xiaodao-spreader 0.1.32 → 0.1.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ZH.md +52 -1
- package/README.md +52 -1
- package/dist/style.css +1 -1
- package/dist/types/components/spreader/components/conditional-format-manager.vue.d.ts +25 -0
- package/dist/types/components/spreader/components/conditional-format-menu.vue.d.ts +25 -0
- package/dist/types/components/spreader/components/conditional-format-rule-editor.vue.d.ts +23 -0
- package/dist/types/components/spreader/components/dropdown.vue.d.ts +3 -0
- package/dist/types/components/spreader/components/find-replace-bar.vue.d.ts +1 -0
- package/dist/types/components/spreader/components/spreader.vue.d.ts +263 -1
- package/dist/types/components/spreader/components/toolbar.vue.d.ts +14 -1
- package/dist/types/components/spreader/composables/core-state.d.ts +9 -1
- package/dist/types/components/spreader/core/conditional-formatting.d.ts +61 -0
- package/dist/types/components/spreader/core/constants.d.ts +2 -0
- package/dist/types/components/spreader/core/formula.d.ts +9 -0
- package/dist/types/components/spreader/core/types.d.ts +76 -0
- package/dist/xiaodao-spreader.es.js +7772 -6031
- package/dist/xiaodao-spreader.umd.js +9 -9
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
(function(rn,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(rn=typeof globalThis<"u"?globalThis:rn||self,t(rn.XiaoDaoSpreader={},rn.Vue))})(this,function(rn,t){"use strict";const yr={"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:"范围",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:"筛选此列"},"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",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"}};function D(e,l){var o;return((o=yr[e])==null?void 0:o[l])??l}const Cn='-apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif',_l=10,br=[{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'}],Cr=[{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}],wr='<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>',vr='<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>',kr='<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>',Er='<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>',Sr='<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>',Rr='<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>',Mr=[{value:"left",labelKey:"alignLeft",icon:wr},{value:"center",labelKey:"alignCenter",icon:vr},{value:"right",labelKey:"alignRight",icon:kr}],xr=[{value:"top",labelKey:"alignTop",icon:Er},{value:"middle",labelKey:"alignMiddle",icon:Sr},{value:"bottom",labelKey:"alignBottom",icon:Rr}],Eo=[{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>'}],Br={bg:"#f4f4f4",gridBg:"#ffffff",headerBg:"#e8e8e8",headerBorder:"#c8c8c8",headerText:"#444",headerSep:"#b0b0b0",cornerBg:"#e0e0e0",gridLine:"#e0e0e0",selectionBg:"rgba(0, 120, 215, 0.12)",activeCellBorder:"#0078d7",cellText:"#1a1a1a",scrollTrack:"rgba(0,0,0,0.08)",scrollThumb:"rgba(0,0,0,0.25)",formulaBarBg:"#f0f0f0",formulaBarBorder:"#c8c8c8",formulaBarLabelText:"#333",formulaBarLabelBg:"#fff",formulaBarLabelBorder:"#c0c0c0",formulaBarInputBg:"#fff",formulaBarInputBorder:"#c0c0c0",formulaBarInputText:"#1a1a1a",formulaBarInputFocusBorder:"#0078d7",formulaBarInputFocusShadow:"rgba(0, 120, 215, 0.3)",wrapperBg:"#e8e8e8",cellEditorBorder:"#0078d7",cellEditorText:"#1a1a1a",cellEditorBg:"#fff",cellEditorShadow:"#0078d7",tabBarBg:"#e8e8e8",tabBarBorder:"#c0c0c0",tabActiveBg:"#ffffff",tabActiveText:"#1a1a1a",tabActiveBorder:"#0078d7",tabInactiveBg:"#dfdfdf",tabInactiveText:"#666",tabInactiveBorder:"transparent",tabHoverBg:"#e0e0e0",tabAddBtnColor:"#555",tabAddBtnHoverBg:"#d0d0d0",tabScrollBtnColor:"#888",tabScrollBtnHoverBg:"#d0d0d0",scrollbarThumb:"rgba(0,0,0,0.25)",scrollbarThumbHover:"rgba(0,0,0,0.4)",scrollBtnBg:"#e8e8e8",scrollBtnColor:"#666",scrollBtnHoverBg:"#d0d0d0",scrollBtnActiveBg:"#c0c0c0",scrollTrackBg:"rgba(0,0,0,0.06)",toolbarBg:"#f7f7f7",toolbarBorder:"#d8d8d8",toolbarBtnColor:"#444",toolbarBtnHoverBg:"#e6e6e6",toolbarBtnDisabledColor:"#b0b0b0",toolbarBtnActiveColor:"#0078d7",findMatchBg:"rgba(255, 213, 79, 0.45)",findActiveBg:"rgba(255, 179, 0, 0.75)"},Tr={bg:"#1e1e1e",gridBg:"#252526",headerBg:"#252525",headerBorder:"#3e3e3e",headerText:"#999",headerSep:"#3e3e3e",cornerBg:"#2a2a2a",gridLine:"#3e3e3e",selectionBg:"rgba(0, 120, 215, 0.25)",activeCellBorder:"#0078d7",cellText:"#d4d4d4",scrollTrack:"rgba(255,255,255,0.06)",scrollThumb:"rgba(255,255,255,0.2)",formulaBarBg:"#2d2d2d",formulaBarBorder:"#3e3e3e",formulaBarLabelText:"#ccc",formulaBarLabelBg:"#3c3c3c",formulaBarLabelBorder:"#555",formulaBarInputBg:"#3c3c3c",formulaBarInputBorder:"#555",formulaBarInputText:"#d4d4d4",formulaBarInputFocusBorder:"#0078d7",formulaBarInputFocusShadow:"rgba(0, 120, 215, 0.4)",wrapperBg:"#1e1e1e",cellEditorBorder:"#0078d7",cellEditorText:"#d4d4d4",cellEditorBg:"#3c3c3c",cellEditorShadow:"#0078d7",tabBarBg:"#2a2a2a",tabBarBorder:"#3e3e3e",tabActiveBg:"#1e1e1e",tabActiveText:"#e0e0e0",tabActiveBorder:"#0078d7",tabInactiveBg:"#333333",tabInactiveText:"#888",tabInactiveBorder:"transparent",tabHoverBg:"#3a3a3a",tabAddBtnColor:"#999",tabAddBtnHoverBg:"#3a3a3a",tabScrollBtnColor:"#777",tabScrollBtnHoverBg:"#3a3a3a",scrollbarThumb:"rgba(255,255,255,0.2)",scrollbarThumbHover:"rgba(255,255,255,0.35)",scrollBtnBg:"#2d2d2d",scrollBtnColor:"#999",scrollBtnHoverBg:"#3d3d3d",scrollBtnActiveBg:"#4d4d4d",scrollTrackBg:"rgba(255,255,255,0.05)",toolbarBg:"#2a2a2a",toolbarBorder:"#3e3e3e",toolbarBtnColor:"#ccc",toolbarBtnHoverBg:"#3a3a3a",toolbarBtnDisabledColor:"#666",toolbarBtnActiveColor:"#4ea1ff",findMatchBg:"rgba(255, 213, 79, 0.35)",findActiveBg:"rgba(255, 179, 0, 0.6)"},$l="__nf_custom__",Bl="",Wl="",ul="@",Gn="__NF_INVALID__",oo=2958465,ro=0;function dl(e){return e==null||e===""?!0:e.toUpperCase()==="GENERAL"}function ao(e){return e==="zh-CN"?"¥":"$"}function Dr(e){return e.replace(/\*/g,"").replace(/_.|_\b/g,"")}function So(e){return e.replace(/"([^"]*)"/g,"$1")}function Nr(e){let l=e,o;const n=l.match(/^\[([^\]]+)\]/);n&&(o=n[1].toLowerCase(),l=l.slice(n[0].length)),l=Dr(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:o};let f=-1;for(let q=l.length-1;q>=0;q--){const se=l[q];if(se==="0"||se==="#"||se==="?"||se==="E"){f=q;break}}f<0&&(f=r);const m=r>0?l.slice(0,r):"",y=f<l.length-1?l.slice(f+1):"",k=l.slice(r,f+1),d=/[0#?]/.test(k),w=k.includes(",");let R=k.replace(/,/g,"");if(a){const q=R.search(/E/i);q>=0&&(R=R.slice(0,q))}const G=R.indexOf("."),te=G>=0?R.slice(0,G):R,Y=G>=0?R.slice(G+1):"",K=(Y.match(/[0#?]/g)||[]).length,C=(Y.match(/0/g)||[]).length,j=(te.match(/0/g)||[]).length;return{hasDigits:d,decimals:K,minDecimals:C,minIntDigits:j,thousands:w,scale:i?100:1,scientific:a,prefix:m,suffix:y,color:o}}function Fr(e){const l=[];let o=!1;const n=/\[h\]|\[mm\]|\[ss\]|yyyy|yy|y|mmmm|mmm|mm|m|dddd|ddd|dd|d|hh|h|ss|s|AM\/PM|am\/pm|"[^"]*"|\/|-|:|\s+|[^\s]/g;let a;for(;(a=n.exec(e))!==null;){const i=a[0];switch(i){case"[h]":o=!0,l.push({type:"hour",len:0});break;case"[mm]":o=!0,l.push({type:"minute",len:2});break;case"[ss]":o=!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(o?{type:"minute",len:4}:{type:"monthName",len:4});break;case"mmm":l.push(o?{type:"minute",len:3}:{type:"monthName",len:3});break;case"mm":l.push(o?{type:"minute",len:2}:{type:"month",len:2});break;case"m":l.push(o?{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:So(i),len:0}):l.push({type:"literal",text:i,len:0})}}return{tokens:l,isDuration:o}}const Ro=new Map;function Ir(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:f}=Fr(i);return{kind:f?"duration":"date",sections:[],tokens:r,isDuration:f,raw:e}}return{kind:"number",sections:e.split(";").map(i=>Nr(i)),tokens:[],isDuration:!1,raw:e}}function Pl(e){const l=Ro.get(e);if(l)return l;const o=Ir(e);return Ro.set(e,o),o}function Mo(e,l,o,n,a){const i=Math.pow(10,l),r=Math.round((e+Number.EPSILON)*i)/i,f=r<0,m=Math.abs(r);let k=new Intl.NumberFormat("en-US",{useGrouping:n,minimumIntegerDigits:a,minimumFractionDigits:l,maximumFractionDigits:l}).format(m);if(o<l&&l>0){const w=k.indexOf(".");if(w>=0){const v=k.substring(0,w);let R=k.substring(w+1);R=R.replace(/0+$/,""),R.length<o&&(R=R+"0".repeat(o-R.length)),k=R?`${v}.${R}`:v}}return`${f?"-":""}${k}`}function xo(e,l){if(e===0)return(l>0?"0."+"0".repeat(l):"0")+"E+00";const o=Math.floor(Math.log10(Math.abs(e))),n=e/Math.pow(10,o),a=Mo(n,l,l,!1,1),i=(o>=0?"+":"-")+String(Math.abs(o)).padStart(2,"0");return`${a}E${i}`}function Ar(e,l,o){if(!o.hasDigits)return So(o.prefix+o.suffix);const n=o.scale===100?e*100:e,a=o.scientific?xo(n,o.decimals):Mo(n,o.decimals,o.minDecimals,o.thousands,o.minIntDigits);return l+o.prefix+a+o.suffix}function Vr(e,l){const o=l.sections;if(o.length===0)return String(e);let n,a,i="";return e>0?(n=o[0],a=e):e<0?o[1]?(n=o[1],a=-e):(n=o[0],a=-e,i="-"):(n=o[2]??o[0],a=0),Ar(a,i,n)}function Hr(e){return new Date((e-25569)*864e5)}const Or=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],Lr=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],Bo=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],zr=["January","February","March","April","May","June","July","August","September","October","November","December"],_r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],To=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function Tn(e,l){return String(e).padStart(l,"0")}function $r(e,l,o,n){const a=e.getUTCFullYear(),i=e.getUTCMonth()+1,r=e.getUTCDate(),f=e.getUTCDay(),m=o==="zh-CN";let y="",k=!1;for(const d of l)switch(d.type){case"literal":y+=d.text??"";break;case"year":y+=d.len>=4?String(a):String(a%100).padStart(2,"0");break;case"month":y+=Tn(k?e.getUTCMinutes():i,d.len);break;case"monthName":y+=d.len>=4?m?Or[i-1]:zr[i-1]:m?Lr[i-1]:_r[i-1];break;case"day":y+=Tn(r,d.len);break;case"weekday":y+=d.len>=4?m?Bo[f]:To[f]:m?Bo[f].slice(2):To[f].slice(0,3);break;case"hour":{let w=e.getUTCHours();if(d.len===0){const v=Math.floor(n*86400);w=Math.floor(v/3600)}y+=String(w),k=!0;break}case"minute":y+=Tn(e.getUTCMinutes(),d.len);break;case"second":y+=Tn(e.getUTCSeconds(),d.len);break;case"ampm":{const w=e.getUTCHours();y+=w<12?m?"上午":"AM":m?"下午":"PM";break}}return y}function Wr(e,l){const o=Math.floor(e*86400),n=Math.floor(o/3600),a=Math.floor(o%3600/60),i=o%60;let r="";for(const f of l)switch(f.type){case"literal":r+=f.text??"";break;case"hour":r+=String(n);break;case"minute":r+=Tn(a,f.len||2);break;case"second":r+=Tn(i,f.len||2);break;default:r+=""}return r}function Pr(e){if(e==="")return e;const l=Number(e);if(!isNaN(l)&&e.trim()!==""){const o=Math.abs(l);return o!==0&&(o>=1e15||o<1e-9)?xo(l,9):e}return e}function bl(e,l,o){if(dl(l))return Pr(e);if(l==null||l===ul)return e;const n=Pl(l);if(n.kind==="date"||n.kind==="duration"){const i=Number(e);if(!isFinite(i))return e;if(n.kind==="date"){if(i<ro||i>oo)return Gn}else if(i<0)return Gn;return n.kind==="duration"?Wr(i,n.tokens):$r(Hr(i),n.tokens,o,i)}const a=Number(e);return isNaN(a)?e:Vr(a,n)}const Ur=["general","text","number","percent","scientific","accounting","financial","currency","currencyRounded","date","time","dateTime","duration","custom"];function io(e,l){if(l===ul||l==="@")return!1;if(dl(l)){if(e==null||e===""||e.trim()==="")return!1;const n=Number(e);return!Number.isNaN(n)&&Number.isFinite(n)}const o=Pl(l);return!!(o.kind==="number"&&Do(o))}function Do(e){return e.sections.some(l=>l.hasDigits)}function No(e){if(e==null||dl(e)||e===ul||e==="@")return!1;const l=Pl(e);return!!(l.kind==="date"||l.kind==="duration"||l.kind==="number"&&Do(l))}function Fo(e,l){if(l==null||dl(l)||l===ul||l==="@")return!1;const o=Pl(l),n=Number(e);return Number.isFinite(n)?o.kind==="date"?n<ro||n>oo:o.kind==="duration"?n<0:!1:!1}const co=30,so=0;function Ul(e){if(e==null||e===""||e.trim()==="")return!1;const l=Number(e);return!Number.isNaN(l)&&Number.isFinite(l)}function Io(e,l){if(e==null||e===Bl||dl(e))return Ul(l);if(e===ul)return!1;const o=Pl(e);return o.kind==="date"||o.kind==="duration"?!1:o.sections.some(n=>n.hasDigits)}function Kr(e){if(!Ul(e))return 0;const l=String(Number(e));return l.indexOf(".")<0||/e/i.test(l)?0:l.slice(l.indexOf(".")+1).length}function Gr(e,l){if(!Io(e,l))return-1;if(e==null||e===Bl||dl(e))return Kr(l);const n=Pl(e).sections.find(a=>a.hasDigits);return n?n.decimals:-1}function Yr(e,l){let o=0;const n=/\[[^\]]*\]/g;let a;for(;(a=n.exec(e))!==null&&!/^\[(h|mm|ss)\]$/i.test(a[0]);)o=a.index+a[0].length;const i=e.slice(0,o),r=e.slice(o),f=r.search(/[0#?]/);if(f===-1)return e;let m=-1;for(let te=r.length-1;te>=0;te--){const Y=r[te];if(Y==="0"||Y==="#"||Y==="?"||Y==="E"){m=te;break}}if(m<f)return e;const y=r.slice(f,m+1),k=y.search(/E[+-]/i),d=k>=0?y.slice(0,k):y,w=d.indexOf("."),v=w>=0?(d.slice(w+1).match(/[0#?]/g)||[]).length:0;if(v===l)return e;let R;if(w<0)R=l>0?d+"."+"0".repeat(l):d;else if(l>v)R=d+"0".repeat(l-v);else{let te=v-l;const Y=d.split("");for(let K=Y.length-1;K>=0&&te>0;K--){const C=Y[K];(C==="0"||C==="#"||C==="?")&&(Y.splice(K,1),te--)}R=Y.join(""),l===0&&R.endsWith(".")&&(R=R.slice(0,-1))}const G=R+(k>=0?y.slice(k):"");return i+r.slice(0,f)+G+r.slice(m+1)}function Xr(e,l){if(!Number.isInteger(l)||l<so||l>co||e===Bl)return null;if(e==null||dl(e))return l>0?"0."+"0".repeat(l):"0";if(e===ul)return null;const o=Pl(e);return o.kind==="date"||o.kind==="duration"||!o.sections.some(n=>n.hasDigits)?null:e.split(";").map(n=>Yr(n,l)).join(";")}const uo=["¥","$","€","£"];function Ao(e,l){if(e==null||e===Bl)return e??Wl;if(dl(e))return Wl;if(e===ul||e==="@")return ul;const o=ao(l),n=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=`${o}#,##0.00;(${o}#,##0.00);${o}"-"`,r="#,##0.00;[Red](#,##0.00)";if(Vo(l).some(v=>v.value===e))return e;const m=e.replace(/\[[^\]]*\]/gi,v=>/^\[(h|mm|ss)\]$/i.test(v)?v:"");if(/\[(h|mm|ss)\]/i.test(m)&&!/[yd]/i.test(m))return"[h]:mm:ss";const y=/[yd]/i.test(m),k=/h|s|AM\/PM/i.test(m);if(y&&k)return a;if(y||/AM\/PM/i.test(m))return n;if(k)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 d=uo.find(v=>e.startsWith(v));if(d)return e.includes("(")?i:/\.\d/.test(e.slice(d.length))?o+"#,##0.00":o+"#,##0";const w=Pl(e);return w.kind==="number"&&w.sections.some(v=>v.hasDigits)?"#,##0.00":$l}function jr(e,l){return new Date(Date.UTC(e,l,0)).getUTCDate()}function Zr(e,l,o){const n=Date.UTC(e,l-1,o)/864e5+25569;return n<=60?n-1:n}function Dn(e,l,o=new Date){const n=e.trim();if(!n||n.startsWith("=")||Ul(n))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 f(w){const v=/^(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/.exec(w);if(!v)return null;const R=Number(v[1]),G=Number(v[2]),te=v[3]!==void 0?Number(v[3]):0;return R>23||G>59||te>59?null:(R*3600+G*60+te)/86400}function m(w){let v=/^(\d{4})[-/](\d{1,2})[-/](\d{1,2})$/.exec(w),R,G,te;if(v)R=Number(v[1]),G=Number(v[2]),te=Number(v[3]);else if(v=/^(\d{4})年(\d{1,2})月(\d{1,2})日$/.exec(w))R=Number(v[1]),G=Number(v[2]),te=Number(v[3]);else if(v=/^(\d{1,2})[-/](\d{1,2})$/.exec(w))R=o.getUTCFullYear(),G=Number(v[1]),te=Number(v[2]);else return null;if(R<1900||R>9999||G<1||G>12||te<1||te>jr(R,G))return null;const Y=Zr(R,G,te);return Y>=ro&&Y<=oo?Y:null}const y=f(n);if(y!==null)return{serial:y,format:r};const k=/^(.+?)[T ](\d{1,2}:\d{1,2}(?::\d{1,2})?)$/.exec(n);if(k){const w=m(k[1].trim()),v=f(k[2]);if(w!==null&&v!==null)return{serial:w+v,format:i}}const d=m(n);return d!==null?{serial:d,format:a}:null}function qr(e,l){const o=e.trim();if(!o||o.startsWith("=")||!(o.includes(",")||o.includes("%")||uo.some(K=>o.startsWith(K)))||Dn(o,l))return null;const a=uo.find(K=>o.startsWith(K)),i=a?o.slice(a.length).trim():o;if(!i)return null;const r=/^([+-]?)(\d{1,3}(?:,\d{3})+)(?:\.(\d+))?(%?)$/.exec(i)||/^([+-]?)(\d+)(?:\.(\d+))?(%?)$/.exec(i);if(!r)return null;const f=r[1]==="-"?-1:1,m=r[2].replace(/,/g,""),y=r[3],k=(r[4]??"")==="%",d=y?y.length:0,w=+(m+(y?"."+y:""));if(!Number.isFinite(w))return null;const R=i.includes(",")?"#,##0":"0",G=d>0?"."+"0".repeat(d):"",te=(a??"")+R+G+(k?"%":"");let Y=w*f;return k&&(Y=Y/100),Y=Math.round(Y*1e12)/1e12,{num:Y,format:te}}function Jr(e,l,o,n){const a=ao(e),i=n?"#,##0":"0",r=o>0?"."+"0".repeat(o):"",f=i+r;switch(l){case"general":return"";case"text":return ul;case"custom":return"";case"number":return f;case"percent":return f+"%";case"scientific":return"0."+"0".repeat(o)+"E+00";case"currency":return a+f;case"currencyRounded":return a+(n?"#,##0":"0");case"accounting":return`${a}${f};(${a}${f});${a}"-"`;case"financial":return`${f};[Red](${f})`;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 Vo(e){const l=ao(e);return[{label:D(e,"nfGeneral"),value:Wl},{label:D(e,"nfText"),value:ul},{label:D(e,"nfNumber"),value:"#,##0.00"},{label:D(e,"nfPercent"),value:"0.00%"},{label:D(e,"nfScientific"),value:"0.00E+00"},{label:D(e,"nfAccounting"),value:`${l}#,##0.00;(${l}#,##0.00);${l}"-"`},{label:D(e,"nfFinancial"),value:"#,##0.00;[Red](#,##0.00)"},{label:D(e,"nfCurrency"),value:l+"#,##0.00"},{label:D(e,"nfCurrencyRounded"),value:l+"#,##0"},{label:D(e,"nfDate"),value:e==="zh-CN"?'yyyy"年"m"月"d"日"':"m/d/yyyy"},{label:D(e,"nfTime"),value:"h:mm:ss"},{label:D(e,"nfDateTime"),value:e==="zh-CN"?'yyyy"年"m"月"d"日" h:mm:ss':"m/d/yyyy h:mm:ss"},{label:D(e,"nfDuration"),value:"[h]:mm:ss"},{label:D(e,"nfCustom"),value:$l}]}const Qr=["title"],ea=["innerHTML"],ta={key:1,class:"sp-dropdown__value"},la=["disabled"],na=["placeholder"],oa=["onClick"],ra=["innerHTML"],aa={class:"sp-dropdown__item-label"},ia={key:2,class:"sp-dropdown__empty"},ca=["disabled"],sa=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:""}},emits:["update:modelValue","change","update:modelOpen"],setup(e,{emit:l}){const o=e,n=l,a=t.ref(!1),i=t.ref(0),r=t.ref(null),f=t.ref(null),m=t.ref(null),y=t.ref({top:0,up:!1}),k=t.ref(void 0),d=t.ref(0),w=t.ref(!1),v=t.ref(""),R=t.ref(null),G=t.computed(()=>o.options.find(g=>String(g.value)===String(o.modelValue))),te=t.computed(()=>o.menuWidth!==void 0?o.menuWidth:k.value),Y=t.computed(()=>{if(!o.searchable||!v.value.trim())return o.options;const g=v.value.trim().toLowerCase();return o.options.filter(A=>String(A.label??"").toLowerCase().includes(g))}),K=t.computed(()=>Y.value.length>0),C=t.computed(()=>Math.min(o.visibleCount,Y.value.length)),j=t.computed(()=>Y.value.slice(i.value,i.value+C.value)),q=t.computed(()=>i.value>0),se=t.computed(()=>i.value+C.value<Y.value.length),Fe=t.computed(()=>Y.value.length>C.value);function Qe(g){i.value=Math.max(0,Math.min(Y.value.length-C.value,i.value+g))}function Ge(){a.value=!0,o.searchable&&(v.value=""),o.modelOpen!==void 0&&n("update:modelOpen",!0);const g=o.triggerEl??r.value;if(!g)return;const A=g.getBoundingClientRect();k.value=A.width;const L=C.value*22+(Fe.value?2*15:0)+8+(o.searchable?34:0),ee=window.innerHeight-A.bottom-4<L&&A.top-4>L;o.align==="right"?y.value={right:window.innerWidth-A.right,top:ee?A.top-L-4:A.bottom+4,up:ee}:y.value={left:A.left,top:ee?A.top-L-4:A.bottom+4,up:ee};const ie=Y.value.findIndex(re=>String(re.value)===String(o.modelValue));i.value=ie>=0?Math.max(0,Math.min(ie-Math.floor(C.value/2),Y.value.length-C.value)):0,o.searchable&&t.nextTick(()=>{var re;return(re=R.value)==null?void 0:re.focus()})}function be(){a.value=!1,v.value="",o.modelOpen!==void 0&&n("update:modelOpen",!1)}function ve(){a.value?be():Ge()}function Xe(g){n("update:modelValue",g.value),n("change",g.value),be()}function Je(g){var L,$;if(!a.value)return;const A=g.target;(L=r.value)!=null&&L.contains(A)||($=m.value)!=null&&$.contains(A)||be()}function gt(g){a.value&&(g.preventDefault(),Qe(g.deltaY>0?1:-1))}t.watch(a,g=>{t.nextTick(()=>{var A,L;g?((A=f.value)==null||A.addEventListener("wheel",gt,{passive:!1}),document.addEventListener("keydown",Ze)):((L=f.value)==null||L.removeEventListener("wheel",gt),document.removeEventListener("keydown",Ze))})});function Ze(g){a.value&&g.key==="Escape"&&be()}t.watch(()=>o.modelOpen,g=>{g!==void 0&&g!==a.value&&(g?Ge():be())});function lt(g){a.value&&(d.value=g.touches[0].clientY,w.value=!0)}function et(g){if(!a.value||!w.value)return;const A=g.touches[0].clientY-d.value;Math.abs(A)>5&&(Qe(A<0?1:-1),d.value=g.touches[0].clientY)}function oe(){w.value=!1}function pe(g){g.key==="Escape"&&(g.stopPropagation(),be())}return t.onMounted(()=>{document.addEventListener("pointerdown",Je),window.addEventListener("resize",be),window.addEventListener("scroll",be,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",Je),document.removeEventListener("keydown",Ze),window.removeEventListener("resize",be),window.removeEventListener("scroll",be,!0)}),(g,A)=>{var L,$,ee;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:ve},[(L=G.value)!=null&&L.icon||e.triggerIcon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__icon",innerHTML:(($=G.value)==null?void 0:$.icon)||e.triggerIcon},null,8,ea)):(t.openBlock(),t.createElementBlock("span",ta,t.toDisplayString(((ee=G.value)==null?void 0:ee.label)??e.fallbackLabel),1)),A[5]||(A[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,Qr)),(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:m,class:t.normalizeClass(["sp-dropdown__menu",{"sp-dropdown__menu--up":y.value.up}]),style:t.normalizeStyle({left:y.value.left!==void 0?y.value.left+"px":void 0,right:y.value.right!==void 0?y.value.right+"px":void 0,top:y.value.top+"px",minWidth:te.value!==void 0?typeof te.value=="number"?te.value+"px":te.value:void 0}),onKeydown:pe,onMousedown:A[4]||(A[4]=t.withModifiers(()=>{},["prevent"]))},[Fe.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!q.value}]),disabled:!q.value,onClick:A[0]||(A[0]=ie=>Qe(-1))},[...A[6]||(A[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,la)):t.createCommentVNode("",!0),e.searchable?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:1,ref_key:"searchInputRef",ref:R,"onUpdate:modelValue":A[1]||(A[1]=ie=>v.value=ie),class:"sp-dropdown__search",type:"text",placeholder:e.searchPlaceholder,onMousedown:A[2]||(A[2]=t.withModifiers(()=>{},["stop"]))},null,40,na)),[[t.vModelText,v.value]]):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:f,class:"sp-dropdown__list",onTouchstart:lt,onTouchmove:et,onTouchend:oe},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(j.value,ie=>(t.openBlock(),t.createElementBlock("button",{key:String(ie.value),type:"button",class:t.normalizeClass(["sp-dropdown__item",{"sp-dropdown__item--active":String(ie.value)===String(e.modelValue)}]),onClick:re=>Xe(ie)},[ie.icon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__item-icon",innerHTML:ie.icon},null,8,ra)):t.createCommentVNode("",!0),t.createElementVNode("span",aa,t.toDisplayString(ie.label),1)],10,oa))),128))],544),e.searchable&&!K.value?(t.openBlock(),t.createElementBlock("div",ia," 无匹配 ")):t.createCommentVNode("",!0),Fe.value?(t.openBlock(),t.createElementBlock("button",{key:3,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!se.value}]),disabled:!se.value,onClick:A[3]||(A[3]=ie=>Qe(1))},[...A[7]||(A[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,ca)):t.createCommentVNode("",!0)],38)):t.createCommentVNode("",!0)]),_:1})]))],4)}}}),tl=(e,l)=>{const o=e.__vccOpts||e;for(const[n,a]of l)o[n]=a;return o},ll=tl(sa,[["__scopeId","data-v-804e629f"]]),ua=["title","onClick"],Ho=tl(t.defineComponent({__name:"colorPicker",props:{modelOpen:{type:Boolean,default:void 0},colorKey:{default:"text"},currentColor:{default:""},locale:{default:"zh-CN"},triggerEl:{default:null}},emits:["update:modelValue","change","update:modelOpen"],setup(e,{expose:l,emit:o}){const n=e,a=o,i=[[{key:"colorAutomatic",value:""},{key:"colorLightBlue",value:"#DEEBF7"},{key:"colorLightOrange",value:"#FCE4D6"},{key:"colorLightYellow",value:"#FFE79A"},{key:"colorLightGreen",value:"#E2EFDA"}],[{key:"colorLightGray",value:"#F2F2F2"},{key:"colorPaleBlue",value:"#BDD7EE"},{key:"colorPaleOrange",value:"#F8CBAD"},{key:"colorPaleYellow",value:"#FFD966"},{key:"colorPaleGreen",value:"#C6EFCE"}],[{key:"colorSilver",value:"#D9D9D9"},{key:"colorSkyBlue",value:"#9BC2E6"},{key:"colorCoral",value:"#F4B183"},{key:"colorGold",value:"#FFC000"},{key:"colorMint",value:"#A9D18E"}],[{key:"colorGray",value:"#BFBFBF"},{key:"colorMediumBlue",value:"#6FA8DC"},{key:"colorOrange",value:"#ED7D31"},{key:"colorAmber",value:"#F1C232"},{key:"colorMediumGreen",value:"#70AD47"}],[{key:"colorDarkGray",value:"#A5A5A5"},{key:"colorRoyalBlue",value:"#4A86E8"},{key:"colorRed",value:"#E06666"},{key:"colorDarkGold",value:"#BF8F00"},{key:"colorDarkGreen",value:"#548235"}],[{key:"colorCharcoal",value:"#808080"},{key:"colorDeepBlue",value:"#2E75B6"},{key:"colorDarkRed",value:"#CC4125"},{key:"colorOlive",value:"#806000"},{key:"colorForest",value:"#375623"}],[{key:"colorSlate",value:"#595959"},{key:"colorNavy",value:"#1F4E79"},{key:"colorCrimson",value:"#993300"},{key:"colorDarkOlive",value:"#5C4500"},{key:"colorDeepForest",value:"#2D6A4F"}],[{key:"colorDarkSlate",value:"#404040"},{key:"colorMidnight",value:"#17375E"},{key:"colorMaroon",value:"#5A1E00"},{key:"colorCoffee",value:"#3D3000"},{key:"colorEvergreen",value:"#1B4332"}],[{key:"colorBlack",value:"#000000"},{key:"colorDarkNavy",value:"#0C2340"},{key:"colorDarkMaroon",value:"#2E0A00"},{key:"colorDarkCoffee",value:"#1F1800"},{key:"colorInkGreen",value:"#081C15"}]],r=[[{key:"colorNoFill",value:""},{key:"colorLightBlue",value:"#DEEBF7"},{key:"colorLightOrange",value:"#FCE4D6"},{key:"colorLightYellow",value:"#FFE79A"},{key:"colorLightGreen",value:"#E2EFDA"}],[{key:"colorWhite",value:"#FFFFFF"},{key:"colorPaleBlue",value:"#BDD7EE"},{key:"colorPaleOrange",value:"#F8CBAD"},{key:"colorPaleYellow",value:"#FFD966"},{key:"colorPaleGreen",value:"#C6EFCE"}],[{key:"colorLightGray",value:"#F2F2F2"},{key:"colorSkyBlue",value:"#9BC2E6"},{key:"colorCoral",value:"#F4B183"},{key:"colorGold",value:"#FFC000"},{key:"colorMint",value:"#A9D18E"}],[{key:"colorSilver",value:"#D9D9D9"},{key:"colorMediumBlue",value:"#6FA8DC"},{key:"colorOrange",value:"#ED7D31"},{key:"colorAmber",value:"#F1C232"},{key:"colorMediumGreen",value:"#70AD47"}],[{key:"colorGray",value:"#BFBFBF"},{key:"colorRoyalBlue",value:"#4A86E8"},{key:"colorRed",value:"#E06666"},{key:"colorDarkGold",value:"#BF8F00"},{key:"colorDarkGreen",value:"#548235"}],[{key:"colorDarkGray",value:"#A5A5A5"},{key:"colorDeepBlue",value:"#2E75B6"},{key:"colorDarkRed",value:"#CC4125"},{key:"colorOlive",value:"#806000"},{key:"colorForest",value:"#375623"}],[{key:"colorCharcoal",value:"#808080"},{key:"colorNavy",value:"#1F4E79"},{key:"colorCrimson",value:"#993300"},{key:"colorDarkOlive",value:"#5C4500"},{key:"colorDeepForest",value:"#2D6A4F"}],[{key:"colorSlate",value:"#595959"},{key:"colorMidnight",value:"#17375E"},{key:"colorMaroon",value:"#5A1E00"},{key:"colorCoffee",value:"#3D3000"},{key:"colorEvergreen",value:"#1B4332"}],[{key:"colorDarkSlate",value:"#404040"},{key:"colorDarkNavy",value:"#0C2340"},{key:"colorDarkMaroon",value:"#2E0A00"},{key:"colorDarkCoffee",value:"#1F1800"},{key:"colorInkGreen",value:"#081C15"}]],f=t.computed(()=>n.colorKey==="fill"?r:i);function m(K){return D(n.locale,K)}function y(K){const C=n.currentColor;return!C&&!K?!0:C?C.toLowerCase()===K.toLowerCase():!1}const k=t.ref(!1),d=t.ref(null),w=t.ref(null),v=t.ref({top:0});t.watch(()=>n.modelOpen,K=>{K!==void 0&&K!==k.value&&(K?G():te())});function R(K){const C=d.value,j=w.value,q=K.target;C&&C.contains(q)||j&&j.contains(q)||te()}function G(){k.value=!0,n.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const K=n.triggerEl??d.value;if(K){const C=K.getBoundingClientRect(),j=150,q=120;let se=window.innerWidth-C.right,Fe=C.bottom+4,Qe;C.left-q<4&&(se=void 0,Qe=Math.max(4,C.left)),Fe+j>window.innerHeight-4&&(Fe=C.top-j-4),Fe<4&&(Fe=4),v.value=se!==void 0?{right:se,top:Fe}:{left:Qe,top:Fe}}document.addEventListener("pointerdown",R)})}function te(){k.value=!1,n.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",R)}function Y(K){a("update:modelValue",K),a("change",K),te()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",R)}),l({open:k,openMenu:G,close:te}),(K,C)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:d,class:"color-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[k.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:w,class:"color-picker__menu",style:t.normalizeStyle({left:v.value.left!==void 0?v.value.left+"px":void 0,right:v.value.right!==void 0?v.value.right+"px":void 0,top:v.value.top+"px"}),onMousedown:C[0]||(C[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(f.value,(j,q)=>(t.openBlock(),t.createElementBlock("div",{key:q,class:"color-picker__row"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(j,se=>(t.openBlock(),t.createElementBlock("button",{key:se.value,class:t.normalizeClass(["color-picker__swatch",{"color-picker__swatch--selected":y(se.value)}]),title:m(se.key),style:t.normalizeStyle({background:se.value||"transparent",border:se.value?"1px solid rgba(0,0,0,0.15)":"1px dashed #999"}),onClick:Fe=>Y(se.value)},null,14,ua))),128))]))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-70f3dfdc"]]),da=["title","onClick"],fa={viewBox:"0 0 30 30",class:"border-picker__icon"},ma=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],pa={class:"border-picker__label"},ha=tl(t.defineComponent({__name:"borderPicker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},currentBorder:{default:"none"},triggerEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:l,emit:o}){const n=e,a=o,i=[{key:"bottom",i18nKey:"borderBottom"},{key:"top",i18nKey:"borderTop"},{key:"left",i18nKey:"borderLeft"},{key:"right",i18nKey:"borderRight"},{key:"none",i18nKey:"borderNone"},{key:"all",i18nKey:"borderAll"},{key:"outer",i18nKey:"borderOuter"},{key:"thickOuter",i18nKey:"borderThickOuter"}],r=[{name:"top",x1:4,y1:4,x2:26,y2:4},{name:"bottom",x1:4,y1:26,x2:26,y2:26},{name:"left",x1:4,y1:4,x2:4,y2:26},{name:"right",x1:26,y1:4,x2:26,y2:26},{name:"vMid",x1:15,y1:4,x2:15,y2:26},{name:"hMid",x1:4,y1:15,x2:26,y2:15}],f={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"]},m={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function y(K,C){return m[K].includes(C)?"thick":f[K].includes(C)?"solid":"dashed"}const k=t.ref(!1),d=t.ref(null),w=t.ref(null),v=t.ref({top:0});t.watch(()=>n.modelOpen,K=>{K!==void 0&&K!==k.value&&(K?G():te())});function R(K){const C=d.value,j=w.value,q=K.target;C&&C.contains(q)||j&&j.contains(q)||te()}function G(){k.value=!0,n.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const K=n.triggerEl??d.value;if(K){const C=K.getBoundingClientRect(),j=200,q=160;let se=window.innerWidth-C.right,Fe=C.bottom+4,Qe;C.left-q<4&&(se=void 0,Qe=Math.max(4,C.left)),Fe+j>window.innerHeight-4&&(Fe=C.top-j-4),Fe<4&&(Fe=4),v.value=se!==void 0?{right:se,top:Fe}:{left:Qe,top:Fe}}document.addEventListener("pointerdown",R)})}function te(){k.value=!1,n.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",R)}function Y(K){a("change",K),te()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",R)}),l({open:k,openMenu:G,close:te}),(K,C)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:d,class:"border-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[k.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:w,class:"border-picker__menu",style:t.normalizeStyle({left:v.value.left!==void 0?v.value.left+"px":void 0,right:v.value.right!==void 0?v.value.right+"px":void 0,top:v.value.top+"px"}),onMousedown:C[0]||(C[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,j=>t.createElementVNode("button",{key:j.key,class:"border-picker__item",title:t.unref(D)(e.locale,j.i18nKey),onClick:q=>Y(j.key)},[(t.openBlock(),t.createElementBlock("svg",fa,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(r,q=>t.createElementVNode("line",{key:q.name,x1:q.x1,y1:q.y1,x2:q.x2,y2:q.y2,stroke:"currentColor","stroke-width":y(j.key,q.name)==="thick"?3:1.5,"stroke-dasharray":y(j.key,q.name)==="dashed"?"0 4":"none","stroke-linecap":y(j.key,q.name)==="dashed"?"round":"square"},null,8,ma)),64))])),t.createElementVNode("span",pa,t.toDisplayString(t.unref(D)(e.locale,j.i18nKey)),1)],8,da)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-551c0ffe"]]),ga=["title","onClick"],ya={viewBox:"0 0 1024 1024",class:"sort-picker__icon",fill:"none",stroke:"currentColor","stroke-width":"64","stroke-linecap":"round","stroke-linejoin":"round"},ba=["x1","y1","x2","y2"],Ca=["d"],wa={class:"sort-picker__label"},va=tl(t.defineComponent({__name:"sortPicker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},currentSort:{default:"asc"},triggerEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:l,emit:o}){const n=e,a=o,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}],f={asc:"M832 800V288M672 448l160-160 160 160",desc:"M832 224v512M672 576l160 160 160-160"},m=t.ref(!1),y=t.ref(null),k=t.ref(null),d=t.ref({top:0});t.watch(()=>n.modelOpen,te=>{te!==void 0&&te!==m.value&&(te?v():R())});function w(te){const Y=y.value,K=k.value,C=te.target;Y&&Y.contains(C)||K&&K.contains(C)||R()}function v(){m.value=!0,n.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const te=n.triggerEl??y.value;if(te){const Y=te.getBoundingClientRect(),K=84,C=160;let j=window.innerWidth-Y.right,q=Y.bottom+4,se;Y.left-C<4&&(j=void 0,se=Math.max(4,Y.left)),q+K>window.innerHeight-4&&(q=Y.top-K-4),q<4&&(q=4),d.value=j!==void 0?{right:j,top:q}:{left:se,top:q}}document.addEventListener("pointerdown",w)})}function R(){m.value=!1,n.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",w)}function G(te){a("change",te),R()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",w)}),l({open:m,openMenu:v,close:R}),(te,Y)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:y,class:"sort-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[m.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:k,class:"sort-picker__menu",style:t.normalizeStyle({left:d.value.left!==void 0?d.value.left+"px":void 0,right:d.value.right!==void 0?d.value.right+"px":void 0,top:d.value.top+"px"}),onMousedown:Y[0]||(Y[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,K=>t.createElementVNode("button",{key:K.key,class:"sort-picker__item",title:t.unref(D)(e.locale,K.i18nKey),onClick:C=>G(K.key)},[(t.openBlock(),t.createElementBlock("svg",ya,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(r,C=>t.createElementVNode("line",{key:C.name,x1:C.x1,y1:C.y1,x2:C.x2,y2:C.y2},null,8,ba)),64)),t.createElementVNode("path",{d:f[K.key]},null,8,Ca)])),t.createElementVNode("span",wa,t.toDisplayString(t.unref(D)(e.locale,K.i18nKey)),1)],8,ga)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-45929b74"]]),ka=["title","onClick"],Ea=["innerHTML"],Sa={class:"merge-picker__label"},Ra=tl(t.defineComponent({__name:"mergePicker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},triggerEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:l,emit:o}){const n=e,a=o,i=t.ref(!1),r=t.ref(null),f=t.ref(null),m=t.ref({top:0});t.watch(()=>n.modelOpen,v=>{v!==void 0&&v!==i.value&&(v?k():d())});function y(v){const R=r.value,G=f.value,te=v.target;R&&R.contains(te)||G&&G.contains(te)||d()}function k(){i.value=!0,n.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const v=n.triggerEl??r.value;if(v){const R=v.getBoundingClientRect(),G=Eo.length*30+12,te=160;let Y=window.innerWidth-R.right,K=R.bottom+4,C;R.left-te<4&&(Y=void 0,C=Math.max(4,R.left)),K+G>window.innerHeight-4&&(K=R.top-G-4),K<4&&(K=4),m.value=Y!==void 0?{right:Y,top:K}:{left:C,top:K}}document.addEventListener("pointerdown",y)})}function d(){i.value=!1,n.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",y)}function w(v){a("change",v),d()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",y)}),l({open:i,openMenu:k,close:d}),(v,R)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:r,class:"merge-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[i.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:f,class:"merge-picker__menu",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"}),onMousedown:R[0]||(R[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Eo),G=>(t.openBlock(),t.createElementBlock("button",{key:G.key,class:"merge-picker__item",title:t.unref(D)(e.locale,G.labelKey),onClick:te=>w(G.key)},[t.createElementVNode("span",{class:"merge-picker__icon",innerHTML:G.icon},null,8,Ea),t.createElementVNode("span",Sa,t.toDisplayString(t.unref(D)(e.locale,G.labelKey)),1)],8,ka))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-edd36208"]]),Ma=["disabled","title","onClick"],xa={class:"calc-picker__label"},Ba=tl(t.defineComponent({__name:"calcPicker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},triggerEl:{default:null},disabled:{type:Boolean,default:!1}},emits:["update:modelOpen","change"],setup(e,{expose:l,emit:o}){const n=e,a=o,i=[{key:"sum",labelKey:"sum"},{key:"avg",labelKey:"avg"},{key:"count",labelKey:"count"}],r=t.ref(!1),f=t.ref(null),m=t.ref(null),y=t.ref({top:0});t.watch(()=>n.modelOpen,R=>{R!==void 0&&R!==r.value&&(R?d():w())});function k(R){const G=f.value,te=m.value,Y=R.target;G&&G.contains(Y)||te&&te.contains(Y)||w()}function d(){r.value=!0,n.modelOpen!==void 0&&a("update:modelOpen",!0),t.nextTick(()=>{const R=n.triggerEl??f.value;if(R){const G=R.getBoundingClientRect(),te=i.length*30+12,Y=160;let K=window.innerWidth-G.right,C=G.bottom+4,j;G.left-Y<4&&(K=void 0,j=Math.max(4,G.left)),C+te>window.innerHeight-4&&(C=G.top-te-4),C<4&&(C=4),y.value=K!==void 0?{right:K,top:C}:{left:j,top:C}}document.addEventListener("pointerdown",k)})}function w(){r.value=!1,n.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",k)}function v(R){n.disabled||(a("change",R),w())}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",k)}),l({open:r,openMenu:d,close:w}),(R,G)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:f,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:m,class:"calc-picker__menu",style:t.normalizeStyle({left:y.value.left!==void 0?y.value.left+"px":void 0,right:y.value.right!==void 0?y.value.right+"px":void 0,top:y.value.top+"px"}),onMousedown: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(D)(e.locale,te.labelKey),onClick:Y=>v(te.key)},[t.createElementVNode("span",xa,t.toDisplayString(t.unref(D)(e.locale,te.labelKey)),1)],10,Ma)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-01a18e00"]]),Ta={class:"tb-item","data-key":"undo"},Da=["title","disabled"],Na={class:"tb-item","data-key":"redo"},Fa=["title","disabled"],Ia={class:"tb-item","data-key":"paint"},Aa=["title","disabled"],Va={class:"tb-item","data-key":"clear"},Ha=["title","disabled"],Oa={class:"tb-item","data-key":"font"},La={class:"tb-item","data-key":"fontSize"},za={class:"toolbar-font-size"},_a=["value","title"],$a=["title"],Wa=["title","disabled"],Pa=["title","disabled"],Ua={class:"tb-item","data-key":"bold"},Ka=["title","disabled"],Ga={class:"tb-item","data-key":"italic"},Ya=["title","disabled"],Xa={class:"tb-item","data-key":"underline"},ja=["title","disabled"],Za={class:"tb-item","data-key":"strike"},qa=["title","disabled"],Ja={class:"tb-item","data-key":"textColor"},Qa={class:"toolbar-split"},ei=["title","disabled"],ti={viewBox:"0 0 1024 1024",fill:"currentColor"},li=["fill"],ni=["title","disabled"],oi={class:"tb-item","data-key":"fillColor"},ri={class:"toolbar-split"},ai=["title","disabled"],ii={viewBox:"0 0 1024 1024",fill:"currentColor"},ci=["fill"],si=["title","disabled"],ui={class:"tb-item","data-key":"border"},di={class:"toolbar-split"},fi=["title","disabled"],mi={viewBox:"0 0 30 30",fill:"none",stroke:"currentColor"},pi=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],hi=["title","disabled"],gi={class:"tb-item","data-key":"hAlign"},yi={class:"tb-item","data-key":"vAlign"},bi={class:"tb-item","data-key":"wrap"},Ci=["title"],wi={class:"tb-item","data-key":"merge"},vi={class:"toolbar-split"},ki=["title","disabled"],Ei=["title","disabled"],Si={class:"tb-item","data-key":"numFmt"},Ri={class:"toolbar-number-format-group"},Mi=["title","disabled"],xi=["title","disabled"],Bi={class:"tb-item","data-key":"calc"},Ti={class:"toolbar-split"},Di=["title","disabled"],Ni=["title","disabled"],Fi={class:"tb-item","data-key":"sort"},Ii={class:"toolbar-split"},Ai=["title","disabled"],Vi={viewBox:"0 0 1024 1024",fill:"none",stroke:"currentColor","stroke-width":"64","stroke-linecap":"round","stroke-linejoin":"round"},Hi=["x1","y1","x2","y2"],Oi=["d"],Li=["title","disabled"],zi={class:"tb-item","data-key":"filter"},_i=["disabled","title"],$i={class:"tb-item","data-key":"freeze"},Wi={class:"tb-item","data-key":"find"},Pi=["title"],Oo='<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>',Ui='<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>',Ki='<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>',Gi='<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>',fo=2,Yi=6,Xi=34,ji=tl(t.defineComponent({__name:"toolbar",props:{locale:{},canUndo:{type:Boolean},canRedo:{type:Boolean},paintFmtActive:{type:Boolean},hasSelection:{type:Boolean},fontFamilyOptions:{},fontSizeOptions:{},selFontFamily:{},selFontSize:{},fontSizeInput:{},fontSizeMenuOpen:{type:Boolean},selFontWeight:{type:Boolean},selFontStyle:{type:Boolean},selUnderline:{type:Boolean},selStrikethrough:{type:Boolean},selTextColor:{},textColorMenuOpen:{type:Boolean},selFillColor:{},fillColorMenuOpen:{type:Boolean},cachedTextColor:{},cachedFillColor:{},borderMenuOpen:{type:Boolean},cachedBorder:{},sortMenuOpen:{type:Boolean},cachedSortOrder:{},canSort:{type:Boolean},canFilter:{type:Boolean},filterActive:{type:Boolean},selHAlign:{},selVAlign:{},selWrap:{type:Boolean},hAlignOptions:{},vAlignOptions:{},mergeMenuOpen:{type:Boolean},calcMenuOpen:{type:Boolean},isSingleCell:{type:Boolean},hasFreeze:{type:Boolean},themeVars:{},selNumberFormat:{},nfOptions:{},canIncreaseDecimals:{type:Boolean},canDecreaseDecimals:{type:Boolean}},emits:["undo","redo","paint-format","clear-format","font-size-blur","font-size-toggle","font-size-step-up","font-size-step-down","bold-toggle","italic-toggle","underline-toggle","strikethrough-toggle","apply-text-color","apply-fill-color","apply-border","apply-sort","wrap-toggle","apply-merge","calc-sum","calc-avg","calc-count","find","increase-decimals","decrease-decimals","toggle-filter","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","font-size-keydown","update:font-size-menu-open","update:text-color-menu-open","update:fill-color-menu-open","update:border-menu-open","update:sort-menu-open","update:merge-menu-open","update:calc-menu-open","border-change","sort-change","merge-change"],setup(e,{emit:l}){const o=[{name:"top",x1:4,y1:4,x2:26,y2:4},{name:"bottom",x1:4,y1:26,x2:26,y2:26},{name:"left",x1:4,y1:4,x2:4,y2:26},{name:"right",x1:26,y1:4,x2:26,y2:26},{name:"vMid",x1:15,y1:4,x2:15,y2:26},{name:"hMid",x1:4,y1:15,x2:26,y2:15}],n={bottom:["bottom"],top:["top"],left:["left"],right:["right"],none:[],all:["top","bottom","left","right","vMid","hMid"],outer:["top","bottom","left","right"],thickOuter:["top","bottom","left","right"]},a={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function i(u,p){return a[u].includes(p)?"thick":n[u].includes(p)?"solid":"dashed"}const 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}],f={asc:"M832 800V288M672 448l160-160 160 160",desc:"M832 224v512M672 576l160 160 160-160"},m=["undo","redo","paint","clear","sep1","font","fontSize","sep2","bold","italic","underline","strike","sep3","textColor","fillColor","border","sep4","hAlign","vAlign","wrap","merge","sep6","numFmt","sep7","calc","sort","filter","freeze","find"],y=t.ref(null),k=t.ref(null),d=t.ref(null),w=t.ref(null),v=t.ref(null),R=t.ref(null),G=t.ref(null),te=t.ref(null),Y=t.ref(null),K=t.ref(null),C=t.ref(new Set),j=t.ref(!1),q=t.ref(!1),se=t.ref(0),Fe=new Map,Qe=t.computed(()=>C.value.size>0);function Ge(u){return C.value.has(u)}const be=t.computed(()=>{const u=k.value;return u instanceof HTMLElement?u:void 0});function ve(u){return be.value?!Ge(u):!0}function Xe(){for(const u of m){const p=Fe.get(u);if(p===void 0||p===0)return!0}return!1}function Je(){if(!y.value)return;y.value.querySelectorAll(".tb-item").forEach(p=>{const H=p.dataset.key;if(!H)return;const ct=p.offsetWidth;ct>0?Fe.set(H,ct):Fe.has(H)||Fe.set(H,0)})}function gt(u,p){if(u.size!==p.size)return!1;for(const H of u)if(!p.has(H))return!1;return!0}let Ze=0,lt=0;function et(){Ze&&cancelAnimationFrame(Ze),!(lt>60)&&(lt++,Ze=requestAnimationFrame(()=>requestAnimationFrame(oe)))}function oe(){if(!y.value)return;const u=y.value.clientWidth-Yi*2;if(u<=0){et();return}lt=0,(Fe.size===0||Xe())&&Je();let p=0;for(const ct of m)p+=(Fe.get(ct)??0)+fo;const H=new Set;if(p>u){const ct=u-Xi-fo;let ae=0;for(let Pe=0;Pe<m.length;Pe++){const at=m[Pe],Mt=(Fe.get(at)??0)+fo;if(ae+Mt>ct){for(let St=Pe;St<m.length;St++)H.add(m[St]);break}ae+=Mt}}gt(H,C.value)||(C.value=H,se.value++,H.size===0&&(j.value=!1))}let pe=null;const g=t.ref(0),A=t.computed(()=>{const u=d.value,p={position:"fixed",top:"0px",right:"0px"};if(!u)return{...he.themeVars,...p};g.value;const H=u.getBoundingClientRect();return{...he.themeVars,position:"fixed",top:`${H.bottom+4}px`,right:`${window.innerWidth-H.right}px`}});function L(){j.value&&(g.value++,t.nextTick(()=>oe()))}function $(u){var H,ct;if(!j.value)return;const p=u.target;(H=k.value)!=null&&H.contains(p)||(ct=d.value)!=null&&ct.contains(p)||(q.value=!0,j.value=!1,t.nextTick(()=>{q.value=!1}))}function ee(){j.value=!j.value}function ie(){j.value=!1,ce("find")}function re(){j.value=!1,ce("toggle-filter")}t.onMounted(()=>{et(),y.value&&(pe=new ResizeObserver(()=>{j.value||et()}),pe.observe(y.value)),document.addEventListener("pointerdown",$,!0),window.addEventListener("resize",L),window.addEventListener("load",et),window.addEventListener("orientationchange",et)}),t.onBeforeUnmount(()=>{Ze&&cancelAnimationFrame(Ze),pe==null||pe.disconnect(),document.removeEventListener("pointerdown",$,!0),window.removeEventListener("resize",L),window.removeEventListener("load",et),window.removeEventListener("orientationchange",et)});const he=e,ce=l,V=t.computed(()=>he.selNumberFormat===Bl?D(he.locale,"nfMixed"):""),c=t.computed(()=>{const u=[{label:D(he.locale,"freezeFirstRow"),value:"firstRow",icon:Ui},{label:D(he.locale,"freezeFirstCol"),value:"firstCol",icon:Ki}];return he.hasFreeze?u.unshift({label:D(he.locale,"unfreezePanes"),value:"unfreeze",icon:Gi}):u.unshift({label:D(he.locale,"freezePanes"),value:"panes",icon:Oo}),u});return(u,p)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{ref_key:"rootEl",ref:y,class:"toolbar",onMousedown:p[52]||(p[52]=t.withModifiers(()=>{},["prevent"]))},[(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("undo"),to:be.value},[t.createElementVNode("div",Ta,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canUndo}]),title:t.unref(D)(e.locale,"undo"),disabled:!e.canUndo,onClick:p[0]||(p[0]=H=>ce("undo"))},[...p[54]||(p[54]=[t.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M596.16 284.064H258.56l101.376-101.44a31.968 31.968 0 1 0-45.248-45.216L178.56 273.504c-11.904 11.872-18.496 27.84-18.56 44.8a63.04 63.04 0 0 0 18.56 45.28l136.128 136.16a31.904 31.904 0 0 0 45.248 0 31.968 31.968 0 0 0 0-45.248l-106.752-106.496H596.16c114.88 0 208.32 93.312 208.32 208s-93.44 208-208.32 208h-223.36a32 32 0 0 0 0 64h223.36c150.144 0 272.32-122.016 272.32-272 0-149.984-122.176-272-272.32-272"})],-1)])],10,Da)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("redo"),to:be.value},[t.createElementVNode("div",Na,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canRedo}]),title:t.unref(D)(e.locale,"redo"),disabled:!e.canRedo,onClick:p[1]||(p[1]=H=>ce("redo"))},[...p[55]||(p[55]=[t.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{transform:"translate(1024, 0) scale(-1, 1)",d:"M596.16 284.064H258.56l101.376-101.44a31.968 31.968 0 1 0-45.248-45.216L178.56 273.504c-11.904 11.872-18.496 27.84-18.56 44.8a63.04 63.04 0 0 0 18.56 45.28l136.128 136.16a31.904 31.904 0 0 0 45.248 0 31.968 31.968 0 0 0 0-45.248l-106.752-106.496H596.16c114.88 0 208.32 93.312 208.32 208s-93.44 208-208.32 208h-223.36a32 32 0 0 0 0 64h223.36c150.144 0 272.32-122.016 272.32-272 0-149.984-122.176-272-272.32-272"})],-1)])],10,Fa)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("paint"),to:be.value},[t.createElementVNode("div",Ia,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.paintFmtActive}]),title:t.unref(D)(e.locale,"paintFormat"),disabled:!e.hasSelection,onClick:p[2]||(p[2]=H=>ce("paint-format"))},[...p[56]||(p[56]=[t.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M722.285714 438.857143a36.571429 36.571429 0 0 1-36.571428 36.571428h-512a36.571429 36.571429 0 0 1-36.571429-36.571428V164.571429a36.571429 36.571429 0 0 1 36.571429-36.571429h512a36.571429 36.571429 0 0 1 36.571428 36.571429V256h128a36.571429 36.571429 0 0 1 36.571429 36.571429v294.4a36.571429 36.571429 0 0 1-31.890286 36.278857L448 675.766857V859.428571a36.571429 36.571429 0 0 1-32.292571 36.315429l-4.278858 0.256a36.571429 36.571429 0 0 1-36.571428-36.571429v-215.771428a36.571429 36.571429 0 0 1 31.890286-36.278857l406.966857-52.553143V329.142857h-91.428572v109.714286z m-73.142857-237.714286h-438.857143V402.285714h438.857143V201.142857z"})],-1)])],10,Aa)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("clear"),to:be.value},[t.createElementVNode("div",Va,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.hasSelection}]),title:t.unref(D)(e.locale,"clearFormat"),disabled:!e.hasSelection,onClick:p[3]||(p[3]=H=>ce("clear-format"))},[...p[57]||(p[57]=[t.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M672.748 105.674c-3.666-3.799-8.778-5.949-14.125-5.949-5.341 0-10.459 2.15-14.119 5.949L10.418 754.633c-7.789 8.163-7.789 20.798 0 28.967l123.353 126.213c7.782 7.979 23.113 14.461 34.111 14.461h395.042c12.774-0.742 24.882-5.854 34.162-14.461l416.525-426.362c7.751-8.163 7.751-20.76 0-28.916l-340.92-348.861h0.057zM557.85 832.801c-9.273 8.582-21.343 13.707-34.111 14.461H217.888c-12.781-0.742-24.882-5.867-34.162-14.461l-58.074-59.482c-7.782-8.163-7.782-20.804 0-28.967l232.333-237.87c3.666-3.799 8.778-5.949 14.125-5.949s10.453 2.15 14.119 5.949l231.102 236.551c7.744 8.157 7.744 20.753 0 28.916l-59.539 60.909 0.058-0.057z m0 0"})],-1)])],10,Ha)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("sep1"),to:be.value},[p[58]||(p[58]=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:ve("font"),to:be.value},[t.createElementVNode("div",Oa,[t.createVNode(ll,{class:"toolbar-font","model-value":e.selFontFamily,options:e.fontFamilyOptions,width:Ge("font")?"100%":110,"menu-width":Ge("font")?120:void 0,"visible-count":8,title:t.unref(D)(e.locale,"fontFamily"),align:"right",onChange:p[4]||(p[4]=H=>ce("font-family-change",H))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("fontSize"),to:be.value},[t.createElementVNode("div",La,[t.createElementVNode("div",za,[t.createElementVNode("input",{class:"toolbar-font-size__input",type:"number",min:"5",max:"72",step:"1",value:e.fontSizeInput,title:t.unref(D)(e.locale,"fontSize"),onMousedown:p[5]||(p[5]=t.withModifiers(()=>{},["stop"])),onInput:p[6]||(p[6]=H=>ce("font-size-input",H.target.value)),onBlur:p[7]||(p[7]=H=>ce("font-size-blur")),onKeydown:p[8]||(p[8]=H=>ce("font-size-keydown",H))},null,40,_a),t.createVNode(ll,{class:"toolbar-font-size__dropdown","model-value":e.selFontSize,options:e.fontSizeOptions,width:Ge("fontSize")?"100%":56,"menu-width":Ge("fontSize")?120:56,"visible-count":9,title:t.unref(D)(e.locale,"fontSize"),"hide-trigger":!0,"model-open":e.fontSizeMenuOpen,align:"right","trigger-el":K.value,"onUpdate:modelOpen":p[9]||(p[9]=H=>ce("update:font-size-menu-open",H)),onChange:p[10]||(p[10]=H=>ce("font-size-change",H))},null,8,["model-value","options","width","menu-width","title","model-open","trigger-el"]),t.createElementVNode("button",{ref_key:"fontSizeArrowRef",ref:K,class:"toolbar-font-size__btn",type:"button",title:t.unref(D)(e.locale,"fontSize"),onMousedown:p[11]||(p[11]=t.withModifiers(()=>{},["prevent"])),onClick:p[12]||(p[12]=H=>ce("font-size-toggle"))},[...p[59]||(p[59]=[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,$a),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(D)(e.locale,"fontSizeDecrease"),disabled:!e.hasSelection,onMousedown:p[13]||(p[13]=t.withModifiers(()=>{},["prevent"])),onClick:p[14]||(p[14]=H=>ce("font-size-step-down"))},[...p[60]||(p[60]=[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,Wa),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(D)(e.locale,"fontSizeIncrease"),disabled:!e.hasSelection,onMousedown:p[15]||(p[15]=t.withModifiers(()=>{},["prevent"])),onClick:p[16]||(p[16]=H=>ce("font-size-step-up"))},[...p[61]||(p[61]=[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,Pa)])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("sep2"),to:be.value},[p[62]||(p[62]=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:ve("bold"),to:be.value},[t.createElementVNode("div",Ua,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontWeight}]),title:t.unref(D)(e.locale,"bold"),disabled:!e.hasSelection,onClick:p[17]||(p[17]=H=>ce("bold-toggle"))},[...p[63]||(p[63]=[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,Ka)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("italic"),to:be.value},[t.createElementVNode("div",Ga,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontStyle}]),title:t.unref(D)(e.locale,"italic"),disabled:!e.hasSelection,onClick:p[18]||(p[18]=H=>ce("italic-toggle"))},[...p[64]||(p[64]=[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,Ya)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("underline"),to:be.value},[t.createElementVNode("div",Xa,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selUnderline}]),title:t.unref(D)(e.locale,"underline"),disabled:!e.hasSelection,onClick:p[19]||(p[19]=H=>ce("underline-toggle"))},[...p[65]||(p[65]=[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,ja)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("strike"),to:be.value},[t.createElementVNode("div",Za,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selStrikethrough}]),title:t.unref(D)(e.locale,"strikethrough"),disabled:!e.hasSelection,onClick:p[20]||(p[20]=H=>ce("strikethrough-toggle"))},[...p[66]||(p[66]=[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,qa)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("sep3"),to:be.value},[p[67]||(p[67]=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:ve("textColor"),to:be.value},[t.createElementVNode("div",Ja,[t.createElementVNode("div",Qa,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(D)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:p[21]||(p[21]=H=>ce("apply-text-color"))},[(t.openBlock(),t.createElementBlock("svg",ti,[p[68]||(p[68]=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,li)]))],8,ei),t.createElementVNode("button",{ref_key:"textColorArrowRef",ref:w,class:"toolbar-btn toolbar-split__arrow",title:t.unref(D)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:p[22]||(p[22]=H=>ce("update:text-color-menu-open",!e.textColorMenuOpen))},[...p[69]||(p[69]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,ni),t.createVNode(Ho,{"model-open":e.textColorMenuOpen,"color-key":"text","current-color":e.selTextColor,locale:e.locale,"trigger-el":w.value,"onUpdate:modelOpen":p[23]||(p[23]=H=>ce("update:text-color-menu-open",H)),onChange:p[24]||(p[24]=H=>ce("text-color-change",H))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("fillColor"),to:be.value},[t.createElementVNode("div",oi,[t.createElementVNode("div",ri,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(D)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:p[25]||(p[25]=H=>ce("apply-fill-color"))},[(t.openBlock(),t.createElementBlock("svg",ii,[p[70]||(p[70]=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,ci)]))],8,ai),t.createElementVNode("button",{ref_key:"fillColorArrowRef",ref:v,class:"toolbar-btn toolbar-split__arrow",title:t.unref(D)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:p[26]||(p[26]=H=>ce("update:fill-color-menu-open",!e.fillColorMenuOpen))},[...p[71]||(p[71]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,si),t.createVNode(Ho,{"model-open":e.fillColorMenuOpen,"color-key":"fill","current-color":e.selFillColor,locale:e.locale,"trigger-el":v.value,"onUpdate:modelOpen":p[27]||(p[27]=H=>ce("update:fill-color-menu-open",H)),onChange:p[28]||(p[28]=H=>ce("fill-color-change",H))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("border"),to:be.value},[t.createElementVNode("div",ui,[t.createElementVNode("div",di,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(D)(e.locale,"borders"),disabled:!e.hasSelection,onClick:p[29]||(p[29]=H=>ce("apply-border"))},[(t.openBlock(),t.createElementBlock("svg",mi,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(o,H=>t.createElementVNode("line",{key:H.name,x1:H.x1,y1:H.y1,x2:H.x2,y2:H.y2,"stroke-width":i(e.cachedBorder,H.name)==="thick"?3:1.5,"stroke-dasharray":i(e.cachedBorder,H.name)==="dashed"?"0 4":"none","stroke-linecap":i(e.cachedBorder,H.name)==="dashed"?"round":"square"},null,8,pi)),64))]))],8,fi),t.createElementVNode("button",{ref_key:"borderArrowRef",ref:R,class:"toolbar-btn toolbar-split__arrow",title:t.unref(D)(e.locale,"borders"),disabled:!e.hasSelection,onClick:p[30]||(p[30]=H=>ce("update:border-menu-open",!e.borderMenuOpen))},[...p[72]||(p[72]=[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,hi),t.createVNode(ha,{"model-open":e.borderMenuOpen,locale:e.locale,"current-border":e.cachedBorder,"trigger-el":R.value,"onUpdate:modelOpen":p[31]||(p[31]=H=>ce("update:border-menu-open",H)),onChange:p[32]||(p[32]=H=>ce("border-change",H))},null,8,["model-open","locale","current-border","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("sep4"),to:be.value},[p[73]||(p[73]=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:ve("hAlign"),to:be.value},[t.createElementVNode("div",gi,[t.createVNode(ll,{class:"toolbar-align","model-value":e.selHAlign,options:e.hAlignOptions,width:Ge("hAlign")?"100%":44,"menu-width":Ge("hAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(D)(e.locale,"hAlign"),onChange:p[33]||(p[33]=H=>ce("h-align-change",H))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("vAlign"),to:be.value},[t.createElementVNode("div",yi,[t.createVNode(ll,{class:"toolbar-align","model-value":e.selVAlign,options:e.vAlignOptions,width:Ge("vAlign")?"100%":44,"menu-width":Ge("vAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(D)(e.locale,"vAlign"),onChange:p[34]||(p[34]=H=>ce("v-align-change",H))},null,8,["model-value","options","width","menu-width","title"])]),t.createElementVNode("div",bi,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selWrap}]),type:"button",title:t.unref(D)(e.locale,"wrap"),onClick:p[35]||(p[35]=H=>ce("wrap-toggle"))},[...p[74]||(p[74]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M896 179.2a38.4 38.4 0 0 0-76.8 0v665.6a38.4 38.4 0 0 0 76.8 0v-665.6zM204.8 281.6A38.4 38.4 0 0 0 204.8 358.4h179.2a38.4 38.4 0 0 0 0-76.8H204.8zM550.4 281.6a38.4 38.4 0 0 0 0 76.8h51.2c35.328 0 64 28.672 64 64v179.2c0 35.328-28.672 64-64 64H246.272l36.864-36.864a38.4 38.4 0 1 0-54.272-54.272l-102.4 102.4a38.4 38.4 0 0 0 0 54.272l102.4 102.4a38.4 38.4 0 0 0 54.272-54.272l-36.864-36.864h355.328a140.8 140.8 0 0 0 140.8-140.8v-179.2a140.8 140.8 0 0 0-140.8-140.8h-51.2z"})],-1)])],10,Ci)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("merge"),to:be.value},[t.createElementVNode("div",wi,[t.createElementVNode("div",vi,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(D)(e.locale,"mergeCenter"),disabled:!e.hasSelection,onClick:p[36]||(p[36]=H=>ce("apply-merge"))},[...p[75]||(p[75]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M709.952 465.92l88-76.032C801.92 385.984 806.656 384 812.032 384s10.048 1.984 14.08 5.952C830.08 393.92 832 398.656 832 403.968L832 448l32 0C881.664 448 896 462.336 896 480S881.664 512 864 512L832 512l0 44.032c0 5.376-1.92 10.112-5.952 14.08C822.08 574.08 817.344 576 812.032 576s-10.048-1.92-14.08-5.952L709.952 494.08C705.984 490.112 704 485.376 704 480S705.984 469.952 709.952 465.92zM378.048 465.92 290.048 389.952C286.08 385.984 281.344 384 275.968 384s-10.048 1.984-14.08 5.952C257.92 393.92 256 398.656 256 403.968L256 448 224 448C206.336 448 192 462.336 192 480S206.336 512 224 512L256 512l0 44.032c0 5.376 1.92 10.112 5.952 14.08C265.92 574.08 270.656 576 275.968 576s10.048-1.92 14.08-5.952L378.048 494.08C382.016 490.112 384 485.376 384 480S382.016 469.952 378.048 465.92zM448 128 128 128l0 704 320 0 0-128 64 0 0 128c0 35.392-28.608 64-64 64L128 896c-35.392 0-64-28.608-64-64L64 128c0-35.392 28.608-64 64-64l320 0 0 0c35.392 0 64 28.608 64 64l0 128L448 256 448 128M640 128l320 0 0 704-320 0 0-128L576 704l0 128c0 35.392 28.608 64 64 64l320 0c35.392 0 64-28.608 64-64L1024 128c0-35.392-28.608-64-64-64l-320 0 0 0C604.608 64 576 92.608 576 128l0 128 64 0L640 128M722.304 642.304c0 8.512-3.52 16.32-10.496 23.36s-15.424 10.624-25.344 10.624c-5.76 0-10.688-1.088-14.72-3.136-4.096-2.048-7.616-4.928-10.432-8.512s-5.824-9.088-9.024-16.512-5.952-13.952-8.32-19.648l-17.28-46.016L479.36 582.464 462.08 629.568c-6.72 18.304-12.48 30.656-17.344 37.12s-12.544 9.6-23.424 9.6c-9.28 0-17.408-3.456-24.512-10.24s-10.624-14.592-10.624-23.232c0-4.992 0.896-10.176 2.496-15.488S393.024 614.592 396.8 605.056l92.672-238.016C492.096 360.256 495.296 352 499.008 342.464s7.68-17.536 11.904-23.872 9.664-11.456 16.576-15.36c6.784-3.968 15.232-5.888 25.344-5.888 10.176 0 18.752 1.92 25.472 5.888 6.848 3.968 12.352 8.96 16.64 15.104 4.096 6.208 7.744 12.8 10.624 19.904s6.528 16.576 11.008 28.352l94.656 236.48C718.592 621.056 722.304 634.112 722.304 642.304zM606.912 526.784 552.32 375.552 498.624 526.784 606.912 526.784z"})],-1)])],8,ki),t.createElementVNode("button",{ref_key:"mergeArrowRef",ref:te,class:"toolbar-btn toolbar-split__arrow",title:t.unref(D)(e.locale,"mergeCells"),disabled:!e.hasSelection,onClick:p[37]||(p[37]=H=>ce("update:merge-menu-open",!e.mergeMenuOpen))},[...p[76]||(p[76]=[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,Ei),t.createVNode(Ra,{"model-open":e.mergeMenuOpen,locale:e.locale,"trigger-el":te.value,"onUpdate:modelOpen":p[38]||(p[38]=H=>ce("update:merge-menu-open",H)),onChange:p[39]||(p[39]=H=>ce("merge-change",H))},null,8,["model-open","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("sep6"),to:be.value},[p[77]||(p[77]=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:ve("numFmt"),to:be.value},[t.createElementVNode("div",Si,[t.createElementVNode("div",Ri,[t.createVNode(ll,{class:"toolbar-number-format","model-value":e.selNumberFormat,options:e.nfOptions,width:Ge("numFmt")?"auto":92,"menu-width":(Ge("numFmt"),150),"visible-count":8,title:t.unref(D)(e.locale,"numberFormat"),"fallback-label":V.value,align:"right",onChange:p[40]||(p[40]=H=>ce("number-format-change",String(H)))},null,8,["model-value","options","width","menu-width","title","fallback-label"]),t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn toolbar-number-format__btn",{"toolbar-btn--disabled":!e.canIncreaseDecimals}]),title:t.unref(D)(e.locale,"nfIncreaseDecimals"),disabled:!e.canIncreaseDecimals,onClick:p[41]||(p[41]=H=>ce("increase-decimals"))},[...p[78]||(p[78]=[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,Mi),t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn toolbar-number-format__btn",{"toolbar-btn--disabled":!e.canDecreaseDecimals}]),title:t.unref(D)(e.locale,"nfDecreaseDecimals"),disabled:!e.canDecreaseDecimals,onClick:p[42]||(p[42]=H=>ce("decrease-decimals"))},[...p[79]||(p[79]=[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,xi)])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("sep7"),to:be.value},[p[80]||(p[80]=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:ve("calc"),to:be.value},[t.createElementVNode("div",Bi,[t.createElementVNode("div",Ti,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(D)(e.locale,"sum"),disabled:!e.hasSelection||e.isSingleCell,onClick:p[43]||(p[43]=H=>ce("calc-sum"))},[...p[81]||(p[81]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[t.createElementVNode("path",{d:"M19 3H5l7 9-7 9h14v-2H8l5.5-7L8 5h11z"})],-1)])],8,Di),t.createElementVNode("button",{ref_key:"calcArrowRef",ref:Y,class:"toolbar-btn toolbar-split__arrow",title:t.unref(D)(e.locale,"calculate"),disabled:!e.hasSelection,onClick:p[44]||(p[44]=H=>ce("update:calc-menu-open",!e.calcMenuOpen))},[...p[82]||(p[82]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,Ni),t.createVNode(Ba,{"model-open":e.calcMenuOpen,locale:e.locale,"trigger-el":Y.value,disabled:e.isSingleCell,"onUpdate:modelOpen":p[45]||(p[45]=H=>ce("update:calc-menu-open",H)),onChange:p[46]||(p[46]=H=>ce(`calc-${H}`))},null,8,["model-open","locale","trigger-el","disabled"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("sort"),to:be.value},[t.createElementVNode("div",Fi,[t.createElementVNode("div",Ii,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:e.cachedSortOrder==="asc"?t.unref(D)(e.locale,"sortAsc"):t.unref(D)(e.locale,"sortDesc"),disabled:!e.canSort,onClick:p[47]||(p[47]=H=>ce("apply-sort"))},[(t.openBlock(),t.createElementBlock("svg",Vi,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(r,H=>t.createElementVNode("line",{key:H.name,x1:H.x1,y1:H.y1,x2:H.x2,y2:H.y2},null,8,Hi)),64)),t.createElementVNode("path",{d:f[e.cachedSortOrder]},null,8,Oi)]))],8,Ai),t.createElementVNode("button",{ref_key:"sortArrowRef",ref:G,class:"toolbar-btn toolbar-split__arrow",title:t.unref(D)(e.locale,"sort"),disabled:!e.canSort,onClick:p[48]||(p[48]=H=>ce("update:sort-menu-open",!e.sortMenuOpen))},[...p[83]||(p[83]=[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,Li),t.createVNode(va,{"model-open":e.sortMenuOpen,locale:e.locale,"current-sort":e.cachedSortOrder,"trigger-el":G.value,"onUpdate:modelOpen":p[49]||(p[49]=H=>ce("update:sort-menu-open",H)),onChange:p[50]||(p[50]=H=>ce("sort-change",H))},null,8,["model-open","locale","current-sort","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("filter"),to:be.value},[t.createElementVNode("div",zi,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.filterActive}]),disabled:!e.canFilter,title:e.filterActive?t.unref(D)(e.locale,"clearFilter"):t.unref(D)(e.locale,"filter"),onClick:re},[...p[84]||(p[84]=[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)])],10,_i)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("freeze"),to:be.value},[t.createElementVNode("div",$i,[t.createVNode(ll,{class:"toolbar-freeze","model-value":"",options:c.value,width:Ge("freeze")?"100%":44,"menu-width":Ge("freeze")?120:void 0,"visible-count":4,align:"right",title:t.unref(D)(e.locale,"freezePane"),"trigger-icon":Oo,onChange:p[51]||(p[51]=H=>ce("freeze-change",String(H)))},null,8,["options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ve("find"),to:be.value},[t.createElementVNode("div",Wi,[t.createElementVNode("button",{class:"toolbar-btn",title:t.unref(D)(e.locale,"find"),onClick:ie},[...p[85]||(p[85]=[t.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M448 128a320 320 0 0 1 251.2 516.8l171.2 171.2a32 32 0 0 1-45.2 45.2L654 689.9A320 320 0 1 1 448 128zm0 64a256 256 0 1 0 0 512 256 256 0 0 0 0-512z"})],-1)])],8,Pi)])],8,["disabled","to"])),Qe.value?(t.openBlock(),t.createElementBlock("button",{key:0,ref_key:"moreBtnEl",ref:d,class:t.normalizeClass(["toolbar-more",{"toolbar-more--active":j.value}]),type:"button",onClick:ee},[...p[86]||(p[86]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("circle",{cx:"512",cy:"160",r:"96"}),t.createElementVNode("circle",{cx:"512",cy:"512",r:"96"}),t.createElementVNode("circle",{cx:"512",cy:"864",r:"96"})],-1)])],2)):t.createCommentVNode("",!0)],544),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[t.withDirectives((t.openBlock(),t.createElementBlock("div",{ref_key:"overflowMenuEl",ref:k,key:se.value,class:t.normalizeClass(["overflow-menu",{"no-anim":q.value}]),style:t.normalizeStyle(A.value),onMousedown:p[53]||(p[53]=t.withModifiers(()=>{},["prevent"]))},null,38)),[[t.vShow,j.value]])]),_:1})]))],64))}}),[["__scopeId","data-v-0d0b0e86"]]),Zi=["title"],qi={class:"tab-list"},Ji=["onClick","onDblclick","onContextmenu","onTouchstart"],Qi=["value"],ec={key:1,class:"tab-item__name"},tc=["title"],lc=["disabled"],nc=["title","onClick"],oc={class:"tab-list-menu__name"},rc=["title","disabled","onClick"],ac=["disabled"],ic=8,Lo=450,Yn=8,cc=tl(t.defineComponent({__name:"tabbar",props:{locale:{},sheets:{},activeSheetIndex:{},renTab:{},renTabVal:{}},emits:["tab-click","tab-dblclick","delete-sheet","tab-contextmenu","tab-rename-input","tab-rename-keydown","tab-rename-commit","add-sheet","tabbar-contextmenu"],setup(e,{emit:l}){const o=e,n=l,a=t.ref(null),i=t.ref(!1),r=t.ref(0),f=t.ref({left:0,bottom:0}),m=t.ref(null),y=t.computed(()=>Math.min(ic,o.sheets.length)),k=t.computed(()=>o.sheets.slice(r.value,r.value+y.value)),d=t.computed(()=>r.value>0),w=t.computed(()=>r.value+y.value<o.sheets.length),v=t.computed(()=>o.sheets.length>y.value),R=t.computed(()=>o.sheets.length>1);t.watch(()=>o.sheets.length,()=>{if(!i.value)return;const V=Math.max(0,o.sheets.length-y.value);r.value>V&&(r.value=V)});function G(V){r.value=Math.max(0,Math.min(o.sheets.length-y.value,r.value+V))}function te(){if(i.value){i.value=!1;return}const V=a.value;if(!V)return;const c=V.getBoundingClientRect();f.value={left:c.left,bottom:window.innerHeight-c.top+4};const u=o.activeSheetIndex;r.value=u>=0?Math.max(0,Math.min(u-Math.floor(y.value/2),o.sheets.length-y.value)):0,i.value=!0}function Y(V){n("tab-click",V),i.value=!1}function K(V){R.value&&n("delete-sheet",V)}function C(V){var p;if(!i.value)return;const c=V.target;if((p=a.value)!=null&&p.contains(c))return;const u=document.querySelector(".tab-list-menu");u!=null&&u.contains(c)||(i.value=!1)}function j(V){i.value&&V.key==="Escape"&&(i.value=!1)}function q(V){i.value&&(V.preventDefault(),G(V.deltaY>0?1:-1))}function se(){i.value=!1}function Fe(V){!i.value||V.target===m.value||se()}const Qe=t.ref(0),Ge=t.ref(!1);function be(V){i.value&&(Qe.value=V.touches[0].clientY,Ge.value=!0)}function ve(V){if(!i.value||!Ge.value)return;const c=V.touches[0].clientY-Qe.value;Math.abs(c)>5&&(G(c<0?1:-1),Qe.value=V.touches[0].clientY)}function Xe(){Ge.value=!1}let Je=null,gt=-1,Ze=0,lt=0,et=!1,oe=null,pe=0,g=0;function A(V,c,u){return{clientX:V,clientY:c,target:u,preventDefault(){},stopPropagation(){}}}function L(V,c){const u=V.touches[0];if(!u)return;Ze=u.clientX,lt=u.clientY,gt=c,Je!==null&&clearTimeout(Je);const p=V.target;Je=window.setTimeout(()=>{et=!0;const H=A(Ze,lt,p);n("tab-contextmenu",{ev:H,i:gt})},Lo)}function $(V){const c=V.touches[0];!c||Je===null||(Math.abs(c.clientX-Ze)>Yn||Math.abs(c.clientY-lt)>Yn)&&(clearTimeout(Je),Je=null)}function ee(){Je!==null&&(clearTimeout(Je),Je=null)}function ie(V){if(et){et=!1;return}n("tab-click",V)}function re(V){const c=V.touches[0];if(!c)return;const u=V.target;if(u.closest(".tab-item")||u.closest(".tab-bar__add-btn")||u.closest(".tab-bar__list-btn"))return;pe=c.clientX,g=c.clientY,oe!==null&&clearTimeout(oe);const p=u;oe=window.setTimeout(()=>{const H=A(pe,g,p);n("tabbar-contextmenu",H)},Lo)}function he(V){const c=V.touches[0];!c||oe===null||(Math.abs(c.clientX-pe)>Yn||Math.abs(c.clientY-g)>Yn)&&(clearTimeout(oe),oe=null)}function ce(){oe!==null&&(clearTimeout(oe),oe=null)}return t.watch(i,V=>{t.nextTick(()=>{var c,u;V?(c=m.value)==null||c.addEventListener("wheel",q,{passive:!1}):(u=m.value)==null||u.removeEventListener("wheel",q)})}),t.onMounted(()=>{document.addEventListener("pointerdown",C),document.addEventListener("keydown",j),window.addEventListener("resize",se),window.addEventListener("scroll",Fe,!0)}),t.onBeforeUnmount(()=>{Je!==null&&clearTimeout(Je),oe!==null&&clearTimeout(oe),document.removeEventListener("pointerdown",C),document.removeEventListener("keydown",j),window.removeEventListener("resize",se),window.removeEventListener("scroll",Fe,!0)}),(V,c)=>(t.openBlock(),t.createElementBlock("div",{class:"tab-bar",onContextmenu:c[8]||(c[8]=u=>n("tabbar-contextmenu",u)),onTouchstart:re,onTouchmove:he,onTouchend:ce,onTouchcancel:ce},[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(D)(e.locale,"sheetList"),onClick:te},[...c[9]||(c[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,Zi),t.createElementVNode("div",qi,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.sheets,(u,p)=>(t.openBlock(),t.createElementBlock("div",{key:u.id,class:t.normalizeClass(["tab-item",{"tab-item--active":p===e.activeSheetIndex}]),onClick:H=>ie(p),onDblclick:t.withModifiers(H=>n("tab-dblclick",p),["prevent"]),onContextmenu:H=>n("tab-contextmenu",{ev:H,i:p}),onTouchstart:H=>L(H,p),onTouchmove:$,onTouchend:ee,onTouchcancel:ee},[e.renTab===p?(t.openBlock(),t.createElementBlock("input",{key:0,class:"tab-rename-input",value:e.renTabVal,onInput:c[0]||(c[0]=H=>n("tab-rename-input",H.target.value)),onKeydown:c[1]||(c[1]=H=>n("tab-rename-keydown",H)),onBlur:c[2]||(c[2]=H=>n("tab-rename-commit")),onClick:c[3]||(c[3]=t.withModifiers(()=>{},["stop"]))},null,40,Qi)):(t.openBlock(),t.createElementBlock("span",ec,t.toDisplayString(u.name),1))],42,Ji))),128))]),t.createElementVNode("button",{class:"tab-bar__add-btn",title:t.unref(D)(e.locale,"addSheet"),onClick:c[4]||(c[4]=u=>n("add-sheet"))}," + ",8,tc),(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:f.value.left+"px",bottom:f.value.bottom+"px"}),onMousedown:c[7]||(c[7]=t.withModifiers(()=>{},["prevent"]))},[v.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["tab-list-menu__nav",{"tab-list-menu__nav--disabled":!d.value}]),disabled:!d.value,onClick:c[5]||(c[5]=u=>G(-1))},[...c[10]||(c[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,lc)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:m,class:"tab-list-menu__list",onTouchstart:be,onTouchmove:ve,onTouchend:Xe},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(k.value,u=>(t.openBlock(),t.createElementBlock("div",{key:u.id,class:t.normalizeClass(["tab-list-menu__item",{"tab-list-menu__item--active":e.sheets.indexOf(u)===e.activeSheetIndex}]),title:u.name,onClick:p=>Y(e.sheets.indexOf(u))},[t.createElementVNode("span",oc,t.toDisplayString(u.name),1),t.createElementVNode("button",{type:"button",class:"tab-list-menu__del",title:t.unref(D)(e.locale,"delete"),disabled:!R.value,onClick:t.withModifiers(p=>K(e.sheets.indexOf(u)),["stop"])},[...c[11]||(c[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,rc)],10,nc))),128))],544),v.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["tab-list-menu__nav",{"tab-list-menu__nav--disabled":!w.value}]),disabled:!w.value,onClick:c[6]||(c[6]=u=>G(1))},[...c[12]||(c[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,ac)):t.createCommentVNode("",!0)],36)):t.createCommentVNode("",!0)]),_:1})]))],32))}}),[["__scopeId","data-v-e00401ad"]]),sc=["placeholder","value"],uc=["placeholder","value"],dc={class:"find-bar__chk"},fc=["checked"],mc={class:"find-bar__chk"},pc=["checked"],hc={class:"find-bar__count"},gc=["title","disabled"],yc=["title","disabled"],bc=["disabled"],Cc=["disabled"],wc=["title"],vc=tl(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 o=e,n=l,a=t.ref(null),i=t.computed(()=>o.total>0?`${o.currentIndex+1}/${o.total}`:o.message||""),r=t.computed(()=>[{label:D(o.locale,"scopeSheet"),value:"sheet"},{label:D(o.locale,"scopeWorkbook"),value:"workbook"},{label:D(o.locale,"scopeSelection"),value:"selection"}]);t.watch(()=>o.focusToken,()=>{t.nextTick(()=>{var m;return(m=a.value)==null?void 0:m.focus()})});function f(m){m.key==="Enter"?(m.preventDefault(),m.shiftKey?n("prev"):n("next")):m.key==="Escape"&&(m.preventDefault(),n("close"))}return(m,y)=>e.open?(t.openBlock(),t.createElementBlock("div",{key:0,class:"find-bar",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("input",{ref_key:"findInputRef",ref:a,class:"find-bar__input",placeholder:t.unref(D)(e.locale,"findPlaceholder"),value:e.findText,onInput:y[0]||(y[0]=k=>n("update:findText",k.target.value)),onKeydown:f},null,40,sc),t.createElementVNode("input",{class:"find-bar__input",placeholder:t.unref(D)(e.locale,"replacePlaceholder"),value:e.replaceText,onInput:y[1]||(y[1]=k=>n("update:replaceText",k.target.value)),onKeydown:f},null,40,uc),t.createVNode(ll,{class:"find-bar__dropdown","model-value":e.scope,options:r.value,title:t.unref(D)(e.locale,"findScope"),"onUpdate:modelValue":y[2]||(y[2]=k=>m.$emit("update:scope",k))},null,8,["model-value","options","title"]),t.createElementVNode("label",dc,[t.createElementVNode("input",{class:"find-bar__chk-input",type:"checkbox",checked:e.matchCase,onChange:y[3]||(y[3]=k=>n("update:matchCase",k.target.checked))},null,40,fc),y[10]||(y[10]=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(D)(e.locale,"matchCase")),1)]),t.createElementVNode("label",mc,[t.createElementVNode("input",{class:"find-bar__chk-input",type:"checkbox",checked:e.matchEntireCell,onChange:y[4]||(y[4]=k=>n("update:matchEntireCell",k.target.checked))},null,40,pc),y[11]||(y[11]=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(D)(e.locale,"matchEntireCell")),1)]),t.createElementVNode("span",hc,t.toDisplayString(i.value),1),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--icon",title:t.unref(D)(e.locale,"findPrev"),disabled:e.total===0,onClick:y[5]||(y[5]=k=>n("prev"))},[...y[12]||(y[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,gc),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--icon",title:t.unref(D)(e.locale,"findNext"),disabled:e.total===0,onClick:y[6]||(y[6]=k=>n("next"))},[...y[13]||(y[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,yc),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--text",disabled:e.total===0,onClick:y[7]||(y[7]=k=>n("replace"))},t.toDisplayString(t.unref(D)(e.locale,"replace")),9,bc),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--text",disabled:e.total===0,onClick:y[8]||(y[8]=k=>n("replace-all"))},t.toDisplayString(t.unref(D)(e.locale,"replaceAll")),9,Cc),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--close",title:t.unref(D)(e.locale,"findClose"),onClick:y[9]||(y[9]=k=>n("close"))},[...y[14]||(y[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,wc)],4)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-3120909b"]]),kc={class:"nf-dialog__header"},Ec={class:"nf-dialog__title"},Sc={class:"nf-dialog__body"},Rc={class:"nf-field"},Mc={class:"nf-field__label"},xc={key:0,class:"nf-field"},Bc={class:"nf-field__label"},Tc={key:1,class:"nf-field nf-field--inline"},Dc={class:"nf-checkbox"},Nc={key:2,class:"nf-field"},Fc={class:"nf-field__label"},Ic={key:3,class:"nf-field"},Ac={class:"nf-field__label"},Vc={key:4,class:"nf-field"},Hc={class:"nf-field__label"},Oc={key:5,class:"nf-field"},Lc={class:"nf-field__label"},zc={key:6,class:"nf-field"},_c={class:"nf-field__label"},$c={class:"nf-field"},Wc={class:"nf-field__label"},Pc={class:"nf-dialog__footer"},Uc={class:"nf-preview"},Kc={class:"nf-preview__label"},Gc={class:"nf-preview__value"},Yc={class:"nf-dialog__actions"},Xc=tl(t.defineComponent({__name:"numberFormatDialog",props:{modelOpen:{type:Boolean,default:!1},locale:{default:"zh-CN"},currentFormat:{default:""},isCustom:{type:Boolean,default:!1},sampleValue:{default:"1234.5"}},emits:["update:modelOpen","apply"],setup(e,{emit:l}){const o=e,n=l,a=t.ref(!1),i=t.ref("general"),r=t.ref(2),f=t.ref(!1),m=t.ref("$"),y=t.ref("m/d/yyyy"),k=t.ref("h:mm:ss"),d=t.ref("m/d/yyyy h:mm:ss"),w=t.ref("[h]:mm:ss"),v=t.ref(""),R=t.ref(null),G=[{label:"¥",value:"¥"},{label:"$",value:"$"},{label:"€",value:"€"},{label:"£",value:"£"}],te=['yyyy"年"m"月"d"日"',"yyyy-mm-dd","yyyy/m/d",'m"月"d"日"'],Y=["m/d/yyyy","mm/dd/yyyy","d-mmm-yyyy","mmmm d, yyyy"],K=['yyyy"年"m"月"d"日" h:mm:ss','yyyy"年"m"月"d"日" hh:mm',"yyyy-mm-dd hh:mm:ss","yyyy/m/d h:mm"],C=["m/d/yyyy h:mm:ss","m/d/yyyy hh:mm","mm/dd/yyyy h:mm AM/PM","d-mmm-yyyy hh:mm:ss"],j=t.computed(()=>o.locale==="zh-CN"?[...te,...Y]:[...Y,...te]),q=["h:mm:ss","h:mm","hh:mm:ss","h:mm AM/PM",'hh"时"mm"分"ss"秒"',"H:mm:ss"],se=t.computed(()=>o.locale==="zh-CN"?[...K,...C]:[...C,...K]),Fe=["[h]:mm:ss","[h]:mm","mm:ss",'[h]"小时"mm"分"ss"秒"',"[h]:mm:ss.00",'d"天"h:mm:ss'],Qe={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"},Ge=t.computed(()=>Ur.map(ae=>({label:D(o.locale,Qe[ae]),value:ae}))),be=G.map(ae=>({label:ae.label,value:ae.value})),ve=t.computed(()=>j.value.map(ae=>({label:ae,value:ae}))),Xe=q.map(ae=>({label:ae,value:ae})),Je=t.computed(()=>se.value.map(ae=>({label:ae,value:ae}))),gt=Fe.map(ae=>({label:ae,value:ae})),Ze=t.computed(()=>["number","currency","currencyRounded","accounting","financial"].includes(i.value)),lt=t.computed(()=>["currency","currencyRounded","accounting"].includes(i.value)),et=t.computed(()=>i.value==="date"),oe=t.computed(()=>i.value==="time"),pe=t.computed(()=>i.value==="dateTime"),g=t.computed(()=>i.value==="duration"),A=t.computed(()=>["number","currency","accounting","financial","percent","scientific"].includes(i.value));function L(){if(i.value==="general")return Wl;if(i.value==="text")return ul;if(i.value==="custom")return v.value;if(i.value==="date")return y.value;if(i.value==="time")return k.value;if(i.value==="dateTime")return d.value;if(i.value==="duration")return w.value;const ae=Math.max(0,Math.min(30,r.value));return i.value==="currency"||i.value==="currencyRounded"||i.value==="accounting"?$(i.value,ae,f.value,m.value):Jr(o.locale,i.value,ae,f.value)}function $(ae,Pe,at,Mt){const St=at?"#,##0":"0";if(ae==="currencyRounded")return Mt+St;const Rt=Pe>0?"."+"0".repeat(Pe):"",Ft=St+Rt;return ae==="currency"?Mt+Ft:`${Mt}${Ft};(${Mt}${Ft});${Mt}"-"`}function ee(ae){if(v.value=ae,dl(ae)){i.value="general";return}if(ae==="@"){i.value="text";return}const Pe=ae.replace(/\[[^\]]*\]/gi,Rt=>/\[h\]/i.test(Rt)?Rt:"");if(/\[h\]/i.test(Pe)&&!/[yd]/i.test(Pe)){i.value="duration",Fe.includes(ae)&&(w.value=ae);return}const at=/[yd]/i.test(Pe),Mt=/h|s|AM\/PM/i.test(Pe);if(at&&Mt){i.value="dateTime",se.value.includes(ae)&&(d.value=ae);return}if(at||/AM\/PM/i.test(Pe)){Mt&&!at?(i.value="time",q.includes(ae)&&(k.value=ae)):(i.value="date",j.value.includes(ae)&&(y.value=ae));return}if(ae.includes("%")){i.value="percent",r.value=ie(ae);return}if(/E[+-]/i.test(ae)){i.value="scientific",r.value=ie(ae);return}const St=G.find(Rt=>ae.startsWith(Rt.value));if(ae.includes("[Red](")){i.value="financial",f.value=ae.includes(","),r.value=ie(ae);return}if(St){ae.includes("(")?(i.value="accounting",m.value=St.value,f.value=ae.includes(","),r.value=ie(ae)):/\.\d/.test(ae.slice(St.value.length))?(i.value="currency",m.value=St.value,f.value=ae.includes(","),r.value=ie(ae)):(i.value="currencyRounded",m.value=St.value,f.value=ae.includes(","));return}i.value="number",f.value=ae.includes(","),r.value=ie(ae)}function ie(ae){const Pe=ae.match(/\.([0#?]+)/);return Pe?Pe[1].length:0}function re(){i.value!=="custom"&&(v.value=L())}function he(){}function ce(){y.value=j.value[0],k.value=q[0],d.value=se.value[0],w.value=Fe[0]}function V(){a.value=!0,o.modelOpen!==void 0&&n("update:modelOpen",!0),ce(),ee(o.currentFormat??""),o.isCustom&&(i.value="custom"),t.nextTick(()=>{var ae;return(ae=R.value)==null?void 0:ae.focus()})}function c(){a.value=!1,o.modelOpen!==void 0&&n("update:modelOpen",!1)}function u(){n("apply",v.value),c()}function p(){c()}function H(ae){ae.key==="Escape"&&c()}t.watch(()=>o.modelOpen,ae=>{ae&&!a.value?V():!ae&&a.value&&c()});const ct=t.computed(()=>bl(o.sampleValue,v.value,o.locale));return(ae,Pe)=>(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:p,onKeydown:H},[t.createElementVNode("div",{class:t.normalizeClass(["nf-dialog",{"nf-dialog--zh":e.locale==="zh-CN"}]),onMousedown:Pe[9]||(Pe[9]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",kc,[t.createElementVNode("span",Ec,t.toDisplayString(t.unref(D)(e.locale,"nfDialogTitle")),1),t.createElementVNode("button",{class:"nf-dialog__close",type:"button",onClick:c},[...Pe[10]||(Pe[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",Sc,[t.createElementVNode("div",Rc,[t.createElementVNode("label",Mc,t.toDisplayString(t.unref(D)(e.locale,"nfCategory")),1),t.createVNode(ll,{class:"nf-field__dropdown","model-value":i.value,options:Ge.value,"onUpdate:modelValue":Pe[0]||(Pe[0]=at=>i.value=at),onChange:re},null,8,["model-value","options"])]),A.value?(t.openBlock(),t.createElementBlock("div",xc,[t.createElementVNode("label",Bc,t.toDisplayString(t.unref(D)(e.locale,"nfDecimals")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":Pe[1]||(Pe[1]=at=>r.value=at),class:"nf-field__input",type:"number",min:"0",max:"30",onInput:re},null,544),[[t.vModelText,r.value,void 0,{number:!0}]])])):t.createCommentVNode("",!0),Ze.value?(t.openBlock(),t.createElementBlock("div",Tc,[t.createElementVNode("label",Dc,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":Pe[2]||(Pe[2]=at=>f.value=at),type:"checkbox",onChange:re},null,544),[[t.vModelCheckbox,f.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(D)(e.locale,"nfThousands")),1)])])):t.createCommentVNode("",!0),lt.value?(t.openBlock(),t.createElementBlock("div",Nc,[t.createElementVNode("label",Fc,t.toDisplayString(t.unref(D)(e.locale,"nfSymbol")),1),t.createVNode(ll,{class:"nf-field__dropdown","model-value":m.value,options:t.unref(be),"onUpdate:modelValue":Pe[3]||(Pe[3]=at=>m.value=at),onChange:re},null,8,["model-value","options"])])):t.createCommentVNode("",!0),et.value?(t.openBlock(),t.createElementBlock("div",Ic,[t.createElementVNode("label",Ac,t.toDisplayString(t.unref(D)(e.locale,"nfDateFormat")),1),t.createVNode(ll,{class:"nf-field__dropdown","model-value":y.value,options:ve.value,"onUpdate:modelValue":Pe[4]||(Pe[4]=at=>y.value=at),onChange:re},null,8,["model-value","options"])])):t.createCommentVNode("",!0),oe.value?(t.openBlock(),t.createElementBlock("div",Vc,[t.createElementVNode("label",Hc,t.toDisplayString(t.unref(D)(e.locale,"nfTimeFormat")),1),t.createVNode(ll,{class:"nf-field__dropdown","model-value":k.value,options:t.unref(Xe),"onUpdate:modelValue":Pe[5]||(Pe[5]=at=>k.value=at),onChange:re},null,8,["model-value","options"])])):t.createCommentVNode("",!0),pe.value?(t.openBlock(),t.createElementBlock("div",Oc,[t.createElementVNode("label",Lc,t.toDisplayString(t.unref(D)(e.locale,"nfDateTime")),1),t.createVNode(ll,{class:"nf-field__dropdown","model-value":d.value,options:Je.value,"onUpdate:modelValue":Pe[6]||(Pe[6]=at=>d.value=at),onChange:re},null,8,["model-value","options"])])):t.createCommentVNode("",!0),g.value?(t.openBlock(),t.createElementBlock("div",zc,[t.createElementVNode("label",_c,t.toDisplayString(t.unref(D)(e.locale,"nfDuration")),1),t.createVNode(ll,{class:"nf-field__dropdown","model-value":w.value,options:t.unref(gt),"onUpdate:modelValue":Pe[7]||(Pe[7]=at=>w.value=at),onChange:re},null,8,["model-value","options"])])):t.createCommentVNode("",!0),t.createElementVNode("div",$c,[t.createElementVNode("label",Wc,t.toDisplayString(t.unref(D)(e.locale,"nfCustomCode")),1),t.withDirectives(t.createElementVNode("textarea",{ref_key:"customCodeRef",ref:R,"onUpdate:modelValue":Pe[8]||(Pe[8]=at=>v.value=at),class:"nf-field__textarea",rows:"2",spellcheck:"false",onInput:he},null,544),[[t.vModelText,v.value]])])]),t.createElementVNode("div",Pc,[t.createElementVNode("div",Uc,[t.createElementVNode("span",Kc,t.toDisplayString(t.unref(D)(e.locale,"nfPreview")),1),t.createElementVNode("span",Gc,t.toDisplayString(ct.value||"—"),1)]),t.createElementVNode("div",Yc,[t.createElementVNode("button",{class:"nf-btn nf-btn--primary",type:"button",onClick:u},t.toDisplayString(t.unref(D)(e.locale,"ok")),1),t.createElementVNode("button",{class:"nf-btn",type:"button",onClick:c},t.toDisplayString(t.unref(D)(e.locale,"cancel")),1)])])],34)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-39792a0b"]]),jc={class:"sort-confirm__header"},Zc={class:"sort-confirm__title"},qc={class:"sort-confirm__body"},Jc={class:"sort-confirm__message"},Qc={class:"sort-confirm__options"},es={class:"sort-confirm__option"},ts={class:"sort-confirm__option"},ls={class:"sort-confirm__footer"},ns=tl(t.defineComponent({__name:"sortConfirmDialog",props:{modelOpen:{type:Boolean,default:!1},locale:{default:"zh-CN"}},emits:["update:modelOpen","confirm","cancel"],setup(e,{emit:l}){const o=e,n=l,a=t.ref(!1),i=t.ref(!0),r=t.ref(null);t.watch(()=>o.modelOpen,v=>{v&&!a.value?f():!v&&a.value&&m()});function f(){i.value=!0,a.value=!0,o.modelOpen!==void 0&&n("update:modelOpen",!0),t.nextTick(()=>{var R;const v=(R=r.value)==null?void 0:R.querySelector(".sort-confirm__btn--primary");v==null||v.focus()})}function m(){a.value=!1,o.modelOpen!==void 0&&n("update:modelOpen",!1)}function y(){w()}function k(v){v.key==="Escape"&&w()}function d(){n("confirm",i.value),m()}function w(){n("cancel"),m()}return(v,R)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"sort-confirm"},{default:t.withCtx(()=>[a.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"sort-confirm__mask",onMousedown:y,onKeydown:k},[t.createElementVNode("div",{ref_key:"dialogRef",ref:r,class:"sort-confirm",onMousedown:R[2]||(R[2]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",jc,[t.createElementVNode("span",Zc,t.toDisplayString(t.unref(D)(e.locale,"sortReminderTitle")),1),t.createElementVNode("button",{class:"sort-confirm__close",type:"button",onClick:w},[...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",qc,[t.createElementVNode("p",Jc,t.toDisplayString(t.unref(D)(e.locale,"sortReminderMessage")),1),t.createElementVNode("div",Qc,[t.createElementVNode("label",es,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":R[0]||(R[0]=G=>i.value=G),type:"radio",value:!0},null,512),[[t.vModelRadio,i.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(D)(e.locale,"sortExpandSelection")),1)]),t.createElementVNode("label",ts,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":R[1]||(R[1]=G=>i.value=G),type:"radio",value:!1},null,512),[[t.vModelRadio,i.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(D)(e.locale,"sortCurrentSelection")),1)])])]),t.createElementVNode("div",ls,[t.createElementVNode("button",{class:"sort-confirm__btn sort-confirm__btn--primary",type:"button",onClick:d},t.toDisplayString(t.unref(D)(e.locale,"sort")),1),t.createElementVNode("button",{class:"sort-confirm__btn",type:"button",onClick:w},t.toDisplayString(t.unref(D)(e.locale,"cancel")),1)])],544)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-d26d5917"]]);function ht(e){let l="",o=e;do l=String.fromCharCode(65+o%26)+l,o=Math.floor(o/26)-1;while(o>=0);return l}function mo(e){let l=0;for(let o=0;o<e.length;o++)l=l*26+(e.toUpperCase().charCodeAt(o)-64);return l-1}function wn(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 po(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 Nn(e,l){return`${e},${l}`}function Ln(e,l,o){const n=e.match(/^\$?([A-Z]+)\$?(\d+)$/i);if(!n)return null;const a=mo(n[1]),i=parseInt(n[2],10)-1;return a<0||a>=l||i<0||i>=o?null:{col:a,row:i}}function an(e,l){if(!l)return{x:0,y:0};const o=l.getBoundingClientRect();return{x:e.clientX-o.left,y:e.clientY-o.top}}const zo=[{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)"}],os={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 rs(e){let l=0,o=null;for(let n=0;n<e.length;n++){const a=e[n];if(o){a===o&&(e[n+1]===o?n++:o=null);continue}if(a==='"'||a==="'"){o=a;continue}if(a==="(")l++;else if(a===")"&&(l--,l<0))return!1}return l===0}function as(e){const l=e.trim();if(!l.startsWith("="))return{ok:!1,name:null};const o=/^([A-Za-z_][A-Za-z0-9_]*)\s*\(([\s\S]*)\)$/.exec(l.slice(1).trim());if(!o)return{ok:!1,name:null};const n=o[1].toUpperCase(),a=os[n];if(!a)return{ok:!1,name:n};const i=o[2];if(!rs(i))return{ok:!1,name:n};const r=vn(i),f=r.length===1&&r[0].trim()===""?0:r.length;return f<a.min||f>a.max?{ok:!1,name:n}:r.some(m=>m.trim()==="")?{ok:!1,name:n}:{ok:!0,name:n}}function Fn(e,l,o){const n=e.split(":");if(n.length!==2)return null;const a=Ln(n[0],l,o),i=Ln(n[1],l,o);return!a||!i?null:{sc:Math.min(a.col,i.col),sr:Math.min(a.row,i.row),ec:Math.max(a.col,i.col),er:Math.max(a.row,i.row)}}function _o(e){const l=e.trim();if(l==="")return"";const o=Number(l);return!isNaN(o)&&/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(l)?o:e}function Tl(e,l,o,n,a){const i=o[Nn(e,l)];if(!i)return"";const r=i.value;return r.startsWith("=")?Wo(Nn(e,l),o,n,a):_o(r)}function $o(e,l,o,n,a){const i=Tl(e,l,o,n,a);if(i===null)return 0;if(typeof i=="number")return i;const r=parseFloat(String(i));return isNaN(r)?0:r}const zn=new Map,Xn=new Set;function _n(){zn.clear(),Xn.clear()}function Wo(e,l,o,n){return is(e,l,o,n,0)}function is(e,l,o,n,a){if(Xn.has(e))return null;if(zn.has(e))return zn.get(e);Xn.add(e);const i=l[e];let r;if(!i)r=null;else{const f=i.value;if(!f.startsWith("="))r=_o(f);else{const m=f.slice(1).trim(),y=/^([A-Za-z_][A-Za-z0-9_]*)\s*\(([\s\S]*)\)$/.exec(m);r=y?Go(y[1].toUpperCase(),y[2],l,o,n,a+1):Wt(m,l,o,n,a+1)}}return Xn.delete(e),zn.set(e,r),r}function ho(e){return e===null||e===""?!1:typeof e=="number"?e!==0:!0}function Po(e,l){return typeof e=="number"&&typeof l=="number"?e===l:String(e??"")===String(l??"")}function Uo(e,l,o){let n;if(typeof e=="number"&&typeof l=="number")n=e<l?-1:e>l?1:0;else{const a=String(e??""),i=String(l??"");n=a<i?-1:a>i?1:0}switch(o){case"=":return n===0;case"<>":return n!==0;case"<":return n<0;case">":return n>0;case"<=":return n<=0;case">=":return n>=0}return!1}function Ko(e,l,o,n){const a=e.trim();if(a.length>=2&&(a[0]==='"'&&a[a.length-1]==='"'||a[0]==="'"&&a[a.length-1]==="'"))return a.slice(1,-1);const i=Number(a);return!isNaN(i)&&/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(a)?i:a}function cs(e,l,o,n,a,i){let f=l.trim();f.length>=2&&(f[0]==='"'&&f[f.length-1]==='"'||f[0]==="'"&&f[f.length-1]==="'")&&(f=f.slice(1,-1));const m=/^([<>=]+)([\s\S]*)$/.exec(f);if(m){const k=m[1],d=Ko(m[2]);return Uo(e,d,k)}const y=Ko(f);return Po(e,y)}function ss(e,l,o,n,a){const i=e.trim(),r=["<=",">=","<>"];let f=null,m=-1,y=null,k=0;for(let w=0;w<i.length;w++){const v=i[w];if(y){v===y&&(i[w+1]===y?w++:y=null);continue}if(v==='"'||v==="'"){y=v;continue}if(v==="("&&k++,v===")"&&k--,k===0&&(v==="<"||v===">"||v==="=")){const R=i.slice(w,w+2);f=r.includes(R)?R:v,m=w;break}}if(f&&m>=0){const w=i.slice(0,m).trim(),v=i.slice(m+f.length).trim(),R=Wt(w,l,o,n,a),G=Wt(v,l,o,n,a);return Uo(R,G,f)}const d=Wt(i,l,o,n,a);return ho(d)}function vn(e){const l=[];let o=0,n=null,a="";for(let i=0;i<e.length;i++){const r=e[i];if(n){a+=r,r===n&&(e[i+1]===n?(i++,a+=n):n=null);continue}if(r==='"'||r==="'"){n=r,a+=r;continue}if(r==="("&&o++,r===")"&&o--,r===","&&o===0){l.push(a),a="";continue}a+=r}return l.push(a),l}function Wt(e,l,o,n,a){if(a>20)return null;const i=e.trim();if(i==="")return null;const r=i.toUpperCase();if(r==="TRUE")return 1;if(r==="FALSE")return 0;const f=us(i);if(f.length===0)return null;let m=0;const y=()=>{let v=k();for(;m<f.length;){const R=f[m];if(R.type==="op"&&(R.val==="+"||R.val==="-"))m++,v=go(v,k(),R.val);else break}return v},k=()=>{let v=d();for(;m<f.length;){const R=f[m];if(R.type==="op"&&(R.val==="*"||R.val==="/"))m++,v=go(v,d(),R.val);else break}return v},d=()=>{const v=f[m];return v&&v.type==="op"&&v.val==="-"?(m++,go(0,d(),"-")):v&&v.type==="op"&&v.val==="+"?(m++,d()):w()},w=()=>{const v=f[m];if(!v)return null;if(v.type==="num")return m++,Number(v.val);if(v.type==="str")return m++,v.val;if(v.type==="lp"){m++;const R=y();return f[m]&&f[m].type==="rp"&&m++,R}if(v.type==="ref"){m++;const R=Ln(v.val,o,n);return R?Tl(R.col,R.row,l,o,n):null}if(v.type==="func"){const R=v.val.toUpperCase();if(m++,f[m]&&f[m].type==="lp"){const G=f[m];let te=0,Y=null,K=m;for(;K<f.length;K++)if(f[K].type==="lp")te++;else if(f[K].type==="rp"&&(te--,te===0)){Y=f[K];break}if(Y){const C=i.slice(G.start+1,Y.start);return m=K+1,Go(R,C,l,o,n,a+1)}}return null}return m++,null};return y()}function us(e){const l=[];let o=0;for(;o<e.length;){const n=e[o];if(/\s/.test(n)){o++;continue}if(n==='"'||n==="'"){const a=n,i=o;o++;let r="";for(;o<e.length;){if(e[o]===a){if(e[o+1]===a){r+=a,o+=2;continue}o++;break}r+=e[o],o++}l.push({type:"str",val:r,start:i});continue}if(/[0-9]/.test(n)||n==="."){const a=o;let i="";for(n==="."&&(i+=".",o++);o<e.length&&/[0-9]/.test(e[o]);)i+=e[o],o++;if(e[o]===".")for(i+=".",o++;o<e.length&&/[0-9]/.test(e[o]);)i+=e[o],o++;if(e[o]==="e"||e[o]==="E")for(i+=e[o],o++,(e[o]==="+"||e[o]==="-")&&(i+=e[o],o++);o<e.length&&/[0-9]/.test(e[o]);)i+=e[o],o++;l.push({type:"num",val:i,start:a});continue}if(/[A-Za-z_]/.test(n)){const a=o;let i="";for(;o<e.length&&/[A-Za-z0-9_]/.test(e[o]);)i+=e[o],o++;e[o]==="("?l.push({type:"func",val:i,start:a}):l.push({type:"ref",val:i,start:a});continue}if(n==="("){l.push({type:"lp",val:n,start:o}),o++;continue}if(n===")"){l.push({type:"rp",val:n,start:o}),o++;continue}if(n===","){l.push({type:"comma",val:n,start:o}),o++;continue}if(n==="+"||n==="-"||n==="*"||n==="/"){l.push({type:"op",val:n,start:o}),o++;continue}o++}return l}function go(e,l,o){if(typeof e!="number"||typeof l!="number")return null;switch(o){case"+":return e+l;case"-":return e-l;case"*":return e*l;case"/":return l===0?null:e/l}return null}function Go(e,l,o,n,a,i){switch(e){case"SUM":case"AVERAGE":case"COUNT":{const r=Fn(l.trim(),n,a);if(!r)return null;if(e==="COUNT"){let m=0;for(let y=r.sc;y<=r.ec;y++)for(let k=r.sr;k<=r.er;k++)typeof Tl(y,k,o,n,a)=="number"&&m++;return m}let f=0;for(let m=r.sc;m<=r.ec;m++)for(let y=r.sr;y<=r.er;y++)f+=$o(m,y,o,n,a);if(isNaN(f))return null;if(e==="AVERAGE"){const m=(r.ec-r.sc+1)*(r.er-r.sr+1);return m===0?null:f/m}return f}case"IF":{const r=vn(l);if(r.length<3)return null;const f=ss(r[0],o,n,a,i);return Wt(f?r[1]:r[2],o,n,a,i)}case"VLOOKUP":{const r=vn(l);if(r.length<3)return null;const f=Wt(r[0],o,n,a,i),m=Fn(r[1].trim(),n,a);if(!m)return null;const y=Wt(r[2],o,n,a,i),k=typeof y=="number"?y:parseFloat(String(y));if(isNaN(k))return null;const d=m.sc+(k-1);if(d<m.sc||d>m.ec)return null;if(r.length>=4?ho(Wt(r[3],o,n,a,i)):!1){let v=-1,R=-1/0;for(let G=m.sr;G<=m.er;G++){const te=Tl(m.sc,G,o,n,a);typeof te=="number"&&typeof f=="number"&&te<=f&&te>R&&(R=te,v=G)}return v>=0?Tl(d,v,o,n,a):null}for(let v=m.sr;v<=m.er;v++){const R=Tl(m.sc,v,o,n,a);if(Po(R,f))return Tl(d,v,o,n,a)}return null}case"CONCATENATE":{const r=vn(l);let f="";for(const m of r){const y=Wt(m,o,n,a,i);f+=y===null?"":typeof y=="number"?String(y):y}return f}case"MAX":case"MIN":{const r=Fn(l.trim(),n,a);if(!r)return null;const f=[];for(let m=r.sc;m<=r.ec;m++)for(let y=r.sr;y<=r.er;y++){const k=Tl(m,y,o,n,a);typeof k=="number"&&f.push(k)}return f.length===0?null:e==="MAX"?Math.max(...f):Math.min(...f)}case"STDEV":{const r=Fn(l.trim(),n,a);if(!r)return null;const f=[];for(let d=r.sc;d<=r.ec;d++)for(let w=r.sr;w<=r.er;w++){const v=Tl(d,w,o,n,a);typeof v=="number"&&f.push(v)}const m=f.length;if(m<2)return null;const y=f.reduce((d,w)=>d+w,0)/m,k=f.reduce((d,w)=>d+Math.pow(w-y,2),0)/(m-1);return Math.sqrt(k)}case"SIN":{const r=vn(l);if(r.length!==1)return null;const f=Wt(r[0],o,n,a,i);return typeof f!="number"?null:Math.sin(f)}case"SUMIF":{const r=vn(l);if(r.length<2||r.length>3)return null;const f=Fn(r[0].trim(),n,a);if(!f)return null;const m=r.length===3?Fn(r[2].trim(),n,a):f;if(!m)return null;let y=0;for(let k=f.sr;k<=f.er;k++)for(let d=f.sc;d<=f.ec;d++){const w=Tl(d,k,o,n,a);cs(w,r[1])&&(y+=$o(m.sc+(d-f.sc),m.sr+(k-f.sr),o,n,a))}return y}case"PMT":{const r=vn(l);if(r.length<3||r.length>5)return null;const f=Wt(r[0],o,n,a,i),m=Wt(r[1],o,n,a,i),y=Wt(r[2],o,n,a,i);if(typeof f!="number"||typeof m!="number"||typeof y!="number")return null;const k=r.length>=4?Wt(r[3],o,n,a,i):0,d=typeof k=="number"?k:0,w=r.length>=5?Wt(r[4],o,n,a,i):0,v=ho(w)?1:0;if(f===0)return m===0?null:-(y+d)/m;const R=Math.pow(1+f,m);return-(d+y*R)*f/((1+f*v)*(R-1))}default:return null}}function jn(e,l,o){const n=[],a=/(\$?[A-Z]+\$?\d+)(?::(\$?[A-Z]+\$?\d+))?/gi;let i;for(;(i=a.exec(e))!==null;){const r=Ln(i[1],l,o);if(r)if(i[2]){const f=Ln(i[2],l,o);if(!f)continue;for(let m=Math.min(r.col,f.col);m<=Math.max(r.col,f.col);m++)for(let y=Math.min(r.row,f.row);y<=Math.max(r.row,f.row);y++)n.push(Nn(m,y))}else n.push(Nn(r.col,r.row))}return n}function Yo(e,l,o,n,a){const i=o[Nn(e,l)];if(!i)return"";const r=i.value;if(!r.startsWith("="))return r;const f=Wo(Nn(e,l),o,n,a);return f===null?"#ERROR":String(f)}function Xo(e,l,o,n,a,i){return l===0&&o===0?e:e.replace(/(\$?)([A-Z]+)(\$?)(\d+)/gi,(r,f,m,y,k)=>{const d=f?mo(m):mo(m)+l,w=y?parseInt(k,10)-1:parseInt(k,10)-1+o;let v;d<0?v="A":d>=n?v=i(n-1):v=i(d);let R;return w<0?R="1":w>=a?R=String(a):R=String(w+1),(f||"")+v+(y||"")+R})}class ds{constructor(){this.deps=new Map,this.rev=new Map,this.dirty=new Set}clear(l){var n;const o=this.deps.get(l);if(o){for(const a of o)(n=this.rev.get(a))==null||n.delete(l);this.deps.delete(l)}}set(l,o){if(this.clear(l),o.length!==0){this.deps.set(l,o);for(const n of o)this.rev.has(n)||this.rev.set(n,new Set),this.rev.get(n).add(l)}}markDirty(l){const o=[l];for(;o.length>0;){const n=o.pop(),a=this.rev.get(n);if(a)for(const i of a)this.dirty.has(i)||(this.dirty.add(i),o.push(i))}}getDirtyAndClear(){const l=this.dirty;return this.dirty=new Set,l}rebuild(l,o,n){this.deps.clear(),this.rev.clear(),this.dirty.clear(),zn.clear();for(const[a,i]of Object.entries(l))if(i.value.startsWith("=")){const r=jn(i.value.slice(1),o,n);this.set(a,r)}}}const fs={class:"ifn-dialog__header"},ms={class:"ifn-dialog__title"},ps={class:"ifn-dialog__body"},hs={class:"ifn-dialog__field"},gs={class:"ifn-dialog__label"},ys={key:0,class:"ifn-dialog__desc"},bs={class:"ifn-dialog__field"},Cs={class:"ifn-dialog__label"},ws={class:"ifn-dialog__footer"},vs=["disabled"],ks=tl(t.defineComponent({__name:"insertFunctionDialog",props:{modelOpen:{type:Boolean,default:!1},locale:{default:"zh-CN"}},emits:["update:modelOpen","insert","cancel"],setup(e,{emit:l}){const o=e,n=l,a=t.ref(!1),i=t.ref(""),r=t.ref(""),f=t.ref(null),m=t.ref(null),y={SUM:"fnDescSum",AVERAGE:"fnDescAverage",COUNT:"fnDescCount",IF:"fnDescIf",VLOOKUP:"fnDescVlookup",CONCATENATE:"fnDescConcatenate",MAX:"fnDescMax",MIN:"fnDescMin",SIN:"fnDescSin",SUMIF:"fnDescSumif",PMT:"fnDescPmt",STDEV:"fnDescStdev"},k=t.computed(()=>zo.map(q=>({label:q.name,value:q.name}))),d=t.computed(()=>{const q=String(i.value??"");return q?D(o.locale,y[q]??""):""}),w=t.computed(()=>as(r.value)),v=t.computed(()=>i.value===""||i.value===null||!r.value.trim()||!w.value.ok?!1:w.value.name===String(i.value).toUpperCase());t.watch(()=>o.modelOpen,q=>{q&&!a.value?R():!q&&a.value&&G()});function R(){r.value="",i.value="",a.value=!0,o.modelOpen!==void 0&&n("update:modelOpen",!0),t.nextTick(()=>{const q=f.value;if(q)try{q.focus({preventScroll:!0}),q.setSelectionRange(q.value.length,q.value.length)}catch{}})}function G(){a.value=!1,o.modelOpen!==void 0&&n("update:modelOpen",!1)}function te(q){i.value=q;const se=zo.find(Fe=>Fe.name===String(q));se&&(r.value="",Y(se.snippet))}function Y(q){const se=r.value,Fe=f.value,Qe=Fe?Fe.selectionStart??se.length:se.length,Ge=Fe?Fe.selectionEnd??se.length:se.length,be=se.trim()?q:"="+q;r.value=se.slice(0,Qe)+be+se.slice(Ge),t.nextTick(()=>{const ve=f.value;if(!ve)return;const Xe=Qe+be.length;try{ve.focus({preventScroll:!0}),ve.setSelectionRange(Xe,Xe)}catch{}})}function K(){n("insert",r.value),G()}function C(){n("cancel"),G()}function j(q){q.key==="Escape"&&(q.stopPropagation(),C())}return(q,se)=>(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(C,["self"]),onKeydown:j},[t.createElementVNode("div",{ref_key:"dialogRef",ref:m,class:"ifn-dialog",onMousedown:se[1]||(se[1]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",fs,[t.createElementVNode("span",ms,t.toDisplayString(t.unref(D)(e.locale,"insertFunctionTitle")),1),t.createElementVNode("button",{class:"ifn-dialog__close",type:"button",onClick:C},[...se[2]||(se[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",ps,[t.createElementVNode("div",hs,[t.createElementVNode("label",gs,t.toDisplayString(t.unref(D)(e.locale,"insertFunctionSelectLabel")),1),t.createVNode(ll,{class:"ifn-dialog__dropdown","model-value":i.value,options:k.value,searchable:!0,"search-placeholder":t.unref(D)(e.locale,"insertFunctionSearchPlaceholder"),"fallback-label":t.unref(D)(e.locale,"insertFunctionPlaceholder"),title:t.unref(D)(e.locale,"insertFunctionSelectLabel"),"onUpdate:modelValue":te},null,8,["model-value","options","search-placeholder","fallback-label","title"]),d.value?(t.openBlock(),t.createElementBlock("div",ys,t.toDisplayString(d.value),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",bs,[t.createElementVNode("label",Cs,t.toDisplayString(t.unref(D)(e.locale,"insertFunctionFormulaLabel")),1),t.withDirectives(t.createElementVNode("textarea",{ref_key:"textareaRef",ref:f,"onUpdate:modelValue":se[0]||(se[0]=Fe=>r.value=Fe),class:"ifn-dialog__textarea",spellcheck:"false"},null,512),[[t.vModelText,r.value]])])]),t.createElementVNode("div",ws,[t.createElementVNode("button",{class:"ifn-dialog__btn ifn-dialog__btn--primary",type:"button",disabled:!v.value,onClick:K},t.toDisplayString(t.unref(D)(e.locale,"insertFunctionBtn")),9,vs),t.createElementVNode("button",{class:"ifn-dialog__btn",type:"button",onClick:C},t.toDisplayString(t.unref(D)(e.locale,"cancel")),1)])],544)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-f4e459b6"]]),$n="__filter_blank__";function yo(e,l,o,n){if(Ul(e))return Number(e);if(n==="date"){const a=Dn(e,o);if(a)return a.serial}return null}function Zn(e,l,o){if(e==null)return null;if(Ul(e))return Number(e);if(l==="date"){const n=Dn(e,o);if(n)return n.serial}return null}function Es(e,l,o,n,a){const i=bl(l,o,n);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 m=yo(l,o,n,a),y=Zn(e.value,a,n);return m==null||y==null?!1:r?m===y:m!==y}const f=i.toLowerCase()===(e.value??"").toLowerCase();return r?f:!f}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=yo(l,o,n,a),f=Zn(e.value,a,n);return r==null||f==null?!1:e.operator==="gt"?r>f:e.operator==="gte"?r>=f:e.operator==="lt"?r<f:r<=f}case"between":{const r=yo(l,o,n,a),f=Zn(e.value,a,n),m=Zn(e.value2,a,n);if(r==null||f==null||m==null)return!1;const y=Math.min(f,m),k=Math.max(f,m);return r>=y&&r<=k}}return!0}function jo(e,l,o,n){if(e.type==="values"){const a=e.values??[];if(a.length===0)return!0;if(l.trim()==="")return a.includes($n);const i=bl(l,o,n);return a.includes(l)||a.includes(i)}return e.condition?Es(e.condition,l,o,n,e.type):!0}function Ss(e,l,o,n){if(!e)return!0;const{columns:a,range:i}=e;for(const r in a){const f=Number(r);if(f<i.startCol||f>i.endCol)continue;const m=a[r],y=o.getValue(f,l),k=o.getFormat(f,l);if(!jo(m,y,k,n))return!1}return!0}function Rs(e,l,o,n){const a=new Set,i=[];let r=!1;const{range:f,columns:m}=e;for(let k=f.startRow+1;k<=f.endRow;k++){let d=!0;for(const R in m){const G=Number(R);if(G===l)continue;const te=m[R];if(!jo(te,o.getValue(G,k),o.getFormat(G,k),n)){d=!1;break}}if(!d)continue;const w=o.getValue(l,k),v=bl(w,o.getFormat(l,k),n);if(w.trim()===""){r=!0;continue}a.has(v)||(a.add(v),i.push(v))}return i.length>0&&i.every(k=>Ul(k))?i.sort((k,d)=>Number(k)-Number(d)):i.sort((k,d)=>k.localeCompare(d,n,{numeric:!0})),{values:i,hasBlank:r}}function Zo(e){var l;return e?e.type==="values"?(((l=e.values)==null?void 0:l.length)??0)>0:!!e.condition:!1}const Ms={class:"filter-popup__head"},xs={class:"filter-popup__head-label"},Bs={key:0,class:"filter-popup__head-badge"},Ts={class:"filter-popup__search"},Ds=["placeholder"],Ns={class:"filter-popup__tools"},Fs={class:"filter-popup__count"},Is=["checked","onChange"],As={class:"filter-popup__item-label"},Vs={key:0,class:"filter-popup__item-note"},Hs={key:0,class:"filter-popup__empty"},Os={class:"filter-popup__modes"},Ls={key:1,class:"filter-popup__cond"},zs={class:"filter-popup__cond-row"},_s=["value"],$s={key:0,class:"filter-popup__cond-row"},Ws={class:"filter-popup__cond-and"},Ps={key:1,class:"filter-popup__cond-row"},Us=["placeholder"],Ks={class:"filter-popup__footer"},bo=248,qn=28,Gs=252,Ys=tl(t.defineComponent({__name:"filter-popup",props:{col:{},anchor:{},locale:{default:"zh-CN"},headerLabel:{},getFilter:{},setFilter:{},setFilterColumn:{},clearFilterColumn:{},getColumnCandidates:{},close:{}},setup(e){const l=e,o=t.ref(null),n=t.ref(null),a=t.ref(null),i=t.ref({left:0,top:0}),r=t.ref("values"),f=t.ref(""),m=t.ref(new Set),y=t.ref(!1),k=t.ref(0),d=t.ref(null),w=t.ref("equals"),v=t.ref(""),R=t.ref(""),G=t.computed(()=>l.getColumnCandidates(l.col)),te=t.computed(()=>f.value.trim()!==""),Y=t.computed(()=>{const V=f.value.trim().toLowerCase();return V?G.value.values.filter(c=>c.toLowerCase().includes(V)):G.value.values}),K=t.computed(()=>{const V=Y.value.map(c=>({key:c,label:c,isBlank:!1}));return G.value.hasBlank&&!te.value&&V.push({key:$n,label:D(l.locale,"filterBlank"),isBlank:!0}),V}),C=Math.ceil(Gs/qn),j=t.computed(()=>Math.max(0,Math.floor(k.value/qn)-2)),q=t.computed(()=>Math.min(K.value.length,j.value+C+4)),se=t.computed(()=>K.value.slice(j.value,q.value)),Fe=t.computed(()=>j.value*qn),Qe=t.computed(()=>Math.max(0,(K.value.length-q.value)*qn));function Ge(V){k.value=V.target.scrollTop}const be=["equals","notEquals","contains","notContains","startsWith","endsWith"],ve=["equals","notEquals","gt","gte","lt","lte","between"],Xe={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"},Je=t.computed(()=>r.value==="text"?be:ve),gt=t.computed(()=>{var u;const V=l.getFilter(),c=V==null?void 0:V.columns[l.col];return c?c.type==="values"?(((u=c.values)==null?void 0:u.length)??0)>0:!!c.condition:!1});function Ze(){const V=l.getFilter(),c=V==null?void 0:V.columns[l.col];c&&c.type==="values"?(m.value=new Set((c.values??[]).filter(u=>u!==$n)),y.value=(c.values??[]).includes($n)):c&&c.condition?(r.value=c.type,w.value=c.condition.operator,v.value=c.condition.value??"",R.value=c.condition.value2??""):(m.value=new Set(G.value.values),y.value=G.value.hasBlank)}function lt(){if(!l.getFilter())return;const c=G.value.values,u=G.value.hasBlank;if(m.value.size===c.length&&c.every(H=>m.value.has(H))&&y.value===u)l.setFilterColumn(l.col,null);else{const H=[...m.value];y.value&&H.push($n),l.setFilterColumn(l.col,{type:"values",values:H})}}function et(V){const c=new Set(m.value);c.has(V)?c.delete(V):c.add(V),m.value=c}function oe(){y.value=!y.value}function pe(){const V=te.value?Y.value:G.value.values,c=new Set(m.value);V.forEach(u=>c.add(u)),m.value=c,y.value=!0}function g(){m.value=new Set,y.value=!1}function A(V){r.value=V,w.value=V==="text"?"contains":"equals",v.value="",R.value=""}function L(){r.value="values",Ze()}function $(){const V={operator:w.value,value:v.value};r.value!=="text"&&w.value==="between"&&(V.value2=R.value),v.value.trim()!==""&&(l.setFilterColumn(l.col,{type:r.value,condition:V}),l.close())}function ee(){m.value=new Set(G.value.values),y.value=G.value.hasBlank}function ie(){lt(),l.close()}function re(){d.value&&l.setFilter(d.value),l.close()}function he(V){const c=o.value;c&&V.target instanceof Node&&c.contains(V.target)||l.close()}function ce(V){V.key==="Escape"&&re()}return t.onMounted(async()=>{var p,H;d.value=l.getFilter()?JSON.parse(JSON.stringify(l.getFilter())):null,Ze(),await t.nextTick();const V=((p=o.value)==null?void 0:p.offsetHeight)??400;let c=l.anchor.x+15-bo,u=l.anchor.y+24;c<4&&(c=Math.max(4,l.anchor.x)),c+bo>window.innerWidth-4&&(c=Math.max(4,window.innerWidth-bo-4)),u+V>window.innerHeight-4&&(u=Math.max(4,l.anchor.y-V-4)),i.value={left:c,top:u},(H=a.value)==null||H.focus(),document.addEventListener("pointerdown",he,!0),document.addEventListener("keydown",ce,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",he,!0),document.removeEventListener("keydown",ce,!0)}),(V,c)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createElementVNode("div",{ref_key:"rootRef",ref:o,class:"filter-popup",style:t.normalizeStyle({left:i.value.left+"px",top:i.value.top+"px"}),onPointerdown:c[9]||(c[9]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",Ms,[t.createElementVNode("span",xs,t.toDisplayString(e.headerLabel||t.unref(ht)(e.col)),1),gt.value?(t.openBlock(),t.createElementBlock("span",Bs,t.toDisplayString(t.unref(D)(e.locale,"filterActive")),1)):t.createCommentVNode("",!0)]),r.value==="values"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",Ts,[t.withDirectives(t.createElementVNode("input",{ref_key:"searchInputRef",ref:a,"onUpdate:modelValue":c[0]||(c[0]=u=>f.value=u),class:"filter-popup__search-input",type:"text",placeholder:t.unref(D)(e.locale,"filterSearchPlaceholder")},null,8,Ds),[[t.vModelText,f.value]])]),t.createElementVNode("div",Ns,[t.createElementVNode("button",{class:"filter-popup__tool",onClick:pe},t.toDisplayString(t.unref(D)(e.locale,"filterSelectAll")),1),t.createElementVNode("button",{class:"filter-popup__tool",onClick:g},t.toDisplayString(t.unref(D)(e.locale,"filterClearAll")),1),t.createElementVNode("span",Fs,t.toDisplayString(t.unref(D)(e.locale,"filterFilteredCount").replace("{n}",String(G.value.values.length))),1)]),t.createElementVNode("div",{ref_key:"listRef",ref:n,class:"filter-popup__list",onScroll:Ge},[t.createElementVNode("div",{style:t.normalizeStyle({height:Fe.value+"px"})},null,4),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(se.value,u=>(t.openBlock(),t.createElementBlock("label",{key:u.key,class:"filter-popup__item"},[t.createElementVNode("input",{type:"checkbox",checked:u.isBlank?y.value:m.value.has(u.key),onChange:p=>u.isBlank?oe():et(u.key)},null,40,Is),t.createElementVNode("span",As,t.toDisplayString(u.label),1),u.isBlank?(t.openBlock(),t.createElementBlock("span",Vs,"("+t.toDisplayString(t.unref(D)(e.locale,"filterBlank"))+")",1)):t.createCommentVNode("",!0)]))),128)),t.createElementVNode("div",{style:t.normalizeStyle({height:Qe.value+"px"})},null,4),K.value.length===0?(t.openBlock(),t.createElementBlock("div",Hs,t.toDisplayString(t.unref(D)(e.locale,"filterNoData")),1)):t.createCommentVNode("",!0)],544),t.createElementVNode("div",Os,[t.createElementVNode("button",{class:"filter-popup__mode",onClick:c[1]||(c[1]=u=>A("text"))},t.toDisplayString(t.unref(D)(e.locale,"filterText")),1),t.createElementVNode("button",{class:"filter-popup__mode",onClick:c[2]||(c[2]=u=>A("number"))},t.toDisplayString(t.unref(D)(e.locale,"filterNumber")),1),t.createElementVNode("button",{class:"filter-popup__mode",onClick:c[3]||(c[3]=u=>A("date"))},t.toDisplayString(t.unref(D)(e.locale,"filterDate")),1)])],64)):(t.openBlock(),t.createElementBlock("div",Ls,[t.createElementVNode("button",{class:"filter-popup__cond-back",onClick:L},"← "+t.toDisplayString(t.unref(D)(e.locale,"filterCustom")),1),t.createElementVNode("div",zs,[t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":c[4]||(c[4]=u=>w.value=u),class:"filter-popup__cond-select"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Je.value,u=>(t.openBlock(),t.createElementBlock("option",{key:u,value:u},t.toDisplayString(t.unref(D)(e.locale,Xe[u])),9,_s))),128))],512),[[t.vModelSelect,w.value]])]),w.value==="between"?(t.openBlock(),t.createElementBlock("div",$s,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":c[5]||(c[5]=u=>v.value=u),class:"filter-popup__cond-input",type:"text"},null,512),[[t.vModelText,v.value]]),t.createElementVNode("span",Ws,t.toDisplayString(t.unref(D)(e.locale,"filterAnd")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":c[6]||(c[6]=u=>R.value=u),class:"filter-popup__cond-input",type:"text"},null,512),[[t.vModelText,R.value]])])):(t.openBlock(),t.createElementBlock("div",Ps,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":c[7]||(c[7]=u=>v.value=u),class:"filter-popup__cond-input",type:"text",placeholder:r.value==="date"?"2024-01-01":"",onKeydown:t.withKeys($,["enter"])},null,40,Us),[[t.vModelText,v.value]])]))])),t.createElementVNode("div",Ks,[t.createElementVNode("button",{class:"filter-popup__btn filter-popup__btn--clear",onClick:ee},t.toDisplayString(t.unref(D)(e.locale,"clearFilter")),1),c[10]||(c[10]=t.createElementVNode("span",{class:"filter-popup__footer-spacer"},null,-1)),t.createElementVNode("button",{class:"filter-popup__btn",onClick:re},t.toDisplayString(t.unref(D)(e.locale,"cancelFilter")),1),t.createElementVNode("button",{class:"filter-popup__btn filter-popup__btn--primary",onClick:c[8]||(c[8]=u=>r.value==="values"?ie():$())},t.toDisplayString(t.unref(D)(e.locale,"filterOk")),1)])],36)]))}}),[["__scopeId","data-v-ec90eb74"]]);function cn(e,l){return`${e},${l}`}function qo(e,l){if(e.startsWith("="))return{kind:"formula",formula:e};const o=Dn(e,l);if(o)return{kind:"date",serial:o.serial};const n=/^(.*?)(\d+)$/.exec(e);if(n){const a=n[1],i=n[2];if(a!==""&&/^\d+$/.test(i))return{kind:"text-number",prefix:a,num:parseInt(i,10),digits:i.length}}return Ul(e)?{kind:"number",num:parseFloat(e)}:{kind:"text",text:e}}function Co(e,l){for(let o=2;o<e.length;o++)if(e[o]-e[o-1]!==l)return!1;return!0}function Jo(e){const l=e.length;if(l===0)return{kind:"copy",sourceValues:[]};if(e.some(o=>o.kind==="formula"))return{kind:"formula"};if(e.every(o=>o.kind==="date")){const o=e[0],n=l>=2?e[1].serial-o.serial:1;return{kind:"date-linear",baseSerial:o.serial,step:n,sourceLen:l}}if(e.every(o=>o.kind==="number")){if(l===1)return{kind:"copy",sourceValues:[...e]};const o=e.map(a=>a.num),n=o[1]-o[0];return Co(o,n)?{kind:"linear",step:n,base:o[0],sourceLen:l}:{kind:"copy",sourceValues:[...e]}}if(e.every(o=>o.kind==="text-number")){const o=e[0];if(e.every(a=>a.kind==="text-number"&&a.prefix===o.prefix)){if(l===1)return{kind:"copy",sourceValues:[...e]};const a=e.map(r=>r.num),i=a[1]-a[0];if(Co(a,i))return{kind:"text-number",prefix:o.prefix,step:i,base:o.num,digits:o.digits,sourceLen:l}}return{kind:"copy",sourceValues:[...e]}}if(e.every(o=>o.kind==="text")){const o=e.every(n=>n.text.length===1&&/[a-zA-Z]/.test(n.text));if(l>=2&&o){const n=e.map(i=>i.text.charCodeAt(0)),a=n[1]-n[0];if(a!==0&&Co(n,a))return{kind:"text-series",step:a,baseCharCode:n[0],sourceLen:l}}return{kind:"copy",sourceValues:[...e]}}return{kind:"copy",sourceValues:[...e]}}function Qo(e,l,o){switch(e.kind){case"copy":{const n=e.sourceValues.length;return n===0?{kind:"text",text:""}:e.sourceValues[l%n]}case"linear":return{kind:"number",num:e.base+e.step*(o+l)};case"text-number":return{kind:"text-number",prefix:e.prefix,num:e.base+e.step*(o+l),digits:e.digits};case"date-linear":return{kind:"date",serial:e.baseSerial+e.step*(o+l)};case"text-series":return{kind:"text",text:String.fromCharCode(e.baseCharCode+e.step*(o+l))};case"formula":return{kind:"formula",formula:""}}}function er(e,l){switch(e.kind){case"copy":{const o=e.sourceValues.length;return o===0?{kind:"text",text:""}:e.sourceValues[o-1-l%o]}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 Jn(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 tr(e,l){const o=l.row<e.startRow?e.startRow-l.row:l.row>e.endRow?l.row-e.endRow:0,n=l.col<e.startCol?e.startCol-l.col:l.col>e.endCol?l.col-e.endCol:0;if(o===0&&n===0)return null;const a=o>=n?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 lr(e,l,o,n,a,i){return Xo(e,o.col-l.col,o.row-l.row,n,a,i)}function nr(e,l){return!(e.endCol<l.startCol||e.startCol>l.endCol||e.endRow<l.startRow||e.startRow>l.endRow)}function Xs(e,l){return l.startCol>=e.startCol&&l.endCol<=e.endCol&&l.startRow>=e.startRow&&l.endRow<=e.endRow}function wo(e,l,o){const n=Object.keys(o);for(const a of n){const i=o[a];if(nr(e,i)&&!Xs(e,i))return!1}for(const a of n){const i=o[a];if(nr(l,i))return!1}return!0}function or(e,l,o,n){const a=l.length;if(a!==0){if(e.kind==="copy"){const i=n?a-1-o%a:o%a;return l[i]}return n?l[0]:l[a-1]}}function js(e,l,o,n,a,i,r,f){const m={cells:{},merges:{}},y=n==="up"||n==="down",k=n==="up"||n==="left";if(y){const d=e.endRow-e.startRow+1;for(let w=e.startCol;w<=e.endCol;w++){const v=[],R=[];for(let Y=e.startRow;Y<=e.endRow;Y++){const K=o.cells[cn(w,Y)];v.push(K?qo(K.value,a):{kind:"text",text:""}),R.push(K==null?void 0:K.styleId)}const G=Jo(v),te=v.length;for(let Y=l.startRow;Y<=l.endRow;Y++){const K=k?l.endRow-Y:Y-l.startRow;if(G.kind==="formula"){const C=k?e.endRow-((l.endRow-Y)%d+d)%d:e.startRow+((Y-e.startRow)%d+d)%d,j=o.cells[cn(w,C)],q=j?j.value:"",se=lr(q,{col:w,row:C},{col:w,row:Y},i,r,f);m.cells[cn(w,Y)]=Jn({kind:"formula",formula:se},j==null?void 0:j.styleId)}else{const C=k?er(G,K):Qo(G,K,te),j=or(G,R,K,k);m.cells[cn(w,Y)]=Jn(C,j)}}}}else{const d=e.endCol-e.startCol+1;for(let w=e.startRow;w<=e.endRow;w++){const v=[],R=[];for(let Y=e.startCol;Y<=e.endCol;Y++){const K=o.cells[cn(Y,w)];v.push(K?qo(K.value,a):{kind:"text",text:""}),R.push(K==null?void 0:K.styleId)}const G=Jo(v),te=v.length;for(let Y=l.startCol;Y<=l.endCol;Y++){const K=k?l.endCol-Y:Y-l.startCol;if(G.kind==="formula"){const C=k?e.endCol-((l.endCol-Y)%d+d)%d:e.startCol+((Y-e.startCol)%d+d)%d,j=o.cells[cn(C,w)],q=j?j.value:"",se=lr(q,{col:C,row:w},{col:Y,row:w},i,r,f);m.cells[cn(Y,w)]=Jn({kind:"formula",formula:se},j==null?void 0:j.styleId)}else{const C=k?er(G,K):Qo(G,K,te),j=or(G,R,K,k);m.cells[cn(Y,w)]=Jn(C,j)}}}}return m}class Zs{constructor(l){if(l&&l.length>0){this.styles=l,this.index=new Map;for(let o=0;o<this.styles.length;o++){const n=this.stableKey(this.styles[o]);this.index.set(n,o)}}else this.styles=[{}],this.index=new Map,this.index.set(this.stableKey({}),0)}stableKey(l){const o=Object.keys(l).sort(),n={};for(const a of o)n[a]=l[a];return JSON.stringify(n)}get(l){const o=this.styles[l];return o?l===0?o:Object.freeze(o):{}}getId(l){if(!l||Object.keys(l).length===0)return 0;const o=this.stableKey(l),n=this.index.get(o);if(n!==void 0)return n;const a=this.styles.length,i=Object.freeze({...l});return this.styles.push(i),this.index.set(o,a),a}getStyles(){return[...this.styles]}setStyles(l){this.styles=l,this.index=new Map;for(let o=0;o<this.styles.length;o++){const n=this.stableKey(this.styles[o]);this.index.set(n,o)}}compactStyles(l){const o=new Set;o.add(0);for(const r in l){const f=l[r].styleId??0;o.add(f)}const n=new Map,a=[{}];n.set(0,0);const i=Array.from(o).sort((r,f)=>r-f);for(const r of i)if(r!==0&&r<this.styles.length){const f=a.length;n.set(r,f),a.push(this.styles[r])}for(const r in l){const f=l[r],m=f.styleId??0,y=n.get(m);y!==void 0&&y!==m&&(f.styleId=y)}this.styles=a,this.index=new Map;for(let r=0;r<this.styles.length;r++){const f=this.stableKey(this.styles[r]);this.index.set(f,r)}return a}}function qs(e,l){if(!e)return null;const o=e.styleId;return o===void 0||o===0?null:l[o]??null}function rr(e){const l=new Zs,o={};for(const[n,a]of Object.entries(e)){const i={value:a.value};a.styleId!==void 0&&a.styleId>0&&(i.styleId=a.styleId),a.style&&Object.keys(a.style).length>0&&(i.styleId=l.getId(a.style)),i.styleId===0&&delete i.styleId,o[n]=i}return{cells:o,styles:l.getStyles()}}function Js(e){const l={};for(const[o,n]of Object.entries(e)){const a={value:n.value};n.styleId!==void 0&&n.styleId>0&&(a.styleId=n.styleId),l[o]=a}return l}class Qs{constructor(l){if(l&&l.length>0){this.borders=l,this.index=new Map;for(let o=0;o<this.borders.length;o++){const n=this.stableKey(this.borders[o]);this.index.set(n,o)}}else this.borders=[{}],this.index=new Map,this.index.set(this.stableKey({}),0)}stableKey(l){const o=["top","right","bottom","left"],n={};for(const a of o){const i=l[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),n[a]=r}}return JSON.stringify(n)}get(l){const o=this.borders[l];return o?l===0?o:Object.freeze(o):{}}getId(l){if(!l||this.isEmptyBorder(l))return 0;const o=this.stableKey(l),n=this.index.get(o);if(n!==void 0)return n;const a=this.borders.length,i=Object.freeze(this.deepCloneBorder(l));return this.borders.push(i),this.index.set(o,a),a}isEmptyBorder(l){return!l.top&&!l.right&&!l.bottom&&!l.left}deepCloneBorder(l){const o={};return l.top&&(o.top={...l.top}),l.right&&(o.right={...l.right}),l.bottom&&(o.bottom={...l.bottom}),l.left&&(o.left={...l.left}),o}getBorders(){return[...this.borders]}setBorders(l){this.borders=l,this.index=new Map;for(let o=0;o<this.borders.length;o++){const n=this.stableKey(this.borders[o]);this.index.set(n,o)}}compactBorders(l){const o=new Set;o.add(0);for(const r of l){const f=r.borderId??0;o.add(f)}const n=new Map,a=[{}];n.set(0,0);const i=Array.from(o).sort((r,f)=>r-f);for(const r of i)if(r!==0&&r<this.borders.length){const f=a.length;n.set(r,f),a.push(this.borders[r])}for(const r of l){const f=r.borderId??0,m=n.get(f);m!==void 0&&m!==f&&(r.borderId=m)}this.borders=a,this.index=new Map;for(let r=0;r<this.borders.length;r++){const f=this.stableKey(this.borders[r]);this.index.set(f,r)}return a}}function eu(e,l,o,n){if(!e)return;const a=e.styleId??0,i=o[a];if(!i)return;const r=i.borderId??0;if(r===0)return;const f=n.get(r);if(f)return f[l]}function tu(e,l,o,n,a,i){const r=n[e.styleId??0]??{},f=r.borderId??0,m=f>0?a.get(f):{},y={top:m.top?{...m.top}:void 0,right:m.right?{...m.right}:void 0,bottom:m.bottom?{...m.bottom}:void 0,left:m.left?{...m.left}:void 0};o?y[l]={...o}:y[l]=void 0;const k=a.getId(y),d={...r};k===0?delete d.borderId:d.borderId=k,delete d.borderTopWidth,delete d.borderBottomWidth,delete d.borderLeftWidth,delete d.borderRightWidth,delete d.borderColor,Object.keys(d).length===0?e.styleId=0:e.styleId=i(d)}function ar(e){const l=new Qs,o=[];for(const n of e){if(!(n.borderTopWidth!==void 0||n.borderBottomWidth!==void 0||n.borderLeftWidth!==void 0||n.borderRightWidth!==void 0)){o.push(n);continue}const i=typeof n.borderColor=="string"?n.borderColor:void 0,r={};n.borderTopWidth!==void 0&&n.borderTopWidth>0&&(r.top={width:n.borderTopWidth,color:i}),n.borderBottomWidth!==void 0&&n.borderBottomWidth>0&&(r.bottom={width:n.borderBottomWidth,color:i}),n.borderLeftWidth!==void 0&&n.borderLeftWidth>0&&(r.left={width:n.borderLeftWidth,color:i}),n.borderRightWidth!==void 0&&n.borderRightWidth>0&&(r.right={width:n.borderRightWidth,color:i});const f=l.getId(r),m={...n};delete m.borderTopWidth,delete m.borderBottomWidth,delete m.borderLeftWidth,delete m.borderRightWidth,delete m.borderColor,f>0?m.borderId=f:delete m.borderId,o.push(m)}return{styles:o,borders:l.getBorders()}}function lu(e,l){const o=t.reactive({rowCount:e.rowCount??l.rowCount,colCount:e.colCount??l.colCount,width:e.width,height:e.height,theme:e.theme??l.theme,locale:e.locale??l.locale});t.watchEffect(()=>{o.rowCount=e.rowCount??l.rowCount,o.colCount=e.colCount??l.colCount,o.width=e.width,o.height=e.height,o.theme=e.theme??l.theme,o.locale=e.locale??l.locale});const n=t.computed(()=>o.locale==="zh-CN"?"zh-CN":"en-US"),a=o.colCount,i=o.rowCount,r=t.reactive({colCount:a,rowCount:i}),f=8,m=32,y=t.reactive({}),k=t.reactive([{}]),d=t.reactive([{}]);let w=new Map;w.set("{}",0);let v=new Map;v.set("{}",0);function R(h){const S=Object.keys(h).sort(),B={};for(const W of S)B[W]=h[W];return JSON.stringify(B)}function G(h){const S=["top","right","bottom","left"],B={};for(const W of S){const X=h[W];if(X&&(X.width!==void 0||X.color!==void 0||X.style!==void 0)){const Ce={};X.width!==void 0&&(Ce.width=X.width),X.color!==void 0&&(Ce.color=X.color),X.style!==void 0&&(Ce.style=X.style),B[W]=Ce}}return JSON.stringify(B)}function te(h){if(!h||Object.keys(h).length===0)return 0;const S=R(h),B=w.get(S);if(B!==void 0)return B;const W=k.length;return k.push(Object.freeze({...h})),w.set(S,W),W}function Y(h){return qs(h,k)}function K(){w=new Map;for(let h=0;h<k.length;h++)w.set(R(k[h]),h)}function C(h){k.splice(0,k.length,...h),K()}function j(h){if(!h||!h.top&&!h.right&&!h.bottom&&!h.left)return 0;const S=G(h),B=v.get(S);if(B!==void 0)return B;const W=d.length;return d.push(Object.freeze({top:h.top?Object.freeze({...h.top}):void 0,right:h.right?Object.freeze({...h.right}):void 0,bottom:h.bottom?Object.freeze({...h.bottom}):void 0,left:h.left?Object.freeze({...h.left}):void 0})),v.set(S,W),W}function q(h){return d[h]??{}}function se(){v=new Map;for(let h=0;h<d.length;h++)v.set(G(d[h]),h)}function Fe(h){d.splice(0,d.length,...h),se()}function Qe(h,S){return eu(h,S,k,{get:B=>d[B]??{}})}function Ge(h,S){const B=p(h,S);return B?B.anchor:null}function be(h,S,B,W){const X=p(h,S),Ce=p(B,W);return!X||!Ce?!1:X.anchor===Ce.anchor}const ve=t.reactive({}),Xe=new ds,Je=t.ref(null),gt=t.ref("cell"),Ze=t.ref({col:0,row:0}),lt=t.ref(null),et=t.ref(""),oe=t.ref(new Array(r.colCount).fill(100)),pe=t.ref(new Array(r.rowCount).fill(void 0)),g=t.ref(0),A=t.ref(0),L=t.reactive({rows:0,cols:0}),$=t.ref(null),ee=t.shallowRef({active:!1,sourceRange:null,targetRange:null,direction:null,preview:!1}),ie=new Map;let re=null;function he(h,S,B,W){const X=`${W} ${B} ${S}px ${h}`,Ce=ie.get(X);if(Ce)return Ce;if(!re){if(typeof document>"u")return{ascent:S*.88,descent:S*.28};re=document.createElement("canvas")}const xe=re.getContext("2d");if(!xe)return{ascent:S*.88,descent:S*.28};xe.font=X;const Ie=xe.measureText(" "),Ve=Ie.fontBoundingBoxAscent,Le=Ie.fontBoundingBoxDescent;if(typeof Ve=="number"&&typeof Le=="number"&&Ve>0&&Le>0){const El={ascent:Ve,descent:Le};return ie.set(X,El),El}const Ue=["M","中","y","Ä","0"];let mt=0,je=0;for(const El of Ue){const mn=xe.measureText(El),Rn=mn.actualBoundingBoxAscent||0,Zl=mn.actualBoundingBoxDescent||0;Rn>mt&&(mt=Rn),Zl>je&&(je=Zl)}const pt=Math.max(mt,S*.88),Ot=Math.max(je,S*.28),Sn={ascent:pt,descent:Ot};return ie.set(X,Sn),Sn}const ce=he(Cn,_l,"normal","normal"),V=ce.ascent+ce.descent,c=Math.max(0,(24-V)/2);let u=(h,S)=>`${h},${S}`,p=()=>null,H=()=>_l,ct=t.computed(()=>[0]),ae=()=>24,Pe=(h,S,B,W)=>({startCol:Math.min(h,B),startRow:Math.min(S,W),endCol:Math.max(h,B),endRow:Math.max(S,W)});function at(h,S){const B=Y(y[u(h,S)]),W=H(h,S),X=typeof(B==null?void 0:B.fontFamily)=="string"&&B.fontFamily?B.fontFamily:Cn,Ce=(B==null?void 0:B.fontWeight)==="bold"?"bold":"normal",xe=(B==null?void 0:B.fontStyle)==="italic"?"italic":"normal";return he(X,W,Ce,xe)}function Mt(h,S,B,W){if(!S)return[""];const X=S.split(`
|
|
2
|
-
`),
|
|
3
|
-
`).length,Il>X&&(X=Il)}}const Ie=B+W,Ve=c*2+X*Ie;return Math.min(500,Math.max(24,Math.round(Ve)))}ae=Cl;function Dl(h){return pe.value[h]===void 0}const cl={getValue:(h,S)=>Pt(h,S),getFormat:(h,S)=>{var B;return(B=Y(y[u(h,S)]))==null?void 0:B.numberFormat}},wl=t.computed(()=>{const h=new Set,S=$.value;if(!S)return h;const{range:B}=S;for(let W=B.startRow+1;W<=B.endRow;W++)ol(W)||h.add(W);return h});function ol(h){return Ss($.value,h,cl,n.value)}function fl(){return wl.value}function Xt(h){return $.value?wl.value.has(h):!1}function Kl(){return $.value?r.rowCount-wl.value.size:r.rowCount}function Gl(h){let S=-1;for(let B=0;B<r.rowCount;B++)if(!Xt(B)&&(S++,S===h))return B;return-1}function Yl(h){if(Xt(h))return-1;let S=0;for(let B=0;B<h;B++)Xt(B)||S++;return S}function sn(){return $.value}function I(h,S=!1){var B,W;$.value=h,!S&&(Yt(g.value,A.value),(B=De.scheduleRender)==null||B.call(De),(W=De.emitModelData)==null||W.call(De))}function N(h){var B,W;const S={range:{startCol:Math.min(h.startCol,h.endCol),endCol:Math.max(h.startCol,h.endCol),startRow:Math.min(h.startRow,h.endRow),endRow:Math.max(h.startRow,h.endRow)},columns:{}};$.value=S,Yt(g.value,A.value),(B=De.scheduleRender)==null||B.call(De),(W=De.emitModelData)==null||W.call(De)}function O(){var h,S;$.value&&($.value=null,Yt(g.value,A.value),(h=De.scheduleRender)==null||h.call(De),(S=De.emitModelData)==null||S.call(De))}function de(h){var B,W;if(!$.value)return;const S={...$.value,columns:{...$.value.columns}};delete S.columns[h],$.value=S,(B=De.scheduleRender)==null||B.call(De),(W=De.emitModelData)==null||W.call(De)}function ge(h,S){var W,X;if(!$.value)return;const B={...$.value,columns:{...$.value.columns}};S?B.columns[h]=S:delete B.columns[h],$.value=B,(W=De.scheduleRender)==null||W.call(De),(X=De.emitModelData)==null||X.call(De)}function Me(h){const S=$.value;return S?Rs(S,h,cl,n.value):{values:[],hasBlank:!1}}function Ee(h,S){const B=r.colCount,W=r.rowCount,X=(mt,je)=>{const pt=y[ue(mt,je)];return!!pt&&(pt.value!==""||pt.styleId!==void 0)};if(!X(h,S))return null;const Ce=mt=>{for(let je=0;je<B;je++)if(X(je,mt))return!0;return!1},xe=(mt,je,pt)=>{for(let Ot=je;Ot<=pt;Ot++)if(X(mt,Ot))return!0;return!1};let Ie=S;for(;Ie>0&&Ce(Ie-1);)Ie--;let Ve=S;for(;Ve<W-1&&Ce(Ve+1);)Ve++;let Le=h;for(;Le>0&&xe(Le-1,Ie,Ve);)Le--;let Ue=h;for(;Ue<B-1&&xe(Ue+1,Ie,Ve);)Ue++;return{startCol:Le,startRow:Ie,endCol:Ue,endRow:Ve}}function fe(){const h=Je.value;if(!!h&&h.startRow!==h.endRow)return{startCol:Math.min(h.startCol,h.endCol),endCol:Math.max(h.startCol,h.endCol),startRow:Math.min(h.startRow,h.endRow),endRow:Math.max(h.startRow,h.endRow)};const B=Ze.value,W=h?h.startCol:B.col,X=h?h.startRow:B.row,Ce=(Le,Ue)=>{const mt=y[ue(Le,Ue)];return!!mt&&(mt.value!==""||mt.styleId!==void 0)};let xe,Ie;h?(xe=Math.min(h.startCol,h.endCol),Ie=Math.max(h.startCol,h.endCol)):(xe=B.col,Ie=B.col);let Ve=X;for(;Ve<r.rowCount-1;){const Le=Ve+1;let Ue=!1,mt=!1;for(let je=xe;je<=Ie;je++){Ce(je,Le)&&(Ue=!0);const pt=zt(je,Le);pt&&(pt.range.startCol!==pt.range.endCol||pt.range.startRow!==pt.range.endRow)&&(mt=!0)}if(mt||!Ue)break;Ve++}return!Ce(W,X)&&Ve===X?ft():{startCol:xe,endCol:Ie,startRow:X,endRow:Ve}}function Z(){if($.value){O();return}const h=fe();h&&N(h)}function ze(h){const S=$.value;return S?h>=S.range.startCol&&h<=S.range.endCol:!1}function $e(){return $.value?{...$.value.range}:null}function le(){return!!$.value}function Ke(h){const S=$.value;return S?Zo(S.columns[h]):!1}function ft(){let h=1/0,S=1/0,B=-1,W=-1;for(const X in y){const Ce=X.indexOf(",");if(Ce<0)continue;const xe=parseInt(X.substring(0,Ce),10),Ie=parseInt(X.substring(Ce+1),10),Ve=y[X];Ve&&(Ve.value!==""||Ve.styleId!==void 0)&&(xe<h&&(h=xe),Ie<S&&(S=Ie),xe>B&&(B=xe),Ie>W&&(W=Ie))}return B<0?null:{startCol:h,startRow:S,endCol:B,endRow:W}}const E=t.computed(()=>{const h=[0];for(let S=0;S<r.rowCount;S++)h.push(h[S]+ae(S));return h}),U=t.computed(()=>Rt.value[r.colCount]),J=t.computed(()=>E.value[r.rowCount]);function ue(h,S){return`${h},${S}`}u=ue;function ye(h){Reflect.deleteProperty(y,h)}function me(h,S){gt.value="cell";const B=p(h,S);B?(Ze.value={col:B.range.startCol,row:B.range.startRow},Je.value={...B.range}):(Ze.value={col:h,row:S},Je.value={startCol:h,startRow:S,endCol:h,endRow:S})}function Se(h,S,B,W,X="cell"){const Ce=p(h,S);if(Ze.value=Ce?{col:Ce.range.startCol,row:Ce.range.startRow}:{col:h,row:S},gt.value=X,X==="row"||X==="col"){const xe=Math.min(h,B),Ie=Math.max(h,B),Ve=Math.min(S,W),Le=Math.max(S,W);Je.value={startCol:xe,startRow:Ve,endCol:Ie,endRow:Le}}else Je.value=Pe(h,S,B,W)}function We(){Se(0,0,r.colCount-1,r.rowCount-1,"all")}function st(h,S){const B=Je.value;return B?(gt.value==="cell"||gt.value==="all",h>=B.startCol&&h<=B.endCol&&S>=B.startRow&&S<=B.endRow):!1}function Bt(h,S){return st(h,S)}function zt(h,S){for(const B in ve){const W=ve[B];if(W&&h>=W.startCol&&h<=W.endCol&&S>=W.startRow&&S<=W.endRow)return{range:W,anchor:B}}return null}p=zt;function jt(h,S){return ve[ue(h,S)]!==void 0}function Vt(h,S){const B=p(h,S);if(B&&h===B.range.startCol&&S===B.range.startRow){const W=Rt.value[B.range.endCol+1]-Rt.value[h],X=E.value[B.range.endRow+1]-E.value[S];return{w:W,h:X}}return{w:oe.value[h],h:ae(S)}}function Ht(h,S,B,W){let X=Math.min(h,B),Ce=Math.max(h,B),xe=Math.min(S,W),Ie=Math.max(S,W),Ve=!0;for(;Ve;){Ve=!1;for(const Le in ve){const Ue=ve[Le];if(!Ue)continue;Ue.startCol<=Ce&&Ue.endCol>=X&&Ue.startRow<=Ie&&Ue.endRow>=xe&&(Ue.startCol<X&&(X=Ue.startCol,Ve=!0),Ue.endCol>Ce&&(Ce=Ue.endCol,Ve=!0),Ue.startRow<xe&&(xe=Ue.startRow,Ve=!0),Ue.endRow>Ie&&(Ie=Ue.endRow,Ve=!0))}}return{startCol:X,startRow:xe,endCol:Ce,endRow:Ie}}Pe=Ht;function _t(h,S){var B;return((B=y[ue(h,S)])==null?void 0:B.value)??""}function Pt(h,S){return _n(),Yo(h,S,y,r.colCount,r.rowCount)}function Xl(h,S,B){var Ie,Ve;h>=0&&S>=0&&Zt(h,S);const W=ue(h,S);if(_n(),B===""||B==null){Xe.clear(W);const Le=(Ie=y[W])==null?void 0:Ie.styleId;Le!==void 0&&Le>0?y[W]={value:"",styleId:Le}:ye(W),Xe.markDirty(W);return}const X=String(B);if(!X.startsWith("=")){const Le=Y(y[W]),Ue=typeof(Le==null?void 0:Le.numberFormat)=="string"?Le.numberFormat:"";if(dl(Ue)){const mt=Dn(X,n.value);if(mt){const pt={...Le??{},numberFormat:mt.format};y[W]={value:String(mt.serial),styleId:te(pt)},Xe.clear(W),Xe.markDirty(W);return}const je=qr(X,n.value);if(je){const pt={...Le??{},numberFormat:je.format};y[W]={value:String(je.num),styleId:te(pt)},Xe.clear(W),Xe.markDirty(W);return}}}const Ce=(Ve=y[W])==null?void 0:Ve.styleId,xe={value:X};Ce!==void 0&&Ce>0&&(xe.styleId=Ce),y[W]=xe,X.startsWith("=")?Xe.set(W,jn(X.slice(1),r.colCount,r.rowCount)):Xe.clear(W),Xe.markDirty(W)}function un(h,S,B,W){for(let X=h;X<=S;X++)for(let Ce=B;Ce<=W;Ce++){const xe=ue(X,Ce);Xe.clear(xe),ye(xe),Xe.markDirty(xe)}}let vl=()=>{};function Nl(h){lt.value||(lt.value={...Ze.value},h!==void 0?et.value=h:et.value||(et.value=_t(Ze.value.col,Ze.value.row)))}function kn(){lt.value&&(vl(),Xl(lt.value.col,lt.value.row,et.value),lt.value=null,et.value="")}function En(){lt.value=null,et.value=""}function In(h,S){const B=Ze.value;let W=Math.max(0,B.col+h),X=Math.max(0,B.row+S);(W>=r.colCount||X>=r.rowCount)&&Zt(W,X);const Ce=p(B.col,B.row),xe=p(W,X);Ce&&xe&&Ce.anchor===xe.anchor&&(h>0?W=Ce.range.endCol+1:h<0&&(W=Ce.range.startCol-1),S>0?X=Ce.range.endRow+1:S<0&&(X=Ce.range.startRow-1),(W>=r.colCount||X>=r.rowCount)&&Zt(W,X)),W=Math.max(0,Math.min(r.colCount-1,W)),X=Math.max(0,Math.min(r.rowCount-1,X)),me(W,X)}function An(h,S){ml(S,h)}function Ut(h){const S=Rt.value;if(h<0||h>=S[r.colCount])return-1;let B=0,W=r.colCount-1;for(;B<W;){const X=B+W+1>>1;S[X]<=h?B=X:W=X-1}return B}function Fl(h){const S=E.value;if(h<0||h>=S[r.rowCount])return-1;let B=0,W=r.rowCount-1;for(;B<W;){const X=B+W+1>>1;S[X]<=h?B=X:W=X-1}return B}function bt(h,S){var X,Ce;const B=Math.max(0,Math.min(Math.floor(h),r.rowCount)),W=Math.max(0,Math.min(Math.floor(S),r.colCount));L.rows=B,L.cols=W,(X=De.scheduleRender)==null||X.call(De),(Ce=De.emitModelData)==null||Ce.call(De)}function Ct(){var h,S;L.rows=0,L.cols=0,(h=De.scheduleRender)==null||h.call(De),(S=De.emitModelData)==null||S.call(De)}function Kt(){return{rows:L.rows,cols:L.cols}}function dn(){let h=0,S=0;if(L.cols>0){const B=oe.value,W=Math.min(L.cols,B.length);for(let X=0;X<W;X++)h+=B[X]}if(L.rows>0)for(let B=0;B<L.rows;B++)S+=ae(B);return{frozenRowsHeight:S,frozenColumnsWidth:h}}function Qn(){const{frozenColumnsWidth:h,frozenRowsHeight:S}=dn(),B=52+h,W=24+S,X=Math.max(0,Ft.w-52-11-h),Ce=Math.max(0,Ft.h-24-11-S),xe=[];return S>0&&h>0&&xe.push({kind:"corner",x:52,y:24,width:h,height:S,scrollLeft:0,scrollTop:0}),S>0&&xe.push({kind:"rows",x:B,y:24,width:X,height:S,scrollLeft:g.value,scrollTop:0}),h>0&&xe.push({kind:"columns",x:52,y:W,width:h,height:Ce,scrollLeft:0,scrollTop:A.value}),xe.push({kind:"body",x:B,y:W,width:X,height:Ce,scrollLeft:g.value,scrollTop:A.value}),xe}function eo(h,S){const B=Rt.value,W=E.value,X=oe.value,Ce=B[S]??0,xe=W[h]??0,Ie=p(S,h),Ve=Ie?(B[Ie.range.endCol+1]??Ce)-Ce:X[S]??0,Le=Ie?(W[Ie.range.endRow+1]??xe)-xe:ae(h),Ue=S<L.cols,mt=h<L.rows,je=Ue?52+Ce:52+Ce-g.value,pt=mt?24+xe:24+xe-A.value;return{x:je,y:pt,width:Ve,height:Le}}function rl(h,S){const{frozenColumnsWidth:B,frozenRowsHeight:W}=dn();if(h<52||S<24)return null;const X=B>0&&h<52+B,Ce=W>0&&S<24+W,xe=X?h-52:h-52+g.value,Ie=Ce?S-24:S-24+A.value,Ve=Ut(xe),Le=Fl(Ie);return Ve<0||Le<0?null:{col:Ve,row:Le}}function kl(h,S){return h<L.rows||S<L.cols}function ml(h,S){if(kl(h,S))return;const{frozenColumnsWidth:B,frozenRowsHeight:W}=dn(),X=Math.max(0,Ft.w-52-11-B),Ce=Math.max(0,Ft.h-24-11-W),xe=Rt.value,Ie=E.value,Ve=(xe[S]??0)-B,Le=(Ie[h]??0)-W,Ue=p(S,h),mt=Ue?(xe[Ue.range.endCol+1]??0)-(xe[S]??0):oe.value[S]??0,je=Ue?(Ie[Ue.range.endRow+1]??0)-(Ie[h]??0):ae(h);let pt=g.value,Ot=A.value;Ve<pt?pt=Ve:Ve+mt>pt+X&&(pt=Ve+mt-X),Le<Ot?Ot=Le:Le+je>Ot+Ce&&(Ot=Le+je-Ce),pt=Math.max(0,pt),Ot=Math.max(0,Ot),Yt(pt,Ot)}function Zt(h,S){var Ce;const B=h+1,W=S+1;let X=!1;if(B>=r.colCount){const xe=Math.max(r.colCount+f,B),Ie=xe-r.colCount,Ve=oe.value;for(let Le=0;Le<Ie;Le++)Ve.push(100);r.colCount=xe,X=!0}if(W>=r.rowCount){const xe=Math.max(r.rowCount+m,W),Ie=xe-r.rowCount,Ve=pe.value;for(let Le=0;Le<Ie;Le++)Ve.push(void 0);r.rowCount=xe,X=!0}X&&((Ce=De.scheduleRender)==null||Ce.call(De))}function jl(){return r.colCount!==a||r.rowCount!==i}function pl(h,S,B){var Ce,xe,Ie;if(!wo(h,S,ve))return;(Ce=De.saveUndo)==null||Ce.call(De),Zt(S.endCol,S.endRow);const W=js(h,S,{cells:y},B,n.value,r.colCount,r.rowCount,ht);_n();for(const[Ve,Le]of Object.entries(W.cells)){const Ue=Le.value;Ue===""&&(Le.styleId===void 0||Le.styleId===0)?(Xe.clear(Ve),ye(Ve)):(y[Ve]={value:Ue,...Le.styleId!==void 0&&Le.styleId>0?{styleId:Le.styleId}:{}},Ue.startsWith("=")?Xe.set(Ve,jn(Ue.slice(1),r.colCount,r.rowCount)):Xe.clear(Ve)),Xe.markDirty(Ve)}const X={startCol:Math.min(h.startCol,S.startCol),startRow:Math.min(h.startRow,S.startRow),endCol:Math.max(h.endCol,S.endCol),endRow:Math.max(h.endRow,S.endRow)};Se(X.startCol,X.startRow,X.endCol,X.endRow),(xe=De.scheduleRender)==null||xe.call(De),(Ie=De.emitModelData)==null||Ie.call(De)}function fn(h,S){var Ce;let B=!1;const W=Math.max(1,Math.floor(h)),X=Math.max(1,Math.floor(S));if(W!==r.colCount){if(W>r.colCount){const xe=oe.value;for(let Ie=r.colCount;Ie<W;Ie++)xe.push(100)}else oe.value=oe.value.slice(0,W);r.colCount=W,B=!0}if(X!==r.rowCount){if(X>r.rowCount){const xe=pe.value;for(let Ie=r.rowCount;Ie<X;Ie++)xe.push(void 0)}else pe.value=pe.value.slice(0,X);r.rowCount=X,B=!0}B&&((Ce=De.scheduleRender)==null||Ce.call(De))}const De={props:o,locale:n,get colCount(){return r.colCount},get rowCount(){return r.rowCount},ensureCapacity:Zt,hasDynamicDims:jl,setDims:fn,cells:y,styles:k,borders:d,merges:ve,formulaDeps:Xe,selection:Je,activeCell:Ze,editingCell:lt,editValue:et,colWidths:oe,rowHeights:pe,scrollX:g,scrollY:A,freeze:L,setFreeze:bt,clearFreeze:Ct,getFreeze:Kt,getFrozenMetrics:dn,filter:$,getFilter:sn,setFilter:I,enableFilter:N,clearFilter:O,clearFilterColumn:de,setFilterColumn:ge,getColumnCandidates:Me,getDataRange:ft,getCurrentRegion:Ee,detectFilterRange:fe,toggleAutoFilter:Z,isColumnInFilterRange:ze,getFilterRange:$e,isFilterEnabled:le,isFilterColumnActive:Ke,isRowHidden:Xt,getFilteredOutRows:fl,getVisibleRowCount:Kl,getVisibleRowAt:Gl,getVisibleRowIndex:Yl,getViewportRegions:Qn,cellToScreenRect:eo,screenToCell:rl,isCellFrozen:kl,scrollCellIntoView:ml,BASE_CELL_VPAD:c,fontMetricsCache:ie,fontMetricsCanvas:re,measureFontMetrics:he,_getFontMetricsForCell:at,getWrappedLines:Mt,cellFontSize:St,colPositions:Rt,getRowHeight:Cl,_isAutoRow:Dl,rowPositions:E,totalWidth:U,totalHeight:J,selectCell:me,selectRange:Se,selectAll:We,isSelected:st,isCellSelected:Bt,selectionMode:gt,cellKey:ue,delCell:ye,findMerge:zt,_isMergeAnchor:jt,_mergedSpan:Vt,expandSelectionForMerges:Ht,getCellRaw:_t,getCellValue:Pt,setCellValue:Xl,clearCellsInRange:un,startEdit:Nl,commitEdit:kn,cancelEdit:En,moveActive:In,ensureVisible:An,hitCol:Ut,hitRow:Fl,registerStyle:te,resolveStyle:Y,rebuildStyleIndex:K,syncStyles:C,registerBorder:j,resolveBorder:q,rebuildBorderIndex:se,syncBorders:Fe,getCellBorderSide:Qe,getMergeOwner:Ge,isSameMergeInternal:be,viewSize:Ft,findHighlight:(h,S)=>null,autoFillState:ee,applyAutoFill:pl};return vl=()=>{var h;return(h=De.saveUndo)==null?void 0:h.call(De)},Yt=(h,S)=>{var B;return(B=De.clampScroll)==null?void 0:B.call(De,h,S)},De}function nu(e,l){const o=t.ref([]),n=t.ref([]);function a(E){return Js(E)}function i(){return l.saveSheet(),{sheets:l.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})),styles:[...e.styles],activeSheetIndex:l.activeSheetIndex.value}}function r(E){const U=l.sheets.value;l.sheets.value=E.sheets.map((J,ue)=>{var me;const ye=((me=U[ue])==null?void 0:me.freeze)??{rows:0,cols:0};return{...J,cells:a(J.cells),styles:[...J.styles],borders:J.borders?[...J.borders]:[{}],freeze:{rows:ye.rows,cols:ye.cols}}}),l.loadSheet(Math.max(0,Math.min(E.activeSheetIndex,l.sheets.value.length-1))),e.formulaDeps.rebuild(e.cells,e.colCount,e.rowCount)}function f(){const E=i(),U=o.value[o.value.length-1];U&&JSON.stringify(U)===JSON.stringify(E)||(o.value.push(E),n.value=[],o.value.length>50&&o.value.shift())}e.saveUndo=f;function m(){var E;o.value.length&&(n.value.push(i()),r(o.value.pop()),(E=e.scheduleRender)==null||E.call(e),t.nextTick(()=>{var U;return(U=e.emitModelData)==null?void 0:U.call(e)}))}function y(){var E;n.value.length&&(o.value.push(i()),r(n.value.pop()),(E=e.scheduleRender)==null||E.call(e),t.nextTick(()=>{var U;return(U=e.emitModelData)==null?void 0:U.call(e)}))}const k=t.computed(()=>o.value.length>0),d=t.computed(()=>n.value.length>0),w=t.computed(()=>!!e.selection.value),v=t.ref(null);function R(){var J;const E=e.selection.value;if(!E)return;const U={};for(let ue=E.startCol;ue<=E.endCol;ue++)for(let ye=E.startRow;ye<=E.endRow;ye++)U[`${ue-E.startCol},${ye-E.startRow}`]=((J=e.cells[e.cellKey(ue,ye)])==null?void 0:J.styleId)??0;v.value={styles:U}}function G(){var J,ue,ye;const E=v.value,U=e.selection.value;if(!(!E||!U)){f();for(let me=U.startCol;me<=U.endCol;me++)for(let Se=U.startRow;Se<=U.endRow;Se++){const We=e.findMerge(me,Se);if(We&&(me!==We.range.startCol||Se!==We.range.startRow))continue;const st=E.styles[`${me-U.startCol},${Se-U.startRow}`]??0,Bt=e.cellKey(me,Se),zt=((J=e.cells[Bt])==null?void 0:J.value)??"";if(zt===""&&st===0)e.delCell(Bt);else{const jt={value:zt};st>0&&(jt.styleId=st),e.cells[Bt]=jt}}v.value=null,(ue=e.scheduleRender)==null||ue.call(e),(ye=e.emitModelData)==null||ye.call(e)}}function te(){var U,J,ue;const E=e.selection.value;if(E){f();for(let ye=E.startCol;ye<=E.endCol;ye++)for(let me=E.startRow;me<=E.endRow;me++){const Se=e.findMerge(ye,me);if(Se&&(ye!==Se.range.startCol||me!==Se.range.startRow))continue;const We=e.cellKey(ye,me),st=((U=e.cells[We])==null?void 0:U.value)??"";st===""?e.delCell(We):e.cells[We]={value:st}}(J=e.scheduleRender)==null||J.call(e),(ue=e.emitModelData)==null||ue.call(e)}}const Y=t.computed(()=>br.map(E=>({...E,label:E.value===""?D(e.locale.value,"fontDefault"):E.label}))),K=t.computed(()=>Cr.map(E=>({...E,label:String(E.value)}))),C="\0",j=t.computed(()=>{const E=e.selection.value;if(!E)return"";let U,J=!1;for(let ue=E.startCol;ue<=E.endCol&&!J;ue++)for(let ye=E.startRow;ye<=E.endRow&&!J;ye++){const me=e.findMerge(ue,ye);if(me&&(ue!==me.range.startCol||ye!==me.range.startRow))continue;const Se=e.resolveStyle(e.cells[e.cellKey(ue,ye)]),We=typeof(Se==null?void 0:Se.fontFamily)=="string"?Se.fontFamily:"";U===void 0?U=We:We!==U&&(J=!0)}return J?C:U??""}),q=t.computed(()=>{const E=e.selection.value;if(!E)return _l;let U,J=!1;for(let ue=E.startCol;ue<=E.endCol&&!J;ue++)for(let ye=E.startRow;ye<=E.endRow&&!J;ye++){const me=e.findMerge(ue,ye);if(me&&(ue!==me.range.startCol||ye!==me.range.startRow))continue;const Se=e.cellFontSize(ue,ye);U===void 0?U=Se:Se!==U&&(J=!0)}return J?0:U??_l});function se(E,U){var ue,ye,me;const J=e.selection.value;if(J){f();for(let Se=J.startCol;Se<=J.endCol;Se++)for(let We=J.startRow;We<=J.endRow;We++){const st=e.findMerge(Se,We);if(st&&(Se!==st.range.startCol||We!==st.range.startRow))continue;const Bt=e.cellKey(Se,We),zt=((ue=e.cells[Bt])==null?void 0:ue.value)??"";let Vt={...e.resolveStyle(e.cells[Bt])??{}};if(U===""||U===null||U===void 0||U===0){const{[E]:_t,...Pt}=Vt;Vt=Pt}else Vt[E]=U;const Ht=Object.keys(Vt).length?e.registerStyle(Vt):0;if(zt===""&&Ht===0)e.delCell(Bt);else{const _t={value:zt};Ht>0&&(_t.styleId=Ht),e.cells[Bt]=_t}}(ye=e.scheduleRender)==null||ye.call(e),(me=e.emitModelData)==null||me.call(e)}}function Fe(E){se("fontFamily",E===""?"":E)}const Qe=t.ref(!1),Ge=t.ref(!1),be=t.ref(!1),ve=t.ref(!1),Xe=t.ref(!1);function Je(E){se("fontSize",E),Qe.value=!1}const gt=t.computed(()=>Mr.map(E=>({label:D(e.locale.value,E.labelKey),value:E.value,icon:E.icon}))),Ze=t.computed(()=>xr.map(E=>({label:D(e.locale.value,E.labelKey),value:E.value,icon:E.icon}))),lt=t.computed(()=>{const E=e.selection.value;if(!E)return"left";const U=e.resolveStyle(e.cells[e.cellKey(E.startCol,E.startRow)]),J=typeof(U==null?void 0:U.textAlign)=="string"?U.textAlign:"";return J==="center"||J==="right"?J:"left"}),et=t.computed(()=>{const E=e.selection.value;if(!E)return"top";const U=e.resolveStyle(e.cells[e.cellKey(E.startCol,E.startRow)]),J=typeof(U==null?void 0:U.verticalAlign)=="string"?U.verticalAlign:"";return J==="middle"||J==="bottom"?J:"top"}),oe=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 pe(E){se("textAlign",E)}function g(E){se("verticalAlign",E)}function A(){if(!e.selection.value)return;const U=oe.value;se("wrap",U?void 0:"wrap")}const L=t.ref(""),$=Qe;t.watch(q,E=>{L.value=E===0?"":String(E)},{immediate:!0});function ee(E){const U=E.replace(/[^\d]/g,"");L.value=U;const J=parseInt(U,10);!isNaN(J)&&J>=5&&J<=72&&J!==q.value&&se("fontSize",J)}function ie(){const E=L.value.trim();if(!E){L.value=q.value===0?"":String(q.value);return}let U=parseInt(E,10);isNaN(U)?U=q.value===0?_l:q.value:U=Math.max(5,Math.min(72,U)),L.value=String(U),U!==q.value&&se("fontSize",U)}function re(E){E.key==="Enter"&&E.target.blur()}function he(E){E&&E.preventDefault(),$.value=!$.value,$.value&&(be&&(be.value=!1),Ge&&(Ge.value=!1),ve.value=!1,Xe.value=!1)}function ce(){const E=q.value===0?_l:q.value,U=Math.min(72,E+1);se("fontSize",U),L.value=String(U),$.value=!1}function V(){const E=q.value===0?_l:q.value,U=Math.max(5,E-1);se("fontSize",U),L.value=String(U),$.value=!1}function c(E){const U=e.selection.value;if(!U)return!1;let J,ue=!1;for(let ye=U.startCol;ye<=U.endCol&&!ue;ye++)for(let me=U.startRow;me<=U.endRow&&!ue;me++){const Se=e.findMerge(ye,me);if(Se&&(ye!==Se.range.startCol||me!==Se.range.startRow))continue;const We=e.resolveStyle(e.cells[e.cellKey(ye,me)]),st=!!(We!=null&&We[E]);J===void 0?J=st:st!==J&&(ue=!0)}return!ue&&J===!0}const u=t.computed(()=>c("fontWeight")),p=t.computed(()=>c("fontStyle")),H=t.computed(()=>c("underline")),ct=t.computed(()=>c("strikethrough"));function ae(){se("fontWeight",u.value?"":"bold")}function Pe(){se("fontStyle",p.value?"":"italic")}function at(){se("underline",H.value?"":"underline")}function Mt(){se("strikethrough",ct.value?"":"line-through")}const St=t.ref(""),Rt=t.ref(""),Ft=ve,Yt=Xe;function nl(){Ft.value=!Ft.value,Yt.value=!1,Ge&&(Ge.value=!1),be&&(be.value=!1)}function Cl(){Yt.value=!Yt.value,Ft.value=!1,Ge&&(Ge.value=!1),be&&(be.value=!1)}function Dl(E){Ge&&(Ge.value=E),E&&(Ft.value=!1,Yt.value=!1,be&&(be.value=!1))}function cl(E){St.value=E,se("color",E===""?"":E)}function wl(E){Rt.value=E,se("backgroundColor",E===""?"":E)}function ol(){se("color",St.value===""?"":St.value)}function fl(){se("backgroundColor",Rt.value===""?"":Rt.value)}const Xt=t.computed(()=>{const E=e.selection.value;if(!E)return"";let U,J=!1;for(let ue=E.startCol;ue<=E.endCol&&!J;ue++)for(let ye=E.startRow;ye<=E.endRow&&!J;ye++){const me=e.findMerge(ue,ye);if(me&&(ue!==me.range.startCol||ye!==me.range.startRow))continue;const Se=e.resolveStyle(e.cells[e.cellKey(ue,ye)]),We=typeof(Se==null?void 0:Se.color)=="string"?Se.color:"";U===void 0?U=We:We!==U&&(J=!0)}return J?"":U??""}),Kl=t.computed(()=>{const E=e.selection.value;if(!E)return"";let U,J=!1;for(let ue=E.startCol;ue<=E.endCol&&!J;ue++)for(let ye=E.startRow;ye<=E.endRow&&!J;ye++){const me=e.findMerge(ue,ye);if(me&&(ue!==me.range.startCol||ye!==me.range.startRow))continue;const Se=e.resolveStyle(e.cells[e.cellKey(ue,ye)]),We=typeof(Se==null?void 0:Se.backgroundColor)=="string"?Se.backgroundColor:"";U===void 0?U=We:We!==U&&(J=!0)}return J?"":U??""}),Gl=t.computed(()=>Vo(e.locale.value)),Yl=t.ref(!1),sn=t.computed(()=>{const E=e.selection.value;if(!E)return Wl;let U,J=!1;for(let ue=E.startCol;ue<=E.endCol&&!J;ue++)for(let ye=E.startRow;ye<=E.endRow&&!J;ye++){const me=e.findMerge(ue,ye);if(me&&(ue!==me.range.startCol||ye!==me.range.startRow))continue;const Se=e.resolveStyle(e.cells[e.cellKey(ue,ye)]),We=(Se==null?void 0:Se.numberFormatCategory)==="custom"?$l:typeof(Se==null?void 0:Se.numberFormat)=="string"?Se.numberFormat:"";U===void 0?U=We:We!==U&&(J=!0)}return J?Bl:U??Wl});function I(E){if((E==null?void 0:E.numberFormatCategory)==="custom")return $l;const U=typeof(E==null?void 0:E.numberFormat)=="string"?E.numberFormat:"";return Ao(U,e.locale.value)}const N=t.computed(()=>{const E=sn.value;if(E!==Bl)return E===$l?$l:Ao(E,e.locale.value);const U=e.selection.value;if(!U)return Wl;let J,ue=!1;for(let ye=U.startCol;ye<=U.endCol&&!ue;ye++)for(let me=U.startRow;me<=U.endRow&&!ue;me++){const Se=e.findMerge(ye,me);if(Se&&(ye!==Se.range.startCol||me!==Se.range.startRow))continue;const We=I(e.resolveStyle(e.cells[e.cellKey(ye,me)]));J===void 0?J=We:We!==J&&(ue=!0)}return ue?Bl:J??Wl});function O(E){se("numberFormat",E),de()}function de(){const E=e.selection.value;if(E)for(let U=E.startCol;U<=E.endCol;U++)for(let J=E.startRow;J<=E.endRow;J++){const ue=e.findMerge(U,J);if(ue&&(U!==ue.range.startCol||J!==ue.range.startRow))continue;const ye=e.cellKey(U,J),me=e.cells[ye],Se=e.resolveStyle(me);if((Se==null?void 0:Se.numberFormatCategory)!=="custom")continue;const{numberFormatCategory:We,...st}=Se,Bt=Object.keys(st).length?e.registerStyle(st):0,zt=(me==null?void 0:me.value)??"";if(zt===""&&Bt===0)e.delCell(ye);else{const jt={value:zt};Bt>0&&(jt.styleId=Bt),e.cells[ye]=jt}}}function ge(E){if(E===$l){Yl.value=!0;return}O(E)}function Me(){Yl.value=!0}function Ee(){const E=e.selection.value;if(!E)return[];const U=[];for(let J=E.startCol;J<=E.endCol;J++)for(let ue=E.startRow;ue<=E.endRow;ue++){const ye=e.findMerge(J,ue);if(ye&&(J!==ye.range.startCol||ue!==ye.range.startRow))continue;const me=e.cellKey(J,ue),Se=e.cells[me],We=e.resolveStyle(Se),st=typeof(We==null?void 0:We.numberFormat)=="string"?We.numberFormat:Wl,Bt=(Se==null?void 0:Se.value)??"",zt=Bt.startsWith("=")?Yo(J,ue,e.cells,e.colCount,e.rowCount):Bt;Io(st,zt)&&U.push({key:me,nf:st,decimals:Gr(st,zt)})}return U}const fe=t.computed(()=>Ee().some(E=>E.decimals<co)),Z=t.computed(()=>Ee().some(E=>E.decimals>so));function ze(E,U,J){var We;const ue=((We=e.cells[E])==null?void 0:We.value)??"",me={...e.resolveStyle(e.cells[E])??{}};U===""?(delete me.numberFormat,delete me.numberFormatCategory):(me.numberFormat=U,J==="custom"&&(me.numberFormatCategory="custom"));const Se=Object.keys(me).length?e.registerStyle(me):0;if(ue===""&&Se===0)e.delCell(E);else{const st={value:ue};Se>0&&(st.styleId=Se),e.cells[E]=st}}function $e(E){var ue,ye;const U=Ee(),J=[];for(const me of U){const Se=me.decimals+E;if(Se<so||Se>co)continue;const We=Xr(me.nf,Se);We==null||We===me.nf||J.push({key:me.key,code:We,category:dl(me.nf)?"custom":void 0})}if(J.length){f();for(const me of J)ze(me.key,me.code,me.category);(ue=e.scheduleRender)==null||ue.call(e),(ye=e.emitModelData)==null||ye.call(e)}}function le(){$e(1)}function Ke(){$e(-1)}return{undoStack:o,redoStack:n,cloneCells:a,takeSnap:i,restoreSnap:r,saveUndo:f,undo:m,redo:y,canUndo:k,canRedo:d,hasSelection:w,paintFmt:v,onPaintFormat:R,applyPaintFormat:G,clearFormat:te,fontFamilyOptions:Y,fontSizeOptions:K,FONT_FAMILY_MIXED:C,selFontFamily:j,selFontSize:q,applyStyleToSelection:se,onFontFamilyChange:Fe,onFontSizeChange:Je,hAlignOptions:gt,vAlignOptions:Ze,selHAlign:lt,selVAlign:et,selWrap:oe,onHAlignChange:pe,onVAlignChange:g,onWrapToggle:A,fontSizeInput:L,fontSizeMenuOpen:$,onFontSizeInput:ee,onFontSizeBlur:ie,onFontSizeKeydown:re,toggleFontSizeMenu:he,onFontSizeStepUp:ce,onFontSizeStepDown:V,selFontWeight:u,selFontStyle:p,selUnderline:H,selStrikethrough:ct,toggleFontWeight:ae,toggleFontStyle:Pe,toggleUnderline:at,toggleStrikethrough:Mt,cachedTextColor:St,cachedFillColor:Rt,textColorMenuOpen:Ft,fillColorMenuOpen:Yt,_toggleTextColorMenu:nl,_toggleFillColorMenu:Cl,onBorderMenuToggle:Dl,onTextColorChange:cl,onFillColorChange:wl,applyCachedTextColor:ol,applyCachedFillColor:fl,selTextColor:Xt,selFillColor:Kl,nfOptions:Gl,selNumberFormat:sn,selNumberFormatDisplay:N,NF_NUMBER_FORMAT_MIXED:Bl,nfDialogOpen:Yl,onNumberFormatChange:ge,openNumberFormatDialog:Me,applyNumberFormatCode:O,canIncreaseDecimals:fe,canDecreaseDecimals:Z,onIncreaseDecimals:le,onDecreaseDecimals:Ke}}function ou(e,l){l.borderMenuOpen&&(e.borderMenuOpen=l.borderMenuOpen),l.mergeMenuOpen&&(e.mergeMenuOpen=l.mergeMenuOpen),(()=>{const n=e.borderMenuOpen,a=e.mergeMenuOpen;e.onBorderMenuToggle=i=>{n&&(n.value=i),i&&(e.textColorMenuOpen.value=!1,e.fillColorMenuOpen.value=!1,a&&(a.value=!1))},e.toggleFontSizeMenu=i=>{i&&i.preventDefault(),e.fontSizeMenuOpen.value=!e.fontSizeMenuOpen.value,e.fontSizeMenuOpen.value&&(a&&(a.value=!1),n&&(n.value=!1),e.textColorMenuOpen.value=!1,e.fillColorMenuOpen.value=!1)},e._toggleTextColorMenu=()=>{e.textColorMenuOpen.value=!e.textColorMenuOpen.value,e.fillColorMenuOpen.value=!1,n&&(n.value=!1),a&&(a.value=!1)},e._toggleFillColorMenu=()=>{e.fillColorMenuOpen.value=!e.fillColorMenuOpen.value,e.textColorMenuOpen.value=!1,n&&(n.value=!1),a&&(a.value=!1)}})()}function ru(e,l){const o=t.ref("none"),n=t.ref(!1),a="#444";function i(g,A,L,$){if(g<0||A<0||g>=e.colCount||A>=e.rowCount)return;const ee=e.findMerge(g,A),ie=ee?ee.anchor:e.cellKey(g,A);if(!e.cells[ie]){if(!$)return;e.cells[ie]={value:""}}tu(e.cells[ie],L,$,e.styles,{get:he=>e.resolveBorder(he),getId:he=>e.registerBorder(he)},e.registerStyle)}function r(g,A,L){var ce;const $=e.findMerge(g,A),ee=$?$.anchor:e.cellKey(g,A),ie=((ce=e.cells[ee])==null?void 0:ce.value)??"",re=e.resolveStyle(e.cells[ee])?{...e.resolveStyle(e.cells[ee])}:{},he=e.registerBorder(L);if(he>0?re.borderId=he:delete re.borderId,delete re.borderTopWidth,delete re.borderBottomWidth,delete re.borderLeftWidth,delete re.borderRightWidth,delete re.borderColor,ie===""&&!Object.keys(re).length)e.delCell(ee);else{const V=e.registerStyle(re);e.cells[ee]={value:ie,styleId:V||void 0}}}function f(g){var ce,V;o.value=g;const A=e.selection.value;if(!A)return;l.saveUndo();const{startCol:L,startRow:$,endCol:ee,endRow:ie}=A,re={width:1,color:a},he={width:2,color:a};if(g==="none")for(let c=L;c<=ee;c++)for(let u=$;u<=ie;u++){const p=e.findMerge(c,u);p&&(c!==p.range.startCol||u!==p.range.startRow)||r(c,u,{})}else if(g==="all")for(let c=L;c<=ee;c++)for(let u=$;u<=ie;u++){const p=e.findMerge(c,u);p&&(c!==p.range.startCol||u!==p.range.startRow)||r(c,u,{top:re,right:re,bottom:re,left:re})}else if(g==="outer"||g==="thickOuter"){const c=g==="thickOuter"?he:re;for(let u=L;u<=ee;u++)i(u,$,"top",c);for(let u=L;u<=ee;u++)i(u,ie,"bottom",c);for(let u=$;u<=ie;u++)i(L,u,"left",c);for(let u=$;u<=ie;u++)i(ee,u,"right",c)}else{const u={top:{side:"top",edgeCheck:(p,H)=>H===$},bottom:{side:"bottom",edgeCheck:(p,H)=>H===ie},left:{side:"left",edgeCheck:(p,H)=>p===L},right:{side:"right",edgeCheck:(p,H)=>p===ee}}[g];if(u)for(let p=L;p<=ee;p++)for(let H=$;H<=ie;H++)u.edgeCheck(p,H)&&i(p,H,u.side,re)}(ce=e.scheduleRender)==null||ce.call(e),(V=e.emitModelData)==null||V.call(e)}function m(){f(o.value)}function y(g,A,L){const $=L.toLowerCase(),ee=e.findMerge(g,A);if(ee){if($==="top"&&A!==ee.range.startRow||$==="bottom"&&A!==ee.range.endRow||$==="left"&&g!==ee.range.startCol||$==="right"&&g!==ee.range.endCol)return 0;const re=e.getCellBorderSide(e.cells[ee.anchor],$);return(re==null?void 0:re.width)??0}const ie=e.getCellBorderSide(e.cells[e.cellKey(g,A)],$);return(ie==null?void 0:ie.width)??0}const k=t.ref(!1);function d(g){k.value=g,g&&(l.textColorMenuOpen.value=!1,l.fillColorMenuOpen.value=!1,n.value=!1,l.fontSizeMenuOpen.value=!1)}function w(g,A,L,$){const ee=[];for(const ie in e.merges){const re=e.merges[ie];re&&re.startCol<=L&&re.endCol>=g&&re.startRow<=$&&re.endRow>=A&&ee.push(ie)}for(const ie of ee)Reflect.deleteProperty(e.merges,ie)}function v(){var ie,re,he;const g=e.selection.value;if(!g||g.startCol===g.endCol&&g.startRow===g.endRow)return;l.saveUndo(),w(g.startCol,g.startRow,g.endCol,g.endRow);const A=e.cellKey(g.startCol,g.startRow),L=((ie=e.cells[A])==null?void 0:ie.value)??"";for(let ce=g.startCol;ce<=g.endCol;ce++)for(let V=g.startRow;V<=g.endRow;V++)ce===g.startCol&&V===g.startRow||e.clearCellsInRange(ce,ce,V,V);const $=e.resolveStyle(e.cells[A])?{...e.resolveStyle(e.cells[A])}:{};$.textAlign="center";const ee=e.registerStyle($);e.cells[A]={value:L,styleId:ee||void 0},e.merges[A]={startCol:g.startCol,startRow:g.startRow,endCol:g.endCol,endRow:g.endRow},e.selectCell(g.startCol,g.startRow),(re=e.scheduleRender)==null||re.call(e),(he=e.emitModelData)==null||he.call(e)}function R(){var A,L,$;const g=e.selection.value;if(!(!g||g.startCol===g.endCol)){l.saveUndo();for(let ee=g.startRow;ee<=g.endRow;ee++){w(g.startCol,ee,g.endCol,ee);const ie=e.cellKey(g.startCol,ee);(A=e.cells[ie])==null||A.value;for(let re=g.startCol+1;re<=g.endCol;re++)e.clearCellsInRange(re,re,ee,ee);e.merges[ie]={startCol:g.startCol,startRow:ee,endCol:g.endCol,endRow:ee}}e.selectRange(g.startCol,g.startRow,g.endCol,g.endRow),(L=e.scheduleRender)==null||L.call(e),($=e.emitModelData)==null||$.call(e)}}function G(){var L,$,ee;const g=e.selection.value;if(!g||g.startCol===g.endCol&&g.startRow===g.endRow)return;l.saveUndo(),w(g.startCol,g.startRow,g.endCol,g.endRow);const A=e.cellKey(g.startCol,g.startRow);(L=e.cells[A])==null||L.value;for(let ie=g.startCol;ie<=g.endCol;ie++)for(let re=g.startRow;re<=g.endRow;re++)ie===g.startCol&&re===g.startRow||e.clearCellsInRange(ie,ie,re,re);e.merges[A]={startCol:g.startCol,startRow:g.startRow,endCol:g.endCol,endRow:g.endRow},e.selectCell(g.startCol,g.startRow),($=e.scheduleRender)==null||$.call(e),(ee=e.emitModelData)==null||ee.call(e)}function te(){var A,L;const g=e.selection.value;g&&(l.saveUndo(),w(g.startCol,g.startRow,g.endCol,g.endRow),(A=e.scheduleRender)==null||A.call(e),(L=e.emitModelData)==null||L.call(e))}function Y(){const g=e.selection.value;if(!g)return;const A=e.findMerge(g.startCol,g.startRow);A&&g.startCol===A.range.startCol&&g.startRow===A.range.startRow&&g.endCol===A.range.endCol&&g.endRow===A.range.endRow?te():v()}function K(g){switch(g){case"mergeCenter":v();break;case"mergeAcross":R();break;case"mergeCells":G();break;case"unmergeCells":te();break}}let C=null,j=[];function q(g,A,L,$){j=[];for(let ee=L;ee<=$;ee++){const ie=[];for(let re=g;re<=A;re++){const he=e.cells[e.cellKey(re,ee)];ie.push((he==null?void 0:he.styleId)??0)}j.push(ie)}}function se(g,A,L,$){const ee=e.cellKey(g,A);if(_n(),L===""||L==null){e.formulaDeps.clear(ee),$&&$>0?e.cells[ee]={value:"",styleId:$}:e.delCell(ee),e.formulaDeps.markDirty(ee);return}e.cells[ee]={value:L,styleId:$&&$>0?$:void 0},L.startsWith("=")?e.formulaDeps.set(ee,jn(L.slice(1),e.colCount,e.rowCount)):e.formulaDeps.clear(ee),e.formulaDeps.markDirty(ee)}function Fe(){const g=e.selection.value;if(!g)return;C={...g},q(g.startCol,g.endCol,g.startRow,g.endRow);const A=[];for(let L=g.startRow;L<=g.endRow;L++){const $=[];for(let ee=g.startCol;ee<=g.endCol;ee++)$.push(e.getCellRaw(ee,L));A.push($.join(" "))}po(A.join(`
|
|
4
|
-
`))}function
|
|
5
|
-
`))}else if(
|
|
6
|
-
`))}}}async function Ge(){var V;let g;try{g=await navigator.clipboard.readText()}catch{return}if(!g&&g!=="")return;const A=g.split(/\r?\n/),L=e.activeCell.value,$=C,ee=$&&j.length>0,ie=A.map(c=>c.split(" ").length),re=ie.length?Math.max(...ie):0,he=L.col+re-1,ce=L.row+A.length-1;he>=0&&ce>=0&&e.ensureCapacity(he,ce);for(let c=0;c<A.length;c++){const u=A[c].split(" ");for(let p=0;p<u.length;p++){const H=L.col+p,ct=L.row+c;let ae=u[p];if(ae.startsWith("=")&&$&&(ae=Xo(ae,H-($.startCol+p),ct-($.startRow+c),e.colCount,e.rowCount,ht)),ee&&c<j.length&&p<(((V=j[c])==null?void 0:V.length)??0)){const Pe=j[c][p]??null;se(H,ct,ae,Pe)}else e.setCellValue(H,ct,ae)}}}function be(){var g;if(l.saveUndo(),Fe(),e.selection.value){const A=e.selection.value;e.clearCellsInRange(A.startCol,A.endCol,A.startRow,A.endRow),(g=e.scheduleRender)==null||g.call(e)}}function ve(){var g;if(e.selection.value){const A=e.selection.value;e.clearCellsInRange(A.startCol,A.endCol,A.startRow,A.endRow),(g=e.scheduleRender)==null||g.call(e)}}function Xe(){var ie,re;const g=e.selection.value;if(!g)return;l.saveUndo();const A=g.startCol,L=g.startRow,$=g.endCol,ee=g.endRow;if(L===ee)if($+1<e.colCount){const he=`${ht(A)}${L+1}:${ht($)}${L+1}`;e.setCellValue($+1,L,`=SUM(${he})`)}else{const he=`${ht(A)}${L+1}:${ht($-1)}${L+1}`;e.setCellValue($,L,`=SUM(${he})`)}else for(let he=A;he<=$;he++)if(ee+1<e.rowCount){const ce=`${ht(he)}${L+1}:${ht(he)}${ee+1}`;e.setCellValue(he,ee+1,`=SUM(${ce})`)}else{const ce=`${ht(he)}${L+1}:${ht(he)}${ee}`;e.setCellValue(he,ee,`=SUM(${ce})`)}(ie=e.scheduleRender)==null||ie.call(e),(re=e.emitModelData)==null||re.call(e)}function Je(){var ie,re;const g=e.selection.value;if(!g)return;l.saveUndo();const A=g.startCol,L=g.startRow,$=g.endCol,ee=g.endRow;if(L===ee)if($+1<e.colCount){const he=`${ht(A)}${L+1}:${ht($)}${L+1}`;e.setCellValue($+1,L,`=AVERAGE(${he})`)}else{const he=`${ht(A)}${L+1}:${ht($-1)}${L+1}`;e.setCellValue($,L,`=AVERAGE(${he})`)}else for(let he=A;he<=$;he++)if(ee+1<e.rowCount){const ce=`${ht(he)}${L+1}:${ht(he)}${ee+1}`;e.setCellValue(he,ee+1,`=AVERAGE(${ce})`)}else{const ce=`${ht(he)}${L+1}:${ht(he)}${ee}`;e.setCellValue(he,ee,`=AVERAGE(${ce})`)}(ie=e.scheduleRender)==null||ie.call(e),(re=e.emitModelData)==null||re.call(e)}function gt(){var ie,re;const g=e.selection.value;if(!g)return;l.saveUndo();const A=g.startCol,L=g.startRow,$=g.endCol,ee=g.endRow;if(L===ee)if($+1<e.colCount){const he=`${ht(A)}${L+1}:${ht($)}${L+1}`;e.setCellValue($+1,L,`=COUNT(${he})`)}else{const he=`${ht(A)}${L+1}:${ht($-1)}${L+1}`;e.setCellValue($,L,`=COUNT(${he})`)}else for(let he=A;he<=$;he++)if(ee+1<e.rowCount){const ce=`${ht(he)}${L+1}:${ht(he)}${ee+1}`;e.setCellValue(he,ee+1,`=COUNT(${ce})`)}else{const ce=`${ht(he)}${L+1}:${ht(he)}${ee}`;e.setCellValue(he,ee,`=COUNT(${ce})`)}(ie=e.scheduleRender)==null||ie.call(e),(re=e.emitModelData)==null||re.call(e)}const Ze=t.ref(!1);function lt(g){Ze.value=g,g&&(l.textColorMenuOpen.value=!1,l.fillColorMenuOpen.value=!1,n.value=!1,l.fontSizeMenuOpen.value=!1,k.value=!1)}function et(){Xe(),Ze.value=!1}function oe(){Je(),Ze.value=!1}function pe(){gt(),Ze.value=!1}return{cachedBorder:o,borderMenuOpen:n,BORDER_COLOR:a,onBorderChange:f,setCellBorderSide:i,applyBorderToCell:r,applyCachedBorder:m,cellBorderWidth:y,mergeMenuOpen:k,onMergeMenuToggle:d,removeOverlappingMerges:w,mergeAndCenter:v,mergeAcross:R,mergeCells:G,unmergeCells:te,onApplyMerge:Y,onMergeChange:K,copySourceRange:null,copySourceStyles:[],captureStyles:q,setCellWithStyle:se,copyToClipboard:Fe,copyRowCol:Qe,pasteFromClipboard:Ge,cutSelected:be,clearSelected:ve,sumSelected:Xe,avgSelected:Je,countSelected:gt,calcMenuOpen:Ze,onCalcMenuToggle:lt,onCalcSum:et,onCalcAvg:oe,onCalcCount:pe}}function au(e,l,o,n){const a={},i=n(l),r=n(o);return i!=null&&(a.width=`${i}px`),r!=null&&(a.height=`${r}px`),a["--sp-formula-bar-bg"]=e.formulaBarBg,a["--sp-formula-bar-border"]=e.formulaBarBorder,a["--sp-formula-bar-label-color"]=e.formulaBarLabelText,a["--sp-formula-bar-label-bg"]=e.formulaBarLabelBg,a["--sp-formula-bar-label-border"]=e.formulaBarLabelBorder,a["--sp-formula-bar-input-bg"]=e.formulaBarInputBg,a["--sp-formula-bar-input-border"]=e.formulaBarInputBorder,a["--sp-formula-bar-input-color"]=e.formulaBarInputText,a["--sp-formula-bar-input-focus-border"]=e.formulaBarInputFocusBorder,a["--sp-formula-bar-input-focus-shadow"]=e.formulaBarInputFocusShadow,a["--sp-wrapper-bg"]=e.wrapperBg,a["--sp-cell-editor-border"]=e.cellEditorBorder,a["--sp-cell-editor-color"]=e.cellEditorText,a["--sp-cell-editor-bg"]=e.cellEditorBg,a["--sp-cell-editor-shadow"]=e.cellEditorShadow,a["--sp-tab-bar-bg"]=e.tabBarBg,a["--sp-tab-bar-border"]=e.tabBarBorder,a["--sp-tab-active-bg"]=e.tabActiveBg,a["--sp-tab-active-color"]=e.tabActiveText,a["--sp-tab-active-border"]=e.tabActiveBorder,a["--sp-tab-inactive-bg"]=e.tabInactiveBg,a["--sp-tab-inactive-color"]=e.tabInactiveText,a["--sp-tab-inactive-border"]=e.tabInactiveBorder,a["--sp-tab-hover-bg"]=e.tabHoverBg,a["--sp-tab-add-btn-color"]=e.tabAddBtnColor,a["--sp-tab-add-btn-hover-bg"]=e.tabAddBtnHoverBg,a["--sp-tab-scroll-btn-color"]=e.tabScrollBtnColor,a["--sp-tab-scroll-btn-hover-bg"]=e.tabScrollBtnHoverBg,a["--sp-scroll-thumb"]=e.scrollbarThumb,a["--sp-scroll-thumb-hover"]=e.scrollbarThumbHover,a["--sp-scroll-btn-bg"]=e.scrollBtnBg,a["--sp-scroll-btn-color"]=e.scrollBtnColor,a["--sp-scroll-btn-hover-bg"]=e.scrollBtnHoverBg,a["--sp-scroll-btn-active-bg"]=e.scrollBtnActiveBg,a["--sp-scroll-track-bg"]=e.scrollTrackBg,a["--sp-toolbar-bg"]=e.toolbarBg,a["--sp-toolbar-border"]=e.toolbarBorder,a["--sp-toolbar-btn-color"]=e.toolbarBtnColor,a["--sp-toolbar-btn-hover-bg"]=e.toolbarBtnHoverBg,a["--sp-toolbar-btn-disabled-color"]=e.toolbarBtnDisabledColor,a["--sp-toolbar-btn-active-color"]=e.toolbarBtnActiveColor,a}function ir(e){return e==="number"?0:1}function cr(e,l,o){var i;if(e==null||e.trim()==="")return{kind:"blank"};const n=l??"";if(n===ul||n==="@")return{kind:"text",text:e};if(dl(n)){if(Ul(e))return{kind:"number",num:Number(e)};const r=Dn(e,o);return r?{kind:"number",num:r.serial}:{kind:"text",text:bl(e,n,o)}}const a=Pl(n);if(a.kind==="date"||a.kind==="duration"){const r=Number(e);return Number.isFinite(r)?{kind:"number",num:r}:{kind:"text",text:bl(e,n,o)}}if(a.kind==="number"){const r=Number(e);if(Number.isFinite(r)){const f=((i=a.sections.find(m=>m.hasDigits))==null?void 0:i.scale)??1;return{kind:"number",num:r*f}}return{kind:"text",text:bl(e,n,o)}}return{kind:"text",text:bl(e,n,o)}}function iu(e,l,o,n){if(e.kind==="blank"||l.kind==="blank")return e.kind==="blank"&&l.kind==="blank"?0:e.kind==="blank"?1:-1;const a=ir(e.kind),i=ir(l.kind);if(a!==i)return o==="asc"?a-i:i-a;let r;return e.kind==="number"?r=(e.num??0)-(l.num??0):r=(e.text??"").localeCompare(l.text??"",n,{numeric:!0}),o==="asc"?r:-r}function cu(e,l,o){const n=e.map((a,i)=>i);return n.sort((a,i)=>{const r=iu(e[a],e[i],l,o);return r!==0?r:a-i}),n}function su(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 vo(e){return e?JSON.parse(JSON.stringify(e)):null}function sr(e,l,o,n){if(!e)return null;const a=o-l+1,i={...e.range};return n?l<=i.endRow&&(l<=i.startRow&&(i.startRow+=a),i.endRow+=a):o<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 ur(e,l,o,n){if(!e)return null;const a=o-l+1,i={...e.range},r={};if(n){l<=i.endCol&&(l<=i.startCol&&(i.startCol+=a),i.endCol+=a);for(const f in e.columns){const m=Number(f);r[m>=l?m+a:m]=e.columns[f]}}else{o<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 f in e.columns){const m=Number(f);m>=l&&m<=o||(r[m>o?m-a:m]=e.columns[f])}}return{range:i,columns:r}}function uu(e,l,o,n,a){function i(I,N){const O=N-I+1,de=Xe(I,N),ge=[],Me=[];for(const Z in e.cells){const ze=Z.indexOf(",");if(ze<0)continue;const $e=parseInt(Z.substring(0,ze),10),le=parseInt(Z.substring(ze+1),10);le>=I&&le<=N?Me.push(Z):le>N&&ge.push({oldKey:Z,newKey:e.cellKey($e,le-O),cell:e.cells[Z]})}for(const Z of Me)Reflect.deleteProperty(e.cells,Z);for(const Z of ge)Reflect.deleteProperty(e.cells,Z.oldKey),e.cells[Z.newKey]=Z.cell;const Ee=e.rowHeights.value,fe=new Array(Ee.length);for(let Z=0;Z<I;Z++)fe[Z]=Ee[Z];for(let Z=I;Z<Ee.length-O;Z++)fe[Z]=Ee[Z+O];for(let Z=Ee.length-O;Z<Ee.length;Z++)fe[Z]=void 0;e.rowHeights.value=fe,ve(de),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(sr(e.getFilter(),I,N,!1))}function r(I,N){const O=N-I+1,de=e.rowCount,ge=e.colCount,{lastRow:Me}=y();Me>=I&&Me+O>=de&&e.ensureCapacity(ge-1,de-1+O);const Ee=e.rowCount,fe=gt(I,N),Z=[];for(const le in e.cells){const Ke=le.indexOf(",");if(Ke<0)continue;const ft=parseInt(le.substring(0,Ke),10),E=parseInt(le.substring(Ke+1),10);E>=I&&Z.push({oldKey:le,newKey:e.cellKey(ft,E+O),cell:e.cells[le],oldRow:E})}Z.sort((le,Ke)=>Ke.oldRow-le.oldRow);for(const le of Z)Reflect.deleteProperty(e.cells,le.oldKey),e.cells[le.newKey]=le.cell;for(const le in e.cells){const Ke=le.indexOf(",");if(Ke<0)continue;const ft=parseInt(le.substring(Ke+1),10);ft>=I&&ft<=N&&Reflect.deleteProperty(e.cells,le)}const ze=e.rowHeights.value,$e=new Array(Ee);for(let le=0;le<I;le++)$e[le]=ze[le];for(let le=I;le<=N;le++)$e[le]=void 0;for(let le=I;le<Ee;le++)$e[le+O]=ze[le];e.rowHeights.value=$e,ve(fe),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(sr(e.getFilter(),I,N,!0))}function f(I,N){const O=N-I+1,de=e.colCount,ge=e.rowCount,{lastCol:Me}=y();Me>=I&&Me+O>=de&&e.ensureCapacity(de-1+O,ge-1);const Ee=e.colCount,fe=Ze(I,N),Z=[];for(const le in e.cells){const Ke=le.indexOf(",");if(Ke<0)continue;const ft=parseInt(le.substring(0,Ke),10),E=parseInt(le.substring(Ke+1),10);ft>=I&&Z.push({oldKey:le,newKey:e.cellKey(ft+O,E),cell:e.cells[le],oldCol:ft})}Z.sort((le,Ke)=>Ke.oldCol-le.oldCol);for(const le of Z)Reflect.deleteProperty(e.cells,le.oldKey),e.cells[le.newKey]=le.cell;for(const le in e.cells){const Ke=le.indexOf(",");if(Ke<0)continue;const ft=parseInt(le.substring(0,Ke),10);ft>=I&&ft<=N&&Reflect.deleteProperty(e.cells,le)}const ze=e.colWidths.value,$e=new Array(Ee);for(let le=0;le<I;le++)$e[le]=ze[le];for(let le=I;le<=N;le++)$e[le]=100;for(let le=I;le<Ee;le++)$e[le+O]=ze[le];e.colWidths.value=$e,ve(fe),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(ur(e.getFilter(),I,N,!0))}function m(I,N){const O=N-I+1,de=Je(I,N),ge=[],Me=[];for(const Z in e.cells){const ze=Z.indexOf(",");if(ze<0)continue;const $e=parseInt(Z.substring(0,ze),10),le=parseInt(Z.substring(ze+1),10);$e>=I&&$e<=N?Me.push(Z):$e>N&&ge.push({oldKey:Z,newKey:e.cellKey($e-O,le),cell:e.cells[Z]})}for(const Z of Me)Reflect.deleteProperty(e.cells,Z);for(const Z of ge)Reflect.deleteProperty(e.cells,Z.oldKey),e.cells[Z.newKey]=Z.cell;const Ee=e.colWidths.value,fe=new Array(Ee.length);for(let Z=0;Z<I;Z++)fe[Z]=Ee[Z];for(let Z=I;Z<Ee.length-O;Z++)fe[Z]=Ee[Z+O];for(let Z=Ee.length-O;Z<Ee.length;Z++)fe[Z]=100;e.colWidths.value=fe,ve(de),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(ur(e.getFilter(),I,N,!1))}function y(){let I=-1,N=-1;for(const O in e.cells){const de=O.split(",");if(de.length===2){const ge=parseInt(de[0],10),Me=parseInt(de[1],10),Ee=e.cells[O];Ee&&(Ee.value!==""||Ee.styleId!==void 0)&&(ge>I&&(I=ge),Me>N&&(N=Me))}}for(let O=e.colCount-1;O>=0;O--){const de=e.colWidths.value[O];if(de!==void 0&&de!==100){O>I&&(I=O);break}}for(let O=e.rowCount-1;O>=0;O--)if(e.rowHeights.value[O]!==void 0){O>N&&(N=O);break}return{lastCol:I,lastRow:N}}function k(I,N){const O=e.resolveStyle(e.cells[e.cellKey(I,N)]);return typeof(O==null?void 0:O.numberFormat)=="string"?O.numberFormat:""}function d(I,N,O){for(let de=N;de<=O;de++)if(e.getCellRaw(I,de).trim()!=="")return!0;return!1}function w(I){const{startRow:N,endRow:O,startCol:de,endCol:ge}=I;let Me=de,Ee=ge;for(;Me>0&&d(Me-1,N,O);)Me--;for(;Ee<e.colCount-1&&d(Ee+1,N,O);)Ee++;return{startRow:N,endRow:O,startCol:Me,endCol:Ee}}function v(I){const N=w(I);return N.startCol!==I.startCol||N.endCol!==I.endCol}function R(I,N,O,de=I){let ge,Me;if(O)ge=O.startRow,Me=O.endRow;else{const le=e.selection.value,Ke=!!le&&le.startRow===le.endRow&&le.startCol===le.endCol;ge=Ke||!le?0:le.startRow,Me=Ke||!le?e.rowCount-1:le.endRow}let Ee=-1,fe=-1;for(let le=ge;le<=Me;le++){let Ke=!1;for(let ft=I;ft<=N;ft++)if(e.getCellRaw(ft,le).trim()!==""){Ke=!0;break}Ke&&(Ee<0&&(Ee=le),fe=le)}if(Ee<0)return null;const Z=[];for(let le=Ee;le<=fe;le++){const Ke=e.getCellRaw(de,le);Z.push(cr(Ke,k(de,le),e.locale.value))}const ze=su(Z)?Ee+1:Ee;let $e=!1;for(let le=Ee;le<=fe&&!$e;le++)for(let Ke=I;Ke<=N;Ke++){const ft=e.cells[e.cellKey(Ke,le)];if(ft&&ft.value.startsWith("=")){$e=!0;break}}if(!$e)for(const le in e.merges){const Ke=e.merges[le];if(Ke&&Ke.startCol<=N&&Ke.endCol>=I&&Ke.startRow<=Me&&Ke.endRow>=ge){$e=!0;break}}return{firstRow:Ee,lastRow:fe,sortStart:ze,blocked:$e}}function G(I,N){const O=R(I,N);return!!O&&!O.blocked&&O.sortStart<O.lastRow}function te(I,N,O){var E,U;const de=N??e.selection.value;if(!de)return;const ge=de.startCol,Me=de.endCol,Ee=O??ge,fe=R(ge,Me,{startRow:de.startRow,endRow:de.endRow},Ee);if(!fe||fe.blocked||fe.sortStart>=fe.lastRow)return;const Z=Me-ge+1,ze=fe.lastRow-fe.sortStart+1,$e=[],le=[];for(let J=fe.sortStart;J<=fe.lastRow;J++){const ue=new Array(Z);for(let me=ge;me<=Me;me++)ue[me-ge]=e.cells[e.cellKey(me,J)]??null;$e.push(ue);const ye=e.getCellRaw(Ee,J);le.push(cr(ye,k(Ee,J),e.locale.value))}const Ke=cu(le,I,e.locale.value);let ft=!1;for(let J=0;J<ze;J++)if(Ke[J]!==J){ft=!0;break}if(ft){l.saveUndo();for(let J=0;J<ze;J++){const ue=$e[Ke[J]],ye=fe.sortStart+J;for(let me=ge;me<=Me;me++){const Se=e.cellKey(me,ye),We=ue[me-ge],st=We?We.value:"",Bt=(E=e.cells[Se])==null?void 0:E.styleId;st!==""||Bt!==void 0?e.cells[Se]={value:st,styleId:Bt}:e.delCell(Se)}}_n();for(let J=fe.sortStart;J<=fe.lastRow;J++)for(let ue=ge;ue<=Me;ue++)e.formulaDeps.markDirty(e.cellKey(ue,J));(U=e.scheduleRender)==null||U.call(e),p()}}const Y=t.ref(!1),K=t.ref(null);function C(I){const N=e.selection.value;if(!N||!v(N))return!1;const O=w(N);return K.value={order:I,originalRange:N,expandedRange:O},Y.value=!0,!0}function j(I){const N=K.value;if(!N)return;const{order:O,originalRange:de,expandedRange:ge}=N;Y.value=!1,K.value=null,te(O,I?ge:de,de.startCol),Fe.value=O}function q(){Y.value=!1,K.value=null}const se=t.ref(!1),Fe=t.ref("asc");function Qe(I){se.value=I,I&&(l.textColorMenuOpen.value=!1,l.fillColorMenuOpen.value=!1,l.fontSizeMenuOpen.value=!1)}function Ge(I){C(I)||(Fe.value=I,te(I))}function be(){C(Fe.value)||te(Fe.value)}function ve(I){Object.keys(e.merges).forEach(N=>Reflect.deleteProperty(e.merges,N));for(const N of I)if(!(N.newRange.startCol>N.newRange.endCol||N.newRange.startRow>N.newRange.endRow)&&(e.merges[N.newAnchorKey]={...N.newRange},N.anchorCell)){const O=N.anchorCell.value,de=N.anchorCell.styleId;O===""&&!de||(e.cells[N.newAnchorKey]={value:O,styleId:de||void 0})}}function Xe(I,N){const O=N-I+1,de=[];for(const ge in e.merges){const Me=e.merges[ge];if(!Me)continue;const Ee=e.cells[ge]?{value:e.cells[ge].value,styleId:e.cells[ge].styleId??0}:{value:"",styleId:0},{startCol:fe,endCol:Z}=Me;let{startRow:ze,endRow:$e}=Me;if(ze>N){ze-=O,$e-=O,de.push({newAnchorKey:e.cellKey(fe,ze),newRange:{startCol:fe,startRow:ze,endCol:Z,endRow:$e}});continue}if($e<I){de.push({newAnchorKey:ge,newRange:{startCol:fe,startRow:ze,endCol:Z,endRow:$e}});continue}if(ze>=I&&$e<=N||(ze>=I&&ze<=N&&(ze=I),$e>=I&&$e<=N?$e=I-1:$e>N&&($e-=O),ze>$e))continue;const le=fe,Ke=ze,ft=e.cellKey(le,Ke),U=ge.split(",").map(Number)[1],J=U>=I&&U<=N||le!==Me.startCol||Ke!==U;de.push({newAnchorKey:ft,newRange:{startCol:fe,startRow:ze,endCol:Z,endRow:$e},anchorCell:J?Ee:void 0})}return de}function Je(I,N){const O=N-I+1,de=[];for(const ge in e.merges){const Me=e.merges[ge];if(!Me)continue;const Ee=e.cells[ge]?{value:e.cells[ge].value,styleId:e.cells[ge].styleId??0}:{value:"",styleId:0};let{startCol:fe,endCol:Z}=Me;const{startRow:ze,endRow:$e}=Me;if(fe>N){fe-=O,Z-=O,de.push({newAnchorKey:e.cellKey(fe,ze),newRange:{startCol:fe,startRow:ze,endCol:Z,endRow:$e}});continue}if(Z<I){de.push({newAnchorKey:ge,newRange:{startCol:fe,startRow:ze,endCol:Z,endRow:$e}});continue}if(fe>=I&&Z<=N||(fe>=I&&fe<=N&&(fe=I),Z>=I&&Z<=N?Z=I-1:Z>N&&(Z-=O),fe>Z))continue;const le=fe,Ke=ze,ft=e.cellKey(le,Ke),U=ge.split(",").map(Number)[0],J=U>=I&&U<=N||le!==U||Ke!==Me.startRow;de.push({newAnchorKey:ft,newRange:{startCol:fe,startRow:ze,endCol:Z,endRow:$e},anchorCell:J?Ee:void 0})}return de}function gt(I,N){const O=N-I+1,de=[];for(const ge in e.merges){const Me=e.merges[ge];if(!Me)continue;const{startCol:Ee,endCol:fe}=Me;let{startRow:Z,endRow:ze}=Me;ze<I?de.push({newAnchorKey:ge,newRange:{startCol:Ee,startRow:Z,endCol:fe,endRow:ze}}):Z>N?(Z+=O,ze+=O,de.push({newAnchorKey:e.cellKey(Ee,Z),newRange:{startCol:Ee,startRow:Z,endCol:fe,endRow:ze}})):(ze+=O,de.push({newAnchorKey:ge,newRange:{startCol:Ee,startRow:Z,endCol:fe,endRow:ze}}))}return de}function Ze(I,N){const O=N-I+1,de=[];for(const ge in e.merges){const Me=e.merges[ge];if(!Me)continue;let{startCol:Ee,endCol:fe}=Me;const{startRow:Z,endRow:ze}=Me;fe<I?de.push({newAnchorKey:ge,newRange:{startCol:Ee,startRow:Z,endCol:fe,endRow:ze}}):Ee>N?(Ee+=O,fe+=O,de.push({newAnchorKey:e.cellKey(Ee,Z),newRange:{startCol:Ee,startRow:Z,endCol:fe,endRow:ze}})):(fe+=O,de.push({newAnchorKey:ge,newRange:{startCol:Ee,startRow:Z,endCol:fe,endRow:ze}}))}return de}let lt=0;function et(){return lt++,`s_${lt}`}function oe(I,N){const O=Math.max(1,(N==null?void 0:N.colCount)??e.colCount),de=Math.max(1,(N==null?void 0:N.rowCount)??e.rowCount),ge=new Array(O).fill(100),Me=new Array(de).fill(void 0);return{id:et(),name:I,cells:{},merges:{},styles:[{}],borders:[{}],selection:{startCol:0,startRow:0,endCol:0,endRow:0},activeCell:{col:0,row:0},scrollX:0,scrollY:0,colWidths:ge,rowHeights:Me,colCount:O,rowCount:de,freeze:{rows:0,cols:0},filter:null}}const pe=t.ref([oe("Sheet1")]),g=t.ref(0);function A(){const I=pe.value[g.value];I&&(I.cells={...e.cells},I.merges={...e.merges},I.selection=e.selection.value?{...e.selection.value}:null,I.activeCell={...e.activeCell.value},I.scrollX=e.scrollX.value,I.scrollY=e.scrollY.value,I.colWidths=[...e.colWidths.value],I.rowHeights=[...e.rowHeights.value],I.styles=[...e.styles],I.borders=[...e.borders],I.colCount=e.colCount,I.rowCount=e.rowCount,I.freeze={rows:e.freeze.rows,cols:e.freeze.cols},I.filter=vo(e.getFilter()))}function L(I){var fe;const N=pe.value[I];if(!N)return;Object.keys(e.cells).forEach(Z=>e.delCell(Z)),Object.assign(e.cells,N.cells),Object.keys(e.merges).forEach(Z=>Reflect.deleteProperty(e.merges,Z)),N.merges&&Object.assign(e.merges,N.merges),e.selection.value=N.selection?{...N.selection}:null,e.activeCell.value={...N.activeCell};const O=e.activeCell.value,de=e.selection.value,ge=e.findMerge(O.col,O.row);ge&&ge.anchor===e.cellKey(O.col,O.row)&&(!de||de.startCol===O.col&&de.startRow===O.row&&de.endCol===O.col&&de.endRow===O.row)&&e.selectCell(O.col,O.row),e.scrollX.value=N.scrollX,e.scrollY.value=N.scrollY,e.colWidths.value=[...N.colWidths],e.rowHeights.value=[...N.rowHeights];const Me=Math.max(1,N.colCount??e.colCount),Ee=Math.max(1,N.rowCount??e.rowCount);if((fe=e.setDims)==null||fe.call(e,Me,Ee),e.freeze.rows=Math.max(0,Math.min(N.freeze.rows,e.rowCount)),e.freeze.cols=Math.max(0,Math.min(N.freeze.cols,e.colCount)),N.filter){const Z=N.filter.range;e.setFilter({range:{startCol:Math.max(0,Math.min(Z.startCol,e.colCount-1)),endCol:Math.max(0,Math.min(Z.endCol,e.colCount-1)),startRow:Math.max(0,Math.min(Z.startRow,e.rowCount-1)),endRow:Math.max(0,Math.min(Z.endRow,e.rowCount-1))},columns:{...N.filter.columns}},!0)}else e.setFilter(null,!0);e.syncStyles(N.styles),e.syncBorders(N.borders??[{}]),g.value=I}function $(I){I===g.value||I<0||I>=pe.value.length||(e.cancelEdit(),A(),L(I))}function ee(I){return l.saveUndo(),e.cancelEdit(),A(),pe.value.push(oe(I??`Sheet${pe.value.length+1}`)),L(pe.value.length-1),pe.value.length-1}function ie(I){return pe.value.length<=1||(l.saveUndo(),e.cancelEdit(),pe.value.splice(I,1),L(Math.min(I,pe.value.length-1))),g.value}function re(I,N){pe.value[I]&&N.trim()&&(l.saveUndo(),pe.value[I].name=N.trim())}function he(I){l.saveUndo(),e.cancelEdit(),A();const N=pe.value[I];if(!N)return I;let O=N.name;const de=O.match(/^(.*?)\s*\((\d+)\)$/);let ge=de?parseInt(de[2],10)+1:2;de&&(O=de[1]);let Me=`${O} (${ge})`;const Ee=new Set(pe.value.map(Z=>Z.name));for(;Ee.has(Me);)ge++,Me=`${O} (${ge})`;const fe={id:et(),name:Me,cells:{...N.cells},merges:N.merges?{...N.merges}:{},styles:[...N.styles],borders:N.borders?[...N.borders]:[{}],selection:N.selection?{...N.selection}:null,activeCell:N.activeCell?{...N.activeCell}:{col:0,row:0},scrollX:N.scrollX,scrollY:N.scrollY,colWidths:[...N.colWidths],rowHeights:[...N.rowHeights],colCount:N.colCount,rowCount:N.rowCount,freeze:{...N.freeze},filter:vo(N.filter)};return pe.value.splice(I+1,0,fe),L(I+1),I+1}function ce(I,N){var Me;const O=I+N;if(O<0||O>=pe.value.length)return;l.saveUndo();const de=g.value,ge=pe.value.splice(I,1)[0];pe.value.splice(O,0,ge),de===I?g.value=O:I<de&&O>=de?g.value=de-1:I>de&&O<=de&&(g.value=de+1),(Me=e.scheduleRender)==null||Me.call(e)}const V=t.computed(()=>pe.value.length);let c="";const u=o;function p(){A();const I=pe.value.map(O=>{const de={};for(const[fe,Z]of Object.entries(O.cells))de[fe]={value:Z.value},Z.styleId&&Z.styleId>0&&(de[fe].styleId=Z.styleId);const ge={name:O.name,cells:de};O.styles&&O.styles.length>1&&(ge.styles=[...O.styles]),O.borders&&O.borders.length>1&&(ge.borders=[...O.borders]),O.merges&&Object.keys(O.merges).length&&(ge.merges={...O.merges});const Me={};for(let fe=0;fe<O.colWidths.length;fe++)O.colWidths[fe]!==100&&(Me[fe]=O.colWidths[fe]);Object.keys(Me).length&&(ge.colWidths=Me);const Ee={};for(let fe=0;fe<O.rowHeights.length;fe++){const Z=O.rowHeights[fe];Z!=null&&(Ee[fe]=Z)}return Object.keys(Ee).length&&(ge.rowHeights=Ee),O.colCount!==26&&(ge.colCount=O.colCount),O.rowCount!==200&&(ge.rowCount=O.rowCount),(O.freeze.rows!==0||O.freeze.cols!==0)&&(ge.freeze={rows:O.freeze.rows,cols:O.freeze.cols}),O.filter&&(ge.filter=vo(O.filter)),ge}),N=JSON.stringify(I);N!==c&&(c=N,u.value=I,a&&(a.value=N))}e.emitModelData=p;let H=!1;function ct(){H||(H=!0,Promise.resolve().then(()=>{H=!1,p()}))}const ae=t.computed(()=>e.props.theme==="dark"?Tr:Br),Pe=t.computed(()=>au(ae.value,e.props.width,e.props.height,wn)),at=t.computed(()=>{const I={};for(const[N,O]of Object.entries(Pe.value))N.startsWith("--")&&(I[N]=O);return I}),Mt=t.ref(null),St=t.ref(null),Rt=t.ref(null),Ft=t.ref(null),Yt=t.ref(null),nl=t.reactive({w:800,h:600});e.viewSize&&t.watch(nl,I=>{e.viewSize&&(e.viewSize.w=I.w,e.viewSize.h=I.h)},{deep:!0});const Cl=48,Dl=28,cl=11,wl=t.computed(()=>Math.max(0,e.totalWidth.value-Math.max(0,nl.w-Cl-cl))),ol=t.computed(()=>Math.max(0,e.totalHeight.value-Math.max(0,nl.h-Dl-cl)));function fl(I,N){const O=Math.max(0,nl.w-Cl-cl),de=Math.max(0,nl.h-Dl-cl),ge=I??e.scrollX.value,Me=N??e.scrollY.value,Ee=40,fe=Math.max(0,e.totalWidth.value-O),Z=Math.max(0,e.totalHeight.value-de);if(ge>=fe-Ee&&ge>e.scrollX.value||Me>=Z-Ee&&Me>e.scrollY.value){const ze=Math.max(0,Math.ceil((ge+O)/100)+2),$e=Math.max(0,Math.ceil((Me+de)/24)+2);e.ensureCapacity(ze,$e)}e.scrollX.value=Math.max(0,Math.min(ge,Math.max(0,e.totalWidth.value-O))),e.scrollY.value=Math.max(0,Math.min(Me,Math.max(0,e.totalHeight.value-de)))}e.clampScroll=fl;function Xt(){var I;return typeof window>"u"?!1:!((I=window.matchMedia)!=null&&I.call(window,"(hover: none) and (pointer: coarse)").matches)}function Kl(I=!1){t.nextTick(()=>{const N=Ft.value;if(N){if(!e.editingCell.value&&!Xt()){document.activeElement===N&&N.blur();return}N.focus({preventScroll:!0}),I&&N.select()}})}function Gl(){Kl()}function Yl(){var N;const I=e.selection.value;if(I){l.saveUndo();for(let O=I.startRow;O<=I.endRow;O++)e.rowHeights.value[O]=void 0;(N=e.scheduleRender)==null||N.call(e),p()}}function sn(){var N;const I=e.selection.value;if(I){l.saveUndo();for(let O=I.startCol;O<=I.endCol;O++)e.colWidths.value[O]=100;(N=e.scheduleRender)==null||N.call(e),p()}}return{deleteRows:i,insertRows:r,insertCols:f,deleteCols:m,sortSelectedColumns:te,canSortColumns:G,sortMenuOpen:se,cachedSortOrder:Fe,onSortMenuToggle:Qe,onSortChange:Ge,applyCachedSort:be,sortConfirmOpen:Y,prepareSortConfirmation:C,confirmSort:j,cancelSortConfirmation:q,sheets:pe,activeSheetIndex:g,saveSheet:A,loadSheet:L,switchSheet:$,addSheet:ee,removeSheet:ie,renameSheet:re,dupSheet:he,moveSheet:ce,sheetCount:V,mkSheet:oe,emitModelData:p,scheduleOptEmit:ct,themeColors:ae,outerStyle:Pe,toolbarThemeVars:at,wrapperRef:Mt,canvasRef:St,freezeCanvasRef:Rt,editInputRef:Ft,formulaBarRef:Yt,viewSize:nl,maxScrollX:wl,maxScrollY:ol,clampScroll:fl,canFocusHiddenEditor:Xt,focusEditInput:Kl,onCanvasFocus:Gl,resetRowHeight:Yl,resetColWidth:sn,modelData:u}}function dr(e){return!!e&&e.width!==void 0&&e.width>0}function Nt(e,l,o,n){const a=dr(e),i=dr(l);if(!a&&!i)return;if(a&&!i)return e;if(!a&&i)return l;const r=e.width??0,f=l.width??0;return r>f?e:f>r?l:e}function fr(e,l){if(!e||typeof e!="object")return null;const o=e,n=o.columns??{},a=Object.keys(n).map(r=>Number(r)).filter(r=>!Number.isNaN(r));if(!o.range||typeof o.range.startRow!="number"){let r=a.length?Math.min(...a):0,f=a.length?Math.max(...a):0,m=0;for(const y in l){const k=y.indexOf(",");if(k<0)continue;const d=parseInt(y.substring(k+1),10);d>m&&(m=d)}return{range:{startCol:r,startRow:0,endCol:f,endRow:Math.max(0,m)},columns:n}}const i={...o.range};for(const r of a)r<i.startCol&&(i.startCol=r),r>i.endCol&&(i.endCol=r);return{range:i,columns:n}}function du(e,l,o,n,a){let i=!1,r=null,f=1,m=()=>{},y=()=>{},k=()=>{};function d(){i||(i=!0,requestAnimationFrame(()=>{i=!1,G(),te()}))}e.scheduleRender=d;function w(s){const{frozenColumnsWidth:b}=e.getFrozenMetrics(),M=b>0&&s<52+b?s-52:s-52+e.scrollX.value;return e.hitCol(M)}function v(s){const{frozenRowsHeight:b}=e.getFrozenMetrics(),M=b>0&&s<24+b?s-24:s-24+e.scrollY.value;return e.hitRow(M)}const R="#444";function G(){const s=n.wrapperRef.value,b=n.canvasRef.value;if(!s||!b||(r=b.getContext("2d"),!r))return;f=window.devicePixelRatio||1;const M=s.getBoundingClientRect(),_=M.width,x=M.height;n.viewSize.w=_,n.viewSize.h=x,b.width=_*f,b.height=x*f,b.style.width=_+"px",b.style.height=x+"px",r.setTransform(f,0,0,f,0,0);const P=e.scrollX.value,z=e.scrollY.value,F=52,Q=24,ke=n.themeColors.value,Ne=e.getFilter(),tt=e.colPositions.value,ut=e.rowPositions.value,yt=e.colWidths.value,{frozenRowsHeight:Tt,frozenColumnsWidth:qt}=e.getFrozenMetrics(),al=F+qt,Sl=Q+Tt,ql=Math.max(0,_-F-11-qt),pn=Math.max(0,x-Q-11-Tt),hn=Math.max(0,e.freeze.cols-1),gn=Math.max(0,e.freeze.rows-1),Jl=Math.max(e.freeze.cols,e.hitCol(qt+P));let yn=Jl;for(let T=Jl;T<e.colCount&&!(F+tt[T]-P>=_);T++)yn=T;const gl=Math.max(e.freeze.rows,e.hitRow(Tt+z));let Al=gl;for(let T=gl;T<e.rowCount&&!(Q+ut[T]-z>=x);T++)Al=T;let Jt=Jl,Qt=yn,il=gl,Vl=Al;qt>0&&(Jt=0,Qt=Math.max(Qt,hn)),Tt>0&&(il=0,Vl=Math.max(Vl,gn));let Hl=Jt,Ql=il;for(const T in e.merges){const Be=e.merges[T];Be&&(Be.startRow>Vl||Be.endRow<il||Be.startCol>Qt||Be.endCol<Jt||(Be.startCol<Hl&&(Hl=Be.startCol),Be.startRow<Ql&&(Ql=Be.startRow)))}const Ol=new Array(Ql);for(let T=Ql;T<=Vl;T++)Ol[T]=ut[T+1]-ut[T];r.fillStyle=ke.bg,r.fillRect(0,0,_,x),r.fillStyle=ke.gridBg,r.fillRect(F,Q,_-F,x-Q);const vt=e.selection.value,Mn=e.editingCell.value;m=(T,Be,He,wt,Lt,Dt)=>{for(let qe=wt;qe<=Lt;qe++)for(let Re=Be;Re<=He;Re++){if(e.findMerge(Re,qe))continue;const nt=e.cellToScreenRect(qe,Re),_e=nt.x,Oe=nt.y,rt=nt.width,it=nt.height;if(_e+rt<F||Oe+it<Q||_e>_||Oe>x)continue;const kt=e.findHighlight?e.findHighlight(Re,qe):null,Et=e.resolveStyle(e.cells[e.cellKey(Re,qe)]),At=typeof(Et==null?void 0:Et.backgroundColor)=="string"?Et.backgroundColor:"";if(At&&(T.fillStyle=At,T.fillRect(_e,Oe,rt,it)),kt&&(T.fillStyle=kt==="active"?ke.findActiveBg:ke.findMatchBg,T.fillRect(_e,Oe,rt,it)),e.isSelected(Re,qe)&&(T.fillStyle=ke.selectionBg,e.selectionMode.value==="row"||e.selectionMode.value==="col"?T.fillRect(_e,Oe,yt[Re],Dt[qe]):T.fillRect(_e,Oe,rt,it)),e.activeCell.value.col===Re&&e.activeCell.value.row===qe&&(T.strokeStyle=ke.activeCellBorder,T.lineWidth=2,T.strokeRect(_e+1,Oe+1,rt-2,it-2)),kt==="active"&&(T.strokeStyle=ke.findActiveBg,T.lineWidth=2,T.strokeRect(_e+1,Oe+1,rt-2,it-2)),T.strokeStyle=ke.gridLine,T.lineWidth=.5,T.strokeRect(_e+.25,Oe+.25,rt-.5,it-.5),!(Mn&&Mn.col===Re&&Mn.row===qe)){const we=e.resolveStyle(e.cells[e.cellKey(Re,qe)]),ne=e.getCellValue(Re,qe),Te=typeof(we==null?void 0:we.numberFormat)=="string"?we.numberFormat:"",Ae=ne?bl(ne,Te,e.locale.value):"";if(Ae){const ot=e.cellFontSize(Re,qe),xt=typeof(we==null?void 0:we.fontFamily)=="string"&&we.fontFamily?we.fontFamily:Cn,Gt=(we==null?void 0:we.fontWeight)==="bold"?"bold":"normal",$t=(we==null?void 0:we.fontStyle)==="italic"?"italic":"normal",Ll=(we==null?void 0:we.underline)==="underline",en=(we==null?void 0:we.strikethrough)==="line-through",zl=typeof(we==null?void 0:we.color)=="string"?we.color:"",tn=typeof(we==null?void 0:we.textAlign)=="string"?we.textAlign:io(ne,Te)?"right":"left",Hn=typeof(we==null?void 0:we.verticalAlign)=="string"?we.verticalAlign:"top";T.fillStyle=zl||ke.cellText,T.font=`${$t} ${Gt} ${ot}px ${xt}`,T.textBaseline="alphabetic",T.save(),T.beginPath(),T.rect(_e+5,Oe+1,rt-10,it-2),T.clip();const ln=(we==null?void 0:we.wrap)==="wrap";let el=rt-10;Ne&&qe===Ne.range.startRow&&Re>=Ne.range.startCol&&Re<=Ne.range.endCol&&(el=rt-10-ie);let Ml=Ae;const xl=!ln&&No(Te),nn=Ae===Gn||Fo(ne,Te);if(nn||xl){if(nn){const Bn=Math.max(1,T.measureText("#").width),Kn=Math.max(1,Math.floor(el/Bn));Ml="#".repeat(Kn)}else if(e.getWrappedLines(T,Ae,1e9,!1).some(on=>on&&T.measureText(on).width>el)){const on=Math.max(1,T.measureText("#").width),On=Math.max(1,Math.floor(el/on));Ml="#".repeat(On)}}const sl=e.getWrappedLines(T,Ml,el,ln),{ascent:xn,descent:to}=e.measureFontMetrics(xt,ot,Gt,$t),lo=xn+to,Lu=sl.length*lo;let no;Hn==="middle"?no=Oe+(it-Lu)/2+xn:Hn==="bottom"?no=Oe+it-e.BASE_CELL_VPAD-to-(sl.length-1)*lo:no=Oe+e.BASE_CELL_VPAD+xn;for(let Bn=0;Bn<sl.length;Bn++){const Kn=sl[Bn],on=no+Bn*lo,On=T.measureText(Kn);let bn;if(tn==="center"?bn=_e+rt/2-On.width/2:tn==="right"?bn=_e+rt-5-On.width:bn=_e+5,T.fillText(Kn,bn,on),Ll&&(T.strokeStyle=zl||ke.cellText,T.lineWidth=1,T.beginPath(),T.moveTo(bn,on+to+1),T.lineTo(bn+On.width,on+to+1),T.stroke()),en){T.strokeStyle=zl||ke.cellText,T.lineWidth=1;const gr=on-xn+lo*.42;T.beginPath(),T.moveTo(bn,gr),T.lineTo(bn+On.width,gr),T.stroke()}}T.restore()}}Ne&&qe===Ne.range.startRow&&Re>=Ne.range.startCol&&Re<=Ne.range.endCol&&c(T,_e,Oe,rt,it,Zo(Ne.columns[Re]),ke)}};const Ye=(T,Be,He)=>{const wt=e.findMerge(T,Be);return wt?e.getCellBorderSide(e.cells[wt.anchor],He):e.getCellBorderSide(e.cells[e.cellKey(T,Be)],He)};y=(T,Be,He,wt,Lt,Dt)=>{T.fillStyle=R;for(let qe=wt;qe<=Lt;qe++)for(let Re=Be;Re<=He;Re++){if(e.findMerge(Re,qe))continue;const nt=e.cellToScreenRect(qe,Re),_e=nt.x,Oe=nt.y,rt=nt.width,it=nt.height;if(_e+rt<F||Oe+it<Q||_e>_||Oe>x)continue;const kt=e.cells[e.cellKey(Re,qe)],Et={top:e.getCellBorderSide(kt,"top"),right:e.getCellBorderSide(kt,"right"),bottom:e.getCellBorderSide(kt,"bottom"),left:e.getCellBorderSide(kt,"left")},At={top:Ye(Re,qe-1,"bottom"),left:Ye(Re-1,qe,"right"),bottom:Ye(Re,qe+1,"top"),right:Ye(Re+1,qe,"left")},we=Nt(At.top,Et.top),ne=Nt(At.left,Et.left),Te=Nt(Et.bottom,At.bottom),Ae=Nt(Et.right,At.right),ot=(we==null?void 0:we.width)??0,xt=(ne==null?void 0:ne.width)??0,Gt=(Te==null?void 0:Te.width)??0,$t=(Ae==null?void 0:Ae.width)??0;ot>0&&(T.fillStyle=(we==null?void 0:we.color)||R,T.fillRect(_e,Oe,rt,ot)),Gt>0&&(T.fillStyle=(Te==null?void 0:Te.color)||R,T.fillRect(_e,Oe+it-Gt,rt,Gt)),xt>0&&(T.fillStyle=(ne==null?void 0:ne.color)||R,T.fillRect(_e,Oe,xt,it)),$t>0&&(T.fillStyle=(Ae==null?void 0:Ae.color)||R,T.fillRect(_e+rt-$t,Oe,$t,it)),ot>0&&xt>0&&(T.fillStyle=(we==null?void 0:we.color)||(ne==null?void 0:ne.color)||R,T.fillRect(_e-xt,Oe-ot,xt,ot)),ot>0&&$t>0&&(T.fillStyle=(we==null?void 0:we.color)||(Ae==null?void 0:Ae.color)||R,T.fillRect(_e+rt,Oe-ot,$t,ot)),Gt>0&&xt>0&&(T.fillStyle=(Te==null?void 0:Te.color)||(ne==null?void 0:ne.color)||R,T.fillRect(_e-xt,Oe+it,xt,Gt)),Gt>0&&$t>0&&(T.fillStyle=(Te==null?void 0:Te.color)||(Ae==null?void 0:Ae.color)||R,T.fillRect(_e+rt,Oe+it,$t,Gt))}};const It=(T,Be,He,wt,Lt,Dt,qe)=>{const Re=e.resolveStyle(e.cells[e.cellKey(Be,He)]),dt=e.getCellValue(Be,He),nt=typeof(Re==null?void 0:Re.numberFormat)=="string"?Re.numberFormat:"",_e=dt?bl(dt,nt,e.locale.value):"";if(!_e)return;const Oe=e.cellFontSize(Be,He),rt=typeof(Re==null?void 0:Re.fontFamily)=="string"&&Re.fontFamily?Re.fontFamily:Cn,it=(Re==null?void 0:Re.fontWeight)==="bold"?"bold":"normal",kt=(Re==null?void 0:Re.fontStyle)==="italic"?"italic":"normal",Et=(Re==null?void 0:Re.underline)==="underline",At=(Re==null?void 0:Re.strikethrough)==="line-through",we=typeof(Re==null?void 0:Re.color)=="string"?Re.color:"",ne=typeof(Re==null?void 0:Re.textAlign)=="string"?Re.textAlign:io(dt,nt)?"right":"left",Te=typeof(Re==null?void 0:Re.verticalAlign)=="string"?Re.verticalAlign:"top";T.fillStyle=we||ke.cellText,T.font=`${kt} ${it} ${Oe}px ${rt}`,T.textBaseline="alphabetic",T.save(),T.beginPath(),T.rect(Dt+5,qe+1,wt-10,Lt-2),T.clip();const Ae=(Re==null?void 0:Re.wrap)==="wrap",ot=wt-10;let xt=_e;const Gt=!Ae&&No(nt),$t=_e===Gn||Fo(dt,nt);if($t||Gt){if($t){const el=Math.max(1,T.measureText("#").width),Ml=Math.max(1,Math.floor(ot/el));xt="#".repeat(Ml)}else if(e.getWrappedLines(T,_e,1e9,!1).some(xl=>xl&&T.measureText(xl).width>ot)){const xl=Math.max(1,T.measureText("#").width),nn=Math.max(1,Math.floor(ot/xl));xt="#".repeat(nn)}}const Ll=e.getWrappedLines(T,xt,ot,Ae),{ascent:en,descent:zl}=e.measureFontMetrics(rt,Oe,it,kt),tn=en+zl,Hn=Ll.length*tn;let ln;Te==="middle"?ln=qe+(Lt-Hn)/2+en:Te==="bottom"?ln=qe+Lt-e.BASE_CELL_VPAD-zl-(Ll.length-1)*tn:ln=qe+e.BASE_CELL_VPAD+en;for(let el=0;el<Ll.length;el++){const Ml=Ll[el],xl=ln+el*tn,nn=T.measureText(Ml);let sl;if(ne==="center"?sl=Dt+wt/2-nn.width/2:ne==="right"?sl=Dt+wt-5-nn.width:sl=Dt+5,T.fillText(Ml,sl,xl),Et&&(T.strokeStyle=we||ke.cellText,T.lineWidth=1,T.beginPath(),T.moveTo(sl,xl+zl+1),T.lineTo(sl+nn.width,xl+zl+1),T.stroke()),At){T.strokeStyle=we||ke.cellText,T.lineWidth=1;const xn=xl-en+tn*.42;T.beginPath(),T.moveTo(sl,xn),T.lineTo(sl+nn.width,xn),T.stroke()}}T.restore()},Rl=(T,Be,He,wt,Lt,Dt,qe,Re)=>{const dt=Be.startCol,nt=Be.endCol,_e=Be.startRow,Oe=Be.endRow,rt=wt,it=Dt,kt=qe&&nt>=e.freeze.cols,Et=Re&&Oe>=e.freeze.rows,At=e.cells[e.cellKey(dt,_e)],we={top:e.getCellBorderSide(At,"top"),right:e.getCellBorderSide(At,"right"),bottom:e.getCellBorderSide(At,"bottom"),left:e.getCellBorderSide(At,"left")};T.fillStyle=R;for(let ne=dt;ne<=nt;ne++){if(qe&&ne>=e.freeze.cols||e.isSameMergeInternal(ne,_e-1,ne,_e))continue;const Te=Ye(ne,_e-1,"bottom"),Ae=Nt(Te,we.top);if(Ae&&Ae.width&&Ae.width>0){const ot=ne<e.freeze.cols?F+tt[ne]:F+tt[ne]-P;T.fillStyle=Ae.color||R,T.fillRect(ot,rt,yt[ne],Ae.width)}}if(!Et)for(let ne=dt;ne<=nt;ne++){if(qe&&ne>=e.freeze.cols||e.isSameMergeInternal(ne,Oe,ne,Oe+1))continue;const Te=Ye(ne,Oe+1,"top"),Ae=Nt(we.bottom,Te);if(Ae&&Ae.width&&Ae.width>0){const ot=ne<e.freeze.cols?F+tt[ne]:F+tt[ne]-P;T.fillStyle=Ae.color||R,T.fillRect(ot,rt+it-Ae.width,yt[ne],Ae.width)}}for(let ne=_e;ne<=Oe;ne++){if(Re&&ne>=e.freeze.rows||e.isSameMergeInternal(dt-1,ne,dt,ne))continue;const Te=Ye(dt-1,ne,"right"),Ae=Nt(Te,we.left);if(Ae&&Ae.width&&Ae.width>0){const ot=ne<e.freeze.rows?Q+ut[ne]:Q+ut[ne]-z,xt=ut[ne+1]-ut[ne];T.fillStyle=Ae.color||R,T.fillRect(He,ot,Ae.width,xt)}}if(!kt)for(let ne=_e;ne<=Oe;ne++){if(Re&&ne>=e.freeze.rows||e.isSameMergeInternal(nt,ne,nt+1,ne))continue;const Te=Ye(nt+1,ne,"left"),Ae=Nt(we.right,Te);if(Ae&&Ae.width&&Ae.width>0){const ot=ne<e.freeze.rows?Q+ut[ne]:Q+ut[ne]-z,xt=ut[ne+1]-ut[ne];T.fillStyle=Ae.color||R,T.fillRect(He+Lt-Ae.width,ot,Ae.width,xt)}}{const ne=e.isSameMergeInternal(dt,_e-1,dt,_e)?we.top:Nt(Ye(dt,_e-1,"bottom"),we.top),Te=e.isSameMergeInternal(dt-1,_e,dt,_e)?we.left:Nt(Ye(dt-1,_e,"right"),we.left),Ae=(ne==null?void 0:ne.width)??0,ot=(Te==null?void 0:Te.width)??0;Ae>0&&ot>0&&(T.fillStyle=(ne==null?void 0:ne.color)||(Te==null?void 0:Te.color)||R,T.fillRect(He-ot,wt-Ae,ot,Ae))}if(!kt){const ne=e.isSameMergeInternal(nt,_e-1,nt,_e)?we.top:Nt(Ye(nt,_e-1,"bottom"),we.top),Te=e.isSameMergeInternal(nt,_e,nt+1,_e)?we.right:Nt(we.right,Ye(nt+1,_e,"left")),Ae=(ne==null?void 0:ne.width)??0,ot=(Te==null?void 0:Te.width)??0;Ae>0&&ot>0&&(T.fillStyle=(ne==null?void 0:ne.color)||(Te==null?void 0:Te.color)||R,T.fillRect(He+Lt,wt-Ae,ot,Ae))}if(!Et){const ne=e.isSameMergeInternal(dt,Oe,dt,Oe+1)?we.bottom:Nt(we.bottom,Ye(dt,Oe+1,"top")),Te=e.isSameMergeInternal(dt-1,Oe,dt,Oe)?we.left:Nt(Ye(dt-1,Oe,"right"),we.left),Ae=(ne==null?void 0:ne.width)??0,ot=(Te==null?void 0:Te.width)??0;Ae>0&&ot>0&&(T.fillStyle=(ne==null?void 0:ne.color)||(Te==null?void 0:Te.color)||R,T.fillRect(He-ot,wt+Dt,ot,Ae))}if(!kt&&!Et){const ne=e.isSameMergeInternal(nt,Oe,nt,Oe+1)?we.bottom:Nt(we.bottom,Ye(nt,Oe+1,"top")),Te=e.isSameMergeInternal(nt,Oe,nt+1,Oe)?we.right:Nt(we.right,Ye(nt+1,Oe,"left")),Ae=(ne==null?void 0:ne.width)??0,ot=(Te==null?void 0:Te.width)??0;Ae>0&&ot>0&&(T.fillStyle=(ne==null?void 0:ne.color)||(Te==null?void 0:Te.color)||R,T.fillRect(He+Lt,wt+Dt,ot,Ae))}};k=(T,Be,He,wt,Lt)=>{var nt;const Dt=Be+wt,qe=He+Lt,Re=Be<al,dt=He<Sl;for(const _e in e.merges){const Oe=e.merges[_e];if(!Oe)continue;const rt=Oe.startCol,it=Oe.startRow,kt=Oe.endCol,Et=Oe.endRow,At=e.cellToScreenRect(it,rt),we=e.cellToScreenRect(Et,kt),ne=At.x,Te=At.y,Ae=we.x+we.width-ne,ot=we.y+we.height-Te,xt=Re&&kt>=e.freeze.cols?Math.min(Dt,al):Math.min(ne+Ae,Dt),Gt=dt&&Et>=e.freeze.rows?Math.min(qe,Sl):Math.min(Te+ot,qe),$t=Math.max(ne,Be),Ll=Math.max(Te,He);if(xt<=$t||Gt<=Ll)continue;const en=(nt=e.resolveStyle(e.cells[e.cellKey(rt,it)]))==null?void 0:nt.backgroundColor;if(en&&(T.fillStyle=en,T.fillRect($t,Ll,xt-$t,Gt-Ll)),T.strokeStyle=ke.gridLine,T.lineWidth=.5,T.strokeRect(ne+.25,Te+.25,xt-ne-.5,Gt-Te-.5),Rl(T,Oe,ne,Te,Ae,ot,Re,dt),!(e.editingCell.value&&e.editingCell.value.col===rt&&e.editingCell.value.row===it)){const zl=tt[kt+1]-tt[rt],tn=ut[Et+1]-ut[it],Hn=rt<e.freeze.cols,ln=it<e.freeze.rows,el=Re?ne:Hn?ne-P:ne,Ml=dt?Te:ln?Te-z:Te;It(T,rt,it,zl,tn,el,Ml)}}},r.save(),r.beginPath(),r.rect(al,Sl,ql,pn),r.clip(),m(r,Hl,Qt,Ql,Vl,Ol),y(r,Hl,Qt,Ql,Vl,Ol),k(r,al,Sl,ql,pn),r.restore(),qt>0&&(r.strokeStyle=ke.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(al+.5,Q),r.lineTo(al+.5,x),r.stroke()),Tt>0&&(r.strokeStyle=ke.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(F,Sl+.5),r.lineTo(_,Sl+.5),r.stroke()),r.fillStyle=ke.headerBg,r.fillRect(F,0,_-F,Q);for(let T=Jl;T<=yn;T++){const Be=F+tt[T]-P,He=yt[T];Be+He<F||Be>_||(vt&&T>=vt.startCol&&T<=vt.endCol&&(r.fillStyle=ke.selectionBg,r.fillRect(Be,0,He,Q)),r.strokeStyle=ke.headerBorder,r.lineWidth=.5,r.strokeRect(Be+.25,.25,He-.5,Q-.5),vt&&T>=vt.startCol&&T<=vt.endCol&&(r.strokeStyle=ke.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(Be,Q-1),r.lineTo(Be+He,Q-1),r.stroke()),r.fillStyle=ke.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(ht(T),Be+He/2,Q/2))}if(qt>0){r.fillStyle=ke.headerBg,r.fillRect(F,0,qt,Q);for(let T=0;T<=hn;T++){const Be=F+tt[T],He=yt[T];Be+He<F||Be>_||(vt&&T>=vt.startCol&&T<=vt.endCol&&(r.fillStyle=ke.selectionBg,r.fillRect(Be,0,He,Q)),r.strokeStyle=ke.headerBorder,r.lineWidth=.5,r.strokeRect(Be+.25,.25,He-.5,Q-.5),vt&&T>=vt.startCol&&T<=vt.endCol&&(r.strokeStyle=ke.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(Be,Q-1),r.lineTo(Be+He,Q-1),r.stroke()),r.fillStyle=ke.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(ht(T),Be+He/2,Q/2))}}r.strokeStyle=ke.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(F,Q+.5),r.lineTo(_,Q+.5),r.stroke(),r.fillStyle=ke.headerBg,r.fillRect(0,Q,F,x-Q);for(let T=gl;T<=Al;T++){if(e.isRowHidden(T))continue;const Be=Q+ut[T]-z,He=Ol[T];Be+He<Q||Be>x||(vt&&T>=vt.startRow&&T<=vt.endRow&&(r.fillStyle=ke.selectionBg,r.fillRect(0,Be,F,He)),r.strokeStyle=ke.headerBorder,r.lineWidth=.5,r.strokeRect(.25,Be+.25,F-.5,He-.5),vt&&T>=vt.startRow&&T<=vt.endRow&&(r.strokeStyle=ke.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(F-1,Be),r.lineTo(F-1,Be+He),r.stroke()),r.fillStyle=ke.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(String(T+1),F/2,Be+He/2+.5))}if(Tt>0){r.fillStyle=ke.headerBg,r.fillRect(0,Q,F,Tt);for(let T=0;T<=gn;T++){if(e.isRowHidden(T))continue;const Be=Q+ut[T],He=Ol[T];Be+He<Q||Be>x||(vt&&T>=vt.startRow&&T<=vt.endRow&&(r.fillStyle=ke.selectionBg,r.fillRect(0,Be,F,He)),r.strokeStyle=ke.headerBorder,r.lineWidth=.5,r.strokeRect(.25,Be+.25,F-.5,He-.5),vt&&T>=vt.startRow&&T<=vt.endRow&&(r.strokeStyle=ke.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(F-1,Be),r.lineTo(F-1,Be+He),r.stroke()),r.fillStyle=ke.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(String(T+1),F/2,Be+He/2+.5))}}r.strokeStyle=ke.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(F+.5,Q),r.lineTo(F+.5,x),r.stroke(),r.fillStyle=ke.headerBg,r.fillRect(0,0,F,Q),r.strokeStyle=ke.headerSep,r.lineWidth=1,r.strokeRect(.5,.5,F-1,Q-1);const yl=Math.min(F,Q)*.32;r.fillStyle=ke.activeCellBorder,r.beginPath(),r.moveTo(F-1,Q-1-yl),r.lineTo(F-1-yl,Q-1),r.lineTo(F-1,Q-1),r.closePath(),r.fill(),Y(r,ke),K(r,ke)}function te(){const s=n.freezeCanvasRef.value,b=n.wrapperRef.value;if(!s||!b)return;const M=s.getContext("2d");if(!M)return;const _=b.getBoundingClientRect(),x=_.width,P=_.height,z=52,F=24,Q=n.themeColors.value,ke=e.colPositions.value,Ne=e.rowPositions.value,tt=e.scrollX.value,ut=e.scrollY.value;s.width=x*f,s.height=P*f,s.style.width=x+"px",s.style.height=P+"px",M.setTransform(f,0,0,f,0,0),M.clearRect(0,0,x,P);const{frozenRowsHeight:yt,frozenColumnsWidth:Tt}=e.getFrozenMetrics();if(yt<=0&&Tt<=0)return;const qt=z+Tt,al=F+yt,Sl=Math.max(0,x-z-11-Tt),ql=Math.max(0,P-F-11-yt),pn=Math.max(0,e.freeze.cols-1),hn=Math.max(0,e.freeze.rows-1),gn=Math.max(e.freeze.cols,e.hitCol(Tt+tt));let Jl=gn;for(let Ye=gn;Ye<e.colCount&&!(z+ke[Ye]-tt>=x);Ye++)Jl=Ye;const yn=Math.max(e.freeze.rows,e.hitRow(yt+ut));let gl=yn;for(let Ye=yn;Ye<e.rowCount&&!(F+Ne[Ye]-ut>=P);Ye++)gl=Ye;let Al=gn,Jt=Jl,Qt=yn,il=gl;Tt>0&&(Al=0,Jt=Math.max(Jt,pn)),yt>0&&(Qt=0,il=Math.max(il,hn));let Vl=Al,Hl=Qt;for(const Ye in e.merges){const It=e.merges[Ye];It&&(It.startRow>il||It.endRow<Qt||It.startCol>Jt||It.endCol<Al||(It.startCol<Vl&&(Vl=It.startCol),It.startRow<Hl&&(Hl=It.startRow)))}const Ql=new Array(Hl);for(let Ye=Hl;Ye<=il;Ye++)Ql[Ye]=Ne[Ye+1]-Ne[Ye];const Ol=(Ye,It,Rl)=>{const yl=e.findMerge(Ye,It);return yl?e.getCellBorderSide(e.cells[yl.anchor],Rl):e.getCellBorderSide(e.cells[e.cellKey(Ye,It)],Rl)},vt=(Ye,It,Rl,yl,T)=>{Ye.fillStyle="#444";for(let Be=yl;Be<=T;Be++)for(let He=It;He<=Rl;He++){const wt=e.findMerge(He,Be);if(wt&&!(He===wt.range.startCol&&Be===wt.range.startRow))continue;const Lt=e.cellToScreenRect(Be,He),Dt=Lt.x,qe=Lt.y,Re=Lt.width,dt=Lt.height;if(Dt+Re<z||qe+dt<F||Dt>x||qe>P)continue;const nt=e.cells[e.cellKey(He,Be)],_e={top:e.getCellBorderSide(nt,"top"),right:e.getCellBorderSide(nt,"right"),bottom:e.getCellBorderSide(nt,"bottom"),left:e.getCellBorderSide(nt,"left")};if(wt)continue;const Oe={top:Ol(He,Be-1,"bottom"),left:Ol(He-1,Be,"right"),bottom:Ol(He,Be+1,"top"),right:Ol(He+1,Be,"left")},rt=Nt(Oe.top,_e.top),it=Nt(Oe.left,_e.left),kt=Nt(_e.bottom,Oe.bottom),Et=Nt(_e.right,Oe.right),At=(rt==null?void 0:rt.width)??0,we=(it==null?void 0:it.width)??0,ne=(kt==null?void 0:kt.width)??0,Te=(Et==null?void 0:Et.width)??0;At>0&&(Ye.fillStyle=(rt==null?void 0:rt.color)||"#444",Ye.fillRect(Dt,qe,Re,At)),ne>0&&(Ye.fillStyle=(kt==null?void 0:kt.color)||"#444",Ye.fillRect(Dt,qe+dt-ne,Re,ne)),we>0&&(Ye.fillStyle=(it==null?void 0:it.color)||"#444",Ye.fillRect(Dt,qe,we,dt)),Te>0&&(Ye.fillStyle=(Et==null?void 0:Et.color)||"#444",Ye.fillRect(Dt+Re-Te,qe,Te,dt))}},Mn=(Ye,It,Rl,yl,T,Be,He,wt)=>{Rl<=0||yl<=0||(M.save(),M.beginPath(),M.rect(Ye,It,Rl,yl),M.clip(),M.fillStyle=Q.gridBg,M.fillRect(Ye,It,Rl,yl),m(M,T,Be,He,wt,Ql),vt(M,T,Be,He,wt),k(M,Ye,It,Rl,yl),M.restore())};Tt>0&&yt>0&&Mn(z,F,Tt,yt,0,pn,0,hn),yt>0&&Mn(qt,F,Sl,yt,Vl,Jt,0,hn),Tt>0&&Mn(z,al,Tt,ql,0,pn,Hl,il),M.strokeStyle=Q.headerSep,M.lineWidth=1,Tt>0&&(M.beginPath(),M.moveTo(qt+.5,F),M.lineTo(qt+.5,P),M.stroke()),yt>0&&(M.beginPath(),M.moveTo(z,al+.5),M.lineTo(x,al+.5),M.stroke()),M.fillStyle=Q.headerBg,M.fillRect(0,0,z,F),M.strokeStyle=Q.headerSep,M.lineWidth=1,M.strokeRect(.5,.5,z-.5,F-.5),Y(M,Q),K(M,Q)}function Y(s,b){const M=e.selection.value;if(!M||e.editingCell.value)return;const _=e.cellToScreenRect(M.endRow,M.endCol),x=wo(M,M,e.merges),P=_.x+_.width-6/2,z=_.y+_.height-6/2;s.fillStyle=x?b.activeCellBorder:b.scrollTrack,s.fillRect(P,z,6,6),s.strokeStyle="#fff",s.lineWidth=1,s.strokeRect(P+.5,z+.5,6-1,6-1)}function K(s,b){const M=e.autoFillState.value;if(!M.active||!M.preview||!M.targetRange)return;const _=M.targetRange,x=e.cellToScreenRect(_.startRow,_.startCol),P=e.cellToScreenRect(_.endRow,_.endCol),z=x.x,F=x.y,Q=P.x+P.width-z,ke=P.y+P.height-F;s.fillStyle=b.selectionBg,s.fillRect(z,F,Q,ke),s.strokeStyle=b.activeCellBorder,s.lineWidth=1.5,s.setLineDash([4,3]),s.strokeRect(z+.5,F+.5,Q-1,ke-1),s.setLineDash([])}const C=t.computed(()=>ht(e.activeCell.value.col)+String(e.activeCell.value.row+1)),j=t.ref(""),q=t.ref(!1),se=t.computed(()=>e.editingCell.value?j.value:e.getCellRaw(e.activeCell.value.col,e.activeCell.value.row));t.watch(()=>e.editingCell.value,(s,b)=>{if(s&&!b){const M=e.editValue.value||e.getCellRaw(s.col,s.row)||"";j.value=M,ve=!1}else!s&&b&&(j.value="",q.value=!1,ve=!1)},{immediate:!0}),t.watch(()=>[e.activeCell.value.col,e.activeCell.value.row],()=>{e.editingCell.value||(j.value="",ve=!1)});function Fe(){e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),d())}function Qe(s){const b=s.target.value;e.editingCell.value?e.editValue.value=b:e.startEdit(b),j.value=b,ve=!0}function Ge(s){var M,_;const b={...e.activeCell.value};e.editingCell.value?(e.editValue.value=s,e.commitEdit()):((M=e.saveUndo)==null||M.call(e),e.setCellValue(b.col,b.row,s)),j.value="",ve=!1,d(),(_=n.emitModelData)==null||_.call(n)}let be=!1,ve=!1;function Xe(){var P,z,F,Q,ke,Ne,tt,ut,yt;if(be)return;const s=n.formulaBarRef.value,b=!!(s&&typeof document<"u"&&document.activeElement===s);if(!e.editingCell.value&&!b&&!ve)return;const M={...e.activeCell.value},_=e.editingCell.value?e.editingCell.value.col:M.col,x=e.editingCell.value?e.editingCell.value.row:M.row;if(!e.editingCell.value){const Tt=e.getCellRaw(_,x),qt=j.value!==Tt;if(!ve)return;be=!0,qt&&((P=e.saveUndo)==null||P.call(e),e.setCellValue(_,x,j.value),d(),(z=n.emitModelData)==null||z.call(n)),(F=n.formulaBarRef.value)==null||F.blur(),j.value="",q.value=!1,ve=!1,t.nextTick(()=>{be=!1});return}be=!0,ve?(e.editValue.value=j.value,e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),(Q=n.formulaBarRef.value)==null||Q.blur(),j.value="",q.value=!1,ve=!1,d(),n.focusEditInput(),(ke=n.emitModelData)==null||ke.call(n),t.nextTick(()=>{be=!1})):b?(j.value=e.editValue.value,e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),(Ne=n.formulaBarRef.value)==null||Ne.blur(),j.value="",q.value=!1,ve=!1,d(),n.focusEditInput(),(tt=n.emitModelData)==null||tt.call(n),t.nextTick(()=>{be=!1})):(e.commitEdit(),(ut=n.formulaBarRef.value)==null||ut.blur(),j.value="",q.value=!1,ve=!1,d(),n.focusEditInput(),(yt=n.emitModelData)==null||yt.call(n),t.nextTick(()=>{be=!1}))}function Je(){var s;be||(be=!0,e.editingCell.value&&e.cancelEdit(),(s=n.formulaBarRef.value)==null||s.blur(),j.value="",q.value=!1,ve=!1,d(),n.focusEditInput(),t.nextTick(()=>{be=!1}))}function gt(s){if(!s.isComposing){if(s.key==="Enter"&&(s.altKey||s.metaKey)&&!s.ctrlKey){s.preventDefault(),s.stopPropagation();const b=s.target;if(!b)return;e.editingCell.value||e.startEdit();const M=b.selectionStart??b.value.length,_=b.selectionEnd??b.value.length,x=b.value,P=x.substring(0,M)+`
|
|
7
|
-
`+x.substring(_),z=M+1;j.value=P,q.value||(q.value=!0),t.nextTick(()=>{try{b.setSelectionRange(z,z)}catch{}if(q.value)try{b.scrollTop=b.scrollHeight}catch{}try{b.focus({preventScroll:!0})}catch{}});return}s.key==="Enter"?(s.preventDefault(),Xe()):s.key==="Escape"&&(s.preventDefault(),Je())}}function Ze(){Xe()}const lt=t.ref(null),et=t.ref("");function oe(s){lt.value===null&&(n.switchSheet(s),d())}function pe(s){s!==n.activeSheetIndex.value&&(n.saveSheet(),n.loadSheet(s),d()),lt.value=s,et.value=n.sheets.value[s].name,t.nextTick(()=>{const b=document.querySelector(".tab-rename-input");b==null||b.focus(),b==null||b.select()})}function g(){lt.value!==null&&(n.renameSheet(lt.value,et.value),t.nextTick(()=>n.emitModelData())),lt.value=null,et.value=""}function A(){lt.value=null,et.value=""}function L(s){s.key==="Enter"?(s.preventDefault(),g()):s.key==="Escape"&&(s.preventDefault(),A())}const $=t.ref(null);t.watch($,s=>{s===null&&Pe()});const ee=t.ref(null),ie=18,re=2,he=2,ce=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 V(s,b,M,_,x,P){const z=Math.min(P,_/2,x/2);s.beginPath(),s.moveTo(b+z,M),s.arcTo(b+_,M,b+_,M+x,z),s.arcTo(b+_,M+x,b,M+x,z),s.arcTo(b,M+x,b,M,z),s.arcTo(b,M,b+_,M,z),s.closePath()}function c(s,b,M,_,x,P,z){const F=Math.min(_,ie)-re,Q=b+_-F-re,ke=M+re,Ne=x-2*re;s.save(),s.fillStyle=P?z.activeCellBorder:"#ececec",V(s,Q,ke,F,Ne,he),s.fill();const tt=Math.min(F,Ne)*.72;s.translate(Q+F/2,ke+Ne/2),s.scale(tt/1024,tt/1024),s.translate(-512,-512),s.fillStyle=P?"#ffffff":"#5a5a5a",s.fill(ce),s.restore()}function u(s,b){const M=e.getFilter();if(!M)return-1;const _=e.screenToCell(s,b);if(!_)return-1;const{col:x,row:P}=_;if(P!==M.range.startRow||x<M.range.startCol||x>M.range.endCol)return-1;const z=e.cellToScreenRect(P,x),F=Math.min(z.width,ie)-re,Q=z.x+z.width-F-re,ke=z.x+z.width-re;return s>=Q&&s<=ke&&b>=z.y+re&&b<=z.y+z.height-re?x:-1}function p(s){const b=e.getFilter();if(!b)return;const M=n.canvasRef.value;if(!M)return;const _=M.getBoundingClientRect(),x=e.cellToScreenRect(b.range.startRow,s);ee.value={col:s,x:_.left+x.x+x.width-ie,y:_.top+x.y+2}}function H(){ee.value=null}let ct=null,ae=null;function Pe(){ct&&(document.removeEventListener("click",ct),ct=null),ae&&(document.removeEventListener("touchstart",ae,{capture:!0}),ae=null)}function at(s,b,M){Pe();const _=140,x=M.length*28+8,P=window.innerWidth,z=window.innerHeight;s+_>P&&(s-=_),b+x>z&&(b-=x),Mt.value=!1,$.value={x:s,y:b,items:M},t.nextTick(()=>Rt()),ct=()=>{$.value=null,Pe()},ae=F=>{const Q=F.target;Q&&Q.closest(".context-menu")||($.value=null,Pe())},setTimeout(()=>{document.addEventListener("click",ct,{once:!0}),document.addEventListener("touchstart",ae,{capture:!0})},0)}const Mt=t.ref(!1);function St(s,b){}function Rt(){const b=document.querySelector(".context-menu"),M=$.value,_=n.wrapperRef.value;if(!b||!M||!_){Mt.value=!1;return}const x=M.x+140;M.x;const P=_.getBoundingClientRect(),z=b.style.transform;b.style.transform="none";let F=0;if(b.querySelectorAll(".context-menu__item").forEach(ke=>{const Ne=ke.querySelector(":scope > .context-submenu");if(!Ne)return;const tt=Ne.style.display;Ne.style.display="block";const ut=Ne.getBoundingClientRect().width;Ne.style.display=tt,ut>F&&(F=ut)}),b.style.transform=z,F===0){Mt.value=!0;return}const Q=P.right-x;Mt.value=Q<F+8}function Ft(s,b){s.preventDefault(),s.stopPropagation(),at(s.clientX,s.clientY,[{label:D(e.locale.value,"insert"),action:()=>{n.addSheet(),d()}},{label:D(e.locale.value,"copy"),action:()=>{n.dupSheet(b)}},{label:D(e.locale.value,"rename"),action:()=>{pe(b)}},{label:D(e.locale.value,"delete"),action:()=>{n.removeSheet(b),d()},disabled:n.sheetCount.value<=1},{label:D(e.locale.value,"moveSheetLeft"),action:()=>{n.moveSheet(b,-1)},disabled:b===0},{label:D(e.locale.value,"moveSheetRight"),action:()=>{n.moveSheet(b,1)},disabled:b===n.sheets.value.length-1}])}function Yt(s){s.preventDefault(),!(s.target.closest(".tab-item")||s.target.closest(".tab-bar__add-btn"))&&at(s.clientX,s.clientY,[{label:D(e.locale.value,"insert"),action:()=>{n.addSheet(),d()}}])}function nl(s){s.preventDefault(),e.selectAll(),d(),at(s.clientX,s.clientY,[{label:D(e.locale.value,"cut"),action:()=>{o.cutSelected(),n.emitModelData()}},{label:D(e.locale.value,"copy"),action:()=>o.copyToClipboard()},{label:D(e.locale.value,"paste"),action:()=>{l.saveUndo(),o.pasteFromClipboard().then(()=>{d(),t.nextTick(()=>n.emitModelData())})}},{label:D(e.locale.value,"delete"),action:()=>{l.saveUndo(),o.clearSelected();for(let b=0;b<e.colCount;b++)e.colWidths.value[b]=100;for(let b=0;b<e.rowCount;b++)e.rowHeights.value[b]=void 0;d(),n.emitModelData()}}])}function Cl(s,b){s.preventDefault();const M=s.clientX,_=s.clientY,x=e.selection.value;x&&x.startCol===0&&x.endCol===e.colCount-1&&b>=x.startRow&&b<=x.endRow||(e.selectRange(0,b,e.colCount-1,b,"row"),d());const P=e.selection.value;at(s.clientX,s.clientY,[{label:D(e.locale.value,"insert"),action:()=>{l.saveUndo(),n.insertRows(P.startRow,P.endRow),d(),n.emitModelData()}},{label:D(e.locale.value,"cut"),action:()=>{l.saveUndo(),o.copyRowCol(),e.clearCellsInRange(0,e.colCount-1,P.startRow,P.endRow),d(),n.emitModelData()}},{label:D(e.locale.value,"copy"),action:()=>o.copyRowCol()},{label:D(e.locale.value,"paste"),action:()=>{l.saveUndo(),o.pasteFromClipboard().then(()=>{d(),t.nextTick(()=>n.emitModelData())})}},{label:D(e.locale.value,"delete"),action:()=>{l.saveUndo(),n.deleteRows(P.startRow,P.endRow),d(),n.emitModelData()}},{label:`${D(e.locale.value,"rowHeight")}...`,action:()=>Gl("row",M,_)},{label:D(e.locale.value,"autoRowHeight"),action:()=>n.resetRowHeight()},{label:D(e.locale.value,"freezeToRow"),action:()=>{e.setFreeze(b+1,e.freeze.cols),d()}}])}function Dl(s,b){s.preventDefault();const M=s.clientX,_=s.clientY,x=e.selection.value;x&&x.startRow===0&&x.endRow===e.rowCount-1&&b>=x.startCol&&b<=x.endCol||(e.selectRange(b,0,b,e.rowCount-1,"col"),d());const P=e.selection.value,z=!n.canSortColumns(P.startCol,P.endCol);at(s.clientX,s.clientY,[{label:D(e.locale.value,"insert"),action:()=>{l.saveUndo(),n.insertCols(P.startCol,P.endCol),d(),n.emitModelData()}},{label:D(e.locale.value,"cut"),action:()=>{l.saveUndo(),o.copyRowCol(),e.clearCellsInRange(P.startCol,P.endCol,0,e.rowCount-1),d(),n.emitModelData()}},{label:D(e.locale.value,"copy"),action:()=>o.copyRowCol()},{label:D(e.locale.value,"paste"),action:()=>{l.saveUndo(),o.pasteFromClipboard().then(()=>{d(),t.nextTick(()=>n.emitModelData())})}},{label:D(e.locale.value,"delete"),action:()=>{l.saveUndo(),n.deleteCols(P.startCol,P.endCol),d(),n.emitModelData()}},{label:D(e.locale.value,"sort"),disabled:z,children:[{label:D(e.locale.value,"sortAsc"),action:()=>{n.prepareSortConfirmation("asc")||n.sortSelectedColumns("asc")},disabled:z},{label:D(e.locale.value,"sortDesc"),action:()=>{n.prepareSortConfirmation("desc")||n.sortSelectedColumns("desc")},disabled:z}]},{label:`${D(e.locale.value,"colWidth")}...`,action:()=>Gl("col",M,_)},{label:D(e.locale.value,"defaultColWidth"),action:()=>n.resetColWidth()},{label:D(e.locale.value,"freezeToCol"),action:()=>{e.setFreeze(e.freeze.rows,b+1),d()}}])}function cl(s,b,M){s.preventDefault(),e.isSelected(b,M)||(e.selectCell(b,M),d());const _=e.selection.value,x=!!(_&&_.startCol===_.endCol&&_.startRow===_.endRow);at(s.clientX,s.clientY,[{label:D(e.locale.value,"cut"),action:()=>{o.cutSelected(),n.emitModelData()}},{label:D(e.locale.value,"copy"),action:()=>o.copyToClipboard()},{label:D(e.locale.value,"paste"),action:()=>{l.saveUndo(),o.pasteFromClipboard().then(()=>{d(),t.nextTick(()=>n.emitModelData())})}},{label:D(e.locale.value,"delete"),action:()=>{l.saveUndo(),o.clearSelected(),d(),n.emitModelData()}},{label:D(e.locale.value,"calculate"),children:[{label:D(e.locale.value,"sum"),action:o.sumSelected,disabled:x},{label:D(e.locale.value,"avg"),action:o.avgSelected,disabled:x},{label:D(e.locale.value,"count"),action:o.countSelected,disabled:x}]}])}const wl=t.ref(null),ol=t.ref(null);let fl=null,Xt=null;function Kl(){fl&&(document.removeEventListener("mousedown",fl),fl=null),Xt&&(document.removeEventListener("touchstart",Xt),Xt=null)}function Gl(s,b,M){Kl();const _=e.selection.value;let x="";if(_){const ke=s==="row"?e.getRowHeight(_.startRow):e.colWidths.value[_.startCol];x=ke!=null&&ke>0?String(Math.round(ke)):""}const P=220,z=118;let F=b,Q=M;F+P>window.innerWidth&&(F=window.innerWidth-P-8),Q+z>window.innerHeight&&(Q=window.innerHeight-z-8),F<8&&(F=8),Q<8&&(Q=8),ol.value={type:s,x:F,y:Q,value:x,error:""},fl=()=>{ol.value=null},Xt=()=>{ol.value=null},setTimeout(()=>{document.addEventListener("mousedown",fl,{once:!0}),document.addEventListener("touchstart",Xt,{once:!0})},0),t.nextTick(()=>{const ke=wl.value;ke&&(ke.focus(),ke.select())})}function Yl(s){const b=ol.value;if(!b)return;const M=s.target,_=M.value,x=_.replace(/[^\d]/g,"");b.value=x,_!==x&&(M.value=x),b.error=""}function sn(s){s.key==="Enter"?(s.preventDefault(),N()):s.key==="Escape"&&(s.preventDefault(),O())}function I(){const s=ol.value;if(!s)return;const b=s.value.trim(),M=Number(b),_=s.type==="row",x=_?24:30,P=_?500:1e3;if(b===""||!Number.isFinite(M)){O();return}const z=Math.max(x,Math.min(P,Math.round(M)));s.value=String(z),s.error=""}function N(){const s=ol.value,b=e.selection.value;if(!s||!b)return;const M=s.value.trim(),_=Number(M),x=s.type==="row",P=x?24:30,z=x?500:1e3;if(M===""||!Number.isFinite(_)){s.error=D(e.locale.value,"dimNumberError");return}if(_<P||_>z){s.error=D(e.locale.value,"dimRangeError").replace("{min}",String(P)).replace("{max}",String(z));return}const F=_;if(l.saveUndo(),x)for(let Q=b.startRow;Q<=b.endRow;Q++)e.rowHeights.value[Q]=F;else for(let Q=b.startCol;Q<=b.endCol;Q++)e.colWidths.value[Q]=F;d(),n.emitModelData(),O()}function O(){Kl(),ol.value=null}const de=t.computed(()=>{const s=!e.editingCell.value,b=e.editingCell.value??e.activeCell.value,M=b.col,_=b.row,x=e.resolveStyle(e.cells[e.cellKey(M,_)]),P=e.cellFontSize(M,_),z=typeof(x==null?void 0:x.fontFamily)=="string"&&x.fontFamily?x.fontFamily:Cn,F=(x==null?void 0:x.fontWeight)==="bold"?"bold":"normal",Q=(x==null?void 0:x.fontStyle)==="italic"?"italic":"normal",ke=(x==null?void 0:x.underline)==="underline"?"underline":(x==null?void 0:x.strikethrough)==="line-through"?"line-through":"none",Ne=(x==null?void 0:x.underline)==="underline"&&(x==null?void 0:x.strikethrough)==="line-through"?"underline line-through":ke,tt=typeof(x==null?void 0:x.color)=="string"?x.color:void 0,ut=typeof(x==null?void 0:x.backgroundColor)=="string"?x.backgroundColor:void 0,yt=typeof(x==null?void 0:x.numberFormat)=="string"?x.numberFormat:"",Tt=e.editValue.value??e.getCellValue(M,_),qt=typeof(x==null?void 0:x.textAlign)=="string"?x.textAlign:io(Tt,yt)?"right":"left",al=typeof(x==null?void 0:x.verticalAlign)=="string"?x.verticalAlign:"top",Sl=e.findMerge(M,_),ql=Sl?e.rowPositions.value[Sl.range.endRow+1]-e.rowPositions.value[_]:e.getRowHeight(_),pn=2,{ascent:hn,descent:gn}=e.measureFontMetrics(z,P,F,Q),Jl=hn+gn,gl=(e.editValue.value?e.editValue.value.split(`
|
|
8
|
-
`).length:1)*Jl,Al=e.BASE_CELL_VPAD-pn;let Jt=0,Qt=0;al==="middle"?(Jt=Math.floor((ql-gl)/2),Qt=Math.max(0,ql-gl-Jt)):al==="top"?(Jt=Al,Qt=Math.max(0,ql-gl-Jt)):al==="bottom"&&(Qt=Al,Jt=Math.max(0,ql-gl-Qt));const il=e.cellToScreenRect(_,M);return{left:`${il.x}px`,top:`${il.y}px`,width:`${il.width}px`,height:`${il.height}px`,fontFamily:z,fontSize:`${P}px`,lineHeight:1,fontWeight:F,fontStyle:Q,textDecoration:Ne,textAlign:qt,paddingTop:`${Jt}px`,paddingRight:"3px",paddingBottom:`${Qt}px`,paddingLeft:"3px",opacity:s?0:1,pointerEvents:s?"none":"auto",color:s?"transparent":tt,caretColor:s?"transparent":void 0,borderColor:s?"transparent":void 0,background:s?"transparent":ut,boxShadow:s?"none":void 0}});function ge(){return Math.max(0,n.viewSize.w-52-11)}function Me(){return Math.max(0,n.viewSize.h-24-11)}const Ee=t.computed(()=>Math.max(0,ge()-e.getFrozenMetrics().frozenColumnsWidth)),fe=t.computed(()=>Math.max(0,Me()-e.getFrozenMetrics().frozenRowsHeight)),Z=t.computed(()=>52+e.getFrozenMetrics().frozenColumnsWidth),ze=t.computed(()=>24+e.getFrozenMetrics().frozenRowsHeight),$e=t.computed(()=>Math.max(0,Ee.value-11*2)),le=t.computed(()=>Math.max(0,fe.value-11*2)),Ke=t.computed(()=>n.maxScrollX.value<=0?$e.value:Math.max(24,Ee.value/e.totalWidth.value*$e.value)),ft=t.computed(()=>n.maxScrollX.value<=0?0:e.scrollX.value/n.maxScrollX.value*($e.value-Ke.value)),E=t.computed(()=>n.maxScrollY.value<=0?le.value:Math.max(24,fe.value/e.totalHeight.value*le.value)),U=t.computed(()=>n.maxScrollY.value<=0?0:e.scrollY.value/n.maxScrollY.value*(le.value-E.value));let J=null,ue=0,ye=0;function me(s){s.preventDefault(),J="v",ue=s.clientY,ye=e.scrollY.value,document.addEventListener("mousemove",We),document.addEventListener("mouseup",st)}function Se(s){s.preventDefault(),J="h",ue=s.clientX,ye=e.scrollX.value,document.addEventListener("mousemove",We),document.addEventListener("mouseup",st)}function We(s){if(J==="v"){const M=(s.clientY-ue)/(le.value-E.value);n.clampScroll(null,ye+M*n.maxScrollY.value),d()}else if(J==="h"){const M=(s.clientX-ue)/($e.value-Ke.value);n.clampScroll(ye+M*n.maxScrollX.value,null),d()}}function st(){J=null,document.removeEventListener("mousemove",We),document.removeEventListener("mouseup",st)}function Bt(s){if(J)return;const b=s.currentTarget.getBoundingClientRect(),M=s.clientY-b.top;M<U.value?n.clampScroll(null,e.scrollY.value-Me()):M>U.value+E.value&&n.clampScroll(null,e.scrollY.value+Me()),d()}function zt(s){if(J)return;const b=s.currentTarget.getBoundingClientRect(),M=s.clientX-b.left;M<ft.value?n.clampScroll(e.scrollX.value-ge(),null):M>ft.value+Ke.value&&n.clampScroll(e.scrollX.value+ge(),null),d()}let jt=!1,Vt=0,Ht=0,_t=!1,Pt=!1,Xl=0,un=0,vl=0,Nl=0,kn=0,En=0,In=0,An=0,Ut=!1,Fl=!1,bt=0,Ct=0,Kt="cell",dn=0,Qn=-1,eo=-1,rl=null,kl=!1,ml=0,Zt=0,jl=!1,pl=null,fn=null,De=0,h=0;function S(s,b){const M=e.selection.value;if(!M||e.editingCell.value||!wo(M,M,e.merges))return!1;const _=e.cellToScreenRect(M.endRow,M.endCol),x=_.x+_.width-6,P=_.y+_.height-6,z=4;return s>=x-z&&s<=x+6+z&&b>=P-z&&b<=P+6+z}function B(){pl=requestAnimationFrame(W)}function W(){if(!e.autoFillState.value.active||!fn){pl=null;return}const s=8;n.clampScroll(e.scrollX.value+fn.x*s*.1,e.scrollY.value+fn.y*s*.1);const b=e.screenToCell(De,h),M=e.autoFillState.value.sourceRange;if(b&&M){const _=tr(M,{col:b.col,row:b.row});_?e.autoFillState.value={...e.autoFillState.value,targetRange:_.targetRange,direction:_.direction}:e.autoFillState.value={...e.autoFillState.value,targetRange:null,direction:null}}d(),pl=requestAnimationFrame(W)}function X(){pl!==null&&(cancelAnimationFrame(pl),pl=null),fn=null}function Ce(s,b){De=s,h=b;const M=e.screenToCell(s,b),_=e.autoFillState.value.sourceRange;if(M&&_){const ke=tr(_,{col:M.col,row:M.row});ke?e.autoFillState.value={...e.autoFillState.value,targetRange:ke.targetRange,direction:ke.direction}:e.autoFillState.value={...e.autoFillState.value,targetRange:null,direction:null}}const x=30,P=n.viewSize.w,z=n.viewSize.h;let F=0,Q=0;s<52+x?F=-(52+x-s):s>P-11-x&&(F=s-(P-11-x)),b<24+x?Q=-(24+x-b):b>z-11-x&&(Q=b-(z-11-x)),F!==0||Q!==0?(fn={x:F,y:Q},pl===null&&B()):(fn=null,pl!==null&&(cancelAnimationFrame(pl),pl=null)),d()}function xe(){X();const s=e.autoFillState.value;s.targetRange&&s.direction&&s.sourceRange&&e.applyAutoFill(s.sourceRange,s.targetRange,s.direction),e.autoFillState.value={active:!1,sourceRange:null,targetRange:null,direction:null,preview:!1}}function Ie(s){if(s.button!==0)return;s.preventDefault(),$.value=null;const b=an(s,n.canvasRef.value),M=u(b.x,b.y);if(M>=0){p(M);return}if(b.y<24&&b.x>=52){const z=b.x-52+e.scrollX.value,F=w(b.x),Q=F>=0?e.cellToScreenRect(0,F).x+e.colWidths.value[F]:-1;if(F>=0&&Math.abs(b.x-Q)<=4){l.saveUndo(),_t=!0,Xl=F,vl=e.colWidths.value[F],Nl=z,d();return}}if(b.x<52&&b.y>=24){const z=b.y-24+e.scrollY.value,F=v(b.y),Q=F>=0?e.cellToScreenRect(F,0).y+e.getRowHeight(F):-1;if(F>=0&&Math.abs(b.y-Q)<=4){l.saveUndo(),Pt=!0,un=F,vl=e.getRowHeight(F),Nl=z,d();return}}if(S(b.x,b.y)){const z=e.selection.value;z&&(e.autoFillState.value={active:!0,sourceRange:{...z},targetRange:null,direction:null,preview:!0},d());return}if(b.x<52||b.y<24){{const z=n.formulaBarRef.value,F=!!(z&&typeof document<"u"&&document.activeElement===z);(e.editingCell.value||F||ve)&&Xe()}if(b.y<24&&b.x>=52){const z=w(b.x);z>=0&&(e.selectRange(z,0,z,e.rowCount-1,"col"),jt=!0,Vt=z,Ht=0)}else if(b.x<52&&b.y>=24){const z=v(b.y);z>=0&&(e.selectRange(0,z,e.colCount-1,z,"row"),jt=!0,Vt=0,Ht=z)}else b.x<52&&b.y<24&&e.selectAll();d();return}const _=e.screenToCell(b.x,b.y);if(!_)return;const x=_.col,P=_.row;{const z=n.formulaBarRef.value,F=!!(z&&typeof document<"u"&&document.activeElement===z);(e.editingCell.value||F||ve)&&Xe()}if(s.shiftKey&&e.selection.value){const z=e.selection.value;e.selectRange(z.startCol,z.startRow,x,P)}else e.selectCell(x,P);jt=!0,Vt=x,Ht=P,n.focusEditInput(),d()}function Ve(s){if(_t){const z=an(s,n.canvasRef.value).x-52+e.scrollX.value-Nl,F=vl+z;F>=30&&F<=1e3?e.colWidths.value[Xl]=F:F<30?e.colWidths.value[Xl]=30:e.colWidths.value[Xl]=1e3,d();return}if(Pt){const z=an(s,n.canvasRef.value).y-24+e.scrollY.value-Nl,F=vl+z;F>=24&&F<=500?e.rowHeights.value[un]=F:F<24?e.rowHeights.value[un]=24:e.rowHeights.value[un]=500,d();return}if(e.autoFillState.value.active){const P=an(s,n.canvasRef.value);Ce(P.x,P.y);return}if(!jt){const P=n.canvasRef.value;if(!P)return;if(l.paintFmt.value){P.style.cursor="copy";return}const z=an(s,P);if(u(z.x,z.y)>=0){P.style.cursor="pointer";return}if(z.y<24&&z.x>=52){const F=w(z.x),Q=F>=0?e.cellToScreenRect(0,F).x+e.colWidths.value[F]:-1;if(F>=0&&Math.abs(z.x-Q)<=4){P.style.cursor="col-resize";return}}if(z.x<52&&z.y>=24){const F=v(z.y),Q=F>=0?e.cellToScreenRect(F,0).y+e.getRowHeight(F):-1;if(F>=0&&Math.abs(z.y-Q)<=4){P.style.cursor="row-resize";return}}if(S(z.x,z.y)){P.style.cursor="crosshair";return}P.style.cursor="cell";return}const b=an(s,n.canvasRef.value);if(Vt<0||Ht<0)return;if(b.x<52||b.y<24){if(b.y<24&&b.x>=52){const P=w(b.x);P>=0&&e.selectRange(Math.min(Vt,P),0,Math.max(Vt,P),e.rowCount-1,"col")}else if(b.x<52&&b.y>=24){const P=v(b.y);P>=0&&e.selectRange(0,Math.min(Ht,P),e.colCount-1,Math.max(Ht,P),"row")}d();return}const M=e.screenToCell(b.x,b.y);if(!M)return;const _=M.col,x=M.row;Ht===0&&Vt>=0&&e.selection.value&&e.selection.value.startRow===0&&e.selection.value.endRow===e.rowCount-1?e.selectRange(Math.min(Vt,_),0,Math.max(Vt,_),e.rowCount-1,"col"):Vt===0&&Ht>=0&&e.selection.value&&e.selection.value.startCol===0&&e.selection.value.endCol===e.colCount-1?e.selectRange(0,Math.min(Ht,x),e.colCount-1,Math.max(Ht,x),"row"):e.selectRange(Vt,Ht,_,x),d()}function Le(s){const b=_t||Pt;if(jt=!1,_t=!1,Pt=!1,b&&n.scheduleOptEmit(),e.autoFillState.value.active){xe();return}l.paintFmt.value&&l.applyPaintFormat()}function Ue(){X();const s=_t||Pt;jt=!1,_t=!1,Pt=!1,s&&n.scheduleOptEmit()}function mt(s){s.preventDefault();const b=an(s,n.canvasRef.value);if(b.x<52&&b.y<24){nl(s);return}if(b.y<24&&b.x>=52){const M=w(b.x);M>=0&&Dl(s,M);return}if(b.x<52&&b.y>=24){const M=v(b.y);M>=0&&Cl(s,M);return}if(b.x>=52&&b.y>=24){const M=e.screenToCell(b.x,b.y);M&&cl(s,M.col,M.row)}}function je(s){const b=an(s,n.canvasRef.value);if(b.x<52||b.y<24)return;const M=e.screenToCell(b.x,b.y);if(!M)return;const _=M.col,x=M.row;{const P=n.formulaBarRef.value,z=!!(P&&typeof document<"u"&&document.activeElement===P);(e.editingCell.value||z||ve)&&Xe()}e.selectCell(_,x),e.ensureVisible(_,x),e.startEdit(),d(),n.focusEditInput()}function pt(s){const b=e.scrollX.value+s.deltaX,M=e.scrollY.value+s.deltaY,_=40,x=n.maxScrollX.value,P=n.maxScrollY.value;if(b>=x-_&&s.deltaX>0||M>=P-_&&s.deltaY>0){const z=Math.max(0,n.viewSize.w-28-11),F=Math.max(0,n.viewSize.h-28-11),Q=Math.max(0,Math.ceil((b+z)/100)+2),ke=Math.max(0,Math.ceil((M+F)/24)+2);e.ensureCapacity(Q,ke)}n.clampScroll(b,M),d()}function Ot(s){if(s.touches.length!==1){Ut=!1;return}const b=s.touches[0],M=n.canvasRef.value;if(!M)return;const _=M.getBoundingClientRect(),x=b.clientX-_.left,P=b.clientY-_.top,z=b.clientX,F=b.clientY,Q=(Ne,tt)=>({clientX:Ne,clientY:tt,preventDefault(){}});{const Ne=n.formulaBarRef.value,tt=!!(Ne&&typeof document<"u"&&document.activeElement===Ne);(e.editingCell.value||tt||ve)&&Xe()}if(S(x,P)){s.preventDefault();const Ne=e.selection.value;Ne&&(e.autoFillState.value={active:!0,sourceRange:{...Ne},targetRange:null,direction:null,preview:!0},Ut=!0,Fl=!1,Kt="cell",kn=x,En=P,In=e.scrollX.value,An=e.scrollY.value);return}const ke=u(x,P);if(ke>=0){s.preventDefault(),p(ke);return}if(P<24&&x>=52){const Ne=w(x);if(Ne>=0){const tt=e.cellToScreenRect(0,Ne).x+e.colWidths.value[Ne];if(Math.abs(x-tt)<=8){s.preventDefault(),l.saveUndo(),_t=!0,Xl=Ne,vl=e.colWidths.value[Ne],Nl=x-52+e.scrollX.value,Ut=!0,Fl=!1;return}}}if(x<52&&P>=24){const Ne=v(P);if(Ne>=0){const tt=e.cellToScreenRect(Ne,0).y+e.getRowHeight(Ne);if(Math.abs(P-tt)<=8){s.preventDefault(),l.saveUndo(),Pt=!0,un=Ne,vl=e.getRowHeight(Ne),Nl=P-24+e.scrollY.value,Ut=!0,Fl=!1;return}}}x>=52&&P>=24?(s.preventDefault(),Ut=!0,Fl=!1,kl=!1,jl=!1,Kt="cell",kn=x,En=P,In=e.scrollX.value,An=e.scrollY.value,bt=w(x),Ct=v(P),rl!==null&&clearTimeout(rl),rl=window.setTimeout(()=>{const Ne=e.selection.value;if(!!Ne&&bt>=Ne.startCol&&bt<=Ne.endCol&&Ct>=Ne.startRow&&Ct<=Ne.endRow){jl=!0,cl(Q(z,F),bt,Ct);return}kl=!0,ml=bt,Zt=Ct,bt>=0&&Ct>=0&&(e.selectCell(bt,Ct),d())},450)):x>=0&&P>=0&&(x<52||P<24)&&(s.preventDefault(),Ut=!0,Fl=!1,kl=!1,kn=x,En=P,In=e.scrollX.value,An=e.scrollY.value,P<24&&x>=52?(Kt="col",bt=w(x),Ct=-1):x<52&&P>=24?(Kt="row",Ct=v(P),bt=-1):(Kt="all",bt=-1,Ct=-1),(Kt==="col"||Kt==="row"||Kt==="all")&&(rl!==null&&clearTimeout(rl),rl=window.setTimeout(()=>{const Ne=e.selection.value;if(Kt==="all"){jl=!0,nl(Q(z,F));return}if(Kt==="col"){if(!!Ne&&Ne.startRow===0&&Ne.endRow===e.rowCount-1&&bt>=Ne.startCol&&bt<=Ne.endCol){jl=!0,Dl(Q(z,F),bt);return}kl=!0,ml=bt,Zt=-1,bt>=0&&(e.selectRange(bt,0,bt,e.rowCount-1,"col"),d())}else{if(!!Ne&&Ne.startCol===0&&Ne.endCol===e.colCount-1&&Ct>=Ne.startRow&&Ct<=Ne.endRow){jl=!0,Cl(Q(z,F),Ct);return}kl=!0,ml=-1,Zt=Ct,Ct>=0&&(e.selectRange(0,Ct,e.colCount-1,Ct,"row"),d())}},450)))}function Sn(s){if(!Ut||s.touches.length!==1)return;const b=s.touches[0],M=n.canvasRef.value;if(!M)return;const _=M.getBoundingClientRect(),x=b.clientX-_.left,P=b.clientY-_.top;if(e.autoFillState.value.active){s.preventDefault(),Ce(x,P);return}if(_t){const z=x-52+e.scrollX.value-Nl;let F=vl+z;F=F<30?30:F>1e3?1e3:F,e.colWidths.value[Xl]=F,s.preventDefault(),d();return}if(Pt){const z=P-24+e.scrollY.value-Nl;let F=vl+z;F=F<24?24:F>500?500:F,e.rowHeights.value[un]=F,s.preventDefault(),d();return}if(kl){if(s.preventDefault(),ml>=0&&Zt>=0){const z=w(x),F=v(P);z>=0&&F>=0&&(e.selectRange(ml,Zt,z,F),d())}else if(Zt===-1&&ml>=0){const z=w(x);z>=0&&(e.selectRange(Math.min(ml,z),0,Math.max(ml,z),e.rowCount-1,"col"),d())}else if(ml===-1&&Zt>=0){const z=v(P);z>=0&&(e.selectRange(0,Math.min(Zt,z),e.colCount-1,Math.max(Zt,z),"row"),d())}return}rl!==null&&(clearTimeout(rl),rl=null),(Math.abs(x-kn)>8||Math.abs(P-En)>8)&&(Fl=!0,s.preventDefault(),n.clampScroll(In+(kn-x),An+(En-P)),d())}function El(){if(Ut){if(rl!==null&&(clearTimeout(rl),rl=null),jl){jl=!1,Ut=!1;return}if(e.autoFillState.value.active){xe(),Ut=!1;return}if(_t||Pt){_t=!1,Pt=!1,n.scheduleOptEmit(),l.paintFmt.value&&l.applyPaintFormat(),Ut=!1;return}if(kl){kl=!1,l.paintFmt.value&&l.applyPaintFormat(),Ut=!1;return}if(Ut=!1,!Fl){if(Kt==="cell"&&bt>=0&&Ct>=0){const s=Date.now();bt===Qn&&Ct===eo&&s-dn<300?(e.selectCell(bt,Ct),e.startEdit(),d(),n.focusEditInput(),dn=0):(e.commitEdit(),e.selectCell(bt,Ct),d(),dn=s),Qn=bt,eo=Ct,n.focusEditInput()}else Kt==="col"&&bt>=0?(e.commitEdit(),e.selectRange(bt,0,bt,e.rowCount-1,"col"),d()):Kt==="row"&&Ct>=0?(e.commitEdit(),e.selectRange(0,Ct,e.colCount-1,Ct,"row"),d()):Kt==="all"&&(e.commitEdit(),e.selectAll(),d());l.paintFmt.value&&!e.editingCell.value&&l.applyPaintFormat()}}}function mn(s){return s.isComposing||s.key==="Process"||s.keyCode===229}function Rn(s){return s.key.length===1&&!s.ctrlKey&&!s.metaKey&&!s.altKey}function Zl(s){if(e.autoFillState.value.active){s.key==="Escape"&&(s.preventDefault(),X(),e.autoFillState.value={active:!1,sourceRange:null,targetRange:null,direction:null,preview:!1},d());return}if(e.editingCell.value)return;const b=s.ctrlKey||s.metaKey,M=s.shiftKey;switch(!0){case(b&&(s.key==="c"||s.key==="C")):s.preventDefault(),o.copyToClipboard();return;case(b&&(s.key==="x"||s.key==="X")):s.preventDefault(),o.cutSelected();return;case(b&&(s.key==="z"||s.key==="Z")):s.preventDefault(),l.undo();return;case(b&&(s.key==="y"||s.key==="Y")):s.preventDefault(),l.redo();return;case(b&&(s.key==="v"||s.key==="V")):s.preventDefault(),l.saveUndo(),o.pasteFromClipboard().then(()=>{d(),t.nextTick(()=>n.emitModelData())});return;case(b&&(s.key==="a"||s.key==="A")):s.preventDefault(),e.selectAll(),d();return;case(b&&M&&(s.key==="l"||s.key==="L")):s.preventDefault(),e.toggleAutoFilter(),d();return;case(b&&s.key==="Home"):s.preventDefault(),e.selectCell(0,0),e.ensureVisible(0,0),d();return;case(b&&s.key==="End"):s.preventDefault(),e.selectCell(e.colCount-1,e.rowCount-1),e.ensureVisible(e.colCount-1,e.rowCount-1),d();return;case s.key==="Home":s.preventDefault(),e.selectCell(0,e.activeCell.value.row),e.ensureVisible(0,e.activeCell.value.row),d();return;case s.key==="End":s.preventDefault(),e.selectCell(e.colCount-1,e.activeCell.value.row),e.ensureVisible(e.colCount-1,e.activeCell.value.row),d();return;case s.key==="ArrowUp":s.preventDefault(),e.moveActive(0,-1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),d();return;case s.key==="ArrowDown":s.preventDefault(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),d();return;case s.key==="ArrowLeft":s.preventDefault(),e.moveActive(-1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),d();return;case s.key==="ArrowRight":s.preventDefault(),e.moveActive(1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),d();return;case s.key==="Tab":s.preventDefault(),e.moveActive(M?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),d();return;case s.key==="Enter":s.preventDefault(),e.moveActive(0,M?-1:1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),d();return;case s.key==="F2":s.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),d(),n.focusEditInput();return;case s.key==="Delete":case s.key==="Backspace":s.preventDefault(),l.saveUndo(),o.clearSelected(),d();return;case s.key==="Escape":s.preventDefault(),e.cancelEdit(),l.paintFmt.value=null,d();return;case Rn(s):if(mn(s)){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),d(),n.focusEditInput();return}s.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(s.key),d(),t.nextTick(()=>{const _=n.editInputRef.value;_&&(_.focus(),_.setSelectionRange(1,1))});return}}let Wn=!1,Il=!1;function Vn(s){const b=s.target.value;if(!e.editingCell.value){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(b),j.value=b,d();return}e.editValue.value=b,j.value=b}function Pn(){Wn=!0,e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),j.value="",d())}function hr(s){Wn=!1,Il=!0,setTimeout(()=>{Il=!1},0);const b=s.target.value;e.editValue.value=b,j.value=b}function Au(s){if(!e.editingCell.value){if(Rn(s)||mn(s))return;Zl(s);return}if(!(Wn||mn(s))&&!(Il&&(s.key==="Enter"||s.key==="Escape")))if(s.key==="Enter"&&(s.altKey||s.metaKey)){s.preventDefault();const b=n.editInputRef.value;if(!b)return;const M=b.selectionStart??b.value.length,_=b.selectionEnd??b.value.length,x=b.value,P=x.slice(0,M)+`
|
|
9
|
-
`+x.slice(_);e.editValue.value=P,b.value=P,b.selectionStart=b.selectionEnd=M+1,d()}else s.key==="Enter"?(s.preventDefault(),e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),d(),n.focusEditInput()):s.key==="Tab"?(s.preventDefault(),e.commitEdit(),e.moveActive(s.shiftKey?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),d(),n.focusEditInput()):s.key==="Escape"&&(s.preventDefault(),e.cancelEdit(),d(),n.focusEditInput())}function Vu(s){e.editingCell.value}function Hu(){setTimeout(()=>{e.editingCell.value&&(e.commitEdit(),d())},0)}let hl=null;function Un(){var b;const s=(b=n.wrapperRef.value)==null?void 0:b.getBoundingClientRect();if(s){const M=wn(e.props.width),_=wn(e.props.height);M!=null?n.viewSize.w=M:n.viewSize.w=s.width,_!=null?n.viewSize.h=_:n.viewSize.h=s.height}n.clampScroll(null,null),d()}function Ou(){t.onMounted(()=>{const s=wn(e.props.width),b=wn(e.props.height);(s==null||b==null)&&(hl=new ResizeObserver(()=>Un()),n.wrapperRef.value&&hl.observe(n.wrapperRef.value)),t.nextTick(()=>{Un(),n.focusEditInput()}),e.selectCell(0,0),n.modelData.value&&n.modelData.value.length>0&&(a.value=JSON.stringify(n.modelData.value),n.sheets.value=n.modelData.value.map(M=>{const _=n.mkSheet(M.name,{colCount:M.colCount,rowCount:M.rowCount}),{cells:x,styles:P}=rr(M.cells);if(Object.assign(_.cells,x),_.styles=M.styles??P,M.borders)_.borders=M.borders;else{const z=ar(_.styles);_.styles=z.styles,_.borders=z.borders}if(M.colWidths)for(const[z,F]of Object.entries(M.colWidths)){const Q=Number(z);Q>=0&&Q<(_.colCount??e.colCount)&&F>=30&&(_.colWidths[Q]=F)}if(M.rowHeights)for(const[z,F]of Object.entries(M.rowHeights)){const Q=Number(z);Q>=0&&Q<(_.rowCount??e.rowCount)&&F>=24&&(_.rowHeights[Q]=F)}if(M.merges)for(const[z,F]of Object.entries(M.merges))_.merges[z]={...F};return _.freeze=M.freeze?{rows:M.freeze.rows,cols:M.freeze.cols}:{rows:0,cols:0},_.filter=fr(M.filter,_.cells),_}),n.sheets.value.length>0&&n.loadSheet(0))}),t.watch(()=>[e.props.width,e.props.height],()=>{const s=wn(e.props.width),b=wn(e.props.height);s!=null&&b!=null?(hl==null||hl.disconnect(),hl=null):!hl&&n.wrapperRef.value&&(hl=new ResizeObserver(()=>Un()),hl.observe(n.wrapperRef.value)),t.nextTick(()=>Un())}),t.watch(()=>e.props.theme,()=>d()),t.watch(()=>({...e.cells}),()=>t.nextTick(()=>n.emitModelData()),{deep:!1}),t.watch(()=>({...e.merges}),()=>{t.nextTick(()=>n.emitModelData()),d()},{deep:!1}),t.watch(n.activeSheetIndex,()=>t.nextTick(()=>n.emitModelData())),t.watch(()=>n.modelData.value,s=>{if(!s||s.length===0)return;const b=JSON.stringify(s);if(b===a.value)return;a.value=b;const M=e.selection.value?{...e.selection.value}:null,_={...e.activeCell.value};n.sheets.value=s.map(F=>{const Q=n.mkSheet(F.name),{cells:ke,styles:Ne}=rr(F.cells);if(Object.assign(Q.cells,ke),Q.styles=F.styles??Ne,F.borders)Q.borders=F.borders;else{const tt=ar(Q.styles);Q.styles=tt.styles,Q.borders=tt.borders}if(F.colWidths)for(const[tt,ut]of Object.entries(F.colWidths)){const yt=Number(tt);yt>=0&&yt<e.colCount&&ut>=30&&(Q.colWidths[yt]=ut)}if(F.rowHeights)for(const[tt,ut]of Object.entries(F.rowHeights)){const yt=Number(tt);yt>=0&&yt<e.rowCount&&ut>=24&&(Q.rowHeights[yt]=ut)}if(F.merges)for(const[tt,ut]of Object.entries(F.merges))Q.merges[tt]={...ut};return Q.freeze=F.freeze?{rows:F.freeze.rows,cols:F.freeze.cols}:{rows:0,cols:0},Q.filter=fr(F.filter,Q.cells),Q}),n.sheets.value.length>0&&n.loadSheet(0),M&&(e.selection.value=M),e.activeCell.value=_;const x=e.activeCell.value,P=e.selection.value,z=e.findMerge(x.col,x.row);z&&z.anchor===e.cellKey(x.col,x.row)&&(!P||P.startCol===x.col&&P.startRow===x.row&&P.endCol===x.col&&P.endRow===x.row)&&e.selectCell(x.col,x.row),d()},{deep:!0}),t.onBeforeUnmount(()=>{hl==null||hl.disconnect()})}return{scheduleRender:d,render:G,renderFrozenOverlay:te,activeCellLabel:C,formulaBarDisplay:se,formulaBarDraft:j,formulaBarExpanded:q,onFormulaBarFocus:Fe,onFormulaBarInput:Qe,onFormulaBarKeydown:gt,onFormulaBarBlur:Ze,acceptFormulaBarEdit:Xe,cancelFormulaBarEdit:Je,insertFunctionIntoCell:Ge,renTab:lt,renTabVal:et,onTabClick:oe,onTabDblClick:pe,commitTabRename:g,cclTabRename:A,onTabRenameKd:L,ctxMenu:$,ctxSubmenuLeft:Mt,filterPopup:ee,isFilterButtonHit:u,openFilterPopup:p,closeFilterPopup:H,onCtxItemEnter:St,onTabCtxMenu:Ft,onTabBarCtx:Yt,onCornerCtx:nl,onRowHdrCtx:Cl,onColHdrCtx:Dl,onCellCtx:cl,dimInputRef:wl,dimPanel:ol,openDimPanel:Gl,onDimInput:Yl,onDimKeydown:sn,onDimBlur:I,applyDimPanel:N,closeDimPanel:O,editInputStyle:de,hScrollbarW:Ee,vScrollbarH:fe,hScrollbarLeft:Z,vScrollbarTop:ze,hTrackW:$e,vTrackH:le,hThumbW:Ke,hThumbL:ft,vThumbH:E,vThumbT:U,onVStart:me,onHStart:Se,onSbMove:We,onSbUp:st,onVTrk:Bt,onHTrk:zt,onMouseDown:Ie,onMouseMove:Ve,onMouseUp:Le,onMouseLeave:Ue,onCanvasCtx:mt,onDblClick:je,onWheel:pt,onTouchStart:Ot,onTouchMove:Sn,onTouchEnd:El,onKeydown:Zl,onEditInput:Vn,onEditCompositionStart:Pn,onEditCompositionEnd:hr,onEditKd:Au,onEditPaste:Vu,onEditBlur:Hu,applySize:Un,setupLifecycle:Ou}}function fu(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function mr(e,l,o,n){return l?n?o?e===l:e.toLowerCase()===l.toLowerCase():o?e.includes(l):e.toLowerCase().includes(l.toLowerCase()):!1}function mu(e,l,o,n){if(!l)return e;if(n){const i=e.indexOf(l);return i<0?e:e.slice(0,i)+o+e.slice(i+l.length)}const a=e.toLowerCase().indexOf(l.toLowerCase());return a<0?e:e.slice(0,a)+o+e.slice(a+l.length)}function pu(e,l,o,n){return l?n?e.indexOf(l)<0?e:e.split(l).join(o):e.toLowerCase().indexOf(l.toLowerCase())<0?e:e.replace(new RegExp(fu(l),"gi"),()=>o):e}function ko(e,l,o,n,a,i,r){const f=[];if(r){for(let m=r.startRow;m<=r.endRow;m++)for(let y=r.startCol;y<=r.endCol;y++){const k=e[o(y,m)];k&&mr(k.value,n,a,i)&&f.push({sheetIndex:l,col:y,row:m})}return f}for(const m in e){const y=e[m];if(y&&mr(y.value,n,a,i)){const k=m.split(","),d=Number(k[0]),w=Number(k[1]);!Number.isNaN(d)&&!Number.isNaN(w)&&f.push({sheetIndex:l,col:d,row:w})}}return f}function hu(e,l,o,n){const a=t.ref(!1),i=t.ref(""),r=t.ref(""),f=t.ref("sheet"),m=t.ref(!1),y=t.ref(!1),k=t.ref(-1),d=t.ref([]),w=t.ref(""),v=t.ref(0),R=t.ref(""),G=t.computed(()=>{const oe=new Set,pe=o.activeSheetIndex.value;for(const g of d.value)g.sheetIndex===pe&&oe.add(`${g.col},${g.row}`);return oe}),te=t.computed(()=>{if(k.value<0||k.value>=d.value.length)return null;const oe=d.value[k.value];return oe.sheetIndex!==o.activeSheetIndex.value?null:`${oe.col},${oe.row}`});e.findHighlight=(oe,pe)=>{const g=`${oe},${pe}`;return te.value===g?"active":G.value.has(g)?"match":null};function Y(oe){var A,L;const pe=e.cellKey(oe.col,oe.row);if(oe.sheetIndex===o.activeSheetIndex.value)return((A=e.cells[pe])==null?void 0:A.value)??"";const g=o.sheets.value[oe.sheetIndex];return((L=g==null?void 0:g.cells[pe])==null?void 0:L.value)??""}function K(oe,pe){const g=e.cellKey(oe.col,oe.row);if(oe.sheetIndex===o.activeSheetIndex.value)e.setCellValue(oe.col,oe.row,pe);else{const A=o.sheets.value[oe.sheetIndex];if(!A)return;const L=A.cells[g];A.cells[g]={value:String(pe),styleId:L==null?void 0:L.styleId}}}function C(){if(R.value){w.value=R.value;return}if(!i.value){w.value="";return}if(f.value==="selection"&&!e.selection.value){w.value=D(e.locale.value,"findNeedSelection");return}if(d.value.length===0){w.value=D(e.locale.value,"findNoResult");return}w.value=""}function j(){const oe=i.value,pe=[];if(oe)if(f.value==="workbook")o.sheets.value.forEach((g,A)=>{pe.push(...ko(g.cells,A,e.cellKey,oe,m.value,y.value))});else if(f.value==="selection"){const g=e.selection.value;g&&pe.push(...ko(e.cells,o.activeSheetIndex.value,e.cellKey,oe,m.value,y.value,g))}else pe.push(...ko(e.cells,o.activeSheetIndex.value,e.cellKey,oe,m.value,y.value));d.value=pe,pe.length===0?k.value=-1:k.value>=pe.length?k.value=pe.length-1:k.value<0&&(k.value=0),C()}function q(){if(k.value<0||k.value>=d.value.length)return;const oe=d.value[k.value];oe.sheetIndex!==o.activeSheetIndex.value&&o.switchSheet(oe.sheetIndex),f.value==="selection"?e.activeCell.value={col:oe.col,row:oe.row}:e.selectCell(oe.col,oe.row),e.ensureVisible(oe.col,oe.row)}const se=typeof requestAnimationFrame=="function"?requestAnimationFrame:oe=>setTimeout(oe,16);let Fe=!1,Qe=!1;function Ge(oe){if(Fe){Qe=Qe||oe;return}Fe=!0,Qe=oe,se(()=>{var pe;Fe=!1,j(),Qe&&d.value.length>0&&k.value>=0&&q(),Qe=!1,(pe=e.scheduleRender)==null||pe.call(e)})}function be(){var oe;a.value=!0,v.value++,j(),d.value.length>0&&(k.value=0,q()),(oe=e.scheduleRender)==null||oe.call(e)}function ve(){be()}function Xe(){var oe;a.value=!1,d.value=[],k.value=-1,R.value="",w.value="",(oe=e.scheduleRender)==null||oe.call(e)}function Je(){var oe;d.value.length!==0&&(k.value=(k.value+1)%d.value.length,q(),(oe=e.scheduleRender)==null||oe.call(e))}function gt(){var oe;d.value.length!==0&&(k.value=(k.value-1+d.value.length)%d.value.length,q(),(oe=e.scheduleRender)==null||oe.call(e))}function Ze(){var L,$;if(k.value<0||k.value>=d.value.length)return;const oe=d.value[k.value],pe=Y(oe),g=mu(pe,i.value,r.value,m.value);if(g===pe)return;l.saveUndo(),K(oe,g);const A=k.value;j(),d.value.length>0?(k.value=Math.min(A,d.value.length-1),Je()):k.value=-1,(L=e.emitModelData)==null||L.call(e),($=e.scheduleRender)==null||$.call(e)}function lt(){var A,L;const oe=i.value;if(!oe||d.value.length===0)return;l.saveUndo();let pe=0;const g=d.value.slice();for(const $ of g){const ee=Y($),ie=pu(ee,oe,r.value,m.value);ie!==ee&&(K($,ie),pe++)}d.value=[],k.value=-1,R.value=D(e.locale.value,"findReplacedAll").replace("{n}",String(pe)),C(),(A=e.emitModelData)==null||A.call(e),(L=e.scheduleRender)==null||L.call(e)}function et(){const oe=pe=>{if(!(pe.ctrlKey||pe.metaKey))return;const A=pe.key.toLowerCase();(A==="f"||A==="h")&&(pe.preventDefault(),be())};window.addEventListener("keydown",oe),t.onBeforeUnmount(()=>window.removeEventListener("keydown",oe))}return t.watch(i,()=>{a.value&&(R.value="",k.value=0,Ge(!0))}),t.watch([f,m,y],()=>{a.value&&(R.value="",k.value=0,Ge(!0))}),t.watch(e.cells,()=>{a.value&&Ge(!1)},{deep:!0}),t.watch(()=>e.selection.value,()=>{a.value&&f.value==="selection"&&(k.value=0,Ge(!0))}),t.watch([()=>l.undoStack.value.length,()=>l.redoStack.value.length],()=>{a.value&&Ge(!1)}),{open:a,findText:i,replaceText:r,scope:f,matchCase:m,matchEntireCell:y,currentIndex:k,results:d,message:w,focusToken:v,activeSheetMatches:G,activeMatchKey:te,openFind:be,openReplace:ve,close:Xe,recompute:j,findNext:Je,findPrev:gt,replace:Ze,replaceAll:lt,setupLifecycle:et}}const gu={class:"formula-bar__cell-label"},yu={class:"formula-bar__buttons"},bu=["title","aria-label"],Cu=["rows","value"],wu=["title"],vu={key:0,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},ku={key:1,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},Eu=["value"],Su={key:2,class:"sb-corner"},Ru=["onClick","onMouseenter"],Mu={class:"context-menu__label"},xu={key:0,class:"context-menu__arrow",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"22869"},Bu=["onClick"],Tu={class:"dim-panel__title"},Du={class:"dim-panel__body"},Nu=["value"],Fu={key:0,class:"dim-panel__error"},Iu={class:"dim-panel__footer"},pr=tl(t.defineComponent({__name:"spreader",props:t.mergeModels({rowCount:{default:200},colCount:{default:26},width:{},height:{},theme:{default:"light"},locale:{default:"zh-CN"}},{data:{default:()=>[]},dataModifiers:{}}),emits:["update:data"],setup(e){const l=e,o=t.useModel(e,"data"),n={value:""},a=lu(l,{rowCount:l.rowCount,colCount:l.colCount,theme:l.theme,locale:l.locale}),i={sheets:t.ref([]),activeSheetIndex:t.ref(0),saveSheet:()=>{},loadSheet:V=>{},mkSheet:V=>({id:"",name:V,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})},r=nu(a,i),f=ru(a,r);ou(r,{borderMenuOpen:f.borderMenuOpen,mergeMenuOpen:f.mergeMenuOpen});const m=uu(a,r,o,void 0,n);i.sheets=m.sheets,i.activeSheetIndex=m.activeSheetIndex,i.saveSheet=m.saveSheet,i.loadSheet=m.loadSheet,i.mkSheet=m.mkSheet;const y=du(a,r,f,m,n);y.setupLifecycle();const k=hu(a,r,m);k.setupLifecycle();const d=t.reactive(a),w=t.reactive(r),v=t.reactive(f),R=t.reactive(m),G=m.sheets,te=m.activeSheetIndex,Y=m.sortMenuOpen,K=m.cachedSortOrder,C=t.reactive(y),j=t.reactive(k),q=t.computed(()=>{const V=d.selection;return!!V&&V.startCol===V.endCol&&V.startRow===V.endRow}),se=t.computed(()=>{const V=d.selection;return V?m.canSortColumns(V.startCol,V.endCol):!1}),Fe=t.computed(()=>{if(d.getFilter()!==null)return!0;const V=d.selection;if(!V)return!0;const c=Math.min(V.startCol,V.endCol),u=Math.max(V.startCol,V.endCol),p=Math.min(V.startRow,V.endRow),H=Math.max(V.startRow,V.endRow);for(const ct in d.merges){const ae=d.merges[ct];if(!(ae.startCol===ae.endCol&&ae.startRow===ae.endRow)&&c<=ae.endCol&&u>=ae.startCol&&p<=ae.endRow&&H>=ae.startRow)return!1}return!0}),Qe=t.computed(()=>{const V=w.selNumberFormat;if(V!==Bl&&V!==$l)return V;const c=d.activeCell,u=a.resolveStyle(d.cells[d.cellKey(c.col,c.row)]);return typeof(u==null?void 0:u.numberFormat)=="string"?u.numberFormat:""});function Ge(V){r.nfDialogOpen.value=V}const be=t.ref(!1);function ve(){be.value=!0}function Xe(V){be.value=V}function Je(V){y.insertFunctionIntoCell(V)}function gt(){d.toggleAutoFilter(),C.scheduleRender()}function Ze(V){const c=d.getFilter();return c?d.getCellValue(V,c.range.startRow):""}function lt(V){const c=d.freeze;if(V==="panes"){const u=d.selection,p=u?u.startRow:d.activeCell.row,H=u?u.startCol:d.activeCell.col;d.setFreeze(p,H)}else V==="firstRow"?d.setFreeze(1,c.cols):V==="firstCol"?d.setFreeze(c.rows,1):V==="unfreeze"&&d.clearFreeze();C.scheduleRender()}function et(V){r.fontSizeMenuOpen.value=V}function oe(V){r.textColorMenuOpen.value=V}function pe(V){r.fillColorMenuOpen.value=V}function g(V){y.renTabVal.value=V}function A(){y.ctxMenu.value=null}const L=V=>{m.formulaBarRef.value=V};function $(){y.formulaBarExpanded.value=!y.formulaBarExpanded.value}const ee=V=>{m.wrapperRef.value=V},ie=V=>{m.canvasRef.value=V},re=V=>{m.freezeCanvasRef.value=V},he=V=>{m.editInputRef.value=V},ce=V=>{y.dimInputRef.value=V};return(V,c)=>(t.openBlock(),t.createElementBlock("div",{class:"spreadsheet-outer",style:t.normalizeStyle(R.outerStyle)},[t.createVNode(ji,{locale:d.locale,"can-undo":w.canUndo,"can-redo":w.canRedo,"paint-fmt-active":w.paintFmt!==null,"has-selection":w.hasSelection,"font-family-options":w.fontFamilyOptions,"font-size-options":w.fontSizeOptions,"sel-font-family":w.selFontFamily,"sel-font-size":w.selFontSize,"font-size-input":w.fontSizeInput,"font-size-menu-open":w.fontSizeMenuOpen,"sel-font-weight":w.selFontWeight,"sel-font-style":w.selFontStyle,"sel-underline":w.selUnderline,"sel-strikethrough":w.selStrikethrough,"sel-text-color":w.selTextColor,"text-color-menu-open":w.textColorMenuOpen,"sel-fill-color":w.selFillColor,"fill-color-menu-open":w.fillColorMenuOpen,"cached-text-color":w.cachedTextColor,"cached-fill-color":w.cachedFillColor,"border-menu-open":v.borderMenuOpen,"cached-border":v.cachedBorder,"sort-menu-open":t.unref(Y),"cached-sort-order":t.unref(K),"can-sort":se.value,"can-filter":Fe.value,"filter-active":d.getFilter()!==null,"h-align-options":w.hAlignOptions,"v-align-options":w.vAlignOptions,"sel-h-align":w.selHAlign,"sel-v-align":w.selVAlign,"sel-wrap":w.selWrap,"merge-menu-open":v.mergeMenuOpen,"calc-menu-open":v.calcMenuOpen,"is-single-cell":q.value,"has-freeze":d.freeze.rows>0||d.freeze.cols>0,"sel-number-format":w.selNumberFormatDisplay,"nf-options":w.nfOptions,"can-increase-decimals":w.canIncreaseDecimals,"can-decrease-decimals":w.canDecreaseDecimals,"theme-vars":R.toolbarThemeVars,onUndo:c[0]||(c[0]=u=>w.undo()),onRedo:c[1]||(c[1]=u=>w.redo()),onPaintFormat:w.onPaintFormat,onClearFormat:c[2]||(c[2]=u=>w.clearFormat()),onNumberFormatChange:c[3]||(c[3]=u=>w.onNumberFormatChange(u)),onIncreaseDecimals:w.onIncreaseDecimals,onDecreaseDecimals:w.onDecreaseDecimals,onFontFamilyChange:c[4]||(c[4]=u=>w.onFontFamilyChange(u)),onFontSizeInput:c[5]||(c[5]=u=>w.onFontSizeInput(u)),onFontSizeBlur:w.onFontSizeBlur,onFontSizeKeydown:c[6]||(c[6]=u=>w.onFontSizeKeydown(u)),onFontSizeChange:c[7]||(c[7]=u=>w.onFontSizeChange(u)),"onUpdate:fontSizeMenuOpen":c[8]||(c[8]=u=>et(u)),onFontSizeToggle:c[9]||(c[9]=u=>w.toggleFontSizeMenu()),onFontSizeStepUp:w.onFontSizeStepUp,onFontSizeStepDown:w.onFontSizeStepDown,onBoldToggle:w.toggleFontWeight,onItalicToggle:w.toggleFontStyle,onUnderlineToggle:w.toggleUnderline,onStrikethroughToggle:w.toggleStrikethrough,onTextColorChange:c[10]||(c[10]=u=>w.onTextColorChange(u)),"onUpdate:textColorMenuOpen":c[11]||(c[11]=u=>oe(u)),onFillColorChange:c[12]||(c[12]=u=>w.onFillColorChange(u)),"onUpdate:fillColorMenuOpen":c[13]||(c[13]=u=>pe(u)),onApplyTextColor:w.applyCachedTextColor,onApplyFillColor:w.applyCachedFillColor,"onUpdate:borderMenuOpen":c[14]||(c[14]=u=>w.onBorderMenuToggle(u)),onBorderChange:c[15]||(c[15]=u=>v.onBorderChange(u)),onApplyBorder:v.applyCachedBorder,"onUpdate:sortMenuOpen":c[16]||(c[16]=u=>R.onSortMenuToggle(u)),onSortChange:c[17]||(c[17]=u=>R.onSortChange(u)),onApplySort:R.applyCachedSort,onToggleFilter:gt,onFreezeChange:c[18]||(c[18]=u=>lt(u)),onHAlignChange:c[19]||(c[19]=u=>w.onHAlignChange(u)),onVAlignChange:c[20]||(c[20]=u=>w.onVAlignChange(u)),onWrapToggle:w.onWrapToggle,"onUpdate:mergeMenuOpen":c[21]||(c[21]=u=>v.onMergeMenuToggle(u)),onMergeChange:c[22]||(c[22]=u=>v.onMergeChange(u)),onApplyMerge:v.onApplyMerge,"onUpdate:calcMenuOpen":c[23]||(c[23]=u=>v.onCalcMenuToggle(u)),onCalcSum:v.onCalcSum,onCalcAvg:v.onCalcAvg,onCalcCount:v.onCalcCount,onFind:c[24]||(c[24]=u=>t.unref(k).openFind())},null,8,["locale","can-undo","can-redo","paint-fmt-active","has-selection","font-family-options","font-size-options","sel-font-family","sel-font-size","font-size-input","font-size-menu-open","sel-font-weight","sel-font-style","sel-underline","sel-strikethrough","sel-text-color","text-color-menu-open","sel-fill-color","fill-color-menu-open","cached-text-color","cached-fill-color","border-menu-open","cached-border","sort-menu-open","cached-sort-order","can-sort","can-filter","filter-active","h-align-options","v-align-options","sel-h-align","sel-v-align","sel-wrap","merge-menu-open","calc-menu-open","is-single-cell","has-freeze","sel-number-format","nf-options","can-increase-decimals","can-decrease-decimals","theme-vars","onPaintFormat","onIncreaseDecimals","onDecreaseDecimals","onFontSizeBlur","onFontSizeStepUp","onFontSizeStepDown","onBoldToggle","onItalicToggle","onUnderlineToggle","onStrikethroughToggle","onApplyTextColor","onApplyFillColor","onApplyBorder","onApplySort","onWrapToggle","onApplyMerge","onCalcSum","onCalcAvg","onCalcCount"]),t.createVNode(vc,{open:j.open,"find-text":j.findText,"replace-text":j.replaceText,scope:j.scope,"match-case":j.matchCase,"match-entire-cell":j.matchEntireCell,"current-index":j.currentIndex,total:j.results.length,message:j.message,"focus-token":j.focusToken,locale:d.locale,"theme-vars":R.toolbarThemeVars,"onUpdate:findText":c[25]||(c[25]=u=>t.unref(k).findText.value=u),"onUpdate:replaceText":c[26]||(c[26]=u=>t.unref(k).replaceText.value=u),"onUpdate:scope":c[27]||(c[27]=u=>t.unref(k).scope.value=u),"onUpdate:matchCase":c[28]||(c[28]=u=>t.unref(k).matchCase.value=u),"onUpdate:matchEntireCell":c[29]||(c[29]=u=>t.unref(k).matchEntireCell.value=u),onPrev:c[30]||(c[30]=u=>t.unref(k).findPrev()),onNext:c[31]||(c[31]=u=>t.unref(k).findNext()),onReplace:c[32]||(c[32]=u=>t.unref(k).replace()),onReplaceAll:c[33]||(c[33]=u=>t.unref(k).replaceAll()),onClose:c[34]||(c[34]=u=>t.unref(k).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(Xc,{"model-open":w.nfDialogOpen,locale:d.locale,"current-format":Qe.value,"is-custom":w.selNumberFormat===t.unref($l),"onUpdate:modelOpen":c[35]||(c[35]=u=>Ge(u)),onApply:c[36]||(c[36]=u=>w.applyNumberFormatCode(u))},null,8,["model-open","locale","current-format","is-custom"]),t.createVNode(ns,{"model-open":R.sortConfirmOpen,locale:d.locale,"onUpdate:modelOpen":c[37]||(c[37]=u=>R.sortConfirmOpen=u),onConfirm:c[38]||(c[38]=u=>R.confirmSort(u)),onCancel:c[39]||(c[39]=u=>R.cancelSortConfirmation())},null,8,["model-open","locale"]),t.createVNode(ks,{"model-open":be.value,locale:d.locale,"onUpdate:modelOpen":c[40]||(c[40]=u=>Xe(u)),onInsert:c[41]||(c[41]=u=>Je(u))},null,8,["model-open","locale"]),t.createElementVNode("div",{class:t.normalizeClass(["formula-bar",{"formula-bar--expanded":C.formulaBarExpanded}])},[t.createElementVNode("div",gu,t.toDisplayString(C.activeCellLabel),1),t.createElementVNode("div",yu,[t.createElementVNode("button",{type:"button",class:"formula-bar__btn formula-bar__btn--cancel",title:"取消(Esc)","aria-label":"取消",onMousedown:c[42]||(c[42]=t.withModifiers(()=>{},["prevent"])),onClick:c[43]||(c[43]=t.withModifiers((...u)=>C.cancelFormulaBarEdit&&C.cancelFormulaBarEdit(...u),["stop"]))},[...c[95]||(c[95]=[t.createElementVNode("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":"true"},[t.createElementVNode("path",{d:"M3 3l8 8M11 3l-8 8",fill:"none",stroke:"#e53935","stroke-width":"1.8","stroke-linecap":"round"})],-1)])],32),t.createElementVNode("button",{type:"button",class:"formula-bar__btn formula-bar__btn--accept",title:"接受(Enter)","aria-label":"接受",onMousedown:c[44]||(c[44]=t.withModifiers(()=>{},["prevent"])),onClick:c[45]||(c[45]=t.withModifiers((...u)=>C.acceptFormulaBarEdit&&C.acceptFormulaBarEdit(...u),["stop"]))},[...c[96]||(c[96]=[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(D)(d.locale,"insertFunctionTitle"),"aria-label":t.unref(D)(d.locale,"insertFunctionTitle"),onMousedown:c[46]||(c[46]=t.withModifiers(()=>{},["prevent"])),onClick:t.withModifiers(ve,["stop"])},[...c[97]||(c[97]=[t.createElementVNode("span",{class:"formula-bar__fx-label"},"fx",-1)])],40,bu)]),t.createElementVNode("textarea",{ref:L,class:t.normalizeClass(["formula-bar__input",{"formula-bar__input--expanded":C.formulaBarExpanded}]),rows:C.formulaBarExpanded?3:1,value:C.formulaBarDisplay,spellcheck:"false",onFocus:c[47]||(c[47]=(...u)=>C.onFormulaBarFocus&&C.onFormulaBarFocus(...u)),onInput:c[48]||(c[48]=(...u)=>C.onFormulaBarInput&&C.onFormulaBarInput(...u)),onKeydown:c[49]||(c[49]=(...u)=>C.onFormulaBarKeydown&&C.onFormulaBarKeydown(...u)),onBlur:c[50]||(c[50]=(...u)=>C.onFormulaBarBlur&&C.onFormulaBarBlur(...u))},null,42,Cu),t.createElementVNode("button",{type:"button",class:"formula-bar__toggle",title:C.formulaBarExpanded?"折叠为1行":"展开为3行",onMousedown:c[51]||(c[51]=t.withModifiers(()=>{},["prevent"])),onClick:t.withModifiers($,["stop"])},[C.formulaBarExpanded?(t.openBlock(),t.createElementBlock("svg",ku,[...c[99]||(c[99]=[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",vu,[...c[98]||(c[98]=[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,wu)],2),t.createElementVNode("div",{ref:ee,class:"spreadsheet-wrapper"},[t.createElementVNode("canvas",{ref:ie,class:"grid-canvas",tabindex:"0",onMousedown:c[52]||(c[52]=(...u)=>C.onMouseDown&&C.onMouseDown(...u)),onMousemove:c[53]||(c[53]=(...u)=>C.onMouseMove&&C.onMouseMove(...u)),onMouseup:c[54]||(c[54]=(...u)=>C.onMouseUp&&C.onMouseUp(...u)),onMouseleave:c[55]||(c[55]=(...u)=>C.onMouseLeave&&C.onMouseLeave(...u)),onDblclick:c[56]||(c[56]=(...u)=>C.onDblClick&&C.onDblClick(...u)),onWheel:c[57]||(c[57]=t.withModifiers((...u)=>C.onWheel&&C.onWheel(...u),["prevent"])),onFocus:c[58]||(c[58]=(...u)=>R.onCanvasFocus&&R.onCanvasFocus(...u)),onKeydown:c[59]||(c[59]=(...u)=>C.onKeydown&&C.onKeydown(...u)),onContextmenu:c[60]||(c[60]=(...u)=>C.onCanvasCtx&&C.onCanvasCtx(...u)),onTouchstart:c[61]||(c[61]=t.withModifiers((...u)=>C.onTouchStart&&C.onTouchStart(...u),["prevent"])),onTouchmove:c[62]||(c[62]=t.withModifiers((...u)=>C.onTouchMove&&C.onTouchMove(...u),["prevent"])),onTouchend:c[63]||(c[63]=(...u)=>C.onTouchEnd&&C.onTouchEnd(...u))},null,32),t.createElementVNode("canvas",{ref:re,class:"grid-canvas grid-canvas--freeze","aria-hidden":"true"}),t.createElementVNode("textarea",{ref:he,class:"cell-editor",value:d.editValue,style:t.normalizeStyle(C.editInputStyle),onInput:c[64]||(c[64]=(...u)=>C.onEditInput&&C.onEditInput(...u)),onKeydown:c[65]||(c[65]=(...u)=>C.onEditKd&&C.onEditKd(...u)),onCompositionstart:c[66]||(c[66]=(...u)=>C.onEditCompositionStart&&C.onEditCompositionStart(...u)),onCompositionend:c[67]||(c[67]=(...u)=>C.onEditCompositionEnd&&C.onEditCompositionEnd(...u)),onBlur:c[68]||(c[68]=(...u)=>C.onEditBlur&&C.onEditBlur(...u)),onPaste:c[69]||(c[69]=(...u)=>C.onEditPaste&&C.onEditPaste(...u))},null,44,Eu),R.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"v-scrollbar",style:t.normalizeStyle({top:C.vScrollbarTop+"px",height:`calc(100% - ${C.vScrollbarTop+t.unref(11)}px)`})},[t.createElementVNode("button",{class:"sb-btn sb-btn--up",title:"",onMousedown:c[70]||(c[70]=t.withModifiers(u=>{R.clampScroll(null,d.scrollY-50),C.scheduleRender()},["prevent"]))},[...c[100]||(c[100]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--up"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--v",onMousedown:c[72]||(c[72]=(...u)=>C.onVTrk&&C.onVTrk(...u))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--v",style:t.normalizeStyle({top:C.vThumbT+"px",height:C.vThumbH+"px"}),onMousedown:c[71]||(c[71]=(...u)=>C.onVStart&&C.onVStart(...u))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--down",onMousedown:c[73]||(c[73]=t.withModifiers(u=>{R.clampScroll(null,d.scrollY+50),C.scheduleRender()},["prevent"]))},[...c[101]||(c[101]=[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:C.hScrollbarLeft+"px",width:`calc(100% - ${C.hScrollbarLeft+t.unref(11)}px)`})},[t.createElementVNode("button",{class:"sb-btn sb-btn--left",onMousedown:c[74]||(c[74]=t.withModifiers(u=>{R.clampScroll(d.scrollX-50,null),C.scheduleRender()},["prevent"]))},[...c[102]||(c[102]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--left"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--h",onMousedown:c[76]||(c[76]=(...u)=>C.onHTrk&&C.onHTrk(...u))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--h",style:t.normalizeStyle({left:C.hThumbL+"px",width:C.hThumbW+"px"}),onMousedown:c[75]||(c[75]=(...u)=>C.onHStart&&C.onHStart(...u))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--right",onMousedown:c[77]||(c[77]=t.withModifiers(u=>{R.clampScroll(d.scrollX+50,null),C.scheduleRender()},["prevent"]))},[...c[103]||(c[103]=[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",Su)):t.createCommentVNode("",!0)]),t.createVNode(cc,{locale:d.locale,sheets:t.unref(G),"active-sheet-index":t.unref(te),"ren-tab":C.renTab,"ren-tab-val":C.renTabVal,onTabClick:c[78]||(c[78]=u=>C.onTabClick(u)),onTabDblclick:c[79]||(c[79]=u=>C.onTabDblClick(u)),onTabContextmenu:c[80]||(c[80]=u=>C.onTabCtxMenu(u.ev,u.i)),onTabRenameInput:c[81]||(c[81]=u=>g(u)),onTabRenameKeydown:c[82]||(c[82]=u=>C.onTabRenameKd(u)),onTabRenameCommit:C.commitTabRename,onTabbarContextmenu:c[83]||(c[83]=u=>C.onTabBarCtx(u)),onDeleteSheet:c[84]||(c[84]=u=>{R.removeSheet(u),C.scheduleRender()}),onAddSheet:c[85]||(c[85]=u=>{R.addSheet(),C.scheduleRender()})},null,8,["locale","sheets","active-sheet-index","ren-tab","ren-tab-val","onTabRenameCommit"]),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[C.ctxMenu?(t.openBlock(),t.createElementBlock("div",{key:0,class:"context-menu",style:t.normalizeStyle({left:C.ctxMenu.x+"px",top:C.ctxMenu.y+"px"}),onClick:c[86]||(c[86]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(C.ctxMenu.items,(u,p)=>(t.openBlock(),t.createElementBlock("div",{key:p,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":u.disabled}]),onClick:H=>!u.disabled&&u.action&&(u.action(),A()),onMouseenter:H=>C.onCtxItemEnter(H,u)},[t.createElementVNode("span",Mu,t.toDisplayString(u.label),1),u.children?(t.openBlock(),t.createElementBlock("svg",xu,[...c[104]||(c[104]=[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),u.children?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["context-submenu",{"context-submenu--left":C.ctxSubmenuLeft}])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.children,(H,ct)=>(t.openBlock(),t.createElementBlock("div",{key:ct,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":H.disabled}]),onClick:t.withModifiers(ae=>!H.disabled&&H.action&&(H.action(),A()),["stop"])},t.toDisplayString(H.label),11,Bu))),128))],2)):t.createCommentVNode("",!0)],42,Ru))),128))],4)):t.createCommentVNode("",!0)]),_:1})])),C.filterPopup?(t.openBlock(),t.createBlock(Ys,{key:C.filterPopup.col,col:C.filterPopup.col,"header-label":Ze(C.filterPopup.col),anchor:{x:C.filterPopup.x,y:C.filterPopup.y},locale:d.locale,"get-filter":d.getFilter,"set-filter":d.setFilter,"set-filter-column":d.setFilterColumn,"clear-filter-column":d.clearFilterColumn,"get-column-candidates":d.getColumnCandidates,close:C.closeFilterPopup},null,8,["col","header-label","anchor","locale","get-filter","set-filter","set-filter-column","clear-filter-column","get-column-candidates","close"])):t.createCommentVNode("",!0),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[C.dimPanel?(t.openBlock(),t.createElementBlock("div",{key:0,class:"dim-panel",style:t.normalizeStyle({left:C.dimPanel.x+"px",top:C.dimPanel.y+"px"}),onMousedown:c[92]||(c[92]=t.withModifiers(()=>{},["stop"])),onTouchstart:c[93]||(c[93]=t.withModifiers(()=>{},["stop"])),onClick:c[94]||(c[94]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",Tu,t.toDisplayString(C.dimPanel.type==="row"?"行高":"列宽"),1),t.createElementVNode("div",Du,[t.createElementVNode("input",{ref:ce,class:t.normalizeClass(["dim-panel__input",{"dim-panel__input--error":C.dimPanel.error}]),type:"number",step:"1",min:"1",inputmode:"numeric",value:C.dimPanel.value,onInput:c[87]||(c[87]=(...u)=>C.onDimInput&&C.onDimInput(...u)),onKeydown:c[88]||(c[88]=(...u)=>C.onDimKeydown&&C.onDimKeydown(...u)),onBlur:c[89]||(c[89]=(...u)=>C.onDimBlur&&C.onDimBlur(...u))},null,42,Nu)]),C.dimPanel.error?(t.openBlock(),t.createElementBlock("div",Fu,t.toDisplayString(C.dimPanel.error),1)):t.createCommentVNode("",!0),t.createElementVNode("div",Iu,[t.createElementVNode("button",{class:"dim-panel__btn dim-panel__btn--primary",onClick:c[90]||(c[90]=(...u)=>C.applyDimPanel&&C.applyDimPanel(...u))}," 确定 "),t.createElementVNode("button",{class:"dim-panel__btn",onClick:c[91]||(c[91]=(...u)=>C.closeDimPanel&&C.closeDimPanel(...u))}," 取消 ")])],36)):t.createCommentVNode("",!0)]),_:1})]))],4))}}),[["__scopeId","data-v-17b333fa"]]);rn.Spreader=pr,rn.default=pr,Object.defineProperties(rn,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(an,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(an=typeof globalThis<"u"?globalThis:an||self,t(an.XiaoDaoSpreader={},an.Vue))})(this,function(an,t){"use strict";const Rr={"zh-CN":{insert:"插入",delete:"删除",rename:"重命名",moveLeft:"左移",moveRight:"右移",cut:"剪切",copy:"复制",paste:"粘贴",addSheet:"新建工作表",sheetList:"工作表列表",moveSheetLeft:"左移",moveSheetRight:"右移",scrollUp:"向上滚动",scrollDown:"向下滚动",scrollLeft:"向左滚动",scrollRight:"向右滚动",calculate:"计算",sum:"求和",avg:"平均值",count:"计数",undo:"撤销",redo:"重做",paintFormat:"格式刷",clearFormat:"清除格式",fontFamily:"字体",fontSize:"字号",fontSizeIncrease:"增大字号",fontSizeDecrease:"减小字号",bold:"加粗",italic:"斜体",underline:"下划线",strikethrough:"删除线",fontColor:"文字颜色",fillColor:"填充颜色",borders:"边框",hAlign:"水平对齐",vAlign:"垂直对齐",alignLeft:"左端对齐",alignCenter:"居中对齐",alignRight:"右端对齐",alignTop:"顶端对齐",alignMiddle:"垂直居中",alignBottom:"底端对齐",wrap:"自动换行",mergeCells:"合并单元格",mergeCenter:"合并后居中",mergeAcross:"跨越合并",unmergeCells:"取消合并单元格",borderBottom:"下框线",borderTop:"上框线",borderLeft:"左框线",borderRight:"右框线",borderNone:"无框线",borderAll:"所有框线",borderOuter:"外框线",borderThickOuter:"粗外框线",fontDefault:"默认",rowHeight:"行高",colWidth:"列宽",autoRowHeight:"自动行高",defaultColWidth:"默认列宽",sort:"排序",sortAsc:"升序排序",sortDesc:"降序排序",sortReminderTitle:"排序提醒",sortReminderMessage:"选定区域的左侧或右侧还有相邻数据,这些数据未被选中,将不参与排序。是否将其一并纳入排序?",sortExpandSelection:"扩展选定区域",sortCurrentSelection:"仅对选定区域排序",insertFunctionTitle:"插入函数",insertFunctionSelectLabel:"函数",insertFunctionPlaceholder:"请选择函数",insertFunctionSearchPlaceholder:"搜索函数",insertFunctionFormulaLabel:"公式",insertFunctionBtn:"插入",fnDescSum:"计算单元格区域中所有数值的和",fnDescAverage:"计算单元格区域中数值的算术平均值",fnDescCount:"统计单元格区域中包含数值的单元格个数",fnDescIf:"根据指定条件判断真假,返回对应的两个值之一",fnDescVlookup:"在区域首列查找指定值,返回同一行中指定列的值",fnDescConcatenate:"将多个文本连接合并为一个文本",fnDescMax:"返回单元格区域中所有数值的最大值",fnDescMin:"返回单元格区域中所有数值的最小值",fnDescSin:"返回给定角度(弧度)的正弦值",fnDescSumif:"对区域中满足指定条件的单元格对应的数值求和",fnDescPmt:"计算基于固定利率及等额分期付款的贷款每期还款额",fnDescStdev:"估算基于样本的标准偏差(忽略文本与逻辑值)",ok:"确定",cancel:"取消",dimNumberError:"请输入数字",dimRangeError:"请输入 {min}~{max} 之间的数值",colorAutomatic:"自动",colorNoFill:"无填充",colorWhite:"白色",colorBlack:"黑色",colorLightGray:"浅灰",colorLightBlue:"浅蓝",colorLightOrange:"浅橙",colorLightYellow:"浅黄",colorLightGreen:"浅绿",colorPaleBlue:"淡蓝",colorPaleOrange:"淡橙",colorPaleYellow:"淡黄",colorPaleGreen:"淡绿",colorSilver:"银色",colorSkyBlue:"天蓝",colorCoral:"珊瑚",colorGold:"金色",colorMint:"薄荷",colorGray:"灰色",colorMediumBlue:"中蓝",colorOrange:"橙色",colorAmber:"琥珀",colorMediumGreen:"中绿",colorDarkGray:"深灰",colorRoyalBlue:"宝蓝",colorRed:"红色",colorDarkGold:"深金",colorDarkGreen:"深绿",colorCharcoal:"炭灰",colorDeepBlue:"深蓝",colorDarkRed:"深红",colorOlive:"橄榄",colorForest:"森林",colorSlate:"石板灰",colorNavy:"藏青",colorCrimson:"绯红",colorDarkOlive:"深橄榄",colorDeepForest:"深林",colorDarkSlate:"深石板灰",colorMidnight:"午夜蓝",colorMaroon:"栗色",colorCoffee:"咖啡色",colorEvergreen:"常青",colorDarkNavy:"深藏青",colorDarkMaroon:"深栗",colorDarkCoffee:"深咖",colorInkGreen:"墨绿",numberFormat:"数字格式",nfGeneral:"常规",nfText:"文本",nfNumber:"数字",nfPercent:"百分比",nfScientific:"科学计数法",nfAccounting:"会计专用",nfFinancial:"财务数值",nfCurrency:"货币",nfCurrencyRounded:"货币取整",nfDate:"日期",nfTime:"时间",nfDateTime:"日期和时间",nfDuration:"持续时间",nfCustom:"其他数字格式…",nfMixed:"混合",nfIncreaseDecimals:"增加小数位数",nfDecreaseDecimals:"减少小数位数",nfDialogTitle:"设置单元格格式",nfCategory:"分类",nfCatCustom:"自定义",nfDecimals:"小数位数",nfThousands:"使用千位分隔符",nfSymbol:"货币符号",nfDateFormat:"日期格式",nfTimeFormat:"时间格式",nfCustomCode:"自定义格式代码",nfPreview:"预览",nfPreviewSample:"示例",find:"查找",findReplace:"查找和替换",findPlaceholder:"查找内容",replacePlaceholder:"替换为",findPrev:"上一个",findNext:"下一个",replace:"替换",replaceAll:"全部替换",findScope:"范围",findOptions:"查找选项",scopeSheet:"当前工作表",scopeWorkbook:"整个工作簿",scopeSelection:"当前选区",matchCase:"区分大小写",matchEntireCell:"完整匹配",findNoResult:"未找到",findNeedSelection:"请先选择范围",findReplacedAll:"已替换 {n} 处",findClose:"关闭",freezePane:"冻结窗格",freezePanes:"冻结窗格",freezeFirstRow:"冻结首行",freezeFirstCol:"冻结首列",unfreezePanes:"取消冻结",freezeToRow:"冻结至此行",freezeToCol:"冻结至此列",filter:"筛选",clearFilter:"清除筛选",cancelFilter:"取消",filterSearchPlaceholder:"搜索",filterSelectAll:"全选",filterClearAll:"清除全部",filterOk:"确定",filterBlank:"空白",filterNonBlank:"非空白",filterText:"文本筛选",filterNumber:"数字筛选",filterDate:"日期筛选",filterEquals:"等于",filterNotEquals:"不等于",filterContains:"包含",filterNotContains:"不包含",filterStartsWith:"开头是",filterEndsWith:"结尾是",filterGreaterThan:"大于",filterGreaterThanOrEqual:"大于等于",filterLessThan:"小于",filterLessThanOrEqual:"小于等于",filterBetween:"介于",filterAnd:"与",filterCustom:"自定义筛选",filterNoData:"无数据",filterFilteredCount:"共 {n} 项",filterActive:"筛选中",filterByValue:"按此值筛选",filterByThisColumn:"筛选此列",conditionalFormat:"条件格式",cfHighlightRules:"突出显示单元格规则",cfGreaterThan:"大于",cfGreaterThanOrEqual:"大于等于",cfLessThan:"小于",cfLessThanOrEqual:"小于等于",cfBetween:"介于",cfNotBetween:"不介于",cfEqual:"等于",cfCellIs:"单元格值",cfNotEqual:"不等于",cfTextContains:"文本包含",cfTextNotContains:"文本不包含",cfBlank:"空白",cfNotBlank:"非空白",cfDuplicate:"重复值",cfUnique:"唯一值",cfFormulaShort:"公式",cfFormula:"使用公式确定要设置格式的单元格",cfFormulaExample:"例如 =$A1>100",cfNewRule:"新建规则",cfManageRules:"管理规则",cfClearRules:"清除规则",cfClearSelected:"清除所选单元格的规则",cfClearSheet:"清除整个工作表的规则",cfAppliedTo:"应用于",cfRule:"规则",cfFormat:"格式",cfPriority:"优先级",cfStopIfTrue:"停止如果为真",cfEnabled:"启用",cfDelete:"删除",cfEdit:"编辑",cfMoveUp:"上移",cfMoveDown:"下移",cfType:"类型",cfOperator:"条件",cfValue:"值",cfValue2:"到",cfManagerTitle:"条件格式规则管理器",cfPreview:"预览",cfNoRules:"当前工作表没有条件格式规则",cfRuleTypeGeneric:"自定义规则",cfBold:"加粗",cfItalic:"斜体",cfUnderline:"下划线",cfFontColor:"字体颜色",cfFillColor:"填充颜色"},"en-US":{insert:"Insert",delete:"Delete",rename:"Rename",moveLeft:"Move Left",moveRight:"Move Right",cut:"Cut",copy:"Copy",paste:"Paste",addSheet:"Add new sheet",sheetList:"Sheet list",moveSheetLeft:"Move Left",moveSheetRight:"Move Right",scrollUp:"Scroll up",scrollDown:"Scroll down",scrollLeft:"Scroll left",scrollRight:"Scroll right",calculate:"Calculate",sum:"Sum",avg:"Average",count:"Count",undo:"Undo",redo:"Redo",paintFormat:"Paint Format",clearFormat:"Clear Format",fontFamily:"Font Family",fontSize:"Font Size",fontSizeIncrease:"Increase Font Size",fontSizeDecrease:"Decrease Font Size",bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",fontColor:"Font Color",fillColor:"Fill Color",borders:"Borders",hAlign:"Horizontal Align",vAlign:"Vertical Align",alignLeft:"Align Left",alignCenter:"Align Center",alignRight:"Align Right",alignTop:"Align Top",alignMiddle:"Align Middle",alignBottom:"Align Bottom",wrap:"Wrap Text",mergeCells:"Merge Cells",mergeCenter:"Merge & Center",mergeAcross:"Merge Across",unmergeCells:"Unmerge Cells",borderBottom:"Bottom Border",borderTop:"Top Border",borderLeft:"Left Border",borderRight:"Right Border",borderNone:"No Border",borderAll:"All Borders",borderOuter:"Outside Borders",borderThickOuter:"Thick Box Border",fontDefault:"Default",rowHeight:"Row Height",colWidth:"Column Width",autoRowHeight:"Auto Row Height",defaultColWidth:"Default Column Width",sort:"Sort",sortAsc:"Sort Ascending",sortDesc:"Sort Descending",sortReminderTitle:"Sort Warning",sortReminderMessage:"There is adjacent data to the left or right of your selection. It is not selected and will not be sorted. Include it in the sort?",sortExpandSelection:"Expand the selection",sortCurrentSelection:"Sort the current selection only",insertFunctionTitle:"Insert Function",insertFunctionSelectLabel:"Function",insertFunctionPlaceholder:"Select a function",insertFunctionSearchPlaceholder:"Search a function",insertFunctionFormulaLabel:"Formula",insertFunctionBtn:"Insert",fnDescSum:"Adds all the numbers in a range of cells",fnDescAverage:"Returns the arithmetic mean of the numbers in a range",fnDescCount:"Counts the cells that contain numbers in a range",fnDescIf:"Checks a condition and returns one of two values",fnDescVlookup:"Looks up a value in the first column of a range and returns a value in the same row",fnDescConcatenate:"Joins several text strings into one text string",fnDescMax:"Returns the largest numeric value in a range of cells",fnDescMin:"Returns the smallest numeric value in a range of cells",fnDescSin:"Returns the sine of a given angle (in radians)",fnDescSumif:"Sums the values in a range that meet a specified condition",fnDescPmt:"Calculates the periodic payment for a loan with constant payments and interest",fnDescStdev:"Estimates the sample standard deviation of a supplied set of values",ok:"OK",cancel:"Cancel",dimNumberError:"Please enter a number",dimRangeError:"Please enter a value between {min} and {max}",colorAutomatic:"Automatic",colorNoFill:"No Fill",colorWhite:"White",colorBlack:"Black",colorLightGray:"Light Gray",colorLightBlue:"Light Blue",colorLightOrange:"Light Orange",colorLightYellow:"Light Yellow",colorLightGreen:"Light Green",colorPaleBlue:"Pale Blue",colorPaleOrange:"Pale Orange",colorPaleYellow:"Pale Yellow",colorPaleGreen:"Pale Green",colorSilver:"Silver",colorSkyBlue:"Sky Blue",colorCoral:"Coral",colorGold:"Gold",colorMint:"Mint",colorGray:"Gray",colorMediumBlue:"Medium Blue",colorOrange:"Orange",colorAmber:"Amber",colorMediumGreen:"Medium Green",colorDarkGray:"Dark Gray",colorRoyalBlue:"Royal Blue",colorRed:"Red",colorDarkGold:"Dark Gold",colorDarkGreen:"Dark Green",colorCharcoal:"Charcoal",colorDeepBlue:"Deep Blue",colorDarkRed:"Dark Red",colorOlive:"Olive",colorForest:"Forest",colorSlate:"Slate",colorNavy:"Navy",colorCrimson:"Crimson",colorDarkOlive:"Dark Olive",colorDeepForest:"Deep Forest",colorDarkSlate:"Dark Slate",colorMidnight:"Midnight",colorMaroon:"Maroon",colorCoffee:"Coffee",colorEvergreen:"Evergreen",colorDarkNavy:"Dark Navy",colorDarkMaroon:"Dark Maroon",colorDarkCoffee:"Dark Coffee",colorInkGreen:"Ink Green",numberFormat:"Number Format",nfGeneral:"General",nfText:"Text",nfNumber:"Number",nfPercent:"Percentage",nfScientific:"Scientific",nfAccounting:"Accounting",nfFinancial:"Financial",nfCurrency:"Currency",nfCurrencyRounded:"Currency Rounded",nfDate:"Date",nfTime:"Time",nfDateTime:"Date & Time",nfDuration:"Duration",nfCustom:"Other Number Formats…",nfMixed:"Mixed",nfIncreaseDecimals:"Increase Decimal",nfDecreaseDecimals:"Decrease Decimal",nfDialogTitle:"Format Cells",nfCategory:"Category",nfCatCustom:"Custom",nfDecimals:"Decimal places",nfThousands:"Use 1000 separator",nfSymbol:"Currency symbol",nfDateFormat:"Date format",nfTimeFormat:"Time format",nfCustomCode:"Custom format code",nfPreview:"Preview",nfPreviewSample:"Sample",find:"Find",findReplace:"Find & Replace",findPlaceholder:"Find what",replacePlaceholder:"Replace with",findPrev:"Previous",findNext:"Next",replace:"Replace",replaceAll:"Replace All",findScope:"Scope",findOptions:"Find options",scopeSheet:"Current sheet",scopeWorkbook:"Entire workbook",scopeSelection:"Current selection",matchCase:"Match case",matchEntireCell:"Match entire cell",findNoResult:"No results",findNeedSelection:"Select a range first",findReplacedAll:"Replaced {n} occurrence(s)",findClose:"Close",freezePane:"Freeze Panes",freezePanes:"Freeze Panes",freezeFirstRow:"Freeze First Row",freezeFirstCol:"Freeze First Column",unfreezePanes:"Unfreeze Panes",freezeToRow:"Freeze to Row",freezeToCol:"Freeze to Column",filter:"Filter",clearFilter:"Clear Filter",cancelFilter:"Cancel",filterSearchPlaceholder:"Search",filterSelectAll:"Select All",filterClearAll:"Clear All",filterOk:"OK",filterBlank:"Blanks",filterNonBlank:"Non-blanks",filterText:"Text Filters",filterNumber:"Number Filters",filterDate:"Date Filters",filterEquals:"Equals",filterNotEquals:"Does Not Equal",filterContains:"Contains",filterNotContains:"Does Not Contain",filterStartsWith:"Begins With",filterEndsWith:"Ends With",filterGreaterThan:"Greater Than",filterGreaterThanOrEqual:"Greater Than Or Equal To",filterLessThan:"Less Than",filterLessThanOrEqual:"Less Than Or Equal To",filterBetween:"Between",filterAnd:"And",filterCustom:"Custom Filter",filterNoData:"No data",filterFilteredCount:"{n} items",filterActive:"Filtering",filterByValue:"Filter by This Value",filterByThisColumn:"Filter This Column",conditionalFormat:"Conditional Formatting",cfHighlightRules:"Highlight Cell Rules",cfGreaterThan:"Greater Than",cfGreaterThanOrEqual:"Greater Than Or Equal To",cfLessThan:"Less Than",cfLessThanOrEqual:"Less Than Or Equal To",cfBetween:"Between",cfNotBetween:"Not Between",cfEqual:"Equal To",cfCellIs:"Cell Value",cfNotEqual:"Not Equal To",cfTextContains:"Text Contains",cfTextNotContains:"Text Does Not Contain",cfBlank:"Blanks",cfNotBlank:"Non-blanks",cfDuplicate:"Duplicate Values",cfUnique:"Unique Values",cfFormulaShort:"Formula",cfFormula:"Use a formula to determine which cells to format",cfFormulaExample:"e.g. =$A1>100",cfNewRule:"New Rule",cfManageRules:"Manage Rules",cfClearRules:"Clear Rules",cfClearSelected:"Clear Rules from Selected Cells",cfClearSheet:"Clear Rules from Entire Sheet",cfAppliedTo:"Applies to",cfRule:"Rule",cfFormat:"Format",cfPriority:"Priority",cfStopIfTrue:"Stop If True",cfEnabled:"Enabled",cfDelete:"Delete",cfEdit:"Edit",cfMoveUp:"Move Up",cfMoveDown:"Move Down",cfType:"Type",cfOperator:"When",cfValue:"Value",cfValue2:"To",cfManagerTitle:"Conditional Formatting Rules Manager",cfPreview:"Preview",cfNoRules:"No conditional formatting rules on this sheet",cfRuleTypeGeneric:"Custom Rule",cfBold:"Bold",cfItalic:"Italic",cfUnderline:"Underline",cfFontColor:"Font Color",cfFillColor:"Fill Color"}};function w(e,l){var o;return((o=Rr[e])==null?void 0:o[l])??l}const yn='-apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif',Ul=10,Mr=[{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'}],Br=[{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}],xr='<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>',Tr='<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>',Nr='<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>',Dr='<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>',Vr='<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>',Fr='<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>',Ir=[{value:"left",labelKey:"alignLeft",icon:xr},{value:"center",labelKey:"alignCenter",icon:Tr},{value:"right",labelKey:"alignRight",icon:Nr}],Ar=[{value:"top",labelKey:"alignTop",icon:Dr},{value:"middle",labelKey:"alignMiddle",icon:Vr},{value:"bottom",labelKey:"alignBottom",icon:Fr}],Hr=[{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>'}],Lr={bg:"#f4f4f4",gridBg:"#ffffff",headerBg:"#e8e8e8",headerBorder:"#c8c8c8",headerText:"#444",headerSep:"#b0b0b0",cornerBg:"#e0e0e0",gridLine:"#e0e0e0",selectionBg:"rgba(0, 120, 215, 0.12)",activeCellBorder:"#0078d7",cellText:"#1a1a1a",scrollTrack:"rgba(0,0,0,0.08)",scrollThumb:"rgba(0,0,0,0.25)",formulaBarBg:"#f0f0f0",formulaBarBorder:"#c8c8c8",formulaBarLabelText:"#333",formulaBarLabelBg:"#fff",formulaBarLabelBorder:"#c0c0c0",formulaBarInputBg:"#fff",formulaBarInputBorder:"#c0c0c0",formulaBarInputText:"#1a1a1a",formulaBarInputFocusBorder:"#0078d7",formulaBarInputFocusShadow:"rgba(0, 120, 215, 0.3)",wrapperBg:"#e8e8e8",cellEditorBorder:"#0078d7",cellEditorText:"#1a1a1a",cellEditorBg:"#fff",cellEditorShadow:"#0078d7",tabBarBg:"#e8e8e8",tabBarBorder:"#c0c0c0",tabActiveBg:"#ffffff",tabActiveText:"#1a1a1a",tabActiveBorder:"#0078d7",tabInactiveBg:"#dfdfdf",tabInactiveText:"#666",tabInactiveBorder:"transparent",tabHoverBg:"#e0e0e0",tabAddBtnColor:"#555",tabAddBtnHoverBg:"#d0d0d0",tabScrollBtnColor:"#888",tabScrollBtnHoverBg:"#d0d0d0",scrollbarThumb:"rgba(0,0,0,0.25)",scrollbarThumbHover:"rgba(0,0,0,0.4)",scrollBtnBg:"#e8e8e8",scrollBtnColor:"#666",scrollBtnHoverBg:"#d0d0d0",scrollBtnActiveBg:"#c0c0c0",scrollTrackBg:"rgba(0,0,0,0.06)",toolbarBg:"#f7f7f7",toolbarBorder:"#d8d8d8",toolbarBtnColor:"#444",toolbarBtnHoverBg:"#e6e6e6",toolbarBtnDisabledColor:"#b0b0b0",toolbarBtnActiveColor:"#0078d7",findMatchBg:"rgba(255, 213, 79, 0.45)",findActiveBg:"rgba(255, 179, 0, 0.75)"},Or={bg:"#1e1e1e",gridBg:"#252526",headerBg:"#252525",headerBorder:"#3e3e3e",headerText:"#999",headerSep:"#3e3e3e",cornerBg:"#2a2a2a",gridLine:"#3e3e3e",selectionBg:"rgba(0, 120, 215, 0.25)",activeCellBorder:"#0078d7",cellText:"#d4d4d4",scrollTrack:"rgba(255,255,255,0.06)",scrollThumb:"rgba(255,255,255,0.2)",formulaBarBg:"#2d2d2d",formulaBarBorder:"#3e3e3e",formulaBarLabelText:"#ccc",formulaBarLabelBg:"#3c3c3c",formulaBarLabelBorder:"#555",formulaBarInputBg:"#3c3c3c",formulaBarInputBorder:"#555",formulaBarInputText:"#d4d4d4",formulaBarInputFocusBorder:"#0078d7",formulaBarInputFocusShadow:"rgba(0, 120, 215, 0.4)",wrapperBg:"#1e1e1e",cellEditorBorder:"#0078d7",cellEditorText:"#d4d4d4",cellEditorBg:"#3c3c3c",cellEditorShadow:"#0078d7",tabBarBg:"#2a2a2a",tabBarBorder:"#3e3e3e",tabActiveBg:"#1e1e1e",tabActiveText:"#e0e0e0",tabActiveBorder:"#0078d7",tabInactiveBg:"#333333",tabInactiveText:"#888",tabInactiveBorder:"transparent",tabHoverBg:"#3a3a3a",tabAddBtnColor:"#999",tabAddBtnHoverBg:"#3a3a3a",tabScrollBtnColor:"#777",tabScrollBtnHoverBg:"#3a3a3a",scrollbarThumb:"rgba(255,255,255,0.2)",scrollbarThumbHover:"rgba(255,255,255,0.35)",scrollBtnBg:"#2d2d2d",scrollBtnColor:"#999",scrollBtnHoverBg:"#3d3d3d",scrollBtnActiveBg:"#4d4d4d",scrollTrackBg:"rgba(255,255,255,0.05)",toolbarBg:"#2a2a2a",toolbarBorder:"#3e3e3e",toolbarBtnColor:"#ccc",toolbarBtnHoverBg:"#3a3a3a",toolbarBtnDisabledColor:"#666",toolbarBtnActiveColor:"#4ea1ff",findMatchBg:"rgba(255, 213, 79, 0.35)",findActiveBg:"rgba(255, 179, 0, 0.6)"},Kl="__nf_custom__",Il="",Gl="",gl="@",qn="__NF_INVALID__",co=2958465,so=0;function bl(e){return e==null||e===""?!0:e.toUpperCase()==="GENERAL"}function uo(e){return e==="zh-CN"?"¥":"$"}function zr(e){return e.replace(/\*/g,"").replace(/_.|_\b/g,"")}function Vo(e){return e.replace(/"([^"]*)"/g,"$1")}function _r(e){let l=e,o;const n=l.match(/^\[([^\]]+)\]/);n&&(o=n[1].toLowerCase(),l=l.slice(n[0].length)),l=zr(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:o};let c=-1;for(let le=l.length-1;le>=0;le--){const se=l[le];if(se==="0"||se==="#"||se==="?"||se==="E"){c=le;break}}c<0&&(c=r);const s=r>0?l.slice(0,r):"",m=c<l.length-1?l.slice(c+1):"",v=l.slice(r,c+1),d=/[0#?]/.test(v),C=v.includes(",");let h=v.replace(/,/g,"");if(a){const le=h.search(/E/i);le>=0&&(h=h.slice(0,le))}const L=h.indexOf("."),oe=L>=0?h.slice(0,L):h,te=L>=0?h.slice(L+1):"",Y=(te.match(/[0#?]/g)||[]).length,k=(te.match(/0/g)||[]).length,Q=(oe.match(/0/g)||[]).length;return{hasDigits:d,decimals:Y,minDecimals:k,minIntDigits:Q,thousands:C,scale:i?100:1,scientific:a,prefix:s,suffix:m,color:o}}function $r(e){const l=[];let o=!1;const n=/\[h\]|\[mm\]|\[ss\]|yyyy|yy|y|mmmm|mmm|mm|m|dddd|ddd|dd|d|hh|h|ss|s|AM\/PM|am\/pm|"[^"]*"|\/|-|:|\s+|[^\s]/g;let a;for(;(a=n.exec(e))!==null;){const i=a[0];switch(i){case"[h]":o=!0,l.push({type:"hour",len:0});break;case"[mm]":o=!0,l.push({type:"minute",len:2});break;case"[ss]":o=!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(o?{type:"minute",len:4}:{type:"monthName",len:4});break;case"mmm":l.push(o?{type:"minute",len:3}:{type:"monthName",len:3});break;case"mm":l.push(o?{type:"minute",len:2}:{type:"month",len:2});break;case"m":l.push(o?{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:Vo(i),len:0}):l.push({type:"literal",text:i,len:0})}}return{tokens:l,isDuration:o}}const Fo=new Map;function Wr(e){const l=e.replace(/\[[^\]]*\]/gi,i=>/^\[(h|mm|ss)\]$/i.test(i)?i:"");if(/[ydhs]/.test(l)||/AM\/PM/i.test(l)||/\[h\]/i.test(l)){const i=e.split(";")[0]??e,{tokens:r,isDuration:c}=$r(i);return{kind:c?"duration":"date",sections:[],tokens:r,isDuration:c,raw:e}}return{kind:"number",sections:e.split(";").map(i=>_r(i)),tokens:[],isDuration:!1,raw:e}}function ql(e){const l=Fo.get(e);if(l)return l;const o=Wr(e);return Fo.set(e,o),o}function Io(e,l,o,n,a){const i=Math.pow(10,l),r=Math.round((e+Number.EPSILON)*i)/i,c=r<0,s=Math.abs(r);let v=new Intl.NumberFormat("en-US",{useGrouping:n,minimumIntegerDigits:a,minimumFractionDigits:l,maximumFractionDigits:l}).format(s);if(o<l&&l>0){const C=v.indexOf(".");if(C>=0){const y=v.substring(0,C);let h=v.substring(C+1);h=h.replace(/0+$/,""),h.length<o&&(h=h+"0".repeat(o-h.length)),v=h?`${y}.${h}`:y}}return`${c?"-":""}${v}`}function Ao(e,l){if(e===0)return(l>0?"0."+"0".repeat(l):"0")+"E+00";const o=Math.floor(Math.log10(Math.abs(e))),n=e/Math.pow(10,o),a=Io(n,l,l,!1,1),i=(o>=0?"+":"-")+String(Math.abs(o)).padStart(2,"0");return`${a}E${i}`}function Pr(e,l,o){if(!o.hasDigits)return Vo(o.prefix+o.suffix);const n=o.scale===100?e*100:e,a=o.scientific?Ao(n,o.decimals):Io(n,o.decimals,o.minDecimals,o.thousands,o.minIntDigits);return l+o.prefix+a+o.suffix}function Ur(e,l){const o=l.sections;if(o.length===0)return String(e);let n,a,i="";return e>0?(n=o[0],a=e):e<0?o[1]?(n=o[1],a=-e):(n=o[0],a=-e,i="-"):(n=o[2]??o[0],a=0),Pr(a,i,n)}function Kr(e){return new Date((e-25569)*864e5)}const Gr=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],qr=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],Ho=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],Yr=["January","February","March","April","May","June","July","August","September","October","November","December"],Xr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Lo=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function Nn(e,l){return String(e).padStart(l,"0")}function jr(e,l,o,n){const a=e.getUTCFullYear(),i=e.getUTCMonth()+1,r=e.getUTCDate(),c=e.getUTCDay(),s=o==="zh-CN";let m="",v=!1;for(const d of l)switch(d.type){case"literal":m+=d.text??"";break;case"year":m+=d.len>=4?String(a):String(a%100).padStart(2,"0");break;case"month":m+=Nn(v?e.getUTCMinutes():i,d.len);break;case"monthName":m+=d.len>=4?s?Gr[i-1]:Yr[i-1]:s?qr[i-1]:Xr[i-1];break;case"day":m+=Nn(r,d.len);break;case"weekday":m+=d.len>=4?s?Ho[c]:Lo[c]:s?Ho[c].slice(2):Lo[c].slice(0,3);break;case"hour":{let C=e.getUTCHours();if(d.len===0){const y=Math.floor(n*86400);C=Math.floor(y/3600)}m+=String(C),v=!0;break}case"minute":m+=Nn(e.getUTCMinutes(),d.len);break;case"second":m+=Nn(e.getUTCSeconds(),d.len);break;case"ampm":{const C=e.getUTCHours();m+=C<12?s?"上午":"AM":s?"下午":"PM";break}}return m}function Zr(e,l){const o=Math.floor(e*86400),n=Math.floor(o/3600),a=Math.floor(o%3600/60),i=o%60;let r="";for(const c of l)switch(c.type){case"literal":r+=c.text??"";break;case"hour":r+=String(n);break;case"minute":r+=Nn(a,c.len||2);break;case"second":r+=Nn(i,c.len||2);break;default:r+=""}return r}function Jr(e){if(e==="")return e;const l=Number(e);if(!isNaN(l)&&e.trim()!==""){const o=Math.abs(l);return o!==0&&(o>=1e15||o<1e-9)?Ao(l,9):e}return e}function Rl(e,l,o){if(bl(l))return Jr(e);if(l==null||l===gl)return e;const n=ql(l);if(n.kind==="date"||n.kind==="duration"){const i=Number(e);if(!isFinite(i))return e;if(n.kind==="date"){if(i<so||i>co)return qn}else if(i<0)return qn;return n.kind==="duration"?Zr(i,n.tokens):jr(Kr(i),n.tokens,o,i)}const a=Number(e);return isNaN(a)?e:Ur(a,n)}const Qr=["general","text","number","percent","scientific","accounting","financial","currency","currencyRounded","date","time","dateTime","duration","custom"];function fo(e,l){if(l===gl||l==="@")return!1;if(bl(l)){if(e==null||e===""||e.trim()==="")return!1;const n=Number(e);return!Number.isNaN(n)&&Number.isFinite(n)}const o=ql(l);return!!(o.kind==="number"&&Oo(o))}function Oo(e){return e.sections.some(l=>l.hasDigits)}function zo(e){if(e==null||bl(e)||e===gl||e==="@")return!1;const l=ql(e);return!!(l.kind==="date"||l.kind==="duration"||l.kind==="number"&&Oo(l))}function _o(e,l){if(l==null||bl(l)||l===gl||l==="@")return!1;const o=ql(l),n=Number(e);return Number.isFinite(n)?o.kind==="date"?n<so||n>co:o.kind==="duration"?n<0:!1:!1}const mo=30,po=0;function Yl(e){if(e==null||e===""||e.trim()==="")return!1;const l=Number(e);return!Number.isNaN(l)&&Number.isFinite(l)}function $o(e,l){if(e==null||e===Il||bl(e))return Yl(l);if(e===gl)return!1;const o=ql(e);return o.kind==="date"||o.kind==="duration"?!1:o.sections.some(n=>n.hasDigits)}function ea(e){if(!Yl(e))return 0;const l=String(Number(e));return l.indexOf(".")<0||/e/i.test(l)?0:l.slice(l.indexOf(".")+1).length}function ta(e,l){if(!$o(e,l))return-1;if(e==null||e===Il||bl(e))return ea(l);const n=ql(e).sections.find(a=>a.hasDigits);return n?n.decimals:-1}function la(e,l){let o=0;const n=/\[[^\]]*\]/g;let a;for(;(a=n.exec(e))!==null&&!/^\[(h|mm|ss)\]$/i.test(a[0]);)o=a.index+a[0].length;const i=e.slice(0,o),r=e.slice(o),c=r.search(/[0#?]/);if(c===-1)return e;let s=-1;for(let oe=r.length-1;oe>=0;oe--){const te=r[oe];if(te==="0"||te==="#"||te==="?"||te==="E"){s=oe;break}}if(s<c)return e;const m=r.slice(c,s+1),v=m.search(/E[+-]/i),d=v>=0?m.slice(0,v):m,C=d.indexOf("."),y=C>=0?(d.slice(C+1).match(/[0#?]/g)||[]).length:0;if(y===l)return e;let h;if(C<0)h=l>0?d+"."+"0".repeat(l):d;else if(l>y)h=d+"0".repeat(l-y);else{let oe=y-l;const te=d.split("");for(let Y=te.length-1;Y>=0&&oe>0;Y--){const k=te[Y];(k==="0"||k==="#"||k==="?")&&(te.splice(Y,1),oe--)}h=te.join(""),l===0&&h.endsWith(".")&&(h=h.slice(0,-1))}const L=h+(v>=0?m.slice(v):"");return i+r.slice(0,c)+L+r.slice(s+1)}function na(e,l){if(!Number.isInteger(l)||l<po||l>mo||e===Il)return null;if(e==null||bl(e))return l>0?"0."+"0".repeat(l):"0";if(e===gl)return null;const o=ql(e);return o.kind==="date"||o.kind==="duration"||!o.sections.some(n=>n.hasDigits)?null:e.split(";").map(n=>la(n,l)).join(";")}const ho=["¥","$","€","£"];function Wo(e,l){if(e==null||e===Il)return e??Gl;if(bl(e))return Gl;if(e===gl||e==="@")return gl;const o=uo(l),n=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=`${o}#,##0.00;(${o}#,##0.00);${o}"-"`,r="#,##0.00;[Red](#,##0.00)";if(Po(l).some(y=>y.value===e))return e;const s=e.replace(/\[[^\]]*\]/gi,y=>/^\[(h|mm|ss)\]$/i.test(y)?y:"");if(/\[(h|mm|ss)\]/i.test(s)&&!/[yd]/i.test(s))return"[h]:mm:ss";const m=/[yd]/i.test(s),v=/h|s|AM\/PM/i.test(s);if(m&&v)return a;if(m||/AM\/PM/i.test(s))return n;if(v)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 d=ho.find(y=>e.startsWith(y));if(d)return e.includes("(")?i:/\.\d/.test(e.slice(d.length))?o+"#,##0.00":o+"#,##0";const C=ql(e);return C.kind==="number"&&C.sections.some(y=>y.hasDigits)?"#,##0.00":Kl}function oa(e,l){return new Date(Date.UTC(e,l,0)).getUTCDate()}function ra(e,l,o){const n=Date.UTC(e,l-1,o)/864e5+25569;return n<=60?n-1:n}function Dn(e,l,o=new Date){const n=e.trim();if(!n||n.startsWith("=")||Yl(n))return null;const a=l==="zh-CN"?'yyyy"年"m"月"d"日"':"m/d/yyyy",i=l==="zh-CN"?'yyyy"年"m"月"d"日" h:mm:ss':"m/d/yyyy h:mm:ss",r="h:mm:ss";function c(C){const y=/^(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/.exec(C);if(!y)return null;const h=Number(y[1]),L=Number(y[2]),oe=y[3]!==void 0?Number(y[3]):0;return h>23||L>59||oe>59?null:(h*3600+L*60+oe)/86400}function s(C){let y=/^(\d{4})[-/](\d{1,2})[-/](\d{1,2})$/.exec(C),h,L,oe;if(y)h=Number(y[1]),L=Number(y[2]),oe=Number(y[3]);else if(y=/^(\d{4})年(\d{1,2})月(\d{1,2})日$/.exec(C))h=Number(y[1]),L=Number(y[2]),oe=Number(y[3]);else if(y=/^(\d{1,2})[-/](\d{1,2})$/.exec(C))h=o.getUTCFullYear(),L=Number(y[1]),oe=Number(y[2]);else return null;if(h<1900||h>9999||L<1||L>12||oe<1||oe>oa(h,L))return null;const te=ra(h,L,oe);return te>=so&&te<=co?te:null}const m=c(n);if(m!==null)return{serial:m,format:r};const v=/^(.+?)[T ](\d{1,2}:\d{1,2}(?::\d{1,2})?)$/.exec(n);if(v){const C=s(v[1].trim()),y=c(v[2]);if(C!==null&&y!==null)return{serial:C+y,format:i}}const d=s(n);return d!==null?{serial:d,format:a}:null}function aa(e,l){const o=e.trim();if(!o||o.startsWith("=")||!(o.includes(",")||o.includes("%")||ho.some(Y=>o.startsWith(Y)))||Dn(o,l))return null;const a=ho.find(Y=>o.startsWith(Y)),i=a?o.slice(a.length).trim():o;if(!i)return null;const r=/^([+-]?)(\d{1,3}(?:,\d{3})+)(?:\.(\d+))?(%?)$/.exec(i)||/^([+-]?)(\d+)(?:\.(\d+))?(%?)$/.exec(i);if(!r)return null;const c=r[1]==="-"?-1:1,s=r[2].replace(/,/g,""),m=r[3],v=(r[4]??"")==="%",d=m?m.length:0,C=+(s+(m?"."+m:""));if(!Number.isFinite(C))return null;const h=i.includes(",")?"#,##0":"0",L=d>0?"."+"0".repeat(d):"",oe=(a??"")+h+L+(v?"%":"");let te=C*c;return v&&(te=te/100),te=Math.round(te*1e12)/1e12,{num:te,format:oe}}function ia(e,l,o,n){const a=uo(e),i=n?"#,##0":"0",r=o>0?"."+"0".repeat(o):"",c=i+r;switch(l){case"general":return"";case"text":return gl;case"custom":return"";case"number":return c;case"percent":return c+"%";case"scientific":return"0."+"0".repeat(o)+"E+00";case"currency":return a+c;case"currencyRounded":return a+(n?"#,##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 Po(e){const l=uo(e);return[{label:w(e,"nfGeneral"),value:Gl},{label:w(e,"nfText"),value:gl},{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:`${l}#,##0.00;(${l}#,##0.00);${l}"-"`},{label:w(e,"nfFinancial"),value:"#,##0.00;[Red](#,##0.00)"},{label:w(e,"nfCurrency"),value:l+"#,##0.00"},{label:w(e,"nfCurrencyRounded"),value:l+"#,##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:Kl}]}const ca=["title"],sa=["innerHTML"],da={class:"sp-dropdown__value"},ua=["disabled"],fa=["placeholder"],ma=["disabled","onClick"],pa=["innerHTML"],ha={class:"sp-dropdown__item-label"},ga={key:2,class:"sp-dropdown__empty"},ba=["disabled"],Ca=t.defineComponent({__name:"dropdown",props:{modelValue:{},options:{},width:{default:"auto"},menuWidth:{default:void 0},visibleCount:{default:8},title:{default:""},modelOpen:{type:Boolean,default:void 0},hideTrigger:{type:Boolean,default:!1},align:{default:"left"},triggerEl:{default:null},fallbackLabel:{default:""},searchable:{type:Boolean,default:!1},searchPlaceholder:{default:""},triggerIcon:{default:""},triggerLabel:{default:""}},emits:["update:modelValue","change","update:modelOpen"],setup(e,{emit:l}){const o=e,n=l,a=t.ref(!1),i=t.ref(0),r=t.ref(null),c=t.ref(null),s=t.ref(null),m=t.ref({top:0,up:!1}),v=t.ref(void 0),d=t.ref(0),C=t.ref(!1),y=t.ref(""),h=t.ref(null),L=t.computed(()=>o.options.find(p=>String(p.value)===String(o.modelValue))),oe=t.computed(()=>o.menuWidth!==void 0?o.menuWidth:v.value),te=t.computed(()=>{if(!o.searchable||!y.value.trim())return o.options;const p=y.value.trim().toLowerCase();return o.options.filter(A=>String(A.label??"").toLowerCase().includes(p))}),Y=t.computed(()=>te.value.length>0),k=t.computed(()=>Math.min(o.visibleCount,te.value.length)),Q=t.computed(()=>te.value.slice(i.value,i.value+k.value)),le=t.computed(()=>i.value>0),se=t.computed(()=>i.value+k.value<te.value.length),Ke=t.computed(()=>te.value.length>k.value);function Oe(p){i.value=Math.max(0,Math.min(te.value.length-k.value,i.value+p))}function Ge(){const p=o.triggerEl??r.value;if(!p)return;const A=p.getBoundingClientRect();v.value=A.width,a.value=!0,o.searchable&&(y.value=""),o.modelOpen!==void 0&&n("update:modelOpen",!0);const $=A.bottom+4;o.align==="right"?m.value={right:window.innerWidth-A.right,top:$,up:!1}:m.value={left:A.left,top:$,up:!1};const ee=te.value.findIndex(U=>String(U.value)===String(o.modelValue));i.value=ee>=0?Math.max(0,Math.min(ee-Math.floor(k.value/2),te.value.length-k.value)):0,o.searchable&&t.nextTick(()=>{var U;return(U=h.value)==null?void 0:U.focus()}),t.nextTick(()=>{const U=o.triggerEl??r.value;if(!U)return;const O=U.getBoundingClientRect(),x=s.value;if(!x)return;const X=x.offsetHeight,Le=window.innerHeight-O.bottom-8,re=O.top-8,V=Le<X&&re>0;let G=V?O.top-X-4:O.bottom+4;G=Math.max(8,Math.min(window.innerHeight-X-8,G)),o.align==="right"?m.value={right:window.innerWidth-O.right,top:G,up:V}:m.value={left:O.left,top:G,up:V}})}function Te(){a.value=!1,y.value="",o.modelOpen!==void 0&&n("update:modelOpen",!1)}function qe(){a.value?Te():Ge()}function tt(p){p.disabled||(n("update:modelValue",p.value),n("change",p.value),Te())}function ye(p){var $,ee;if(!a.value)return;const A=p.target;($=r.value)!=null&&$.contains(A)||(ee=s.value)!=null&&ee.contains(A)||Te()}function ie(p){a.value&&(p.preventDefault(),Oe(p.deltaY>0?1:-1))}t.watch(a,p=>{t.nextTick(()=>{var A,$;p?((A=c.value)==null||A.addEventListener("wheel",ie,{passive:!1}),document.addEventListener("keydown",he)):(($=c.value)==null||$.removeEventListener("wheel",ie),document.removeEventListener("keydown",he))})});function he(p){a.value&&p.key==="Escape"&&Te()}t.watch(()=>o.modelOpen,p=>{p!==void 0&&p!==a.value&&(p?Ge():Te())});function Ae(p){a.value&&(d.value=p.touches[0].clientY,C.value=!0)}function dt(p){if(!a.value||!C.value)return;const A=p.touches[0].clientY-d.value;Math.abs(A)>5&&(Oe(A<0?1:-1),d.value=p.touches[0].clientY)}function ue(){C.value=!1}function ve(p){p.key==="Escape"&&(p.stopPropagation(),Te())}return t.onMounted(()=>{document.addEventListener("pointerdown",ye),window.addEventListener("resize",Te),window.addEventListener("scroll",Te,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",ye),document.removeEventListener("keydown",he),window.removeEventListener("resize",Te),window.removeEventListener("scroll",Te,!0)}),(p,A)=>{var $,ee,U,O,x;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:qe},[($=L.value)!=null&&$.icon||e.triggerIcon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__icon",innerHTML:((ee=L.value)==null?void 0:ee.icon)||e.triggerIcon},null,8,sa)):t.createCommentVNode("",!0),t.createElementVNode("span",da,t.toDisplayString((U=L.value)!=null&&U.icon||e.triggerIcon?((O=L.value)==null?void 0:O.label)??e.triggerLabel:((x=L.value)==null?void 0:x.label)??e.fallbackLabel),1),A[5]||(A[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,ca)),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[a.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:s,class:t.normalizeClass(["sp-dropdown__menu",{"sp-dropdown__menu--up":m.value.up}]),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",minWidth:oe.value!==void 0?typeof oe.value=="number"?oe.value+"px":oe.value:void 0}),onKeydown:ve,onMousedown:A[4]||(A[4]=t.withModifiers(()=>{},["prevent"]))},[Ke.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!le.value}]),disabled:!le.value,onClick:A[0]||(A[0]=X=>Oe(-1))},[...A[6]||(A[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,ua)):t.createCommentVNode("",!0),e.searchable?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:1,ref_key:"searchInputRef",ref:h,"onUpdate:modelValue":A[1]||(A[1]=X=>y.value=X),class:"sp-dropdown__search",type:"text",placeholder:e.searchPlaceholder,onMousedown:A[2]||(A[2]=t.withModifiers(()=>{},["stop"]))},null,40,fa)),[[t.vModelText,y.value]]):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:c,class:"sp-dropdown__list",onTouchstart:Ae,onTouchmove:dt,onTouchend:ue},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Q.value,X=>(t.openBlock(),t.createElementBlock("button",{key:String(X.value),type:"button",class:t.normalizeClass(["sp-dropdown__item",{"sp-dropdown__item--active":!X.disabled&&String(X.value)===String(e.modelValue),"sp-dropdown__item--disabled":X.disabled}]),disabled:X.disabled,onClick:Le=>tt(X)},[X.icon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__item-icon",innerHTML:X.icon},null,8,pa)):t.createCommentVNode("",!0),t.createElementVNode("span",ha,t.toDisplayString(X.label),1)],10,ma))),128))],544),e.searchable&&!Y.value?(t.openBlock(),t.createElementBlock("div",ga," 无匹配 ")):t.createCommentVNode("",!0),Ke.value?(t.openBlock(),t.createElementBlock("button",{key:3,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!se.value}]),disabled:!se.value,onClick:A[3]||(A[3]=X=>Oe(1))},[...A[7]||(A[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,ba)):t.createCommentVNode("",!0)],38)):t.createCommentVNode("",!0)]),_:1})]))],4)}}}),Yt=(e,l)=>{const o=e.__vccOpts||e;for(const[n,a]of l)o[n]=a;return o},Jt=Yt(Ca,[["__scopeId","data-v-391d39ca"]]),ya=["title","onClick"],Yn=Yt(t.defineComponent({__name:"colorPicker",props:{modelOpen:{type:Boolean,default:void 0},colorKey:{default:"text"},currentColor:{default:""},locale:{default:"zh-CN"},triggerEl:{default:null}},emits:["update:modelValue","change","update:modelOpen"],setup(e,{expose:l,emit:o}){const n=e,a=o,i=[[{key:"colorAutomatic",value:""},{key:"colorLightBlue",value:"#DEEBF7"},{key:"colorLightOrange",value:"#FCE4D6"},{key:"colorLightYellow",value:"#FFE79A"},{key:"colorLightGreen",value:"#E2EFDA"}],[{key:"colorLightGray",value:"#F2F2F2"},{key:"colorPaleBlue",value:"#BDD7EE"},{key:"colorPaleOrange",value:"#F8CBAD"},{key:"colorPaleYellow",value:"#FFD966"},{key:"colorPaleGreen",value:"#C6EFCE"}],[{key:"colorSilver",value:"#D9D9D9"},{key:"colorSkyBlue",value:"#9BC2E6"},{key:"colorCoral",value:"#F4B183"},{key:"colorGold",value:"#FFC000"},{key:"colorMint",value:"#A9D18E"}],[{key:"colorGray",value:"#BFBFBF"},{key:"colorMediumBlue",value:"#6FA8DC"},{key:"colorOrange",value:"#ED7D31"},{key:"colorAmber",value:"#F1C232"},{key:"colorMediumGreen",value:"#70AD47"}],[{key:"colorDarkGray",value:"#A5A5A5"},{key:"colorRoyalBlue",value:"#4A86E8"},{key:"colorRed",value:"#E06666"},{key:"colorDarkGold",value:"#BF8F00"},{key:"colorDarkGreen",value:"#548235"}],[{key:"colorCharcoal",value:"#808080"},{key:"colorDeepBlue",value:"#2E75B6"},{key:"colorDarkRed",value:"#CC4125"},{key:"colorOlive",value:"#806000"},{key:"colorForest",value:"#375623"}],[{key:"colorSlate",value:"#595959"},{key:"colorNavy",value:"#1F4E79"},{key:"colorCrimson",value:"#993300"},{key:"colorDarkOlive",value:"#5C4500"},{key:"colorDeepForest",value:"#2D6A4F"}],[{key:"colorDarkSlate",value:"#404040"},{key:"colorMidnight",value:"#17375E"},{key:"colorMaroon",value:"#5A1E00"},{key:"colorCoffee",value:"#3D3000"},{key:"colorEvergreen",value:"#1B4332"}],[{key:"colorBlack",value:"#000000"},{key:"colorDarkNavy",value:"#0C2340"},{key:"colorDarkMaroon",value:"#2E0A00"},{key:"colorDarkCoffee",value:"#1F1800"},{key:"colorInkGreen",value:"#081C15"}]],r=[[{key:"colorNoFill",value:""},{key:"colorLightBlue",value:"#DEEBF7"},{key:"colorLightOrange",value:"#FCE4D6"},{key:"colorLightYellow",value:"#FFE79A"},{key:"colorLightGreen",value:"#E2EFDA"}],[{key:"colorWhite",value:"#FFFFFF"},{key:"colorPaleBlue",value:"#BDD7EE"},{key:"colorPaleOrange",value:"#F8CBAD"},{key:"colorPaleYellow",value:"#FFD966"},{key:"colorPaleGreen",value:"#C6EFCE"}],[{key:"colorLightGray",value:"#F2F2F2"},{key:"colorSkyBlue",value:"#9BC2E6"},{key:"colorCoral",value:"#F4B183"},{key:"colorGold",value:"#FFC000"},{key:"colorMint",value:"#A9D18E"}],[{key:"colorSilver",value:"#D9D9D9"},{key:"colorMediumBlue",value:"#6FA8DC"},{key:"colorOrange",value:"#ED7D31"},{key:"colorAmber",value:"#F1C232"},{key:"colorMediumGreen",value:"#70AD47"}],[{key:"colorGray",value:"#BFBFBF"},{key:"colorRoyalBlue",value:"#4A86E8"},{key:"colorRed",value:"#E06666"},{key:"colorDarkGold",value:"#BF8F00"},{key:"colorDarkGreen",value:"#548235"}],[{key:"colorDarkGray",value:"#A5A5A5"},{key:"colorDeepBlue",value:"#2E75B6"},{key:"colorDarkRed",value:"#CC4125"},{key:"colorOlive",value:"#806000"},{key:"colorForest",value:"#375623"}],[{key:"colorCharcoal",value:"#808080"},{key:"colorNavy",value:"#1F4E79"},{key:"colorCrimson",value:"#993300"},{key:"colorDarkOlive",value:"#5C4500"},{key:"colorDeepForest",value:"#2D6A4F"}],[{key:"colorSlate",value:"#595959"},{key:"colorMidnight",value:"#17375E"},{key:"colorMaroon",value:"#5A1E00"},{key:"colorCoffee",value:"#3D3000"},{key:"colorEvergreen",value:"#1B4332"}],[{key:"colorDarkSlate",value:"#404040"},{key:"colorDarkNavy",value:"#0C2340"},{key:"colorDarkMaroon",value:"#2E0A00"},{key:"colorDarkCoffee",value:"#1F1800"},{key:"colorInkGreen",value:"#081C15"}]],c=t.computed(()=>n.colorKey==="fill"?r:i);function s(Y){return w(n.locale,Y)}function m(Y){const k=n.currentColor;return!k&&!Y?!0:k?k.toLowerCase()===Y.toLowerCase():!1}const v=t.ref(!1),d=t.ref(null),C=t.ref(null),y=t.ref({top:0});t.watch(()=>n.modelOpen,Y=>{Y!==void 0&&Y!==v.value&&(Y?L():oe())});function h(Y){const k=d.value,Q=C.value,le=Y.target;k&&k.contains(le)||Q&&Q.contains(le)||oe()}function L(){const Y=n.triggerEl??d.value;if(!Y)return;v.value=!0,n.modelOpen!==void 0&&a("update:modelOpen",!0);const k=Y.getBoundingClientRect();let Q=window.innerWidth-k.right;const le=120;let se;k.left-le<4&&(Q=void 0,se=Math.max(4,k.left)),y.value=Q!==void 0?{right:Q,top:k.bottom+4}:{left:se,top:k.bottom+4},t.nextTick(()=>{const Ke=n.triggerEl??d.value;if(!Ke)return;const Oe=Ke.getBoundingClientRect(),Ge=C.value;if(!Ge)return;const Te=Ge.offsetHeight,qe=window.innerHeight-Oe.bottom-8,tt=Oe.top-8;let ie=qe<Te&&tt>0?Oe.top-Te-4:Oe.bottom+4;ie=Math.max(4,Math.min(window.innerHeight-Te-4,ie)),y.value=Q!==void 0?{right:window.innerWidth-Oe.right,top:ie}:{left:se,top:ie},document.addEventListener("pointerdown",h)})}function oe(){v.value=!1,n.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",h)}function te(Y){a("update:modelValue",Y),a("change",Y),oe()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",h)}),l({open:v,openMenu:L,close:oe}),(Y,k)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:d,class:"color-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[v.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:C,class:"color-picker__menu",style:t.normalizeStyle({left:y.value.left!==void 0?y.value.left+"px":void 0,right:y.value.right!==void 0?y.value.right+"px":void 0,top:y.value.top+"px"}),onMousedown:k[0]||(k[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.value,(Q,le)=>(t.openBlock(),t.createElementBlock("div",{key:le,class:"color-picker__row"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Q,se=>(t.openBlock(),t.createElementBlock("button",{key:se.value,class:t.normalizeClass(["color-picker__swatch",{"color-picker__swatch--selected":m(se.value)}]),title:s(se.key),style:t.normalizeStyle({background:se.value||"transparent",border:se.value?"1px solid rgba(0,0,0,0.15)":"1px dashed #999"}),onClick:Ke=>te(se.value)},null,14,ya))),128))]))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-09b67665"]]),wa=["title","onClick"],va={viewBox:"0 0 30 30",class:"border-picker__icon"},ka=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],Ea={class:"border-picker__label"},Sa=Yt(t.defineComponent({__name:"borderPicker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},currentBorder:{default:"none"},triggerEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:l,emit:o}){const n=e,a=o,i=[{key:"bottom",i18nKey:"borderBottom"},{key:"top",i18nKey:"borderTop"},{key:"left",i18nKey:"borderLeft"},{key:"right",i18nKey:"borderRight"},{key:"none",i18nKey:"borderNone"},{key:"all",i18nKey:"borderAll"},{key:"outer",i18nKey:"borderOuter"},{key:"thickOuter",i18nKey:"borderThickOuter"}],r=[{name:"top",x1:4,y1:4,x2:26,y2:4},{name:"bottom",x1:4,y1:26,x2:26,y2:26},{name:"left",x1:4,y1:4,x2:4,y2:26},{name:"right",x1:26,y1:4,x2:26,y2:26},{name:"vMid",x1:15,y1:4,x2:15,y2:26},{name:"hMid",x1:4,y1:15,x2:26,y2:15}],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"]},s={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function m(Y,k){return s[Y].includes(k)?"thick":c[Y].includes(k)?"solid":"dashed"}const v=t.ref(!1),d=t.ref(null),C=t.ref(null),y=t.ref({top:0});t.watch(()=>n.modelOpen,Y=>{Y!==void 0&&Y!==v.value&&(Y?L():oe())});function h(Y){const k=d.value,Q=C.value,le=Y.target;k&&k.contains(le)||Q&&Q.contains(le)||oe()}function L(){const Y=n.triggerEl??d.value;if(!Y)return;v.value=!0,n.modelOpen!==void 0&&a("update:modelOpen",!0);const k=Y.getBoundingClientRect();let Q=window.innerWidth-k.right;const le=160;let se;k.left-le<4&&(Q=void 0,se=Math.max(4,k.left)),y.value=Q!==void 0?{right:Q,top:k.bottom+4}:{left:se,top:k.bottom+4},t.nextTick(()=>{const Ke=n.triggerEl??d.value;if(!Ke)return;const Oe=Ke.getBoundingClientRect(),Ge=C.value;if(!Ge)return;const Te=Ge.offsetHeight,qe=window.innerHeight-Oe.bottom-8,tt=Oe.top-8;let ie=qe<Te&&tt>0?Oe.top-Te-4:Oe.bottom+4;ie=Math.max(4,Math.min(window.innerHeight-Te-4,ie)),y.value=Q!==void 0?{right:window.innerWidth-Oe.right,top:ie}:{left:se,top:ie},document.addEventListener("pointerdown",h)})}function oe(){v.value=!1,n.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",h)}function te(Y){a("change",Y),oe()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",h)}),l({open:v,openMenu:L,close:oe}),(Y,k)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:d,class:"border-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[v.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:C,class:"border-picker__menu",style:t.normalizeStyle({left:y.value.left!==void 0?y.value.left+"px":void 0,right:y.value.right!==void 0?y.value.right+"px":void 0,top:y.value.top+"px"}),onMousedown:k[0]||(k[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,Q=>t.createElementVNode("button",{key:Q.key,class:"border-picker__item",title:t.unref(w)(e.locale,Q.i18nKey),onClick:le=>te(Q.key)},[(t.openBlock(),t.createElementBlock("svg",va,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(r,le=>t.createElementVNode("line",{key:le.name,x1:le.x1,y1:le.y1,x2:le.x2,y2:le.y2,stroke:"currentColor","stroke-width":m(Q.key,le.name)==="thick"?3:1.5,"stroke-dasharray":m(Q.key,le.name)==="dashed"?"0 4":"none","stroke-linecap":m(Q.key,le.name)==="dashed"?"round":"square"},null,8,ka)),64))])),t.createElementVNode("span",Ea,t.toDisplayString(t.unref(w)(e.locale,Q.i18nKey)),1)],8,wa)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-e8c6528a"]]),Ra=["title","onClick"],Ma={viewBox:"0 0 1024 1024",class:"sort-picker__icon",fill:"none",stroke:"currentColor","stroke-width":"64","stroke-linecap":"round","stroke-linejoin":"round"},Ba=["x1","y1","x2","y2"],xa=["d"],Ta={class:"sort-picker__label"},Na=Yt(t.defineComponent({__name:"sortPicker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},currentSort:{default:"asc"},triggerEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:l,emit:o}){const n=e,a=o,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"},s=t.ref(!1),m=t.ref(null),v=t.ref(null),d=t.ref({top:0});t.watch(()=>n.modelOpen,oe=>{oe!==void 0&&oe!==s.value&&(oe?y():h())});function C(oe){const te=m.value,Y=v.value,k=oe.target;te&&te.contains(k)||Y&&Y.contains(k)||h()}function y(){const oe=n.triggerEl??m.value;if(!oe)return;s.value=!0,n.modelOpen!==void 0&&a("update:modelOpen",!0);const te=oe.getBoundingClientRect();let Y=window.innerWidth-te.right;const k=160;let Q;te.left-k<4&&(Y=void 0,Q=Math.max(4,te.left)),d.value=Y!==void 0?{right:Y,top:te.bottom+4}:{left:Q,top:te.bottom+4},t.nextTick(()=>{const le=n.triggerEl??m.value;if(!le)return;const se=le.getBoundingClientRect(),Ke=v.value;if(!Ke)return;const Oe=Ke.offsetHeight,Ge=window.innerHeight-se.bottom-8,Te=se.top-8;let tt=Ge<Oe&&Te>0?se.top-Oe-4:se.bottom+4;tt=Math.max(4,Math.min(window.innerHeight-Oe-4,tt)),d.value=Y!==void 0?{right:window.innerWidth-se.right,top:tt}:{left:Q,top:tt},document.addEventListener("pointerdown",C)})}function h(){s.value=!1,n.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",C)}function L(oe){a("change",oe),h()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",C)}),l({open:s,openMenu:y,close:h}),(oe,te)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:m,class:"sort-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[s.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:v,class:"sort-picker__menu",style:t.normalizeStyle({left:d.value.left!==void 0?d.value.left+"px":void 0,right:d.value.right!==void 0?d.value.right+"px":void 0,top:d.value.top+"px"}),onMousedown:te[0]||(te[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,Y=>t.createElementVNode("button",{key:Y.key,class:"sort-picker__item",title:t.unref(w)(e.locale,Y.i18nKey),onClick:k=>L(Y.key)},[(t.openBlock(),t.createElementBlock("svg",Ma,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(r,k=>t.createElementVNode("line",{key:k.name,x1:k.x1,y1:k.y1,x2:k.x2,y2:k.y2},null,8,Ba)),64)),t.createElementVNode("path",{d:c[Y.key]},null,8,xa)])),t.createElementVNode("span",Ta,t.toDisplayString(t.unref(w)(e.locale,Y.i18nKey)),1)],8,Ra)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-42aed824"]]),Da=["title","onClick"],Va=["innerHTML"],Fa={class:"merge-picker__label"},Ia=Yt(t.defineComponent({__name:"mergePicker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},triggerEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:l,emit:o}){const n=e,a=o,i=t.ref(!1),r=t.ref(null),c=t.ref(null),s=t.ref({top:0});t.watch(()=>n.modelOpen,y=>{y!==void 0&&y!==i.value&&(y?v():d())});function m(y){const h=r.value,L=c.value,oe=y.target;h&&h.contains(oe)||L&&L.contains(oe)||d()}function v(){const y=n.triggerEl??r.value;if(!y)return;i.value=!0,n.modelOpen!==void 0&&a("update:modelOpen",!0);const h=y.getBoundingClientRect();let L=window.innerWidth-h.right;const oe=160;let te;h.left-oe<4&&(L=void 0,te=Math.max(4,h.left)),s.value=L!==void 0?{right:L,top:h.bottom+4}:{left:te,top:h.bottom+4},t.nextTick(()=>{const Y=n.triggerEl??r.value;if(!Y)return;const k=Y.getBoundingClientRect(),Q=c.value;if(!Q)return;const le=Q.offsetHeight,se=window.innerHeight-k.bottom-8,Ke=k.top-8;let Ge=se<le&&Ke>0?k.top-le-4:k.bottom+4;Ge=Math.max(4,Math.min(window.innerHeight-le-4,Ge)),s.value=L!==void 0?{right:window.innerWidth-k.right,top:Ge}:{left:te,top:Ge},document.addEventListener("pointerdown",m)})}function d(){i.value=!1,n.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",m)}function C(y){a("change",y),d()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",m)}),l({open:i,openMenu:v,close:d}),(y,h)=>(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:s.value.left!==void 0?s.value.left+"px":void 0,right:s.value.right!==void 0?s.value.right+"px":void 0,top:s.value.top+"px"}),onMousedown:h[0]||(h[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Hr),L=>(t.openBlock(),t.createElementBlock("button",{key:L.key,class:"merge-picker__item",title:t.unref(w)(e.locale,L.labelKey),onClick:oe=>C(L.key)},[t.createElementVNode("span",{class:"merge-picker__icon",innerHTML:L.icon},null,8,Va),t.createElementVNode("span",Fa,t.toDisplayString(t.unref(w)(e.locale,L.labelKey)),1)],8,Da))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-ba2f4cee"]]),Aa=["title","disabled"],Ha={class:"cf-menu-trigger__label"},La=["disabled"],Oa=["disabled"],za=["disabled"],_a=["disabled"],$a=["disabled"],Wa=["disabled"],Pa=["disabled"],Ua=["onClick"],Ka=["disabled"],Ga=["disabled"],qa=["disabled"],Ya=["disabled"],Xa=Yt(t.defineComponent({__name:"conditional-format-menu",props:{locale:{},hasSelection:{type:Boolean},themeVars:{default:()=>({})}},emits:["preset","new-rule","manage","clear"],setup(e,{emit:l}){const o=l,n=t.ref(null),a=t.ref(null),i=t.ref(null),r=t.ref(null),c=t.ref(null),s=t.ref(!1),m=t.ref(null),v=t.ref("right"),d=t.ref({right:0,top:0,up:!1}),C=t.ref(!1),y=t.ref(!1),h=t.ref(!1),L=t.ref(!1),oe=t.ref(!1),te=t.ref(!1),Y=t.ref({top:0}),k=t.ref({top:0});let Q;const le=[{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 se(){s.value?Oe():Ke()}function Ke(){const O=a.value;if(!O)return;const x=O.getBoundingClientRect();s.value=!0,m.value=null,d.value={right:window.innerWidth-x.right,top:x.bottom+4,up:!1},t.nextTick(()=>{var $e;const X=($e=i.value)==null?void 0:$e.closest(".cf-menu");if(!X)return;const Le=X.offsetHeight,re=window.innerHeight-x.bottom-8,V=x.top-8,G=re<Le&&V>0;let xe=G?x.top-Le-4:x.bottom+4;xe=Math.max(8,Math.min(window.innerHeight-Le-8,xe)),d.value={right:window.innerWidth-x.right,top:xe,up:G},Ge()})}function Oe(){s.value=!1,clearTimeout(Q),m.value=null}function Ge(){const O=i.value;O&&(C.value=O.scrollTop>1,y.value=O.scrollTop+O.clientHeight<O.scrollHeight-1)}function Te(O){const x=i.value;x&&(x.scrollTop=Math.max(0,Math.min(x.scrollHeight-x.clientHeight,x.scrollTop+O*30)))}function qe(O){const x=O==="highlight"?r.value:c.value;if(!x)return;const X=x.scrollTop>1,Le=x.scrollTop+x.clientHeight<x.scrollHeight-1;O==="highlight"?(h.value=X,L.value=Le):(oe.value=X,te.value=Le)}function tt(O,x){const X=O==="highlight"?r.value:c.value;X&&(X.scrollTop=Math.max(0,Math.min(X.scrollHeight-X.clientHeight,X.scrollTop+x*30)))}function ye(O,x){O&&(O.scrollHeight<=O.clientHeight||(x.preventDefault(),O.scrollTop=Math.max(0,Math.min(O.scrollHeight-O.clientHeight,O.scrollTop+x.deltaY))))}function ie(O){ye(i.value,O),Ge()}function he(O){ye(r.value,O),qe("highlight")}function Ae(O){ye(c.value,O),qe("clear")}function dt(O){var X,Le,re,V,G,xe;if(!s.value)return;const x=O.target;(X=n.value)!=null&&X.contains(x)||(Le=i.value)!=null&&Le.contains(x)||(V=(re=r.value)==null?void 0:re.closest(".cf-submenu-wrap"))!=null&&V.contains(x)||(xe=(G=c.value)==null?void 0:G.closest(".cf-submenu-wrap"))!=null&&xe.contains(x)||Oe()}function ue(O,x){clearTimeout(Q),m.value=O,t.nextTick(()=>{var pe,it;const X=(x==null?void 0:x.currentTarget)instanceof HTMLElement?x.currentTarget:null;if(!X)return;const Le=X.getBoundingClientRect(),re=O==="highlight"?(pe=r.value)==null?void 0:pe.closest(".cf-submenu-wrap"):(it=c.value)==null?void 0:it.closest(".cf-submenu-wrap");if(!re)return;const V=re.offsetWidth,G=Le.right+V+8>window.innerWidth,xe=Le.left-V-8<0;let $e="right";(G&&!xe||G&&xe)&&($e="left"),v.value=$e;const bt=Math.max(8,Math.min(window.innerHeight-30,Le.top-4)),ge=$e==="right"?{left:Le.right+4,top:bt}:{right:window.innerWidth-Le.left+4,top:bt};O==="highlight"?Y.value=ge:k.value=ge,qe(O)})}function ve(){clearTimeout(Q),Q=setTimeout(()=>{m.value=null},150)}function p(){clearTimeout(Q)}function A(O){o("preset",O),Oe()}function $(){o("new-rule"),Oe()}function ee(){o("manage"),Oe()}function U(O){o("clear",O),Oe()}return t.onMounted(()=>{document.addEventListener("pointerdown",dt),window.addEventListener("resize",Oe),window.addEventListener("scroll",Oe,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",dt),window.removeEventListener("resize",Oe),window.removeEventListener("scroll",Oe,!0)}),(O,x)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:n,class:"cf-menu-root"},[t.createElementVNode("button",{ref_key:"btnRef",ref:a,type:"button",class:"toolbar-btn cf-menu-trigger",title:t.unref(w)(e.locale,"conditionalFormat"),disabled:!e.hasSelection,onClick:se},[x[22]||(x[22]=t.createStaticVNode('<svg class="cf-menu-trigger__icon" viewBox="0 0 1097 1024" version="1.1" fill="currentColor" data-v-5e87a212><path d="M877.714286 52.809143V487.862857h-73.142857V125.952H73.142857v585.142857h247.661714v73.142857H0v-731.428571z" data-v-5e87a212></path><path d="M841.142857 267.702857v73.142857H36.571429v-73.142857zM287.451429 457.142857v73.142857H36.571429v-73.142857z" data-v-5e87a212></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-5e87a212></path><path d="M877.421714 637.952v73.142857H568.539429v-73.142857zM877.421714 784.237714v73.142857H568.539429v-73.142857z" data-v-5e87a212></path></svg>',1)),t.createElementVNode("span",Ha,t.toDisplayString(t.unref(w)(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,Aa),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"cf-pop"},{default:t.withCtx(()=>[s.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"cf-menu",style:t.normalizeStyle({...e.themeVars,right:d.value.right+"px",top:d.value.top+"px"}),onClick:x[8]||(x[8]=t.withModifiers(()=>{},["stop"])),onMousedown:x[9]||(x[9]=t.withModifiers(()=>{},["prevent"]))},[C.value||y.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["cf-menu__nav",{"cf-menu__nav--disabled":!C.value}]),disabled:!C.value,onClick:x[0]||(x[0]=X=>Te(-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,La)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"menuRef",ref:i,class:"cf-menu__body",onScroll:Ge,onWheelPassive:ie},[t.createElementVNode("div",{class:"cf-menu__item cf-menu__item--sub",onMouseenter:x[1]||(x[1]=X=>ue("highlight",X)),onMouseleave:ve},[t.createElementVNode("span",null,t.toDisplayString(t.unref(w)(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]=X=>e.hasSelection&&A("blank"))},t.toDisplayString(t.unref(w)(e.locale,"cfBlank")),11,Oa),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]=X=>e.hasSelection&&A("notBlank"))},t.toDisplayString(t.unref(w)(e.locale,"cfNotBlank")),11,za),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]=X=>e.hasSelection&&A("duplicate"))},t.toDisplayString(t.unref(w)(e.locale,"cfDuplicate")),11,_a),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]=X=>e.hasSelection&&A("unique"))},t.toDisplayString(t.unref(w)(e.locale,"cfUnique")),11,$a),x[28]||(x[28]=t.createElementVNode("div",{class:"cf-menu__sep"},null,-1)),t.createElementVNode("button",{type:"button",class:"cf-menu__item",onClick:$},t.toDisplayString(t.unref(w)(e.locale,"cfNewRule")),1),t.createElementVNode("button",{type:"button",class:"cf-menu__item",onClick:ee},t.toDisplayString(t.unref(w)(e.locale,"cfManageRules")),1),t.createElementVNode("div",{class:"cf-menu__item cf-menu__item--sub",onMouseenter:x[6]||(x[6]=X=>ue("clear",X)),onMouseleave:ve},[t.createElementVNode("span",null,t.toDisplayString(t.unref(w)(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),C.value||y.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["cf-menu__nav",{"cf-menu__nav--disabled":!y.value}]),disabled:!y.value,onClick:x[7]||(x[7]=X=>Te(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,Wa)):t.createCommentVNode("",!0)],36)):t.createCommentVNode("",!0)]),_:1})])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"cf-pop"},{default:t.withCtx(()=>[s.value&&m.value==="highlight"?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["cf-submenu-wrap",{"cf-submenu-wrap--left":v.value==="left"}]),style:t.normalizeStyle({...e.themeVars,left:Y.value.left!==void 0?Y.value.left+"px":void 0,right:Y.value.right!==void 0?Y.value.right+"px":void 0,top:Y.value.top+"px"}),onClick:x[13]||(x[13]=t.withModifiers(()=>{},["stop"])),onMousedown:x[14]||(x[14]=t.withModifiers(()=>{},["prevent"])),onMouseenter:p,onMouseleave:ve},[h.value||L.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["cf-subnav",{"cf-subnav--disabled":!h.value}]),disabled:!h.value,onClick:x[10]||(x[10]=X=>tt("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,Pa)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"highlightSubRef",ref:r,class:"cf-submenu",onScroll:x[11]||(x[11]=X=>qe("highlight")),onWheelPassive:he},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(le,X=>t.createElementVNode("button",{key:X.type,type:"button",class:"cf-menu__subitem",onClick:Le=>A(X.type)},t.toDisplayString(t.unref(w)(e.locale,X.key)),9,Ua)),64))],544),h.value||L.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["cf-subnav",{"cf-subnav--disabled":!L.value}]),disabled:!L.value,onClick:x[12]||(x[12]=X=>tt("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,Ka)):t.createCommentVNode("",!0)],38)):t.createCommentVNode("",!0)]),_:1})])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"cf-pop"},{default:t.withCtx(()=>[s.value&&m.value==="clear"?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["cf-submenu-wrap",{"cf-submenu-wrap--left":v.value==="left"}]),style:t.normalizeStyle({...e.themeVars,left:k.value.left!==void 0?k.value.left+"px":void 0,right:k.value.right!==void 0?k.value.right+"px":void 0,top:k.value.top+"px"}),onClick:x[20]||(x[20]=t.withModifiers(()=>{},["stop"])),onMousedown:x[21]||(x[21]=t.withModifiers(()=>{},["prevent"])),onMouseenter:p,onMouseleave:ve},[oe.value||te.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["cf-subnav",{"cf-subnav--disabled":!oe.value}]),disabled:!oe.value,onClick:x[15]||(x[15]=X=>tt("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,Ga)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"clearSubRef",ref:c,class:"cf-submenu",onScroll:x[18]||(x[18]=X=>qe("clear")),onWheelPassive:Ae},[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]=X=>e.hasSelection&&U("selection"))},t.toDisplayString(t.unref(w)(e.locale,"cfClearSelected")),11,qa),t.createElementVNode("button",{type:"button",class:"cf-menu__subitem",onClick:x[17]||(x[17]=X=>U("sheet"))},t.toDisplayString(t.unref(w)(e.locale,"cfClearSheet")),1)],544),oe.value||te.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["cf-subnav",{"cf-subnav--disabled":!te.value}]),disabled:!te.value,onClick:x[19]||(x[19]=X=>tt("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,Ya)):t.createCommentVNode("",!0)],38)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-5e87a212"]]),ja=["disabled","title","onClick"],Za={class:"calc-picker__label"},Ja=Yt(t.defineComponent({__name:"calcPicker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},triggerEl:{default:null},disabled:{type:Boolean,default:!1}},emits:["update:modelOpen","change"],setup(e,{expose:l,emit:o}){const n=e,a=o,i=[{key:"sum",labelKey:"sum"},{key:"avg",labelKey:"avg"},{key:"count",labelKey:"count"}],r=t.ref(!1),c=t.ref(null),s=t.ref(null),m=t.ref({top:0});t.watch(()=>n.modelOpen,h=>{h!==void 0&&h!==r.value&&(h?d():C())});function v(h){const L=c.value,oe=s.value,te=h.target;L&&L.contains(te)||oe&&oe.contains(te)||C()}function d(){const h=n.triggerEl??c.value;if(!h)return;r.value=!0,n.modelOpen!==void 0&&a("update:modelOpen",!0);const L=h.getBoundingClientRect();let oe=window.innerWidth-L.right;const te=160;let Y;L.left-te<4&&(oe=void 0,Y=Math.max(4,L.left)),m.value=oe!==void 0?{right:oe,top:L.bottom+4}:{left:Y,top:L.bottom+4},t.nextTick(()=>{const k=n.triggerEl??c.value;if(!k)return;const Q=k.getBoundingClientRect(),le=s.value;if(!le)return;const se=le.offsetHeight,Ke=window.innerHeight-Q.bottom-8,Oe=Q.top-8;let Te=Ke<se&&Oe>0?Q.top-se-4:Q.bottom+4;Te=Math.max(4,Math.min(window.innerHeight-se-4,Te)),m.value=oe!==void 0?{right:window.innerWidth-Q.right,top:Te}:{left:Y,top:Te},document.addEventListener("pointerdown",v)})}function C(){r.value=!1,n.modelOpen!==void 0&&a("update:modelOpen",!1),document.removeEventListener("pointerdown",v)}function y(h){n.disabled||(a("change",h),C())}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",v)}),l({open:r,openMenu:d,close:C}),(h,L)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:c,class:"calc-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:s,class:"calc-picker__menu",style:t.normalizeStyle({left: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"}),onMousedown:L[0]||(L[0]=t.withModifiers(()=>{},["stop","prevent"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,oe=>t.createElementVNode("button",{key:oe.key,class:t.normalizeClass(["calc-picker__item",{"calc-picker__item--disabled":e.disabled}]),disabled:e.disabled,title:t.unref(w)(e.locale,oe.labelKey),onClick:te=>y(oe.key)},[t.createElementVNode("span",Za,t.toDisplayString(t.unref(w)(e.locale,oe.labelKey)),1)],10,ja)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-c0ff1163"]]),Qa={class:"tb-item","data-key":"undo"},ei=["title","disabled"],ti={class:"toolbar-btn__label"},li={class:"tb-item","data-key":"redo"},ni=["title","disabled"],oi={class:"toolbar-btn__label"},ri={class:"tb-item","data-key":"paint"},ai=["title","disabled"],ii={class:"toolbar-btn__label"},ci={class:"tb-item","data-key":"clear"},si=["title","disabled"],di={class:"toolbar-btn__label"},ui={class:"tb-item","data-key":"font"},fi={class:"tb-item","data-key":"fontSize"},mi={class:"toolbar-font-size"},pi=["value","title"],hi=["title"],gi=["title","disabled"],bi=["title","disabled"],Ci={class:"tb-item","data-key":"bold"},yi=["title","disabled"],wi={class:"toolbar-btn__label"},vi={class:"tb-item","data-key":"italic"},ki=["title","disabled"],Ei={class:"toolbar-btn__label"},Si={class:"tb-item","data-key":"underline"},Ri=["title","disabled"],Mi={class:"toolbar-btn__label"},Bi={class:"tb-item","data-key":"strike"},xi=["title","disabled"],Ti={class:"toolbar-btn__label"},Ni={class:"tb-item","data-key":"textColor"},Di={class:"toolbar-split"},Vi=["title","disabled"],Fi={viewBox:"0 0 1024 1024",fill:"currentColor"},Ii=["fill"],Ai={class:"toolbar-btn__label"},Hi=["title","disabled"],Li={class:"tb-item","data-key":"fillColor"},Oi={class:"toolbar-split"},zi=["title","disabled"],_i={viewBox:"0 0 1024 1024",fill:"currentColor"},$i=["fill"],Wi={class:"toolbar-btn__label"},Pi=["title","disabled"],Ui={class:"tb-item","data-key":"border"},Ki={class:"toolbar-split"},Gi=["title","disabled"],qi={viewBox:"0 0 30 30",fill:"none",stroke:"currentColor"},Yi=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],Xi={class:"toolbar-btn__label"},ji=["title","disabled"],Zi={class:"tb-item","data-key":"hAlign"},Ji={class:"tb-item","data-key":"vAlign"},Qi={class:"tb-item","data-key":"wrap"},ec=["title"],tc={class:"toolbar-btn__label"},lc={class:"tb-item","data-key":"merge"},nc={class:"toolbar-split"},oc=["title","disabled"],rc={class:"toolbar-btn__label"},ac=["title","disabled"],ic={class:"tb-item","data-key":"numFmt"},cc={class:"toolbar-number-format-group"},sc=["title","disabled"],dc=["title","disabled"],uc={class:"tb-item","data-key":"calc"},fc={class:"toolbar-split"},mc=["title","disabled"],pc={class:"toolbar-btn__label"},hc=["title","disabled"],gc={class:"tb-item","data-key":"sort"},bc={class:"toolbar-split"},Cc=["title","disabled"],yc={viewBox:"0 0 1024 1024",fill:"none",stroke:"currentColor","stroke-width":"64","stroke-linecap":"round","stroke-linejoin":"round"},wc=["x1","y1","x2","y2"],vc=["d"],kc={class:"toolbar-btn__label"},Ec=["title","disabled"],Sc={class:"tb-item","data-key":"filter"},Rc=["disabled","title"],Mc={class:"toolbar-btn__label"},Bc={class:"tb-item","data-key":"freeze"},xc={class:"tb-item","data-key":"cf"},Tc={class:"tb-item","data-key":"find"},Nc=["title"],Dc={class:"toolbar-btn__label"},Vc=["disabled"],Fc=["disabled"],Uo='<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>',Ic='<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>',Ac='<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>',Hc='<svg viewBox="0 0 1024 1024" fill="currentColor"><path fill="none" stroke="currentColor" stroke-width="64" stroke-linejoin="round" stroke-linecap="round" d="M160 160 H864 V864 H160 Z" /><path fill="none" stroke="currentColor" stroke-width="64" stroke-linecap="round" d="M160 448 H864" /><path 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>',go=2,Lc=6,Oc=34,zc=Yt(t.defineComponent({__name:"toolbar",props:{locale:{},canUndo:{type:Boolean},canRedo:{type:Boolean},paintFmtActive:{type:Boolean},hasSelection:{type:Boolean},fontFamilyOptions:{},fontSizeOptions:{},selFontFamily:{},selFontSize:{},fontSizeInput:{},fontSizeMenuOpen:{type:Boolean},selFontWeight:{type:Boolean},selFontStyle:{type:Boolean},selUnderline:{type:Boolean},selStrikethrough:{type:Boolean},selTextColor:{},textColorMenuOpen:{type:Boolean},selFillColor:{},fillColorMenuOpen:{type:Boolean},cachedTextColor:{},cachedFillColor:{},borderMenuOpen:{type:Boolean},cachedBorder:{},sortMenuOpen:{type:Boolean},cachedSortOrder:{},canSort:{type:Boolean},canFilter:{type:Boolean},filterActive:{type:Boolean},selHAlign:{},selVAlign:{},selWrap:{type:Boolean},hAlignOptions:{},vAlignOptions:{},mergeMenuOpen:{type:Boolean},calcMenuOpen:{type:Boolean},isSingleCell:{type:Boolean},hasFreeze:{type:Boolean},freezePanesDisabled:{type:Boolean},themeVars:{},selNumberFormat:{},nfOptions:{},canIncreaseDecimals:{type:Boolean},canDecreaseDecimals:{type:Boolean}},emits:["undo","redo","paint-format","clear-format","font-size-blur","font-size-toggle","font-size-step-up","font-size-step-down","bold-toggle","italic-toggle","underline-toggle","strikethrough-toggle","apply-text-color","apply-fill-color","apply-border","apply-sort","wrap-toggle","apply-merge","calc-sum","calc-avg","calc-count","find","increase-decimals","decrease-decimals","toggle-filter","cf-new-rule","cf-manage","font-family-change","font-size-change","h-align-change","v-align-change","font-size-input","text-color-change","fill-color-change","number-format-change","freeze-change","cf-preset","font-size-keydown","update:font-size-menu-open","update:text-color-menu-open","update:fill-color-menu-open","update:border-menu-open","update:sort-menu-open","update:merge-menu-open","update:calc-menu-open","border-change","sort-change","merge-change","cf-clear"],setup(e,{expose:l,emit:o}){const n=[{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(Je,E){return i[Je].includes(E)?"thick":a[Je].includes(E)?"solid":"dashed"}const c={none:"borderNone",bottom:"borderBottom",top:"borderTop",left:"borderLeft",right:"borderRight",all:"borderAll",outer:"borderOuter",thickOuter:"borderThickOuter"},s=[{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}],m={asc:"M832 800V288M672 448l160-160 160 160",desc:"M832 224v512M672 576l160 160 160-160"},v=["undo","redo","paint","clear","sep1","font","fontSize","sep2","bold","italic","underline","strike","sep3","textColor","fillColor","border","sep4","hAlign","vAlign","wrap","merge","sep6","numFmt","sep7","calc","sort","filter","freeze","cf","find"],d=t.ref(null),C=t.ref(null),y=t.ref(null),h=t.ref(null),L=t.ref(null),oe=t.ref(null),te=t.ref(null),Y=t.ref(null),k=t.ref(null),Q=t.ref(null),le=t.ref(new Set),se=t.ref(!1),Ke=t.ref(!1),Oe=t.ref(0),Ge=t.ref(!1),Te=t.ref(!1),qe=t.ref(!1),tt=new Map,ye=t.computed(()=>le.value.size>0);function ie(Je){return le.value.has(Je)}const he=t.computed(()=>{const Je=C.value;return Je instanceof HTMLElement?Je:void 0});function Ae(Je){return he.value?!ie(Je):!0}function dt(){for(const Je of v){const E=tt.get(Je);if(E===void 0||E===0)return!0}return!1}function ue(){if(!d.value)return;d.value.querySelectorAll(".tb-item").forEach(E=>{const ne=E.dataset.key;if(!ne)return;const Et=E.offsetWidth;Et>0?tt.set(ne,Et):tt.has(ne)||tt.set(ne,0)})}function ve(Je,E){if(Je.size!==E.size)return!1;for(const ne of Je)if(!E.has(ne))return!1;return!0}let p=0,A=0;function $(){p&&cancelAnimationFrame(p),!(A>60)&&(A++,p=requestAnimationFrame(()=>requestAnimationFrame(ee)))}function ee(){if(!d.value)return;const Je=d.value.clientWidth-Lc*2;if(Je<=0){$();return}A=0,(tt.size===0||dt())&&ue();let E=0;for(const Et of v)E+=(tt.get(Et)??0)+go;const ne=new Set;if(E>Je){const Et=Je-Oc-go;let Dt=0;for(let Ot=0;Ot<v.length;Ot++){const de=v[Ot],g=(tt.get(de)??0)+go;if(Dt+g>Et){for(let M=Ot;M<v.length;M++)ne.add(v[M]);break}Dt+=g}}ve(ne,le.value)||(le.value=ne,Oe.value++,ne.size===0&&(se.value=!1)),qe.value=!0}let U=null;const O=t.ref(0),x=t.computed(()=>{const Je=y.value,E={position:"fixed",top:"0px",right:"0px"};if(!Je)return{...ge.themeVars,...E};O.value;const ne=Je.getBoundingClientRect();return{...ge.themeVars,position:"fixed",top:`${ne.bottom+4}px`,right:`${window.innerWidth-ne.right}px`}});function X(){se.value&&(O.value++,t.nextTick(()=>ee()))}function Le(Je){var ne,Et,Dt;if(!se.value)return;const E=Je.target;(ne=E.closest)!=null&&ne.call(E,".overflow-menu-wrap")||(Et=y.value)!=null&&Et.contains(E)||(Dt=E.closest)!=null&&Dt.call(E,".cf-menu, .sp-dropdown__menu, .color-picker__menu")||(Ke.value=!0,se.value=!1,t.nextTick(()=>{Ke.value=!1}))}function re(){se.value=!se.value,se.value&&t.nextTick($e)}function V(){se.value=!1,pe("find")}function G(){se.value=!1,pe("toggle-filter")}function xe(){se.value=!1}function $e(){const Je=C.value;Je&&(Ge.value=Je.scrollTop>1,Te.value=Je.scrollTop+Je.clientHeight<Je.scrollHeight-1)}function bt(Je){const E=C.value;E&&(E.scrollTop=Math.max(0,Math.min(E.scrollHeight-E.clientHeight,E.scrollTop+Je*40)))}l({closeOverflow:xe}),t.onMounted(()=>{$(),d.value&&(U=new ResizeObserver(()=>{se.value||$()}),U.observe(d.value)),document.addEventListener("pointerdown",Le,!0),window.addEventListener("resize",X),window.addEventListener("load",$),window.addEventListener("orientationchange",$)}),t.onBeforeUnmount(()=>{p&&cancelAnimationFrame(p),U==null||U.disconnect(),document.removeEventListener("pointerdown",Le,!0),window.removeEventListener("resize",X),window.removeEventListener("load",$),window.removeEventListener("orientationchange",$)});const ge=e,pe=o,it=t.computed(()=>ge.selNumberFormat===Il?w(ge.locale,"nfMixed"):""),It=t.computed(()=>{const Je=[{label:w(ge.locale,"freezeFirstRow"),value:"firstRow",icon:Ic},{label:w(ge.locale,"freezeFirstCol"),value:"firstCol",icon:Ac}];return ge.hasFreeze?Je.unshift({label:w(ge.locale,"unfreezePanes"),value:"unfreeze",icon:Hc}):Je.unshift({label:w(ge.locale,"freezePanes"),value:"panes",icon:Uo,disabled:ge.freezePanesDisabled}),Je});return(Je,E)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{ref_key:"rootEl",ref:d,class:t.normalizeClass(["toolbar",{"toolbar--ready":qe.value}]),onMousedown:E[56]||(E[56]=t.withModifiers(()=>{},["prevent"]))},[(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ae("undo"),to:he.value},[t.createElementVNode("div",Qa,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canUndo}]),title:t.unref(w)(e.locale,"undo"),disabled:!e.canUndo,onClick:E[0]||(E[0]=ne=>pe("undo"))},[E[60]||(E[60]=t.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M596.16 284.064H258.56l101.376-101.44a31.968 31.968 0 1 0-45.248-45.216L178.56 273.504c-11.904 11.872-18.496 27.84-18.56 44.8a63.04 63.04 0 0 0 18.56 45.28l136.128 136.16a31.904 31.904 0 0 0 45.248 0 31.968 31.968 0 0 0 0-45.248l-106.752-106.496H596.16c114.88 0 208.32 93.312 208.32 208s-93.44 208-208.32 208h-223.36a32 32 0 0 0 0 64h223.36c150.144 0 272.32-122.016 272.32-272 0-149.984-122.176-272-272.32-272"})],-1)),t.createElementVNode("span",ti,t.toDisplayString(t.unref(w)(e.locale,"undo")),1)],10,ei)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ae("redo"),to:he.value},[t.createElementVNode("div",li,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canRedo}]),title:t.unref(w)(e.locale,"redo"),disabled:!e.canRedo,onClick:E[1]||(E[1]=ne=>pe("redo"))},[E[61]||(E[61]=t.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{transform:"translate(1024, 0) scale(-1, 1)",d:"M596.16 284.064H258.56l101.376-101.44a31.968 31.968 0 1 0-45.248-45.216L178.56 273.504c-11.904 11.872-18.496 27.84-18.56 44.8a63.04 63.04 0 0 0 18.56 45.28l136.128 136.16a31.904 31.904 0 0 0 45.248 0 31.968 31.968 0 0 0 0-45.248l-106.752-106.496H596.16c114.88 0 208.32 93.312 208.32 208s-93.44 208-208.32 208h-223.36a32 32 0 0 0 0 64h223.36c150.144 0 272.32-122.016 272.32-272 0-149.984-122.176-272-272.32-272"})],-1)),t.createElementVNode("span",oi,t.toDisplayString(t.unref(w)(e.locale,"redo")),1)],10,ni)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ae("paint"),to:he.value},[t.createElementVNode("div",ri,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.paintFmtActive}]),title:t.unref(w)(e.locale,"paintFormat"),disabled:!e.hasSelection,onClick:E[2]||(E[2]=ne=>pe("paint-format"))},[E[62]||(E[62]=t.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M722.285714 438.857143a36.571429 36.571429 0 0 1-36.571428 36.571428h-512a36.571429 36.571429 0 0 1-36.571429-36.571428V164.571429a36.571429 36.571429 0 0 1 36.571429-36.571429h512a36.571429 36.571429 0 0 1 36.571428 36.571429V256h128a36.571429 36.571429 0 0 1 36.571429 36.571429v294.4a36.571429 36.571429 0 0 1-31.890286 36.278857L448 675.766857V859.428571a36.571429 36.571429 0 0 1-32.292571 36.315429l-4.278858 0.256a36.571429 36.571429 0 0 1-36.571428-36.571429v-215.771428a36.571429 36.571429 0 0 1 31.890286-36.278857l406.966857-52.553143V329.142857h-91.428572v109.714286z m-73.142857-237.714286h-438.857143V402.285714h438.857143V201.142857z"})],-1)),t.createElementVNode("span",ii,t.toDisplayString(t.unref(w)(e.locale,"paintFormat")),1)],10,ai)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ae("clear"),to:he.value},[t.createElementVNode("div",ci,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.hasSelection}]),title:t.unref(w)(e.locale,"clearFormat"),disabled:!e.hasSelection,onClick:E[3]||(E[3]=ne=>pe("clear-format"))},[E[63]||(E[63]=t.createElementVNode("svg",{class:"toolbar-btn__icon",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M672.748 105.674c-3.666-3.799-8.778-5.949-14.125-5.949-5.341 0-10.459 2.15-14.119 5.949L10.418 754.633c-7.789 8.163-7.789 20.798 0 28.967l123.353 126.213c7.782 7.979 23.113 14.461 34.111 14.461h395.042c12.774-0.742 24.882-5.854 34.162-14.461l416.525-426.362c7.751-8.163 7.751-20.76 0-28.916l-340.92-348.861h0.057zM557.85 832.801c-9.273 8.582-21.343 13.707-34.111 14.461H217.888c-12.781-0.742-24.882-5.867-34.162-14.461l-58.074-59.482c-7.782-8.163-7.782-20.804 0-28.967l232.333-237.87c3.666-3.799 8.778-5.949 14.125-5.949s10.453 2.15 14.119 5.949l231.102 236.551c7.744 8.157 7.744 20.753 0 28.916l-59.539 60.909 0.058-0.057z m0 0"})],-1)),t.createElementVNode("span",di,t.toDisplayString(t.unref(w)(e.locale,"clearFormat")),1)],10,si)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ae("sep1"),to:he.value},[E[64]||(E[64]=t.createElementVNode("div",{class:"tb-item","data-key":"sep1"},[t.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ae("font"),to:he.value},[t.createElementVNode("div",ui,[t.createVNode(Jt,{class:"toolbar-font","model-value":e.selFontFamily,options:e.fontFamilyOptions,width:ie("font")?"100%":110,"menu-width":ie("font")?120:void 0,"visible-count":8,title:t.unref(w)(e.locale,"fontFamily"),align:"right",onChange:E[4]||(E[4]=ne=>pe("font-family-change",ne))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ae("fontSize"),to:he.value},[t.createElementVNode("div",fi,[t.createElementVNode("div",mi,[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:E[5]||(E[5]=t.withModifiers(()=>{},["stop"])),onInput:E[6]||(E[6]=ne=>pe("font-size-input",ne.target.value)),onBlur:E[7]||(E[7]=ne=>pe("font-size-blur")),onKeydown:E[8]||(E[8]=ne=>pe("font-size-keydown",ne))},null,40,pi),t.createVNode(Jt,{class:"toolbar-font-size__dropdown","model-value":e.selFontSize,options:e.fontSizeOptions,width:ie("fontSize")?"100%":56,"menu-width":ie("fontSize")?120:56,"visible-count":9,title:t.unref(w)(e.locale,"fontSize"),"hide-trigger":!0,"model-open":e.fontSizeMenuOpen,align:"right","trigger-el":Q.value,"onUpdate:modelOpen":E[9]||(E[9]=ne=>pe("update:font-size-menu-open",ne)),onChange:E[10]||(E[10]=ne=>pe("font-size-change",ne))},null,8,["model-value","options","width","menu-width","title","model-open","trigger-el"]),t.createElementVNode("button",{ref_key:"fontSizeArrowRef",ref:Q,class:"toolbar-font-size__btn",type:"button",title:t.unref(w)(e.locale,"fontSize"),onMousedown:E[11]||(E[11]=t.withModifiers(()=>{},["prevent"])),onClick:E[12]||(E[12]=ne=>pe("font-size-toggle"))},[...E[65]||(E[65]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053333 361.386667a32 32 0 0 1 45.226667 0L512 648.106667l286.72-286.72a32 32 0 1 1 45.226667 45.226666l-309.333334 309.333334a32 32 0 0 1-45.226666 0L180.053333 406.613333a32 32 0 0 1 0-45.226666z"})],-1)])],40,hi),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(w)(e.locale,"fontSizeDecrease"),disabled:!e.hasSelection,onMousedown:E[13]||(E[13]=t.withModifiers(()=>{},["prevent"])),onClick:E[14]||(E[14]=ne=>pe("font-size-step-down"))},[...E[66]||(E[66]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M675.2 184.533333h260.266667a12.8 12.8 0 0 1 12.8 12.8v21.333334a12.8 12.8 0 0 1-12.8 12.8H675.2a12.8 12.8 0 0 1-12.8-12.8v-21.333334a12.8 12.8 0 0 1 12.8-12.8zM687.744 739.413333l87.722667 197.717334a12.8 12.8 0 0 0 11.733333 7.594666h54.016a12.8 12.8 0 0 0 11.605333-18.133333l-7.466666-16.213333-131.2-287.829334-35.413334-77.653333-166.570666-365.525333a36.266667 36.266667 0 0 0-66.432 0.938666l-154.154667 365.482667-34.688 82.261333-34.688 82.218667-84.778667 201.045333-6.570666 15.658667a12.8 12.8 0 0 0 11.776 17.749333h57.557333a12.8 12.8 0 0 0 11.904-8.106666l102.4-258.474667 343.466667-4.010667 29.781333 65.28zM480.426667 284.672l132.352 290.261333 12.288 27.050667-279.808 3.242667 13.184-31.232 122.026666-289.28z"})],-1)])],40,gi),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(w)(e.locale,"fontSizeIncrease"),disabled:!e.hasSelection,onMousedown:E[15]||(E[15]=t.withModifiers(()=>{},["prevent"])),onClick:E[16]||(E[16]=ne=>pe("font-size-step-up"))},[...E[67]||(E[67]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M769.066667 77.952v93.781333h-93.866667a12.8 12.8 0 0 0-12.8 12.8v46.933334a12.8 12.8 0 0 0 12.8 12.8h93.866667v93.952a12.8 12.8 0 0 0 12.8 12.8h46.933333a12.8 12.8 0 0 0 12.8-12.8V244.266667h93.866667a12.8 12.8 0 0 0 12.8-12.8v-46.933334a12.8 12.8 0 0 0-12.8-12.8h-93.866667V77.952a12.8 12.8 0 0 0-12.8-12.8h-46.933333a12.8 12.8 0 0 0-12.8 12.8zM687.744 739.413333l87.722667 197.717334a12.8 12.8 0 0 0 11.733333 7.594666h54.016a12.8 12.8 0 0 0 11.605333-18.133333l-7.466666-16.213333-131.2-287.829334-35.413334-77.653333-166.570666-365.525333a36.266667 36.266667 0 0 0-66.432 0.938666l-154.154667 365.482667-34.688 82.261333-34.688 82.218667-84.778667 201.045333-6.570666 15.658667a12.8 12.8 0 0 0 11.776 17.749333h57.557333a12.8 12.8 0 0 0 11.904-8.106666l102.4-258.474667 343.466667-4.010667 29.781333 65.28zM480.426667 284.672l132.352 290.261333 12.288 27.050667-279.808 3.242667 13.184-31.232 122.026666-289.28z"})],-1)])],40,bi)])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ae("sep2"),to:he.value},[E[68]||(E[68]=t.createElementVNode("div",{class:"tb-item","data-key":"sep2"},[t.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ae("bold"),to:he.value},[t.createElementVNode("div",Ci,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontWeight}]),title:t.unref(w)(e.locale,"bold"),disabled:!e.hasSelection,onClick:E[17]||(E[17]=ne=>pe("bold-toggle"))},[E[69]||(E[69]=t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M214.857 889.143v-68.571h68.571V203.429H214.857v-68.571h411.429v1.257c96.114 10.629 171.429 87.383 171.429 181.6 0 58.971-29.486 111.086-75.109 144.457 72.069 39.291 120.823 113.234 120.823 198.4 0 119.291-95.634 216.594-217.12 227.543l-0.286.029H214.857z m388.572-388.571H352v320h251.429c95.086 0 171.429-72.091 171.429-160s-76.343-160-171.429-160z m0-297.143H352v228.571h251.429l5.211-0.091c67.52-2.515 120.503-53.235 120.503-114.195 0-62.537-55.749-114.285-125.714-114.285z"})],-1)),t.createElementVNode("span",wi,t.toDisplayString(t.unref(w)(e.locale,"bold")),1)],10,yi)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ae("italic"),to:he.value},[t.createElementVNode("div",vi,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontStyle}]),title:t.unref(w)(e.locale,"italic"),disabled:!e.hasSelection,onClick:E[18]||(E[18]=ne=>pe("italic-toggle"))},[E[70]||(E[70]=t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M730.143 127.714v64.286h-112.329l-166.521 621.429h128.871v64.286H276.286v-64.286h108.45l166.5-621.429H426.286V127.714h303.857z"})],-1)),t.createElementVNode("span",Ei,t.toDisplayString(t.unref(w)(e.locale,"italic")),1)],10,ki)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ae("underline"),to:he.value},[t.createElementVNode("div",Si,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selUnderline}]),title:t.unref(w)(e.locale,"underline"),disabled:!e.hasSelection,onClick:E[19]||(E[19]=ne=>pe("underline-toggle"))},[E[71]||(E[71]=t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M512 123.639a36.409 36.409 0 0 1 33.642 22.525l230.59 558.27a36.409 36.409 0 1 1-67.284 27.768L638.072 560.545H385.928l-70.876 171.656a36.409 36.409 0 1 1-67.332-27.768l230.59-558.27A36.409 36.409 0 0 1 512 123.639z m-95.974 364.089h191.948L512 255.439l-95.974 232.289zM769.289 827.544c19.418 0 38.836 14.564 38.836 38.836 0 19.418-14.564 33.982-29.127 33.982H259.565c-19.418 0-38.836-14.564-38.836-38.836 0-19.418 14.564-33.982 29.127-33.982h519.433z"})],-1)),t.createElementVNode("span",Mi,t.toDisplayString(t.unref(w)(e.locale,"underline")),1)],10,Ri)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ae("strike"),to:he.value},[t.createElementVNode("div",Bi,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selStrikethrough}]),title:t.unref(w)(e.locale,"strikethrough"),disabled:!e.hasSelection,onClick:E[20]||(E[20]=ne=>pe("strikethrough-toggle"))},[E[72]||(E[72]=t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M182.044 490.667h659.911a34.133 34.133 0 0 1 4.642 67.948l-4.597 0.319h-135.395c40.05 37 60.803 81.601 60.803 133.575 0 128.569-147.092 211.171-307.382 192.512-101.717-11.833-173.352-52.565-210.944-122.971a34.133 34.133 0 0 1 60.211-32.176c25.942 48.606 77.46 77.915 158.606 87.381 124.837 14.473 231.242-45.283 231.242-124.746 0-53.339-36.636-96.802-116.736-131.345l-5.279-2.23H182.044a34.133 34.133 0 0 1-33.815-29.492L147.911 524.8a34.133 34.133 0 0 1 29.491-33.815l4.642-0.318z m68.767-176.447c6.918-128.796 128.432-203.343 287.812-184.82 99.579 11.56 175.81 47.923 226.737 109.636a34.133 34.133 0 1 1-52.657 43.463c-38.775-47.013-98.759-75.639-181.999-85.288-123.654-14.381-211.627 36.591-211.627 117.009 0 35.135 10.65 61.349 37.774 90.203l5.826 6.007c4.278 4.369 8.966 8.875 11.377 10.923l1.411 0.91H288.085l-1.092-1.729c-6.508-9.376-38.958-54.386-36.182-106.314z"})],-1)),t.createElementVNode("span",Ti,t.toDisplayString(t.unref(w)(e.locale,"strikethrough")),1)],10,xi)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ae("sep3"),to:he.value},[E[73]||(E[73]=t.createElementVNode("div",{class:"tb-item","data-key":"sep3"},[t.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ae("textColor"),to:he.value},[t.createElementVNode("div",Ni,[t.createElementVNode("div",Di,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(w)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:E[21]||(E[21]=ne=>pe("apply-text-color"))},[(t.openBlock(),t.createElementBlock("svg",Fi,[E[74]||(E[74]=t.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[t.createElementVNode("path",{d:"M663.120842 529.946947H364.759579l-84.07579 212.884211a53.894737 53.894737 0 0 1-50.122105 34.169263h-14.551579a34.869895 34.869895 0 0 1-32.498526-47.696842L443.715368 70.063158a53.894737 53.894737 0 0 1 50.122106-34.115369h41.768421a53.894737 53.894737 0 0 1 50.176 34.277053l257.670737 659.078737a34.977684 34.977684 0 0 1-32.552421 47.696842h-14.389895a53.894737 53.894737 0 0 1-50.229895-34.277053l-83.159579-212.776421z m-35.139368-89.788631l-113.340632-289.953684-114.472421 289.953684h227.813053z"})],-1)),t.createElementVNode("path",{d:"M62.895 844.369m53.895 0l790.474 0q53.895 0 53.895 53.895l0 26.947q0 53.895-53.895 53.895l-790.474 0q-53.895 0-53.895-53.895l0-26.947q0-53.895 53.895-53.895z",fill:e.cachedTextColor||"#000000"},null,8,Ii)])),t.createElementVNode("span",Ai,t.toDisplayString(t.unref(w)(e.locale,"fontColor")),1)],8,Vi),t.createElementVNode("button",{ref_key:"textColorArrowRef",ref:h,class:"toolbar-btn toolbar-split__arrow",title:t.unref(w)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:E[22]||(E[22]=ne=>pe("update:text-color-menu-open",!e.textColorMenuOpen))},[...E[75]||(E[75]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,Hi),t.createVNode(Yn,{"model-open":e.textColorMenuOpen,"color-key":"text","current-color":e.selTextColor,locale:e.locale,"trigger-el":h.value,"onUpdate:modelOpen":E[23]||(E[23]=ne=>pe("update:text-color-menu-open",ne)),onChange:E[24]||(E[24]=ne=>pe("text-color-change",ne))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ae("fillColor"),to:he.value},[t.createElementVNode("div",Li,[t.createElementVNode("div",Oi,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(w)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:E[25]||(E[25]=ne=>pe("apply-fill-color"))},[(t.openBlock(),t.createElementBlock("svg",_i,[E[76]||(E[76]=t.createElementVNode("path",{d:"M447.018667 37.952l352.298666 352.298667c6.613333 6.613333 6.613333 17.344 0 23.957333L446.101333 767.424a16.938667 16.938667 0 0 1-23.957333 0L121.429333 466.688a16.938667 16.938667 0 0 1 0-23.957333L428.608 135.552 388.992 96a8.469333 8.469333 0 0 1 0-11.989333l46.058667-46.037334a8.469333 8.469333 0 0 1 11.968 0z m346.325333 517.461333l57.514667 60.074667c31.744 33.194667 31.744 86.997333 0 120.192a78.869333 78.869333 0 0 1-115.008 0c-31.765333-33.194667-31.765333-86.997333 0-120.192l57.493333-60.074667zM486.101333 193.066667l-261.12 261.12 20.458667 20.458666 380.16-1.728 70.186667-70.186666-209.706667-209.664z"},null,-1)),t.createElementVNode("path",{d:"M85.333333 853.333333m8.896 0l835.541334 0q8.896 0 8.896 8.896l0 110.208q0 8.896-8.896 8.896l-835.541334 0q-8.896 0-8.896-8.896l0-110.208q0-8.896 8.896-8.896Z",fill:e.cachedFillColor||"currentColor"},null,8,$i)])),t.createElementVNode("span",Wi,t.toDisplayString(t.unref(w)(e.locale,"fillColor")),1)],8,zi),t.createElementVNode("button",{ref_key:"fillColorArrowRef",ref:L,class:"toolbar-btn toolbar-split__arrow",title:t.unref(w)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:E[26]||(E[26]=ne=>pe("update:fill-color-menu-open",!e.fillColorMenuOpen))},[...E[77]||(E[77]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,Pi),t.createVNode(Yn,{"model-open":e.fillColorMenuOpen,"color-key":"fill","current-color":e.selFillColor,locale:e.locale,"trigger-el":L.value,"onUpdate:modelOpen":E[27]||(E[27]=ne=>pe("update:fill-color-menu-open",ne)),onChange:E[28]||(E[28]=ne=>pe("fill-color-change",ne))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ae("border"),to:he.value},[t.createElementVNode("div",Ui,[t.createElementVNode("div",Ki,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(w)(e.locale,"borders"),disabled:!e.hasSelection,onClick:E[29]||(E[29]=ne=>pe("apply-border"))},[(t.openBlock(),t.createElementBlock("svg",qi,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(n,ne=>t.createElementVNode("line",{key:ne.name,x1:ne.x1,y1:ne.y1,x2:ne.x2,y2:ne.y2,"stroke-width":r(e.cachedBorder,ne.name)==="thick"?3:1.5,"stroke-dasharray":r(e.cachedBorder,ne.name)==="dashed"?"0 4":"none","stroke-linecap":r(e.cachedBorder,ne.name)==="dashed"?"round":"square"},null,8,Yi)),64))])),t.createElementVNode("span",Xi,t.toDisplayString(t.unref(w)(e.locale,c[e.cachedBorder]??"borders")),1)],8,Gi),t.createElementVNode("button",{ref_key:"borderArrowRef",ref:oe,class:"toolbar-btn toolbar-split__arrow",title:t.unref(w)(e.locale,"borders"),disabled:!e.hasSelection,onClick:E[30]||(E[30]=ne=>pe("update:border-menu-open",!e.borderMenuOpen))},[...E[78]||(E[78]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,ji),t.createVNode(Sa,{"model-open":e.borderMenuOpen,locale:e.locale,"current-border":e.cachedBorder,"trigger-el":oe.value,"onUpdate:modelOpen":E[31]||(E[31]=ne=>pe("update:border-menu-open",ne)),onChange:E[32]||(E[32]=ne=>pe("border-change",ne))},null,8,["model-open","locale","current-border","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ae("sep4"),to:he.value},[E[79]||(E[79]=t.createElementVNode("div",{class:"tb-item","data-key":"sep4"},[t.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ae("hAlign"),to:he.value},[t.createElementVNode("div",Zi,[t.createVNode(Jt,{class:"toolbar-align","model-value":e.selHAlign,options:e.hAlignOptions,width:ie("hAlign")?"100%":44,"menu-width":ie("hAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(w)(e.locale,"hAlign"),onChange:E[33]||(E[33]=ne=>pe("h-align-change",ne))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ae("vAlign"),to:he.value},[t.createElementVNode("div",Ji,[t.createVNode(Jt,{class:"toolbar-align","model-value":e.selVAlign,options:e.vAlignOptions,width:ie("vAlign")?"100%":44,"menu-width":ie("vAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(w)(e.locale,"vAlign"),onChange:E[34]||(E[34]=ne=>pe("v-align-change",ne))},null,8,["model-value","options","width","menu-width","title"])]),t.createElementVNode("div",Qi,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selWrap}]),type:"button",title:t.unref(w)(e.locale,"wrap"),onClick:E[35]||(E[35]=ne=>pe("wrap-toggle"))},[E[80]||(E[80]=t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M896 179.2a38.4 38.4 0 0 0-76.8 0v665.6a38.4 38.4 0 0 0 76.8 0v-665.6zM204.8 281.6A38.4 38.4 0 0 0 204.8 358.4h179.2a38.4 38.4 0 0 0 0-76.8H204.8zM550.4 281.6a38.4 38.4 0 0 0 0 76.8h51.2c35.328 0 64 28.672 64 64v179.2c0 35.328-28.672 64-64 64H246.272l36.864-36.864a38.4 38.4 0 1 0-54.272-54.272l-102.4 102.4a38.4 38.4 0 0 0 0 54.272l102.4 102.4a38.4 38.4 0 0 0 54.272-54.272l-36.864-36.864h355.328a140.8 140.8 0 0 0 140.8-140.8v-179.2a140.8 140.8 0 0 0-140.8-140.8h-51.2z"})],-1)),t.createElementVNode("span",tc,t.toDisplayString(t.unref(w)(e.locale,"wrap")),1)],10,ec)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ae("merge"),to:he.value},[t.createElementVNode("div",lc,[t.createElementVNode("div",nc,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(w)(e.locale,"mergeCenter"),disabled:!e.hasSelection,onClick:E[36]||(E[36]=ne=>pe("apply-merge"))},[E[81]||(E[81]=t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M709.952 465.92l88-76.032C801.92 385.984 806.656 384 812.032 384s10.048 1.984 14.08 5.952C830.08 393.92 832 398.656 832 403.968L832 448l32 0C881.664 448 896 462.336 896 480S881.664 512 864 512L832 512l0 44.032c0 5.376-1.92 10.112-5.952 14.08C822.08 574.08 817.344 576 812.032 576s-10.048-1.92-14.08-5.952L709.952 494.08C705.984 490.112 704 485.376 704 480S705.984 469.952 709.952 465.92zM378.048 465.92 290.048 389.952C286.08 385.984 281.344 384 275.968 384s-10.048 1.984-14.08 5.952C257.92 393.92 256 398.656 256 403.968L256 448 224 448C206.336 448 192 462.336 192 480S206.336 512 224 512L256 512l0 44.032c0 5.376 1.92 10.112 5.952 14.08C265.92 574.08 270.656 576 275.968 576s10.048-1.92 14.08-5.952L378.048 494.08C382.016 490.112 384 485.376 384 480S382.016 469.952 378.048 465.92zM448 128 128 128l0 704 320 0 0-128 64 0 0 128c0 35.392-28.608 64-64 64L128 896c-35.392 0-64-28.608-64-64L64 128c0-35.392 28.608-64 64-64l320 0 0 0c35.392 0 64 28.608 64 64l0 128L448 256 448 128M640 128l320 0 0 704-320 0 0-128L576 704l0 128c0 35.392 28.608 64 64 64l320 0c35.392 0 64-28.608 64-64L1024 128c0-35.392-28.608-64-64-64l-320 0 0 0C604.608 64 576 92.608 576 128l0 128 64 0L640 128M722.304 642.304c0 8.512-3.52 16.32-10.496 23.36s-15.424 10.624-25.344 10.624c-5.76 0-10.688-1.088-14.72-3.136-4.096-2.048-7.616-4.928-10.432-8.512s-5.824-9.088-9.024-16.512-5.952-13.952-8.32-19.648l-17.28-46.016L479.36 582.464 462.08 629.568c-6.72 18.304-12.48 30.656-17.344 37.12s-12.544 9.6-23.424 9.6c-9.28 0-17.408-3.456-24.512-10.24s-10.624-14.592-10.624-23.232c0-4.992 0.896-10.176 2.496-15.488S393.024 614.592 396.8 605.056l92.672-238.016C492.096 360.256 495.296 352 499.008 342.464s7.68-17.536 11.904-23.872 9.664-11.456 16.576-15.36c6.784-3.968 15.232-5.888 25.344-5.888 10.176 0 18.752 1.92 25.472 5.888 6.848 3.968 12.352 8.96 16.64 15.104 4.096 6.208 7.744 12.8 10.624 19.904s6.528 16.576 11.008 28.352l94.656 236.48C718.592 621.056 722.304 634.112 722.304 642.304zM606.912 526.784 552.32 375.552 498.624 526.784 606.912 526.784z"})],-1)),t.createElementVNode("span",rc,t.toDisplayString(t.unref(w)(e.locale,"mergeCenter")),1)],8,oc),t.createElementVNode("button",{ref_key:"mergeArrowRef",ref:Y,class:"toolbar-btn toolbar-split__arrow",title:t.unref(w)(e.locale,"mergeCells"),disabled:!e.hasSelection,onClick:E[37]||(E[37]=ne=>pe("update:merge-menu-open",!e.mergeMenuOpen))},[...E[82]||(E[82]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,ac),t.createVNode(Ia,{"model-open":e.mergeMenuOpen,locale:e.locale,"trigger-el":Y.value,"onUpdate:modelOpen":E[38]||(E[38]=ne=>pe("update:merge-menu-open",ne)),onChange:E[39]||(E[39]=ne=>pe("merge-change",ne))},null,8,["model-open","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ae("sep6"),to:he.value},[E[83]||(E[83]=t.createElementVNode("div",{class:"tb-item","data-key":"sep6"},[t.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ae("numFmt"),to:he.value},[t.createElementVNode("div",ic,[t.createElementVNode("div",cc,[t.createVNode(Jt,{class:"toolbar-number-format","model-value":e.selNumberFormat,options:e.nfOptions,width:ie("numFmt")?"auto":92,"menu-width":(ie("numFmt"),150),"visible-count":8,title:t.unref(w)(e.locale,"numberFormat"),"fallback-label":it.value,align:"right",onChange:E[40]||(E[40]=ne=>pe("number-format-change",String(ne)))},null,8,["model-value","options","width","menu-width","title","fallback-label"]),t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn toolbar-number-format__btn",{"toolbar-btn--disabled":!e.canIncreaseDecimals}]),title:t.unref(w)(e.locale,"nfIncreaseDecimals"),disabled:!e.canIncreaseDecimals,onClick:E[41]||(E[41]=ne=>pe("increase-decimals"))},[...E[84]||(E[84]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[t.createElementVNode("text",{x:"0.5",y:"16","font-size":"9","font-weight":"700","font-family":"Arial, sans-serif"},".00"),t.createElementVNode("path",{d:"M19 5.5l4.2 5.2h-2.7v7.8h-3v-7.8h-2.7z"})],-1)])],10,sc),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:E[42]||(E[42]=ne=>pe("decrease-decimals"))},[...E[85]||(E[85]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[t.createElementVNode("text",{x:"0.5",y:"16","font-size":"9","font-weight":"700","font-family":"Arial, sans-serif"},".00"),t.createElementVNode("path",{d:"M19 18.5l-4.2-5.2h2.7V5.5h3v7.8h2.7z"})],-1)])],10,dc)])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ae("sep7"),to:he.value},[E[86]||(E[86]=t.createElementVNode("div",{class:"tb-item","data-key":"sep7"},[t.createElementVNode("div",{class:"toolbar-sep"})],-1))],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ae("calc"),to:he.value},[t.createElementVNode("div",uc,[t.createElementVNode("div",fc,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(w)(e.locale,"sum"),disabled:!e.hasSelection||e.isSingleCell,onClick:E[43]||(E[43]=ne=>pe("calc-sum"))},[E[87]||(E[87]=t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[t.createElementVNode("path",{d:"M19 3H5l7 9-7 9h14v-2H8l5.5-7L8 5h11z"})],-1)),t.createElementVNode("span",pc,t.toDisplayString(t.unref(w)(e.locale,"sum")),1)],8,mc),t.createElementVNode("button",{ref_key:"calcArrowRef",ref:k,class:"toolbar-btn toolbar-split__arrow",title:t.unref(w)(e.locale,"calculate"),disabled:!e.hasSelection,onClick:E[44]||(E[44]=ne=>pe("update:calc-menu-open",!e.calcMenuOpen))},[...E[88]||(E[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,hc),t.createVNode(Ja,{"model-open":e.calcMenuOpen,locale:e.locale,"trigger-el":k.value,disabled:e.isSingleCell,"onUpdate:modelOpen":E[45]||(E[45]=ne=>pe("update:calc-menu-open",ne)),onChange:E[46]||(E[46]=ne=>pe(`calc-${ne}`))},null,8,["model-open","locale","trigger-el","disabled"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ae("sort"),to:he.value},[t.createElementVNode("div",gc,[t.createElementVNode("div",bc,[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:E[47]||(E[47]=ne=>pe("apply-sort"))},[(t.openBlock(),t.createElementBlock("svg",yc,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(s,ne=>t.createElementVNode("line",{key:ne.name,x1:ne.x1,y1:ne.y1,x2:ne.x2,y2:ne.y2},null,8,wc)),64)),t.createElementVNode("path",{d:m[e.cachedSortOrder]},null,8,vc)])),t.createElementVNode("span",kc,t.toDisplayString(t.unref(w)(e.locale,"sort")),1)],8,Cc),t.createElementVNode("button",{ref_key:"sortArrowRef",ref:te,class:"toolbar-btn toolbar-split__arrow",title:t.unref(w)(e.locale,"sort"),disabled:!e.canSort,onClick:E[48]||(E[48]=ne=>pe("update:sort-menu-open",!e.sortMenuOpen))},[...E[89]||(E[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,Ec),t.createVNode(Na,{"model-open":e.sortMenuOpen,locale:e.locale,"current-sort":e.cachedSortOrder,"trigger-el":te.value,"onUpdate:modelOpen":E[49]||(E[49]=ne=>pe("update:sort-menu-open",ne)),onChange:E[50]||(E[50]=ne=>pe("sort-change",ne))},null,8,["model-open","locale","current-sort","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ae("filter"),to:he.value},[t.createElementVNode("div",Sc,[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:G},[E[90]||(E[90]=t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M96 192c0-17.6 14.4-32 32-32h768c17.6 0 32 14.4 32 32 0 9.6-4.8 19.2-12.8 25.6L608 480v320c0 19.2-12.8 35.2-32 40-4.8 1.6-9.6 1.6-14.4 1.6-12.8 0-24-4.8-33.6-12.8l-128-108.8c-8-6.4-12.8-16-12.8-25.6V480L108.8 217.6C100.8 211.2 96 201.6 96 192z"})],-1)),t.createElementVNode("span",Mc,t.toDisplayString(t.unref(w)(e.locale,"filter")),1)],10,Rc)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ae("freeze"),to:he.value},[t.createElementVNode("div",Bc,[t.createVNode(Jt,{class:"toolbar-freeze","model-value":"",options:It.value,width:ie("freeze")?"100%":44,"menu-width":ie("freeze")?120:void 0,"visible-count":4,align:"right",title:t.unref(w)(e.locale,"freezePane"),"trigger-icon":Uo,"trigger-label":t.unref(w)(e.locale,"freezePane"),onChange:E[51]||(E[51]=ne=>pe("freeze-change",String(ne)))},null,8,["options","width","menu-width","title","trigger-label"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ae("cf"),to:he.value},[t.createElementVNode("div",xc,[t.createVNode(Xa,{locale:e.locale,"has-selection":e.hasSelection,"theme-vars":e.themeVars,onPreset:E[52]||(E[52]=ne=>pe("cf-preset",ne)),onNewRule:E[53]||(E[53]=ne=>pe("cf-new-rule")),onManage:E[54]||(E[54]=ne=>pe("cf-manage")),onClear:E[55]||(E[55]=ne=>pe("cf-clear",ne))},null,8,["locale","has-selection","theme-vars"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:Ae("find"),to:he.value},[t.createElementVNode("div",Tc,[t.createElementVNode("button",{class:"toolbar-btn",title:t.unref(w)(e.locale,"find"),onClick:V},[E[91]||(E[91]=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",Dc,t.toDisplayString(t.unref(w)(e.locale,"findReplace")),1)],8,Nc)])],8,["disabled","to"])),ye.value?(t.openBlock(),t.createElementBlock("button",{key:0,ref_key:"moreBtnEl",ref:y,class:t.normalizeClass(["toolbar-more",{"toolbar-more--active":se.value}]),type:"button",onClick:re},[...E[92]||(E[92]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("circle",{cx:"512",cy:"160",r:"96"}),t.createElementVNode("circle",{cx:"512",cy:"512",r:"96"}),t.createElementVNode("circle",{cx:"512",cy:"864",r:"96"})],-1)])],2)):t.createCommentVNode("",!0)],34),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("div",{class:t.normalizeClass(["overflow-menu-wrap",{"no-anim":Ke.value}]),style:t.normalizeStyle(x.value),onPointerdown:E[59]||(E[59]=t.withModifiers(()=>{},["stop","prevent"]))},[Ge.value||Te.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["overflow-nav",{"overflow-nav--disabled":!Ge.value}]),disabled:!Ge.value,onClick:E[57]||(E[57]=ne=>bt(-1))},[...E[93]||(E[93]=[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,Vc)):t.createCommentVNode("",!0),(t.openBlock(),t.createElementBlock("div",{ref_key:"overflowMenuEl",ref:C,key:Oe.value,class:"overflow-menu",onScroll:$e},null,32)),Ge.value||Te.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["overflow-nav",{"overflow-nav--disabled":!Te.value}]),disabled:!Te.value,onClick:E[58]||(E[58]=ne=>bt(1))},[...E[94]||(E[94]=[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,Fc)):t.createCommentVNode("",!0)],38),[[t.vShow,se.value]])]),_:1})]))],64))}}),[["__scopeId","data-v-5d658d97"]]),_c=["title"],$c={class:"tab-list"},Wc=["onClick","onDblclick","onContextmenu","onTouchstart"],Pc=["value"],Uc={key:1,class:"tab-item__name"},Kc=["title"],Gc=["disabled"],qc=["title","onClick"],Yc={class:"tab-list-menu__name"},Xc=["title","disabled","onClick"],jc=["disabled"],Zc=8,Ko=450,Xn=8,Jc=Yt(t.defineComponent({__name:"tabbar",props:{locale:{},sheets:{},activeSheetIndex:{},renTab:{},renTabVal:{}},emits:["tab-click","tab-dblclick","delete-sheet","tab-contextmenu","tab-rename-input","tab-rename-keydown","tab-rename-commit","add-sheet","tabbar-contextmenu"],setup(e,{emit:l}){const o=e,n=l,a=t.ref(null),i=t.ref(!1),r=t.ref(0),c=t.ref({left:0,bottom:0}),s=t.ref(null),m=t.computed(()=>Math.min(Zc,o.sheets.length)),v=t.computed(()=>o.sheets.slice(r.value,r.value+m.value)),d=t.computed(()=>r.value>0),C=t.computed(()=>r.value+m.value<o.sheets.length),y=t.computed(()=>o.sheets.length>m.value),h=t.computed(()=>o.sheets.length>1);t.watch(()=>o.sheets.length,()=>{if(!i.value)return;const re=Math.max(0,o.sheets.length-m.value);r.value>re&&(r.value=re)});function L(re){r.value=Math.max(0,Math.min(o.sheets.length-m.value,r.value+re))}function oe(){if(i.value){i.value=!1;return}const re=a.value;if(!re)return;const V=re.getBoundingClientRect();c.value={left:V.left,bottom:window.innerHeight-V.top+4};const G=o.activeSheetIndex;r.value=G>=0?Math.max(0,Math.min(G-Math.floor(m.value/2),o.sheets.length-m.value)):0,i.value=!0}function te(re){n("tab-click",re),i.value=!1}function Y(re){h.value&&n("delete-sheet",re)}function k(re){var xe;if(!i.value)return;const V=re.target;if((xe=a.value)!=null&&xe.contains(V))return;const G=document.querySelector(".tab-list-menu");G!=null&&G.contains(V)||(i.value=!1)}function Q(re){i.value&&re.key==="Escape"&&(i.value=!1)}function le(re){i.value&&(re.preventDefault(),L(re.deltaY>0?1:-1))}function se(){i.value=!1}function Ke(re){!i.value||re.target===s.value||se()}const Oe=t.ref(0),Ge=t.ref(!1);function Te(re){i.value&&(Oe.value=re.touches[0].clientY,Ge.value=!0)}function qe(re){if(!i.value||!Ge.value)return;const V=re.touches[0].clientY-Oe.value;Math.abs(V)>5&&(L(V<0?1:-1),Oe.value=re.touches[0].clientY)}function tt(){Ge.value=!1}let ye=null,ie=-1,he=0,Ae=0,dt=!1,ue=null,ve=0,p=0;function A(re,V,G){return{clientX:re,clientY:V,target:G,preventDefault(){},stopPropagation(){}}}function $(re,V){const G=re.touches[0];if(!G)return;he=G.clientX,Ae=G.clientY,ie=V,ye!==null&&clearTimeout(ye);const xe=re.target;ye=window.setTimeout(()=>{dt=!0;const $e=A(he,Ae,xe);n("tab-contextmenu",{ev:$e,i:ie})},Ko)}function ee(re){const V=re.touches[0];!V||ye===null||(Math.abs(V.clientX-he)>Xn||Math.abs(V.clientY-Ae)>Xn)&&(clearTimeout(ye),ye=null)}function U(){ye!==null&&(clearTimeout(ye),ye=null)}function O(re){if(dt){dt=!1;return}n("tab-click",re)}function x(re){const V=re.touches[0];if(!V)return;const G=re.target;if(G.closest(".tab-item")||G.closest(".tab-bar__add-btn")||G.closest(".tab-bar__list-btn"))return;ve=V.clientX,p=V.clientY,ue!==null&&clearTimeout(ue);const xe=G;ue=window.setTimeout(()=>{const $e=A(ve,p,xe);n("tabbar-contextmenu",$e)},Ko)}function X(re){const V=re.touches[0];!V||ue===null||(Math.abs(V.clientX-ve)>Xn||Math.abs(V.clientY-p)>Xn)&&(clearTimeout(ue),ue=null)}function Le(){ue!==null&&(clearTimeout(ue),ue=null)}return t.watch(i,re=>{t.nextTick(()=>{var V,G;re?(V=s.value)==null||V.addEventListener("wheel",le,{passive:!1}):(G=s.value)==null||G.removeEventListener("wheel",le)})}),t.onMounted(()=>{document.addEventListener("pointerdown",k),document.addEventListener("keydown",Q),window.addEventListener("resize",se),window.addEventListener("scroll",Ke,!0)}),t.onBeforeUnmount(()=>{ye!==null&&clearTimeout(ye),ue!==null&&clearTimeout(ue),document.removeEventListener("pointerdown",k),document.removeEventListener("keydown",Q),window.removeEventListener("resize",se),window.removeEventListener("scroll",Ke,!0)}),(re,V)=>(t.openBlock(),t.createElementBlock("div",{class:"tab-bar",onContextmenu:V[8]||(V[8]=G=>n("tabbar-contextmenu",G)),onTouchstart:x,onTouchmove:X,onTouchend:Le,onTouchcancel:Le},[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:oe},[...V[9]||(V[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,_c),t.createElementVNode("div",$c,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.sheets,(G,xe)=>(t.openBlock(),t.createElementBlock("div",{key:G.id,class:t.normalizeClass(["tab-item",{"tab-item--active":xe===e.activeSheetIndex}]),onClick:$e=>O(xe),onDblclick:t.withModifiers($e=>n("tab-dblclick",xe),["prevent"]),onContextmenu:$e=>n("tab-contextmenu",{ev:$e,i:xe}),onTouchstart:$e=>$($e,xe),onTouchmove:ee,onTouchend:U,onTouchcancel:U},[e.renTab===xe?(t.openBlock(),t.createElementBlock("input",{key:0,class:"tab-rename-input",value:e.renTabVal,onInput:V[0]||(V[0]=$e=>n("tab-rename-input",$e.target.value)),onKeydown:V[1]||(V[1]=$e=>n("tab-rename-keydown",$e)),onBlur:V[2]||(V[2]=$e=>n("tab-rename-commit")),onClick:V[3]||(V[3]=t.withModifiers(()=>{},["stop"]))},null,40,Pc)):(t.openBlock(),t.createElementBlock("span",Uc,t.toDisplayString(G.name),1))],42,Wc))),128))]),t.createElementVNode("button",{class:"tab-bar__add-btn",title:t.unref(w)(e.locale,"addSheet"),onClick:V[4]||(V[4]=G=>n("add-sheet"))}," + ",8,Kc),(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:V[7]||(V[7]=t.withModifiers(()=>{},["prevent"]))},[y.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["tab-list-menu__nav",{"tab-list-menu__nav--disabled":!d.value}]),disabled:!d.value,onClick:V[5]||(V[5]=G=>L(-1))},[...V[10]||(V[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,Gc)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:s,class:"tab-list-menu__list",onTouchstart:Te,onTouchmove:qe,onTouchend:tt},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(v.value,G=>(t.openBlock(),t.createElementBlock("div",{key:G.id,class:t.normalizeClass(["tab-list-menu__item",{"tab-list-menu__item--active":e.sheets.indexOf(G)===e.activeSheetIndex}]),title:G.name,onClick:xe=>te(e.sheets.indexOf(G))},[t.createElementVNode("span",Yc,t.toDisplayString(G.name),1),t.createElementVNode("button",{type:"button",class:"tab-list-menu__del",title:t.unref(w)(e.locale,"delete"),disabled:!h.value,onClick:t.withModifiers(xe=>Y(e.sheets.indexOf(G)),["stop"])},[...V[11]||(V[11]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M571.733333 512l288.533334-288.533333c17.066667-17.066667 17.066667-42.666667 0-59.733334-17.066667-17.066667-42.666667-17.066667-59.733334 0L512 452.266667 223.466667 164.266667c-17.066667-17.066667-42.666667-17.066667-59.733334 0-17.066667 17.066667-17.066667 42.666667 0 59.733333L452.266667 512 164.266667 800c-17.066667 17.066667-17.066667 42.666667 0 59.733333 8.533333 8.533333 19.2 12.8 29.866666 12.8 10.666667 0 21.333333-4.266667 29.866667-12.8L512 571.733333l288.533333 288.533334c8.533333 8.533333 19.2 12.8 29.866667 12.8 10.666667 0 21.333333-4.266667 29.866667-12.8 17.066667-17.066667 17.066667-42.666667 0-59.733334L571.733333 512z"})],-1)])],8,Xc)],10,qc))),128))],544),y.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["tab-list-menu__nav",{"tab-list-menu__nav--disabled":!C.value}]),disabled:!C.value,onClick:V[6]||(V[6]=G=>L(1))},[...V[12]||(V[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,jc)):t.createCommentVNode("",!0)],36)):t.createCommentVNode("",!0)]),_:1})]))],32))}}),[["__scopeId","data-v-e00401ad"]]),Qc={class:"find-bar__row find-bar__row--inputs"},es=["placeholder","value"],ts=["placeholder","value"],ls=["title","disabled"],ns=["title","disabled"],os=["title"],rs={class:"find-bar__row find-bar__row--controls"},as=["title"],is={class:"find-bar__count"},cs=["disabled"],ss=["disabled"],ds={class:"find-bar__chk find-bar__chk--panel"},us=["checked"],fs={class:"find-bar__chk find-bar__chk--panel"},ms=["checked"],ps=Yt(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 o=e,n=l,a=t.ref(null),i=t.ref(null),r=t.ref(!1),c=t.ref({top:0,left:0}),s=t.computed(()=>o.total>0?`${o.currentIndex+1}/${o.total}`:o.message||""),m=t.computed(()=>[{label:w(o.locale,"scopeSheet"),value:"sheet"},{label:w(o.locale,"scopeWorkbook"),value:"workbook"},{label:w(o.locale,"scopeSelection"),value:"selection"}]);t.watch(()=>o.focusToken,()=>{t.nextTick(()=>{var y;return(y=a.value)==null?void 0:y.focus()})});function v(y){y.key==="Enter"?(y.preventDefault(),y.shiftKey?n("prev"):n("next")):y.key==="Escape"&&(y.preventDefault(),n("close"))}function d(){if(i.value){if(!r.value){const y=i.value.getBoundingClientRect();c.value={top:y.bottom+2,left:y.left}}r.value=!r.value}}function C(y){if(!r.value)return;const h=y.target;h.closest(".find-bar__settings-btn")||h.closest(".find-bar__settings-panel")||(r.value=!1)}return t.watch(r,y=>{y?document.addEventListener("pointerdown",C,!0):document.removeEventListener("pointerdown",C,!0)}),t.watch(()=>o.open,y=>{y||(r.value=!1)}),t.onBeforeUnmount(()=>document.removeEventListener("pointerdown",C,!0)),(y,h)=>(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",Qc,[t.createElementVNode("input",{ref_key:"findInputRef",ref:a,class:"find-bar__input",placeholder:t.unref(w)(e.locale,"findPlaceholder"),value:e.findText,onInput:h[0]||(h[0]=L=>n("update:findText",L.target.value)),onKeydown:v},null,40,es),t.createElementVNode("input",{class:"find-bar__input",placeholder:t.unref(w)(e.locale,"replacePlaceholder"),value:e.replaceText,onInput:h[1]||(h[1]=L=>n("update:replaceText",L.target.value)),onKeydown:v},null,40,ts),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--icon",title:t.unref(w)(e.locale,"findPrev"),disabled:e.total===0,onClick:h[2]||(h[2]=L=>n("prev"))},[...h[12]||(h[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,ls),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--icon",title:t.unref(w)(e.locale,"findNext"),disabled:e.total===0,onClick:h[3]||(h[3]=L=>n("next"))},[...h[13]||(h[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,ns),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--close",title:t.unref(w)(e.locale,"findClose"),onClick:h[4]||(h[4]=L=>n("close"))},[...h[14]||(h[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,os)]),t.createElementVNode("div",rs,[t.createVNode(Jt,{class:"find-bar__dropdown","model-value":e.scope,options:m.value,title:t.unref(w)(e.locale,"findScope"),"onUpdate:modelValue":h[5]||(h[5]=L=>y.$emit("update:scope",L))},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(d,["stop"])},[...h[15]||(h[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,as),t.createElementVNode("span",is,t.toDisplayString(s.value),1),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--text",disabled:e.total===0,onClick:h[6]||(h[6]=L=>n("replace"))},t.toDisplayString(t.unref(w)(e.locale,"replace")),9,cs),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--text",disabled:e.total===0,onClick:h[7]||(h[7]=L=>n("replace-all"))},t.toDisplayString(t.unref(w)(e.locale,"replaceAll")),9,ss)])],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:h[10]||(h[10]=t.withModifiers(()=>{},["stop"])),onMousedown:h[11]||(h[11]=t.withModifiers(()=>{},["prevent"]))},[t.createElementVNode("label",ds,[t.createElementVNode("input",{class:"find-bar__chk-input",type:"checkbox",checked:e.matchCase,onChange:h[8]||(h[8]=L=>n("update:matchCase",L.target.checked))},null,40,us),h[16]||(h[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",fs,[t.createElementVNode("input",{class:"find-bar__chk-input",type:"checkbox",checked:e.matchEntireCell,onChange:h[9]||(h[9]=L=>n("update:matchEntireCell",L.target.checked))},null,40,ms),h[17]||(h[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"]]),hs={class:"nf-dialog__header"},gs={class:"nf-dialog__title"},bs={class:"nf-dialog__body"},Cs={class:"nf-field"},ys={class:"nf-field__label"},ws={key:0,class:"nf-field"},vs={class:"nf-field__label"},ks={key:1,class:"nf-field nf-field--inline"},Es={class:"nf-checkbox"},Ss={key:2,class:"nf-field"},Rs={class:"nf-field__label"},Ms={key:3,class:"nf-field"},Bs={class:"nf-field__label"},xs={key:4,class:"nf-field"},Ts={class:"nf-field__label"},Ns={key:5,class:"nf-field"},Ds={class:"nf-field__label"},Vs={key:6,class:"nf-field"},Fs={class:"nf-field__label"},Is={class:"nf-field"},As={class:"nf-field__label"},Hs={class:"nf-dialog__footer"},Ls={class:"nf-preview"},Os={class:"nf-preview__label"},zs={class:"nf-preview__value"},_s={class:"nf-dialog__actions"},$s=Yt(t.defineComponent({__name:"numberFormatDialog",props:{modelOpen:{type:Boolean,default:!1},locale:{default:"zh-CN"},currentFormat:{default:""},isCustom:{type:Boolean,default:!1},sampleValue:{default:"1234.5"}},emits:["update:modelOpen","apply"],setup(e,{emit:l}){const o=e,n=l,a=t.ref(!1),i=t.ref("general"),r=t.ref(2),c=t.ref(!1),s=t.ref("$"),m=t.ref("m/d/yyyy"),v=t.ref("h:mm:ss"),d=t.ref("m/d/yyyy h:mm:ss"),C=t.ref("[h]:mm:ss"),y=t.ref(""),h=t.ref(null),L=[{label:"¥",value:"¥"},{label:"$",value:"$"},{label:"€",value:"€"},{label:"£",value:"£"}],oe=['yyyy"年"m"月"d"日"',"yyyy-mm-dd","yyyy/m/d",'m"月"d"日"'],te=["m/d/yyyy","mm/dd/yyyy","d-mmm-yyyy","mmmm d, yyyy"],Y=['yyyy"年"m"月"d"日" h:mm:ss','yyyy"年"m"月"d"日" hh:mm',"yyyy-mm-dd hh:mm:ss","yyyy/m/d h:mm"],k=["m/d/yyyy h:mm:ss","m/d/yyyy hh:mm","mm/dd/yyyy h:mm AM/PM","d-mmm-yyyy hh:mm:ss"],Q=t.computed(()=>o.locale==="zh-CN"?[...oe,...te]:[...te,...oe]),le=["h:mm:ss","h:mm","hh:mm:ss","h:mm AM/PM",'hh"时"mm"分"ss"秒"',"H:mm:ss"],se=t.computed(()=>o.locale==="zh-CN"?[...Y,...k]:[...k,...Y]),Ke=["[h]:mm:ss","[h]:mm","mm:ss",'[h]"小时"mm"分"ss"秒"',"[h]:mm:ss.00",'d"天"h:mm:ss'],Oe={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"},Ge=t.computed(()=>Qr.map(ge=>({label:w(o.locale,Oe[ge]),value:ge}))),Te=L.map(ge=>({label:ge.label,value:ge.value})),qe=t.computed(()=>Q.value.map(ge=>({label:ge,value:ge}))),tt=le.map(ge=>({label:ge,value:ge})),ye=t.computed(()=>se.value.map(ge=>({label:ge,value:ge}))),ie=Ke.map(ge=>({label:ge,value:ge})),he=t.computed(()=>["number","currency","currencyRounded","accounting","financial"].includes(i.value)),Ae=t.computed(()=>["currency","currencyRounded","accounting"].includes(i.value)),dt=t.computed(()=>i.value==="date"),ue=t.computed(()=>i.value==="time"),ve=t.computed(()=>i.value==="dateTime"),p=t.computed(()=>i.value==="duration"),A=t.computed(()=>["number","currency","accounting","financial","percent","scientific"].includes(i.value));function $(){if(i.value==="general")return Gl;if(i.value==="text")return gl;if(i.value==="custom")return y.value;if(i.value==="date")return m.value;if(i.value==="time")return v.value;if(i.value==="dateTime")return d.value;if(i.value==="duration")return C.value;const ge=Math.max(0,Math.min(30,r.value));return i.value==="currency"||i.value==="currencyRounded"||i.value==="accounting"?ee(i.value,ge,c.value,s.value):ia(o.locale,i.value,ge,c.value)}function ee(ge,pe,it,It){const Je=it?"#,##0":"0";if(ge==="currencyRounded")return It+Je;const E=pe>0?"."+"0".repeat(pe):"",ne=Je+E;return ge==="currency"?It+ne:`${It}${ne};(${It}${ne});${It}"-"`}function U(ge){if(y.value=ge,bl(ge)){i.value="general";return}if(ge==="@"){i.value="text";return}const pe=ge.replace(/\[[^\]]*\]/gi,E=>/\[h\]/i.test(E)?E:"");if(/\[h\]/i.test(pe)&&!/[yd]/i.test(pe)){i.value="duration",Ke.includes(ge)&&(C.value=ge);return}const it=/[yd]/i.test(pe),It=/h|s|AM\/PM/i.test(pe);if(it&&It){i.value="dateTime",se.value.includes(ge)&&(d.value=ge);return}if(it||/AM\/PM/i.test(pe)){It&&!it?(i.value="time",le.includes(ge)&&(v.value=ge)):(i.value="date",Q.value.includes(ge)&&(m.value=ge));return}if(ge.includes("%")){i.value="percent",r.value=O(ge);return}if(/E[+-]/i.test(ge)){i.value="scientific",r.value=O(ge);return}const Je=L.find(E=>ge.startsWith(E.value));if(ge.includes("[Red](")){i.value="financial",c.value=ge.includes(","),r.value=O(ge);return}if(Je){ge.includes("(")?(i.value="accounting",s.value=Je.value,c.value=ge.includes(","),r.value=O(ge)):/\.\d/.test(ge.slice(Je.value.length))?(i.value="currency",s.value=Je.value,c.value=ge.includes(","),r.value=O(ge)):(i.value="currencyRounded",s.value=Je.value,c.value=ge.includes(","));return}i.value="number",c.value=ge.includes(","),r.value=O(ge)}function O(ge){const pe=ge.match(/\.([0#?]+)/);return pe?pe[1].length:0}function x(){i.value!=="custom"&&(y.value=$())}function X(){}function Le(){m.value=Q.value[0],v.value=le[0],d.value=se.value[0],C.value=Ke[0]}function re(){a.value=!0,o.modelOpen!==void 0&&n("update:modelOpen",!0),Le(),U(o.currentFormat??""),o.isCustom&&(i.value="custom"),t.nextTick(()=>{var ge;return(ge=h.value)==null?void 0:ge.focus()})}function V(){a.value=!1,o.modelOpen!==void 0&&n("update:modelOpen",!1)}function G(){n("apply",y.value),V()}function xe(){V()}function $e(ge){ge.key==="Escape"&&V()}t.watch(()=>o.modelOpen,ge=>{ge&&!a.value?re():!ge&&a.value&&V()});const bt=t.computed(()=>Rl(o.sampleValue,y.value,o.locale));return(ge,pe)=>(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:xe,onKeydown:$e},[t.createElementVNode("div",{class:t.normalizeClass(["nf-dialog",{"nf-dialog--zh":e.locale==="zh-CN"}]),onMousedown:pe[9]||(pe[9]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",hs,[t.createElementVNode("span",gs,t.toDisplayString(t.unref(w)(e.locale,"nfDialogTitle")),1),t.createElementVNode("button",{class:"nf-dialog__close",type:"button",onClick:V},[...pe[10]||(pe[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",bs,[t.createElementVNode("div",Cs,[t.createElementVNode("label",ys,t.toDisplayString(t.unref(w)(e.locale,"nfCategory")),1),t.createVNode(Jt,{class:"nf-field__dropdown","model-value":i.value,options:Ge.value,"onUpdate:modelValue":pe[0]||(pe[0]=it=>i.value=it),onChange:x},null,8,["model-value","options"])]),A.value?(t.openBlock(),t.createElementBlock("div",ws,[t.createElementVNode("label",vs,t.toDisplayString(t.unref(w)(e.locale,"nfDecimals")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":pe[1]||(pe[1]=it=>r.value=it),class:"nf-field__input",type:"number",min:"0",max:"30",onInput:x},null,544),[[t.vModelText,r.value,void 0,{number:!0}]])])):t.createCommentVNode("",!0),he.value?(t.openBlock(),t.createElementBlock("div",ks,[t.createElementVNode("label",Es,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":pe[2]||(pe[2]=it=>c.value=it),type:"checkbox",onChange:x},null,544),[[t.vModelCheckbox,c.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(w)(e.locale,"nfThousands")),1)])])):t.createCommentVNode("",!0),Ae.value?(t.openBlock(),t.createElementBlock("div",Ss,[t.createElementVNode("label",Rs,t.toDisplayString(t.unref(w)(e.locale,"nfSymbol")),1),t.createVNode(Jt,{class:"nf-field__dropdown","model-value":s.value,options:t.unref(Te),"onUpdate:modelValue":pe[3]||(pe[3]=it=>s.value=it),onChange:x},null,8,["model-value","options"])])):t.createCommentVNode("",!0),dt.value?(t.openBlock(),t.createElementBlock("div",Ms,[t.createElementVNode("label",Bs,t.toDisplayString(t.unref(w)(e.locale,"nfDateFormat")),1),t.createVNode(Jt,{class:"nf-field__dropdown","model-value":m.value,options:qe.value,"onUpdate:modelValue":pe[4]||(pe[4]=it=>m.value=it),onChange:x},null,8,["model-value","options"])])):t.createCommentVNode("",!0),ue.value?(t.openBlock(),t.createElementBlock("div",xs,[t.createElementVNode("label",Ts,t.toDisplayString(t.unref(w)(e.locale,"nfTimeFormat")),1),t.createVNode(Jt,{class:"nf-field__dropdown","model-value":v.value,options:t.unref(tt),"onUpdate:modelValue":pe[5]||(pe[5]=it=>v.value=it),onChange:x},null,8,["model-value","options"])])):t.createCommentVNode("",!0),ve.value?(t.openBlock(),t.createElementBlock("div",Ns,[t.createElementVNode("label",Ds,t.toDisplayString(t.unref(w)(e.locale,"nfDateTime")),1),t.createVNode(Jt,{class:"nf-field__dropdown","model-value":d.value,options:ye.value,"onUpdate:modelValue":pe[6]||(pe[6]=it=>d.value=it),onChange:x},null,8,["model-value","options"])])):t.createCommentVNode("",!0),p.value?(t.openBlock(),t.createElementBlock("div",Vs,[t.createElementVNode("label",Fs,t.toDisplayString(t.unref(w)(e.locale,"nfDuration")),1),t.createVNode(Jt,{class:"nf-field__dropdown","model-value":C.value,options:t.unref(ie),"onUpdate:modelValue":pe[7]||(pe[7]=it=>C.value=it),onChange:x},null,8,["model-value","options"])])):t.createCommentVNode("",!0),t.createElementVNode("div",Is,[t.createElementVNode("label",As,t.toDisplayString(t.unref(w)(e.locale,"nfCustomCode")),1),t.withDirectives(t.createElementVNode("textarea",{ref_key:"customCodeRef",ref:h,"onUpdate:modelValue":pe[8]||(pe[8]=it=>y.value=it),class:"nf-field__textarea",rows:"2",spellcheck:"false",onInput:X},null,544),[[t.vModelText,y.value]])])]),t.createElementVNode("div",Hs,[t.createElementVNode("div",Ls,[t.createElementVNode("span",Os,t.toDisplayString(t.unref(w)(e.locale,"nfPreview")),1),t.createElementVNode("span",zs,t.toDisplayString(bt.value||"—"),1)]),t.createElementVNode("div",_s,[t.createElementVNode("button",{class:"nf-btn nf-btn--primary",type:"button",onClick:G},t.toDisplayString(t.unref(w)(e.locale,"ok")),1),t.createElementVNode("button",{class:"nf-btn",type:"button",onClick:V},t.toDisplayString(t.unref(w)(e.locale,"cancel")),1)])])],34)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-39792a0b"]]),Ws={class:"sort-confirm__header"},Ps={class:"sort-confirm__title"},Us={class:"sort-confirm__body"},Ks={class:"sort-confirm__message"},Gs={class:"sort-confirm__options"},qs={class:"sort-confirm__option"},Ys={class:"sort-confirm__option"},Xs={class:"sort-confirm__footer"},js=Yt(t.defineComponent({__name:"sortConfirmDialog",props:{modelOpen:{type:Boolean,default:!1},locale:{default:"zh-CN"}},emits:["update:modelOpen","confirm","cancel"],setup(e,{emit:l}){const o=e,n=l,a=t.ref(!1),i=t.ref(!0),r=t.ref(null);t.watch(()=>o.modelOpen,y=>{y&&!a.value?c():!y&&a.value&&s()});function c(){i.value=!0,a.value=!0,o.modelOpen!==void 0&&n("update:modelOpen",!0),t.nextTick(()=>{var h;const y=(h=r.value)==null?void 0:h.querySelector(".sort-confirm__btn--primary");y==null||y.focus()})}function s(){a.value=!1,o.modelOpen!==void 0&&n("update:modelOpen",!1)}function m(){C()}function v(y){y.key==="Escape"&&C()}function d(){n("confirm",i.value),s()}function C(){n("cancel"),s()}return(y,h)=>(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:m,onKeydown:v},[t.createElementVNode("div",{ref_key:"dialogRef",ref:r,class:"sort-confirm",onMousedown:h[2]||(h[2]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",Ws,[t.createElementVNode("span",Ps,t.toDisplayString(t.unref(w)(e.locale,"sortReminderTitle")),1),t.createElementVNode("button",{class:"sort-confirm__close",type:"button",onClick:C},[...h[3]||(h[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",Us,[t.createElementVNode("p",Ks,t.toDisplayString(t.unref(w)(e.locale,"sortReminderMessage")),1),t.createElementVNode("div",Gs,[t.createElementVNode("label",qs,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":h[0]||(h[0]=L=>i.value=L),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",Ys,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":h[1]||(h[1]=L=>i.value=L),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",Xs,[t.createElementVNode("button",{class:"sort-confirm__btn sort-confirm__btn--primary",type:"button",onClick:d},t.toDisplayString(t.unref(w)(e.locale,"sort")),1),t.createElementVNode("button",{class:"sort-confirm__btn",type:"button",onClick:C},t.toDisplayString(t.unref(w)(e.locale,"cancel")),1)])],544)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-d26d5917"]]);function ht(e){let l="",o=e;do l=String.fromCharCode(65+o%26)+l,o=Math.floor(o/26)-1;while(o>=0);return l}function bo(e){let l=0;for(let o=0;o<e.length;o++)l=l*26+(e.toUpperCase().charCodeAt(o)-64);return l-1}function wn(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 Co(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 Vn(e,l){return`${e},${l}`}function vn(e,l,o){const n=e.match(/^\$?([A-Z]+)\$?(\d+)$/i);if(!n)return null;const a=bo(n[1]),i=parseInt(n[2],10)-1;return a<0||a>=l||i<0||i>=o?null:{col:a,row:i}}function cn(e,l){if(!l)return{x:0,y:0};const o=l.getBoundingClientRect();return{x:e.clientX-o.left,y:e.clientY-o.top}}const Go=[{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)"}],Zs={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 Js(e){let l=0,o=null;for(let n=0;n<e.length;n++){const a=e[n];if(o){a===o&&(e[n+1]===o?n++:o=null);continue}if(a==='"'||a==="'"){o=a;continue}if(a==="(")l++;else if(a===")"&&(l--,l<0))return!1}return l===0}function Qs(e){const l=e.trim();if(!l.startsWith("="))return{ok:!1,name:null};const o=/^([A-Za-z_][A-Za-z0-9_]*)\s*\(([\s\S]*)\)$/.exec(l.slice(1).trim());if(!o)return{ok:!1,name:null};const n=o[1].toUpperCase(),a=Zs[n];if(!a)return{ok:!1,name:n};const i=o[2];if(!Js(i))return{ok:!1,name:n};const r=kn(i),c=r.length===1&&r[0].trim()===""?0:r.length;return c<a.min||c>a.max?{ok:!1,name:n}:r.some(s=>s.trim()==="")?{ok:!1,name:n}:{ok:!0,name:n}}function Fn(e,l,o){const n=e.split(":");if(n.length!==2)return null;const a=vn(n[0],l,o),i=vn(n[1],l,o);return!a||!i?null:{sc:Math.min(a.col,i.col),sr:Math.min(a.row,i.row),ec:Math.max(a.col,i.col),er:Math.max(a.row,i.row)}}function qo(e){const l=e.trim();if(l==="")return"";const o=Number(l);return!isNaN(o)&&/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(l)?o:e}function Al(e,l,o,n,a){const i=o[Vn(e,l)];if(!i)return"";const r=i.value;return r.startsWith("=")?Xo(Vn(e,l),o,n,a):qo(r)}function Yo(e,l,o,n,a){const i=Al(e,l,o,n,a);if(i===null)return 0;if(typeof i=="number")return i;const r=parseFloat(String(i));return isNaN(r)?0:r}const _n=new Map,jn=new Set;function $n(){_n.clear(),jn.clear()}function Xo(e,l,o,n){return ed(e,l,o,n,0)}function ed(e,l,o,n,a){if(jn.has(e))return null;if(_n.has(e))return _n.get(e);jn.add(e);const i=l[e];let r;if(!i)r=null;else{const c=i.value;if(!c.startsWith("="))r=qo(c);else{const s=c.slice(1).trim(),m=/^([A-Za-z_][A-Za-z0-9_]*)\s*\(([\s\S]*)\)$/.exec(s);r=m?er(m[1].toUpperCase(),m[2],l,o,n,a+1):Qt(s,l,o,n,a+1)}}return jn.delete(e),_n.set(e,r),r}function yo(e){return e===null||e===""?!1:typeof e=="number"?e!==0:!0}function jo(e,l){return typeof e=="number"&&typeof l=="number"?e===l:String(e??"")===String(l??"")}function Zo(e,l,o){let n;if(typeof e=="number"&&typeof l=="number")n=e<l?-1:e>l?1:0;else{const a=String(e??""),i=String(l??"");n=a<i?-1:a>i?1:0}switch(o){case"=":return n===0;case"<>":return n!==0;case"<":return n<0;case">":return n>0;case"<=":return n<=0;case">=":return n>=0}return!1}function Jo(e,l,o,n){const a=e.trim();if(a.length>=2&&(a[0]==='"'&&a[a.length-1]==='"'||a[0]==="'"&&a[a.length-1]==="'"))return a.slice(1,-1);const i=Number(a);return!isNaN(i)&&/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(a)?i:a}function td(e,l,o,n,a,i){let c=l.trim();c.length>=2&&(c[0]==='"'&&c[c.length-1]==='"'||c[0]==="'"&&c[c.length-1]==="'")&&(c=c.slice(1,-1));const s=/^([<>=]+)([\s\S]*)$/.exec(c);if(s){const v=s[1],d=Jo(s[2]);return Zo(e,d,v)}const m=Jo(c);return jo(e,m)}function Qo(e,l,o,n,a){const i=e.trim(),r=["<=",">=","<>"];let c=null,s=-1,m=null,v=0;for(let C=0;C<i.length;C++){const y=i[C];if(m){y===m&&(i[C+1]===m?C++:m=null);continue}if(y==='"'||y==="'"){m=y;continue}if(y==="("&&v++,y===")"&&v--,v===0&&(y==="<"||y===">"||y==="=")){const h=i.slice(C,C+2);c=r.includes(h)?h:y,s=C;break}}if(c&&s>=0){const C=i.slice(0,s).trim(),y=i.slice(s+c.length).trim(),h=Qt(C,l,o,n,a),L=Qt(y,l,o,n,a);return Zo(h,L,c)}const d=Qt(i,l,o,n,a);return yo(d)}function kn(e){const l=[];let o=0,n=null,a="";for(let i=0;i<e.length;i++){const r=e[i];if(n){a+=r,r===n&&(e[i+1]===n?(i++,a+=n):n=null);continue}if(r==='"'||r==="'"){n=r,a+=r;continue}if(r==="("&&o++,r===")"&&o--,r===","&&o===0){l.push(a),a="";continue}a+=r}return l.push(a),l}function Qt(e,l,o,n,a){if(a>20)return null;const i=e.trim();if(i==="")return null;const r=i.toUpperCase();if(r==="TRUE")return 1;if(r==="FALSE")return 0;const c=ld(i);if(c.length===0)return null;let s=0;const m=()=>{let y=v();for(;s<c.length;){const h=c[s];if(h.type==="op"&&(h.val==="+"||h.val==="-"))s++,y=wo(y,v(),h.val);else break}return y},v=()=>{let y=d();for(;s<c.length;){const h=c[s];if(h.type==="op"&&(h.val==="*"||h.val==="/"))s++,y=wo(y,d(),h.val);else break}return y},d=()=>{const y=c[s];return y&&y.type==="op"&&y.val==="-"?(s++,wo(0,d(),"-")):y&&y.type==="op"&&y.val==="+"?(s++,d()):C()},C=()=>{const y=c[s];if(!y)return null;if(y.type==="num")return s++,Number(y.val);if(y.type==="str")return s++,y.val;if(y.type==="lp"){s++;const h=m();return c[s]&&c[s].type==="rp"&&s++,h}if(y.type==="ref"){s++;const h=vn(y.val,o,n);return h?Al(h.col,h.row,l,o,n):null}if(y.type==="func"){const h=y.val.toUpperCase();if(s++,c[s]&&c[s].type==="lp"){const L=c[s];let oe=0,te=null,Y=s;for(;Y<c.length;Y++)if(c[Y].type==="lp")oe++;else if(c[Y].type==="rp"&&(oe--,oe===0)){te=c[Y];break}if(te){const k=i.slice(L.start+1,te.start);return s=Y+1,er(h,k,l,o,n,a+1)}}return null}return s++,null};return m()}function ld(e){const l=[];let o=0;for(;o<e.length;){const n=e[o];if(/\s/.test(n)){o++;continue}if(n==='"'||n==="'"){const a=n,i=o;o++;let r="";for(;o<e.length;){if(e[o]===a){if(e[o+1]===a){r+=a,o+=2;continue}o++;break}r+=e[o],o++}l.push({type:"str",val:r,start:i});continue}if(/[0-9]/.test(n)||n==="."){const a=o;let i="";for(n==="."&&(i+=".",o++);o<e.length&&/[0-9]/.test(e[o]);)i+=e[o],o++;if(e[o]===".")for(i+=".",o++;o<e.length&&/[0-9]/.test(e[o]);)i+=e[o],o++;if(e[o]==="e"||e[o]==="E")for(i+=e[o],o++,(e[o]==="+"||e[o]==="-")&&(i+=e[o],o++);o<e.length&&/[0-9]/.test(e[o]);)i+=e[o],o++;l.push({type:"num",val:i,start:a});continue}if(/[A-Za-z_$]/.test(n)){const a=o;let i="";for(;o<e.length&&/[A-Za-z0-9_$]/.test(e[o]);)i+=e[o],o++;e[o]==="("&&!i.includes("$")?l.push({type:"func",val:i,start:a}):l.push({type:"ref",val:i,start:a});continue}if(n==="("){l.push({type:"lp",val:n,start:o}),o++;continue}if(n===")"){l.push({type:"rp",val:n,start:o}),o++;continue}if(n===","){l.push({type:"comma",val:n,start:o}),o++;continue}if(n==="+"||n==="-"||n==="*"||n==="/"){l.push({type:"op",val:n,start:o}),o++;continue}o++}return l}function wo(e,l,o){if(typeof e!="number"||typeof l!="number")return null;switch(o){case"+":return e+l;case"-":return e-l;case"*":return e*l;case"/":return l===0?null:e/l}return null}function er(e,l,o,n,a,i){switch(e){case"SUM":case"AVERAGE":case"COUNT":{const r=Fn(l.trim(),n,a);if(!r)return null;if(e==="COUNT"){let s=0;for(let m=r.sc;m<=r.ec;m++)for(let v=r.sr;v<=r.er;v++)typeof Al(m,v,o,n,a)=="number"&&s++;return s}let c=0;for(let s=r.sc;s<=r.ec;s++)for(let m=r.sr;m<=r.er;m++)c+=Yo(s,m,o,n,a);if(isNaN(c))return null;if(e==="AVERAGE"){const s=(r.ec-r.sc+1)*(r.er-r.sr+1);return s===0?null:c/s}return c}case"IF":{const r=kn(l);if(r.length<3)return null;const c=Qo(r[0],o,n,a,i);return Qt(c?r[1]:r[2],o,n,a,i)}case"VLOOKUP":{const r=kn(l);if(r.length<3)return null;const c=Qt(r[0],o,n,a,i),s=Fn(r[1].trim(),n,a);if(!s)return null;const m=Qt(r[2],o,n,a,i),v=typeof m=="number"?m:parseFloat(String(m));if(isNaN(v))return null;const d=s.sc+(v-1);if(d<s.sc||d>s.ec)return null;if(r.length>=4?yo(Qt(r[3],o,n,a,i)):!1){let y=-1,h=-1/0;for(let L=s.sr;L<=s.er;L++){const oe=Al(s.sc,L,o,n,a);typeof oe=="number"&&typeof c=="number"&&oe<=c&&oe>h&&(h=oe,y=L)}return y>=0?Al(d,y,o,n,a):null}for(let y=s.sr;y<=s.er;y++){const h=Al(s.sc,y,o,n,a);if(jo(h,c))return Al(d,y,o,n,a)}return null}case"CONCATENATE":{const r=kn(l);let c="";for(const s of r){const m=Qt(s,o,n,a,i);c+=m===null?"":typeof m=="number"?String(m):m}return c}case"MAX":case"MIN":{const r=Fn(l.trim(),n,a);if(!r)return null;const c=[];for(let s=r.sc;s<=r.ec;s++)for(let m=r.sr;m<=r.er;m++){const v=Al(s,m,o,n,a);typeof v=="number"&&c.push(v)}return c.length===0?null:e==="MAX"?Math.max(...c):Math.min(...c)}case"STDEV":{const r=Fn(l.trim(),n,a);if(!r)return null;const c=[];for(let d=r.sc;d<=r.ec;d++)for(let C=r.sr;C<=r.er;C++){const y=Al(d,C,o,n,a);typeof y=="number"&&c.push(y)}const s=c.length;if(s<2)return null;const m=c.reduce((d,C)=>d+C,0)/s,v=c.reduce((d,C)=>d+Math.pow(C-m,2),0)/(s-1);return Math.sqrt(v)}case"SIN":{const r=kn(l);if(r.length!==1)return null;const c=Qt(r[0],o,n,a,i);return typeof c!="number"?null:Math.sin(c)}case"SUMIF":{const r=kn(l);if(r.length<2||r.length>3)return null;const c=Fn(r[0].trim(),n,a);if(!c)return null;const s=r.length===3?Fn(r[2].trim(),n,a):c;if(!s)return null;let m=0;for(let v=c.sr;v<=c.er;v++)for(let d=c.sc;d<=c.ec;d++){const C=Al(d,v,o,n,a);td(C,r[1])&&(m+=Yo(s.sc+(d-c.sc),s.sr+(v-c.sr),o,n,a))}return m}case"PMT":{const r=kn(l);if(r.length<3||r.length>5)return null;const c=Qt(r[0],o,n,a,i),s=Qt(r[1],o,n,a,i),m=Qt(r[2],o,n,a,i);if(typeof c!="number"||typeof s!="number"||typeof m!="number")return null;const v=r.length>=4?Qt(r[3],o,n,a,i):0,d=typeof v=="number"?v:0,C=r.length>=5?Qt(r[4],o,n,a,i):0,y=yo(C)?1:0;if(c===0)return s===0?null:-(m+d)/s;const h=Math.pow(1+c,s);return-(d+m*h)*c/((1+c*y)*(h-1))}default:return null}}function Zn(e,l,o){const n=[],a=/(\$?[A-Z]+\$?\d+)(?::(\$?[A-Z]+\$?\d+))?/gi;let i;for(;(i=a.exec(e))!==null;){const r=vn(i[1],l,o);if(r)if(i[2]){const c=vn(i[2],l,o);if(!c)continue;for(let s=Math.min(r.col,c.col);s<=Math.max(r.col,c.col);s++)for(let m=Math.min(r.row,c.row);m<=Math.max(r.row,c.row);m++)n.push(Vn(s,m))}else n.push(Vn(r.col,r.row))}return n}function tr(e,l,o,n,a){const i=o[Vn(e,l)];if(!i)return"";const r=i.value;if(!r.startsWith("="))return r;const c=Xo(Vn(e,l),o,n,a);return c===null?"#ERROR":String(c)}function nd(e,l,o,n){const a=e.trim().replace(/^=/,"");return a?Qo(a,l,o,n,0):!1}function vo(e,l,o,n,a,i){return l===0&&o===0?e:e.replace(/(\$?)([A-Z]+)(\$?)(\d+)/gi,(r,c,s,m,v)=>{const d=c?bo(s):bo(s)+l,C=m?parseInt(v,10)-1:parseInt(v,10)-1+o;let y;d<0?y="A":d>=n?y=i(n-1):y=i(d);let h;return C<0?h="1":C>=a?h=String(a):h=String(C+1),(c||"")+y+(m||"")+h})}class od{constructor(){this.deps=new Map,this.rev=new Map,this.dirty=new Set}clear(l){var n;const o=this.deps.get(l);if(o){for(const a of o)(n=this.rev.get(a))==null||n.delete(l);this.deps.delete(l)}}set(l,o){if(this.clear(l),o.length!==0){this.deps.set(l,o);for(const n of o)this.rev.has(n)||this.rev.set(n,new Set),this.rev.get(n).add(l)}}markDirty(l){const o=[l];for(;o.length>0;){const n=o.pop(),a=this.rev.get(n);if(a)for(const i of a)this.dirty.has(i)||(this.dirty.add(i),o.push(i))}}getDirtyAndClear(){const l=this.dirty;return this.dirty=new Set,l}rebuild(l,o,n){this.deps.clear(),this.rev.clear(),this.dirty.clear(),_n.clear();for(const[a,i]of Object.entries(l))if(i.value.startsWith("=")){const r=Zn(i.value.slice(1),o,n);this.set(a,r)}}}const rd={class:"ifn-dialog__header"},ad={class:"ifn-dialog__title"},id={class:"ifn-dialog__body"},cd={class:"ifn-dialog__field"},sd={class:"ifn-dialog__label"},dd={key:0,class:"ifn-dialog__desc"},ud={class:"ifn-dialog__field"},fd={class:"ifn-dialog__label"},md={class:"ifn-dialog__footer"},pd=["disabled"],hd=Yt(t.defineComponent({__name:"insertFunctionDialog",props:{modelOpen:{type:Boolean,default:!1},locale:{default:"zh-CN"}},emits:["update:modelOpen","insert","cancel"],setup(e,{emit:l}){const o=e,n=l,a=t.ref(!1),i=t.ref(""),r=t.ref(""),c=t.ref(null),s=t.ref(null),m={SUM:"fnDescSum",AVERAGE:"fnDescAverage",COUNT:"fnDescCount",IF:"fnDescIf",VLOOKUP:"fnDescVlookup",CONCATENATE:"fnDescConcatenate",MAX:"fnDescMax",MIN:"fnDescMin",SIN:"fnDescSin",SUMIF:"fnDescSumif",PMT:"fnDescPmt",STDEV:"fnDescStdev"},v=t.computed(()=>Go.map(le=>({label:le.name,value:le.name}))),d=t.computed(()=>{const le=String(i.value??"");return le?w(o.locale,m[le]??""):""}),C=t.computed(()=>Qs(r.value)),y=t.computed(()=>i.value===""||i.value===null||!r.value.trim()||!C.value.ok?!1:C.value.name===String(i.value).toUpperCase());t.watch(()=>o.modelOpen,le=>{le&&!a.value?h():!le&&a.value&&L()});function h(){r.value="",i.value="",a.value=!0,o.modelOpen!==void 0&&n("update:modelOpen",!0),t.nextTick(()=>{const le=c.value;if(le)try{le.focus({preventScroll:!0}),le.setSelectionRange(le.value.length,le.value.length)}catch{}})}function L(){a.value=!1,o.modelOpen!==void 0&&n("update:modelOpen",!1)}function oe(le){i.value=le;const se=Go.find(Ke=>Ke.name===String(le));se&&(r.value="",te(se.snippet))}function te(le){const se=r.value,Ke=c.value,Oe=Ke?Ke.selectionStart??se.length:se.length,Ge=Ke?Ke.selectionEnd??se.length:se.length,Te=se.trim()?le:"="+le;r.value=se.slice(0,Oe)+Te+se.slice(Ge),t.nextTick(()=>{const qe=c.value;if(!qe)return;const tt=Oe+Te.length;try{qe.focus({preventScroll:!0}),qe.setSelectionRange(tt,tt)}catch{}})}function Y(){n("insert",r.value),L()}function k(){n("cancel"),L()}function Q(le){le.key==="Escape"&&(le.stopPropagation(),k())}return(le,se)=>(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(k,["self"]),onKeydown:Q},[t.createElementVNode("div",{ref_key:"dialogRef",ref:s,class:"ifn-dialog",onMousedown:se[1]||(se[1]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",rd,[t.createElementVNode("span",ad,t.toDisplayString(t.unref(w)(e.locale,"insertFunctionTitle")),1),t.createElementVNode("button",{class:"ifn-dialog__close",type:"button",onClick:k},[...se[2]||(se[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",id,[t.createElementVNode("div",cd,[t.createElementVNode("label",sd,t.toDisplayString(t.unref(w)(e.locale,"insertFunctionSelectLabel")),1),t.createVNode(Jt,{class:"ifn-dialog__dropdown","model-value":i.value,options:v.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":oe},null,8,["model-value","options","search-placeholder","fallback-label","title"]),d.value?(t.openBlock(),t.createElementBlock("div",dd,t.toDisplayString(d.value),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",ud,[t.createElementVNode("label",fd,t.toDisplayString(t.unref(w)(e.locale,"insertFunctionFormulaLabel")),1),t.withDirectives(t.createElementVNode("textarea",{ref_key:"textareaRef",ref:c,"onUpdate:modelValue":se[0]||(se[0]=Ke=>r.value=Ke),class:"ifn-dialog__textarea",spellcheck:"false"},null,512),[[t.vModelText,r.value]])])]),t.createElementVNode("div",md,[t.createElementVNode("button",{class:"ifn-dialog__btn ifn-dialog__btn--primary",type:"button",disabled:!y.value,onClick:Y},t.toDisplayString(t.unref(w)(e.locale,"insertFunctionBtn")),9,pd),t.createElementVNode("button",{class:"ifn-dialog__btn",type:"button",onClick:k},t.toDisplayString(t.unref(w)(e.locale,"cancel")),1)])],544)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-f4e459b6"]]),Wn="__filter_blank__";function ko(e,l,o,n){if(Yl(e))return Number(e);if(n==="date"){const a=Dn(e,o);if(a)return a.serial}return null}function Jn(e,l,o){if(e==null)return null;if(Yl(e))return Number(e);if(l==="date"){const n=Dn(e,o);if(n)return n.serial}return null}function gd(e,l,o,n,a){const i=Rl(l,o,n);switch(e.operator){case"blank":return l.trim()==="";case"notBlank":return l.trim()!=="";case"equals":case"notEquals":{const r=e.operator==="equals";if(a==="number"||a==="date"){const s=ko(l,o,n,a),m=Jn(e.value,a,n);return s==null||m==null?!1:r?s===m:s!==m}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=ko(l,o,n,a),c=Jn(e.value,a,n);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=ko(l,o,n,a),c=Jn(e.value,a,n),s=Jn(e.value2,a,n);if(r==null||c==null||s==null)return!1;const m=Math.min(c,s),v=Math.max(c,s);return r>=m&&r<=v}}return!0}function lr(e,l,o,n){if(e.type==="values"){const a=e.values??[];if(a.length===0)return!0;if(l.trim()==="")return a.includes(Wn);const i=Rl(l,o,n);return a.includes(l)||a.includes(i)}return e.condition?gd(e.condition,l,o,n,e.type):!0}function bd(e,l,o,n){if(!e)return!0;const{columns:a,range:i}=e;for(const r in a){const c=Number(r);if(c<i.startCol||c>i.endCol)continue;const s=a[r],m=o.getValue(c,l),v=o.getFormat(c,l);if(!lr(s,m,v,n))return!1}return!0}function Cd(e,l,o,n){const a=new Set,i=[];let r=!1;const{range:c,columns:s}=e;for(let v=c.startRow+1;v<=c.endRow;v++){let d=!0;for(const h in s){const L=Number(h);if(L===l)continue;const oe=s[h];if(!lr(oe,o.getValue(L,v),o.getFormat(L,v),n)){d=!1;break}}if(!d)continue;const C=o.getValue(l,v),y=Rl(C,o.getFormat(l,v),n);if(C.trim()===""){r=!0;continue}a.has(y)||(a.add(y),i.push(y))}return i.length>0&&i.every(v=>Yl(v))?i.sort((v,d)=>Number(v)-Number(d)):i.sort((v,d)=>v.localeCompare(d,n,{numeric:!0})),{values:i,hasBlank:r}}function nr(e){var l;return e?e.type==="values"?(((l=e.values)==null?void 0:l.length)??0)>0:!!e.condition:!1}const yd={class:"filter-popup__head"},wd={class:"filter-popup__head-label"},vd={key:0,class:"filter-popup__head-badge"},kd={class:"filter-popup__search"},Ed=["placeholder"],Sd={class:"filter-popup__tools"},Rd={class:"filter-popup__count"},Md=["checked","onChange"],Bd={class:"filter-popup__item-label"},xd={key:0,class:"filter-popup__item-note"},Td={key:0,class:"filter-popup__empty"},Nd={class:"filter-popup__modes"},Dd={key:1,class:"filter-popup__cond"},Vd={class:"filter-popup__cond-row"},Fd=["value"],Id={key:0,class:"filter-popup__cond-row"},Ad={class:"filter-popup__cond-and"},Hd={key:1,class:"filter-popup__cond-row"},Ld=["placeholder"],Od={class:"filter-popup__footer"},Eo=248,Qn=28,zd=252,_d=Yt(t.defineComponent({__name:"filter-popup",props:{col:{},anchor:{},locale:{default:"zh-CN"},headerLabel:{},getFilter:{},setFilter:{},setFilterColumn:{},clearFilterColumn:{},getColumnCandidates:{},close:{}},setup(e){const l=e,o=t.ref(null),n=t.ref(null),a=t.ref(null),i=t.ref({left:0,top:0}),r=t.ref("values"),c=t.ref(""),s=t.ref(new Set),m=t.ref(!1),v=t.ref(0),d=t.ref(null),C=t.ref("equals"),y=t.ref(""),h=t.ref(""),L=t.computed(()=>l.getColumnCandidates(l.col)),oe=t.computed(()=>c.value.trim()!==""),te=t.computed(()=>{const re=c.value.trim().toLowerCase();return re?L.value.values.filter(V=>V.toLowerCase().includes(re)):L.value.values}),Y=t.computed(()=>{const re=te.value.map(V=>({key:V,label:V,isBlank:!1}));return L.value.hasBlank&&!oe.value&&re.push({key:Wn,label:w(l.locale,"filterBlank"),isBlank:!0}),re}),k=Math.ceil(zd/Qn),Q=t.computed(()=>Math.max(0,Math.floor(v.value/Qn)-2)),le=t.computed(()=>Math.min(Y.value.length,Q.value+k+4)),se=t.computed(()=>Y.value.slice(Q.value,le.value)),Ke=t.computed(()=>Q.value*Qn),Oe=t.computed(()=>Math.max(0,(Y.value.length-le.value)*Qn));function Ge(re){v.value=re.target.scrollTop}const Te=["equals","notEquals","contains","notContains","startsWith","endsWith"],qe=["equals","notEquals","gt","gte","lt","lte","between"],tt={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"},ye=t.computed(()=>r.value==="text"?Te:qe),ie=t.computed(()=>{var G;const re=l.getFilter(),V=re==null?void 0:re.columns[l.col];return V?V.type==="values"?(((G=V.values)==null?void 0:G.length)??0)>0:!!V.condition:!1});function he(){const re=l.getFilter(),V=re==null?void 0:re.columns[l.col];V&&V.type==="values"?(s.value=new Set((V.values??[]).filter(G=>G!==Wn)),m.value=(V.values??[]).includes(Wn)):V&&V.condition?(r.value=V.type,C.value=V.condition.operator,y.value=V.condition.value??"",h.value=V.condition.value2??""):(s.value=new Set(L.value.values),m.value=L.value.hasBlank)}function Ae(){if(!l.getFilter())return;const V=L.value.values,G=L.value.hasBlank;if(s.value.size===V.length&&V.every($e=>s.value.has($e))&&m.value===G)l.setFilterColumn(l.col,null);else{const $e=[...s.value];m.value&&$e.push(Wn),l.setFilterColumn(l.col,{type:"values",values:$e})}}function dt(re){const V=new Set(s.value);V.has(re)?V.delete(re):V.add(re),s.value=V}function ue(){m.value=!m.value}function ve(){const re=oe.value?te.value:L.value.values,V=new Set(s.value);re.forEach(G=>V.add(G)),s.value=V,m.value=!0}function p(){s.value=new Set,m.value=!1}function A(re){r.value=re,C.value=re==="text"?"contains":"equals",y.value="",h.value=""}function $(){r.value="values",he()}function ee(){const re={operator:C.value,value:y.value};r.value!=="text"&&C.value==="between"&&(re.value2=h.value),y.value.trim()!==""&&(l.setFilterColumn(l.col,{type:r.value,condition:re}),l.close())}function U(){s.value=new Set(L.value.values),m.value=L.value.hasBlank}function O(){Ae(),l.close()}function x(){d.value&&l.setFilter(d.value),l.close()}function X(re){const V=o.value;V&&re.target instanceof Node&&V.contains(re.target)||l.close()}function Le(re){re.key==="Escape"&&x()}return t.onMounted(async()=>{var xe,$e;d.value=l.getFilter()?JSON.parse(JSON.stringify(l.getFilter())):null,he(),await t.nextTick();const re=((xe=o.value)==null?void 0:xe.offsetHeight)??400;let V=l.anchor.x+15-Eo,G=l.anchor.y+24;V<4&&(V=Math.max(4,l.anchor.x)),V+Eo>window.innerWidth-4&&(V=Math.max(4,window.innerWidth-Eo-4)),G+re>window.innerHeight-4&&(G=Math.max(4,l.anchor.y-re-4)),i.value={left:V,top:G},($e=a.value)==null||$e.focus(),document.addEventListener("pointerdown",X,!0),document.addEventListener("keydown",Le,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",X,!0),document.removeEventListener("keydown",Le,!0)}),(re,V)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createElementVNode("div",{ref_key:"rootRef",ref:o,class:"filter-popup",style:t.normalizeStyle({left:i.value.left+"px",top:i.value.top+"px"}),onPointerdown:V[9]||(V[9]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",yd,[t.createElementVNode("span",wd,t.toDisplayString(e.headerLabel||t.unref(ht)(e.col)),1),ie.value?(t.openBlock(),t.createElementBlock("span",vd,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",kd,[t.withDirectives(t.createElementVNode("input",{ref_key:"searchInputRef",ref:a,"onUpdate:modelValue":V[0]||(V[0]=G=>c.value=G),class:"filter-popup__search-input",type:"text",placeholder:t.unref(w)(e.locale,"filterSearchPlaceholder")},null,8,Ed),[[t.vModelText,c.value]])]),t.createElementVNode("div",Sd,[t.createElementVNode("button",{class:"filter-popup__tool",onClick:ve},t.toDisplayString(t.unref(w)(e.locale,"filterSelectAll")),1),t.createElementVNode("button",{class:"filter-popup__tool",onClick:p},t.toDisplayString(t.unref(w)(e.locale,"filterClearAll")),1),t.createElementVNode("span",Rd,t.toDisplayString(t.unref(w)(e.locale,"filterFilteredCount").replace("{n}",String(L.value.values.length))),1)]),t.createElementVNode("div",{ref_key:"listRef",ref:n,class:"filter-popup__list",onScroll:Ge},[t.createElementVNode("div",{style:t.normalizeStyle({height:Ke.value+"px"})},null,4),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(se.value,G=>(t.openBlock(),t.createElementBlock("label",{key:G.key,class:"filter-popup__item"},[t.createElementVNode("input",{type:"checkbox",checked:G.isBlank?m.value:s.value.has(G.key),onChange:xe=>G.isBlank?ue():dt(G.key)},null,40,Md),t.createElementVNode("span",Bd,t.toDisplayString(G.label),1),G.isBlank?(t.openBlock(),t.createElementBlock("span",xd,"("+t.toDisplayString(t.unref(w)(e.locale,"filterBlank"))+")",1)):t.createCommentVNode("",!0)]))),128)),t.createElementVNode("div",{style:t.normalizeStyle({height:Oe.value+"px"})},null,4),Y.value.length===0?(t.openBlock(),t.createElementBlock("div",Td,t.toDisplayString(t.unref(w)(e.locale,"filterNoData")),1)):t.createCommentVNode("",!0)],544),t.createElementVNode("div",Nd,[t.createElementVNode("button",{class:"filter-popup__mode",onClick:V[1]||(V[1]=G=>A("text"))},t.toDisplayString(t.unref(w)(e.locale,"filterText")),1),t.createElementVNode("button",{class:"filter-popup__mode",onClick:V[2]||(V[2]=G=>A("number"))},t.toDisplayString(t.unref(w)(e.locale,"filterNumber")),1),t.createElementVNode("button",{class:"filter-popup__mode",onClick:V[3]||(V[3]=G=>A("date"))},t.toDisplayString(t.unref(w)(e.locale,"filterDate")),1)])],64)):(t.openBlock(),t.createElementBlock("div",Dd,[t.createElementVNode("button",{class:"filter-popup__cond-back",onClick:$}," ← "+t.toDisplayString(t.unref(w)(e.locale,"filterCustom")),1),t.createElementVNode("div",Vd,[t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":V[4]||(V[4]=G=>C.value=G),class:"filter-popup__cond-select"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ye.value,G=>(t.openBlock(),t.createElementBlock("option",{key:G,value:G},t.toDisplayString(t.unref(w)(e.locale,tt[G])),9,Fd))),128))],512),[[t.vModelSelect,C.value]])]),C.value==="between"?(t.openBlock(),t.createElementBlock("div",Id,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":V[5]||(V[5]=G=>y.value=G),class:"filter-popup__cond-input",type:"text"},null,512),[[t.vModelText,y.value]]),t.createElementVNode("span",Ad,t.toDisplayString(t.unref(w)(e.locale,"filterAnd")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":V[6]||(V[6]=G=>h.value=G),class:"filter-popup__cond-input",type:"text"},null,512),[[t.vModelText,h.value]])])):(t.openBlock(),t.createElementBlock("div",Hd,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":V[7]||(V[7]=G=>y.value=G),class:"filter-popup__cond-input",type:"text",placeholder:r.value==="date"?"2024-01-01":"",onKeydown:t.withKeys(ee,["enter"])},null,40,Ld),[[t.vModelText,y.value]])]))])),t.createElementVNode("div",Od,[t.createElementVNode("button",{class:"filter-popup__btn filter-popup__btn--clear",onClick:U},t.toDisplayString(t.unref(w)(e.locale,"clearFilter")),1),V[10]||(V[10]=t.createElementVNode("span",{class:"filter-popup__footer-spacer"},null,-1)),t.createElementVNode("button",{class:"filter-popup__btn",onClick:x},t.toDisplayString(t.unref(w)(e.locale,"cancelFilter")),1),t.createElementVNode("button",{class:"filter-popup__btn filter-popup__btn--primary",onClick:V[8]||(V[8]=G=>r.value==="values"?O():ee())},t.toDisplayString(t.unref(w)(e.locale,"filterOk")),1)])],36)]))}}),[["__scopeId","data-v-3cfc34e8"]]),$d={class:"cf-manager__header"},Wd={class:"cf-manager__title"},Pd={key:0,class:"cf-manager__empty"},Ud={key:1,class:"cf-manager__list"},Kd={class:"cf-rule__main"},Gd={class:"cf-rule__info"},qd={class:"cf-rule__summary"},Yd={class:"cf-rule__range"},Xd={class:"cf-rule__actions"},jd={class:"cf-chk"},Zd=["checked","onChange"],Jd=["title","onClick"],Qd=["title","onClick"],eu=["title","onClick"],tu=["title","onClick"],lu=Yt(t.defineComponent({__name:"conditional-format-manager",props:{locale:{},rules:{default:()=>[]},themeVars:{default:()=>({})}},emits:["edit","delete","move","toggle","new","close"],setup(e,{emit:l}){const o=e,n=l,a=t.computed(()=>[...o.rules].sort((s,m)=>s.priority-m.priority));function i(s){return s.ranges.map(m=>{const v=ht(m.startCol)+(m.startRow+1);return m.startCol===m.endCol&&m.startRow===m.endRow?v:v+":"+ht(m.endCol)+(m.endRow+1)}).join(", ")}function r(s){switch(s.type){case"cellIs":{const m=w(o.locale,"cf"+(s.operator==="greaterThan"?"GreaterThan":s.operator==="lessThan"?"LessThan":s.operator==="greaterThanOrEqual"?"GreaterThanOrEqual":s.operator==="lessThanOrEqual"?"LessThanOrEqual":s.operator==="notEqual"?"NotEqual":s.operator==="between"?"Between":s.operator==="notBetween"?"NotBetween":"Equal"));return s.operator==="between"||s.operator==="notBetween"?`${m} ${s.value} ${w(o.locale,"cfValue2")} ${s.value2??""}`:`${m} ${s.value}`}case"textContains":return`${w(o.locale,"cfTextContains")} "${s.value}"`;case"textNotContains":return`${w(o.locale,"cfTextNotContains")} "${s.value}"`;case"blank":return w(o.locale,"cfBlank");case"notBlank":return w(o.locale,"cfNotBlank");case"duplicate":return w(o.locale,"cfDuplicate");case"unique":return w(o.locale,"cfUnique");case"formula":return"= "+s.formula;default:return w(o.locale,"cfRuleTypeGeneric")}}function c(s){const m={};return s.format.backgroundColor&&(m.background=s.format.backgroundColor),s.format.color&&(m.color=s.format.color),s.format.fontWeight==="bold"&&(m.fontWeight="700"),s.format.fontStyle==="italic"&&(m.fontStyle="italic"),s.format.underline==="underline"&&(m.textDecoration="underline"),s.format.strikethrough==="line-through"&&(m.textDecoration="line-through"),m}return(s,m)=>(t.openBlock(),t.createElementBlock("div",{class:"cf-manager",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("div",$d,[t.createElementVNode("span",Wd,t.toDisplayString(t.unref(w)(e.locale,"cfManagerTitle")),1),t.createElementVNode("button",{type:"button",class:"cf-btn cf-btn--primary cf-manager__new",onClick:m[0]||(m[0]=v=>n("new"))},t.toDisplayString(t.unref(w)(e.locale,"cfNewRule")),1),t.createElementVNode("button",{type:"button",class:"cf-manager__close",onClick:m[1]||(m[1]=v=>n("close"))}," × ")]),a.value.length===0?(t.openBlock(),t.createElementBlock("div",Pd,t.toDisplayString(t.unref(w)(e.locale,"cfNoRules")),1)):(t.openBlock(),t.createElementBlock("div",Ud,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,v=>(t.openBlock(),t.createElementBlock("div",{key:v.id,class:t.normalizeClass(["cf-rule",{"cf-rule--disabled":!v.enabled}])},[t.createElementVNode("div",Kd,[t.createElementVNode("span",{class:"cf-rule__preview",style:t.normalizeStyle(c(v))},"Aa",4),t.createElementVNode("div",Gd,[t.createElementVNode("div",qd,t.toDisplayString(r(v.condition)),1),t.createElementVNode("div",Yd,t.toDisplayString(t.unref(w)(e.locale,"cfAppliedTo"))+": "+t.toDisplayString(i(v)),1)])]),t.createElementVNode("div",Xd,[t.createElementVNode("label",jd,[t.createElementVNode("input",{class:"cf-chk__input",type:"checkbox",checked:v.enabled,onChange:d=>n("toggle",v.id,d.target.checked)},null,40,Zd),m[2]||(m[2]=t.createElementVNode("span",{class:"cf-chk__box"},[t.createElementVNode("svg",{class:"cf-chk__tick",viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M405 697L195 487l58-58 152 152 304-304 58 58z"})])],-1)),t.createTextVNode(t.toDisplayString(t.unref(w)(e.locale,"cfEnabled")),1)]),t.createElementVNode("button",{type:"button",class:"cf-mini",title:t.unref(w)(e.locale,"cfMoveUp"),onClick:d=>n("move",v.id,"up")},[...m[3]||(m[3]=[t.createElementVNode("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round","stroke-linejoin":"round"},[t.createElementVNode("path",{d:"M8 3 L8 13 M4 7 L8 3 L12 7"})],-1)])],8,Jd),t.createElementVNode("button",{type:"button",class:"cf-mini",title:t.unref(w)(e.locale,"cfMoveDown"),onClick:d=>n("move",v.id,"down")},[...m[4]||(m[4]=[t.createElementVNode("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round","stroke-linejoin":"round"},[t.createElementVNode("path",{d:"M8 3 L8 13 M4 9 L8 13 L12 9"})],-1)])],8,Qd),t.createElementVNode("button",{type:"button",class:"cf-mini",title:t.unref(w)(e.locale,"cfEdit"),onClick:d=>n("edit",v)},[...m[5]||(m[5]=[t.createElementVNode("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},[t.createElementVNode("path",{d:"M10.5 3.5 L13 6 L5 14 L2 14 L2 11 Z"}),t.createElementVNode("path",{d:"M9 5.5 L11.5 8"})],-1)])],8,eu),t.createElementVNode("button",{type:"button",class:"cf-mini",title:t.unref(w)(e.locale,"cfDelete"),onClick:d=>n("delete",v.id)},[...m[6]||(m[6]=[t.createElementVNode("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round"},[t.createElementVNode("path",{d:"M4.5 4.5 L11.5 11.5 M11.5 4.5 L4.5 11.5"})],-1)])],8,tu)])],2))),128))]))],4))}}),[["__scopeId","data-v-dd8fdaef"]]),nu={class:"cf-editor__header"},ou={class:"cf-editor__title"},ru={class:"cf-editor__body"},au={class:"cf-row"},iu={class:"cf-label"},cu={class:"cf-row"},su={class:"cf-label"},du={class:"cf-row"},uu={class:"cf-label"},fu={key:0,class:"cf-row"},mu={class:"cf-label"},pu={class:"cf-row"},hu={class:"cf-label"},gu=["placeholder"],bu={class:"cf-hint"},Cu={key:2,class:"cf-row"},yu={class:"cf-label"},wu={class:"cf-row"},vu={class:"cf-label"},ku={class:"cf-format-row"},Eu=["title"],Su={viewBox:"0 0 1024 1024",fill:"currentColor"},Ru=["fill"],Mu=["title"],Bu={viewBox:"0 0 1024 1024",fill:"currentColor"},xu=["fill"],Tu=["title"],Nu=["title"],Du=["title"],Vu=["title"],Fu={class:"cf-row"},Iu={class:"cf-label"},Au={key:3,class:"cf-error"},Hu={class:"cf-row cf-row--inline"},Lu={class:"cf-chk"},Ou=["checked"],zu={class:"cf-chk"},_u=["checked"],$u={class:"cf-editor__footer"},Wu=Yt(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 o=e,n=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(o.rule){const ye=o.rule.condition;return{type:ye.type==="cellIs"||ye.type==="textContains"||ye.type==="textNotContains"||ye.type==="blank"||ye.type==="notBlank"||ye.type==="duplicate"||ye.type==="unique"||ye.type==="formula"?ye.type:"cellIs",operator:ye.type==="cellIs"?ye.operator:"greaterThan",value:ye.type==="cellIs"||ye.type==="textContains"||ye.type==="textNotContains"?ye.value:"",value2:ye.type==="cellIs"?ye.value2??"":"",formula:ye.type==="formula"?ye.formula:"",backgroundColor:o.rule.format.backgroundColor??"",color:o.rule.format.color??"",fontWeight:o.rule.format.fontWeight==="bold",fontStyle:o.rule.format.fontStyle==="italic",underline:o.rule.format.underline==="underline",strikethrough:o.rule.format.strikethrough==="line-through",rangeText:o.rule.ranges.length?o.rule.ranges.map(he=>y(he)).join(", "):o.defaultRangeText,stopIfTrue:o.rule.stopIfTrue,enabled:o.rule.enabled}}return{type:"cellIs",operator:"greaterThan",value:"",value2:"",formula:"",backgroundColor:"#DEEBF7",color:"#17375E",fontWeight:!1,fontStyle:!1,underline:!1,strikethrough:!1,rangeText:o.defaultRangeText,stopIfTrue:!1,enabled:!0}}const c=t.reactive(r()),s=t.ref(!1),m=t.ref(!1),v=t.ref(null),d=t.ref(null),C=t.ref("");function y(ye){const ie=ht(ye.startCol)+(ye.startRow+1);return ye.startCol===ye.endCol&&ye.startRow===ye.endRow?ie:ie+":"+ht(ye.endCol)+(ye.endRow+1)}function h(ye){const ie=ye.split(",").map(Ae=>Ae.trim()).filter(Boolean),he=[];for(const Ae of ie){if(!Ae.match(/^[A-Za-z]+\d+(?::[A-Za-z]+\d+)?$/i))return null;const ue=vn(Ae.split(":")[0],99999,99999),ve=Ae.split(":")[1],p=ve?vn(ve,99999,99999):ue;if(!ue||!p)return null;he.push({startCol:Math.min(ue.col,p.col),endCol:Math.max(ue.col,p.col),startRow:Math.min(ue.row,p.row),endRow:Math.max(ue.row,p.row)})}return he.length?he:null}const L=t.computed(()=>c.type==="cellIs"&&(c.operator==="between"||c.operator==="notBetween")),oe=t.computed(()=>c.type==="formula"),te=t.computed(()=>["blank","notBlank","duplicate","unique"].includes(c.type)),Y=t.computed(()=>a.map(ye=>({value:ye.value,label:w(o.locale,ye.label)}))),k=t.computed(()=>i.map(ye=>({value:ye.value,label:w(o.locale,ye.label)})));function Q(ye){c.type=ye}function le(ye){c.operator=String(ye)}function se(){s.value=!s.value}function Ke(){m.value=!m.value}function Oe(){return C.value="",h(c.rangeText)?oe.value&&!c.formula.trim()?(C.value="请输入公式",!1):!0:(C.value="范围格式无效,例如 A1:B10",!1)}function Ge(){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 Te(){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 qe(){var he,Ae;if(!Oe())return;const ye=h(c.rangeText),ie={id:((he=o.rule)==null?void 0:he.id)??"",condition:Ge(),format:Te(),ranges:ye,priority:((Ae=o.rule)==null?void 0:Ae.priority)??0,stopIfTrue:c.stopIfTrue,enabled:c.enabled};n("save",ie)}function tt(){n("cancel")}return(ye,ie)=>(t.openBlock(),t.createElementBlock("div",{class:"cf-editor",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("div",nu,[t.createElementVNode("span",ou,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:tt}," × ")]),t.createElementVNode("div",ru,[t.createElementVNode("div",au,[t.createElementVNode("label",iu,t.toDisplayString(t.unref(w)(e.locale,"cfType")),1),t.createVNode(Jt,{class:"cf-dropdown","model-value":c.type,options:Y.value,width:"100%","visible-count":8,title:t.unref(w)(e.locale,"cfType"),align:"right",onChange:Q},null,8,["model-value","options","title"])]),c.type==="cellIs"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",cu,[t.createElementVNode("label",su,t.toDisplayString(t.unref(w)(e.locale,"cfOperator")),1),t.createVNode(Jt,{class:"cf-dropdown","model-value":c.operator,options:k.value,width:"100%","visible-count":9,title:t.unref(w)(e.locale,"cfOperator"),align:"right",onChange:le},null,8,["model-value","options","title"])]),t.createElementVNode("div",du,[t.createElementVNode("label",uu,t.toDisplayString(t.unref(w)(e.locale,"cfValue")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":ie[0]||(ie[0]=he=>c.value=he),class:"cf-input",type:"text"},null,512),[[t.vModelText,c.value]])]),L.value?(t.openBlock(),t.createElementBlock("div",fu,[t.createElementVNode("label",mu,t.toDisplayString(t.unref(w)(e.locale,"cfValue2")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":ie[1]||(ie[1]=he=>c.value2=he),class:"cf-input",type:"text"},null,512),[[t.vModelText,c.value2]])])):t.createCommentVNode("",!0)],64)):oe.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",pu,[t.createElementVNode("label",hu,t.toDisplayString(t.unref(w)(e.locale,"cfFormulaShort")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":ie[2]||(ie[2]=he=>c.formula=he),class:"cf-input",type:"text",placeholder:t.unref(w)(e.locale,"cfFormulaExample")},null,8,gu),[[t.vModelText,c.formula]])]),t.createElementVNode("p",bu,t.toDisplayString(t.unref(w)(e.locale,"cfFormula")),1)],64)):te.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",Cu,[t.createElementVNode("label",yu,t.toDisplayString(t.unref(w)(e.locale,"cfValue")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":ie[3]||(ie[3]=he=>c.value=he),class:"cf-input",type:"text"},null,512),[[t.vModelText,c.value]])])),t.createElementVNode("div",wu,[t.createElementVNode("label",vu,t.toDisplayString(t.unref(w)(e.locale,"cfFormat")),1),t.createElementVNode("div",ku,[t.createElementVNode("button",{ref_key:"fillTrigger",ref:v,type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":s.value}]),title:t.unref(w)(e.locale,"fillColor"),onClick:se},[(t.openBlock(),t.createElementBlock("svg",Su,[ie[15]||(ie[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,Ru)]))],10,Eu),t.createVNode(Yn,{"model-open":s.value,"color-key":"fill","current-color":c.backgroundColor,"trigger-el":v.value,locale:e.locale,"onUpdate:modelOpen":ie[4]||(ie[4]=he=>s.value=he),onChange:ie[5]||(ie[5]=he=>c.backgroundColor=he)},null,8,["model-open","current-color","trigger-el","locale"]),t.createElementVNode("button",{ref_key:"fontTrigger",ref:d,type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":m.value}]),title:t.unref(w)(e.locale,"fontColor"),onClick:Ke},[(t.openBlock(),t.createElementBlock("svg",Bu,[ie[16]||(ie[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,xu)]))],10,Mu),t.createVNode(Yn,{"model-open":m.value,"color-key":"text","current-color":c.color,"trigger-el":d.value,locale:e.locale,"onUpdate:modelOpen":ie[6]||(ie[6]=he=>m.value=he),onChange:ie[7]||(ie[7]=he=>c.color=he)},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:ie[8]||(ie[8]=he=>c.fontWeight=!c.fontWeight)},[...ie[17]||(ie[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,Tu),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":c.fontStyle}]),title:t.unref(w)(e.locale,"italic"),onClick:ie[9]||(ie[9]=he=>c.fontStyle=!c.fontStyle)},[...ie[18]||(ie[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,Nu),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":c.underline}]),title:t.unref(w)(e.locale,"underline"),onClick:ie[10]||(ie[10]=he=>c.underline=!c.underline)},[...ie[19]||(ie[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,Du),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":c.strikethrough}]),title:t.unref(w)(e.locale,"strikethrough"),onClick:ie[11]||(ie[11]=he=>c.strikethrough=!c.strikethrough)},[...ie[20]||(ie[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,Vu)])]),t.createElementVNode("div",Fu,[t.createElementVNode("label",Iu,t.toDisplayString(t.unref(w)(e.locale,"cfAppliedTo")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":ie[12]||(ie[12]=he=>c.rangeText=he),class:"cf-input",type:"text"},null,512),[[t.vModelText,c.rangeText]])]),C.value?(t.openBlock(),t.createElementBlock("div",Au,t.toDisplayString(C.value),1)):t.createCommentVNode("",!0),t.createElementVNode("div",Hu,[t.createElementVNode("label",Lu,[t.createElementVNode("input",{class:"cf-chk__input",type:"checkbox",checked:c.stopIfTrue,onChange:ie[13]||(ie[13]=he=>c.stopIfTrue=he.target.checked)},null,40,Ou),ie[21]||(ie[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",zu,[t.createElementVNode("input",{class:"cf-chk__input",type:"checkbox",checked:c.enabled,onChange:ie[14]||(ie[14]=he=>c.enabled=he.target.checked)},null,40,_u),ie[22]||(ie[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",$u,[t.createElementVNode("button",{type:"button",class:"cf-btn cf-btn--primary",onClick:qe},t.toDisplayString(t.unref(w)(e.locale,"ok")),1),t.createElementVNode("button",{type:"button",class:"cf-btn",onClick:tt},t.toDisplayString(t.unref(w)(e.locale,"cancel")),1)])],4))}}),[["__scopeId","data-v-f923e29a"]]);function sn(e,l){return`${e},${l}`}function or(e,l){if(e.startsWith("="))return{kind:"formula",formula:e};const o=Dn(e,l);if(o)return{kind:"date",serial:o.serial};const n=/^(.*?)(\d+)$/.exec(e);if(n){const a=n[1],i=n[2];if(a!==""&&/^\d+$/.test(i))return{kind:"text-number",prefix:a,num:parseInt(i,10),digits:i.length}}return Yl(e)?{kind:"number",num:parseFloat(e)}:{kind:"text",text:e}}function So(e,l){for(let o=2;o<e.length;o++)if(e[o]-e[o-1]!==l)return!1;return!0}function rr(e){const l=e.length;if(l===0)return{kind:"copy",sourceValues:[]};if(e.some(o=>o.kind==="formula"))return{kind:"formula"};if(e.every(o=>o.kind==="date")){const o=e[0],n=l>=2?e[1].serial-o.serial:1;return{kind:"date-linear",baseSerial:o.serial,step:n,sourceLen:l}}if(e.every(o=>o.kind==="number")){if(l===1)return{kind:"copy",sourceValues:[...e]};const o=e.map(a=>a.num),n=o[1]-o[0];return So(o,n)?{kind:"linear",step:n,base:o[0],sourceLen:l}:{kind:"copy",sourceValues:[...e]}}if(e.every(o=>o.kind==="text-number")){const o=e[0];if(e.every(a=>a.kind==="text-number"&&a.prefix===o.prefix)){if(l===1)return{kind:"copy",sourceValues:[...e]};const a=e.map(r=>r.num),i=a[1]-a[0];if(So(a,i))return{kind:"text-number",prefix:o.prefix,step:i,base:o.num,digits:o.digits,sourceLen:l}}return{kind:"copy",sourceValues:[...e]}}if(e.every(o=>o.kind==="text")){const o=e.every(n=>n.text.length===1&&/[a-zA-Z]/.test(n.text));if(l>=2&&o){const n=e.map(i=>i.text.charCodeAt(0)),a=n[1]-n[0];if(a!==0&&So(n,a))return{kind:"text-series",step:a,baseCharCode:n[0],sourceLen:l}}return{kind:"copy",sourceValues:[...e]}}return{kind:"copy",sourceValues:[...e]}}function ar(e,l,o){switch(e.kind){case"copy":{const n=e.sourceValues.length;return n===0?{kind:"text",text:""}:e.sourceValues[l%n]}case"linear":return{kind:"number",num:e.base+e.step*(o+l)};case"text-number":return{kind:"text-number",prefix:e.prefix,num:e.base+e.step*(o+l),digits:e.digits};case"date-linear":return{kind:"date",serial:e.baseSerial+e.step*(o+l)};case"text-series":return{kind:"text",text:String.fromCharCode(e.baseCharCode+e.step*(o+l))};case"formula":return{kind:"formula",formula:""}}}function ir(e,l){switch(e.kind){case"copy":{const o=e.sourceValues.length;return o===0?{kind:"text",text:""}:e.sourceValues[o-1-l%o]}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 eo(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 cr(e,l){const o=l.row<e.startRow?e.startRow-l.row:l.row>e.endRow?l.row-e.endRow:0,n=l.col<e.startCol?e.startCol-l.col:l.col>e.endCol?l.col-e.endCol:0;if(o===0&&n===0)return null;const a=o>=n?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 sr(e,l,o,n,a,i){return vo(e,o.col-l.col,o.row-l.row,n,a,i)}function dr(e,l){return!(e.endCol<l.startCol||e.startCol>l.endCol||e.endRow<l.startRow||e.startRow>l.endRow)}function Pu(e,l){return l.startCol>=e.startCol&&l.endCol<=e.endCol&&l.startRow>=e.startRow&&l.endRow<=e.endRow}function Ro(e,l,o){const n=Object.keys(o);for(const a of n){const i=o[a];if(dr(e,i)&&!Pu(e,i))return!1}for(const a of n){const i=o[a];if(dr(l,i))return!1}return!0}function ur(e,l,o,n){const a=l.length;if(a!==0){if(e.kind==="copy"){const i=n?a-1-o%a:o%a;return l[i]}return n?l[0]:l[a-1]}}function Uu(e,l,o,n,a,i,r,c){const s={cells:{},merges:{}},m=n==="up"||n==="down",v=n==="up"||n==="left";if(m){const d=e.endRow-e.startRow+1;for(let C=e.startCol;C<=e.endCol;C++){const y=[],h=[];for(let te=e.startRow;te<=e.endRow;te++){const Y=o.cells[sn(C,te)];y.push(Y?or(Y.value,a):{kind:"text",text:""}),h.push(Y==null?void 0:Y.styleId)}const L=rr(y),oe=y.length;for(let te=l.startRow;te<=l.endRow;te++){const Y=v?l.endRow-te:te-l.startRow;if(L.kind==="formula"){const k=v?e.endRow-((l.endRow-te)%d+d)%d:e.startRow+((te-e.startRow)%d+d)%d,Q=o.cells[sn(C,k)],le=Q?Q.value:"",se=sr(le,{col:C,row:k},{col:C,row:te},i,r,c);s.cells[sn(C,te)]=eo({kind:"formula",formula:se},Q==null?void 0:Q.styleId)}else{const k=v?ir(L,Y):ar(L,Y,oe),Q=ur(L,h,Y,v);s.cells[sn(C,te)]=eo(k,Q)}}}}else{const d=e.endCol-e.startCol+1;for(let C=e.startRow;C<=e.endRow;C++){const y=[],h=[];for(let te=e.startCol;te<=e.endCol;te++){const Y=o.cells[sn(te,C)];y.push(Y?or(Y.value,a):{kind:"text",text:""}),h.push(Y==null?void 0:Y.styleId)}const L=rr(y),oe=y.length;for(let te=l.startCol;te<=l.endCol;te++){const Y=v?l.endCol-te:te-l.startCol;if(L.kind==="formula"){const k=v?e.endCol-((l.endCol-te)%d+d)%d:e.startCol+((te-e.startCol)%d+d)%d,Q=o.cells[sn(k,C)],le=Q?Q.value:"",se=sr(le,{col:k,row:C},{col:te,row:C},i,r,c);s.cells[sn(te,C)]=eo({kind:"formula",formula:se},Q==null?void 0:Q.styleId)}else{const k=v?ir(L,Y):ar(L,Y,oe),Q=ur(L,h,Y,v);s.cells[sn(te,C)]=eo(k,Q)}}}}return s}function Ku(e){let l=1/0,o=1/0;for(const n of e.ranges)n.startCol<l&&(l=n.startCol),n.startRow<o&&(o=n.startRow);return isFinite(l)||(l=0),isFinite(o)||(o=0),{col:l,row:o}}function Gu(e,l,o){for(const n of e)if(l>=n.startCol&&l<=n.endCol&&o>=n.startRow&&o<=n.endRow)return!0;return!1}function Ml(e){if(e==null)return null;const l=String(e).trim();if(l==="")return null;const o=l.replace(/[, ]/g,"");if(o==="")return null;const n=Number(o);return Number.isFinite(n)?n:null}function qu(e,l){const o=new Map;for(const n of e.ranges)for(let a=n.startRow;a<=n.endRow;a++)for(let i=n.startCol;i<=n.endCol;i++){const r=l.getCellValue(i,a);r!==""&&o.set(r,(o.get(r)??0)+1)}return o}class Yu{constructor(){this.map=new Map}get(l){return this.map.get(l)}set(l,o){this.map.set(l,o)}invalidate(l){l?this.map.delete(l):this.map.clear()}}function Xu(e,l,o,n,a,i){switch(e.type){case"cellIs":{const r=n.getCellValue(l,o),c=Ml(r);switch(e.operator){case"equal":{const s=Ml(e.value);return c!==null&&s!==null?c===s:r===e.value}case"notEqual":{const s=Ml(e.value);return c!==null&&s!==null?c!==s:r!==e.value}case"greaterThan":{const s=Ml(e.value);return c===null||s===null?!1:c>s}case"greaterThanOrEqual":{const s=Ml(e.value);return c===null||s===null?!1:c>=s}case"lessThan":{const s=Ml(e.value);return c===null||s===null?!1:c<s}case"lessThanOrEqual":{const s=Ml(e.value);return c===null||s===null?!1:c<=s}case"between":{const s=Ml(e.value),m=Ml(e.value2??"");return c===null||s===null||m===null?!1:c>=Math.min(s,m)&&c<=Math.max(s,m)}case"notBetween":{const s=Ml(e.value),m=Ml(e.value2??"");return c===null||s===null||m===null?!1:c<Math.min(s,m)||c>Math.max(s,m)}}return!1}case"textContains":return n.getCellValue(l,o).toLowerCase().includes(e.value.toLowerCase());case"textNotContains":return!n.getCellValue(l,o).toLowerCase().includes(e.value.toLowerCase());case"blank":return n.getCellValue(l,o)==="";case"notBlank":return n.getCellValue(l,o)!=="";case"duplicate":{if(!i)return!1;const r=n.getCellValue(l,o);return r===""?!1:(i.get(r)??0)>1}case"unique":{if(!i)return!1;const r=n.getCellValue(l,o);return r===""?!1:(i.get(r)??0)===1}case"formula":try{const r=l-a.col,c=o-a.row,s=e.formula.trim().replace(/^=/,""),m=ju(s,r,c,n.colCount,n.rowCount);return nd(m,n.cells,n.colCount,n.rowCount)}catch{return!1}case"colorScale":case"dataBar":case"iconSet":case"topBottom":case"aboveBelowAverage":return!1}return!1}function ju(e,l,o,n,a){return vo(e,l,o,n,a,ht)}function Zu(e,l,o,n,a){if(!o||o.length===0)return null;const i=o.filter(s=>s.enabled&&Gu(s.ranges,e,l)).sort((s,m)=>s.priority-m.priority);if(i.length===0)return null;const r={};let c=!1;for(const s of i){const m=Ku(s);let v;(s.condition.type==="duplicate"||s.condition.type==="unique")&&(v=a==null?void 0:a.get(s.id),v||(v=qu(s,n),a==null||a.set(s.id,v)));let d=!1;try{d=Xu(s.condition,e,l,n,m,v)}catch{}if(!d)continue;c=!0;const C=s.format;if(C.backgroundColor!==void 0&&r.backgroundColor===void 0&&(r.backgroundColor=C.backgroundColor),C.color!==void 0&&r.color===void 0&&(r.color=C.color),C.fontWeight!==void 0&&r.fontWeight===void 0&&(r.fontWeight=C.fontWeight),C.fontStyle!==void 0&&r.fontStyle===void 0&&(r.fontStyle=C.fontStyle),C.underline!==void 0&&r.underline===void 0&&(r.underline=C.underline),C.strikethrough!==void 0&&r.strikethrough===void 0&&(r.strikethrough=C.strikethrough),s.stopIfTrue)break}return c?r:null}function Ju(){return"cf_"+Math.random().toString(36).slice(2,10)+Date.now().toString(36).slice(-4)}class Qu{constructor(l){if(l&&l.length>0){this.styles=l,this.index=new Map;for(let o=0;o<this.styles.length;o++){const n=this.stableKey(this.styles[o]);this.index.set(n,o)}}else this.styles=[{}],this.index=new Map,this.index.set(this.stableKey({}),0)}stableKey(l){const o=Object.keys(l).sort(),n={};for(const a of o)n[a]=l[a];return JSON.stringify(n)}get(l){const o=this.styles[l];return o?l===0?o:Object.freeze(o):{}}getId(l){if(!l||Object.keys(l).length===0)return 0;const o=this.stableKey(l),n=this.index.get(o);if(n!==void 0)return n;const a=this.styles.length,i=Object.freeze({...l});return this.styles.push(i),this.index.set(o,a),a}getStyles(){return[...this.styles]}setStyles(l){this.styles=l,this.index=new Map;for(let o=0;o<this.styles.length;o++){const n=this.stableKey(this.styles[o]);this.index.set(n,o)}}compactStyles(l){const o=new Set;o.add(0);for(const r in l){const c=l[r].styleId??0;o.add(c)}const n=new Map,a=[{}];n.set(0,0);const i=Array.from(o).sort((r,c)=>r-c);for(const r of i)if(r!==0&&r<this.styles.length){const c=a.length;n.set(r,c),a.push(this.styles[r])}for(const r in l){const c=l[r],s=c.styleId??0,m=n.get(s);m!==void 0&&m!==s&&(c.styleId=m)}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 ef(e,l){if(!e)return null;const o=e.styleId;return o===void 0||o===0?null:l[o]??null}function fr(e){const l=new Qu,o={};for(const[n,a]of Object.entries(e)){const i={value:a.value};a.styleId!==void 0&&a.styleId>0&&(i.styleId=a.styleId),a.style&&Object.keys(a.style).length>0&&(i.styleId=l.getId(a.style)),i.styleId===0&&delete i.styleId,o[n]=i}return{cells:o,styles:l.getStyles()}}function tf(e){const l={};for(const[o,n]of Object.entries(e)){const a={value:n.value};n.styleId!==void 0&&n.styleId>0&&(a.styleId=n.styleId),l[o]=a}return l}class lf{constructor(l){if(l&&l.length>0){this.borders=l,this.index=new Map;for(let o=0;o<this.borders.length;o++){const n=this.stableKey(this.borders[o]);this.index.set(n,o)}}else this.borders=[{}],this.index=new Map,this.index.set(this.stableKey({}),0)}stableKey(l){const o=["top","right","bottom","left"],n={};for(const a of o){const i=l[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),n[a]=r}}return JSON.stringify(n)}get(l){const o=this.borders[l];return o?l===0?o:Object.freeze(o):{}}getId(l){if(!l||this.isEmptyBorder(l))return 0;const o=this.stableKey(l),n=this.index.get(o);if(n!==void 0)return n;const a=this.borders.length,i=Object.freeze(this.deepCloneBorder(l));return this.borders.push(i),this.index.set(o,a),a}isEmptyBorder(l){return!l.top&&!l.right&&!l.bottom&&!l.left}deepCloneBorder(l){const o={};return l.top&&(o.top={...l.top}),l.right&&(o.right={...l.right}),l.bottom&&(o.bottom={...l.bottom}),l.left&&(o.left={...l.left}),o}getBorders(){return[...this.borders]}setBorders(l){this.borders=l,this.index=new Map;for(let o=0;o<this.borders.length;o++){const n=this.stableKey(this.borders[o]);this.index.set(n,o)}}compactBorders(l){const o=new Set;o.add(0);for(const r of l){const c=r.borderId??0;o.add(c)}const n=new Map,a=[{}];n.set(0,0);const i=Array.from(o).sort((r,c)=>r-c);for(const r of i)if(r!==0&&r<this.borders.length){const c=a.length;n.set(r,c),a.push(this.borders[r])}for(const r of l){const c=r.borderId??0,s=n.get(c);s!==void 0&&s!==c&&(r.borderId=s)}this.borders=a,this.index=new Map;for(let r=0;r<this.borders.length;r++){const c=this.stableKey(this.borders[r]);this.index.set(c,r)}return a}}function nf(e,l,o,n){if(!e)return;const a=e.styleId??0,i=o[a];if(!i)return;const r=i.borderId??0;if(r===0)return;const c=n.get(r);if(c)return c[l]}function of(e,l,o,n,a,i){const r=n[e.styleId??0]??{},c=r.borderId??0,s=c>0?a.get(c):{},m={top:s.top?{...s.top}:void 0,right:s.right?{...s.right}:void 0,bottom:s.bottom?{...s.bottom}:void 0,left:s.left?{...s.left}:void 0};o?m[l]={...o}:m[l]=void 0;const v=a.getId(m),d={...r};v===0?delete d.borderId:d.borderId=v,delete d.borderTopWidth,delete d.borderBottomWidth,delete d.borderLeftWidth,delete d.borderRightWidth,delete d.borderColor,Object.keys(d).length===0?e.styleId=0:e.styleId=i(d)}function mr(e){const l=new lf,o=[];for(const n of e){if(!(n.borderTopWidth!==void 0||n.borderBottomWidth!==void 0||n.borderLeftWidth!==void 0||n.borderRightWidth!==void 0)){o.push(n);continue}const i=typeof n.borderColor=="string"?n.borderColor:void 0,r={};n.borderTopWidth!==void 0&&n.borderTopWidth>0&&(r.top={width:n.borderTopWidth,color:i}),n.borderBottomWidth!==void 0&&n.borderBottomWidth>0&&(r.bottom={width:n.borderBottomWidth,color:i}),n.borderLeftWidth!==void 0&&n.borderLeftWidth>0&&(r.left={width:n.borderLeftWidth,color:i}),n.borderRightWidth!==void 0&&n.borderRightWidth>0&&(r.right={width:n.borderRightWidth,color:i});const c=l.getId(r),s={...n};delete s.borderTopWidth,delete s.borderBottomWidth,delete s.borderLeftWidth,delete s.borderRightWidth,delete s.borderColor,c>0?s.borderId=c:delete s.borderId,o.push(s)}return{styles:o,borders:l.getBorders()}}function rf(e,l){const o=t.reactive({rowCount:e.rowCount??l.rowCount,colCount:e.colCount??l.colCount,width:e.width,height:e.height,theme:e.theme??l.theme,locale:e.locale??l.locale});t.watchEffect(()=>{o.rowCount=e.rowCount??l.rowCount,o.colCount=e.colCount??l.colCount,o.width=e.width,o.height=e.height,o.theme=e.theme??l.theme,o.locale=e.locale??l.locale});const n=t.computed(()=>o.locale==="zh-CN"?"zh-CN":"en-US"),a=o.colCount,i=o.rowCount,r=t.reactive({colCount:a,rowCount:i}),c=8,s=32,m=t.reactive({}),v=t.reactive([{}]),d=t.reactive([{}]);let C=new Map;C.set("{}",0);let y=new Map;y.set("{}",0);const h=t.reactive([]),L=new Yu;function oe(f){const S=Object.keys(f).sort(),B={};for(const _ of S)B[_]=f[_];return JSON.stringify(B)}function te(f){const S=["top","right","bottom","left"],B={};for(const _ of S){const K=f[_];if(K&&(K.width!==void 0||K.color!==void 0||K.style!==void 0)){const be={};K.width!==void 0&&(be.width=K.width),K.color!==void 0&&(be.color=K.color),K.style!==void 0&&(be.style=K.style),B[_]=be}}return JSON.stringify(B)}function Y(f){if(!f||Object.keys(f).length===0)return 0;const S=oe(f),B=C.get(S);if(B!==void 0)return B;const _=v.length;return v.push(Object.freeze({...f})),C.set(S,_),_}function k(f){return ef(f,v)}function Q(){C=new Map;for(let f=0;f<v.length;f++)C.set(oe(v[f]),f)}function le(f){v.splice(0,v.length,...f),Q()}function se(f){if(!f||!f.top&&!f.right&&!f.bottom&&!f.left)return 0;const S=te(f),B=y.get(S);if(B!==void 0)return B;const _=d.length;return d.push(Object.freeze({top:f.top?Object.freeze({...f.top}):void 0,right:f.right?Object.freeze({...f.right}):void 0,bottom:f.bottom?Object.freeze({...f.bottom}):void 0,left:f.left?Object.freeze({...f.left}):void 0})),y.set(S,_),_}function Ke(f){return d[f]??{}}function Oe(){y=new Map;for(let f=0;f<d.length;f++)y.set(te(d[f]),f)}function Ge(f){d.splice(0,d.length,...f),Oe()}function Te(f,S){return nf(f,S,v,{get:B=>d[B]??{}})}function qe(f,S){const B=bt(f,S);return B?B.anchor:null}function tt(f,S,B,_){const K=bt(f,S),be=bt(B,_);return!K||!be?!1:K.anchor===be.anchor}const ye=t.reactive({}),ie=new od,he=t.ref(null),Ae=t.ref("cell"),dt=t.ref({col:0,row:0}),ue=t.ref(null),ve=t.ref(""),p=t.ref(new Array(r.colCount).fill(100)),A=t.ref(new Array(r.rowCount).fill(void 0)),$=t.ref(0),ee=t.ref(0),U=t.reactive({rows:0,cols:0}),O=t.ref(null),x=t.shallowRef({active:!1,sourceRange:null,targetRange:null,direction:null,preview:!1}),X=new Map;let Le=null;function re(f,S,B,_){const K=`${_} ${B} ${S}px ${f}`,be=X.get(K);if(be)return be;if(!Le){if(typeof document>"u")return{ascent:S*.88,descent:S*.28};Le=document.createElement("canvas")}const Me=Le.getContext("2d");if(!Me)return{ascent:S*.88,descent:S*.28};Me.font=K;const He=Me.measureText(" "),Ue=He.fontBoundingBoxAscent,Ye=He.fontBoundingBoxDescent;if(typeof Ue=="number"&&typeof Ye=="number"&&Ue>0&&Ye>0){const Tl={ascent:Ue,descent:Ye};return X.set(K,Tl),Tl}const Qe=["M","中","y","Ä","0"];let gt=0,ct=0;for(const Tl of Qe){const Ln=Me.measureText(Tl),Zt=Ln.actualBoundingBoxAscent||0,kl=Ln.actualBoundingBoxDescent||0;Zt>gt&&(gt=Zt),kl>ct&&(ct=kl)}const kt=Math.max(gt,S*.88),Kt=Math.max(ct,S*.28),Mn={ascent:kt,descent:Kt};return X.set(K,Mn),Mn}const V=re(yn,Ul,"normal","normal"),G=V.ascent+V.descent,xe=Math.max(0,(24-G)/2);let $e=(f,S)=>`${f},${S}`,bt=()=>null,ge=()=>Ul,pe=t.computed(()=>[0]),it=()=>24,It=(f,S,B,_)=>({startCol:Math.min(f,B),startRow:Math.min(S,_),endCol:Math.max(f,B),endRow:Math.max(S,_)});function Je(f,S){const B=k(m[$e(f,S)]),_=ge(f,S),K=typeof(B==null?void 0:B.fontFamily)=="string"&&B.fontFamily?B.fontFamily:yn,be=(B==null?void 0:B.fontWeight)==="bold"?"bold":"normal",Me=(B==null?void 0:B.fontStyle)==="italic"?"italic":"normal";return re(K,_,be,Me)}function E(f,S,B,_){if(!S)return[""];const K=S.split(`
|
|
2
|
+
`),be=[];for(const Me of K)if(!_||B<=0)be.push(Me);else{let He="";for(let Ue=0;Ue<Me.length;Ue++){const Ye=Me[Ue],Qe=He+Ye;f.measureText(Qe).width>B&&He?(be.push(He),He=Ye):He=Qe}be.push(He)}return be}function ne(f,S){const B=k(m[$e(f,S)]);return typeof(B==null?void 0:B.fontSize)=="number"&&B.fontSize>0?B.fontSize:Ul}ge=ne;const Et=t.computed(()=>{const f=[0];for(let S=0;S<r.colCount;S++)f.push(f[S]+p.value[S]);return f});pe=Et;const Dt={w:800,h:600};let Ot=()=>{};const de=t.computed(()=>{const f=new Set;for(const S in m){const B=S.indexOf(",");if(B<0)continue;const _=parseInt(S.substring(B+1),10),K=m[S];K&&(K.value!==""||K.styleId!==void 0)&&f.add(_)}for(let S=0;S<A.value.length;S++)A.value[S]!==void 0&&f.add(S);for(const S in ye){const B=S.indexOf(",");if(B<0)continue;const _=parseInt(S.substring(B+1),10);f.add(_)}return f});function g(f){if(O.value&&Mt.value.has(f))return 0;const S=A.value[f];if(S!=null&&S>0)return S;if(!de.value.has(f))return 24;let B,_,K=1;const be=Le?Le.getContext("2d"):null,Me=re(yn,Ul,"normal","normal");B=Me.ascent,_=Me.descent;for(let Qe=0;Qe<r.colCount;Qe++){const gt=ne(Qe,f),ct=k(m[$e(Qe,f)]),kt=typeof(ct==null?void 0:ct.fontFamily)=="string"&&ct.fontFamily?ct.fontFamily:yn,Kt=(ct==null?void 0:ct.fontWeight)==="bold"?"bold":"normal",Mn=(ct==null?void 0:ct.fontStyle)==="italic"?"italic":"normal",Tl=re(kt,gt,Kt,Mn);Tl.ascent>B&&(B=Tl.ascent),Tl.descent>_&&(_=Tl.descent);const Ln=typeof(ct==null?void 0:ct.numberFormat)=="string"?ct.numberFormat:"",Zt=Bl(Qe,f),kl=Rl(Zt,Ln,n.value);if(kl){const Do=(ct==null?void 0:ct.wrap)==="wrap";let u;if(Do&&be){be.font=`${Mn} ${Kt} ${gt}px ${kt}`;const b=bt(Qe,f);let T;b&&Qe===b.range.startCol&&f===b.range.startRow?T=pe.value[b.range.endCol+1]-pe.value[Qe]:T=p.value[Qe],u=E(be,kl,Math.max(0,T-10),!0).length,u>K&&(K=u)}else u=kl.split(`
|
|
3
|
+
`).length,u>K&&(K=u)}}const He=B+_,Ue=xe*2+K*He;return Math.min(500,Math.max(24,Math.round(Ue)))}it=g;function M(f){return A.value[f]===void 0}const Vt={getValue:(f,S)=>Bl(f,S),getFormat:(f,S)=>{var B;return(B=k(m[$e(f,S)]))==null?void 0:B.numberFormat}},Mt=t.computed(()=>{const f=new Set,S=O.value;if(!S)return f;const{range:B}=S;for(let _=B.startRow+1;_<=B.endRow;_++)el(_)||f.add(_);return f});function el(f){return bd(O.value,f,Vt,n.value)}function Ut(){return Mt.value}function Cl(f){return O.value?Mt.value.has(f):!1}function Xl(){return O.value?r.rowCount-Mt.value.size:r.rowCount}function dn(f){let S=-1;for(let B=0;B<r.rowCount;B++)if(!Cl(B)&&(S++,S===f))return B;return-1}function I(f){if(Cl(f))return-1;let S=0;for(let B=0;B<f;B++)Cl(B)||S++;return S}function F(){return O.value}function z(f,S=!1){var B,_;O.value=f,!S&&(Ot($.value,ee.value),(B=me.scheduleRender)==null||B.call(me),(_=me.emitModelData)==null||_.call(me))}function we(f){var B,_;const S={range:{startCol:Math.min(f.startCol,f.endCol),endCol:Math.max(f.startCol,f.endCol),startRow:Math.min(f.startRow,f.endRow),endRow:Math.max(f.startRow,f.endRow)},columns:{}};O.value=S,Ot($.value,ee.value),(B=me.scheduleRender)==null||B.call(me),(_=me.emitModelData)==null||_.call(me)}function Ee(){var f,S;O.value&&(O.value=null,Ot($.value,ee.value),(f=me.scheduleRender)==null||f.call(me),(S=me.emitModelData)==null||S.call(me))}function Fe(f){var _,K;if(!O.value)return;const{[f]:S,...B}=O.value.columns;O.value={...O.value,columns:B},(_=me.scheduleRender)==null||_.call(me),(K=me.emitModelData)==null||K.call(me)}function Ve(f,S){var B,_;if(O.value){if(S)O.value={...O.value,columns:{...O.value.columns,[f]:S}};else{const{[f]:K,...be}=O.value.columns;O.value={...O.value,columns:be}}(B=me.scheduleRender)==null||B.call(me),(_=me.emitModelData)==null||_.call(me)}}function ke(f){const S=O.value;return S?Cd(S,f,Vt,n.value):{values:[],hasBlank:!1}}function ce(f,S){const B=r.colCount,_=r.rowCount,K=(gt,ct)=>{const kt=m[Ce(gt,ct)];return!!kt&&(kt.value!==""||kt.styleId!==void 0)};if(!K(f,S))return null;const be=gt=>{for(let ct=0;ct<B;ct++)if(K(ct,gt))return!0;return!1},Me=(gt,ct,kt)=>{for(let Kt=ct;Kt<=kt;Kt++)if(K(gt,Kt))return!0;return!1};let He=S;for(;He>0&&be(He-1);)He--;let Ue=S;for(;Ue<_-1&&be(Ue+1);)Ue++;let Ye=f;for(;Ye>0&&Me(Ye-1,He,Ue);)Ye--;let Qe=f;for(;Qe<B-1&&Me(Qe+1,He,Ue);)Qe++;return{startCol:Ye,startRow:He,endCol:Qe,endRow:Ue}}function je(){const f=he.value;if(!!f&&f.startRow!==f.endRow)return{startCol:Math.min(f.startCol,f.endCol),endCol:Math.max(f.startCol,f.endCol),startRow:Math.min(f.startRow,f.endRow),endRow:Math.max(f.startRow,f.endRow)};const B=dt.value,_=f?f.startCol:B.col,K=f?f.startRow:B.row,be=(Ye,Qe)=>{const gt=m[Ce(Ye,Qe)];return!!gt&&(gt.value!==""||gt.styleId!==void 0)};let Me,He;f?(Me=Math.min(f.startCol,f.endCol),He=Math.max(f.startCol,f.endCol)):(Me=B.col,He=B.col);let Ue=K;for(;Ue<r.rowCount-1;){const Ye=Ue+1;let Qe=!1,gt=!1;for(let ct=Me;ct<=He;ct++){be(ct,Ye)&&(Qe=!0);const kt=zt(ct,Ye);kt&&(kt.range.startCol!==kt.range.endCol||kt.range.startRow!==kt.range.endRow)&&(gt=!0)}if(gt||!Qe)break;Ue++}return!be(_,K)&&Ue===K?j():{startCol:Me,endCol:He,startRow:K,endRow:Ue}}function We(){if(O.value){Ee();return}const f=je();f&&we(f)}function fe(f){const S=O.value;return S?f>=S.range.startCol&&f<=S.range.endCol:!1}function ot(){return O.value?{...O.value.range}:null}function vt(){return!!O.value}function R(f){const S=O.value;return S?nr(S.columns[f]):!1}function j(){let f=1/0,S=1/0,B=-1,_=-1;for(const K in m){const be=K.indexOf(",");if(be<0)continue;const Me=parseInt(K.substring(0,be),10),He=parseInt(K.substring(be+1),10),Ue=m[K];Ue&&(Ue.value!==""||Ue.styleId!==void 0)&&(Me<f&&(f=Me),He<S&&(S=He),Me>B&&(B=Me),He>_&&(_=He))}return B<0?null:{startCol:f,startRow:S,endCol:B,endRow:_}}const Z=t.computed(()=>{const f=[0];for(let S=0;S<r.rowCount;S++)f.push(f[S]+it(S));return f}),Se=t.computed(()=>Et.value[r.colCount]),Re=t.computed(()=>Z.value[r.rowCount]);function Ce(f,S){return`${f},${S}`}$e=Ce;function Ne(f){Reflect.deleteProperty(m,f)}function lt(f,S){Ae.value="cell";const B=bt(f,S);B?(dt.value={col:B.range.startCol,row:B.range.startRow},he.value={...B.range}):(dt.value={col:f,row:S},he.value={startCol:f,startRow:S,endCol:f,endRow:S})}function Ct(f,S,B,_,K="cell"){const be=bt(f,S);if(dt.value=be?{col:be.range.startCol,row:be.range.startRow}:{col:f,row:S},Ae.value=K,K==="row"||K==="col"){const Me=Math.min(f,B),He=Math.max(f,B),Ue=Math.min(S,_),Ye=Math.max(S,_);he.value={startCol:Me,startRow:Ue,endCol:He,endRow:Ye}}else he.value=It(f,S,B,_)}function Ht(){Ct(0,0,r.colCount-1,r.rowCount-1,"all")}function tl(f,S){const B=he.value;return B?(Ae.value==="cell"||Ae.value==="all",f>=B.startCol&&f<=B.endCol&&S>=B.startRow&&S<=B.endRow):!1}function ol(f,S){return tl(f,S)}function zt(f,S){for(const B in ye){const _=ye[B];if(_&&f>=_.startCol&&f<=_.endCol&&S>=_.startRow&&S<=_.endRow)return{range:_,anchor:B}}return null}bt=zt;function Xt(f,S){return ye[Ce(f,S)]!==void 0}function ll(f,S){const B=bt(f,S);if(B&&f===B.range.startCol&&S===B.range.startRow){const _=Et.value[B.range.endCol+1]-Et.value[f],K=Z.value[B.range.endRow+1]-Z.value[S];return{w:_,h:K}}return{w:p.value[f],h:it(S)}}function rl(f,S,B,_){let K=Math.min(f,B),be=Math.max(f,B),Me=Math.min(S,_),He=Math.max(S,_),Ue=!0;for(;Ue;){Ue=!1;for(const Ye in ye){const Qe=ye[Ye];if(!Qe)continue;Qe.startCol<=be&&Qe.endCol>=K&&Qe.startRow<=He&&Qe.endRow>=Me&&(Qe.startCol<K&&(K=Qe.startCol,Ue=!0),Qe.endCol>be&&(be=Qe.endCol,Ue=!0),Qe.startRow<Me&&(Me=Qe.startRow,Ue=!0),Qe.endRow>He&&(He=Qe.endRow,Ue=!0))}}return{startCol:K,startRow:Me,endCol:be,endRow:He}}It=rl;function jl(f,S){var B;return((B=m[Ce(f,S)])==null?void 0:B.value)??""}function Bl(f,S){return $n(),tr(f,S,m,r.colCount,r.rowCount)}function xl(f,S,B){var He,Ue;f>=0&&S>=0&&fn(f,S);const _=Ce(f,S);if($n(),L.invalidate(),B===""||B==null){ie.clear(_);const Ye=(He=m[_])==null?void 0:He.styleId;Ye!==void 0&&Ye>0?m[_]={value:"",styleId:Ye}:Ne(_),ie.markDirty(_);return}const K=String(B);if(!K.startsWith("=")){const Ye=k(m[_]),Qe=typeof(Ye==null?void 0:Ye.numberFormat)=="string"?Ye.numberFormat:"";if(bl(Qe)){const gt=Dn(K,n.value);if(gt){const kt={...Ye??{},numberFormat:gt.format};m[_]={value:String(gt.serial),styleId:Y(kt)},ie.clear(_),ie.markDirty(_);return}const ct=aa(K,n.value);if(ct){const kt={...Ye??{},numberFormat:ct.format};m[_]={value:String(ct.num),styleId:Y(kt)},ie.clear(_),ie.markDirty(_);return}}}const be=(Ue=m[_])==null?void 0:Ue.styleId,Me={value:K};be!==void 0&&be>0&&(Me.styleId=be),m[_]=Me,K.startsWith("=")?ie.set(_,Zn(K.slice(1),r.colCount,r.rowCount)):ie.clear(_),ie.markDirty(_)}function Hl(f,S,B,_){for(let K=f;K<=S;K++)for(let be=B;be<=_;be++){const Me=Ce(K,be);ie.clear(Me),Ne(Me),ie.markDirty(Me)}L.invalidate()}function En(){return{cells:m,colCount:r.colCount,rowCount:r.rowCount,locale:n.value,getCellValue:(f,S)=>Bl(f,S)}}function Sn(f,S){return h.length===0?null:Zu(f,S,h,En(),L)}function In(f){var B,_,K;(B=me.saveUndo)==null||B.call(me);const S={id:f.id||Ju(),condition:f.condition,format:f.format,ranges:f.ranges,priority:f.priority,stopIfTrue:f.stopIfTrue,enabled:f.enabled!==!1};h.push(S),L.invalidate(),(_=me.scheduleRender)==null||_.call(me),(K=me.emitModelData)==null||K.call(me)}function An(f,S){var _,K,be;(_=me.saveUndo)==null||_.call(me);const B=h.findIndex(Me=>Me.id===f);B<0||(h[B]={...h[B],...S,id:f},L.invalidate(),(K=me.scheduleRender)==null||K.call(me),(be=me.emitModelData)==null||be.call(me))}function al(f){var B,_,K;(B=me.saveUndo)==null||B.call(me);const S=h.findIndex(be=>be.id===f);S<0||(h.splice(S,1),L.invalidate(),(_=me.scheduleRender)==null||_.call(me),(K=me.emitModelData)==null||K.call(me))}function Zl(f,S){var Ue,Ye,Qe;(Ue=me.saveUndo)==null||Ue.call(me);const B=[...h].sort((gt,ct)=>gt.priority-ct.priority),_=B.findIndex(gt=>gt.id===f);if(_<0)return;const K=S==="up"?_-1:_+1;if(K<0||K>=B.length)return;const be=B[_],Me=B[K],He=be.priority;be.priority=Me.priority,Me.priority=He,L.invalidate(),(Ye=me.scheduleRender)==null||Ye.call(me),(Qe=me.emitModelData)==null||Qe.call(me)}function Bt(){L.invalidate()}function xt(f){var S,B,_;if((S=me.saveUndo)==null||S.call(me),f==="sheet")h.splice(0,h.length);else{const K=me.selection.value;if(!K)return;for(let be=h.length-1;be>=0;be--){const Me=h[be];Me.ranges=Me.ranges.filter(He=>!(He.startCol<=K.endCol&&He.endCol>=K.startCol&&He.startRow<=K.endRow&&He.endRow>=K.startRow)),Me.ranges.length===0&&h.splice(be,1)}}L.invalidate(),(B=me.scheduleRender)==null||B.call(me),(_=me.emitModelData)==null||_.call(me)}let jt=()=>{};function Pn(f){ue.value||(ue.value={...dt.value},f!==void 0?ve.value=f:ve.value||(ve.value=jl(dt.value.col,dt.value.row)))}function to(){ue.value&&(jt(),xl(ue.value.col,ue.value.row,ve.value),ue.value=null,ve.value="")}function lo(){ue.value=null,ve.value=""}function ul(f,S){const B=dt.value;let _=Math.max(0,B.col+f),K=Math.max(0,B.row+S);(_>=r.colCount||K>=r.rowCount)&&fn(_,K);const be=bt(B.col,B.row),Me=bt(_,K);be&&Me&&be.anchor===Me.anchor&&(f>0?_=be.range.endCol+1:f<0&&(_=be.range.startCol-1),S>0?K=be.range.endRow+1:S<0&&(K=be.range.startRow-1),(_>=r.colCount||K>=r.rowCount)&&fn(_,K)),_=Math.max(0,Math.min(r.colCount-1,_)),K=Math.max(0,Math.min(r.rowCount-1,K)),lt(_,K)}function Ll(f,S){Hn(S,f)}function yl(f){const S=Et.value;if(f<0||f>=S[r.colCount])return-1;let B=0,_=r.colCount-1;for(;B<_;){const K=B+_+1>>1;S[K]<=f?B=K:_=K-1}return B}function wl(f){const S=Z.value;if(f<0||f>=S[r.rowCount])return-1;let B=0,_=r.rowCount-1;for(;B<_;){const K=B+_+1>>1;S[K]<=f?B=K:_=K-1}return B}function Jl(f,S){var K,be;const B=Math.max(0,Math.min(Math.floor(f),r.rowCount)),_=Math.max(0,Math.min(Math.floor(S),r.colCount));U.rows=B,U.cols=_,(K=me.scheduleRender)==null||K.call(me),(be=me.emitModelData)==null||be.call(me)}function vl(){var f,S;U.rows=0,U.cols=0,(f=me.scheduleRender)==null||f.call(me),(S=me.emitModelData)==null||S.call(me)}function un(){return{rows:U.rows,cols:U.cols}}function Rn(){let f=0,S=0;if(U.cols>0){const B=p.value,_=Math.min(U.cols,B.length);for(let K=0;K<_;K++)f+=B[K]}if(U.rows>0)for(let B=0;B<U.rows;B++)S+=it(B);return{frozenRowsHeight:S,frozenColumnsWidth:f}}function no(){const{frozenColumnsWidth:f,frozenRowsHeight:S}=Rn(),B=52+f,_=24+S,K=Math.max(0,Dt.w-52-11-f),be=Math.max(0,Dt.h-24-11-S),Me=[];return S>0&&f>0&&Me.push({kind:"corner",x:52,y:24,width:f,height:S,scrollLeft:0,scrollTop:0}),S>0&&Me.push({kind:"rows",x:B,y:24,width:K,height:S,scrollLeft:$.value,scrollTop:0}),f>0&&Me.push({kind:"columns",x:52,y:_,width:f,height:be,scrollLeft:0,scrollTop:ee.value}),Me.push({kind:"body",x:B,y:_,width:K,height:be,scrollLeft:$.value,scrollTop:ee.value}),Me}function Un(f,S){const B=Et.value,_=Z.value,K=p.value,be=B[S]??0,Me=_[f]??0,He=bt(S,f),Ue=He?(B[He.range.endCol+1]??be)-be:K[S]??0,Ye=He?(_[He.range.endRow+1]??Me)-Me:it(f),Qe=S<U.cols,gt=f<U.rows,ct=Qe?52+be:52+be-$.value,kt=gt?24+Me:24+Me-ee.value;return{x:ct,y:kt,width:Ue,height:Ye}}function xo(f,S){const{frozenColumnsWidth:B,frozenRowsHeight:_}=Rn();if(f<52||S<24)return null;const K=B>0&&f<52+B,be=_>0&&S<24+_,Me=K?f-52:f-52+$.value,He=be?S-24:S-24+ee.value,Ue=yl(Me),Ye=wl(He);return Ue<0||Ye<0?null:{col:Ue,row:Ye}}function Kn(f,S){return f<U.rows||S<U.cols}function Hn(f,S){if(Kn(f,S))return;const{frozenColumnsWidth:B,frozenRowsHeight:_}=Rn(),K=Math.max(0,Dt.w-52-11-B),be=Math.max(0,Dt.h-24-11-_),Me=Et.value,He=Z.value,Ue=(Me[S]??0)-B,Ye=(He[f]??0)-_,Qe=bt(S,f),gt=Qe?(Me[Qe.range.endCol+1]??0)-(Me[S]??0):p.value[S]??0,ct=Qe?(He[Qe.range.endRow+1]??0)-(He[f]??0):it(f);let kt=$.value,Kt=ee.value;Ue<kt?kt=Ue:Ue+gt>kt+K&&(kt=Ue+gt-K),Ye<Kt?Kt=Ye:Ye+ct>Kt+be&&(Kt=Ye+ct-be),kt=Math.max(0,kt),Kt=Math.max(0,Kt),Ot(kt,Kt)}function fn(f,S){var be;const B=f+1,_=S+1;let K=!1;if(B>=r.colCount){const Me=Math.max(r.colCount+c,B),He=Me-r.colCount,Ue=p.value;for(let Ye=0;Ye<He;Ye++)Ue.push(100);r.colCount=Me,K=!0}if(_>=r.rowCount){const Me=Math.max(r.rowCount+s,_),He=Me-r.rowCount,Ue=A.value;for(let Ye=0;Ye<He;Ye++)Ue.push(void 0);r.rowCount=Me,K=!0}K&&((be=me.scheduleRender)==null||be.call(me))}function oo(){return r.colCount!==a||r.rowCount!==i}function To(f,S,B){var be,Me,He;if(!Ro(f,S,ye))return;(be=me.saveUndo)==null||be.call(me),fn(S.endCol,S.endRow);const _=Uu(f,S,{cells:m},B,n.value,r.colCount,r.rowCount,ht);$n();for(const[Ue,Ye]of Object.entries(_.cells)){const Qe=Ye.value;Qe===""&&(Ye.styleId===void 0||Ye.styleId===0)?(ie.clear(Ue),Ne(Ue)):(m[Ue]={value:Qe,...Ye.styleId!==void 0&&Ye.styleId>0?{styleId:Ye.styleId}:{}},Qe.startsWith("=")?ie.set(Ue,Zn(Qe.slice(1),r.colCount,r.rowCount)):ie.clear(Ue)),ie.markDirty(Ue)}const K={startCol:Math.min(f.startCol,S.startCol),startRow:Math.min(f.startRow,S.startRow),endCol:Math.max(f.endCol,S.endCol),endRow:Math.max(f.endRow,S.endRow)};Ct(K.startCol,K.startRow,K.endCol,K.endRow),(Me=me.scheduleRender)==null||Me.call(me),(He=me.emitModelData)==null||He.call(me)}function No(f,S){var be;let B=!1;const _=Math.max(1,Math.floor(f)),K=Math.max(1,Math.floor(S));if(_!==r.colCount){if(_>r.colCount){const Me=p.value;for(let He=r.colCount;He<_;He++)Me.push(100)}else p.value=p.value.slice(0,_);r.colCount=_,B=!0}if(K!==r.rowCount){if(K>r.rowCount){const Me=A.value;for(let He=r.rowCount;He<K;He++)Me.push(void 0)}else A.value=A.value.slice(0,K);r.rowCount=K,B=!0}B&&((be=me.scheduleRender)==null||be.call(me))}const me={props:o,locale:n,get colCount(){return r.colCount},get rowCount(){return r.rowCount},ensureCapacity:fn,hasDynamicDims:oo,setDims:No,cells:m,styles:v,borders:d,merges:ye,formulaDeps:ie,selection:he,activeCell:dt,editingCell:ue,editValue:ve,colWidths:p,rowHeights:A,scrollX:$,scrollY:ee,freeze:U,setFreeze:Jl,clearFreeze:vl,getFreeze:un,getFrozenMetrics:Rn,filter:O,getFilter:F,setFilter:z,enableFilter:we,clearFilter:Ee,clearFilterColumn:Fe,setFilterColumn:Ve,getColumnCandidates:ke,getDataRange:j,getCurrentRegion:ce,detectFilterRange:je,toggleAutoFilter:We,isColumnInFilterRange:fe,getFilterRange:ot,isFilterEnabled:vt,isFilterColumnActive:R,isRowHidden:Cl,getFilteredOutRows:Ut,getVisibleRowCount:Xl,getVisibleRowAt:dn,getVisibleRowIndex:I,getViewportRegions:no,cellToScreenRect:Un,screenToCell:xo,isCellFrozen:Kn,scrollCellIntoView:Hn,BASE_CELL_VPAD:xe,fontMetricsCache:X,fontMetricsCanvas:Le,measureFontMetrics:re,_getFontMetricsForCell:Je,getWrappedLines:E,cellFontSize:ne,colPositions:Et,getRowHeight:g,_isAutoRow:M,rowPositions:Z,totalWidth:Se,totalHeight:Re,selectCell:lt,selectRange:Ct,selectAll:Ht,isSelected:tl,isCellSelected:ol,selectionMode:Ae,cellKey:Ce,delCell:Ne,findMerge:zt,_isMergeAnchor:Xt,_mergedSpan:ll,expandSelectionForMerges:rl,getCellRaw:jl,getCellValue:Bl,setCellValue:xl,clearCellsInRange:Hl,startEdit:Pn,commitEdit:to,cancelEdit:lo,moveActive:ul,ensureVisible:Ll,hitCol:yl,hitRow:wl,registerStyle:Y,resolveStyle:k,rebuildStyleIndex:Q,syncStyles:le,registerBorder:se,resolveBorder:Ke,rebuildBorderIndex:Oe,syncBorders:Ge,getCellBorderSide:Te,getMergeOwner:qe,isSameMergeInternal:tt,viewSize:Dt,findHighlight:(f,S)=>null,autoFillState:x,applyAutoFill:To,conditionalFormats:h,resolveConditionalFormat:Sn,addConditionalFormatRule:In,updateConditionalFormatRule:An,removeConditionalFormatRule:al,moveConditionalFormatRule:Zl,clearConditionalFormats:xt,invalidateConditionalFormatCache:Bt};return jt=()=>{var f;return(f=me.saveUndo)==null?void 0:f.call(me)},Ot=(f,S)=>{var B;return(B=me.clampScroll)==null?void 0:B.call(me,f,S)},me}function af(e,l){const o=t.ref([]),n=t.ref([]);function a(R){return tf(R)}function i(){return l.saveSheet(),{sheets:l.sheets.value.map(R=>({id:R.id,name:R.name,cells:a(R.cells),styles:[...R.styles],borders:R.borders?[...R.borders]:[{}],merges:R.merges?{...R.merges}:{},selection:R.selection?{...R.selection}:null,activeCell:R.activeCell?{...R.activeCell}:{col:0,row:0},scrollX:R.scrollX,scrollY:R.scrollY,colWidths:[...R.colWidths],rowHeights:[...R.rowHeights],colCount:R.colCount,rowCount:R.rowCount,freeze:{...R.freeze},filter:R.filter?JSON.parse(JSON.stringify(R.filter)):null,conditionalFormats:R.conditionalFormats?R.conditionalFormats.map(j=>({...j,ranges:j.ranges.map(Z=>({...Z}))})):[]})),styles:[...e.styles],activeSheetIndex:l.activeSheetIndex.value}}function r(R){const j=l.sheets.value;l.sheets.value=R.sheets.map((Z,Se)=>{var Ce;const Re=((Ce=j[Se])==null?void 0:Ce.freeze)??{rows:0,cols:0};return{...Z,cells:a(Z.cells),styles:[...Z.styles],borders:Z.borders?[...Z.borders]:[{}],freeze:{rows:Re.rows,cols:Re.cols}}}),l.loadSheet(Math.max(0,Math.min(R.activeSheetIndex,l.sheets.value.length-1))),e.formulaDeps.rebuild(e.cells,e.colCount,e.rowCount)}function c(){const R=i(),j=o.value[o.value.length-1];j&&JSON.stringify(j)===JSON.stringify(R)||(o.value.push(R),n.value=[],o.value.length>50&&o.value.shift())}e.saveUndo=c;function s(){var R,j;o.value.length&&(n.value.push(i()),r(o.value.pop()),(R=e.invalidateConditionalFormatCache)==null||R.call(e),(j=e.scheduleRender)==null||j.call(e),t.nextTick(()=>{var Z;return(Z=e.emitModelData)==null?void 0:Z.call(e)}))}function m(){var R,j;n.value.length&&(o.value.push(i()),r(n.value.pop()),(R=e.invalidateConditionalFormatCache)==null||R.call(e),(j=e.scheduleRender)==null||j.call(e),t.nextTick(()=>{var Z;return(Z=e.emitModelData)==null?void 0:Z.call(e)}))}const v=t.computed(()=>o.value.length>0),d=t.computed(()=>n.value.length>0),C=t.computed(()=>!!e.selection.value),y=t.ref(null);function h(){var Z;const R=e.selection.value;if(!R)return;const j={};for(let Se=R.startCol;Se<=R.endCol;Se++)for(let Re=R.startRow;Re<=R.endRow;Re++)j[`${Se-R.startCol},${Re-R.startRow}`]=((Z=e.cells[e.cellKey(Se,Re)])==null?void 0:Z.styleId)??0;y.value={styles:j}}function L(){var Z,Se,Re;const R=y.value,j=e.selection.value;if(!(!R||!j)){c();for(let Ce=j.startCol;Ce<=j.endCol;Ce++)for(let Ne=j.startRow;Ne<=j.endRow;Ne++){const lt=e.findMerge(Ce,Ne);if(lt&&(Ce!==lt.range.startCol||Ne!==lt.range.startRow))continue;const Ct=R.styles[`${Ce-j.startCol},${Ne-j.startRow}`]??0,Ht=e.cellKey(Ce,Ne),tl=((Z=e.cells[Ht])==null?void 0:Z.value)??"";if(tl===""&&Ct===0)e.delCell(Ht);else{const ol={value:tl};Ct>0&&(ol.styleId=Ct),e.cells[Ht]=ol}}y.value=null,(Se=e.scheduleRender)==null||Se.call(e),(Re=e.emitModelData)==null||Re.call(e)}}function oe(){var j,Z,Se;const R=e.selection.value;if(R){c();for(let Re=R.startCol;Re<=R.endCol;Re++)for(let Ce=R.startRow;Ce<=R.endRow;Ce++){const Ne=e.findMerge(Re,Ce);if(Ne&&(Re!==Ne.range.startCol||Ce!==Ne.range.startRow))continue;const lt=e.cellKey(Re,Ce),Ct=((j=e.cells[lt])==null?void 0:j.value)??"";Ct===""?e.delCell(lt):e.cells[lt]={value:Ct}}(Z=e.scheduleRender)==null||Z.call(e),(Se=e.emitModelData)==null||Se.call(e)}}const te=t.computed(()=>Mr.map(R=>({...R,label:R.value===""?w(e.locale.value,"fontDefault"):R.label}))),Y=t.computed(()=>Br.map(R=>({...R,label:String(R.value)}))),k="\0",Q=t.computed(()=>{const R=e.selection.value;if(!R)return"";let j,Z=!1;for(let Se=R.startCol;Se<=R.endCol&&!Z;Se++)for(let Re=R.startRow;Re<=R.endRow&&!Z;Re++){const Ce=e.findMerge(Se,Re);if(Ce&&(Se!==Ce.range.startCol||Re!==Ce.range.startRow))continue;const Ne=e.resolveStyle(e.cells[e.cellKey(Se,Re)]),lt=typeof(Ne==null?void 0:Ne.fontFamily)=="string"?Ne.fontFamily:"";j===void 0?j=lt:lt!==j&&(Z=!0)}return Z?k:j??""}),le=t.computed(()=>{const R=e.selection.value;if(!R)return Ul;let j,Z=!1;for(let Se=R.startCol;Se<=R.endCol&&!Z;Se++)for(let Re=R.startRow;Re<=R.endRow&&!Z;Re++){const Ce=e.findMerge(Se,Re);if(Ce&&(Se!==Ce.range.startCol||Re!==Ce.range.startRow))continue;const Ne=e.cellFontSize(Se,Re);j===void 0?j=Ne:Ne!==j&&(Z=!0)}return Z?0:j??Ul});function se(R,j){var Se,Re,Ce;const Z=e.selection.value;if(Z){c();for(let Ne=Z.startCol;Ne<=Z.endCol;Ne++)for(let lt=Z.startRow;lt<=Z.endRow;lt++){const Ct=e.findMerge(Ne,lt);if(Ct&&(Ne!==Ct.range.startCol||lt!==Ct.range.startRow))continue;const Ht=e.cellKey(Ne,lt),tl=((Se=e.cells[Ht])==null?void 0:Se.value)??"";let zt={...e.resolveStyle(e.cells[Ht])??{}};if(j===""||j===null||j===void 0||j===0){const{[R]:ll,...rl}=zt;zt=rl}else zt[R]=j;const Xt=Object.keys(zt).length?e.registerStyle(zt):0;if(tl===""&&Xt===0)e.delCell(Ht);else{const ll={value:tl};Xt>0&&(ll.styleId=Xt),e.cells[Ht]=ll}}(Re=e.scheduleRender)==null||Re.call(e),(Ce=e.emitModelData)==null||Ce.call(e)}}function Ke(R){se("fontFamily",R===""?"":R)}const Oe=t.ref(!1),Ge=t.ref(!1),Te=t.ref(!1),qe=t.ref(!1),tt=t.ref(!1);function ye(R){se("fontSize",R),Oe.value=!1}const ie=t.computed(()=>Ir.map(R=>({label:w(e.locale.value,R.labelKey),value:R.value,icon:R.icon}))),he=t.computed(()=>Ar.map(R=>({label:w(e.locale.value,R.labelKey),value:R.value,icon:R.icon}))),Ae=t.computed(()=>{const R=e.selection.value;if(!R)return"left";const j=e.resolveStyle(e.cells[e.cellKey(R.startCol,R.startRow)]),Z=typeof(j==null?void 0:j.textAlign)=="string"?j.textAlign:"";return Z==="center"||Z==="right"?Z:"left"}),dt=t.computed(()=>{const R=e.selection.value;if(!R)return"top";const j=e.resolveStyle(e.cells[e.cellKey(R.startCol,R.startRow)]),Z=typeof(j==null?void 0:j.verticalAlign)=="string"?j.verticalAlign:"";return Z==="middle"||Z==="bottom"?Z:"top"}),ue=t.computed(()=>{const R=e.selection.value;if(!R)return!1;const j=e.resolveStyle(e.cells[e.cellKey(R.startCol,R.startRow)]);return(j==null?void 0:j.wrap)==="wrap"});function ve(R){se("textAlign",R)}function p(R){se("verticalAlign",R)}function A(){if(!e.selection.value)return;const j=ue.value;se("wrap",j?void 0:"wrap")}const $=t.ref(""),ee=Oe;t.watch(le,R=>{$.value=R===0?"":String(R)},{immediate:!0});function U(R){const j=R.replace(/[^\d]/g,"");$.value=j;const Z=parseInt(j,10);!isNaN(Z)&&Z>=5&&Z<=72&&Z!==le.value&&se("fontSize",Z)}function O(){const R=$.value.trim();if(!R){$.value=le.value===0?"":String(le.value);return}let j=parseInt(R,10);isNaN(j)?j=le.value===0?Ul:le.value:j=Math.max(5,Math.min(72,j)),$.value=String(j),j!==le.value&&se("fontSize",j)}function x(R){R.key==="Enter"&&R.target.blur()}function X(R){R&&R.preventDefault(),ee.value=!ee.value,ee.value&&(Te&&(Te.value=!1),Ge&&(Ge.value=!1),qe.value=!1,tt.value=!1)}function Le(){const R=le.value===0?Ul:le.value,j=Math.min(72,R+1);se("fontSize",j),$.value=String(j),ee.value=!1}function re(){const R=le.value===0?Ul:le.value,j=Math.max(5,R-1);se("fontSize",j),$.value=String(j),ee.value=!1}function V(R){const j=e.selection.value;if(!j)return!1;let Z,Se=!1;for(let Re=j.startCol;Re<=j.endCol&&!Se;Re++)for(let Ce=j.startRow;Ce<=j.endRow&&!Se;Ce++){const Ne=e.findMerge(Re,Ce);if(Ne&&(Re!==Ne.range.startCol||Ce!==Ne.range.startRow))continue;const lt=e.resolveStyle(e.cells[e.cellKey(Re,Ce)]),Ct=!!(lt!=null&<[R]);Z===void 0?Z=Ct:Ct!==Z&&(Se=!0)}return!Se&&Z===!0}const G=t.computed(()=>V("fontWeight")),xe=t.computed(()=>V("fontStyle")),$e=t.computed(()=>V("underline")),bt=t.computed(()=>V("strikethrough"));function ge(){se("fontWeight",G.value?"":"bold")}function pe(){se("fontStyle",xe.value?"":"italic")}function it(){se("underline",$e.value?"":"underline")}function It(){se("strikethrough",bt.value?"":"line-through")}const Je=t.ref(""),E=t.ref(""),ne=qe,Et=tt;function Dt(){ne.value=!ne.value,Et.value=!1,Ge&&(Ge.value=!1),Te&&(Te.value=!1)}function Ot(){Et.value=!Et.value,ne.value=!1,Ge&&(Ge.value=!1),Te&&(Te.value=!1)}function de(R){Ge&&(Ge.value=R),R&&(ne.value=!1,Et.value=!1,Te&&(Te.value=!1))}function g(R){Je.value=R,se("color",R===""?"":R)}function M(R){E.value=R,se("backgroundColor",R===""?"":R)}function Vt(){se("color",Je.value===""?"":Je.value)}function Mt(){se("backgroundColor",E.value===""?"":E.value)}const el=t.computed(()=>{const R=e.selection.value;if(!R)return"";let j,Z=!1;for(let Se=R.startCol;Se<=R.endCol&&!Z;Se++)for(let Re=R.startRow;Re<=R.endRow&&!Z;Re++){const Ce=e.findMerge(Se,Re);if(Ce&&(Se!==Ce.range.startCol||Re!==Ce.range.startRow))continue;const Ne=e.resolveStyle(e.cells[e.cellKey(Se,Re)]),lt=typeof(Ne==null?void 0:Ne.color)=="string"?Ne.color:"";j===void 0?j=lt:lt!==j&&(Z=!0)}return Z?"":j??""}),Ut=t.computed(()=>{const R=e.selection.value;if(!R)return"";let j,Z=!1;for(let Se=R.startCol;Se<=R.endCol&&!Z;Se++)for(let Re=R.startRow;Re<=R.endRow&&!Z;Re++){const Ce=e.findMerge(Se,Re);if(Ce&&(Se!==Ce.range.startCol||Re!==Ce.range.startRow))continue;const Ne=e.resolveStyle(e.cells[e.cellKey(Se,Re)]),lt=typeof(Ne==null?void 0:Ne.backgroundColor)=="string"?Ne.backgroundColor:"";j===void 0?j=lt:lt!==j&&(Z=!0)}return Z?"":j??""}),Cl=t.computed(()=>Po(e.locale.value)),Xl=t.ref(!1),dn=t.computed(()=>{const R=e.selection.value;if(!R)return Gl;let j,Z=!1;for(let Se=R.startCol;Se<=R.endCol&&!Z;Se++)for(let Re=R.startRow;Re<=R.endRow&&!Z;Re++){const Ce=e.findMerge(Se,Re);if(Ce&&(Se!==Ce.range.startCol||Re!==Ce.range.startRow))continue;const Ne=e.resolveStyle(e.cells[e.cellKey(Se,Re)]),lt=(Ne==null?void 0:Ne.numberFormatCategory)==="custom"?Kl:typeof(Ne==null?void 0:Ne.numberFormat)=="string"?Ne.numberFormat:"";j===void 0?j=lt:lt!==j&&(Z=!0)}return Z?Il:j??Gl});function I(R){if((R==null?void 0:R.numberFormatCategory)==="custom")return Kl;const j=typeof(R==null?void 0:R.numberFormat)=="string"?R.numberFormat:"";return Wo(j,e.locale.value)}const F=t.computed(()=>{const R=dn.value;if(R!==Il)return R===Kl?Kl:Wo(R,e.locale.value);const j=e.selection.value;if(!j)return Gl;let Z,Se=!1;for(let Re=j.startCol;Re<=j.endCol&&!Se;Re++)for(let Ce=j.startRow;Ce<=j.endRow&&!Se;Ce++){const Ne=e.findMerge(Re,Ce);if(Ne&&(Re!==Ne.range.startCol||Ce!==Ne.range.startRow))continue;const lt=I(e.resolveStyle(e.cells[e.cellKey(Re,Ce)]));Z===void 0?Z=lt:lt!==Z&&(Se=!0)}return Se?Il:Z??Gl});function z(R){se("numberFormat",R),we()}function we(){const R=e.selection.value;if(R)for(let j=R.startCol;j<=R.endCol;j++)for(let Z=R.startRow;Z<=R.endRow;Z++){const Se=e.findMerge(j,Z);if(Se&&(j!==Se.range.startCol||Z!==Se.range.startRow))continue;const Re=e.cellKey(j,Z),Ce=e.cells[Re],Ne=e.resolveStyle(Ce);if((Ne==null?void 0:Ne.numberFormatCategory)!=="custom")continue;const{numberFormatCategory:lt,...Ct}=Ne,Ht=Object.keys(Ct).length?e.registerStyle(Ct):0,tl=(Ce==null?void 0:Ce.value)??"";if(tl===""&&Ht===0)e.delCell(Re);else{const ol={value:tl};Ht>0&&(ol.styleId=Ht),e.cells[Re]=ol}}}function Ee(R){if(R===Kl){Xl.value=!0;return}z(R)}function Fe(){Xl.value=!0}function Ve(){const R=e.selection.value;if(!R)return[];const j=[];for(let Z=R.startCol;Z<=R.endCol;Z++)for(let Se=R.startRow;Se<=R.endRow;Se++){const Re=e.findMerge(Z,Se);if(Re&&(Z!==Re.range.startCol||Se!==Re.range.startRow))continue;const Ce=e.cellKey(Z,Se),Ne=e.cells[Ce],lt=e.resolveStyle(Ne),Ct=typeof(lt==null?void 0:lt.numberFormat)=="string"?lt.numberFormat:Gl,Ht=(Ne==null?void 0:Ne.value)??"",tl=Ht.startsWith("=")?tr(Z,Se,e.cells,e.colCount,e.rowCount):Ht;$o(Ct,tl)&&j.push({key:Ce,nf:Ct,decimals:ta(Ct,tl)})}return j}const ke=t.computed(()=>Ve().some(R=>R.decimals<mo)),ce=t.computed(()=>Ve().some(R=>R.decimals>po));function je(R,j,Z){var lt;const Se=((lt=e.cells[R])==null?void 0:lt.value)??"",Ce={...e.resolveStyle(e.cells[R])??{}};j===""?(delete Ce.numberFormat,delete Ce.numberFormatCategory):(Ce.numberFormat=j,Z==="custom"&&(Ce.numberFormatCategory="custom"));const Ne=Object.keys(Ce).length?e.registerStyle(Ce):0;if(Se===""&&Ne===0)e.delCell(R);else{const Ct={value:Se};Ne>0&&(Ct.styleId=Ne),e.cells[R]=Ct}}function We(R){var Se,Re;const j=Ve(),Z=[];for(const Ce of j){const Ne=Ce.decimals+R;if(Ne<po||Ne>mo)continue;const lt=na(Ce.nf,Ne);lt==null||lt===Ce.nf||Z.push({key:Ce.key,code:lt,category:bl(Ce.nf)?"custom":void 0})}if(Z.length){c();for(const Ce of Z)je(Ce.key,Ce.code,Ce.category);(Se=e.scheduleRender)==null||Se.call(e),(Re=e.emitModelData)==null||Re.call(e)}}function fe(){We(1)}function ot(){We(-1)}return{undoStack:o,redoStack:n,cloneCells:a,takeSnap:i,restoreSnap:r,saveUndo:c,undo:s,redo:m,canUndo:v,canRedo:d,hasSelection:C,paintFmt:y,onPaintFormat:h,applyPaintFormat:L,clearFormat:oe,fontFamilyOptions:te,fontSizeOptions:Y,FONT_FAMILY_MIXED:k,selFontFamily:Q,selFontSize:le,applyStyleToSelection:se,onFontFamilyChange:Ke,onFontSizeChange:ye,hAlignOptions:ie,vAlignOptions:he,selHAlign:Ae,selVAlign:dt,selWrap:ue,onHAlignChange:ve,onVAlignChange:p,onWrapToggle:A,fontSizeInput:$,fontSizeMenuOpen:ee,onFontSizeInput:U,onFontSizeBlur:O,onFontSizeKeydown:x,toggleFontSizeMenu:X,onFontSizeStepUp:Le,onFontSizeStepDown:re,selFontWeight:G,selFontStyle:xe,selUnderline:$e,selStrikethrough:bt,toggleFontWeight:ge,toggleFontStyle:pe,toggleUnderline:it,toggleStrikethrough:It,cachedTextColor:Je,cachedFillColor:E,textColorMenuOpen:ne,fillColorMenuOpen:Et,_toggleTextColorMenu:Dt,_toggleFillColorMenu:Ot,onBorderMenuToggle:de,onTextColorChange:g,onFillColorChange:M,applyCachedTextColor:Vt,applyCachedFillColor:Mt,selTextColor:el,selFillColor:Ut,nfOptions:Cl,selNumberFormat:dn,selNumberFormatDisplay:F,NF_NUMBER_FORMAT_MIXED:Il,nfDialogOpen:Xl,onNumberFormatChange:Ee,openNumberFormatDialog:Fe,applyNumberFormatCode:z,canIncreaseDecimals:ke,canDecreaseDecimals:ce,onIncreaseDecimals:fe,onDecreaseDecimals:ot}}function cf(e,l){l.borderMenuOpen&&(e.borderMenuOpen=l.borderMenuOpen),l.mergeMenuOpen&&(e.mergeMenuOpen=l.mergeMenuOpen),(()=>{const n=e.borderMenuOpen,a=e.mergeMenuOpen;e.onBorderMenuToggle=i=>{n&&(n.value=i),i&&(e.textColorMenuOpen.value=!1,e.fillColorMenuOpen.value=!1,a&&(a.value=!1))},e.toggleFontSizeMenu=i=>{i&&i.preventDefault(),e.fontSizeMenuOpen.value=!e.fontSizeMenuOpen.value,e.fontSizeMenuOpen.value&&(a&&(a.value=!1),n&&(n.value=!1),e.textColorMenuOpen.value=!1,e.fillColorMenuOpen.value=!1)},e._toggleTextColorMenu=()=>{e.textColorMenuOpen.value=!e.textColorMenuOpen.value,e.fillColorMenuOpen.value=!1,n&&(n.value=!1),a&&(a.value=!1)},e._toggleFillColorMenu=()=>{e.fillColorMenuOpen.value=!e.fillColorMenuOpen.value,e.textColorMenuOpen.value=!1,n&&(n.value=!1),a&&(a.value=!1)}})()}function sf(e,l){const o=t.ref("none"),n=t.ref(!1),a="#444";function i(p,A,$,ee){if(p<0||A<0||p>=e.colCount||A>=e.rowCount)return;const U=e.findMerge(p,A),O=U?U.anchor:e.cellKey(p,A);if(!e.cells[O]){if(!ee)return;e.cells[O]={value:""}}of(e.cells[O],$,ee,e.styles,{get:X=>e.resolveBorder(X),getId:X=>e.registerBorder(X)},e.registerStyle)}function r(p,A,$){var Le;const ee=e.findMerge(p,A),U=ee?ee.anchor:e.cellKey(p,A),O=((Le=e.cells[U])==null?void 0:Le.value)??"",x=e.resolveStyle(e.cells[U])?{...e.resolveStyle(e.cells[U])}:{},X=e.registerBorder($);if(X>0?x.borderId=X:delete x.borderId,delete x.borderTopWidth,delete x.borderBottomWidth,delete x.borderLeftWidth,delete x.borderRightWidth,delete x.borderColor,O===""&&!Object.keys(x).length)e.delCell(U);else{const re=e.registerStyle(x);e.cells[U]={value:O,styleId:re||void 0}}}function c(p){var Le,re;o.value=p;const A=e.selection.value;if(!A)return;l.saveUndo();const{startCol:$,startRow:ee,endCol:U,endRow:O}=A,x={width:1,color:a},X={width:2,color:a};if(p==="none")for(let V=$;V<=U;V++)for(let G=ee;G<=O;G++){const xe=e.findMerge(V,G);xe&&(V!==xe.range.startCol||G!==xe.range.startRow)||r(V,G,{})}else if(p==="all")for(let V=$;V<=U;V++)for(let G=ee;G<=O;G++){const xe=e.findMerge(V,G);xe&&(V!==xe.range.startCol||G!==xe.range.startRow)||r(V,G,{top:x,right:x,bottom:x,left:x})}else if(p==="outer"||p==="thickOuter"){const V=p==="thickOuter"?X:x;for(let G=$;G<=U;G++)i(G,ee,"top",V);for(let G=$;G<=U;G++)i(G,O,"bottom",V);for(let G=ee;G<=O;G++)i($,G,"left",V);for(let G=ee;G<=O;G++)i(U,G,"right",V)}else{const G={top:{side:"top",edgeCheck:(xe,$e)=>$e===ee},bottom:{side:"bottom",edgeCheck:(xe,$e)=>$e===O},left:{side:"left",edgeCheck:(xe,$e)=>xe===$},right:{side:"right",edgeCheck:(xe,$e)=>xe===U}}[p];if(G)for(let xe=$;xe<=U;xe++)for(let $e=ee;$e<=O;$e++)G.edgeCheck(xe,$e)&&i(xe,$e,G.side,x)}(Le=e.scheduleRender)==null||Le.call(e),(re=e.emitModelData)==null||re.call(e)}function s(){c(o.value)}function m(p,A,$){const ee=$.toLowerCase(),U=e.findMerge(p,A);if(U){if(ee==="top"&&A!==U.range.startRow||ee==="bottom"&&A!==U.range.endRow||ee==="left"&&p!==U.range.startCol||ee==="right"&&p!==U.range.endCol)return 0;const x=e.getCellBorderSide(e.cells[U.anchor],ee);return(x==null?void 0:x.width)??0}const O=e.getCellBorderSide(e.cells[e.cellKey(p,A)],ee);return(O==null?void 0:O.width)??0}const v=t.ref(!1);function d(p){v.value=p,p&&(l.textColorMenuOpen.value=!1,l.fillColorMenuOpen.value=!1,n.value=!1,l.fontSizeMenuOpen.value=!1)}function C(p,A,$,ee){const U=[];for(const O in e.merges){const x=e.merges[O];x&&x.startCol<=$&&x.endCol>=p&&x.startRow<=ee&&x.endRow>=A&&U.push(O)}for(const O of U)Reflect.deleteProperty(e.merges,O)}function y(){var O,x,X;const p=e.selection.value;if(!p||p.startCol===p.endCol&&p.startRow===p.endRow)return;l.saveUndo(),C(p.startCol,p.startRow,p.endCol,p.endRow);const A=e.cellKey(p.startCol,p.startRow),$=((O=e.cells[A])==null?void 0:O.value)??"";for(let Le=p.startCol;Le<=p.endCol;Le++)for(let re=p.startRow;re<=p.endRow;re++)Le===p.startCol&&re===p.startRow||e.clearCellsInRange(Le,Le,re,re);const ee=e.resolveStyle(e.cells[A])?{...e.resolveStyle(e.cells[A])}:{};ee.textAlign="center";const U=e.registerStyle(ee);e.cells[A]={value:$,styleId:U||void 0},e.merges[A]={startCol:p.startCol,startRow:p.startRow,endCol:p.endCol,endRow:p.endRow},e.selectCell(p.startCol,p.startRow),(x=e.scheduleRender)==null||x.call(e),(X=e.emitModelData)==null||X.call(e)}function h(){var A,$,ee;const p=e.selection.value;if(!(!p||p.startCol===p.endCol)){l.saveUndo();for(let U=p.startRow;U<=p.endRow;U++){C(p.startCol,U,p.endCol,U);const O=e.cellKey(p.startCol,U);(A=e.cells[O])==null||A.value;for(let x=p.startCol+1;x<=p.endCol;x++)e.clearCellsInRange(x,x,U,U);e.merges[O]={startCol:p.startCol,startRow:U,endCol:p.endCol,endRow:U}}e.selectRange(p.startCol,p.startRow,p.endCol,p.endRow),($=e.scheduleRender)==null||$.call(e),(ee=e.emitModelData)==null||ee.call(e)}}function L(){var $,ee,U;const p=e.selection.value;if(!p||p.startCol===p.endCol&&p.startRow===p.endRow)return;l.saveUndo(),C(p.startCol,p.startRow,p.endCol,p.endRow);const A=e.cellKey(p.startCol,p.startRow);($=e.cells[A])==null||$.value;for(let O=p.startCol;O<=p.endCol;O++)for(let x=p.startRow;x<=p.endRow;x++)O===p.startCol&&x===p.startRow||e.clearCellsInRange(O,O,x,x);e.merges[A]={startCol:p.startCol,startRow:p.startRow,endCol:p.endCol,endRow:p.endRow},e.selectCell(p.startCol,p.startRow),(ee=e.scheduleRender)==null||ee.call(e),(U=e.emitModelData)==null||U.call(e)}function oe(){var A,$;const p=e.selection.value;p&&(l.saveUndo(),C(p.startCol,p.startRow,p.endCol,p.endRow),(A=e.scheduleRender)==null||A.call(e),($=e.emitModelData)==null||$.call(e))}function te(){const p=e.selection.value;if(!p)return;const A=e.findMerge(p.startCol,p.startRow);A&&p.startCol===A.range.startCol&&p.startRow===A.range.startRow&&p.endCol===A.range.endCol&&p.endRow===A.range.endRow?oe():y()}function Y(p){switch(p){case"mergeCenter":y();break;case"mergeAcross":h();break;case"mergeCells":L();break;case"unmergeCells":oe();break}}let k=null,Q=[];function le(p,A,$,ee){Q=[];for(let U=$;U<=ee;U++){const O=[];for(let x=p;x<=A;x++){const X=e.cells[e.cellKey(x,U)];O.push((X==null?void 0:X.styleId)??0)}Q.push(O)}}function se(p,A,$,ee){const U=e.cellKey(p,A);if($n(),$===""||$==null){e.formulaDeps.clear(U),ee&&ee>0?e.cells[U]={value:"",styleId:ee}:e.delCell(U),e.formulaDeps.markDirty(U);return}e.cells[U]={value:$,styleId:ee&&ee>0?ee:void 0},$.startsWith("=")?e.formulaDeps.set(U,Zn($.slice(1),e.colCount,e.rowCount)):e.formulaDeps.clear(U),e.formulaDeps.markDirty(U)}function Ke(){const p=e.selection.value;if(!p)return;k={...p},le(p.startCol,p.endCol,p.startRow,p.endRow);const A=[];for(let $=p.startRow;$<=p.endRow;$++){const ee=[];for(let U=p.startCol;U<=p.endCol;U++)ee.push(e.getCellRaw(U,$));A.push(ee.join(" "))}Co(A.join(`
|
|
4
|
+
`))}function Oe(){const p=e.selection.value;if(p){if(p.startCol===0&&p.endCol===e.colCount-1){k={...p},le(0,e.colCount-1,p.startRow,p.endRow);const A=[];for(let $=p.startRow;$<=p.endRow;$++){const ee=[];for(let U=0;U<e.colCount;U++)ee.push(e.getCellRaw(U,$));A.push(ee.join(" "))}Co(A.join(`
|
|
5
|
+
`))}else if(p.startRow===0&&p.endRow===e.rowCount-1){k={...p},le(p.startCol,p.endCol,0,e.rowCount-1);const A=[];for(let $=0;$<e.rowCount;$++){const ee=[];for(let U=p.startCol;U<=p.endCol;U++)ee.push(e.getCellRaw(U,$));A.push(ee.join(" "))}Co(A.join(`
|
|
6
|
+
`))}}}async function Ge(){var re;let p;try{p=await navigator.clipboard.readText()}catch{return}if(!p&&p!=="")return;const A=p.split(/\r?\n/),$=e.activeCell.value,ee=k,U=ee&&Q.length>0,O=A.map(V=>V.split(" ").length),x=O.length?Math.max(...O):0,X=$.col+x-1,Le=$.row+A.length-1;X>=0&&Le>=0&&e.ensureCapacity(X,Le);for(let V=0;V<A.length;V++){const G=A[V].split(" ");for(let xe=0;xe<G.length;xe++){const $e=$.col+xe,bt=$.row+V;let ge=G[xe];if(ge.startsWith("=")&&ee&&(ge=vo(ge,$e-(ee.startCol+xe),bt-(ee.startRow+V),e.colCount,e.rowCount,ht)),U&&V<Q.length&&xe<(((re=Q[V])==null?void 0:re.length)??0)){const pe=Q[V][xe]??null;se($e,bt,ge,pe)}else e.setCellValue($e,bt,ge)}}}function Te(){var p;if(l.saveUndo(),Ke(),e.selection.value){const A=e.selection.value;e.clearCellsInRange(A.startCol,A.endCol,A.startRow,A.endRow),(p=e.scheduleRender)==null||p.call(e)}}function qe(){var p;if(e.selection.value){const A=e.selection.value;e.clearCellsInRange(A.startCol,A.endCol,A.startRow,A.endRow),(p=e.scheduleRender)==null||p.call(e)}}function tt(){var O,x;const p=e.selection.value;if(!p)return;l.saveUndo();const A=p.startCol,$=p.startRow,ee=p.endCol,U=p.endRow;if($===U)if(ee+1<e.colCount){const X=`${ht(A)}${$+1}:${ht(ee)}${$+1}`;e.setCellValue(ee+1,$,`=SUM(${X})`)}else{const X=`${ht(A)}${$+1}:${ht(ee-1)}${$+1}`;e.setCellValue(ee,$,`=SUM(${X})`)}else for(let X=A;X<=ee;X++)if(U+1<e.rowCount){const Le=`${ht(X)}${$+1}:${ht(X)}${U+1}`;e.setCellValue(X,U+1,`=SUM(${Le})`)}else{const Le=`${ht(X)}${$+1}:${ht(X)}${U}`;e.setCellValue(X,U,`=SUM(${Le})`)}(O=e.scheduleRender)==null||O.call(e),(x=e.emitModelData)==null||x.call(e)}function ye(){var O,x;const p=e.selection.value;if(!p)return;l.saveUndo();const A=p.startCol,$=p.startRow,ee=p.endCol,U=p.endRow;if($===U)if(ee+1<e.colCount){const X=`${ht(A)}${$+1}:${ht(ee)}${$+1}`;e.setCellValue(ee+1,$,`=AVERAGE(${X})`)}else{const X=`${ht(A)}${$+1}:${ht(ee-1)}${$+1}`;e.setCellValue(ee,$,`=AVERAGE(${X})`)}else for(let X=A;X<=ee;X++)if(U+1<e.rowCount){const Le=`${ht(X)}${$+1}:${ht(X)}${U+1}`;e.setCellValue(X,U+1,`=AVERAGE(${Le})`)}else{const Le=`${ht(X)}${$+1}:${ht(X)}${U}`;e.setCellValue(X,U,`=AVERAGE(${Le})`)}(O=e.scheduleRender)==null||O.call(e),(x=e.emitModelData)==null||x.call(e)}function ie(){var O,x;const p=e.selection.value;if(!p)return;l.saveUndo();const A=p.startCol,$=p.startRow,ee=p.endCol,U=p.endRow;if($===U)if(ee+1<e.colCount){const X=`${ht(A)}${$+1}:${ht(ee)}${$+1}`;e.setCellValue(ee+1,$,`=COUNT(${X})`)}else{const X=`${ht(A)}${$+1}:${ht(ee-1)}${$+1}`;e.setCellValue(ee,$,`=COUNT(${X})`)}else for(let X=A;X<=ee;X++)if(U+1<e.rowCount){const Le=`${ht(X)}${$+1}:${ht(X)}${U+1}`;e.setCellValue(X,U+1,`=COUNT(${Le})`)}else{const Le=`${ht(X)}${$+1}:${ht(X)}${U}`;e.setCellValue(X,U,`=COUNT(${Le})`)}(O=e.scheduleRender)==null||O.call(e),(x=e.emitModelData)==null||x.call(e)}const he=t.ref(!1);function Ae(p){he.value=p,p&&(l.textColorMenuOpen.value=!1,l.fillColorMenuOpen.value=!1,n.value=!1,l.fontSizeMenuOpen.value=!1,v.value=!1)}function dt(){tt(),he.value=!1}function ue(){ye(),he.value=!1}function ve(){ie(),he.value=!1}return{cachedBorder:o,borderMenuOpen:n,BORDER_COLOR:a,onBorderChange:c,setCellBorderSide:i,applyBorderToCell:r,applyCachedBorder:s,cellBorderWidth:m,mergeMenuOpen:v,onMergeMenuToggle:d,removeOverlappingMerges:C,mergeAndCenter:y,mergeAcross:h,mergeCells:L,unmergeCells:oe,onApplyMerge:te,onMergeChange:Y,copySourceRange:null,copySourceStyles:[],captureStyles:le,setCellWithStyle:se,copyToClipboard:Ke,copyRowCol:Oe,pasteFromClipboard:Ge,cutSelected:Te,clearSelected:qe,sumSelected:tt,avgSelected:ye,countSelected:ie,calcMenuOpen:he,onCalcMenuToggle:Ae,onCalcSum:dt,onCalcAvg:ue,onCalcCount:ve}}function df(e,l,o,n){const a={},i=n(l),r=n(o);return i!=null&&(a.width=`${i}px`),r!=null&&(a.height=`${r}px`),a["--sp-formula-bar-bg"]=e.formulaBarBg,a["--sp-formula-bar-border"]=e.formulaBarBorder,a["--sp-formula-bar-label-color"]=e.formulaBarLabelText,a["--sp-formula-bar-label-bg"]=e.formulaBarLabelBg,a["--sp-formula-bar-label-border"]=e.formulaBarLabelBorder,a["--sp-formula-bar-input-bg"]=e.formulaBarInputBg,a["--sp-formula-bar-input-border"]=e.formulaBarInputBorder,a["--sp-formula-bar-input-color"]=e.formulaBarInputText,a["--sp-formula-bar-input-focus-border"]=e.formulaBarInputFocusBorder,a["--sp-formula-bar-input-focus-shadow"]=e.formulaBarInputFocusShadow,a["--sp-wrapper-bg"]=e.wrapperBg,a["--sp-cell-editor-border"]=e.cellEditorBorder,a["--sp-cell-editor-color"]=e.cellEditorText,a["--sp-cell-editor-bg"]=e.cellEditorBg,a["--sp-cell-editor-shadow"]=e.cellEditorShadow,a["--sp-tab-bar-bg"]=e.tabBarBg,a["--sp-tab-bar-border"]=e.tabBarBorder,a["--sp-tab-active-bg"]=e.tabActiveBg,a["--sp-tab-active-color"]=e.tabActiveText,a["--sp-tab-active-border"]=e.tabActiveBorder,a["--sp-tab-inactive-bg"]=e.tabInactiveBg,a["--sp-tab-inactive-color"]=e.tabInactiveText,a["--sp-tab-inactive-border"]=e.tabInactiveBorder,a["--sp-tab-hover-bg"]=e.tabHoverBg,a["--sp-tab-add-btn-color"]=e.tabAddBtnColor,a["--sp-tab-add-btn-hover-bg"]=e.tabAddBtnHoverBg,a["--sp-tab-scroll-btn-color"]=e.tabScrollBtnColor,a["--sp-tab-scroll-btn-hover-bg"]=e.tabScrollBtnHoverBg,a["--sp-scroll-thumb"]=e.scrollbarThumb,a["--sp-scroll-thumb-hover"]=e.scrollbarThumbHover,a["--sp-scroll-btn-bg"]=e.scrollBtnBg,a["--sp-scroll-btn-color"]=e.scrollBtnColor,a["--sp-scroll-btn-hover-bg"]=e.scrollBtnHoverBg,a["--sp-scroll-btn-active-bg"]=e.scrollBtnActiveBg,a["--sp-scroll-track-bg"]=e.scrollTrackBg,a["--sp-toolbar-bg"]=e.toolbarBg,a["--sp-toolbar-border"]=e.toolbarBorder,a["--sp-toolbar-btn-color"]=e.toolbarBtnColor,a["--sp-toolbar-btn-hover-bg"]=e.toolbarBtnHoverBg,a["--sp-toolbar-btn-disabled-color"]=e.toolbarBtnDisabledColor,a["--sp-toolbar-btn-active-color"]=e.toolbarBtnActiveColor,a}function pr(e){return e==="number"?0:1}function hr(e,l,o){var i;if(e==null||e.trim()==="")return{kind:"blank"};const n=l??"";if(n===gl||n==="@")return{kind:"text",text:e};if(bl(n)){if(Yl(e))return{kind:"number",num:Number(e)};const r=Dn(e,o);return r?{kind:"number",num:r.serial}:{kind:"text",text:Rl(e,n,o)}}const a=ql(n);if(a.kind==="date"||a.kind==="duration"){const r=Number(e);return Number.isFinite(r)?{kind:"number",num:r}:{kind:"text",text:Rl(e,n,o)}}if(a.kind==="number"){const r=Number(e);if(Number.isFinite(r)){const c=((i=a.sections.find(s=>s.hasDigits))==null?void 0:i.scale)??1;return{kind:"number",num:r*c}}return{kind:"text",text:Rl(e,n,o)}}return{kind:"text",text:Rl(e,n,o)}}function uf(e,l,o,n){if(e.kind==="blank"||l.kind==="blank")return e.kind==="blank"&&l.kind==="blank"?0:e.kind==="blank"?1:-1;const a=pr(e.kind),i=pr(l.kind);if(a!==i)return o==="asc"?a-i:i-a;let r;return e.kind==="number"?r=(e.num??0)-(l.num??0):r=(e.text??"").localeCompare(l.text??"",n,{numeric:!0}),o==="asc"?r:-r}function ff(e,l,o){const n=e.map((a,i)=>i);return n.sort((a,i)=>{const r=uf(e[a],e[i],l,o);return r!==0?r:a-i}),n}function mf(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 Mo(e){return e?JSON.parse(JSON.stringify(e)):null}function gr(e,l,o,n){if(!e)return null;const a=o-l+1,i={...e.range};return n?l<=i.endRow&&(l<=i.startRow&&(i.startRow+=a),i.endRow+=a):o<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 br(e,l,o,n){if(!e)return null;const a=o-l+1,i={...e.range},r={};if(n){l<=i.endCol&&(l<=i.startCol&&(i.startCol+=a),i.endCol+=a);for(const c in e.columns){const s=Number(c);r[s>=l?s+a:s]=e.columns[c]}}else{o<i.startCol?(i.startCol-=a,i.endCol-=a):l<=i.endCol&&(i.endCol-=Math.min(a,i.endCol-l+1),i.endCol<i.startCol&&(i.endCol=i.startCol));for(const c in e.columns){const s=Number(c);s>=l&&s<=o||(r[s>o?s-a:s]=e.columns[c])}}return{range:i,columns:r}}function Cr(e,l,o,n){if(l==="row"){const a=e.startRow,i=e.endRow;let r,c;if(i<o)r=a,c=i;else if(a>o+n-1)r=a-n,c=i-n;else if(r=a<o?a:o,c=i>o+n-1?i-n:o-1,c<r)return null;return{...e,startRow:r,endRow:c}}else{const a=e.startCol,i=e.endCol;let r,c;if(i<o)r=a,c=i;else if(a>o+n-1)r=a-n,c=i-n;else if(r=a<o?a:o,c=i>o+n-1?i-n:o-1,c<r)return null;return{...e,startCol:r,endCol:c}}}function yr(e,l,o,n){if(l==="row"){const a=e.startRow,i=e.endRow;return a>=o?{...e,startRow:a+n,endRow:i+n}:i<o?e:{...e,endRow:i+n}}else{const a=e.startCol,i=e.endCol;return a>=o?{...e,startCol:a+n,endCol:i+n}:i<o?e:{...e,endCol:i+n}}}function pf(e,l,o){var a;const n=o-l+1;for(let i=e.conditionalFormats.length-1;i>=0;i--){const r=e.conditionalFormats[i],c=r.ranges.map(s=>Cr(s,"row",l,n)).filter(s=>s!==null);c.length===0?e.conditionalFormats.splice(i,1):r.ranges=c}(a=e.invalidateConditionalFormatCache)==null||a.call(e)}function hf(e,l,o){var a;const n=o-l+1;for(const i of e.conditionalFormats)i.ranges=i.ranges.map(r=>yr(r,"row",l,n));(a=e.invalidateConditionalFormatCache)==null||a.call(e)}function gf(e,l,o){var a;const n=o-l+1;for(let i=e.conditionalFormats.length-1;i>=0;i--){const r=e.conditionalFormats[i],c=r.ranges.map(s=>Cr(s,"col",l,n)).filter(s=>s!==null);c.length===0?e.conditionalFormats.splice(i,1):r.ranges=c}(a=e.invalidateConditionalFormatCache)==null||a.call(e)}function bf(e,l,o){var a;const n=o-l+1;for(const i of e.conditionalFormats)i.ranges=i.ranges.map(r=>yr(r,"col",l,n));(a=e.invalidateConditionalFormatCache)==null||a.call(e)}function Cf(e,l,o,n,a){function i(I,F){const z=F-I+1,we=tt(I,F),Ee=[],Fe=[];for(const ce in e.cells){const je=ce.indexOf(",");if(je<0)continue;const We=parseInt(ce.substring(0,je),10),fe=parseInt(ce.substring(je+1),10);fe>=I&&fe<=F?Fe.push(ce):fe>F&&Ee.push({oldKey:ce,newKey:e.cellKey(We,fe-z),cell:e.cells[ce]})}for(const ce of Fe)Reflect.deleteProperty(e.cells,ce);for(const ce of Ee)Reflect.deleteProperty(e.cells,ce.oldKey),e.cells[ce.newKey]=ce.cell;const Ve=e.rowHeights.value,ke=new Array(Ve.length);for(let ce=0;ce<I;ce++)ke[ce]=Ve[ce];for(let ce=I;ce<Ve.length-z;ce++)ke[ce]=Ve[ce+z];for(let ce=Ve.length-z;ce<Ve.length;ce++)ke[ce]=void 0;e.rowHeights.value=ke,qe(we),e.freeze.rows=Math.max(0,Math.min(e.freeze.rows,e.rowCount)),e.freeze.cols=Math.max(0,Math.min(e.freeze.cols,e.colCount)),e.setFilter(gr(e.getFilter(),I,F,!1)),pf(e,I,F)}function r(I,F){const z=F-I+1,we=e.rowCount,Ee=e.colCount,{lastRow:Fe}=m();Fe>=I&&Fe+z>=we&&e.ensureCapacity(Ee-1,we-1+z);const Ve=e.rowCount,ke=ie(I,F),ce=[];for(const fe in e.cells){const ot=fe.indexOf(",");if(ot<0)continue;const vt=parseInt(fe.substring(0,ot),10),R=parseInt(fe.substring(ot+1),10);R>=I&&ce.push({oldKey:fe,newKey:e.cellKey(vt,R+z),cell:e.cells[fe],oldRow:R})}ce.sort((fe,ot)=>ot.oldRow-fe.oldRow);for(const fe of ce)Reflect.deleteProperty(e.cells,fe.oldKey),e.cells[fe.newKey]=fe.cell;for(const fe in e.cells){const ot=fe.indexOf(",");if(ot<0)continue;const vt=parseInt(fe.substring(ot+1),10);vt>=I&&vt<=F&&Reflect.deleteProperty(e.cells,fe)}const je=e.rowHeights.value,We=new Array(Ve);for(let fe=0;fe<I;fe++)We[fe]=je[fe];for(let fe=I;fe<=F;fe++)We[fe]=void 0;for(let fe=I;fe<Ve;fe++)We[fe+z]=je[fe];e.rowHeights.value=We,qe(ke),e.freeze.rows=Math.max(0,Math.min(e.freeze.rows,e.rowCount)),e.freeze.cols=Math.max(0,Math.min(e.freeze.cols,e.colCount)),e.setFilter(gr(e.getFilter(),I,F,!0)),hf(e,I,F)}function c(I,F){const z=F-I+1,we=e.colCount,Ee=e.rowCount,{lastCol:Fe}=m();Fe>=I&&Fe+z>=we&&e.ensureCapacity(we-1+z,Ee-1);const Ve=e.colCount,ke=he(I,F),ce=[];for(const fe in e.cells){const ot=fe.indexOf(",");if(ot<0)continue;const vt=parseInt(fe.substring(0,ot),10),R=parseInt(fe.substring(ot+1),10);vt>=I&&ce.push({oldKey:fe,newKey:e.cellKey(vt+z,R),cell:e.cells[fe],oldCol:vt})}ce.sort((fe,ot)=>ot.oldCol-fe.oldCol);for(const fe of ce)Reflect.deleteProperty(e.cells,fe.oldKey),e.cells[fe.newKey]=fe.cell;for(const fe in e.cells){const ot=fe.indexOf(",");if(ot<0)continue;const vt=parseInt(fe.substring(0,ot),10);vt>=I&&vt<=F&&Reflect.deleteProperty(e.cells,fe)}const je=e.colWidths.value,We=new Array(Ve);for(let fe=0;fe<I;fe++)We[fe]=je[fe];for(let fe=I;fe<=F;fe++)We[fe]=100;for(let fe=I;fe<Ve;fe++)We[fe+z]=je[fe];e.colWidths.value=We,qe(ke),e.freeze.rows=Math.max(0,Math.min(e.freeze.rows,e.rowCount)),e.freeze.cols=Math.max(0,Math.min(e.freeze.cols,e.colCount)),e.setFilter(br(e.getFilter(),I,F,!0)),bf(e,I,F)}function s(I,F){const z=F-I+1,we=ye(I,F),Ee=[],Fe=[];for(const ce in e.cells){const je=ce.indexOf(",");if(je<0)continue;const We=parseInt(ce.substring(0,je),10),fe=parseInt(ce.substring(je+1),10);We>=I&&We<=F?Fe.push(ce):We>F&&Ee.push({oldKey:ce,newKey:e.cellKey(We-z,fe),cell:e.cells[ce]})}for(const ce of Fe)Reflect.deleteProperty(e.cells,ce);for(const ce of Ee)Reflect.deleteProperty(e.cells,ce.oldKey),e.cells[ce.newKey]=ce.cell;const Ve=e.colWidths.value,ke=new Array(Ve.length);for(let ce=0;ce<I;ce++)ke[ce]=Ve[ce];for(let ce=I;ce<Ve.length-z;ce++)ke[ce]=Ve[ce+z];for(let ce=Ve.length-z;ce<Ve.length;ce++)ke[ce]=100;e.colWidths.value=ke,qe(we),e.freeze.rows=Math.max(0,Math.min(e.freeze.rows,e.rowCount)),e.freeze.cols=Math.max(0,Math.min(e.freeze.cols,e.colCount)),e.setFilter(br(e.getFilter(),I,F,!1)),gf(e,I,F)}function m(){let I=-1,F=-1;for(const z in e.cells){const we=z.split(",");if(we.length===2){const Ee=parseInt(we[0],10),Fe=parseInt(we[1],10),Ve=e.cells[z];Ve&&(Ve.value!==""||Ve.styleId!==void 0)&&(Ee>I&&(I=Ee),Fe>F&&(F=Fe))}}for(let z=e.colCount-1;z>=0;z--){const we=e.colWidths.value[z];if(we!==void 0&&we!==100){z>I&&(I=z);break}}for(let z=e.rowCount-1;z>=0;z--)if(e.rowHeights.value[z]!==void 0){z>F&&(F=z);break}return{lastCol:I,lastRow:F}}function v(I,F){const z=e.resolveStyle(e.cells[e.cellKey(I,F)]);return typeof(z==null?void 0:z.numberFormat)=="string"?z.numberFormat:""}function d(I,F,z){for(let we=F;we<=z;we++)if(e.getCellRaw(I,we).trim()!=="")return!0;return!1}function C(I){const{startRow:F,endRow:z,startCol:we,endCol:Ee}=I;let Fe=we,Ve=Ee;for(;Fe>0&&d(Fe-1,F,z);)Fe--;for(;Ve<e.colCount-1&&d(Ve+1,F,z);)Ve++;return{startRow:F,endRow:z,startCol:Fe,endCol:Ve}}function y(I){const F=C(I);return F.startCol!==I.startCol||F.endCol!==I.endCol}function h(I,F,z,we=I){let Ee,Fe;if(z)Ee=z.startRow,Fe=z.endRow;else{const fe=e.selection.value,ot=!!fe&&fe.startRow===fe.endRow&&fe.startCol===fe.endCol;Ee=ot||!fe?0:fe.startRow,Fe=ot||!fe?e.rowCount-1:fe.endRow}let Ve=-1,ke=-1;for(let fe=Ee;fe<=Fe;fe++){let ot=!1;for(let vt=I;vt<=F;vt++)if(e.getCellRaw(vt,fe).trim()!==""){ot=!0;break}ot&&(Ve<0&&(Ve=fe),ke=fe)}if(Ve<0)return null;const ce=[];for(let fe=Ve;fe<=ke;fe++){const ot=e.getCellRaw(we,fe);ce.push(hr(ot,v(we,fe),e.locale.value))}const je=mf(ce)?Ve+1:Ve;let We=!1;for(let fe=Ve;fe<=ke&&!We;fe++)for(let ot=I;ot<=F;ot++){const vt=e.cells[e.cellKey(ot,fe)];if(vt&&vt.value.startsWith("=")){We=!0;break}}if(!We)for(const fe in e.merges){const ot=e.merges[fe];if(ot&&ot.startCol<=F&&ot.endCol>=I&&ot.startRow<=Fe&&ot.endRow>=Ee){We=!0;break}}return{firstRow:Ve,lastRow:ke,sortStart:je,blocked:We}}function L(I,F){const z=h(I,F);return!!z&&!z.blocked&&z.sortStart<z.lastRow}function oe(I,F,z){var R,j;const we=F??e.selection.value;if(!we)return;const Ee=we.startCol,Fe=we.endCol,Ve=z??Ee,ke=h(Ee,Fe,{startRow:we.startRow,endRow:we.endRow},Ve);if(!ke||ke.blocked||ke.sortStart>=ke.lastRow)return;const ce=Fe-Ee+1,je=ke.lastRow-ke.sortStart+1,We=[],fe=[];for(let Z=ke.sortStart;Z<=ke.lastRow;Z++){const Se=new Array(ce);for(let Ce=Ee;Ce<=Fe;Ce++)Se[Ce-Ee]=e.cells[e.cellKey(Ce,Z)]??null;We.push(Se);const Re=e.getCellRaw(Ve,Z);fe.push(hr(Re,v(Ve,Z),e.locale.value))}const ot=ff(fe,I,e.locale.value);let vt=!1;for(let Z=0;Z<je;Z++)if(ot[Z]!==Z){vt=!0;break}if(vt){l.saveUndo();for(let Z=0;Z<je;Z++){const Se=We[ot[Z]],Re=ke.sortStart+Z;for(let Ce=Ee;Ce<=Fe;Ce++){const Ne=e.cellKey(Ce,Re),lt=Se[Ce-Ee],Ct=lt?lt.value:"",Ht=(R=e.cells[Ne])==null?void 0:R.styleId;Ct!==""||Ht!==void 0?e.cells[Ne]={value:Ct,styleId:Ht}:e.delCell(Ne)}}$n();for(let Z=ke.sortStart;Z<=ke.lastRow;Z++)for(let Se=Ee;Se<=Fe;Se++)e.formulaDeps.markDirty(e.cellKey(Se,Z));(j=e.scheduleRender)==null||j.call(e),xe()}}const te=t.ref(!1),Y=t.ref(null);function k(I){const F=e.selection.value;if(!F||!y(F))return!1;const z=C(F);return Y.value={order:I,originalRange:F,expandedRange:z},te.value=!0,!0}function Q(I){const F=Y.value;if(!F)return;const{order:z,originalRange:we,expandedRange:Ee}=F;te.value=!1,Y.value=null,oe(z,I?Ee:we,we.startCol),Ke.value=z}function le(){te.value=!1,Y.value=null}const se=t.ref(!1),Ke=t.ref("asc");function Oe(I){se.value=I,I&&(l.textColorMenuOpen.value=!1,l.fillColorMenuOpen.value=!1,l.fontSizeMenuOpen.value=!1)}function Ge(I){k(I)||(Ke.value=I,oe(I))}function Te(){k(Ke.value)||oe(Ke.value)}function qe(I){Object.keys(e.merges).forEach(F=>Reflect.deleteProperty(e.merges,F));for(const F of I)if(!(F.newRange.startCol>F.newRange.endCol||F.newRange.startRow>F.newRange.endRow)&&(e.merges[F.newAnchorKey]={...F.newRange},F.anchorCell)){const z=F.anchorCell.value,we=F.anchorCell.styleId;z===""&&!we||(e.cells[F.newAnchorKey]={value:z,styleId:we||void 0})}}function tt(I,F){const z=F-I+1,we=[];for(const Ee in e.merges){const Fe=e.merges[Ee];if(!Fe)continue;const Ve=e.cells[Ee]?{value:e.cells[Ee].value,styleId:e.cells[Ee].styleId??0}:{value:"",styleId:0},{startCol:ke,endCol:ce}=Fe;let{startRow:je,endRow:We}=Fe;if(je>F){je-=z,We-=z,we.push({newAnchorKey:e.cellKey(ke,je),newRange:{startCol:ke,startRow:je,endCol:ce,endRow:We}});continue}if(We<I){we.push({newAnchorKey:Ee,newRange:{startCol:ke,startRow:je,endCol:ce,endRow:We}});continue}if(je>=I&&We<=F||(je>=I&&je<=F&&(je=I),We>=I&&We<=F?We=I-1:We>F&&(We-=z),je>We))continue;const fe=ke,ot=je,vt=e.cellKey(fe,ot),j=Ee.split(",").map(Number)[1],Z=j>=I&&j<=F||fe!==Fe.startCol||ot!==j;we.push({newAnchorKey:vt,newRange:{startCol:ke,startRow:je,endCol:ce,endRow:We},anchorCell:Z?Ve:void 0})}return we}function ye(I,F){const z=F-I+1,we=[];for(const Ee in e.merges){const Fe=e.merges[Ee];if(!Fe)continue;const Ve=e.cells[Ee]?{value:e.cells[Ee].value,styleId:e.cells[Ee].styleId??0}:{value:"",styleId:0};let{startCol:ke,endCol:ce}=Fe;const{startRow:je,endRow:We}=Fe;if(ke>F){ke-=z,ce-=z,we.push({newAnchorKey:e.cellKey(ke,je),newRange:{startCol:ke,startRow:je,endCol:ce,endRow:We}});continue}if(ce<I){we.push({newAnchorKey:Ee,newRange:{startCol:ke,startRow:je,endCol:ce,endRow:We}});continue}if(ke>=I&&ce<=F||(ke>=I&&ke<=F&&(ke=I),ce>=I&&ce<=F?ce=I-1:ce>F&&(ce-=z),ke>ce))continue;const fe=ke,ot=je,vt=e.cellKey(fe,ot),j=Ee.split(",").map(Number)[0],Z=j>=I&&j<=F||fe!==j||ot!==Fe.startRow;we.push({newAnchorKey:vt,newRange:{startCol:ke,startRow:je,endCol:ce,endRow:We},anchorCell:Z?Ve:void 0})}return we}function ie(I,F){const z=F-I+1,we=[];for(const Ee in e.merges){const Fe=e.merges[Ee];if(!Fe)continue;const{startCol:Ve,endCol:ke}=Fe;let{startRow:ce,endRow:je}=Fe;je<I?we.push({newAnchorKey:Ee,newRange:{startCol:Ve,startRow:ce,endCol:ke,endRow:je}}):ce>F?(ce+=z,je+=z,we.push({newAnchorKey:e.cellKey(Ve,ce),newRange:{startCol:Ve,startRow:ce,endCol:ke,endRow:je}})):(je+=z,we.push({newAnchorKey:Ee,newRange:{startCol:Ve,startRow:ce,endCol:ke,endRow:je}}))}return we}function he(I,F){const z=F-I+1,we=[];for(const Ee in e.merges){const Fe=e.merges[Ee];if(!Fe)continue;let{startCol:Ve,endCol:ke}=Fe;const{startRow:ce,endRow:je}=Fe;ke<I?we.push({newAnchorKey:Ee,newRange:{startCol:Ve,startRow:ce,endCol:ke,endRow:je}}):Ve>F?(Ve+=z,ke+=z,we.push({newAnchorKey:e.cellKey(Ve,ce),newRange:{startCol:Ve,startRow:ce,endCol:ke,endRow:je}})):(ke+=z,we.push({newAnchorKey:Ee,newRange:{startCol:Ve,startRow:ce,endCol:ke,endRow:je}}))}return we}let Ae=0;function dt(){return Ae++,`s_${Ae}`}function ue(I,F){const z=Math.max(1,(F==null?void 0:F.colCount)??e.colCount),we=Math.max(1,(F==null?void 0:F.rowCount)??e.rowCount),Ee=new Array(z).fill(100),Fe=new Array(we).fill(void 0);return{id:dt(),name:I,cells:{},merges:{},styles:[{}],borders:[{}],selection:{startCol:0,startRow:0,endCol:0,endRow:0},activeCell:{col:0,row:0},scrollX:0,scrollY:0,colWidths:Ee,rowHeights:Fe,colCount:z,rowCount:we,freeze:{rows:0,cols:0},filter:null,conditionalFormats:[]}}const ve=t.ref([ue("Sheet1")]),p=t.ref(0);function A(){const I=ve.value[p.value];I&&(I.cells={...e.cells},I.merges={...e.merges},I.selection=e.selection.value?{...e.selection.value}:null,I.activeCell={...e.activeCell.value},I.scrollX=e.scrollX.value,I.scrollY=e.scrollY.value,I.colWidths=[...e.colWidths.value],I.rowHeights=[...e.rowHeights.value],I.styles=[...e.styles],I.borders=[...e.borders],I.colCount=e.colCount,I.rowCount=e.rowCount,I.freeze={rows:e.freeze.rows,cols:e.freeze.cols},I.filter=Mo(e.getFilter()),I.conditionalFormats=[...e.conditionalFormats])}function $(I){var ce,je;const F=ve.value[I];if(!F)return;Object.keys(e.cells).forEach(We=>e.delCell(We)),Object.assign(e.cells,F.cells),Object.keys(e.merges).forEach(We=>Reflect.deleteProperty(e.merges,We)),F.merges&&Object.assign(e.merges,F.merges),e.selection.value=F.selection?{...F.selection}:null,e.activeCell.value={...F.activeCell};const z=e.activeCell.value,we=e.selection.value,Ee=e.findMerge(z.col,z.row);Ee&&Ee.anchor===e.cellKey(z.col,z.row)&&(!we||we.startCol===z.col&&we.startRow===z.row&&we.endCol===z.col&&we.endRow===z.row)&&e.selectCell(z.col,z.row),e.scrollX.value=F.scrollX,e.scrollY.value=F.scrollY,e.colWidths.value=[...F.colWidths],e.rowHeights.value=[...F.rowHeights];const Fe=Math.max(1,F.colCount??e.colCount),Ve=Math.max(1,F.rowCount??e.rowCount);if((ce=e.setDims)==null||ce.call(e,Fe,Ve),e.freeze.rows=Math.max(0,Math.min(F.freeze.rows,e.rowCount)),e.freeze.cols=Math.max(0,Math.min(F.freeze.cols,e.colCount)),F.filter){const We=F.filter.range;e.setFilter({range:{startCol:Math.max(0,Math.min(We.startCol,e.colCount-1)),endCol:Math.max(0,Math.min(We.endCol,e.colCount-1)),startRow:Math.max(0,Math.min(We.startRow,e.rowCount-1)),endRow:Math.max(0,Math.min(We.endRow,e.rowCount-1))},columns:{...F.filter.columns}},!0)}else e.setFilter(null,!0);e.syncStyles(F.styles),e.syncBorders(F.borders??[{}]);const ke=F.conditionalFormats?F.conditionalFormats.map(We=>({...We,ranges:We.ranges.map(fe=>({...fe}))})):[];e.conditionalFormats.splice(0,e.conditionalFormats.length,...ke),(je=e.invalidateConditionalFormatCache)==null||je.call(e),p.value=I}function ee(I){I===p.value||I<0||I>=ve.value.length||(e.cancelEdit(),A(),$(I))}function U(I){return l.saveUndo(),e.cancelEdit(),A(),ve.value.push(ue(I??`Sheet${ve.value.length+1}`)),$(ve.value.length-1),ve.value.length-1}function O(I){return ve.value.length<=1||(l.saveUndo(),e.cancelEdit(),ve.value.splice(I,1),$(Math.min(I,ve.value.length-1))),p.value}function x(I,F){ve.value[I]&&F.trim()&&(l.saveUndo(),ve.value[I].name=F.trim())}function X(I){l.saveUndo(),e.cancelEdit(),A();const F=ve.value[I];if(!F)return I;let z=F.name;const we=z.match(/^(.*?)\s*\((\d+)\)$/);let Ee=we?parseInt(we[2],10)+1:2;we&&(z=we[1]);let Fe=`${z} (${Ee})`;const Ve=new Set(ve.value.map(ce=>ce.name));for(;Ve.has(Fe);)Ee++,Fe=`${z} (${Ee})`;const ke={id:dt(),name:Fe,cells:{...F.cells},merges:F.merges?{...F.merges}:{},styles:[...F.styles],borders:F.borders?[...F.borders]:[{}],selection:F.selection?{...F.selection}:null,activeCell:F.activeCell?{...F.activeCell}:{col:0,row:0},scrollX:F.scrollX,scrollY:F.scrollY,colWidths:[...F.colWidths],rowHeights:[...F.rowHeights],colCount:F.colCount,rowCount:F.rowCount,freeze:{...F.freeze},filter:Mo(F.filter),conditionalFormats:F.conditionalFormats?F.conditionalFormats.map(ce=>({...ce})):[]};return ve.value.splice(I+1,0,ke),$(I+1),I+1}function Le(I,F){var Fe;const z=I+F;if(z<0||z>=ve.value.length)return;l.saveUndo();const we=p.value,Ee=ve.value.splice(I,1)[0];ve.value.splice(z,0,Ee),we===I?p.value=z:I<we&&z>=we?p.value=we-1:I>we&&z<=we&&(p.value=we+1),(Fe=e.scheduleRender)==null||Fe.call(e)}const re=t.computed(()=>ve.value.length);let V="";const G=o;function xe(){A();const I=ve.value.map(z=>{const we={};for(const[ke,ce]of Object.entries(z.cells))we[ke]={value:ce.value},ce.styleId&&ce.styleId>0&&(we[ke].styleId=ce.styleId);const Ee={name:z.name,cells:we};z.styles&&z.styles.length>1&&(Ee.styles=[...z.styles]),z.borders&&z.borders.length>1&&(Ee.borders=[...z.borders]),z.merges&&Object.keys(z.merges).length&&(Ee.merges={...z.merges});const Fe={};for(let ke=0;ke<z.colWidths.length;ke++)z.colWidths[ke]!==100&&(Fe[ke]=z.colWidths[ke]);Object.keys(Fe).length&&(Ee.colWidths=Fe);const Ve={};for(let ke=0;ke<z.rowHeights.length;ke++){const ce=z.rowHeights[ke];ce!=null&&(Ve[ke]=ce)}return Object.keys(Ve).length&&(Ee.rowHeights=Ve),z.colCount!==26&&(Ee.colCount=z.colCount),z.rowCount!==200&&(Ee.rowCount=z.rowCount),(z.freeze.rows!==0||z.freeze.cols!==0)&&(Ee.freeze={rows:z.freeze.rows,cols:z.freeze.cols}),z.filter&&(Ee.filter=Mo(z.filter)),z.conditionalFormats&&z.conditionalFormats.length&&(Ee.conditionalFormats=z.conditionalFormats.map(ke=>({...ke}))),Ee}),F=JSON.stringify(I);F!==V&&(V=F,G.value=I,a&&(a.value=F))}e.emitModelData=xe;let $e=!1;function bt(){$e||($e=!0,Promise.resolve().then(()=>{$e=!1,xe()}))}const ge=t.computed(()=>e.props.theme==="dark"?Or:Lr),pe=t.computed(()=>df(ge.value,e.props.width,e.props.height,wn)),it=t.computed(()=>{const I={};for(const[F,z]of Object.entries(pe.value))F.startsWith("--")&&(I[F]=z);return I}),It=t.ref(null),Je=t.ref(null),E=t.ref(null),ne=t.ref(null),Et=t.ref(null),Dt=t.reactive({w:800,h:600});e.viewSize&&t.watch(Dt,I=>{e.viewSize&&(e.viewSize.w=I.w,e.viewSize.h=I.h)},{deep:!0});const Ot=48,de=28,g=11,M=t.computed(()=>Math.max(0,e.totalWidth.value-Math.max(0,Dt.w-Ot-g))),Vt=t.computed(()=>Math.max(0,e.totalHeight.value-Math.max(0,Dt.h-de-g)));function Mt(I,F){const z=Math.max(0,Dt.w-Ot-g),we=Math.max(0,Dt.h-de-g),Ee=I??e.scrollX.value,Fe=F??e.scrollY.value,Ve=40,ke=Math.max(0,e.totalWidth.value-z),ce=Math.max(0,e.totalHeight.value-we);if(Ee>=ke-Ve&&Ee>e.scrollX.value||Fe>=ce-Ve&&Fe>e.scrollY.value){const je=Math.max(0,Math.ceil((Ee+z)/100)+2),We=Math.max(0,Math.ceil((Fe+we)/24)+2);e.ensureCapacity(je,We)}e.scrollX.value=Math.max(0,Math.min(Ee,Math.max(0,e.totalWidth.value-z))),e.scrollY.value=Math.max(0,Math.min(Fe,Math.max(0,e.totalHeight.value-we)))}e.clampScroll=Mt;function el(){var I;return typeof window>"u"?!1:!((I=window.matchMedia)!=null&&I.call(window,"(hover: none) and (pointer: coarse)").matches)}function Ut(I=!1){t.nextTick(()=>{const F=ne.value;if(F){if(!e.editingCell.value&&!el()){document.activeElement===F&&F.blur();return}F.focus({preventScroll:!0}),I&&F.select()}})}function Cl(){Ut()}function Xl(){var F;const I=e.selection.value;if(I){l.saveUndo();for(let z=I.startRow;z<=I.endRow;z++)e.rowHeights.value[z]=void 0;(F=e.scheduleRender)==null||F.call(e),xe()}}function dn(){var F;const I=e.selection.value;if(I){l.saveUndo();for(let z=I.startCol;z<=I.endCol;z++)e.colWidths.value[z]=100;(F=e.scheduleRender)==null||F.call(e),xe()}}return{deleteRows:i,insertRows:r,insertCols:c,deleteCols:s,sortSelectedColumns:oe,canSortColumns:L,sortMenuOpen:se,cachedSortOrder:Ke,onSortMenuToggle:Oe,onSortChange:Ge,applyCachedSort:Te,sortConfirmOpen:te,prepareSortConfirmation:k,confirmSort:Q,cancelSortConfirmation:le,sheets:ve,activeSheetIndex:p,saveSheet:A,loadSheet:$,switchSheet:ee,addSheet:U,removeSheet:O,renameSheet:x,dupSheet:X,moveSheet:Le,sheetCount:re,mkSheet:ue,emitModelData:xe,scheduleOptEmit:bt,themeColors:ge,outerStyle:pe,toolbarThemeVars:it,wrapperRef:It,canvasRef:Je,freezeCanvasRef:E,editInputRef:ne,formulaBarRef:Et,viewSize:Dt,maxScrollX:M,maxScrollY:Vt,clampScroll:Mt,canFocusHiddenEditor:el,focusEditInput:Ut,onCanvasFocus:Cl,resetRowHeight:Xl,resetColWidth:dn,modelData:G}}function wr(e){return!!e&&e.width!==void 0&&e.width>0}function Wt(e,l,o,n){const a=wr(e),i=wr(l);if(!a&&!i)return;if(a&&!i)return e;if(!a&&i)return l;const r=e.width??0,c=l.width??0;return r>c?e:c>r?l:e}function vr(e,l){if(!e||typeof e!="object")return null;const o=e,n=o.columns??{},a=Object.keys(n).map(r=>Number(r)).filter(r=>!Number.isNaN(r));if(!o.range||typeof o.range.startRow!="number"){const r=a.length?Math.min(...a):0,c=a.length?Math.max(...a):0;let s=0;for(const m in l){const v=m.indexOf(",");if(v<0)continue;const d=parseInt(m.substring(v+1),10);d>s&&(s=d)}return{range:{startCol:r,startRow:0,endCol:c,endRow:Math.max(0,s)},columns:n}}const i={...o.range};for(const r of a)r<i.startCol&&(i.startCol=r),r>i.endCol&&(i.endCol=r);return{range:i,columns:n}}function yf(e,l,o,n,a){let i=!1,r=null,c=1,s=()=>{},m=()=>{},v=()=>{};function d(){i||(i=!0,requestAnimationFrame(()=>{i=!1,L(),oe()}))}e.scheduleRender=d;function C(u){const{frozenColumnsWidth:b}=e.getFrozenMetrics(),T=b>0&&u<52+b?u-52:u-52+e.scrollX.value;return e.hitCol(T)}function y(u){const{frozenRowsHeight:b}=e.getFrozenMetrics(),T=b>0&&u<24+b?u-24:u-24+e.scrollY.value;return e.hitRow(T)}const h="#444";function L(){const u=n.wrapperRef.value,b=n.canvasRef.value;if(!u||!b||(r=b.getContext("2d"),!r))return;c=window.devicePixelRatio||1;const T=u.getBoundingClientRect(),P=T.width,N=T.height;n.viewSize.w=P,n.viewSize.h=N,b.width=P*c,b.height=N*c,b.style.width=P+"px",b.style.height=N+"px",r.setTransform(c,0,0,c,0,0);const q=e.scrollX.value,W=e.scrollY.value,H=52,ae=24,Be=n.themeColors.value,Pe=e.getFilter(),ut=e.colPositions.value,yt=e.rowPositions.value,Rt=e.colWidths.value,{frozenRowsHeight:Lt,frozenColumnsWidth:il}=e.getFrozenMetrics(),fl=H+il,Nl=ae+Lt,Ql=Math.max(0,P-H-11-il),mn=Math.max(0,N-ae-11-Lt),pn=Math.max(0,e.freeze.cols-1),hn=Math.max(0,e.freeze.rows-1),en=Math.max(e.freeze.cols,e.hitCol(il+q));let gn=en;for(let D=en;D<e.colCount&&!(H+ut[D]-q>=P);D++)gn=D;const El=Math.max(e.freeze.rows,e.hitRow(Lt+W));let Ol=El;for(let D=El;D<e.rowCount&&!(ae+yt[D]-W>=N);D++)Ol=D;let cl=en,sl=gn,ml=El,zl=Ol;il>0&&(cl=0,sl=Math.max(sl,pn)),Lt>0&&(ml=0,zl=Math.max(zl,hn));let _l=cl,tn=ml;for(const D in e.merges){const Ie=e.merges[D];Ie&&(Ie.startRow>zl||Ie.endRow<ml||Ie.startCol>sl||Ie.endCol<cl||(Ie.startCol<_l&&(_l=Ie.startCol),Ie.startRow<tn&&(tn=Ie.startRow)))}const $l=new Array(tn);for(let D=tn;D<=zl;D++)$l[D]=yt[D+1]-yt[D];r.fillStyle=Be.bg,r.fillRect(0,0,P,N),r.fillStyle=Be.gridBg,r.fillRect(H,ae,P-H,N-ae);const Ft=e.selection.value,Bn=e.editingCell.value;s=(D,Ie,Ze,Tt,Gt,_t)=>{for(let st=Tt;st<=Gt;st++)for(let De=Ie;De<=Ze;De++){if(e.findMerge(De,st))continue;const ft=e.cellToScreenRect(st,De),et=ft.x,nt=ft.y,mt=ft.width,rt=ft.height;if(et+mt<H||nt+rt<ae||et>P||nt>N)continue;const St=e.findHighlight?e.findHighlight(De,st):null,Nt=e.resolveStyle(e.cells[e.cellKey(De,st)]),$t=typeof(Nt==null?void 0:Nt.backgroundColor)=="string"?Nt.backgroundColor:"";$t&&(D.fillStyle=$t,D.fillRect(et,nt,mt,rt));const Xe=e.resolveConditionalFormat(De,st);if(Xe!=null&&Xe.backgroundColor&&(D.fillStyle=Xe.backgroundColor,D.fillRect(et,nt,mt,rt)),St&&(D.fillStyle=St==="active"?Be.findActiveBg:Be.findMatchBg,D.fillRect(et,nt,mt,rt)),e.isSelected(De,st)&&(D.fillStyle=Be.selectionBg,e.selectionMode.value==="row"||e.selectionMode.value==="col"?D.fillRect(et,nt,Rt[De],_t[st]):D.fillRect(et,nt,mt,rt)),e.activeCell.value.col===De&&e.activeCell.value.row===st&&(D.strokeStyle=Be.activeCellBorder,D.lineWidth=2,D.strokeRect(et+1,nt+1,mt-2,rt-2)),St==="active"&&(D.strokeStyle=Be.findActiveBg,D.lineWidth=2,D.strokeRect(et+1,nt+1,mt-2,rt-2)),D.strokeStyle=Be.gridLine,D.lineWidth=.5,D.strokeRect(et+.25,nt+.25,mt-.5,rt-.5),!(Bn&&Bn.col===De&&Bn.row===st)){const J=e.resolveStyle(e.cells[e.cellKey(De,st)]),ze=e.getCellValue(De,st),_e=typeof(J==null?void 0:J.numberFormat)=="string"?J.numberFormat:"",pt=ze?Rl(ze,_e,e.locale.value):"";if(pt){const At=e.cellFontSize(De,st),qt=typeof(J==null?void 0:J.fontFamily)=="string"&&J.fontFamily?J.fontFamily:yn,nl=(J==null?void 0:J.fontWeight)==="bold"||(Xe==null?void 0:Xe.fontWeight)==="bold"?"bold":"normal",ln=(J==null?void 0:J.fontStyle)==="italic"||(Xe==null?void 0:Xe.fontStyle)==="italic"?"italic":"normal",Wl=(J==null?void 0:J.underline)==="underline"||(Xe==null?void 0:Xe.underline)==="underline",bn=(J==null?void 0:J.strikethrough)==="line-through"||(Xe==null?void 0:Xe.strikethrough)==="line-through",nn=(Xe==null?void 0:Xe.color)||(typeof(J==null?void 0:J.color)=="string"?J.color:""),Pl=typeof(J==null?void 0:J.textAlign)=="string"?J.textAlign:fo(ze,_e)?"right":"left",On=typeof(J==null?void 0:J.verticalAlign)=="string"?J.verticalAlign:"top";D.fillStyle=nn||Be.cellText,D.font=`${ln} ${nl} ${At}px ${qt}`,D.textBaseline="alphabetic",D.save(),D.beginPath(),D.rect(et+5,nt+1,mt-10,rt-2),D.clip();const on=(J==null?void 0:J.wrap)==="wrap";let dl=mt-10;Pe&&st===Pe.range.startRow&&De>=Pe.range.startCol&&De<=Pe.range.endCol&&(dl=mt-10-O);let Vl=pt;const pl=!on&&zo(_e),Fl=pt===qn||_o(ze,_e);if(Fl||pl){if(Fl){const Tn=Math.max(1,D.measureText("#").width),Gn=Math.max(1,Math.floor(dl/Tn));Vl="#".repeat(Gn)}else if(e.getWrappedLines(D,pt,1e9,!1).some(rn=>rn&&D.measureText(rn).width>dl)){const rn=Math.max(1,D.measureText("#").width),zn=Math.max(1,Math.floor(dl/rn));Vl="#".repeat(zn)}}const hl=e.getWrappedLines(D,Vl,dl,on),{ascent:xn,descent:ro}=e.measureFontMetrics(qt,At,nl,ln),ao=xn+ro,Wf=hl.length*ao;let io;On==="middle"?io=nt+(rt-Wf)/2+xn:On==="bottom"?io=nt+rt-e.BASE_CELL_VPAD-ro-(hl.length-1)*ao:io=nt+e.BASE_CELL_VPAD+xn;for(let Tn=0;Tn<hl.length;Tn++){const Gn=hl[Tn],rn=io+Tn*ao,zn=D.measureText(Gn);let Cn;if(Pl==="center"?Cn=et+mt/2-zn.width/2:Pl==="right"?Cn=et+mt-5-zn.width:Cn=et+5,D.fillText(Gn,Cn,rn),Wl&&(D.strokeStyle=nn||Be.cellText,D.lineWidth=1,D.beginPath(),D.moveTo(Cn,rn+ro+1),D.lineTo(Cn+zn.width,rn+ro+1),D.stroke()),bn){D.strokeStyle=nn||Be.cellText,D.lineWidth=1;const Sr=rn-xn+ao*.42;D.beginPath(),D.moveTo(Cn,Sr),D.lineTo(Cn+zn.width,Sr),D.stroke()}}D.restore()}}Pe&&st===Pe.range.startRow&&De>=Pe.range.startCol&&De<=Pe.range.endCol&&V(D,et,nt,mt,rt,nr(Pe.columns[De]),Be)}};const at=(D,Ie,Ze)=>{const Tt=e.findMerge(D,Ie);return Tt?e.getCellBorderSide(e.cells[Tt.anchor],Ze):e.getCellBorderSide(e.cells[e.cellKey(D,Ie)],Ze)};m=(D,Ie,Ze,Tt,Gt,_t)=>{D.fillStyle=h;for(let st=Tt;st<=Gt;st++)for(let De=Ie;De<=Ze;De++){if(e.findMerge(De,st))continue;const ft=e.cellToScreenRect(st,De),et=ft.x,nt=ft.y,mt=ft.width,rt=ft.height;if(et+mt<H||nt+rt<ae||et>P||nt>N)continue;const St=e.cells[e.cellKey(De,st)],Nt={top:e.getCellBorderSide(St,"top"),right:e.getCellBorderSide(St,"right"),bottom:e.getCellBorderSide(St,"bottom"),left:e.getCellBorderSide(St,"left")},$t={top:at(De,st-1,"bottom"),left:at(De-1,st,"right"),bottom:at(De,st+1,"top"),right:at(De+1,st,"left")},Xe=Wt($t.top,Nt.top),J=Wt($t.left,Nt.left),ze=Wt(Nt.bottom,$t.bottom),_e=Wt(Nt.right,$t.right),pt=(Xe==null?void 0:Xe.width)??0,At=(J==null?void 0:J.width)??0,qt=(ze==null?void 0:ze.width)??0,nl=(_e==null?void 0:_e.width)??0;pt>0&&(D.fillStyle=(Xe==null?void 0:Xe.color)||h,D.fillRect(et,nt,mt,pt)),qt>0&&(D.fillStyle=(ze==null?void 0:ze.color)||h,D.fillRect(et,nt+rt-qt,mt,qt)),At>0&&(D.fillStyle=(J==null?void 0:J.color)||h,D.fillRect(et,nt,At,rt)),nl>0&&(D.fillStyle=(_e==null?void 0:_e.color)||h,D.fillRect(et+mt-nl,nt,nl,rt)),pt>0&&At>0&&(D.fillStyle=(Xe==null?void 0:Xe.color)||(J==null?void 0:J.color)||h,D.fillRect(et-At,nt-pt,At,pt)),pt>0&&nl>0&&(D.fillStyle=(Xe==null?void 0:Xe.color)||(_e==null?void 0:_e.color)||h,D.fillRect(et+mt,nt-pt,nl,pt)),qt>0&&At>0&&(D.fillStyle=(ze==null?void 0:ze.color)||(J==null?void 0:J.color)||h,D.fillRect(et-At,nt+rt,At,qt)),qt>0&&nl>0&&(D.fillStyle=(ze==null?void 0:ze.color)||(_e==null?void 0:_e.color)||h,D.fillRect(et+mt,nt+rt,nl,qt))}};const Pt=(D,Ie,Ze,Tt,Gt,_t,st)=>{const De=e.resolveStyle(e.cells[e.cellKey(Ie,Ze)]),wt=e.getCellValue(Ie,Ze),ft=typeof(De==null?void 0:De.numberFormat)=="string"?De.numberFormat:"",et=wt?Rl(wt,ft,e.locale.value):"";if(!et)return;const nt=e.cellFontSize(Ie,Ze),mt=typeof(De==null?void 0:De.fontFamily)=="string"&&De.fontFamily?De.fontFamily:yn,rt=e.resolveConditionalFormat(Ie,Ze),St=(De==null?void 0:De.fontWeight)==="bold"||(rt==null?void 0:rt.fontWeight)==="bold"?"bold":"normal",Nt=(De==null?void 0:De.fontStyle)==="italic"||(rt==null?void 0:rt.fontStyle)==="italic"?"italic":"normal",$t=(De==null?void 0:De.underline)==="underline"||(rt==null?void 0:rt.underline)==="underline",Xe=(De==null?void 0:De.strikethrough)==="line-through"||(rt==null?void 0:rt.strikethrough)==="line-through",J=(rt==null?void 0:rt.color)||(typeof(De==null?void 0:De.color)=="string"?De.color:""),ze=typeof(De==null?void 0:De.textAlign)=="string"?De.textAlign:fo(wt,ft)?"right":"left",_e=typeof(De==null?void 0:De.verticalAlign)=="string"?De.verticalAlign:"top";D.fillStyle=J||Be.cellText,D.font=`${Nt} ${St} ${nt}px ${mt}`,D.textBaseline="alphabetic",D.save(),D.beginPath(),D.rect(_t+5,st+1,Tt-10,Gt-2),D.clip();const pt=(De==null?void 0:De.wrap)==="wrap",At=Tt-10;let qt=et;const nl=!pt&&zo(ft),ln=et===qn||_o(wt,ft);if(ln||nl){if(ln){const dl=Math.max(1,D.measureText("#").width),Vl=Math.max(1,Math.floor(At/dl));qt="#".repeat(Vl)}else if(e.getWrappedLines(D,et,1e9,!1).some(pl=>pl&&D.measureText(pl).width>At)){const pl=Math.max(1,D.measureText("#").width),Fl=Math.max(1,Math.floor(At/pl));qt="#".repeat(Fl)}}const Wl=e.getWrappedLines(D,qt,At,pt),{ascent:bn,descent:nn}=e.measureFontMetrics(mt,nt,St,Nt),Pl=bn+nn,On=Wl.length*Pl;let on;_e==="middle"?on=st+(Gt-On)/2+bn:_e==="bottom"?on=st+Gt-e.BASE_CELL_VPAD-nn-(Wl.length-1)*Pl:on=st+e.BASE_CELL_VPAD+bn;for(let dl=0;dl<Wl.length;dl++){const Vl=Wl[dl],pl=on+dl*Pl,Fl=D.measureText(Vl);let hl;if(ze==="center"?hl=_t+Tt/2-Fl.width/2:ze==="right"?hl=_t+Tt-5-Fl.width:hl=_t+5,D.fillText(Vl,hl,pl),$t&&(D.strokeStyle=J||Be.cellText,D.lineWidth=1,D.beginPath(),D.moveTo(hl,pl+nn+1),D.lineTo(hl+Fl.width,pl+nn+1),D.stroke()),Xe){D.strokeStyle=J||Be.cellText,D.lineWidth=1;const xn=pl-bn+Pl*.42;D.beginPath(),D.moveTo(hl,xn),D.lineTo(hl+Fl.width,xn),D.stroke()}}D.restore()},Dl=(D,Ie,Ze,Tt,Gt,_t,st,De)=>{const wt=Ie.startCol,ft=Ie.endCol,et=Ie.startRow,nt=Ie.endRow,mt=Tt,rt=_t,St=st&&ft>=e.freeze.cols,Nt=De&&nt>=e.freeze.rows,$t=e.cells[e.cellKey(wt,et)],Xe={top:e.getCellBorderSide($t,"top"),right:e.getCellBorderSide($t,"right"),bottom:e.getCellBorderSide($t,"bottom"),left:e.getCellBorderSide($t,"left")};D.fillStyle=h;for(let J=wt;J<=ft;J++){if(st&&J>=e.freeze.cols||e.isSameMergeInternal(J,et-1,J,et))continue;const ze=at(J,et-1,"bottom"),_e=Wt(ze,Xe.top);if(_e&&_e.width&&_e.width>0){const pt=J<e.freeze.cols?H+ut[J]:H+ut[J]-q;D.fillStyle=_e.color||h,D.fillRect(pt,mt,Rt[J],_e.width)}}if(!Nt)for(let J=wt;J<=ft;J++){if(st&&J>=e.freeze.cols||e.isSameMergeInternal(J,nt,J,nt+1))continue;const ze=at(J,nt+1,"top"),_e=Wt(Xe.bottom,ze);if(_e&&_e.width&&_e.width>0){const pt=J<e.freeze.cols?H+ut[J]:H+ut[J]-q;D.fillStyle=_e.color||h,D.fillRect(pt,mt+rt-_e.width,Rt[J],_e.width)}}for(let J=et;J<=nt;J++){if(De&&J>=e.freeze.rows||e.isSameMergeInternal(wt-1,J,wt,J))continue;const ze=at(wt-1,J,"right"),_e=Wt(ze,Xe.left);if(_e&&_e.width&&_e.width>0){const pt=J<e.freeze.rows?ae+yt[J]:ae+yt[J]-W,At=yt[J+1]-yt[J];D.fillStyle=_e.color||h,D.fillRect(Ze,pt,_e.width,At)}}if(!St)for(let J=et;J<=nt;J++){if(De&&J>=e.freeze.rows||e.isSameMergeInternal(ft,J,ft+1,J))continue;const ze=at(ft+1,J,"left"),_e=Wt(Xe.right,ze);if(_e&&_e.width&&_e.width>0){const pt=J<e.freeze.rows?ae+yt[J]:ae+yt[J]-W,At=yt[J+1]-yt[J];D.fillStyle=_e.color||h,D.fillRect(Ze+Gt-_e.width,pt,_e.width,At)}}{const J=e.isSameMergeInternal(wt,et-1,wt,et)?Xe.top:Wt(at(wt,et-1,"bottom"),Xe.top),ze=e.isSameMergeInternal(wt-1,et,wt,et)?Xe.left:Wt(at(wt-1,et,"right"),Xe.left),_e=(J==null?void 0:J.width)??0,pt=(ze==null?void 0:ze.width)??0;_e>0&&pt>0&&(D.fillStyle=(J==null?void 0:J.color)||(ze==null?void 0:ze.color)||h,D.fillRect(Ze-pt,Tt-_e,pt,_e))}if(!St){const J=e.isSameMergeInternal(ft,et-1,ft,et)?Xe.top:Wt(at(ft,et-1,"bottom"),Xe.top),ze=e.isSameMergeInternal(ft,et,ft+1,et)?Xe.right:Wt(Xe.right,at(ft+1,et,"left")),_e=(J==null?void 0:J.width)??0,pt=(ze==null?void 0:ze.width)??0;_e>0&&pt>0&&(D.fillStyle=(J==null?void 0:J.color)||(ze==null?void 0:ze.color)||h,D.fillRect(Ze+Gt,Tt-_e,pt,_e))}if(!Nt){const J=e.isSameMergeInternal(wt,nt,wt,nt+1)?Xe.bottom:Wt(Xe.bottom,at(wt,nt+1,"top")),ze=e.isSameMergeInternal(wt-1,nt,wt,nt)?Xe.left:Wt(at(wt-1,nt,"right"),Xe.left),_e=(J==null?void 0:J.width)??0,pt=(ze==null?void 0:ze.width)??0;_e>0&&pt>0&&(D.fillStyle=(J==null?void 0:J.color)||(ze==null?void 0:ze.color)||h,D.fillRect(Ze-pt,Tt+_t,pt,_e))}if(!St&&!Nt){const J=e.isSameMergeInternal(ft,nt,ft,nt+1)?Xe.bottom:Wt(Xe.bottom,at(ft,nt+1,"top")),ze=e.isSameMergeInternal(ft,nt,ft+1,nt)?Xe.right:Wt(Xe.right,at(ft+1,nt,"left")),_e=(J==null?void 0:J.width)??0,pt=(ze==null?void 0:ze.width)??0;_e>0&&pt>0&&(D.fillStyle=(J==null?void 0:J.color)||(ze==null?void 0:ze.color)||h,D.fillRect(Ze+Gt,Tt+_t,pt,_e))}};v=(D,Ie,Ze,Tt,Gt)=>{var ft,et;const _t=Ie+Tt,st=Ze+Gt,De=Ie<fl,wt=Ze<Nl;for(const nt in e.merges){const mt=e.merges[nt];if(!mt)continue;const rt=mt.startCol,St=mt.startRow,Nt=mt.endCol,$t=mt.endRow,Xe=e.cellToScreenRect(St,rt),J=e.cellToScreenRect($t,Nt),ze=Xe.x,_e=Xe.y,pt=J.x+J.width-ze,At=J.y+J.height-_e,qt=De&&Nt>=e.freeze.cols?Math.min(_t,fl):Math.min(ze+pt,_t),nl=wt&&$t>=e.freeze.rows?Math.min(st,Nl):Math.min(_e+At,st),ln=Math.max(ze,Ie),Wl=Math.max(_e,Ze);if(qt<=ln||nl<=Wl)continue;const bn=(ft=e.resolveStyle(e.cells[e.cellKey(rt,St)]))==null?void 0:ft.backgroundColor,Pl=((et=e.resolveConditionalFormat(rt,St))==null?void 0:et.backgroundColor)||bn;if(Pl&&(D.fillStyle=Pl,D.fillRect(ln,Wl,qt-ln,nl-Wl)),D.strokeStyle=Be.gridLine,D.lineWidth=.5,D.strokeRect(ze+.25,_e+.25,qt-ze-.5,nl-_e-.5),Dl(D,mt,ze,_e,pt,At,De,wt),!(e.editingCell.value&&e.editingCell.value.col===rt&&e.editingCell.value.row===St)){const On=ut[Nt+1]-ut[rt],on=yt[$t+1]-yt[St],dl=rt<e.freeze.cols,Vl=St<e.freeze.rows,pl=De?ze:dl?ze-q:ze,Fl=wt?_e:Vl?_e-W:_e;Pt(D,rt,St,On,on,pl,Fl)}}},r.save(),r.beginPath(),r.rect(fl,Nl,Ql,mn),r.clip(),s(r,_l,sl,tn,zl,$l),m(r,_l,sl,tn,zl,$l),v(r,fl,Nl,Ql,mn),r.restore(),il>0&&(r.strokeStyle=Be.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(fl+.5,ae),r.lineTo(fl+.5,N),r.stroke()),Lt>0&&(r.strokeStyle=Be.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(H,Nl+.5),r.lineTo(P,Nl+.5),r.stroke()),r.fillStyle=Be.headerBg,r.fillRect(H,0,P-H,ae);for(let D=en;D<=gn;D++){const Ie=H+ut[D]-q,Ze=Rt[D];Ie+Ze<H||Ie>P||(Ft&&D>=Ft.startCol&&D<=Ft.endCol&&(r.fillStyle=Be.selectionBg,r.fillRect(Ie,0,Ze,ae)),r.strokeStyle=Be.headerBorder,r.lineWidth=.5,r.strokeRect(Ie+.25,.25,Ze-.5,ae-.5),Ft&&D>=Ft.startCol&&D<=Ft.endCol&&(r.strokeStyle=Be.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(Ie,ae-1),r.lineTo(Ie+Ze,ae-1),r.stroke()),r.fillStyle=Be.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(ht(D),Ie+Ze/2,ae/2))}if(il>0){r.fillStyle=Be.headerBg,r.fillRect(H,0,il,ae);for(let D=0;D<=pn;D++){const Ie=H+ut[D],Ze=Rt[D];Ie+Ze<H||Ie>P||(Ft&&D>=Ft.startCol&&D<=Ft.endCol&&(r.fillStyle=Be.selectionBg,r.fillRect(Ie,0,Ze,ae)),r.strokeStyle=Be.headerBorder,r.lineWidth=.5,r.strokeRect(Ie+.25,.25,Ze-.5,ae-.5),Ft&&D>=Ft.startCol&&D<=Ft.endCol&&(r.strokeStyle=Be.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(Ie,ae-1),r.lineTo(Ie+Ze,ae-1),r.stroke()),r.fillStyle=Be.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(ht(D),Ie+Ze/2,ae/2))}}r.strokeStyle=Be.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(H,ae+.5),r.lineTo(P,ae+.5),r.stroke(),r.fillStyle=Be.headerBg,r.fillRect(0,ae,H,N-ae);for(let D=El;D<=Ol;D++){if(e.isRowHidden(D))continue;const Ie=ae+yt[D]-W,Ze=$l[D];Ie+Ze<ae||Ie>N||(Ft&&D>=Ft.startRow&&D<=Ft.endRow&&(r.fillStyle=Be.selectionBg,r.fillRect(0,Ie,H,Ze)),r.strokeStyle=Be.headerBorder,r.lineWidth=.5,r.strokeRect(.25,Ie+.25,H-.5,Ze-.5),Ft&&D>=Ft.startRow&&D<=Ft.endRow&&(r.strokeStyle=Be.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(H-1,Ie),r.lineTo(H-1,Ie+Ze),r.stroke()),r.fillStyle=Be.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(String(D+1),H/2,Ie+Ze/2+.5))}if(Lt>0){r.fillStyle=Be.headerBg,r.fillRect(0,ae,H,Lt);for(let D=0;D<=hn;D++){if(e.isRowHidden(D))continue;const Ie=ae+yt[D],Ze=$l[D];Ie+Ze<ae||Ie>N||(Ft&&D>=Ft.startRow&&D<=Ft.endRow&&(r.fillStyle=Be.selectionBg,r.fillRect(0,Ie,H,Ze)),r.strokeStyle=Be.headerBorder,r.lineWidth=.5,r.strokeRect(.25,Ie+.25,H-.5,Ze-.5),Ft&&D>=Ft.startRow&&D<=Ft.endRow&&(r.strokeStyle=Be.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(H-1,Ie),r.lineTo(H-1,Ie+Ze),r.stroke()),r.fillStyle=Be.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(String(D+1),H/2,Ie+Ze/2+.5))}}r.strokeStyle=Be.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(H+.5,ae),r.lineTo(H+.5,N),r.stroke(),r.fillStyle=Be.headerBg,r.fillRect(0,0,H,ae),r.strokeStyle=Be.headerSep,r.lineWidth=1,r.strokeRect(.5,.5,H-1,ae-1);const Sl=Math.min(H,ae)*.32;r.fillStyle=Be.activeCellBorder,r.beginPath(),r.moveTo(H-1,ae-1-Sl),r.lineTo(H-1-Sl,ae-1),r.lineTo(H-1,ae-1),r.closePath(),r.fill(),te(r,Be),Y(r,Be)}function oe(){const u=n.freezeCanvasRef.value,b=n.wrapperRef.value;if(!u||!b)return;const T=u.getContext("2d");if(!T)return;const P=b.getBoundingClientRect(),N=P.width,q=P.height,W=52,H=24,ae=n.themeColors.value,Be=e.colPositions.value,Pe=e.rowPositions.value,ut=e.scrollX.value,yt=e.scrollY.value;u.width=N*c,u.height=q*c,u.style.width=N+"px",u.style.height=q+"px",T.setTransform(c,0,0,c,0,0),T.clearRect(0,0,N,q);const{frozenRowsHeight:Rt,frozenColumnsWidth:Lt}=e.getFrozenMetrics();if(Rt<=0&&Lt<=0)return;const il=W+Lt,fl=H+Rt,Nl=Math.max(0,N-W-11-Lt),Ql=Math.max(0,q-H-11-Rt),mn=Math.max(0,e.freeze.cols-1),pn=Math.max(0,e.freeze.rows-1),hn=Math.max(e.freeze.cols,e.hitCol(Lt+ut));let en=hn;for(let at=hn;at<e.colCount&&!(W+Be[at]-ut>=N);at++)en=at;const gn=Math.max(e.freeze.rows,e.hitRow(Rt+yt));let El=gn;for(let at=gn;at<e.rowCount&&!(H+Pe[at]-yt>=q);at++)El=at;let Ol=hn,cl=en,sl=gn,ml=El;Lt>0&&(Ol=0,cl=Math.max(cl,mn)),Rt>0&&(sl=0,ml=Math.max(ml,pn));let zl=Ol,_l=sl;for(const at in e.merges){const Pt=e.merges[at];Pt&&(Pt.startRow>ml||Pt.endRow<sl||Pt.startCol>cl||Pt.endCol<Ol||(Pt.startCol<zl&&(zl=Pt.startCol),Pt.startRow<_l&&(_l=Pt.startRow)))}const tn=new Array(_l);for(let at=_l;at<=ml;at++)tn[at]=Pe[at+1]-Pe[at];const $l=(at,Pt,Dl)=>{const Sl=e.findMerge(at,Pt);return Sl?e.getCellBorderSide(e.cells[Sl.anchor],Dl):e.getCellBorderSide(e.cells[e.cellKey(at,Pt)],Dl)},Ft=(at,Pt,Dl,Sl,D)=>{at.fillStyle="#444";for(let Ie=Sl;Ie<=D;Ie++)for(let Ze=Pt;Ze<=Dl;Ze++){const Tt=e.findMerge(Ze,Ie);if(Tt&&!(Ze===Tt.range.startCol&&Ie===Tt.range.startRow))continue;const Gt=e.cellToScreenRect(Ie,Ze),_t=Gt.x,st=Gt.y,De=Gt.width,wt=Gt.height;if(_t+De<W||st+wt<H||_t>N||st>q)continue;const ft=e.cells[e.cellKey(Ze,Ie)],et={top:e.getCellBorderSide(ft,"top"),right:e.getCellBorderSide(ft,"right"),bottom:e.getCellBorderSide(ft,"bottom"),left:e.getCellBorderSide(ft,"left")};if(Tt)continue;const nt={top:$l(Ze,Ie-1,"bottom"),left:$l(Ze-1,Ie,"right"),bottom:$l(Ze,Ie+1,"top"),right:$l(Ze+1,Ie,"left")},mt=Wt(nt.top,et.top),rt=Wt(nt.left,et.left),St=Wt(et.bottom,nt.bottom),Nt=Wt(et.right,nt.right),$t=(mt==null?void 0:mt.width)??0,Xe=(rt==null?void 0:rt.width)??0,J=(St==null?void 0:St.width)??0,ze=(Nt==null?void 0:Nt.width)??0;$t>0&&(at.fillStyle=(mt==null?void 0:mt.color)||"#444",at.fillRect(_t,st,De,$t)),J>0&&(at.fillStyle=(St==null?void 0:St.color)||"#444",at.fillRect(_t,st+wt-J,De,J)),Xe>0&&(at.fillStyle=(rt==null?void 0:rt.color)||"#444",at.fillRect(_t,st,Xe,wt)),ze>0&&(at.fillStyle=(Nt==null?void 0:Nt.color)||"#444",at.fillRect(_t+De-ze,st,ze,wt))}},Bn=(at,Pt,Dl,Sl,D,Ie,Ze,Tt)=>{Dl<=0||Sl<=0||(T.save(),T.beginPath(),T.rect(at,Pt,Dl,Sl),T.clip(),T.fillStyle=ae.gridBg,T.fillRect(at,Pt,Dl,Sl),s(T,D,Ie,Ze,Tt,tn),Ft(T,D,Ie,Ze,Tt),v(T,at,Pt,Dl,Sl),T.restore())};Lt>0&&Rt>0&&Bn(W,H,Lt,Rt,0,mn,0,pn),Rt>0&&Bn(il,H,Nl,Rt,zl,cl,0,pn),Lt>0&&Bn(W,fl,Lt,Ql,0,mn,_l,ml),T.strokeStyle=ae.headerSep,T.lineWidth=1,Lt>0&&(T.beginPath(),T.moveTo(il+.5,H),T.lineTo(il+.5,q),T.stroke()),Rt>0&&(T.beginPath(),T.moveTo(W,fl+.5),T.lineTo(N,fl+.5),T.stroke()),T.fillStyle=ae.headerBg,T.fillRect(0,0,W,H),T.strokeStyle=ae.headerSep,T.lineWidth=1,T.strokeRect(.5,.5,W-.5,H-.5),te(T,ae),Y(T,ae)}function te(u,b){const T=e.selection.value;if(!T||e.editingCell.value)return;const P=e.cellToScreenRect(T.endRow,T.endCol),N=Ro(T,T,e.merges),q=P.x+P.width-6/2,W=P.y+P.height-6/2;u.fillStyle=N?b.activeCellBorder:b.scrollTrack,u.fillRect(q,W,6,6),u.strokeStyle="#fff",u.lineWidth=1,u.strokeRect(q+.5,W+.5,6-1,6-1)}function Y(u,b){const T=e.autoFillState.value;if(!T.active||!T.preview||!T.targetRange)return;const P=T.targetRange,N=e.cellToScreenRect(P.startRow,P.startCol),q=e.cellToScreenRect(P.endRow,P.endCol),W=N.x,H=N.y,ae=q.x+q.width-W,Be=q.y+q.height-H;u.fillStyle=b.selectionBg,u.fillRect(W,H,ae,Be),u.strokeStyle=b.activeCellBorder,u.lineWidth=1.5,u.setLineDash([4,3]),u.strokeRect(W+.5,H+.5,ae-1,Be-1),u.setLineDash([])}const k=t.computed(()=>ht(e.activeCell.value.col)+String(e.activeCell.value.row+1)),Q=t.ref(""),le=t.ref(!1),se=t.computed(()=>e.editingCell.value?Q.value:e.getCellRaw(e.activeCell.value.col,e.activeCell.value.row));t.watch(()=>e.editingCell.value,(u,b)=>{if(u&&!b){const T=e.editValue.value||e.getCellRaw(u.col,u.row)||"";Q.value=T,qe=!1}else!u&&b&&(Q.value="",le.value=!1,qe=!1)},{immediate:!0}),t.watch(()=>[e.activeCell.value.col,e.activeCell.value.row],()=>{e.editingCell.value||(Q.value="",qe=!1)});function Ke(){e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),d())}function Oe(u){const b=u.target.value;e.editingCell.value?e.editValue.value=b:e.startEdit(b),Q.value=b,qe=!0}function Ge(u){var T,P;const b={...e.activeCell.value};e.editingCell.value?(e.editValue.value=u,e.commitEdit()):((T=e.saveUndo)==null||T.call(e),e.setCellValue(b.col,b.row,u)),Q.value="",qe=!1,d(),(P=n.emitModelData)==null||P.call(n)}let Te=!1,qe=!1;function tt(){var q,W,H,ae,Be,Pe,ut,yt,Rt;if(Te)return;const u=n.formulaBarRef.value,b=!!(u&&typeof document<"u"&&document.activeElement===u);if(!e.editingCell.value&&!b&&!qe)return;const T={...e.activeCell.value},P=e.editingCell.value?e.editingCell.value.col:T.col,N=e.editingCell.value?e.editingCell.value.row:T.row;if(!e.editingCell.value){const Lt=e.getCellRaw(P,N),il=Q.value!==Lt;if(!qe)return;Te=!0,il&&((q=e.saveUndo)==null||q.call(e),e.setCellValue(P,N,Q.value),d(),(W=n.emitModelData)==null||W.call(n)),(H=n.formulaBarRef.value)==null||H.blur(),Q.value="",le.value=!1,qe=!1,t.nextTick(()=>{Te=!1});return}Te=!0,qe?(e.editValue.value=Q.value,e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),(ae=n.formulaBarRef.value)==null||ae.blur(),Q.value="",le.value=!1,qe=!1,d(),n.focusEditInput(),(Be=n.emitModelData)==null||Be.call(n),t.nextTick(()=>{Te=!1})):b?(Q.value=e.editValue.value,e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),(Pe=n.formulaBarRef.value)==null||Pe.blur(),Q.value="",le.value=!1,qe=!1,d(),n.focusEditInput(),(ut=n.emitModelData)==null||ut.call(n),t.nextTick(()=>{Te=!1})):(e.commitEdit(),(yt=n.formulaBarRef.value)==null||yt.blur(),Q.value="",le.value=!1,qe=!1,d(),n.focusEditInput(),(Rt=n.emitModelData)==null||Rt.call(n),t.nextTick(()=>{Te=!1}))}function ye(){var u;Te||(Te=!0,e.editingCell.value&&e.cancelEdit(),(u=n.formulaBarRef.value)==null||u.blur(),Q.value="",le.value=!1,qe=!1,d(),n.focusEditInput(),t.nextTick(()=>{Te=!1}))}function ie(u){if(!u.isComposing){if(u.key==="Enter"&&(u.altKey||u.metaKey)&&!u.ctrlKey){u.preventDefault(),u.stopPropagation();const b=u.target;if(!b)return;e.editingCell.value||e.startEdit();const T=b.selectionStart??b.value.length,P=b.selectionEnd??b.value.length,N=b.value,q=N.substring(0,T)+`
|
|
7
|
+
`+N.substring(P),W=T+1;Q.value=q,le.value||(le.value=!0),t.nextTick(()=>{try{b.setSelectionRange(W,W)}catch{}if(le.value)try{b.scrollTop=b.scrollHeight}catch{}try{b.focus({preventScroll:!0})}catch{}});return}u.key==="Enter"?(u.preventDefault(),tt()):u.key==="Escape"&&(u.preventDefault(),ye())}}function he(){tt()}const Ae=t.ref(null),dt=t.ref("");function ue(u){Ae.value===null&&(n.switchSheet(u),d())}function ve(u){u!==n.activeSheetIndex.value&&(n.saveSheet(),n.loadSheet(u),d()),Ae.value=u,dt.value=n.sheets.value[u].name,t.nextTick(()=>{const b=document.querySelector(".tab-rename-input");b==null||b.focus(),b==null||b.select()})}function p(){Ae.value!==null&&(n.renameSheet(Ae.value,dt.value),t.nextTick(()=>n.emitModelData())),Ae.value=null,dt.value=""}function A(){Ae.value=null,dt.value=""}function $(u){u.key==="Enter"?(u.preventDefault(),p()):u.key==="Escape"&&(u.preventDefault(),A())}const ee=t.ref(null);t.watch(ee,u=>{u===null&&pe()});const U=t.ref(null),O=18,x=2,X=2,Le=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 re(u,b,T,P,N,q){const W=Math.min(q,P/2,N/2);u.beginPath(),u.moveTo(b+W,T),u.arcTo(b+P,T,b+P,T+N,W),u.arcTo(b+P,T+N,b,T+N,W),u.arcTo(b,T+N,b,T,W),u.arcTo(b,T,b+P,T,W),u.closePath()}function V(u,b,T,P,N,q,W){const H=Math.min(P,O)-x,ae=b+P-H-x,Be=T+x,Pe=N-2*x;u.save(),u.fillStyle=q?W.activeCellBorder:"#ececec",re(u,ae,Be,H,Pe,X),u.fill();const ut=Math.min(H,Pe)*.72;u.translate(ae+H/2,Be+Pe/2),u.scale(ut/1024,ut/1024),u.translate(-512,-512),u.fillStyle=q?"#ffffff":"#5a5a5a",u.fill(Le),u.restore()}function G(u,b){const T=e.getFilter();if(!T)return-1;const P=e.screenToCell(u,b);if(!P)return-1;const{col:N,row:q}=P;if(q!==T.range.startRow||N<T.range.startCol||N>T.range.endCol)return-1;const W=e.cellToScreenRect(q,N),H=Math.min(W.width,O)-x,ae=W.x+W.width-H-x,Be=W.x+W.width-x;return u>=ae&&u<=Be&&b>=W.y+x&&b<=W.y+W.height-x?N:-1}function xe(u){const b=e.getFilter();if(!b)return;const T=n.canvasRef.value;if(!T)return;const P=T.getBoundingClientRect(),N=e.cellToScreenRect(b.range.startRow,u);U.value={col:u,x:P.left+N.x+N.width-O,y:P.top+N.y+2}}function $e(){U.value=null}let bt=null,ge=null;function pe(){bt&&(document.removeEventListener("click",bt),bt=null),ge&&(document.removeEventListener("touchstart",ge,{capture:!0}),ge=null)}function it(u,b,T){pe();const P=140,N=T.length*28+8,q=window.innerWidth,W=window.innerHeight;u+P>q&&(u-=P),b+N>W&&(b-=N),It.value=!1,ee.value={x:u,y:b,items:T},t.nextTick(()=>E()),bt=()=>{ee.value=null,pe()},ge=H=>{const ae=H.target;ae&&ae.closest(".context-menu")||(ee.value=null,pe())},setTimeout(()=>{document.addEventListener("click",bt,{once:!0}),document.addEventListener("touchstart",ge,{capture:!0})},0)}const It=t.ref(!1);function Je(u,b){}function E(){const b=document.querySelector(".context-menu"),T=ee.value,P=n.wrapperRef.value;if(!b||!T||!P){It.value=!1;return}const N=T.x+140,q=P.getBoundingClientRect(),W=b.style.transform;b.style.transform="none";let H=0;if(b.querySelectorAll(".context-menu__item").forEach(Be=>{const Pe=Be.querySelector(":scope > .context-submenu");if(!Pe)return;const ut=Pe.style.display;Pe.style.display="block";const yt=Pe.getBoundingClientRect().width;Pe.style.display=ut,yt>H&&(H=yt)}),b.style.transform=W,H===0){It.value=!0;return}const ae=q.right-N;It.value=ae<H+8}function ne(u,b){u.preventDefault(),u.stopPropagation(),it(u.clientX,u.clientY,[{label:w(e.locale.value,"insert"),action:()=>{n.addSheet(),d()}},{label:w(e.locale.value,"copy"),action:()=>{n.dupSheet(b)}},{label:w(e.locale.value,"rename"),action:()=>{ve(b)}},{label:w(e.locale.value,"delete"),action:()=>{n.removeSheet(b),d()},disabled:n.sheetCount.value<=1},{label:w(e.locale.value,"moveSheetLeft"),action:()=>{n.moveSheet(b,-1)},disabled:b===0},{label:w(e.locale.value,"moveSheetRight"),action:()=>{n.moveSheet(b,1)},disabled:b===n.sheets.value.length-1}])}function Et(u){u.preventDefault(),!(u.target.closest(".tab-item")||u.target.closest(".tab-bar__add-btn"))&&it(u.clientX,u.clientY,[{label:w(e.locale.value,"insert"),action:()=>{n.addSheet(),d()}}])}function Dt(u){u.preventDefault(),e.selectAll(),d(),it(u.clientX,u.clientY,[{label:w(e.locale.value,"cut"),action:()=>{o.cutSelected(),n.emitModelData()}},{label:w(e.locale.value,"copy"),action:()=>o.copyToClipboard()},{label:w(e.locale.value,"paste"),action:()=>{l.saveUndo(),o.pasteFromClipboard().then(()=>{d(),t.nextTick(()=>n.emitModelData())})}},{label:w(e.locale.value,"delete"),action:()=>{l.saveUndo(),o.clearSelected();for(let b=0;b<e.colCount;b++)e.colWidths.value[b]=100;for(let b=0;b<e.rowCount;b++)e.rowHeights.value[b]=void 0;d(),n.emitModelData()}}])}function Ot(u,b){u.preventDefault();const T=u.clientX,P=u.clientY,N=e.selection.value;N&&N.startCol===0&&N.endCol===e.colCount-1&&b>=N.startRow&&b<=N.endRow||(e.selectRange(0,b,e.colCount-1,b,"row"),d());const q=e.selection.value;it(u.clientX,u.clientY,[{label:w(e.locale.value,"insert"),action:()=>{l.saveUndo(),n.insertRows(q.startRow,q.endRow),d(),n.emitModelData()}},{label:w(e.locale.value,"cut"),action:()=>{l.saveUndo(),o.copyRowCol(),e.clearCellsInRange(0,e.colCount-1,q.startRow,q.endRow),d(),n.emitModelData()}},{label:w(e.locale.value,"copy"),action:()=>o.copyRowCol()},{label:w(e.locale.value,"paste"),action:()=>{l.saveUndo(),o.pasteFromClipboard().then(()=>{d(),t.nextTick(()=>n.emitModelData())})}},{label:w(e.locale.value,"delete"),action:()=>{l.saveUndo(),n.deleteRows(q.startRow,q.endRow),d(),n.emitModelData()}},{label:`${w(e.locale.value,"rowHeight")}...`,action:()=>Cl("row",T,P)},{label:w(e.locale.value,"autoRowHeight"),action:()=>n.resetRowHeight()},{label:w(e.locale.value,"freezeToRow"),action:()=>{e.setFreeze(b+1,e.freeze.cols),d()}}])}function de(u,b){u.preventDefault();const T=u.clientX,P=u.clientY,N=e.selection.value;N&&N.startRow===0&&N.endRow===e.rowCount-1&&b>=N.startCol&&b<=N.endCol||(e.selectRange(b,0,b,e.rowCount-1,"col"),d());const q=e.selection.value,W=!n.canSortColumns(q.startCol,q.endCol);it(u.clientX,u.clientY,[{label:w(e.locale.value,"insert"),action:()=>{l.saveUndo(),n.insertCols(q.startCol,q.endCol),d(),n.emitModelData()}},{label:w(e.locale.value,"cut"),action:()=>{l.saveUndo(),o.copyRowCol(),e.clearCellsInRange(q.startCol,q.endCol,0,e.rowCount-1),d(),n.emitModelData()}},{label:w(e.locale.value,"copy"),action:()=>o.copyRowCol()},{label:w(e.locale.value,"paste"),action:()=>{l.saveUndo(),o.pasteFromClipboard().then(()=>{d(),t.nextTick(()=>n.emitModelData())})}},{label:w(e.locale.value,"delete"),action:()=>{l.saveUndo(),n.deleteCols(q.startCol,q.endCol),d(),n.emitModelData()}},{label:w(e.locale.value,"sort"),disabled:W,children:[{label:w(e.locale.value,"sortAsc"),action:()=>{n.prepareSortConfirmation("asc")||n.sortSelectedColumns("asc")},disabled:W},{label:w(e.locale.value,"sortDesc"),action:()=>{n.prepareSortConfirmation("desc")||n.sortSelectedColumns("desc")},disabled:W}]},{label:`${w(e.locale.value,"colWidth")}...`,action:()=>Cl("col",T,P)},{label:w(e.locale.value,"defaultColWidth"),action:()=>n.resetColWidth()},{label:w(e.locale.value,"freezeToCol"),action:()=>{e.setFreeze(e.freeze.rows,b+1),d()}}])}function g(u,b,T){u.preventDefault(),e.isSelected(b,T)||(e.selectCell(b,T),d());const P=e.selection.value,N=!!(P&&P.startCol===P.endCol&&P.startRow===P.endRow);it(u.clientX,u.clientY,[{label:w(e.locale.value,"cut"),action:()=>{o.cutSelected(),n.emitModelData()}},{label:w(e.locale.value,"copy"),action:()=>o.copyToClipboard()},{label:w(e.locale.value,"paste"),action:()=>{l.saveUndo(),o.pasteFromClipboard().then(()=>{d(),t.nextTick(()=>n.emitModelData())})}},{label:w(e.locale.value,"delete"),action:()=>{l.saveUndo(),o.clearSelected(),d(),n.emitModelData()}},{label:w(e.locale.value,"calculate"),children:[{label:w(e.locale.value,"sum"),action:o.sumSelected,disabled:N},{label:w(e.locale.value,"avg"),action:o.avgSelected,disabled:N},{label:w(e.locale.value,"count"),action:o.countSelected,disabled:N}]}])}const M=t.ref(null),Vt=t.ref(null);let Mt=null,el=null;function Ut(){Mt&&(document.removeEventListener("mousedown",Mt),Mt=null),el&&(document.removeEventListener("touchstart",el),el=null)}function Cl(u,b,T){Ut();const P=e.selection.value;let N="";if(P){const Be=u==="row"?e.getRowHeight(P.startRow):e.colWidths.value[P.startCol];N=Be!=null&&Be>0?String(Math.round(Be)):""}const q=220,W=118;let H=b,ae=T;H+q>window.innerWidth&&(H=window.innerWidth-q-8),ae+W>window.innerHeight&&(ae=window.innerHeight-W-8),H<8&&(H=8),ae<8&&(ae=8),Vt.value={type:u,x:H,y:ae,value:N,error:""},Mt=()=>{Vt.value=null},el=()=>{Vt.value=null},setTimeout(()=>{document.addEventListener("mousedown",Mt,{once:!0}),document.addEventListener("touchstart",el,{once:!0})},0),t.nextTick(()=>{const Be=M.value;Be&&(Be.focus(),Be.select())})}function Xl(u){const b=Vt.value;if(!b)return;const T=u.target,P=T.value,N=P.replace(/[^\d]/g,"");b.value=N,P!==N&&(T.value=N),b.error=""}function dn(u){u.key==="Enter"?(u.preventDefault(),F()):u.key==="Escape"&&(u.preventDefault(),z())}function I(){const u=Vt.value;if(!u)return;const b=u.value.trim(),T=Number(b),P=u.type==="row",N=P?24:30,q=P?500:1e3;if(b===""||!Number.isFinite(T)){z();return}const W=Math.max(N,Math.min(q,Math.round(T)));u.value=String(W),u.error=""}function F(){const u=Vt.value,b=e.selection.value;if(!u||!b)return;const T=u.value.trim(),P=Number(T),N=u.type==="row",q=N?24:30,W=N?500:1e3;if(T===""||!Number.isFinite(P)){u.error=w(e.locale.value,"dimNumberError");return}if(P<q||P>W){u.error=w(e.locale.value,"dimRangeError").replace("{min}",String(q)).replace("{max}",String(W));return}const H=P;if(l.saveUndo(),N)for(let ae=b.startRow;ae<=b.endRow;ae++)e.rowHeights.value[ae]=H;else for(let ae=b.startCol;ae<=b.endCol;ae++)e.colWidths.value[ae]=H;d(),n.emitModelData(),z()}function z(){Ut(),Vt.value=null}const we=t.computed(()=>{const u=!e.editingCell.value,b=e.editingCell.value??e.activeCell.value,T=b.col,P=b.row,N=e.resolveStyle(e.cells[e.cellKey(T,P)]),q=e.cellFontSize(T,P),W=typeof(N==null?void 0:N.fontFamily)=="string"&&N.fontFamily?N.fontFamily:yn,H=(N==null?void 0:N.fontWeight)==="bold"?"bold":"normal",ae=(N==null?void 0:N.fontStyle)==="italic"?"italic":"normal",Be=(N==null?void 0:N.underline)==="underline"?"underline":(N==null?void 0:N.strikethrough)==="line-through"?"line-through":"none",Pe=(N==null?void 0:N.underline)==="underline"&&(N==null?void 0:N.strikethrough)==="line-through"?"underline line-through":Be,ut=typeof(N==null?void 0:N.color)=="string"?N.color:void 0,yt=typeof(N==null?void 0:N.backgroundColor)=="string"?N.backgroundColor:void 0,Rt=typeof(N==null?void 0:N.numberFormat)=="string"?N.numberFormat:"",Lt=e.editValue.value??e.getCellValue(T,P),il=typeof(N==null?void 0:N.textAlign)=="string"?N.textAlign:fo(Lt,Rt)?"right":"left",fl=typeof(N==null?void 0:N.verticalAlign)=="string"?N.verticalAlign:"top",Nl=e.findMerge(T,P),Ql=Nl?e.rowPositions.value[Nl.range.endRow+1]-e.rowPositions.value[P]:e.getRowHeight(P),mn=2,{ascent:pn,descent:hn}=e.measureFontMetrics(W,q,H,ae),en=pn+hn,El=(e.editValue.value?e.editValue.value.split(`
|
|
8
|
+
`).length:1)*en,Ol=e.BASE_CELL_VPAD-mn;let cl=0,sl=0;fl==="middle"?(cl=Math.floor((Ql-El)/2),sl=Math.max(0,Ql-El-cl)):fl==="top"?(cl=Ol,sl=Math.max(0,Ql-El-cl)):fl==="bottom"&&(sl=Ol,cl=Math.max(0,Ql-El-sl));const ml=e.cellToScreenRect(P,T);return{left:`${ml.x}px`,top:`${ml.y}px`,width:`${ml.width}px`,height:`${ml.height}px`,fontFamily:W,fontSize:`${q}px`,lineHeight:1,fontWeight:H,fontStyle:ae,textDecoration:Pe,textAlign:il,paddingTop:`${cl}px`,paddingRight:"3px",paddingBottom:`${sl}px`,paddingLeft:"3px",opacity:u?0:1,pointerEvents:u?"none":"auto",color:u?"transparent":ut,caretColor:u?"transparent":void 0,borderColor:u?"transparent":void 0,background:u?"transparent":yt,boxShadow:u?"none":void 0}});function Ee(){return Math.max(0,n.viewSize.w-52-11)}function Fe(){return Math.max(0,n.viewSize.h-24-11)}const Ve=t.computed(()=>Math.max(0,Ee()-e.getFrozenMetrics().frozenColumnsWidth)),ke=t.computed(()=>Math.max(0,Fe()-e.getFrozenMetrics().frozenRowsHeight)),ce=t.computed(()=>52+e.getFrozenMetrics().frozenColumnsWidth),je=t.computed(()=>24+e.getFrozenMetrics().frozenRowsHeight),We=t.computed(()=>Math.max(0,Ve.value-11*2)),fe=t.computed(()=>Math.max(0,ke.value-11*2)),ot=t.computed(()=>n.maxScrollX.value<=0?We.value:Math.max(24,Ve.value/e.totalWidth.value*We.value)),vt=t.computed(()=>n.maxScrollX.value<=0?0:e.scrollX.value/n.maxScrollX.value*(We.value-ot.value)),R=t.computed(()=>n.maxScrollY.value<=0?fe.value:Math.max(24,ke.value/e.totalHeight.value*fe.value)),j=t.computed(()=>n.maxScrollY.value<=0?0:e.scrollY.value/n.maxScrollY.value*(fe.value-R.value));let Z=null,Se=0,Re=0;function Ce(u){u.preventDefault(),Z="v",Se=u.clientY,Re=e.scrollY.value,document.addEventListener("mousemove",lt),document.addEventListener("mouseup",Ct)}function Ne(u){u.preventDefault(),Z="h",Se=u.clientX,Re=e.scrollX.value,document.addEventListener("mousemove",lt),document.addEventListener("mouseup",Ct)}function lt(u){if(Z==="v"){const T=(u.clientY-Se)/(fe.value-R.value);n.clampScroll(null,Re+T*n.maxScrollY.value),d()}else if(Z==="h"){const T=(u.clientX-Se)/(We.value-ot.value);n.clampScroll(Re+T*n.maxScrollX.value,null),d()}}function Ct(){Z=null,document.removeEventListener("mousemove",lt),document.removeEventListener("mouseup",Ct)}function Ht(u){if(Z)return;const b=u.currentTarget.getBoundingClientRect(),T=u.clientY-b.top;T<j.value?n.clampScroll(null,e.scrollY.value-Fe()):T>j.value+R.value&&n.clampScroll(null,e.scrollY.value+Fe()),d()}function tl(u){if(Z)return;const b=u.currentTarget.getBoundingClientRect(),T=u.clientX-b.left;T<vt.value?n.clampScroll(e.scrollX.value-Ee(),null):T>vt.value+ot.value&&n.clampScroll(e.scrollX.value+Ee(),null),d()}let ol=!1,zt=0,Xt=0,ll=!1,rl=!1,jl=0,Bl=0,xl=0,Hl=0,En=0,Sn=0,In=0,An=0,al=!1,Zl=!1,Bt=0,xt=0,jt="cell",Pn=0,to=-1,lo=-1,ul=null,Ll=!1,yl=0,wl=0,Jl=!1,vl=null,un=null,Rn=0,no=0;function Un(u,b){const T=e.selection.value;if(!T||e.editingCell.value||!Ro(T,T,e.merges))return!1;const P=e.cellToScreenRect(T.endRow,T.endCol),N=P.x+P.width-6,q=P.y+P.height-6,W=4;return u>=N-W&&u<=N+6+W&&b>=q-W&&b<=q+6+W}function xo(){vl=requestAnimationFrame(Kn)}function Kn(){if(!e.autoFillState.value.active||!un){vl=null;return}const u=8;n.clampScroll(e.scrollX.value+un.x*u*.1,e.scrollY.value+un.y*u*.1);const b=e.screenToCell(Rn,no),T=e.autoFillState.value.sourceRange;if(b&&T){const P=cr(T,{col:b.col,row:b.row});P?e.autoFillState.value={...e.autoFillState.value,targetRange:P.targetRange,direction:P.direction}:e.autoFillState.value={...e.autoFillState.value,targetRange:null,direction:null}}d(),vl=requestAnimationFrame(Kn)}function Hn(){vl!==null&&(cancelAnimationFrame(vl),vl=null),un=null}function fn(u,b){Rn=u,no=b;const T=e.screenToCell(u,b),P=e.autoFillState.value.sourceRange;if(T&&P){const Be=cr(P,{col:T.col,row:T.row});Be?e.autoFillState.value={...e.autoFillState.value,targetRange:Be.targetRange,direction:Be.direction}:e.autoFillState.value={...e.autoFillState.value,targetRange:null,direction:null}}const N=30,q=n.viewSize.w,W=n.viewSize.h;let H=0,ae=0;u<52+N?H=-(52+N-u):u>q-11-N&&(H=u-(q-11-N)),b<24+N?ae=-(24+N-b):b>W-11-N&&(ae=b-(W-11-N)),H!==0||ae!==0?(un={x:H,y:ae},vl===null&&xo()):(un=null,vl!==null&&(cancelAnimationFrame(vl),vl=null)),d()}function oo(){Hn();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 To(u){if(u.button!==0)return;u.preventDefault(),ee.value=null;const b=cn(u,n.canvasRef.value),T=G(b.x,b.y);if(T>=0){xe(T);return}if(b.y<24&&b.x>=52){const W=b.x-52+e.scrollX.value,H=C(b.x),ae=H>=0?e.cellToScreenRect(0,H).x+e.colWidths.value[H]:-1;if(H>=0&&Math.abs(b.x-ae)<=4){l.saveUndo(),ll=!0,jl=H,xl=e.colWidths.value[H],Hl=W,d();return}}if(b.x<52&&b.y>=24){const W=b.y-24+e.scrollY.value,H=y(b.y),ae=H>=0?e.cellToScreenRect(H,0).y+e.getRowHeight(H):-1;if(H>=0&&Math.abs(b.y-ae)<=4){l.saveUndo(),rl=!0,Bl=H,xl=e.getRowHeight(H),Hl=W,d();return}}if(Un(b.x,b.y)){const W=e.selection.value;W&&(e.autoFillState.value={active:!0,sourceRange:{...W},targetRange:null,direction:null,preview:!0},d());return}if(b.x<52||b.y<24){{const W=n.formulaBarRef.value,H=!!(W&&typeof document<"u"&&document.activeElement===W);(e.editingCell.value||H||qe)&&tt()}if(b.y<24&&b.x>=52){const W=C(b.x);W>=0&&(e.selectRange(W,0,W,e.rowCount-1,"col"),ol=!0,zt=W,Xt=0)}else if(b.x<52&&b.y>=24){const W=y(b.y);W>=0&&(e.selectRange(0,W,e.colCount-1,W,"row"),ol=!0,zt=0,Xt=W)}else b.x<52&&b.y<24&&e.selectAll();d();return}const P=e.screenToCell(b.x,b.y);if(!P)return;const N=P.col,q=P.row;{const W=n.formulaBarRef.value,H=!!(W&&typeof document<"u"&&document.activeElement===W);(e.editingCell.value||H||qe)&&tt()}if(u.shiftKey&&e.selection.value){const W=e.selection.value;e.selectRange(W.startCol,W.startRow,N,q)}else e.selectCell(N,q);ol=!0,zt=N,Xt=q,n.focusEditInput(),d()}function No(u){if(ll){const W=cn(u,n.canvasRef.value).x-52+e.scrollX.value-Hl,H=xl+W;H>=30&&H<=1e3?e.colWidths.value[jl]=H:H<30?e.colWidths.value[jl]=30:e.colWidths.value[jl]=1e3,d();return}if(rl){const W=cn(u,n.canvasRef.value).y-24+e.scrollY.value-Hl,H=xl+W;H>=24&&H<=500?e.rowHeights.value[Bl]=H:H<24?e.rowHeights.value[Bl]=24:e.rowHeights.value[Bl]=500,d();return}if(e.autoFillState.value.active){const q=cn(u,n.canvasRef.value);fn(q.x,q.y);return}if(!ol){const q=n.canvasRef.value;if(!q)return;if(l.paintFmt.value){q.style.cursor="copy";return}const W=cn(u,q);if(G(W.x,W.y)>=0){q.style.cursor="pointer";return}if(W.y<24&&W.x>=52){const H=C(W.x),ae=H>=0?e.cellToScreenRect(0,H).x+e.colWidths.value[H]:-1;if(H>=0&&Math.abs(W.x-ae)<=4){q.style.cursor="col-resize";return}}if(W.x<52&&W.y>=24){const H=y(W.y),ae=H>=0?e.cellToScreenRect(H,0).y+e.getRowHeight(H):-1;if(H>=0&&Math.abs(W.y-ae)<=4){q.style.cursor="row-resize";return}}if(Un(W.x,W.y)){q.style.cursor="crosshair";return}q.style.cursor="cell";return}const b=cn(u,n.canvasRef.value);if(zt<0||Xt<0)return;if(b.x<52||b.y<24){if(b.y<24&&b.x>=52){const q=C(b.x);q>=0&&e.selectRange(Math.min(zt,q),0,Math.max(zt,q),e.rowCount-1,"col")}else if(b.x<52&&b.y>=24){const q=y(b.y);q>=0&&e.selectRange(0,Math.min(Xt,q),e.colCount-1,Math.max(Xt,q),"row")}d();return}const T=e.screenToCell(b.x,b.y);if(!T)return;const P=T.col,N=T.row;Xt===0&&zt>=0&&e.selection.value&&e.selection.value.startRow===0&&e.selection.value.endRow===e.rowCount-1?e.selectRange(Math.min(zt,P),0,Math.max(zt,P),e.rowCount-1,"col"):zt===0&&Xt>=0&&e.selection.value&&e.selection.value.startCol===0&&e.selection.value.endCol===e.colCount-1?e.selectRange(0,Math.min(Xt,N),e.colCount-1,Math.max(Xt,N),"row"):e.selectRange(zt,Xt,P,N),d()}function me(u){const b=ll||rl;if(ol=!1,ll=!1,rl=!1,b&&n.scheduleOptEmit(),e.autoFillState.value.active){oo();return}l.paintFmt.value&&l.applyPaintFormat()}function f(){Hn();const u=ll||rl;ol=!1,ll=!1,rl=!1,u&&n.scheduleOptEmit()}function S(u){u.preventDefault();const b=cn(u,n.canvasRef.value);if(b.x<52&&b.y<24){Dt(u);return}if(b.y<24&&b.x>=52){const T=C(b.x);T>=0&&de(u,T);return}if(b.x<52&&b.y>=24){const T=y(b.y);T>=0&&Ot(u,T);return}if(b.x>=52&&b.y>=24){const T=e.screenToCell(b.x,b.y);T&&g(u,T.col,T.row)}}function B(u){const b=cn(u,n.canvasRef.value);if(b.x<52||b.y<24)return;const T=e.screenToCell(b.x,b.y);if(!T)return;const P=T.col,N=T.row;{const q=n.formulaBarRef.value,W=!!(q&&typeof document<"u"&&document.activeElement===q);(e.editingCell.value||W||qe)&&tt()}e.selectCell(P,N),e.ensureVisible(P,N),e.startEdit(),d(),n.focusEditInput()}function _(u){const b=e.scrollX.value+u.deltaX,T=e.scrollY.value+u.deltaY,P=40,N=n.maxScrollX.value,q=n.maxScrollY.value;if(b>=N-P&&u.deltaX>0||T>=q-P&&u.deltaY>0){const W=Math.max(0,n.viewSize.w-28-11),H=Math.max(0,n.viewSize.h-28-11),ae=Math.max(0,Math.ceil((b+W)/100)+2),Be=Math.max(0,Math.ceil((T+H)/24)+2);e.ensureCapacity(ae,Be)}n.clampScroll(b,T),d()}function K(u){if(u.touches.length!==1){al=!1;return}const b=u.touches[0],T=n.canvasRef.value;if(!T)return;const P=T.getBoundingClientRect(),N=b.clientX-P.left,q=b.clientY-P.top,W=b.clientX,H=b.clientY,ae=(Pe,ut)=>({clientX:Pe,clientY:ut,preventDefault(){}});{const Pe=n.formulaBarRef.value,ut=!!(Pe&&typeof document<"u"&&document.activeElement===Pe);(e.editingCell.value||ut||qe)&&tt()}if(Un(N,q)){u.preventDefault();const Pe=e.selection.value;Pe&&(e.autoFillState.value={active:!0,sourceRange:{...Pe},targetRange:null,direction:null,preview:!0},al=!0,Zl=!1,jt="cell",En=N,Sn=q,In=e.scrollX.value,An=e.scrollY.value);return}const Be=G(N,q);if(Be>=0){u.preventDefault(),xe(Be);return}if(q<24&&N>=52){const Pe=C(N);if(Pe>=0){const ut=e.cellToScreenRect(0,Pe).x+e.colWidths.value[Pe];if(Math.abs(N-ut)<=8){u.preventDefault(),l.saveUndo(),ll=!0,jl=Pe,xl=e.colWidths.value[Pe],Hl=N-52+e.scrollX.value,al=!0,Zl=!1;return}}}if(N<52&&q>=24){const Pe=y(q);if(Pe>=0){const ut=e.cellToScreenRect(Pe,0).y+e.getRowHeight(Pe);if(Math.abs(q-ut)<=8){u.preventDefault(),l.saveUndo(),rl=!0,Bl=Pe,xl=e.getRowHeight(Pe),Hl=q-24+e.scrollY.value,al=!0,Zl=!1;return}}}N>=52&&q>=24?(u.preventDefault(),al=!0,Zl=!1,Ll=!1,Jl=!1,jt="cell",En=N,Sn=q,In=e.scrollX.value,An=e.scrollY.value,Bt=C(N),xt=y(q),ul!==null&&clearTimeout(ul),ul=window.setTimeout(()=>{const Pe=e.selection.value;if(!!Pe&&Bt>=Pe.startCol&&Bt<=Pe.endCol&&xt>=Pe.startRow&&xt<=Pe.endRow){Jl=!0,g(ae(W,H),Bt,xt);return}Ll=!0,yl=Bt,wl=xt,Bt>=0&&xt>=0&&(e.selectCell(Bt,xt),d())},450)):N>=0&&q>=0&&(N<52||q<24)&&(u.preventDefault(),al=!0,Zl=!1,Ll=!1,En=N,Sn=q,In=e.scrollX.value,An=e.scrollY.value,q<24&&N>=52?(jt="col",Bt=C(N),xt=-1):N<52&&q>=24?(jt="row",xt=y(q),Bt=-1):(jt="all",Bt=-1,xt=-1),(jt==="col"||jt==="row"||jt==="all")&&(ul!==null&&clearTimeout(ul),ul=window.setTimeout(()=>{const Pe=e.selection.value;if(jt==="all"){Jl=!0,Dt(ae(W,H));return}if(jt==="col"){if(!!Pe&&Pe.startRow===0&&Pe.endRow===e.rowCount-1&&Bt>=Pe.startCol&&Bt<=Pe.endCol){Jl=!0,de(ae(W,H),Bt);return}Ll=!0,yl=Bt,wl=-1,Bt>=0&&(e.selectRange(Bt,0,Bt,e.rowCount-1,"col"),d())}else{if(!!Pe&&Pe.startCol===0&&Pe.endCol===e.colCount-1&&xt>=Pe.startRow&&xt<=Pe.endRow){Jl=!0,Ot(ae(W,H),xt);return}Ll=!0,yl=-1,wl=xt,xt>=0&&(e.selectRange(0,xt,e.colCount-1,xt,"row"),d())}},450)))}function be(u){if(!al||u.touches.length!==1)return;const b=u.touches[0],T=n.canvasRef.value;if(!T)return;const P=T.getBoundingClientRect(),N=b.clientX-P.left,q=b.clientY-P.top;if(e.autoFillState.value.active){u.preventDefault(),fn(N,q);return}if(ll){const W=N-52+e.scrollX.value-Hl;let H=xl+W;H=H<30?30:H>1e3?1e3:H,e.colWidths.value[jl]=H,u.preventDefault(),d();return}if(rl){const W=q-24+e.scrollY.value-Hl;let H=xl+W;H=H<24?24:H>500?500:H,e.rowHeights.value[Bl]=H,u.preventDefault(),d();return}if(Ll){if(u.preventDefault(),yl>=0&&wl>=0){const W=C(N),H=y(q);W>=0&&H>=0&&(e.selectRange(yl,wl,W,H),d())}else if(wl===-1&&yl>=0){const W=C(N);W>=0&&(e.selectRange(Math.min(yl,W),0,Math.max(yl,W),e.rowCount-1,"col"),d())}else if(yl===-1&&wl>=0){const W=y(q);W>=0&&(e.selectRange(0,Math.min(wl,W),e.colCount-1,Math.max(wl,W),"row"),d())}return}ul!==null&&(clearTimeout(ul),ul=null),(Math.abs(N-En)>8||Math.abs(q-Sn)>8)&&(Zl=!0,u.preventDefault(),n.clampScroll(In+(En-N),An+(Sn-q)),d())}function Me(){if(al){if(ul!==null&&(clearTimeout(ul),ul=null),Jl){Jl=!1,al=!1;return}if(e.autoFillState.value.active){oo(),al=!1;return}if(ll||rl){ll=!1,rl=!1,n.scheduleOptEmit(),l.paintFmt.value&&l.applyPaintFormat(),al=!1;return}if(Ll){Ll=!1,l.paintFmt.value&&l.applyPaintFormat(),al=!1;return}if(al=!1,!Zl){if(jt==="cell"&&Bt>=0&&xt>=0){const u=Date.now();Bt===to&&xt===lo&&u-Pn<300?(e.selectCell(Bt,xt),e.startEdit(),d(),n.focusEditInput(),Pn=0):(e.commitEdit(),e.selectCell(Bt,xt),d(),Pn=u),to=Bt,lo=xt,n.focusEditInput()}else jt==="col"&&Bt>=0?(e.commitEdit(),e.selectRange(Bt,0,Bt,e.rowCount-1,"col"),d()):jt==="row"&&xt>=0?(e.commitEdit(),e.selectRange(0,xt,e.colCount-1,xt,"row"),d()):jt==="all"&&(e.commitEdit(),e.selectAll(),d());l.paintFmt.value&&!e.editingCell.value&&l.applyPaintFormat()}}}function He(u){return u.isComposing||u.key==="Process"||u.keyCode===229}function Ue(u){return u.key.length===1&&!u.ctrlKey&&!u.metaKey&&!u.altKey}function Ye(u){if(e.autoFillState.value.active){u.key==="Escape"&&(u.preventDefault(),Hn(),e.autoFillState.value={active:!1,sourceRange:null,targetRange:null,direction:null,preview:!1},d());return}if(e.editingCell.value)return;const b=u.ctrlKey||u.metaKey,T=u.shiftKey;switch(!0){case(b&&(u.key==="c"||u.key==="C")):u.preventDefault(),o.copyToClipboard();return;case(b&&(u.key==="x"||u.key==="X")):u.preventDefault(),o.cutSelected();return;case(b&&(u.key==="z"||u.key==="Z")):u.preventDefault(),l.undo();return;case(b&&(u.key==="y"||u.key==="Y")):u.preventDefault(),l.redo();return;case(b&&(u.key==="v"||u.key==="V")):u.preventDefault(),l.saveUndo(),o.pasteFromClipboard().then(()=>{d(),t.nextTick(()=>n.emitModelData())});return;case(b&&(u.key==="a"||u.key==="A")):u.preventDefault(),e.selectAll(),d();return;case(b&&T&&(u.key==="l"||u.key==="L")):u.preventDefault(),e.toggleAutoFilter(),d();return;case(b&&u.key==="Home"):u.preventDefault(),e.selectCell(0,0),e.ensureVisible(0,0),d();return;case(b&&u.key==="End"):u.preventDefault(),e.selectCell(e.colCount-1,e.rowCount-1),e.ensureVisible(e.colCount-1,e.rowCount-1),d();return;case u.key==="Home":u.preventDefault(),e.selectCell(0,e.activeCell.value.row),e.ensureVisible(0,e.activeCell.value.row),d();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),d();return;case u.key==="ArrowUp":u.preventDefault(),e.moveActive(0,-1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),d();return;case u.key==="ArrowDown":u.preventDefault(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),d();return;case u.key==="ArrowLeft":u.preventDefault(),e.moveActive(-1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),d();return;case u.key==="ArrowRight":u.preventDefault(),e.moveActive(1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),d();return;case u.key==="Tab":u.preventDefault(),e.moveActive(T?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),d();return;case u.key==="Enter":u.preventDefault(),e.moveActive(0,T?-1:1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),d();return;case u.key==="F2":u.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),d(),n.focusEditInput();return;case u.key==="Delete":case u.key==="Backspace":u.preventDefault(),l.saveUndo(),o.clearSelected(),d();return;case u.key==="Escape":u.preventDefault(),e.cancelEdit(),l.paintFmt.value=null,d();return;case Ue(u):if(He(u)){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),d(),n.focusEditInput();return}u.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(u.key),d(),t.nextTick(()=>{const P=n.editInputRef.value;P&&(P.focus(),P.setSelectionRange(1,1))});return}}let Qe=!1,gt=!1;function ct(u){const b=u.target.value;if(!e.editingCell.value){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(b),Q.value=b,d();return}e.editValue.value=b,Q.value=b}function kt(){Qe=!0,e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),Q.value="",d())}function Kt(u){Qe=!1,gt=!0,setTimeout(()=>{gt=!1},0);const b=u.target.value;e.editValue.value=b,Q.value=b}function Mn(u){if(!e.editingCell.value){if(Ue(u)||He(u))return;Ye(u);return}if(!(Qe||He(u))&&!(gt&&(u.key==="Enter"||u.key==="Escape")))if(u.key==="Enter"&&(u.altKey||u.metaKey)){u.preventDefault();const b=n.editInputRef.value;if(!b)return;const T=b.selectionStart??b.value.length,P=b.selectionEnd??b.value.length,N=b.value,q=N.slice(0,T)+`
|
|
9
|
+
`+N.slice(P);e.editValue.value=q,b.value=q,b.selectionStart=b.selectionEnd=T+1,d()}else u.key==="Enter"?(u.preventDefault(),e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),d(),n.focusEditInput()):u.key==="Tab"?(u.preventDefault(),e.commitEdit(),e.moveActive(u.shiftKey?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),d(),n.focusEditInput()):u.key==="Escape"&&(u.preventDefault(),e.cancelEdit(),d(),n.focusEditInput())}function Tl(u){e.editingCell.value}function Ln(){setTimeout(()=>{e.editingCell.value&&(e.commitEdit(),d())},0)}let Zt=null;function kl(){var b;const u=(b=n.wrapperRef.value)==null?void 0:b.getBoundingClientRect();if(u){const T=wn(e.props.width),P=wn(e.props.height);T!=null?n.viewSize.w=T:n.viewSize.w=u.width,P!=null?n.viewSize.h=P:n.viewSize.h=u.height}n.clampScroll(null,null),d()}function Do(){t.onMounted(()=>{const u=wn(e.props.width),b=wn(e.props.height);(u==null||b==null)&&(Zt=new ResizeObserver(()=>kl()),n.wrapperRef.value&&Zt.observe(n.wrapperRef.value)),t.nextTick(()=>{kl(),n.focusEditInput()}),e.selectCell(0,0),n.modelData.value&&n.modelData.value.length>0&&(a.value=JSON.stringify(n.modelData.value),n.sheets.value=n.modelData.value.map(T=>{const P=n.mkSheet(T.name,{colCount:T.colCount,rowCount:T.rowCount}),{cells:N,styles:q}=fr(T.cells);if(Object.assign(P.cells,N),P.styles=T.styles??q,T.borders)P.borders=T.borders;else{const W=mr(P.styles);P.styles=W.styles,P.borders=W.borders}if(T.colWidths)for(const[W,H]of Object.entries(T.colWidths)){const ae=Number(W);ae>=0&&ae<(P.colCount??e.colCount)&&H>=30&&(P.colWidths[ae]=H)}if(T.rowHeights)for(const[W,H]of Object.entries(T.rowHeights)){const ae=Number(W);ae>=0&&ae<(P.rowCount??e.rowCount)&&H>=24&&(P.rowHeights[ae]=H)}if(T.merges)for(const[W,H]of Object.entries(T.merges))P.merges[W]={...H};return P.freeze=T.freeze?{rows:T.freeze.rows,cols:T.freeze.cols}:{rows:0,cols:0},P.filter=vr(T.filter,P.cells),P}),n.sheets.value.length>0&&n.loadSheet(0))}),t.watch(()=>[e.props.width,e.props.height],()=>{const u=wn(e.props.width),b=wn(e.props.height);u!=null&&b!=null?(Zt==null||Zt.disconnect(),Zt=null):!Zt&&n.wrapperRef.value&&(Zt=new ResizeObserver(()=>kl()),Zt.observe(n.wrapperRef.value)),t.nextTick(()=>kl())}),t.watch(()=>e.props.theme,()=>d()),t.watch(()=>({...e.cells}),()=>t.nextTick(()=>n.emitModelData()),{deep:!1}),t.watch(()=>({...e.merges}),()=>{t.nextTick(()=>n.emitModelData()),d()},{deep:!1}),t.watch(n.activeSheetIndex,()=>t.nextTick(()=>n.emitModelData())),t.watch(()=>n.modelData.value,u=>{if(!u||u.length===0)return;const b=JSON.stringify(u);if(b===a.value)return;a.value=b;const T=e.selection.value?{...e.selection.value}:null,P={...e.activeCell.value};n.sheets.value=u.map(H=>{const ae=n.mkSheet(H.name),{cells:Be,styles:Pe}=fr(H.cells);if(Object.assign(ae.cells,Be),ae.styles=H.styles??Pe,H.borders)ae.borders=H.borders;else{const ut=mr(ae.styles);ae.styles=ut.styles,ae.borders=ut.borders}if(H.colWidths)for(const[ut,yt]of Object.entries(H.colWidths)){const Rt=Number(ut);Rt>=0&&Rt<e.colCount&&yt>=30&&(ae.colWidths[Rt]=yt)}if(H.rowHeights)for(const[ut,yt]of Object.entries(H.rowHeights)){const Rt=Number(ut);Rt>=0&&Rt<e.rowCount&&yt>=24&&(ae.rowHeights[Rt]=yt)}if(H.merges)for(const[ut,yt]of Object.entries(H.merges))ae.merges[ut]={...yt};return ae.freeze=H.freeze?{rows:H.freeze.rows,cols:H.freeze.cols}:{rows:0,cols:0},ae.filter=vr(H.filter,ae.cells),ae}),n.sheets.value.length>0&&n.loadSheet(0),T&&(e.selection.value=T),e.activeCell.value=P;const N=e.activeCell.value,q=e.selection.value,W=e.findMerge(N.col,N.row);W&&W.anchor===e.cellKey(N.col,N.row)&&(!q||q.startCol===N.col&&q.startRow===N.row&&q.endCol===N.col&&q.endRow===N.row)&&e.selectCell(N.col,N.row),d()},{deep:!0}),t.onBeforeUnmount(()=>{Zt==null||Zt.disconnect()})}return{scheduleRender:d,render:L,renderFrozenOverlay:oe,activeCellLabel:k,formulaBarDisplay:se,formulaBarDraft:Q,formulaBarExpanded:le,onFormulaBarFocus:Ke,onFormulaBarInput:Oe,onFormulaBarKeydown:ie,onFormulaBarBlur:he,acceptFormulaBarEdit:tt,cancelFormulaBarEdit:ye,insertFunctionIntoCell:Ge,renTab:Ae,renTabVal:dt,onTabClick:ue,onTabDblClick:ve,commitTabRename:p,cclTabRename:A,onTabRenameKd:$,ctxMenu:ee,ctxSubmenuLeft:It,filterPopup:U,isFilterButtonHit:G,openFilterPopup:xe,closeFilterPopup:$e,onCtxItemEnter:Je,onTabCtxMenu:ne,onTabBarCtx:Et,onCornerCtx:Dt,onRowHdrCtx:Ot,onColHdrCtx:de,onCellCtx:g,dimInputRef:M,dimPanel:Vt,openDimPanel:Cl,onDimInput:Xl,onDimKeydown:dn,onDimBlur:I,applyDimPanel:F,closeDimPanel:z,editInputStyle:we,hScrollbarW:Ve,vScrollbarH:ke,hScrollbarLeft:ce,vScrollbarTop:je,hTrackW:We,vTrackH:fe,hThumbW:ot,hThumbL:vt,vThumbH:R,vThumbT:j,onVStart:Ce,onHStart:Ne,onSbMove:lt,onSbUp:Ct,onVTrk:Ht,onHTrk:tl,onMouseDown:To,onMouseMove:No,onMouseUp:me,onMouseLeave:f,onCanvasCtx:S,onDblClick:B,onWheel:_,onTouchStart:K,onTouchMove:be,onTouchEnd:Me,onKeydown:Ye,onEditInput:ct,onEditCompositionStart:kt,onEditCompositionEnd:Kt,onEditKd:Mn,onEditPaste:Tl,onEditBlur:Ln,applySize:kl,setupLifecycle:Do}}function wf(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function kr(e,l,o,n){return l?n?o?e===l:e.toLowerCase()===l.toLowerCase():o?e.includes(l):e.toLowerCase().includes(l.toLowerCase()):!1}function vf(e,l,o,n){if(!l)return e;if(n){const i=e.indexOf(l);return i<0?e:e.slice(0,i)+o+e.slice(i+l.length)}const a=e.toLowerCase().indexOf(l.toLowerCase());return a<0?e:e.slice(0,a)+o+e.slice(a+l.length)}function kf(e,l,o,n){return l?n?e.indexOf(l)<0?e:e.split(l).join(o):e.toLowerCase().indexOf(l.toLowerCase())<0?e:e.replace(new RegExp(wf(l),"gi"),()=>o):e}function Bo(e,l,o,n,a,i,r){const c=[];if(r){for(let s=r.startRow;s<=r.endRow;s++)for(let m=r.startCol;m<=r.endCol;m++){const v=e[o(m,s)];v&&kr(v.value,n,a,i)&&c.push({sheetIndex:l,col:m,row:s})}return c}for(const s in e){const m=e[s];if(m&&kr(m.value,n,a,i)){const v=s.split(","),d=Number(v[0]),C=Number(v[1]);!Number.isNaN(d)&&!Number.isNaN(C)&&c.push({sheetIndex:l,col:d,row:C})}}return c}function Ef(e,l,o,n){const a=t.ref(!1),i=t.ref(""),r=t.ref(""),c=t.ref("sheet"),s=t.ref(!1),m=t.ref(!1),v=t.ref(-1),d=t.ref([]),C=t.ref(""),y=t.ref(0),h=t.ref(""),L=t.computed(()=>{const ue=new Set,ve=o.activeSheetIndex.value;for(const p of d.value)p.sheetIndex===ve&&ue.add(`${p.col},${p.row}`);return ue}),oe=t.computed(()=>{if(v.value<0||v.value>=d.value.length)return null;const ue=d.value[v.value];return ue.sheetIndex!==o.activeSheetIndex.value?null:`${ue.col},${ue.row}`});e.findHighlight=(ue,ve)=>{const p=`${ue},${ve}`;return oe.value===p?"active":L.value.has(p)?"match":null};function te(ue){var A,$;const ve=e.cellKey(ue.col,ue.row);if(ue.sheetIndex===o.activeSheetIndex.value)return((A=e.cells[ve])==null?void 0:A.value)??"";const p=o.sheets.value[ue.sheetIndex];return(($=p==null?void 0:p.cells[ve])==null?void 0:$.value)??""}function Y(ue,ve){const p=e.cellKey(ue.col,ue.row);if(ue.sheetIndex===o.activeSheetIndex.value)e.setCellValue(ue.col,ue.row,ve);else{const A=o.sheets.value[ue.sheetIndex];if(!A)return;const $=A.cells[p];A.cells[p]={value:String(ve),styleId:$==null?void 0:$.styleId}}}function k(){if(h.value){C.value=h.value;return}if(!i.value){C.value="";return}if(c.value==="selection"&&!e.selection.value){C.value=w(e.locale.value,"findNeedSelection");return}if(d.value.length===0){C.value=w(e.locale.value,"findNoResult");return}C.value=""}function Q(){const ue=i.value,ve=[];if(ue)if(c.value==="workbook")o.sheets.value.forEach((p,A)=>{ve.push(...Bo(p.cells,A,e.cellKey,ue,s.value,m.value))});else if(c.value==="selection"){const p=e.selection.value;p&&ve.push(...Bo(e.cells,o.activeSheetIndex.value,e.cellKey,ue,s.value,m.value,p))}else ve.push(...Bo(e.cells,o.activeSheetIndex.value,e.cellKey,ue,s.value,m.value));d.value=ve,ve.length===0?v.value=-1:v.value>=ve.length?v.value=ve.length-1:v.value<0&&(v.value=0),k()}function le(){if(v.value<0||v.value>=d.value.length)return;const ue=d.value[v.value];ue.sheetIndex!==o.activeSheetIndex.value&&o.switchSheet(ue.sheetIndex),c.value==="selection"?e.activeCell.value={col:ue.col,row:ue.row}:e.selectCell(ue.col,ue.row),e.ensureVisible(ue.col,ue.row)}const se=typeof requestAnimationFrame=="function"?requestAnimationFrame:ue=>setTimeout(ue,16);let Ke=!1,Oe=!1;function Ge(ue){if(Ke){Oe=Oe||ue;return}Ke=!0,Oe=ue,se(()=>{var ve;Ke=!1,Q(),Oe&&d.value.length>0&&v.value>=0&&le(),Oe=!1,(ve=e.scheduleRender)==null||ve.call(e)})}function Te(){var ue;a.value=!0,y.value++,Q(),d.value.length>0&&(v.value=0,le()),(ue=e.scheduleRender)==null||ue.call(e)}function qe(){Te()}function tt(){var ue;a.value=!1,d.value=[],v.value=-1,h.value="",C.value="",(ue=e.scheduleRender)==null||ue.call(e)}function ye(){var ue;d.value.length!==0&&(v.value=(v.value+1)%d.value.length,le(),(ue=e.scheduleRender)==null||ue.call(e))}function ie(){var ue;d.value.length!==0&&(v.value=(v.value-1+d.value.length)%d.value.length,le(),(ue=e.scheduleRender)==null||ue.call(e))}function he(){var $,ee;if(v.value<0||v.value>=d.value.length)return;const ue=d.value[v.value],ve=te(ue),p=vf(ve,i.value,r.value,s.value);if(p===ve)return;l.saveUndo(),Y(ue,p);const A=v.value;Q(),d.value.length>0?(v.value=Math.min(A,d.value.length-1),ye()):v.value=-1,($=e.emitModelData)==null||$.call(e),(ee=e.scheduleRender)==null||ee.call(e)}function Ae(){var A,$;const ue=i.value;if(!ue||d.value.length===0)return;l.saveUndo();let ve=0;const p=d.value.slice();for(const ee of p){const U=te(ee),O=kf(U,ue,r.value,s.value);O!==U&&(Y(ee,O),ve++)}d.value=[],v.value=-1,h.value=w(e.locale.value,"findReplacedAll").replace("{n}",String(ve)),k(),(A=e.emitModelData)==null||A.call(e),($=e.scheduleRender)==null||$.call(e)}function dt(){const ue=ve=>{if(!(ve.ctrlKey||ve.metaKey))return;const A=ve.key.toLowerCase();(A==="f"||A==="h")&&(ve.preventDefault(),Te())};window.addEventListener("keydown",ue),t.onBeforeUnmount(()=>window.removeEventListener("keydown",ue))}return t.watch(i,()=>{a.value&&(h.value="",v.value=0,Ge(!0))}),t.watch([c,s,m],()=>{a.value&&(h.value="",v.value=0,Ge(!0))}),t.watch(e.cells,()=>{a.value&&Ge(!1)},{deep:!0}),t.watch(()=>e.selection.value,()=>{a.value&&c.value==="selection"&&(v.value=0,Ge(!0))}),t.watch([()=>l.undoStack.value.length,()=>l.redoStack.value.length],()=>{a.value&&Ge(!1)}),{open:a,findText:i,replaceText:r,scope:c,matchCase:s,matchEntireCell:m,currentIndex:v,results:d,message:C,focusToken:y,activeSheetMatches:L,activeMatchKey:oe,openFind:Te,openReplace:qe,close:tt,recompute:Q,findNext:ye,findPrev:ie,replace:he,replaceAll:Ae,setupLifecycle:dt}}const Sf={class:"formula-bar__cell-label"},Rf={class:"formula-bar__buttons"},Mf=["title","aria-label"],Bf=["rows","value"],xf=["title"],Tf={key:0,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},Nf={key:1,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},Df=["value"],Vf={key:2,class:"sb-corner"},Ff=["onClick","onMouseenter"],If={class:"context-menu__label"},Af={key:0,class:"context-menu__arrow",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"22869"},Hf=["onClick"],Lf={class:"dim-panel__title"},Of={class:"dim-panel__body"},zf=["value"],_f={key:0,class:"dim-panel__error"},$f={class:"dim-panel__footer"},Er=Yt(t.defineComponent({__name:"spreader",props:t.mergeModels({rowCount:{default:200},colCount:{default:26},width:{},height:{},theme:{default:"light"},locale:{default:"zh-CN"}},{data:{default:()=>[]},dataModifiers:{}}),emits:["update:data"],setup(e){const l=e,o=t.useModel(e,"data"),n={value:""},a=rf(l,{rowCount:l.rowCount,colCount:l.colCount,theme:l.theme,locale:l.locale}),i={sheets:t.ref([]),activeSheetIndex:t.ref(0),saveSheet:()=>{},loadSheet:de=>{},mkSheet:de=>({id:"",name:de,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:[]})},r=af(a,i),c=sf(a,r);cf(r,{borderMenuOpen:c.borderMenuOpen,mergeMenuOpen:c.mergeMenuOpen});const s=Cf(a,r,o,void 0,n);i.sheets=s.sheets,i.activeSheetIndex=s.activeSheetIndex,i.saveSheet=s.saveSheet,i.loadSheet=s.loadSheet,i.mkSheet=s.mkSheet;const m=yf(a,r,c,s,n);m.setupLifecycle();const v=Ef(a,r,s);v.setupLifecycle();const d=t.reactive(a),C=t.reactive(r),y=t.reactive(c),h=t.reactive(s),L=s.sheets,oe=s.activeSheetIndex,te=s.sortMenuOpen,Y=s.cachedSortOrder,k=t.reactive(m),Q=t.reactive(v),le=t.computed(()=>{const de=d.selection;return!!de&&de.startCol===de.endCol&&de.startRow===de.endRow}),se=t.computed(()=>{const de=d.selection;return de?s.canSortColumns(de.startCol,de.endCol):!1}),Ke=t.computed(()=>{if(d.getFilter()!==null)return!0;const de=d.selection;if(!de)return!0;const g=Math.min(de.startCol,de.endCol),M=Math.max(de.startCol,de.endCol),Vt=Math.min(de.startRow,de.endRow),Mt=Math.max(de.startRow,de.endRow);for(const el in d.merges){const Ut=d.merges[el];if(!(Ut.startCol===Ut.endCol&&Ut.startRow===Ut.endRow)&&g<=Ut.endCol&&M>=Ut.startCol&&Vt<=Ut.endRow&&Mt>=Ut.startRow)return!1}return!0}),Oe=t.computed(()=>{const de=C.selNumberFormat;if(de!==Il&&de!==Kl)return de;const g=d.activeCell,M=a.resolveStyle(d.cells[d.cellKey(g.col,g.row)]);return typeof(M==null?void 0:M.numberFormat)=="string"?M.numberFormat:""});function Ge(de){r.nfDialogOpen.value=de}const Te=t.ref(!1);function qe(){Te.value=!0}function tt(de){Te.value=de}function ye(de){m.insertFunctionIntoCell(de)}function ie(){d.toggleAutoFilter(),k.scheduleRender()}function he(de){const g=d.getFilter();return g?d.getCellValue(de,g.range.startRow):""}const Ae=t.computed(()=>{const de=d.selection,g=de?de.startRow:d.activeCell.row,M=de?de.startCol:d.activeCell.col;return g===0&&M===0});function dt(de){const g=d.freeze;if(de==="panes"){const M=d.selection,Vt=M?M.startRow:d.activeCell.row,Mt=M?M.startCol:d.activeCell.col;d.setFreeze(Vt,Mt)}else de==="firstRow"?d.setFreeze(1,g.cols):de==="firstCol"?d.setFreeze(g.rows,1):de==="unfreeze"&&d.clearFreeze();k.scheduleRender()}const ue=t.ref(null),ve=t.ref(!1),p=t.ref(!1),A=t.ref(null),$=t.ref("create"),ee=t.computed(()=>{const de=d.selection;if(de){const M=ht(de.startCol)+(de.startRow+1),Vt=ht(de.endCol)+(de.endRow+1);return de.startCol===de.endCol&&de.startRow===de.endRow?M:`${M}:${Vt}`}const g=d.activeCell;return ht(g.col)+(g.row+1)});function U(de){var Vt;let g;["equal","notEqual","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual","between","notBetween"].includes(de)?g={type:"cellIs",operator:de,value:""}:de==="textContains"?g={type:"textContains",value:""}:de==="textNotContains"?g={type:"textNotContains",value:""}:de==="blank"?g={type:"blank"}:de==="notBlank"?g={type:"notBlank"}:de==="duplicate"?g={type:"duplicate"}:de==="unique"?g={type:"unique"}:g={type:"cellIs",operator:"greaterThan",value:""},A.value={id:"",condition:g,format:{backgroundColor:"#DEEBF7",color:"#17375E"},ranges:[],priority:0,stopIfTrue:!1,enabled:!0},$.value="create",(Vt=ue.value)==null||Vt.closeOverflow(),p.value=!0}function O(){var de;A.value={id:"",condition:{type:"cellIs",operator:"greaterThan",value:""},format:{backgroundColor:"#DEEBF7",color:"#17375E"},ranges:[],priority:0,stopIfTrue:!1,enabled:!0},$.value="create",(de=ue.value)==null||de.closeOverflow(),p.value=!0}function x(){var de;(de=ue.value)==null||de.closeOverflow(),ve.value=!0}function X(de){d.clearConditionalFormats(de),k.scheduleRender()}function Le(de){de.id?d.updateConditionalFormatRule(de.id,de):d.addConditionalFormatRule(de),p.value=!1}function re(de){var g;A.value=de,$.value="edit",(g=ue.value)==null||g.closeOverflow(),p.value=!0}function V(de){d.removeConditionalFormatRule(de)}function G(de,g){d.moveConditionalFormatRule(de,g)}function xe(de,g){d.updateConditionalFormatRule(de,{enabled:g})}function $e(de){r.fontSizeMenuOpen.value=de}function bt(de){r.textColorMenuOpen.value=de}function ge(de){r.fillColorMenuOpen.value=de}function pe(de){m.renTabVal.value=de}function it(){m.ctxMenu.value=null}const It=de=>{s.formulaBarRef.value=de};function Je(){m.formulaBarExpanded.value=!m.formulaBarExpanded.value}const E=de=>{s.wrapperRef.value=de},ne=de=>{s.canvasRef.value=de},Et=de=>{s.freezeCanvasRef.value=de},Dt=de=>{s.editInputRef.value=de},Ot=de=>{m.dimInputRef.value=de};return(de,g)=>(t.openBlock(),t.createElementBlock("div",{class:"spreadsheet-outer",style:t.normalizeStyle(h.outerStyle)},[t.createVNode(zc,{ref_key:"toolbarRef",ref:ue,locale:d.locale,"can-undo":C.canUndo,"can-redo":C.canRedo,"paint-fmt-active":C.paintFmt!==null,"has-selection":C.hasSelection,"font-family-options":C.fontFamilyOptions,"font-size-options":C.fontSizeOptions,"sel-font-family":C.selFontFamily,"sel-font-size":C.selFontSize,"font-size-input":C.fontSizeInput,"font-size-menu-open":C.fontSizeMenuOpen,"sel-font-weight":C.selFontWeight,"sel-font-style":C.selFontStyle,"sel-underline":C.selUnderline,"sel-strikethrough":C.selStrikethrough,"sel-text-color":C.selTextColor,"text-color-menu-open":C.textColorMenuOpen,"sel-fill-color":C.selFillColor,"fill-color-menu-open":C.fillColorMenuOpen,"cached-text-color":C.cachedTextColor,"cached-fill-color":C.cachedFillColor,"border-menu-open":y.borderMenuOpen,"cached-border":y.cachedBorder,"sort-menu-open":t.unref(te),"cached-sort-order":t.unref(Y),"can-sort":se.value,"can-filter":Ke.value,"filter-active":d.getFilter()!==null,"h-align-options":C.hAlignOptions,"v-align-options":C.vAlignOptions,"sel-h-align":C.selHAlign,"sel-v-align":C.selVAlign,"sel-wrap":C.selWrap,"merge-menu-open":y.mergeMenuOpen,"calc-menu-open":y.calcMenuOpen,"is-single-cell":le.value,"has-freeze":d.freeze.rows>0||d.freeze.cols>0,"freeze-panes-disabled":Ae.value,"sel-number-format":C.selNumberFormatDisplay,"nf-options":C.nfOptions,"can-increase-decimals":C.canIncreaseDecimals,"can-decrease-decimals":C.canDecreaseDecimals,"theme-vars":h.toolbarThemeVars,onUndo:g[0]||(g[0]=M=>C.undo()),onRedo:g[1]||(g[1]=M=>C.redo()),onPaintFormat:C.onPaintFormat,onClearFormat:g[2]||(g[2]=M=>C.clearFormat()),onNumberFormatChange:g[3]||(g[3]=M=>C.onNumberFormatChange(M)),onIncreaseDecimals:C.onIncreaseDecimals,onDecreaseDecimals:C.onDecreaseDecimals,onFontFamilyChange:g[4]||(g[4]=M=>C.onFontFamilyChange(M)),onFontSizeInput:g[5]||(g[5]=M=>C.onFontSizeInput(M)),onFontSizeBlur:C.onFontSizeBlur,onFontSizeKeydown:g[6]||(g[6]=M=>C.onFontSizeKeydown(M)),onFontSizeChange:g[7]||(g[7]=M=>C.onFontSizeChange(M)),"onUpdate:fontSizeMenuOpen":g[8]||(g[8]=M=>$e(M)),onFontSizeToggle:g[9]||(g[9]=M=>C.toggleFontSizeMenu()),onFontSizeStepUp:C.onFontSizeStepUp,onFontSizeStepDown:C.onFontSizeStepDown,onBoldToggle:C.toggleFontWeight,onItalicToggle:C.toggleFontStyle,onUnderlineToggle:C.toggleUnderline,onStrikethroughToggle:C.toggleStrikethrough,onTextColorChange:g[10]||(g[10]=M=>C.onTextColorChange(M)),"onUpdate:textColorMenuOpen":g[11]||(g[11]=M=>bt(M)),onFillColorChange:g[12]||(g[12]=M=>C.onFillColorChange(M)),"onUpdate:fillColorMenuOpen":g[13]||(g[13]=M=>ge(M)),onApplyTextColor:C.applyCachedTextColor,onApplyFillColor:C.applyCachedFillColor,"onUpdate:borderMenuOpen":g[14]||(g[14]=M=>C.onBorderMenuToggle(M)),onBorderChange:g[15]||(g[15]=M=>y.onBorderChange(M)),onApplyBorder:y.applyCachedBorder,"onUpdate:sortMenuOpen":g[16]||(g[16]=M=>h.onSortMenuToggle(M)),onSortChange:g[17]||(g[17]=M=>h.onSortChange(M)),onApplySort:h.applyCachedSort,onToggleFilter:ie,onFreezeChange:g[18]||(g[18]=M=>dt(M)),onHAlignChange:g[19]||(g[19]=M=>C.onHAlignChange(M)),onVAlignChange:g[20]||(g[20]=M=>C.onVAlignChange(M)),onWrapToggle:C.onWrapToggle,"onUpdate:mergeMenuOpen":g[21]||(g[21]=M=>y.onMergeMenuToggle(M)),onMergeChange:g[22]||(g[22]=M=>y.onMergeChange(M)),onApplyMerge:y.onApplyMerge,"onUpdate:calcMenuOpen":g[23]||(g[23]=M=>y.onCalcMenuToggle(M)),onCalcSum:y.onCalcSum,onCalcAvg:y.onCalcAvg,onCalcCount:y.onCalcCount,onFind:g[24]||(g[24]=M=>t.unref(v).openFind()),onCfPreset:g[25]||(g[25]=M=>U(M)),onCfNewRule:O,onCfManage:x,onCfClear:g[26]||(g[26]=M=>X(M))},null,8,["locale","can-undo","can-redo","paint-fmt-active","has-selection","font-family-options","font-size-options","sel-font-family","sel-font-size","font-size-input","font-size-menu-open","sel-font-weight","sel-font-style","sel-underline","sel-strikethrough","sel-text-color","text-color-menu-open","sel-fill-color","fill-color-menu-open","cached-text-color","cached-fill-color","border-menu-open","cached-border","sort-menu-open","cached-sort-order","can-sort","can-filter","filter-active","h-align-options","v-align-options","sel-h-align","sel-v-align","sel-wrap","merge-menu-open","calc-menu-open","is-single-cell","has-freeze","freeze-panes-disabled","sel-number-format","nf-options","can-increase-decimals","can-decrease-decimals","theme-vars","onPaintFormat","onIncreaseDecimals","onDecreaseDecimals","onFontSizeBlur","onFontSizeStepUp","onFontSizeStepDown","onBoldToggle","onItalicToggle","onUnderlineToggle","onStrikethroughToggle","onApplyTextColor","onApplyFillColor","onApplyBorder","onApplySort","onWrapToggle","onApplyMerge","onCalcSum","onCalcAvg","onCalcCount"]),t.createVNode(ps,{open:Q.open,"find-text":Q.findText,"replace-text":Q.replaceText,scope:Q.scope,"match-case":Q.matchCase,"match-entire-cell":Q.matchEntireCell,"current-index":Q.currentIndex,total:Q.results.length,message:Q.message,"focus-token":Q.focusToken,locale:d.locale,"theme-vars":h.toolbarThemeVars,"onUpdate:findText":g[27]||(g[27]=M=>t.unref(v).findText.value=M),"onUpdate:replaceText":g[28]||(g[28]=M=>t.unref(v).replaceText.value=M),"onUpdate:scope":g[29]||(g[29]=M=>t.unref(v).scope.value=M),"onUpdate:matchCase":g[30]||(g[30]=M=>t.unref(v).matchCase.value=M),"onUpdate:matchEntireCell":g[31]||(g[31]=M=>t.unref(v).matchEntireCell.value=M),onPrev:g[32]||(g[32]=M=>t.unref(v).findPrev()),onNext:g[33]||(g[33]=M=>t.unref(v).findNext()),onReplace:g[34]||(g[34]=M=>t.unref(v).replace()),onReplaceAll:g[35]||(g[35]=M=>t.unref(v).replaceAll()),onClose:g[36]||(g[36]=M=>t.unref(v).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($s,{"model-open":C.nfDialogOpen,locale:d.locale,"current-format":Oe.value,"is-custom":C.selNumberFormat===t.unref(Kl),"onUpdate:modelOpen":g[37]||(g[37]=M=>Ge(M)),onApply:g[38]||(g[38]=M=>C.applyNumberFormatCode(M))},null,8,["model-open","locale","current-format","is-custom"]),t.createVNode(js,{"model-open":h.sortConfirmOpen,locale:d.locale,"onUpdate:modelOpen":g[39]||(g[39]=M=>h.sortConfirmOpen=M),onConfirm:g[40]||(g[40]=M=>h.confirmSort(M)),onCancel:g[41]||(g[41]=M=>h.cancelSortConfirmation())},null,8,["model-open","locale"]),t.createVNode(hd,{"model-open":Te.value,locale:d.locale,"onUpdate:modelOpen":g[42]||(g[42]=M=>tt(M)),onInsert:g[43]||(g[43]=M=>ye(M))},null,8,["model-open","locale"]),t.createElementVNode("div",{class:t.normalizeClass(["formula-bar",{"formula-bar--expanded":k.formulaBarExpanded}])},[t.createElementVNode("div",Sf,t.toDisplayString(k.activeCellLabel),1),t.createElementVNode("div",Rf,[t.createElementVNode("button",{type:"button",class:"formula-bar__btn formula-bar__btn--cancel",title:"取消(Esc)","aria-label":"取消",onMousedown:g[44]||(g[44]=t.withModifiers(()=>{},["prevent"])),onClick:g[45]||(g[45]=t.withModifiers((...M)=>k.cancelFormulaBarEdit&&k.cancelFormulaBarEdit(...M),["stop"]))},[...g[101]||(g[101]=[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:g[46]||(g[46]=t.withModifiers(()=>{},["prevent"])),onClick:g[47]||(g[47]=t.withModifiers((...M)=>k.acceptFormulaBarEdit&&k.acceptFormulaBarEdit(...M),["stop"]))},[...g[102]||(g[102]=[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)(d.locale,"insertFunctionTitle"),"aria-label":t.unref(w)(d.locale,"insertFunctionTitle"),onMousedown:g[48]||(g[48]=t.withModifiers(()=>{},["prevent"])),onClick:t.withModifiers(qe,["stop"])},[...g[103]||(g[103]=[t.createElementVNode("span",{class:"formula-bar__fx-label"},"fx",-1)])],40,Mf)]),t.createElementVNode("textarea",{ref:It,class:t.normalizeClass(["formula-bar__input",{"formula-bar__input--expanded":k.formulaBarExpanded}]),rows:k.formulaBarExpanded?3:1,value:k.formulaBarDisplay,spellcheck:"false",onFocus:g[49]||(g[49]=(...M)=>k.onFormulaBarFocus&&k.onFormulaBarFocus(...M)),onInput:g[50]||(g[50]=(...M)=>k.onFormulaBarInput&&k.onFormulaBarInput(...M)),onKeydown:g[51]||(g[51]=(...M)=>k.onFormulaBarKeydown&&k.onFormulaBarKeydown(...M)),onBlur:g[52]||(g[52]=(...M)=>k.onFormulaBarBlur&&k.onFormulaBarBlur(...M))},null,42,Bf),t.createElementVNode("button",{type:"button",class:"formula-bar__toggle",title:k.formulaBarExpanded?"折叠为1行":"展开为3行",onMousedown:g[53]||(g[53]=t.withModifiers(()=>{},["prevent"])),onClick:t.withModifiers(Je,["stop"])},[k.formulaBarExpanded?(t.openBlock(),t.createElementBlock("svg",Nf,[...g[105]||(g[105]=[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",Tf,[...g[104]||(g[104]=[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,xf)],2),t.createElementVNode("div",{ref:E,class:"spreadsheet-wrapper"},[t.createElementVNode("canvas",{ref:ne,class:"grid-canvas",tabindex:"0",onMousedown:g[54]||(g[54]=(...M)=>k.onMouseDown&&k.onMouseDown(...M)),onMousemove:g[55]||(g[55]=(...M)=>k.onMouseMove&&k.onMouseMove(...M)),onMouseup:g[56]||(g[56]=(...M)=>k.onMouseUp&&k.onMouseUp(...M)),onMouseleave:g[57]||(g[57]=(...M)=>k.onMouseLeave&&k.onMouseLeave(...M)),onDblclick:g[58]||(g[58]=(...M)=>k.onDblClick&&k.onDblClick(...M)),onWheel:g[59]||(g[59]=t.withModifiers((...M)=>k.onWheel&&k.onWheel(...M),["prevent"])),onFocus:g[60]||(g[60]=(...M)=>h.onCanvasFocus&&h.onCanvasFocus(...M)),onKeydown:g[61]||(g[61]=(...M)=>k.onKeydown&&k.onKeydown(...M)),onContextmenu:g[62]||(g[62]=(...M)=>k.onCanvasCtx&&k.onCanvasCtx(...M)),onTouchstart:g[63]||(g[63]=t.withModifiers((...M)=>k.onTouchStart&&k.onTouchStart(...M),["prevent"])),onTouchmove:g[64]||(g[64]=t.withModifiers((...M)=>k.onTouchMove&&k.onTouchMove(...M),["prevent"])),onTouchend:g[65]||(g[65]=(...M)=>k.onTouchEnd&&k.onTouchEnd(...M))},null,32),t.createElementVNode("canvas",{ref:Et,class:"grid-canvas grid-canvas--freeze","aria-hidden":"true"}),t.createElementVNode("textarea",{ref:Dt,class:"cell-editor",value:d.editValue,style:t.normalizeStyle(k.editInputStyle),onInput:g[66]||(g[66]=(...M)=>k.onEditInput&&k.onEditInput(...M)),onKeydown:g[67]||(g[67]=(...M)=>k.onEditKd&&k.onEditKd(...M)),onCompositionstart:g[68]||(g[68]=(...M)=>k.onEditCompositionStart&&k.onEditCompositionStart(...M)),onCompositionend:g[69]||(g[69]=(...M)=>k.onEditCompositionEnd&&k.onEditCompositionEnd(...M)),onBlur:g[70]||(g[70]=(...M)=>k.onEditBlur&&k.onEditBlur(...M)),onPaste:g[71]||(g[71]=(...M)=>k.onEditPaste&&k.onEditPaste(...M))},null,44,Df),h.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"v-scrollbar",style:t.normalizeStyle({top:k.vScrollbarTop+"px",height:`calc(100% - ${k.vScrollbarTop+t.unref(11)}px)`})},[t.createElementVNode("button",{class:"sb-btn sb-btn--up",title:"",onMousedown:g[72]||(g[72]=t.withModifiers(M=>{h.clampScroll(null,d.scrollY-50),k.scheduleRender()},["prevent"]))},[...g[106]||(g[106]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--up"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--v",onMousedown:g[74]||(g[74]=(...M)=>k.onVTrk&&k.onVTrk(...M))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--v",style:t.normalizeStyle({top:k.vThumbT+"px",height:k.vThumbH+"px"}),onMousedown:g[73]||(g[73]=(...M)=>k.onVStart&&k.onVStart(...M))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--down",onMousedown:g[75]||(g[75]=t.withModifiers(M=>{h.clampScroll(null,d.scrollY+50),k.scheduleRender()},["prevent"]))},[...g[107]||(g[107]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--down"},null,-1)])],32)],4)):t.createCommentVNode("",!0),h.maxScrollX>0?(t.openBlock(),t.createElementBlock("div",{key:1,class:"h-scrollbar",style:t.normalizeStyle({left:k.hScrollbarLeft+"px",width:`calc(100% - ${k.hScrollbarLeft+t.unref(11)}px)`})},[t.createElementVNode("button",{class:"sb-btn sb-btn--left",onMousedown:g[76]||(g[76]=t.withModifiers(M=>{h.clampScroll(d.scrollX-50,null),k.scheduleRender()},["prevent"]))},[...g[108]||(g[108]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--left"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--h",onMousedown:g[78]||(g[78]=(...M)=>k.onHTrk&&k.onHTrk(...M))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--h",style:t.normalizeStyle({left:k.hThumbL+"px",width:k.hThumbW+"px"}),onMousedown:g[77]||(g[77]=(...M)=>k.onHStart&&k.onHStart(...M))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--right",onMousedown:g[79]||(g[79]=t.withModifiers(M=>{h.clampScroll(d.scrollX+50,null),k.scheduleRender()},["prevent"]))},[...g[109]||(g[109]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--right"},null,-1)])],32)],4)):t.createCommentVNode("",!0),h.maxScrollX>0&&h.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",Vf)):t.createCommentVNode("",!0)]),t.createVNode(Jc,{locale:d.locale,sheets:t.unref(L),"active-sheet-index":t.unref(oe),"ren-tab":k.renTab,"ren-tab-val":k.renTabVal,onTabClick:g[80]||(g[80]=M=>k.onTabClick(M)),onTabDblclick:g[81]||(g[81]=M=>k.onTabDblClick(M)),onTabContextmenu:g[82]||(g[82]=M=>k.onTabCtxMenu(M.ev,M.i)),onTabRenameInput:g[83]||(g[83]=M=>pe(M)),onTabRenameKeydown:g[84]||(g[84]=M=>k.onTabRenameKd(M)),onTabRenameCommit:k.commitTabRename,onTabbarContextmenu:g[85]||(g[85]=M=>k.onTabBarCtx(M)),onDeleteSheet:g[86]||(g[86]=M=>{h.removeSheet(M),k.scheduleRender()}),onAddSheet:g[87]||(g[87]=M=>{h.addSheet(),k.scheduleRender()})},null,8,["locale","sheets","active-sheet-index","ren-tab","ren-tab-val","onTabRenameCommit"]),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[k.ctxMenu?(t.openBlock(),t.createElementBlock("div",{key:0,class:"context-menu",style:t.normalizeStyle({left:k.ctxMenu.x+"px",top:k.ctxMenu.y+"px"}),onClick:g[88]||(g[88]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(k.ctxMenu.items,(M,Vt)=>(t.openBlock(),t.createElementBlock("div",{key:Vt,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":M.disabled}]),onClick:Mt=>!M.disabled&&M.action&&(M.action(),it()),onMouseenter:Mt=>k.onCtxItemEnter(Mt,M)},[t.createElementVNode("span",If,t.toDisplayString(M.label),1),M.children?(t.openBlock(),t.createElementBlock("svg",Af,[...g[110]||(g[110]=[t.createElementVNode("path",{d:"M361.386667 180.053333a32 32 0 0 0 0 45.226667L648.106667 512l-286.72 286.72a32 32 0 1 0 45.226666 45.226667l309.333334-309.333334a32 32 0 0 0 0-45.226666L406.613333 180.053333a32 32 0 0 0-45.226666 0z","p-id":"22870"},null,-1)])])):t.createCommentVNode("",!0),M.children?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["context-submenu",{"context-submenu--left":k.ctxSubmenuLeft}])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(M.children,(Mt,el)=>(t.openBlock(),t.createElementBlock("div",{key:el,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":Mt.disabled}]),onClick:t.withModifiers(Ut=>!Mt.disabled&&Mt.action&&(Mt.action(),it()),["stop"])},t.toDisplayString(Mt.label),11,Hf))),128))],2)):t.createCommentVNode("",!0)],42,Ff))),128))],4)):t.createCommentVNode("",!0)]),_:1})])),k.filterPopup?(t.openBlock(),t.createBlock(_d,{key:k.filterPopup.col,col:k.filterPopup.col,"header-label":he(k.filterPopup.col),anchor:{x:k.filterPopup.x,y:k.filterPopup.y},locale:d.locale,"get-filter":d.getFilter,"set-filter":d.setFilter,"set-filter-column":d.setFilterColumn,"clear-filter-column":d.clearFilterColumn,"get-column-candidates":d.getColumnCandidates,close:k.closeFilterPopup},null,8,["col","header-label","anchor","locale","get-filter","set-filter","set-filter-column","clear-filter-column","get-column-candidates","close"])):t.createCommentVNode("",!0),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[ve.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"cf-modal-mask",onClick:g[90]||(g[90]=t.withModifiers(M=>ve.value=!1,["self"]))},[t.createVNode(lu,{locale:d.locale,rules:d.conditionalFormats,"theme-vars":h.toolbarThemeVars,onNew:O,onEdit:re,onDelete:V,onMove:G,onToggle:xe,onClose:g[89]||(g[89]=M=>ve.value=!1)},null,8,["locale","rules","theme-vars"])])):t.createCommentVNode("",!0)])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[p.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"cf-modal-mask",onClick:g[92]||(g[92]=t.withModifiers(M=>p.value=!1,["self"]))},[t.createVNode(Wu,{locale:d.locale,mode:$.value,rule:A.value,"default-range-text":ee.value,"theme-vars":h.toolbarThemeVars,onSave:Le,onCancel:g[91]||(g[91]=M=>p.value=!1)},null,8,["locale","mode","rule","default-range-text","theme-vars"])])):t.createCommentVNode("",!0)])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[k.dimPanel?(t.openBlock(),t.createElementBlock("div",{key:0,class:"dim-panel",style:t.normalizeStyle({left:k.dimPanel.x+"px",top:k.dimPanel.y+"px"}),onMousedown:g[98]||(g[98]=t.withModifiers(()=>{},["stop"])),onTouchstart:g[99]||(g[99]=t.withModifiers(()=>{},["stop"])),onClick:g[100]||(g[100]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",Lf,t.toDisplayString(k.dimPanel.type==="row"?"行高":"列宽"),1),t.createElementVNode("div",Of,[t.createElementVNode("input",{ref:Ot,class:t.normalizeClass(["dim-panel__input",{"dim-panel__input--error":k.dimPanel.error}]),type:"number",step:"1",min:"1",inputmode:"numeric",value:k.dimPanel.value,onInput:g[93]||(g[93]=(...M)=>k.onDimInput&&k.onDimInput(...M)),onKeydown:g[94]||(g[94]=(...M)=>k.onDimKeydown&&k.onDimKeydown(...M)),onBlur:g[95]||(g[95]=(...M)=>k.onDimBlur&&k.onDimBlur(...M))},null,42,zf)]),k.dimPanel.error?(t.openBlock(),t.createElementBlock("div",_f,t.toDisplayString(k.dimPanel.error),1)):t.createCommentVNode("",!0),t.createElementVNode("div",$f,[t.createElementVNode("button",{class:"dim-panel__btn dim-panel__btn--primary",onClick:g[96]||(g[96]=(...M)=>k.applyDimPanel&&k.applyDimPanel(...M))}," 确定 "),t.createElementVNode("button",{class:"dim-panel__btn",onClick:g[97]||(g[97]=(...M)=>k.closeDimPanel&&k.closeDimPanel(...M))}," 取消 ")])],36)):t.createCommentVNode("",!0)]),_:1})]))],4))}}),[["__scopeId","data-v-09ccf3ed"]]);an.Spreader=Er,an.default=Er,Object.defineProperties(an,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|