xiaodao-spreader 0.1.13 → 0.1.15
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/dist/style.css +1 -1
- package/dist/xiaodao-spreader.es.js +2062 -2059
- package/dist/xiaodao-spreader.umd.js +9 -9
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
(function(Dt,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(Dt=typeof globalThis<"u"?globalThis:Dt||self,t(Dt.XiaoDaoSpreader={},Dt.Vue))})(this,function(Dt,t){"use strict";const uo={"zh-CN":{insert:"插入",delete:"删除",rename:"重命名",moveLeft:"左移",moveRight:"右移",cut:"剪切",copy:"复制",paste:"粘贴",addSheet:"新建工作表",moveSheetLeft:"左移",moveSheetRight:"右移",scrollUp:"向上滚动",scrollDown:"向下滚动",scrollLeft:"向左滚动",scrollRight:"向右滚动",calculate:"计算",sum:"求和",avg:"平均值",count:"计数",undo:"撤销",redo:"重做",paintFormat:"格式刷",clearFormat:"清除格式",fontFamily:"字体",fontSize:"字号",fontSizeIncrease:"增大字号",fontSizeDecrease:"减小字号",bold:"加粗",italic:"斜体",underline:"下划线",strikethrough:"删除线",fontColor:"文字颜色",fillColor:"填充颜色",borders:"边框",hAlign:"水平对齐",vAlign:"垂直对齐",alignLeft:"左端对齐",alignCenter:"居中对齐",alignRight:"右端对齐",alignTop:"顶端对齐",alignMiddle:"垂直居中",alignBottom:"底端对齐",wrap:"自动换行",mergeCells:"合并单元格",mergeCenter:"合并后居中",mergeAcross:"跨越合并",unmergeCells:"取消合并单元格",borderBottom:"下框线",borderTop:"上框线",borderLeft:"左框线",borderRight:"右框线",borderNone:"无框线",borderAll:"所有框线",borderOuter:"外框线",borderThickOuter:"粗外框线",fontDefault:"默认",rowHeight:"行高",colWidth:"列宽",autoRowHeight:"自动行高",defaultColWidth:"默认列宽",ok:"确定",cancel:"取消",dimNumberError:"请输入数字",dimRangeError:"请输入 {min}~{max} 之间的数值",colorAutomatic:"自动",colorNoFill:"无填充",colorWhite:"白色",colorBlack:"黑色",colorLightGray:"浅灰",colorLightBlue:"浅蓝",colorLightOrange:"浅橙",colorLightYellow:"浅黄",colorLightGreen:"浅绿",colorPaleBlue:"淡蓝",colorPaleOrange:"淡橙",colorPaleYellow:"淡黄",colorPaleGreen:"淡绿",colorSilver:"银色",colorSkyBlue:"天蓝",colorCoral:"珊瑚",colorGold:"金色",colorMint:"薄荷",colorGray:"灰色",colorMediumBlue:"中蓝",colorOrange:"橙色",colorAmber:"琥珀",colorMediumGreen:"中绿",colorDarkGray:"深灰",colorRoyalBlue:"宝蓝",colorRed:"红色",colorDarkGold:"深金",colorDarkGreen:"深绿",colorCharcoal:"炭灰",colorDeepBlue:"深蓝",colorDarkRed:"深红",colorOlive:"橄榄",colorForest:"森林",colorSlate:"石板灰",colorNavy:"藏青",colorCrimson:"绯红",colorDarkOlive:"深橄榄",colorDeepForest:"深林",colorDarkSlate:"深石板灰",colorMidnight:"午夜蓝",colorMaroon:"栗色",colorCoffee:"咖啡色",colorEvergreen:"常青",colorDarkNavy:"深藏青",colorDarkMaroon:"深栗",colorDarkCoffee:"深咖",colorInkGreen:"墨绿",numberFormat:"数字格式",nfGeneral:"常规",nfText:"文本",nfNumber:"数字",nfPercent:"百分比",nfScientific:"科学计数法",nfAccounting:"会计专用",nfFinancial:"财务数值",nfCurrency:"货币",nfCurrencyRounded:"货币取整",nfDate:"日期",nfTime:"时间",nfDateTime:"日期和时间",nfDuration:"持续时间",nfCustom:"其他数字格式…",nfMixed:"混合",nfDialogTitle:"设置单元格格式",nfCategory:"分类",nfCatGeneral:"常规",nfCatNumber:"数值",nfCatCurrency:"货币",nfCatAccounting:"会计专用",nfCatFinancial:"财务",nfCatPercent:"百分比",nfCatScientific:"科学计数",nfCatDate:"日期",nfCatTime:"时间",nfCatText:"文本",nfCatCurrencyRounded:"货币取整",nfCatDateTime:"日期和时间",nfCatDuration:"持续时间",nfCatCustom:"自定义",nfDecimals:"小数位数",nfThousands:"使用千位分隔符",nfSymbol:"货币符号",nfDateFormat:"日期格式",nfTimeFormat:"时间格式",nfCustomCode:"自定义格式代码",nfPreview:"预览",nfPreviewSample:"示例",find:"查找",findReplace:"查找和替换",findPlaceholder:"查找内容",replacePlaceholder:"替换为",findPrev:"上一个",findNext:"下一个",replace:"替换",replaceAll:"全部替换",findScope:"范围",scopeSheet:"当前工作表",scopeWorkbook:"整个工作簿",scopeSelection:"当前选区",matchCase:"区分大小写",matchEntireCell:"完整匹配",findNoResult:"未找到",findNeedSelection:"请先选择范围",findReplacedAll:"已替换 {n} 处",findClose:"关闭"},"en-US":{insert:"Insert",delete:"Delete",rename:"Rename",moveLeft:"Move Left",moveRight:"Move Right",cut:"Cut",copy:"Copy",paste:"Paste",addSheet:"Add new sheet",moveSheetLeft:"Move Left",moveSheetRight:"Move Right",scrollUp:"Scroll up",scrollDown:"Scroll down",scrollLeft:"Scroll left",scrollRight:"Scroll right",calculate:"Calculate",sum:"Sum",avg:"Average",count:"Count",undo:"Undo",redo:"Redo",paintFormat:"Paint Format",clearFormat:"Clear Format",fontFamily:"Font Family",fontSize:"Font Size",fontSizeIncrease:"Increase Font Size",fontSizeDecrease:"Decrease Font Size",bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",fontColor:"Font Color",fillColor:"Fill Color",borders:"Borders",hAlign:"Horizontal Align",vAlign:"Vertical Align",alignLeft:"Align Left",alignCenter:"Align Center",alignRight:"Align Right",alignTop:"Align Top",alignMiddle:"Align Middle",alignBottom:"Align Bottom",wrap:"Wrap Text",mergeCells:"Merge Cells",mergeCenter:"Merge & Center",mergeAcross:"Merge Across",unmergeCells:"Unmerge Cells",borderBottom:"Bottom Border",borderTop:"Top Border",borderLeft:"Left Border",borderRight:"Right Border",borderNone:"No Border",borderAll:"All Borders",borderOuter:"Outside Borders",borderThickOuter:"Thick Box Border",fontDefault:"Default",rowHeight:"Row Height",colWidth:"Column Width",autoRowHeight:"Auto Row Height",defaultColWidth:"Default Column Width",ok:"OK",cancel:"Cancel",dimNumberError:"Please enter a number",dimRangeError:"Please enter a value between {min} and {max}",colorAutomatic:"Automatic",colorNoFill:"No Fill",colorWhite:"White",colorBlack:"Black",colorLightGray:"Light Gray",colorLightBlue:"Light Blue",colorLightOrange:"Light Orange",colorLightYellow:"Light Yellow",colorLightGreen:"Light Green",colorPaleBlue:"Pale Blue",colorPaleOrange:"Pale Orange",colorPaleYellow:"Pale Yellow",colorPaleGreen:"Pale Green",colorSilver:"Silver",colorSkyBlue:"Sky Blue",colorCoral:"Coral",colorGold:"Gold",colorMint:"Mint",colorGray:"Gray",colorMediumBlue:"Medium Blue",colorOrange:"Orange",colorAmber:"Amber",colorMediumGreen:"Medium Green",colorDarkGray:"Dark Gray",colorRoyalBlue:"Royal Blue",colorRed:"Red",colorDarkGold:"Dark Gold",colorDarkGreen:"Dark Green",colorCharcoal:"Charcoal",colorDeepBlue:"Deep Blue",colorDarkRed:"Dark Red",colorOlive:"Olive",colorForest:"Forest",colorSlate:"Slate",colorNavy:"Navy",colorCrimson:"Crimson",colorDarkOlive:"Dark Olive",colorDeepForest:"Deep Forest",colorDarkSlate:"Dark Slate",colorMidnight:"Midnight",colorMaroon:"Maroon",colorCoffee:"Coffee",colorEvergreen:"Evergreen",colorDarkNavy:"Dark Navy",colorDarkMaroon:"Dark Maroon",colorDarkCoffee:"Dark Coffee",colorInkGreen:"Ink Green",numberFormat:"Number Format",nfGeneral:"General",nfText:"Text",nfNumber:"Number",nfPercent:"Percentage",nfScientific:"Scientific",nfAccounting:"Accounting",nfFinancial:"Financial",nfCurrency:"Currency",nfCurrencyRounded:"Currency Rounded",nfDate:"Date",nfTime:"Time",nfDateTime:"Date & Time",nfDuration:"Duration",nfCustom:"Other Number Formats…",nfMixed:"Mixed",nfDialogTitle:"Format Cells",nfCategory:"Category",nfCatGeneral:"General",nfCatNumber:"Number",nfCatCurrency:"Currency",nfCatAccounting:"Accounting",nfCatFinancial:"Financial",nfCatPercent:"Percentage",nfCatScientific:"Scientific",nfCatDate:"Date",nfCatTime:"Time",nfCatText:"Text",nfCatCurrencyRounded:"Currency Rounded",nfCatDateTime:"Date & Time",nfCatDuration:"Duration",nfCatCustom:"Custom",nfDecimals:"Decimal places",nfThousands:"Use 1000 separator",nfSymbol:"Currency symbol",nfDateFormat:"Date format",nfTimeFormat:"Time format",nfCustomCode:"Custom format code",nfPreview:"Preview",nfPreviewSample:"Sample",find:"Find",findReplace:"Find & Replace",findPlaceholder:"Find what",replacePlaceholder:"Replace with",findPrev:"Previous",findNext:"Next",replace:"Replace",replaceAll:"Replace All",findScope:"Scope",scopeSheet:"Current sheet",scopeWorkbook:"Entire workbook",scopeSelection:"Current selection",matchCase:"Match case",matchEntireCell:"Match entire cell",findNoResult:"No results",findNeedSelection:"Select a range first",findReplacedAll:"Replaced {n} occurrence(s)",findClose:"Close"}};function N(e,n){var o;return((o=uo[e])==null?void 0:o[n])??n}const Pt='-apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif',kt=10,fo=[{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'}],mo=[{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}],po='<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>',go='<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>',ho='<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>',Co='<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>',bo='<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>',yo='<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>',vo=[{value:"left",labelKey:"alignLeft",icon:po},{value:"center",labelKey:"alignCenter",icon:go},{value:"right",labelKey:"alignRight",icon:ho}],wo=[{value:"top",labelKey:"alignTop",icon:Co},{value:"middle",labelKey:"alignMiddle",icon:bo},{value:"bottom",labelKey:"alignBottom",icon:yo}],Nl=[{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>'}],ko={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)"},Eo={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)"},Al="__nf_custom__",nl="",rl="",Ht="@",gl="__NF_INVALID__",Hl=2958465,Vl=0;function Yt(e){return e==null||e===""?!0:e.toUpperCase()==="GENERAL"}function Fl(e){return e==="zh-CN"?"¥":"$"}function Ro(e){return e.replace(/\*/g,"").replace(/_.|_\b/g,"")}function Ol(e){return e.replace(/"([^"]*)"/g,"$1")}function Bo(e){let n=e,o;const l=n.match(/^\[([^\]]+)\]/);l&&(o=l[1].toLowerCase(),n=n.slice(l[0].length)),n=Ro(n);const c=/E[+-]/i.test(n),d=n.includes("%"),r=n.search(/[0#?]/);if(r===-1)return{hasDigits:!1,decimals:0,minDecimals:0,minIntDigits:0,thousands:!1,scale:d?100:1,scientific:!1,prefix:n,suffix:"",color:o};let v=-1;for(let Z=n.length-1;Z>=0;Z--){const J=n[Z];if(J==="0"||J==="#"||J==="?"||J==="E"){v=Z;break}}v<0&&(v=r);const u=r>0?n.slice(0,r):"",k=v<n.length-1?n.slice(v+1):"",x=n.slice(r,v+1),S=/[0#?]/.test(x),w=x.includes(",");let B=x.replace(/,/g,"");if(c){const Z=B.search(/E/i);Z>=0&&(B=B.slice(0,Z))}const le=B.indexOf("."),ne=le>=0?B.slice(0,le):B,p=le>=0?B.slice(le+1):"",V=(p.match(/[0#?]/g)||[]).length,P=(p.match(/0/g)||[]).length,oe=(ne.match(/0/g)||[]).length;return{hasDigits:S,decimals:V,minDecimals:P,minIntDigits:oe,thousands:w,scale:d?100:1,scientific:c,prefix:u,suffix:k,color:o}}function xo(e){const n=[];let o=!1;const l=/\[h\]|\[mm\]|\[ss\]|yyyy|yy|y|mmmm|mmm|mm|m|dddd|ddd|dd|d|hh|h|ss|s|AM\/PM|am\/pm|"[^"]*"|\/|-|:|\s+|[^\s]/g;let c;for(;(c=l.exec(e))!==null;){const d=c[0];switch(d){case"[h]":o=!0,n.push({type:"hour",len:0});break;case"[mm]":o=!0,n.push({type:"minute",len:2});break;case"[ss]":o=!0,n.push({type:"second",len:2});break;case"yyyy":n.push({type:"year",len:4});break;case"yy":case"y":n.push({type:"year",len:2});break;case"mmmm":n.push({type:"monthName",len:4});break;case"mmm":n.push({type:"monthName",len:3});break;case"mm":n.push({type:"month",len:2});break;case"m":n.push({type:"month",len:1});break;case"dddd":n.push({type:"weekday",len:4});break;case"ddd":n.push({type:"weekday",len:3});break;case"dd":n.push({type:"day",len:2});break;case"d":n.push({type:"day",len:1});break;case"hh":n.push({type:"hour",len:2});break;case"h":n.push({type:"hour",len:1});break;case"ss":n.push({type:"second",len:2});break;case"s":n.push({type:"second",len:1});break;case"AM/PM":case"am/pm":n.push({type:"ampm",len:2});break;default:d.startsWith('"')?n.push({type:"literal",text:Ol(d),len:0}):n.push({type:"literal",text:d,len:0})}}return{tokens:n,isDuration:o}}const Ll=new Map;function Mo(e){if(/[ydhs]/.test(e)||/AM\/PM/i.test(e)||/\[h\]/i.test(e)){const c=e.split(";")[0]??e,{tokens:d,isDuration:r}=xo(c);return{kind:r?"duration":"date",sections:[],tokens:d,isDuration:r,raw:e}}return{kind:"number",sections:e.split(";").map(c=>Bo(c)),tokens:[],isDuration:!1,raw:e}}function al(e){const n=Ll.get(e);if(n)return n;const o=Mo(e);return Ll.set(e,o),o}function Il(e,n,o,l,c){const d=Math.pow(10,n),r=Math.round((e+Number.EPSILON)*d)/d,v=r<0,u=Math.abs(r);let x=new Intl.NumberFormat("en-US",{useGrouping:l,minimumIntegerDigits:c,minimumFractionDigits:n,maximumFractionDigits:n}).format(u);if(o<n&&n>0){const w=x.indexOf(".");if(w>=0){const R=x.substring(0,w);let B=x.substring(w+1);B=B.replace(/0+$/,""),B.length<o&&(B=B+"0".repeat(o-B.length)),x=B?`${R}.${B}`:R}}return`${v?"-":""}${x}`}function $l(e,n){if(e===0)return(n>0?"0."+"0".repeat(n):"0")+"E+00";const o=Math.floor(Math.log10(Math.abs(e))),l=e/Math.pow(10,o),c=Il(l,n,n,!1,1),d=(o>=0?"+":"-")+String(Math.abs(o)).padStart(2,"0");return`${c}E${d}`}function So(e,n,o){if(!o.hasDigits)return Ol(o.prefix+o.suffix);const l=o.scale===100?e*100:e,c=o.scientific?$l(l,o.decimals):Il(l,o.decimals,o.minDecimals,o.thousands,o.minIntDigits);return n+o.prefix+c+o.suffix}function To(e,n){const o=n.sections;if(o.length===0)return String(e);let l,c,d="";return e>0?(l=o[0],c=e):e<0?o[1]?(l=o[1],c=-e):(l=o[0],c=-e,d="-"):(l=o[2]??o[0],c=0),So(c,d,l)}function Do(e){return new Date((e-25569)*864e5)}const No=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],Ao=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],zl=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],Ho=["January","February","March","April","May","June","July","August","September","October","November","December"],Vo=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Wl=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function _t(e,n){return String(e).padStart(n,"0")}function Fo(e,n,o,l){const c=e.getUTCFullYear(),d=e.getUTCMonth()+1,r=e.getUTCDate(),v=e.getUTCDay(),u=o==="zh-CN";let k="",x=!1;for(const S of n)switch(S.type){case"literal":k+=S.text??"";break;case"year":k+=S.len>=4?String(c):String(c%100).padStart(2,"0");break;case"month":k+=_t(x?e.getUTCMinutes():d,S.len);break;case"monthName":k+=S.len>=4?u?No[d-1]:Ho[d-1]:u?Ao[d-1]:Vo[d-1];break;case"day":k+=_t(r,S.len);break;case"weekday":k+=S.len>=4?u?zl[v]:Wl[v]:u?zl[v].slice(2):Wl[v].slice(0,3);break;case"hour":{let w=e.getUTCHours();if(S.len===0){const R=Math.floor(l*86400);w=Math.floor(R/3600)}k+=String(w),x=!0;break}case"minute":k+=_t(e.getUTCMinutes(),S.len);break;case"second":k+=_t(e.getUTCSeconds(),S.len);break;case"ampm":{const w=e.getUTCHours();k+=w<12?u?"上午":"AM":u?"下午":"PM";break}}return k}function Oo(e,n){const o=Math.floor(e*86400),l=Math.floor(o/3600),c=Math.floor(o%3600/60),d=o%60;let r="";for(const v of n)switch(v.type){case"literal":r+=v.text??"";break;case"hour":r+=String(l);break;case"minute":r+=_t(c,v.len||2);break;case"second":r+=_t(d,v.len||2);break;default:r+=""}return r}function Lo(e){if(e==="")return e;const n=Number(e);if(!isNaN(n)&&e.trim()!==""){const o=Math.abs(n);return o!==0&&(o>=1e15||o<1e-9)?$l(n,9):e}return e}function hl(e,n,o){if(Yt(n))return Lo(e);if(n==null||n===Ht)return e;const l=al(n);if(l.kind==="date"||l.kind==="duration"){const d=Number(e);if(!isFinite(d))return e;if(l.kind==="date"){if(d<Vl||d>Hl)return gl}else if(d<0)return gl;return l.kind==="duration"?Oo(d,l.tokens):Fo(Do(d),l.tokens,o,d)}const c=Number(e);return isNaN(c)?e:To(c,l)}const Io=["general","number","currency","currencyRounded","accounting","financial","percent","scientific","date","time","dateTime","duration","text","custom"];function _l(e,n){if(n===Ht||n==="@")return!1;if(Yt(n)){if(e==null||e===""||e.trim()==="")return!1;const l=Number(e);return!Number.isNaN(l)&&Number.isFinite(l)}const o=al(n);return!!(o.kind==="number"&&Kl(o))}function Kl(e){return e.sections.some(n=>n.hasDigits)}function $o(e){if(e==null||Yt(e)||e===Ht||e==="@")return!1;const n=al(e);return!!(n.kind==="date"||n.kind==="duration"||n.kind==="number"&&Kl(n))}function zo(e,n){if(n==null||Yt(n)||n===Ht||n==="@")return!1;const o=al(n),l=Number(e);return Number.isFinite(l)?o.kind==="date"?l<Vl||l>Hl:o.kind==="duration"?l<0:!1:!1}function Wo(e,n,o,l){const c=Fl(e),d=l?"#,##0":"0",r=o>0?"."+"0".repeat(o):"",v=d+r;switch(n){case"general":return"";case"text":return Ht;case"custom":return"";case"number":return v;case"percent":return v+"%";case"scientific":return"0."+"0".repeat(o)+"E+00";case"currency":return c+v;case"currencyRounded":return c+(l?"#,##0":"0");case"accounting":return`${c}${v};(${c}${v});${c}"-"`;case"financial":return`${v};[Red](${v})`;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 _o(e){const n=Fl(e);return[{label:N(e,"nfGeneral"),value:rl},{label:N(e,"nfText"),value:Ht},{label:N(e,"nfNumber"),value:"#,##0.00"},{label:N(e,"nfPercent"),value:"0.00%"},{label:N(e,"nfScientific"),value:"0.00E+00"},{label:N(e,"nfAccounting"),value:`${n}#,##0.00;(${n}#,##0.00);${n}"-"`},{label:N(e,"nfFinancial"),value:"#,##0.00;[Red](#,##0.00)"},{label:N(e,"nfCurrency"),value:n+"#,##0.00"},{label:N(e,"nfCurrencyRounded"),value:n+"#,##0"},{label:N(e,"nfDate"),value:e==="zh-CN"?'yyyy"年"m"月"d"日"':"m/d/yyyy"},{label:N(e,"nfTime"),value:"h:mm:ss"},{label:N(e,"nfDateTime"),value:e==="zh-CN"?'yyyy"年"m"月"d"日" h:mm:ss':"m/d/yyyy h:mm:ss"},{label:N(e,"nfDuration"),value:"[h]:mm:ss"},{label:N(e,"nfCustom"),value:Al}]}const Ko=["title"],Uo=["innerHTML"],Go={key:1,class:"sp-dropdown__value"},Po=["disabled"],Yo=["onClick"],Xo=["innerHTML"],jo={class:"sp-dropdown__item-label"},Zo=["disabled"],qo=t.defineComponent({__name:"dropdown",props:{modelValue:{},options:{},width:{default:"auto"},menuWidth:{default:void 0},visibleCount:{default:8},title:{default:""},modelOpen:{type:Boolean,default:void 0},hideTrigger:{type:Boolean,default:!1},align:{default:"left"},triggerEl:{default:null},fallbackLabel:{default:""}},emits:["update:modelValue","change","update:modelOpen"],setup(e,{emit:n}){const o=e,l=n,c=t.ref(!1),d=t.ref(0),r=t.ref(null),v=t.ref(null),u=t.ref(null),k=t.ref({top:0,up:!1}),x=t.ref(0),S=t.ref(!1),w=t.computed(()=>o.options.find(se=>String(se.value)===String(o.modelValue))),R=t.computed(()=>o.menuWidth),B=t.computed(()=>Math.min(o.visibleCount,o.options.length)),le=t.computed(()=>o.options.slice(d.value,d.value+B.value)),ne=t.computed(()=>d.value>0),p=t.computed(()=>d.value+B.value<o.options.length),V=t.computed(()=>o.options.length>B.value);function P(se){d.value=Math.max(0,Math.min(o.options.length-B.value,d.value+se))}function oe(){c.value=!0,o.modelOpen!==void 0&&l("update:modelOpen",!0);const se=o.triggerEl??r.value;if(!se)return;const de=se.getBoundingClientRect(),Te=B.value*22+(V.value?2*15:0)+8,i=window.innerHeight-de.bottom-4<Te&&de.top-4>Te;o.align==="right"?k.value={right:window.innerWidth-de.right,top:i?de.top-Te-4:de.bottom+4,up:i}:k.value={left:de.left,top:i?de.top-Te-4:de.bottom+4,up:i};const m=o.options.findIndex(fe=>String(fe.value)===String(o.modelValue));d.value=m>=0?Math.max(0,Math.min(m-Math.floor(B.value/2),o.options.length-B.value)):0}function Z(){c.value=!1,o.modelOpen!==void 0&&l("update:modelOpen",!1)}function J(){c.value?Z():oe()}function q(se){l("update:modelValue",se.value),l("change",se.value),Z()}function ue(se){var Te,re;if(!c.value)return;const de=se.target;(Te=r.value)!=null&&Te.contains(de)||(re=u.value)!=null&&re.contains(de)||Z()}function Fe(se){c.value&&(se.preventDefault(),P(se.deltaY>0?1:-1))}t.watch(c,se=>{t.nextTick(()=>{var de,Te;se?(de=v.value)==null||de.addEventListener("wheel",Fe,{passive:!1}):(Te=v.value)==null||Te.removeEventListener("wheel",Fe)})}),t.watch(()=>o.modelOpen,se=>{se!==void 0&&se!==c.value&&(se?oe():Z())});function Oe(se){c.value&&(x.value=se.touches[0].clientY,S.value=!0)}function Je(se){if(!c.value||!S.value)return;const de=se.touches[0].clientY-x.value;Math.abs(de)>5&&(P(de<0?1:-1),x.value=se.touches[0].clientY)}function Ge(){S.value=!1}function je(se){se.key==="Escape"&&Z()}return t.onMounted(()=>{document.addEventListener("pointerdown",ue),window.addEventListener("resize",Z),window.addEventListener("scroll",Z,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",ue),window.removeEventListener("resize",Z),window.removeEventListener("scroll",Z,!0)}),(se,de)=>{var Te,re;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":c.value}]),title:e.title,onClick:J},[(Te=w.value)!=null&&Te.icon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__icon",innerHTML:w.value.icon},null,8,Uo)):(t.openBlock(),t.createElementBlock("span",Go,t.toDisplayString(((re=w.value)==null?void 0:re.label)??e.fallbackLabel),1)),de[2]||(de[2]=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,Ko)),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[c.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:u,class:t.normalizeClass(["sp-dropdown__menu",{"sp-dropdown__menu--up":k.value.up}]),style:t.normalizeStyle({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",minWidth:R.value!==void 0?typeof R.value=="number"?R.value+"px":R.value:void 0}),onKeydown:je},[V.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!ne.value}]),disabled:!ne.value,onClick:de[0]||(de[0]=i=>P(-1))},[...de[3]||(de[3]=[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,Po)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:v,class:"sp-dropdown__list",onTouchstart:Oe,onTouchmove:Je,onTouchend:Ge},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(le.value,i=>(t.openBlock(),t.createElementBlock("button",{key:String(i.value),type:"button",class:t.normalizeClass(["sp-dropdown__item",{"sp-dropdown__item--active":String(i.value)===String(e.modelValue)}]),onClick:m=>q(i)},[i.icon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__item-icon",innerHTML:i.icon},null,8,Xo)):t.createCommentVNode("",!0),t.createElementVNode("span",jo,t.toDisplayString(i.label),1)],10,Yo))),128))],544),V.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!p.value}]),disabled:!p.value,onClick:de[1]||(de[1]=i=>P(1))},[...de[4]||(de[4]=[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,Zo)):t.createCommentVNode("",!0)],38)):t.createCommentVNode("",!0)]),_:1})]))],4)}}}),vt=(e,n)=>{const o=e.__vccOpts||e;for(const[l,c]of n)o[l]=c;return o},Xt=vt(qo,[["__scopeId","data-v-77df3baf"]]),Jo=["title","onClick"],Ul=vt(t.defineComponent({__name:"colorPicker",props:{modelOpen:{type:Boolean,default:void 0},colorKey:{default:"text"},currentColor:{default:""},locale:{default:"zh-CN"},triggerEl:{default:null}},emits:["update:modelValue","change","update:modelOpen"],setup(e,{expose:n,emit:o}){const l=e,c=o,d=[[{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"}]],v=t.computed(()=>l.colorKey==="fill"?r:d);function u(V){return N(l.locale,V)}function k(V){const P=l.currentColor;return!P&&!V?!0:P?P.toLowerCase()===V.toLowerCase():!1}const x=t.ref(!1),S=t.ref(null),w=t.ref(null),R=t.ref({top:0});t.watch(()=>l.modelOpen,V=>{V!==void 0&&V!==x.value&&(V?le():ne())});function B(V){const P=S.value,oe=w.value,Z=V.target;P&&P.contains(Z)||oe&&oe.contains(Z)||ne()}function le(){x.value=!0,l.modelOpen!==void 0&&c("update:modelOpen",!0),t.nextTick(()=>{const V=l.triggerEl??S.value;if(V){const P=V.getBoundingClientRect(),oe=150,Z=120;let J=window.innerWidth-P.right,q=P.bottom+4,ue;P.left-Z<4&&(J=void 0,ue=Math.max(4,P.left)),q+oe>window.innerHeight-4&&(q=P.top-oe-4),q<4&&(q=4),R.value=J!==void 0?{right:J,top:q}:{left:ue,top:q}}document.addEventListener("pointerdown",B)})}function ne(){x.value=!1,l.modelOpen!==void 0&&c("update:modelOpen",!1),document.removeEventListener("pointerdown",B)}function p(V){c("update:modelValue",V),c("change",V),ne()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",B)}),n({open:x,openMenu:le,close:ne}),(V,P)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:S,class:"color-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[x.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:w,class:"color-picker__menu",style:t.normalizeStyle({left:R.value.left!==void 0?R.value.left+"px":void 0,right:R.value.right!==void 0?R.value.right+"px":void 0,top:R.value.top+"px"}),onMousedown:P[0]||(P[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(v.value,(oe,Z)=>(t.openBlock(),t.createElementBlock("div",{key:Z,class:"color-picker__row"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(oe,J=>(t.openBlock(),t.createElementBlock("button",{key:J.value,class:t.normalizeClass(["color-picker__swatch",{"color-picker__swatch--selected":k(J.value)}]),title:u(J.key),style:t.normalizeStyle({background:J.value||"transparent",border:J.value?"1px solid rgba(0,0,0,0.15)":"1px dashed #999"}),onClick:q=>p(J.value)},null,14,Jo))),128))]))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-f8fac424"]]),Qo=["title","onClick"],en={viewBox:"0 0 30 30",class:"border-picker__icon"},tn=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],ln={class:"border-picker__label"},on=vt(t.defineComponent({__name:"borderPicker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},currentBorder:{default:"none"},triggerEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:n,emit:o}){const l=e,c=o,d=[{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}],v={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"]},u={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function k(V,P){return u[V].includes(P)?"thick":v[V].includes(P)?"solid":"dashed"}const x=t.ref(!1),S=t.ref(null),w=t.ref(null),R=t.ref({top:0});t.watch(()=>l.modelOpen,V=>{V!==void 0&&V!==x.value&&(V?le():ne())});function B(V){const P=S.value,oe=w.value,Z=V.target;P&&P.contains(Z)||oe&&oe.contains(Z)||ne()}function le(){x.value=!0,l.modelOpen!==void 0&&c("update:modelOpen",!0),t.nextTick(()=>{const V=l.triggerEl??S.value;if(V){const P=V.getBoundingClientRect(),oe=200,Z=160;let J=window.innerWidth-P.right,q=P.bottom+4,ue;P.left-Z<4&&(J=void 0,ue=Math.max(4,P.left)),q+oe>window.innerHeight-4&&(q=P.top-oe-4),q<4&&(q=4),R.value=J!==void 0?{right:J,top:q}:{left:ue,top:q}}document.addEventListener("pointerdown",B)})}function ne(){x.value=!1,l.modelOpen!==void 0&&c("update:modelOpen",!1),document.removeEventListener("pointerdown",B)}function p(V){c("change",V),ne()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",B)}),n({open:x,openMenu:le,close:ne}),(V,P)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:S,class:"border-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[x.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:w,class:"border-picker__menu",style:t.normalizeStyle({left:R.value.left!==void 0?R.value.left+"px":void 0,right:R.value.right!==void 0?R.value.right+"px":void 0,top:R.value.top+"px"}),onMousedown:P[0]||(P[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(d,oe=>t.createElementVNode("button",{key:oe.key,class:"border-picker__item",title:t.unref(N)(e.locale,oe.i18nKey),onClick:Z=>p(oe.key)},[(t.openBlock(),t.createElementBlock("svg",en,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(r,Z=>t.createElementVNode("line",{key:Z.name,x1:Z.x1,y1:Z.y1,x2:Z.x2,y2:Z.y2,stroke:"currentColor","stroke-width":k(oe.key,Z.name)==="thick"?3:1.5,"stroke-dasharray":k(oe.key,Z.name)==="dashed"?"0 4":"none","stroke-linecap":k(oe.key,Z.name)==="dashed"?"round":"square"},null,8,tn)),64))])),t.createElementVNode("span",ln,t.toDisplayString(t.unref(N)(e.locale,oe.i18nKey)),1)],8,Qo)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-f362abdb"]]),nn=["title","onClick"],rn=["innerHTML"],an={class:"merge-picker__label"},cn=vt(t.defineComponent({__name:"mergePicker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},triggerEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:n,emit:o}){const l=e,c=o,d=t.ref(!1),r=t.ref(null),v=t.ref(null),u=t.ref({top:0});t.watch(()=>l.modelOpen,R=>{R!==void 0&&R!==d.value&&(R?x():S())});function k(R){const B=r.value,le=v.value,ne=R.target;B&&B.contains(ne)||le&&le.contains(ne)||S()}function x(){d.value=!0,l.modelOpen!==void 0&&c("update:modelOpen",!0),t.nextTick(()=>{const R=l.triggerEl??r.value;if(R){const B=R.getBoundingClientRect(),le=Nl.length*30+12,ne=160;let p=window.innerWidth-B.right,V=B.bottom+4,P;B.left-ne<4&&(p=void 0,P=Math.max(4,B.left)),V+le>window.innerHeight-4&&(V=B.top-le-4),V<4&&(V=4),u.value=p!==void 0?{right:p,top:V}:{left:P,top:V}}document.addEventListener("pointerdown",k)})}function S(){d.value=!1,l.modelOpen!==void 0&&c("update:modelOpen",!1),document.removeEventListener("pointerdown",k)}function w(R){c("change",R),S()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",k)}),n({open:d,openMenu:x,close:S}),(R,B)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:r,class:"merge-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[d.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:v,class:"merge-picker__menu",style:t.normalizeStyle({left:u.value.left!==void 0?u.value.left+"px":void 0,right:u.value.right!==void 0?u.value.right+"px":void 0,top:u.value.top+"px"}),onMousedown:B[0]||(B[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Nl),le=>(t.openBlock(),t.createElementBlock("button",{key:le.key,class:"merge-picker__item",title:t.unref(N)(e.locale,le.labelKey),onClick:ne=>w(le.key)},[t.createElementVNode("span",{class:"merge-picker__icon",innerHTML:le.icon},null,8,rn),t.createElementVNode("span",an,t.toDisplayString(t.unref(N)(e.locale,le.labelKey)),1)],8,nn))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-67c0f9e3"]]),sn=["disabled","title","onClick"],dn={class:"calc-picker__label"},un=vt(t.defineComponent({__name:"calcPicker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},triggerEl:{default:null},disabled:{type:Boolean,default:!1}},emits:["update:modelOpen","change"],setup(e,{expose:n,emit:o}){const l=e,c=o,d=[{key:"sum",labelKey:"sum"},{key:"avg",labelKey:"avg"},{key:"count",labelKey:"count"}],r=t.ref(!1),v=t.ref(null),u=t.ref(null),k=t.ref({top:0});t.watch(()=>l.modelOpen,B=>{B!==void 0&&B!==r.value&&(B?S():w())});function x(B){const le=v.value,ne=u.value,p=B.target;le&&le.contains(p)||ne&&ne.contains(p)||w()}function S(){r.value=!0,l.modelOpen!==void 0&&c("update:modelOpen",!0),t.nextTick(()=>{const B=l.triggerEl??v.value;if(B){const le=B.getBoundingClientRect(),ne=d.length*30+12,p=160;let V=window.innerWidth-le.right,P=le.bottom+4,oe;le.left-p<4&&(V=void 0,oe=Math.max(4,le.left)),P+ne>window.innerHeight-4&&(P=le.top-ne-4),P<4&&(P=4),k.value=V!==void 0?{right:V,top:P}:{left:oe,top:P}}document.addEventListener("pointerdown",x)})}function w(){r.value=!1,l.modelOpen!==void 0&&c("update:modelOpen",!1),document.removeEventListener("pointerdown",x)}function R(B){l.disabled||(c("change",B),w())}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",x)}),n({open:r,openMenu:S,close:w}),(B,le)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:v,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:u,class:"calc-picker__menu",style:t.normalizeStyle({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"}),onMousedown:le[0]||(le[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(d,ne=>t.createElementVNode("button",{key:ne.key,class:t.normalizeClass(["calc-picker__item",{"calc-picker__item--disabled":e.disabled}]),disabled:e.disabled,title:t.unref(N)(e.locale,ne.labelKey),onClick:p=>R(ne.key)},[t.createElementVNode("span",dn,t.toDisplayString(t.unref(N)(e.locale,ne.labelKey)),1)],10,sn)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-9029e58c"]]),fn={class:"tb-item","data-key":"undo"},mn=["title","disabled"],pn={class:"tb-item","data-key":"redo"},gn=["title","disabled"],hn={class:"tb-item","data-key":"paint"},Cn=["title","disabled"],bn={class:"tb-item","data-key":"clear"},yn=["title","disabled"],vn={class:"tb-item","data-key":"font"},wn={class:"tb-item","data-key":"fontSize"},kn={class:"toolbar-font-size"},En=["value","title"],Rn=["title"],Bn=["title","disabled"],xn=["title","disabled"],Mn={class:"tb-item","data-key":"bold"},Sn=["title","disabled"],Tn={class:"tb-item","data-key":"italic"},Dn=["title","disabled"],Nn={class:"tb-item","data-key":"underline"},An=["title","disabled"],Hn={class:"tb-item","data-key":"strike"},Vn=["title","disabled"],Fn={class:"tb-item","data-key":"textColor"},On={class:"toolbar-split"},Ln=["title","disabled"],In={viewBox:"0 0 1024 1024",fill:"currentColor"},$n=["fill"],zn=["title","disabled"],Wn={class:"tb-item","data-key":"fillColor"},_n={class:"toolbar-split"},Kn=["title","disabled"],Un={viewBox:"0 0 1024 1024",fill:"currentColor"},Gn=["fill"],Pn=["title","disabled"],Yn={class:"tb-item","data-key":"border"},Xn={class:"toolbar-split"},jn=["title","disabled"],Zn={viewBox:"0 0 30 30",fill:"none",stroke:"currentColor"},qn=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],Jn=["title","disabled"],Qn={class:"tb-item","data-key":"hAlign"},er={class:"tb-item","data-key":"vAlign"},tr={class:"tb-item","data-key":"wrap"},lr=["title"],or={class:"tb-item","data-key":"merge"},nr={class:"toolbar-split"},rr=["title","disabled"],ar=["title","disabled"],ir={class:"tb-item","data-key":"numFmt"},cr={class:"tb-item","data-key":"calc"},sr={class:"toolbar-split"},dr=["title","disabled"],ur=["title","disabled"],fr={class:"tb-item","data-key":"find"},mr=["title"],Cl=2,pr=6,gr=34,hr=vt(t.defineComponent({__name:"toolbar",props:{locale:{},canUndo:{type:Boolean},canRedo:{type:Boolean},paintFmtActive:{type:Boolean},hasSelection:{type:Boolean},fontFamilyOptions:{},fontSizeOptions:{},selFontFamily:{},selFontSize:{},fontSizeInput:{},fontSizeMenuOpen:{type:Boolean},selFontWeight:{type:Boolean},selFontStyle:{type:Boolean},selUnderline:{type:Boolean},selStrikethrough:{type:Boolean},selTextColor:{},textColorMenuOpen:{type:Boolean},selFillColor:{},fillColorMenuOpen:{type:Boolean},cachedTextColor:{},cachedFillColor:{},borderMenuOpen:{type:Boolean},cachedBorder:{},selHAlign:{},selVAlign:{},selWrap:{type:Boolean},hAlignOptions:{},vAlignOptions:{},mergeMenuOpen:{type:Boolean},calcMenuOpen:{type:Boolean},isSingleCell:{type:Boolean},themeVars:{},selNumberFormat:{},nfOptions:{}},emits:["undo","redo","paint-format","clear-format","font-size-blur","font-size-toggle","font-size-step-up","font-size-step-down","bold-toggle","italic-toggle","underline-toggle","strikethrough-toggle","apply-text-color","apply-fill-color","apply-border","wrap-toggle","apply-merge","calc-sum","calc-avg","calc-count","font-family-change","font-size-change","h-align-change","v-align-change","font-size-input","text-color-change","fill-color-change","number-format-change","font-size-keydown","find","update:font-size-menu-open","update:text-color-menu-open","update:fill-color-menu-open","update:border-menu-open","update:merge-menu-open","update:calc-menu-open","border-change","merge-change"],setup(e,{emit:n}){const o=[{name:"top",x1:4,y1:4,x2:26,y2:4},{name:"bottom",x1:4,y1:26,x2:26,y2:26},{name:"left",x1:4,y1:4,x2:4,y2:26},{name:"right",x1:26,y1:4,x2:26,y2:26},{name:"vMid",x1:15,y1:4,x2:15,y2:26},{name:"hMid",x1:4,y1:15,x2:26,y2:15}],l={bottom:["bottom"],top:["top"],left:["left"],right:["right"],none:[],all:["top","bottom","left","right","vMid","hMid"],outer:["top","bottom","left","right"],thickOuter:["top","bottom","left","right"]},c={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function d(A,a){return c[A].includes(a)?"thick":l[A].includes(a)?"solid":"dashed"}const r=["undo","redo","paint","clear","sep1","font","fontSize","sep2","bold","italic","underline","strike","sep3","textColor","fillColor","border","sep4","hAlign","vAlign","wrap","merge","sep6","numFmt","sep7","calc","find"],v=t.ref(null),u=t.ref(null),k=t.ref(null),x=t.ref(null),S=t.ref(null),w=t.ref(null),R=t.ref(null),B=t.ref(null),le=t.ref(null),ne=t.ref(new Set),p=t.ref(!1),V=t.ref(!1),P=t.ref(0),oe=new Map,Z=t.computed(()=>ne.value.size>0);function J(A){return ne.value.has(A)}const q=t.computed(()=>{const A=u.value;return A instanceof HTMLElement?A:void 0});function ue(A){return q.value?!J(A):!0}function Fe(){for(const A of r){const a=oe.get(A);if(a===void 0||a===0)return!0}return!1}function Oe(){if(!v.value)return;v.value.querySelectorAll(".tb-item").forEach(a=>{const h=a.dataset.key;if(!h)return;const _=a.offsetWidth;_>0?oe.set(h,_):oe.has(h)||oe.set(h,0)})}function Je(A,a){if(A.size!==a.size)return!1;for(const h of A)if(!a.has(h))return!1;return!0}let Ge=0,je=0;function se(){Ge&&cancelAnimationFrame(Ge),!(je>60)&&(je++,Ge=requestAnimationFrame(()=>requestAnimationFrame(de)))}function de(){if(!v.value)return;const A=v.value.clientWidth-pr*2;if(A<=0){se();return}je=0,(oe.size===0||Fe())&&Oe();let a=0;for(const _ of r)a+=(oe.get(_)??0)+Cl;const h=new Set;if(a>A){const _=A-gr-Cl;let E=0;for(let W=0;W<r.length;W++){const Y=r[W],Me=(oe.get(Y)??0)+Cl;if(E+Me>_){for(let Ve=W;Ve<r.length;Ve++)h.add(r[Ve]);break}E+=Me}}Je(h,ne.value)||(ne.value=h,P.value++,h.size===0&&(p.value=!1))}let Te=null;const re=t.ref(0),i=t.computed(()=>{const A=k.value,a={position:"fixed",top:"0px",right:"0px"};if(!A)return{...f.themeVars,...a};re.value;const h=A.getBoundingClientRect();return{...f.themeVars,position:"fixed",top:`${h.bottom+4}px`,right:`${window.innerWidth-h.right}px`}});function m(){p.value&&(re.value++,t.nextTick(()=>de()))}function fe(A){var h,_;if(!p.value)return;const a=A.target;(h=u.value)!=null&&h.contains(a)||(_=k.value)!=null&&_.contains(a)||(V.value=!0,p.value=!1,t.nextTick(()=>{V.value=!1}))}function De(){p.value=!p.value}t.onMounted(()=>{se(),v.value&&(Te=new ResizeObserver(()=>{p.value||se()}),Te.observe(v.value)),document.addEventListener("pointerdown",fe,!0),window.addEventListener("resize",m),window.addEventListener("load",se),window.addEventListener("orientationchange",se)}),t.onBeforeUnmount(()=>{Ge&&cancelAnimationFrame(Ge),Te==null||Te.disconnect(),document.removeEventListener("pointerdown",fe,!0),window.removeEventListener("resize",m),window.removeEventListener("load",se),window.removeEventListener("orientationchange",se)});const f=e,y=n,T=t.computed(()=>f.selNumberFormat===nl?N(f.locale,"nfMixed"):"");return(A,a)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{ref_key:"rootEl",ref:v,class:"toolbar"},[(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("undo"),to:q.value},[t.createElementVNode("div",fn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canUndo}]),title:t.unref(N)(e.locale,"undo"),disabled:!e.canUndo,onClick:a[0]||(a[0]=h=>y("undo"))},[...a[45]||(a[45]=[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,mn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("redo"),to:q.value},[t.createElementVNode("div",pn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canRedo}]),title:t.unref(N)(e.locale,"redo"),disabled:!e.canRedo,onClick:a[1]||(a[1]=h=>y("redo"))},[...a[46]||(a[46]=[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,gn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("paint"),to:q.value},[t.createElementVNode("div",hn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.paintFmtActive}]),title:t.unref(N)(e.locale,"paintFormat"),disabled:!e.hasSelection,onClick:a[2]||(a[2]=h=>y("paint-format"))},[...a[47]||(a[47]=[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,Cn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("clear"),to:q.value},[t.createElementVNode("div",bn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.hasSelection}]),title:t.unref(N)(e.locale,"clearFormat"),disabled:!e.hasSelection,onClick:a[3]||(a[3]=h=>y("clear-format"))},[...a[48]||(a[48]=[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,yn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("sep1"),to:q.value},[a[49]||(a[49]=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:ue("font"),to:q.value},[t.createElementVNode("div",vn,[t.createVNode(Xt,{class:"toolbar-font","model-value":e.selFontFamily,options:e.fontFamilyOptions,width:J("font")?"100%":110,"menu-width":J("font")?120:void 0,"visible-count":8,title:t.unref(N)(e.locale,"fontFamily"),align:"right",onChange:a[4]||(a[4]=h=>y("font-family-change",h))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("fontSize"),to:q.value},[t.createElementVNode("div",wn,[t.createElementVNode("div",kn,[t.createElementVNode("input",{class:"toolbar-font-size__input",type:"number",min:"5",max:"72",step:"1",value:e.fontSizeInput,title:t.unref(N)(e.locale,"fontSize"),onInput:a[5]||(a[5]=h=>y("font-size-input",h.target.value)),onBlur:a[6]||(a[6]=h=>y("font-size-blur")),onKeydown:a[7]||(a[7]=h=>y("font-size-keydown",h))},null,40,En),t.createVNode(Xt,{class:"toolbar-font-size__dropdown","model-value":e.selFontSize,options:e.fontSizeOptions,width:J("fontSize")?"100%":56,"menu-width":J("fontSize")?120:56,"visible-count":9,title:t.unref(N)(e.locale,"fontSize"),"hide-trigger":!0,"model-open":e.fontSizeMenuOpen,align:"right","trigger-el":le.value,"onUpdate:modelOpen":a[8]||(a[8]=h=>y("update:font-size-menu-open",h)),onChange:a[9]||(a[9]=h=>y("font-size-change",h))},null,8,["model-value","options","width","menu-width","title","model-open","trigger-el"]),t.createElementVNode("button",{ref_key:"fontSizeArrowRef",ref:le,class:"toolbar-font-size__btn",type:"button",title:t.unref(N)(e.locale,"fontSize"),onMousedown:a[10]||(a[10]=t.withModifiers(()=>{},["prevent"])),onClick:a[11]||(a[11]=h=>y("font-size-toggle"))},[...a[50]||(a[50]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053333 361.386667a32 32 0 0 1 45.226667 0L512 648.106667l286.72-286.72a32 32 0 1 1 45.226667 45.226666l-309.333334 309.333334a32 32 0 0 1-45.226666 0L180.053333 406.613333a32 32 0 0 1 0-45.226666z"})],-1)])],40,Rn),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(N)(e.locale,"fontSizeDecrease"),disabled:!e.hasSelection,onMousedown:a[12]||(a[12]=t.withModifiers(()=>{},["prevent"])),onClick:a[13]||(a[13]=h=>y("font-size-step-down"))},[...a[51]||(a[51]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M481.28 125.95a29.506 29.506 0 0 0-27.45-18.7h-63.34c-12.13 0-23.02 7.42-27.45 18.7L67.94 876.46c-7.61 19.35 6.66 40.29 27.45 40.29h35.47c12.26 0 23.24-7.58 27.58-19.04l80.89-213.35h364.54l81.94 213.46a29.51 29.51 0 0 0 27.54 18.93h35.56c20.8 0 35.06-20.94 27.45-40.29L481.28 125.95zM273.47 594.06l145.38-384.38h2.2l147.58 384.38H273.47zM928.64 195.74h-177c-16.29 0-29.5 13.21-29.5 29.5s13.21 29.5 29.5 29.5h177c16.29 0 29.5-13.21 29.5-29.5s-13.21-29.5-29.5-29.5z"})],-1)])],40,Bn),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(N)(e.locale,"fontSizeIncrease"),disabled:!e.hasSelection,onMousedown:a[14]||(a[14]=t.withModifiers(()=>{},["prevent"])),onClick:a[15]||(a[15]=h=>y("font-size-step-up"))},[...a[52]||(a[52]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M481.28 125.95a29.506 29.506 0 0 0-27.45-18.7h-63.34c-12.13 0-23.02 7.42-27.45 18.7L67.94 876.46c-7.61 19.35 6.66 40.29 27.45 40.29h35.47c12.26 0 23.24-7.58 27.58-19.04l80.89-213.35h364.54l81.94 213.46a29.51 29.51 0 0 0 27.54 18.93h35.56c20.8 0 35.06-20.94 27.45-40.29L481.28 125.95zM273.47 594.06l145.38-384.38h2.2l147.58 384.38H273.47zM928.64 195.74h-59v-59c0-16.29-13.21-29.5-29.5-29.5s-29.5 13.21-29.5 29.5v59h-59c-16.29 0-29.5 13.21-29.5 29.5s13.21 29.5 29.5 29.5h59v59c0 16.29 13.21 29.5 29.5 29.5s29.5-13.21 29.5-29.5v-59h59c16.29 0 29.5-13.21 29.5-29.5s-13.21-29.5-29.5-29.5z"})],-1)])],40,xn)])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("sep2"),to:q.value},[a[53]||(a[53]=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:ue("bold"),to:q.value},[t.createElementVNode("div",Mn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontWeight}]),title:t.unref(N)(e.locale,"bold"),disabled:!e.hasSelection,onClick:a[16]||(a[16]=h=>y("bold-toggle"))},[...a[54]||(a[54]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[t.createElementVNode("path",{d:"M733.610667 467.712A267.562667 267.562667 0 0 0 548.010667 10.581333H183.466667a53.333333 53.333333 0 0 0 0 106.666667h43.221333a10.666667 10.666667 0 0 1 10.666667 10.666667V896a10.666667 10.666667 0 0 1-10.666667 10.666667H183.466667a53.333333 53.333333 0 1 0 0 106.666666h425.088a287.658667 287.658667 0 0 0 125.013333-545.536z m-185.6-350.464a160.512 160.512 0 0 1 0 320.981333H354.688a10.666667 10.666667 0 0 1-10.666667-10.666666V128a10.666667 10.666667 0 0 1 10.666667-10.666667z m60.586666 789.333333H354.688a10.666667 10.666667 0 0 1-10.666667-10.666666v-340.352a10.666667 10.666667 0 0 1 10.666667-10.666667H608.597333a180.864 180.864 0 0 1 0 361.685333z"})])],-1)])],10,Sn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("italic"),to:q.value},[t.createElementVNode("div",Tn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontStyle}]),title:t.unref(N)(e.locale,"italic"),disabled:!e.hasSelection,onClick:a[17]||(a[17]=h=>y("italic-toggle"))},[...a[55]||(a[55]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[t.createElementVNode("path",{d:"M960 10.581333h-325.845333a53.333333 53.333333 0 0 0 0 106.666667h46.336a10.666667 10.666667 0 0 1 9.002666 16.384L203.946667 896.725333a21.333333 21.333333 0 0 1-18.005334 9.856H64a53.333333 53.333333 0 0 0 0 106.666667h325.845333a53.333333 53.333333 0 0 0 0-106.666667H343.509333a10.666667 10.666667 0 0 1-9.002666-16.384L820.053333 127.146667a21.333333 21.333333 0 0 1 18.005334-9.898667H960a53.333333 53.333333 0 0 0 0-106.666667z"})])],-1)])],10,Dn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("underline"),to:q.value},[t.createElementVNode("div",Nn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selUnderline}]),title:t.unref(N)(e.locale,"underline"),disabled:!e.hasSelection,onClick:a[18]||(a[18]=h=>y("underline-toggle"))},[...a[56]||(a[56]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[t.createElementVNode("path",{d:"M960 906.581333h-896a53.333333 53.333333 0 0 0 0 106.666667h896a53.333333 53.333333 0 0 0 0-106.666667zM84.394667 117.248h58.154666a10.666667 10.666667 0 0 1 10.666667 10.666667v363.648a358.784 358.784 0 0 0 717.568 0V128a10.666667 10.666667 0 0 1 10.666667-10.666667h58.154666a53.333333 53.333333 0 0 0 0-106.666666H695.466667a53.333333 53.333333 0 0 0 0 106.666666h58.154666a10.666667 10.666667 0 0 1 10.666667 10.666667v363.648a252.117333 252.117333 0 0 1-504.234667 0V128a10.666667 10.666667 0 0 1 10.666667-10.666667H328.533333a53.333333 53.333333 0 1 0 0-106.666666H84.394667a53.333333 53.333333 0 0 0 0 106.666666z"})])],-1)])],10,An)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("strike"),to:q.value},[t.createElementVNode("div",Hn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selStrikethrough}]),title:t.unref(N)(e.locale,"strikethrough"),disabled:!e.hasSelection,onClick:a[19]||(a[19]=h=>y("strikethrough-toggle"))},[...a[57]||(a[57]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[t.createElementVNode("path",{d:"M1013.333333 552.618667A53.333333 53.333333 0 0 0 960 499.2h-381.269333a20.992 20.992 0 0 1-12.032-3.84c-30.805333-21.888-63.232-41.856-94.634667-61.098667-119.466667-73.173333-192-123.733333-192-207.488 0-95.36 94.165333-109.610667 150.314667-109.610666a193.706667 193.706667 0 0 1 131.456 32.597333 113.578667 113.578667 0 0 1 19.072 84.906667v12.8a53.333333 53.333333 0 1 0 106.666666 0v-11.434667a208.512 208.512 0 0 0-49.706666-161.152C595.157333 31.616 527.317333 10.581333 430.549333 10.581333c-156.074667 0-256.981333 84.864-256.981333 216.277334 0 118.314667 80.725333 192.512 170.666667 252.885333a10.666667 10.666667 0 0 1-5.930667 19.541333H64a53.333333 53.333333 0 0 0 0 106.666667h468.352a10.709333 10.709333 0 0 1 6.784 2.474667 185.130667 185.130667 0 0 1 82.432 147.882666c0 139.434667-146.176 150.272-191.018667 150.272-77.397333 0-133.930667-17.28-163.584-50.048a144.810667 144.810667 0 0 1-27.733333-115.2 53.333333 53.333333 0 0 0-106.154667-10.496A245.76 245.76 0 0 0 187.733333 928.128c51.2 56.490667 132.864 85.333333 242.688 85.333333 178.090667 0 297.685333-103.253333 297.685334-256.938666a258.517333 258.517333 0 0 0-36.224-134.272 10.666667 10.666667 0 0 1 9.216-16.085334H960a53.333333 53.333333 0 0 0 53.333333-53.546666z"})])],-1)])],10,Vn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("sep3"),to:q.value},[a[58]||(a[58]=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:ue("textColor"),to:q.value},[t.createElementVNode("div",Fn,[t.createElementVNode("div",On,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(N)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:a[20]||(a[20]=h=>y("apply-text-color"))},[(t.openBlock(),t.createElementBlock("svg",In,[a[59]||(a[59]=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,$n)]))],8,Ln),t.createElementVNode("button",{ref_key:"textColorArrowRef",ref:x,class:"toolbar-btn toolbar-split__arrow",title:t.unref(N)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:a[21]||(a[21]=h=>y("update:text-color-menu-open",!e.textColorMenuOpen))},[...a[60]||(a[60]=[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,zn),t.createVNode(Ul,{"model-open":e.textColorMenuOpen,"color-key":"text","current-color":e.selTextColor,locale:e.locale,"trigger-el":x.value,"onUpdate:modelOpen":a[22]||(a[22]=h=>y("update:text-color-menu-open",h)),onChange:a[23]||(a[23]=h=>y("text-color-change",h))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("fillColor"),to:q.value},[t.createElementVNode("div",Wn,[t.createElementVNode("div",_n,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(N)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:a[24]||(a[24]=h=>y("apply-fill-color"))},[(t.openBlock(),t.createElementBlock("svg",Un,[a[61]||(a[61]=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,Gn)]))],8,Kn),t.createElementVNode("button",{ref_key:"fillColorArrowRef",ref:S,class:"toolbar-btn toolbar-split__arrow",title:t.unref(N)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:a[25]||(a[25]=h=>y("update:fill-color-menu-open",!e.fillColorMenuOpen))},[...a[62]||(a[62]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,Pn),t.createVNode(Ul,{"model-open":e.fillColorMenuOpen,"color-key":"fill","current-color":e.selFillColor,locale:e.locale,"trigger-el":S.value,"onUpdate:modelOpen":a[26]||(a[26]=h=>y("update:fill-color-menu-open",h)),onChange:a[27]||(a[27]=h=>y("fill-color-change",h))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("border"),to:q.value},[t.createElementVNode("div",Yn,[t.createElementVNode("div",Xn,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(N)(e.locale,"borders"),disabled:!e.hasSelection,onClick:a[28]||(a[28]=h=>y("apply-border"))},[(t.openBlock(),t.createElementBlock("svg",Zn,[(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":d(e.cachedBorder,h.name)==="thick"?3:1.5,"stroke-dasharray":d(e.cachedBorder,h.name)==="dashed"?"0 4":"none","stroke-linecap":d(e.cachedBorder,h.name)==="dashed"?"round":"square"},null,8,qn)),64))]))],8,jn),t.createElementVNode("button",{ref_key:"borderArrowRef",ref:w,class:"toolbar-btn toolbar-split__arrow",title:t.unref(N)(e.locale,"borders"),disabled:!e.hasSelection,onClick:a[29]||(a[29]=h=>y("update:border-menu-open",!e.borderMenuOpen))},[...a[63]||(a[63]=[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,Jn),t.createVNode(on,{"model-open":e.borderMenuOpen,locale:e.locale,"current-border":e.cachedBorder,"trigger-el":w.value,"onUpdate:modelOpen":a[30]||(a[30]=h=>y("update:border-menu-open",h)),onChange:a[31]||(a[31]=h=>y("border-change",h))},null,8,["model-open","locale","current-border","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("sep4"),to:q.value},[a[64]||(a[64]=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:ue("hAlign"),to:q.value},[t.createElementVNode("div",Qn,[t.createVNode(Xt,{class:"toolbar-align","model-value":e.selHAlign,options:e.hAlignOptions,width:J("hAlign")?"100%":44,"menu-width":J("hAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(N)(e.locale,"hAlign"),onChange:a[32]||(a[32]=h=>y("h-align-change",h))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("vAlign"),to:q.value},[t.createElementVNode("div",er,[t.createVNode(Xt,{class:"toolbar-align","model-value":e.selVAlign,options:e.vAlignOptions,width:J("vAlign")?"100%":44,"menu-width":J("vAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(N)(e.locale,"vAlign"),onChange:a[33]||(a[33]=h=>y("v-align-change",h))},null,8,["model-value","options","width","menu-width","title"])]),t.createElementVNode("div",tr,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selWrap}]),type:"button",title:t.unref(N)(e.locale,"wrap"),onClick:a[34]||(a[34]=h=>y("wrap-toggle"))},[...a[65]||(a[65]=[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,lr)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("merge"),to:q.value},[t.createElementVNode("div",or,[t.createElementVNode("div",nr,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(N)(e.locale,"mergeCenter"),disabled:!e.hasSelection,onClick:a[35]||(a[35]=h=>y("apply-merge"))},[...a[66]||(a[66]=[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,rr),t.createElementVNode("button",{ref_key:"mergeArrowRef",ref:R,class:"toolbar-btn toolbar-split__arrow",title:t.unref(N)(e.locale,"mergeCells"),disabled:!e.hasSelection,onClick:a[36]||(a[36]=h=>y("update:merge-menu-open",!e.mergeMenuOpen))},[...a[67]||(a[67]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,ar),t.createVNode(cn,{"model-open":e.mergeMenuOpen,locale:e.locale,"trigger-el":R.value,"onUpdate:modelOpen":a[37]||(a[37]=h=>y("update:merge-menu-open",h)),onChange:a[38]||(a[38]=h=>y("merge-change",h))},null,8,["model-open","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("sep6"),to:q.value},[a[68]||(a[68]=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:ue("numFmt"),to:q.value},[t.createElementVNode("div",ir,[t.createVNode(Xt,{class:"toolbar-number-format","model-value":e.selNumberFormat,options:e.nfOptions,width:J("numFmt")?"100%":92,"menu-width":(J("numFmt"),150),"visible-count":8,title:t.unref(N)(e.locale,"numberFormat"),"fallback-label":T.value,align:"right",onChange:a[39]||(a[39]=h=>y("number-format-change",String(h)))},null,8,["model-value","options","width","menu-width","title","fallback-label"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("sep7"),to:q.value},[a[69]||(a[69]=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:ue("calc"),to:q.value},[t.createElementVNode("div",cr,[t.createElementVNode("div",sr,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(N)(e.locale,"sum"),disabled:!e.hasSelection||e.isSingleCell,onClick:a[40]||(a[40]=h=>y("calc-sum"))},[...a[70]||(a[70]=[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,dr),t.createElementVNode("button",{ref_key:"calcArrowRef",ref:B,class:"toolbar-btn toolbar-split__arrow",title:t.unref(N)(e.locale,"calculate"),disabled:!e.hasSelection,onClick:a[41]||(a[41]=h=>y("update:calc-menu-open",!e.calcMenuOpen))},[...a[71]||(a[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,ur),t.createVNode(un,{"model-open":e.calcMenuOpen,locale:e.locale,"trigger-el":B.value,disabled:e.isSingleCell,"onUpdate:modelOpen":a[42]||(a[42]=h=>y("update:calc-menu-open",h)),onChange:a[43]||(a[43]=h=>y(`calc-${h}`))},null,8,["model-open","locale","trigger-el","disabled"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("find"),to:q.value},[t.createElementVNode("div",fr,[t.createElementVNode("button",{class:"toolbar-btn",title:t.unref(N)(e.locale,"find"),onClick:a[44]||(a[44]=h=>y("find"))},[...a[72]||(a[72]=[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,mr)])],8,["disabled","to"])),Z.value?(t.openBlock(),t.createElementBlock("button",{key:0,ref_key:"moreBtnEl",ref:k,class:t.normalizeClass(["toolbar-more",{"toolbar-more--active":p.value}]),type:"button",onClick:De},[...a[73]||(a[73]=[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)],512),(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:u,key:P.value,class:t.normalizeClass(["overflow-menu",{"no-anim":V.value}]),style:t.normalizeStyle(i.value)},null,6)),[[t.vShow,p.value]])]),_:1})]))],64))}}),[["__scopeId","data-v-a36c59af"]]),Cr={class:"tab-list"},br=["onClick","onDblclick","onContextmenu"],yr=["value"],vr={key:1,class:"tab-item__name"},wr=["title"],kr=vt(t.defineComponent({__name:"tabbar",props:{locale:{},sheets:{},activeSheetIndex:{},renTab:{},renTabVal:{}},emits:["tab-click","tab-dblclick","tab-contextmenu","tab-rename-input","tab-rename-keydown","tab-rename-commit","add-sheet","tabbar-contextmenu"],setup(e,{emit:n}){const o=n;return(l,c)=>(t.openBlock(),t.createElementBlock("div",{class:"tab-bar",onContextmenu:c[5]||(c[5]=d=>o("tabbar-contextmenu",d))},[t.createElementVNode("div",Cr,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.sheets,(d,r)=>(t.openBlock(),t.createElementBlock("div",{key:d.id,class:t.normalizeClass(["tab-item",{"tab-item--active":r===e.activeSheetIndex}]),onClick:v=>o("tab-click",r),onDblclick:t.withModifiers(v=>o("tab-dblclick",r),["prevent"]),onContextmenu:v=>o("tab-contextmenu",{ev:v,i:r})},[e.renTab===r?(t.openBlock(),t.createElementBlock("input",{key:0,class:"tab-rename-input",value:e.renTabVal,onInput:c[0]||(c[0]=v=>o("tab-rename-input",v.target.value)),onKeydown:c[1]||(c[1]=v=>o("tab-rename-keydown",v)),onBlur:c[2]||(c[2]=v=>o("tab-rename-commit")),onClick:c[3]||(c[3]=t.withModifiers(()=>{},["stop"]))},null,40,yr)):(t.openBlock(),t.createElementBlock("span",vr,t.toDisplayString(d.name),1))],42,br))),128))]),t.createElementVNode("button",{class:"tab-bar__add-btn",title:t.unref(N)(e.locale,"addSheet"),onClick:c[4]||(c[4]=d=>o("add-sheet"))}," + ",8,wr)],32))}}),[["__scopeId","data-v-454e1a12"]]),Er=["placeholder","value"],Rr=["placeholder","value"],Br=["value","title"],xr={value:"sheet"},Mr={value:"workbook"},Sr={value:"selection"},Tr={class:"find-bar__chk"},Dr=["checked"],Nr={class:"find-bar__chk"},Ar=["checked"],Hr={class:"find-bar__count"},Vr=["title","disabled"],Fr=["title","disabled"],Or=["disabled"],Lr=["disabled"],Ir=["title"],$r=vt(t.defineComponent({__name:"find-replace-bar",props:{open:{type:Boolean},findText:{},replaceText:{},scope:{},matchCase:{type:Boolean},matchEntireCell:{type:Boolean},currentIndex:{},total:{},message:{},focusToken:{},locale:{},themeVars:{}},emits:["update:findText","update:replaceText","update:scope","update:matchCase","update:matchEntireCell","prev","next","replace","replace-all","close"],setup(e,{emit:n}){const o=e,l=n,c=t.ref(null),d=t.computed(()=>o.total>0?`${o.currentIndex+1}/${o.total}`:o.message||"");t.watch(()=>o.focusToken,()=>{t.nextTick(()=>{var u;return(u=c.value)==null?void 0:u.focus()})});function r(u){u.key==="Enter"?(u.preventDefault(),u.shiftKey?l("prev"):l("next")):u.key==="Escape"&&(u.preventDefault(),l("close"))}function v(u){l("update:scope",u.target.value)}return(u,k)=>e.open?(t.openBlock(),t.createElementBlock("div",{key:0,class:"find-bar",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("input",{ref_key:"findInputRef",ref:c,class:"find-bar__input",placeholder:t.unref(N)(e.locale,"findPlaceholder"),value:e.findText,onInput:k[0]||(k[0]=x=>l("update:findText",x.target.value)),onKeydown:r},null,40,Er),t.createElementVNode("input",{class:"find-bar__input",placeholder:t.unref(N)(e.locale,"replacePlaceholder"),value:e.replaceText,onInput:k[1]||(k[1]=x=>l("update:replaceText",x.target.value)),onKeydown:r},null,40,Rr),t.createElementVNode("select",{class:"find-bar__select",value:e.scope,title:t.unref(N)(e.locale,"findScope"),onChange:v},[t.createElementVNode("option",xr,t.toDisplayString(t.unref(N)(e.locale,"scopeSheet")),1),t.createElementVNode("option",Mr,t.toDisplayString(t.unref(N)(e.locale,"scopeWorkbook")),1),t.createElementVNode("option",Sr,t.toDisplayString(t.unref(N)(e.locale,"scopeSelection")),1)],40,Br),t.createElementVNode("label",Tr,[t.createElementVNode("input",{type:"checkbox",checked:e.matchCase,onChange:k[2]||(k[2]=x=>l("update:matchCase",x.target.checked))},null,40,Dr),t.createTextVNode(t.toDisplayString(t.unref(N)(e.locale,"matchCase")),1)]),t.createElementVNode("label",Nr,[t.createElementVNode("input",{type:"checkbox",checked:e.matchEntireCell,onChange:k[3]||(k[3]=x=>l("update:matchEntireCell",x.target.checked))},null,40,Ar),t.createTextVNode(t.toDisplayString(t.unref(N)(e.locale,"matchEntireCell")),1)]),t.createElementVNode("span",Hr,t.toDisplayString(d.value),1),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--icon",title:t.unref(N)(e.locale,"findPrev"),disabled:e.total===0,onClick:k[4]||(k[4]=x=>l("prev"))},[...k[9]||(k[9]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M512 320a32 32 0 0 1 45.254 0l288 288a32 32 0 0 1-45.254 45.254L512 410.51 214.254 653.254A32 32 0 0 1 169 608l288-288z"})],-1)])],8,Vr),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--icon",title:t.unref(N)(e.locale,"findNext"),disabled:e.total===0,onClick:k[5]||(k[5]=x=>l("next"))},[...k[10]||(k[10]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M512 704a32 32 0 0 1-45.254 0l-288-288A32 32 0 0 1 214.254 370.746L512 613.49 809.746 370.746A32 32 0 0 1 855 416l-288 288z"})],-1)])],8,Fr),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--text",disabled:e.total===0,onClick:k[6]||(k[6]=x=>l("replace"))},t.toDisplayString(t.unref(N)(e.locale,"replace")),9,Or),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--text",disabled:e.total===0,onClick:k[7]||(k[7]=x=>l("replace-all"))},t.toDisplayString(t.unref(N)(e.locale,"replaceAll")),9,Lr),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--close",title:t.unref(N)(e.locale,"findClose"),onClick:k[8]||(k[8]=x=>l("close"))},[...k[11]||(k[11]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M512 451.669L369.664 294.336a32 32 0 0 0-45.312 45.312L466.688 497 309.355 654.336a32 32 0 0 0 45.312 45.312L512 542.688l157.333 157.334a32 32 0 0 0 45.312-45.312L557.312 497 714.645 339.664a32 32 0 0 0-45.312-45.312z"})],-1)])],8,Ir)],4)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-0d187de9"]]),zr={class:"nf-dialog__header"},Wr={class:"nf-dialog__title"},_r={class:"nf-dialog__body"},Kr={class:"nf-field"},Ur={class:"nf-field__label"},Gr=["value"],Pr={key:0,class:"nf-field"},Yr={class:"nf-field__label"},Xr={key:1,class:"nf-field nf-field--inline"},jr={class:"nf-checkbox"},Zr={key:2,class:"nf-field"},qr={class:"nf-field__label"},Jr=["value"],Qr={key:3,class:"nf-field"},ea={class:"nf-field__label"},ta=["value"],la={key:4,class:"nf-field"},oa={class:"nf-field__label"},na=["value"],ra={key:5,class:"nf-field"},aa={class:"nf-field__label"},ia=["value"],ca={key:6,class:"nf-field"},sa={class:"nf-field__label"},da=["value"],ua={class:"nf-field"},fa={class:"nf-field__label"},ma={class:"nf-dialog__footer"},pa={class:"nf-preview"},ga={class:"nf-preview__label"},ha={class:"nf-preview__value"},Ca={class:"nf-dialog__actions"},ba=vt(t.defineComponent({__name:"numberFormatDialog",props:{modelOpen:{type:Boolean,default:!1},locale:{default:"zh-CN"},currentFormat:{default:""},sampleValue:{default:"1234.5"}},emits:["update:modelOpen","apply"],setup(e,{emit:n}){const o=e,l=n,c=t.ref(!1),d=t.ref("general"),r=t.ref(2),v=t.ref(!1),u=t.ref("$"),k=t.ref("m/d/yyyy"),x=t.ref("h:mm:ss"),S=t.ref("m/d/yyyy h:mm:ss"),w=t.ref("[h]:mm:ss"),R=t.ref(""),B=t.ref(null),le=[{label:"¥",value:"¥"},{label:"$",value:"$"},{label:"€",value:"€"},{label:"£",value:"£"}],ne=['yyyy"年"m"月"d"日"',"yyyy-mm-dd","yyyy/m/d",'m"月"d"日"'],p=["m/d/yyyy","mm/dd/yyyy","d-mmm-yyyy","mmmm d, yyyy"],V=['yyyy"年"m"月"d"日" h:mm:ss','yyyy"年"m"月"d"日" hh:mm',"yyyy-mm-dd hh:mm:ss","yyyy/m/d h:mm"],P=["m/d/yyyy h:mm:ss","m/d/yyyy hh:mm","mm/dd/yyyy h:mm AM/PM","d-mmm-yyyy hh:mm:ss"],oe=t.computed(()=>o.locale==="zh-CN"?[...ne,...p]:[...p,...ne]),Z=["h:mm:ss","h:mm","hh:mm:ss","h:mm AM/PM",'hh"时"mm"分"ss"秒"',"H:mm:ss"],J=t.computed(()=>o.locale==="zh-CN"?[...V,...P]:[...P,...V]),q=["[h]:mm:ss","[h]:mm","mm:ss",'[h]"小时"mm"分"ss"秒"',"[h]:mm:ss.00",'d"天"h:mm:ss'],ue={general:"nfCatGeneral",number:"nfCatNumber",currency:"nfCatCurrency",currencyRounded:"nfCatCurrencyRounded",accounting:"nfCatAccounting",financial:"nfCatFinancial",percent:"nfCatPercent",scientific:"nfCatScientific",date:"nfCatDate",time:"nfCatTime",dateTime:"nfCatDateTime",duration:"nfCatDuration",text:"nfCatText",custom:"nfCatCustom"},Fe=t.computed(()=>["number","currency","currencyRounded","accounting","financial"].includes(d.value)),Oe=t.computed(()=>["currency","currencyRounded","accounting"].includes(d.value)),Je=t.computed(()=>d.value==="date"),Ge=t.computed(()=>d.value==="time"),je=t.computed(()=>d.value==="dateTime"),se=t.computed(()=>d.value==="duration"),de=t.computed(()=>["number","currency","accounting","financial","percent","scientific"].includes(d.value));function Te(){if(d.value==="general")return rl;if(d.value==="text")return Ht;if(d.value==="custom")return R.value;if(d.value==="date")return k.value;if(d.value==="time")return x.value;if(d.value==="dateTime")return S.value;if(d.value==="duration")return w.value;const E=Math.max(0,Math.min(30,r.value));return d.value==="currency"||d.value==="currencyRounded"||d.value==="accounting"?re(d.value,E,v.value,u.value):Wo(o.locale,d.value,E,v.value)}function re(E,W,Y,Me){const Ve=Y?"#,##0":"0";if(E==="currencyRounded")return Me+Ve;const Ke=W>0?"."+"0".repeat(W):"",Be=Ve+Ke;return E==="currency"?Me+Be:`${Me}${Be};(${Me}${Be});${Me}"-"`}function i(E){if(R.value=E,Yt(E)){d.value="general";return}if(E==="@"){d.value="text";return}if(/\[h\]/i.test(E)&&!/[yd]/i.test(E)){d.value="duration",q.includes(E)&&(w.value=E);return}const W=/[yd]/i.test(E),Y=/h|s|AM\/PM/i.test(E);if(W&&Y){d.value="dateTime",J.value.includes(E)&&(S.value=E);return}if(W||/AM\/PM/i.test(E)){Y&&!W?(d.value="time",Z.includes(E)&&(x.value=E)):(d.value="date",oe.value.includes(E)&&(k.value=E));return}if(E.includes("%")){d.value="percent",r.value=m(E);return}if(/E[+-]/i.test(E)){d.value="scientific",r.value=m(E);return}const Me=le.find(Ve=>E.startsWith(Ve.value));if(E.includes("[Red](")){d.value="financial",v.value=E.includes(","),r.value=m(E);return}if(Me){E.includes("(")?(d.value="accounting",u.value=Me.value,v.value=E.includes(","),r.value=m(E)):/\.\d/.test(E.slice(Me.value.length))?(d.value="currency",u.value=Me.value,v.value=E.includes(","),r.value=m(E)):(d.value="currencyRounded",u.value=Me.value,v.value=E.includes(","));return}d.value="number",v.value=E.includes(","),r.value=m(E)}function m(E){const W=E.match(/\.([0#?]+)/);return W?W[1].length:0}function fe(){d.value!=="custom"&&(R.value=Te())}function De(){}function f(){k.value=oe.value[0],x.value=Z[0],S.value=J.value[0],w.value=q[0]}function y(){c.value=!0,o.modelOpen!==void 0&&l("update:modelOpen",!0),f(),i(o.currentFormat??""),t.nextTick(()=>{var E;return(E=B.value)==null?void 0:E.focus()})}function T(){c.value=!1,o.modelOpen!==void 0&&l("update:modelOpen",!1)}function A(){l("apply",R.value),T()}function a(){T()}function h(E){E.key==="Escape"&&T()}t.watch(()=>o.modelOpen,E=>{E&&!c.value?y():!E&&c.value&&T()});const _=t.computed(()=>hl(o.sampleValue,R.value,o.locale));return(E,W)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"nf-dialog"},{default:t.withCtx(()=>[c.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"nf-dialog__mask",onMousedown:a,onKeydown:h},[t.createElementVNode("div",{class:t.normalizeClass(["nf-dialog",{"nf-dialog--zh":e.locale==="zh-CN"}]),onMousedown:W[9]||(W[9]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",zr,[t.createElementVNode("span",Wr,t.toDisplayString(t.unref(N)(e.locale,"nfDialogTitle")),1),t.createElementVNode("button",{class:"nf-dialog__close",type:"button",onClick:T},[...W[10]||(W[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",_r,[t.createElementVNode("div",Kr,[t.createElementVNode("label",Ur,t.toDisplayString(t.unref(N)(e.locale,"nfCategory")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":W[0]||(W[0]=Y=>d.value=Y),class:"nf-field__select",onChange:fe},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Io),Y=>(t.openBlock(),t.createElementBlock("option",{key:Y,value:Y},t.toDisplayString(t.unref(N)(e.locale,ue[Y])),9,Gr))),128))],544),[[t.vModelSelect,d.value]])]),de.value?(t.openBlock(),t.createElementBlock("div",Pr,[t.createElementVNode("label",Yr,t.toDisplayString(t.unref(N)(e.locale,"nfDecimals")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":W[1]||(W[1]=Y=>r.value=Y),class:"nf-field__input",type:"number",min:"0",max:"30",onInput:fe},null,544),[[t.vModelText,r.value,void 0,{number:!0}]])])):t.createCommentVNode("",!0),Fe.value?(t.openBlock(),t.createElementBlock("div",Xr,[t.createElementVNode("label",jr,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":W[2]||(W[2]=Y=>v.value=Y),type:"checkbox",onChange:fe},null,544),[[t.vModelCheckbox,v.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(N)(e.locale,"nfThousands")),1)])])):t.createCommentVNode("",!0),Oe.value?(t.openBlock(),t.createElementBlock("div",Zr,[t.createElementVNode("label",qr,t.toDisplayString(t.unref(N)(e.locale,"nfSymbol")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":W[3]||(W[3]=Y=>u.value=Y),class:"nf-field__select",onChange:fe},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(le,Y=>t.createElementVNode("option",{key:Y.value,value:Y.value},t.toDisplayString(Y.label),9,Jr)),64))],544),[[t.vModelSelect,u.value]])])):t.createCommentVNode("",!0),Je.value?(t.openBlock(),t.createElementBlock("div",Qr,[t.createElementVNode("label",ea,t.toDisplayString(t.unref(N)(e.locale,"nfDateFormat")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":W[4]||(W[4]=Y=>k.value=Y),class:"nf-field__select",onChange:fe},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(oe.value,Y=>(t.openBlock(),t.createElementBlock("option",{key:Y,value:Y},t.toDisplayString(Y),9,ta))),128))],544),[[t.vModelSelect,k.value]])])):t.createCommentVNode("",!0),Ge.value?(t.openBlock(),t.createElementBlock("div",la,[t.createElementVNode("label",oa,t.toDisplayString(t.unref(N)(e.locale,"nfTimeFormat")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":W[5]||(W[5]=Y=>x.value=Y),class:"nf-field__select",onChange:fe},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(Z,Y=>t.createElementVNode("option",{key:Y,value:Y},t.toDisplayString(Y),9,na)),64))],544),[[t.vModelSelect,x.value]])])):t.createCommentVNode("",!0),je.value?(t.openBlock(),t.createElementBlock("div",ra,[t.createElementVNode("label",aa,t.toDisplayString(t.unref(N)(e.locale,"nfDateTime")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":W[6]||(W[6]=Y=>S.value=Y),class:"nf-field__select",onChange:fe},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(J.value,Y=>(t.openBlock(),t.createElementBlock("option",{key:Y,value:Y},t.toDisplayString(Y),9,ia))),128))],544),[[t.vModelSelect,S.value]])])):t.createCommentVNode("",!0),se.value?(t.openBlock(),t.createElementBlock("div",ca,[t.createElementVNode("label",sa,t.toDisplayString(t.unref(N)(e.locale,"nfDuration")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":W[7]||(W[7]=Y=>w.value=Y),class:"nf-field__select",onChange:fe},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(q,Y=>t.createElementVNode("option",{key:Y,value:Y},t.toDisplayString(Y),9,da)),64))],544),[[t.vModelSelect,w.value]])])):t.createCommentVNode("",!0),t.createElementVNode("div",ua,[t.createElementVNode("label",fa,t.toDisplayString(t.unref(N)(e.locale,"nfCustomCode")),1),t.withDirectives(t.createElementVNode("textarea",{ref_key:"customCodeRef",ref:B,"onUpdate:modelValue":W[8]||(W[8]=Y=>R.value=Y),class:"nf-field__textarea",rows:"2",spellcheck:"false",onInput:De},null,544),[[t.vModelText,R.value]])])]),t.createElementVNode("div",ma,[t.createElementVNode("div",pa,[t.createElementVNode("span",ga,t.toDisplayString(t.unref(N)(e.locale,"nfPreview")),1),t.createElementVNode("span",ha,t.toDisplayString(_.value||"—"),1)]),t.createElementVNode("div",Ca,[t.createElementVNode("button",{class:"nf-btn nf-btn--primary",type:"button",onClick:A},t.toDisplayString(t.unref(N)(e.locale,"ok")),1),t.createElementVNode("button",{class:"nf-btn",type:"button",onClick:T},t.toDisplayString(t.unref(N)(e.locale,"cancel")),1)])])],34)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-69cb36b7"]]);function Ue(e){let n="",o=e;do n=String.fromCharCode(65+o%26)+n,o=Math.floor(o/26)-1;while(o>=0);return n}function bl(e){let n=0;for(let o=0;o<e.length;o++)n=n*26+(e.toUpperCase().charCodeAt(o)-64);return n-1}function Vt(e){if(e==null)return null;if(typeof e=="number")return e;if(typeof e=="string"){const n=parseFloat(e);return e.endsWith("%")||isNaN(n)?null:n}return null}function yl(e){navigator.clipboard.writeText(e).catch(()=>{const n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.opacity="0",document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n)})}function Kt(e,n){return`${e},${n}`}function jt(e,n,o){const l=e.match(/^\$?([A-Z]+)\$?(\d+)$/i);if(!l)return null;const c=bl(l[1]),d=parseInt(l[2],10)-1;return c<0||c>=n||d<0||d>=o?null:{col:c,row:d}}function Ft(e,n){if(!n)return{x:0,y:0};const o=n.getBoundingClientRect();return{x:e.clientX-o.left,y:e.clientY-o.top}}function Gl(e,n,o){const l=e.split(":");if(l.length!==2)return null;const c=jt(l[0],n,o),d=jt(l[1],n,o);return!c||!d?null:{sc:Math.min(c.col,d.col),sr:Math.min(c.row,d.row),ec:Math.max(c.col,d.col),er:Math.max(c.row,d.row)}}function Pl(e){const n=e.trim();if(n==="")return"";const o=Number(n);return!isNaN(o)&&/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(n)?o:e}function Ot(e,n,o,l,c){const d=o[Kt(e,n)];if(!d)return"";const r=d.value;return r.startsWith("=")?Yl(Kt(e,n),o,l,c):Pl(r)}function ya(e,n,o,l,c){const d=Ot(e,n,o,l,c);if(d===null)return 0;if(typeof d=="number")return d;const r=parseFloat(String(d));return isNaN(r)?0:r}const Zt=new Map,il=new Set;function vl(){Zt.clear(),il.clear()}function Yl(e,n,o,l){return va(e,n,o,l,0)}function va(e,n,o,l,c){if(il.has(e))return null;if(Zt.has(e))return Zt.get(e);il.add(e);const d=n[e];let r;if(!d)r=null;else{const v=d.value;if(!v.startsWith("="))r=Pl(v);else{const u=v.slice(1).trim(),k=/^([A-Za-z_][A-Za-z0-9_]*)\s*\(([\s\S]*)\)$/.exec(u);r=k?jl(k[1].toUpperCase(),k[2],n,o,l,c+1):null}}return il.delete(e),Zt.set(e,r),r}function Xl(e){return e===null||e===""?!1:typeof e=="number"?e!==0:!0}function wa(e,n){return typeof e=="number"&&typeof n=="number"?e===n:String(e??"")===String(n??"")}function ka(e,n,o){let l;if(typeof e=="number"&&typeof n=="number")l=e<n?-1:e>n?1:0;else{const c=String(e??""),d=String(n??"");l=c<d?-1:c>d?1:0}switch(o){case"=":return l===0;case"<>":return l!==0;case"<":return l<0;case">":return l>0;case"<=":return l<=0;case">=":return l>=0}return!1}function Ea(e,n,o,l,c){const d=e.trim();let r=null,v=-1,u=null,k=0;for(let S=0;S<d.length;S++){const w=d[S];if(u){w===u&&(d[S+1]===u?S++:u=null);continue}if(w==='"'||w==="'"){u=w;continue}if(w==="("&&k++,w===")"&&k--,k===0&&(w==="<"||w===">"||w==="=")){let R=null;const B=d.slice(S,S+2);B==="<="||B===">="||B==="<>"?R=B:R=w,r=R,v=S,R.length===2&&S++;break}}if(r&&v>=0){const S=d.slice(0,v).trim(),w=d.slice(v+r.length).trim(),R=Et(S,n,o,l,c),B=Et(w,n,o,l,c);return ka(R,B,r)}const x=Et(d,n,o,l,c);return Xl(x)}function wl(e){const n=[];let o=0,l=null,c="";for(let d=0;d<e.length;d++){const r=e[d];if(l){c+=r,r===l&&(e[d+1]===l?(d++,c+=l):l=null);continue}if(r==='"'||r==="'"){l=r,c+=r;continue}if(r==="("&&o++,r===")"&&o--,r===","&&o===0){n.push(c),c="";continue}c+=r}return n.push(c),n}function Et(e,n,o,l,c){if(c>20)return null;const d=e.trim();if(d==="")return null;const r=d.toUpperCase();if(r==="TRUE")return 1;if(r==="FALSE")return 0;const v=Ra(d);if(v.length===0)return null;let u=0;const k=()=>{let R=x();for(;u<v.length;){const B=v[u];if(B.type==="op"&&(B.val==="+"||B.val==="-"))u++,R=kl(R,x(),B.val);else break}return R},x=()=>{let R=S();for(;u<v.length;){const B=v[u];if(B.type==="op"&&(B.val==="*"||B.val==="/"))u++,R=kl(R,S(),B.val);else break}return R},S=()=>{const R=v[u];return R&&R.type==="op"&&R.val==="-"?(u++,kl(0,S(),"-")):R&&R.type==="op"&&R.val==="+"?(u++,S()):w()},w=()=>{const R=v[u];if(!R)return null;if(R.type==="num")return u++,Number(R.val);if(R.type==="str")return u++,R.val;if(R.type==="lp"){u++;const B=k();return v[u]&&v[u].type==="rp"&&u++,B}if(R.type==="ref"){u++;const B=jt(R.val,o,l);return B?Ot(B.col,B.row,n,o,l):null}if(R.type==="func"){const B=R.val.toUpperCase();if(u++,v[u]&&v[u].type==="lp"){const le=v[u];let ne=0,p=null,V=u;for(;V<v.length;V++)if(v[V].type==="lp")ne++;else if(v[V].type==="rp"&&(ne--,ne===0)){p=v[V];break}if(p){const P=d.slice(le.start+1,p.start);return u=V+1,jl(B,P,n,o,l,c+1)}}return null}return u++,null};return k()}function Ra(e){const n=[];let o=0;for(;o<e.length;){const l=e[o];if(/\s/.test(l)){o++;continue}if(l==='"'||l==="'"){const c=l,d=o;o++;let r="";for(;o<e.length;){if(e[o]===c){if(e[o+1]===c){r+=c,o+=2;continue}o++;break}r+=e[o],o++}n.push({type:"str",val:r,start:d});continue}if(/[0-9]/.test(l)||l==="."){const c=o;let d="";for(l==="."&&(d+=".",o++);o<e.length&&/[0-9]/.test(e[o]);)d+=e[o],o++;if(e[o]===".")for(d+=".",o++;o<e.length&&/[0-9]/.test(e[o]);)d+=e[o],o++;if(e[o]==="e"||e[o]==="E")for(d+=e[o],o++,(e[o]==="+"||e[o]==="-")&&(d+=e[o],o++);o<e.length&&/[0-9]/.test(e[o]);)d+=e[o],o++;n.push({type:"num",val:d,start:c});continue}if(/[A-Za-z_]/.test(l)){const c=o;let d="";for(;o<e.length&&/[A-Za-z0-9_]/.test(e[o]);)d+=e[o],o++;e[o]==="("?n.push({type:"func",val:d,start:c}):n.push({type:"ref",val:d,start:c});continue}if(l==="("){n.push({type:"lp",val:l,start:o}),o++;continue}if(l===")"){n.push({type:"rp",val:l,start:o}),o++;continue}if(l===","){n.push({type:"comma",val:l,start:o}),o++;continue}if(l==="+"||l==="-"||l==="*"||l==="/"){n.push({type:"op",val:l,start:o}),o++;continue}o++}return n}function kl(e,n,o){if(typeof e!="number"||typeof n!="number")return null;switch(o){case"+":return e+n;case"-":return e-n;case"*":return e*n;case"/":return n===0?null:e/n}return null}function jl(e,n,o,l,c,d){switch(e){case"SUM":case"AVERAGE":case"COUNT":{const r=Gl(n.trim(),l,c);if(!r)return null;if(e==="COUNT"){let u=0;for(let k=r.sc;k<=r.ec;k++)for(let x=r.sr;x<=r.er;x++)typeof Ot(k,x,o,l,c)=="number"&&u++;return u}let v=0;for(let u=r.sc;u<=r.ec;u++)for(let k=r.sr;k<=r.er;k++)v+=ya(u,k,o,l,c);if(isNaN(v))return null;if(e==="AVERAGE"){const u=(r.ec-r.sc+1)*(r.er-r.sr+1);return u===0?null:v/u}return v}case"IF":{const r=wl(n);if(r.length<3)return null;const v=Ea(r[0],o,l,c,d);return Et(v?r[1]:r[2],o,l,c,d)}case"VLOOKUP":{const r=wl(n);if(r.length<3)return null;const v=Et(r[0],o,l,c,d),u=Gl(r[1].trim(),l,c);if(!u)return null;const k=Et(r[2],o,l,c,d),x=typeof k=="number"?k:parseFloat(String(k));if(isNaN(x))return null;const S=u.sc+(x-1);if(S<u.sc||S>u.ec)return null;if(r.length>=4?Xl(Et(r[3],o,l,c,d)):!1){let R=-1,B=-1/0;for(let le=u.sr;le<=u.er;le++){const ne=Ot(u.sc,le,o,l,c);typeof ne=="number"&&typeof v=="number"&&ne<=v&&ne>B&&(B=ne,R=le)}return R>=0?Ot(S,R,o,l,c):null}for(let R=u.sr;R<=u.er;R++){const B=Ot(u.sc,R,o,l,c);if(wa(B,v))return Ot(S,R,o,l,c)}return null}case"CONCATENATE":{const r=wl(n);let v="";for(const u of r){const k=Et(u,o,l,c,d);v+=k===null?"":typeof k=="number"?String(k):k}return v}default:return null}}function El(e,n,o){const l=[],c=/(\$?[A-Z]+\$?\d+)(?::(\$?[A-Z]+\$?\d+))?/gi;let d;for(;(d=c.exec(e))!==null;){const r=jt(d[1],n,o);if(r)if(d[2]){const v=jt(d[2],n,o);if(!v)continue;for(let u=Math.min(r.col,v.col);u<=Math.max(r.col,v.col);u++)for(let k=Math.min(r.row,v.row);k<=Math.max(r.row,v.row);k++)l.push(Kt(u,k))}else l.push(Kt(r.col,r.row))}return l}function Ba(e,n,o,l,c){const d=o[Kt(e,n)];if(!d)return"";const r=d.value;if(!r.startsWith("="))return r;const v=Yl(Kt(e,n),o,l,c);return v===null?"#ERROR":String(v)}function xa(e,n,o,l,c,d){return n===0&&o===0?e:e.replace(/(\$?)([A-Z]+)(\$?)(\d+)/gi,(r,v,u,k,x)=>{const S=v?bl(u):bl(u)+n,w=k?parseInt(x,10)-1:parseInt(x,10)-1+o;let R;S<0?R="A":S>=l?R=d(l-1):R=d(S);let B;return w<0?B="1":w>=c?B=String(c):B=String(w+1),(v||"")+R+(k||"")+B})}class Ma{constructor(){this.deps=new Map,this.rev=new Map,this.dirty=new Set}clear(n){var l;const o=this.deps.get(n);if(o){for(const c of o)(l=this.rev.get(c))==null||l.delete(n);this.deps.delete(n)}}set(n,o){if(this.clear(n),o.length!==0){this.deps.set(n,o);for(const l of o)this.rev.has(l)||this.rev.set(l,new Set),this.rev.get(l).add(n)}}markDirty(n){const o=[n];for(;o.length>0;){const l=o.pop(),c=this.rev.get(l);if(c)for(const d of c)this.dirty.has(d)||(this.dirty.add(d),o.push(d))}}getDirtyAndClear(){const n=this.dirty;return this.dirty=new Set,n}rebuild(n,o,l){this.deps.clear(),this.rev.clear(),this.dirty.clear(),Zt.clear();for(const[c,d]of Object.entries(n))if(d.value.startsWith("=")){const r=El(d.value.slice(1),o,l);this.set(c,r)}}}function Sa(e,n){const o=t.reactive({rowCount:e.rowCount??n.rowCount,colCount:e.colCount??n.colCount,width:e.width,height:e.height,theme:e.theme??n.theme,locale:e.locale??n.locale});t.watchEffect(()=>{o.rowCount=e.rowCount??n.rowCount,o.colCount=e.colCount??n.colCount,o.width=e.width,o.height=e.height,o.theme=e.theme??n.theme,o.locale=e.locale??n.locale});const l=t.computed(()=>o.locale==="zh-CN"?"zh-CN":"en-US"),c=o.colCount,d=o.rowCount,r=t.reactive({}),v=t.reactive({}),u=new Ma,k=t.ref(null),x=t.ref("cell"),S=t.ref({col:0,row:0}),w=t.ref(null),R=t.ref(""),B=t.ref(new Array(c).fill(100)),le=t.ref(new Array(d).fill(void 0)),ne=t.ref(0),p=t.ref(0),V=(24-kt)/2,P=new Map;let oe=null;function Z(H,O,I,Q){const ie=`${Q} ${I} ${O}px ${H}`,ke=P.get(ie);if(ke)return ke;if(!oe){if(typeof document>"u")return{ascent:O*.88,descent:O*.28};oe=document.createElement("canvas")}const Ne=oe.getContext("2d");if(!Ne)return{ascent:O*.88,descent:O*.28};Ne.font=ie;const ze=Ne.measureText(" "),Le=ze.fontBoundingBoxAscent,We=ze.fontBoundingBoxDescent;if(typeof Le=="number"&&typeof We=="number"&&Le>0&&We>0){const me={ascent:Le,descent:We};return P.set(ie,me),me}const Se=["M","中","y","Ä","0"];let b=0,F=0;for(const me of Se){const be=Ne.measureText(me),we=be.actualBoundingBoxAscent||0,Ae=be.actualBoundingBoxDescent||0;we>b&&(b=we),Ae>F&&(F=Ae)}const K=Math.max(b,O*.88),Ce=Math.max(F,O*.28),ge={ascent:K,descent:Ce};return P.set(ie,ge),ge}let J=(H,O)=>`${H},${O}`,q=()=>null,ue=()=>kt,Fe=t.computed(()=>[0]),Oe=()=>24,Je=(H,O,I,Q)=>({startCol:Math.min(H,I),startRow:Math.min(O,Q),endCol:Math.max(H,I),endRow:Math.max(O,Q)});function Ge(H,O){var ze;const I=(ze=r[J(H,O)])==null?void 0:ze.style,Q=ue(H,O),ie=typeof(I==null?void 0:I.fontFamily)=="string"&&I.fontFamily?I.fontFamily:Pt,ke=(I==null?void 0:I.fontWeight)==="bold"?"bold":"normal",Ne=(I==null?void 0:I.fontStyle)==="italic"?"italic":"normal";return Z(ie,Q,ke,Ne)}function je(H,O,I,Q){if(!O)return[""];const ie=O.split(`
|
|
2
|
-
`),ke=[];for(const Ne of ie)if(!Q||I<=0)ke.push(Ne);else{let
|
|
3
|
-
`).length,dt>ie&&(ie=dt)}}const ze=I+Q,Le=V*2+ie*ze;return Math.min(500,Math.max(24,Math.round(Le)))}Oe=i;function m(H){return le.value[H]===void 0}const fe=t.computed(()=>{const H=[0];for(let O=0;O<d;O++)H.push(H[O]+Oe(O));return H}),De=t.computed(()=>de.value[c]),f=t.computed(()=>fe.value[d]);function y(H,O){return`${H},${O}`}J=y;function T(H){Reflect.deleteProperty(r,H)}function A(H,O){x.value="cell";const I=q(H,O);I?(S.value={col:I.range.startCol,row:I.range.startRow},k.value={...I.range}):(S.value={col:H,row:O},k.value={startCol:H,startRow:O,endCol:H,endRow:O})}function a(H,O,I,Q,ie="cell"){const ke=q(H,O);if(S.value=ke?{col:ke.range.startCol,row:ke.range.startRow}:{col:H,row:O},x.value=ie,ie==="row"||ie==="col"){const Ne=Math.min(H,I),ze=Math.max(H,I),Le=Math.min(O,Q),We=Math.max(O,Q);k.value={startCol:Ne,startRow:Le,endCol:ze,endRow:We}}else k.value=Je(H,O,I,Q)}function h(){a(0,0,c-1,d-1,"all")}function _(H,O){const I=k.value;return I?(x.value==="cell"||x.value==="all",H>=I.startCol&&H<=I.endCol&&O>=I.startRow&&O<=I.endRow):!1}function E(H,O){return _(H,O)}function W(H,O){for(const I in v){const Q=v[I];if(Q&&H>=Q.startCol&&H<=Q.endCol&&O>=Q.startRow&&O<=Q.endRow)return{range:Q,anchor:I}}return null}q=W;function Y(H,O){return v[y(H,O)]!==void 0}function Me(H,O){const I=q(H,O);if(I&&H===I.range.startCol&&O===I.range.startRow){const Q=de.value[I.range.endCol+1]-de.value[H],ie=fe.value[I.range.endRow+1]-fe.value[O];return{w:Q,h:ie}}return{w:B.value[H],h:Oe(O)}}function Ve(H,O,I,Q){let ie=Math.min(H,I),ke=Math.max(H,I),Ne=Math.min(O,Q),ze=Math.max(O,Q),Le=!0;for(;Le;){Le=!1;for(const We in v){const Se=v[We];if(!Se)continue;Se.startCol<=ke&&Se.endCol>=ie&&Se.startRow<=ze&&Se.endRow>=Ne&&(Se.startCol<ie&&(ie=Se.startCol,Le=!0),Se.endCol>ke&&(ke=Se.endCol,Le=!0),Se.startRow<Ne&&(Ne=Se.startRow,Le=!0),Se.endRow>ze&&(ze=Se.endRow,Le=!0))}}return{startCol:ie,startRow:Ne,endCol:ke,endRow:ze}}Je=Ve;let Ke=()=>{};function Be(H,O){var I;return((I=r[y(H,O)])==null?void 0:I.value)??""}function M(H,O){return vl(),Ba(H,O,r,c,d)}function D(H,O,I){var Ne,ze;const Q=y(H,O);if(vl(),I===""||I==null){u.clear(Q);const Le=((Ne=r[Q])==null?void 0:Ne.style)??null;Le?r[Q]={value:"",style:Le}:T(Q),u.markDirty(Q);return}const ie=String(I),ke=((ze=r[Q])==null?void 0:ze.style)??null;r[Q]={value:ie,style:ke},ie.startsWith("=")?u.set(Q,El(ie.slice(1),c,d)):u.clear(Q),u.markDirty(Q)}function G(H,O,I,Q){for(let ie=H;ie<=O;ie++)for(let ke=I;ke<=Q;ke++){const Ne=y(ie,ke);u.clear(Ne),T(Ne),u.markDirty(Ne),Ke(ie,ke)}}let ce=()=>{};function ee(H){w.value||(w.value={...S.value},H!==void 0?R.value=H:R.value||(R.value=Be(S.value.col,S.value.row)))}function ae(){w.value&&(ce(),D(w.value.col,w.value.row,R.value),w.value=null,R.value="")}function X(){w.value=null,R.value=""}function U(H,O){const I=S.value;let Q=Math.max(0,Math.min(c-1,I.col+H)),ie=Math.max(0,Math.min(d-1,I.row+O));const ke=q(I.col,I.row),Ne=q(Q,ie);ke&&Ne&&ke.anchor===Ne.anchor&&(H>0?Q=ke.range.endCol+1:H<0&&(Q=ke.range.startCol-1),O>0?ie=ke.range.endRow+1:O<0&&(ie=ke.range.startRow-1),Q=Math.max(0,Math.min(c-1,Q)),ie=Math.max(0,Math.min(d-1,ie))),A(Q,ie)}function ye(H,O){const I=Math.max(0,Te.w-52-11),Q=Math.max(0,Te.h-24-11),ie=de.value[H],ke=fe.value[O],Ne=q(H,O),ze=Ne?de.value[Ne.range.endCol+1]-de.value[H]:B.value[H],Le=Ne?fe.value[Ne.range.endRow+1]-fe.value[O]:Oe(O);let We=ne.value,Se=p.value;ie<We?We=ie:ie+ze>We+I&&(We=ie+ze-I),ke<Se?Se=ke:ke+Le>Se+Q&&(Se=ke+Le-Q),re(We,Se)}function Ee(H){const O=de.value;if(H<0||H>=O[c])return-1;let I=0,Q=c-1;for(;I<Q;){const ie=I+Q+1>>1;O[ie]<=H?I=ie:Q=ie-1}return I}function Ze(H){const O=fe.value;if(H<0||H>=O[d])return-1;let I=0,Q=d-1;for(;I<Q;){const ie=I+Q+1>>1;O[ie]<=H?I=ie:Q=ie-1}return I}const Pe={props:o,locale:l,colCount:c,rowCount:d,cells:r,merges:v,formulaDeps:u,selection:k,activeCell:S,editingCell:w,editValue:R,colWidths:B,rowHeights:le,scrollX:ne,scrollY:p,BASE_CELL_VPAD:V,fontMetricsCache:P,fontMetricsCanvas:oe,measureFontMetrics:Z,_getFontMetricsForCell:Ge,getWrappedLines:je,cellFontSize:se,colPositions:de,getRowHeight:i,_isAutoRow:m,rowPositions:fe,totalWidth:De,totalHeight:f,selectCell:A,selectRange:a,selectAll:h,isSelected:_,isCellSelected:E,selectionMode:x,cellKey:y,delCell:T,findMerge:W,_isMergeAnchor:Y,_mergedSpan:Me,expandSelectionForMerges:Ve,getCellRaw:Be,getCellValue:M,setCellValue:D,clearCellsInRange:G,startEdit:ee,commitEdit:ae,cancelEdit:X,moveActive:U,ensureVisible:ye,hitCol:Ee,hitRow:Ze,viewSize:Te,findHighlight:(H,O)=>null};return ce=()=>{var H;return(H=Pe.saveUndo)==null?void 0:H.call(Pe)},Ke=(H,O)=>{var I;return(I=Pe.syncCellBorders)==null?void 0:I.call(Pe,H,O)},re=(H,O)=>{var I;return(I=Pe.clampScroll)==null?void 0:I.call(Pe,H,O)},Pe}function Ta(e,n){const o=t.ref([]),l=t.ref([]);function c(b){const F={};for(const[K,Ce]of Object.entries(b))F[K]={value:Ce.value,style:Ce.style};return F}function d(){return n.saveSheet(),{sheets:n.sheets.value.map(b=>({id:b.id,name:b.name,cells:c(b.cells),merges:b.merges?{...b.merges}:{},selection:b.selection?{...b.selection}:null,activeCell:b.activeCell?{...b.activeCell}:{col:0,row:0},scrollX:b.scrollX,scrollY:b.scrollY,colWidths:[...b.colWidths],rowHeights:[...b.rowHeights]})),activeSheetIndex:n.activeSheetIndex.value}}function r(b){n.sheets.value=b.sheets.map(F=>({...F,cells:c(F.cells)})),n.loadSheet(Math.max(0,Math.min(b.activeSheetIndex,n.sheets.value.length-1))),e.formulaDeps.rebuild(e.cells,e.colCount,e.rowCount)}function v(){const b=d(),F=o.value[o.value.length-1];F&&JSON.stringify(F)===JSON.stringify(b)||(o.value.push(b),l.value=[],o.value.length>50&&o.value.shift())}e.saveUndo=v;function u(){var b;o.value.length&&(l.value.push(d()),r(o.value.pop()),(b=e.scheduleRender)==null||b.call(e),t.nextTick(()=>{var F;return(F=e.emitModelData)==null?void 0:F.call(e)}))}function k(){var b;l.value.length&&(o.value.push(d()),r(l.value.pop()),(b=e.scheduleRender)==null||b.call(e),t.nextTick(()=>{var F;return(F=e.emitModelData)==null?void 0:F.call(e)}))}const x=t.computed(()=>o.value.length>0),S=t.computed(()=>l.value.length>0),w=t.computed(()=>!!e.selection.value),R=t.ref(null);function B(){var K;const b=e.selection.value;if(!b)return;const F={};for(let Ce=b.startCol;Ce<=b.endCol;Ce++)for(let ge=b.startRow;ge<=b.endRow;ge++)F[`${Ce-b.startCol},${ge-b.startRow}`]=((K=e.cells[e.cellKey(Ce,ge)])==null?void 0:K.style)??null;R.value={styles:F}}function le(){var K,Ce,ge,me;const b=R.value,F=e.selection.value;if(!(!b||!F)){v();for(let be=F.startCol;be<=F.endCol;be++)for(let we=F.startRow;we<=F.endRow;we++){const Ae=e.findMerge(be,we);if(Ae&&(be!==Ae.range.startCol||we!==Ae.range.startRow))continue;const lt=b.styles[`${be-F.startCol},${we-F.startRow}`]??null,it=e.cellKey(be,we),dt=((K=e.cells[it])==null?void 0:K.value)??"";dt===""&<===null?e.delCell(it):e.cells[it]={value:dt,style:lt},(Ce=e.syncCellBorders)==null||Ce.call(e,be,we)}R.value=null,(ge=e.scheduleRender)==null||ge.call(e),(me=e.emitModelData)==null||me.call(e)}}function ne(){var F,K,Ce,ge;const b=e.selection.value;if(b){v();for(let me=b.startCol;me<=b.endCol;me++)for(let be=b.startRow;be<=b.endRow;be++){const we=e.findMerge(me,be);if(we&&(me!==we.range.startCol||be!==we.range.startRow))continue;const Ae=e.cellKey(me,be),lt=((F=e.cells[Ae])==null?void 0:F.value)??"";lt===""?e.delCell(Ae):e.cells[Ae]={value:lt,style:null},(K=e.syncCellBorders)==null||K.call(e,me,be)}(Ce=e.scheduleRender)==null||Ce.call(e),(ge=e.emitModelData)==null||ge.call(e)}}const p=t.computed(()=>fo.map(b=>({...b,label:b.value===""?N(e.locale.value,"fontDefault"):b.label}))),V=t.computed(()=>mo.map(b=>({...b,label:String(b.value)}))),P="\0",oe=t.computed(()=>{var Ce;const b=e.selection.value;if(!b)return"";let F,K=!1;for(let ge=b.startCol;ge<=b.endCol&&!K;ge++)for(let me=b.startRow;me<=b.endRow&&!K;me++){const be=e.findMerge(ge,me);if(be&&(ge!==be.range.startCol||me!==be.range.startRow))continue;const we=(Ce=e.cells[e.cellKey(ge,me)])==null?void 0:Ce.style,Ae=typeof(we==null?void 0:we.fontFamily)=="string"?we.fontFamily:"";F===void 0?F=Ae:Ae!==F&&(K=!0)}return K?P:F??""}),Z=t.computed(()=>{const b=e.selection.value;if(!b)return kt;let F,K=!1;for(let Ce=b.startCol;Ce<=b.endCol&&!K;Ce++)for(let ge=b.startRow;ge<=b.endRow&&!K;ge++){const me=e.findMerge(Ce,ge);if(me&&(Ce!==me.range.startCol||ge!==me.range.startRow))continue;const be=e.cellFontSize(Ce,ge);F===void 0?F=be:be!==F&&(K=!0)}return K?0:F??kt});function J(b,F){var Ce,ge,me,be;const K=e.selection.value;if(K){v();for(let we=K.startCol;we<=K.endCol;we++)for(let Ae=K.startRow;Ae<=K.endRow;Ae++){const lt=e.findMerge(we,Ae);if(lt&&(we!==lt.range.startCol||Ae!==lt.range.startRow))continue;const it=e.cellKey(we,Ae),dt=((Ce=e.cells[it])==null?void 0:Ce.value)??"",Qe=(ge=e.cells[it])!=null&&ge.style?{...e.cells[it].style}:{};F===""||F===null||F===void 0||F===0?Reflect.deleteProperty(Qe,b):Qe[b]=F;const rt=Object.keys(Qe).length?Qe:null;dt===""&&rt===null?e.delCell(it):e.cells[it]={value:dt,style:rt}}(me=e.scheduleRender)==null||me.call(e),(be=e.emitModelData)==null||be.call(e)}}function q(b){J("fontFamily",b===""?"":b)}const ue=t.ref(!1),Fe=t.ref(!1),Oe=t.ref(!1),Je=t.ref(!1),Ge=t.ref(!1);function je(b){J("fontSize",b),ue.value=!1}const se=t.computed(()=>vo.map(b=>({label:N(e.locale.value,b.labelKey),value:b.value,icon:b.icon}))),de=t.computed(()=>wo.map(b=>({label:N(e.locale.value,b.labelKey),value:b.value,icon:b.icon}))),Te=t.computed(()=>{var Ce;const b=e.selection.value;if(!b)return"left";const F=(Ce=e.cells[e.cellKey(b.startCol,b.startRow)])==null?void 0:Ce.style,K=typeof(F==null?void 0:F.textAlign)=="string"?F.textAlign:"";return K==="center"||K==="right"?K:"left"}),re=t.computed(()=>{var Ce;const b=e.selection.value;if(!b)return"top";const F=(Ce=e.cells[e.cellKey(b.startCol,b.startRow)])==null?void 0:Ce.style,K=typeof(F==null?void 0:F.verticalAlign)=="string"?F.verticalAlign:"";return K==="middle"||K==="bottom"?K:"top"}),i=t.computed(()=>{var K;const b=e.selection.value;if(!b)return!1;const F=(K=e.cells[e.cellKey(b.startCol,b.startRow)])==null?void 0:K.style;return(F==null?void 0:F.wrap)==="wrap"});function m(b){J("textAlign",b)}function fe(b){J("verticalAlign",b)}function De(){if(!e.selection.value)return;const F=i.value;J("wrap",F?void 0:"wrap")}const f=t.ref(""),y=ue;t.watch(Z,b=>{f.value=b===0?"":String(b)},{immediate:!0});function T(b){const F=b.replace(/[^\d]/g,"");f.value=F;const K=parseInt(F,10);!isNaN(K)&&K>=5&&K<=72&&K!==Z.value&&J("fontSize",K)}function A(){const b=f.value.trim();if(!b){f.value=Z.value===0?"":String(Z.value);return}let F=parseInt(b,10);isNaN(F)?F=Z.value===0?kt:Z.value:F=Math.max(5,Math.min(72,F)),f.value=String(F),F!==Z.value&&J("fontSize",F)}function a(b){b.key==="Enter"&&b.target.blur()}function h(b){b&&b.preventDefault(),y.value=!y.value,y.value&&(Oe&&(Oe.value=!1),Fe&&(Fe.value=!1),Je.value=!1,Ge.value=!1)}function _(){const b=Z.value===0?kt:Z.value,F=Math.min(72,b+1);J("fontSize",F),f.value=String(F),y.value=!1}function E(){const b=Z.value===0?kt:Z.value,F=Math.max(5,b-1);J("fontSize",F),f.value=String(F),y.value=!1}function W(b){var ge;const F=e.selection.value;if(!F)return!1;let K,Ce=!1;for(let me=F.startCol;me<=F.endCol&&!Ce;me++)for(let be=F.startRow;be<=F.endRow&&!Ce;be++){const we=e.findMerge(me,be);if(we&&(me!==we.range.startCol||be!==we.range.startRow))continue;const Ae=(ge=e.cells[e.cellKey(me,be)])==null?void 0:ge.style,lt=!!(Ae!=null&&Ae[b]);K===void 0?K=lt:lt!==K&&(Ce=!0)}return!Ce&&K===!0}const Y=t.computed(()=>W("fontWeight")),Me=t.computed(()=>W("fontStyle")),Ve=t.computed(()=>W("underline")),Ke=t.computed(()=>W("strikethrough"));function Be(){J("fontWeight",Y.value?"":"bold")}function M(){J("fontStyle",Me.value?"":"italic")}function D(){J("underline",Ve.value?"":"underline")}function G(){J("strikethrough",Ke.value?"":"line-through")}const ce=t.ref(""),ee=t.ref(""),ae=Je,X=Ge;function U(){ae.value=!ae.value,X.value=!1,Fe&&(Fe.value=!1),Oe&&(Oe.value=!1)}function ye(){X.value=!X.value,ae.value=!1,Fe&&(Fe.value=!1),Oe&&(Oe.value=!1)}function Ee(b){Fe&&(Fe.value=b),b&&(ae.value=!1,X.value=!1,Oe&&(Oe.value=!1))}function Ze(b){ce.value=b,J("color",b===""?"":b)}function Pe(b){ee.value=b,J("backgroundColor",b===""?"":b)}function H(){J("color",ce.value===""?"":ce.value)}function O(){J("backgroundColor",ee.value===""?"":ee.value)}const I=t.computed(()=>{var Ce;const b=e.selection.value;if(!b)return"";let F,K=!1;for(let ge=b.startCol;ge<=b.endCol&&!K;ge++)for(let me=b.startRow;me<=b.endRow&&!K;me++){const be=e.findMerge(ge,me);if(be&&(ge!==be.range.startCol||me!==be.range.startRow))continue;const we=(Ce=e.cells[e.cellKey(ge,me)])==null?void 0:Ce.style,Ae=typeof(we==null?void 0:we.color)=="string"?we.color:"";F===void 0?F=Ae:Ae!==F&&(K=!0)}return K?"":F??""}),Q=t.computed(()=>{var Ce;const b=e.selection.value;if(!b)return"";let F,K=!1;for(let ge=b.startCol;ge<=b.endCol&&!K;ge++)for(let me=b.startRow;me<=b.endRow&&!K;me++){const be=e.findMerge(ge,me);if(be&&(ge!==be.range.startCol||me!==be.range.startRow))continue;const we=(Ce=e.cells[e.cellKey(ge,me)])==null?void 0:Ce.style,Ae=typeof(we==null?void 0:we.backgroundColor)=="string"?we.backgroundColor:"";F===void 0?F=Ae:Ae!==F&&(K=!0)}return K?"":F??""}),ie=t.computed(()=>_o(e.locale.value)),ke=t.ref(!1),Ne=t.computed(()=>{var Ce;const b=e.selection.value;if(!b)return rl;let F,K=!1;for(let ge=b.startCol;ge<=b.endCol&&!K;ge++)for(let me=b.startRow;me<=b.endRow&&!K;me++){const be=e.findMerge(ge,me);if(be&&(ge!==be.range.startCol||me!==be.range.startRow))continue;const we=(Ce=e.cells[e.cellKey(ge,me)])==null?void 0:Ce.style,Ae=typeof(we==null?void 0:we.numberFormat)=="string"?we.numberFormat:"";F===void 0?F=Ae:Ae!==F&&(K=!0)}return K?nl:F??rl});function ze(b){J("numberFormat",b)}function Le(b){if(b===Al){ke.value=!0;return}ze(b)}function We(){ke.value=!0}return{undoStack:o,redoStack:l,cloneCells:c,takeSnap:d,restoreSnap:r,saveUndo:v,undo:u,redo:k,canUndo:x,canRedo:S,hasSelection:w,paintFmt:R,onPaintFormat:B,applyPaintFormat:le,clearFormat:ne,fontFamilyOptions:p,fontSizeOptions:V,FONT_FAMILY_MIXED:P,selFontFamily:oe,selFontSize:Z,applyStyleToSelection:J,onFontFamilyChange:q,onFontSizeChange:je,hAlignOptions:se,vAlignOptions:de,selHAlign:Te,selVAlign:re,selWrap:i,onHAlignChange:m,onVAlignChange:fe,onWrapToggle:De,fontSizeInput:f,fontSizeMenuOpen:y,onFontSizeInput:T,onFontSizeBlur:A,onFontSizeKeydown:a,toggleFontSizeMenu:h,onFontSizeStepUp:_,onFontSizeStepDown:E,selFontWeight:Y,selFontStyle:Me,selUnderline:Ve,selStrikethrough:Ke,toggleFontWeight:Be,toggleFontStyle:M,toggleUnderline:D,toggleStrikethrough:G,cachedTextColor:ce,cachedFillColor:ee,textColorMenuOpen:ae,fillColorMenuOpen:X,_toggleTextColorMenu:U,_toggleFillColorMenu:ye,onBorderMenuToggle:Ee,onTextColorChange:Ze,onFillColorChange:Pe,applyCachedTextColor:H,applyCachedFillColor:O,selTextColor:I,selFillColor:Q,nfOptions:ie,selNumberFormat:Ne,NF_NUMBER_FORMAT_MIXED:nl,nfDialogOpen:ke,onNumberFormatChange:Le,openNumberFormatDialog:We,applyNumberFormatCode:ze}}function Da(e,n){n.borderMenuOpen&&(e.borderMenuOpen=n.borderMenuOpen),n.mergeMenuOpen&&(e.mergeMenuOpen=n.mergeMenuOpen),(()=>{const l=e.borderMenuOpen,c=e.mergeMenuOpen;e.onBorderMenuToggle=d=>{l&&(l.value=d),d&&(e.textColorMenuOpen.value=!1,e.fillColorMenuOpen.value=!1,c&&(c.value=!1))},e.toggleFontSizeMenu=d=>{d&&d.preventDefault(),e.fontSizeMenuOpen.value=!e.fontSizeMenuOpen.value,e.fontSizeMenuOpen.value&&(c&&(c.value=!1),l&&(l.value=!1),e.textColorMenuOpen.value=!1,e.fillColorMenuOpen.value=!1)},e._toggleTextColorMenu=()=>{e.textColorMenuOpen.value=!e.textColorMenuOpen.value,e.fillColorMenuOpen.value=!1,l&&(l.value=!1),c&&(c.value=!1)},e._toggleFillColorMenu=()=>{e.fillColorMenuOpen.value=!e.fillColorMenuOpen.value,e.textColorMenuOpen.value=!1,l&&(l.value=!1),c&&(c.value=!1)}})()}function Na(e,n){const o=t.ref("none"),l=t.ref(!1),c="#444";function d(f,y,T,A){const a=e.findMerge(y,T),h=a?a.range.endCol:y,_=a?a.range.endRow:T,E=a?a.range.startCol:y,Y=(a?a.range.startRow:T)===A.startRow,Me=_===A.endRow,Ve=E===A.startCol,Ke=h===A.endCol,Be={top:0,bottom:0,left:0,right:0};switch(f){case"none":return Be;case"bottom":Me&&(Be.bottom=1);break;case"top":Y&&(Be.top=1);break;case"left":Ve&&(Be.left=1);break;case"right":Ke&&(Be.right=1);break;case"all":Be.top=1,Be.bottom=1,Be.left=1,Be.right=1;break;case"outer":Y&&(Be.top=1),Me&&(Be.bottom=1),Ve&&(Be.left=1),Ke&&(Be.right=1);break;case"thickOuter":Y&&(Be.top=2),Me&&(Be.bottom=2),Ve&&(Be.left=2),Ke&&(Be.right=2);break}return Be}function r(f,y,T,A,a){var Be,M;if(f<0||y<0||f>=e.colCount||y>=e.rowCount)return;const h=e.findMerge(f,y);if(h&&(T==="Top"&&(f!==h.range.startCol||y!==h.range.startRow)||T==="Bottom"&&(f!==h.range.startCol||y!==h.range.endRow)||T==="Left"&&(f!==h.range.startCol||y!==h.range.startRow)||T==="Right"&&(f!==h.range.endCol||y!==h.range.startRow)))return;const _=h?h.anchor:e.cellKey(f,y),E=((Be=e.cells[_])==null?void 0:Be.value)??"",W=(M=e.cells[_])!=null&&M.style?{...e.cells[_].style}:{},Y=`border${T}Width`;A===0?a&&Reflect.deleteProperty(W,Y):(W[Y]=A,W.borderColor=c),["Top","Bottom","Left","Right"].some(D=>W[`border${D}Width`]!==void 0)||Reflect.deleteProperty(W,"borderColor");const Ke=Object.keys(W).length?W:null;E===""&&Ke===null?e.delCell(_):e.cells[_]={value:E,style:Ke}}function v(f,y){var Y;const T=e.findMerge(f,y),A=T?T.anchor:e.cellKey(f,y),a=(Y=e.cells[A])==null?void 0:Y.style,h=(a==null?void 0:a.borderTopWidth)||0,_=(a==null?void 0:a.borderBottomWidth)||0,E=(a==null?void 0:a.borderLeftWidth)||0,W=(a==null?void 0:a.borderRightWidth)||0;if(T){const Me=T.range.startRow,Ve=T.range.endRow,Ke=T.range.startCol,Be=T.range.endCol;r(Ke,Me-1,"Bottom",h,!0),r(Ke,Ve+1,"Top",_,!0),r(Ke-1,Me,"Right",E,!0),r(Be+1,Me,"Left",W,!0)}else r(f,y-1,"Bottom",h,!0),r(f,y+1,"Top",_,!0),r(f-1,y,"Right",E,!0),r(f+1,y,"Left",W,!0)}e.syncCellBorders=v;function u(f,y,T,A=!0){var Ke,Be;const a=e.findMerge(f,y),h=a?a.anchor:e.cellKey(f,y),_=((Ke=e.cells[h])==null?void 0:Ke.value)??"",E=(Be=e.cells[h])!=null&&Be.style?{...e.cells[h].style}:{},W=["Top","Bottom","Left","Right"],Y=[T.top,T.bottom,T.left,T.right];for(let M=0;M<4;M++){const D=`border${W[M]}Width`;Y[M]===0?A&&Reflect.deleteProperty(E,D):(E[D]=Y[M],E.borderColor=c)}W.some(M=>E[`border${M}Width`]!==void 0)||Reflect.deleteProperty(E,"borderColor");const Ve=Object.keys(E).length?E:null;_===""&&Ve===null?e.delCell(h):e.cells[h]={value:_,style:Ve},v(a?a.range.startCol:f,a?a.range.startRow:y)}function k(f){var T,A;o.value=f;const y=e.selection.value;if(y){if(n.saveUndo(),f==="none")for(let a=y.startCol;a<=y.endCol;a++)for(let h=y.startRow;h<=y.endRow;h++){const _=e.findMerge(a,h);_&&(a!==_.range.startCol||h!==_.range.startRow)||u(a,h,{top:0,bottom:0,left:0,right:0},!0)}else for(let a=y.startCol;a<=y.endCol;a++)for(let h=y.startRow;h<=y.endRow;h++){const _=e.findMerge(a,h);if(_&&(a!==_.range.startCol||h!==_.range.startRow))continue;const E=d(f,a,h,y);u(a,h,E,!1)}(T=e.scheduleRender)==null||T.call(e),(A=e.emitModelData)==null||A.call(e)}}function x(){k(o.value)}function S(f,y,T){var h,_;const A=e.findMerge(f,y);if(A){const E=(h=e.cells[A.anchor])==null?void 0:h.style;return T==="Top"&&y===A.range.startRow?(E==null?void 0:E.borderTopWidth)||0:T==="Bottom"&&y===A.range.endRow?(E==null?void 0:E.borderBottomWidth)||0:T==="Left"&&f===A.range.startCol?(E==null?void 0:E.borderLeftWidth)||0:T==="Right"&&f===A.range.endCol&&(E==null?void 0:E.borderRightWidth)||0}const a=(_=e.cells[e.cellKey(f,y)])==null?void 0:_.style;return(a==null?void 0:a[`border${T}Width`])||0}const w=t.ref(!1);function R(f){w.value=f,f&&(n.textColorMenuOpen.value=!1,n.fillColorMenuOpen.value=!1,l.value=!1,n.fontSizeMenuOpen.value=!1)}function B(f,y,T,A){const a=[];for(const h in e.merges){const _=e.merges[h];_&&_.startCol<=T&&_.endCol>=f&&_.startRow<=A&&_.endRow>=y&&a.push(h)}for(const h of a)Reflect.deleteProperty(e.merges,h)}function le(){var a,h,_,E;const f=e.selection.value;if(!f||f.startCol===f.endCol&&f.startRow===f.endRow)return;n.saveUndo(),B(f.startCol,f.startRow,f.endCol,f.endRow);const y=e.cellKey(f.startCol,f.startRow),T=((a=e.cells[y])==null?void 0:a.value)??"";for(let W=f.startCol;W<=f.endCol;W++)for(let Y=f.startRow;Y<=f.endRow;Y++)W===f.startCol&&Y===f.startRow||e.clearCellsInRange(W,W,Y,Y);const A=(h=e.cells[y])!=null&&h.style?{...e.cells[y].style}:{};A.textAlign="center",e.cells[y]={value:T,style:A},e.merges[y]={startCol:f.startCol,startRow:f.startRow,endCol:f.endCol,endRow:f.endRow},e.selectCell(f.startCol,f.startRow),(_=e.scheduleRender)==null||_.call(e),(E=e.emitModelData)==null||E.call(e)}function ne(){var y,T,A;const f=e.selection.value;if(!(!f||f.startCol===f.endCol)){n.saveUndo();for(let a=f.startRow;a<=f.endRow;a++){B(f.startCol,a,f.endCol,a);const h=e.cellKey(f.startCol,a);(y=e.cells[h])==null||y.value;for(let _=f.startCol+1;_<=f.endCol;_++)e.clearCellsInRange(_,_,a,a);e.merges[h]={startCol:f.startCol,startRow:a,endCol:f.endCol,endRow:a}}e.selectRange(f.startCol,f.startRow,f.endCol,f.endRow),(T=e.scheduleRender)==null||T.call(e),(A=e.emitModelData)==null||A.call(e)}}function p(){var T,A,a;const f=e.selection.value;if(!f||f.startCol===f.endCol&&f.startRow===f.endRow)return;n.saveUndo(),B(f.startCol,f.startRow,f.endCol,f.endRow);const y=e.cellKey(f.startCol,f.startRow);(T=e.cells[y])==null||T.value;for(let h=f.startCol;h<=f.endCol;h++)for(let _=f.startRow;_<=f.endRow;_++)h===f.startCol&&_===f.startRow||e.clearCellsInRange(h,h,_,_);e.merges[y]={startCol:f.startCol,startRow:f.startRow,endCol:f.endCol,endRow:f.endRow},e.selectCell(f.startCol,f.startRow),(A=e.scheduleRender)==null||A.call(e),(a=e.emitModelData)==null||a.call(e)}function V(){var y,T;const f=e.selection.value;f&&(n.saveUndo(),B(f.startCol,f.startRow,f.endCol,f.endRow),(y=e.scheduleRender)==null||y.call(e),(T=e.emitModelData)==null||T.call(e))}function P(){const f=e.selection.value;if(!f)return;const y=e.findMerge(f.startCol,f.startRow);y&&f.startCol===y.range.startCol&&f.startRow===y.range.startRow&&f.endCol===y.range.endCol&&f.endRow===y.range.endRow?V():le()}function oe(f){switch(f){case"mergeCenter":le();break;case"mergeAcross":ne();break;case"mergeCells":p();break;case"unmergeCells":V();break}}let Z=null,J=[];function q(f,y,T,A){var a;J=[];for(let h=T;h<=A;h++){const _=[];for(let E=f;E<=y;E++){const W=(a=e.cells[e.cellKey(E,h)])==null?void 0:a.style;_.push(W?{...W}:null)}J.push(_)}}function ue(f,y,T,A){const a=e.cellKey(f,y);if(vl(),T===""||T==null){e.formulaDeps.clear(a),A?e.cells[a]={value:"",style:{...A}}:e.delCell(a),e.formulaDeps.markDirty(a);return}e.cells[a]={value:T,style:A?{...A}:null},T.startsWith("=")?e.formulaDeps.set(a,El(T.slice(1),e.colCount,e.rowCount)):e.formulaDeps.clear(a),e.formulaDeps.markDirty(a)}function Fe(){const f=e.selection.value;if(!f)return;Z={...f},q(f.startCol,f.endCol,f.startRow,f.endRow);const y=[];for(let T=f.startRow;T<=f.endRow;T++){const A=[];for(let a=f.startCol;a<=f.endCol;a++)A.push(e.getCellRaw(a,T));y.push(A.join(" "))}yl(y.join(`
|
|
4
|
-
`))}function Oe(){const f=e.selection.value;if(f){if(f.startCol===0&&f.endCol===e.colCount-1){Z={...f},q(0,e.colCount-1,f.startRow,f.endRow);const
|
|
5
|
-
`))}else if(f.startRow===0&&f.endRow===e.rowCount-1){Z={...f},q(f.startCol,f.endCol,0,e.rowCount-1);const
|
|
6
|
-
`))}}}async function Je(){var h;let f;try{f=await navigator.clipboard.readText()}catch{return}if(!f&&f!=="")return;const y=f.split(/\r?\n/),T=e.activeCell.value,A=Z,a=A&&J.length>0;for(let _=0;_<y.length;_++){const E=y[_].split(" ");for(let W=0;W<E.length;W++){const Y=T.col+W,Me=T.row+_;if(Y<e.colCount&&Me<e.rowCount){let Ve=E[W];if(Ve.startsWith("=")&&A&&(Ve=xa(Ve,Y-(A.startCol+W),Me-(A.startRow+_),e.colCount,e.rowCount,Ue)),a&&_<J.length&&W<(((h=J[_])==null?void 0:h.length)??0)){const Ke=J[_][W]??null;ue(Y,Me,Ve,Ke),v(Y,Me)}else e.setCellValue(Y,Me,Ve)}}}}function Ge(){var f;if(n.saveUndo(),Fe(),e.selection.value){const y=e.selection.value;e.clearCellsInRange(y.startCol,y.endCol,y.startRow,y.endRow),(f=e.scheduleRender)==null||f.call(e)}}function je(){var f;if(e.selection.value){const y=e.selection.value;e.clearCellsInRange(y.startCol,y.endCol,y.startRow,y.endRow),(f=e.scheduleRender)==null||f.call(e)}}function se(){var h,_;const f=e.selection.value;if(!f)return;n.saveUndo();const y=f.startCol,T=f.startRow,A=f.endCol,a=f.endRow;if(T===a)if(A+1<e.colCount){const E=`${Ue(y)}${T+1}:${Ue(A)}${T+1}`;e.setCellValue(A+1,T,`=SUM(${E})`)}else{const E=`${Ue(y)}${T+1}:${Ue(A-1)}${T+1}`;e.setCellValue(A,T,`=SUM(${E})`)}else for(let E=y;E<=A;E++)if(a+1<e.rowCount){const W=`${Ue(E)}${T+1}:${Ue(E)}${a+1}`;e.setCellValue(E,a+1,`=SUM(${W})`)}else{const W=`${Ue(E)}${T+1}:${Ue(E)}${a}`;e.setCellValue(E,a,`=SUM(${W})`)}(h=e.scheduleRender)==null||h.call(e),(_=e.emitModelData)==null||_.call(e)}function de(){var h,_;const f=e.selection.value;if(!f)return;n.saveUndo();const y=f.startCol,T=f.startRow,A=f.endCol,a=f.endRow;if(T===a)if(A+1<e.colCount){const E=`${Ue(y)}${T+1}:${Ue(A)}${T+1}`;e.setCellValue(A+1,T,`=AVERAGE(${E})`)}else{const E=`${Ue(y)}${T+1}:${Ue(A-1)}${T+1}`;e.setCellValue(A,T,`=AVERAGE(${E})`)}else for(let E=y;E<=A;E++)if(a+1<e.rowCount){const W=`${Ue(E)}${T+1}:${Ue(E)}${a+1}`;e.setCellValue(E,a+1,`=AVERAGE(${W})`)}else{const W=`${Ue(E)}${T+1}:${Ue(E)}${a}`;e.setCellValue(E,a,`=AVERAGE(${W})`)}(h=e.scheduleRender)==null||h.call(e),(_=e.emitModelData)==null||_.call(e)}function Te(){var h,_;const f=e.selection.value;if(!f)return;n.saveUndo();const y=f.startCol,T=f.startRow,A=f.endCol,a=f.endRow;if(T===a)if(A+1<e.colCount){const E=`${Ue(y)}${T+1}:${Ue(A)}${T+1}`;e.setCellValue(A+1,T,`=COUNT(${E})`)}else{const E=`${Ue(y)}${T+1}:${Ue(A-1)}${T+1}`;e.setCellValue(A,T,`=COUNT(${E})`)}else for(let E=y;E<=A;E++)if(a+1<e.rowCount){const W=`${Ue(E)}${T+1}:${Ue(E)}${a+1}`;e.setCellValue(E,a+1,`=COUNT(${W})`)}else{const W=`${Ue(E)}${T+1}:${Ue(E)}${a}`;e.setCellValue(E,a,`=COUNT(${W})`)}(h=e.scheduleRender)==null||h.call(e),(_=e.emitModelData)==null||_.call(e)}const re=t.ref(!1);function i(f){re.value=f,f&&(n.textColorMenuOpen.value=!1,n.fillColorMenuOpen.value=!1,l.value=!1,n.fontSizeMenuOpen.value=!1,w.value=!1)}function m(){se(),re.value=!1}function fe(){de(),re.value=!1}function De(){Te(),re.value=!1}return{cachedBorder:o,borderMenuOpen:l,BORDER_COLOR:c,borderTypeToWidths:d,onBorderChange:k,setCellBorderSide:r,syncCellBorders:v,applyBorderToCell:u,applyCachedBorder:x,cellBorderWidth:S,mergeMenuOpen:w,onMergeMenuToggle:R,removeOverlappingMerges:B,mergeAndCenter:le,mergeAcross:ne,mergeCells:p,unmergeCells:V,onApplyMerge:P,onMergeChange:oe,copySourceRange:null,copySourceStyles:[],captureStyles:q,setCellWithStyle:ue,copyToClipboard:Fe,copyRowCol:Oe,pasteFromClipboard:Je,cutSelected:Ge,clearSelected:je,sumSelected:se,avgSelected:de,countSelected:Te,calcMenuOpen:re,onCalcMenuToggle:i,onCalcSum:m,onCalcAvg:fe,onCalcCount:De}}function Aa(e,n,o,l){const c={},d=l(n),r=l(o);return d!=null&&(c.width=`${d}px`),r!=null&&(c.height=`${r}px`),c["--sp-formula-bar-bg"]=e.formulaBarBg,c["--sp-formula-bar-border"]=e.formulaBarBorder,c["--sp-formula-bar-label-color"]=e.formulaBarLabelText,c["--sp-formula-bar-label-bg"]=e.formulaBarLabelBg,c["--sp-formula-bar-label-border"]=e.formulaBarLabelBorder,c["--sp-formula-bar-input-bg"]=e.formulaBarInputBg,c["--sp-formula-bar-input-border"]=e.formulaBarInputBorder,c["--sp-formula-bar-input-color"]=e.formulaBarInputText,c["--sp-formula-bar-input-focus-border"]=e.formulaBarInputFocusBorder,c["--sp-formula-bar-input-focus-shadow"]=e.formulaBarInputFocusShadow,c["--sp-wrapper-bg"]=e.wrapperBg,c["--sp-cell-editor-border"]=e.cellEditorBorder,c["--sp-cell-editor-color"]=e.cellEditorText,c["--sp-cell-editor-bg"]=e.cellEditorBg,c["--sp-cell-editor-shadow"]=e.cellEditorShadow,c["--sp-tab-bar-bg"]=e.tabBarBg,c["--sp-tab-bar-border"]=e.tabBarBorder,c["--sp-tab-active-bg"]=e.tabActiveBg,c["--sp-tab-active-color"]=e.tabActiveText,c["--sp-tab-active-border"]=e.tabActiveBorder,c["--sp-tab-inactive-bg"]=e.tabInactiveBg,c["--sp-tab-inactive-color"]=e.tabInactiveText,c["--sp-tab-inactive-border"]=e.tabInactiveBorder,c["--sp-tab-hover-bg"]=e.tabHoverBg,c["--sp-tab-add-btn-color"]=e.tabAddBtnColor,c["--sp-tab-add-btn-hover-bg"]=e.tabAddBtnHoverBg,c["--sp-tab-scroll-btn-color"]=e.tabScrollBtnColor,c["--sp-tab-scroll-btn-hover-bg"]=e.tabScrollBtnHoverBg,c["--sp-scroll-thumb"]=e.scrollbarThumb,c["--sp-scroll-thumb-hover"]=e.scrollbarThumbHover,c["--sp-scroll-btn-bg"]=e.scrollBtnBg,c["--sp-scroll-btn-color"]=e.scrollBtnColor,c["--sp-scroll-btn-hover-bg"]=e.scrollBtnHoverBg,c["--sp-scroll-btn-active-bg"]=e.scrollBtnActiveBg,c["--sp-scroll-track-bg"]=e.scrollTrackBg,c["--sp-toolbar-bg"]=e.toolbarBg,c["--sp-toolbar-border"]=e.toolbarBorder,c["--sp-toolbar-btn-color"]=e.toolbarBtnColor,c["--sp-toolbar-btn-hover-bg"]=e.toolbarBtnHoverBg,c["--sp-toolbar-btn-disabled-color"]=e.toolbarBtnDisabledColor,c["--sp-toolbar-btn-active-color"]=e.toolbarBtnActiveColor,c}function Ha(e,n,o,l,c){function d(M,D){var ee,ae;const G=D-M+1,ce=x(M,D);for(let X=M;X<=D;X++)for(let U=0;U<e.colCount;U++)e.delCell(e.cellKey(U,X));for(let X=M;X<e.rowCount-G;X++){for(let U=0;U<e.colCount;U++){const ye=e.cellKey(U,X+G),Ee=e.cellKey(U,X);e.cells[ye]?(e.cells[Ee]=e.cells[ye],e.delCell(ye)):e.delCell(Ee)}e.rowHeights.value[X]=e.rowHeights.value[X+G]}for(let X=e.rowCount-G;X<e.rowCount;X++){for(let U=0;U<e.colCount;U++)e.delCell(e.cellKey(U,X));e.rowHeights.value[X]=void 0}if(k(ce),M>0)for(let X=0;X<e.colCount;X++)(ee=e.syncCellBorders)==null||ee.call(e,X,M-1),(ae=e.syncCellBorders)==null||ae.call(e,X,M)}function r(M,D){const G=D-M+1;if(D>=e.rowCount-1)return;const ce=w(M,D);for(let ee=e.rowCount-1;ee>D;ee--){for(let ae=0;ae<e.colCount;ae++){const X=e.cellKey(ae,ee-G),U=e.cellKey(ae,ee);e.cells[X]?e.cells[U]=e.cells[X]:e.delCell(U)}e.rowHeights.value[ee]=e.rowHeights.value[ee-G]}for(let ee=D+1;ee<=D+G;ee++){for(let ae=0;ae<e.colCount;ae++)e.delCell(e.cellKey(ae,ee));e.rowHeights.value[ee]=void 0}k(ce)}function v(M,D){const G=D-M+1;if(D>=e.colCount-1)return;const ce=R(M,D);for(let ee=e.colCount-1;ee>D;ee--){for(let ae=0;ae<e.rowCount;ae++){const X=e.cellKey(ee-G,ae),U=e.cellKey(ee,ae);e.cells[X]?e.cells[U]=e.cells[X]:e.delCell(U)}e.colWidths.value[ee]=e.colWidths.value[ee-G]}for(let ee=D+1;ee<=D+G;ee++){for(let ae=0;ae<e.rowCount;ae++)e.delCell(e.cellKey(ee,ae));e.colWidths.value[ee]=100}k(ce)}function u(M,D){var ee,ae;const G=D-M+1,ce=S(M,D);for(let X=M;X<=D;X++)for(let U=0;U<e.rowCount;U++)e.delCell(e.cellKey(X,U));for(let X=M;X<e.colCount-G;X++){for(let U=0;U<e.rowCount;U++){const ye=e.cellKey(X+G,U),Ee=e.cellKey(X,U);e.cells[ye]?(e.cells[Ee]=e.cells[ye],e.delCell(ye)):e.delCell(Ee)}e.colWidths.value[X]=e.colWidths.value[X+G]}for(let X=e.colCount-G;X<e.colCount;X++){for(let U=0;U<e.rowCount;U++)e.delCell(e.cellKey(X,U));e.colWidths.value[X]=100}if(k(ce),M>0)for(let X=0;X<e.rowCount;X++)(ee=e.syncCellBorders)==null||ee.call(e,M-1,X),(ae=e.syncCellBorders)==null||ae.call(e,M,X)}function k(M){Object.keys(e.merges).forEach(D=>Reflect.deleteProperty(e.merges,D));for(const D of M)if(!(D.newRange.startCol>D.newRange.endCol||D.newRange.startRow>D.newRange.endRow)&&(e.merges[D.newAnchorKey]={...D.newRange},D.anchorCell)){const G=D.anchorCell.value,ce=D.anchorCell.style;G===""&&(!ce||Object.keys(ce).length===0)||(e.cells[D.newAnchorKey]={value:G,style:ce&&Object.keys(ce).length?{...ce}:null})}}function x(M,D){const G=D-M+1,ce=[];for(const ee in e.merges){const ae=e.merges[ee];if(!ae)continue;const X=e.cells[ee]?{value:e.cells[ee].value,style:e.cells[ee].style?{...e.cells[ee].style}:null}:{value:"",style:null},{startCol:U,endCol:ye}=ae;let{startRow:Ee,endRow:Ze}=ae;if(Ee>D){Ee-=G,Ze-=G,ce.push({newAnchorKey:e.cellKey(U,Ee),newRange:{startCol:U,startRow:Ee,endCol:ye,endRow:Ze}});continue}if(Ze<M){ce.push({newAnchorKey:ee,newRange:{startCol:U,startRow:Ee,endCol:ye,endRow:Ze}});continue}if(Ee>=M&&Ze<=D||(Ee>=M&&Ee<=D&&(Ee=M),Ze>=M&&Ze<=D?Ze=M-1:Ze>D&&(Ze-=G),Ee>Ze))continue;const Pe=U,H=Ee,O=e.cellKey(Pe,H),Q=ee.split(",").map(Number)[1],ie=Q>=M&&Q<=D||Pe!==ae.startCol||H!==Q;ce.push({newAnchorKey:O,newRange:{startCol:U,startRow:Ee,endCol:ye,endRow:Ze},anchorCell:ie?X:void 0})}return ce}function S(M,D){const G=D-M+1,ce=[];for(const ee in e.merges){const ae=e.merges[ee];if(!ae)continue;const X=e.cells[ee]?{value:e.cells[ee].value,style:e.cells[ee].style?{...e.cells[ee].style}:null}:{value:"",style:null};let{startCol:U,endCol:ye}=ae;const{startRow:Ee,endRow:Ze}=ae;if(U>D){U-=G,ye-=G,ce.push({newAnchorKey:e.cellKey(U,Ee),newRange:{startCol:U,startRow:Ee,endCol:ye,endRow:Ze}});continue}if(ye<M){ce.push({newAnchorKey:ee,newRange:{startCol:U,startRow:Ee,endCol:ye,endRow:Ze}});continue}if(U>=M&&ye<=D||(U>=M&&U<=D&&(U=M),ye>=M&&ye<=D?ye=M-1:ye>D&&(ye-=G),U>ye))continue;const Pe=U,H=Ee,O=e.cellKey(Pe,H),Q=ee.split(",").map(Number)[0],ie=Q>=M&&Q<=D||Pe!==Q||H!==ae.startRow;ce.push({newAnchorKey:O,newRange:{startCol:U,startRow:Ee,endCol:ye,endRow:Ze},anchorCell:ie?X:void 0})}return ce}function w(M,D){const G=D-M+1,ce=[];for(const ee in e.merges){const ae=e.merges[ee];if(!ae)continue;const{startCol:X,endCol:U}=ae;let{startRow:ye,endRow:Ee}=ae;Ee<M?ce.push({newAnchorKey:ee,newRange:{startCol:X,startRow:ye,endCol:U,endRow:Ee}}):ye>D?(ye+=G,Ee+=G,ce.push({newAnchorKey:e.cellKey(X,ye),newRange:{startCol:X,startRow:ye,endCol:U,endRow:Ee}})):(Ee+=G,ce.push({newAnchorKey:ee,newRange:{startCol:X,startRow:ye,endCol:U,endRow:Ee}}))}return ce}function R(M,D){const G=D-M+1,ce=[];for(const ee in e.merges){const ae=e.merges[ee];if(!ae)continue;let{startCol:X,endCol:U}=ae;const{startRow:ye,endRow:Ee}=ae;U<M?ce.push({newAnchorKey:ee,newRange:{startCol:X,startRow:ye,endCol:U,endRow:Ee}}):X>D?(X+=G,U+=G,ce.push({newAnchorKey:e.cellKey(X,ye),newRange:{startCol:X,startRow:ye,endCol:U,endRow:Ee}})):(U+=G,ce.push({newAnchorKey:ee,newRange:{startCol:X,startRow:ye,endCol:U,endRow:Ee}}))}return ce}let B=0;function le(){return B++,`s_${B}`}function ne(M){return{id:le(),name:M,cells:{},merges:{},selection:{startCol:0,startRow:0,endCol:0,endRow:0},activeCell:{col:0,row:0},scrollX:0,scrollY:0,colWidths:new Array(e.colCount).fill(100),rowHeights:new Array(e.rowCount).fill(void 0)}}const p=t.ref([ne("Sheet1")]),V=t.ref(0);function P(){const M=p.value[V.value];M&&(M.cells={...e.cells},M.merges={...e.merges},M.selection=e.selection.value?{...e.selection.value}:null,M.activeCell={...e.activeCell.value},M.scrollX=e.scrollX.value,M.scrollY=e.scrollY.value,M.colWidths=[...e.colWidths.value],M.rowHeights=[...e.rowHeights.value])}function oe(M){const D=p.value[M];D&&(Object.keys(e.cells).forEach(G=>e.delCell(G)),Object.assign(e.cells,D.cells),Object.keys(e.merges).forEach(G=>Reflect.deleteProperty(e.merges,G)),D.merges&&Object.assign(e.merges,D.merges),e.selection.value=D.selection?{...D.selection}:null,e.activeCell.value={...D.activeCell},e.scrollX.value=D.scrollX,e.scrollY.value=D.scrollY,e.colWidths.value=[...D.colWidths],e.rowHeights.value=[...D.rowHeights],V.value=M)}function Z(M){M===V.value||M<0||M>=p.value.length||(e.cancelEdit(),P(),oe(M))}function J(M){return n.saveUndo(),e.cancelEdit(),P(),p.value.push(ne(M??`Sheet${p.value.length+1}`)),oe(p.value.length-1),p.value.length-1}function q(M){return p.value.length<=1||(n.saveUndo(),e.cancelEdit(),p.value.splice(M,1),oe(Math.min(M,p.value.length-1))),V.value}function ue(M,D){p.value[M]&&D.trim()&&(n.saveUndo(),p.value[M].name=D.trim())}function Fe(M){n.saveUndo(),e.cancelEdit(),P();const D=p.value[M];if(!D)return M;let G=D.name;const ce=G.match(/^(.*?)\s*\((\d+)\)$/);let ee=ce?parseInt(ce[2],10)+1:2;ce&&(G=ce[1]);let ae=`${G} (${ee})`;const X=new Set(p.value.map(ye=>ye.name));for(;X.has(ae);)ee++,ae=`${G} (${ee})`;const U={id:le(),name:ae,cells:{...D.cells},merges:D.merges?{...D.merges}:{},selection:D.selection?{...D.selection}:null,activeCell:D.activeCell?{...D.activeCell}:{col:0,row:0},scrollX:D.scrollX,scrollY:D.scrollY,colWidths:[...D.colWidths],rowHeights:[...D.rowHeights]};return p.value.splice(M+1,0,U),oe(M+1),M+1}function Oe(M,D){var ae;const G=M+D;if(G<0||G>=p.value.length)return;n.saveUndo();const ce=V.value,ee=p.value.splice(M,1)[0];p.value.splice(G,0,ee),ce===M?V.value=G:M<ce&&G>=ce?V.value=ce-1:M>ce&&G<=ce&&(V.value=ce+1),(ae=e.scheduleRender)==null||ae.call(e)}const Je=t.computed(()=>p.value.length);let Ge="";const je=o;function se(){P();const M=p.value.map(G=>{const ce={};for(const[U,ye]of Object.entries(G.cells))ce[U]={value:ye.value},ye.style&&(ce[U].style=ye.style);const ee={name:G.name,cells:ce};G.merges&&Object.keys(G.merges).length&&(ee.merges={...G.merges});const ae={};for(let U=0;U<G.colWidths.length;U++)G.colWidths[U]!==100&&(ae[U]=G.colWidths[U]);Object.keys(ae).length&&(ee.colWidths=ae);const X={};for(let U=0;U<G.rowHeights.length;U++){const ye=G.rowHeights[U];ye!=null&&(X[U]=ye)}return Object.keys(X).length&&(ee.rowHeights=X),ee}),D=JSON.stringify(M);D!==Ge&&(Ge=D,je.value=M,c&&(c.value=D))}e.emitModelData=se;let de=!1;function Te(){de||(de=!0,Promise.resolve().then(()=>{de=!1,se()}))}const re=t.computed(()=>e.props.theme==="dark"?Eo:ko),i=t.computed(()=>Aa(re.value,e.props.width,e.props.height,Vt)),m=t.computed(()=>{const M={};for(const[D,G]of Object.entries(i.value))D.startsWith("--")&&(M[D]=G);return M}),fe=t.ref(null),De=t.ref(null),f=t.ref(null),y=t.ref(null),T=t.reactive({w:800,h:600});e.viewSize&&t.watch(T,M=>{e.viewSize&&(e.viewSize.w=M.w,e.viewSize.h=M.h)},{deep:!0});const A=48,a=28,h=11,_=t.computed(()=>Math.max(0,e.totalWidth.value-Math.max(0,T.w-A-h))),E=t.computed(()=>Math.max(0,e.totalHeight.value-Math.max(0,T.h-a-h)));function W(M,D){const G=Math.max(0,T.w-A-h),ce=Math.max(0,T.h-a-h);e.scrollX.value=Math.max(0,Math.min(M??e.scrollX.value,Math.max(0,e.totalWidth.value-G))),e.scrollY.value=Math.max(0,Math.min(D??e.scrollY.value,Math.max(0,e.totalHeight.value-ce)))}e.clampScroll=W;function Y(){var M;return typeof window>"u"?!1:!((M=window.matchMedia)!=null&&M.call(window,"(hover: none) and (pointer: coarse)").matches)}function Me(M=!1){t.nextTick(()=>{const D=f.value;if(D){if(!e.editingCell.value&&!Y()){document.activeElement===D&&D.blur();return}D.focus({preventScroll:!0}),M&&D.select()}})}function Ve(){Me()}function Ke(){var D;const M=e.selection.value;if(M){n.saveUndo();for(let G=M.startRow;G<=M.endRow;G++)e.rowHeights.value[G]=void 0;(D=e.scheduleRender)==null||D.call(e),se()}}function Be(){var D;const M=e.selection.value;if(M){n.saveUndo();for(let G=M.startCol;G<=M.endCol;G++)e.colWidths.value[G]=100;(D=e.scheduleRender)==null||D.call(e),se()}}return{deleteRows:d,insertRows:r,insertCols:v,deleteCols:u,sheets:p,activeSheetIndex:V,saveSheet:P,loadSheet:oe,switchSheet:Z,addSheet:J,removeSheet:q,renameSheet:ue,dupSheet:Fe,moveSheet:Oe,sheetCount:Je,mkSheet:ne,emitModelData:se,scheduleOptEmit:Te,themeColors:re,outerStyle:i,toolbarThemeVars:m,wrapperRef:fe,canvasRef:De,editInputRef:f,formulaBarRef:y,viewSize:T,maxScrollX:_,maxScrollY:E,clampScroll:W,canFocusHiddenEditor:Y,focusEditInput:Me,onCanvasFocus:Ve,resetRowHeight:Ke,resetColWidth:Be,modelData:je}}function Va(e,n,o,l,c){let d=!1,r=null,v=1;function u(){d||(d=!0,requestAnimationFrame(()=>{d=!1,x()}))}e.scheduleRender=u;const k="#444";function x(){var Tl,$t,Qt,Mt,Nt,el,lo,oo,no,ro,ao;const s=l.canvasRef.value;if(!s)return;const g=l.wrapperRef.value;if(!g||(r=s.getContext("2d"),!r))return;v=window.devicePixelRatio||1;const $=g.getBoundingClientRect(),z=$.width,C=$.height;l.viewSize.w=z,l.viewSize.h=C,s.width=z*v,s.height=C*v,s.style.width=z+"px",s.style.height=C+"px",r.setTransform(v,0,0,v,0,0);const L=e.scrollX.value,pe=e.scrollY.value,ve=52,he=24,He=l.themeColors.value,ct=e.colPositions.value,ot=e.rowPositions.value,ht=e.colWidths.value,pt=[];for(let j=0;j<e.rowCount;j++)pt[j]=ot[j+1]-ot[j];const Bt=Math.max(0,e.hitCol(L));let Ut=Bt;for(let j=Bt;j<e.colCount&&!(ve+ct[j]-L>=z);j++)Ut=j;const xt=Ut,wt=Math.max(0,e.hitRow(pe));let cl=wt;for(let j=wt;j<e.rowCount&&!(he+ot[j]-pe>=C);j++)cl=j;const bt=cl;let Lt=Bt,It=wt;for(const j in e.merges){const te=e.merges[j];te&&(te.startRow>bt||te.endRow<wt||te.startCol>xt||te.endCol<Bt||(te.startCol<Lt&&(Lt=te.startCol),te.startRow<It&&(It=te.startRow)))}r.fillStyle=He.bg,r.fillRect(0,0,z,C),r.fillStyle=He.gridBg,r.fillRect(ve,he,z-ve,C-he),r.save(),r.beginPath(),r.rect(ve,he,z-ve,C-he),r.clip();const ft=e.selection.value,Jt=e.editingCell.value;for(let j=It;j<=bt;j++)for(let te=Lt;te<=xt;te++){const xe=e.findMerge(te,j);if(xe&&!(te===xe.range.startCol&&j===xe.range.startRow))continue;const Ie=ve+ct[te]-L,$e=he+ot[j]-pe;let Ye=ht[te],Xe=pt[j];if(xe&&(Ye=ct[xe.range.endCol+1]-ct[te],Xe=ot[xe.range.endRow+1]-ot[j]),Ie+Ye<ve||$e+Xe<he||Ie>z||$e>C)continue;const nt=e.findHighlight?e.findHighlight(te,j):null,yt=(Tl=e.cells[e.cellKey(te,j)])==null?void 0:Tl.style,St=typeof(yt==null?void 0:yt.backgroundColor)=="string"?yt.backgroundColor:"";if(St&&(r.fillStyle=St,r.fillRect(Ie,$e,Ye,Xe)),nt&&(r.fillStyle=nt==="active"?He.findActiveBg:He.findMatchBg,r.fillRect(Ie,$e,Ye,Xe)),e.isSelected(te,j)&&(r.fillStyle=He.selectionBg,e.selectionMode.value==="row"||e.selectionMode.value==="col"?r.fillRect(Ie,$e,ht[te],pt[j]):r.fillRect(Ie,$e,Ye,Xe)),e.activeCell.value.col===te&&e.activeCell.value.row===j&&(r.strokeStyle=He.activeCellBorder,r.lineWidth=2,r.strokeRect(Ie+1,$e+1,Ye-2,Xe-2)),nt==="active"&&(r.strokeStyle=He.findActiveBg,r.lineWidth=2,r.strokeRect(Ie+1,$e+1,Ye-2,Xe-2)),r.strokeStyle=He.gridLine,r.lineWidth=.5,r.strokeRect(Ie+.25,$e+.25,Ye-.5,Xe-.5),!(Jt&&Jt.col===te&&Jt.row===j)){const Re=($t=e.cells[e.cellKey(te,j)])==null?void 0:$t.style,at=e.getCellValue(te,j),qe=typeof(Re==null?void 0:Re.numberFormat)=="string"?Re.numberFormat:"",et=at?hl(at,qe,e.locale.value):"";if(et){const tt=e.cellFontSize(te,j),ut=typeof(Re==null?void 0:Re.fontFamily)=="string"&&Re.fontFamily?Re.fontFamily:Pt,_e=(Re==null?void 0:Re.fontWeight)==="bold"?"bold":"normal",mt=(Re==null?void 0:Re.fontStyle)==="italic"?"italic":"normal",Ct=(Re==null?void 0:Re.underline)==="underline",st=(Re==null?void 0:Re.strikethrough)==="line-through",zt=typeof(Re==null?void 0:Re.color)=="string"?Re.color:"",tl=typeof(Re==null?void 0:Re.textAlign)=="string"?Re.textAlign:_l(at,qe)?"right":"left",ll=typeof(Re==null?void 0:Re.verticalAlign)=="string"?Re.verticalAlign:"top";r.fillStyle=zt||He.cellText,r.font=`${mt} ${_e} ${tt}px ${ut}`,r.textBaseline="alphabetic",r.save(),r.beginPath(),r.rect(Ie+5,$e+1,Ye-10,Xe-2),r.clip();const io=(Re==null?void 0:Re.wrap)==="wrap",sl=Ye-10;let Dl=et;const yi=!io&&$o(qe),co=et===gl||zo(at,qe);if(co||yi){if(co){const Wt=Math.max(1,r.measureText("#").width),ol=Math.max(1,Math.floor(sl/Wt));Dl="#".repeat(ol)}else if(e.getWrappedLines(r,et,1e9,!1).some(Tt=>Tt&&r.measureText(Tt).width>sl)){const Tt=Math.max(1,r.measureText("#").width),Gt=Math.max(1,Math.floor(sl/Tt));Dl="#".repeat(Gt)}}const dl=e.getWrappedLines(r,Dl,sl,io),{ascent:ul,descent:fl}=e.measureFontMetrics(ut,tt,_e,mt),ml=ul+fl,vi=dl.length*ml;let pl;ll==="middle"?pl=$e+(Xe-vi)/2+ul:ll==="bottom"?pl=$e+Xe-e.BASE_CELL_VPAD-fl-(dl.length-1)*ml:pl=$e+e.BASE_CELL_VPAD+ul;for(let Wt=0;Wt<dl.length;Wt++){const ol=dl[Wt],Tt=pl+Wt*ml,Gt=r.measureText(ol);let At;if(tl==="center"?At=Ie+Ye/2-Gt.width/2:tl==="right"?At=Ie+Ye-5-Gt.width:At=Ie+5,r.fillText(ol,At,Tt),Ct&&(r.strokeStyle=zt||He.cellText,r.lineWidth=1,r.beginPath(),r.moveTo(At,Tt+fl+1),r.lineTo(At+Gt.width,Tt+fl+1),r.stroke()),st){r.strokeStyle=zt||He.cellText,r.lineWidth=1;const so=Tt-ul+ml*.42;r.beginPath(),r.moveTo(At,so),r.lineTo(At+Gt.width,so),r.stroke()}}r.restore()}}}for(let j=It;j<=bt;j++)for(let te=Lt;te<=xt;te++){const xe=e.findMerge(te,j);if(xe&&!(te===xe.range.startCol&&j===xe.range.startRow))continue;const Ie=ve+ct[te]-L,$e=he+ot[j]-pe;let Ye=ht[te],Xe=pt[j];if(xe&&(Ye=ct[xe.range.endCol+1]-ct[te],Xe=ot[xe.range.endRow+1]-ot[j]),Ie+Ye<ve||$e+Xe<he||Ie>z||$e>C)continue;const nt=(Qt=e.cells[e.cellKey(te,j)])==null?void 0:Qt.style,yt=(nt==null?void 0:nt.borderTopWidth)||0,St=(nt==null?void 0:nt.borderLeftWidth)||0,Re=(nt==null?void 0:nt.borderBottomWidth)||0,at=(nt==null?void 0:nt.borderRightWidth)||0;if(r.fillStyle=k,xe){const qe=xe.range.startRow,et=xe.range.endRow,tt=xe.range.startCol,ut=xe.range.endCol;for(let _e=tt;_e<=ut;_e++){const mt=ve+ct[_e]-L,Ct=ht[_e],st=Math.max(yt,o.cellBorderWidth(_e,qe-1,"Bottom"));st>0&&r.fillRect(mt,$e,Ct,st)}for(let _e=tt;_e<=ut;_e++){const mt=ve+ct[_e]-L,Ct=ht[_e],st=Math.max(Re,o.cellBorderWidth(_e,et+1,"Top"));st>0&&r.fillRect(mt,$e+Xe-st,Ct,st)}for(let _e=qe;_e<=et;_e++){const mt=he+ot[_e]-pe,Ct=pt[_e],st=Math.max(St,o.cellBorderWidth(tt-1,_e,"Right"));st>0&&r.fillRect(Ie,mt,st,Ct)}for(let _e=qe;_e<=et;_e++){const mt=he+ot[_e]-pe,Ct=pt[_e],st=Math.max(at,o.cellBorderWidth(ut+1,_e,"Left"));st>0&&r.fillRect(Ie+Ye-st,mt,st,Ct)}}else{const qe=Math.max(yt,o.cellBorderWidth(te,j-1,"Bottom")),et=Math.max(St,o.cellBorderWidth(te-1,j,"Right")),tt=Math.max(Re,o.cellBorderWidth(te,j+1,"Top")),ut=Math.max(at,o.cellBorderWidth(te+1,j,"Left"));(qe>0||et>0||tt>0||ut>0)&&(qe>0&&r.fillRect(Ie,$e,Ye,qe),tt>0&&r.fillRect(Ie,$e+Xe-tt,Ye,tt),et>0&&r.fillRect(Ie,$e,et,Xe),ut>0&&r.fillRect(Ie+Ye-ut,$e,ut,Xe))}}for(let j=It;j<=bt;j++)for(let te=Lt;te<=xt;te++){const xe=e.findMerge(te,j);if(xe&&!(te===xe.range.startCol&&j===xe.range.startRow))continue;const Ie=ve+ct[te]-L,$e=he+ot[j]-pe;let Ye=ht[te],Xe=pt[j];if(xe&&(Ye=ct[xe.range.endCol+1]-ct[te],Xe=ot[xe.range.endRow+1]-ot[j]),Ie+Ye<ve||$e+Xe<he||Ie>z||$e>C)continue;const nt=((Nt=(Mt=e.cells[e.cellKey(te,j)])==null?void 0:Mt.style)==null?void 0:Nt.borderTopWidth)||0,yt=((lo=(el=e.cells[e.cellKey(te,j)])==null?void 0:el.style)==null?void 0:lo.borderLeftWidth)||0,St=((no=(oo=e.cells[e.cellKey(te,j)])==null?void 0:oo.style)==null?void 0:no.borderBottomWidth)||0,Re=((ao=(ro=e.cells[e.cellKey(te,j)])==null?void 0:ro.style)==null?void 0:ao.borderRightWidth)||0;if(r.fillStyle=k,xe){const at=xe.range.startRow,qe=xe.range.endRow,et=xe.range.startCol,tt=xe.range.endCol,ut=Math.max(nt,o.cellBorderWidth(et,at-1,"Bottom")),_e=Math.max(yt,o.cellBorderWidth(et-1,at,"Right"));ut>0&&_e>0&&r.fillRect(Ie-_e,$e-ut,_e,ut);const mt=Math.max(nt,o.cellBorderWidth(tt,at-1,"Bottom")),Ct=Math.max(Re,o.cellBorderWidth(tt+1,at,"Left"));mt>0&&Ct>0&&r.fillRect(Ie+Ye,$e-mt,Ct,mt);const st=Math.max(St,o.cellBorderWidth(et,qe+1,"Top")),zt=Math.max(yt,o.cellBorderWidth(et-1,qe,"Right"));st>0&&zt>0&&r.fillRect(Ie-zt,$e+Xe,zt,st);const tl=Math.max(St,o.cellBorderWidth(tt,qe+1,"Top")),ll=Math.max(Re,o.cellBorderWidth(tt+1,qe,"Left"));tl>0&&ll>0&&r.fillRect(Ie+Ye,$e+Xe,ll,tl)}else{const at=Math.max(nt,o.cellBorderWidth(te,j-1,"Bottom")),qe=Math.max(yt,o.cellBorderWidth(te-1,j,"Right")),et=Math.max(St,o.cellBorderWidth(te,j+1,"Top")),tt=Math.max(Re,o.cellBorderWidth(te+1,j,"Left"));at>0&&qe>0&&r.fillRect(Ie-qe,$e-at,qe,at),at>0&&tt>0&&r.fillRect(Ie+Ye,$e-at,tt,at),et>0&&qe>0&&r.fillRect(Ie-qe,$e+Xe,qe,et),et>0&&tt>0&&r.fillRect(Ie+Ye,$e+Xe,tt,et)}}r.restore(),r.fillStyle=He.headerBg,r.fillRect(ve,0,z-ve,he);for(let j=Bt;j<=xt;j++){const te=ve+ct[j]-L,xe=ht[j];te+xe<ve||te>z||(ft&&j>=ft.startCol&&j<=ft.endCol&&(r.fillStyle=He.selectionBg,r.fillRect(te,0,xe,he)),r.strokeStyle=He.headerBorder,r.lineWidth=.5,r.strokeRect(te+.25,.25,xe-.5,he-.5),ft&&j>=ft.startCol&&j<=ft.endCol&&(r.strokeStyle=He.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(te,he-1),r.lineTo(te+xe,he-1),r.stroke()),r.fillStyle=He.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(Ue(j),te+xe/2,he/2))}r.strokeStyle=He.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(ve,he+.5),r.lineTo(z,he+.5),r.stroke(),r.fillStyle=He.headerBg,r.fillRect(0,he,ve,C-he);for(let j=wt;j<=bt;j++){const te=he+ot[j]-pe,xe=pt[j];te+xe<he||te>C||(ft&&j>=ft.startRow&&j<=ft.endRow&&(r.fillStyle=He.selectionBg,r.fillRect(0,te,ve,xe)),r.strokeStyle=He.headerBorder,r.lineWidth=.5,r.strokeRect(.25,te+.25,ve-.5,xe-.5),ft&&j>=ft.startRow&&j<=ft.endRow&&(r.strokeStyle=He.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(ve-1,te),r.lineTo(ve-1,te+xe),r.stroke()),r.fillStyle=He.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(String(j+1),ve/2,te+xe/2+.5))}r.strokeStyle=He.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(ve+.5,he),r.lineTo(ve+.5,C),r.stroke(),r.fillStyle=He.headerBg,r.fillRect(0,0,ve,he),r.strokeStyle=He.headerSep,r.lineWidth=1,r.strokeRect(.5,.5,ve-.5,he-.5)}const S=t.computed(()=>Ue(e.activeCell.value.col)+String(e.activeCell.value.row+1)),w=t.ref(""),R=t.ref(!1),B=t.computed(()=>e.editingCell.value?w.value:e.getCellRaw(e.activeCell.value.col,e.activeCell.value.row));t.watch(()=>e.editingCell.value,(s,g)=>{if(s&&!g){const $=e.editValue.value||e.getCellRaw(s.col,s.row)||"";w.value=$,V=!1}else!s&&g&&(w.value="",R.value=!1,V=!1)},{immediate:!0}),t.watch(()=>[e.activeCell.value.col,e.activeCell.value.row],()=>{e.editingCell.value||(w.value="",V=!1)});function le(){e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),u())}function ne(s){const g=s.target.value;w.value=g,V=!0,e.editingCell.value||e.startEdit()}let p=!1,V=!1;function P(){var L,pe,ve,he,He,ct,ot,ht,pt;if(p)return;const s=l.formulaBarRef.value,g=!!(s&&typeof document<"u"&&document.activeElement===s);if(!e.editingCell.value&&!g&&!V)return;const $={...e.activeCell.value},z=e.editingCell.value?e.editingCell.value.col:$.col,C=e.editingCell.value?e.editingCell.value.row:$.row;if(!e.editingCell.value){const Bt=e.getCellRaw(z,C),Ut=w.value!==Bt;if(!V)return;p=!0,Ut&&((L=e.saveUndo)==null||L.call(e),e.setCellValue(z,C,w.value),u(),(pe=l.emitModelData)==null||pe.call(l)),(ve=l.formulaBarRef.value)==null||ve.blur(),w.value="",R.value=!1,V=!1,t.nextTick(()=>{p=!1});return}p=!0,V?(e.editValue.value=w.value,e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),(he=l.formulaBarRef.value)==null||he.blur(),w.value="",R.value=!1,V=!1,u(),l.focusEditInput(),(He=l.emitModelData)==null||He.call(l),t.nextTick(()=>{p=!1})):g?(w.value=e.editValue.value,e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),(ct=l.formulaBarRef.value)==null||ct.blur(),w.value="",R.value=!1,V=!1,u(),l.focusEditInput(),(ot=l.emitModelData)==null||ot.call(l),t.nextTick(()=>{p=!1})):(e.commitEdit(),(ht=l.formulaBarRef.value)==null||ht.blur(),w.value="",R.value=!1,V=!1,u(),l.focusEditInput(),(pt=l.emitModelData)==null||pt.call(l),t.nextTick(()=>{p=!1}))}function oe(){var s;p||(p=!0,e.editingCell.value&&e.cancelEdit(),(s=l.formulaBarRef.value)==null||s.blur(),w.value="",R.value=!1,V=!1,u(),l.focusEditInput(),t.nextTick(()=>{p=!1}))}function Z(s){if(!s.isComposing){if(s.key==="Enter"&&(s.altKey||s.metaKey)&&!s.ctrlKey){s.preventDefault(),s.stopPropagation();const g=s.target;if(!g)return;e.editingCell.value||e.startEdit();const $=g.selectionStart??g.value.length,z=g.selectionEnd??g.value.length,C=g.value,L=C.substring(0,$)+`
|
|
7
|
-
`+
|
|
8
|
-
`).length:1)*Jt,Qt=e.BASE_CELL_VPAD-Lt;let Mt=0,Nt=0;return xt==="middle"?(Mt=Math.floor((bt-$t)/2),Nt=Math.max(0,bt-$t-Mt)):xt==="top"?(Mt=Qt,Nt=Math.max(0,bt-$t-Mt)):xt==="bottom"&&(Nt=Qt,Mt=Math.max(0,bt-$t-Nt)),{left:`${52+e.colPositions.value[$]-e.scrollX.value}px`,top:`${24+e.rowPositions.value[z]-e.scrollY.value}px`,width:`${cl}px`,height:`${bt}px`,fontFamily:pe,fontSize:`${L}px`,lineHeight:1,fontWeight:ve,fontStyle:he,textDecoration:ct,textAlign:Ut,paddingTop:`${Mt}px`,paddingRight:"3px",paddingBottom:`${Nt}px`,paddingLeft:"3px",opacity:s?0:1,pointerEvents:s?"none":"auto",color:s?"transparent":ot,caretColor:s?"transparent":void 0,borderColor:s?"transparent":void 0,background:s?"transparent":ht,boxShadow:s?"none":void 0}});function D(){return Math.max(0,l.viewSize.w-52-11)}function G(){return Math.max(0,l.viewSize.h-24-11)}const ce=t.computed(()=>D()),ee=t.computed(()=>G()),ae=t.computed(()=>Math.max(0,ce.value-11*2)),X=t.computed(()=>Math.max(0,ee.value-11*2)),U=t.computed(()=>l.maxScrollX.value<=0?ae.value:Math.max(24,D()/e.totalWidth.value*ae.value)),ye=t.computed(()=>l.maxScrollX.value<=0?0:e.scrollX.value/l.maxScrollX.value*(ae.value-U.value)),Ee=t.computed(()=>l.maxScrollY.value<=0?X.value:Math.max(24,G()/e.totalHeight.value*X.value)),Ze=t.computed(()=>l.maxScrollY.value<=0?0:e.scrollY.value/l.maxScrollY.value*(X.value-Ee.value));let Pe=null,H=0,O=0;function I(s){s.preventDefault(),Pe="v",H=s.clientY,O=e.scrollY.value,document.addEventListener("mousemove",ie),document.addEventListener("mouseup",ke)}function Q(s){s.preventDefault(),Pe="h",H=s.clientX,O=e.scrollX.value,document.addEventListener("mousemove",ie),document.addEventListener("mouseup",ke)}function ie(s){if(Pe==="v"){const $=(s.clientY-H)/(X.value-Ee.value);l.clampScroll(null,O+$*l.maxScrollY.value),u()}else if(Pe==="h"){const $=(s.clientX-H)/(ae.value-U.value);l.clampScroll(O+$*l.maxScrollX.value,null),u()}}function ke(){Pe=null,document.removeEventListener("mousemove",ie),document.removeEventListener("mouseup",ke)}function Ne(s){if(Pe)return;const g=s.currentTarget.getBoundingClientRect(),$=s.clientY-g.top;$<Ze.value?l.clampScroll(null,e.scrollY.value-G()):$>Ze.value+Ee.value&&l.clampScroll(null,e.scrollY.value+G()),u()}function ze(s){if(Pe)return;const g=s.currentTarget.getBoundingClientRect(),$=s.clientX-g.left;$<ye.value?l.clampScroll(e.scrollX.value-D(),null):$>ye.value+U.value&&l.clampScroll(e.scrollX.value+D(),null),u()}let Le=!1,We=0,Se=0,b=!1,F=!1,K=0,Ce=0,ge=0,me=0,be=0,we=0,Ae=0,lt=0,it=!1,dt=!1,Qe=0,rt=0,Rt="cell",Bl=0,Jl=-1,Ql=-1;function li(s){if(s.button!==0)return;s.preventDefault(),se.value=null;const g=Ft(s,l.canvasRef.value);if(g.y<24&&g.x>=52){const C=g.x-52+e.scrollX.value,L=e.hitCol(C);if(L>=0&&Math.abs(g.x-(52+e.colPositions.value[L+1]-e.scrollX.value))<=4){n.saveUndo(),b=!0,K=L,ge=e.colWidths.value[L],me=C,u();return}}if(g.x<52&&g.y>=24){const C=g.y-24+e.scrollY.value,L=e.hitRow(C);if(L>=0&&Math.abs(g.y-(24+e.rowPositions.value[L+1]-e.scrollY.value))<=4){n.saveUndo(),F=!0,Ce=L,ge=e.getRowHeight(L),me=C,u();return}}if(g.x<52||g.y<24){{const C=l.formulaBarRef.value,L=!!(C&&typeof document<"u"&&document.activeElement===C);(e.editingCell.value||L||V)&&P()}if(g.y<24&&g.x>=52){const C=e.hitCol(g.x-52+e.scrollX.value);C>=0&&(e.selectRange(C,0,C,e.rowCount-1,"col"),Le=!0,We=C,Se=0)}else if(g.x<52&&g.y>=24){const C=e.hitRow(g.y-24+e.scrollY.value);C>=0&&(e.selectRange(0,C,e.colCount-1,C,"row"),Le=!0,We=0,Se=C)}else g.x<52&&g.y<24&&e.selectAll();u();return}const $=e.hitCol(g.x-52+e.scrollX.value),z=e.hitRow(g.y-24+e.scrollY.value);if(!($<0||z<0)){{const C=l.formulaBarRef.value,L=!!(C&&typeof document<"u"&&document.activeElement===C);(e.editingCell.value||L||V)&&P()}if(s.shiftKey&&e.selection.value){const C=e.selection.value;e.selectRange(C.startCol,C.startRow,$,z)}else e.selectCell($,z);Le=!0,We=$,Se=z,l.focusEditInput(),u()}}function oi(s){if(b){const L=Ft(s,l.canvasRef.value).x-52+e.scrollX.value-me,pe=ge+L;pe>=30&&pe<=1e3?e.colWidths.value[K]=pe:pe<30?e.colWidths.value[K]=30:e.colWidths.value[K]=1e3,u();return}if(F){const L=Ft(s,l.canvasRef.value).y-24+e.scrollY.value-me,pe=ge+L;pe>=24&&pe<=500?e.rowHeights.value[Ce]=pe:pe<24?e.rowHeights.value[Ce]=24:e.rowHeights.value[Ce]=500,u();return}if(!Le){const C=l.canvasRef.value;if(!C)return;if(n.paintFmt.value){C.style.cursor="copy";return}const L=Ft(s,C);if(L.y<24&&L.x>=52){const pe=e.hitCol(L.x-52+e.scrollX.value);if(pe>=0&&Math.abs(L.x-(52+e.colPositions.value[pe+1]-e.scrollX.value))<=4){C.style.cursor="col-resize";return}}if(L.x<52&&L.y>=24){const pe=e.hitRow(L.y-24+e.scrollY.value);if(pe>=0&&Math.abs(L.y-(24+e.rowPositions.value[pe+1]-e.scrollY.value))<=4){C.style.cursor="row-resize";return}}C.style.cursor="cell";return}const g=Ft(s,l.canvasRef.value);if(We<0||Se<0)return;if(g.x<52||g.y<24){if(g.y<24&&g.x>=52){const C=e.hitCol(g.x-52+e.scrollX.value);C>=0&&e.selectRange(Math.min(We,C),0,Math.max(We,C),e.rowCount-1,"col")}else if(g.x<52&&g.y>=24){const C=e.hitRow(g.y-24+e.scrollY.value);C>=0&&e.selectRange(0,Math.min(Se,C),e.colCount-1,Math.max(Se,C),"row")}u();return}const $=e.hitCol(g.x-52+e.scrollX.value),z=e.hitRow(g.y-24+e.scrollY.value);$<0||z<0||(Se===0&&We>=0&&e.selection.value&&e.selection.value.startRow===0&&e.selection.value.endRow===e.rowCount-1?e.selectRange(Math.min(We,$),0,Math.max(We,$),e.rowCount-1,"col"):We===0&&Se>=0&&e.selection.value&&e.selection.value.startCol===0&&e.selection.value.endCol===e.colCount-1?e.selectRange(0,Math.min(Se,z),e.colCount-1,Math.max(Se,z),"row"):e.selectRange(We,Se,$,z),u())}function ni(s){const g=b||F;Le=!1,b=!1,F=!1,g&&l.scheduleOptEmit(),n.paintFmt.value&&n.applyPaintFormat()}function ri(){const s=b||F;Le=!1,b=!1,F=!1,s&&l.scheduleOptEmit()}function ai(s){s.preventDefault();const g=Ft(s,l.canvasRef.value);if(g.x<52&&g.y<24){f(s);return}if(g.y<24&&g.x>=52){const $=e.hitCol(g.x-52+e.scrollX.value);$>=0&&T(s,$);return}if(g.x<52&&g.y>=24){const $=e.hitRow(g.y-24+e.scrollY.value);$>=0&&y(s,$);return}if(g.x>=52&&g.y>=24){const $=e.hitCol(g.x-52+e.scrollX.value),z=e.hitRow(g.y-24+e.scrollY.value);$>=0&&z>=0&&A(s,$,z)}}function ii(s){const g=Ft(s,l.canvasRef.value);if(g.x<52||g.y<24)return;const $=e.hitCol(g.x-52+e.scrollX.value),z=e.hitRow(g.y-24+e.scrollY.value);if(!($<0||z<0)){{const C=l.formulaBarRef.value,L=!!(C&&typeof document<"u"&&document.activeElement===C);(e.editingCell.value||L||V)&&P()}e.selectCell($,z),e.ensureVisible($,z),e.startEdit(),u(),l.focusEditInput()}}function ci(s){l.clampScroll(e.scrollX.value+s.deltaX,e.scrollY.value+s.deltaY),u()}function si(s){if(s.touches.length!==1){it=!1;return}const g=s.touches[0],$=l.canvasRef.value;if(!$)return;const z=$.getBoundingClientRect(),C=g.clientX-z.left,L=g.clientY-z.top;C>=52&&L>=24?(s.preventDefault(),it=!0,dt=!1,Rt="cell",be=C,we=L,Ae=e.scrollX.value,lt=e.scrollY.value,Qe=e.hitCol(C-52+e.scrollX.value),rt=e.hitRow(L-24+e.scrollY.value)):C>=0&&L>=0&&(C<52||L<24)&&(s.preventDefault(),it=!0,dt=!1,be=C,we=L,Ae=e.scrollX.value,lt=e.scrollY.value,L<24&&C>=52?(Rt="col",Qe=e.hitCol(C-52+e.scrollX.value),rt=-1):C<52&&L>=24?(Rt="row",rt=e.hitRow(L-24+e.scrollY.value),Qe=-1):(Rt="all",Qe=-1,rt=-1))}function di(s){if(!it||s.touches.length!==1)return;const g=s.touches[0],$=l.canvasRef.value;if(!$)return;const z=$.getBoundingClientRect(),C=g.clientX-z.left,L=g.clientY-z.top;(Math.abs(C-be)>8||Math.abs(L-we)>8)&&(dt=!0,s.preventDefault(),l.clampScroll(Ae+(be-C),lt+(we-L)),u())}function ui(){if(it&&(it=!1,!dt))if(Rt==="cell"&&Qe>=0&&rt>=0){const s=Date.now();Qe===Jl&&rt===Ql&&s-Bl<300?(e.selectCell(Qe,rt),e.startEdit(),u(),l.focusEditInput(),Bl=0):(e.commitEdit(),e.selectCell(Qe,rt),u(),Bl=s),Jl=Qe,Ql=rt,l.focusEditInput()}else Rt==="col"&&Qe>=0?(e.commitEdit(),e.selectRange(Qe,0,Qe,e.rowCount-1,"col"),u()):Rt==="row"&&rt>=0?(e.commitEdit(),e.selectRange(0,rt,e.colCount-1,rt,"row"),u()):Rt==="all"&&(e.commitEdit(),e.selectAll(),u())}function xl(s){return s.isComposing||s.key==="Process"||s.keyCode===229}function eo(s){return s.key.length===1&&!s.ctrlKey&&!s.metaKey&&!s.altKey}function to(s){if(e.editingCell.value)return;const g=s.ctrlKey||s.metaKey,$=s.shiftKey;switch(!0){case(g&&(s.key==="c"||s.key==="C")):s.preventDefault(),o.copyToClipboard();return;case(g&&(s.key==="x"||s.key==="X")):s.preventDefault(),o.cutSelected();return;case(g&&(s.key==="z"||s.key==="Z")):s.preventDefault(),n.undo();return;case(g&&(s.key==="y"||s.key==="Y")):s.preventDefault(),n.redo();return;case(g&&(s.key==="v"||s.key==="V")):s.preventDefault(),n.saveUndo(),o.pasteFromClipboard().then(()=>{u(),t.nextTick(()=>l.emitModelData())});return;case(g&&(s.key==="a"||s.key==="A")):s.preventDefault(),e.selectAll(),u();return;case(g&&s.key==="Home"):s.preventDefault(),e.selectCell(0,0),e.ensureVisible(0,0),u();return;case(g&&s.key==="End"):s.preventDefault(),e.selectCell(e.colCount-1,e.rowCount-1),e.ensureVisible(e.colCount-1,e.rowCount-1),u();return;case s.key==="Home":s.preventDefault(),e.selectCell(0,e.activeCell.value.row),e.ensureVisible(0,e.activeCell.value.row),u();return;case s.key==="End":s.preventDefault(),e.selectCell(e.colCount-1,e.activeCell.value.row),e.ensureVisible(e.colCount-1,e.activeCell.value.row),u();return;case s.key==="ArrowUp":s.preventDefault(),e.moveActive(0,-1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),u();return;case s.key==="ArrowDown":s.preventDefault(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),u();return;case s.key==="ArrowLeft":s.preventDefault(),e.moveActive(-1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),u();return;case s.key==="ArrowRight":s.preventDefault(),e.moveActive(1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),u();return;case s.key==="Tab":s.preventDefault(),e.moveActive($?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),u();return;case s.key==="Enter":s.preventDefault(),e.moveActive(0,$?-1:1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),u();return;case s.key==="F2":s.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),u(),l.focusEditInput();return;case s.key==="Delete":case s.key==="Backspace":s.preventDefault(),n.saveUndo(),o.clearSelected(),u();return;case s.key==="Escape":s.preventDefault(),e.cancelEdit(),n.paintFmt.value=null,u();return;case eo(s):if(xl(s)){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),u(),l.focusEditInput();return}s.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(s.key),u(),t.nextTick(()=>{const z=l.editInputRef.value;z&&(z.focus(),z.setSelectionRange(1,1))});return}}let Ml=!1,Sl=!1;function fi(s){const g=s.target.value;if(!e.editingCell.value){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(g),w.value=g,u();return}e.editValue.value=g,w.value=g}function mi(){Ml=!0,e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),w.value="",u())}function pi(s){Ml=!1,Sl=!0,setTimeout(()=>{Sl=!1},0);const g=s.target.value;e.editValue.value=g,w.value=g}function gi(s){if(!e.editingCell.value){if(eo(s)||xl(s))return;to(s);return}if(!(Ml||xl(s))&&!(Sl&&(s.key==="Enter"||s.key==="Escape")))if(s.key==="Enter"&&(s.altKey||s.metaKey)){s.preventDefault();const g=l.editInputRef.value;if(!g)return;const $=g.selectionStart??g.value.length,z=g.selectionEnd??g.value.length,C=g.value,L=C.slice(0,$)+`
|
|
9
|
-
`+C.slice(z);e.editValue.value=L,g.value=L,g.selectionStart=g.selectionEnd=$+1,u()}else s.key==="Enter"?(s.preventDefault(),e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),u(),l.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),u(),l.focusEditInput()):s.key==="Escape"&&(s.preventDefault(),e.cancelEdit(),u(),l.focusEditInput())}function hi(s){e.editingCell.value}function Ci(){setTimeout(()=>{e.editingCell.value&&(e.commitEdit(),u())},0)}let gt=null;function qt(){var g;const s=(g=l.wrapperRef.value)==null?void 0:g.getBoundingClientRect();if(s){const $=Vt(e.props.width),z=Vt(e.props.height);$!=null?l.viewSize.w=$:l.viewSize.w=s.width,z!=null?l.viewSize.h=z:l.viewSize.h=s.height}l.clampScroll(null,null),u()}function bi(){t.onMounted(()=>{const s=Vt(e.props.width),g=Vt(e.props.height);(s==null||g==null)&&(gt=new ResizeObserver(()=>qt()),l.wrapperRef.value&>.observe(l.wrapperRef.value)),t.nextTick(()=>{qt(),l.focusEditInput()}),e.selectCell(0,0),l.modelData.value&&l.modelData.value.length>0&&(c.value=JSON.stringify(l.modelData.value),l.sheets.value=l.modelData.value.map($=>{const z=l.mkSheet($.name);for(const[C,L]of Object.entries($.cells))z.cells[C]={value:L.value,style:L.style??null};if($.colWidths)for(const[C,L]of Object.entries($.colWidths)){const pe=Number(C);pe>=0&&pe<e.colCount&&L>=30&&(z.colWidths[pe]=L)}if($.rowHeights)for(const[C,L]of Object.entries($.rowHeights)){const pe=Number(C);pe>=0&&pe<e.rowCount&&L>=24&&(z.rowHeights[pe]=L)}if($.merges)for(const[C,L]of Object.entries($.merges))z.merges[C]={...L};return z}),l.sheets.value.length>0&&l.loadSheet(0))}),t.watch(()=>[e.props.width,e.props.height],()=>{const s=Vt(e.props.width),g=Vt(e.props.height);s!=null&&g!=null?(gt==null||gt.disconnect(),gt=null):!gt&&l.wrapperRef.value&&(gt=new ResizeObserver(()=>qt()),gt.observe(l.wrapperRef.value)),t.nextTick(()=>qt())}),t.watch(()=>e.props.theme,()=>u()),t.watch(()=>({...e.cells}),()=>t.nextTick(()=>l.emitModelData()),{deep:!1}),t.watch(()=>({...e.merges}),()=>{t.nextTick(()=>l.emitModelData()),u()},{deep:!1}),t.watch(l.activeSheetIndex,()=>t.nextTick(()=>l.emitModelData())),t.watch(()=>l.modelData.value,s=>{if(!s||s.length===0)return;const g=JSON.stringify(s);if(g===c.value)return;c.value=g;const $=e.selection.value?{...e.selection.value}:null,z={...e.activeCell.value};l.sheets.value=s.map(C=>{const L=l.mkSheet(C.name);for(const[pe,ve]of Object.entries(C.cells))L.cells[pe]={value:ve.value,style:ve.style??null};if(C.colWidths)for(const[pe,ve]of Object.entries(C.colWidths)){const he=Number(pe);he>=0&&he<e.colCount&&ve>=30&&(L.colWidths[he]=ve)}if(C.rowHeights)for(const[pe,ve]of Object.entries(C.rowHeights)){const he=Number(pe);he>=0&&he<e.rowCount&&ve>=24&&(L.rowHeights[he]=ve)}if(C.merges)for(const[pe,ve]of Object.entries(C.merges))L.merges[pe]={...ve};return L}),l.sheets.value.length>0&&l.loadSheet(0),$&&(e.selection.value=$),e.activeCell.value=z,u()},{deep:!0}),t.onBeforeUnmount(()=>{gt==null||gt.disconnect()})}return{scheduleRender:u,render:x,activeCellLabel:S,formulaBarDisplay:B,formulaBarDraft:w,formulaBarExpanded:R,onFormulaBarFocus:le,onFormulaBarInput:ne,onFormulaBarKeydown:Z,onFormulaBarBlur:J,acceptFormulaBarEdit:P,cancelFormulaBarEdit:oe,renTab:q,renTabVal:ue,onTabClick:Fe,onTabDblClick:Oe,commitTabRename:Je,cclTabRename:Ge,onTabRenameKd:je,ctxMenu:se,ctxSubmenuLeft:i,onCtxItemEnter:m,onTabCtxMenu:fe,onTabBarCtx:De,onCornerCtx:f,onRowHdrCtx:y,onColHdrCtx:T,onCellCtx:A,dimInputRef:a,dimPanel:h,openDimPanel:W,onDimInput:Y,onDimKeydown:Me,onDimBlur:Ve,applyDimPanel:Ke,closeDimPanel:Be,editInputStyle:M,hScrollbarW:ce,vScrollbarH:ee,hTrackW:ae,vTrackH:X,hThumbW:U,hThumbL:ye,vThumbH:Ee,vThumbT:Ze,onVStart:I,onHStart:Q,onSbMove:ie,onSbUp:ke,onVTrk:Ne,onHTrk:ze,onMouseDown:li,onMouseMove:oi,onMouseUp:ni,onMouseLeave:ri,onCanvasCtx:ai,onDblClick:ii,onWheel:ci,onTouchStart:si,onTouchMove:di,onTouchEnd:ui,onKeydown:to,onEditInput:fi,onEditCompositionStart:mi,onEditCompositionEnd:pi,onEditKd:gi,onEditPaste:hi,onEditBlur:Ci,applySize:qt,setupLifecycle:bi}}function Fa(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Zl(e,n,o,l){return n?l?o?e===n:e.toLowerCase()===n.toLowerCase():o?e.includes(n):e.toLowerCase().includes(n.toLowerCase()):!1}function Oa(e,n,o,l){if(!n)return e;if(l){const d=e.indexOf(n);return d<0?e:e.slice(0,d)+o+e.slice(d+n.length)}const c=e.toLowerCase().indexOf(n.toLowerCase());return c<0?e:e.slice(0,c)+o+e.slice(c+n.length)}function La(e,n,o,l){return n?l?e.indexOf(n)<0?e:e.split(n).join(o):e.toLowerCase().indexOf(n.toLowerCase())<0?e:e.replace(new RegExp(Fa(n),"gi"),()=>o):e}function Rl(e,n,o,l,c,d,r){const v=[];if(r){for(let u=r.startRow;u<=r.endRow;u++)for(let k=r.startCol;k<=r.endCol;k++){const x=e[o(k,u)];x&&Zl(x.value,l,c,d)&&v.push({sheetIndex:n,col:k,row:u})}return v}for(const u in e){const k=e[u];if(k&&Zl(k.value,l,c,d)){const x=u.split(","),S=Number(x[0]),w=Number(x[1]);!Number.isNaN(S)&&!Number.isNaN(w)&&v.push({sheetIndex:n,col:S,row:w})}}return v}function Ia(e,n,o,l){const c=t.ref(!1),d=t.ref(""),r=t.ref(""),v=t.ref("sheet"),u=t.ref(!1),k=t.ref(!1),x=t.ref(-1),S=t.ref([]),w=t.ref(""),R=t.ref(0),B=t.ref(""),le=t.computed(()=>{const i=new Set,m=o.activeSheetIndex.value;for(const fe of S.value)fe.sheetIndex===m&&i.add(`${fe.col},${fe.row}`);return i}),ne=t.computed(()=>{if(x.value<0||x.value>=S.value.length)return null;const i=S.value[x.value];return i.sheetIndex!==o.activeSheetIndex.value?null:`${i.col},${i.row}`});e.findHighlight=(i,m)=>{const fe=`${i},${m}`;return ne.value===fe?"active":le.value.has(fe)?"match":null};function p(i){var De,f;const m=e.cellKey(i.col,i.row);if(i.sheetIndex===o.activeSheetIndex.value)return((De=e.cells[m])==null?void 0:De.value)??"";const fe=o.sheets.value[i.sheetIndex];return((f=fe==null?void 0:fe.cells[m])==null?void 0:f.value)??""}function V(i,m){const fe=e.cellKey(i.col,i.row);if(i.sheetIndex===o.activeSheetIndex.value)e.setCellValue(i.col,i.row,m);else{const De=o.sheets.value[i.sheetIndex];if(!De)return;const f=De.cells[fe];De.cells[fe]={value:String(m),style:(f==null?void 0:f.style)??null}}}function P(){if(B.value){w.value=B.value;return}if(!d.value){w.value="";return}if(v.value==="selection"&&!e.selection.value){w.value=N(e.locale.value,"findNeedSelection");return}if(S.value.length===0){w.value=N(e.locale.value,"findNoResult");return}w.value=""}function oe(){const i=d.value,m=[];if(i)if(v.value==="workbook")o.sheets.value.forEach((fe,De)=>{m.push(...Rl(fe.cells,De,e.cellKey,i,u.value,k.value))});else if(v.value==="selection"){const fe=e.selection.value;fe&&m.push(...Rl(e.cells,o.activeSheetIndex.value,e.cellKey,i,u.value,k.value,fe))}else m.push(...Rl(e.cells,o.activeSheetIndex.value,e.cellKey,i,u.value,k.value));S.value=m,m.length===0?x.value=-1:x.value>=m.length?x.value=m.length-1:x.value<0&&(x.value=0),P()}function Z(){if(x.value<0||x.value>=S.value.length)return;const i=S.value[x.value];i.sheetIndex!==o.activeSheetIndex.value&&o.switchSheet(i.sheetIndex),v.value==="selection"?e.activeCell.value={col:i.col,row:i.row}:e.selectCell(i.col,i.row),e.ensureVisible(i.col,i.row)}const J=typeof requestAnimationFrame=="function"?requestAnimationFrame:i=>setTimeout(i,16);let q=!1,ue=!1;function Fe(i){if(q){ue=ue||i;return}q=!0,ue=i,J(()=>{var m;q=!1,oe(),ue&&S.value.length>0&&x.value>=0&&Z(),ue=!1,(m=e.scheduleRender)==null||m.call(e)})}function Oe(){var i;c.value=!0,R.value++,oe(),S.value.length>0&&(x.value=0,Z()),(i=e.scheduleRender)==null||i.call(e)}function Je(){Oe()}function Ge(){var i;c.value=!1,S.value=[],x.value=-1,B.value="",w.value="",(i=e.scheduleRender)==null||i.call(e)}function je(){var i;S.value.length!==0&&(x.value=(x.value+1)%S.value.length,Z(),(i=e.scheduleRender)==null||i.call(e))}function se(){var i;S.value.length!==0&&(x.value=(x.value-1+S.value.length)%S.value.length,Z(),(i=e.scheduleRender)==null||i.call(e))}function de(){var f,y;if(x.value<0||x.value>=S.value.length)return;const i=S.value[x.value],m=p(i),fe=Oa(m,d.value,r.value,u.value);if(fe===m)return;n.saveUndo(),V(i,fe);const De=x.value;oe(),S.value.length>0?(x.value=Math.min(De,S.value.length-1),je()):x.value=-1,(f=e.emitModelData)==null||f.call(e),(y=e.scheduleRender)==null||y.call(e)}function Te(){var De,f;const i=d.value;if(!i||S.value.length===0)return;n.saveUndo();let m=0;const fe=S.value.slice();for(const y of fe){const T=p(y),A=La(T,i,r.value,u.value);A!==T&&(V(y,A),m++)}S.value=[],x.value=-1,B.value=N(e.locale.value,"findReplacedAll").replace("{n}",String(m)),P(),(De=e.emitModelData)==null||De.call(e),(f=e.scheduleRender)==null||f.call(e)}function re(){const i=m=>{if(!(m.ctrlKey||m.metaKey))return;const De=m.key.toLowerCase();(De==="f"||De==="h")&&(m.preventDefault(),Oe())};window.addEventListener("keydown",i),t.onBeforeUnmount(()=>window.removeEventListener("keydown",i))}return t.watch(d,()=>{c.value&&(B.value="",x.value=0,Fe(!0))}),t.watch([v,u,k],()=>{c.value&&(B.value="",x.value=0,Fe(!0))}),t.watch(e.cells,()=>{c.value&&Fe(!1)},{deep:!0}),t.watch(()=>e.selection.value,()=>{c.value&&v.value==="selection"&&(x.value=0,Fe(!0))}),t.watch([()=>n.undoStack.value.length,()=>n.redoStack.value.length],()=>{c.value&&Fe(!1)}),{open:c,findText:d,replaceText:r,scope:v,matchCase:u,matchEntireCell:k,currentIndex:x,results:S,message:w,focusToken:R,activeSheetMatches:le,activeMatchKey:ne,openFind:Oe,openReplace:Je,close:Ge,recompute:oe,findNext:je,findPrev:se,replace:de,replaceAll:Te,setupLifecycle:re}}const $a={class:"formula-bar__cell-label"},za={class:"formula-bar__buttons"},Wa=["rows","value"],_a=["title"],Ka={key:0,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},Ua={key:1,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},Ga=["value"],Pa={key:2,class:"sb-corner"},Ya=["onClick","onMouseenter"],Xa={class:"context-menu__label"},ja={key:0,class:"context-menu__arrow"},Za=["onClick"],qa={class:"dim-panel__title"},Ja={class:"dim-panel__body"},Qa=["value"],ei={key:0,class:"dim-panel__error"},ti={class:"dim-panel__footer"},ql=vt(t.defineComponent({__name:"spreader",props:t.mergeModels({rowCount:{default:200},colCount:{default:26},width:{},height:{},theme:{default:"light"},locale:{default:"zh-CN"}},{data:{default:()=>[]},dataModifiers:{}}),emits:["update:data"],setup(e){const n=e,o=t.useModel(e,"data"),l={value:""},c=Sa(n,{rowCount:n.rowCount,colCount:n.colCount,theme:n.theme,locale:n.locale}),d={sheets:t.ref([]),activeSheetIndex:t.ref(0),saveSheet:()=>{},loadSheet:re=>{},mkSheet:re=>({id:"",name:re,cells:{},merges:{},selection:null,activeCell:{col:0,row:0},scrollX:0,scrollY:0,colWidths:[],rowHeights:[]})},r=Ta(c,d),v=Na(c,r);Da(r,{borderMenuOpen:v.borderMenuOpen,mergeMenuOpen:v.mergeMenuOpen});const u=Ha(c,r,o,void 0,l);d.sheets=u.sheets,d.activeSheetIndex=u.activeSheetIndex,d.saveSheet=u.saveSheet,d.loadSheet=u.loadSheet,d.mkSheet=u.mkSheet;const k=Va(c,r,v,u,l);k.setupLifecycle();const x=Ia(c,r,u);x.setupLifecycle();const S=t.reactive(c),w=t.reactive(r),R=t.reactive(v),B=t.reactive(u),le=u.sheets,ne=u.activeSheetIndex,p=t.reactive(k),V=t.reactive(x),P=t.computed(()=>{const re=S.selection;return!!re&&re.startCol===re.endCol&&re.startRow===re.endRow}),oe=t.computed(()=>{var fe;const re=w.selNumberFormat;if(re!==nl)return re;const i=S.activeCell,m=(fe=S.cells[S.cellKey(i.col,i.row)])==null?void 0:fe.style;return typeof(m==null?void 0:m.numberFormat)=="string"?m.numberFormat:""});function Z(re){r.nfDialogOpen.value=re}function J(re){r.fontSizeMenuOpen.value=re}function q(re){r.textColorMenuOpen.value=re}function ue(re){r.fillColorMenuOpen.value=re}function Fe(re){k.renTabVal.value=re}function Oe(){k.ctxMenu.value=null}const Je=re=>{u.formulaBarRef.value=re};function Ge(){k.formulaBarExpanded.value=!k.formulaBarExpanded.value}const je=re=>{u.wrapperRef.value=re},se=re=>{u.canvasRef.value=re},de=re=>{u.editInputRef.value=re},Te=re=>{k.dimInputRef.value=re};return(re,i)=>(t.openBlock(),t.createElementBlock("div",{class:"spreadsheet-outer",style:t.normalizeStyle(B.outerStyle)},[t.createVNode(hr,{locale:S.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":R.borderMenuOpen,"cached-border":R.cachedBorder,"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":R.mergeMenuOpen,"calc-menu-open":R.calcMenuOpen,"is-single-cell":P.value,"sel-number-format":w.selNumberFormat,"nf-options":w.nfOptions,"theme-vars":B.toolbarThemeVars,onUndo:i[0]||(i[0]=m=>w.undo()),onRedo:i[1]||(i[1]=m=>w.redo()),onPaintFormat:w.onPaintFormat,onClearFormat:i[2]||(i[2]=m=>w.clearFormat()),onNumberFormatChange:i[3]||(i[3]=m=>w.onNumberFormatChange(m)),onFontFamilyChange:i[4]||(i[4]=m=>w.onFontFamilyChange(m)),onFontSizeInput:i[5]||(i[5]=m=>w.onFontSizeInput(m)),onFontSizeBlur:w.onFontSizeBlur,onFontSizeKeydown:i[6]||(i[6]=m=>w.onFontSizeKeydown(m)),onFontSizeChange:i[7]||(i[7]=m=>w.onFontSizeChange(m)),"onUpdate:fontSizeMenuOpen":i[8]||(i[8]=m=>J(m)),onFontSizeToggle:i[9]||(i[9]=m=>w.toggleFontSizeMenu()),onFontSizeStepUp:w.onFontSizeStepUp,onFontSizeStepDown:w.onFontSizeStepDown,onBoldToggle:w.toggleFontWeight,onItalicToggle:w.toggleFontStyle,onUnderlineToggle:w.toggleUnderline,onStrikethroughToggle:w.toggleStrikethrough,onTextColorChange:i[10]||(i[10]=m=>w.onTextColorChange(m)),"onUpdate:textColorMenuOpen":i[11]||(i[11]=m=>q(m)),onFillColorChange:i[12]||(i[12]=m=>w.onFillColorChange(m)),"onUpdate:fillColorMenuOpen":i[13]||(i[13]=m=>ue(m)),onApplyTextColor:w.applyCachedTextColor,onApplyFillColor:w.applyCachedFillColor,"onUpdate:borderMenuOpen":i[14]||(i[14]=m=>w.onBorderMenuToggle(m)),onBorderChange:i[15]||(i[15]=m=>R.onBorderChange(m)),onApplyBorder:R.applyCachedBorder,onHAlignChange:i[16]||(i[16]=m=>w.onHAlignChange(m)),onVAlignChange:i[17]||(i[17]=m=>w.onVAlignChange(m)),onWrapToggle:w.onWrapToggle,"onUpdate:mergeMenuOpen":i[18]||(i[18]=m=>R.onMergeMenuToggle(m)),onMergeChange:i[19]||(i[19]=m=>R.onMergeChange(m)),onApplyMerge:R.onApplyMerge,"onUpdate:calcMenuOpen":i[20]||(i[20]=m=>R.onCalcMenuToggle(m)),onCalcSum:R.onCalcSum,onCalcAvg:R.onCalcAvg,onCalcCount:R.onCalcCount,onFind:i[21]||(i[21]=m=>t.unref(x).openFind())},null,8,["locale","can-undo","can-redo","paint-fmt-active","has-selection","font-family-options","font-size-options","sel-font-family","sel-font-size","font-size-input","font-size-menu-open","sel-font-weight","sel-font-style","sel-underline","sel-strikethrough","sel-text-color","text-color-menu-open","sel-fill-color","fill-color-menu-open","cached-text-color","cached-fill-color","border-menu-open","cached-border","h-align-options","v-align-options","sel-h-align","sel-v-align","sel-wrap","merge-menu-open","calc-menu-open","is-single-cell","sel-number-format","nf-options","theme-vars","onPaintFormat","onFontSizeBlur","onFontSizeStepUp","onFontSizeStepDown","onBoldToggle","onItalicToggle","onUnderlineToggle","onStrikethroughToggle","onApplyTextColor","onApplyFillColor","onApplyBorder","onWrapToggle","onApplyMerge","onCalcSum","onCalcAvg","onCalcCount"]),t.createVNode($r,{open:V.open,"find-text":V.findText,"replace-text":V.replaceText,scope:V.scope,"match-case":V.matchCase,"match-entire-cell":V.matchEntireCell,"current-index":V.currentIndex,total:V.results.length,message:V.message,"focus-token":V.focusToken,locale:S.locale,"theme-vars":B.toolbarThemeVars,"onUpdate:findText":i[22]||(i[22]=m=>t.unref(x).findText.value=m),"onUpdate:replaceText":i[23]||(i[23]=m=>t.unref(x).replaceText.value=m),"onUpdate:scope":i[24]||(i[24]=m=>t.unref(x).scope.value=m),"onUpdate:matchCase":i[25]||(i[25]=m=>t.unref(x).matchCase.value=m),"onUpdate:matchEntireCell":i[26]||(i[26]=m=>t.unref(x).matchEntireCell.value=m),onPrev:i[27]||(i[27]=m=>t.unref(x).findPrev()),onNext:i[28]||(i[28]=m=>t.unref(x).findNext()),onReplace:i[29]||(i[29]=m=>t.unref(x).replace()),onReplaceAll:i[30]||(i[30]=m=>t.unref(x).replaceAll()),onClose:i[31]||(i[31]=m=>t.unref(x).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(ba,{"model-open":w.nfDialogOpen,locale:S.locale,"current-format":oe.value,"onUpdate:modelOpen":i[32]||(i[32]=m=>Z(m)),onApply:i[33]||(i[33]=m=>w.applyNumberFormatCode(m))},null,8,["model-open","locale","current-format"]),t.createElementVNode("div",{class:t.normalizeClass(["formula-bar",{"formula-bar--expanded":p.formulaBarExpanded}])},[t.createElementVNode("div",$a,t.toDisplayString(p.activeCellLabel),1),t.createElementVNode("div",za,[t.createElementVNode("button",{type:"button",class:"formula-bar__btn formula-bar__btn--cancel",title:"取消(Esc)","aria-label":"取消",onMousedown:i[34]||(i[34]=t.withModifiers(()=>{},["prevent"])),onClick:i[35]||(i[35]=t.withModifiers((...m)=>p.cancelFormulaBarEdit&&p.cancelFormulaBarEdit(...m),["stop"]))},[...i[84]||(i[84]=[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:i[36]||(i[36]=t.withModifiers(()=>{},["prevent"])),onClick:i[37]||(i[37]=t.withModifiers((...m)=>p.acceptFormulaBarEdit&&p.acceptFormulaBarEdit(...m),["stop"]))},[...i[85]||(i[85]=[t.createElementVNode("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":"true"},[t.createElementVNode("path",{d:"M2.5 7.5l3.5 3.5L12 3.5",fill:"none",stroke:"#2e7d32","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],32)]),t.createElementVNode("textarea",{ref:Je,class:t.normalizeClass(["formula-bar__input",{"formula-bar__input--expanded":p.formulaBarExpanded}]),rows:p.formulaBarExpanded?3:1,value:p.formulaBarDisplay,spellcheck:"false",onFocus:i[38]||(i[38]=(...m)=>p.onFormulaBarFocus&&p.onFormulaBarFocus(...m)),onInput:i[39]||(i[39]=(...m)=>p.onFormulaBarInput&&p.onFormulaBarInput(...m)),onKeydown:i[40]||(i[40]=(...m)=>p.onFormulaBarKeydown&&p.onFormulaBarKeydown(...m)),onBlur:i[41]||(i[41]=(...m)=>p.onFormulaBarBlur&&p.onFormulaBarBlur(...m))},null,42,Wa),t.createElementVNode("button",{type:"button",class:"formula-bar__toggle",title:p.formulaBarExpanded?"折叠为1行":"展开为3行",onMousedown:i[42]||(i[42]=t.withModifiers(()=>{},["prevent"])),onClick:t.withModifiers(Ge,["stop"])},[p.formulaBarExpanded?(t.openBlock(),t.createElementBlock("svg",Ua,[...i[87]||(i[87]=[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",Ka,[...i[86]||(i[86]=[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,_a)],2),t.createElementVNode("div",{ref:je,class:"spreadsheet-wrapper"},[t.createElementVNode("canvas",{ref:se,class:"grid-canvas",tabindex:"0",onMousedown:i[43]||(i[43]=(...m)=>p.onMouseDown&&p.onMouseDown(...m)),onMousemove:i[44]||(i[44]=(...m)=>p.onMouseMove&&p.onMouseMove(...m)),onMouseup:i[45]||(i[45]=(...m)=>p.onMouseUp&&p.onMouseUp(...m)),onMouseleave:i[46]||(i[46]=(...m)=>p.onMouseLeave&&p.onMouseLeave(...m)),onDblclick:i[47]||(i[47]=(...m)=>p.onDblClick&&p.onDblClick(...m)),onWheel:i[48]||(i[48]=t.withModifiers((...m)=>p.onWheel&&p.onWheel(...m),["prevent"])),onFocus:i[49]||(i[49]=(...m)=>B.onCanvasFocus&&B.onCanvasFocus(...m)),onKeydown:i[50]||(i[50]=(...m)=>p.onKeydown&&p.onKeydown(...m)),onContextmenu:i[51]||(i[51]=(...m)=>p.onCanvasCtx&&p.onCanvasCtx(...m)),onTouchstart:i[52]||(i[52]=t.withModifiers((...m)=>p.onTouchStart&&p.onTouchStart(...m),["prevent"])),onTouchmove:i[53]||(i[53]=t.withModifiers((...m)=>p.onTouchMove&&p.onTouchMove(...m),["prevent"])),onTouchend:i[54]||(i[54]=(...m)=>p.onTouchEnd&&p.onTouchEnd(...m))},null,32),t.createElementVNode("textarea",{ref:de,class:"cell-editor",value:S.editValue,style:t.normalizeStyle(p.editInputStyle),onInput:i[55]||(i[55]=(...m)=>p.onEditInput&&p.onEditInput(...m)),onKeydown:i[56]||(i[56]=(...m)=>p.onEditKd&&p.onEditKd(...m)),onCompositionstart:i[57]||(i[57]=(...m)=>p.onEditCompositionStart&&p.onEditCompositionStart(...m)),onCompositionend:i[58]||(i[58]=(...m)=>p.onEditCompositionEnd&&p.onEditCompositionEnd(...m)),onBlur:i[59]||(i[59]=(...m)=>p.onEditBlur&&p.onEditBlur(...m)),onPaste:i[60]||(i[60]=(...m)=>p.onEditPaste&&p.onEditPaste(...m))},null,44,Ga),B.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"v-scrollbar",style:t.normalizeStyle({top:t.unref(24)+"px",height:`calc(100% - ${t.unref(24)+t.unref(11)}px)`})},[t.createElementVNode("button",{class:"sb-btn sb-btn--up",title:"",onMousedown:i[61]||(i[61]=t.withModifiers(m=>{B.clampScroll(null,S.scrollY-50),p.scheduleRender()},["prevent"]))},[...i[88]||(i[88]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--up"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--v",onMousedown:i[63]||(i[63]=(...m)=>p.onVTrk&&p.onVTrk(...m))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--v",style:t.normalizeStyle({top:p.vThumbT+"px",height:p.vThumbH+"px"}),onMousedown:i[62]||(i[62]=(...m)=>p.onVStart&&p.onVStart(...m))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--down",onMousedown:i[64]||(i[64]=t.withModifiers(m=>{B.clampScroll(null,S.scrollY+50),p.scheduleRender()},["prevent"]))},[...i[89]||(i[89]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--down"},null,-1)])],32)],4)):t.createCommentVNode("",!0),B.maxScrollX>0?(t.openBlock(),t.createElementBlock("div",{key:1,class:"h-scrollbar",style:t.normalizeStyle({left:t.unref(52)+"px",width:`calc(100% - ${t.unref(52)+t.unref(11)}px)`})},[t.createElementVNode("button",{class:"sb-btn sb-btn--left",onMousedown:i[65]||(i[65]=t.withModifiers(m=>{B.clampScroll(S.scrollX-50,null),p.scheduleRender()},["prevent"]))},[...i[90]||(i[90]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--left"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--h",onMousedown:i[67]||(i[67]=(...m)=>p.onHTrk&&p.onHTrk(...m))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--h",style:t.normalizeStyle({left:p.hThumbL+"px",width:p.hThumbW+"px"}),onMousedown:i[66]||(i[66]=(...m)=>p.onHStart&&p.onHStart(...m))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--right",onMousedown:i[68]||(i[68]=t.withModifiers(m=>{B.clampScroll(S.scrollX+50,null),p.scheduleRender()},["prevent"]))},[...i[91]||(i[91]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--right"},null,-1)])],32)],4)):t.createCommentVNode("",!0),B.maxScrollX>0&&B.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",Pa)):t.createCommentVNode("",!0)]),t.createVNode(kr,{locale:S.locale,sheets:t.unref(le),"active-sheet-index":t.unref(ne),"ren-tab":p.renTab,"ren-tab-val":p.renTabVal,onTabClick:i[69]||(i[69]=m=>p.onTabClick(m)),onTabDblclick:i[70]||(i[70]=m=>p.onTabDblClick(m)),onTabContextmenu:i[71]||(i[71]=m=>p.onTabCtxMenu(m.ev,m.i)),onTabRenameInput:i[72]||(i[72]=m=>Fe(m)),onTabRenameKeydown:i[73]||(i[73]=m=>p.onTabRenameKd(m)),onTabRenameCommit:p.commitTabRename,onTabbarContextmenu:i[74]||(i[74]=m=>p.onTabBarCtx(m)),onAddSheet:i[75]||(i[75]=m=>{B.addSheet(),p.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(()=>[p.ctxMenu?(t.openBlock(),t.createElementBlock("div",{key:0,class:"context-menu",style:t.normalizeStyle({left:p.ctxMenu.x+"px",top:p.ctxMenu.y+"px"}),onClick:i[76]||(i[76]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(p.ctxMenu.items,(m,fe)=>(t.openBlock(),t.createElementBlock("div",{key:fe,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":m.disabled}]),onClick:De=>!m.disabled&&m.action&&(m.action(),Oe()),onMouseenter:De=>p.onCtxItemEnter(De,m)},[t.createElementVNode("span",Xa,t.toDisplayString(m.label),1),m.children?(t.openBlock(),t.createElementBlock("span",ja)):t.createCommentVNode("",!0),m.children?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["context-submenu",{"context-submenu--left":p.ctxSubmenuLeft}])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(m.children,(De,f)=>(t.openBlock(),t.createElementBlock("div",{key:f,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":De.disabled}]),onClick:t.withModifiers(y=>!De.disabled&&De.action&&(De.action(),Oe()),["stop"])},t.toDisplayString(De.label),11,Za))),128))],2)):t.createCommentVNode("",!0)],42,Ya))),128))],4)):t.createCommentVNode("",!0)]),_:1})])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[p.dimPanel?(t.openBlock(),t.createElementBlock("div",{key:0,class:"dim-panel",style:t.normalizeStyle({left:p.dimPanel.x+"px",top:p.dimPanel.y+"px"}),onMousedown:i[82]||(i[82]=t.withModifiers(()=>{},["stop"])),onClick:i[83]||(i[83]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",qa,t.toDisplayString(p.dimPanel.type==="row"?"行高":"列宽"),1),t.createElementVNode("div",Ja,[t.createElementVNode("input",{ref:Te,class:t.normalizeClass(["dim-panel__input",{"dim-panel__input--error":p.dimPanel.error}]),type:"number",step:"1",min:"1",inputmode:"numeric",value:p.dimPanel.value,onInput:i[77]||(i[77]=(...m)=>p.onDimInput&&p.onDimInput(...m)),onKeydown:i[78]||(i[78]=(...m)=>p.onDimKeydown&&p.onDimKeydown(...m)),onBlur:i[79]||(i[79]=(...m)=>p.onDimBlur&&p.onDimBlur(...m))},null,42,Qa),i[92]||(i[92]=t.createElementVNode("span",{class:"dim-panel__unit"},"px",-1))]),p.dimPanel.error?(t.openBlock(),t.createElementBlock("div",ei,t.toDisplayString(p.dimPanel.error),1)):t.createCommentVNode("",!0),t.createElementVNode("div",ti,[t.createElementVNode("button",{class:"dim-panel__btn dim-panel__btn--primary",onClick:i[80]||(i[80]=(...m)=>p.applyDimPanel&&p.applyDimPanel(...m))}," 确定 "),t.createElementVNode("button",{class:"dim-panel__btn",onClick:i[81]||(i[81]=(...m)=>p.closeDimPanel&&p.closeDimPanel(...m))}," 取消 ")])],36)):t.createCommentVNode("",!0)]),_:1})]))],4))}}),[["__scopeId","data-v-daa631b0"]]);Dt.Spreader=ql,Dt.default=ql,Object.defineProperties(Dt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(Dt,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(Dt=typeof globalThis<"u"?globalThis:Dt||self,t(Dt.XiaoDaoSpreader={},Dt.Vue))})(this,function(Dt,t){"use strict";const uo={"zh-CN":{insert:"插入",delete:"删除",rename:"重命名",moveLeft:"左移",moveRight:"右移",cut:"剪切",copy:"复制",paste:"粘贴",addSheet:"新建工作表",moveSheetLeft:"左移",moveSheetRight:"右移",scrollUp:"向上滚动",scrollDown:"向下滚动",scrollLeft:"向左滚动",scrollRight:"向右滚动",calculate:"计算",sum:"求和",avg:"平均值",count:"计数",undo:"撤销",redo:"重做",paintFormat:"格式刷",clearFormat:"清除格式",fontFamily:"字体",fontSize:"字号",fontSizeIncrease:"增大字号",fontSizeDecrease:"减小字号",bold:"加粗",italic:"斜体",underline:"下划线",strikethrough:"删除线",fontColor:"文字颜色",fillColor:"填充颜色",borders:"边框",hAlign:"水平对齐",vAlign:"垂直对齐",alignLeft:"左端对齐",alignCenter:"居中对齐",alignRight:"右端对齐",alignTop:"顶端对齐",alignMiddle:"垂直居中",alignBottom:"底端对齐",wrap:"自动换行",mergeCells:"合并单元格",mergeCenter:"合并后居中",mergeAcross:"跨越合并",unmergeCells:"取消合并单元格",borderBottom:"下框线",borderTop:"上框线",borderLeft:"左框线",borderRight:"右框线",borderNone:"无框线",borderAll:"所有框线",borderOuter:"外框线",borderThickOuter:"粗外框线",fontDefault:"默认",rowHeight:"行高",colWidth:"列宽",autoRowHeight:"自动行高",defaultColWidth:"默认列宽",ok:"确定",cancel:"取消",dimNumberError:"请输入数字",dimRangeError:"请输入 {min}~{max} 之间的数值",colorAutomatic:"自动",colorNoFill:"无填充",colorWhite:"白色",colorBlack:"黑色",colorLightGray:"浅灰",colorLightBlue:"浅蓝",colorLightOrange:"浅橙",colorLightYellow:"浅黄",colorLightGreen:"浅绿",colorPaleBlue:"淡蓝",colorPaleOrange:"淡橙",colorPaleYellow:"淡黄",colorPaleGreen:"淡绿",colorSilver:"银色",colorSkyBlue:"天蓝",colorCoral:"珊瑚",colorGold:"金色",colorMint:"薄荷",colorGray:"灰色",colorMediumBlue:"中蓝",colorOrange:"橙色",colorAmber:"琥珀",colorMediumGreen:"中绿",colorDarkGray:"深灰",colorRoyalBlue:"宝蓝",colorRed:"红色",colorDarkGold:"深金",colorDarkGreen:"深绿",colorCharcoal:"炭灰",colorDeepBlue:"深蓝",colorDarkRed:"深红",colorOlive:"橄榄",colorForest:"森林",colorSlate:"石板灰",colorNavy:"藏青",colorCrimson:"绯红",colorDarkOlive:"深橄榄",colorDeepForest:"深林",colorDarkSlate:"深石板灰",colorMidnight:"午夜蓝",colorMaroon:"栗色",colorCoffee:"咖啡色",colorEvergreen:"常青",colorDarkNavy:"深藏青",colorDarkMaroon:"深栗",colorDarkCoffee:"深咖",colorInkGreen:"墨绿",numberFormat:"数字格式",nfGeneral:"常规",nfText:"文本",nfNumber:"数字",nfPercent:"百分比",nfScientific:"科学计数法",nfAccounting:"会计专用",nfFinancial:"财务数值",nfCurrency:"货币",nfCurrencyRounded:"货币取整",nfDate:"日期",nfTime:"时间",nfDateTime:"日期和时间",nfDuration:"持续时间",nfCustom:"其他数字格式…",nfMixed:"混合",nfDialogTitle:"设置单元格格式",nfCategory:"分类",nfCatGeneral:"常规",nfCatNumber:"数值",nfCatCurrency:"货币",nfCatAccounting:"会计专用",nfCatFinancial:"财务",nfCatPercent:"百分比",nfCatScientific:"科学计数",nfCatDate:"日期",nfCatTime:"时间",nfCatText:"文本",nfCatCurrencyRounded:"货币取整",nfCatDateTime:"日期和时间",nfCatDuration:"持续时间",nfCatCustom:"自定义",nfDecimals:"小数位数",nfThousands:"使用千位分隔符",nfSymbol:"货币符号",nfDateFormat:"日期格式",nfTimeFormat:"时间格式",nfCustomCode:"自定义格式代码",nfPreview:"预览",nfPreviewSample:"示例",find:"查找",findReplace:"查找和替换",findPlaceholder:"查找内容",replacePlaceholder:"替换为",findPrev:"上一个",findNext:"下一个",replace:"替换",replaceAll:"全部替换",findScope:"范围",scopeSheet:"当前工作表",scopeWorkbook:"整个工作簿",scopeSelection:"当前选区",matchCase:"区分大小写",matchEntireCell:"完整匹配",findNoResult:"未找到",findNeedSelection:"请先选择范围",findReplacedAll:"已替换 {n} 处",findClose:"关闭"},"en-US":{insert:"Insert",delete:"Delete",rename:"Rename",moveLeft:"Move Left",moveRight:"Move Right",cut:"Cut",copy:"Copy",paste:"Paste",addSheet:"Add new sheet",moveSheetLeft:"Move Left",moveSheetRight:"Move Right",scrollUp:"Scroll up",scrollDown:"Scroll down",scrollLeft:"Scroll left",scrollRight:"Scroll right",calculate:"Calculate",sum:"Sum",avg:"Average",count:"Count",undo:"Undo",redo:"Redo",paintFormat:"Paint Format",clearFormat:"Clear Format",fontFamily:"Font Family",fontSize:"Font Size",fontSizeIncrease:"Increase Font Size",fontSizeDecrease:"Decrease Font Size",bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",fontColor:"Font Color",fillColor:"Fill Color",borders:"Borders",hAlign:"Horizontal Align",vAlign:"Vertical Align",alignLeft:"Align Left",alignCenter:"Align Center",alignRight:"Align Right",alignTop:"Align Top",alignMiddle:"Align Middle",alignBottom:"Align Bottom",wrap:"Wrap Text",mergeCells:"Merge Cells",mergeCenter:"Merge & Center",mergeAcross:"Merge Across",unmergeCells:"Unmerge Cells",borderBottom:"Bottom Border",borderTop:"Top Border",borderLeft:"Left Border",borderRight:"Right Border",borderNone:"No Border",borderAll:"All Borders",borderOuter:"Outside Borders",borderThickOuter:"Thick Box Border",fontDefault:"Default",rowHeight:"Row Height",colWidth:"Column Width",autoRowHeight:"Auto Row Height",defaultColWidth:"Default Column Width",ok:"OK",cancel:"Cancel",dimNumberError:"Please enter a number",dimRangeError:"Please enter a value between {min} and {max}",colorAutomatic:"Automatic",colorNoFill:"No Fill",colorWhite:"White",colorBlack:"Black",colorLightGray:"Light Gray",colorLightBlue:"Light Blue",colorLightOrange:"Light Orange",colorLightYellow:"Light Yellow",colorLightGreen:"Light Green",colorPaleBlue:"Pale Blue",colorPaleOrange:"Pale Orange",colorPaleYellow:"Pale Yellow",colorPaleGreen:"Pale Green",colorSilver:"Silver",colorSkyBlue:"Sky Blue",colorCoral:"Coral",colorGold:"Gold",colorMint:"Mint",colorGray:"Gray",colorMediumBlue:"Medium Blue",colorOrange:"Orange",colorAmber:"Amber",colorMediumGreen:"Medium Green",colorDarkGray:"Dark Gray",colorRoyalBlue:"Royal Blue",colorRed:"Red",colorDarkGold:"Dark Gold",colorDarkGreen:"Dark Green",colorCharcoal:"Charcoal",colorDeepBlue:"Deep Blue",colorDarkRed:"Dark Red",colorOlive:"Olive",colorForest:"Forest",colorSlate:"Slate",colorNavy:"Navy",colorCrimson:"Crimson",colorDarkOlive:"Dark Olive",colorDeepForest:"Deep Forest",colorDarkSlate:"Dark Slate",colorMidnight:"Midnight",colorMaroon:"Maroon",colorCoffee:"Coffee",colorEvergreen:"Evergreen",colorDarkNavy:"Dark Navy",colorDarkMaroon:"Dark Maroon",colorDarkCoffee:"Dark Coffee",colorInkGreen:"Ink Green",numberFormat:"Number Format",nfGeneral:"General",nfText:"Text",nfNumber:"Number",nfPercent:"Percentage",nfScientific:"Scientific",nfAccounting:"Accounting",nfFinancial:"Financial",nfCurrency:"Currency",nfCurrencyRounded:"Currency Rounded",nfDate:"Date",nfTime:"Time",nfDateTime:"Date & Time",nfDuration:"Duration",nfCustom:"Other Number Formats…",nfMixed:"Mixed",nfDialogTitle:"Format Cells",nfCategory:"Category",nfCatGeneral:"General",nfCatNumber:"Number",nfCatCurrency:"Currency",nfCatAccounting:"Accounting",nfCatFinancial:"Financial",nfCatPercent:"Percentage",nfCatScientific:"Scientific",nfCatDate:"Date",nfCatTime:"Time",nfCatText:"Text",nfCatCurrencyRounded:"Currency Rounded",nfCatDateTime:"Date & Time",nfCatDuration:"Duration",nfCatCustom:"Custom",nfDecimals:"Decimal places",nfThousands:"Use 1000 separator",nfSymbol:"Currency symbol",nfDateFormat:"Date format",nfTimeFormat:"Time format",nfCustomCode:"Custom format code",nfPreview:"Preview",nfPreviewSample:"Sample",find:"Find",findReplace:"Find & Replace",findPlaceholder:"Find what",replacePlaceholder:"Replace with",findPrev:"Previous",findNext:"Next",replace:"Replace",replaceAll:"Replace All",findScope:"Scope",scopeSheet:"Current sheet",scopeWorkbook:"Entire workbook",scopeSelection:"Current selection",matchCase:"Match case",matchEntireCell:"Match entire cell",findNoResult:"No results",findNeedSelection:"Select a range first",findReplacedAll:"Replaced {n} occurrence(s)",findClose:"Close"}};function A(e,n){var o;return((o=uo[e])==null?void 0:o[n])??n}const Pt='-apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif',kt=10,fo=[{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'}],mo=[{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}],po='<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>',go='<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>',ho='<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>',Co='<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>',bo='<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>',yo='<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>',vo=[{value:"left",labelKey:"alignLeft",icon:po},{value:"center",labelKey:"alignCenter",icon:go},{value:"right",labelKey:"alignRight",icon:ho}],wo=[{value:"top",labelKey:"alignTop",icon:Co},{value:"middle",labelKey:"alignMiddle",icon:bo},{value:"bottom",labelKey:"alignBottom",icon:yo}],Nl=[{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>'}],ko={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)"},Eo={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)"},Al="__nf_custom__",nl="",rl="",Ht="@",gl="__NF_INVALID__",Hl=2958465,Vl=0;function Yt(e){return e==null||e===""?!0:e.toUpperCase()==="GENERAL"}function Fl(e){return e==="zh-CN"?"¥":"$"}function Ro(e){return e.replace(/\*/g,"").replace(/_.|_\b/g,"")}function Ol(e){return e.replace(/"([^"]*)"/g,"$1")}function Bo(e){let n=e,o;const l=n.match(/^\[([^\]]+)\]/);l&&(o=l[1].toLowerCase(),n=n.slice(l[0].length)),n=Ro(n);const i=/E[+-]/i.test(n),d=n.includes("%"),r=n.search(/[0#?]/);if(r===-1)return{hasDigits:!1,decimals:0,minDecimals:0,minIntDigits:0,thousands:!1,scale:d?100:1,scientific:!1,prefix:n,suffix:"",color:o};let b=-1;for(let Z=n.length-1;Z>=0;Z--){const J=n[Z];if(J==="0"||J==="#"||J==="?"||J==="E"){b=Z;break}}b<0&&(b=r);const u=r>0?n.slice(0,r):"",k=b<n.length-1?n.slice(b+1):"",M=n.slice(r,b+1),D=/[0#?]/.test(M),w=M.includes(",");let x=M.replace(/,/g,"");if(i){const Z=x.search(/E/i);Z>=0&&(x=x.slice(0,Z))}const le=x.indexOf("."),ne=le>=0?x.slice(0,le):x,p=le>=0?x.slice(le+1):"",V=(p.match(/[0#?]/g)||[]).length,Y=(p.match(/0/g)||[]).length,oe=(ne.match(/0/g)||[]).length;return{hasDigits:D,decimals:V,minDecimals:Y,minIntDigits:oe,thousands:w,scale:d?100:1,scientific:i,prefix:u,suffix:k,color:o}}function xo(e){const n=[];let o=!1;const l=/\[h\]|\[mm\]|\[ss\]|yyyy|yy|y|mmmm|mmm|mm|m|dddd|ddd|dd|d|hh|h|ss|s|AM\/PM|am\/pm|"[^"]*"|\/|-|:|\s+|[^\s]/g;let i;for(;(i=l.exec(e))!==null;){const d=i[0];switch(d){case"[h]":o=!0,n.push({type:"hour",len:0});break;case"[mm]":o=!0,n.push({type:"minute",len:2});break;case"[ss]":o=!0,n.push({type:"second",len:2});break;case"yyyy":n.push({type:"year",len:4});break;case"yy":case"y":n.push({type:"year",len:2});break;case"mmmm":n.push({type:"monthName",len:4});break;case"mmm":n.push({type:"monthName",len:3});break;case"mm":n.push({type:"month",len:2});break;case"m":n.push({type:"month",len:1});break;case"dddd":n.push({type:"weekday",len:4});break;case"ddd":n.push({type:"weekday",len:3});break;case"dd":n.push({type:"day",len:2});break;case"d":n.push({type:"day",len:1});break;case"hh":n.push({type:"hour",len:2});break;case"h":n.push({type:"hour",len:1});break;case"ss":n.push({type:"second",len:2});break;case"s":n.push({type:"second",len:1});break;case"AM/PM":case"am/pm":n.push({type:"ampm",len:2});break;default:d.startsWith('"')?n.push({type:"literal",text:Ol(d),len:0}):n.push({type:"literal",text:d,len:0})}}return{tokens:n,isDuration:o}}const Ll=new Map;function Mo(e){if(/[ydhs]/.test(e)||/AM\/PM/i.test(e)||/\[h\]/i.test(e)){const i=e.split(";")[0]??e,{tokens:d,isDuration:r}=xo(i);return{kind:r?"duration":"date",sections:[],tokens:d,isDuration:r,raw:e}}return{kind:"number",sections:e.split(";").map(i=>Bo(i)),tokens:[],isDuration:!1,raw:e}}function al(e){const n=Ll.get(e);if(n)return n;const o=Mo(e);return Ll.set(e,o),o}function Il(e,n,o,l,i){const d=Math.pow(10,n),r=Math.round((e+Number.EPSILON)*d)/d,b=r<0,u=Math.abs(r);let M=new Intl.NumberFormat("en-US",{useGrouping:l,minimumIntegerDigits:i,minimumFractionDigits:n,maximumFractionDigits:n}).format(u);if(o<n&&n>0){const w=M.indexOf(".");if(w>=0){const B=M.substring(0,w);let x=M.substring(w+1);x=x.replace(/0+$/,""),x.length<o&&(x=x+"0".repeat(o-x.length)),M=x?`${B}.${x}`:B}}return`${b?"-":""}${M}`}function $l(e,n){if(e===0)return(n>0?"0."+"0".repeat(n):"0")+"E+00";const o=Math.floor(Math.log10(Math.abs(e))),l=e/Math.pow(10,o),i=Il(l,n,n,!1,1),d=(o>=0?"+":"-")+String(Math.abs(o)).padStart(2,"0");return`${i}E${d}`}function So(e,n,o){if(!o.hasDigits)return Ol(o.prefix+o.suffix);const l=o.scale===100?e*100:e,i=o.scientific?$l(l,o.decimals):Il(l,o.decimals,o.minDecimals,o.thousands,o.minIntDigits);return n+o.prefix+i+o.suffix}function To(e,n){const o=n.sections;if(o.length===0)return String(e);let l,i,d="";return e>0?(l=o[0],i=e):e<0?o[1]?(l=o[1],i=-e):(l=o[0],i=-e,d="-"):(l=o[2]??o[0],i=0),So(i,d,l)}function Do(e){return new Date((e-25569)*864e5)}const No=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],Ao=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],zl=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],Ho=["January","February","March","April","May","June","July","August","September","October","November","December"],Vo=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Wl=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function _t(e,n){return String(e).padStart(n,"0")}function Fo(e,n,o,l){const i=e.getUTCFullYear(),d=e.getUTCMonth()+1,r=e.getUTCDate(),b=e.getUTCDay(),u=o==="zh-CN";let k="",M=!1;for(const D of n)switch(D.type){case"literal":k+=D.text??"";break;case"year":k+=D.len>=4?String(i):String(i%100).padStart(2,"0");break;case"month":k+=_t(M?e.getUTCMinutes():d,D.len);break;case"monthName":k+=D.len>=4?u?No[d-1]:Ho[d-1]:u?Ao[d-1]:Vo[d-1];break;case"day":k+=_t(r,D.len);break;case"weekday":k+=D.len>=4?u?zl[b]:Wl[b]:u?zl[b].slice(2):Wl[b].slice(0,3);break;case"hour":{let w=e.getUTCHours();if(D.len===0){const B=Math.floor(l*86400);w=Math.floor(B/3600)}k+=String(w),M=!0;break}case"minute":k+=_t(e.getUTCMinutes(),D.len);break;case"second":k+=_t(e.getUTCSeconds(),D.len);break;case"ampm":{const w=e.getUTCHours();k+=w<12?u?"上午":"AM":u?"下午":"PM";break}}return k}function Oo(e,n){const o=Math.floor(e*86400),l=Math.floor(o/3600),i=Math.floor(o%3600/60),d=o%60;let r="";for(const b of n)switch(b.type){case"literal":r+=b.text??"";break;case"hour":r+=String(l);break;case"minute":r+=_t(i,b.len||2);break;case"second":r+=_t(d,b.len||2);break;default:r+=""}return r}function Lo(e){if(e==="")return e;const n=Number(e);if(!isNaN(n)&&e.trim()!==""){const o=Math.abs(n);return o!==0&&(o>=1e15||o<1e-9)?$l(n,9):e}return e}function hl(e,n,o){if(Yt(n))return Lo(e);if(n==null||n===Ht)return e;const l=al(n);if(l.kind==="date"||l.kind==="duration"){const d=Number(e);if(!isFinite(d))return e;if(l.kind==="date"){if(d<Vl||d>Hl)return gl}else if(d<0)return gl;return l.kind==="duration"?Oo(d,l.tokens):Fo(Do(d),l.tokens,o,d)}const i=Number(e);return isNaN(i)?e:To(i,l)}const Io=["general","number","currency","currencyRounded","accounting","financial","percent","scientific","date","time","dateTime","duration","text","custom"];function _l(e,n){if(n===Ht||n==="@")return!1;if(Yt(n)){if(e==null||e===""||e.trim()==="")return!1;const l=Number(e);return!Number.isNaN(l)&&Number.isFinite(l)}const o=al(n);return!!(o.kind==="number"&&Kl(o))}function Kl(e){return e.sections.some(n=>n.hasDigits)}function $o(e){if(e==null||Yt(e)||e===Ht||e==="@")return!1;const n=al(e);return!!(n.kind==="date"||n.kind==="duration"||n.kind==="number"&&Kl(n))}function zo(e,n){if(n==null||Yt(n)||n===Ht||n==="@")return!1;const o=al(n),l=Number(e);return Number.isFinite(l)?o.kind==="date"?l<Vl||l>Hl:o.kind==="duration"?l<0:!1:!1}function Wo(e,n,o,l){const i=Fl(e),d=l?"#,##0":"0",r=o>0?"."+"0".repeat(o):"",b=d+r;switch(n){case"general":return"";case"text":return Ht;case"custom":return"";case"number":return b;case"percent":return b+"%";case"scientific":return"0."+"0".repeat(o)+"E+00";case"currency":return i+b;case"currencyRounded":return i+(l?"#,##0":"0");case"accounting":return`${i}${b};(${i}${b});${i}"-"`;case"financial":return`${b};[Red](${b})`;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 _o(e){const n=Fl(e);return[{label:A(e,"nfGeneral"),value:rl},{label:A(e,"nfText"),value:Ht},{label:A(e,"nfNumber"),value:"#,##0.00"},{label:A(e,"nfPercent"),value:"0.00%"},{label:A(e,"nfScientific"),value:"0.00E+00"},{label:A(e,"nfAccounting"),value:`${n}#,##0.00;(${n}#,##0.00);${n}"-"`},{label:A(e,"nfFinancial"),value:"#,##0.00;[Red](#,##0.00)"},{label:A(e,"nfCurrency"),value:n+"#,##0.00"},{label:A(e,"nfCurrencyRounded"),value:n+"#,##0"},{label:A(e,"nfDate"),value:e==="zh-CN"?'yyyy"年"m"月"d"日"':"m/d/yyyy"},{label:A(e,"nfTime"),value:"h:mm:ss"},{label:A(e,"nfDateTime"),value:e==="zh-CN"?'yyyy"年"m"月"d"日" h:mm:ss':"m/d/yyyy h:mm:ss"},{label:A(e,"nfDuration"),value:"[h]:mm:ss"},{label:A(e,"nfCustom"),value:Al}]}const Ko=["title"],Uo=["innerHTML"],Go={key:1,class:"sp-dropdown__value"},Po=["disabled"],Yo=["onClick"],Xo=["innerHTML"],jo={class:"sp-dropdown__item-label"},Zo=["disabled"],qo=t.defineComponent({__name:"dropdown",props:{modelValue:{},options:{},width:{default:"auto"},menuWidth:{default:void 0},visibleCount:{default:8},title:{default:""},modelOpen:{type:Boolean,default:void 0},hideTrigger:{type:Boolean,default:!1},align:{default:"left"},triggerEl:{default:null},fallbackLabel:{default:""}},emits:["update:modelValue","change","update:modelOpen"],setup(e,{emit:n}){const o=e,l=n,i=t.ref(!1),d=t.ref(0),r=t.ref(null),b=t.ref(null),u=t.ref(null),k=t.ref({top:0,up:!1}),M=t.ref(0),D=t.ref(!1),w=t.computed(()=>o.options.find(se=>String(se.value)===String(o.modelValue))),B=t.computed(()=>o.menuWidth),x=t.computed(()=>Math.min(o.visibleCount,o.options.length)),le=t.computed(()=>o.options.slice(d.value,d.value+x.value)),ne=t.computed(()=>d.value>0),p=t.computed(()=>d.value+x.value<o.options.length),V=t.computed(()=>o.options.length>x.value);function Y(se){d.value=Math.max(0,Math.min(o.options.length-x.value,d.value+se))}function oe(){i.value=!0,o.modelOpen!==void 0&&l("update:modelOpen",!0);const se=o.triggerEl??r.value;if(!se)return;const de=se.getBoundingClientRect(),Se=x.value*22+(V.value?2*15:0)+8,a=window.innerHeight-de.bottom-4<Se&&de.top-4>Se;o.align==="right"?k.value={right:window.innerWidth-de.right,top:a?de.top-Se-4:de.bottom+4,up:a}:k.value={left:de.left,top:a?de.top-Se-4:de.bottom+4,up:a};const m=o.options.findIndex(fe=>String(fe.value)===String(o.modelValue));d.value=m>=0?Math.max(0,Math.min(m-Math.floor(x.value/2),o.options.length-x.value)):0}function Z(){i.value=!1,o.modelOpen!==void 0&&l("update:modelOpen",!1)}function J(){i.value?Z():oe()}function q(se){l("update:modelValue",se.value),l("change",se.value),Z()}function ue(se){var Se,re;if(!i.value)return;const de=se.target;(Se=r.value)!=null&&Se.contains(de)||(re=u.value)!=null&&re.contains(de)||Z()}function Ve(se){i.value&&(se.preventDefault(),Y(se.deltaY>0?1:-1))}t.watch(i,se=>{t.nextTick(()=>{var de,Se;se?(de=b.value)==null||de.addEventListener("wheel",Ve,{passive:!1}):(Se=b.value)==null||Se.removeEventListener("wheel",Ve)})}),t.watch(()=>o.modelOpen,se=>{se!==void 0&&se!==i.value&&(se?oe():Z())});function Oe(se){i.value&&(M.value=se.touches[0].clientY,D.value=!0)}function Je(se){if(!i.value||!D.value)return;const de=se.touches[0].clientY-M.value;Math.abs(de)>5&&(Y(de<0?1:-1),M.value=se.touches[0].clientY)}function Ge(){D.value=!1}function je(se){se.key==="Escape"&&Z()}return t.onMounted(()=>{document.addEventListener("pointerdown",ue),window.addEventListener("resize",Z),window.addEventListener("scroll",Z,!0)}),t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",ue),window.removeEventListener("resize",Z),window.removeEventListener("scroll",Z,!0)}),(se,de)=>{var Se,re;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":i.value}]),title:e.title,onClick:J},[(Se=w.value)!=null&&Se.icon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__icon",innerHTML:w.value.icon},null,8,Uo)):(t.openBlock(),t.createElementBlock("span",Go,t.toDisplayString(((re=w.value)==null?void 0:re.label)??e.fallbackLabel),1)),de[2]||(de[2]=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,Ko)),(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:u,class:t.normalizeClass(["sp-dropdown__menu",{"sp-dropdown__menu--up":k.value.up}]),style:t.normalizeStyle({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",minWidth:B.value!==void 0?typeof B.value=="number"?B.value+"px":B.value:void 0}),onKeydown:je},[V.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!ne.value}]),disabled:!ne.value,onClick:de[0]||(de[0]=a=>Y(-1))},[...de[3]||(de[3]=[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,Po)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"listRef",ref:b,class:"sp-dropdown__list",onTouchstart:Oe,onTouchmove:Je,onTouchend:Ge},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(le.value,a=>(t.openBlock(),t.createElementBlock("button",{key:String(a.value),type:"button",class:t.normalizeClass(["sp-dropdown__item",{"sp-dropdown__item--active":String(a.value)===String(e.modelValue)}]),onClick:m=>q(a)},[a.icon?(t.openBlock(),t.createElementBlock("span",{key:0,class:"sp-dropdown__item-icon",innerHTML:a.icon},null,8,Xo)):t.createCommentVNode("",!0),t.createElementVNode("span",jo,t.toDisplayString(a.label),1)],10,Yo))),128))],544),V.value?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["sp-dropdown__nav",{"sp-dropdown__nav--disabled":!p.value}]),disabled:!p.value,onClick:de[1]||(de[1]=a=>Y(1))},[...de[4]||(de[4]=[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,Zo)):t.createCommentVNode("",!0)],38)):t.createCommentVNode("",!0)]),_:1})]))],4)}}}),vt=(e,n)=>{const o=e.__vccOpts||e;for(const[l,i]of n)o[l]=i;return o},Xt=vt(qo,[["__scopeId","data-v-77df3baf"]]),Jo=["title","onClick"],Ul=vt(t.defineComponent({__name:"colorPicker",props:{modelOpen:{type:Boolean,default:void 0},colorKey:{default:"text"},currentColor:{default:""},locale:{default:"zh-CN"},triggerEl:{default:null}},emits:["update:modelValue","change","update:modelOpen"],setup(e,{expose:n,emit:o}){const l=e,i=o,d=[[{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"}]],b=t.computed(()=>l.colorKey==="fill"?r:d);function u(V){return A(l.locale,V)}function k(V){const Y=l.currentColor;return!Y&&!V?!0:Y?Y.toLowerCase()===V.toLowerCase():!1}const M=t.ref(!1),D=t.ref(null),w=t.ref(null),B=t.ref({top:0});t.watch(()=>l.modelOpen,V=>{V!==void 0&&V!==M.value&&(V?le():ne())});function x(V){const Y=D.value,oe=w.value,Z=V.target;Y&&Y.contains(Z)||oe&&oe.contains(Z)||ne()}function le(){M.value=!0,l.modelOpen!==void 0&&i("update:modelOpen",!0),t.nextTick(()=>{const V=l.triggerEl??D.value;if(V){const Y=V.getBoundingClientRect(),oe=150,Z=120;let J=window.innerWidth-Y.right,q=Y.bottom+4,ue;Y.left-Z<4&&(J=void 0,ue=Math.max(4,Y.left)),q+oe>window.innerHeight-4&&(q=Y.top-oe-4),q<4&&(q=4),B.value=J!==void 0?{right:J,top:q}:{left:ue,top:q}}document.addEventListener("pointerdown",x)})}function ne(){M.value=!1,l.modelOpen!==void 0&&i("update:modelOpen",!1),document.removeEventListener("pointerdown",x)}function p(V){i("update:modelValue",V),i("change",V),ne()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",x)}),n({open:M,openMenu:le,close:ne}),(V,Y)=>(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(()=>[M.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:w,class:"color-picker__menu",style:t.normalizeStyle({left:B.value.left!==void 0?B.value.left+"px":void 0,right:B.value.right!==void 0?B.value.right+"px":void 0,top:B.value.top+"px"}),onMousedown:Y[0]||(Y[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(b.value,(oe,Z)=>(t.openBlock(),t.createElementBlock("div",{key:Z,class:"color-picker__row"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(oe,J=>(t.openBlock(),t.createElementBlock("button",{key:J.value,class:t.normalizeClass(["color-picker__swatch",{"color-picker__swatch--selected":k(J.value)}]),title:u(J.key),style:t.normalizeStyle({background:J.value||"transparent",border:J.value?"1px solid rgba(0,0,0,0.15)":"1px dashed #999"}),onClick:q=>p(J.value)},null,14,Jo))),128))]))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-f8fac424"]]),Qo=["title","onClick"],en={viewBox:"0 0 30 30",class:"border-picker__icon"},tn=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],ln={class:"border-picker__label"},on=vt(t.defineComponent({__name:"borderPicker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},currentBorder:{default:"none"},triggerEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:n,emit:o}){const l=e,i=o,d=[{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}],b={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"]},u={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function k(V,Y){return u[V].includes(Y)?"thick":b[V].includes(Y)?"solid":"dashed"}const M=t.ref(!1),D=t.ref(null),w=t.ref(null),B=t.ref({top:0});t.watch(()=>l.modelOpen,V=>{V!==void 0&&V!==M.value&&(V?le():ne())});function x(V){const Y=D.value,oe=w.value,Z=V.target;Y&&Y.contains(Z)||oe&&oe.contains(Z)||ne()}function le(){M.value=!0,l.modelOpen!==void 0&&i("update:modelOpen",!0),t.nextTick(()=>{const V=l.triggerEl??D.value;if(V){const Y=V.getBoundingClientRect(),oe=200,Z=160;let J=window.innerWidth-Y.right,q=Y.bottom+4,ue;Y.left-Z<4&&(J=void 0,ue=Math.max(4,Y.left)),q+oe>window.innerHeight-4&&(q=Y.top-oe-4),q<4&&(q=4),B.value=J!==void 0?{right:J,top:q}:{left:ue,top:q}}document.addEventListener("pointerdown",x)})}function ne(){M.value=!1,l.modelOpen!==void 0&&i("update:modelOpen",!1),document.removeEventListener("pointerdown",x)}function p(V){i("change",V),ne()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",x)}),n({open:M,openMenu:le,close:ne}),(V,Y)=>(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(()=>[M.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:w,class:"border-picker__menu",style:t.normalizeStyle({left:B.value.left!==void 0?B.value.left+"px":void 0,right:B.value.right!==void 0?B.value.right+"px":void 0,top:B.value.top+"px"}),onMousedown:Y[0]||(Y[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(d,oe=>t.createElementVNode("button",{key:oe.key,class:"border-picker__item",title:t.unref(A)(e.locale,oe.i18nKey),onClick:Z=>p(oe.key)},[(t.openBlock(),t.createElementBlock("svg",en,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(r,Z=>t.createElementVNode("line",{key:Z.name,x1:Z.x1,y1:Z.y1,x2:Z.x2,y2:Z.y2,stroke:"currentColor","stroke-width":k(oe.key,Z.name)==="thick"?3:1.5,"stroke-dasharray":k(oe.key,Z.name)==="dashed"?"0 4":"none","stroke-linecap":k(oe.key,Z.name)==="dashed"?"round":"square"},null,8,tn)),64))])),t.createElementVNode("span",ln,t.toDisplayString(t.unref(A)(e.locale,oe.i18nKey)),1)],8,Qo)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-f362abdb"]]),nn=["title","onClick"],rn=["innerHTML"],an={class:"merge-picker__label"},cn=vt(t.defineComponent({__name:"mergePicker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},triggerEl:{default:null}},emits:["update:modelOpen","change"],setup(e,{expose:n,emit:o}){const l=e,i=o,d=t.ref(!1),r=t.ref(null),b=t.ref(null),u=t.ref({top:0});t.watch(()=>l.modelOpen,B=>{B!==void 0&&B!==d.value&&(B?M():D())});function k(B){const x=r.value,le=b.value,ne=B.target;x&&x.contains(ne)||le&&le.contains(ne)||D()}function M(){d.value=!0,l.modelOpen!==void 0&&i("update:modelOpen",!0),t.nextTick(()=>{const B=l.triggerEl??r.value;if(B){const x=B.getBoundingClientRect(),le=Nl.length*30+12,ne=160;let p=window.innerWidth-x.right,V=x.bottom+4,Y;x.left-ne<4&&(p=void 0,Y=Math.max(4,x.left)),V+le>window.innerHeight-4&&(V=x.top-le-4),V<4&&(V=4),u.value=p!==void 0?{right:p,top:V}:{left:Y,top:V}}document.addEventListener("pointerdown",k)})}function D(){d.value=!1,l.modelOpen!==void 0&&i("update:modelOpen",!1),document.removeEventListener("pointerdown",k)}function w(B){i("change",B),D()}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",k)}),n({open:d,openMenu:M,close:D}),(B,x)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:r,class:"merge-picker"},[(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[d.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuRef",ref:b,class:"merge-picker__menu",style:t.normalizeStyle({left:u.value.left!==void 0?u.value.left+"px":void 0,right:u.value.right!==void 0?u.value.right+"px":void 0,top:u.value.top+"px"}),onMousedown:x[0]||(x[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Nl),le=>(t.openBlock(),t.createElementBlock("button",{key:le.key,class:"merge-picker__item",title:t.unref(A)(e.locale,le.labelKey),onClick:ne=>w(le.key)},[t.createElementVNode("span",{class:"merge-picker__icon",innerHTML:le.icon},null,8,rn),t.createElementVNode("span",an,t.toDisplayString(t.unref(A)(e.locale,le.labelKey)),1)],8,nn))),128))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-67c0f9e3"]]),sn=["disabled","title","onClick"],dn={class:"calc-picker__label"},un=vt(t.defineComponent({__name:"calcPicker",props:{modelOpen:{type:Boolean,default:void 0},locale:{default:"zh-CN"},triggerEl:{default:null},disabled:{type:Boolean,default:!1}},emits:["update:modelOpen","change"],setup(e,{expose:n,emit:o}){const l=e,i=o,d=[{key:"sum",labelKey:"sum"},{key:"avg",labelKey:"avg"},{key:"count",labelKey:"count"}],r=t.ref(!1),b=t.ref(null),u=t.ref(null),k=t.ref({top:0});t.watch(()=>l.modelOpen,x=>{x!==void 0&&x!==r.value&&(x?D():w())});function M(x){const le=b.value,ne=u.value,p=x.target;le&&le.contains(p)||ne&&ne.contains(p)||w()}function D(){r.value=!0,l.modelOpen!==void 0&&i("update:modelOpen",!0),t.nextTick(()=>{const x=l.triggerEl??b.value;if(x){const le=x.getBoundingClientRect(),ne=d.length*30+12,p=160;let V=window.innerWidth-le.right,Y=le.bottom+4,oe;le.left-p<4&&(V=void 0,oe=Math.max(4,le.left)),Y+ne>window.innerHeight-4&&(Y=le.top-ne-4),Y<4&&(Y=4),k.value=V!==void 0?{right:V,top:Y}:{left:oe,top:Y}}document.addEventListener("pointerdown",M)})}function w(){r.value=!1,l.modelOpen!==void 0&&i("update:modelOpen",!1),document.removeEventListener("pointerdown",M)}function B(x){l.disabled||(i("change",x),w())}return t.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",M)}),n({open:r,openMenu:D,close:w}),(x,le)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootRef",ref:b,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:u,class:"calc-picker__menu",style:t.normalizeStyle({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"}),onMousedown:le[0]||(le[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(d,ne=>t.createElementVNode("button",{key:ne.key,class:t.normalizeClass(["calc-picker__item",{"calc-picker__item--disabled":e.disabled}]),disabled:e.disabled,title:t.unref(A)(e.locale,ne.labelKey),onClick:p=>B(ne.key)},[t.createElementVNode("span",dn,t.toDisplayString(t.unref(A)(e.locale,ne.labelKey)),1)],10,sn)),64))],36)):t.createCommentVNode("",!0)]),_:1})]))],512))}}),[["__scopeId","data-v-9029e58c"]]),fn={class:"tb-item","data-key":"undo"},mn=["title","disabled"],pn={class:"tb-item","data-key":"redo"},gn=["title","disabled"],hn={class:"tb-item","data-key":"paint"},Cn=["title","disabled"],bn={class:"tb-item","data-key":"clear"},yn=["title","disabled"],vn={class:"tb-item","data-key":"font"},wn={class:"tb-item","data-key":"fontSize"},kn={class:"toolbar-font-size"},En=["value","title"],Rn=["title"],Bn=["title","disabled"],xn=["title","disabled"],Mn={class:"tb-item","data-key":"bold"},Sn=["title","disabled"],Tn={class:"tb-item","data-key":"italic"},Dn=["title","disabled"],Nn={class:"tb-item","data-key":"underline"},An=["title","disabled"],Hn={class:"tb-item","data-key":"strike"},Vn=["title","disabled"],Fn={class:"tb-item","data-key":"textColor"},On={class:"toolbar-split"},Ln=["title","disabled"],In={viewBox:"0 0 1024 1024",fill:"currentColor"},$n=["fill"],zn=["title","disabled"],Wn={class:"tb-item","data-key":"fillColor"},_n={class:"toolbar-split"},Kn=["title","disabled"],Un={viewBox:"0 0 1024 1024",fill:"currentColor"},Gn=["fill"],Pn=["title","disabled"],Yn={class:"tb-item","data-key":"border"},Xn={class:"toolbar-split"},jn=["title","disabled"],Zn={viewBox:"0 0 30 30",fill:"none",stroke:"currentColor"},qn=["x1","y1","x2","y2","stroke-width","stroke-dasharray","stroke-linecap"],Jn=["title","disabled"],Qn={class:"tb-item","data-key":"hAlign"},er={class:"tb-item","data-key":"vAlign"},tr={class:"tb-item","data-key":"wrap"},lr=["title"],or={class:"tb-item","data-key":"merge"},nr={class:"toolbar-split"},rr=["title","disabled"],ar=["title","disabled"],ir={class:"tb-item","data-key":"numFmt"},cr={class:"tb-item","data-key":"calc"},sr={class:"toolbar-split"},dr=["title","disabled"],ur=["title","disabled"],fr={class:"tb-item","data-key":"find"},mr=["title"],Cl=2,pr=6,gr=34,hr=vt(t.defineComponent({__name:"toolbar",props:{locale:{},canUndo:{type:Boolean},canRedo:{type:Boolean},paintFmtActive:{type:Boolean},hasSelection:{type:Boolean},fontFamilyOptions:{},fontSizeOptions:{},selFontFamily:{},selFontSize:{},fontSizeInput:{},fontSizeMenuOpen:{type:Boolean},selFontWeight:{type:Boolean},selFontStyle:{type:Boolean},selUnderline:{type:Boolean},selStrikethrough:{type:Boolean},selTextColor:{},textColorMenuOpen:{type:Boolean},selFillColor:{},fillColorMenuOpen:{type:Boolean},cachedTextColor:{},cachedFillColor:{},borderMenuOpen:{type:Boolean},cachedBorder:{},selHAlign:{},selVAlign:{},selWrap:{type:Boolean},hAlignOptions:{},vAlignOptions:{},mergeMenuOpen:{type:Boolean},calcMenuOpen:{type:Boolean},isSingleCell:{type:Boolean},themeVars:{},selNumberFormat:{},nfOptions:{}},emits:["undo","redo","paint-format","clear-format","font-size-blur","font-size-toggle","font-size-step-up","font-size-step-down","bold-toggle","italic-toggle","underline-toggle","strikethrough-toggle","apply-text-color","apply-fill-color","apply-border","wrap-toggle","apply-merge","calc-sum","calc-avg","calc-count","font-family-change","font-size-change","h-align-change","v-align-change","font-size-input","text-color-change","fill-color-change","number-format-change","font-size-keydown","find","update:font-size-menu-open","update:text-color-menu-open","update:fill-color-menu-open","update:border-menu-open","update:merge-menu-open","update:calc-menu-open","border-change","merge-change"],setup(e,{emit:n}){const o=[{name:"top",x1:4,y1:4,x2:26,y2:4},{name:"bottom",x1:4,y1:26,x2:26,y2:26},{name:"left",x1:4,y1:4,x2:4,y2:26},{name:"right",x1:26,y1:4,x2:26,y2:26},{name:"vMid",x1:15,y1:4,x2:15,y2:26},{name:"hMid",x1:4,y1:15,x2:26,y2:15}],l={bottom:["bottom"],top:["top"],left:["left"],right:["right"],none:[],all:["top","bottom","left","right","vMid","hMid"],outer:["top","bottom","left","right"],thickOuter:["top","bottom","left","right"]},i={bottom:[],top:[],left:[],right:[],none:[],all:[],outer:[],thickOuter:["top","bottom","left","right"]};function d(E,s){return i[E].includes(s)?"thick":l[E].includes(s)?"solid":"dashed"}const r=["undo","redo","paint","clear","sep1","font","fontSize","sep2","bold","italic","underline","strike","sep3","textColor","fillColor","border","sep4","hAlign","vAlign","wrap","merge","sep6","numFmt","sep7","calc","find"],b=t.ref(null),u=t.ref(null),k=t.ref(null),M=t.ref(null),D=t.ref(null),w=t.ref(null),B=t.ref(null),x=t.ref(null),le=t.ref(null),ne=t.ref(new Set),p=t.ref(!1),V=t.ref(!1),Y=t.ref(0),oe=new Map,Z=t.computed(()=>ne.value.size>0);function J(E){return ne.value.has(E)}const q=t.computed(()=>{const E=u.value;return E instanceof HTMLElement?E:void 0});function ue(E){return q.value?!J(E):!0}function Ve(){for(const E of r){const s=oe.get(E);if(s===void 0||s===0)return!0}return!1}function Oe(){if(!b.value)return;b.value.querySelectorAll(".tb-item").forEach(s=>{const v=s.dataset.key;if(!v)return;const R=s.offsetWidth;R>0?oe.set(v,R):oe.has(v)||oe.set(v,0)})}function Je(E,s){if(E.size!==s.size)return!1;for(const v of E)if(!s.has(v))return!1;return!0}let Ge=0,je=0;function se(){Ge&&cancelAnimationFrame(Ge),!(je>60)&&(je++,Ge=requestAnimationFrame(()=>requestAnimationFrame(de)))}function de(){if(!b.value)return;const E=b.value.clientWidth-pr*2;if(E<=0){se();return}je=0,(oe.size===0||Ve())&&Oe();let s=0;for(const R of r)s+=(oe.get(R)??0)+Cl;const v=new Set;if(s>E){const R=E-gr-Cl;let W=0;for(let U=0;U<r.length;U++){const De=r[U],Fe=(oe.get(De)??0)+Cl;if(W+Fe>R){for(let ze=U;ze<r.length;ze++)v.add(r[ze]);break}W+=Fe}}Je(v,ne.value)||(ne.value=v,Y.value++,v.size===0&&(p.value=!1))}let Se=null;const re=t.ref(0),a=t.computed(()=>{const E=k.value,s={position:"fixed",top:"0px",right:"0px"};if(!E)return{...S.themeVars,...s};re.value;const v=E.getBoundingClientRect();return{...S.themeVars,position:"fixed",top:`${v.bottom+4}px`,right:`${window.innerWidth-v.right}px`}});function m(){p.value&&(re.value++,t.nextTick(()=>de()))}function fe(E){var v,R;if(!p.value)return;const s=E.target;(v=u.value)!=null&&v.contains(s)||(R=k.value)!=null&&R.contains(s)||(V.value=!0,p.value=!1,t.nextTick(()=>{V.value=!1}))}function Te(){p.value=!p.value}function f(){p.value=!1,y("find")}t.onMounted(()=>{se(),b.value&&(Se=new ResizeObserver(()=>{p.value||se()}),Se.observe(b.value)),document.addEventListener("pointerdown",fe,!0),window.addEventListener("resize",m),window.addEventListener("load",se),window.addEventListener("orientationchange",se)}),t.onBeforeUnmount(()=>{Ge&&cancelAnimationFrame(Ge),Se==null||Se.disconnect(),document.removeEventListener("pointerdown",fe,!0),window.removeEventListener("resize",m),window.removeEventListener("load",se),window.removeEventListener("orientationchange",se)});const S=e,y=n,_=t.computed(()=>S.selNumberFormat===nl?A(S.locale,"nfMixed"):"");return(E,s)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{ref_key:"rootEl",ref:b,class:"toolbar"},[(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("undo"),to:q.value},[t.createElementVNode("div",fn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canUndo}]),title:t.unref(A)(e.locale,"undo"),disabled:!e.canUndo,onClick:s[0]||(s[0]=v=>y("undo"))},[...s[44]||(s[44]=[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,mn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("redo"),to:q.value},[t.createElementVNode("div",pn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.canRedo}]),title:t.unref(A)(e.locale,"redo"),disabled:!e.canRedo,onClick:s[1]||(s[1]=v=>y("redo"))},[...s[45]||(s[45]=[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,gn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("paint"),to:q.value},[t.createElementVNode("div",hn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.paintFmtActive}]),title:t.unref(A)(e.locale,"paintFormat"),disabled:!e.hasSelection,onClick:s[2]||(s[2]=v=>y("paint-format"))},[...s[46]||(s[46]=[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,Cn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("clear"),to:q.value},[t.createElementVNode("div",bn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--disabled":!e.hasSelection}]),title:t.unref(A)(e.locale,"clearFormat"),disabled:!e.hasSelection,onClick:s[3]||(s[3]=v=>y("clear-format"))},[...s[47]||(s[47]=[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,yn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("sep1"),to:q.value},[s[48]||(s[48]=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:ue("font"),to:q.value},[t.createElementVNode("div",vn,[t.createVNode(Xt,{class:"toolbar-font","model-value":e.selFontFamily,options:e.fontFamilyOptions,width:J("font")?"100%":110,"menu-width":J("font")?120:void 0,"visible-count":8,title:t.unref(A)(e.locale,"fontFamily"),align:"right",onChange:s[4]||(s[4]=v=>y("font-family-change",v))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("fontSize"),to:q.value},[t.createElementVNode("div",wn,[t.createElementVNode("div",kn,[t.createElementVNode("input",{class:"toolbar-font-size__input",type:"number",min:"5",max:"72",step:"1",value:e.fontSizeInput,title:t.unref(A)(e.locale,"fontSize"),onInput:s[5]||(s[5]=v=>y("font-size-input",v.target.value)),onBlur:s[6]||(s[6]=v=>y("font-size-blur")),onKeydown:s[7]||(s[7]=v=>y("font-size-keydown",v))},null,40,En),t.createVNode(Xt,{class:"toolbar-font-size__dropdown","model-value":e.selFontSize,options:e.fontSizeOptions,width:J("fontSize")?"100%":56,"menu-width":J("fontSize")?120:56,"visible-count":9,title:t.unref(A)(e.locale,"fontSize"),"hide-trigger":!0,"model-open":e.fontSizeMenuOpen,align:"right","trigger-el":le.value,"onUpdate:modelOpen":s[8]||(s[8]=v=>y("update:font-size-menu-open",v)),onChange:s[9]||(s[9]=v=>y("font-size-change",v))},null,8,["model-value","options","width","menu-width","title","model-open","trigger-el"]),t.createElementVNode("button",{ref_key:"fontSizeArrowRef",ref:le,class:"toolbar-font-size__btn",type:"button",title:t.unref(A)(e.locale,"fontSize"),onMousedown:s[10]||(s[10]=t.withModifiers(()=>{},["prevent"])),onClick:s[11]||(s[11]=v=>y("font-size-toggle"))},[...s[49]||(s[49]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053333 361.386667a32 32 0 0 1 45.226667 0L512 648.106667l286.72-286.72a32 32 0 1 1 45.226667 45.226666l-309.333334 309.333334a32 32 0 0 1-45.226666 0L180.053333 406.613333a32 32 0 0 1 0-45.226666z"})],-1)])],40,Rn),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(A)(e.locale,"fontSizeDecrease"),disabled:!e.hasSelection,onMousedown:s[12]||(s[12]=t.withModifiers(()=>{},["prevent"])),onClick:s[13]||(s[13]=v=>y("font-size-step-down"))},[...s[50]||(s[50]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M481.28 125.95a29.506 29.506 0 0 0-27.45-18.7h-63.34c-12.13 0-23.02 7.42-27.45 18.7L67.94 876.46c-7.61 19.35 6.66 40.29 27.45 40.29h35.47c12.26 0 23.24-7.58 27.58-19.04l80.89-213.35h364.54l81.94 213.46a29.51 29.51 0 0 0 27.54 18.93h35.56c20.8 0 35.06-20.94 27.45-40.29L481.28 125.95zM273.47 594.06l145.38-384.38h2.2l147.58 384.38H273.47zM928.64 195.74h-177c-16.29 0-29.5 13.21-29.5 29.5s13.21 29.5 29.5 29.5h177c16.29 0 29.5-13.21 29.5-29.5s-13.21-29.5-29.5-29.5z"})],-1)])],40,Bn),t.createElementVNode("button",{class:"toolbar-btn toolbar-btn--step",type:"button",title:t.unref(A)(e.locale,"fontSizeIncrease"),disabled:!e.hasSelection,onMousedown:s[14]||(s[14]=t.withModifiers(()=>{},["prevent"])),onClick:s[15]||(s[15]=v=>y("font-size-step-up"))},[...s[51]||(s[51]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M481.28 125.95a29.506 29.506 0 0 0-27.45-18.7h-63.34c-12.13 0-23.02 7.42-27.45 18.7L67.94 876.46c-7.61 19.35 6.66 40.29 27.45 40.29h35.47c12.26 0 23.24-7.58 27.58-19.04l80.89-213.35h364.54l81.94 213.46a29.51 29.51 0 0 0 27.54 18.93h35.56c20.8 0 35.06-20.94 27.45-40.29L481.28 125.95zM273.47 594.06l145.38-384.38h2.2l147.58 384.38H273.47zM928.64 195.74h-59v-59c0-16.29-13.21-29.5-29.5-29.5s-29.5 13.21-29.5 29.5v59h-59c-16.29 0-29.5 13.21-29.5 29.5s13.21 29.5 29.5 29.5h59v59c0 16.29 13.21 29.5 29.5 29.5s29.5-13.21 29.5-29.5v-59h59c16.29 0 29.5-13.21 29.5-29.5s-13.21-29.5-29.5-29.5z"})],-1)])],40,xn)])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("sep2"),to:q.value},[s[52]||(s[52]=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:ue("bold"),to:q.value},[t.createElementVNode("div",Mn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontWeight}]),title:t.unref(A)(e.locale,"bold"),disabled:!e.hasSelection,onClick:s[16]||(s[16]=v=>y("bold-toggle"))},[...s[53]||(s[53]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[t.createElementVNode("path",{d:"M733.610667 467.712A267.562667 267.562667 0 0 0 548.010667 10.581333H183.466667a53.333333 53.333333 0 0 0 0 106.666667h43.221333a10.666667 10.666667 0 0 1 10.666667 10.666667V896a10.666667 10.666667 0 0 1-10.666667 10.666667H183.466667a53.333333 53.333333 0 1 0 0 106.666666h425.088a287.658667 287.658667 0 0 0 125.013333-545.536z m-185.6-350.464a160.512 160.512 0 0 1 0 320.981333H354.688a10.666667 10.666667 0 0 1-10.666667-10.666666V128a10.666667 10.666667 0 0 1 10.666667-10.666667z m60.586666 789.333333H354.688a10.666667 10.666667 0 0 1-10.666667-10.666666v-340.352a10.666667 10.666667 0 0 1 10.666667-10.666667H608.597333a180.864 180.864 0 0 1 0 361.685333z"})])],-1)])],10,Sn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("italic"),to:q.value},[t.createElementVNode("div",Tn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selFontStyle}]),title:t.unref(A)(e.locale,"italic"),disabled:!e.hasSelection,onClick:s[17]||(s[17]=v=>y("italic-toggle"))},[...s[54]||(s[54]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[t.createElementVNode("path",{d:"M960 10.581333h-325.845333a53.333333 53.333333 0 0 0 0 106.666667h46.336a10.666667 10.666667 0 0 1 9.002666 16.384L203.946667 896.725333a21.333333 21.333333 0 0 1-18.005334 9.856H64a53.333333 53.333333 0 0 0 0 106.666667h325.845333a53.333333 53.333333 0 0 0 0-106.666667H343.509333a10.666667 10.666667 0 0 1-9.002666-16.384L820.053333 127.146667a21.333333 21.333333 0 0 1 18.005334-9.898667H960a53.333333 53.333333 0 0 0 0-106.666667z"})])],-1)])],10,Dn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("underline"),to:q.value},[t.createElementVNode("div",Nn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selUnderline}]),title:t.unref(A)(e.locale,"underline"),disabled:!e.hasSelection,onClick:s[18]||(s[18]=v=>y("underline-toggle"))},[...s[55]||(s[55]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[t.createElementVNode("path",{d:"M960 906.581333h-896a53.333333 53.333333 0 0 0 0 106.666667h896a53.333333 53.333333 0 0 0 0-106.666667zM84.394667 117.248h58.154666a10.666667 10.666667 0 0 1 10.666667 10.666667v363.648a358.784 358.784 0 0 0 717.568 0V128a10.666667 10.666667 0 0 1 10.666667-10.666667h58.154666a53.333333 53.333333 0 0 0 0-106.666666H695.466667a53.333333 53.333333 0 0 0 0 106.666666h58.154666a10.666667 10.666667 0 0 1 10.666667 10.666667v363.648a252.117333 252.117333 0 0 1-504.234667 0V128a10.666667 10.666667 0 0 1 10.666667-10.666667H328.533333a53.333333 53.333333 0 1 0 0-106.666666H84.394667a53.333333 53.333333 0 0 0 0 106.666666z"})])],-1)])],10,An)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("strike"),to:q.value},[t.createElementVNode("div",Hn,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selStrikethrough}]),title:t.unref(A)(e.locale,"strikethrough"),disabled:!e.hasSelection,onClick:s[19]||(s[19]=v=>y("strikethrough-toggle"))},[...s[56]||(s[56]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("g",{transform:"translate(102.4, 102.4) scale(0.8)"},[t.createElementVNode("path",{d:"M1013.333333 552.618667A53.333333 53.333333 0 0 0 960 499.2h-381.269333a20.992 20.992 0 0 1-12.032-3.84c-30.805333-21.888-63.232-41.856-94.634667-61.098667-119.466667-73.173333-192-123.733333-192-207.488 0-95.36 94.165333-109.610667 150.314667-109.610666a193.706667 193.706667 0 0 1 131.456 32.597333 113.578667 113.578667 0 0 1 19.072 84.906667v12.8a53.333333 53.333333 0 1 0 106.666666 0v-11.434667a208.512 208.512 0 0 0-49.706666-161.152C595.157333 31.616 527.317333 10.581333 430.549333 10.581333c-156.074667 0-256.981333 84.864-256.981333 216.277334 0 118.314667 80.725333 192.512 170.666667 252.885333a10.666667 10.666667 0 0 1-5.930667 19.541333H64a53.333333 53.333333 0 0 0 0 106.666667h468.352a10.709333 10.709333 0 0 1 6.784 2.474667 185.130667 185.130667 0 0 1 82.432 147.882666c0 139.434667-146.176 150.272-191.018667 150.272-77.397333 0-133.930667-17.28-163.584-50.048a144.810667 144.810667 0 0 1-27.733333-115.2 53.333333 53.333333 0 0 0-106.154667-10.496A245.76 245.76 0 0 0 187.733333 928.128c51.2 56.490667 132.864 85.333333 242.688 85.333333 178.090667 0 297.685333-103.253333 297.685334-256.938666a258.517333 258.517333 0 0 0-36.224-134.272 10.666667 10.666667 0 0 1 9.216-16.085334H960a53.333333 53.333333 0 0 0 53.333333-53.546666z"})])],-1)])],10,Vn)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("sep3"),to:q.value},[s[57]||(s[57]=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:ue("textColor"),to:q.value},[t.createElementVNode("div",Fn,[t.createElementVNode("div",On,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(A)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:s[20]||(s[20]=v=>y("apply-text-color"))},[(t.openBlock(),t.createElementBlock("svg",In,[s[58]||(s[58]=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,$n)]))],8,Ln),t.createElementVNode("button",{ref_key:"textColorArrowRef",ref:M,class:"toolbar-btn toolbar-split__arrow",title:t.unref(A)(e.locale,"fontColor"),disabled:!e.hasSelection,onClick:s[21]||(s[21]=v=>y("update:text-color-menu-open",!e.textColorMenuOpen))},[...s[59]||(s[59]=[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,zn),t.createVNode(Ul,{"model-open":e.textColorMenuOpen,"color-key":"text","current-color":e.selTextColor,locale:e.locale,"trigger-el":M.value,"onUpdate:modelOpen":s[22]||(s[22]=v=>y("update:text-color-menu-open",v)),onChange:s[23]||(s[23]=v=>y("text-color-change",v))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("fillColor"),to:q.value},[t.createElementVNode("div",Wn,[t.createElementVNode("div",_n,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(A)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:s[24]||(s[24]=v=>y("apply-fill-color"))},[(t.openBlock(),t.createElementBlock("svg",Un,[s[60]||(s[60]=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,Gn)]))],8,Kn),t.createElementVNode("button",{ref_key:"fillColorArrowRef",ref:D,class:"toolbar-btn toolbar-split__arrow",title:t.unref(A)(e.locale,"fillColor"),disabled:!e.hasSelection,onClick:s[25]||(s[25]=v=>y("update:fill-color-menu-open",!e.fillColorMenuOpen))},[...s[61]||(s[61]=[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,Pn),t.createVNode(Ul,{"model-open":e.fillColorMenuOpen,"color-key":"fill","current-color":e.selFillColor,locale:e.locale,"trigger-el":D.value,"onUpdate:modelOpen":s[26]||(s[26]=v=>y("update:fill-color-menu-open",v)),onChange:s[27]||(s[27]=v=>y("fill-color-change",v))},null,8,["model-open","current-color","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("border"),to:q.value},[t.createElementVNode("div",Yn,[t.createElementVNode("div",Xn,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(A)(e.locale,"borders"),disabled:!e.hasSelection,onClick:s[28]||(s[28]=v=>y("apply-border"))},[(t.openBlock(),t.createElementBlock("svg",Zn,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(o,v=>t.createElementVNode("line",{key:v.name,x1:v.x1,y1:v.y1,x2:v.x2,y2:v.y2,"stroke-width":d(e.cachedBorder,v.name)==="thick"?3:1.5,"stroke-dasharray":d(e.cachedBorder,v.name)==="dashed"?"0 4":"none","stroke-linecap":d(e.cachedBorder,v.name)==="dashed"?"round":"square"},null,8,qn)),64))]))],8,jn),t.createElementVNode("button",{ref_key:"borderArrowRef",ref:w,class:"toolbar-btn toolbar-split__arrow",title:t.unref(A)(e.locale,"borders"),disabled:!e.hasSelection,onClick:s[29]||(s[29]=v=>y("update:border-menu-open",!e.borderMenuOpen))},[...s[62]||(s[62]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,Jn),t.createVNode(on,{"model-open":e.borderMenuOpen,locale:e.locale,"current-border":e.cachedBorder,"trigger-el":w.value,"onUpdate:modelOpen":s[30]||(s[30]=v=>y("update:border-menu-open",v)),onChange:s[31]||(s[31]=v=>y("border-change",v))},null,8,["model-open","locale","current-border","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("sep4"),to:q.value},[s[63]||(s[63]=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:ue("hAlign"),to:q.value},[t.createElementVNode("div",Qn,[t.createVNode(Xt,{class:"toolbar-align","model-value":e.selHAlign,options:e.hAlignOptions,width:J("hAlign")?"100%":44,"menu-width":J("hAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(A)(e.locale,"hAlign"),onChange:s[32]||(s[32]=v=>y("h-align-change",v))},null,8,["model-value","options","width","menu-width","title"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("vAlign"),to:q.value},[t.createElementVNode("div",er,[t.createVNode(Xt,{class:"toolbar-align","model-value":e.selVAlign,options:e.vAlignOptions,width:J("vAlign")?"100%":44,"menu-width":J("vAlign")?120:void 0,"visible-count":3,align:"right",title:t.unref(A)(e.locale,"vAlign"),onChange:s[33]||(s[33]=v=>y("v-align-change",v))},null,8,["model-value","options","width","menu-width","title"])]),t.createElementVNode("div",tr,[t.createElementVNode("button",{class:t.normalizeClass(["toolbar-btn",{"toolbar-btn--active":e.selWrap}]),type:"button",title:t.unref(A)(e.locale,"wrap"),onClick:s[34]||(s[34]=v=>y("wrap-toggle"))},[...s[64]||(s[64]=[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,lr)])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("merge"),to:q.value},[t.createElementVNode("div",or,[t.createElementVNode("div",nr,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(A)(e.locale,"mergeCenter"),disabled:!e.hasSelection,onClick:s[35]||(s[35]=v=>y("apply-merge"))},[...s[65]||(s[65]=[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,rr),t.createElementVNode("button",{ref_key:"mergeArrowRef",ref:B,class:"toolbar-btn toolbar-split__arrow",title:t.unref(A)(e.locale,"mergeCells"),disabled:!e.hasSelection,onClick:s[36]||(s[36]=v=>y("update:merge-menu-open",!e.mergeMenuOpen))},[...s[66]||(s[66]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z"})],-1)])],8,ar),t.createVNode(cn,{"model-open":e.mergeMenuOpen,locale:e.locale,"trigger-el":B.value,"onUpdate:modelOpen":s[37]||(s[37]=v=>y("update:merge-menu-open",v)),onChange:s[38]||(s[38]=v=>y("merge-change",v))},null,8,["model-open","locale","trigger-el"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("sep6"),to:q.value},[s[67]||(s[67]=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:ue("numFmt"),to:q.value},[t.createElementVNode("div",ir,[t.createVNode(Xt,{class:"toolbar-number-format","model-value":e.selNumberFormat,options:e.nfOptions,width:J("numFmt")?"100%":92,"menu-width":(J("numFmt"),150),"visible-count":8,title:t.unref(A)(e.locale,"numberFormat"),"fallback-label":_.value,align:"right",onChange:s[39]||(s[39]=v=>y("number-format-change",String(v)))},null,8,["model-value","options","width","menu-width","title","fallback-label"])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("sep7"),to:q.value},[s[68]||(s[68]=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:ue("calc"),to:q.value},[t.createElementVNode("div",cr,[t.createElementVNode("div",sr,[t.createElementVNode("button",{class:"toolbar-btn toolbar-split__main",title:t.unref(A)(e.locale,"sum"),disabled:!e.hasSelection||e.isSingleCell,onClick:s[40]||(s[40]=v=>y("calc-sum"))},[...s[69]||(s[69]=[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,dr),t.createElementVNode("button",{ref_key:"calcArrowRef",ref:x,class:"toolbar-btn toolbar-split__arrow",title:t.unref(A)(e.locale,"calculate"),disabled:!e.hasSelection,onClick:s[41]||(s[41]=v=>y("update:calc-menu-open",!e.calcMenuOpen))},[...s[70]||(s[70]=[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,ur),t.createVNode(un,{"model-open":e.calcMenuOpen,locale:e.locale,"trigger-el":x.value,disabled:e.isSingleCell,"onUpdate:modelOpen":s[42]||(s[42]=v=>y("update:calc-menu-open",v)),onChange:s[43]||(s[43]=v=>y(`calc-${v}`))},null,8,["model-open","locale","trigger-el","disabled"])])])],8,["disabled","to"])),(t.openBlock(),t.createBlock(t.Teleport,{disabled:ue("find"),to:q.value},[t.createElementVNode("div",fr,[t.createElementVNode("button",{class:"toolbar-btn",title:t.unref(A)(e.locale,"find"),onClick:f},[...s[71]||(s[71]=[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,mr)])],8,["disabled","to"])),Z.value?(t.openBlock(),t.createElementBlock("button",{key:0,ref_key:"moreBtnEl",ref:k,class:t.normalizeClass(["toolbar-more",{"toolbar-more--active":p.value}]),type:"button",onClick:Te},[...s[72]||(s[72]=[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)],512),(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:u,key:Y.value,class:t.normalizeClass(["overflow-menu",{"no-anim":V.value}]),style:t.normalizeStyle(a.value)},null,6)),[[t.vShow,p.value]])]),_:1})]))],64))}}),[["__scopeId","data-v-a54ebf3e"]]),Cr={class:"tab-list"},br=["onClick","onDblclick","onContextmenu"],yr=["value"],vr={key:1,class:"tab-item__name"},wr=["title"],kr=vt(t.defineComponent({__name:"tabbar",props:{locale:{},sheets:{},activeSheetIndex:{},renTab:{},renTabVal:{}},emits:["tab-click","tab-dblclick","tab-contextmenu","tab-rename-input","tab-rename-keydown","tab-rename-commit","add-sheet","tabbar-contextmenu"],setup(e,{emit:n}){const o=n;return(l,i)=>(t.openBlock(),t.createElementBlock("div",{class:"tab-bar",onContextmenu:i[5]||(i[5]=d=>o("tabbar-contextmenu",d))},[t.createElementVNode("div",Cr,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.sheets,(d,r)=>(t.openBlock(),t.createElementBlock("div",{key:d.id,class:t.normalizeClass(["tab-item",{"tab-item--active":r===e.activeSheetIndex}]),onClick:b=>o("tab-click",r),onDblclick:t.withModifiers(b=>o("tab-dblclick",r),["prevent"]),onContextmenu:b=>o("tab-contextmenu",{ev:b,i:r})},[e.renTab===r?(t.openBlock(),t.createElementBlock("input",{key:0,class:"tab-rename-input",value:e.renTabVal,onInput:i[0]||(i[0]=b=>o("tab-rename-input",b.target.value)),onKeydown:i[1]||(i[1]=b=>o("tab-rename-keydown",b)),onBlur:i[2]||(i[2]=b=>o("tab-rename-commit")),onClick:i[3]||(i[3]=t.withModifiers(()=>{},["stop"]))},null,40,yr)):(t.openBlock(),t.createElementBlock("span",vr,t.toDisplayString(d.name),1))],42,br))),128))]),t.createElementVNode("button",{class:"tab-bar__add-btn",title:t.unref(A)(e.locale,"addSheet"),onClick:i[4]||(i[4]=d=>o("add-sheet"))}," + ",8,wr)],32))}}),[["__scopeId","data-v-454e1a12"]]),Er=["placeholder","value"],Rr=["placeholder","value"],Br=["value","title"],xr={value:"sheet"},Mr={value:"workbook"},Sr={value:"selection"},Tr={class:"find-bar__chk"},Dr=["checked"],Nr={class:"find-bar__chk"},Ar=["checked"],Hr={class:"find-bar__count"},Vr=["title","disabled"],Fr=["title","disabled"],Or=["disabled"],Lr=["disabled"],Ir=["title"],$r=vt(t.defineComponent({__name:"find-replace-bar",props:{open:{type:Boolean},findText:{},replaceText:{},scope:{},matchCase:{type:Boolean},matchEntireCell:{type:Boolean},currentIndex:{},total:{},message:{},focusToken:{},locale:{},themeVars:{}},emits:["update:findText","update:replaceText","update:scope","update:matchCase","update:matchEntireCell","prev","next","replace","replace-all","close"],setup(e,{emit:n}){const o=e,l=n,i=t.ref(null),d=t.computed(()=>o.total>0?`${o.currentIndex+1}/${o.total}`:o.message||"");t.watch(()=>o.focusToken,()=>{t.nextTick(()=>{var u;return(u=i.value)==null?void 0:u.focus()})});function r(u){u.key==="Enter"?(u.preventDefault(),u.shiftKey?l("prev"):l("next")):u.key==="Escape"&&(u.preventDefault(),l("close"))}function b(u){l("update:scope",u.target.value)}return(u,k)=>e.open?(t.openBlock(),t.createElementBlock("div",{key:0,class:"find-bar",style:t.normalizeStyle(e.themeVars)},[t.createElementVNode("input",{ref_key:"findInputRef",ref:i,class:"find-bar__input",placeholder:t.unref(A)(e.locale,"findPlaceholder"),value:e.findText,onInput:k[0]||(k[0]=M=>l("update:findText",M.target.value)),onKeydown:r},null,40,Er),t.createElementVNode("input",{class:"find-bar__input",placeholder:t.unref(A)(e.locale,"replacePlaceholder"),value:e.replaceText,onInput:k[1]||(k[1]=M=>l("update:replaceText",M.target.value)),onKeydown:r},null,40,Rr),t.createElementVNode("select",{class:"find-bar__select",value:e.scope,title:t.unref(A)(e.locale,"findScope"),onChange:b},[t.createElementVNode("option",xr,t.toDisplayString(t.unref(A)(e.locale,"scopeSheet")),1),t.createElementVNode("option",Mr,t.toDisplayString(t.unref(A)(e.locale,"scopeWorkbook")),1),t.createElementVNode("option",Sr,t.toDisplayString(t.unref(A)(e.locale,"scopeSelection")),1)],40,Br),t.createElementVNode("label",Tr,[t.createElementVNode("input",{type:"checkbox",checked:e.matchCase,onChange:k[2]||(k[2]=M=>l("update:matchCase",M.target.checked))},null,40,Dr),t.createTextVNode(t.toDisplayString(t.unref(A)(e.locale,"matchCase")),1)]),t.createElementVNode("label",Nr,[t.createElementVNode("input",{type:"checkbox",checked:e.matchEntireCell,onChange:k[3]||(k[3]=M=>l("update:matchEntireCell",M.target.checked))},null,40,Ar),t.createTextVNode(t.toDisplayString(t.unref(A)(e.locale,"matchEntireCell")),1)]),t.createElementVNode("span",Hr,t.toDisplayString(d.value),1),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--icon",title:t.unref(A)(e.locale,"findPrev"),disabled:e.total===0,onClick:k[4]||(k[4]=M=>l("prev"))},[...k[9]||(k[9]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M512 320a32 32 0 0 1 45.254 0l288 288a32 32 0 0 1-45.254 45.254L512 410.51 214.254 653.254A32 32 0 0 1 169 608l288-288z"})],-1)])],8,Vr),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--icon",title:t.unref(A)(e.locale,"findNext"),disabled:e.total===0,onClick:k[5]||(k[5]=M=>l("next"))},[...k[10]||(k[10]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M512 704a32 32 0 0 1-45.254 0l-288-288A32 32 0 0 1 214.254 370.746L512 613.49 809.746 370.746A32 32 0 0 1 855 416l-288 288z"})],-1)])],8,Fr),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--text",disabled:e.total===0,onClick:k[6]||(k[6]=M=>l("replace"))},t.toDisplayString(t.unref(A)(e.locale,"replace")),9,Or),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--text",disabled:e.total===0,onClick:k[7]||(k[7]=M=>l("replace-all"))},t.toDisplayString(t.unref(A)(e.locale,"replaceAll")),9,Lr),t.createElementVNode("button",{class:"find-bar__btn find-bar__btn--close",title:t.unref(A)(e.locale,"findClose"),onClick:k[8]||(k[8]=M=>l("close"))},[...k[11]||(k[11]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",fill:"currentColor"},[t.createElementVNode("path",{d:"M512 451.669L369.664 294.336a32 32 0 0 0-45.312 45.312L466.688 497 309.355 654.336a32 32 0 0 0 45.312 45.312L512 542.688l157.333 157.334a32 32 0 0 0 45.312-45.312L557.312 497 714.645 339.664a32 32 0 0 0-45.312-45.312z"})],-1)])],8,Ir)],4)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-0d187de9"]]),zr={class:"nf-dialog__header"},Wr={class:"nf-dialog__title"},_r={class:"nf-dialog__body"},Kr={class:"nf-field"},Ur={class:"nf-field__label"},Gr=["value"],Pr={key:0,class:"nf-field"},Yr={class:"nf-field__label"},Xr={key:1,class:"nf-field nf-field--inline"},jr={class:"nf-checkbox"},Zr={key:2,class:"nf-field"},qr={class:"nf-field__label"},Jr=["value"],Qr={key:3,class:"nf-field"},ea={class:"nf-field__label"},ta=["value"],la={key:4,class:"nf-field"},oa={class:"nf-field__label"},na=["value"],ra={key:5,class:"nf-field"},aa={class:"nf-field__label"},ia=["value"],ca={key:6,class:"nf-field"},sa={class:"nf-field__label"},da=["value"],ua={class:"nf-field"},fa={class:"nf-field__label"},ma={class:"nf-dialog__footer"},pa={class:"nf-preview"},ga={class:"nf-preview__label"},ha={class:"nf-preview__value"},Ca={class:"nf-dialog__actions"},ba=vt(t.defineComponent({__name:"numberFormatDialog",props:{modelOpen:{type:Boolean,default:!1},locale:{default:"zh-CN"},currentFormat:{default:""},sampleValue:{default:"1234.5"}},emits:["update:modelOpen","apply"],setup(e,{emit:n}){const o=e,l=n,i=t.ref(!1),d=t.ref("general"),r=t.ref(2),b=t.ref(!1),u=t.ref("$"),k=t.ref("m/d/yyyy"),M=t.ref("h:mm:ss"),D=t.ref("m/d/yyyy h:mm:ss"),w=t.ref("[h]:mm:ss"),B=t.ref(""),x=t.ref(null),le=[{label:"¥",value:"¥"},{label:"$",value:"$"},{label:"€",value:"€"},{label:"£",value:"£"}],ne=['yyyy"年"m"月"d"日"',"yyyy-mm-dd","yyyy/m/d",'m"月"d"日"'],p=["m/d/yyyy","mm/dd/yyyy","d-mmm-yyyy","mmmm d, yyyy"],V=['yyyy"年"m"月"d"日" h:mm:ss','yyyy"年"m"月"d"日" hh:mm',"yyyy-mm-dd hh:mm:ss","yyyy/m/d h:mm"],Y=["m/d/yyyy h:mm:ss","m/d/yyyy hh:mm","mm/dd/yyyy h:mm AM/PM","d-mmm-yyyy hh:mm:ss"],oe=t.computed(()=>o.locale==="zh-CN"?[...ne,...p]:[...p,...ne]),Z=["h:mm:ss","h:mm","hh:mm:ss","h:mm AM/PM",'hh"时"mm"分"ss"秒"',"H:mm:ss"],J=t.computed(()=>o.locale==="zh-CN"?[...V,...Y]:[...Y,...V]),q=["[h]:mm:ss","[h]:mm","mm:ss",'[h]"小时"mm"分"ss"秒"',"[h]:mm:ss.00",'d"天"h:mm:ss'],ue={general:"nfCatGeneral",number:"nfCatNumber",currency:"nfCatCurrency",currencyRounded:"nfCatCurrencyRounded",accounting:"nfCatAccounting",financial:"nfCatFinancial",percent:"nfCatPercent",scientific:"nfCatScientific",date:"nfCatDate",time:"nfCatTime",dateTime:"nfCatDateTime",duration:"nfCatDuration",text:"nfCatText",custom:"nfCatCustom"},Ve=t.computed(()=>["number","currency","currencyRounded","accounting","financial"].includes(d.value)),Oe=t.computed(()=>["currency","currencyRounded","accounting"].includes(d.value)),Je=t.computed(()=>d.value==="date"),Ge=t.computed(()=>d.value==="time"),je=t.computed(()=>d.value==="dateTime"),se=t.computed(()=>d.value==="duration"),de=t.computed(()=>["number","currency","accounting","financial","percent","scientific"].includes(d.value));function Se(){if(d.value==="general")return rl;if(d.value==="text")return Ht;if(d.value==="custom")return B.value;if(d.value==="date")return k.value;if(d.value==="time")return M.value;if(d.value==="dateTime")return D.value;if(d.value==="duration")return w.value;const R=Math.max(0,Math.min(30,r.value));return d.value==="currency"||d.value==="currencyRounded"||d.value==="accounting"?re(d.value,R,b.value,u.value):Wo(o.locale,d.value,R,b.value)}function re(R,W,U,De){const Fe=U?"#,##0":"0";if(R==="currencyRounded")return De+Fe;const ze=W>0?"."+"0".repeat(W):"",Be=Fe+ze;return R==="currency"?De+Be:`${De}${Be};(${De}${Be});${De}"-"`}function a(R){if(B.value=R,Yt(R)){d.value="general";return}if(R==="@"){d.value="text";return}if(/\[h\]/i.test(R)&&!/[yd]/i.test(R)){d.value="duration",q.includes(R)&&(w.value=R);return}const W=/[yd]/i.test(R),U=/h|s|AM\/PM/i.test(R);if(W&&U){d.value="dateTime",J.value.includes(R)&&(D.value=R);return}if(W||/AM\/PM/i.test(R)){U&&!W?(d.value="time",Z.includes(R)&&(M.value=R)):(d.value="date",oe.value.includes(R)&&(k.value=R));return}if(R.includes("%")){d.value="percent",r.value=m(R);return}if(/E[+-]/i.test(R)){d.value="scientific",r.value=m(R);return}const De=le.find(Fe=>R.startsWith(Fe.value));if(R.includes("[Red](")){d.value="financial",b.value=R.includes(","),r.value=m(R);return}if(De){R.includes("(")?(d.value="accounting",u.value=De.value,b.value=R.includes(","),r.value=m(R)):/\.\d/.test(R.slice(De.value.length))?(d.value="currency",u.value=De.value,b.value=R.includes(","),r.value=m(R)):(d.value="currencyRounded",u.value=De.value,b.value=R.includes(","));return}d.value="number",b.value=R.includes(","),r.value=m(R)}function m(R){const W=R.match(/\.([0#?]+)/);return W?W[1].length:0}function fe(){d.value!=="custom"&&(B.value=Se())}function Te(){}function f(){k.value=oe.value[0],M.value=Z[0],D.value=J.value[0],w.value=q[0]}function S(){i.value=!0,o.modelOpen!==void 0&&l("update:modelOpen",!0),f(),a(o.currentFormat??""),t.nextTick(()=>{var R;return(R=x.value)==null?void 0:R.focus()})}function y(){i.value=!1,o.modelOpen!==void 0&&l("update:modelOpen",!1)}function _(){l("apply",B.value),y()}function E(){y()}function s(R){R.key==="Escape"&&y()}t.watch(()=>o.modelOpen,R=>{R&&!i.value?S():!R&&i.value&&y()});const v=t.computed(()=>hl(o.sampleValue,B.value,o.locale));return(R,W)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"nf-dialog"},{default:t.withCtx(()=>[i.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"nf-dialog__mask",onMousedown:E,onKeydown:s},[t.createElementVNode("div",{class:t.normalizeClass(["nf-dialog",{"nf-dialog--zh":e.locale==="zh-CN"}]),onMousedown:W[9]||(W[9]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",zr,[t.createElementVNode("span",Wr,t.toDisplayString(t.unref(A)(e.locale,"nfDialogTitle")),1),t.createElementVNode("button",{class:"nf-dialog__close",type:"button",onClick:y},[...W[10]||(W[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",_r,[t.createElementVNode("div",Kr,[t.createElementVNode("label",Ur,t.toDisplayString(t.unref(A)(e.locale,"nfCategory")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":W[0]||(W[0]=U=>d.value=U),class:"nf-field__select",onChange:fe},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Io),U=>(t.openBlock(),t.createElementBlock("option",{key:U,value:U},t.toDisplayString(t.unref(A)(e.locale,ue[U])),9,Gr))),128))],544),[[t.vModelSelect,d.value]])]),de.value?(t.openBlock(),t.createElementBlock("div",Pr,[t.createElementVNode("label",Yr,t.toDisplayString(t.unref(A)(e.locale,"nfDecimals")),1),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":W[1]||(W[1]=U=>r.value=U),class:"nf-field__input",type:"number",min:"0",max:"30",onInput:fe},null,544),[[t.vModelText,r.value,void 0,{number:!0}]])])):t.createCommentVNode("",!0),Ve.value?(t.openBlock(),t.createElementBlock("div",Xr,[t.createElementVNode("label",jr,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":W[2]||(W[2]=U=>b.value=U),type:"checkbox",onChange:fe},null,544),[[t.vModelCheckbox,b.value]]),t.createElementVNode("span",null,t.toDisplayString(t.unref(A)(e.locale,"nfThousands")),1)])])):t.createCommentVNode("",!0),Oe.value?(t.openBlock(),t.createElementBlock("div",Zr,[t.createElementVNode("label",qr,t.toDisplayString(t.unref(A)(e.locale,"nfSymbol")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":W[3]||(W[3]=U=>u.value=U),class:"nf-field__select",onChange:fe},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(le,U=>t.createElementVNode("option",{key:U.value,value:U.value},t.toDisplayString(U.label),9,Jr)),64))],544),[[t.vModelSelect,u.value]])])):t.createCommentVNode("",!0),Je.value?(t.openBlock(),t.createElementBlock("div",Qr,[t.createElementVNode("label",ea,t.toDisplayString(t.unref(A)(e.locale,"nfDateFormat")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":W[4]||(W[4]=U=>k.value=U),class:"nf-field__select",onChange:fe},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(oe.value,U=>(t.openBlock(),t.createElementBlock("option",{key:U,value:U},t.toDisplayString(U),9,ta))),128))],544),[[t.vModelSelect,k.value]])])):t.createCommentVNode("",!0),Ge.value?(t.openBlock(),t.createElementBlock("div",la,[t.createElementVNode("label",oa,t.toDisplayString(t.unref(A)(e.locale,"nfTimeFormat")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":W[5]||(W[5]=U=>M.value=U),class:"nf-field__select",onChange:fe},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(Z,U=>t.createElementVNode("option",{key:U,value:U},t.toDisplayString(U),9,na)),64))],544),[[t.vModelSelect,M.value]])])):t.createCommentVNode("",!0),je.value?(t.openBlock(),t.createElementBlock("div",ra,[t.createElementVNode("label",aa,t.toDisplayString(t.unref(A)(e.locale,"nfDateTime")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":W[6]||(W[6]=U=>D.value=U),class:"nf-field__select",onChange:fe},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(J.value,U=>(t.openBlock(),t.createElementBlock("option",{key:U,value:U},t.toDisplayString(U),9,ia))),128))],544),[[t.vModelSelect,D.value]])])):t.createCommentVNode("",!0),se.value?(t.openBlock(),t.createElementBlock("div",ca,[t.createElementVNode("label",sa,t.toDisplayString(t.unref(A)(e.locale,"nfDuration")),1),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":W[7]||(W[7]=U=>w.value=U),class:"nf-field__select",onChange:fe},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(q,U=>t.createElementVNode("option",{key:U,value:U},t.toDisplayString(U),9,da)),64))],544),[[t.vModelSelect,w.value]])])):t.createCommentVNode("",!0),t.createElementVNode("div",ua,[t.createElementVNode("label",fa,t.toDisplayString(t.unref(A)(e.locale,"nfCustomCode")),1),t.withDirectives(t.createElementVNode("textarea",{ref_key:"customCodeRef",ref:x,"onUpdate:modelValue":W[8]||(W[8]=U=>B.value=U),class:"nf-field__textarea",rows:"2",spellcheck:"false",onInput:Te},null,544),[[t.vModelText,B.value]])])]),t.createElementVNode("div",ma,[t.createElementVNode("div",pa,[t.createElementVNode("span",ga,t.toDisplayString(t.unref(A)(e.locale,"nfPreview")),1),t.createElementVNode("span",ha,t.toDisplayString(v.value||"—"),1)]),t.createElementVNode("div",Ca,[t.createElementVNode("button",{class:"nf-btn nf-btn--primary",type:"button",onClick:_},t.toDisplayString(t.unref(A)(e.locale,"ok")),1),t.createElementVNode("button",{class:"nf-btn",type:"button",onClick:y},t.toDisplayString(t.unref(A)(e.locale,"cancel")),1)])])],34)],32)):t.createCommentVNode("",!0)]),_:1})]))}}),[["__scopeId","data-v-69cb36b7"]]);function Ue(e){let n="",o=e;do n=String.fromCharCode(65+o%26)+n,o=Math.floor(o/26)-1;while(o>=0);return n}function bl(e){let n=0;for(let o=0;o<e.length;o++)n=n*26+(e.toUpperCase().charCodeAt(o)-64);return n-1}function Vt(e){if(e==null)return null;if(typeof e=="number")return e;if(typeof e=="string"){const n=parseFloat(e);return e.endsWith("%")||isNaN(n)?null:n}return null}function yl(e){navigator.clipboard.writeText(e).catch(()=>{const n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.opacity="0",document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n)})}function Kt(e,n){return`${e},${n}`}function jt(e,n,o){const l=e.match(/^\$?([A-Z]+)\$?(\d+)$/i);if(!l)return null;const i=bl(l[1]),d=parseInt(l[2],10)-1;return i<0||i>=n||d<0||d>=o?null:{col:i,row:d}}function Ft(e,n){if(!n)return{x:0,y:0};const o=n.getBoundingClientRect();return{x:e.clientX-o.left,y:e.clientY-o.top}}function Gl(e,n,o){const l=e.split(":");if(l.length!==2)return null;const i=jt(l[0],n,o),d=jt(l[1],n,o);return!i||!d?null:{sc:Math.min(i.col,d.col),sr:Math.min(i.row,d.row),ec:Math.max(i.col,d.col),er:Math.max(i.row,d.row)}}function Pl(e){const n=e.trim();if(n==="")return"";const o=Number(n);return!isNaN(o)&&/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(n)?o:e}function Ot(e,n,o,l,i){const d=o[Kt(e,n)];if(!d)return"";const r=d.value;return r.startsWith("=")?Yl(Kt(e,n),o,l,i):Pl(r)}function ya(e,n,o,l,i){const d=Ot(e,n,o,l,i);if(d===null)return 0;if(typeof d=="number")return d;const r=parseFloat(String(d));return isNaN(r)?0:r}const Zt=new Map,il=new Set;function vl(){Zt.clear(),il.clear()}function Yl(e,n,o,l){return va(e,n,o,l,0)}function va(e,n,o,l,i){if(il.has(e))return null;if(Zt.has(e))return Zt.get(e);il.add(e);const d=n[e];let r;if(!d)r=null;else{const b=d.value;if(!b.startsWith("="))r=Pl(b);else{const u=b.slice(1).trim(),k=/^([A-Za-z_][A-Za-z0-9_]*)\s*\(([\s\S]*)\)$/.exec(u);r=k?jl(k[1].toUpperCase(),k[2],n,o,l,i+1):null}}return il.delete(e),Zt.set(e,r),r}function Xl(e){return e===null||e===""?!1:typeof e=="number"?e!==0:!0}function wa(e,n){return typeof e=="number"&&typeof n=="number"?e===n:String(e??"")===String(n??"")}function ka(e,n,o){let l;if(typeof e=="number"&&typeof n=="number")l=e<n?-1:e>n?1:0;else{const i=String(e??""),d=String(n??"");l=i<d?-1:i>d?1:0}switch(o){case"=":return l===0;case"<>":return l!==0;case"<":return l<0;case">":return l>0;case"<=":return l<=0;case">=":return l>=0}return!1}function Ea(e,n,o,l,i){const d=e.trim();let r=null,b=-1,u=null,k=0;for(let D=0;D<d.length;D++){const w=d[D];if(u){w===u&&(d[D+1]===u?D++:u=null);continue}if(w==='"'||w==="'"){u=w;continue}if(w==="("&&k++,w===")"&&k--,k===0&&(w==="<"||w===">"||w==="=")){let B=null;const x=d.slice(D,D+2);x==="<="||x===">="||x==="<>"?B=x:B=w,r=B,b=D,B.length===2&&D++;break}}if(r&&b>=0){const D=d.slice(0,b).trim(),w=d.slice(b+r.length).trim(),B=Et(D,n,o,l,i),x=Et(w,n,o,l,i);return ka(B,x,r)}const M=Et(d,n,o,l,i);return Xl(M)}function wl(e){const n=[];let o=0,l=null,i="";for(let d=0;d<e.length;d++){const r=e[d];if(l){i+=r,r===l&&(e[d+1]===l?(d++,i+=l):l=null);continue}if(r==='"'||r==="'"){l=r,i+=r;continue}if(r==="("&&o++,r===")"&&o--,r===","&&o===0){n.push(i),i="";continue}i+=r}return n.push(i),n}function Et(e,n,o,l,i){if(i>20)return null;const d=e.trim();if(d==="")return null;const r=d.toUpperCase();if(r==="TRUE")return 1;if(r==="FALSE")return 0;const b=Ra(d);if(b.length===0)return null;let u=0;const k=()=>{let B=M();for(;u<b.length;){const x=b[u];if(x.type==="op"&&(x.val==="+"||x.val==="-"))u++,B=kl(B,M(),x.val);else break}return B},M=()=>{let B=D();for(;u<b.length;){const x=b[u];if(x.type==="op"&&(x.val==="*"||x.val==="/"))u++,B=kl(B,D(),x.val);else break}return B},D=()=>{const B=b[u];return B&&B.type==="op"&&B.val==="-"?(u++,kl(0,D(),"-")):B&&B.type==="op"&&B.val==="+"?(u++,D()):w()},w=()=>{const B=b[u];if(!B)return null;if(B.type==="num")return u++,Number(B.val);if(B.type==="str")return u++,B.val;if(B.type==="lp"){u++;const x=k();return b[u]&&b[u].type==="rp"&&u++,x}if(B.type==="ref"){u++;const x=jt(B.val,o,l);return x?Ot(x.col,x.row,n,o,l):null}if(B.type==="func"){const x=B.val.toUpperCase();if(u++,b[u]&&b[u].type==="lp"){const le=b[u];let ne=0,p=null,V=u;for(;V<b.length;V++)if(b[V].type==="lp")ne++;else if(b[V].type==="rp"&&(ne--,ne===0)){p=b[V];break}if(p){const Y=d.slice(le.start+1,p.start);return u=V+1,jl(x,Y,n,o,l,i+1)}}return null}return u++,null};return k()}function Ra(e){const n=[];let o=0;for(;o<e.length;){const l=e[o];if(/\s/.test(l)){o++;continue}if(l==='"'||l==="'"){const i=l,d=o;o++;let r="";for(;o<e.length;){if(e[o]===i){if(e[o+1]===i){r+=i,o+=2;continue}o++;break}r+=e[o],o++}n.push({type:"str",val:r,start:d});continue}if(/[0-9]/.test(l)||l==="."){const i=o;let d="";for(l==="."&&(d+=".",o++);o<e.length&&/[0-9]/.test(e[o]);)d+=e[o],o++;if(e[o]===".")for(d+=".",o++;o<e.length&&/[0-9]/.test(e[o]);)d+=e[o],o++;if(e[o]==="e"||e[o]==="E")for(d+=e[o],o++,(e[o]==="+"||e[o]==="-")&&(d+=e[o],o++);o<e.length&&/[0-9]/.test(e[o]);)d+=e[o],o++;n.push({type:"num",val:d,start:i});continue}if(/[A-Za-z_]/.test(l)){const i=o;let d="";for(;o<e.length&&/[A-Za-z0-9_]/.test(e[o]);)d+=e[o],o++;e[o]==="("?n.push({type:"func",val:d,start:i}):n.push({type:"ref",val:d,start:i});continue}if(l==="("){n.push({type:"lp",val:l,start:o}),o++;continue}if(l===")"){n.push({type:"rp",val:l,start:o}),o++;continue}if(l===","){n.push({type:"comma",val:l,start:o}),o++;continue}if(l==="+"||l==="-"||l==="*"||l==="/"){n.push({type:"op",val:l,start:o}),o++;continue}o++}return n}function kl(e,n,o){if(typeof e!="number"||typeof n!="number")return null;switch(o){case"+":return e+n;case"-":return e-n;case"*":return e*n;case"/":return n===0?null:e/n}return null}function jl(e,n,o,l,i,d){switch(e){case"SUM":case"AVERAGE":case"COUNT":{const r=Gl(n.trim(),l,i);if(!r)return null;if(e==="COUNT"){let u=0;for(let k=r.sc;k<=r.ec;k++)for(let M=r.sr;M<=r.er;M++)typeof Ot(k,M,o,l,i)=="number"&&u++;return u}let b=0;for(let u=r.sc;u<=r.ec;u++)for(let k=r.sr;k<=r.er;k++)b+=ya(u,k,o,l,i);if(isNaN(b))return null;if(e==="AVERAGE"){const u=(r.ec-r.sc+1)*(r.er-r.sr+1);return u===0?null:b/u}return b}case"IF":{const r=wl(n);if(r.length<3)return null;const b=Ea(r[0],o,l,i,d);return Et(b?r[1]:r[2],o,l,i,d)}case"VLOOKUP":{const r=wl(n);if(r.length<3)return null;const b=Et(r[0],o,l,i,d),u=Gl(r[1].trim(),l,i);if(!u)return null;const k=Et(r[2],o,l,i,d),M=typeof k=="number"?k:parseFloat(String(k));if(isNaN(M))return null;const D=u.sc+(M-1);if(D<u.sc||D>u.ec)return null;if(r.length>=4?Xl(Et(r[3],o,l,i,d)):!1){let B=-1,x=-1/0;for(let le=u.sr;le<=u.er;le++){const ne=Ot(u.sc,le,o,l,i);typeof ne=="number"&&typeof b=="number"&&ne<=b&&ne>x&&(x=ne,B=le)}return B>=0?Ot(D,B,o,l,i):null}for(let B=u.sr;B<=u.er;B++){const x=Ot(u.sc,B,o,l,i);if(wa(x,b))return Ot(D,B,o,l,i)}return null}case"CONCATENATE":{const r=wl(n);let b="";for(const u of r){const k=Et(u,o,l,i,d);b+=k===null?"":typeof k=="number"?String(k):k}return b}default:return null}}function El(e,n,o){const l=[],i=/(\$?[A-Z]+\$?\d+)(?::(\$?[A-Z]+\$?\d+))?/gi;let d;for(;(d=i.exec(e))!==null;){const r=jt(d[1],n,o);if(r)if(d[2]){const b=jt(d[2],n,o);if(!b)continue;for(let u=Math.min(r.col,b.col);u<=Math.max(r.col,b.col);u++)for(let k=Math.min(r.row,b.row);k<=Math.max(r.row,b.row);k++)l.push(Kt(u,k))}else l.push(Kt(r.col,r.row))}return l}function Ba(e,n,o,l,i){const d=o[Kt(e,n)];if(!d)return"";const r=d.value;if(!r.startsWith("="))return r;const b=Yl(Kt(e,n),o,l,i);return b===null?"#ERROR":String(b)}function xa(e,n,o,l,i,d){return n===0&&o===0?e:e.replace(/(\$?)([A-Z]+)(\$?)(\d+)/gi,(r,b,u,k,M)=>{const D=b?bl(u):bl(u)+n,w=k?parseInt(M,10)-1:parseInt(M,10)-1+o;let B;D<0?B="A":D>=l?B=d(l-1):B=d(D);let x;return w<0?x="1":w>=i?x=String(i):x=String(w+1),(b||"")+B+(k||"")+x})}class Ma{constructor(){this.deps=new Map,this.rev=new Map,this.dirty=new Set}clear(n){var l;const o=this.deps.get(n);if(o){for(const i of o)(l=this.rev.get(i))==null||l.delete(n);this.deps.delete(n)}}set(n,o){if(this.clear(n),o.length!==0){this.deps.set(n,o);for(const l of o)this.rev.has(l)||this.rev.set(l,new Set),this.rev.get(l).add(n)}}markDirty(n){const o=[n];for(;o.length>0;){const l=o.pop(),i=this.rev.get(l);if(i)for(const d of i)this.dirty.has(d)||(this.dirty.add(d),o.push(d))}}getDirtyAndClear(){const n=this.dirty;return this.dirty=new Set,n}rebuild(n,o,l){this.deps.clear(),this.rev.clear(),this.dirty.clear(),Zt.clear();for(const[i,d]of Object.entries(n))if(d.value.startsWith("=")){const r=El(d.value.slice(1),o,l);this.set(i,r)}}}function Sa(e,n){const o=t.reactive({rowCount:e.rowCount??n.rowCount,colCount:e.colCount??n.colCount,width:e.width,height:e.height,theme:e.theme??n.theme,locale:e.locale??n.locale});t.watchEffect(()=>{o.rowCount=e.rowCount??n.rowCount,o.colCount=e.colCount??n.colCount,o.width=e.width,o.height=e.height,o.theme=e.theme??n.theme,o.locale=e.locale??n.locale});const l=t.computed(()=>o.locale==="zh-CN"?"zh-CN":"en-US"),i=o.colCount,d=o.rowCount,r=t.reactive({}),b=t.reactive({}),u=new Ma,k=t.ref(null),M=t.ref("cell"),D=t.ref({col:0,row:0}),w=t.ref(null),B=t.ref(""),x=t.ref(new Array(i).fill(100)),le=t.ref(new Array(d).fill(void 0)),ne=t.ref(0),p=t.ref(0),V=(24-kt)/2,Y=new Map;let oe=null;function Z(H,O,I,Q){const ie=`${Q} ${I} ${O}px ${H}`,ke=Y.get(ie);if(ke)return ke;if(!oe){if(typeof document>"u")return{ascent:O*.88,descent:O*.28};oe=document.createElement("canvas")}const Ne=oe.getContext("2d");if(!Ne)return{ascent:O*.88,descent:O*.28};Ne.font=ie;const We=Ne.measureText(" "),Le=We.fontBoundingBoxAscent,_e=We.fontBoundingBoxDescent;if(typeof Le=="number"&&typeof _e=="number"&&Le>0&&_e>0){const me={ascent:Le,descent:_e};return Y.set(ie,me),me}const Me=["M","中","y","Ä","0"];let C=0,F=0;for(const me of Me){const be=Ne.measureText(me),we=be.actualBoundingBoxAscent||0,Ae=be.actualBoundingBoxDescent||0;we>C&&(C=we),Ae>F&&(F=Ae)}const K=Math.max(C,O*.88),Ce=Math.max(F,O*.28),ge={ascent:K,descent:Ce};return Y.set(ie,ge),ge}let J=(H,O)=>`${H},${O}`,q=()=>null,ue=()=>kt,Ve=t.computed(()=>[0]),Oe=()=>24,Je=(H,O,I,Q)=>({startCol:Math.min(H,I),startRow:Math.min(O,Q),endCol:Math.max(H,I),endRow:Math.max(O,Q)});function Ge(H,O){var We;const I=(We=r[J(H,O)])==null?void 0:We.style,Q=ue(H,O),ie=typeof(I==null?void 0:I.fontFamily)=="string"&&I.fontFamily?I.fontFamily:Pt,ke=(I==null?void 0:I.fontWeight)==="bold"?"bold":"normal",Ne=(I==null?void 0:I.fontStyle)==="italic"?"italic":"normal";return Z(ie,Q,ke,Ne)}function je(H,O,I,Q){if(!O)return[""];const ie=O.split(`
|
|
2
|
+
`),ke=[];for(const Ne of ie)if(!Q||I<=0)ke.push(Ne);else{let We="";for(let Le=0;Le<Ne.length;Le++){const _e=Ne[Le],Me=We+_e;H.measureText(Me).width>I&&We?(ke.push(We),We=_e):We=Me}ke.push(We)}return ke}function se(H,O){var Q;const I=(Q=r[J(H,O)])==null?void 0:Q.style;return typeof(I==null?void 0:I.fontSize)=="number"&&I.fontSize>0?I.fontSize:kt}ue=se;const de=t.computed(()=>{const H=[0];for(let O=0;O<i;O++)H.push(H[O]+x.value[O]);return H});Ve=de;const Se={w:800,h:600};let re=()=>{};function a(H){var Me;const O=le.value[H];if(O!=null&&O>0)return O;let I,Q,ie=1;const ke=oe?oe.getContext("2d"):null,Ne=Z(Pt,kt,"normal","normal");I=Ne.ascent,Q=Ne.descent;for(let C=0;C<i;C++){const F=se(C,H),K=(Me=r[J(C,H)])==null?void 0:Me.style,Ce=typeof(K==null?void 0:K.fontFamily)=="string"&&K.fontFamily?K.fontFamily:Pt,ge=(K==null?void 0:K.fontWeight)==="bold"?"bold":"normal",me=(K==null?void 0:K.fontStyle)==="italic"?"italic":"normal",be=Z(Ce,F,ge,me);be.ascent>I&&(I=be.ascent),be.descent>Q&&(Q=be.descent);const we=typeof(K==null?void 0:K.numberFormat)=="string"?K.numberFormat:"",Ae=T(C,H),lt=hl(Ae,we,l.value);if(lt){const it=(K==null?void 0:K.wrap)==="wrap";let dt;if(it&&ke){ke.font=`${me} ${ge} ${F}px ${Ce}`;const Qe=q(C,H);let rt;Qe&&C===Qe.range.startCol&&H===Qe.range.startRow?rt=Ve.value[Qe.range.endCol+1]-Ve.value[C]:rt=x.value[C],dt=je(ke,lt,Math.max(0,rt-10),!0).length,dt>ie&&(ie=dt)}else dt=lt.split(`
|
|
3
|
+
`).length,dt>ie&&(ie=dt)}}const We=I+Q,Le=V*2+ie*We;return Math.min(500,Math.max(24,Math.round(Le)))}Oe=a;function m(H){return le.value[H]===void 0}const fe=t.computed(()=>{const H=[0];for(let O=0;O<d;O++)H.push(H[O]+Oe(O));return H}),Te=t.computed(()=>de.value[i]),f=t.computed(()=>fe.value[d]);function S(H,O){return`${H},${O}`}J=S;function y(H){Reflect.deleteProperty(r,H)}function _(H,O){M.value="cell";const I=q(H,O);I?(D.value={col:I.range.startCol,row:I.range.startRow},k.value={...I.range}):(D.value={col:H,row:O},k.value={startCol:H,startRow:O,endCol:H,endRow:O})}function E(H,O,I,Q,ie="cell"){const ke=q(H,O);if(D.value=ke?{col:ke.range.startCol,row:ke.range.startRow}:{col:H,row:O},M.value=ie,ie==="row"||ie==="col"){const Ne=Math.min(H,I),We=Math.max(H,I),Le=Math.min(O,Q),_e=Math.max(O,Q);k.value={startCol:Ne,startRow:Le,endCol:We,endRow:_e}}else k.value=Je(H,O,I,Q)}function s(){E(0,0,i-1,d-1,"all")}function v(H,O){const I=k.value;return I?(M.value==="cell"||M.value==="all",H>=I.startCol&&H<=I.endCol&&O>=I.startRow&&O<=I.endRow):!1}function R(H,O){return v(H,O)}function W(H,O){for(const I in b){const Q=b[I];if(Q&&H>=Q.startCol&&H<=Q.endCol&&O>=Q.startRow&&O<=Q.endRow)return{range:Q,anchor:I}}return null}q=W;function U(H,O){return b[S(H,O)]!==void 0}function De(H,O){const I=q(H,O);if(I&&H===I.range.startCol&&O===I.range.startRow){const Q=de.value[I.range.endCol+1]-de.value[H],ie=fe.value[I.range.endRow+1]-fe.value[O];return{w:Q,h:ie}}return{w:x.value[H],h:Oe(O)}}function Fe(H,O,I,Q){let ie=Math.min(H,I),ke=Math.max(H,I),Ne=Math.min(O,Q),We=Math.max(O,Q),Le=!0;for(;Le;){Le=!1;for(const _e in b){const Me=b[_e];if(!Me)continue;Me.startCol<=ke&&Me.endCol>=ie&&Me.startRow<=We&&Me.endRow>=Ne&&(Me.startCol<ie&&(ie=Me.startCol,Le=!0),Me.endCol>ke&&(ke=Me.endCol,Le=!0),Me.startRow<Ne&&(Ne=Me.startRow,Le=!0),Me.endRow>We&&(We=Me.endRow,Le=!0))}}return{startCol:ie,startRow:Ne,endCol:ke,endRow:We}}Je=Fe;let ze=()=>{};function Be(H,O){var I;return((I=r[S(H,O)])==null?void 0:I.value)??""}function T(H,O){return vl(),Ba(H,O,r,i,d)}function N(H,O,I){var Ne,We;const Q=S(H,O);if(vl(),I===""||I==null){u.clear(Q);const Le=((Ne=r[Q])==null?void 0:Ne.style)??null;Le?r[Q]={value:"",style:Le}:y(Q),u.markDirty(Q);return}const ie=String(I),ke=((We=r[Q])==null?void 0:We.style)??null;r[Q]={value:ie,style:ke},ie.startsWith("=")?u.set(Q,El(ie.slice(1),i,d)):u.clear(Q),u.markDirty(Q)}function P(H,O,I,Q){for(let ie=H;ie<=O;ie++)for(let ke=I;ke<=Q;ke++){const Ne=S(ie,ke);u.clear(Ne),y(Ne),u.markDirty(Ne),ze(ie,ke)}}let ce=()=>{};function ee(H){w.value||(w.value={...D.value},H!==void 0?B.value=H:B.value||(B.value=Be(D.value.col,D.value.row)))}function ae(){w.value&&(ce(),N(w.value.col,w.value.row,B.value),w.value=null,B.value="")}function X(){w.value=null,B.value=""}function G(H,O){const I=D.value;let Q=Math.max(0,Math.min(i-1,I.col+H)),ie=Math.max(0,Math.min(d-1,I.row+O));const ke=q(I.col,I.row),Ne=q(Q,ie);ke&&Ne&&ke.anchor===Ne.anchor&&(H>0?Q=ke.range.endCol+1:H<0&&(Q=ke.range.startCol-1),O>0?ie=ke.range.endRow+1:O<0&&(ie=ke.range.startRow-1),Q=Math.max(0,Math.min(i-1,Q)),ie=Math.max(0,Math.min(d-1,ie))),_(Q,ie)}function ye(H,O){const I=Math.max(0,Se.w-52-11),Q=Math.max(0,Se.h-24-11),ie=de.value[H],ke=fe.value[O],Ne=q(H,O),We=Ne?de.value[Ne.range.endCol+1]-de.value[H]:x.value[H],Le=Ne?fe.value[Ne.range.endRow+1]-fe.value[O]:Oe(O);let _e=ne.value,Me=p.value;ie<_e?_e=ie:ie+We>_e+I&&(_e=ie+We-I),ke<Me?Me=ke:ke+Le>Me+Q&&(Me=ke+Le-Q),re(_e,Me)}function Ee(H){const O=de.value;if(H<0||H>=O[i])return-1;let I=0,Q=i-1;for(;I<Q;){const ie=I+Q+1>>1;O[ie]<=H?I=ie:Q=ie-1}return I}function Ze(H){const O=fe.value;if(H<0||H>=O[d])return-1;let I=0,Q=d-1;for(;I<Q;){const ie=I+Q+1>>1;O[ie]<=H?I=ie:Q=ie-1}return I}const Pe={props:o,locale:l,colCount:i,rowCount:d,cells:r,merges:b,formulaDeps:u,selection:k,activeCell:D,editingCell:w,editValue:B,colWidths:x,rowHeights:le,scrollX:ne,scrollY:p,BASE_CELL_VPAD:V,fontMetricsCache:Y,fontMetricsCanvas:oe,measureFontMetrics:Z,_getFontMetricsForCell:Ge,getWrappedLines:je,cellFontSize:se,colPositions:de,getRowHeight:a,_isAutoRow:m,rowPositions:fe,totalWidth:Te,totalHeight:f,selectCell:_,selectRange:E,selectAll:s,isSelected:v,isCellSelected:R,selectionMode:M,cellKey:S,delCell:y,findMerge:W,_isMergeAnchor:U,_mergedSpan:De,expandSelectionForMerges:Fe,getCellRaw:Be,getCellValue:T,setCellValue:N,clearCellsInRange:P,startEdit:ee,commitEdit:ae,cancelEdit:X,moveActive:G,ensureVisible:ye,hitCol:Ee,hitRow:Ze,viewSize:Se,findHighlight:(H,O)=>null};return ce=()=>{var H;return(H=Pe.saveUndo)==null?void 0:H.call(Pe)},ze=(H,O)=>{var I;return(I=Pe.syncCellBorders)==null?void 0:I.call(Pe,H,O)},re=(H,O)=>{var I;return(I=Pe.clampScroll)==null?void 0:I.call(Pe,H,O)},Pe}function Ta(e,n){const o=t.ref([]),l=t.ref([]);function i(C){const F={};for(const[K,Ce]of Object.entries(C))F[K]={value:Ce.value,style:Ce.style};return F}function d(){return n.saveSheet(),{sheets:n.sheets.value.map(C=>({id:C.id,name:C.name,cells:i(C.cells),merges:C.merges?{...C.merges}:{},selection:C.selection?{...C.selection}:null,activeCell:C.activeCell?{...C.activeCell}:{col:0,row:0},scrollX:C.scrollX,scrollY:C.scrollY,colWidths:[...C.colWidths],rowHeights:[...C.rowHeights]})),activeSheetIndex:n.activeSheetIndex.value}}function r(C){n.sheets.value=C.sheets.map(F=>({...F,cells:i(F.cells)})),n.loadSheet(Math.max(0,Math.min(C.activeSheetIndex,n.sheets.value.length-1))),e.formulaDeps.rebuild(e.cells,e.colCount,e.rowCount)}function b(){const C=d(),F=o.value[o.value.length-1];F&&JSON.stringify(F)===JSON.stringify(C)||(o.value.push(C),l.value=[],o.value.length>50&&o.value.shift())}e.saveUndo=b;function u(){var C;o.value.length&&(l.value.push(d()),r(o.value.pop()),(C=e.scheduleRender)==null||C.call(e),t.nextTick(()=>{var F;return(F=e.emitModelData)==null?void 0:F.call(e)}))}function k(){var C;l.value.length&&(o.value.push(d()),r(l.value.pop()),(C=e.scheduleRender)==null||C.call(e),t.nextTick(()=>{var F;return(F=e.emitModelData)==null?void 0:F.call(e)}))}const M=t.computed(()=>o.value.length>0),D=t.computed(()=>l.value.length>0),w=t.computed(()=>!!e.selection.value),B=t.ref(null);function x(){var K;const C=e.selection.value;if(!C)return;const F={};for(let Ce=C.startCol;Ce<=C.endCol;Ce++)for(let ge=C.startRow;ge<=C.endRow;ge++)F[`${Ce-C.startCol},${ge-C.startRow}`]=((K=e.cells[e.cellKey(Ce,ge)])==null?void 0:K.style)??null;B.value={styles:F}}function le(){var K,Ce,ge,me;const C=B.value,F=e.selection.value;if(!(!C||!F)){b();for(let be=F.startCol;be<=F.endCol;be++)for(let we=F.startRow;we<=F.endRow;we++){const Ae=e.findMerge(be,we);if(Ae&&(be!==Ae.range.startCol||we!==Ae.range.startRow))continue;const lt=C.styles[`${be-F.startCol},${we-F.startRow}`]??null,it=e.cellKey(be,we),dt=((K=e.cells[it])==null?void 0:K.value)??"";dt===""&<===null?e.delCell(it):e.cells[it]={value:dt,style:lt},(Ce=e.syncCellBorders)==null||Ce.call(e,be,we)}B.value=null,(ge=e.scheduleRender)==null||ge.call(e),(me=e.emitModelData)==null||me.call(e)}}function ne(){var F,K,Ce,ge;const C=e.selection.value;if(C){b();for(let me=C.startCol;me<=C.endCol;me++)for(let be=C.startRow;be<=C.endRow;be++){const we=e.findMerge(me,be);if(we&&(me!==we.range.startCol||be!==we.range.startRow))continue;const Ae=e.cellKey(me,be),lt=((F=e.cells[Ae])==null?void 0:F.value)??"";lt===""?e.delCell(Ae):e.cells[Ae]={value:lt,style:null},(K=e.syncCellBorders)==null||K.call(e,me,be)}(Ce=e.scheduleRender)==null||Ce.call(e),(ge=e.emitModelData)==null||ge.call(e)}}const p=t.computed(()=>fo.map(C=>({...C,label:C.value===""?A(e.locale.value,"fontDefault"):C.label}))),V=t.computed(()=>mo.map(C=>({...C,label:String(C.value)}))),Y="\0",oe=t.computed(()=>{var Ce;const C=e.selection.value;if(!C)return"";let F,K=!1;for(let ge=C.startCol;ge<=C.endCol&&!K;ge++)for(let me=C.startRow;me<=C.endRow&&!K;me++){const be=e.findMerge(ge,me);if(be&&(ge!==be.range.startCol||me!==be.range.startRow))continue;const we=(Ce=e.cells[e.cellKey(ge,me)])==null?void 0:Ce.style,Ae=typeof(we==null?void 0:we.fontFamily)=="string"?we.fontFamily:"";F===void 0?F=Ae:Ae!==F&&(K=!0)}return K?Y:F??""}),Z=t.computed(()=>{const C=e.selection.value;if(!C)return kt;let F,K=!1;for(let Ce=C.startCol;Ce<=C.endCol&&!K;Ce++)for(let ge=C.startRow;ge<=C.endRow&&!K;ge++){const me=e.findMerge(Ce,ge);if(me&&(Ce!==me.range.startCol||ge!==me.range.startRow))continue;const be=e.cellFontSize(Ce,ge);F===void 0?F=be:be!==F&&(K=!0)}return K?0:F??kt});function J(C,F){var Ce,ge,me,be;const K=e.selection.value;if(K){b();for(let we=K.startCol;we<=K.endCol;we++)for(let Ae=K.startRow;Ae<=K.endRow;Ae++){const lt=e.findMerge(we,Ae);if(lt&&(we!==lt.range.startCol||Ae!==lt.range.startRow))continue;const it=e.cellKey(we,Ae),dt=((Ce=e.cells[it])==null?void 0:Ce.value)??"",Qe=(ge=e.cells[it])!=null&&ge.style?{...e.cells[it].style}:{};F===""||F===null||F===void 0||F===0?Reflect.deleteProperty(Qe,C):Qe[C]=F;const rt=Object.keys(Qe).length?Qe:null;dt===""&&rt===null?e.delCell(it):e.cells[it]={value:dt,style:rt}}(me=e.scheduleRender)==null||me.call(e),(be=e.emitModelData)==null||be.call(e)}}function q(C){J("fontFamily",C===""?"":C)}const ue=t.ref(!1),Ve=t.ref(!1),Oe=t.ref(!1),Je=t.ref(!1),Ge=t.ref(!1);function je(C){J("fontSize",C),ue.value=!1}const se=t.computed(()=>vo.map(C=>({label:A(e.locale.value,C.labelKey),value:C.value,icon:C.icon}))),de=t.computed(()=>wo.map(C=>({label:A(e.locale.value,C.labelKey),value:C.value,icon:C.icon}))),Se=t.computed(()=>{var Ce;const C=e.selection.value;if(!C)return"left";const F=(Ce=e.cells[e.cellKey(C.startCol,C.startRow)])==null?void 0:Ce.style,K=typeof(F==null?void 0:F.textAlign)=="string"?F.textAlign:"";return K==="center"||K==="right"?K:"left"}),re=t.computed(()=>{var Ce;const C=e.selection.value;if(!C)return"top";const F=(Ce=e.cells[e.cellKey(C.startCol,C.startRow)])==null?void 0:Ce.style,K=typeof(F==null?void 0:F.verticalAlign)=="string"?F.verticalAlign:"";return K==="middle"||K==="bottom"?K:"top"}),a=t.computed(()=>{var K;const C=e.selection.value;if(!C)return!1;const F=(K=e.cells[e.cellKey(C.startCol,C.startRow)])==null?void 0:K.style;return(F==null?void 0:F.wrap)==="wrap"});function m(C){J("textAlign",C)}function fe(C){J("verticalAlign",C)}function Te(){if(!e.selection.value)return;const F=a.value;J("wrap",F?void 0:"wrap")}const f=t.ref(""),S=ue;t.watch(Z,C=>{f.value=C===0?"":String(C)},{immediate:!0});function y(C){const F=C.replace(/[^\d]/g,"");f.value=F;const K=parseInt(F,10);!isNaN(K)&&K>=5&&K<=72&&K!==Z.value&&J("fontSize",K)}function _(){const C=f.value.trim();if(!C){f.value=Z.value===0?"":String(Z.value);return}let F=parseInt(C,10);isNaN(F)?F=Z.value===0?kt:Z.value:F=Math.max(5,Math.min(72,F)),f.value=String(F),F!==Z.value&&J("fontSize",F)}function E(C){C.key==="Enter"&&C.target.blur()}function s(C){C&&C.preventDefault(),S.value=!S.value,S.value&&(Oe&&(Oe.value=!1),Ve&&(Ve.value=!1),Je.value=!1,Ge.value=!1)}function v(){const C=Z.value===0?kt:Z.value,F=Math.min(72,C+1);J("fontSize",F),f.value=String(F),S.value=!1}function R(){const C=Z.value===0?kt:Z.value,F=Math.max(5,C-1);J("fontSize",F),f.value=String(F),S.value=!1}function W(C){var ge;const F=e.selection.value;if(!F)return!1;let K,Ce=!1;for(let me=F.startCol;me<=F.endCol&&!Ce;me++)for(let be=F.startRow;be<=F.endRow&&!Ce;be++){const we=e.findMerge(me,be);if(we&&(me!==we.range.startCol||be!==we.range.startRow))continue;const Ae=(ge=e.cells[e.cellKey(me,be)])==null?void 0:ge.style,lt=!!(Ae!=null&&Ae[C]);K===void 0?K=lt:lt!==K&&(Ce=!0)}return!Ce&&K===!0}const U=t.computed(()=>W("fontWeight")),De=t.computed(()=>W("fontStyle")),Fe=t.computed(()=>W("underline")),ze=t.computed(()=>W("strikethrough"));function Be(){J("fontWeight",U.value?"":"bold")}function T(){J("fontStyle",De.value?"":"italic")}function N(){J("underline",Fe.value?"":"underline")}function P(){J("strikethrough",ze.value?"":"line-through")}const ce=t.ref(""),ee=t.ref(""),ae=Je,X=Ge;function G(){ae.value=!ae.value,X.value=!1,Ve&&(Ve.value=!1),Oe&&(Oe.value=!1)}function ye(){X.value=!X.value,ae.value=!1,Ve&&(Ve.value=!1),Oe&&(Oe.value=!1)}function Ee(C){Ve&&(Ve.value=C),C&&(ae.value=!1,X.value=!1,Oe&&(Oe.value=!1))}function Ze(C){ce.value=C,J("color",C===""?"":C)}function Pe(C){ee.value=C,J("backgroundColor",C===""?"":C)}function H(){J("color",ce.value===""?"":ce.value)}function O(){J("backgroundColor",ee.value===""?"":ee.value)}const I=t.computed(()=>{var Ce;const C=e.selection.value;if(!C)return"";let F,K=!1;for(let ge=C.startCol;ge<=C.endCol&&!K;ge++)for(let me=C.startRow;me<=C.endRow&&!K;me++){const be=e.findMerge(ge,me);if(be&&(ge!==be.range.startCol||me!==be.range.startRow))continue;const we=(Ce=e.cells[e.cellKey(ge,me)])==null?void 0:Ce.style,Ae=typeof(we==null?void 0:we.color)=="string"?we.color:"";F===void 0?F=Ae:Ae!==F&&(K=!0)}return K?"":F??""}),Q=t.computed(()=>{var Ce;const C=e.selection.value;if(!C)return"";let F,K=!1;for(let ge=C.startCol;ge<=C.endCol&&!K;ge++)for(let me=C.startRow;me<=C.endRow&&!K;me++){const be=e.findMerge(ge,me);if(be&&(ge!==be.range.startCol||me!==be.range.startRow))continue;const we=(Ce=e.cells[e.cellKey(ge,me)])==null?void 0:Ce.style,Ae=typeof(we==null?void 0:we.backgroundColor)=="string"?we.backgroundColor:"";F===void 0?F=Ae:Ae!==F&&(K=!0)}return K?"":F??""}),ie=t.computed(()=>_o(e.locale.value)),ke=t.ref(!1),Ne=t.computed(()=>{var Ce;const C=e.selection.value;if(!C)return rl;let F,K=!1;for(let ge=C.startCol;ge<=C.endCol&&!K;ge++)for(let me=C.startRow;me<=C.endRow&&!K;me++){const be=e.findMerge(ge,me);if(be&&(ge!==be.range.startCol||me!==be.range.startRow))continue;const we=(Ce=e.cells[e.cellKey(ge,me)])==null?void 0:Ce.style,Ae=typeof(we==null?void 0:we.numberFormat)=="string"?we.numberFormat:"";F===void 0?F=Ae:Ae!==F&&(K=!0)}return K?nl:F??rl});function We(C){J("numberFormat",C)}function Le(C){if(C===Al){ke.value=!0;return}We(C)}function _e(){ke.value=!0}return{undoStack:o,redoStack:l,cloneCells:i,takeSnap:d,restoreSnap:r,saveUndo:b,undo:u,redo:k,canUndo:M,canRedo:D,hasSelection:w,paintFmt:B,onPaintFormat:x,applyPaintFormat:le,clearFormat:ne,fontFamilyOptions:p,fontSizeOptions:V,FONT_FAMILY_MIXED:Y,selFontFamily:oe,selFontSize:Z,applyStyleToSelection:J,onFontFamilyChange:q,onFontSizeChange:je,hAlignOptions:se,vAlignOptions:de,selHAlign:Se,selVAlign:re,selWrap:a,onHAlignChange:m,onVAlignChange:fe,onWrapToggle:Te,fontSizeInput:f,fontSizeMenuOpen:S,onFontSizeInput:y,onFontSizeBlur:_,onFontSizeKeydown:E,toggleFontSizeMenu:s,onFontSizeStepUp:v,onFontSizeStepDown:R,selFontWeight:U,selFontStyle:De,selUnderline:Fe,selStrikethrough:ze,toggleFontWeight:Be,toggleFontStyle:T,toggleUnderline:N,toggleStrikethrough:P,cachedTextColor:ce,cachedFillColor:ee,textColorMenuOpen:ae,fillColorMenuOpen:X,_toggleTextColorMenu:G,_toggleFillColorMenu:ye,onBorderMenuToggle:Ee,onTextColorChange:Ze,onFillColorChange:Pe,applyCachedTextColor:H,applyCachedFillColor:O,selTextColor:I,selFillColor:Q,nfOptions:ie,selNumberFormat:Ne,NF_NUMBER_FORMAT_MIXED:nl,nfDialogOpen:ke,onNumberFormatChange:Le,openNumberFormatDialog:_e,applyNumberFormatCode:We}}function Da(e,n){n.borderMenuOpen&&(e.borderMenuOpen=n.borderMenuOpen),n.mergeMenuOpen&&(e.mergeMenuOpen=n.mergeMenuOpen),(()=>{const l=e.borderMenuOpen,i=e.mergeMenuOpen;e.onBorderMenuToggle=d=>{l&&(l.value=d),d&&(e.textColorMenuOpen.value=!1,e.fillColorMenuOpen.value=!1,i&&(i.value=!1))},e.toggleFontSizeMenu=d=>{d&&d.preventDefault(),e.fontSizeMenuOpen.value=!e.fontSizeMenuOpen.value,e.fontSizeMenuOpen.value&&(i&&(i.value=!1),l&&(l.value=!1),e.textColorMenuOpen.value=!1,e.fillColorMenuOpen.value=!1)},e._toggleTextColorMenu=()=>{e.textColorMenuOpen.value=!e.textColorMenuOpen.value,e.fillColorMenuOpen.value=!1,l&&(l.value=!1),i&&(i.value=!1)},e._toggleFillColorMenu=()=>{e.fillColorMenuOpen.value=!e.fillColorMenuOpen.value,e.textColorMenuOpen.value=!1,l&&(l.value=!1),i&&(i.value=!1)}})()}function Na(e,n){const o=t.ref("none"),l=t.ref(!1),i="#444";function d(f,S,y,_){const E=e.findMerge(S,y),s=E?E.range.endCol:S,v=E?E.range.endRow:y,R=E?E.range.startCol:S,U=(E?E.range.startRow:y)===_.startRow,De=v===_.endRow,Fe=R===_.startCol,ze=s===_.endCol,Be={top:0,bottom:0,left:0,right:0};switch(f){case"none":return Be;case"bottom":De&&(Be.bottom=1);break;case"top":U&&(Be.top=1);break;case"left":Fe&&(Be.left=1);break;case"right":ze&&(Be.right=1);break;case"all":Be.top=1,Be.bottom=1,Be.left=1,Be.right=1;break;case"outer":U&&(Be.top=1),De&&(Be.bottom=1),Fe&&(Be.left=1),ze&&(Be.right=1);break;case"thickOuter":U&&(Be.top=2),De&&(Be.bottom=2),Fe&&(Be.left=2),ze&&(Be.right=2);break}return Be}function r(f,S,y,_,E){var Be,T;if(f<0||S<0||f>=e.colCount||S>=e.rowCount)return;const s=e.findMerge(f,S);if(s&&(y==="Top"&&(f!==s.range.startCol||S!==s.range.startRow)||y==="Bottom"&&(f!==s.range.startCol||S!==s.range.endRow)||y==="Left"&&(f!==s.range.startCol||S!==s.range.startRow)||y==="Right"&&(f!==s.range.endCol||S!==s.range.startRow)))return;const v=s?s.anchor:e.cellKey(f,S),R=((Be=e.cells[v])==null?void 0:Be.value)??"",W=(T=e.cells[v])!=null&&T.style?{...e.cells[v].style}:{},U=`border${y}Width`;_===0?E&&Reflect.deleteProperty(W,U):(W[U]=_,W.borderColor=i),["Top","Bottom","Left","Right"].some(N=>W[`border${N}Width`]!==void 0)||Reflect.deleteProperty(W,"borderColor");const ze=Object.keys(W).length?W:null;R===""&&ze===null?e.delCell(v):e.cells[v]={value:R,style:ze}}function b(f,S){var U;const y=e.findMerge(f,S),_=y?y.anchor:e.cellKey(f,S),E=(U=e.cells[_])==null?void 0:U.style,s=(E==null?void 0:E.borderTopWidth)||0,v=(E==null?void 0:E.borderBottomWidth)||0,R=(E==null?void 0:E.borderLeftWidth)||0,W=(E==null?void 0:E.borderRightWidth)||0;if(y){const De=y.range.startRow,Fe=y.range.endRow,ze=y.range.startCol,Be=y.range.endCol;r(ze,De-1,"Bottom",s,!0),r(ze,Fe+1,"Top",v,!0),r(ze-1,De,"Right",R,!0),r(Be+1,De,"Left",W,!0)}else r(f,S-1,"Bottom",s,!0),r(f,S+1,"Top",v,!0),r(f-1,S,"Right",R,!0),r(f+1,S,"Left",W,!0)}e.syncCellBorders=b;function u(f,S,y,_=!0){var ze,Be;const E=e.findMerge(f,S),s=E?E.anchor:e.cellKey(f,S),v=((ze=e.cells[s])==null?void 0:ze.value)??"",R=(Be=e.cells[s])!=null&&Be.style?{...e.cells[s].style}:{},W=["Top","Bottom","Left","Right"],U=[y.top,y.bottom,y.left,y.right];for(let T=0;T<4;T++){const N=`border${W[T]}Width`;U[T]===0?_&&Reflect.deleteProperty(R,N):(R[N]=U[T],R.borderColor=i)}W.some(T=>R[`border${T}Width`]!==void 0)||Reflect.deleteProperty(R,"borderColor");const Fe=Object.keys(R).length?R:null;v===""&&Fe===null?e.delCell(s):e.cells[s]={value:v,style:Fe},b(E?E.range.startCol:f,E?E.range.startRow:S)}function k(f){var y,_;o.value=f;const S=e.selection.value;if(S){if(n.saveUndo(),f==="none")for(let E=S.startCol;E<=S.endCol;E++)for(let s=S.startRow;s<=S.endRow;s++){const v=e.findMerge(E,s);v&&(E!==v.range.startCol||s!==v.range.startRow)||u(E,s,{top:0,bottom:0,left:0,right:0},!0)}else for(let E=S.startCol;E<=S.endCol;E++)for(let s=S.startRow;s<=S.endRow;s++){const v=e.findMerge(E,s);if(v&&(E!==v.range.startCol||s!==v.range.startRow))continue;const R=d(f,E,s,S);u(E,s,R,!1)}(y=e.scheduleRender)==null||y.call(e),(_=e.emitModelData)==null||_.call(e)}}function M(){k(o.value)}function D(f,S,y){var s,v;const _=e.findMerge(f,S);if(_){const R=(s=e.cells[_.anchor])==null?void 0:s.style;return y==="Top"&&S===_.range.startRow?(R==null?void 0:R.borderTopWidth)||0:y==="Bottom"&&S===_.range.endRow?(R==null?void 0:R.borderBottomWidth)||0:y==="Left"&&f===_.range.startCol?(R==null?void 0:R.borderLeftWidth)||0:y==="Right"&&f===_.range.endCol&&(R==null?void 0:R.borderRightWidth)||0}const E=(v=e.cells[e.cellKey(f,S)])==null?void 0:v.style;return(E==null?void 0:E[`border${y}Width`])||0}const w=t.ref(!1);function B(f){w.value=f,f&&(n.textColorMenuOpen.value=!1,n.fillColorMenuOpen.value=!1,l.value=!1,n.fontSizeMenuOpen.value=!1)}function x(f,S,y,_){const E=[];for(const s in e.merges){const v=e.merges[s];v&&v.startCol<=y&&v.endCol>=f&&v.startRow<=_&&v.endRow>=S&&E.push(s)}for(const s of E)Reflect.deleteProperty(e.merges,s)}function le(){var E,s,v,R;const f=e.selection.value;if(!f||f.startCol===f.endCol&&f.startRow===f.endRow)return;n.saveUndo(),x(f.startCol,f.startRow,f.endCol,f.endRow);const S=e.cellKey(f.startCol,f.startRow),y=((E=e.cells[S])==null?void 0:E.value)??"";for(let W=f.startCol;W<=f.endCol;W++)for(let U=f.startRow;U<=f.endRow;U++)W===f.startCol&&U===f.startRow||e.clearCellsInRange(W,W,U,U);const _=(s=e.cells[S])!=null&&s.style?{...e.cells[S].style}:{};_.textAlign="center",e.cells[S]={value:y,style:_},e.merges[S]={startCol:f.startCol,startRow:f.startRow,endCol:f.endCol,endRow:f.endRow},e.selectCell(f.startCol,f.startRow),(v=e.scheduleRender)==null||v.call(e),(R=e.emitModelData)==null||R.call(e)}function ne(){var S,y,_;const f=e.selection.value;if(!(!f||f.startCol===f.endCol)){n.saveUndo();for(let E=f.startRow;E<=f.endRow;E++){x(f.startCol,E,f.endCol,E);const s=e.cellKey(f.startCol,E);(S=e.cells[s])==null||S.value;for(let v=f.startCol+1;v<=f.endCol;v++)e.clearCellsInRange(v,v,E,E);e.merges[s]={startCol:f.startCol,startRow:E,endCol:f.endCol,endRow:E}}e.selectRange(f.startCol,f.startRow,f.endCol,f.endRow),(y=e.scheduleRender)==null||y.call(e),(_=e.emitModelData)==null||_.call(e)}}function p(){var y,_,E;const f=e.selection.value;if(!f||f.startCol===f.endCol&&f.startRow===f.endRow)return;n.saveUndo(),x(f.startCol,f.startRow,f.endCol,f.endRow);const S=e.cellKey(f.startCol,f.startRow);(y=e.cells[S])==null||y.value;for(let s=f.startCol;s<=f.endCol;s++)for(let v=f.startRow;v<=f.endRow;v++)s===f.startCol&&v===f.startRow||e.clearCellsInRange(s,s,v,v);e.merges[S]={startCol:f.startCol,startRow:f.startRow,endCol:f.endCol,endRow:f.endRow},e.selectCell(f.startCol,f.startRow),(_=e.scheduleRender)==null||_.call(e),(E=e.emitModelData)==null||E.call(e)}function V(){var S,y;const f=e.selection.value;f&&(n.saveUndo(),x(f.startCol,f.startRow,f.endCol,f.endRow),(S=e.scheduleRender)==null||S.call(e),(y=e.emitModelData)==null||y.call(e))}function Y(){const f=e.selection.value;if(!f)return;const S=e.findMerge(f.startCol,f.startRow);S&&f.startCol===S.range.startCol&&f.startRow===S.range.startRow&&f.endCol===S.range.endCol&&f.endRow===S.range.endRow?V():le()}function oe(f){switch(f){case"mergeCenter":le();break;case"mergeAcross":ne();break;case"mergeCells":p();break;case"unmergeCells":V();break}}let Z=null,J=[];function q(f,S,y,_){var E;J=[];for(let s=y;s<=_;s++){const v=[];for(let R=f;R<=S;R++){const W=(E=e.cells[e.cellKey(R,s)])==null?void 0:E.style;v.push(W?{...W}:null)}J.push(v)}}function ue(f,S,y,_){const E=e.cellKey(f,S);if(vl(),y===""||y==null){e.formulaDeps.clear(E),_?e.cells[E]={value:"",style:{..._}}:e.delCell(E),e.formulaDeps.markDirty(E);return}e.cells[E]={value:y,style:_?{..._}:null},y.startsWith("=")?e.formulaDeps.set(E,El(y.slice(1),e.colCount,e.rowCount)):e.formulaDeps.clear(E),e.formulaDeps.markDirty(E)}function Ve(){const f=e.selection.value;if(!f)return;Z={...f},q(f.startCol,f.endCol,f.startRow,f.endRow);const S=[];for(let y=f.startRow;y<=f.endRow;y++){const _=[];for(let E=f.startCol;E<=f.endCol;E++)_.push(e.getCellRaw(E,y));S.push(_.join(" "))}yl(S.join(`
|
|
4
|
+
`))}function Oe(){const f=e.selection.value;if(f){if(f.startCol===0&&f.endCol===e.colCount-1){Z={...f},q(0,e.colCount-1,f.startRow,f.endRow);const S=[];for(let y=f.startRow;y<=f.endRow;y++){const _=[];for(let E=0;E<e.colCount;E++)_.push(e.getCellRaw(E,y));S.push(_.join(" "))}yl(S.join(`
|
|
5
|
+
`))}else if(f.startRow===0&&f.endRow===e.rowCount-1){Z={...f},q(f.startCol,f.endCol,0,e.rowCount-1);const S=[];for(let y=0;y<e.rowCount;y++){const _=[];for(let E=f.startCol;E<=f.endCol;E++)_.push(e.getCellRaw(E,y));S.push(_.join(" "))}yl(S.join(`
|
|
6
|
+
`))}}}async function Je(){var s;let f;try{f=await navigator.clipboard.readText()}catch{return}if(!f&&f!=="")return;const S=f.split(/\r?\n/),y=e.activeCell.value,_=Z,E=_&&J.length>0;for(let v=0;v<S.length;v++){const R=S[v].split(" ");for(let W=0;W<R.length;W++){const U=y.col+W,De=y.row+v;if(U<e.colCount&&De<e.rowCount){let Fe=R[W];if(Fe.startsWith("=")&&_&&(Fe=xa(Fe,U-(_.startCol+W),De-(_.startRow+v),e.colCount,e.rowCount,Ue)),E&&v<J.length&&W<(((s=J[v])==null?void 0:s.length)??0)){const ze=J[v][W]??null;ue(U,De,Fe,ze),b(U,De)}else e.setCellValue(U,De,Fe)}}}}function Ge(){var f;if(n.saveUndo(),Ve(),e.selection.value){const S=e.selection.value;e.clearCellsInRange(S.startCol,S.endCol,S.startRow,S.endRow),(f=e.scheduleRender)==null||f.call(e)}}function je(){var f;if(e.selection.value){const S=e.selection.value;e.clearCellsInRange(S.startCol,S.endCol,S.startRow,S.endRow),(f=e.scheduleRender)==null||f.call(e)}}function se(){var s,v;const f=e.selection.value;if(!f)return;n.saveUndo();const S=f.startCol,y=f.startRow,_=f.endCol,E=f.endRow;if(y===E)if(_+1<e.colCount){const R=`${Ue(S)}${y+1}:${Ue(_)}${y+1}`;e.setCellValue(_+1,y,`=SUM(${R})`)}else{const R=`${Ue(S)}${y+1}:${Ue(_-1)}${y+1}`;e.setCellValue(_,y,`=SUM(${R})`)}else for(let R=S;R<=_;R++)if(E+1<e.rowCount){const W=`${Ue(R)}${y+1}:${Ue(R)}${E+1}`;e.setCellValue(R,E+1,`=SUM(${W})`)}else{const W=`${Ue(R)}${y+1}:${Ue(R)}${E}`;e.setCellValue(R,E,`=SUM(${W})`)}(s=e.scheduleRender)==null||s.call(e),(v=e.emitModelData)==null||v.call(e)}function de(){var s,v;const f=e.selection.value;if(!f)return;n.saveUndo();const S=f.startCol,y=f.startRow,_=f.endCol,E=f.endRow;if(y===E)if(_+1<e.colCount){const R=`${Ue(S)}${y+1}:${Ue(_)}${y+1}`;e.setCellValue(_+1,y,`=AVERAGE(${R})`)}else{const R=`${Ue(S)}${y+1}:${Ue(_-1)}${y+1}`;e.setCellValue(_,y,`=AVERAGE(${R})`)}else for(let R=S;R<=_;R++)if(E+1<e.rowCount){const W=`${Ue(R)}${y+1}:${Ue(R)}${E+1}`;e.setCellValue(R,E+1,`=AVERAGE(${W})`)}else{const W=`${Ue(R)}${y+1}:${Ue(R)}${E}`;e.setCellValue(R,E,`=AVERAGE(${W})`)}(s=e.scheduleRender)==null||s.call(e),(v=e.emitModelData)==null||v.call(e)}function Se(){var s,v;const f=e.selection.value;if(!f)return;n.saveUndo();const S=f.startCol,y=f.startRow,_=f.endCol,E=f.endRow;if(y===E)if(_+1<e.colCount){const R=`${Ue(S)}${y+1}:${Ue(_)}${y+1}`;e.setCellValue(_+1,y,`=COUNT(${R})`)}else{const R=`${Ue(S)}${y+1}:${Ue(_-1)}${y+1}`;e.setCellValue(_,y,`=COUNT(${R})`)}else for(let R=S;R<=_;R++)if(E+1<e.rowCount){const W=`${Ue(R)}${y+1}:${Ue(R)}${E+1}`;e.setCellValue(R,E+1,`=COUNT(${W})`)}else{const W=`${Ue(R)}${y+1}:${Ue(R)}${E}`;e.setCellValue(R,E,`=COUNT(${W})`)}(s=e.scheduleRender)==null||s.call(e),(v=e.emitModelData)==null||v.call(e)}const re=t.ref(!1);function a(f){re.value=f,f&&(n.textColorMenuOpen.value=!1,n.fillColorMenuOpen.value=!1,l.value=!1,n.fontSizeMenuOpen.value=!1,w.value=!1)}function m(){se(),re.value=!1}function fe(){de(),re.value=!1}function Te(){Se(),re.value=!1}return{cachedBorder:o,borderMenuOpen:l,BORDER_COLOR:i,borderTypeToWidths:d,onBorderChange:k,setCellBorderSide:r,syncCellBorders:b,applyBorderToCell:u,applyCachedBorder:M,cellBorderWidth:D,mergeMenuOpen:w,onMergeMenuToggle:B,removeOverlappingMerges:x,mergeAndCenter:le,mergeAcross:ne,mergeCells:p,unmergeCells:V,onApplyMerge:Y,onMergeChange:oe,copySourceRange:null,copySourceStyles:[],captureStyles:q,setCellWithStyle:ue,copyToClipboard:Ve,copyRowCol:Oe,pasteFromClipboard:Je,cutSelected:Ge,clearSelected:je,sumSelected:se,avgSelected:de,countSelected:Se,calcMenuOpen:re,onCalcMenuToggle:a,onCalcSum:m,onCalcAvg:fe,onCalcCount:Te}}function Aa(e,n,o,l){const i={},d=l(n),r=l(o);return d!=null&&(i.width=`${d}px`),r!=null&&(i.height=`${r}px`),i["--sp-formula-bar-bg"]=e.formulaBarBg,i["--sp-formula-bar-border"]=e.formulaBarBorder,i["--sp-formula-bar-label-color"]=e.formulaBarLabelText,i["--sp-formula-bar-label-bg"]=e.formulaBarLabelBg,i["--sp-formula-bar-label-border"]=e.formulaBarLabelBorder,i["--sp-formula-bar-input-bg"]=e.formulaBarInputBg,i["--sp-formula-bar-input-border"]=e.formulaBarInputBorder,i["--sp-formula-bar-input-color"]=e.formulaBarInputText,i["--sp-formula-bar-input-focus-border"]=e.formulaBarInputFocusBorder,i["--sp-formula-bar-input-focus-shadow"]=e.formulaBarInputFocusShadow,i["--sp-wrapper-bg"]=e.wrapperBg,i["--sp-cell-editor-border"]=e.cellEditorBorder,i["--sp-cell-editor-color"]=e.cellEditorText,i["--sp-cell-editor-bg"]=e.cellEditorBg,i["--sp-cell-editor-shadow"]=e.cellEditorShadow,i["--sp-tab-bar-bg"]=e.tabBarBg,i["--sp-tab-bar-border"]=e.tabBarBorder,i["--sp-tab-active-bg"]=e.tabActiveBg,i["--sp-tab-active-color"]=e.tabActiveText,i["--sp-tab-active-border"]=e.tabActiveBorder,i["--sp-tab-inactive-bg"]=e.tabInactiveBg,i["--sp-tab-inactive-color"]=e.tabInactiveText,i["--sp-tab-inactive-border"]=e.tabInactiveBorder,i["--sp-tab-hover-bg"]=e.tabHoverBg,i["--sp-tab-add-btn-color"]=e.tabAddBtnColor,i["--sp-tab-add-btn-hover-bg"]=e.tabAddBtnHoverBg,i["--sp-tab-scroll-btn-color"]=e.tabScrollBtnColor,i["--sp-tab-scroll-btn-hover-bg"]=e.tabScrollBtnHoverBg,i["--sp-scroll-thumb"]=e.scrollbarThumb,i["--sp-scroll-thumb-hover"]=e.scrollbarThumbHover,i["--sp-scroll-btn-bg"]=e.scrollBtnBg,i["--sp-scroll-btn-color"]=e.scrollBtnColor,i["--sp-scroll-btn-hover-bg"]=e.scrollBtnHoverBg,i["--sp-scroll-btn-active-bg"]=e.scrollBtnActiveBg,i["--sp-scroll-track-bg"]=e.scrollTrackBg,i["--sp-toolbar-bg"]=e.toolbarBg,i["--sp-toolbar-border"]=e.toolbarBorder,i["--sp-toolbar-btn-color"]=e.toolbarBtnColor,i["--sp-toolbar-btn-hover-bg"]=e.toolbarBtnHoverBg,i["--sp-toolbar-btn-disabled-color"]=e.toolbarBtnDisabledColor,i["--sp-toolbar-btn-active-color"]=e.toolbarBtnActiveColor,i}function Ha(e,n,o,l,i){function d(T,N){var ee,ae;const P=N-T+1,ce=M(T,N);for(let X=T;X<=N;X++)for(let G=0;G<e.colCount;G++)e.delCell(e.cellKey(G,X));for(let X=T;X<e.rowCount-P;X++){for(let G=0;G<e.colCount;G++){const ye=e.cellKey(G,X+P),Ee=e.cellKey(G,X);e.cells[ye]?(e.cells[Ee]=e.cells[ye],e.delCell(ye)):e.delCell(Ee)}e.rowHeights.value[X]=e.rowHeights.value[X+P]}for(let X=e.rowCount-P;X<e.rowCount;X++){for(let G=0;G<e.colCount;G++)e.delCell(e.cellKey(G,X));e.rowHeights.value[X]=void 0}if(k(ce),T>0)for(let X=0;X<e.colCount;X++)(ee=e.syncCellBorders)==null||ee.call(e,X,T-1),(ae=e.syncCellBorders)==null||ae.call(e,X,T)}function r(T,N){const P=N-T+1;if(N>=e.rowCount-1)return;const ce=w(T,N);for(let ee=e.rowCount-1;ee>N;ee--){for(let ae=0;ae<e.colCount;ae++){const X=e.cellKey(ae,ee-P),G=e.cellKey(ae,ee);e.cells[X]?e.cells[G]=e.cells[X]:e.delCell(G)}e.rowHeights.value[ee]=e.rowHeights.value[ee-P]}for(let ee=N+1;ee<=N+P;ee++){for(let ae=0;ae<e.colCount;ae++)e.delCell(e.cellKey(ae,ee));e.rowHeights.value[ee]=void 0}k(ce)}function b(T,N){const P=N-T+1;if(N>=e.colCount-1)return;const ce=B(T,N);for(let ee=e.colCount-1;ee>N;ee--){for(let ae=0;ae<e.rowCount;ae++){const X=e.cellKey(ee-P,ae),G=e.cellKey(ee,ae);e.cells[X]?e.cells[G]=e.cells[X]:e.delCell(G)}e.colWidths.value[ee]=e.colWidths.value[ee-P]}for(let ee=N+1;ee<=N+P;ee++){for(let ae=0;ae<e.rowCount;ae++)e.delCell(e.cellKey(ee,ae));e.colWidths.value[ee]=100}k(ce)}function u(T,N){var ee,ae;const P=N-T+1,ce=D(T,N);for(let X=T;X<=N;X++)for(let G=0;G<e.rowCount;G++)e.delCell(e.cellKey(X,G));for(let X=T;X<e.colCount-P;X++){for(let G=0;G<e.rowCount;G++){const ye=e.cellKey(X+P,G),Ee=e.cellKey(X,G);e.cells[ye]?(e.cells[Ee]=e.cells[ye],e.delCell(ye)):e.delCell(Ee)}e.colWidths.value[X]=e.colWidths.value[X+P]}for(let X=e.colCount-P;X<e.colCount;X++){for(let G=0;G<e.rowCount;G++)e.delCell(e.cellKey(X,G));e.colWidths.value[X]=100}if(k(ce),T>0)for(let X=0;X<e.rowCount;X++)(ee=e.syncCellBorders)==null||ee.call(e,T-1,X),(ae=e.syncCellBorders)==null||ae.call(e,T,X)}function k(T){Object.keys(e.merges).forEach(N=>Reflect.deleteProperty(e.merges,N));for(const N of T)if(!(N.newRange.startCol>N.newRange.endCol||N.newRange.startRow>N.newRange.endRow)&&(e.merges[N.newAnchorKey]={...N.newRange},N.anchorCell)){const P=N.anchorCell.value,ce=N.anchorCell.style;P===""&&(!ce||Object.keys(ce).length===0)||(e.cells[N.newAnchorKey]={value:P,style:ce&&Object.keys(ce).length?{...ce}:null})}}function M(T,N){const P=N-T+1,ce=[];for(const ee in e.merges){const ae=e.merges[ee];if(!ae)continue;const X=e.cells[ee]?{value:e.cells[ee].value,style:e.cells[ee].style?{...e.cells[ee].style}:null}:{value:"",style:null},{startCol:G,endCol:ye}=ae;let{startRow:Ee,endRow:Ze}=ae;if(Ee>N){Ee-=P,Ze-=P,ce.push({newAnchorKey:e.cellKey(G,Ee),newRange:{startCol:G,startRow:Ee,endCol:ye,endRow:Ze}});continue}if(Ze<T){ce.push({newAnchorKey:ee,newRange:{startCol:G,startRow:Ee,endCol:ye,endRow:Ze}});continue}if(Ee>=T&&Ze<=N||(Ee>=T&&Ee<=N&&(Ee=T),Ze>=T&&Ze<=N?Ze=T-1:Ze>N&&(Ze-=P),Ee>Ze))continue;const Pe=G,H=Ee,O=e.cellKey(Pe,H),Q=ee.split(",").map(Number)[1],ie=Q>=T&&Q<=N||Pe!==ae.startCol||H!==Q;ce.push({newAnchorKey:O,newRange:{startCol:G,startRow:Ee,endCol:ye,endRow:Ze},anchorCell:ie?X:void 0})}return ce}function D(T,N){const P=N-T+1,ce=[];for(const ee in e.merges){const ae=e.merges[ee];if(!ae)continue;const X=e.cells[ee]?{value:e.cells[ee].value,style:e.cells[ee].style?{...e.cells[ee].style}:null}:{value:"",style:null};let{startCol:G,endCol:ye}=ae;const{startRow:Ee,endRow:Ze}=ae;if(G>N){G-=P,ye-=P,ce.push({newAnchorKey:e.cellKey(G,Ee),newRange:{startCol:G,startRow:Ee,endCol:ye,endRow:Ze}});continue}if(ye<T){ce.push({newAnchorKey:ee,newRange:{startCol:G,startRow:Ee,endCol:ye,endRow:Ze}});continue}if(G>=T&&ye<=N||(G>=T&&G<=N&&(G=T),ye>=T&&ye<=N?ye=T-1:ye>N&&(ye-=P),G>ye))continue;const Pe=G,H=Ee,O=e.cellKey(Pe,H),Q=ee.split(",").map(Number)[0],ie=Q>=T&&Q<=N||Pe!==Q||H!==ae.startRow;ce.push({newAnchorKey:O,newRange:{startCol:G,startRow:Ee,endCol:ye,endRow:Ze},anchorCell:ie?X:void 0})}return ce}function w(T,N){const P=N-T+1,ce=[];for(const ee in e.merges){const ae=e.merges[ee];if(!ae)continue;const{startCol:X,endCol:G}=ae;let{startRow:ye,endRow:Ee}=ae;Ee<T?ce.push({newAnchorKey:ee,newRange:{startCol:X,startRow:ye,endCol:G,endRow:Ee}}):ye>N?(ye+=P,Ee+=P,ce.push({newAnchorKey:e.cellKey(X,ye),newRange:{startCol:X,startRow:ye,endCol:G,endRow:Ee}})):(Ee+=P,ce.push({newAnchorKey:ee,newRange:{startCol:X,startRow:ye,endCol:G,endRow:Ee}}))}return ce}function B(T,N){const P=N-T+1,ce=[];for(const ee in e.merges){const ae=e.merges[ee];if(!ae)continue;let{startCol:X,endCol:G}=ae;const{startRow:ye,endRow:Ee}=ae;G<T?ce.push({newAnchorKey:ee,newRange:{startCol:X,startRow:ye,endCol:G,endRow:Ee}}):X>N?(X+=P,G+=P,ce.push({newAnchorKey:e.cellKey(X,ye),newRange:{startCol:X,startRow:ye,endCol:G,endRow:Ee}})):(G+=P,ce.push({newAnchorKey:ee,newRange:{startCol:X,startRow:ye,endCol:G,endRow:Ee}}))}return ce}let x=0;function le(){return x++,`s_${x}`}function ne(T){return{id:le(),name:T,cells:{},merges:{},selection:{startCol:0,startRow:0,endCol:0,endRow:0},activeCell:{col:0,row:0},scrollX:0,scrollY:0,colWidths:new Array(e.colCount).fill(100),rowHeights:new Array(e.rowCount).fill(void 0)}}const p=t.ref([ne("Sheet1")]),V=t.ref(0);function Y(){const T=p.value[V.value];T&&(T.cells={...e.cells},T.merges={...e.merges},T.selection=e.selection.value?{...e.selection.value}:null,T.activeCell={...e.activeCell.value},T.scrollX=e.scrollX.value,T.scrollY=e.scrollY.value,T.colWidths=[...e.colWidths.value],T.rowHeights=[...e.rowHeights.value])}function oe(T){const N=p.value[T];N&&(Object.keys(e.cells).forEach(P=>e.delCell(P)),Object.assign(e.cells,N.cells),Object.keys(e.merges).forEach(P=>Reflect.deleteProperty(e.merges,P)),N.merges&&Object.assign(e.merges,N.merges),e.selection.value=N.selection?{...N.selection}:null,e.activeCell.value={...N.activeCell},e.scrollX.value=N.scrollX,e.scrollY.value=N.scrollY,e.colWidths.value=[...N.colWidths],e.rowHeights.value=[...N.rowHeights],V.value=T)}function Z(T){T===V.value||T<0||T>=p.value.length||(e.cancelEdit(),Y(),oe(T))}function J(T){return n.saveUndo(),e.cancelEdit(),Y(),p.value.push(ne(T??`Sheet${p.value.length+1}`)),oe(p.value.length-1),p.value.length-1}function q(T){return p.value.length<=1||(n.saveUndo(),e.cancelEdit(),p.value.splice(T,1),oe(Math.min(T,p.value.length-1))),V.value}function ue(T,N){p.value[T]&&N.trim()&&(n.saveUndo(),p.value[T].name=N.trim())}function Ve(T){n.saveUndo(),e.cancelEdit(),Y();const N=p.value[T];if(!N)return T;let P=N.name;const ce=P.match(/^(.*?)\s*\((\d+)\)$/);let ee=ce?parseInt(ce[2],10)+1:2;ce&&(P=ce[1]);let ae=`${P} (${ee})`;const X=new Set(p.value.map(ye=>ye.name));for(;X.has(ae);)ee++,ae=`${P} (${ee})`;const G={id:le(),name:ae,cells:{...N.cells},merges:N.merges?{...N.merges}:{},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]};return p.value.splice(T+1,0,G),oe(T+1),T+1}function Oe(T,N){var ae;const P=T+N;if(P<0||P>=p.value.length)return;n.saveUndo();const ce=V.value,ee=p.value.splice(T,1)[0];p.value.splice(P,0,ee),ce===T?V.value=P:T<ce&&P>=ce?V.value=ce-1:T>ce&&P<=ce&&(V.value=ce+1),(ae=e.scheduleRender)==null||ae.call(e)}const Je=t.computed(()=>p.value.length);let Ge="";const je=o;function se(){Y();const T=p.value.map(P=>{const ce={};for(const[G,ye]of Object.entries(P.cells))ce[G]={value:ye.value},ye.style&&(ce[G].style=ye.style);const ee={name:P.name,cells:ce};P.merges&&Object.keys(P.merges).length&&(ee.merges={...P.merges});const ae={};for(let G=0;G<P.colWidths.length;G++)P.colWidths[G]!==100&&(ae[G]=P.colWidths[G]);Object.keys(ae).length&&(ee.colWidths=ae);const X={};for(let G=0;G<P.rowHeights.length;G++){const ye=P.rowHeights[G];ye!=null&&(X[G]=ye)}return Object.keys(X).length&&(ee.rowHeights=X),ee}),N=JSON.stringify(T);N!==Ge&&(Ge=N,je.value=T,i&&(i.value=N))}e.emitModelData=se;let de=!1;function Se(){de||(de=!0,Promise.resolve().then(()=>{de=!1,se()}))}const re=t.computed(()=>e.props.theme==="dark"?Eo:ko),a=t.computed(()=>Aa(re.value,e.props.width,e.props.height,Vt)),m=t.computed(()=>{const T={};for(const[N,P]of Object.entries(a.value))N.startsWith("--")&&(T[N]=P);return T}),fe=t.ref(null),Te=t.ref(null),f=t.ref(null),S=t.ref(null),y=t.reactive({w:800,h:600});e.viewSize&&t.watch(y,T=>{e.viewSize&&(e.viewSize.w=T.w,e.viewSize.h=T.h)},{deep:!0});const _=48,E=28,s=11,v=t.computed(()=>Math.max(0,e.totalWidth.value-Math.max(0,y.w-_-s))),R=t.computed(()=>Math.max(0,e.totalHeight.value-Math.max(0,y.h-E-s)));function W(T,N){const P=Math.max(0,y.w-_-s),ce=Math.max(0,y.h-E-s);e.scrollX.value=Math.max(0,Math.min(T??e.scrollX.value,Math.max(0,e.totalWidth.value-P))),e.scrollY.value=Math.max(0,Math.min(N??e.scrollY.value,Math.max(0,e.totalHeight.value-ce)))}e.clampScroll=W;function U(){var T;return typeof window>"u"?!1:!((T=window.matchMedia)!=null&&T.call(window,"(hover: none) and (pointer: coarse)").matches)}function De(T=!1){t.nextTick(()=>{const N=f.value;if(N){if(!e.editingCell.value&&!U()){document.activeElement===N&&N.blur();return}N.focus({preventScroll:!0}),T&&N.select()}})}function Fe(){De()}function ze(){var N;const T=e.selection.value;if(T){n.saveUndo();for(let P=T.startRow;P<=T.endRow;P++)e.rowHeights.value[P]=void 0;(N=e.scheduleRender)==null||N.call(e),se()}}function Be(){var N;const T=e.selection.value;if(T){n.saveUndo();for(let P=T.startCol;P<=T.endCol;P++)e.colWidths.value[P]=100;(N=e.scheduleRender)==null||N.call(e),se()}}return{deleteRows:d,insertRows:r,insertCols:b,deleteCols:u,sheets:p,activeSheetIndex:V,saveSheet:Y,loadSheet:oe,switchSheet:Z,addSheet:J,removeSheet:q,renameSheet:ue,dupSheet:Ve,moveSheet:Oe,sheetCount:Je,mkSheet:ne,emitModelData:se,scheduleOptEmit:Se,themeColors:re,outerStyle:a,toolbarThemeVars:m,wrapperRef:fe,canvasRef:Te,editInputRef:f,formulaBarRef:S,viewSize:y,maxScrollX:v,maxScrollY:R,clampScroll:W,canFocusHiddenEditor:U,focusEditInput:De,onCanvasFocus:Fe,resetRowHeight:ze,resetColWidth:Be,modelData:je}}function Va(e,n,o,l,i){let d=!1,r=null,b=1;function u(){d||(d=!0,requestAnimationFrame(()=>{d=!1,M()}))}e.scheduleRender=u;const k="#444";function M(){var Tl,$t,Qt,Mt,Nt,el,lo,oo,no,ro,ao;const c=l.canvasRef.value;if(!c)return;const g=l.wrapperRef.value;if(!g||(r=c.getContext("2d"),!r))return;b=window.devicePixelRatio||1;const $=g.getBoundingClientRect(),z=$.width,h=$.height;l.viewSize.w=z,l.viewSize.h=h,c.width=z*b,c.height=h*b,c.style.width=z+"px",c.style.height=h+"px",r.setTransform(b,0,0,b,0,0);const L=e.scrollX.value,pe=e.scrollY.value,ve=52,he=24,He=l.themeColors.value,ct=e.colPositions.value,ot=e.rowPositions.value,ht=e.colWidths.value,pt=[];for(let j=0;j<e.rowCount;j++)pt[j]=ot[j+1]-ot[j];const Bt=Math.max(0,e.hitCol(L));let Ut=Bt;for(let j=Bt;j<e.colCount&&!(ve+ct[j]-L>=z);j++)Ut=j;const xt=Ut,wt=Math.max(0,e.hitRow(pe));let cl=wt;for(let j=wt;j<e.rowCount&&!(he+ot[j]-pe>=h);j++)cl=j;const bt=cl;let Lt=Bt,It=wt;for(const j in e.merges){const te=e.merges[j];te&&(te.startRow>bt||te.endRow<wt||te.startCol>xt||te.endCol<Bt||(te.startCol<Lt&&(Lt=te.startCol),te.startRow<It&&(It=te.startRow)))}r.fillStyle=He.bg,r.fillRect(0,0,z,h),r.fillStyle=He.gridBg,r.fillRect(ve,he,z-ve,h-he),r.save(),r.beginPath(),r.rect(ve,he,z-ve,h-he),r.clip();const ft=e.selection.value,Jt=e.editingCell.value;for(let j=It;j<=bt;j++)for(let te=Lt;te<=xt;te++){const xe=e.findMerge(te,j);if(xe&&!(te===xe.range.startCol&&j===xe.range.startRow))continue;const Ie=ve+ct[te]-L,$e=he+ot[j]-pe;let Ye=ht[te],Xe=pt[j];if(xe&&(Ye=ct[xe.range.endCol+1]-ct[te],Xe=ot[xe.range.endRow+1]-ot[j]),Ie+Ye<ve||$e+Xe<he||Ie>z||$e>h)continue;const nt=e.findHighlight?e.findHighlight(te,j):null,yt=(Tl=e.cells[e.cellKey(te,j)])==null?void 0:Tl.style,St=typeof(yt==null?void 0:yt.backgroundColor)=="string"?yt.backgroundColor:"";if(St&&(r.fillStyle=St,r.fillRect(Ie,$e,Ye,Xe)),nt&&(r.fillStyle=nt==="active"?He.findActiveBg:He.findMatchBg,r.fillRect(Ie,$e,Ye,Xe)),e.isSelected(te,j)&&(r.fillStyle=He.selectionBg,e.selectionMode.value==="row"||e.selectionMode.value==="col"?r.fillRect(Ie,$e,ht[te],pt[j]):r.fillRect(Ie,$e,Ye,Xe)),e.activeCell.value.col===te&&e.activeCell.value.row===j&&(r.strokeStyle=He.activeCellBorder,r.lineWidth=2,r.strokeRect(Ie+1,$e+1,Ye-2,Xe-2)),nt==="active"&&(r.strokeStyle=He.findActiveBg,r.lineWidth=2,r.strokeRect(Ie+1,$e+1,Ye-2,Xe-2)),r.strokeStyle=He.gridLine,r.lineWidth=.5,r.strokeRect(Ie+.25,$e+.25,Ye-.5,Xe-.5),!(Jt&&Jt.col===te&&Jt.row===j)){const Re=($t=e.cells[e.cellKey(te,j)])==null?void 0:$t.style,at=e.getCellValue(te,j),qe=typeof(Re==null?void 0:Re.numberFormat)=="string"?Re.numberFormat:"",et=at?hl(at,qe,e.locale.value):"";if(et){const tt=e.cellFontSize(te,j),ut=typeof(Re==null?void 0:Re.fontFamily)=="string"&&Re.fontFamily?Re.fontFamily:Pt,Ke=(Re==null?void 0:Re.fontWeight)==="bold"?"bold":"normal",mt=(Re==null?void 0:Re.fontStyle)==="italic"?"italic":"normal",Ct=(Re==null?void 0:Re.underline)==="underline",st=(Re==null?void 0:Re.strikethrough)==="line-through",zt=typeof(Re==null?void 0:Re.color)=="string"?Re.color:"",tl=typeof(Re==null?void 0:Re.textAlign)=="string"?Re.textAlign:_l(at,qe)?"right":"left",ll=typeof(Re==null?void 0:Re.verticalAlign)=="string"?Re.verticalAlign:"top";r.fillStyle=zt||He.cellText,r.font=`${mt} ${Ke} ${tt}px ${ut}`,r.textBaseline="alphabetic",r.save(),r.beginPath(),r.rect(Ie+5,$e+1,Ye-10,Xe-2),r.clip();const io=(Re==null?void 0:Re.wrap)==="wrap",sl=Ye-10;let Dl=et;const yi=!io&&$o(qe),co=et===gl||zo(at,qe);if(co||yi){if(co){const Wt=Math.max(1,r.measureText("#").width),ol=Math.max(1,Math.floor(sl/Wt));Dl="#".repeat(ol)}else if(e.getWrappedLines(r,et,1e9,!1).some(Tt=>Tt&&r.measureText(Tt).width>sl)){const Tt=Math.max(1,r.measureText("#").width),Gt=Math.max(1,Math.floor(sl/Tt));Dl="#".repeat(Gt)}}const dl=e.getWrappedLines(r,Dl,sl,io),{ascent:ul,descent:fl}=e.measureFontMetrics(ut,tt,Ke,mt),ml=ul+fl,vi=dl.length*ml;let pl;ll==="middle"?pl=$e+(Xe-vi)/2+ul:ll==="bottom"?pl=$e+Xe-e.BASE_CELL_VPAD-fl-(dl.length-1)*ml:pl=$e+e.BASE_CELL_VPAD+ul;for(let Wt=0;Wt<dl.length;Wt++){const ol=dl[Wt],Tt=pl+Wt*ml,Gt=r.measureText(ol);let At;if(tl==="center"?At=Ie+Ye/2-Gt.width/2:tl==="right"?At=Ie+Ye-5-Gt.width:At=Ie+5,r.fillText(ol,At,Tt),Ct&&(r.strokeStyle=zt||He.cellText,r.lineWidth=1,r.beginPath(),r.moveTo(At,Tt+fl+1),r.lineTo(At+Gt.width,Tt+fl+1),r.stroke()),st){r.strokeStyle=zt||He.cellText,r.lineWidth=1;const so=Tt-ul+ml*.42;r.beginPath(),r.moveTo(At,so),r.lineTo(At+Gt.width,so),r.stroke()}}r.restore()}}}for(let j=It;j<=bt;j++)for(let te=Lt;te<=xt;te++){const xe=e.findMerge(te,j);if(xe&&!(te===xe.range.startCol&&j===xe.range.startRow))continue;const Ie=ve+ct[te]-L,$e=he+ot[j]-pe;let Ye=ht[te],Xe=pt[j];if(xe&&(Ye=ct[xe.range.endCol+1]-ct[te],Xe=ot[xe.range.endRow+1]-ot[j]),Ie+Ye<ve||$e+Xe<he||Ie>z||$e>h)continue;const nt=(Qt=e.cells[e.cellKey(te,j)])==null?void 0:Qt.style,yt=(nt==null?void 0:nt.borderTopWidth)||0,St=(nt==null?void 0:nt.borderLeftWidth)||0,Re=(nt==null?void 0:nt.borderBottomWidth)||0,at=(nt==null?void 0:nt.borderRightWidth)||0;if(r.fillStyle=k,xe){const qe=xe.range.startRow,et=xe.range.endRow,tt=xe.range.startCol,ut=xe.range.endCol;for(let Ke=tt;Ke<=ut;Ke++){const mt=ve+ct[Ke]-L,Ct=ht[Ke],st=Math.max(yt,o.cellBorderWidth(Ke,qe-1,"Bottom"));st>0&&r.fillRect(mt,$e,Ct,st)}for(let Ke=tt;Ke<=ut;Ke++){const mt=ve+ct[Ke]-L,Ct=ht[Ke],st=Math.max(Re,o.cellBorderWidth(Ke,et+1,"Top"));st>0&&r.fillRect(mt,$e+Xe-st,Ct,st)}for(let Ke=qe;Ke<=et;Ke++){const mt=he+ot[Ke]-pe,Ct=pt[Ke],st=Math.max(St,o.cellBorderWidth(tt-1,Ke,"Right"));st>0&&r.fillRect(Ie,mt,st,Ct)}for(let Ke=qe;Ke<=et;Ke++){const mt=he+ot[Ke]-pe,Ct=pt[Ke],st=Math.max(at,o.cellBorderWidth(ut+1,Ke,"Left"));st>0&&r.fillRect(Ie+Ye-st,mt,st,Ct)}}else{const qe=Math.max(yt,o.cellBorderWidth(te,j-1,"Bottom")),et=Math.max(St,o.cellBorderWidth(te-1,j,"Right")),tt=Math.max(Re,o.cellBorderWidth(te,j+1,"Top")),ut=Math.max(at,o.cellBorderWidth(te+1,j,"Left"));(qe>0||et>0||tt>0||ut>0)&&(qe>0&&r.fillRect(Ie,$e,Ye,qe),tt>0&&r.fillRect(Ie,$e+Xe-tt,Ye,tt),et>0&&r.fillRect(Ie,$e,et,Xe),ut>0&&r.fillRect(Ie+Ye-ut,$e,ut,Xe))}}for(let j=It;j<=bt;j++)for(let te=Lt;te<=xt;te++){const xe=e.findMerge(te,j);if(xe&&!(te===xe.range.startCol&&j===xe.range.startRow))continue;const Ie=ve+ct[te]-L,$e=he+ot[j]-pe;let Ye=ht[te],Xe=pt[j];if(xe&&(Ye=ct[xe.range.endCol+1]-ct[te],Xe=ot[xe.range.endRow+1]-ot[j]),Ie+Ye<ve||$e+Xe<he||Ie>z||$e>h)continue;const nt=((Nt=(Mt=e.cells[e.cellKey(te,j)])==null?void 0:Mt.style)==null?void 0:Nt.borderTopWidth)||0,yt=((lo=(el=e.cells[e.cellKey(te,j)])==null?void 0:el.style)==null?void 0:lo.borderLeftWidth)||0,St=((no=(oo=e.cells[e.cellKey(te,j)])==null?void 0:oo.style)==null?void 0:no.borderBottomWidth)||0,Re=((ao=(ro=e.cells[e.cellKey(te,j)])==null?void 0:ro.style)==null?void 0:ao.borderRightWidth)||0;if(r.fillStyle=k,xe){const at=xe.range.startRow,qe=xe.range.endRow,et=xe.range.startCol,tt=xe.range.endCol,ut=Math.max(nt,o.cellBorderWidth(et,at-1,"Bottom")),Ke=Math.max(yt,o.cellBorderWidth(et-1,at,"Right"));ut>0&&Ke>0&&r.fillRect(Ie-Ke,$e-ut,Ke,ut);const mt=Math.max(nt,o.cellBorderWidth(tt,at-1,"Bottom")),Ct=Math.max(Re,o.cellBorderWidth(tt+1,at,"Left"));mt>0&&Ct>0&&r.fillRect(Ie+Ye,$e-mt,Ct,mt);const st=Math.max(St,o.cellBorderWidth(et,qe+1,"Top")),zt=Math.max(yt,o.cellBorderWidth(et-1,qe,"Right"));st>0&&zt>0&&r.fillRect(Ie-zt,$e+Xe,zt,st);const tl=Math.max(St,o.cellBorderWidth(tt,qe+1,"Top")),ll=Math.max(Re,o.cellBorderWidth(tt+1,qe,"Left"));tl>0&&ll>0&&r.fillRect(Ie+Ye,$e+Xe,ll,tl)}else{const at=Math.max(nt,o.cellBorderWidth(te,j-1,"Bottom")),qe=Math.max(yt,o.cellBorderWidth(te-1,j,"Right")),et=Math.max(St,o.cellBorderWidth(te,j+1,"Top")),tt=Math.max(Re,o.cellBorderWidth(te+1,j,"Left"));at>0&&qe>0&&r.fillRect(Ie-qe,$e-at,qe,at),at>0&&tt>0&&r.fillRect(Ie+Ye,$e-at,tt,at),et>0&&qe>0&&r.fillRect(Ie-qe,$e+Xe,qe,et),et>0&&tt>0&&r.fillRect(Ie+Ye,$e+Xe,tt,et)}}r.restore(),r.fillStyle=He.headerBg,r.fillRect(ve,0,z-ve,he);for(let j=Bt;j<=xt;j++){const te=ve+ct[j]-L,xe=ht[j];te+xe<ve||te>z||(ft&&j>=ft.startCol&&j<=ft.endCol&&(r.fillStyle=He.selectionBg,r.fillRect(te,0,xe,he)),r.strokeStyle=He.headerBorder,r.lineWidth=.5,r.strokeRect(te+.25,.25,xe-.5,he-.5),ft&&j>=ft.startCol&&j<=ft.endCol&&(r.strokeStyle=He.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(te,he-1),r.lineTo(te+xe,he-1),r.stroke()),r.fillStyle=He.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(Ue(j),te+xe/2,he/2))}r.strokeStyle=He.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(ve,he+.5),r.lineTo(z,he+.5),r.stroke(),r.fillStyle=He.headerBg,r.fillRect(0,he,ve,h-he);for(let j=wt;j<=bt;j++){const te=he+ot[j]-pe,xe=pt[j];te+xe<he||te>h||(ft&&j>=ft.startRow&&j<=ft.endRow&&(r.fillStyle=He.selectionBg,r.fillRect(0,te,ve,xe)),r.strokeStyle=He.headerBorder,r.lineWidth=.5,r.strokeRect(.25,te+.25,ve-.5,xe-.5),ft&&j>=ft.startRow&&j<=ft.endRow&&(r.strokeStyle=He.activeCellBorder,r.lineWidth=2,r.beginPath(),r.moveTo(ve-1,te),r.lineTo(ve-1,te+xe),r.stroke()),r.fillStyle=He.headerText,r.font='11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',r.textAlign="center",r.textBaseline="middle",r.fillText(String(j+1),ve/2,te+xe/2+.5))}r.strokeStyle=He.headerSep,r.lineWidth=1,r.beginPath(),r.moveTo(ve+.5,he),r.lineTo(ve+.5,h),r.stroke(),r.fillStyle=He.headerBg,r.fillRect(0,0,ve,he),r.strokeStyle=He.headerSep,r.lineWidth=1,r.strokeRect(.5,.5,ve-.5,he-.5)}const D=t.computed(()=>Ue(e.activeCell.value.col)+String(e.activeCell.value.row+1)),w=t.ref(""),B=t.ref(!1),x=t.computed(()=>e.editingCell.value?w.value:e.getCellRaw(e.activeCell.value.col,e.activeCell.value.row));t.watch(()=>e.editingCell.value,(c,g)=>{if(c&&!g){const $=e.editValue.value||e.getCellRaw(c.col,c.row)||"";w.value=$,V=!1}else!c&&g&&(w.value="",B.value=!1,V=!1)},{immediate:!0}),t.watch(()=>[e.activeCell.value.col,e.activeCell.value.row],()=>{e.editingCell.value||(w.value="",V=!1)});function le(){e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),u())}function ne(c){const g=c.target.value;w.value=g,V=!0,e.editingCell.value||e.startEdit()}let p=!1,V=!1;function Y(){var L,pe,ve,he,He,ct,ot,ht,pt;if(p)return;const c=l.formulaBarRef.value,g=!!(c&&typeof document<"u"&&document.activeElement===c);if(!e.editingCell.value&&!g&&!V)return;const $={...e.activeCell.value},z=e.editingCell.value?e.editingCell.value.col:$.col,h=e.editingCell.value?e.editingCell.value.row:$.row;if(!e.editingCell.value){const Bt=e.getCellRaw(z,h),Ut=w.value!==Bt;if(!V)return;p=!0,Ut&&((L=e.saveUndo)==null||L.call(e),e.setCellValue(z,h,w.value),u(),(pe=l.emitModelData)==null||pe.call(l)),(ve=l.formulaBarRef.value)==null||ve.blur(),w.value="",B.value=!1,V=!1,t.nextTick(()=>{p=!1});return}p=!0,V?(e.editValue.value=w.value,e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),(he=l.formulaBarRef.value)==null||he.blur(),w.value="",B.value=!1,V=!1,u(),l.focusEditInput(),(He=l.emitModelData)==null||He.call(l),t.nextTick(()=>{p=!1})):g?(w.value=e.editValue.value,e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),(ct=l.formulaBarRef.value)==null||ct.blur(),w.value="",B.value=!1,V=!1,u(),l.focusEditInput(),(ot=l.emitModelData)==null||ot.call(l),t.nextTick(()=>{p=!1})):(e.commitEdit(),(ht=l.formulaBarRef.value)==null||ht.blur(),w.value="",B.value=!1,V=!1,u(),l.focusEditInput(),(pt=l.emitModelData)==null||pt.call(l),t.nextTick(()=>{p=!1}))}function oe(){var c;p||(p=!0,e.editingCell.value&&e.cancelEdit(),(c=l.formulaBarRef.value)==null||c.blur(),w.value="",B.value=!1,V=!1,u(),l.focusEditInput(),t.nextTick(()=>{p=!1}))}function Z(c){if(!c.isComposing){if(c.key==="Enter"&&(c.altKey||c.metaKey)&&!c.ctrlKey){c.preventDefault(),c.stopPropagation();const g=c.target;if(!g)return;e.editingCell.value||e.startEdit();const $=g.selectionStart??g.value.length,z=g.selectionEnd??g.value.length,h=g.value,L=h.substring(0,$)+`
|
|
7
|
+
`+h.substring(z),pe=$+1;w.value=L,B.value||(B.value=!0),t.nextTick(()=>{try{g.setSelectionRange(pe,pe)}catch{}if(B.value)try{g.scrollTop=g.scrollHeight}catch{}try{g.focus({preventScroll:!0})}catch{}});return}c.key==="Enter"?(c.preventDefault(),Y()):c.key==="Escape"&&(c.preventDefault(),oe())}}function J(){Y()}const q=t.ref(null),ue=t.ref("");function Ve(c){q.value===null&&(l.switchSheet(c),u())}function Oe(c){c!==l.activeSheetIndex.value&&(l.saveSheet(),l.loadSheet(c),u()),q.value=c,ue.value=l.sheets.value[c].name,t.nextTick(()=>{const g=document.querySelector(".tab-rename-input");g==null||g.focus(),g==null||g.select()})}function Je(){q.value!==null&&(l.renameSheet(q.value,ue.value),t.nextTick(()=>l.emitModelData())),q.value=null,ue.value=""}function Ge(){q.value=null,ue.value=""}function je(c){c.key==="Enter"?(c.preventDefault(),Je()):c.key==="Escape"&&(c.preventDefault(),Ge())}const se=t.ref(null);let de=null;function Se(){de&&(document.removeEventListener("click",de),de=null)}function re(c,g,$){Se();const z=140,h=$.length*28+8,L=window.innerWidth,pe=window.innerHeight;c+z>L&&(c-=z),g+h>pe&&(g-=h),se.value={x:c,y:g,items:$},de=()=>{se.value=null,Se()},setTimeout(()=>document.addEventListener("click",de,{once:!0}),0)}const a=t.ref(!1);function m(c,g){if(!g.children){a.value=!1;return}const z=c.currentTarget.querySelector(".context-submenu");if(!z){a.value=!1;return}const h=z.getBoundingClientRect();a.value=h.right>window.innerWidth}function fe(c,g){c.preventDefault(),c.stopPropagation(),re(c.clientX,c.clientY,[{label:A(e.locale.value,"insert"),action:()=>{l.addSheet(),u()}},{label:A(e.locale.value,"copy"),action:()=>{l.dupSheet(g)}},{label:A(e.locale.value,"rename"),action:()=>{Oe(g)}},{label:A(e.locale.value,"delete"),action:()=>{l.removeSheet(g),u()},disabled:l.sheetCount.value<=1},{label:A(e.locale.value,"moveSheetLeft"),action:()=>{l.moveSheet(g,-1)},disabled:g===0},{label:A(e.locale.value,"moveSheetRight"),action:()=>{l.moveSheet(g,1)},disabled:g===l.sheets.value.length-1}])}function Te(c){c.preventDefault(),!(c.target.closest(".tab-item")||c.target.closest(".tab-bar__add-btn"))&&re(c.clientX,c.clientY,[{label:A(e.locale.value,"insert"),action:()=>{l.addSheet(),u()}}])}function f(c){c.preventDefault(),e.selectAll(),u(),re(c.clientX,c.clientY,[{label:A(e.locale.value,"cut"),action:()=>{o.cutSelected(),l.emitModelData()}},{label:A(e.locale.value,"copy"),action:()=>o.copyToClipboard()},{label:A(e.locale.value,"paste"),action:()=>{n.saveUndo(),o.pasteFromClipboard().then(()=>{u(),t.nextTick(()=>l.emitModelData())})}},{label:A(e.locale.value,"delete"),action:()=>{n.saveUndo(),o.clearSelected();for(let g=0;g<e.colCount;g++)e.colWidths.value[g]=100;for(let g=0;g<e.rowCount;g++)e.rowHeights.value[g]=void 0;u(),l.emitModelData()}}])}function S(c,g){c.preventDefault();const $=c.clientX,z=c.clientY,h=e.selection.value;h&&h.startCol===0&&h.endCol===e.colCount-1&&g>=h.startRow&&g<=h.endRow||(e.selectRange(0,g,e.colCount-1,g,"row"),u());const L=e.selection.value;re(c.clientX,c.clientY,[{label:A(e.locale.value,"insert"),action:()=>{n.saveUndo(),l.insertRows(L.startRow,L.endRow),u(),l.emitModelData()},disabled:L.endRow>=e.rowCount-1},{label:A(e.locale.value,"cut"),action:()=>{n.saveUndo(),o.copyRowCol(),e.clearCellsInRange(0,e.colCount-1,L.startRow,L.endRow),u(),l.emitModelData()}},{label:A(e.locale.value,"copy"),action:()=>o.copyRowCol()},{label:A(e.locale.value,"paste"),action:()=>{n.saveUndo(),o.pasteFromClipboard().then(()=>{u(),t.nextTick(()=>l.emitModelData())})}},{label:A(e.locale.value,"delete"),action:()=>{n.saveUndo(),l.deleteRows(L.startRow,L.endRow),u(),l.emitModelData()}},{label:`${A(e.locale.value,"rowHeight")}...`,action:()=>W("row",$,z)},{label:A(e.locale.value,"autoRowHeight"),action:()=>l.resetRowHeight()}])}function y(c,g){c.preventDefault();const $=c.clientX,z=c.clientY,h=e.selection.value;h&&h.startRow===0&&h.endRow===e.rowCount-1&&g>=h.startCol&&g<=h.endCol||(e.selectRange(g,0,g,e.rowCount-1,"col"),u());const L=e.selection.value;re(c.clientX,c.clientY,[{label:A(e.locale.value,"insert"),action:()=>{n.saveUndo(),l.insertCols(L.startCol,L.endCol),u(),l.emitModelData()},disabled:L.endCol>=e.colCount-1},{label:A(e.locale.value,"cut"),action:()=>{n.saveUndo(),o.copyRowCol(),e.clearCellsInRange(L.startCol,L.endCol,0,e.rowCount-1),u(),l.emitModelData()}},{label:A(e.locale.value,"copy"),action:()=>o.copyRowCol()},{label:A(e.locale.value,"paste"),action:()=>{n.saveUndo(),o.pasteFromClipboard().then(()=>{u(),t.nextTick(()=>l.emitModelData())})}},{label:A(e.locale.value,"delete"),action:()=>{n.saveUndo(),l.deleteCols(L.startCol,L.endCol),u(),l.emitModelData()}},{label:`${A(e.locale.value,"colWidth")}...`,action:()=>W("col",$,z)},{label:A(e.locale.value,"defaultColWidth"),action:()=>l.resetColWidth()}])}function _(c,g,$){c.preventDefault(),e.isSelected(g,$)||(e.selectCell(g,$),u());const z=e.selection.value,h=!!(z&&z.startCol===z.endCol&&z.startRow===z.endRow);re(c.clientX,c.clientY,[{label:A(e.locale.value,"cut"),action:()=>{o.cutSelected(),l.emitModelData()}},{label:A(e.locale.value,"copy"),action:()=>o.copyToClipboard()},{label:A(e.locale.value,"paste"),action:()=>{n.saveUndo(),o.pasteFromClipboard().then(()=>{u(),t.nextTick(()=>l.emitModelData())})}},{label:A(e.locale.value,"delete"),action:()=>{n.saveUndo(),o.clearSelected(),u(),l.emitModelData()}},{label:A(e.locale.value,"calculate"),children:[{label:A(e.locale.value,"sum"),action:o.sumSelected,disabled:h},{label:A(e.locale.value,"avg"),action:o.avgSelected,disabled:h},{label:A(e.locale.value,"count"),action:o.countSelected,disabled:h}]}])}const E=t.ref(null),s=t.ref(null);let v=null;function R(){v&&(document.removeEventListener("mousedown",v),v=null)}function W(c,g,$){R();const z=e.selection.value;let h="";if(z){const He=c==="row"?e.getRowHeight(z.startRow):e.colWidths.value[z.startCol];h=He!=null&&He>0?String(Math.round(He)):""}const L=220,pe=118;let ve=g,he=$;ve+L>window.innerWidth&&(ve=window.innerWidth-L-8),he+pe>window.innerHeight&&(he=window.innerHeight-pe-8),ve<8&&(ve=8),he<8&&(he=8),s.value={type:c,x:ve,y:he,value:h,error:""},v=()=>{s.value=null},setTimeout(()=>document.addEventListener("mousedown",v,{once:!0}),0),t.nextTick(()=>{const He=E.value;He&&(He.focus(),He.select())})}function U(c){const g=s.value;if(!g)return;const $=c.target,z=$.value,h=z.replace(/[^\d]/g,"");g.value=h,z!==h&&($.value=h),g.error=""}function De(c){c.key==="Enter"?(c.preventDefault(),ze()):c.key==="Escape"&&(c.preventDefault(),Be())}function Fe(){const c=s.value;if(!c)return;const g=c.value.trim(),$=Number(g),z=c.type==="row",h=z?24:30,L=z?500:1e3;if(g===""||!Number.isFinite($)){Be();return}const pe=Math.max(h,Math.min(L,Math.round($)));c.value=String(pe),c.error=""}function ze(){const c=s.value,g=e.selection.value;if(!c||!g)return;const $=c.value.trim(),z=Number($),h=c.type==="row",L=h?24:30,pe=h?500:1e3;if($===""||!Number.isFinite(z)){c.error=A(e.locale.value,"dimNumberError");return}if(z<L||z>pe){c.error=A(e.locale.value,"dimRangeError").replace("{min}",String(L)).replace("{max}",String(pe));return}const ve=z;if(n.saveUndo(),h)for(let he=g.startRow;he<=g.endRow;he++)e.rowHeights.value[he]=ve;else for(let he=g.startCol;he<=g.endCol;he++)e.colWidths.value[he]=ve;u(),l.emitModelData(),Be()}function Be(){R(),s.value=null}const T=t.computed(()=>{var el;const c=!e.editingCell.value,g=e.editingCell.value??e.activeCell.value,$=g.col,z=g.row,h=(el=e.cells[e.cellKey($,z)])==null?void 0:el.style,L=e.cellFontSize($,z),pe=typeof(h==null?void 0:h.fontFamily)=="string"&&h.fontFamily?h.fontFamily:Pt,ve=(h==null?void 0:h.fontWeight)==="bold"?"bold":"normal",he=(h==null?void 0:h.fontStyle)==="italic"?"italic":"normal",He=(h==null?void 0:h.underline)==="underline"?"underline":(h==null?void 0:h.strikethrough)==="line-through"?"line-through":"none",ct=(h==null?void 0:h.underline)==="underline"&&(h==null?void 0:h.strikethrough)==="line-through"?"underline line-through":He,ot=typeof(h==null?void 0:h.color)=="string"?h.color:void 0,ht=typeof(h==null?void 0:h.backgroundColor)=="string"?h.backgroundColor:void 0,pt=typeof(h==null?void 0:h.numberFormat)=="string"?h.numberFormat:"",Bt=e.editValue.value??e.getCellValue($,z),Ut=typeof(h==null?void 0:h.textAlign)=="string"?h.textAlign:_l(Bt,pt)?"right":"left",xt=typeof(h==null?void 0:h.verticalAlign)=="string"?h.verticalAlign:"top",wt=e.findMerge($,z),cl=wt?e.colPositions.value[wt.range.endCol+1]-e.colPositions.value[$]:e.colWidths.value[$],bt=wt?e.rowPositions.value[wt.range.endRow+1]-e.rowPositions.value[z]:e.getRowHeight(z),Lt=2,{ascent:It,descent:ft}=e.measureFontMetrics(pe,L,ve,he),Jt=It+ft,$t=(e.editValue.value?e.editValue.value.split(`
|
|
8
|
+
`).length:1)*Jt,Qt=e.BASE_CELL_VPAD-Lt;let Mt=0,Nt=0;return xt==="middle"?(Mt=Math.floor((bt-$t)/2),Nt=Math.max(0,bt-$t-Mt)):xt==="top"?(Mt=Qt,Nt=Math.max(0,bt-$t-Mt)):xt==="bottom"&&(Nt=Qt,Mt=Math.max(0,bt-$t-Nt)),{left:`${52+e.colPositions.value[$]-e.scrollX.value}px`,top:`${24+e.rowPositions.value[z]-e.scrollY.value}px`,width:`${cl}px`,height:`${bt}px`,fontFamily:pe,fontSize:`${L}px`,lineHeight:1,fontWeight:ve,fontStyle:he,textDecoration:ct,textAlign:Ut,paddingTop:`${Mt}px`,paddingRight:"3px",paddingBottom:`${Nt}px`,paddingLeft:"3px",opacity:c?0:1,pointerEvents:c?"none":"auto",color:c?"transparent":ot,caretColor:c?"transparent":void 0,borderColor:c?"transparent":void 0,background:c?"transparent":ht,boxShadow:c?"none":void 0}});function N(){return Math.max(0,l.viewSize.w-52-11)}function P(){return Math.max(0,l.viewSize.h-24-11)}const ce=t.computed(()=>N()),ee=t.computed(()=>P()),ae=t.computed(()=>Math.max(0,ce.value-11*2)),X=t.computed(()=>Math.max(0,ee.value-11*2)),G=t.computed(()=>l.maxScrollX.value<=0?ae.value:Math.max(24,N()/e.totalWidth.value*ae.value)),ye=t.computed(()=>l.maxScrollX.value<=0?0:e.scrollX.value/l.maxScrollX.value*(ae.value-G.value)),Ee=t.computed(()=>l.maxScrollY.value<=0?X.value:Math.max(24,P()/e.totalHeight.value*X.value)),Ze=t.computed(()=>l.maxScrollY.value<=0?0:e.scrollY.value/l.maxScrollY.value*(X.value-Ee.value));let Pe=null,H=0,O=0;function I(c){c.preventDefault(),Pe="v",H=c.clientY,O=e.scrollY.value,document.addEventListener("mousemove",ie),document.addEventListener("mouseup",ke)}function Q(c){c.preventDefault(),Pe="h",H=c.clientX,O=e.scrollX.value,document.addEventListener("mousemove",ie),document.addEventListener("mouseup",ke)}function ie(c){if(Pe==="v"){const $=(c.clientY-H)/(X.value-Ee.value);l.clampScroll(null,O+$*l.maxScrollY.value),u()}else if(Pe==="h"){const $=(c.clientX-H)/(ae.value-G.value);l.clampScroll(O+$*l.maxScrollX.value,null),u()}}function ke(){Pe=null,document.removeEventListener("mousemove",ie),document.removeEventListener("mouseup",ke)}function Ne(c){if(Pe)return;const g=c.currentTarget.getBoundingClientRect(),$=c.clientY-g.top;$<Ze.value?l.clampScroll(null,e.scrollY.value-P()):$>Ze.value+Ee.value&&l.clampScroll(null,e.scrollY.value+P()),u()}function We(c){if(Pe)return;const g=c.currentTarget.getBoundingClientRect(),$=c.clientX-g.left;$<ye.value?l.clampScroll(e.scrollX.value-N(),null):$>ye.value+G.value&&l.clampScroll(e.scrollX.value+N(),null),u()}let Le=!1,_e=0,Me=0,C=!1,F=!1,K=0,Ce=0,ge=0,me=0,be=0,we=0,Ae=0,lt=0,it=!1,dt=!1,Qe=0,rt=0,Rt="cell",Bl=0,Jl=-1,Ql=-1;function li(c){if(c.button!==0)return;c.preventDefault(),se.value=null;const g=Ft(c,l.canvasRef.value);if(g.y<24&&g.x>=52){const h=g.x-52+e.scrollX.value,L=e.hitCol(h);if(L>=0&&Math.abs(g.x-(52+e.colPositions.value[L+1]-e.scrollX.value))<=4){n.saveUndo(),C=!0,K=L,ge=e.colWidths.value[L],me=h,u();return}}if(g.x<52&&g.y>=24){const h=g.y-24+e.scrollY.value,L=e.hitRow(h);if(L>=0&&Math.abs(g.y-(24+e.rowPositions.value[L+1]-e.scrollY.value))<=4){n.saveUndo(),F=!0,Ce=L,ge=e.getRowHeight(L),me=h,u();return}}if(g.x<52||g.y<24){{const h=l.formulaBarRef.value,L=!!(h&&typeof document<"u"&&document.activeElement===h);(e.editingCell.value||L||V)&&Y()}if(g.y<24&&g.x>=52){const h=e.hitCol(g.x-52+e.scrollX.value);h>=0&&(e.selectRange(h,0,h,e.rowCount-1,"col"),Le=!0,_e=h,Me=0)}else if(g.x<52&&g.y>=24){const h=e.hitRow(g.y-24+e.scrollY.value);h>=0&&(e.selectRange(0,h,e.colCount-1,h,"row"),Le=!0,_e=0,Me=h)}else g.x<52&&g.y<24&&e.selectAll();u();return}const $=e.hitCol(g.x-52+e.scrollX.value),z=e.hitRow(g.y-24+e.scrollY.value);if(!($<0||z<0)){{const h=l.formulaBarRef.value,L=!!(h&&typeof document<"u"&&document.activeElement===h);(e.editingCell.value||L||V)&&Y()}if(c.shiftKey&&e.selection.value){const h=e.selection.value;e.selectRange(h.startCol,h.startRow,$,z)}else e.selectCell($,z);Le=!0,_e=$,Me=z,l.focusEditInput(),u()}}function oi(c){if(C){const L=Ft(c,l.canvasRef.value).x-52+e.scrollX.value-me,pe=ge+L;pe>=30&&pe<=1e3?e.colWidths.value[K]=pe:pe<30?e.colWidths.value[K]=30:e.colWidths.value[K]=1e3,u();return}if(F){const L=Ft(c,l.canvasRef.value).y-24+e.scrollY.value-me,pe=ge+L;pe>=24&&pe<=500?e.rowHeights.value[Ce]=pe:pe<24?e.rowHeights.value[Ce]=24:e.rowHeights.value[Ce]=500,u();return}if(!Le){const h=l.canvasRef.value;if(!h)return;if(n.paintFmt.value){h.style.cursor="copy";return}const L=Ft(c,h);if(L.y<24&&L.x>=52){const pe=e.hitCol(L.x-52+e.scrollX.value);if(pe>=0&&Math.abs(L.x-(52+e.colPositions.value[pe+1]-e.scrollX.value))<=4){h.style.cursor="col-resize";return}}if(L.x<52&&L.y>=24){const pe=e.hitRow(L.y-24+e.scrollY.value);if(pe>=0&&Math.abs(L.y-(24+e.rowPositions.value[pe+1]-e.scrollY.value))<=4){h.style.cursor="row-resize";return}}h.style.cursor="cell";return}const g=Ft(c,l.canvasRef.value);if(_e<0||Me<0)return;if(g.x<52||g.y<24){if(g.y<24&&g.x>=52){const h=e.hitCol(g.x-52+e.scrollX.value);h>=0&&e.selectRange(Math.min(_e,h),0,Math.max(_e,h),e.rowCount-1,"col")}else if(g.x<52&&g.y>=24){const h=e.hitRow(g.y-24+e.scrollY.value);h>=0&&e.selectRange(0,Math.min(Me,h),e.colCount-1,Math.max(Me,h),"row")}u();return}const $=e.hitCol(g.x-52+e.scrollX.value),z=e.hitRow(g.y-24+e.scrollY.value);$<0||z<0||(Me===0&&_e>=0&&e.selection.value&&e.selection.value.startRow===0&&e.selection.value.endRow===e.rowCount-1?e.selectRange(Math.min(_e,$),0,Math.max(_e,$),e.rowCount-1,"col"):_e===0&&Me>=0&&e.selection.value&&e.selection.value.startCol===0&&e.selection.value.endCol===e.colCount-1?e.selectRange(0,Math.min(Me,z),e.colCount-1,Math.max(Me,z),"row"):e.selectRange(_e,Me,$,z),u())}function ni(c){const g=C||F;Le=!1,C=!1,F=!1,g&&l.scheduleOptEmit(),n.paintFmt.value&&n.applyPaintFormat()}function ri(){const c=C||F;Le=!1,C=!1,F=!1,c&&l.scheduleOptEmit()}function ai(c){c.preventDefault();const g=Ft(c,l.canvasRef.value);if(g.x<52&&g.y<24){f(c);return}if(g.y<24&&g.x>=52){const $=e.hitCol(g.x-52+e.scrollX.value);$>=0&&y(c,$);return}if(g.x<52&&g.y>=24){const $=e.hitRow(g.y-24+e.scrollY.value);$>=0&&S(c,$);return}if(g.x>=52&&g.y>=24){const $=e.hitCol(g.x-52+e.scrollX.value),z=e.hitRow(g.y-24+e.scrollY.value);$>=0&&z>=0&&_(c,$,z)}}function ii(c){const g=Ft(c,l.canvasRef.value);if(g.x<52||g.y<24)return;const $=e.hitCol(g.x-52+e.scrollX.value),z=e.hitRow(g.y-24+e.scrollY.value);if(!($<0||z<0)){{const h=l.formulaBarRef.value,L=!!(h&&typeof document<"u"&&document.activeElement===h);(e.editingCell.value||L||V)&&Y()}e.selectCell($,z),e.ensureVisible($,z),e.startEdit(),u(),l.focusEditInput()}}function ci(c){l.clampScroll(e.scrollX.value+c.deltaX,e.scrollY.value+c.deltaY),u()}function si(c){if(c.touches.length!==1){it=!1;return}const g=c.touches[0],$=l.canvasRef.value;if(!$)return;const z=$.getBoundingClientRect(),h=g.clientX-z.left,L=g.clientY-z.top;h>=52&&L>=24?(c.preventDefault(),it=!0,dt=!1,Rt="cell",be=h,we=L,Ae=e.scrollX.value,lt=e.scrollY.value,Qe=e.hitCol(h-52+e.scrollX.value),rt=e.hitRow(L-24+e.scrollY.value)):h>=0&&L>=0&&(h<52||L<24)&&(c.preventDefault(),it=!0,dt=!1,be=h,we=L,Ae=e.scrollX.value,lt=e.scrollY.value,L<24&&h>=52?(Rt="col",Qe=e.hitCol(h-52+e.scrollX.value),rt=-1):h<52&&L>=24?(Rt="row",rt=e.hitRow(L-24+e.scrollY.value),Qe=-1):(Rt="all",Qe=-1,rt=-1))}function di(c){if(!it||c.touches.length!==1)return;const g=c.touches[0],$=l.canvasRef.value;if(!$)return;const z=$.getBoundingClientRect(),h=g.clientX-z.left,L=g.clientY-z.top;(Math.abs(h-be)>8||Math.abs(L-we)>8)&&(dt=!0,c.preventDefault(),l.clampScroll(Ae+(be-h),lt+(we-L)),u())}function ui(){if(it&&(it=!1,!dt))if(Rt==="cell"&&Qe>=0&&rt>=0){const c=Date.now();Qe===Jl&&rt===Ql&&c-Bl<300?(e.selectCell(Qe,rt),e.startEdit(),u(),l.focusEditInput(),Bl=0):(e.commitEdit(),e.selectCell(Qe,rt),u(),Bl=c),Jl=Qe,Ql=rt,l.focusEditInput()}else Rt==="col"&&Qe>=0?(e.commitEdit(),e.selectRange(Qe,0,Qe,e.rowCount-1,"col"),u()):Rt==="row"&&rt>=0?(e.commitEdit(),e.selectRange(0,rt,e.colCount-1,rt,"row"),u()):Rt==="all"&&(e.commitEdit(),e.selectAll(),u())}function xl(c){return c.isComposing||c.key==="Process"||c.keyCode===229}function eo(c){return c.key.length===1&&!c.ctrlKey&&!c.metaKey&&!c.altKey}function to(c){if(e.editingCell.value)return;const g=c.ctrlKey||c.metaKey,$=c.shiftKey;switch(!0){case(g&&(c.key==="c"||c.key==="C")):c.preventDefault(),o.copyToClipboard();return;case(g&&(c.key==="x"||c.key==="X")):c.preventDefault(),o.cutSelected();return;case(g&&(c.key==="z"||c.key==="Z")):c.preventDefault(),n.undo();return;case(g&&(c.key==="y"||c.key==="Y")):c.preventDefault(),n.redo();return;case(g&&(c.key==="v"||c.key==="V")):c.preventDefault(),n.saveUndo(),o.pasteFromClipboard().then(()=>{u(),t.nextTick(()=>l.emitModelData())});return;case(g&&(c.key==="a"||c.key==="A")):c.preventDefault(),e.selectAll(),u();return;case(g&&c.key==="Home"):c.preventDefault(),e.selectCell(0,0),e.ensureVisible(0,0),u();return;case(g&&c.key==="End"):c.preventDefault(),e.selectCell(e.colCount-1,e.rowCount-1),e.ensureVisible(e.colCount-1,e.rowCount-1),u();return;case c.key==="Home":c.preventDefault(),e.selectCell(0,e.activeCell.value.row),e.ensureVisible(0,e.activeCell.value.row),u();return;case c.key==="End":c.preventDefault(),e.selectCell(e.colCount-1,e.activeCell.value.row),e.ensureVisible(e.colCount-1,e.activeCell.value.row),u();return;case c.key==="ArrowUp":c.preventDefault(),e.moveActive(0,-1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),u();return;case c.key==="ArrowDown":c.preventDefault(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),u();return;case c.key==="ArrowLeft":c.preventDefault(),e.moveActive(-1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),u();return;case c.key==="ArrowRight":c.preventDefault(),e.moveActive(1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),u();return;case c.key==="Tab":c.preventDefault(),e.moveActive($?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),u();return;case c.key==="Enter":c.preventDefault(),e.moveActive(0,$?-1:1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),u();return;case c.key==="F2":c.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(),u(),l.focusEditInput();return;case c.key==="Delete":case c.key==="Backspace":c.preventDefault(),n.saveUndo(),o.clearSelected(),u();return;case c.key==="Escape":c.preventDefault(),e.cancelEdit(),n.paintFmt.value=null,u();return;case eo(c):if(xl(c)){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),u(),l.focusEditInput();return}c.preventDefault(),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(c.key),u(),t.nextTick(()=>{const z=l.editInputRef.value;z&&(z.focus(),z.setSelectionRange(1,1))});return}}let Ml=!1,Sl=!1;function fi(c){const g=c.target.value;if(!e.editingCell.value){e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(g),w.value=g,u();return}e.editValue.value=g,w.value=g}function mi(){Ml=!0,e.editingCell.value||(e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),e.startEdit(""),w.value="",u())}function pi(c){Ml=!1,Sl=!0,setTimeout(()=>{Sl=!1},0);const g=c.target.value;e.editValue.value=g,w.value=g}function gi(c){if(!e.editingCell.value){if(eo(c)||xl(c))return;to(c);return}if(!(Ml||xl(c))&&!(Sl&&(c.key==="Enter"||c.key==="Escape")))if(c.key==="Enter"&&(c.altKey||c.metaKey)){c.preventDefault();const g=l.editInputRef.value;if(!g)return;const $=g.selectionStart??g.value.length,z=g.selectionEnd??g.value.length,h=g.value,L=h.slice(0,$)+`
|
|
9
|
+
`+h.slice(z);e.editValue.value=L,g.value=L,g.selectionStart=g.selectionEnd=$+1,u()}else c.key==="Enter"?(c.preventDefault(),e.commitEdit(),e.moveActive(0,1),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),u(),l.focusEditInput()):c.key==="Tab"?(c.preventDefault(),e.commitEdit(),e.moveActive(c.shiftKey?-1:1,0),e.ensureVisible(e.activeCell.value.col,e.activeCell.value.row),u(),l.focusEditInput()):c.key==="Escape"&&(c.preventDefault(),e.cancelEdit(),u(),l.focusEditInput())}function hi(c){e.editingCell.value}function Ci(){setTimeout(()=>{e.editingCell.value&&(e.commitEdit(),u())},0)}let gt=null;function qt(){var g;const c=(g=l.wrapperRef.value)==null?void 0:g.getBoundingClientRect();if(c){const $=Vt(e.props.width),z=Vt(e.props.height);$!=null?l.viewSize.w=$:l.viewSize.w=c.width,z!=null?l.viewSize.h=z:l.viewSize.h=c.height}l.clampScroll(null,null),u()}function bi(){t.onMounted(()=>{const c=Vt(e.props.width),g=Vt(e.props.height);(c==null||g==null)&&(gt=new ResizeObserver(()=>qt()),l.wrapperRef.value&>.observe(l.wrapperRef.value)),t.nextTick(()=>{qt(),l.focusEditInput()}),e.selectCell(0,0),l.modelData.value&&l.modelData.value.length>0&&(i.value=JSON.stringify(l.modelData.value),l.sheets.value=l.modelData.value.map($=>{const z=l.mkSheet($.name);for(const[h,L]of Object.entries($.cells))z.cells[h]={value:L.value,style:L.style??null};if($.colWidths)for(const[h,L]of Object.entries($.colWidths)){const pe=Number(h);pe>=0&&pe<e.colCount&&L>=30&&(z.colWidths[pe]=L)}if($.rowHeights)for(const[h,L]of Object.entries($.rowHeights)){const pe=Number(h);pe>=0&&pe<e.rowCount&&L>=24&&(z.rowHeights[pe]=L)}if($.merges)for(const[h,L]of Object.entries($.merges))z.merges[h]={...L};return z}),l.sheets.value.length>0&&l.loadSheet(0))}),t.watch(()=>[e.props.width,e.props.height],()=>{const c=Vt(e.props.width),g=Vt(e.props.height);c!=null&&g!=null?(gt==null||gt.disconnect(),gt=null):!gt&&l.wrapperRef.value&&(gt=new ResizeObserver(()=>qt()),gt.observe(l.wrapperRef.value)),t.nextTick(()=>qt())}),t.watch(()=>e.props.theme,()=>u()),t.watch(()=>({...e.cells}),()=>t.nextTick(()=>l.emitModelData()),{deep:!1}),t.watch(()=>({...e.merges}),()=>{t.nextTick(()=>l.emitModelData()),u()},{deep:!1}),t.watch(l.activeSheetIndex,()=>t.nextTick(()=>l.emitModelData())),t.watch(()=>l.modelData.value,c=>{if(!c||c.length===0)return;const g=JSON.stringify(c);if(g===i.value)return;i.value=g;const $=e.selection.value?{...e.selection.value}:null,z={...e.activeCell.value};l.sheets.value=c.map(h=>{const L=l.mkSheet(h.name);for(const[pe,ve]of Object.entries(h.cells))L.cells[pe]={value:ve.value,style:ve.style??null};if(h.colWidths)for(const[pe,ve]of Object.entries(h.colWidths)){const he=Number(pe);he>=0&&he<e.colCount&&ve>=30&&(L.colWidths[he]=ve)}if(h.rowHeights)for(const[pe,ve]of Object.entries(h.rowHeights)){const he=Number(pe);he>=0&&he<e.rowCount&&ve>=24&&(L.rowHeights[he]=ve)}if(h.merges)for(const[pe,ve]of Object.entries(h.merges))L.merges[pe]={...ve};return L}),l.sheets.value.length>0&&l.loadSheet(0),$&&(e.selection.value=$),e.activeCell.value=z,u()},{deep:!0}),t.onBeforeUnmount(()=>{gt==null||gt.disconnect()})}return{scheduleRender:u,render:M,activeCellLabel:D,formulaBarDisplay:x,formulaBarDraft:w,formulaBarExpanded:B,onFormulaBarFocus:le,onFormulaBarInput:ne,onFormulaBarKeydown:Z,onFormulaBarBlur:J,acceptFormulaBarEdit:Y,cancelFormulaBarEdit:oe,renTab:q,renTabVal:ue,onTabClick:Ve,onTabDblClick:Oe,commitTabRename:Je,cclTabRename:Ge,onTabRenameKd:je,ctxMenu:se,ctxSubmenuLeft:a,onCtxItemEnter:m,onTabCtxMenu:fe,onTabBarCtx:Te,onCornerCtx:f,onRowHdrCtx:S,onColHdrCtx:y,onCellCtx:_,dimInputRef:E,dimPanel:s,openDimPanel:W,onDimInput:U,onDimKeydown:De,onDimBlur:Fe,applyDimPanel:ze,closeDimPanel:Be,editInputStyle:T,hScrollbarW:ce,vScrollbarH:ee,hTrackW:ae,vTrackH:X,hThumbW:G,hThumbL:ye,vThumbH:Ee,vThumbT:Ze,onVStart:I,onHStart:Q,onSbMove:ie,onSbUp:ke,onVTrk:Ne,onHTrk:We,onMouseDown:li,onMouseMove:oi,onMouseUp:ni,onMouseLeave:ri,onCanvasCtx:ai,onDblClick:ii,onWheel:ci,onTouchStart:si,onTouchMove:di,onTouchEnd:ui,onKeydown:to,onEditInput:fi,onEditCompositionStart:mi,onEditCompositionEnd:pi,onEditKd:gi,onEditPaste:hi,onEditBlur:Ci,applySize:qt,setupLifecycle:bi}}function Fa(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Zl(e,n,o,l){return n?l?o?e===n:e.toLowerCase()===n.toLowerCase():o?e.includes(n):e.toLowerCase().includes(n.toLowerCase()):!1}function Oa(e,n,o,l){if(!n)return e;if(l){const d=e.indexOf(n);return d<0?e:e.slice(0,d)+o+e.slice(d+n.length)}const i=e.toLowerCase().indexOf(n.toLowerCase());return i<0?e:e.slice(0,i)+o+e.slice(i+n.length)}function La(e,n,o,l){return n?l?e.indexOf(n)<0?e:e.split(n).join(o):e.toLowerCase().indexOf(n.toLowerCase())<0?e:e.replace(new RegExp(Fa(n),"gi"),()=>o):e}function Rl(e,n,o,l,i,d,r){const b=[];if(r){for(let u=r.startRow;u<=r.endRow;u++)for(let k=r.startCol;k<=r.endCol;k++){const M=e[o(k,u)];M&&Zl(M.value,l,i,d)&&b.push({sheetIndex:n,col:k,row:u})}return b}for(const u in e){const k=e[u];if(k&&Zl(k.value,l,i,d)){const M=u.split(","),D=Number(M[0]),w=Number(M[1]);!Number.isNaN(D)&&!Number.isNaN(w)&&b.push({sheetIndex:n,col:D,row:w})}}return b}function Ia(e,n,o,l){const i=t.ref(!1),d=t.ref(""),r=t.ref(""),b=t.ref("sheet"),u=t.ref(!1),k=t.ref(!1),M=t.ref(-1),D=t.ref([]),w=t.ref(""),B=t.ref(0),x=t.ref(""),le=t.computed(()=>{const a=new Set,m=o.activeSheetIndex.value;for(const fe of D.value)fe.sheetIndex===m&&a.add(`${fe.col},${fe.row}`);return a}),ne=t.computed(()=>{if(M.value<0||M.value>=D.value.length)return null;const a=D.value[M.value];return a.sheetIndex!==o.activeSheetIndex.value?null:`${a.col},${a.row}`});e.findHighlight=(a,m)=>{const fe=`${a},${m}`;return ne.value===fe?"active":le.value.has(fe)?"match":null};function p(a){var Te,f;const m=e.cellKey(a.col,a.row);if(a.sheetIndex===o.activeSheetIndex.value)return((Te=e.cells[m])==null?void 0:Te.value)??"";const fe=o.sheets.value[a.sheetIndex];return((f=fe==null?void 0:fe.cells[m])==null?void 0:f.value)??""}function V(a,m){const fe=e.cellKey(a.col,a.row);if(a.sheetIndex===o.activeSheetIndex.value)e.setCellValue(a.col,a.row,m);else{const Te=o.sheets.value[a.sheetIndex];if(!Te)return;const f=Te.cells[fe];Te.cells[fe]={value:String(m),style:(f==null?void 0:f.style)??null}}}function Y(){if(x.value){w.value=x.value;return}if(!d.value){w.value="";return}if(b.value==="selection"&&!e.selection.value){w.value=A(e.locale.value,"findNeedSelection");return}if(D.value.length===0){w.value=A(e.locale.value,"findNoResult");return}w.value=""}function oe(){const a=d.value,m=[];if(a)if(b.value==="workbook")o.sheets.value.forEach((fe,Te)=>{m.push(...Rl(fe.cells,Te,e.cellKey,a,u.value,k.value))});else if(b.value==="selection"){const fe=e.selection.value;fe&&m.push(...Rl(e.cells,o.activeSheetIndex.value,e.cellKey,a,u.value,k.value,fe))}else m.push(...Rl(e.cells,o.activeSheetIndex.value,e.cellKey,a,u.value,k.value));D.value=m,m.length===0?M.value=-1:M.value>=m.length?M.value=m.length-1:M.value<0&&(M.value=0),Y()}function Z(){if(M.value<0||M.value>=D.value.length)return;const a=D.value[M.value];a.sheetIndex!==o.activeSheetIndex.value&&o.switchSheet(a.sheetIndex),b.value==="selection"?e.activeCell.value={col:a.col,row:a.row}:e.selectCell(a.col,a.row),e.ensureVisible(a.col,a.row)}const J=typeof requestAnimationFrame=="function"?requestAnimationFrame:a=>setTimeout(a,16);let q=!1,ue=!1;function Ve(a){if(q){ue=ue||a;return}q=!0,ue=a,J(()=>{var m;q=!1,oe(),ue&&D.value.length>0&&M.value>=0&&Z(),ue=!1,(m=e.scheduleRender)==null||m.call(e)})}function Oe(){var a;i.value=!0,B.value++,oe(),D.value.length>0&&(M.value=0,Z()),(a=e.scheduleRender)==null||a.call(e)}function Je(){Oe()}function Ge(){var a;i.value=!1,D.value=[],M.value=-1,x.value="",w.value="",(a=e.scheduleRender)==null||a.call(e)}function je(){var a;D.value.length!==0&&(M.value=(M.value+1)%D.value.length,Z(),(a=e.scheduleRender)==null||a.call(e))}function se(){var a;D.value.length!==0&&(M.value=(M.value-1+D.value.length)%D.value.length,Z(),(a=e.scheduleRender)==null||a.call(e))}function de(){var f,S;if(M.value<0||M.value>=D.value.length)return;const a=D.value[M.value],m=p(a),fe=Oa(m,d.value,r.value,u.value);if(fe===m)return;n.saveUndo(),V(a,fe);const Te=M.value;oe(),D.value.length>0?(M.value=Math.min(Te,D.value.length-1),je()):M.value=-1,(f=e.emitModelData)==null||f.call(e),(S=e.scheduleRender)==null||S.call(e)}function Se(){var Te,f;const a=d.value;if(!a||D.value.length===0)return;n.saveUndo();let m=0;const fe=D.value.slice();for(const S of fe){const y=p(S),_=La(y,a,r.value,u.value);_!==y&&(V(S,_),m++)}D.value=[],M.value=-1,x.value=A(e.locale.value,"findReplacedAll").replace("{n}",String(m)),Y(),(Te=e.emitModelData)==null||Te.call(e),(f=e.scheduleRender)==null||f.call(e)}function re(){const a=m=>{if(!(m.ctrlKey||m.metaKey))return;const Te=m.key.toLowerCase();(Te==="f"||Te==="h")&&(m.preventDefault(),Oe())};window.addEventListener("keydown",a),t.onBeforeUnmount(()=>window.removeEventListener("keydown",a))}return t.watch(d,()=>{i.value&&(x.value="",M.value=0,Ve(!0))}),t.watch([b,u,k],()=>{i.value&&(x.value="",M.value=0,Ve(!0))}),t.watch(e.cells,()=>{i.value&&Ve(!1)},{deep:!0}),t.watch(()=>e.selection.value,()=>{i.value&&b.value==="selection"&&(M.value=0,Ve(!0))}),t.watch([()=>n.undoStack.value.length,()=>n.redoStack.value.length],()=>{i.value&&Ve(!1)}),{open:i,findText:d,replaceText:r,scope:b,matchCase:u,matchEntireCell:k,currentIndex:M,results:D,message:w,focusToken:B,activeSheetMatches:le,activeMatchKey:ne,openFind:Oe,openReplace:Je,close:Ge,recompute:oe,findNext:je,findPrev:se,replace:de,replaceAll:Se,setupLifecycle:re}}const $a={class:"formula-bar__cell-label"},za={class:"formula-bar__buttons"},Wa=["rows","value"],_a=["title"],Ka={key:0,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},Ua={key:1,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true"},Ga=["value"],Pa={key:2,class:"sb-corner"},Ya=["onClick","onMouseenter"],Xa={class:"context-menu__label"},ja={key:0,class:"context-menu__arrow"},Za=["onClick"],qa={class:"dim-panel__title"},Ja={class:"dim-panel__body"},Qa=["value"],ei={key:0,class:"dim-panel__error"},ti={class:"dim-panel__footer"},ql=vt(t.defineComponent({__name:"spreader",props:t.mergeModels({rowCount:{default:200},colCount:{default:26},width:{},height:{},theme:{default:"light"},locale:{default:"zh-CN"}},{data:{default:()=>[]},dataModifiers:{}}),emits:["update:data"],setup(e){const n=e,o=t.useModel(e,"data"),l={value:""},i=Sa(n,{rowCount:n.rowCount,colCount:n.colCount,theme:n.theme,locale:n.locale}),d={sheets:t.ref([]),activeSheetIndex:t.ref(0),saveSheet:()=>{},loadSheet:re=>{},mkSheet:re=>({id:"",name:re,cells:{},merges:{},selection:null,activeCell:{col:0,row:0},scrollX:0,scrollY:0,colWidths:[],rowHeights:[]})},r=Ta(i,d),b=Na(i,r);Da(r,{borderMenuOpen:b.borderMenuOpen,mergeMenuOpen:b.mergeMenuOpen});const u=Ha(i,r,o,void 0,l);d.sheets=u.sheets,d.activeSheetIndex=u.activeSheetIndex,d.saveSheet=u.saveSheet,d.loadSheet=u.loadSheet,d.mkSheet=u.mkSheet;const k=Va(i,r,b,u,l);k.setupLifecycle();const M=Ia(i,r,u);M.setupLifecycle();const D=t.reactive(i),w=t.reactive(r),B=t.reactive(b),x=t.reactive(u),le=u.sheets,ne=u.activeSheetIndex,p=t.reactive(k),V=t.reactive(M),Y=t.computed(()=>{const re=D.selection;return!!re&&re.startCol===re.endCol&&re.startRow===re.endRow}),oe=t.computed(()=>{var fe;const re=w.selNumberFormat;if(re!==nl)return re;const a=D.activeCell,m=(fe=D.cells[D.cellKey(a.col,a.row)])==null?void 0:fe.style;return typeof(m==null?void 0:m.numberFormat)=="string"?m.numberFormat:""});function Z(re){r.nfDialogOpen.value=re}function J(re){r.fontSizeMenuOpen.value=re}function q(re){r.textColorMenuOpen.value=re}function ue(re){r.fillColorMenuOpen.value=re}function Ve(re){k.renTabVal.value=re}function Oe(){k.ctxMenu.value=null}const Je=re=>{u.formulaBarRef.value=re};function Ge(){k.formulaBarExpanded.value=!k.formulaBarExpanded.value}const je=re=>{u.wrapperRef.value=re},se=re=>{u.canvasRef.value=re},de=re=>{u.editInputRef.value=re},Se=re=>{k.dimInputRef.value=re};return(re,a)=>(t.openBlock(),t.createElementBlock("div",{class:"spreadsheet-outer",style:t.normalizeStyle(x.outerStyle)},[t.createVNode(hr,{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":B.borderMenuOpen,"cached-border":B.cachedBorder,"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":B.mergeMenuOpen,"calc-menu-open":B.calcMenuOpen,"is-single-cell":Y.value,"sel-number-format":w.selNumberFormat,"nf-options":w.nfOptions,"theme-vars":x.toolbarThemeVars,onUndo:a[0]||(a[0]=m=>w.undo()),onRedo:a[1]||(a[1]=m=>w.redo()),onPaintFormat:w.onPaintFormat,onClearFormat:a[2]||(a[2]=m=>w.clearFormat()),onNumberFormatChange:a[3]||(a[3]=m=>w.onNumberFormatChange(m)),onFontFamilyChange:a[4]||(a[4]=m=>w.onFontFamilyChange(m)),onFontSizeInput:a[5]||(a[5]=m=>w.onFontSizeInput(m)),onFontSizeBlur:w.onFontSizeBlur,onFontSizeKeydown:a[6]||(a[6]=m=>w.onFontSizeKeydown(m)),onFontSizeChange:a[7]||(a[7]=m=>w.onFontSizeChange(m)),"onUpdate:fontSizeMenuOpen":a[8]||(a[8]=m=>J(m)),onFontSizeToggle:a[9]||(a[9]=m=>w.toggleFontSizeMenu()),onFontSizeStepUp:w.onFontSizeStepUp,onFontSizeStepDown:w.onFontSizeStepDown,onBoldToggle:w.toggleFontWeight,onItalicToggle:w.toggleFontStyle,onUnderlineToggle:w.toggleUnderline,onStrikethroughToggle:w.toggleStrikethrough,onTextColorChange:a[10]||(a[10]=m=>w.onTextColorChange(m)),"onUpdate:textColorMenuOpen":a[11]||(a[11]=m=>q(m)),onFillColorChange:a[12]||(a[12]=m=>w.onFillColorChange(m)),"onUpdate:fillColorMenuOpen":a[13]||(a[13]=m=>ue(m)),onApplyTextColor:w.applyCachedTextColor,onApplyFillColor:w.applyCachedFillColor,"onUpdate:borderMenuOpen":a[14]||(a[14]=m=>w.onBorderMenuToggle(m)),onBorderChange:a[15]||(a[15]=m=>B.onBorderChange(m)),onApplyBorder:B.applyCachedBorder,onHAlignChange:a[16]||(a[16]=m=>w.onHAlignChange(m)),onVAlignChange:a[17]||(a[17]=m=>w.onVAlignChange(m)),onWrapToggle:w.onWrapToggle,"onUpdate:mergeMenuOpen":a[18]||(a[18]=m=>B.onMergeMenuToggle(m)),onMergeChange:a[19]||(a[19]=m=>B.onMergeChange(m)),onApplyMerge:B.onApplyMerge,"onUpdate:calcMenuOpen":a[20]||(a[20]=m=>B.onCalcMenuToggle(m)),onCalcSum:B.onCalcSum,onCalcAvg:B.onCalcAvg,onCalcCount:B.onCalcCount,onFind:a[21]||(a[21]=m=>t.unref(M).openFind())},null,8,["locale","can-undo","can-redo","paint-fmt-active","has-selection","font-family-options","font-size-options","sel-font-family","sel-font-size","font-size-input","font-size-menu-open","sel-font-weight","sel-font-style","sel-underline","sel-strikethrough","sel-text-color","text-color-menu-open","sel-fill-color","fill-color-menu-open","cached-text-color","cached-fill-color","border-menu-open","cached-border","h-align-options","v-align-options","sel-h-align","sel-v-align","sel-wrap","merge-menu-open","calc-menu-open","is-single-cell","sel-number-format","nf-options","theme-vars","onPaintFormat","onFontSizeBlur","onFontSizeStepUp","onFontSizeStepDown","onBoldToggle","onItalicToggle","onUnderlineToggle","onStrikethroughToggle","onApplyTextColor","onApplyFillColor","onApplyBorder","onWrapToggle","onApplyMerge","onCalcSum","onCalcAvg","onCalcCount"]),t.createVNode($r,{open:V.open,"find-text":V.findText,"replace-text":V.replaceText,scope:V.scope,"match-case":V.matchCase,"match-entire-cell":V.matchEntireCell,"current-index":V.currentIndex,total:V.results.length,message:V.message,"focus-token":V.focusToken,locale:D.locale,"theme-vars":x.toolbarThemeVars,"onUpdate:findText":a[22]||(a[22]=m=>t.unref(M).findText.value=m),"onUpdate:replaceText":a[23]||(a[23]=m=>t.unref(M).replaceText.value=m),"onUpdate:scope":a[24]||(a[24]=m=>t.unref(M).scope.value=m),"onUpdate:matchCase":a[25]||(a[25]=m=>t.unref(M).matchCase.value=m),"onUpdate:matchEntireCell":a[26]||(a[26]=m=>t.unref(M).matchEntireCell.value=m),onPrev:a[27]||(a[27]=m=>t.unref(M).findPrev()),onNext:a[28]||(a[28]=m=>t.unref(M).findNext()),onReplace:a[29]||(a[29]=m=>t.unref(M).replace()),onReplaceAll:a[30]||(a[30]=m=>t.unref(M).replaceAll()),onClose:a[31]||(a[31]=m=>t.unref(M).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(ba,{"model-open":w.nfDialogOpen,locale:D.locale,"current-format":oe.value,"onUpdate:modelOpen":a[32]||(a[32]=m=>Z(m)),onApply:a[33]||(a[33]=m=>w.applyNumberFormatCode(m))},null,8,["model-open","locale","current-format"]),t.createElementVNode("div",{class:t.normalizeClass(["formula-bar",{"formula-bar--expanded":p.formulaBarExpanded}])},[t.createElementVNode("div",$a,t.toDisplayString(p.activeCellLabel),1),t.createElementVNode("div",za,[t.createElementVNode("button",{type:"button",class:"formula-bar__btn formula-bar__btn--cancel",title:"取消(Esc)","aria-label":"取消",onMousedown:a[34]||(a[34]=t.withModifiers(()=>{},["prevent"])),onClick:a[35]||(a[35]=t.withModifiers((...m)=>p.cancelFormulaBarEdit&&p.cancelFormulaBarEdit(...m),["stop"]))},[...a[84]||(a[84]=[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:a[36]||(a[36]=t.withModifiers(()=>{},["prevent"])),onClick:a[37]||(a[37]=t.withModifiers((...m)=>p.acceptFormulaBarEdit&&p.acceptFormulaBarEdit(...m),["stop"]))},[...a[85]||(a[85]=[t.createElementVNode("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":"true"},[t.createElementVNode("path",{d:"M2.5 7.5l3.5 3.5L12 3.5",fill:"none",stroke:"#2e7d32","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],32)]),t.createElementVNode("textarea",{ref:Je,class:t.normalizeClass(["formula-bar__input",{"formula-bar__input--expanded":p.formulaBarExpanded}]),rows:p.formulaBarExpanded?3:1,value:p.formulaBarDisplay,spellcheck:"false",onFocus:a[38]||(a[38]=(...m)=>p.onFormulaBarFocus&&p.onFormulaBarFocus(...m)),onInput:a[39]||(a[39]=(...m)=>p.onFormulaBarInput&&p.onFormulaBarInput(...m)),onKeydown:a[40]||(a[40]=(...m)=>p.onFormulaBarKeydown&&p.onFormulaBarKeydown(...m)),onBlur:a[41]||(a[41]=(...m)=>p.onFormulaBarBlur&&p.onFormulaBarBlur(...m))},null,42,Wa),t.createElementVNode("button",{type:"button",class:"formula-bar__toggle",title:p.formulaBarExpanded?"折叠为1行":"展开为3行",onMousedown:a[42]||(a[42]=t.withModifiers(()=>{},["prevent"])),onClick:t.withModifiers(Ge,["stop"])},[p.formulaBarExpanded?(t.openBlock(),t.createElementBlock("svg",Ua,[...a[87]||(a[87]=[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",Ka,[...a[86]||(a[86]=[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,_a)],2),t.createElementVNode("div",{ref:je,class:"spreadsheet-wrapper"},[t.createElementVNode("canvas",{ref:se,class:"grid-canvas",tabindex:"0",onMousedown:a[43]||(a[43]=(...m)=>p.onMouseDown&&p.onMouseDown(...m)),onMousemove:a[44]||(a[44]=(...m)=>p.onMouseMove&&p.onMouseMove(...m)),onMouseup:a[45]||(a[45]=(...m)=>p.onMouseUp&&p.onMouseUp(...m)),onMouseleave:a[46]||(a[46]=(...m)=>p.onMouseLeave&&p.onMouseLeave(...m)),onDblclick:a[47]||(a[47]=(...m)=>p.onDblClick&&p.onDblClick(...m)),onWheel:a[48]||(a[48]=t.withModifiers((...m)=>p.onWheel&&p.onWheel(...m),["prevent"])),onFocus:a[49]||(a[49]=(...m)=>x.onCanvasFocus&&x.onCanvasFocus(...m)),onKeydown:a[50]||(a[50]=(...m)=>p.onKeydown&&p.onKeydown(...m)),onContextmenu:a[51]||(a[51]=(...m)=>p.onCanvasCtx&&p.onCanvasCtx(...m)),onTouchstart:a[52]||(a[52]=t.withModifiers((...m)=>p.onTouchStart&&p.onTouchStart(...m),["prevent"])),onTouchmove:a[53]||(a[53]=t.withModifiers((...m)=>p.onTouchMove&&p.onTouchMove(...m),["prevent"])),onTouchend:a[54]||(a[54]=(...m)=>p.onTouchEnd&&p.onTouchEnd(...m))},null,32),t.createElementVNode("textarea",{ref:de,class:"cell-editor",value:D.editValue,style:t.normalizeStyle(p.editInputStyle),onInput:a[55]||(a[55]=(...m)=>p.onEditInput&&p.onEditInput(...m)),onKeydown:a[56]||(a[56]=(...m)=>p.onEditKd&&p.onEditKd(...m)),onCompositionstart:a[57]||(a[57]=(...m)=>p.onEditCompositionStart&&p.onEditCompositionStart(...m)),onCompositionend:a[58]||(a[58]=(...m)=>p.onEditCompositionEnd&&p.onEditCompositionEnd(...m)),onBlur:a[59]||(a[59]=(...m)=>p.onEditBlur&&p.onEditBlur(...m)),onPaste:a[60]||(a[60]=(...m)=>p.onEditPaste&&p.onEditPaste(...m))},null,44,Ga),x.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"v-scrollbar",style:t.normalizeStyle({top:t.unref(24)+"px",height:`calc(100% - ${t.unref(24)+t.unref(11)}px)`})},[t.createElementVNode("button",{class:"sb-btn sb-btn--up",title:"",onMousedown:a[61]||(a[61]=t.withModifiers(m=>{x.clampScroll(null,D.scrollY-50),p.scheduleRender()},["prevent"]))},[...a[88]||(a[88]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--up"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--v",onMousedown:a[63]||(a[63]=(...m)=>p.onVTrk&&p.onVTrk(...m))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--v",style:t.normalizeStyle({top:p.vThumbT+"px",height:p.vThumbH+"px"}),onMousedown:a[62]||(a[62]=(...m)=>p.onVStart&&p.onVStart(...m))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--down",onMousedown:a[64]||(a[64]=t.withModifiers(m=>{x.clampScroll(null,D.scrollY+50),p.scheduleRender()},["prevent"]))},[...a[89]||(a[89]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--down"},null,-1)])],32)],4)):t.createCommentVNode("",!0),x.maxScrollX>0?(t.openBlock(),t.createElementBlock("div",{key:1,class:"h-scrollbar",style:t.normalizeStyle({left:t.unref(52)+"px",width:`calc(100% - ${t.unref(52)+t.unref(11)}px)`})},[t.createElementVNode("button",{class:"sb-btn sb-btn--left",onMousedown:a[65]||(a[65]=t.withModifiers(m=>{x.clampScroll(D.scrollX-50,null),p.scheduleRender()},["prevent"]))},[...a[90]||(a[90]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--left"},null,-1)])],32),t.createElementVNode("div",{class:"sb-track sb-track--h",onMousedown:a[67]||(a[67]=(...m)=>p.onHTrk&&p.onHTrk(...m))},[t.createElementVNode("div",{class:"sb-thumb sb-thumb--h",style:t.normalizeStyle({left:p.hThumbL+"px",width:p.hThumbW+"px"}),onMousedown:a[66]||(a[66]=(...m)=>p.onHStart&&p.onHStart(...m))},null,36)],32),t.createElementVNode("button",{class:"sb-btn sb-btn--right",onMousedown:a[68]||(a[68]=t.withModifiers(m=>{x.clampScroll(D.scrollX+50,null),p.scheduleRender()},["prevent"]))},[...a[91]||(a[91]=[t.createElementVNode("span",{class:"sb-arrow sb-arrow--right"},null,-1)])],32)],4)):t.createCommentVNode("",!0),x.maxScrollX>0&&x.maxScrollY>0?(t.openBlock(),t.createElementBlock("div",Pa)):t.createCommentVNode("",!0)]),t.createVNode(kr,{locale:D.locale,sheets:t.unref(le),"active-sheet-index":t.unref(ne),"ren-tab":p.renTab,"ren-tab-val":p.renTabVal,onTabClick:a[69]||(a[69]=m=>p.onTabClick(m)),onTabDblclick:a[70]||(a[70]=m=>p.onTabDblClick(m)),onTabContextmenu:a[71]||(a[71]=m=>p.onTabCtxMenu(m.ev,m.i)),onTabRenameInput:a[72]||(a[72]=m=>Ve(m)),onTabRenameKeydown:a[73]||(a[73]=m=>p.onTabRenameKd(m)),onTabRenameCommit:p.commitTabRename,onTabbarContextmenu:a[74]||(a[74]=m=>p.onTabBarCtx(m)),onAddSheet:a[75]||(a[75]=m=>{x.addSheet(),p.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(()=>[p.ctxMenu?(t.openBlock(),t.createElementBlock("div",{key:0,class:"context-menu",style:t.normalizeStyle({left:p.ctxMenu.x+"px",top:p.ctxMenu.y+"px"}),onClick:a[76]||(a[76]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(p.ctxMenu.items,(m,fe)=>(t.openBlock(),t.createElementBlock("div",{key:fe,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":m.disabled}]),onClick:Te=>!m.disabled&&m.action&&(m.action(),Oe()),onMouseenter:Te=>p.onCtxItemEnter(Te,m)},[t.createElementVNode("span",Xa,t.toDisplayString(m.label),1),m.children?(t.openBlock(),t.createElementBlock("span",ja)):t.createCommentVNode("",!0),m.children?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["context-submenu",{"context-submenu--left":p.ctxSubmenuLeft}])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(m.children,(Te,f)=>(t.openBlock(),t.createElementBlock("div",{key:f,class:t.normalizeClass(["context-menu__item",{"context-menu__item--disabled":Te.disabled}]),onClick:t.withModifiers(S=>!Te.disabled&&Te.action&&(Te.action(),Oe()),["stop"])},t.toDisplayString(Te.label),11,Za))),128))],2)):t.createCommentVNode("",!0)],42,Ya))),128))],4)):t.createCommentVNode("",!0)]),_:1})])),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"menu-pop"},{default:t.withCtx(()=>[p.dimPanel?(t.openBlock(),t.createElementBlock("div",{key:0,class:"dim-panel",style:t.normalizeStyle({left:p.dimPanel.x+"px",top:p.dimPanel.y+"px"}),onMousedown:a[82]||(a[82]=t.withModifiers(()=>{},["stop"])),onClick:a[83]||(a[83]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",qa,t.toDisplayString(p.dimPanel.type==="row"?"行高":"列宽"),1),t.createElementVNode("div",Ja,[t.createElementVNode("input",{ref:Se,class:t.normalizeClass(["dim-panel__input",{"dim-panel__input--error":p.dimPanel.error}]),type:"number",step:"1",min:"1",inputmode:"numeric",value:p.dimPanel.value,onInput:a[77]||(a[77]=(...m)=>p.onDimInput&&p.onDimInput(...m)),onKeydown:a[78]||(a[78]=(...m)=>p.onDimKeydown&&p.onDimKeydown(...m)),onBlur:a[79]||(a[79]=(...m)=>p.onDimBlur&&p.onDimBlur(...m))},null,42,Qa),a[92]||(a[92]=t.createElementVNode("span",{class:"dim-panel__unit"},"px",-1))]),p.dimPanel.error?(t.openBlock(),t.createElementBlock("div",ei,t.toDisplayString(p.dimPanel.error),1)):t.createCommentVNode("",!0),t.createElementVNode("div",ti,[t.createElementVNode("button",{class:"dim-panel__btn dim-panel__btn--primary",onClick:a[80]||(a[80]=(...m)=>p.applyDimPanel&&p.applyDimPanel(...m))}," 确定 "),t.createElementVNode("button",{class:"dim-panel__btn",onClick:a[81]||(a[81]=(...m)=>p.closeDimPanel&&p.closeDimPanel(...m))}," 取消 ")])],36)):t.createCommentVNode("",!0)]),_:1})]))],4))}}),[["__scopeId","data-v-daa631b0"]]);Dt.Spreader=ql,Dt.default=ql,Object.defineProperties(Dt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|