xiaodao-spreader 0.1.38 → 0.1.41

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.
Files changed (40) hide show
  1. package/README.ZH.md +67 -49
  2. package/README.md +77 -58
  3. package/dist/style.css +1 -1
  4. package/dist/types/components/spreader/components/dropdown.vue.d.ts +3 -1
  5. package/dist/types/components/spreader/components/pickers/border-picker.vue.d.ts +16 -2
  6. package/dist/types/components/spreader/components/pickers/calc-picker.vue.d.ts +1 -1
  7. package/dist/types/components/spreader/components/pickers/color-palette.vue.d.ts +17 -0
  8. package/dist/types/components/spreader/components/pickers/color-picker.vue.d.ts +1 -1
  9. package/dist/types/components/spreader/components/pickers/data-validation-dropdown.vue.d.ts +1 -1
  10. package/dist/types/components/spreader/components/pickers/insert-function-dialog.vue.d.ts +1 -1
  11. package/dist/types/components/spreader/components/pickers/merge-picker.vue.d.ts +1 -1
  12. package/dist/types/components/spreader/components/pickers/number-format-dialog.vue.d.ts +1 -1
  13. package/dist/types/components/spreader/components/pickers/outline-picker.vue.d.ts +1 -1
  14. package/dist/types/components/spreader/components/pickers/sort-confirm-dialog.vue.d.ts +1 -1
  15. package/dist/types/components/spreader/components/pickers/sort-picker.vue.d.ts +1 -1
  16. package/dist/types/components/spreader/components/spreader.vue.d.ts +15 -5
  17. package/dist/types/components/spreader/components/toolbar.vue.d.ts +10 -2
  18. package/dist/types/components/spreader/composables/borders-merge.d.ts +19 -3
  19. package/dist/types/components/spreader/composables/core-state.d.ts +9 -1
  20. package/dist/types/components/spreader/composables/find-replace.d.ts +5 -0
  21. package/dist/types/components/spreader/composables/interactions.d.ts +5 -0
  22. package/dist/types/components/spreader/composables/sheets-ops.d.ts +5 -0
  23. package/dist/types/components/spreader/composables/undo-styles.d.ts +5 -0
  24. package/dist/types/components/spreader/core/border-color.d.ts +138 -0
  25. package/dist/types/components/spreader/core/border-icon.d.ts +43 -0
  26. package/dist/types/components/spreader/core/border-pool.d.ts +1 -1
  27. package/dist/types/components/spreader/core/border-resolve.d.ts +12 -3
  28. package/dist/types/components/spreader/core/border-style.d.ts +24 -0
  29. package/dist/types/components/spreader/core/constants.d.ts +1 -2
  30. package/dist/types/components/spreader/core/model-dims.d.ts +19 -0
  31. package/dist/types/components/spreader/core/notes.d.ts +4 -0
  32. package/dist/types/components/spreader/core/sort-icon.d.ts +25 -0
  33. package/dist/types/components/spreader/core/style-pool.d.ts +1 -1
  34. package/dist/types/components/spreader/core/theme.d.ts +5 -0
  35. package/dist/types/components/spreader/core/types.d.ts +14 -4
  36. package/dist/xiaodao-spreader.es.js +8347 -7759
  37. package/dist/xiaodao-spreader.umd.js +9 -9
  38. package/package.json +1 -1
  39. /package/dist/types/components/spreader/components/{data-validation-input-message.vue.d.ts → pickers/data-validation-input-message.vue.d.ts} +0 -0
  40. /package/dist/types/components/spreader/composables/{useFloatMenuPosition.d.ts → float-menu-position.d.ts} +0 -0
@@ -1,9 +1,9 @@
1
- (function(bl,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(bl=typeof globalThis<"u"?globalThis:bl||self,t(bl.XiaoDaoSpreader={},bl.Vue))})(this,function(bl,t){"use strict";const jr="",di={"zh-CN":{insert:"插入",delete:"删除",rename:"重命名",moveLeft:"左移",moveRight:"右移",cut:"剪切",copy:"复制",paste:"粘贴",addSheet:"新建工作表",sheetList:"工作表列表",moveSheetLeft:"左移",moveSheetRight:"右移",scrollUp:"向上滚动",scrollDown:"向下滚动",scrollLeft:"向左滚动",scrollRight:"向右滚动",calculate:"计算",sum:"求和",avg:"平均值",count:"计数",undo:"撤销",redo:"重做",paintFormat:"格式刷",clearFormat:"清除格式",fontFamily:"字体",fontSize:"字号",fontSizeIncrease:"增大字号",fontSizeDecrease:"减小字号",bold:"加粗",italic:"斜体",underline:"下划线",strikethrough:"删除线",fontColor:"文字颜色",fillColor:"填充颜色",borders:"边框",hAlign:"水平对齐",vAlign:"垂直对齐",alignLeft:"左端对齐",alignCenter:"居中对齐",alignRight:"右端对齐",alignTop:"顶端对齐",alignMiddle:"垂直居中",alignBottom:"底端对齐",wrap:"自动换行",mergeCells:"合并单元格",mergeCenter:"合并后居中",mergeAcross:"跨越合并",unmergeCells:"取消合并单元格",borderBottom:"下框线",borderTop:"上框线",borderLeft:"左框线",borderRight:"右框线",borderNone:"无框线",borderAll:"所有框线",borderOuter:"外框线",borderThickOuter:"粗外框线",fontDefault:"默认",rowHeight:"行高",colWidth:"列宽",autoRowHeight:"自动行高",defaultColWidth:"默认列宽",sort:"排序",sortAsc:"升序排序",sortDesc:"降序排序",sortReminderTitle:"排序提醒",sortReminderMessage:"选定区域的左侧或右侧还有相邻数据,这些数据未被选中,将不参与排序。是否将其一并纳入排序?",sortExpandSelection:"扩展选定区域",sortCurrentSelection:"仅对选定区域排序",insertFunctionTitle:"插入函数",insertFunctionSelectLabel:"函数",insertFunctionPlaceholder:"请选择函数",insertFunctionSearchPlaceholder:"搜索函数",insertFunctionFormulaLabel:"公式",insertFunctionBtn:"插入",fnDescSum:"计算单元格区域中所有数值的和",fnDescAverage:"计算单元格区域中数值的算术平均值",fnDescCount:"统计单元格区域中包含数值的单元格个数",fnDescIf:"根据指定条件判断真假,返回对应的两个值之一",fnDescVlookup:"在区域首列查找指定值,返回同一行中指定列的值",fnDescConcatenate:"将多个文本连接合并为一个文本",fnDescMax:"返回单元格区域中所有数值的最大值",fnDescMin:"返回单元格区域中所有数值的最小值",fnDescSin:"返回给定角度(弧度)的正弦值",fnDescSumif:"对区域中满足指定条件的单元格对应的数值求和",fnDescPmt:"计算基于固定利率及等额分期付款的贷款每期还款额",fnDescStdev:"估算基于样本的标准偏差(忽略文本与逻辑值)",ok:"确定",cancel:"取消",dimNumberError:"请输入数字",dimRangeError:"请输入 {min}~{max} 之间的数值",colorAutomatic:"自动",colorNoFill:"无填充",colorWhite:"白色",colorBlack:"黑色",colorLightGray:"浅灰",colorLightBlue:"浅蓝",colorLightOrange:"浅橙",colorLightYellow:"浅黄",colorLightGreen:"浅绿",colorPaleBlue:"淡蓝",colorPaleOrange:"淡橙",colorPaleYellow:"淡黄",colorPaleGreen:"淡绿",colorSilver:"银色",colorSkyBlue:"天蓝",colorCoral:"珊瑚",colorGold:"金色",colorMint:"薄荷",colorGray:"灰色",colorMediumBlue:"中蓝",colorOrange:"橙色",colorAmber:"琥珀",colorMediumGreen:"中绿",colorDarkGray:"深灰",colorRoyalBlue:"宝蓝",colorRed:"红色",colorDarkGold:"深金",colorDarkGreen:"深绿",colorCharcoal:"炭灰",colorDeepBlue:"深蓝",colorDarkRed:"深红",colorOlive:"橄榄",colorForest:"森林",colorSlate:"石板灰",colorNavy:"藏青",colorCrimson:"绯红",colorDarkOlive:"深橄榄",colorDeepForest:"深林",colorDarkSlate:"深石板灰",colorMidnight:"午夜蓝",colorMaroon:"栗色",colorCoffee:"咖啡色",colorEvergreen:"常青",colorDarkNavy:"深藏青",colorDarkMaroon:"深栗",colorDarkCoffee:"深咖",colorInkGreen:"墨绿",numberFormat:"数字格式",nfGeneral:"常规",nfText:"文本",nfNumber:"数字",nfPercent:"百分比",nfScientific:"科学计数法",nfAccounting:"会计专用",nfFinancial:"财务数值",nfCurrency:"货币",nfCurrencyRounded:"货币取整",nfDate:"日期",nfTime:"时间",nfDateTime:"日期和时间",nfDuration:"持续时间",nfCustom:"其他数字格式…",nfMixed:"混合",nfIncreaseDecimals:"增加小数位数",nfDecreaseDecimals:"减少小数位数",nfDialogTitle:"设置单元格格式",nfCategory:"分类",nfCatCustom:"自定义",nfDecimals:"小数位数",nfThousands:"使用千位分隔符",nfSymbol:"货币符号",nfDateFormat:"日期格式",nfTimeFormat:"时间格式",nfCustomCode:"自定义格式代码",nfPreview:"预览",nfPreviewSample:"示例",find:"查找",findReplace:"查找和替换",findPlaceholder:"查找内容",replacePlaceholder:"替换为",findPrev:"上一个",findNext:"下一个",replace:"替换",replaceAll:"全部替换",findScope:"范围",findOptions:"查找选项",scopeSheet:"当前工作表",scopeWorkbook:"整个工作簿",scopeSelection:"当前选区",matchCase:"区分大小写",matchEntireCell:"完整匹配",findNoResult:"未找到",findNeedSelection:"请先选择范围",findReplacedAll:"已替换 {n} 处",findClose:"关闭",freezePane:"冻结窗格",freezePanes:"冻结窗格",freezeFirstRow:"冻结首行",freezeFirstCol:"冻结首列",unfreezePanes:"取消冻结",freezeToRow:"冻结至此行",freezeToCol:"冻结至此列",filter:"筛选",clearFilter:"清除筛选",cancelFilter:"取消",filterSearchPlaceholder:"搜索",filterSelectAll:"全选",filterClearAll:"清除全部",filterOk:"确定",filterBlank:"空白",filterNonBlank:"非空白",filterText:"文本筛选",filterNumber:"数字筛选",filterDate:"日期筛选",filterEquals:"等于",filterNotEquals:"不等于",filterContains:"包含",filterNotContains:"不包含",filterStartsWith:"开头是",filterEndsWith:"结尾是",filterGreaterThan:"大于",filterGreaterThanOrEqual:"大于等于",filterLessThan:"小于",filterLessThanOrEqual:"小于等于",filterBetween:"介于",filterAnd:"与",filterCustom:"自定义筛选",filterNoData:"无数据",filterFilteredCount:"共 {n} 项",filterActive:"筛选中",filterByValue:"按此值筛选",filterByThisColumn:"筛选此列",outlineGroup:"分组",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",dimNumberError:"Please enter a number",dimRangeError:"Please enter a value between {min} and {max}",colorAutomatic:"Automatic",colorNoFill:"No Fill",colorWhite:"White",colorBlack:"Black",colorLightGray:"Light Gray",colorLightBlue:"Light Blue",colorLightOrange:"Light Orange",colorLightYellow:"Light Yellow",colorLightGreen:"Light Green",colorPaleBlue:"Pale Blue",colorPaleOrange:"Pale Orange",colorPaleYellow:"Pale Yellow",colorPaleGreen:"Pale Green",colorSilver:"Silver",colorSkyBlue:"Sky Blue",colorCoral:"Coral",colorGold:"Gold",colorMint:"Mint",colorGray:"Gray",colorMediumBlue:"Medium Blue",colorOrange:"Orange",colorAmber:"Amber",colorMediumGreen:"Medium Green",colorDarkGray:"Dark Gray",colorRoyalBlue:"Royal Blue",colorRed:"Red",colorDarkGold:"Dark Gold",colorDarkGreen:"Dark Green",colorCharcoal:"Charcoal",colorDeepBlue:"Deep Blue",colorDarkRed:"Dark Red",colorOlive:"Olive",colorForest:"Forest",colorSlate:"Slate",colorNavy:"Navy",colorCrimson:"Crimson",colorDarkOlive:"Dark Olive",colorDeepForest:"Deep Forest",colorDarkSlate:"Dark Slate",colorMidnight:"Midnight",colorMaroon:"Maroon",colorCoffee:"Coffee",colorEvergreen:"Evergreen",colorDarkNavy:"Dark Navy",colorDarkMaroon:"Dark Maroon",colorDarkCoffee:"Dark Coffee",colorInkGreen:"Ink Green",numberFormat:"Number Format",nfGeneral:"General",nfText:"Text",nfNumber:"Number",nfPercent:"Percentage",nfScientific:"Scientific",nfAccounting:"Accounting",nfFinancial:"Financial",nfCurrency:"Currency",nfCurrencyRounded:"Currency Rounded",nfDate:"Date",nfTime:"Time",nfDateTime:"Date & Time",nfDuration:"Duration",nfCustom:"Other Number Formats…",nfMixed:"Mixed",nfIncreaseDecimals:"Increase Decimal",nfDecreaseDecimals:"Decrease Decimal",nfDialogTitle:"Format Cells",nfCategory:"Category",nfCatCustom:"Custom",nfDecimals:"Decimal places",nfThousands:"Use 1000 separator",nfSymbol:"Currency symbol",nfDateFormat:"Date format",nfTimeFormat:"Time format",nfCustomCode:"Custom format code",nfPreview:"Preview",nfPreviewSample:"Sample",find:"Find",findReplace:"Find & Replace",findPlaceholder:"Find what",replacePlaceholder:"Replace with",findPrev:"Previous",findNext:"Next",replace:"Replace",replaceAll:"Replace All",findScope:"Scope",findOptions:"Find options",scopeSheet:"Current sheet",scopeWorkbook:"Entire workbook",scopeSelection:"Current selection",matchCase:"Match case",matchEntireCell:"Match entire cell",findNoResult:"No results",findNeedSelection:"Select a range first",findReplacedAll:"Replaced {n} occurrence(s)",findClose:"Close",freezePane:"Freeze Panes",freezePanes:"Freeze Panes",freezeFirstRow:"Freeze First Row",freezeFirstCol:"Freeze First Column",unfreezePanes:"Unfreeze Panes",freezeToRow:"Freeze to Row",freezeToCol:"Freeze to Column",filter:"Filter",clearFilter:"Clear Filter",cancelFilter:"Cancel",filterSearchPlaceholder:"Search",filterSelectAll:"Select All",filterClearAll:"Clear All",filterOk:"OK",filterBlank:"Blanks",filterNonBlank:"Non-blanks",filterText:"Text Filters",filterNumber:"Number Filters",filterDate:"Date Filters",filterEquals:"Equals",filterNotEquals:"Does Not Equal",filterContains:"Contains",filterNotContains:"Does Not Contain",filterStartsWith:"Begins With",filterEndsWith:"Ends With",filterGreaterThan:"Greater Than",filterGreaterThanOrEqual:"Greater Than Or Equal To",filterLessThan:"Less Than",filterLessThanOrEqual:"Less Than Or Equal To",filterBetween:"Between",filterAnd:"And",filterCustom:"Custom Filter",filterNoData:"No data",filterFilteredCount:"{n} items",filterActive:"Filtering",filterByValue:"Filter by This Value",filterByThisColumn:"Filter This Column",outlineGroup:"Group",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 w(e,o){var n;return((n=di[e])==null?void 0:n[o])??o}const Nl='-apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif',nl=10,ui=[{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'}],fi=[{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}],mi='<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>',pi='<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>',hi='<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>',gi='<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>',bi='<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>',yi='<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>',Ci=[{value:"left",labelKey:"alignLeft",icon:mi},{value:"center",labelKey:"alignCenter",icon:pi},{value:"right",labelKey:"alignRight",icon:hi}],wi=[{value:"top",labelKey:"alignTop",icon:gi},{value:"middle",labelKey:"alignMiddle",icon:bi},{value:"bottom",labelKey:"alignBottom",icon:yi}],vi=[{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>'}],ki={bg:"#f4f4f4",gridBg:"#ffffff",headerBg:"#e8e8e8",headerBorder:"#c8c8c8",headerText:"#444",headerSep:"#b0b0b0",cornerBg:"#e0e0e0",gridLine:"#e0e0e0",selectionBg:"rgba(0, 120, 215, 0.12)",activeCellBorder:"#0078d7",outlineGroupBg1:"#d5e2f8",outlineGroupBg2:"#f0e2f6",cellText:"#1a1a1a",scrollTrack:"rgba(0,0,0,0.08)",scrollThumb:"rgba(0,0,0,0.25)",formulaBarBg:"#f0f0f0",formulaBarBorder:"#c8c8c8",formulaBarLabelText:"#333",formulaBarLabelBg:"#fff",formulaBarLabelBorder:"#c0c0c0",formulaBarInputBg:"#fff",formulaBarInputBorder:"#c0c0c0",formulaBarInputText:"#1a1a1a",formulaBarInputFocusBorder:"#0078d7",formulaBarInputFocusShadow:"rgba(0, 120, 215, 0.3)",wrapperBg:"#e8e8e8",cellEditorBorder:"#0078d7",cellEditorText:"#1a1a1a",cellEditorBg:"#fff",cellEditorShadow:"#0078d7",tabBarBg:"#e8e8e8",tabBarBorder:"#c0c0c0",tabActiveBg:"#ffffff",tabActiveText:"#1a1a1a",tabActiveBorder:"#0078d7",tabInactiveBg:"#dfdfdf",tabInactiveText:"#666",tabInactiveBorder:"transparent",tabHoverBg:"#e0e0e0",tabAddBtnColor:"#555",tabAddBtnHoverBg:"#d0d0d0",tabScrollBtnColor:"#888",tabScrollBtnHoverBg:"#d0d0d0",scrollbarThumb:"rgba(0,0,0,0.25)",scrollbarThumbHover:"rgba(0,0,0,0.4)",scrollBtnBg:"#e8e8e8",scrollBtnColor:"#666",scrollBtnHoverBg:"#d0d0d0",scrollBtnActiveBg:"#c0c0c0",scrollTrackBg:"rgba(0,0,0,0.06)",toolbarBg:"#f7f7f7",toolbarBorder:"#d8d8d8",toolbarBtnColor:"#444",toolbarBtnHoverBg:"#e6e6e6",toolbarBtnDisabledColor:"#b0b0b0",toolbarBtnActiveColor:"#0078d7",findMatchBg:"rgba(255, 213, 79, 0.45)",findActiveBg:"rgba(255, 179, 0, 0.75)"},Ei={bg:"#1e1e1e",gridBg:"#252526",headerBg:"#252525",headerBorder:"#3e3e3e",headerText:"#999",headerSep:"#3e3e3e",cornerBg:"#2a2a2a",gridLine:"#3e3e3e",selectionBg:"rgba(0, 120, 215, 0.25)",activeCellBorder:"#0078d7",outlineGroupBg1:"#33405f",outlineGroupBg2:"#47335f",cellText:"#d4d4d4",scrollTrack:"rgba(255,255,255,0.06)",scrollThumb:"rgba(255,255,255,0.2)",formulaBarBg:"#2d2d2d",formulaBarBorder:"#3e3e3e",formulaBarLabelText:"#ccc",formulaBarLabelBg:"#3c3c3c",formulaBarLabelBorder:"#555",formulaBarInputBg:"#3c3c3c",formulaBarInputBorder:"#555",formulaBarInputText:"#d4d4d4",formulaBarInputFocusBorder:"#0078d7",formulaBarInputFocusShadow:"rgba(0, 120, 215, 0.4)",wrapperBg:"#1e1e1e",cellEditorBorder:"#0078d7",cellEditorText:"#d4d4d4",cellEditorBg:"#3c3c3c",cellEditorShadow:"#0078d7",tabBarBg:"#2a2a2a",tabBarBorder:"#3e3e3e",tabActiveBg:"#1e1e1e",tabActiveText:"#e0e0e0",tabActiveBorder:"#0078d7",tabInactiveBg:"#333333",tabInactiveText:"#888",tabInactiveBorder:"transparent",tabHoverBg:"#3a3a3a",tabAddBtnColor:"#999",tabAddBtnHoverBg:"#3a3a3a",tabScrollBtnColor:"#777",tabScrollBtnHoverBg:"#3a3a3a",scrollbarThumb:"rgba(255,255,255,0.2)",scrollbarThumbHover:"rgba(255,255,255,0.35)",scrollBtnBg:"#2d2d2d",scrollBtnColor:"#999",scrollBtnHoverBg:"#3d3d3d",scrollBtnActiveBg:"#4d4d4d",scrollTrackBg:"rgba(255,255,255,0.05)",toolbarBg:"#2a2a2a",toolbarBorder:"#3e3e3e",toolbarBtnColor:"#ccc",toolbarBtnHoverBg:"#3a3a3a",toolbarBtnDisabledColor:"#666",toolbarBtnActiveColor:"#4ea1ff",findMatchBg:"rgba(255, 213, 79, 0.35)",findActiveBg:"rgba(255, 179, 0, 0.6)"};function ut(e){let o="",n=e;do o=String.fromCharCode(65+n%26)+o,n=Math.floor(n/26)-1;while(n>=0);return o}function lr(e){let o=0;for(let n=0;n<e.length;n++)o=o*26+(e.toUpperCase().charCodeAt(n)-64);return o-1}function Bl(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 or(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 Hl(e,o){return`${e},${o}`}function hn(e,o,n){const l=e.match(/^\$?([A-Z]+)\$?(\d+)$/i);if(!l)return null;const a=lr(l[1]),i=parseInt(l[2],10)-1;return a<0||a>=o||i<0||i>=n?null:{col:a,row:i}}function yl(e,o){if(!o)return{x:0,y:0};const n=o.getBoundingClientRect();return{x:e.clientX-n.left,y:e.clientY-n.top}}function qn(e){const o=window.innerWidth,n=window.innerHeight,l=(e==null?void 0:e.getBoundingClientRect())??null;return l?{left:Math.max(0,Math.min(o,l.left)),right:Math.max(0,Math.min(o,l.right)),top:Math.max(0,Math.min(n,l.top)),bottom:Math.max(0,Math.min(n,l.bottom))}:{left:0,right:o,top:0,bottom:n}}function ro(e){return window.innerWidth-e}const ll="__nf_custom__",jn="",ol="",kn="@",xo="__NF_INVALID__",rr=2958465,ar=0;function En(e){return e==null||e===""?!0:e.toUpperCase()==="GENERAL"}function ir(e){return e==="zh-CN"?"¥":"$"}function Ri(e){return e.replace(/\*/g,"").replace(/_.|_\b/g,"")}function Yr(e){return e.replace(/"([^"]*)"/g,"$1")}function Si(e){let o=e,n;const l=o.match(/^\[([^\]]+)\]/);l&&(n=l[1].toLowerCase(),o=o.slice(l[0].length)),o=Ri(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:n};let c=-1;for(let ie=o.length-1;ie>=0;ie--){const me=o[ie];if(me==="0"||me==="#"||me==="?"||me==="E"){c=ie;break}}c<0&&(c=r);const d=r>0?o.slice(0,r):"",b=c<o.length-1?o.slice(c+1):"",C=o.slice(r,c+1),v=/[0#?]/.test(C),h=C.includes(",");let R=C.replace(/,/g,"");if(a){const ie=R.search(/E/i);ie>=0&&(R=R.slice(0,ie))}const F=R.indexOf("."),Q=F>=0?R.slice(0,F):R,K=F>=0?R.slice(F+1):"",Ee=(K.match(/[0#?]/g)||[]).length,ee=(K.match(/0/g)||[]).length,pe=(Q.match(/0/g)||[]).length;return{hasDigits:v,decimals:Ee,minDecimals:ee,minIntDigits:pe,thousands:h,scale:i?100:1,scientific:a,prefix:d,suffix:b,color:n}}function Mi(e){const o=[];let n=!1;const l=/\[h\]|\[mm\]|\[ss\]|yyyy|yy|y|mmmm|mmm|mm|m|dddd|ddd|dd|d|hh|h|ss|s|AM\/PM|am\/pm|"[^"]*"|\/|-|:|\s+|[^\s]/g;let a;for(;(a=l.exec(e))!==null;){const i=a[0];switch(i){case"[h]":n=!0,o.push({type:"hour",len:0});break;case"[mm]":n=!0,o.push({type:"minute",len:2});break;case"[ss]":n=!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(n?{type:"minute",len:4}:{type:"monthName",len:4});break;case"mmm":o.push(n?{type:"minute",len:3}:{type:"monthName",len:3});break;case"mm":o.push(n?{type:"minute",len:2}:{type:"month",len:2});break;case"m":o.push(n?{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:Yr(i),len:0}):o.push({type:"literal",text:i,len:0})}}return{tokens:o,isDuration:n}}const Xr=new Map;function Ni(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:c}=Mi(i);return{kind:c?"duration":"date",sections:[],tokens:r,isDuration:c,raw:e}}return{kind:"number",sections:e.split(";").map(i=>Si(i)),tokens:[],isDuration:!1,raw:e}}function rl(e){const o=Xr.get(e);if(o)return o;const n=Ni(e);return Xr.set(e,n),n}function Zr(e,o,n,l,a){const i=Math.pow(10,o),r=Math.round((e+Number.EPSILON)*i)/i,c=r<0,d=Math.abs(r);let C=new Intl.NumberFormat("en-US",{useGrouping:l,minimumIntegerDigits:a,minimumFractionDigits:o,maximumFractionDigits:o}).format(d);if(n<o&&o>0){const h=C.indexOf(".");if(h>=0){const B=C.substring(0,h);let R=C.substring(h+1);R=R.replace(/0+$/,""),R.length<n&&(R=R+"0".repeat(n-R.length)),C=R?`${B}.${R}`:B}}return`${c?"-":""}${C}`}function Jr(e,o){if(e===0)return(o>0?"0."+"0".repeat(o):"0")+"E+00";const n=Math.floor(Math.log10(Math.abs(e))),l=e/Math.pow(10,n),a=Zr(l,o,o,!1,1),i=(n>=0?"+":"-")+String(Math.abs(n)).padStart(2,"0");return`${a}E${i}`}function Bi(e,o,n){if(!n.hasDigits)return Yr(n.prefix+n.suffix);const l=n.scale===100?e*100:e,a=n.scientific?Jr(l,n.decimals):Zr(l,n.decimals,n.minDecimals,n.thousands,n.minIntDigits);return o+n.prefix+a+n.suffix}function xi(e,o){const n=o.sections;if(n.length===0)return String(e);let l,a,i="";return e>0?(l=n[0],a=e):e<0?n[1]?(l=n[1],a=-e):(l=n[0],a=-e,i="-"):(l=n[2]??n[0],a=0),Bi(a,i,l)}function Ti(e){return new Date((e-25569)*864e5)}const Vi=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],Di=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],Qr=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],Fi=["January","February","March","April","May","June","July","August","September","October","November","December"],Ii=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],ea=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function Wl(e,o){return String(e).padStart(o,"0")}function Oi(e,o,n,l){const a=e.getUTCFullYear(),i=e.getUTCMonth()+1,r=e.getUTCDate(),c=e.getUTCDay(),d=n==="zh-CN";let b="",C=!1;for(const v of o)switch(v.type){case"literal":b+=v.text??"";break;case"year":b+=v.len>=4?String(a):String(a%100).padStart(2,"0");break;case"month":b+=Wl(C?e.getUTCMinutes():i,v.len);break;case"monthName":b+=v.len>=4?d?Vi[i-1]:Fi[i-1]:d?Di[i-1]:Ii[i-1];break;case"day":b+=Wl(r,v.len);break;case"weekday":b+=v.len>=4?d?Qr[c]:ea[c]:d?Qr[c].slice(2):ea[c].slice(0,3);break;case"hour":{let h=e.getUTCHours();if(v.len===0){const B=Math.floor(l*86400);h=Math.floor(B/3600)}b+=String(h),C=!0;break}case"minute":b+=Wl(e.getUTCMinutes(),v.len);break;case"second":b+=Wl(e.getUTCSeconds(),v.len);break;case"ampm":{const h=e.getUTCHours();b+=h<12?d?"上午":"AM":d?"下午":"PM";break}}return b}function Ai(e,o){const n=Math.floor(e*86400),l=Math.floor(n/3600),a=Math.floor(n%3600/60),i=n%60;let r="";for(const c of o)switch(c.type){case"literal":r+=c.text??"";break;case"hour":r+=String(l);break;case"minute":r+=Wl(a,c.len||2);break;case"second":r+=Wl(i,c.len||2);break;default:r+=""}return r}function Li(e){if(e==="")return e;const o=Number(e);if(!isNaN(o)&&e.trim()!==""){const n=Math.abs(o);return n!==0&&(n>=1e15||n<1e-9)?Jr(o,9):e}return e}function An(e,o,n){if(En(o))return Li(e);if(o==null||o===kn)return e;const l=rl(o);if(l.kind==="date"||l.kind==="duration"){const i=Number(e);if(!isFinite(i))return e;if(l.kind==="date"){if(i<ar||i>rr)return xo}else if(i<0)return xo;return l.kind==="duration"?Ai(i,l.tokens):Oi(Ti(i),l.tokens,n,i)}const a=Number(e);return isNaN(a)?e:xi(a,l)}const $i=["general","text","number","percent","scientific","accounting","financial","currency","currencyRounded","date","time","dateTime","duration","custom"];function sr(e,o){if(o===kn||o==="@")return!1;if(En(o)){if(e==null||e===""||e.trim()==="")return!1;const l=Number(e);return!Number.isNaN(l)&&Number.isFinite(l)}const n=rl(o);return!!(n.kind==="number"&&ta(n))}function ta(e){return e.sections.some(o=>o.hasDigits)}function na(e){if(e==null||En(e)||e===kn||e==="@")return!1;const o=rl(e);return!!(o.kind==="date"||o.kind==="duration"||o.kind==="number"&&ta(o))}function la(e,o){if(o==null||En(o)||o===kn||o==="@")return!1;const n=rl(o),l=Number(e);return Number.isFinite(l)?n.kind==="date"?l<ar||l>rr:n.kind==="duration"?l<0:!1:!1}const cr=30,dr=0;function Ln(e){if(e==null||e===""||e.trim()==="")return!1;const o=Number(e);return!Number.isNaN(o)&&Number.isFinite(o)}function oa(e,o){if(e==null||e===jn||En(e))return Ln(o);if(e===kn)return!1;const n=rl(e);return n.kind==="date"||n.kind==="duration"?!1:n.sections.some(l=>l.hasDigits)}function zi(e){if(!Ln(e))return 0;const o=String(Number(e));return o.indexOf(".")<0||/e/i.test(o)?0:o.slice(o.indexOf(".")+1).length}function _i(e,o){if(!oa(e,o))return-1;if(e==null||e===jn||En(e))return zi(o);const l=rl(e).sections.find(a=>a.hasDigits);return l?l.decimals:-1}function Hi(e,o){let n=0;const l=/\[[^\]]*\]/g;let a;for(;(a=l.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 d=-1;for(let Q=r.length-1;Q>=0;Q--){const K=r[Q];if(K==="0"||K==="#"||K==="?"||K==="E"){d=Q;break}}if(d<c)return e;const b=r.slice(c,d+1),C=b.search(/E[+-]/i),v=C>=0?b.slice(0,C):b,h=v.indexOf("."),B=h>=0?(v.slice(h+1).match(/[0#?]/g)||[]).length:0;if(B===o)return e;let R;if(h<0)R=o>0?v+"."+"0".repeat(o):v;else if(o>B)R=v+"0".repeat(o-B);else{let Q=B-o;const K=v.split("");for(let Ee=K.length-1;Ee>=0&&Q>0;Ee--){const ee=K[Ee];(ee==="0"||ee==="#"||ee==="?")&&(K.splice(Ee,1),Q--)}R=K.join(""),o===0&&R.endsWith(".")&&(R=R.slice(0,-1))}const F=R+(C>=0?b.slice(C):"");return i+r.slice(0,c)+F+r.slice(d+1)}function Wi(e,o){if(!Number.isInteger(o)||o<dr||o>cr||e===jn)return null;if(e==null||En(e))return o>0?"0."+"0".repeat(o):"0";if(e===kn)return null;const n=rl(e);return n.kind==="date"||n.kind==="duration"||!n.sections.some(l=>l.hasDigits)?null:e.split(";").map(l=>Hi(l,o)).join(";")}const ur=["¥","$","€","£"];function ra(e,o){if(e==null||e===jn)return e??ol;if(En(e))return ol;if(e===kn||e==="@")return kn;const n=ir(o),l=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=`${n}#,##0.00;(${n}#,##0.00);${n}"-"`,r="#,##0.00;[Red](#,##0.00)";if(aa(o).some(B=>B.value===e))return e;const d=e.replace(/\[[^\]]*\]/gi,B=>/^\[(h|mm|ss)\]$/i.test(B)?B:"");if(/\[(h|mm|ss)\]/i.test(d)&&!/[yd]/i.test(d))return"[h]:mm:ss";const b=/[yd]/i.test(d),C=/h|s|AM\/PM/i.test(d);if(b&&C)return a;if(b||/AM\/PM/i.test(d))return l;if(C)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 v=ur.find(B=>e.startsWith(B));if(v)return e.includes("(")?i:/\.\d/.test(e.slice(v.length))?n+"#,##0.00":n+"#,##0";const h=rl(e);return h.kind==="number"&&h.sections.some(B=>B.hasDigits)?"#,##0.00":ll}function Ui(e,o){return new Date(Date.UTC(e,o,0)).getUTCDate()}function Pi(e,o,n){const l=Date.UTC(e,o-1,n)/864e5+25569;return l<=60?l-1:l}function Yn(e,o,n=new Date){const l=e.trim();if(!l||l.startsWith("=")||Ln(l))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 c(h){const B=/^(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/.exec(h);if(!B)return null;const R=Number(B[1]),F=Number(B[2]),Q=B[3]!==void 0?Number(B[3]):0;return R>23||F>59||Q>59?null:(R*3600+F*60+Q)/86400}function d(h){let B=/^(\d{4})[-/](\d{1,2})[-/](\d{1,2})$/.exec(h),R,F,Q;if(B)R=Number(B[1]),F=Number(B[2]),Q=Number(B[3]);else if(B=/^(\d{4})年(\d{1,2})月(\d{1,2})日$/.exec(h))R=Number(B[1]),F=Number(B[2]),Q=Number(B[3]);else if(B=/^(\d{1,2})[-/](\d{1,2})[-/](\d{4})$/.exec(h))F=Number(B[1]),Q=Number(B[2]),R=Number(B[3]);else if(B=/^(\d{1,2})[-/](\d{1,2})$/.exec(h))R=n.getUTCFullYear(),F=Number(B[1]),Q=Number(B[2]);else return null;if(R<1900||R>9999||F<1||F>12||Q<1||Q>Ui(R,F))return null;const K=Pi(R,F,Q);return K>=ar&&K<=rr?K:null}const b=c(l);if(b!==null)return{serial:b,format:r};const C=/^(.+?)[T ](\d{1,2}:\d{1,2}(?::\d{1,2})?)$/.exec(l);if(C){const h=d(C[1].trim()),B=c(C[2]);if(h!==null&&B!==null)return{serial:h+B,format:i}}const v=d(l);return v!==null?{serial:v,format:a}:null}function To(e,o){const n=e.trim();if(!n||n.startsWith("=")||!(n.includes(",")||n.includes("%")||ur.some(Ee=>n.startsWith(Ee)))||Yn(n,o))return null;const a=ur.find(Ee=>n.startsWith(Ee)),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,d=r[2].replace(/,/g,""),b=r[3],C=(r[4]??"")==="%",v=b?b.length:0,h=+(d+(b?"."+b:""));if(!Number.isFinite(h))return null;const R=i.includes(",")?"#,##0":"0",F=v>0?"."+"0".repeat(v):"",Q=(a??"")+R+F+(C?"%":"");let K=h*c;return C&&(K=K/100),K=Math.round(K*1e12)/1e12,{num:K,format:Q}}function Ki(e,o,n,l){const a=ir(e),i=l?"#,##0":"0",r=n>0?"."+"0".repeat(n):"",c=i+r;switch(o){case"general":return"";case"text":return kn;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+(l?"#,##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 aa(e){const o=ir(e);return[{label:w(e,"nfGeneral"),value:ol},{label:w(e,"nfText"),value:kn},{label:w(e,"nfNumber"),value:"#,##0.00"},{label:w(e,"nfPercent"),value:"0.00%"},{label:w(e,"nfScientific"),value:"0.00E+00"},{label:w(e,"nfAccounting"),value:`${o}#,##0.00;(${o}#,##0.00);${o}"-"`},{label:w(e,"nfFinancial"),value:"#,##0.00;[Red](#,##0.00)"},{label:w(e,"nfCurrency"),value:o+"#,##0.00"},{label:w(e,"nfCurrencyRounded"),value:o+"#,##0"},{label:w(e,"nfDate"),value:e==="zh-CN"?'yyyy"年"m"月"d"日"':"m/d/yyyy"},{label:w(e,"nfTime"),value:"h:mm:ss"},{label:w(e,"nfDateTime"),value:e==="zh-CN"?'yyyy"年"m"月"d"日" h:mm:ss':"m/d/yyyy h:mm:ss"},{label:w(e,"nfDuration"),value:"[h]:mm:ss"},{label:w(e,"nfCustom"),value:ll}]}const Gi=["title"],qi=["innerHTML"],ji={class:"sp-dropdown__value"},Yi=["disabled"],Xi=["placeholder"],Zi=["disabled","onClick"],Ji=["innerHTML"],Qi={class:"sp-dropdown__item-label"},es={key:2,class:"sp-dropdown__empty"},ts=["disabled"],ns=t.defineComponent({__name:"dropdown",props:{modelValue:{},options:{},width:{default:"auto"},menuWidth:{default:void 0},visibleCount:{default:8},title:{default:""},modelOpen:{type:Boolean,default:void 0},hideTrigger:{type:Boolean,default:!1},align:{default:"left"},triggerEl:{default:null},fallbackLabel:{default:""},searchable:{type:Boolean,default:!1},searchPlaceholder:{default:""},triggerIcon:{default:""},triggerLabel:{default:""},boundaryEl:{default:null}},emits:["update:modelValue","change","update:modelOpen"],setup(e,{emit:o}){const n=e,l=o,a=t.ref(!1),i=t.ref(0),r=t.ref(null),c=t.ref(null),d=t.ref(null),b=t.ref({top:0,up:!1}),C=t.ref(void 0),v=t.ref(0),h=t.ref(!1),B=t.ref(""),R=t.ref(null),F=t.computed(()=>n.options.find(ce=>String(ce.value)===String(n.modelValue))),Q=t.computed(()=>n.menuWidth!==void 0?n.menuWidth:C.value),K=t.computed(()=>{if(!n.searchable||!B.value.trim())return n.options;const ce=B.value.trim().toLowerCase();return n.options.filter(Fe=>String(Fe.label??"").toLowerCase().includes(ce))}),Ee=t.computed(()=>K.value.length>0),ee=t.computed(()=>Math.min(n.visibleCount,K.value.length)),pe=t.computed(()=>K.value.slice(i.value,i.value+ee.value)),ie=t.computed(()=>i.value>0),me=t.computed(()=>i.value+ee.value<K.value.length),se=t.computed(()=>K.value.length>ee.value);function Se(ce){i.value=Math.max(0,Math.min(K.value.length-ee.value,i.value+ce))}function Xe(){const ce=n.triggerEl??r.value;if(!ce)return;const Fe=ce.getBoundingClientRect();C.value=Fe.width,a.value=!0,n.searchable&&(B.value=""),n.modelOpen!==void 0&&l("update:modelOpen",!0);const V=Fe.bottom+4,J=qn(n.boundaryEl);n.align==="right"?b.value={right:ro(Math.min(Fe.right,J.right)),top:V,up:!1}:b.value={left:Math.max(J.left,Fe.left),top:V,up:!1};const re=K.value.findIndex(ae=>String(ae.value)===String(n.modelValue));i.value=re>=0?Math.max(0,Math.min(re-Math.floor(ee.value/2),K.value.length-ee.value)):0,n.searchable&&t.nextTick(()=>{var ae;return(ae=R.value)==null?void 0:ae.focus()}),t.nextTick(()=>{const ae=n.triggerEl??r.value;if(!ae)return;const oe=ae.getBoundingClientRect(),ve=d.value;if(!ve)return;const Me=ve.offsetHeight,q=J.bottom-oe.bottom-8,$=oe.top-J.top-8,Y=q<Me&&$>0,W=Y?oe.top-Me-4:oe.bottom+4,fe=Math.min(J.top+8,oe.bottom+4),Ae=Math.max(fe,Math.min(J.bottom-Me-8,W));n.align==="right"?b.value={right:ro(Math.min(oe.right,J.right)),top:Ae,up:Y}:b.value={left:Math.max(J.left,oe.left),top:Ae,up:Y}})}function Qe(){a.value=!1,B.value="",n.modelOpen!==void 0&&l("update:modelOpen",!1)}function X(){a.value?Qe():Xe()}function rt(ce){ce.disabled||(l("update:modelValue",ce.value),l("change",ce.value),Qe())}function O(ce){var V,J;if(!a.value)return;const Fe=ce.target;(V=r.value)!=null&&V.contains(Fe)||(J=d.value)!=null&&J.contains(Fe)||Qe()}function I(ce){a.value&&(ce.preventDefault(),Se(ce.deltaY>0?1:-1))}t.watch(a,ce=>{t.nextTick(()=>{var Fe,V;ce?((Fe=c.value)==null||Fe.addEventListener("wheel",I,{passive:!1}),document.addEventListener("keydown",j)):((V=c.value)==null||V.removeEventListener("wheel",I),document.removeEventListener("keydown",j))})});function j(ce){a.value&&ce.key==="Escape"&&Qe()}t.watch(()=>n.modelOpen,ce=>{ce!==void 0&&ce!==a.value&&(ce?Xe():Qe())});function we(ce){a.value&&(v.value=ce.touches[0].clientY,h.value=!0)}function ze(ce){if(!a.value||!h.value)return;const Fe=ce.touches[0].clientY-v.value;Math.abs(Fe)>5&&(Se(Fe<0?1:-1),v.value=ce.touches[0].clientY)}function le(){h.value=!1}function xe(ce){ce.key==="Escape"&&(ce.stopPropagation(),Qe())}return t.onMounted(()=>{document.addEventListener("pointerdown",O),window.addEventListener("resize",Qe),window.addEventListener("scroll",Qe,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",O),document.removeEventListener("keydown",j),window.removeEventListener("resize",Qe),window.removeEventListener("scroll",Qe,!0)}),(ce,Fe)=>{var V,J,re,ae,oe;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:X},[(V=F.value)!=null&&V.icon||e.triggerIcon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__icon",innerHTML:((J=F.value)==null?void 0:J.icon)||e.triggerIcon},null,8,qi)):t.createCommentVNode("",!0),t.createElementVNode("span",ji,t.toDisplayString((re=F.value)!=null&&re.icon||e.triggerIcon?((ae=F.value)==null?void 0:ae.label)??e.triggerLabel:((oe=F.value)==null?void 0:oe.label)??e.fallbackLabel),1),Fe[5]||(Fe[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,Gi)),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[a.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:d,class:t.normalizeClass(["sp-dropdown__menu",{"sp-dropdown__menu--up":b.value.up}]),style:t.normalizeStyle({left:b.value.left!==void 0?b.value.left+"px":void 0,right:b.value.right!==void 0?b.value.right+"px":void 0,top:b.value.top+"px",minWidth:Q.value!==void 0?typeof Q.value=="number"?Q.value+"px":Q.value:void 0}),onKeydown:xe,onMousedown:Fe[4]||(Fe[4]=t.withModifiers(()=>{},["prevent"]))},[se.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!ie.value}]),disabled:!ie.value,onClick:Fe[0]||(Fe[0]=ve=>Se(-1))},[...Fe[6]||(Fe[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,Yi)):t.createCommentVNode("",!0),e.searchable?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:1,ref_key:"searchInputRef",ref:R,"onUpdate:modelValue":Fe[1]||(Fe[1]=ve=>B.value=ve),class:"sp-dropdown__search",type:"text",placeholder:e.searchPlaceholder,onMousedown:Fe[2]||(Fe[2]=t.withModifiers(()=>{},["stop"]))},null,40,Xi)),[[t.vModelText,B.value]]):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:c,class:"sp-dropdown__list",onTouchstart:we,onTouchmove:ze,onTouchend:le},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(pe.value,ve=>(t.openBlock(),t.createElementBlock("button",{key:String(ve.value),type:"button",class:t.normalizeClass(["sp-dropdown__item",{"sp-dropdown__item--active":!ve.disabled&&String(ve.value)===String(e.modelValue),"sp-dropdown__item--disabled":ve.disabled}]),disabled:ve.disabled,onClick:Me=>rt(ve)},[ve.icon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__item-icon",innerHTML:ve.icon},null,8,Ji)):t.createCommentVNode("",!0),t.createElementVNode("span",Qi,t.toDisplayString(ve.label),1)],10,Zi))),128))],544),e.searchable&&!Ee.value?(t.openBlock(),t.createElementBlock("div",es," 无匹配 ")):t.createCommentVNode("",!0),se.value?(t.openBlock(),t.createElementBlock("button",{key:3,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!me.value}]),disabled:!me.value,onClick:Fe[3]||(Fe[3]=ve=>Se(1))},[...Fe[7]||(Fe[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,ts)):t.createCommentVNode("",!0)],38)):t.createCommentVNode("",!0)]),_:1})]))],4)}}}),Dt=(e,o)=>{const n=e.__vccOpts||e;for(const[l,a]of o)n[l]=a;return n},Kt=Dt(ns,[["__scopeId","data-v-85ba0ec8"]]);function xl(){const e=t.ref({top:0,up:!1});function o(n,l,a){const i=qn(l),r=n.getBoundingClientRect(),c=ro(Math.min(r.right,i.right));if(!a){e.value={right:c,top:r.bottom+4,up:!1};return}const d=a.offsetHeight,b=i.bottom-r.bottom-8,C=r.top-i.top-8,v=b<d&&C>0,h=v?r.top-d-4:r.bottom+4,B=Math.min(i.top+8,r.bottom+4),R=Math.max(B,Math.min(i.bottom-d-8,h));e.value={right:c,top:R,up:v}}return{pos:e,place:o}}const ls=["title","onClick"],Vo=Dt(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:n}){const l=e,a=n,i=[[{key:"colorAutomatic",value:""},{key:"colorLightBlue",value:"#DEEBF7"},{key:"colorLightOrange",value:"#FCE4D6"},{key:"colorLightYellow",value:"#FFE79A"},{key:"colorLightGreen",value:"#E2EFDA"}],[{key:"colorLightGray",value:"#F2F2F2"},{key:"colorPaleBlue",value:"#BDD7EE"},{key:"colorPaleOrange",value:"#F8CBAD"},{key:"colorPaleYellow",value:"#FFD966"},{key:"colorPaleGreen",value:"#C6EFCE"}],[{key:"colorSilver",value:"#D9D9D9"},{key:"colorSkyBlue",value:"#9BC2E6"},{key:"colorCoral",value:"#F4B183"},{key:"colorGold",value:"#FFC000"},{key:"colorMint",value:"#A9D18E"}],[{key:"colorGray",value:"#BFBFBF"},{key:"colorMediumBlue",value:"#6FA8DC"},{key:"colorOrange",value:"#ED7D31"},{key:"colorAmber",value:"#F1C232"},{key:"colorMediumGreen",value:"#70AD47"}],[{key:"colorDarkGray",value:"#A5A5A5"},{key:"colorRoyalBlue",value:"#4A86E8"},{key:"colorRed",value:"#E06666"},{key:"colorDarkGold",value:"#BF8F00"},{key:"colorDarkGreen",value:"#548235"}],[{key:"colorCharcoal",value:"#808080"},{key:"colorDeepBlue",value:"#2E75B6"},{key:"colorDarkRed",value:"#CC4125"},{key:"colorOlive",value:"#806000"},{key:"colorForest",value:"#375623"}],[{key:"colorSlate",value:"#595959"},{key:"colorNavy",value:"#1F4E79"},{key:"colorCrimson",value:"#993300"},{key:"colorDarkOlive",value:"#5C4500"},{key:"colorDeepForest",value:"#2D6A4F"}],[{key:"colorDarkSlate",value:"#404040"},{key:"colorMidnight",value:"#17375E"},{key:"colorMaroon",value:"#5A1E00"},{key:"colorCoffee",value:"#3D3000"},{key:"colorEvergreen",value:"#1B4332"}],[{key:"colorBlack",value:"#000000"},{key:"colorDarkNavy",value:"#0C2340"},{key:"colorDarkMaroon",value:"#2E0A00"},{key:"colorDarkCoffee",value:"#1F1800"},{key:"colorInkGreen",value:"#081C15"}]],r=[[{key:"colorNoFill",value:""},{key:"colorLightBlue",value:"#DEEBF7"},{key:"colorLightOrange",value:"#FCE4D6"},{key:"colorLightYellow",value:"#FFE79A"},{key:"colorLightGreen",value:"#E2EFDA"}],[{key:"colorWhite",value:"#FFFFFF"},{key:"colorPaleBlue",value:"#BDD7EE"},{key:"colorPaleOrange",value:"#F8CBAD"},{key:"colorPaleYellow",value:"#FFD966"},{key:"colorPaleGreen",value:"#C6EFCE"}],[{key:"colorLightGray",value:"#F2F2F2"},{key:"colorSkyBlue",value:"#9BC2E6"},{key:"colorCoral",value:"#F4B183"},{key:"colorGold",value:"#FFC000"},{key:"colorMint",value:"#A9D18E"}],[{key:"colorSilver",value:"#D9D9D9"},{key:"colorMediumBlue",value:"#6FA8DC"},{key:"colorOrange",value:"#ED7D31"},{key:"colorAmber",value:"#F1C232"},{key:"colorMediumGreen",value:"#70AD47"}],[{key:"colorGray",value:"#BFBFBF"},{key:"colorRoyalBlue",value:"#4A86E8"},{key:"colorRed",value:"#E06666"},{key:"colorDarkGold",value:"#BF8F00"},{key:"colorDarkGreen",value:"#548235"}],[{key:"colorDarkGray",value:"#A5A5A5"},{key:"colorDeepBlue",value:"#2E75B6"},{key:"colorDarkRed",value:"#CC4125"},{key:"colorOlive",value:"#806000"},{key:"colorForest",value:"#375623"}],[{key:"colorCharcoal",value:"#808080"},{key:"colorNavy",value:"#1F4E79"},{key:"colorCrimson",value:"#993300"},{key:"colorDarkOlive",value:"#5C4500"},{key:"colorDeepForest",value:"#2D6A4F"}],[{key:"colorSlate",value:"#595959"},{key:"colorMidnight",value:"#17375E"},{key:"colorMaroon",value:"#5A1E00"},{key:"colorCoffee",value:"#3D3000"},{key:"colorEvergreen",value:"#1B4332"}],[{key:"colorDarkSlate",value:"#404040"},{key:"colorDarkNavy",value:"#0C2340"},{key:"colorDarkMaroon",value:"#2E0A00"},{key:"colorDarkCoffee",value:"#1F1800"},{key:"colorInkGreen",value:"#081C15"}]],c=t.computed(()=>l.colorKey==="fill"?r:i);function d(ee){return w(l.locale,ee)}function b(ee){const pe=l.currentColor;return!pe&&!ee?!0:pe?pe.toLowerCase()===ee.toLowerCase():!1}const C=t.ref(!1),v=t.ref(null),h=t.ref(null),{pos:B,place:R}=xl();t.watch(()=>l.modelOpen,ee=>{ee!==void 0&&ee!==C.value&&(ee?Q():K())});function F(ee){const pe=v.value,ie=h.value,me=ee.target;pe&&pe.contains(me)||ie&&ie.contains(me)||K()}function Q(){const ee=l.triggerEl??v.value;ee&&(C.value=!0,l.modelOpen!==void 0&&a("update:modelOpen",!0),R(ee,l.boundaryEl),t.nextTick(()=>{const pe=l.triggerEl??v.value;if(!pe)return;const ie=h.value;ie&&(R(pe,l.boundaryEl,ie),document.addEventListener("pointerdown",F))}))}function K(){C.value=!1,l.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",F)}function Ee(ee){a("update:modelValue",ee),a("change",ee),K()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",F)}),o({open:C,openMenu:Q,close:K}),(ee,pe)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:v,class:"color-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[C.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:h,class:"color-picker__menu",style:t.normalizeStyle({left:t.unref(B).left!==void 0?t.unref(B).left+"px":void 0,right:t.unref(B).right!==void 0?t.unref(B).right+"px":void 0,top:t.unref(B).top+"px"}),onMousedown:pe[0]||(pe[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.value,(ie,me)=>(t.openBlock(),t.createElementBlock("div",{key:me,class:"color-picker__row"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ie,se=>(t.openBlock(),t.createElementBlock("button",{key:se.value,class:t.normalizeClass(["color-picker__swatch",{"color-picker__swatch--selected":b(se.value)}]),title:d(se.key),style:t.normalizeStyle({background:se.value||"transparent",border:se.value?"1px solid rgba(0,0,0,0.15)":"1px dashed #999"}),onClick:Se=>Ee(se.value)},null,14,ls))),128))]))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-f6c2d2cf"]]),os=["title","onClick"],rs={viewBox:"0 0 30 30",class:"border-picker__icon"},as=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],is={class:"border-picker__label"},ss=Dt(t.defineComponent({__name:"border-picker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},currentBorder:{default:"none"},triggerEl:{default:null},boundaryEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:o,emit:n}){const l=e,a=n,i=[{key:"bottom",i18nKey:"borderBottom"},{key:"top",i18nKey:"borderTop"},{key:"left",i18nKey:"borderLeft"},{key:"right",i18nKey:"borderRight"},{key:"none",i18nKey:"borderNone"},{key:"all",i18nKey:"borderAll"},{key:"outer",i18nKey:"borderOuter"},{key:"thickOuter",i18nKey:"borderThickOuter"}],r=[{name:"top",x1:4,y1:4,x2:26,y2:4},{name:"bottom",x1:4,y1:26,x2:26,y2:26},{name:"left",x1:4,y1:4,x2:4,y2:26},{name:"right",x1:26,y1:4,x2:26,y2:26},{name:"vMid",x1:15,y1:4,x2:15,y2:26},{name:"hMid",x1:4,y1:15,x2:26,y2:15}],c={bottom:["bottom"],top:["top"],left:["left"],right:["right"],none:[],all:["top","bottom","left","right","vMid","hMid"],outer:["top","bottom","left","right"],thickOuter:["top","bottom","left","right"]},d={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function b(ee,pe){return d[ee].includes(pe)?"thick":c[ee].includes(pe)?"solid":"dashed"}const C=t.ref(!1),v=t.ref(null),h=t.ref(null),{pos:B,place:R}=xl();t.watch(()=>l.modelOpen,ee=>{ee!==void 0&&ee!==C.value&&(ee?Q():K())});function F(ee){const pe=v.value,ie=h.value,me=ee.target;pe&&pe.contains(me)||ie&&ie.contains(me)||K()}function Q(){const ee=l.triggerEl??v.value;ee&&(C.value=!0,l.modelOpen!==void 0&&a("update:modelOpen",!0),R(ee,l.boundaryEl),t.nextTick(()=>{const pe=l.triggerEl??v.value;if(!pe)return;const ie=h.value;ie&&(R(pe,l.boundaryEl,ie),document.addEventListener("pointerdown",F))}))}function K(){C.value=!1,l.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",F)}function Ee(ee){a("change",ee),K()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",F)}),o({open:C,openMenu:Q,close:K}),(ee,pe)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:v,class:"border-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[C.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:h,class:"border-picker__menu",style:t.normalizeStyle({left:t.unref(B).left!==void 0?t.unref(B).left+"px":void 0,right:t.unref(B).right!==void 0?t.unref(B).right+"px":void 0,top:t.unref(B).top+"px"}),onMousedown:pe[0]||(pe[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,ie=>t.createElementVNode("button",{key:ie.key,class:"border-picker__item",title:t.unref(w)(e.locale,ie.i18nKey),onClick:me=>Ee(ie.key)},[(t.openBlock(),t.createElementBlock("svg",rs,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(r,me=>t.createElementVNode("line",{key:me.name,x1:me.x1,y1:me.y1,x2:me.x2,y2:me.y2,stroke:"currentColor","stroke-width":b(ie.key,me.name)==="thick"?3:1.5,"stroke-dasharray":b(ie.key,me.name)==="dashed"?"0 4":"none","stroke-linecap":b(ie.key,me.name)==="dashed"?"round":"square"},null,8,as)),64))])),t.createElementVNode("span",is,t.toDisplayString(t.unref(w)(e.locale,ie.i18nKey)),1)],8,os)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-5c3ebafb"]]),cs=["title","onClick"],ds={viewBox:"0 0 1024 1024",class:"sort-picker__icon",fill:"none",stroke:"currentColor","stroke-width":"64","stroke-linecap":"round","stroke-linejoin":"round"},us=["x1","y1","x2","y2"],fs=["d"],ms={class:"sort-picker__label"},ps=Dt(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:n}){const l=e,a=n,i=[{key:"asc",i18nKey:"sortAsc"},{key:"desc",i18nKey:"sortDesc"}],r=[{name:"bar1",x1:96,y1:224,x2:352,y2:224},{name:"bar2",x1:96,y1:512,x2:512,y2:512},{name:"bar3",x1:96,y1:800,x2:672,y2:800}],c={asc:"M832 800V288M672 448l160-160 160 160",desc:"M832 224v512M672 576l160 160 160-160"},d=t.ref(!1),b=t.ref(null),C=t.ref(null),{pos:v,place:h}=xl();t.watch(()=>l.modelOpen,K=>{K!==void 0&&K!==d.value&&(K?R():F())});function B(K){const Ee=b.value,ee=C.value,pe=K.target;Ee&&Ee.contains(pe)||ee&&ee.contains(pe)||F()}function R(){const K=l.triggerEl??b.value;K&&(d.value=!0,l.modelOpen!==void 0&&a("update:modelOpen",!0),h(K,l.boundaryEl),t.nextTick(()=>{const Ee=l.triggerEl??b.value;if(!Ee)return;const ee=C.value;ee&&(h(Ee,l.boundaryEl,ee),document.addEventListener("pointerdown",B))}))}function F(){d.value=!1,l.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",B)}function Q(K){a("change",K),F()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",B)}),o({open:d,openMenu:R,close:F}),(K,Ee)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:b,class:"sort-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[d.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:C,class:"sort-picker__menu",style:t.normalizeStyle({left:t.unref(v).left!==void 0?t.unref(v).left+"px":void 0,right:t.unref(v).right!==void 0?t.unref(v).right+"px":void 0,top:t.unref(v).top+"px"}),onMousedown:Ee[0]||(Ee[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,ee=>t.createElementVNode("button",{key:ee.key,class:"sort-picker__item",title:t.unref(w)(e.locale,ee.i18nKey),onClick:pe=>Q(ee.key)},[(t.openBlock(),t.createElementBlock("svg",ds,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(r,pe=>t.createElementVNode("line",{key:pe.name,x1:pe.x1,y1:pe.y1,x2:pe.x2,y2:pe.y2},null,8,us)),64)),t.createElementVNode("path",{d:c[ee.key]},null,8,fs)])),t.createElementVNode("span",ms,t.toDisplayString(t.unref(w)(e.locale,ee.i18nKey)),1)],8,cs)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-ef7c7f4c"]]),hs={key:0,class:"outline-picker__sep"},gs=["onClick"],bs={class:"outline-picker__label"},ys=Dt(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:n}){const l=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),d=t.ref(null),{pos:b,place:C}=xl();t.watch(()=>l.modelOpen,F=>{F!==void 0&&F!==r.value&&(F?h():B())});function v(F){const Q=c.value,K=d.value,Ee=F.target;Q&&Q.contains(Ee)||K&&K.contains(Ee)||B()}function h(){const F=l.triggerEl??c.value;F&&(r.value=!0,l.modelOpen!==void 0&&a("update:modelOpen",!0),C(F,l.boundaryEl),t.nextTick(()=>{const Q=l.triggerEl??c.value;if(!Q)return;const K=d.value;K&&(C(Q,l.boundaryEl,K),document.addEventListener("pointerdown",v))}))}function B(){r.value=!1,l.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",v)}function R(F){l.axis&&(a("action",`${F}-${l.axis}`),B())}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",v)}),o({open:r,openMenu:h,close:B}),(F,Q)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:c,class:"outline-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:d,class:"outline-picker__menu",style:t.normalizeStyle({left:t.unref(b).left!==void 0?t.unref(b).left+"px":void 0,right:t.unref(b).right!==void 0?t.unref(b).right+"px":void 0,top:t.unref(b).top+"px"}),onMousedown:Q[0]||(Q[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,K=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:K.key},[K.sep?(t.openBlock(),t.createElementBlock("div",hs)):(t.openBlock(),t.createElementBlock("div",{key:1,class:"outline-picker__item",onClick:Ee=>R(K.key)},[t.createElementVNode("span",bs,t.toDisplayString(t.unref(w)(e.locale,K.i18nKey)),1)],8,gs))],64))),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-9ba8ba10"]]),Cs=["title","onClick"],ws=["innerHTML"],vs={class:"merge-picker__label"},ks=Dt(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:n}){const l=e,a=n,i=t.ref(!1),r=t.ref(null),c=t.ref(null),{pos:d,place:b}=xl();t.watch(()=>l.modelOpen,R=>{R!==void 0&&R!==i.value&&(R?v():h())});function C(R){const F=r.value,Q=c.value,K=R.target;F&&F.contains(K)||Q&&Q.contains(K)||h()}function v(){const R=l.triggerEl??r.value;R&&(i.value=!0,l.modelOpen!==void 0&&a("update:modelOpen",!0),b(R,l.boundaryEl),t.nextTick(()=>{const F=l.triggerEl??r.value;if(!F)return;const Q=c.value;Q&&(b(F,l.boundaryEl,Q),document.addEventListener("pointerdown",C))}))}function h(){i.value=!1,l.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",C)}function B(R){a("change",R),h()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",C)}),o({open:i,openMenu:v,close:h}),(R,F)=>(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(d).left!==void 0?t.unref(d).left+"px":void 0,right:t.unref(d).right!==void 0?t.unref(d).right+"px":void 0,top:t.unref(d).top+"px"}),onMousedown:F[0]||(F[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(vi),Q=>(t.openBlock(),t.createElementBlock("button",{key:Q.key,class:"merge-picker__item",title:t.unref(w)(e.locale,Q.labelKey),onClick:K=>B(Q.key)},[t.createElementVNode("span",{class:"merge-picker__icon",innerHTML:Q.icon},null,8,ws),t.createElementVNode("span",vs,t.toDisplayString(t.unref(w)(e.locale,Q.labelKey)),1)],8,Cs))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-b44e2e92"]]),Es=["title","disabled"],Rs={class:"cf-menu-trigger__label"},Ss=["disabled"],Ms=["disabled"],Ns=["disabled"],Bs=["disabled"],xs=["disabled"],Ts=["disabled"],Vs=["disabled"],Ds=["onClick"],Fs=["disabled"],Is=["disabled"],Os=["disabled"],As=["disabled"],Ls=Dt(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 n=e,l=o,a=t.ref(null),i=t.ref(null),r=t.ref(null),c=t.ref(null),d=t.ref(null),b=t.ref(!1),C=t.ref(null),v=t.ref("right"),h=t.ref("right"),B=t.ref(!1),R=t.ref(!1),F=t.ref(!1),Q=t.ref(!1),K=t.ref(!1),Ee=t.ref(!1),ee=t.ref(!1),pe=t.ref(!1),{pos:ie,place:me}=xl(),se=t.ref({top:0}),Se=t.ref({top:0});let Xe;const Qe=[{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 X(){l("update:modelOpen",!b.value)}t.watch(()=>n.modelOpen,Y=>{Y&&!b.value?rt():!Y&&b.value&&O()});function rt(){const Y=i.value;Y&&(b.value=!0,C.value=null,me(Y,n.boundaryEl),t.nextTick(()=>{var fe;const W=(fe=r.value)==null?void 0:fe.closest(".cf-menu");W&&(me(Y,n.boundaryEl,W),j())}))}function O(){b.value=!1,clearTimeout(Xe),C.value=null}function I(){l("update:modelOpen",!1)}function j(){const Y=r.value;Y&&(F.value=Y.scrollTop>1,Q.value=Y.scrollTop+Y.clientHeight<Y.scrollHeight-1)}function we(Y){const W=r.value;W&&(W.scrollTop=Math.max(0,Math.min(W.scrollHeight-W.clientHeight,W.scrollTop+Y*30)))}function ze(Y){const W=Y==="highlight"?c.value:d.value;if(!W)return;const fe=W.scrollTop>1,Ae=W.scrollTop+W.clientHeight<W.scrollHeight-1;Y==="highlight"?(K.value=fe,Ee.value=Ae):(ee.value=fe,pe.value=Ae)}function le(Y,W){const fe=Y==="highlight"?c.value:d.value;fe&&(fe.scrollTop=Math.max(0,Math.min(fe.scrollHeight-fe.clientHeight,fe.scrollTop+W*30)))}function xe(Y,W){Y&&(Y.scrollHeight<=Y.clientHeight||(W.preventDefault(),Y.scrollTop=Math.max(0,Math.min(Y.scrollHeight-Y.clientHeight,Y.scrollTop+W.deltaY))))}function ce(Y){xe(r.value,Y),j()}function Fe(Y){xe(c.value,Y),ze("highlight")}function V(Y){xe(d.value,Y),ze("clear")}function J(Y){var fe,Ae,Re,_e,Ge,Le;if(!b.value)return;const W=Y.target;(fe=a.value)!=null&&fe.contains(W)||(Ae=r.value)!=null&&Ae.contains(W)||(_e=(Re=c.value)==null?void 0:Re.closest(".cf-submenu-wrap"))!=null&&_e.contains(W)||(Le=(Ge=d.value)==null?void 0:Ge.closest(".cf-submenu-wrap"))!=null&&Le.contains(W)||I()}function re(Y,W){clearTimeout(Xe),C.value=Y,t.nextTick(()=>{var et,N;const fe=(W==null?void 0:W.currentTarget)instanceof HTMLElement?W.currentTarget:null;if(!fe)return;const Ae=fe.getBoundingClientRect(),Re=Y==="highlight"?(et=c.value)==null?void 0:et.closest(".cf-submenu-wrap"):(N=d.value)==null?void 0:N.closest(".cf-submenu-wrap");if(!Re)return;const _e=qn(n.boundaryEl),Ge=Re.offsetWidth,Le=Re.offsetHeight,ht=Ae.right+Ge+8>_e.right;let bt="right";ht&&(bt="left");const je=Ae.top+Le>_e.bottom-8,Bt=je?Ae.bottom+5-Le:Ae.top-5,Yt=Math.min(_e.top+8,Bt),Vt=Math.max(Yt,Math.min(_e.bottom-Le-8,Bt)),zt=bt==="right"?{left:Ae.right+4,top:Vt}:{right:ro(Ae.left-4),top:Vt};Y==="highlight"?(v.value=bt,B.value=je,se.value=zt):(h.value=bt,R.value=je,Se.value=zt),ze(Y)})}function ae(){clearTimeout(Xe),Xe=setTimeout(()=>{C.value=null},150)}function oe(){clearTimeout(Xe)}function ve(Y){l("preset",Y),I()}function Me(){l("new-rule"),I()}function q(){l("manage"),I()}function $(Y){l("clear",Y),I()}return t.onMounted(()=>{document.addEventListener("pointerdown",J),window.addEventListener("resize",I),window.addEventListener("scroll",I,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",J),window.removeEventListener("resize",I),window.removeEventListener("scroll",I,!0)}),(Y,W)=>(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(w)(e.locale,"conditionalFormat"),disabled:!e.hasSelection,onClick:X},[W[22]||(W[22]=t.createStaticVNode('<svg class="cf-menu-trigger__icon" viewBox="0 0 1097 1024" version="1.1" fill="currentColor" data-v-f75544d4><path d="M877.714286 52.809143V487.862857h-73.142857V125.952H73.142857v585.142857h247.661714v73.142857H0v-731.428571z" data-v-f75544d4></path><path d="M841.142857 267.702857v73.142857H36.571429v-73.142857zM287.451429 457.142857v73.142857H36.571429v-73.142857z" data-v-f75544d4></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-f75544d4></path><path d="M877.421714 637.952v73.142857H568.539429v-73.142857zM877.421714 784.237714v73.142857H568.539429v-73.142857z" data-v-f75544d4></path></svg>',1)),t.createElementVNode("span",Rs,t.toDisplayString(t.unref(w)(e.locale,"conditionalFormat")),1),W[23]||(W[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,Es),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"cf-pop"},{default:t.withCtx(()=>[b.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"cf-menu",style:t.normalizeStyle({...e.themeVars,right:t.unref(ie).right+"px",top:t.unref(ie).top+"px"}),onClick:W[8]||(W[8]=t.withModifiers(()=>{},["stop"])),onMousedown:W[9]||(W[9]=t.withModifiers(()=>{},["prevent"]))},[F.value||Q.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["cf-menu__nav",{"cf-menu__nav--disabled":!F.value}]),disabled:!F.value,onClick:W[0]||(W[0]=fe=>we(-1))},[...W[24]||(W[24]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 662.613a32 32 0 0 0 45.227 0L512 375.893l286.72 286.72a32 32 0 1 0 45.227-45.226L534.613 307.053a32 32 0 0 0-45.226 0L134.827 617.387a32 32 0 0 0 0 45.226z"})],-1)])],10,Ss)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"menuRef",ref:r,class:"cf-menu__body",onScroll:j,onWheelPassive:ce},[t.createElementVNode("div",{class:"cf-menu__item cf-menu__item--sub",onMouseenter:W[1]||(W[1]=fe=>re("highlight",fe)),onMouseleave:ae},[t.createElementVNode("span",null,t.toDisplayString(t.unref(w)(e.locale,"cfHighlightRules")),1),W[25]||(W[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),W[27]||(W[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:W[2]||(W[2]=fe=>e.hasSelection&&ve("blank"))},t.toDisplayString(t.unref(w)(e.locale,"cfBlank")),11,Ms),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["cf-menu__item",{"cf-menu__item--disabled":!e.hasSelection}]),disabled:!e.hasSelection,onClick:W[3]||(W[3]=fe=>e.hasSelection&&ve("notBlank"))},t.toDisplayString(t.unref(w)(e.locale,"cfNotBlank")),11,Ns),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["cf-menu__item",{"cf-menu__item--disabled":!e.hasSelection}]),disabled:!e.hasSelection,onClick:W[4]||(W[4]=fe=>e.hasSelection&&ve("duplicate"))},t.toDisplayString(t.unref(w)(e.locale,"cfDuplicate")),11,Bs),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["cf-menu__item",{"cf-menu__item--disabled":!e.hasSelection}]),disabled:!e.hasSelection,onClick:W[5]||(W[5]=fe=>e.hasSelection&&ve("unique"))},t.toDisplayString(t.unref(w)(e.locale,"cfUnique")),11,xs),W[28]||(W[28]=t.createElementVNode("div",{class:"cf-menu__sep"},null,-1)),t.createElementVNode("button",{type:"button",class:"cf-menu__item",onClick:Me},t.toDisplayString(t.unref(w)(e.locale,"cfNewRule")),1),t.createElementVNode("button",{type:"button",class:"cf-menu__item",onClick:q},t.toDisplayString(t.unref(w)(e.locale,"cfManageRules")),1),t.createElementVNode("div",{class:"cf-menu__item cf-menu__item--sub",onMouseenter:W[6]||(W[6]=fe=>re("clear",fe)),onMouseleave:ae},[t.createElementVNode("span",null,t.toDisplayString(t.unref(w)(e.locale,"cfClearRules")),1),W[26]||(W[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),F.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:W[7]||(W[7]=fe=>we(1))},[...W[29]||(W[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,Ts)):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(()=>[b.value&&C.value==="highlight"?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["cf-submenu-wrap",{"cf-submenu-wrap--left":v.value==="left","cf-submenu-wrap--up":B.value}]),style:t.normalizeStyle({...e.themeVars,left:se.value.left!==void 0?se.value.left+"px":void 0,right:se.value.right!==void 0?se.value.right+"px":void 0,top:se.value.top+"px"}),onClick:W[13]||(W[13]=t.withModifiers(()=>{},["stop"])),onMousedown:W[14]||(W[14]=t.withModifiers(()=>{},["prevent"])),onMouseenter:oe,onMouseleave:ae},[K.value||Ee.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["cf-subnav",{"cf-subnav--disabled":!K.value}]),disabled:!K.value,onClick:W[10]||(W[10]=fe=>le("highlight",-1))},[...W[30]||(W[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,Vs)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"highlightSubRef",ref:c,class:"cf-submenu",onScroll:W[11]||(W[11]=fe=>ze("highlight")),onWheelPassive:Fe},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(Qe,fe=>t.createElementVNode("button",{key:fe.type,type:"button",class:"cf-menu__subitem",onClick:Ae=>ve(fe.type)},t.toDisplayString(t.unref(w)(e.locale,fe.key)),9,Ds)),64))],544),K.value||Ee.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["cf-subnav",{"cf-subnav--disabled":!Ee.value}]),disabled:!Ee.value,onClick:W[12]||(W[12]=fe=>le("highlight",1))},[...W[31]||(W[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,Fs)):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(()=>[b.value&&C.value==="clear"?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["cf-submenu-wrap",{"cf-submenu-wrap--left":h.value==="left","cf-submenu-wrap--up":R.value}]),style:t.normalizeStyle({...e.themeVars,left:Se.value.left!==void 0?Se.value.left+"px":void 0,right:Se.value.right!==void 0?Se.value.right+"px":void 0,top:Se.value.top+"px"}),onClick:W[20]||(W[20]=t.withModifiers(()=>{},["stop"])),onMousedown:W[21]||(W[21]=t.withModifiers(()=>{},["prevent"])),onMouseenter:oe,onMouseleave:ae},[ee.value||pe.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["cf-subnav",{"cf-subnav--disabled":!ee.value}]),disabled:!ee.value,onClick:W[15]||(W[15]=fe=>le("clear",-1))},[...W[32]||(W[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,Is)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"clearSubRef",ref:d,class:"cf-submenu",onScroll:W[18]||(W[18]=fe=>ze("clear")),onWheelPassive:V},[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["cf-menu__subitem",{"cf-menu__item--disabled":!e.hasSelection}]),disabled:!e.hasSelection,onClick:W[16]||(W[16]=fe=>e.hasSelection&&$("selection"))},t.toDisplayString(t.unref(w)(e.locale,"cfClearSelected")),11,Os),t.createElementVNode("button",{type:"button",class:"cf-menu__subitem",onClick:W[17]||(W[17]=fe=>$("sheet"))},t.toDisplayString(t.unref(w)(e.locale,"cfClearSheet")),1)],544),ee.value||pe.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["cf-subnav",{"cf-subnav--disabled":!pe.value}]),disabled:!pe.value,onClick:W[19]||(W[19]=fe=>le("clear",1))},[...W[33]||(W[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,As)):t.createCommentVNode("",!0)],38)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-f75544d4"]]),$s=["disabled","title","onClick"],zs={class:"calc-picker__label"},_s=Dt(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:n}){const l=e,a=n,i=[{key:"sum",labelKey:"sum"},{key:"avg",labelKey:"avg"},{key:"count",labelKey:"count"}],r=t.ref(!1),c=t.ref(null),d=t.ref(null),{pos:b,place:C}=xl();t.watch(()=>l.modelOpen,F=>{F!==void 0&&F!==r.value&&(F?h():B())});function v(F){const Q=c.value,K=d.value,Ee=F.target;Q&&Q.contains(Ee)||K&&K.contains(Ee)||B()}function h(){const F=l.triggerEl??c.value;F&&(r.value=!0,l.modelOpen!==void 0&&a("update:modelOpen",!0),C(F,l.boundaryEl),t.nextTick(()=>{const Q=l.triggerEl??c.value;if(!Q)return;const K=d.value;K&&(C(Q,l.boundaryEl,K),document.addEventListener("pointerdown",v))}))}function B(){r.value=!1,l.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",v)}function R(F){l.disabled||(a("change",F),B())}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",v)}),o({open:r,openMenu:h,close:B}),(F,Q)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:c,class:"calc-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:d,class:"calc-picker__menu",style:t.normalizeStyle({left:t.unref(b).left!==void 0?t.unref(b).left+"px":void 0,right:t.unref(b).right!==void 0?t.unref(b).right+"px":void 0,top:t.unref(b).top+"px"}),onMousedown:Q[0]||(Q[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,K=>t.createElementVNode("button",{key:K.key,class:t.normalizeClass(["calc-picker__item",{"calc-picker__item--disabled":e.disabled}]),disabled:e.disabled,title:t.unref(w)(e.locale,K.labelKey),onClick:Ee=>R(K.key)},[t.createElementVNode("span",zs,t.toDisplayString(t.unref(w)(e.locale,K.labelKey)),1)],10,$s)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-01c4024a"]]),Hs={class:"tb-item","data-key":"undo"},Ws=["title","disabled"],Us={class:"toolbar-btn__label"},Ps={class:"tb-item","data-key":"redo"},Ks=["title","disabled"],Gs={class:"toolbar-btn__label"},qs={class:"tb-item","data-key":"paint"},js=["title","disabled"],Ys={class:"toolbar-btn__label"},Xs={class:"tb-item","data-key":"clear"},Zs=["title","disabled"],Js={class:"toolbar-btn__label"},Qs={class:"tb-item","data-key":"font"},ec={class:"tb-item","data-key":"fontSize"},tc={class:"toolbar-font-size"},nc=["value","title"],lc=["title"],oc=["title","disabled"],rc=["title","disabled"],ac={class:"tb-item","data-key":"bold"},ic=["title","disabled"],sc={class:"toolbar-btn__label"},cc={class:"tb-item","data-key":"italic"},dc=["title","disabled"],uc={class:"toolbar-btn__label"},fc={class:"tb-item","data-key":"underline"},mc=["title","disabled"],pc={class:"toolbar-btn__label"},hc={class:"tb-item","data-key":"strike"},gc=["title","disabled"],bc={class:"toolbar-btn__label"},yc={class:"tb-item","data-key":"textColor"},Cc={class:"toolbar-split"},wc=["title","disabled"],vc={viewBox:"0 0 1024 1024",fill:"currentColor"},kc=["fill"],Ec={class:"toolbar-btn__label"},Rc=["title","disabled"],Sc={class:"tb-item","data-key":"fillColor"},Mc={class:"toolbar-split"},Nc=["title","disabled"],Bc={viewBox:"0 0 1024 1024",fill:"currentColor"},xc=["fill"],Tc={class:"toolbar-btn__label"},Vc=["title","disabled"],Dc={class:"tb-item","data-key":"border"},Fc={class:"toolbar-split"},Ic=["title","disabled"],Oc={viewBox:"0 0 30 30",fill:"none",stroke:"currentColor"},Ac=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],Lc={class:"toolbar-btn__label"},$c=["title","disabled"],zc={class:"tb-item","data-key":"hAlign"},_c={class:"tb-item","data-key":"vAlign"},Hc={class:"tb-item","data-key":"wrap"},Wc=["title"],Uc={class:"toolbar-btn__label"},Pc={class:"tb-item","data-key":"merge"},Kc={class:"toolbar-split"},Gc=["title","disabled"],qc={class:"toolbar-btn__label"},jc=["title","disabled"],Yc={class:"tb-item","data-key":"numFmt"},Xc={class:"toolbar-number-format-group"},Zc=["title","disabled"],Jc=["title","disabled"],Qc={class:"tb-item","data-key":"calc"},ed={class:"toolbar-split"},td=["title","disabled"],nd={class:"toolbar-btn__label"},ld=["title","disabled"],od={class:"tb-item","data-key":"sort"},rd={class:"toolbar-split"},ad=["title","disabled"],id={viewBox:"0 0 1024 1024",fill:"none",stroke:"currentColor","stroke-width":"64","stroke-linecap":"round","stroke-linejoin":"round"},sd=["x1","y1","x2","y2"],cd=["d"],dd={class:"toolbar-btn__label"},ud=["title","disabled"],fd={class:"tb-item","data-key":"outline"},md=["disabled","title"],pd={class:"toolbar-btn__label"},hd={class:"tb-item","data-key":"filter"},gd=["disabled","title"],bd={class:"toolbar-btn__label"},yd={class:"tb-item","data-key":"freeze"},Cd={class:"tb-item","data-key":"cf"},wd={class:"tb-item","data-key":"dv"},vd=["title"],kd={class:"toolbar-btn__label"},Ed={class:"tb-item","data-key":"find"},Rd=["title"],Sd={class:"toolbar-btn__label"},Md=["disabled"],Nd=["disabled"],ia='<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>',Bd='<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>',xd='<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>',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 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>',fr=2,Vd=6,Dd=34,Fd=Dt(t.defineComponent({__name:"toolbar",props:{locale:{},canUndo:{type:Boolean},canRedo:{type:Boolean},paintFmtActive:{type:Boolean},hasSelection:{type:Boolean},fontFamilyOptions:{},fontSizeOptions:{},selFontFamily:{},selFontSize:{},fontSizeInput:{},fontSizeMenuOpen:{type:Boolean},selFontWeight:{type:Boolean},selFontStyle:{type:Boolean},selUnderline:{type:Boolean},selStrikethrough:{type:Boolean},selTextColor:{},textColorMenuOpen:{type:Boolean},selFillColor:{},fillColorMenuOpen:{type:Boolean},cachedTextColor:{},cachedFillColor:{},borderMenuOpen:{type:Boolean},cachedBorder:{},sortMenuOpen:{type:Boolean},cachedSortOrder:{},canSort:{type:Boolean},outlineMenuOpen:{type:Boolean},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","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:n}){const l=[{name:"top",x1:4,y1:4,x2:26,y2:4},{name:"bottom",x1:4,y1:26,x2:26,y2:26},{name:"left",x1:4,y1:4,x2:4,y2:26},{name:"right",x1:26,y1:4,x2:26,y2:26},{name:"vMid",x1:15,y1:4,x2:15,y2:26},{name:"hMid",x1:4,y1:15,x2:26,y2:15}],a={bottom:["bottom"],top:["top"],left:["left"],right:["right"],none:[],all:["top","bottom","left","right","vMid","hMid"],outer:["top","bottom","left","right"],thickOuter:["top","bottom","left","right"]},i={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function r(et,N){return i[et].includes(N)?"thick":a[et].includes(N)?"solid":"dashed"}const c={none:"borderNone",bottom:"borderBottom",top:"borderTop",left:"borderLeft",right:"borderRight",all:"borderAll",outer:"borderOuter",thickOuter:"borderThickOuter"},d=[{name:"bar1",x1:96,y1:224,x2:352,y2:224},{name:"bar2",x1:96,y1:512,x2:512,y2:512},{name:"bar3",x1:96,y1:800,x2:672,y2:800}],b={asc:"M832 800V288M672 448l160-160 160 160",desc:"M832 224v512M672 576l160 160 160-160"},C=["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"],v=t.ref(null),h=t.ref(null),B=t.ref(null),R=t.ref(null),F=t.ref(null),Q=t.ref(null),K=t.ref(null),Ee=t.ref(null),ee=t.ref(null),pe=t.ref(null),ie=t.ref(null),me=t.ref(new Set),se=t.ref(!1),Se=t.ref(!1),Xe=t.ref(0),Qe=t.ref(!1),X=t.ref(!1),rt=new Map,O=t.computed(()=>me.value.size>0);function I(et){return me.value.has(et)}const j=t.computed(()=>{const et=h.value;return et instanceof HTMLElement?et:void 0});function we(et){return j.value?!I(et):!0}function ze(){for(const et of C){const N=rt.get(et);if(N===void 0||N===0)return!0}return!1}function le(){if(!v.value)return;v.value.querySelectorAll(".tb-item").forEach(N=>{const te=N.dataset.key;if(!te)return;const vt=N.offsetWidth;vt>0?rt.set(te,vt):rt.has(te)||rt.set(te,0)})}function xe(et,N){if(et.size!==N.size)return!1;for(const te of et)if(!N.has(te))return!1;return!0}let ce=0,Fe=0,V=null;function J(){if(ce&&cancelAnimationFrame(ce),Fe>60){V&&clearTimeout(V),V=setTimeout(()=>{Fe=0,J()},500);return}Fe++,ce=requestAnimationFrame(()=>requestAnimationFrame(re))}function re(){if(!v.value)return;const et=v.value.clientWidth-Vd*2;if(et<=0){J();return}Fe=0,(rt.size===0||ze())&&le();let N=0;for(const vt of C)N+=(rt.get(vt)??0)+fr;const te=new Set;if(N>et){const vt=et-Dd-fr;let It=0;for(let Et=0;Et<C.length;Et++){const Sn=C[Et],en=(rt.get(Sn)??0)+fr;if(It+en>vt){for(let Xt=Et;Xt<C.length;Xt++)te.add(C[Xt]);break}It+=en}}xe(te,me.value)||(me.value=te,Xe.value++,te.size===0&&(se.value=!1))}let ae=null;const oe=t.ref(0),ve=t.computed(()=>{const et=B.value,N={position:"fixed",top:"0px",right:"0px"};if(!et)return{...Ge.themeVars,...N};oe.value;const te=et.getBoundingClientRect(),vt=qn(Ge.boundaryEl);return{...Ge.themeVars,position:"fixed",top:`${te.bottom+4}px`,right:`${ro(Math.min(te.right,vt.right))}px`}});function Me(){se.value&&(oe.value++,t.nextTick(()=>re()))}function q(et){var te,vt,It;if(!se.value)return;const N=et.target;(te=N.closest)!=null&&te.call(N,".overflow-menu-wrap")||(vt=B.value)!=null&&vt.contains(N)||(It=N.closest)!=null&&It.call(N,".cf-menu, .sp-dropdown__menu, .color-picker__menu, .outline-picker__menu, .border-picker__menu, .calc-picker__menu, .merge-picker__menu, .sort-picker__menu")||(Se.value=!0,se.value=!1,t.nextTick(()=>{Se.value=!1}))}function $(){se.value=!se.value,se.value&&t.nextTick(Re)}function Y(){se.value=!1,Le("open-data-validation")}function W(){se.value=!1,Le("find")}function fe(){se.value=!1,Le("toggle-filter")}function Ae(){se.value=!1}function Re(){const et=h.value;et&&(Qe.value=et.scrollTop>1,X.value=et.scrollTop+et.clientHeight<et.scrollHeight-1,Bt())}function _e(et){const N=h.value;N&&(N.scrollTop=Math.max(0,Math.min(N.scrollHeight-N.clientHeight,N.scrollTop+et*40)))}o({closeOverflow:Ae}),t.onMounted(()=>{J(),v.value&&(ae=new ResizeObserver(()=>{se.value||J()}),ae.observe(v.value)),document.addEventListener("pointerdown",q,!0),window.addEventListener("resize",Me),window.addEventListener("load",J),window.addEventListener("orientationchange",J)}),t.onBeforeUnmount(()=>{ce&&cancelAnimationFrame(ce),V&&clearTimeout(V),ae==null||ae.disconnect(),document.removeEventListener("pointerdown",q,!0),window.removeEventListener("resize",Me),window.removeEventListener("load",J),window.removeEventListener("orientationchange",J)});const Ge=e,Le=n,ht=["fontSize","textColor","fillColor","border","merge","calc","sort","outline","cf","freeze","font","hAlign","vAlign","numFmt"],bt={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 je(et,N){if(N)for(const te of ht)te!==et&&Le(bt[te],!1);Le(bt[et],N)}function Bt(){for(const et of ht)Le(bt[et],!1)}function Yt(et){var te;const N=et.target;(te=N.closest)!=null&&te.call(N,".toolbar-split__arrow, .outline-trigger, .toolbar-font-size__btn, .cf-menu-trigger, .sp-dropdown__trigger")||Bt()}const Vt=t.computed(()=>Ge.selNumberFormat===jn?w(Ge.locale,"nfMixed"):""),zt=t.computed(()=>{const et=[{label:w(Ge.locale,"freezeFirstRow"),value:"firstRow",icon:Bd},{label:w(Ge.locale,"freezeFirstCol"),value:"firstCol",icon:xd}];return Ge.hasFreeze?et.unshift({label:w(Ge.locale,"unfreezePanes"),value:"unfreeze",icon:Td}):et.unshift({label:w(Ge.locale,"freezePanes"),value:"panes",icon:ia,disabled:Ge.freezePanesDisabled}),et});return(et,N)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{ref_key:"rootEl",ref:v,class:"toolbar",onMousedown:N[65]||(N[65]=t.withModifiers(()=>{},["prevent"]))},[(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("undo"),to:j.value},[t.createElementVNode("div",Hs,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canUndo}]),title:t.unref(w)(e.locale,"undo"),disabled:!e.canUndo,onClick:N[0]||(N[0]=te=>Le("undo"))},[N[69]||(N[69]=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",Us,t.toDisplayString(t.unref(w)(e.locale,"undo")),1)],10,Ws)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("redo"),to:j.value},[t.createElementVNode("div",Ps,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canRedo}]),title:t.unref(w)(e.locale,"redo"),disabled:!e.canRedo,onClick:N[1]||(N[1]=te=>Le("redo"))},[N[70]||(N[70]=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",Gs,t.toDisplayString(t.unref(w)(e.locale,"redo")),1)],10,Ks)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("paint"),to:j.value},[t.createElementVNode("div",qs,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.paintFmtActive}]),title:t.unref(w)(e.locale,"paintFormat"),disabled:!e.hasSelection,onClick:N[2]||(N[2]=te=>Le("paint-format"))},[N[71]||(N[71]=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",Ys,t.toDisplayString(t.unref(w)(e.locale,"paintFormat")),1)],10,js)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("clear"),to:j.value},[t.createElementVNode("div",Xs,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.hasSelection}]),title:t.unref(w)(e.locale,"clearFormat"),disabled:!e.hasSelection,onClick:N[3]||(N[3]=te=>Le("clear-format"))},[N[72]||(N[72]=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",Js,t.toDisplayString(t.unref(w)(e.locale,"clearFormat")),1)],10,Zs)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("sep1"),to:j.value},[N[73]||(N[73]=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:we("font"),to:j.value},[t.createElementVNode("div",Qs,[t.createVNode(Kt,{class:"toolbar-font","model-value":e.selFontFamily,options:e.fontFamilyOptions,width:I("font")?"100%":110,"menu-width":I("font")?120:void 0,"visible-count":8,title:t.unref(w)(e.locale,"fontFamily"),align:"right","model-open":e.fontMenuOpen,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":N[4]||(N[4]=te=>je("font",te)),onChange:N[5]||(N[5]=te=>Le("font-family-change",te))},null,8,["model-value","options","width","menu-width","title","model-open","boundary-el"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("fontSize"),to:j.value},[t.createElementVNode("div",ec,[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(w)(e.locale,"fontSize"),onMousedown:N[6]||(N[6]=t.withModifiers(()=>{},["stop"])),onInput:N[7]||(N[7]=te=>Le("font-size-input",te.target.value)),onBlur:N[8]||(N[8]=te=>Le("font-size-blur")),onKeydown:N[9]||(N[9]=te=>Le("font-size-keydown",te))},null,40,nc),t.createVNode(Kt,{class:"toolbar-font-size__dropdown","model-value":e.selFontSize,options:e.fontSizeOptions,width:I("fontSize")?"100%":56,"menu-width":I("fontSize")?120:56,"visible-count":9,title:t.unref(w)(e.locale,"fontSize"),"hide-trigger":!0,"model-open":e.fontSizeMenuOpen,align:"right","trigger-el":ie.value,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":N[10]||(N[10]=te=>je("fontSize",te)),onChange:N[11]||(N[11]=te=>Le("font-size-change",te))},null,8,["model-value","options","width","menu-width","title","model-open","trigger-el","boundary-el"]),t.createElementVNode("button",{ref_key:"fontSizeArrowRef",ref:ie,class:"toolbar-font-size__btn",type:"button",title:t.unref(w)(e.locale,"fontSize"),onMousedown:N[12]||(N[12]=t.withModifiers(()=>{},["prevent"])),onClick:N[13]||(N[13]=te=>Le("font-size-toggle"))},[...N[74]||(N[74]=[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,lc),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(w)(e.locale,"fontSizeDecrease"),disabled:!e.hasSelection,onMousedown:N[14]||(N[14]=t.withModifiers(()=>{},["prevent"])),onClick:N[15]||(N[15]=te=>Le("font-size-step-down"))},[...N[75]||(N[75]=[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,oc),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(w)(e.locale,"fontSizeIncrease"),disabled:!e.hasSelection,onMousedown:N[16]||(N[16]=t.withModifiers(()=>{},["prevent"])),onClick:N[17]||(N[17]=te=>Le("font-size-step-up"))},[...N[76]||(N[76]=[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,rc)])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("sep2"),to:j.value},[N[77]||(N[77]=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:we("bold"),to:j.value},[t.createElementVNode("div",ac,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontWeight}]),title:t.unref(w)(e.locale,"bold"),disabled:!e.hasSelection,onClick:N[18]||(N[18]=te=>Le("bold-toggle"))},[N[78]||(N[78]=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",sc,t.toDisplayString(t.unref(w)(e.locale,"bold")),1)],10,ic)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("italic"),to:j.value},[t.createElementVNode("div",cc,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontStyle}]),title:t.unref(w)(e.locale,"italic"),disabled:!e.hasSelection,onClick:N[19]||(N[19]=te=>Le("italic-toggle"))},[N[79]||(N[79]=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",uc,t.toDisplayString(t.unref(w)(e.locale,"italic")),1)],10,dc)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("underline"),to:j.value},[t.createElementVNode("div",fc,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selUnderline}]),title:t.unref(w)(e.locale,"underline"),disabled:!e.hasSelection,onClick:N[20]||(N[20]=te=>Le("underline-toggle"))},[N[80]||(N[80]=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",pc,t.toDisplayString(t.unref(w)(e.locale,"underline")),1)],10,mc)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("strike"),to:j.value},[t.createElementVNode("div",hc,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selStrikethrough}]),title:t.unref(w)(e.locale,"strikethrough"),disabled:!e.hasSelection,onClick:N[21]||(N[21]=te=>Le("strikethrough-toggle"))},[N[81]||(N[81]=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",bc,t.toDisplayString(t.unref(w)(e.locale,"strikethrough")),1)],10,gc)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("sep3"),to:j.value},[N[82]||(N[82]=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:we("textColor"),to:j.value},[t.createElementVNode("div",yc,[t.createElementVNode("div",Cc,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(w)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:N[22]||(N[22]=te=>Le("apply-text-color"))},[(t.openBlock(),t.createElementBlock("svg",vc,[N[83]||(N[83]=t.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[t.createElementVNode("path",{d:"M663.120842 529.946947H364.759579l-84.07579 212.884211a53.894737 53.894737 0 0 1-50.122105 34.169263h-14.551579a34.869895 34.869895 0 0 1-32.498526-47.696842L443.715368 70.063158a53.894737 53.894737 0 0 1 50.122106-34.115369h41.768421a53.894737 53.894737 0 0 1 50.176 34.277053l257.670737 659.078737a34.977684 34.977684 0 0 1-32.552421 47.696842h-14.389895a53.894737 53.894737 0 0 1-50.229895-34.277053l-83.159579-212.776421z m-35.139368-89.788631l-113.340632-289.953684-114.472421 289.953684h227.813053z"})],-1)),t.createElementVNode("path",{d:"M62.895 844.369m53.895 0l790.474 0q53.895 0 53.895 53.895l0 26.947q0 53.895-53.895 53.895l-790.474 0q-53.895 0-53.895-53.895l0-26.947q0-53.895 53.895-53.895z",fill:e.cachedTextColor||"#000000"},null,8,kc)])),t.createElementVNode("span",Ec,t.toDisplayString(t.unref(w)(e.locale,"fontColor")),1)],8,wc),t.createElementVNode("button",{ref_key:"textColorArrowRef",ref:R,class:"toolbar-btn toolbar-split__arrow",title:t.unref(w)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:N[23]||(N[23]=te=>je("textColor",!e.textColorMenuOpen))},[...N[84]||(N[84]=[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,Rc),t.createVNode(Vo,{"model-open":e.textColorMenuOpen,"color-key":"text","current-color":e.selTextColor,locale:e.locale,"trigger-el":R.value,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":N[24]||(N[24]=te=>je("textColor",te)),onChange:N[25]||(N[25]=te=>Le("text-color-change",te))},null,8,["model-open","current-color","locale","trigger-el","boundary-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("fillColor"),to:j.value},[t.createElementVNode("div",Sc,[t.createElementVNode("div",Mc,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(w)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:N[26]||(N[26]=te=>Le("apply-fill-color"))},[(t.openBlock(),t.createElementBlock("svg",Bc,[N[85]||(N[85]=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,xc)])),t.createElementVNode("span",Tc,t.toDisplayString(t.unref(w)(e.locale,"fillColor")),1)],8,Nc),t.createElementVNode("button",{ref_key:"fillColorArrowRef",ref:F,class:"toolbar-btn toolbar-split__arrow",title:t.unref(w)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:N[27]||(N[27]=te=>je("fillColor",!e.fillColorMenuOpen))},[...N[86]||(N[86]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,Vc),t.createVNode(Vo,{"model-open":e.fillColorMenuOpen,"color-key":"fill","current-color":e.selFillColor,locale:e.locale,"trigger-el":F.value,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":N[28]||(N[28]=te=>je("fillColor",te)),onChange:N[29]||(N[29]=te=>Le("fill-color-change",te))},null,8,["model-open","current-color","locale","trigger-el","boundary-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("border"),to:j.value},[t.createElementVNode("div",Dc,[t.createElementVNode("div",Fc,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(w)(e.locale,"borders"),disabled:!e.hasSelection,onClick:N[30]||(N[30]=te=>Le("apply-border"))},[(t.openBlock(),t.createElementBlock("svg",Oc,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(l,te=>t.createElementVNode("line",{key:te.name,x1:te.x1,y1:te.y1,x2:te.x2,y2:te.y2,"stroke-width":r(e.cachedBorder,te.name)==="thick"?3:1.5,"stroke-dasharray":r(e.cachedBorder,te.name)==="dashed"?"0 4":"none","stroke-linecap":r(e.cachedBorder,te.name)==="dashed"?"round":"square"},null,8,Ac)),64))])),t.createElementVNode("span",Lc,t.toDisplayString(t.unref(w)(e.locale,c[e.cachedBorder]??"borders")),1)],8,Ic),t.createElementVNode("button",{ref_key:"borderArrowRef",ref:Q,class:"toolbar-btn toolbar-split__arrow",title:t.unref(w)(e.locale,"borders"),disabled:!e.hasSelection,onClick:N[31]||(N[31]=te=>je("border",!e.borderMenuOpen))},[...N[87]||(N[87]=[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(ss,{"model-open":e.borderMenuOpen,locale:e.locale,"current-border":e.cachedBorder,"trigger-el":Q.value,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":N[32]||(N[32]=te=>je("border",te)),onChange:N[33]||(N[33]=te=>Le("border-change",te))},null,8,["model-open","locale","current-border","trigger-el","boundary-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("sep4"),to:j.value},[N[88]||(N[88]=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:we("hAlign"),to:j.value},[t.createElementVNode("div",zc,[t.createVNode(Kt,{class:"toolbar-align","model-value":e.selHAlign,options:e.hAlignOptions,width:I("hAlign")?"100%":44,"menu-width":I("hAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(w)(e.locale,"hAlign"),"model-open":e.hAlignMenuOpen,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":N[34]||(N[34]=te=>je("hAlign",te)),onChange:N[35]||(N[35]=te=>Le("h-align-change",te))},null,8,["model-value","options","width","menu-width","title","model-open","boundary-el"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("vAlign"),to:j.value},[t.createElementVNode("div",_c,[t.createVNode(Kt,{class:"toolbar-align","model-value":e.selVAlign,options:e.vAlignOptions,width:I("vAlign")?"100%":44,"menu-width":I("vAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(w)(e.locale,"vAlign"),"model-open":e.vAlignMenuOpen,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":N[36]||(N[36]=te=>je("vAlign",te)),onChange:N[37]||(N[37]=te=>Le("v-align-change",te))},null,8,["model-value","options","width","menu-width","title","model-open","boundary-el"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("wrap"),to:j.value},[t.createElementVNode("div",Hc,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selWrap}]),type:"button",title:t.unref(w)(e.locale,"wrap"),onClick:N[38]||(N[38]=te=>Le("wrap-toggle"))},[N[89]||(N[89]=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",Uc,t.toDisplayString(t.unref(w)(e.locale,"wrap")),1)],10,Wc)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("merge"),to:j.value},[t.createElementVNode("div",Pc,[t.createElementVNode("div",Kc,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(w)(e.locale,"mergeCenter"),disabled:!e.hasSelection,onClick:N[39]||(N[39]=te=>Le("apply-merge"))},[N[90]||(N[90]=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",qc,t.toDisplayString(t.unref(w)(e.locale,"mergeCenter")),1)],8,Gc),t.createElementVNode("button",{ref_key:"mergeArrowRef",ref:Ee,class:"toolbar-btn toolbar-split__arrow",title:t.unref(w)(e.locale,"mergeCells"),disabled:!e.hasSelection,onClick:N[40]||(N[40]=te=>je("merge",!e.mergeMenuOpen))},[...N[91]||(N[91]=[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,jc),t.createVNode(ks,{"model-open":e.mergeMenuOpen,locale:e.locale,"trigger-el":Ee.value,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":N[41]||(N[41]=te=>je("merge",te)),onChange:N[42]||(N[42]=te=>Le("merge-change",te))},null,8,["model-open","locale","trigger-el","boundary-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("sep6"),to:j.value},[N[92]||(N[92]=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:we("numFmt"),to:j.value},[t.createElementVNode("div",Yc,[t.createElementVNode("div",Xc,[t.createVNode(Kt,{class:"toolbar-number-format","model-value":e.selNumberFormat,options:e.nfOptions,width:I("numFmt")?"auto":92,"menu-width":(I("numFmt"),150),"visible-count":8,title:t.unref(w)(e.locale,"numberFormat"),"fallback-label":Vt.value,align:"right","model-open":e.numFmtMenuOpen,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":N[43]||(N[43]=te=>je("numFmt",te)),onChange:N[44]||(N[44]=te=>Le("number-format-change",String(te)))},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(w)(e.locale,"nfIncreaseDecimals"),disabled:!e.canIncreaseDecimals,onClick:N[45]||(N[45]=te=>Le("increase-decimals"))},[...N[93]||(N[93]=[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,Zc),t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn toolbar-number-format__btn",{"toolbar-btn--disabled":!e.canDecreaseDecimals}]),title:t.unref(w)(e.locale,"nfDecreaseDecimals"),disabled:!e.canDecreaseDecimals,onClick:N[46]||(N[46]=te=>Le("decrease-decimals"))},[...N[94]||(N[94]=[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,Jc)])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("sep7"),to:j.value},[N[95]||(N[95]=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:we("calc"),to:j.value},[t.createElementVNode("div",Qc,[t.createElementVNode("div",ed,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(w)(e.locale,"sum"),disabled:!e.hasSelection||e.isSingleCell,onClick:N[47]||(N[47]=te=>Le("calc-sum"))},[N[96]||(N[96]=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",nd,t.toDisplayString(t.unref(w)(e.locale,"sum")),1)],8,td),t.createElementVNode("button",{ref_key:"calcArrowRef",ref:ee,class:"toolbar-btn toolbar-split__arrow",title:t.unref(w)(e.locale,"calculate"),disabled:!e.hasSelection,onClick:N[48]||(N[48]=te=>je("calc",!e.calcMenuOpen))},[...N[97]||(N[97]=[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,ld),t.createVNode(_s,{"model-open":e.calcMenuOpen,locale:e.locale,"trigger-el":ee.value,disabled:e.isSingleCell,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":N[49]||(N[49]=te=>je("calc",te)),onChange:N[50]||(N[50]=te=>Le(`calc-${te}`))},null,8,["model-open","locale","trigger-el","disabled","boundary-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("sort"),to:j.value},[t.createElementVNode("div",od,[t.createElementVNode("div",rd,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:e.cachedSortOrder==="asc"?t.unref(w)(e.locale,"sortAsc"):t.unref(w)(e.locale,"sortDesc"),disabled:!e.canSort,onClick:N[51]||(N[51]=te=>Le("apply-sort"))},[(t.openBlock(),t.createElementBlock("svg",id,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(d,te=>t.createElementVNode("line",{key:te.name,x1:te.x1,y1:te.y1,x2:te.x2,y2:te.y2},null,8,sd)),64)),t.createElementVNode("path",{d:b[e.cachedSortOrder]},null,8,cd)])),t.createElementVNode("span",dd,t.toDisplayString(t.unref(w)(e.locale,"sort")),1)],8,ad),t.createElementVNode("button",{ref_key:"sortArrowRef",ref:K,class:"toolbar-btn toolbar-split__arrow",title:t.unref(w)(e.locale,"sort"),disabled:!e.canSort,onClick:N[52]||(N[52]=te=>je("sort",!e.sortMenuOpen))},[...N[98]||(N[98]=[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,ud),t.createVNode(ps,{"model-open":e.sortMenuOpen,locale:e.locale,"current-sort":e.cachedSortOrder,"trigger-el":K.value,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":N[53]||(N[53]=te=>je("sort",te)),onChange:N[54]||(N[54]=te=>Le("sort-change",te))},null,8,["model-open","locale","current-sort","trigger-el","boundary-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("outline"),to:j.value},[t.createElementVNode("div",fd,[t.createElementVNode("button",{ref_key:"outlineArrowRef",ref:pe,class:t.normalizeClass(["toolbar-btn outline-trigger",{"is-open":e.outlineMenuOpen}]),disabled:!e.outlineAxis,title:t.unref(w)(e.locale,"outlineGroup"),onClick:N[55]||(N[55]=te=>je("outline",!e.outlineMenuOpen))},[N[99]||(N[99]=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(w)(e.locale,"outlineGroup")),1),N[100]||(N[100]=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,md),t.createVNode(ys,{"model-open":e.outlineMenuOpen,locale:e.locale,"trigger-el":pe.value,"boundary-el":e.boundaryEl,axis:e.outlineAxis,"onUpdate:modelOpen":N[56]||(N[56]=te=>je("outline",te)),onAction:N[57]||(N[57]=te=>Le("outline-action",te))},null,8,["model-open","locale","trigger-el","boundary-el","axis"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("filter"),to:j.value},[t.createElementVNode("div",hd,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.filterActive}]),disabled:!e.canFilter,title:e.filterActive?t.unref(w)(e.locale,"clearFilter"):t.unref(w)(e.locale,"filter"),onClick:fe},[N[101]||(N[101]=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",bd,t.toDisplayString(t.unref(w)(e.locale,"filter")),1)],10,gd)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("freeze"),to:j.value},[t.createElementVNode("div",yd,[t.createVNode(Kt,{class:"toolbar-freeze","model-value":"",options:zt.value,width:I("freeze")?"100%":44,"menu-width":I("freeze")?120:void 0,"visible-count":4,align:"right",title:t.unref(w)(e.locale,"freezePane"),"trigger-icon":ia,"trigger-label":t.unref(w)(e.locale,"freezePane"),"model-open":e.freezeMenuOpen,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":N[58]||(N[58]=te=>je("freeze",te)),onChange:N[59]||(N[59]=te=>Le("freeze-change",String(te)))},null,8,["options","width","menu-width","title","trigger-label","model-open","boundary-el"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("cf"),to:j.value},[t.createElementVNode("div",Cd,[t.createVNode(Ls,{locale:e.locale,"has-selection":e.hasSelection,"theme-vars":e.themeVars,"model-open":e.cfMenuOpen,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":N[60]||(N[60]=te=>je("cf",te)),onPreset:N[61]||(N[61]=te=>Le("cf-preset",te)),onNewRule:N[62]||(N[62]=te=>Le("cf-new-rule")),onManage:N[63]||(N[63]=te=>Le("cf-manage")),onClear:N[64]||(N[64]=te=>Le("cf-clear",te))},null,8,["locale","has-selection","theme-vars","model-open","boundary-el"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("dv"),to:j.value},[t.createElementVNode("div",wd,[t.createElementVNode("button",{class:"toolbar-btn",title:t.unref(w)(e.locale,"dv"),onClick:Y},[N[102]||(N[102]=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",kd,t.toDisplayString(t.unref(w)(e.locale,"dv")),1)],8,vd)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:we("find"),to:j.value},[t.createElementVNode("div",Ed,[t.createElementVNode("button",{class:"toolbar-btn",title:t.unref(w)(e.locale,"find"),onClick:W},[N[103]||(N[103]=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",Sd,t.toDisplayString(t.unref(w)(e.locale,"findReplace")),1)],8,Rd)])],8,["disabled","to"])),O.value?(t.openBlock(),t.createElementBlock("button",{key:0,ref_key:"moreBtnEl",ref:B,class:t.normalizeClass(["toolbar-more",{"toolbar-more--active":se.value}]),type:"button",onClick:$},[...N[104]||(N[104]=[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":Se.value}]),style:t.normalizeStyle(ve.value),onPointerdown:N[68]||(N[68]=t.withModifiers(()=>{},["stop","prevent"]))},[Qe.value||X.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["overflow-nav",{"overflow-nav--disabled":!Qe.value}]),disabled:!Qe.value,onClick:N[66]||(N[66]=te=>_e(-1))},[...N[105]||(N[105]=[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,Md)):t.createCommentVNode("",!0),(t.openBlock(),t.createElementBlock("div",{ref_key:"overflowMenuEl",ref:h,key:Xe.value,class:"overflow-menu",onScroll:Re,onClick:Yt},null,32)),Qe.value||X.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["overflow-nav",{"overflow-nav--disabled":!X.value}]),disabled:!X.value,onClick:N[67]||(N[67]=te=>_e(1))},[...N[106]||(N[106]=[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,Nd)):t.createCommentVNode("",!0)],38),[[t.vShow,se.value]])]),_:1})]))],64))}}),[["__scopeId","data-v-1a2f529d"]]),Id=["title"],Od={class:"tab-list"},Ad=["onClick","onDblclick","onContextmenu","onTouchstart"],Ld=["value"],$d={key:1,class:"tab-item__name"},zd=["title"],_d=["disabled"],Hd=["title","onClick"],Wd={class:"tab-list-menu__name"},Ud=["title","disabled","onClick"],Pd=["disabled"],Kd=8,sa=450,Do=8,Gd=Dt(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:o}){const n=e,l=o,a=t.ref(null),i=t.ref(!1),r=t.ref(0),c=t.ref({left:0,bottom:0}),d=t.ref(null),b=t.computed(()=>Math.min(Kd,n.sheets.length)),C=t.computed(()=>n.sheets.slice(r.value,r.value+b.value)),v=t.computed(()=>r.value>0),h=t.computed(()=>r.value+b.value<n.sheets.length),B=t.computed(()=>n.sheets.length>b.value),R=t.computed(()=>n.sheets.length>1);t.watch(()=>n.sheets.length,()=>{if(!i.value)return;const q=Math.max(0,n.sheets.length-b.value);r.value>q&&(r.value=q)});function F(q){r.value=Math.max(0,Math.min(n.sheets.length-b.value,r.value+q))}function Q(){if(i.value){i.value=!1;return}const q=a.value;if(!q)return;const $=q.getBoundingClientRect(),Y=qn(n.boundaryEl);c.value={left:$.left,bottom:Y.bottom-$.top+4};const W=n.activeSheetIndex;r.value=W>=0?Math.max(0,Math.min(W-Math.floor(b.value/2),n.sheets.length-b.value)):0,i.value=!0}function K(q){l("tab-click",q),i.value=!1}function Ee(q){R.value&&l("delete-sheet",q)}function ee(q){var W;if(!i.value)return;const $=q.target;if((W=a.value)!=null&&W.contains($))return;const Y=document.querySelector(".tab-list-menu");Y!=null&&Y.contains($)||(i.value=!1)}function pe(q){i.value&&q.key==="Escape"&&(i.value=!1)}function ie(q){i.value&&(q.preventDefault(),F(q.deltaY>0?1:-1))}function me(){i.value=!1}function se(q){!i.value||q.target===d.value||me()}const Se=t.ref(0),Xe=t.ref(!1);function Qe(q){i.value&&(Se.value=q.touches[0].clientY,Xe.value=!0)}function X(q){if(!i.value||!Xe.value)return;const $=q.touches[0].clientY-Se.value;Math.abs($)>5&&(F($<0?1:-1),Se.value=q.touches[0].clientY)}function rt(){Xe.value=!1}let O=null,I=-1,j=0,we=0,ze=!1,le=null,xe=0,ce=0;function Fe(q,$,Y){return{clientX:q,clientY:$,target:Y,preventDefault(){},stopPropagation(){}}}function V(q,$){const Y=q.touches[0];if(!Y)return;j=Y.clientX,we=Y.clientY,I=$,O!==null&&clearTimeout(O);const W=q.target;O=window.setTimeout(()=>{ze=!0;const fe=Fe(j,we,W);l("tab-contextmenu",{ev:fe,i:I})},sa)}function J(q){const $=q.touches[0];!$||O===null||(Math.abs($.clientX-j)>Do||Math.abs($.clientY-we)>Do)&&(clearTimeout(O),O=null)}function re(){O!==null&&(clearTimeout(O),O=null)}function ae(q){if(ze){ze=!1;return}l("tab-click",q)}function oe(q){const $=q.touches[0];if(!$)return;const Y=q.target;if(Y.closest(".tab-item")||Y.closest(".tab-bar__add-btn")||Y.closest(".tab-bar__list-btn"))return;xe=$.clientX,ce=$.clientY,le!==null&&clearTimeout(le);const W=Y;le=window.setTimeout(()=>{const fe=Fe(xe,ce,W);l("tabbar-contextmenu",fe)},sa)}function ve(q){const $=q.touches[0];!$||le===null||(Math.abs($.clientX-xe)>Do||Math.abs($.clientY-ce)>Do)&&(clearTimeout(le),le=null)}function Me(){le!==null&&(clearTimeout(le),le=null)}return t.watch(i,q=>{t.nextTick(()=>{var $,Y;q?($=d.value)==null||$.addEventListener("wheel",ie,{passive:!1}):(Y=d.value)==null||Y.removeEventListener("wheel",ie)})}),t.onMounted(()=>{document.addEventListener("pointerdown",ee),document.addEventListener("keydown",pe),window.addEventListener("resize",me),window.addEventListener("scroll",se,!0)}),t.onBeforeUnmount(()=>{O!==null&&clearTimeout(O),le!==null&&clearTimeout(le),document.removeEventListener("pointerdown",ee),document.removeEventListener("keydown",pe),window.removeEventListener("resize",me),window.removeEventListener("scroll",se,!0)}),(q,$)=>(t.openBlock(),t.createElementBlock("div",{class:"tab-bar",onContextmenu:$[8]||($[8]=Y=>l("tabbar-contextmenu",Y)),onTouchstart:oe,onTouchmove:ve,onTouchend:Me,onTouchcancel:Me},[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(w)(e.locale,"sheetList"),onClick:Q},[...$[9]||($[9]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M128 256h768a32 32 0 0 0 0-64H128a32 32 0 0 0 0 64z m0 256h768a32 32 0 0 0 0-64H128a32 32 0 0 0 0 64z m0 256h768a32 32 0 0 0 0-64H128a32 32 0 0 0 0 64z"})],-1)])],10,Id),t.createElementVNode("div",Od,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.sheets,(Y,W)=>(t.openBlock(),t.createElementBlock("div",{key:Y.id,class:t.normalizeClass(["tab-item",{"tab-item--active":W===e.activeSheetIndex}]),onClick:fe=>ae(W),onDblclick:t.withModifiers(fe=>l("tab-dblclick",W),["prevent"]),onContextmenu:fe=>l("tab-contextmenu",{ev:fe,i:W}),onTouchstart:fe=>V(fe,W),onTouchmove:J,onTouchend:re,onTouchcancel:re},[e.renTab===W?(t.openBlock(),t.createElementBlock("input",{key:0,class:"tab-rename-input",value:e.renTabVal,onInput:$[0]||($[0]=fe=>l("tab-rename-input",fe.target.value)),onKeydown:$[1]||($[1]=fe=>l("tab-rename-keydown",fe)),onBlur:$[2]||($[2]=fe=>l("tab-rename-commit")),onClick:$[3]||($[3]=t.withModifiers(()=>{},["stop"]))},null,40,Ld)):(t.openBlock(),t.createElementBlock("span",$d,t.toDisplayString(Y.name),1))],42,Ad))),128))]),t.createElementVNode("button",{class:"tab-bar__add-btn",title:t.unref(w)(e.locale,"addSheet"),onClick:$[4]||($[4]=Y=>l("add-sheet"))}," + ",8,zd),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[i.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"tab-list-menu",style:t.normalizeStyle({left:c.value.left+"px",bottom:c.value.bottom+"px"}),onMousedown:$[7]||($[7]=t.withModifiers(()=>{},["prevent"]))},[B.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["tab-list-menu__nav",{"tab-list-menu__nav--disabled":!v.value}]),disabled:!v.value,onClick:$[5]||($[5]=Y=>F(-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,_d)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:d,class:"tab-list-menu__list",onTouchstart:Qe,onTouchmove:X,onTouchend:rt},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(C.value,Y=>(t.openBlock(),t.createElementBlock("div",{key:Y.id,class:t.normalizeClass(["tab-list-menu__item",{"tab-list-menu__item--active":e.sheets.indexOf(Y)===e.activeSheetIndex}]),title:Y.name,onClick:W=>K(e.sheets.indexOf(Y))},[t.createElementVNode("span",Wd,t.toDisplayString(Y.name),1),t.createElementVNode("button",{type:"button",class:"tab-list-menu__del",title:t.unref(w)(e.locale,"delete"),disabled:!R.value,onClick:t.withModifiers(W=>Ee(e.sheets.indexOf(Y)),["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,Ud)],10,Hd))),128))],544),B.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["tab-list-menu__nav",{"tab-list-menu__nav--disabled":!h.value}]),disabled:!h.value,onClick:$[6]||($[6]=Y=>F(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,Pd)):t.createCommentVNode("",!0)],36)):t.createCommentVNode("",!0)]),_:1})]))],32))}}),[["__scopeId","data-v-96289e1d"]]),qd={class:"find-bar__row find-bar__row--inputs"},jd=["placeholder","value"],Yd=["placeholder","value"],Xd=["title","disabled"],Zd=["title","disabled"],Jd=["title"],Qd={class:"find-bar__row find-bar__row--controls"},eu=["title"],tu={class:"find-bar__count"},nu=["disabled"],lu=["disabled"],ou={class:"find-bar__chk find-bar__chk--panel"},ru=["checked"],au={class:"find-bar__chk find-bar__chk--panel"},iu=["checked"],su=Dt(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:o}){const n=e,l=o,a=t.ref(null),i=t.ref(null),r=t.ref(!1),c=t.ref({top:0,left:0}),d=t.computed(()=>n.total>0?`${n.currentIndex+1}/${n.total}`:n.message||""),b=t.computed(()=>[{label:w(n.locale,"scopeSheet"),value:"sheet"},{label:w(n.locale,"scopeWorkbook"),value:"workbook"},{label:w(n.locale,"scopeSelection"),value:"selection"}]);t.watch(()=>n.focusToken,()=>{t.nextTick(()=>{var B;return(B=a.value)==null?void 0:B.focus()})});function C(B){B.key==="Enter"?(B.preventDefault(),B.shiftKey?l("prev"):l("next")):B.key==="Escape"&&(B.preventDefault(),l("close"))}function v(){if(i.value){if(!r.value){const B=i.value.getBoundingClientRect();c.value={top:B.bottom+2,left:B.left}}r.value=!r.value}}function h(B){if(!r.value)return;const R=B.target;R.closest(".find-bar__settings-btn")||R.closest(".find-bar__settings-panel")||(r.value=!1)}return t.watch(r,B=>{B?document.addEventListener("pointerdown",h,!0):document.removeEventListener("pointerdown",h,!0)}),t.watch(()=>n.open,B=>{B||(r.value=!1)}),t.onBeforeUnmount(()=>document.removeEventListener("pointerdown",h,!0)),(B,R)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[e.open?(t.openBlock(),t.createElementBlock("div",{key:0,class:"find-bar",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("div",qd,[t.createElementVNode("input",{ref_key:"findInputRef",ref:a,class:"find-bar__input",placeholder:t.unref(w)(e.locale,"findPlaceholder"),value:e.findText,onInput:R[0]||(R[0]=F=>l("update:findText",F.target.value)),onKeydown:C},null,40,jd),t.createElementVNode("input",{class:"find-bar__input",placeholder:t.unref(w)(e.locale,"replacePlaceholder"),value:e.replaceText,onInput:R[1]||(R[1]=F=>l("update:replaceText",F.target.value)),onKeydown:C},null,40,Yd),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--icon",title:t.unref(w)(e.locale,"findPrev"),disabled:e.total===0,onClick:R[2]||(R[2]=F=>l("prev"))},[...R[12]||(R[12]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M512 320a32 32 0 0 1 45.254 0l288 288a32 32 0 0 1-45.254 45.254L512 410.51 214.254 653.254A32 32 0 0 1 169 608l288-288z"})],-1)])],8,Xd),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--icon",title:t.unref(w)(e.locale,"findNext"),disabled:e.total===0,onClick:R[3]||(R[3]=F=>l("next"))},[...R[13]||(R[13]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M512 704a32 32 0 0 1-45.254 0l-288-288A32 32 0 0 1 214.254 370.746L512 613.49 809.746 370.746A32 32 0 0 1 855 416l-288 288z"})],-1)])],8,Zd),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--close",title:t.unref(w)(e.locale,"findClose"),onClick:R[4]||(R[4]=F=>l("close"))},[...R[14]||(R[14]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M571.733333 512l288.533334-288.533333c17.066667-17.066667 17.066667-42.666667 0-59.733334-17.066667-17.066667-42.666667-17.066667-59.733334 0L512 452.266667 223.466667 164.266667c-17.066667-17.066667-42.666667-17.066667-59.733334 0-17.066667 17.066667-17.066667 42.666667 0 59.733333L452.266667 512 164.266667 800c-17.066667 17.066667-17.066667 42.666667 0 59.733333 8.533333 8.533333 19.2 12.8 29.866666 12.8 10.666667 0 21.333333-4.266667 29.866667-12.8L512 571.733333l288.533333 288.533334c8.533333 8.533333 19.2 12.8 29.866667 12.8 10.666667 0 21.333333-4.266667 29.866667-12.8 17.066667-17.066667 17.066667-42.666667 0-59.733334L571.733333 512z"})],-1)])],8,Jd)]),t.createElementVNode("div",Qd,[t.createVNode(Kt,{class:"find-bar__dropdown","model-value":e.scope,options:b.value,title:t.unref(w)(e.locale,"findScope"),"onUpdate:modelValue":R[5]||(R[5]=F=>B.$emit("update:scope",F))},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(w)(e.locale,"findOptions"),onClick:t.withModifiers(v,["stop"])},[...R[15]||(R[15]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M224 671.616a64 64 0 1 1 128 0 64 64 0 0 1-128 0z m-59.968 32a128 128 0 0 0 247.936 0H928a32 32 0 1 0 0-64H411.968a128 128 0 0 0-247.936 0H96a32 32 0 1 0 0 64h68.032z"}),t.createElementVNode("path",{d:"M800 319.808a64 64 0 1 1-128 0 64 64 0 0 1 128 0z m59.968-32a128 128 0 0 0-247.936 0H96a32 32 0 0 0 0 64h516.032a128 128 0 0 0 247.936 0H928a32 32 0 0 0 0-64h-68.032z"})],-1)])],10,eu),t.createElementVNode("span",tu,t.toDisplayString(d.value),1),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--text",disabled:e.total===0,onClick:R[6]||(R[6]=F=>l("replace"))},t.toDisplayString(t.unref(w)(e.locale,"replace")),9,nu),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--text",disabled:e.total===0,onClick:R[7]||(R[7]=F=>l("replace-all"))},t.toDisplayString(t.unref(w)(e.locale,"replaceAll")),9,lu)])],4)):t.createCommentVNode("",!0),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"find-pop"},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"find-bar__settings-panel",style:t.normalizeStyle({top:c.value.top+"px",left:c.value.left+"px"}),onClick:R[10]||(R[10]=t.withModifiers(()=>{},["stop"])),onMousedown:R[11]||(R[11]=t.withModifiers(()=>{},["prevent"]))},[t.createElementVNode("label",ou,[t.createElementVNode("input",{class:"find-bar__chk-input",type:"checkbox",checked:e.matchCase,onChange:R[8]||(R[8]=F=>l("update:matchCase",F.target.checked))},null,40,ru),R[16]||(R[16]=t.createElementVNode("span",{class:"find-bar__chk-box"},[t.createElementVNode("svg",{class:"find-bar__chk-tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(w)(e.locale,"matchCase")),1)]),t.createElementVNode("label",au,[t.createElementVNode("input",{class:"find-bar__chk-input",type:"checkbox",checked:e.matchEntireCell,onChange:R[9]||(R[9]=F=>l("update:matchEntireCell",F.target.checked))},null,40,iu),R[17]||(R[17]=t.createElementVNode("span",{class:"find-bar__chk-box"},[t.createElementVNode("svg",{class:"find-bar__chk-tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(w)(e.locale,"matchEntireCell")),1)])],36)):t.createCommentVNode("",!0)]),_:1})]))],64))}}),[["__scopeId","data-v-07f6713b"]]),cu={class:"nf-dialog__header"},du={class:"nf-dialog__title"},uu={class:"nf-dialog__body"},fu={class:"nf-field"},mu={class:"nf-field__label"},pu={key:0,class:"nf-field"},hu={class:"nf-field__label"},gu={key:1,class:"nf-field nf-field--inline"},bu={class:"nf-checkbox"},yu={key:2,class:"nf-field"},Cu={class:"nf-field__label"},wu={key:3,class:"nf-field"},vu={class:"nf-field__label"},ku={key:4,class:"nf-field"},Eu={class:"nf-field__label"},Ru={key:5,class:"nf-field"},Su={class:"nf-field__label"},Mu={key:6,class:"nf-field"},Nu={class:"nf-field__label"},Bu={class:"nf-field"},xu={class:"nf-field__label"},Tu={class:"nf-dialog__footer"},Vu={class:"nf-preview"},Du={class:"nf-preview__label"},Fu={class:"nf-preview__value"},Iu={class:"nf-dialog__actions"},Ou=Dt(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:o}){const n=e,l=o,a=t.ref(!1),i=t.ref("general"),r=t.ref(2),c=t.ref(!1),d=t.ref("$"),b=t.ref("m/d/yyyy"),C=t.ref("h:mm:ss"),v=t.ref("m/d/yyyy h:mm:ss"),h=t.ref("[h]:mm:ss"),B=t.ref(""),R=t.ref(null),F=[{label:"¥",value:"¥"},{label:"$",value:"$"},{label:"€",value:"€"},{label:"£",value:"£"}],Q=['yyyy"年"m"月"d"日"',"yyyy-mm-dd","yyyy/m/d",'m"月"d"日"'],K=["m/d/yyyy","mm/dd/yyyy","d-mmm-yyyy","mmmm d, yyyy"],Ee=['yyyy"年"m"月"d"日" h:mm:ss','yyyy"年"m"月"d"日" hh:mm',"yyyy-mm-dd hh:mm:ss","yyyy/m/d h:mm"],ee=["m/d/yyyy h:mm:ss","m/d/yyyy hh:mm","mm/dd/yyyy h:mm AM/PM","d-mmm-yyyy hh:mm:ss"],pe=t.computed(()=>n.locale==="zh-CN"?[...Q,...K]:[...K,...Q]),ie=["h:mm:ss","h:mm","hh:mm:ss","h:mm AM/PM",'hh"时"mm"分"ss"秒"',"H:mm:ss"],me=t.computed(()=>n.locale==="zh-CN"?[...Ee,...ee]:[...ee,...Ee]),se=["[h]:mm:ss","[h]:mm","mm:ss",'[h]"小时"mm"分"ss"秒"',"[h]:mm:ss.00",'d"天"h:mm:ss'],Se={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"},Xe=t.computed(()=>$i.map(Re=>({label:w(n.locale,Se[Re]),value:Re}))),Qe=F.map(Re=>({label:Re.label,value:Re.value})),X=t.computed(()=>pe.value.map(Re=>({label:Re,value:Re}))),rt=ie.map(Re=>({label:Re,value:Re})),O=t.computed(()=>me.value.map(Re=>({label:Re,value:Re}))),I=se.map(Re=>({label:Re,value:Re})),j=t.computed(()=>["number","currency","currencyRounded","accounting","financial"].includes(i.value)),we=t.computed(()=>["currency","currencyRounded","accounting"].includes(i.value)),ze=t.computed(()=>i.value==="date"),le=t.computed(()=>i.value==="time"),xe=t.computed(()=>i.value==="dateTime"),ce=t.computed(()=>i.value==="duration"),Fe=t.computed(()=>["number","currency","accounting","financial","percent","scientific"].includes(i.value));function V(){if(i.value==="general")return ol;if(i.value==="text")return kn;if(i.value==="custom")return B.value;if(i.value==="date")return b.value;if(i.value==="time")return C.value;if(i.value==="dateTime")return v.value;if(i.value==="duration")return h.value;const Re=Math.max(0,Math.min(30,r.value));return i.value==="currency"||i.value==="currencyRounded"||i.value==="accounting"?J(i.value,Re,c.value,d.value):Ki(n.locale,i.value,Re,c.value)}function J(Re,_e,Ge,Le){const ht=Ge?"#,##0":"0";if(Re==="currencyRounded")return Le+ht;const bt=_e>0?"."+"0".repeat(_e):"",je=ht+bt;return Re==="currency"?Le+je:`${Le}${je};(${Le}${je});${Le}"-"`}function re(Re){if(B.value=Re,En(Re)){i.value="general";return}if(Re==="@"){i.value="text";return}const _e=Re.replace(/\[[^\]]*\]/gi,bt=>/\[h\]/i.test(bt)?bt:"");if(/\[h\]/i.test(_e)&&!/[yd]/i.test(_e)){i.value="duration",se.includes(Re)&&(h.value=Re);return}const Ge=/[yd]/i.test(_e),Le=/h|s|AM\/PM/i.test(_e);if(Ge&&Le){i.value="dateTime",me.value.includes(Re)&&(v.value=Re);return}if(Ge||/AM\/PM/i.test(_e)){Le&&!Ge?(i.value="time",ie.includes(Re)&&(C.value=Re)):(i.value="date",pe.value.includes(Re)&&(b.value=Re));return}if(Re.includes("%")){i.value="percent",r.value=ae(Re);return}if(/E[+-]/i.test(Re)){i.value="scientific",r.value=ae(Re);return}const ht=F.find(bt=>Re.startsWith(bt.value));if(Re.includes("[Red](")){i.value="financial",c.value=Re.includes(","),r.value=ae(Re);return}if(ht){Re.includes("(")?(i.value="accounting",d.value=ht.value,c.value=Re.includes(","),r.value=ae(Re)):/\.\d/.test(Re.slice(ht.value.length))?(i.value="currency",d.value=ht.value,c.value=Re.includes(","),r.value=ae(Re)):(i.value="currencyRounded",d.value=ht.value,c.value=Re.includes(","));return}i.value="number",c.value=Re.includes(","),r.value=ae(Re)}function ae(Re){const _e=Re.match(/\.([0#?]+)/);return _e?_e[1].length:0}function oe(){i.value!=="custom"&&(B.value=V())}function ve(){}function Me(){b.value=pe.value[0],C.value=ie[0],v.value=me.value[0],h.value=se[0]}function q(){a.value=!0,n.modelOpen!==void 0&&l("update:modelOpen",!0),Me(),re(n.currentFormat??""),n.isCustom&&(i.value="custom"),t.nextTick(()=>{var Re;return(Re=R.value)==null?void 0:Re.focus()})}function $(){a.value=!1,n.modelOpen!==void 0&&l("update:modelOpen",!1)}function Y(){l("apply",B.value),$()}function W(){$()}function fe(Re){Re.key==="Escape"&&$()}t.watch(()=>n.modelOpen,Re=>{Re&&!a.value?q():!Re&&a.value&&$()});const Ae=t.computed(()=>An(n.sampleValue,B.value,n.locale));return(Re,_e)=>(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:W,onKeydown:fe},[t.createElementVNode("div",{class:t.normalizeClass(["nf-dialog",{"nf-dialog--zh":e.locale==="zh-CN"}]),onMousedown:_e[9]||(_e[9]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",cu,[t.createElementVNode("span",du,t.toDisplayString(t.unref(w)(e.locale,"nfDialogTitle")),1),t.createElementVNode("button",{class:"nf-dialog__close",type:"button",onClick:$},[..._e[10]||(_e[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",uu,[t.createElementVNode("div",fu,[t.createElementVNode("label",mu,t.toDisplayString(t.unref(w)(e.locale,"nfCategory")),1),t.createVNode(Kt,{class:"nf-field__dropdown","model-value":i.value,options:Xe.value,"onUpdate:modelValue":_e[0]||(_e[0]=Ge=>i.value=Ge),onChange:oe},null,8,["model-value","options"])]),Fe.value?(t.openBlock(),t.createElementBlock("div",pu,[t.createElementVNode("label",hu,t.toDisplayString(t.unref(w)(e.locale,"nfDecimals")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":_e[1]||(_e[1]=Ge=>r.value=Ge),class:"nf-field__input",type:"number",min:"0",max:"30",onInput:oe},null,544),[[t.vModelText,r.value,void 0,{number:!0}]])])):t.createCommentVNode("",!0),j.value?(t.openBlock(),t.createElementBlock("div",gu,[t.createElementVNode("label",bu,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":_e[2]||(_e[2]=Ge=>c.value=Ge),type:"checkbox",onChange:oe},null,544),[[t.vModelCheckbox,c.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(w)(e.locale,"nfThousands")),1)])])):t.createCommentVNode("",!0),we.value?(t.openBlock(),t.createElementBlock("div",yu,[t.createElementVNode("label",Cu,t.toDisplayString(t.unref(w)(e.locale,"nfSymbol")),1),t.createVNode(Kt,{class:"nf-field__dropdown","model-value":d.value,options:t.unref(Qe),"onUpdate:modelValue":_e[3]||(_e[3]=Ge=>d.value=Ge),onChange:oe},null,8,["model-value","options"])])):t.createCommentVNode("",!0),ze.value?(t.openBlock(),t.createElementBlock("div",wu,[t.createElementVNode("label",vu,t.toDisplayString(t.unref(w)(e.locale,"nfDateFormat")),1),t.createVNode(Kt,{class:"nf-field__dropdown","model-value":b.value,options:X.value,"onUpdate:modelValue":_e[4]||(_e[4]=Ge=>b.value=Ge),onChange:oe},null,8,["model-value","options"])])):t.createCommentVNode("",!0),le.value?(t.openBlock(),t.createElementBlock("div",ku,[t.createElementVNode("label",Eu,t.toDisplayString(t.unref(w)(e.locale,"nfTimeFormat")),1),t.createVNode(Kt,{class:"nf-field__dropdown","model-value":C.value,options:t.unref(rt),"onUpdate:modelValue":_e[5]||(_e[5]=Ge=>C.value=Ge),onChange:oe},null,8,["model-value","options"])])):t.createCommentVNode("",!0),xe.value?(t.openBlock(),t.createElementBlock("div",Ru,[t.createElementVNode("label",Su,t.toDisplayString(t.unref(w)(e.locale,"nfDateTime")),1),t.createVNode(Kt,{class:"nf-field__dropdown","model-value":v.value,options:O.value,"onUpdate:modelValue":_e[6]||(_e[6]=Ge=>v.value=Ge),onChange:oe},null,8,["model-value","options"])])):t.createCommentVNode("",!0),ce.value?(t.openBlock(),t.createElementBlock("div",Mu,[t.createElementVNode("label",Nu,t.toDisplayString(t.unref(w)(e.locale,"nfDuration")),1),t.createVNode(Kt,{class:"nf-field__dropdown","model-value":h.value,options:t.unref(I),"onUpdate:modelValue":_e[7]||(_e[7]=Ge=>h.value=Ge),onChange:oe},null,8,["model-value","options"])])):t.createCommentVNode("",!0),t.createElementVNode("div",Bu,[t.createElementVNode("label",xu,t.toDisplayString(t.unref(w)(e.locale,"nfCustomCode")),1),t.withDirectives(t.createElementVNode("textarea",{ref_key:"customCodeRef",ref:R,"onUpdate:modelValue":_e[8]||(_e[8]=Ge=>B.value=Ge),class:"nf-field__textarea",rows:"2",spellcheck:"false",onInput:ve},null,544),[[t.vModelText,B.value]])])]),t.createElementVNode("div",Tu,[t.createElementVNode("div",Vu,[t.createElementVNode("span",Du,t.toDisplayString(t.unref(w)(e.locale,"nfPreview")),1),t.createElementVNode("span",Fu,t.toDisplayString(Ae.value||"—"),1)]),t.createElementVNode("div",Iu,[t.createElementVNode("button",{class:"nf-btn nf-btn--primary",type:"button",onClick:Y},t.toDisplayString(t.unref(w)(e.locale,"ok")),1),t.createElementVNode("button",{class:"nf-btn",type:"button",onClick:$},t.toDisplayString(t.unref(w)(e.locale,"cancel")),1)])])],34)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-84bb335b"]]),Au={class:"sort-confirm__header"},Lu={class:"sort-confirm__title"},$u={class:"sort-confirm__body"},zu={class:"sort-confirm__message"},_u={class:"sort-confirm__options"},Hu={class:"sort-confirm__option"},Wu={class:"sort-confirm__option"},Uu={class:"sort-confirm__footer"},Pu=Dt(t.defineComponent({__name:"sort-confirm-dialog",props:{modelOpen:{type:Boolean,default:!1},locale:{default:"zh-CN"}},emits:["update:modelOpen","confirm","cancel"],setup(e,{emit:o}){const n=e,l=o,a=t.ref(!1),i=t.ref(!0),r=t.ref(null);t.watch(()=>n.modelOpen,B=>{B&&!a.value?c():!B&&a.value&&d()});function c(){i.value=!0,a.value=!0,n.modelOpen!==void 0&&l("update:modelOpen",!0),t.nextTick(()=>{var R;const B=(R=r.value)==null?void 0:R.querySelector(".sort-confirm__btn--primary");B==null||B.focus()})}function d(){a.value=!1,n.modelOpen!==void 0&&l("update:modelOpen",!1)}function b(){h()}function C(B){B.key==="Escape"&&h()}function v(){l("confirm",i.value),d()}function h(){l("cancel"),d()}return(B,R)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"sort-confirm"},{default:t.withCtx(()=>[a.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"sort-confirm__mask",onMousedown:b,onKeydown:C},[t.createElementVNode("div",{ref_key:"dialogRef",ref:r,class:"sort-confirm",onMousedown:R[2]||(R[2]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",Au,[t.createElementVNode("span",Lu,t.toDisplayString(t.unref(w)(e.locale,"sortReminderTitle")),1),t.createElementVNode("button",{class:"sort-confirm__close",type:"button",onClick:h},[...R[3]||(R[3]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M571.733333 512l288.533334-288.533333c17.066667-17.066667 17.066667-42.666667 0-59.733334-17.066667-17.066667-42.666667-17.066667-59.733334 0L512 452.266667 223.466667 164.266667c-17.066667-17.066667-42.666667-17.066667-59.733334 0-17.066667 17.066667-17.066667 42.666667 0 59.733333L452.266667 512 164.266667 800c-17.066667 17.066667-17.066667 42.666667 0 59.733333 8.533333 8.533333 19.2 12.8 29.866666 12.8 10.666667 0 21.333333-4.266667 29.866667-12.8L512 571.733333l288.533333 288.533334c8.533333 8.533333 19.2 12.8 29.866667 12.8 10.666667 0 21.333333-4.266667 29.866667-12.8 17.066667-17.066667 17.066667-42.666667 0-59.733334L571.733333 512z"})],-1)])])]),t.createElementVNode("div",$u,[t.createElementVNode("p",zu,t.toDisplayString(t.unref(w)(e.locale,"sortReminderMessage")),1),t.createElementVNode("div",_u,[t.createElementVNode("label",Hu,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":R[0]||(R[0]=F=>i.value=F),type:"radio",value:!0},null,512),[[t.vModelRadio,i.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(w)(e.locale,"sortExpandSelection")),1)]),t.createElementVNode("label",Wu,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":R[1]||(R[1]=F=>i.value=F),type:"radio",value:!1},null,512),[[t.vModelRadio,i.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(w)(e.locale,"sortCurrentSelection")),1)])])]),t.createElementVNode("div",Uu,[t.createElementVNode("button",{class:"sort-confirm__btn sort-confirm__btn--primary",type:"button",onClick:v},t.toDisplayString(t.unref(w)(e.locale,"sort")),1),t.createElementVNode("button",{class:"sort-confirm__btn",type:"button",onClick:h},t.toDisplayString(t.unref(w)(e.locale,"cancel")),1)])],544)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-af42d78b"]]),ca=[{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)"}],Ku={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 Gu(e){let o=0,n=null;for(let l=0;l<e.length;l++){const a=e[l];if(n){a===n&&(e[l+1]===n?l++:n=null);continue}if(a==='"'||a==="'"){n=a;continue}if(a==="(")o++;else if(a===")"&&(o--,o<0))return!1}return o===0}function qu(e){const o=e.trim();if(!o.startsWith("="))return{ok:!1,name:null};const n=/^([A-Za-z_][A-Za-z0-9_]*)\s*\(([\s\S]*)\)$/.exec(o.slice(1).trim());if(!n)return{ok:!1,name:null};const l=n[1].toUpperCase(),a=Ku[l];if(!a)return{ok:!1,name:l};const i=n[2];if(!Gu(i))return{ok:!1,name:l};const r=al(i),c=r.length===1&&r[0].trim()===""?0:r.length;return c<a.min||c>a.max?{ok:!1,name:l}:r.some(d=>d.trim()==="")?{ok:!1,name:l}:{ok:!0,name:l}}function Ul(e,o,n){const l=e.split(":");if(l.length!==2)return null;const a=hn(l[0],o,n),i=hn(l[1],o,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 da(e){const o=e.trim();if(o==="")return"";const n=Number(o);return!isNaN(n)&&/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(o)?n:e}function Xn(e,o,n,l,a){const i=n[Hl(e,o)];if(!i)return"";const r=i.value;return r.startsWith("=")?fa(Hl(e,o),n,l,a):da(r)}function ua(e,o,n,l,a){const i=Xn(e,o,n,l,a);if(i===null)return 0;if(typeof i=="number")return i;const r=parseFloat(String(i));return isNaN(r)?0:r}const ao=new Map,Fo=new Set;function Cl(){ao.clear(),Fo.clear()}function fa(e,o,n,l){return ju(e,o,n,l,0)}function ju(e,o,n,l,a){if(Fo.has(e))return null;if(ao.has(e))return ao.get(e);Fo.add(e);const i=o[e];let r;if(!i)r=null;else{const c=i.value;if(!c.startsWith("="))r=da(c);else{const d=c.slice(1).trim(),b=/^([A-Za-z_][A-Za-z0-9_]*)\s*\(([\s\S]*)\)$/.exec(d);r=b?ga(b[1].toUpperCase(),b[2],o,n,l,a+1):Gt(d,o,n,l,a+1)}}return Fo.delete(e),ao.set(e,r),r}function Pl(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 mr(e,o,n){let l;if(typeof e=="number"&&typeof o=="number")l=e<o?-1:e>o?1:0;else{const a=String(e??""),i=String(o??"");l=a<i?-1:a>i?1:0}switch(n){case"=":return l===0;case"<>":return l!==0;case"<":return l<0;case">":return l>0;case"<=":return l<=0;case">=":return l>=0}return!1}function pa(e,o,n,l){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 Yu(e,o,n,l,a,i){let c=o.trim();c.length>=2&&(c[0]==='"'&&c[c.length-1]==='"'||c[0]==="'"&&c[c.length-1]==="'")&&(c=c.slice(1,-1));const d=/^([<>=]+)([\s\S]*)$/.exec(c);if(d){const C=d[1],v=pa(d[2]);return mr(e,v,C)}const b=pa(c);return ma(e,b)}function ha(e,o,n,l,a){const i=e.trim(),r=["<=",">=","<>"];let c=null,d=-1,b=null,C=0;for(let h=0;h<i.length;h++){const B=i[h];if(b){B===b&&(i[h+1]===b?h++:b=null);continue}if(B==='"'||B==="'"){b=B;continue}if(B==="("&&C++,B===")"&&C--,C===0&&(B==="<"||B===">"||B==="=")){const R=i.slice(h,h+2);c=r.includes(R)?R:B,d=h;break}}if(c&&d>=0){const h=i.slice(0,d).trim(),B=i.slice(d+c.length).trim(),R=Gt(h,o,n,l,a),F=Gt(B,o,n,l,a);return mr(R,F,c)}const v=Gt(i,o,n,l,a);return Pl(v)}function al(e){const o=[];let n=0,l=null,a="";for(let i=0;i<e.length;i++){const r=e[i];if(l){a+=r,r===l&&(e[i+1]===l?(i++,a+=l):l=null);continue}if(r==='"'||r==="'"){l=r,a+=r;continue}if(r==="("&&n++,r===")"&&n--,r===","&&n===0){o.push(a),a="";continue}a+=r}return o.push(a),o}function Gt(e,o,n,l,a){if(a>20)return null;const i=e.trim();if(i==="")return null;const r=i.toUpperCase();if(r==="TRUE")return 1;if(r==="FALSE")return 0;const c=Xu(i);if(c.length===0)return null;let d=0;const b=()=>{const R=C(),F=c[d];if(!(F&&F.type==="cmp"))return R;d++;const Q=C();return R===null||Q===null?null:mr(R,Q,F.val)?1:0},C=()=>{let R=v();for(;d<c.length;){const F=c[d];if(F.type==="op"&&(F.val==="+"||F.val==="-"))d++,R=pr(R,v(),F.val);else break}return R},v=()=>{let R=h();for(;d<c.length;){const F=c[d];if(F.type==="op"&&(F.val==="*"||F.val==="/"))d++,R=pr(R,h(),F.val);else break}return R},h=()=>{const R=c[d];return R&&R.type==="op"&&R.val==="-"?(d++,pr(0,h(),"-")):R&&R.type==="op"&&R.val==="+"?(d++,h()):B()},B=()=>{const R=c[d];if(!R)return null;if(R.type==="num")return d++,Number(R.val);if(R.type==="str")return d++,R.val;if(R.type==="lp"){d++;const F=b();return c[d]&&c[d].type==="rp"&&d++,F}if(R.type==="ref"){d++;const F=hn(R.val,n,l);return F?Xn(F.col,F.row,o,n,l):null}if(R.type==="func"){const F=R.val.toUpperCase();if(d++,c[d]&&c[d].type==="lp"){const Q=c[d];let K=0,Ee=null,ee=d;for(;ee<c.length;ee++)if(c[ee].type==="lp")K++;else if(c[ee].type==="rp"&&(K--,K===0)){Ee=c[ee];break}if(Ee){const pe=i.slice(Q.start+1,Ee.start);return d=ee+1,ga(F,pe,o,n,l,a+1)}}return null}return d++,null};return b()}function Xu(e){const o=[];let n=0;for(;n<e.length;){const l=e[n];if(/\s/.test(l)){n++;continue}if(l==='"'||l==="'"){const a=l,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++}o.push({type:"str",val:r,start:i});continue}if(/[0-9]/.test(l)||l==="."){const a=n;let i="";for(l==="."&&(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++;o.push({type:"num",val:i,start:a});continue}if(/[A-Za-z_$]/.test(l)){const a=n;let i="";for(;n<e.length&&/[A-Za-z0-9_$]/.test(e[n]);)i+=e[n],n++;e[n]==="("&&!i.includes("$")?o.push({type:"func",val:i,start:a}):o.push({type:"ref",val:i,start:a});continue}if(l==="("){o.push({type:"lp",val:l,start:n}),n++;continue}if(l===")"){o.push({type:"rp",val:l,start:n}),n++;continue}if(l===","){o.push({type:"comma",val:l,start:n}),n++;continue}if(l==="+"||l==="-"||l==="*"||l==="/"){o.push({type:"op",val:l,start:n}),n++;continue}if(l==="<"||l===">"||l==="="){const a=e.slice(n,n+2);a==="<="||a===">="||a==="<>"?(o.push({type:"cmp",val:a,start:n}),n+=2):(o.push({type:"cmp",val:l,start:n}),n++);continue}n++}return o}function pr(e,o,n){if(typeof e!="number"||typeof o!="number")return null;switch(n){case"+":return e+o;case"-":return e-o;case"*":return e*o;case"/":return o===0?null:e/o}return null}function ga(e,o,n,l,a,i){switch(e){case"SUM":case"AVERAGE":case"COUNT":{const r=Ul(o.trim(),l,a);if(!r)return null;if(e==="COUNT"){let d=0;for(let b=r.sc;b<=r.ec;b++)for(let C=r.sr;C<=r.er;C++)typeof Xn(b,C,n,l,a)=="number"&&d++;return d}let c=0;for(let d=r.sc;d<=r.ec;d++)for(let b=r.sr;b<=r.er;b++)c+=ua(d,b,n,l,a);if(isNaN(c))return null;if(e==="AVERAGE"){const d=(r.ec-r.sc+1)*(r.er-r.sr+1);return d===0?null:c/d}return c}case"AND":case"OR":{const r=al(o);if(r.length===0)return null;const c=e==="AND";for(const d of r){const b=Gt(d,n,l,a,i);if(b===null)return null;if(e==="AND"){if(!Pl(b))return 0}else if(Pl(b))return 1}return c?1:0}case"NOT":{const r=al(o);if(r.length!==1)return null;const c=Gt(r[0],n,l,a,i);return c===null?null:Pl(c)?0:1}case"IF":{const r=al(o);if(r.length<3)return null;const c=ha(r[0],n,l,a,i);return Gt(c?r[1]:r[2],n,l,a,i)}case"VLOOKUP":{const r=al(o);if(r.length<3)return null;const c=Gt(r[0],n,l,a,i),d=Ul(r[1].trim(),l,a);if(!d)return null;const b=Gt(r[2],n,l,a,i),C=typeof b=="number"?b:parseFloat(String(b));if(isNaN(C))return null;const v=d.sc+(C-1);if(v<d.sc||v>d.ec)return null;if(r.length>=4?Pl(Gt(r[3],n,l,a,i)):!1){let B=-1,R=-1/0;for(let F=d.sr;F<=d.er;F++){const Q=Xn(d.sc,F,n,l,a);typeof Q=="number"&&typeof c=="number"&&Q<=c&&Q>R&&(R=Q,B=F)}return B>=0?Xn(v,B,n,l,a):null}for(let B=d.sr;B<=d.er;B++){const R=Xn(d.sc,B,n,l,a);if(ma(R,c))return Xn(v,B,n,l,a)}return null}case"CONCATENATE":{const r=al(o);let c="";for(const d of r){const b=Gt(d,n,l,a,i);c+=b===null?"":typeof b=="number"?String(b):b}return c}case"MAX":case"MIN":{const r=Ul(o.trim(),l,a);if(!r)return null;const c=[];for(let d=r.sc;d<=r.ec;d++)for(let b=r.sr;b<=r.er;b++){const C=Xn(d,b,n,l,a);typeof C=="number"&&c.push(C)}return c.length===0?null:e==="MAX"?Math.max(...c):Math.min(...c)}case"STDEV":{const r=Ul(o.trim(),l,a);if(!r)return null;const c=[];for(let v=r.sc;v<=r.ec;v++)for(let h=r.sr;h<=r.er;h++){const B=Xn(v,h,n,l,a);typeof B=="number"&&c.push(B)}const d=c.length;if(d<2)return null;const b=c.reduce((v,h)=>v+h,0)/d,C=c.reduce((v,h)=>v+Math.pow(h-b,2),0)/(d-1);return Math.sqrt(C)}case"SIN":{const r=al(o);if(r.length!==1)return null;const c=Gt(r[0],n,l,a,i);return typeof c!="number"?null:Math.sin(c)}case"SUMIF":{const r=al(o);if(r.length<2||r.length>3)return null;const c=Ul(r[0].trim(),l,a);if(!c)return null;const d=r.length===3?Ul(r[2].trim(),l,a):c;if(!d)return null;let b=0;for(let C=c.sr;C<=c.er;C++)for(let v=c.sc;v<=c.ec;v++){const h=Xn(v,C,n,l,a);Yu(h,r[1])&&(b+=ua(d.sc+(v-c.sc),d.sr+(C-c.sr),n,l,a))}return b}case"PMT":{const r=al(o);if(r.length<3||r.length>5)return null;const c=Gt(r[0],n,l,a,i),d=Gt(r[1],n,l,a,i),b=Gt(r[2],n,l,a,i);if(typeof c!="number"||typeof d!="number"||typeof b!="number")return null;const C=r.length>=4?Gt(r[3],n,l,a,i):0,v=typeof C=="number"?C:0,h=r.length>=5?Gt(r[4],n,l,a,i):0,B=Pl(h)?1:0;if(c===0)return d===0?null:-(b+v)/d;const R=Math.pow(1+c,d);return-(v+b*R)*c/((1+c*B)*(R-1))}default:return null}}function Io(e,o,n){const l=[],a=/(\$?[A-Z]+\$?\d+)(?::(\$?[A-Z]+\$?\d+))?/gi;let i;for(;(i=a.exec(e))!==null;){const r=hn(i[1],o,n);if(r)if(i[2]){const c=hn(i[2],o,n);if(!c)continue;for(let d=Math.min(r.col,c.col);d<=Math.max(r.col,c.col);d++)for(let b=Math.min(r.row,c.row);b<=Math.max(r.row,c.row);b++)l.push(Hl(d,b))}else l.push(Hl(r.col,r.row))}return l}function ba(e,o,n,l,a){const i=n[Hl(e,o)];if(!i)return"";const r=i.value;if(!r.startsWith("="))return r;const c=fa(Hl(e,o),n,l,a);return c===null?"#ERROR":String(c)}function ya(e,o,n,l){return Gt(e,o,n,l,0)}function Ca(e,o,n,l){const a=e.trim().replace(/^=/,"");return a?ha(a,o,n,l,0):!1}function Oo(e,o,n,l,a,i){return o===0&&n===0?e:e.replace(/(\$?)([A-Z]+)(\$?)(\d+)/gi,(r,c,d,b,C)=>{const v=c?lr(d):lr(d)+o,h=b?parseInt(C,10)-1:parseInt(C,10)-1+n;let B;v<0?B="A":v>=l?B=i(l-1):B=i(v);let R;return h<0?R="1":h>=a?R=String(a):R=String(h+1),(c||"")+B+(b||"")+R})}class Zu{constructor(){this.deps=new Map,this.rev=new Map,this.dirty=new Set}clear(o){var l;const n=this.deps.get(o);if(n){for(const a of n)(l=this.rev.get(a))==null||l.delete(o);this.deps.delete(o)}}set(o,n){if(this.clear(o),n.length!==0){this.deps.set(o,n);for(const l of n)this.rev.has(l)||this.rev.set(l,new Set),this.rev.get(l).add(o)}}markDirty(o){const n=[o];for(;n.length>0;){const l=n.pop(),a=this.rev.get(l);if(a)for(const i of a)this.dirty.has(i)||(this.dirty.add(i),n.push(i))}}getDirtyAndClear(){const o=this.dirty;return this.dirty=new Set,o}rebuild(o,n,l){this.deps.clear(),this.rev.clear(),this.dirty.clear(),ao.clear();for(const[a,i]of Object.entries(o))if(i.value.startsWith("=")){const r=Io(i.value.slice(1),n,l);this.set(a,r)}}}const Ju={class:"ifn-dialog__header"},Qu={class:"ifn-dialog__title"},ef={class:"ifn-dialog__body"},tf={class:"ifn-dialog__field"},nf={class:"ifn-dialog__label"},lf={key:0,class:"ifn-dialog__desc"},of={class:"ifn-dialog__field"},rf={class:"ifn-dialog__label"},af={class:"ifn-dialog__footer"},sf=["disabled"],cf=Dt(t.defineComponent({__name:"insert-function-dialog",props:{modelOpen:{type:Boolean,default:!1},locale:{default:"zh-CN"}},emits:["update:modelOpen","insert","cancel"],setup(e,{emit:o}){const n=e,l=o,a=t.ref(!1),i=t.ref(""),r=t.ref(""),c=t.ref(null),d=t.ref(null),b={SUM:"fnDescSum",AVERAGE:"fnDescAverage",COUNT:"fnDescCount",IF:"fnDescIf",VLOOKUP:"fnDescVlookup",CONCATENATE:"fnDescConcatenate",MAX:"fnDescMax",MIN:"fnDescMin",SIN:"fnDescSin",SUMIF:"fnDescSumif",PMT:"fnDescPmt",STDEV:"fnDescStdev"},C=t.computed(()=>ca.map(ie=>({label:ie.name,value:ie.name}))),v=t.computed(()=>{const ie=String(i.value??"");return ie?w(n.locale,b[ie]??""):""}),h=t.computed(()=>qu(r.value)),B=t.computed(()=>i.value===""||i.value===null||!r.value.trim()||!h.value.ok?!1:h.value.name===String(i.value).toUpperCase());t.watch(()=>n.modelOpen,ie=>{ie&&!a.value?R():!ie&&a.value&&F()});function R(){r.value="",i.value="",a.value=!0,n.modelOpen!==void 0&&l("update:modelOpen",!0),t.nextTick(()=>{const ie=c.value;if(ie)try{ie.focus({preventScroll:!0}),ie.setSelectionRange(ie.value.length,ie.value.length)}catch{}})}function F(){a.value=!1,n.modelOpen!==void 0&&l("update:modelOpen",!1)}function Q(ie){i.value=ie;const me=ca.find(se=>se.name===String(ie));me&&(r.value="",K(me.snippet))}function K(ie){const me=r.value,se=c.value,Se=se?se.selectionStart??me.length:me.length,Xe=se?se.selectionEnd??me.length:me.length,Qe=me.trim()?ie:"="+ie;r.value=me.slice(0,Se)+Qe+me.slice(Xe),t.nextTick(()=>{const X=c.value;if(!X)return;const rt=Se+Qe.length;try{X.focus({preventScroll:!0}),X.setSelectionRange(rt,rt)}catch{}})}function Ee(){l("insert",r.value),F()}function ee(){l("cancel"),F()}function pe(ie){ie.key==="Escape"&&(ie.stopPropagation(),ee())}return(ie,me)=>(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(ee,["self"]),onKeydown:pe},[t.createElementVNode("div",{ref_key:"dialogRef",ref:d,class:"ifn-dialog",onMousedown:me[1]||(me[1]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",Ju,[t.createElementVNode("span",Qu,t.toDisplayString(t.unref(w)(e.locale,"insertFunctionTitle")),1),t.createElementVNode("button",{class:"ifn-dialog__close",type:"button",onClick:ee},[...me[2]||(me[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",ef,[t.createElementVNode("div",tf,[t.createElementVNode("label",nf,t.toDisplayString(t.unref(w)(e.locale,"insertFunctionSelectLabel")),1),t.createVNode(Kt,{class:"ifn-dialog__dropdown","model-value":i.value,options:C.value,searchable:!0,"search-placeholder":t.unref(w)(e.locale,"insertFunctionSearchPlaceholder"),"fallback-label":t.unref(w)(e.locale,"insertFunctionPlaceholder"),title:t.unref(w)(e.locale,"insertFunctionSelectLabel"),"onUpdate:modelValue":Q},null,8,["model-value","options","search-placeholder","fallback-label","title"]),v.value?(t.openBlock(),t.createElementBlock("div",lf,t.toDisplayString(v.value),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",of,[t.createElementVNode("label",rf,t.toDisplayString(t.unref(w)(e.locale,"insertFunctionFormulaLabel")),1),t.withDirectives(t.createElementVNode("textarea",{ref_key:"textareaRef",ref:c,"onUpdate:modelValue":me[0]||(me[0]=se=>r.value=se),class:"ifn-dialog__textarea",spellcheck:"false"},null,512),[[t.vModelText,r.value]])])]),t.createElementVNode("div",af,[t.createElementVNode("button",{class:"ifn-dialog__btn ifn-dialog__btn--primary",type:"button",disabled:!B.value,onClick:Ee},t.toDisplayString(t.unref(w)(e.locale,"insertFunctionBtn")),9,sf),t.createElementVNode("button",{class:"ifn-dialog__btn",type:"button",onClick:ee},t.toDisplayString(t.unref(w)(e.locale,"cancel")),1)])],544)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-9b21a714"]]),io="__filter_blank__";function hr(e,o,n,l){if(Ln(e))return Number(e);if(l==="date"){const a=Yn(e,n);if(a)return a.serial}return null}function Ao(e,o,n){if(e==null)return null;if(Ln(e))return Number(e);if(o==="date"){const l=Yn(e,n);if(l)return l.serial}return null}function df(e,o,n,l,a){const i=An(o,n,l);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=hr(o,n,l,a),b=Ao(e.value,a,l);return d==null||b==null?!1:r?d===b:d!==b}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=hr(o,n,l,a),c=Ao(e.value,a,l);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=hr(o,n,l,a),c=Ao(e.value,a,l),d=Ao(e.value2,a,l);if(r==null||c==null||d==null)return!1;const b=Math.min(c,d),C=Math.max(c,d);return r>=b&&r<=C}}return!0}function wa(e,o,n,l){if(e.type==="values"){const a=e.values??[];if(a.length===0)return!0;if(o.trim()==="")return a.includes(io);const i=An(o,n,l);return a.includes(o)||a.includes(i)}return e.condition?df(e.condition,o,n,l,e.type):!0}function uf(e,o,n,l){if(!e)return!0;const{columns:a,range:i}=e;for(const r in a){const c=Number(r);if(c<i.startCol||c>i.endCol)continue;const d=a[r],b=n.getValue(c,o),C=n.getFormat(c,o);if(!wa(d,b,C,l))return!1}return!0}function ff(e,o,n,l){const a=new Set,i=[];let r=!1;const{range:c,columns:d}=e;for(let C=c.startRow+1;C<=c.endRow;C++){let v=!0;for(const R in d){const F=Number(R);if(F===o)continue;const Q=d[R];if(!wa(Q,n.getValue(F,C),n.getFormat(F,C),l)){v=!1;break}}if(!v)continue;const h=n.getValue(o,C),B=An(h,n.getFormat(o,C),l);if(h.trim()===""){r=!0;continue}a.has(B)||(a.add(B),i.push(B))}return i.length>0&&i.every(C=>Ln(C))?i.sort((C,v)=>Number(C)-Number(v)):i.sort((C,v)=>C.localeCompare(v,l,{numeric:!0})),{values:i,hasBlank:r}}function va(e){var o;return e?e.type==="values"?(((o=e.values)==null?void 0:o.length)??0)>0:!!e.condition:!1}const mf={class:"filter-popup__head"},pf={class:"filter-popup__head-label"},hf={key:0,class:"filter-popup__head-badge"},gf={class:"filter-popup__search"},bf=["placeholder"],yf={class:"filter-popup__tools"},Cf={class:"filter-popup__count"},wf=["checked","onChange"],vf={class:"filter-popup__item-label"},kf={key:0,class:"filter-popup__item-note"},Ef={key:0,class:"filter-popup__empty"},Rf={class:"filter-popup__modes"},Sf={key:1,class:"filter-popup__cond"},Mf={class:"filter-popup__cond-row"},Nf=["value"],Bf={key:0,class:"filter-popup__cond-row"},xf={class:"filter-popup__cond-and"},Tf={key:1,class:"filter-popup__cond-row"},Vf=["placeholder"],Df={class:"filter-popup__footer"},gr=248,Lo=28,Ff=252,If=Dt(t.defineComponent({__name:"filter-popup",props:{col:{},anchor:{},locale:{default:"zh-CN"},headerLabel:{},getFilter:{},setFilter:{},setFilterColumn:{},clearFilterColumn:{},getColumnCandidates:{},close:{},boundaryEl:{}},setup(e){const o=e,n=t.ref(null),l=t.ref(null),a=t.ref(null),i=t.ref({left:0,top:0}),r=t.ref("values"),c=t.ref(""),d=t.ref(new Set),b=t.ref(!1),C=t.ref(0),v=t.ref(null),h=t.ref("equals"),B=t.ref(""),R=t.ref(""),F=t.computed(()=>o.getColumnCandidates(o.col)),Q=t.computed(()=>c.value.trim()!==""),K=t.computed(()=>{const q=c.value.trim().toLowerCase();return q?F.value.values.filter($=>$.toLowerCase().includes(q)):F.value.values}),Ee=t.computed(()=>{const q=K.value.map($=>({key:$,label:$,isBlank:!1}));return F.value.hasBlank&&!Q.value&&q.push({key:io,label:w(o.locale,"filterBlank"),isBlank:!0}),q}),ee=Math.ceil(Ff/Lo),pe=t.computed(()=>Math.max(0,Math.floor(C.value/Lo)-2)),ie=t.computed(()=>Math.min(Ee.value.length,pe.value+ee+4)),me=t.computed(()=>Ee.value.slice(pe.value,ie.value)),se=t.computed(()=>pe.value*Lo),Se=t.computed(()=>Math.max(0,(Ee.value.length-ie.value)*Lo));function Xe(q){C.value=q.target.scrollTop}const Qe=["equals","notEquals","contains","notContains","startsWith","endsWith"],X=["equals","notEquals","gt","gte","lt","lte","between"],rt={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"?Qe:X),I=t.computed(()=>{var Y;const q=o.getFilter(),$=q==null?void 0:q.columns[o.col];return $?$.type==="values"?(((Y=$.values)==null?void 0:Y.length)??0)>0:!!$.condition:!1});function j(){const q=o.getFilter(),$=q==null?void 0:q.columns[o.col];$&&$.type==="values"?(d.value=new Set(($.values??[]).filter(Y=>Y!==io)),b.value=($.values??[]).includes(io)):$&&$.condition?(r.value=$.type,h.value=$.condition.operator,B.value=$.condition.value??"",R.value=$.condition.value2??""):(d.value=new Set(F.value.values),b.value=F.value.hasBlank)}function we(){if(!o.getFilter())return;const $=F.value.values,Y=F.value.hasBlank;if(d.value.size===$.length&&$.every(fe=>d.value.has(fe))&&b.value===Y)o.setFilterColumn(o.col,null);else{const fe=[...d.value];b.value&&fe.push(io),o.setFilterColumn(o.col,{type:"values",values:fe})}}function ze(q){const $=new Set(d.value);$.has(q)?$.delete(q):$.add(q),d.value=$}function le(){b.value=!b.value}function xe(){const q=Q.value?K.value:F.value.values,$=new Set(d.value);q.forEach(Y=>$.add(Y)),d.value=$,b.value=!0}function ce(){d.value=new Set,b.value=!1}function Fe(q){r.value=q,h.value=q==="text"?"contains":"equals",B.value="",R.value=""}function V(){r.value="values",j()}function J(){const q={operator:h.value,value:B.value};r.value!=="text"&&h.value==="between"&&(q.value2=R.value),B.value.trim()!==""&&(o.setFilterColumn(o.col,{type:r.value,condition:q}),o.close())}function re(){d.value=new Set(F.value.values),b.value=F.value.hasBlank}function ae(){we(),o.close()}function oe(){v.value&&o.setFilter(v.value),o.close()}function ve(q){const $=n.value;$&&q.target instanceof Node&&$.contains(q.target)||o.close()}function Me(q){q.key==="Escape"&&oe()}return t.onMounted(async()=>{var fe,Ae;v.value=o.getFilter()?JSON.parse(JSON.stringify(o.getFilter())):null,j(),await t.nextTick();const q=((fe=n.value)==null?void 0:fe.offsetHeight)??400;let $=o.anchor.x+15-gr,Y=o.anchor.y+24;const W=qn(o.boundaryEl);$<W.left+4&&($=Math.max(W.left+4,o.anchor.x)),$+gr>W.right-4&&($=Math.max(W.left+4,W.right-gr-4)),Y+q>W.bottom-4&&(Y=Math.max(W.top+4,o.anchor.y-q-4)),i.value={left:$,top:Y},(Ae=a.value)==null||Ae.focus(),document.addEventListener("pointerdown",ve,!0),document.addEventListener("keydown",Me,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",ve,!0),document.removeEventListener("keydown",Me,!0)}),(q,$)=>(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:$[9]||($[9]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",mf,[t.createElementVNode("span",pf,t.toDisplayString(e.headerLabel||t.unref(ut)(e.col)),1),I.value?(t.openBlock(),t.createElementBlock("span",hf,t.toDisplayString(t.unref(w)(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":$[0]||($[0]=Y=>c.value=Y),class:"filter-popup__search-input",type:"text",placeholder:t.unref(w)(e.locale,"filterSearchPlaceholder")},null,8,bf),[[t.vModelText,c.value]])]),t.createElementVNode("div",yf,[t.createElementVNode("button",{class:"filter-popup__tool",onClick:xe},t.toDisplayString(t.unref(w)(e.locale,"filterSelectAll")),1),t.createElementVNode("button",{class:"filter-popup__tool",onClick:ce},t.toDisplayString(t.unref(w)(e.locale,"filterClearAll")),1),t.createElementVNode("span",Cf,t.toDisplayString(t.unref(w)(e.locale,"filterFilteredCount").replace("{n}",String(F.value.values.length))),1)]),t.createElementVNode("div",{ref_key:"listRef",ref:l,class:"filter-popup__list",onScroll:Xe},[t.createElementVNode("div",{style:t.normalizeStyle({height:se.value+"px"})},null,4),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(me.value,Y=>(t.openBlock(),t.createElementBlock("label",{key:Y.key,class:"filter-popup__item"},[t.createElementVNode("input",{type:"checkbox",checked:Y.isBlank?b.value:d.value.has(Y.key),onChange:W=>Y.isBlank?le():ze(Y.key)},null,40,wf),t.createElementVNode("span",vf,t.toDisplayString(Y.label),1),Y.isBlank?(t.openBlock(),t.createElementBlock("span",kf,"("+t.toDisplayString(t.unref(w)(e.locale,"filterBlank"))+")",1)):t.createCommentVNode("",!0)]))),128)),t.createElementVNode("div",{style:t.normalizeStyle({height:Se.value+"px"})},null,4),Ee.value.length===0?(t.openBlock(),t.createElementBlock("div",Ef,t.toDisplayString(t.unref(w)(e.locale,"filterNoData")),1)):t.createCommentVNode("",!0)],544),t.createElementVNode("div",Rf,[t.createElementVNode("button",{class:"filter-popup__mode",onClick:$[1]||($[1]=Y=>Fe("text"))},t.toDisplayString(t.unref(w)(e.locale,"filterText")),1),t.createElementVNode("button",{class:"filter-popup__mode",onClick:$[2]||($[2]=Y=>Fe("number"))},t.toDisplayString(t.unref(w)(e.locale,"filterNumber")),1),t.createElementVNode("button",{class:"filter-popup__mode",onClick:$[3]||($[3]=Y=>Fe("date"))},t.toDisplayString(t.unref(w)(e.locale,"filterDate")),1)])],64)):(t.openBlock(),t.createElementBlock("div",Sf,[t.createElementVNode("button",{class:"filter-popup__cond-back",onClick:V}," ← "+t.toDisplayString(t.unref(w)(e.locale,"filterCustom")),1),t.createElementVNode("div",Mf,[t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":$[4]||($[4]=Y=>h.value=Y),class:"filter-popup__cond-select"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(O.value,Y=>(t.openBlock(),t.createElementBlock("option",{key:Y,value:Y},t.toDisplayString(t.unref(w)(e.locale,rt[Y])),9,Nf))),128))],512),[[t.vModelSelect,h.value]])]),h.value==="between"?(t.openBlock(),t.createElementBlock("div",Bf,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":$[5]||($[5]=Y=>B.value=Y),class:"filter-popup__cond-input",type:"text"},null,512),[[t.vModelText,B.value]]),t.createElementVNode("span",xf,t.toDisplayString(t.unref(w)(e.locale,"filterAnd")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":$[6]||($[6]=Y=>R.value=Y),class:"filter-popup__cond-input",type:"text"},null,512),[[t.vModelText,R.value]])])):(t.openBlock(),t.createElementBlock("div",Tf,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":$[7]||($[7]=Y=>B.value=Y),class:"filter-popup__cond-input",type:"text",placeholder:r.value==="date"?"2024-01-01":"",onKeydown:t.withKeys(J,["enter"])},null,40,Vf),[[t.vModelText,B.value]])]))])),t.createElementVNode("div",Df,[t.createElementVNode("button",{class:"filter-popup__btn filter-popup__btn--clear",onClick:re},t.toDisplayString(t.unref(w)(e.locale,"clearFilter")),1),$[10]||($[10]=t.createElementVNode("span",{class:"filter-popup__footer-spacer"},null,-1)),t.createElementVNode("button",{class:"filter-popup__btn",onClick:oe},t.toDisplayString(t.unref(w)(e.locale,"cancelFilter")),1),t.createElementVNode("button",{class:"filter-popup__btn filter-popup__btn--primary",onClick:$[8]||($[8]=Y=>r.value==="values"?ae():J())},t.toDisplayString(t.unref(w)(e.locale,"filterOk")),1)])],36)]))}}),[["__scopeId","data-v-8ed96243"]]),Of={class:"cf-manager__header"},Af={class:"cf-manager__title"},Lf={key:0,class:"cf-manager__empty"},$f={key:1,class:"cf-manager__list"},zf={class:"cf-rule__main"},_f={class:"cf-rule__info"},Hf={class:"cf-rule__summary"},Wf={class:"cf-rule__range"},Uf={class:"cf-rule__actions"},Pf={class:"cf-chk"},Kf=["checked","onChange"],Gf=["title","onClick"],qf=["title","onClick"],jf=["title","onClick"],Yf=["title","onClick"],Xf=Dt(t.defineComponent({__name:"conditional-format-manager",props:{locale:{},rules:{default:()=>[]},themeVars:{default:()=>({})}},emits:["edit","delete","move","toggle","new","close"],setup(e,{emit:o}){const n=e,l=o,a=t.computed(()=>[...n.rules].sort((d,b)=>d.priority-b.priority));function i(d){return d.ranges.map(b=>{const C=ut(b.startCol)+(b.startRow+1);return b.startCol===b.endCol&&b.startRow===b.endRow?C:C+":"+ut(b.endCol)+(b.endRow+1)}).join(", ")}function r(d){switch(d.type){case"cellIs":{const b=w(n.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"?`${b} ${d.value} ${w(n.locale,"cfValue2")} ${d.value2??""}`:`${b} ${d.value}`}case"textContains":return`${w(n.locale,"cfTextContains")} "${d.value}"`;case"textNotContains":return`${w(n.locale,"cfTextNotContains")} "${d.value}"`;case"blank":return w(n.locale,"cfBlank");case"notBlank":return w(n.locale,"cfNotBlank");case"duplicate":return w(n.locale,"cfDuplicate");case"unique":return w(n.locale,"cfUnique");case"formula":return"= "+d.formula;default:return w(n.locale,"cfRuleTypeGeneric")}}function c(d){const b={};return d.format.backgroundColor&&(b.background=d.format.backgroundColor),d.format.color&&(b.color=d.format.color),d.format.fontWeight==="bold"&&(b.fontWeight="700"),d.format.fontStyle==="italic"&&(b.fontStyle="italic"),d.format.underline==="underline"&&(b.textDecoration="underline"),d.format.strikethrough==="line-through"&&(b.textDecoration="line-through"),b}return(d,b)=>(t.openBlock(),t.createElementBlock("div",{class:"cf-manager",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("div",Of,[t.createElementVNode("span",Af,t.toDisplayString(t.unref(w)(e.locale,"cfManagerTitle")),1),t.createElementVNode("button",{type:"button",class:"cf-btn cf-btn--primary cf-manager__new",onClick:b[0]||(b[0]=C=>l("new"))},t.toDisplayString(t.unref(w)(e.locale,"cfNewRule")),1),t.createElementVNode("button",{type:"button",class:"cf-manager__close",onClick:b[1]||(b[1]=C=>l("close"))}," × ")]),a.value.length===0?(t.openBlock(),t.createElementBlock("div",Lf,t.toDisplayString(t.unref(w)(e.locale,"cfNoRules")),1)):(t.openBlock(),t.createElementBlock("div",$f,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,C=>(t.openBlock(),t.createElementBlock("div",{key:C.id,class:t.normalizeClass(["cf-rule",{"cf-rule--disabled":!C.enabled}])},[t.createElementVNode("div",zf,[t.createElementVNode("span",{class:"cf-rule__preview",style:t.normalizeStyle(c(C))},"Aa",4),t.createElementVNode("div",_f,[t.createElementVNode("div",Hf,t.toDisplayString(r(C.condition)),1),t.createElementVNode("div",Wf,t.toDisplayString(t.unref(w)(e.locale,"cfAppliedTo"))+": "+t.toDisplayString(i(C)),1)])]),t.createElementVNode("div",Uf,[t.createElementVNode("label",Pf,[t.createElementVNode("input",{class:"cf-chk__input",type:"checkbox",checked:C.enabled,onChange:v=>l("toggle",C.id,v.target.checked)},null,40,Kf),b[2]||(b[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(w)(e.locale,"cfEnabled")),1)]),t.createElementVNode("button",{type:"button",class:"cf-mini",title:t.unref(w)(e.locale,"cfMoveUp"),onClick:v=>l("move",C.id,"up")},[...b[3]||(b[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,Gf),t.createElementVNode("button",{type:"button",class:"cf-mini",title:t.unref(w)(e.locale,"cfMoveDown"),onClick:v=>l("move",C.id,"down")},[...b[4]||(b[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,qf),t.createElementVNode("button",{type:"button",class:"cf-mini",title:t.unref(w)(e.locale,"cfEdit"),onClick:v=>l("edit",C)},[...b[5]||(b[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,jf),t.createElementVNode("button",{type:"button",class:"cf-mini",title:t.unref(w)(e.locale,"cfDelete"),onClick:v=>l("delete",C.id)},[...b[6]||(b[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,Yf)])],2))),128))]))],4))}}),[["__scopeId","data-v-230c5fcf"]]),Zf={class:"cf-editor__header"},Jf={class:"cf-editor__title"},Qf={class:"cf-editor__body"},em={class:"cf-row"},tm={class:"cf-label"},nm={class:"cf-row"},lm={class:"cf-label"},om={class:"cf-row"},rm={class:"cf-label"},am={key:0,class:"cf-row"},im={class:"cf-label"},sm={class:"cf-row"},cm={class:"cf-label"},dm=["placeholder"],um={class:"cf-hint"},fm={key:2,class:"cf-row"},mm={class:"cf-label"},pm={class:"cf-row"},hm={class:"cf-label"},gm={class:"cf-format-row"},bm=["title"],ym={viewBox:"0 0 1024 1024",fill:"currentColor"},Cm=["fill"],wm=["title"],vm={viewBox:"0 0 1024 1024",fill:"currentColor"},km=["fill"],Em=["title"],Rm=["title"],Sm=["title"],Mm=["title"],Nm={class:"cf-row"},Bm={class:"cf-label"},xm={key:3,class:"cf-error"},Tm={class:"cf-row cf-row--inline"},Vm={class:"cf-chk"},Dm=["checked"],Fm={class:"cf-chk"},Im=["checked"],Om={class:"cf-editor__footer"},Am=Dt(t.defineComponent({__name:"conditional-format-rule-editor",props:{locale:{},mode:{},rule:{default:null},defaultRangeText:{default:""},themeVars:{default:()=>({})}},emits:["save","cancel"],setup(e,{emit:o}){const n=e,l=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(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(j=>B(j)).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()),d=t.ref(!1),b=t.ref(!1),C=t.ref(null),v=t.ref(null),h=t.ref("");function B(O){const I=ut(O.startCol)+(O.startRow+1);return O.startCol===O.endCol&&O.startRow===O.endRow?I:I+":"+ut(O.endCol)+(O.endRow+1)}function R(O){const I=O.split(",").map(we=>we.trim()).filter(Boolean),j=[];for(const we of I){if(!we.match(/^[A-Za-z]+\d+(?::[A-Za-z]+\d+)?$/i))return null;const le=hn(we.split(":")[0],99999,99999),xe=we.split(":")[1],ce=xe?hn(xe,99999,99999):le;if(!le||!ce)return null;j.push({startCol:Math.min(le.col,ce.col),endCol:Math.max(le.col,ce.col),startRow:Math.min(le.row,ce.row),endRow:Math.max(le.row,ce.row)})}return j.length?j:null}const F=t.computed(()=>c.type==="cellIs"&&(c.operator==="between"||c.operator==="notBetween")),Q=t.computed(()=>c.type==="formula"),K=t.computed(()=>["blank","notBlank","duplicate","unique"].includes(c.type)),Ee=t.computed(()=>a.map(O=>({value:O.value,label:w(n.locale,O.label)}))),ee=t.computed(()=>i.map(O=>({value:O.value,label:w(n.locale,O.label)})));function pe(O){c.type=O}function ie(O){c.operator=String(O)}function me(){d.value=!d.value}function se(){b.value=!b.value}function Se(){return h.value="",R(c.rangeText)?Q.value&&!c.formula.trim()?(h.value="请输入公式",!1):!0:(h.value="范围格式无效,例如 A1:B10",!1)}function Xe(){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 Qe(){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 X(){var j,we;if(!Se())return;const O=R(c.rangeText),I={id:((j=n.rule)==null?void 0:j.id)??"",condition:Xe(),format:Qe(),ranges:O,priority:((we=n.rule)==null?void 0:we.priority)??0,stopIfTrue:c.stopIfTrue,enabled:c.enabled};l("save",I)}function rt(){l("cancel")}return(O,I)=>(t.openBlock(),t.createElementBlock("div",{class:"cf-editor",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("div",Zf,[t.createElementVNode("span",Jf,t.toDisplayString(e.mode==="edit"?t.unref(w)(e.locale,"cfEdit"):t.unref(w)(e.locale,"cfNewRule")),1),t.createElementVNode("button",{type:"button",class:"cf-editor__close",onClick:rt}," × ")]),t.createElementVNode("div",Qf,[t.createElementVNode("div",em,[t.createElementVNode("label",tm,t.toDisplayString(t.unref(w)(e.locale,"cfType")),1),t.createVNode(Kt,{class:"cf-dropdown","model-value":c.type,options:Ee.value,width:"100%","visible-count":8,title:t.unref(w)(e.locale,"cfType"),align:"right",onChange:pe},null,8,["model-value","options","title"])]),c.type==="cellIs"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",nm,[t.createElementVNode("label",lm,t.toDisplayString(t.unref(w)(e.locale,"cfOperator")),1),t.createVNode(Kt,{class:"cf-dropdown","model-value":c.operator,options:ee.value,width:"100%","visible-count":9,title:t.unref(w)(e.locale,"cfOperator"),align:"right",onChange:ie},null,8,["model-value","options","title"])]),t.createElementVNode("div",om,[t.createElementVNode("label",rm,t.toDisplayString(t.unref(w)(e.locale,"cfValue")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":I[0]||(I[0]=j=>c.value=j),class:"cf-input",type:"text"},null,512),[[t.vModelText,c.value]])]),F.value?(t.openBlock(),t.createElementBlock("div",am,[t.createElementVNode("label",im,t.toDisplayString(t.unref(w)(e.locale,"cfValue2")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":I[1]||(I[1]=j=>c.value2=j),class:"cf-input",type:"text"},null,512),[[t.vModelText,c.value2]])])):t.createCommentVNode("",!0)],64)):Q.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",sm,[t.createElementVNode("label",cm,t.toDisplayString(t.unref(w)(e.locale,"cfFormulaShort")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":I[2]||(I[2]=j=>c.formula=j),class:"cf-input",type:"text",placeholder:t.unref(w)(e.locale,"cfFormulaExample")},null,8,dm),[[t.vModelText,c.formula]])]),t.createElementVNode("p",um,t.toDisplayString(t.unref(w)(e.locale,"cfFormula")),1)],64)):K.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",fm,[t.createElementVNode("label",mm,t.toDisplayString(t.unref(w)(e.locale,"cfValue")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":I[3]||(I[3]=j=>c.value=j),class:"cf-input",type:"text"},null,512),[[t.vModelText,c.value]])])),t.createElementVNode("div",pm,[t.createElementVNode("label",hm,t.toDisplayString(t.unref(w)(e.locale,"cfFormat")),1),t.createElementVNode("div",gm,[t.createElementVNode("button",{ref_key:"fillTrigger",ref:C,type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":d.value}]),title:t.unref(w)(e.locale,"fillColor"),onClick:me},[(t.openBlock(),t.createElementBlock("svg",ym,[I[15]||(I[15]=t.createElementVNode("path",{d:"M447.018667 37.952l352.298666 352.298667c6.613333 6.613333 6.613333 17.344 0 23.957333L446.101333 767.424a16.938667 16.938667 0 0 1-23.957333 0L121.429333 466.688a16.938667 16.938667 0 0 1 0-23.957333L428.608 135.552 388.992 96a8.469333 8.469333 0 0 1 0-11.989333l46.058667-46.037334a8.469333 8.469333 0 0 1 11.968 0z m346.325333 517.461333l57.514667 60.074667c31.744 33.194667 31.744 86.997333 0 120.192a78.869333 78.869333 0 0 1-115.008 0c-31.765333-33.194667-31.765333-86.997333 0-120.192l57.493333-60.074667zM486.101333 193.066667l-261.12 261.12 20.458667 20.458666 380.16-1.728 70.186667-70.186666-209.706667-209.664z"},null,-1)),t.createElementVNode("path",{d:"M85.333333 853.333333m8.896 0l835.541334 0q8.896 0 8.896 8.896l0 110.208q0 8.896-8.896 8.896l-835.541334 0q-8.896 0-8.896-8.896l0-110.208q0-8.896 8.896-8.896Z",fill:c.backgroundColor||"currentColor"},null,8,Cm)]))],10,bm),t.createVNode(Vo,{"model-open":d.value,"color-key":"fill","current-color":c.backgroundColor,"trigger-el":C.value,locale:e.locale,"onUpdate:modelOpen":I[4]||(I[4]=j=>d.value=j),onChange:I[5]||(I[5]=j=>c.backgroundColor=j)},null,8,["model-open","current-color","trigger-el","locale"]),t.createElementVNode("button",{ref_key:"fontTrigger",ref:v,type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":b.value}]),title:t.unref(w)(e.locale,"fontColor"),onClick:se},[(t.openBlock(),t.createElementBlock("svg",vm,[I[16]||(I[16]=t.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[t.createElementVNode("path",{d:"M663.120842 529.946947H364.759579l-84.07579 212.884211a53.894737 53.894737 0 0 1-50.122105 34.169263h-14.551579a34.869895 34.869895 0 0 1-32.498526-47.696842L443.715368 70.063158a53.894737 53.894737 0 0 1 50.122106-34.115369h41.768421a53.894737 53.894737 0 0 1 50.176 34.277053l257.670737 659.078737a34.977684 34.977684 0 0 1-32.552421 47.696842h-14.389895a53.894737 53.894737 0 0 1-50.229895-34.277053l-83.159579-212.776421z m-35.139368-89.788631l-113.340632-289.953684-114.472421 289.953684h227.813053z"})],-1)),t.createElementVNode("path",{d:"M62.895 844.369m53.895 0l790.474 0q53.895 0 53.895 53.895l0 26.947q0 53.895-53.895 53.895l-790.474 0q-53.895 0-53.895-53.895l0-26.947q0-53.895 53.895-53.895z",fill:c.color||"#000000"},null,8,km)]))],10,wm),t.createVNode(Vo,{"model-open":b.value,"color-key":"text","current-color":c.color,"trigger-el":v.value,locale:e.locale,"onUpdate:modelOpen":I[6]||(I[6]=j=>b.value=j),onChange:I[7]||(I[7]=j=>c.color=j)},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(w)(e.locale,"bold"),onClick:I[8]||(I[8]=j=>c.fontWeight=!c.fontWeight)},[...I[17]||(I[17]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M214.857 889.143v-68.571h68.571V203.429H214.857v-68.571h411.429v1.257c96.114 10.629 171.429 87.383 171.429 181.6 0 58.971-29.486 111.086-75.109 144.457 72.069 39.291 120.823 113.234 120.823 198.4 0 119.291-95.634 216.594-217.12 227.543l-0.286.029H214.857z m388.572-388.571H352v320h251.429c95.086 0 171.429-72.091 171.429-160s-76.343-160-171.429-160z m0-297.143H352v228.571h251.429l5.211-0.091c67.52-2.515 120.503-53.235 120.503-114.195 0-62.537-55.749-114.285-125.714-114.285z"})],-1)])],10,Em),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":c.fontStyle}]),title:t.unref(w)(e.locale,"italic"),onClick:I[9]||(I[9]=j=>c.fontStyle=!c.fontStyle)},[...I[18]||(I[18]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M730.143 127.714v64.286h-112.329l-166.521 621.429h128.871v64.286H276.286v-64.286h108.45l166.5-621.429H426.286V127.714h303.857z"})],-1)])],10,Rm),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":c.underline}]),title:t.unref(w)(e.locale,"underline"),onClick:I[10]||(I[10]=j=>c.underline=!c.underline)},[...I[19]||(I[19]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M512 123.639a36.409 36.409 0 0 1 33.642 22.525l230.59 558.27a36.409 36.409 0 1 1-67.284 27.768L638.072 560.545H385.928l-70.876 171.656a36.409 36.409 0 1 1-67.332-27.768l230.59-558.27A36.409 36.409 0 0 1 512 123.639z m-95.974 364.089h191.948L512 255.439l-95.974 232.289zM769.289 827.544c19.418 0 38.836 14.564 38.836 38.836 0 19.418-14.564 33.982-29.127 33.982H259.565c-19.418 0-38.836-14.564-38.836-38.836 0-19.418 14.564-33.982 29.127-33.982h519.433z"})],-1)])],10,Sm),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":c.strikethrough}]),title:t.unref(w)(e.locale,"strikethrough"),onClick:I[11]||(I[11]=j=>c.strikethrough=!c.strikethrough)},[...I[20]||(I[20]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M182.044 490.667h659.911a34.133 34.133 0 0 1 4.642 67.948l-4.597 0.319h-135.395c40.05 37 60.803 81.601 60.803 133.575 0 128.569-147.092 211.171-307.382 192.512-101.717-11.833-173.352-52.565-210.944-122.971a34.133 34.133 0 0 1 60.211-32.176c25.942 48.606 77.46 77.915 158.606 87.381 124.837 14.473 231.242-45.283 231.242-124.746 0-53.339-36.636-96.802-116.736-131.345l-5.279-2.23H182.044a34.133 34.133 0 0 1-33.815-29.492L147.911 524.8a34.133 34.133 0 0 1 29.491-33.815l4.642-0.318z m68.767-176.447c6.918-128.796 128.432-203.343 287.812-184.82 99.579 11.56 175.81 47.923 226.737 109.636a34.133 34.133 0 1 1-52.657 43.463c-38.775-47.013-98.759-75.639-181.999-85.288-123.654-14.381-211.627 36.591-211.627 117.009 0 35.135 10.65 61.349 37.774 90.203l5.826 6.007c4.278 4.369 8.966 8.875 11.377 10.923l1.411 0.91H288.085l-1.092-1.729c-6.508-9.376-38.958-54.386-36.182-106.314z"})],-1)])],10,Mm)])]),t.createElementVNode("div",Nm,[t.createElementVNode("label",Bm,t.toDisplayString(t.unref(w)(e.locale,"cfAppliedTo")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":I[12]||(I[12]=j=>c.rangeText=j),class:"cf-input",type:"text"},null,512),[[t.vModelText,c.rangeText]])]),h.value?(t.openBlock(),t.createElementBlock("div",xm,t.toDisplayString(h.value),1)):t.createCommentVNode("",!0),t.createElementVNode("div",Tm,[t.createElementVNode("label",Vm,[t.createElementVNode("input",{class:"cf-chk__input",type:"checkbox",checked:c.stopIfTrue,onChange:I[13]||(I[13]=j=>c.stopIfTrue=j.target.checked)},null,40,Dm),I[21]||(I[21]=t.createElementVNode("span",{class:"cf-chk__box"},[t.createElementVNode("svg",{class:"cf-chk__tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(w)(e.locale,"cfStopIfTrue")),1)]),t.createElementVNode("label",Fm,[t.createElementVNode("input",{class:"cf-chk__input",type:"checkbox",checked:c.enabled,onChange:I[14]||(I[14]=j=>c.enabled=j.target.checked)},null,40,Im),I[22]||(I[22]=t.createElementVNode("span",{class:"cf-chk__box"},[t.createElementVNode("svg",{class:"cf-chk__tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(w)(e.locale,"cfEnabled")),1)])])]),t.createElementVNode("div",Om,[t.createElementVNode("button",{type:"button",class:"cf-btn cf-btn--primary",onClick:X},t.toDisplayString(t.unref(w)(e.locale,"ok")),1),t.createElementVNode("button",{type:"button",class:"cf-btn",onClick:rt},t.toDisplayString(t.unref(w)(e.locale,"cancel")),1)])],4))}}),[["__scopeId","data-v-f625bb44"]]),Lm={class:"dv-editor__header"},$m={class:"dv-editor__title"},zm={class:"dv-editor__body"},_m={class:"dv-sec"},Hm={class:"dv-sec__title"},Wm={class:"dv-row"},Um={class:"dv-label"},Pm={class:"dv-row"},Km={class:"dv-label"},Gm={class:"dv-hint"},qm={class:"dv-row dv-row--inline"},jm={class:"dv-chk"},Ym=["checked"],Xm={class:"dv-row"},Zm={class:"dv-label"},Jm={class:"dv-hint"},Qm={class:"dv-row"},e0={class:"dv-label"},t0={key:0,class:"dv-row"},n0={class:"dv-label"},l0={class:"dv-row"},o0={class:"dv-label"},r0={class:"dv-row"},a0={class:"dv-label"},i0={class:"dv-row dv-row--inline"},s0=["checked","disabled"],c0=["checked","disabled"],d0={class:"dv-sec"},u0={class:"dv-sec__title"},f0={class:"dv-row dv-row--inline"},m0={class:"dv-chk"},p0=["checked"],h0={class:"dv-row"},g0={class:"dv-label"},b0=["disabled"],y0={class:"dv-row dv-row--top"},C0={class:"dv-label"},w0=["disabled"],v0={class:"dv-sec"},k0={class:"dv-sec__title"},E0={class:"dv-row dv-row--inline"},R0={class:"dv-chk"},S0=["checked"],M0={class:"dv-row"},N0={class:"dv-label"},B0={class:"dv-row"},x0={class:"dv-label"},T0=["disabled"],V0={class:"dv-row dv-row--top"},D0={class:"dv-label"},F0=["disabled"],I0={class:"dv-sec"},O0={class:"dv-row"},A0={class:"dv-label"},L0={key:0,class:"dv-error"},$0={class:"dv-editor__footer"},$o="\\$?[A-Za-z]+\\$?\\d+",z0=Dt(t.defineComponent({__name:"data-validation-dialog",props:{locale:{},mode:{},rule:{default:null},defaultRangeText:{default:""},themeVars:{default:()=>({})}},emits:["save","cancel","clear"],setup(e,{emit:o}){const n=e,l=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 c(O){const I=ut(O.startCol)+(O.startRow+1);return O.startCol===O.endCol&&O.startRow===O.endRow?I:I+":"+ut(O.endCol)+(O.endRow+1)}function d(O){const I=O==null?void 0:O.listSource;if((I==null?void 0:I.type)==="range"){const we=c(I.range);return I.sheetId?`${I.sheetId}!${we}`:we}return((I==null?void 0:I.type)==="values"?I.values:(O==null?void 0:O.values)??[]).join(",")}function b(){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:d(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 C=t.reactive(b()),v=t.ref(""),h=t.computed(()=>C.type==="list"),B=t.computed(()=>C.type==="custom"),R=t.computed(()=>["wholeNumber","decimal","date","time","textLength"].includes(C.type)),F=t.computed(()=>R.value&&(C.operator==="between"||C.operator==="notBetween")),Q=t.computed(()=>C.type==="any"),K=t.computed(()=>a.map(O=>({value:O.value,label:w(n.locale,O.label)}))),Ee=t.computed(()=>i.map(O=>({value:O.value,label:w(n.locale,O.label)}))),ee=t.computed(()=>r.map(O=>({value:O.value,label:w(n.locale,O.label)})));function pe(O){const I=O.split(",").map(we=>we.trim()).filter(Boolean),j=[];for(const we of I){if(!we.match(/^\$?[A-Za-z]+\$?\d+(?::\$?[A-Za-z]+\$?\d+)?$/))return null;const le=hn(we.split(":")[0],99999,99999),xe=we.split(":")[1],ce=xe?hn(xe,99999,99999):le;if(!le||!ce)return null;j.push({startCol:Math.min(le.col,ce.col),endCol:Math.max(le.col,ce.col),startRow:Math.min(le.row,ce.row),endRow:Math.max(le.row,ce.row)})}return j.length?j:null}function ie(O){const I=O.trim();if(!I)return null;const j=new RegExp(`^(?:'([^']+)'|([^!'"]+))!(${$o})(?::(${$o}))?$`).exec(I);if(j){const le=(j[1]??j[2]??"").trim(),xe=hn(j[3],99999,99999),ce=j[4]?hn(j[4],99999,99999):xe;return!le||!xe||!ce?null:{type:"range",sheetId:le,range:{startCol:Math.min(xe.col,ce.col),endCol:Math.max(xe.col,ce.col),startRow:Math.min(xe.row,ce.row),endRow:Math.max(xe.row,ce.row)}}}const we=new RegExp(`^(${$o})(?::(${$o}))?$`).exec(I);if(we){const le=hn(we[1],99999,99999),xe=we[2]?hn(we[2],99999,99999):le;return!le||!xe?null:{type:"range",range:{startCol:Math.min(le.col,xe.col),endCol:Math.max(le.col,xe.col),startRow:Math.min(le.row,xe.row),endRow:Math.max(le.row,xe.row)}}}const ze=I.split(",").map(le=>le.trim());return ze.some(le=>le!=="")?{type:"values",values:ze}:null}const me=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/;function se(O,I){const j=I.trim();if(j==="")return w(n.locale,"dvValueRequired");if(j.startsWith("="))return null;const we=n.locale;switch(O){case"wholeNumber":case"textLength":{const ze=To(j,we);return ze&&Number.isFinite(ze.num)&&Number.isInteger(ze.num)||me.test(j)&&Number.isInteger(Number(j))?null:w(we,"dvMustBeInteger")}case"decimal":{const ze=To(j,we);return ze&&Number.isFinite(ze.num)||me.test(j)&&Number.isFinite(Number(j))?null:w(we,"dvMustBeNumber")}case"date":{const ze=Yn(j,we);return ze&&ze.format!=="h:mm:ss"?null:w(we,"dvDateInvalid")}case"time":return Yn(j,we)?null:w(we,"dvTimeInvalid");default:return null}}function Se(){if(v.value="",!pe(C.rangeText))return v.value=w(n.locale,"dvRangeInvalid"),!1;if(C.type==="any")return!0;if(h.value)return ie(C.source)?!0:(v.value=w(n.locale,"dvSourceInvalid"),!1);if(B.value)return C.formula1.trim()?!0:(v.value=w(n.locale,"dvFormulaRequired"),!1);if(F.value){if(!C.formula1.trim())return v.value=w(n.locale,"dvMinRequired"),!1;if(!C.formula2.trim())return v.value=w(n.locale,"dvMaxRequired"),!1;const I=se(C.type,C.formula1);if(I)return v.value=`${w(n.locale,"dvMin")}:${I}`,!1;const j=se(C.type,C.formula2);return j?(v.value=`${w(n.locale,"dvMax")}:${j}`,!1):!0}if(!C.formula1.trim())return v.value=w(n.locale,"dvValueRequired"),!1;const O=se(C.type,C.formula1);return O?(v.value=`${w(n.locale,"dvValue")}:${O}`,!1):!0}function Xe(){var j,we;if(!Se())return;const O=pe(C.rangeText);if(C.type==="any"){l("save",{id:((j=n.rule)==null?void 0:j.id)??"",type:"any",ranges:O,allowBlank:C.allowBlank,enabled:!0});return}const I={id:((we=n.rule)==null?void 0:we.id)??"",type:C.type,ranges:O,allowBlank:C.allowBlank,enabled:C.enabled,showInputMessage:C.showInputMessage,inputTitle:C.inputTitle||void 0,inputMessage:C.inputMessage||void 0,showErrorMessage:C.showErrorMessage,errorStyle:C.errorStyle,errorTitle:C.errorTitle||void 0,errorMessage:C.errorMessage||void 0};if(h.value){const ze=ie(C.source);I.listSource=ze,I.values=ze.type==="values"?ze.values:void 0,I.showDropdown=C.showDropdown}else B.value?I.formula1=C.formula1.trim():(I.operator=C.operator,I.formula1=C.formula1.trim(),I.formula2=F.value?C.formula2.trim():void 0);l("save",I)}function Qe(O){C.type=O}function X(O){C.operator=String(O)}function rt(O){C.errorStyle=String(O)}return(O,I)=>(t.openBlock(),t.createElementBlock("div",{class:"dv-editor",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("div",Lm,[t.createElementVNode("span",$m,t.toDisplayString(t.unref(w)(e.locale,"dvDialogTitle")),1),t.createElementVNode("button",{type:"button",class:"dv-editor__close",onClick:I[0]||(I[0]=j=>l("cancel"))}," × ")]),t.createElementVNode("div",zm,[t.createElementVNode("div",_m,[t.createElementVNode("div",Hm,t.toDisplayString(t.unref(w)(e.locale,"dvSettings")),1),t.createElementVNode("div",Wm,[t.createElementVNode("label",Um,t.toDisplayString(t.unref(w)(e.locale,"dvAllow")),1),t.createVNode(Kt,{class:"dv-dropdown","model-value":C.type,options:K.value,width:"100%","visible-count":8,title:t.unref(w)(e.locale,"dvAllow"),align:"right",onChange:Qe},null,8,["model-value","options","title"])]),h.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",Pm,[t.createElementVNode("label",Km,t.toDisplayString(t.unref(w)(e.locale,"dvSource")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":I[1]||(I[1]=j=>C.source=j),class:"dv-input",type:"text",spellcheck:"false"},null,512),[[t.vModelText,C.source]])]),t.createElementVNode("p",Gm,t.toDisplayString(t.unref(w)(e.locale,"dvSourceHint")),1),t.createElementVNode("div",qm,[t.createElementVNode("label",jm,[t.createElementVNode("input",{class:"dv-chk__input",type:"checkbox",checked:C.showDropdown,onChange:I[2]||(I[2]=j=>C.showDropdown=j.target.checked)},null,40,Ym),I[18]||(I[18]=t.createElementVNode("span",{class:"dv-chk__box"},[t.createElementVNode("svg",{class:"dv-chk__tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(w)(e.locale,"dvShowDropdown")),1)])])],64)):B.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",Xm,[t.createElementVNode("label",Zm,t.toDisplayString(t.unref(w)(e.locale,"dvFormula")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":I[3]||(I[3]=j=>C.formula1=j),class:"dv-input",type:"text",spellcheck:"false",placeholder:"=AND(A1>=0,A1<=100)"},null,512),[[t.vModelText,C.formula1]])]),t.createElementVNode("p",Jm,t.toDisplayString(t.unref(w)(e.locale,"cfFormulaExample")),1)],64)):R.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("div",Qm,[t.createElementVNode("label",e0,t.toDisplayString(t.unref(w)(e.locale,"dvData")),1),t.createVNode(Kt,{class:"dv-dropdown","model-value":C.operator,options:Ee.value,width:"100%","visible-count":9,title:t.unref(w)(e.locale,"dvOperator"),align:"right",onChange:X},null,8,["model-value","options","title"])]),F.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",l0,[t.createElementVNode("label",o0,t.toDisplayString(t.unref(w)(e.locale,"dvMin")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":I[5]||(I[5]=j=>C.formula1=j),class:"dv-input",type:"text",spellcheck:"false"},null,512),[[t.vModelText,C.formula1]])]),t.createElementVNode("div",r0,[t.createElementVNode("label",a0,t.toDisplayString(t.unref(w)(e.locale,"dvMax")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":I[6]||(I[6]=j=>C.formula2=j),class:"dv-input",type:"text",spellcheck:"false"},null,512),[[t.vModelText,C.formula2]])])],64)):(t.openBlock(),t.createElementBlock("div",t0,[t.createElementVNode("label",n0,t.toDisplayString(t.unref(w)(e.locale,"dvValue")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":I[4]||(I[4]=j=>C.formula1=j),class:"dv-input",type:"text",spellcheck:"false"},null,512),[[t.vModelText,C.formula1]])]))],64)):t.createCommentVNode("",!0),t.createElementVNode("div",i0,[t.createElementVNode("label",{class:t.normalizeClass(["dv-chk",{"dv-chk--disabled":Q.value}])},[t.createElementVNode("input",{class:"dv-chk__input",type:"checkbox",checked:C.allowBlank,disabled:Q.value,onChange:I[7]||(I[7]=j=>C.allowBlank=j.target.checked)},null,40,s0),I[19]||(I[19]=t.createElementVNode("span",{class:"dv-chk__box"},[t.createElementVNode("svg",{class:"dv-chk__tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(w)(e.locale,"dvIgnoreBlank")),1)],2),t.createElementVNode("label",{class:t.normalizeClass(["dv-chk",{"dv-chk--disabled":Q.value}])},[t.createElementVNode("input",{class:"dv-chk__input",type:"checkbox",checked:C.enabled,disabled:Q.value,onChange:I[8]||(I[8]=j=>C.enabled=j.target.checked)},null,40,c0),I[20]||(I[20]=t.createElementVNode("span",{class:"dv-chk__box"},[t.createElementVNode("svg",{class:"dv-chk__tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(w)(e.locale,"cfEnabled")),1)],2)])]),t.createElementVNode("div",d0,[t.createElementVNode("div",u0,t.toDisplayString(t.unref(w)(e.locale,"dvInputMessageTab")),1),t.createElementVNode("div",f0,[t.createElementVNode("label",m0,[t.createElementVNode("input",{class:"dv-chk__input",type:"checkbox",checked:C.showInputMessage,onChange:I[9]||(I[9]=j=>C.showInputMessage=j.target.checked)},null,40,p0),I[21]||(I[21]=t.createElementVNode("span",{class:"dv-chk__box"},[t.createElementVNode("svg",{class:"dv-chk__tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(w)(e.locale,"dvShowInputMessage")),1)])]),t.createElementVNode("div",h0,[t.createElementVNode("label",g0,t.toDisplayString(t.unref(w)(e.locale,"dvInputTitle")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":I[10]||(I[10]=j=>C.inputTitle=j),class:"dv-input",type:"text",disabled:!C.showInputMessage},null,8,b0),[[t.vModelText,C.inputTitle]])]),t.createElementVNode("div",y0,[t.createElementVNode("label",C0,t.toDisplayString(t.unref(w)(e.locale,"dvInputMessage")),1),t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":I[11]||(I[11]=j=>C.inputMessage=j),class:"dv-input dv-input--area",rows:"2",disabled:!C.showInputMessage},null,8,w0),[[t.vModelText,C.inputMessage]])])]),t.createElementVNode("div",v0,[t.createElementVNode("div",k0,t.toDisplayString(t.unref(w)(e.locale,"dvErrorAlertTab")),1),t.createElementVNode("div",E0,[t.createElementVNode("label",R0,[t.createElementVNode("input",{class:"dv-chk__input",type:"checkbox",checked:C.showErrorMessage,onChange:I[12]||(I[12]=j=>C.showErrorMessage=j.target.checked)},null,40,S0),I[22]||(I[22]=t.createElementVNode("span",{class:"dv-chk__box"},[t.createElementVNode("svg",{class:"dv-chk__tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(w)(e.locale,"dvShowErrorAlert")),1)])]),t.createElementVNode("div",M0,[t.createElementVNode("label",N0,t.toDisplayString(t.unref(w)(e.locale,"dvErrorStyle")),1),t.createVNode(Kt,{class:"dv-dropdown","model-value":C.errorStyle,options:ee.value,width:"100%","visible-count":4,title:t.unref(w)(e.locale,"dvErrorStyle"),align:"right",onChange:rt},null,8,["model-value","options","title"])]),t.createElementVNode("div",B0,[t.createElementVNode("label",x0,t.toDisplayString(t.unref(w)(e.locale,"dvErrorTitle")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":I[13]||(I[13]=j=>C.errorTitle=j),class:"dv-input",type:"text",disabled:!C.showErrorMessage},null,8,T0),[[t.vModelText,C.errorTitle]])]),t.createElementVNode("div",V0,[t.createElementVNode("label",D0,t.toDisplayString(t.unref(w)(e.locale,"dvErrorMessage")),1),t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":I[14]||(I[14]=j=>C.errorMessage=j),class:"dv-input dv-input--area",rows:"2",disabled:!C.showErrorMessage},null,8,F0),[[t.vModelText,C.errorMessage]])])]),t.createElementVNode("div",I0,[t.createElementVNode("div",O0,[t.createElementVNode("label",A0,t.toDisplayString(t.unref(w)(e.locale,"dvApplyTo")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":I[15]||(I[15]=j=>C.rangeText=j),class:"dv-input",type:"text",spellcheck:"false"},null,512),[[t.vModelText,C.rangeText]])])]),v.value?(t.openBlock(),t.createElementBlock("div",L0,t.toDisplayString(v.value),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",$0,[t.createElementVNode("button",{type:"button",class:"dv-btn dv-btn--danger",onClick:I[16]||(I[16]=j=>l("clear"))},t.toDisplayString(t.unref(w)(e.locale,"dvClearAll")),1),I[23]||(I[23]=t.createElementVNode("span",{class:"dv-editor__spacer"},null,-1)),t.createElementVNode("button",{type:"button",class:"dv-btn dv-btn--primary",onClick:Xe},t.toDisplayString(t.unref(w)(e.locale,"ok")),1),t.createElementVNode("button",{type:"button",class:"dv-btn",onClick:I[17]||(I[17]=j=>l("cancel"))},t.toDisplayString(t.unref(w)(e.locale,"cancel")),1)])],4))}}),[["__scopeId","data-v-dc3b8000"]]),_0={key:0,class:"dvd__search"},H0=["placeholder"],W0=["onMouseenter","onClick"],U0={class:"dvd__check"},P0={class:"dvd__label"},K0={key:1,class:"dvd__empty"},Rn=24,G0=244,q0=140,j0=Dt(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 n=e,l=o,a=t.ref(""),i=t.ref(0),r=t.ref(0),c=t.ref(null),d=t.ref(null),b=t.ref(null),C=t.ref({left:n.x,top:n.y+n.height+2,up:!1}),v=t.computed(()=>{const O=a.value.trim().toLowerCase();return O?n.items.filter(I=>String(I??"").toLowerCase().includes(O)):n.items}),h=t.computed(()=>Math.min(G0,Math.max(Rn,v.value.length*Rn))),B=t.computed(()=>Math.max(q0,Math.min(360,n.width))),R=t.computed(()=>Math.max(0,Math.floor(r.value/Rn)-1)),F=t.computed(()=>Math.min(v.value.length,Math.ceil((r.value+h.value)/Rn)+1)),Q=t.computed(()=>v.value.slice(R.value,F.value)),K=t.computed(()=>R.value*Rn),Ee=t.computed(()=>Math.max(0,(v.value.length-F.value)*Rn));function ee(O){return String(O??"").trim().toLowerCase()===String(n.current??"").trim().toLowerCase()}function pe(){const O=h.value+ie(),I=qn(n.boundaryEl),j=I.bottom-(n.y+n.height)-8,we=n.y-I.top-8,ze=j<O&&we>j;let le=ze?n.y-O-2:n.y+n.height+2;le=Math.max(I.top+8,Math.min(I.bottom-O-8,le));const xe=Math.max(I.left+8,Math.min(I.right-B.value-8,n.x));C.value={left:xe,top:le,up:ze}}function ie(){return v.value.length>8||a.value?34:0}t.watch(()=>[n.x,n.y,n.width,n.height],()=>pe()),t.onMounted(()=>{t.nextTick(()=>{var O;pe(),c.value?c.value.focus():(O=b.value)==null||O.focus()}),document.addEventListener("pointerdown",me,!0),window.addEventListener("resize",se),window.addEventListener("scroll",se,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",me,!0),window.removeEventListener("resize",se),window.removeEventListener("scroll",se,!0)});function me(O){var I;(I=b.value)!=null&&I.contains(O.target)||se()}function se(){l("close")}function Se(O){const I=d.value;if(!I)return;const j=O*Rn,we=j+Rn;j<I.scrollTop?I.scrollTop=j:we>I.scrollTop+h.value&&(I.scrollTop=we-h.value)}function Xe(O){const I=v.value.length;I!==0&&(i.value=(i.value+O+I)%I,Se(i.value))}function Qe(O){const I=v.value[O];I!==void 0&&l("select",I)}function X(O){r.value=O.target.scrollTop}function rt(O){switch(O.key){case"ArrowDown":O.preventDefault(),O.stopPropagation(),Xe(1);return;case"ArrowUp":O.preventDefault(),O.stopPropagation(),Xe(-1);return;case"Home":O.preventDefault(),O.stopPropagation(),i.value=0,r.value=0,d.value&&(d.value.scrollTop=0);return;case"End":{O.preventDefault(),O.stopPropagation();const I=v.value.length;i.value=Math.max(0,I-1),Se(i.value);return}case"PageDown":O.preventDefault(),O.stopPropagation(),Xe(Math.max(1,Math.floor(h.value/Rn)));return;case"PageUp":O.preventDefault(),O.stopPropagation(),Xe(-Math.max(1,Math.floor(h.value/Rn)));return;case"Enter":O.preventDefault(),O.stopPropagation(),Qe(i.value);return;case"Escape":O.preventDefault(),O.stopPropagation(),se();return;case"Tab":O.preventDefault(),O.stopPropagation(),Qe(i.value);return}}return t.watch(a,()=>{i.value=0,r.value=0,d.value&&(d.value.scrollTop=0),t.nextTick(pe)}),t.watch(v,O=>{const I=O.findIndex(j=>ee(j));I>=0&&(i.value=I,t.nextTick(()=>Se(I)))},{immediate:!0}),(O,I)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:b,class:"dvd",tabindex:"-1",style:t.normalizeStyle({left:C.value.left+"px",top:C.value.top+"px",width:B.value+"px"}),onKeydown:rt,onWheel:I[2]||(I[2]=t.withModifiers(()=>{},["stop"]))},[ie()>0?(t.openBlock(),t.createElementBlock("div",_0,[t.withDirectives(t.createElementVNode("input",{ref_key:"searchRef",ref:c,"onUpdate:modelValue":I[0]||(I[0]=j=>a.value=j),class:"dvd__search-input",type:"text",spellcheck:"false",placeholder:t.unref(w)(e.locale,"dvSearchPlaceholder"),onKeydown:rt},null,40,H0),[[t.vModelText,a.value]])])):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:d,class:"dvd__list",style:t.normalizeStyle({height:h.value+"px"}),onScroll:X},[t.createElementVNode("div",{style:t.normalizeStyle({height:K.value+"px"})},null,4),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Q.value,(j,we)=>(t.openBlock(),t.createElementBlock("div",{key:R.value+we,class:t.normalizeClass(["dvd__item",{"dvd__item--active":R.value+we===i.value,"dvd__item--checked":ee(j)}]),style:t.normalizeStyle({height:Rn+"px",lineHeight:Rn+"px"}),onMousedown:I[1]||(I[1]=t.withModifiers(()=>{},["prevent"])),onMouseenter:ze=>i.value=R.value+we,onClick:ze=>Qe(R.value+we)},[t.createElementVNode("span",U0,t.toDisplayString(ee(j)?"✓":""),1),t.createElementVNode("span",P0,t.toDisplayString(j===""?"(空)":j),1)],46,W0))),128)),t.createElementVNode("div",{style:t.normalizeStyle({height:Ee.value+"px"})},null,4)],36),v.value.length===0?(t.openBlock(),t.createElementBlock("div",K0,t.toDisplayString(t.unref(w)(e.locale,"dvNoMatch")),1)):t.createCommentVNode("",!0)],36))}}),[["__scopeId","data-v-fc845e0b"]]),Y0={class:"dv-alert__header"},X0={class:"dv-alert__title"},Z0={class:"dv-alert__body"},J0=["d"],Q0={class:"dv-alert__text"},e1={key:0,class:"dv-alert__subtitle"},t1={class:"dv-alert__message"},n1={class:"dv-alert__footer"},ka=Dt(t.defineComponent({__name:"data-validation-alert",props:{locale:{},severity:{},title:{default:""},message:{default:""},themeVars:{default:()=>({})}},emits:["resolve"],setup(e,{emit:o}){const n=e,l=o,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"?w(n.locale,"dvWarningDialogTitle"):n.severity==="information"?w(n.locale,"dvInformationDialogTitle"):w(n.locale,"dvStopDialogTitle")),c=t.computed(()=>n.severity==="stop"?w(n.locale,"dvBtnRetry"):n.severity==="warning"?w(n.locale,"dvBtnContinue"):w(n.locale,"dvBtnOk")),d=t.computed(()=>n.severity==="stop"?w(n.locale,"cancel"):n.severity==="warning"?w(n.locale,"dvBtnNo"):w(n.locale,"cancel"));function b(){l("resolve",n.severity==="stop"?"retry":"continue")}function C(){l("resolve","cancel")}return(v,h)=>(t.openBlock(),t.createElementBlock("div",{class:"dv-alert",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("div",Y0,[t.createElementVNode("span",X0,t.toDisplayString(r.value),1)]),t.createElementVNode("div",Z0,[(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,J0)],4)),t.createElementVNode("div",Q0,[e.title?(t.openBlock(),t.createElementBlock("div",e1,t.toDisplayString(e.title),1)):t.createCommentVNode("",!0),t.createElementVNode("div",t1,t.toDisplayString(e.message),1)])]),t.createElementVNode("div",n1,[h[2]||(h[2]=t.createElementVNode("span",{class:"dv-alert__spacer"},null,-1)),t.createElementVNode("button",{type:"button",class:"dv-alert__btn dv-alert__btn--primary",onMousedown:h[0]||(h[0]=t.withModifiers(()=>{},["prevent"])),onClick:b},t.toDisplayString(c.value),33),t.createElementVNode("button",{type:"button",class:"dv-alert__btn",onMousedown:h[1]||(h[1]=t.withModifiers(()=>{},["prevent"])),onClick:C},t.toDisplayString(d.value),33)])],4))}}),[["__scopeId","data-v-4edabad0"]]),l1={key:0,class:"dvim__title"},o1={class:"dvim__message"},r1=Dt(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(o,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",l1,t.toDisplayString(e.title),1)):t.createCommentVNode("",!0),t.createElementVNode("div",o1,t.toDisplayString(e.message),1)],4))}}),[["__scopeId","data-v-15c54146"]]),a1={class:"note-overlay__header"},i1={class:"note-overlay__author"},s1=["title"],c1={class:"note-overlay__body"},d1={class:"note-overlay__header"},u1={class:"note-overlay__author"},f1=["placeholder"],m1={class:"note-overlay__footer"},p1=Dt(t.defineComponent({__name:"note-overlay",props:{anchor:{},mode:{},note:{default:null},author:{},locale:{},placeholder:{default:""},boundaryEl:{default:null},frozen:{type:Boolean,default:!1}},emits:["save","delete","close"],setup(e,{emit:o}){var h;const n=e,l=o,a=t.ref(null),i=t.ref(((h=n.note)==null?void 0:h.text)??"");t.watch(()=>{var B;return[n.mode,(B=n.note)==null?void 0:B.text,n.anchor.x,n.anchor.y]},()=>{var B;i.value=((B=n.note)==null?void 0:B.text)??""});const r=t.ref({left:0,top:0}),c=t.computed(()=>({left:r.value.left+"px",top:r.value.top+"px",zIndex:n.frozen?2:0}));function d(){var Se,Xe;const B=a.value,R=n.anchor;if(!B){r.value={left:R.x+R.width+6,top:R.y+6};return}const F=B.offsetWidth,Q=B.offsetHeight,ee={left:52,top:24,right:((Se=n.boundaryEl)==null?void 0:Se.offsetWidth)??0,bottom:((Xe=n.boundaryEl)==null?void 0:Xe.offsetHeight)??0},pe=6,ie=8;let me=R.x+R.width+pe,se=R.y+pe;me+F>ee.right-ie&&(me=R.x-F-pe,me<ee.left+ie&&(me=Math.min(Math.max(ee.left+ie,R.x),ee.right-F-ie),ee.right-F-ie<ee.left+ie&&(me=ee.left+ie))),se+Q>ee.bottom-ie&&(se=R.y+R.height-pe-Q,se<ee.top+ie&&(se=Math.min(Math.max(ee.top+ie,R.y),ee.bottom-Q-ie),ee.bottom-Q-ie<ee.top+ie&&(se=ee.top+ie))),r.value={left:me,top:se}}t.watch(()=>{var B;return[n.anchor.x,n.anchor.y,n.anchor.width,(B=n.note)==null?void 0:B.text,i.value]},()=>t.nextTick(d),{immediate:!0,flush:"post"});function b(){t.nextTick(d)}t.onMounted(()=>window.addEventListener("resize",b)),t.onBeforeUnmount(()=>window.removeEventListener("resize",b));function C(B){B.key==="Escape"?(B.stopPropagation(),B.preventDefault(),l("close")):B.key==="Enter"&&!B.shiftKey&&(B.ctrlKey||B.metaKey||B.altKey)&&(B.stopPropagation(),B.preventDefault(),v())}function v(){l("save",i.value.trim())}return(B,R)=>{var F,Q;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:R[3]||(R[3]=t.withModifiers(()=>{},["stop"])),onContextmenu:R[4]||(R[4]=t.withModifiers(()=>{},["stop"])),onClick:R[5]||(R[5]=t.withModifiers(()=>{},["stop"]))},[e.mode==="view"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",a1,[t.createElementVNode("span",i1,t.toDisplayString(((F=e.note)==null?void 0:F.author)||e.author||(e.locale==="en-US"?"Unnamed":"未命名")),1),t.createElementVNode("button",{type:"button",class:"note-overlay__icon",title:e.locale==="en-US"?"Close":"关闭",onClick:R[0]||(R[0]=K=>l("close"))}," × ",8,s1)]),t.createElementVNode("div",c1,t.toDisplayString(((Q=e.note)==null?void 0:Q.text)||(e.locale==="en-US"?"(Empty)":"(无内容)")),1)],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",d1,[t.createElementVNode("span",u1,t.toDisplayString(e.author||(e.locale==="en-US"?"Unnamed":"未命名")),1)]),t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":R[1]||(R[1]=K=>i.value=K),class:"note-overlay__editor",placeholder:e.placeholder,rows:"3",onKeydown:C,onBlur:v},null,40,f1),[[t.vModelText,i.value]]),t.createElementVNode("div",m1,[t.createElementVNode("button",{type:"button",class:"note-overlay__btn note-overlay__btn--ghost",onClick:R[2]||(R[2]=K=>l("close"))},t.toDisplayString(e.locale==="en-US"?"Cancel":"取消"),1),t.createElementVNode("button",{type:"button",class:"note-overlay__btn note-overlay__btn--primary",onClick:v},t.toDisplayString(e.locale==="en-US"?"Save":"保存"),1)])],64))],38)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-18a4be48"]]);function wl(e,o){return`${e},${o}`}function Ea(e,o){if(e.startsWith("="))return{kind:"formula",formula:e};const n=Yn(e,o);if(n)return{kind:"date",serial:n.serial};const l=/^(.*?)(\d+)$/.exec(e);if(l){const a=l[1],i=l[2];if(a!==""&&/^\d+$/.test(i))return{kind:"text-number",prefix:a,num:parseInt(i,10),digits:i.length}}return Ln(e)?{kind:"number",num:parseFloat(e)}:{kind:"text",text:e}}function br(e,o){for(let n=2;n<e.length;n++)if(e[n]-e[n-1]!==o)return!1;return!0}function Ra(e){const o=e.length;if(o===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],l=o>=2?e[1].serial-n.serial:1;return{kind:"date-linear",baseSerial:n.serial,step:l,sourceLen:o}}if(e.every(n=>n.kind==="number")){if(o===1)return{kind:"copy",sourceValues:[...e]};const n=e.map(a=>a.num),l=n[1]-n[0];return br(n,l)?{kind:"linear",step:l,base:n[0],sourceLen:o}:{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(o===1)return{kind:"copy",sourceValues:[...e]};const a=e.map(r=>r.num),i=a[1]-a[0];if(br(a,i))return{kind:"text-number",prefix:n.prefix,step:i,base:n.num,digits:n.digits,sourceLen:o}}return{kind:"copy",sourceValues:[...e]}}if(e.every(n=>n.kind==="text")){const n=e.every(l=>l.text.length===1&&/[a-zA-Z]/.test(l.text));if(o>=2&&n){const l=e.map(i=>i.text.charCodeAt(0)),a=l[1]-l[0];if(a!==0&&br(l,a))return{kind:"text-series",step:a,baseCharCode:l[0],sourceLen:o}}return{kind:"copy",sourceValues:[...e]}}return{kind:"copy",sourceValues:[...e]}}function Sa(e,o,n){switch(e.kind){case"copy":{const l=e.sourceValues.length;return l===0?{kind:"text",text:""}:e.sourceValues[o%l]}case"linear":return{kind:"number",num:e.base+e.step*(n+o)};case"text-number":return{kind:"text-number",prefix:e.prefix,num:e.base+e.step*(n+o),digits:e.digits};case"date-linear":return{kind:"date",serial:e.baseSerial+e.step*(n+o)};case"text-series":return{kind:"text",text:String.fromCharCode(e.baseCharCode+e.step*(n+o))};case"formula":return{kind:"formula",formula:""}}}function Ma(e,o){switch(e.kind){case"copy":{const n=e.sourceValues.length;return n===0?{kind:"text",text:""}:e.sourceValues[n-1-o%n]}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 zo(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 Na(e,o){const n=o.row<e.startRow?e.startRow-o.row:o.row>e.endRow?o.row-e.endRow:0,l=o.col<e.startCol?e.startCol-o.col:o.col>e.endCol?o.col-e.endCol:0;if(n===0&&l===0)return null;const a=n>=l?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 Ba(e,o,n,l,a,i){return Oo(e,n.col-o.col,n.row-o.row,l,a,i)}function xa(e,o){return!(e.endCol<o.startCol||e.startCol>o.endCol||e.endRow<o.startRow||e.startRow>o.endRow)}function Ta(e,o){return o.startCol>=e.startCol&&o.endCol<=e.endCol&&o.startRow>=e.startRow&&o.endRow<=e.endRow}function yr(e,o,n){const l=Object.keys(n);for(const c of l){const d=n[c];if(xa(e,d)&&!Ta(e,d))return{ok:!1,reason:"source-overlap"}}const a=[];for(const c of l){const d=n[c];Ta(e,d)||xa(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 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 Va(e,o,n,l){const a=o.length;if(a!==0){if(e.kind==="copy"){const i=l?a-1-n%a:n%a;return o[i]}return l?o[0]:o[a-1]}}function Da(e,o,n,l,a,i,r,c){const d={cells:{},merges:{}},b=l==="up"||l==="down",C=l==="up"||l==="left";if(b){const v=e.endRow-e.startRow+1;for(let h=e.startCol;h<=e.endCol;h++){const B=[],R=[];for(let K=e.startRow;K<=e.endRow;K++){const Ee=n.cells[wl(h,K)];B.push(Ee?Ea(Ee.value,a):{kind:"text",text:""}),R.push(Ee==null?void 0:Ee.styleId)}const F=Ra(B),Q=B.length;for(let K=o.startRow;K<=o.endRow;K++){const Ee=C?o.endRow-K:K-o.startRow;if(F.kind==="formula"){const ee=C?e.endRow-((o.endRow-K)%v+v)%v:e.startRow+((K-e.startRow)%v+v)%v,pe=n.cells[wl(h,ee)],ie=pe?pe.value:"",me=Ba(ie,{col:h,row:ee},{col:h,row:K},i,r,c);d.cells[wl(h,K)]=zo({kind:"formula",formula:me},pe==null?void 0:pe.styleId)}else{const ee=C?Ma(F,Ee):Sa(F,Ee,Q),pe=Va(F,R,Ee,C);d.cells[wl(h,K)]=zo(ee,pe)}}}}else{const v=e.endCol-e.startCol+1;for(let h=e.startRow;h<=e.endRow;h++){const B=[],R=[];for(let K=e.startCol;K<=e.endCol;K++){const Ee=n.cells[wl(K,h)];B.push(Ee?Ea(Ee.value,a):{kind:"text",text:""}),R.push(Ee==null?void 0:Ee.styleId)}const F=Ra(B),Q=B.length;for(let K=o.startCol;K<=o.endCol;K++){const Ee=C?o.endCol-K:K-o.startCol;if(F.kind==="formula"){const ee=C?e.endCol-((o.endCol-K)%v+v)%v:e.startCol+((K-e.startCol)%v+v)%v,pe=n.cells[wl(ee,h)],ie=pe?pe.value:"",me=Ba(ie,{col:ee,row:h},{col:K,row:h},i,r,c);d.cells[wl(K,h)]=zo({kind:"formula",formula:me},pe==null?void 0:pe.styleId)}else{const ee=C?Ma(F,Ee):Sa(F,Ee,Q),pe=Va(F,R,Ee,C);d.cells[wl(K,h)]=zo(ee,pe)}}}}return d}function _o(e,o){delete e[o]}function h1(){return`note-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function Fa(e){return e?{...e}:{}}function Kl(e,o){return`${e},${o}`}function Ia(e,o,n){const l=n[Kl(o,e)];return!!(l&&l.noteId)}function g1(e,o,n,l){const a=n[Kl(o,e)];if(!(!a||!a.noteId))return l[a.noteId]}function b1(e,o){const n=Date.now();return{id:h1(),text:e,author:o,createdAt:n,updatedAt:n}}function y1(e,o,n,l,a,i){const r=Kl(o,e),c=a[r]||(a[r]={value:""});c.noteId&&i[c.noteId]&&_o(i,c.noteId);const d=b1(n,l);return i[d.id]=d,c.noteId=d.id,d}function C1(e,o,n){const l=n[e];if(!l)throw new Error(`Note ${e} not found`);return l.text=o,l.updatedAt=Date.now(),l}function w1(e,o,n,l){const a=Kl(o,e),i=n[a];if(!i||!i.noteId)return;const r=l[i.noteId];return _o(l,i.noteId),i.noteId=void 0,Object.keys(i).length===1&&"value"in i&&i.value===""&&_o(n,a),r}function v1(e,o,n){const l=new Map;for(let a=e.startRow;a<=e.endRow;a++)for(let i=e.startCol;i<=e.endCol;i++){const r=o[Kl(i,a)];r&&r.noteId&&n[r.noteId]&&l.set(Kl(i,a),n[r.noteId])}return l}function Ho(e,o){const n=new Set;for(const l in e){const a=e[l];a!=null&&a.noteId&&n.add(a.noteId)}for(const l in o)n.has(l)||_o(o,l)}function k1(e){let o=1/0,n=1/0;for(const l of e.ranges)l.startCol<o&&(o=l.startCol),l.startRow<n&&(n=l.startRow);return isFinite(o)||(o=0),isFinite(n)||(n=0),{col:o,row:n}}function E1(e,o,n){for(const l of e)if(o>=l.startCol&&o<=l.endCol&&n>=l.startRow&&n<=l.endRow)return!0;return!1}function $n(e){if(e==null)return null;const o=String(e).trim();if(o==="")return null;const n=o.replace(/[, ]/g,"");if(n==="")return null;const l=Number(n);return Number.isFinite(l)?l:null}function R1(e,o){const n=new Map;for(const l of e.ranges)for(let a=l.startRow;a<=l.endRow;a++)for(let i=l.startCol;i<=l.endCol;i++){const r=o.getCellValue(i,a);r!==""&&n.set(r,(n.get(r)??0)+1)}return n}class S1{constructor(){this.map=new Map}get(o){return this.map.get(o)}set(o,n){this.map.set(o,n)}invalidate(o){o?this.map.delete(o):this.map.clear()}}function M1(e,o,n,l,a,i){switch(e.type){case"cellIs":{const r=l.getCellValue(o,n),c=$n(r);switch(e.operator){case"equal":{const d=$n(e.value);return c!==null&&d!==null?c===d:r===e.value}case"notEqual":{const d=$n(e.value);return c!==null&&d!==null?c!==d:r!==e.value}case"greaterThan":{const d=$n(e.value);return c===null||d===null?!1:c>d}case"greaterThanOrEqual":{const d=$n(e.value);return c===null||d===null?!1:c>=d}case"lessThan":{const d=$n(e.value);return c===null||d===null?!1:c<d}case"lessThanOrEqual":{const d=$n(e.value);return c===null||d===null?!1:c<=d}case"between":{const d=$n(e.value),b=$n(e.value2??"");return c===null||d===null||b===null?!1:c>=Math.min(d,b)&&c<=Math.max(d,b)}case"notBetween":{const d=$n(e.value),b=$n(e.value2??"");return c===null||d===null||b===null?!1:c<Math.min(d,b)||c>Math.max(d,b)}}return!1}case"textContains":return l.getCellValue(o,n).toLowerCase().includes(e.value.toLowerCase());case"textNotContains":return!l.getCellValue(o,n).toLowerCase().includes(e.value.toLowerCase());case"blank":return l.getCellValue(o,n)==="";case"notBlank":return l.getCellValue(o,n)!=="";case"duplicate":{if(!i)return!1;const r=l.getCellValue(o,n);return r===""?!1:(i.get(r)??0)>1}case"unique":{if(!i)return!1;const r=l.getCellValue(o,n);return r===""?!1:(i.get(r)??0)===1}case"formula":try{const r=o-a.col,c=n-a.row,d=e.formula.trim().replace(/^=/,""),b=N1(d,r,c,l.colCount,l.rowCount);return Ca(b,l.cells,l.colCount,l.rowCount)}catch{return!1}case"colorScale":case"dataBar":case"iconSet":case"topBottom":case"aboveBelowAverage":return!1}return!1}function N1(e,o,n,l,a){return Oo(e,o,n,l,a,ut)}function B1(e,o,n,l,a){if(!n||n.length===0)return null;const i=n.filter(d=>d.enabled&&E1(d.ranges,e,o)).sort((d,b)=>d.priority-b.priority);if(i.length===0)return null;const r={};let c=!1;for(const d of i){const b=k1(d);let C;(d.condition.type==="duplicate"||d.condition.type==="unique")&&(C=a==null?void 0:a.get(d.id),C||(C=R1(d,l),a==null||a.set(d.id,C)));let v=!1;try{v=M1(d.condition,e,o,l,b,C)}catch{}if(!v)continue;c=!0;const h=d.format;if(h.backgroundColor!==void 0&&r.backgroundColor===void 0&&(r.backgroundColor=h.backgroundColor),h.color!==void 0&&r.color===void 0&&(r.color=h.color),h.fontWeight!==void 0&&r.fontWeight===void 0&&(r.fontWeight=h.fontWeight),h.fontStyle!==void 0&&r.fontStyle===void 0&&(r.fontStyle=h.fontStyle),h.underline!==void 0&&r.underline===void 0&&(r.underline=h.underline),h.strikethrough!==void 0&&r.strikethrough===void 0&&(r.strikethrough=h.strikethrough),d.stopIfTrue)break}return c?r:null}function x1(){return"cf_"+Math.random().toString(36).slice(2,10)+Date.now().toString(36).slice(-4)}function Oa(){return"dv_"+Math.random().toString(36).slice(2,10)+Date.now().toString(36).slice(-4)}function T1(e,o,n){for(const l of e)if(o>=l.startCol&&o<=l.endCol&&n>=l.startRow&&n<=l.endRow)return!0;return!1}function V1(e){let o=1/0,n=1/0;for(const l of e.ranges)l.startCol<o&&(o=l.startCol),l.startRow<n&&(n=l.startRow);return isFinite(o)||(o=0),isFinite(n)||(n=0),{col:o,row:n}}function D1(e){return e==null?!0:typeof e=="number"?!1:(typeof e=="string"?e:String(e)).trim()===""}function F1(e){return e?Array.from(e).length:0}const Aa=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/;function so(e,o){if(e==null)return null;const n=String(e).trim();if(n==="")return null;if(n.startsWith("=")){const a=Cr(n.slice(1),o);return typeof a=="number"&&Number.isFinite(a)?a:a===null?null:Number(a)}const l=To(n,o.locale);if(l&&Number.isFinite(l.num))return l.num;if(Aa.test(n)){const a=Number(n);return Number.isFinite(a)?a:null}return null}function Cr(e,o){try{return Cl(),ya(e,o.cells,o.colCount,o.rowCount)}catch{return null}}function wr(e,o){if(e==null)return null;const n=String(e).trim();if(n==="")return null;if(n.startsWith("=")){const a=Cr(n.slice(1),o);return typeof a=="number"&&Number.isFinite(a)?a:typeof a=="string"?wr(a,o):null}if(Ln(n)||Aa.test(n)){const a=Number(n);return Number.isFinite(a)?a:null}const l=Yn(n,o.locale);return l&&l.format!=="h:mm:ss"?l.serial:null}function vr(e,o){if(e==null)return null;const n=String(e).trim();if(n==="")return null;if(n.startsWith("=")){const a=Cr(n.slice(1),o);return typeof a=="number"&&Number.isFinite(a)?kr(a):typeof a=="string"?vr(a,o):null}const l=Yn(n,o.locale);return l?l.format==="h:mm:ss"?l.serial:kr(l.serial):Ln(n)?kr(Number(n)):null}function kr(e){return Number.isFinite(e)?Math.abs(e)%1:0}function I1(e,o,n,l){switch(e){case"between":return n===null||l===null?!1:o>=Math.min(n,l)&&o<=Math.max(n,l);case"notBetween":return n===null||l===null?!1:o<Math.min(n,l)||o>Math.max(n,l);case"equal":return n!==null&&o===n;case"notEqual":return n!==null&&o!==n;case"greaterThan":return n!==null&&o>n;case"greaterThanOrEqual":return n!==null&&o>=n;case"lessThan":return n!==null&&o<n;case"lessThanOrEqual":return n!==null&&o<=n;default:return!1}}function Er(e){return String(e??"").trim().toLowerCase()}function La(e,o){var C;const n=e.listSource??(e.values?{type:"values",values:e.values}:void 0);if(!n)return[];const l=[],a=new Set,i=v=>{const h=Er(v);if(!h){if(e.allowBlank===!1||a.has("\0blank"))return;a.add("\0blank"),l.push("");return}a.has(h)||(a.add(h),l.push(v))};if(n.type==="values"){for(const v of n.values??[])i(v);return l}const{range:r,sheetId:c}=n,d=c?((C=o.getSheetCells)==null?void 0:C.call(o,c))??null:null,b=d??o.cells;for(let v=r.startRow;v<=r.endRow;v++)for(let h=r.startCol;h<=r.endCol;h++){const B=`${h},${v}`,R=b[B];if(R)if(d){const F=R.value;i(F.startsWith("=")?O1(F,d,o):F)}else i(o.getCellValue(h,v))}return l}function O1(e,o,n){try{Cl();const l=ya(e.slice(1),o,n.colCount,n.rowCount);return l===null?"":String(l)}catch{return""}}function A1(e){return!!e&&e.type==="list"&&e.showDropdown!==!1&&e.enabled!==!1}function L1(e,o,n){const l={value:n};return new Proxy(e,{get(a,i){return i===o?l:a[i]},has(a,i){return i===o?!0:i in a}})}function $1(e,o,n,l,a){if(e.enabled===!1)return!0;const i=o==null?"":String(o);if(D1(i))return e.allowBlank!==!1;try{switch(e.type){case"any":return!0;case"list":{const r=La(e,a),c=Er(i);return r.some(d=>Er(d)===c)}case"wholeNumber":{const r=so(i,a);return r===null||!Number.isFinite(r)||!Number.isInteger(r)?!1:co(e,r,a,so)}case"decimal":{const r=so(i,a);return r===null||!Number.isFinite(r)?!1:co(e,r,a,so)}case"date":{const r=wr(i,a);return r===null?!1:co(e,r,a,wr)}case"time":{const r=vr(i,a);return r===null?!1:co(e,r,a,vr)}case"textLength":{const r=F1(i);return co(e,r,a,so)}case"custom":{const r=(e.formula1??"").trim().replace(/^=/,"");return r?z1(r,o,n,l,e,a):!0}default:return!0}}catch{return!1}}function co(e,o,n,l){const a=e.operator;if(!a)return!0;const i=e.formula1!==void 0&&e.formula1!==""?l(e.formula1,n):null,r=e.formula2!==void 0&&e.formula2!==""?l(e.formula2,n):null;return I1(a,o,i,r)}function z1(e,o,n,l,a,i){try{const r=V1(a),c=Oo(e,n-r.col,l-r.row,i.colCount,i.rowCount,ut),d=L1(i.cells,`${n},${l}`,o==null?"":String(o));return Cl(),Ca(c,d,i.colCount,i.rowCount)}catch{return!1}}const _1={stop:3,warning:2,information:1};function Rr(e){return e.errorStyle==="warning"||e.errorStyle==="information"?e.errorStyle:"stop"}function $a(e,o,n,l,a){if(!l||l.length===0)return{valid:!0};let i=null,r=0;for(const C of l){if(C.enabled===!1||!T1(C.ranges,o,n))continue;let v;try{v=$1(C,e,o,n,a)}catch{v=!1}if(v)continue;const h=_1[Rr(C)];h>r&&(r=h,i=C)}if(!i)return{valid:!0};const c=Rr(i),d=i.showErrorMessage!==!1,b=H1(i,a.locale);return{valid:!1,rule:i,severity:c,title:d&&i.errorTitle?i.errorTitle:b.title,message:d&&i.errorMessage?i.errorMessage:b.message}}function H1(e,o){var a;const n=w(o,"dvErrorTitleDefault"),l=e.operator?w(o,`dv${W1(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:w(o,r?"dvMsgList":"dvMsgListEmpty").replace("{values}",r)}}case"wholeNumber":return{title:n,message:uo(o,w(o,"dvTypeWholeNumber"),l,e)};case"decimal":return{title:n,message:uo(o,w(o,"dvTypeDecimal"),l,e)};case"date":return{title:n,message:uo(o,w(o,"dvTypeDate"),l,e)};case"time":return{title:n,message:uo(o,w(o,"dvTypeTime"),l,e)};case"textLength":return{title:n,message:uo(o,w(o,"dvTypeTextLength"),l,e)};case"custom":return{title:n,message:w(o,"dvMsgCustom").replace("{formula}",e.formula1??"")};default:return{title:n,message:w(o,"dvMsgInvalid")}}}function W1(e){return e.charAt(0).toUpperCase()+e.slice(1)}function uo(e,o,n,l){return n?l.operator==="between"||l.operator==="notBetween"?w(e,l.operator==="between"?"dvMsgBetween":"dvMsgNotBetween").replace("{type}",o).replace("{min}",l.formula1??"").replace("{max}",l.formula2??""):w(e,"dvMsgCompare").replace("{type}",o).replace("{op}",n).replace("{value}",l.formula1??""):w(e,"dvMsgInvalid")}const Wo=64;class U1{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 n of this.source)if(!(!n||n.enabled===!1))for(const l of n.ranges??[]){const a=Math.floor(l.startRow/Wo),i=Math.floor(l.endRow/Wo);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:l})}}this.dirty=!1}}getRules(o,n,l){this.ensure(l);const a=this.bands.get(Math.floor(n/Wo));if(!a||a.length===0)return[];const i=[];for(const r of a)o<r.range.startCol||o>r.range.endCol||n<r.range.startRow||n>r.range.endRow||i.includes(r.rule)||i.push(r.rule);return i}has(o,n,l){const a=this.bandsOf(o,n,l);for(const i of a)if(!(o<i.range.startCol||o>i.range.endCol)&&!(n<i.range.startRow||n>i.range.endRow))return!0;return!1}findRule(o,n,l,a){for(const i of this.bandsOf(o,n,a))if(!(o<i.range.startCol||o>i.range.endCol)&&!(n<i.range.startRow||n>i.range.endRow)&&l(i.rule))return i.rule;return null}bandsOf(o,n,l){return this.ensure(l),this.bands.get(Math.floor(n/Wo))??P1}}const P1=[];function K1(e,o,n,l){if(o==="row"){const d=e.startRow,b=e.endRow;let C,v;if(b<n)C=d,v=b;else if(d>n+l-1)C=d-l,v=b-l;else if(C=d<n?d:n,v=b>n+l-1?b-l:n-1,v<C)return null;return{...e,startRow:C,endRow:v}}const a=e.startCol,i=e.endCol;let r,c;if(i<n)r=a,c=i;else if(a>n+l-1)r=a-l,c=i-l;else if(r=a<n?a:n,c=i>n+l-1?i-l:n-1,c<r)return null;return{...e,startCol:r,endCol:c}}function G1(e,o,n,l){if(o==="row"){const r=e.startRow,c=e.endRow;return r>=n?{...e,startRow:r+l,endRow:c+l}:c<n?e:{...e,endRow:c+l}}const a=e.startCol,i=e.endCol;return a>=n?{...e,startCol:a+l,endCol:i+l}:i<n?e:{...e,endCol:i+l}}function za(e,o){return!(e.endCol<o.startCol||e.startCol>o.endCol||e.endRow<o.startRow||e.startRow>o.endRow)}function _a(e,o){if(!za(e,o))return[{...e}];const n=[];e.startRow<o.startRow&&n.push({startCol:e.startCol,endCol:e.endCol,startRow:e.startRow,endRow:o.startRow-1}),e.endRow>o.endRow&&n.push({startCol:e.startCol,endCol:e.endCol,startRow:o.endRow+1,endRow:e.endRow});const l=Math.max(e.startRow,o.startRow),a=Math.min(e.endRow,o.endRow);return l<=a&&(e.startCol<o.startCol&&n.push({startCol:e.startCol,endCol:o.startCol-1,startRow:l,endRow:a}),e.endCol>o.endCol&&n.push({startCol:o.endCol+1,endCol:e.endCol,startRow:l,endRow:a})),n}function q1(e,o,n){return{startCol:e.startCol+o,endCol:e.endCol+o,startRow:e.startRow+n,endRow:e.endRow+n}}function Ha(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 j1=1;function Y1(e,o,n){let l=0;for(let a=0;a<e.length;a++){const i=e[a];i.start<=o&&n<=i.end&&l++}return l}function X1(e,o,n,l){return e<=n&&l<=o||n<=e&&o<=l||o<n||l<e}function Sr(e,o,n){if(!Number.isInteger(o)||!Number.isInteger(n)||o<0||n<o)return{ok:!1,code:"outlineInvalid"};if(n-o+1<2)return{ok:!1,code:"outlineMinSize"};for(let a=0;a<e.length;a++){const i=e[a];if(!X1(o,n,i.start,i.end))return{ok:!1,code:"outlineCrossing"}}const l=Y1(e,o,n)+1;return l>j1?{ok:!1,code:"outlineTooDeep"}:{ok:!0,level:l}}function Wa(e,o,n,l,a,i){const r=Sr(e,n,l);return!r.ok||r.level===void 0?{outlines:e,validation:r}:{outlines:e.concat({id:a,axis:o,start:n,end:l,level:r.level,collapsed:!1}),validation:r}}function Ua(e,o,n){let l=!1;const a=e.map(i=>i.id===o&&i.collapsed!==n?(l=!0,{...i,collapsed:n}):i);return l?a:e}function Pa(e,o){return e.filter(n=>n.id!==o)}function Uo(){return[]}function Ka(e,o,n){return e.map(l=>l.start>=o?{...l,start:l.start+n,end:l.end+n}:l.end<o?l:{...l,end:l.end+n})}function Ga(e,o,n){const l=[];for(const a of e){const i=a.start,r=a.end;let c,d;if(r<o)c=i,d=r;else if(i>o+n-1)c=i-n,d=r-n;else if(c=i<o?i:o,d=r>o+n-1?r-n:o-1,d<c)continue;l.push({...a,start:c,end:d})}return l}function Zn(e){return e.map(o=>{let n=0;for(let l=0;l<e.length;l++){const a=e[l];a!==o&&a.start<=o.start&&o.end<=a.end&&n++}return{...o,level:n+1}})}function qa(e,o){let n=0;for(let l=0;l<e.length;l++){const a=e[l];a.start<=o&&o<=a.end&&n++}return n}function ja(e,o){const n=o==="row"?"row-outline":"col-outline",l=new Set(e.map(i=>i.id));let a=1;for(;l.has(`${n}-${a}`);)a++;return`${n}-${a}`}class Z1{constructor(o){if(o&&o.length>0){this.styles=o,this.index=new Map;for(let n=0;n<this.styles.length;n++){const l=this.stableKey(this.styles[n]);this.index.set(l,n)}}else this.styles=[{}],this.index=new Map,this.index.set(this.stableKey({}),0)}stableKey(o){const n=Object.keys(o).sort(),l={};for(const a of n)l[a]=o[a];return JSON.stringify(l)}get(o){const n=this.styles[o];return n?o===0?n:Object.freeze(n):{}}getId(o){if(!o||Object.keys(o).length===0)return 0;const n=this.stableKey(o),l=this.index.get(n);if(l!==void 0)return l;const a=this.styles.length,i=Object.freeze({...o});return this.styles.push(i),this.index.set(n,a),a}getStyles(){return[...this.styles]}setStyles(o){this.styles=o,this.index=new Map;for(let n=0;n<this.styles.length;n++){const l=this.stableKey(this.styles[n]);this.index.set(l,n)}}compactStyles(o){const n=new Set;n.add(0);for(const r in o){const c=o[r].styleId??0;n.add(c)}const l=new Map,a=[{}];l.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;l.set(r,c),a.push(this.styles[r])}for(const r in o){const c=o[r],d=c.styleId??0,b=l.get(d);b!==void 0&&b!==d&&(c.styleId=b)}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 J1(e,o){if(!e)return null;const n=e.styleId;return n===void 0||n===0?null:o[n]??null}function Ya(e){const o=new Z1,n={};for(const[l,a]of Object.entries(e)){const i={value:a.value};a.styleId!==void 0&&a.styleId>0&&(i.styleId=a.styleId),a.style&&Object.keys(a.style).length>0&&(i.styleId=o.getId(a.style)),i.styleId===0&&delete i.styleId;const r=a.noteId;typeof r=="string"&&r&&(i.noteId=r),n[l]=i}return{cells:n,styles:o.getStyles()}}function Q1(e){const o={};for(const[n,l]of Object.entries(e)){const a={value:l.value};l.styleId!==void 0&&l.styleId>0&&(a.styleId=l.styleId),l.noteId&&(a.noteId=l.noteId),o[n]=a}return o}class ep{constructor(o){if(o&&o.length>0){this.borders=o,this.index=new Map;for(let n=0;n<this.borders.length;n++){const l=this.stableKey(this.borders[n]);this.index.set(l,n)}}else this.borders=[{}],this.index=new Map,this.index.set(this.stableKey({}),0)}stableKey(o){const n=["top","right","bottom","left"],l={};for(const a of n){const i=o[a];if(i&&(i.width!==void 0||i.color!==void 0||i.style!==void 0)){const r={};i.width!==void 0&&(r.width=i.width),i.color!==void 0&&(r.color=i.color),i.style!==void 0&&(r.style=i.style),l[a]=r}}return JSON.stringify(l)}get(o){const n=this.borders[o];return n?o===0?n:Object.freeze(n):{}}getId(o){if(!o||this.isEmptyBorder(o))return 0;const n=this.stableKey(o),l=this.index.get(n);if(l!==void 0)return l;const a=this.borders.length,i=Object.freeze(this.deepCloneBorder(o));return this.borders.push(i),this.index.set(n,a),a}isEmptyBorder(o){return!o.top&&!o.right&&!o.bottom&&!o.left}deepCloneBorder(o){const n={};return o.top&&(n.top={...o.top}),o.right&&(n.right={...o.right}),o.bottom&&(n.bottom={...o.bottom}),o.left&&(n.left={...o.left}),n}getBorders(){return[...this.borders]}setBorders(o){this.borders=o,this.index=new Map;for(let n=0;n<this.borders.length;n++){const l=this.stableKey(this.borders[n]);this.index.set(l,n)}}compactBorders(o){const n=new Set;n.add(0);for(const r of o){const c=r.borderId??0;n.add(c)}const l=new Map,a=[{}];l.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;l.set(r,c),a.push(this.borders[r])}for(const r of o){const c=r.borderId??0,d=l.get(c);d!==void 0&&d!==c&&(r.borderId=d)}this.borders=a,this.index=new Map;for(let r=0;r<this.borders.length;r++){const c=this.stableKey(this.borders[r]);this.index.set(c,r)}return a}}function tp(e,o,n,l){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=l.get(r);if(c)return c[o]}function np(e,o,n,l,a,i){const r=l[e.styleId??0]??{},c=r.borderId??0,d=c>0?a.get(c):{},b={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};n?b[o]={...n}:b[o]=void 0;const C=a.getId(b),v={...r};C===0?delete v.borderId:v.borderId=C,delete v.borderTopWidth,delete v.borderBottomWidth,delete v.borderLeftWidth,delete v.borderRightWidth,delete v.borderColor,Object.keys(v).length===0?e.styleId=0:e.styleId=i(v)}function Xa(e){const o=new ep,n=[];for(const l of e){if(!(l.borderTopWidth!==void 0||l.borderBottomWidth!==void 0||l.borderLeftWidth!==void 0||l.borderRightWidth!==void 0)){n.push(l);continue}const i=typeof l.borderColor=="string"?l.borderColor:void 0,r={};l.borderTopWidth!==void 0&&l.borderTopWidth>0&&(r.top={width:l.borderTopWidth,color:i}),l.borderBottomWidth!==void 0&&l.borderBottomWidth>0&&(r.bottom={width:l.borderBottomWidth,color:i}),l.borderLeftWidth!==void 0&&l.borderLeftWidth>0&&(r.left={width:l.borderLeftWidth,color:i}),l.borderRightWidth!==void 0&&l.borderRightWidth>0&&(r.right={width:l.borderRightWidth,color:i});const c=o.getId(r),d={...l};delete d.borderTopWidth,delete d.borderBottomWidth,delete d.borderLeftWidth,delete d.borderRightWidth,delete d.borderColor,c>0?d.borderId=c:delete d.borderId,n.push(d)}return{styles:n,borders:o.getBorders()}}function lp(e,o){const n=t.reactive({rowCount:e.rowCount??o.rowCount,colCount:e.colCount??o.colCount,width:e.width,height:e.height,theme:e.theme??o.theme,locale:e.locale??o.locale});t.watchEffect(()=>{n.rowCount=e.rowCount??o.rowCount,n.colCount=e.colCount??o.colCount,n.width=e.width,n.height=e.height,n.theme=e.theme??o.theme,n.locale=e.locale??o.locale});const l=t.computed(()=>n.locale==="zh-CN"?"zh-CN":"en-US"),a=n.colCount,i=n.rowCount,r=t.reactive({colCount:a,rowCount:i}),c=8,d=32,b=t.reactive({}),C=t.reactive([{}]),v=t.reactive([{}]);let h=new Map;h.set("{}",0);let B=new Map;B.set("{}",0);const R=t.reactive([]),F=new S1,Q=t.reactive({}),K=t.reactive([]),Ee=new U1(K),ee=new Map;let pe=0;function ie(s){const f=Object.keys(s).sort(),m={};for(const k of f)m[k]=s[k];return JSON.stringify(m)}function me(s){const f=["top","right","bottom","left"],m={};for(const k of f){const T=s[k];if(T&&(T.width!==void 0||T.color!==void 0||T.style!==void 0)){const L={};T.width!==void 0&&(L.width=T.width),T.color!==void 0&&(L.color=T.color),T.style!==void 0&&(L.style=T.style),m[k]=L}}return JSON.stringify(m)}function se(s){if(!s||Object.keys(s).length===0)return 0;const f=ie(s),m=h.get(f);if(m!==void 0)return m;const k=C.length;return C.push(Object.freeze({...s})),h.set(f,k),k}function Se(s){return J1(s,C)}function Xe(){h=new Map;for(let s=0;s<C.length;s++)h.set(ie(C[s]),s)}function Qe(s){C.splice(0,C.length,...s),Xe()}function X(s){if(!s||!s.top&&!s.right&&!s.bottom&&!s.left)return 0;const f=me(s),m=B.get(f);if(m!==void 0)return m;const k=v.length;return v.push(Object.freeze({top:s.top?Object.freeze({...s.top}):void 0,right:s.right?Object.freeze({...s.right}):void 0,bottom:s.bottom?Object.freeze({...s.bottom}):void 0,left:s.left?Object.freeze({...s.left}):void 0})),B.set(f,k),k}function rt(s){return v[s]??{}}function O(){B=new Map;for(let s=0;s<v.length;s++)B.set(me(v[s]),s)}function I(s){v.splice(0,v.length,...s),O()}function j(s,f){return tp(s,f,C,{get:m=>v[m]??{}})}function we(s,f){const m=je(s,f);return m?m.anchor:null}function ze(s,f,m,k){const T=je(s,f),L=je(m,k);return!T||!L?!1:T.anchor===L.anchor}const le=t.reactive({}),xe=new Zu,ce=t.ref(null),Fe=t.ref("cell"),V=t.ref({col:0,row:0}),J=t.ref(null),re=t.ref(""),ae=t.ref(new Array(r.colCount).fill(100)),oe=t.ref(new Array(r.rowCount).fill(void 0)),ve=t.ref(0),Me=t.ref(0),q=t.reactive({rows:0,cols:0}),$=t.ref(null),Y=t.ref([]),W=t.ref([]),fe=t.shallowRef({active:!1,sourceRange:null,targetRange:null,direction:null,preview:!1}),Ae=new Map;let Re=null;function _e(s,f,m,k){const T=`${k} ${m} ${f}px ${s}`,L=Ae.get(T);if(L)return L;if(!Re){if(typeof document>"u")return{ascent:f*.88,descent:f*.28};Re=document.createElement("canvas")}const de=Re.getContext("2d");if(!de)return{ascent:f*.88,descent:f*.28};de.font=T;const ue=de.measureText(" "),he=ue.fontBoundingBoxAscent,We=ue.fontBoundingBoxDescent;if(typeof he=="number"&&typeof We=="number"&&he>0&&We>0){const _t={ascent:he,descent:We};return Ae.set(T,_t),_t}const $e=["M","中","y","Ä","0"];let Pe=0,qe=0;for(const _t of $e){const un=de.measureText(_t),Qt=un.actualBoundingBoxAscent||0,Ht=un.actualBoundingBoxDescent||0;Qt>Pe&&(Pe=Qt),Ht>qe&&(qe=Ht)}const ft=Math.max(Pe,f*.88),yt=Math.max(qe,f*.28),Jt={ascent:ft,descent:yt};return Ae.set(T,Jt),Jt}const Ge=_e(Nl,nl,"normal","normal"),Le=Ge.ascent+Ge.descent,ht=Math.max(0,(24-Le)/2);let bt=(s,f)=>`${s},${f}`,je=()=>null,Bt=()=>nl,Yt=t.computed(()=>[0]),Vt=()=>24,zt=(s,f,m,k)=>({startCol:Math.min(s,m),startRow:Math.min(f,k),endCol:Math.max(s,m),endRow:Math.max(f,k)});function et(s,f){const m=Se(b[bt(s,f)]),k=Bt(s,f),T=typeof(m==null?void 0:m.fontFamily)=="string"&&m.fontFamily?m.fontFamily:Nl,L=(m==null?void 0:m.fontWeight)==="bold"?"bold":"normal",de=(m==null?void 0:m.fontStyle)==="italic"?"italic":"normal";return _e(T,k,L,de)}function N(s,f,m,k){if(!f)return[""];const T=f.split(`
2
- `),L=[];for(const de of T)if(!k||m<=0)L.push(de);else{let ue="";for(let he=0;he<de.length;he++){const We=de[he],$e=ue+We;s.measureText($e).width>m&&ue?(L.push(ue),ue=We):ue=$e}L.push(ue)}return L}function te(s,f){const m=Se(b[bt(s,f)]);return typeof(m==null?void 0:m.fontSize)=="number"&&m.fontSize>0?m.fontSize:nl}Bt=te;const vt=t.computed(()=>{const s=[0];for(let f=0;f<r.colCount;f++)s.push(s[f]+ke(f));return s});Yt=vt;const It={w:800,h:600};let Et=()=>{};const Sn=t.computed(()=>{const s=new Set;for(const f in b){const m=f.indexOf(",");if(m<0)continue;const k=parseInt(f.substring(m+1),10),T=b[f];T&&(T.value!==""||T.styleId!==void 0)&&s.add(k)}for(let f=0;f<oe.value.length;f++)oe.value[f]!==void 0&&s.add(f);for(const f in le){const m=f.indexOf(",");if(m<0)continue;const k=parseInt(f.substring(m+1),10);s.add(k)}return s});function en(s){if(z(s))return 0;const f=oe.value[s];if(f!=null&&f>0)return f;if(!Sn.value.has(s))return 24;let m,k,T=1;const L=Re?Re.getContext("2d"):null,de=_e(Nl,nl,"normal","normal");m=de.ascent,k=de.descent;for(let $e=0;$e<r.colCount;$e++){const Pe=te($e,s),qe=Se(b[bt($e,s)]),ft=typeof(qe==null?void 0:qe.fontFamily)=="string"&&qe.fontFamily?qe.fontFamily:Nl,yt=(qe==null?void 0:qe.fontWeight)==="bold"?"bold":"normal",Jt=(qe==null?void 0:qe.fontStyle)==="italic"?"italic":"normal",_t=_e(ft,Pe,yt,Jt);_t.ascent>m&&(m=_t.ascent),_t.descent>k&&(k=_t.descent);const un=typeof(qe==null?void 0:qe.numberFormat)=="string"?qe.numberFormat:"",Qt=cn($e,s),Ht=An(Qt,un,l.value);if(Ht){const yn=(qe==null?void 0:qe.wrap)==="wrap";let rn;if(yn&&L){L.font=`${Jt} ${yt} ${Pe}px ${ft}`;const Cn=je($e,s);let Hn;Cn&&$e===Cn.range.startCol&&s===Cn.range.startRow?Hn=Yt.value[Cn.range.endCol+1]-Yt.value[$e]:Hn=ae.value[$e],rn=N(L,Ht,Math.max(0,Hn-10),!0).length,rn>T&&(T=rn)}else rn=Ht.split(`
3
- `).length,rn>T&&(T=rn)}}const ue=m+k,he=ht*2+T*ue;return Math.min(500,Math.max(24,Math.round(he)))}Vt=en;function Xt(s){return oe.value[s]===void 0}const Zt={getValue:(s,f)=>cn(s,f),getFormat:(s,f)=>{var m;return(m=Se(b[bt(s,f)]))==null?void 0:m.numberFormat}},Mn=t.computed(()=>{const s=new Set,f=$.value;if(!f)return s;const{range:m}=f;for(let k=m.startRow+1;k<=m.endRow;k++)Nn(k)||s.add(k);return s});function Nn(s){return uf($.value,s,Zt,l.value)}function _(){return Mn.value}function z(s){return Ce(s)?!0:$.value?Mn.value.has(s):!1}function G(){let s=0;for(let f=0;f<r.rowCount;f++)z(f)||s++;return s}function ye(s){let f=-1;for(let m=0;m<r.rowCount;m++)if(!z(m)&&(f++,f===s))return m;return-1}function Be(s){if(z(s))return-1;let f=0;for(let m=0;m<s;m++)z(m)||f++;return f}const Ve=t.computed(()=>{const s=new Set,f=Y.value;for(let m=0;m<f.length;m++){const k=f[m];if(k.collapsed)for(let T=Math.max(0,k.start);T<=k.end&&T<r.rowCount;T++)s.add(T)}return s}),He=t.computed(()=>{const s=new Set,f=W.value;for(let m=0;m<f.length;m++){const k=f[m];if(k.collapsed)for(let T=Math.max(0,k.start);T<=k.end&&T<r.colCount;T++)s.add(T)}return s});function Ce(s){return Ve.value.has(s)}function Oe(s){return He.value.has(s)}function be(s){return Ce(s)}function Je(s){return Oe(s)}function E(s){return!z(s)}function U(s){return!Oe(s)}function ne(s){return Oe(s)}function ke(s){return ne(s)?0:ae.value[s]??100}function Ne(s){return qa(Y.value,s)}function M(s){return qa(W.value,s)}function p(s){const f=s==="row"?Y.value:W.value;let m=0;for(let k=0;k<f.length;k++){const T=f[k].level;T>m&&(m=T)}return m}function S(s){return 0}const ot=()=>S(),mt=()=>S();function Ot(){return Y.value.map(s=>({...s}))}function xt(){return W.value.map(s=>({...s}))}function Tt(s=!1){var f,m;s||(Et(ve.value,Me.value),(f=g.scheduleRender)==null||f.call(g),(m=g.emitModelData)==null||m.call(g))}function il(s,f){var k;const m=Sr(Y.value,s,f);return!m.ok||m.level===void 0?m:((k=g.saveUndo)==null||k.call(g),Y.value=Zn(Wa(Y.value,"row",s,f,ja(Y.value,"row")).outlines),Tt(),{ok:!0,level:m.level})}function sl(s,f){var k;const m=Sr(W.value,s,f);return!m.ok||m.level===void 0?m:((k=g.saveUndo)==null||k.call(g),W.value=Zn(Wa(W.value,"column",s,f,ja(W.value,"column")).outlines),Tt(),{ok:!0,level:m.level})}function Gl(s){var k;const f=Y.value.some(T=>T.id===s),m=!f&&W.value.some(T=>T.id===s);return!f&&!m?!1:((k=g.saveUndo)==null||k.call(g),f?Y.value=Zn(Pa(Y.value,s)):W.value=Zn(Pa(W.value,s)),Tt(),!0)}function Jn(){var s;Y.value.length&&((s=g.saveUndo)==null||s.call(g),Y.value=Uo(),Tt())}function Tl(){var s;W.value.length&&((s=g.saveUndo)==null||s.call(g),W.value=Uo(),Tt())}function Vl(){var s;!Y.value.length&&!W.value.length||((s=g.saveUndo)==null||s.call(g),Y.value=Uo(),W.value=Uo(),Tt())}function fo(s,f,m=!1){var L;const k=Ua(Y.value,s,f),T=Ua(W.value,s,f);k===Y.value&&T===W.value||(m||(L=g.saveUndo)==null||L.call(g),Y.value=k,W.value=T,Tt(m))}function mo(s){const f=Y.value.find(m=>m.id===s)??W.value.find(m=>m.id===s);f&&fo(s,!f.collapsed)}function Br(s,f){Y.value.length&&(Y.value=Zn(Ka(Y.value,s,f)),Tt())}function xr(s,f){Y.value.length&&(Y.value=Zn(Ga(Y.value,s,f)),Tt())}function Tr(s,f){W.value.length&&(W.value=Zn(Ka(W.value,s,f)),Tt())}function Po(s,f){W.value.length&&(W.value=Zn(Ga(W.value,s,f)),Tt())}function ql(s,f){s&&(Y.value=Zn([...s])),f&&(W.value=Zn([...f])),Tt(!0)}function Vr(){return $.value}function po(s,f=!1){var m,k;$.value=s,!f&&(Et(ve.value,Me.value),(m=g.scheduleRender)==null||m.call(g),(k=g.emitModelData)==null||k.call(g))}function jl(s){var m,k;const f={range:{startCol:Math.min(s.startCol,s.endCol),endCol:Math.max(s.startCol,s.endCol),startRow:Math.min(s.startRow,s.endRow),endRow:Math.max(s.startRow,s.endRow)},columns:{}};$.value=f,Et(ve.value,Me.value),(m=g.scheduleRender)==null||m.call(g),(k=g.emitModelData)==null||k.call(g)}function Yl(){var s,f;$.value&&($.value=null,Et(ve.value,Me.value),(s=g.scheduleRender)==null||s.call(g),(f=g.emitModelData)==null||f.call(g))}function ho(s){var k,T;if(!$.value)return;const{[s]:f,...m}=$.value.columns;$.value={...$.value,columns:m},(k=g.scheduleRender)==null||k.call(g),(T=g.emitModelData)==null||T.call(g)}function Dr(s,f){var m,k;if($.value){if(f)$.value={...$.value,columns:{...$.value.columns,[s]:f}};else{const{[s]:T,...L}=$.value.columns;$.value={...$.value,columns:L}}(m=g.scheduleRender)==null||m.call(g),(k=g.emitModelData)==null||k.call(g)}}function Fr(s){const f=$.value;return f?ff(f,s,Zt,l.value):{values:[],hasBlank:!1}}function Dl(s,f){const m=r.colCount,k=r.rowCount,T=(Pe,qe)=>{const ft=b[gn(Pe,qe)];return!!ft&&(ft.value!==""||ft.styleId!==void 0)};if(!T(s,f))return null;const L=Pe=>{for(let qe=0;qe<m;qe++)if(T(qe,Pe))return!0;return!1},de=(Pe,qe,ft)=>{for(let yt=qe;yt<=ft;yt++)if(T(Pe,yt))return!0;return!1};let ue=f;for(;ue>0&&L(ue-1);)ue--;let he=f;for(;he<k-1&&L(he+1);)he++;let We=s;for(;We>0&&de(We-1,ue,he);)We--;let $e=s;for(;$e<m-1&&de($e+1,ue,he);)$e++;return{startCol:We,startRow:ue,endCol:$e,endRow:he}}function vl(){const s=ce.value;if(!!s&&s.startRow!==s.endRow)return{startCol:Math.min(s.startCol,s.endCol),endCol:Math.max(s.startCol,s.endCol),startRow:Math.min(s.startRow,s.endRow),endRow:Math.max(s.startRow,s.endRow)};const m=V.value,k=s?s.startCol:m.col,T=s?s.startRow:m.row,L=(We,$e)=>{const Pe=b[gn(We,$e)];return!!Pe&&(Pe.value!==""||Pe.styleId!==void 0)};let de,ue;s?(de=Math.min(s.startCol,s.endCol),ue=Math.max(s.startCol,s.endCol)):(de=m.col,ue=m.col);let he=T;for(;he<r.rowCount-1;){const We=he+1;let $e=!1,Pe=!1;for(let qe=de;qe<=ue;qe++){L(qe,We)&&($e=!0);const ft=ln(qe,We);ft&&(ft.range.startCol!==ft.range.endCol||ft.range.startRow!==ft.range.endRow)&&(Pe=!0)}if(Pe||!$e)break;he++}return!L(k,T)&&he===T?Fl():{startCol:de,endCol:ue,startRow:T,endRow:he}}function Xl(){if($.value){Yl();return}const s=vl();s&&jl(s)}function go(s){const f=$.value;return f?s>=f.range.startCol&&s<=f.range.endCol:!1}function Zl(){return $.value?{...$.value.range}:null}function bo(){return!!$.value}function cl(s){const f=$.value;return f?va(f.columns[s]):!1}function Fl(){let s=1/0,f=1/0,m=-1,k=-1;for(const T in b){const L=T.indexOf(",");if(L<0)continue;const de=parseInt(T.substring(0,L),10),ue=parseInt(T.substring(L+1),10),he=b[T];he&&(he.value!==""||he.styleId!==void 0)&&(de<s&&(s=de),ue<f&&(f=ue),de>m&&(m=de),ue>k&&(k=ue))}return m<0?null:{startCol:s,startRow:f,endCol:m,endRow:k}}const Bn=t.computed(()=>{const s=[0];for(let f=0;f<r.rowCount;f++)s.push(s[f]+Vt(f));return s}),Ir=t.computed(()=>vt.value[r.colCount]),Or=t.computed(()=>Bn.value[r.rowCount]);function gn(s,f){return`${s},${f}`}bt=gn;function dl(s){Reflect.deleteProperty(b,s)}function Ko(s,f){Fe.value="cell";const m=je(s,f);m?(V.value={col:m.range.startCol,row:m.range.startRow},ce.value={...m.range}):(V.value={col:s,row:f},ce.value={startCol:s,startRow:f,endCol:s,endRow:f})}function yo(s,f,m,k,T="cell"){const L=je(s,f);if(V.value=L?{col:L.range.startCol,row:L.range.startRow}:{col:s,row:f},Fe.value=T,T==="row"||T==="col"){const de=Math.min(s,m),ue=Math.max(s,m),he=Math.min(f,k),We=Math.max(f,k);ce.value={startCol:de,startRow:he,endCol:ue,endRow:We}}else ce.value=zt(s,f,m,k)}function kl(){yo(0,0,r.colCount-1,r.rowCount-1,"all")}function sn(s,f){const m=ce.value;return m?(Fe.value==="cell"||Fe.value==="all",s>=m.startCol&&s<=m.endCol&&f>=m.startRow&&f<=m.endRow):!1}function bn(s,f){return sn(s,f)}function ln(s,f){for(const m in le){const k=le[m];if(k&&s>=k.startCol&&s<=k.endCol&&f>=k.startRow&&f<=k.endRow)return{range:k,anchor:m}}return null}je=ln;function xn(s,f){return le[gn(s,f)]!==void 0}function El(s,f){const m=je(s,f);if(m&&s===m.range.startCol&&f===m.range.startRow){const k=vt.value[m.range.endCol+1]-vt.value[s],T=Bn.value[m.range.endRow+1]-Bn.value[f];return{w:k,h:T}}return{w:ke(s),h:Vt(f)}}function ul(s,f,m,k){let T=Math.min(s,m),L=Math.max(s,m),de=Math.min(f,k),ue=Math.max(f,k),he=!0;for(;he;){he=!1;for(const We in le){const $e=le[We];if(!$e)continue;$e.startCol<=L&&$e.endCol>=T&&$e.startRow<=ue&&$e.endRow>=de&&($e.startCol<T&&(T=$e.startCol,he=!0),$e.endCol>L&&(L=$e.endCol,he=!0),$e.startRow<de&&(de=$e.startRow,he=!0),$e.endRow>ue&&(ue=$e.endRow,he=!0))}}return{startCol:T,startRow:de,endCol:L,endRow:ue}}zt=ul;function zn(s,f){var m;return((m=b[gn(s,f)])==null?void 0:m.value)??""}function cn(s,f){return Cl(),ba(s,f,b,r.colCount,r.rowCount)}function Rl(s,f,m){var he,We,$e;s>=0&&f>=0&&x(s,f);const k=gn(s,f);Cl(),F.invalidate(),K.length>0&&Tn();const T=(he=b[k])==null?void 0:he.noteId;if(m===""||m==null){xe.clear(k);const Pe=(We=b[k])==null?void 0:We.styleId;Pe!==void 0&&Pe>0?b[k]={value:"",styleId:Pe}:dl(k),xe.markDirty(k);return}const L=String(m);if(!L.startsWith("=")){const Pe=Se(b[k]),qe=typeof(Pe==null?void 0:Pe.numberFormat)=="string"?Pe.numberFormat:"";if(En(qe)){const ft=Yn(L,l.value);if(ft){const Jt={...Pe??{},numberFormat:ft.format};b[k]={value:String(ft.serial),styleId:se(Jt),noteId:T},xe.clear(k),xe.markDirty(k);return}const yt=To(L,l.value);if(yt){const Jt={...Pe??{},numberFormat:yt.format};b[k]={value:String(yt.num),styleId:se(Jt),noteId:T},xe.clear(k),xe.markDirty(k);return}}}const de=($e=b[k])==null?void 0:$e.styleId,ue={value:L};de!==void 0&&de>0&&(ue.styleId=de),T&&(ue.noteId=T),b[k]=ue,L.startsWith("=")?xe.set(k,Io(L.slice(1),r.colCount,r.rowCount)):xe.clear(k),xe.markDirty(k)}function Il(s,f,m,k){for(let T=s;T<=f;T++)for(let L=m;L<=k;L++){const de=gn(T,L);xe.clear(de),dl(de),xe.markDirty(de)}F.invalidate(),K.length>0&&Tn(),Ho(b,Q)}function Jl(){return{cells:b,colCount:r.colCount,rowCount:r.rowCount,locale:l.value,getCellValue:(s,f)=>cn(s,f)}}function Ql(s,f){return R.length===0?null:B1(s,f,R,Jl(),F)}function on(s){var m,k,T;(m=g.saveUndo)==null||m.call(g);const f={id:s.id||x1(),condition:s.condition,format:s.format,ranges:s.ranges,priority:s.priority,stopIfTrue:s.stopIfTrue,enabled:s.enabled!==!1};R.push(f),F.invalidate(),(k=g.scheduleRender)==null||k.call(g),(T=g.emitModelData)==null||T.call(g)}function fl(s,f){var k,T,L;(k=g.saveUndo)==null||k.call(g);const m=R.findIndex(de=>de.id===s);m<0||(R[m]={...R[m],...f,id:s},F.invalidate(),(T=g.scheduleRender)==null||T.call(g),(L=g.emitModelData)==null||L.call(g))}function St(s){var m,k,T;(m=g.saveUndo)==null||m.call(g);const f=R.findIndex(L=>L.id===s);f<0||(R.splice(f,1),F.invalidate(),(k=g.scheduleRender)==null||k.call(g),(T=g.emitModelData)==null||T.call(g))}function Mt(s,f){var he,We,$e;(he=g.saveUndo)==null||he.call(g);const m=[...R].sort((Pe,qe)=>Pe.priority-qe.priority),k=m.findIndex(Pe=>Pe.id===s);if(k<0)return;const T=f==="up"?k-1:k+1;if(T<0||T>=m.length)return;const L=m[k],de=m[T],ue=L.priority;L.priority=de.priority,de.priority=ue,F.invalidate(),(We=g.scheduleRender)==null||We.call(g),($e=g.emitModelData)==null||$e.call(g)}function tn(){F.invalidate()}function Co(s){var f,m,k;if((f=g.saveUndo)==null||f.call(g),s==="sheet")R.splice(0,R.length);else{const T=g.selection.value;if(!T)return;for(let L=R.length-1;L>=0;L--){const de=R[L];de.ranges=de.ranges.filter(ue=>!(ue.startCol<=T.endCol&&ue.endCol>=T.startCol&&ue.startRow<=T.endRow&&ue.endRow>=T.startRow)),de.ranges.length===0&&R.splice(L,1)}}F.invalidate(),(m=g.scheduleRender)==null||m.call(g),(k=g.emitModelData)==null||k.call(g)}function Tn(){Ee.invalidate(),ee.clear()}function eo(){return{cells:b,colCount:r.colCount,rowCount:r.rowCount,locale:l.value,getCellValue:(s,f)=>cn(s,f),getSheetCells:s=>g.getSheetCellsById?g.getSheetCellsById(s):null}}function qt(s,f){const m=je(f,s),k=m?{col:m.range.startCol,row:m.range.startRow}:{col:f,row:s};return Ee.getRules(k.col,k.row,K)}function Qn(s,f){const m=qt(s,f);return m.length?m[0]:null}function _n(s,f){return qt(s,f).length>0}function Vn(s,f){const m=je(f,s),k=m?{col:m.range.startCol,row:m.range.startRow}:{col:f,row:s};return Ee.findRule(k.col,k.row,A1,K)}function ml(s){const f=s.listSource,m=f&&f.type==="range"?`range:${f.sheetId??""}:${f.range.startCol},${f.range.startRow},${f.range.endCol},${f.range.endRow}`:`values:${(f&&f.type==="values"?f.values:s.values??[]).join("")}`,k=ee.get(m);if(k)return k;const T=La(s,eo());return ee.set(m,T),T}function Dn(s,f){const m=Vn(s,f);return m?{rule:m,items:ml(m)}:null}function Sl(s,f){for(const m of qt(s,f)){if(m.enabled===!1||!m.showInputMessage)continue;const k=m.inputTitle??"",T=m.inputMessage??"";if(!(!k&&!T))return{title:k,message:T}}return null}function wo(s,f,m){const k=qt(s,f);return k.length===0?{valid:!0}:$a(m,f,s,k,eo())}function vo(s){const f=eo(),m={stop:3,warning:2,information:1};let k=null,T=0;for(const L of s){const de=qt(L.row,L.col);if(de.length===0)continue;const ue=$a(L.value,L.col,L.row,de,f);if(ue.valid)continue;const he=m[Rr(ue.rule)]??0;he>T&&(T=he,k=ue)}return k??{valid:!0}}function ko(s,f){return Ia(s,f,b)}function Ar(s,f){return g1(s,f,b,Q)}function Go(s,f,m,k,T){var de,ue,he;T!=null&&T.silent||(de=g.saveUndo)==null||de.call(g);const L=y1(s,f,m,k,b,Q);return Ho(b,Q),(ue=g.scheduleRender)==null||ue.call(g),(he=g.emitModelData)==null||he.call(g),L}function Eo(s,f){var m,k,T;Q[s]&&((m=g.saveUndo)==null||m.call(g),C1(s,f,Q),(k=g.scheduleRender)==null||k.call(g),(T=g.emitModelData)==null||T.call(g))}function qo(s,f){var m,k,T;Ia(s,f,b)&&((m=g.saveUndo)==null||m.call(g),w1(s,f,b,Q),Ho(b,Q),(k=g.scheduleRender)==null||k.call(g),(T=g.emitModelData)==null||T.call(g))}function jo(){Ho(b,Q)}function Lr(s){return v1(s,b,Q)}function Yo(s,f){var k,T,L;f!=null&&f.silent||(k=g.saveUndo)==null||k.call(g);const m={...s,id:s.id||Oa(),ranges:(s.ranges??[]).map(de=>({...de})),enabled:s.enabled!==!1};return K.push(m),Tn(),f!=null&&f.silent||((T=g.scheduleRender)==null||T.call(g),(L=g.emitModelData)==null||L.call(g)),m}function $r(s,f,m){var T,L,de;const k=K.findIndex(ue=>ue.id===s);if(k<0){Yo({id:s,...f},m);return}m!=null&&m.silent||(T=g.saveUndo)==null||T.call(g),K[k]={...K[k],...f,id:s},Tn(),m!=null&&m.silent||((L=g.scheduleRender)==null||L.call(g),(de=g.emitModelData)==null||de.call(g))}function zr(s,f){var k,T,L;const m=K.findIndex(de=>de.id===s);m<0||(f!=null&&f.silent||(k=g.saveUndo)==null||k.call(g),K.splice(m,1),Tn(),f!=null&&f.silent||((T=g.scheduleRender)==null||T.call(g),(L=g.emitModelData)==null||L.call(g)))}function _r(s,f){var T,L,de,ue,he,We;if(!s){if(K.length===0)return;f!=null&&f.silent||(T=g.saveUndo)==null||T.call(g),K.splice(0,K.length),Tn(),f!=null&&f.silent||((L=g.scheduleRender)==null||L.call(g),(de=g.emitModelData)==null||de.call(g));return}const m={startCol:Math.min(s.startCol,s.endCol),endCol:Math.max(s.startCol,s.endCol),startRow:Math.min(s.startRow,s.endRow),endRow:Math.max(s.startRow,s.endRow)};if(K.filter($e=>($e.ranges??[]).some(Pe=>!(Pe.endCol<m.startCol||Pe.startCol>m.endCol||Pe.endRow<m.startRow||Pe.startRow>m.endRow))).length!==0){f!=null&&f.silent||(ue=g.saveUndo)==null||ue.call(g);for(let $e=K.length-1;$e>=0;$e--){const Pe=K[$e],qe=[];for(const ft of Pe.ranges??[])qe.push(..._a(ft,m));qe.length===0?K.splice($e,1):Pe.ranges=qe}Tn(),f!=null&&f.silent||((he=g.scheduleRender)==null||he.call(g),(We=g.emitModelData)==null||We.call(g))}}function Hr(s){const f=[];for(const m of K)for(const k of m.ranges??[]){const T=Ha(k,s);T&&f.push({rule:m,range:T})}return f}function Wr(s,f,m){var k,T,L;if(s.length){m!=null&&m.silent||(k=g.saveUndo)==null||k.call(g);for(let de=K.length-1;de>=0;de--){const ue=K[de],he=[];for(const We of ue.ranges??[])he.push(..._a(We,f));he.length===0?K.splice(de,1):ue.ranges=he}for(const de of s){const ue=[];for(const he of de.ranges??[]){const We=Ha(he,f);We&&ue.push(We)}ue.length&&K.push({...de,id:Oa(),ranges:ue})}Tn(),m!=null&&m.silent||((T=g.scheduleRender)==null||T.call(g),(L=g.emitModelData)==null||L.call(g))}}async function Ro(s,f,m){const k=s.severity??"stop";if(!(!s.rule||s.rule.showErrorMessage!==!1))return k==="stop"?"cancel":"continue";const L=g.showValidationAlert;if(!L)return k==="stop"?"cancel":"continue";pe++;try{return await L({severity:k,title:s.title??"",message:s.message??"",col:f,row:m})}catch{return"cancel"}finally{pe=Math.max(0,pe-1)}}function Ur(){return pe>0}let Xo=()=>{};function So(s){J.value||(J.value={...V.value},s!==void 0?re.value=s:re.value||(re.value=zn(V.value.col,V.value.row)))}async function Zo(){const s=J.value;if(!s)return!1;const f=s.col,m=s.row,k=re.value,T=wo(m,f,k);return!T.valid&&await Ro(T,f,m)!=="continue"?!1:(Xo(),Rl(f,m,k),J.value=null,re.value="",!0)}function Jo(){J.value=null,re.value=""}function Mo(s,f){const m=V.value;let k=Math.max(0,m.col+s),T=Math.max(0,m.row+f);(k>=r.colCount||T>=r.rowCount)&&x(k,T);const L=je(m.col,m.row),de=je(k,T);L&&de&&L.anchor===de.anchor&&(s>0?k=L.range.endCol+1:s<0&&(k=L.range.startCol-1),f>0?T=L.range.endRow+1:f<0&&(T=L.range.startRow-1),(k>=r.colCount||T>=r.rowCount)&&x(k,T)),k=Math.max(0,Math.min(r.colCount-1,k)),T=Math.max(0,Math.min(r.rowCount-1,T)),Ko(k,T)}function No(s,f){y(f,s)}function Qo(s){const f=vt.value;if(s<0||s>=f[r.colCount])return-1;let m=0,k=r.colCount-1;for(;m<k;){const T=m+k+1>>1;f[T]<=s?m=T:k=T-1}return m}function er(s){const f=Bn.value;if(s<0||s>=f[r.rowCount])return-1;let m=0,k=r.rowCount-1;for(;m<k;){const T=m+k+1>>1;f[T]<=s?m=T:k=T-1}return m}function Pr(s,f){var T,L;const m=Math.max(0,Math.min(Math.floor(s),r.rowCount)),k=Math.max(0,Math.min(Math.floor(f),r.colCount));q.rows=m,q.cols=k,(T=g.scheduleRender)==null||T.call(g),(L=g.emitModelData)==null||L.call(g)}function Kr(){var s,f;q.rows=0,q.cols=0,(s=g.scheduleRender)==null||s.call(g),(f=g.emitModelData)==null||f.call(g)}function Gr(){return{rows:q.rows,cols:q.cols}}function to(){let s=0,f=0;if(q.cols>0){const m=ae.value,k=Math.min(q.cols,m.length);for(let T=0;T<k;T++)s+=m[T]}if(q.rows>0)for(let m=0;m<q.rows;m++)f+=Vt(m);return{frozenRowsHeight:f,frozenColumnsWidth:s}}function dn(){const{frozenColumnsWidth:s,frozenRowsHeight:f}=to(),m=ot(),k=mt(),T=52+m+s,L=24+k+f,de=Math.max(0,It.w-52-m-11-s),ue=Math.max(0,It.h-24-k-11-f),he=[];return f>0&&s>0&&he.push({kind:"corner",x:52+m,y:24+k,width:s,height:f,scrollLeft:0,scrollTop:0}),f>0&&he.push({kind:"rows",x:T,y:24+k,width:de,height:f,scrollLeft:ve.value,scrollTop:0}),s>0&&he.push({kind:"columns",x:52+m,y:L,width:s,height:ue,scrollLeft:0,scrollTop:Me.value}),he.push({kind:"body",x:T,y:L,width:de,height:ue,scrollLeft:ve.value,scrollTop:Me.value}),he}function Ol(s,f){const m=vt.value,k=Bn.value,T=m[f]??0,L=k[s]??0,de=je(f,s),ue=de?(m[de.range.endCol+1]??T)-T:(m[f+1]??T)-T,he=de?(k[de.range.endRow+1]??L)-L:Vt(s),We=f<q.cols,$e=s<q.rows,Pe=(We?0:-ve.value)+52+ot()+T,qe=($e?0:-Me.value)+24+mt()+L;return{x:Pe,y:qe,width:ue,height:he}}function qr(s,f){const{frozenColumnsWidth:m,frozenRowsHeight:k}=to(),T=ot(),L=mt();if(s<52+T||f<24+L)return null;const de=m>0&&s<52+T+m,ue=k>0&&f<24+L+k,he=de?s-52-T:s-52-T+ve.value,We=ue?f-24-L:f-24-L+Me.value,$e=Qo(he),Pe=er(We);return $e<0||Pe<0?null:{col:$e,row:Pe}}function u(s,f){return s<q.rows||f<q.cols}function y(s,f){if(u(s,f))return;const{frozenColumnsWidth:m,frozenRowsHeight:k}=to(),T=Math.max(0,It.w-52-ot()-11-m),L=Math.max(0,It.h-24-mt()-11-k),de=vt.value,ue=Bn.value,he=(de[f]??0)-m,We=(ue[s]??0)-k,$e=je(f,s),Pe=$e?(de[$e.range.endCol+1]??0)-(de[f]??0):ae.value[f]??0,qe=$e?(ue[$e.range.endRow+1]??0)-(ue[s]??0):Vt(s);let ft=ve.value,yt=Me.value;he<ft?ft=he:he+Pe>ft+T&&(ft=he+Pe-T),We<yt?yt=We:We+qe>yt+L&&(yt=We+qe-L),ft=Math.max(0,ft),yt=Math.max(0,yt),Et(ft,yt)}function x(s,f){var L;const m=s+1,k=f+1;let T=!1;if(m>=r.colCount){const de=Math.max(r.colCount+c,m),ue=de-r.colCount,he=ae.value;for(let We=0;We<ue;We++)he.push(100);r.colCount=de,T=!0}if(k>=r.rowCount){const de=Math.max(r.rowCount+d,k),ue=de-r.rowCount,he=oe.value;for(let We=0;We<ue;We++)he.push(void 0);r.rowCount=de,T=!0}T&&((L=g.scheduleRender)==null||L.call(g))}function H(){return r.colCount!==a||r.rowCount!==i}function D(s,f,m){const k=yr(s,f,le);if(!k.ok){k.reason==="target-merge-size"&&window.alert(w(l.value,"autofillMergeSizeError"));return}const T=Da(s,f,{cells:b},m,l.value,r.colCount,r.rowCount,ut),L=Object.entries(T.cells).map(([ue,he])=>{const We=ue.indexOf(",");return{col:parseInt(ue.substring(0,We),10),row:parseInt(ue.substring(We+1),10),value:he?he.value:""}}),de=vo(L);if(!de.valid){(async()=>await Ro(de,f.startCol,f.startRow)==="continue"&&P(s,f,m))();return}P(s,f,m)}function P(s,f,m){var L,de,ue;(L=g.saveUndo)==null||L.call(g),x(f.endCol,f.endRow);const k=Da(s,f,{cells:b},m,l.value,r.colCount,r.rowCount,ut);Cl();for(const[he,We]of Object.entries(k.cells)){const $e=he.indexOf(","),Pe=parseInt(he.substring(0,$e),10),qe=parseInt(he.substring($e+1),10),ft=ln(Pe,qe);if(ft&&!(Pe===ft.range.startCol&&qe===ft.range.startRow))continue;const yt=We.value;yt===""&&(We.styleId===void 0||We.styleId===0)?(xe.clear(he),dl(he)):(b[he]={value:yt,...We.styleId!==void 0&&We.styleId>0?{styleId:We.styleId}:{}},yt.startsWith("=")?xe.set(he,Io(yt.slice(1),r.colCount,r.rowCount)):xe.clear(he)),xe.markDirty(he)}const T={startCol:Math.min(s.startCol,f.startCol),startRow:Math.min(s.startRow,f.startRow),endCol:Math.max(s.endCol,f.endCol),endRow:Math.max(s.endRow,f.endRow)};yo(T.startCol,T.startRow,T.endCol,T.endRow),(de=g.scheduleRender)==null||de.call(g),(ue=g.emitModelData)==null||ue.call(g)}function Z(s,f){var L;let m=!1;const k=Math.max(1,Math.floor(s)),T=Math.max(1,Math.floor(f));if(k!==r.colCount){if(k>r.colCount){const de=ae.value;for(let ue=r.colCount;ue<k;ue++)de.push(100)}else ae.value=ae.value.slice(0,k);r.colCount=k,m=!0}if(T!==r.rowCount){if(T>r.rowCount){const de=oe.value;for(let ue=r.rowCount;ue<T;ue++)de.push(void 0)}else oe.value=oe.value.slice(0,T);r.rowCount=T,m=!0}m&&((L=g.scheduleRender)==null||L.call(g))}const g={props:n,locale:l,get colCount(){return r.colCount},get rowCount(){return r.rowCount},ensureCapacity:x,hasDynamicDims:H,setDims:Z,cells:b,styles:C,borders:v,merges:le,formulaDeps:xe,selection:ce,activeCell:V,editingCell:J,editValue:re,colWidths:ae,rowHeights:oe,scrollX:ve,scrollY:Me,freeze:q,setFreeze:Pr,clearFreeze:Kr,getFreeze:Gr,getFrozenMetrics:to,filter:$,getFilter:Vr,setFilter:po,enableFilter:jl,clearFilter:Yl,clearFilterColumn:ho,setFilterColumn:Dr,getColumnCandidates:Fr,getDataRange:Fl,getCurrentRegion:Dl,detectFilterRange:vl,toggleAutoFilter:Xl,isColumnInFilterRange:go,getFilterRange:Zl,isFilterEnabled:bo,isFilterColumnActive:cl,isRowHidden:z,getFilteredOutRows:_,getVisibleRowCount:G,getVisibleRowAt:ye,getVisibleRowIndex:Be,getViewportRegions:dn,cellToScreenRect:Ol,screenToCell:qr,isCellFrozen:u,scrollCellIntoView:y,BASE_CELL_VPAD:ht,fontMetricsCache:Ae,fontMetricsCanvas:Re,measureFontMetrics:_e,_getFontMetricsForCell:et,getWrappedLines:N,cellFontSize:te,colPositions:vt,getRowHeight:en,_isAutoRow:Xt,rowPositions:Bn,totalWidth:Ir,totalHeight:Or,selectCell:Ko,selectRange:yo,selectAll:kl,isSelected:sn,isCellSelected:bn,selectionMode:Fe,cellKey:gn,delCell:dl,findMerge:ln,_isMergeAnchor:xn,_mergedSpan:El,expandSelectionForMerges:ul,getCellRaw:zn,getCellValue:cn,setCellValue:Rl,clearCellsInRange:Il,startEdit:So,commitEdit:Zo,cancelEdit:Jo,moveActive:Mo,ensureVisible:No,hitCol:Qo,hitRow:er,registerStyle:se,resolveStyle:Se,rebuildStyleIndex:Xe,syncStyles:Qe,registerBorder:X,resolveBorder:rt,rebuildBorderIndex:O,syncBorders:I,getCellBorderSide:j,getMergeOwner:we,isSameMergeInternal:ze,getRowOutlines:Ot,getColumnOutlines:xt,addRowGroup:il,addColumnGroup:sl,removeOutline:Gl,clearRowGroups:Jn,clearColumnGroups:Tl,clearAllOutlines:Vl,setOutlineCollapsed:fo,toggleOutline:mo,getOutlineLevel:p,getOutlineGutterSize:S,getRowOutlineLevel:Ne,getColumnOutlineLevel:M,isRowCollapsed:be,isColumnCollapsed:Je,isRowVisible:E,isColumnVisible:U,isColHidden:ne,getColWidth:ke,adjustOutlinesForInsertRows:Br,adjustOutlinesForDeleteRows:xr,adjustOutlinesForInsertCols:Tr,adjustOutlinesForDeleteCols:Po,syncOutlines:ql,viewSize:It,findHighlight:(s,f)=>null,autoFillState:fe,applyAutoFill:D,conditionalFormats:R,resolveConditionalFormat:Ql,addConditionalFormatRule:on,updateConditionalFormatRule:fl,removeConditionalFormatRule:St,moveConditionalFormatRule:Mt,clearConditionalFormats:Co,invalidateConditionalFormatCache:tn,dataValidations:K,getDataValidationRules:qt,getDataValidationRule:Qn,hasDataValidation:_n,getListValidation:Vn,getValidationDropdown:Dn,getValidationInputMessage:Sl,validateCell:wo,validateCells:vo,createDataValidation:Yo,updateDataValidation:$r,removeDataValidation:zr,clearDataValidation:_r,getDataValidationsInRange:Hr,applyDataValidationsToRange:Wr,invalidateDataValidationCache:Tn,isValidationAlertOpen:Ur,confirmInvalidValue:Ro,notes:Q,hasNote:ko,getNote:Ar,setCellNote:Go,updateCellNote:Eo,deleteCellNote:qo,gcNotes:jo,getNotesInRange:Lr};return Xo=()=>{var s;return(s=g.saveUndo)==null?void 0:s.call(g)},Et=(s,f)=>{var m;return(m=g.clampScroll)==null?void 0:m.call(g,s,f)},g}function op(e,o){const n=t.ref([]),l=t.ref([]);function a(E){return Q1(E)}function i(){return o.saveSheet(),{sheets:o.sheets.value.map(E=>({id:E.id,name:E.name,cells:a(E.cells),styles:[...E.styles],borders:E.borders?[...E.borders]:[{}],merges:E.merges?{...E.merges}:{},selection:E.selection?{...E.selection}:null,activeCell:E.activeCell?{...E.activeCell}:{col:0,row:0},scrollX:E.scrollX,scrollY:E.scrollY,colWidths:[...E.colWidths],rowHeights:[...E.rowHeights],colCount:E.colCount,rowCount:E.rowCount,freeze:{...E.freeze},filter:E.filter?JSON.parse(JSON.stringify(E.filter)):null,conditionalFormats:E.conditionalFormats?E.conditionalFormats.map(U=>({...U,ranges:U.ranges.map(ne=>({...ne}))})):[],dataValidations:E.dataValidations?E.dataValidations.map(U=>({...U,ranges:(U.ranges??[]).map(ne=>({...ne}))})):[],rowOutlines:E.rowOutlines?E.rowOutlines.map(U=>({...U})):[],columnOutlines:E.columnOutlines?E.columnOutlines.map(U=>({...U})):[],notes:E.notes?Object.fromEntries(Object.entries(E.notes).map(([U,ne])=>[U,{...ne}])):{}})),styles:[...e.styles],activeSheetIndex:o.activeSheetIndex.value}}function r(E){const U=o.sheets.value;o.sheets.value=E.sheets.map((ne,ke)=>{var M;const Ne=((M=U[ke])==null?void 0:M.freeze)??{rows:0,cols:0};return{...ne,cells:a(ne.cells),styles:[...ne.styles],borders:ne.borders?[...ne.borders]:[{}],freeze:{rows:Ne.rows,cols:Ne.cols}}}),o.loadSheet(Math.max(0,Math.min(E.activeSheetIndex,o.sheets.value.length-1))),e.formulaDeps.rebuild(e.cells,e.colCount,e.rowCount)}function c(){const E=i(),U=n.value[n.value.length-1];U&&JSON.stringify(U)===JSON.stringify(E)||(n.value.push(E),l.value=[],n.value.length>50&&n.value.shift())}e.saveUndo=c;function d(){var E,U,ne;n.value.length&&(l.value.push(i()),r(n.value.pop()),(E=e.invalidateConditionalFormatCache)==null||E.call(e),(U=e.invalidateDataValidationCache)==null||U.call(e),(ne=e.scheduleRender)==null||ne.call(e),t.nextTick(()=>{var ke;return(ke=e.emitModelData)==null?void 0:ke.call(e)}))}function b(){var E,U,ne;l.value.length&&(n.value.push(i()),r(l.value.pop()),(E=e.invalidateConditionalFormatCache)==null||E.call(e),(U=e.invalidateDataValidationCache)==null||U.call(e),(ne=e.scheduleRender)==null||ne.call(e),t.nextTick(()=>{var ke;return(ke=e.emitModelData)==null?void 0:ke.call(e)}))}const C=t.computed(()=>n.value.length>0),v=t.computed(()=>l.value.length>0),h=t.computed(()=>!!e.selection.value),B=t.ref(null);function R(){var ne;const E=e.selection.value;if(!E)return;const U={};for(let ke=E.startCol;ke<=E.endCol;ke++)for(let Ne=E.startRow;Ne<=E.endRow;Ne++)U[`${ke-E.startCol},${Ne-E.startRow}`]=((ne=e.cells[e.cellKey(ke,Ne)])==null?void 0:ne.styleId)??0;B.value={styles:U}}function F(){var ne,ke,Ne;const E=B.value,U=e.selection.value;if(!(!E||!U)){c();for(let M=U.startCol;M<=U.endCol;M++)for(let p=U.startRow;p<=U.endRow;p++){const S=e.findMerge(M,p);if(S&&(M!==S.range.startCol||p!==S.range.startRow))continue;const ot=E.styles[`${M-U.startCol},${p-U.startRow}`]??0,mt=e.cellKey(M,p),Ot=((ne=e.cells[mt])==null?void 0:ne.value)??"";if(Ot===""&&ot===0)e.delCell(mt);else{const xt={value:Ot};ot>0&&(xt.styleId=ot),e.cells[mt]=xt}}B.value=null,(ke=e.scheduleRender)==null||ke.call(e),(Ne=e.emitModelData)==null||Ne.call(e)}}function Q(){var U,ne,ke;const E=e.selection.value;if(E){c();for(let Ne=E.startCol;Ne<=E.endCol;Ne++)for(let M=E.startRow;M<=E.endRow;M++){const p=e.findMerge(Ne,M);if(p&&(Ne!==p.range.startCol||M!==p.range.startRow))continue;const S=e.cellKey(Ne,M),ot=((U=e.cells[S])==null?void 0:U.value)??"";ot===""?e.delCell(S):e.cells[S]={value:ot}}(ne=e.scheduleRender)==null||ne.call(e),(ke=e.emitModelData)==null||ke.call(e)}}const K=t.computed(()=>ui.map(E=>({...E,label:E.value===""?w(e.locale.value,"fontDefault"):E.label}))),Ee=t.computed(()=>fi.map(E=>({...E,label:String(E.value)}))),ee="\0",pe=t.computed(()=>{const E=e.selection.value;if(!E)return"";let U,ne=!1;for(let ke=E.startCol;ke<=E.endCol&&!ne;ke++)for(let Ne=E.startRow;Ne<=E.endRow&&!ne;Ne++){const M=e.findMerge(ke,Ne);if(M&&(ke!==M.range.startCol||Ne!==M.range.startRow))continue;const p=e.resolveStyle(e.cells[e.cellKey(ke,Ne)]),S=typeof(p==null?void 0:p.fontFamily)=="string"?p.fontFamily:"";U===void 0?U=S:S!==U&&(ne=!0)}return ne?ee:U??""}),ie=t.computed(()=>{const E=e.selection.value;if(!E)return nl;let U,ne=!1;for(let ke=E.startCol;ke<=E.endCol&&!ne;ke++)for(let Ne=E.startRow;Ne<=E.endRow&&!ne;Ne++){const M=e.findMerge(ke,Ne);if(M&&(ke!==M.range.startCol||Ne!==M.range.startRow))continue;const p=e.cellFontSize(ke,Ne);U===void 0?U=p:p!==U&&(ne=!0)}return ne?0:U??nl});function me(E,U){var ke,Ne,M;const ne=e.selection.value;if(ne){c();for(let p=ne.startCol;p<=ne.endCol;p++)for(let S=ne.startRow;S<=ne.endRow;S++){const ot=e.findMerge(p,S);if(ot&&(p!==ot.range.startCol||S!==ot.range.startRow))continue;const mt=e.cellKey(p,S),Ot=((ke=e.cells[mt])==null?void 0:ke.value)??"";let Tt={...e.resolveStyle(e.cells[mt])??{}};if(U===""||U===null||U===void 0||U===0){const{[E]:sl,...Gl}=Tt;Tt=Gl}else Tt[E]=U;const il=Object.keys(Tt).length?e.registerStyle(Tt):0;if(Ot===""&&il===0)e.delCell(mt);else{const sl={value:Ot};il>0&&(sl.styleId=il),e.cells[mt]=sl}}(Ne=e.scheduleRender)==null||Ne.call(e),(M=e.emitModelData)==null||M.call(e)}}function se(E){me("fontFamily",E===""?"":E)}const Se=t.ref(!1),Xe=t.ref(!1),Qe=t.ref(!1),X=t.ref(!1),rt=t.ref(!1);function O(E){me("fontSize",E),Se.value=!1}const I=t.computed(()=>Ci.map(E=>({label:w(e.locale.value,E.labelKey),value:E.value,icon:E.icon}))),j=t.computed(()=>wi.map(E=>({label:w(e.locale.value,E.labelKey),value:E.value,icon:E.icon}))),we=t.computed(()=>{const E=e.selection.value;if(!E)return"left";const U=e.resolveStyle(e.cells[e.cellKey(E.startCol,E.startRow)]),ne=typeof(U==null?void 0:U.textAlign)=="string"?U.textAlign:"";return ne==="center"||ne==="right"?ne:"left"}),ze=t.computed(()=>{const E=e.selection.value;if(!E)return"top";const U=e.resolveStyle(e.cells[e.cellKey(E.startCol,E.startRow)]),ne=typeof(U==null?void 0:U.verticalAlign)=="string"?U.verticalAlign:"";return ne==="middle"||ne==="bottom"?ne:"top"}),le=t.computed(()=>{const E=e.selection.value;if(!E)return!1;const U=e.resolveStyle(e.cells[e.cellKey(E.startCol,E.startRow)]);return(U==null?void 0:U.wrap)==="wrap"});function xe(E){me("textAlign",E)}function ce(E){me("verticalAlign",E)}function Fe(){if(!e.selection.value)return;const U=le.value;me("wrap",U?void 0:"wrap")}const V=t.ref(""),J=Se;t.watch(ie,E=>{V.value=E===0?"":String(E)},{immediate:!0});function re(E){const U=E.replace(/[^\d]/g,"");V.value=U;const ne=parseInt(U,10);!isNaN(ne)&&ne>=5&&ne<=72&&ne!==ie.value&&me("fontSize",ne)}function ae(){const E=V.value.trim();if(!E){V.value=ie.value===0?"":String(ie.value);return}let U=parseInt(E,10);isNaN(U)?U=ie.value===0?nl:ie.value:U=Math.max(5,Math.min(72,U)),V.value=String(U),U!==ie.value&&me("fontSize",U)}function oe(E){E.key==="Enter"&&E.target.blur()}function ve(E){E&&E.preventDefault(),J.value=!J.value,J.value&&(Qe&&(Qe.value=!1),Xe&&(Xe.value=!1),X.value=!1,rt.value=!1)}function Me(){const E=ie.value===0?nl:ie.value,U=Math.min(72,E+1);me("fontSize",U),V.value=String(U),J.value=!1}function q(){const E=ie.value===0?nl:ie.value,U=Math.max(5,E-1);me("fontSize",U),V.value=String(U),J.value=!1}function $(E){const U=e.selection.value;if(!U)return!1;let ne,ke=!1;for(let Ne=U.startCol;Ne<=U.endCol&&!ke;Ne++)for(let M=U.startRow;M<=U.endRow&&!ke;M++){const p=e.findMerge(Ne,M);if(p&&(Ne!==p.range.startCol||M!==p.range.startRow))continue;const S=e.resolveStyle(e.cells[e.cellKey(Ne,M)]),ot=!!(S!=null&&S[E]);ne===void 0?ne=ot:ot!==ne&&(ke=!0)}return!ke&&ne===!0}const Y=t.computed(()=>$("fontWeight")),W=t.computed(()=>$("fontStyle")),fe=t.computed(()=>$("underline")),Ae=t.computed(()=>$("strikethrough"));function Re(){me("fontWeight",Y.value?"":"bold")}function _e(){me("fontStyle",W.value?"":"italic")}function Ge(){me("underline",fe.value?"":"underline")}function Le(){me("strikethrough",Ae.value?"":"line-through")}const ht=t.ref(""),bt=t.ref(""),je=X,Bt=rt;function Yt(){je.value=!je.value,Bt.value=!1,Xe&&(Xe.value=!1),Qe&&(Qe.value=!1)}function Vt(){Bt.value=!Bt.value,je.value=!1,Xe&&(Xe.value=!1),Qe&&(Qe.value=!1)}function zt(E){Xe&&(Xe.value=E),E&&(je.value=!1,Bt.value=!1,Qe&&(Qe.value=!1))}function et(E){ht.value=E,me("color",E===""?"":E)}function N(E){bt.value=E,me("backgroundColor",E===""?"":E)}function te(){me("color",ht.value===""?"":ht.value)}function vt(){me("backgroundColor",bt.value===""?"":bt.value)}const It=t.computed(()=>{const E=e.selection.value;if(!E)return"";let U,ne=!1;for(let ke=E.startCol;ke<=E.endCol&&!ne;ke++)for(let Ne=E.startRow;Ne<=E.endRow&&!ne;Ne++){const M=e.findMerge(ke,Ne);if(M&&(ke!==M.range.startCol||Ne!==M.range.startRow))continue;const p=e.resolveStyle(e.cells[e.cellKey(ke,Ne)]),S=typeof(p==null?void 0:p.color)=="string"?p.color:"";U===void 0?U=S:S!==U&&(ne=!0)}return ne?"":U??""}),Et=t.computed(()=>{const E=e.selection.value;if(!E)return"";let U,ne=!1;for(let ke=E.startCol;ke<=E.endCol&&!ne;ke++)for(let Ne=E.startRow;Ne<=E.endRow&&!ne;Ne++){const M=e.findMerge(ke,Ne);if(M&&(ke!==M.range.startCol||Ne!==M.range.startRow))continue;const p=e.resolveStyle(e.cells[e.cellKey(ke,Ne)]),S=typeof(p==null?void 0:p.backgroundColor)=="string"?p.backgroundColor:"";U===void 0?U=S:S!==U&&(ne=!0)}return ne?"":U??""}),Sn=t.computed(()=>aa(e.locale.value)),en=t.ref(!1),Xt=t.computed(()=>{const E=e.selection.value;if(!E)return ol;let U,ne=!1;for(let ke=E.startCol;ke<=E.endCol&&!ne;ke++)for(let Ne=E.startRow;Ne<=E.endRow&&!ne;Ne++){const M=e.findMerge(ke,Ne);if(M&&(ke!==M.range.startCol||Ne!==M.range.startRow))continue;const p=e.resolveStyle(e.cells[e.cellKey(ke,Ne)]),S=(p==null?void 0:p.numberFormatCategory)==="custom"?ll:typeof(p==null?void 0:p.numberFormat)=="string"?p.numberFormat:"";U===void 0?U=S:S!==U&&(ne=!0)}return ne?jn:U??ol});function Zt(E){if((E==null?void 0:E.numberFormatCategory)==="custom")return ll;const U=typeof(E==null?void 0:E.numberFormat)=="string"?E.numberFormat:"";return ra(U,e.locale.value)}const Mn=t.computed(()=>{const E=Xt.value;if(E!==jn)return E===ll?ll:ra(E,e.locale.value);const U=e.selection.value;if(!U)return ol;let ne,ke=!1;for(let Ne=U.startCol;Ne<=U.endCol&&!ke;Ne++)for(let M=U.startRow;M<=U.endRow&&!ke;M++){const p=e.findMerge(Ne,M);if(p&&(Ne!==p.range.startCol||M!==p.range.startRow))continue;const S=Zt(e.resolveStyle(e.cells[e.cellKey(Ne,M)]));ne===void 0?ne=S:S!==ne&&(ke=!0)}return ke?jn:ne??ol});function Nn(E){me("numberFormat",E),_()}function _(){const E=e.selection.value;if(E)for(let U=E.startCol;U<=E.endCol;U++)for(let ne=E.startRow;ne<=E.endRow;ne++){const ke=e.findMerge(U,ne);if(ke&&(U!==ke.range.startCol||ne!==ke.range.startRow))continue;const Ne=e.cellKey(U,ne),M=e.cells[Ne],p=e.resolveStyle(M);if((p==null?void 0:p.numberFormatCategory)!=="custom")continue;const{numberFormatCategory:S,...ot}=p,mt=Object.keys(ot).length?e.registerStyle(ot):0,Ot=(M==null?void 0:M.value)??"";if(Ot===""&&mt===0)e.delCell(Ne);else{const xt={value:Ot};mt>0&&(xt.styleId=mt),e.cells[Ne]=xt}}}function z(E){if(E===ll){en.value=!0;return}Nn(E)}function G(){en.value=!0}function ye(){const E=e.selection.value;if(!E)return[];const U=[];for(let ne=E.startCol;ne<=E.endCol;ne++)for(let ke=E.startRow;ke<=E.endRow;ke++){const Ne=e.findMerge(ne,ke);if(Ne&&(ne!==Ne.range.startCol||ke!==Ne.range.startRow))continue;const M=e.cellKey(ne,ke),p=e.cells[M],S=e.resolveStyle(p),ot=typeof(S==null?void 0:S.numberFormat)=="string"?S.numberFormat:ol,mt=(p==null?void 0:p.value)??"",Ot=mt.startsWith("=")?ba(ne,ke,e.cells,e.colCount,e.rowCount):mt;oa(ot,Ot)&&U.push({key:M,nf:ot,decimals:_i(ot,Ot)})}return U}const Be=t.computed(()=>ye().some(E=>E.decimals<cr)),Ve=t.computed(()=>ye().some(E=>E.decimals>dr));function He(E,U,ne){var S;const ke=((S=e.cells[E])==null?void 0:S.value)??"",M={...e.resolveStyle(e.cells[E])??{}};U===""?(delete M.numberFormat,delete M.numberFormatCategory):(M.numberFormat=U,ne==="custom"&&(M.numberFormatCategory="custom"));const p=Object.keys(M).length?e.registerStyle(M):0;if(ke===""&&p===0)e.delCell(E);else{const ot={value:ke};p>0&&(ot.styleId=p),e.cells[E]=ot}}function Ce(E){var ke,Ne;const U=ye(),ne=[];for(const M of U){const p=M.decimals+E;if(p<dr||p>cr)continue;const S=Wi(M.nf,p);S==null||S===M.nf||ne.push({key:M.key,code:S,category:En(M.nf)?"custom":void 0})}if(ne.length){c();for(const M of ne)He(M.key,M.code,M.category);(ke=e.scheduleRender)==null||ke.call(e),(Ne=e.emitModelData)==null||Ne.call(e)}}function Oe(){Ce(1)}function be(){Ce(-1)}return{undoStack:n,redoStack:l,cloneCells:a,takeSnap:i,restoreSnap:r,saveUndo:c,undo:d,redo:b,canUndo:C,canRedo:v,hasSelection:h,paintFmt:B,onPaintFormat:R,applyPaintFormat:F,clearFormat:Q,fontFamilyOptions:K,fontSizeOptions:Ee,FONT_FAMILY_MIXED:ee,selFontFamily:pe,selFontSize:ie,applyStyleToSelection:me,onFontFamilyChange:se,onFontSizeChange:O,hAlignOptions:I,vAlignOptions:j,selHAlign:we,selVAlign:ze,selWrap:le,onHAlignChange:xe,onVAlignChange:ce,onWrapToggle:Fe,fontSizeInput:V,fontSizeMenuOpen:J,onFontSizeInput:re,onFontSizeBlur:ae,onFontSizeKeydown:oe,toggleFontSizeMenu:ve,onFontSizeStepUp:Me,onFontSizeStepDown:q,selFontWeight:Y,selFontStyle:W,selUnderline:fe,selStrikethrough:Ae,toggleFontWeight:Re,toggleFontStyle:_e,toggleUnderline:Ge,toggleStrikethrough:Le,cachedTextColor:ht,cachedFillColor:bt,textColorMenuOpen:je,fillColorMenuOpen:Bt,_toggleTextColorMenu:Yt,_toggleFillColorMenu:Vt,onBorderMenuToggle:zt,onTextColorChange:et,onFillColorChange:N,applyCachedTextColor:te,applyCachedFillColor:vt,selTextColor:It,selFillColor:Et,nfOptions:Sn,selNumberFormat:Xt,selNumberFormatDisplay:Mn,NF_NUMBER_FORMAT_MIXED:jn,nfDialogOpen:en,onNumberFormatChange:z,openNumberFormatDialog:G,applyNumberFormatCode:Nn,canIncreaseDecimals:Be,canDecreaseDecimals:Ve,onIncreaseDecimals:Oe,onDecreaseDecimals:be}}function rp(e,o){o.borderMenuOpen&&(e.borderMenuOpen=o.borderMenuOpen),o.mergeMenuOpen&&(e.mergeMenuOpen=o.mergeMenuOpen),(()=>{const l=e.borderMenuOpen,a=e.mergeMenuOpen;e.onBorderMenuToggle=i=>{l&&(l.value=i),i&&(e.textColorMenuOpen.value=!1,e.fillColorMenuOpen.value=!1,a&&(a.value=!1))},e.toggleFontSizeMenu=i=>{i&&i.preventDefault(),e.fontSizeMenuOpen.value=!e.fontSizeMenuOpen.value,e.fontSizeMenuOpen.value&&(a&&(a.value=!1),l&&(l.value=!1),e.textColorMenuOpen.value=!1,e.fillColorMenuOpen.value=!1)},e._toggleTextColorMenu=()=>{e.textColorMenuOpen.value=!e.textColorMenuOpen.value,e.fillColorMenuOpen.value=!1,l&&(l.value=!1),a&&(a.value=!1)},e._toggleFillColorMenu=()=>{e.fillColorMenuOpen.value=!e.fillColorMenuOpen.value,e.textColorMenuOpen.value=!1,l&&(l.value=!1),a&&(a.value=!1)}})()}function ap(e,o){const n=t.ref("none"),l=t.ref(!1),a="#444";function i(V,J,re,ae){if(V<0||J<0||V>=e.colCount||J>=e.rowCount)return;const oe=e.findMerge(V,J),ve=oe?oe.anchor:e.cellKey(V,J);if(!e.cells[ve]){if(!ae)return;e.cells[ve]={value:""}}np(e.cells[ve],re,ae,e.styles,{get:q=>e.resolveBorder(q),getId:q=>e.registerBorder(q)},e.registerStyle)}function r(V,J,re){var $;const ae=e.findMerge(V,J),oe=ae?ae.anchor:e.cellKey(V,J),ve=(($=e.cells[oe])==null?void 0:$.value)??"",Me=e.resolveStyle(e.cells[oe])?{...e.resolveStyle(e.cells[oe])}:{},q=e.registerBorder(re);if(q>0?Me.borderId=q:delete Me.borderId,delete Me.borderTopWidth,delete Me.borderBottomWidth,delete Me.borderLeftWidth,delete Me.borderRightWidth,delete Me.borderColor,ve===""&&!Object.keys(Me).length)e.delCell(oe);else{const Y=e.registerStyle(Me);e.cells[oe]={value:ve,styleId:Y||void 0}}}function c(V){var $,Y;n.value=V;const J=e.selection.value;if(!J)return;o.saveUndo();const{startCol:re,startRow:ae,endCol:oe,endRow:ve}=J,Me={width:1,color:a},q={width:2,color:a};if(V==="none")for(let W=re;W<=oe;W++)for(let fe=ae;fe<=ve;fe++){const Ae=e.findMerge(W,fe);Ae&&(W!==Ae.range.startCol||fe!==Ae.range.startRow)||r(W,fe,{})}else if(V==="all")for(let W=re;W<=oe;W++)for(let fe=ae;fe<=ve;fe++){const Ae=e.findMerge(W,fe);Ae&&(W!==Ae.range.startCol||fe!==Ae.range.startRow)||r(W,fe,{top:Me,right:Me,bottom:Me,left:Me})}else if(V==="outer"||V==="thickOuter"){const W=V==="thickOuter"?q:Me;for(let fe=re;fe<=oe;fe++)i(fe,ae,"top",W);for(let fe=re;fe<=oe;fe++)i(fe,ve,"bottom",W);for(let fe=ae;fe<=ve;fe++)i(re,fe,"left",W);for(let fe=ae;fe<=ve;fe++)i(oe,fe,"right",W)}else{const fe={top:{side:"top",edgeCheck:(Ae,Re)=>Re===ae},bottom:{side:"bottom",edgeCheck:(Ae,Re)=>Re===ve},left:{side:"left",edgeCheck:(Ae,Re)=>Ae===re},right:{side:"right",edgeCheck:(Ae,Re)=>Ae===oe}}[V];if(fe)for(let Ae=re;Ae<=oe;Ae++)for(let Re=ae;Re<=ve;Re++)fe.edgeCheck(Ae,Re)&&i(Ae,Re,fe.side,Me)}($=e.scheduleRender)==null||$.call(e),(Y=e.emitModelData)==null||Y.call(e)}function d(){c(n.value)}function b(V,J,re){const ae=re.toLowerCase(),oe=e.findMerge(V,J);if(oe){if(ae==="top"&&J!==oe.range.startRow||ae==="bottom"&&J!==oe.range.endRow||ae==="left"&&V!==oe.range.startCol||ae==="right"&&V!==oe.range.endCol)return 0;const Me=e.getCellBorderSide(e.cells[oe.anchor],ae);return(Me==null?void 0:Me.width)??0}const ve=e.getCellBorderSide(e.cells[e.cellKey(V,J)],ae);return(ve==null?void 0:ve.width)??0}const C=t.ref(!1);function v(V){C.value=V,V&&(o.textColorMenuOpen.value=!1,o.fillColorMenuOpen.value=!1,l.value=!1,o.fontSizeMenuOpen.value=!1)}function h(V,J,re,ae){const oe=[];for(const ve in e.merges){const Me=e.merges[ve];Me&&Me.startCol<=re&&Me.endCol>=V&&Me.startRow<=ae&&Me.endRow>=J&&oe.push(ve)}for(const ve of oe)Reflect.deleteProperty(e.merges,ve)}function B(){var ve,Me,q;const V=e.selection.value;if(!V||V.startCol===V.endCol&&V.startRow===V.endRow)return;o.saveUndo(),h(V.startCol,V.startRow,V.endCol,V.endRow);const J=e.cellKey(V.startCol,V.startRow),re=((ve=e.cells[J])==null?void 0:ve.value)??"";for(let $=V.startCol;$<=V.endCol;$++)for(let Y=V.startRow;Y<=V.endRow;Y++)$===V.startCol&&Y===V.startRow||e.clearCellsInRange($,$,Y,Y);const ae=e.resolveStyle(e.cells[J])?{...e.resolveStyle(e.cells[J])}:{};ae.textAlign="center";const oe=e.registerStyle(ae);e.cells[J]={value:re,styleId:oe||void 0},e.merges[J]={startCol:V.startCol,startRow:V.startRow,endCol:V.endCol,endRow:V.endRow},e.selectCell(V.startCol,V.startRow),(Me=e.scheduleRender)==null||Me.call(e),(q=e.emitModelData)==null||q.call(e)}function R(){var J,re,ae;const V=e.selection.value;if(!(!V||V.startCol===V.endCol)){o.saveUndo();for(let oe=V.startRow;oe<=V.endRow;oe++){h(V.startCol,oe,V.endCol,oe);const ve=e.cellKey(V.startCol,oe);(J=e.cells[ve])==null||J.value;for(let Me=V.startCol+1;Me<=V.endCol;Me++)e.clearCellsInRange(Me,Me,oe,oe);e.merges[ve]={startCol:V.startCol,startRow:oe,endCol:V.endCol,endRow:oe}}e.selectRange(V.startCol,V.startRow,V.endCol,V.endRow),(re=e.scheduleRender)==null||re.call(e),(ae=e.emitModelData)==null||ae.call(e)}}function F(){var re,ae,oe;const V=e.selection.value;if(!V||V.startCol===V.endCol&&V.startRow===V.endRow)return;o.saveUndo(),h(V.startCol,V.startRow,V.endCol,V.endRow);const J=e.cellKey(V.startCol,V.startRow);(re=e.cells[J])==null||re.value;for(let ve=V.startCol;ve<=V.endCol;ve++)for(let Me=V.startRow;Me<=V.endRow;Me++)ve===V.startCol&&Me===V.startRow||e.clearCellsInRange(ve,ve,Me,Me);e.merges[J]={startCol:V.startCol,startRow:V.startRow,endCol:V.endCol,endRow:V.endRow},e.selectCell(V.startCol,V.startRow),(ae=e.scheduleRender)==null||ae.call(e),(oe=e.emitModelData)==null||oe.call(e)}function Q(){var J,re;const V=e.selection.value;V&&(o.saveUndo(),h(V.startCol,V.startRow,V.endCol,V.endRow),(J=e.scheduleRender)==null||J.call(e),(re=e.emitModelData)==null||re.call(e))}function K(){const V=e.selection.value;if(!V)return;const J=e.findMerge(V.startCol,V.startRow);J&&V.startCol===J.range.startCol&&V.startRow===J.range.startRow&&V.endCol===J.range.endCol&&V.endRow===J.range.endRow?Q():B()}function Ee(V){switch(V){case"mergeCenter":B();break;case"mergeAcross":R();break;case"mergeCells":F();break;case"unmergeCells":Q();break}}let ee=null,pe=[],ie=[];function me(V,J,re,ae){ie=[];const oe={startCol:V,endCol:J,startRow:re,endRow:ae};for(const{rule:ve,range:Me}of e.getDataValidationsInRange(oe))ie.push({...ve,ranges:[{...Me}]})}function se(V,J,re,ae){pe=[];for(let oe=re;oe<=ae;oe++){const ve=[];for(let Me=V;Me<=J;Me++){const q=e.cells[e.cellKey(Me,oe)];ve.push((q==null?void 0:q.styleId)??0)}pe.push(ve)}}function Se(V,J,re,ae){const oe=e.cellKey(V,J);if(Cl(),re===""||re==null){e.formulaDeps.clear(oe),ae&&ae>0?e.cells[oe]={value:"",styleId:ae}:e.delCell(oe),e.formulaDeps.markDirty(oe);return}e.cells[oe]={value:re,styleId:ae&&ae>0?ae:void 0},re.startsWith("=")?e.formulaDeps.set(oe,Io(re.slice(1),e.colCount,e.rowCount)):e.formulaDeps.clear(oe),e.formulaDeps.markDirty(oe)}function Xe(){const V=e.selection.value;if(!V)return;ee={...V},se(V.startCol,V.endCol,V.startRow,V.endRow),me(V.startCol,V.endCol,V.startRow,V.endRow);const J=[];for(let re=V.startRow;re<=V.endRow;re++){const ae=[];for(let oe=V.startCol;oe<=V.endCol;oe++)ae.push(e.getCellRaw(oe,re));J.push(ae.join(" "))}or(J.join(`
4
- `))}function Qe(){const V=e.selection.value;if(V){if(V.startCol===0&&V.endCol===e.colCount-1){ee={...V},se(0,e.colCount-1,V.startRow,V.endRow),me(0,e.colCount-1,V.startRow,V.endRow);const J=[];for(let re=V.startRow;re<=V.endRow;re++){const ae=[];for(let oe=0;oe<e.colCount;oe++)ae.push(e.getCellRaw(oe,re));J.push(ae.join(" "))}or(J.join(`
5
- `))}else if(V.startRow===0&&V.endRow===e.rowCount-1){ee={...V},se(V.startCol,V.endCol,0,e.rowCount-1),me(V.startCol,V.endCol,0,e.rowCount-1);const J=[];for(let re=0;re<e.rowCount;re++){const ae=[];for(let oe=V.startCol;oe<=V.endCol;oe++)ae.push(e.getCellRaw(oe,re));J.push(ae.join(" "))}or(J.join(`
6
- `))}}}async function X(){var fe;let V;try{V=await navigator.clipboard.readText()}catch{return}if(!V&&V!=="")return;const J=V.split(/\r?\n/),re=e.activeCell.value,ae=ee,oe=ae&&pe.length>0,ve=J.map(Ae=>Ae.split(" ").length),Me=ve.length?Math.max(...ve):0,q=re.col+Me-1,$=re.row+J.length-1;q>=0&&$>=0&&e.ensureCapacity(q,$);const Y=[];for(let Ae=0;Ae<J.length;Ae++){const Re=J[Ae].split(" ");for(let _e=0;_e<Re.length;_e++){const Ge=re.col+_e,Le=re.row+Ae;let ht=Re[_e];ht.startsWith("=")&&ae&&(ht=Oo(ht,Ge-(ae.startCol+_e),Le-(ae.startRow+Ae),e.colCount,e.rowCount,ut));const bt=oe&&Ae<pe.length&&_e<(((fe=pe[Ae])==null?void 0:fe.length)??0)?pe[Ae][_e]??null:null;Y.push({c:Ge,r:Le,val:ht,styleId:bt})}}const W=e.validateCells(Y.map(Ae=>({col:Ae.c,row:Ae.r,value:Ae.val})));if(!(!W.valid&&await e.confirmInvalidValue(W,re.col,re.row)!=="continue")){for(const Ae of Y)Ae.styleId!==null?Se(Ae.c,Ae.r,Ae.val,Ae.styleId):e.setCellValue(Ae.c,Ae.r,Ae.val);if(ae&&ie.length>0){const Ae=re.col-ae.startCol,Re=re.row-ae.startRow,_e={startCol:re.col,endCol:re.col+Me-1,startRow:re.row,endRow:re.row+J.length-1},Ge=ie.map(Le=>({...Le,ranges:Le.ranges.map(ht=>q1(ht,Ae,Re))}));e.applyDataValidationsToRange(Ge,_e,{silent:!0}),e.invalidateDataValidationCache()}}}function rt(){var V;if(o.saveUndo(),Xe(),e.selection.value){const J=e.selection.value;e.clearCellsInRange(J.startCol,J.endCol,J.startRow,J.endRow),(V=e.scheduleRender)==null||V.call(e)}}function O(){var V;if(e.selection.value){const J=e.selection.value;e.clearCellsInRange(J.startCol,J.endCol,J.startRow,J.endRow),(V=e.scheduleRender)==null||V.call(e)}}function I(){var ve,Me;const V=e.selection.value;if(!V)return;o.saveUndo();const J=V.startCol,re=V.startRow,ae=V.endCol,oe=V.endRow;if(re===oe)if(ae+1<e.colCount){const q=`${ut(J)}${re+1}:${ut(ae)}${re+1}`;e.setCellValue(ae+1,re,`=SUM(${q})`)}else{const q=`${ut(J)}${re+1}:${ut(ae-1)}${re+1}`;e.setCellValue(ae,re,`=SUM(${q})`)}else for(let q=J;q<=ae;q++)if(oe+1<e.rowCount){const $=`${ut(q)}${re+1}:${ut(q)}${oe+1}`;e.setCellValue(q,oe+1,`=SUM(${$})`)}else{const $=`${ut(q)}${re+1}:${ut(q)}${oe}`;e.setCellValue(q,oe,`=SUM(${$})`)}(ve=e.scheduleRender)==null||ve.call(e),(Me=e.emitModelData)==null||Me.call(e)}function j(){var ve,Me;const V=e.selection.value;if(!V)return;o.saveUndo();const J=V.startCol,re=V.startRow,ae=V.endCol,oe=V.endRow;if(re===oe)if(ae+1<e.colCount){const q=`${ut(J)}${re+1}:${ut(ae)}${re+1}`;e.setCellValue(ae+1,re,`=AVERAGE(${q})`)}else{const q=`${ut(J)}${re+1}:${ut(ae-1)}${re+1}`;e.setCellValue(ae,re,`=AVERAGE(${q})`)}else for(let q=J;q<=ae;q++)if(oe+1<e.rowCount){const $=`${ut(q)}${re+1}:${ut(q)}${oe+1}`;e.setCellValue(q,oe+1,`=AVERAGE(${$})`)}else{const $=`${ut(q)}${re+1}:${ut(q)}${oe}`;e.setCellValue(q,oe,`=AVERAGE(${$})`)}(ve=e.scheduleRender)==null||ve.call(e),(Me=e.emitModelData)==null||Me.call(e)}function we(){var ve,Me;const V=e.selection.value;if(!V)return;o.saveUndo();const J=V.startCol,re=V.startRow,ae=V.endCol,oe=V.endRow;if(re===oe)if(ae+1<e.colCount){const q=`${ut(J)}${re+1}:${ut(ae)}${re+1}`;e.setCellValue(ae+1,re,`=COUNT(${q})`)}else{const q=`${ut(J)}${re+1}:${ut(ae-1)}${re+1}`;e.setCellValue(ae,re,`=COUNT(${q})`)}else for(let q=J;q<=ae;q++)if(oe+1<e.rowCount){const $=`${ut(q)}${re+1}:${ut(q)}${oe+1}`;e.setCellValue(q,oe+1,`=COUNT(${$})`)}else{const $=`${ut(q)}${re+1}:${ut(q)}${oe}`;e.setCellValue(q,oe,`=COUNT(${$})`)}(ve=e.scheduleRender)==null||ve.call(e),(Me=e.emitModelData)==null||Me.call(e)}const ze=t.ref(!1);function le(V){ze.value=V,V&&(o.textColorMenuOpen.value=!1,o.fillColorMenuOpen.value=!1,l.value=!1,o.fontSizeMenuOpen.value=!1,C.value=!1)}function xe(){I(),ze.value=!1}function ce(){j(),ze.value=!1}function Fe(){we(),ze.value=!1}return{cachedBorder:n,borderMenuOpen:l,BORDER_COLOR:a,onBorderChange:c,setCellBorderSide:i,applyBorderToCell:r,applyCachedBorder:d,cellBorderWidth:b,mergeMenuOpen:C,onMergeMenuToggle:v,removeOverlappingMerges:h,mergeAndCenter:B,mergeAcross:R,mergeCells:F,unmergeCells:Q,onApplyMerge:K,onMergeChange:Ee,copySourceRange:null,copySourceStyles:[],captureStyles:se,captureDataValidations:me,setCellWithStyle:Se,copyToClipboard:Xe,copyRowCol:Qe,pasteFromClipboard:X,cutSelected:rt,clearSelected:O,sumSelected:I,avgSelected:j,countSelected:we,calcMenuOpen:ze,onCalcMenuToggle:le,onCalcSum:xe,onCalcAvg:ce,onCalcCount:Fe}}function ip(e,o,n,l){const a={},i=l(o),r=l(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}function Za(e){return e==="number"?0:1}function Ja(e,o,n){var i;if(e==null||e.trim()==="")return{kind:"blank"};const l=o??"";if(l===kn||l==="@")return{kind:"text",text:e};if(En(l)){if(Ln(e))return{kind:"number",num:Number(e)};const r=Yn(e,n);return r?{kind:"number",num:r.serial}:{kind:"text",text:An(e,l,n)}}const a=rl(l);if(a.kind==="date"||a.kind==="duration"){const r=Number(e);return Number.isFinite(r)?{kind:"number",num:r}:{kind:"text",text:An(e,l,n)}}if(a.kind==="number"){const r=Number(e);if(Number.isFinite(r)){const c=((i=a.sections.find(d=>d.hasDigits))==null?void 0:i.scale)??1;return{kind:"number",num:r*c}}return{kind:"text",text:An(e,l,n)}}return{kind:"text",text:An(e,l,n)}}function sp(e,o,n,l){if(e.kind==="blank"||o.kind==="blank")return e.kind==="blank"&&o.kind==="blank"?0:e.kind==="blank"?1:-1;const a=Za(e.kind),i=Za(o.kind);if(a!==i)return n==="asc"?a-i:i-a;let r;return e.kind==="number"?r=(e.num??0)-(o.num??0):r=(e.text??"").localeCompare(o.text??"",l,{numeric:!0}),n==="asc"?r:-r}function cp(e,o,n){const l=e.map((a,i)=>i);return l.sort((a,i)=>{const r=sp(e[a],e[i],o,n);return r!==0?r:a-i}),l}function dp(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 Mr(e){return e?JSON.parse(JSON.stringify(e)):null}function Qa(e,o,n,l){if(!e)return null;const a=n-o+1,i={...e.range};return l?o<=i.endRow&&(o<=i.startRow&&(i.startRow+=a),i.endRow+=a):n<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 ei(e,o,n,l){if(!e)return null;const a=n-o+1,i={...e.range},r={};if(l){o<=i.endCol&&(o<=i.startCol&&(i.startCol+=a),i.endCol+=a);for(const c in e.columns){const d=Number(c);r[d>=o?d+a:d]=e.columns[c]}}else{n<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 c in e.columns){const d=Number(c);d>=o&&d<=n||(r[d>n?d-a:d]=e.columns[c])}}return{range:i,columns:r}}function ti(e,o,n,l){if(o==="row"){const a=e.startRow,i=e.endRow;let r,c;if(i<n)r=a,c=i;else if(a>n+l-1)r=a-l,c=i-l;else if(r=a<n?a:n,c=i>n+l-1?i-l: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+l-1)r=a-l,c=i-l;else if(r=a<n?a:n,c=i>n+l-1?i-l:n-1,c<r)return null;return{...e,startCol:r,endCol:c}}}function ni(e,o,n,l){if(o==="row"){const a=e.startRow,i=e.endRow;return a>=n?{...e,startRow:a+l,endRow:i+l}:i<n?e:{...e,endRow:i+l}}else{const a=e.startCol,i=e.endCol;return a>=n?{...e,startCol:a+l,endCol:i+l}:i<n?e:{...e,endCol:i+l}}}function up(e,o,n){var a;const l=n-o+1;for(let i=e.conditionalFormats.length-1;i>=0;i--){const r=e.conditionalFormats[i],c=r.ranges.map(d=>ti(d,"row",o,l)).filter(d=>d!==null);c.length===0?e.conditionalFormats.splice(i,1):r.ranges=c}(a=e.invalidateConditionalFormatCache)==null||a.call(e)}function fp(e,o,n){var a;const l=n-o+1;for(const i of e.conditionalFormats)i.ranges=i.ranges.map(r=>ni(r,"row",o,l));(a=e.invalidateConditionalFormatCache)==null||a.call(e)}function mp(e,o,n){var a;const l=n-o+1;for(let i=e.conditionalFormats.length-1;i>=0;i--){const r=e.conditionalFormats[i],c=r.ranges.map(d=>ti(d,"col",o,l)).filter(d=>d!==null);c.length===0?e.conditionalFormats.splice(i,1):r.ranges=c}(a=e.invalidateConditionalFormatCache)==null||a.call(e)}function pp(e,o,n){var a;const l=n-o+1;for(const i of e.conditionalFormats)i.ranges=i.ranges.map(r=>ni(r,"col",o,l));(a=e.invalidateConditionalFormatCache)==null||a.call(e)}function li(e,o,n,l){var a;for(let i=e.dataValidations.length-1;i>=0;i--){const r=e.dataValidations[i],c=(r.ranges??[]).map(d=>K1(d,o,n,l)).filter(d=>d!==null);c.length===0?e.dataValidations.splice(i,1):r.ranges=c}(a=e.invalidateDataValidationCache)==null||a.call(e)}function oi(e,o,n,l){var a;for(const i of e.dataValidations)i.ranges=(i.ranges??[]).map(r=>G1(r,o,n,l));(a=e.invalidateDataValidationCache)==null||a.call(e)}function hp(e,o,n,l,a){function i(_,z){var Oe;const G=z-_+1,ye=rt(_,z),Be=[],Ve=[];for(const be in e.cells){const Je=be.indexOf(",");if(Je<0)continue;const E=parseInt(be.substring(0,Je),10),U=parseInt(be.substring(Je+1),10);U>=_&&U<=z?Ve.push(be):U>z&&Be.push({oldKey:be,newKey:e.cellKey(E,U-G),cell:e.cells[be]})}for(const be of Ve)Reflect.deleteProperty(e.cells,be);for(const be of Be)Reflect.deleteProperty(e.cells,be.oldKey),e.cells[be.newKey]=be.cell;(Oe=e.gcNotes)==null||Oe.call(e);const He=e.rowHeights.value,Ce=new Array(He.length);for(let be=0;be<_;be++)Ce[be]=He[be];for(let be=_;be<He.length-G;be++)Ce[be]=He[be+G];for(let be=He.length-G;be<He.length;be++)Ce[be]=void 0;e.rowHeights.value=Ce,X(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(Qa(e.getFilter(),_,z,!1)),up(e,_,z),li(e,"row",_,G),e.adjustOutlinesForDeleteRows(_,G)}function r(_,z){const G=z-_+1,ye=e.rowCount,Be=e.colCount,{lastRow:Ve}=b();Ve>=_&&Ve+G>=ye&&e.ensureCapacity(Be-1,ye-1+G);const He=e.rowCount,Ce=I(_,z),Oe=[];for(const E in e.cells){const U=E.indexOf(",");if(U<0)continue;const ne=parseInt(E.substring(0,U),10),ke=parseInt(E.substring(U+1),10);ke>=_&&Oe.push({oldKey:E,newKey:e.cellKey(ne,ke+G),cell:e.cells[E],oldRow:ke})}Oe.sort((E,U)=>U.oldRow-E.oldRow);for(const E of Oe)Reflect.deleteProperty(e.cells,E.oldKey),e.cells[E.newKey]=E.cell;for(const E in e.cells){const U=E.indexOf(",");if(U<0)continue;const ne=parseInt(E.substring(U+1),10);ne>=_&&ne<=z&&Reflect.deleteProperty(e.cells,E)}const be=e.rowHeights.value,Je=new Array(He);for(let E=0;E<_;E++)Je[E]=be[E];for(let E=_;E<=z;E++)Je[E]=void 0;for(let E=_;E<He;E++)Je[E+G]=be[E];e.rowHeights.value=Je,X(Ce),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(Qa(e.getFilter(),_,z,!0)),fp(e,_,z),oi(e,"row",_,G),e.adjustOutlinesForInsertRows(_,G)}function c(_,z){const G=z-_+1,ye=e.colCount,Be=e.rowCount,{lastCol:Ve}=b();Ve>=_&&Ve+G>=ye&&e.ensureCapacity(ye-1+G,Be-1);const He=e.colCount,Ce=j(_,z),Oe=[];for(const E in e.cells){const U=E.indexOf(",");if(U<0)continue;const ne=parseInt(E.substring(0,U),10),ke=parseInt(E.substring(U+1),10);ne>=_&&Oe.push({oldKey:E,newKey:e.cellKey(ne+G,ke),cell:e.cells[E],oldCol:ne})}Oe.sort((E,U)=>U.oldCol-E.oldCol);for(const E of Oe)Reflect.deleteProperty(e.cells,E.oldKey),e.cells[E.newKey]=E.cell;for(const E in e.cells){const U=E.indexOf(",");if(U<0)continue;const ne=parseInt(E.substring(0,U),10);ne>=_&&ne<=z&&Reflect.deleteProperty(e.cells,E)}const be=e.colWidths.value,Je=new Array(He);for(let E=0;E<_;E++)Je[E]=be[E];for(let E=_;E<=z;E++)Je[E]=100;for(let E=_;E<He;E++)Je[E+G]=be[E];e.colWidths.value=Je,X(Ce),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(ei(e.getFilter(),_,z,!0)),pp(e,_,z),oi(e,"col",_,G),e.adjustOutlinesForInsertCols(_,G)}function d(_,z){var Oe;const G=z-_+1,ye=O(_,z),Be=[],Ve=[];for(const be in e.cells){const Je=be.indexOf(",");if(Je<0)continue;const E=parseInt(be.substring(0,Je),10),U=parseInt(be.substring(Je+1),10);E>=_&&E<=z?Ve.push(be):E>z&&Be.push({oldKey:be,newKey:e.cellKey(E-G,U),cell:e.cells[be]})}for(const be of Ve)Reflect.deleteProperty(e.cells,be);for(const be of Be)Reflect.deleteProperty(e.cells,be.oldKey),e.cells[be.newKey]=be.cell;(Oe=e.gcNotes)==null||Oe.call(e);const He=e.colWidths.value,Ce=new Array(He.length);for(let be=0;be<_;be++)Ce[be]=He[be];for(let be=_;be<He.length-G;be++)Ce[be]=He[be+G];for(let be=He.length-G;be<He.length;be++)Ce[be]=100;e.colWidths.value=Ce,X(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(ei(e.getFilter(),_,z,!1)),mp(e,_,z),li(e,"col",_,G),e.adjustOutlinesForDeleteCols(_,G)}function b(){let _=-1,z=-1;for(const G in e.cells){const ye=G.split(",");if(ye.length===2){const Be=parseInt(ye[0],10),Ve=parseInt(ye[1],10),He=e.cells[G];He&&(He.value!==""||He.styleId!==void 0)&&(Be>_&&(_=Be),Ve>z&&(z=Ve))}}for(let G=e.colCount-1;G>=0;G--){const ye=e.colWidths.value[G];if(ye!==void 0&&ye!==100){G>_&&(_=G);break}}for(let G=e.rowCount-1;G>=0;G--)if(e.rowHeights.value[G]!==void 0){G>z&&(z=G);break}return{lastCol:_,lastRow:z}}function C(_,z){const G=e.resolveStyle(e.cells[e.cellKey(_,z)]);return typeof(G==null?void 0:G.numberFormat)=="string"?G.numberFormat:""}function v(_,z,G){for(let ye=z;ye<=G;ye++)if(e.getCellRaw(_,ye).trim()!=="")return!0;return!1}function h(_){const{startRow:z,endRow:G,startCol:ye,endCol:Be}=_;let Ve=ye,He=Be;for(;Ve>0&&v(Ve-1,z,G);)Ve--;for(;He<e.colCount-1&&v(He+1,z,G);)He++;return{startRow:z,endRow:G,startCol:Ve,endCol:He}}function B(_){const z=h(_);return z.startCol!==_.startCol||z.endCol!==_.endCol}function R(_,z,G,ye=_){let Be,Ve;if(G)Be=G.startRow,Ve=G.endRow;else{const E=e.selection.value,U=!!E&&E.startRow===E.endRow&&E.startCol===E.endCol;Be=U||!E?0:E.startRow,Ve=U||!E?e.rowCount-1:E.endRow}let He=-1,Ce=-1;for(let E=Be;E<=Ve;E++){let U=!1;for(let ne=_;ne<=z;ne++)if(e.getCellRaw(ne,E).trim()!==""){U=!0;break}U&&(He<0&&(He=E),Ce=E)}if(He<0)return null;const Oe=[];for(let E=He;E<=Ce;E++){const U=e.getCellRaw(ye,E);Oe.push(Ja(U,C(ye,E),e.locale.value))}const be=dp(Oe)?He+1:He;let Je=!1;for(let E=He;E<=Ce&&!Je;E++)for(let U=_;U<=z;U++){const ne=e.cells[e.cellKey(U,E)];if(ne&&ne.value.startsWith("=")){Je=!0;break}}if(!Je)for(const E in e.merges){const U=e.merges[E];if(U&&U.startCol<=z&&U.endCol>=_&&U.startRow<=Ve&&U.endRow>=Be){Je=!0;break}}return{firstRow:He,lastRow:Ce,sortStart:be,blocked:Je}}function F(_,z){const G=R(_,z);return!!G&&!G.blocked&&G.sortStart<G.lastRow}function Q(_,z,G){var ke,Ne;const ye=z??e.selection.value;if(!ye)return;const Be=ye.startCol,Ve=ye.endCol,He=G??Be,Ce=R(Be,Ve,{startRow:ye.startRow,endRow:ye.endRow},He);if(!Ce||Ce.blocked||Ce.sortStart>=Ce.lastRow)return;const Oe=Ve-Be+1,be=Ce.lastRow-Ce.sortStart+1,Je=[],E=[];for(let M=Ce.sortStart;M<=Ce.lastRow;M++){const p=new Array(Oe);for(let ot=Be;ot<=Ve;ot++)p[ot-Be]=e.cells[e.cellKey(ot,M)]??null;Je.push(p);const S=e.getCellRaw(He,M);E.push(Ja(S,C(He,M),e.locale.value))}const U=cp(E,_,e.locale.value);let ne=!1;for(let M=0;M<be;M++)if(U[M]!==M){ne=!0;break}if(ne){o.saveUndo();for(let M=0;M<be;M++){const p=Je[U[M]],S=Ce.sortStart+M;for(let ot=Be;ot<=Ve;ot++){const mt=e.cellKey(ot,S),Ot=p[ot-Be],xt=Ot?Ot.value:"",Tt=(ke=e.cells[mt])==null?void 0:ke.styleId;xt!==""||Tt!==void 0?e.cells[mt]={value:xt,styleId:Tt}:e.delCell(mt)}}Cl();for(let M=Ce.sortStart;M<=Ce.lastRow;M++)for(let p=Be;p<=Ve;p++)e.formulaDeps.markDirty(e.cellKey(p,M));(Ne=e.scheduleRender)==null||Ne.call(e),fe()}}const K=t.ref(!1),Ee=t.ref(null);function ee(_){const z=e.selection.value;if(!z||!B(z))return!1;const G=h(z);return Ee.value={order:_,originalRange:z,expandedRange:G},K.value=!0,!0}function pe(_){const z=Ee.value;if(!z)return;const{order:G,originalRange:ye,expandedRange:Be}=z;K.value=!1,Ee.value=null,Q(G,_?Be:ye,ye.startCol),se.value=G}function ie(){K.value=!1,Ee.value=null}const me=t.ref(!1),se=t.ref("asc");function Se(_){me.value=_,_&&(o.textColorMenuOpen.value=!1,o.fillColorMenuOpen.value=!1,o.fontSizeMenuOpen.value=!1)}function Xe(_){ee(_)||(se.value=_,Q(_))}function Qe(){ee(se.value)||Q(se.value)}function X(_){Object.keys(e.merges).forEach(z=>Reflect.deleteProperty(e.merges,z));for(const z of _)if(!(z.newRange.startCol>z.newRange.endCol||z.newRange.startRow>z.newRange.endRow)&&(e.merges[z.newAnchorKey]={...z.newRange},z.anchorCell)){const G=z.anchorCell.value,ye=z.anchorCell.styleId;G===""&&!ye||(e.cells[z.newAnchorKey]={value:G,styleId:ye||void 0})}}function rt(_,z){const G=z-_+1,ye=[];for(const Be in e.merges){const Ve=e.merges[Be];if(!Ve)continue;const He=e.cells[Be]?{value:e.cells[Be].value,styleId:e.cells[Be].styleId??0}:{value:"",styleId:0},{startCol:Ce,endCol:Oe}=Ve;let{startRow:be,endRow:Je}=Ve;if(be>z){be-=G,Je-=G,ye.push({newAnchorKey:e.cellKey(Ce,be),newRange:{startCol:Ce,startRow:be,endCol:Oe,endRow:Je}});continue}if(Je<_){ye.push({newAnchorKey:Be,newRange:{startCol:Ce,startRow:be,endCol:Oe,endRow:Je}});continue}if(be>=_&&Je<=z||(be>=_&&be<=z&&(be=_),Je>=_&&Je<=z?Je=_-1:Je>z&&(Je-=G),be>Je))continue;const E=Ce,U=be,ne=e.cellKey(E,U),Ne=Be.split(",").map(Number)[1],M=Ne>=_&&Ne<=z||E!==Ve.startCol||U!==Ne;ye.push({newAnchorKey:ne,newRange:{startCol:Ce,startRow:be,endCol:Oe,endRow:Je},anchorCell:M?He:void 0})}return ye}function O(_,z){const G=z-_+1,ye=[];for(const Be in e.merges){const Ve=e.merges[Be];if(!Ve)continue;const He=e.cells[Be]?{value:e.cells[Be].value,styleId:e.cells[Be].styleId??0}:{value:"",styleId:0};let{startCol:Ce,endCol:Oe}=Ve;const{startRow:be,endRow:Je}=Ve;if(Ce>z){Ce-=G,Oe-=G,ye.push({newAnchorKey:e.cellKey(Ce,be),newRange:{startCol:Ce,startRow:be,endCol:Oe,endRow:Je}});continue}if(Oe<_){ye.push({newAnchorKey:Be,newRange:{startCol:Ce,startRow:be,endCol:Oe,endRow:Je}});continue}if(Ce>=_&&Oe<=z||(Ce>=_&&Ce<=z&&(Ce=_),Oe>=_&&Oe<=z?Oe=_-1:Oe>z&&(Oe-=G),Ce>Oe))continue;const E=Ce,U=be,ne=e.cellKey(E,U),Ne=Be.split(",").map(Number)[0],M=Ne>=_&&Ne<=z||E!==Ne||U!==Ve.startRow;ye.push({newAnchorKey:ne,newRange:{startCol:Ce,startRow:be,endCol:Oe,endRow:Je},anchorCell:M?He:void 0})}return ye}function I(_,z){const G=z-_+1,ye=[];for(const Be in e.merges){const Ve=e.merges[Be];if(!Ve)continue;const{startCol:He,endCol:Ce}=Ve;let{startRow:Oe,endRow:be}=Ve;be<_?ye.push({newAnchorKey:Be,newRange:{startCol:He,startRow:Oe,endCol:Ce,endRow:be}}):Oe<_?(be+=G,ye.push({newAnchorKey:Be,newRange:{startCol:He,startRow:Oe,endCol:Ce,endRow:be}})):(Oe+=G,be+=G,ye.push({newAnchorKey:e.cellKey(He,Oe),newRange:{startCol:He,startRow:Oe,endCol:Ce,endRow:be}}))}return ye}function j(_,z){const G=z-_+1,ye=[];for(const Be in e.merges){const Ve=e.merges[Be];if(!Ve)continue;let{startCol:He,endCol:Ce}=Ve;const{startRow:Oe,endRow:be}=Ve;Ce<_?ye.push({newAnchorKey:Be,newRange:{startCol:He,startRow:Oe,endCol:Ce,endRow:be}}):He<_?(Ce+=G,ye.push({newAnchorKey:Be,newRange:{startCol:He,startRow:Oe,endCol:Ce,endRow:be}})):(He+=G,Ce+=G,ye.push({newAnchorKey:e.cellKey(He,Oe),newRange:{startCol:He,startRow:Oe,endCol:Ce,endRow:be}}))}return ye}let we=0;function ze(){return we++,`s_${we}`}function le(_){if(!Array.isArray(_))return[];const z=[];for(const G of _){if(!G||typeof G!="object")continue;const ye=G;if(!ye.type||!Array.isArray(ye.ranges)||ye.ranges.length===0)continue;const Be=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)}));Be.length&&z.push({...ye,id:ye.id||`dv_${z.length}`,ranges:Be})}return z}function xe(_,z){const G=Math.max(1,(z==null?void 0:z.colCount)??e.colCount),ye=Math.max(1,(z==null?void 0:z.rowCount)??e.rowCount),Be=new Array(G).fill(100),Ve=new Array(ye).fill(void 0);return{id:ze(),name:_,cells:{},merges:{},styles:[{}],borders:[{}],selection:{startCol:0,startRow:0,endCol:0,endRow:0},activeCell:{col:0,row:0},scrollX:0,scrollY:0,colWidths:Be,rowHeights:Ve,colCount:G,rowCount:ye,freeze:{rows:0,cols:0},filter:null,conditionalFormats:[],dataValidations:[],rowOutlines:[],columnOutlines:[],notes:{}}}const ce=t.ref([xe("Sheet1")]),Fe=t.ref(0);function V(){const _=ce.value[Fe.value];if(!_)return;_.cells={...e.cells},_.merges={...e.merges},_.selection=e.selection.value?{...e.selection.value}:null,_.activeCell={...e.activeCell.value},_.scrollX=e.scrollX.value,_.scrollY=e.scrollY.value,_.colWidths=[...e.colWidths.value],_.rowHeights=[...e.rowHeights.value],_.styles=[...e.styles],_.borders=[...e.borders],_.colCount=e.colCount,_.rowCount=e.rowCount,_.freeze={rows:e.freeze.rows,cols:e.freeze.cols},_.filter=Mr(e.getFilter()),_.conditionalFormats=[...e.conditionalFormats],_.dataValidations=[...e.dataValidations];const z=Object.entries(e.notes).map(([G,ye])=>[G,{...ye}]);_.notes=Object.fromEntries(z),_.rowOutlines=e.getRowOutlines(),_.columnOutlines=e.getColumnOutlines()}function J(_){var Je,E,U;const z=ce.value[_];if(!z)return;Object.keys(e.cells).forEach(ne=>e.delCell(ne)),Object.assign(e.cells,z.cells),Object.keys(e.merges).forEach(ne=>Reflect.deleteProperty(e.merges,ne)),z.merges&&Object.assign(e.merges,z.merges),e.selection.value=z.selection?{...z.selection}:null,e.activeCell.value={...z.activeCell};const G=e.activeCell.value,ye=e.selection.value,Be=e.findMerge(G.col,G.row);Be&&Be.anchor===e.cellKey(G.col,G.row)&&(!ye||ye.startCol===G.col&&ye.startRow===G.row&&ye.endCol===G.col&&ye.endRow===G.row)&&e.selectCell(G.col,G.row),e.scrollX.value=z.scrollX,e.scrollY.value=z.scrollY,e.colWidths.value=[...z.colWidths],e.rowHeights.value=[...z.rowHeights];const Ve=Math.max(1,z.colCount??e.colCount),He=Math.max(1,z.rowCount??e.rowCount);if((Je=e.setDims)==null||Je.call(e,Ve,He),e.freeze.rows=Math.max(0,Math.min(z.freeze.rows,e.rowCount)),e.freeze.cols=Math.max(0,Math.min(z.freeze.cols,e.colCount)),z.filter){const ne=z.filter.range;e.setFilter({range:{startCol:Math.max(0,Math.min(ne.startCol,e.colCount-1)),endCol:Math.max(0,Math.min(ne.endCol,e.colCount-1)),startRow:Math.max(0,Math.min(ne.startRow,e.rowCount-1)),endRow:Math.max(0,Math.min(ne.endRow,e.rowCount-1))},columns:{...z.filter.columns}},!0)}else e.setFilter(null,!0);e.syncStyles(z.styles),e.syncBorders(z.borders??[{}]);const Ce=z.conditionalFormats?z.conditionalFormats.map(ne=>({...ne,ranges:ne.ranges.map(ke=>({...ke}))})):[];e.conditionalFormats.splice(0,e.conditionalFormats.length,...Ce),(E=e.invalidateConditionalFormatCache)==null||E.call(e);const Oe=le(z.dataValidations);e.dataValidations.splice(0,e.dataValidations.length,...Oe),(U=e.invalidateDataValidationCache)==null||U.call(e);const be=Fa(z.notes);Object.keys(e.notes).forEach(ne=>{e.notes[ne]=void 0}),Object.assign(e.notes,be),e.syncOutlines(z.rowOutlines,z.columnOutlines),Fe.value=_}function re(_){_===Fe.value||_<0||_>=ce.value.length||(e.cancelEdit(),V(),J(_))}function ae(_){return o.saveUndo(),e.cancelEdit(),V(),ce.value.push(xe(_??`Sheet${ce.value.length+1}`)),J(ce.value.length-1),ce.value.length-1}function oe(_){return ce.value.length<=1||(o.saveUndo(),e.cancelEdit(),ce.value.splice(_,1),J(Math.min(_,ce.value.length-1))),Fe.value}function ve(_,z){ce.value[_]&&z.trim()&&(o.saveUndo(),ce.value[_].name=z.trim())}function Me(_){o.saveUndo(),e.cancelEdit(),V();const z=ce.value[_];if(!z)return _;let G=z.name;const ye=G.match(/^(.*?)\s*\((\d+)\)$/);let Be=ye?parseInt(ye[2],10)+1:2;ye&&(G=ye[1]);let Ve=`${G} (${Be})`;const He=new Set(ce.value.map(Oe=>Oe.name));for(;He.has(Ve);)Be++,Ve=`${G} (${Be})`;const Ce={id:ze(),name:Ve,cells:{...z.cells},merges:z.merges?{...z.merges}:{},styles:[...z.styles],borders:z.borders?[...z.borders]:[{}],selection:z.selection?{...z.selection}:null,activeCell:z.activeCell?{...z.activeCell}:{col:0,row:0},scrollX:z.scrollX,scrollY:z.scrollY,colWidths:[...z.colWidths],rowHeights:[...z.rowHeights],colCount:z.colCount,rowCount:z.rowCount,freeze:{...z.freeze},filter:Mr(z.filter),conditionalFormats:z.conditionalFormats?z.conditionalFormats.map(Oe=>({...Oe})):[],dataValidations:le(z.dataValidations),rowOutlines:z.rowOutlines?z.rowOutlines.map(Oe=>({...Oe})):[],columnOutlines:z.columnOutlines?z.columnOutlines.map(Oe=>({...Oe})):[],notes:Fa(z.notes)};return ce.value.splice(_+1,0,Ce),J(_+1),_+1}function q(_,z){var Ve;const G=_+z;if(G<0||G>=ce.value.length)return;o.saveUndo();const ye=Fe.value,Be=ce.value.splice(_,1)[0];ce.value.splice(G,0,Be),ye===_?Fe.value=G:_<ye&&G>=ye?Fe.value=ye-1:_>ye&&G<=ye&&(Fe.value=ye+1),(Ve=e.scheduleRender)==null||Ve.call(e)}const $=t.computed(()=>ce.value.length);let Y="";const W=n;function fe(){V();const _=ce.value.map(G=>{const ye={};for(const[Ce,Oe]of Object.entries(G.cells))ye[Ce]={value:Oe.value},Oe.styleId&&Oe.styleId>0&&(ye[Ce].styleId=Oe.styleId),Oe.noteId&&(ye[Ce].noteId=Oe.noteId);const Be={name:G.name,cells:ye};G.styles&&G.styles.length>1&&(Be.styles=[...G.styles]),G.borders&&G.borders.length>1&&(Be.borders=[...G.borders]),G.merges&&Object.keys(G.merges).length&&(Be.merges={...G.merges});const Ve={};for(let Ce=0;Ce<G.colWidths.length;Ce++)G.colWidths[Ce]!==100&&(Ve[Ce]=G.colWidths[Ce]);Object.keys(Ve).length&&(Be.colWidths=Ve);const He={};for(let Ce=0;Ce<G.rowHeights.length;Ce++){const Oe=G.rowHeights[Ce];Oe!=null&&(He[Ce]=Oe)}return Object.keys(He).length&&(Be.rowHeights=He),G.colCount!==26&&(Be.colCount=G.colCount),G.rowCount!==200&&(Be.rowCount=G.rowCount),(G.freeze.rows!==0||G.freeze.cols!==0)&&(Be.freeze={rows:G.freeze.rows,cols:G.freeze.cols}),G.filter&&(Be.filter=Mr(G.filter)),G.conditionalFormats&&G.conditionalFormats.length&&(Be.conditionalFormats=G.conditionalFormats.map(Ce=>({...Ce}))),G.dataValidations&&G.dataValidations.length&&(Be.dataValidations=G.dataValidations.map(Ce=>({...Ce,ranges:Ce.ranges.map(Oe=>({...Oe}))}))),G.notes&&Object.keys(G.notes).length&&(Be.notes=Object.fromEntries(Object.entries(G.notes).map(([Ce,Oe])=>[Ce,{...Oe}]))),G.rowOutlines&&G.rowOutlines.length&&(Be.rowOutlines=G.rowOutlines.map(Ce=>({...Ce}))),G.columnOutlines&&G.columnOutlines.length&&(Be.columnOutlines=G.columnOutlines.map(Ce=>({...Ce}))),Be}),z=JSON.stringify(_);z!==Y&&(Y=z,W.value=_,a&&(a.value=z))}e.emitModelData=fe;let Ae=!1;function Re(){Ae||(Ae=!0,Promise.resolve().then(()=>{Ae=!1,fe()}))}const _e=t.computed(()=>e.props.theme==="dark"?Ei:ki),Ge=t.computed(()=>ip(_e.value,e.props.width,e.props.height,Bl)),Le=t.computed(()=>{const _={};for(const[z,G]of Object.entries(Ge.value))z.startsWith("--")&&(_[z]=G);return _}),ht=t.ref(null),bt=t.ref(null),je=t.ref(null),Bt=t.ref(null),Yt=t.ref(null),Vt=t.reactive({w:800,h:600});e.viewSize&&t.watch(Vt,_=>{e.viewSize&&(e.viewSize.w=_.w,e.viewSize.h=_.h)},{deep:!0});const zt=48,et=28,N=11,te=()=>zt+e.getOutlineGutterSize("row"),vt=()=>et+e.getOutlineGutterSize("column"),It=t.computed(()=>Math.max(0,e.totalWidth.value-Math.max(0,Vt.w-te()-N))),Et=t.computed(()=>Math.max(0,e.totalHeight.value-Math.max(0,Vt.h-vt()-N)));function Sn(_,z){const G=Math.max(0,Vt.w-te()-N),ye=Math.max(0,Vt.h-vt()-N),Be=_??e.scrollX.value,Ve=z??e.scrollY.value,He=40,Ce=Math.max(0,e.totalWidth.value-G),Oe=Math.max(0,e.totalHeight.value-ye);if(Be>=Ce-He&&Be>e.scrollX.value||Ve>=Oe-He&&Ve>e.scrollY.value){const be=Math.max(0,Math.ceil((Be+G)/100)+2),Je=Math.max(0,Math.ceil((Ve+ye)/24)+2);e.ensureCapacity(be,Je)}e.scrollX.value=Math.max(0,Math.min(Be,Math.max(0,e.totalWidth.value-G))),e.scrollY.value=Math.max(0,Math.min(Ve,Math.max(0,e.totalHeight.value-ye)))}e.clampScroll=Sn;function en(){var _;return typeof window>"u"?!1:!((_=window.matchMedia)!=null&&_.call(window,"(hover: none) and (pointer: coarse)").matches)}function Xt(_=!1){t.nextTick(()=>{const z=Bt.value;if(z){if(!e.editingCell.value&&!en()){document.activeElement===z&&z.blur();return}z.focus({preventScroll:!0}),_&&z.select()}})}function Zt(){Xt()}function Mn(){var z;const _=e.selection.value;if(_){o.saveUndo();for(let G=_.startRow;G<=_.endRow;G++)e.rowHeights.value[G]=void 0;(z=e.scheduleRender)==null||z.call(e),fe()}}function Nn(){var z;const _=e.selection.value;if(_){o.saveUndo();for(let G=_.startCol;G<=_.endCol;G++)e.colWidths.value[G]=100;(z=e.scheduleRender)==null||z.call(e),fe()}}return{deleteRows:i,insertRows:r,insertCols:c,deleteCols:d,sortSelectedColumns:Q,canSortColumns:F,sortMenuOpen:me,cachedSortOrder:se,onSortMenuToggle:Se,onSortChange:Xe,applyCachedSort:Qe,sortConfirmOpen:K,prepareSortConfirmation:ee,confirmSort:pe,cancelSortConfirmation:ie,sheets:ce,activeSheetIndex:Fe,saveSheet:V,loadSheet:J,switchSheet:re,addSheet:ae,removeSheet:oe,renameSheet:ve,dupSheet:Me,moveSheet:q,sheetCount:$,mkSheet:xe,emitModelData:fe,scheduleOptEmit:Re,themeColors:_e,outerStyle:Ge,toolbarThemeVars:Le,wrapperRef:ht,canvasRef:bt,freezeCanvasRef:je,editInputRef:Bt,formulaBarRef:Yt,viewSize:Vt,maxScrollX:It,maxScrollY:Et,clampScroll:Sn,canFocusHiddenEditor:en,focusEditInput:Xt,onCanvasFocus:Zt,resetRowHeight:Mn,resetColWidth:Nn,modelData:W}}function ri(e){return!!e&&e.width!==void 0&&e.width>0}function Pt(e,o,n,l){const a=ri(e),i=ri(o);if(!a&&!i)return;if(a&&!i)return e;if(!a&&i)return o;const r=e.width??0,c=o.width??0;return r>c?e:c>r?o:e}function ai(e,o){if(!e||typeof e!="object")return null;const n=e,l=n.columns??{},a=Object.keys(l).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 d=0;for(const b in o){const C=b.indexOf(",");if(C<0)continue;const v=parseInt(b.substring(C+1),10);v>d&&(d=v)}return{range:{startCol:r,startRow:0,endCol:c,endRow:Math.max(0,d)},columns:l}}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:l}}function gp(e,o,n,l,a){let i=!1,r=null,c=1,d,b=()=>{},C=()=>{},v=()=>{};function h(){i||(i=!0,requestAnimationFrame(()=>{i=!1,rt(),O()}))}e.scheduleRender=h;function B(u){const{frozenColumnsWidth:y}=e.getFrozenMetrics(),x=y>0&&u<se()+y?u-se():u-se()+e.scrollX.value;return e.hitCol(x)}function R(u){const{frozenRowsHeight:y}=e.getFrozenMetrics(),x=y>0&&u<Se()+y?u-Se():u-Se()+e.scrollY.value;return e.hitRow(x)}const F="#444",Q=14,K=9,Ee=16,ee=Math.min(K-1,9);function pe(u){return 0}const ie=()=>pe(),me=()=>pe(),se=()=>52+ie(),Se=()=>24+me();function Xe(u,y){return Ee+2+(y-u.level)*K}function Qe(u,y){return 3+(y-u.level)*K}function X(u,y){const x=new Int8Array(y).fill(-1);if(!u.length)return x;const H=[...u].sort((P,Z)=>P.start-Z.start),D=new Map;H.forEach((P,Z)=>D.set(P.id,Z%2));for(const P of H){const Z=D.get(P.id),g=Math.min(P.end,y-1);for(let s=Math.max(0,P.start);s<=g;s++)x[s]===-1&&(x[s]=Z)}return x}function rt(){const u=l.wrapperRef.value,y=l.canvasRef.value;if(!u||!y||(r=y.getContext("2d"),!r))return;c=window.devicePixelRatio||1;const x=u.getBoundingClientRect(),H=x.width,D=x.height;l.viewSize.w=H,l.viewSize.h=D,y.width=H*c,y.height=D*c,y.style.width=H+"px",y.style.height=D+"px",r.setTransform(c,0,0,c,0,0);const P=e.scrollX.value,Z=e.scrollY.value,g=52,s=24,f=ie(),m=me(),k=g+f,T=s+m,L=l.themeColors.value,de=e.getFilter(),ue=e.colPositions.value,he=e.rowPositions.value,We=X(e.getRowOutlines(),e.rowCount),$e=X(e.getColumnOutlines(),e.colCount),{frozenRowsHeight:Pe,frozenColumnsWidth:qe}=e.getFrozenMetrics(),ft=k+qe,yt=T+Pe,Jt=Math.max(0,H-k-11-qe),_t=Math.max(0,D-T-11-Pe),un=Math.max(0,e.freeze.cols-1),Qt=Math.max(0,e.freeze.rows-1),Ht=Math.max(e.freeze.cols,e.hitCol(qe+P));let yn=Ht;for(let A=Ht;A<e.colCount&&!(k+ue[A]-P>=H);A++)yn=A;const rn=Math.max(e.freeze.rows,e.hitRow(Pe+Z));let Cn=rn;for(let A=rn;A<e.rowCount&&!(T+he[A]-Z>=D);A++)Cn=A;let Hn=Ht,Fn=yn,Al=rn,In=Cn;qe>0&&(Hn=0,Fn=Math.max(Fn,un)),Pe>0&&(Al=0,In=Math.max(In,Qt));let Ll=Hn,Wn=Al;for(const A in e.merges){const Ie=e.merges[A];Ie&&(Ie.startRow>In||Ie.endRow<Al||Ie.startCol>Fn||Ie.endCol<Hn||(Ie.startCol<Ll&&(Ll=Ie.startCol),Ie.startRow<Wn&&(Wn=Ie.startRow)))}const $l=new Array(Wn);for(let A=Wn;A<=In;A++)$l[A]=he[A+1]-he[A];r.fillStyle=L.bg,r.fillRect(0,0,H,D),r.fillStyle=L.gridBg,r.fillRect(k,T,H-k,D-T);const Rt=e.selection.value,ct=e.editingCell.value;b=(A,Ie,Ke,gt,Ft,jt)=>{const wt=e.dataValidations.length>0;for(let Te=gt;Te<=Ft;Te++)if(!e.isRowCollapsed(Te))for(let Ue=Ie;Ue<=Ke;Ue++){if(e.isColumnCollapsed(Ue)||e.findMerge(Ue,Te))continue;const tt=e.cellToScreenRect(Te,Ue),Ye=tt.x,dt=tt.y,it=tt.width,nt=tt.height;if(Ye+it<k||dt+nt<T||Ye>H||dt>D)continue;const $t=e.findHighlight?e.findHighlight(Ue,Te):null,Wt=e.resolveStyle(e.cells[e.cellKey(Ue,Te)]),Nt=typeof(Wt==null?void 0:Wt.backgroundColor)=="string"?Wt.backgroundColor:"";Nt&&(A.fillStyle=Nt,A.fillRect(Ye,dt,it,nt));const st=e.resolveConditionalFormat(Ue,Te);if(st!=null&&st.backgroundColor&&(A.fillStyle=st.backgroundColor,A.fillRect(Ye,dt,it,nt)),$t&&(A.fillStyle=$t==="active"?L.findActiveBg:L.findMatchBg,A.fillRect(Ye,dt,it,nt)),e.isSelected(Ue,Te)&&(A.fillStyle=L.selectionBg,e.selectionMode.value==="row"||e.selectionMode.value==="col"?A.fillRect(Ye,dt,(ue[Ue+1]??0)-ue[Ue],jt[Te]):A.fillRect(Ye,dt,it,nt)),e.activeCell.value.col===Ue&&e.activeCell.value.row===Te&&(A.strokeStyle=L.activeCellBorder,A.lineWidth=2,A.strokeRect(Ye+1,dt+1,it-2,nt-2)),$t==="active"&&(A.strokeStyle=L.findActiveBg,A.lineWidth=2,A.strokeRect(Ye+1,dt+1,it-2,nt-2)),A.strokeStyle=L.gridLine,A.lineWidth=.5,A.strokeRect(Ye+.25,dt+.25,it-.5,nt-.5),!(ct&&ct.col===Ue&&ct.row===Te)){const De=e.resolveStyle(e.cells[e.cellKey(Ue,Te)]),ge=e.getCellValue(Ue,Te),lt=typeof(De==null?void 0:De.numberFormat)=="string"?De.numberFormat:"",Ze=ge?An(ge,lt,e.locale.value):"";if(Ze){const pt=e.cellFontSize(Ue,Te),kt=typeof(De==null?void 0:De.fontFamily)=="string"&&De.fontFamily?De.fontFamily:Nl,Ut=(De==null?void 0:De.fontWeight)==="bold"||(st==null?void 0:st.fontWeight)==="bold"?"bold":"normal",fn=(De==null?void 0:De.fontStyle)==="italic"||(st==null?void 0:st.fontStyle)==="italic"?"italic":"normal",Kn=(De==null?void 0:De.underline)==="underline"||(st==null?void 0:st.underline)==="underline",el=(De==null?void 0:De.strikethrough)==="line-through"||(st==null?void 0:st.strikethrough)==="line-through",mn=(st==null?void 0:st.color)||(typeof(De==null?void 0:De.color)=="string"?De.color:""),On=typeof(De==null?void 0:De.textAlign)=="string"?De.textAlign:sr(ge,lt)?"right":"left",pn=typeof(De==null?void 0:De.verticalAlign)=="string"?De.verticalAlign:"top";A.fillStyle=mn||L.cellText,A.font=`${fn} ${Ut} ${pt}px ${kt}`,A.textBaseline="alphabetic",A.save(),A.beginPath(),A.rect(Ye+5,dt+1,it-10,nt-2),A.clip();const tl=(De==null?void 0:De.wrap)==="wrap";let nn=it-10;de&&Te===de.range.startRow&&Ue>=de.range.startCol&&Ue<=de.range.endCol&&(nn=it-10-It);let wn=Ze;const vn=!tl&&na(lt),Gn=Ze===xo||la(ge,lt);if(Gn||vn){if(Gn){const _l=Math.max(1,A.measureText("#").width),Bo=Math.max(1,Math.floor(nn/_l));wn="#".repeat(Bo)}else if(e.getWrappedLines(A,Ze,1e9,!1).some(gl=>gl&&A.measureText(gl).width>nn)){const gl=Math.max(1,A.measureText("#").width),oo=Math.max(1,Math.floor(nn/gl));wn="#".repeat(oo)}}const an=e.getWrappedLines(A,wn,nn,tl),{ascent:hl,descent:lo}=e.measureFontMetrics(kt,pt,Ut,fn),tr=hl+lo,Hp=an.length*tr;let nr;pn==="middle"?nr=dt+(nt-Hp)/2+hl:pn==="bottom"?nr=dt+nt-e.BASE_CELL_VPAD-lo-(an.length-1)*tr:nr=dt+e.BASE_CELL_VPAD+hl;for(let _l=0;_l<an.length;_l++){const Bo=an[_l],gl=nr+_l*tr,oo=A.measureText(Bo);let Ml;if(On==="center"?Ml=Ye+it/2-oo.width/2:On==="right"?Ml=Ye+it-5-oo.width:Ml=Ye+5,A.fillText(Bo,Ml,gl),Kn&&(A.strokeStyle=mn||L.cellText,A.lineWidth=1,A.beginPath(),A.moveTo(Ml,gl+lo+1),A.lineTo(Ml+oo.width,gl+lo+1),A.stroke()),el){A.strokeStyle=mn||L.cellText,A.lineWidth=1;const ci=gl-hl+tr*.42;A.beginPath(),A.moveTo(Ml,ci),A.lineTo(Ml+oo.width,ci),A.stroke()}}A.restore()}}if(de&&Te===de.range.startRow&&Ue>=de.range.startCol&&Ue<=de.range.endCol&&ye(A,Ye,dt,it,nt,va(de.columns[Ue]),L),wt&&e.getListValidation(Te,Ue)){const De=e.activeCell.value.col===Ue&&e.activeCell.value.row===Te;Zt(A,Ye,dt,it,nt,De||e.isSelected(Ue,Te),L)}e.hasNote(Te,Ue)&&Mn(A,Ye,dt,it,nt)}};const Ct=(A,Ie,Ke)=>{const gt=e.findMerge(A,Ie);return gt?e.getCellBorderSide(e.cells[gt.anchor],Ke):e.getCellBorderSide(e.cells[e.cellKey(A,Ie)],Ke)};C=(A,Ie,Ke,gt,Ft,jt)=>{A.fillStyle=F;for(let wt=gt;wt<=Ft;wt++)if(!e.isRowCollapsed(wt))for(let Te=Ie;Te<=Ke;Te++){if(e.isColumnCollapsed(Te)||e.findMerge(Te,wt))continue;const at=e.cellToScreenRect(wt,Te),tt=at.x,Ye=at.y,dt=at.width,it=at.height;if(tt+dt<k||Ye+it<T||tt>H||Ye>D)continue;const nt=e.cells[e.cellKey(Te,wt)],$t={top:e.getCellBorderSide(nt,"top"),right:e.getCellBorderSide(nt,"right"),bottom:e.getCellBorderSide(nt,"bottom"),left:e.getCellBorderSide(nt,"left")},Wt={top:Ct(Te,wt-1,"bottom"),left:Ct(Te-1,wt,"right"),bottom:Ct(Te,wt+1,"top"),right:Ct(Te+1,wt,"left")},Nt=Pt(Wt.top,$t.top),st=Pt(Wt.left,$t.left),De=Pt($t.bottom,Wt.bottom),ge=Pt($t.right,Wt.right),lt=(Nt==null?void 0:Nt.width)??0,Ze=(st==null?void 0:st.width)??0,pt=(De==null?void 0:De.width)??0,kt=(ge==null?void 0:ge.width)??0;lt>0&&(A.fillStyle=(Nt==null?void 0:Nt.color)||F,A.fillRect(tt,Ye,dt,lt)),pt>0&&(A.fillStyle=(De==null?void 0:De.color)||F,A.fillRect(tt,Ye+it-pt,dt,pt)),Ze>0&&(A.fillStyle=(st==null?void 0:st.color)||F,A.fillRect(tt,Ye,Ze,it)),kt>0&&(A.fillStyle=(ge==null?void 0:ge.color)||F,A.fillRect(tt+dt-kt,Ye,kt,it));const Ut=Te>0&&e.isColumnCollapsed(Te-1),fn=Te<e.colCount-1&&e.isColumnCollapsed(Te+1),Kn=wt>0&&e.isRowCollapsed(wt-1),el=wt<e.rowCount-1&&e.isRowCollapsed(wt+1),mn=Te<e.freeze.cols&&(()=>{try{const pn=A.canvas;return pn?String(pn.className||"")==="grid-canvas":!1}catch{return!1}})(),On=wt<e.freeze.rows&&(()=>{try{const pn=A.canvas;return pn?String(pn.className||"")==="grid-canvas":!1}catch{return!1}})();lt>0&&Ze>0&&!Ut&&!Kn&&(A.fillStyle=(Nt==null?void 0:Nt.color)||(st==null?void 0:st.color)||F,A.fillRect(tt-Ze,Ye-lt,Ze,lt)),lt>0&&kt>0&&!fn&&!Kn&&!mn&&(A.fillStyle=(Nt==null?void 0:Nt.color)||(ge==null?void 0:ge.color)||F,A.fillRect(tt+dt,Ye-lt,kt,lt)),pt>0&&Ze>0&&!Ut&&!el&&!On&&(A.fillStyle=(De==null?void 0:De.color)||(st==null?void 0:st.color)||F,A.fillRect(tt-Ze,Ye+it,Ze,pt)),pt>0&&kt>0&&!fn&&!el&&!mn&&!On&&(A.fillStyle=(De==null?void 0:De.color)||(ge==null?void 0:ge.color)||F,A.fillRect(tt+dt,Ye+it,kt,pt))}};const Un=(A,Ie,Ke,gt,Ft,jt,wt)=>{const Te=e.resolveStyle(e.cells[e.cellKey(Ie,Ke)]),Ue=e.getCellValue(Ie,Ke),at=typeof(Te==null?void 0:Te.numberFormat)=="string"?Te.numberFormat:"",tt=Ue?An(Ue,at,e.locale.value):"";if(!tt||gt-10<=0||Ft-2<=0)return;const dt=e.cellFontSize(Ie,Ke),it=typeof(Te==null?void 0:Te.fontFamily)=="string"&&Te.fontFamily?Te.fontFamily:Nl,nt=e.resolveConditionalFormat(Ie,Ke),$t=(Te==null?void 0:Te.fontWeight)==="bold"||(nt==null?void 0:nt.fontWeight)==="bold"?"bold":"normal",Wt=(Te==null?void 0:Te.fontStyle)==="italic"||(nt==null?void 0:nt.fontStyle)==="italic"?"italic":"normal",Nt=(Te==null?void 0:Te.underline)==="underline"||(nt==null?void 0:nt.underline)==="underline",st=(Te==null?void 0:Te.strikethrough)==="line-through"||(nt==null?void 0:nt.strikethrough)==="line-through",De=(nt==null?void 0:nt.color)||(typeof(Te==null?void 0:Te.color)=="string"?Te.color:""),ge=typeof(Te==null?void 0:Te.textAlign)=="string"?Te.textAlign:sr(Ue,at)?"right":"left",lt=typeof(Te==null?void 0:Te.verticalAlign)=="string"?Te.verticalAlign:"top";A.fillStyle=De||L.cellText,A.font=`${Wt} ${$t} ${dt}px ${it}`,A.textBaseline="alphabetic",A.save(),A.beginPath(),A.rect(jt+5,wt+1,gt-10,Ft-2),A.clip();const Ze=(Te==null?void 0:Te.wrap)==="wrap",pt=gt-10;let kt=tt;const Ut=!Ze&&na(at),fn=tt===xo||la(Ue,at);if(fn||Ut){if(fn){const nn=Math.max(1,A.measureText("#").width),wn=Math.max(1,Math.floor(pt/nn));kt="#".repeat(wn)}else if(e.getWrappedLines(A,tt,1e9,!1).some(vn=>vn&&A.measureText(vn).width>pt)){const vn=Math.max(1,A.measureText("#").width),Gn=Math.max(1,Math.floor(pt/vn));kt="#".repeat(Gn)}}const Kn=e.getWrappedLines(A,kt,pt,Ze),{ascent:el,descent:mn}=e.measureFontMetrics(it,dt,$t,Wt),On=el+mn,pn=Kn.length*On;let tl;lt==="middle"?tl=wt+(Ft-pn)/2+el:lt==="bottom"?tl=wt+Ft-e.BASE_CELL_VPAD-mn-(Kn.length-1)*On:tl=wt+e.BASE_CELL_VPAD+el;for(let nn=0;nn<Kn.length;nn++){const wn=Kn[nn],vn=tl+nn*On,Gn=A.measureText(wn);let an;if(ge==="center"?an=jt+gt/2-Gn.width/2:ge==="right"?an=jt+gt-5-Gn.width:an=jt+5,A.fillText(wn,an,vn),Nt&&(A.strokeStyle=De||L.cellText,A.lineWidth=1,A.beginPath(),A.moveTo(an,vn+mn+1),A.lineTo(an+Gn.width,vn+mn+1),A.stroke()),st){A.strokeStyle=De||L.cellText,A.lineWidth=1;const hl=vn-el+On*.42;A.beginPath(),A.moveTo(an,hl),A.lineTo(an+Gn.width,hl),A.stroke()}}A.restore()},Pn=(A,Ie,Ke,gt,Ft,jt,wt,Te)=>{const Ue=Ie.startCol,at=Ie.endCol,tt=Ie.startRow,Ye=Ie.endRow,dt=gt,it=jt,nt=wt&&at+1===e.freeze.cols&&e.freeze.cols<e.colCount&&e.isColumnCollapsed(e.freeze.cols),$t=wt&&at>=e.freeze.cols||nt,Wt=Te&&Ye+1===e.freeze.rows&&e.freeze.rows<e.rowCount&&e.isRowCollapsed(e.freeze.rows),Nt=Te&&Ye>=e.freeze.rows||Wt,st=e.cells[e.cellKey(Ue,tt)],De={top:e.getCellBorderSide(st,"top"),right:e.getCellBorderSide(st,"right"),bottom:e.getCellBorderSide(st,"bottom"),left:e.getCellBorderSide(st,"left")};A.fillStyle=F;for(let ge=Ue;ge<=at;ge++){if(wt&&ge>=e.freeze.cols||e.isSameMergeInternal(ge,tt-1,ge,tt))continue;const lt=Ct(ge,tt-1,"bottom"),Ze=Pt(lt,De.top);if(Ze&&Ze.width&&Ze.width>0){const pt=ge<e.freeze.cols?g+ue[ge]:g+ue[ge]-P;A.fillStyle=Ze.color||F,A.fillRect(pt,dt,(ue[ge+1]??0)-ue[ge],Ze.width)}}if(!Nt)for(let ge=Ue;ge<=at;ge++){if(wt&&ge>=e.freeze.cols||e.isSameMergeInternal(ge,Ye,ge,Ye+1))continue;const lt=Ct(ge,Ye+1,"top"),Ze=Pt(De.bottom,lt);if(Ze&&Ze.width&&Ze.width>0){const pt=ge<e.freeze.cols?g+ue[ge]:g+ue[ge]-P;A.fillStyle=Ze.color||F,A.fillRect(pt,dt+it-Ze.width,(ue[ge+1]??0)-ue[ge],Ze.width)}}for(let ge=tt;ge<=Ye;ge++){if(Te&&ge>=e.freeze.rows||e.isSameMergeInternal(Ue-1,ge,Ue,ge))continue;const lt=Ct(Ue-1,ge,"right"),Ze=Pt(lt,De.left);if(Ze&&Ze.width&&Ze.width>0){const pt=ge<e.freeze.rows?s+he[ge]:s+he[ge]-Z,kt=he[ge+1]-he[ge];A.fillStyle=Ze.color||F,A.fillRect(Ke,pt,Ze.width,kt)}}if(!$t)for(let ge=tt;ge<=Ye;ge++){if(Te&&ge>=e.freeze.rows||e.isSameMergeInternal(at,ge,at+1,ge))continue;const lt=Ct(at+1,ge,"left"),Ze=Pt(De.right,lt);if(Ze&&Ze.width&&Ze.width>0){const pt=ge<e.freeze.rows?s+he[ge]:s+he[ge]-Z,kt=he[ge+1]-he[ge];A.fillStyle=Ze.color||F,A.fillRect(Ke+Ft-Ze.width,pt,Ze.width,kt)}}{const ge=e.isSameMergeInternal(Ue,tt-1,Ue,tt)?De.top:Pt(Ct(Ue,tt-1,"bottom"),De.top),lt=e.isSameMergeInternal(Ue-1,tt,Ue,tt)?De.left:Pt(Ct(Ue-1,tt,"right"),De.left),Ze=(ge==null?void 0:ge.width)??0,pt=(lt==null?void 0:lt.width)??0,kt=Ue>0&&e.isColumnCollapsed(Ue-1),Ut=tt>0&&e.isRowCollapsed(tt-1);Ze>0&&pt>0&&!kt&&!Ut&&(A.fillStyle=(ge==null?void 0:ge.color)||(lt==null?void 0:lt.color)||F,A.fillRect(Ke-pt,gt-Ze,pt,Ze))}if(!$t){const ge=e.isSameMergeInternal(at,tt-1,at,tt)?De.top:Pt(Ct(at,tt-1,"bottom"),De.top),lt=e.isSameMergeInternal(at,tt,at+1,tt)?De.right:Pt(De.right,Ct(at+1,tt,"left")),Ze=(ge==null?void 0:ge.width)??0,pt=(lt==null?void 0:lt.width)??0,kt=at<e.colCount-1&&e.isColumnCollapsed(at+1),Ut=tt>0&&e.isRowCollapsed(tt-1);Ze>0&&pt>0&&!kt&&!Ut&&(A.fillStyle=(ge==null?void 0:ge.color)||(lt==null?void 0:lt.color)||F,A.fillRect(Ke+Ft,gt-Ze,pt,Ze))}if(!Nt){const ge=e.isSameMergeInternal(Ue,Ye,Ue,Ye+1)?De.bottom:Pt(De.bottom,Ct(Ue,Ye+1,"top")),lt=e.isSameMergeInternal(Ue-1,Ye,Ue,Ye)?De.left:Pt(Ct(Ue-1,Ye,"right"),De.left),Ze=(ge==null?void 0:ge.width)??0,pt=(lt==null?void 0:lt.width)??0,kt=Ue>0&&e.isColumnCollapsed(Ue-1),Ut=Ye<e.rowCount-1&&e.isRowCollapsed(Ye+1);Ze>0&&pt>0&&!kt&&!Ut&&(A.fillStyle=(ge==null?void 0:ge.color)||(lt==null?void 0:lt.color)||F,A.fillRect(Ke-pt,gt+jt,pt,Ze))}if(!$t&&!Nt){const ge=e.isSameMergeInternal(at,Ye,at,Ye+1)?De.bottom:Pt(De.bottom,Ct(at,Ye+1,"top")),lt=e.isSameMergeInternal(at,Ye,at+1,Ye)?De.right:Pt(De.right,Ct(at+1,Ye,"left")),Ze=(ge==null?void 0:ge.width)??0,pt=(lt==null?void 0:lt.width)??0,kt=at<e.colCount-1&&e.isColumnCollapsed(at+1),Ut=Ye<e.rowCount-1&&e.isRowCollapsed(Ye+1);Ze>0&&pt>0&&!kt&&!Ut&&(A.fillStyle=(ge==null?void 0:ge.color)||(lt==null?void 0:lt.color)||F,A.fillRect(Ke+Ft,gt+jt,pt,Ze))}};v=(A,Ie,Ke,gt,Ft)=>{var at,tt;const jt=Ie+gt,wt=Ke+Ft,Te=Ie<ft,Ue=Ke<yt;for(const Ye in e.merges){const dt=e.merges[Ye];if(!dt)continue;const it=dt.startCol,nt=dt.startRow,$t=dt.endCol,Wt=dt.endRow,Nt=e.cellToScreenRect(nt,it),st=e.cellToScreenRect(Wt,$t),De=Nt.x,ge=Nt.y,lt=st.x+st.width-De,Ze=st.y+st.height-ge,pt=Te&&$t>=e.freeze.cols?Math.min(jt,ft):Math.min(De+lt,jt),kt=Ue&&Wt>=e.freeze.rows?Math.min(wt,yt):Math.min(ge+Ze,wt),Ut=Math.max(De,Ie),fn=Math.max(ge,Ke);if(pt<=Ut||kt<=fn)continue;const Kn=(at=e.resolveStyle(e.cells[e.cellKey(it,nt)]))==null?void 0:at.backgroundColor,mn=((tt=e.resolveConditionalFormat(it,nt))==null?void 0:tt.backgroundColor)||Kn;mn&&(A.fillStyle=mn,A.fillRect(Ut,fn,pt-Ut,kt-fn)),e.isSelected(it,nt)&&(A.fillStyle=L.selectionBg,A.fillRect(Ut,fn,pt-Ut,kt-fn)),A.strokeStyle=L.gridLine,A.lineWidth=.5;const On=De+.25,pn=ge+.25,tl=pt-De-.5,nn=kt-ge-.5;if(tl>0&&nn>0&&A.strokeRect(On,pn,tl,nn),Pn(A,dt,De,ge,lt,Ze,Te,Ue),e.activeCell.value.col===it&&e.activeCell.value.row===nt&&(A.strokeStyle=L.activeCellBorder,A.lineWidth=2,A.strokeRect(De+1,ge+1,lt-2,Ze-2)),e.getListValidation(nt,it)){const wn=e.activeCell.value.col===it&&e.activeCell.value.row===nt;Zt(A,De,ge,lt,Ze,wn,L)}if(e.hasNote(nt,it)&&Mn(A,De,ge,lt,Ze),!(e.editingCell.value&&e.editingCell.value.col===it&&e.editingCell.value.row===nt)){const wn=ue[$t+1]-ue[it],vn=he[Wt+1]-he[nt],Gn=it<e.freeze.cols,an=nt<e.freeze.rows,hl=Te?De:Gn?De-P:De,lo=Ue?ge:an?ge-Z:ge;Un(A,it,nt,wn,vn,hl,lo)}}},r.save(),r.beginPath();const zl=qe>0?2:0,At=Pe>0?2:0;r.rect(ft-zl,yt-At,Jt+zl,_t+At),r.clip(),b(r,Ll,Fn,Wn,In,$l),C(r,Ll,Fn,Wn,In,$l),v(r,ft,yt,Jt,_t),r.restore(),qe>0&&(r.strokeStyle=L.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(ft+.5,s),r.lineTo(ft+.5,D),r.stroke()),Pe>0&&(r.strokeStyle=L.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(g,yt+.5),r.lineTo(H,yt+.5),r.stroke()),r.fillStyle=L.headerBg,r.fillRect(k,m,H-k,s);for(let A=Ht;A<=yn;A++){const Ie=k+ue[A]-P;if(e.isColumnCollapsed(A))continue;const Ke=(ue[A+1]??0)-ue[A];if(Ie+Ke<k||Ie>H)continue;const gt=$e[A];gt===0?(r.fillStyle=L.outlineGroupBg1,r.fillRect(Ie,m,Ke,s)):gt===1&&(r.fillStyle=L.outlineGroupBg2,r.fillRect(Ie,m,Ke,s)),Rt&&A>=Rt.startCol&&A<=Rt.endCol&&(r.fillStyle=L.selectionBg,r.fillRect(Ie,m,Ke,s)),r.strokeStyle=L.headerBorder,r.lineWidth=.5,r.strokeRect(Ie+.25,m+.25,Ke-.5,s-.5),Rt&&A>=Rt.startCol&&A<=Rt.endCol&&(r.strokeStyle=L.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(Ie,m+s-1),r.lineTo(Ie+Ke,m+s-1),r.stroke()),r.fillStyle=L.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(ut(A),Ie+Ke/2,m+s/2)}if(qe>0){r.fillStyle=L.headerBg,r.fillRect(k,m,qe,s);for(let A=0;A<=un;A++){const Ie=k+ue[A];if(e.isColumnCollapsed(A))continue;const Ke=(ue[A+1]??0)-ue[A];Ie+Ke<k||Ie>H||(Rt&&A>=Rt.startCol&&A<=Rt.endCol&&(r.fillStyle=L.selectionBg,r.fillRect(Ie,m,Ke,s)),r.strokeStyle=L.headerBorder,r.lineWidth=.5,r.strokeRect(Ie+.25,m+.25,Ke-.5,s-.5),Rt&&A>=Rt.startCol&&A<=Rt.endCol&&(r.strokeStyle=L.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(Ie,m+s-1),r.lineTo(Ie+Ke,m+s-1),r.stroke()),r.fillStyle=L.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(ut(A),Ie+Ke/2,m+s/2))}}r.strokeStyle=L.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(k,T+.5),r.lineTo(H,T+.5),r.stroke(),r.fillStyle=L.headerBg,r.fillRect(0,T,k,D-T);for(let A=rn;A<=Cn;A++){if(e.isRowHidden(A))continue;const Ie=T+he[A]-Z,Ke=$l[A];if(Ie+Ke<T||Ie>D)continue;const gt=We[A];gt===0?(r.fillStyle=L.outlineGroupBg1,r.fillRect(f,Ie,g,Ke)):gt===1&&(r.fillStyle=L.outlineGroupBg2,r.fillRect(f,Ie,g,Ke)),Rt&&A>=Rt.startRow&&A<=Rt.endRow&&(r.fillStyle=L.selectionBg,r.fillRect(f,Ie,g,Ke)),r.strokeStyle=L.headerBorder,r.lineWidth=.5,r.strokeRect(f+.25,Ie+.25,g-.5,Ke-.5),Rt&&A>=Rt.startRow&&A<=Rt.endRow&&(r.strokeStyle=L.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(f+g-1,Ie),r.lineTo(f+g-1,Ie+Ke),r.stroke()),r.fillStyle=L.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(String(A+1),f+g/2,Ie+Ke/2+.5)}if(Pe>0){r.fillStyle=L.headerBg,r.fillRect(0,T,k,Pe);for(let A=0;A<=Qt;A++){if(e.isRowHidden(A))continue;const Ie=T+he[A],Ke=$l[A];Ie+Ke<T||Ie>D||(Rt&&A>=Rt.startRow&&A<=Rt.endRow&&(r.fillStyle=L.selectionBg,r.fillRect(f,Ie,g,Ke)),r.strokeStyle=L.headerBorder,r.lineWidth=.5,r.strokeRect(f+.25,Ie+.25,g-.5,Ke-.5),Rt&&A>=Rt.startRow&&A<=Rt.endRow&&(r.strokeStyle=L.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(f+g-1,Ie),r.lineTo(f+g-1,Ie+Ke),r.stroke()),r.fillStyle=L.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(String(A+1),f+g/2,Ie+Ke/2+.5))}}r.strokeStyle=L.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(k+.5,T),r.lineTo(k+.5,D),r.stroke(),r.fillStyle=L.headerBg,r.fillRect(f,m,g,s),r.strokeStyle=L.headerSep,r.lineWidth=1,r.strokeRect(f+.5,m+.5,g-1,s-1);const Lt=Math.min(g,s)*.32;r.fillStyle=L.activeCellBorder,r.beginPath(),r.moveTo(f+g-1,m+s-1-Lt),r.lineTo(f+g-1-Lt,m+s-1),r.lineTo(f+g-1,m+s-1),r.closePath(),r.fill();const pl=e.getOutlineLevel("row"),no=e.getOutlineLevel("column");if(e.getRowOutlines().length)for(const A of e.getRowOutlines()){const Ie=Xe(A,pl),Ke=T+he[A.start]-Z,gt=Ie-ee/2,Ft=Ke-ee/2;r.fillStyle=L.headerBg,r.strokeStyle=L.headerText,r.lineWidth=1,Xt(r,Math.round(gt),Math.round(Ft),ee,ee,2),r.fill(),r.stroke(),r.strokeStyle=L.headerText,r.lineWidth=1.4,r.beginPath(),r.moveTo(Ie-2,Ke),r.lineTo(Ie+2,Ke),r.stroke(),A.collapsed&&(r.beginPath(),r.moveTo(Ie,Ke-2),r.lineTo(Ie,Ke+2),r.stroke())}if(e.getColumnOutlines().length)for(const A of e.getColumnOutlines()){const Ie=Qe(A,no),Ke=k+ue[A.start]-P,gt=Ke-ee/2,Ft=Ie-ee/2;r.fillStyle=L.headerBg,r.strokeStyle=L.headerText,r.lineWidth=1,Xt(r,Math.round(gt),Math.round(Ft),ee,ee,2),r.fill(),r.stroke(),r.strokeStyle=L.headerText,r.lineWidth=1.4,r.beginPath(),r.moveTo(Ke-2,Ie),r.lineTo(Ke+2,Ie),r.stroke(),A.collapsed&&(r.beginPath(),r.moveTo(Ke,Ie-2),r.lineTo(Ke,Ie+2),r.stroke())}I(r,L),j(r,L)}function O(){const u=l.freezeCanvasRef.value,y=l.wrapperRef.value;if(!u||!y)return;const x=u.getContext("2d");if(!x)return;const H=y.getBoundingClientRect(),D=H.width,P=H.height,Z=52,g=24,s=ie(),f=me(),m=Z+s,k=g+f,T=l.themeColors.value,L=e.colPositions.value,de=e.rowPositions.value,ue=e.scrollX.value,he=e.scrollY.value;u.width=D*c,u.height=P*c,u.style.width=D+"px",u.style.height=P+"px",x.setTransform(c,0,0,c,0,0),x.clearRect(0,0,D,P);const{frozenRowsHeight:We,frozenColumnsWidth:$e}=e.getFrozenMetrics(),Pe=m+$e,qe=k+We,ft=Math.max(0,D-m-11-$e),yt=Math.max(0,P-k-11-We),Jt=Math.max(0,e.freeze.cols-1),_t=Math.max(0,e.freeze.rows-1),un=Math.max(e.freeze.cols,e.hitCol($e+ue));let Qt=un;for(let ct=un;ct<e.colCount&&!(m+L[ct]-ue>=D);ct++)Qt=ct;const Ht=Math.max(e.freeze.rows,e.hitRow(We+he));let yn=Ht;for(let ct=Ht;ct<e.rowCount&&!(k+de[ct]-he>=P);ct++)yn=ct;let rn=un,Cn=Qt,Hn=Ht,Fn=yn;$e>0&&(rn=0,Cn=Math.max(Cn,Jt)),We>0&&(Hn=0,Fn=Math.max(Fn,_t));let Al=rn,In=Hn;for(const ct in e.merges){const Ct=e.merges[ct];Ct&&(Ct.startRow>Fn||Ct.endRow<Hn||Ct.startCol>Cn||Ct.endCol<rn||(Ct.startCol<Al&&(Al=Ct.startCol),Ct.startRow<In&&(In=Ct.startRow)))}const Ll=new Array(In);for(let ct=In;ct<=Fn;ct++)Ll[ct]=de[ct+1]-de[ct];const Wn=(ct,Ct,Un)=>{const Pn=e.findMerge(ct,Ct);return Pn?e.getCellBorderSide(e.cells[Pn.anchor],Un):e.getCellBorderSide(e.cells[e.cellKey(ct,Ct)],Un)},$l=(ct,Ct,Un,Pn,zl)=>{ct.fillStyle="#444";for(let At=Pn;At<=zl;At++)for(let Lt=Ct;Lt<=Un;Lt++){if(e.isRowCollapsed(At)||e.isColumnCollapsed(Lt))continue;const pl=e.findMerge(Lt,At);if(pl&&!(Lt===pl.range.startCol&&At===pl.range.startRow))continue;const no=e.cellToScreenRect(At,Lt),A=no.x,Ie=no.y,Ke=no.width,gt=no.height;if(A+Ke<m||Ie+gt<k||A>D||Ie>P)continue;const Ft=e.cells[e.cellKey(Lt,At)],jt={top:e.getCellBorderSide(Ft,"top"),right:e.getCellBorderSide(Ft,"right"),bottom:e.getCellBorderSide(Ft,"bottom"),left:e.getCellBorderSide(Ft,"left")};if(pl)continue;const wt={top:Wn(Lt,At-1,"bottom"),left:Wn(Lt-1,At,"right"),bottom:Wn(Lt,At+1,"top"),right:Wn(Lt+1,At,"left")},Te=Pt(wt.top,jt.top),Ue=Pt(wt.left,jt.left),at=Pt(jt.bottom,wt.bottom),tt=Pt(jt.right,wt.right),Ye=(Te==null?void 0:Te.width)??0,dt=(Ue==null?void 0:Ue.width)??0,it=(at==null?void 0:at.width)??0,nt=(tt==null?void 0:tt.width)??0;Ye>0&&(ct.fillStyle=(Te==null?void 0:Te.color)||"#444",ct.fillRect(A,Ie,Ke,Ye)),it>0&&(ct.fillStyle=(at==null?void 0:at.color)||"#444",ct.fillRect(A,Ie+gt-it,Ke,it)),dt>0&&(ct.fillStyle=(Ue==null?void 0:Ue.color)||"#444",ct.fillRect(A,Ie,dt,gt)),nt>0&&(ct.fillStyle=(tt==null?void 0:tt.color)||"#444",ct.fillRect(A+Ke-nt,Ie,nt,gt));const $t=Lt>0&&e.isColumnCollapsed(Lt-1),Wt=Lt<e.colCount-1&&e.isColumnCollapsed(Lt+1),Nt=At>0&&e.isRowCollapsed(At-1),st=At<e.rowCount-1&&e.isRowCollapsed(At+1),De=Lt<e.freeze.cols,ge=At<e.freeze.rows;Ye>0&&dt>0&&!$t&&!Nt&&(ct.fillStyle=(Te==null?void 0:Te.color)||(Ue==null?void 0:Ue.color)||"#444",ct.fillRect(A-dt,Ie-Ye,dt,Ye)),Ye>0&&nt>0&&!Wt&&!Nt&&!De&&(ct.fillStyle=(Te==null?void 0:Te.color)||(tt==null?void 0:tt.color)||"#444",ct.fillRect(A+Ke,Ie-Ye,nt,Ye)),it>0&&dt>0&&!$t&&!st&&!ge&&(ct.fillStyle=(at==null?void 0:at.color)||(Ue==null?void 0:Ue.color)||"#444",ct.fillRect(A-dt,Ie+gt,dt,it)),it>0&&nt>0&&!Wt&&!st&&!De&&!ge&&(ct.fillStyle=(at==null?void 0:at.color)||(tt==null?void 0:tt.color)||"#444",ct.fillRect(A+Ke,Ie+gt,nt,it))}},Rt=(ct,Ct,Un,Pn,zl,At,Lt,pl)=>{Un<=0||Pn<=0||(x.save(),x.beginPath(),x.rect(ct,Ct,Un,Pn),x.clip(),x.fillStyle=T.gridBg,x.fillRect(ct,Ct,Un,Pn),b(x,zl,At,Lt,pl,Ll),$l(x,zl,At,Lt,pl),v(x,ct,Ct,Un,Pn),x.restore())};$e>0&&We>0&&Rt(Z,g,$e,We,0,Jt,0,_t),We>0&&Rt(Pe,g,ft,We,Al,Cn,0,_t),$e>0&&Rt(Z,qe,$e,yt,0,Jt,In,Fn),x.strokeStyle=T.headerSep,x.lineWidth=1,$e>0&&(x.beginPath(),x.moveTo(Pe+.5,g),x.lineTo(Pe+.5,P),x.stroke()),We>0&&(x.beginPath(),x.moveTo(Z,qe+.5),x.lineTo(D,qe+.5),x.stroke()),x.fillStyle=T.headerBg,x.fillRect(0,0,Z,g),x.strokeStyle=T.headerSep,x.lineWidth=1,x.strokeRect(.5,.5,Z-.5,g-.5),I(x,T),j(x,T)}function I(u,y){const x=e.selection.value;if(!x||e.editingCell.value)return;const H=e.cellToScreenRect(x.endRow,x.endCol),D=H.x+H.width-6/2,P=H.y+H.height-6/2;if(D<se()||P<Se())return;const{frozenColumnsWidth:Z,frozenRowsHeight:g}=e.getFrozenMetrics();if(Z>0&&x.endCol>=e.freeze.cols&&D<se()+Z||g>0&&x.endRow>=e.freeze.rows&&P<Se()+g)return;const s=yr(x,x,e.merges).ok;u.fillStyle=s?y.activeCellBorder:y.scrollTrack,u.fillRect(D,P,6,6),u.strokeStyle="#fff",u.lineWidth=1,u.strokeRect(D+.5,P+.5,6-1,6-1)}function j(u,y){const x=e.autoFillState.value;if(!x.active||!x.preview||!x.targetRange)return;const H=x.targetRange,D=e.cellToScreenRect(H.startRow,H.startCol),P=e.cellToScreenRect(H.endRow,H.endCol),Z=D.x,g=D.y,s=P.x+P.width-Z,f=P.y+P.height-g;g<Se()||Z<se()||(u.fillStyle=y.selectionBg,u.fillRect(Z,g,s,f),u.strokeStyle=y.activeCellBorder,u.lineWidth=1.5,u.setLineDash([4,3]),u.strokeRect(Z+.5,g+.5,s-1,f-1),u.setLineDash([]))}const we=t.computed(()=>ut(e.activeCell.value.col)+String(e.activeCell.value.row+1)),ze=t.ref(""),le=t.ref(!1),xe=t.computed(()=>e.editingCell.value?ze.value:e.getCellRaw(e.activeCell.value.col,e.activeCell.value.row));t.watch(()=>e.editingCell.value,(u,y)=>{if(u&&!y){const x=e.editValue.value||e.getCellRaw(u.col,u.row)||"";ze.value=x,re=!1}else!u&&y&&(ze.value="",le.value=!1,re=!1)},{immediate:!0}),t.watch(()=>[e.activeCell.value.col,e.activeCell.value.row],()=>{e.editingCell.value||(ze.value="",re=!1)});function ce(){e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),h())}function Fe(u){const y=u.target.value;e.editingCell.value?e.editValue.value=y:e.startEdit(y),ze.value=y,re=!0}function V(u){var x,H;const y={...e.activeCell.value};e.editingCell.value?(e.editValue.value=u,e.commitEdit()):((x=e.saveUndo)==null||x.call(e),e.setCellValue(y.col,y.row,u)),ze.value="",re=!1,h(),(H=l.emitModelData)==null||H.call(l)}let J=!1,re=!1;function ae(){var P,Z,g;if(J)return;const u=l.formulaBarRef.value,y=!!(u&&typeof document<"u"&&document.activeElement===u);if(!e.editingCell.value&&!y&&!re)return;const x={...e.activeCell.value},H=e.editingCell.value?e.editingCell.value.col:x.col,D=e.editingCell.value?e.editingCell.value.row:x.row;if(!e.editingCell.value){const s=e.getCellRaw(H,D),f=ze.value!==s;if(!re)return;J=!0,f&&((P=e.saveUndo)==null||P.call(e),e.setCellValue(H,D,ze.value),h(),(Z=l.emitModelData)==null||Z.call(l)),(g=l.formulaBarRef.value)==null||g.blur(),ze.value="",le.value=!1,re=!1,t.nextTick(()=>{J=!1});return}J=!0,re?(e.editValue.value=ze.value,e.commitEdit().then(s=>{var f,m;s&&(e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row)),(f=l.formulaBarRef.value)==null||f.blur(),ze.value="",le.value=!1,re=!1,h(),l.focusEditInput(),(m=l.emitModelData)==null||m.call(l),t.nextTick(()=>{J=!1})})):y?(ze.value=e.editValue.value,e.commitEdit().then(s=>{var f,m;s&&(e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row)),(f=l.formulaBarRef.value)==null||f.blur(),ze.value="",le.value=!1,re=!1,h(),l.focusEditInput(),(m=l.emitModelData)==null||m.call(l),t.nextTick(()=>{J=!1})})):e.commitEdit().then(()=>{var s,f;(s=l.formulaBarRef.value)==null||s.blur(),ze.value="",le.value=!1,re=!1,h(),l.focusEditInput(),(f=l.emitModelData)==null||f.call(l),t.nextTick(()=>{J=!1})})}function oe(){var u;J||(J=!0,e.editingCell.value&&e.cancelEdit(),(u=l.formulaBarRef.value)==null||u.blur(),ze.value="",le.value=!1,re=!1,h(),l.focusEditInput(),t.nextTick(()=>{J=!1}))}function ve(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 x=y.selectionStart??y.value.length,H=y.selectionEnd??y.value.length,D=y.value,P=D.substring(0,x)+`
7
- `+D.substring(H),Z=x+1;ze.value=P,le.value||(le.value=!0),t.nextTick(()=>{try{y.setSelectionRange(Z,Z)}catch{}if(le.value)try{y.scrollTop=y.scrollHeight}catch{}try{y.focus({preventScroll:!0})}catch{}});return}u.key==="Enter"?(u.preventDefault(),ae()):u.key==="Escape"&&(u.preventDefault(),oe())}}function Me(){ae()}const q=t.ref(null),$=t.ref("");function Y(u){q.value===null&&(l.switchSheet(u),h())}function W(u){u!==l.activeSheetIndex.value&&(l.saveSheet(),l.loadSheet(u),h()),q.value=u,$.value=l.sheets.value[u].name,t.nextTick(()=>{const y=document.querySelector(".tab-rename-input");y==null||y.focus(),y==null||y.select()})}function fe(){q.value!==null&&(l.renameSheet(q.value,$.value),t.nextTick(()=>l.emitModelData())),q.value=null,$.value=""}function Ae(){q.value=null,$.value=""}function Re(u){u.key==="Enter"?(u.preventDefault(),fe()):u.key==="Escape"&&(u.preventDefault(),Ae())}const _e=t.ref(null);t.watch(_e,u=>{u===null&&be()});const Ge=t.ref(null);let Le=null,ht=null;function bt(){Le&&(clearTimeout(Le),Le=null),ht=null}function je(u,y,x){bt(),Ge.value={mode:x,row:u,col:y}}function Bt(){bt(),Ge.value=null}function Yt(u,y){je(u,y,"edit")}function Vt(u,y,x,H){const D=e.getNote(u,y);x?D?e.updateCellNote(D.id,x):e.setCellNote(u,y,x,H||jr):D&&e.deleteCellNote(u,y),Bt(),h()}function zt(u,y){e.deleteCellNote(u,y),Bt(),h()}function et(u,y){var g;if(((g=Ge.value)==null?void 0:g.mode)==="edit")return;const H=u>=se()&&y>=Se()?e.screenToCell(u,y):null,D=H&&H.col>=0&&H.row>=0&&e.hasNote(H.row,H.col)?H:null,P=Ge.value&&Ge.value.mode==="view"?Ge.value:null;P&&`${P.col}${P.row}`;const Z=D?`${D.col},${D.row}`:null;ht&&`${ht.col},${ht.row}`===Z||(ht=D?{row:D.row,col:D.col}:null,Le&&(clearTimeout(Le),Le=null),Z&&(Le=setTimeout(()=>{var s;Le=null,((s=Ge.value)==null?void 0:s.mode)!=="edit"&&(Ge.value={mode:"view",row:D.row,col:D.col},h())},300)))}function N(u,y){if(u<se()||y<Se())return null;const x=e.screenToCell(u,y);if(!x)return null;const{col:H,row:D}=x;if(!e.hasNote(D,H))return null;const P=e.cellToScreenRect(D,H),Z=5,g=P.x+P.width-1.5,s=P.y+1.5,f=u-g,m=y-s;return f<=1&&m>=-1&&m-f<=Z+1?{row:D,col:H}:null}const te=t.ref(null),vt=t.ref(null),It=18,Et=2,Sn=2,en=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 Xt(u,y,x,H,D,P){const Z=Math.min(P,H/2,D/2);u.beginPath(),u.moveTo(y+Z,x),u.arcTo(y+H,x,y+H,x+D,Z),u.arcTo(y+H,x+D,y,x+D,Z),u.arcTo(y,x+D,y,x,Z),u.arcTo(y,x,y+H,x,Z),u.closePath()}function Zt(u,y,x,H,D,P,Z){if(H<Q+4||D<10)return;const g=y+H-Q,s=x+1,f=D-2;u.save(),P&&(u.fillStyle=Z.selectionBg,u.fillRect(g,s,Q,f)),u.fillStyle=Z.activeCellBorder;const m=6,k=4,T=g+Q/2,L=s+f/2;u.beginPath(),u.moveTo(T-m/2,L-k/2+.5),u.lineTo(T+m/2,L-k/2+.5),u.lineTo(T,L+k/2+.5),u.closePath(),u.fill(),u.restore()}function Mn(u,y,x,H,D){if(H<8||D<8)return;const P=5,Z=y+H-1.5,g=x+1.5;u.save(),u.fillStyle="#d93025",u.beginPath(),u.moveTo(Z,g),u.lineTo(Z-P,g),u.lineTo(Z,g+P),u.closePath(),u.fill(),u.restore()}function Nn(u,y){if(e.dataValidations.length===0)return null;const x=e.screenToCell(u,y);if(!x)return null;const H=e.findMerge(x.col,x.row),D=H?H.range.startCol:x.col,P=H?H.range.startRow:x.row;if(!e.getListValidation(P,D))return null;const Z=e.cellToScreenRect(P,D);if(Z.width<Q+4)return null;const g=Z.x+Z.width-Q;return u<g||u>Z.x+Z.width||y<Z.y||y>Z.y+Z.height?null:{col:D,row:P}}function _(u,y){const x=e.getValidationDropdown(y,u);if(!x)return!1;const H=l.canvasRef.value;if(!H)return!1;e.activeCell.value.col===u&&e.activeCell.value.row===y||e.selectCell(u,y),e.ensureVisible(u,y),h();const D=e.cellToScreenRect(y,u),P=H.getBoundingClientRect();return vt.value={col:u,row:y,rule:x.rule,items:x.items,current:e.getCellRaw(u,y),x:P.left+D.x,y:P.top+D.y,width:D.width,height:D.height},!0}function z(){vt.value&&(vt.value=null,h())}async function G(u){var P;const y=vt.value;if(!y)return;const{col:x,row:H}=y;vt.value=null;const D=e.validateCell(H,x,u);if(!D.valid&&await e.confirmInvalidValue(D,x,H)!=="continue"){h(),l.focusEditInput();return}o.saveUndo(),e.setCellValue(x,H,u),(P=e.emitModelData)==null||P.call(e),h(),l.focusEditInput()}function ye(u,y,x,H,D,P,Z){const g=Math.min(H,It)-Et,s=y+H-g-Et,f=x+Et,m=D-2*Et;u.save(),u.fillStyle=P?Z.activeCellBorder:"#ececec",Xt(u,s,f,g,m,Sn),u.fill();const k=Math.min(g,m)*.72;u.translate(s+g/2,f+m/2),u.scale(k/1024,k/1024),u.translate(-512,-512),u.fillStyle=P?"#ffffff":"#5a5a5a",u.fill(en),u.restore()}function Be(u,y){const x=e.getFilter();if(!x)return-1;const H=e.screenToCell(u,y);if(!H)return-1;const{col:D,row:P}=H;if(P!==x.range.startRow||D<x.range.startCol||D>x.range.endCol)return-1;const Z=e.cellToScreenRect(P,D),g=Math.min(Z.width,It)-Et,s=Z.x+Z.width-g-Et,f=Z.x+Z.width-Et;return u>=s&&u<=f&&y>=Z.y+Et&&y<=Z.y+Z.height-Et?D:-1}function Ve(u){const y=e.getFilter();if(!y)return;const x=l.canvasRef.value;if(!x)return;const H=x.getBoundingClientRect(),D=e.cellToScreenRect(y.range.startRow,u);te.value={col:u,x:H.left+D.x+D.width-It,y:H.top+D.y+2}}function He(){te.value=null}let Ce=null,Oe=null;function be(){Ce&&(document.removeEventListener("click",Ce),Ce=null),Oe&&(document.removeEventListener("touchstart",Oe,{capture:!0}),Oe=null)}function Je(u,y){const x=e.getOutlineLevel("row"),H=e.getOutlineLevel("column"),D=e.rowPositions.value,P=e.colPositions.value,Z=e.scrollX.value,g=e.scrollY.value,s=ee/2+1;if(y>=Se())for(const f of e.getRowOutlines()){const m=Xe(f,x),k=Se()+D[f.start]-g;if(Math.abs(u-m)<=s&&Math.abs(y-k)<=s)return{kind:"toggle",outlineId:f.id}}if(u>=se())for(const f of e.getColumnOutlines()){const m=Qe(f,H),k=se()+P[f.start]-Z;if(Math.abs(y-m)<=s&&Math.abs(u-k)<=s)return{kind:"toggle",outlineId:f.id}}return null}function E(u){for(const y of u)e.removeOutline(y);l.emitModelData(),h()}function U(u){const y=e.selection.value;if(!y)return Ne("outlineNeedRowsOrColumns"),!1;let x;if(u==="row"){if(y.startCol!==0||y.endCol!==e.colCount-1)return Ne("outlineNeedRowsOrColumns"),!1;if(y.startRow===y.endRow)return Ne("outlineInvalidRange"),!1;x=e.addRowGroup(y.startRow,y.endRow)}else{if(y.startRow!==0||y.endRow!==e.rowCount-1)return Ne("outlineNeedRowsOrColumns"),!1;if(y.startCol===y.endCol)return Ne("outlineInvalidRange"),!1;x=e.addColumnGroup(y.startCol,y.endCol)}return x.ok?!0:(Ne(x.code==="outlineCrossing"?"outlineCrossing":x.code==="outlineTooDeep"?"outlineTooDeep":"outlineInvalidRange"),!1)}function ne(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 Ne("outlineNeedRowsOrColumns"),!1;const x=u==="row"?e.getRowOutlines():e.getColumnOutlines(),H=u==="row"?y.startRow:y.startCol,D=u==="row"?y.endRow:y.endCol,P=x.filter(Z=>H<=Z.start&&Z.end<=D);return P.length?(E(P.map(Z=>Z.id)),!0):(Ne("outlineUngroupPartial"),!1)}function ke(u,y){const x=u==="row"?e.getRowOutlines():e.getColumnOutlines();if(x.length&&!x.every(H=>H.collapsed===y)){o.saveUndo();for(const H of x)e.setOutlineCollapsed(H.id,y,!0);l.emitModelData(),h()}}function Ne(u){const y=w(e.locale.value,u);if(d){d(y);return}window.alert(y)}function M(u,y,x){be();const H=140,D=x.length*28+8,P=qn(l.wrapperRef.value),Z=P.right,g=P.bottom;u+H>Z&&(u-=H),y+D>g&&(y-=D),p.value=!1,_e.value={x:u,y,items:x},t.nextTick(()=>ot()),Ce=()=>{_e.value=null,be()},Oe=s=>{const f=s.target;f&&f.closest(".context-menu")||(_e.value=null,be())},setTimeout(()=>{document.addEventListener("click",Ce,{once:!0}),document.addEventListener("touchstart",Oe,{capture:!0})},0)}const p=t.ref(!1);function S(u,y){}function ot(){const y=document.querySelector(".context-menu"),x=_e.value;if(!y||!x){p.value=!1;return}const H=x.x+140,D=qn(l.wrapperRef.value),P=D.right,Z=D.bottom,g=y.style.transform;y.style.transform="none";let s=0;if(y.querySelectorAll(".context-menu__item").forEach(m=>{const k=m.querySelector(":scope > .context-submenu");if(!k)return;const T=k.style.display;k.style.display="block";const L=k.getBoundingClientRect(),de=L.width,ue=L.height;k.style.display=T,de>s&&(s=de),m.getBoundingClientRect().top+ue>Z-8?(k.style.top="auto",k.style.bottom="-5px"):(k.style.top="",k.style.bottom="")}),y.style.transform=g,s===0){p.value=!0;return}const f=P-H;p.value=f<s+8}function mt(u,y){u.preventDefault(),u.stopPropagation(),M(u.clientX,u.clientY,[{label:w(e.locale.value,"insert"),action:()=>{l.addSheet(),h()}},{label:w(e.locale.value,"copy"),action:()=>{l.dupSheet(y)}},{label:w(e.locale.value,"rename"),action:()=>{W(y)}},{label:w(e.locale.value,"delete"),action:()=>{l.removeSheet(y),h()},disabled:l.sheetCount.value<=1},{label:w(e.locale.value,"moveSheetLeft"),action:()=>{l.moveSheet(y,-1)},disabled:y===0},{label:w(e.locale.value,"moveSheetRight"),action:()=>{l.moveSheet(y,1)},disabled:y===l.sheets.value.length-1}])}function Ot(u){u.preventDefault(),!(u.target.closest(".tab-item")||u.target.closest(".tab-bar__add-btn"))&&M(u.clientX,u.clientY,[{label:w(e.locale.value,"insert"),action:()=>{l.addSheet(),h()}}])}function xt(u){u.preventDefault(),e.selectAll(),h(),M(u.clientX,u.clientY,[{label:w(e.locale.value,"cut"),action:()=>{n.cutSelected(),l.emitModelData()}},{label:w(e.locale.value,"copy"),action:()=>n.copyToClipboard()},{label:w(e.locale.value,"paste"),action:()=>{o.saveUndo(),n.pasteFromClipboard().then(()=>{h(),t.nextTick(()=>l.emitModelData())})}},{label:w(e.locale.value,"delete"),action:()=>{o.saveUndo(),n.clearSelected();for(let y=0;y<e.colCount;y++)e.colWidths.value[y]=100;for(let y=0;y<e.rowCount;y++)e.rowHeights.value[y]=void 0;h(),l.emitModelData()}}])}function Tt(u,y){u.preventDefault();const x=u.clientX,H=u.clientY,D=e.selection.value;D&&D.startCol===0&&D.endCol===e.colCount-1&&y>=D.startRow&&y<=D.endRow||(e.selectRange(0,y,e.colCount-1,y,"row"),h());const P=e.selection.value;M(u.clientX,u.clientY,[{label:w(e.locale.value,"insert"),action:()=>{o.saveUndo(),l.insertRows(P.startRow,P.startRow),e.selectRange(0,P.startRow,e.colCount-1,P.startRow,"row"),h(),l.emitModelData()}},{label:w(e.locale.value,"cut"),action:()=>{o.saveUndo(),n.copyRowCol(),e.clearCellsInRange(0,e.colCount-1,P.startRow,P.endRow),h(),l.emitModelData()}},{label:w(e.locale.value,"copy"),action:()=>n.copyRowCol()},{label:w(e.locale.value,"paste"),action:()=>{o.saveUndo(),n.pasteFromClipboard().then(()=>{h(),t.nextTick(()=>l.emitModelData())})}},{label:w(e.locale.value,"delete"),action:()=>{o.saveUndo(),l.deleteRows(P.startRow,P.endRow),h(),l.emitModelData()}},{label:`${w(e.locale.value,"rowHeight")}...`,action:()=>mo("row",x,H)},{label:w(e.locale.value,"autoRowHeight"),action:()=>l.resetRowHeight()},{label:w(e.locale.value,"freezeToRow"),action:()=>{e.setFreeze(y+1,e.freeze.cols),h()}},{label:w(e.locale.value,"outlineGroup"),children:[{label:w(e.locale.value,"outlineAddRowGroup"),action:()=>U("row")},{label:w(e.locale.value,"outlineUngroupRows"),action:()=>ne("row")},{label:w(e.locale.value,"outlineClear"),action:()=>e.clearRowGroups()},{label:w(e.locale.value,"outlineExpandAll"),action:()=>ke("row",!1)},{label:w(e.locale.value,"outlineCollapseAll"),action:()=>ke("row",!0)}]}])}function il(u,y){u.preventDefault();const x=u.clientX,H=u.clientY,D=e.selection.value;D&&D.startRow===0&&D.endRow===e.rowCount-1&&y>=D.startCol&&y<=D.endCol||(e.selectRange(y,0,y,e.rowCount-1,"col"),h());const P=e.selection.value,Z=!l.canSortColumns(P.startCol,P.endCol);M(u.clientX,u.clientY,[{label:w(e.locale.value,"insert"),action:()=>{o.saveUndo(),l.insertCols(P.startCol,P.startCol),e.selectRange(P.startCol,0,P.startCol,e.rowCount-1,"col"),h(),l.emitModelData()}},{label:w(e.locale.value,"cut"),action:()=>{o.saveUndo(),n.copyRowCol(),e.clearCellsInRange(P.startCol,P.endCol,0,e.rowCount-1),h(),l.emitModelData()}},{label:w(e.locale.value,"copy"),action:()=>n.copyRowCol()},{label:w(e.locale.value,"paste"),action:()=>{o.saveUndo(),n.pasteFromClipboard().then(()=>{h(),t.nextTick(()=>l.emitModelData())})}},{label:w(e.locale.value,"delete"),action:()=>{o.saveUndo(),l.deleteCols(P.startCol,P.endCol),h(),l.emitModelData()}},{label:w(e.locale.value,"sort"),disabled:Z,children:[{label:w(e.locale.value,"sortAsc"),action:()=>{l.prepareSortConfirmation("asc")||l.sortSelectedColumns("asc")},disabled:Z},{label:w(e.locale.value,"sortDesc"),action:()=>{l.prepareSortConfirmation("desc")||l.sortSelectedColumns("desc")},disabled:Z}]},{label:`${w(e.locale.value,"colWidth")}...`,action:()=>mo("col",x,H)},{label:w(e.locale.value,"defaultColWidth"),action:()=>l.resetColWidth()},{label:w(e.locale.value,"freezeToCol"),action:()=>{e.setFreeze(e.freeze.rows,y+1),h()}},{label:w(e.locale.value,"outlineGroup"),children:[{label:w(e.locale.value,"outlineAddColumnGroup"),action:()=>U("column")},{label:w(e.locale.value,"outlineUngroupColumns"),action:()=>ne("column")},{label:w(e.locale.value,"outlineClear"),action:()=>e.clearColumnGroups()},{label:w(e.locale.value,"outlineExpandAll"),action:()=>ke("column",!1)},{label:w(e.locale.value,"outlineCollapseAll"),action:()=>ke("column",!0)}]}])}function sl(u,y,x){u.preventDefault(),e.isSelected(y,x)||(e.selectCell(y,x),h());const H=e.selection.value,D=!!(H&&H.startCol===H.endCol&&H.startRow===H.endRow);M(u.clientX,u.clientY,[{label:w(e.locale.value,"cut"),action:()=>{n.cutSelected(),l.emitModelData()}},{label:w(e.locale.value,"copy"),action:()=>n.copyToClipboard()},{label:w(e.locale.value,"paste"),action:()=>{o.saveUndo(),n.pasteFromClipboard().then(()=>{h(),t.nextTick(()=>l.emitModelData())})}},{label:w(e.locale.value,"delete"),action:()=>{o.saveUndo(),n.clearSelected(),h(),l.emitModelData()}},{label:w(e.locale.value,"calculate"),children:[{label:w(e.locale.value,"sum"),action:n.sumSelected,disabled:D},{label:w(e.locale.value,"avg"),action:n.avgSelected,disabled:D},{label:w(e.locale.value,"count"),action:n.countSelected,disabled:D}]},{label:`${w(e.locale.value,"dv")}...`,action:()=>{var P;return(P=e.requestDataValidationDialog)==null?void 0:P.call(e)}},{label:w(e.locale.value,"dvClearValidation"),action:()=>{o.saveUndo(),e.clearDataValidation(e.selection.value),h(),l.emitModelData()}},...D?[{label:e.hasNote(x,y)?w(e.locale.value,"editNote"):w(e.locale.value,"newNote"),action:()=>Yt(x,y)},...e.hasNote(x,y)?[{label:w(e.locale.value,"deleteNote"),action:()=>zt(x,y)}]:[]]:[]])}const Gl=t.ref(null),Jn=t.ref(null);let Tl=null,Vl=null;function fo(){Tl&&(document.removeEventListener("mousedown",Tl),Tl=null),Vl&&(document.removeEventListener("touchstart",Vl),Vl=null)}function mo(u,y,x){fo();const H=e.selection.value;let D="";if(H){const m=u==="row"?e.getRowHeight(H.startRow):e.colWidths.value[H.startCol];D=m!=null&&m>0?String(Math.round(m)):""}const P=220,Z=118;let g=y,s=x;const f=qn(l.wrapperRef.value);g=Math.max(f.left+8,Math.min(f.right-P-8,g)),s=Math.max(f.top+8,Math.min(f.bottom-Z-8,s)),Jn.value={type:u,x:g,y:s,value:D,error:""},Tl=()=>{Jn.value=null},Vl=()=>{Jn.value=null},setTimeout(()=>{document.addEventListener("mousedown",Tl,{once:!0}),document.addEventListener("touchstart",Vl,{once:!0})},0),t.nextTick(()=>{const m=Gl.value;m&&(m.focus(),m.select())})}function Br(u){const y=Jn.value;if(!y)return;const x=u.target,H=x.value,D=H.replace(/[^\d]/g,"");y.value=D,H!==D&&(x.value=D),y.error=""}function xr(u){u.key==="Enter"?(u.preventDefault(),Po()):u.key==="Escape"&&(u.preventDefault(),ql())}function Tr(){const u=Jn.value;if(!u)return;const y=u.value.trim(),x=Number(y),H=u.type==="row",D=H?24:30,P=H?500:1e3;if(y===""||!Number.isFinite(x)){ql();return}const Z=Math.max(D,Math.min(P,Math.round(x)));u.value=String(Z),u.error=""}function Po(){const u=Jn.value,y=e.selection.value;if(!u||!y)return;const x=u.value.trim(),H=Number(x),D=u.type==="row",P=D?24:30,Z=D?500:1e3;if(x===""||!Number.isFinite(H)){u.error=w(e.locale.value,"dimNumberError");return}if(H<P||H>Z){u.error=w(e.locale.value,"dimRangeError").replace("{min}",String(P)).replace("{max}",String(Z));return}const g=H;if(o.saveUndo(),D)for(let s=y.startRow;s<=y.endRow;s++)e.rowHeights.value[s]=g;else for(let s=y.startCol;s<=y.endCol;s++)e.colWidths.value[s]=g;h(),l.emitModelData(),ql()}function ql(){fo(),Jn.value=null}const Vr=t.computed(()=>{const u=!e.editingCell.value,y=e.editingCell.value??e.activeCell.value,x=y.col,H=y.row,D=e.resolveStyle(e.cells[e.cellKey(x,H)]),P=e.cellFontSize(x,H),Z=typeof(D==null?void 0:D.fontFamily)=="string"&&D.fontFamily?D.fontFamily:Nl,g=(D==null?void 0:D.fontWeight)==="bold"?"bold":"normal",s=(D==null?void 0:D.fontStyle)==="italic"?"italic":"normal",f=(D==null?void 0:D.underline)==="underline"?"underline":(D==null?void 0:D.strikethrough)==="line-through"?"line-through":"none",m=(D==null?void 0:D.underline)==="underline"&&(D==null?void 0:D.strikethrough)==="line-through"?"underline line-through":f,k=typeof(D==null?void 0:D.color)=="string"?D.color:void 0,T=typeof(D==null?void 0:D.backgroundColor)=="string"?D.backgroundColor:void 0,L=typeof(D==null?void 0:D.numberFormat)=="string"?D.numberFormat:"",de=e.editValue.value??e.getCellValue(x,H),ue=typeof(D==null?void 0:D.textAlign)=="string"?D.textAlign:sr(de,L)?"right":"left",he=typeof(D==null?void 0:D.verticalAlign)=="string"?D.verticalAlign:"top",We=e.findMerge(x,H),$e=We?e.rowPositions.value[We.range.endRow+1]-e.rowPositions.value[H]:e.getRowHeight(H),Pe=2,{ascent:qe,descent:ft}=e.measureFontMetrics(Z,P,g,s),yt=qe+ft,_t=(e.editValue.value?e.editValue.value.split(`
8
- `).length:1)*yt,un=e.BASE_CELL_VPAD-Pe;let Qt=0,Ht=0;he==="middle"?(Qt=Math.floor(($e-_t)/2),Ht=Math.max(0,$e-_t-Qt)):he==="top"?(Qt=un,Ht=Math.max(0,$e-_t-Qt)):he==="bottom"&&(Ht=un,Qt=Math.max(0,$e-_t-Ht));const yn=e.cellToScreenRect(H,x);return{left:`${yn.x}px`,top:`${yn.y}px`,width:`${yn.width}px`,height:`${yn.height}px`,fontFamily:Z,fontSize:`${P}px`,lineHeight:1,fontWeight:g,fontStyle:s,textDecoration:m,textAlign:ue,paddingTop:`${Qt}px`,paddingRight:"3px",paddingBottom:`${Ht}px`,paddingLeft:"3px",opacity:u?0:1,pointerEvents:u?"none":"auto",color:u?"transparent":k,caretColor:u?"transparent":void 0,borderColor:u?"transparent":void 0,background:u?"transparent":T,boxShadow:u?"none":void 0}});function po(){return Math.max(0,l.viewSize.w-se()-11)}function jl(){return Math.max(0,l.viewSize.h-Se()-11)}const Yl=t.computed(()=>Math.max(0,po()-e.getFrozenMetrics().frozenColumnsWidth)),ho=t.computed(()=>Math.max(0,jl()-e.getFrozenMetrics().frozenRowsHeight)),Dr=t.computed(()=>se()+e.getFrozenMetrics().frozenColumnsWidth),Fr=t.computed(()=>Se()+e.getFrozenMetrics().frozenRowsHeight),Dl=t.computed(()=>Math.max(0,Yl.value-11*2)),vl=t.computed(()=>Math.max(0,ho.value-11*2)),Xl=t.computed(()=>l.maxScrollX.value<=0?Dl.value:Math.max(24,Yl.value/e.totalWidth.value*Dl.value)),go=t.computed(()=>l.maxScrollX.value<=0?0:e.scrollX.value/l.maxScrollX.value*(Dl.value-Xl.value)),Zl=t.computed(()=>l.maxScrollY.value<=0?vl.value:Math.max(24,ho.value/e.totalHeight.value*vl.value)),bo=t.computed(()=>l.maxScrollY.value<=0?0:e.scrollY.value/l.maxScrollY.value*(vl.value-Zl.value));let cl=null,Fl=0,Bn=0;function Ir(u){u.preventDefault(),cl="v",Fl=u.clientY,Bn=e.scrollY.value,document.addEventListener("mousemove",gn),document.addEventListener("mouseup",dl)}function Or(u){u.preventDefault(),cl="h",Fl=u.clientX,Bn=e.scrollX.value,document.addEventListener("mousemove",gn),document.addEventListener("mouseup",dl)}function gn(u){if(cl==="v"){const x=(u.clientY-Fl)/(vl.value-Zl.value);l.clampScroll(null,Bn+x*l.maxScrollY.value),h()}else if(cl==="h"){const x=(u.clientX-Fl)/(Dl.value-Xl.value);l.clampScroll(Bn+x*l.maxScrollX.value,null),h()}}function dl(){cl=null,document.removeEventListener("mousemove",gn),document.removeEventListener("mouseup",dl)}function Ko(u){if(cl)return;const y=u.currentTarget.getBoundingClientRect(),x=u.clientY-y.top;x<bo.value?l.clampScroll(null,e.scrollY.value-jl()):x>bo.value+Zl.value&&l.clampScroll(null,e.scrollY.value+jl()),h()}function yo(u){if(cl)return;const y=u.currentTarget.getBoundingClientRect(),x=u.clientX-y.left;x<go.value?l.clampScroll(e.scrollX.value-po(),null):x>go.value+Xl.value&&l.clampScroll(e.scrollX.value+po(),null),h()}let kl=!1,sn=0,bn=0,ln=!1,xn=!1,El=0,ul=0,zn=0,cn=0,Rl=0,Il=0,Jl=0,Ql=0,on=!1,fl=!1,St=0,Mt=0,tn="cell",Co=0,Tn=-1,eo=-1,qt=null,Qn=!1,_n=0,Vn=0,ml=!1,Dn=null,Sl=null,wo=0,vo=0;function ko(u,y){const x=e.selection.value;if(!x||e.editingCell.value||!yr(x,x,e.merges).ok)return!1;const H=e.cellToScreenRect(x.endRow,x.endCol),D=H.x+H.width-6,P=H.y+H.height-6,Z=4;return u>=D-Z&&u<=D+6+Z&&y>=P-Z&&y<=P+6+Z}function Ar(){Dn=requestAnimationFrame(Go)}function Go(){if(!e.autoFillState.value.active||!Sl){Dn=null;return}const u=8;l.clampScroll(e.scrollX.value+Sl.x*u*.1,e.scrollY.value+Sl.y*u*.1);const y=e.screenToCell(wo,vo),x=e.autoFillState.value.sourceRange;if(y&&x){const H=Na(x,{col:y.col,row:y.row});H?e.autoFillState.value={...e.autoFillState.value,targetRange:H.targetRange,direction:H.direction}:e.autoFillState.value={...e.autoFillState.value,targetRange:null,direction:null}}h(),Dn=requestAnimationFrame(Go)}function Eo(){Dn!==null&&(cancelAnimationFrame(Dn),Dn=null),Sl=null}function qo(u,y){wo=u,vo=y;const x=e.screenToCell(u,y),H=e.autoFillState.value.sourceRange;if(x&&H){const f=Na(H,{col:x.col,row:x.row});f?e.autoFillState.value={...e.autoFillState.value,targetRange:f.targetRange,direction:f.direction}:e.autoFillState.value={...e.autoFillState.value,targetRange:null,direction:null}}const D=30,P=l.viewSize.w,Z=l.viewSize.h;let g=0,s=0;u<se()+D?g=-(se()+D-u):u>P-11-D&&(g=u-(P-11-D)),y<Se()+D?s=-(Se()+D-y):y>Z-11-D&&(s=y-(Z-11-D)),g!==0||s!==0?(Sl={x:g,y:s},Dn===null&&Ar()):(Sl=null,Dn!==null&&(cancelAnimationFrame(Dn),Dn=null)),h()}function jo(){Eo();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 Lr(u){var f;if(u.button!==0)return;u.preventDefault(),_e.value=null;const y=yl(u,l.canvasRef.value),x=Nn(y.x,y.y);if(x){if(e.editingCell.value){e.commitEdit().then(m=>{m&&_(x.col,x.row)});return}_(x.col,x.row);return}((f=Ge.value)==null?void 0:f.mode)==="edit"&&Bt();const H=N(y.x,y.y);if(H){je(H.row,H.col,"view"),l.emitModelData();return}else Ge.value&&Bt();const D=Be(y.x,y.y);if(D>=0){Ve(D);return}const P=Je(y.x,y.y);if(P){P.kind==="toggle"&&(e.toggleOutline(P.outlineId),h(),l.emitModelData());return}if(y.y<Se()&&y.x>=se()){const m=y.x-se()+e.scrollX.value,k=B(y.x),T=k>=0?e.cellToScreenRect(0,k).x+e.colWidths.value[k]:-1;if(k>=0&&Math.abs(y.x-T)<=4){o.saveUndo(),ln=!0,El=k,zn=e.colWidths.value[k],cn=m,h();return}}if(y.x<se()&&y.y>=Se()){const m=y.y-Se()+e.scrollY.value,k=R(y.y),T=k>=0?e.cellToScreenRect(k,0).y+e.getRowHeight(k):-1;if(k>=0&&Math.abs(y.y-T)<=4){o.saveUndo(),xn=!0,ul=k,zn=e.getRowHeight(k),cn=m,h();return}}if(ko(y.x,y.y)){const m=e.selection.value;m&&(e.autoFillState.value={active:!0,sourceRange:{...m},targetRange:null,direction:null,preview:!0},h());return}if(y.x<se()||y.y<Se()){{const m=l.formulaBarRef.value,k=!!(m&&typeof document<"u"&&document.activeElement===m);(e.editingCell.value||k||re)&&ae()}if(y.y<Se()&&y.x>=se()){const m=B(y.x);m>=0&&(e.selectRange(m,0,m,e.rowCount-1,"col"),kl=!0,sn=m,bn=0)}else if(y.x<se()&&y.y>=Se()){const m=R(y.y);m>=0&&(e.selectRange(0,m,e.colCount-1,m,"row"),kl=!0,sn=0,bn=m)}else y.x<se()&&y.y<Se()&&e.selectAll();h();return}const Z=e.screenToCell(y.x,y.y);if(!Z)return;const g=Z.col,s=Z.row;{const m=l.formulaBarRef.value,k=!!(m&&typeof document<"u"&&document.activeElement===m);(e.editingCell.value||k||re)&&ae()}if(u.shiftKey&&e.selection.value){const m=e.selection.value;e.selectRange(m.startCol,m.startRow,g,s)}else e.selectCell(g,s);kl=!0,sn=g,bn=s,l.focusEditInput(),h()}function Yo(u){if(ln){const Z=yl(u,l.canvasRef.value).x-se()+e.scrollX.value-cn,g=zn+Z;g>=30&&g<=1e3?e.colWidths.value[El]=g:g<30?e.colWidths.value[El]=30:e.colWidths.value[El]=1e3,h();return}if(xn){const Z=yl(u,l.canvasRef.value).y-Se()+e.scrollY.value-cn,g=zn+Z;g>=24&&g<=500?e.rowHeights.value[ul]=g:g<24?e.rowHeights.value[ul]=24:e.rowHeights.value[ul]=500,h();return}if(e.autoFillState.value.active){const P=yl(u,l.canvasRef.value);qo(P.x,P.y);return}if(!kl){const P=l.canvasRef.value;if(!P)return;if(o.paintFmt.value){P.style.cursor="copy";return}const Z=yl(u,P);if(N(Z.x,Z.y)&&(P.style.cursor="pointer"),et(Z.x,Z.y),Je(Z.x,Z.y)){P.style.cursor="pointer";return}if(Be(Z.x,Z.y)>=0){P.style.cursor="pointer";return}if(Nn(Z.x,Z.y)){P.style.cursor="pointer";return}if(Z.y<Se()&&Z.x>=se()){const g=B(Z.x),s=g>=0?e.cellToScreenRect(0,g).x+e.colWidths.value[g]:-1;if(g>=0&&Math.abs(Z.x-s)<=4){P.style.cursor="col-resize";return}}if(Z.x<se()&&Z.y>=Se()){const g=R(Z.y),s=g>=0?e.cellToScreenRect(g,0).y+e.getRowHeight(g):-1;if(g>=0&&Math.abs(Z.y-s)<=4){P.style.cursor="row-resize";return}}if(ko(Z.x,Z.y)){P.style.cursor="crosshair";return}P.style.cursor="cell";return}const y=yl(u,l.canvasRef.value);if(sn<0||bn<0)return;if(y.x<se()||y.y<Se()){if(y.y<Se()&&y.x>=se()){const P=B(y.x);P>=0&&e.selectRange(Math.min(sn,P),0,Math.max(sn,P),e.rowCount-1,"col")}else if(y.x<se()&&y.y>=Se()){const P=R(y.y);P>=0&&e.selectRange(0,Math.min(bn,P),e.colCount-1,Math.max(bn,P),"row")}h();return}const x=e.screenToCell(y.x,y.y);if(!x)return;const H=x.col,D=x.row;bn===0&&sn>=0&&e.selection.value&&e.selection.value.startRow===0&&e.selection.value.endRow===e.rowCount-1?e.selectRange(Math.min(sn,H),0,Math.max(sn,H),e.rowCount-1,"col"):sn===0&&bn>=0&&e.selection.value&&e.selection.value.startCol===0&&e.selection.value.endCol===e.colCount-1?e.selectRange(0,Math.min(bn,D),e.colCount-1,Math.max(bn,D),"row"):e.selectRange(sn,bn,H,D),h()}function $r(u){const y=ln||xn;if(kl=!1,ln=!1,xn=!1,y&&l.scheduleOptEmit(),e.autoFillState.value.active){jo();return}o.paintFmt.value&&o.applyPaintFormat()}function zr(){Eo();const u=ln||xn;kl=!1,ln=!1,xn=!1,u&&l.scheduleOptEmit()}function _r(u){u.preventDefault();const y=yl(u,l.canvasRef.value);if(y.x<se()&&y.y<Se()){xt(u);return}if(y.y<Se()&&y.x>=se()){const x=B(y.x);x>=0&&il(u,x);return}if(y.x<se()&&y.y>=Se()){const x=R(y.y);x>=0&&Tt(u,x);return}if(y.x>=se()&&y.y>=Se()){const x=e.screenToCell(y.x,y.y);x&&sl(u,x.col,x.row)}}function Hr(u){const y=yl(u,l.canvasRef.value);if(y.x<se()||y.y<Se())return;const x=e.screenToCell(y.x,y.y);if(!x)return;const H=x.col,D=x.row;{const P=l.formulaBarRef.value,Z=!!(P&&typeof document<"u"&&document.activeElement===P);(e.editingCell.value||Z||re)&&ae()}e.selectCell(H,D),e.ensureVisible(H,D),e.startEdit(),h(),l.focusEditInput()}function Wr(u){const y=e.scrollX.value+u.deltaX,x=e.scrollY.value+u.deltaY,H=40,D=l.maxScrollX.value,P=l.maxScrollY.value;if(y>=D-H&&u.deltaX>0||x>=P-H&&u.deltaY>0){const Z=Math.max(0,l.viewSize.w-28-11),g=Math.max(0,l.viewSize.h-28-11),s=Math.max(0,Math.ceil((y+Z)/100)+2),f=Math.max(0,Math.ceil((x+g)/24)+2);e.ensureCapacity(s,f)}l.clampScroll(y,x),h()}function Ro(u){if(u.touches.length!==1){on=!1;return}const y=u.touches[0],x=l.canvasRef.value;if(!x)return;const H=x.getBoundingClientRect(),D=y.clientX-H.left,P=y.clientY-H.top,Z=y.clientX,g=y.clientY,s=(m,k)=>({clientX:m,clientY:k,preventDefault(){}});{const m=l.formulaBarRef.value,k=!!(m&&typeof document<"u"&&document.activeElement===m);(e.editingCell.value||k||re)&&ae()}if(ko(D,P)){u.preventDefault();const m=e.selection.value;m&&(e.autoFillState.value={active:!0,sourceRange:{...m},targetRange:null,direction:null,preview:!0},on=!0,fl=!1,tn="cell",Rl=D,Il=P,Jl=e.scrollX.value,Ql=e.scrollY.value);return}const f=Be(D,P);if(f>=0){u.preventDefault(),Ve(f);return}if(P<Se()&&D>=se()){const m=B(D);if(m>=0){const k=e.cellToScreenRect(0,m).x+e.colWidths.value[m];if(Math.abs(D-k)<=8){u.preventDefault(),o.saveUndo(),ln=!0,El=m,zn=e.colWidths.value[m],cn=D-se()+e.scrollX.value,on=!0,fl=!1;return}}}if(D<se()&&P>=Se()){const m=R(P);if(m>=0){const k=e.cellToScreenRect(m,0).y+e.getRowHeight(m);if(Math.abs(P-k)<=8){u.preventDefault(),o.saveUndo(),xn=!0,ul=m,zn=e.getRowHeight(m),cn=P-Se()+e.scrollY.value,on=!0,fl=!1;return}}}D>=se()&&P>=Se()?(u.preventDefault(),on=!0,fl=!1,Qn=!1,ml=!1,tn="cell",Rl=D,Il=P,Jl=e.scrollX.value,Ql=e.scrollY.value,St=B(D),Mt=R(P),qt!==null&&clearTimeout(qt),qt=window.setTimeout(()=>{const m=e.selection.value;if(!!m&&St>=m.startCol&&St<=m.endCol&&Mt>=m.startRow&&Mt<=m.endRow){ml=!0,sl(s(Z,g),St,Mt);return}Qn=!0,_n=St,Vn=Mt,St>=0&&Mt>=0&&(e.selectCell(St,Mt),h())},450)):D>=0&&P>=0&&(D<se()||P<Se())&&(u.preventDefault(),on=!0,fl=!1,Qn=!1,Rl=D,Il=P,Jl=e.scrollX.value,Ql=e.scrollY.value,P<Se()&&D>=se()?(tn="col",St=B(D),Mt=-1):D<se()&&P>=Se()?(tn="row",Mt=R(P),St=-1):(tn="all",St=-1,Mt=-1),(tn==="col"||tn==="row"||tn==="all")&&(qt!==null&&clearTimeout(qt),qt=window.setTimeout(()=>{const m=e.selection.value;if(tn==="all"){ml=!0,xt(s(Z,g));return}if(tn==="col"){if(!!m&&m.startRow===0&&m.endRow===e.rowCount-1&&St>=m.startCol&&St<=m.endCol){ml=!0,il(s(Z,g),St);return}Qn=!0,_n=St,Vn=-1,St>=0&&(e.selectRange(St,0,St,e.rowCount-1,"col"),h())}else{if(!!m&&m.startCol===0&&m.endCol===e.colCount-1&&Mt>=m.startRow&&Mt<=m.endRow){ml=!0,Tt(s(Z,g),Mt);return}Qn=!0,_n=-1,Vn=Mt,Mt>=0&&(e.selectRange(0,Mt,e.colCount-1,Mt,"row"),h())}},450)))}function Ur(u){if(!on||u.touches.length!==1)return;const y=u.touches[0],x=l.canvasRef.value;if(!x)return;const H=x.getBoundingClientRect(),D=y.clientX-H.left,P=y.clientY-H.top;if(e.autoFillState.value.active){u.preventDefault(),qo(D,P);return}if(ln){const Z=D-se()+e.scrollX.value-cn;let g=zn+Z;g=g<30?30:g>1e3?1e3:g,e.colWidths.value[El]=g,u.preventDefault(),h();return}if(xn){const Z=P-Se()+e.scrollY.value-cn;let g=zn+Z;g=g<24?24:g>500?500:g,e.rowHeights.value[ul]=g,u.preventDefault(),h();return}if(Qn){if(u.preventDefault(),_n>=0&&Vn>=0){const Z=B(D),g=R(P);Z>=0&&g>=0&&(e.selectRange(_n,Vn,Z,g),h())}else if(Vn===-1&&_n>=0){const Z=B(D);Z>=0&&(e.selectRange(Math.min(_n,Z),0,Math.max(_n,Z),e.rowCount-1,"col"),h())}else if(_n===-1&&Vn>=0){const Z=R(P);Z>=0&&(e.selectRange(0,Math.min(Vn,Z),e.colCount-1,Math.max(Vn,Z),"row"),h())}return}qt!==null&&(clearTimeout(qt),qt=null),(Math.abs(D-Rl)>8||Math.abs(P-Il)>8)&&(fl=!0,u.preventDefault(),l.clampScroll(Jl+(Rl-D),Ql+(Il-P)),h())}function Xo(){if(on){if(qt!==null&&(clearTimeout(qt),qt=null),ml){ml=!1,on=!1;return}if(e.autoFillState.value.active){jo(),on=!1;return}if(ln||xn){ln=!1,xn=!1,l.scheduleOptEmit(),o.paintFmt.value&&o.applyPaintFormat(),on=!1;return}if(Qn){Qn=!1,o.paintFmt.value&&o.applyPaintFormat(),on=!1;return}if(on=!1,!fl){if(tn==="cell"&&St>=0&&Mt>=0){const u=Date.now();St===Tn&&Mt===eo&&u-Co<300?(e.selectCell(St,Mt),e.startEdit(),h(),l.focusEditInput(),Co=0):(e.commitEdit(),e.selectCell(St,Mt),h(),Co=u),Tn=St,eo=Mt,l.focusEditInput()}else tn==="col"&&St>=0?(e.commitEdit(),e.selectRange(St,0,St,e.rowCount-1,"col"),h()):tn==="row"&&Mt>=0?(e.commitEdit(),e.selectRange(0,Mt,e.colCount-1,Mt,"row"),h()):tn==="all"&&(e.commitEdit(),e.selectAll(),h());o.paintFmt.value&&!e.editingCell.value&&o.applyPaintFormat()}}}function So(u){return u.isComposing||u.key==="Process"||u.keyCode===229}function Zo(u){return u.key.length===1&&!u.ctrlKey&&!u.metaKey&&!u.altKey}function Jo(u){if(e.autoFillState.value.active){u.key==="Escape"&&(u.preventDefault(),Eo(),e.autoFillState.value={active:!1,sourceRange:null,targetRange:null,direction:null,preview:!1},h());return}if(e.editingCell.value)return;const y=u.ctrlKey||u.metaKey,x=u.shiftKey;switch(!0){case(u.altKey&&u.key==="ArrowDown"):u.preventDefault(),_(e.activeCell.value.col,e.activeCell.value.row);return;case(y&&(u.key==="c"||u.key==="C")):u.preventDefault(),n.copyToClipboard();return;case(y&&(u.key==="x"||u.key==="X")):u.preventDefault(),n.cutSelected();return;case(y&&(u.key==="z"||u.key==="Z")):u.preventDefault(),o.undo();return;case(y&&(u.key==="y"||u.key==="Y")):u.preventDefault(),o.redo();return;case(y&&(u.key==="v"||u.key==="V")):u.preventDefault(),o.saveUndo(),n.pasteFromClipboard().then(()=>{h(),t.nextTick(()=>l.emitModelData())});return;case(y&&(u.key==="a"||u.key==="A")):u.preventDefault(),e.selectAll(),h();return;case(y&&x&&(u.key==="l"||u.key==="L")):u.preventDefault(),e.toggleAutoFilter(),h();return;case(y&&u.key==="Home"):u.preventDefault(),e.selectCell(0,0),e.ensureVisible(0,0),h();return;case(y&&u.key==="End"):u.preventDefault(),e.selectCell(e.colCount-1,e.rowCount-1),e.ensureVisible(e.colCount-1,e.rowCount-1),h();return;case u.key==="Home":u.preventDefault(),e.selectCell(0,e.activeCell.value.row),e.ensureVisible(0,e.activeCell.value.row),h();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),h();return;case u.key==="ArrowUp":u.preventDefault(),e.moveActive(0,-1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),h();return;case u.key==="ArrowDown":u.preventDefault(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),h();return;case u.key==="ArrowLeft":u.preventDefault(),e.moveActive(-1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),h();return;case u.key==="ArrowRight":u.preventDefault(),e.moveActive(1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),h();return;case u.key==="Tab":u.preventDefault(),e.moveActive(x?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),h();return;case u.key==="Enter":u.preventDefault(),e.moveActive(0,x?-1:1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),h();return;case u.key==="F2":u.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),h(),l.focusEditInput();return;case(x&&u.key==="F2"):u.preventDefault(),Yt(e.activeCell.value.row,e.activeCell.value.col);return;case u.key==="Delete":case u.key==="Backspace":u.preventDefault(),o.saveUndo(),n.clearSelected(),h();return;case u.key==="Escape":u.preventDefault(),e.cancelEdit(),o.paintFmt.value=null,h();return;case Zo(u):if(So(u)){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),h(),l.focusEditInput();return}u.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(u.key),h(),t.nextTick(()=>{const H=l.editInputRef.value;H&&(H.focus(),H.setSelectionRange(1,1))});return}}let Mo=!1,No=!1;function Qo(u){const y=u.target.value;if(!e.editingCell.value){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(y),ze.value=y,h();return}e.editValue.value=y,ze.value=y}function er(){Mo=!0,e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),ze.value="",h())}function Pr(u){Mo=!1,No=!0,setTimeout(()=>{No=!1},0);const y=u.target.value;e.editValue.value=y,ze.value=y}function Kr(u){if(!e.editingCell.value){if(Zo(u)||So(u))return;Jo(u);return}if(!(Mo||So(u))&&!(No&&(u.key==="Enter"||u.key==="Escape")))if(u.key==="Enter"&&(u.altKey||u.metaKey)){u.preventDefault();const y=l.editInputRef.value;if(!y)return;const x=y.selectionStart??y.value.length,H=y.selectionEnd??y.value.length,D=y.value,P=D.slice(0,x)+`
9
- `+D.slice(H);e.editValue.value=P,y.value=P,y.selectionStart=y.selectionEnd=x+1,h()}else u.key==="Enter"?(u.preventDefault(),e.commitEdit().then(y=>{if(!y){h(),l.focusEditInput();return}e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),h(),l.focusEditInput()})):u.key==="Tab"?(u.preventDefault(),e.commitEdit().then(y=>{if(!y){h(),l.focusEditInput();return}e.moveActive(u.shiftKey?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),h(),l.focusEditInput()})):u.key==="Escape"&&(u.preventDefault(),e.cancelEdit(),h(),l.focusEditInput())}function Gr(u){e.editingCell.value}function to(){setTimeout(()=>{e.isValidationAlertOpen()||e.editingCell.value&&e.commitEdit().then(()=>h())},0)}let dn=null;function Ol(){var y;const u=(y=l.wrapperRef.value)==null?void 0:y.getBoundingClientRect();if(u){const x=Bl(e.props.width),H=Bl(e.props.height);x!=null?l.viewSize.w=x:l.viewSize.w=u.width,H!=null?l.viewSize.h=H:l.viewSize.h=u.height}l.clampScroll(null,null),h()}function qr(){t.onMounted(()=>{const u=Bl(e.props.width),y=Bl(e.props.height);(u==null||y==null)&&(dn=new ResizeObserver(()=>Ol()),l.wrapperRef.value&&dn.observe(l.wrapperRef.value)),t.nextTick(()=>{Ol(),l.focusEditInput()}),e.selectCell(0,0),l.modelData.value&&l.modelData.value.length>0&&(a.value=JSON.stringify(l.modelData.value),l.sheets.value=l.modelData.value.map(x=>{const H=l.mkSheet(x.name,{colCount:x.colCount,rowCount:x.rowCount}),{cells:D,styles:P}=Ya(x.cells);if(Object.assign(H.cells,D),H.styles=x.styles??P,x.borders)H.borders=x.borders;else{const Z=Xa(H.styles);H.styles=Z.styles,H.borders=Z.borders}if(x.colWidths)for(const[Z,g]of Object.entries(x.colWidths)){const s=Number(Z);s>=0&&s<(H.colCount??e.colCount)&&g>=30&&(H.colWidths[s]=g)}if(x.rowHeights)for(const[Z,g]of Object.entries(x.rowHeights)){const s=Number(Z);s>=0&&s<(H.rowCount??e.rowCount)&&g>=24&&(H.rowHeights[s]=g)}if(x.merges)for(const[Z,g]of Object.entries(x.merges))H.merges[Z]={...g};return H.freeze=x.freeze?{rows:x.freeze.rows,cols:x.freeze.cols}:{rows:0,cols:0},H.filter=ai(x.filter,H.cells),H.dataValidations=Array.isArray(x.dataValidations)?[...x.dataValidations]:[],H.notes=x.notes?Object.fromEntries(Object.entries(x.notes).map(([Z,g])=>[Z,{...g}])):{},H}),l.sheets.value.length>0&&l.loadSheet(0))}),t.watch(()=>[e.props.width,e.props.height],()=>{const u=Bl(e.props.width),y=Bl(e.props.height);u!=null&&y!=null?(dn==null||dn.disconnect(),dn=null):!dn&&l.wrapperRef.value&&(dn=new ResizeObserver(()=>Ol()),dn.observe(l.wrapperRef.value)),t.nextTick(()=>Ol())}),t.watch(()=>e.props.theme,()=>h()),t.watch(()=>({...e.cells}),()=>t.nextTick(()=>l.emitModelData()),{deep:!1}),t.watch(()=>({...e.merges}),()=>{t.nextTick(()=>l.emitModelData()),h()},{deep:!1}),t.watch(l.activeSheetIndex,()=>t.nextTick(()=>l.emitModelData())),t.watch(()=>l.modelData.value,u=>{if(!u||u.length===0)return;const y=JSON.stringify(u);if(y===a.value)return;a.value=y;const x=e.selection.value?{...e.selection.value}:null,H={...e.activeCell.value};l.sheets.value=u.map(g=>{const s=l.mkSheet(g.name),{cells:f,styles:m}=Ya(g.cells);if(Object.assign(s.cells,f),s.styles=g.styles??m,g.borders)s.borders=g.borders;else{const k=Xa(s.styles);s.styles=k.styles,s.borders=k.borders}if(g.colWidths)for(const[k,T]of Object.entries(g.colWidths)){const L=Number(k);L>=0&&L<e.colCount&&T>=30&&(s.colWidths[L]=T)}if(g.rowHeights)for(const[k,T]of Object.entries(g.rowHeights)){const L=Number(k);L>=0&&L<e.rowCount&&T>=24&&(s.rowHeights[L]=T)}if(g.merges)for(const[k,T]of Object.entries(g.merges))s.merges[k]={...T};return s.freeze=g.freeze?{rows:g.freeze.rows,cols:g.freeze.cols}:{rows:0,cols:0},s.filter=ai(g.filter,s.cells),s.dataValidations=Array.isArray(g.dataValidations)?[...g.dataValidations]:[],s.rowOutlines=Array.isArray(g.rowOutlines)?g.rowOutlines.map(k=>({...k})):[],s.columnOutlines=Array.isArray(g.columnOutlines)?g.columnOutlines.map(k=>({...k})):[],s.notes=g.notes?Object.fromEntries(Object.entries(g.notes).map(([k,T])=>[k,{...T}])):{},s}),l.sheets.value.length>0&&l.loadSheet(0),x&&(e.selection.value=x),e.activeCell.value=H;const D=e.activeCell.value,P=e.selection.value,Z=e.findMerge(D.col,D.row);Z&&Z.anchor===e.cellKey(D.col,D.row)&&(!P||P.startCol===D.col&&P.startRow===D.row&&P.endCol===D.col&&P.endRow===D.row)&&e.selectCell(D.col,D.row),h()},{deep:!0}),t.onBeforeUnmount(()=>{dn==null||dn.disconnect()})}return{scheduleRender:h,render:rt,renderFrozenOverlay:O,activeCellLabel:we,formulaBarDisplay:xe,formulaBarDraft:ze,formulaBarExpanded:le,onFormulaBarFocus:ce,onFormulaBarInput:Fe,onFormulaBarKeydown:ve,onFormulaBarBlur:Me,acceptFormulaBarEdit:ae,cancelFormulaBarEdit:oe,insertFunctionIntoCell:V,renTab:q,renTabVal:$,onTabClick:Y,onTabDblClick:W,commitTabRename:fe,cclTabRename:Ae,onTabRenameKd:Re,ctxMenu:_e,ctxSubmenuLeft:p,filterPopup:te,isFilterButtonHit:Be,openFilterPopup:Ve,closeFilterPopup:He,validationDropdown:vt,isValidationDropdownHit:Nn,openValidationDropdown:_,closeValidationDropdown:z,onValidationDropdownSelect:G,onCtxItemEnter:S,onTabCtxMenu:mt,onTabBarCtx:Ot,onCornerCtx:xt,onRowHdrCtx:Tt,onColHdrCtx:il,onCellCtx:sl,noteUi:Ge,openNote:je,closeNote:Bt,editNoteAt:Yt,saveNoteAt:Vt,removeNoteAt:zt,isNoteIndicatorHit:N,dimInputRef:Gl,dimPanel:Jn,openDimPanel:mo,onDimInput:Br,onDimKeydown:xr,onDimBlur:Tr,applyDimPanel:Po,closeDimPanel:ql,outlineGroupRows:()=>U("row"),outlineGroupCols:()=>U("column"),outlineUngroupRows:()=>ne("row"),outlineUngroupCols:()=>ne("column"),outlineExpandRows:()=>ke("row",!1),outlineCollapseRows:()=>ke("row",!0),outlineExpandCols:()=>ke("column",!1),outlineCollapseCols:()=>ke("column",!0),get showOutlineAlert(){return d},set showOutlineAlert(u){d=u},editInputStyle:Vr,hScrollbarW:Yl,vScrollbarH:ho,hScrollbarLeft:Dr,vScrollbarTop:Fr,hTrackW:Dl,vTrackH:vl,hThumbW:Xl,hThumbL:go,vThumbH:Zl,vThumbT:bo,onVStart:Ir,onHStart:Or,onSbMove:gn,onSbUp:dl,onVTrk:Ko,onHTrk:yo,onMouseDown:Lr,onMouseMove:Yo,onMouseUp:$r,onMouseLeave:zr,onCanvasCtx:_r,onDblClick:Hr,onWheel:Wr,onTouchStart:Ro,onTouchMove:Ur,onTouchEnd:Xo,onKeydown:Jo,onEditInput:Qo,onEditCompositionStart:er,onEditCompositionEnd:Pr,onEditKd:Kr,onEditPaste:Gr,onEditBlur:to,applySize:Ol,setupLifecycle:qr}}function bp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ii(e,o,n,l){return o?l?n?e===o:e.toLowerCase()===o.toLowerCase():n?e.includes(o):e.toLowerCase().includes(o.toLowerCase()):!1}function yp(e,o,n,l){if(!o)return e;if(l){const i=e.indexOf(o);return i<0?e:e.slice(0,i)+n+e.slice(i+o.length)}const a=e.toLowerCase().indexOf(o.toLowerCase());return a<0?e:e.slice(0,a)+n+e.slice(a+o.length)}function Cp(e,o,n,l){return o?l?e.indexOf(o)<0?e:e.split(o).join(n):e.toLowerCase().indexOf(o.toLowerCase())<0?e:e.replace(new RegExp(bp(o),"gi"),()=>n):e}function Nr(e,o,n,l,a,i,r){const c=[];if(r){for(let d=r.startRow;d<=r.endRow;d++)for(let b=r.startCol;b<=r.endCol;b++){const C=e[n(b,d)];C&&ii(C.value,l,a,i)&&c.push({sheetIndex:o,col:b,row:d})}return c}for(const d in e){const b=e[d];if(b&&ii(b.value,l,a,i)){const C=d.split(","),v=Number(C[0]),h=Number(C[1]);!Number.isNaN(v)&&!Number.isNaN(h)&&c.push({sheetIndex:o,col:v,row:h})}}return c}function wp(e,o,n,l){const a=t.ref(!1),i=t.ref(""),r=t.ref(""),c=t.ref("sheet"),d=t.ref(!1),b=t.ref(!1),C=t.ref(-1),v=t.ref([]),h=t.ref(""),B=t.ref(0),R=t.ref(""),F=t.computed(()=>{const le=new Set,xe=n.activeSheetIndex.value;for(const ce of v.value)ce.sheetIndex===xe&&le.add(`${ce.col},${ce.row}`);return le}),Q=t.computed(()=>{if(C.value<0||C.value>=v.value.length)return null;const le=v.value[C.value];return le.sheetIndex!==n.activeSheetIndex.value?null:`${le.col},${le.row}`});e.findHighlight=(le,xe)=>{const ce=`${le},${xe}`;return Q.value===ce?"active":F.value.has(ce)?"match":null};function K(le){var Fe,V;const xe=e.cellKey(le.col,le.row);if(le.sheetIndex===n.activeSheetIndex.value)return((Fe=e.cells[xe])==null?void 0:Fe.value)??"";const ce=n.sheets.value[le.sheetIndex];return((V=ce==null?void 0:ce.cells[xe])==null?void 0:V.value)??""}function Ee(le,xe){const ce=e.cellKey(le.col,le.row);if(le.sheetIndex===n.activeSheetIndex.value)e.setCellValue(le.col,le.row,xe);else{const Fe=n.sheets.value[le.sheetIndex];if(!Fe)return;const V=Fe.cells[ce];Fe.cells[ce]={value:String(xe),styleId:V==null?void 0:V.styleId}}}function ee(){if(R.value){h.value=R.value;return}if(!i.value){h.value="";return}if(c.value==="selection"&&!e.selection.value){h.value=w(e.locale.value,"findNeedSelection");return}if(v.value.length===0){h.value=w(e.locale.value,"findNoResult");return}h.value=""}function pe(){const le=i.value,xe=[];if(le)if(c.value==="workbook")n.sheets.value.forEach((ce,Fe)=>{xe.push(...Nr(ce.cells,Fe,e.cellKey,le,d.value,b.value))});else if(c.value==="selection"){const ce=e.selection.value;ce&&xe.push(...Nr(e.cells,n.activeSheetIndex.value,e.cellKey,le,d.value,b.value,ce))}else xe.push(...Nr(e.cells,n.activeSheetIndex.value,e.cellKey,le,d.value,b.value));v.value=xe,xe.length===0?C.value=-1:C.value>=xe.length?C.value=xe.length-1:C.value<0&&(C.value=0),ee()}function ie(){if(C.value<0||C.value>=v.value.length)return;const le=v.value[C.value];le.sheetIndex!==n.activeSheetIndex.value&&n.switchSheet(le.sheetIndex),c.value==="selection"?e.activeCell.value={col:le.col,row:le.row}:e.selectCell(le.col,le.row),e.ensureVisible(le.col,le.row)}const me=typeof requestAnimationFrame=="function"?requestAnimationFrame:le=>setTimeout(le,16);let se=!1,Se=!1;function Xe(le){if(se){Se=Se||le;return}se=!0,Se=le,me(()=>{var xe;se=!1,pe(),Se&&v.value.length>0&&C.value>=0&&ie(),Se=!1,(xe=e.scheduleRender)==null||xe.call(e)})}function Qe(){var le;a.value=!0,B.value++,pe(),v.value.length>0&&(C.value=0,ie()),(le=e.scheduleRender)==null||le.call(e)}function X(){Qe()}function rt(){var le;a.value=!1,v.value=[],C.value=-1,R.value="",h.value="",(le=e.scheduleRender)==null||le.call(e)}function O(){var le;v.value.length!==0&&(C.value=(C.value+1)%v.value.length,ie(),(le=e.scheduleRender)==null||le.call(e))}function I(){var le;v.value.length!==0&&(C.value=(C.value-1+v.value.length)%v.value.length,ie(),(le=e.scheduleRender)==null||le.call(e))}function j(){var V,J;if(C.value<0||C.value>=v.value.length)return;const le=v.value[C.value],xe=K(le),ce=yp(xe,i.value,r.value,d.value);if(ce===xe)return;o.saveUndo(),Ee(le,ce);const Fe=C.value;pe(),v.value.length>0?(C.value=Math.min(Fe,v.value.length-1),O()):C.value=-1,(V=e.emitModelData)==null||V.call(e),(J=e.scheduleRender)==null||J.call(e)}function we(){var Fe,V;const le=i.value;if(!le||v.value.length===0)return;o.saveUndo();let xe=0;const ce=v.value.slice();for(const J of ce){const re=K(J),ae=Cp(re,le,r.value,d.value);ae!==re&&(Ee(J,ae),xe++)}v.value=[],C.value=-1,R.value=w(e.locale.value,"findReplacedAll").replace("{n}",String(xe)),ee(),(Fe=e.emitModelData)==null||Fe.call(e),(V=e.scheduleRender)==null||V.call(e)}function ze(){const le=xe=>{if(!(xe.ctrlKey||xe.metaKey))return;const Fe=xe.key.toLowerCase();(Fe==="f"||Fe==="h")&&(xe.preventDefault(),Qe())};window.addEventListener("keydown",le),t.onBeforeUnmount(()=>window.removeEventListener("keydown",le))}return t.watch(i,()=>{a.value&&(R.value="",C.value=0,Xe(!0))}),t.watch([c,d,b],()=>{a.value&&(R.value="",C.value=0,Xe(!0))}),t.watch(e.cells,()=>{a.value&&Xe(!1)},{deep:!0}),t.watch(()=>e.selection.value,()=>{a.value&&c.value==="selection"&&(C.value=0,Xe(!0))}),t.watch([()=>o.undoStack.value.length,()=>o.redoStack.value.length],()=>{a.value&&Xe(!1)}),{open:a,findText:i,replaceText:r,scope:c,matchCase:d,matchEntireCell:b,currentIndex:C,results:v,message:h,focusToken:B,activeSheetMatches:F,activeMatchKey:Q,openFind:Qe,openReplace:X,close:rt,recompute:pe,findNext:O,findPrev:I,replace:j,replaceAll:we,setupLifecycle:ze}}const vp={class:"formula-bar__cell-label"},kp={class:"formula-bar__buttons"},Ep=["title","aria-label"],Rp=["rows","value"],Sp=["title"],Mp={key:0,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},Np={key:1,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},Bp=["value"],xp={key:2,class:"sb-corner"},Tp=["onClick","onMouseenter"],Vp={class:"context-menu__label"},Dp={key:0,class:"context-menu__arrow",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"22869"},Fp=["onClick"],Ip={key:0,class:"cf-modal-mask"},Op={key:0,class:"cf-modal-mask"},Ap={class:"dim-panel__title"},Lp={class:"dim-panel__body"},$p=["value"],zp={key:0,class:"dim-panel__error"},_p={class:"dim-panel__footer"},si=Dt(t.defineComponent({__name:"spreader",props:t.mergeModels({rowCount:{default:200},colCount:{default:26},width:{},height:{},theme:{default:"light"},locale:{default:"zh-CN"},noteAuthor:{default:jr}},{data:{default:()=>[]},dataModifiers:{}}),emits:["update:data"],setup(e){const o=e,n=t.useModel(e,"data"),l={value:""},a=lp(o,{rowCount:o.rowCount,colCount:o.colCount,theme:o.theme,locale:o.locale}),i={sheets:t.ref([]),activeSheetIndex:t.ref(0),saveSheet:()=>{},loadSheet:M=>{},mkSheet:M=>({id:"",name:M,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=op(a,i),c=ap(a,r);rp(r,{borderMenuOpen:c.borderMenuOpen,mergeMenuOpen:c.mergeMenuOpen});const d=hp(a,r,n,void 0,l);i.sheets=d.sheets,i.activeSheetIndex=d.activeSheetIndex,i.saveSheet=d.saveSheet,i.loadSheet=d.loadSheet,i.mkSheet=d.mkSheet;const b=gp(a,r,c,d,l);b.setupLifecycle();const C=wp(a,r,d);C.setupLifecycle();const v=t.reactive(a),h=t.reactive(r),B=t.reactive(c),R=t.reactive(d),F=d.sheets,Q=d.activeSheetIndex,K=d.sortMenuOpen,Ee=d.cachedSortOrder,ee=t.ref(!1),pe=t.ref(!1),ie=t.ref(!1),me=t.ref(!1),se=t.ref(!1),Se=t.ref(!1),Xe=t.ref(!1),Qe=t.computed(()=>{const M=v.selection;return M?M.startCol===0&&M.endCol===v.colCount-1?"rows":M.startRow===0&&M.endRow===v.rowCount-1?"cols":null:null}),X=t.reactive(b),rt=t.reactive(C),O=t.computed(()=>{const M=v.selection;return!!M&&M.startCol===M.endCol&&M.startRow===M.endRow}),I=t.computed(()=>{const M=v.selection;return M?d.canSortColumns(M.startCol,M.endCol):!1}),j=t.computed(()=>{if(v.getFilter()!==null)return!0;const M=v.selection;if(!M)return!0;const p=Math.min(M.startCol,M.endCol),S=Math.max(M.startCol,M.endCol),ot=Math.min(M.startRow,M.endRow),mt=Math.max(M.startRow,M.endRow);for(const Ot in v.merges){const xt=v.merges[Ot];if(!(xt.startCol===xt.endCol&&xt.startRow===xt.endRow)&&p<=xt.endCol&&S>=xt.startCol&&ot<=xt.endRow&&mt>=xt.startRow)return!1}return!0}),we=t.computed(()=>{const M=h.selNumberFormat;if(M!==jn&&M!==ll)return M;const p=v.activeCell,S=a.resolveStyle(v.cells[v.cellKey(p.col,p.row)]);return typeof(S==null?void 0:S.numberFormat)=="string"?S.numberFormat:""});function ze(M){r.nfDialogOpen.value=M}const le=t.ref(!1);function xe(){le.value=!0}function ce(M){le.value=M}function Fe(M){b.insertFunctionIntoCell(M)}function V(){v.toggleAutoFilter(),X.scheduleRender()}function J(M){const p=v.getFilter();return p?v.getCellValue(M,p.range.startRow):""}const re=t.computed(()=>{const M=v.selection,p=M?M.startRow:v.activeCell.row,S=M?M.startCol:v.activeCell.col;return p===0&&S===0});function ae(M){const p=v.freeze;if(M==="panes"){const S=v.selection,ot=S?S.startRow:v.activeCell.row,mt=S?S.startCol:v.activeCell.col;v.setFreeze(ot,mt)}else M==="firstRow"?v.setFreeze(1,p.cols):M==="firstCol"?v.setFreeze(p.rows,1):M==="unfreeze"&&v.clearFreeze();X.scheduleRender()}const oe=t.ref(null),ve=t.ref(!1),Me=t.ref(!1),q=t.ref(null),$=t.ref("create"),Y=t.computed(()=>{const M=v.selection;if(M){const S=ut(M.startCol)+(M.startRow+1),ot=ut(M.endCol)+(M.endRow+1);return M.startCol===M.endCol&&M.startRow===M.endRow?S:`${S}:${ot}`}const p=v.activeCell;return ut(p.col)+(p.row+1)});function W(M){var ot;let p;["equal","notEqual","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual","between","notBetween"].includes(M)?p={type:"cellIs",operator:M,value:""}:M==="textContains"?p={type:"textContains",value:""}:M==="textNotContains"?p={type:"textNotContains",value:""}:M==="blank"?p={type:"blank"}:M==="notBlank"?p={type:"notBlank"}:M==="duplicate"?p={type:"duplicate"}:M==="unique"?p={type:"unique"}:p={type:"cellIs",operator:"greaterThan",value:""},q.value={id:"",condition:p,format:{backgroundColor:"#DEEBF7",color:"#17375E"},ranges:[],priority:0,stopIfTrue:!1,enabled:!0},$.value="create",(ot=oe.value)==null||ot.closeOverflow(),Me.value=!0}function fe(){var M;q.value={id:"",condition:{type:"cellIs",operator:"greaterThan",value:""},format:{backgroundColor:"#DEEBF7",color:"#17375E"},ranges:[],priority:0,stopIfTrue:!1,enabled:!0},$.value="create",(M=oe.value)==null||M.closeOverflow(),Me.value=!0}function Ae(){var M;(M=oe.value)==null||M.closeOverflow(),ve.value=!0}function Re(M){v.clearConditionalFormats(M),X.scheduleRender()}function _e(M){M.id?v.updateConditionalFormatRule(M.id,M):v.addConditionalFormatRule(M),Me.value=!1}function Ge(M){var p;q.value=M,$.value="edit",(p=oe.value)==null||p.closeOverflow(),Me.value=!0}function Le(M){v.removeConditionalFormatRule(M)}function ht(M,p){v.moveConditionalFormatRule(M,p)}function bt(M,p){v.updateConditionalFormatRule(M,{enabled:p})}const je=t.ref(!1),Bt=t.ref(null),Yt=t.ref("create"),Vt=t.computed(()=>{const M=v.selection;if(M){const S=ut(M.startCol)+(M.startRow+1),ot=ut(M.endCol)+(M.endRow+1);return M.startCol===M.endCol&&M.startRow===M.endRow?S:`${S}:${ot}`}const p=v.activeCell;return ut(p.col)+(p.row+1)}),zt=t.ref(null);let et=null;function N(M){return new Promise(p=>{et=p,zt.value={...M}})}a.showValidationAlert=N;const te=t.ref(null);function vt(M){te.value=M}function It(){te.value=null}b.showOutlineAlert=vt,a.getSheetCellsById=M=>{const p=d.sheets.value.findIndex(S=>S.id===M||S.name===M);return p<0?null:p===d.activeSheetIndex.value?a.cells:d.sheets.value[p].cells},a.requestDataValidationDialog=()=>Et();function Et(){var S;const M=v.activeCell,p=a.getDataValidationRule(M.row,M.col);Bt.value=p?JSON.parse(JSON.stringify(p)):null,Yt.value=p?"edit":"create",(S=oe.value)==null||S.closeOverflow(),je.value=!0}function Sn(M){if(M.type==="any"){M.ranges.forEach(p=>a.clearDataValidation(p)),je.value=!1,b.scheduleRender();return}M.id?a.updateDataValidation(M.id,M):a.createDataValidation(M),je.value=!1,b.scheduleRender()}function en(){const M=v.selection;M&&a.clearDataValidation(M),je.value=!1,b.scheduleRender()}function Xt(M){zt.value=null;const p=et;et=null,t.nextTick(()=>{const S=v.editingCell;S&&(a.selectCell(S.col,S.row),a.ensureVisible(S.col,S.row),b.scheduleRender(),d.focusEditInput())}),p==null||p(M)}const Zt=t.computed(()=>{const M=v.activeCell,p=a.getValidationInputMessage(M.row,M.col);if(!p)return null;const S=a.cellToScreenRect(M.row,M.col),ot=d.wrapperRef.value,mt=ot?ot.getBoundingClientRect():{left:0,top:0};return{title:p.title,message:p.message,x:mt.left+S.x,y:mt.top+S.y,width:S.width,height:S.height}}),Mn=t.computed(()=>{const M=b.noteUi.value;if(!M)return null;const p=a.cellToScreenRect(M.row,M.col);return{x:p.x,y:p.y,width:p.width,height:p.height}}),Nn=t.computed(()=>{const M=b.noteUi.value;return M?a.getNote(M.row,M.col)??null:null}),_=t.computed(()=>w(v.locale,"notePlaceholder")),z=t.computed(()=>{const M=b.noteUi.value;if(!M)return!1;const p=v.freeze;return M.row<p.rows&&M.col<p.cols});function G(M){r.fontSizeMenuOpen.value=M}function ye(M){r.textColorMenuOpen.value=M}function Be(M){r.fillColorMenuOpen.value=M}function Ve(M){switch(M){case"group-rows":b.outlineGroupRows();break;case"group-cols":b.outlineGroupCols();break;case"ungroup-rows":b.outlineUngroupRows();break;case"ungroup-cols":b.outlineUngroupCols();break;case"clear-rows":a.clearRowGroups();break;case"clear-cols":a.clearColumnGroups();break;case"expand-rows":b.outlineExpandRows();break;case"expand-cols":b.outlineExpandCols();break;case"collapse-rows":b.outlineCollapseRows();break;case"collapse-cols":b.outlineCollapseCols();break}}function He(M){b.renTabVal.value=M}function Ce(){b.ctxMenu.value=null}const Oe=M=>{d.formulaBarRef.value=M};function be(){b.formulaBarExpanded.value=!b.formulaBarExpanded.value}const Je=t.ref(null),E=M=>{d.wrapperRef.value=M,Je.value=M},U=M=>{d.canvasRef.value=M},ne=M=>{d.freezeCanvasRef.value=M},ke=M=>{d.editInputRef.value=M},Ne=M=>{b.dimInputRef.value=M};return(M,p)=>(t.openBlock(),t.createElementBlock("div",{class:"spreadsheet-outer",style:t.normalizeStyle(R.outerStyle)},[t.createVNode(Fd,{ref_key:"toolbarRef",ref:oe,locale:v.locale,"can-undo":h.canUndo,"can-redo":h.canRedo,"paint-fmt-active":h.paintFmt!==null,"has-selection":h.hasSelection,"font-family-options":h.fontFamilyOptions,"font-size-options":h.fontSizeOptions,"sel-font-family":h.selFontFamily,"sel-font-size":h.selFontSize,"font-size-input":h.fontSizeInput,"font-size-menu-open":h.fontSizeMenuOpen,"sel-font-weight":h.selFontWeight,"sel-font-style":h.selFontStyle,"sel-underline":h.selUnderline,"sel-strikethrough":h.selStrikethrough,"sel-text-color":h.selTextColor,"text-color-menu-open":h.textColorMenuOpen,"sel-fill-color":h.selFillColor,"fill-color-menu-open":h.fillColorMenuOpen,"cached-text-color":h.cachedTextColor,"cached-fill-color":h.cachedFillColor,"border-menu-open":B.borderMenuOpen,"cached-border":B.cachedBorder,"sort-menu-open":t.unref(K),"cached-sort-order":t.unref(Ee),"can-sort":I.value,"outline-menu-open":ee.value,"outline-axis":Qe.value,"can-filter":j.value,"filter-active":v.getFilter()!==null,"h-align-options":h.hAlignOptions,"v-align-options":h.vAlignOptions,"sel-h-align":h.selHAlign,"sel-v-align":h.selVAlign,"sel-wrap":h.selWrap,"merge-menu-open":B.mergeMenuOpen,"calc-menu-open":B.calcMenuOpen,"cf-menu-open":pe.value,"freeze-menu-open":ie.value,"font-menu-open":me.value,"h-align-menu-open":se.value,"v-align-menu-open":Se.value,"num-fmt-menu-open":Xe.value,"is-single-cell":O.value,"has-freeze":v.freeze.rows>0||v.freeze.cols>0,"freeze-panes-disabled":re.value,"sel-number-format":h.selNumberFormatDisplay,"nf-options":h.nfOptions,"can-increase-decimals":h.canIncreaseDecimals,"can-decrease-decimals":h.canDecreaseDecimals,"boundary-el":Je.value,"theme-vars":R.toolbarThemeVars,onUndo:p[0]||(p[0]=S=>h.undo()),onRedo:p[1]||(p[1]=S=>h.redo()),onPaintFormat:h.onPaintFormat,onClearFormat:p[2]||(p[2]=S=>h.clearFormat()),onNumberFormatChange:p[3]||(p[3]=S=>h.onNumberFormatChange(S)),onIncreaseDecimals:h.onIncreaseDecimals,onDecreaseDecimals:h.onDecreaseDecimals,onFontFamilyChange:p[4]||(p[4]=S=>h.onFontFamilyChange(S)),onFontSizeInput:p[5]||(p[5]=S=>h.onFontSizeInput(S)),onFontSizeBlur:h.onFontSizeBlur,onFontSizeKeydown:p[6]||(p[6]=S=>h.onFontSizeKeydown(S)),onFontSizeChange:p[7]||(p[7]=S=>h.onFontSizeChange(S)),"onUpdate:fontSizeMenuOpen":p[8]||(p[8]=S=>G(S)),onFontSizeToggle:p[9]||(p[9]=S=>h.toggleFontSizeMenu()),onFontSizeStepUp:h.onFontSizeStepUp,onFontSizeStepDown:h.onFontSizeStepDown,onBoldToggle:h.toggleFontWeight,onItalicToggle:h.toggleFontStyle,onUnderlineToggle:h.toggleUnderline,onStrikethroughToggle:h.toggleStrikethrough,onTextColorChange:p[10]||(p[10]=S=>h.onTextColorChange(S)),"onUpdate:textColorMenuOpen":p[11]||(p[11]=S=>ye(S)),onFillColorChange:p[12]||(p[12]=S=>h.onFillColorChange(S)),"onUpdate:fillColorMenuOpen":p[13]||(p[13]=S=>Be(S)),onApplyTextColor:h.applyCachedTextColor,onApplyFillColor:h.applyCachedFillColor,"onUpdate:borderMenuOpen":p[14]||(p[14]=S=>h.onBorderMenuToggle(S)),onBorderChange:p[15]||(p[15]=S=>B.onBorderChange(S)),onApplyBorder:B.applyCachedBorder,"onUpdate:sortMenuOpen":p[16]||(p[16]=S=>R.onSortMenuToggle(S)),onSortChange:p[17]||(p[17]=S=>R.onSortChange(S)),onApplySort:R.applyCachedSort,"onUpdate:outlineMenuOpen":p[18]||(p[18]=S=>ee.value=S),onOutlineAction:p[19]||(p[19]=S=>Ve(S)),onToggleFilter:V,onFreezeChange:p[20]||(p[20]=S=>ae(S)),onHAlignChange:p[21]||(p[21]=S=>h.onHAlignChange(S)),onVAlignChange:p[22]||(p[22]=S=>h.onVAlignChange(S)),onWrapToggle:h.onWrapToggle,"onUpdate:mergeMenuOpen":p[23]||(p[23]=S=>B.onMergeMenuToggle(S)),onMergeChange:p[24]||(p[24]=S=>B.onMergeChange(S)),onApplyMerge:B.onApplyMerge,"onUpdate:calcMenuOpen":p[25]||(p[25]=S=>B.onCalcMenuToggle(S)),"onUpdate:cfMenuOpen":p[26]||(p[26]=S=>pe.value=S),"onUpdate:freezeMenuOpen":p[27]||(p[27]=S=>ie.value=S),"onUpdate:fontMenuOpen":p[28]||(p[28]=S=>me.value=S),"onUpdate:hAlignMenuOpen":p[29]||(p[29]=S=>se.value=S),"onUpdate:vAlignMenuOpen":p[30]||(p[30]=S=>Se.value=S),"onUpdate:numFmtMenuOpen":p[31]||(p[31]=S=>Xe.value=S),onCalcSum:B.onCalcSum,onCalcAvg:B.onCalcAvg,onCalcCount:B.onCalcCount,onFind:p[32]||(p[32]=S=>t.unref(C).openFind()),onCfPreset:p[33]||(p[33]=S=>W(S)),onCfNewRule:fe,onCfManage:Ae,onCfClear:p[34]||(p[34]=S=>Re(S)),onOpenDataValidation:Et},null,8,["locale","can-undo","can-redo","paint-fmt-active","has-selection","font-family-options","font-size-options","sel-font-family","sel-font-size","font-size-input","font-size-menu-open","sel-font-weight","sel-font-style","sel-underline","sel-strikethrough","sel-text-color","text-color-menu-open","sel-fill-color","fill-color-menu-open","cached-text-color","cached-fill-color","border-menu-open","cached-border","sort-menu-open","cached-sort-order","can-sort","outline-menu-open","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(su,{open:rt.open,"find-text":rt.findText,"replace-text":rt.replaceText,scope:rt.scope,"match-case":rt.matchCase,"match-entire-cell":rt.matchEntireCell,"current-index":rt.currentIndex,total:rt.results.length,message:rt.message,"focus-token":rt.focusToken,locale:v.locale,"theme-vars":R.toolbarThemeVars,"onUpdate:findText":p[35]||(p[35]=S=>t.unref(C).findText.value=S),"onUpdate:replaceText":p[36]||(p[36]=S=>t.unref(C).replaceText.value=S),"onUpdate:scope":p[37]||(p[37]=S=>t.unref(C).scope.value=S),"onUpdate:matchCase":p[38]||(p[38]=S=>t.unref(C).matchCase.value=S),"onUpdate:matchEntireCell":p[39]||(p[39]=S=>t.unref(C).matchEntireCell.value=S),onPrev:p[40]||(p[40]=S=>t.unref(C).findPrev()),onNext:p[41]||(p[41]=S=>t.unref(C).findNext()),onReplace:p[42]||(p[42]=S=>t.unref(C).replace()),onReplaceAll:p[43]||(p[43]=S=>t.unref(C).replaceAll()),onClose:p[44]||(p[44]=S=>t.unref(C).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(Ou,{"model-open":h.nfDialogOpen,locale:v.locale,"current-format":we.value,"is-custom":h.selNumberFormat===t.unref(ll),"onUpdate:modelOpen":p[45]||(p[45]=S=>ze(S)),onApply:p[46]||(p[46]=S=>h.applyNumberFormatCode(S))},null,8,["model-open","locale","current-format","is-custom"]),t.createVNode(Pu,{"model-open":R.sortConfirmOpen,locale:v.locale,"onUpdate:modelOpen":p[47]||(p[47]=S=>R.sortConfirmOpen=S),onConfirm:p[48]||(p[48]=S=>R.confirmSort(S)),onCancel:p[49]||(p[49]=S=>R.cancelSortConfirmation())},null,8,["model-open","locale"]),t.createVNode(cf,{"model-open":le.value,locale:v.locale,"onUpdate:modelOpen":p[50]||(p[50]=S=>ce(S)),onInsert:p[51]||(p[51]=S=>Fe(S))},null,8,["model-open","locale"]),t.createElementVNode("div",{class:t.normalizeClass(["formula-bar",{"formula-bar--expanded":X.formulaBarExpanded}])},[t.createElementVNode("div",vp,t.toDisplayString(X.activeCellLabel),1),t.createElementVNode("div",kp,[t.createElementVNode("button",{type:"button",class:"formula-bar__btn formula-bar__btn--cancel",title:"取消(Esc)","aria-label":"取消",onMousedown:p[52]||(p[52]=t.withModifiers(()=>{},["prevent"])),onClick:p[53]||(p[53]=t.withModifiers((...S)=>X.cancelFormulaBarEdit&&X.cancelFormulaBarEdit(...S),["stop"]))},[...p[116]||(p[116]=[t.createElementVNode("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":"true"},[t.createElementVNode("path",{d:"M3 3l8 8M11 3l-8 8",fill:"none",stroke:"#e53935","stroke-width":"1.8","stroke-linecap":"round"})],-1)])],32),t.createElementVNode("button",{type:"button",class:"formula-bar__btn formula-bar__btn--accept",title:"接受(Enter)","aria-label":"接受",onMousedown:p[54]||(p[54]=t.withModifiers(()=>{},["prevent"])),onClick:p[55]||(p[55]=t.withModifiers((...S)=>X.acceptFormulaBarEdit&&X.acceptFormulaBarEdit(...S),["stop"]))},[...p[117]||(p[117]=[t.createElementVNode("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":"true"},[t.createElementVNode("path",{d:"M2.5 7.5l3.5 3.5L12 3.5",fill:"none",stroke:"#2e7d32","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],32),t.createElementVNode("button",{type:"button",class:"formula-bar__btn formula-bar__btn--fx",title:t.unref(w)(v.locale,"insertFunctionTitle"),"aria-label":t.unref(w)(v.locale,"insertFunctionTitle"),onMousedown:p[56]||(p[56]=t.withModifiers(()=>{},["prevent"])),onClick:t.withModifiers(xe,["stop"])},[...p[118]||(p[118]=[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,Ep)]),t.createElementVNode("textarea",{ref:Oe,class:t.normalizeClass(["formula-bar__input",{"formula-bar__input--expanded":X.formulaBarExpanded}]),rows:X.formulaBarExpanded?3:1,value:X.formulaBarDisplay,spellcheck:"false",onFocus:p[57]||(p[57]=(...S)=>X.onFormulaBarFocus&&X.onFormulaBarFocus(...S)),onInput:p[58]||(p[58]=(...S)=>X.onFormulaBarInput&&X.onFormulaBarInput(...S)),onKeydown:p[59]||(p[59]=(...S)=>X.onFormulaBarKeydown&&X.onFormulaBarKeydown(...S)),onBlur:p[60]||(p[60]=(...S)=>X.onFormulaBarBlur&&X.onFormulaBarBlur(...S))},null,42,Rp),t.createElementVNode("button",{type:"button",class:"formula-bar__toggle",title:X.formulaBarExpanded?"折叠为1行":"展开为3行",onMousedown:p[61]||(p[61]=t.withModifiers(()=>{},["prevent"])),onClick:t.withModifiers(be,["stop"])},[X.formulaBarExpanded?(t.openBlock(),t.createElementBlock("svg",Np,[...p[120]||(p[120]=[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",Mp,[...p[119]||(p[119]=[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,Sp)],2),t.createElementVNode("div",{ref:E,class:"spreadsheet-wrapper"},[t.createElementVNode("canvas",{ref:U,class:"grid-canvas",tabindex:"0",onMousedown:p[62]||(p[62]=(...S)=>X.onMouseDown&&X.onMouseDown(...S)),onMousemove:p[63]||(p[63]=(...S)=>X.onMouseMove&&X.onMouseMove(...S)),onMouseup:p[64]||(p[64]=(...S)=>X.onMouseUp&&X.onMouseUp(...S)),onMouseleave:p[65]||(p[65]=(...S)=>X.onMouseLeave&&X.onMouseLeave(...S)),onDblclick:p[66]||(p[66]=(...S)=>X.onDblClick&&X.onDblClick(...S)),onWheel:p[67]||(p[67]=t.withModifiers((...S)=>X.onWheel&&X.onWheel(...S),["prevent"])),onFocus:p[68]||(p[68]=(...S)=>R.onCanvasFocus&&R.onCanvasFocus(...S)),onKeydown:p[69]||(p[69]=(...S)=>X.onKeydown&&X.onKeydown(...S)),onContextmenu:p[70]||(p[70]=(...S)=>X.onCanvasCtx&&X.onCanvasCtx(...S)),onTouchstart:p[71]||(p[71]=t.withModifiers((...S)=>X.onTouchStart&&X.onTouchStart(...S),["prevent"])),onTouchmove:p[72]||(p[72]=t.withModifiers((...S)=>X.onTouchMove&&X.onTouchMove(...S),["prevent"])),onTouchend:p[73]||(p[73]=(...S)=>X.onTouchEnd&&X.onTouchEnd(...S))},null,32),t.createElementVNode("canvas",{ref:ne,class:"grid-canvas grid-canvas--freeze","aria-hidden":"true"}),t.createElementVNode("textarea",{ref:ke,class:"cell-editor",value:v.editValue,style:t.normalizeStyle(X.editInputStyle),onInput:p[74]||(p[74]=(...S)=>X.onEditInput&&X.onEditInput(...S)),onKeydown:p[75]||(p[75]=(...S)=>X.onEditKd&&X.onEditKd(...S)),onCompositionstart:p[76]||(p[76]=(...S)=>X.onEditCompositionStart&&X.onEditCompositionStart(...S)),onCompositionend:p[77]||(p[77]=(...S)=>X.onEditCompositionEnd&&X.onEditCompositionEnd(...S)),onBlur:p[78]||(p[78]=(...S)=>X.onEditBlur&&X.onEditBlur(...S)),onPaste:p[79]||(p[79]=(...S)=>X.onEditPaste&&X.onEditPaste(...S))},null,44,Bp),R.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"v-scrollbar",style:t.normalizeStyle({top:X.vScrollbarTop+"px",height:`calc(100% - ${X.vScrollbarTop+t.unref(11)}px)`})},[t.createElementVNode("button",{class:"sb-btn sb-btn--up",title:"",onMousedown:p[80]||(p[80]=t.withModifiers(S=>{R.clampScroll(null,v.scrollY-50),X.scheduleRender()},["prevent"]))},[...p[121]||(p[121]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--up"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--v",onMousedown:p[82]||(p[82]=(...S)=>X.onVTrk&&X.onVTrk(...S))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--v",style:t.normalizeStyle({top:X.vThumbT+"px",height:X.vThumbH+"px"}),onMousedown:p[81]||(p[81]=(...S)=>X.onVStart&&X.onVStart(...S))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--down",onMousedown:p[83]||(p[83]=t.withModifiers(S=>{R.clampScroll(null,v.scrollY+50),X.scheduleRender()},["prevent"]))},[...p[122]||(p[122]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--down"},null,-1)])],32)],4)):t.createCommentVNode("",!0),R.maxScrollX>0?(t.openBlock(),t.createElementBlock("div",{key:1,class:"h-scrollbar",style:t.normalizeStyle({left:X.hScrollbarLeft+"px",width:`calc(100% - ${X.hScrollbarLeft+t.unref(11)}px)`})},[t.createElementVNode("button",{class:"sb-btn sb-btn--left",onMousedown:p[84]||(p[84]=t.withModifiers(S=>{R.clampScroll(v.scrollX-50,null),X.scheduleRender()},["prevent"]))},[...p[123]||(p[123]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--left"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--h",onMousedown:p[86]||(p[86]=(...S)=>X.onHTrk&&X.onHTrk(...S))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--h",style:t.normalizeStyle({left:X.hThumbL+"px",width:X.hThumbW+"px"}),onMousedown:p[85]||(p[85]=(...S)=>X.onHStart&&X.onHStart(...S))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--right",onMousedown:p[87]||(p[87]=t.withModifiers(S=>{R.clampScroll(v.scrollX+50,null),X.scheduleRender()},["prevent"]))},[...p[124]||(p[124]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--right"},null,-1)])],32)],4)):t.createCommentVNode("",!0),R.maxScrollX>0&&R.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",xp)):t.createCommentVNode("",!0),X.noteUi&&Mn.value?(t.openBlock(),t.createBlock(p1,{key:3,anchor:Mn.value,mode:X.noteUi.mode,note:Nn.value,author:o.noteAuthor,locale:v.locale,placeholder:_.value,"boundary-el":Je.value,frozen:z.value,onSave:p[88]||(p[88]=S=>t.unref(b).saveNoteAt(X.noteUi.row,X.noteUi.col,S,o.noteAuthor)),onDelete:p[89]||(p[89]=S=>t.unref(b).removeNoteAt(X.noteUi.row,X.noteUi.col)),onClose:p[90]||(p[90]=S=>t.unref(b).closeNote())},null,8,["anchor","mode","note","author","locale","placeholder","boundary-el","frozen"])):t.createCommentVNode("",!0)]),t.createVNode(Gd,{locale:v.locale,sheets:t.unref(F),"active-sheet-index":t.unref(Q),"ren-tab":X.renTab,"ren-tab-val":X.renTabVal,"boundary-el":Je.value,onTabClick:p[91]||(p[91]=S=>X.onTabClick(S)),onTabDblclick:p[92]||(p[92]=S=>X.onTabDblClick(S)),onTabContextmenu:p[93]||(p[93]=S=>X.onTabCtxMenu(S.ev,S.i)),onTabRenameInput:p[94]||(p[94]=S=>He(S)),onTabRenameKeydown:p[95]||(p[95]=S=>X.onTabRenameKd(S)),onTabRenameCommit:X.commitTabRename,onTabbarContextmenu:p[96]||(p[96]=S=>X.onTabBarCtx(S)),onDeleteSheet:p[97]||(p[97]=S=>{R.removeSheet(S),X.scheduleRender()}),onAddSheet:p[98]||(p[98]=S=>{R.addSheet(),X.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(()=>[X.ctxMenu?(t.openBlock(),t.createElementBlock("div",{key:0,class:"context-menu",style:t.normalizeStyle({left:X.ctxMenu.x+"px",top:X.ctxMenu.y+"px"}),onClick:p[99]||(p[99]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(X.ctxMenu.items,(S,ot)=>(t.openBlock(),t.createElementBlock("div",{key:ot,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":S.disabled}]),onClick:mt=>!S.disabled&&S.action&&(S.action(),Ce()),onMouseenter:mt=>X.onCtxItemEnter(mt,S)},[t.createElementVNode("span",Vp,t.toDisplayString(S.label),1),S.children?(t.openBlock(),t.createElementBlock("svg",Dp,[...p[125]||(p[125]=[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),S.children?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["context-submenu",{"context-submenu--left":X.ctxSubmenuLeft}])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(S.children,(mt,Ot)=>(t.openBlock(),t.createElementBlock("div",{key:Ot,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":mt.disabled}]),onClick:t.withModifiers(xt=>!mt.disabled&&mt.action&&(mt.action(),Ce()),["stop"])},t.toDisplayString(mt.label),11,Fp))),128))],2)):t.createCommentVNode("",!0)],42,Tp))),128))],4)):t.createCommentVNode("",!0)]),_:1})])),X.filterPopup?(t.openBlock(),t.createBlock(If,{key:X.filterPopup.col,col:X.filterPopup.col,"header-label":J(X.filterPopup.col),anchor:{x:X.filterPopup.x,y:X.filterPopup.y},locale:v.locale,"get-filter":v.getFilter,"set-filter":v.setFilter,"set-filter-column":v.setFilterColumn,"clear-filter-column":v.clearFilterColumn,"get-column-candidates":v.getColumnCandidates,close:X.closeFilterPopup,"boundary-el":Je.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"},[ve.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"cf-modal-mask",onClick:p[101]||(p[101]=t.withModifiers(S=>ve.value=!1,["self"]))},[t.createVNode(Xf,{locale:v.locale,rules:v.conditionalFormats,"theme-vars":R.toolbarThemeVars,onNew:fe,onEdit:Ge,onDelete:Le,onMove:ht,onToggle:bt,onClose:p[100]||(p[100]=S=>ve.value=!1)},null,8,["locale","rules","theme-vars"])])):t.createCommentVNode("",!0)])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[Me.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"cf-modal-mask",onClick:p[103]||(p[103]=t.withModifiers(S=>Me.value=!1,["self"]))},[t.createVNode(Am,{locale:v.locale,mode:$.value,rule:q.value,"default-range-text":Y.value,"theme-vars":R.toolbarThemeVars,onSave:_e,onCancel:p[102]||(p[102]=S=>Me.value=!1)},null,8,["locale","mode","rule","default-range-text","theme-vars"])])):t.createCommentVNode("",!0)])),X.validationDropdown?(t.openBlock(),t.createBlock(j0,{key:`${X.validationDropdown.col},${X.validationDropdown.row}`,items:X.validationDropdown.items,current:X.validationDropdown.current,locale:v.locale,x:X.validationDropdown.x,y:X.validationDropdown.y,width:X.validationDropdown.width,height:X.validationDropdown.height,"boundary-el":Je.value,onSelect:p[104]||(p[104]=S=>t.unref(b).onValidationDropdownSelect(S)),onClose:p[105]||(p[105]=S=>t.unref(b).closeValidationDropdown())},null,8,["items","current","locale","x","y","width","height","boundary-el"])):t.createCommentVNode("",!0),Zt.value?(t.openBlock(),t.createBlock(r1,{key:2,title:Zt.value.title,message:Zt.value.message,x:Zt.value.x,y:Zt.value.y,width:Zt.value.width,height:Zt.value.height},null,8,["title","message","x","y","width","height"])):t.createCommentVNode("",!0),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[je.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"cf-modal-mask",onClick:p[107]||(p[107]=t.withModifiers(S=>je.value=!1,["self"]))},[t.createVNode(z0,{locale:v.locale,mode:Yt.value,rule:Bt.value,"default-range-text":Vt.value,"theme-vars":R.toolbarThemeVars,onSave:Sn,onClear:en,onCancel:p[106]||(p[106]=S=>je.value=!1)},null,8,["locale","mode","rule","default-range-text","theme-vars"])])):t.createCommentVNode("",!0)])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[zt.value?(t.openBlock(),t.createElementBlock("div",Ip,[t.createVNode(ka,{locale:v.locale,severity:zt.value.severity,title:zt.value.title,message:zt.value.message,"theme-vars":R.toolbarThemeVars,onResolve:Xt},null,8,["locale","severity","title","message","theme-vars"])])):t.createCommentVNode("",!0)])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[te.value?(t.openBlock(),t.createElementBlock("div",Op,[t.createVNode(ka,{locale:v.locale,severity:"information",title:t.unref(w)(v.locale,"outlineAlertTitle"),message:te.value,"theme-vars":R.toolbarThemeVars,onResolve:It},null,8,["locale","title","message","theme-vars"])])):t.createCommentVNode("",!0)])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[X.dimPanel?(t.openBlock(),t.createElementBlock("div",{key:0,class:"dim-panel",style:t.normalizeStyle({left:X.dimPanel.x+"px",top:X.dimPanel.y+"px"}),onMousedown:p[113]||(p[113]=t.withModifiers(()=>{},["stop"])),onTouchstart:p[114]||(p[114]=t.withModifiers(()=>{},["stop"])),onClick:p[115]||(p[115]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",Ap,t.toDisplayString(X.dimPanel.type==="row"?"行高":"列宽"),1),t.createElementVNode("div",Lp,[t.createElementVNode("input",{ref:Ne,class:t.normalizeClass(["dim-panel__input",{"dim-panel__input--error":X.dimPanel.error}]),type:"number",step:"1",min:"1",inputmode:"numeric",value:X.dimPanel.value,onInput:p[108]||(p[108]=(...S)=>X.onDimInput&&X.onDimInput(...S)),onKeydown:p[109]||(p[109]=(...S)=>X.onDimKeydown&&X.onDimKeydown(...S)),onBlur:p[110]||(p[110]=(...S)=>X.onDimBlur&&X.onDimBlur(...S))},null,42,$p)]),X.dimPanel.error?(t.openBlock(),t.createElementBlock("div",zp,t.toDisplayString(X.dimPanel.error),1)):t.createCommentVNode("",!0),t.createElementVNode("div",_p,[t.createElementVNode("button",{class:"dim-panel__btn dim-panel__btn--primary",onClick:p[111]||(p[111]=(...S)=>X.applyDimPanel&&X.applyDimPanel(...S))}," 确定 "),t.createElementVNode("button",{class:"dim-panel__btn",onClick:p[112]||(p[112]=(...S)=>X.closeDimPanel&&X.closeDimPanel(...S))}," 取消 ")])],36)):t.createCommentVNode("",!0)]),_:1})]))],4))}}),[["__scopeId","data-v-748b248c"]]);bl.Spreader=si,bl.default=si,Object.defineProperties(bl,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
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 ta="",Fi={"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=Fi[e])==null?void 0:n[l])??l}const Vo='-apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif',ao=16,Oi=[{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'}],Ii=[{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}],Ai='<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>',Li='<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>',$i='<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>',zi='<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>',_i='<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>',Hi='<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>',Wi=[{value:"left",labelKey:"alignLeft",icon:Ai},{value:"center",labelKey:"alignCenter",icon:Li},{value:"right",labelKey:"alignRight",icon:$i}],Ui=[{value:"top",labelKey:"alignTop",icon:zi},{value:"middle",labelKey:"alignMiddle",icon:_i},{value:"bottom",labelKey:"alignBottom",icon:Hi}],Pi=[{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>'}],Ki={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",findMatchBg:"rgba(255, 213, 79, 0.45)",findActiveBg:"rgba(255, 179, 0, 0.75)"},na={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)",findMatchBg:"rgba(255, 213, 79, 0.35)",findActiveBg:"rgba(255, 179, 0, 0.6)"};function pt(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 fr(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 mr(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 Cn(e,l,n){const o=e.match(/^\$?([A-Z]+)\$?(\d+)$/i);if(!o)return null;const a=fr(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 Nn(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 io="__nf_custom__",jn="",so="",Bn="@",Tl="__NF_INVALID__",pr=2958465,hr=0;function xn(e){return e==null||e===""?!0:e.toUpperCase()==="GENERAL"}function gr(e){return e==="zh-CN"?"¥":"$"}function Gi(e){return e.replace(/\*/g,"").replace(/_.|_\b/g,"")}function oa(e){return e.replace(/"([^"]*)"/g,"$1")}function qi(e){let l=e,n;const o=l.match(/^\[([^\]]+)\]/);o&&(n=o[1].toLowerCase(),l=l.slice(o[0].length)),l=Gi(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 d=-1;for(let me=l.length-1;me>=0;me--){const Ee=l[me];if(Ee==="0"||Ee==="#"||Ee==="?"||Ee==="E"){d=me;break}}d<0&&(d=r);const c=r>0?l.slice(0,r):"",C=d<l.length-1?l.slice(d+1):"",h=l.slice(r,d+1),S=/[0#?]/.test(h),m=h.includes(",");let E=h.replace(/,/g,"");if(a){const me=E.search(/E/i);me>=0&&(E=E.slice(0,me))}const B=E.indexOf("."),G=B>=0?E.slice(0,B):E,te=B>=0?E.slice(B+1):"",ge=(te.match(/[0#?]/g)||[]).length,fe=(te.match(/0/g)||[]).length,Ie=(G.match(/0/g)||[]).length;return{hasDigits:S,decimals:ge,minDecimals:fe,minIntDigits:Ie,thousands:m,scale:i?100:1,scientific:a,prefix:c,suffix:C,color:n}}function Yi(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:oa(i),len:0}):l.push({type:"literal",text:i,len:0})}}return{tokens:l,isDuration:n}}const la=new Map;function ji(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:d}=Yi(i);return{kind:d?"duration":"date",sections:[],tokens:r,isDuration:d,raw:e}}return{kind:"number",sections:e.split(";").map(i=>qi(i)),tokens:[],isDuration:!1,raw:e}}function co(e){const l=la.get(e);if(l)return l;const n=ji(e);return la.set(e,n),n}function ra(e,l,n,o,a){const i=Math.pow(10,l),r=Math.round((e+Number.EPSILON)*i)/i,d=r<0,c=Math.abs(r);let h=new Intl.NumberFormat("en-US",{useGrouping:o,minimumIntegerDigits:a,minimumFractionDigits:l,maximumFractionDigits:l}).format(c);if(n<l&&l>0){const m=h.indexOf(".");if(m>=0){const M=h.substring(0,m);let E=h.substring(m+1);E=E.replace(/0+$/,""),E.length<n&&(E=E+"0".repeat(n-E.length)),h=E?`${M}.${E}`:M}}return`${d?"-":""}${h}`}function aa(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=ra(o,l,l,!1,1),i=(n>=0?"+":"-")+String(Math.abs(n)).padStart(2,"0");return`${a}E${i}`}function Xi(e,l,n){if(!n.hasDigits)return oa(n.prefix+n.suffix);const o=n.scale===100?e*100:e,a=n.scientific?aa(o,n.decimals):ra(o,n.decimals,n.minDecimals,n.thousands,n.minIntDigits);return l+n.prefix+a+n.suffix}function Zi(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),Xi(a,i,o)}function Ji(e){return new Date((e-25569)*864e5)}const Qi=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],es=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],ia=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],ts=["January","February","March","April","May","June","July","August","September","October","November","December"],ns=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],sa=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function Ko(e,l){return String(e).padStart(l,"0")}function os(e,l,n,o){const a=e.getUTCFullYear(),i=e.getUTCMonth()+1,r=e.getUTCDate(),d=e.getUTCDay(),c=n==="zh-CN";let C="",h=!1;for(const S of l)switch(S.type){case"literal":C+=S.text??"";break;case"year":C+=S.len>=4?String(a):String(a%100).padStart(2,"0");break;case"month":C+=Ko(h?e.getUTCMinutes():i,S.len);break;case"monthName":C+=S.len>=4?c?Qi[i-1]:ts[i-1]:c?es[i-1]:ns[i-1];break;case"day":C+=Ko(r,S.len);break;case"weekday":C+=S.len>=4?c?ia[d]:sa[d]:c?ia[d].slice(2):sa[d].slice(0,3);break;case"hour":{let m=e.getUTCHours();if(S.len===0){const M=Math.floor(o*86400);m=Math.floor(M/3600)}C+=String(m),h=!0;break}case"minute":C+=Ko(e.getUTCMinutes(),S.len);break;case"second":C+=Ko(e.getUTCSeconds(),S.len);break;case"ampm":{const m=e.getUTCHours();C+=m<12?c?"上午":"AM":c?"下午":"PM";break}}return C}function ls(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 d of l)switch(d.type){case"literal":r+=d.text??"";break;case"hour":r+=String(o);break;case"minute":r+=Ko(a,d.len||2);break;case"second":r+=Ko(i,d.len||2);break;default:r+=""}return r}function rs(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)?aa(l,9):e}return e}function In(e,l,n){if(xn(l))return rs(e);if(l==null||l===Bn)return e;const o=co(l);if(o.kind==="date"||o.kind==="duration"){const i=Number(e);if(!isFinite(i))return e;if(o.kind==="date"){if(i<hr||i>pr)return Tl}else if(i<0)return Tl;return o.kind==="duration"?ls(i,o.tokens):os(Ji(i),o.tokens,n,i)}const a=Number(e);return isNaN(a)?e:Zi(a,o)}const as=["general","text","number","percent","scientific","accounting","financial","currency","currencyRounded","date","time","dateTime","duration","custom"];function br(e,l){if(l===Bn||l==="@")return!1;if(xn(l)){if(e==null||e===""||e.trim()==="")return!1;const o=Number(e);return!Number.isNaN(o)&&Number.isFinite(o)}const n=co(l);return!!(n.kind==="number"&&ca(n))}function ca(e){return e.sections.some(l=>l.hasDigits)}function da(e){if(e==null||xn(e)||e===Bn||e==="@")return!1;const l=co(e);return!!(l.kind==="date"||l.kind==="duration"||l.kind==="number"&&ca(l))}function ua(e,l){if(l==null||xn(l)||l===Bn||l==="@")return!1;const n=co(l),o=Number(e);return Number.isFinite(o)?n.kind==="date"?o<hr||o>pr:n.kind==="duration"?o<0:!1:!1}const yr=30,Cr=0;function An(e){if(e==null||e===""||e.trim()==="")return!1;const l=Number(e);return!Number.isNaN(l)&&Number.isFinite(l)}function fa(e,l){if(e==null||e===jn||xn(e))return An(l);if(e===Bn)return!1;const n=co(e);return n.kind==="date"||n.kind==="duration"?!1:n.sections.some(o=>o.hasDigits)}function is(e){if(!An(e))return 0;const l=String(Number(e));return l.indexOf(".")<0||/e/i.test(l)?0:l.slice(l.indexOf(".")+1).length}function ss(e,l){if(!fa(e,l))return-1;if(e==null||e===jn||xn(e))return is(l);const o=co(e).sections.find(a=>a.hasDigits);return o?o.decimals:-1}function cs(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),d=r.search(/[0#?]/);if(d===-1)return e;let c=-1;for(let G=r.length-1;G>=0;G--){const te=r[G];if(te==="0"||te==="#"||te==="?"||te==="E"){c=G;break}}if(c<d)return e;const C=r.slice(d,c+1),h=C.search(/E[+-]/i),S=h>=0?C.slice(0,h):C,m=S.indexOf("."),M=m>=0?(S.slice(m+1).match(/[0#?]/g)||[]).length:0;if(M===l)return e;let E;if(m<0)E=l>0?S+"."+"0".repeat(l):S;else if(l>M)E=S+"0".repeat(l-M);else{let G=M-l;const te=S.split("");for(let ge=te.length-1;ge>=0&&G>0;ge--){const fe=te[ge];(fe==="0"||fe==="#"||fe==="?")&&(te.splice(ge,1),G--)}E=te.join(""),l===0&&E.endsWith(".")&&(E=E.slice(0,-1))}const B=E+(h>=0?C.slice(h):"");return i+r.slice(0,d)+B+r.slice(c+1)}function ds(e,l){if(!Number.isInteger(l)||l<Cr||l>yr||e===jn)return null;if(e==null||xn(e))return l>0?"0."+"0".repeat(l):"0";if(e===Bn)return null;const n=co(e);return n.kind==="date"||n.kind==="duration"||!n.sections.some(o=>o.hasDigits)?null:e.split(";").map(o=>cs(o,l)).join(";")}const wr=["¥","$","€","£"];function ma(e,l){if(e==null||e===jn)return e??so;if(xn(e))return so;if(e===Bn||e==="@")return Bn;const n=gr(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(pa(l).some(M=>M.value===e))return e;const c=e.replace(/\[[^\]]*\]/gi,M=>/^\[(h|mm|ss)\]$/i.test(M)?M:"");if(/\[(h|mm|ss)\]/i.test(c)&&!/[yd]/i.test(c))return"[h]:mm:ss";const C=/[yd]/i.test(c),h=/h|s|AM\/PM/i.test(c);if(C&&h)return a;if(C||/AM\/PM/i.test(c))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 S=wr.find(M=>e.startsWith(M));if(S)return e.includes("(")?i:/\.\d/.test(e.slice(S.length))?n+"#,##0.00":n+"#,##0";const m=co(e);return m.kind==="number"&&m.sections.some(M=>M.hasDigits)?"#,##0.00":io}function us(e,l){return new Date(Date.UTC(e,l,0)).getUTCDate()}function fs(e,l,n){const o=Date.UTC(e,l-1,n)/864e5+25569;return o<=60?o-1:o}function Xn(e,l,n=new Date){const o=e.trim();if(!o||o.startsWith("=")||An(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 d(m){const M=/^(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/.exec(m);if(!M)return null;const E=Number(M[1]),B=Number(M[2]),G=M[3]!==void 0?Number(M[3]):0;return E>23||B>59||G>59?null:(E*3600+B*60+G)/86400}function c(m){let M=/^(\d{4})[-/](\d{1,2})[-/](\d{1,2})$/.exec(m),E,B,G;if(M)E=Number(M[1]),B=Number(M[2]),G=Number(M[3]);else if(M=/^(\d{4})年(\d{1,2})月(\d{1,2})日$/.exec(m))E=Number(M[1]),B=Number(M[2]),G=Number(M[3]);else if(M=/^(\d{1,2})[-/](\d{1,2})[-/](\d{4})$/.exec(m))B=Number(M[1]),G=Number(M[2]),E=Number(M[3]);else if(M=/^(\d{1,2})[-/](\d{1,2})$/.exec(m))E=n.getUTCFullYear(),B=Number(M[1]),G=Number(M[2]);else return null;if(E<1900||E>9999||B<1||B>12||G<1||G>us(E,B))return null;const te=fs(E,B,G);return te>=hr&&te<=pr?te:null}const C=d(o);if(C!==null)return{serial:C,format:r};const h=/^(.+?)[T ](\d{1,2}:\d{1,2}(?::\d{1,2})?)$/.exec(o);if(h){const m=c(h[1].trim()),M=d(h[2]);if(m!==null&&M!==null)return{serial:m+M,format:i}}const S=c(o);return S!==null?{serial:S,format:a}:null}function Vl(e,l){const n=e.trim();if(!n||n.startsWith("=")||!(n.includes(",")||n.includes("%")||wr.some(ge=>n.startsWith(ge)))||Xn(n,l))return null;const a=wr.find(ge=>n.startsWith(ge)),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 d=r[1]==="-"?-1:1,c=r[2].replace(/,/g,""),C=r[3],h=(r[4]??"")==="%",S=C?C.length:0,m=+(c+(C?"."+C:""));if(!Number.isFinite(m))return null;const E=i.includes(",")?"#,##0":"0",B=S>0?"."+"0".repeat(S):"",G=(a??"")+E+B+(h?"%":"");let te=m*d;return h&&(te=te/100),te=Math.round(te*1e12)/1e12,{num:te,format:G}}function ms(e,l,n,o){const a=gr(e),i=o?"#,##0":"0",r=n>0?"."+"0".repeat(n):"",d=i+r;switch(l){case"general":return"";case"text":return Bn;case"custom":return"";case"number":return d;case"percent":return d+"%";case"scientific":return"0."+"0".repeat(n)+"E+00";case"currency":return a+d;case"currencyRounded":return a+(o?"#,##0":"0");case"accounting":return`${a}${d};(${a}${d});${a}"-"`;case"financial":return`${d};[Red](${d})`;case"date":return e==="zh-CN"?'yyyy"年"m"月"d"日"':"m/d/yyyy";case"time":return"h:mm:ss";case"dateTime":return e==="zh-CN"?'yyyy"年"m"月"d"日" h:mm:ss':"m/d/yyyy h:mm:ss";case"duration":return"[h]:mm:ss";default:return""}}function pa(e){const l=gr(e);return[{label:g(e,"nfGeneral"),value:so},{label:g(e,"nfText"),value:Bn},{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:io}]}const ps=["title"],hs=["innerHTML"],gs={class:"sp-dropdown__value"},bs=["disabled"],ys=["placeholder"],Cs=["disabled","onClick"],ws=["innerHTML"],vs={class:"sp-dropdown__item-label"},ks={key:2,class:"sp-dropdown__empty"},Es=["disabled"],Rs=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}},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),d=t.ref(null),c=t.ref(null),C=t.ref({top:0,up:!1}),h=t.ref(void 0),S=t.ref(0),m=t.ref(!1),M=t.ref(""),E=t.ref(null),B=t.computed(()=>n.options.find(se=>String(se.value)===String(n.modelValue))),G=t.computed(()=>n.menuWidth!==void 0?n.menuWidth:h.value),te=t.computed(()=>{if(!n.searchable||!M.value.trim())return n.options;const se=M.value.trim().toLowerCase();return n.options.filter(de=>String(de.label??"").toLowerCase().includes(se))}),ge=t.computed(()=>te.value.length>0),fe=t.computed(()=>Math.min(n.visibleCount,te.value.length)),Ie=t.computed(()=>te.value.slice(i.value,i.value+fe.value)),me=t.computed(()=>i.value>0),Ee=t.computed(()=>i.value+fe.value<te.value.length),Ae=t.computed(()=>te.value.length>fe.value);function ce(se){i.value=Math.max(0,Math.min(te.value.length-fe.value,i.value+se))}function ae(){const se=n.triggerEl??r.value;if(!se)return;const de=se.getBoundingClientRect();h.value=de.width,a.value=!0,n.searchable&&(M.value=""),n.modelOpen!==void 0&&o("update:modelOpen",!0);const we=de.bottom+4,Re=Nn(n.boundaryEl);n.align==="right"?C.value={right:Fo(Math.min(de.right,Re.right)),top:we,up:!1}:C.value={left:Math.max(Re.left,de.left),top:we,up:!1};const Ke=te.value.findIndex(We=>String(We.value)===String(n.modelValue));i.value=Ke>=0?Math.max(0,Math.min(Ke-Math.floor(fe.value/2),te.value.length-fe.value)):0,n.searchable&&t.nextTick(()=>{var We;return(We=E.value)==null?void 0:We.focus()}),t.nextTick(()=>{const We=n.triggerEl??r.value;if(!We)return;const rt=We.getBoundingClientRect(),je=c.value;if(!je)return;const A=je.offsetHeight,K=Re.bottom-rt.bottom-8,$=rt.top-Re.top-8,V=K<A&&$>0,x=V?rt.top-A-4:rt.bottom+4,H=Math.min(Re.top+8,rt.bottom+4),z=Math.max(H,Math.min(Re.bottom-A-8,x));n.align==="right"?C.value={right:Fo(Math.min(rt.right,Re.right)),top:z,up:V}:C.value={left:Math.max(Re.left,rt.left),top:z,up:V}})}function qe(){a.value=!1,M.value="",n.modelOpen!==void 0&&o("update:modelOpen",!1)}function ut(){a.value?qe():ae()}function J(se){se.disabled||(o("update:modelValue",se.value),o("change",se.value),qe())}function O(se){var we,Re;if(!a.value)return;const de=se.target;(we=r.value)!=null&&we.contains(de)||(Re=c.value)!=null&&Re.contains(de)||qe()}function L(se){a.value&&(se.preventDefault(),ce(se.deltaY>0?1:-1))}t.watch(a,se=>{t.nextTick(()=>{var de,we;se?((de=d.value)==null||de.addEventListener("wheel",L,{passive:!1}),document.addEventListener("keydown",le)):((we=d.value)==null||we.removeEventListener("wheel",L),document.removeEventListener("keydown",le))})});function le(se){a.value&&se.key==="Escape"&&qe()}t.watch(()=>n.modelOpen,se=>{se!==void 0&&se!==a.value&&(se?ae():qe())});function $e(se){a.value&&(S.value=se.touches[0].clientY,m.value=!0)}function et(se){if(!a.value||!m.value)return;const de=se.touches[0].clientY-S.value;Math.abs(de)>5&&(ce(de<0?1:-1),S.value=se.touches[0].clientY)}function oe(){m.value=!1}function xe(se){se.key==="Escape"&&(se.stopPropagation(),qe())}return t.onMounted(()=>{document.addEventListener("pointerdown",O),window.addEventListener("resize",qe),window.addEventListener("scroll",qe,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",O),document.removeEventListener("keydown",le),window.removeEventListener("resize",qe),window.removeEventListener("scroll",qe,!0)}),(se,de)=>{var we,Re,Ke,We,rt;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:ut},[(we=B.value)!=null&&we.icon||e.triggerIcon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__icon",innerHTML:((Re=B.value)==null?void 0:Re.icon)||e.triggerIcon},null,8,hs)):t.createCommentVNode("",!0),t.createElementVNode("span",gs,t.toDisplayString((Ke=B.value)!=null&&Ke.icon||e.triggerIcon?((We=B.value)==null?void 0:We.label)??e.triggerLabel:((rt=B.value)==null?void 0:rt.label)??e.fallbackLabel),1),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,ps)),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[a.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:c,class:t.normalizeClass(["sp-dropdown__menu",{"sp-dropdown__menu--up":C.value.up}]),style:t.normalizeStyle({left:C.value.left!==void 0?C.value.left+"px":void 0,right:C.value.right!==void 0?C.value.right+"px":void 0,top:C.value.top+"px",minWidth:G.value!==void 0?typeof G.value=="number"?G.value+"px":G.value:void 0}),onKeydown:xe,onMousedown:de[4]||(de[4]=t.withModifiers(()=>{},["prevent"]))},[Ae.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!me.value}]),disabled:!me.value,onClick:de[0]||(de[0]=je=>ce(-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,bs)):t.createCommentVNode("",!0),e.searchable?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:1,ref_key:"searchInputRef",ref:E,"onUpdate:modelValue":de[1]||(de[1]=je=>M.value=je),class:"sp-dropdown__search",type:"text",placeholder:e.searchPlaceholder,onMousedown:de[2]||(de[2]=t.withModifiers(()=>{},["stop"]))},null,40,ys)),[[t.vModelText,M.value]]):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:d,class:"sp-dropdown__list",onTouchstart:$e,onTouchmove:et,onTouchend:oe},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ie.value,je=>(t.openBlock(),t.createElementBlock("button",{key:String(je.value),type:"button",class:t.normalizeClass(["sp-dropdown__item",{"sp-dropdown__item--active":!je.disabled&&String(je.value)===String(e.modelValue),"sp-dropdown__item--disabled":je.disabled}]),disabled:je.disabled,onClick:A=>J(je)},[je.icon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__item-icon",innerHTML:je.icon},null,8,ws)):t.createCommentVNode("",!0),t.createElementVNode("span",vs,t.toDisplayString(je.label),1)],10,Cs))),128))],544),e.searchable&&!ge.value?(t.openBlock(),t.createElementBlock("div",ks,t.toDisplayString(t.unref(g)(e.locale,"searchNoMatch")),1)):t.createCommentVNode("",!0),Ae.value?(t.openBlock(),t.createElementBlock("button",{key:3,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!Ee.value}]),disabled:!Ee.value,onClick:de[3]||(de[3]=je=>ce(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,Es)):t.createCommentVNode("",!0)],38)):t.createCommentVNode("",!0)]),_:1})]))],4)}}}),Ot=(e,l)=>{const n=e.__vccOpts||e;for(const[o,a]of l)n[o]=a;return n},Ut=Ot(Rs,[["__scopeId","data-v-8c94c1de"]]);function Oo(){const e=t.ref({top:0,up:!1});function l(n,o,a){const i=Nn(o),r=n.getBoundingClientRect(),d=Fo(Math.min(r.right,i.right));if(!a){e.value={right:d,top:r.bottom+4,up:!1};return}const c=a.offsetHeight,C=i.bottom-r.bottom-8,h=r.top-i.top-8,S=C<c&&h>0,m=S?r.top-c-4:r.bottom+4,M=Math.min(i.top+8,r.bottom+4),E=Math.max(M,Math.min(i.bottom-c-8,m));e.value={right:d,top:E,up:S}}return{pos:e,place:l}}const Ms={class:"color-palette"},Ss=["title","onClick"],ha=Ot(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 d(h){return g(n.locale,h)}function c(h){const S=n.currentColor;return!S&&!h?!0:S?S.toLowerCase()===h.toLowerCase():!1}function C(h){o("pick",h)}return(h,S)=>(t.openBlock(),t.createElementBlock("div",Ms,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,(m,M)=>(t.openBlock(),t.createElementBlock("div",{key:M,class:"color-palette__row"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(m,E=>(t.openBlock(),t.createElementBlock("button",{key:E.value,type:"button",class:t.normalizeClass(["color-palette__swatch",{"color-palette__swatch--selected":c(E.value)}]),title:d(E.key),style:t.normalizeStyle({background:E.value||"transparent",border:E.value?"1px solid rgba(0,0,0,0.15)":"1px dashed #999"}),onClick:B=>C(E.value)},null,14,Ss))),128))]))),128))]))}}),[["__scopeId","data-v-50e25658"]]),Dl=Ot(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),d=t.ref(null),{pos:c,place:C}=Oo();t.watch(()=>o.modelOpen,E=>{E!==void 0&&E!==i.value&&(E?S():m())});function h(E){const B=r.value,G=d.value,te=E.target;B&&B.contains(te)||G&&G.contains(te)||m()}function S(){const E=o.triggerEl??r.value;E&&(i.value=!0,o.modelOpen!==void 0&&a("update:modelOpen",!0),C(E,o.boundaryEl),t.nextTick(()=>{const B=o.triggerEl??r.value;if(!B)return;const G=d.value;G&&(C(B,o.boundaryEl,G),document.addEventListener("pointerdown",h))}))}function m(){i.value=!1,o.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",h)}function M(E){a("update:modelValue",E),a("change",E),m()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",h)}),l({open:i,openMenu:S,close:m}),(E,B)=>(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:d,class:"color-picker__menu",style:t.normalizeStyle({left:t.unref(c).left!==void 0?t.unref(c).left+"px":void 0,right:t.unref(c).right!==void 0?t.unref(c).right+"px":void 0,top:t.unref(c).top+"px"}),onMousedown:B[0]||(B[0]=t.withModifiers(()=>{},["stop","prevent"]))},[t.createVNode(ha,{"color-key":o.colorKey,"current-color":o.currentColor,locale:o.locale,onPick:M},null,8,["color-key","current-color","locale"])],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-6f79730a"]]),ga=[{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}],Ns={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"]},Bs={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function Ro(e,l){return Bs[e].includes(l)?"thick":Ns[e].includes(l)?"solid":"dashed"}function ba(e){return Ro(e,"right")==="dashed"&&Ro(e,"bottom")==="dashed"}const ya=.75,Ca=26,wa=26,xs=[{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"}],Ts={none:"borderNone",bottom:"borderBottom",top:"borderTop",left:"borderLeft",right:"borderRight",all:"borderAll",outer:"borderOuter",thickOuter:"borderThickOuter"};function rn(e){return e==="dashed"||e==="dotted"?e:"solid"}function va(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 Vs=["title","onClick"],Ds={viewBox:"0 0 30 30",class:"border-picker__icon"},Fs=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],Os=["cx","cy","r"],Is={class:"border-picker__label"},As={class:"border-picker__item--sub-label"},Ls={class:"border-picker__item--sub-label"},$s=["title","onClick"],zs={viewBox:"0 0 64 20",class:"border-picker__line-preview"},_s=["stroke-dasharray","stroke-linecap"],Hs={class:"border-picker__line-label"},Ws=Ot(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),d=t.ref(null),c=t.ref(!1),C=t.ref(null),h=t.ref("right"),S=t.ref(!1);let m;const M=t.ref({top:0}),{pos:E,place:B}=Oo();t.watch(()=>o.modelOpen,de=>{de!==void 0&&de!==i.value&&(de?te():ge())});function G(de){const we=r.value,Re=d.value,Ke=de.target;we&&we.contains(Ke)||Re&&Re.contains(Ke)||Ke instanceof Element&&Ke.closest(".border-submenu-wrap")||ge()}function te(){const de=o.triggerEl??r.value;de&&(i.value=!0,o.modelOpen!==void 0&&a("update:modelOpen",!0),B(de,o.boundaryEl),t.nextTick(()=>{const we=o.triggerEl??r.value;if(!we)return;const Re=d.value;Re&&(B(we,o.boundaryEl,Re),document.addEventListener("pointerdown",G))}))}function ge(){i.value=!1,c.value=!1,o.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",G)}function fe(de){a("change",de),ge()}function Ie(de){clearTimeout(m),c.value=!0,t.nextTick(()=>{var z;const we=de.currentTarget instanceof HTMLElement?de.currentTarget:null;if(!we)return;const Re=we.getBoundingClientRect(),Ke=(z=C.value)==null?void 0:z.closest(".border-submenu-wrap");if(!Ke)return;const We=Nn(o.boundaryEl),rt=Ke.offsetWidth,je=Ke.offsetHeight,K=Re.right+rt+8>We.right?"left":"right",$=Re.top+je>We.bottom-8,V=$?Re.bottom+5-je:Re.top-5,x=Math.min(We.top+8,V),H=Math.max(x,Math.min(We.bottom-je-8,V));h.value=K,S.value=$,M.value=K==="right"?{left:Re.right+4,top:H}:{right:Fo(Re.left-4),top:H}})}function me(){clearTimeout(m),m=setTimeout(()=>{c.value=!1},150)}function Ee(){clearTimeout(m)}function Ae(de){c.value=!1,a("changeColor",de),ge()}const ce=[{key:"solid",i18nKey:"lineSolid"},{key:"dashed",i18nKey:"lineDashed"},{key:"dotted",i18nKey:"lineDotted"}],ae=t.ref(!1),qe=t.ref(null),ut=t.ref("right"),J=t.ref(!1);let O;const L=t.ref({top:0});function le(de){const we=va(de,2);return we?`${we[0]} ${we[1]}`:void 0}function $e(de){return rn(o.currentLineStyle)===de}function et(de){clearTimeout(O),ae.value=!0,t.nextTick(()=>{var z;const we=de.currentTarget instanceof HTMLElement?de.currentTarget:null;if(!we)return;const Re=we.getBoundingClientRect(),Ke=(z=qe.value)==null?void 0:z.closest(".border-submenu-wrap");if(!Ke)return;const We=Nn(o.boundaryEl),rt=Ke.offsetWidth,je=Ke.offsetHeight,K=Re.right+rt+8>We.right?"left":"right",$=Re.top+je>We.bottom-8,V=$?Re.bottom+5-je:Re.top-5,x=Math.min(We.top+8,V),H=Math.max(x,Math.min(We.bottom-je-8,V));ut.value=K,J.value=$,L.value=K==="right"?{left:Re.right+4,top:H}:{right:Fo(Re.left-4),top:H}})}function oe(){clearTimeout(O),O=setTimeout(()=>{ae.value=!1},150)}function xe(){clearTimeout(O)}function se(de){ae.value=!1,a("change-line-style",de),ge()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",G),clearTimeout(m)}),l({open:i,openMenu:te,close:ge}),(de,we)=>(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:d,class:"border-picker__menu",style:t.normalizeStyle({left:t.unref(E).left!==void 0?t.unref(E).left+"px":void 0,right:t.unref(E).right!==void 0?t.unref(E).right+"px":void 0,top:t.unref(E).top+"px"}),onMousedown:we[2]||(we[2]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(xs),Re=>(t.openBlock(),t.createElementBlock("button",{key:Re.key,class:"border-picker__item",title:t.unref(g)(e.locale,Re.i18nKey),onClick:Ke=>fe(Re.key)},[(t.openBlock(),t.createElementBlock("svg",Ds,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(ga),Ke=>(t.openBlock(),t.createElementBlock("line",{key:Ke.name,x1:Ke.x1,y1:Ke.y1,x2:Ke.x2,y2:Ke.y2,stroke:"currentColor","stroke-width":t.unref(Ro)(Re.key,Ke.name)==="thick"?3:1.5,"stroke-dasharray":t.unref(Ro)(Re.key,Ke.name)==="dashed"?"0 4":"none","stroke-linecap":t.unref(Ro)(Re.key,Ke.name)==="dashed"?"round":"square"},null,8,Fs))),128)),t.unref(ba)(Re.key)?(t.openBlock(),t.createElementBlock("circle",{key:0,cx:t.unref(Ca),cy:t.unref(wa),r:t.unref(ya),fill:"currentColor"},null,8,Os)):t.createCommentVNode("",!0)])),t.createElementVNode("span",Is,t.toDisplayString(t.unref(g)(e.locale,Re.i18nKey)),1)],8,Vs))),128)),we[11]||(we[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":ae.value}]),onMouseenter:we[0]||(we[0]=Re=>et(Re)),onMouseleave:oe},[we[7]||(we[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",As,t.toDisplayString(t.unref(g)(e.locale,"borderLineStyle")),1),we[8]||(we[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":c.value}]),onMouseenter:we[1]||(we[1]=Re=>Ie(Re)),onMouseleave:me},[we[9]||(we[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",Ls,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),we[10]||(we[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&&c.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"colorSubRef",ref:C,class:t.normalizeClass(["border-submenu-wrap",{"border-submenu-wrap--left":h.value==="left","border-submenu-wrap--up":S.value}]),style:t.normalizeStyle({left:M.value.left!==void 0?M.value.left+"px":void 0,right:M.value.right!==void 0?M.value.right+"px":void 0,top:M.value.top+"px"}),onClick:we[3]||(we[3]=t.withModifiers(()=>{},["stop"])),onMousedown:we[4]||(we[4]=t.withModifiers(()=>{},["prevent"])),onMouseenter:Ee,onMouseleave:me},[t.createVNode(ha,{"color-key":"border","current-color":e.currentColor,locale:e.locale,onPick:Ae},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&&ae.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"lineSubRef",ref:qe,class:t.normalizeClass(["border-submenu-wrap",{"border-submenu-wrap--left":ut.value==="left","border-submenu-wrap--up":J.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:we[5]||(we[5]=t.withModifiers(()=>{},["stop"])),onMousedown:we[6]||(we[6]=t.withModifiers(()=>{},["prevent"])),onMouseenter:xe,onMouseleave:oe},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(ce,Re=>t.createElementVNode("button",{key:Re.key,class:t.normalizeClass(["border-picker__line-item",{"border-picker__line-item--active":$e(Re.key)}]),title:t.unref(g)(e.locale,Re.i18nKey),onClick:Ke=>se(Re.key)},[(t.openBlock(),t.createElementBlock("svg",zs,[t.createElementVNode("line",{x1:"3",y1:"10",x2:"61",y2:"10",stroke:"currentColor","stroke-width":"2","stroke-dasharray":le(Re.key)||"none","stroke-linecap":Re.key==="dotted"?"round":"butt"},null,8,_s)])),t.createElementVNode("span",Hs,t.toDisplayString(t.unref(g)(e.locale,Re.i18nKey)),1)],10,$s)),64))],38)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-515c076a"]]),ka=[{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}],Ea={asc:"M832 800V288M672 448l160-160 160 160",desc:"M832 224v512M672 576l160 160 160-160"},Us=[{key:"asc",i18nKey:"sortAsc"},{key:"desc",i18nKey:"sortDesc"}],Ps=["title","onClick"],Ks={viewBox:"0 0 1024 1024",class:"sort-picker__icon",fill:"none",stroke:"currentColor","stroke-width":"64","stroke-linecap":"round","stroke-linejoin":"round"},Gs=["x1","y1","x2","y2"],qs=["d"],Ys={class:"sort-picker__label"},js=Ot(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),d=t.ref(null),{pos:c,place:C}=Oo();t.watch(()=>o.modelOpen,E=>{E!==void 0&&E!==i.value&&(E?S():m())});function h(E){const B=r.value,G=d.value,te=E.target;B&&B.contains(te)||G&&G.contains(te)||m()}function S(){const E=o.triggerEl??r.value;E&&(i.value=!0,o.modelOpen!==void 0&&a("update:modelOpen",!0),C(E,o.boundaryEl),t.nextTick(()=>{const B=o.triggerEl??r.value;if(!B)return;const G=d.value;G&&(C(B,o.boundaryEl,G),document.addEventListener("pointerdown",h))}))}function m(){i.value=!1,o.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",h)}function M(E){a("change",E),m()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",h)}),l({open:i,openMenu:S,close:m}),(E,B)=>(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:d,class:"sort-picker__menu",style:t.normalizeStyle({left:t.unref(c).left!==void 0?t.unref(c).left+"px":void 0,right:t.unref(c).right!==void 0?t.unref(c).right+"px":void 0,top:t.unref(c).top+"px"}),onMousedown:B[0]||(B[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Us),G=>(t.openBlock(),t.createElementBlock("button",{key:G.key,class:"sort-picker__item",title:t.unref(g)(e.locale,G.i18nKey),onClick:te=>M(G.key)},[(t.openBlock(),t.createElementBlock("svg",Ks,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(ka),te=>(t.openBlock(),t.createElementBlock("line",{key:te.name,x1:te.x1,y1:te.y1,x2:te.x2,y2:te.y2},null,8,Gs))),128)),t.createElementVNode("path",{d:t.unref(Ea)[G.key]},null,8,qs)])),t.createElementVNode("span",Ys,t.toDisplayString(t.unref(g)(e.locale,G.i18nKey)),1)],8,Ps))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-5b172d0e"]]),Xs={key:0,class:"outline-picker__sep"},Zs=["onClick"],Js={class:"outline-picker__label"},Qs=Ot(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),d=t.ref(null),c=t.ref(null),{pos:C,place:h}=Oo();t.watch(()=>o.modelOpen,B=>{B!==void 0&&B!==r.value&&(B?m():M())});function S(B){const G=d.value,te=c.value,ge=B.target;G&&G.contains(ge)||te&&te.contains(ge)||M()}function m(){const B=o.triggerEl??d.value;B&&(r.value=!0,o.modelOpen!==void 0&&a("update:modelOpen",!0),h(B,o.boundaryEl),t.nextTick(()=>{const G=o.triggerEl??d.value;if(!G)return;const te=c.value;te&&(h(G,o.boundaryEl,te),document.addEventListener("pointerdown",S))}))}function M(){r.value=!1,o.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",S)}function E(B){o.axis&&(a("action",`${B}-${o.axis}`),M())}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",S)}),l({open:r,openMenu:m,close:M}),(B,G)=>(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(()=>[r.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:c,class:"outline-picker__menu",style:t.normalizeStyle({left:t.unref(C).left!==void 0?t.unref(C).left+"px":void 0,right:t.unref(C).right!==void 0?t.unref(C).right+"px":void 0,top:t.unref(C).top+"px"}),onMousedown:G[0]||(G[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",Xs)):(t.openBlock(),t.createElementBlock("div",{key:1,class:"outline-picker__item",onClick:ge=>E(te.key)},[t.createElementVNode("span",Js,t.toDisplayString(t.unref(g)(e.locale,te.i18nKey)),1)],8,Zs))],64))),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-5e1b54bf"]]),ec=["title","onClick"],tc=["innerHTML"],nc={class:"merge-picker__label"},oc=Ot(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),d=t.ref(null),{pos:c,place:C}=Oo();t.watch(()=>o.modelOpen,E=>{E!==void 0&&E!==i.value&&(E?S():m())});function h(E){const B=r.value,G=d.value,te=E.target;B&&B.contains(te)||G&&G.contains(te)||m()}function S(){const E=o.triggerEl??r.value;E&&(i.value=!0,o.modelOpen!==void 0&&a("update:modelOpen",!0),C(E,o.boundaryEl),t.nextTick(()=>{const B=o.triggerEl??r.value;if(!B)return;const G=d.value;G&&(C(B,o.boundaryEl,G),document.addEventListener("pointerdown",h))}))}function m(){i.value=!1,o.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",h)}function M(E){a("change",E),m()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",h)}),l({open:i,openMenu:S,close:m}),(E,B)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:r,class:"merge-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[i.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:d,class:"merge-picker__menu",style:t.normalizeStyle({left:t.unref(c).left!==void 0?t.unref(c).left+"px":void 0,right:t.unref(c).right!==void 0?t.unref(c).right+"px":void 0,top:t.unref(c).top+"px"}),onMousedown:B[0]||(B[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Pi),G=>(t.openBlock(),t.createElementBlock("button",{key:G.key,class:"merge-picker__item",title:t.unref(g)(e.locale,G.labelKey),onClick:te=>M(G.key)},[t.createElementVNode("span",{class:"merge-picker__icon",innerHTML:G.icon},null,8,tc),t.createElementVNode("span",nc,t.toDisplayString(t.unref(g)(e.locale,G.labelKey)),1)],8,ec))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-1905c902"]]),lc=["title","disabled"],rc={class:"cf-menu-trigger__label"},ac=["disabled"],ic=["disabled"],sc=["disabled"],cc=["disabled"],dc=["disabled"],uc=["disabled"],fc=["disabled"],mc=["onClick"],pc=["disabled"],hc=["disabled"],gc=["disabled"],bc=["disabled"],yc=Ot(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),d=t.ref(null),c=t.ref(null),C=t.ref(!1),h=t.ref(null),S=t.ref("right"),m=t.ref("right"),M=t.ref(!1),E=t.ref(!1),B=t.ref(!1),G=t.ref(!1),te=t.ref(!1),ge=t.ref(!1),fe=t.ref(!1),Ie=t.ref(!1),{pos:me,place:Ee}=Oo(),Ae=t.ref({top:0}),ce=t.ref({top:0});let ae;const qe=[{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 ut(){o("update:modelOpen",!C.value)}t.watch(()=>n.modelOpen,V=>{V&&!C.value?J():!V&&C.value&&O()});function J(){const V=i.value;V&&(C.value=!0,h.value=null,Ee(V,n.boundaryEl),t.nextTick(()=>{var H;const x=(H=r.value)==null?void 0:H.closest(".cf-menu");x&&(Ee(V,n.boundaryEl,x),le())}))}function O(){C.value=!1,clearTimeout(ae),h.value=null}function L(){o("update:modelOpen",!1)}function le(){const V=r.value;V&&(B.value=V.scrollTop>1,G.value=V.scrollTop+V.clientHeight<V.scrollHeight-1)}function $e(V){const x=r.value;x&&(x.scrollTop=Math.max(0,Math.min(x.scrollHeight-x.clientHeight,x.scrollTop+V*30)))}function et(V){const x=V==="highlight"?d.value:c.value;if(!x)return;const H=x.scrollTop>1,z=x.scrollTop+x.clientHeight<x.scrollHeight-1;V==="highlight"?(te.value=H,ge.value=z):(fe.value=H,Ie.value=z)}function oe(V,x){const H=V==="highlight"?d.value:c.value;H&&(H.scrollTop=Math.max(0,Math.min(H.scrollHeight-H.clientHeight,H.scrollTop+x*30)))}function xe(V,x){V&&(V.scrollHeight<=V.clientHeight||(x.preventDefault(),V.scrollTop=Math.max(0,Math.min(V.scrollHeight-V.clientHeight,V.scrollTop+x.deltaY))))}function se(V){xe(r.value,V),le()}function de(V){xe(d.value,V),et("highlight")}function we(V){xe(c.value,V),et("clear")}function Re(V){var H,z,Y,ve,ze,it;if(!C.value)return;const x=V.target;(H=a.value)!=null&&H.contains(x)||(z=r.value)!=null&&z.contains(x)||(ve=(Y=d.value)==null?void 0:Y.closest(".cf-submenu-wrap"))!=null&&ve.contains(x)||(it=(ze=c.value)==null?void 0:ze.closest(".cf-submenu-wrap"))!=null&&it.contains(x)||L()}function Ke(V,x){clearTimeout(ae),h.value=V,t.nextTick(()=>{var Ft,Vt;const H=(x==null?void 0:x.currentTarget)instanceof HTMLElement?x.currentTarget:null;if(!H)return;const z=H.getBoundingClientRect(),Y=V==="highlight"?(Ft=d.value)==null?void 0:Ft.closest(".cf-submenu-wrap"):(Vt=c.value)==null?void 0:Vt.closest(".cf-submenu-wrap");if(!Y)return;const ve=Nn(n.boundaryEl),ze=Y.offsetWidth,it=Y.offsetHeight,Fe=z.right+ze+8>ve.right;let v="right";Fe&&(v="left");const Z=z.top+it>ve.bottom-8,lt=Z?z.bottom+5-it:z.top-5,wt=Math.min(ve.top+8,lt),ft=Math.max(wt,Math.min(ve.bottom-it-8,lt)),At=v==="right"?{left:z.right+4,top:ft}:{right:Fo(z.left-4),top:ft};V==="highlight"?(S.value=v,M.value=Z,Ae.value=At):(m.value=v,E.value=Z,ce.value=At),et(V)})}function We(){clearTimeout(ae),ae=setTimeout(()=>{h.value=null},150)}function rt(){clearTimeout(ae)}function je(V){o("preset",V),L()}function A(){o("new-rule"),L()}function K(){o("manage"),L()}function $(V){o("clear",V),L()}return t.onMounted(()=>{document.addEventListener("pointerdown",Re),window.addEventListener("resize",L),window.addEventListener("scroll",L,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",Re),window.removeEventListener("resize",L),window.removeEventListener("scroll",L,!0)}),(V,x)=>(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:ut},[x[22]||(x[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",rc,t.toDisplayString(t.unref(g)(e.locale,"conditionalFormat")),1),x[23]||(x[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,lc),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"cf-pop"},{default:t.withCtx(()=>[C.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"cf-menu",style:t.normalizeStyle({...e.themeVars,right:t.unref(me).right+"px",top:t.unref(me).top+"px"}),onClick:x[8]||(x[8]=t.withModifiers(()=>{},["stop"])),onMousedown:x[9]||(x[9]=t.withModifiers(()=>{},["prevent"]))},[B.value||G.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["cf-menu__nav",{"cf-menu__nav--disabled":!B.value}]),disabled:!B.value,onClick:x[0]||(x[0]=H=>$e(-1))},[...x[24]||(x[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,ac)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"menuRef",ref:r,class:"cf-menu__body",onScroll:le,onWheelPassive:se},[t.createElementVNode("div",{class:"cf-menu__item cf-menu__item--sub",onMouseenter:x[1]||(x[1]=H=>Ke("highlight",H)),onMouseleave:We},[t.createElementVNode("span",null,t.toDisplayString(t.unref(g)(e.locale,"cfHighlightRules")),1),x[25]||(x[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),x[27]||(x[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:x[2]||(x[2]=H=>e.hasSelection&&je("blank"))},t.toDisplayString(t.unref(g)(e.locale,"cfBlank")),11,ic),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["cf-menu__item",{"cf-menu__item--disabled":!e.hasSelection}]),disabled:!e.hasSelection,onClick:x[3]||(x[3]=H=>e.hasSelection&&je("notBlank"))},t.toDisplayString(t.unref(g)(e.locale,"cfNotBlank")),11,sc),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["cf-menu__item",{"cf-menu__item--disabled":!e.hasSelection}]),disabled:!e.hasSelection,onClick:x[4]||(x[4]=H=>e.hasSelection&&je("duplicate"))},t.toDisplayString(t.unref(g)(e.locale,"cfDuplicate")),11,cc),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["cf-menu__item",{"cf-menu__item--disabled":!e.hasSelection}]),disabled:!e.hasSelection,onClick:x[5]||(x[5]=H=>e.hasSelection&&je("unique"))},t.toDisplayString(t.unref(g)(e.locale,"cfUnique")),11,dc),x[28]||(x[28]=t.createElementVNode("div",{class:"cf-menu__sep"},null,-1)),t.createElementVNode("button",{type:"button",class:"cf-menu__item",onClick:A},t.toDisplayString(t.unref(g)(e.locale,"cfNewRule")),1),t.createElementVNode("button",{type:"button",class:"cf-menu__item",onClick:K},t.toDisplayString(t.unref(g)(e.locale,"cfManageRules")),1),t.createElementVNode("div",{class:"cf-menu__item cf-menu__item--sub",onMouseenter:x[6]||(x[6]=H=>Ke("clear",H)),onMouseleave:We},[t.createElementVNode("span",null,t.toDisplayString(t.unref(g)(e.locale,"cfClearRules")),1),x[26]||(x[26]=t.createElementVNode("svg",{class:"cf-menu__arrow",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M361.387 180.053a32 32 0 0 0 0 45.227L648.107 512l-286.72 286.72a32 32 0 1 0 45.227 45.227l309.333-309.334a32 32 0 0 0 0-45.226L406.613 180.053a32 32 0 0 0-45.226 0z"})],-1))],32)],544),B.value||G.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["cf-menu__nav",{"cf-menu__nav--disabled":!G.value}]),disabled:!G.value,onClick:x[7]||(x[7]=H=>$e(1))},[...x[29]||(x[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,uc)):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(()=>[C.value&&h.value==="highlight"?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["cf-submenu-wrap",{"cf-submenu-wrap--left":S.value==="left","cf-submenu-wrap--up":M.value}]),style:t.normalizeStyle({...e.themeVars,left:Ae.value.left!==void 0?Ae.value.left+"px":void 0,right:Ae.value.right!==void 0?Ae.value.right+"px":void 0,top:Ae.value.top+"px"}),onClick:x[13]||(x[13]=t.withModifiers(()=>{},["stop"])),onMousedown:x[14]||(x[14]=t.withModifiers(()=>{},["prevent"])),onMouseenter:rt,onMouseleave:We},[te.value||ge.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["cf-subnav",{"cf-subnav--disabled":!te.value}]),disabled:!te.value,onClick:x[10]||(x[10]=H=>oe("highlight",-1))},[...x[30]||(x[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,fc)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"highlightSubRef",ref:d,class:"cf-submenu",onScroll:x[11]||(x[11]=H=>et("highlight")),onWheelPassive:de},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(qe,H=>t.createElementVNode("button",{key:H.type,type:"button",class:"cf-menu__subitem",onClick:z=>je(H.type)},t.toDisplayString(t.unref(g)(e.locale,H.key)),9,mc)),64))],544),te.value||ge.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["cf-subnav",{"cf-subnav--disabled":!ge.value}]),disabled:!ge.value,onClick:x[12]||(x[12]=H=>oe("highlight",1))},[...x[31]||(x[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,pc)):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(()=>[C.value&&h.value==="clear"?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["cf-submenu-wrap",{"cf-submenu-wrap--left":m.value==="left","cf-submenu-wrap--up":E.value}]),style:t.normalizeStyle({...e.themeVars,left:ce.value.left!==void 0?ce.value.left+"px":void 0,right:ce.value.right!==void 0?ce.value.right+"px":void 0,top:ce.value.top+"px"}),onClick:x[20]||(x[20]=t.withModifiers(()=>{},["stop"])),onMousedown:x[21]||(x[21]=t.withModifiers(()=>{},["prevent"])),onMouseenter:rt,onMouseleave:We},[fe.value||Ie.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["cf-subnav",{"cf-subnav--disabled":!fe.value}]),disabled:!fe.value,onClick:x[15]||(x[15]=H=>oe("clear",-1))},[...x[32]||(x[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,hc)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"clearSubRef",ref:c,class:"cf-submenu",onScroll:x[18]||(x[18]=H=>et("clear")),onWheelPassive:we},[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["cf-menu__subitem",{"cf-menu__item--disabled":!e.hasSelection}]),disabled:!e.hasSelection,onClick:x[16]||(x[16]=H=>e.hasSelection&&$("selection"))},t.toDisplayString(t.unref(g)(e.locale,"cfClearSelected")),11,gc),t.createElementVNode("button",{type:"button",class:"cf-menu__subitem",onClick:x[17]||(x[17]=H=>$("sheet"))},t.toDisplayString(t.unref(g)(e.locale,"cfClearSheet")),1)],544),fe.value||Ie.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["cf-subnav",{"cf-subnav--disabled":!Ie.value}]),disabled:!Ie.value,onClick:x[19]||(x[19]=H=>oe("clear",1))},[...x[33]||(x[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,bc)):t.createCommentVNode("",!0)],38)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-00c340ba"]]),Cc=["disabled","title","onClick"],wc={class:"calc-picker__label"},vc=Ot(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),d=t.ref(null),c=t.ref(null),{pos:C,place:h}=Oo();t.watch(()=>o.modelOpen,B=>{B!==void 0&&B!==r.value&&(B?m():M())});function S(B){const G=d.value,te=c.value,ge=B.target;G&&G.contains(ge)||te&&te.contains(ge)||M()}function m(){const B=o.triggerEl??d.value;B&&(r.value=!0,o.modelOpen!==void 0&&a("update:modelOpen",!0),h(B,o.boundaryEl),t.nextTick(()=>{const G=o.triggerEl??d.value;if(!G)return;const te=c.value;te&&(h(G,o.boundaryEl,te),document.addEventListener("pointerdown",S))}))}function M(){r.value=!1,o.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",S)}function E(B){o.disabled||(a("change",B),M())}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",S)}),l({open:r,openMenu:m,close:M}),(B,G)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:d,class:"calc-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:c,class:"calc-picker__menu",style:t.normalizeStyle({left:t.unref(C).left!==void 0?t.unref(C).left+"px":void 0,right:t.unref(C).right!==void 0?t.unref(C).right+"px":void 0,top:t.unref(C).top+"px"}),onMousedown:G[0]||(G[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:ge=>E(te.key)},[t.createElementVNode("span",wc,t.toDisplayString(t.unref(g)(e.locale,te.labelKey)),1)],10,Cc)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-118a07d5"]]),kc={class:"tb-item","data-key":"undo"},Ec=["title","disabled"],Rc={class:"toolbar-btn__label"},Mc={class:"tb-item","data-key":"redo"},Sc=["title","disabled"],Nc={class:"toolbar-btn__label"},Bc={class:"tb-item","data-key":"paint"},xc=["title","disabled"],Tc={class:"toolbar-btn__label"},Vc={class:"tb-item","data-key":"clear"},Dc=["title","disabled"],Fc={class:"toolbar-btn__label"},Oc={class:"tb-item","data-key":"font"},Ic={class:"tb-item","data-key":"fontSize"},Ac={class:"toolbar-font-size"},Lc=["value","title"],$c=["title"],zc=["title","disabled"],_c=["title","disabled"],Hc={class:"tb-item","data-key":"bold"},Wc=["title","disabled"],Uc={class:"toolbar-btn__label"},Pc={class:"tb-item","data-key":"italic"},Kc=["title","disabled"],Gc={class:"toolbar-btn__label"},qc={class:"tb-item","data-key":"underline"},Yc=["title","disabled"],jc={class:"toolbar-btn__label"},Xc={class:"tb-item","data-key":"strike"},Zc=["title","disabled"],Jc={class:"toolbar-btn__label"},Qc={class:"tb-item","data-key":"textColor"},ed={class:"toolbar-split"},td=["title","disabled"],nd={viewBox:"0 0 1024 1024",fill:"currentColor"},od=["fill"],ld={class:"toolbar-btn__label"},rd=["title","disabled"],ad={class:"tb-item","data-key":"fillColor"},id={class:"toolbar-split"},sd=["title","disabled"],cd={viewBox:"0 0 1024 1024",fill:"currentColor"},dd=["fill"],ud={class:"toolbar-btn__label"},fd=["title","disabled"],md={class:"tb-item","data-key":"border"},pd={class:"toolbar-split"},hd=["title","disabled"],gd={viewBox:"0 0 30 30",fill:"none",stroke:"currentColor"},bd=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],yd=["cx","cy","r"],Cd={class:"toolbar-btn__label"},wd=["title","disabled"],vd={class:"tb-item","data-key":"hAlign"},kd={class:"tb-item","data-key":"vAlign"},Ed={class:"tb-item","data-key":"wrap"},Rd=["title"],Md={class:"toolbar-btn__label"},Sd={class:"tb-item","data-key":"merge"},Nd={class:"toolbar-split"},Bd=["title","disabled"],xd={class:"toolbar-btn__label"},Td=["title","disabled"],Vd={class:"tb-item","data-key":"numFmt"},Dd={class:"toolbar-number-format-group"},Fd=["title","disabled"],Od=["title","disabled"],Id={class:"tb-item","data-key":"calc"},Ad={class:"toolbar-split"},Ld=["title","disabled"],$d={class:"toolbar-btn__label"},zd=["title","disabled"],_d={class:"tb-item","data-key":"sort"},Hd={class:"toolbar-split"},Wd=["title","disabled"],Ud={viewBox:"0 0 1024 1024",fill:"none",stroke:"currentColor","stroke-width":"64","stroke-linecap":"round","stroke-linejoin":"round"},Pd=["x1","y1","x2","y2"],Kd=["d"],Gd={class:"toolbar-btn__label"},qd=["title","disabled"],Yd={class:"tb-item","data-key":"outline"},jd=["disabled","title"],Xd={class:"toolbar-btn__label"},Zd={class:"tb-item","data-key":"filter"},Jd=["disabled","title"],Qd={class:"toolbar-btn__label"},eu={class:"tb-item","data-key":"freeze"},tu={class:"tb-item","data-key":"cf"},nu={class:"tb-item","data-key":"dv"},ou=["title"],lu={class:"toolbar-btn__label"},ru={class:"tb-item","data-key":"find"},au=["title"],iu={class:"toolbar-btn__label"},su=["disabled"],cu=["disabled"],Ra='<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>',du='<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>',uu='<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>',fu='<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>',vr=2,mu=6,pu=34,hu=Ot(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),d=t.ref(null),c=t.ref(null),C=t.ref(null),h=t.ref(null),S=t.ref(null),m=t.ref(null),M=t.ref(null),E=t.ref(null),B=t.ref(new Set),G=t.ref(!1),te=t.ref(!1),ge=t.ref(0),fe=t.ref(!1),Ie=t.ref(!1),me=new Map,Ee=t.computed(()=>B.value.size>0);function Ae(Fe){return B.value.has(Fe)}const ce=t.computed(()=>{const Fe=i.value;return Fe instanceof HTMLElement?Fe:void 0});function ae(Fe){return ce.value?!Ae(Fe):!0}function qe(){for(const Fe of o){const v=me.get(Fe);if(v===void 0||v===0)return!0}return!1}function ut(){if(!a.value)return;a.value.querySelectorAll(".tb-item").forEach(v=>{const Z=v.dataset.key;if(!Z)return;const lt=v.offsetWidth;lt>0?me.set(Z,lt):me.has(Z)||me.set(Z,0)})}function J(Fe,v){if(Fe.size!==v.size)return!1;for(const Z of Fe)if(!v.has(Z))return!1;return!0}let O=0,L=0,le=null;function $e(){if(O&&cancelAnimationFrame(O),L>60){le&&clearTimeout(le),le=setTimeout(()=>{L=0,$e()},500);return}L++,O=requestAnimationFrame(()=>requestAnimationFrame(et))}function et(){if(!a.value)return;const Fe=a.value.clientWidth-mu*2;if(Fe<=0){$e();return}L=0,(me.size===0||qe())&&ut();let v=0;for(const lt of o)v+=(me.get(lt)??0)+vr;const Z=new Set;if(v>Fe){const lt=Fe-pu-vr;let wt=0;for(let ft=0;ft<o.length;ft++){const At=o[ft],Ft=(me.get(At)??0)+vr;if(wt+Ft>lt){for(let Vt=ft;Vt<o.length;Vt++)Z.add(o[Vt]);break}wt+=Ft}}J(Z,B.value)||(B.value=Z,ge.value++,Z.size===0&&(G.value=!1))}let oe=null;const xe=t.ref(0),se=t.computed(()=>{const Fe=r.value,v={position:"fixed",top:"0px",right:"0px"};if(!Fe)return{...$.themeVars,...v};xe.value;const Z=Fe.getBoundingClientRect(),lt=Nn($.boundaryEl);return{...$.themeVars,position:"fixed",top:`${Z.bottom+4}px`,right:`${Fo(Math.min(Z.right,lt.right))}px`}});function de(){G.value&&(xe.value++,t.nextTick(()=>et()))}function we(Fe){var Z,lt,wt;if(!G.value)return;const v=Fe.target;(Z=v.closest)!=null&&Z.call(v,".overflow-menu-wrap")||(lt=r.value)!=null&&lt.contains(v)||(wt=v.closest)!=null&&wt.call(v,".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,G.value=!1,t.nextTick(()=>{te.value=!1}))}function Re(){G.value=!G.value,G.value&&t.nextTick(A)}function Ke(){G.value=!1,V("open-data-validation")}function We(){G.value=!1,V("find")}function rt(){G.value=!1,V("toggle-filter")}function je(){G.value=!1}function A(){const Fe=i.value;Fe&&(fe.value=Fe.scrollTop>1,Ie.value=Fe.scrollTop+Fe.clientHeight<Fe.scrollHeight-1,Y())}function K(Fe){const v=i.value;v&&(v.scrollTop=Math.max(0,Math.min(v.scrollHeight-v.clientHeight,v.scrollTop+Fe*40)))}l({closeOverflow:je}),t.onMounted(()=>{$e(),a.value&&(oe=new ResizeObserver(()=>{G.value||$e()}),oe.observe(a.value)),document.addEventListener("pointerdown",we,!0),window.addEventListener("resize",de),window.addEventListener("load",$e),window.addEventListener("orientationchange",$e)}),t.onBeforeUnmount(()=>{O&&cancelAnimationFrame(O),le&&clearTimeout(le),oe==null||oe.disconnect(),document.removeEventListener("pointerdown",we,!0),window.removeEventListener("resize",de),window.removeEventListener("load",$e),window.removeEventListener("orientationchange",$e)});const $=e,V=n,x=["fontSize","textColor","fillColor","border","merge","calc","sort","outline","cf","freeze","font","hAlign","vAlign","numFmt"],H={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(Fe,v){if(v)for(const Z of x)Z!==Fe&&V(H[Z],!1);V(H[Fe],v)}function Y(){for(const Fe of x)V(H[Fe],!1)}function ve(Fe){var Z;const v=Fe.target;(Z=v.closest)!=null&&Z.call(v,".toolbar-split__arrow, .outline-trigger, .toolbar-font-size__btn, .cf-menu-trigger, .sp-dropdown__trigger")||Y()}const ze=t.computed(()=>$.selNumberFormat===jn?g($.locale,"nfMixed"):""),it=t.computed(()=>{const Fe=[{label:g($.locale,"freezeFirstRow"),value:"firstRow",icon:du},{label:g($.locale,"freezeFirstCol"),value:"firstCol",icon:uu}];return $.hasFreeze?Fe.unshift({label:g($.locale,"unfreezePanes"),value:"unfreeze",icon:fu}):Fe.unshift({label:g($.locale,"freezePanes"),value:"panes",icon:Ra,disabled:$.freezePanesDisabled}),Fe});return(Fe,v)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{ref_key:"rootEl",ref:a,class:"toolbar",onMousedown:v[67]||(v[67]=t.withModifiers(()=>{},["prevent"]))},[(t.openBlock(),t.createBlock(t.Teleport,{disabled:ae("undo"),to:ce.value},[t.createElementVNode("div",kc,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canUndo}]),title:t.unref(g)(e.locale,"undo"),disabled:!e.canUndo,onClick:v[0]||(v[0]=Z=>V("undo"))},[v[71]||(v[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",Rc,t.toDisplayString(t.unref(g)(e.locale,"undo")),1)],10,Ec)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ae("redo"),to:ce.value},[t.createElementVNode("div",Mc,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canRedo}]),title:t.unref(g)(e.locale,"redo"),disabled:!e.canRedo,onClick:v[1]||(v[1]=Z=>V("redo"))},[v[72]||(v[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",Nc,t.toDisplayString(t.unref(g)(e.locale,"redo")),1)],10,Sc)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ae("paint"),to:ce.value},[t.createElementVNode("div",Bc,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.paintFmtActive}]),title:t.unref(g)(e.locale,"paintFormat"),disabled:!e.hasSelection,onClick:v[2]||(v[2]=Z=>V("paint-format"))},[v[73]||(v[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",Tc,t.toDisplayString(t.unref(g)(e.locale,"paintFormat")),1)],10,xc)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ae("clear"),to:ce.value},[t.createElementVNode("div",Vc,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.hasSelection}]),title:t.unref(g)(e.locale,"clearFormat"),disabled:!e.hasSelection,onClick:v[3]||(v[3]=Z=>V("clear-format"))},[v[74]||(v[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",Fc,t.toDisplayString(t.unref(g)(e.locale,"clearFormat")),1)],10,Dc)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ae("sep1"),to:ce.value},[v[75]||(v[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:ae("font"),to:ce.value},[t.createElementVNode("div",Oc,[t.createVNode(Ut,{class:"toolbar-font","model-value":e.selFontFamily,options:e.fontFamilyOptions,width:Ae("font")?"100%":110,"menu-width":Ae("font")?120:void 0,"visible-count":8,title:t.unref(g)(e.locale,"fontFamily"),align:"right","model-open":e.fontMenuOpen,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":v[4]||(v[4]=Z=>z("font",Z)),onChange:v[5]||(v[5]=Z=>V("font-family-change",Z))},null,8,["model-value","options","width","menu-width","title","model-open","boundary-el"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ae("fontSize"),to:ce.value},[t.createElementVNode("div",Ic,[t.createElementVNode("div",Ac,[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:v[6]||(v[6]=t.withModifiers(()=>{},["stop"])),onInput:v[7]||(v[7]=Z=>V("font-size-input",Z.target.value)),onBlur:v[8]||(v[8]=Z=>V("font-size-blur")),onKeydown:v[9]||(v[9]=Z=>V("font-size-keydown",Z))},null,40,Lc),t.createVNode(Ut,{class:"toolbar-font-size__dropdown","model-value":e.selFontSize,options:e.fontSizeOptions,width:Ae("fontSize")?"100%":56,"menu-width":Ae("fontSize")?120:56,"visible-count":9,title:t.unref(g)(e.locale,"fontSize"),"hide-trigger":!0,"model-open":e.fontSizeMenuOpen,align:"right","trigger-el":E.value,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":v[10]||(v[10]=Z=>z("fontSize",Z)),onChange:v[11]||(v[11]=Z=>V("font-size-change",Z))},null,8,["model-value","options","width","menu-width","title","model-open","trigger-el","boundary-el"]),t.createElementVNode("button",{ref_key:"fontSizeArrowRef",ref:E,class:"toolbar-font-size__btn",type:"button",title:t.unref(g)(e.locale,"fontSize"),onMousedown:v[12]||(v[12]=t.withModifiers(()=>{},["prevent"])),onClick:v[13]||(v[13]=Z=>V("font-size-toggle"))},[...v[76]||(v[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,$c),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(g)(e.locale,"fontSizeDecrease"),disabled:!e.hasSelection,onMousedown:v[14]||(v[14]=t.withModifiers(()=>{},["prevent"])),onClick:v[15]||(v[15]=Z=>V("font-size-step-down"))},[...v[77]||(v[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,zc),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(g)(e.locale,"fontSizeIncrease"),disabled:!e.hasSelection,onMousedown:v[16]||(v[16]=t.withModifiers(()=>{},["prevent"])),onClick:v[17]||(v[17]=Z=>V("font-size-step-up"))},[...v[78]||(v[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,_c)])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ae("sep2"),to:ce.value},[v[79]||(v[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:ae("bold"),to:ce.value},[t.createElementVNode("div",Hc,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontWeight}]),title:t.unref(g)(e.locale,"bold"),disabled:!e.hasSelection,onClick:v[18]||(v[18]=Z=>V("bold-toggle"))},[v[80]||(v[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",Uc,t.toDisplayString(t.unref(g)(e.locale,"bold")),1)],10,Wc)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ae("italic"),to:ce.value},[t.createElementVNode("div",Pc,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontStyle}]),title:t.unref(g)(e.locale,"italic"),disabled:!e.hasSelection,onClick:v[19]||(v[19]=Z=>V("italic-toggle"))},[v[81]||(v[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",Gc,t.toDisplayString(t.unref(g)(e.locale,"italic")),1)],10,Kc)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ae("underline"),to:ce.value},[t.createElementVNode("div",qc,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selUnderline}]),title:t.unref(g)(e.locale,"underline"),disabled:!e.hasSelection,onClick:v[20]||(v[20]=Z=>V("underline-toggle"))},[v[82]||(v[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",jc,t.toDisplayString(t.unref(g)(e.locale,"underline")),1)],10,Yc)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ae("strike"),to:ce.value},[t.createElementVNode("div",Xc,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selStrikethrough}]),title:t.unref(g)(e.locale,"strikethrough"),disabled:!e.hasSelection,onClick:v[21]||(v[21]=Z=>V("strikethrough-toggle"))},[v[83]||(v[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",Jc,t.toDisplayString(t.unref(g)(e.locale,"strikethrough")),1)],10,Zc)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ae("sep3"),to:ce.value},[v[84]||(v[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:ae("textColor"),to:ce.value},[t.createElementVNode("div",Qc,[t.createElementVNode("div",ed,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(g)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:v[22]||(v[22]=Z=>V("apply-text-color"))},[(t.openBlock(),t.createElementBlock("svg",nd,[v[85]||(v[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,od)])),t.createElementVNode("span",ld,t.toDisplayString(t.unref(g)(e.locale,"fontColor")),1)],8,td),t.createElementVNode("button",{ref_key:"textColorArrowRef",ref:d,class:"toolbar-btn toolbar-split__arrow",title:t.unref(g)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:v[23]||(v[23]=Z=>z("textColor",!e.textColorMenuOpen))},[...v[86]||(v[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,rd),t.createVNode(Dl,{"model-open":e.textColorMenuOpen,"color-key":"text","current-color":e.selTextColor,locale:e.locale,"trigger-el":d.value,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":v[24]||(v[24]=Z=>z("textColor",Z)),onChange:v[25]||(v[25]=Z=>V("text-color-change",Z))},null,8,["model-open","current-color","locale","trigger-el","boundary-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ae("fillColor"),to:ce.value},[t.createElementVNode("div",ad,[t.createElementVNode("div",id,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(g)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:v[26]||(v[26]=Z=>V("apply-fill-color"))},[(t.openBlock(),t.createElementBlock("svg",cd,[v[87]||(v[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,dd)])),t.createElementVNode("span",ud,t.toDisplayString(t.unref(g)(e.locale,"fillColor")),1)],8,sd),t.createElementVNode("button",{ref_key:"fillColorArrowRef",ref:c,class:"toolbar-btn toolbar-split__arrow",title:t.unref(g)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:v[27]||(v[27]=Z=>z("fillColor",!e.fillColorMenuOpen))},[...v[88]||(v[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,fd),t.createVNode(Dl,{"model-open":e.fillColorMenuOpen,"color-key":"fill","current-color":e.selFillColor,locale:e.locale,"trigger-el":c.value,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":v[28]||(v[28]=Z=>z("fillColor",Z)),onChange:v[29]||(v[29]=Z=>V("fill-color-change",Z))},null,8,["model-open","current-color","locale","trigger-el","boundary-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ae("border"),to:ce.value},[t.createElementVNode("div",md,[t.createElementVNode("div",pd,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(g)(e.locale,"borders"),disabled:!e.hasSelection,onClick:v[30]||(v[30]=Z=>V("apply-border"))},[(t.openBlock(),t.createElementBlock("svg",gd,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(ga),Z=>(t.openBlock(),t.createElementBlock("line",{key:Z.name,x1:Z.x1,y1:Z.y1,x2:Z.x2,y2:Z.y2,"stroke-width":t.unref(Ro)(e.cachedBorder,Z.name)==="thick"?3:1.5,"stroke-dasharray":t.unref(Ro)(e.cachedBorder,Z.name)==="dashed"?"0 4":"none","stroke-linecap":t.unref(Ro)(e.cachedBorder,Z.name)==="dashed"?"round":"square"},null,8,bd))),128)),t.unref(ba)(e.cachedBorder)?(t.openBlock(),t.createElementBlock("circle",{key:0,cx:t.unref(Ca),cy:t.unref(wa),r:t.unref(ya),fill:"currentColor",stroke:"none"},null,8,yd)):t.createCommentVNode("",!0)])),t.createElementVNode("span",Cd,t.toDisplayString(t.unref(g)(e.locale,t.unref(Ts)[e.cachedBorder]??"borders")),1)],8,hd),t.createElementVNode("button",{ref_key:"borderArrowRef",ref:C,class:"toolbar-btn toolbar-split__arrow",title:t.unref(g)(e.locale,"borders"),disabled:!e.hasSelection,onClick:v[31]||(v[31]=Z=>z("border",!e.borderMenuOpen))},[...v[89]||(v[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,wd),t.createVNode(Ws,{"model-open":e.borderMenuOpen,locale:e.locale,"current-border":e.cachedBorder,"current-color":e.cachedBorderColor,"current-line-style":e.cachedBorderLineStyle,"trigger-el":C.value,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":v[32]||(v[32]=Z=>z("border",Z)),onChange:v[33]||(v[33]=Z=>V("border-change",Z)),onChangeColor:v[34]||(v[34]=Z=>V("border-color-change",Z)),onChangeLineStyle:v[35]||(v[35]=Z=>V("border-line-style-change",Z))},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:ae("sep4"),to:ce.value},[v[90]||(v[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:ae("hAlign"),to:ce.value},[t.createElementVNode("div",vd,[t.createVNode(Ut,{class:"toolbar-align","model-value":e.selHAlign,options:e.hAlignOptions,width:Ae("hAlign")?"100%":44,"menu-width":Ae("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":v[36]||(v[36]=Z=>z("hAlign",Z)),onChange:v[37]||(v[37]=Z=>V("h-align-change",Z))},null,8,["model-value","options","width","menu-width","title","model-open","boundary-el"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ae("vAlign"),to:ce.value},[t.createElementVNode("div",kd,[t.createVNode(Ut,{class:"toolbar-align","model-value":e.selVAlign,options:e.vAlignOptions,width:Ae("vAlign")?"100%":44,"menu-width":Ae("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":v[38]||(v[38]=Z=>z("vAlign",Z)),onChange:v[39]||(v[39]=Z=>V("v-align-change",Z))},null,8,["model-value","options","width","menu-width","title","model-open","boundary-el"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ae("wrap"),to:ce.value},[t.createElementVNode("div",Ed,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selWrap}]),type:"button",title:t.unref(g)(e.locale,"wrap"),onClick:v[40]||(v[40]=Z=>V("wrap-toggle"))},[v[91]||(v[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",Md,t.toDisplayString(t.unref(g)(e.locale,"wrap")),1)],10,Rd)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ae("merge"),to:ce.value},[t.createElementVNode("div",Sd,[t.createElementVNode("div",Nd,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(g)(e.locale,"mergeCenter"),disabled:!e.hasSelection,onClick:v[41]||(v[41]=Z=>V("apply-merge"))},[v[92]||(v[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",xd,t.toDisplayString(t.unref(g)(e.locale,"mergeCenter")),1)],8,Bd),t.createElementVNode("button",{ref_key:"mergeArrowRef",ref:S,class:"toolbar-btn toolbar-split__arrow",title:t.unref(g)(e.locale,"mergeCells"),disabled:!e.hasSelection,onClick:v[42]||(v[42]=Z=>z("merge",!e.mergeMenuOpen))},[...v[93]||(v[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,Td),t.createVNode(oc,{"model-open":e.mergeMenuOpen,locale:e.locale,"trigger-el":S.value,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":v[43]||(v[43]=Z=>z("merge",Z)),onChange:v[44]||(v[44]=Z=>V("merge-change",Z))},null,8,["model-open","locale","trigger-el","boundary-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ae("sep6"),to:ce.value},[v[94]||(v[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:ae("numFmt"),to:ce.value},[t.createElementVNode("div",Vd,[t.createElementVNode("div",Dd,[t.createVNode(Ut,{class:"toolbar-number-format","model-value":e.selNumberFormat,options:e.nfOptions,width:Ae("numFmt")?"auto":92,"menu-width":(Ae("numFmt"),150),"visible-count":8,title:t.unref(g)(e.locale,"numberFormat"),"fallback-label":ze.value,align:"right","model-open":e.numFmtMenuOpen,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":v[45]||(v[45]=Z=>z("numFmt",Z)),onChange:v[46]||(v[46]=Z=>V("number-format-change",String(Z)))},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:v[47]||(v[47]=Z=>V("increase-decimals"))},[...v[95]||(v[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,Fd),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:v[48]||(v[48]=Z=>V("decrease-decimals"))},[...v[96]||(v[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,Od)])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ae("sep7"),to:ce.value},[v[97]||(v[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:ae("calc"),to:ce.value},[t.createElementVNode("div",Id,[t.createElementVNode("div",Ad,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(g)(e.locale,"sum"),disabled:!e.hasSelection||e.isSingleCell,onClick:v[49]||(v[49]=Z=>V("calc-sum"))},[v[98]||(v[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",$d,t.toDisplayString(t.unref(g)(e.locale,"sum")),1)],8,Ld),t.createElementVNode("button",{ref_key:"calcArrowRef",ref:m,class:"toolbar-btn toolbar-split__arrow",title:t.unref(g)(e.locale,"calculate"),disabled:!e.hasSelection,onClick:v[50]||(v[50]=Z=>z("calc",!e.calcMenuOpen))},[...v[99]||(v[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,zd),t.createVNode(vc,{"model-open":e.calcMenuOpen,locale:e.locale,"trigger-el":m.value,disabled:e.isSingleCell,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":v[51]||(v[51]=Z=>z("calc",Z)),onChange:v[52]||(v[52]=Z=>V(`calc-${Z}`))},null,8,["model-open","locale","trigger-el","disabled","boundary-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ae("sort"),to:ce.value},[t.createElementVNode("div",_d,[t.createElementVNode("div",Hd,[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:v[53]||(v[53]=Z=>V("apply-sort"))},[(t.openBlock(),t.createElementBlock("svg",Ud,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(ka),Z=>(t.openBlock(),t.createElementBlock("line",{key:Z.name,x1:Z.x1,y1:Z.y1,x2:Z.x2,y2:Z.y2},null,8,Pd))),128)),t.createElementVNode("path",{d:t.unref(Ea)[e.cachedSortOrder]},null,8,Kd)])),t.createElementVNode("span",Gd,t.toDisplayString(t.unref(g)(e.locale,"sort")),1)],8,Wd),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:v[54]||(v[54]=Z=>z("sort",!e.sortMenuOpen))},[...v[100]||(v[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,qd),t.createVNode(js,{"model-open":e.sortMenuOpen,locale:e.locale,"current-sort":e.cachedSortOrder,"trigger-el":h.value,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":v[55]||(v[55]=Z=>z("sort",Z)),onChange:v[56]||(v[56]=Z=>V("sort-change",Z))},null,8,["model-open","locale","current-sort","trigger-el","boundary-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ae("outline"),to:ce.value},[t.createElementVNode("div",Yd,[t.createElementVNode("button",{ref_key:"outlineArrowRef",ref:M,class:t.normalizeClass(["toolbar-btn outline-trigger",{"is-open":e.outlineMenuOpen}]),disabled:!e.outlineAxis,title:t.unref(g)(e.locale,"outlineGroup"),onClick:v[57]||(v[57]=Z=>z("outline",!e.outlineMenuOpen))},[v[101]||(v[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",Xd,t.toDisplayString(t.unref(g)(e.locale,"outlineGroup")),1),v[102]||(v[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,jd),t.createVNode(Qs,{"model-open":e.outlineMenuOpen,locale:e.locale,"trigger-el":M.value,"boundary-el":e.boundaryEl,axis:e.outlineAxis,"onUpdate:modelOpen":v[58]||(v[58]=Z=>z("outline",Z)),onAction:v[59]||(v[59]=Z=>V("outline-action",Z))},null,8,["model-open","locale","trigger-el","boundary-el","axis"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ae("filter"),to:ce.value},[t.createElementVNode("div",Zd,[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:rt},[v[103]||(v[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,Jd)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ae("freeze"),to:ce.value},[t.createElementVNode("div",eu,[t.createVNode(Ut,{class:"toolbar-freeze","model-value":"",options:it.value,width:Ae("freeze")?"100%":44,"menu-width":Ae("freeze")?120:void 0,"visible-count":4,align:"right",title:t.unref(g)(e.locale,"freezePane"),"trigger-icon":Ra,"trigger-label":t.unref(g)(e.locale,"freezePane"),"model-open":e.freezeMenuOpen,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":v[60]||(v[60]=Z=>z("freeze",Z)),onChange:v[61]||(v[61]=Z=>V("freeze-change",String(Z)))},null,8,["options","width","menu-width","title","trigger-label","model-open","boundary-el"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ae("cf"),to:ce.value},[t.createElementVNode("div",tu,[t.createVNode(yc,{locale:e.locale,"has-selection":e.hasSelection,"theme-vars":e.themeVars,"model-open":e.cfMenuOpen,"boundary-el":e.boundaryEl,"onUpdate:modelOpen":v[62]||(v[62]=Z=>z("cf",Z)),onPreset:v[63]||(v[63]=Z=>V("cf-preset",Z)),onNewRule:v[64]||(v[64]=Z=>V("cf-new-rule")),onManage:v[65]||(v[65]=Z=>V("cf-manage")),onClear:v[66]||(v[66]=Z=>V("cf-clear",Z))},null,8,["locale","has-selection","theme-vars","model-open","boundary-el"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ae("dv"),to:ce.value},[t.createElementVNode("div",nu,[t.createElementVNode("button",{class:"toolbar-btn",title:t.unref(g)(e.locale,"dv"),onClick:Ke},[v[104]||(v[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",lu,t.toDisplayString(t.unref(g)(e.locale,"dv")),1)],8,ou)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ae("find"),to:ce.value},[t.createElementVNode("div",ru,[t.createElementVNode("button",{class:"toolbar-btn",title:t.unref(g)(e.locale,"find"),onClick:We},[v[105]||(v[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",iu,t.toDisplayString(t.unref(g)(e.locale,"findReplace")),1)],8,au)])],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":G.value}]),type:"button",onClick:Re},[...v[106]||(v[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(se.value),onPointerdown:v[70]||(v[70]=t.withModifiers(()=>{},["stop","prevent"]))},[fe.value||Ie.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["overflow-nav",{"overflow-nav--disabled":!fe.value}]),disabled:!fe.value,onClick:v[68]||(v[68]=Z=>K(-1))},[...v[107]||(v[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,su)):t.createCommentVNode("",!0),(t.openBlock(),t.createElementBlock("div",{ref_key:"overflowMenuEl",ref:i,key:ge.value,class:"overflow-menu",onScroll:A,onClick:ve},null,32)),fe.value||Ie.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["overflow-nav",{"overflow-nav--disabled":!Ie.value}]),disabled:!Ie.value,onClick:v[69]||(v[69]=Z=>K(1))},[...v[108]||(v[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,cu)):t.createCommentVNode("",!0)],38),[[t.vShow,G.value]])]),_:1})]))],64))}}),[["__scopeId","data-v-68b5264e"]]),gu=["title"],bu={class:"tab-list"},yu=["onClick","onDblclick","onContextmenu","onTouchstart"],Cu=["value"],wu={key:1,class:"tab-item__name"},vu=["title"],ku=["disabled"],Eu=["title","onClick"],Ru={class:"tab-list-menu__name"},Mu=["title","disabled","onClick"],Su=["disabled"],Nu=8,Ma=450,Fl=8,Bu=Ot(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),d=t.ref({left:0,bottom:0}),c=t.ref(null),C=t.computed(()=>Math.min(Nu,n.sheets.length)),h=t.computed(()=>n.sheets.slice(r.value,r.value+C.value)),S=t.computed(()=>r.value>0),m=t.computed(()=>r.value+C.value<n.sheets.length),M=t.computed(()=>n.sheets.length>C.value),E=t.computed(()=>n.sheets.length>1);t.watch(()=>n.sheets.length,()=>{if(!i.value)return;const K=Math.max(0,n.sheets.length-C.value);r.value>K&&(r.value=K)});function B(K){r.value=Math.max(0,Math.min(n.sheets.length-C.value,r.value+K))}function G(){if(i.value){i.value=!1;return}const K=a.value;if(!K)return;const $=K.getBoundingClientRect(),V=Nn(n.boundaryEl);d.value={left:Math.max(V.left,$.left),bottom:window.innerHeight-$.top+4};const x=n.activeSheetIndex;r.value=x>=0?Math.max(0,Math.min(x-Math.floor(C.value/2),n.sheets.length-C.value)):0,i.value=!0}function te(K){o("tab-click",K),i.value=!1}function ge(K){E.value&&o("delete-sheet",K)}function fe(K){var x;if(!i.value)return;const $=K.target;if((x=a.value)!=null&&x.contains($))return;const V=document.querySelector(".tab-list-menu");V!=null&&V.contains($)||(i.value=!1)}function Ie(K){i.value&&K.key==="Escape"&&(i.value=!1)}function me(K){i.value&&(K.preventDefault(),B(K.deltaY>0?1:-1))}function Ee(){i.value=!1}function Ae(K){!i.value||K.target===c.value||Ee()}const ce=t.ref(0),ae=t.ref(!1);function qe(K){i.value&&(ce.value=K.touches[0].clientY,ae.value=!0)}function ut(K){if(!i.value||!ae.value)return;const $=K.touches[0].clientY-ce.value;Math.abs($)>5&&(B($<0?1:-1),ce.value=K.touches[0].clientY)}function J(){ae.value=!1}let O=null,L=-1,le=0,$e=0,et=!1,oe=null,xe=0,se=0;function de(K,$,V){return{clientX:K,clientY:$,target:V,preventDefault(){},stopPropagation(){}}}function we(K,$){const V=K.touches[0];if(!V)return;le=V.clientX,$e=V.clientY,L=$,O!==null&&clearTimeout(O);const x=K.target;O=window.setTimeout(()=>{et=!0;const H=de(le,$e,x);o("tab-contextmenu",{ev:H,i:L})},Ma)}function Re(K){const $=K.touches[0];!$||O===null||(Math.abs($.clientX-le)>Fl||Math.abs($.clientY-$e)>Fl)&&(clearTimeout(O),O=null)}function Ke(){O!==null&&(clearTimeout(O),O=null)}function We(K){if(et){et=!1;return}o("tab-click",K)}function rt(K){const $=K.touches[0];if(!$)return;const V=K.target;if(V.closest(".tab-item")||V.closest(".tab-bar__add-btn")||V.closest(".tab-bar__list-btn"))return;xe=$.clientX,se=$.clientY,oe!==null&&clearTimeout(oe);const x=V;oe=window.setTimeout(()=>{const H=de(xe,se,x);o("tabbar-contextmenu",H)},Ma)}function je(K){const $=K.touches[0];!$||oe===null||(Math.abs($.clientX-xe)>Fl||Math.abs($.clientY-se)>Fl)&&(clearTimeout(oe),oe=null)}function A(){oe!==null&&(clearTimeout(oe),oe=null)}return t.watch(i,K=>{t.nextTick(()=>{var $,V;K?($=c.value)==null||$.addEventListener("wheel",me,{passive:!1}):(V=c.value)==null||V.removeEventListener("wheel",me)})}),t.onMounted(()=>{document.addEventListener("pointerdown",fe),document.addEventListener("keydown",Ie),window.addEventListener("resize",Ee),window.addEventListener("scroll",Ae,!0)}),t.onBeforeUnmount(()=>{O!==null&&clearTimeout(O),oe!==null&&clearTimeout(oe),document.removeEventListener("pointerdown",fe),document.removeEventListener("keydown",Ie),window.removeEventListener("resize",Ee),window.removeEventListener("scroll",Ae,!0)}),(K,$)=>(t.openBlock(),t.createElementBlock("div",{class:"tab-bar",onContextmenu:$[8]||($[8]=V=>o("tabbar-contextmenu",V)),onTouchstart:rt,onTouchmove:je,onTouchend:A,onTouchcancel:A},[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:G},[...$[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,gu),t.createElementVNode("div",bu,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.sheets,(V,x)=>(t.openBlock(),t.createElementBlock("div",{key:V.id,class:t.normalizeClass(["tab-item",{"tab-item--active":x===e.activeSheetIndex}]),onClick:H=>We(x),onDblclick:t.withModifiers(H=>o("tab-dblclick",x),["prevent"]),onContextmenu:H=>o("tab-contextmenu",{ev:H,i:x}),onTouchstart:H=>we(H,x),onTouchmove:Re,onTouchend:Ke,onTouchcancel:Ke},[e.renTab===x?(t.openBlock(),t.createElementBlock("input",{key:0,class:"tab-rename-input",value:e.renTabVal,onInput:$[0]||($[0]=H=>o("tab-rename-input",H.target.value)),onKeydown:$[1]||($[1]=H=>o("tab-rename-keydown",H)),onBlur:$[2]||($[2]=H=>o("tab-rename-commit")),onClick:$[3]||($[3]=t.withModifiers(()=>{},["stop"]))},null,40,Cu)):(t.openBlock(),t.createElementBlock("span",wu,t.toDisplayString(V.name),1))],42,yu))),128))]),t.createElementVNode("button",{class:"tab-bar__add-btn",title:t.unref(g)(e.locale,"addSheet"),onClick:$[4]||($[4]=V=>o("add-sheet"))}," + ",8,vu),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[i.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"tab-list-menu",style:t.normalizeStyle({left:d.value.left+"px",bottom:d.value.bottom+"px"}),onMousedown:$[7]||($[7]=t.withModifiers(()=>{},["prevent"]))},[M.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["tab-list-menu__nav",{"tab-list-menu__nav--disabled":!S.value}]),disabled:!S.value,onClick:$[5]||($[5]=V=>B(-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,ku)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:c,class:"tab-list-menu__list",onTouchstart:qe,onTouchmove:ut,onTouchend:J},[(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:x=>te(e.sheets.indexOf(V))},[t.createElementVNode("span",Ru,t.toDisplayString(V.name),1),t.createElementVNode("button",{type:"button",class:"tab-list-menu__del",title:t.unref(g)(e.locale,"delete"),disabled:!E.value,onClick:t.withModifiers(x=>ge(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,Mu)],10,Eu))),128))],544),M.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["tab-list-menu__nav",{"tab-list-menu__nav--disabled":!m.value}]),disabled:!m.value,onClick:$[6]||($[6]=V=>B(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,Su)):t.createCommentVNode("",!0)],36)):t.createCommentVNode("",!0)]),_:1})]))],32))}}),[["__scopeId","data-v-65476c97"]]),xu={class:"find-bar__row find-bar__row--inputs"},Tu=["placeholder","value"],Vu=["placeholder","value"],Du=["title","disabled"],Fu=["title","disabled"],Ou=["title"],Iu={class:"find-bar__row find-bar__row--controls"},Au=["title"],Lu={class:"find-bar__count"},$u=["disabled"],zu=["disabled"],_u={class:"find-bar__chk find-bar__chk--panel"},Hu=["checked"],Wu={class:"find-bar__chk find-bar__chk--panel"},Uu=["checked"],Pu=Ot(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),d=t.ref({top:0,left:0}),c=t.computed(()=>n.total>0?`${n.currentIndex+1}/${n.total}`:n.message||""),C=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 M;return(M=a.value)==null?void 0:M.focus()})});function h(M){M.key==="Enter"?(M.preventDefault(),M.shiftKey?o("prev"):o("next")):M.key==="Escape"&&(M.preventDefault(),o("close"))}function S(){if(i.value){if(!r.value){const M=i.value.getBoundingClientRect();d.value={top:M.bottom+2,left:M.left}}r.value=!r.value}}function m(M){if(!r.value)return;const E=M.target;E.closest(".find-bar__settings-btn")||E.closest(".find-bar__settings-panel")||(r.value=!1)}return t.watch(r,M=>{M?document.addEventListener("pointerdown",m,!0):document.removeEventListener("pointerdown",m,!0)}),t.watch(()=>n.open,M=>{M||(r.value=!1)}),t.onBeforeUnmount(()=>document.removeEventListener("pointerdown",m,!0)),(M,E)=>(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",xu,[t.createElementVNode("input",{ref_key:"findInputRef",ref:a,class:"find-bar__input",placeholder:t.unref(g)(e.locale,"findPlaceholder"),value:e.findText,onInput:E[0]||(E[0]=B=>o("update:findText",B.target.value)),onKeydown:h},null,40,Tu),t.createElementVNode("input",{class:"find-bar__input",placeholder:t.unref(g)(e.locale,"replacePlaceholder"),value:e.replaceText,onInput:E[1]||(E[1]=B=>o("update:replaceText",B.target.value)),onKeydown:h},null,40,Vu),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--icon",title:t.unref(g)(e.locale,"findPrev"),disabled:e.total===0,onClick:E[2]||(E[2]=B=>o("prev"))},[...E[12]||(E[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,Du),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--icon",title:t.unref(g)(e.locale,"findNext"),disabled:e.total===0,onClick:E[3]||(E[3]=B=>o("next"))},[...E[13]||(E[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,Fu),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--close",title:t.unref(g)(e.locale,"findClose"),onClick:E[4]||(E[4]=B=>o("close"))},[...E[14]||(E[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,Ou)]),t.createElementVNode("div",Iu,[t.createVNode(Ut,{class:"find-bar__dropdown","model-value":e.scope,options:C.value,title:t.unref(g)(e.locale,"findScope"),"onUpdate:modelValue":E[5]||(E[5]=B=>M.$emit("update:scope",B))},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(S,["stop"])},[...E[15]||(E[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,Au),t.createElementVNode("span",Lu,t.toDisplayString(c.value),1),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--text",disabled:e.total===0,onClick:E[6]||(E[6]=B=>o("replace"))},t.toDisplayString(t.unref(g)(e.locale,"replace")),9,$u),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--text",disabled:e.total===0,onClick:E[7]||(E[7]=B=>o("replace-all"))},t.toDisplayString(t.unref(g)(e.locale,"replaceAll")),9,zu)])],4)):t.createCommentVNode("",!0),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"find-pop"},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"find-bar__settings-panel",style:t.normalizeStyle({top:d.value.top+"px",left:d.value.left+"px"}),onClick:E[10]||(E[10]=t.withModifiers(()=>{},["stop"])),onMousedown:E[11]||(E[11]=t.withModifiers(()=>{},["prevent"]))},[t.createElementVNode("label",_u,[t.createElementVNode("input",{class:"find-bar__chk-input",type:"checkbox",checked:e.matchCase,onChange:E[8]||(E[8]=B=>o("update:matchCase",B.target.checked))},null,40,Hu),E[16]||(E[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",Wu,[t.createElementVNode("input",{class:"find-bar__chk-input",type:"checkbox",checked:e.matchEntireCell,onChange:E[9]||(E[9]=B=>o("update:matchEntireCell",B.target.checked))},null,40,Uu),E[17]||(E[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"]]),Ku={class:"nf-dialog__header"},Gu={class:"nf-dialog__title"},qu={class:"nf-dialog__body"},Yu={class:"nf-field"},ju={class:"nf-field__label"},Xu={key:0,class:"nf-field"},Zu={class:"nf-field__label"},Ju={key:1,class:"nf-field nf-field--inline"},Qu={class:"nf-checkbox"},ef={key:2,class:"nf-field"},tf={class:"nf-field__label"},nf={key:3,class:"nf-field"},of={class:"nf-field__label"},lf={key:4,class:"nf-field"},rf={class:"nf-field__label"},af={key:5,class:"nf-field"},sf={class:"nf-field__label"},cf={key:6,class:"nf-field"},df={class:"nf-field__label"},uf={class:"nf-field"},ff={class:"nf-field__label"},mf={class:"nf-dialog__footer"},pf={class:"nf-preview"},hf={class:"nf-preview__label"},gf={class:"nf-preview__value"},bf={class:"nf-dialog__actions"},yf=Ot(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),d=t.ref(!1),c=t.ref("$"),C=t.ref("m/d/yyyy"),h=t.ref("h:mm:ss"),S=t.ref("m/d/yyyy h:mm:ss"),m=t.ref("[h]:mm:ss"),M=t.ref(""),E=t.ref(null),B=[{label:"¥",value:"¥"},{label:"$",value:"$"},{label:"€",value:"€"},{label:"£",value:"£"}],G=['yyyy"年"m"月"d"日"',"yyyy-mm-dd","yyyy/m/d",'m"月"d"日"'],te=["m/d/yyyy","mm/dd/yyyy","d-mmm-yyyy","mmmm d, yyyy"],ge=['yyyy"年"m"月"d"日" h:mm:ss','yyyy"年"m"月"d"日" hh:mm',"yyyy-mm-dd hh:mm:ss","yyyy/m/d h:mm"],fe=["m/d/yyyy h:mm:ss","m/d/yyyy hh:mm","mm/dd/yyyy h:mm AM/PM","d-mmm-yyyy hh:mm:ss"],Ie=t.computed(()=>n.locale==="zh-CN"?[...G,...te]:[...te,...G]),me=["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"?[...ge,...fe]:[...fe,...ge]),Ae=["[h]:mm:ss","[h]:mm","mm:ss",'[h]"小时"mm"分"ss"秒"',"[h]:mm:ss.00",'d"天"h:mm:ss'],ce={general:"nfGeneral",text:"nfText",number:"nfNumber",percent:"nfPercent",scientific:"nfScientific",accounting:"nfAccounting",financial:"nfFinancial",currency:"nfCurrency",currencyRounded:"nfCurrencyRounded",date:"nfDate",time:"nfTime",dateTime:"nfDateTime",duration:"nfDuration",custom:"nfCatCustom"},ae=t.computed(()=>as.map(Y=>({label:g(n.locale,ce[Y]),value:Y}))),qe=B.map(Y=>({label:Y.label,value:Y.value})),ut=t.computed(()=>Ie.value.map(Y=>({label:Y,value:Y}))),J=me.map(Y=>({label:Y,value:Y})),O=t.computed(()=>Ee.value.map(Y=>({label:Y,value:Y}))),L=Ae.map(Y=>({label:Y,value:Y})),le=t.computed(()=>["number","currency","currencyRounded","accounting","financial"].includes(i.value)),$e=t.computed(()=>["currency","currencyRounded","accounting"].includes(i.value)),et=t.computed(()=>i.value==="date"),oe=t.computed(()=>i.value==="time"),xe=t.computed(()=>i.value==="dateTime"),se=t.computed(()=>i.value==="duration"),de=t.computed(()=>["number","currency","accounting","financial","percent","scientific"].includes(i.value));function we(){if(i.value==="general")return so;if(i.value==="text")return Bn;if(i.value==="custom")return M.value;if(i.value==="date")return C.value;if(i.value==="time")return h.value;if(i.value==="dateTime")return S.value;if(i.value==="duration")return m.value;const Y=Math.max(0,Math.min(30,r.value));return i.value==="currency"||i.value==="currencyRounded"||i.value==="accounting"?Re(i.value,Y,d.value,c.value):ms(n.locale,i.value,Y,d.value)}function Re(Y,ve,ze,it){const Fe=ze?"#,##0":"0";if(Y==="currencyRounded")return it+Fe;const v=ve>0?"."+"0".repeat(ve):"",Z=Fe+v;return Y==="currency"?it+Z:`${it}${Z};(${it}${Z});${it}"-"`}function Ke(Y){if(M.value=Y,xn(Y)){i.value="general";return}if(Y==="@"){i.value="text";return}const ve=Y.replace(/\[[^\]]*\]/gi,v=>/\[h\]/i.test(v)?v:"");if(/\[h\]/i.test(ve)&&!/[yd]/i.test(ve)){i.value="duration",Ae.includes(Y)&&(m.value=Y);return}const ze=/[yd]/i.test(ve),it=/h|s|AM\/PM/i.test(ve);if(ze&&it){i.value="dateTime",Ee.value.includes(Y)&&(S.value=Y);return}if(ze||/AM\/PM/i.test(ve)){it&&!ze?(i.value="time",me.includes(Y)&&(h.value=Y)):(i.value="date",Ie.value.includes(Y)&&(C.value=Y));return}if(Y.includes("%")){i.value="percent",r.value=We(Y);return}if(/E[+-]/i.test(Y)){i.value="scientific",r.value=We(Y);return}const Fe=B.find(v=>Y.startsWith(v.value));if(Y.includes("[Red](")){i.value="financial",d.value=Y.includes(","),r.value=We(Y);return}if(Fe){Y.includes("(")?(i.value="accounting",c.value=Fe.value,d.value=Y.includes(","),r.value=We(Y)):/\.\d/.test(Y.slice(Fe.value.length))?(i.value="currency",c.value=Fe.value,d.value=Y.includes(","),r.value=We(Y)):(i.value="currencyRounded",c.value=Fe.value,d.value=Y.includes(","));return}i.value="number",d.value=Y.includes(","),r.value=We(Y)}function We(Y){const ve=Y.match(/\.([0#?]+)/);return ve?ve[1].length:0}function rt(){i.value!=="custom"&&(M.value=we())}function je(){}function A(){C.value=Ie.value[0],h.value=me[0],S.value=Ee.value[0],m.value=Ae[0]}function K(){a.value=!0,n.modelOpen!==void 0&&o("update:modelOpen",!0),A(),Ke(n.currentFormat??""),n.isCustom&&(i.value="custom"),t.nextTick(()=>{var Y;return(Y=E.value)==null?void 0:Y.focus()})}function $(){a.value=!1,n.modelOpen!==void 0&&o("update:modelOpen",!1)}function V(){o("apply",M.value),$()}function x(){$()}function H(Y){Y.key==="Escape"&&$()}t.watch(()=>n.modelOpen,Y=>{Y&&!a.value?K():!Y&&a.value&&$()});const z=t.computed(()=>In(n.sampleValue,M.value,n.locale));return(Y,ve)=>(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:x,onKeydown:H},[t.createElementVNode("div",{class:t.normalizeClass(["nf-dialog",{"nf-dialog--zh":e.locale==="zh-CN"}]),onMousedown:ve[9]||(ve[9]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",Ku,[t.createElementVNode("span",Gu,t.toDisplayString(t.unref(g)(e.locale,"nfDialogTitle")),1),t.createElementVNode("button",{class:"nf-dialog__close",type:"button",onClick:$},[...ve[10]||(ve[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",qu,[t.createElementVNode("div",Yu,[t.createElementVNode("label",ju,t.toDisplayString(t.unref(g)(e.locale,"nfCategory")),1),t.createVNode(Ut,{class:"nf-field__dropdown","model-value":i.value,options:ae.value,"onUpdate:modelValue":ve[0]||(ve[0]=ze=>i.value=ze),onChange:rt},null,8,["model-value","options"])]),de.value?(t.openBlock(),t.createElementBlock("div",Xu,[t.createElementVNode("label",Zu,t.toDisplayString(t.unref(g)(e.locale,"nfDecimals")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":ve[1]||(ve[1]=ze=>r.value=ze),class:"nf-field__input",type:"number",min:"0",max:"30",onInput:rt},null,544),[[t.vModelText,r.value,void 0,{number:!0}]])])):t.createCommentVNode("",!0),le.value?(t.openBlock(),t.createElementBlock("div",Ju,[t.createElementVNode("label",Qu,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":ve[2]||(ve[2]=ze=>d.value=ze),type:"checkbox",onChange:rt},null,544),[[t.vModelCheckbox,d.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(g)(e.locale,"nfThousands")),1)])])):t.createCommentVNode("",!0),$e.value?(t.openBlock(),t.createElementBlock("div",ef,[t.createElementVNode("label",tf,t.toDisplayString(t.unref(g)(e.locale,"nfSymbol")),1),t.createVNode(Ut,{class:"nf-field__dropdown","model-value":c.value,options:t.unref(qe),"onUpdate:modelValue":ve[3]||(ve[3]=ze=>c.value=ze),onChange:rt},null,8,["model-value","options"])])):t.createCommentVNode("",!0),et.value?(t.openBlock(),t.createElementBlock("div",nf,[t.createElementVNode("label",of,t.toDisplayString(t.unref(g)(e.locale,"nfDateFormat")),1),t.createVNode(Ut,{class:"nf-field__dropdown","model-value":C.value,options:ut.value,"onUpdate:modelValue":ve[4]||(ve[4]=ze=>C.value=ze),onChange:rt},null,8,["model-value","options"])])):t.createCommentVNode("",!0),oe.value?(t.openBlock(),t.createElementBlock("div",lf,[t.createElementVNode("label",rf,t.toDisplayString(t.unref(g)(e.locale,"nfTimeFormat")),1),t.createVNode(Ut,{class:"nf-field__dropdown","model-value":h.value,options:t.unref(J),"onUpdate:modelValue":ve[5]||(ve[5]=ze=>h.value=ze),onChange:rt},null,8,["model-value","options"])])):t.createCommentVNode("",!0),xe.value?(t.openBlock(),t.createElementBlock("div",af,[t.createElementVNode("label",sf,t.toDisplayString(t.unref(g)(e.locale,"nfDateTime")),1),t.createVNode(Ut,{class:"nf-field__dropdown","model-value":S.value,options:O.value,"onUpdate:modelValue":ve[6]||(ve[6]=ze=>S.value=ze),onChange:rt},null,8,["model-value","options"])])):t.createCommentVNode("",!0),se.value?(t.openBlock(),t.createElementBlock("div",cf,[t.createElementVNode("label",df,t.toDisplayString(t.unref(g)(e.locale,"nfDuration")),1),t.createVNode(Ut,{class:"nf-field__dropdown","model-value":m.value,options:t.unref(L),"onUpdate:modelValue":ve[7]||(ve[7]=ze=>m.value=ze),onChange:rt},null,8,["model-value","options"])])):t.createCommentVNode("",!0),t.createElementVNode("div",uf,[t.createElementVNode("label",ff,t.toDisplayString(t.unref(g)(e.locale,"nfCustomCode")),1),t.withDirectives(t.createElementVNode("textarea",{ref_key:"customCodeRef",ref:E,"onUpdate:modelValue":ve[8]||(ve[8]=ze=>M.value=ze),class:"nf-field__textarea",rows:"2",spellcheck:"false",onInput:je},null,544),[[t.vModelText,M.value]])])]),t.createElementVNode("div",mf,[t.createElementVNode("div",pf,[t.createElementVNode("span",hf,t.toDisplayString(t.unref(g)(e.locale,"nfPreview")),1),t.createElementVNode("span",gf,t.toDisplayString(z.value||"-"),1)]),t.createElementVNode("div",bf,[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"]]),Cf={class:"sort-confirm__header"},wf={class:"sort-confirm__title"},vf={class:"sort-confirm__body"},kf={class:"sort-confirm__message"},Ef={class:"sort-confirm__options"},Rf={class:"sort-confirm__option"},Mf={class:"sort-confirm__option"},Sf={class:"sort-confirm__footer"},Nf=Ot(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,M=>{M&&!a.value?d():!M&&a.value&&c()});function d(){i.value=!0,a.value=!0,n.modelOpen!==void 0&&o("update:modelOpen",!0),t.nextTick(()=>{var E;const M=(E=r.value)==null?void 0:E.querySelector(".sort-confirm__btn--primary");M==null||M.focus()})}function c(){a.value=!1,n.modelOpen!==void 0&&o("update:modelOpen",!1)}function C(){m()}function h(M){M.key==="Escape"&&m()}function S(){o("confirm",i.value),c()}function m(){o("cancel"),c()}return(M,E)=>(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:C,onKeydown:h},[t.createElementVNode("div",{ref_key:"dialogRef",ref:r,class:"sort-confirm",onMousedown:E[2]||(E[2]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",Cf,[t.createElementVNode("span",wf,t.toDisplayString(t.unref(g)(e.locale,"sortReminderTitle")),1),t.createElementVNode("button",{class:"sort-confirm__close",type:"button",onClick:m},[...E[3]||(E[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",vf,[t.createElementVNode("p",kf,t.toDisplayString(t.unref(g)(e.locale,"sortReminderMessage")),1),t.createElementVNode("div",Ef,[t.createElementVNode("label",Rf,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":E[0]||(E[0]=B=>i.value=B),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",Mf,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":E[1]||(E[1]=B=>i.value=B),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",Sf,[t.createElementVNode("button",{class:"sort-confirm__btn sort-confirm__btn--primary",type:"button",onClick:S},t.toDisplayString(t.unref(g)(e.locale,"sort")),1),t.createElementVNode("button",{class:"sort-confirm__btn",type:"button",onClick:m},t.toDisplayString(t.unref(g)(e.locale,"cancel")),1)])],544)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-c73bc474"]]),Sa=[{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)"}],Bf={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 xf(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 Tf(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=Bf[o];if(!a)return{ok:!1,name:o};const i=n[2];if(!xf(i))return{ok:!1,name:o};const r=uo(i),d=r.length===1&&r[0].trim()===""?0:r.length;return d<a.min||d>a.max?{ok:!1,name:o}:r.some(c=>c.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=Cn(o[0],l,n),i=Cn(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 Na(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 Zn(e,l,n,o,a){const i=n[Po(e,l)];if(!i)return"";const r=i.value;return r.startsWith("=")?xa(Po(e,l),n,o,a):Na(r)}function Ba(e,l,n,o,a){const i=Zn(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 dl=new Map,Ol=new Set;function Mo(){dl.clear(),Ol.clear()}function xa(e,l,n,o){return Vf(e,l,n,o,0)}function Vf(e,l,n,o,a){if(Ol.has(e))return null;if(dl.has(e))return dl.get(e);Ol.add(e);const i=l[e];let r;if(!i)r=null;else{const d=i.value;if(!d.startsWith("="))r=Na(d);else{const c=d.slice(1).trim(),C=/^([A-Za-z_][A-Za-z0-9_]*)\s*\(([\s\S]*)\)$/.exec(c);r=C?Fa(C[1].toUpperCase(),C[2],l,n,o,a+1):Gt(c,l,n,o,a+1)}}return Ol.delete(e),dl.set(e,r),r}function qo(e){return e===null||e===""?!1:typeof e=="number"?e!==0:!0}function Ta(e,l){return typeof e=="number"&&typeof l=="number"?e===l:String(e??"")===String(l??"")}function kr(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 Va(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 Df(e,l,n,o,a,i){let d=l.trim();d.length>=2&&(d[0]==='"'&&d[d.length-1]==='"'||d[0]==="'"&&d[d.length-1]==="'")&&(d=d.slice(1,-1));const c=/^([<>=]+)([\s\S]*)$/.exec(d);if(c){const h=c[1],S=Va(c[2]);return kr(e,S,h)}const C=Va(d);return Ta(e,C)}function Da(e,l,n,o,a){const i=e.trim(),r=["<=",">=","<>"];let d=null,c=-1,C=null,h=0;for(let m=0;m<i.length;m++){const M=i[m];if(C){M===C&&(i[m+1]===C?m++:C=null);continue}if(M==='"'||M==="'"){C=M;continue}if(M==="("&&h++,M===")"&&h--,h===0&&(M==="<"||M===">"||M==="=")){const E=i.slice(m,m+2);d=r.includes(E)?E:M,c=m;break}}if(d&&c>=0){const m=i.slice(0,c).trim(),M=i.slice(c+d.length).trim(),E=Gt(m,l,n,o,a),B=Gt(M,l,n,o,a);return kr(E,B,d)}const S=Gt(i,l,n,o,a);return qo(S)}function uo(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 Gt(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 d=Ff(i);if(d.length===0)return null;let c=0;const C=()=>{const E=h(),B=d[c];if(!(B&&B.type==="cmp"))return E;c++;const G=h();return E===null||G===null?null:kr(E,G,B.val)?1:0},h=()=>{let E=S();for(;c<d.length;){const B=d[c];if(B.type==="op"&&(B.val==="+"||B.val==="-"))c++,E=Er(E,S(),B.val);else break}return E},S=()=>{let E=m();for(;c<d.length;){const B=d[c];if(B.type==="op"&&(B.val==="*"||B.val==="/"))c++,E=Er(E,m(),B.val);else break}return E},m=()=>{const E=d[c];return E&&E.type==="op"&&E.val==="-"?(c++,Er(0,m(),"-")):E&&E.type==="op"&&E.val==="+"?(c++,m()):M()},M=()=>{const E=d[c];if(!E)return null;if(E.type==="num")return c++,Number(E.val);if(E.type==="str")return c++,E.val;if(E.type==="lp"){c++;const B=C();return d[c]&&d[c].type==="rp"&&c++,B}if(E.type==="ref"){c++;const B=Cn(E.val,n,o);return B?Zn(B.col,B.row,l,n,o):null}if(E.type==="func"){const B=E.val.toUpperCase();if(c++,d[c]&&d[c].type==="lp"){const G=d[c];let te=0,ge=null,fe=c;for(;fe<d.length;fe++)if(d[fe].type==="lp")te++;else if(d[fe].type==="rp"&&(te--,te===0)){ge=d[fe];break}if(ge){const Ie=i.slice(G.start+1,ge.start);return c=fe+1,Fa(B,Ie,l,n,o,a+1)}}return null}return c++,null};return C()}function Ff(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 Er(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 Fa(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 c=0;for(let C=r.sc;C<=r.ec;C++)for(let h=r.sr;h<=r.er;h++)typeof Zn(C,h,n,o,a)=="number"&&c++;return c}let d=0;for(let c=r.sc;c<=r.ec;c++)for(let C=r.sr;C<=r.er;C++)d+=Ba(c,C,n,o,a);if(isNaN(d))return null;if(e==="AVERAGE"){const c=(r.ec-r.sc+1)*(r.er-r.sr+1);return c===0?null:d/c}return d}case"AND":case"OR":{const r=uo(l);if(r.length===0)return null;const d=e==="AND";for(const c of r){const C=Gt(c,n,o,a,i);if(C===null)return null;if(e==="AND"){if(!qo(C))return 0}else if(qo(C))return 1}return d?1:0}case"NOT":{const r=uo(l);if(r.length!==1)return null;const d=Gt(r[0],n,o,a,i);return d===null?null:qo(d)?0:1}case"IF":{const r=uo(l);if(r.length<3)return null;const d=Da(r[0],n,o,a,i);return Gt(d?r[1]:r[2],n,o,a,i)}case"VLOOKUP":{const r=uo(l);if(r.length<3)return null;const d=Gt(r[0],n,o,a,i),c=Go(r[1].trim(),o,a);if(!c)return null;const C=Gt(r[2],n,o,a,i),h=typeof C=="number"?C:parseFloat(String(C));if(isNaN(h))return null;const S=c.sc+(h-1);if(S<c.sc||S>c.ec)return null;if(r.length>=4?qo(Gt(r[3],n,o,a,i)):!1){let M=-1,E=-1/0;for(let B=c.sr;B<=c.er;B++){const G=Zn(c.sc,B,n,o,a);typeof G=="number"&&typeof d=="number"&&G<=d&&G>E&&(E=G,M=B)}return M>=0?Zn(S,M,n,o,a):null}for(let M=c.sr;M<=c.er;M++){const E=Zn(c.sc,M,n,o,a);if(Ta(E,d))return Zn(S,M,n,o,a)}return null}case"CONCATENATE":{const r=uo(l);let d="";for(const c of r){const C=Gt(c,n,o,a,i);d+=C===null?"":typeof C=="number"?String(C):C}return d}case"MAX":case"MIN":{const r=Go(l.trim(),o,a);if(!r)return null;const d=[];for(let c=r.sc;c<=r.ec;c++)for(let C=r.sr;C<=r.er;C++){const h=Zn(c,C,n,o,a);typeof h=="number"&&d.push(h)}return d.length===0?null:e==="MAX"?Math.max(...d):Math.min(...d)}case"STDEV":{const r=Go(l.trim(),o,a);if(!r)return null;const d=[];for(let S=r.sc;S<=r.ec;S++)for(let m=r.sr;m<=r.er;m++){const M=Zn(S,m,n,o,a);typeof M=="number"&&d.push(M)}const c=d.length;if(c<2)return null;const C=d.reduce((S,m)=>S+m,0)/c,h=d.reduce((S,m)=>S+Math.pow(m-C,2),0)/(c-1);return Math.sqrt(h)}case"SIN":{const r=uo(l);if(r.length!==1)return null;const d=Gt(r[0],n,o,a,i);return typeof d!="number"?null:Math.sin(d)}case"SUMIF":{const r=uo(l);if(r.length<2||r.length>3)return null;const d=Go(r[0].trim(),o,a);if(!d)return null;const c=r.length===3?Go(r[2].trim(),o,a):d;if(!c)return null;let C=0;for(let h=d.sr;h<=d.er;h++)for(let S=d.sc;S<=d.ec;S++){const m=Zn(S,h,n,o,a);Df(m,r[1])&&(C+=Ba(c.sc+(S-d.sc),c.sr+(h-d.sr),n,o,a))}return C}case"PMT":{const r=uo(l);if(r.length<3||r.length>5)return null;const d=Gt(r[0],n,o,a,i),c=Gt(r[1],n,o,a,i),C=Gt(r[2],n,o,a,i);if(typeof d!="number"||typeof c!="number"||typeof C!="number")return null;const h=r.length>=4?Gt(r[3],n,o,a,i):0,S=typeof h=="number"?h:0,m=r.length>=5?Gt(r[4],n,o,a,i):0,M=qo(m)?1:0;if(d===0)return c===0?null:-(C+S)/c;const E=Math.pow(1+d,c);return-(S+C*E)*d/((1+d*M)*(E-1))}default:return null}}function Il(e,l,n){const o=[],a=/(\$?[A-Z]+\$?\d+)(?::(\$?[A-Z]+\$?\d+))?/gi;let i;for(;(i=a.exec(e))!==null;){const r=Cn(i[1],l,n);if(r)if(i[2]){const d=Cn(i[2],l,n);if(!d)continue;for(let c=Math.min(r.col,d.col);c<=Math.max(r.col,d.col);c++)for(let C=Math.min(r.row,d.row);C<=Math.max(r.row,d.row);C++)o.push(Po(c,C))}else o.push(Po(r.col,r.row))}return o}function Oa(e,l,n,o,a){const i=n[Po(e,l)];if(!i)return"";const r=i.value;if(!r.startsWith("="))return r;const d=xa(Po(e,l),n,o,a);return d===null?"#ERROR":String(d)}function Ia(e,l,n,o){return Gt(e,l,n,o,0)}function Aa(e,l,n,o){const a=e.trim().replace(/^=/,"");return a?Da(a,l,n,o,0):!1}function Al(e,l,n,o,a,i){return l===0&&n===0?e:e.replace(/(\$?)([A-Z]+)(\$?)(\d+)/gi,(r,d,c,C,h)=>{const S=d?fr(c):fr(c)+l,m=C?parseInt(h,10)-1:parseInt(h,10)-1+n;let M;S<0?M="A":S>=o?M=i(o-1):M=i(S);let E;return m<0?E="1":m>=a?E=String(a):E=String(m+1),(d||"")+M+(C||"")+E})}class Of{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(),dl.clear();for(const[a,i]of Object.entries(l))if(i.value.startsWith("=")){const r=Il(i.value.slice(1),n,o);this.set(a,r)}}}const If={class:"ifn-dialog__header"},Af={class:"ifn-dialog__title"},Lf={class:"ifn-dialog__body"},$f={class:"ifn-dialog__field"},zf={class:"ifn-dialog__label"},_f={key:0,class:"ifn-dialog__desc"},Hf={class:"ifn-dialog__field"},Wf={class:"ifn-dialog__label"},Uf={class:"ifn-dialog__footer"},Pf=["disabled"],Kf=Ot(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(""),d=t.ref(null),c=t.ref(null),C={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(()=>Sa.map(me=>({label:me.name,value:me.name}))),S=t.computed(()=>{const me=String(i.value??"");return me?g(n.locale,C[me]??""):""}),m=t.computed(()=>Tf(r.value)),M=t.computed(()=>i.value===""||i.value===null||!r.value.trim()||!m.value.ok?!1:m.value.name===String(i.value).toUpperCase());t.watch(()=>n.modelOpen,me=>{me&&!a.value?E():!me&&a.value&&B()});function E(){r.value="",i.value="",a.value=!0,n.modelOpen!==void 0&&o("update:modelOpen",!0),t.nextTick(()=>{const me=d.value;if(me)try{me.focus({preventScroll:!0}),me.setSelectionRange(me.value.length,me.value.length)}catch{}})}function B(){a.value=!1,n.modelOpen!==void 0&&o("update:modelOpen",!1)}function G(me){i.value=me;const Ee=Sa.find(Ae=>Ae.name===String(me));Ee&&(r.value="",te(Ee.snippet))}function te(me){const Ee=r.value,Ae=d.value,ce=Ae?Ae.selectionStart??Ee.length:Ee.length,ae=Ae?Ae.selectionEnd??Ee.length:Ee.length,qe=Ee.trim()?me:"="+me;r.value=Ee.slice(0,ce)+qe+Ee.slice(ae),t.nextTick(()=>{const ut=d.value;if(!ut)return;const J=ce+qe.length;try{ut.focus({preventScroll:!0}),ut.setSelectionRange(J,J)}catch{}})}function ge(){o("insert",r.value),B()}function fe(){o("cancel"),B()}function Ie(me){me.key==="Escape"&&(me.stopPropagation(),fe())}return(me,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(fe,["self"]),onKeydown:Ie},[t.createElementVNode("div",{ref_key:"dialogRef",ref:c,class:"ifn-dialog",onMousedown:Ee[1]||(Ee[1]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",If,[t.createElementVNode("span",Af,t.toDisplayString(t.unref(g)(e.locale,"insertFunctionTitle")),1),t.createElementVNode("button",{class:"ifn-dialog__close",type:"button",onClick:fe},[...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",Lf,[t.createElementVNode("div",$f,[t.createElementVNode("label",zf,t.toDisplayString(t.unref(g)(e.locale,"insertFunctionSelectLabel")),1),t.createVNode(Ut,{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":G},null,8,["locale","model-value","options","search-placeholder","fallback-label","title"]),S.value?(t.openBlock(),t.createElementBlock("div",_f,t.toDisplayString(S.value),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",Hf,[t.createElementVNode("label",Wf,t.toDisplayString(t.unref(g)(e.locale,"insertFunctionFormulaLabel")),1),t.withDirectives(t.createElementVNode("textarea",{ref_key:"textareaRef",ref:d,"onUpdate:modelValue":Ee[0]||(Ee[0]=Ae=>r.value=Ae),class:"ifn-dialog__textarea",spellcheck:"false"},null,512),[[t.vModelText,r.value]])])]),t.createElementVNode("div",Uf,[t.createElementVNode("button",{class:"ifn-dialog__btn ifn-dialog__btn--primary",type:"button",disabled:!M.value,onClick:ge},t.toDisplayString(t.unref(g)(e.locale,"insertFunctionBtn")),9,Pf),t.createElementVNode("button",{class:"ifn-dialog__btn",type:"button",onClick:fe},t.toDisplayString(t.unref(g)(e.locale,"cancel")),1)])],544)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-49675eeb"]]),ul="__filter_blank__";function Rr(e,l,n,o){if(An(e))return Number(e);if(o==="date"){const a=Xn(e,n);if(a)return a.serial}return null}function Ll(e,l,n){if(e==null)return null;if(An(e))return Number(e);if(l==="date"){const o=Xn(e,n);if(o)return o.serial}return null}function Gf(e,l,n,o,a){const i=In(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 c=Rr(l,n,o,a),C=Ll(e.value,a,o);return c==null||C==null?!1:r?c===C:c!==C}const d=i.toLowerCase()===(e.value??"").toLowerCase();return r?d:!d}case"contains":return i.toLowerCase().includes((e.value??"").toLowerCase());case"notContains":return!i.toLowerCase().includes((e.value??"").toLowerCase());case"startsWith":return i.toLowerCase().startsWith((e.value??"").toLowerCase());case"endsWith":return i.toLowerCase().endsWith((e.value??"").toLowerCase());case"gt":case"gte":case"lt":case"lte":{const r=Rr(l,n,o,a),d=Ll(e.value,a,o);return r==null||d==null?!1:e.operator==="gt"?r>d:e.operator==="gte"?r>=d:e.operator==="lt"?r<d:r<=d}case"between":{const r=Rr(l,n,o,a),d=Ll(e.value,a,o),c=Ll(e.value2,a,o);if(r==null||d==null||c==null)return!1;const C=Math.min(d,c),h=Math.max(d,c);return r>=C&&r<=h}}return!0}function La(e,l,n,o){if(e.type==="values"){const a=e.values??[];if(a.length===0)return!0;if(l.trim()==="")return a.includes(ul);const i=In(l,n,o);return a.includes(l)||a.includes(i)}return e.condition?Gf(e.condition,l,n,o,e.type):!0}function qf(e,l,n,o){if(!e)return!0;const{columns:a,range:i}=e;for(const r in a){const d=Number(r);if(d<i.startCol||d>i.endCol)continue;const c=a[r],C=n.getValue(d,l),h=n.getFormat(d,l);if(!La(c,C,h,o))return!1}return!0}function Yf(e,l,n,o){const a=new Set,i=[];let r=!1;const{range:d,columns:c}=e;for(let h=d.startRow+1;h<=d.endRow;h++){let S=!0;for(const E in c){const B=Number(E);if(B===l)continue;const G=c[E];if(!La(G,n.getValue(B,h),n.getFormat(B,h),o)){S=!1;break}}if(!S)continue;const m=n.getValue(l,h),M=In(m,n.getFormat(l,h),o);if(m.trim()===""){r=!0;continue}a.has(M)||(a.add(M),i.push(M))}return i.length>0&&i.every(h=>An(h))?i.sort((h,S)=>Number(h)-Number(S)):i.sort((h,S)=>h.localeCompare(S,o,{numeric:!0})),{values:i,hasBlank:r}}function $a(e){var l;return e?e.type==="values"?(((l=e.values)==null?void 0:l.length)??0)>0:!!e.condition:!1}const jf={class:"filter-popup__head"},Xf={class:"filter-popup__head-label"},Zf={key:0,class:"filter-popup__head-badge"},Jf={class:"filter-popup__search"},Qf=["placeholder"],em={class:"filter-popup__tools"},tm={class:"filter-popup__count"},nm=["checked","onChange"],om={class:"filter-popup__item-label"},lm={key:0,class:"filter-popup__item-note"},rm={key:0,class:"filter-popup__empty"},am={class:"filter-popup__modes"},im={key:1,class:"filter-popup__cond"},sm={class:"filter-popup__cond-nav"},cm={class:"filter-popup__cond-mode"},dm={class:"filter-popup__cond-title"},um={key:0,class:"filter-popup__cond-row filter-popup__cond-row--between"},fm={class:"filter-popup__cond-and"},mm={key:1,class:"filter-popup__cond-row"},pm=["placeholder"],hm={key:2,class:"filter-popup__cond-hint"},gm={class:"filter-popup__footer"},Mr=248,$l=28,bm=252,ym=Ot(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"),d=t.ref(""),c=t.ref(new Set),C=t.ref(!1),h=t.ref(0),S=t.ref(null),m=t.ref("equals"),M=t.ref(""),E=t.ref(""),B=t.computed(()=>l.getColumnCandidates(l.col)),G=t.computed(()=>d.value.trim()!==""),te=t.computed(()=>{const H=d.value.trim().toLowerCase();return H?B.value.values.filter(z=>z.toLowerCase().includes(H)):B.value.values}),ge=t.computed(()=>{const H=te.value.map(z=>({key:z,label:z,isBlank:!1}));return B.value.hasBlank&&!G.value&&H.push({key:ul,label:g(l.locale,"filterBlank"),isBlank:!0}),H}),fe=Math.ceil(bm/$l),Ie=t.computed(()=>Math.max(0,Math.floor(h.value/$l)-2)),me=t.computed(()=>Math.min(ge.value.length,Ie.value+fe+4)),Ee=t.computed(()=>ge.value.slice(Ie.value,me.value)),Ae=t.computed(()=>Ie.value*$l),ce=t.computed(()=>Math.max(0,(ge.value.length-me.value)*$l));function ae(H){h.value=H.target.scrollTop}const qe=["equals","notEquals","contains","notContains","startsWith","endsWith"],ut=["equals","notEquals","gt","gte","lt","lte","between"],J={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"?qe:ut),L=t.computed(()=>O.value.map(H=>({value:H,label:g(l.locale,J[H])})));function le(H){m.value=H}const $e={text:"filterText",number:"filterNumber",date:"filterDate"},et=t.computed(()=>{const H=r.value,z=$e[H]??$e.text;return g(l.locale,z)}),oe=t.computed(()=>{var Y;const H=l.getFilter(),z=H==null?void 0:H.columns[l.col];return z?z.type==="values"?(((Y=z.values)==null?void 0:Y.length)??0)>0:!!z.condition:!1});function xe(){const H=l.getFilter(),z=H==null?void 0:H.columns[l.col];z&&z.type==="values"?(c.value=new Set((z.values??[]).filter(Y=>Y!==ul)),C.value=(z.values??[]).includes(ul)):z&&z.condition?(r.value=z.type,m.value=z.condition.operator,M.value=z.condition.value??"",E.value=z.condition.value2??""):(c.value=new Set(B.value.values),C.value=B.value.hasBlank)}function se(){if(!l.getFilter())return;const z=B.value.values,Y=B.value.hasBlank;if(c.value.size===z.length&&z.every(ze=>c.value.has(ze))&&C.value===Y)l.setFilterColumn(l.col,null);else{const ze=[...c.value];C.value&&ze.push(ul),l.setFilterColumn(l.col,{type:"values",values:ze})}}function de(H){const z=new Set(c.value);z.has(H)?z.delete(H):z.add(H),c.value=z}function we(){C.value=!C.value}function Re(){const H=G.value?te.value:B.value.values,z=new Set(c.value);H.forEach(Y=>z.add(Y)),c.value=z,C.value=!0}function Ke(){c.value=new Set,C.value=!1}function We(H){r.value=H,m.value=H==="text"?"contains":"equals",M.value="",E.value=""}function rt(){r.value="values",xe()}function je(){const H={operator:m.value,value:M.value};r.value!=="text"&&m.value==="between"&&(H.value2=E.value),M.value.trim()!==""&&(l.setFilterColumn(l.col,{type:r.value,condition:H}),l.close())}function A(){c.value=new Set(B.value.values),C.value=B.value.hasBlank}function K(){se(),l.close()}function $(){S.value&&l.setFilter(S.value),l.close()}function V(H){const z=n.value;z&&H.target instanceof Node&&z.contains(H.target)||l.close()}function x(H){H.key==="Escape"&&$()}return t.onMounted(async()=>{var ze,it;S.value=l.getFilter()?JSON.parse(JSON.stringify(l.getFilter())):null,xe(),await t.nextTick();const H=((ze=n.value)==null?void 0:ze.offsetHeight)??400;let z=l.anchor.x+15-Mr,Y=l.anchor.y+24;const ve=Nn(l.boundaryEl);z<ve.left+4&&(z=Math.max(ve.left+4,l.anchor.x)),z+Mr>ve.right-4&&(z=Math.max(ve.left+4,ve.right-Mr-4)),Y+H>ve.bottom-4&&(Y=Math.max(ve.top+4,l.anchor.y-H-4)),i.value={left:z,top:Y},(it=a.value)==null||it.focus(),document.addEventListener("pointerdown",V,!0),document.addEventListener("keydown",x,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",V,!0),document.removeEventListener("keydown",x,!0)}),(H,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",jf,[t.createElementVNode("span",Xf,t.toDisplayString(e.headerLabel||t.unref(pt)(e.col)),1),oe.value?(t.openBlock(),t.createElementBlock("span",Zf,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",Jf,[t.withDirectives(t.createElementVNode("input",{ref_key:"searchInputRef",ref:a,"onUpdate:modelValue":z[0]||(z[0]=Y=>d.value=Y),class:"filter-popup__search-input",type:"text",placeholder:t.unref(g)(e.locale,"filterSearchPlaceholder")},null,8,Qf),[[t.vModelText,d.value]])]),t.createElementVNode("div",em,[t.createElementVNode("button",{class:"filter-popup__tool",onClick:Re},t.toDisplayString(t.unref(g)(e.locale,"filterSelectAll")),1),t.createElementVNode("button",{class:"filter-popup__tool",onClick:Ke},t.toDisplayString(t.unref(g)(e.locale,"filterClearAll")),1),t.createElementVNode("span",tm,t.toDisplayString(t.unref(g)(e.locale,"filterFilteredCount").replace("{n}",String(B.value.values.length))),1)]),t.createElementVNode("div",{ref_key:"listRef",ref:o,class:"filter-popup__list",onScroll:ae},[t.createElementVNode("div",{style:t.normalizeStyle({height:Ae.value+"px"})},null,4),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ee.value,Y=>(t.openBlock(),t.createElementBlock("label",{key:Y.key,class:"filter-popup__item"},[t.createElementVNode("input",{class:"filter-popup__item-input",type:"checkbox",checked:Y.isBlank?C.value:c.value.has(Y.key),onChange:ve=>Y.isBlank?we():de(Y.key)},null,40,nm),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",om,t.toDisplayString(Y.label),1),Y.isBlank?(t.openBlock(),t.createElementBlock("span",lm,"("+t.toDisplayString(t.unref(g)(e.locale,"filterBlank"))+")",1)):t.createCommentVNode("",!0)]))),128)),t.createElementVNode("div",{style:t.normalizeStyle({height:ce.value+"px"})},null,4),ge.value.length===0?(t.openBlock(),t.createElementBlock("div",rm,t.toDisplayString(t.unref(g)(e.locale,"filterNoData")),1)):t.createCommentVNode("",!0)],544),t.createElementVNode("div",am,[t.createElementVNode("button",{class:"filter-popup__mode",onClick:z[1]||(z[1]=Y=>We("text"))},t.toDisplayString(t.unref(g)(e.locale,"filterText")),1),t.createElementVNode("button",{class:"filter-popup__mode",onClick:z[2]||(z[2]=Y=>We("number"))},t.toDisplayString(t.unref(g)(e.locale,"filterNumber")),1),t.createElementVNode("button",{class:"filter-popup__mode",onClick:z[3]||(z[3]=Y=>We("date"))},t.toDisplayString(t.unref(g)(e.locale,"filterDate")),1)])],64)):(t.openBlock(),t.createElementBlock("div",im,[t.createElementVNode("div",sm,[t.createElementVNode("button",{type:"button",class:"filter-popup__back",onClick:rt},[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",cm,t.toDisplayString(et.value),1)]),t.createElementVNode("div",dm,t.toDisplayString(t.unref(g)(e.locale,"filterCustom")),1),t.createVNode(Ut,{class:"filter-popup__cond-op","model-value":m.value,options:L.value,title:t.unref(g)(e.locale,"filterCustom"),onChange:le},null,8,["model-value","options","title"]),m.value==="between"?(t.openBlock(),t.createElementBlock("div",um,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":z[4]||(z[4]=Y=>M.value=Y),class:"filter-popup__cond-input",type:"text",onKeydown:t.withKeys(je,["enter"])},null,544),[[t.vModelText,M.value]]),t.createElementVNode("span",fm,t.toDisplayString(t.unref(g)(e.locale,"filterAnd")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":z[5]||(z[5]=Y=>E.value=Y),class:"filter-popup__cond-input",type:"text",onKeydown:t.withKeys(je,["enter"])},null,544),[[t.vModelText,E.value]])])):(t.openBlock(),t.createElementBlock("div",mm,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":z[6]||(z[6]=Y=>M.value=Y),class:"filter-popup__cond-input",type:"text",placeholder:r.value==="date"?"YYYY-MM-DD":"",onKeydown:t.withKeys(je,["enter"])},null,40,pm),[[t.vModelText,M.value]])])),r.value==="date"?(t.openBlock(),t.createElementBlock("p",hm,t.toDisplayString(t.unref(g)(e.locale,"filterDateHint")),1)):t.createCommentVNode("",!0)])),t.createElementVNode("div",gm,[t.createElementVNode("button",{class:"filter-popup__btn filter-popup__btn--clear",onClick:A},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]=Y=>r.value==="values"?K():je())},t.toDisplayString(t.unref(g)(e.locale,"filterOk")),1)])],36)]))}}),[["__scopeId","data-v-4bb3ed82"]]),Cm={class:"cf-manager__header"},wm={class:"cf-manager__title"},vm={key:0,class:"cf-manager__empty"},km={key:1,class:"cf-manager__list"},Em={class:"cf-rule__main"},Rm={class:"cf-rule__info"},Mm={class:"cf-rule__summary"},Sm={class:"cf-rule__range"},Nm={class:"cf-rule__actions"},Bm={class:"cf-chk"},xm=["checked","onChange"],Tm=["title","onClick"],Vm=["title","onClick"],Dm=["title","onClick"],Fm=["title","onClick"],Om=Ot(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((c,C)=>c.priority-C.priority));function i(c){return c.ranges.map(C=>{const h=pt(C.startCol)+(C.startRow+1);return C.startCol===C.endCol&&C.startRow===C.endRow?h:h+":"+pt(C.endCol)+(C.endRow+1)}).join(", ")}function r(c){switch(c.type){case"cellIs":{const C=g(n.locale,"cf"+(c.operator==="greaterThan"?"GreaterThan":c.operator==="lessThan"?"LessThan":c.operator==="greaterThanOrEqual"?"GreaterThanOrEqual":c.operator==="lessThanOrEqual"?"LessThanOrEqual":c.operator==="notEqual"?"NotEqual":c.operator==="between"?"Between":c.operator==="notBetween"?"NotBetween":"Equal"));return c.operator==="between"||c.operator==="notBetween"?`${C} ${c.value} ${g(n.locale,"cfValue2")} ${c.value2??""}`:`${C} ${c.value}`}case"textContains":return`${g(n.locale,"cfTextContains")} "${c.value}"`;case"textNotContains":return`${g(n.locale,"cfTextNotContains")} "${c.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"= "+c.formula;default:return g(n.locale,"cfRuleTypeGeneric")}}function d(c){const C={};return c.format.backgroundColor&&(C.background=c.format.backgroundColor),c.format.color&&(C.color=c.format.color),c.format.fontWeight==="bold"&&(C.fontWeight="700"),c.format.fontStyle==="italic"&&(C.fontStyle="italic"),c.format.underline==="underline"&&(C.textDecoration="underline"),c.format.strikethrough==="line-through"&&(C.textDecoration="line-through"),C}return(c,C)=>(t.openBlock(),t.createElementBlock("div",{class:"cf-manager",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("div",Cm,[t.createElementVNode("span",wm,t.toDisplayString(t.unref(g)(e.locale,"cfManagerTitle")),1),t.createElementVNode("button",{type:"button",class:"cf-btn cf-btn--primary cf-manager__new",onClick:C[0]||(C[0]=h=>o("new"))},t.toDisplayString(t.unref(g)(e.locale,"cfNewRule")),1),t.createElementVNode("button",{type:"button",class:"cf-manager__close",onClick:C[1]||(C[1]=h=>o("close"))}," × ")]),a.value.length===0?(t.openBlock(),t.createElementBlock("div",vm,t.toDisplayString(t.unref(g)(e.locale,"cfNoRules")),1)):(t.openBlock(),t.createElementBlock("div",km,[(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",Em,[t.createElementVNode("span",{class:"cf-rule__preview",style:t.normalizeStyle(d(h))},"Aa",4),t.createElementVNode("div",Rm,[t.createElementVNode("div",Mm,t.toDisplayString(r(h.condition)),1),t.createElementVNode("div",Sm,t.toDisplayString(t.unref(g)(e.locale,"cfAppliedTo"))+": "+t.toDisplayString(i(h)),1)])]),t.createElementVNode("div",Nm,[t.createElementVNode("label",Bm,[t.createElementVNode("input",{class:"cf-chk__input",type:"checkbox",checked:h.enabled,onChange:S=>o("toggle",h.id,S.target.checked)},null,40,xm),C[2]||(C[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:S=>o("move",h.id,"up")},[...C[3]||(C[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,Tm),t.createElementVNode("button",{type:"button",class:"cf-mini",title:t.unref(g)(e.locale,"cfMoveDown"),onClick:S=>o("move",h.id,"down")},[...C[4]||(C[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,Vm),t.createElementVNode("button",{type:"button",class:"cf-mini",title:t.unref(g)(e.locale,"cfEdit"),onClick:S=>o("edit",h)},[...C[5]||(C[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,Dm),t.createElementVNode("button",{type:"button",class:"cf-mini",title:t.unref(g)(e.locale,"cfDelete"),onClick:S=>o("delete",h.id)},[...C[6]||(C[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,Fm)])],2))),128))]))],4))}}),[["__scopeId","data-v-fccc9961"]]),Im={class:"cf-editor__header"},Am={class:"cf-editor__title"},Lm={class:"cf-editor__body"},$m={class:"cf-row"},zm={class:"cf-label"},_m={class:"cf-row"},Hm={class:"cf-label"},Wm={class:"cf-row"},Um={class:"cf-label"},Pm={key:0,class:"cf-row"},Km={class:"cf-label"},Gm={class:"cf-row"},qm={class:"cf-label"},Ym=["placeholder"],jm={class:"cf-hint"},Xm={key:2,class:"cf-row"},Zm={class:"cf-label"},Jm={class:"cf-row"},Qm={class:"cf-label"},e0={class:"cf-format-row"},t0=["title"],n0={viewBox:"0 0 1024 1024",fill:"currentColor"},o0=["fill"],l0=["title"],r0={viewBox:"0 0 1024 1024",fill:"currentColor"},a0=["fill"],i0=["title"],s0=["title"],c0=["title"],d0=["title"],u0={class:"cf-row"},f0={class:"cf-label"},m0={key:3,class:"cf-error"},p0={class:"cf-row cf-row--inline"},h0={class:"cf-chk"},g0=["checked"],b0={class:"cf-chk"},y0=["checked"],C0={class:"cf-editor__footer"},w0=Ot(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(le=>M(le)).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 d=t.reactive(r()),c=t.ref(!1),C=t.ref(!1),h=t.ref(null),S=t.ref(null),m=t.ref("");function M(O){const L=pt(O.startCol)+(O.startRow+1);return O.startCol===O.endCol&&O.startRow===O.endRow?L:L+":"+pt(O.endCol)+(O.endRow+1)}function E(O){const L=O.split(",").map($e=>$e.trim()).filter(Boolean),le=[];for(const $e of L){if(!$e.match(/^[A-Za-z]+\d+(?::[A-Za-z]+\d+)?$/i))return null;const oe=Cn($e.split(":")[0],99999,99999),xe=$e.split(":")[1],se=xe?Cn(xe,99999,99999):oe;if(!oe||!se)return null;le.push({startCol:Math.min(oe.col,se.col),endCol:Math.max(oe.col,se.col),startRow:Math.min(oe.row,se.row),endRow:Math.max(oe.row,se.row)})}return le.length?le:null}const B=t.computed(()=>d.type==="cellIs"&&(d.operator==="between"||d.operator==="notBetween")),G=t.computed(()=>d.type==="formula"),te=t.computed(()=>["blank","notBlank","duplicate","unique"].includes(d.type)),ge=t.computed(()=>a.map(O=>({value:O.value,label:g(n.locale,O.label)}))),fe=t.computed(()=>i.map(O=>({value:O.value,label:g(n.locale,O.label)})));function Ie(O){d.type=O}function me(O){d.operator=String(O)}function Ee(){c.value=!c.value}function Ae(){C.value=!C.value}function ce(){return m.value="",E(d.rangeText)?G.value&&!d.formula.trim()?(m.value=g(n.locale,"cfFormulaRequired"),!1):!0:(m.value=g(n.locale,"cfRangeInvalid"),!1)}function ae(){switch(d.type){case"cellIs":return{type:"cellIs",operator:d.operator,value:d.value,value2:d.value2||void 0};case"textContains":return{type:"textContains",value:d.value};case"textNotContains":return{type:"textNotContains",value:d.value};case"blank":return{type:"blank"};case"notBlank":return{type:"notBlank"};case"duplicate":return{type:"duplicate"};case"unique":return{type:"unique"};case"formula":return{type:"formula",formula:d.formula}}}function qe(){return{backgroundColor:d.backgroundColor||void 0,color:d.color||void 0,fontWeight:d.fontWeight?"bold":"",fontStyle:d.fontStyle?"italic":"",underline:d.underline?"underline":"",strikethrough:d.strikethrough?"line-through":""}}function ut(){var le,$e;if(!ce())return;const O=E(d.rangeText),L={id:((le=n.rule)==null?void 0:le.id)??"",condition:ae(),format:qe(),ranges:O,priority:(($e=n.rule)==null?void 0:$e.priority)??0,stopIfTrue:d.stopIfTrue,enabled:d.enabled};o("save",L)}function J(){o("cancel")}return(O,L)=>(t.openBlock(),t.createElementBlock("div",{class:"cf-editor",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("div",Im,[t.createElementVNode("span",Am,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:J}," × ")]),t.createElementVNode("div",Lm,[t.createElementVNode("div",$m,[t.createElementVNode("label",zm,t.toDisplayString(t.unref(g)(e.locale,"cfType")),1),t.createVNode(Ut,{class:"cf-dropdown","model-value":d.type,options:ge.value,width:"100%","visible-count":8,title:t.unref(g)(e.locale,"cfType"),align:"right",onChange:Ie},null,8,["model-value","options","title"])]),d.type==="cellIs"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",_m,[t.createElementVNode("label",Hm,t.toDisplayString(t.unref(g)(e.locale,"cfOperator")),1),t.createVNode(Ut,{class:"cf-dropdown","model-value":d.operator,options:fe.value,width:"100%","visible-count":9,title:t.unref(g)(e.locale,"cfOperator"),align:"right",onChange:me},null,8,["model-value","options","title"])]),t.createElementVNode("div",Wm,[t.createElementVNode("label",Um,t.toDisplayString(t.unref(g)(e.locale,"cfValue")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":L[0]||(L[0]=le=>d.value=le),class:"cf-input",type:"text"},null,512),[[t.vModelText,d.value]])]),B.value?(t.openBlock(),t.createElementBlock("div",Pm,[t.createElementVNode("label",Km,t.toDisplayString(t.unref(g)(e.locale,"cfValue2")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":L[1]||(L[1]=le=>d.value2=le),class:"cf-input",type:"text"},null,512),[[t.vModelText,d.value2]])])):t.createCommentVNode("",!0)],64)):G.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",Gm,[t.createElementVNode("label",qm,t.toDisplayString(t.unref(g)(e.locale,"cfFormulaShort")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":L[2]||(L[2]=le=>d.formula=le),class:"cf-input",type:"text",placeholder:t.unref(g)(e.locale,"cfFormulaExample")},null,8,Ym),[[t.vModelText,d.formula]])]),t.createElementVNode("p",jm,t.toDisplayString(t.unref(g)(e.locale,"cfFormula")),1)],64)):te.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",Xm,[t.createElementVNode("label",Zm,t.toDisplayString(t.unref(g)(e.locale,"cfValue")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":L[3]||(L[3]=le=>d.value=le),class:"cf-input",type:"text"},null,512),[[t.vModelText,d.value]])])),t.createElementVNode("div",Jm,[t.createElementVNode("label",Qm,t.toDisplayString(t.unref(g)(e.locale,"cfFormat")),1),t.createElementVNode("div",e0,[t.createElementVNode("button",{ref_key:"fillTrigger",ref:h,type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":c.value}]),title:t.unref(g)(e.locale,"fillColor"),onClick:Ee},[(t.openBlock(),t.createElementBlock("svg",n0,[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:d.backgroundColor||"currentColor"},null,8,o0)]))],10,t0),t.createVNode(Dl,{"model-open":c.value,"color-key":"fill","current-color":d.backgroundColor,"trigger-el":h.value,locale:e.locale,"onUpdate:modelOpen":L[4]||(L[4]=le=>c.value=le),onChange:L[5]||(L[5]=le=>d.backgroundColor=le)},null,8,["model-open","current-color","trigger-el","locale"]),t.createElementVNode("button",{ref_key:"fontTrigger",ref:S,type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":C.value}]),title:t.unref(g)(e.locale,"fontColor"),onClick:Ae},[(t.openBlock(),t.createElementBlock("svg",r0,[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:d.color||"#000000"},null,8,a0)]))],10,l0),t.createVNode(Dl,{"model-open":C.value,"color-key":"text","current-color":d.color,"trigger-el":S.value,locale:e.locale,"onUpdate:modelOpen":L[6]||(L[6]=le=>C.value=le),onChange:L[7]||(L[7]=le=>d.color=le)},null,8,["model-open","current-color","trigger-el","locale"]),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":d.fontWeight}]),title:t.unref(g)(e.locale,"bold"),onClick:L[8]||(L[8]=le=>d.fontWeight=!d.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,i0),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":d.fontStyle}]),title:t.unref(g)(e.locale,"italic"),onClick:L[9]||(L[9]=le=>d.fontStyle=!d.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,s0),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":d.underline}]),title:t.unref(g)(e.locale,"underline"),onClick:L[10]||(L[10]=le=>d.underline=!d.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,c0),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":d.strikethrough}]),title:t.unref(g)(e.locale,"strikethrough"),onClick:L[11]||(L[11]=le=>d.strikethrough=!d.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,d0)])]),t.createElementVNode("div",u0,[t.createElementVNode("label",f0,t.toDisplayString(t.unref(g)(e.locale,"cfAppliedTo")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":L[12]||(L[12]=le=>d.rangeText=le),class:"cf-input",type:"text"},null,512),[[t.vModelText,d.rangeText]])]),m.value?(t.openBlock(),t.createElementBlock("div",m0,t.toDisplayString(m.value),1)):t.createCommentVNode("",!0),t.createElementVNode("div",p0,[t.createElementVNode("label",h0,[t.createElementVNode("input",{class:"cf-chk__input",type:"checkbox",checked:d.stopIfTrue,onChange:L[13]||(L[13]=le=>d.stopIfTrue=le.target.checked)},null,40,g0),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",b0,[t.createElementVNode("input",{class:"cf-chk__input",type:"checkbox",checked:d.enabled,onChange:L[14]||(L[14]=le=>d.enabled=le.target.checked)},null,40,y0),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",C0,[t.createElementVNode("button",{type:"button",class:"cf-btn cf-btn--primary",onClick:ut},t.toDisplayString(t.unref(g)(e.locale,"ok")),1),t.createElementVNode("button",{type:"button",class:"cf-btn",onClick:J},t.toDisplayString(t.unref(g)(e.locale,"cancel")),1)])],4))}}),[["__scopeId","data-v-8a513402"]]),v0={class:"dv-editor__header"},k0={class:"dv-editor__title"},E0={class:"dv-editor__body"},R0={class:"dv-sec"},M0={class:"dv-sec__title"},S0={class:"dv-row"},N0={class:"dv-label"},B0={class:"dv-row"},x0={class:"dv-label"},T0={class:"dv-hint"},V0={class:"dv-row dv-row--inline"},D0={class:"dv-chk"},F0=["checked"],O0={class:"dv-row"},I0={class:"dv-label"},A0={class:"dv-hint"},L0={class:"dv-row"},$0={class:"dv-label"},z0={key:0,class:"dv-row"},_0={class:"dv-label"},H0={class:"dv-row"},W0={class:"dv-label"},U0={class:"dv-row"},P0={class:"dv-label"},K0={class:"dv-row dv-row--inline"},G0=["checked","disabled"],q0=["checked","disabled"],Y0={class:"dv-sec"},j0={class:"dv-sec__title"},X0={class:"dv-row dv-row--inline"},Z0={class:"dv-chk"},J0=["checked"],Q0={class:"dv-row"},e1={class:"dv-label"},t1=["disabled"],n1={class:"dv-row dv-row--top"},o1={class:"dv-label"},l1=["disabled"],r1={class:"dv-sec"},a1={class:"dv-sec__title"},i1={class:"dv-row dv-row--inline"},s1={class:"dv-chk"},c1=["checked"],d1={class:"dv-row"},u1={class:"dv-label"},f1={class:"dv-row"},m1={class:"dv-label"},p1=["disabled"],h1={class:"dv-row dv-row--top"},g1={class:"dv-label"},b1=["disabled"],y1={class:"dv-sec"},C1={class:"dv-row"},w1={class:"dv-label"},v1={key:0,class:"dv-error"},k1={class:"dv-editor__footer"},zl="\\$?[A-Za-z]+\\$?\\d+",E1=Ot(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 d(O){const L=pt(O.startCol)+(O.startRow+1);return O.startCol===O.endCol&&O.startRow===O.endRow?L:L+":"+pt(O.endCol)+(O.endRow+1)}function c(O){const L=O==null?void 0:O.listSource;if((L==null?void 0:L.type)==="range"){const $e=d(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 C(){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:c(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(d).join(", "):n.defaultRangeText,enabled:(O==null?void 0:O.enabled)!==!1}}const h=t.reactive(C()),S=t.ref(""),m=t.computed(()=>h.type==="list"),M=t.computed(()=>h.type==="custom"),E=t.computed(()=>["wholeNumber","decimal","date","time","textLength"].includes(h.type)),B=t.computed(()=>E.value&&(h.operator==="between"||h.operator==="notBetween")),G=t.computed(()=>h.type==="any"),te=t.computed(()=>a.map(O=>({value:O.value,label:g(n.locale,O.label)}))),ge=t.computed(()=>i.map(O=>({value:O.value,label:g(n.locale,O.label)}))),fe=t.computed(()=>r.map(O=>({value:O.value,label:g(n.locale,O.label)})));function Ie(O){const L=O.split(",").map($e=>$e.trim()).filter(Boolean),le=[];for(const $e of L){if(!$e.match(/^\$?[A-Za-z]+\$?\d+(?::\$?[A-Za-z]+\$?\d+)?$/))return null;const oe=Cn($e.split(":")[0],99999,99999),xe=$e.split(":")[1],se=xe?Cn(xe,99999,99999):oe;if(!oe||!se)return null;le.push({startCol:Math.min(oe.col,se.col),endCol:Math.max(oe.col,se.col),startRow:Math.min(oe.row,se.row),endRow:Math.max(oe.row,se.row)})}return le.length?le:null}function me(O){const L=O.trim();if(!L)return null;const le=new RegExp(`^(?:'([^']+)'|([^!'"]+))!(${zl})(?::(${zl}))?$`).exec(L);if(le){const oe=(le[1]??le[2]??"").trim(),xe=Cn(le[3],99999,99999),se=le[4]?Cn(le[4],99999,99999):xe;return!oe||!xe||!se?null:{type:"range",sheetId:oe,range:{startCol:Math.min(xe.col,se.col),endCol:Math.max(xe.col,se.col),startRow:Math.min(xe.row,se.row),endRow:Math.max(xe.row,se.row)}}}const $e=new RegExp(`^(${zl})(?::(${zl}))?$`).exec(L);if($e){const oe=Cn($e[1],99999,99999),xe=$e[2]?Cn($e[2],99999,99999):oe;return!oe||!xe?null:{type:"range",range:{startCol:Math.min(oe.col,xe.col),endCol:Math.max(oe.col,xe.col),startRow:Math.min(oe.row,xe.row),endRow:Math.max(oe.row,xe.row)}}}const et=L.split(",").map(oe=>oe.trim());return et.some(oe=>oe!=="")?{type:"values",values:et}:null}const Ee=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/;function Ae(O,L){const le=L.trim();if(le==="")return g(n.locale,"dvValueRequired");if(le.startsWith("="))return null;const $e=n.locale;switch(O){case"wholeNumber":case"textLength":{const et=Vl(le,$e);return et&&Number.isFinite(et.num)&&Number.isInteger(et.num)||Ee.test(le)&&Number.isInteger(Number(le))?null:g($e,"dvMustBeInteger")}case"decimal":{const et=Vl(le,$e);return et&&Number.isFinite(et.num)||Ee.test(le)&&Number.isFinite(Number(le))?null:g($e,"dvMustBeNumber")}case"date":{const et=Xn(le,$e);return et&&et.format!=="h:mm:ss"?null:g($e,"dvDateInvalid")}case"time":return Xn(le,$e)?null:g($e,"dvTimeInvalid");default:return null}}function ce(){if(S.value="",!Ie(h.rangeText))return S.value=g(n.locale,"dvRangeInvalid"),!1;if(h.type==="any")return!0;if(m.value)return me(h.source)?!0:(S.value=g(n.locale,"dvSourceInvalid"),!1);if(M.value)return h.formula1.trim()?!0:(S.value=g(n.locale,"dvFormulaRequired"),!1);if(B.value){if(!h.formula1.trim())return S.value=g(n.locale,"dvMinRequired"),!1;if(!h.formula2.trim())return S.value=g(n.locale,"dvMaxRequired"),!1;const L=Ae(h.type,h.formula1);if(L)return S.value=`${g(n.locale,"dvMin")}:${L}`,!1;const le=Ae(h.type,h.formula2);return le?(S.value=`${g(n.locale,"dvMax")}:${le}`,!1):!0}if(!h.formula1.trim())return S.value=g(n.locale,"dvValueRequired"),!1;const O=Ae(h.type,h.formula1);return O?(S.value=`${g(n.locale,"dvValue")}:${O}`,!1):!0}function ae(){var le,$e;if(!ce())return;const O=Ie(h.rangeText);if(h.type==="any"){o("save",{id:((le=n.rule)==null?void 0:le.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(m.value){const et=me(h.source);L.listSource=et,L.values=et.type==="values"?et.values:void 0,L.showDropdown=h.showDropdown}else M.value?L.formula1=h.formula1.trim():(L.operator=h.operator,L.formula1=h.formula1.trim(),L.formula2=B.value?h.formula2.trim():void 0);o("save",L)}function qe(O){h.type=O}function ut(O){h.operator=String(O)}function J(O){h.errorStyle=String(O)}return(O,L)=>(t.openBlock(),t.createElementBlock("div",{class:"dv-editor",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("div",v0,[t.createElementVNode("span",k0,t.toDisplayString(t.unref(g)(e.locale,"dvDialogTitle")),1),t.createElementVNode("button",{type:"button",class:"dv-editor__close",onClick:L[0]||(L[0]=le=>o("cancel"))}," × ")]),t.createElementVNode("div",E0,[t.createElementVNode("div",R0,[t.createElementVNode("div",M0,t.toDisplayString(t.unref(g)(e.locale,"dvSettings")),1),t.createElementVNode("div",S0,[t.createElementVNode("label",N0,t.toDisplayString(t.unref(g)(e.locale,"dvAllow")),1),t.createVNode(Ut,{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:qe},null,8,["model-value","options","title"])]),m.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",B0,[t.createElementVNode("label",x0,t.toDisplayString(t.unref(g)(e.locale,"dvSource")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":L[1]||(L[1]=le=>h.source=le),class:"dv-input",type:"text",spellcheck:"false"},null,512),[[t.vModelText,h.source]])]),t.createElementVNode("p",T0,t.toDisplayString(t.unref(g)(e.locale,"dvSourceHint")),1),t.createElementVNode("div",V0,[t.createElementVNode("label",D0,[t.createElementVNode("input",{class:"dv-chk__input",type:"checkbox",checked:h.showDropdown,onChange:L[2]||(L[2]=le=>h.showDropdown=le.target.checked)},null,40,F0),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)):M.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",O0,[t.createElementVNode("label",I0,t.toDisplayString(t.unref(g)(e.locale,"dvFormula")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":L[3]||(L[3]=le=>h.formula1=le),class:"dv-input",type:"text",spellcheck:"false",placeholder:"=AND(A1>=0,A1<=100)"},null,512),[[t.vModelText,h.formula1]])]),t.createElementVNode("p",A0,t.toDisplayString(t.unref(g)(e.locale,"cfFormulaExample")),1)],64)):E.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("div",L0,[t.createElementVNode("label",$0,t.toDisplayString(t.unref(g)(e.locale,"dvData")),1),t.createVNode(Ut,{class:"dv-dropdown","model-value":h.operator,options:ge.value,width:"100%","visible-count":9,title:t.unref(g)(e.locale,"dvOperator"),align:"right",onChange:ut},null,8,["model-value","options","title"])]),B.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",H0,[t.createElementVNode("label",W0,t.toDisplayString(t.unref(g)(e.locale,"dvMin")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":L[5]||(L[5]=le=>h.formula1=le),class:"dv-input",type:"text",spellcheck:"false"},null,512),[[t.vModelText,h.formula1]])]),t.createElementVNode("div",U0,[t.createElementVNode("label",P0,t.toDisplayString(t.unref(g)(e.locale,"dvMax")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":L[6]||(L[6]=le=>h.formula2=le),class:"dv-input",type:"text",spellcheck:"false"},null,512),[[t.vModelText,h.formula2]])])],64)):(t.openBlock(),t.createElementBlock("div",z0,[t.createElementVNode("label",_0,t.toDisplayString(t.unref(g)(e.locale,"dvValue")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":L[4]||(L[4]=le=>h.formula1=le),class:"dv-input",type:"text",spellcheck:"false"},null,512),[[t.vModelText,h.formula1]])]))],64)):t.createCommentVNode("",!0),t.createElementVNode("div",K0,[t.createElementVNode("label",{class:t.normalizeClass(["dv-chk",{"dv-chk--disabled":G.value}])},[t.createElementVNode("input",{class:"dv-chk__input",type:"checkbox",checked:h.allowBlank,disabled:G.value,onChange:L[7]||(L[7]=le=>h.allowBlank=le.target.checked)},null,40,G0),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":G.value}])},[t.createElementVNode("input",{class:"dv-chk__input",type:"checkbox",checked:h.enabled,disabled:G.value,onChange:L[8]||(L[8]=le=>h.enabled=le.target.checked)},null,40,q0),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",Y0,[t.createElementVNode("div",j0,t.toDisplayString(t.unref(g)(e.locale,"dvInputMessageTab")),1),t.createElementVNode("div",X0,[t.createElementVNode("label",Z0,[t.createElementVNode("input",{class:"dv-chk__input",type:"checkbox",checked:h.showInputMessage,onChange:L[9]||(L[9]=le=>h.showInputMessage=le.target.checked)},null,40,J0),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",e1,t.toDisplayString(t.unref(g)(e.locale,"dvInputTitle")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":L[10]||(L[10]=le=>h.inputTitle=le),class:"dv-input",type:"text",disabled:!h.showInputMessage},null,8,t1),[[t.vModelText,h.inputTitle]])]),t.createElementVNode("div",n1,[t.createElementVNode("label",o1,t.toDisplayString(t.unref(g)(e.locale,"dvInputMessage")),1),t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":L[11]||(L[11]=le=>h.inputMessage=le),class:"dv-input dv-input--area",rows:"2",disabled:!h.showInputMessage},null,8,l1),[[t.vModelText,h.inputMessage]])])]),t.createElementVNode("div",r1,[t.createElementVNode("div",a1,t.toDisplayString(t.unref(g)(e.locale,"dvErrorAlertTab")),1),t.createElementVNode("div",i1,[t.createElementVNode("label",s1,[t.createElementVNode("input",{class:"dv-chk__input",type:"checkbox",checked:h.showErrorMessage,onChange:L[12]||(L[12]=le=>h.showErrorMessage=le.target.checked)},null,40,c1),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",d1,[t.createElementVNode("label",u1,t.toDisplayString(t.unref(g)(e.locale,"dvErrorStyle")),1),t.createVNode(Ut,{class:"dv-dropdown","model-value":h.errorStyle,options:fe.value,width:"100%","visible-count":4,title:t.unref(g)(e.locale,"dvErrorStyle"),align:"right",onChange:J},null,8,["model-value","options","title"])]),t.createElementVNode("div",f1,[t.createElementVNode("label",m1,t.toDisplayString(t.unref(g)(e.locale,"dvErrorTitle")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":L[13]||(L[13]=le=>h.errorTitle=le),class:"dv-input",type:"text",disabled:!h.showErrorMessage},null,8,p1),[[t.vModelText,h.errorTitle]])]),t.createElementVNode("div",h1,[t.createElementVNode("label",g1,t.toDisplayString(t.unref(g)(e.locale,"dvErrorMessage")),1),t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":L[14]||(L[14]=le=>h.errorMessage=le),class:"dv-input dv-input--area",rows:"2",disabled:!h.showErrorMessage},null,8,b1),[[t.vModelText,h.errorMessage]])])]),t.createElementVNode("div",y1,[t.createElementVNode("div",C1,[t.createElementVNode("label",w1,t.toDisplayString(t.unref(g)(e.locale,"dvApplyTo")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":L[15]||(L[15]=le=>h.rangeText=le),class:"dv-input",type:"text",spellcheck:"false"},null,512),[[t.vModelText,h.rangeText]])])]),S.value?(t.openBlock(),t.createElementBlock("div",v1,t.toDisplayString(S.value),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",k1,[t.createElementVNode("button",{type:"button",class:"dv-btn dv-btn--danger",onClick:L[16]||(L[16]=le=>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:ae},t.toDisplayString(t.unref(g)(e.locale,"ok")),1),t.createElementVNode("button",{type:"button",class:"dv-btn",onClick:L[17]||(L[17]=le=>o("cancel"))},t.toDisplayString(t.unref(g)(e.locale,"cancel")),1)])],4))}}),[["__scopeId","data-v-e44c5a06"]]),R1={key:0,class:"dvd__search"},M1=["placeholder"],S1=["onMouseenter","onClick"],N1={class:"dvd__check"},B1={class:"dvd__label"},x1={key:1,class:"dvd__empty"},Tn=24,T1=244,V1=140,D1=Ot(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),d=t.ref(null),c=t.ref(null),C=t.ref(null),h=t.ref({left:n.x,top:n.y+n.height+2,up:!1}),S=t.computed(()=>{const O=a.value.trim().toLowerCase();return O?n.items.filter(L=>String(L??"").toLowerCase().includes(O)):n.items}),m=t.computed(()=>Math.min(T1,Math.max(Tn,S.value.length*Tn))),M=t.computed(()=>Math.max(V1,Math.min(360,n.width))),E=t.computed(()=>Math.max(0,Math.floor(r.value/Tn)-1)),B=t.computed(()=>Math.min(S.value.length,Math.ceil((r.value+m.value)/Tn)+1)),G=t.computed(()=>S.value.slice(E.value,B.value)),te=t.computed(()=>E.value*Tn),ge=t.computed(()=>Math.max(0,(S.value.length-B.value)*Tn));function fe(O){return String(O??"").trim().toLowerCase()===String(n.current??"").trim().toLowerCase()}function Ie(){const O=m.value+me(),L=Nn(n.boundaryEl),le=L.bottom-(n.y+n.height)-8,$e=n.y-L.top-8,et=le<O&&$e>le;let oe=et?n.y-O-2:n.y+n.height+2;oe=Math.max(L.top+8,Math.min(L.bottom-O-8,oe));const xe=Math.max(L.left+8,Math.min(L.right-M.value-8,n.x));h.value={left:xe,top:oe,up:et}}function me(){return S.value.length>8||a.value?34:0}t.watch(()=>[n.x,n.y,n.width,n.height],()=>Ie()),t.onMounted(()=>{t.nextTick(()=>{var O;Ie(),d.value?d.value.focus():(O=C.value)==null||O.focus()}),document.addEventListener("pointerdown",Ee,!0),window.addEventListener("resize",Ae),window.addEventListener("scroll",Ae,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",Ee,!0),window.removeEventListener("resize",Ae),window.removeEventListener("scroll",Ae,!0)});function Ee(O){var L;(L=C.value)!=null&&L.contains(O.target)||Ae()}function Ae(){o("close")}function ce(O){const L=c.value;if(!L)return;const le=O*Tn,$e=le+Tn;le<L.scrollTop?L.scrollTop=le:$e>L.scrollTop+m.value&&(L.scrollTop=$e-m.value)}function ae(O){const L=S.value.length;L!==0&&(i.value=(i.value+O+L)%L,ce(i.value))}function qe(O){const L=S.value[O];L!==void 0&&o("select",L)}function ut(O){r.value=O.target.scrollTop}function J(O){switch(O.key){case"ArrowDown":O.preventDefault(),O.stopPropagation(),ae(1);return;case"ArrowUp":O.preventDefault(),O.stopPropagation(),ae(-1);return;case"Home":O.preventDefault(),O.stopPropagation(),i.value=0,r.value=0,c.value&&(c.value.scrollTop=0);return;case"End":{O.preventDefault(),O.stopPropagation();const L=S.value.length;i.value=Math.max(0,L-1),ce(i.value);return}case"PageDown":O.preventDefault(),O.stopPropagation(),ae(Math.max(1,Math.floor(m.value/Tn)));return;case"PageUp":O.preventDefault(),O.stopPropagation(),ae(-Math.max(1,Math.floor(m.value/Tn)));return;case"Enter":O.preventDefault(),O.stopPropagation(),qe(i.value);return;case"Escape":O.preventDefault(),O.stopPropagation(),Ae();return;case"Tab":O.preventDefault(),O.stopPropagation(),qe(i.value);return}}return t.watch(a,()=>{i.value=0,r.value=0,c.value&&(c.value.scrollTop=0),t.nextTick(Ie)}),t.watch(S,O=>{const L=O.findIndex(le=>fe(le));L>=0&&(i.value=L,t.nextTick(()=>ce(L)))},{immediate:!0}),(O,L)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:C,class:"dvd",tabindex:"-1",style:t.normalizeStyle({left:h.value.left+"px",top:h.value.top+"px",width:M.value+"px"}),onKeydown:J,onWheel:L[2]||(L[2]=t.withModifiers(()=>{},["stop"]))},[me()>0?(t.openBlock(),t.createElementBlock("div",R1,[t.withDirectives(t.createElementVNode("input",{ref_key:"searchRef",ref:d,"onUpdate:modelValue":L[0]||(L[0]=le=>a.value=le),class:"dvd__search-input",type:"text",spellcheck:"false",placeholder:t.unref(g)(e.locale,"dvSearchPlaceholder"),onKeydown:J},null,40,M1),[[t.vModelText,a.value]])])):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:c,class:"dvd__list",style:t.normalizeStyle({height:m.value+"px"}),onScroll:ut},[t.createElementVNode("div",{style:t.normalizeStyle({height:te.value+"px"})},null,4),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(G.value,(le,$e)=>(t.openBlock(),t.createElementBlock("div",{key:E.value+$e,class:t.normalizeClass(["dvd__item",{"dvd__item--active":E.value+$e===i.value,"dvd__item--checked":fe(le)}]),style:t.normalizeStyle({height:Tn+"px",lineHeight:Tn+"px"}),onMousedown:L[1]||(L[1]=t.withModifiers(()=>{},["prevent"])),onMouseenter:et=>i.value=E.value+$e,onClick:et=>qe(E.value+$e)},[t.createElementVNode("span",N1,t.toDisplayString(fe(le)?"✓":""),1),t.createElementVNode("span",B1,t.toDisplayString(le===""?t.unref(g)(e.locale,"emptyCellLabel"):le),1)],46,S1))),128)),t.createElementVNode("div",{style:t.normalizeStyle({height:ge.value+"px"})},null,4)],36),S.value.length===0?(t.openBlock(),t.createElementBlock("div",x1,t.toDisplayString(t.unref(g)(e.locale,"dvNoMatch")),1)):t.createCommentVNode("",!0)],36))}}),[["__scopeId","data-v-1645fbe5"]]),F1={class:"dv-alert__header"},O1={class:"dv-alert__title"},I1={class:"dv-alert__body"},A1=["d"],L1={class:"dv-alert__text"},$1={key:0,class:"dv-alert__subtitle"},z1={class:"dv-alert__message"},_1={class:"dv-alert__footer"},za=Ot(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")),d=t.computed(()=>n.severity==="stop"?g(n.locale,"dvBtnRetry"):n.severity==="warning"?g(n.locale,"dvBtnContinue"):g(n.locale,"dvBtnOk")),c=t.computed(()=>n.severity==="stop"?g(n.locale,"cancel"):n.severity==="warning"?g(n.locale,"dvBtnNo"):g(n.locale,"cancel"));function C(){o("resolve",n.severity==="stop"?"retry":"continue")}function h(){o("resolve","cancel")}return(S,m)=>(t.openBlock(),t.createElementBlock("div",{class:"dv-alert",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("div",F1,[t.createElementVNode("span",O1,t.toDisplayString(r.value),1)]),t.createElementVNode("div",I1,[(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,A1)],4)),t.createElementVNode("div",L1,[e.title?(t.openBlock(),t.createElementBlock("div",$1,t.toDisplayString(e.title),1)):t.createCommentVNode("",!0),t.createElementVNode("div",z1,t.toDisplayString(e.message),1)])]),t.createElementVNode("div",_1,[m[2]||(m[2]=t.createElementVNode("span",{class:"dv-alert__spacer"},null,-1)),t.createElementVNode("button",{type:"button",class:"dv-alert__btn dv-alert__btn--primary",onMousedown:m[0]||(m[0]=t.withModifiers(()=>{},["prevent"])),onClick:C},t.toDisplayString(d.value),33),t.createElementVNode("button",{type:"button",class:"dv-alert__btn",onMousedown:m[1]||(m[1]=t.withModifiers(()=>{},["prevent"])),onClick:h},t.toDisplayString(c.value),33)])],4))}}),[["__scopeId","data-v-8b20dae0"]]),H1={key:0,class:"dvim__title"},W1={class:"dvim__message"},U1=Ot(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",H1,t.toDisplayString(e.title),1)):t.createCommentVNode("",!0),t.createElementVNode("div",W1,t.toDisplayString(e.message),1)],4))}}),[["__scopeId","data-v-c8350c96"]]),P1={class:"note-overlay__header"},K1={class:"note-overlay__author"},G1=["title"],q1={class:"note-overlay__body"},Y1={class:"note-overlay__header"},j1={class:"note-overlay__author"},X1=["placeholder"],Z1={class:"note-overlay__footer"},J1=Ot(t.defineComponent({__name:"note-overlay",props:{anchor:{},mode:{},note:{default:null},author:{},locale:{},placeholder:{default:""},boundaryEl:{default:null},frozen:{type:Boolean,default:!1}},emits:["save","delete","close"],setup(e,{emit:l}){var m;const n=e,o=l,a=t.ref(null),i=t.ref(((m=n.note)==null?void 0:m.text)??"");t.watch(()=>{var M;return[n.mode,(M=n.note)==null?void 0:M.text,n.anchor.x,n.anchor.y]},()=>{var M;i.value=((M=n.note)==null?void 0:M.text)??""});const r=t.ref({left:0,top:0}),d=t.computed(()=>({left:r.value.left+"px",top:r.value.top+"px",zIndex:n.frozen?2:0}));function c(){var ce,ae;const M=a.value,E=n.anchor;if(!M){r.value={left:E.x+E.width+6,top:E.y+6};return}const B=M.offsetWidth,G=M.offsetHeight,fe={left:52,top:24,right:((ce=n.boundaryEl)==null?void 0:ce.offsetWidth)??0,bottom:((ae=n.boundaryEl)==null?void 0:ae.offsetHeight)??0},Ie=6,me=8;let Ee=E.x+E.width+Ie,Ae=E.y+Ie;Ee+B>fe.right-me&&(Ee=E.x-B-Ie,Ee<fe.left+me&&(Ee=Math.min(Math.max(fe.left+me,E.x),fe.right-B-me),fe.right-B-me<fe.left+me&&(Ee=fe.left+me))),Ae+G>fe.bottom-me&&(Ae=E.y+E.height-Ie-G,Ae<fe.top+me&&(Ae=Math.min(Math.max(fe.top+me,E.y),fe.bottom-G-me),fe.bottom-G-me<fe.top+me&&(Ae=fe.top+me))),r.value={left:Ee,top:Ae}}t.watch(()=>{var M;return[n.anchor.x,n.anchor.y,n.anchor.width,(M=n.note)==null?void 0:M.text,i.value]},()=>t.nextTick(c),{immediate:!0,flush:"post"});function C(){t.nextTick(c)}t.onMounted(()=>window.addEventListener("resize",C)),t.onBeforeUnmount(()=>window.removeEventListener("resize",C));function h(M){M.key==="Escape"?(M.stopPropagation(),M.preventDefault(),o("close")):M.key==="Enter"&&!M.shiftKey&&(M.ctrlKey||M.metaKey||M.altKey)&&(M.stopPropagation(),M.preventDefault(),S())}function S(){o("save",i.value.trim())}return(M,E)=>{var B,G;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(d.value),onMousedown:E[3]||(E[3]=t.withModifiers(()=>{},["stop"])),onContextmenu:E[4]||(E[4]=t.withModifiers(()=>{},["stop"])),onClick:E[5]||(E[5]=t.withModifiers(()=>{},["stop"]))},[e.mode==="view"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",P1,[t.createElementVNode("span",K1,t.toDisplayString(((B=e.note)==null?void 0:B.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:E[0]||(E[0]=te=>o("close"))}," × ",8,G1)]),t.createElementVNode("div",q1,t.toDisplayString(((G=e.note)==null?void 0:G.text)||t.unref(g)(e.locale,"noteEmpty")),1)],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",Y1,[t.createElementVNode("span",j1,t.toDisplayString(e.author||t.unref(g)(e.locale,"noteUnnamed")),1)]),t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":E[1]||(E[1]=te=>i.value=te),class:"note-overlay__editor",placeholder:e.placeholder,rows:"3",onKeydown:h,onBlur:S},null,40,X1),[[t.vModelText,i.value]]),t.createElementVNode("div",Z1,[t.createElementVNode("button",{type:"button",class:"note-overlay__btn note-overlay__btn--ghost",onClick:E[2]||(E[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:S},t.toDisplayString(t.unref(g)(e.locale,"noteSave")),1)])],64))],38)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-b3ae8ae0"]]);function So(e,l){return`${e},${l}`}function _a(e,l){if(e.startsWith("="))return{kind:"formula",formula:e};const n=Xn(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 An(e)?{kind:"number",num:parseFloat(e)}:{kind:"text",text:e}}function Sr(e,l){for(let n=2;n<e.length;n++)if(e[n]-e[n-1]!==l)return!1;return!0}function Ha(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 Sr(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(Sr(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&&Sr(o,a))return{kind:"text-series",step:a,baseCharCode:o[0],sourceLen:l}}return{kind:"copy",sourceValues:[...e]}}return{kind:"copy",sourceValues:[...e]}}function Wa(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 Ua(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 _l(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 Pa(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 Ka(e,l,n,o,a,i){return Al(e,n.col-l.col,n.row-l.row,o,a,i)}function Ga(e,l){return!(e.endCol<l.startCol||e.startCol>l.endCol||e.endRow<l.startRow||e.startRow>l.endRow)}function qa(e,l){return l.startCol>=e.startCol&&l.endCol<=e.endCol&&l.startRow>=e.startRow&&l.endRow<=e.endRow}function Nr(e,l,n){const o=Object.keys(n);for(const d of o){const c=n[d];if(Ga(e,c)&&!qa(e,c))return{ok:!1,reason:"source-overlap"}}const a=[];for(const d of o){const c=n[d];qa(e,c)||Ga(l,c)&&a.push(c)}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 d of a)if(d.endRow-d.startRow!==i||d.endCol-d.startCol!==r)return{ok:!1,reason:"target-merge-size"};return{ok:!0,reason:"ok"}}function Ya(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 ja(e,l,n,o,a,i,r,d){const c={cells:{},merges:{}},C=o==="up"||o==="down",h=o==="up"||o==="left";if(C){const S=e.endRow-e.startRow+1;for(let m=e.startCol;m<=e.endCol;m++){const M=[],E=[];for(let te=e.startRow;te<=e.endRow;te++){const ge=n.cells[So(m,te)];M.push(ge?_a(ge.value,a):{kind:"text",text:""}),E.push(ge==null?void 0:ge.styleId)}const B=Ha(M),G=M.length;for(let te=l.startRow;te<=l.endRow;te++){const ge=h?l.endRow-te:te-l.startRow;if(B.kind==="formula"){const fe=h?e.endRow-((l.endRow-te)%S+S)%S:e.startRow+((te-e.startRow)%S+S)%S,Ie=n.cells[So(m,fe)],me=Ie?Ie.value:"",Ee=Ka(me,{col:m,row:fe},{col:m,row:te},i,r,d);c.cells[So(m,te)]=_l({kind:"formula",formula:Ee},Ie==null?void 0:Ie.styleId)}else{const fe=h?Ua(B,ge):Wa(B,ge,G),Ie=Ya(B,E,ge,h);c.cells[So(m,te)]=_l(fe,Ie)}}}}else{const S=e.endCol-e.startCol+1;for(let m=e.startRow;m<=e.endRow;m++){const M=[],E=[];for(let te=e.startCol;te<=e.endCol;te++){const ge=n.cells[So(te,m)];M.push(ge?_a(ge.value,a):{kind:"text",text:""}),E.push(ge==null?void 0:ge.styleId)}const B=Ha(M),G=M.length;for(let te=l.startCol;te<=l.endCol;te++){const ge=h?l.endCol-te:te-l.startCol;if(B.kind==="formula"){const fe=h?e.endCol-((l.endCol-te)%S+S)%S:e.startCol+((te-e.startCol)%S+S)%S,Ie=n.cells[So(fe,m)],me=Ie?Ie.value:"",Ee=Ka(me,{col:fe,row:m},{col:te,row:m},i,r,d);c.cells[So(te,m)]=_l({kind:"formula",formula:Ee},Ie==null?void 0:Ie.styleId)}else{const fe=h?Ua(B,ge):Wa(B,ge,G),Ie=Ya(B,E,ge,h);c.cells[So(te,m)]=_l(fe,Ie)}}}}return c}function Hl(e,l){delete e[l]}function Q1(){return`note-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function Xa(e){return e?{...e}:{}}function Yo(e,l){return`${e},${l}`}function Za(e,l,n){const o=n[Yo(l,e)];return!!(o&&o.noteId)}function ep(e,l,n,o){const a=n[Yo(l,e)];if(!(!a||!a.noteId))return o[a.noteId]}function tp(e,l){const n=Date.now();return{id:Q1(),text:e,author:l,createdAt:n,updatedAt:n}}function np(e,l,n,o,a,i){const r=Yo(l,e),d=a[r]||(a[r]={value:""});d.noteId&&i[d.noteId]&&Hl(i,d.noteId);const c=tp(n,o);return i[c.id]=c,d.noteId=c.id,c}function op(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 lp(e,l,n,o){const a=Yo(l,e),i=n[a];if(!i||!i.noteId)return;const r=o[i.noteId];return Hl(o,i.noteId),i.noteId=void 0,Object.keys(i).length===1&&"value"in i&&i.value===""&&Hl(n,a),r}function rp(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 Wl(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)||Hl(l,o)}function ap(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 ip(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 Ln(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 sp(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 cp{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 dp(e,l,n,o,a,i){switch(e.type){case"cellIs":{const r=o.getCellValue(l,n),d=Ln(r);switch(e.operator){case"equal":{const c=Ln(e.value);return d!==null&&c!==null?d===c:r===e.value}case"notEqual":{const c=Ln(e.value);return d!==null&&c!==null?d!==c:r!==e.value}case"greaterThan":{const c=Ln(e.value);return d===null||c===null?!1:d>c}case"greaterThanOrEqual":{const c=Ln(e.value);return d===null||c===null?!1:d>=c}case"lessThan":{const c=Ln(e.value);return d===null||c===null?!1:d<c}case"lessThanOrEqual":{const c=Ln(e.value);return d===null||c===null?!1:d<=c}case"between":{const c=Ln(e.value),C=Ln(e.value2??"");return d===null||c===null||C===null?!1:d>=Math.min(c,C)&&d<=Math.max(c,C)}case"notBetween":{const c=Ln(e.value),C=Ln(e.value2??"");return d===null||c===null||C===null?!1:d<Math.min(c,C)||d>Math.max(c,C)}}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,d=n-a.row,c=e.formula.trim().replace(/^=/,""),C=up(c,r,d,o.colCount,o.rowCount);return Aa(C,o.cells,o.colCount,o.rowCount)}catch{return!1}case"colorScale":case"dataBar":case"iconSet":case"topBottom":case"aboveBelowAverage":return!1}return!1}function up(e,l,n,o,a){return Al(e,l,n,o,a,pt)}function fp(e,l,n,o,a){if(!n||n.length===0)return null;const i=n.filter(c=>c.enabled&&ip(c.ranges,e,l)).sort((c,C)=>c.priority-C.priority);if(i.length===0)return null;const r={};let d=!1;for(const c of i){const C=ap(c);let h;(c.condition.type==="duplicate"||c.condition.type==="unique")&&(h=a==null?void 0:a.get(c.id),h||(h=sp(c,o),a==null||a.set(c.id,h)));let S=!1;try{S=dp(c.condition,e,l,o,C,h)}catch{}if(!S)continue;d=!0;const m=c.format;if(m.backgroundColor!==void 0&&r.backgroundColor===void 0&&(r.backgroundColor=m.backgroundColor),m.color!==void 0&&r.color===void 0&&(r.color=m.color),m.fontWeight!==void 0&&r.fontWeight===void 0&&(r.fontWeight=m.fontWeight),m.fontStyle!==void 0&&r.fontStyle===void 0&&(r.fontStyle=m.fontStyle),m.underline!==void 0&&r.underline===void 0&&(r.underline=m.underline),m.strikethrough!==void 0&&r.strikethrough===void 0&&(r.strikethrough=m.strikethrough),c.stopIfTrue)break}return d?r:null}function mp(){return"cf_"+Math.random().toString(36).slice(2,10)+Date.now().toString(36).slice(-4)}function Ja(){return"dv_"+Math.random().toString(36).slice(2,10)+Date.now().toString(36).slice(-4)}function pp(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 hp(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 gp(e){return e==null?!0:typeof e=="number"?!1:(typeof e=="string"?e:String(e)).trim()===""}function bp(e){return e?Array.from(e).length:0}const Qa=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/;function fl(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=Vl(n,l.locale);if(o&&Number.isFinite(o.num))return o.num;if(Qa.test(n)){const a=Number(n);return Number.isFinite(a)?a:null}return null}function Br(e,l){try{return Mo(),Ia(e,l.cells,l.colCount,l.rowCount)}catch{return null}}function xr(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"?xr(a,l):null}if(An(n)||Qa.test(n)){const a=Number(n);return Number.isFinite(a)?a:null}const o=Xn(n,l.locale);return o&&o.format!=="h:mm:ss"?o.serial:null}function Tr(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)?Vr(a):typeof a=="string"?Tr(a,l):null}const o=Xn(n,l.locale);return o?o.format==="h:mm:ss"?o.serial:Vr(o.serial):An(n)?Vr(Number(n)):null}function Vr(e){return Number.isFinite(e)?Math.abs(e)%1:0}function yp(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 Dr(e){return String(e??"").trim().toLowerCase()}function ei(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=S=>{const m=Dr(S);if(!m){if(e.allowBlank===!1||a.has("\0blank"))return;a.add("\0blank"),o.push("");return}a.has(m)||(a.add(m),o.push(S))};if(n.type==="values"){for(const S of n.values??[])i(S);return o}const{range:r,sheetId:d}=n,c=d?((h=l.getSheetCells)==null?void 0:h.call(l,d))??null:null,C=c??l.cells;for(let S=r.startRow;S<=r.endRow;S++)for(let m=r.startCol;m<=r.endCol;m++){const M=`${m},${S}`,E=C[M];if(E)if(c){const B=E.value;i(B.startsWith("=")?Cp(B,c,l):B)}else i(l.getCellValue(m,S))}return o}function Cp(e,l,n){try{Mo();const o=Ia(e.slice(1),l,n.colCount,n.rowCount);return o===null?"":String(o)}catch{return""}}function wp(e){return!!e&&e.type==="list"&&e.showDropdown!==!1&&e.enabled!==!1}function vp(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 kp(e,l,n,o,a){if(e.enabled===!1)return!0;const i=l==null?"":String(l);if(gp(i))return e.allowBlank!==!1;try{switch(e.type){case"any":return!0;case"list":{const r=ei(e,a),d=Dr(i);return r.some(c=>Dr(c)===d)}case"wholeNumber":{const r=fl(i,a);return r===null||!Number.isFinite(r)||!Number.isInteger(r)?!1:ml(e,r,a,fl)}case"decimal":{const r=fl(i,a);return r===null||!Number.isFinite(r)?!1:ml(e,r,a,fl)}case"date":{const r=xr(i,a);return r===null?!1:ml(e,r,a,xr)}case"time":{const r=Tr(i,a);return r===null?!1:ml(e,r,a,Tr)}case"textLength":{const r=bp(i);return ml(e,r,a,fl)}case"custom":{const r=(e.formula1??"").trim().replace(/^=/,"");return r?Ep(r,l,n,o,e,a):!0}default:return!0}}catch{return!1}}function ml(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 yp(a,l,i,r)}function Ep(e,l,n,o,a,i){try{const r=hp(a),d=Al(e,n-r.col,o-r.row,i.colCount,i.rowCount,pt),c=vp(i.cells,`${n},${o}`,l==null?"":String(l));return Mo(),Aa(d,c,i.colCount,i.rowCount)}catch{return!1}}const Rp={stop:3,warning:2,information:1};function Fr(e){return e.errorStyle==="warning"||e.errorStyle==="information"?e.errorStyle:"stop"}function ti(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||!pp(h.ranges,l,n))continue;let S;try{S=kp(h,e,l,n,a)}catch{S=!1}if(S)continue;const m=Rp[Fr(h)];m>r&&(r=m,i=h)}if(!i)return{valid:!0};const d=Fr(i),c=i.showErrorMessage!==!1,C=Mp(i,a.locale);return{valid:!1,rule:i,severity:d,title:c&&i.errorTitle?i.errorTitle:C.title,message:c&&i.errorMessage?i.errorMessage:C.message}}function Mp(e,l){var a;const n=g(l,"dvErrorTitleDefault"),o=e.operator?g(l,`dv${Sp(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:pl(l,g(l,"dvTypeWholeNumber"),o,e)};case"decimal":return{title:n,message:pl(l,g(l,"dvTypeDecimal"),o,e)};case"date":return{title:n,message:pl(l,g(l,"dvTypeDate"),o,e)};case"time":return{title:n,message:pl(l,g(l,"dvTypeTime"),o,e)};case"textLength":return{title:n,message:pl(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 Sp(e){return e.charAt(0).toUpperCase()+e.slice(1)}function pl(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 Ul=64;class Np{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/Ul),i=Math.floor(o.endRow/Ul);for(let r=a;r<=i;r++){let d=this.bands.get(r);d||(d=[],this.bands.set(r,d)),d.push({rule:n,range:o})}}this.dirty=!1}}getRules(l,n,o){this.ensure(o);const a=this.bands.get(Math.floor(n/Ul));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/Ul))??Bp}}const Bp=[];function xp(e,l,n,o){if(l==="row"){const c=e.startRow,C=e.endRow;let h,S;if(C<n)h=c,S=C;else if(c>n+o-1)h=c-o,S=C-o;else if(h=c<n?c:n,S=C>n+o-1?C-o:n-1,S<h)return null;return{...e,startRow:h,endRow:S}}const a=e.startCol,i=e.endCol;let r,d;if(i<n)r=a,d=i;else if(a>n+o-1)r=a-o,d=i-o;else if(r=a<n?a:n,d=i>n+o-1?i-o:n-1,d<r)return null;return{...e,startCol:r,endCol:d}}function Tp(e,l,n,o){if(l==="row"){const r=e.startRow,d=e.endRow;return r>=n?{...e,startRow:r+o,endRow:d+o}:d<n?e:{...e,endRow:d+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 ni(e,l){return!(e.endCol<l.startCol||e.startCol>l.endCol||e.endRow<l.startRow||e.startRow>l.endRow)}function oi(e,l){if(!ni(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 Vp(e,l,n){return{startCol:e.startCol+l,endCol:e.endCol+l,startRow:e.startRow+n,endRow:e.endRow+n}}function li(e,l){return ni(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 Dp=1;function Fp(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 Op(e,l,n,o){return e<=n&&o<=l||n<=e&&l<=o||l<n||o<e}function Or(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(!Op(l,n,i.start,i.end))return{ok:!1,code:"outlineCrossing"}}const o=Fp(e,l,n)+1;return o>Dp?{ok:!1,code:"outlineTooDeep"}:{ok:!0,level:o}}function ri(e,l,n,o,a,i){const r=Or(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 ai(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 ii(e,l){return e.filter(n=>n.id!==l)}function Pl(){return[]}function si(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 ci(e,l,n){const o=[];for(const a of e){const i=a.start,r=a.end;let d,c;if(r<l)d=i,c=r;else if(i>l+n-1)d=i-n,c=r-n;else if(d=i<l?i:l,c=r>l+n-1?r-n:l-1,c<d)continue;o.push({...a,start:d,end:c})}return o}function Jn(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 di(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 ui(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 Ip{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 d=l[r].styleId??0;n.add(d)}const o=new Map,a=[{}];o.set(0,0);const i=Array.from(n).sort((r,d)=>r-d);for(const r of i)if(r!==0&&r<this.styles.length){const d=a.length;o.set(r,d),a.push(this.styles[r])}for(const r in l){const d=l[r],c=d.styleId??0,C=o.get(c);C!==void 0&&C!==c&&(d.styleId=C)}this.styles=a,this.index=new Map;for(let r=0;r<this.styles.length;r++){const d=this.stableKey(this.styles[r]);this.index.set(d,r)}return a}}function Ap(e,l){if(!e)return null;const n=e.styleId;return n===void 0||n===0?null:l[n]??null}function fi(e){const l=new Ip,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 Lp(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 $p{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 d=r.borderId??0;n.add(d)}const o=new Map,a=[{}];o.set(0,0);const i=Array.from(n).sort((r,d)=>r-d);for(const r of i)if(r!==0&&r<this.borders.length){const d=a.length;o.set(r,d),a.push(this.borders[r])}for(const r of l){const d=r.borderId??0,c=o.get(d);c!==void 0&&c!==d&&(r.borderId=c)}this.borders=a,this.index=new Map;for(let r=0;r<this.borders.length;r++){const d=this.stableKey(this.borders[r]);this.index.set(d,r)}return a}}function zp(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 d=o.get(r);if(d)return d[l]}function _p(e,l,n,o,a,i){const r=o[e.styleId??0]??{},d=r.borderId??0,c=d>0?a.get(d):{},C={top:c.top?{...c.top}:void 0,right:c.right?{...c.right}:void 0,bottom:c.bottom?{...c.bottom}:void 0,left:c.left?{...c.left}:void 0};n?C[l]={...n}:C[l]=void 0;const h=a.getId(C),S={...r};h===0?delete S.borderId:S.borderId=h,delete S.borderTopWidth,delete S.borderBottomWidth,delete S.borderLeftWidth,delete S.borderRightWidth,delete S.borderColor,Object.keys(S).length===0?e.styleId=0:e.styleId=i(S)}function mi(e){const l=new $p,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 d=l.getId(r),c={...o};delete c.borderTopWidth,delete c.borderBottomWidth,delete c.borderLeftWidth,delete c.borderRightWidth,delete c.borderColor,d>0?c.borderId=d:delete c.borderId,n.push(c)}return{styles:n,borders:l.getBorders()}}function Hp(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,d=a.rowCount,c=t.reactive({colCount:r,rowCount:d}),C=8,h=32,S=t.reactive({}),m=t.reactive([{}]),M=t.reactive([{}]);let E=new Map;E.set("{}",0);let B=new Map;B.set("{}",0);const G=t.reactive([]),te=new cp,ge=t.reactive({}),fe=t.reactive([]),Ie=new Np(fe),me=new Map;let Ee=0;function Ae(s){const f=Object.keys(s).sort(),b={};for(const R of f)b[R]=s[R];return JSON.stringify(b)}function ce(s){const f=["top","right","bottom","left"],b={};for(const R of f){const I=s[R];if(I&&(I.width!==void 0||I.color!==void 0||I.style!==void 0)){const ne={};I.width!==void 0&&(ne.width=I.width),I.color!==void 0&&(ne.color=I.color),I.style!==void 0&&(ne.style=I.style),b[R]=ne}}return JSON.stringify(b)}function ae(s){if(!s||Object.keys(s).length===0)return 0;const f=Ae(s),b=E.get(f);if(b!==void 0)return b;const R=m.length;return m.push(Object.freeze({...s})),E.set(f,R),R}function qe(s){return Ap(s,m)}function ut(){E=new Map;for(let s=0;s<m.length;s++)E.set(Ae(m[s]),s)}function J(s){m.splice(0,m.length,...s),ut()}function O(s){if(!s||!s.top&&!s.right&&!s.bottom&&!s.left)return 0;const f=ce(s),b=B.get(f);if(b!==void 0)return b;const R=M.length;return M.push(Object.freeze({top:s.top?Object.freeze({...s.top}):void 0,right:s.right?Object.freeze({...s.right}):void 0,bottom:s.bottom?Object.freeze({...s.bottom}):void 0,left:s.left?Object.freeze({...s.left}):void 0})),B.set(f,R),R}function L(s){return M[s]??{}}function le(){B=new Map;for(let s=0;s<M.length;s++)B.set(ce(M[s]),s)}function $e(s){M.splice(0,M.length,...s),le()}function et(s,f){return zp(s,f,m,{get:b=>M[b]??{}})}function oe(s,f){const b=ft(s,f);return b?b.anchor:null}function xe(s,f,b,R){const I=ft(s,f),ne=ft(b,R);return!I||!ne?!1:I.anchor===ne.anchor}const se=t.reactive({}),de=new Of,we=t.ref(null),Re=t.ref("cell"),Ke=t.ref({col:0,row:0}),We=t.ref(null),rt=t.ref(""),je=t.ref(new Array(c.colCount).fill(100)),A=t.ref(new Array(c.rowCount).fill(void 0)),K=t.ref(0),$=t.ref(0),V=t.reactive({rows:0,cols:0}),x=t.ref(null),H=t.ref([]),z=t.ref([]),Y=t.shallowRef({active:!1,sourceRange:null,targetRange:null,direction:null,preview:!1}),ve=new Map;let ze=null;function it(s,f,b,R){const I=`${R} ${b} ${f}px ${s}`,ne=ve.get(I);if(ne)return ne;if(!ze){if(typeof document>"u")return{ascent:f*.88,descent:f*.28};ze=document.createElement("canvas")}const ie=ze.getContext("2d");if(!ie)return{ascent:f*.88,descent:f*.28};ie.font=I;const ye=ie.measureText(" "),ke=ye.fontBoundingBoxAscent,Ue=ye.fontBoundingBoxDescent;if(typeof ke=="number"&&typeof Ue=="number"&&ke>0&&Ue>0){const $t={ascent:ke,descent:Ue};return ve.set(I,$t),$t}const _e=["M","中","y","Ä","0"];let Xe=0,Qe=0;for(const $t of _e){const Yt=ie.measureText($t),nn=Yt.actualBoundingBoxAscent||0,un=Yt.actualBoundingBoxDescent||0;nn>Xe&&(Xe=nn),un>Qe&&(Qe=un)}const ht=Math.max(Xe,f*.88),Ct=Math.max(Qe,f*.28),qt={ascent:ht,descent:Ct};return ve.set(I,qt),qt}const Fe=it(Vo,ao,"normal","normal"),v=Fe.ascent+Fe.descent,Z=3,lt=Math.round(Z*2+v);let wt=(s,f)=>`${s},${f}`,ft=()=>null,At=()=>ao,Ft=t.computed(()=>[0]),Vt=()=>lt,wn=(s,f,b,R)=>({startCol:Math.min(s,b),startRow:Math.min(f,R),endCol:Math.max(s,b),endRow:Math.max(f,R)});function an(s,f){const b=qe(S[wt(s,f)]),R=At(s,f),I=typeof(b==null?void 0:b.fontFamily)=="string"&&b.fontFamily?b.fontFamily:Vo,ne=(b==null?void 0:b.fontWeight)==="bold"?"bold":"normal",ie=(b==null?void 0:b.fontStyle)==="italic"?"italic":"normal";return it(I,R,ne,ie)}function sn(s,f,b,R){if(!f)return[""];const I=f.split(`
2
+ `),ne=[];for(const ie of I)if(!R||b<=0)ne.push(ie);else{let ye="";for(let ke=0;ke<ie.length;ke++){const Ue=ie[ke],_e=ye+Ue;s.measureText(_e).width>b&&ye?(ne.push(ye),ye=Ue):ye=_e}ne.push(ye)}return ne}function mn(s,f){const b=qe(S[wt(s,f)]);return typeof(b==null?void 0:b.fontSize)=="number"&&b.fontSize>0?b.fontSize:ao}At=mn;const Dt=t.computed(()=>{const s=[0];for(let f=0;f<c.colCount;f++)s.push(s[f]+F(f));return s});Ft=Dt;const Jt={w:800,h:600};let Qt=()=>{};const $n=t.computed(()=>{const s=new Set;for(const f in S){const b=f.indexOf(",");if(b<0)continue;const R=parseInt(f.substring(b+1),10),I=S[f];I&&(I.value!==""||I.styleId!==void 0)&&s.add(R)}for(let f=0;f<A.value.length;f++)A.value[f]!==void 0&&s.add(f);for(const f in se){const b=f.indexOf(",");if(b<0)continue;const R=parseInt(f.substring(b+1),10);s.add(R)}return s});function Zt(s){if(Ne(s))return 0;const f=A.value[s];if(f!=null&&f>0)return f;if(!$n.value.has(s))return lt;let b,R,I=1;const ne=ze?ze.getContext("2d"):null,ie=it(Vo,ao,"normal","normal");b=ie.ascent,R=ie.descent;for(let _e=0;_e<c.colCount;_e++){const Xe=mn(_e,s),Qe=qe(S[wt(_e,s)]),ht=typeof(Qe==null?void 0:Qe.fontFamily)=="string"&&Qe.fontFamily?Qe.fontFamily:Vo,Ct=(Qe==null?void 0:Qe.fontWeight)==="bold"?"bold":"normal",qt=(Qe==null?void 0:Qe.fontStyle)==="italic"?"italic":"normal",$t=it(ht,Xe,Ct,qt);$t.ascent>b&&(b=$t.ascent),$t.descent>R&&(R=$t.descent);const Yt=typeof(Qe==null?void 0:Qe.numberFormat)=="string"?Qe.numberFormat:"",nn=Hn(_e,s),un=In(nn,Yt,i.value);if(un){const oo=(Qe==null?void 0:Qe.wrap)==="wrap";let hn;if(oo&&ne){ne.font=`${qt} ${Ct} ${Xe}px ${ht}`;const on=ft(_e,s);let Un;on&&_e===on.range.startCol&&s===on.range.startRow?Un=Ft.value[on.range.endCol+1]-Ft.value[_e]:Un=je.value[_e],hn=sn(ne,un,Math.max(0,Un-10),!0).length,hn>I&&(I=hn)}else hn=un.split(`
3
+ `).length,hn>I&&(I=hn)}}const ye=b+R,ke=Z*2+I*ye;return Math.min(500,Math.max(lt,Math.round(ke)))}Vt=Zt;function Vn(s){return A.value[s]===void 0}const U={getValue:(s,f)=>Hn(s,f),getFormat:(s,f)=>{var b;return(b=qe(S[wt(s,f)]))==null?void 0:b.numberFormat}},W=t.computed(()=>{const s=new Set,f=x.value;if(!f)return s;const{range:b}=f;for(let R=b.startRow+1;R<=b.endRow;R++)X(R)||s.add(R);return s});function X(s){return qf(x.value,s,U,i.value)}function Ce(){return W.value}function Ne(s){return tt(s)?!0:x.value?W.value.has(s):!1}function Ve(){let s=0;for(let f=0;f<c.rowCount;f++)Ne(f)||s++;return s}function He(s){let f=-1;for(let b=0;b<c.rowCount;b++)if(!Ne(b)&&(f++,f===s))return b;return-1}function Me(s){if(Ne(s))return-1;let f=0;for(let b=0;b<s;b++)Ne(b)||f++;return f}const Le=t.computed(()=>{const s=new Set,f=H.value;for(let b=0;b<f.length;b++){const R=f[b];if(R.collapsed)for(let I=Math.max(0,R.start);I<=R.end&&I<c.rowCount;I++)s.add(I)}return s}),be=t.computed(()=>{const s=new Set,f=z.value;for(let b=0;b<f.length;b++){const R=f[b];if(R.collapsed)for(let I=Math.max(0,R.start);I<=R.end&&I<c.colCount;I++)s.add(I)}return s});function tt(s){return Le.value.has(s)}function k(s){return be.value.has(s)}function q(s){return tt(s)}function re(s){return k(s)}function Se(s){return!Ne(s)}function Te(s){return!k(s)}function pe(s){return k(s)}function F(s){return pe(s)?0:je.value[s]??100}function p(s){return di(H.value,s)}function N(s){return di(z.value,s)}function bt(s){const f=s==="row"?H.value:z.value;let b=0;for(let R=0;R<f.length;R++){const I=f[R].level;I>b&&(b=I)}return b}function vt(s){return 0}const Kt=()=>vt(),Nt=()=>vt();function fo(){return H.value.map(s=>({...s}))}function mo(){return z.value.map(s=>({...s}))}function Xt(s=!1){var f,b;s||(Qt(K.value,$.value),(f=w.scheduleRender)==null||f.call(w),(b=w.emitModelData)==null||b.call(w))}function Gl(s,f){var R;const b=Or(H.value,s,f);return!b.ok||b.level===void 0?b:((R=w.saveUndo)==null||R.call(w),H.value=Jn(ri(H.value,"row",s,f,ui(H.value,"row")).outlines),Xt(),{ok:!0,level:b.level})}function Qn(s,f){var R;const b=Or(z.value,s,f);return!b.ok||b.level===void 0?b:((R=w.saveUndo)==null||R.call(w),z.value=Jn(ri(z.value,"column",s,f,ui(z.value,"column")).outlines),Xt(),{ok:!0,level:b.level})}function Io(s){var R;const f=H.value.some(I=>I.id===s),b=!f&&z.value.some(I=>I.id===s);return!f&&!b?!1:((R=w.saveUndo)==null||R.call(w),f?H.value=Jn(ii(H.value,s)):z.value=Jn(ii(z.value,s)),Xt(),!0)}function Ao(){var s;H.value.length&&((s=w.saveUndo)==null||s.call(w),H.value=Pl(),Xt())}function ql(){var s;z.value.length&&((s=w.saveUndo)==null||s.call(w),z.value=Pl(),Xt())}function bl(){var s;!H.value.length&&!z.value.length||((s=w.saveUndo)==null||s.call(w),H.value=Pl(),z.value=Pl(),Xt())}function Yl(s,f,b=!1){var ne;const R=ai(H.value,s,f),I=ai(z.value,s,f);R===H.value&&I===z.value||(b||(ne=w.saveUndo)==null||ne.call(w),H.value=R,z.value=I,Xt(b))}function $r(s){const f=H.value.find(b=>b.id===s)??z.value.find(b=>b.id===s);f&&Yl(s,!f.collapsed)}function zr(s,f){H.value.length&&(H.value=Jn(si(H.value,s,f)),Xt())}function jl(s,f){H.value.length&&(H.value=Jn(ci(H.value,s,f)),Xt())}function jo(s,f){z.value.length&&(z.value=Jn(si(z.value,s,f)),Xt())}function _r(s,f){z.value.length&&(z.value=Jn(ci(z.value,s,f)),Xt())}function yl(s,f){s&&(H.value=Jn([...s])),f&&(z.value=Jn([...f])),Xt(!0)}function Cl(){return x.value}function wl(s,f=!1){var b,R;x.value=s,!f&&(Qt(K.value,$.value),(b=w.scheduleRender)==null||b.call(w),(R=w.emitModelData)==null||R.call(w))}function Xo(s){var b,R;const f={range:{startCol:Math.min(s.startCol,s.endCol),endCol:Math.max(s.startCol,s.endCol),startRow:Math.min(s.startRow,s.endRow),endRow:Math.max(s.startRow,s.endRow)},columns:{}};x.value=f,Qt(K.value,$.value),(b=w.scheduleRender)==null||b.call(w),(R=w.emitModelData)==null||R.call(w)}function Xl(){var s,f;x.value&&(x.value=null,Qt(K.value,$.value),(s=w.scheduleRender)==null||s.call(w),(f=w.emitModelData)==null||f.call(w))}function Hr(s){var R,I;if(!x.value)return;const{[s]:f,...b}=x.value.columns;x.value={...x.value,columns:b},(R=w.scheduleRender)==null||R.call(w),(I=w.emitModelData)==null||I.call(w)}function Lo(s,f){var b,R;if(x.value){if(f)x.value={...x.value,columns:{...x.value.columns,[s]:f}};else{const{[s]:I,...ne}=x.value.columns;x.value={...x.value,columns:ne}}(b=w.scheduleRender)==null||b.call(w),(R=w.emitModelData)==null||R.call(w)}}function $o(s){const f=x.value;return f?Yf(f,s,U,i.value):{values:[],hasBlank:!1}}function Zo(s,f){const b=c.colCount,R=c.rowCount,I=(Xe,Qe)=>{const ht=S[eo(Xe,Qe)];return!!ht&&(ht.value!==""||ht.styleId!==void 0)};if(!I(s,f))return null;const ne=Xe=>{for(let Qe=0;Qe<b;Qe++)if(I(Qe,Xe))return!0;return!1},ie=(Xe,Qe,ht)=>{for(let Ct=Qe;Ct<=ht;Ct++)if(I(Xe,Ct))return!0;return!1};let ye=f;for(;ye>0&&ne(ye-1);)ye--;let ke=f;for(;ke<R-1&&ne(ke+1);)ke++;let Ue=s;for(;Ue>0&&ie(Ue-1,ye,ke);)Ue--;let _e=s;for(;_e<b-1&&ie(_e+1,ye,ke);)_e++;return{startCol:Ue,startRow:ye,endCol:_e,endRow:ke}}function Jo(){const s=we.value;if(!!s&&s.startRow!==s.endRow)return{startCol:Math.min(s.startCol,s.endCol),endCol:Math.max(s.startCol,s.endCol),startRow:Math.min(s.startRow,s.endRow),endRow:Math.max(s.startRow,s.endRow)};const b=Ke.value,R=s?s.startCol:b.col,I=s?s.startRow:b.row,ne=(Ue,_e)=>{const Xe=S[eo(Ue,_e)];return!!Xe&&(Xe.value!==""||Xe.styleId!==void 0)};let ie,ye;s?(ie=Math.min(s.startCol,s.endCol),ye=Math.max(s.startCol,s.endCol)):(ie=b.col,ye=b.col);let ke=I;for(;ke<c.rowCount-1;){const Ue=ke+1;let _e=!1,Xe=!1;for(let Qe=ie;Qe<=ye;Qe++){ne(Qe,Ue)&&(_e=!0);const ht=zn(Qe,Ue);ht&&(ht.range.startCol!==ht.range.endCol||ht.range.startRow!==ht.range.endRow)&&(Xe=!0)}if(Xe||!_e)break;ke++}return!ne(R,I)&&ke===I?Zl():{startCol:ie,endCol:ye,startRow:I,endRow:ke}}function Qo(){if(x.value){Xl();return}const s=Jo();s&&Xo(s)}function vl(s){const f=x.value;return f?s>=f.range.startCol&&s<=f.range.endCol:!1}function po(){return x.value?{...x.value.range}:null}function el(){return!!x.value}function tl(s){const f=x.value;return f?$a(f.columns[s]):!1}function Zl(){let s=1/0,f=1/0,b=-1,R=-1;for(const I in S){const ne=I.indexOf(",");if(ne<0)continue;const ie=parseInt(I.substring(0,ne),10),ye=parseInt(I.substring(ne+1),10),ke=S[I];ke&&(ke.value!==""||ke.styleId!==void 0)&&(ie<s&&(s=ie),ye<f&&(f=ye),ie>b&&(b=ie),ye>R&&(R=ye))}return b<0?null:{startCol:s,startRow:f,endCol:b,endRow:R}}const ho=t.computed(()=>{const s=[0];for(let f=0;f<c.rowCount;f++)s.push(s[f]+Vt(f));return s}),nl=t.computed(()=>Dt.value[c.colCount]),ol=t.computed(()=>ho.value[c.rowCount]);function eo(s,f){return`${s},${f}`}wt=eo;function ll(s){Reflect.deleteProperty(S,s)}function go(s,f){Re.value="cell";const b=ft(s,f);b?(Ke.value={col:b.range.startCol,row:b.range.startRow},we.value={...b.range}):(Ke.value={col:s,row:f},we.value={startCol:s,startRow:f,endCol:s,endRow:f})}function cn(s,f,b,R,I="cell"){const ne=ft(s,f);if(Ke.value=ne?{col:ne.range.startCol,row:ne.range.startRow}:{col:s,row:f},Re.value=I,I==="row"||I==="col"){const ie=Math.min(s,b),ye=Math.max(s,b),ke=Math.min(f,R),Ue=Math.max(f,R);we.value={startCol:ie,startRow:ke,endCol:ye,endRow:Ue}}else we.value=wn(s,f,b,R)}function vn(){cn(0,0,c.colCount-1,c.rowCount-1,"all")}function kn(s,f){const b=we.value;return b?(Re.value==="cell"||Re.value==="all",s>=b.startCol&&s<=b.endCol&&f>=b.startRow&&f<=b.endRow):!1}function Dn(s,f){return kn(s,f)}function zn(s,f){for(const b in se){const R=se[b];if(R&&s>=R.startCol&&s<=R.endCol&&f>=R.startRow&&f<=R.endRow)return{range:R,anchor:b}}return null}ft=zn;function No(s,f){return se[eo(s,f)]!==void 0}function to(s,f){const b=ft(s,f);if(b&&s===b.range.startCol&&f===b.range.startRow){const R=Dt.value[b.range.endCol+1]-Dt.value[s],I=ho.value[b.range.endRow+1]-ho.value[f];return{w:R,h:I}}return{w:F(s),h:Vt(f)}}function _n(s,f,b,R){let I=Math.min(s,b),ne=Math.max(s,b),ie=Math.min(f,R),ye=Math.max(f,R),ke=!0;for(;ke;){ke=!1;for(const Ue in se){const _e=se[Ue];if(!_e)continue;_e.startCol<=ne&&_e.endCol>=I&&_e.startRow<=ye&&_e.endRow>=ie&&(_e.startCol<I&&(I=_e.startCol,ke=!0),_e.endCol>ne&&(ne=_e.endCol,ke=!0),_e.startRow<ie&&(ie=_e.startRow,ke=!0),_e.endRow>ye&&(ye=_e.endRow,ke=!0))}}return{startCol:I,startRow:ie,endCol:ne,endRow:ye}}wn=_n;function Bo(s,f){var b;return((b=S[eo(s,f)])==null?void 0:b.value)??""}function Hn(s,f){return Mo(),Oa(s,f,S,c.colCount,c.rowCount)}function zo(s,f,b){var ke,Ue,_e;s>=0&&f>=0&&T(s,f);const R=eo(s,f);Mo(),te.invalidate(),fe.length>0&&Lt();const I=(ke=S[R])==null?void 0:ke.noteId;if(b===""||b==null){de.clear(R);const Xe=(Ue=S[R])==null?void 0:Ue.styleId;Xe!==void 0&&Xe>0?S[R]={value:"",styleId:Xe}:ll(R),de.markDirty(R);return}const ne=String(b);if(!ne.startsWith("=")){const Xe=qe(S[R]),Qe=typeof(Xe==null?void 0:Xe.numberFormat)=="string"?Xe.numberFormat:"";if(xn(Qe)){const ht=Xn(ne,i.value);if(ht){const qt={...Xe??{},numberFormat:ht.format};S[R]={value:String(ht.serial),styleId:ae(qt),noteId:I},de.clear(R),de.markDirty(R);return}const Ct=Vl(ne,i.value);if(Ct){const qt={...Xe??{},numberFormat:Ct.format};S[R]={value:String(Ct.num),styleId:ae(qt),noteId:I},de.clear(R),de.markDirty(R);return}}}const ie=(_e=S[R])==null?void 0:_e.styleId,ye={value:ne};ie!==void 0&&ie>0&&(ye.styleId=ie),I&&(ye.noteId=I),S[R]=ye,ne.startsWith("=")?de.set(R,Il(ne.slice(1),c.colCount,c.rowCount)):de.clear(R),de.markDirty(R)}function rl(s,f,b,R){for(let I=s;I<=f;I++)for(let ne=b;ne<=R;ne++){const ie=eo(I,ne);de.clear(ie),ll(ie),de.markDirty(ie)}te.invalidate(),fe.length>0&&Lt(),Wl(S,ge)}function dn(){return{cells:S,colCount:c.colCount,rowCount:c.rowCount,locale:i.value,getCellValue:(s,f)=>Hn(s,f)}}function bo(s,f){return G.length===0?null:fp(s,f,G,dn(),te)}function Bt(s){var b,R,I;(b=w.saveUndo)==null||b.call(w);const f={id:s.id||mp(),condition:s.condition,format:s.format,ranges:s.ranges,priority:s.priority,stopIfTrue:s.stopIfTrue,enabled:s.enabled!==!1};G.push(f),te.invalidate(),(R=w.scheduleRender)==null||R.call(w),(I=w.emitModelData)==null||I.call(w)}function xt(s,f){var R,I,ne;(R=w.saveUndo)==null||R.call(w);const b=G.findIndex(ie=>ie.id===s);b<0||(G[b]={...G[b],...f,id:s},te.invalidate(),(I=w.scheduleRender)==null||I.call(w),(ne=w.emitModelData)==null||ne.call(w))}function en(s){var b,R,I;(b=w.saveUndo)==null||b.call(w);const f=G.findIndex(ne=>ne.id===s);f<0||(G.splice(f,1),te.invalidate(),(R=w.scheduleRender)==null||R.call(w),(I=w.emitModelData)==null||I.call(w))}function kl(s,f){var ke,Ue,_e;(ke=w.saveUndo)==null||ke.call(w);const b=[...G].sort((Xe,Qe)=>Xe.priority-Qe.priority),R=b.findIndex(Xe=>Xe.id===s);if(R<0)return;const I=f==="up"?R-1:R+1;if(I<0||I>=b.length)return;const ne=b[R],ie=b[I],ye=ne.priority;ne.priority=ie.priority,ie.priority=ye,te.invalidate(),(Ue=w.scheduleRender)==null||Ue.call(w),(_e=w.emitModelData)==null||_e.call(w)}function Jl(){te.invalidate()}function Ql(s){var f,b,R;if((f=w.saveUndo)==null||f.call(w),s==="sheet")G.splice(0,G.length);else{const I=w.selection.value;if(!I)return;for(let ne=G.length-1;ne>=0;ne--){const ie=G[ne];ie.ranges=ie.ranges.filter(ye=>!(ye.startCol<=I.endCol&&ye.endCol>=I.startCol&&ye.startRow<=I.endRow&&ye.endRow>=I.startRow)),ie.ranges.length===0&&G.splice(ne,1)}}te.invalidate(),(b=w.scheduleRender)==null||b.call(w),(R=w.emitModelData)==null||R.call(w)}function Lt(){Ie.invalidate(),me.clear()}function Fn(){return{cells:S,colCount:c.colCount,rowCount:c.rowCount,locale:i.value,getCellValue:(s,f)=>Hn(s,f),getSheetCells:s=>w.getSheetCellsById?w.getSheetCellsById(s):null}}function tn(s,f){const b=ft(f,s),R=b?{col:b.range.startCol,row:b.range.startRow}:{col:f,row:s};return Ie.getRules(R.col,R.row,fe)}function Wn(s,f){const b=tn(s,f);return b.length?b[0]:null}function yo(s,f){return tn(s,f).length>0}function En(s,f){const b=ft(f,s),R=b?{col:b.range.startCol,row:b.range.startRow}:{col:f,row:s};return Ie.findRule(R.col,R.row,wp,fe)}function xo(s){const f=s.listSource,b=f&&f.type==="range"?`range:${f.sheetId??""}:${f.range.startCol},${f.range.startRow},${f.range.endCol},${f.range.endRow}`:`values:${(f&&f.type==="values"?f.values:s.values??[]).join("")}`,R=me.get(b);if(R)return R;const I=ei(s,Fn());return me.set(b,I),I}function er(s,f){const b=En(s,f);return b?{rule:b,items:xo(b)}:null}function tr(s,f){for(const b of tn(s,f)){if(b.enabled===!1||!b.showInputMessage)continue;const R=b.inputTitle??"",I=b.inputMessage??"";if(!(!R&&!I))return{title:R,message:I}}return null}function al(s,f,b){const R=tn(s,f);return R.length===0?{valid:!0}:ti(b,f,s,R,Fn())}function nr(s){const f=Fn(),b={stop:3,warning:2,information:1};let R=null,I=0;for(const ne of s){const ie=tn(ne.row,ne.col);if(ie.length===0)continue;const ye=ti(ne.value,ne.col,ne.row,ie,f);if(ye.valid)continue;const ke=b[Fr(ye.rule)]??0;ke>I&&(I=ke,R=ye)}return R??{valid:!0}}function or(s,f){return Za(s,f,S)}function El(s,f){return ep(s,f,S,ge)}function lr(s,f,b,R,I){var ie,ye,ke;I!=null&&I.silent||(ie=w.saveUndo)==null||ie.call(w);const ne=np(s,f,b,R,S,ge);return Wl(S,ge),(ye=w.scheduleRender)==null||ye.call(w),(ke=w.emitModelData)==null||ke.call(w),ne}function rr(s,f){var b,R,I;ge[s]&&((b=w.saveUndo)==null||b.call(w),op(s,f,ge),(R=w.scheduleRender)==null||R.call(w),(I=w.emitModelData)==null||I.call(w))}function Wr(s,f){var b,R,I;Za(s,f,S)&&((b=w.saveUndo)==null||b.call(w),lp(s,f,S,ge),Wl(S,ge),(R=w.scheduleRender)==null||R.call(w),(I=w.emitModelData)==null||I.call(w))}function Ur(){Wl(S,ge)}function Pr(s){return rp(s,S,ge)}function ar(s,f){var R,I,ne;f!=null&&f.silent||(R=w.saveUndo)==null||R.call(w);const b={...s,id:s.id||Ja(),ranges:(s.ranges??[]).map(ie=>({...ie})),enabled:s.enabled!==!1};return fe.push(b),Lt(),f!=null&&f.silent||((I=w.scheduleRender)==null||I.call(w),(ne=w.emitModelData)==null||ne.call(w)),b}function Kr(s,f,b){var I,ne,ie;const R=fe.findIndex(ye=>ye.id===s);if(R<0){ar({id:s,...f},b);return}b!=null&&b.silent||(I=w.saveUndo)==null||I.call(w),fe[R]={...fe[R],...f,id:s},Lt(),b!=null&&b.silent||((ne=w.scheduleRender)==null||ne.call(w),(ie=w.emitModelData)==null||ie.call(w))}function Gr(s,f){var R,I,ne;const b=fe.findIndex(ie=>ie.id===s);b<0||(f!=null&&f.silent||(R=w.saveUndo)==null||R.call(w),fe.splice(b,1),Lt(),f!=null&&f.silent||((I=w.scheduleRender)==null||I.call(w),(ne=w.emitModelData)==null||ne.call(w)))}function qr(s,f){var I,ne,ie,ye,ke,Ue;if(!s){if(fe.length===0)return;f!=null&&f.silent||(I=w.saveUndo)==null||I.call(w),fe.splice(0,fe.length),Lt(),f!=null&&f.silent||((ne=w.scheduleRender)==null||ne.call(w),(ie=w.emitModelData)==null||ie.call(w));return}const b={startCol:Math.min(s.startCol,s.endCol),endCol:Math.max(s.startCol,s.endCol),startRow:Math.min(s.startRow,s.endRow),endRow:Math.max(s.startRow,s.endRow)};if(fe.filter(_e=>(_e.ranges??[]).some(Xe=>!(Xe.endCol<b.startCol||Xe.startCol>b.endCol||Xe.endRow<b.startRow||Xe.startRow>b.endRow))).length!==0){f!=null&&f.silent||(ye=w.saveUndo)==null||ye.call(w);for(let _e=fe.length-1;_e>=0;_e--){const Xe=fe[_e],Qe=[];for(const ht of Xe.ranges??[])Qe.push(...oi(ht,b));Qe.length===0?fe.splice(_e,1):Xe.ranges=Qe}Lt(),f!=null&&f.silent||((ke=w.scheduleRender)==null||ke.call(w),(Ue=w.emitModelData)==null||Ue.call(w))}}function Yr(s){const f=[];for(const b of fe)for(const R of b.ranges??[]){const I=li(R,s);I&&f.push({rule:b,range:I})}return f}function jr(s,f,b){var R,I,ne;if(s.length){b!=null&&b.silent||(R=w.saveUndo)==null||R.call(w);for(let ie=fe.length-1;ie>=0;ie--){const ye=fe[ie],ke=[];for(const Ue of ye.ranges??[])ke.push(...oi(Ue,f));ke.length===0?fe.splice(ie,1):ye.ranges=ke}for(const ie of s){const ye=[];for(const ke of ie.ranges??[]){const Ue=li(ke,f);Ue&&ye.push(Ue)}ye.length&&fe.push({...ie,id:Ja(),ranges:ye})}Lt(),b!=null&&b.silent||((I=w.scheduleRender)==null||I.call(w),(ne=w.emitModelData)==null||ne.call(w))}}async function Rl(s,f,b){const R=s.severity??"stop";if(!(!s.rule||s.rule.showErrorMessage!==!1))return R==="stop"?"cancel":"continue";const ne=w.showValidationAlert;if(!ne)return R==="stop"?"cancel":"continue";Ee++;try{return await ne({severity:R,title:s.title??"",message:s.message??"",col:f,row:b})}catch{return"cancel"}finally{Ee=Math.max(0,Ee-1)}}function Ml(){return Ee>0}let Sl=()=>{};function ir(s){We.value||(We.value={...Ke.value},s!==void 0?rt.value=s:rt.value||(rt.value=Bo(Ke.value.col,Ke.value.row)))}async function Nl(){const s=We.value;if(!s)return!1;const f=s.col,b=s.row,R=rt.value,I=al(b,f,R);return!I.valid&&await Rl(I,f,b)!=="continue"?!1:(Sl(),zo(f,b,R),We.value=null,rt.value="",!0)}function Bl(){We.value=null,rt.value=""}function Xr(s,f){const b=Ke.value;let R=Math.max(0,b.col+s),I=Math.max(0,b.row+f);(R>=c.colCount||I>=c.rowCount)&&T(R,I);const ne=ft(b.col,b.row),ie=ft(R,I);ne&&ie&&ne.anchor===ie.anchor&&(s>0?R=ne.range.endCol+1:s<0&&(R=ne.range.startCol-1),f>0?I=ne.range.endRow+1:f<0&&(I=ne.range.startRow-1),(R>=c.colCount||I>=c.rowCount)&&T(R,I)),R=Math.max(0,Math.min(c.colCount-1,R)),I=Math.max(0,Math.min(c.rowCount-1,I)),go(R,I)}function Zr(s,f){j(f,s)}function sr(s){const f=Dt.value;if(s<0||s>=f[c.colCount])return-1;let b=0,R=c.colCount-1;for(;b<R;){const I=b+R+1>>1;f[I]<=s?b=I:R=I-1}return b}function cr(s){const f=ho.value;if(s<0||s>=f[c.rowCount])return-1;let b=0,R=c.rowCount-1;for(;b<R;){const I=b+R+1>>1;f[I]<=s?b=I:R=I-1}return b}function Jr(s,f){var I,ne;const b=Math.max(0,Math.min(Math.floor(s),c.rowCount)),R=Math.max(0,Math.min(Math.floor(f),c.colCount));V.rows=b,V.cols=R,(I=w.scheduleRender)==null||I.call(w),(ne=w.emitModelData)==null||ne.call(w)}function Qr(){var s,f;V.rows=0,V.cols=0,(s=w.scheduleRender)==null||s.call(w),(f=w.emitModelData)==null||f.call(w)}function pn(){return{rows:V.rows,cols:V.cols}}function no(){let s=0,f=0;if(V.cols>0){const b=je.value,R=Math.min(V.cols,b.length);for(let I=0;I<R;I++)s+=b[I]}if(V.rows>0)for(let b=0;b<V.rows;b++)f+=Vt(b);return{frozenRowsHeight:f,frozenColumnsWidth:s}}function ea(){const{frozenColumnsWidth:s,frozenRowsHeight:f}=no(),b=Kt(),R=Nt(),I=52+b+s,ne=24+R+f,ie=Math.max(0,Jt.w-52-b-11-s),ye=Math.max(0,Jt.h-24-R-11-f),ke=[];return f>0&&s>0&&ke.push({kind:"corner",x:52+b,y:24+R,width:s,height:f,scrollLeft:0,scrollTop:0}),f>0&&ke.push({kind:"rows",x:I,y:24+R,width:ie,height:f,scrollLeft:K.value,scrollTop:0}),s>0&&ke.push({kind:"columns",x:52+b,y:ne,width:s,height:ye,scrollLeft:0,scrollTop:$.value}),ke.push({kind:"body",x:I,y:ne,width:ie,height:ye,scrollLeft:K.value,scrollTop:$.value}),ke}function u(s,f){const b=Dt.value,R=ho.value,I=b[f]??0,ne=R[s]??0,ie=ft(f,s),ye=ie?(b[ie.range.endCol+1]??I)-I:(b[f+1]??I)-I,ke=ie?(R[ie.range.endRow+1]??ne)-ne:Vt(s),Ue=f<V.cols,_e=s<V.rows,Xe=(Ue?0:-K.value)+52+Kt()+I,Qe=(_e?0:-$.value)+24+Nt()+ne;return{x:Xe,y:Qe,width:ye,height:ke}}function y(s,f){const{frozenColumnsWidth:b,frozenRowsHeight:R}=no(),I=Kt(),ne=Nt();if(s<52+I||f<24+ne)return null;const ie=b>0&&s<52+I+b,ye=R>0&&f<24+ne+R,ke=ie?s-52-I:s-52-I+K.value,Ue=ye?f-24-ne:f-24-ne+$.value,_e=sr(ke),Xe=cr(Ue);return _e<0||Xe<0?null:{col:_e,row:Xe}}function D(s,f){return s<V.rows||f<V.cols}function j(s,f){if(D(s,f))return;const{frozenColumnsWidth:b,frozenRowsHeight:R}=no(),I=Math.max(0,Jt.w-52-Kt()-11-b),ne=Math.max(0,Jt.h-24-Nt()-11-R),ie=Dt.value,ye=ho.value,ke=(ie[f]??0)-b,Ue=(ye[s]??0)-R,_e=ft(f,s),Xe=_e?(ie[_e.range.endCol+1]??0)-(ie[f]??0):je.value[f]??0,Qe=_e?(ye[_e.range.endRow+1]??0)-(ye[s]??0):Vt(s);let ht=K.value,Ct=$.value;ke<ht?ht=ke:ke+Xe>ht+I&&(ht=ke+Xe-I),Ue<Ct?Ct=Ue:Ue+Qe>Ct+ne&&(Ct=Ue+Qe-ne),ht=Math.max(0,ht),Ct=Math.max(0,Ct),Qt(ht,Ct)}function T(s,f){var ne;const b=s+1,R=f+1;let I=!1;if(b>=c.colCount){const ie=Math.max(c.colCount+C,b),ye=ie-c.colCount,ke=je.value;for(let Ue=0;Ue<ye;Ue++)ke.push(100);c.colCount=ie,I=!0}if(R>=c.rowCount){const ie=Math.max(c.rowCount+h,R),ye=ie-c.rowCount,ke=A.value;for(let Ue=0;Ue<ye;Ue++)ke.push(void 0);c.rowCount=ie,I=!0}I&&((ne=w.scheduleRender)==null||ne.call(w))}function P(){return c.colCount!==r||c.rowCount!==d}function ee(s,f,b){const R=Nr(s,f,se);if(!R.ok){R.reason==="target-merge-size"&&window.alert(g(i.value,"autofillMergeSizeError"));return}const I=ja(s,f,{cells:S},b,i.value,c.colCount,c.rowCount,pt),ne=Object.entries(I.cells).map(([ye,ke])=>{const Ue=ye.indexOf(",");return{col:parseInt(ye.substring(0,Ue),10),row:parseInt(ye.substring(Ue+1),10),value:ke?ke.value:""}}),ie=nr(ne);if(!ie.valid){(async()=>await Rl(ie,f.startCol,f.startRow)==="continue"&&Q(s,f,b))();return}Q(s,f,b)}function Q(s,f,b){var ne,ie,ye;(ne=w.saveUndo)==null||ne.call(w),T(f.endCol,f.endRow);const R=ja(s,f,{cells:S},b,i.value,c.colCount,c.rowCount,pt);Mo();for(const[ke,Ue]of Object.entries(R.cells)){const _e=ke.indexOf(","),Xe=parseInt(ke.substring(0,_e),10),Qe=parseInt(ke.substring(_e+1),10),ht=zn(Xe,Qe);if(ht&&!(Xe===ht.range.startCol&&Qe===ht.range.startRow))continue;const Ct=Ue.value;Ct===""&&(Ue.styleId===void 0||Ue.styleId===0)?(de.clear(ke),ll(ke)):(S[ke]={value:Ct,...Ue.styleId!==void 0&&Ue.styleId>0?{styleId:Ue.styleId}:{}},Ct.startsWith("=")?de.set(ke,Il(Ct.slice(1),c.colCount,c.rowCount)):de.clear(ke)),de.markDirty(ke)}const I={startCol:Math.min(s.startCol,f.startCol),startRow:Math.min(s.startRow,f.startRow),endCol:Math.max(s.endCol,f.endCol),endRow:Math.max(s.endRow,f.endRow)};cn(I.startCol,I.startRow,I.endCol,I.endRow),(ie=w.scheduleRender)==null||ie.call(w),(ye=w.emitModelData)==null||ye.call(w)}function ue(s,f){var ne;let b=!1;const R=Math.max(1,Math.floor(s)),I=Math.max(1,Math.floor(f));if(R!==c.colCount){if(R>c.colCount){const ie=je.value;for(let ye=c.colCount;ye<R;ye++)ie.push(100)}else je.value=je.value.slice(0,R);c.colCount=R,b=!0}if(I!==c.rowCount){if(I>c.rowCount){const ie=A.value;for(let ye=c.rowCount;ye<I;ye++)ie.push(void 0)}else A.value=A.value.slice(0,I);c.rowCount=I,b=!0}b&&((ne=w.scheduleRender)==null||ne.call(w))}const w={props:a,locale:i,get colCount(){return c.colCount},get rowCount(){return c.rowCount},ensureCapacity:T,hasDynamicDims:P,setDims:ue,cells:S,styles:m,borders:M,merges:se,formulaDeps:de,selection:we,activeCell:Ke,editingCell:We,editValue:rt,colWidths:je,rowHeights:A,scrollX:K,scrollY:$,freeze:V,setFreeze:Jr,clearFreeze:Qr,getFreeze:pn,getFrozenMetrics:no,filter:x,getFilter:Cl,setFilter:wl,enableFilter:Xo,clearFilter:Xl,clearFilterColumn:Hr,setFilterColumn:Lo,getColumnCandidates:$o,getDataRange:Zl,getCurrentRegion:Zo,detectFilterRange:Jo,toggleAutoFilter:Qo,isColumnInFilterRange:vl,getFilterRange:po,isFilterEnabled:el,isFilterColumnActive:tl,isRowHidden:Ne,getFilteredOutRows:Ce,getVisibleRowCount:Ve,getVisibleRowAt:He,getVisibleRowIndex:Me,getViewportRegions:ea,cellToScreenRect:u,screenToCell:y,isCellFrozen:D,scrollCellIntoView:j,BASE_CELL_VPAD:Z,AUTO_ROW_BASE:lt,fontMetricsCache:ve,fontMetricsCanvas:ze,measureFontMetrics:it,_getFontMetricsForCell:an,getWrappedLines:sn,cellFontSize:mn,colPositions:Dt,getRowHeight:Zt,_isAutoRow:Vn,rowPositions:ho,totalWidth:nl,totalHeight:ol,selectCell:go,selectRange:cn,selectAll:vn,isSelected:kn,isCellSelected:Dn,selectionMode:Re,cellKey:eo,delCell:ll,findMerge:zn,_isMergeAnchor:No,_mergedSpan:to,expandSelectionForMerges:_n,getCellRaw:Bo,getCellValue:Hn,setCellValue:zo,clearCellsInRange:rl,startEdit:ir,commitEdit:Nl,cancelEdit:Bl,moveActive:Xr,ensureVisible:Zr,hitCol:sr,hitRow:cr,registerStyle:ae,resolveStyle:qe,rebuildStyleIndex:ut,syncStyles:J,registerBorder:O,resolveBorder:L,rebuildBorderIndex:le,syncBorders:$e,getCellBorderSide:et,getMergeOwner:oe,isSameMergeInternal:xe,getRowOutlines:fo,getColumnOutlines:mo,addRowGroup:Gl,addColumnGroup:Qn,removeOutline:Io,clearRowGroups:Ao,clearColumnGroups:ql,clearAllOutlines:bl,setOutlineCollapsed:Yl,toggleOutline:$r,getOutlineLevel:bt,getOutlineGutterSize:vt,getRowOutlineLevel:p,getColumnOutlineLevel:N,isRowCollapsed:q,isColumnCollapsed:re,isRowVisible:Se,isColumnVisible:Te,isColHidden:pe,getColWidth:F,adjustOutlinesForInsertRows:zr,adjustOutlinesForDeleteRows:jl,adjustOutlinesForInsertCols:jo,adjustOutlinesForDeleteCols:_r,syncOutlines:yl,viewSize:Jt,findHighlight:(s,f)=>null,autoFillState:Y,applyAutoFill:ee,conditionalFormats:G,resolveConditionalFormat:bo,addConditionalFormatRule:Bt,updateConditionalFormatRule:xt,removeConditionalFormatRule:en,moveConditionalFormatRule:kl,clearConditionalFormats:Ql,invalidateConditionalFormatCache:Jl,dataValidations:fe,getDataValidationRules:tn,getDataValidationRule:Wn,hasDataValidation:yo,getListValidation:En,getValidationDropdown:er,getValidationInputMessage:tr,validateCell:al,validateCells:nr,createDataValidation:ar,updateDataValidation:Kr,removeDataValidation:Gr,clearDataValidation:qr,getDataValidationsInRange:Yr,applyDataValidationsToRange:jr,invalidateDataValidationCache:Lt,isValidationAlertOpen:Ml,confirmInvalidValue:Rl,notes:ge,hasNote:or,getNote:El,setCellNote:lr,updateCellNote:rr,deleteCellNote:Wr,gcNotes:Ur,getNotesInRange:Pr};return Sl=()=>{var s;return(s=w.saveUndo)==null?void 0:s.call(w)},Qt=(s,f)=>{var b;return(b=w.clampScroll)==null?void 0:b.call(w,s,f)},w}function Wp(e,l){const n=t.ref([]),o=t.ref([]);function a(k){return Lp(k)}function i(){return l.saveSheet(),{sheets:l.sheets.value.map(k=>({id:k.id,name:k.name,cells:a(k.cells),styles:[...k.styles],borders:k.borders?[...k.borders]:[{}],merges:k.merges?{...k.merges}:{},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:k.filter?JSON.parse(JSON.stringify(k.filter)):null,conditionalFormats:k.conditionalFormats?k.conditionalFormats.map(q=>({...q,ranges:q.ranges.map(re=>({...re}))})):[],dataValidations:k.dataValidations?k.dataValidations.map(q=>({...q,ranges:(q.ranges??[]).map(re=>({...re}))})):[],rowOutlines:k.rowOutlines?k.rowOutlines.map(q=>({...q})):[],columnOutlines:k.columnOutlines?k.columnOutlines.map(q=>({...q})):[],notes:k.notes?Object.fromEntries(Object.entries(k.notes).map(([q,re])=>[q,{...re}])):{}})),styles:[...e.styles],activeSheetIndex:l.activeSheetIndex.value}}function r(k){const q=l.sheets.value;l.sheets.value=k.sheets.map((re,Se)=>{var pe;const Te=((pe=q[Se])==null?void 0:pe.freeze)??{rows:0,cols:0};return{...re,cells:a(re.cells),styles:[...re.styles],borders:re.borders?[...re.borders]:[{}],freeze:{rows:Te.rows,cols:Te.cols}}}),l.loadSheet(Math.max(0,Math.min(k.activeSheetIndex,l.sheets.value.length-1))),e.formulaDeps.rebuild(e.cells,e.colCount,e.rowCount)}function d(){const k=i(),q=n.value[n.value.length-1];q&&JSON.stringify(q)===JSON.stringify(k)||(n.value.push(k),o.value=[],n.value.length>50&&n.value.shift())}e.saveUndo=d;function c(){var k,q,re;n.value.length&&(o.value.push(i()),r(n.value.pop()),(k=e.invalidateConditionalFormatCache)==null||k.call(e),(q=e.invalidateDataValidationCache)==null||q.call(e),(re=e.scheduleRender)==null||re.call(e),t.nextTick(()=>{var Se;return(Se=e.emitModelData)==null?void 0:Se.call(e)}))}function C(){var k,q,re;o.value.length&&(n.value.push(i()),r(o.value.pop()),(k=e.invalidateConditionalFormatCache)==null||k.call(e),(q=e.invalidateDataValidationCache)==null||q.call(e),(re=e.scheduleRender)==null||re.call(e),t.nextTick(()=>{var Se;return(Se=e.emitModelData)==null?void 0:Se.call(e)}))}const h=t.computed(()=>n.value.length>0),S=t.computed(()=>o.value.length>0),m=t.computed(()=>!!e.selection.value),M=t.ref(null);function E(){var re;const k=e.selection.value;if(!k)return;const q={};for(let Se=k.startCol;Se<=k.endCol;Se++)for(let Te=k.startRow;Te<=k.endRow;Te++)q[`${Se-k.startCol},${Te-k.startRow}`]=((re=e.cells[e.cellKey(Se,Te)])==null?void 0:re.styleId)??0;M.value={styles:q}}function B(){var re,Se,Te;const k=M.value,q=e.selection.value;if(!(!k||!q)){d();for(let pe=q.startCol;pe<=q.endCol;pe++)for(let F=q.startRow;F<=q.endRow;F++){const p=e.findMerge(pe,F);if(p&&(pe!==p.range.startCol||F!==p.range.startRow))continue;const N=k.styles[`${pe-q.startCol},${F-q.startRow}`]??0,bt=e.cellKey(pe,F),vt=((re=e.cells[bt])==null?void 0:re.value)??"";if(vt===""&&N===0)e.delCell(bt);else{const Kt={value:vt};N>0&&(Kt.styleId=N),e.cells[bt]=Kt}}M.value=null,(Se=e.scheduleRender)==null||Se.call(e),(Te=e.emitModelData)==null||Te.call(e)}}function G(){var q,re,Se;const k=e.selection.value;if(k){d();for(let Te=k.startCol;Te<=k.endCol;Te++)for(let pe=k.startRow;pe<=k.endRow;pe++){const F=e.findMerge(Te,pe);if(F&&(Te!==F.range.startCol||pe!==F.range.startRow))continue;const p=e.cellKey(Te,pe),N=((q=e.cells[p])==null?void 0:q.value)??"";N===""?e.delCell(p):e.cells[p]={value:N}}(re=e.scheduleRender)==null||re.call(e),(Se=e.emitModelData)==null||Se.call(e)}}const te=t.computed(()=>Oi.map(k=>({...k,label:k.value===""?g(e.locale.value,"fontDefault"):k.label}))),ge=t.computed(()=>Ii.map(k=>({...k,label:String(k.value)}))),fe="\0",Ie=t.computed(()=>{const k=e.selection.value;if(!k)return"";let q,re=!1;for(let Se=k.startCol;Se<=k.endCol&&!re;Se++)for(let Te=k.startRow;Te<=k.endRow&&!re;Te++){const pe=e.findMerge(Se,Te);if(pe&&(Se!==pe.range.startCol||Te!==pe.range.startRow))continue;const F=e.resolveStyle(e.cells[e.cellKey(Se,Te)]),p=typeof(F==null?void 0:F.fontFamily)=="string"?F.fontFamily:"";q===void 0?q=p:p!==q&&(re=!0)}return re?fe:q??""}),me=t.computed(()=>{const k=e.selection.value;if(!k)return ao;let q,re=!1;for(let Se=k.startCol;Se<=k.endCol&&!re;Se++)for(let Te=k.startRow;Te<=k.endRow&&!re;Te++){const pe=e.findMerge(Se,Te);if(pe&&(Se!==pe.range.startCol||Te!==pe.range.startRow))continue;const F=e.cellFontSize(Se,Te);q===void 0?q=F:F!==q&&(re=!0)}return re?0:q??ao});function Ee(k,q){var Se,Te,pe;const re=e.selection.value;if(re){d();for(let F=re.startCol;F<=re.endCol;F++)for(let p=re.startRow;p<=re.endRow;p++){const N=e.findMerge(F,p);if(N&&(F!==N.range.startCol||p!==N.range.startRow))continue;const bt=e.cellKey(F,p),vt=((Se=e.cells[bt])==null?void 0:Se.value)??"";let Nt={...e.resolveStyle(e.cells[bt])??{}};if(q===""||q===null||q===void 0||q===0){const{[k]:mo,...Xt}=Nt;Nt=Xt}else Nt[k]=q;const fo=Object.keys(Nt).length?e.registerStyle(Nt):0;if(vt===""&&fo===0)e.delCell(bt);else{const mo={value:vt};fo>0&&(mo.styleId=fo),e.cells[bt]=mo}}(Te=e.scheduleRender)==null||Te.call(e),(pe=e.emitModelData)==null||pe.call(e)}}function Ae(k){Ee("fontFamily",k===""?"":k)}const ce=t.ref(!1),ae=t.ref(!1),qe=t.ref(!1),ut=t.ref(!1),J=t.ref(!1);function O(k){Ee("fontSize",k),ce.value=!1}const L=t.computed(()=>Wi.map(k=>({label:g(e.locale.value,k.labelKey),value:k.value,icon:k.icon}))),le=t.computed(()=>Ui.map(k=>({label:g(e.locale.value,k.labelKey),value:k.value,icon:k.icon}))),$e=t.computed(()=>{const k=e.selection.value;if(!k)return"left";const q=e.resolveStyle(e.cells[e.cellKey(k.startCol,k.startRow)]),re=typeof(q==null?void 0:q.textAlign)=="string"?q.textAlign:"";return re==="center"||re==="right"?re:"left"}),et=t.computed(()=>{const k=e.selection.value;if(!k)return"top";const q=e.resolveStyle(e.cells[e.cellKey(k.startCol,k.startRow)]),re=typeof(q==null?void 0:q.verticalAlign)=="string"?q.verticalAlign:"";return re==="middle"||re==="bottom"?re:"top"}),oe=t.computed(()=>{const k=e.selection.value;if(!k)return!1;const q=e.resolveStyle(e.cells[e.cellKey(k.startCol,k.startRow)]);return(q==null?void 0:q.wrap)==="wrap"});function xe(k){Ee("textAlign",k)}function se(k){Ee("verticalAlign",k)}function de(){if(!e.selection.value)return;const q=oe.value;Ee("wrap",q?void 0:"wrap")}const we=t.ref(""),Re=ce;t.watch(me,k=>{we.value=k===0?"":String(k)},{immediate:!0});function Ke(k){const q=k.replace(/[^\d]/g,"");we.value=q;const re=parseInt(q,10);!isNaN(re)&&re>=5&&re<=72&&re!==me.value&&Ee("fontSize",re)}function We(){const k=we.value.trim();if(!k){we.value=me.value===0?"":String(me.value);return}let q=parseInt(k,10);isNaN(q)?q=me.value===0?ao:me.value:q=Math.max(5,Math.min(72,q)),we.value=String(q),q!==me.value&&Ee("fontSize",q)}function rt(k){k.key==="Enter"&&k.target.blur()}function je(k){k&&k.preventDefault(),Re.value=!Re.value,Re.value&&(qe&&(qe.value=!1),ae&&(ae.value=!1),ut.value=!1,J.value=!1)}function A(){const k=me.value===0?ao:me.value,q=Math.min(72,k+1);Ee("fontSize",q),we.value=String(q),Re.value=!1}function K(){const k=me.value===0?ao:me.value,q=Math.max(5,k-1);Ee("fontSize",q),we.value=String(q),Re.value=!1}function $(k){const q=e.selection.value;if(!q)return!1;let re,Se=!1;for(let Te=q.startCol;Te<=q.endCol&&!Se;Te++)for(let pe=q.startRow;pe<=q.endRow&&!Se;pe++){const F=e.findMerge(Te,pe);if(F&&(Te!==F.range.startCol||pe!==F.range.startRow))continue;const p=e.resolveStyle(e.cells[e.cellKey(Te,pe)]),N=!!(p!=null&&p[k]);re===void 0?re=N:N!==re&&(Se=!0)}return!Se&&re===!0}const V=t.computed(()=>$("fontWeight")),x=t.computed(()=>$("fontStyle")),H=t.computed(()=>$("underline")),z=t.computed(()=>$("strikethrough"));function Y(){Ee("fontWeight",V.value?"":"bold")}function ve(){Ee("fontStyle",x.value?"":"italic")}function ze(){Ee("underline",H.value?"":"underline")}function it(){Ee("strikethrough",z.value?"":"line-through")}const Fe=t.ref(""),v=t.ref(""),Z=ut,lt=J;function wt(){Z.value=!Z.value,lt.value=!1,ae&&(ae.value=!1),qe&&(qe.value=!1)}function ft(){lt.value=!lt.value,Z.value=!1,ae&&(ae.value=!1),qe&&(qe.value=!1)}function At(k){ae&&(ae.value=k),k&&(Z.value=!1,lt.value=!1,qe&&(qe.value=!1))}function Ft(k){Fe.value=k,Ee("color",k===""?"":k)}function Vt(k){v.value=k,Ee("backgroundColor",k===""?"":k)}function wn(){Ee("color",Fe.value===""?"":Fe.value)}function an(){Ee("backgroundColor",v.value===""?"":v.value)}const sn=t.computed(()=>{const k=e.selection.value;if(!k)return"";let q,re=!1;for(let Se=k.startCol;Se<=k.endCol&&!re;Se++)for(let Te=k.startRow;Te<=k.endRow&&!re;Te++){const pe=e.findMerge(Se,Te);if(pe&&(Se!==pe.range.startCol||Te!==pe.range.startRow))continue;const F=e.resolveStyle(e.cells[e.cellKey(Se,Te)]),p=typeof(F==null?void 0:F.color)=="string"?F.color:"";q===void 0?q=p:p!==q&&(re=!0)}return re?"":q??""}),mn=t.computed(()=>{const k=e.selection.value;if(!k)return"";let q,re=!1;for(let Se=k.startCol;Se<=k.endCol&&!re;Se++)for(let Te=k.startRow;Te<=k.endRow&&!re;Te++){const pe=e.findMerge(Se,Te);if(pe&&(Se!==pe.range.startCol||Te!==pe.range.startRow))continue;const F=e.resolveStyle(e.cells[e.cellKey(Se,Te)]),p=typeof(F==null?void 0:F.backgroundColor)=="string"?F.backgroundColor:"";q===void 0?q=p:p!==q&&(re=!0)}return re?"":q??""}),Dt=t.computed(()=>pa(e.locale.value)),Jt=t.ref(!1),Qt=t.computed(()=>{const k=e.selection.value;if(!k)return so;let q,re=!1;for(let Se=k.startCol;Se<=k.endCol&&!re;Se++)for(let Te=k.startRow;Te<=k.endRow&&!re;Te++){const pe=e.findMerge(Se,Te);if(pe&&(Se!==pe.range.startCol||Te!==pe.range.startRow))continue;const F=e.resolveStyle(e.cells[e.cellKey(Se,Te)]),p=(F==null?void 0:F.numberFormatCategory)==="custom"?io:typeof(F==null?void 0:F.numberFormat)=="string"?F.numberFormat:"";q===void 0?q=p:p!==q&&(re=!0)}return re?jn:q??so});function $n(k){if((k==null?void 0:k.numberFormatCategory)==="custom")return io;const q=typeof(k==null?void 0:k.numberFormat)=="string"?k.numberFormat:"";return ma(q,e.locale.value)}const Zt=t.computed(()=>{const k=Qt.value;if(k!==jn)return k===io?io:ma(k,e.locale.value);const q=e.selection.value;if(!q)return so;let re,Se=!1;for(let Te=q.startCol;Te<=q.endCol&&!Se;Te++)for(let pe=q.startRow;pe<=q.endRow&&!Se;pe++){const F=e.findMerge(Te,pe);if(F&&(Te!==F.range.startCol||pe!==F.range.startRow))continue;const p=$n(e.resolveStyle(e.cells[e.cellKey(Te,pe)]));re===void 0?re=p:p!==re&&(Se=!0)}return Se?jn:re??so});function Vn(k){Ee("numberFormat",k),U()}function U(){const k=e.selection.value;if(k)for(let q=k.startCol;q<=k.endCol;q++)for(let re=k.startRow;re<=k.endRow;re++){const Se=e.findMerge(q,re);if(Se&&(q!==Se.range.startCol||re!==Se.range.startRow))continue;const Te=e.cellKey(q,re),pe=e.cells[Te],F=e.resolveStyle(pe);if((F==null?void 0:F.numberFormatCategory)!=="custom")continue;const{numberFormatCategory:p,...N}=F,bt=Object.keys(N).length?e.registerStyle(N):0,vt=(pe==null?void 0:pe.value)??"";if(vt===""&&bt===0)e.delCell(Te);else{const Kt={value:vt};bt>0&&(Kt.styleId=bt),e.cells[Te]=Kt}}}function W(k){if(k===io){Jt.value=!0;return}Vn(k)}function X(){Jt.value=!0}function Ce(){const k=e.selection.value;if(!k)return[];const q=[];for(let re=k.startCol;re<=k.endCol;re++)for(let Se=k.startRow;Se<=k.endRow;Se++){const Te=e.findMerge(re,Se);if(Te&&(re!==Te.range.startCol||Se!==Te.range.startRow))continue;const pe=e.cellKey(re,Se),F=e.cells[pe],p=e.resolveStyle(F),N=typeof(p==null?void 0:p.numberFormat)=="string"?p.numberFormat:so,bt=(F==null?void 0:F.value)??"",vt=bt.startsWith("=")?Oa(re,Se,e.cells,e.colCount,e.rowCount):bt;fa(N,vt)&&q.push({key:pe,nf:N,decimals:ss(N,vt)})}return q}const Ne=t.computed(()=>Ce().some(k=>k.decimals<yr)),Ve=t.computed(()=>Ce().some(k=>k.decimals>Cr));function He(k,q,re){var p;const Se=((p=e.cells[k])==null?void 0:p.value)??"",pe={...e.resolveStyle(e.cells[k])??{}};q===""?(delete pe.numberFormat,delete pe.numberFormatCategory):(pe.numberFormat=q,re==="custom"&&(pe.numberFormatCategory="custom"));const F=Object.keys(pe).length?e.registerStyle(pe):0;if(Se===""&&F===0)e.delCell(k);else{const N={value:Se};F>0&&(N.styleId=F),e.cells[k]=N}}function Me(k){var Se,Te;const q=Ce(),re=[];for(const pe of q){const F=pe.decimals+k;if(F<Cr||F>yr)continue;const p=ds(pe.nf,F);p==null||p===pe.nf||re.push({key:pe.key,code:p,category:xn(pe.nf)?"custom":void 0})}if(re.length){d();for(const pe of re)He(pe.key,pe.code,pe.category);(Se=e.scheduleRender)==null||Se.call(e),(Te=e.emitModelData)==null||Te.call(e)}}function Le(){Me(1)}function be(){Me(-1)}return{undoStack:n,redoStack:o,cloneCells:a,takeSnap:i,restoreSnap:r,saveUndo:d,undo:c,redo:C,canUndo:h,canRedo:S,hasSelection:m,paintFmt:M,onPaintFormat:E,applyPaintFormat:B,clearFormat:G,fontFamilyOptions:te,fontSizeOptions:ge,FONT_FAMILY_MIXED:fe,selFontFamily:Ie,selFontSize:me,applyStyleToSelection:Ee,onFontFamilyChange:Ae,onFontSizeChange:O,hAlignOptions:L,vAlignOptions:le,selHAlign:$e,selVAlign:et,selWrap:oe,onHAlignChange:xe,onVAlignChange:se,onWrapToggle:de,fontSizeInput:we,fontSizeMenuOpen:Re,onFontSizeInput:Ke,onFontSizeBlur:We,onFontSizeKeydown:rt,toggleFontSizeMenu:je,onFontSizeStepUp:A,onFontSizeStepDown:K,selFontWeight:V,selFontStyle:x,selUnderline:H,selStrikethrough:z,toggleFontWeight:Y,toggleFontStyle:ve,toggleUnderline:ze,toggleStrikethrough:it,cachedTextColor:Fe,cachedFillColor:v,textColorMenuOpen:Z,fillColorMenuOpen:lt,_toggleTextColorMenu:wt,_toggleFillColorMenu:ft,onBorderMenuToggle:At,onTextColorChange:Ft,onFillColorChange:Vt,applyCachedTextColor:wn,applyCachedFillColor:an,selTextColor:sn,selFillColor:mn,nfOptions:Dt,selNumberFormat:Qt,selNumberFormatDisplay:Zt,NF_NUMBER_FORMAT_MIXED:jn,nfDialogOpen:Jt,onNumberFormatChange:W,openNumberFormatDialog:X,applyNumberFormatCode:Vn,canIncreaseDecimals:Ne,canDecreaseDecimals:Ve,onIncreaseDecimals:Le,onDecreaseDecimals:be}}function Up(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 pi="#444",hi="#aaaaaa";function gi(e){return e==="dark"?hi:pi}const Ir=["top","right","bottom","left"];function hl(e){if(typeof e!="string")return;const l=e.trim();return l===""?void 0:l}function bi(e,l){const n=hl(e),o=hl(l);return n===void 0||o===void 0?n===o:n.toLowerCase()===o.toLowerCase()}function Kl(e){return!!e&&typeof e.width=="number"&&e.width>0}function Pp(e,l){const n={...e},o=hl(l);return o===void 0?delete n.color:n.color=o,n}function Kp(e,l){const n={...e};return l==="solid"?delete n.style:n.style=l,n}function yi(e,l,n,o){const a=e?{...e}:{};a.width=l;const i=hl(n);return i===void 0?delete a.color:a.color=i,o!==void 0&&(o==="solid"?delete a.style:a.style=o),a}function gl(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 C=o;C<=a;C++)for(let h=i;h<=r;h++)for(const S of Ir)n({col:C,row:h,side:S});return}if(e==="outer"||e==="thickOuter"){for(let C=o;C<=a;C++)n({col:C,row:i,side:"top"}),n({col:C,row:r,side:"bottom"});for(let C=i;C<=r;C++)n({col:o,row:C,side:"left"}),n({col:a,row:C,side:"right"});return}const c={bottom:{side:"bottom",isEdge:(C,h)=>h===r},top:{side:"top",isEdge:(C,h)=>h===i},left:{side:"left",isEdge:(C,h)=>C===o},right:{side:"right",isEdge:(C,h)=>C===a}}[e];if(c)for(let C=o;C<=a;C++)for(let h=i;h<=r;h++)c.isEdge(C,h)&&n({col:C,row:h,side:c.side})}function Gp(e,l,n,o){const a=[];return gl(e,l,({col:i,row:r,side:d})=>{const c=o(i,r,d);if(!Kl(c))return;const C=Pp(c,n);bi(c==null?void 0:c.color,C.color)||a.push({col:i,row:r,side:d,next:C})}),a}function qp(e,l,n,o,a,i){const r={};for(const d of Ir)r[d]=yi(a(e,l,d),n,o,i);return r}function Yp(e,l,n){let o,a=!1,i=!1;if(gl(e,l,({col:r,row:d,side:c})=>{if(i)return;const C=n(r,d,c);if(!Kl(C))return;const h=hl(C.color);if(!a){o=h,a=!0;return}bi(o,h)||(i=!0)}),!(i||!a))return o}function jp(e,l,n,o){const a=[];return gl(e,l,({col:i,row:r,side:d})=>{const c=o(i,r,d);if(!Kl(c))return;const C=Kp(c,n);rn(c.style)!==n&&a.push({col:i,row:r,side:d,next:C})}),a}function Xp(e,l,n){let o,a=!1,i=!1;if(gl(e,l,({col:r,row:d,side:c})=>{if(i)return;const C=n(r,d,c);if(!Kl(C))return;const h=rn(C.style);if(!a){o=h,a=!0;return}h!==o&&(i=!0)}),!(i||!a))return o}function Zp(e,l){const n=t.ref("none"),o=t.ref(""),a=t.ref("solid"),i=t.ref(!1);function r(A,K,$){if(A<0||K<0||A>=e.colCount||K>=e.rowCount)return;const V=e.findMerge(A,K);return e.getCellBorderSide(e.cells[V?V.anchor:e.cellKey(A,K)],$)}function d(A,K,$,V){if(A<0||K<0||A>=e.colCount||K>=e.rowCount)return;const x=e.findMerge(A,K),H=x?x.anchor:e.cellKey(A,K);if(!e.cells[H]){if(!V)return;e.cells[H]={value:""}}_p(e.cells[H],$,V,e.styles,{get:Y=>e.resolveBorder(Y),getId:Y=>e.registerBorder(Y)},e.registerStyle)}function c(A,K,$){var ve;const V=e.findMerge(A,K),x=V?V.anchor:e.cellKey(A,K),H=((ve=e.cells[x])==null?void 0:ve.value)??"",z=e.resolveStyle(e.cells[x])?{...e.resolveStyle(e.cells[x])}:{},Y=e.registerBorder($);if(Y>0?z.borderId=Y:delete z.borderId,delete z.borderTopWidth,delete z.borderBottomWidth,delete z.borderLeftWidth,delete z.borderRightWidth,delete z.borderColor,H===""&&!Object.keys(z).length)e.delCell(x);else{const ze=e.registerStyle(z);e.cells[x]={value:H,styleId:ze||void 0}}}function C(A){var ze,it;n.value=A;const K=e.selection.value;if(!K)return;l.saveUndo();const{startCol:$,startRow:V,endCol:x,endRow:H}=K,z={startCol:$,startRow:V,endCol:x,endRow:H},Y=o.value||void 0,ve=(Fe,v,Z)=>r(Fe,v,Z);if(A==="none")for(let Fe=$;Fe<=x;Fe++)for(let v=V;v<=H;v++){const Z=e.findMerge(Fe,v);Z&&(Fe!==Z.range.startCol||v!==Z.range.startRow)||c(Fe,v,{})}else if(A==="all")for(let Fe=$;Fe<=x;Fe++)for(let v=V;v<=H;v++){const Z=e.findMerge(Fe,v);if(Z&&(Fe!==Z.range.startCol||v!==Z.range.startRow))continue;const lt=qp(Fe,v,1,Y,ve,a.value);for(const wt of Ir)lt[wt]&&(lt[wt].owner=!0);c(Fe,v,lt)}else{const Fe=A==="thickOuter"?2:1;gl(A,z,({col:v,row:Z,side:lt})=>{const wt=ve(v,Z,lt),ft=yi(wt,Fe,Y,a.value);ft.owner=!0,d(v,Z,lt,ft)})}(ze=e.scheduleRender)==null||ze.call(e),(it=e.emitModelData)==null||it.call(e)}function h(A){var H,z;o.value=A;const K=e.selection.value;if(!K)return;const $={startCol:Math.min(K.startCol,K.endCol),startRow:Math.min(K.startRow,K.endRow),endCol:Math.max(K.startCol,K.endCol),endRow:Math.max(K.startRow,K.endRow)},V=n.value==="none"?"all":n.value,x=Gp(V,$,A,(Y,ve,ze)=>r(Y,ve,ze));if(x.length!==0){l.saveUndo();for(const Y of x)Y.next.owner=!0,d(Y.col,Y.row,Y.side,Y.next);(H=e.scheduleRender)==null||H.call(e),(z=e.emitModelData)==null||z.call(e)}}function S(A){var H,z,Y;a.value=A;const K=e.selection.value;if(!K)return;const $={startCol:Math.min(K.startCol,K.endCol),startRow:Math.min(K.startRow,K.endRow),endCol:Math.max(K.startCol,K.endCol),endRow:Math.max(K.startRow,K.endRow)},V=n.value==="none"?"all":n.value,x=jp(V,$,A,(ve,ze,it)=>r(ve,ze,it));if(x.length===0){(H=e.scheduleRender)==null||H.call(e);return}l.saveUndo();for(const ve of x)ve.next.owner=!0,d(ve.col,ve.row,ve.side,ve.next);(z=e.scheduleRender)==null||z.call(e),(Y=e.emitModelData)==null||Y.call(e)}const m=t.computed(()=>{const A=e.selection.value;if(!A)return"";const K=n.value==="none"?"all":n.value;return Yp(K,A,($,V,x)=>r($,V,x))??""}),M=t.computed(()=>{const A=e.selection.value;if(!A)return"";const K=n.value==="none"?"all":n.value;return Xp(K,A,($,V,x)=>r($,V,x))??""});function E(){C(n.value)}function B(A,K,$){const V=$.toLowerCase(),x=e.findMerge(A,K);if(x){if(V==="top"&&K!==x.range.startRow||V==="bottom"&&K!==x.range.endRow||V==="left"&&A!==x.range.startCol||V==="right"&&A!==x.range.endCol)return 0;const z=e.getCellBorderSide(e.cells[x.anchor],V);return(z==null?void 0:z.width)??0}const H=e.getCellBorderSide(e.cells[e.cellKey(A,K)],V);return(H==null?void 0:H.width)??0}const G=t.ref(!1);function te(A){G.value=A,A&&(l.textColorMenuOpen.value=!1,l.fillColorMenuOpen.value=!1,i.value=!1,l.fontSizeMenuOpen.value=!1)}function ge(A,K,$,V){const x=[];for(const H in e.merges){const z=e.merges[H];z&&z.startCol<=$&&z.endCol>=A&&z.startRow<=V&&z.endRow>=K&&x.push(H)}for(const H of x)Reflect.deleteProperty(e.merges,H)}function fe(){var H,z,Y;const A=e.selection.value;if(!A||A.startCol===A.endCol&&A.startRow===A.endRow)return;l.saveUndo(),ge(A.startCol,A.startRow,A.endCol,A.endRow);const K=e.cellKey(A.startCol,A.startRow),$=((H=e.cells[K])==null?void 0:H.value)??"";for(let ve=A.startCol;ve<=A.endCol;ve++)for(let ze=A.startRow;ze<=A.endRow;ze++)ve===A.startCol&&ze===A.startRow||e.clearCellsInRange(ve,ve,ze,ze);const V=e.resolveStyle(e.cells[K])?{...e.resolveStyle(e.cells[K])}:{};V.textAlign="center";const x=e.registerStyle(V);e.cells[K]={value:$,styleId:x||void 0},e.merges[K]={startCol:A.startCol,startRow:A.startRow,endCol:A.endCol,endRow:A.endRow},e.selectCell(A.startCol,A.startRow),(z=e.scheduleRender)==null||z.call(e),(Y=e.emitModelData)==null||Y.call(e)}function Ie(){var K,$,V;const A=e.selection.value;if(!(!A||A.startCol===A.endCol)){l.saveUndo();for(let x=A.startRow;x<=A.endRow;x++){ge(A.startCol,x,A.endCol,x);const H=e.cellKey(A.startCol,x);(K=e.cells[H])==null||K.value;for(let z=A.startCol+1;z<=A.endCol;z++)e.clearCellsInRange(z,z,x,x);e.merges[H]={startCol:A.startCol,startRow:x,endCol:A.endCol,endRow:x}}e.selectRange(A.startCol,A.startRow,A.endCol,A.endRow),($=e.scheduleRender)==null||$.call(e),(V=e.emitModelData)==null||V.call(e)}}function me(){var $,V,x;const A=e.selection.value;if(!A||A.startCol===A.endCol&&A.startRow===A.endRow)return;l.saveUndo(),ge(A.startCol,A.startRow,A.endCol,A.endRow);const K=e.cellKey(A.startCol,A.startRow);($=e.cells[K])==null||$.value;for(let H=A.startCol;H<=A.endCol;H++)for(let z=A.startRow;z<=A.endRow;z++)H===A.startCol&&z===A.startRow||e.clearCellsInRange(H,H,z,z);e.merges[K]={startCol:A.startCol,startRow:A.startRow,endCol:A.endCol,endRow:A.endRow},e.selectCell(A.startCol,A.startRow),(V=e.scheduleRender)==null||V.call(e),(x=e.emitModelData)==null||x.call(e)}function Ee(){var K,$;const A=e.selection.value;A&&(l.saveUndo(),ge(A.startCol,A.startRow,A.endCol,A.endRow),(K=e.scheduleRender)==null||K.call(e),($=e.emitModelData)==null||$.call(e))}function Ae(){const A=e.selection.value;if(!A)return;const K=e.findMerge(A.startCol,A.startRow);K&&A.startCol===K.range.startCol&&A.startRow===K.range.startRow&&A.endCol===K.range.endCol&&A.endRow===K.range.endRow?Ee():fe()}function ce(A){switch(A){case"mergeCenter":fe();break;case"mergeAcross":Ie();break;case"mergeCells":me();break;case"unmergeCells":Ee();break}}let ae=null,qe=[],ut=[];function J(A,K,$,V){ut=[];const x={startCol:A,endCol:K,startRow:$,endRow:V};for(const{rule:H,range:z}of e.getDataValidationsInRange(x))ut.push({...H,ranges:[{...z}]})}function O(A,K,$,V){qe=[];for(let x=$;x<=V;x++){const H=[];for(let z=A;z<=K;z++){const Y=e.cells[e.cellKey(z,x)];H.push((Y==null?void 0:Y.styleId)??0)}qe.push(H)}}function L(A,K,$,V){const x=e.cellKey(A,K);if(Mo(),$===""||$==null){e.formulaDeps.clear(x),V&&V>0?e.cells[x]={value:"",styleId:V}:e.delCell(x),e.formulaDeps.markDirty(x);return}e.cells[x]={value:$,styleId:V&&V>0?V:void 0},$.startsWith("=")?e.formulaDeps.set(x,Il($.slice(1),e.colCount,e.rowCount)):e.formulaDeps.clear(x),e.formulaDeps.markDirty(x)}function le(){const A=e.selection.value;if(!A)return;ae={...A},O(A.startCol,A.endCol,A.startRow,A.endRow),J(A.startCol,A.endCol,A.startRow,A.endRow);const K=[];for(let $=A.startRow;$<=A.endRow;$++){const V=[];for(let x=A.startCol;x<=A.endCol;x++)V.push(e.getCellRaw(x,$));K.push(V.join(" "))}mr(K.join(`
4
+ `))}function $e(){const A=e.selection.value;if(A){if(A.startCol===0&&A.endCol===e.colCount-1){ae={...A},O(0,e.colCount-1,A.startRow,A.endRow),J(0,e.colCount-1,A.startRow,A.endRow);const K=[];for(let $=A.startRow;$<=A.endRow;$++){const V=[];for(let x=0;x<e.colCount;x++)V.push(e.getCellRaw(x,$));K.push(V.join(" "))}mr(K.join(`
5
+ `))}else if(A.startRow===0&&A.endRow===e.rowCount-1){ae={...A},O(A.startCol,A.endCol,0,e.rowCount-1),J(A.startCol,A.endCol,0,e.rowCount-1);const K=[];for(let $=0;$<e.rowCount;$++){const V=[];for(let x=A.startCol;x<=A.endCol;x++)V.push(e.getCellRaw(x,$));K.push(V.join(" "))}mr(K.join(`
6
+ `))}}}async function et(){var Fe;let A;try{A=await navigator.clipboard.readText()}catch{return}if(!A&&A!=="")return;const K=A.split(/\r?\n/),$=e.activeCell.value,V=ae,x=V&&qe.length>0,H=K.map(v=>v.split(" ").length),z=H.length?Math.max(...H):0,Y=$.col+z-1,ve=$.row+K.length-1;Y>=0&&ve>=0&&e.ensureCapacity(Y,ve);const ze=[];for(let v=0;v<K.length;v++){const Z=K[v].split(" ");for(let lt=0;lt<Z.length;lt++){const wt=$.col+lt,ft=$.row+v;let At=Z[lt];At.startsWith("=")&&V&&(At=Al(At,wt-(V.startCol+lt),ft-(V.startRow+v),e.colCount,e.rowCount,pt));const Ft=x&&v<qe.length&&lt<(((Fe=qe[v])==null?void 0:Fe.length)??0)?qe[v][lt]??null:null;ze.push({c:wt,r:ft,val:At,styleId:Ft})}}const it=e.validateCells(ze.map(v=>({col:v.c,row:v.r,value:v.val})));if(!(!it.valid&&await e.confirmInvalidValue(it,$.col,$.row)!=="continue")){for(const v of ze)v.styleId!==null?L(v.c,v.r,v.val,v.styleId):e.setCellValue(v.c,v.r,v.val);if(V&&ut.length>0){const v=$.col-V.startCol,Z=$.row-V.startRow,lt={startCol:$.col,endCol:$.col+z-1,startRow:$.row,endRow:$.row+K.length-1},wt=ut.map(ft=>({...ft,ranges:ft.ranges.map(At=>Vp(At,v,Z))}));e.applyDataValidationsToRange(wt,lt,{silent:!0}),e.invalidateDataValidationCache()}}}function oe(){var A;if(l.saveUndo(),le(),e.selection.value){const K=e.selection.value;e.clearCellsInRange(K.startCol,K.endCol,K.startRow,K.endRow),(A=e.scheduleRender)==null||A.call(e)}}function xe(){var A;if(e.selection.value){const K=e.selection.value;e.clearCellsInRange(K.startCol,K.endCol,K.startRow,K.endRow),(A=e.scheduleRender)==null||A.call(e)}}function se(){var H,z;const A=e.selection.value;if(!A)return;l.saveUndo();const K=A.startCol,$=A.startRow,V=A.endCol,x=A.endRow;if($===x)if(V+1<e.colCount){const Y=`${pt(K)}${$+1}:${pt(V)}${$+1}`;e.setCellValue(V+1,$,`=SUM(${Y})`)}else{const Y=`${pt(K)}${$+1}:${pt(V-1)}${$+1}`;e.setCellValue(V,$,`=SUM(${Y})`)}else for(let Y=K;Y<=V;Y++)if(x+1<e.rowCount){const ve=`${pt(Y)}${$+1}:${pt(Y)}${x+1}`;e.setCellValue(Y,x+1,`=SUM(${ve})`)}else{const ve=`${pt(Y)}${$+1}:${pt(Y)}${x}`;e.setCellValue(Y,x,`=SUM(${ve})`)}(H=e.scheduleRender)==null||H.call(e),(z=e.emitModelData)==null||z.call(e)}function de(){var H,z;const A=e.selection.value;if(!A)return;l.saveUndo();const K=A.startCol,$=A.startRow,V=A.endCol,x=A.endRow;if($===x)if(V+1<e.colCount){const Y=`${pt(K)}${$+1}:${pt(V)}${$+1}`;e.setCellValue(V+1,$,`=AVERAGE(${Y})`)}else{const Y=`${pt(K)}${$+1}:${pt(V-1)}${$+1}`;e.setCellValue(V,$,`=AVERAGE(${Y})`)}else for(let Y=K;Y<=V;Y++)if(x+1<e.rowCount){const ve=`${pt(Y)}${$+1}:${pt(Y)}${x+1}`;e.setCellValue(Y,x+1,`=AVERAGE(${ve})`)}else{const ve=`${pt(Y)}${$+1}:${pt(Y)}${x}`;e.setCellValue(Y,x,`=AVERAGE(${ve})`)}(H=e.scheduleRender)==null||H.call(e),(z=e.emitModelData)==null||z.call(e)}function we(){var H,z;const A=e.selection.value;if(!A)return;l.saveUndo();const K=A.startCol,$=A.startRow,V=A.endCol,x=A.endRow;if($===x)if(V+1<e.colCount){const Y=`${pt(K)}${$+1}:${pt(V)}${$+1}`;e.setCellValue(V+1,$,`=COUNT(${Y})`)}else{const Y=`${pt(K)}${$+1}:${pt(V-1)}${$+1}`;e.setCellValue(V,$,`=COUNT(${Y})`)}else for(let Y=K;Y<=V;Y++)if(x+1<e.rowCount){const ve=`${pt(Y)}${$+1}:${pt(Y)}${x+1}`;e.setCellValue(Y,x+1,`=COUNT(${ve})`)}else{const ve=`${pt(Y)}${$+1}:${pt(Y)}${x}`;e.setCellValue(Y,x,`=COUNT(${ve})`)}(H=e.scheduleRender)==null||H.call(e),(z=e.emitModelData)==null||z.call(e)}const Re=t.ref(!1);function Ke(A){Re.value=A,A&&(l.textColorMenuOpen.value=!1,l.fillColorMenuOpen.value=!1,i.value=!1,l.fontSizeMenuOpen.value=!1,G.value=!1)}function We(){se(),Re.value=!1}function rt(){de(),Re.value=!1}function je(){we(),Re.value=!1}return{cachedBorder:n,cachedBorderColor:o,cachedBorderLineStyle:a,selBorderColor:m,selBorderLineStyle:M,borderMenuOpen:i,onBorderChange:C,onBorderColorChange:h,onBorderLineStyleChange:S,setCellBorderSide:d,applyBorderToCell:c,applyCachedBorder:E,cellBorderWidth:B,mergeMenuOpen:G,onMergeMenuToggle:te,removeOverlappingMerges:ge,mergeAndCenter:fe,mergeAcross:Ie,mergeCells:me,unmergeCells:Ee,onApplyMerge:Ae,onMergeChange:ce,copySourceRange:null,copySourceStyles:[],captureStyles:O,captureDataValidations:J,setCellWithStyle:L,copyToClipboard:le,copyRowCol:$e,pasteFromClipboard:et,cutSelected:oe,clearSelected:xe,sumSelected:se,avgSelected:de,countSelected:we,calcMenuOpen:Re,onCalcMenuToggle:Ke,onCalcSum:We,onCalcAvg:rt,onCalcCount:je}}function Jp(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-border-default"]=e===na?hi:pi,a}function Ci(e){return e==="number"?0:1}function wi(e,l,n){var i;if(e==null||e.trim()==="")return{kind:"blank"};const o=l??"";if(o===Bn||o==="@")return{kind:"text",text:e};if(xn(o)){if(An(e))return{kind:"number",num:Number(e)};const r=Xn(e,n);return r?{kind:"number",num:r.serial}:{kind:"text",text:In(e,o,n)}}const a=co(o);if(a.kind==="date"||a.kind==="duration"){const r=Number(e);return Number.isFinite(r)?{kind:"number",num:r}:{kind:"text",text:In(e,o,n)}}if(a.kind==="number"){const r=Number(e);if(Number.isFinite(r)){const d=((i=a.sections.find(c=>c.hasDigits))==null?void 0:i.scale)??1;return{kind:"number",num:r*d}}return{kind:"text",text:In(e,o,n)}}return{kind:"text",text:In(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=Ci(e.kind),i=Ci(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 e2(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 t2(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 Ar(e){return e?JSON.parse(JSON.stringify(e)):null}function vi(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 ki(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 d in e.columns){const c=Number(d);r[c>=l?c+a:c]=e.columns[d]}}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 d in e.columns){const c=Number(d);c>=l&&c<=n||(r[c>n?c-a:c]=e.columns[d])}}return{range:i,columns:r}}function Ei(e,l,n,o){if(l==="row"){const a=e.startRow,i=e.endRow;let r,d;if(i<n)r=a,d=i;else if(a>n+o-1)r=a-o,d=i-o;else if(r=a<n?a:n,d=i>n+o-1?i-o:n-1,d<r)return null;return{...e,startRow:r,endRow:d}}else{const a=e.startCol,i=e.endCol;let r,d;if(i<n)r=a,d=i;else if(a>n+o-1)r=a-o,d=i-o;else if(r=a<n?a:n,d=i>n+o-1?i-o:n-1,d<r)return null;return{...e,startCol:r,endCol:d}}}function Ri(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 n2(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],d=r.ranges.map(c=>Ei(c,"row",l,o)).filter(c=>c!==null);d.length===0?e.conditionalFormats.splice(i,1):r.ranges=d}(a=e.invalidateConditionalFormatCache)==null||a.call(e)}function o2(e,l,n){var a;const o=n-l+1;for(const i of e.conditionalFormats)i.ranges=i.ranges.map(r=>Ri(r,"row",l,o));(a=e.invalidateConditionalFormatCache)==null||a.call(e)}function l2(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],d=r.ranges.map(c=>Ei(c,"col",l,o)).filter(c=>c!==null);d.length===0?e.conditionalFormats.splice(i,1):r.ranges=d}(a=e.invalidateConditionalFormatCache)==null||a.call(e)}function r2(e,l,n){var a;const o=n-l+1;for(const i of e.conditionalFormats)i.ranges=i.ranges.map(r=>Ri(r,"col",l,o));(a=e.invalidateConditionalFormatCache)==null||a.call(e)}function Mi(e,l,n,o){var a;for(let i=e.dataValidations.length-1;i>=0;i--){const r=e.dataValidations[i],d=(r.ranges??[]).map(c=>xp(c,l,n,o)).filter(c=>c!==null);d.length===0?e.dataValidations.splice(i,1):r.ranges=d}(a=e.invalidateDataValidationCache)==null||a.call(e)}function Si(e,l,n,o){var a;for(const i of e.dataValidations)i.ranges=(i.ranges??[]).map(r=>Tp(r,l,n,o));(a=e.invalidateDataValidationCache)==null||a.call(e)}function a2(e,l,n,o,a){function i(U,W){var Le;const X=W-U+1,Ce=J(U,W),Ne=[],Ve=[];for(const be in e.cells){const tt=be.indexOf(",");if(tt<0)continue;const k=parseInt(be.substring(0,tt),10),q=parseInt(be.substring(tt+1),10);q>=U&&q<=W?Ve.push(be):q>W&&Ne.push({oldKey:be,newKey:e.cellKey(k,q-X),cell:e.cells[be]})}for(const be of Ve)Reflect.deleteProperty(e.cells,be);for(const be of Ne)Reflect.deleteProperty(e.cells,be.oldKey),e.cells[be.newKey]=be.cell;(Le=e.gcNotes)==null||Le.call(e);const He=e.rowHeights.value,Me=new Array(He.length);for(let be=0;be<U;be++)Me[be]=He[be];for(let be=U;be<He.length-X;be++)Me[be]=He[be+X];for(let be=He.length-X;be<He.length;be++)Me[be]=void 0;e.rowHeights.value=Me,ut(Ce),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(vi(e.getFilter(),U,W,!1)),n2(e,U,W),Mi(e,"row",U,X),e.adjustOutlinesForDeleteRows(U,X)}function r(U,W){const X=W-U+1,Ce=e.rowCount,Ne=e.colCount,{lastRow:Ve}=C();Ve>=U&&Ve+X>=Ce&&e.ensureCapacity(Ne-1,Ce-1+X);const He=e.rowCount,Me=L(U,W),Le=[];for(const k in e.cells){const q=k.indexOf(",");if(q<0)continue;const re=parseInt(k.substring(0,q),10),Se=parseInt(k.substring(q+1),10);Se>=U&&Le.push({oldKey:k,newKey:e.cellKey(re,Se+X),cell:e.cells[k],oldRow:Se})}Le.sort((k,q)=>q.oldRow-k.oldRow);for(const k of Le)Reflect.deleteProperty(e.cells,k.oldKey),e.cells[k.newKey]=k.cell;for(const k in e.cells){const q=k.indexOf(",");if(q<0)continue;const re=parseInt(k.substring(q+1),10);re>=U&&re<=W&&Reflect.deleteProperty(e.cells,k)}const be=e.rowHeights.value,tt=new Array(He);for(let k=0;k<U;k++)tt[k]=be[k];for(let k=U;k<=W;k++)tt[k]=void 0;for(let k=U;k<He;k++)tt[k+X]=be[k];e.rowHeights.value=tt,ut(Me),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(vi(e.getFilter(),U,W,!0)),o2(e,U,W),Si(e,"row",U,X),e.adjustOutlinesForInsertRows(U,X)}function d(U,W){const X=W-U+1,Ce=e.colCount,Ne=e.rowCount,{lastCol:Ve}=C();Ve>=U&&Ve+X>=Ce&&e.ensureCapacity(Ce-1+X,Ne-1);const He=e.colCount,Me=le(U,W),Le=[];for(const k in e.cells){const q=k.indexOf(",");if(q<0)continue;const re=parseInt(k.substring(0,q),10),Se=parseInt(k.substring(q+1),10);re>=U&&Le.push({oldKey:k,newKey:e.cellKey(re+X,Se),cell:e.cells[k],oldCol:re})}Le.sort((k,q)=>q.oldCol-k.oldCol);for(const k of Le)Reflect.deleteProperty(e.cells,k.oldKey),e.cells[k.newKey]=k.cell;for(const k in e.cells){const q=k.indexOf(",");if(q<0)continue;const re=parseInt(k.substring(0,q),10);re>=U&&re<=W&&Reflect.deleteProperty(e.cells,k)}const be=e.colWidths.value,tt=new Array(He);for(let k=0;k<U;k++)tt[k]=be[k];for(let k=U;k<=W;k++)tt[k]=100;for(let k=U;k<He;k++)tt[k+X]=be[k];e.colWidths.value=tt,ut(Me),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(ki(e.getFilter(),U,W,!0)),r2(e,U,W),Si(e,"col",U,X),e.adjustOutlinesForInsertCols(U,X)}function c(U,W){var Le;const X=W-U+1,Ce=O(U,W),Ne=[],Ve=[];for(const be in e.cells){const tt=be.indexOf(",");if(tt<0)continue;const k=parseInt(be.substring(0,tt),10),q=parseInt(be.substring(tt+1),10);k>=U&&k<=W?Ve.push(be):k>W&&Ne.push({oldKey:be,newKey:e.cellKey(k-X,q),cell:e.cells[be]})}for(const be of Ve)Reflect.deleteProperty(e.cells,be);for(const be of Ne)Reflect.deleteProperty(e.cells,be.oldKey),e.cells[be.newKey]=be.cell;(Le=e.gcNotes)==null||Le.call(e);const He=e.colWidths.value,Me=new Array(He.length);for(let be=0;be<U;be++)Me[be]=He[be];for(let be=U;be<He.length-X;be++)Me[be]=He[be+X];for(let be=He.length-X;be<He.length;be++)Me[be]=100;e.colWidths.value=Me,ut(Ce),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(ki(e.getFilter(),U,W,!1)),l2(e,U,W),Mi(e,"col",U,X),e.adjustOutlinesForDeleteCols(U,X)}function C(){let U=-1,W=-1;for(const X in e.cells){const Ce=X.split(",");if(Ce.length===2){const Ne=parseInt(Ce[0],10),Ve=parseInt(Ce[1],10),He=e.cells[X];He&&(He.value!==""||He.styleId!==void 0)&&(Ne>U&&(U=Ne),Ve>W&&(W=Ve))}}for(let X=e.colCount-1;X>=0;X--){const Ce=e.colWidths.value[X];if(Ce!==void 0&&Ce!==100){X>U&&(U=X);break}}for(let X=e.rowCount-1;X>=0;X--)if(e.rowHeights.value[X]!==void 0){X>W&&(W=X);break}return{lastCol:U,lastRow:W}}function h(U,W){const X=e.resolveStyle(e.cells[e.cellKey(U,W)]);return typeof(X==null?void 0:X.numberFormat)=="string"?X.numberFormat:""}function S(U,W,X){for(let Ce=W;Ce<=X;Ce++)if(e.getCellRaw(U,Ce).trim()!=="")return!0;return!1}function m(U){const{startRow:W,endRow:X,startCol:Ce,endCol:Ne}=U;let Ve=Ce,He=Ne;for(;Ve>0&&S(Ve-1,W,X);)Ve--;for(;He<e.colCount-1&&S(He+1,W,X);)He++;return{startRow:W,endRow:X,startCol:Ve,endCol:He}}function M(U){const W=m(U);return W.startCol!==U.startCol||W.endCol!==U.endCol}function E(U,W,X,Ce=U){let Ne,Ve;if(X)Ne=X.startRow,Ve=X.endRow;else{const k=e.selection.value,q=!!k&&k.startRow===k.endRow&&k.startCol===k.endCol;Ne=q||!k?0:k.startRow,Ve=q||!k?e.rowCount-1:k.endRow}let He=-1,Me=-1;for(let k=Ne;k<=Ve;k++){let q=!1;for(let re=U;re<=W;re++)if(e.getCellRaw(re,k).trim()!==""){q=!0;break}q&&(He<0&&(He=k),Me=k)}if(He<0)return null;const Le=[];for(let k=He;k<=Me;k++){const q=e.getCellRaw(Ce,k);Le.push(wi(q,h(Ce,k),e.locale.value))}const be=t2(Le)?He+1:He;let tt=!1;for(let k=He;k<=Me&&!tt;k++)for(let q=U;q<=W;q++){const re=e.cells[e.cellKey(q,k)];if(re&&re.value.startsWith("=")){tt=!0;break}}if(!tt)for(const k in e.merges){const q=e.merges[k];if(q&&q.startCol<=W&&q.endCol>=U&&q.startRow<=Ve&&q.endRow>=Ne){tt=!0;break}}return{firstRow:He,lastRow:Me,sortStart:be,blocked:tt}}function B(U,W){const X=E(U,W);return!!X&&!X.blocked&&X.sortStart<X.lastRow}function G(U,W,X){var Se,Te;const Ce=W??e.selection.value;if(!Ce)return;const Ne=Ce.startCol,Ve=Ce.endCol,He=X??Ne,Me=E(Ne,Ve,{startRow:Ce.startRow,endRow:Ce.endRow},He);if(!Me||Me.blocked||Me.sortStart>=Me.lastRow)return;const Le=Ve-Ne+1,be=Me.lastRow-Me.sortStart+1,tt=[],k=[];for(let pe=Me.sortStart;pe<=Me.lastRow;pe++){const F=new Array(Le);for(let N=Ne;N<=Ve;N++)F[N-Ne]=e.cells[e.cellKey(N,pe)]??null;tt.push(F);const p=e.getCellRaw(He,pe);k.push(wi(p,h(He,pe),e.locale.value))}const q=e2(k,U,e.locale.value);let re=!1;for(let pe=0;pe<be;pe++)if(q[pe]!==pe){re=!0;break}if(re){l.saveUndo();for(let pe=0;pe<be;pe++){const F=tt[q[pe]],p=Me.sortStart+pe;for(let N=Ne;N<=Ve;N++){const bt=e.cellKey(N,p),vt=F[N-Ne],Kt=vt?vt.value:"",Nt=(Se=e.cells[bt])==null?void 0:Se.styleId;Kt!==""||Nt!==void 0?e.cells[bt]={value:Kt,styleId:Nt}:e.delCell(bt)}}Mo();for(let pe=Me.sortStart;pe<=Me.lastRow;pe++)for(let F=Ne;F<=Ve;F++)e.formulaDeps.markDirty(e.cellKey(F,pe));(Te=e.scheduleRender)==null||Te.call(e),H()}}const te=t.ref(!1),ge=t.ref(null);function fe(U){const W=e.selection.value;if(!W||!M(W))return!1;const X=m(W);return ge.value={order:U,originalRange:W,expandedRange:X},te.value=!0,!0}function Ie(U){const W=ge.value;if(!W)return;const{order:X,originalRange:Ce,expandedRange:Ne}=W;te.value=!1,ge.value=null,G(X,U?Ne:Ce,Ce.startCol),Ae.value=X}function me(){te.value=!1,ge.value=null}const Ee=t.ref(!1),Ae=t.ref("asc");function ce(U){Ee.value=U,U&&(l.textColorMenuOpen.value=!1,l.fillColorMenuOpen.value=!1,l.fontSizeMenuOpen.value=!1)}function ae(U){fe(U)||(Ae.value=U,G(U))}function qe(){fe(Ae.value)||G(Ae.value)}function ut(U){Object.keys(e.merges).forEach(W=>Reflect.deleteProperty(e.merges,W));for(const W of U)if(!(W.newRange.startCol>W.newRange.endCol||W.newRange.startRow>W.newRange.endRow)&&(e.merges[W.newAnchorKey]={...W.newRange},W.anchorCell)){const X=W.anchorCell.value,Ce=W.anchorCell.styleId;X===""&&!Ce||(e.cells[W.newAnchorKey]={value:X,styleId:Ce||void 0})}}function J(U,W){const X=W-U+1,Ce=[];for(const Ne in e.merges){const Ve=e.merges[Ne];if(!Ve)continue;const He=e.cells[Ne]?{value:e.cells[Ne].value,styleId:e.cells[Ne].styleId??0}:{value:"",styleId:0},{startCol:Me,endCol:Le}=Ve;let{startRow:be,endRow:tt}=Ve;if(be>W){be-=X,tt-=X,Ce.push({newAnchorKey:e.cellKey(Me,be),newRange:{startCol:Me,startRow:be,endCol:Le,endRow:tt}});continue}if(tt<U){Ce.push({newAnchorKey:Ne,newRange:{startCol:Me,startRow:be,endCol:Le,endRow:tt}});continue}if(be>=U&&tt<=W||(be>=U&&be<=W&&(be=U),tt>=U&&tt<=W?tt=U-1:tt>W&&(tt-=X),be>tt))continue;const k=Me,q=be,re=e.cellKey(k,q),Te=Ne.split(",").map(Number)[1],pe=Te>=U&&Te<=W||k!==Ve.startCol||q!==Te;Ce.push({newAnchorKey:re,newRange:{startCol:Me,startRow:be,endCol:Le,endRow:tt},anchorCell:pe?He:void 0})}return Ce}function O(U,W){const X=W-U+1,Ce=[];for(const Ne in e.merges){const Ve=e.merges[Ne];if(!Ve)continue;const He=e.cells[Ne]?{value:e.cells[Ne].value,styleId:e.cells[Ne].styleId??0}:{value:"",styleId:0};let{startCol:Me,endCol:Le}=Ve;const{startRow:be,endRow:tt}=Ve;if(Me>W){Me-=X,Le-=X,Ce.push({newAnchorKey:e.cellKey(Me,be),newRange:{startCol:Me,startRow:be,endCol:Le,endRow:tt}});continue}if(Le<U){Ce.push({newAnchorKey:Ne,newRange:{startCol:Me,startRow:be,endCol:Le,endRow:tt}});continue}if(Me>=U&&Le<=W||(Me>=U&&Me<=W&&(Me=U),Le>=U&&Le<=W?Le=U-1:Le>W&&(Le-=X),Me>Le))continue;const k=Me,q=be,re=e.cellKey(k,q),Te=Ne.split(",").map(Number)[0],pe=Te>=U&&Te<=W||k!==Te||q!==Ve.startRow;Ce.push({newAnchorKey:re,newRange:{startCol:Me,startRow:be,endCol:Le,endRow:tt},anchorCell:pe?He:void 0})}return Ce}function L(U,W){const X=W-U+1,Ce=[];for(const Ne in e.merges){const Ve=e.merges[Ne];if(!Ve)continue;const{startCol:He,endCol:Me}=Ve;let{startRow:Le,endRow:be}=Ve;be<U?Ce.push({newAnchorKey:Ne,newRange:{startCol:He,startRow:Le,endCol:Me,endRow:be}}):Le<U?(be+=X,Ce.push({newAnchorKey:Ne,newRange:{startCol:He,startRow:Le,endCol:Me,endRow:be}})):(Le+=X,be+=X,Ce.push({newAnchorKey:e.cellKey(He,Le),newRange:{startCol:He,startRow:Le,endCol:Me,endRow:be}}))}return Ce}function le(U,W){const X=W-U+1,Ce=[];for(const Ne in e.merges){const Ve=e.merges[Ne];if(!Ve)continue;let{startCol:He,endCol:Me}=Ve;const{startRow:Le,endRow:be}=Ve;Me<U?Ce.push({newAnchorKey:Ne,newRange:{startCol:He,startRow:Le,endCol:Me,endRow:be}}):He<U?(Me+=X,Ce.push({newAnchorKey:Ne,newRange:{startCol:He,startRow:Le,endCol:Me,endRow:be}})):(He+=X,Me+=X,Ce.push({newAnchorKey:e.cellKey(He,Le),newRange:{startCol:He,startRow:Le,endCol:Me,endRow:be}}))}return Ce}let $e=0;function et(){return $e++,`s_${$e}`}function oe(U){if(!Array.isArray(U))return[];const W=[];for(const X of U){if(!X||typeof X!="object")continue;const Ce=X;if(!Ce.type||!Array.isArray(Ce.ranges)||Ce.ranges.length===0)continue;const Ne=Ce.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)}));Ne.length&&W.push({...Ce,id:Ce.id||`dv_${W.length}`,ranges:Ne})}return W}function xe(U,W){const X=Math.max(1,(W==null?void 0:W.colCount)??e.colCount),Ce=Math.max(1,(W==null?void 0:W.rowCount)??e.rowCount),Ne=new Array(X).fill(100),Ve=new Array(Ce).fill(void 0);return{id:et(),name:U,cells:{},merges:{},styles:[{}],borders:[{}],selection:{startCol:0,startRow:0,endCol:0,endRow:0},activeCell:{col:0,row:0},scrollX:0,scrollY:0,colWidths:Ne,rowHeights:Ve,colCount:X,rowCount:Ce,freeze:{rows:0,cols:0},filter:null,conditionalFormats:[],dataValidations:[],rowOutlines:[],columnOutlines:[],notes:{}}}const se=t.ref([xe("Sheet1")]),de=t.ref(0);function we(){const U=se.value[de.value];if(!U)return;U.cells={...e.cells},U.merges={...e.merges},U.selection=e.selection.value?{...e.selection.value}:null,U.activeCell={...e.activeCell.value},U.scrollX=e.scrollX.value,U.scrollY=e.scrollY.value,U.colWidths=[...e.colWidths.value],U.rowHeights=[...e.rowHeights.value],U.styles=[...e.styles],U.borders=[...e.borders],U.colCount=e.colCount,U.rowCount=e.rowCount,U.freeze={rows:e.freeze.rows,cols:e.freeze.cols},U.filter=Ar(e.getFilter()),U.conditionalFormats=[...e.conditionalFormats],U.dataValidations=[...e.dataValidations];const W=Object.entries(e.notes).map(([X,Ce])=>[X,{...Ce}]);U.notes=Object.fromEntries(W),U.rowOutlines=e.getRowOutlines(),U.columnOutlines=e.getColumnOutlines()}function Re(U){var tt,k,q;const W=se.value[U];if(!W)return;Object.keys(e.cells).forEach(re=>e.delCell(re)),Object.assign(e.cells,W.cells),Object.keys(e.merges).forEach(re=>Reflect.deleteProperty(e.merges,re)),W.merges&&Object.assign(e.merges,W.merges),e.selection.value=W.selection?{...W.selection}:null,e.activeCell.value={...W.activeCell};const X=e.activeCell.value,Ce=e.selection.value,Ne=e.findMerge(X.col,X.row);Ne&&Ne.anchor===e.cellKey(X.col,X.row)&&(!Ce||Ce.startCol===X.col&&Ce.startRow===X.row&&Ce.endCol===X.col&&Ce.endRow===X.row)&&e.selectCell(X.col,X.row),e.scrollX.value=W.scrollX,e.scrollY.value=W.scrollY,e.colWidths.value=[...W.colWidths],e.rowHeights.value=[...W.rowHeights];const Ve=Math.max(1,W.colCount??e.colCount),He=Math.max(1,W.rowCount??e.rowCount);if((tt=e.setDims)==null||tt.call(e,Ve,He),e.freeze.rows=Math.max(0,Math.min(W.freeze.rows,e.rowCount)),e.freeze.cols=Math.max(0,Math.min(W.freeze.cols,e.colCount)),W.filter){const re=W.filter.range;e.setFilter({range:{startCol:Math.max(0,Math.min(re.startCol,e.colCount-1)),endCol:Math.max(0,Math.min(re.endCol,e.colCount-1)),startRow:Math.max(0,Math.min(re.startRow,e.rowCount-1)),endRow:Math.max(0,Math.min(re.endRow,e.rowCount-1))},columns:{...W.filter.columns}},!0)}else e.setFilter(null,!0);e.syncStyles(W.styles),e.syncBorders(W.borders??[{}]);const Me=W.conditionalFormats?W.conditionalFormats.map(re=>({...re,ranges:re.ranges.map(Se=>({...Se}))})):[];e.conditionalFormats.splice(0,e.conditionalFormats.length,...Me),(k=e.invalidateConditionalFormatCache)==null||k.call(e);const Le=oe(W.dataValidations);e.dataValidations.splice(0,e.dataValidations.length,...Le),(q=e.invalidateDataValidationCache)==null||q.call(e);const be=Xa(W.notes);Object.keys(e.notes).forEach(re=>{e.notes[re]=void 0}),Object.assign(e.notes,be),e.syncOutlines(W.rowOutlines,W.columnOutlines),de.value=U}function Ke(U){U===de.value||U<0||U>=se.value.length||(e.cancelEdit(),we(),Re(U))}function We(U){return l.saveUndo(),e.cancelEdit(),we(),se.value.push(xe(U??`Sheet${se.value.length+1}`)),Re(se.value.length-1),se.value.length-1}function rt(U){return se.value.length<=1||(l.saveUndo(),e.cancelEdit(),se.value.splice(U,1),Re(Math.min(U,se.value.length-1))),de.value}function je(U,W){se.value[U]&&W.trim()&&(l.saveUndo(),se.value[U].name=W.trim())}function A(U){l.saveUndo(),e.cancelEdit(),we();const W=se.value[U];if(!W)return U;let X=W.name;const Ce=X.match(/^(.*?)\s*\((\d+)\)$/);let Ne=Ce?parseInt(Ce[2],10)+1:2;Ce&&(X=Ce[1]);let Ve=`${X} (${Ne})`;const He=new Set(se.value.map(Le=>Le.name));for(;He.has(Ve);)Ne++,Ve=`${X} (${Ne})`;const Me={id:et(),name:Ve,cells:{...W.cells},merges:W.merges?{...W.merges}:{},styles:[...W.styles],borders:W.borders?[...W.borders]:[{}],selection:W.selection?{...W.selection}:null,activeCell:W.activeCell?{...W.activeCell}:{col:0,row:0},scrollX:W.scrollX,scrollY:W.scrollY,colWidths:[...W.colWidths],rowHeights:[...W.rowHeights],colCount:W.colCount,rowCount:W.rowCount,freeze:{...W.freeze},filter:Ar(W.filter),conditionalFormats:W.conditionalFormats?W.conditionalFormats.map(Le=>({...Le})):[],dataValidations:oe(W.dataValidations),rowOutlines:W.rowOutlines?W.rowOutlines.map(Le=>({...Le})):[],columnOutlines:W.columnOutlines?W.columnOutlines.map(Le=>({...Le})):[],notes:Xa(W.notes)};return se.value.splice(U+1,0,Me),Re(U+1),U+1}function K(U,W){var Ve;const X=U+W;if(X<0||X>=se.value.length)return;l.saveUndo();const Ce=de.value,Ne=se.value.splice(U,1)[0];se.value.splice(X,0,Ne),Ce===U?de.value=X:U<Ce&&X>=Ce?de.value=Ce-1:U>Ce&&X<=Ce&&(de.value=Ce+1),(Ve=e.scheduleRender)==null||Ve.call(e)}const $=t.computed(()=>se.value.length);let V="";const x=n;function H(){we();const U=se.value.map(X=>{const Ce={};for(const[Me,Le]of Object.entries(X.cells))Ce[Me]={value:Le.value},Le.styleId&&Le.styleId>0&&(Ce[Me].styleId=Le.styleId),Le.noteId&&(Ce[Me].noteId=Le.noteId);const Ne={name:X.name,cells:Ce};X.styles&&X.styles.length>1&&(Ne.styles=[...X.styles]),X.borders&&X.borders.length>1&&(Ne.borders=[...X.borders]),X.merges&&Object.keys(X.merges).length&&(Ne.merges={...X.merges});const Ve={};for(let Me=0;Me<X.colWidths.length;Me++)X.colWidths[Me]!==100&&(Ve[Me]=X.colWidths[Me]);Object.keys(Ve).length&&(Ne.colWidths=Ve);const He={};for(let Me=0;Me<X.rowHeights.length;Me++){const Le=X.rowHeights[Me];Le!=null&&(He[Me]=Le)}return Object.keys(He).length&&(Ne.rowHeights=He),(X.freeze.rows!==0||X.freeze.cols!==0)&&(Ne.freeze={rows:X.freeze.rows,cols:X.freeze.cols}),X.filter&&(Ne.filter=Ar(X.filter)),X.conditionalFormats&&X.conditionalFormats.length&&(Ne.conditionalFormats=X.conditionalFormats.map(Me=>({...Me}))),X.dataValidations&&X.dataValidations.length&&(Ne.dataValidations=X.dataValidations.map(Me=>({...Me,ranges:Me.ranges.map(Le=>({...Le}))}))),X.notes&&Object.keys(X.notes).length&&(Ne.notes=Object.fromEntries(Object.entries(X.notes).map(([Me,Le])=>[Me,{...Le}]))),X.rowOutlines&&X.rowOutlines.length&&(Ne.rowOutlines=X.rowOutlines.map(Me=>({...Me}))),X.columnOutlines&&X.columnOutlines.length&&(Ne.columnOutlines=X.columnOutlines.map(Me=>({...Me}))),Ne}),W=JSON.stringify(U);W!==V&&(V=W,x.value=U,a&&(a.value=W))}e.emitModelData=H;let z=!1;function Y(){z||(z=!0,Promise.resolve().then(()=>{z=!1,H()}))}const ve=t.computed(()=>e.props.theme==="dark"?na:Ki),ze=t.computed(()=>Jp(ve.value,e.props.width,e.props.height,Do)),it=t.computed(()=>{const U={};for(const[W,X]of Object.entries(ze.value))W.startsWith("--")&&(U[W]=X);return U}),Fe=t.ref(null),v=t.ref(null),Z=t.ref(null),lt=t.ref(null),wt=t.ref(null),ft=t.reactive({w:800,h:600});e.viewSize&&t.watch(ft,U=>{e.viewSize&&(e.viewSize.w=U.w,e.viewSize.h=U.h)},{deep:!0});const At=48,Ft=28,Vt=11,wn=()=>At+e.getOutlineGutterSize("row"),an=()=>Ft+e.getOutlineGutterSize("column"),sn=t.computed(()=>Math.max(0,e.totalWidth.value-Math.max(0,ft.w-wn()-Vt))),mn=t.computed(()=>Math.max(0,e.totalHeight.value-Math.max(0,ft.h-an()-Vt)));function Dt(U,W){const X=Math.max(0,ft.w-wn()-Vt),Ce=Math.max(0,ft.h-an()-Vt),Ne=U??e.scrollX.value,Ve=W??e.scrollY.value,He=40,Me=Math.max(0,e.totalWidth.value-X),Le=Math.max(0,e.totalHeight.value-Ce);if(Ne>=Me-He&&Ne>e.scrollX.value||Ve>=Le-He&&Ve>e.scrollY.value){const be=Math.max(0,Math.ceil((Ne+X)/100)+2),tt=Math.max(0,Math.ceil((Ve+Ce)/24)+2);e.ensureCapacity(be,tt)}e.scrollX.value=Math.max(0,Math.min(Ne,Math.max(0,e.totalWidth.value-X))),e.scrollY.value=Math.max(0,Math.min(Ve,Math.max(0,e.totalHeight.value-Ce)))}e.clampScroll=Dt;function Jt(){var U;return typeof window>"u"?!1:!((U=window.matchMedia)!=null&&U.call(window,"(hover: none) and (pointer: coarse)").matches)}function Qt(U=!1){t.nextTick(()=>{const W=lt.value;if(W){if(!e.editingCell.value&&!Jt()){document.activeElement===W&&W.blur();return}W.focus({preventScroll:!0}),U&&W.select()}})}function $n(){Qt()}function Zt(){var W;const U=e.selection.value;if(U){l.saveUndo();for(let X=U.startRow;X<=U.endRow;X++)e.rowHeights.value[X]=void 0;(W=e.scheduleRender)==null||W.call(e),H()}}function Vn(){var W;const U=e.selection.value;if(U){l.saveUndo();for(let X=U.startCol;X<=U.endCol;X++)e.colWidths.value[X]=100;(W=e.scheduleRender)==null||W.call(e),H()}}return{deleteRows:i,insertRows:r,insertCols:d,deleteCols:c,sortSelectedColumns:G,canSortColumns:B,sortMenuOpen:Ee,cachedSortOrder:Ae,onSortMenuToggle:ce,onSortChange:ae,applyCachedSort:qe,sortConfirmOpen:te,prepareSortConfirmation:fe,confirmSort:Ie,cancelSortConfirmation:me,sheets:se,activeSheetIndex:de,saveSheet:we,loadSheet:Re,switchSheet:Ke,addSheet:We,removeSheet:rt,renameSheet:je,dupSheet:A,moveSheet:K,sheetCount:$,mkSheet:xe,emitModelData:H,scheduleOptEmit:Y,themeColors:ve,outerStyle:ze,toolbarThemeVars:it,wrapperRef:Fe,canvasRef:v,freezeCanvasRef:Z,editInputRef:lt,formulaBarRef:wt,viewSize:ft,maxScrollX:sn,maxScrollY:mn,clampScroll:Dt,canFocusHiddenEditor:Jt,focusEditInput:Qt,onCanvasFocus:$n,resetRowHeight:Zt,resetColWidth:Vn,modelData:x}}function Ni(e,l){let n=-1,o=-1;const a=(r,d)=>{Number.isInteger(r)&&r>=0&&r>n&&(n=r),Number.isInteger(d)&&d>=0&&d>o&&(o=d)},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 d=r.indexOf(",");d<0||a(Number(r.slice(0,d)),Number(r.slice(d+1)))}for(const r of Object.values(e.merges??{}))i(r);if(e.colWidths)for(const[r,d]of Object.entries(e.colWidths)){const c=Number(r);Number.isInteger(c)&&c>=0&&d>=30&&a(c,-1)}if(e.rowHeights)for(const[r,d]of Object.entries(e.rowHeights)){const c=Number(r);Number.isInteger(c)&&c>=0&&d!=null&&d>=24&&a(-1,c)}for(const r of e.conditionalFormats??[])for(const d of r.ranges??[])i(d);for(const r of e.dataValidations??[])for(const d of r.ranges??[])i(d);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 Bi(e){return!!e&&e.width!==void 0&&e.width>0}function Pt(e,l,n,o){const a=Bi(e),i=Bi(l);if(!a&&!i)return;if(a&&!i)return e;if(!a&&i)return l;const r=!!e.owner,d=!!l.owner;if(r&&!d)return e;if(d&&!r)return l;const c=e.width??0,C=l.width??0;return c>C?e:C>c?l:e}function xi(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,d=a.length?Math.max(...a):0;let c=0;for(const C in l){const h=C.indexOf(",");if(h<0)continue;const S=parseInt(C.substring(h+1),10);S>c&&(c=S)}return{range:{startCol:r,startRow:0,endCol:d,endRow:Math.max(0,c)},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 i2(e,l,n,o,a){let i=!1,r=null,d=1,c,C=()=>{},h=()=>{},S=()=>{};function m(){i||(i=!0,requestAnimationFrame(()=>{i=!1,O(),L()}))}e.scheduleRender=m;function M(u){const{frozenColumnsWidth:y}=e.getFrozenMetrics(),D=y>0&&u<ce()+y?u-ce():u-ce()+e.scrollX.value;return e.hitCol(D)}function E(u){const{frozenRowsHeight:y}=e.getFrozenMetrics(),D=y>0&&u<ae()+y?u-ae():u-ae()+e.scrollY.value;return e.hitRow(D)}let B=gi(e.props.theme);function G(u,y,D,j,T,P,ee,Q){const ue=va(Q,P);if(!ue){D===T?u.fillRect(y,D,j-y,P):u.fillRect(y,D,P,T-D);return}if(u.save(),u.strokeStyle=ee,u.lineWidth=P,u.lineCap=Q==="dotted"?"round":"butt",u.setLineDash(ue),u.beginPath(),D===T){const w=D+P/2;u.moveTo(y,w),u.lineTo(j,w)}else{const w=y+P/2;u.moveTo(w,D),u.lineTo(w,T)}u.stroke(),u.setLineDash([]),u.restore()}const te=14,ge=9,fe=16,Ie=Math.min(ge-1,9);function me(u){return 0}const Ee=()=>me(),Ae=()=>me(),ce=()=>52+Ee(),ae=()=>24+Ae();function qe(u,y){return fe+2+(y-u.level)*ge}function ut(u,y){return 3+(y-u.level)*ge}function J(u,y){const D=new Int8Array(y).fill(-1);if(!u.length)return D;const j=[...u].sort((P,ee)=>P.start-ee.start),T=new Map;j.forEach((P,ee)=>T.set(P.id,ee%2));for(const P of j){const ee=T.get(P.id),Q=Math.min(P.end,y-1);for(let ue=Math.max(0,P.start);ue<=Q;ue++)D[ue]===-1&&(D[ue]=ee)}return D}function O(){const u=o.wrapperRef.value,y=o.canvasRef.value;if(!u||!y||(r=y.getContext("2d"),!r))return;d=window.devicePixelRatio||1;const D=u.getBoundingClientRect(),j=D.width,T=D.height;o.viewSize.w=j,o.viewSize.h=T,y.width=j*d,y.height=T*d,y.style.width=j+"px",y.style.height=T+"px",r.setTransform(d,0,0,d,0,0);const P=e.scrollX.value,ee=e.scrollY.value,Q=52,ue=24,w=Ee(),s=Ae(),f=Q+w,b=ue+s,R=o.themeColors.value,I=e.getFilter(),ne=e.colPositions.value,ie=e.rowPositions.value,ye=J(e.getRowOutlines(),e.rowCount),ke=J(e.getColumnOutlines(),e.colCount),{frozenRowsHeight:Ue,frozenColumnsWidth:_e}=e.getFrozenMetrics(),Xe=f+_e,Qe=b+Ue,ht=Math.max(0,j-f-11-_e),Ct=Math.max(0,T-b-11-Ue),qt=Math.max(0,e.freeze.cols-1),$t=Math.max(0,e.freeze.rows-1),Yt=Math.max(e.freeze.cols,e.hitCol(_e+P));let nn=Yt;for(let _=Yt;_<e.colCount&&!(f+ne[_]-P>=j);_++)nn=_;const un=Math.max(e.freeze.rows,e.hitRow(Ue+ee));let oo=un;for(let _=un;_<e.rowCount&&!(b+ie[_]-ee>=T);_++)oo=_;let hn=Yt,on=nn,Un=un,Rn=oo;_e>0&&(hn=0,on=Math.max(on,qt)),Ue>0&&(Un=0,Rn=Math.max(Rn,$t));let _o=hn,Pn=Un;for(const _ in e.merges){const Oe=e.merges[_];Oe&&(Oe.startRow>Rn||Oe.endRow<Un||Oe.startCol>on||Oe.endCol<hn||(Oe.startCol<_o&&(_o=Oe.startCol),Oe.startRow<Pn&&(Pn=Oe.startRow)))}const Ho=new Array(Pn);for(let _=Pn;_<=Rn;_++)Ho[_]=ie[_+1]-ie[_];r.fillStyle=R.bg,r.fillRect(0,0,j,T),r.fillStyle=R.gridBg,r.fillRect(f,b,j-f,T-b);const St=e.selection.value,gt=e.editingCell.value;C=(_,Oe,Ge,yt,It,jt)=>{const Rt=e.dataValidations.length>0;for(let Be=yt;Be<=It;Be++)if(!e.isRowCollapsed(Be))for(let Pe=Oe;Pe<=Ge;Pe++){if(e.isColumnCollapsed(Pe)||e.findMerge(Pe,Be))continue;const Ze=e.cellToScreenRect(Be,Pe),Ye=Ze.x,dt=Ze.y,st=Ze.width,nt=Ze.height;if(Ye+st<f||dt+nt<b||Ye>j||dt>T)continue;const Ht=e.findHighlight?e.findHighlight(Pe,Be):null,Wt=e.resolveStyle(e.cells[e.cellKey(Pe,Be)]),Mt=typeof(Wt==null?void 0:Wt.backgroundColor)=="string"?Wt.backgroundColor:"";Mt&&(_.fillStyle=Mt,_.fillRect(Ye,dt,st,nt));const ct=e.resolveConditionalFormat(Pe,Be);if(ct!=null&&ct.backgroundColor&&(_.fillStyle=ct.backgroundColor,_.fillRect(Ye,dt,st,nt)),Ht&&(_.fillStyle=Ht==="active"?R.findActiveBg:R.findMatchBg,_.fillRect(Ye,dt,st,nt)),e.isSelected(Pe,Be)&&(_.fillStyle=R.selectionBg,e.selectionMode.value==="row"||e.selectionMode.value==="col"?_.fillRect(Ye,dt,(ne[Pe+1]??0)-ne[Pe],jt[Be]):_.fillRect(Ye,dt,st,nt)),e.activeCell.value.col===Pe&&e.activeCell.value.row===Be&&(_.strokeStyle=R.activeCellBorder,_.lineWidth=2,_.strokeRect(Ye+1,dt+1,st-2,nt-2)),Ht==="active"&&(_.strokeStyle=R.findActiveBg,_.lineWidth=2,_.strokeRect(Ye+1,dt+1,st-2,nt-2)),_.strokeStyle=R.gridLine,_.lineWidth=.5,_.strokeRect(Ye+.25,dt+.25,st-.5,nt-.5),!(gt&&gt.col===Pe&&gt.row===Be)){const De=e.resolveStyle(e.cells[e.cellKey(Pe,Be)]),he=e.getCellValue(Pe,Be),ot=typeof(De==null?void 0:De.numberFormat)=="string"?De.numberFormat:"",Je=he?In(he,ot,e.locale.value):"";if(Je){const mt=e.cellFontSize(Pe,Be),kt=typeof(De==null?void 0:De.fontFamily)=="string"&&De.fontFamily?De.fontFamily:Vo,Tt=(De==null?void 0:De.fontWeight)==="bold"||(ct==null?void 0:ct.fontWeight)==="bold"?"bold":"normal",gn=(De==null?void 0:De.fontStyle)==="italic"||(ct==null?void 0:ct.fontStyle)==="italic"?"italic":"normal",qn=(De==null?void 0:De.underline)==="underline"||(ct==null?void 0:ct.underline)==="underline",lo=(De==null?void 0:De.strikethrough)==="line-through"||(ct==null?void 0:ct.strikethrough)==="line-through",bn=(ct==null?void 0:ct.color)||(typeof(De==null?void 0:De.color)=="string"?De.color:""),On=typeof(De==null?void 0:De.textAlign)=="string"?De.textAlign:br(he,ot)?"right":"left",yn=typeof(De==null?void 0:De.verticalAlign)=="string"?De.verticalAlign:"top";_.fillStyle=bn||R.cellText,_.font=`${gn} ${Tt} ${mt}px ${kt}`,_.textBaseline="alphabetic",_.save(),_.beginPath(),_.rect(Ye+5,dt+1,st-10,nt-2),_.clip();const ro=(De==null?void 0:De.wrap)==="wrap";let ln=st-10;I&&Be===I.range.startRow&&Pe>=I.range.startCol&&Pe<=I.range.endCol&&(ln=st-10-mn);let Mn=Je;const Sn=!ro&&da(ot),Yn=Je===Tl||ua(he,ot);if(Yn||Sn){if(Yn){const Uo=Math.max(1,_.measureText("#").width),xl=Math.max(1,Math.floor(ln/Uo));Mn="#".repeat(xl)}else if(e.getWrappedLines(_,Je,1e9,!1).some(vo=>vo&&_.measureText(vo).width>ln)){const vo=Math.max(1,_.measureText("#").width),cl=Math.max(1,Math.floor(ln/vo));Mn="#".repeat(cl)}}const fn=e.getWrappedLines(_,Mn,ln,ro),{ascent:wo,descent:sl}=e.measureFontMetrics(kt,mt,Tt,gn),dr=wo+sl,O2=fn.length*dr;let ur;yn==="middle"?ur=dt+(nt-O2)/2+wo:yn==="bottom"?ur=dt+nt-e.BASE_CELL_VPAD-sl-(fn.length-1)*dr:ur=dt+e.BASE_CELL_VPAD+wo;for(let Uo=0;Uo<fn.length;Uo++){const xl=fn[Uo],vo=ur+Uo*dr,cl=_.measureText(xl);let To;if(On==="center"?To=Ye+st/2-cl.width/2:On==="right"?To=Ye+st-5-cl.width:To=Ye+5,_.fillText(xl,To,vo),qn&&(_.strokeStyle=bn||R.cellText,_.lineWidth=1,_.beginPath(),_.moveTo(To,vo+sl+1),_.lineTo(To+cl.width,vo+sl+1),_.stroke()),lo){_.strokeStyle=bn||R.cellText,_.lineWidth=1;const Di=vo-wo+dr*.42;_.beginPath(),_.moveTo(To,Di),_.lineTo(To+cl.width,Di),_.stroke()}}_.restore()}}if(I&&Be===I.range.startRow&&Pe>=I.range.startCol&&Pe<=I.range.endCol&&Ne(_,Ye,dt,st,nt,$a(I.columns[Pe]),R),Rt&&e.getListValidation(Be,Pe)){const De=e.activeCell.value.col===Pe&&e.activeCell.value.row===Be;Zt(_,Ye,dt,st,nt,De||e.isSelected(Pe,Be),R)}e.hasNote(Be,Pe)&&Vn(_,Ye,dt,st,nt)}};const Et=(_,Oe,Ge)=>{const yt=e.findMerge(_,Oe);return yt?e.getCellBorderSide(e.cells[yt.anchor],Ge):e.getCellBorderSide(e.cells[e.cellKey(_,Oe)],Ge)};h=(_,Oe,Ge,yt,It,jt)=>{_.fillStyle=B;for(let Rt=yt;Rt<=It;Rt++)if(!e.isRowCollapsed(Rt))for(let Be=Oe;Be<=Ge;Be++){if(e.isColumnCollapsed(Be)||e.findMerge(Be,Rt))continue;const at=e.cellToScreenRect(Rt,Be),Ze=at.x,Ye=at.y,dt=at.width,st=at.height;if(Ze+dt<f||Ye+st<b||Ze>j||Ye>T)continue;const nt=e.cells[e.cellKey(Be,Rt)],Ht={top:e.getCellBorderSide(nt,"top"),right:e.getCellBorderSide(nt,"right"),bottom:e.getCellBorderSide(nt,"bottom"),left:e.getCellBorderSide(nt,"left")},Wt={top:Et(Be,Rt-1,"bottom"),left:Et(Be-1,Rt,"right"),bottom:Et(Be,Rt+1,"top"),right:Et(Be+1,Rt,"left")},Mt=Pt(Wt.top,Ht.top),ct=Pt(Wt.left,Ht.left),De=Pt(Ht.bottom,Wt.bottom),he=Pt(Ht.right,Wt.right),ot=(Mt==null?void 0:Mt.width)??0,Je=(ct==null?void 0:ct.width)??0,mt=(De==null?void 0:De.width)??0,kt=(he==null?void 0:he.width)??0;ot>0&&G(_,Ze,Ye,Ze+dt,Ye,ot,(Mt==null?void 0:Mt.color)||B,rn(Mt==null?void 0:Mt.style)),mt>0&&G(_,Ze,Ye+st-mt,Ze+dt,Ye+st-mt,mt,(De==null?void 0:De.color)||B,rn(De==null?void 0:De.style)),Je>0&&G(_,Ze,Ye,Ze,Ye+st,Je,(ct==null?void 0:ct.color)||B,rn(ct==null?void 0:ct.style)),kt>0&&G(_,Ze+dt-kt,Ye,Ze+dt-kt,Ye+st,kt,(he==null?void 0:he.color)||B,rn(he==null?void 0:he.style));const Tt=Be>0&&e.isColumnCollapsed(Be-1),gn=Be<e.colCount-1&&e.isColumnCollapsed(Be+1),qn=Rt>0&&e.isRowCollapsed(Rt-1),lo=Rt<e.rowCount-1&&e.isRowCollapsed(Rt+1),bn=Be<e.freeze.cols&&(()=>{try{const yn=_.canvas;return yn?String(yn.className||"")==="grid-canvas":!1}catch{return!1}})(),On=Rt<e.freeze.rows&&(()=>{try{const yn=_.canvas;return yn?String(yn.className||"")==="grid-canvas":!1}catch{return!1}})();ot>0&&Je>0&&!Tt&&!qn&&(_.fillStyle=(Mt==null?void 0:Mt.color)||(ct==null?void 0:ct.color)||B,_.fillRect(Ze-Je,Ye-ot,Je,ot)),ot>0&&kt>0&&!gn&&!qn&&!bn&&(_.fillStyle=(Mt==null?void 0:Mt.color)||(he==null?void 0:he.color)||B,_.fillRect(Ze+dt,Ye-ot,kt,ot)),mt>0&&Je>0&&!Tt&&!lo&&!On&&(_.fillStyle=(De==null?void 0:De.color)||(ct==null?void 0:ct.color)||B,_.fillRect(Ze-Je,Ye+st,Je,mt)),mt>0&&kt>0&&!gn&&!lo&&!bn&&!On&&(_.fillStyle=(De==null?void 0:De.color)||(he==null?void 0:he.color)||B,_.fillRect(Ze+dt,Ye+st,kt,mt))}};const Kn=(_,Oe,Ge,yt,It,jt,Rt)=>{const Be=e.resolveStyle(e.cells[e.cellKey(Oe,Ge)]),Pe=e.getCellValue(Oe,Ge),at=typeof(Be==null?void 0:Be.numberFormat)=="string"?Be.numberFormat:"",Ze=Pe?In(Pe,at,e.locale.value):"";if(!Ze||yt-10<=0||It-2<=0)return;const dt=e.cellFontSize(Oe,Ge),st=typeof(Be==null?void 0:Be.fontFamily)=="string"&&Be.fontFamily?Be.fontFamily:Vo,nt=e.resolveConditionalFormat(Oe,Ge),Ht=(Be==null?void 0:Be.fontWeight)==="bold"||(nt==null?void 0:nt.fontWeight)==="bold"?"bold":"normal",Wt=(Be==null?void 0:Be.fontStyle)==="italic"||(nt==null?void 0:nt.fontStyle)==="italic"?"italic":"normal",Mt=(Be==null?void 0:Be.underline)==="underline"||(nt==null?void 0:nt.underline)==="underline",ct=(Be==null?void 0:Be.strikethrough)==="line-through"||(nt==null?void 0:nt.strikethrough)==="line-through",De=(nt==null?void 0:nt.color)||(typeof(Be==null?void 0:Be.color)=="string"?Be.color:""),he=typeof(Be==null?void 0:Be.textAlign)=="string"?Be.textAlign:br(Pe,at)?"right":"left",ot=typeof(Be==null?void 0:Be.verticalAlign)=="string"?Be.verticalAlign:"top";_.fillStyle=De||R.cellText,_.font=`${Wt} ${Ht} ${dt}px ${st}`,_.textBaseline="alphabetic",_.save(),_.beginPath(),_.rect(jt+5,Rt+1,yt-10,It-2),_.clip();const Je=(Be==null?void 0:Be.wrap)==="wrap",mt=yt-10;let kt=Ze;const Tt=!Je&&da(at),gn=Ze===Tl||ua(Pe,at);if(gn||Tt){if(gn){const ln=Math.max(1,_.measureText("#").width),Mn=Math.max(1,Math.floor(mt/ln));kt="#".repeat(Mn)}else if(e.getWrappedLines(_,Ze,1e9,!1).some(Sn=>Sn&&_.measureText(Sn).width>mt)){const Sn=Math.max(1,_.measureText("#").width),Yn=Math.max(1,Math.floor(mt/Sn));kt="#".repeat(Yn)}}const qn=e.getWrappedLines(_,kt,mt,Je),{ascent:lo,descent:bn}=e.measureFontMetrics(st,dt,Ht,Wt),On=lo+bn,yn=qn.length*On;let ro;ot==="middle"?ro=Rt+(It-yn)/2+lo:ot==="bottom"?ro=Rt+It-e.BASE_CELL_VPAD-bn-(qn.length-1)*On:ro=Rt+e.BASE_CELL_VPAD+lo;for(let ln=0;ln<qn.length;ln++){const Mn=qn[ln],Sn=ro+ln*On,Yn=_.measureText(Mn);let fn;if(he==="center"?fn=jt+yt/2-Yn.width/2:he==="right"?fn=jt+yt-5-Yn.width:fn=jt+5,_.fillText(Mn,fn,Sn),Mt&&(_.strokeStyle=De||R.cellText,_.lineWidth=1,_.beginPath(),_.moveTo(fn,Sn+bn+1),_.lineTo(fn+Yn.width,Sn+bn+1),_.stroke()),ct){_.strokeStyle=De||R.cellText,_.lineWidth=1;const wo=Sn-lo+On*.42;_.beginPath(),_.moveTo(fn,wo),_.lineTo(fn+Yn.width,wo),_.stroke()}}_.restore()},Gn=(_,Oe,Ge,yt,It,jt,Rt,Be)=>{const Pe=Oe.startCol,at=Oe.endCol,Ze=Oe.startRow,Ye=Oe.endRow,dt=yt,st=jt,nt=Rt&&at+1===e.freeze.cols&&e.freeze.cols<e.colCount&&e.isColumnCollapsed(e.freeze.cols),Ht=Rt&&at>=e.freeze.cols||nt,Wt=Be&&Ye+1===e.freeze.rows&&e.freeze.rows<e.rowCount&&e.isRowCollapsed(e.freeze.rows),Mt=Be&&Ye>=e.freeze.rows||Wt,ct=e.cells[e.cellKey(Pe,Ze)],De={top:e.getCellBorderSide(ct,"top"),right:e.getCellBorderSide(ct,"right"),bottom:e.getCellBorderSide(ct,"bottom"),left:e.getCellBorderSide(ct,"left")};_.fillStyle=B;for(let he=Pe;he<=at;he++){if(Rt&&he>=e.freeze.cols||e.isSameMergeInternal(he,Ze-1,he,Ze))continue;const ot=Et(he,Ze-1,"bottom"),Je=Pt(ot,De.top);if(Je&&Je.width&&Je.width>0){const mt=he<e.freeze.cols?Q+ne[he]:Q+ne[he]-P,kt=(ne[he+1]??0)-ne[he];G(_,mt,dt,mt+kt,dt,Je.width,Je.color||B,rn(Je.style))}}if(!Mt)for(let he=Pe;he<=at;he++){if(Rt&&he>=e.freeze.cols||e.isSameMergeInternal(he,Ye,he,Ye+1))continue;const ot=Et(he,Ye+1,"top"),Je=Pt(De.bottom,ot);if(Je&&Je.width&&Je.width>0){const mt=he<e.freeze.cols?Q+ne[he]:Q+ne[he]-P,kt=(ne[he+1]??0)-ne[he],Tt=dt+st-Je.width;G(_,mt,Tt,mt+kt,Tt,Je.width,Je.color||B,rn(Je.style))}}for(let he=Ze;he<=Ye;he++){if(Be&&he>=e.freeze.rows||e.isSameMergeInternal(Pe-1,he,Pe,he))continue;const ot=Et(Pe-1,he,"right"),Je=Pt(ot,De.left);if(Je&&Je.width&&Je.width>0){const mt=he<e.freeze.rows?ue+ie[he]:ue+ie[he]-ee,kt=ie[he+1]-ie[he];G(_,Ge,mt,Ge,mt+kt,Je.width,Je.color||B,rn(Je.style))}}if(!Ht)for(let he=Ze;he<=Ye;he++){if(Be&&he>=e.freeze.rows||e.isSameMergeInternal(at,he,at+1,he))continue;const ot=Et(at+1,he,"left"),Je=Pt(De.right,ot);if(Je&&Je.width&&Je.width>0){const mt=he<e.freeze.rows?ue+ie[he]:ue+ie[he]-ee,kt=ie[he+1]-ie[he],Tt=Ge+It-Je.width;G(_,Tt,mt,Tt,mt+kt,Je.width,Je.color||B,rn(Je.style))}}{const he=e.isSameMergeInternal(Pe,Ze-1,Pe,Ze)?De.top:Pt(Et(Pe,Ze-1,"bottom"),De.top),ot=e.isSameMergeInternal(Pe-1,Ze,Pe,Ze)?De.left:Pt(Et(Pe-1,Ze,"right"),De.left),Je=(he==null?void 0:he.width)??0,mt=(ot==null?void 0:ot.width)??0,kt=Pe>0&&e.isColumnCollapsed(Pe-1),Tt=Ze>0&&e.isRowCollapsed(Ze-1);Je>0&&mt>0&&!kt&&!Tt&&(_.fillStyle=(he==null?void 0:he.color)||(ot==null?void 0:ot.color)||B,_.fillRect(Ge-mt,yt-Je,mt,Je))}if(!Ht){const he=e.isSameMergeInternal(at,Ze-1,at,Ze)?De.top:Pt(Et(at,Ze-1,"bottom"),De.top),ot=e.isSameMergeInternal(at,Ze,at+1,Ze)?De.right:Pt(De.right,Et(at+1,Ze,"left")),Je=(he==null?void 0:he.width)??0,mt=(ot==null?void 0:ot.width)??0,kt=at<e.colCount-1&&e.isColumnCollapsed(at+1),Tt=Ze>0&&e.isRowCollapsed(Ze-1);Je>0&&mt>0&&!kt&&!Tt&&(_.fillStyle=(he==null?void 0:he.color)||(ot==null?void 0:ot.color)||B,_.fillRect(Ge+It,yt-Je,mt,Je))}if(!Mt){const he=e.isSameMergeInternal(Pe,Ye,Pe,Ye+1)?De.bottom:Pt(De.bottom,Et(Pe,Ye+1,"top")),ot=e.isSameMergeInternal(Pe-1,Ye,Pe,Ye)?De.left:Pt(Et(Pe-1,Ye,"right"),De.left),Je=(he==null?void 0:he.width)??0,mt=(ot==null?void 0:ot.width)??0,kt=Pe>0&&e.isColumnCollapsed(Pe-1),Tt=Ye<e.rowCount-1&&e.isRowCollapsed(Ye+1);Je>0&&mt>0&&!kt&&!Tt&&(_.fillStyle=(he==null?void 0:he.color)||(ot==null?void 0:ot.color)||B,_.fillRect(Ge-mt,yt+jt,mt,Je))}if(!Ht&&!Mt){const he=e.isSameMergeInternal(at,Ye,at,Ye+1)?De.bottom:Pt(De.bottom,Et(at,Ye+1,"top")),ot=e.isSameMergeInternal(at,Ye,at+1,Ye)?De.right:Pt(De.right,Et(at+1,Ye,"left")),Je=(he==null?void 0:he.width)??0,mt=(ot==null?void 0:ot.width)??0,kt=at<e.colCount-1&&e.isColumnCollapsed(at+1),Tt=Ye<e.rowCount-1&&e.isRowCollapsed(Ye+1);Je>0&&mt>0&&!kt&&!Tt&&(_.fillStyle=(he==null?void 0:he.color)||(ot==null?void 0:ot.color)||B,_.fillRect(Ge+It,yt+jt,mt,Je))}};S=(_,Oe,Ge,yt,It)=>{var at,Ze;const jt=Oe+yt,Rt=Ge+It,Be=Oe<Xe,Pe=Ge<Qe;for(const Ye in e.merges){const dt=e.merges[Ye];if(!dt)continue;const st=dt.startCol,nt=dt.startRow,Ht=dt.endCol,Wt=dt.endRow,Mt=e.cellToScreenRect(nt,st),ct=e.cellToScreenRect(Wt,Ht),De=Mt.x,he=Mt.y,ot=ct.x+ct.width-De,Je=ct.y+ct.height-he,mt=Be&&Ht>=e.freeze.cols?Math.min(jt,Xe):Math.min(De+ot,jt),kt=Pe&&Wt>=e.freeze.rows?Math.min(Rt,Qe):Math.min(he+Je,Rt),Tt=Math.max(De,Oe),gn=Math.max(he,Ge);if(mt<=Tt||kt<=gn)continue;const qn=(at=e.resolveStyle(e.cells[e.cellKey(st,nt)]))==null?void 0:at.backgroundColor,bn=((Ze=e.resolveConditionalFormat(st,nt))==null?void 0:Ze.backgroundColor)||qn;bn&&(_.fillStyle=bn,_.fillRect(Tt,gn,mt-Tt,kt-gn)),e.isSelected(st,nt)&&(_.fillStyle=R.selectionBg,_.fillRect(Tt,gn,mt-Tt,kt-gn)),_.strokeStyle=R.gridLine,_.lineWidth=.5;const On=De+.25,yn=he+.25,ro=mt-De-.5,ln=kt-he-.5;if(ro>0&&ln>0&&_.strokeRect(On,yn,ro,ln),Gn(_,dt,De,he,ot,Je,Be,Pe),e.activeCell.value.col===st&&e.activeCell.value.row===nt&&(_.strokeStyle=R.activeCellBorder,_.lineWidth=2,_.strokeRect(De+1,he+1,ot-2,Je-2)),e.getListValidation(nt,st)){const Mn=e.activeCell.value.col===st&&e.activeCell.value.row===nt;Zt(_,De,he,ot,Je,Mn,R)}if(e.hasNote(nt,st)&&Vn(_,De,he,ot,Je),!(e.editingCell.value&&e.editingCell.value.col===st&&e.editingCell.value.row===nt)){const Mn=ne[Ht+1]-ne[st],Sn=ie[Wt+1]-ie[nt],Yn=st<e.freeze.cols,fn=nt<e.freeze.rows,wo=Be?De:Yn?De-P:De,sl=Pe?he:fn?he-ee:he;Kn(_,st,nt,Mn,Sn,wo,sl)}}},r.save(),r.beginPath();const Wo=_e>0?2:0,zt=Ue>0?2:0;r.rect(Xe-Wo,Qe-zt,ht+Wo,Ct+zt),r.clip(),C(r,_o,on,Pn,Rn,Ho),h(r,_o,on,Pn,Rn,Ho),S(r,Xe,Qe,ht,Ct),r.restore(),_e>0&&(r.strokeStyle=R.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(Xe+.5,ue),r.lineTo(Xe+.5,T),r.stroke()),Ue>0&&(r.strokeStyle=R.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(Q,Qe+.5),r.lineTo(j,Qe+.5),r.stroke()),r.fillStyle=R.headerBg,r.fillRect(f,s,j-f,ue);for(let _=Yt;_<=nn;_++){const Oe=f+ne[_]-P;if(e.isColumnCollapsed(_))continue;const Ge=(ne[_+1]??0)-ne[_];if(Oe+Ge<f||Oe>j)continue;const yt=ke[_];yt===0?(r.fillStyle=R.outlineGroupBg1,r.fillRect(Oe,s,Ge,ue)):yt===1&&(r.fillStyle=R.outlineGroupBg2,r.fillRect(Oe,s,Ge,ue)),St&&_>=St.startCol&&_<=St.endCol&&(r.fillStyle=R.selectionBg,r.fillRect(Oe,s,Ge,ue)),r.strokeStyle=R.headerBorder,r.lineWidth=.5,r.strokeRect(Oe+.25,s+.25,Ge-.5,ue-.5),St&&_>=St.startCol&&_<=St.endCol&&(r.strokeStyle=R.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(Oe,s+ue-1),r.lineTo(Oe+Ge,s+ue-1),r.stroke()),r.fillStyle=R.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(pt(_),Oe+Ge/2,s+ue/2)}if(_e>0){r.fillStyle=R.headerBg,r.fillRect(f,s,_e,ue);for(let _=0;_<=qt;_++){const Oe=f+ne[_];if(e.isColumnCollapsed(_))continue;const Ge=(ne[_+1]??0)-ne[_];Oe+Ge<f||Oe>j||(St&&_>=St.startCol&&_<=St.endCol&&(r.fillStyle=R.selectionBg,r.fillRect(Oe,s,Ge,ue)),r.strokeStyle=R.headerBorder,r.lineWidth=.5,r.strokeRect(Oe+.25,s+.25,Ge-.5,ue-.5),St&&_>=St.startCol&&_<=St.endCol&&(r.strokeStyle=R.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(Oe,s+ue-1),r.lineTo(Oe+Ge,s+ue-1),r.stroke()),r.fillStyle=R.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(pt(_),Oe+Ge/2,s+ue/2))}}r.strokeStyle=R.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(f,b+.5),r.lineTo(j,b+.5),r.stroke(),r.fillStyle=R.headerBg,r.fillRect(0,b,f,T-b);for(let _=un;_<=oo;_++){if(e.isRowHidden(_))continue;const Oe=b+ie[_]-ee,Ge=Ho[_];if(Oe+Ge<b||Oe>T)continue;const yt=ye[_];yt===0?(r.fillStyle=R.outlineGroupBg1,r.fillRect(w,Oe,Q,Ge)):yt===1&&(r.fillStyle=R.outlineGroupBg2,r.fillRect(w,Oe,Q,Ge)),St&&_>=St.startRow&&_<=St.endRow&&(r.fillStyle=R.selectionBg,r.fillRect(w,Oe,Q,Ge)),r.strokeStyle=R.headerBorder,r.lineWidth=.5,r.strokeRect(w+.25,Oe+.25,Q-.5,Ge-.5),St&&_>=St.startRow&&_<=St.endRow&&(r.strokeStyle=R.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(w+Q-1,Oe),r.lineTo(w+Q-1,Oe+Ge),r.stroke()),r.fillStyle=R.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(String(_+1),w+Q/2,Oe+Ge/2+.5)}if(Ue>0){r.fillStyle=R.headerBg,r.fillRect(0,b,f,Ue);for(let _=0;_<=$t;_++){if(e.isRowHidden(_))continue;const Oe=b+ie[_],Ge=Ho[_];Oe+Ge<b||Oe>T||(St&&_>=St.startRow&&_<=St.endRow&&(r.fillStyle=R.selectionBg,r.fillRect(w,Oe,Q,Ge)),r.strokeStyle=R.headerBorder,r.lineWidth=.5,r.strokeRect(w+.25,Oe+.25,Q-.5,Ge-.5),St&&_>=St.startRow&&_<=St.endRow&&(r.strokeStyle=R.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(w+Q-1,Oe),r.lineTo(w+Q-1,Oe+Ge),r.stroke()),r.fillStyle=R.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(String(_+1),w+Q/2,Oe+Ge/2+.5))}}r.strokeStyle=R.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(f+.5,b),r.lineTo(f+.5,T),r.stroke(),r.fillStyle=R.headerBg,r.fillRect(w,s,Q,ue),r.strokeStyle=R.headerSep,r.lineWidth=1,r.strokeRect(w+.5,s+.5,Q-1,ue-1);const _t=Math.min(Q,ue)*.32;r.fillStyle=R.activeCellBorder,r.beginPath(),r.moveTo(w+Q-1,s+ue-1-_t),r.lineTo(w+Q-1-_t,s+ue-1),r.lineTo(w+Q-1,s+ue-1),r.closePath(),r.fill();const Co=e.getOutlineLevel("row"),il=e.getOutlineLevel("column");if(e.getRowOutlines().length)for(const _ of e.getRowOutlines()){const Oe=qe(_,Co),Ge=b+ie[_.start]-ee,yt=Oe-Ie/2,It=Ge-Ie/2;r.fillStyle=R.headerBg,r.strokeStyle=R.headerText,r.lineWidth=1,$n(r,Math.round(yt),Math.round(It),Ie,Ie,2),r.fill(),r.stroke(),r.strokeStyle=R.headerText,r.lineWidth=1.4,r.beginPath(),r.moveTo(Oe-2,Ge),r.lineTo(Oe+2,Ge),r.stroke(),_.collapsed&&(r.beginPath(),r.moveTo(Oe,Ge-2),r.lineTo(Oe,Ge+2),r.stroke())}if(e.getColumnOutlines().length)for(const _ of e.getColumnOutlines()){const Oe=ut(_,il),Ge=f+ne[_.start]-P,yt=Ge-Ie/2,It=Oe-Ie/2;r.fillStyle=R.headerBg,r.strokeStyle=R.headerText,r.lineWidth=1,$n(r,Math.round(yt),Math.round(It),Ie,Ie,2),r.fill(),r.stroke(),r.strokeStyle=R.headerText,r.lineWidth=1.4,r.beginPath(),r.moveTo(Ge-2,Oe),r.lineTo(Ge+2,Oe),r.stroke(),_.collapsed&&(r.beginPath(),r.moveTo(Ge,Oe-2),r.lineTo(Ge,Oe+2),r.stroke())}le(r,R),$e(r,R)}function L(){const u=o.freezeCanvasRef.value,y=o.wrapperRef.value;if(!u||!y)return;const D=u.getContext("2d");if(!D)return;const j=y.getBoundingClientRect(),T=j.width,P=j.height,ee=52,Q=24,ue=Ee(),w=Ae(),s=ee+ue,f=Q+w,b=o.themeColors.value,R=e.colPositions.value,I=e.rowPositions.value,ne=e.scrollX.value,ie=e.scrollY.value;u.width=T*d,u.height=P*d,u.style.width=T+"px",u.style.height=P+"px",D.setTransform(d,0,0,d,0,0),D.clearRect(0,0,T,P);const{frozenRowsHeight:ye,frozenColumnsWidth:ke}=e.getFrozenMetrics(),Ue=s+ke,_e=f+ye,Xe=Math.max(0,T-s-11-ke),Qe=Math.max(0,P-f-11-ye),ht=Math.max(0,e.freeze.cols-1),Ct=Math.max(0,e.freeze.rows-1),qt=Math.max(e.freeze.cols,e.hitCol(ke+ne));let $t=qt;for(let gt=qt;gt<e.colCount&&!(s+R[gt]-ne>=T);gt++)$t=gt;const Yt=Math.max(e.freeze.rows,e.hitRow(ye+ie));let nn=Yt;for(let gt=Yt;gt<e.rowCount&&!(f+I[gt]-ie>=P);gt++)nn=gt;let un=qt,oo=$t,hn=Yt,on=nn;ke>0&&(un=0,oo=Math.max(oo,ht)),ye>0&&(hn=0,on=Math.max(on,Ct));let Un=un,Rn=hn;for(const gt in e.merges){const Et=e.merges[gt];Et&&(Et.startRow>on||Et.endRow<hn||Et.startCol>oo||Et.endCol<un||(Et.startCol<Un&&(Un=Et.startCol),Et.startRow<Rn&&(Rn=Et.startRow)))}const _o=new Array(Rn);for(let gt=Rn;gt<=on;gt++)_o[gt]=I[gt+1]-I[gt];const Pn=(gt,Et,Kn)=>{const Gn=e.findMerge(gt,Et);return Gn?e.getCellBorderSide(e.cells[Gn.anchor],Kn):e.getCellBorderSide(e.cells[e.cellKey(gt,Et)],Kn)},Ho=(gt,Et,Kn,Gn,Wo)=>{gt.fillStyle=B;for(let zt=Gn;zt<=Wo;zt++)for(let _t=Et;_t<=Kn;_t++){if(e.isRowCollapsed(zt)||e.isColumnCollapsed(_t))continue;const Co=e.findMerge(_t,zt);if(Co&&!(_t===Co.range.startCol&&zt===Co.range.startRow))continue;const il=e.cellToScreenRect(zt,_t),_=il.x,Oe=il.y,Ge=il.width,yt=il.height;if(_+Ge<s||Oe+yt<f||_>T||Oe>P)continue;const It=e.cells[e.cellKey(_t,zt)],jt={top:e.getCellBorderSide(It,"top"),right:e.getCellBorderSide(It,"right"),bottom:e.getCellBorderSide(It,"bottom"),left:e.getCellBorderSide(It,"left")};if(Co)continue;const Rt={top:Pn(_t,zt-1,"bottom"),left:Pn(_t-1,zt,"right"),bottom:Pn(_t,zt+1,"top"),right:Pn(_t+1,zt,"left")},Be=Pt(Rt.top,jt.top),Pe=Pt(Rt.left,jt.left),at=Pt(jt.bottom,Rt.bottom),Ze=Pt(jt.right,Rt.right),Ye=(Be==null?void 0:Be.width)??0,dt=(Pe==null?void 0:Pe.width)??0,st=(at==null?void 0:at.width)??0,nt=(Ze==null?void 0:Ze.width)??0;Ye>0&&G(gt,_,Oe,_+Ge,Oe,Ye,(Be==null?void 0:Be.color)||B,rn(Be==null?void 0:Be.style)),st>0&&G(gt,_,Oe+yt-st,_+Ge,Oe+yt-st,st,(at==null?void 0:at.color)||B,rn(at==null?void 0:at.style)),dt>0&&G(gt,_,Oe,_,Oe+yt,dt,(Pe==null?void 0:Pe.color)||B,rn(Pe==null?void 0:Pe.style)),nt>0&&G(gt,_+Ge-nt,Oe,_+Ge-nt,Oe+yt,nt,(Ze==null?void 0:Ze.color)||B,rn(Ze==null?void 0:Ze.style));const Ht=_t>0&&e.isColumnCollapsed(_t-1),Wt=_t<e.colCount-1&&e.isColumnCollapsed(_t+1),Mt=zt>0&&e.isRowCollapsed(zt-1),ct=zt<e.rowCount-1&&e.isRowCollapsed(zt+1),De=_t<e.freeze.cols,he=zt<e.freeze.rows;Ye>0&&dt>0&&!Ht&&!Mt&&(gt.fillStyle=(Be==null?void 0:Be.color)||(Pe==null?void 0:Pe.color)||B,gt.fillRect(_-dt,Oe-Ye,dt,Ye)),Ye>0&&nt>0&&!Wt&&!Mt&&!De&&(gt.fillStyle=(Be==null?void 0:Be.color)||(Ze==null?void 0:Ze.color)||B,gt.fillRect(_+Ge,Oe-Ye,nt,Ye)),st>0&&dt>0&&!Ht&&!ct&&!he&&(gt.fillStyle=(at==null?void 0:at.color)||(Pe==null?void 0:Pe.color)||B,gt.fillRect(_-dt,Oe+yt,dt,st)),st>0&&nt>0&&!Wt&&!ct&&!De&&!he&&(gt.fillStyle=(at==null?void 0:at.color)||(Ze==null?void 0:Ze.color)||B,gt.fillRect(_+Ge,Oe+yt,nt,st))}},St=(gt,Et,Kn,Gn,Wo,zt,_t,Co)=>{Kn<=0||Gn<=0||(D.save(),D.beginPath(),D.rect(gt,Et,Kn,Gn),D.clip(),D.fillStyle=b.gridBg,D.fillRect(gt,Et,Kn,Gn),C(D,Wo,zt,_t,Co,_o),Ho(D,Wo,zt,_t,Co),S(D,gt,Et,Kn,Gn),D.restore())};ke>0&&ye>0&&St(ee,Q,ke,ye,0,ht,0,Ct),ye>0&&St(Ue,Q,Xe,ye,Un,oo,0,Ct),ke>0&&St(ee,_e,ke,Qe,0,ht,Rn,on),D.strokeStyle=b.headerSep,D.lineWidth=1,ke>0&&(D.beginPath(),D.moveTo(Ue+.5,Q),D.lineTo(Ue+.5,P),D.stroke()),ye>0&&(D.beginPath(),D.moveTo(ee,_e+.5),D.lineTo(T,_e+.5),D.stroke()),D.fillStyle=b.headerBg,D.fillRect(0,0,ee,Q),D.strokeStyle=b.headerSep,D.lineWidth=1,D.strokeRect(.5,.5,ee-.5,Q-.5),le(D,b),$e(D,b)}function le(u,y){const D=e.selection.value;if(!D||e.editingCell.value)return;const j=e.cellToScreenRect(D.endRow,D.endCol),T=j.x+j.width-6/2,P=j.y+j.height-6/2;if(T<ce()||P<ae())return;const{frozenColumnsWidth:ee,frozenRowsHeight:Q}=e.getFrozenMetrics();if(ee>0&&D.endCol>=e.freeze.cols&&T<ce()+ee||Q>0&&D.endRow>=e.freeze.rows&&P<ae()+Q)return;const ue=Nr(D,D,e.merges).ok;u.fillStyle=ue?y.activeCellBorder:y.scrollTrack,u.fillRect(T,P,6,6),u.strokeStyle="#fff",u.lineWidth=1,u.strokeRect(T+.5,P+.5,6-1,6-1)}function $e(u,y){const D=e.autoFillState.value;if(!D.active||!D.preview||!D.targetRange)return;const j=D.targetRange,T=e.cellToScreenRect(j.startRow,j.startCol),P=e.cellToScreenRect(j.endRow,j.endCol),ee=T.x,Q=T.y,ue=P.x+P.width-ee,w=P.y+P.height-Q;Q<ae()||ee<ce()||(u.fillStyle=y.selectionBg,u.fillRect(ee,Q,ue,w),u.strokeStyle=y.activeCellBorder,u.lineWidth=1.5,u.setLineDash([4,3]),u.strokeRect(ee+.5,Q+.5,ue-1,w-1),u.setLineDash([]))}const et=t.computed(()=>pt(e.activeCell.value.col)+String(e.activeCell.value.row+1)),oe=t.ref(""),xe=t.ref(!1),se=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 D=e.editValue.value||e.getCellRaw(u.col,u.row)||"";oe.value=D,We=!1}else!u&&y&&(oe.value="",xe.value=!1,We=!1)},{immediate:!0}),t.watch(()=>[e.activeCell.value.col,e.activeCell.value.row],()=>{e.editingCell.value||(oe.value="",We=!1)});function de(){e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),m())}function we(u){const y=u.target.value;e.editingCell.value?e.editValue.value=y:e.startEdit(y),oe.value=y,We=!0}function Re(u){var D,j;const y={...e.activeCell.value};e.editingCell.value?(e.editValue.value=u,e.commitEdit()):((D=e.saveUndo)==null||D.call(e),e.setCellValue(y.col,y.row,u)),oe.value="",We=!1,m(),(j=o.emitModelData)==null||j.call(o)}let Ke=!1,We=!1;function rt(){var P,ee,Q;if(Ke)return;const u=o.formulaBarRef.value,y=!!(u&&typeof document<"u"&&document.activeElement===u);if(!e.editingCell.value&&!y&&!We)return;const D={...e.activeCell.value},j=e.editingCell.value?e.editingCell.value.col:D.col,T=e.editingCell.value?e.editingCell.value.row:D.row;if(!e.editingCell.value){const ue=e.getCellRaw(j,T),w=oe.value!==ue;if(!We)return;Ke=!0,w&&((P=e.saveUndo)==null||P.call(e),e.setCellValue(j,T,oe.value),m(),(ee=o.emitModelData)==null||ee.call(o)),(Q=o.formulaBarRef.value)==null||Q.blur(),oe.value="",xe.value=!1,We=!1,t.nextTick(()=>{Ke=!1});return}Ke=!0,We?(e.editValue.value=oe.value,e.commitEdit().then(ue=>{var w,s;ue&&(e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row)),(w=o.formulaBarRef.value)==null||w.blur(),oe.value="",xe.value=!1,We=!1,m(),o.focusEditInput(),(s=o.emitModelData)==null||s.call(o),t.nextTick(()=>{Ke=!1})})):y?(oe.value=e.editValue.value,e.commitEdit().then(ue=>{var w,s;ue&&(e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row)),(w=o.formulaBarRef.value)==null||w.blur(),oe.value="",xe.value=!1,We=!1,m(),o.focusEditInput(),(s=o.emitModelData)==null||s.call(o),t.nextTick(()=>{Ke=!1})})):e.commitEdit().then(()=>{var ue,w;(ue=o.formulaBarRef.value)==null||ue.blur(),oe.value="",xe.value=!1,We=!1,m(),o.focusEditInput(),(w=o.emitModelData)==null||w.call(o),t.nextTick(()=>{Ke=!1})})}function je(){var u;Ke||(Ke=!0,e.editingCell.value&&e.cancelEdit(),(u=o.formulaBarRef.value)==null||u.blur(),oe.value="",xe.value=!1,We=!1,m(),o.focusEditInput(),t.nextTick(()=>{Ke=!1}))}function A(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 D=y.selectionStart??y.value.length,j=y.selectionEnd??y.value.length,T=y.value,P=T.substring(0,D)+`
7
+ `+T.substring(j),ee=D+1;oe.value=P,xe.value||(xe.value=!0),t.nextTick(()=>{try{y.setSelectionRange(ee,ee)}catch{}if(xe.value)try{y.scrollTop=y.scrollHeight}catch{}try{y.focus({preventScroll:!0})}catch{}});return}u.key==="Enter"?(u.preventDefault(),rt()):u.key==="Escape"&&(u.preventDefault(),je())}}function K(){rt()}const $=t.ref(null),V=t.ref("");function x(u){$.value===null&&(o.switchSheet(u),m())}function H(u){u!==o.activeSheetIndex.value&&(o.saveSheet(),o.loadSheet(u),m()),$.value=u,V.value=o.sheets.value[u].name,t.nextTick(()=>{const y=document.querySelector(".tab-rename-input");y==null||y.focus(),y==null||y.select()})}function z(){$.value!==null&&(o.renameSheet($.value,V.value),t.nextTick(()=>o.emitModelData())),$.value=null,V.value=""}function Y(){$.value=null,V.value=""}function ve(u){u.key==="Enter"?(u.preventDefault(),z()):u.key==="Escape"&&(u.preventDefault(),Y())}const ze=t.ref(null);t.watch(ze,u=>{u===null&&tt()});const it=t.ref(null);let Fe=null,v=null;function Z(){Fe&&(clearTimeout(Fe),Fe=null),v=null}function lt(u,y,D){Z(),it.value={mode:D,row:u,col:y}}function wt(){Z(),it.value=null}function ft(u,y){lt(u,y,"edit")}function At(u,y,D,j){const T=e.getNote(u,y);D?T?e.updateCellNote(T.id,D):e.setCellNote(u,y,D,j||ta):T&&e.deleteCellNote(u,y),wt(),m()}function Ft(u,y){e.deleteCellNote(u,y),wt(),m()}function Vt(u,y){var Q;if(((Q=it.value)==null?void 0:Q.mode)==="edit")return;const j=u>=ce()&&y>=ae()?e.screenToCell(u,y):null,T=j&&j.col>=0&&j.row>=0&&e.hasNote(j.row,j.col)?j:null,P=it.value&&it.value.mode==="view"?it.value:null;P&&`${P.col}${P.row}`;const ee=T?`${T.col},${T.row}`:null;v&&`${v.col},${v.row}`===ee||(v=T?{row:T.row,col:T.col}:null,Fe&&(clearTimeout(Fe),Fe=null),ee&&(Fe=setTimeout(()=>{var ue;Fe=null,((ue=it.value)==null?void 0:ue.mode)!=="edit"&&(it.value={mode:"view",row:T.row,col:T.col},m())},300)))}function wn(u,y){if(u<ce()||y<ae())return null;const D=e.screenToCell(u,y);if(!D)return null;const{col:j,row:T}=D;if(!e.hasNote(T,j))return null;const P=e.cellToScreenRect(T,j),ee=5,Q=P.x+P.width-1.5,ue=P.y+1.5,w=u-Q,s=y-ue;return w<=1&&s>=-1&&s-w<=ee+1?{row:T,col:j}:null}const an=t.ref(null),sn=t.ref(null),mn=18,Dt=2,Jt=2,Qt=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 $n(u,y,D,j,T,P){const ee=Math.min(P,j/2,T/2);u.beginPath(),u.moveTo(y+ee,D),u.arcTo(y+j,D,y+j,D+T,ee),u.arcTo(y+j,D+T,y,D+T,ee),u.arcTo(y,D+T,y,D,ee),u.arcTo(y,D,y+j,D,ee),u.closePath()}function Zt(u,y,D,j,T,P,ee){if(j<te+4||T<10)return;const Q=y+j-te,ue=D+1,w=T-2;u.save(),P&&(u.fillStyle=ee.selectionBg,u.fillRect(Q,ue,te,w)),u.fillStyle=ee.activeCellBorder;const s=6,f=4,b=Q+te/2,R=ue+w/2;u.beginPath(),u.moveTo(b-s/2,R-f/2+.5),u.lineTo(b+s/2,R-f/2+.5),u.lineTo(b,R+f/2+.5),u.closePath(),u.fill(),u.restore()}function Vn(u,y,D,j,T){if(j<8||T<8)return;const P=5,ee=y+j-1.5,Q=D+1.5;u.save(),u.fillStyle="#d93025",u.beginPath(),u.moveTo(ee,Q),u.lineTo(ee-P,Q),u.lineTo(ee,Q+P),u.closePath(),u.fill(),u.restore()}function U(u,y){if(e.dataValidations.length===0)return null;const D=e.screenToCell(u,y);if(!D)return null;const j=e.findMerge(D.col,D.row),T=j?j.range.startCol:D.col,P=j?j.range.startRow:D.row;if(!e.getListValidation(P,T))return null;const ee=e.cellToScreenRect(P,T);if(ee.width<te+4)return null;const Q=ee.x+ee.width-te;return u<Q||u>ee.x+ee.width||y<ee.y||y>ee.y+ee.height?null:{col:T,row:P}}function W(u,y){const D=e.getValidationDropdown(y,u);if(!D)return!1;const j=o.canvasRef.value;if(!j)return!1;e.activeCell.value.col===u&&e.activeCell.value.row===y||e.selectCell(u,y),e.ensureVisible(u,y),m();const T=e.cellToScreenRect(y,u),P=j.getBoundingClientRect();return sn.value={col:u,row:y,rule:D.rule,items:D.items,current:e.getCellRaw(u,y),x:P.left+T.x,y:P.top+T.y,width:T.width,height:T.height},!0}function X(){sn.value&&(sn.value=null,m())}async function Ce(u){var P;const y=sn.value;if(!y)return;const{col:D,row:j}=y;sn.value=null;const T=e.validateCell(j,D,u);if(!T.valid&&await e.confirmInvalidValue(T,D,j)!=="continue"){m(),o.focusEditInput();return}l.saveUndo(),e.setCellValue(D,j,u),(P=e.emitModelData)==null||P.call(e),m(),o.focusEditInput()}function Ne(u,y,D,j,T,P,ee){const Q=Math.min(j,mn)-Dt,ue=y+j-Q-Dt,w=D+Dt,s=T-2*Dt;u.save(),u.fillStyle=P?ee.activeCellBorder:"#ececec",$n(u,ue,w,Q,s,Jt),u.fill();const f=Math.min(Q,s)*.72;u.translate(ue+Q/2,w+s/2),u.scale(f/1024,f/1024),u.translate(-512,-512),u.fillStyle=P?"#ffffff":"#5a5a5a",u.fill(Qt),u.restore()}function Ve(u,y){const D=e.getFilter();if(!D)return-1;const j=e.screenToCell(u,y);if(!j)return-1;const{col:T,row:P}=j;if(P!==D.range.startRow||T<D.range.startCol||T>D.range.endCol)return-1;const ee=e.cellToScreenRect(P,T),Q=Math.min(ee.width,mn)-Dt,ue=ee.x+ee.width-Q-Dt,w=ee.x+ee.width-Dt;return u>=ue&&u<=w&&y>=ee.y+Dt&&y<=ee.y+ee.height-Dt?T:-1}function He(u){const y=e.getFilter();if(!y)return;const D=o.canvasRef.value;if(!D)return;const j=D.getBoundingClientRect(),T=e.cellToScreenRect(y.range.startRow,u);an.value={col:u,x:j.left+T.x+T.width-mn,y:j.top+T.y+2}}function Me(){an.value=null}let Le=null,be=null;function tt(){Le&&(document.removeEventListener("click",Le),Le=null),be&&(document.removeEventListener("touchstart",be,{capture:!0}),be=null)}function k(u,y){const D=e.getOutlineLevel("row"),j=e.getOutlineLevel("column"),T=e.rowPositions.value,P=e.colPositions.value,ee=e.scrollX.value,Q=e.scrollY.value,ue=Ie/2+1;if(y>=ae())for(const w of e.getRowOutlines()){const s=qe(w,D),f=ae()+T[w.start]-Q;if(Math.abs(u-s)<=ue&&Math.abs(y-f)<=ue)return{kind:"toggle",outlineId:w.id}}if(u>=ce())for(const w of e.getColumnOutlines()){const s=ut(w,j),f=ce()+P[w.start]-ee;if(Math.abs(y-s)<=ue&&Math.abs(u-f)<=ue)return{kind:"toggle",outlineId:w.id}}return null}function q(u){for(const y of u)e.removeOutline(y);o.emitModelData(),m()}function re(u){const y=e.selection.value;if(!y)return pe("outlineNeedRowsOrColumns"),!1;let D;if(u==="row"){if(y.startCol!==0||y.endCol!==e.colCount-1)return pe("outlineNeedRowsOrColumns"),!1;if(y.startRow===y.endRow)return pe("outlineInvalidRange"),!1;D=e.addRowGroup(y.startRow,y.endRow)}else{if(y.startRow!==0||y.endRow!==e.rowCount-1)return pe("outlineNeedRowsOrColumns"),!1;if(y.startCol===y.endCol)return pe("outlineInvalidRange"),!1;D=e.addColumnGroup(y.startCol,y.endCol)}return D.ok?!0:(pe(D.code==="outlineCrossing"?"outlineCrossing":D.code==="outlineTooDeep"?"outlineTooDeep":"outlineInvalidRange"),!1)}function Se(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 pe("outlineNeedRowsOrColumns"),!1;const D=u==="row"?e.getRowOutlines():e.getColumnOutlines(),j=u==="row"?y.startRow:y.startCol,T=u==="row"?y.endRow:y.endCol,P=D.filter(ee=>j<=ee.start&&ee.end<=T);return P.length?(q(P.map(ee=>ee.id)),!0):(pe("outlineUngroupPartial"),!1)}function Te(u,y){const D=u==="row"?e.getRowOutlines():e.getColumnOutlines();if(D.length&&!D.every(j=>j.collapsed===y)){l.saveUndo();for(const j of D)e.setOutlineCollapsed(j.id,y,!0);o.emitModelData(),m()}}function pe(u){const y=g(e.locale.value,u);if(c){c(y);return}window.alert(y)}function F(u,y,D){tt();const j=140,T=D.length*28+8,P=Nn(o.wrapperRef.value),ee=P.right,Q=P.bottom;u+j>ee&&(u-=j),y+T>Q&&(y-=T),p.value=!1,ze.value={x:u,y,items:D},t.nextTick(()=>bt()),Le=()=>{ze.value=null,tt()},be=ue=>{const w=ue.target;w&&w.closest(".context-menu")||(ze.value=null,tt())},setTimeout(()=>{document.addEventListener("click",Le,{once:!0}),document.addEventListener("touchstart",be,{capture:!0})},0)}const p=t.ref(!1);function N(u,y){}function bt(){const y=document.querySelector(".context-menu"),D=ze.value;if(!y||!D){p.value=!1;return}const j=D.x+140,T=Nn(o.wrapperRef.value),P=T.right,ee=T.bottom,Q=y.style.transform;y.style.transform="none";let ue=0;if(y.querySelectorAll(".context-menu__item").forEach(s=>{const f=s.querySelector(":scope > .context-submenu");if(!f)return;const b=f.style.display;f.style.display="block";const R=f.getBoundingClientRect(),I=R.width,ne=R.height;f.style.display=b,I>ue&&(ue=I),s.getBoundingClientRect().top+ne>ee-8?(f.style.top="auto",f.style.bottom="-5px"):(f.style.top="",f.style.bottom="")}),y.style.transform=Q,ue===0){p.value=!0;return}const w=P-j;p.value=w<ue+8}function vt(u,y){u.preventDefault(),u.stopPropagation(),F(u.clientX,u.clientY,[{label:g(e.locale.value,"insert"),action:()=>{o.addSheet(),m()}},{label:g(e.locale.value,"copy"),action:()=>{o.dupSheet(y)}},{label:g(e.locale.value,"rename"),action:()=>{H(y)}},{label:g(e.locale.value,"delete"),action:()=>{o.removeSheet(y),m()},disabled:o.sheetCount.value<=1},{label:g(e.locale.value,"moveSheetLeft"),action:()=>{o.moveSheet(y,-1)},disabled:y===0},{label:g(e.locale.value,"moveSheetRight"),action:()=>{o.moveSheet(y,1)},disabled:y===o.sheets.value.length-1}])}function Kt(u){u.preventDefault(),!(u.target.closest(".tab-item")||u.target.closest(".tab-bar__add-btn"))&&F(u.clientX,u.clientY,[{label:g(e.locale.value,"insert"),action:()=>{o.addSheet(),m()}}])}function Nt(u){u.preventDefault(),e.selectAll(),m(),F(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(()=>{m(),t.nextTick(()=>o.emitModelData())})}},{label:g(e.locale.value,"delete"),action:()=>{l.saveUndo(),n.clearSelected();for(let y=0;y<e.colCount;y++)e.colWidths.value[y]=100;for(let y=0;y<e.rowCount;y++)e.rowHeights.value[y]=void 0;m(),o.emitModelData()}}])}function fo(u,y){u.preventDefault();const D=u.clientX,j=u.clientY,T=e.selection.value;T&&T.startCol===0&&T.endCol===e.colCount-1&&y>=T.startRow&&y<=T.endRow||(e.selectRange(0,y,e.colCount-1,y,"row"),m());const P=e.selection.value;F(u.clientX,u.clientY,[{label:g(e.locale.value,"insert"),action:()=>{l.saveUndo(),o.insertRows(P.startRow,P.startRow),e.selectRange(0,P.startRow,e.colCount-1,P.startRow,"row"),m(),o.emitModelData()}},{label:g(e.locale.value,"cut"),action:()=>{l.saveUndo(),n.copyRowCol(),e.clearCellsInRange(0,e.colCount-1,P.startRow,P.endRow),m(),o.emitModelData()}},{label:g(e.locale.value,"copy"),action:()=>n.copyRowCol()},{label:g(e.locale.value,"paste"),action:()=>{l.saveUndo(),n.pasteFromClipboard().then(()=>{m(),t.nextTick(()=>o.emitModelData())})}},{label:g(e.locale.value,"delete"),action:()=>{l.saveUndo(),o.deleteRows(P.startRow,P.endRow),m(),o.emitModelData()}},{label:`${g(e.locale.value,"rowHeight")}...`,action:()=>bl("row",D,j)},{label:g(e.locale.value,"autoRowHeight"),action:()=>o.resetRowHeight()},{label:g(e.locale.value,"freezeToRow"),action:()=>{e.setFreeze(y+1,e.freeze.cols),m()}},{label:g(e.locale.value,"outlineGroup"),children:[{label:g(e.locale.value,"outlineAddRowGroup"),action:()=>re("row")},{label:g(e.locale.value,"outlineUngroupRows"),action:()=>Se("row")},{label:g(e.locale.value,"outlineClear"),action:()=>e.clearRowGroups()},{label:g(e.locale.value,"outlineExpandAll"),action:()=>Te("row",!1)},{label:g(e.locale.value,"outlineCollapseAll"),action:()=>Te("row",!0)}]}])}function mo(u,y){u.preventDefault();const D=u.clientX,j=u.clientY,T=e.selection.value;T&&T.startRow===0&&T.endRow===e.rowCount-1&&y>=T.startCol&&y<=T.endCol||(e.selectRange(y,0,y,e.rowCount-1,"col"),m());const P=e.selection.value,ee=!o.canSortColumns(P.startCol,P.endCol);F(u.clientX,u.clientY,[{label:g(e.locale.value,"insert"),action:()=>{l.saveUndo(),o.insertCols(P.startCol,P.startCol),e.selectRange(P.startCol,0,P.startCol,e.rowCount-1,"col"),m(),o.emitModelData()}},{label:g(e.locale.value,"cut"),action:()=>{l.saveUndo(),n.copyRowCol(),e.clearCellsInRange(P.startCol,P.endCol,0,e.rowCount-1),m(),o.emitModelData()}},{label:g(e.locale.value,"copy"),action:()=>n.copyRowCol()},{label:g(e.locale.value,"paste"),action:()=>{l.saveUndo(),n.pasteFromClipboard().then(()=>{m(),t.nextTick(()=>o.emitModelData())})}},{label:g(e.locale.value,"delete"),action:()=>{l.saveUndo(),o.deleteCols(P.startCol,P.endCol),m(),o.emitModelData()}},{label:g(e.locale.value,"sort"),disabled:ee,children:[{label:g(e.locale.value,"sortAsc"),action:()=>{o.prepareSortConfirmation("asc")||o.sortSelectedColumns("asc")},disabled:ee},{label:g(e.locale.value,"sortDesc"),action:()=>{o.prepareSortConfirmation("desc")||o.sortSelectedColumns("desc")},disabled:ee}]},{label:`${g(e.locale.value,"colWidth")}...`,action:()=>bl("col",D,j)},{label:g(e.locale.value,"defaultColWidth"),action:()=>o.resetColWidth()},{label:g(e.locale.value,"freezeToCol"),action:()=>{e.setFreeze(e.freeze.rows,y+1),m()}},{label:g(e.locale.value,"outlineGroup"),children:[{label:g(e.locale.value,"outlineAddColumnGroup"),action:()=>re("column")},{label:g(e.locale.value,"outlineUngroupColumns"),action:()=>Se("column")},{label:g(e.locale.value,"outlineClear"),action:()=>e.clearColumnGroups()},{label:g(e.locale.value,"outlineExpandAll"),action:()=>Te("column",!1)},{label:g(e.locale.value,"outlineCollapseAll"),action:()=>Te("column",!0)}]}])}function Xt(u,y,D){u.preventDefault(),e.isSelected(y,D)||(e.selectCell(y,D),m());const j=e.selection.value,T=!!(j&&j.startCol===j.endCol&&j.startRow===j.endRow);F(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(()=>{m(),t.nextTick(()=>o.emitModelData())})}},{label:g(e.locale.value,"delete"),action:()=>{l.saveUndo(),n.clearSelected(),m(),o.emitModelData()}},{label:g(e.locale.value,"calculate"),children:[{label:g(e.locale.value,"sum"),action:n.sumSelected,disabled:T},{label:g(e.locale.value,"avg"),action:n.avgSelected,disabled:T},{label:g(e.locale.value,"count"),action:n.countSelected,disabled:T}]},{label:`${g(e.locale.value,"dv")}...`,action:()=>{var P;return(P=e.requestDataValidationDialog)==null?void 0:P.call(e)}},{label:g(e.locale.value,"dvClearValidation"),action:()=>{l.saveUndo(),e.clearDataValidation(e.selection.value),m(),o.emitModelData()}},...T?[{label:e.hasNote(D,y)?g(e.locale.value,"editNote"):g(e.locale.value,"newNote"),action:()=>ft(D,y)},...e.hasNote(D,y)?[{label:g(e.locale.value,"deleteNote"),action:()=>Ft(D,y)}]:[]]:[]])}const Gl=t.ref(null),Qn=t.ref(null);let Io=null,Ao=null;function ql(){Io&&(document.removeEventListener("mousedown",Io),Io=null),Ao&&(document.removeEventListener("touchstart",Ao),Ao=null)}function bl(u,y,D){ql();const j=e.selection.value;let T="";if(j){const s=u==="row"?e.getRowHeight(j.startRow):e.colWidths.value[j.startCol];T=s!=null&&s>0?String(Math.round(s)):""}const P=220,ee=118;let Q=y,ue=D;const w=Nn(o.wrapperRef.value);Q=Math.max(w.left+8,Math.min(w.right-P-8,Q)),ue=Math.max(w.top+8,Math.min(w.bottom-ee-8,ue)),Qn.value={type:u,x:Q,y:ue,value:T,error:""},Io=()=>{Qn.value=null},Ao=()=>{Qn.value=null},setTimeout(()=>{document.addEventListener("mousedown",Io,{once:!0}),document.addEventListener("touchstart",Ao,{once:!0})},0),t.nextTick(()=>{const s=Gl.value;s&&(s.focus(),s.select())})}function Yl(u){const y=Qn.value;if(!y)return;const D=u.target,j=D.value,T=j.replace(/[^\d]/g,"");y.value=T,j!==T&&(D.value=T),y.error=""}function $r(u){u.key==="Enter"?(u.preventDefault(),jl()):u.key==="Escape"&&(u.preventDefault(),jo())}function zr(){const u=Qn.value;if(!u)return;const y=u.value.trim(),D=Number(y),j=u.type==="row",T=j?24:30,P=j?500:1e3;if(y===""||!Number.isFinite(D)){jo();return}const ee=Math.max(T,Math.min(P,Math.round(D)));u.value=String(ee),u.error=""}function jl(){const u=Qn.value,y=e.selection.value;if(!u||!y)return;const D=u.value.trim(),j=Number(D),T=u.type==="row",P=T?24:30,ee=T?500:1e3;if(D===""||!Number.isFinite(j)){u.error=g(e.locale.value,"dimNumberError");return}if(j<P||j>ee){u.error=g(e.locale.value,"dimRangeError").replace("{min}",String(P)).replace("{max}",String(ee));return}const Q=j;if(l.saveUndo(),T)for(let ue=y.startRow;ue<=y.endRow;ue++)e.rowHeights.value[ue]=Q;else for(let ue=y.startCol;ue<=y.endCol;ue++)e.colWidths.value[ue]=Q;m(),o.emitModelData(),jo()}function jo(){ql(),Qn.value=null}const _r=t.computed(()=>{const u=!e.editingCell.value,y=e.editingCell.value??e.activeCell.value,D=y.col,j=y.row,T=e.resolveStyle(e.cells[e.cellKey(D,j)]),P=e.cellFontSize(D,j),ee=typeof(T==null?void 0:T.fontFamily)=="string"&&T.fontFamily?T.fontFamily:Vo,Q=(T==null?void 0:T.fontWeight)==="bold"?"bold":"normal",ue=(T==null?void 0:T.fontStyle)==="italic"?"italic":"normal",w=(T==null?void 0:T.underline)==="underline"?"underline":(T==null?void 0:T.strikethrough)==="line-through"?"line-through":"none",s=(T==null?void 0:T.underline)==="underline"&&(T==null?void 0:T.strikethrough)==="line-through"?"underline line-through":w,f=typeof(T==null?void 0:T.color)=="string"?T.color:void 0,b=typeof(T==null?void 0:T.backgroundColor)=="string"?T.backgroundColor:void 0,R=typeof(T==null?void 0:T.numberFormat)=="string"?T.numberFormat:"",I=e.editValue.value??e.getCellValue(D,j),ne=typeof(T==null?void 0:T.textAlign)=="string"?T.textAlign:br(I,R)?"right":"left",ie=typeof(T==null?void 0:T.verticalAlign)=="string"?T.verticalAlign:"top",ye=e.findMerge(D,j),ke=ye?e.rowPositions.value[ye.range.endRow+1]-e.rowPositions.value[j]:e.getRowHeight(j),Ue=2,{ascent:_e,descent:Xe}=e.measureFontMetrics(ee,P,Q,ue),Qe=_e+Xe,Ct=(e.editValue.value?e.editValue.value.split(`
8
+ `).length:1)*Qe,qt=e.BASE_CELL_VPAD-Ue;let $t=0,Yt=0;ie==="middle"?($t=Math.floor((ke-Ct)/2),Yt=Math.max(0,ke-Ct-$t)):ie==="top"?($t=qt,Yt=Math.max(0,ke-Ct-$t)):ie==="bottom"&&(Yt=qt,$t=Math.max(0,ke-Ct-Yt));const nn=e.cellToScreenRect(j,D);return{left:`${nn.x}px`,top:`${nn.y}px`,width:`${nn.width}px`,height:`${nn.height}px`,fontFamily:ee,fontSize:`${P}px`,lineHeight:1,fontWeight:Q,fontStyle:ue,textDecoration:s,textAlign:ne,paddingTop:`${$t}px`,paddingRight:"3px",paddingBottom:`${Yt}px`,paddingLeft:"3px",opacity:u?0:1,pointerEvents:u?"none":"auto",color:u?"transparent":f,caretColor:u?"transparent":void 0,borderColor:u?"transparent":void 0,background:u?"transparent":b,boxShadow:u?"none":void 0}});function yl(){return Math.max(0,o.viewSize.w-ce()-11)}function Cl(){return Math.max(0,o.viewSize.h-ae()-11)}const wl=t.computed(()=>Math.max(0,yl()-e.getFrozenMetrics().frozenColumnsWidth)),Xo=t.computed(()=>Math.max(0,Cl()-e.getFrozenMetrics().frozenRowsHeight)),Xl=t.computed(()=>ce()+e.getFrozenMetrics().frozenColumnsWidth),Hr=t.computed(()=>ae()+e.getFrozenMetrics().frozenRowsHeight),Lo=t.computed(()=>Math.max(0,wl.value-11*2)),$o=t.computed(()=>Math.max(0,Xo.value-11*2)),Zo=t.computed(()=>o.maxScrollX.value<=0?Lo.value:Math.max(24,wl.value/e.totalWidth.value*Lo.value)),Jo=t.computed(()=>o.maxScrollX.value<=0?0:e.scrollX.value/o.maxScrollX.value*(Lo.value-Zo.value)),Qo=t.computed(()=>o.maxScrollY.value<=0?$o.value:Math.max(24,Xo.value/e.totalHeight.value*$o.value)),vl=t.computed(()=>o.maxScrollY.value<=0?0:e.scrollY.value/o.maxScrollY.value*($o.value-Qo.value));let po=null,el=0,tl=0;function Zl(u){u.preventDefault(),po="v",el=u.clientY,tl=e.scrollY.value,document.addEventListener("mousemove",nl),document.addEventListener("mouseup",ol)}function ho(u){u.preventDefault(),po="h",el=u.clientX,tl=e.scrollX.value,document.addEventListener("mousemove",nl),document.addEventListener("mouseup",ol)}function nl(u){if(po==="v"){const D=(u.clientY-el)/($o.value-Qo.value);o.clampScroll(null,tl+D*o.maxScrollY.value),m()}else if(po==="h"){const D=(u.clientX-el)/(Lo.value-Zo.value);o.clampScroll(tl+D*o.maxScrollX.value,null),m()}}function ol(){po=null,document.removeEventListener("mousemove",nl),document.removeEventListener("mouseup",ol)}function eo(u){if(po)return;const y=u.currentTarget.getBoundingClientRect(),D=u.clientY-y.top;D<vl.value?o.clampScroll(null,e.scrollY.value-Cl()):D>vl.value+Qo.value&&o.clampScroll(null,e.scrollY.value+Cl()),m()}function ll(u){if(po)return;const y=u.currentTarget.getBoundingClientRect(),D=u.clientX-y.left;D<Jo.value?o.clampScroll(e.scrollX.value-yl(),null):D>Jo.value+Zo.value&&o.clampScroll(e.scrollX.value+yl(),null),m()}let go=!1,cn=0,vn=0,kn=!1,Dn=!1,zn=0,No=0,to=0,_n=0,Bo=0,Hn=0,zo=0,rl=0,dn=!1,bo=!1,Bt=0,xt=0,en="cell",kl=0,Jl=-1,Ql=-1,Lt=null,Fn=!1,tn=0,Wn=0,yo=!1,En=null,xo=null,er=0,tr=0;function al(u,y){const D=e.selection.value;if(!D||e.editingCell.value||!Nr(D,D,e.merges).ok)return!1;const j=e.cellToScreenRect(D.endRow,D.endCol),T=j.x+j.width-6,P=j.y+j.height-6,ee=4;return u>=T-ee&&u<=T+6+ee&&y>=P-ee&&y<=P+6+ee}function nr(){En=requestAnimationFrame(or)}function or(){if(!e.autoFillState.value.active||!xo){En=null;return}const u=8;o.clampScroll(e.scrollX.value+xo.x*u*.1,e.scrollY.value+xo.y*u*.1);const y=e.screenToCell(er,tr),D=e.autoFillState.value.sourceRange;if(y&&D){const j=Pa(D,{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}}m(),En=requestAnimationFrame(or)}function El(){En!==null&&(cancelAnimationFrame(En),En=null),xo=null}function lr(u,y){er=u,tr=y;const D=e.screenToCell(u,y),j=e.autoFillState.value.sourceRange;if(D&&j){const w=Pa(j,{col:D.col,row:D.row});w?e.autoFillState.value={...e.autoFillState.value,targetRange:w.targetRange,direction:w.direction}:e.autoFillState.value={...e.autoFillState.value,targetRange:null,direction:null}}const T=30,P=o.viewSize.w,ee=o.viewSize.h;let Q=0,ue=0;u<ce()+T?Q=-(ce()+T-u):u>P-11-T&&(Q=u-(P-11-T)),y<ae()+T?ue=-(ae()+T-y):y>ee-11-T&&(ue=y-(ee-11-T)),Q!==0||ue!==0?(xo={x:Q,y:ue},En===null&&nr()):(xo=null,En!==null&&(cancelAnimationFrame(En),En=null)),m()}function rr(){El();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 Wr(u){var w;if(u.button!==0)return;u.preventDefault(),ze.value=null;const y=Eo(u,o.canvasRef.value),D=U(y.x,y.y);if(D){if(e.editingCell.value){e.commitEdit().then(s=>{s&&W(D.col,D.row)});return}W(D.col,D.row);return}((w=it.value)==null?void 0:w.mode)==="edit"&&wt();const j=wn(y.x,y.y);if(j){lt(j.row,j.col,"view"),o.emitModelData();return}else it.value&&wt();const T=Ve(y.x,y.y);if(T>=0){He(T);return}const P=k(y.x,y.y);if(P){P.kind==="toggle"&&(e.toggleOutline(P.outlineId),m(),o.emitModelData());return}if(y.y<ae()&&y.x>=ce()){const s=y.x-ce()+e.scrollX.value,f=M(y.x),b=f>=0?e.cellToScreenRect(0,f).x+e.colWidths.value[f]:-1;if(f>=0&&Math.abs(y.x-b)<=4){l.saveUndo(),kn=!0,zn=f,to=e.colWidths.value[f],_n=s,m();return}}if(y.x<ce()&&y.y>=ae()){const s=y.y-ae()+e.scrollY.value,f=E(y.y),b=f>=0?e.cellToScreenRect(f,0).y+e.getRowHeight(f):-1;if(f>=0&&Math.abs(y.y-b)<=4){l.saveUndo(),Dn=!0,No=f,to=e.getRowHeight(f),_n=s,m();return}}if(al(y.x,y.y)){const s=e.selection.value;s&&(e.autoFillState.value={active:!0,sourceRange:{...s},targetRange:null,direction:null,preview:!0},m());return}if(y.x<ce()||y.y<ae()){{const s=o.formulaBarRef.value,f=!!(s&&typeof document<"u"&&document.activeElement===s);(e.editingCell.value||f||We)&&rt()}if(y.y<ae()&&y.x>=ce()){const s=M(y.x);s>=0&&(e.selectRange(s,0,s,e.rowCount-1,"col"),go=!0,cn=s,vn=0)}else if(y.x<ce()&&y.y>=ae()){const s=E(y.y);s>=0&&(e.selectRange(0,s,e.colCount-1,s,"row"),go=!0,cn=0,vn=s)}else y.x<ce()&&y.y<ae()&&e.selectAll();m();return}const ee=e.screenToCell(y.x,y.y);if(!ee)return;const Q=ee.col,ue=ee.row;{const s=o.formulaBarRef.value,f=!!(s&&typeof document<"u"&&document.activeElement===s);(e.editingCell.value||f||We)&&rt()}if(u.shiftKey&&e.selection.value){const s=e.selection.value;e.selectRange(s.startCol,s.startRow,Q,ue)}else e.selectCell(Q,ue);go=!0,cn=Q,vn=ue,o.focusEditInput(),m()}function Ur(u){if(kn){const ee=Eo(u,o.canvasRef.value).x-ce()+e.scrollX.value-_n,Q=to+ee;Q>=30&&Q<=1e3?e.colWidths.value[zn]=Q:Q<30?e.colWidths.value[zn]=30:e.colWidths.value[zn]=1e3,m();return}if(Dn){const ee=Eo(u,o.canvasRef.value).y-ae()+e.scrollY.value-_n,Q=to+ee;Q>=24&&Q<=500?e.rowHeights.value[No]=Q:Q<24?e.rowHeights.value[No]=24:e.rowHeights.value[No]=500,m();return}if(e.autoFillState.value.active){const P=Eo(u,o.canvasRef.value);lr(P.x,P.y);return}if(!go){const P=o.canvasRef.value;if(!P)return;if(l.paintFmt.value){P.style.cursor="copy";return}const ee=Eo(u,P);if(wn(ee.x,ee.y)&&(P.style.cursor="pointer"),Vt(ee.x,ee.y),k(ee.x,ee.y)){P.style.cursor="pointer";return}if(Ve(ee.x,ee.y)>=0){P.style.cursor="pointer";return}if(U(ee.x,ee.y)){P.style.cursor="pointer";return}if(ee.y<ae()&&ee.x>=ce()){const Q=M(ee.x),ue=Q>=0?e.cellToScreenRect(0,Q).x+e.colWidths.value[Q]:-1;if(Q>=0&&Math.abs(ee.x-ue)<=4){P.style.cursor="col-resize";return}}if(ee.x<ce()&&ee.y>=ae()){const Q=E(ee.y),ue=Q>=0?e.cellToScreenRect(Q,0).y+e.getRowHeight(Q):-1;if(Q>=0&&Math.abs(ee.y-ue)<=4){P.style.cursor="row-resize";return}}if(al(ee.x,ee.y)){P.style.cursor="crosshair";return}P.style.cursor="cell";return}const y=Eo(u,o.canvasRef.value);if(cn<0||vn<0)return;if(y.x<ce()||y.y<ae()){if(y.y<ae()&&y.x>=ce()){const P=M(y.x);P>=0&&e.selectRange(Math.min(cn,P),0,Math.max(cn,P),e.rowCount-1,"col")}else if(y.x<ce()&&y.y>=ae()){const P=E(y.y);P>=0&&e.selectRange(0,Math.min(vn,P),e.colCount-1,Math.max(vn,P),"row")}m();return}const D=e.screenToCell(y.x,y.y);if(!D)return;const j=D.col,T=D.row;vn===0&&cn>=0&&e.selection.value&&e.selection.value.startRow===0&&e.selection.value.endRow===e.rowCount-1?e.selectRange(Math.min(cn,j),0,Math.max(cn,j),e.rowCount-1,"col"):cn===0&&vn>=0&&e.selection.value&&e.selection.value.startCol===0&&e.selection.value.endCol===e.colCount-1?e.selectRange(0,Math.min(vn,T),e.colCount-1,Math.max(vn,T),"row"):e.selectRange(cn,vn,j,T),m()}function Pr(u){const y=kn||Dn;if(go=!1,kn=!1,Dn=!1,y&&o.scheduleOptEmit(),e.autoFillState.value.active){rr();return}l.paintFmt.value&&l.applyPaintFormat()}function ar(){El();const u=kn||Dn;go=!1,kn=!1,Dn=!1,u&&o.scheduleOptEmit()}function Kr(u){u.preventDefault();const y=Eo(u,o.canvasRef.value);if(y.x<ce()&&y.y<ae()){Nt(u);return}if(y.y<ae()&&y.x>=ce()){const D=M(y.x);D>=0&&mo(u,D);return}if(y.x<ce()&&y.y>=ae()){const D=E(y.y);D>=0&&fo(u,D);return}if(y.x>=ce()&&y.y>=ae()){const D=e.screenToCell(y.x,y.y);D&&Xt(u,D.col,D.row)}}function Gr(u){const y=Eo(u,o.canvasRef.value);if(y.x<ce()||y.y<ae())return;const D=e.screenToCell(y.x,y.y);if(!D)return;const j=D.col,T=D.row;{const P=o.formulaBarRef.value,ee=!!(P&&typeof document<"u"&&document.activeElement===P);(e.editingCell.value||ee||We)&&rt()}e.selectCell(j,T),e.ensureVisible(j,T),e.startEdit(),m(),o.focusEditInput()}function qr(u){const y=e.scrollX.value+u.deltaX,D=e.scrollY.value+u.deltaY,j=40,T=o.maxScrollX.value,P=o.maxScrollY.value;if(y>=T-j&&u.deltaX>0||D>=P-j&&u.deltaY>0){const ee=Math.max(0,o.viewSize.w-28-11),Q=Math.max(0,o.viewSize.h-28-11),ue=Math.max(0,Math.ceil((y+ee)/100)+2),w=Math.max(0,Math.ceil((D+Q)/24)+2);e.ensureCapacity(ue,w)}o.clampScroll(y,D),m()}function Yr(u){if(u.touches.length!==1){dn=!1;return}const y=u.touches[0],D=o.canvasRef.value;if(!D)return;const j=D.getBoundingClientRect(),T=y.clientX-j.left,P=y.clientY-j.top,ee=y.clientX,Q=y.clientY,ue=(s,f)=>({clientX:s,clientY:f,preventDefault(){}});{const s=o.formulaBarRef.value,f=!!(s&&typeof document<"u"&&document.activeElement===s);(e.editingCell.value||f||We)&&rt()}if(al(T,P)){u.preventDefault();const s=e.selection.value;s&&(e.autoFillState.value={active:!0,sourceRange:{...s},targetRange:null,direction:null,preview:!0},dn=!0,bo=!1,en="cell",Bo=T,Hn=P,zo=e.scrollX.value,rl=e.scrollY.value);return}const w=Ve(T,P);if(w>=0){u.preventDefault(),He(w);return}if(P<ae()&&T>=ce()){const s=M(T);if(s>=0){const f=e.cellToScreenRect(0,s).x+e.colWidths.value[s];if(Math.abs(T-f)<=8){u.preventDefault(),l.saveUndo(),kn=!0,zn=s,to=e.colWidths.value[s],_n=T-ce()+e.scrollX.value,dn=!0,bo=!1;return}}}if(T<ce()&&P>=ae()){const s=E(P);if(s>=0){const f=e.cellToScreenRect(s,0).y+e.getRowHeight(s);if(Math.abs(P-f)<=8){u.preventDefault(),l.saveUndo(),Dn=!0,No=s,to=e.getRowHeight(s),_n=P-ae()+e.scrollY.value,dn=!0,bo=!1;return}}}T>=ce()&&P>=ae()?(u.preventDefault(),dn=!0,bo=!1,Fn=!1,yo=!1,en="cell",Bo=T,Hn=P,zo=e.scrollX.value,rl=e.scrollY.value,Bt=M(T),xt=E(P),Lt!==null&&clearTimeout(Lt),Lt=window.setTimeout(()=>{const s=e.selection.value;if(!!s&&Bt>=s.startCol&&Bt<=s.endCol&&xt>=s.startRow&&xt<=s.endRow){yo=!0,Xt(ue(ee,Q),Bt,xt);return}Fn=!0,tn=Bt,Wn=xt,Bt>=0&&xt>=0&&(e.selectCell(Bt,xt),m())},450)):T>=0&&P>=0&&(T<ce()||P<ae())&&(u.preventDefault(),dn=!0,bo=!1,Fn=!1,Bo=T,Hn=P,zo=e.scrollX.value,rl=e.scrollY.value,P<ae()&&T>=ce()?(en="col",Bt=M(T),xt=-1):T<ce()&&P>=ae()?(en="row",xt=E(P),Bt=-1):(en="all",Bt=-1,xt=-1),(en==="col"||en==="row"||en==="all")&&(Lt!==null&&clearTimeout(Lt),Lt=window.setTimeout(()=>{const s=e.selection.value;if(en==="all"){yo=!0,Nt(ue(ee,Q));return}if(en==="col"){if(!!s&&s.startRow===0&&s.endRow===e.rowCount-1&&Bt>=s.startCol&&Bt<=s.endCol){yo=!0,mo(ue(ee,Q),Bt);return}Fn=!0,tn=Bt,Wn=-1,Bt>=0&&(e.selectRange(Bt,0,Bt,e.rowCount-1,"col"),m())}else{if(!!s&&s.startCol===0&&s.endCol===e.colCount-1&&xt>=s.startRow&&xt<=s.endRow){yo=!0,fo(ue(ee,Q),xt);return}Fn=!0,tn=-1,Wn=xt,xt>=0&&(e.selectRange(0,xt,e.colCount-1,xt,"row"),m())}},450)))}function jr(u){if(!dn||u.touches.length!==1)return;const y=u.touches[0],D=o.canvasRef.value;if(!D)return;const j=D.getBoundingClientRect(),T=y.clientX-j.left,P=y.clientY-j.top;if(e.autoFillState.value.active){u.preventDefault(),lr(T,P);return}if(kn){const ee=T-ce()+e.scrollX.value-_n;let Q=to+ee;Q=Q<30?30:Q>1e3?1e3:Q,e.colWidths.value[zn]=Q,u.preventDefault(),m();return}if(Dn){const ee=P-ae()+e.scrollY.value-_n;let Q=to+ee;Q=Q<24?24:Q>500?500:Q,e.rowHeights.value[No]=Q,u.preventDefault(),m();return}if(Fn){if(u.preventDefault(),tn>=0&&Wn>=0){const ee=M(T),Q=E(P);ee>=0&&Q>=0&&(e.selectRange(tn,Wn,ee,Q),m())}else if(Wn===-1&&tn>=0){const ee=M(T);ee>=0&&(e.selectRange(Math.min(tn,ee),0,Math.max(tn,ee),e.rowCount-1,"col"),m())}else if(tn===-1&&Wn>=0){const ee=E(P);ee>=0&&(e.selectRange(0,Math.min(Wn,ee),e.colCount-1,Math.max(Wn,ee),"row"),m())}return}Lt!==null&&(clearTimeout(Lt),Lt=null),(Math.abs(T-Bo)>8||Math.abs(P-Hn)>8)&&(bo=!0,u.preventDefault(),o.clampScroll(zo+(Bo-T),rl+(Hn-P)),m())}function Rl(){if(dn){if(Lt!==null&&(clearTimeout(Lt),Lt=null),yo){yo=!1,dn=!1;return}if(e.autoFillState.value.active){rr(),dn=!1;return}if(kn||Dn){kn=!1,Dn=!1,o.scheduleOptEmit(),l.paintFmt.value&&l.applyPaintFormat(),dn=!1;return}if(Fn){Fn=!1,l.paintFmt.value&&l.applyPaintFormat(),dn=!1;return}if(dn=!1,!bo){if(en==="cell"&&Bt>=0&&xt>=0){const u=Date.now();Bt===Jl&&xt===Ql&&u-kl<300?(e.selectCell(Bt,xt),e.startEdit(),m(),o.focusEditInput(),kl=0):(e.commitEdit(),e.selectCell(Bt,xt),m(),kl=u),Jl=Bt,Ql=xt,o.focusEditInput()}else en==="col"&&Bt>=0?(e.commitEdit(),e.selectRange(Bt,0,Bt,e.rowCount-1,"col"),m()):en==="row"&&xt>=0?(e.commitEdit(),e.selectRange(0,xt,e.colCount-1,xt,"row"),m()):en==="all"&&(e.commitEdit(),e.selectAll(),m());l.paintFmt.value&&!e.editingCell.value&&l.applyPaintFormat()}}}function Ml(u){return u.isComposing||u.key==="Process"||u.keyCode===229}function Sl(u){return u.key.length===1&&!u.ctrlKey&&!u.metaKey&&!u.altKey}function ir(u){if(e.autoFillState.value.active){u.key==="Escape"&&(u.preventDefault(),El(),e.autoFillState.value={active:!1,sourceRange:null,targetRange:null,direction:null,preview:!1},m());return}if(e.editingCell.value)return;const y=u.ctrlKey||u.metaKey,D=u.shiftKey;switch(!0){case(u.altKey&&u.key==="ArrowDown"):u.preventDefault(),W(e.activeCell.value.col,e.activeCell.value.row);return;case(y&&(u.key==="c"||u.key==="C")):u.preventDefault(),n.copyToClipboard();return;case(y&&(u.key==="x"||u.key==="X")):u.preventDefault(),n.cutSelected();return;case(y&&(u.key==="z"||u.key==="Z")):u.preventDefault(),l.undo();return;case(y&&(u.key==="y"||u.key==="Y")):u.preventDefault(),l.redo();return;case(y&&(u.key==="v"||u.key==="V")):u.preventDefault(),l.saveUndo(),n.pasteFromClipboard().then(()=>{m(),t.nextTick(()=>o.emitModelData())});return;case(y&&(u.key==="a"||u.key==="A")):u.preventDefault(),e.selectAll(),m();return;case(y&&D&&(u.key==="l"||u.key==="L")):u.preventDefault(),e.toggleAutoFilter(),m();return;case(y&&u.key==="Home"):u.preventDefault(),e.selectCell(0,0),e.ensureVisible(0,0),m();return;case(y&&u.key==="End"):u.preventDefault(),e.selectCell(e.colCount-1,e.rowCount-1),e.ensureVisible(e.colCount-1,e.rowCount-1),m();return;case u.key==="Home":u.preventDefault(),e.selectCell(0,e.activeCell.value.row),e.ensureVisible(0,e.activeCell.value.row),m();return;case u.key==="End":u.preventDefault(),e.selectCell(e.colCount-1,e.activeCell.value.row),e.ensureVisible(e.colCount-1,e.activeCell.value.row),m();return;case u.key==="ArrowUp":u.preventDefault(),e.moveActive(0,-1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),m();return;case u.key==="ArrowDown":u.preventDefault(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),m();return;case u.key==="ArrowLeft":u.preventDefault(),e.moveActive(-1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),m();return;case u.key==="ArrowRight":u.preventDefault(),e.moveActive(1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),m();return;case u.key==="Tab":u.preventDefault(),e.moveActive(D?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),m();return;case u.key==="Enter":u.preventDefault(),e.moveActive(0,D?-1:1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),m();return;case u.key==="F2":u.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),m(),o.focusEditInput();return;case(D&&u.key==="F2"):u.preventDefault(),ft(e.activeCell.value.row,e.activeCell.value.col);return;case u.key==="Delete":case u.key==="Backspace":u.preventDefault(),l.saveUndo(),n.clearSelected(),m();return;case u.key==="Escape":u.preventDefault(),e.cancelEdit(),l.paintFmt.value=null,m();return;case Sl(u):if(Ml(u)){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),m(),o.focusEditInput();return}u.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(u.key),m(),t.nextTick(()=>{const j=o.editInputRef.value;j&&(j.focus(),j.setSelectionRange(1,1))});return}}let Nl=!1,Bl=!1;function Xr(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,m();return}e.editValue.value=y,oe.value=y}function Zr(){Nl=!0,e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),oe.value="",m())}function sr(u){Nl=!1,Bl=!0,setTimeout(()=>{Bl=!1},0);const y=u.target.value;e.editValue.value=y,oe.value=y}function cr(u){if(!e.editingCell.value){if(Sl(u)||Ml(u))return;ir(u);return}if(!(Nl||Ml(u))&&!(Bl&&(u.key==="Enter"||u.key==="Escape")))if(u.key==="Enter"&&(u.altKey||u.metaKey)){u.preventDefault();const y=o.editInputRef.value;if(!y)return;const D=y.selectionStart??y.value.length,j=y.selectionEnd??y.value.length,T=y.value,P=T.slice(0,D)+`
9
+ `+T.slice(j);e.editValue.value=P,y.value=P,y.selectionStart=y.selectionEnd=D+1,m()}else u.key==="Enter"?(u.preventDefault(),e.commitEdit().then(y=>{if(!y){m(),o.focusEditInput();return}e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),m(),o.focusEditInput()})):u.key==="Tab"?(u.preventDefault(),e.commitEdit().then(y=>{if(!y){m(),o.focusEditInput();return}e.moveActive(u.shiftKey?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),m(),o.focusEditInput()})):u.key==="Escape"&&(u.preventDefault(),e.cancelEdit(),m(),o.focusEditInput())}function Jr(u){e.editingCell.value}function Qr(){setTimeout(()=>{e.isValidationAlertOpen()||e.editingCell.value&&e.commitEdit().then(()=>m())},0)}let pn=null;function no(){var y;const u=(y=o.wrapperRef.value)==null?void 0:y.getBoundingClientRect();if(u){const D=Do(e.props.width),j=Do(e.props.height);D!=null?o.viewSize.w=D:o.viewSize.w=u.width,j!=null?o.viewSize.h=j:o.viewSize.h=u.height}o.clampScroll(null,null),m()}function ea(){t.onMounted(()=>{const u=Do(e.props.width),y=Do(e.props.height);(u==null||y==null)&&(pn=new ResizeObserver(()=>no()),o.wrapperRef.value&&pn.observe(o.wrapperRef.value)),t.nextTick(()=>{no(),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(D=>{const j=Ni(D,{colCount:e.props.colCount,rowCount:e.props.rowCount}),T=o.mkSheet(D.name,j),{cells:P,styles:ee}=fi(D.cells);if(Object.assign(T.cells,P),T.styles=D.styles??ee,D.borders)T.borders=D.borders;else{const Q=mi(T.styles);T.styles=Q.styles,T.borders=Q.borders}if(D.colWidths)for(const[Q,ue]of Object.entries(D.colWidths)){const w=Number(Q);w>=0&&w<T.colCount&&ue>=30&&(T.colWidths[w]=ue)}if(D.rowHeights)for(const[Q,ue]of Object.entries(D.rowHeights)){const w=Number(Q);w>=0&&w<T.rowCount&&ue>=24&&(T.rowHeights[w]=ue)}if(D.merges)for(const[Q,ue]of Object.entries(D.merges))T.merges[Q]={...ue};return T.freeze=D.freeze?{rows:D.freeze.rows,cols:D.freeze.cols}:{rows:0,cols:0},T.filter=xi(D.filter,T.cells),T.dataValidations=Array.isArray(D.dataValidations)?[...D.dataValidations]:[],T.notes=D.notes?Object.fromEntries(Object.entries(D.notes).map(([Q,ue])=>[Q,{...ue}])):{},T}),o.sheets.value.length>0&&o.loadSheet(0))}),t.watch(()=>[e.props.width,e.props.height],()=>{const u=Do(e.props.width),y=Do(e.props.height);u!=null&&y!=null?(pn==null||pn.disconnect(),pn=null):!pn&&o.wrapperRef.value&&(pn=new ResizeObserver(()=>no()),pn.observe(o.wrapperRef.value)),t.nextTick(()=>no())}),t.watch(()=>e.props.theme,()=>{B=gi(e.props.theme),m()}),t.watch(()=>({...e.cells}),()=>t.nextTick(()=>o.emitModelData()),{deep:!1}),t.watch(()=>({...e.merges}),()=>{t.nextTick(()=>o.emitModelData()),m()},{deep:!1}),t.watch(o.activeSheetIndex,()=>t.nextTick(()=>o.emitModelData())),t.watch(()=>o.modelData.value,u=>{if(!u||u.length===0)return;const y=JSON.stringify(u);if(y===a.value)return;a.value=y;const D=e.selection.value?{...e.selection.value}:null,j={...e.activeCell.value};o.sheets.value=u.map(Q=>{const ue=Ni(Q,{colCount:e.props.colCount,rowCount:e.props.rowCount}),w=o.mkSheet(Q.name,ue),{cells:s,styles:f}=fi(Q.cells);if(Object.assign(w.cells,s),w.styles=Q.styles??f,Q.borders)w.borders=Q.borders;else{const b=mi(w.styles);w.styles=b.styles,w.borders=b.borders}if(Q.colWidths)for(const[b,R]of Object.entries(Q.colWidths)){const I=Number(b);I>=0&&I<w.colCount&&R>=30&&(w.colWidths[I]=R)}if(Q.rowHeights)for(const[b,R]of Object.entries(Q.rowHeights)){const I=Number(b);I>=0&&I<w.rowCount&&R>=24&&(w.rowHeights[I]=R)}if(Q.merges)for(const[b,R]of Object.entries(Q.merges))w.merges[b]={...R};return w.freeze=Q.freeze?{rows:Q.freeze.rows,cols:Q.freeze.cols}:{rows:0,cols:0},w.filter=xi(Q.filter,w.cells),w.dataValidations=Array.isArray(Q.dataValidations)?[...Q.dataValidations]:[],w.rowOutlines=Array.isArray(Q.rowOutlines)?Q.rowOutlines.map(b=>({...b})):[],w.columnOutlines=Array.isArray(Q.columnOutlines)?Q.columnOutlines.map(b=>({...b})):[],w.notes=Q.notes?Object.fromEntries(Object.entries(Q.notes).map(([b,R])=>[b,{...R}])):{},w}),o.sheets.value.length>0&&o.loadSheet(0),D&&(e.selection.value=D),e.activeCell.value=j;const T=e.activeCell.value,P=e.selection.value,ee=e.findMerge(T.col,T.row);ee&&ee.anchor===e.cellKey(T.col,T.row)&&(!P||P.startCol===T.col&&P.startRow===T.row&&P.endCol===T.col&&P.endRow===T.row)&&e.selectCell(T.col,T.row),m()},{deep:!0}),t.onBeforeUnmount(()=>{pn==null||pn.disconnect()})}return{scheduleRender:m,render:O,renderFrozenOverlay:L,activeCellLabel:et,formulaBarDisplay:se,formulaBarDraft:oe,formulaBarExpanded:xe,onFormulaBarFocus:de,onFormulaBarInput:we,onFormulaBarKeydown:A,onFormulaBarBlur:K,acceptFormulaBarEdit:rt,cancelFormulaBarEdit:je,insertFunctionIntoCell:Re,renTab:$,renTabVal:V,onTabClick:x,onTabDblClick:H,commitTabRename:z,cclTabRename:Y,onTabRenameKd:ve,ctxMenu:ze,ctxSubmenuLeft:p,filterPopup:an,isFilterButtonHit:Ve,openFilterPopup:He,closeFilterPopup:Me,validationDropdown:sn,isValidationDropdownHit:U,openValidationDropdown:W,closeValidationDropdown:X,onValidationDropdownSelect:Ce,onCtxItemEnter:N,onTabCtxMenu:vt,onTabBarCtx:Kt,onCornerCtx:Nt,onRowHdrCtx:fo,onColHdrCtx:mo,onCellCtx:Xt,noteUi:it,openNote:lt,closeNote:wt,editNoteAt:ft,saveNoteAt:At,removeNoteAt:Ft,isNoteIndicatorHit:wn,dimInputRef:Gl,dimPanel:Qn,openDimPanel:bl,onDimInput:Yl,onDimKeydown:$r,onDimBlur:zr,applyDimPanel:jl,closeDimPanel:jo,outlineGroupRows:()=>re("row"),outlineGroupCols:()=>re("column"),outlineUngroupRows:()=>Se("row"),outlineUngroupCols:()=>Se("column"),outlineExpandRows:()=>Te("row",!1),outlineCollapseRows:()=>Te("row",!0),outlineExpandCols:()=>Te("column",!1),outlineCollapseCols:()=>Te("column",!0),get showOutlineAlert(){return c},set showOutlineAlert(u){c=u},editInputStyle:_r,hScrollbarW:wl,vScrollbarH:Xo,hScrollbarLeft:Xl,vScrollbarTop:Hr,hTrackW:Lo,vTrackH:$o,hThumbW:Zo,hThumbL:Jo,vThumbH:Qo,vThumbT:vl,onVStart:Zl,onHStart:ho,onSbMove:nl,onSbUp:ol,onVTrk:eo,onHTrk:ll,onMouseDown:Wr,onMouseMove:Ur,onMouseUp:Pr,onMouseLeave:ar,onCanvasCtx:Kr,onDblClick:Gr,onWheel:qr,onTouchStart:Yr,onTouchMove:jr,onTouchEnd:Rl,onKeydown:ir,onEditInput:Xr,onEditCompositionStart:Zr,onEditCompositionEnd:sr,onEditKd:cr,onEditPaste:Jr,onEditBlur:Qr,applySize:no,setupLifecycle:ea}}function s2(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ti(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 c2(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 d2(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(s2(l),"gi"),()=>n):e}function Lr(e,l,n,o,a,i,r){const d=[];if(r){for(let c=r.startRow;c<=r.endRow;c++)for(let C=r.startCol;C<=r.endCol;C++){const h=e[n(C,c)];h&&Ti(h.value,o,a,i)&&d.push({sheetIndex:l,col:C,row:c})}return d}for(const c in e){const C=e[c];if(C&&Ti(C.value,o,a,i)){const h=c.split(","),S=Number(h[0]),m=Number(h[1]);!Number.isNaN(S)&&!Number.isNaN(m)&&d.push({sheetIndex:l,col:S,row:m})}}return d}function u2(e,l,n,o){const a=t.ref(!1),i=t.ref(""),r=t.ref(""),d=t.ref("sheet"),c=t.ref(!1),C=t.ref(!1),h=t.ref(-1),S=t.ref([]),m=t.ref(""),M=t.ref(0),E=t.ref(""),B=t.computed(()=>{const oe=new Set,xe=n.activeSheetIndex.value;for(const se of S.value)se.sheetIndex===xe&&oe.add(`${se.col},${se.row}`);return oe}),G=t.computed(()=>{if(h.value<0||h.value>=S.value.length)return null;const oe=S.value[h.value];return oe.sheetIndex!==n.activeSheetIndex.value?null:`${oe.col},${oe.row}`});e.findHighlight=(oe,xe)=>{const se=`${oe},${xe}`;return G.value===se?"active":B.value.has(se)?"match":null};function te(oe){var de,we;const xe=e.cellKey(oe.col,oe.row);if(oe.sheetIndex===n.activeSheetIndex.value)return((de=e.cells[xe])==null?void 0:de.value)??"";const se=n.sheets.value[oe.sheetIndex];return((we=se==null?void 0:se.cells[xe])==null?void 0:we.value)??""}function ge(oe,xe){const se=e.cellKey(oe.col,oe.row);if(oe.sheetIndex===n.activeSheetIndex.value)e.setCellValue(oe.col,oe.row,xe);else{const de=n.sheets.value[oe.sheetIndex];if(!de)return;const we=de.cells[se];de.cells[se]={value:String(xe),styleId:we==null?void 0:we.styleId}}}function fe(){if(E.value){m.value=E.value;return}if(!i.value){m.value="";return}if(d.value==="selection"&&!e.selection.value){m.value=g(e.locale.value,"findNeedSelection");return}if(S.value.length===0){m.value=g(e.locale.value,"findNoResult");return}m.value=""}function Ie(){const oe=i.value,xe=[];if(oe)if(d.value==="workbook")n.sheets.value.forEach((se,de)=>{xe.push(...Lr(se.cells,de,e.cellKey,oe,c.value,C.value))});else if(d.value==="selection"){const se=e.selection.value;se&&xe.push(...Lr(e.cells,n.activeSheetIndex.value,e.cellKey,oe,c.value,C.value,se))}else xe.push(...Lr(e.cells,n.activeSheetIndex.value,e.cellKey,oe,c.value,C.value));S.value=xe,xe.length===0?h.value=-1:h.value>=xe.length?h.value=xe.length-1:h.value<0&&(h.value=0),fe()}function me(){if(h.value<0||h.value>=S.value.length)return;const oe=S.value[h.value];oe.sheetIndex!==n.activeSheetIndex.value&&n.switchSheet(oe.sheetIndex),d.value==="selection"?e.activeCell.value={col:oe.col,row:oe.row}:e.selectCell(oe.col,oe.row),e.ensureVisible(oe.col,oe.row)}const Ee=typeof requestAnimationFrame=="function"?requestAnimationFrame:oe=>setTimeout(oe,16);let Ae=!1,ce=!1;function ae(oe){if(Ae){ce=ce||oe;return}Ae=!0,ce=oe,Ee(()=>{var xe;Ae=!1,Ie(),ce&&S.value.length>0&&h.value>=0&&me(),ce=!1,(xe=e.scheduleRender)==null||xe.call(e)})}function qe(){var oe;a.value=!0,M.value++,Ie(),S.value.length>0&&(h.value=0,me()),(oe=e.scheduleRender)==null||oe.call(e)}function ut(){qe()}function J(){var oe;a.value=!1,S.value=[],h.value=-1,E.value="",m.value="",(oe=e.scheduleRender)==null||oe.call(e)}function O(){var oe;S.value.length!==0&&(h.value=(h.value+1)%S.value.length,me(),(oe=e.scheduleRender)==null||oe.call(e))}function L(){var oe;S.value.length!==0&&(h.value=(h.value-1+S.value.length)%S.value.length,me(),(oe=e.scheduleRender)==null||oe.call(e))}function le(){var we,Re;if(h.value<0||h.value>=S.value.length)return;const oe=S.value[h.value],xe=te(oe),se=c2(xe,i.value,r.value,c.value);if(se===xe)return;l.saveUndo(),ge(oe,se);const de=h.value;Ie(),S.value.length>0?(h.value=Math.min(de,S.value.length-1),O()):h.value=-1,(we=e.emitModelData)==null||we.call(e),(Re=e.scheduleRender)==null||Re.call(e)}function $e(){var de,we;const oe=i.value;if(!oe||S.value.length===0)return;l.saveUndo();let xe=0;const se=S.value.slice();for(const Re of se){const Ke=te(Re),We=d2(Ke,oe,r.value,c.value);We!==Ke&&(ge(Re,We),xe++)}S.value=[],h.value=-1,E.value=g(e.locale.value,"findReplacedAll").replace("{n}",String(xe)),fe(),(de=e.emitModelData)==null||de.call(e),(we=e.scheduleRender)==null||we.call(e)}function et(){const oe=xe=>{if(!(xe.ctrlKey||xe.metaKey))return;const de=xe.key.toLowerCase();(de==="f"||de==="h")&&(xe.preventDefault(),qe())};window.addEventListener("keydown",oe),t.onBeforeUnmount(()=>window.removeEventListener("keydown",oe))}return t.watch(i,()=>{a.value&&(E.value="",h.value=0,ae(!0))}),t.watch([d,c,C],()=>{a.value&&(E.value="",h.value=0,ae(!0))}),t.watch(e.cells,()=>{a.value&&ae(!1)},{deep:!0}),t.watch(()=>e.selection.value,()=>{a.value&&d.value==="selection"&&(h.value=0,ae(!0))}),t.watch([()=>l.undoStack.value.length,()=>l.redoStack.value.length],()=>{a.value&&ae(!1)}),{open:a,findText:i,replaceText:r,scope:d,matchCase:c,matchEntireCell:C,currentIndex:h,results:S,message:m,focusToken:M,activeSheetMatches:B,activeMatchKey:G,openFind:qe,openReplace:ut,close:J,recompute:Ie,findNext:O,findPrev:L,replace:le,replaceAll:$e,setupLifecycle:et}}const f2={class:"formula-bar__cell-label"},m2={class:"formula-bar__buttons"},p2=["title","aria-label"],h2=["title","aria-label"],g2=["title","aria-label"],b2=["rows","value"],y2=["title"],C2={key:0,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},w2={key:1,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},v2=["value"],k2={key:2,class:"sb-corner"},E2=["onClick","onMouseenter"],R2={class:"context-menu__label"},M2={key:0,class:"context-menu__arrow",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"22869"},S2=["onClick"],N2={key:0,class:"cf-modal-mask"},B2={key:0,class:"cf-modal-mask"},x2={class:"dim-panel__title"},T2={class:"dim-panel__body"},V2=["value"],D2={key:0,class:"dim-panel__error"},F2={class:"dim-panel__footer"},Vi=Ot(t.defineComponent({__name:"spreader",props:t.mergeModels({rowCount:{default:200},colCount:{default:26},width:{},height:{},theme:{default:"light"},locale:{default:"zh-CN"},noteAuthor:{default:ta}},{data:{default:()=>[]},dataModifiers:{}}),emits:["update:data"],setup(e){const l=e,n=t.useModel(e,"data"),o={value:""},a=Hp(l,{rowCount:l.rowCount,colCount:l.colCount,theme:l.theme,locale:l.locale}),i={sheets:t.ref([]),activeSheetIndex:t.ref(0),saveSheet:()=>{},loadSheet:F=>{},mkSheet:F=>({id:"",name:F,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=Wp(a,i),d=Zp(a,r);Up(r,{borderMenuOpen:d.borderMenuOpen,mergeMenuOpen:d.mergeMenuOpen});const c=a2(a,r,n,void 0,o);i.sheets=c.sheets,i.activeSheetIndex=c.activeSheetIndex,i.saveSheet=c.saveSheet,i.loadSheet=c.loadSheet,i.mkSheet=c.mkSheet;function C(){const F=document.documentElement,p=c.toolbarThemeVars.value;for(const[N,bt]of Object.entries(p))F.style.setProperty(N,bt)}t.watch(()=>c.toolbarThemeVars.value,C,{immediate:!0,deep:!0}),t.onBeforeUnmount(()=>{const F=document.documentElement;for(const p of Object.keys(c.toolbarThemeVars.value))F.style.removeProperty(p)});const h=i2(a,r,d,c,o);h.setupLifecycle();const S=u2(a,r,c);S.setupLifecycle();const m=t.reactive(a),M=t.reactive(r),E=t.reactive(d),B=t.reactive(c),G=c.sheets,te=c.activeSheetIndex,ge=c.sortMenuOpen,fe=c.cachedSortOrder,Ie=t.ref(!1),me=t.ref(!1),Ee=t.ref(!1),Ae=t.ref(!1),ce=t.ref(!1),ae=t.ref(!1),qe=t.ref(!1),ut=t.computed(()=>{const F=m.selection;return F?F.startCol===0&&F.endCol===m.colCount-1?"rows":F.startRow===0&&F.endRow===m.rowCount-1?"cols":null:null}),J=t.reactive(h),O=t.reactive(S),L=t.computed(()=>{const F=m.selection;return!!F&&F.startCol===F.endCol&&F.startRow===F.endRow}),le=t.computed(()=>{const F=m.selection;return F?c.canSortColumns(F.startCol,F.endCol):!1}),$e=t.computed(()=>{if(m.getFilter()!==null)return!0;const F=m.selection;if(!F)return!0;const p=Math.min(F.startCol,F.endCol),N=Math.max(F.startCol,F.endCol),bt=Math.min(F.startRow,F.endRow),vt=Math.max(F.startRow,F.endRow);for(const Kt in m.merges){const Nt=m.merges[Kt];if(!(Nt.startCol===Nt.endCol&&Nt.startRow===Nt.endRow)&&p<=Nt.endCol&&N>=Nt.startCol&&bt<=Nt.endRow&&vt>=Nt.startRow)return!1}return!0}),et=t.computed(()=>{const F=M.selNumberFormat;if(F!==jn&&F!==io)return F;const p=m.activeCell,N=a.resolveStyle(m.cells[m.cellKey(p.col,p.row)]);return typeof(N==null?void 0:N.numberFormat)=="string"?N.numberFormat:""});function oe(F){r.nfDialogOpen.value=F}const xe=t.ref(!1);function se(){xe.value=!0}function de(F){xe.value=F}function we(F){h.insertFunctionIntoCell(F)}function Re(){m.toggleAutoFilter(),J.scheduleRender()}function Ke(F){const p=m.getFilter();return p?m.getCellValue(F,p.range.startRow):""}const We=t.computed(()=>{const F=m.selection,p=F?F.startRow:m.activeCell.row,N=F?F.startCol:m.activeCell.col;return p===0&&N===0});function rt(F){const p=m.freeze;if(F==="panes"){const N=m.selection,bt=N?N.startRow:m.activeCell.row,vt=N?N.startCol:m.activeCell.col;m.setFreeze(bt,vt)}else F==="firstRow"?m.setFreeze(1,p.cols):F==="firstCol"?m.setFreeze(p.rows,1):F==="unfreeze"&&m.clearFreeze();J.scheduleRender()}const je=t.ref(null),A=t.ref(!1),K=t.ref(!1),$=t.ref(null),V=t.ref("create"),x=t.computed(()=>{const F=m.selection;if(F){const N=pt(F.startCol)+(F.startRow+1),bt=pt(F.endCol)+(F.endRow+1);return F.startCol===F.endCol&&F.startRow===F.endRow?N:`${N}:${bt}`}const p=m.activeCell;return pt(p.col)+(p.row+1)});function H(F){var bt;let p;["equal","notEqual","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual","between","notBetween"].includes(F)?p={type:"cellIs",operator:F,value:""}:F==="textContains"?p={type:"textContains",value:""}:F==="textNotContains"?p={type:"textNotContains",value:""}:F==="blank"?p={type:"blank"}:F==="notBlank"?p={type:"notBlank"}:F==="duplicate"?p={type:"duplicate"}:F==="unique"?p={type:"unique"}:p={type:"cellIs",operator:"greaterThan",value:""},$.value={id:"",condition:p,format:{backgroundColor:"#DEEBF7",color:"#17375E"},ranges:[],priority:0,stopIfTrue:!1,enabled:!0},V.value="create",(bt=je.value)==null||bt.closeOverflow(),K.value=!0}function z(){var F;$.value={id:"",condition:{type:"cellIs",operator:"greaterThan",value:""},format:{backgroundColor:"#DEEBF7",color:"#17375E"},ranges:[],priority:0,stopIfTrue:!1,enabled:!0},V.value="create",(F=je.value)==null||F.closeOverflow(),K.value=!0}function Y(){var F;(F=je.value)==null||F.closeOverflow(),A.value=!0}function ve(F){m.clearConditionalFormats(F),J.scheduleRender()}function ze(F){F.id?m.updateConditionalFormatRule(F.id,F):m.addConditionalFormatRule(F),K.value=!1}function it(F){var p;$.value=F,V.value="edit",(p=je.value)==null||p.closeOverflow(),K.value=!0}function Fe(F){m.removeConditionalFormatRule(F)}function v(F,p){m.moveConditionalFormatRule(F,p)}function Z(F,p){m.updateConditionalFormatRule(F,{enabled:p})}const lt=t.ref(!1),wt=t.ref(null),ft=t.ref("create"),At=t.computed(()=>{const F=m.selection;if(F){const N=pt(F.startCol)+(F.startRow+1),bt=pt(F.endCol)+(F.endRow+1);return F.startCol===F.endCol&&F.startRow===F.endRow?N:`${N}:${bt}`}const p=m.activeCell;return pt(p.col)+(p.row+1)}),Ft=t.ref(null);let Vt=null;function wn(F){return new Promise(p=>{Vt=p,Ft.value={...F}})}a.showValidationAlert=wn;const an=t.ref(null);function sn(F){an.value=F}function mn(){an.value=null}h.showOutlineAlert=sn,a.getSheetCellsById=F=>{const p=c.sheets.value.findIndex(N=>N.id===F||N.name===F);return p<0?null:p===c.activeSheetIndex.value?a.cells:c.sheets.value[p].cells},a.requestDataValidationDialog=()=>Dt();function Dt(){var N;const F=m.activeCell,p=a.getDataValidationRule(F.row,F.col);wt.value=p?JSON.parse(JSON.stringify(p)):null,ft.value=p?"edit":"create",(N=je.value)==null||N.closeOverflow(),lt.value=!0}function Jt(F){if(F.type==="any"){F.ranges.forEach(p=>a.clearDataValidation(p)),lt.value=!1,h.scheduleRender();return}F.id?a.updateDataValidation(F.id,F):a.createDataValidation(F),lt.value=!1,h.scheduleRender()}function Qt(){const F=m.selection;F&&a.clearDataValidation(F),lt.value=!1,h.scheduleRender()}function $n(F){Ft.value=null;const p=Vt;Vt=null,t.nextTick(()=>{const N=m.editingCell;N&&(a.selectCell(N.col,N.row),a.ensureVisible(N.col,N.row),h.scheduleRender(),c.focusEditInput())}),p==null||p(F)}const Zt=t.computed(()=>{const F=m.activeCell,p=a.getValidationInputMessage(F.row,F.col);if(!p)return null;const N=a.cellToScreenRect(F.row,F.col),bt=c.wrapperRef.value,vt=bt?bt.getBoundingClientRect():{left:0,top:0};return{title:p.title,message:p.message,x:vt.left+N.x,y:vt.top+N.y,width:N.width,height:N.height}}),Vn=t.computed(()=>{const F=h.noteUi.value;if(!F)return null;const p=a.cellToScreenRect(F.row,F.col);return{x:p.x,y:p.y,width:p.width,height:p.height}}),U=t.computed(()=>{const F=h.noteUi.value;return F?a.getNote(F.row,F.col)??null:null}),W=t.computed(()=>g(m.locale,"notePlaceholder")),X=t.computed(()=>{const F=h.noteUi.value;if(!F)return!1;const p=m.freeze;return F.row<p.rows&&F.col<p.cols});function Ce(F){r.fontSizeMenuOpen.value=F}function Ne(F){r.textColorMenuOpen.value=F}function Ve(F){r.fillColorMenuOpen.value=F}function He(F){switch(F){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 Me(F){h.renTabVal.value=F}function Le(){h.ctxMenu.value=null}const be=F=>{c.formulaBarRef.value=F};function tt(){h.formulaBarExpanded.value=!h.formulaBarExpanded.value}const k=t.ref(null),q=F=>{c.wrapperRef.value=F,k.value=F},re=F=>{c.canvasRef.value=F},Se=F=>{c.freezeCanvasRef.value=F},Te=F=>{c.editInputRef.value=F},pe=F=>{h.dimInputRef.value=F};return(F,p)=>(t.openBlock(),t.createElementBlock("div",{class:"spreadsheet-outer",style:t.normalizeStyle(B.outerStyle)},[t.createVNode(hu,{ref_key:"toolbarRef",ref:je,locale:m.locale,"can-undo":M.canUndo,"can-redo":M.canRedo,"paint-fmt-active":M.paintFmt!==null,"has-selection":M.hasSelection,"font-family-options":M.fontFamilyOptions,"font-size-options":M.fontSizeOptions,"sel-font-family":M.selFontFamily,"sel-font-size":M.selFontSize,"font-size-input":M.fontSizeInput,"font-size-menu-open":M.fontSizeMenuOpen,"sel-font-weight":M.selFontWeight,"sel-font-style":M.selFontStyle,"sel-underline":M.selUnderline,"sel-strikethrough":M.selStrikethrough,"sel-text-color":M.selTextColor,"text-color-menu-open":M.textColorMenuOpen,"sel-fill-color":M.selFillColor,"fill-color-menu-open":M.fillColorMenuOpen,"cached-text-color":M.cachedTextColor,"cached-fill-color":M.cachedFillColor,"border-menu-open":E.borderMenuOpen,"cached-border":E.cachedBorder,"cached-border-color":E.cachedBorderColor,"cached-border-line-style":E.cachedBorderLineStyle,"sort-menu-open":t.unref(ge),"cached-sort-order":t.unref(fe),"can-sort":le.value,"outline-menu-open":Ie.value,"outline-axis":ut.value,"can-filter":$e.value,"filter-active":m.getFilter()!==null,"h-align-options":M.hAlignOptions,"v-align-options":M.vAlignOptions,"sel-h-align":M.selHAlign,"sel-v-align":M.selVAlign,"sel-wrap":M.selWrap,"merge-menu-open":E.mergeMenuOpen,"calc-menu-open":E.calcMenuOpen,"cf-menu-open":me.value,"freeze-menu-open":Ee.value,"font-menu-open":Ae.value,"h-align-menu-open":ce.value,"v-align-menu-open":ae.value,"num-fmt-menu-open":qe.value,"is-single-cell":L.value,"has-freeze":m.freeze.rows>0||m.freeze.cols>0,"freeze-panes-disabled":We.value,"sel-number-format":M.selNumberFormatDisplay,"nf-options":M.nfOptions,"can-increase-decimals":M.canIncreaseDecimals,"can-decrease-decimals":M.canDecreaseDecimals,"boundary-el":k.value,"theme-vars":B.toolbarThemeVars,onUndo:p[0]||(p[0]=N=>M.undo()),onRedo:p[1]||(p[1]=N=>M.redo()),onPaintFormat:M.onPaintFormat,onClearFormat:p[2]||(p[2]=N=>M.clearFormat()),onNumberFormatChange:p[3]||(p[3]=N=>M.onNumberFormatChange(N)),onIncreaseDecimals:M.onIncreaseDecimals,onDecreaseDecimals:M.onDecreaseDecimals,onFontFamilyChange:p[4]||(p[4]=N=>M.onFontFamilyChange(N)),onFontSizeInput:p[5]||(p[5]=N=>M.onFontSizeInput(N)),onFontSizeBlur:M.onFontSizeBlur,onFontSizeKeydown:p[6]||(p[6]=N=>M.onFontSizeKeydown(N)),onFontSizeChange:p[7]||(p[7]=N=>M.onFontSizeChange(N)),"onUpdate:fontSizeMenuOpen":p[8]||(p[8]=N=>Ce(N)),onFontSizeToggle:p[9]||(p[9]=N=>M.toggleFontSizeMenu()),onFontSizeStepUp:M.onFontSizeStepUp,onFontSizeStepDown:M.onFontSizeStepDown,onBoldToggle:M.toggleFontWeight,onItalicToggle:M.toggleFontStyle,onUnderlineToggle:M.toggleUnderline,onStrikethroughToggle:M.toggleStrikethrough,onTextColorChange:p[10]||(p[10]=N=>M.onTextColorChange(N)),"onUpdate:textColorMenuOpen":p[11]||(p[11]=N=>Ne(N)),onFillColorChange:p[12]||(p[12]=N=>M.onFillColorChange(N)),"onUpdate:fillColorMenuOpen":p[13]||(p[13]=N=>Ve(N)),onApplyTextColor:M.applyCachedTextColor,onApplyFillColor:M.applyCachedFillColor,"onUpdate:borderMenuOpen":p[14]||(p[14]=N=>M.onBorderMenuToggle(N)),onBorderChange:p[15]||(p[15]=N=>E.onBorderChange(N)),onBorderColorChange:p[16]||(p[16]=N=>E.onBorderColorChange(N)),onBorderLineStyleChange:p[17]||(p[17]=N=>E.onBorderLineStyleChange(N)),onApplyBorder:E.applyCachedBorder,"onUpdate:sortMenuOpen":p[18]||(p[18]=N=>B.onSortMenuToggle(N)),onSortChange:p[19]||(p[19]=N=>B.onSortChange(N)),onApplySort:B.applyCachedSort,"onUpdate:outlineMenuOpen":p[20]||(p[20]=N=>Ie.value=N),onOutlineAction:p[21]||(p[21]=N=>He(N)),onToggleFilter:Re,onFreezeChange:p[22]||(p[22]=N=>rt(N)),onHAlignChange:p[23]||(p[23]=N=>M.onHAlignChange(N)),onVAlignChange:p[24]||(p[24]=N=>M.onVAlignChange(N)),onWrapToggle:M.onWrapToggle,"onUpdate:mergeMenuOpen":p[25]||(p[25]=N=>E.onMergeMenuToggle(N)),onMergeChange:p[26]||(p[26]=N=>E.onMergeChange(N)),onApplyMerge:E.onApplyMerge,"onUpdate:calcMenuOpen":p[27]||(p[27]=N=>E.onCalcMenuToggle(N)),"onUpdate:cfMenuOpen":p[28]||(p[28]=N=>me.value=N),"onUpdate:freezeMenuOpen":p[29]||(p[29]=N=>Ee.value=N),"onUpdate:fontMenuOpen":p[30]||(p[30]=N=>Ae.value=N),"onUpdate:hAlignMenuOpen":p[31]||(p[31]=N=>ce.value=N),"onUpdate:vAlignMenuOpen":p[32]||(p[32]=N=>ae.value=N),"onUpdate:numFmtMenuOpen":p[33]||(p[33]=N=>qe.value=N),onCalcSum:E.onCalcSum,onCalcAvg:E.onCalcAvg,onCalcCount:E.onCalcCount,onFind:p[34]||(p[34]=N=>t.unref(S).openFind()),onCfPreset:p[35]||(p[35]=N=>H(N)),onCfNewRule:z,onCfManage:Y,onCfClear:p[36]||(p[36]=N=>ve(N)),onOpenDataValidation:Dt},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(Pu,{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:m.locale,"theme-vars":B.toolbarThemeVars,"onUpdate:findText":p[37]||(p[37]=N=>t.unref(S).findText.value=N),"onUpdate:replaceText":p[38]||(p[38]=N=>t.unref(S).replaceText.value=N),"onUpdate:scope":p[39]||(p[39]=N=>t.unref(S).scope.value=N),"onUpdate:matchCase":p[40]||(p[40]=N=>t.unref(S).matchCase.value=N),"onUpdate:matchEntireCell":p[41]||(p[41]=N=>t.unref(S).matchEntireCell.value=N),onPrev:p[42]||(p[42]=N=>t.unref(S).findPrev()),onNext:p[43]||(p[43]=N=>t.unref(S).findNext()),onReplace:p[44]||(p[44]=N=>t.unref(S).replace()),onReplaceAll:p[45]||(p[45]=N=>t.unref(S).replaceAll()),onClose:p[46]||(p[46]=N=>t.unref(S).close())},null,8,["open","find-text","replace-text","scope","match-case","match-entire-cell","current-index","total","message","focus-token","locale","theme-vars"]),t.createVNode(yf,{"model-open":M.nfDialogOpen,locale:m.locale,"current-format":et.value,"is-custom":M.selNumberFormat===t.unref(io),"onUpdate:modelOpen":p[47]||(p[47]=N=>oe(N)),onApply:p[48]||(p[48]=N=>M.applyNumberFormatCode(N))},null,8,["model-open","locale","current-format","is-custom"]),t.createVNode(Nf,{"model-open":B.sortConfirmOpen,locale:m.locale,"onUpdate:modelOpen":p[49]||(p[49]=N=>B.sortConfirmOpen=N),onConfirm:p[50]||(p[50]=N=>B.confirmSort(N)),onCancel:p[51]||(p[51]=N=>B.cancelSortConfirmation())},null,8,["model-open","locale"]),t.createVNode(Kf,{"model-open":xe.value,locale:m.locale,"onUpdate:modelOpen":p[52]||(p[52]=N=>de(N)),onInsert:p[53]||(p[53]=N=>we(N))},null,8,["model-open","locale"]),t.createElementVNode("div",{class:t.normalizeClass(["formula-bar",{"formula-bar--expanded":J.formulaBarExpanded}])},[t.createElementVNode("div",f2,t.toDisplayString(J.activeCellLabel),1),t.createElementVNode("div",m2,[t.createElementVNode("button",{type:"button",class:"formula-bar__btn formula-bar__btn--cancel",title:t.unref(g)(m.locale,"formulaBarCancel"),"aria-label":t.unref(g)(m.locale,"cancel"),onMousedown:p[54]||(p[54]=t.withModifiers(()=>{},["prevent"])),onClick:p[55]||(p[55]=t.withModifiers((...N)=>J.cancelFormulaBarEdit&&J.cancelFormulaBarEdit(...N),["stop"]))},[...p[118]||(p[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,p2),t.createElementVNode("button",{type:"button",class:"formula-bar__btn formula-bar__btn--accept",title:t.unref(g)(m.locale,"formulaBarAccept"),"aria-label":t.unref(g)(m.locale,"accept"),onMousedown:p[56]||(p[56]=t.withModifiers(()=>{},["prevent"])),onClick:p[57]||(p[57]=t.withModifiers((...N)=>J.acceptFormulaBarEdit&&J.acceptFormulaBarEdit(...N),["stop"]))},[...p[119]||(p[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,h2),t.createElementVNode("button",{type:"button",class:"formula-bar__btn formula-bar__btn--fx",title:t.unref(g)(m.locale,"insertFunctionTitle"),"aria-label":t.unref(g)(m.locale,"insertFunctionTitle"),onMousedown:p[58]||(p[58]=t.withModifiers(()=>{},["prevent"])),onClick:t.withModifiers(se,["stop"])},[...p[120]||(p[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,g2)]),t.createElementVNode("textarea",{ref:be,class:t.normalizeClass(["formula-bar__input",{"formula-bar__input--expanded":J.formulaBarExpanded}]),rows:J.formulaBarExpanded?3:1,value:J.formulaBarDisplay,spellcheck:"false",onFocus:p[59]||(p[59]=(...N)=>J.onFormulaBarFocus&&J.onFormulaBarFocus(...N)),onInput:p[60]||(p[60]=(...N)=>J.onFormulaBarInput&&J.onFormulaBarInput(...N)),onKeydown:p[61]||(p[61]=(...N)=>J.onFormulaBarKeydown&&J.onFormulaBarKeydown(...N)),onBlur:p[62]||(p[62]=(...N)=>J.onFormulaBarBlur&&J.onFormulaBarBlur(...N))},null,42,b2),t.createElementVNode("button",{type:"button",class:"formula-bar__toggle",title:t.unref(g)(m.locale,J.formulaBarExpanded?"formulaBarCollapse":"formulaBarExpand"),onMousedown:p[63]||(p[63]=t.withModifiers(()=>{},["prevent"])),onClick:t.withModifiers(tt,["stop"])},[J.formulaBarExpanded?(t.openBlock(),t.createElementBlock("svg",w2,[...p[122]||(p[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",C2,[...p[121]||(p[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,y2)],2),t.createElementVNode("div",{ref:q,class:"spreadsheet-wrapper"},[t.createElementVNode("canvas",{ref:re,class:"grid-canvas",tabindex:"0",onMousedown:p[64]||(p[64]=(...N)=>J.onMouseDown&&J.onMouseDown(...N)),onMousemove:p[65]||(p[65]=(...N)=>J.onMouseMove&&J.onMouseMove(...N)),onMouseup:p[66]||(p[66]=(...N)=>J.onMouseUp&&J.onMouseUp(...N)),onMouseleave:p[67]||(p[67]=(...N)=>J.onMouseLeave&&J.onMouseLeave(...N)),onDblclick:p[68]||(p[68]=(...N)=>J.onDblClick&&J.onDblClick(...N)),onWheel:p[69]||(p[69]=t.withModifiers((...N)=>J.onWheel&&J.onWheel(...N),["prevent"])),onFocus:p[70]||(p[70]=(...N)=>B.onCanvasFocus&&B.onCanvasFocus(...N)),onKeydown:p[71]||(p[71]=(...N)=>J.onKeydown&&J.onKeydown(...N)),onContextmenu:p[72]||(p[72]=(...N)=>J.onCanvasCtx&&J.onCanvasCtx(...N)),onTouchstart:p[73]||(p[73]=t.withModifiers((...N)=>J.onTouchStart&&J.onTouchStart(...N),["prevent"])),onTouchmove:p[74]||(p[74]=t.withModifiers((...N)=>J.onTouchMove&&J.onTouchMove(...N),["prevent"])),onTouchend:p[75]||(p[75]=(...N)=>J.onTouchEnd&&J.onTouchEnd(...N))},null,32),t.createElementVNode("canvas",{ref:Se,class:"grid-canvas grid-canvas--freeze","aria-hidden":"true"}),t.createElementVNode("textarea",{ref:Te,class:"cell-editor",value:m.editValue,style:t.normalizeStyle(J.editInputStyle),onInput:p[76]||(p[76]=(...N)=>J.onEditInput&&J.onEditInput(...N)),onKeydown:p[77]||(p[77]=(...N)=>J.onEditKd&&J.onEditKd(...N)),onCompositionstart:p[78]||(p[78]=(...N)=>J.onEditCompositionStart&&J.onEditCompositionStart(...N)),onCompositionend:p[79]||(p[79]=(...N)=>J.onEditCompositionEnd&&J.onEditCompositionEnd(...N)),onBlur:p[80]||(p[80]=(...N)=>J.onEditBlur&&J.onEditBlur(...N)),onPaste:p[81]||(p[81]=(...N)=>J.onEditPaste&&J.onEditPaste(...N))},null,44,v2),B.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"v-scrollbar",style:t.normalizeStyle({top:J.vScrollbarTop+"px",height:`calc(100% - ${J.vScrollbarTop+t.unref(11)}px)`})},[t.createElementVNode("button",{class:"sb-btn sb-btn--up",title:"",onMousedown:p[82]||(p[82]=t.withModifiers(N=>{B.clampScroll(null,m.scrollY-50),J.scheduleRender()},["prevent"]))},[...p[123]||(p[123]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--up"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--v",onMousedown:p[84]||(p[84]=(...N)=>J.onVTrk&&J.onVTrk(...N))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--v",style:t.normalizeStyle({top:J.vThumbT+"px",height:J.vThumbH+"px"}),onMousedown:p[83]||(p[83]=(...N)=>J.onVStart&&J.onVStart(...N))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--down",onMousedown:p[85]||(p[85]=t.withModifiers(N=>{B.clampScroll(null,m.scrollY+50),J.scheduleRender()},["prevent"]))},[...p[124]||(p[124]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--down"},null,-1)])],32)],4)):t.createCommentVNode("",!0),B.maxScrollX>0?(t.openBlock(),t.createElementBlock("div",{key:1,class:"h-scrollbar",style:t.normalizeStyle({left:J.hScrollbarLeft+"px",width:`calc(100% - ${J.hScrollbarLeft+t.unref(11)}px)`})},[t.createElementVNode("button",{class:"sb-btn sb-btn--left",onMousedown:p[86]||(p[86]=t.withModifiers(N=>{B.clampScroll(m.scrollX-50,null),J.scheduleRender()},["prevent"]))},[...p[125]||(p[125]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--left"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--h",onMousedown:p[88]||(p[88]=(...N)=>J.onHTrk&&J.onHTrk(...N))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--h",style:t.normalizeStyle({left:J.hThumbL+"px",width:J.hThumbW+"px"}),onMousedown:p[87]||(p[87]=(...N)=>J.onHStart&&J.onHStart(...N))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--right",onMousedown:p[89]||(p[89]=t.withModifiers(N=>{B.clampScroll(m.scrollX+50,null),J.scheduleRender()},["prevent"]))},[...p[126]||(p[126]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--right"},null,-1)])],32)],4)):t.createCommentVNode("",!0),B.maxScrollX>0&&B.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",k2)):t.createCommentVNode("",!0),J.noteUi&&Vn.value?(t.openBlock(),t.createBlock(J1,{key:3,anchor:Vn.value,mode:J.noteUi.mode,note:U.value,author:l.noteAuthor,locale:m.locale,placeholder:W.value,"boundary-el":k.value,frozen:X.value,onSave:p[90]||(p[90]=N=>t.unref(h).saveNoteAt(J.noteUi.row,J.noteUi.col,N,l.noteAuthor)),onDelete:p[91]||(p[91]=N=>t.unref(h).removeNoteAt(J.noteUi.row,J.noteUi.col)),onClose:p[92]||(p[92]=N=>t.unref(h).closeNote())},null,8,["anchor","mode","note","author","locale","placeholder","boundary-el","frozen"])):t.createCommentVNode("",!0)]),t.createVNode(Bu,{locale:m.locale,sheets:t.unref(G),"active-sheet-index":t.unref(te),"ren-tab":J.renTab,"ren-tab-val":J.renTabVal,"boundary-el":k.value,onTabClick:p[93]||(p[93]=N=>J.onTabClick(N)),onTabDblclick:p[94]||(p[94]=N=>J.onTabDblClick(N)),onTabContextmenu:p[95]||(p[95]=N=>J.onTabCtxMenu(N.ev,N.i)),onTabRenameInput:p[96]||(p[96]=N=>Me(N)),onTabRenameKeydown:p[97]||(p[97]=N=>J.onTabRenameKd(N)),onTabRenameCommit:J.commitTabRename,onTabbarContextmenu:p[98]||(p[98]=N=>J.onTabBarCtx(N)),onDeleteSheet:p[99]||(p[99]=N=>{B.removeSheet(N),J.scheduleRender()}),onAddSheet:p[100]||(p[100]=N=>{B.addSheet(),J.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(()=>[J.ctxMenu?(t.openBlock(),t.createElementBlock("div",{key:0,class:"context-menu",style:t.normalizeStyle({left:J.ctxMenu.x+"px",top:J.ctxMenu.y+"px"}),onClick:p[101]||(p[101]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(J.ctxMenu.items,(N,bt)=>(t.openBlock(),t.createElementBlock("div",{key:bt,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":N.disabled}]),onClick:vt=>!N.disabled&&N.action&&(N.action(),Le()),onMouseenter:vt=>J.onCtxItemEnter(vt,N)},[t.createElementVNode("span",R2,t.toDisplayString(N.label),1),N.children?(t.openBlock(),t.createElementBlock("svg",M2,[...p[127]||(p[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),N.children?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["context-submenu",{"context-submenu--left":J.ctxSubmenuLeft}])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(N.children,(vt,Kt)=>(t.openBlock(),t.createElementBlock("div",{key:Kt,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":vt.disabled}]),onClick:t.withModifiers(Nt=>!vt.disabled&&vt.action&&(vt.action(),Le()),["stop"])},t.toDisplayString(vt.label),11,S2))),128))],2)):t.createCommentVNode("",!0)],42,E2))),128))],4)):t.createCommentVNode("",!0)]),_:1})])),J.filterPopup?(t.openBlock(),t.createBlock(ym,{key:J.filterPopup.col,col:J.filterPopup.col,"header-label":Ke(J.filterPopup.col),anchor:{x:J.filterPopup.x,y:J.filterPopup.y},locale:m.locale,"get-filter":m.getFilter,"set-filter":m.setFilter,"set-filter-column":m.setFilterColumn,"clear-filter-column":m.clearFilterColumn,"get-column-candidates":m.getColumnCandidates,close:J.closeFilterPopup,"boundary-el":k.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"},[A.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"cf-modal-mask",onClick:p[103]||(p[103]=t.withModifiers(N=>A.value=!1,["self"]))},[t.createVNode(Om,{locale:m.locale,rules:m.conditionalFormats,"theme-vars":B.toolbarThemeVars,onNew:z,onEdit:it,onDelete:Fe,onMove:v,onToggle:Z,onClose:p[102]||(p[102]=N=>A.value=!1)},null,8,["locale","rules","theme-vars"])])):t.createCommentVNode("",!0)])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[K.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"cf-modal-mask",onClick:p[105]||(p[105]=t.withModifiers(N=>K.value=!1,["self"]))},[t.createVNode(w0,{locale:m.locale,mode:V.value,rule:$.value,"default-range-text":x.value,"theme-vars":B.toolbarThemeVars,onSave:ze,onCancel:p[104]||(p[104]=N=>K.value=!1)},null,8,["locale","mode","rule","default-range-text","theme-vars"])])):t.createCommentVNode("",!0)])),J.validationDropdown?(t.openBlock(),t.createBlock(D1,{key:`${J.validationDropdown.col},${J.validationDropdown.row}`,items:J.validationDropdown.items,current:J.validationDropdown.current,locale:m.locale,x:J.validationDropdown.x,y:J.validationDropdown.y,width:J.validationDropdown.width,height:J.validationDropdown.height,"boundary-el":k.value,onSelect:p[106]||(p[106]=N=>t.unref(h).onValidationDropdownSelect(N)),onClose:p[107]||(p[107]=N=>t.unref(h).closeValidationDropdown())},null,8,["items","current","locale","x","y","width","height","boundary-el"])):t.createCommentVNode("",!0),Zt.value?(t.openBlock(),t.createBlock(U1,{key:2,title:Zt.value.title,message:Zt.value.message,x:Zt.value.x,y:Zt.value.y,width:Zt.value.width,height:Zt.value.height},null,8,["title","message","x","y","width","height"])):t.createCommentVNode("",!0),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[lt.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"cf-modal-mask",onClick:p[109]||(p[109]=t.withModifiers(N=>lt.value=!1,["self"]))},[t.createVNode(E1,{locale:m.locale,mode:ft.value,rule:wt.value,"default-range-text":At.value,"theme-vars":B.toolbarThemeVars,onSave:Jt,onClear:Qt,onCancel:p[108]||(p[108]=N=>lt.value=!1)},null,8,["locale","mode","rule","default-range-text","theme-vars"])])):t.createCommentVNode("",!0)])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[Ft.value?(t.openBlock(),t.createElementBlock("div",N2,[t.createVNode(za,{locale:m.locale,severity:Ft.value.severity,title:Ft.value.title,message:Ft.value.message,"theme-vars":B.toolbarThemeVars,onResolve:$n},null,8,["locale","severity","title","message","theme-vars"])])):t.createCommentVNode("",!0)])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[an.value?(t.openBlock(),t.createElementBlock("div",B2,[t.createVNode(za,{locale:m.locale,severity:"information",title:t.unref(g)(m.locale,"outlineAlertTitle"),message:an.value,"theme-vars":B.toolbarThemeVars,onResolve:mn},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(()=>[J.dimPanel?(t.openBlock(),t.createElementBlock("div",{key:0,class:"dim-panel",style:t.normalizeStyle({left:J.dimPanel.x+"px",top:J.dimPanel.y+"px"}),onMousedown:p[115]||(p[115]=t.withModifiers(()=>{},["stop"])),onTouchstart:p[116]||(p[116]=t.withModifiers(()=>{},["stop"])),onClick:p[117]||(p[117]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",x2,t.toDisplayString(J.dimPanel.type==="row"?t.unref(g)(m.locale,"rowHeight"):t.unref(g)(m.locale,"colWidth")),1),t.createElementVNode("div",T2,[t.createElementVNode("input",{ref:pe,class:t.normalizeClass(["dim-panel__input",{"dim-panel__input--error":J.dimPanel.error}]),type:"number",step:"1",min:"1",inputmode:"numeric",value:J.dimPanel.value,onInput:p[110]||(p[110]=(...N)=>J.onDimInput&&J.onDimInput(...N)),onKeydown:p[111]||(p[111]=(...N)=>J.onDimKeydown&&J.onDimKeydown(...N)),onBlur:p[112]||(p[112]=(...N)=>J.onDimBlur&&J.onDimBlur(...N))},null,42,V2)]),J.dimPanel.error?(t.openBlock(),t.createElementBlock("div",D2,t.toDisplayString(J.dimPanel.error),1)):t.createCommentVNode("",!0),t.createElementVNode("div",F2,[t.createElementVNode("button",{class:"dim-panel__btn dim-panel__btn--primary",onClick:p[113]||(p[113]=(...N)=>J.applyDimPanel&&J.applyDimPanel(...N))},t.toDisplayString(t.unref(g)(m.locale,"ok")),1),t.createElementVNode("button",{class:"dim-panel__btn",onClick:p[114]||(p[114]=(...N)=>J.closeDimPanel&&J.closeDimPanel(...N))},t.toDisplayString(t.unref(g)(m.locale,"cancel")),1)])],36)):t.createCommentVNode("",!0)]),_:1})]))],4))}}),[["__scopeId","data-v-9f2d05cf"]]);ko.Spreader=Vi,ko.default=Vi,Object.defineProperties(ko,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});