hxy-editor 0.4.26 → 0.4.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- (function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`@keyframes univer-spin{to{transform:rotate(360deg)}}@media (width>=640px){.sm\\:\\!univer-flex-row{flex-direction:row!important}.sm\\:\\!univer-justify-end{justify-content:flex-end!important}.sm\\:\\!univer-space-x-2>:not([hidden])~:not([hidden]){--univer-tw-space-x-reverse:0!important;margin-right:0!important;margin-right:calc(.5rem * var(--univer-tw-space-x-reverse))!important;margin-left:calc(.5rem * (1 - var(--univer-tw-space-x-reverse)))!important;margin-left:.5rem!important;margin-left:calc(.5rem * calc(1 - var(--univer-tw-space-x-reverse)))!important}.sm\\:\\!univer-rounded-lg{border-radius:.5rem!important}.sm\\:\\!univer-text-left{text-align:left!important}}@media (width>=768px){.md\\:univer-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}@keyframes popup-slide-up-in{0%{transform-origin:0 0;opacity:0;transform:scaleY(0)}to{transform-origin:0 0;opacity:1;transform:scaleY(1)}}@keyframes popup-slide-up-out{0%{transform-origin:0 0;opacity:1;transform:scaleY(1)}to{transform-origin:0 0;opacity:0;transform:scaleY(0)}}@keyframes enter{0%{opacity:1;opacity:var(--univer-tw-enter-opacity,1);transform:translateZ(0)scaleZ(1)rotate(0);transform:translate3d(var(--univer-tw-enter-translate-x,0),var(--univer-tw-enter-translate-y,0),0) scale3d(var(--univer-tw-enter-scale,1),var(--univer-tw-enter-scale,1),var(--univer-tw-enter-scale,1)) rotate(var(--univer-tw-enter-rotate,0))}}@keyframes exit{to{opacity:1;opacity:var(--univer-tw-exit-opacity,1);transform:translateZ(0)scaleZ(1)rotate(0);transform:translate3d(var(--univer-tw-exit-translate-x,0),var(--univer-tw-exit-translate-y,0),0) scale3d(var(--univer-tw-exit-scale,1),var(--univer-tw-exit-scale,1),var(--univer-tw-exit-scale,1)) rotate(var(--univer-tw-exit-rotate,0))}}.focus\\:univer-ring-2:focus,.focus-visible\\:univer-ring-2:focus-visible{--univer-tw-ring-offset-shadow:var(--univer-tw-ring-inset) 0 0 0 var(--univer-tw-ring-offset-width) var(--univer-tw-ring-offset-color);--univer-tw-ring-shadow:var(--univer-tw-ring-inset) 0 0 0 calc(2px + var(--univer-tw-ring-offset-width)) var(--univer-tw-ring-color);box-shadow:var(--univer-tw-ring-offset-shadow),var(--univer-tw-ring-shadow),0 0 #0000;box-shadow:var(--univer-tw-ring-offset-shadow),var(--univer-tw-ring-shadow),var(--univer-tw-shadow,0 0 #0000)}@media (width>=640px){.sm\\:\\!univer-block{display:block!important}}.univer-w-\\[328px\\]{width:328px}.univer-flex-\\[0_0_auto\\]{flex:none}.doc-shell[data-v-6ceced2c]{letter-spacing:normal;flex-direction:column;height:760px;font-size:14px;line-height:normal;display:flex}.doc-layout[data-v-6ceced2c]{flex:1;min-height:0;display:flex}.doc-canvas[data-v-6ceced2c]{background:#f7f8fa;flex:1;min-width:0;position:relative}.readonly-badge[data-v-6ceced2c]{z-index:30;color:#8c8c8c;pointer-events:none;background:#ffffffeb;border:1px solid #e0e0e0;border-radius:999px;padding:3px 10px;font-size:12px;position:absolute;top:10px;right:14px;box-shadow:0 1px 4px #0000000f}.attachment-file-input[data-v-6ceced2c]{display:none}.attachment-error-tip[data-v-6ceced2c]{z-index:30;color:#fff;pointer-events:none;background:#e5484df2;border-radius:6px;max-width:80%;padding:6px 14px;font-size:12px;position:absolute;bottom:16px;left:50%;transform:translate(-50%);box-shadow:0 4px 12px #0000002e}.attachment-uploading-tip[data-v-6ceced2c]{z-index:30;color:#fff;pointer-events:none;background:#3370ffeb;border-radius:6px;padding:6px 14px;font-size:12px;position:absolute;bottom:16px;left:50%;transform:translate(-50%);box-shadow:0 4px 12px #0000002e}.doc-editor[data-v-6ceced2c]{contain:layout style;letter-spacing:normal;font-size:14px;line-height:normal;position:absolute;inset:0;overflow:hidden}.link-dialog-mask[data-v-6ceced2c]{z-index:30;background:#00000047;justify-content:center;align-items:center;display:flex;position:absolute;inset:0}.link-dialog[data-v-6ceced2c]{background:#fff;border-radius:12px;width:400px;max-width:calc(100% - 48px);padding:22px 24px 18px;box-shadow:0 12px 40px #00000029}.link-dialog-title[data-v-6ceced2c]{color:#1a1a1a;margin-bottom:18px;font-size:16px;font-weight:600}.link-dialog-field[data-v-6ceced2c]{margin-bottom:14px}.field-label[data-v-6ceced2c]{color:#595959;margin-bottom:6px;font-size:13px;font-weight:500;display:block}.field-input[data-v-6ceced2c]{color:#333;background:#fafafa;border:1px solid #e0e0e0;border-radius:6px;outline:none;width:100%;height:34px;padding:0 10px;font-size:13px;transition:border-color .15s,box-shadow .15s}.field-input[data-v-6ceced2c]:focus{background:#fff;border-color:#25b864;box-shadow:0 0 0 2px #25b8641f}.field-input.error[data-v-6ceced2c]{border-color:#e5484d}.field-error[data-v-6ceced2c]{color:#e5484d;margin-top:4px;font-size:12px}.link-dialog-tip[data-v-6ceced2c]{color:#bfbfbf;margin-bottom:16px;font-size:12px}.link-dialog-actions[data-v-6ceced2c]{justify-content:flex-end;gap:10px;display:flex}.dialog-btn[data-v-6ceced2c]{cursor:pointer;border:none;border-radius:6px;height:32px;padding:0 18px;font-size:13px;transition:all .15s}.dialog-btn.cancel[data-v-6ceced2c]{color:#595959;background:#f5f5f5}.dialog-btn.cancel[data-v-6ceced2c]:hover{background:#ececec}.dialog-btn.confirm[data-v-6ceced2c]{color:#fff;background:#25b864;font-weight:500}.dialog-btn.confirm[data-v-6ceced2c]:hover:not(:disabled){background:#1fa257}.dialog-btn.confirm[data-v-6ceced2c]:disabled{cursor:not-allowed;background:#bfe6d2}.doc-statusbar[data-v-6ceced2c]{color:#8c8c8c;background:#fafbfc;border-top:1px solid #f0f0f0;align-items:center;gap:8px;padding:8px 20px;font-size:12px;display:flex}.status-count[data-v-6ceced2c]{color:#595959;font-weight:500}.status-flex[data-v-6ceced2c]{flex:1}.status-tip[data-v-6ceced2c]{color:#bfbfbf}.link-hover-bar[data-v-6ceced2c]{z-index:1080;white-space:nowrap;-webkit-user-select:none;user-select:none;background:#fff;border:1px solid #e8e8e8;border-radius:6px;align-items:center;gap:2px;padding:4px 8px;display:flex;position:fixed;transform:translate(-50%)translateY(-100%);box-shadow:0 4px 16px #0000001f}.hover-label[data-v-6ceced2c]{color:#3370ff;cursor:pointer;padding:0 6px;font-size:13px;font-weight:500}.hover-label[data-v-6ceced2c]:hover{text-decoration:underline}.hover-icon-btn[data-v-6ceced2c]{color:#595959;cursor:pointer;background:0 0;border:none;border-radius:4px;justify-content:center;align-items:center;width:28px;height:28px;padding:0;transition:background .12s,color .12s;display:inline-flex;position:relative}.hover-icon-btn[data-v-6ceced2c]:hover{color:#1d2129;background:#f2f3f5}.hover-icon-tip[data-v-6ceced2c]{color:#3370ff;white-space:nowrap;pointer-events:none;font-size:10px;position:absolute;bottom:-18px;left:50%;transform:translate(-50%)}.hover-unlink-btn[data-v-6ceced2c]:hover{color:#e5484d;background:#e5484d14}.hover-sep[data-v-6ceced2c]{background:#ececec;flex-shrink:0;width:1px;height:16px;margin:0 4px}.hover-bar-arrow[data-v-6ceced2c]{background:#fff;border-bottom:1px solid #e8e8e8;border-right:1px solid #e8e8e8;width:8px;height:8px;position:absolute;bottom:-5px;left:50%;transform:translate(-50%)rotate(45deg)}.hover-style[data-v-6ceced2c]{position:relative}.hover-style-menu[data-v-6ceced2c]{text-align:left;background:#fff;border:1px solid #e8e8e8;border-radius:6px;min-width:140px;padding:4px;position:absolute;top:calc(100% + 8px);left:50%;transform:translate(-50%);box-shadow:0 4px 16px #0000001f}.hover-style-item[data-v-6ceced2c]{cursor:pointer;color:#595959;border-radius:4px;align-items:center;gap:6px;padding:6px 10px;font-size:13px;display:flex}.hover-style-item[data-v-6ceced2c]:hover{background:#f7f8fa}.hover-style-item.active[data-v-6ceced2c]{color:#3370ff}.style-check[data-v-6ceced2c]{color:#3370ff;text-align:center;flex-shrink:0;width:16px;font-size:12px}.style-name[data-v-6ceced2c]{font-size:13px}[data-u-comp=rect-popup]:has(.univer-max-w-80){visibility:hidden;pointer-events:none}*,:before,:after,::backdrop{--univer-tw-border-spacing-x:0;--univer-tw-border-spacing-y:0;--univer-tw-translate-x:0;--univer-tw-translate-y:0;--univer-tw-rotate:0;--univer-tw-skew-x:0;--univer-tw-skew-y:0;--univer-tw-scale-x:1;--univer-tw-scale-y:1;--univer-tw-pan-x: ;--univer-tw-pan-y: ;--univer-tw-pinch-zoom: ;--univer-tw-scroll-snap-strictness:proximity;--univer-tw-gradient-from-position: ;--univer-tw-gradient-via-position: ;--univer-tw-gradient-to-position: ;--univer-tw-ordinal: ;--univer-tw-slashed-zero: ;--univer-tw-numeric-figure: ;--univer-tw-numeric-spacing: ;--univer-tw-numeric-fraction: ;--univer-tw-ring-inset: ;--univer-tw-ring-offset-width:0px;--univer-tw-ring-offset-color:#fff;--univer-tw-ring-color:#93c5fd80;--univer-tw-ring-offset-shadow:0 0 #0000;--univer-tw-ring-shadow:0 0 #0000;--univer-tw-shadow:0 0 #0000;--univer-tw-shadow-colored:0 0 #0000;--univer-tw-blur: ;--univer-tw-brightness: ;--univer-tw-contrast: ;--univer-tw-grayscale: ;--univer-tw-hue-rotate: ;--univer-tw-invert: ;--univer-tw-saturate: ;--univer-tw-sepia: ;--univer-tw-drop-shadow: ;--univer-tw-backdrop-blur: ;--univer-tw-backdrop-brightness: ;--univer-tw-backdrop-contrast: ;--univer-tw-backdrop-grayscale: ;--univer-tw-backdrop-hue-rotate: ;--univer-tw-backdrop-invert: ;--univer-tw-backdrop-opacity: ;--univer-tw-backdrop-saturate: ;--univer-tw-backdrop-sepia: ;--univer-tw-contain-size: ;--univer-tw-contain-layout: ;--univer-tw-contain-paint: ;--univer-tw-contain-style: }*{scrollbar-color:initial;scrollbar-width:initial}.univer-sr-only{clip:rect(0,0,0,0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.univer-inset-x-0{left:0;right:0}.univer-bottom-0\\.5{bottom:.125rem}.univer-bottom-6{bottom:1.5rem}.univer-left-0\\.5{left:.125rem}.univer-left-2{left:.5rem}.univer-left-\\[-16px\\]{left:-16px}.univer-right-4{right:1rem}.univer-right-px{right:1px}.univer-top-px{top:1px}.univer-z-0{z-index:0}.univer-z-\\[1081\\]{z-index:1081}.-univer-mx-1{margin-left:-.25rem;margin-right:-.25rem}.univer-ml-auto{margin-left:auto}.\\!univer-hidden{display:none!important}.univer-size-2{width:.5rem;height:.5rem}.univer-size-2\\.5{width:.625rem;height:.625rem}.univer-h-1\\/2{height:50%}.univer-h-12{height:3rem}.univer-h-2{height:.5rem}.univer-h-32{height:8rem}.univer-h-48{height:12rem}.univer-h-\\[150px\\]{height:150px}.univer-h-\\[calc\\(100\\%-2px\\)\\]{height:calc(100% - 2px)}.univer-max-h-0{max-height:0}.univer-max-h-\\[--radix-popper-available-height\\]{max-height:var(--radix-popper-available-height)}.univer-max-h-\\[1000px\\]{max-height:1000px}.univer-max-h-\\[40vh\\]{max-height:40vh}.univer-max-h-full{max-height:100%}.univer-max-h-screen{max-height:100vh}.univer-min-h-3\\.5{min-height:.875rem}.univer-min-h-\\[520px\\]{min-height:520px}.\\!univer-w-fit{width:fit-content!important}.univer-w-64{width:16rem}.univer-w-72{width:18rem}.univer-w-80{width:20rem}.univer-w-\\[calc\\(100\\%-16px\\)\\]{width:calc(100% - 16px)}.univer-min-w-36{min-width:9rem}.univer-min-w-\\[320px\\]{min-width:320px}.univer-max-w-2xl{max-width:42rem}.univer-max-w-\\[520px\\]{max-width:520px}.univer-max-w-\\[60vw\\]{max-width:60vw}.univer-max-w-sm{max-width:24rem}.univer-max-w-xs{max-width:20rem}.univer-shrink{flex-shrink:1}.univer-shrink-0{flex-shrink:0}.univer-origin-\\[--radix-hover-card-content-transform-origin\\]{transform-origin:var(--radix-hover-card-content-transform-origin)}.-univer-translate-y-1\\/2,.univer--translate-y-1\\/2{--univer-tw-translate-y:-50%;transform:translate(var(--univer-tw-translate-x),-50%) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y));transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y))}.univer-translate-x-3{--univer-tw-translate-x:.75rem;transform:translate(.75rem,var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y));transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y))}.-univer-rotate-90{--univer-tw-rotate:-90deg;transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(-90deg) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y));transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y))}.univer-rotate-0{--univer-tw-rotate:0deg;transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(0) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y));transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y))}.univer-rotate-45{--univer-tw-rotate:45deg;transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(45deg) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y));transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y))}.univer-rotate-\\[-90deg\\]{--univer-tw-rotate:-90deg;transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(-90deg) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y));transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y))}.\\!univer-animate-none{animation:none!important}.univer-cursor-crosshair{cursor:crosshair}.univer-cursor-grabbing{cursor:grabbing}.univer-resize{resize:both}.univer-grid-flow-row{grid-auto-flow:row}.univer-grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.univer-flex-col-reverse{flex-direction:column-reverse}.univer-content-center{align-content:center}.univer-gap-5{gap:1.25rem}.univer-space-y-1\\.5>:not([hidden])~:not([hidden]){--univer-tw-space-y-reverse:0;margin-top:calc(.375rem * (1 - var(--univer-tw-space-y-reverse)));margin-top:.375rem;margin-top:calc(.375rem * calc(1 - var(--univer-tw-space-y-reverse)));margin-bottom:0;margin-bottom:calc(.375rem * var(--univer-tw-space-y-reverse))}.univer-divide-x>:not([hidden])~:not([hidden]){--univer-tw-divide-x-reverse:0;border-right-width:0;border-right-width:calc(1px * var(--univer-tw-divide-x-reverse));border-left-width:calc(1px * (1 - var(--univer-tw-divide-x-reverse)));border-left-width:1px;border-left-width:calc(1px * calc(1 - var(--univer-tw-divide-x-reverse)))}.univer-divide-y-0>:not([hidden])~:not([hidden]){--univer-tw-divide-y-reverse:0;border-top-width:calc(0px * (1 - var(--univer-tw-divide-y-reverse)));border-top-width:0;border-top-width:calc(0px * calc(1 - var(--univer-tw-divide-y-reverse)));border-bottom-width:0;border-bottom-width:calc(0px * var(--univer-tw-divide-y-reverse))}.univer-text-ellipsis{text-overflow:ellipsis}.univer-text-balance{text-wrap:balance}.\\!univer-rounded-b-none{border-bottom-right-radius:0!important;border-bottom-left-radius:0!important}.\\!univer-rounded-l-none{border-top-left-radius:0!important;border-bottom-left-radius:0!important}.\\!univer-rounded-r-none{border-top-right-radius:0!important;border-bottom-right-radius:0!important}.\\!univer-rounded-t-none{border-top-left-radius:0!important;border-top-right-radius:0!important}.univer-rounded-r-md{border-top-right-radius:.375rem;border-bottom-right-radius:.375rem}.\\!univer-border-l-0{border-left-width:0!important}.\\!univer-border-t-0{border-top-width:0!important}.univer-border-b-0{border-bottom-width:0}.univer-border-l{border-left-width:1px}.univer-border-l-0{border-left-width:0}.univer-border-r{border-right-width:1px}.univer-border-t-0{border-top-width:0}.univer-border-dashed{border-style:dashed}.\\!univer-border-gray-200{border-color:var(--univer-gray-200)!important}.univer-border-gray-300{border-color:var(--univer-gray-300)}.univer-border-primary-200{border-color:var(--univer-primary-200)}.univer-border-primary-300{border-color:var(--univer-primary-300)}.univer-border-red-300{border-color:var(--univer-red-300)}.univer-border-red-500{border-color:var(--univer-red-500)}.univer-border-white{border-color:var(--univer-white)}.\\!univer-bg-primary-600{background-color:var(--univer-primary-600)!important}.univer-bg-\\[rgba\\(0\\,0\\,0\\,0\\.8\\)\\]{background-color:#000c}.univer-bg-gray-800{background-color:var(--univer-gray-800)}.univer-bg-gray-900{background-color:var(--univer-gray-900)}.univer-bg-primary-500{background-color:var(--univer-primary-500)}.univer-bg-red-500{background-color:var(--univer-red-500)}.univer-bg-sky-100\\/70{background-color:#e0f2feb3}.univer-bg-slate-100\\/80{background-color:#f1f5f9cc}.univer-bg-slate-900\\/90{background-color:#0f172ae6}.univer-bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--univer-tw-gradient-stops))}.univer-from-slate-100{--univer-tw-gradient-from:#f1f5f9 var(--univer-tw-gradient-from-position);--univer-tw-gradient-to:#f1f5f900 var(--univer-tw-gradient-to-position);--univer-tw-gradient-stops:var(--univer-tw-gradient-from), var(--univer-tw-gradient-to)}.univer-via-cyan-50{--univer-tw-gradient-to:#ecfeff00 var(--univer-tw-gradient-to-position);--univer-tw-gradient-stops:var(--univer-tw-gradient-from), #ecfeff var(--univer-tw-gradient-via-position), var(--univer-tw-gradient-to)}.univer-to-blue-100{--univer-tw-gradient-to:var(--univer-blue-100) var(--univer-tw-gradient-to-position)}.univer-fill-current{fill:currentColor}.\\!univer-p-2\\.5{padding:.625rem!important}.univer-p-6{padding:1.5rem}.\\!univer-pl-4{padding-left:1rem!important}.univer-pb-2\\.5{padding-bottom:.625rem}.univer-pl-8{padding-left:2rem}.univer-pr-32{padding-right:8rem}.univer-pr-8{padding-right:2rem}.univer-pt-4{padding-top:1rem}.univer-align-middle{vertical-align:middle}.univer-font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.univer-text-\\[13px\\]{font-size:13px}.univer-text-\\[8px\\]{font-size:8px}.univer-text-sm\\/8{font-size:.875rem;line-height:2rem}.univer-text-xs\\/6{font-size:.75rem;line-height:1.5rem}.univer-leading-9{line-height:2.25rem}.univer-leading-normal{line-height:1.5}.univer-tracking-wide{letter-spacing:.025em}.univer-tracking-widest{letter-spacing:.1em}.\\!univer-text-primary-500{color:var(--univer-primary-500)!important}.univer-text-amber-500{--univer-tw-text-opacity:1;color:rgba(245,158,11,var(--univer-tw-text-opacity,1))}.univer-text-cyan-700{--univer-tw-text-opacity:1;color:rgba(14,116,144,var(--univer-tw-text-opacity,1))}.univer-text-sky-500{--univer-tw-text-opacity:1;color:rgba(14,165,233,var(--univer-tw-text-opacity,1))}.univer-text-sky-700{--univer-tw-text-opacity:1;color:rgba(3,105,161,var(--univer-tw-text-opacity,1))}.univer-text-sky-900{--univer-tw-text-opacity:1;color:rgba(12,74,110,var(--univer-tw-text-opacity,1))}.univer-text-slate-500{--univer-tw-text-opacity:1;color:rgba(100,116,139,var(--univer-tw-text-opacity,1))}.univer-text-slate-600{--univer-tw-text-opacity:1;color:rgba(71,85,105,var(--univer-tw-text-opacity,1))}.univer-text-slate-700{--univer-tw-text-opacity:1;color:rgba(51,65,85,var(--univer-tw-text-opacity,1))}.univer-text-slate-800{--univer-tw-text-opacity:1;color:rgba(30,41,59,var(--univer-tw-text-opacity,1))}.univer-text-violet-500{--univer-tw-text-opacity:1;color:rgba(139,92,246,var(--univer-tw-text-opacity,1))}.univer-underline-offset-4{text-underline-offset:4px}.univer-opacity-100{opacity:1}.univer-opacity-50{opacity:.5}.univer-opacity-80{opacity:.8}.univer-shadow-\\[0_30px_60px_-35px_rgba\\(15\\,23\\,42\\,0\\.55\\)\\]{--univer-tw-shadow:0 30px 60px -35px #0f172a8c;--univer-tw-shadow-colored:0 30px 60px -35px var(--univer-tw-shadow-color);box-shadow:0 0 #0000,0 0 #0000,0 30px 60px -35px #0f172a8c;box-shadow:var(--univer-tw-ring-offset-shadow,0 0 #0000),var(--univer-tw-ring-shadow,0 0 #0000),var(--univer-tw-shadow)}.univer-shadow-inner{--univer-tw-shadow:inset 0 2px 4px 0 #0000000d;--univer-tw-shadow-colored:inset 0 2px 4px 0 var(--univer-tw-shadow-color);box-shadow:0 0 #0000,0 0 #0000,inset 0 2px 4px #0000000d;box-shadow:var(--univer-tw-ring-offset-shadow,0 0 #0000),var(--univer-tw-ring-shadow,0 0 #0000),var(--univer-tw-shadow)}.univer-ring-2{--univer-tw-ring-offset-shadow:var(--univer-tw-ring-inset) 0 0 0 var(--univer-tw-ring-offset-width) var(--univer-tw-ring-offset-color);--univer-tw-ring-shadow:var(--univer-tw-ring-inset) 0 0 0 calc(2px + var(--univer-tw-ring-offset-width)) var(--univer-tw-ring-color);box-shadow:var(--univer-tw-ring-offset-shadow),var(--univer-tw-ring-shadow),0 0 #0000;box-shadow:var(--univer-tw-ring-offset-shadow),var(--univer-tw-ring-shadow),var(--univer-tw-shadow,0 0 #0000)}.\\!univer-ring-primary-900{--univer-tw-ring-color:var(--univer-primary-900)!important}.univer-ring-primary-50{--univer-tw-ring-color:var(--univer-primary-50)}.univer-ring-white{--univer-tw-ring-color:var(--univer-white)}.univer-ring-offset-2{--univer-tw-ring-offset-width:2px}.\\!univer-ring-offset-gray-600{--univer-tw-ring-offset-color:var(--univer-gray-600)!important}.univer-ring-offset-white{--univer-tw-ring-offset-color:var(--univer-white)}.univer-drop-shadow-sm{--univer-tw-drop-shadow:drop-shadow(0 1px 1px #0000000d);filter:var(--univer-tw-blur) var(--univer-tw-brightness) var(--univer-tw-contrast) var(--univer-tw-grayscale) var(--univer-tw-hue-rotate) var(--univer-tw-invert) var(--univer-tw-saturate) var(--univer-tw-sepia) var(--univer-tw-drop-shadow)}.univer-transition-\\[color\\,box-shadow\\]{transition-property:color,box-shadow;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.univer-transition-\\[max-height\\,opacity\\]{transition-property:max-height,opacity;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.univer-transition-opacity{transition-property:opacity;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.univer-transition-transform{transition-property:transform;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.univer-duration-150{transition-duration:.15s}.univer-duration-500{transition-duration:.5s}.univer-duration-75{transition-duration:75ms}.univer-ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.univer-ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.univer-will-change-transform{will-change:transform}.univer-scrollbar-thin::-webkit-scrollbar-track{background-color:var(--scrollbar-track);border-radius:var(--scrollbar-track-radius)}.univer-scrollbar-thin::-webkit-scrollbar-track:hover{background-color:var(--scrollbar-track-hover,var(--scrollbar-track))}.univer-scrollbar-thin::-webkit-scrollbar-track:active{background-color:var(--scrollbar-track-active,var(--scrollbar-track-hover,var(--scrollbar-track)))}.univer-scrollbar-thin::-webkit-scrollbar-thumb{background-color:var(--scrollbar-thumb);border-radius:var(--scrollbar-thumb-radius)}.univer-scrollbar-thin::-webkit-scrollbar-thumb:hover{background-color:var(--scrollbar-thumb-hover,var(--scrollbar-thumb))}.univer-scrollbar-thin::-webkit-scrollbar-thumb:active{background-color:var(--scrollbar-thumb-active,var(--scrollbar-thumb-hover,var(--scrollbar-thumb)))}.univer-scrollbar-thin::-webkit-scrollbar-corner{background-color:var(--scrollbar-corner);border-radius:var(--scrollbar-corner-radius)}.univer-scrollbar-thin::-webkit-scrollbar-corner:hover{background-color:var(--scrollbar-corner-hover,var(--scrollbar-corner))}.univer-scrollbar-thin::-webkit-scrollbar-corner:active{background-color:var(--scrollbar-corner-active,var(--scrollbar-corner-hover,var(--scrollbar-corner)))}.univer-scrollbar-thin{scrollbar-width:thin;scrollbar-color:initial initial;scrollbar-color:var(--scrollbar-thumb,initial) var(--scrollbar-track,initial)}.univer-scrollbar-thin::-webkit-scrollbar{width:8px;height:8px;display:block}.univer-scrollbar-track-gray-50{--scrollbar-track:var(--univer-gray-50)!important}.univer-scrollbar-thumb-gray-300{--scrollbar-thumb:var(--univer-gray-300)!important}.univer-animate-out{--univer-tw-exit-opacity:initial;--univer-tw-exit-scale:initial;--univer-tw-exit-rotate:initial;--univer-tw-exit-translate-x:initial;--univer-tw-exit-translate-y:initial;animation-name:exit;animation-duration:.15s}.univer-fade-in,.univer-fade-in-0{--univer-tw-enter-opacity:0}.univer-fade-out{--univer-tw-exit-opacity:0}.univer-zoom-in-95{--univer-tw-enter-scale:.95}.univer-duration-150{animation-duration:.15s}.univer-duration-200{animation-duration:.2s}.univer-duration-300{animation-duration:.3s}.univer-duration-500{animation-duration:.5s}.univer-duration-75{animation-duration:75ms}.univer-ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.univer-ease-out{animation-timing-function:cubic-bezier(0,0,.2,1)}.placeholder\\:univer-text-gray-200::placeholder{color:var(--univer-gray-200)}.placeholder\\:univer-text-gray-400::placeholder{color:var(--univer-gray-400)}.before\\:univer-absolute:before{content:var(--univer-tw-content);position:absolute}.before\\:univer-top-1\\/2:before{content:var(--univer-tw-content);top:50%}.before\\:univer-block:before{content:var(--univer-tw-content);display:block}.before\\:univer-h-px:before{content:var(--univer-tw-content);height:1px}.before\\:univer-w-full:before{content:var(--univer-tw-content);width:100%}.before\\:-univer-translate-y-1\\/2:before{content:var(--univer-tw-content);--univer-tw-translate-y:-50%;transform:translate(var(--univer-tw-translate-x),-50%) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y));transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y))}.before\\:univer-bg-gray-200:before{content:var(--univer-tw-content);background-color:var(--univer-gray-200)}.before\\:univer-content-\\[\\"\\"\\]:before{--univer-tw-content:"";content:"";content:var(--univer-tw-content)}.data-\\[disabled\\]\\:univer-pointer-events-none[data-disabled]{pointer-events:none}.data-\\[orientation\\=horizontal\\]\\:univer-h-px[data-orientation=horizontal]{height:1px}.data-\\[orientation\\=vertical\\]\\:univer-h-full[data-orientation=vertical]{height:100%}.data-\\[orientation\\=horizontal\\]\\:univer-w-full[data-orientation=horizontal]{width:100%}.data-\\[orientation\\=vertical\\]\\:univer-w-px[data-orientation=vertical]{width:1px}.data-\\[state\\=open\\]\\:univer-bg-gray-100[data-state=open]{background-color:var(--univer-gray-100)}.data-\\[disabled\\]\\:univer-opacity-50[data-disabled]{opacity:.5}.data-\\[state\\=open\\]\\:univer-animate-in[data-state=open]{--univer-tw-enter-opacity:initial;--univer-tw-enter-scale:initial;--univer-tw-enter-rotate:initial;--univer-tw-enter-translate-x:initial;--univer-tw-enter-translate-y:initial;animation-name:enter;animation-duration:.15s}.data-\\[state\\=closed\\]\\:univer-animate-out[data-state=closed]{--univer-tw-exit-opacity:initial;--univer-tw-exit-scale:initial;--univer-tw-exit-rotate:initial;--univer-tw-exit-translate-x:initial;--univer-tw-exit-translate-y:initial;animation-name:exit;animation-duration:.15s}.data-\\[state\\=closed\\]\\:univer-fade-out-0[data-state=closed]{--univer-tw-exit-opacity:0}.data-\\[state\\=open\\]\\:univer-fade-in-0[data-state=open]{--univer-tw-enter-opacity:0}.data-\\[state\\=closed\\]\\:univer-zoom-out-95[data-state=closed]{--univer-tw-exit-scale:.95}.data-\\[state\\=open\\]\\:univer-zoom-in-95[data-state=open]{--univer-tw-enter-scale:.95}.data-\\[side\\=bottom\\]\\:univer-slide-in-from-top-2[data-side=bottom]{--univer-tw-enter-translate-y:-.5rem}.data-\\[side\\=left\\]\\:univer-slide-in-from-right-2[data-side=left]{--univer-tw-enter-translate-x:.5rem}.data-\\[side\\=right\\]\\:univer-slide-in-from-left-2[data-side=right]{--univer-tw-enter-translate-x:-.5rem}.data-\\[side\\=top\\]\\:univer-slide-in-from-bottom-2[data-side=top]{--univer-tw-enter-translate-y:.5rem}.data-\\[state\\=closed\\]\\:univer-slide-out-to-left-1\\/2[data-state=closed]{--univer-tw-exit-translate-x:-50%}.data-\\[state\\=closed\\]\\:univer-slide-out-to-top-\\[48\\%\\][data-state=closed]{--univer-tw-exit-translate-y:-48%}.data-\\[state\\=open\\]\\:univer-slide-in-from-left-1\\/2[data-state=open]{--univer-tw-enter-translate-x:-50%}.data-\\[state\\=open\\]\\:univer-slide-in-from-top-\\[48\\%\\][data-state=open]{--univer-tw-enter-translate-y:-48%}.hover\\:univer-border-red-400:hover{border-color:var(--univer-red-400)}.hover\\:univer-border-transparent:hover{border-color:#0000}.hover\\:univer-bg-primary-500:hover{background-color:var(--univer-primary-500)}.hover\\:univer-bg-red-400:hover{background-color:var(--univer-red-400)}.hover\\:univer-text-gray-500:hover{color:var(--univer-gray-500)}.hover\\:univer-text-primary-500:hover{color:var(--univer-primary-500)}.hover\\:univer-text-white:hover{color:var(--univer-white)}.hover\\:univer-underline:hover{text-decoration-line:underline}.hover\\:univer-opacity-100:hover{opacity:1}.hover\\:univer-opacity-70:hover{opacity:.7}.hover\\:univer-opacity-80:hover{opacity:.8}.focus\\:univer-border-primary-600:focus{border-color:var(--univer-primary-600)}.focus\\:univer-bg-gray-100:focus{background-color:var(--univer-gray-100)}.focus\\:univer-ring-primary-50:focus{--univer-tw-ring-color:var(--univer-primary-50)}.active\\:univer-border-red-600:active{border-color:var(--univer-red-600)}.active\\:univer-bg-primary-700:active{background-color:var(--univer-primary-700)}.active\\:univer-bg-red-600:active{background-color:var(--univer-red-600)}.active\\:univer-text-primary-700:active{color:var(--univer-primary-700)}.disabled\\:univer-pointer-events-none:disabled{pointer-events:none}.disabled\\:univer-opacity-50:disabled{opacity:.5}@media (width>=640px){.sm\\:\\!univer-flex-row{flex-direction:row!important}.sm\\:\\!univer-justify-end{justify-content:flex-end!important}.sm\\:\\!univer-space-x-2>:not([hidden])~:not([hidden]){--univer-tw-space-x-reverse:0!important;margin-right:0!important;margin-right:calc(.5rem * var(--univer-tw-space-x-reverse))!important;margin-left:calc(.5rem * (1 - var(--univer-tw-space-x-reverse)))!important;margin-left:.5rem!important;margin-left:calc(.5rem * calc(1 - var(--univer-tw-space-x-reverse)))!important}.sm\\:\\!univer-rounded-lg{border-radius:.5rem!important}.sm\\:\\!univer-text-left{text-align:left!important}}@media (width>=768px){.md\\:univer-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}.rtl\\:univer-left-px:where([dir=rtl],[dir=rtl] *){left:1px}.rtl\\:univer-right-auto:where([dir=rtl],[dir=rtl] *){right:auto}.rtl\\:univer-rounded-l-md:where([dir=rtl],[dir=rtl] *){border-top-left-radius:.375rem;border-bottom-left-radius:.375rem}.rtl\\:univer-rounded-r-none:where([dir=rtl],[dir=rtl] *){border-top-right-radius:0;border-bottom-right-radius:0}.rtl\\:univer-border-l-0:where([dir=rtl],[dir=rtl] *){border-left-width:0}.rtl\\:univer-border-r:where([dir=rtl],[dir=rtl] *){border-right-width:1px}.dark\\:\\!univer-border-gray-500:where(.univer-dark,.univer-dark *){border-color:var(--univer-gray-500)!important}.dark\\:\\!univer-border-primary-700:where(.univer-dark,.univer-dark *){border-color:var(--univer-primary-700)!important}.dark\\:\\!univer-bg-gray-100:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-100)!important}.dark\\:\\!univer-bg-primary-600:where(.univer-dark,.univer-dark *){background-color:var(--univer-primary-600)!important}.dark\\:\\!univer-text-gray-900:where(.univer-dark,.univer-dark *){color:var(--univer-gray-900)!important}.dark\\:\\!univer-text-primary-500:where(.univer-dark,.univer-dark *){color:var(--univer-primary-500)!important}.dark\\:\\!univer-text-sky-400:where(.univer-dark,.univer-dark *){--univer-tw-text-opacity:1!important;color:rgba(56,189,248,var(--univer-tw-text-opacity,1))!important}.dark\\:\\!univer-ring-primary-600:where(.univer-dark,.univer-dark *){--univer-tw-ring-color:var(--univer-primary-600)!important}.dark\\:\\!univer-ring-primary-900:where(.univer-dark,.univer-dark *){--univer-tw-ring-color:var(--univer-primary-900)!important}.dark\\:\\!univer-ring-offset-gray-600:where(.univer-dark,.univer-dark *){--univer-tw-ring-offset-color:var(--univer-gray-600)!important}.dark\\:\\!univer-scrollbar-track-gray-900:where(.univer-dark,.univer-dark *){--scrollbar-track:var(--univer-gray-900)!important}.dark\\:\\!univer-scrollbar-thumb-gray-700:where(.univer-dark,.univer-dark *){--scrollbar-thumb:var(--univer-gray-700)!important}.dark\\:before\\:\\!univer-bg-gray-600:where(.univer-dark,.univer-dark *):before{content:var(--univer-tw-content);background-color:var(--univer-gray-600)!important}.dark\\:data-\\[state\\=open\\]\\:\\!univer-bg-gray-600[data-state=open]:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-600)!important}.dark\\:hover\\:\\!univer-text-white:hover:where(.univer-dark,.univer-dark *){color:var(--univer-white)!important}.dark\\:focus\\:\\!univer-border-primary-500:focus:where(.univer-dark,.univer-dark *){border-color:var(--univer-primary-500)!important}.dark\\:focus\\:\\!univer-bg-gray-600:focus:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-600)!important}.dark\\:focus\\:\\!univer-ring-primary-900:focus:where(.univer-dark,.univer-dark *){--univer-tw-ring-color:var(--univer-primary-900)!important}.dark\\:focus-visible\\:\\!univer-border-gray-600:focus-visible:where(.univer-dark,.univer-dark *){border-color:var(--univer-gray-600)!important}.dark\\:active\\:\\!univer-bg-gray-700:active:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-700)!important}.\\[\\&\\:\\:-webkit-calendar-picker-indicator\\]\\:univer-hidden::-webkit-calendar-picker-indicator{display:none}.\\[\\&\\:\\:-webkit-calendar-picker-indicator\\]\\:univer-appearance-none::-webkit-calendar-picker-indicator{appearance:none}.\\[\\&\\>input\\]\\:univer-w-11>input{width:2.75rem}.\\[\\&\\>input\\]\\:univer-border-gray-200>input{border-color:var(--univer-gray-200)}.\\[\\&\\>input\\]\\:focus\\:univer-border-primary-500:focus>input{border-color:var(--univer-primary-500)}.dark\\:\\[\\&\\>input\\]\\:\\!univer-border-gray-600>input:where(.univer-dark,.univer-dark *){border-color:var(--univer-gray-600)!important}.dark\\:\\[\\&\\>input\\]\\:\\!univer-text-white>input:where(.univer-dark,.univer-dark *){color:var(--univer-white)!important}.\\[\\&\\>svg\\]\\:univer-block>svg{display:block}.\\[\\&\\>svg\\]\\:univer-size-4>svg{width:1rem;height:1rem}.\\[\\&\\>ul\\:not\\(\\:last-child\\)\\]\\:univer-border-0>ul:not(:last-child){border-width:0}.\\[\\&\\>ul\\:not\\(\\:last-child\\)\\]\\:univer-border-r>ul:not(:last-child){border-right-width:1px}.\\[\\&\\>ul\\:not\\(\\:last-child\\)\\]\\:univer-border-solid>ul:not(:last-child){border-style:solid}.\\[\\&\\>ul\\:not\\(\\:last-child\\)\\]\\:univer-border-r-gray-200>ul:not(:last-child){border-right-color:var(--univer-gray-200)}.\\[\\&_\\[data-description\\]\\]\\:univer-text-sm [data-description]{font-size:.875rem;line-height:1.25rem}.\\[\\&_\\[data-description\\]\\]\\:univer-text-gray-200 [data-description]{color:var(--univer-gray-200)}.\\[\\&_\\[data-description\\]\\]\\:univer-text-gray-600 [data-description]{color:var(--univer-gray-600)}.\\[\\&_\\[data-icon\\]\\>svg\\]\\:univer-relative [data-icon]>svg{position:relative}.\\[\\&_\\[data-icon\\]\\>svg\\]\\:univer-top-1 [data-icon]>svg{top:.25rem}.\\[\\&_\\[data-icon\\]\\]\\:univer-self-baseline [data-icon]{align-self:baseline}.\\[\\&_\\[data-icon\\]\\]\\:univer-text-amber-500 [data-icon]{--univer-tw-text-opacity:1;color:rgba(245,158,11,var(--univer-tw-text-opacity,1))}.\\[\\&_\\[data-icon\\]\\]\\:univer-text-green-500 [data-icon]{color:var(--univer-green-500)}.\\[\\&_\\[data-icon\\]\\]\\:univer-text-primary-600 [data-icon]{color:var(--univer-primary-600)}.\\[\\&_\\[data-icon\\]\\]\\:univer-text-red-500 [data-icon]{color:var(--univer-red-500)}.\\[\\&_\\[data-icon\\]\\]\\:univer-text-sky-500 [data-icon]{--univer-tw-text-opacity:1;color:rgba(14,165,233,var(--univer-tw-text-opacity,1))}.\\[\\&_\\[data-icon\\]\\]\\:univer-text-violet-500 [data-icon]{--univer-tw-text-opacity:1;color:rgba(139,92,246,var(--univer-tw-text-opacity,1))}.\\[\\&_\\[data-icon\\]\\]\\:univer-text-yellow-500 [data-icon]{color:var(--univer-yellow-500)}.\\[\\&_\\[data-sonner-toast\\]\\]\\:univer-rounded-2xl [data-sonner-toast]{border-radius:1rem}.\\[\\&_\\[data-sonner-toast\\]\\]\\:univer-border [data-sonner-toast]{border-width:1px}.\\[\\&_\\[data-sonner-toast\\]\\]\\:univer-border-solid [data-sonner-toast]{border-style:solid}.\\[\\&_\\[data-sonner-toast\\]\\]\\:univer-border-gray-200 [data-sonner-toast]{border-color:var(--univer-gray-200)}.\\[\\&_\\[data-sonner-toast\\]\\]\\:univer-shadow-\\[0_16px_40px_-20px_rgba\\(15\\,23\\,42\\,0\\.55\\)\\] [data-sonner-toast]{--univer-tw-shadow:0 16px 40px -20px #0f172a8c;--univer-tw-shadow-colored:0 16px 40px -20px var(--univer-tw-shadow-color);box-shadow:0 0 #0000,0 0 #0000,0 16px 40px -20px #0f172a8c;box-shadow:var(--univer-tw-ring-offset-shadow,0 0 #0000),var(--univer-tw-ring-shadow,0 0 #0000),var(--univer-tw-shadow)}.\\[\\&_\\[data-sonner-toast\\]\\]\\:univer-shadow-md [data-sonner-toast]{--univer-tw-shadow:0px 1px 6px -2px #1e284d14, 0px 2px 6px -1px #1e284d1a;--univer-tw-shadow-colored:0px 1px 6px -2px var(--univer-tw-shadow-color), 0px 2px 6px -1px var(--univer-tw-shadow-color);box-shadow:0 0 #0000,0 0 #0000,0 1px 6px -2px #1e284d14,0 2px 6px -1px #1e284d1a;box-shadow:var(--univer-tw-ring-offset-shadow,0 0 #0000),var(--univer-tw-ring-shadow,0 0 #0000),var(--univer-tw-shadow)}.\\[\\&_\\[data-sonner-toast\\]\\]\\:univer-backdrop-blur-sm [data-sonner-toast]{--univer-tw-backdrop-blur:blur(4px);-webkit-backdrop-filter:var(--univer-tw-backdrop-blur) var(--univer-tw-backdrop-brightness) var(--univer-tw-backdrop-contrast) var(--univer-tw-backdrop-grayscale) var(--univer-tw-backdrop-hue-rotate) var(--univer-tw-backdrop-invert) var(--univer-tw-backdrop-opacity) var(--univer-tw-backdrop-saturate) var(--univer-tw-backdrop-sepia);backdrop-filter:var(--univer-tw-backdrop-blur) var(--univer-tw-backdrop-brightness) var(--univer-tw-backdrop-contrast) var(--univer-tw-backdrop-grayscale) var(--univer-tw-backdrop-hue-rotate) var(--univer-tw-backdrop-invert) var(--univer-tw-backdrop-opacity) var(--univer-tw-backdrop-saturate) var(--univer-tw-backdrop-sepia)}.dark\\:\\[\\&_\\[data-sonner-toast\\]\\]\\:\\!univer-border-gray-600 [data-sonner-toast]:where(.univer-dark,.univer-dark *){border-color:var(--univer-gray-600)!important}.\\[\\&_\\[data-title\\]\\]\\:univer-text-sm [data-title]{font-size:.875rem;line-height:1.25rem}.\\[\\&_\\[data-title\\]\\]\\:univer-text-gray-900 [data-title]{color:var(--univer-gray-900)}.\\[\\&_\\[data-u-comp\\=form-layout\\]\\]\\:univer-max-w-\\[calc\\(50\\%-8px\\)\\] [data-u-comp=form-layout]{max-width:calc(50% - 8px)}.\\[\\&_\\[data-u-comp\\=form-layout\\]\\]\\:univer-shrink [data-u-comp=form-layout]{flex-shrink:1}.\\[\\&_\\[data-u-comp\\=form-layout\\]\\]\\:univer-grow [data-u-comp=form-layout]{flex-grow:1}.\\[\\&_\\[data-u-comp\\=input\\]\\]\\:univer-w-full [data-u-comp=input]{width:100%}.\\[\\&_\\[data-u-comp\\=input\\]\\]\\:univer-border-red-500 [data-u-comp=input]{border-color:var(--univer-red-500)}.\\[\\&_\\[data-u-comp\\=pager-left-arrow\\]\\:hover\\]\\:\\!univer-bg-gray-600 [data-u-comp=pager-left-arrow]:hover,.\\[\\&_\\[data-u-comp\\=pager-right-arrow\\]\\:hover\\]\\:\\!univer-bg-gray-600 [data-u-comp=pager-right-arrow]:hover{background-color:var(--univer-gray-600)!important}.\\[\\&_\\[data-u-comp\\=select\\]\\]\\:univer-w-full [data-u-comp=select]{width:100%}.\\[\\&_\\[data-u-comp\\=select\\]\\]\\:univer-border-red-500 [data-u-comp=select]{border-color:var(--univer-red-500)}.\\[\\&_input\\]\\:univer-box-border input{box-sizing:border-box}.\\[\\&_input\\]\\:univer-flex input{display:flex}.\\[\\&_input\\]\\:univer-h-7 input{height:1.75rem}.\\[\\&_input\\]\\:univer-items-center input{align-items:center}.\\[\\&_input\\]\\:univer-rounded input{border-radius:.25rem}.\\[\\&_input\\]\\:univer-border input{border-width:1px}.\\[\\&_input\\]\\:univer-border-solid input{border-style:solid}.\\[\\&_input\\]\\:univer-border-gray-200 input{border-color:var(--univer-gray-200)}.\\[\\&_input\\]\\:univer-border-gray-600 input{border-color:var(--univer-gray-600)}.\\[\\&_input\\]\\:univer-bg-transparent input{background-color:#0000}.\\[\\&_input\\]\\:univer-px-1\\.5 input{padding-left:.375rem;padding-right:.375rem}.\\[\\&_input\\]\\:univer-text-gray-700 input{color:var(--univer-gray-700)}.\\[\\&_input\\]\\:univer-text-white input{color:var(--univer-white)}.\\[\\&_input\\]\\:univer-outline-none input{outline-offset:2px;outline:2px solid #0000}.\\[\\&_svg\\]\\:univer-pointer-events-none svg{pointer-events:none}.\\[\\&_svg\\]\\:univer-size-4 svg{width:1rem;height:1rem}.\\[\\&_svg\\]\\:univer-shrink-0 svg{flex-shrink:0}.univer-popup{z-index:1070;--univer-tw-shadow:0 1px 3px 0 #0000001a, 0 1px 2px -1px #0000001a;--univer-tw-shadow-colored:0 1px 3px 0 var(--univer-tw-shadow-color), 0 1px 2px -1px var(--univer-tw-shadow-color);box-shadow:0 0 #0000,0 0 #0000,0 1px 3px #0000001a,0 1px 2px -1px #0000001a;box-shadow:var(--univer-tw-ring-offset-shadow,0 0 #0000),var(--univer-tw-ring-shadow,0 0 #0000),var(--univer-tw-shadow);border-radius:6px;position:fixed;top:-9999px;left:-9999px;overflow:hidden}.univer-popup-enter{transform-origin:0 0;opacity:0;animation-duration:.15s;animation-timing-function:cubic-bezier(.08,.82,.17,1);animation-play-state:paused;animation-fill-mode:both}.univer-popup-enter-active{animation-name:popup-slide-up-in;animation-play-state:running}.univer-popup-exit{transform-origin:0 0;opacity:1;animation-name:popup-slide-up-out;animation-duration:.15s;animation-timing-function:cubic-bezier(.6,.04,.98,.34);animation-play-state:running;animation-fill-mode:both}.univer-popup-exit-active{display:none}.univer-popup-mask{z-index:1060;position:fixed;inset:0}.univer-pointer-events-auto{pointer-events:auto}.univer-invisible{visibility:hidden}.univer-sticky{position:sticky}.-univer-left-\\[99999\\]{left:-99999px}.-univer-top-\\[99999\\]{top:-99999px}.univer-left-1\\/2{left:50%}.univer-left-\\[-9999px\\]{left:-9999px}.univer-right-2{right:.5rem}.univer-top-\\[-9999px\\]{top:-9999px}.univer-top-\\[calc\\(50\\%-6px\\)\\]{top:calc(50% - 6px)}.univer-z-20{z-index:20}.univer-z-\\[-1\\]{z-index:-1}.univer-z-\\[1020\\]{z-index:1020}.univer-z-\\[1080\\]{z-index:1080}.univer-z-\\[1\\]{z-index:1}.univer-mx-2{margin-left:.5rem;margin-right:.5rem}.univer-mx-auto{margin-left:auto;margin-right:auto}.univer-line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.\\!univer-size-3\\.5{width:.875rem!important;height:.875rem!important}.univer-size-12{width:3rem;height:3rem}.univer-size-3\\.5{width:.875rem;height:.875rem}.univer-size-7{width:1.75rem;height:1.75rem}.univer-size-9{width:2.25rem;height:2.25rem}.univer-h-0{height:0}.univer-max-h-\\[80vh\\]{max-height:80vh}.univer-max-h-\\[min\\(72vh\\,560px\\)\\]{max-height:min(72vh,560px)}.univer-min-h-\\[560px\\]{min-height:560px}.univer-min-h-\\[56px\\]{min-height:56px}.univer-w-0{width:0}.univer-w-1{width:.25rem}.univer-w-10{width:2.5rem}.univer-w-40{width:10rem}.univer-w-7{width:1.75rem}.univer-w-8{width:2rem}.univer-w-96{width:24rem}.univer-w-max{width:max-content}.univer-w-screen{width:100vw}.univer-min-w-52{min-width:13rem}.univer-min-w-6{min-width:1.5rem}.univer-min-w-min{min-width:min-content}.univer-max-w-3xl{max-width:48rem}.univer-max-w-5xl{max-width:64rem}.univer-max-w-96{max-width:24rem}.univer-max-w-\\[--radix-popper-available-width\\]{max-width:var(--radix-popper-available-width)}.univer-max-w-\\[32\\%\\]{max-width:32%}.univer-max-w-\\[560px\\]{max-width:560px}.univer-max-w-\\[calc\\(100vw-16px\\)\\]{max-width:calc(100vw - 16px)}.univer-max-w-full{max-width:100%}.univer-origin-center{transform-origin:50%}.-univer-translate-x-1\\/2{--univer-tw-translate-x:-50%;transform:translate(-50%,var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y));transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y))}.univer-translate-x-0{--univer-tw-translate-x:0px;transform:translateY(var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y));transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y))}.univer-translate-x-full{--univer-tw-translate-x:100%;transform:translate(100%,var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y));transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y))}.univer-cursor-col-resize{cursor:col-resize}.univer-grid-cols-\\[1fr\\]{grid-template-columns:1fr}.univer-grid-cols-\\[22px_minmax\\(0\\,1fr\\)_22px\\]{grid-template-columns:22px minmax(0,1fr) 22px}.univer-grid-cols-\\[28px_minmax\\(0\\,1fr\\)_auto\\]{grid-template-columns:28px minmax(0,1fr) auto}.univer-grid-cols-\\[32px_minmax\\(0\\,1fr\\)_32px\\]{grid-template-columns:32px minmax(0,1fr) 32px}.univer-grid-cols-\\[auto\\,1fr\\]{grid-template-columns:auto 1fr}.univer-grid-cols-\\[auto_1fr_auto\\]{grid-template-columns:auto 1fr auto}.univer-grid-rows-\\[100\\%\\]{grid-template-rows:100%}.univer-grid-rows-\\[auto_1fr\\]{grid-template-rows:auto 1fr}.univer-grid-rows-\\[auto_1fr_auto\\]{grid-template-rows:auto 1fr auto}.univer-flex-wrap{flex-wrap:wrap}.univer-items-end{align-items:flex-end}.univer-gap-0\\.5{gap:.125rem}.univer-overscroll-contain{overscroll-behavior:contain}.univer-scroll-smooth{scroll-behavior:smooth}.\\!univer-rounded-full{border-radius:9999px!important}.\\!univer-rounded-xl{border-radius:.75rem!important}.univer-rounded-2xl{border-radius:1rem}.univer-rounded-3xl{border-radius:1.5rem}.univer-rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.univer-rounded-t-\\[28px\\]{border-top-left-radius:28px;border-top-right-radius:28px}.univer-border-0{border-width:0}.\\!univer-bg-gray-200{background-color:var(--univer-gray-200)!important}.\\!univer-bg-gray-500{background-color:var(--univer-gray-500)!important}.univer-bg-\\[rgba\\(15\\,23\\,42\\,0\\.32\\)\\]{background-color:#0f172a52}.univer-bg-gray-700{background-color:var(--univer-gray-700)}.univer-bg-gradient-to-tr{background-image:linear-gradient(to top right,var(--univer-tw-gradient-stops))}.univer-from-slate-950{--univer-tw-gradient-from:#020617 var(--univer-tw-gradient-from-position);--univer-tw-gradient-to:#02061700 var(--univer-tw-gradient-to-position);--univer-tw-gradient-stops:var(--univer-tw-gradient-from), var(--univer-tw-gradient-to)}.univer-via-blue-950{--univer-tw-gradient-to:#17255400 var(--univer-tw-gradient-to-position);--univer-tw-gradient-stops:var(--univer-tw-gradient-from), #172554 var(--univer-tw-gradient-via-position), var(--univer-tw-gradient-to)}.univer-to-cyan-900{--univer-tw-gradient-to:#164e63 var(--univer-tw-gradient-to-position)}.univer-p-8{padding:2rem}.univer-px-0{padding-left:0;padding-right:0}.univer-px-0\\.5{padding-left:.125rem;padding-right:.125rem}.univer-px-3{padding-left:.75rem;padding-right:.75rem}.univer-pb-2{padding-bottom:.5rem}.univer-pl-2{padding-left:.5rem}.univer-pl-4{padding-left:1rem}.univer-pr-1\\.5{padding-right:.375rem}.univer-text-right{text-align:right}.univer-font-sans{font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.univer-text-2xl{font-size:1.5rem;line-height:2rem}.univer-uppercase{text-transform:uppercase}.univer-leading-4{line-height:1rem}.univer-leading-none{line-height:1}.univer-tracking-\\[0\\.08em\\]{letter-spacing:.08em}.univer-tracking-tight{letter-spacing:-.025em}.\\!univer-text-gray-600{color:var(--univer-gray-600)!important}.univer-text-current{color:currentColor}.univer-text-slate-200{--univer-tw-text-opacity:1;color:rgba(226,232,240,var(--univer-tw-text-opacity,1))}.univer-underline{text-decoration-line:underline}.univer-opacity-0{opacity:0}.univer-opacity-30{opacity:.3}.univer-opacity-40{opacity:.4}.univer-opacity-60{opacity:.6}.univer-shadow-\\[0_-16px_48px_rgba\\(15\\,23\\,42\\,0\\.18\\)\\]{--univer-tw-shadow:0 -16px 48px #0f172a2e;--univer-tw-shadow-colored:0 -16px 48px var(--univer-tw-shadow-color);box-shadow:0 0 #0000,0 0 #0000,0 -16px 48px #0f172a2e;box-shadow:var(--univer-tw-ring-offset-shadow,0 0 #0000),var(--univer-tw-ring-shadow,0 0 #0000),var(--univer-tw-shadow)}.univer-ring-0{--univer-tw-ring-offset-shadow:var(--univer-tw-ring-inset) 0 0 0 var(--univer-tw-ring-offset-width) var(--univer-tw-ring-offset-color);--univer-tw-ring-shadow:var(--univer-tw-ring-inset) 0 0 0 calc(0px + var(--univer-tw-ring-offset-width)) var(--univer-tw-ring-color);box-shadow:var(--univer-tw-ring-offset-shadow),var(--univer-tw-ring-shadow),0 0 #0000;box-shadow:var(--univer-tw-ring-offset-shadow),var(--univer-tw-ring-shadow),var(--univer-tw-shadow,0 0 #0000)}.univer-ring-primary-600{--univer-tw-ring-color:var(--univer-primary-600)}.univer-backdrop-blur-\\[2px\\]{--univer-tw-backdrop-blur:blur(2px);-webkit-backdrop-filter:var(--univer-tw-backdrop-blur) var(--univer-tw-backdrop-brightness) var(--univer-tw-backdrop-contrast) var(--univer-tw-backdrop-grayscale) var(--univer-tw-backdrop-hue-rotate) var(--univer-tw-backdrop-invert) var(--univer-tw-backdrop-opacity) var(--univer-tw-backdrop-saturate) var(--univer-tw-backdrop-sepia);backdrop-filter:var(--univer-tw-backdrop-blur) var(--univer-tw-backdrop-brightness) var(--univer-tw-backdrop-contrast) var(--univer-tw-backdrop-grayscale) var(--univer-tw-backdrop-hue-rotate) var(--univer-tw-backdrop-invert) var(--univer-tw-backdrop-opacity) var(--univer-tw-backdrop-saturate) var(--univer-tw-backdrop-sepia)}.univer-backdrop-blur-xl{--univer-tw-backdrop-blur:blur(24px);-webkit-backdrop-filter:var(--univer-tw-backdrop-blur) var(--univer-tw-backdrop-brightness) var(--univer-tw-backdrop-contrast) var(--univer-tw-backdrop-grayscale) var(--univer-tw-backdrop-hue-rotate) var(--univer-tw-backdrop-invert) var(--univer-tw-backdrop-opacity) var(--univer-tw-backdrop-saturate) var(--univer-tw-backdrop-sepia);backdrop-filter:var(--univer-tw-backdrop-blur) var(--univer-tw-backdrop-brightness) var(--univer-tw-backdrop-contrast) var(--univer-tw-backdrop-grayscale) var(--univer-tw-backdrop-hue-rotate) var(--univer-tw-backdrop-invert) var(--univer-tw-backdrop-opacity) var(--univer-tw-backdrop-saturate) var(--univer-tw-backdrop-sepia)}.univer-transition-\\[width\\]{transition-property:width;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.univer-animate-in{--univer-tw-enter-opacity:initial;--univer-tw-enter-scale:initial;--univer-tw-enter-rotate:initial;--univer-tw-enter-translate-x:initial;--univer-tw-enter-translate-y:initial;animation-name:enter;animation-duration:.15s}.univer-fade-in{--univer-tw-enter-opacity:0}.univer-fade-in-70{--univer-tw-enter-opacity:.7}.last\\:univer-border-b-0:last-child{border-bottom-width:0}.empty\\:univer-hidden:empty{display:none}.hover\\:univer-opacity-50:hover{opacity:.5}.focus\\:univer-bg-white:focus{background-color:var(--univer-white)}.focus\\:univer-ring-2:focus{--univer-tw-ring-offset-shadow:var(--univer-tw-ring-inset) 0 0 0 var(--univer-tw-ring-offset-width) var(--univer-tw-ring-offset-color);--univer-tw-ring-shadow:var(--univer-tw-ring-inset) 0 0 0 calc(2px + var(--univer-tw-ring-offset-width)) var(--univer-tw-ring-color);box-shadow:var(--univer-tw-ring-offset-shadow),var(--univer-tw-ring-shadow),0 0 #0000;box-shadow:var(--univer-tw-ring-offset-shadow),var(--univer-tw-ring-shadow),var(--univer-tw-shadow,0 0 #0000)}.focus-visible\\:univer-ring-primary-600:focus-visible{--univer-tw-ring-color:var(--univer-primary-600)}.focus-visible\\:univer-ring-offset-0:focus-visible{--univer-tw-ring-offset-width:0px}.active\\:univer-bg-gray-200:active{background-color:var(--univer-gray-200)}.enabled\\:hover\\:univer-bg-gray-50:hover:enabled{background-color:var(--univer-gray-50)}.enabled\\:active\\:univer-bg-gray-100:active:enabled{background-color:var(--univer-gray-100)}.disabled\\:univer-text-gray-300:disabled{color:var(--univer-gray-300)}.disabled\\:hover\\:univer-bg-transparent:hover:disabled{background-color:#0000}@media (width>=640px){.sm\\:\\!univer-block{display:block!important}}.rtl\\:univer-pl-1\\.5:where([dir=rtl],[dir=rtl] *){padding-left:.375rem}.rtl\\:univer-pr-0:where([dir=rtl],[dir=rtl] *){padding-right:0}.rtl\\:univer-pr-2:where([dir=rtl],[dir=rtl] *){padding-right:.5rem}.dark\\:\\!univer-bg-gray-200:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-200)!important}.dark\\:\\!univer-bg-primary-400:where(.univer-dark,.univer-dark *){background-color:var(--univer-primary-400)!important}.dark\\:\\!univer-text-gray-600:where(.univer-dark,.univer-dark *){color:var(--univer-gray-600)!important}.dark\\:\\!univer-text-gray-800:where(.univer-dark,.univer-dark *){color:var(--univer-gray-800)!important}.dark\\:\\!univer-text-primary-100:where(.univer-dark,.univer-dark *){color:var(--univer-primary-100)!important}.dark\\:\\!univer-text-primary-400:where(.univer-dark,.univer-dark *){color:var(--univer-primary-400)!important}.dark\\:hover\\:\\!univer-bg-transparent:hover:where(.univer-dark,.univer-dark *){background-color:#0000!important}.dark\\:active\\:\\!univer-bg-gray-600:active:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-600)!important}.dark\\:disabled\\:\\!univer-text-gray-600:disabled:where(.univer-dark,.univer-dark *){color:var(--univer-gray-600)!important}.\\[\\&\\:\\:-webkit-scrollbar\\]\\:univer-hidden::-webkit-scrollbar{display:none}.\\[\\&\\>\\*\\]\\:univer-m-0>*{margin:0}.\\[\\&\\>\\*\\]\\:univer-inline-flex>*{display:inline-flex}.\\[\\&\\>\\*\\]\\:univer-h-6>*{height:1.5rem}.\\[\\&\\>\\*\\]\\:univer-min-h-7>*{min-height:1.75rem}.\\[\\&\\>\\*\\]\\:univer-min-w-7>*{min-width:1.75rem}.\\[\\&\\>\\*\\]\\:univer-appearance-none>*{appearance:none}.\\[\\&\\>\\*\\]\\:univer-items-center>*{align-items:center}.\\[\\&\\>\\*\\]\\:univer-justify-center>*{justify-content:center}.\\[\\&\\>\\*\\]\\:univer-rounded>*{border-radius:.25rem}.\\[\\&\\>\\*\\]\\:univer-rounded-md>*{border-radius:.375rem}.\\[\\&\\>\\*\\]\\:univer-border-0>*{border-width:0}.\\[\\&\\>\\*\\]\\:univer-px-1>*{padding-left:.25rem;padding-right:.25rem}.\\[\\&\\>\\*\\]\\:univer-px-1\\.5>*{padding-left:.375rem;padding-right:.375rem}.\\[\\&\\>\\*\\]\\:univer-leading-none>*{line-height:1}.\\[\\&\\>\\*\\]\\:univer-outline-none>*{outline-offset:2px;outline:2px solid #0000}.\\[\\&\\>\\*\\]\\:univer-transition-colors>*{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.hover\\:\\[\\&\\>\\*\\]\\:univer-bg-gray-100>:hover{background-color:var(--univer-gray-100)}.\\[\\&\\>span\\]\\:univer-truncate>span{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.\\[\\&\\>span\\]\\:univer-text-sm>span{font-size:.875rem;line-height:1.25rem}.\\[\\&\\>span\\]\\:univer-font-medium>span{font-weight:500}.\\[\\&\\>svg\\]\\:univer-shrink-0>svg{flex-shrink:0}.\\[\\&\\>svg\\]\\:univer-text-lg>svg{font-size:1.125rem;line-height:1.75rem}.\\[\\&\\>svg\\]\\:univer-text-gray-700>svg{color:var(--univer-gray-700)}.\\[\\&_\\*\\]\\:univer-box-border *{box-sizing:border-box}.\\[\\&_\\.univer-custom-label\\]\\:univer-text-sm .univer-custom-label{font-size:.875rem;line-height:1.25rem}.\\[\\&_\\.univer-custom-label\\]\\:univer-leading-none .univer-custom-label{line-height:1}.\\[\\&_\\.univer-toolbar-button-selector-main\\]\\:\\!univer-h-8 .univer-toolbar-button-selector-main{height:2rem!important}.\\[\\&_\\.univer-toolbar-button-selector-main\\]\\:\\!univer-rounded-none .univer-toolbar-button-selector-main{border-radius:0!important}.\\[\\&_\\.univer-toolbar-button-selector-main\\]\\:\\!univer-rounded-l-md .univer-toolbar-button-selector-main{border-top-left-radius:.375rem!important;border-bottom-left-radius:.375rem!important}.\\[\\&_\\.univer-toolbar-button-selector-main\\]\\:\\!univer-px-1\\.5 .univer-toolbar-button-selector-main{padding-left:.375rem!important;padding-right:.375rem!important}.\\[\\&_\\.univer-toolbar-button-selector-root\\]\\:\\!univer-h-8 .univer-toolbar-button-selector-root{height:2rem!important}.\\[\\&_\\.univer-toolbar-button-selector-root\\]\\:univer-overflow-hidden .univer-toolbar-button-selector-root{overflow:hidden}.\\[\\&_\\.univer-toolbar-button-selector-root\\]\\:\\!univer-rounded-md .univer-toolbar-button-selector-root{border-radius:.375rem!important}.\\[\\&_\\.univer-toolbar-button-selector-root\\]\\:\\!univer-pr-0 .univer-toolbar-button-selector-root{padding-right:0!important}.\\[\\&_\\.univer-toolbar-button-selector-trigger\\]\\:\\!univer-static .univer-toolbar-button-selector-trigger{position:static!important}.\\[\\&_\\.univer-toolbar-button-selector-trigger\\]\\:\\!univer-h-8 .univer-toolbar-button-selector-trigger{height:2rem!important}.\\[\\&_\\.univer-toolbar-button-selector-trigger\\]\\:\\!univer-w-6 .univer-toolbar-button-selector-trigger{width:1.5rem!important}.\\[\\&_\\.univer-toolbar-button-selector-trigger\\]\\:\\!univer-rounded-none .univer-toolbar-button-selector-trigger{border-radius:0!important}.\\[\\&_\\.univer-toolbar-button-selector-trigger\\]\\:\\!univer-rounded-r-md .univer-toolbar-button-selector-trigger{border-top-right-radius:.375rem!important;border-bottom-right-radius:.375rem!important}.\\[\\&_\\.univer-toolbar-selector-root\\]\\:\\!univer-h-8 .univer-toolbar-selector-root{height:2rem!important}.\\[\\&_\\.univer-toolbar-selector-root\\]\\:\\!univer-gap-1 .univer-toolbar-selector-root{gap:.25rem!important}.\\[\\&_\\.univer-toolbar-selector-root\\]\\:\\!univer-rounded-md .univer-toolbar-selector-root{border-radius:.375rem!important}.\\[\\&_\\.univer-toolbar-selector-root\\]\\:\\!univer-px-1\\.5 .univer-toolbar-selector-root{padding-left:.375rem!important;padding-right:.375rem!important}.\\[\\&_\\.univer-toolbar-selector-trigger\\]\\:\\!univer-pl-0\\.5 .univer-toolbar-selector-trigger{padding-left:.125rem!important}.\\[\\&_\\.univer-tooltip\\]\\:univer-inline-flex .univer-tooltip{display:inline-flex}.\\[\\&_\\.univer-tooltip\\]\\:univer-h-full .univer-tooltip{height:100%}.\\[\\&_\\.univer-tooltip\\]\\:univer-items-center .univer-tooltip{align-items:center}.\\[\\&_\\[data-u-command\\]\\]\\:\\!univer-h-8 [data-u-command]{height:2rem!important}.\\[\\&_\\[data-u-command\\]\\]\\:\\!univer-min-h-8 [data-u-command]{min-height:2rem!important}.\\[\\&_\\[data-u-command\\]\\]\\:\\!univer-rounded-md [data-u-command]{border-radius:.375rem!important}.\\[\\&_\\[data-u-command\\]\\]\\:\\!univer-px-1\\.5 [data-u-command]{padding-left:.375rem!important;padding-right:.375rem!important}.\\[\\&_button\\]\\:\\!univer-m-0 button{margin:0!important}.\\[\\&_button\\]\\:\\!univer-h-8 button{height:2rem!important}.\\[\\&_button\\]\\:\\!univer-min-w-8 button{min-width:2rem!important}.\\[\\&_button\\]\\:\\!univer-appearance-none button{appearance:none!important}.\\[\\&_button\\]\\:\\!univer-rounded-md button{border-radius:.375rem!important}.\\[\\&_button\\]\\:\\!univer-border-0 button{border-width:0!important}.\\[\\&_button\\]\\:\\!univer-bg-transparent button{background-color:#0000!important}.\\[\\&_button\\]\\:\\!univer-p-0 button{padding:0!important}.\\[\\&_button\\]\\:\\!univer-px-1\\.5 button{padding-left:.375rem!important;padding-right:.375rem!important}.\\[\\&_button\\]\\:\\!univer-leading-none button{line-height:1!important}.\\[\\&_button\\]\\:\\!univer-outline-none button{outline-offset:2px!important;outline:2px solid #0000!important}.\\[\\&_input\\:focus\\]\\:\\!univer-ring-0 input:focus{--univer-tw-ring-offset-shadow:var(--univer-tw-ring-inset) 0 0 0 var(--univer-tw-ring-offset-width) var(--univer-tw-ring-offset-color)!important;--univer-tw-ring-shadow:var(--univer-tw-ring-inset) 0 0 0 calc(0px + var(--univer-tw-ring-offset-width)) var(--univer-tw-ring-color)!important;box-shadow:var(--univer-tw-ring-offset-shadow),var(--univer-tw-ring-shadow),0 0 #0000!important;box-shadow:var(--univer-tw-ring-offset-shadow),var(--univer-tw-ring-shadow),var(--univer-tw-shadow,0 0 #0000)!important}.\\[\\&_input\\]\\:\\!univer-m-0 input{margin:0!important}.\\[\\&_input\\]\\:univer-h-6 input{height:1.5rem}.\\[\\&_input\\]\\:univer-w-7 input{width:1.75rem}.\\[\\&_input\\]\\:\\!univer-appearance-none input{appearance:none!important}.\\[\\&_input\\]\\:\\!univer-border-0 input{border-width:0!important}.\\[\\&_input\\]\\:univer-border-none input{border-style:none}.\\[\\&_input\\]\\:\\!univer-bg-transparent input{background-color:#0000!important}.\\[\\&_input\\]\\:\\!univer-p-0 input{padding:0!important}.\\[\\&_input\\]\\:univer-p-0 input{padding:0}.\\[\\&_input\\]\\:univer-text-sm input{font-size:.875rem;line-height:1.25rem}.\\[\\&_input\\]\\:\\!univer-leading-none input{line-height:1!important}.\\[\\&_input\\]\\:\\!univer-outline-none input{outline-offset:2px!important;outline:2px solid #0000!important}.univer-fixed{position:fixed}.univer-bottom-0{bottom:0}.univer-left-5{left:1.25rem}.univer-left-\\[5px\\]{left:5px}.univer-top-4{top:1rem}.univer-top-\\[5px\\]{top:5px}.univer-z-\\[10000\\]{z-index:10000}.univer-mr-1{margin-right:.25rem}.univer-mt-1\\.5{margin-top:.375rem}.univer-mt-12{margin-top:3rem}.univer-size-0\\.5{width:.125rem;height:.125rem}.univer-size-8{width:2rem;height:2rem}.univer-h-16{height:4rem}.univer-h-\\[24px\\]{height:24px}.univer-min-h-8{min-height:2rem}.univer-w-2{width:.5rem}.univer-w-2\\.5{width:.625rem}.univer-w-28{width:7rem}.univer-w-4\\/5{width:80%}.univer-w-\\[0px\\]{width:0}.univer-w-\\[212px\\]{width:212px}.univer-w-\\[72px\\]{width:72px}.univer-min-w-\\[180px\\]{min-width:180px}.univer-cursor-grab{cursor:grab}.univer-grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.univer-place-items-center{place-items:center}.univer-items-stretch{align-items:stretch}.univer-gap-2\\.5{gap:.625rem}.univer-gap-x-0\\.5{-moz-column-gap:.125rem;column-gap:.125rem}.univer-gap-y-px{row-gap:1px}.univer-rounded-r-2xl{border-top-right-radius:1rem;border-bottom-right-radius:1rem}.\\!univer-border-primary-500{border-color:var(--univer-primary-500)!important}.univer-border-primary-500{border-color:var(--univer-primary-500)}.\\!univer-bg-primary-50{background-color:var(--univer-primary-50)!important}.\\!univer-bg-primary-900{background-color:var(--univer-primary-900)!important}.univer-bg-gray-400{background-color:var(--univer-gray-400)}.univer-px-2\\.5{padding-left:.625rem;padding-right:.625rem}.univer-pb-0\\.5{padding-bottom:.125rem}.univer-pb-4{padding-bottom:1rem}.univer-pr-1{padding-right:.25rem}.univer-pt-1\\.5{padding-top:.375rem}.univer-pt-14{padding-top:3.5rem}.univer-text-lg{font-size:1.125rem;line-height:1.75rem}.univer-font-\\[500\\],.univer-font-medium{font-weight:500}.univer-font-normal{font-weight:400}.univer-leading-\\[24px\\]{line-height:24px}.\\!univer-text-gray-200{color:var(--univer-gray-200)!important}.\\!univer-text-gray-400{color:var(--univer-gray-400)!important}.\\!univer-text-primary-600{color:var(--univer-primary-600)!important}.univer-text-gray-800{color:var(--univer-gray-800)}.univer-backdrop-blur-\\[10px\\]{--univer-tw-backdrop-blur:blur(10px);-webkit-backdrop-filter:var(--univer-tw-backdrop-blur) var(--univer-tw-backdrop-brightness) var(--univer-tw-backdrop-contrast) var(--univer-tw-backdrop-grayscale) var(--univer-tw-backdrop-hue-rotate) var(--univer-tw-backdrop-invert) var(--univer-tw-backdrop-opacity) var(--univer-tw-backdrop-saturate) var(--univer-tw-backdrop-sepia);backdrop-filter:var(--univer-tw-backdrop-blur) var(--univer-tw-backdrop-brightness) var(--univer-tw-backdrop-contrast) var(--univer-tw-backdrop-grayscale) var(--univer-tw-backdrop-hue-rotate) var(--univer-tw-backdrop-invert) var(--univer-tw-backdrop-opacity) var(--univer-tw-backdrop-saturate) var(--univer-tw-backdrop-sepia)}.univer-duration-300{transition-duration:.3s}.univer-group:hover .group-hover\\:univer-bg-gray-500{background-color:var(--univer-gray-500)}.hover\\:univer-border-primary-500:hover{border-color:var(--univer-primary-500)}.hover\\:univer-bg-white:hover{background-color:var(--univer-white)}.hover\\:univer-text-gray-900:hover{color:var(--univer-gray-900)}.hover\\:univer-text-primary-600:hover{color:var(--univer-primary-600)}.hover\\:univer-shadow-md:hover{--univer-tw-shadow:0px 1px 6px -2px #1e284d14, 0px 2px 6px -1px #1e284d1a;--univer-tw-shadow-colored:0px 1px 6px -2px var(--univer-tw-shadow-color), 0px 2px 6px -1px var(--univer-tw-shadow-color);box-shadow:0 0 #0000,0 0 #0000,0 1px 6px -2px #1e284d14,0 2px 6px -1px #1e284d1a;box-shadow:var(--univer-tw-ring-offset-shadow,0 0 #0000),var(--univer-tw-ring-shadow,0 0 #0000),var(--univer-tw-shadow)}.active\\:univer-cursor-grabbing:active{cursor:grabbing}.dark\\:\\!univer-bg-gray-500:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-500)!important}.dark\\:\\!univer-bg-primary-900:where(.univer-dark,.univer-dark *){background-color:var(--univer-primary-900)!important}.univer-group:hover .dark\\:group-hover\\:\\!univer-bg-gray-300:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-300)!important}.univer-pointer-events-none{pointer-events:none}.univer-inset-0{inset:0}.-univer-left-0\\.5{left:-.125rem}.-univer-top-0\\.5{top:-.125rem}.univer-left-1{left:.25rem}.univer-left-3{left:.75rem}.univer-right-5{right:1.25rem}.univer-top-0\\.5{top:.125rem}.univer-z-10{z-index:10}.univer-z-\\[1001\\]{z-index:1001}.univer-z-\\[100\\]{z-index:100}.univer-mx-1\\.5{margin-left:.375rem;margin-right:.375rem}.univer-mb-1\\.5{margin-bottom:.375rem}.univer-ml-6{margin-left:1.5rem}.univer-ml-px{margin-left:1px}.univer-mr-5{margin-right:1.25rem}.univer-mt-auto{margin-top:auto}.univer-size-0{width:0;height:0}.univer-size-10{width:2.5rem;height:2.5rem}.univer-h-0\\.5{height:.125rem}.univer-h-1{height:.25rem}.univer-h-10{height:2.5rem}.univer-h-20{height:5rem}.univer-h-60{height:15rem}.univer-h-9{height:2.25rem}.univer-h-\\[270px\\]{height:270px}.univer-h-\\[30px\\]{height:30px}.univer-h-\\[calc\\(100\\%-16px\\)\\]{height:calc(100% - 16px)}.univer-h-\\[calc\\(100\\%-8px\\)\\]{height:calc(100% - 8px)}.univer-h-px{height:1px}.univer-max-h-52{max-height:13rem}.univer-max-h-\\[100px\\]{max-height:100px}.univer-max-h-\\[360px\\]{max-height:360px}.univer-min-h-0{min-height:0}.univer-min-h-\\[30px\\]{min-height:30px}.\\!univer-w-\\[90px\\]{width:90px!important}.univer-w-16{width:4rem}.univer-w-20{width:5rem}.univer-w-24{width:6rem}.univer-w-5{width:1.25rem}.univer-w-60{width:15rem}.univer-w-\\[100px\\]{width:100px}.univer-w-\\[130px\\]{width:130px}.univer-w-\\[156px\\]{width:156px}.univer-w-\\[300px\\]{width:300px}.univer-w-\\[50\\%\\]{width:50%}.univer-w-fit{width:fit-content}.univer-min-w-0{min-width:0}.univer-min-w-72{min-width:18rem}.univer-max-w-32{max-width:8rem}.univer-max-w-36{max-width:9rem}.univer-max-w-64{max-width:16rem}.univer-max-w-\\[190px\\]{max-width:190px}.univer-max-w-\\[200px\\]{max-width:200px}.univer-max-w-\\[calc\\(100\\%-112px\\)\\]{max-width:calc(100% - 112px)}.univer-max-w-fit{max-width:fit-content}.univer-max-w-lg{max-width:32rem}.univer-flex-shrink-0,.univer-shrink-0{flex-shrink:0}.univer-rotate-180{--univer-tw-rotate:180deg;transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(180deg) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y));transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y))}.univer-animate-spin{animation:1s linear infinite univer-spin}.univer-cursor-not-allowed{cursor:not-allowed}.univer-appearance-none{appearance:none}.univer-grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.univer-grid-cols-\\[1fr\\,auto\\,auto\\,auto\\]{grid-template-columns:1fr auto auto auto}.univer-flex-row-reverse{flex-direction:row-reverse}.univer-gap-7{gap:1.75rem}.univer-gap-x-2{-moz-column-gap:.5rem;column-gap:.5rem}.univer-space-y-2>:not([hidden])~:not([hidden]){--univer-tw-space-y-reverse:0;margin-top:calc(.5rem * (1 - var(--univer-tw-space-y-reverse)));margin-top:.5rem;margin-top:calc(.5rem * calc(1 - var(--univer-tw-space-y-reverse)));margin-bottom:0;margin-bottom:calc(.5rem * var(--univer-tw-space-y-reverse))}.univer-divide-x-0>:not([hidden])~:not([hidden]){--univer-tw-divide-x-reverse:0;border-right-width:0;border-right-width:calc(0px * var(--univer-tw-divide-x-reverse));border-left-width:calc(0px * (1 - var(--univer-tw-divide-x-reverse)));border-left-width:0;border-left-width:calc(0px * calc(1 - var(--univer-tw-divide-x-reverse)))}.univer-divide-y>:not([hidden])~:not([hidden]){--univer-tw-divide-y-reverse:0;border-top-width:calc(1px * (1 - var(--univer-tw-divide-y-reverse)));border-top-width:1px;border-top-width:calc(1px * calc(1 - var(--univer-tw-divide-y-reverse)));border-bottom-width:0;border-bottom-width:calc(1px * var(--univer-tw-divide-y-reverse))}.univer-divide-solid>:not([hidden])~:not([hidden]){border-style:solid}.univer-divide-gray-200>:not([hidden])~:not([hidden]){border-color:var(--univer-gray-200)}.univer-justify-self-center{justify-self:center}.univer-overflow-x-auto{overflow-x:auto}.univer-overflow-y-hidden{overflow-y:hidden}.univer-border-2{border-width:2px}.univer-border-4{border-width:4px}.univer-border-b{border-bottom-width:1px}.univer-border-\\[rgba\\(13\\,13\\,13\\,0\\.12\\)\\]{border-color:#0d0d0d1f}.univer-border-gray-100{border-color:var(--univer-gray-100)}.univer-border-r-gray-200{border-right-color:var(--univer-gray-200)}.univer-border-t-primary-500{border-top-color:var(--univer-primary-500)}.\\!univer-bg-gray-700{background-color:var(--univer-gray-700)!important}.univer-bg-blue-500{background-color:var(--univer-blue-500)}.univer-bg-blue-600{background-color:var(--univer-blue-600)}.univer-bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--univer-tw-gradient-stops))}.univer-from-gray-50{--univer-tw-gradient-from:var(--univer-gray-50) var(--univer-tw-gradient-from-position);--univer-tw-gradient-to:#fff0 var(--univer-tw-gradient-to-position);--univer-tw-gradient-stops:var(--univer-tw-gradient-from), var(--univer-tw-gradient-to)}.univer-to-gray-100{--univer-tw-gradient-to:var(--univer-gray-100) var(--univer-tw-gradient-to-position)}.univer-fill-gray-900{fill:var(--univer-gray-900)}.univer-px-3\\.5{padding-left:.875rem;padding-right:.875rem}.univer-px-5{padding-left:1.25rem;padding-right:1.25rem}.univer-py-5{padding-top:1.25rem;padding-bottom:1.25rem}.univer-pb-1{padding-bottom:.25rem}.univer-pl-1\\.5{padding-left:.375rem}.univer-pl-3{padding-left:.75rem}.univer-pl-6{padding-left:1.5rem}.univer-pr-5{padding-right:1.25rem}.univer-pt-1{padding-top:.25rem}.univer-font-semibold{font-weight:600}.univer-leading-6{line-height:1.5rem}.univer-leading-7{line-height:1.75rem}.\\!univer-text-blue-400{color:var(--univer-blue-400)!important}.\\!univer-text-gray-700{color:var(--univer-gray-700)!important}.\\!univer-text-white{color:var(--univer-white)!important}.univer-text-blue-500{color:var(--univer-blue-500)}.univer-text-blue-600{color:var(--univer-blue-600)}.univer-text-gray-200{color:var(--univer-gray-200)}.univer-text-gray-300{color:var(--univer-gray-300)}.univer-text-green-600{color:var(--univer-green-600)}.univer-text-primary-700{color:var(--univer-primary-700)}.univer-text-red-600{color:var(--univer-red-600)}.univer-text-rose-600{--univer-tw-text-opacity:1;color:rgba(225,29,72,var(--univer-tw-text-opacity,1))}.univer-text-yellow-500{color:var(--univer-yellow-500)}.univer-blur-sm{--univer-tw-blur:blur(4px);filter:var(--univer-tw-blur) var(--univer-tw-brightness) var(--univer-tw-contrast) var(--univer-tw-grayscale) var(--univer-tw-hue-rotate) var(--univer-tw-invert) var(--univer-tw-saturate) var(--univer-tw-sepia) var(--univer-tw-drop-shadow)}.univer-backdrop-blur{--univer-tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--univer-tw-backdrop-blur) var(--univer-tw-backdrop-brightness) var(--univer-tw-backdrop-contrast) var(--univer-tw-backdrop-grayscale) var(--univer-tw-backdrop-hue-rotate) var(--univer-tw-backdrop-invert) var(--univer-tw-backdrop-opacity) var(--univer-tw-backdrop-saturate) var(--univer-tw-backdrop-sepia);backdrop-filter:var(--univer-tw-backdrop-blur) var(--univer-tw-backdrop-brightness) var(--univer-tw-backdrop-contrast) var(--univer-tw-backdrop-grayscale) var(--univer-tw-backdrop-hue-rotate) var(--univer-tw-backdrop-invert) var(--univer-tw-backdrop-opacity) var(--univer-tw-backdrop-saturate) var(--univer-tw-backdrop-sepia)}.univer-transition-\\[colors\\,box-shadow\\]{transition-property:colors,box-shadow;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.univer-transition-\\[height\\]{transition-property:height;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.univer-duration-200{transition-duration:.2s}.univer-ease-linear{transition-timing-function:linear}.after\\:univer-absolute:after{content:var(--univer-tw-content);position:absolute}.after\\:univer-right-0:after{content:var(--univer-tw-content);right:0}.after\\:univer-top-1\\/2:after{content:var(--univer-tw-content);top:50%}.after\\:univer-block:after{content:var(--univer-tw-content);display:block}.after\\:univer-h-4:after{content:var(--univer-tw-content);height:1rem}.after\\:univer-w-px:after{content:var(--univer-tw-content);width:1px}.after\\:-univer-translate-y-1\\/2:after{content:var(--univer-tw-content);--univer-tw-translate-y:-50%;transform:translate(var(--univer-tw-translate-x),-50%) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y));transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y))}.after\\:univer-bg-gray-200:after{content:var(--univer-tw-content);background-color:var(--univer-gray-200)}.after\\:univer-content-\\[\\"\\"\\]:after{--univer-tw-content:"";content:"";content:var(--univer-tw-content)}.last\\:univer-mb-0:last-child{margin-bottom:0}.univer-group:hover .group-hover\\:univer-flex{display:flex}.hover\\:univer-border-primary-600:hover{border-color:var(--univer-primary-600)}.hover\\:univer-bg-transparent:hover{background-color:#0000}.focus\\:univer-border-primary-500:focus{border-color:var(--univer-primary-500)}.focus\\:univer-outline-none:focus{outline-offset:2px;outline:2px solid #0000}.focus-visible\\:univer-ring-2:focus-visible{--univer-tw-ring-offset-shadow:var(--univer-tw-ring-inset) 0 0 0 var(--univer-tw-ring-offset-width) var(--univer-tw-ring-offset-color);--univer-tw-ring-shadow:var(--univer-tw-ring-inset) 0 0 0 calc(2px + var(--univer-tw-ring-offset-width)) var(--univer-tw-ring-color);box-shadow:var(--univer-tw-ring-offset-shadow),var(--univer-tw-ring-shadow),0 0 #0000;box-shadow:var(--univer-tw-ring-offset-shadow),var(--univer-tw-ring-shadow),var(--univer-tw-shadow,0 0 #0000)}.focus-visible\\:univer-ring-primary-500:focus-visible{--univer-tw-ring-color:var(--univer-primary-500)}.active\\:univer-bg-gray-100:active{background-color:var(--univer-gray-100)}.dark\\:\\!univer-divide-gray-600:where(.univer-dark,.univer-dark *)>:not([hidden])~:not([hidden]){border-color:var(--univer-gray-600)!important}.dark\\:\\!univer-border-r-gray-700:where(.univer-dark,.univer-dark *){border-right-color:var(--univer-gray-700)!important}.dark\\:\\!univer-bg-black:where(.univer-dark,.univer-dark *){background-color:var(--univer-black)!important}.dark\\:\\!univer-bg-blue-400:where(.univer-dark,.univer-dark *){background-color:var(--univer-blue-400)!important}.dark\\:\\!univer-from-gray-800:where(.univer-dark,.univer-dark *){--univer-tw-gradient-from:var(--univer-gray-800) var(--univer-tw-gradient-from-position)!important;--univer-tw-gradient-to:#fff0 var(--univer-tw-gradient-to-position)!important;--univer-tw-gradient-stops:var(--univer-tw-gradient-from), var(--univer-tw-gradient-to)!important}.dark\\:\\!univer-to-gray-900:where(.univer-dark,.univer-dark *){--univer-tw-gradient-to:var(--univer-gray-900) var(--univer-tw-gradient-to-position)!important}.dark\\:\\!univer-fill-white:where(.univer-dark,.univer-dark *){fill:var(--univer-white)!important}.dark\\:\\!univer-text-blue-400:where(.univer-dark,.univer-dark *){color:var(--univer-blue-400)!important}.dark\\:\\!univer-text-gray-700:where(.univer-dark,.univer-dark *){color:var(--univer-gray-700)!important}.dark\\:\\!univer-text-green-400:where(.univer-dark,.univer-dark *){color:var(--univer-green-400)!important}.dark\\:\\!univer-text-red-400:where(.univer-dark,.univer-dark *){color:var(--univer-red-400)!important}.\\[\\&\\>div\\:first-child\\]\\:univer-px-2\\.5>div:first-child{padding-left:.625rem;padding-right:.625rem}.\\[\\&\\>div\\]\\:univer-h-5>div{height:1.25rem}.\\[\\&\\>div\\]\\:univer-ring-transparent>div{--univer-tw-ring-color:transparent}.\\[\\&_canvas\\]\\:univer-absolute canvas,.univer-absolute{position:absolute}.univer-left-1\\.5{left:.375rem}.univer-top-1\\/2{top:50%}.univer-z-\\[15\\]{z-index:15}.-univer-mx-6{margin-left:-1.5rem;margin-right:-1.5rem}.univer-mx-0{margin-left:0;margin-right:0}.univer-my-1{margin-top:.25rem;margin-bottom:.25rem}.univer-my-2{margin-top:.5rem;margin-bottom:.5rem}.univer-mb-0{margin-bottom:0}.univer-ml-4{margin-left:1rem}.univer-mr-0{margin-right:0}.univer-mt-0{margin-top:0}.univer-mt-1{margin-top:.25rem}.univer-h-\\[18px\\]{height:18px}.univer-h-\\[364px\\]{height:364px}.univer-max-h-60{max-height:15rem}.univer-max-h-72{max-height:18rem}.univer-max-h-\\[350px\\]{max-height:350px}.univer-w-\\[250px\\]{width:250px}.-univer-translate-y-1\\/2{--univer-tw-translate-y:-50%;transform:translate(var(--univer-tw-translate-x),-50%) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y));transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y))}.univer-justify-around{justify-content:space-around}.univer-overflow-visible{overflow:visible}.univer-whitespace-pre-wrap{white-space:pre-wrap}.univer-break-all{word-break:break-all}.univer-rounded-none{border-radius:0}.univer-rounded-l{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.univer-border-r-0{border-right-width:0}.univer-border-gray-600{border-color:var(--univer-gray-600)}.univer-border-primary-600{border-color:var(--univer-primary-600)}.\\!univer-bg-gray-600{background-color:var(--univer-gray-600)!important}.univer-bg-primary-600{background-color:var(--univer-primary-600)}.univer-px-4{padding-left:1rem;padding-right:1rem}.univer-px-6{padding-left:1.5rem;padding-right:1.5rem}.univer-px-7{padding-left:1.75rem;padding-right:1.75rem}.univer-py-3{padding-top:.75rem;padding-bottom:.75rem}.univer-pt-0{padding-top:0}.univer-leading-\\[13px\\]{line-height:13px}.univer-text-white{color:var(--univer-white)}.univer-outline-none{outline-offset:2px;outline:2px solid #0000}.univer-ring-1{--univer-tw-ring-offset-shadow:var(--univer-tw-ring-inset) 0 0 0 var(--univer-tw-ring-offset-width) var(--univer-tw-ring-offset-color);--univer-tw-ring-shadow:var(--univer-tw-ring-inset) 0 0 0 calc(1px + var(--univer-tw-ring-offset-width)) var(--univer-tw-ring-color);box-shadow:var(--univer-tw-ring-offset-shadow),var(--univer-tw-ring-shadow),0 0 #0000;box-shadow:var(--univer-tw-ring-offset-shadow),var(--univer-tw-ring-shadow),var(--univer-tw-shadow,0 0 #0000)}.univer-ring-primary-500{--univer-tw-ring-color:var(--univer-primary-500)}.univer-ring-red-500{--univer-tw-ring-color:var(--univer-red-500)}.hover\\:univer-bg-gray-300:hover{background-color:var(--univer-gray-300)}.dark\\:\\!univer-bg-gray-600:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-600)!important}.dark\\:\\!univer-text-gray-300:where(.univer-dark,.univer-dark *){color:var(--univer-gray-300)!important}.dark\\:hover\\:\\!univer-bg-gray-600:hover:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-600)!important}.univer-mb-5{margin-bottom:1.25rem}.univer-mr-3{margin-right:.75rem}.univer-mt-3\\.5{margin-top:.875rem}.univer-max-h-\\[400px\\]{max-height:400px}.univer-w-32{width:8rem}.univer-w-36{width:9rem}.univer-w-4{width:1rem}.univer-w-\\[340px\\]{width:340px}.univer-cursor-default{cursor:default}.univer-gap-1\\.5{gap:.375rem}.univer-gap-6{gap:1.5rem}.univer-pb-5{padding-bottom:1.25rem}.univer-text-sm,.univer-text-sm\\/5{font-size:.875rem;line-height:1.25rem}.dark\\:\\!univer-text-gray-400:where(.univer-dark,.univer-dark *){color:var(--univer-gray-400)!important}.-univer-bottom-0\\.5{bottom:-.125rem}.-univer-right-0\\.5{right:-.125rem}.univer-mx-1{margin-left:.25rem;margin-right:.25rem}.univer-block{display:block}.univer-inline-block{display:inline-block}.univer-size-3{width:.75rem;height:.75rem}.univer-size-full{width:100%;height:100%}.univer-h-4{height:1rem}.univer-h-\\[300px\\]{height:300px}.univer-max-h-\\[500px\\]{max-height:500px}.univer-min-h-\\[300px\\]{min-height:300px}.univer-w-\\[400px\\]{width:400px}.univer-flex-shrink{flex-shrink:1}.univer-flex-grow{flex-grow:1}.univer-grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}.univer-flex-nowrap{flex-wrap:nowrap}.univer-justify-start{justify-content:flex-start}.univer-gap-4{gap:1rem}.univer-overflow-auto{overflow:auto}.univer-whitespace-nowrap{white-space:nowrap}.univer-border-\\[rgba\\(13\\,13\\,13\\,0\\.06\\)\\]{border-color:#0d0d0d0f}.univer-border-transparent{border-color:#0000}.univer-bg-gray-300{background-color:var(--univer-gray-300)}.univer-p-0\\.5{padding:.125rem}.univer-p-2{padding:.5rem}.univer-py-0{padding-top:0;padding-bottom:0}.univer-py-0\\.5{padding-top:.125rem;padding-bottom:.125rem}.univer-py-2\\.5{padding-top:.625rem;padding-bottom:.625rem}.univer-pl-5{padding-left:1.25rem}.univer-pr-0\\.5{padding-right:.125rem}.univer-pr-2{padding-right:.5rem}.univer-pt-2{padding-top:.5rem}.univer-font-bold{font-weight:700}.univer-text-\\[\\#418F1F\\]{--univer-tw-text-opacity:1;color:rgba(65,143,31,var(--univer-tw-text-opacity,1))}.univer-text-gray-500{color:var(--univer-gray-500)}.univer-transition-shadow{transition-property:box-shadow;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.hover\\:univer-ring-2:hover{--univer-tw-ring-offset-shadow:var(--univer-tw-ring-inset) 0 0 0 var(--univer-tw-ring-offset-width) var(--univer-tw-ring-offset-color);--univer-tw-ring-shadow:var(--univer-tw-ring-inset) 0 0 0 calc(2px + var(--univer-tw-ring-offset-width)) var(--univer-tw-ring-color);box-shadow:var(--univer-tw-ring-offset-shadow),var(--univer-tw-ring-shadow),0 0 #0000;box-shadow:var(--univer-tw-ring-offset-shadow),var(--univer-tw-ring-shadow),var(--univer-tw-shadow,0 0 #0000)}.hover\\:univer-ring-offset-2:hover{--univer-tw-ring-offset-width:2px}.hover\\:univer-ring-offset-white:hover{--univer-tw-ring-offset-color:var(--univer-white)}.dark\\:\\!univer-border-\\[rgba\\(255\\,255\\,255\\,0\\.06\\)\\]:where(.univer-dark,.univer-dark *){border-color:#ffffff0f!important}.dark\\:\\!univer-border-gray-600:where(.univer-dark,.univer-dark *){border-color:var(--univer-gray-600)!important}.dark\\:\\!univer-text-gray-500:where(.univer-dark,.univer-dark *){color:var(--univer-gray-500)!important}.dark\\:hover\\:\\!univer-bg-gray-900:hover:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-900)!important}.\\[\\&\\:hover_a\\]\\:univer-inline-block:hover a{display:inline-block}.univer-my-0{margin-top:0;margin-bottom:0}.univer-mb-2{margin-bottom:.5rem}.univer-ml-1\\.5{margin-left:.375rem}.univer-ml-3{margin-left:.75rem}.univer-mt-5{margin-top:1.25rem}.univer-max-h-\\[310px\\]{max-height:310px}.univer-w-\\[--radix-popper-anchor-width\\]{width:var(--radix-popper-anchor-width)}.univer-max-w-\\[220px\\]{max-width:220px}.univer-select-none{-webkit-user-select:none;user-select:none}.univer-grid-flow-col{grid-auto-flow:column}.univer-py-1\\.5{padding-top:.375rem;padding-bottom:.375rem}.univer-transition-all{transition-property:all;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.hover\\:univer-text-red-500:hover{color:var(--univer-red-500)}.disabled\\:univer-divide-opacity-30:disabled>:not([hidden])~:not([hidden]){--univer-tw-divide-opacity:.3}.disabled\\:univer-text-gray-800:disabled{color:var(--univer-gray-800)}.univer-mt-4{margin-top:1rem}.univer-mt-6{margin-top:1.5rem}.univer-text-primary-500{color:var(--univer-primary-500)}.univer-mt-2\\.5{margin-top:.625rem}.univer-size-4{width:1rem;height:1rem}.univer-h-5{height:1.25rem}.univer-h-7{height:1.75rem}.univer-h-8{height:2rem}.univer-h-full{height:100%}.univer-w-6{width:1.5rem}.univer-w-px{width:1px}.univer-min-w-32{min-width:8rem}.univer-min-w-9{min-width:2.25rem}.univer-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.univer-grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.univer-gap-1{gap:.25rem}.univer-border{border-width:1px}.univer-border-solid{border-style:solid}.univer-border-none{border-style:none}.\\!univer-bg-gray-800{background-color:var(--univer-gray-800)!important}.univer-bg-gray-100{background-color:var(--univer-gray-100)}.univer-bg-gray-200{background-color:var(--univer-gray-200)}.univer-bg-primary-50{background-color:var(--univer-primary-50)}.univer-bg-transparent{background-color:#0000}.univer-fill-primary-600{fill:var(--univer-primary-600)}.univer-p-0{padding:0}.univer-p-1{padding:.25rem}.univer-px-1{padding-left:.25rem;padding-right:.25rem}.univer-px-1\\.5{padding-left:.375rem;padding-right:.375rem}.univer-px-2{padding-left:.5rem;padding-right:.5rem}.univer-py-1{padding-top:.25rem;padding-bottom:.25rem}.univer-text-left{text-align:left}.univer-text-center{text-align:center}.\\!univer-text-primary-300{color:var(--univer-primary-300)!important}.univer-text-gray-700{color:var(--univer-gray-700)}.univer-shadow-lg{--univer-tw-shadow:0px 4px 6px 0px #1e284d0d, 0px 10px 15px -3px #1e284d1a;--univer-tw-shadow-colored:0px 4px 6px 0px var(--univer-tw-shadow-color), 0px 10px 15px -3px var(--univer-tw-shadow-color);box-shadow:0 0 #0000,0 0 #0000,0 4px 6px #1e284d0d,0 10px 15px -3px #1e284d1a;box-shadow:var(--univer-tw-ring-offset-shadow,0 0 #0000),var(--univer-tw-ring-shadow,0 0 #0000),var(--univer-tw-shadow)}.univer-shadow-sm{--univer-tw-shadow:0px 1px 2px 0px #1e284d14;--univer-tw-shadow-colored:0px 1px 2px 0px var(--univer-tw-shadow-color);box-shadow:0 0 #0000,0 0 #0000,0 1px 2px #1e284d14;box-shadow:var(--univer-tw-ring-offset-shadow,0 0 #0000),var(--univer-tw-ring-shadow,0 0 #0000),var(--univer-tw-shadow)}.univer-transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.disabled\\:univer-cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:univer-opacity-40:disabled{opacity:.4}.dark\\:\\!univer-border-gray-700:where(.univer-dark,.univer-dark *){border-color:var(--univer-gray-700)!important}.dark\\:\\!univer-bg-gray-700:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-700)!important}.dark\\:\\!univer-bg-gray-800:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-800)!important}.dark\\:\\!univer-text-gray-100:where(.univer-dark,.univer-dark *){color:var(--univer-gray-100)!important}.dark\\:\\!univer-text-primary-300:where(.univer-dark,.univer-dark *){color:var(--univer-primary-300)!important}.\\[\\&\\>div\\]\\:univer-grid>div{display:grid}.\\[\\&\\>div\\]\\:univer-gap-2>div{gap:.5rem}.univer-hidden{display:none}.univer-border-t{border-top-width:1px}.univer-border-gray-200{border-color:var(--univer-gray-200)}.univer-py-2{padding-top:.5rem;padding-bottom:.5rem}.univer-pt-3{padding-top:.75rem}.univer-text-gray-400{color:var(--univer-gray-400)}.univer-absolute{position:absolute}.univer-relative{position:relative}.univer-left-0{left:0}.univer-right-0{right:0}.univer-top-0{top:0}.univer-m-0{margin:0}.univer-mb-3{margin-bottom:.75rem}.univer-mb-4{margin-bottom:1rem}.univer-ml-1{margin-left:.25rem}.univer-mr-1\\.5{margin-right:.375rem}.univer-mt-2{margin-top:.5rem}.univer-mt-3{margin-top:.75rem}.univer-inline-flex{display:inline-flex}.univer-grid{display:grid}.univer-h-1\\.5{height:.375rem}.univer-h-3\\.5{height:.875rem}.univer-max-h-80{max-height:20rem}.univer-min-h-full{min-height:100%}.univer-w-\\[278px\\]{width:278px}.univer-w-\\[3px\\]{width:3px}.univer-flex-shrink-0{flex-shrink:0}.univer-flex-grow-0{flex-grow:0}.univer-list-none{list-style-type:none}.univer-flex-col{flex-direction:column}.univer-gap-3{gap:.75rem}.univer-overflow-y-auto{overflow-y:auto}.univer-overflow-x-hidden{overflow-x:hidden}.univer-break-words{word-wrap:break-word}.univer-rounded-\\[3px\\]{border-radius:3px}.univer-rounded-full{border-radius:9999px}.univer-rounded-md{border-radius:.375rem}.univer-rounded-sm{border-radius:.125rem}.univer-rounded-t-md{border-top-left-radius:.375rem;border-top-right-radius:.375rem}.\\!univer-bg-gray-900{background-color:var(--univer-gray-900)!important}.univer-bg-gray-50{background-color:var(--univer-gray-50)}.univer-bg-yellow-400{background-color:var(--univer-yellow-400)}.univer-bg-yellow-500{background-color:var(--univer-yellow-500)}.univer-bg-cover{background-size:cover}.univer-bg-center{background-position:50%}.univer-bg-no-repeat{background-repeat:no-repeat}.univer-p-1\\.5{padding:.375rem}.univer-pb-3{padding-bottom:.75rem}.univer-pl-\\[30px\\]{padding-left:30px}.univer-text-xs{font-size:.75rem;line-height:1rem}.univer-text-xs\\/normal{font-size:.75rem;line-height:1.5}.univer-font-medium{font-weight:500}.univer-text-gray-600{color:var(--univer-gray-600)}.univer-shadow{--univer-tw-shadow:0 1px 3px 0 #0000001a, 0 1px 2px -1px #0000001a;--univer-tw-shadow-colored:0 1px 3px 0 var(--univer-tw-shadow-color), 0 1px 2px -1px var(--univer-tw-shadow-color);box-shadow:0 0 #0000,0 0 #0000,0 1px 3px #0000001a,0 1px 2px -1px #0000001a;box-shadow:var(--univer-tw-ring-offset-shadow,0 0 #0000),var(--univer-tw-ring-shadow,0 0 #0000),var(--univer-tw-shadow)}.hover\\:univer-bg-gray-200:hover{background-color:var(--univer-gray-200)}.hover\\:univer-bg-gray-50:hover{background-color:var(--univer-gray-50)}.dark\\:\\!univer-text-gray-200:where(.univer-dark,.univer-dark *){color:var(--univer-gray-200)!important}.dark\\:hover\\:\\!univer-bg-gray-800:hover:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-800)!important}.\\[\\&_a\\]\\:univer-block a{display:block}.\\[\\&_a\\]\\:univer-cursor-pointer a{cursor:pointer}.\\[\\&_a\\]\\:univer-rounded a{border-radius:.25rem}.\\[\\&_a\\]\\:univer-px-2 a{padding-left:.5rem;padding-right:.5rem}.\\[\\&_a\\]\\:univer-py-1\\.5 a{padding-top:.375rem;padding-bottom:.375rem}.\\[\\&_a\\]\\:univer-transition-colors a{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.univer-mb-1{margin-bottom:.25rem}.univer-ml-2{margin-left:.5rem}.univer-mr-2{margin-right:.5rem}.univer-box-border{box-sizing:border-box}.univer-flex{display:flex}.univer-size-5{width:1.25rem;height:1.25rem}.univer-size-6{width:1.5rem;height:1.5rem}.univer-h-6{height:1.5rem}.univer-w-\\[296px\\]{width:296px}.univer-w-full{width:100%}.univer-max-w-80{max-width:20rem}.univer-flex-1{flex:1}.univer-flex-none{flex:none}.univer-cursor-pointer{cursor:pointer}.univer-flex-row{flex-direction:row}.univer-items-center{align-items:center}.univer-justify-end{justify-content:flex-end}.univer-justify-center{justify-content:center}.univer-justify-between{justify-content:space-between}.univer-gap-2{gap:.5rem}.univer-overflow-hidden{overflow:hidden}.univer-truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.univer-rounded{border-radius:.25rem}.univer-rounded-lg{border-radius:.5rem}.univer-rounded-xl{border-radius:.75rem}.univer-bg-white{background-color:var(--univer-white)}.univer-p-3{padding:.75rem}.univer-p-4{padding:1rem}.univer-text-base{font-size:1rem;line-height:1.5rem}.univer-text-sm{font-size:.875rem;line-height:1.25rem}.univer-leading-5{line-height:1.25rem}.univer-text-gray-900{color:var(--univer-gray-900)}.univer-text-green-500{color:var(--univer-green-500)}.univer-text-primary-600{color:var(--univer-primary-600)}.univer-text-red-500{color:var(--univer-red-500)}.univer-shadow-md{--univer-tw-shadow:0px 1px 6px -2px #1e284d14, 0px 2px 6px -1px #1e284d1a;--univer-tw-shadow-colored:0px 1px 6px -2px var(--univer-tw-shadow-color), 0px 2px 6px -1px var(--univer-tw-shadow-color);box-shadow:0 0 #0000,0 0 #0000,0 1px 6px -2px #1e284d14,0 2px 6px -1px #1e284d1a;box-shadow:var(--univer-tw-ring-offset-shadow,0 0 #0000), var(--univer-tw-ring-shadow,0 0 #0000), var(--univer-tw-shadow)}.hover\\:univer-bg-gray-100:hover{background-color:var(--univer-gray-100)}.dark\\:\\!univer-bg-gray-900:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-900)!important}.dark\\:\\!univer-text-white:where(.univer-dark,.univer-dark *){color:var(--univer-white)!important}.dark\\:hover\\:\\!univer-bg-gray-700:hover:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-700)!important}.sheet-shell[data-v-cde37d0b]{letter-spacing:normal;flex-direction:column;height:760px;font-size:14px;line-height:normal;display:flex}.sheet-canvas[data-v-cde37d0b]{flex:1;min-height:0;position:relative}.sheet-editor[data-v-cde37d0b]{contain:layout style;letter-spacing:normal;width:100%;height:100%;font-size:14px;line-height:normal;position:absolute;inset:0;overflow:hidden}.sheet-attachments[data-v-cde37d0b]{border-bottom:1px solid #eee;align-items:center;gap:8px;padding:6px 12px;font-size:12px;display:flex}.sheet-attachments button[data-v-cde37d0b]{cursor:pointer;color:#3370ff;background:#fff;border:1px solid #dce3ed;border-radius:4px;padding:4px 8px}.sheet-attachments button[data-v-cde37d0b]:disabled{cursor:wait;opacity:.5}.attachment-name[data-v-cde37d0b]{text-overflow:ellipsis;white-space:nowrap;max-width:240px;overflow:hidden}.attachment-error[data-v-cde37d0b]{color:#c62828}.tag-current-row[data-v-cde37d0b]{z-index:100;background:#fafbfc;border:1px solid #eee;border-radius:6px;align-items:center;gap:4px;padding:0 8px;font-size:12px;display:inline-flex;position:absolute;box-shadow:0 1px 4px #0000000f}.tag-current-label[data-v-cde37d0b]{color:#999;white-space:nowrap;font-size:11px}.tag-dropdown[data-v-cde37d0b]{z-index:100;background:#fff;border:1px solid #e0e0e0;border-radius:6px;flex-direction:column;gap:4px;min-width:220px;max-width:320px;padding:8px;display:flex;position:absolute;box-shadow:0 4px 12px #0000001f}.tag-search[data-v-cde37d0b]{box-sizing:border-box;border:1px solid #d9d9d9;border-radius:4px;outline:none;width:100%;padding:5px 8px;font-size:12px}.tag-search[data-v-cde37d0b]:focus{border-color:#3370ff}.tag-option-list[data-v-cde37d0b]{flex-wrap:wrap;gap:6px;max-height:180px;padding:4px;display:flex;overflow-y:auto}.tag-option[data-v-cde37d0b]{cursor:pointer;white-space:nowrap;border:1px solid #0000;border-radius:4px;padding:3px 10px;font-size:12px;font-weight:600;position:relative}.tag-option[data-v-cde37d0b]:hover{opacity:.85;border-color:currentColor}.tag-option-name[data-v-cde37d0b]{pointer-events:none}.tag-option-delete[data-v-cde37d0b]{cursor:pointer;color:#fff;background:#ff4d4f;border:1px solid #fff;border-radius:50%;justify-content:center;align-items:center;width:14px;height:14px;font-size:10px;line-height:1;display:none;position:absolute;top:-6px;right:-6px;box-shadow:0 1px 2px #00000026}.tag-option:hover .tag-option-delete[data-v-cde37d0b]{display:inline-flex}.tag-option-delete[data-v-cde37d0b]:hover{background:#cf1322}.tag-empty[data-v-cde37d0b]{color:#999;text-align:center;width:100%;padding:8px 0;font-size:12px}.tag-add-new[data-v-cde37d0b]{color:#666;cursor:pointer;text-align:center;background:0 0;border:1px dashed #d9d9d9;border-radius:4px;width:100%;padding:4px 8px;font-size:12px}.tag-add-new[data-v-cde37d0b]:hover{color:#3370ff;border-color:#3370ff}.cell-tag-chip[data-v-cde37d0b]{border-radius:4px;align-items:center;gap:2px;padding:2px 6px;font-size:12px;font-weight:600;display:inline-flex}.cell-tag-remove[data-v-cde37d0b]{cursor:pointer;color:inherit;opacity:.6;background:0 0;border:none;padding:0 1px;font-size:14px;line-height:1}.cell-tag-remove[data-v-cde37d0b]:hover{opacity:1}.tag-config-overlay[data-v-cde37d0b]{z-index:1000;background:#0006;justify-content:center;align-items:center;display:flex;position:fixed;inset:0}.tag-config-dialog[data-v-cde37d0b]{background:#fff;border-radius:8px;min-width:320px;padding:20px;box-shadow:0 8px 24px #00000026}.tag-config-dialog h4[data-v-cde37d0b]{margin:0 0 16px;font-size:15px;font-weight:600}.tag-config-label[data-v-cde37d0b]{color:#666;flex-direction:column;gap:4px;margin-bottom:12px;font-size:12px;display:flex}.tag-config-label input[data-v-cde37d0b]{border:1px solid #d9d9d9;border-radius:4px;padding:6px 8px;font-size:13px}.tag-config-label input[data-v-cde37d0b]:focus{border-color:#3370ff;outline:none}.tag-config-colors[data-v-cde37d0b]{margin-bottom:12px}.tag-config-colors>span[data-v-cde37d0b]{color:#666;margin-bottom:6px;font-size:12px;display:block}.tag-sv-panel[data-v-cde37d0b]{cursor:crosshair;touch-action:none;border-radius:6px;width:100%;height:110px;margin-bottom:10px;position:relative}.tag-hue-bar[data-v-cde37d0b]{cursor:pointer;touch-action:none;background:linear-gradient(90deg,red,#ff0,#0f0,#0ff,#00f,#f0f,red);border-radius:7px;width:100%;height:14px;position:relative}.tag-color-dot[data-v-cde37d0b]{pointer-events:none;border:2px solid #fff;border-radius:50%;width:14px;height:14px;position:absolute;transform:translate(-50%,-50%);box-shadow:0 0 2px #0006}.tag-config-preview[data-v-cde37d0b]{margin-bottom:16px}.tag-config-actions[data-v-cde37d0b]{justify-content:flex-end;gap:8px;display:flex}.tag-config-cancel[data-v-cde37d0b]{cursor:pointer;background:#fff;border:1px solid #d9d9d9;border-radius:4px;padding:5px 14px;font-size:13px}.tag-config-save[data-v-cde37d0b]{color:#fff;cursor:pointer;background:#3370ff;border:none;border-radius:4px;padding:5px 14px;font-size:13px}.tag-config-save[data-v-cde37d0b]:hover{background:#245bdb}.sheet-statusbar[data-v-cde37d0b]{color:#8c8c8c;white-space:nowrap;background:#fafbfc;border-top:1px solid #f0f0f0;align-items:center;gap:8px;padding:8px 16px;font-size:12px;display:flex;overflow:hidden}.status-cell[data-v-cde37d0b]{color:#25b864;font-family:ui-monospace,Consolas,monospace;font-weight:600}.status-sep[data-v-cde37d0b]{color:#d9d9d9}.sheet-statusbar b[data-v-cde37d0b]{color:#595959;font-weight:600}.status-flex[data-v-cde37d0b]{flex:1}.status-hint[data-v-cde37d0b]{color:#bfbfbf}.status-readonly[data-v-cde37d0b]{color:#faad14}.status-tip[data-v-cde37d0b]{color:#bfbfbf}.tag-toast[data-v-cde37d0b]{z-index:200;color:#fff;pointer-events:none;white-space:nowrap;background:#000000bf;border-radius:6px;padding:8px 18px;font-size:13px;line-height:1.4;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);box-shadow:0 4px 12px #00000026}.tag-toast-enter-active[data-v-cde37d0b],.tag-toast-leave-active[data-v-cde37d0b]{transition:opacity .25s}.tag-toast-enter-from[data-v-cde37d0b],.tag-toast-leave-to[data-v-cde37d0b]{opacity:0}/*$vite$:1*/`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();
1
+ (function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`@keyframes univer-spin{to{transform:rotate(360deg)}}@media (width>=640px){.sm\\:\\!univer-flex-row{flex-direction:row!important}.sm\\:\\!univer-justify-end{justify-content:flex-end!important}.sm\\:\\!univer-space-x-2>:not([hidden])~:not([hidden]){--univer-tw-space-x-reverse:0!important;margin-right:0!important;margin-right:calc(.5rem * var(--univer-tw-space-x-reverse))!important;margin-left:calc(.5rem * (1 - var(--univer-tw-space-x-reverse)))!important;margin-left:.5rem!important;margin-left:calc(.5rem * calc(1 - var(--univer-tw-space-x-reverse)))!important}.sm\\:\\!univer-rounded-lg{border-radius:.5rem!important}.sm\\:\\!univer-text-left{text-align:left!important}}@media (width>=768px){.md\\:univer-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}@keyframes popup-slide-up-in{0%{transform-origin:0 0;opacity:0;transform:scaleY(0)}to{transform-origin:0 0;opacity:1;transform:scaleY(1)}}@keyframes popup-slide-up-out{0%{transform-origin:0 0;opacity:1;transform:scaleY(1)}to{transform-origin:0 0;opacity:0;transform:scaleY(0)}}@keyframes enter{0%{opacity:1;opacity:var(--univer-tw-enter-opacity,1);transform:translateZ(0)scaleZ(1)rotate(0);transform:translate3d(var(--univer-tw-enter-translate-x,0),var(--univer-tw-enter-translate-y,0),0) scale3d(var(--univer-tw-enter-scale,1),var(--univer-tw-enter-scale,1),var(--univer-tw-enter-scale,1)) rotate(var(--univer-tw-enter-rotate,0))}}@keyframes exit{to{opacity:1;opacity:var(--univer-tw-exit-opacity,1);transform:translateZ(0)scaleZ(1)rotate(0);transform:translate3d(var(--univer-tw-exit-translate-x,0),var(--univer-tw-exit-translate-y,0),0) scale3d(var(--univer-tw-exit-scale,1),var(--univer-tw-exit-scale,1),var(--univer-tw-exit-scale,1)) rotate(var(--univer-tw-exit-rotate,0))}}.focus\\:univer-ring-2:focus,.focus-visible\\:univer-ring-2:focus-visible{--univer-tw-ring-offset-shadow:var(--univer-tw-ring-inset) 0 0 0 var(--univer-tw-ring-offset-width) var(--univer-tw-ring-offset-color);--univer-tw-ring-shadow:var(--univer-tw-ring-inset) 0 0 0 calc(2px + var(--univer-tw-ring-offset-width)) var(--univer-tw-ring-color);box-shadow:var(--univer-tw-ring-offset-shadow),var(--univer-tw-ring-shadow),0 0 #0000;box-shadow:var(--univer-tw-ring-offset-shadow),var(--univer-tw-ring-shadow),var(--univer-tw-shadow,0 0 #0000)}@media (width>=640px){.sm\\:\\!univer-block{display:block!important}}.univer-w-\\[328px\\]{width:328px}.univer-flex-\\[0_0_auto\\]{flex:none}.doc-shell[data-v-8ea611a2]{letter-spacing:normal;flex-direction:column;height:760px;font-size:14px;line-height:normal;display:flex}.doc-layout[data-v-8ea611a2]{flex:1;min-height:0;display:flex}.doc-canvas[data-v-8ea611a2]{background:#f7f8fa;flex:1;min-width:0;position:relative}.readonly-badge[data-v-8ea611a2]{z-index:30;color:#8c8c8c;pointer-events:none;background:#ffffffeb;border:1px solid #e0e0e0;border-radius:999px;padding:3px 10px;font-size:12px;position:absolute;top:10px;right:14px;box-shadow:0 1px 4px #0000000f}.attachment-file-input[data-v-8ea611a2]{display:none}.attachment-error-tip[data-v-8ea611a2]{z-index:30;color:#fff;pointer-events:none;background:#e5484df2;border-radius:6px;max-width:80%;padding:6px 14px;font-size:12px;position:absolute;bottom:16px;left:50%;transform:translate(-50%);box-shadow:0 4px 12px #0000002e}.attachment-uploading-tip[data-v-8ea611a2]{z-index:30;color:#fff;pointer-events:none;background:#3370ffeb;border-radius:6px;padding:6px 14px;font-size:12px;position:absolute;bottom:16px;left:50%;transform:translate(-50%);box-shadow:0 4px 12px #0000002e}.doc-editor[data-v-8ea611a2]{contain:layout style;letter-spacing:normal;font-size:14px;line-height:normal;position:absolute;inset:0;overflow:hidden}.link-dialog-mask[data-v-8ea611a2]{z-index:30;background:#00000047;justify-content:center;align-items:center;display:flex;position:absolute;inset:0}.link-dialog[data-v-8ea611a2]{background:#fff;border-radius:12px;width:400px;max-width:calc(100% - 48px);padding:22px 24px 18px;box-shadow:0 12px 40px #00000029}.link-dialog-title[data-v-8ea611a2]{color:#1a1a1a;margin-bottom:18px;font-size:16px;font-weight:600}.link-dialog-field[data-v-8ea611a2]{margin-bottom:14px}.field-label[data-v-8ea611a2]{color:#595959;margin-bottom:6px;font-size:13px;font-weight:500;display:block}.field-input[data-v-8ea611a2]{color:#333;background:#fafafa;border:1px solid #e0e0e0;border-radius:6px;outline:none;width:100%;height:34px;padding:0 10px;font-size:13px;transition:border-color .15s,box-shadow .15s}.field-input[data-v-8ea611a2]:focus{background:#fff;border-color:#25b864;box-shadow:0 0 0 2px #25b8641f}.field-input.error[data-v-8ea611a2]{border-color:#e5484d}.field-error[data-v-8ea611a2]{color:#e5484d;margin-top:4px;font-size:12px}.link-dialog-tip[data-v-8ea611a2]{color:#bfbfbf;margin-bottom:16px;font-size:12px}.link-dialog-actions[data-v-8ea611a2]{justify-content:flex-end;gap:10px;display:flex}.dialog-btn[data-v-8ea611a2]{cursor:pointer;border:none;border-radius:6px;height:32px;padding:0 18px;font-size:13px;transition:all .15s}.dialog-btn.cancel[data-v-8ea611a2]{color:#595959;background:#f5f5f5}.dialog-btn.cancel[data-v-8ea611a2]:hover{background:#ececec}.dialog-btn.confirm[data-v-8ea611a2]{color:#fff;background:#25b864;font-weight:500}.dialog-btn.confirm[data-v-8ea611a2]:hover:not(:disabled){background:#1fa257}.dialog-btn.confirm[data-v-8ea611a2]:disabled{cursor:not-allowed;background:#bfe6d2}.doc-statusbar[data-v-8ea611a2]{color:#8c8c8c;background:#fafbfc;border-top:1px solid #f0f0f0;align-items:center;gap:8px;padding:8px 20px;font-size:12px;display:flex}.status-count[data-v-8ea611a2]{color:#595959;font-weight:500}.status-flex[data-v-8ea611a2]{flex:1}.status-tip[data-v-8ea611a2]{color:#bfbfbf}.link-hover-bar[data-v-8ea611a2]{z-index:1080;white-space:nowrap;-webkit-user-select:none;user-select:none;background:#fff;border:1px solid #e8e8e8;border-radius:6px;align-items:center;gap:2px;padding:4px 8px;display:flex;position:fixed;transform:translate(-50%)translateY(-100%);box-shadow:0 4px 16px #0000001f}.hover-label[data-v-8ea611a2]{color:#3370ff;cursor:pointer;padding:0 6px;font-size:13px;font-weight:500}.hover-label[data-v-8ea611a2]:hover{text-decoration:underline}.hover-icon-btn[data-v-8ea611a2]{color:#595959;cursor:pointer;background:0 0;border:none;border-radius:4px;justify-content:center;align-items:center;width:28px;height:28px;padding:0;transition:background .12s,color .12s;display:inline-flex;position:relative}.hover-icon-btn[data-v-8ea611a2]:hover{color:#1d2129;background:#f2f3f5}.hover-icon-tip[data-v-8ea611a2]{color:#3370ff;white-space:nowrap;pointer-events:none;font-size:10px;position:absolute;bottom:-18px;left:50%;transform:translate(-50%)}.hover-unlink-btn[data-v-8ea611a2]:hover{color:#e5484d;background:#e5484d14}.hover-sep[data-v-8ea611a2]{background:#ececec;flex-shrink:0;width:1px;height:16px;margin:0 4px}.hover-bar-arrow[data-v-8ea611a2]{background:#fff;border-bottom:1px solid #e8e8e8;border-right:1px solid #e8e8e8;width:8px;height:8px;position:absolute;bottom:-5px;left:50%;transform:translate(-50%)rotate(45deg)}.hover-style[data-v-8ea611a2]{position:relative}.hover-style-menu[data-v-8ea611a2]{text-align:left;background:#fff;border:1px solid #e8e8e8;border-radius:6px;min-width:140px;padding:4px;position:absolute;top:calc(100% + 8px);left:50%;transform:translate(-50%);box-shadow:0 4px 16px #0000001f}.hover-style-item[data-v-8ea611a2]{cursor:pointer;color:#595959;border-radius:4px;align-items:center;gap:6px;padding:6px 10px;font-size:13px;display:flex}.hover-style-item[data-v-8ea611a2]:hover{background:#f7f8fa}.hover-style-item.active[data-v-8ea611a2]{color:#3370ff}.style-check[data-v-8ea611a2]{color:#3370ff;text-align:center;flex-shrink:0;width:16px;font-size:12px}.style-name[data-v-8ea611a2]{font-size:13px}[data-u-comp=rect-popup]:has(.univer-max-w-80){visibility:hidden;pointer-events:none}*,:before,:after,::backdrop{--univer-tw-border-spacing-x:0;--univer-tw-border-spacing-y:0;--univer-tw-translate-x:0;--univer-tw-translate-y:0;--univer-tw-rotate:0;--univer-tw-skew-x:0;--univer-tw-skew-y:0;--univer-tw-scale-x:1;--univer-tw-scale-y:1;--univer-tw-pan-x: ;--univer-tw-pan-y: ;--univer-tw-pinch-zoom: ;--univer-tw-scroll-snap-strictness:proximity;--univer-tw-gradient-from-position: ;--univer-tw-gradient-via-position: ;--univer-tw-gradient-to-position: ;--univer-tw-ordinal: ;--univer-tw-slashed-zero: ;--univer-tw-numeric-figure: ;--univer-tw-numeric-spacing: ;--univer-tw-numeric-fraction: ;--univer-tw-ring-inset: ;--univer-tw-ring-offset-width:0px;--univer-tw-ring-offset-color:#fff;--univer-tw-ring-color:#93c5fd80;--univer-tw-ring-offset-shadow:0 0 #0000;--univer-tw-ring-shadow:0 0 #0000;--univer-tw-shadow:0 0 #0000;--univer-tw-shadow-colored:0 0 #0000;--univer-tw-blur: ;--univer-tw-brightness: ;--univer-tw-contrast: ;--univer-tw-grayscale: ;--univer-tw-hue-rotate: ;--univer-tw-invert: ;--univer-tw-saturate: ;--univer-tw-sepia: ;--univer-tw-drop-shadow: ;--univer-tw-backdrop-blur: ;--univer-tw-backdrop-brightness: ;--univer-tw-backdrop-contrast: ;--univer-tw-backdrop-grayscale: ;--univer-tw-backdrop-hue-rotate: ;--univer-tw-backdrop-invert: ;--univer-tw-backdrop-opacity: ;--univer-tw-backdrop-saturate: ;--univer-tw-backdrop-sepia: ;--univer-tw-contain-size: ;--univer-tw-contain-layout: ;--univer-tw-contain-paint: ;--univer-tw-contain-style: }*{scrollbar-color:initial;scrollbar-width:initial}.univer-sr-only{clip:rect(0,0,0,0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.univer-inset-x-0{left:0;right:0}.univer-bottom-0\\.5{bottom:.125rem}.univer-bottom-6{bottom:1.5rem}.univer-left-0\\.5{left:.125rem}.univer-left-2{left:.5rem}.univer-left-\\[-16px\\]{left:-16px}.univer-right-4{right:1rem}.univer-right-px{right:1px}.univer-top-px{top:1px}.univer-z-0{z-index:0}.univer-z-\\[1081\\]{z-index:1081}.-univer-mx-1{margin-left:-.25rem;margin-right:-.25rem}.univer-ml-auto{margin-left:auto}.\\!univer-hidden{display:none!important}.univer-size-2{width:.5rem;height:.5rem}.univer-size-2\\.5{width:.625rem;height:.625rem}.univer-h-1\\/2{height:50%}.univer-h-12{height:3rem}.univer-h-2{height:.5rem}.univer-h-32{height:8rem}.univer-h-48{height:12rem}.univer-h-\\[150px\\]{height:150px}.univer-h-\\[calc\\(100\\%-2px\\)\\]{height:calc(100% - 2px)}.univer-max-h-0{max-height:0}.univer-max-h-\\[--radix-popper-available-height\\]{max-height:var(--radix-popper-available-height)}.univer-max-h-\\[1000px\\]{max-height:1000px}.univer-max-h-\\[40vh\\]{max-height:40vh}.univer-max-h-full{max-height:100%}.univer-max-h-screen{max-height:100vh}.univer-min-h-3\\.5{min-height:.875rem}.univer-min-h-\\[520px\\]{min-height:520px}.\\!univer-w-fit{width:fit-content!important}.univer-w-64{width:16rem}.univer-w-72{width:18rem}.univer-w-80{width:20rem}.univer-w-\\[calc\\(100\\%-16px\\)\\]{width:calc(100% - 16px)}.univer-min-w-36{min-width:9rem}.univer-min-w-\\[320px\\]{min-width:320px}.univer-max-w-2xl{max-width:42rem}.univer-max-w-\\[520px\\]{max-width:520px}.univer-max-w-\\[60vw\\]{max-width:60vw}.univer-max-w-sm{max-width:24rem}.univer-max-w-xs{max-width:20rem}.univer-shrink{flex-shrink:1}.univer-shrink-0{flex-shrink:0}.univer-origin-\\[--radix-hover-card-content-transform-origin\\]{transform-origin:var(--radix-hover-card-content-transform-origin)}.-univer-translate-y-1\\/2,.univer--translate-y-1\\/2{--univer-tw-translate-y:-50%;transform:translate(var(--univer-tw-translate-x),-50%) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y));transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y))}.univer-translate-x-3{--univer-tw-translate-x:.75rem;transform:translate(.75rem,var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y));transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y))}.-univer-rotate-90{--univer-tw-rotate:-90deg;transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(-90deg) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y));transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y))}.univer-rotate-0{--univer-tw-rotate:0deg;transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(0) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y));transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y))}.univer-rotate-45{--univer-tw-rotate:45deg;transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(45deg) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y));transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y))}.univer-rotate-\\[-90deg\\]{--univer-tw-rotate:-90deg;transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(-90deg) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y));transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y))}.\\!univer-animate-none{animation:none!important}.univer-cursor-crosshair{cursor:crosshair}.univer-cursor-grabbing{cursor:grabbing}.univer-resize{resize:both}.univer-grid-flow-row{grid-auto-flow:row}.univer-grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.univer-flex-col-reverse{flex-direction:column-reverse}.univer-content-center{align-content:center}.univer-gap-5{gap:1.25rem}.univer-space-y-1\\.5>:not([hidden])~:not([hidden]){--univer-tw-space-y-reverse:0;margin-top:calc(.375rem * (1 - var(--univer-tw-space-y-reverse)));margin-top:.375rem;margin-top:calc(.375rem * calc(1 - var(--univer-tw-space-y-reverse)));margin-bottom:0;margin-bottom:calc(.375rem * var(--univer-tw-space-y-reverse))}.univer-divide-x>:not([hidden])~:not([hidden]){--univer-tw-divide-x-reverse:0;border-right-width:0;border-right-width:calc(1px * var(--univer-tw-divide-x-reverse));border-left-width:calc(1px * (1 - var(--univer-tw-divide-x-reverse)));border-left-width:1px;border-left-width:calc(1px * calc(1 - var(--univer-tw-divide-x-reverse)))}.univer-divide-y-0>:not([hidden])~:not([hidden]){--univer-tw-divide-y-reverse:0;border-top-width:calc(0px * (1 - var(--univer-tw-divide-y-reverse)));border-top-width:0;border-top-width:calc(0px * calc(1 - var(--univer-tw-divide-y-reverse)));border-bottom-width:0;border-bottom-width:calc(0px * var(--univer-tw-divide-y-reverse))}.univer-text-ellipsis{text-overflow:ellipsis}.univer-text-balance{text-wrap:balance}.\\!univer-rounded-b-none{border-bottom-right-radius:0!important;border-bottom-left-radius:0!important}.\\!univer-rounded-l-none{border-top-left-radius:0!important;border-bottom-left-radius:0!important}.\\!univer-rounded-r-none{border-top-right-radius:0!important;border-bottom-right-radius:0!important}.\\!univer-rounded-t-none{border-top-left-radius:0!important;border-top-right-radius:0!important}.univer-rounded-r-md{border-top-right-radius:.375rem;border-bottom-right-radius:.375rem}.\\!univer-border-l-0{border-left-width:0!important}.\\!univer-border-t-0{border-top-width:0!important}.univer-border-b-0{border-bottom-width:0}.univer-border-l{border-left-width:1px}.univer-border-l-0{border-left-width:0}.univer-border-r{border-right-width:1px}.univer-border-t-0{border-top-width:0}.univer-border-dashed{border-style:dashed}.\\!univer-border-gray-200{border-color:var(--univer-gray-200)!important}.univer-border-gray-300{border-color:var(--univer-gray-300)}.univer-border-primary-200{border-color:var(--univer-primary-200)}.univer-border-primary-300{border-color:var(--univer-primary-300)}.univer-border-red-300{border-color:var(--univer-red-300)}.univer-border-red-500{border-color:var(--univer-red-500)}.univer-border-white{border-color:var(--univer-white)}.\\!univer-bg-primary-600{background-color:var(--univer-primary-600)!important}.univer-bg-\\[rgba\\(0\\,0\\,0\\,0\\.8\\)\\]{background-color:#000c}.univer-bg-gray-800{background-color:var(--univer-gray-800)}.univer-bg-gray-900{background-color:var(--univer-gray-900)}.univer-bg-primary-500{background-color:var(--univer-primary-500)}.univer-bg-red-500{background-color:var(--univer-red-500)}.univer-bg-sky-100\\/70{background-color:#e0f2feb3}.univer-bg-slate-100\\/80{background-color:#f1f5f9cc}.univer-bg-slate-900\\/90{background-color:#0f172ae6}.univer-bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--univer-tw-gradient-stops))}.univer-from-slate-100{--univer-tw-gradient-from:#f1f5f9 var(--univer-tw-gradient-from-position);--univer-tw-gradient-to:#f1f5f900 var(--univer-tw-gradient-to-position);--univer-tw-gradient-stops:var(--univer-tw-gradient-from), var(--univer-tw-gradient-to)}.univer-via-cyan-50{--univer-tw-gradient-to:#ecfeff00 var(--univer-tw-gradient-to-position);--univer-tw-gradient-stops:var(--univer-tw-gradient-from), #ecfeff var(--univer-tw-gradient-via-position), var(--univer-tw-gradient-to)}.univer-to-blue-100{--univer-tw-gradient-to:var(--univer-blue-100) var(--univer-tw-gradient-to-position)}.univer-fill-current{fill:currentColor}.\\!univer-p-2\\.5{padding:.625rem!important}.univer-p-6{padding:1.5rem}.\\!univer-pl-4{padding-left:1rem!important}.univer-pb-2\\.5{padding-bottom:.625rem}.univer-pl-8{padding-left:2rem}.univer-pr-32{padding-right:8rem}.univer-pr-8{padding-right:2rem}.univer-pt-4{padding-top:1rem}.univer-align-middle{vertical-align:middle}.univer-font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.univer-text-\\[13px\\]{font-size:13px}.univer-text-\\[8px\\]{font-size:8px}.univer-text-sm\\/8{font-size:.875rem;line-height:2rem}.univer-text-xs\\/6{font-size:.75rem;line-height:1.5rem}.univer-leading-9{line-height:2.25rem}.univer-leading-normal{line-height:1.5}.univer-tracking-wide{letter-spacing:.025em}.univer-tracking-widest{letter-spacing:.1em}.\\!univer-text-primary-500{color:var(--univer-primary-500)!important}.univer-text-amber-500{--univer-tw-text-opacity:1;color:rgba(245,158,11,var(--univer-tw-text-opacity,1))}.univer-text-cyan-700{--univer-tw-text-opacity:1;color:rgba(14,116,144,var(--univer-tw-text-opacity,1))}.univer-text-sky-500{--univer-tw-text-opacity:1;color:rgba(14,165,233,var(--univer-tw-text-opacity,1))}.univer-text-sky-700{--univer-tw-text-opacity:1;color:rgba(3,105,161,var(--univer-tw-text-opacity,1))}.univer-text-sky-900{--univer-tw-text-opacity:1;color:rgba(12,74,110,var(--univer-tw-text-opacity,1))}.univer-text-slate-500{--univer-tw-text-opacity:1;color:rgba(100,116,139,var(--univer-tw-text-opacity,1))}.univer-text-slate-600{--univer-tw-text-opacity:1;color:rgba(71,85,105,var(--univer-tw-text-opacity,1))}.univer-text-slate-700{--univer-tw-text-opacity:1;color:rgba(51,65,85,var(--univer-tw-text-opacity,1))}.univer-text-slate-800{--univer-tw-text-opacity:1;color:rgba(30,41,59,var(--univer-tw-text-opacity,1))}.univer-text-violet-500{--univer-tw-text-opacity:1;color:rgba(139,92,246,var(--univer-tw-text-opacity,1))}.univer-underline-offset-4{text-underline-offset:4px}.univer-opacity-100{opacity:1}.univer-opacity-50{opacity:.5}.univer-opacity-80{opacity:.8}.univer-shadow-\\[0_30px_60px_-35px_rgba\\(15\\,23\\,42\\,0\\.55\\)\\]{--univer-tw-shadow:0 30px 60px -35px #0f172a8c;--univer-tw-shadow-colored:0 30px 60px -35px var(--univer-tw-shadow-color);box-shadow:0 0 #0000,0 0 #0000,0 30px 60px -35px #0f172a8c;box-shadow:var(--univer-tw-ring-offset-shadow,0 0 #0000),var(--univer-tw-ring-shadow,0 0 #0000),var(--univer-tw-shadow)}.univer-shadow-inner{--univer-tw-shadow:inset 0 2px 4px 0 #0000000d;--univer-tw-shadow-colored:inset 0 2px 4px 0 var(--univer-tw-shadow-color);box-shadow:0 0 #0000,0 0 #0000,inset 0 2px 4px #0000000d;box-shadow:var(--univer-tw-ring-offset-shadow,0 0 #0000),var(--univer-tw-ring-shadow,0 0 #0000),var(--univer-tw-shadow)}.univer-ring-2{--univer-tw-ring-offset-shadow:var(--univer-tw-ring-inset) 0 0 0 var(--univer-tw-ring-offset-width) var(--univer-tw-ring-offset-color);--univer-tw-ring-shadow:var(--univer-tw-ring-inset) 0 0 0 calc(2px + var(--univer-tw-ring-offset-width)) var(--univer-tw-ring-color);box-shadow:var(--univer-tw-ring-offset-shadow),var(--univer-tw-ring-shadow),0 0 #0000;box-shadow:var(--univer-tw-ring-offset-shadow),var(--univer-tw-ring-shadow),var(--univer-tw-shadow,0 0 #0000)}.\\!univer-ring-primary-900{--univer-tw-ring-color:var(--univer-primary-900)!important}.univer-ring-primary-50{--univer-tw-ring-color:var(--univer-primary-50)}.univer-ring-white{--univer-tw-ring-color:var(--univer-white)}.univer-ring-offset-2{--univer-tw-ring-offset-width:2px}.\\!univer-ring-offset-gray-600{--univer-tw-ring-offset-color:var(--univer-gray-600)!important}.univer-ring-offset-white{--univer-tw-ring-offset-color:var(--univer-white)}.univer-drop-shadow-sm{--univer-tw-drop-shadow:drop-shadow(0 1px 1px #0000000d);filter:var(--univer-tw-blur) var(--univer-tw-brightness) var(--univer-tw-contrast) var(--univer-tw-grayscale) var(--univer-tw-hue-rotate) var(--univer-tw-invert) var(--univer-tw-saturate) var(--univer-tw-sepia) var(--univer-tw-drop-shadow)}.univer-transition-\\[color\\,box-shadow\\]{transition-property:color,box-shadow;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.univer-transition-\\[max-height\\,opacity\\]{transition-property:max-height,opacity;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.univer-transition-opacity{transition-property:opacity;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.univer-transition-transform{transition-property:transform;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.univer-duration-150{transition-duration:.15s}.univer-duration-500{transition-duration:.5s}.univer-duration-75{transition-duration:75ms}.univer-ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.univer-ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.univer-will-change-transform{will-change:transform}.univer-scrollbar-thin::-webkit-scrollbar-track{background-color:var(--scrollbar-track);border-radius:var(--scrollbar-track-radius)}.univer-scrollbar-thin::-webkit-scrollbar-track:hover{background-color:var(--scrollbar-track-hover,var(--scrollbar-track))}.univer-scrollbar-thin::-webkit-scrollbar-track:active{background-color:var(--scrollbar-track-active,var(--scrollbar-track-hover,var(--scrollbar-track)))}.univer-scrollbar-thin::-webkit-scrollbar-thumb{background-color:var(--scrollbar-thumb);border-radius:var(--scrollbar-thumb-radius)}.univer-scrollbar-thin::-webkit-scrollbar-thumb:hover{background-color:var(--scrollbar-thumb-hover,var(--scrollbar-thumb))}.univer-scrollbar-thin::-webkit-scrollbar-thumb:active{background-color:var(--scrollbar-thumb-active,var(--scrollbar-thumb-hover,var(--scrollbar-thumb)))}.univer-scrollbar-thin::-webkit-scrollbar-corner{background-color:var(--scrollbar-corner);border-radius:var(--scrollbar-corner-radius)}.univer-scrollbar-thin::-webkit-scrollbar-corner:hover{background-color:var(--scrollbar-corner-hover,var(--scrollbar-corner))}.univer-scrollbar-thin::-webkit-scrollbar-corner:active{background-color:var(--scrollbar-corner-active,var(--scrollbar-corner-hover,var(--scrollbar-corner)))}.univer-scrollbar-thin{scrollbar-width:thin;scrollbar-color:initial initial;scrollbar-color:var(--scrollbar-thumb,initial) var(--scrollbar-track,initial)}.univer-scrollbar-thin::-webkit-scrollbar{width:8px;height:8px;display:block}.univer-scrollbar-track-gray-50{--scrollbar-track:var(--univer-gray-50)!important}.univer-scrollbar-thumb-gray-300{--scrollbar-thumb:var(--univer-gray-300)!important}.univer-animate-out{--univer-tw-exit-opacity:initial;--univer-tw-exit-scale:initial;--univer-tw-exit-rotate:initial;--univer-tw-exit-translate-x:initial;--univer-tw-exit-translate-y:initial;animation-name:exit;animation-duration:.15s}.univer-fade-in,.univer-fade-in-0{--univer-tw-enter-opacity:0}.univer-fade-out{--univer-tw-exit-opacity:0}.univer-zoom-in-95{--univer-tw-enter-scale:.95}.univer-duration-150{animation-duration:.15s}.univer-duration-200{animation-duration:.2s}.univer-duration-300{animation-duration:.3s}.univer-duration-500{animation-duration:.5s}.univer-duration-75{animation-duration:75ms}.univer-ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.univer-ease-out{animation-timing-function:cubic-bezier(0,0,.2,1)}.placeholder\\:univer-text-gray-200::placeholder{color:var(--univer-gray-200)}.placeholder\\:univer-text-gray-400::placeholder{color:var(--univer-gray-400)}.before\\:univer-absolute:before{content:var(--univer-tw-content);position:absolute}.before\\:univer-top-1\\/2:before{content:var(--univer-tw-content);top:50%}.before\\:univer-block:before{content:var(--univer-tw-content);display:block}.before\\:univer-h-px:before{content:var(--univer-tw-content);height:1px}.before\\:univer-w-full:before{content:var(--univer-tw-content);width:100%}.before\\:-univer-translate-y-1\\/2:before{content:var(--univer-tw-content);--univer-tw-translate-y:-50%;transform:translate(var(--univer-tw-translate-x),-50%) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y));transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y))}.before\\:univer-bg-gray-200:before{content:var(--univer-tw-content);background-color:var(--univer-gray-200)}.before\\:univer-content-\\[\\"\\"\\]:before{--univer-tw-content:"";content:"";content:var(--univer-tw-content)}.data-\\[disabled\\]\\:univer-pointer-events-none[data-disabled]{pointer-events:none}.data-\\[orientation\\=horizontal\\]\\:univer-h-px[data-orientation=horizontal]{height:1px}.data-\\[orientation\\=vertical\\]\\:univer-h-full[data-orientation=vertical]{height:100%}.data-\\[orientation\\=horizontal\\]\\:univer-w-full[data-orientation=horizontal]{width:100%}.data-\\[orientation\\=vertical\\]\\:univer-w-px[data-orientation=vertical]{width:1px}.data-\\[state\\=open\\]\\:univer-bg-gray-100[data-state=open]{background-color:var(--univer-gray-100)}.data-\\[disabled\\]\\:univer-opacity-50[data-disabled]{opacity:.5}.data-\\[state\\=open\\]\\:univer-animate-in[data-state=open]{--univer-tw-enter-opacity:initial;--univer-tw-enter-scale:initial;--univer-tw-enter-rotate:initial;--univer-tw-enter-translate-x:initial;--univer-tw-enter-translate-y:initial;animation-name:enter;animation-duration:.15s}.data-\\[state\\=closed\\]\\:univer-animate-out[data-state=closed]{--univer-tw-exit-opacity:initial;--univer-tw-exit-scale:initial;--univer-tw-exit-rotate:initial;--univer-tw-exit-translate-x:initial;--univer-tw-exit-translate-y:initial;animation-name:exit;animation-duration:.15s}.data-\\[state\\=closed\\]\\:univer-fade-out-0[data-state=closed]{--univer-tw-exit-opacity:0}.data-\\[state\\=open\\]\\:univer-fade-in-0[data-state=open]{--univer-tw-enter-opacity:0}.data-\\[state\\=closed\\]\\:univer-zoom-out-95[data-state=closed]{--univer-tw-exit-scale:.95}.data-\\[state\\=open\\]\\:univer-zoom-in-95[data-state=open]{--univer-tw-enter-scale:.95}.data-\\[side\\=bottom\\]\\:univer-slide-in-from-top-2[data-side=bottom]{--univer-tw-enter-translate-y:-.5rem}.data-\\[side\\=left\\]\\:univer-slide-in-from-right-2[data-side=left]{--univer-tw-enter-translate-x:.5rem}.data-\\[side\\=right\\]\\:univer-slide-in-from-left-2[data-side=right]{--univer-tw-enter-translate-x:-.5rem}.data-\\[side\\=top\\]\\:univer-slide-in-from-bottom-2[data-side=top]{--univer-tw-enter-translate-y:.5rem}.data-\\[state\\=closed\\]\\:univer-slide-out-to-left-1\\/2[data-state=closed]{--univer-tw-exit-translate-x:-50%}.data-\\[state\\=closed\\]\\:univer-slide-out-to-top-\\[48\\%\\][data-state=closed]{--univer-tw-exit-translate-y:-48%}.data-\\[state\\=open\\]\\:univer-slide-in-from-left-1\\/2[data-state=open]{--univer-tw-enter-translate-x:-50%}.data-\\[state\\=open\\]\\:univer-slide-in-from-top-\\[48\\%\\][data-state=open]{--univer-tw-enter-translate-y:-48%}.hover\\:univer-border-red-400:hover{border-color:var(--univer-red-400)}.hover\\:univer-border-transparent:hover{border-color:#0000}.hover\\:univer-bg-primary-500:hover{background-color:var(--univer-primary-500)}.hover\\:univer-bg-red-400:hover{background-color:var(--univer-red-400)}.hover\\:univer-text-gray-500:hover{color:var(--univer-gray-500)}.hover\\:univer-text-primary-500:hover{color:var(--univer-primary-500)}.hover\\:univer-text-white:hover{color:var(--univer-white)}.hover\\:univer-underline:hover{text-decoration-line:underline}.hover\\:univer-opacity-100:hover{opacity:1}.hover\\:univer-opacity-70:hover{opacity:.7}.hover\\:univer-opacity-80:hover{opacity:.8}.focus\\:univer-border-primary-600:focus{border-color:var(--univer-primary-600)}.focus\\:univer-bg-gray-100:focus{background-color:var(--univer-gray-100)}.focus\\:univer-ring-primary-50:focus{--univer-tw-ring-color:var(--univer-primary-50)}.active\\:univer-border-red-600:active{border-color:var(--univer-red-600)}.active\\:univer-bg-primary-700:active{background-color:var(--univer-primary-700)}.active\\:univer-bg-red-600:active{background-color:var(--univer-red-600)}.active\\:univer-text-primary-700:active{color:var(--univer-primary-700)}.disabled\\:univer-pointer-events-none:disabled{pointer-events:none}.disabled\\:univer-opacity-50:disabled{opacity:.5}@media (width>=640px){.sm\\:\\!univer-flex-row{flex-direction:row!important}.sm\\:\\!univer-justify-end{justify-content:flex-end!important}.sm\\:\\!univer-space-x-2>:not([hidden])~:not([hidden]){--univer-tw-space-x-reverse:0!important;margin-right:0!important;margin-right:calc(.5rem * var(--univer-tw-space-x-reverse))!important;margin-left:calc(.5rem * (1 - var(--univer-tw-space-x-reverse)))!important;margin-left:.5rem!important;margin-left:calc(.5rem * calc(1 - var(--univer-tw-space-x-reverse)))!important}.sm\\:\\!univer-rounded-lg{border-radius:.5rem!important}.sm\\:\\!univer-text-left{text-align:left!important}}@media (width>=768px){.md\\:univer-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}.rtl\\:univer-left-px:where([dir=rtl],[dir=rtl] *){left:1px}.rtl\\:univer-right-auto:where([dir=rtl],[dir=rtl] *){right:auto}.rtl\\:univer-rounded-l-md:where([dir=rtl],[dir=rtl] *){border-top-left-radius:.375rem;border-bottom-left-radius:.375rem}.rtl\\:univer-rounded-r-none:where([dir=rtl],[dir=rtl] *){border-top-right-radius:0;border-bottom-right-radius:0}.rtl\\:univer-border-l-0:where([dir=rtl],[dir=rtl] *){border-left-width:0}.rtl\\:univer-border-r:where([dir=rtl],[dir=rtl] *){border-right-width:1px}.dark\\:\\!univer-border-gray-500:where(.univer-dark,.univer-dark *){border-color:var(--univer-gray-500)!important}.dark\\:\\!univer-border-primary-700:where(.univer-dark,.univer-dark *){border-color:var(--univer-primary-700)!important}.dark\\:\\!univer-bg-gray-100:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-100)!important}.dark\\:\\!univer-bg-primary-600:where(.univer-dark,.univer-dark *){background-color:var(--univer-primary-600)!important}.dark\\:\\!univer-text-gray-900:where(.univer-dark,.univer-dark *){color:var(--univer-gray-900)!important}.dark\\:\\!univer-text-primary-500:where(.univer-dark,.univer-dark *){color:var(--univer-primary-500)!important}.dark\\:\\!univer-text-sky-400:where(.univer-dark,.univer-dark *){--univer-tw-text-opacity:1!important;color:rgba(56,189,248,var(--univer-tw-text-opacity,1))!important}.dark\\:\\!univer-ring-primary-600:where(.univer-dark,.univer-dark *){--univer-tw-ring-color:var(--univer-primary-600)!important}.dark\\:\\!univer-ring-primary-900:where(.univer-dark,.univer-dark *){--univer-tw-ring-color:var(--univer-primary-900)!important}.dark\\:\\!univer-ring-offset-gray-600:where(.univer-dark,.univer-dark *){--univer-tw-ring-offset-color:var(--univer-gray-600)!important}.dark\\:\\!univer-scrollbar-track-gray-900:where(.univer-dark,.univer-dark *){--scrollbar-track:var(--univer-gray-900)!important}.dark\\:\\!univer-scrollbar-thumb-gray-700:where(.univer-dark,.univer-dark *){--scrollbar-thumb:var(--univer-gray-700)!important}.dark\\:before\\:\\!univer-bg-gray-600:where(.univer-dark,.univer-dark *):before{content:var(--univer-tw-content);background-color:var(--univer-gray-600)!important}.dark\\:data-\\[state\\=open\\]\\:\\!univer-bg-gray-600[data-state=open]:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-600)!important}.dark\\:hover\\:\\!univer-text-white:hover:where(.univer-dark,.univer-dark *){color:var(--univer-white)!important}.dark\\:focus\\:\\!univer-border-primary-500:focus:where(.univer-dark,.univer-dark *){border-color:var(--univer-primary-500)!important}.dark\\:focus\\:\\!univer-bg-gray-600:focus:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-600)!important}.dark\\:focus\\:\\!univer-ring-primary-900:focus:where(.univer-dark,.univer-dark *){--univer-tw-ring-color:var(--univer-primary-900)!important}.dark\\:focus-visible\\:\\!univer-border-gray-600:focus-visible:where(.univer-dark,.univer-dark *){border-color:var(--univer-gray-600)!important}.dark\\:active\\:\\!univer-bg-gray-700:active:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-700)!important}.\\[\\&\\:\\:-webkit-calendar-picker-indicator\\]\\:univer-hidden::-webkit-calendar-picker-indicator{display:none}.\\[\\&\\:\\:-webkit-calendar-picker-indicator\\]\\:univer-appearance-none::-webkit-calendar-picker-indicator{appearance:none}.\\[\\&\\>input\\]\\:univer-w-11>input{width:2.75rem}.\\[\\&\\>input\\]\\:univer-border-gray-200>input{border-color:var(--univer-gray-200)}.\\[\\&\\>input\\]\\:focus\\:univer-border-primary-500:focus>input{border-color:var(--univer-primary-500)}.dark\\:\\[\\&\\>input\\]\\:\\!univer-border-gray-600>input:where(.univer-dark,.univer-dark *){border-color:var(--univer-gray-600)!important}.dark\\:\\[\\&\\>input\\]\\:\\!univer-text-white>input:where(.univer-dark,.univer-dark *){color:var(--univer-white)!important}.\\[\\&\\>svg\\]\\:univer-block>svg{display:block}.\\[\\&\\>svg\\]\\:univer-size-4>svg{width:1rem;height:1rem}.\\[\\&\\>ul\\:not\\(\\:last-child\\)\\]\\:univer-border-0>ul:not(:last-child){border-width:0}.\\[\\&\\>ul\\:not\\(\\:last-child\\)\\]\\:univer-border-r>ul:not(:last-child){border-right-width:1px}.\\[\\&\\>ul\\:not\\(\\:last-child\\)\\]\\:univer-border-solid>ul:not(:last-child){border-style:solid}.\\[\\&\\>ul\\:not\\(\\:last-child\\)\\]\\:univer-border-r-gray-200>ul:not(:last-child){border-right-color:var(--univer-gray-200)}.\\[\\&_\\[data-description\\]\\]\\:univer-text-sm [data-description]{font-size:.875rem;line-height:1.25rem}.\\[\\&_\\[data-description\\]\\]\\:univer-text-gray-200 [data-description]{color:var(--univer-gray-200)}.\\[\\&_\\[data-description\\]\\]\\:univer-text-gray-600 [data-description]{color:var(--univer-gray-600)}.\\[\\&_\\[data-icon\\]\\>svg\\]\\:univer-relative [data-icon]>svg{position:relative}.\\[\\&_\\[data-icon\\]\\>svg\\]\\:univer-top-1 [data-icon]>svg{top:.25rem}.\\[\\&_\\[data-icon\\]\\]\\:univer-self-baseline [data-icon]{align-self:baseline}.\\[\\&_\\[data-icon\\]\\]\\:univer-text-amber-500 [data-icon]{--univer-tw-text-opacity:1;color:rgba(245,158,11,var(--univer-tw-text-opacity,1))}.\\[\\&_\\[data-icon\\]\\]\\:univer-text-green-500 [data-icon]{color:var(--univer-green-500)}.\\[\\&_\\[data-icon\\]\\]\\:univer-text-primary-600 [data-icon]{color:var(--univer-primary-600)}.\\[\\&_\\[data-icon\\]\\]\\:univer-text-red-500 [data-icon]{color:var(--univer-red-500)}.\\[\\&_\\[data-icon\\]\\]\\:univer-text-sky-500 [data-icon]{--univer-tw-text-opacity:1;color:rgba(14,165,233,var(--univer-tw-text-opacity,1))}.\\[\\&_\\[data-icon\\]\\]\\:univer-text-violet-500 [data-icon]{--univer-tw-text-opacity:1;color:rgba(139,92,246,var(--univer-tw-text-opacity,1))}.\\[\\&_\\[data-icon\\]\\]\\:univer-text-yellow-500 [data-icon]{color:var(--univer-yellow-500)}.\\[\\&_\\[data-sonner-toast\\]\\]\\:univer-rounded-2xl [data-sonner-toast]{border-radius:1rem}.\\[\\&_\\[data-sonner-toast\\]\\]\\:univer-border [data-sonner-toast]{border-width:1px}.\\[\\&_\\[data-sonner-toast\\]\\]\\:univer-border-solid [data-sonner-toast]{border-style:solid}.\\[\\&_\\[data-sonner-toast\\]\\]\\:univer-border-gray-200 [data-sonner-toast]{border-color:var(--univer-gray-200)}.\\[\\&_\\[data-sonner-toast\\]\\]\\:univer-shadow-\\[0_16px_40px_-20px_rgba\\(15\\,23\\,42\\,0\\.55\\)\\] [data-sonner-toast]{--univer-tw-shadow:0 16px 40px -20px #0f172a8c;--univer-tw-shadow-colored:0 16px 40px -20px var(--univer-tw-shadow-color);box-shadow:0 0 #0000,0 0 #0000,0 16px 40px -20px #0f172a8c;box-shadow:var(--univer-tw-ring-offset-shadow,0 0 #0000),var(--univer-tw-ring-shadow,0 0 #0000),var(--univer-tw-shadow)}.\\[\\&_\\[data-sonner-toast\\]\\]\\:univer-shadow-md [data-sonner-toast]{--univer-tw-shadow:0px 1px 6px -2px #1e284d14, 0px 2px 6px -1px #1e284d1a;--univer-tw-shadow-colored:0px 1px 6px -2px var(--univer-tw-shadow-color), 0px 2px 6px -1px var(--univer-tw-shadow-color);box-shadow:0 0 #0000,0 0 #0000,0 1px 6px -2px #1e284d14,0 2px 6px -1px #1e284d1a;box-shadow:var(--univer-tw-ring-offset-shadow,0 0 #0000),var(--univer-tw-ring-shadow,0 0 #0000),var(--univer-tw-shadow)}.\\[\\&_\\[data-sonner-toast\\]\\]\\:univer-backdrop-blur-sm [data-sonner-toast]{--univer-tw-backdrop-blur:blur(4px);-webkit-backdrop-filter:var(--univer-tw-backdrop-blur) var(--univer-tw-backdrop-brightness) var(--univer-tw-backdrop-contrast) var(--univer-tw-backdrop-grayscale) var(--univer-tw-backdrop-hue-rotate) var(--univer-tw-backdrop-invert) var(--univer-tw-backdrop-opacity) var(--univer-tw-backdrop-saturate) var(--univer-tw-backdrop-sepia);backdrop-filter:var(--univer-tw-backdrop-blur) var(--univer-tw-backdrop-brightness) var(--univer-tw-backdrop-contrast) var(--univer-tw-backdrop-grayscale) var(--univer-tw-backdrop-hue-rotate) var(--univer-tw-backdrop-invert) var(--univer-tw-backdrop-opacity) var(--univer-tw-backdrop-saturate) var(--univer-tw-backdrop-sepia)}.dark\\:\\[\\&_\\[data-sonner-toast\\]\\]\\:\\!univer-border-gray-600 [data-sonner-toast]:where(.univer-dark,.univer-dark *){border-color:var(--univer-gray-600)!important}.\\[\\&_\\[data-title\\]\\]\\:univer-text-sm [data-title]{font-size:.875rem;line-height:1.25rem}.\\[\\&_\\[data-title\\]\\]\\:univer-text-gray-900 [data-title]{color:var(--univer-gray-900)}.\\[\\&_\\[data-u-comp\\=form-layout\\]\\]\\:univer-max-w-\\[calc\\(50\\%-8px\\)\\] [data-u-comp=form-layout]{max-width:calc(50% - 8px)}.\\[\\&_\\[data-u-comp\\=form-layout\\]\\]\\:univer-shrink [data-u-comp=form-layout]{flex-shrink:1}.\\[\\&_\\[data-u-comp\\=form-layout\\]\\]\\:univer-grow [data-u-comp=form-layout]{flex-grow:1}.\\[\\&_\\[data-u-comp\\=input\\]\\]\\:univer-w-full [data-u-comp=input]{width:100%}.\\[\\&_\\[data-u-comp\\=input\\]\\]\\:univer-border-red-500 [data-u-comp=input]{border-color:var(--univer-red-500)}.\\[\\&_\\[data-u-comp\\=pager-left-arrow\\]\\:hover\\]\\:\\!univer-bg-gray-600 [data-u-comp=pager-left-arrow]:hover,.\\[\\&_\\[data-u-comp\\=pager-right-arrow\\]\\:hover\\]\\:\\!univer-bg-gray-600 [data-u-comp=pager-right-arrow]:hover{background-color:var(--univer-gray-600)!important}.\\[\\&_\\[data-u-comp\\=select\\]\\]\\:univer-w-full [data-u-comp=select]{width:100%}.\\[\\&_\\[data-u-comp\\=select\\]\\]\\:univer-border-red-500 [data-u-comp=select]{border-color:var(--univer-red-500)}.\\[\\&_input\\]\\:univer-box-border input{box-sizing:border-box}.\\[\\&_input\\]\\:univer-flex input{display:flex}.\\[\\&_input\\]\\:univer-h-7 input{height:1.75rem}.\\[\\&_input\\]\\:univer-items-center input{align-items:center}.\\[\\&_input\\]\\:univer-rounded input{border-radius:.25rem}.\\[\\&_input\\]\\:univer-border input{border-width:1px}.\\[\\&_input\\]\\:univer-border-solid input{border-style:solid}.\\[\\&_input\\]\\:univer-border-gray-200 input{border-color:var(--univer-gray-200)}.\\[\\&_input\\]\\:univer-border-gray-600 input{border-color:var(--univer-gray-600)}.\\[\\&_input\\]\\:univer-bg-transparent input{background-color:#0000}.\\[\\&_input\\]\\:univer-px-1\\.5 input{padding-left:.375rem;padding-right:.375rem}.\\[\\&_input\\]\\:univer-text-gray-700 input{color:var(--univer-gray-700)}.\\[\\&_input\\]\\:univer-text-white input{color:var(--univer-white)}.\\[\\&_input\\]\\:univer-outline-none input{outline-offset:2px;outline:2px solid #0000}.\\[\\&_svg\\]\\:univer-pointer-events-none svg{pointer-events:none}.\\[\\&_svg\\]\\:univer-size-4 svg{width:1rem;height:1rem}.\\[\\&_svg\\]\\:univer-shrink-0 svg{flex-shrink:0}.univer-popup{z-index:1070;--univer-tw-shadow:0 1px 3px 0 #0000001a, 0 1px 2px -1px #0000001a;--univer-tw-shadow-colored:0 1px 3px 0 var(--univer-tw-shadow-color), 0 1px 2px -1px var(--univer-tw-shadow-color);box-shadow:0 0 #0000,0 0 #0000,0 1px 3px #0000001a,0 1px 2px -1px #0000001a;box-shadow:var(--univer-tw-ring-offset-shadow,0 0 #0000),var(--univer-tw-ring-shadow,0 0 #0000),var(--univer-tw-shadow);border-radius:6px;position:fixed;top:-9999px;left:-9999px;overflow:hidden}.univer-popup-enter{transform-origin:0 0;opacity:0;animation-duration:.15s;animation-timing-function:cubic-bezier(.08,.82,.17,1);animation-play-state:paused;animation-fill-mode:both}.univer-popup-enter-active{animation-name:popup-slide-up-in;animation-play-state:running}.univer-popup-exit{transform-origin:0 0;opacity:1;animation-name:popup-slide-up-out;animation-duration:.15s;animation-timing-function:cubic-bezier(.6,.04,.98,.34);animation-play-state:running;animation-fill-mode:both}.univer-popup-exit-active{display:none}.univer-popup-mask{z-index:1060;position:fixed;inset:0}.univer-pointer-events-auto{pointer-events:auto}.univer-invisible{visibility:hidden}.univer-sticky{position:sticky}.-univer-left-\\[99999\\]{left:-99999px}.-univer-top-\\[99999\\]{top:-99999px}.univer-left-1\\/2{left:50%}.univer-left-\\[-9999px\\]{left:-9999px}.univer-right-2{right:.5rem}.univer-top-\\[-9999px\\]{top:-9999px}.univer-top-\\[calc\\(50\\%-6px\\)\\]{top:calc(50% - 6px)}.univer-z-20{z-index:20}.univer-z-\\[-1\\]{z-index:-1}.univer-z-\\[1020\\]{z-index:1020}.univer-z-\\[1080\\]{z-index:1080}.univer-z-\\[1\\]{z-index:1}.univer-mx-2{margin-left:.5rem;margin-right:.5rem}.univer-mx-auto{margin-left:auto;margin-right:auto}.univer-line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.\\!univer-size-3\\.5{width:.875rem!important;height:.875rem!important}.univer-size-12{width:3rem;height:3rem}.univer-size-3\\.5{width:.875rem;height:.875rem}.univer-size-7{width:1.75rem;height:1.75rem}.univer-size-9{width:2.25rem;height:2.25rem}.univer-h-0{height:0}.univer-max-h-\\[80vh\\]{max-height:80vh}.univer-max-h-\\[min\\(72vh\\,560px\\)\\]{max-height:min(72vh,560px)}.univer-min-h-\\[560px\\]{min-height:560px}.univer-min-h-\\[56px\\]{min-height:56px}.univer-w-0{width:0}.univer-w-1{width:.25rem}.univer-w-10{width:2.5rem}.univer-w-40{width:10rem}.univer-w-7{width:1.75rem}.univer-w-8{width:2rem}.univer-w-96{width:24rem}.univer-w-max{width:max-content}.univer-w-screen{width:100vw}.univer-min-w-52{min-width:13rem}.univer-min-w-6{min-width:1.5rem}.univer-min-w-min{min-width:min-content}.univer-max-w-3xl{max-width:48rem}.univer-max-w-5xl{max-width:64rem}.univer-max-w-96{max-width:24rem}.univer-max-w-\\[--radix-popper-available-width\\]{max-width:var(--radix-popper-available-width)}.univer-max-w-\\[32\\%\\]{max-width:32%}.univer-max-w-\\[560px\\]{max-width:560px}.univer-max-w-\\[calc\\(100vw-16px\\)\\]{max-width:calc(100vw - 16px)}.univer-max-w-full{max-width:100%}.univer-origin-center{transform-origin:50%}.-univer-translate-x-1\\/2{--univer-tw-translate-x:-50%;transform:translate(-50%,var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y));transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y))}.univer-translate-x-0{--univer-tw-translate-x:0px;transform:translateY(var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y));transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y))}.univer-translate-x-full{--univer-tw-translate-x:100%;transform:translate(100%,var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y));transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y))}.univer-cursor-col-resize{cursor:col-resize}.univer-grid-cols-\\[1fr\\]{grid-template-columns:1fr}.univer-grid-cols-\\[22px_minmax\\(0\\,1fr\\)_22px\\]{grid-template-columns:22px minmax(0,1fr) 22px}.univer-grid-cols-\\[28px_minmax\\(0\\,1fr\\)_auto\\]{grid-template-columns:28px minmax(0,1fr) auto}.univer-grid-cols-\\[32px_minmax\\(0\\,1fr\\)_32px\\]{grid-template-columns:32px minmax(0,1fr) 32px}.univer-grid-cols-\\[auto\\,1fr\\]{grid-template-columns:auto 1fr}.univer-grid-cols-\\[auto_1fr_auto\\]{grid-template-columns:auto 1fr auto}.univer-grid-rows-\\[100\\%\\]{grid-template-rows:100%}.univer-grid-rows-\\[auto_1fr\\]{grid-template-rows:auto 1fr}.univer-grid-rows-\\[auto_1fr_auto\\]{grid-template-rows:auto 1fr auto}.univer-flex-wrap{flex-wrap:wrap}.univer-items-end{align-items:flex-end}.univer-gap-0\\.5{gap:.125rem}.univer-overscroll-contain{overscroll-behavior:contain}.univer-scroll-smooth{scroll-behavior:smooth}.\\!univer-rounded-full{border-radius:9999px!important}.\\!univer-rounded-xl{border-radius:.75rem!important}.univer-rounded-2xl{border-radius:1rem}.univer-rounded-3xl{border-radius:1.5rem}.univer-rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.univer-rounded-t-\\[28px\\]{border-top-left-radius:28px;border-top-right-radius:28px}.univer-border-0{border-width:0}.\\!univer-bg-gray-200{background-color:var(--univer-gray-200)!important}.\\!univer-bg-gray-500{background-color:var(--univer-gray-500)!important}.univer-bg-\\[rgba\\(15\\,23\\,42\\,0\\.32\\)\\]{background-color:#0f172a52}.univer-bg-gray-700{background-color:var(--univer-gray-700)}.univer-bg-gradient-to-tr{background-image:linear-gradient(to top right,var(--univer-tw-gradient-stops))}.univer-from-slate-950{--univer-tw-gradient-from:#020617 var(--univer-tw-gradient-from-position);--univer-tw-gradient-to:#02061700 var(--univer-tw-gradient-to-position);--univer-tw-gradient-stops:var(--univer-tw-gradient-from), var(--univer-tw-gradient-to)}.univer-via-blue-950{--univer-tw-gradient-to:#17255400 var(--univer-tw-gradient-to-position);--univer-tw-gradient-stops:var(--univer-tw-gradient-from), #172554 var(--univer-tw-gradient-via-position), var(--univer-tw-gradient-to)}.univer-to-cyan-900{--univer-tw-gradient-to:#164e63 var(--univer-tw-gradient-to-position)}.univer-p-8{padding:2rem}.univer-px-0{padding-left:0;padding-right:0}.univer-px-0\\.5{padding-left:.125rem;padding-right:.125rem}.univer-px-3{padding-left:.75rem;padding-right:.75rem}.univer-pb-2{padding-bottom:.5rem}.univer-pl-2{padding-left:.5rem}.univer-pl-4{padding-left:1rem}.univer-pr-1\\.5{padding-right:.375rem}.univer-text-right{text-align:right}.univer-font-sans{font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.univer-text-2xl{font-size:1.5rem;line-height:2rem}.univer-uppercase{text-transform:uppercase}.univer-leading-4{line-height:1rem}.univer-leading-none{line-height:1}.univer-tracking-\\[0\\.08em\\]{letter-spacing:.08em}.univer-tracking-tight{letter-spacing:-.025em}.\\!univer-text-gray-600{color:var(--univer-gray-600)!important}.univer-text-current{color:currentColor}.univer-text-slate-200{--univer-tw-text-opacity:1;color:rgba(226,232,240,var(--univer-tw-text-opacity,1))}.univer-underline{text-decoration-line:underline}.univer-opacity-0{opacity:0}.univer-opacity-30{opacity:.3}.univer-opacity-40{opacity:.4}.univer-opacity-60{opacity:.6}.univer-shadow-\\[0_-16px_48px_rgba\\(15\\,23\\,42\\,0\\.18\\)\\]{--univer-tw-shadow:0 -16px 48px #0f172a2e;--univer-tw-shadow-colored:0 -16px 48px var(--univer-tw-shadow-color);box-shadow:0 0 #0000,0 0 #0000,0 -16px 48px #0f172a2e;box-shadow:var(--univer-tw-ring-offset-shadow,0 0 #0000),var(--univer-tw-ring-shadow,0 0 #0000),var(--univer-tw-shadow)}.univer-ring-0{--univer-tw-ring-offset-shadow:var(--univer-tw-ring-inset) 0 0 0 var(--univer-tw-ring-offset-width) var(--univer-tw-ring-offset-color);--univer-tw-ring-shadow:var(--univer-tw-ring-inset) 0 0 0 calc(0px + var(--univer-tw-ring-offset-width)) var(--univer-tw-ring-color);box-shadow:var(--univer-tw-ring-offset-shadow),var(--univer-tw-ring-shadow),0 0 #0000;box-shadow:var(--univer-tw-ring-offset-shadow),var(--univer-tw-ring-shadow),var(--univer-tw-shadow,0 0 #0000)}.univer-ring-primary-600{--univer-tw-ring-color:var(--univer-primary-600)}.univer-backdrop-blur-\\[2px\\]{--univer-tw-backdrop-blur:blur(2px);-webkit-backdrop-filter:var(--univer-tw-backdrop-blur) var(--univer-tw-backdrop-brightness) var(--univer-tw-backdrop-contrast) var(--univer-tw-backdrop-grayscale) var(--univer-tw-backdrop-hue-rotate) var(--univer-tw-backdrop-invert) var(--univer-tw-backdrop-opacity) var(--univer-tw-backdrop-saturate) var(--univer-tw-backdrop-sepia);backdrop-filter:var(--univer-tw-backdrop-blur) var(--univer-tw-backdrop-brightness) var(--univer-tw-backdrop-contrast) var(--univer-tw-backdrop-grayscale) var(--univer-tw-backdrop-hue-rotate) var(--univer-tw-backdrop-invert) var(--univer-tw-backdrop-opacity) var(--univer-tw-backdrop-saturate) var(--univer-tw-backdrop-sepia)}.univer-backdrop-blur-xl{--univer-tw-backdrop-blur:blur(24px);-webkit-backdrop-filter:var(--univer-tw-backdrop-blur) var(--univer-tw-backdrop-brightness) var(--univer-tw-backdrop-contrast) var(--univer-tw-backdrop-grayscale) var(--univer-tw-backdrop-hue-rotate) var(--univer-tw-backdrop-invert) var(--univer-tw-backdrop-opacity) var(--univer-tw-backdrop-saturate) var(--univer-tw-backdrop-sepia);backdrop-filter:var(--univer-tw-backdrop-blur) var(--univer-tw-backdrop-brightness) var(--univer-tw-backdrop-contrast) var(--univer-tw-backdrop-grayscale) var(--univer-tw-backdrop-hue-rotate) var(--univer-tw-backdrop-invert) var(--univer-tw-backdrop-opacity) var(--univer-tw-backdrop-saturate) var(--univer-tw-backdrop-sepia)}.univer-transition-\\[width\\]{transition-property:width;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.univer-animate-in{--univer-tw-enter-opacity:initial;--univer-tw-enter-scale:initial;--univer-tw-enter-rotate:initial;--univer-tw-enter-translate-x:initial;--univer-tw-enter-translate-y:initial;animation-name:enter;animation-duration:.15s}.univer-fade-in{--univer-tw-enter-opacity:0}.univer-fade-in-70{--univer-tw-enter-opacity:.7}.last\\:univer-border-b-0:last-child{border-bottom-width:0}.empty\\:univer-hidden:empty{display:none}.hover\\:univer-opacity-50:hover{opacity:.5}.focus\\:univer-bg-white:focus{background-color:var(--univer-white)}.focus\\:univer-ring-2:focus{--univer-tw-ring-offset-shadow:var(--univer-tw-ring-inset) 0 0 0 var(--univer-tw-ring-offset-width) var(--univer-tw-ring-offset-color);--univer-tw-ring-shadow:var(--univer-tw-ring-inset) 0 0 0 calc(2px + var(--univer-tw-ring-offset-width)) var(--univer-tw-ring-color);box-shadow:var(--univer-tw-ring-offset-shadow),var(--univer-tw-ring-shadow),0 0 #0000;box-shadow:var(--univer-tw-ring-offset-shadow),var(--univer-tw-ring-shadow),var(--univer-tw-shadow,0 0 #0000)}.focus-visible\\:univer-ring-primary-600:focus-visible{--univer-tw-ring-color:var(--univer-primary-600)}.focus-visible\\:univer-ring-offset-0:focus-visible{--univer-tw-ring-offset-width:0px}.active\\:univer-bg-gray-200:active{background-color:var(--univer-gray-200)}.enabled\\:hover\\:univer-bg-gray-50:hover:enabled{background-color:var(--univer-gray-50)}.enabled\\:active\\:univer-bg-gray-100:active:enabled{background-color:var(--univer-gray-100)}.disabled\\:univer-text-gray-300:disabled{color:var(--univer-gray-300)}.disabled\\:hover\\:univer-bg-transparent:hover:disabled{background-color:#0000}@media (width>=640px){.sm\\:\\!univer-block{display:block!important}}.rtl\\:univer-pl-1\\.5:where([dir=rtl],[dir=rtl] *){padding-left:.375rem}.rtl\\:univer-pr-0:where([dir=rtl],[dir=rtl] *){padding-right:0}.rtl\\:univer-pr-2:where([dir=rtl],[dir=rtl] *){padding-right:.5rem}.dark\\:\\!univer-bg-gray-200:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-200)!important}.dark\\:\\!univer-bg-primary-400:where(.univer-dark,.univer-dark *){background-color:var(--univer-primary-400)!important}.dark\\:\\!univer-text-gray-600:where(.univer-dark,.univer-dark *){color:var(--univer-gray-600)!important}.dark\\:\\!univer-text-gray-800:where(.univer-dark,.univer-dark *){color:var(--univer-gray-800)!important}.dark\\:\\!univer-text-primary-100:where(.univer-dark,.univer-dark *){color:var(--univer-primary-100)!important}.dark\\:\\!univer-text-primary-400:where(.univer-dark,.univer-dark *){color:var(--univer-primary-400)!important}.dark\\:hover\\:\\!univer-bg-transparent:hover:where(.univer-dark,.univer-dark *){background-color:#0000!important}.dark\\:active\\:\\!univer-bg-gray-600:active:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-600)!important}.dark\\:disabled\\:\\!univer-text-gray-600:disabled:where(.univer-dark,.univer-dark *){color:var(--univer-gray-600)!important}.\\[\\&\\:\\:-webkit-scrollbar\\]\\:univer-hidden::-webkit-scrollbar{display:none}.\\[\\&\\>\\*\\]\\:univer-m-0>*{margin:0}.\\[\\&\\>\\*\\]\\:univer-inline-flex>*{display:inline-flex}.\\[\\&\\>\\*\\]\\:univer-h-6>*{height:1.5rem}.\\[\\&\\>\\*\\]\\:univer-min-h-7>*{min-height:1.75rem}.\\[\\&\\>\\*\\]\\:univer-min-w-7>*{min-width:1.75rem}.\\[\\&\\>\\*\\]\\:univer-appearance-none>*{appearance:none}.\\[\\&\\>\\*\\]\\:univer-items-center>*{align-items:center}.\\[\\&\\>\\*\\]\\:univer-justify-center>*{justify-content:center}.\\[\\&\\>\\*\\]\\:univer-rounded>*{border-radius:.25rem}.\\[\\&\\>\\*\\]\\:univer-rounded-md>*{border-radius:.375rem}.\\[\\&\\>\\*\\]\\:univer-border-0>*{border-width:0}.\\[\\&\\>\\*\\]\\:univer-px-1>*{padding-left:.25rem;padding-right:.25rem}.\\[\\&\\>\\*\\]\\:univer-px-1\\.5>*{padding-left:.375rem;padding-right:.375rem}.\\[\\&\\>\\*\\]\\:univer-leading-none>*{line-height:1}.\\[\\&\\>\\*\\]\\:univer-outline-none>*{outline-offset:2px;outline:2px solid #0000}.\\[\\&\\>\\*\\]\\:univer-transition-colors>*{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.hover\\:\\[\\&\\>\\*\\]\\:univer-bg-gray-100>:hover{background-color:var(--univer-gray-100)}.\\[\\&\\>span\\]\\:univer-truncate>span{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.\\[\\&\\>span\\]\\:univer-text-sm>span{font-size:.875rem;line-height:1.25rem}.\\[\\&\\>span\\]\\:univer-font-medium>span{font-weight:500}.\\[\\&\\>svg\\]\\:univer-shrink-0>svg{flex-shrink:0}.\\[\\&\\>svg\\]\\:univer-text-lg>svg{font-size:1.125rem;line-height:1.75rem}.\\[\\&\\>svg\\]\\:univer-text-gray-700>svg{color:var(--univer-gray-700)}.\\[\\&_\\*\\]\\:univer-box-border *{box-sizing:border-box}.\\[\\&_\\.univer-custom-label\\]\\:univer-text-sm .univer-custom-label{font-size:.875rem;line-height:1.25rem}.\\[\\&_\\.univer-custom-label\\]\\:univer-leading-none .univer-custom-label{line-height:1}.\\[\\&_\\.univer-toolbar-button-selector-main\\]\\:\\!univer-h-8 .univer-toolbar-button-selector-main{height:2rem!important}.\\[\\&_\\.univer-toolbar-button-selector-main\\]\\:\\!univer-rounded-none .univer-toolbar-button-selector-main{border-radius:0!important}.\\[\\&_\\.univer-toolbar-button-selector-main\\]\\:\\!univer-rounded-l-md .univer-toolbar-button-selector-main{border-top-left-radius:.375rem!important;border-bottom-left-radius:.375rem!important}.\\[\\&_\\.univer-toolbar-button-selector-main\\]\\:\\!univer-px-1\\.5 .univer-toolbar-button-selector-main{padding-left:.375rem!important;padding-right:.375rem!important}.\\[\\&_\\.univer-toolbar-button-selector-root\\]\\:\\!univer-h-8 .univer-toolbar-button-selector-root{height:2rem!important}.\\[\\&_\\.univer-toolbar-button-selector-root\\]\\:univer-overflow-hidden .univer-toolbar-button-selector-root{overflow:hidden}.\\[\\&_\\.univer-toolbar-button-selector-root\\]\\:\\!univer-rounded-md .univer-toolbar-button-selector-root{border-radius:.375rem!important}.\\[\\&_\\.univer-toolbar-button-selector-root\\]\\:\\!univer-pr-0 .univer-toolbar-button-selector-root{padding-right:0!important}.\\[\\&_\\.univer-toolbar-button-selector-trigger\\]\\:\\!univer-static .univer-toolbar-button-selector-trigger{position:static!important}.\\[\\&_\\.univer-toolbar-button-selector-trigger\\]\\:\\!univer-h-8 .univer-toolbar-button-selector-trigger{height:2rem!important}.\\[\\&_\\.univer-toolbar-button-selector-trigger\\]\\:\\!univer-w-6 .univer-toolbar-button-selector-trigger{width:1.5rem!important}.\\[\\&_\\.univer-toolbar-button-selector-trigger\\]\\:\\!univer-rounded-none .univer-toolbar-button-selector-trigger{border-radius:0!important}.\\[\\&_\\.univer-toolbar-button-selector-trigger\\]\\:\\!univer-rounded-r-md .univer-toolbar-button-selector-trigger{border-top-right-radius:.375rem!important;border-bottom-right-radius:.375rem!important}.\\[\\&_\\.univer-toolbar-selector-root\\]\\:\\!univer-h-8 .univer-toolbar-selector-root{height:2rem!important}.\\[\\&_\\.univer-toolbar-selector-root\\]\\:\\!univer-gap-1 .univer-toolbar-selector-root{gap:.25rem!important}.\\[\\&_\\.univer-toolbar-selector-root\\]\\:\\!univer-rounded-md .univer-toolbar-selector-root{border-radius:.375rem!important}.\\[\\&_\\.univer-toolbar-selector-root\\]\\:\\!univer-px-1\\.5 .univer-toolbar-selector-root{padding-left:.375rem!important;padding-right:.375rem!important}.\\[\\&_\\.univer-toolbar-selector-trigger\\]\\:\\!univer-pl-0\\.5 .univer-toolbar-selector-trigger{padding-left:.125rem!important}.\\[\\&_\\.univer-tooltip\\]\\:univer-inline-flex .univer-tooltip{display:inline-flex}.\\[\\&_\\.univer-tooltip\\]\\:univer-h-full .univer-tooltip{height:100%}.\\[\\&_\\.univer-tooltip\\]\\:univer-items-center .univer-tooltip{align-items:center}.\\[\\&_\\[data-u-command\\]\\]\\:\\!univer-h-8 [data-u-command]{height:2rem!important}.\\[\\&_\\[data-u-command\\]\\]\\:\\!univer-min-h-8 [data-u-command]{min-height:2rem!important}.\\[\\&_\\[data-u-command\\]\\]\\:\\!univer-rounded-md [data-u-command]{border-radius:.375rem!important}.\\[\\&_\\[data-u-command\\]\\]\\:\\!univer-px-1\\.5 [data-u-command]{padding-left:.375rem!important;padding-right:.375rem!important}.\\[\\&_button\\]\\:\\!univer-m-0 button{margin:0!important}.\\[\\&_button\\]\\:\\!univer-h-8 button{height:2rem!important}.\\[\\&_button\\]\\:\\!univer-min-w-8 button{min-width:2rem!important}.\\[\\&_button\\]\\:\\!univer-appearance-none button{appearance:none!important}.\\[\\&_button\\]\\:\\!univer-rounded-md button{border-radius:.375rem!important}.\\[\\&_button\\]\\:\\!univer-border-0 button{border-width:0!important}.\\[\\&_button\\]\\:\\!univer-bg-transparent button{background-color:#0000!important}.\\[\\&_button\\]\\:\\!univer-p-0 button{padding:0!important}.\\[\\&_button\\]\\:\\!univer-px-1\\.5 button{padding-left:.375rem!important;padding-right:.375rem!important}.\\[\\&_button\\]\\:\\!univer-leading-none button{line-height:1!important}.\\[\\&_button\\]\\:\\!univer-outline-none button{outline-offset:2px!important;outline:2px solid #0000!important}.\\[\\&_input\\:focus\\]\\:\\!univer-ring-0 input:focus{--univer-tw-ring-offset-shadow:var(--univer-tw-ring-inset) 0 0 0 var(--univer-tw-ring-offset-width) var(--univer-tw-ring-offset-color)!important;--univer-tw-ring-shadow:var(--univer-tw-ring-inset) 0 0 0 calc(0px + var(--univer-tw-ring-offset-width)) var(--univer-tw-ring-color)!important;box-shadow:var(--univer-tw-ring-offset-shadow),var(--univer-tw-ring-shadow),0 0 #0000!important;box-shadow:var(--univer-tw-ring-offset-shadow),var(--univer-tw-ring-shadow),var(--univer-tw-shadow,0 0 #0000)!important}.\\[\\&_input\\]\\:\\!univer-m-0 input{margin:0!important}.\\[\\&_input\\]\\:univer-h-6 input{height:1.5rem}.\\[\\&_input\\]\\:univer-w-7 input{width:1.75rem}.\\[\\&_input\\]\\:\\!univer-appearance-none input{appearance:none!important}.\\[\\&_input\\]\\:\\!univer-border-0 input{border-width:0!important}.\\[\\&_input\\]\\:univer-border-none input{border-style:none}.\\[\\&_input\\]\\:\\!univer-bg-transparent input{background-color:#0000!important}.\\[\\&_input\\]\\:\\!univer-p-0 input{padding:0!important}.\\[\\&_input\\]\\:univer-p-0 input{padding:0}.\\[\\&_input\\]\\:univer-text-sm input{font-size:.875rem;line-height:1.25rem}.\\[\\&_input\\]\\:\\!univer-leading-none input{line-height:1!important}.\\[\\&_input\\]\\:\\!univer-outline-none input{outline-offset:2px!important;outline:2px solid #0000!important}.univer-fixed{position:fixed}.univer-bottom-0{bottom:0}.univer-left-5{left:1.25rem}.univer-left-\\[5px\\]{left:5px}.univer-top-4{top:1rem}.univer-top-\\[5px\\]{top:5px}.univer-z-\\[10000\\]{z-index:10000}.univer-mr-1{margin-right:.25rem}.univer-mt-1\\.5{margin-top:.375rem}.univer-mt-12{margin-top:3rem}.univer-size-0\\.5{width:.125rem;height:.125rem}.univer-size-8{width:2rem;height:2rem}.univer-h-16{height:4rem}.univer-h-\\[24px\\]{height:24px}.univer-min-h-8{min-height:2rem}.univer-w-2{width:.5rem}.univer-w-2\\.5{width:.625rem}.univer-w-28{width:7rem}.univer-w-4\\/5{width:80%}.univer-w-\\[0px\\]{width:0}.univer-w-\\[212px\\]{width:212px}.univer-w-\\[72px\\]{width:72px}.univer-min-w-\\[180px\\]{min-width:180px}.univer-cursor-grab{cursor:grab}.univer-grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.univer-place-items-center{place-items:center}.univer-items-stretch{align-items:stretch}.univer-gap-2\\.5{gap:.625rem}.univer-gap-x-0\\.5{-moz-column-gap:.125rem;column-gap:.125rem}.univer-gap-y-px{row-gap:1px}.univer-rounded-r-2xl{border-top-right-radius:1rem;border-bottom-right-radius:1rem}.\\!univer-border-primary-500{border-color:var(--univer-primary-500)!important}.univer-border-primary-500{border-color:var(--univer-primary-500)}.\\!univer-bg-primary-50{background-color:var(--univer-primary-50)!important}.\\!univer-bg-primary-900{background-color:var(--univer-primary-900)!important}.univer-bg-gray-400{background-color:var(--univer-gray-400)}.univer-px-2\\.5{padding-left:.625rem;padding-right:.625rem}.univer-pb-0\\.5{padding-bottom:.125rem}.univer-pb-4{padding-bottom:1rem}.univer-pr-1{padding-right:.25rem}.univer-pt-1\\.5{padding-top:.375rem}.univer-pt-14{padding-top:3.5rem}.univer-text-lg{font-size:1.125rem;line-height:1.75rem}.univer-font-\\[500\\],.univer-font-medium{font-weight:500}.univer-font-normal{font-weight:400}.univer-leading-\\[24px\\]{line-height:24px}.\\!univer-text-gray-200{color:var(--univer-gray-200)!important}.\\!univer-text-gray-400{color:var(--univer-gray-400)!important}.\\!univer-text-primary-600{color:var(--univer-primary-600)!important}.univer-text-gray-800{color:var(--univer-gray-800)}.univer-backdrop-blur-\\[10px\\]{--univer-tw-backdrop-blur:blur(10px);-webkit-backdrop-filter:var(--univer-tw-backdrop-blur) var(--univer-tw-backdrop-brightness) var(--univer-tw-backdrop-contrast) var(--univer-tw-backdrop-grayscale) var(--univer-tw-backdrop-hue-rotate) var(--univer-tw-backdrop-invert) var(--univer-tw-backdrop-opacity) var(--univer-tw-backdrop-saturate) var(--univer-tw-backdrop-sepia);backdrop-filter:var(--univer-tw-backdrop-blur) var(--univer-tw-backdrop-brightness) var(--univer-tw-backdrop-contrast) var(--univer-tw-backdrop-grayscale) var(--univer-tw-backdrop-hue-rotate) var(--univer-tw-backdrop-invert) var(--univer-tw-backdrop-opacity) var(--univer-tw-backdrop-saturate) var(--univer-tw-backdrop-sepia)}.univer-duration-300{transition-duration:.3s}.univer-group:hover .group-hover\\:univer-bg-gray-500{background-color:var(--univer-gray-500)}.hover\\:univer-border-primary-500:hover{border-color:var(--univer-primary-500)}.hover\\:univer-bg-white:hover{background-color:var(--univer-white)}.hover\\:univer-text-gray-900:hover{color:var(--univer-gray-900)}.hover\\:univer-text-primary-600:hover{color:var(--univer-primary-600)}.hover\\:univer-shadow-md:hover{--univer-tw-shadow:0px 1px 6px -2px #1e284d14, 0px 2px 6px -1px #1e284d1a;--univer-tw-shadow-colored:0px 1px 6px -2px var(--univer-tw-shadow-color), 0px 2px 6px -1px var(--univer-tw-shadow-color);box-shadow:0 0 #0000,0 0 #0000,0 1px 6px -2px #1e284d14,0 2px 6px -1px #1e284d1a;box-shadow:var(--univer-tw-ring-offset-shadow,0 0 #0000),var(--univer-tw-ring-shadow,0 0 #0000),var(--univer-tw-shadow)}.active\\:univer-cursor-grabbing:active{cursor:grabbing}.dark\\:\\!univer-bg-gray-500:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-500)!important}.dark\\:\\!univer-bg-primary-900:where(.univer-dark,.univer-dark *){background-color:var(--univer-primary-900)!important}.univer-group:hover .dark\\:group-hover\\:\\!univer-bg-gray-300:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-300)!important}.univer-pointer-events-none{pointer-events:none}.univer-inset-0{inset:0}.-univer-left-0\\.5{left:-.125rem}.-univer-top-0\\.5{top:-.125rem}.univer-left-1{left:.25rem}.univer-left-3{left:.75rem}.univer-right-5{right:1.25rem}.univer-top-0\\.5{top:.125rem}.univer-z-10{z-index:10}.univer-z-\\[1001\\]{z-index:1001}.univer-z-\\[100\\]{z-index:100}.univer-mx-1\\.5{margin-left:.375rem;margin-right:.375rem}.univer-mb-1\\.5{margin-bottom:.375rem}.univer-ml-6{margin-left:1.5rem}.univer-ml-px{margin-left:1px}.univer-mr-5{margin-right:1.25rem}.univer-mt-auto{margin-top:auto}.univer-size-0{width:0;height:0}.univer-size-10{width:2.5rem;height:2.5rem}.univer-h-0\\.5{height:.125rem}.univer-h-1{height:.25rem}.univer-h-10{height:2.5rem}.univer-h-20{height:5rem}.univer-h-60{height:15rem}.univer-h-9{height:2.25rem}.univer-h-\\[270px\\]{height:270px}.univer-h-\\[30px\\]{height:30px}.univer-h-\\[calc\\(100\\%-16px\\)\\]{height:calc(100% - 16px)}.univer-h-\\[calc\\(100\\%-8px\\)\\]{height:calc(100% - 8px)}.univer-h-px{height:1px}.univer-max-h-52{max-height:13rem}.univer-max-h-\\[100px\\]{max-height:100px}.univer-max-h-\\[360px\\]{max-height:360px}.univer-min-h-0{min-height:0}.univer-min-h-\\[30px\\]{min-height:30px}.\\!univer-w-\\[90px\\]{width:90px!important}.univer-w-16{width:4rem}.univer-w-20{width:5rem}.univer-w-24{width:6rem}.univer-w-5{width:1.25rem}.univer-w-60{width:15rem}.univer-w-\\[100px\\]{width:100px}.univer-w-\\[130px\\]{width:130px}.univer-w-\\[156px\\]{width:156px}.univer-w-\\[300px\\]{width:300px}.univer-w-\\[50\\%\\]{width:50%}.univer-w-fit{width:fit-content}.univer-min-w-0{min-width:0}.univer-min-w-72{min-width:18rem}.univer-max-w-32{max-width:8rem}.univer-max-w-36{max-width:9rem}.univer-max-w-64{max-width:16rem}.univer-max-w-\\[190px\\]{max-width:190px}.univer-max-w-\\[200px\\]{max-width:200px}.univer-max-w-\\[calc\\(100\\%-112px\\)\\]{max-width:calc(100% - 112px)}.univer-max-w-fit{max-width:fit-content}.univer-max-w-lg{max-width:32rem}.univer-flex-shrink-0,.univer-shrink-0{flex-shrink:0}.univer-rotate-180{--univer-tw-rotate:180deg;transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(180deg) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y));transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y))}.univer-animate-spin{animation:1s linear infinite univer-spin}.univer-cursor-not-allowed{cursor:not-allowed}.univer-appearance-none{appearance:none}.univer-grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.univer-grid-cols-\\[1fr\\,auto\\,auto\\,auto\\]{grid-template-columns:1fr auto auto auto}.univer-flex-row-reverse{flex-direction:row-reverse}.univer-gap-7{gap:1.75rem}.univer-gap-x-2{-moz-column-gap:.5rem;column-gap:.5rem}.univer-space-y-2>:not([hidden])~:not([hidden]){--univer-tw-space-y-reverse:0;margin-top:calc(.5rem * (1 - var(--univer-tw-space-y-reverse)));margin-top:.5rem;margin-top:calc(.5rem * calc(1 - var(--univer-tw-space-y-reverse)));margin-bottom:0;margin-bottom:calc(.5rem * var(--univer-tw-space-y-reverse))}.univer-divide-x-0>:not([hidden])~:not([hidden]){--univer-tw-divide-x-reverse:0;border-right-width:0;border-right-width:calc(0px * var(--univer-tw-divide-x-reverse));border-left-width:calc(0px * (1 - var(--univer-tw-divide-x-reverse)));border-left-width:0;border-left-width:calc(0px * calc(1 - var(--univer-tw-divide-x-reverse)))}.univer-divide-y>:not([hidden])~:not([hidden]){--univer-tw-divide-y-reverse:0;border-top-width:calc(1px * (1 - var(--univer-tw-divide-y-reverse)));border-top-width:1px;border-top-width:calc(1px * calc(1 - var(--univer-tw-divide-y-reverse)));border-bottom-width:0;border-bottom-width:calc(1px * var(--univer-tw-divide-y-reverse))}.univer-divide-solid>:not([hidden])~:not([hidden]){border-style:solid}.univer-divide-gray-200>:not([hidden])~:not([hidden]){border-color:var(--univer-gray-200)}.univer-justify-self-center{justify-self:center}.univer-overflow-x-auto{overflow-x:auto}.univer-overflow-y-hidden{overflow-y:hidden}.univer-border-2{border-width:2px}.univer-border-4{border-width:4px}.univer-border-b{border-bottom-width:1px}.univer-border-\\[rgba\\(13\\,13\\,13\\,0\\.12\\)\\]{border-color:#0d0d0d1f}.univer-border-gray-100{border-color:var(--univer-gray-100)}.univer-border-r-gray-200{border-right-color:var(--univer-gray-200)}.univer-border-t-primary-500{border-top-color:var(--univer-primary-500)}.\\!univer-bg-gray-700{background-color:var(--univer-gray-700)!important}.univer-bg-blue-500{background-color:var(--univer-blue-500)}.univer-bg-blue-600{background-color:var(--univer-blue-600)}.univer-bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--univer-tw-gradient-stops))}.univer-from-gray-50{--univer-tw-gradient-from:var(--univer-gray-50) var(--univer-tw-gradient-from-position);--univer-tw-gradient-to:#fff0 var(--univer-tw-gradient-to-position);--univer-tw-gradient-stops:var(--univer-tw-gradient-from), var(--univer-tw-gradient-to)}.univer-to-gray-100{--univer-tw-gradient-to:var(--univer-gray-100) var(--univer-tw-gradient-to-position)}.univer-fill-gray-900{fill:var(--univer-gray-900)}.univer-px-3\\.5{padding-left:.875rem;padding-right:.875rem}.univer-px-5{padding-left:1.25rem;padding-right:1.25rem}.univer-py-5{padding-top:1.25rem;padding-bottom:1.25rem}.univer-pb-1{padding-bottom:.25rem}.univer-pl-1\\.5{padding-left:.375rem}.univer-pl-3{padding-left:.75rem}.univer-pl-6{padding-left:1.5rem}.univer-pr-5{padding-right:1.25rem}.univer-pt-1{padding-top:.25rem}.univer-font-semibold{font-weight:600}.univer-leading-6{line-height:1.5rem}.univer-leading-7{line-height:1.75rem}.\\!univer-text-blue-400{color:var(--univer-blue-400)!important}.\\!univer-text-gray-700{color:var(--univer-gray-700)!important}.\\!univer-text-white{color:var(--univer-white)!important}.univer-text-blue-500{color:var(--univer-blue-500)}.univer-text-blue-600{color:var(--univer-blue-600)}.univer-text-gray-200{color:var(--univer-gray-200)}.univer-text-gray-300{color:var(--univer-gray-300)}.univer-text-green-600{color:var(--univer-green-600)}.univer-text-primary-700{color:var(--univer-primary-700)}.univer-text-red-600{color:var(--univer-red-600)}.univer-text-rose-600{--univer-tw-text-opacity:1;color:rgba(225,29,72,var(--univer-tw-text-opacity,1))}.univer-text-yellow-500{color:var(--univer-yellow-500)}.univer-blur-sm{--univer-tw-blur:blur(4px);filter:var(--univer-tw-blur) var(--univer-tw-brightness) var(--univer-tw-contrast) var(--univer-tw-grayscale) var(--univer-tw-hue-rotate) var(--univer-tw-invert) var(--univer-tw-saturate) var(--univer-tw-sepia) var(--univer-tw-drop-shadow)}.univer-backdrop-blur{--univer-tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--univer-tw-backdrop-blur) var(--univer-tw-backdrop-brightness) var(--univer-tw-backdrop-contrast) var(--univer-tw-backdrop-grayscale) var(--univer-tw-backdrop-hue-rotate) var(--univer-tw-backdrop-invert) var(--univer-tw-backdrop-opacity) var(--univer-tw-backdrop-saturate) var(--univer-tw-backdrop-sepia);backdrop-filter:var(--univer-tw-backdrop-blur) var(--univer-tw-backdrop-brightness) var(--univer-tw-backdrop-contrast) var(--univer-tw-backdrop-grayscale) var(--univer-tw-backdrop-hue-rotate) var(--univer-tw-backdrop-invert) var(--univer-tw-backdrop-opacity) var(--univer-tw-backdrop-saturate) var(--univer-tw-backdrop-sepia)}.univer-transition-\\[colors\\,box-shadow\\]{transition-property:colors,box-shadow;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.univer-transition-\\[height\\]{transition-property:height;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.univer-duration-200{transition-duration:.2s}.univer-ease-linear{transition-timing-function:linear}.after\\:univer-absolute:after{content:var(--univer-tw-content);position:absolute}.after\\:univer-right-0:after{content:var(--univer-tw-content);right:0}.after\\:univer-top-1\\/2:after{content:var(--univer-tw-content);top:50%}.after\\:univer-block:after{content:var(--univer-tw-content);display:block}.after\\:univer-h-4:after{content:var(--univer-tw-content);height:1rem}.after\\:univer-w-px:after{content:var(--univer-tw-content);width:1px}.after\\:-univer-translate-y-1\\/2:after{content:var(--univer-tw-content);--univer-tw-translate-y:-50%;transform:translate(var(--univer-tw-translate-x),-50%) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y));transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y))}.after\\:univer-bg-gray-200:after{content:var(--univer-tw-content);background-color:var(--univer-gray-200)}.after\\:univer-content-\\[\\"\\"\\]:after{--univer-tw-content:"";content:"";content:var(--univer-tw-content)}.last\\:univer-mb-0:last-child{margin-bottom:0}.univer-group:hover .group-hover\\:univer-flex{display:flex}.hover\\:univer-border-primary-600:hover{border-color:var(--univer-primary-600)}.hover\\:univer-bg-transparent:hover{background-color:#0000}.focus\\:univer-border-primary-500:focus{border-color:var(--univer-primary-500)}.focus\\:univer-outline-none:focus{outline-offset:2px;outline:2px solid #0000}.focus-visible\\:univer-ring-2:focus-visible{--univer-tw-ring-offset-shadow:var(--univer-tw-ring-inset) 0 0 0 var(--univer-tw-ring-offset-width) var(--univer-tw-ring-offset-color);--univer-tw-ring-shadow:var(--univer-tw-ring-inset) 0 0 0 calc(2px + var(--univer-tw-ring-offset-width)) var(--univer-tw-ring-color);box-shadow:var(--univer-tw-ring-offset-shadow),var(--univer-tw-ring-shadow),0 0 #0000;box-shadow:var(--univer-tw-ring-offset-shadow),var(--univer-tw-ring-shadow),var(--univer-tw-shadow,0 0 #0000)}.focus-visible\\:univer-ring-primary-500:focus-visible{--univer-tw-ring-color:var(--univer-primary-500)}.active\\:univer-bg-gray-100:active{background-color:var(--univer-gray-100)}.dark\\:\\!univer-divide-gray-600:where(.univer-dark,.univer-dark *)>:not([hidden])~:not([hidden]){border-color:var(--univer-gray-600)!important}.dark\\:\\!univer-border-r-gray-700:where(.univer-dark,.univer-dark *){border-right-color:var(--univer-gray-700)!important}.dark\\:\\!univer-bg-black:where(.univer-dark,.univer-dark *){background-color:var(--univer-black)!important}.dark\\:\\!univer-bg-blue-400:where(.univer-dark,.univer-dark *){background-color:var(--univer-blue-400)!important}.dark\\:\\!univer-from-gray-800:where(.univer-dark,.univer-dark *){--univer-tw-gradient-from:var(--univer-gray-800) var(--univer-tw-gradient-from-position)!important;--univer-tw-gradient-to:#fff0 var(--univer-tw-gradient-to-position)!important;--univer-tw-gradient-stops:var(--univer-tw-gradient-from), var(--univer-tw-gradient-to)!important}.dark\\:\\!univer-to-gray-900:where(.univer-dark,.univer-dark *){--univer-tw-gradient-to:var(--univer-gray-900) var(--univer-tw-gradient-to-position)!important}.dark\\:\\!univer-fill-white:where(.univer-dark,.univer-dark *){fill:var(--univer-white)!important}.dark\\:\\!univer-text-blue-400:where(.univer-dark,.univer-dark *){color:var(--univer-blue-400)!important}.dark\\:\\!univer-text-gray-700:where(.univer-dark,.univer-dark *){color:var(--univer-gray-700)!important}.dark\\:\\!univer-text-green-400:where(.univer-dark,.univer-dark *){color:var(--univer-green-400)!important}.dark\\:\\!univer-text-red-400:where(.univer-dark,.univer-dark *){color:var(--univer-red-400)!important}.\\[\\&\\>div\\:first-child\\]\\:univer-px-2\\.5>div:first-child{padding-left:.625rem;padding-right:.625rem}.\\[\\&\\>div\\]\\:univer-h-5>div{height:1.25rem}.\\[\\&\\>div\\]\\:univer-ring-transparent>div{--univer-tw-ring-color:transparent}.\\[\\&_canvas\\]\\:univer-absolute canvas,.univer-absolute{position:absolute}.univer-left-1\\.5{left:.375rem}.univer-top-1\\/2{top:50%}.univer-z-\\[15\\]{z-index:15}.-univer-mx-6{margin-left:-1.5rem;margin-right:-1.5rem}.univer-mx-0{margin-left:0;margin-right:0}.univer-my-1{margin-top:.25rem;margin-bottom:.25rem}.univer-my-2{margin-top:.5rem;margin-bottom:.5rem}.univer-mb-0{margin-bottom:0}.univer-ml-4{margin-left:1rem}.univer-mr-0{margin-right:0}.univer-mt-0{margin-top:0}.univer-mt-1{margin-top:.25rem}.univer-h-\\[18px\\]{height:18px}.univer-h-\\[364px\\]{height:364px}.univer-max-h-60{max-height:15rem}.univer-max-h-72{max-height:18rem}.univer-max-h-\\[350px\\]{max-height:350px}.univer-w-\\[250px\\]{width:250px}.-univer-translate-y-1\\/2{--univer-tw-translate-y:-50%;transform:translate(var(--univer-tw-translate-x),-50%) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y));transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y))}.univer-justify-around{justify-content:space-around}.univer-overflow-visible{overflow:visible}.univer-whitespace-pre-wrap{white-space:pre-wrap}.univer-break-all{word-break:break-all}.univer-rounded-none{border-radius:0}.univer-rounded-l{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.univer-border-r-0{border-right-width:0}.univer-border-gray-600{border-color:var(--univer-gray-600)}.univer-border-primary-600{border-color:var(--univer-primary-600)}.\\!univer-bg-gray-600{background-color:var(--univer-gray-600)!important}.univer-bg-primary-600{background-color:var(--univer-primary-600)}.univer-px-4{padding-left:1rem;padding-right:1rem}.univer-px-6{padding-left:1.5rem;padding-right:1.5rem}.univer-px-7{padding-left:1.75rem;padding-right:1.75rem}.univer-py-3{padding-top:.75rem;padding-bottom:.75rem}.univer-pt-0{padding-top:0}.univer-leading-\\[13px\\]{line-height:13px}.univer-text-white{color:var(--univer-white)}.univer-outline-none{outline-offset:2px;outline:2px solid #0000}.univer-ring-1{--univer-tw-ring-offset-shadow:var(--univer-tw-ring-inset) 0 0 0 var(--univer-tw-ring-offset-width) var(--univer-tw-ring-offset-color);--univer-tw-ring-shadow:var(--univer-tw-ring-inset) 0 0 0 calc(1px + var(--univer-tw-ring-offset-width)) var(--univer-tw-ring-color);box-shadow:var(--univer-tw-ring-offset-shadow),var(--univer-tw-ring-shadow),0 0 #0000;box-shadow:var(--univer-tw-ring-offset-shadow),var(--univer-tw-ring-shadow),var(--univer-tw-shadow,0 0 #0000)}.univer-ring-primary-500{--univer-tw-ring-color:var(--univer-primary-500)}.univer-ring-red-500{--univer-tw-ring-color:var(--univer-red-500)}.hover\\:univer-bg-gray-300:hover{background-color:var(--univer-gray-300)}.dark\\:\\!univer-bg-gray-600:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-600)!important}.dark\\:\\!univer-text-gray-300:where(.univer-dark,.univer-dark *){color:var(--univer-gray-300)!important}.dark\\:hover\\:\\!univer-bg-gray-600:hover:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-600)!important}.univer-mb-5{margin-bottom:1.25rem}.univer-mr-3{margin-right:.75rem}.univer-mt-3\\.5{margin-top:.875rem}.univer-max-h-\\[400px\\]{max-height:400px}.univer-w-32{width:8rem}.univer-w-36{width:9rem}.univer-w-4{width:1rem}.univer-w-\\[340px\\]{width:340px}.univer-cursor-default{cursor:default}.univer-gap-1\\.5{gap:.375rem}.univer-gap-6{gap:1.5rem}.univer-pb-5{padding-bottom:1.25rem}.univer-text-sm,.univer-text-sm\\/5{font-size:.875rem;line-height:1.25rem}.dark\\:\\!univer-text-gray-400:where(.univer-dark,.univer-dark *){color:var(--univer-gray-400)!important}.-univer-bottom-0\\.5{bottom:-.125rem}.-univer-right-0\\.5{right:-.125rem}.univer-mx-1{margin-left:.25rem;margin-right:.25rem}.univer-block{display:block}.univer-inline-block{display:inline-block}.univer-size-3{width:.75rem;height:.75rem}.univer-size-full{width:100%;height:100%}.univer-h-4{height:1rem}.univer-h-\\[300px\\]{height:300px}.univer-max-h-\\[500px\\]{max-height:500px}.univer-min-h-\\[300px\\]{min-height:300px}.univer-w-\\[400px\\]{width:400px}.univer-flex-shrink{flex-shrink:1}.univer-flex-grow{flex-grow:1}.univer-grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}.univer-flex-nowrap{flex-wrap:nowrap}.univer-justify-start{justify-content:flex-start}.univer-gap-4{gap:1rem}.univer-overflow-auto{overflow:auto}.univer-whitespace-nowrap{white-space:nowrap}.univer-border-\\[rgba\\(13\\,13\\,13\\,0\\.06\\)\\]{border-color:#0d0d0d0f}.univer-border-transparent{border-color:#0000}.univer-bg-gray-300{background-color:var(--univer-gray-300)}.univer-p-0\\.5{padding:.125rem}.univer-p-2{padding:.5rem}.univer-py-0{padding-top:0;padding-bottom:0}.univer-py-0\\.5{padding-top:.125rem;padding-bottom:.125rem}.univer-py-2\\.5{padding-top:.625rem;padding-bottom:.625rem}.univer-pl-5{padding-left:1.25rem}.univer-pr-0\\.5{padding-right:.125rem}.univer-pr-2{padding-right:.5rem}.univer-pt-2{padding-top:.5rem}.univer-font-bold{font-weight:700}.univer-text-\\[\\#418F1F\\]{--univer-tw-text-opacity:1;color:rgba(65,143,31,var(--univer-tw-text-opacity,1))}.univer-text-gray-500{color:var(--univer-gray-500)}.univer-transition-shadow{transition-property:box-shadow;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.hover\\:univer-ring-2:hover{--univer-tw-ring-offset-shadow:var(--univer-tw-ring-inset) 0 0 0 var(--univer-tw-ring-offset-width) var(--univer-tw-ring-offset-color);--univer-tw-ring-shadow:var(--univer-tw-ring-inset) 0 0 0 calc(2px + var(--univer-tw-ring-offset-width)) var(--univer-tw-ring-color);box-shadow:var(--univer-tw-ring-offset-shadow),var(--univer-tw-ring-shadow),0 0 #0000;box-shadow:var(--univer-tw-ring-offset-shadow),var(--univer-tw-ring-shadow),var(--univer-tw-shadow,0 0 #0000)}.hover\\:univer-ring-offset-2:hover{--univer-tw-ring-offset-width:2px}.hover\\:univer-ring-offset-white:hover{--univer-tw-ring-offset-color:var(--univer-white)}.dark\\:\\!univer-border-\\[rgba\\(255\\,255\\,255\\,0\\.06\\)\\]:where(.univer-dark,.univer-dark *){border-color:#ffffff0f!important}.dark\\:\\!univer-border-gray-600:where(.univer-dark,.univer-dark *){border-color:var(--univer-gray-600)!important}.dark\\:\\!univer-text-gray-500:where(.univer-dark,.univer-dark *){color:var(--univer-gray-500)!important}.dark\\:hover\\:\\!univer-bg-gray-900:hover:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-900)!important}.\\[\\&\\:hover_a\\]\\:univer-inline-block:hover a{display:inline-block}.univer-my-0{margin-top:0;margin-bottom:0}.univer-mb-2{margin-bottom:.5rem}.univer-ml-1\\.5{margin-left:.375rem}.univer-ml-3{margin-left:.75rem}.univer-mt-5{margin-top:1.25rem}.univer-max-h-\\[310px\\]{max-height:310px}.univer-w-\\[--radix-popper-anchor-width\\]{width:var(--radix-popper-anchor-width)}.univer-max-w-\\[220px\\]{max-width:220px}.univer-select-none{-webkit-user-select:none;user-select:none}.univer-grid-flow-col{grid-auto-flow:column}.univer-py-1\\.5{padding-top:.375rem;padding-bottom:.375rem}.univer-transition-all{transition-property:all;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.hover\\:univer-text-red-500:hover{color:var(--univer-red-500)}.disabled\\:univer-divide-opacity-30:disabled>:not([hidden])~:not([hidden]){--univer-tw-divide-opacity:.3}.disabled\\:univer-text-gray-800:disabled{color:var(--univer-gray-800)}.univer-mt-4{margin-top:1rem}.univer-mt-6{margin-top:1.5rem}.univer-text-primary-500{color:var(--univer-primary-500)}.univer-mt-2\\.5{margin-top:.625rem}.univer-size-4{width:1rem;height:1rem}.univer-h-5{height:1.25rem}.univer-h-7{height:1.75rem}.univer-h-8{height:2rem}.univer-h-full{height:100%}.univer-w-6{width:1.5rem}.univer-w-px{width:1px}.univer-min-w-32{min-width:8rem}.univer-min-w-9{min-width:2.25rem}.univer-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.univer-grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.univer-gap-1{gap:.25rem}.univer-border{border-width:1px}.univer-border-solid{border-style:solid}.univer-border-none{border-style:none}.\\!univer-bg-gray-800{background-color:var(--univer-gray-800)!important}.univer-bg-gray-100{background-color:var(--univer-gray-100)}.univer-bg-gray-200{background-color:var(--univer-gray-200)}.univer-bg-primary-50{background-color:var(--univer-primary-50)}.univer-bg-transparent{background-color:#0000}.univer-fill-primary-600{fill:var(--univer-primary-600)}.univer-p-0{padding:0}.univer-p-1{padding:.25rem}.univer-px-1{padding-left:.25rem;padding-right:.25rem}.univer-px-1\\.5{padding-left:.375rem;padding-right:.375rem}.univer-px-2{padding-left:.5rem;padding-right:.5rem}.univer-py-1{padding-top:.25rem;padding-bottom:.25rem}.univer-text-left{text-align:left}.univer-text-center{text-align:center}.\\!univer-text-primary-300{color:var(--univer-primary-300)!important}.univer-text-gray-700{color:var(--univer-gray-700)}.univer-shadow-lg{--univer-tw-shadow:0px 4px 6px 0px #1e284d0d, 0px 10px 15px -3px #1e284d1a;--univer-tw-shadow-colored:0px 4px 6px 0px var(--univer-tw-shadow-color), 0px 10px 15px -3px var(--univer-tw-shadow-color);box-shadow:0 0 #0000,0 0 #0000,0 4px 6px #1e284d0d,0 10px 15px -3px #1e284d1a;box-shadow:var(--univer-tw-ring-offset-shadow,0 0 #0000),var(--univer-tw-ring-shadow,0 0 #0000),var(--univer-tw-shadow)}.univer-shadow-sm{--univer-tw-shadow:0px 1px 2px 0px #1e284d14;--univer-tw-shadow-colored:0px 1px 2px 0px var(--univer-tw-shadow-color);box-shadow:0 0 #0000,0 0 #0000,0 1px 2px #1e284d14;box-shadow:var(--univer-tw-ring-offset-shadow,0 0 #0000),var(--univer-tw-ring-shadow,0 0 #0000),var(--univer-tw-shadow)}.univer-transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.disabled\\:univer-cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:univer-opacity-40:disabled{opacity:.4}.dark\\:\\!univer-border-gray-700:where(.univer-dark,.univer-dark *){border-color:var(--univer-gray-700)!important}.dark\\:\\!univer-bg-gray-700:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-700)!important}.dark\\:\\!univer-bg-gray-800:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-800)!important}.dark\\:\\!univer-text-gray-100:where(.univer-dark,.univer-dark *){color:var(--univer-gray-100)!important}.dark\\:\\!univer-text-primary-300:where(.univer-dark,.univer-dark *){color:var(--univer-primary-300)!important}.\\[\\&\\>div\\]\\:univer-grid>div{display:grid}.\\[\\&\\>div\\]\\:univer-gap-2>div{gap:.5rem}.univer-hidden{display:none}.univer-border-t{border-top-width:1px}.univer-border-gray-200{border-color:var(--univer-gray-200)}.univer-py-2{padding-top:.5rem;padding-bottom:.5rem}.univer-pt-3{padding-top:.75rem}.univer-text-gray-400{color:var(--univer-gray-400)}.univer-absolute{position:absolute}.univer-relative{position:relative}.univer-left-0{left:0}.univer-right-0{right:0}.univer-top-0{top:0}.univer-m-0{margin:0}.univer-mb-3{margin-bottom:.75rem}.univer-mb-4{margin-bottom:1rem}.univer-ml-1{margin-left:.25rem}.univer-mr-1\\.5{margin-right:.375rem}.univer-mt-2{margin-top:.5rem}.univer-mt-3{margin-top:.75rem}.univer-inline-flex{display:inline-flex}.univer-grid{display:grid}.univer-h-1\\.5{height:.375rem}.univer-h-3\\.5{height:.875rem}.univer-max-h-80{max-height:20rem}.univer-min-h-full{min-height:100%}.univer-w-\\[278px\\]{width:278px}.univer-w-\\[3px\\]{width:3px}.univer-flex-shrink-0{flex-shrink:0}.univer-flex-grow-0{flex-grow:0}.univer-list-none{list-style-type:none}.univer-flex-col{flex-direction:column}.univer-gap-3{gap:.75rem}.univer-overflow-y-auto{overflow-y:auto}.univer-overflow-x-hidden{overflow-x:hidden}.univer-break-words{word-wrap:break-word}.univer-rounded-\\[3px\\]{border-radius:3px}.univer-rounded-full{border-radius:9999px}.univer-rounded-md{border-radius:.375rem}.univer-rounded-sm{border-radius:.125rem}.univer-rounded-t-md{border-top-left-radius:.375rem;border-top-right-radius:.375rem}.\\!univer-bg-gray-900{background-color:var(--univer-gray-900)!important}.univer-bg-gray-50{background-color:var(--univer-gray-50)}.univer-bg-yellow-400{background-color:var(--univer-yellow-400)}.univer-bg-yellow-500{background-color:var(--univer-yellow-500)}.univer-bg-cover{background-size:cover}.univer-bg-center{background-position:50%}.univer-bg-no-repeat{background-repeat:no-repeat}.univer-p-1\\.5{padding:.375rem}.univer-pb-3{padding-bottom:.75rem}.univer-pl-\\[30px\\]{padding-left:30px}.univer-text-xs{font-size:.75rem;line-height:1rem}.univer-text-xs\\/normal{font-size:.75rem;line-height:1.5}.univer-font-medium{font-weight:500}.univer-text-gray-600{color:var(--univer-gray-600)}.univer-shadow{--univer-tw-shadow:0 1px 3px 0 #0000001a, 0 1px 2px -1px #0000001a;--univer-tw-shadow-colored:0 1px 3px 0 var(--univer-tw-shadow-color), 0 1px 2px -1px var(--univer-tw-shadow-color);box-shadow:0 0 #0000,0 0 #0000,0 1px 3px #0000001a,0 1px 2px -1px #0000001a;box-shadow:var(--univer-tw-ring-offset-shadow,0 0 #0000),var(--univer-tw-ring-shadow,0 0 #0000),var(--univer-tw-shadow)}.hover\\:univer-bg-gray-200:hover{background-color:var(--univer-gray-200)}.hover\\:univer-bg-gray-50:hover{background-color:var(--univer-gray-50)}.dark\\:\\!univer-text-gray-200:where(.univer-dark,.univer-dark *){color:var(--univer-gray-200)!important}.dark\\:hover\\:\\!univer-bg-gray-800:hover:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-800)!important}.\\[\\&_a\\]\\:univer-block a{display:block}.\\[\\&_a\\]\\:univer-cursor-pointer a{cursor:pointer}.\\[\\&_a\\]\\:univer-rounded a{border-radius:.25rem}.\\[\\&_a\\]\\:univer-px-2 a{padding-left:.5rem;padding-right:.5rem}.\\[\\&_a\\]\\:univer-py-1\\.5 a{padding-top:.375rem;padding-bottom:.375rem}.\\[\\&_a\\]\\:univer-transition-colors a{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.univer-mb-1{margin-bottom:.25rem}.univer-ml-2{margin-left:.5rem}.univer-mr-2{margin-right:.5rem}.univer-box-border{box-sizing:border-box}.univer-flex{display:flex}.univer-size-5{width:1.25rem;height:1.25rem}.univer-size-6{width:1.5rem;height:1.5rem}.univer-h-6{height:1.5rem}.univer-w-\\[296px\\]{width:296px}.univer-w-full{width:100%}.univer-max-w-80{max-width:20rem}.univer-flex-1{flex:1}.univer-flex-none{flex:none}.univer-cursor-pointer{cursor:pointer}.univer-flex-row{flex-direction:row}.univer-items-center{align-items:center}.univer-justify-end{justify-content:flex-end}.univer-justify-center{justify-content:center}.univer-justify-between{justify-content:space-between}.univer-gap-2{gap:.5rem}.univer-overflow-hidden{overflow:hidden}.univer-truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.univer-rounded{border-radius:.25rem}.univer-rounded-lg{border-radius:.5rem}.univer-rounded-xl{border-radius:.75rem}.univer-bg-white{background-color:var(--univer-white)}.univer-p-3{padding:.75rem}.univer-p-4{padding:1rem}.univer-text-base{font-size:1rem;line-height:1.5rem}.univer-text-sm{font-size:.875rem;line-height:1.25rem}.univer-leading-5{line-height:1.25rem}.univer-text-gray-900{color:var(--univer-gray-900)}.univer-text-green-500{color:var(--univer-green-500)}.univer-text-primary-600{color:var(--univer-primary-600)}.univer-text-red-500{color:var(--univer-red-500)}.univer-shadow-md{--univer-tw-shadow:0px 1px 6px -2px #1e284d14, 0px 2px 6px -1px #1e284d1a;--univer-tw-shadow-colored:0px 1px 6px -2px var(--univer-tw-shadow-color), 0px 2px 6px -1px var(--univer-tw-shadow-color);box-shadow:0 0 #0000,0 0 #0000,0 1px 6px -2px #1e284d14,0 2px 6px -1px #1e284d1a;box-shadow:var(--univer-tw-ring-offset-shadow,0 0 #0000), var(--univer-tw-ring-shadow,0 0 #0000), var(--univer-tw-shadow)}.hover\\:univer-bg-gray-100:hover{background-color:var(--univer-gray-100)}.dark\\:\\!univer-bg-gray-900:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-900)!important}.dark\\:\\!univer-text-white:where(.univer-dark,.univer-dark *){color:var(--univer-white)!important}.dark\\:hover\\:\\!univer-bg-gray-700:hover:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-700)!important}.sheet-shell[data-v-cde37d0b]{letter-spacing:normal;flex-direction:column;height:760px;font-size:14px;line-height:normal;display:flex}.sheet-canvas[data-v-cde37d0b]{flex:1;min-height:0;position:relative}.sheet-editor[data-v-cde37d0b]{contain:layout style;letter-spacing:normal;width:100%;height:100%;font-size:14px;line-height:normal;position:absolute;inset:0;overflow:hidden}.sheet-attachments[data-v-cde37d0b]{border-bottom:1px solid #eee;align-items:center;gap:8px;padding:6px 12px;font-size:12px;display:flex}.sheet-attachments button[data-v-cde37d0b]{cursor:pointer;color:#3370ff;background:#fff;border:1px solid #dce3ed;border-radius:4px;padding:4px 8px}.sheet-attachments button[data-v-cde37d0b]:disabled{cursor:wait;opacity:.5}.attachment-name[data-v-cde37d0b]{text-overflow:ellipsis;white-space:nowrap;max-width:240px;overflow:hidden}.attachment-error[data-v-cde37d0b]{color:#c62828}.tag-current-row[data-v-cde37d0b]{z-index:100;background:#fafbfc;border:1px solid #eee;border-radius:6px;align-items:center;gap:4px;padding:0 8px;font-size:12px;display:inline-flex;position:absolute;box-shadow:0 1px 4px #0000000f}.tag-current-label[data-v-cde37d0b]{color:#999;white-space:nowrap;font-size:11px}.tag-dropdown[data-v-cde37d0b]{z-index:100;background:#fff;border:1px solid #e0e0e0;border-radius:6px;flex-direction:column;gap:4px;min-width:220px;max-width:320px;padding:8px;display:flex;position:absolute;box-shadow:0 4px 12px #0000001f}.tag-search[data-v-cde37d0b]{box-sizing:border-box;border:1px solid #d9d9d9;border-radius:4px;outline:none;width:100%;padding:5px 8px;font-size:12px}.tag-search[data-v-cde37d0b]:focus{border-color:#3370ff}.tag-option-list[data-v-cde37d0b]{flex-wrap:wrap;gap:6px;max-height:180px;padding:4px;display:flex;overflow-y:auto}.tag-option[data-v-cde37d0b]{cursor:pointer;white-space:nowrap;border:1px solid #0000;border-radius:4px;padding:3px 10px;font-size:12px;font-weight:600;position:relative}.tag-option[data-v-cde37d0b]:hover{opacity:.85;border-color:currentColor}.tag-option-name[data-v-cde37d0b]{pointer-events:none}.tag-option-delete[data-v-cde37d0b]{cursor:pointer;color:#fff;background:#ff4d4f;border:1px solid #fff;border-radius:50%;justify-content:center;align-items:center;width:14px;height:14px;font-size:10px;line-height:1;display:none;position:absolute;top:-6px;right:-6px;box-shadow:0 1px 2px #00000026}.tag-option:hover .tag-option-delete[data-v-cde37d0b]{display:inline-flex}.tag-option-delete[data-v-cde37d0b]:hover{background:#cf1322}.tag-empty[data-v-cde37d0b]{color:#999;text-align:center;width:100%;padding:8px 0;font-size:12px}.tag-add-new[data-v-cde37d0b]{color:#666;cursor:pointer;text-align:center;background:0 0;border:1px dashed #d9d9d9;border-radius:4px;width:100%;padding:4px 8px;font-size:12px}.tag-add-new[data-v-cde37d0b]:hover{color:#3370ff;border-color:#3370ff}.cell-tag-chip[data-v-cde37d0b]{border-radius:4px;align-items:center;gap:2px;padding:2px 6px;font-size:12px;font-weight:600;display:inline-flex}.cell-tag-remove[data-v-cde37d0b]{cursor:pointer;color:inherit;opacity:.6;background:0 0;border:none;padding:0 1px;font-size:14px;line-height:1}.cell-tag-remove[data-v-cde37d0b]:hover{opacity:1}.tag-config-overlay[data-v-cde37d0b]{z-index:1000;background:#0006;justify-content:center;align-items:center;display:flex;position:fixed;inset:0}.tag-config-dialog[data-v-cde37d0b]{background:#fff;border-radius:8px;min-width:320px;padding:20px;box-shadow:0 8px 24px #00000026}.tag-config-dialog h4[data-v-cde37d0b]{margin:0 0 16px;font-size:15px;font-weight:600}.tag-config-label[data-v-cde37d0b]{color:#666;flex-direction:column;gap:4px;margin-bottom:12px;font-size:12px;display:flex}.tag-config-label input[data-v-cde37d0b]{border:1px solid #d9d9d9;border-radius:4px;padding:6px 8px;font-size:13px}.tag-config-label input[data-v-cde37d0b]:focus{border-color:#3370ff;outline:none}.tag-config-colors[data-v-cde37d0b]{margin-bottom:12px}.tag-config-colors>span[data-v-cde37d0b]{color:#666;margin-bottom:6px;font-size:12px;display:block}.tag-sv-panel[data-v-cde37d0b]{cursor:crosshair;touch-action:none;border-radius:6px;width:100%;height:110px;margin-bottom:10px;position:relative}.tag-hue-bar[data-v-cde37d0b]{cursor:pointer;touch-action:none;background:linear-gradient(90deg,red,#ff0,#0f0,#0ff,#00f,#f0f,red);border-radius:7px;width:100%;height:14px;position:relative}.tag-color-dot[data-v-cde37d0b]{pointer-events:none;border:2px solid #fff;border-radius:50%;width:14px;height:14px;position:absolute;transform:translate(-50%,-50%);box-shadow:0 0 2px #0006}.tag-config-preview[data-v-cde37d0b]{margin-bottom:16px}.tag-config-actions[data-v-cde37d0b]{justify-content:flex-end;gap:8px;display:flex}.tag-config-cancel[data-v-cde37d0b]{cursor:pointer;background:#fff;border:1px solid #d9d9d9;border-radius:4px;padding:5px 14px;font-size:13px}.tag-config-save[data-v-cde37d0b]{color:#fff;cursor:pointer;background:#3370ff;border:none;border-radius:4px;padding:5px 14px;font-size:13px}.tag-config-save[data-v-cde37d0b]:hover{background:#245bdb}.sheet-statusbar[data-v-cde37d0b]{color:#8c8c8c;white-space:nowrap;background:#fafbfc;border-top:1px solid #f0f0f0;align-items:center;gap:8px;padding:8px 16px;font-size:12px;display:flex;overflow:hidden}.status-cell[data-v-cde37d0b]{color:#25b864;font-family:ui-monospace,Consolas,monospace;font-weight:600}.status-sep[data-v-cde37d0b]{color:#d9d9d9}.sheet-statusbar b[data-v-cde37d0b]{color:#595959;font-weight:600}.status-flex[data-v-cde37d0b]{flex:1}.status-hint[data-v-cde37d0b]{color:#bfbfbf}.status-readonly[data-v-cde37d0b]{color:#faad14}.status-tip[data-v-cde37d0b]{color:#bfbfbf}.tag-toast[data-v-cde37d0b]{z-index:200;color:#fff;pointer-events:none;white-space:nowrap;background:#000000bf;border-radius:6px;padding:8px 18px;font-size:13px;line-height:1.4;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);box-shadow:0 4px 12px #00000026}.tag-toast-enter-active[data-v-cde37d0b],.tag-toast-leave-active[data-v-cde37d0b]{transition:opacity .25s}.tag-toast-enter-from[data-v-cde37d0b],.tag-toast-leave-to[data-v-cde37d0b]{opacity:0}/*$vite$:1*/`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();
2
2
  (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("vue")):typeof define==`function`&&define.amd?define([`exports`,`vue`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.PdEditor={},e.Vue))})(this,function(e,t){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},l=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),u=(e,t)=>{let n={};for(var i in e)r(n,i,{get:e[i],enumerable:!0});return t||r(n,Symbol.toStringTag,{value:`Module`}),n},d=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=a(t),l=0,u=c.length,d;l<u;l++)d=c[l],!s.call(e,d)&&d!==n&&r(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(o=i(t,d))||o.enumerable});return e},f=(e,t,i)=>(i=e==null?{}:n(o(e)),d(t||!e||!e.__esModule||!s.call(e,`default`)?r(i,`default`,{value:e,enumerable:!0}):i,e)),p=l(((e,t)=>{var n=function(e){if(e||={},this.Promise=e.Promise||Promise,this.queues=Object.create(null),this.domainReentrant=e.domainReentrant||!1,this.domainReentrant){if(typeof process>`u`||process.domain===void 0)throw Error("Domain-reentrant locks require `process.domain` to exist. Please flip `opts.domainReentrant = false`, use a NodeJS version that still implements Domain, or install a browser polyfill.");this.domains=Object.create(null)}this.timeout=e.timeout||n.DEFAULT_TIMEOUT,this.maxOccupationTime=e.maxOccupationTime||n.DEFAULT_MAX_OCCUPATION_TIME,this.maxExecutionTime=e.maxExecutionTime||n.DEFAULT_MAX_EXECUTION_TIME,this.maxPending=e.maxPending===1/0||Number.isInteger(e.maxPending)&&e.maxPending>=0?e.maxPending:n.DEFAULT_MAX_PENDING};n.DEFAULT_TIMEOUT=0,n.DEFAULT_MAX_OCCUPATION_TIME=0,n.DEFAULT_MAX_EXECUTION_TIME=0,n.DEFAULT_MAX_PENDING=1e3,n.prototype.acquire=function(e,t,n,r){if(Array.isArray(e))return this._acquireBatch(e,t,n,r);if(typeof t!=`function`)throw Error(`You must pass a function to execute`);var i=null,a=null,o=null;typeof n!=`function`&&(r=n,n=null,o=new this.Promise(function(e,t){i=e,a=t})),r||={};var s=!1,c=null,l=null,u=null,d=this,f=function(t,r,c){l&&=(clearTimeout(l),null),u&&=(clearTimeout(u),null),t&&(d.queues[e]&&d.queues[e].length===0&&delete d.queues[e],d.domainReentrant&&delete d.domains[e]),s||=(o?r?a(r):i(c):typeof n==`function`&&n(r,c),!0),t&&d.queues[e]&&d.queues[e].length>0&&d.queues[e].shift()()},p=function(n){if(s)return f(n);c&&=(clearTimeout(c),null),d.domainReentrant&&n&&(d.domains[e]=process.domain);var i=r.maxExecutionTime||d.maxExecutionTime;if(i&&(u=setTimeout(function(){d.queues[e]&&f(n,Error(`Maximum execution time is exceeded `+e))},i)),t.length===1){var a=!1;try{t(function(e,t){a||(a=!0,f(n,e,t))})}catch(e){a||(a=!0,f(n,e))}}else d._promiseTry(function(){return t()}).then(function(e){f(n,void 0,e)},function(e){f(n,e)})};d.domainReentrant&&process.domain&&(p=process.domain.bind(p));var m=r.maxPending||d.maxPending;if(!d.queues[e])d.queues[e]=[],p(!0);else if(d.domainReentrant&&process.domain&&process.domain===d.domains[e])p(!1);else if(d.queues[e].length>=m)f(!1,Error(`Too many pending tasks in queue `+e));else{var h=function(){p(!0)};r.skipQueue?d.queues[e].unshift(h):d.queues[e].push(h);var g=r.timeout||d.timeout;g&&(c=setTimeout(function(){c=null,f(!1,Error(`async-lock timed out in queue `+e))},g))}var _=r.maxOccupationTime||d.maxOccupationTime;if(_&&(l=setTimeout(function(){d.queues[e]&&f(!1,Error(`Maximum occupation time is exceeded in queue `+e))},_)),o)return o},n.prototype._acquireBatch=function(e,t,n,r){typeof n!=`function`&&(r=n,n=null);var i=this,a=function(e,t){return function(n){i.acquire(e,t,n,r)}},o=e.reduceRight(function(e,t){return a(t,e)},t);if(typeof n==`function`)o(n);else return new this.Promise(function(e,t){o.length===1?o(function(n,r){n?t(n):e(r)}):e(o())})},n.prototype.isBusy=function(e){return e?!!this.queues[e]:Object.keys(this.queues).length>0},n.prototype._promiseTry=function(e){try{return this.Promise.resolve(e())}catch(e){return this.Promise.reject(e)}},t.exports=n})),m=f(l(((e,t)=>{t.exports=p()}))()),h=Symbol(`$$IDENTIFIER_DECORATOR`);function g(e){return e&&e[h]===!0}function _(e){return typeof e==`function`}function v(e){return!!(e&&e.useClass!==void 0)}function y(e){return!!(e&&e.useFactory!==void 0)}function b(e){return!!(e&&e.useValue!==void 0)}function x(e){return!!(e&&e.useExisting!==void 0)}function S(e){return!!(e&&e.useAsync!==void 0)}var C=Symbol(`AsyncHook`);function w(e){return!!(e&&e.__symbol===C)}function T(e){return _(e)&&!e[h]?e.name:e.toString()}var E=class extends Error{constructor(e){super(`[redi]: ${e}`)}},D=function(e){return e.MANY=`many`,e.OPTIONAL=`optional`,e.REQUIRED=`required`,e}({}),O=function(e){return e.SELF=`self`,e.SKIP_SELF=`skipSelf`,e}({}),k=Symbol(`$$TARGET`),A=Symbol(`$$DEPENDENCIES`),ee=class extends E{constructor(e,t){let n=`Could not find dependency registered on the ${e} (indexed) parameter of the constructor of "${T(t)}".`;super(n)}},te=class extends E{constructor(e,t){let n=`It seems that you forgot to provide a parameter to @Required() on the ${t}th parameter of "${T(e)}"`;super(n)}},j=class extends E{constructor(e,t){let n=`It seems that you register "undefined" as dependency on the ${t}th parameter of "${T(e)}". Please make sure that there is not cyclic dependency among your TypeScript files, or consider using "forwardRef". For more info please visit our website https://redi.wendell.fun/docs/faq#could-not-find-dependency-registered-on`;super(n)}};function ne(e){return e[A]||[]}function re(e,t){let n=ne(e).find(e=>e.paramIndex===t);if(!n)throw new ee(t,e);return n}function ie(e,t,n,r=D.REQUIRED,i){let a={paramIndex:n,identifier:t,quantity:r,lookUp:i,withNew:!1};if(t===void 0)throw new j(e,n);let o=e;o[k]===o?o[A].push(a):(o[A]=[a],o[k]=o)}var ae=new Set,oe=new Map;function se(e){if(ae.has(e))return console.error(`Identifier "${e}" already exists. Returning the cached identifier decorator.`),oe.get(e);let t=function(e,n,r){ie(e,t,r)};return t.decoratorName=e,t.toString=()=>t.decoratorName,t[h]=!0,ae.add(e),oe.set(e,t),t}function ce(e,t,n){let r=re(e,t);r.lookUp=n}function le(e){return function t(){return this instanceof t?this:function(t,n,r){ce(t,r,e)}}}var ue=le(O.SKIP_SELF),de=le(O.SELF);function fe(e){return e===D.OPTIONAL?`0 or 1`:`1`}var pe=class extends E{constructor(e,t,n){let r=`Expect ${fe(t)} dependency item(s) for id "${T(e)}" but get ${n}.`;n===0&&(r+=` Did you forget to register it?`),n>1&&(r+=` You register it more than once.`),super(r),this.quantity=t,this.actual=n}};function me(e,t,n){if(t===D.OPTIONAL&&n>1||t===D.REQUIRED&&n!==1)throw new pe(e,t,n)}function he(e,t){return e===D.MANY?t:t[0]}function ge(e,t,n){let r=re(e,t);r.quantity=n}function _e(e){return function t(n){return this instanceof t?this:function(t,r,i){if(n)ie(t,n,i,e);else{if(e===D.REQUIRED)throw new te(t,i);ge(t,i,e)}}}}var ve=_e(D.MANY),ye=_e(D.OPTIONAL),M=_e(D.REQUIRED);function be(e,t=0){return e?e.map((e,n)=>{if(n+=t,!Array.isArray(e))return{paramIndex:n,identifier:e,quantity:D.REQUIRED,withNew:!1};let r=e.slice(0,e.length-1),i=e[e.length-1],a,o=D.REQUIRED,s=!1;return r.forEach(e=>{e instanceof de?a=O.SELF:e instanceof ue?a=O.SKIP_SELF:e instanceof ye?o=D.OPTIONAL:e instanceof ve?o=D.MANY:s=!0}),{paramIndex:n,identifier:i,quantity:o,lookUp:a,withNew:s}}):[]}function xe(e){return!!e&&typeof e.unwrap==`function`}function Se(e){return xe(e)?e.unwrap():e}function Ce(e){return!!e&&typeof e.dispose==`function`}function we(e){return e.length===1}var Te=[];function Ee(e){Te.push(e)}function De(){Te.pop()}function Oe(){Te.length=0}var ke=class extends E{constructor(e,t,n){let r=`Cannot find "${T(t)}" registered by any injector. It is the ${n}th param of "${g(e)?T(e):e.name}".`;super(r)}},Ae=class extends E{constructor(e){let t=`Cannot find "${T(e)}" registered by any injector. The stack of dependencies is: "${Te.map(e=>T(e)).join(` -> `)}".`;super(t),Oe()}},je=class{dependencyMap=new Map;constructor(e){this.normalizeDependencies(e).map(e=>this.add(e[0],e[1]))}add(e,t){t===void 0&&(t={useClass:e,lazy:!1});let n=this.dependencyMap.get(e);n===void 0&&(n=[],this.dependencyMap.set(e,n)),n.push(t)}delete(e){this.dependencyMap.delete(e)}get(e,t){let n=this.dependencyMap.get(e);return me(e,t,n.length),he(t,n)}has(e){return this.dependencyMap.has(e)}dispose(){this.dependencyMap.clear()}normalizeDependencies(e){return e.map(e=>{let t=e[0],n;return n=we(e)?{useClass:e[0],lazy:!1}:e[1],[t,n]})}},Me=class{resolvedDependencies=new Map;add(e,t){let n=this.resolvedDependencies.get(e);n===void 0&&(n=[],this.resolvedDependencies.set(e,n)),n.push(t)}has(e){return this.resolvedDependencies.has(e)}get(e,t){let n=this.resolvedDependencies.get(e);if(!n)throw new Ae(e);return me(e,t,n.length),t===D.MANY?n:n[0]}dispose(){Array.from(this.resolvedDependencies.values()).forEach(e=>{e.forEach(e=>Ce(e)?e.dispose():void 0)}),this.resolvedDependencies.clear()}},Ne;(function(){if(typeof requestIdleCallback<`u`&&typeof cancelIdleCallback<`u`)Ne=(e,t)=>{let n=requestIdleCallback(e,typeof t==`number`?{timeout:t}:void 0),r=!1;return()=>{r||(r=!0,cancelIdleCallback(n))}};else{let e=Object.freeze({didTimeout:!0,timeRemaining(){return 15}});Ne=t=>{let n=setTimeout(()=>t(e)),r=!1;return()=>{r||(r=!0,clearTimeout(n))}}}})();var Pe=class{executor;disposeIdleCallback;didRun=!1;value;error;constructor(e){this.executor=()=>{try{this.value=e()}catch(e){this.error=e}finally{this.didRun=!0}},this.disposeIdleCallback=Ne(()=>this.executor())}hasRun(){return this.didRun}dispose(){this.disposeIdleCallback()}getValue(){if(this.didRun||(this.disposeIdleCallback(),this.executor()),this.error)throw this.error;return this.value}},Fe=300,Ie=Symbol(`$$NOT_INSTANTIATED_SYMBOL`),Le=class extends E{constructor(e){super(`Detecting cyclic dependency. The last identifier is "${T(e)}".`)}},Re=class extends E{constructor(){super(`Injector cannot be accessed after it was disposed.`)}},ze=class extends E{constructor(e){super(`Async item "${T(e)}" returns another async item.`)}},Be=class extends E{constructor(e){super(`Cannot get async item "${T(e)}" from sync api.`)}},Ve=class extends E{constructor(e){super(`Cannot add dependency "${T(e)}" after it is already resolved.`)}},He=class extends E{constructor(e){super(`Cannot delete dependency "${T(e)}" when it is already resolved.`)}},Ue=class e{dependencyCollection;resolvedDependencyCollection;children=[];resolutionOngoing=0;disposingCallbacks=new Set;disposed=!1;constructor(e,t=null){this.parent=t,this.dependencyCollection=new je(e||[]),this.resolvedDependencyCollection=new Me,t&&t.children.push(this)}onDispose(e){return this.disposingCallbacks.add(e),{dispose:()=>this.disposingCallbacks.delete(e)}}createChild(t){return this._ensureInjectorNotDisposed(),new e(t,this)}dispose(){this.children.forEach(e=>e.dispose()),this.children.length=0,this.dependencyCollection.dispose(),this.resolvedDependencyCollection.dispose(),this.deleteSelfFromParent(),this.disposed=!0,this.disposingCallbacks.forEach(e=>e()),this.disposingCallbacks.clear()}deleteSelfFromParent(){if(this.parent){let e=this.parent.children.indexOf(this);this.parent.children.splice(e,1)}}add(e){this._ensureInjectorNotDisposed();let t=e[0],n=e[1];if(this.resolvedDependencyCollection.has(t))throw new Ve(t);n===void 0?this.dependencyCollection.add(t):S(n)||v(n)||b(n)||y(n)?this.dependencyCollection.add(t,n):this.resolvedDependencyCollection.add(t,n)}replace(e){this._ensureInjectorNotDisposed();let t=e[0];if(this.resolvedDependencyCollection.has(t))throw new Ve(t);this.dependencyCollection.delete(t),this.dependencyCollection.add(t,e[1])}delete(e){if(this._ensureInjectorNotDisposed(),this.resolvedDependencyCollection.has(e))throw new He(e);this.dependencyCollection.delete(e)}invoke(e,...t){return this._ensureInjectorNotDisposed(),e({get:(e,t,n)=>this._get(e,t,n),has:e=>this.has(e)},...t)}has(e){return this.dependencyCollection.has(e)||this.parent?.has(e)||!1}get(e,t,n){this._ensureInjectorNotDisposed();let r=this._get(e,t,n);if(Array.isArray(r)&&r.some(e=>w(e))||w(r))throw new Be(e);return r}_get(e,t,n,r){let i=D.REQUIRED;if(t===D.REQUIRED||t===D.OPTIONAL||t===D.MANY?i=t:n=t,!r){let t=this.getValue(e,i,n);if(t!==Ie)return t}let a=!r;return this.createDependency(e,i,n,a)}getAsync(e){this._ensureInjectorNotDisposed();let t=this.getValue(e,D.REQUIRED);if(t!==Ie)return Promise.resolve(t);let n=this.createDependency(e,D.REQUIRED);return w(n)?n.whenReady():Promise.resolve(n)}createInstance(e,...t){return this._ensureInjectorNotDisposed(),this._resolveClassImpl({useClass:e},...t)}_resolveDependency(e,t,n=!0){let r;Ee(e);try{r=b(t)?this._resolveValueDependency(e,t):y(t)?this._resolveFactory(e,t,n):v(t)?this._resolveClass(e,t,n):x(t)?this._resolveExisting(e,t):this._resolveAsync(e,t),De()}catch(e){throw De(),e}return r}_resolveExisting(e,t){let n=this.get(t.useExisting);return this.resolvedDependencyCollection.add(e,n),n}_resolveValueDependency(e,t){let n=t.useValue;return this.resolvedDependencyCollection.add(e,n),n}_resolveClass(e,t,n){let r;if(t.lazy){let e=new Pe(()=>(this._ensureInjectorNotDisposed(),this._resolveClassImpl(t)));r=new Proxy(Object.create(null),{get(t,n){if(n in t)return t[n];let r=e.getValue(),i=r[n];return typeof i==`function`?(i=i.bind(r),t[n]=i,i):i},set(t,n,r){return e.getValue()[n]=r,!0}})}else r=this._resolveClassImpl(t);return e&&n&&this.resolvedDependencyCollection.add(e,r),r}_resolveClassImpl(e,...t){let n=e.useClass;this.markNewResolution(n);let r=ne(n).sort((e,t)=>e.paramIndex-t.paramIndex).map(e=>({...e,identifier:Se(e.identifier)})),i=[];for(let e of r)try{let t=this._get(e.identifier,e.quantity,e.lookUp,e.withNew);i.push(t)}catch(t){throw t instanceof Ae||t instanceof pe&&t.actual===0?new ke(n,e.identifier,e.paramIndex):t}let a=[...t],o=r.length>0?r[0].paramIndex:a.length;if(a.length!==o){console.warn(`[redi]: Expect ${o} custom parameter(s) of ${T(n)} but get ${a.length}.`);let e=o-a.length;a=e>0?[...a,...Array.from({length:e}).fill(void 0)]:a.slice(0,o)}let s=new n(...a,...i);return e?.onInstantiation?.(s),this.markResolutionCompleted(),s}_resolveFactory(e,t,n){this.markNewResolution(e);let r=be(t.deps),i=[];for(let t of r)try{let e=this._get(t.identifier,t.quantity,t.lookUp,t.withNew);i.push(e)}catch(n){throw n instanceof Ae||n instanceof pe&&n.actual===0?new ke(e,t.identifier,t.paramIndex):n}let a=t.useFactory.apply(null,i);return n&&this.resolvedDependencyCollection.add(e,a),this.markResolutionCompleted(),t?.onInstantiation?.(a),a}_resolveAsync(e,t){return{__symbol:C,whenReady:()=>this._resolveAsyncImpl(e,t)}}_resolveAsyncImpl(e,t){return t.useAsync().then(n=>{let r=this.getValue(e);if(r!==Ie)return r;let i;if(Array.isArray(n)){let t=n[1];if(S(t))throw new ze(e);i=this._resolveDependency(e,t)}else i=_(n)?this._resolveClassImpl({useClass:n,onInstantiation:t.onInstantiation}):n;return this.resolvedDependencyCollection.add(e,i),i})}getValue(t,n=D.REQUIRED,r){let i=()=>this.dependencyCollection.has(t)&&!this.resolvedDependencyCollection.has(t)?Ie:this.resolvedDependencyCollection.get(t,n),a=()=>{if(this.parent)return this.parent.getValue(t,n);if(n===D.OPTIONAL)return null;if(n===D.MANY)return[];throw new pe(t,D.REQUIRED,0)};return r===O.SKIP_SELF?a():t===e?this:r===O.SELF||this.resolvedDependencyCollection.has(t)||this.dependencyCollection.has(t)?i():a()}createDependency(e,t,n,r=!0){let i=()=>{let n=this.dependencyCollection.get(e,t),i=null;return i=Array.isArray(n)?n.map(t=>this._resolveDependency(e,t,r)):this._resolveDependency(e,n,r),i},a=()=>{if(this.parent)return this.parent.createDependency(e,t,void 0,r);if(t===D.OPTIONAL)return null;if(t===D.MANY)return[];throw Ee(e),new Ae(e)};return n===O.SKIP_SELF?a():this.dependencyCollection.has(e)?i():a()}markNewResolution(e){if(this.resolutionOngoing+=1,this.resolutionOngoing>=Fe)throw new Le(e)}markResolutionCompleted(){--this.resolutionOngoing}_ensureInjectorNotDisposed(){if(this.disposed)throw new Re}},We=typeof globalThis<`u`&&globalThis||typeof window<`u`&&window||typeof global<`u`&&global,Ge=`REDI_GLOBAL_LOCK`,Ke=typeof process<`u`&&process.versions!=null&&process.versions.node!=null;We[Ge]?Ke||console.error(`[redi]: You are loading scripts of redi more than once! This may cause undesired behavior in your application.
3
3
  Maybe your dependencies added redi as its dependency and bundled redi to its dist files. Or you import different versions of redi.
4
4
  For more info please visit our website: https://redi.wendell.fun/en-US/docs/faq#import-scripts-of-redi-more-than-once`):We[Ge]=!0;var qe=typeof global==`object`&&global&&global.Object===Object&&global,Je=typeof self==`object`&&self&&self.Object===Object&&self,Ye=qe||Je||Function(`return this`)(),Xe=Ye.Symbol,Ze=Object.prototype,Qe=Ze.hasOwnProperty,$e=Ze.toString,et=Xe?Xe.toStringTag:void 0;function tt(e){var t=Qe.call(e,et),n=e[et];try{e[et]=void 0;var r=!0}catch{}var i=$e.call(e);return r&&(t?e[et]=n:delete e[et]),i}var nt=Object.prototype.toString;function rt(e){return nt.call(e)}var it=`[object Null]`,at=`[object Undefined]`,ot=Xe?Xe.toStringTag:void 0;function st(e){return e==null?e===void 0?at:it:ot&&ot in Object(e)?tt(e):rt(e)}function ct(e){return typeof e==`object`&&!!e}var lt=`[object Symbol]`;function ut(e){return typeof e==`symbol`||ct(e)&&st(e)==lt}function dt(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}var ft=Array.isArray,pt=1/0,mt=Xe?Xe.prototype:void 0,ht=mt?mt.toString:void 0;function gt(e){if(typeof e==`string`)return e;if(ft(e))return dt(e,gt)+``;if(ut(e))return ht?ht.call(e):``;var t=e+``;return t==`0`&&1/e==-pt?`-0`:t}var _t=/\s/;function vt(e){for(var t=e.length;t--&&_t.test(e.charAt(t)););return t}var yt=/^\s+/;function bt(e){return e&&e.slice(0,vt(e)+1).replace(yt,``)}function xt(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}var St=NaN,Ct=/^[-+]0x[0-9a-f]+$/i,wt=/^0b[01]+$/i,Tt=/^0o[0-7]+$/i,Et=parseInt;function Dt(e){if(typeof e==`number`)return e;if(ut(e))return St;if(xt(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=xt(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=bt(e);var n=wt.test(e);return n||Tt.test(e)?Et(e.slice(2),n?2:8):Ct.test(e)?St:+e}function Ot(e){return e}var kt=`[object AsyncFunction]`,At=`[object Function]`,jt=`[object GeneratorFunction]`,Mt=`[object Proxy]`;function Nt(e){if(!xt(e))return!1;var t=st(e);return t==At||t==jt||t==kt||t==Mt}var Pt=Ye[`__core-js_shared__`],Ft=function(){var e=/[^.]+$/.exec(Pt&&Pt.keys&&Pt.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function It(e){return!!Ft&&Ft in e}var Lt=Function.prototype.toString;function Rt(e){if(e!=null){try{return Lt.call(e)}catch{}try{return e+``}catch{}}return``}var zt=/[\\^$.*+?()[\]{}|]/g,Bt=/^\[object .+?Constructor\]$/,Vt=Function.prototype,Ht=Object.prototype,Ut=Vt.toString,Wt=Ht.hasOwnProperty,Gt=RegExp(`^`+Ut.call(Wt).replace(zt,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function Kt(e){return!xt(e)||It(e)?!1:(Nt(e)?Gt:Bt).test(Rt(e))}function qt(e,t){return e?.[t]}function Jt(e,t){var n=qt(e,t);return Kt(n)?n:void 0}var Yt=Object.create,Xt=function(){function e(){}return function(t){if(!xt(t))return{};if(Yt)return Yt(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function Zt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Qt(e,t){var n=-1,r=e.length;for(t||=Array(r);++n<r;)t[n]=e[n];return t}var $t=800,en=16,tn=Date.now;function nn(e){var t=0,n=0;return function(){var r=tn(),i=en-(r-n);if(n=r,i>0){if(++t>=$t)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function rn(e){return function(){return e}}var an=function(){try{var e=Jt(Object,`defineProperty`);return e({},``,{}),e}catch{}}(),on=nn(an?function(e,t){return an(e,`toString`,{configurable:!0,enumerable:!1,value:rn(t),writable:!0})}:Ot),sn=9007199254740991,cn=/^(?:0|[1-9]\d*)$/;function ln(e,t){var n=typeof e;return t??=sn,!!t&&(n==`number`||n!=`symbol`&&cn.test(e))&&e>-1&&e%1==0&&e<t}function un(e,t,n){t==`__proto__`&&an?an(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function dn(e,t){return e===t||e!==e&&t!==t}var fn=Object.prototype.hasOwnProperty;function pn(e,t,n){var r=e[t];(!(fn.call(e,t)&&dn(r,n))||n===void 0&&!(t in e))&&un(e,t,n)}function mn(e,t,n,r){var i=!n;n||={};for(var a=-1,o=t.length;++a<o;){var s=t[a],c=r?r(n[s],e[s],s,n,e):void 0;c===void 0&&(c=e[s]),i?un(n,s,c):pn(n,s,c)}return n}var hn=Math.max;function gn(e,t,n){return t=hn(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,a=hn(r.length-t,0),o=Array(a);++i<a;)o[i]=r[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=r[i];return s[t]=n(o),Zt(e,this,s)}}function _n(e,t){return on(gn(e,t,Ot),e+``)}var vn=9007199254740991;function yn(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=vn}function bn(e){return e!=null&&yn(e.length)&&!Nt(e)}function xn(e,t,n){if(!xt(n))return!1;var r=typeof t;return(r==`number`?bn(n)&&ln(t,n.length):r==`string`&&t in n)?dn(n[t],e):!1}function Sn(e){return _n(function(t,n){var r=-1,i=n.length,a=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(a=e.length>3&&typeof a==`function`?(i--,a):void 0,o&&xn(n[0],n[1],o)&&(a=i<3?void 0:a,i=1),t=Object(t);++r<i;){var s=n[r];s&&e(t,s,r,a)}return t})}var Cn=Object.prototype;function wn(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||Cn)}function Tn(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var En=`[object Arguments]`;function Dn(e){return ct(e)&&st(e)==En}var On=Object.prototype,kn=On.hasOwnProperty,An=On.propertyIsEnumerable,jn=Dn(function(){return arguments}())?Dn:function(e){return ct(e)&&kn.call(e,`callee`)&&!An.call(e,`callee`)};function Mn(){return!1}var Nn=typeof e==`object`&&e&&!e.nodeType&&e,Pn=Nn&&typeof module==`object`&&module&&!module.nodeType&&module,Fn=Pn&&Pn.exports===Nn?Ye.Buffer:void 0,In=(Fn?Fn.isBuffer:void 0)||Mn,Ln=`[object Arguments]`,Rn=`[object Array]`,zn=`[object Boolean]`,Bn=`[object Date]`,Vn=`[object Error]`,Hn=`[object Function]`,Un=`[object Map]`,Wn=`[object Number]`,Gn=`[object Object]`,Kn=`[object RegExp]`,qn=`[object Set]`,Jn=`[object String]`,Yn=`[object WeakMap]`,Xn=`[object ArrayBuffer]`,Zn=`[object DataView]`,Qn=`[object Float32Array]`,$n=`[object Float64Array]`,er=`[object Int8Array]`,tr=`[object Int16Array]`,nr=`[object Int32Array]`,rr=`[object Uint8Array]`,ir=`[object Uint8ClampedArray]`,ar=`[object Uint16Array]`,or=`[object Uint32Array]`,sr={};sr[Qn]=sr[$n]=sr[er]=sr[tr]=sr[nr]=sr[rr]=sr[ir]=sr[ar]=sr[or]=!0,sr[Ln]=sr[Rn]=sr[Xn]=sr[zn]=sr[Zn]=sr[Bn]=sr[Vn]=sr[Hn]=sr[Un]=sr[Wn]=sr[Gn]=sr[Kn]=sr[qn]=sr[Jn]=sr[Yn]=!1;function cr(e){return ct(e)&&yn(e.length)&&!!sr[st(e)]}function lr(e){return function(t){return e(t)}}var ur=typeof e==`object`&&e&&!e.nodeType&&e,dr=ur&&typeof module==`object`&&module&&!module.nodeType&&module,fr=dr&&dr.exports===ur&&qe.process,pr=function(){try{return dr&&dr.require&&dr.require(`util`).types||fr&&fr.binding&&fr.binding(`util`)}catch{}}(),mr=pr&&pr.isTypedArray,hr=mr?lr(mr):cr,gr=Object.prototype.hasOwnProperty;function _r(e,t){var n=ft(e),r=!n&&jn(e),i=!n&&!r&&In(e),a=!n&&!r&&!i&&hr(e),o=n||r||i||a,s=o?Tn(e.length,String):[],c=s.length;for(var l in e)(t||gr.call(e,l))&&!(o&&(l==`length`||i&&(l==`offset`||l==`parent`)||a&&(l==`buffer`||l==`byteLength`||l==`byteOffset`)||ln(l,c)))&&s.push(l);return s}function vr(e,t){return function(n){return e(t(n))}}function yr(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var br=Object.prototype.hasOwnProperty;function xr(e){if(!xt(e))return yr(e);var t=wn(e),n=[];for(var r in e)(r!=`constructor`||!t&&br.call(e,r))&&n.push(r);return n}function Sr(e){return bn(e)?_r(e,!0):xr(e)}var Cr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,wr=/^\w*$/;function Tr(e,t){if(ft(e))return!1;var n=typeof e;return n==`number`||n==`symbol`||n==`boolean`||e==null||ut(e)?!0:wr.test(e)||!Cr.test(e)||t!=null&&e in Object(t)}var Er=Jt(Object,`create`);function Dr(){this.__data__=Er?Er(null):{},this.size=0}function Or(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}var kr=`__lodash_hash_undefined__`,Ar=Object.prototype.hasOwnProperty;function jr(e){var t=this.__data__;if(Er){var n=t[e];return n===kr?void 0:n}return Ar.call(t,e)?t[e]:void 0}var Mr=Object.prototype.hasOwnProperty;function Nr(e){var t=this.__data__;return Er?t[e]!==void 0:Mr.call(t,e)}var Pr=`__lodash_hash_undefined__`;function Fr(e,t){var n=this.__data__;return this.size+=+!this.has(e),n[e]=Er&&t===void 0?Pr:t,this}function Ir(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Ir.prototype.clear=Dr,Ir.prototype.delete=Or,Ir.prototype.get=jr,Ir.prototype.has=Nr,Ir.prototype.set=Fr;function Lr(){this.__data__=[],this.size=0}function Rr(e,t){for(var n=e.length;n--;)if(dn(e[n][0],t))return n;return-1}var zr=Array.prototype.splice;function Br(e){var t=this.__data__,n=Rr(t,e);return n<0?!1:(n==t.length-1?t.pop():zr.call(t,n,1),--this.size,!0)}function Vr(e){var t=this.__data__,n=Rr(t,e);return n<0?void 0:t[n][1]}function Hr(e){return Rr(this.__data__,e)>-1}function Ur(e,t){var n=this.__data__,r=Rr(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function Wr(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Wr.prototype.clear=Lr,Wr.prototype.delete=Br,Wr.prototype.get=Vr,Wr.prototype.has=Hr,Wr.prototype.set=Ur;var Gr=Jt(Ye,`Map`);function Kr(){this.size=0,this.__data__={hash:new Ir,map:new(Gr||Wr),string:new Ir}}function qr(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}function Jr(e,t){var n=e.__data__;return qr(t)?n[typeof t==`string`?`string`:`hash`]:n.map}function Yr(e){var t=Jr(this,e).delete(e);return this.size-=+!!t,t}function Xr(e){return Jr(this,e).get(e)}function Zr(e){return Jr(this,e).has(e)}function Qr(e,t){var n=Jr(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function $r(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}$r.prototype.clear=Kr,$r.prototype.delete=Yr,$r.prototype.get=Xr,$r.prototype.has=Zr,$r.prototype.set=Qr;var ei=`Expected a function`;function ti(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(ei);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(ti.Cache||$r),n}ti.Cache=$r;var ni=500;function ri(e){var t=ti(e,function(e){return n.size===ni&&n.clear(),e}),n=t.cache;return t}var ii=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ai=/\\(\\)?/g,oi=ri(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(ii,function(e,n,r,i){t.push(r?i.replace(ai,`$1`):n||e)}),t});function si(e){return e==null?``:gt(e)}function ci(e,t){return ft(e)?e:Tr(e,t)?[e]:oi(si(e))}var li=1/0;function ui(e){if(typeof e==`string`||ut(e))return e;var t=e+``;return t==`0`&&1/e==-li?`-0`:t}function di(e,t){t=ci(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[ui(t[n++])];return n&&n==r?e:void 0}function fi(e,t,n){var r=e==null?void 0:di(e,t);return r===void 0?n:r}var pi=vr(Object.getPrototypeOf,Object),mi=`[object Object]`,hi=Function.prototype,gi=Object.prototype,_i=hi.toString,vi=gi.hasOwnProperty,yi=_i.call(Object);function bi(e){if(!ct(e)||st(e)!=mi)return!1;var t=pi(e);if(t===null)return!0;var n=vi.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&_i.call(n)==yi}function xi(){this.__data__=new Wr,this.size=0}function Si(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function Ci(e){return this.__data__.get(e)}function wi(e){return this.__data__.has(e)}var Ti=200;function Ei(e,t){var n=this.__data__;if(n instanceof Wr){var r=n.__data__;if(!Gr||r.length<Ti-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new $r(r)}return n.set(e,t),this.size=n.size,this}function Di(e){var t=this.__data__=new Wr(e);this.size=t.size}Di.prototype.clear=xi,Di.prototype.delete=Si,Di.prototype.get=Ci,Di.prototype.has=wi,Di.prototype.set=Ei;var Oi=typeof e==`object`&&e&&!e.nodeType&&e,ki=Oi&&typeof module==`object`&&module&&!module.nodeType&&module,Ai=ki&&ki.exports===Oi?Ye.Buffer:void 0,ji=Ai?Ai.allocUnsafe:void 0;function Mi(e,t){if(t)return e.slice();var n=e.length,r=ji?ji(n):new e.constructor(n);return e.copy(r),r}var Ni=Ye.Uint8Array;function Pi(e){var t=new e.constructor(e.byteLength);return new Ni(t).set(new Ni(e)),t}function Fi(e,t){var n=t?Pi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Ii(e){return typeof e.constructor==`function`&&!wn(e)?Xt(pi(e)):{}}function Li(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(n(a[c],c,a)===!1)break}return t}}var Ri=Li(),zi=function(){return Ye.Date.now()},Bi=`Expected a function`,Vi=Math.max,Hi=Math.min;function Ui(e,t,n){var r,i,a,o,s,c,l=0,u=!1,d=!1,f=!0;if(typeof e!=`function`)throw TypeError(Bi);t=Dt(t)||0,xt(n)&&(u=!!n.leading,d=`maxWait`in n,a=d?Vi(Dt(n.maxWait)||0,t):a,f=`trailing`in n?!!n.trailing:f);function p(t){var n=r,a=i;return r=i=void 0,l=t,o=e.apply(a,n),o}function m(e){return l=e,s=setTimeout(_,t),u?p(e):o}function h(e){var n=e-c,r=e-l,i=t-n;return d?Hi(i,a-r):i}function g(e){var n=e-c,r=e-l;return c===void 0||n>=t||n<0||d&&r>=a}function _(){var e=zi();if(g(e))return v(e);s=setTimeout(_,h(e))}function v(e){return s=void 0,f&&r?p(e):(r=i=void 0,o)}function y(){s!==void 0&&clearTimeout(s),l=0,r=c=i=s=void 0}function b(){return s===void 0?o:v(zi())}function x(){var e=zi(),n=g(e);if(r=arguments,i=this,c=e,n){if(s===void 0)return m(c);if(d)return clearTimeout(s),s=setTimeout(_,t),p(c)}return s===void 0&&(s=setTimeout(_,t)),o}return x.cancel=y,x.flush=b,x}function Wi(e,t,n){(n!==void 0&&!dn(e[t],n)||n===void 0&&!(t in e))&&un(e,t,n)}function Gi(e){return ct(e)&&bn(e)}function Ki(e,t){if((t!==`constructor`||typeof e[t]!=`function`)&&t!=`__proto__`)return e[t]}function qi(e){return mn(e,Sr(e))}function Ji(e,t,n,r,i,a,o){var s=Ki(e,n),c=Ki(t,n),l=o.get(c);if(l){Wi(e,n,l);return}var u=a?a(s,c,n+``,e,t,o):void 0,d=u===void 0;if(d){var f=ft(c),p=!f&&In(c),m=!f&&!p&&hr(c);u=c,f||p||m?ft(s)?u=s:Gi(s)?u=Qt(s):p?(d=!1,u=Mi(c,!0)):m?(d=!1,u=Fi(c,!0)):u=[]:bi(c)||jn(c)?(u=s,jn(s)?u=qi(s):(!xt(s)||Nt(s))&&(u=Ii(c))):d=!1}d&&(o.set(c,u),i(u,c,r,a,o),o.delete(c)),Wi(e,n,u)}function Yi(e,t,n,r,i){e!==t&&Ri(t,function(a,o){if(i||=new Di,xt(a))Ji(e,t,o,n,Yi,r,i);else{var s=r?r(Ki(e,o),a,o+``,e,t,i):void 0;s===void 0&&(s=a),Wi(e,o,s)}},Sr)}var Xi=Sn(function(e,t,n,r){Yi(e,t,n,r)}),Zi=Sn(function(e,t,n){Yi(e,t,n)});function Qi(e,t,n,r){if(!xt(e))return e;t=ci(t,e);for(var i=-1,a=t.length,o=a-1,s=e;s!=null&&++i<a;){var c=ui(t[i]),l=n;if(c===`__proto__`||c===`constructor`||c===`prototype`)return e;if(i!=o){var u=s[c];l=r?r(u,c,s):void 0,l===void 0&&(l=xt(u)?u:ln(t[i+1])?[]:{})}pn(s,c,l),s=s[c]}return e}function $i(e,t,n){return e==null?e:Qi(e,t,n)}var N=function(e){return e[e.UNIVER_UNKNOWN=0]=`UNIVER_UNKNOWN`,e[e.UNIVER_DOC=1]=`UNIVER_DOC`,e[e.UNIVER_SHEET=2]=`UNIVER_SHEET`,e[e.UNIVER_SLIDE=3]=`UNIVER_SLIDE`,e[e.UNIVER_PROJECT=4]=`UNIVER_PROJECT`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({}),ea=function(e){return e[e.View=0]=`View`,e[e.Edit=1]=`Edit`,e[e.ManageCollaborator=2]=`ManageCollaborator`,e[e.Print=3]=`Print`,e[e.Duplicate=4]=`Duplicate`,e[e.Comment=5]=`Comment`,e[e.Copy=6]=`Copy`,e[e.Share=7]=`Share`,e[e.Export=8]=`Export`,e[e.MoveWorksheet=9]=`MoveWorksheet`,e[e.DeleteWorksheet=10]=`DeleteWorksheet`,e[e.HideWorksheet=11]=`HideWorksheet`,e[e.RenameWorksheet=12]=`RenameWorksheet`,e[e.CreateWorksheet=13]=`CreateWorksheet`,e[e.SetWorksheetStyle=14]=`SetWorksheetStyle`,e[e.EditWorksheetCell=15]=`EditWorksheetCell`,e[e.InsertHyperlink=16]=`InsertHyperlink`,e[e.Sort=17]=`Sort`,e[e.Filter=18]=`Filter`,e[e.PivotTable=19]=`PivotTable`,e[e.FloatImg=20]=`FloatImg`,e[e.IHistory=21]=`IHistory`,e[e.RwHgtClWdt=22]=`RwHgtClWdt`,e[e.ViemRwHgtClWdt=23]=`ViemRwHgtClWdt`,e[e.ViewFilter=24]=`ViewFilter`,e[e.MoveSheet=25]=`MoveSheet`,e[e.DeleteSheet=26]=`DeleteSheet`,e[e.HideSheet=27]=`HideSheet`,e[e.CopySheet=28]=`CopySheet`,e[e.RenameSheet=29]=`RenameSheet`,e[e.CreateSheet=30]=`CreateSheet`,e[e.SelectProtectedCells=31]=`SelectProtectedCells`,e[e.SelectUnProtectedCells=32]=`SelectUnProtectedCells`,e[e.SetCellStyle=33]=`SetCellStyle`,e[e.SetCellValue=34]=`SetCellValue`,e[e.SetRowStyle=35]=`SetRowStyle`,e[e.SetColumnStyle=36]=`SetColumnStyle`,e[e.InsertRow=37]=`InsertRow`,e[e.InsertColumn=38]=`InsertColumn`,e[e.DeleteRow=39]=`DeleteRow`,e[e.DeleteColumn=40]=`DeleteColumn`,e[e.EditExtraObject=41]=`EditExtraObject`,e[e.Delete=42]=`Delete`,e[e.RecoverHistory=43]=`RecoverHistory`,e[e.ViewHistory=44]=`ViewHistory`,e[e.CreatePermissionObject=45]=`CreatePermissionObject`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({}),ta=function(e){return e[e.Reader=0]=`Reader`,e[e.Editor=1]=`Editor`,e[e.Owner=2]=`Owner`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({}),na=function(e){return e[e.Unkonwn=0]=`Unkonwn`,e[e.Workbook=1]=`Workbook`,e[e.Worksheet=2]=`Worksheet`,e[e.SelectRange=3]=`SelectRange`,e[e.Document=4]=`Document`,e[e.Slide=5]=`Slide`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({}),ra=function(e){return e[e.SomeCollaborator=0]=`SomeCollaborator`,e[e.AllCollaborator=1]=`AllCollaborator`,e[e.OneSelf=2]=`OneSelf`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({}),ia=function(e,t){return ia=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},ia(e,t)};function aa(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);ia(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var oa=function(){return oa=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},oa.apply(this,arguments)};function sa(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function ca(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function la(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o=Object.create((typeof Iterator==`function`?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(s){if(r)throw TypeError(`Generator is already executing.`);for(;o&&(o=0,s[0]&&(n=0)),n;)try{if(r=1,i&&(a=s[0]&2?i.return:s[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,s[1])).done)return a;switch(i=0,a&&(s=[s[0]&2,a.value]),s[0]){case 0:case 1:a=s;break;case 4:return n.label++,{value:s[1],done:!1};case 5:n.label++,i=s[1],s=[0];continue;case 7:s=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){n.label=s[1];break}if(s[0]===6&&n.label<a[1]){n.label=a[1],a=s;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(s);break}a[2]&&n.ops.pop(),n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e],i=0}finally{r=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}function ua(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function da(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function fa(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}function pa(e){return this instanceof pa?(this.v=e,this):new pa(e)}function ma(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i=Object.create((typeof AsyncIterator==`function`?AsyncIterator:Object).prototype),s(`next`),s(`throw`),s(`return`,o),i[Symbol.asyncIterator]=function(){return this},i;function o(e){return function(t){return Promise.resolve(t).then(e,d)}}function s(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,t){try{l(r[e](t))}catch(e){f(a[0][3],e)}}function l(e){e.value instanceof pa?Promise.resolve(e.value.v).then(u,d):f(a[0][2],e)}function u(e){c(`next`,e)}function d(e){c(`throw`,e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}}function ha(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof ua==`function`?ua(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}}function ga(e){return typeof e==`function`}function _a(e){var t=e(function(e){Error.call(e),e.stack=Error().stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var va=_a(function(e){return function(t){e(this),this.message=t?t.length+` errors occurred during unsubscription:
@@ -601,9 +601,9 @@ div:has(> svg.univerjs-icon-solve-icon),
601
601
  div:has(> svg.univerjs-icon-resolved-icon) {
602
602
  display: none !important;
603
603
  }
604
- `,YW=`pd-comment-ui-guard`,XW=0;function ddt(){if(XW+=1,XW>1||document.getElementById(YW))return;let e=document.createElement(`style`);e.id=YW,e.textContent=udt,document.head.appendChild(e)}function fdt(){XW=Math.max(0,XW-1),!(XW>0)&&document.getElementById(YW)?.remove()}function pdt(e,t){e?.mergeMenu({[cdt]:{[t.ribbonItem]:{menuItemFactory:e=>({id:t.addOperation,type:zj.BUTTON,icon:`CommentIcon`,title:t.addTitle,tooltip:t.addTitle,hidden$:nj(e,t.instanceType)})}}})}function mdt({univer:e,univerAPI:t,kind:n=`doc`}={}){let r=ldt[n];if(!r||!e||typeof e.__getInjector!=`function`||!t?.addEvent)return null;let i=new Set(r.blockedOperations),a=[];ddt();try{a.push(t.addEvent(t.Event.BeforeCommandExecute,e=>{i.has(e?.id)&&(e.cancel=!0)}))}catch{}try{let t=e.__getInjector(),n=t.get(Ij),i=t.get(Fb);a.push(i.lifecycle$.subscribe(e=>{e>=Mb.Rendered&&pdt(n,r)}))}catch{}return{dispose(){for(let e of a)try{typeof e==`function`?e():e?.unsubscribe?e.unsubscribe():e?.dispose?.()}catch{}fdt()}}}var hdt=`thread-comment-ui`,gdt={editor:{reply:`确定`}};function _dt(e){let t=Object.assign({},...e),n=t[hdt];return!n||!n.editor||(t[hdt]={...n,editor:{...n.editor,...gdt.editor}}),t}var vdt=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},ydt={class:`doc-shell`},bdt={class:`doc-layout`},xdt={class:`doc-canvas`},Sdt={key:0,class:`readonly-badge`,role:`status`},Cdt={key:1,class:`attachment-uploading-tip`,role:`status`},wdt={key:2,class:`attachment-error-tip`},Tdt={class:`link-dialog`},Edt={class:`link-dialog-field`},Ddt={class:`link-dialog-field`},Odt={key:0,class:`field-error`},kdt={class:`link-dialog-tip`},Adt={class:`link-dialog-actions`},jdt=[`disabled`],Mdt={key:0,class:`hover-icon-tip`},Ndt={class:`hover-style`},Pdt={key:0,class:`hover-style-menu`},Fdt=[`onClick`],Idt={class:`style-check`},Ldt={class:`style-name`},Rdt=`univer-sheet://`,ZW=`🔗 `,zdt=`#e4f9fbff`,Bdt=6,Vdt=9,Hdt=6,QW=`hxy.doc.command.format-painter`,Udt=400,$W=`hxy.doc.command.insert-page-break`,eG=`hxy.doc.command.insert-attachment`,Wdt=`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6zM6 20V4h7v5h5v3H6v2h12v6H6z`,Gdt=`M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5c0-1.38 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5c0 1.38 1.12 2.5 2.5 2.5s2.5-1.12 2.5-2.5V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6h-1.5z`,tG=2,Kdt=`.pdf,.doc,.docx,.zip,.rar,.7z,.mp4,.mov,.webm,.avi,.mkv,.mp3,.wav,.m4a,.aac`,qdt=157286400,Jdt=2097152,Ydt=vdt({__name:`DocEditor`,props:{visible:{type:Boolean,default:!0},type:{type:String,default:`edit`,validator:e=>[`view`,`edit`].includes(e)},server:{type:Object,default:null},collaboration:{type:Object,default:null}},emits:[`open-workbook`],setup(e,{expose:n,emit:r}){let i=e,a=r,o=(0,t.ref)(!!i.server?.cloudSync),s=(0,t.ref)(``),c=(0,t.computed)(()=>i.type===`view`||o.value),l=null;function u(e,t){o.value=e,s.value=t,Ut()}async function d(){try{await A?.restore()}catch{}}let p=`demo-doc-01`;try{let e=rI.prototype,t=e._buildCustomRangeBoundsBySegment;if(typeof t==`function`&&!t.__hoverSegmentFixed){let n=function(e,n=-1){return t.call(this,e??``,n)};n.__hoverSegmentFixed=!0,e._buildCustomRangeBoundsBySegment=n,console.log(`[hover-patch] prototype._buildCustomRangeBoundsBySegment patched ✓`)}else typeof t!=`function`&&console.warn(`[hover-patch] _buildCustomRangeBoundsBySegment not found on prototype — engine API changed?`);let n=rF.prototype,r=n._addTextRange;if(typeof r==`function`&&!r.__singleCaretFixed){let e=function(e){r.call(this,e);let t=0;for(let e of this._rangeList)e.collapsed&&t++;t<=1||(this._rangeList=this._rangeList.filter(t=>t===e||!t.collapsed||(t.dispose(),!1)))};e.__singleCaretFixed=!0,n._addTextRange=e}try{let e=TZe,t=e?.preprocessHtml;typeof t==`function`&&!e.__lineSpacingNormalized&&(e.preprocessHtml=function(e){return t.call(this,out(e))},e.__lineSpacingNormalized=!0)}catch{}try{let e=TZe,t=e?.afterProcessRules,n=t?.[0]?.handler;typeof n==`function`&&!e.__exactLineSpacingFixed&&(e.afterProcessRules=[{...t[0],handler(e,t){n.call(this,e,t),hut(e,t);try{let n=t?.getAttribute?.(`style`)??``,r=n.match(/mso-line-height-rule\s*:\s*([a-z-]+)/i)?.[1]?.toLowerCase()??``;if(!r||r===`auto`)return;let i=n.match(/(?:^|;)\s*line-height\s*:\s*([0-9]*\.?[0-9]+)\s*(pt|px)?/i);if(!i)return;let a=e?.body?.paragraphs,o=a?.[a.length-1];if(!o)return;let s=parseFloat(i[1]);if((i[2]||``).toLowerCase()===`pt`&&(s/=.75),!Number.isFinite(s)||s<=0)return;o.paragraphStyle=o.paragraphStyle||{},o.paragraphStyle.spacingRule=r===`exactly`?2:1,o.paragraphStyle.lineSpacing=s}catch{}}}],e.__exactLineSpacingFixed=!0)}catch{}try{_ut(VT)&&console.log(`[pagebreak-patch] DocumentSkeleton._prepareLayoutContext patched ✓`)}catch{}}catch{}let m={"doc.command.set-inline-format-bold":`bl`,"doc.command.set-inline-format-italic":`it`,"doc.command.set-inline-format-underline":`ul`,"doc.command.set-inline-format-strikethrough":`st`},h={"doc.command.set-inline-format-fontsize":`fs`,"doc.command.set-inline-format-font-family":`ff`,"doc.command.set-inline-format-text-color":`cl`,"doc.command.set-inline-format-text-background-color":`bg`};function g(e,t,n,r){for(let i of e)if(i.st<n&&i.ed>t&&i.ts){if(r===`bl`||r===`it`){if(i.ts[r]===jp.TRUE)return!0}else if(i.ts[r]&&i.ts[r].s===jp.TRUE)return!0}return!1}function _(e,t,n,r,i){if(!t||!n||n.length===0)return!1;let a=t.getUnitId(),o=new Ev,s=new Mf;s.reset();let c=!1;for(let e of n){let{startOffset:t,endOffset:n}=e;if(t==null||n==null||t===n)continue;let a={dataStream:``,textRuns:[{st:0,ed:n-t,ts:{[r]:i}}]},l=t-s.cursor;l!==0&&o.push({t:Dm.RETAIN,len:l}),o.push({t:Dm.RETAIN,body:a,len:n-t}),s.reset(),s.moveCursor(n),c=!0}if(!c)return!1;let l=Dv.getInstance().editOp(o.serialize(),[`body`]);return!!e.syncExecuteCommand(TE.id,{unitId:a,actions:l,textRanges:n})}function v(e){let t=e.getTextRanges()||[];return t.length>0?t.filter(e=>e.startOffset!=null&&e.endOffset!=null):e.getDocRanges()||[]}function y(e){try{let t=e&&e.resolvedDependencyCollection&&e.resolvedDependencyCollection.resolvedDependencies;if(t&&t[Symbol.iterator]){for(let[e,n]of t)if(e&&e.name===`DocMenuStyleService`)return Array.isArray(n)?n[0]:n}}catch{}return null}function b(e,t){return e===`bl`||e===`it`?t?jp.FALSE:jp.TRUE:{s:t?jp.FALSE:jp.TRUE}}function x(){if(he)try{let e=he.__getInjector().get(z)._commandRegistry,t=e&&e.getCommand&&e.getCommand(`doc.command.set-inline-format`),n=t&&t[0];if(!n||n.__toggleFixed)return;let r=n.handler,i=(e,t,n)=>{let{preCommandId:i}=t||{},a=m[i],o=h[i];if(!a&&!o)return r(e,t,n);let s=e.get(SE),c=e.get(B),l=e.get(z),u=y(e)||y(he.__getInjector()),d=c.getCurrentUnitOfType(1),f=d&&d.getBody&&d.getBody(),p=v(s),x=p.find(e=>e.isActive)||p[0],S=t&&t.value!=null?o===`cl`||o===`bg`?{rgb:t.value}:t.value:null,C=e=>{u&&e&&setTimeout(()=>u.setStyleCache(e),0)};if(x&&x.startOffset===x.endOffset){let i=null;if(u&&f){let e=x.startOffset,t=e<(f.dataStream||``).length?e:Math.max(0,e-1);if(a){let e=u.getStyleCache()||{},n;n=e[a]===void 0?g(f.textRuns||[],t,t+1,a):a===`bl`||a===`it`?e[a]===jp.TRUE:!!(e[a]&&e[a].s===jp.TRUE),i={[a]:b(a,n)}}else S!=null&&(i={[o]:S})}let s=r(e,t,n);return C(i),s}if(a){if(f&&x){let{startOffset:e,endOffset:t}=x,n=b(a,g(f.textRuns||[],e,t,a)),r=_(l,d,[{startOffset:e,endOffset:t}],a,n);return C({[a]:n}),r}return r(e,t,n)}let w=r(e,t,n);return S!=null&&C({[o]:S}),w};i.__inject=r.__inject,i.__toggleFixed=!0,n.handler=i,console.log(`[toggle-patch] SetInlineFormatCommand toggle behavior fixed ✓`)}catch(e){console.warn(`[toggle-patch] failed:`,e)}}let S=(0,t.ref)(null),C=(0,t.shallowRef)(null),w=(0,t.ref)(null),T=null,E=null,D=null,O=null,k=(0,t.shallowRef)(null),A=i.server?.cloudSync?GW({editorRef:k,docKey:i.server.docKey||`doc:default`,docType:`doc`,cloudSync:i.server.cloudSync,snapshotInterval:i.server.snapshotInterval,mutationFlushSize:i.server.mutationFlushSize,enableIncremental:i.server.enableIncremental}):null,ee=(0,t.ref)([]);(0,t.ref)(``);let te=(0,t.reactive)({words:0,paragraphs:0}),j=(0,t.reactive)({visible:!1,text:``,url:``,urlError:``,style:`text`,startOffset:0,endOffset:0,segmentId:``,replace:!1}),ne=null,re=[{value:`text`,label:`文字链`},{value:`icon`,label:`图标+文字链`},{value:`card`,label:`卡片`}],ie=(0,t.reactive)({visible:!1,url:``,text:``,style:`text`,linkId:``,segmentId:``,startIndex:0,endIndex:0,styleMenuOpen:!1,copied:!1,isAttachment:!1,fileName:``,fileSize:0,x:null,y:null}),ae=null,oe=null,se=null,ce=!1,le=null,ue=[],de=null,fe=!1,pe=!1;function me(e,t,n,r,i,a,o,s){if(!o&&!s){e.fillRect(t,n,r,i);return}let c=Math.max(0,Math.min(a,i/2,o&&s?r/2:r));e.beginPath(),e.moveTo(t+(o?c:0),n),e.arcTo(t+r,n,t+r,n+i,s?c:0),e.arcTo(t+r,n+i,t,n+i,s?c:0),e.arcTo(t,n+i,t,n,o?c:0),e.arcTo(t,n,t+r,n,o?c:0),e.closePath(),e.fill()}let he=null,ge=null,_e=null,ve=null,ye=0,M=-1,be=(0,t.ref)(!1),xe=(0,t.ref)(!1),Se=null,Ce=null,we=0,Te=!1,Ee=null,De=[];function Oe(e){return De.push(e),()=>{let t=De.indexOf(e);t>=0&&De.splice(t,1)}}function ke(e){let t=e.trim();return t?/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(t)?t:/^[w.-]+@([w-]+.)+[w-]{2,4}$/.test(t)?`mailto:${t}`:`https://${t}`:``}function Ae(e){try{let t=new URL(ke(e));return[`http:`,`https:`,`mailto:`,`univer-sheet:`].includes(t.protocol)}catch{return!1}}function je(){if(c.value)return;let e=ne,n=``;e&&!e.collapsed&&(n=(C.value?.getUniverDoc?.(p)?.getSnapshot()?.body?.dataStream||``).slice(e.startOffset,e.endOffset).replace(/[\r\n]+$/,``)),j.text=n,j.url=``,j.urlError=``,j.style=`text`,j.replace=!(!e||e.collapsed);let r=C.value?.getUniverDoc?.(p)?.getSnapshot()?.body?.dataStream?.length??0;j.startOffset=e?e.startOffset:Math.max(0,r-2),j.endOffset=e?e.endOffset:j.startOffset,j.segmentId=e?.segmentId||``,j.visible=!0,(0,t.nextTick)(()=>{j.text||w.value?.focus()})}function Me(){j.visible=!1}function Ne(e,t){return t===`text`?e:`${ZW}${e}`}function Pe(e,t,n,r){if(t===`card`){let i=`──查看`,a=` 📄${e}${i} `,o=a.indexOf(`📄`),s=o+2,c=a.indexOf(i),l={bg:{rgb:`#e4f9fbff`},fs:18,cl:{rgb:`#3370ff`}};return{dataStream:a,customRanges:[{startIndex:0,endIndex:a.length-1,rangeId:n,rangeType:3,wholeEntity:!0,properties:{url:r,text:e,style:t}}],textRuns:[{st:0,ed:1,ts:{...l}},{st:1,ed:2,ts:{...l}},{st:2,ed:o+2,ts:{...l}},{st:s,ed:c,ts:{...l,bl:!0}},{st:c,ed:a.length-1,ts:{...l,bl:!0}},{st:a.length-1,ed:a.length,ts:{...l}}]}}let i=Ne(e,t),a={startIndex:0,endIndex:i.length-1,rangeId:n,rangeType:0,properties:{url:r,text:e,style:t}},o={dataStream:i,customRanges:[a]};return t===`icon`&&(a.show=!1,o.textRuns=[{st:0,ed:i.length,ts:{cl:{rgb:`#3370ff`}}}]),o}async function Fe({text:e,url:t,style:n,startOffset:r,endOffset:i,segmentId:a,replace:o}){let s=`link-${Date.now()}-${Math.floor(Math.random()*1e4)}`,c=Pe(e,n,s,t);return await C.value?.executeCommand?.(`doc.command.insert-text`,{unitId:p,range:{startOffset:r,endOffset:i,collapsed:!o,segmentId:a},segmentId:a,body:c,cursorOffset:c.dataStream.length})?{rangeId:s,startIndex:r,endIndex:r+c.dataStream.length-1}:null}async function Ie(){if(!j.url.trim()){j.urlError=`请输入链接地址`;return}if(!Ae(j.url)){j.urlError=`链接格式不正确`;return}await Fe({text:(j.text.trim()||j.url.trim()).replace(/[\r\n]+/g,` `),url:ke(j.url),style:j.style,startOffset:j.startOffset,endOffset:j.endOffset,segmentId:j.segmentId,replace:j.replace})?(Me(),wt()):j.urlError=`插入失败,请重试`}let Le=Kdt.split(`,`).map(e=>e.slice(1)),Re={pdf:`📕`,doc:`📘`,docx:`📘`,zip:`📦`,rar:`📦`,"7z":`📦`,mp4:`🎬`,mov:`🎬`,webm:`🎬`,avi:`🎬`,mkv:`🎬`,mp3:`🎵`,wav:`🎵`,m4a:`🎵`,aac:`🎵`},ze=(0,t.ref)(null),Be=(0,t.ref)(!1),Ve=(0,t.ref)(``),He=null;function Ue(e){let t=String(e||``),n=t.lastIndexOf(`.`);return n>0?t.slice(n+1).toLowerCase():``}function We(e){return Re[Ue(e)]||`📎`}function Ge(e){return!Number.isFinite(e)||e<0?``:e<1024?`${e}B`:e<1048576?`${Number((e/1024).toFixed(1))}KB`:`${Number((e/1048576).toFixed(1))}MB`}function Ke(e,t=20){let n=String(e||``),r=Array.from(n);if(r.length<=t)return n;let i=n.lastIndexOf(`.`),a=i>0?n.slice(i):``,o=Array.from(a);return a&&o.length<=6?r.slice(0,Math.max(1,t-o.length-1)).join(``)+`…`+a:r.slice(0,Math.max(1,t-1)).join(``)+`…`}function qe(e){return!e||!Le.includes(Ue(e.name))?{ok:!1,error:`仅支持 PDF、Word、压缩包、视频、音频文件`}:e.size>qdt?{ok:!1,error:`文件大小不能超过 150MB`}:{ok:!0}}function Je(e,t,n,r){let i=We(e),a=Ke(String(e||``).replace(/[\u0000-\u001f\u007f]/g,` `)),o=Ge(t),s=`下载`,c=` ${i}${a} · ${o} ${s} `,l=c.indexOf(i)+2,u=l+a.length,d=c.lastIndexOf(s),f={bg:{rgb:zdt},fs:18,cl:{rgb:`#3370ff`}};return{dataStream:c,customRanges:[{startIndex:0,endIndex:c.length-1,rangeId:n,rangeType:3,wholeEntity:!0,properties:{attachment:!0,url:r,name:e,size:t}}],textRuns:[{st:0,ed:1,ts:{...f}},{st:1,ed:2,ts:{...f}},{st:2,ed:l,ts:{...f}},{st:l,ed:u,ts:{...f,bl:!0}},{st:u,ed:d,ts:{...f}},{st:d,ed:c.length-1,ts:{...f,bl:!0}},{st:c.length-1,ed:c.length,ts:{...f}}]}}async function Ye(e,t,n,r){if(typeof t==`function`)try{let n=await t(e),r=typeof n==`string`?n:n?.url||``;if(r)return{url:r}}catch{}if(e.size>n)return{error:`未配置附件上传服务,无法插入超过 2MB 的文件`};try{let t=await r(e);if(t)return{url:t}}catch{}return{error:`附件读取失败,请重试`}}function Xe(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result||``)),r.onerror=()=>n(r.error||Error(`read failed`)),r.readAsDataURL(e)})}async function Ze(e,t){if(!e||e.startsWith(`data:`)||typeof t!=`function`)return e;try{return await t(e)||e}catch{return e}}async function Qe(e,t,n){let{fetchImpl:r,doc:i,urlApi:a,defer:o=e=>setTimeout(e,400)}=n,s=``,c=e;if(!e.startsWith(`data:`)){let t=await r(e);if(!t.ok)throw Error(`附件下载失败(HTTP ${t.status})`);let n=await t.blob();s=a.createObjectURL(n),c=s}let l=i.createElement(`a`);l.href=c,l.download=t||`附件`,l.style.display=`none`,i.body.appendChild(l);try{l.click()}finally{l.remove(),s&&o(()=>a.revokeObjectURL(s))}}function $e(e){Ve.value=e,clearTimeout(He),He=setTimeout(()=>{Ve.value=``},4e3)}async function et(e){let t=e?.url||``;if(!t)return;let n=e?.name||`附件`;try{await Qe(await Ze(t,i.server?.resolveAttachment),n,{fetchImpl:(e,t)=>fetch(e,t),doc:document,urlApi:URL})}catch{$e(`附件下载失败,请稍后重试`)}}function tt(){et({url:ie.url,name:ie.fileName,size:ie.fileSize}),mt()}function nt(e){let t=i.server?.previewAttachment;if(typeof t!=`function`)return!1;try{return t({url:e?.url,name:e?.name,size:e?.size})===!0}catch{return!1}}function rt(){c.value||Be.value||ze.value?.click()}function it(e){let t=e?.target?.files?.[0];if(e?.target&&(e.target.value=``),t)return at(t)}async function at(e){let t=C.value;if(c.value||Be.value||!t||!e)return;let n=qe(e);if(!n.ok){$e(n.error);return}let r=p,a=t.getUniverDoc?.(r)?.getSnapshot(),o=ne?.segmentId||``,s=o?a?.headers?.[o]?.body||a?.footers?.[o]?.body:a?.body,l=s?.dataStream;if(!l)return;let u=ne?.startOffset??Math.max(0,l.length-2);Be.value=!0;try{let{url:n,error:d}=await Ye(e,i.server?.attachmentUpload,Jdt,Xe);if(!C.value)return;if(c.value||C.value!==t||p!==r||t.getUniverDoc?.(r)?.getSnapshot()!==a||s.dataStream!==l){$e(`文档已变更或切为只读,请重新插入附件`);return}if(!n){$e(d||`附件插入失败,请重试`);return}let f=`attachment-${Date.now()}-${Math.floor(Math.random()*1e4)}`,m=Je(e.name,e.size,f,n);await t.executeCommand?.(`doc.command.insert-text`,{unitId:r,range:{startOffset:u,endOffset:u,collapsed:!0,segmentId:o},segmentId:o,body:m,cursorOffset:m.dataStream.length})?wt():$e(`附件插入失败,请重试`)}catch{C.value&&$e(`附件插入失败,请重试`)}finally{Be.value=!1}}async function ot(){let e=C.value;if(c.value||!e)return;let t=p,n=e.getUniverDoc?.(t)?.getSnapshot(),r=ne?.segmentId||``,i=r?n?.headers?.[r]?.body||n?.footers?.[r]?.body:n?.body,a=i?.dataStream;if(!a)return;let o=Math.min(Math.max(0,ne?.startOffset??a.length-2),Math.max(0,a.length-2)),s=(i.paragraphs||[]).find(e=>e.startIndex>=o),l={startIndex:1};s?.bullet&&(l.bullet=JSON.parse(JSON.stringify(s.bullet))),s?.paragraphStyle&&(l.paragraphStyle=JSON.parse(JSON.stringify(s.paragraphStyle)),delete l.paragraphStyle.borderBottom);let u=(i.textRuns||[]).find(e=>o>e.st&&o<=e.ed),d={dataStream:`\f\r`,paragraphs:[l],...u?{textRuns:[{st:0,ed:2,ts:JSON.parse(JSON.stringify(u.ts))}]}:{}};await e.executeCommand?.(`doc.command.insert-text`,{unitId:t,range:{startOffset:o,endOffset:o,collapsed:!0,segmentId:r},segmentId:r,body:d,cursorOffset:d.dataStream.length})&&wt()}function st(e){return(C.value?.getUniverDoc?.(p)?.getSnapshot()?.body)?.customRanges?.find(t=>t.rangeId===e&&(t.rangeType===0||t.rangeType===3))||null}function ct(e){if(!e?.linkId){ut();return}if(dt(),ie.visible&&e.linkId===ie.linkId&&e.startIndex===ie.startIndex)return;let t=st(e.linkId);if(!t){lt();return}let n=(C.value?.getUniverDoc?.(p)?.getSnapshot()?.body?.dataStream||``).slice(t.startIndex,t.endIndex+1),r=t.properties||{};ie.url=r.url||``,ie.isAttachment=!!r.attachment,ie.fileName=r.name||``,ie.fileSize=r.size||0,ie.text=(r.text||n.replace(ZW,``)).replace(/[\s\u00A0\u2000-\u200B\u3000]+$/g,``),ie.style=r.style||`text`,ie.linkId=e.linkId,ie.segmentId=e.segmentId||``,ie.startIndex=t.startIndex,ie.endIndex=t.endIndex,ie.styleMenuOpen=!1,ie.copied=!1,ie.x=null,ie.y=null,ie.visible=!0,ae=e,ht()}function lt(){clearTimeout(oe),clearTimeout(se),se=null,ce=!1,ie.visible=!1,ie.styleMenuOpen=!1,ie.copied=!1}function ut(e=320){ce||(clearTimeout(se),se=setTimeout(()=>{se=null,lt()},e))}function dt(){clearTimeout(se),se=null}function ft(){ce=!0,dt()}function pt(){ce=!1,ut(160)}function mt(){lt(),C.value?.executeCommand?.(`doc.operation.toggle-hyper-link-info-popup`)}function ht(e=12){if(clearTimeout(oe),!ie.visible)return;let t=Array.from(document.querySelectorAll(`[data-u-comp="rect-popup"]`)).find(e=>e.querySelector(`.univer-max-w-80`))?.getBoundingClientRect();if(!t||t.left<-9e3||!t.width&&!t.height){e>0?oe=setTimeout(()=>ht(e-1),50):lt();return}ie.x=t.left+t.width/2,ie.y=Math.max(t.top,8)}function gt(){let e=ie.url;e.startsWith(Rdt)?a(`open-workbook`,e.slice(15)):e&&window.open(e,`_blank`,`noopener noreferrer`),mt()}async function _t(){let e=ie.url;try{if(navigator.clipboard?.writeText)await navigator.clipboard.writeText(e);else throw Error(`clipboard unavailable`)}catch{let t=document.createElement(`textarea`);t.value=e,t.style.cssText=`position:fixed;opacity:0`,document.body.appendChild(t),t.select();try{document.execCommand(`copy`)}catch{}t.remove()}ie.copied=!0,clearTimeout(le),le=setTimeout(()=>{ie.copied=!1},1200)}function vt(){c.value||(lt(),mt(),j.text=ie.text,j.url=ie.url,j.urlError=``,j.style=ie.style,j.replace=!0,j.startOffset=ie.startIndex,j.endOffset=ie.endIndex+1,j.segmentId=ie.segmentId,j.visible=!0)}async function yt(e){if(c.value||(ie.styleMenuOpen=!1,e===ie.style))return;let{text:t,url:n,segmentId:r,startIndex:i,endIndex:a}=ie,o=await Fe({text:t,url:n,style:e,startOffset:i,endOffset:a+1,segmentId:r,replace:!0});o&&(wt(),C.value?.executeCommand?.(`doc.operation.toggle-hyper-link-info-popup`,{...ae||{},unitId:p,linkId:o.rangeId,rangeId:o.rangeId,startIndex:o.startIndex,endIndex:o.endIndex}))}async function bt(){if(c.value)return;let{text:e,segmentId:t,startIndex:n,endIndex:r}=ie;await C.value?.executeCommand?.(`doc.command.insert-text`,{unitId:p,range:{startOffset:n,endOffset:r+1,collapsed:!1,segmentId:t},segmentId:t,body:{dataStream:e},cursorOffset:e.length})&&(mt(),wt())}function xt(){ie.styleMenuOpen&&=!1,ie.visible&&lt()}function St(){ie.visible&&lt(),clearTimeout(St._t),St._t=setTimeout(()=>{if(de)try{let e=C.value?.getUniverDoc?.(p)?.getSnapshot()?.body;if(!e?.customRanges)return;ue=[];for(let t of e.customRanges){if(t.rangeType!==0&&t.rangeType!==3)continue;let e=eI({startOffset:t.startIndex,endOffset:t.endIndex+1,collapsed:!1},de);e?.length&&ue.push({rangeId:t.rangeId,startIndex:t.startIndex,endIndex:t.endIndex,rects:e,style:t.properties?.style||`text`,text:t.properties?.text||``,url:t.properties?.url||``})}}catch{}},200)}let Ct=null;function wt(){clearTimeout(Ct),Ct=setTimeout(Tt,300)}function Tt(){let e=C.value?.getUniverDoc?.(p);if(!e)return;let t=e.getSnapshot()?.body;if(!t)return;let n=t.dataStream||``,r=t.paragraphs||[],i=[];for(let e=0;e<r.length;e++){let t=r[e],a=t.paragraphStyle?.namedStyleType,o=a==null?t.paragraphStyle?.headingLevel:a>=Gp.HEADING_1&&a<=Gp.HEADING_5?a-Gp.HEADING_1+1:0;if(!o)continue;let s=t.startIndex,c=n.lastIndexOf(`\r`,s-1)+1;for(;c<s&&n.charCodeAt(c)<32;)c++;let l=n.slice(c,s).replace(/[\u0000-\u001f]/g,``);l.trim()&&i.push({id:`h-${c}`,level:o,text:l,startIndex:c})}ee.value=i,te.paragraphs=r.length;let a=n.replace(/[\r\n]/g,``),o=(a.match(/[\u4e00-\u9fff]/g)||[]).length,s=(a.replace(/[\u4e00-\u9fff]/g,` `).match(/[A-Za-z0-9]+/g)||[]).length;te.words=o+s}function Et(e){if(e.id!==`doc.operation.click-hyper-link`)return;let{linkId:t}=e.params||{};if(!t)return;let n=(C.value?.getUniverDoc?.(p)?.getSnapshot()?.body)?.customRanges?.find(e=>e.rangeId===t);if(!n)return;if(n.properties?.attachment){nt(n.properties)||et(n.properties),e.cancel=!0;return}let r=n.properties?.url||``;if(r){if(r.startsWith(Rdt)){a(`open-workbook`,r.slice(15)),e.cancel=!0;return}n.rangeType===3&&Ae(r)&&(window.open(ke(r),`_blank`,`noopener,noreferrer`),e.cancel=!0)}}function Dt(){let e=C.value?.getUniverDoc?.(p),t=e?.getSnapshot()?.body?.dataStream||``;if(!e||!t)return!1;let n=Math.max(0,t.length-2);return e.setSelection(n,n),ne={startOffset:n,endOffset:n,segmentId:``,collapsed:!0},!0}function Ot(e){if(l&&!l.entered&&e.type===tG&&e.id===l.id&&e.params===l.params){l.entered=!0;return}if((o.value||l)&&e.type!==1||c.value&&e.type===tG){e.cancel=!0;return}if(i.collaboration?.onBeforeCommand&&!i.collaboration.onBeforeCommand(e.id,e.params)){e.cancel=!0;return}Et(e),!c.value&&e.id===`doc.operation.show-hyper-link-edit-popup`&&!e.params?.link&&(e.cancel=!0,je()),[`doc.operation.create-table`,`doc.command.create-table`,`doc.command.insert-float-image`].includes(e.id)&&!ne&&Dt()&&(e.cancel=!0,C.value?.executeCommand?.(e.id,{...e.params||{}}))}function kt(e){if(e.id!==`doc.operation.set-selections`&&e.id!==`doc.operation.toggle-hyper-link-info-popup`&&ye++,e.type===tG&&!l&&!e.options?.fromChangeset&&!e.options?.fromCollab)for(let t of De)try{t({id:e.id,params:e.params,type:e.type,timestamp:Date.now()})}catch{}if(e.id===`doc.operation.set-selections`){let t=e.params?.ranges?.[0];t&&(ne={startOffset:t.startOffset,endOffset:t.endOffset,segmentId:t.segmentId||e.params?.segmentId||``,collapsed:t.collapsed??t.startOffset===t.endOffset})}e.id===`doc.operation.toggle-hyper-link-info-popup`&&ct(e.params),wt()}function At(){if(!he)return null;let e=he.__getInjector(),t=e.get(B).getCurrentUnitOfType(1);if(!t)return null;let n=t.getSnapshot();if(!n?.body)return null;let r=n.body,i=r.textRuns||[],a=r.paragraphs||[],o=e.get(SE),s=o.getActiveTextRange?.()||v(o).find(e=>e.isActive)||v(o)[0];if(!s)return null;let{startOffset:c,endOffset:l,segmentId:u=``}=s;if(c==null||l==null)return null;let d={};if(c===l){for(let e of i)if(e.st<c&&e.ed>=c&&e.ts){d={...e.ts};break}}else for(let e of i)if(e.st<l&&e.ed>c&&e.ts){d={...e.ts};break}let f=[],p=c===l?Math.max(0,c-1):c;for(let e of a)e.startIndex>=p&&e.startIndex<=l&&e.paragraphStyle&&f.push({startIndex:e.startIndex,paragraphStyle:{...e.paragraphStyle}});return{textStyle:d,paragraphStyles:f,segmentId:u,startOffset:c,endOffset:l}}function jt(e){if(!he||!Se)return!1;let t=he.__getInjector(),n=t.get(z),r=t.get(B),{textStyle:i,paragraphStyles:a,segmentId:o}=Se,{startOffset:s,endOffset:c}=e;try{let e=r.getCurrentUnitOfType(1);if(!e)return!1;let l=e.getBody();if(!l)return!1;let u=v(t.get(SE)),d=(l.textRuns||[]).filter(e=>e.st<c&&e.ed>s),f={};d.length>0&&Object.assign(f,d[0].ts||{});let p=[`bl`,`it`,`ul`,`st`],m=[`fs`,`ff`,`cl`,`bg`];for(let t of p)if(i[t]!=null){let r=i[t],a=f[t],o=!1;o=t===`bl`||t===`it`?r!==a:r?.s!==a?.s,o&&_(n,e,u,t,r)}for(let e of m)if(i[e]!=null){let t=i[e],r=e===`fs`?`doc.command.set-inline-format-fontsize`:e===`ff`?`doc.command.set-inline-format-font-family`:e===`cl`?`doc.command.set-inline-format-text-color`:`doc.command.set-inline-format-text-background-color`;(e===`cl`||e===`bg`)&&(t=t?.rgb||t),n.executeCommand(`doc.command.set-inline-format`,{preCommandId:r,value:t})}if(a.length>0){let t=l?.paragraphs||[];for(let r of t)if(r.startIndex>=s&&r.startIndex<=c){let i=a[0];if(i?.paragraphStyle){let a=t.indexOf(r);if(a>=0){let t=[`body`,`paragraphs`,a,`paragraphStyle`],s=r.paragraphStyle||{},c={...s,...i.paragraphStyle},l=Dv.getInstance().replaceOp(t,s,c);n.syncExecuteCommand(`doc.mutation.rich-text-editing`,{unitId:e.getUnitId(),actions:l,textRanges:null,segmentId:o})}}}}return!0}catch(e){return console.warn(`[FormatPainter] apply style failed:`,e),!1}}function Mt(){be.value=!1,xe.value=!1,Se=null,we=0,Ee=null,Ce&&=(Ce.dispose(),null)}function Nt(e){e.key===`Escape`&&be.value&&Mt()}function Pt(e){if(!be.value||!Se||Te)return;let t=(e&&(e.textRanges||e.ranges)||[]).find(e=>e&&e.startOffset!=null&&e.endOffset!=null&&e.startOffset!==e.endOffset);if(!t)return;let n=Ee;if(n&&n.startOffset===t.startOffset&&n.endOffset===t.endOffset&&(n.segmentId||``)===(t.segmentId||``))return;Ee={startOffset:t.startOffset,endOffset:t.endOffset,segmentId:t.segmentId||``},Te=!0;let r=!1;try{r=jt({startOffset:t.startOffset,endOffset:t.endOffset,segmentId:t.segmentId||``})}finally{Te=!1}r&&!xe.value&&setTimeout(()=>Mt(),100)}function Ft(){if(!S.value||C.value)return;let{univer:e,univerAPI:t}=Ree({locale:vp.ZH_CN,locales:{[vp.ZH_CN]:_dt([Sot,Cct,ilt,Qlt])},presets:[vot({container:S.value,ribbonType:`simple`}),bct(),rlt(),Ylt()]});E=Xut({univer:e,univerAPI:t,comment:i.server?.comment});try{e.__getInjector().get(Om).setConfig(`menu`,{"doc.operation.show-hyper-link-edit-popup":{disabled:!1}},{merge:!0})}catch{}t.createUniverDoc({id:p,title:``,documentStyle:{pageSize:{width:794,height:1123},marginTop:72,marginBottom:72,marginLeft:80,marginRight:80},tableSource:{},drawings:{},drawingsOrder:[],body:{dataStream:`\r
605
- `,textRuns:[],tables:[],sectionBreaks:[],paragraphs:[{startIndex:0,paragraphStyle:{spaceAbove:{v:0},lineSpacing:1.15,spaceBelow:{v:8}}}]}});try{e.__getInjector().get(B).focusUnit(p)}catch{}he=e,C.value=t,D||=sdt({univer:e,univerAPI:t,getUnitId:()=>p}),D&&!O&&(O=mdt({univer:e,univerAPI:t,kind:`doc`})),Bt(),Ut(),x(),T||=KW({univer:e,server:i.server}),A&&!k.value&&(k.value={getData:It,setData:zt,getVersion:Lt,isDirty:Rt,setRestoreState:u,replayMutation:Vt,canPersist:()=>i.type!==`view`,ready:()=>!!C.value,getUniverInstance:()=>he,getUniverAPI:()=>C.value,onMutation:Oe}),t.addEvent(t.Event.CommandExecuted,kt),t.addEvent(t.Event.BeforeCommandExecute,Ot),window.addEventListener(`pointerdown`,xt),window.addEventListener(`scroll`,St,!0),window.addEventListener(`resize`,St),window.addEventListener(`keydown`,Nt),Tt();async function n(){try{let t=e.__getInjector().get(z),n=e.__getInjector().get(Ij);t.registerCommand({id:QW,type:R.COMMAND,handler(){let t=Date.now();if(be.value)return t-we<=Udt&&(xe.value=!0,we=t,console.log(`[FormatPainter] 锁定模式(可连续刷多处,Esc 退出)`)),!0;let n=At();if(!n)return console.warn(`[FormatPainter] 无法读取样式,请先选中文字`),!1;Se=n,be.value=!0,xe.value=!1,we=t,Ee={startOffset:n.startOffset,endOffset:n.endOffset,segmentId:n.segmentId||``};let r=e.__getInjector().get(SE).textSelection$.subscribe(e=>{Pt(e)});return Ce={dispose:()=>r.unsubscribe()},console.log(`[FormatPainter] 已激活(单击=刷一次,双击=连续刷),选中目标文字应用样式`),!0}}),n.mergeMenu({ribbon:{"ribbon.home":{"ribbon.home.format":{[QW]:{order:99,menuItemFactory:()=>({id:QW,type:zj.BUTTON,title:`格式刷`,tooltip:`格式刷`,icon:`BrushIcon`})}}}}})}catch(e){console.warn(`[FormatPainter] 命令注册失败:`,e)}}n();async function r(){try{let t=e.__getInjector().get(z),n=e.__getInjector().get(Ij),r=C.value?.getComponentManager?.();if(r){let e=await Promise.resolve().then(()=>f(jE())),t=t=>n=>e.createElement(`svg`,{viewBox:`0 0 24 24`,width:`1em`,height:`1em`,fill:`currentColor`,...n},e.createElement(`path`,{d:t})),n=typeof r.has==`function`?e=>r.has(e):()=>!1;n(`HxyPageBreakIcon`)||r.register(`HxyPageBreakIcon`,t(Wdt)),n(`HxyAttachIcon`)||r.register(`HxyAttachIcon`,t(Gdt))}t.registerCommand({id:$W,type:R.COMMAND,handler(){return ot(),!0}}),t.registerCommand({id:eG,type:R.COMMAND,handler(){return rt(),!0}}),n.mergeMenu({ribbon:{"ribbon.home":{"ribbon.home.format":{[$W]:{order:100,menuItemFactory:()=>({id:$W,type:zj.BUTTON,title:`分页符`,tooltip:`在光标处插入分页符`,icon:`HxyPageBreakIcon`})},[eG]:{order:101,menuItemFactory:()=>({id:eG,type:zj.BUTTON,title:`附件`,tooltip:`上传本地文件为附件卡片`,icon:`HxyAttachIcon`})}}}}})}catch(e){console.warn(`[InsertToolbar] 插入按钮注册失败:`,e)}}r(),Gt(1e3)}function It(){let e=C.value?.getUniverDoc?.(p)?.getSnapshot?.();return e?.body?.dataStream?(M=ye,{type:`univer-doc`,unitId:p,version:ye,savedAt:Date.now(),data:JSON.parse(JSON.stringify(e))}):null}function Lt(){return ye}function Rt(){return ye!==M}function zt(e){let t=e?.type===`univer-doc`?e.data:e;if(!t?.body?.dataStream)return!1;let n=t.body.dataStream,r=typeof n==`string`&&n.length>0&&!n.endsWith(`
606
- `)?{...t,body:{...t.body,dataStream:`${n.endsWith(`\r`)?n:n+`\r`}\n`}}:t,i=C.value;if(!i)return!1;try{lt()}catch{}try{i.executeCommand?.(`doc.operation.toggle-hyper-link-info-popup`)}catch{}ge?.abort(),ge=null,_e?.dispose?.(),_e=null;try{i.disposeUnit?.(p)}catch{}let a=r.id||p;i.createUniverDoc({...JSON.parse(JSON.stringify(r)),id:a}),p=a,Bt(),ye++,ne=null,ue=[];try{he?.__getInjector?.()?.get(B)?.focusUnit(p)}catch{}return Gt(300),Ut(),wt(),!0}function Bt(){try{let e=(he?.__getInjector?.()?.get(B)?.getUniverDocInstance?.(p))?.getSnapshot?.(),t=e?.body;if(!t)return;t.textRuns??=[],t.tables??=[],t.sectionBreaks??=[],e.tableSource??={};let n=t.dataStream;if(typeof n==`string`&&n.length){t.paragraphs??=[];let e=t.paragraphs,r=new Set;for(let t of e)r.add(t?.startIndex);let i=!1;for(let t=0;t<n.length;t++)n.charCodeAt(t)===13&&!r.has(t)&&(e.push({startIndex:t}),i=!0);i&&e.sort((e,t)=>e.startIndex-t.startIndex)}}catch{}}function Vt(e,t){if(!o.value||l)throw Error(`当前不允许回放`);let n=C.value,r=he?.__getInjector?.()?.get(B)?.getUniverDocInstance?.(p);if(!n||!r||t?.unitId!==p)throw Error(`回放文档不匹配`);let i={...JSON.parse(JSON.stringify(t)),noHistory:!0,isSync:!0,noNeedSetTextRange:!0};l={id:e,params:i,entered:!1};try{r.setDisabled(!1);let t=n.syncExecuteCommand(e,i,{onlyLocal:!0,fromChangeset:!0});return l.entered?e===`doc.mutation.rich-text-editing`?t?.unitId===p&&Array.isArray(t.actions)&&(Dv.isNoop(i.actions)||!Dv.isNoop(t.actions)):t===!0:!1}finally{l=null,r.setDisabled(c.value)}}function Ht(e){let t={applied:0,skipped:0,failed:[]};if(!Array.isArray(e)||!e.length)return t;let n=C.value;if(!n)return t.failed=e.map(e=>({commandId:e?.commandId,message:`编辑器未就绪`})),t;for(let r of e){let e=r?.commandId;if(e){if(typeof e==`string`&&e.startsWith(`sheet.mutation.`)){t.skipped++;continue}try{let i=JSON.parse(JSON.stringify(r.params??{}));if(i.unitId&&i.unitId!==p)throw Error(`回放文档不匹配`);l={id:e,params:i,entered:!1};try{if(n.syncExecuteCommand(e,i,{onlyLocal:!0,fromChangeset:!0}),!l.entered)throw Error(`命令未执行`)}finally{l=null}t.applied++}catch(n){t.failed.push({commandId:e,message:n&&n.message||String(n)})}}}return t}function Ut(){try{(he?.__getInjector?.()?.get(B)?.getUniverDocInstance?.(p))?.setDisabled?.(c.value)}catch{}}function Wt(e,t,n){if(c.value||!Number.isFinite(n)||n<40)return!1;let r=(C.value?.getUniverDoc?.(p)?.getSnapshot())?.tableSource?.[e]?.tableColumns?.[t]?.size?.width?.v;if(!Number.isFinite(r)||r===n)return!1;let i=Dv.getInstance().replaceOp([`tableSource`,e,`tableColumns`,t,`size`,`width`,`v`],r,n);return!!C.value.syncExecuteCommand(`doc.mutation.rich-text-editing`,{unitId:p,actions:i,trigger:`pd-doc.table-resize`,noNeedSetTextRange:!0,debounce:!1})?.actions?.length}function Gt(e=1e3){setTimeout(()=>{if(!he)return;let t=he.__getInjector().get(fE).getRenderById(p),n=S.value?.querySelector(`canvas`);if(!t||!n){if(e<2e3){Gt(e+400);return}console.warn(`[canvas-features] render/canvas not ready`);return}if(de=t,!fe)try{let e=t.with(CE)?.getSkeleton();if(e){let t=e,n=null;for(;t;){let e=Object.getPrototypeOf(t);if(!e)break;if(e.draw&&e.isSkipByDiffBounds){n=e;break}t=e}if(n){let e=n.draw;if(!e.__cardBgPatch){let t=function(t,n){let r=null,i=null,a=null;try{let e=this.getSkeleton?.(),t=e?.getSkeletonData?.();if(t?.pages?.length){let n=((e.getViewModel?.())?.getDataModel?.())?.getBody?.();if(n?.customRanges){r=new Set,i=new Set,a=new Set;for(let e of n.customRanges)if(e.rangeType===3){for(let t=e.startIndex;t<=e.endIndex;t++)r.add(t);i.add(e.startIndex),a.add(e.endIndex)}if(r.size>0){let e=0;for(let n of t.pages)for(let t of n.sections)for(let n of t.columns)for(let t of n.lines)for(let n of t.divides)for(let t of n.glyphGroup)t.content&&r.has(e)&&(t.ts&&!t.ts.bg&&(t.ts.bg={rgb:zdt}),t._isCardGlyph=!0,i.has(e)&&(t._cardRoundLeft=!0),a.has(e)&&(t._cardRoundRight=!0)),e+=t.count||1}}}if(r?.size>0){let e=this.getExtensionByKey?.(`DefaultDocsBackgroundExtension`);if(e&&!e.__cardPaddingPatched){let t=e.draw.bind(e);e.draw=function(e,n,r){if(r._isCardGlyph){let t=r.parent?.parent;if(t&&r.ts?.bg){let{contentHeight:n=0}=t,i=Ih(r.ts.bg),a=this.extensionOffset?.spanStartPoint;if(i&&a&&r.content!==`\r`){e.fillStyle=i,me(e,a.x-1,a.y-Vdt,r.width+2,n+Vdt+Hdt,Bdt,!!r._cardRoundLeft,!!r._cardRoundRight);return}}}return t(e,n,r)},e.__cardPaddingPatched=!0}}}catch{}return e.call(this,t,n)};t.__cardBgPatch=!0,n.draw=t,fe=!0,console.log(`[card-bg-patch] Documents.draw patched ✓`)}}}}catch(e){console.warn(`[card-bg-patch] failed to apply:`,e)}if(!pe)try{let e=QP.prototype.refresh;if(!e.__cardSelectionPatch){let t=function(){e.call(this);try{if(!this._rangeShape)return;let e=(this._docSkeleton?.getViewModel?.())?.getDataModel?.()?.getBody?.();if(!e?.customRanges)return;let t=this.startOffset,n=this.endOffset;if(t==null||n==null)return;for(let r of e.customRanges)if(r.rangeType===3&&t<=r.endIndex&&n>=r.startIndex){this._rangeShape.hide();return}}catch{}};t.__cardSelectionPatch=!0,QP.prototype.refresh=t,pe=!0,console.log(`[card-selection-patch] TextRange.refresh patched ✓`)}}catch(e){console.warn(`[card-selection-patch] failed to apply:`,e)}ge?.abort(),_e?.dispose?.();let r=new AbortController;ge=r;let i={signal:r.signal};try{let e=t.with(rI);if(e){let t=e._buildCustomRangeBoundsBySegment;typeof t==`function`&&!t.__instHoverFixed&&(e._buildCustomRangeBoundsBySegment=function(e,n=-1){return t.call(this,e??``,n)},e._buildCustomRangeBoundsBySegment.__instHoverFixed=!0)}function a(){ue=[];try{let e=C.value?.getUniverDoc?.(p)?.getSnapshot()?.body;if(!e?.customRanges)return;for(let n of e.customRanges){if(n.rangeType!==0&&n.rangeType!==3)continue;let e=eI({startOffset:n.startIndex,endOffset:n.endIndex+1,collapsed:!1},t);e?.length&&ue.push({rangeId:n.rangeId,startIndex:n.startIndex,endIndex:n.endIndex,rects:e,style:n.properties?.style||`text`,text:n.properties?.text||``,url:n.properties?.url||``})}console.log(`[hover-patch] link rects computed: ${ue.length} links found`)}catch(e){console.warn(`[hover-patch] recomputeLinkRects failed:`,e)}}a(),_e=C.value?.addEvent?.(C.value?.Event?.CommandExecuted,()=>{clearTimeout(ve),ve=setTimeout(a,150)}),n&&(n.addEventListener(`mousemove`,e=>{if(!ue.length)return;n.getBoundingClientRect();let t=e.clientX,r=e.clientY,i=null;for(let e of ue){for(let n of e.rects)if(t>=n.left&&t<=n.right&&r>=n.top&&r<=n.bottom){i=e;break}if(i)break}if(i){if(dt(),ie.visible&&i.rangeId===ie.linkId)return;let e=st(i.rangeId);if(!e)return;let t=(C.value?.getUniverDoc?.(p)?.getSnapshot()?.body?.dataStream||``).slice(e.startIndex,e.endIndex+1),n=e.properties||{};ie.url=n.url||``,ie.isAttachment=!!n.attachment,ie.fileName=n.name||``,ie.fileSize=n.size||0,ie.text=(n.text||t.replace(ZW,``)).replace(/[\s\u00A0\u2000-\u200B\u3000]+$/g,``),ie.style=n.style||`text`,ie.linkId=i.rangeId,ie.segmentId=``,ie.startIndex=i.startIndex,ie.endIndex=i.endIndex,ie.styleMenuOpen=!1,ie.copied=!1;let r=i.rects.reduce((e,t)=>e.top<t.top?e:t),a=i.rects[Math.floor(i.rects.length/2)];ie.x=(a.left+a.right)/2,ie.y=Math.max(r.top-4,40),ie.visible=!0,ae={unitId:p,linkId:i.rangeId,segmentId:``,segmentPage:-1,rangeId:i.rangeId,startIndex:i.startIndex,endIndex:i.endIndex},C.value?.executeCommand?.(`doc.operation.toggle-hyper-link-info-popup`,ae)}else ie.visible&&ut()},i),console.log(`[hover-patch] DOM mousemove hover detection active ✓`))}catch(e){console.warn(`[hover-patch] self-implemented hover detection failed:`,e)}try{let e=null;function o(){let e=t.with(CE).getSkeleton()?.getSkeletonData();if(!e)return[];let n=[],{scene:r,engine:i}=t,{scaleX:a}=r.getAncestorScale(),o=r.getViewport(`viewMain`)?.viewportScrollX||0,s=i.getCanvasElement().getBoundingClientRect(),c=parseFloat(i.getCanvasElement().style.width)||s.width,l=s.width/c,{docsLeft:u}=t.mainComponent.getOffsetConfig(),d=e.pages[0]?.marginLeft||0,f=e=>(e-o+u*a)*l+s.left;for(let r of e.pages)for(let e of r.skeTables.values()){let r=d+e.left,i=r,o=[],c=(C.value?.getUniverDoc?.(p)?.getSnapshot())?.tableSource?.[e.tableId]?.tableColumns||[];if(c.length>0)for(let t=0;t<c.length;t++)i+=c[t].size.width.v,o.push({x:i,colIndex:t,tableId:e.tableId,colWidth:c[t].size.width.v});else for(let t of e.rows){let n=r;for(let r=0;r<t.cells.length;r++)n+=t.cells[r].pageWidth,o.push({x:n,colIndex:r,tableId:e.tableId,colWidth:t.cells[r].pageWidth});break}let u=1/0,m=-1/0;try{let n=eI({startOffset:e.st,endOffset:e.ed,collapsed:!1},t);if(n&&n.length>0)for(let e of n)u=Math.min(u,e.top),m=Math.max(m,e.bottom)}catch{}u===1/0&&(u=s.top,m=s.bottom);for(let e of o)n.push({screenX:f(e.x),screenTop:u,screenBottom:m,colIndex:e.colIndex,tableId:e.tableId,colWidth:e.colWidth,tableDocLeft:r,scaleCombined:a*l})}return n}n.addEventListener(`pointermove`,t=>{if(c.value||e)return;let r=o(),i=null;for(let e of r)if(t.clientY>=e.screenTop-6&&t.clientY<=e.screenBottom+6&&Math.abs(t.clientX-e.screenX)<=6){i=e;break}n.style.cursor=i?`col-resize`:``},i),n.addEventListener(`pointerdown`,t=>{if(c.value)return;let r=o(),i=null;for(let e of r)if(t.clientY>=e.screenTop-6&&t.clientY<=e.screenBottom+6&&Math.abs(t.clientX-e.screenX)<=6){i=e;break}i&&(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),n.style.cursor=`col-resize`,n.style.touchAction=`none`,e={tableId:i.tableId,colIndex:i.colIndex,startX:t.clientX,startWidth:i.colWidth,scaleCombined:i.scaleCombined})},{...i,capture:!0}),window.addEventListener(`pointermove`,t=>{e&&t.preventDefault()},i),window.addEventListener(`pointerup`,t=>{if(!e)return;let r=(t.clientX-e.startX)/e.scaleCombined,i=Math.max(40,Math.round(e.startWidth+r));try{Wt(e.tableId,e.colIndex,i),clearTimeout(ve),ve=setTimeout(a,300)}catch(e){console.warn(`[table-resize] apply failed:`,e)}e=null,n.style.cursor=``,n.style.touchAction=``},i),console.log(`[table-resize] column drag-resize active ✓`)}catch(e){console.warn(`[table-resize] init failed:`,e)}},e)}return(0,t.watch)(()=>i.visible,e=>{e?setTimeout(Ft,100):mt()},{immediate:!0}),(0,t.watch)(()=>i.type,()=>{C.value&&Ut()}),(0,t.watch)(()=>i.server?.comment?.user,e=>E?.setUser?.(e)),(0,t.onUnmounted)(()=>{clearTimeout(Ct),clearTimeout(oe),clearTimeout(se),clearTimeout(le),clearTimeout(ve),clearTimeout(He),ge?.abort(),_e?.dispose?.(),window.removeEventListener(`pointerdown`,xt),window.removeEventListener(`scroll`,St,!0),window.removeEventListener(`resize`,St),window.removeEventListener(`keydown`,Nt),Mt(),T?.dispose?.(),T=null,E?.dispose?.(),E=null,D?.dispose?.(),D=null,O?.dispose?.(),O=null,C.value?.dispose?.(),C.value=null}),n({getData:It,setData:zt,getVersion:Lt,isDirty:Rt,ready:()=>!!C.value,getUniverInstance:()=>he,getUniverAPI:()=>C.value,onMutation:Oe,replayRemoteMutations:Ht,persistence:A,applyRemoteComment:e=>E?E.applyRemote(e):qW(C.value,e)}),(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,ydt,[(0,t.createElementVNode)(`div`,bdt,[(0,t.createElementVNode)(`div`,xdt,[(0,t.createElementVNode)(`div`,{ref_key:`containerRef`,ref:S,class:`doc-editor`},null,512),c.value&&C.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Sdt,[s.value?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[(0,t.createTextVNode)(`恢复失败:`+(0,t.toDisplayString)(s.value)+` `,1),(0,t.createElementVNode)(`button`,{onClick:d},`重试`)],64)):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[(0,t.createTextVNode)((0,t.toDisplayString)(o.value?`正在恢复文档…`:`🔒 只读模式`),1)],64))])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`input`,{ref_key:`attachmentInputRef`,ref:ze,class:`attachment-file-input`,type:`file`,accept:Kdt,onChange:it},null,544),Be.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Cdt,`附件上传中…`)):Ve.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,wdt,(0,t.toDisplayString)(Ve.value),1)):(0,t.createCommentVNode)(``,!0),j.visible?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:3,class:`link-dialog-mask`,onClick:(0,t.withModifiers)(Me,[`self`])},[(0,t.createElementVNode)(`div`,Tdt,[n[8]||=(0,t.createElementVNode)(`div`,{class:`link-dialog-title`},`插入链接`,-1),(0,t.createElementVNode)(`div`,Edt,[n[6]||=(0,t.createElementVNode)(`label`,{class:`field-label`},`文字`,-1),(0,t.withDirectives)((0,t.createElementVNode)(`input`,{"onUpdate:modelValue":n[0]||=e=>j.text=e,class:`field-input`,type:`text`,placeholder:`链接显示的文字(留空则显示链接地址)`,onKeydown:(0,t.withKeys)(Ie,[`enter`])},null,544),[[t.vModelText,j.text]])]),(0,t.createElementVNode)(`div`,Ddt,[n[7]||=(0,t.createElementVNode)(`label`,{class:`field-label`},`链接地址`,-1),(0,t.withDirectives)((0,t.createElementVNode)(`input`,{ref_key:`linkUrlInputRef`,ref:w,"onUpdate:modelValue":n[1]||=e=>j.url=e,class:(0,t.normalizeClass)([`field-input`,{error:j.urlError}]),type:`text`,placeholder:`https:// 或 univer-sheet://wb-progress`,onInput:n[2]||=e=>j.urlError=``,onKeydown:(0,t.withKeys)(Ie,[`enter`])},null,34),[[t.vModelText,j.url]]),j.urlError?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Odt,(0,t.toDisplayString)(j.urlError),1)):(0,t.createCommentVNode)(``,!0)]),(0,t.createElementVNode)(`div`,kdt,(0,t.toDisplayString)(j.replace?`将替换选中的文字或原链接`:`将在光标处插入`)+` · 支持 univer-sheet:// 内链跳转表格 · 插入后悬停可改样式 `,1),(0,t.createElementVNode)(`div`,Adt,[(0,t.createElementVNode)(`button`,{class:`dialog-btn cancel`,onClick:Me},`取 消`),(0,t.createElementVNode)(`button`,{class:`dialog-btn confirm`,disabled:!j.url.trim(),onClick:Ie},`确 定`,8,jdt)])])])):(0,t.createCommentVNode)(``,!0),((0,t.openBlock)(),(0,t.createBlock)(t.Teleport,{to:`body`},[ie.visible&&ie.x!==null?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:`link-hover-bar`,style:(0,t.normalizeStyle)({left:ie.x+`px`,top:ie.y+`px`}),onPointerdown:n[5]||=(0,t.withModifiers)(()=>{},[`stop`]),onMouseenter:ft,onMouseleave:pt},[(0,t.createElementVNode)(`span`,{class:`hover-label`,onClick:n[3]||=e=>ie.isAttachment?tt():gt()},(0,t.toDisplayString)(ie.isAttachment?`下载`:`打开链接`),1),ie.isAttachment?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[n[13]||=(0,t.createElementVNode)(`i`,{class:`hover-sep`},null,-1),(0,t.createElementVNode)(`button`,{class:`hover-icon-btn`,title:`复制`,onClick:_t},[n[9]||=(0,t.createElementVNode)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[(0,t.createElementVNode)(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`}),(0,t.createElementVNode)(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})],-1),ie.copied?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Mdt,`已复制`)):(0,t.createCommentVNode)(``,!0)]),c.value?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[(0,t.createElementVNode)(`button`,{class:`hover-icon-btn`,title:`编辑`,onClick:vt},[...n[10]||=[(0,t.createElementVNode)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[(0,t.createElementVNode)(`path`,{d:`M17 3a2.83 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z`})],-1)]]),(0,t.createElementVNode)(`div`,Ndt,[(0,t.createElementVNode)(`button`,{class:`hover-icon-btn`,title:`切换样式`,onClick:n[4]||=e=>ie.styleMenuOpen=!ie.styleMenuOpen},[...n[11]||=[(0,t.createElementVNode)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[(0,t.createElementVNode)(`path`,{d:`m6 9 6 6 6-6`})],-1)]]),ie.styleMenuOpen?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Pdt,[((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(re,e=>(0,t.createElementVNode)(`div`,{key:e.value,class:(0,t.normalizeClass)([`hover-style-item`,{active:e.value===ie.style}]),onClick:t=>yt(e.value)},[(0,t.createElementVNode)(`span`,Idt,(0,t.toDisplayString)(e.value===ie.style?`✓`:``),1),(0,t.createElementVNode)(`span`,Ldt,(0,t.toDisplayString)(e.label),1)],10,Fdt)),64))])):(0,t.createCommentVNode)(``,!0)]),(0,t.createElementVNode)(`button`,{class:`hover-icon-btn hover-unlink-btn`,title:`取消链接`,onClick:bt},[...n[12]||=[(0,t.createElementVNode)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[(0,t.createElementVNode)(`path`,{d:`M15 7h3a5 5 0 0 1 0 10h-3m-6 0H6a5 5 0 0 1 0-10h3`}),(0,t.createElementVNode)(`line`,{x1:`2`,y1:`2`,x2:`22`,y2:`22`})],-1)]])],64))],64)),n[14]||=(0,t.createElementVNode)(`div`,{class:`hover-bar-arrow`},null,-1)],36)):(0,t.createCommentVNode)(``,!0)]))])])]))}},[[`__scopeId`,`data-v-6ceced2c`]]);function Xdt(e,t,n){var r;if(t.t)return t.t;if(t.v===null)return null;let i=e.getStyleByCell(t),a=e.getStyleByCell(n);if(n.t===Mp.FORCE_STRING){var o;if(!_h(a==null||(o=a.n)==null?void 0:o.pattern)&&t.v!==void 0){if(Tg(t.v))return Mp.NUMBER;if(Zd(`${t.v}`))return Mp.BOOLEAN}return Mp.FORCE_STRING}if(Qdt(i)){var s;return _h(i==null||(s=i.n)==null?void 0:s.pattern)?Mp.STRING:Zdt(t,n)}return _h(a==null||(r=a.n)==null?void 0:r.pattern)?Mp.STRING:Zdt(t,n)}function Zdt(e,t){return e.v===void 0?nG(t.v,t.t):nG(e.v,e.t)}function Qdt(e){var t;return!!(e!=null&&(t=e.n)!=null&&t.pattern)}function nG(e,t){return e===null?null:typeof e==`string`?Tg(e)?(+e==0||+e==1)&&t===Mp.BOOLEAN?Mp.BOOLEAN:t!==Mp.STRING&&t!==Mp.FORCE_STRING&&Ff(e)?Mp.FORCE_STRING:Mp.NUMBER:Zd(e)?Mp.BOOLEAN:Mp.STRING:typeof e==`number`?(e===0||e===1)&&t===Mp.BOOLEAN?Mp.BOOLEAN:Mp.NUMBER:typeof e==`boolean`?Mp.BOOLEAN:Mp.FORCE_STRING}function $dt(e,t){let{unitId:n}=t,r=n?e.getUnit(n,N.UNIVER_SHEET):e.getCurrentUnitOfType(N.UNIVER_SHEET);return r?{workbook:r,unitId:r.getUnitId()}:null}function rG(e,t={}){let{unitId:n,subUnitId:r}=t,i=n?e.getUnit(n,N.UNIVER_SHEET):e.getCurrentUnitOfType(N.UNIVER_SHEET);if(!i)return null;let a=r?i.getSheetBySheetId(r):i.getActiveSheet(!0);return a?{worksheet:a,workbook:i,unitId:i.getUnitId(),subUnitId:a.getSheetId()}:null}function iG(e,t){let{unitId:n,subUnitId:r}=t,i=e.getUnit(n,N.UNIVER_SHEET);if(!i)return null;let a=i.getSheetBySheetId(r);return a?{worksheet:a,workbook:i}:null}var aG=(e,t)=>{if(!iG(e.get(B),t))throw Error(`Workbook or worksheet is null error!`);return{unitId:t.unitId,subUnitId:t.subUnitId,ranges:I.deepClone(t.ranges)}},oG={id:`sheet.mutation.add-worksheet-merge`,type:R.MUTATION,handler:(e,t)=>{let n=iG(e.get(B),t);if(!n)throw Error(`Workbook or worksheet is null error!`);let{worksheet:r}=n,i=r.getConfig().mergeData,a=t.ranges;for(let e=0;e<a.length;e++)i.push(a[e]);return r.getSpanModel().rebuild(i),!0}},sG={CELL_CONTENT:xf(`CELL_CONTENT`),ROW_FILTERED:xf(`ROW_FILTERED`)},cG=function(e){return e[e.DATA_VALIDATION=9]=`DATA_VALIDATION`,e[e.NUMFMT=10]=`NUMFMT`,e[e.CELL_IMAGE=11]=`CELL_IMAGE`,e}({}),eft=`sheet.interceptor.range-theme-id`,tft=`sheet.interceptor.ignore-range-theme`;function lG(e){"@babel/helpers - typeof";return lG=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},lG(e)}function nft(e,t){if(lG(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(lG(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function rft(e){var t=nft(e,`string`);return lG(t)==`symbol`?t:t+``}function Z(e,t,n){return(t=rft(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function uG(e,t){return function(n,r){t(n,r,e)}}function dG(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var fG=xf(`BEFORE_CELL_EDIT`),pG=xf(`AFTER_CELL_EDIT`),mG=xf(`VALIDATE_CELL`),hG=class extends F{constructor(e){super(),this._univerInstanceService=e,Z(this,`_interceptorsByName`,new Map),Z(this,`_commandInterceptors`,[]),Z(this,`_rangeInterceptors`,[]),Z(this,`_autoHeightInterceptors`,[]),Z(this,`_beforeCommandInterceptor`,[]),Z(this,`_afterCommandInterceptors`,[]),Z(this,`_workbookDisposables`,new Map),Z(this,`_worksheetDisposables`,new Map),Z(this,`_composedInterceptorByKey`,new Map),Z(this,`_composedInterceptorVersion`,0),Z(this,`writeCellInterceptor`,new Cf({BEFORE_CELL_EDIT:fG,AFTER_CELL_EDIT:pG,VALIDATE_CELL:mG})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(N.UNIVER_SHEET).subscribe(e=>{this._interceptWorkbook(e.unit)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(N.UNIVER_SHEET).subscribe(e=>this._disposeWorkbookInterceptor(e))),this.intercept(sG.CELL_CONTENT,{priority:-1,effect:bf.Style|bf.Value,handler:e=>e}),this.disposeWithMe(this.writeCellInterceptor.intercept(pG,{priority:-1,handler:e=>e})),this.disposeWithMe(this.writeCellInterceptor.intercept(fG,{priority:-1,handler:e=>e})),this.disposeWithMe(this.writeCellInterceptor.intercept(mG,{priority:-1,handler:e=>e}))}dispose(){super.dispose(),this._workbookDisposables.forEach(e=>e.dispose()),this._workbookDisposables.clear(),this._worksheetDisposables.forEach(e=>e.dispose()),this._worksheetDisposables.clear(),this._interceptorsByName.clear(),this._composedInterceptorByKey.clear()}interceptCommand(e){if(this._commandInterceptors.includes(e))throw Error(`[SheetInterceptorService]: Interceptor already exists!`);return this._commandInterceptors.push(e),this._commandInterceptors.sort((e,t)=>(t.priority??0)-(e.priority??0)),this.disposeWithMe(Hf(()=>Gd(this._commandInterceptors,e)))}onCommandExecute(e){let t=this._commandInterceptors.map(t=>t.getMutations(e));return{preUndos:t.map(e=>e.preUndos??[]).flat(),undos:t.map(e=>e.undos).flat(),preRedos:t.map(e=>e.preRedos??[]).flat(),redos:t.map(e=>e.redos).flat()}}interceptAfterCommand(e){if(this._afterCommandInterceptors.includes(e))throw Error(`[SheetInterceptorService]: Interceptor already exists!`);return this._afterCommandInterceptors.push(e),this._afterCommandInterceptors.sort((e,t)=>(t.priority??0)-(e.priority??0)),this.disposeWithMe(Hf(()=>Gd(this._afterCommandInterceptors,e)))}afterCommandExecute(e){let t=this._afterCommandInterceptors.map(t=>t.getMutations(e));return{undos:t.map(e=>e.undos).flat(),redos:t.map(e=>e.redos).flat()}}interceptAutoHeight(e){if(this._autoHeightInterceptors.includes(e))throw Error(`[SheetInterceptorService]: Interceptor already exists!`);return this._autoHeightInterceptors.push(e),this._autoHeightInterceptors.sort((e,t)=>(t.priority??0)-(e.priority??0)),this.disposeWithMe(Hf(()=>Gd(this._autoHeightInterceptors,e)))}generateMutationsOfAutoHeight(e){let t=this._autoHeightInterceptors.map(t=>t.getMutations(e));return{preUndos:t.map(e=>e.preUndos??[]).flat(),undos:t.map(e=>e.undos).flat(),preRedos:t.map(e=>e.preRedos??[]).flat(),redos:t.map(e=>e.redos).flat()}}interceptBeforeCommand(e){if(this._beforeCommandInterceptor.includes(e))throw Error(`[SheetInterceptorService]: Interceptor already exists!`);return this._beforeCommandInterceptor.push(e),this._beforeCommandInterceptor.sort((e,t)=>(t.priority??0)-(e.priority??0)),this.disposeWithMe(Hf(()=>Gd(this._beforeCommandInterceptor,e)))}async beforeCommandExecute(e){return(await Promise.all(this._beforeCommandInterceptor.map(t=>t.performCheck(e)))).every(e=>e)}interceptRanges(e){if(this._rangeInterceptors.includes(e))throw Error(`[SheetInterceptorService]: Interceptor already exists!`);return this._rangeInterceptors.push(e),this._rangeInterceptors.sort((e,t)=>(t.priority??0)-(e.priority??0)),this.disposeWithMe(Hf(()=>Gd(this._rangeInterceptors,e)))}generateMutationsByRanges(e){let t=this._rangeInterceptors.map(t=>t.getMutations(e));return{preUndos:t.map(e=>e.preUndos??[]).flat(),undos:t.map(e=>e.undos).flat(),preRedos:t.map(e=>e.preRedos??[]).flat(),redos:t.map(e=>e.redos).flat()}}onWriteCell(e,t,n,r,i){let a={subUnitId:t.getSheetId(),unitId:e.getUnitId(),workbook:e,worksheet:t,row:n,col:r,origin:I.deepClone(i)};return this.writeCellInterceptor.fetchThroughInterceptors(pG)(i,a)}onValidateCell(e,t,n,r){let i={subUnitId:t.getSheetId(),unitId:e.getUnitId(),workbook:e,worksheet:t,row:n,col:r};return this.writeCellInterceptor.fetchThroughInterceptors(mG)(Promise.resolve(!0),i)}intercept(e,t){let n=e;this._interceptorsByName.has(n)||this._interceptorsByName.set(n,[]);let r=this._interceptorsByName.get(n);r.push(t);let i=r.sort((e,t)=>(t.priority??0)-(e.priority??0));if(this._invalidateComposedInterceptors(),n===sG.CELL_CONTENT){let e=bf.Style|bf.Value;this._interceptorsByName.set(`${n}-${e}`,i);let r=bf.Style|bf.Value;return this._interceptorsByName.set(`${n}-${bf.Style}`,i.filter(e=>((e.effect||r)&bf.Style)>0)),this._interceptorsByName.set(`${n}-${bf.Value}`,i.filter(e=>((e.effect||r)&bf.Value)>0)),this.disposeWithMe(Hf(()=>{Gd(this._interceptorsByName.get(n),t),Gd(this._interceptorsByName.get(`${n}-${e}`),t),Gd(this._interceptorsByName.get(`${n}-${bf.Style}`),t),Gd(this._interceptorsByName.get(`${n}-${bf.Value}`),t),this._invalidateComposedInterceptors()}))}return this._interceptorsByName.set(n,i),this.disposeWithMe(Hf(()=>{Gd(this._interceptorsByName.get(n),t),this._invalidateComposedInterceptors()}))}fetchThroughInterceptors(e,t,n,r){let i=t===void 0?e:`${e}-${t}`,a=n??i,o=this._composedInterceptorByKey.get(a);if(!o){let e=this._interceptorsByName.get(i);e&&r&&(e=e.filter(r)),o=Sf(e||[]),this._composedInterceptorByKey.set(a,o)}return o}_invalidateComposedInterceptors(){this._composedInterceptorVersion+=1,this._composedInterceptorByKey.clear()}_getCommonCellContentInterceptor(e,t){let n=t.get(e);return n||(n=this.fetchThroughInterceptors(sG.CELL_CONTENT,e),t.set(e,n)),n}_getCommonRowFilteredInterceptor(e){return e.interceptor||=this.fetchThroughInterceptors(sG.ROW_FILTERED),e.interceptor}_interceptWorkbook(e){let t=new Uf,n=e.getUnitId(),r=this,i=t=>{let i=t.getSheetId();t.__interceptViewModel(a=>{let o=new Uf,s=new Map,c={interceptor:null},l=-1,u=-1;r._worksheetDisposables.set(ift(n,t),o),o.add(a.registerCellContentInterceptor({getCell(a,o,c,u,d){let f=t.getCellRaw(a,o),p={unitId:n,subUnitId:i,row:a,col:o,worksheet:t,workbook:e,rawData:f};return u===void 0&&d===void 0?(l!==r._composedInterceptorVersion&&(s.clear(),l=r._composedInterceptorVersion),r._getCommonCellContentInterceptor(c,s)(f,p)):r.fetchThroughInterceptors(sG.CELL_CONTENT,c,u,d)(f,p)}})),o.add(a.registerRowFilteredInterceptor({getRowFiltered(a){return u!==r._composedInterceptorVersion&&(c.interceptor=null,u=r._composedInterceptorVersion),!!r._getCommonRowFilteredInterceptor(c)(!1,{unitId:n,subUnitId:i,row:a,workbook:e,worksheet:t})}}))})};e.getSheets().forEach(e=>i(e)),t.add(e.sheetCreated$.subscribe(e=>i(e))),t.add(Hf(()=>e.getSheets().forEach(e=>this._disposeSheetInterceptor(n,e)))),t.add(e.sheetDisposed$.subscribe(e=>this._disposeSheetInterceptor(n,e))),this._workbookDisposables.set(n,t)}_disposeWorkbookInterceptor(e){let t=e.getUnitId(),n=this._workbookDisposables.get(t);n&&(n.dispose(),this._workbookDisposables.delete(t))}_disposeSheetInterceptor(e,t){let n=ift(e,t),r=this._worksheetDisposables.get(n);r&&(r.dispose(),this._worksheetDisposables.delete(n))}};hG=dG([uG(0,B)],hG);function ift(e,t){return`${e}|${t.getSheetId()}`}var gG=e=>{let t={};return e.bg&&(t.bg={...e.bg}),e.ol&&(t.ol={...e.ol}),e.bd&&(t.bd={...e.bd}),e.cl&&(t.cl={...e.cl}),e.ht&&(t.ht=e.ht),e.vt&&(t.vt=e.vt),e.bl!==void 0&&(t.bl=e.bl),t};function aft(e){let t={};if(e.length===1)return e[0];for(let n of e)n.bg&&(t.bg=n.bg),n.ol&&(t.ol=n.ol),n.bd&&(t.bd={...t.bd,...n.bd}),n.cl&&(t.cl=n.cl),n.ht&&(t.ht=n.ht),n.vt&&(t.vt=n.vt),n.bl!==void 0&&(t.bl=n.bl);return t}var _G={wholeStyle:1,headerRowStyle:2,headerColumnStyle:4,firstRowStyle:8,secondRowStyle:16,lastRowStyle:32,firstColumnStyle:128,secondColumnStyle:256,lastColumnStyle:512},vG=class{constructor(e,t){Z(this,`_name`,void 0),Z(this,`wholeStyle`,null),Z(this,`headerRowStyle`,null),Z(this,`headerColumnStyle`,null),Z(this,`firstRowStyle`,null),Z(this,`secondRowStyle`,null),Z(this,`lastRowStyle`,null),Z(this,`firstColumnStyle`,null),Z(this,`secondColumnStyle`,null),Z(this,`lastColumnStyle`,null),Z(this,`_mergeCacheMap`,new Map),t&&this.fromJson({...t,name:e}),this._name=e}getName(){return this._name}getWholeStyle(){return this.wholeStyle}setWholeStyle(e){this.wholeStyle=e,this._resetStyleCache()}getFirstRowStyle(){return this.firstRowStyle}setFirstRowStyle(e){this.firstRowStyle=e,this._resetStyleCache()}getSecondRowStyle(){return this.secondRowStyle}setSecondRowStyle(e){this.secondRowStyle=e,this._resetStyleCache()}getLastRowStyle(){return this.lastRowStyle}setLastRowStyle(e){this.lastRowStyle=e,this._resetStyleCache()}getFirstColumnStyle(){return this.firstColumnStyle}setFirstColumnStyle(e){this.firstColumnStyle=e,this._resetStyleCache()}getSecondColumnStyle(){return this.secondColumnStyle}setSecondColumnStyle(e){this.secondColumnStyle=e,this._resetStyleCache()}getLastColumnStyle(){return this.lastColumnStyle}setLastColumnStyle(e){this.lastColumnStyle=e,this._resetStyleCache()}getHeaderRowStyle(){return this.headerRowStyle}setHeaderRowStyle(e){this.headerRowStyle=e,this._resetStyleCache()}getHeaderColumnStyle(){return this.headerColumnStyle}setHeaderColumnStyle(e){this.headerColumnStyle=e,this._resetStyleCache()}getStyle(e,t,n,r,i){let a=0;return n&&(a|=_G.lastRowStyle),r&&(a|=_G.lastColumnStyle),e>=0&&t>=0&&(a|=_G.wholeStyle),e%2==1&&(a|=i?_G.secondRowStyle:_G.firstRowStyle),e%2==0&&(a|=i?_G.firstRowStyle:_G.secondRowStyle),e===0&&(a|=_G.headerRowStyle),t===0&&(a|=_G.headerColumnStyle),t%2==1&&(a|=_G.firstColumnStyle),t%2==0&&(a|=_G.secondColumnStyle),a===0?null:this._getMergeStyle(a)}_getMergeStyle(e){let t=this._mergeCacheMap.get(e);return t||(t=this._mergeStyle(e),this._mergeCacheMap.set(e,t)),t}_mergeStyle(e){let t=[];return this.wholeStyle&&e&_G.wholeStyle&&t.push(this.wholeStyle),this.firstColumnStyle&&e&_G.firstColumnStyle&&t.push(this.firstColumnStyle),this.secondColumnStyle&&e&_G.secondColumnStyle&&t.push(this.secondColumnStyle),this.firstRowStyle&&e&_G.firstRowStyle&&t.push(this.firstRowStyle),this.secondRowStyle&&e&_G.secondRowStyle&&t.push(this.secondRowStyle),this.headerColumnStyle&&e&_G.headerColumnStyle&&t.push(this.headerColumnStyle),this.lastColumnStyle&&e&_G.lastColumnStyle&&t.push(this.lastColumnStyle),this.headerRowStyle&&e&_G.headerRowStyle&&t.push(this.headerRowStyle),this.lastRowStyle&&e&_G.lastRowStyle&&t.push(this.lastRowStyle),aft(t)}_resetStyleCache(){this._mergeCacheMap.clear()}toJson(){let e={name:this._name};return this.wholeStyle&&(e.wholeStyle=gG(this.wholeStyle)),this.headerRowStyle&&(e.headerRowStyle=gG(this.headerRowStyle)),this.headerColumnStyle&&(e.headerColumnStyle=gG(this.headerColumnStyle)),this.firstRowStyle&&(e.firstRowStyle=gG(this.firstRowStyle)),this.secondRowStyle&&(e.secondRowStyle=gG(this.secondRowStyle)),this.lastRowStyle&&(e.lastRowStyle=gG(this.lastRowStyle)),this.firstColumnStyle&&(e.firstColumnStyle=gG(this.firstColumnStyle)),this.secondColumnStyle&&(e.secondColumnStyle=gG(this.secondColumnStyle)),this.lastColumnStyle&&(e.lastColumnStyle=gG(this.lastColumnStyle)),e}fromJson(e){this._name=e.name,e.wholeStyle&&(this.wholeStyle=gG(e.wholeStyle)),e.headerRowStyle&&(this.headerRowStyle=gG(e.headerRowStyle)),e.headerColumnStyle&&(this.headerColumnStyle=gG(e.headerColumnStyle)),e.firstRowStyle&&(this.firstRowStyle=gG(e.firstRowStyle)),e.secondRowStyle&&(this.secondRowStyle=gG(e.secondRowStyle)),e.lastRowStyle&&(this.lastRowStyle=gG(e.lastRowStyle)),e.firstColumnStyle&&(this.firstColumnStyle=gG(e.firstColumnStyle)),e.secondColumnStyle&&(this.secondColumnStyle=gG(e.secondColumnStyle)),e.lastColumnStyle&&(this.lastColumnStyle=gG(e.lastColumnStyle))}dispose(){this._mergeCacheMap.clear()}},oft=(e,t,n)=>new vG(`light-${e}`,{headerRowStyle:{bg:{rgb:t}},firstColumnStyle:{bg:{rgb:`rgb(255, 255, 255)`}},secondColumnStyle:{bg:{rgb:n}},lastRowStyle:{bg:{rgb:t}}}),sft=(e,t,n)=>new vG(`middle-${e}`,{headerRowStyle:{bg:{rgb:t}},headerColumnStyle:{bg:{rgb:n}},secondRowStyle:{bg:{rgb:n}},lastRowStyle:{bg:{rgb:t}},lastColumnStyle:{bg:{rgb:n}}}),cft=(e,t,n,r)=>new vG(`dark-${e}`,{headerRowStyle:{bg:{rgb:t},cl:{rgb:`rgb(255, 255, 255)`},ht:Tp.CENTER,bl:jp.TRUE},firstRowStyle:{bg:{rgb:n}},secondRowStyle:{bg:{rgb:r}},lastRowStyle:{bg:{rgb:t}}}),lft=[{baseName:`blue`,header:`rgb(164, 202, 254)`,color:`rgb(225, 239, 254)`},{baseName:`grey`,header:`rgb(205, 208, 216)`,color:`rgb(238, 239, 241)`},{baseName:`red`,header:`rgb(248, 180, 180)`,color:`rgb(253, 232, 232)`},{baseName:`orange`,header:`rgb(253, 186, 140)`,color:`rgb(254, 236, 220)`},{baseName:`yellow`,header:`rgb(250, 200, 21)`,color:`rgb(255, 244, 185)`},{baseName:`green`,header:`rgb(132, 225, 188)`,color:`rgb(222, 247, 236)`},{baseName:`azure`,header:`rgb(126, 220, 226)`,color:`rgb(213, 245, 246)`},{baseName:`indigo`,header:`rgb(186, 198, 248)`,color:`rgb(233, 237, 255)`},{baseName:`purple`,header:`rgb(202, 191, 253)`,color:`rgb(237, 235, 254)`},{baseName:`magenta`,header:`rgb(248, 180, 217)`,color:`rgb(252, 232, 243)`}],uft=[{baseName:`blue`,rowHeader:`rgb(63, 131, 248)`,colHeader:`rgb(195, 221, 253)`},{baseName:`grey`,rowHeader:`rgb(95, 101, 116)`,colHeader:`rgb(227, 229, 234)`},{baseName:`red`,rowHeader:`rgb(240, 82, 82)`,colHeader:`rgb(251, 213, 213)`},{baseName:`orange`,rowHeader:`rgb(255, 90, 31)`,colHeader:`rgb(252, 217, 189)`},{baseName:`yellow`,rowHeader:`rgb(212, 157, 15)`,colHeader:`rgb(252, 220, 106)`},{baseName:`green`,rowHeader:`rgb(13, 164, 113)`,colHeader:`rgb(188, 240, 218)`},{baseName:`azure`,rowHeader:`rgb(6, 148, 162)`,colHeader:`rgb(175, 236, 239)`},{baseName:`indigo`,rowHeader:`rgb(70, 106, 247)`,colHeader:`rgb(210, 218, 250)`},{baseName:`purple`,rowHeader:`rgb(144, 97, 249)`,colHeader:`rgb(220, 215, 254)`},{baseName:`magenta`,rowHeader:`rgb(231, 70, 148)`,colHeader:`rgb(250, 209, 232)`}],dft=[{baseName:`blue`,rowHeader:`rgb(30, 66, 159)`,firstRow:`rgb(195, 221, 253)`,secondRow:`rgb(118, 169, 250)`},{baseName:`grey`,rowHeader:`rgb(44, 48, 64)`,firstRow:`rgb(227, 229, 234)`,secondRow:`rgb(151, 157, 172)`},{baseName:`red`,rowHeader:`rgb(155, 28, 28)`,firstRow:`rgb(251, 213, 213)`,secondRow:`rgb(249, 128, 128)`},{baseName:`orange`,rowHeader:`rgb(180, 52, 3)`,firstRow:`rgb(252, 217, 189)`,secondRow:`rgb(255, 138, 76)`},{baseName:`yellow`,rowHeader:`rgb(154, 109, 21)`,firstRow:`rgb(252, 220, 106)`,secondRow:`rgb(212, 157, 15)`},{baseName:`green`,rowHeader:`rgb(4, 108, 78)`,firstRow:`rgb(188, 240, 218)`,secondRow:`rgb(49, 196, 141)`},{baseName:`azure`,rowHeader:`rgb(3, 102, 114)`,firstRow:`rgb(175, 236, 239)`,secondRow:`rgb(22, 189, 202)`},{baseName:`indigo`,rowHeader:`rgb(16, 51, 191)`,firstRow:`rgb(210, 218, 250)`,secondRow:`rgb(98, 128, 249)`},{baseName:`purple`,rowHeader:`rgb(74, 29, 150)`,firstRow:`rgb(220, 215, 254)`,secondRow:`rgb(172, 148, 250)`},{baseName:`magenta`,rowHeader:`rgb(153, 21, 75)`,firstRow:`rgb(250, 209, 232)`,secondRow:`rgb(241, 126, 184)`}],fft=lft.map(({baseName:e,header:t,color:n})=>oft(e,t,n)),pft=uft.map(({baseName:e,rowHeader:t,colHeader:n})=>sft(e,t,n)),mft=dft.map(({baseName:e,rowHeader:t,firstRow:n,secondRow:r})=>cft(e,t,n,r)),hft=[...fft,...pft,...mft],gft={headerRowStyle:{bg:{rgb:`rgb(68,114,196)`},cl:{rgb:`rgb(255,255,255)`},ht:Tp.CENTER,bl:jp.TRUE},firstRowStyle:{bg:{rgb:`rgb(217,225,242)`}}},_ft=new vG(`default`,gft),vft=new vG(`default-last-row`,{...gft,lastRowStyle:{bd:{t:{s:cp.THIN,cl:{rgb:`rgb(68,114,196)`}}},ht:Tp.CENTER,bl:jp.TRUE}}),yft=class{constructor(){Z(this,`_toggleRanges`,[])}refresh(e,t){let{startRow:n,endRow:r}=e,i=[],a=0,o=!1,s=-1;for(let e=n;e<=r;e++){if(!t(e)){a++,a%2==1?o=!0:(o=!1,s!==-1&&(i.push([s,e-1]),s=-1));continue}a%2==1?o?s===-1&&(s=e):(o=!0,s=e):o&&(i.push([s,e-2]),o=!1,s=-1),e===r&&o&&i.push([s,e])}this._toggleRanges=i}getToggleRanges(){return this._toggleRanges.concat()}getIsToggled(e){let t=0,n=this._toggleRanges.length-1;for(;t<=n;){let r=Math.floor((t+n)/2),[i,a]=this._toggleRanges[r];if(e<i)n=r-1;else if(e>a)t=r+1;else return!0}return!1}},bft=`SHEET_RANGE_THEME_MODEL_PLUGIN`,yG=class extends F{constructor(e,t,n){super(),this._sheetInterceptorService=e,this._resourceManagerService=t,this._univerInstanceService=n,Z(this,`_rangeThemeStyleMap`,new Map),Z(this,`_rangeThemeStyleRuleMap`,new Map),Z(this,`_rTreeCollection`,new Map),Z(this,`_defaultRangeThemeMap`,new Map),Z(this,`_zebraCrossingCacheMap`,new Map),Z(this,`_rowVisibleFuncSet`,new Map),Z(this,`_rangeThemeMapChanged$`,new io),Z(this,`rangeThemeMapChange$`,this._rangeThemeMapChanged$.asObservable()),this._registerIntercept(),this._initSnapshot(),this._initDefaultTheme()}_initDefaultTheme(){this.registerDefaultRangeTheme(_ft),this.registerDefaultRangeTheme(vft);for(let e of hft)this.registerDefaultRangeTheme(e)}_ensureRangeThemeStyleMap(e){return this._rangeThemeStyleMap.has(e)||this._rangeThemeStyleMap.set(e,new Map),this._rangeThemeStyleMap.get(e)}_ensureRangeThemeStyleRuleMap(e){return this._rangeThemeStyleRuleMap.has(e)||this._rangeThemeStyleRuleMap.set(e,new Map),this._rangeThemeStyleRuleMap.get(e)}_ensureRTreeCollection(e){return this._rTreeCollection.has(e)||this._rTreeCollection.set(e,new lx),this._rTreeCollection.get(e)}getDefaultRangeThemeStyle(e){return this._defaultRangeThemeMap.get(e)}getCustomRangeThemeStyle(e,t){return this._ensureRangeThemeStyleMap(e).get(t)}_getSheetRowVisibleFuncSet(e,t){this._rowVisibleFuncSet.has(e)||this._rowVisibleFuncSet.set(e,new Map);let n=this._rowVisibleFuncSet.get(e);return n.has(t)||n.set(t,new Set),n.get(t)}_getSheetRowVisibleHasInit(e,t){return!!(this._rowVisibleFuncSet.has(e)&&this._rowVisibleFuncSet.get(e)?.has(t))}refreshSheetRowVisibleFuncSet(e,t){let n=this._getSheetRowVisibleFuncSet(e,t);n.clear();let r=this._univerInstanceService.getUnit(e);if(r){let e=r.getSheetBySheetId(t);if(e){let t=e.getRowCount(),r=e.getRowManager();for(let i=1;i<=t;i++)e.getRowVisible(i)?r.getRowHeight(i)===0&&n.add(i):n.add(i)}}}_ensureZebraCrossingCache(e,t,n){this._zebraCrossingCacheMap.has(e)||this._zebraCrossingCacheMap.set(e,new Map);let r=this._zebraCrossingCacheMap.get(e);r.has(t)||r.set(t,new Map);let i=r.get(t);return i.has(n)||i.set(n,new yft),i.get(n)}registerRangeThemeRule(e,t){let{unitId:n,subUnitId:r,range:i}=t,a=np(),o=this._ensureRangeThemeStyleRuleMap(n),s=this._ensureRTreeCollection(n);o.set(a,{rangeInfo:t,themeName:e}),s.insert({unitId:n,sheetId:r,range:i,id:a}),this._getSheetRowVisibleHasInit(n,r)||this.refreshSheetRowVisibleFuncSet(n,r);let c=this._ensureZebraCrossingCache(n,r,a),l=this._getSheetRowVisibleFuncSet(n,r);c.refresh(i,e=>!l.has(e))}getRegisteredRangeThemeStyle(e){let{unitId:t,subUnitId:n,range:r}=e,i=this._ensureRTreeCollection(t),a=Array.from(i.bulkSearch([{unitId:t,sheetId:n,range:r}]));if(a[0]){let e=this._ensureRangeThemeStyleRuleMap(t).get(a[0]);if(e)return e.themeName}}refreshZebraCrossingCacheBySheet(e,t){this._zebraCrossingCacheMap.has(e)||this._zebraCrossingCacheMap.set(e,new Map);let n=this._zebraCrossingCacheMap.get(e);n.has(t)||n.set(t,new Map);let r=n.get(t);r&&r.forEach((n,i)=>{let a=this._ensureRangeThemeStyleRuleMap(e).get(i);a?n.refresh(a.rangeInfo.range,n=>!this._getSheetRowVisibleFuncSet(e,t).has(n)):r.delete(i)})}removeRangeThemeRule(e,t){let{unitId:n,subUnitId:r,range:i}=t,a=this._ensureRTreeCollection(n),o=Array.from(a.bulkSearch([{unitId:n,sheetId:r,range:i}])),s=this._ensureRangeThemeStyleRuleMap(n);for(let t=0;t<o.length;t++){let c=s.get(o[t]);if(c&&c.themeName===e){s.delete(o[t]),a.remove({unitId:n,sheetId:r,range:i,id:o[t]});let e=this._zebraCrossingCacheMap.get(n);if(e){let n=e.get(r);n&&n.delete(o[t])}break}}}registerDefaultRangeTheme(e){this._defaultRangeThemeMap.set(e.getName(),e),this._rangeThemeMapChanged$.next({type:`add`,styleName:e.getName()})}unRegisterDefaultRangeTheme(e){this._defaultRangeThemeMap.delete(e),this._rangeThemeMapChanged$.next({type:`remove`,styleName:e})}getRegisteredRangeThemes(){return Array.from(this._defaultRangeThemeMap.keys())}registerRangeThemeStyle(e,t){this._ensureRangeThemeStyleMap(e).set(t.getName(),t),this._rangeThemeMapChanged$.next({type:`add`,styleName:t.getName()})}unregisterRangeThemeStyle(e,t){this._ensureRangeThemeStyleMap(e).delete(t),this._rangeThemeMapChanged$.next({type:`remove`,styleName:t})}getALLRegisteredTheme(e){return Array.from(this._ensureRangeThemeStyleMap(e).keys())}getRangeThemeStyle(e,t){return this._defaultRangeThemeMap.has(t)?this._defaultRangeThemeMap.get(t):this._ensureRangeThemeStyleMap(e).get(t)}getCellStyle(e,t,n,r){let i={startRow:n,startColumn:r,endRow:n,endColumn:r},a=this._ensureRTreeCollection(e),o=Array.from(a.bulkSearch([{unitId:e,sheetId:t,range:i}]));if(o[0]){let i=this._ensureRangeThemeStyleRuleMap(e).get(o[0]);if(i){let{rangeInfo:a,themeName:s}=i,c=n-a.range.startRow,l=r-a.range.startColumn,u=this.getRangeThemeStyle(e,s),d=this._ensureZebraCrossingCache(e,t,o[0]).getIsToggled(n);if(u)return u.getStyle(c,l,n===a.range.endRow,r===a.range.endColumn,d)}}}_registerIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(sG.CELL_CONTENT,{id:eft,effect:bf.Style,handler:(e,t,n)=>{let{row:r,col:i,unitId:a,subUnitId:o}=t,s=this.getCellStyle(a,o,r,i);if(s){let r=!e||e===t.rawData?{...t.rawData}:e;return r.themeStyle=s,n(r)}return n(e)}}))}toJson(e){let t=this._ensureRangeThemeStyleRuleMap(e),n=this._ensureRangeThemeStyleMap(e);if(n.size===0&&t.size===0)return`{}`;let r={};t.forEach((e,t)=>{r[t]=e});let i={};return n.forEach((e,t)=>{i[t]=e.toJson()}),JSON.stringify({rangeThemeStyleRuleMap:r,rangeThemeStyleMapJson:i})}fromJSON(e,t){let{rangeThemeStyleRuleMap:n,rangeThemeStyleMapJson:r}=t;n&&Object.keys(n).forEach(e=>{let{themeName:t,rangeInfo:r}=n[e];t.startsWith(`table`)||(this.registerRangeThemeRule(t,r),this._ensureRTreeCollection(r.unitId).insert({unitId:e,sheetId:r.subUnitId,range:r.range,id:e}))}),r&&Object.keys(r).forEach(t=>{let n=r[t],i=new vG(n.name);i.fromJson(n),this._ensureRangeThemeStyleMap(e).set(i.getName(),i)})}deleteUnitId(e){this._rangeThemeStyleMap.delete(e),this._rangeThemeStyleRuleMap.delete(e),this._rTreeCollection.delete(e)}_initSnapshot(){this.disposeWithMe(this._resourceManagerService.registerPluginResource({toJson:e=>this.toJson(e),parseJson:e=>{if(!e)return{};try{return JSON.parse(e)}catch{return{}}},businesses:[N.UNIVER_SHEET],pluginName:bft,onLoad:(e,t)=>{this.fromJSON(e,t)},onUnLoad:e=>{this.deleteUnitId(e)}}))}dispose(){super.dispose(),this._rangeThemeStyleMap.clear(),this._rangeThemeStyleRuleMap.clear(),this._defaultRangeThemeMap.clear(),this._rTreeCollection.clear(),this._zebraCrossingCacheMap.clear(),this._rowVisibleFuncSet.clear()}};yG=dG([uG(0,M(hG)),uG(1,M(wy)),uG(2,M(B))],yG);var bG={id:`sheet.mutation.set-worksheet-range-theme-style`,type:R.MUTATION,handler:(e,t)=>{if(!rG(e.get(B),t))return!1;let n=e.get(yG),{unitId:r,subUnitId:i,range:a,themeName:o}=t;return n.registerRangeThemeRule(o,{range:a,unitId:r,subUnitId:i}),!0}},xft=(e,t)=>{let n=iG(e.get(B),t);if(!n)throw Error(`[SetWorksheetRangeThemeStyleMutation]: worksheet is null error!`);let{worksheet:r}=n;return{unitId:t.unitId,subUnitId:r.getSheetId(),range:t.range,themeName:t.themeName}},xG={id:`sheet.mutation.remove-worksheet-range-theme-style`,type:R.MUTATION,handler:(e,t)=>{if(!rG(e.get(B),t))return!1;let n=e.get(yG),{unitId:r,subUnitId:i,range:a,themeName:o}=t;return n.removeRangeThemeRule(o,{range:a,unitId:r,subUnitId:i}),!0}},Sft=(e,t)=>{let n=iG(e.get(B),t);if(!n)throw Error(`[DeleteWorksheetRangeThemeStyleMutationFactory]: worksheet is null error!`);let{worksheet:r}=n;return{unitId:t.unitId,subUnitId:r.getSheetId(),range:t.range,themeName:t.themeName}},SG=(e,t)=>{if(!iG(e.get(B),t))throw Error(`Workbook or Worksheet not found at InsertRowMutationUndoFactory`);return{unitId:t.unitId,subUnitId:t.subUnitId,range:t.range}},CG={id:`sheet.mutation.insert-row`,type:R.MUTATION,handler:(e,t)=>{let n=iG(e.get(B),t);if(!n)throw Error(`Workbook or Worksheet not found at InsertRowMutation`);let{worksheet:r}=n,i=r.getRowManager(),{range:a,rowInfo:o}=t,{startRow:s,endRow:c}=a;i.insertRowsWithData(s,c,o);let l=c-s+1;return r.setRowCount(r.getRowCount()+l),r.getCellMatrix().insertRows(s,l),!0}},wG=(e,t)=>{if(!iG(e.get(B),t))throw Error(`Workbook or Worksheet not found at InsertColMutationUndoFactory`);return{unitId:t.unitId,subUnitId:t.subUnitId,range:t.range}},TG={id:`sheet.mutation.insert-col`,type:R.MUTATION,handler:(e,t)=>{let n=iG(e.get(B),t);if(!n)throw Error(`Workbook or Worksheet not found at InsertColMutation`);let{worksheet:r}=n,i=r.getColumnManager(),{range:a,colInfo:o}=t,{startColumn:s,endColumn:c}=a;i.insertColumnsWithData(s,c,o);let l=c-s+1;return r.setColumnCount(r.getColumnCount()+l),r.getCellMatrix().insertColumns(a.startColumn,l),!0}},EG={id:`sheet.mutation.move-range`,type:R.MUTATION,handler:(e,t)=>{let{from:n,to:r}=t;if(!n||!r)return!1;let i=e.get(B).getCurrentUnitOfType(N.UNIVER_SHEET);if(!i)return!1;let a=i.getSheetBySheetId(t.from.subUnitId),o=i.getSheetBySheetId(t.to.subUnitId);if(!a||!o)return!1;let s=a.getCellMatrix(),c=o.getCellMatrix();return new Mh(n.value).forValue((e,t,n)=>{n==null?s.realDeleteValue(e,t):s.setValue(e,t,n)}),new Mh(r.value).forValue((e,t,n)=>{n==null?c.realDeleteValue(e,t):c.setValue(e,t,n)}),!0}};function Cft(e,t){let{unitId:n,subUnitId:r,sourceRange:i,targetRange:a}=t,o=i.startRow>a.startRow,s=i.endRow-i.startRow+1;return o?{unitId:n,subUnitId:r,sourceRange:n_.clone(a),targetRange:{...i,endRow:i.endRow+s,startRow:i.startRow+s}}:{unitId:n,subUnitId:r,targetRange:n_.clone(i),sourceRange:{...a,endRow:a.endRow-s,startRow:a.startRow-s}}}var DG={id:`sheet.mutation.move-rows`,type:R.MUTATION,handler:(e,t)=>{let{unitId:n,subUnitId:r,sourceRange:i,targetRange:a}=t,o=e.get(B).getUniverSheetInstance(n);if(!o)throw Error(`[MoveRowMutation] univerSheet is null!`);let s=o.getSheetBySheetId(r);if(!s)throw Error(`[MoveRowMutation] worksheet is null!`);let c=i.startRow,l=i.endRow-i.startRow+1,u=a.startRow;return kh(c,l,u,s.getRowManager().getRowData()),s.getCellMatrix().moveRows(c,l,u),!0}};function wft(e,t){let{unitId:n,subUnitId:r,sourceRange:i,targetRange:a}=t,o=i.startColumn>a.startColumn,s=i.endColumn-i.startColumn+1;return o?{unitId:n,subUnitId:r,sourceRange:n_.clone(a),targetRange:{...i,endColumn:i.endColumn+s,startColumn:i.startColumn+s}}:{unitId:n,subUnitId:r,targetRange:n_.clone(i),sourceRange:{...a,startColumn:a.startColumn-s,endColumn:a.endColumn-s}}}var OG={id:`sheet.mutation.move-columns`,type:R.MUTATION,handler:(e,t)=>{let{unitId:n,subUnitId:r,sourceRange:i,targetRange:a}=t,o=e.get(B).getUniverSheetInstance(n);if(!o)throw Error(`[MoveColumnMutation] univerSheet is null!`);let s=o.getSheetBySheetId(r);if(!s)throw Error(`[MoveColumnMutation] worksheet is null!`);let c=i.startColumn,l=i.endColumn-i.startColumn+1,u=a.startColumn;return kh(c,l,u,s.getColumnManager().getColumnData()),s.getCellMatrix().moveColumns(c,l,u),!0}},Tft=(e,t)=>{let n=t.getRowManager().getRowData(),r={},i=e.range,a=Oh(r,hee(i.startRow,i.endRow,n));return{unitId:e.unitId,subUnitId:e.subUnitId,range:e.range,rowInfo:a}},kG={id:`sheet.mutation.remove-rows`,type:R.MUTATION,handler:(e,t)=>{let n=e.get(B).getUniverSheetInstance(t.unitId);if(n==null)throw Error(`universheet is null error!`);let r=n.getSheetBySheetId(t.subUnitId);if(!r)return!1;let i=t.range,a=r.getRowManager().getRowData(),o=[];for(let e=i.startRow;e<=i.endRow;e++)r.getRowFiltered(e)&&o.push(e);let s=i.endRow-i.startRow+1;return Dh(i.startRow,s,a),r.getCellMatrix().removeRows(i.startRow,s),r.setRowCount(r.getRowCount()-s),!0}},Eft=(e,t)=>{let n=e.get(B).getUniverSheetInstance(t.unitId);if(n==null)throw Error(`universheet is null error!`);let r=n.getSheetBySheetId(t.subUnitId);if(r==null)throw Error(`worksheet is null error!`);let i=r.getColumnManager().getColumnData(),a={},o=t.range,s=Oh(a,hee(o.startColumn,o.endColumn,i));return{unitId:t.unitId,subUnitId:t.subUnitId,range:t.range,colInfo:s}},AG={id:`sheet.mutation.remove-col`,type:R.MUTATION,handler:(e,t)=>{let n=e.get(B).getUniverSheetInstance(t.unitId);if(n==null)throw Error(`universheet is null error!`);let r=n.getSheetBySheetId(t.subUnitId);if(!r)return!1;let i=t.range,a=r.getColumnManager().getColumnData(),o=i.endColumn-i.startColumn+1;return Dh(i.startColumn,o,a),r.setColumnCount(r.getColumnCount()-o),r.getCellMatrix().removeColumns(i.startColumn,o),!0}},jG=(e,t)=>{let n=iG(e.get(B),t);if(!n)throw Error(`Workbook or worksheet is null error!`);let{worksheet:r}=n,i=r.getConfig().mergeData,a=t.ranges,o=[];for(let e=0;e<a.length;e++)for(let t=i.length-1;t>=0;t--){let n=i[t],r=a[e];n_.intersects(n,r)&&o.push(i[t])}return{unitId:t.unitId,subUnitId:t.subUnitId,ranges:o}},MG={id:`sheet.mutation.remove-worksheet-merge`,type:R.MUTATION,handler:(e,t)=>{let n=iG(e.get(B),t);if(!n)throw Error(`Workbook or worksheet is null error!`);let{worksheet:r}=n,i=r.getConfig().mergeData,a=t.ranges;for(let e=0;e<a.length;e++)for(let t=i.length-1;t>=0;t--){let n=i[t],r=a[e];n_.intersects(n,r)&&i.splice(t,1)}return r.getSpanModel().rebuild(i),!0}},Dft=e=>{let{order:t}=e,n={};return Object.keys(t).forEach(e=>{n[t[Number(e)]]=Number(e)}),{...e,order:n}},NG={id:`sheet.mutation.reorder-range`,type:R.MUTATION,handler:(e,t)=>{let{subUnitId:n,unitId:r,range:i,order:a}=t,o=e.get(B).getUnit(r).getSheetBySheetId(n);if(!o)return!1;let s=new Mh;Kg.foreach(i,(e,t)=>{if(a.hasOwnProperty(e)){let n=a[e],r=I.deepClone(o.getCellRaw(n,t));s.setValue(e,t,r)}});let c=o.getCellMatrix();return s.forValue((e,t,n)=>{c.setValue(e,t,n)}),!0}};function Oft(e,t){if(e==null)return e;let n=I.deepClone(e);if(t==null)return n;let r={};return`h`in t&&(r.h=n.h),`ia`in t&&(r.ia=n.ia),`ah`in t&&(r.ah=n.ah),`hd`in t&&(r.hd=n.hd),`s`in t&&(r.s=n.s),`custom`in t&&(r.custom=n.custom),r}function kft(e,t){if(e==null)return e;let n=I.deepClone(e);if(t==null)return n;let r={};return`w`in t&&(r.w=n.w),`hd`in t&&(r.hd=n.hd),`s`in t&&(r.s=n.s),`custom`in t&&(r.custom=n.custom),r}var Aft=(e,t)=>{let{unitId:n,subUnitId:r,columnData:i}=e,a={},o=t.getColumnManager();for(let e in i){let t=i[e];a[e]=kft(o.getColumn(Number(e)),t)}return{unitId:n,subUnitId:r,columnData:a}},PG={id:`sheet.mutation.set-col-data`,type:R.MUTATION,handler:(e,t)=>{let{columnData:n}=t,r=rG(e.get(B),t);if(!r)return!1;let{worksheet:i}=r,a=i.getColumnManager();for(let e in n){let t=n[e];if(t==null){a.removeColumn(Number(e));continue}let r=a.getColumnOrCreate(Number(e));Object.assign(r,t)}return!0}},jft=(e,t)=>{if(e.get(B).getUniverSheetInstance(t.unitId)==null)throw Error(`universheet is null error!`);return{unitId:t.unitId,subUnitId:t.subUnitId,ranges:t.ranges}},FG={id:`sheet.mutation.set-col-hidden`,type:R.MUTATION,handler:(e,t)=>{let n=e.get(B).getUniverSheetInstance(t.unitId);if(!n)return!1;let r=n.getSheetBySheetId(t.subUnitId).getColumnManager();for(let e=0;e<t.ranges.length;e++){let n=t.ranges[e];for(let e=n.startColumn;e<n.endColumn+1;e++){let t=r.getColumnOrCreate(e);t!=null&&(t.hd=jp.TRUE)}}return!0}},Mft=(e,t)=>{if(e.get(B).getUniverSheetInstance(t.unitId)==null)throw Error(`universheet is null error!`);return{unitId:t.unitId,subUnitId:t.subUnitId,ranges:t.ranges}},IG={id:`sheet.mutation.set-col-visible`,type:R.MUTATION,handler:(e,t)=>{let n=e.get(B).getUniverSheetInstance(t.unitId);if(!n)return!1;let r=n.getSheetBySheetId(t.subUnitId).getColumnManager();for(let e=0;e<t.ranges.length;e++){let n=t.ranges[e];for(let e=n.startColumn;e<n.endColumn+1;e++){let t=r.getColumnOrCreate(e);t!=null&&(t.hd=jp.FALSE)}}return!0}},LG={id:`sheet.mutation.set-gridlines-color`,type:R.MUTATION,handler:(e,t)=>{let n=rG(e.get(B),t);if(!n)return!1;let{worksheet:r}=n,i=r.getConfig();return i.gridlinesColor=t.color,!0}};function RG(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function zG(e,t,n){for(let r of t)Object.prototype.hasOwnProperty.call(e,r)&&n(r,e[r])}function BG(e,t,n){if(e==null)return e;if(!RG(e))return;let r={},i=!1;if(zG(e,t,(e,t)=>{r[e]=t,i=!0}),n)for(let t in n){let a=n[t];if(!a||!Object.prototype.hasOwnProperty.call(e,t))continue;let o=a(e[t]);o!==void 0&&(r[t]=o,i=!0)}return i?r:void 0}function Nft(e,t,n){if(e==null)return e;if(!RG(e))return;let r={},i=!1;return zG(e,t,(e,t)=>{let a=n(t);a!==void 0&&(r[e]=a,i=!0)}),i?r:void 0}function Pft(e){switch(e){case`bd`:case`tr`:case`td`:case`ht`:case`vt`:case`tb`:case`pd`:case`bg`:return!0;default:return!1}}function Fft(e){return e==null||[`string`,`number`,`boolean`].includes(typeof e)}function VG(e){return BG(e,dm)}function Ift(e){return BG(e,um,{cl:VG})}function Lft(e){return BG(e,tee,{cl:VG})}function Rft(e){return Nft(e,fm,Lft)}function zft(e){return BG(e,nee)}function Bft(e){return BG(e,ree)}function Vft(e){if(e==null)return e;if(RG(e)&&Object.prototype.hasOwnProperty.call(e,`pattern`)&&typeof e.pattern==`string`)return{pattern:e.pattern}}function Hft(e,t){switch(e){case`ul`:case`bbl`:case`st`:case`ol`:return Ift(t);case`bg`:case`cl`:return VG(t);case`bd`:return Rft(t);case`tr`:return zft(t);case`pd`:return Bft(t);case`n`:return Vft(t);default:return Fft(t)?t:void 0}}function Uft(e,t){if(t===null)return null;if(t===void 0)return e;let n=t,r=I.isObject(e)?{...e}:{};return zG(n,fm,(e,t)=>{let n=Lft(t);n!==void 0&&(r[e]=n)}),r}function Wft(e,t,n){let r=e.getStyleByCell(t);r??delete t.s,typeof n.s==`string`&&(n.s=e.get(n.s));let i=HG(r,n.s?n.s:null);i&&(I.removeNull(i),Object.entries(i).forEach(([e,t])=>{typeof t==`object`&&t&&Object.keys(t).length===0&&delete i[e]})),I.isEmptyObject(i)?delete t.s:t.s=e.setValue(i);let a=n.v?`${n.v}\r\n`:``;!n.p&&t.p&&(a&&a!==t.p.body?.dataStream?delete t.p:Jft(t.p,n.s?n.s:null))}function Gft(e,t){if(!t||!Object.keys(t).length)return e;let n=I.deepClone(e??{})||{},r=t;for(let e of pm){if(!Object.prototype.hasOwnProperty.call(r,e))continue;let t=Hft(e,r[e]);t!==void 0&&(e===`bd`?n[e]=Kft(n[e]||{},t):e in n||(n[e]=null))}return n}function Kft(e,t){if(!t||!Object.keys(t).length)return e;let n=e;for(let r of fm)Object.prototype.hasOwnProperty.call(t,r)&&(r in e||(n[r]=null));return e}function HG(e,t,n=!1){if(t===null)return t;if(t===void 0)return e;let r=I.deepClone(e)||{},i=t;for(let e of pm){if(!Object.prototype.hasOwnProperty.call(i,e)||n&&Pft(e))continue;let t=Hft(e,i[e]);t!==void 0&&(r[e]=e===`bd`?Uft(r[e],t):t)}if(`cl`in r){let e=r,t=e.cl;`ul`in e&&e.ul&&(e.ul.cl=t),`ol`in e&&e.ol&&(e.ol.cl=t),`st`in e&&e.st&&(e.st.cl=t)}return r}function qft(e,t){return e.some(e=>e.startIndex===t)?qft(e,t+1):t}function Jft(e,t){if(e.body==null)return;Array.isArray(e.body.textRuns)||(e.body.textRuns=[]);let n=0,r=[],i=e.body?.paragraphs||[];for(let a of e.body.textRuns){let{st:e,ed:o,ts:s={}}=a;if(n<e){let i={st:n,ed:e},a=HG({},t,!0);a&&I.removeNull(a),I.isEmptyObject(a)||(i.ts=a),r.push(i)}let c=HG(s,t,!0);c&&I.removeNull(c),I.isEmptyObject(c)?delete a.ts:a.ts=c,r.push(a),n=qft(i,o)}let a=e.body.dataStream.endsWith(`\r
604
+ `,YW=`pd-comment-ui-guard`,XW=0;function ddt(){if(XW+=1,XW>1||document.getElementById(YW))return;let e=document.createElement(`style`);e.id=YW,e.textContent=udt,document.head.appendChild(e)}function fdt(){XW=Math.max(0,XW-1),!(XW>0)&&document.getElementById(YW)?.remove()}function pdt(e,t){e?.mergeMenu({[cdt]:{[t.ribbonItem]:{menuItemFactory:e=>({id:t.addOperation,type:zj.BUTTON,icon:`CommentIcon`,title:t.addTitle,tooltip:t.addTitle,hidden$:nj(e,t.instanceType)})}}})}function mdt({univer:e,univerAPI:t,kind:n=`doc`}={}){let r=ldt[n];if(!r||!e||typeof e.__getInjector!=`function`||!t?.addEvent)return null;let i=new Set(r.blockedOperations),a=[];ddt();try{a.push(t.addEvent(t.Event.BeforeCommandExecute,e=>{i.has(e?.id)&&(e.cancel=!0)}))}catch{}try{let t=e.__getInjector(),n=t.get(Ij),i=t.get(Fb);a.push(i.lifecycle$.subscribe(e=>{e>=Mb.Rendered&&pdt(n,r)}))}catch{}return{dispose(){for(let e of a)try{typeof e==`function`?e():e?.unsubscribe?e.unsubscribe():e?.dispose?.()}catch{}fdt()}}}var hdt=`thread-comment-ui`,gdt={editor:{reply:`确定`}};function _dt(e){let t=Object.assign({},...e),n=t[hdt];return!n||!n.editor||(t[hdt]={...n,editor:{...n.editor,...gdt.editor}}),t}var vdt=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},ydt={class:`doc-shell`},bdt={class:`doc-layout`},xdt={class:`doc-canvas`},Sdt={key:0,class:`readonly-badge`,role:`status`},Cdt={key:1,class:`attachment-uploading-tip`,role:`status`},wdt={key:2,class:`attachment-error-tip`},Tdt={class:`link-dialog`},Edt={class:`link-dialog-field`},Ddt={class:`link-dialog-field`},Odt={key:0,class:`field-error`},kdt={class:`link-dialog-tip`},Adt={class:`link-dialog-actions`},jdt=[`disabled`],Mdt={key:0,class:`hover-icon-tip`},Ndt={class:`hover-style`},Pdt={key:0,class:`hover-style-menu`},Fdt=[`onClick`],Idt={class:`style-check`},Ldt={class:`style-name`},Rdt=`univer-sheet://`,ZW=`🔗 `,zdt=`#e4f9fbff`,Bdt=6,Vdt=9,Hdt=6,QW=`hxy.doc.command.format-painter`,Udt=400,$W=`hxy.doc.command.insert-page-break`,eG=`hxy.doc.command.insert-attachment`,Wdt=`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6zM6 20V4h7v5h5v3H6v2h12v6H6z`,Gdt=`M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5c0-1.38 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5c0 1.38 1.12 2.5 2.5 2.5s2.5-1.12 2.5-2.5V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6h-1.5z`,tG=2,Kdt=`.pdf,.doc,.docx,.zip,.rar,.7z,.mp4,.mov,.webm,.avi,.mkv,.mp3,.wav,.m4a,.aac`,qdt=157286400,Jdt=2097152,Ydt=vdt({__name:`DocEditor`,props:{visible:{type:Boolean,default:!0},type:{type:String,default:`edit`,validator:e=>[`view`,`edit`].includes(e)},server:{type:Object,default:null},collaboration:{type:Object,default:null}},emits:[`open-workbook`],setup(e,{expose:n,emit:r}){let i=e,a=r,o=(0,t.ref)(!!i.server?.cloudSync),s=(0,t.ref)(``),c=(0,t.computed)(()=>i.type===`view`||o.value),l=null;function u(e,t){o.value=e,s.value=t,Wt()}async function d(){try{await A?.restore()}catch{}}let p=`demo-doc-01`;try{let e=rI.prototype,t=e._buildCustomRangeBoundsBySegment;if(typeof t==`function`&&!t.__hoverSegmentFixed){let n=function(e,n=-1){return t.call(this,e??``,n)};n.__hoverSegmentFixed=!0,e._buildCustomRangeBoundsBySegment=n,console.log(`[hover-patch] prototype._buildCustomRangeBoundsBySegment patched ✓`)}else typeof t!=`function`&&console.warn(`[hover-patch] _buildCustomRangeBoundsBySegment not found on prototype — engine API changed?`);let n=rF.prototype,r=n._addTextRange;if(typeof r==`function`&&!r.__singleCaretFixed){let e=function(e){r.call(this,e);let t=0;for(let e of this._rangeList)e.collapsed&&t++;t<=1||(this._rangeList=this._rangeList.filter(t=>t===e||!t.collapsed||(t.dispose(),!1)))};e.__singleCaretFixed=!0,n._addTextRange=e}try{let e=TZe,t=e?.preprocessHtml;typeof t==`function`&&!e.__lineSpacingNormalized&&(e.preprocessHtml=function(e){return t.call(this,out(e))},e.__lineSpacingNormalized=!0)}catch{}try{let e=TZe,t=e?.afterProcessRules,n=t?.[0]?.handler;typeof n==`function`&&!e.__exactLineSpacingFixed&&(e.afterProcessRules=[{...t[0],handler(e,t){n.call(this,e,t),hut(e,t);try{let n=t?.getAttribute?.(`style`)??``,r=n.match(/mso-line-height-rule\s*:\s*([a-z-]+)/i)?.[1]?.toLowerCase()??``;if(!r||r===`auto`)return;let i=n.match(/(?:^|;)\s*line-height\s*:\s*([0-9]*\.?[0-9]+)\s*(pt|px)?/i);if(!i)return;let a=e?.body?.paragraphs,o=a?.[a.length-1];if(!o)return;let s=parseFloat(i[1]);if((i[2]||``).toLowerCase()===`pt`&&(s/=.75),!Number.isFinite(s)||s<=0)return;o.paragraphStyle=o.paragraphStyle||{},o.paragraphStyle.spacingRule=r===`exactly`?2:1,o.paragraphStyle.lineSpacing=s}catch{}}}],e.__exactLineSpacingFixed=!0)}catch{}try{_ut(VT)&&console.log(`[pagebreak-patch] DocumentSkeleton._prepareLayoutContext patched ✓`)}catch{}}catch{}let m={"doc.command.set-inline-format-bold":`bl`,"doc.command.set-inline-format-italic":`it`,"doc.command.set-inline-format-underline":`ul`,"doc.command.set-inline-format-strikethrough":`st`},h={"doc.command.set-inline-format-fontsize":`fs`,"doc.command.set-inline-format-font-family":`ff`,"doc.command.set-inline-format-text-color":`cl`,"doc.command.set-inline-format-text-background-color":`bg`};function g(e,t,n,r){for(let i of e)if(i.st<n&&i.ed>t&&i.ts){if(r===`bl`||r===`it`){if(i.ts[r]===jp.TRUE)return!0}else if(i.ts[r]&&i.ts[r].s===jp.TRUE)return!0}return!1}function _(e,t,n,r,i){if(!t||!n||n.length===0)return!1;let a=t.getUnitId(),o=new Ev,s=new Mf;s.reset();let c=!1;for(let e of n){let{startOffset:t,endOffset:n}=e;if(t==null||n==null||t===n)continue;let a={dataStream:``,textRuns:[{st:0,ed:n-t,ts:{[r]:i}}]},l=t-s.cursor;l!==0&&o.push({t:Dm.RETAIN,len:l}),o.push({t:Dm.RETAIN,body:a,len:n-t}),s.reset(),s.moveCursor(n),c=!0}if(!c)return!1;let l=Dv.getInstance().editOp(o.serialize(),[`body`]);return!!e.syncExecuteCommand(TE.id,{unitId:a,actions:l,textRanges:n})}function v(e){let t=e.getTextRanges()||[];return t.length>0?t.filter(e=>e.startOffset!=null&&e.endOffset!=null):e.getDocRanges()||[]}function y(e){try{let t=e&&e.resolvedDependencyCollection&&e.resolvedDependencyCollection.resolvedDependencies;if(t&&t[Symbol.iterator]){for(let[e,n]of t)if(e&&e.name===`DocMenuStyleService`)return Array.isArray(n)?n[0]:n}}catch{}return null}function b(e,t){return e===`bl`||e===`it`?t?jp.FALSE:jp.TRUE:{s:t?jp.FALSE:jp.TRUE}}function x(){if(he)try{let e=he.__getInjector().get(z)._commandRegistry,t=e&&e.getCommand&&e.getCommand(`doc.command.set-inline-format`),n=t&&t[0];if(!n||n.__toggleFixed)return;let r=n.handler,i=(e,t,n)=>{let{preCommandId:i}=t||{},a=m[i],o=h[i];if(!a&&!o)return r(e,t,n);let s=e.get(SE),c=e.get(B),l=e.get(z),u=y(e)||y(he.__getInjector()),d=c.getCurrentUnitOfType(1),f=d&&d.getBody&&d.getBody(),p=v(s),x=p.find(e=>e.isActive)||p[0],S=t&&t.value!=null?o===`cl`||o===`bg`?{rgb:t.value}:t.value:null,C=e=>{u&&e&&setTimeout(()=>u.setStyleCache(e),0)};if(x&&x.startOffset===x.endOffset){let i=null;if(u&&f){let e=x.startOffset,t=e<(f.dataStream||``).length?e:Math.max(0,e-1);if(a){let e=u.getStyleCache()||{},n;n=e[a]===void 0?g(f.textRuns||[],t,t+1,a):a===`bl`||a===`it`?e[a]===jp.TRUE:!!(e[a]&&e[a].s===jp.TRUE),i={[a]:b(a,n)}}else S!=null&&(i={[o]:S})}let s=r(e,t,n);return C(i),s}if(a){if(f&&x){let{startOffset:e,endOffset:t}=x,n=b(a,g(f.textRuns||[],e,t,a)),r=_(l,d,[{startOffset:e,endOffset:t}],a,n);return C({[a]:n}),r}return r(e,t,n)}let w=r(e,t,n);return S!=null&&C({[o]:S}),w};i.__inject=r.__inject,i.__toggleFixed=!0,n.handler=i,console.log(`[toggle-patch] SetInlineFormatCommand toggle behavior fixed ✓`)}catch(e){console.warn(`[toggle-patch] failed:`,e)}}let S=(0,t.ref)(null),C=(0,t.shallowRef)(null),w=(0,t.ref)(null),T=null,E=null,D=null,O=null,k=(0,t.shallowRef)(null),A=i.server?.cloudSync?GW({editorRef:k,docKey:i.server.docKey||`doc:default`,docType:`doc`,cloudSync:i.server.cloudSync,snapshotInterval:i.server.snapshotInterval,mutationFlushSize:i.server.mutationFlushSize,enableIncremental:i.server.enableIncremental}):null,ee=(0,t.ref)([]);(0,t.ref)(``);let te=(0,t.reactive)({words:0,paragraphs:0}),j=(0,t.reactive)({visible:!1,text:``,url:``,urlError:``,style:`text`,startOffset:0,endOffset:0,segmentId:``,replace:!1}),ne=null,re=[{value:`text`,label:`文字链`},{value:`icon`,label:`图标+文字链`},{value:`card`,label:`卡片`}],ie=(0,t.reactive)({visible:!1,url:``,text:``,style:`text`,linkId:``,segmentId:``,startIndex:0,endIndex:0,styleMenuOpen:!1,copied:!1,isAttachment:!1,fileName:``,fileSize:0,x:null,y:null}),ae=null,oe=null,se=null,ce=!1,le=null,ue=[],de=null,fe=!1,pe=!1;function me(e,t,n,r,i,a,o,s){if(!o&&!s){e.fillRect(t,n,r,i);return}let c=Math.max(0,Math.min(a,i/2,o&&s?r/2:r));e.beginPath(),e.moveTo(t+(o?c:0),n),e.arcTo(t+r,n,t+r,n+i,s?c:0),e.arcTo(t+r,n+i,t,n+i,s?c:0),e.arcTo(t,n+i,t,n,o?c:0),e.arcTo(t,n,t+r,n,o?c:0),e.closePath(),e.fill()}let he=null,ge=null,_e=null,ve=null,ye=0,M=-1,be=(0,t.ref)(!1),xe=(0,t.ref)(!1),Se=null,Ce=null,we=0,Te=!1,Ee=null,De=[];function Oe(e){return De.push(e),()=>{let t=De.indexOf(e);t>=0&&De.splice(t,1)}}function ke(e){let t=e.trim();return t?/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(t)?t:/^[w.-]+@([w-]+.)+[w-]{2,4}$/.test(t)?`mailto:${t}`:`https://${t}`:``}function Ae(e){try{let t=new URL(ke(e));return[`http:`,`https:`,`mailto:`,`univer-sheet:`].includes(t.protocol)}catch{return!1}}function je(){if(c.value)return;let e=ne,n=``;e&&!e.collapsed&&(n=(C.value?.getUniverDoc?.(p)?.getSnapshot()?.body?.dataStream||``).slice(e.startOffset,e.endOffset).replace(/[\r\n]+$/,``)),j.text=n,j.url=``,j.urlError=``,j.style=`text`,j.replace=!(!e||e.collapsed);let r=C.value?.getUniverDoc?.(p)?.getSnapshot()?.body?.dataStream?.length??0;j.startOffset=e?e.startOffset:Math.max(0,r-2),j.endOffset=e?e.endOffset:j.startOffset,j.segmentId=e?.segmentId||``,j.visible=!0,(0,t.nextTick)(()=>{j.text||w.value?.focus()})}function Me(){j.visible=!1}function Ne(e,t){return t===`text`?e:`${ZW}${e}`}function Pe(e,t,n,r){if(t===`card`){let i=`──查看`,a=` 📄${e}${i} `,o=a.indexOf(`📄`),s=o+2,c=a.indexOf(i),l={bg:{rgb:`#e4f9fbff`},fs:18,cl:{rgb:`#3370ff`}};return{dataStream:a,customRanges:[{startIndex:0,endIndex:a.length-1,rangeId:n,rangeType:3,wholeEntity:!0,properties:{url:r,text:e,style:t}}],textRuns:[{st:0,ed:1,ts:{...l}},{st:1,ed:2,ts:{...l}},{st:2,ed:o+2,ts:{...l}},{st:s,ed:c,ts:{...l,bl:!0}},{st:c,ed:a.length-1,ts:{...l,bl:!0}},{st:a.length-1,ed:a.length,ts:{...l}}]}}let i=Ne(e,t),a={startIndex:0,endIndex:i.length-1,rangeId:n,rangeType:0,properties:{url:r,text:e,style:t}},o={dataStream:i,customRanges:[a]};return t===`icon`&&(a.show=!1,o.textRuns=[{st:0,ed:i.length,ts:{cl:{rgb:`#3370ff`}}}]),o}async function Fe({text:e,url:t,style:n,startOffset:r,endOffset:i,segmentId:a,replace:o}){let s=`link-${Date.now()}-${Math.floor(Math.random()*1e4)}`,c=Pe(e,n,s,t);return await C.value?.executeCommand?.(`doc.command.insert-text`,{unitId:p,range:{startOffset:r,endOffset:i,collapsed:!o,segmentId:a},segmentId:a,body:c,cursorOffset:c.dataStream.length})?{rangeId:s,startIndex:r,endIndex:r+c.dataStream.length-1}:null}async function Ie(){if(!j.url.trim()){j.urlError=`请输入链接地址`;return}if(!Ae(j.url)){j.urlError=`链接格式不正确`;return}await Fe({text:(j.text.trim()||j.url.trim()).replace(/[\r\n]+/g,` `),url:ke(j.url),style:j.style,startOffset:j.startOffset,endOffset:j.endOffset,segmentId:j.segmentId,replace:j.replace})?(Me(),wt()):j.urlError=`插入失败,请重试`}let Le=Kdt.split(`,`).map(e=>e.slice(1)),Re={pdf:`📕`,doc:`📘`,docx:`📘`,zip:`📦`,rar:`📦`,"7z":`📦`,mp4:`🎬`,mov:`🎬`,webm:`🎬`,avi:`🎬`,mkv:`🎬`,mp3:`🎵`,wav:`🎵`,m4a:`🎵`,aac:`🎵`},ze=(0,t.ref)(null),Be=(0,t.ref)(!1),Ve=(0,t.ref)(``),He=null;function Ue(e){let t=String(e||``),n=t.lastIndexOf(`.`);return n>0?t.slice(n+1).toLowerCase():``}function We(e){return Re[Ue(e)]||`📎`}function Ge(e){return!Number.isFinite(e)||e<0?``:e<1024?`${e}B`:e<1048576?`${Number((e/1024).toFixed(1))}KB`:`${Number((e/1048576).toFixed(1))}MB`}function Ke(e,t=20){let n=String(e||``),r=Array.from(n);if(r.length<=t)return n;let i=n.lastIndexOf(`.`),a=i>0?n.slice(i):``,o=Array.from(a);return a&&o.length<=6?r.slice(0,Math.max(1,t-o.length-1)).join(``)+`…`+a:r.slice(0,Math.max(1,t-1)).join(``)+`…`}function qe(e){return!e||!Le.includes(Ue(e.name))?{ok:!1,error:`仅支持 PDF、Word、压缩包、视频、音频文件`}:e.size>qdt?{ok:!1,error:`文件大小不能超过 150MB`}:{ok:!0}}function Je(e,t,n,r){let i=We(e),a=Ke(String(e||``).replace(/[\u0000-\u001f\u007f]/g,` `)),o=Ge(t),s=`下载`,c=` ${i}${a} · ${o} ${s} `,l=c.indexOf(i)+2,u=l+a.length,d=c.lastIndexOf(s),f={bg:{rgb:zdt},fs:18,cl:{rgb:`#3370ff`}};return{dataStream:c,customRanges:[{startIndex:0,endIndex:c.length-1,rangeId:n,rangeType:3,wholeEntity:!0,properties:{attachment:!0,url:r,name:e,size:t}}],textRuns:[{st:0,ed:1,ts:{...f}},{st:1,ed:2,ts:{...f}},{st:2,ed:l,ts:{...f}},{st:l,ed:u,ts:{...f,bl:!0}},{st:u,ed:d,ts:{...f}},{st:d,ed:c.length-1,ts:{...f,bl:!0}},{st:c.length-1,ed:c.length,ts:{...f}}]}}async function Ye(e,t,n,r){if(typeof t==`function`)try{let n=await t(e),r=typeof n==`string`?n:n?.url||``;if(r)return{url:r}}catch{}if(e.size>n)return{error:`未配置附件上传服务,无法插入超过 2MB 的文件`};try{let t=await r(e);if(t)return{url:t}}catch{}return{error:`附件读取失败,请重试`}}function Xe(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result||``)),r.onerror=()=>n(r.error||Error(`read failed`)),r.readAsDataURL(e)})}async function Ze(e,t){if(!e||e.startsWith(`data:`)||typeof t!=`function`)return e;try{return await t(e)||e}catch{return e}}async function Qe(e,t,n){let{fetchImpl:r,doc:i,urlApi:a,defer:o=e=>setTimeout(e,400)}=n,s=``,c=e;if(!e.startsWith(`data:`)){let t=await r(e);if(!t.ok)throw Error(`附件下载失败(HTTP ${t.status})`);let n=await t.blob();s=a.createObjectURL(n),c=s}let l=i.createElement(`a`);l.href=c,l.download=t||`附件`,l.style.display=`none`,i.body.appendChild(l);try{l.click()}finally{l.remove(),s&&o(()=>a.revokeObjectURL(s))}}function $e(e){Ve.value=e,clearTimeout(He),He=setTimeout(()=>{Ve.value=``},4e3)}async function et(e){let t=e?.url||``;if(!t)return;let n=e?.name||`附件`;try{await Qe(await Ze(t,i.server?.resolveAttachment),n,{fetchImpl:(e,t)=>fetch(e,t),doc:document,urlApi:URL})}catch{$e(`附件下载失败,请稍后重试`)}}function tt(){et({url:ie.url,name:ie.fileName,size:ie.fileSize}),mt()}function nt(e){let t=i.server?.previewAttachment;if(typeof t!=`function`)return!1;try{return t({url:e?.url,name:e?.name,size:e?.size})===!0}catch{return!1}}function rt(){c.value||Be.value||ze.value?.click()}function it(e){let t=e?.target?.files?.[0];if(e?.target&&(e.target.value=``),t)return at(t)}async function at(e){let t=C.value;if(c.value||Be.value||!t||!e)return;let n=qe(e);if(!n.ok){$e(n.error);return}let r=p,a=t.getUniverDoc?.(r)?.getSnapshot(),o=ne?.segmentId||``,s=o?a?.headers?.[o]?.body||a?.footers?.[o]?.body:a?.body,l=s?.dataStream;if(!l)return;let u=ne?.startOffset??Math.max(0,l.length-2);Be.value=!0;try{let{url:n,error:d}=await Ye(e,i.server?.attachmentUpload,Jdt,Xe);if(!C.value)return;if(c.value||C.value!==t||p!==r||t.getUniverDoc?.(r)?.getSnapshot()!==a||s.dataStream!==l){$e(`文档已变更或切为只读,请重新插入附件`);return}if(!n){$e(d||`附件插入失败,请重试`);return}let f=`attachment-${Date.now()}-${Math.floor(Math.random()*1e4)}`,m=Je(e.name,e.size,f,n);await t.executeCommand?.(`doc.command.insert-text`,{unitId:r,range:{startOffset:u,endOffset:u,collapsed:!0,segmentId:o},segmentId:o,body:m,cursorOffset:m.dataStream.length})?wt():$e(`附件插入失败,请重试`)}catch{C.value&&$e(`附件插入失败,请重试`)}finally{Be.value=!1}}async function ot(){let e=C.value;if(c.value||!e)return;let t=p,n=e.getUniverDoc?.(t)?.getSnapshot(),r=ne?.segmentId||``,i=r?n?.headers?.[r]?.body||n?.footers?.[r]?.body:n?.body,a=i?.dataStream;if(!a)return;let o=Math.min(Math.max(0,ne?.startOffset??a.length-2),Math.max(0,a.length-2)),s=(i.paragraphs||[]).find(e=>e.startIndex>=o),l={startIndex:1};s?.bullet&&(l.bullet=JSON.parse(JSON.stringify(s.bullet))),s?.paragraphStyle&&(l.paragraphStyle=JSON.parse(JSON.stringify(s.paragraphStyle)),delete l.paragraphStyle.borderBottom);let u=(i.textRuns||[]).find(e=>o>e.st&&o<=e.ed),d={dataStream:`\f\r`,paragraphs:[l],...u?{textRuns:[{st:0,ed:2,ts:JSON.parse(JSON.stringify(u.ts))}]}:{}};await e.executeCommand?.(`doc.command.insert-text`,{unitId:t,range:{startOffset:o,endOffset:o,collapsed:!0,segmentId:r},segmentId:r,body:d,cursorOffset:d.dataStream.length})&&wt()}function st(e){return(C.value?.getUniverDoc?.(p)?.getSnapshot()?.body)?.customRanges?.find(t=>t.rangeId===e&&(t.rangeType===0||t.rangeType===3))||null}function ct(e){if(!e?.linkId){ut();return}if(dt(),ie.visible&&e.linkId===ie.linkId&&e.startIndex===ie.startIndex)return;let t=st(e.linkId);if(!t){lt();return}let n=(C.value?.getUniverDoc?.(p)?.getSnapshot()?.body?.dataStream||``).slice(t.startIndex,t.endIndex+1),r=t.properties||{};ie.url=r.url||``,ie.isAttachment=!!r.attachment,ie.fileName=r.name||``,ie.fileSize=r.size||0,ie.text=(r.text||n.replace(ZW,``)).replace(/[\s\u00A0\u2000-\u200B\u3000]+$/g,``),ie.style=r.style||`text`,ie.linkId=e.linkId,ie.segmentId=e.segmentId||``,ie.startIndex=t.startIndex,ie.endIndex=t.endIndex,ie.styleMenuOpen=!1,ie.copied=!1,ie.x=null,ie.y=null,ie.visible=!0,ae=e,ht()}function lt(){clearTimeout(oe),clearTimeout(se),se=null,ce=!1,ie.visible=!1,ie.styleMenuOpen=!1,ie.copied=!1}function ut(e=320){ce||(clearTimeout(se),se=setTimeout(()=>{se=null,lt()},e))}function dt(){clearTimeout(se),se=null}function ft(){ce=!0,dt()}function pt(){ce=!1,ut(160)}function mt(){lt(),C.value?.executeCommand?.(`doc.operation.toggle-hyper-link-info-popup`)}function ht(e=12){if(clearTimeout(oe),!ie.visible)return;let t=Array.from(document.querySelectorAll(`[data-u-comp="rect-popup"]`)).find(e=>e.querySelector(`.univer-max-w-80`))?.getBoundingClientRect();if(!t||t.left<-9e3||!t.width&&!t.height){e>0?oe=setTimeout(()=>ht(e-1),50):lt();return}ie.x=t.left+t.width/2,ie.y=Math.max(t.top,8)}function gt(){let e=ie.url;e.startsWith(Rdt)?a(`open-workbook`,e.slice(15)):e&&window.open(e,`_blank`,`noopener noreferrer`),mt()}async function _t(){let e=ie.url;try{if(navigator.clipboard?.writeText)await navigator.clipboard.writeText(e);else throw Error(`clipboard unavailable`)}catch{let t=document.createElement(`textarea`);t.value=e,t.style.cssText=`position:fixed;opacity:0`,document.body.appendChild(t),t.select();try{document.execCommand(`copy`)}catch{}t.remove()}ie.copied=!0,clearTimeout(le),le=setTimeout(()=>{ie.copied=!1},1200)}function vt(){c.value||(lt(),mt(),j.text=ie.text,j.url=ie.url,j.urlError=``,j.style=ie.style,j.replace=!0,j.startOffset=ie.startIndex,j.endOffset=ie.endIndex+1,j.segmentId=ie.segmentId,j.visible=!0)}async function yt(e){if(c.value||(ie.styleMenuOpen=!1,e===ie.style))return;let{text:t,url:n,segmentId:r,startIndex:i,endIndex:a}=ie,o=await Fe({text:t,url:n,style:e,startOffset:i,endOffset:a+1,segmentId:r,replace:!0});o&&(wt(),C.value?.executeCommand?.(`doc.operation.toggle-hyper-link-info-popup`,{...ae||{},unitId:p,linkId:o.rangeId,rangeId:o.rangeId,startIndex:o.startIndex,endIndex:o.endIndex}))}async function bt(){if(c.value)return;let{text:e,segmentId:t,startIndex:n,endIndex:r}=ie;await C.value?.executeCommand?.(`doc.command.insert-text`,{unitId:p,range:{startOffset:n,endOffset:r+1,collapsed:!1,segmentId:t},segmentId:t,body:{dataStream:e},cursorOffset:e.length})&&(mt(),wt())}function xt(){ie.styleMenuOpen&&=!1,ie.visible&&lt()}function St(){ie.visible&&lt(),clearTimeout(St._t),St._t=setTimeout(()=>{if(de)try{let e=C.value?.getUniverDoc?.(p)?.getSnapshot()?.body;if(!e?.customRanges)return;ue=[];for(let t of e.customRanges){if(t.rangeType!==0&&t.rangeType!==3)continue;let e=eI({startOffset:t.startIndex,endOffset:t.endIndex+1,collapsed:!1},de);e?.length&&ue.push({rangeId:t.rangeId,startIndex:t.startIndex,endIndex:t.endIndex,rects:e,style:t.properties?.style||`text`,text:t.properties?.text||``,url:t.properties?.url||``})}}catch{}},200)}let Ct=null;function wt(){clearTimeout(Ct),Ct=setTimeout(Tt,300)}function Tt(){let e=C.value?.getUniverDoc?.(p);if(!e)return;let t=e.getSnapshot()?.body;if(!t)return;let n=t.dataStream||``,r=t.paragraphs||[],i=[];for(let e=0;e<r.length;e++){let t=r[e],a=t.paragraphStyle?.namedStyleType,o=a==null?t.paragraphStyle?.headingLevel:a>=Gp.HEADING_1&&a<=Gp.HEADING_5?a-Gp.HEADING_1+1:0;if(!o)continue;let s=t.startIndex,c=n.lastIndexOf(`\r`,s-1)+1;for(;c<s&&n.charCodeAt(c)<32;)c++;let l=n.slice(c,s).replace(/[\u0000-\u001f]/g,``);l.trim()&&i.push({id:`h-${c}`,level:o,text:l,startIndex:c})}ee.value=i,te.paragraphs=r.length;let a=n.replace(/[\r\n]/g,``),o=(a.match(/[\u4e00-\u9fff]/g)||[]).length,s=(a.replace(/[\u4e00-\u9fff]/g,` `).match(/[A-Za-z0-9]+/g)||[]).length;te.words=o+s}function Et(e){if(e.id!==`doc.operation.click-hyper-link`)return;let{linkId:t}=e.params||{};if(!t)return;let n=(C.value?.getUniverDoc?.(p)?.getSnapshot()?.body)?.customRanges?.find(e=>e.rangeId===t);if(!n)return;if(n.properties?.attachment){nt(n.properties)||et(n.properties),e.cancel=!0;return}let r=n.properties?.url||``;if(r){if(r.startsWith(Rdt)){a(`open-workbook`,r.slice(15)),e.cancel=!0;return}n.rangeType===3&&Ae(r)&&(window.open(ke(r),`_blank`,`noopener,noreferrer`),e.cancel=!0)}}function Dt(){let e=C.value?.getUniverDoc?.(p),t=e?.getSnapshot()?.body?.dataStream||``;if(!e||!t)return!1;let n=Math.max(0,t.length-2);return e.setSelection(n,n),ne={startOffset:n,endOffset:n,segmentId:``,collapsed:!0},!0}function Ot(e){if(l&&!l.entered&&e.type===tG&&e.id===l.id&&e.params===l.params){l.entered=!0;return}if((o.value||l)&&e.type!==1||c.value&&e.type===tG){e.cancel=!0;return}if(i.collaboration?.onBeforeCommand&&!i.collaboration.onBeforeCommand(e.id,e.params)){e.cancel=!0;return}Et(e),!c.value&&e.id===`doc.operation.show-hyper-link-edit-popup`&&!e.params?.link&&(e.cancel=!0,je()),[`doc.operation.create-table`,`doc.command.create-table`,`doc.command.insert-float-image`].includes(e.id)&&!ne&&Dt()&&(e.cancel=!0,C.value?.executeCommand?.(e.id,{...e.params||{}}))}function kt(e){if(e.id!==`doc.operation.set-selections`&&e.id!==`doc.operation.toggle-hyper-link-info-popup`&&ye++,e.type===tG&&!l&&!e.options?.fromChangeset&&!e.options?.fromCollab)for(let t of De)try{t({id:e.id,params:e.params,type:e.type,timestamp:Date.now()})}catch{}if(e.id===`doc.operation.set-selections`){let t=e.params?.ranges?.[0];t&&(ne={startOffset:t.startOffset,endOffset:t.endOffset,segmentId:t.segmentId||e.params?.segmentId||``,collapsed:t.collapsed??t.startOffset===t.endOffset})}e.id===`doc.operation.toggle-hyper-link-info-popup`&&ct(e.params),wt()}function At(){if(!he)return null;let e=he.__getInjector(),t=e.get(B).getCurrentUnitOfType(1);if(!t)return null;let n=t.getSnapshot();if(!n?.body)return null;let r=n.body,i=r.textRuns||[],a=r.paragraphs||[],o=e.get(SE),s=o.getActiveTextRange?.()||v(o).find(e=>e.isActive)||v(o)[0];if(!s)return null;let{startOffset:c,endOffset:l,segmentId:u=``}=s;if(c==null||l==null)return null;let d={};if(c===l){for(let e of i)if(e.st<c&&e.ed>=c&&e.ts){d={...e.ts};break}}else for(let e of i)if(e.st<l&&e.ed>c&&e.ts){d={...e.ts};break}let f=[],p=c===l?Math.max(0,c-1):c;for(let e of a)e.startIndex>=p&&e.startIndex<=l&&e.paragraphStyle&&f.push({startIndex:e.startIndex,paragraphStyle:{...e.paragraphStyle}});return{textStyle:d,paragraphStyles:f,segmentId:u,startOffset:c,endOffset:l}}function jt(e){if(!he||!Se)return!1;let t=he.__getInjector(),n=t.get(z),r=t.get(B),{textStyle:i,paragraphStyles:a,segmentId:o}=Se,{startOffset:s,endOffset:c}=e;try{let e=r.getCurrentUnitOfType(1);if(!e)return!1;let l=e.getBody();if(!l)return!1;let u=v(t.get(SE)),d=(l.textRuns||[]).filter(e=>e.st<c&&e.ed>s),f={};d.length>0&&Object.assign(f,d[0].ts||{});let p=[`bl`,`it`,`ul`,`st`],m=[`fs`,`ff`,`cl`,`bg`];for(let t of p)if(i[t]!=null){let r=i[t],a=f[t],o=!1;o=t===`bl`||t===`it`?r!==a:r?.s!==a?.s,o&&_(n,e,u,t,r)}for(let e of m)if(i[e]!=null){let t=i[e],r=e===`fs`?`doc.command.set-inline-format-fontsize`:e===`ff`?`doc.command.set-inline-format-font-family`:e===`cl`?`doc.command.set-inline-format-text-color`:`doc.command.set-inline-format-text-background-color`;(e===`cl`||e===`bg`)&&(t=t?.rgb||t),n.executeCommand(`doc.command.set-inline-format`,{preCommandId:r,value:t})}if(a.length>0){let t=l?.paragraphs||[];for(let r of t)if(r.startIndex>=s&&r.startIndex<=c){let i=a[0];if(i?.paragraphStyle){let a=t.indexOf(r);if(a>=0){let t=[`body`,`paragraphs`,a,`paragraphStyle`],s=r.paragraphStyle||{},c={...s,...i.paragraphStyle},l=Dv.getInstance().replaceOp(t,s,c);n.syncExecuteCommand(`doc.mutation.rich-text-editing`,{unitId:e.getUnitId(),actions:l,textRanges:null,segmentId:o})}}}}return!0}catch(e){return console.warn(`[FormatPainter] apply style failed:`,e),!1}}function Mt(){be.value=!1,xe.value=!1,Se=null,we=0,Ee=null,Ce&&=(Ce.dispose(),null)}function Nt(e){e.key===`Escape`&&be.value&&Mt()}function Pt(e){if(!be.value||!Se||Te)return;let t=(e&&(e.textRanges||e.ranges)||[]).find(e=>e&&e.startOffset!=null&&e.endOffset!=null&&e.startOffset!==e.endOffset);if(!t)return;let n=Ee;if(n&&n.startOffset===t.startOffset&&n.endOffset===t.endOffset&&(n.segmentId||``)===(t.segmentId||``))return;Ee={startOffset:t.startOffset,endOffset:t.endOffset,segmentId:t.segmentId||``},Te=!0;let r=!1;try{r=jt({startOffset:t.startOffset,endOffset:t.endOffset,segmentId:t.segmentId||``})}finally{Te=!1}r&&!xe.value&&setTimeout(()=>Mt(),100)}function Ft(){if(!S.value||C.value)return;let{univer:e,univerAPI:t}=Ree({locale:vp.ZH_CN,locales:{[vp.ZH_CN]:_dt([Sot,Cct,ilt,Qlt])},presets:[vot({container:S.value,ribbonType:`simple`}),bct(),rlt(),Ylt()]});E=Xut({univer:e,univerAPI:t,comment:i.server?.comment});try{e.__getInjector().get(Om).setConfig(`menu`,{"doc.operation.show-hyper-link-edit-popup":{disabled:!1}},{merge:!0})}catch{}t.createUniverDoc({id:p,title:``,documentStyle:{pageSize:{width:794,height:1123},marginTop:72,marginBottom:72,marginLeft:80,marginRight:80},tableSource:{},drawings:{},drawingsOrder:[],body:{dataStream:`\r
605
+ `,textRuns:[],tables:[],sectionBreaks:[],paragraphs:[{startIndex:0,paragraphStyle:{spaceAbove:{v:0},lineSpacing:1.15,spaceBelow:{v:8}}}]}});try{e.__getInjector().get(B).focusUnit(p)}catch{}he=e,C.value=t,D||=sdt({univer:e,univerAPI:t,getUnitId:()=>p}),D&&!O&&(O=mdt({univer:e,univerAPI:t,kind:`doc`})),Vt(),Wt(),x(),T||=KW({univer:e,server:i.server}),A&&!k.value&&(k.value={getData:It,setData:Bt,getVersion:Lt,isDirty:Rt,setRestoreState:u,replayMutation:Ht,canPersist:()=>i.type!==`view`,ready:()=>!!C.value,getUniverInstance:()=>he,getUniverAPI:()=>C.value,onMutation:Oe}),t.addEvent(t.Event.CommandExecuted,kt),t.addEvent(t.Event.BeforeCommandExecute,Ot),window.addEventListener(`pointerdown`,xt),window.addEventListener(`scroll`,St,!0),window.addEventListener(`resize`,St),window.addEventListener(`keydown`,Nt),Tt();async function n(){try{let t=e.__getInjector().get(z),n=e.__getInjector().get(Ij);t.registerCommand({id:QW,type:R.COMMAND,handler(){let t=Date.now();if(be.value)return t-we<=Udt&&(xe.value=!0,we=t,console.log(`[FormatPainter] 锁定模式(可连续刷多处,Esc 退出)`)),!0;let n=At();if(!n)return console.warn(`[FormatPainter] 无法读取样式,请先选中文字`),!1;Se=n,be.value=!0,xe.value=!1,we=t,Ee={startOffset:n.startOffset,endOffset:n.endOffset,segmentId:n.segmentId||``};let r=e.__getInjector().get(SE).textSelection$.subscribe(e=>{Pt(e)});return Ce={dispose:()=>r.unsubscribe()},console.log(`[FormatPainter] 已激活(单击=刷一次,双击=连续刷),选中目标文字应用样式`),!0}}),n.mergeMenu({ribbon:{"ribbon.home":{"ribbon.home.format":{[QW]:{order:99,menuItemFactory:()=>({id:QW,type:zj.BUTTON,title:`格式刷`,tooltip:`格式刷`,icon:`BrushIcon`})}}}}})}catch(e){console.warn(`[FormatPainter] 命令注册失败:`,e)}}n();async function r(){try{let t=e.__getInjector().get(z),n=e.__getInjector().get(Ij),r=C.value?.getComponentManager?.();if(r){let e=await Promise.resolve().then(()=>f(jE())),t=t=>n=>e.createElement(`svg`,{viewBox:`0 0 24 24`,width:`1em`,height:`1em`,fill:`currentColor`,...n},e.createElement(`path`,{d:t})),n=typeof r.has==`function`?e=>r.has(e):()=>!1;n(`HxyPageBreakIcon`)||r.register(`HxyPageBreakIcon`,t(Wdt)),n(`HxyAttachIcon`)||r.register(`HxyAttachIcon`,t(Gdt))}t.registerCommand({id:$W,type:R.COMMAND,handler(){return ot(),!0}}),t.registerCommand({id:eG,type:R.COMMAND,handler(){return rt(),!0}}),n.mergeMenu({ribbon:{"ribbon.home":{"ribbon.home.format":{[$W]:{order:100,menuItemFactory:()=>({id:$W,type:zj.BUTTON,title:`分页符`,tooltip:`在光标处插入分页符`,icon:`HxyPageBreakIcon`})},[eG]:{order:101,menuItemFactory:()=>({id:eG,type:zj.BUTTON,title:`附件`,tooltip:`上传本地文件为附件卡片`,icon:`HxyAttachIcon`})}}}}})}catch(e){console.warn(`[InsertToolbar] 插入按钮注册失败:`,e)}}r(),Kt(1e3)}function It(){let e=C.value?.getUniverDoc?.(p)?.getSnapshot?.();return e?.body?.dataStream?(M=ye,{type:`univer-doc`,unitId:p,version:ye,savedAt:Date.now(),data:JSON.parse(JSON.stringify(e))}):null}function Lt(){return ye}function Rt(){return ye!==M}function zt(e){let t=/[\u000E\u000F\u001A\u001B\u001C\u001D]/,n=e.dataStream;if(typeof n!=`string`||!t.test(n))return null;let r=[],i=0,a=0,o=``,s=0,c=[];for(let e=0;e<n.length;e++){let t=n.charCodeAt(e);if(t===13)r.length>0&&r[r.length-1]&&r.pop();else if(t===26)r.push(!1);else if(t===27)i++;else if(t===28)a++;else if(t===29){if(i===0||a===0){c.push(e),s++;continue}a--}else if(t===14){if(i===0||r.length===0){c.push(e),s++;continue}i--}else if(t===15){if(r.length===0){c.push(e),s++;continue}r[r.length-1]=!0}o+=n[e]}if(!s)return null;let l=e=>{if(typeof e!=`number`)return e;let t=0;for(;t<c.length&&e>c[t];)t++;return e-t},u={dataStream:o};for(let t of[`paragraphs`,`sectionBreaks`,`customRanges`,`tables`])Array.isArray(e[t])&&(u[t]=e[t].map(e=>{let t={...e};return typeof t.startIndex==`number`&&(t.startIndex=l(t.startIndex)),typeof t.endIndex==`number`&&(t.endIndex=l(t.endIndex)),t}));return Array.isArray(e.textRuns)&&(u.textRuns=e.textRuns.map(e=>({...e,st:l(e.st),ed:l(e.ed)}))),u}function Bt(e){let t=e?.type===`univer-doc`?e.data:e;if(!t?.body?.dataStream)return!1;let n=t,r=zt(t.body);r&&(n={...n,body:{...n.body,...r}});let i=n.body.dataStream;typeof i==`string`&&i.length>0&&!i.endsWith(`
606
+ `)&&(n={...n,body:{...n.body,dataStream:`${i.endsWith(`\r`)?i:i+`\r`}\n`}});let a=C.value;if(!a)return!1;try{lt()}catch{}try{a.executeCommand?.(`doc.operation.toggle-hyper-link-info-popup`)}catch{}ge?.abort(),ge=null,_e?.dispose?.(),_e=null;try{a.disposeUnit?.(p)}catch{}let o=n.id||p;a.createUniverDoc({...JSON.parse(JSON.stringify(n)),id:o}),p=o,Vt(),ye++,ne=null,ue=[];try{he?.__getInjector?.()?.get(B)?.focusUnit(p)}catch{}return Kt(300),Wt(),wt(),!0}function Vt(){try{let e=(he?.__getInjector?.()?.get(B)?.getUniverDocInstance?.(p))?.getSnapshot?.(),t=e?.body;if(!t)return;t.textRuns??=[],t.tables??=[],t.sectionBreaks??=[],e.tableSource??={};let n=t.dataStream;if(typeof n==`string`&&n.length){t.paragraphs??=[];let e=t.paragraphs,r=new Set;for(let t of e)r.add(t?.startIndex);let i=!1;for(let t=0;t<n.length;t++)n.charCodeAt(t)===13&&!r.has(t)&&(e.push({startIndex:t}),i=!0);i&&e.sort((e,t)=>e.startIndex-t.startIndex)}}catch{}}function Ht(e,t){if(!o.value||l)throw Error(`当前不允许回放`);let n=C.value,r=he?.__getInjector?.()?.get(B)?.getUniverDocInstance?.(p);if(!n||!r||t?.unitId!==p)throw Error(`回放文档不匹配`);let i={...JSON.parse(JSON.stringify(t)),noHistory:!0,isSync:!0,noNeedSetTextRange:!0};l={id:e,params:i,entered:!1};try{r.setDisabled(!1);let t=n.syncExecuteCommand(e,i,{onlyLocal:!0,fromChangeset:!0});return l.entered?e===`doc.mutation.rich-text-editing`?t?.unitId===p&&Array.isArray(t.actions)&&(Dv.isNoop(i.actions)||!Dv.isNoop(t.actions)):t===!0:!1}finally{l=null,r.setDisabled(c.value)}}function Ut(e){let t={applied:0,skipped:0,failed:[]};if(!Array.isArray(e)||!e.length)return t;let n=C.value;if(!n)return t.failed=e.map(e=>({commandId:e?.commandId,message:`编辑器未就绪`})),t;for(let r of e){let e=r?.commandId;if(e){if(typeof e==`string`&&e.startsWith(`sheet.mutation.`)){t.skipped++;continue}try{let i=JSON.parse(JSON.stringify(r.params??{}));if(i.unitId&&i.unitId!==p)throw Error(`回放文档不匹配`);l={id:e,params:i,entered:!1};try{if(n.syncExecuteCommand(e,i,{onlyLocal:!0,fromChangeset:!0}),!l.entered)throw Error(`命令未执行`)}finally{l=null}t.applied++}catch(n){t.failed.push({commandId:e,message:n&&n.message||String(n)})}}}return t}function Wt(){try{(he?.__getInjector?.()?.get(B)?.getUniverDocInstance?.(p))?.setDisabled?.(c.value)}catch{}}function Gt(e,t,n){if(c.value||!Number.isFinite(n)||n<40)return!1;let r=(C.value?.getUniverDoc?.(p)?.getSnapshot())?.tableSource?.[e]?.tableColumns?.[t]?.size?.width?.v;if(!Number.isFinite(r)||r===n)return!1;let i=Dv.getInstance().replaceOp([`tableSource`,e,`tableColumns`,t,`size`,`width`,`v`],r,n);return!!C.value.syncExecuteCommand(`doc.mutation.rich-text-editing`,{unitId:p,actions:i,trigger:`pd-doc.table-resize`,noNeedSetTextRange:!0,debounce:!1})?.actions?.length}function Kt(e=1e3){setTimeout(()=>{if(!he)return;let t=he.__getInjector().get(fE).getRenderById(p),n=S.value?.querySelector(`canvas`);if(!t||!n){if(e<2e3){Kt(e+400);return}console.warn(`[canvas-features] render/canvas not ready`);return}if(de=t,!fe)try{let e=t.with(CE)?.getSkeleton();if(e){let t=e,n=null;for(;t;){let e=Object.getPrototypeOf(t);if(!e)break;if(e.draw&&e.isSkipByDiffBounds){n=e;break}t=e}if(n){let e=n.draw;if(!e.__cardBgPatch){let t=function(t,n){let r=null,i=null,a=null;try{let e=this.getSkeleton?.(),t=e?.getSkeletonData?.();if(t?.pages?.length){let n=((e.getViewModel?.())?.getDataModel?.())?.getBody?.();if(n?.customRanges){r=new Set,i=new Set,a=new Set;for(let e of n.customRanges)if(e.rangeType===3){for(let t=e.startIndex;t<=e.endIndex;t++)r.add(t);i.add(e.startIndex),a.add(e.endIndex)}if(r.size>0){let e=0;for(let n of t.pages)for(let t of n.sections)for(let n of t.columns)for(let t of n.lines)for(let n of t.divides)for(let t of n.glyphGroup)t.content&&r.has(e)&&(t.ts&&!t.ts.bg&&(t.ts.bg={rgb:zdt}),t._isCardGlyph=!0,i.has(e)&&(t._cardRoundLeft=!0),a.has(e)&&(t._cardRoundRight=!0)),e+=t.count||1}}}if(r?.size>0){let e=this.getExtensionByKey?.(`DefaultDocsBackgroundExtension`);if(e&&!e.__cardPaddingPatched){let t=e.draw.bind(e);e.draw=function(e,n,r){if(r._isCardGlyph){let t=r.parent?.parent;if(t&&r.ts?.bg){let{contentHeight:n=0}=t,i=Ih(r.ts.bg),a=this.extensionOffset?.spanStartPoint;if(i&&a&&r.content!==`\r`){e.fillStyle=i,me(e,a.x-1,a.y-Vdt,r.width+2,n+Vdt+Hdt,Bdt,!!r._cardRoundLeft,!!r._cardRoundRight);return}}}return t(e,n,r)},e.__cardPaddingPatched=!0}}}catch{}return e.call(this,t,n)};t.__cardBgPatch=!0,n.draw=t,fe=!0,console.log(`[card-bg-patch] Documents.draw patched ✓`)}}}}catch(e){console.warn(`[card-bg-patch] failed to apply:`,e)}if(!pe)try{let e=QP.prototype.refresh;if(!e.__cardSelectionPatch){let t=function(){e.call(this);try{if(!this._rangeShape)return;let e=(this._docSkeleton?.getViewModel?.())?.getDataModel?.()?.getBody?.();if(!e?.customRanges)return;let t=this.startOffset,n=this.endOffset;if(t==null||n==null)return;for(let r of e.customRanges)if(r.rangeType===3&&t<=r.endIndex&&n>=r.startIndex){this._rangeShape.hide();return}}catch{}};t.__cardSelectionPatch=!0,QP.prototype.refresh=t,pe=!0,console.log(`[card-selection-patch] TextRange.refresh patched ✓`)}}catch(e){console.warn(`[card-selection-patch] failed to apply:`,e)}ge?.abort(),_e?.dispose?.();let r=new AbortController;ge=r;let i={signal:r.signal};try{let e=t.with(rI);if(e){let t=e._buildCustomRangeBoundsBySegment;typeof t==`function`&&!t.__instHoverFixed&&(e._buildCustomRangeBoundsBySegment=function(e,n=-1){return t.call(this,e??``,n)},e._buildCustomRangeBoundsBySegment.__instHoverFixed=!0)}function a(){ue=[];try{let e=C.value?.getUniverDoc?.(p)?.getSnapshot()?.body;if(!e?.customRanges)return;for(let n of e.customRanges){if(n.rangeType!==0&&n.rangeType!==3)continue;let e=eI({startOffset:n.startIndex,endOffset:n.endIndex+1,collapsed:!1},t);e?.length&&ue.push({rangeId:n.rangeId,startIndex:n.startIndex,endIndex:n.endIndex,rects:e,style:n.properties?.style||`text`,text:n.properties?.text||``,url:n.properties?.url||``})}console.log(`[hover-patch] link rects computed: ${ue.length} links found`)}catch(e){console.warn(`[hover-patch] recomputeLinkRects failed:`,e)}}a(),_e=C.value?.addEvent?.(C.value?.Event?.CommandExecuted,()=>{clearTimeout(ve),ve=setTimeout(a,150)}),n&&(n.addEventListener(`mousemove`,e=>{if(!ue.length)return;n.getBoundingClientRect();let t=e.clientX,r=e.clientY,i=null;for(let e of ue){for(let n of e.rects)if(t>=n.left&&t<=n.right&&r>=n.top&&r<=n.bottom){i=e;break}if(i)break}if(i){if(dt(),ie.visible&&i.rangeId===ie.linkId)return;let e=st(i.rangeId);if(!e)return;let t=(C.value?.getUniverDoc?.(p)?.getSnapshot()?.body?.dataStream||``).slice(e.startIndex,e.endIndex+1),n=e.properties||{};ie.url=n.url||``,ie.isAttachment=!!n.attachment,ie.fileName=n.name||``,ie.fileSize=n.size||0,ie.text=(n.text||t.replace(ZW,``)).replace(/[\s\u00A0\u2000-\u200B\u3000]+$/g,``),ie.style=n.style||`text`,ie.linkId=i.rangeId,ie.segmentId=``,ie.startIndex=i.startIndex,ie.endIndex=i.endIndex,ie.styleMenuOpen=!1,ie.copied=!1;let r=i.rects.reduce((e,t)=>e.top<t.top?e:t),a=i.rects[Math.floor(i.rects.length/2)];ie.x=(a.left+a.right)/2,ie.y=Math.max(r.top-4,40),ie.visible=!0,ae={unitId:p,linkId:i.rangeId,segmentId:``,segmentPage:-1,rangeId:i.rangeId,startIndex:i.startIndex,endIndex:i.endIndex},C.value?.executeCommand?.(`doc.operation.toggle-hyper-link-info-popup`,ae)}else ie.visible&&ut()},i),console.log(`[hover-patch] DOM mousemove hover detection active ✓`))}catch(e){console.warn(`[hover-patch] self-implemented hover detection failed:`,e)}try{let e=null;function o(){let e=t.with(CE).getSkeleton()?.getSkeletonData();if(!e)return[];let n=[],{scene:r,engine:i}=t,{scaleX:a}=r.getAncestorScale(),o=r.getViewport(`viewMain`)?.viewportScrollX||0,s=i.getCanvasElement().getBoundingClientRect(),c=parseFloat(i.getCanvasElement().style.width)||s.width,l=s.width/c,{docsLeft:u}=t.mainComponent.getOffsetConfig(),d=e.pages[0]?.marginLeft||0,f=e=>(e-o+u*a)*l+s.left;for(let r of e.pages)for(let e of r.skeTables.values()){let r=d+e.left,i=r,o=[],c=(C.value?.getUniverDoc?.(p)?.getSnapshot())?.tableSource?.[e.tableId]?.tableColumns||[];if(c.length>0)for(let t=0;t<c.length;t++)i+=c[t].size.width.v,o.push({x:i,colIndex:t,tableId:e.tableId,colWidth:c[t].size.width.v});else for(let t of e.rows){let n=r;for(let r=0;r<t.cells.length;r++)n+=t.cells[r].pageWidth,o.push({x:n,colIndex:r,tableId:e.tableId,colWidth:t.cells[r].pageWidth});break}let u=1/0,m=-1/0;try{let n=eI({startOffset:e.st,endOffset:e.ed,collapsed:!1},t);if(n&&n.length>0)for(let e of n)u=Math.min(u,e.top),m=Math.max(m,e.bottom)}catch{}u===1/0&&(u=s.top,m=s.bottom);for(let e of o)n.push({screenX:f(e.x),screenTop:u,screenBottom:m,colIndex:e.colIndex,tableId:e.tableId,colWidth:e.colWidth,tableDocLeft:r,scaleCombined:a*l})}return n}n.addEventListener(`pointermove`,t=>{if(c.value||e)return;let r=o(),i=null;for(let e of r)if(t.clientY>=e.screenTop-6&&t.clientY<=e.screenBottom+6&&Math.abs(t.clientX-e.screenX)<=6){i=e;break}n.style.cursor=i?`col-resize`:``},i),n.addEventListener(`pointerdown`,t=>{if(c.value)return;let r=o(),i=null;for(let e of r)if(t.clientY>=e.screenTop-6&&t.clientY<=e.screenBottom+6&&Math.abs(t.clientX-e.screenX)<=6){i=e;break}i&&(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),n.style.cursor=`col-resize`,n.style.touchAction=`none`,e={tableId:i.tableId,colIndex:i.colIndex,startX:t.clientX,startWidth:i.colWidth,scaleCombined:i.scaleCombined})},{...i,capture:!0}),window.addEventListener(`pointermove`,t=>{e&&t.preventDefault()},i),window.addEventListener(`pointerup`,t=>{if(!e)return;let r=(t.clientX-e.startX)/e.scaleCombined,i=Math.max(40,Math.round(e.startWidth+r));try{Gt(e.tableId,e.colIndex,i),clearTimeout(ve),ve=setTimeout(a,300)}catch(e){console.warn(`[table-resize] apply failed:`,e)}e=null,n.style.cursor=``,n.style.touchAction=``},i),console.log(`[table-resize] column drag-resize active ✓`)}catch(e){console.warn(`[table-resize] init failed:`,e)}},e)}return(0,t.watch)(()=>i.visible,e=>{e?setTimeout(Ft,100):mt()},{immediate:!0}),(0,t.watch)(()=>i.type,()=>{C.value&&Wt()}),(0,t.watch)(()=>i.server?.comment?.user,e=>E?.setUser?.(e)),(0,t.onUnmounted)(()=>{clearTimeout(Ct),clearTimeout(oe),clearTimeout(se),clearTimeout(le),clearTimeout(ve),clearTimeout(He),ge?.abort(),_e?.dispose?.(),window.removeEventListener(`pointerdown`,xt),window.removeEventListener(`scroll`,St,!0),window.removeEventListener(`resize`,St),window.removeEventListener(`keydown`,Nt),Mt(),T?.dispose?.(),T=null,E?.dispose?.(),E=null,D?.dispose?.(),D=null,O?.dispose?.(),O=null,C.value?.dispose?.(),C.value=null}),n({getData:It,setData:Bt,getVersion:Lt,isDirty:Rt,ready:()=>!!C.value,getUniverInstance:()=>he,getUniverAPI:()=>C.value,onMutation:Oe,replayRemoteMutations:Ut,persistence:A,applyRemoteComment:e=>E?E.applyRemote(e):qW(C.value,e)}),(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,ydt,[(0,t.createElementVNode)(`div`,bdt,[(0,t.createElementVNode)(`div`,xdt,[(0,t.createElementVNode)(`div`,{ref_key:`containerRef`,ref:S,class:`doc-editor`},null,512),c.value&&C.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Sdt,[s.value?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[(0,t.createTextVNode)(`恢复失败:`+(0,t.toDisplayString)(s.value)+` `,1),(0,t.createElementVNode)(`button`,{onClick:d},`重试`)],64)):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[(0,t.createTextVNode)((0,t.toDisplayString)(o.value?`正在恢复文档…`:`🔒 只读模式`),1)],64))])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`input`,{ref_key:`attachmentInputRef`,ref:ze,class:`attachment-file-input`,type:`file`,accept:Kdt,onChange:it},null,544),Be.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Cdt,`附件上传中…`)):Ve.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,wdt,(0,t.toDisplayString)(Ve.value),1)):(0,t.createCommentVNode)(``,!0),j.visible?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:3,class:`link-dialog-mask`,onClick:(0,t.withModifiers)(Me,[`self`])},[(0,t.createElementVNode)(`div`,Tdt,[n[8]||=(0,t.createElementVNode)(`div`,{class:`link-dialog-title`},`插入链接`,-1),(0,t.createElementVNode)(`div`,Edt,[n[6]||=(0,t.createElementVNode)(`label`,{class:`field-label`},`文字`,-1),(0,t.withDirectives)((0,t.createElementVNode)(`input`,{"onUpdate:modelValue":n[0]||=e=>j.text=e,class:`field-input`,type:`text`,placeholder:`链接显示的文字(留空则显示链接地址)`,onKeydown:(0,t.withKeys)(Ie,[`enter`])},null,544),[[t.vModelText,j.text]])]),(0,t.createElementVNode)(`div`,Ddt,[n[7]||=(0,t.createElementVNode)(`label`,{class:`field-label`},`链接地址`,-1),(0,t.withDirectives)((0,t.createElementVNode)(`input`,{ref_key:`linkUrlInputRef`,ref:w,"onUpdate:modelValue":n[1]||=e=>j.url=e,class:(0,t.normalizeClass)([`field-input`,{error:j.urlError}]),type:`text`,placeholder:`https:// 或 univer-sheet://wb-progress`,onInput:n[2]||=e=>j.urlError=``,onKeydown:(0,t.withKeys)(Ie,[`enter`])},null,34),[[t.vModelText,j.url]]),j.urlError?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Odt,(0,t.toDisplayString)(j.urlError),1)):(0,t.createCommentVNode)(``,!0)]),(0,t.createElementVNode)(`div`,kdt,(0,t.toDisplayString)(j.replace?`将替换选中的文字或原链接`:`将在光标处插入`)+` · 支持 univer-sheet:// 内链跳转表格 · 插入后悬停可改样式 `,1),(0,t.createElementVNode)(`div`,Adt,[(0,t.createElementVNode)(`button`,{class:`dialog-btn cancel`,onClick:Me},`取 消`),(0,t.createElementVNode)(`button`,{class:`dialog-btn confirm`,disabled:!j.url.trim(),onClick:Ie},`确 定`,8,jdt)])])])):(0,t.createCommentVNode)(``,!0),((0,t.openBlock)(),(0,t.createBlock)(t.Teleport,{to:`body`},[ie.visible&&ie.x!==null?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:`link-hover-bar`,style:(0,t.normalizeStyle)({left:ie.x+`px`,top:ie.y+`px`}),onPointerdown:n[5]||=(0,t.withModifiers)(()=>{},[`stop`]),onMouseenter:ft,onMouseleave:pt},[(0,t.createElementVNode)(`span`,{class:`hover-label`,onClick:n[3]||=e=>ie.isAttachment?tt():gt()},(0,t.toDisplayString)(ie.isAttachment?`下载`:`打开链接`),1),ie.isAttachment?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[n[13]||=(0,t.createElementVNode)(`i`,{class:`hover-sep`},null,-1),(0,t.createElementVNode)(`button`,{class:`hover-icon-btn`,title:`复制`,onClick:_t},[n[9]||=(0,t.createElementVNode)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[(0,t.createElementVNode)(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`}),(0,t.createElementVNode)(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})],-1),ie.copied?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Mdt,`已复制`)):(0,t.createCommentVNode)(``,!0)]),c.value?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[(0,t.createElementVNode)(`button`,{class:`hover-icon-btn`,title:`编辑`,onClick:vt},[...n[10]||=[(0,t.createElementVNode)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[(0,t.createElementVNode)(`path`,{d:`M17 3a2.83 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z`})],-1)]]),(0,t.createElementVNode)(`div`,Ndt,[(0,t.createElementVNode)(`button`,{class:`hover-icon-btn`,title:`切换样式`,onClick:n[4]||=e=>ie.styleMenuOpen=!ie.styleMenuOpen},[...n[11]||=[(0,t.createElementVNode)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[(0,t.createElementVNode)(`path`,{d:`m6 9 6 6 6-6`})],-1)]]),ie.styleMenuOpen?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Pdt,[((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(re,e=>(0,t.createElementVNode)(`div`,{key:e.value,class:(0,t.normalizeClass)([`hover-style-item`,{active:e.value===ie.style}]),onClick:t=>yt(e.value)},[(0,t.createElementVNode)(`span`,Idt,(0,t.toDisplayString)(e.value===ie.style?`✓`:``),1),(0,t.createElementVNode)(`span`,Ldt,(0,t.toDisplayString)(e.label),1)],10,Fdt)),64))])):(0,t.createCommentVNode)(``,!0)]),(0,t.createElementVNode)(`button`,{class:`hover-icon-btn hover-unlink-btn`,title:`取消链接`,onClick:bt},[...n[12]||=[(0,t.createElementVNode)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[(0,t.createElementVNode)(`path`,{d:`M15 7h3a5 5 0 0 1 0 10h-3m-6 0H6a5 5 0 0 1 0-10h3`}),(0,t.createElementVNode)(`line`,{x1:`2`,y1:`2`,x2:`22`,y2:`22`})],-1)]])],64))],64)),n[14]||=(0,t.createElementVNode)(`div`,{class:`hover-bar-arrow`},null,-1)],36)):(0,t.createCommentVNode)(``,!0)]))])])]))}},[[`__scopeId`,`data-v-8ea611a2`]]);function Xdt(e,t,n){var r;if(t.t)return t.t;if(t.v===null)return null;let i=e.getStyleByCell(t),a=e.getStyleByCell(n);if(n.t===Mp.FORCE_STRING){var o;if(!_h(a==null||(o=a.n)==null?void 0:o.pattern)&&t.v!==void 0){if(Tg(t.v))return Mp.NUMBER;if(Zd(`${t.v}`))return Mp.BOOLEAN}return Mp.FORCE_STRING}if(Qdt(i)){var s;return _h(i==null||(s=i.n)==null?void 0:s.pattern)?Mp.STRING:Zdt(t,n)}return _h(a==null||(r=a.n)==null?void 0:r.pattern)?Mp.STRING:Zdt(t,n)}function Zdt(e,t){return e.v===void 0?nG(t.v,t.t):nG(e.v,e.t)}function Qdt(e){var t;return!!(e!=null&&(t=e.n)!=null&&t.pattern)}function nG(e,t){return e===null?null:typeof e==`string`?Tg(e)?(+e==0||+e==1)&&t===Mp.BOOLEAN?Mp.BOOLEAN:t!==Mp.STRING&&t!==Mp.FORCE_STRING&&Ff(e)?Mp.FORCE_STRING:Mp.NUMBER:Zd(e)?Mp.BOOLEAN:Mp.STRING:typeof e==`number`?(e===0||e===1)&&t===Mp.BOOLEAN?Mp.BOOLEAN:Mp.NUMBER:typeof e==`boolean`?Mp.BOOLEAN:Mp.FORCE_STRING}function $dt(e,t){let{unitId:n}=t,r=n?e.getUnit(n,N.UNIVER_SHEET):e.getCurrentUnitOfType(N.UNIVER_SHEET);return r?{workbook:r,unitId:r.getUnitId()}:null}function rG(e,t={}){let{unitId:n,subUnitId:r}=t,i=n?e.getUnit(n,N.UNIVER_SHEET):e.getCurrentUnitOfType(N.UNIVER_SHEET);if(!i)return null;let a=r?i.getSheetBySheetId(r):i.getActiveSheet(!0);return a?{worksheet:a,workbook:i,unitId:i.getUnitId(),subUnitId:a.getSheetId()}:null}function iG(e,t){let{unitId:n,subUnitId:r}=t,i=e.getUnit(n,N.UNIVER_SHEET);if(!i)return null;let a=i.getSheetBySheetId(r);return a?{worksheet:a,workbook:i}:null}var aG=(e,t)=>{if(!iG(e.get(B),t))throw Error(`Workbook or worksheet is null error!`);return{unitId:t.unitId,subUnitId:t.subUnitId,ranges:I.deepClone(t.ranges)}},oG={id:`sheet.mutation.add-worksheet-merge`,type:R.MUTATION,handler:(e,t)=>{let n=iG(e.get(B),t);if(!n)throw Error(`Workbook or worksheet is null error!`);let{worksheet:r}=n,i=r.getConfig().mergeData,a=t.ranges;for(let e=0;e<a.length;e++)i.push(a[e]);return r.getSpanModel().rebuild(i),!0}},sG={CELL_CONTENT:xf(`CELL_CONTENT`),ROW_FILTERED:xf(`ROW_FILTERED`)},cG=function(e){return e[e.DATA_VALIDATION=9]=`DATA_VALIDATION`,e[e.NUMFMT=10]=`NUMFMT`,e[e.CELL_IMAGE=11]=`CELL_IMAGE`,e}({}),eft=`sheet.interceptor.range-theme-id`,tft=`sheet.interceptor.ignore-range-theme`;function lG(e){"@babel/helpers - typeof";return lG=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},lG(e)}function nft(e,t){if(lG(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(lG(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function rft(e){var t=nft(e,`string`);return lG(t)==`symbol`?t:t+``}function Z(e,t,n){return(t=rft(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function uG(e,t){return function(n,r){t(n,r,e)}}function dG(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var fG=xf(`BEFORE_CELL_EDIT`),pG=xf(`AFTER_CELL_EDIT`),mG=xf(`VALIDATE_CELL`),hG=class extends F{constructor(e){super(),this._univerInstanceService=e,Z(this,`_interceptorsByName`,new Map),Z(this,`_commandInterceptors`,[]),Z(this,`_rangeInterceptors`,[]),Z(this,`_autoHeightInterceptors`,[]),Z(this,`_beforeCommandInterceptor`,[]),Z(this,`_afterCommandInterceptors`,[]),Z(this,`_workbookDisposables`,new Map),Z(this,`_worksheetDisposables`,new Map),Z(this,`_composedInterceptorByKey`,new Map),Z(this,`_composedInterceptorVersion`,0),Z(this,`writeCellInterceptor`,new Cf({BEFORE_CELL_EDIT:fG,AFTER_CELL_EDIT:pG,VALIDATE_CELL:mG})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(N.UNIVER_SHEET).subscribe(e=>{this._interceptWorkbook(e.unit)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(N.UNIVER_SHEET).subscribe(e=>this._disposeWorkbookInterceptor(e))),this.intercept(sG.CELL_CONTENT,{priority:-1,effect:bf.Style|bf.Value,handler:e=>e}),this.disposeWithMe(this.writeCellInterceptor.intercept(pG,{priority:-1,handler:e=>e})),this.disposeWithMe(this.writeCellInterceptor.intercept(fG,{priority:-1,handler:e=>e})),this.disposeWithMe(this.writeCellInterceptor.intercept(mG,{priority:-1,handler:e=>e}))}dispose(){super.dispose(),this._workbookDisposables.forEach(e=>e.dispose()),this._workbookDisposables.clear(),this._worksheetDisposables.forEach(e=>e.dispose()),this._worksheetDisposables.clear(),this._interceptorsByName.clear(),this._composedInterceptorByKey.clear()}interceptCommand(e){if(this._commandInterceptors.includes(e))throw Error(`[SheetInterceptorService]: Interceptor already exists!`);return this._commandInterceptors.push(e),this._commandInterceptors.sort((e,t)=>(t.priority??0)-(e.priority??0)),this.disposeWithMe(Hf(()=>Gd(this._commandInterceptors,e)))}onCommandExecute(e){let t=this._commandInterceptors.map(t=>t.getMutations(e));return{preUndos:t.map(e=>e.preUndos??[]).flat(),undos:t.map(e=>e.undos).flat(),preRedos:t.map(e=>e.preRedos??[]).flat(),redos:t.map(e=>e.redos).flat()}}interceptAfterCommand(e){if(this._afterCommandInterceptors.includes(e))throw Error(`[SheetInterceptorService]: Interceptor already exists!`);return this._afterCommandInterceptors.push(e),this._afterCommandInterceptors.sort((e,t)=>(t.priority??0)-(e.priority??0)),this.disposeWithMe(Hf(()=>Gd(this._afterCommandInterceptors,e)))}afterCommandExecute(e){let t=this._afterCommandInterceptors.map(t=>t.getMutations(e));return{undos:t.map(e=>e.undos).flat(),redos:t.map(e=>e.redos).flat()}}interceptAutoHeight(e){if(this._autoHeightInterceptors.includes(e))throw Error(`[SheetInterceptorService]: Interceptor already exists!`);return this._autoHeightInterceptors.push(e),this._autoHeightInterceptors.sort((e,t)=>(t.priority??0)-(e.priority??0)),this.disposeWithMe(Hf(()=>Gd(this._autoHeightInterceptors,e)))}generateMutationsOfAutoHeight(e){let t=this._autoHeightInterceptors.map(t=>t.getMutations(e));return{preUndos:t.map(e=>e.preUndos??[]).flat(),undos:t.map(e=>e.undos).flat(),preRedos:t.map(e=>e.preRedos??[]).flat(),redos:t.map(e=>e.redos).flat()}}interceptBeforeCommand(e){if(this._beforeCommandInterceptor.includes(e))throw Error(`[SheetInterceptorService]: Interceptor already exists!`);return this._beforeCommandInterceptor.push(e),this._beforeCommandInterceptor.sort((e,t)=>(t.priority??0)-(e.priority??0)),this.disposeWithMe(Hf(()=>Gd(this._beforeCommandInterceptor,e)))}async beforeCommandExecute(e){return(await Promise.all(this._beforeCommandInterceptor.map(t=>t.performCheck(e)))).every(e=>e)}interceptRanges(e){if(this._rangeInterceptors.includes(e))throw Error(`[SheetInterceptorService]: Interceptor already exists!`);return this._rangeInterceptors.push(e),this._rangeInterceptors.sort((e,t)=>(t.priority??0)-(e.priority??0)),this.disposeWithMe(Hf(()=>Gd(this._rangeInterceptors,e)))}generateMutationsByRanges(e){let t=this._rangeInterceptors.map(t=>t.getMutations(e));return{preUndos:t.map(e=>e.preUndos??[]).flat(),undos:t.map(e=>e.undos).flat(),preRedos:t.map(e=>e.preRedos??[]).flat(),redos:t.map(e=>e.redos).flat()}}onWriteCell(e,t,n,r,i){let a={subUnitId:t.getSheetId(),unitId:e.getUnitId(),workbook:e,worksheet:t,row:n,col:r,origin:I.deepClone(i)};return this.writeCellInterceptor.fetchThroughInterceptors(pG)(i,a)}onValidateCell(e,t,n,r){let i={subUnitId:t.getSheetId(),unitId:e.getUnitId(),workbook:e,worksheet:t,row:n,col:r};return this.writeCellInterceptor.fetchThroughInterceptors(mG)(Promise.resolve(!0),i)}intercept(e,t){let n=e;this._interceptorsByName.has(n)||this._interceptorsByName.set(n,[]);let r=this._interceptorsByName.get(n);r.push(t);let i=r.sort((e,t)=>(t.priority??0)-(e.priority??0));if(this._invalidateComposedInterceptors(),n===sG.CELL_CONTENT){let e=bf.Style|bf.Value;this._interceptorsByName.set(`${n}-${e}`,i);let r=bf.Style|bf.Value;return this._interceptorsByName.set(`${n}-${bf.Style}`,i.filter(e=>((e.effect||r)&bf.Style)>0)),this._interceptorsByName.set(`${n}-${bf.Value}`,i.filter(e=>((e.effect||r)&bf.Value)>0)),this.disposeWithMe(Hf(()=>{Gd(this._interceptorsByName.get(n),t),Gd(this._interceptorsByName.get(`${n}-${e}`),t),Gd(this._interceptorsByName.get(`${n}-${bf.Style}`),t),Gd(this._interceptorsByName.get(`${n}-${bf.Value}`),t),this._invalidateComposedInterceptors()}))}return this._interceptorsByName.set(n,i),this.disposeWithMe(Hf(()=>{Gd(this._interceptorsByName.get(n),t),this._invalidateComposedInterceptors()}))}fetchThroughInterceptors(e,t,n,r){let i=t===void 0?e:`${e}-${t}`,a=n??i,o=this._composedInterceptorByKey.get(a);if(!o){let e=this._interceptorsByName.get(i);e&&r&&(e=e.filter(r)),o=Sf(e||[]),this._composedInterceptorByKey.set(a,o)}return o}_invalidateComposedInterceptors(){this._composedInterceptorVersion+=1,this._composedInterceptorByKey.clear()}_getCommonCellContentInterceptor(e,t){let n=t.get(e);return n||(n=this.fetchThroughInterceptors(sG.CELL_CONTENT,e),t.set(e,n)),n}_getCommonRowFilteredInterceptor(e){return e.interceptor||=this.fetchThroughInterceptors(sG.ROW_FILTERED),e.interceptor}_interceptWorkbook(e){let t=new Uf,n=e.getUnitId(),r=this,i=t=>{let i=t.getSheetId();t.__interceptViewModel(a=>{let o=new Uf,s=new Map,c={interceptor:null},l=-1,u=-1;r._worksheetDisposables.set(ift(n,t),o),o.add(a.registerCellContentInterceptor({getCell(a,o,c,u,d){let f=t.getCellRaw(a,o),p={unitId:n,subUnitId:i,row:a,col:o,worksheet:t,workbook:e,rawData:f};return u===void 0&&d===void 0?(l!==r._composedInterceptorVersion&&(s.clear(),l=r._composedInterceptorVersion),r._getCommonCellContentInterceptor(c,s)(f,p)):r.fetchThroughInterceptors(sG.CELL_CONTENT,c,u,d)(f,p)}})),o.add(a.registerRowFilteredInterceptor({getRowFiltered(a){return u!==r._composedInterceptorVersion&&(c.interceptor=null,u=r._composedInterceptorVersion),!!r._getCommonRowFilteredInterceptor(c)(!1,{unitId:n,subUnitId:i,row:a,workbook:e,worksheet:t})}}))})};e.getSheets().forEach(e=>i(e)),t.add(e.sheetCreated$.subscribe(e=>i(e))),t.add(Hf(()=>e.getSheets().forEach(e=>this._disposeSheetInterceptor(n,e)))),t.add(e.sheetDisposed$.subscribe(e=>this._disposeSheetInterceptor(n,e))),this._workbookDisposables.set(n,t)}_disposeWorkbookInterceptor(e){let t=e.getUnitId(),n=this._workbookDisposables.get(t);n&&(n.dispose(),this._workbookDisposables.delete(t))}_disposeSheetInterceptor(e,t){let n=ift(e,t),r=this._worksheetDisposables.get(n);r&&(r.dispose(),this._worksheetDisposables.delete(n))}};hG=dG([uG(0,B)],hG);function ift(e,t){return`${e}|${t.getSheetId()}`}var gG=e=>{let t={};return e.bg&&(t.bg={...e.bg}),e.ol&&(t.ol={...e.ol}),e.bd&&(t.bd={...e.bd}),e.cl&&(t.cl={...e.cl}),e.ht&&(t.ht=e.ht),e.vt&&(t.vt=e.vt),e.bl!==void 0&&(t.bl=e.bl),t};function aft(e){let t={};if(e.length===1)return e[0];for(let n of e)n.bg&&(t.bg=n.bg),n.ol&&(t.ol=n.ol),n.bd&&(t.bd={...t.bd,...n.bd}),n.cl&&(t.cl=n.cl),n.ht&&(t.ht=n.ht),n.vt&&(t.vt=n.vt),n.bl!==void 0&&(t.bl=n.bl);return t}var _G={wholeStyle:1,headerRowStyle:2,headerColumnStyle:4,firstRowStyle:8,secondRowStyle:16,lastRowStyle:32,firstColumnStyle:128,secondColumnStyle:256,lastColumnStyle:512},vG=class{constructor(e,t){Z(this,`_name`,void 0),Z(this,`wholeStyle`,null),Z(this,`headerRowStyle`,null),Z(this,`headerColumnStyle`,null),Z(this,`firstRowStyle`,null),Z(this,`secondRowStyle`,null),Z(this,`lastRowStyle`,null),Z(this,`firstColumnStyle`,null),Z(this,`secondColumnStyle`,null),Z(this,`lastColumnStyle`,null),Z(this,`_mergeCacheMap`,new Map),t&&this.fromJson({...t,name:e}),this._name=e}getName(){return this._name}getWholeStyle(){return this.wholeStyle}setWholeStyle(e){this.wholeStyle=e,this._resetStyleCache()}getFirstRowStyle(){return this.firstRowStyle}setFirstRowStyle(e){this.firstRowStyle=e,this._resetStyleCache()}getSecondRowStyle(){return this.secondRowStyle}setSecondRowStyle(e){this.secondRowStyle=e,this._resetStyleCache()}getLastRowStyle(){return this.lastRowStyle}setLastRowStyle(e){this.lastRowStyle=e,this._resetStyleCache()}getFirstColumnStyle(){return this.firstColumnStyle}setFirstColumnStyle(e){this.firstColumnStyle=e,this._resetStyleCache()}getSecondColumnStyle(){return this.secondColumnStyle}setSecondColumnStyle(e){this.secondColumnStyle=e,this._resetStyleCache()}getLastColumnStyle(){return this.lastColumnStyle}setLastColumnStyle(e){this.lastColumnStyle=e,this._resetStyleCache()}getHeaderRowStyle(){return this.headerRowStyle}setHeaderRowStyle(e){this.headerRowStyle=e,this._resetStyleCache()}getHeaderColumnStyle(){return this.headerColumnStyle}setHeaderColumnStyle(e){this.headerColumnStyle=e,this._resetStyleCache()}getStyle(e,t,n,r,i){let a=0;return n&&(a|=_G.lastRowStyle),r&&(a|=_G.lastColumnStyle),e>=0&&t>=0&&(a|=_G.wholeStyle),e%2==1&&(a|=i?_G.secondRowStyle:_G.firstRowStyle),e%2==0&&(a|=i?_G.firstRowStyle:_G.secondRowStyle),e===0&&(a|=_G.headerRowStyle),t===0&&(a|=_G.headerColumnStyle),t%2==1&&(a|=_G.firstColumnStyle),t%2==0&&(a|=_G.secondColumnStyle),a===0?null:this._getMergeStyle(a)}_getMergeStyle(e){let t=this._mergeCacheMap.get(e);return t||(t=this._mergeStyle(e),this._mergeCacheMap.set(e,t)),t}_mergeStyle(e){let t=[];return this.wholeStyle&&e&_G.wholeStyle&&t.push(this.wholeStyle),this.firstColumnStyle&&e&_G.firstColumnStyle&&t.push(this.firstColumnStyle),this.secondColumnStyle&&e&_G.secondColumnStyle&&t.push(this.secondColumnStyle),this.firstRowStyle&&e&_G.firstRowStyle&&t.push(this.firstRowStyle),this.secondRowStyle&&e&_G.secondRowStyle&&t.push(this.secondRowStyle),this.headerColumnStyle&&e&_G.headerColumnStyle&&t.push(this.headerColumnStyle),this.lastColumnStyle&&e&_G.lastColumnStyle&&t.push(this.lastColumnStyle),this.headerRowStyle&&e&_G.headerRowStyle&&t.push(this.headerRowStyle),this.lastRowStyle&&e&_G.lastRowStyle&&t.push(this.lastRowStyle),aft(t)}_resetStyleCache(){this._mergeCacheMap.clear()}toJson(){let e={name:this._name};return this.wholeStyle&&(e.wholeStyle=gG(this.wholeStyle)),this.headerRowStyle&&(e.headerRowStyle=gG(this.headerRowStyle)),this.headerColumnStyle&&(e.headerColumnStyle=gG(this.headerColumnStyle)),this.firstRowStyle&&(e.firstRowStyle=gG(this.firstRowStyle)),this.secondRowStyle&&(e.secondRowStyle=gG(this.secondRowStyle)),this.lastRowStyle&&(e.lastRowStyle=gG(this.lastRowStyle)),this.firstColumnStyle&&(e.firstColumnStyle=gG(this.firstColumnStyle)),this.secondColumnStyle&&(e.secondColumnStyle=gG(this.secondColumnStyle)),this.lastColumnStyle&&(e.lastColumnStyle=gG(this.lastColumnStyle)),e}fromJson(e){this._name=e.name,e.wholeStyle&&(this.wholeStyle=gG(e.wholeStyle)),e.headerRowStyle&&(this.headerRowStyle=gG(e.headerRowStyle)),e.headerColumnStyle&&(this.headerColumnStyle=gG(e.headerColumnStyle)),e.firstRowStyle&&(this.firstRowStyle=gG(e.firstRowStyle)),e.secondRowStyle&&(this.secondRowStyle=gG(e.secondRowStyle)),e.lastRowStyle&&(this.lastRowStyle=gG(e.lastRowStyle)),e.firstColumnStyle&&(this.firstColumnStyle=gG(e.firstColumnStyle)),e.secondColumnStyle&&(this.secondColumnStyle=gG(e.secondColumnStyle)),e.lastColumnStyle&&(this.lastColumnStyle=gG(e.lastColumnStyle))}dispose(){this._mergeCacheMap.clear()}},oft=(e,t,n)=>new vG(`light-${e}`,{headerRowStyle:{bg:{rgb:t}},firstColumnStyle:{bg:{rgb:`rgb(255, 255, 255)`}},secondColumnStyle:{bg:{rgb:n}},lastRowStyle:{bg:{rgb:t}}}),sft=(e,t,n)=>new vG(`middle-${e}`,{headerRowStyle:{bg:{rgb:t}},headerColumnStyle:{bg:{rgb:n}},secondRowStyle:{bg:{rgb:n}},lastRowStyle:{bg:{rgb:t}},lastColumnStyle:{bg:{rgb:n}}}),cft=(e,t,n,r)=>new vG(`dark-${e}`,{headerRowStyle:{bg:{rgb:t},cl:{rgb:`rgb(255, 255, 255)`},ht:Tp.CENTER,bl:jp.TRUE},firstRowStyle:{bg:{rgb:n}},secondRowStyle:{bg:{rgb:r}},lastRowStyle:{bg:{rgb:t}}}),lft=[{baseName:`blue`,header:`rgb(164, 202, 254)`,color:`rgb(225, 239, 254)`},{baseName:`grey`,header:`rgb(205, 208, 216)`,color:`rgb(238, 239, 241)`},{baseName:`red`,header:`rgb(248, 180, 180)`,color:`rgb(253, 232, 232)`},{baseName:`orange`,header:`rgb(253, 186, 140)`,color:`rgb(254, 236, 220)`},{baseName:`yellow`,header:`rgb(250, 200, 21)`,color:`rgb(255, 244, 185)`},{baseName:`green`,header:`rgb(132, 225, 188)`,color:`rgb(222, 247, 236)`},{baseName:`azure`,header:`rgb(126, 220, 226)`,color:`rgb(213, 245, 246)`},{baseName:`indigo`,header:`rgb(186, 198, 248)`,color:`rgb(233, 237, 255)`},{baseName:`purple`,header:`rgb(202, 191, 253)`,color:`rgb(237, 235, 254)`},{baseName:`magenta`,header:`rgb(248, 180, 217)`,color:`rgb(252, 232, 243)`}],uft=[{baseName:`blue`,rowHeader:`rgb(63, 131, 248)`,colHeader:`rgb(195, 221, 253)`},{baseName:`grey`,rowHeader:`rgb(95, 101, 116)`,colHeader:`rgb(227, 229, 234)`},{baseName:`red`,rowHeader:`rgb(240, 82, 82)`,colHeader:`rgb(251, 213, 213)`},{baseName:`orange`,rowHeader:`rgb(255, 90, 31)`,colHeader:`rgb(252, 217, 189)`},{baseName:`yellow`,rowHeader:`rgb(212, 157, 15)`,colHeader:`rgb(252, 220, 106)`},{baseName:`green`,rowHeader:`rgb(13, 164, 113)`,colHeader:`rgb(188, 240, 218)`},{baseName:`azure`,rowHeader:`rgb(6, 148, 162)`,colHeader:`rgb(175, 236, 239)`},{baseName:`indigo`,rowHeader:`rgb(70, 106, 247)`,colHeader:`rgb(210, 218, 250)`},{baseName:`purple`,rowHeader:`rgb(144, 97, 249)`,colHeader:`rgb(220, 215, 254)`},{baseName:`magenta`,rowHeader:`rgb(231, 70, 148)`,colHeader:`rgb(250, 209, 232)`}],dft=[{baseName:`blue`,rowHeader:`rgb(30, 66, 159)`,firstRow:`rgb(195, 221, 253)`,secondRow:`rgb(118, 169, 250)`},{baseName:`grey`,rowHeader:`rgb(44, 48, 64)`,firstRow:`rgb(227, 229, 234)`,secondRow:`rgb(151, 157, 172)`},{baseName:`red`,rowHeader:`rgb(155, 28, 28)`,firstRow:`rgb(251, 213, 213)`,secondRow:`rgb(249, 128, 128)`},{baseName:`orange`,rowHeader:`rgb(180, 52, 3)`,firstRow:`rgb(252, 217, 189)`,secondRow:`rgb(255, 138, 76)`},{baseName:`yellow`,rowHeader:`rgb(154, 109, 21)`,firstRow:`rgb(252, 220, 106)`,secondRow:`rgb(212, 157, 15)`},{baseName:`green`,rowHeader:`rgb(4, 108, 78)`,firstRow:`rgb(188, 240, 218)`,secondRow:`rgb(49, 196, 141)`},{baseName:`azure`,rowHeader:`rgb(3, 102, 114)`,firstRow:`rgb(175, 236, 239)`,secondRow:`rgb(22, 189, 202)`},{baseName:`indigo`,rowHeader:`rgb(16, 51, 191)`,firstRow:`rgb(210, 218, 250)`,secondRow:`rgb(98, 128, 249)`},{baseName:`purple`,rowHeader:`rgb(74, 29, 150)`,firstRow:`rgb(220, 215, 254)`,secondRow:`rgb(172, 148, 250)`},{baseName:`magenta`,rowHeader:`rgb(153, 21, 75)`,firstRow:`rgb(250, 209, 232)`,secondRow:`rgb(241, 126, 184)`}],fft=lft.map(({baseName:e,header:t,color:n})=>oft(e,t,n)),pft=uft.map(({baseName:e,rowHeader:t,colHeader:n})=>sft(e,t,n)),mft=dft.map(({baseName:e,rowHeader:t,firstRow:n,secondRow:r})=>cft(e,t,n,r)),hft=[...fft,...pft,...mft],gft={headerRowStyle:{bg:{rgb:`rgb(68,114,196)`},cl:{rgb:`rgb(255,255,255)`},ht:Tp.CENTER,bl:jp.TRUE},firstRowStyle:{bg:{rgb:`rgb(217,225,242)`}}},_ft=new vG(`default`,gft),vft=new vG(`default-last-row`,{...gft,lastRowStyle:{bd:{t:{s:cp.THIN,cl:{rgb:`rgb(68,114,196)`}}},ht:Tp.CENTER,bl:jp.TRUE}}),yft=class{constructor(){Z(this,`_toggleRanges`,[])}refresh(e,t){let{startRow:n,endRow:r}=e,i=[],a=0,o=!1,s=-1;for(let e=n;e<=r;e++){if(!t(e)){a++,a%2==1?o=!0:(o=!1,s!==-1&&(i.push([s,e-1]),s=-1));continue}a%2==1?o?s===-1&&(s=e):(o=!0,s=e):o&&(i.push([s,e-2]),o=!1,s=-1),e===r&&o&&i.push([s,e])}this._toggleRanges=i}getToggleRanges(){return this._toggleRanges.concat()}getIsToggled(e){let t=0,n=this._toggleRanges.length-1;for(;t<=n;){let r=Math.floor((t+n)/2),[i,a]=this._toggleRanges[r];if(e<i)n=r-1;else if(e>a)t=r+1;else return!0}return!1}},bft=`SHEET_RANGE_THEME_MODEL_PLUGIN`,yG=class extends F{constructor(e,t,n){super(),this._sheetInterceptorService=e,this._resourceManagerService=t,this._univerInstanceService=n,Z(this,`_rangeThemeStyleMap`,new Map),Z(this,`_rangeThemeStyleRuleMap`,new Map),Z(this,`_rTreeCollection`,new Map),Z(this,`_defaultRangeThemeMap`,new Map),Z(this,`_zebraCrossingCacheMap`,new Map),Z(this,`_rowVisibleFuncSet`,new Map),Z(this,`_rangeThemeMapChanged$`,new io),Z(this,`rangeThemeMapChange$`,this._rangeThemeMapChanged$.asObservable()),this._registerIntercept(),this._initSnapshot(),this._initDefaultTheme()}_initDefaultTheme(){this.registerDefaultRangeTheme(_ft),this.registerDefaultRangeTheme(vft);for(let e of hft)this.registerDefaultRangeTheme(e)}_ensureRangeThemeStyleMap(e){return this._rangeThemeStyleMap.has(e)||this._rangeThemeStyleMap.set(e,new Map),this._rangeThemeStyleMap.get(e)}_ensureRangeThemeStyleRuleMap(e){return this._rangeThemeStyleRuleMap.has(e)||this._rangeThemeStyleRuleMap.set(e,new Map),this._rangeThemeStyleRuleMap.get(e)}_ensureRTreeCollection(e){return this._rTreeCollection.has(e)||this._rTreeCollection.set(e,new lx),this._rTreeCollection.get(e)}getDefaultRangeThemeStyle(e){return this._defaultRangeThemeMap.get(e)}getCustomRangeThemeStyle(e,t){return this._ensureRangeThemeStyleMap(e).get(t)}_getSheetRowVisibleFuncSet(e,t){this._rowVisibleFuncSet.has(e)||this._rowVisibleFuncSet.set(e,new Map);let n=this._rowVisibleFuncSet.get(e);return n.has(t)||n.set(t,new Set),n.get(t)}_getSheetRowVisibleHasInit(e,t){return!!(this._rowVisibleFuncSet.has(e)&&this._rowVisibleFuncSet.get(e)?.has(t))}refreshSheetRowVisibleFuncSet(e,t){let n=this._getSheetRowVisibleFuncSet(e,t);n.clear();let r=this._univerInstanceService.getUnit(e);if(r){let e=r.getSheetBySheetId(t);if(e){let t=e.getRowCount(),r=e.getRowManager();for(let i=1;i<=t;i++)e.getRowVisible(i)?r.getRowHeight(i)===0&&n.add(i):n.add(i)}}}_ensureZebraCrossingCache(e,t,n){this._zebraCrossingCacheMap.has(e)||this._zebraCrossingCacheMap.set(e,new Map);let r=this._zebraCrossingCacheMap.get(e);r.has(t)||r.set(t,new Map);let i=r.get(t);return i.has(n)||i.set(n,new yft),i.get(n)}registerRangeThemeRule(e,t){let{unitId:n,subUnitId:r,range:i}=t,a=np(),o=this._ensureRangeThemeStyleRuleMap(n),s=this._ensureRTreeCollection(n);o.set(a,{rangeInfo:t,themeName:e}),s.insert({unitId:n,sheetId:r,range:i,id:a}),this._getSheetRowVisibleHasInit(n,r)||this.refreshSheetRowVisibleFuncSet(n,r);let c=this._ensureZebraCrossingCache(n,r,a),l=this._getSheetRowVisibleFuncSet(n,r);c.refresh(i,e=>!l.has(e))}getRegisteredRangeThemeStyle(e){let{unitId:t,subUnitId:n,range:r}=e,i=this._ensureRTreeCollection(t),a=Array.from(i.bulkSearch([{unitId:t,sheetId:n,range:r}]));if(a[0]){let e=this._ensureRangeThemeStyleRuleMap(t).get(a[0]);if(e)return e.themeName}}refreshZebraCrossingCacheBySheet(e,t){this._zebraCrossingCacheMap.has(e)||this._zebraCrossingCacheMap.set(e,new Map);let n=this._zebraCrossingCacheMap.get(e);n.has(t)||n.set(t,new Map);let r=n.get(t);r&&r.forEach((n,i)=>{let a=this._ensureRangeThemeStyleRuleMap(e).get(i);a?n.refresh(a.rangeInfo.range,n=>!this._getSheetRowVisibleFuncSet(e,t).has(n)):r.delete(i)})}removeRangeThemeRule(e,t){let{unitId:n,subUnitId:r,range:i}=t,a=this._ensureRTreeCollection(n),o=Array.from(a.bulkSearch([{unitId:n,sheetId:r,range:i}])),s=this._ensureRangeThemeStyleRuleMap(n);for(let t=0;t<o.length;t++){let c=s.get(o[t]);if(c&&c.themeName===e){s.delete(o[t]),a.remove({unitId:n,sheetId:r,range:i,id:o[t]});let e=this._zebraCrossingCacheMap.get(n);if(e){let n=e.get(r);n&&n.delete(o[t])}break}}}registerDefaultRangeTheme(e){this._defaultRangeThemeMap.set(e.getName(),e),this._rangeThemeMapChanged$.next({type:`add`,styleName:e.getName()})}unRegisterDefaultRangeTheme(e){this._defaultRangeThemeMap.delete(e),this._rangeThemeMapChanged$.next({type:`remove`,styleName:e})}getRegisteredRangeThemes(){return Array.from(this._defaultRangeThemeMap.keys())}registerRangeThemeStyle(e,t){this._ensureRangeThemeStyleMap(e).set(t.getName(),t),this._rangeThemeMapChanged$.next({type:`add`,styleName:t.getName()})}unregisterRangeThemeStyle(e,t){this._ensureRangeThemeStyleMap(e).delete(t),this._rangeThemeMapChanged$.next({type:`remove`,styleName:t})}getALLRegisteredTheme(e){return Array.from(this._ensureRangeThemeStyleMap(e).keys())}getRangeThemeStyle(e,t){return this._defaultRangeThemeMap.has(t)?this._defaultRangeThemeMap.get(t):this._ensureRangeThemeStyleMap(e).get(t)}getCellStyle(e,t,n,r){let i={startRow:n,startColumn:r,endRow:n,endColumn:r},a=this._ensureRTreeCollection(e),o=Array.from(a.bulkSearch([{unitId:e,sheetId:t,range:i}]));if(o[0]){let i=this._ensureRangeThemeStyleRuleMap(e).get(o[0]);if(i){let{rangeInfo:a,themeName:s}=i,c=n-a.range.startRow,l=r-a.range.startColumn,u=this.getRangeThemeStyle(e,s),d=this._ensureZebraCrossingCache(e,t,o[0]).getIsToggled(n);if(u)return u.getStyle(c,l,n===a.range.endRow,r===a.range.endColumn,d)}}}_registerIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(sG.CELL_CONTENT,{id:eft,effect:bf.Style,handler:(e,t,n)=>{let{row:r,col:i,unitId:a,subUnitId:o}=t,s=this.getCellStyle(a,o,r,i);if(s){let r=!e||e===t.rawData?{...t.rawData}:e;return r.themeStyle=s,n(r)}return n(e)}}))}toJson(e){let t=this._ensureRangeThemeStyleRuleMap(e),n=this._ensureRangeThemeStyleMap(e);if(n.size===0&&t.size===0)return`{}`;let r={};t.forEach((e,t)=>{r[t]=e});let i={};return n.forEach((e,t)=>{i[t]=e.toJson()}),JSON.stringify({rangeThemeStyleRuleMap:r,rangeThemeStyleMapJson:i})}fromJSON(e,t){let{rangeThemeStyleRuleMap:n,rangeThemeStyleMapJson:r}=t;n&&Object.keys(n).forEach(e=>{let{themeName:t,rangeInfo:r}=n[e];t.startsWith(`table`)||(this.registerRangeThemeRule(t,r),this._ensureRTreeCollection(r.unitId).insert({unitId:e,sheetId:r.subUnitId,range:r.range,id:e}))}),r&&Object.keys(r).forEach(t=>{let n=r[t],i=new vG(n.name);i.fromJson(n),this._ensureRangeThemeStyleMap(e).set(i.getName(),i)})}deleteUnitId(e){this._rangeThemeStyleMap.delete(e),this._rangeThemeStyleRuleMap.delete(e),this._rTreeCollection.delete(e)}_initSnapshot(){this.disposeWithMe(this._resourceManagerService.registerPluginResource({toJson:e=>this.toJson(e),parseJson:e=>{if(!e)return{};try{return JSON.parse(e)}catch{return{}}},businesses:[N.UNIVER_SHEET],pluginName:bft,onLoad:(e,t)=>{this.fromJSON(e,t)},onUnLoad:e=>{this.deleteUnitId(e)}}))}dispose(){super.dispose(),this._rangeThemeStyleMap.clear(),this._rangeThemeStyleRuleMap.clear(),this._defaultRangeThemeMap.clear(),this._rTreeCollection.clear(),this._zebraCrossingCacheMap.clear(),this._rowVisibleFuncSet.clear()}};yG=dG([uG(0,M(hG)),uG(1,M(wy)),uG(2,M(B))],yG);var bG={id:`sheet.mutation.set-worksheet-range-theme-style`,type:R.MUTATION,handler:(e,t)=>{if(!rG(e.get(B),t))return!1;let n=e.get(yG),{unitId:r,subUnitId:i,range:a,themeName:o}=t;return n.registerRangeThemeRule(o,{range:a,unitId:r,subUnitId:i}),!0}},xft=(e,t)=>{let n=iG(e.get(B),t);if(!n)throw Error(`[SetWorksheetRangeThemeStyleMutation]: worksheet is null error!`);let{worksheet:r}=n;return{unitId:t.unitId,subUnitId:r.getSheetId(),range:t.range,themeName:t.themeName}},xG={id:`sheet.mutation.remove-worksheet-range-theme-style`,type:R.MUTATION,handler:(e,t)=>{if(!rG(e.get(B),t))return!1;let n=e.get(yG),{unitId:r,subUnitId:i,range:a,themeName:o}=t;return n.removeRangeThemeRule(o,{range:a,unitId:r,subUnitId:i}),!0}},Sft=(e,t)=>{let n=iG(e.get(B),t);if(!n)throw Error(`[DeleteWorksheetRangeThemeStyleMutationFactory]: worksheet is null error!`);let{worksheet:r}=n;return{unitId:t.unitId,subUnitId:r.getSheetId(),range:t.range,themeName:t.themeName}},SG=(e,t)=>{if(!iG(e.get(B),t))throw Error(`Workbook or Worksheet not found at InsertRowMutationUndoFactory`);return{unitId:t.unitId,subUnitId:t.subUnitId,range:t.range}},CG={id:`sheet.mutation.insert-row`,type:R.MUTATION,handler:(e,t)=>{let n=iG(e.get(B),t);if(!n)throw Error(`Workbook or Worksheet not found at InsertRowMutation`);let{worksheet:r}=n,i=r.getRowManager(),{range:a,rowInfo:o}=t,{startRow:s,endRow:c}=a;i.insertRowsWithData(s,c,o);let l=c-s+1;return r.setRowCount(r.getRowCount()+l),r.getCellMatrix().insertRows(s,l),!0}},wG=(e,t)=>{if(!iG(e.get(B),t))throw Error(`Workbook or Worksheet not found at InsertColMutationUndoFactory`);return{unitId:t.unitId,subUnitId:t.subUnitId,range:t.range}},TG={id:`sheet.mutation.insert-col`,type:R.MUTATION,handler:(e,t)=>{let n=iG(e.get(B),t);if(!n)throw Error(`Workbook or Worksheet not found at InsertColMutation`);let{worksheet:r}=n,i=r.getColumnManager(),{range:a,colInfo:o}=t,{startColumn:s,endColumn:c}=a;i.insertColumnsWithData(s,c,o);let l=c-s+1;return r.setColumnCount(r.getColumnCount()+l),r.getCellMatrix().insertColumns(a.startColumn,l),!0}},EG={id:`sheet.mutation.move-range`,type:R.MUTATION,handler:(e,t)=>{let{from:n,to:r}=t;if(!n||!r)return!1;let i=e.get(B).getCurrentUnitOfType(N.UNIVER_SHEET);if(!i)return!1;let a=i.getSheetBySheetId(t.from.subUnitId),o=i.getSheetBySheetId(t.to.subUnitId);if(!a||!o)return!1;let s=a.getCellMatrix(),c=o.getCellMatrix();return new Mh(n.value).forValue((e,t,n)=>{n==null?s.realDeleteValue(e,t):s.setValue(e,t,n)}),new Mh(r.value).forValue((e,t,n)=>{n==null?c.realDeleteValue(e,t):c.setValue(e,t,n)}),!0}};function Cft(e,t){let{unitId:n,subUnitId:r,sourceRange:i,targetRange:a}=t,o=i.startRow>a.startRow,s=i.endRow-i.startRow+1;return o?{unitId:n,subUnitId:r,sourceRange:n_.clone(a),targetRange:{...i,endRow:i.endRow+s,startRow:i.startRow+s}}:{unitId:n,subUnitId:r,targetRange:n_.clone(i),sourceRange:{...a,endRow:a.endRow-s,startRow:a.startRow-s}}}var DG={id:`sheet.mutation.move-rows`,type:R.MUTATION,handler:(e,t)=>{let{unitId:n,subUnitId:r,sourceRange:i,targetRange:a}=t,o=e.get(B).getUniverSheetInstance(n);if(!o)throw Error(`[MoveRowMutation] univerSheet is null!`);let s=o.getSheetBySheetId(r);if(!s)throw Error(`[MoveRowMutation] worksheet is null!`);let c=i.startRow,l=i.endRow-i.startRow+1,u=a.startRow;return kh(c,l,u,s.getRowManager().getRowData()),s.getCellMatrix().moveRows(c,l,u),!0}};function wft(e,t){let{unitId:n,subUnitId:r,sourceRange:i,targetRange:a}=t,o=i.startColumn>a.startColumn,s=i.endColumn-i.startColumn+1;return o?{unitId:n,subUnitId:r,sourceRange:n_.clone(a),targetRange:{...i,endColumn:i.endColumn+s,startColumn:i.startColumn+s}}:{unitId:n,subUnitId:r,targetRange:n_.clone(i),sourceRange:{...a,startColumn:a.startColumn-s,endColumn:a.endColumn-s}}}var OG={id:`sheet.mutation.move-columns`,type:R.MUTATION,handler:(e,t)=>{let{unitId:n,subUnitId:r,sourceRange:i,targetRange:a}=t,o=e.get(B).getUniverSheetInstance(n);if(!o)throw Error(`[MoveColumnMutation] univerSheet is null!`);let s=o.getSheetBySheetId(r);if(!s)throw Error(`[MoveColumnMutation] worksheet is null!`);let c=i.startColumn,l=i.endColumn-i.startColumn+1,u=a.startColumn;return kh(c,l,u,s.getColumnManager().getColumnData()),s.getCellMatrix().moveColumns(c,l,u),!0}},Tft=(e,t)=>{let n=t.getRowManager().getRowData(),r={},i=e.range,a=Oh(r,hee(i.startRow,i.endRow,n));return{unitId:e.unitId,subUnitId:e.subUnitId,range:e.range,rowInfo:a}},kG={id:`sheet.mutation.remove-rows`,type:R.MUTATION,handler:(e,t)=>{let n=e.get(B).getUniverSheetInstance(t.unitId);if(n==null)throw Error(`universheet is null error!`);let r=n.getSheetBySheetId(t.subUnitId);if(!r)return!1;let i=t.range,a=r.getRowManager().getRowData(),o=[];for(let e=i.startRow;e<=i.endRow;e++)r.getRowFiltered(e)&&o.push(e);let s=i.endRow-i.startRow+1;return Dh(i.startRow,s,a),r.getCellMatrix().removeRows(i.startRow,s),r.setRowCount(r.getRowCount()-s),!0}},Eft=(e,t)=>{let n=e.get(B).getUniverSheetInstance(t.unitId);if(n==null)throw Error(`universheet is null error!`);let r=n.getSheetBySheetId(t.subUnitId);if(r==null)throw Error(`worksheet is null error!`);let i=r.getColumnManager().getColumnData(),a={},o=t.range,s=Oh(a,hee(o.startColumn,o.endColumn,i));return{unitId:t.unitId,subUnitId:t.subUnitId,range:t.range,colInfo:s}},AG={id:`sheet.mutation.remove-col`,type:R.MUTATION,handler:(e,t)=>{let n=e.get(B).getUniverSheetInstance(t.unitId);if(n==null)throw Error(`universheet is null error!`);let r=n.getSheetBySheetId(t.subUnitId);if(!r)return!1;let i=t.range,a=r.getColumnManager().getColumnData(),o=i.endColumn-i.startColumn+1;return Dh(i.startColumn,o,a),r.setColumnCount(r.getColumnCount()-o),r.getCellMatrix().removeColumns(i.startColumn,o),!0}},jG=(e,t)=>{let n=iG(e.get(B),t);if(!n)throw Error(`Workbook or worksheet is null error!`);let{worksheet:r}=n,i=r.getConfig().mergeData,a=t.ranges,o=[];for(let e=0;e<a.length;e++)for(let t=i.length-1;t>=0;t--){let n=i[t],r=a[e];n_.intersects(n,r)&&o.push(i[t])}return{unitId:t.unitId,subUnitId:t.subUnitId,ranges:o}},MG={id:`sheet.mutation.remove-worksheet-merge`,type:R.MUTATION,handler:(e,t)=>{let n=iG(e.get(B),t);if(!n)throw Error(`Workbook or worksheet is null error!`);let{worksheet:r}=n,i=r.getConfig().mergeData,a=t.ranges;for(let e=0;e<a.length;e++)for(let t=i.length-1;t>=0;t--){let n=i[t],r=a[e];n_.intersects(n,r)&&i.splice(t,1)}return r.getSpanModel().rebuild(i),!0}},Dft=e=>{let{order:t}=e,n={};return Object.keys(t).forEach(e=>{n[t[Number(e)]]=Number(e)}),{...e,order:n}},NG={id:`sheet.mutation.reorder-range`,type:R.MUTATION,handler:(e,t)=>{let{subUnitId:n,unitId:r,range:i,order:a}=t,o=e.get(B).getUnit(r).getSheetBySheetId(n);if(!o)return!1;let s=new Mh;Kg.foreach(i,(e,t)=>{if(a.hasOwnProperty(e)){let n=a[e],r=I.deepClone(o.getCellRaw(n,t));s.setValue(e,t,r)}});let c=o.getCellMatrix();return s.forValue((e,t,n)=>{c.setValue(e,t,n)}),!0}};function Oft(e,t){if(e==null)return e;let n=I.deepClone(e);if(t==null)return n;let r={};return`h`in t&&(r.h=n.h),`ia`in t&&(r.ia=n.ia),`ah`in t&&(r.ah=n.ah),`hd`in t&&(r.hd=n.hd),`s`in t&&(r.s=n.s),`custom`in t&&(r.custom=n.custom),r}function kft(e,t){if(e==null)return e;let n=I.deepClone(e);if(t==null)return n;let r={};return`w`in t&&(r.w=n.w),`hd`in t&&(r.hd=n.hd),`s`in t&&(r.s=n.s),`custom`in t&&(r.custom=n.custom),r}var Aft=(e,t)=>{let{unitId:n,subUnitId:r,columnData:i}=e,a={},o=t.getColumnManager();for(let e in i){let t=i[e];a[e]=kft(o.getColumn(Number(e)),t)}return{unitId:n,subUnitId:r,columnData:a}},PG={id:`sheet.mutation.set-col-data`,type:R.MUTATION,handler:(e,t)=>{let{columnData:n}=t,r=rG(e.get(B),t);if(!r)return!1;let{worksheet:i}=r,a=i.getColumnManager();for(let e in n){let t=n[e];if(t==null){a.removeColumn(Number(e));continue}let r=a.getColumnOrCreate(Number(e));Object.assign(r,t)}return!0}},jft=(e,t)=>{if(e.get(B).getUniverSheetInstance(t.unitId)==null)throw Error(`universheet is null error!`);return{unitId:t.unitId,subUnitId:t.subUnitId,ranges:t.ranges}},FG={id:`sheet.mutation.set-col-hidden`,type:R.MUTATION,handler:(e,t)=>{let n=e.get(B).getUniverSheetInstance(t.unitId);if(!n)return!1;let r=n.getSheetBySheetId(t.subUnitId).getColumnManager();for(let e=0;e<t.ranges.length;e++){let n=t.ranges[e];for(let e=n.startColumn;e<n.endColumn+1;e++){let t=r.getColumnOrCreate(e);t!=null&&(t.hd=jp.TRUE)}}return!0}},Mft=(e,t)=>{if(e.get(B).getUniverSheetInstance(t.unitId)==null)throw Error(`universheet is null error!`);return{unitId:t.unitId,subUnitId:t.subUnitId,ranges:t.ranges}},IG={id:`sheet.mutation.set-col-visible`,type:R.MUTATION,handler:(e,t)=>{let n=e.get(B).getUniverSheetInstance(t.unitId);if(!n)return!1;let r=n.getSheetBySheetId(t.subUnitId).getColumnManager();for(let e=0;e<t.ranges.length;e++){let n=t.ranges[e];for(let e=n.startColumn;e<n.endColumn+1;e++){let t=r.getColumnOrCreate(e);t!=null&&(t.hd=jp.FALSE)}}return!0}},LG={id:`sheet.mutation.set-gridlines-color`,type:R.MUTATION,handler:(e,t)=>{let n=rG(e.get(B),t);if(!n)return!1;let{worksheet:r}=n,i=r.getConfig();return i.gridlinesColor=t.color,!0}};function RG(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function zG(e,t,n){for(let r of t)Object.prototype.hasOwnProperty.call(e,r)&&n(r,e[r])}function BG(e,t,n){if(e==null)return e;if(!RG(e))return;let r={},i=!1;if(zG(e,t,(e,t)=>{r[e]=t,i=!0}),n)for(let t in n){let a=n[t];if(!a||!Object.prototype.hasOwnProperty.call(e,t))continue;let o=a(e[t]);o!==void 0&&(r[t]=o,i=!0)}return i?r:void 0}function Nft(e,t,n){if(e==null)return e;if(!RG(e))return;let r={},i=!1;return zG(e,t,(e,t)=>{let a=n(t);a!==void 0&&(r[e]=a,i=!0)}),i?r:void 0}function Pft(e){switch(e){case`bd`:case`tr`:case`td`:case`ht`:case`vt`:case`tb`:case`pd`:case`bg`:return!0;default:return!1}}function Fft(e){return e==null||[`string`,`number`,`boolean`].includes(typeof e)}function VG(e){return BG(e,dm)}function Ift(e){return BG(e,um,{cl:VG})}function Lft(e){return BG(e,tee,{cl:VG})}function Rft(e){return Nft(e,fm,Lft)}function zft(e){return BG(e,nee)}function Bft(e){return BG(e,ree)}function Vft(e){if(e==null)return e;if(RG(e)&&Object.prototype.hasOwnProperty.call(e,`pattern`)&&typeof e.pattern==`string`)return{pattern:e.pattern}}function Hft(e,t){switch(e){case`ul`:case`bbl`:case`st`:case`ol`:return Ift(t);case`bg`:case`cl`:return VG(t);case`bd`:return Rft(t);case`tr`:return zft(t);case`pd`:return Bft(t);case`n`:return Vft(t);default:return Fft(t)?t:void 0}}function Uft(e,t){if(t===null)return null;if(t===void 0)return e;let n=t,r=I.isObject(e)?{...e}:{};return zG(n,fm,(e,t)=>{let n=Lft(t);n!==void 0&&(r[e]=n)}),r}function Wft(e,t,n){let r=e.getStyleByCell(t);r??delete t.s,typeof n.s==`string`&&(n.s=e.get(n.s));let i=HG(r,n.s?n.s:null);i&&(I.removeNull(i),Object.entries(i).forEach(([e,t])=>{typeof t==`object`&&t&&Object.keys(t).length===0&&delete i[e]})),I.isEmptyObject(i)?delete t.s:t.s=e.setValue(i);let a=n.v?`${n.v}\r\n`:``;!n.p&&t.p&&(a&&a!==t.p.body?.dataStream?delete t.p:Jft(t.p,n.s?n.s:null))}function Gft(e,t){if(!t||!Object.keys(t).length)return e;let n=I.deepClone(e??{})||{},r=t;for(let e of pm){if(!Object.prototype.hasOwnProperty.call(r,e))continue;let t=Hft(e,r[e]);t!==void 0&&(e===`bd`?n[e]=Kft(n[e]||{},t):e in n||(n[e]=null))}return n}function Kft(e,t){if(!t||!Object.keys(t).length)return e;let n=e;for(let r of fm)Object.prototype.hasOwnProperty.call(t,r)&&(r in e||(n[r]=null));return e}function HG(e,t,n=!1){if(t===null)return t;if(t===void 0)return e;let r=I.deepClone(e)||{},i=t;for(let e of pm){if(!Object.prototype.hasOwnProperty.call(i,e)||n&&Pft(e))continue;let t=Hft(e,i[e]);t!==void 0&&(r[e]=e===`bd`?Uft(r[e],t):t)}if(`cl`in r){let e=r,t=e.cl;`ul`in e&&e.ul&&(e.ul.cl=t),`ol`in e&&e.ol&&(e.ol.cl=t),`st`in e&&e.st&&(e.st.cl=t)}return r}function qft(e,t){return e.some(e=>e.startIndex===t)?qft(e,t+1):t}function Jft(e,t){if(e.body==null)return;Array.isArray(e.body.textRuns)||(e.body.textRuns=[]);let n=0,r=[],i=e.body?.paragraphs||[];for(let a of e.body.textRuns){let{st:e,ed:o,ts:s={}}=a;if(n<e){let i={st:n,ed:e},a=HG({},t,!0);a&&I.removeNull(a),I.isEmptyObject(a)||(i.ts=a),r.push(i)}let c=HG(s,t,!0);c&&I.removeNull(c),I.isEmptyObject(c)?delete a.ts:a.ts=c,r.push(a),n=qft(i,o)}let a=e.body.dataStream.endsWith(`\r
607
607
  `)?e.body.dataStream.length-2:e.body.dataStream.length;if(n<a){let e={st:n,ed:a},i=HG({},t,!0);i&&I.removeNull(i),I.isEmptyObject(i)||(e.ts=i),r.push(e)}e.body.textRuns=g_(r)}function Yft(e,t){return t.v===void 0||t.v===null?t.v:e===Mp.NUMBER?Number(t.v):e===Mp.BOOLEAN?+!!Xft(t.v):e===Mp.STRING||e===Mp.FORCE_STRING?`${t.v}`:t.v}function Xft(e){if(typeof e==`string`){if(e.toUpperCase()===`TRUE`)return!0;if(e.toUpperCase()===`FALSE`)return!1;if(Pf(e)){if(Number(e)===0)return!1;if(Number(e)===1)return!0}}if(typeof e==`number`){if(e===0)return!1;if(e===1)return!0}return typeof e==`boolean`?e:null}function Zft(e){return e==null?null:(e.f===void 0&&(e.f=null),e.si===void 0&&(e.si=null),e.p===void 0&&(e.p=null),e.v===void 0&&(e.v=null),e.t===void 0&&(e.t=null),e.s===void 0&&(e.s=null),e.custom===void 0&&(e.custom=null),e)}var UG=(e,t)=>{let{unitId:n,subUnitId:r,cellValue:i}=t,a=e.get(B).getUniverSheetInstance(n);if(a==null)throw Error(`workbook is null error!`);let o=a.getSheetBySheetId(r);if(o==null)throw Error(`worksheet is null error!`);let s=o.getCellMatrix(),c=a.getStyles(),l=new Mh;return new Mh(i).forValue((e,t,n)=>{let r=I.deepClone(s?.getValue(e,t))||{};r.s=Gft(c.getStyleByCell(r),c.getStyleByCell(n)),l.setValue(e,t,Zft(r))}),{...t,options:{},cellValue:l.getMatrix()}},WG={id:`sheet.mutation.set-range-values`,type:R.MUTATION,handler:(e,t)=>{let{cellValue:n,subUnitId:r,unitId:i}=t,a=e.get(B).getUnit(i);if(!a)return!1;let o=a.getSheetBySheetId(r);if(!o)return!1;let s=o.getCellMatrix(),c=a.getStyles();return new Mh(n).forValue((e,t,n)=>{if(!n)s.realDeleteValue(e,t);else{let r=s.getValue(e,t)||{};r=$ft(n,r,c),I.isEmptyObject(r)?s.realDeleteValue(e,t):s.setValue(e,t,r)}}),!0}},Qft=new Set([`f`,`p`,`si`,`custom`,`ref`,`xf`]);function $ft(e,t,n){let r=Xdt(n,e,t);return Object.keys(e).forEach(i=>{let a=i;if(Qft.has(a)){let n=e[a];ept(t,a,n)}else a===`v`?e.v!==void 0&&(t.v=Yft(r,e)):a===`s`&&Wft(n,t,e)}),t.v!==void 0&&(t.t=r,t.v=Yft(r,t)),t.v===null&&(delete t.t,delete t.v),t}function ept(e,t,n){n===void 0||(n===null?delete e[t]:e[t]=n)}var tpt=(e,t)=>{let{unitId:n,subUnitId:r,rowData:i}=e,a={},o=t.getRowManager();for(let e in i){let t=i[e];a[e]=Oft(o.getRow(Number(e)),t)}return{unitId:n,subUnitId:r,rowData:a}},GG={id:`sheet.mutation.set-row-data`,type:R.MUTATION,handler:(e,t)=>{let{rowData:n}=t,r=rG(e.get(B),t);if(!r)return!1;let{worksheet:i}=r,a=i.getRowManager();for(let e in n){let t=n[e];if(t==null){a.removeRow(Number(e));continue}let r=a.getRowOrCreate(Number(e));Object.assign(r,t)}return!0}},npt=(e,t)=>{if(e.get(B).getUniverSheetInstance(t.unitId)==null)throw Error(`universheet is null error!`);return{unitId:t.unitId,subUnitId:t.subUnitId,ranges:t.ranges}},KG={id:`sheet.mutation.set-row-visible`,type:R.MUTATION,handler:(e,t)=>{let n=e.get(B).getUniverSheetInstance(t.unitId);if(n==null)throw Error(`universheet is null error!`);let r=n.getSheetBySheetId(t.subUnitId).getRowManager();for(let e=0;e<t.ranges.length;e++){let n=t.ranges[e];for(let e=n.startRow;e<n.endRow+1;e++){let t=r.getRowOrCreate(e);t!=null&&(t.hd=0)}}return!0}},rpt=(e,t)=>{if(e.get(B).getUniverSheetInstance(t.unitId)==null)throw Error(`universheet is null error!`);return{unitId:t.unitId,subUnitId:t.subUnitId,ranges:t.ranges}},qG={id:`sheet.mutation.set-row-hidden`,type:R.MUTATION,handler:(e,t)=>{let n=e.get(B).getUniverSheetInstance(t.unitId);if(n==null)throw Error(`universheet is null error!`);let r=n.getSheetBySheetId(t.subUnitId).getRowManager();for(let e=0;e<t.ranges.length;e++){let n=t.ranges[e];for(let e=n.startRow;e<n.endRow+1;e++){let t=r.getRowOrCreate(e);t!=null&&(t.hd=1)}}return!0}},JG=(e,t)=>{let{unitId:n,subUnitId:r,ranges:i}=e,a={},o=t.getColumnManager();for(let e=0;e<i.length;e++){let t=i[e];for(let e=t.startColumn;e<t.endColumn+1;e++)a[e]=o.getColumnWidth(e)}return{unitId:n,subUnitId:r,ranges:i,colWidth:a}},YG={id:`sheet.mutation.set-worksheet-col-width`,type:R.MUTATION,handler:(e,t)=>{let n=rG(e.get(B),t);if(!n)return!1;let{worksheet:r}=n,i=r.getColumnManager(),a=t.ranges;for(let e=0;e<a.length;e++){let n=a[e];for(let e=n.startColumn;e<n.endColumn+1;e++)r.getColVisible(e)&&(typeof t.colWidth==`number`?i.setColumnWidth(e,t.colWidth):I.isDefine(t.colWidth[e])&&i.setColumnWidth(e,t.colWidth[e]))}return!0}},ipt=(e,t)=>{let n=iG(e.get(B),t);if(!n)throw Error(`[SetWorksheetColumnCountUndoMutationFactory]: worksheet is null error!`);return{unitId:t.unitId,subUnitId:t.subUnitId,columnCount:n.worksheet.getColumnCount()}},XG={id:`sheet.mutation.set-worksheet-column-count`,type:R.MUTATION,handler:(e,t)=>{let n=iG(e.get(B),t);return n?(n.worksheet.setColumnCount(t.columnCount),!0):!1}},ZG={id:`sheet.mutation.set-worksheet-default-style`,type:R.MUTATION,handler:(e,t)=>{let n=rG(e.get(B),t);if(!n)return!1;let{worksheet:r}=n,{defaultStyle:i}=t;return r.setDefaultCellStyle(i),!0}},apt=(e,t)=>{let n=iG(e.get(B),t);if(!n)throw Error(`[SetWorksheetDefaultStyleMutationFactory]: worksheet is null error!`);let{worksheet:r}=n;return{unitId:t.unitId,subUnitId:r.getSheetId(),defaultStyle:r.getDefaultCellStyle()}},opt=(e,t)=>{let n=iG(e.get(B),t);if(!n)throw Error(`[SetWorksheetRowCountUndoMutationFactory]: worksheet is null error!`);return{unitId:t.unitId,subUnitId:t.subUnitId,rowCount:n.worksheet.getRowCount()}},QG={id:`sheet.mutation.set-worksheet-row-count`,type:R.MUTATION,handler:(e,t)=>{let n=iG(e.get(B),t);return n?(n.worksheet.setRowCount(t.rowCount),!0):!1}},spt=(e,t)=>{let{unitId:n,subUnitId:r,ranges:i}=e,a={},o=t.getRowManager();for(let{startRow:e,endRow:n}of i)for(let r=e;r<n+1;r++)a[r]=o.getRow(r)?.h??t.getConfig().defaultRowHeight;return{unitId:n,subUnitId:r,ranges:i,rowHeight:a}},$G=(e,t)=>{let{unitId:n,subUnitId:r,ranges:i}=e,a={},o=t.getRowManager();for(let{startRow:e,endRow:t}of i)for(let n=e;n<=t;n++)a[n]=o.getRow(n)?.ia;return{unitId:n,subUnitId:r,ranges:i,autoHeightInfo:a}},eK=(e,t)=>{let{unitId:n,subUnitId:r,rowsAutoHeightInfo:i}=e,a=[],o=t.getRowManager();for(let e of i){let{row:n}=e;a.push({row:n,autoHeight:o.getRow(n)?.ah??t.getConfig().defaultRowHeight})}return{unitId:n,subUnitId:r,rowsAutoHeightInfo:a}},tK={id:`sheet.mutation.set-worksheet-row-height`,type:R.MUTATION,handler:(e,t)=>{let{ranges:n,rowHeight:r}=t,i=rG(e.get(B),t);if(!i)return!1;let{worksheet:a}=i,o=a.getRowManager();for(let{startRow:e,endRow:t}of n)for(let n=e;n<=t;n++)typeof r==`number`?o.setRowHeight(n,r):I.isDefine(r[n])&&o.setRowHeight(n,r[n]);return!0}},nK={id:`sheet.mutation.set-worksheet-row-is-auto-height`,type:R.MUTATION,handler:(e,t)=>{let{ranges:n,autoHeightInfo:r}=t,i=rG(e.get(B),t);if(!i)return!1;let a=i.worksheet.getRowManager();for(let{startRow:e,endRow:t}of n)for(let n=e;n<=t;n++){let e=a.getRowOrCreate(n);e.ia=typeof r==`number`?r:r[n]??void 0}return!0}},rK={id:`sheet.mutation.set-worksheet-row-auto-height`,type:R.MUTATION,handler:(e,t)=>{let{rowsAutoHeightInfo:n}=t,r=rG(e.get(B),t);if(!r)return!1;let i=r.worksheet.getRowManager();for(let{row:e,autoHeight:t}of n){let n=i.getRowOrCreate(e);n.ah=t}return!0}},iK={id:`sheet.mutation.toggle-gridlines`,type:R.MUTATION,handler:(e,t)=>{let n=rG(e.get(B),t);if(!n)return!1;let{worksheet:r}=n,i=r.getConfig();return i.showGridlines=t.showGridlines,!0}},aK={id:`sheet.operation.set-worksheet-active`,type:R.OPERATION,handler:(e,t)=>{let n=e.get(B).getUnit(t.unitId,N.UNIVER_SHEET);if(!n)return!1;let r=n.getWorksheets();for(let[,e]of r)if(e.getSheetId()===t.subUnitId)return n.setActiveSheet(e),!0;return!1}},cpt=function(e){return e.SET_WORKSHEET_ROW_HEIGHT=`sheet.mutation.set-worksheet-row-height`,e.SET_WORKSHEET_ROW_IS_AUTO_HEIGHT=`sheet.mutation.set-worksheet-row-is-auto-height`,e.SET_WORKSHEET_ROW_AUTO_HEIGHT=`sheet.mutation.set-worksheet-row-auto-height`,e.SET_WORKSHEET_COL_WIDTH=`sheet.mutation.set-worksheet-col-width`,e.SET_WORKSHEET_ACTIVE=`sheet.operation.set-worksheet-active`,e.MOVE_ROWS=`sheet.mutation.move-rows`,e.MOVE_COLUMNS=`sheet.mutation.move-columns`,e.SET_COL_HIDDEN=`sheet.mutation.set-col-hidden`,e.SET_COL_VISIBLE=`sheet.mutation.set-col-visible`,e.SET_ROW_HIDDEN=`sheet.mutation.set-row-hidden`,e.SET_ROW_VISIBLE=`sheet.mutation.set-row-visible`,e.INSERT_COL=`sheet.mutation.insert-col`,e.INSERT_ROW=`sheet.mutation.insert-row`,e.REMOVE_COL=`sheet.mutation.remove-col`,e.REMOVE_ROW=`sheet.mutation.remove-rows`,e.TOGGLE_GRIDLINES=`sheet.mutation.toggle-gridlines`,e.SET_GRIDLINES_COLOR=`sheet.mutation.set-gridlines-color`,e}({}),lpt=function(e){return e.SET_RANGE_VALUES=`sheet.mutation.set-range-values`,e.MOVE_RANGE=`sheet.mutation.move-range`,e.REMOVE_WORKSHEET_MERGE=`sheet.mutation.remove-worksheet-merge`,e.ADD_WORKSHEET_MERGE=`sheet.mutation.add-worksheet-merge`,e.REORDER_RANGE=`sheet.mutation.reorder-range`,e.SET_WORKSHEET_DEFAULT_STYLE=`sheet.mutation.set-worksheet-default-style`,e.SET_ROW_DATA=`sheet.mutation.set-row-data`,e.SET_COL_DATA=`sheet.mutation.set-col-data`,e.SET_WORKSHEET_RANGE_THEME_STYLE=`sheet.mutation.set-worksheet-range-theme-style`,e.DELETE_WORKSHEET_RANGE_THEME_STYLE=`sheet.mutation.delete-worksheet-range-theme-style`,e}({}),oK=[tK.id,nK.id,rK.id,YG.id,aK.id,DG.id,OG.id,FG.id,IG.id,qG.id,KG.id,TG.id,CG.id,AG.id,kG.id,iK.id,LG.id,QG.id,XG.id],upt=[WG.id,EG.id,MG.id,oG.id,NG.id,ZG.id,GG.id,PG.id,bG.id,xG.id];function dpt(e,t){switch(t.id){case`sheet.mutation.set-range-values`:{let e=t.params,n=new Mh(e.cellValue).getDataRange();return n.endRow===-1?[]:e.cellValue?[{unitId:e.unitId,subUnitId:e.subUnitId,range:n}]:[]}case`sheet.mutation.move-range`:{let e=t.params;return[{unitId:e.unitId,subUnitId:e.from.subUnitId,range:new Mh(e.from.value).getRange()},{unitId:e.unitId,subUnitId:e.to.subUnitId,range:new Mh(e.to.value).getRange()}]}case`sheet.mutation.remove-worksheet-merge`:{let e=t.params;return e.ranges.map(t=>({unitId:e.unitId,subUnitId:e.subUnitId,range:t}))}case`sheet.mutation.add-worksheet-merge`:{let e=t.params;return e.ranges.map(t=>({unitId:e.unitId,subUnitId:e.subUnitId,range:t}))}case`sheet.mutation.reorder-range`:{let e=t.params;return[{unitId:e.unitId,subUnitId:e.subUnitId,range:e.range}]}case`sheet.mutation.set-worksheet-default-style`:{let n=rG(e,t.params);if(!n)return[];let{worksheet:r,unitId:i,subUnitId:a}=n;return[{unitId:i,subUnitId:a,range:{startRow:0,endRow:r.getRowCount()-1,startColumn:0,endColumn:r.getColumnCount()-1}}]}case`sheet.mutation.set-row-data`:{let n=rG(e,t.params);if(!n)return[];let{worksheet:r,unitId:i,subUnitId:a}=n,{rowData:o}=t.params,s=Object.keys(o).map(Number);return s.length===0?[]:[{unitId:i,subUnitId:a,range:{startRow:Math.min(...s),endRow:Math.max(...s),startColumn:0,endColumn:r.getColumnCount()-1}}]}case`sheet.mutation.set-col-data`:{let n=rG(e,t.params);if(!n)return[];let{worksheet:r,unitId:i,subUnitId:a}=n,{columnData:o}=t.params,s=Object.keys(o).map(Number);return s.length===0?[]:[{unitId:i,subUnitId:a,range:{startRow:0,endRow:r.getRowCount()-1,startColumn:Math.min(...s),endColumn:Math.max(...s)}}]}case`sheet.mutation.set-worksheet-range-theme-style`:case`sheet.mutation.delete-worksheet-range-theme-style`:{let e=t.params;return[{unitId:e.unitId,subUnitId:e.subUnitId,range:e.range}]}default:return[]}}function fpt(e,t){switch(e.id){case`sheet.mutation.set-worksheet-row-height`:case`sheet.mutation.set-worksheet-row-is-auto-height`:{let t=e.params;return t.ranges.map(e=>({unitId:t.unitId,subUnitId:t.subUnitId,range:{...e,rangeType:fh.ROW}}))}case`sheet.mutation.set-worksheet-row-auto-height`:{let n=e.params;return n.rowsAutoHeightInfo.map(e=>({unitId:n.unitId,subUnitId:n.subUnitId,range:{startRow:e.row,endRow:e.row,startColumn:0,endColumn:t-1,rangeType:fh.ROW}}))}case`sheet.mutation.set-worksheet-col-width`:{let t=e.params;return t.ranges.map(e=>({unitId:t.unitId,subUnitId:t.subUnitId,range:{...e,rangeType:fh.COLUMN}}))}case`sheet.mutation.move-rows`:case`sheet.mutation.move-columns`:{let t=e.params;return[{unitId:t.unitId,subUnitId:t.subUnitId,range:t.targetRange},{unitId:t.unitId,subUnitId:t.subUnitId,range:t.sourceRange}]}case`sheet.mutation.set-col-hidden`:case`sheet.mutation.set-col-visible`:{let t=e.params;return t.ranges.map(e=>({unitId:t.unitId,subUnitId:t.subUnitId,range:{...e,rangeType:fh.COLUMN}}))}case`sheet.mutation.set-row-hidden`:case`sheet.mutation.set-row-visible`:{let t=e.params;return t.ranges.map(e=>({unitId:t.unitId,subUnitId:t.subUnitId,range:{...e,rangeType:fh.ROW}}))}case`sheet.mutation.insert-col`:{let t=e.params;return[{unitId:t.unitId,subUnitId:t.subUnitId,range:{...t.range,rangeType:fh.COLUMN}}]}case`sheet.mutation.insert-row`:{let t=e.params;return[{unitId:t.unitId,subUnitId:t.subUnitId,range:{...t.range,rangeType:fh.ROW}}]}case`sheet.mutation.remove-col`:{let t=e.params;return[{unitId:t.unitId,subUnitId:t.subUnitId,range:{...t.range,rangeType:fh.COLUMN}}]}case`sheet.mutation.remove-rows`:{let t=e.params;return[{unitId:t.unitId,subUnitId:t.subUnitId,range:{...t.range,rangeType:fh.ROW}}]}case`sheet.mutation.toggle-gridlines`:case`sheet.mutation.set-gridlines-color`:return[];default:return[]}}function sK(e,t){if(e.length===0)return`sheets.definedName.nameEmpty`;let{unitId:n,formulaOrRefString:r,univerInstanceService:i,definedNamesService:a,superTableService:o,functionService:s,id:c}=t,l=a.getValueByName(n,e);if(l&&(c==null||c.length===0||l.id!==c)||o.hasTable(n,e))return`sheets.definedName.nameDuplicate`;if(!I.isValidParameter(e)||SR(e)||!I.isStartValidPosition(e)&&!tw(e.substring(0,1)))return`sheets.definedName.nameInvalid`;let u=i.getUnit(n,N.UNIVER_SHEET);if(!u)throw Error(`Workbook not found for unitId: ${n}`);return u.getSheets().some(t=>t.getName()===e)?`sheets.definedName.nameSheetConflict`:r.length===0?`sheets.definedName.formulaOrRefStringEmpty`:!s.hasExecutor(e.toUpperCase())||`sheets.definedName.nameConflict`}function ppt(e){return e==null?!1:e.v!==void 0&&e.v!==null&&e.v!==``||e.p!==void 0}function cK(e,t){return e&&e.spanAnchor?ppt(t.getValue(e.spanAnchor.startRow,e.spanAnchor.startColumn)):ppt(e)}function mpt(e,t,n,r,i){let a=e.getCellMatrix(),o=e.getSpanModel().getMergedCellRange(t,n,r,i),s=new Mh;return a.forValue((e,t)=>{let n=a.getValue(e,t);n&&s.setValue(e,t,n)}),o.forEach(e=>{let{startColumn:t,startRow:n,endColumn:r,endRow:i}=e;s_(n,i,t,r).forEach((e,o)=>{e===n&&o===t&&s.setValue(e,o,{...a.getValue(e,o),spanAnchor:{startRow:n,endRow:i,startColumn:t,endColumn:r}}),(e!==n||o!==t)&&(s.realDeleteValue(e,o),s.setValue(e,o,{spanAnchor:{startRow:n,endRow:i,startColumn:t,endColumn:r}}))})}),s}function hpt(e,t,n,r){let{startRow:i,startColumn:a,endRow:o}=e,s=null,c=!1;for(let e=i;e<=o;e++){let i=t.getValue(e,a-n);if(c||=cK(i,t),!r&&c)break;i&&i.spanAnchor&&(s=s?{startRow:Math.min(i.spanAnchor.startRow,s.startRow),startColumn:Math.min(i.spanAnchor.startColumn,s.startColumn),endRow:Math.max(i.spanAnchor.endRow,s.endRow),endColumn:Math.max(i.spanAnchor.endColumn,s.endColumn)}:{startRow:i.spanAnchor.startRow,startColumn:i.spanAnchor.startColumn,endRow:i.spanAnchor.endRow,endColumn:i.spanAnchor.endColumn})}return c?(e.startColumn-=n,{spanAnchor:s,hasValue:!0,range:e}):s?{spanAnchor:n_.simpleRangesIntersect(e,s)?s:null,hasValue:!1,range:e}:{spanAnchor:null,hasValue:!1,range:e}}function gpt(e,t,n,r){let{startRow:i,endColumn:a,endRow:o}=e,s=null,c=!1;for(let e=i;e<=o;e++){let i=t.getValue(e,a+n);if(c||=cK(i,t),!r&&c)break;i&&i.spanAnchor&&(s=s?{startRow:Math.min(i.spanAnchor.startRow,s.startRow),startColumn:Math.min(i.spanAnchor.startColumn,s.startColumn),endRow:Math.max(i.spanAnchor.endRow,s.endRow),endColumn:Math.max(i.spanAnchor.endColumn,s.endColumn)}:{startRow:i.spanAnchor.startRow,startColumn:i.spanAnchor.startColumn,endRow:i.spanAnchor.endRow,endColumn:i.spanAnchor.endColumn})}return c?(e.endColumn+=n,{spanAnchor:s,hasValue:!0,range:e}):s?{spanAnchor:n_.simpleRangesIntersect(e,s)?s:null,hasValue:!1,range:e}:{spanAnchor:null,hasValue:!1,range:e}}function _pt(e,t,n,r){let{startRow:i,startColumn:a,endColumn:o}=e,s=null,c=!1;for(let e=a;e<=o;e++){let a=t.getValue(i-n,e);if(c||=cK(a,t),!r&&c)break;a&&a.spanAnchor&&(s=s?{startRow:Math.min(a.spanAnchor.startRow,s.startRow),startColumn:Math.min(a.spanAnchor.startColumn,s.startColumn),endRow:Math.max(a.spanAnchor.endRow,s.endRow),endColumn:Math.max(a.spanAnchor.endColumn,s.endColumn)}:{startRow:a.spanAnchor.startRow,startColumn:a.spanAnchor.startColumn,endRow:a.spanAnchor.endRow,endColumn:a.spanAnchor.endColumn})}return c?(e.startRow-=n,{spanAnchor:s,hasValue:!0,range:e}):s?{spanAnchor:n_.simpleRangesIntersect(e,s)?s:null,hasValue:!1,range:e}:{spanAnchor:null,hasValue:!1,range:e}}function vpt(e,t,n,r){let{startColumn:i,endColumn:a,endRow:o}=e,s=null,c=!1;for(let e=i;e<=a;e++){let i=t.getValue(o+n,e);if(c||=cK(i,t),!r&&c)break;i&&i.spanAnchor&&(s=s?{startRow:Math.min(i.spanAnchor.startRow,s.startRow),startColumn:Math.min(i.spanAnchor.startColumn,s.startColumn),endRow:Math.max(i.spanAnchor.endRow,s.endRow),endColumn:Math.max(i.spanAnchor.endColumn,s.endColumn)}:{startRow:i.spanAnchor.startRow,startColumn:i.spanAnchor.startColumn,endRow:i.spanAnchor.endRow,endColumn:i.spanAnchor.endColumn})}return c?(e.endRow+=n,{spanAnchor:s,hasValue:!0,range:e}):s?{spanAnchor:n_.simpleRangesIntersect(e,s)?s:null,hasValue:!1,range:e}:{spanAnchor:null,hasValue:!1,range:e}}function ypt({range:e,allMatrixWithSpan:t,directions:n,isWorksheetHasSpan:r,maxRow:i,maxColumn:a}){let{left:o,right:s,up:c,down:l}=n,{startRow:u,startColumn:d,endRow:f,endColumn:p}=e,m=!1;if(o&&c&&u>0&&d>0){let n=t.getValue(u-1,d-1);cK(n,t)&&(r&&n.spanAnchor?(e.startRow=n.spanAnchor.startRow,e.startColumn=n.spanAnchor.startColumn):(e.startRow=u-1,e.startColumn=d-1),m=!0)}if(s&&c&&u>0&&p<a-1){let n=t.getValue(u-1,p+1);cK(n,t)&&(r&&n.spanAnchor?(e.startRow=n.spanAnchor.startRow,e.endColumn=n.spanAnchor.endColumn):(e.startRow=u-1,e.endColumn=p+1),m=!0)}if(o&&l&&f<i-1&&d>0){let n=t.getValue(f+1,d-1);cK(n,t)&&(r&&n.spanAnchor?(e.endRow=n.spanAnchor.endRow,e.startColumn=n.spanAnchor.startColumn):(e.endRow=f+1,e.startColumn=d-1),m=!0)}if(s&&l&&f<i-1&&p<a-1){let n=t.getValue(f+1,p+1);cK(n,t)&&(r&&n.spanAnchor?(e.endRow=n.spanAnchor.endRow,e.endColumn=n.spanAnchor.endColumn):(e.endRow=f+1,e.endColumn=p+1),m=!0)}return{hasValue:m,range:e}}function lK(e,t,n){let r=n.getMaxRows(),i=n.getMaxColumns(),a=mpt(n,0,0,r-1,i-1),o=n.getSnapshot().mergeData.length>0,{left:s,right:c,up:l,down:u}=t,d=!0,f={...e},p=[];for(;d;){d=!1;let e=ypt({range:f,allMatrixWithSpan:a,directions:t,isWorksheetHasSpan:o,maxRow:r,maxColumn:i});if(e.hasValue){f=e.range,d=!0;continue}if(l&&f.startRow!==0){let{hasValue:e,range:t,spanAnchor:n}=_pt(f,a,1,o);if(n&&p.push(n),e){f=t,d=!0;continue}}if(u&&f.endRow!==r-1){let{hasValue:e,range:t,spanAnchor:n}=vpt(f,a,1,o);if(n&&p.push(n),e){f=t,d=!0;continue}}if(s&&f.startColumn!==0){let{hasValue:e,range:t,spanAnchor:n}=hpt(f,a,1,o);if(n&&p.push(n),e){f=t,d=!0;continue}}if(c&&f.endColumn!==i-1){let{hasValue:e,range:t,spanAnchor:n}=gpt(f,a,1,o);if(n&&p.push(n),e){f=t,d=!0;continue}}}return p.length>0&&(f=n_.union(f,...p)),f}var bpt=e=>{let t=new Mh;return e.forEach(e=>{Kg.foreach(e,(e,n)=>{t.setValue(e,n,1)})}),t.forValue((e,n)=>{let r=t.getValue(e-1,n);r&&t.setValue(e,n,r+1)}),t},xpt=e=>{let t={area:0},n=(e,n)=>t.area<e&&(t.area=e,t.range=n,!0);return e.forValue((t,r,i)=>{let a=1,o=i;n(a*o,{startRow:t-o+1,endRow:t,startColumn:r,endColumn:r});let s={startRow:t-o+1,endRow:t,startColumn:0,endColumn:r};for(let i=r-1;i>=0&&e.getValue(t,i);i--){o=Math.min(e.getValue(t,i)||0,o),a++;let r=o*a;s.startColumn=i,s.startRow=t-o+1,n(r,s)}}),t},Spt=(e,t)=>{Kg.foreach(t,(t,n)=>{e.realDeleteValue(t,n)});for(let n=t.startColumn;n<=t.endColumn;n++){let r=t.endRow+1;if(e.getValue(r,n)>0){e.setValue(r,n,1);let t=r+1;for(;e.getValue(t,n)>0;)e.setValue(t,n,e.getValue(t-1,n)+1),t++}}return e},Cpt=e=>{let t=[],n=xpt(e);for(;n.area>0;)n.range&&(t.push(n.range),Spt(e,n.range)),n=xpt(e);return t},uK=e=>Cpt(bpt(e)),dK=1.5,fK=`rgba(255, 255, 255, 0.01)`;function pK(e){let{rangeWithCoord:t,primaryWithCoord:n,style:r}=e,i={range:{startRow:t.startRow,startColumn:t.startColumn,endRow:t.endRow,endColumn:t.endColumn,rangeType:t.rangeType,unitId:t.unitId,sheetId:t.sheetId},primary:null,style:r};return n!=null&&(i.primary=mK(n)),i}function mK(e){let{actualRow:t,actualColumn:n,isMerged:r,isMergedMainCell:i}=e,{startRow:a,startColumn:o,endRow:s,endColumn:c}=e.mergeInfo;return{actualRow:t,actualColumn:n,isMerged:r,isMergedMainCell:i,startRow:a,startColumn:o,endRow:s,endColumn:c}}var wpt=function(e){return e[e.Tab=1]=`Tab`,e[e.Comma=2]=`Comma`,e[e.Semicolon=4]=`Semicolon`,e[e.Space=8]=`Space`,e[e.Custom=16]=`Custom`,e}({}),Tpt=class{constructor(){Z(this,`_tabCount`,0),Z(this,`_commaCount`,0),Z(this,`_semicolonCount`,0),Z(this,`_spaceCount`,0)}add(e){switch(e){case` `:this._tabCount++;break;case`,`:this._commaCount++;break;case`;`:this._semicolonCount++;break;case` `:this._spaceCount++}}update(e){e&&typeof e==`string`&&(e.includes(` `)&&this._tabCount++,e.includes(`,`)&&this._commaCount++,e.includes(`;`)&&this._semicolonCount++,e.trim().includes(` `)&&this._spaceCount++)}getDelimiter(){let e=Math.max(this._tabCount,this._commaCount,this._semicolonCount,this._spaceCount);return e===0||e===this._tabCount?1:e===this._commaCount?2:e===this._semicolonCount?4:e===this._spaceCount?8:1}};function Ept(e,t,n){let r=[];n!==void 0&&(e&16)>0&&r.push(n),(e&1)>0&&r.push(` `),(e&2)>0&&r.push(`,`),(e&4)>0&&r.push(`;`),(e&8)>0&&r.push(` `);let i=``;for(let e of r)i+=op(e);let a=`[${i}]`;return t&&(a+=`+`),new RegExp(a)}var Dpt=e=>e.body?.dataStream.replace(/\r\n$/,``)||``;function Opt(e){if(e!=null){if(e.p)return Dpt(e.p);if(e.v&&typeof e.v==`string`)return e.v;if(e.t&&(e.t===Mp.FORCE_STRING||e.t===Mp.STRING))return String(e.v)}}function kpt(e,t,n,r,i=!1){let{startColumn:a,startRow:o,endColumn:s,endRow:c}=Kg.transformRange(t,e);if(a!==s)throw Error(`The range must be in the same column.`);if(n&&(n&16)>0&&(r===void 0||r.length!==1))throw Error(`The custom delimiter must a character.`);let l=n===void 0,u=l?new Tpt:null,d=[];for(let t=o;t<=c;t++){let n=Opt(e.getCell(t,a));d.push(n),u&&u.update(n)}let f=Ept(l?u.getDelimiter():n,i,r),p=-1,m=0,h=0,g=[];for(let e of d){if(e!==void 0){let t=String(e).split(f);p=p<0?t.length:Math.max(p,t.length),g.push(t),m=h}else g.push(void 0);h++}return{rs:g,maxLength:p===-1?0:p,lastRow:m}}var Apt=(e,t,n=``)=>e.reduce((e,r)=>{let i=r&&r[t];return typeof i==`string`?(i?(e[i]||(e[i]=[]),e[i].push(r)):e[n].push(r),e):(console.warn(r,`${t} is not string`),e)},{}),jpt=(e=0)=>{let t=e;return function(){return t++}};function Mpt(e){return e==null?!1:e.v!==void 0&&e.v!==null&&e.v!==``||e.p!==void 0}function Npt(e,t){for(let n=e.startRow;n<=e.endRow;n++)for(let r=e.startColumn;r<=e.endColumn;r++)if(Mpt(t.getCell(n,r)))return{startRow:n,startColumn:r,endRow:n,endColumn:r};return null}function Ppt(e){let t=new Mh;return e.forEach(e=>{let{startRow:n,startColumn:r,endRow:i,endColumn:a}=e;for(let e=n;e<=i;e++)for(let n=r;n<=a;n++)t.setValue(e,n,null)}),t.clone()}function Fpt(e){let t=new Mh;return e.forEach(e=>{let{startRow:n,startColumn:r,endRow:i,endColumn:a}=e;for(let e=n;e<=i;e++)for(let n=r;n<=a;n++)t.setValue(e,n,{v:null,p:null,f:null,si:null,custom:null})}),t.clone()}function Ipt(e){let t=new Mh;return e.forEach(e=>{let{startRow:n,startColumn:r,endRow:i,endColumn:a}=e;for(let e=n;e<=i;e++)for(let n=r;n<=a;n++)t.setValue(e,n,{s:null})}),t.clone()}function hK(e){let{rows:t,cols:n}=e;return{startRow:t[0],endRow:t[t.length-1],startColumn:n[0],endColumn:n[n.length-1]}}function gK(e,t,n,r){let i=t.get(B),a=n?i.getUnit(n,N.UNIVER_SHEET):i.getCurrentUnitOfType(N.UNIVER_SHEET),o=r?a?.getSheetBySheetId(r):a?.getActiveSheet();if(!o)return null;let{startRow:s,endRow:c,startColumn:l,endColumn:u}=e,d=[],f=[];for(let e=s;e<=c;e++)o.getRowFiltered(e)||d.push(e);for(let e=l;e<=u;e++)f.push(e);return{rows:d,cols:f}}function _K(e,t,n,r){let i=rG(t.get(B),{unitId:n,subUnitId:r});if(!i)return e;let{worksheet:a}=i,o=[];for(let t of e){let{startRow:e,endRow:n,startColumn:r,endColumn:i}=t,s=[],c=e;for(let t=e;t<=n;t++)a.getRowFiltered(t)?(c<t&&s.push([c,t-1]),c=t+1):t===n&&s.push([c,n]);let l=o.findIndex(e=>e.startColumn===r&&e.endColumn===i);l>-1?o[l].rowIntervals=o[l].rowIntervals.concat(s):o.push({startColumn:r,endColumn:i,rowIntervals:s})}let s=[];for(let e of o){let{startColumn:t,endColumn:n,rowIntervals:r}=e,i=Og(r);for(let[e,r]of i)s.push({startRow:e,endRow:r,startColumn:t,endColumn:n})}return s}function Lpt(e){return JSON.stringify(e.filter(Boolean))}function vK(e){try{let t=JSON.parse(e);if(Array.isArray(t)&&t.every(e=>typeof e==`string`))return t.filter(Boolean)}catch{}return e.split(`,`).filter(Boolean)}var yK=function(e){return e.OthersCanView=`othersCanView`,e.NoOneElseCanView=`noOneElseCanView`,e}({}),bK=function(e){return e.DesignedUserCanEdit=`designedUserCanEdit`,e.OnlyMe=`onlyMe`,e}({}),xK=class{constructor(){Z(this,`_model`,new Map),Z(this,`_ruleChange$`,new io),Z(this,`ruleChange$`,this._ruleChange$.asObservable()),Z(this,`_ruleRefresh$`,new io),Z(this,`ruleRefresh$`,this._ruleRefresh$.asObservable()),Z(this,`_rangeRuleInitStateChange`,new oo(!1)),Z(this,`rangeRuleInitStateChange$`,this._rangeRuleInitStateChange.asObservable())}dispose(){this._ruleChange$.complete(),this._ruleRefresh$.complete()}ruleRefresh(e){this._ruleRefresh$.next(e)}getRangeRuleInitState(){return this._rangeRuleInitStateChange.value}changeRuleInitState(e){this._rangeRuleInitStateChange.next(e)}addRule(e,t,n){this._ensureRuleMap(e,t).set(n.id,n),this._ruleChange$.next({unitId:e,subUnitId:t,rule:n,type:`add`})}deleteRule(e,t,n){var r;let i=(r=this._model.get(e))==null||(r=r.get(t))==null?void 0:r.get(n);if(i){var a;(a=this._model.get(e))==null||(a=a.get(t))==null||a.delete(n),this._ruleChange$.next({unitId:e,subUnitId:t,rule:i,type:`delete`})}}setRule(e,t,n,r){let i=this.getRule(e,t,n);if(i){var a;(a=this._model.get(e))==null||(a=a.get(t))==null||a.set(n,r),this._ruleChange$.next({unitId:e,subUnitId:t,oldRule:i,rule:r,type:`set`})}}getRule(e,t,n){var r;return(r=this._model.get(e))==null||(r=r.get(t))==null?void 0:r.get(n)}getSubunitRuleList(e,t){return[...(this._model.get(e)?.get(t)||new Map).values()]}getSubunitRuleListLength(e,t){let n=this._model.get(e)?.get(t);return n?n.size:0}_ensureRuleMap(e,t){let n=this._model.get(e);n||(n=new Map,this._model.set(e,n));let r=n.get(t);return r||(r=new Map,n.set(t,r)),r}toObject(){let e={};return[...this._model.keys()].forEach(t=>{let n=this._model.get(t),r=[...n.keys()];e[t]={},r.forEach(r=>{let i=n.get(r);e[t][r]=[...i.values()]})}),e}fromObject(e){let t=new Map;Object.keys(e).forEach(n=>{let r=e[n],i=new Map;Object.keys(r).forEach(e=>{let t=r[e].reduce((e,t)=>(e.set(t.id,t),e),new Map);i.set(e,t)}),t.set(n,i)}),this._model=t}deleteUnitModel(e){this._model.delete(e)}createRuleId(e,t){let n=np(4),r=this._ensureRuleMap(e,t);for(;r.has(n);)n=np(4);return n}getTargetByPermissionId(e,t){let n=this._model.get(e);if(!n)return null;for(let[r,i]of n)for(let n of i.values())if(n.permissionId===t)return[e,r];return null}},SK={id:`sheet.mutation.delete-range-protection`,type:R.MUTATION,handler:(e,t)=>{let{unitId:n,subUnitId:r,ruleIds:i}=t,a=e.get(xK);return i.forEach(e=>{a.deleteRule(n,r,e)}),!0}},CK={id:`sheet.mutation.add-range-protection`,type:R.MUTATION,handler:(e,t)=>{let{unitId:n,subUnitId:r,rules:i}=t,a=e.get(xK);return i.forEach(e=>{a.addRule(n,r,e)}),!0}},Rpt={type:R.COMMAND,id:`sheet.command.add-range-protection`,async handler(e,t){if(!t)return!1;let n=e.get(z),r=e.get($b),i=e.get(xK),{rule:a,permissionId:o}=t,{unitId:s,subUnitId:c,ranges:l,description:u,viewState:d,editState:f}=a,p=[{ranges:l,permissionId:o,id:i.createRuleId(s,c),description:u,unitType:a.unitType,unitId:s,subUnitId:c,viewState:d,editState:f}];if(await n.executeCommand(CK.id,{unitId:s,subUnitId:c,rules:p})){let e=[{id:CK.id,params:{unitId:s,subUnitId:c,rules:p}}],t=[{id:SK.id,params:{unitId:s,subUnitId:c,ruleIds:p.map(e=>e.id)}}];r.pushUndoRedo({unitID:s,redoMutations:e,undoMutations:t})}return!0}},wK=function(e){return e[e.MOVE_START=0]=`MOVE_START`,e[e.MOVING=1]=`MOVING`,e[e.MOVE_END=2]=`MOVE_END`,e[e.ONLY_SET=3]=`ONLY_SET`,e}({}),zpt=class extends F{constructor(e){super(),this._workbook=e,Z(this,`_worksheetSelections`,new Map),Z(this,`_worksheetLastSelectionPrimaryCell`,new Map),Z(this,`_selectionMoveStart$`,new io),Z(this,`selectionMoveStart$`,this._selectionMoveStart$.asObservable()),Z(this,`_selectionMoving$`,new io),Z(this,`selectionMoving$`,this._selectionMoving$.asObservable()),Z(this,`_selectionMoveEnd$`,new oo([])),Z(this,`selectionMoveEnd$`,this._selectionMoveEnd$.asObservable()),Z(this,`_selectionSet$`,new oo([])),Z(this,`selectionSet$`,this._selectionSet$.asObservable()),Z(this,`selectionChanged$`,void 0),Z(this,`_beforeSelectionMoveEnd$`,new oo([])),Z(this,`beforeSelectionMoveEnd$`,this._beforeSelectionMoveEnd$.asObservable()),this.selectionChanged$=Ns(this._selectionMoveEnd$,this._selectionSet$)}dispose(){super.dispose(),this._beforeSelectionMoveEnd$.complete(),this._selectionMoveEnd$.complete(),this._selectionMoving$.complete(),this._selectionMoveStart$.complete(),this._selectionSet$.complete(),this._workbook=null,this.clear()}addSelections(e,t){let n=this.getSelectionsOfWorksheet(e);n.push(...t),this._selectionSet$.next(n)}setSelections(e,t=[],n){switch(this.setSelectionsOfWorksheet(e,t),n){case 0:this._selectionMoveStart$.next(t);break;case 1:this._selectionMoving$.next(t);break;case 2:this._beforeSelectionMoveEnd$.next(t),this._selectionMoveEnd$.next(t);break;case 3:this._selectionSet$.next(t);break;default:this._selectionSet$.next(t)}}getCurrentSelections(){return this._getCurrentSelections()}getSelectionOfWorksheet(e){return this.getSelectionsOfWorksheet(e)}getSelectionsOfWorksheet(e){return this._worksheetSelections.has(e)||this._worksheetSelections.set(e,[]),this._worksheetSelections.get(e)}getLastSelectionPrimaryCellOfWorksheet(e){return this._worksheetLastSelectionPrimaryCell.get(e)??null}setSelectionsOfWorksheet(e,t){this._worksheetSelections.set(e,[...t]),t.length>0&&t[t.length-1].primary&&this._worksheetLastSelectionPrimaryCell.set(e,t[t.length-1].primary)}deleteSheetSelection(e){this._worksheetSelections.set(e,[]),this._worksheetLastSelectionPrimaryCell.delete(e)}clear(){this._worksheetSelections.clear(),this._worksheetLastSelectionPrimaryCell.clear(),this._selectionSet$.next([])}_getCurrentSelections(){return this.getSelectionsOfWorksheet(this._workbook.getActiveSheet().getSheetId())}getCurrentLastSelection(){let e=this._getCurrentSelections();return e[e.length-1]}},TK=class extends Wf{get _currentSelectionPos(){let e=this._instanceSrv.getCurrentUnitOfType(N.UNIVER_SHEET);if(!e)return null;let t=e.getActiveSheet();return{unitId:e.getUnitId(),sheetId:t.getSheetId()}}get currentSelectionParam(){return this._currentSelectionPos}constructor(e){super(),this._instanceSrv=e,Z(this,`_cellStylesCache`,new Map),Z(this,`selectionMoveStart$`,void 0),Z(this,`selectionMoving$`,void 0),Z(this,`selectionMoveEnd$`,void 0),Z(this,`selectionSet$`,void 0),Z(this,`selectionChanged$`,void 0),Z(this,`_workbookSelections`,new Map),this._init()}_init(){let e=this._instanceSrv.getCurrentTypeOfUnit$(N.UNIVER_SHEET).pipe(rc({bufferSize:1,refCount:!0}),sc(this.dispose$));this.selectionMoveStart$=e.pipe(oc(e=>e?this._ensureWorkbookSelection(e.getUnitId()).selectionMoveStart$:es()),sc(this.dispose$)),this.selectionMoving$=e.pipe(oc(e=>e?this._ensureWorkbookSelection(e.getUnitId()).selectionMoving$:es()),sc(this.dispose$)),this.selectionMoveEnd$=e.pipe(oc(e=>e?this._ensureWorkbookSelection(e.getUnitId()).selectionMoveEnd$:es([])),sc(this.dispose$)),this.selectionSet$=e.pipe(oc(e=>e?this._ensureWorkbookSelection(e.getUnitId()).selectionSet$:es([])),sc(this.dispose$)),this.selectionChanged$=e.pipe(oc(e=>e?this._ensureWorkbookSelection(e.getUnitId()).selectionChanged$:es([])),Js((e,t)=>e.length===t.length?e.length===0&&t.length===0||e.every((e,n)=>JSON.stringify(e)===JSON.stringify(t[n])):!1),ic(1),sc(this.dispose$),tc()),this.disposeWithMe(this._instanceSrv.getTypeOfUnitDisposed$(N.UNIVER_SHEET).pipe(sc(this.dispose$)).subscribe(e=>{this._removeWorkbookSelection(e.getUnitId())})),this.disposeWithMe(this.selectionChanged$.pipe(sc(this.dispose$)).subscribe(()=>{this._cellStylesCache.clear()}))}dispose(){super.dispose(),this._cellStylesCache.clear(),this._workbookSelections.forEach(e=>e.dispose()),this._workbookSelections.clear(),this.selectionMoveStart$=es(null),this.selectionMoving$=es(null),this.selectionMoveEnd$=es([]),this.selectionSet$=es(null),this.selectionChanged$=es(null)}clear(){this._workbookSelections.forEach(e=>e.clear())}getCurrentSelections(){return this._getCurrentSelections()}getCurrentLastSelection(){let e=this._getCurrentSelections();return e?.[e.length-1]}getCurrentLastSelectionPrimaryCell(){let e=this._currentSelectionPos;if(!e)return null;let{unitId:t,sheetId:n}=e;return this._ensureWorkbookSelection(t).getLastSelectionPrimaryCellOfWorksheet(n)}addSelections(e,t,n){if(typeof e==`string`){this._ensureWorkbookSelection(e).addSelections(t,n);return}let r=this._currentSelectionPos;if(!r)throw Error(`[SheetsSelectionsService]: cannot find current selection position!`);let{unitId:i,sheetId:a}=r;this._ensureWorkbookSelection(i).addSelections(a,e)}setSelections(e,t,n,r){if(typeof e==`string`&&typeof t==`string`){let i=e;this._ensureWorkbookSelection(i).setSelections(t,n||[],r??3);return}let i=this._currentSelectionPos;if(!i)throw Error(`[SheetsSelectionsService]: cannot find current selection position!`);let{unitId:a,sheetId:o}=i;if(typeof e==`object`){let r=e??n,i=t??3;this._ensureWorkbookSelection(a).setSelections(o,r,i)}}clearCurrentSelections(){this._getCurrentSelections().splice(0)}isOverlapping(){let e=this.getCurrentSelections();return e!=null&&e.some(({range:t},n)=>e.some(({range:e},r)=>n!==r&&t.startRow<=e.endRow&&t.endRow>=e.startRow&&t.startColumn<=e.endColumn&&t.endColumn>=e.startColumn))}_getCurrentSelections(){let e=this._currentSelectionPos;if(!e)return[];let{unitId:t,sheetId:n}=e;return this._ensureWorkbookSelection(t).getSelectionsOfWorksheet(n)}getWorkbookSelections(e){return this._ensureWorkbookSelection(e)}_ensureWorkbookSelection(e){let t=this._workbookSelections.get(e);if(!t){let n=this._instanceSrv.getUnit(e);if(!n)throw Error(`[SheetsSelectionsService]: cannot resolve unit with id "${e}"!`);t=new zpt(n),this._workbookSelections.set(e,t)}return t}_removeWorkbookSelection(e){this._workbookSelections.delete(e)}getCellStylesProperty(e){let t=this._instanceSrv.getCurrentUnitOfType(N.UNIVER_SHEET)?.getActiveSheet(),n=this.getCurrentSelections();if(!t||n.length===0)return{isAllValuesSame:!1,value:null};let r=null;for(let i=0;i<n.length;i++){let{startRow:a,endRow:o,startColumn:s,endColumn:c}=n[i].range;for(let n=a;n<=o;n++)for(let i=s;i<=c;i++){let a=`${n}_${i}`,o;this._cellStylesCache.has(a)?o=this._cellStylesCache.get(a):(o=t.getComposedCellStyle(n,i),this._cellStylesCache.set(a,o));let s=o[e];if(r!=null&&!I.diffValue(r,s))return{isAllValuesSame:!1,value:null};r=s}}return{isAllValuesSame:!0,value:r}}};TK=dG([uG(0,B)],TK);var EK=`SELECTIONS_ENABLED`,DK=`REF_SELECTIONS_ENABLED`,OK=class extends F{constructor(e,t){super(),this._injector=e,this._univerInstanceService=t,Z(this,`_sceneMap`,new Map),Z(this,`_sheetSkeletonParamStore`,new Map),Z(this,`_buildSkeleton$`,new io),Z(this,`buildSkeleton$`,this._buildSkeleton$.asObservable()),this._init()}dispose(){super.dispose(),this._sheetSkeletonParamStore.forEach(e=>e.forEach(e=>e.skeleton.dispose())),this._sheetSkeletonParamStore.clear()}_disposeByUnitId(e){let t=this._sheetSkeletonParamStore.get(e);t&&(t.forEach(e=>e.skeleton.dispose()),this._sheetSkeletonParamStore.delete(e))}_init(){this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(N.UNIVER_SHEET).subscribe(e=>this._initWorkbookSkeleton(e.unit))),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(N.UNIVER_SHEET).subscribe(e=>this._disposeByUnitId(e.getUnitId())))}_initWorkbookSkeleton(e){let t=e.getUnitId();this._initSheetsSkeleton(e),this.disposeWithMe(e.sheetCreated$.subscribe(n=>{let r=this._sheetSkeletonParamStore.get(t);if(!r)return;let i=n.getSheetId(),a=this._buildSkeleton(n,e.getStyles());r.set(i,{unitId:t,sheetId:i,skeleton:a,dirty:!1})})),this.disposeWithMe(e.sheetDisposed$.subscribe(e=>{let n=this._sheetSkeletonParamStore.get(t);if(!n)return;let r=e.getSheetId(),i=n.get(r);i&&i.skeleton.dispose(),n.delete(r)}))}_initSheetsSkeleton(e){let t=e.getUnitId(),n=new Map;e.getWorksheets().forEach(r=>{let i=r.getSheetId(),a=this._buildSkeleton(r,e.getStyles());n.set(i,{unitId:t,sheetId:i,skeleton:a,dirty:!1})}),this._sheetSkeletonParamStore.set(t,n)}_buildSkeleton(e,t){let n=this._injector.createInstance(JT,e,t),r=e.getUnitId(),i=this._sceneMap.get(r);return i&&n.setScene(i),this._buildSkeleton$.next(n),n}setScene(e,t){this._sceneMap.set(e,t);let n=this._sheetSkeletonParamStore.get(e);n&&n.forEach(e=>e.skeleton.setScene(t))}getSkeletonsByUnitId(e){let t=this._sheetSkeletonParamStore.get(e);return t?Array.from(t.values()).map(e=>e.skeleton):[]}getSkeleton(e,t){return this.getSkeletonParam(e,t)?.skeleton}getSkeletonParam(e,t){let n=this._sheetSkeletonParamStore.get(e);if(n)return n.get(t)}newSkeleton(e,t,n,r){return this.newSkeletonParam(e,t,n,r).skeleton}newSkeletonParam(e,t,n,r){let i=this._buildSkeleton(n,r),a=this._sheetSkeletonParamStore.get(e);a||(a=new Map,this._sheetSkeletonParamStore.set(e,a));let o={unitId:e,sheetId:t,skeleton:i,dirty:!1};return a.set(t,o),o}ensureSkeleton(e,t){let n=this.getSkeleton(e,t);if(n)return n;let r=this._univerInstanceService.getUnit(e);if(!r)return;let i=r.getSheetBySheetId(t);if(i)return this.newSkeleton(e,t,i,r.getStyles())}};OK=dG([uG(0,M(Ue)),uG(1,M(B))],OK);function kK(e,t){let n=new Mh;return e.map(e=>Kg.transformRange(e,t)).forEach(e=>{Kg.foreach(e,(e,r)=>{let i=t.getCellHeight(e,r);i&&n.setValue(e,r,i)})}),n}var Bpt=1e4;function AK(e,t){if(!t)return{suitableRanges:e,remainingRanges:[]};let n=t.worksheet.getColumnCount(),r=Math.ceil(Bpt/n),i=[],a=[],o=t.getOffsetRelativeToRowCol(0,t.scrollY).row,s=e.map(e=>{let t;return t=o>=e.startRow&&o<=e.endRow?0:o<e.startRow?e.startRow-o:o-e.endRow,{range:e,distance:t,rowCount:e.endRow-e.startRow+1}});s.sort((e,t)=>e.distance===t.distance?e.rowCount-t.rowCount:e.distance-t.distance);let c=0;for(let e of s)if(c+e.rowCount<=r)i.push(e.range),c+=e.rowCount;else{let t=r-c;if(t>0){let n={...e.range,endRow:e.range.startRow+t-1},o={...e.range,startRow:e.range.startRow+t};i.push(n),a.push(o),c=r}else a.push(e.range)}return{suitableRanges:i,remainingRanges:a}}function Vpt(e){let t=0;return e.forEach(()=>{t++}),t}var jK={id:`sheet.command.clear-selection-all`,type:R.COMMAND,handler:(e,t)=>{let n=rG(e.get(B),{unitId:t?.unitId,subUnitId:t?.subUnitId});if(!n)return!1;let r=e.get(TK),{unitId:i,subUnitId:a}=n,o=t?.ranges||r.getCurrentSelections()?.map(e=>e.range);if(!o?.length)return!1;let s=e.get(OK).getSkeleton(i,a);if(!s)return!1;let c=e.get(z),l=e.get($b),u=e.get(hG),d=[],f=[],p={subUnitId:a,unitId:i,cellValue:Ppt(_K(o,e,i,a))},m=UG(e,p);d.push({id:WG.id,params:p}),f.push({id:WG.id,params:m});let h=u.onCommandExecute({id:jK.id,params:t});d.push(...h.redos),f.unshift(...h.undos);let g=Bm(d,c),{suitableRanges:_,remainingRanges:v}=AK(o,s),{undos:y,redos:b}=u.generateMutationsOfAutoHeight({unitId:i,subUnitId:a,ranges:_,autoHeightRanges:_,lazyAutoHeightRanges:v}),x=Bm(b,c);return g.result&&x.result?(d.push(...b),f.push(...y),l.pushUndoRedo({unitID:i,undoMutations:f,redoMutations:d}),!0):!1}},MK={id:`sheet.command.clear-selection-format`,type:R.COMMAND,handler:(e,t)=>{let n=rG(e.get(B),{unitId:t?.unitId,subUnitId:t?.subUnitId});if(!n)return!1;let r=e.get(TK),{unitId:i,subUnitId:a}=n,o=t?.ranges||r.getCurrentSelections()?.map(e=>e.range);if(!o?.length)return!1;let s=e.get(OK).getSkeleton(i,a);if(!s)return!1;let c=e.get(z),l=e.get($b),u=e.get(hG),d=[],f=[],p={subUnitId:a,unitId:i,cellValue:Ipt(_K(o,e,i,a))},m=UG(e,p);d.push({id:WG.id,params:p}),f.push({id:WG.id,params:m});let h=u.onCommandExecute({id:MK.id,params:t});d.push(...h.redos),f.unshift(...h.undos);let g=Bm(d,c),{suitableRanges:_,remainingRanges:v}=AK(o,s),{undos:y,redos:b}=u.generateMutationsOfAutoHeight({unitId:i,subUnitId:a,ranges:_,autoHeightRanges:_,lazyAutoHeightRanges:v}),x=Bm(b,c);return g.result&&x.result?(d.push(...b),f.push(...y),l.pushUndoRedo({unitID:i,undoMutations:f,redoMutations:d}),!0):!1}};function NK(e,t,n=!0){let r=t.getMatrixWithMergedCells(...mee(e)),i=[];if(r.forValue((t,n,r)=>{if(r.colSpan!==void 0&&r.rowSpan!==void 0){let a={startRow:t,startColumn:n,endRow:t+r.rowSpan-1,endColumn:n+r.colSpan-1};n_.contains(e,a)||i.push(a)}}),i.length===0)return e;let a=n_.union(e,...i);return n?NK(a,t,n):a}function PK(e,t,n){let r=null;return n.getMatrixWithMergedCells(e,t,e,t).forValue((e,t,n)=>(r={actualRow:e,actualColumn:t,startRow:e,startColumn:t,isMerged:n.rowSpan!==void 0||n.colSpan!==void 0,isMergedMainCell:n.rowSpan!==void 0&&n.colSpan!==void 0,endRow:e+(n.rowSpan===void 0?0:n.rowSpan-1),endColumn:t+(n.colSpan===void 0?0:n.colSpan-1),rangeType:fh.NORMAL},!1)),r||{actualColumn:t,actualRow:e,startRow:e,startColumn:t,endRow:e,endColumn:t,isMerged:!1,isMergedMainCell:!1,rangeType:fh.NORMAL}}function Hpt(e,t,n){let{startRow:r,startColumn:i,endRow:a,endColumn:o}=e;return Number.isNaN(r)&&(e.startRow=0),Number.isNaN(a)&&(e.endRow=t-1),Number.isNaN(i)&&(e.startColumn=0),Number.isNaN(o)&&(e.endColumn=n-1),e}function FK(e,t){let n=Number.isNaN(e.startRow)?0:e.startRow,r=Number.isNaN(e.startColumn)?0:e.startColumn,i=t.getMergedCell(n,r);return i?{...i,actualRow:n,actualColumn:r,rangeType:fh.NORMAL,isMerged:!0,isMergedMainCell:!0}:{startRow:n,startColumn:r,endRow:e.startRow,endColumn:e.startColumn,actualRow:n,actualColumn:r,rangeType:fh.NORMAL,isMerged:!1,isMergedMainCell:!1}}var IK=(e,t,n)=>({id:VK.id,params:{unitId:t.getUnitId(),subUnitId:n.getSheetId(),reveal:!0,selections:[{range:e,primary:FK(e,n)}]}});function Upt(e){if(!e)return!1;let{range:t,primary:n}=e;return n_.equals(t,n)}function Wpt(e){function t(t,n){function r(t){for(let r=t.startRow;r<=t.endRow;r++)if(!e.getRowFiltered(r))for(let e=t.startColumn;e<=t.endColumn;e++)n(r,e,t)}r(t)}return{forOperableEach:t}}var Gpt=e=>e.id!==eft;function LK(e,t,n,r,i,a,o){let s={};for(let c=t;c<=n;c++)for(let t=r;t<=i;t++){let n=a?e.getCellWithFilteredInterceptors(o,t,tft,Gpt):e.getCellWithFilteredInterceptors(c,o,tft,Gpt);n&&n.s&&(s[c]||(s[c]={}),s[c][t]={s:n.s})}for(let e in s){for(let t in s[e]){let n=s[e][t];n.s&&typeof n.s==`object`&&I.isEmptyObject(n.s)&&delete n.s,I.isEmptyObject(n)&&delete s[e][t]}I.isEmptyObject(s[e])&&delete s[e]}return s}var RK=se(`sheets-formula.ref-selections.service`),zK=class extends TK{constructor(e){super(e)}_init(){let e=this._getAliveWorkbooks$().pipe(sc(this.dispose$));this.selectionMoveStart$=e.pipe(oc(e=>Ns(...e.map(e=>e.selectionMoveStart$)))),this.selectionMoving$=e.pipe(oc(e=>Ns(...e.map(e=>e.selectionMoving$)))),this.selectionMoveEnd$=e.pipe(oc(e=>Ns(...e.map(e=>e.selectionMoveEnd$)))),this.selectionSet$=e.pipe(oc(e=>Ns(...e.map(e=>e.selectionSet$))))}dispose(){super.dispose(),this.selectionMoveStart$=es(null),this.selectionMoving$=es(null),this.selectionMoveEnd$=es(null),this.selectionSet$=es(null),delete this._instanceSrv,this._workbookSelections.clear()}_getAliveWorkbooks$(){let e=this._instanceSrv.getAllUnitsForType(N.UNIVER_SHEET);e.forEach(e=>this._ensureWorkbookSelection(e.getUnitId()));let t=new oo(e);return this.disposeWithMe(this._instanceSrv.getTypeOfUnitAdded$(N.UNIVER_SHEET).subscribe(e=>{let{unit:n}=e;this._ensureWorkbookSelection(n.getUnitId()),t.next([...t.getValue(),n])})),this.disposeWithMe(this._instanceSrv.getTypeOfUnitDisposed$(N.UNIVER_SHEET).subscribe(e=>{this._removeWorkbookSelection(e.getUnitId()),t.next(t.getValue().filter(t=>t!==e))})),t.pipe(as(e=>e.map(e=>this._ensureWorkbookSelection(e.getUnitId()))))}};zK=dG([uG(0,B)],zK);function BK(e,t){let n=e.get(Am).getContextValue(DK);return e.get(n&&!t?RK:TK)}var VK={id:`sheet.operation.set-selections`,type:R.OPERATION,handler:(e,t)=>{if(!t)return!1;let{selections:n,type:r,unitId:i,subUnitId:a}=t;return BK(e).setSelections(i,a,[...n],r),!0}},Kpt={id:`sheet.command.select-range`,type:R.COMMAND,handler:(e,t)=>{if(!t)return!1;let{unitId:n,subUnit:r,range:i}=t,a=e.get(z),o=rG(e.get(B),t);if(!o)return!1;let s=[{range:i,primary:FK(i,o.worksheet),style:null}];return a.syncExecuteCommand(VK.id,{unitId:n,subUnitId:r,selections:s})}},qpt=`sheet.command.move-range`,HK={type:R.COMMAND,id:qpt,handler:async(e,t)=>{let n=e.get(z),r=e.get($b),i=e.get(Wy),a=e.get(Rb);if(!await e.get(hG).beforeCommandExecute({id:HK.id,params:t}))return!1;let o=Ypt(e,t);return o?Bm(o.redos,n).result?(r.pushUndoRedo({unitID:o.unitId,undoMutations:o.undos,redoMutations:o.redos}),!0):!1:(i.emit(a.t(`sheets.info.acrossMergedCell`)),!1)}};function Jpt(e,t){let n=e.get(B),r=rG(n),i=t.toUnitId??t.fromUnitId??r?.unitId,a=t.fromSubUnitId??r?.subUnitId,o=t.toSubUnitId??t.fromSubUnitId??r?.subUnitId;if(!i||!a||!o||t.fromUnitId&&t.toUnitId&&t.fromUnitId!==t.toUnitId)return null;let s=n.getUniverSheetInstance(i),c=s?.getSheetBySheetId(a),l=s?.getSheetBySheetId(o);return!c||!l?null:{unitId:i,fromSubUnitId:a,toSubUnitId:o,fromWorksheet:c,toWorksheet:l}}function Ypt(e,t,n={}){let{includeSelection:r=!0,includeAfterCommand:i=!0,includeAutoHeight:a=!0}=n,o=Jpt(e,t);if(!o)return null;let s=e.get(hG),{unitId:c,fromSubUnitId:l,toSubUnitId:u,fromWorksheet:d,toWorksheet:f}=o,p=UK(e,{unitId:c,subUnitId:l,range:t.fromRange},{unitId:c,subUnitId:u,range:t.toRange});if(p===null)return null;let m={id:HK.id,params:t},h=s.onCommandExecute(m),g=[...h.preRedos??[],...p.redos,...h.redos],_=[...h.preUndos??[],...p.undos,...h.undos];if(r&&(g.push({id:VK.id,params:{unitId:c,subUnitId:u,selections:[{range:t.toRange,primary:Xpt(t.fromRange,t.toRange,d,f)}],type:2}}),_.push({id:VK.id,params:{unitId:c,subUnitId:l,selections:[{range:t.fromRange,primary:FK(t.fromRange,d)}],type:2}})),i){let e=s.afterCommandExecute(m);g.push(...e.redos),_.push(...e.undos)}if(a){let{undos:e,redos:n}=s.generateMutationsOfAutoHeight({unitId:c,subUnitId:u,ranges:l===u?[t.fromRange,t.toRange]:[t.toRange]});g.push(...n),_.push(...e)}return{unitId:c,redos:g,undos:_}}function UK(e,t,n,r=!1){let i=t.unitId,a=e.get(B).getUnit(i,N.UNIVER_SHEET);if(!a)return null;let{subUnitId:o,range:s}=t,{subUnitId:c,range:l}=n,u=a.getSheetBySheetId(o),d=a.getSheetBySheetId(c);if(!u||!d)return null;let f=NK(l,d,!1);if(!n_.equals(l,f)&&!r)return null;let p=u.getCellMatrix(),m=d.getCellMatrix(),h=new Mh,g=new Mh,_=new Mh,v=new Mh;Kg.foreach(s,(e,t)=>{let n=I.deepClone(p.getValue(e,t))??null;n?.s&&(n.s=a.getStyles().get(n.s)),h.setValue(e,t,null),g.setValue(e,t,n);let r=Uh(e,t),i=n_.getRelativeRange(r,s),o=n_.getPositionRange(i,l);_.setValue(o.startRow,o.startColumn,I.deepClone(n))}),Kg.foreach(l,(e,t)=>{let n=I.deepClone(m.getValue(e,t))??null;v.setValue(e,t,n)});let y={fromRange:t.range,toRange:n.range,from:{value:h.getMatrix(),subUnitId:o},to:{value:_.getMatrix(),subUnitId:c},unitId:i},b={fromRange:n.range,toRange:t.range,from:{value:v.getMatrix(),subUnitId:c},to:{value:g.getMatrix(),subUnitId:o},unitId:i};return{redos:[{id:EG.id,params:y}],undos:[{id:EG.id,params:b}]}}function Xpt(e,t,n,r=n){let i=e.startRow,a=e.startColumn,o=n.getMergedCell(i,a),s=FK(t,r);if(o){let e=o.endRow-o.startRow+1,t=o.endColumn-o.startColumn+1;s.endRow=s.startRow+e-1,s.endColumn=s.startColumn+t-1,s.actualRow=s.startRow,s.actualColumn=s.startColumn,s.isMerged=!1,s.isMergedMainCell=!0}return s}var WK={id:`sheet.command.set-range-values`,type:R.COMMAND,handler:(e,t)=>{let n=rG(e.get(B),t);if(!n)return!1;let r=e.get(TK).getCurrentSelections()?.map(e=>e.range),{value:i,range:a,redoUndoId:o}=t,s=a?[a]:r;if(!s||!s.length)return!1;let c=e.get(z),l=e.get($b),u=e.get(hG),{subUnitId:d,unitId:f,workbook:p,worksheet:m}=n,h=new Mh,g;if(I.isArray(i))for(let e=0;e<s.length;e++){let{startRow:t,startColumn:n,endRow:r,endColumn:a}=s[e];for(let e=t;e<=r;e++)for(let r=n;r<=a;r++)h.setValue(e,r,i[e-t][r-n])}else if(uh(i))for(let e=0;e<s.length;e++){let{startRow:t,startColumn:n,endRow:r,endColumn:a}=s[e];for(let e=t;e<=r;e++)for(let t=n;t<=a;t++)h.setValue(e,t,i)}else g=i,s=g?[new Mh(g).getStartEndScope()]:[];let _={unitId:f,subUnitId:d,cellValue:g??h.getMatrix()},v=UG(e,_),y=Th(_.cellValue,(e,t)=>m.getCellHeight(e,t)||void 0);if(!c.syncExecuteCommand(WG.id,_))return!1;let{undos:b,redos:x}=u.onCommandExecute({id:WK.id,params:_}),{undos:S,redos:C}=u.generateMutationsOfAutoHeight({unitId:f,subUnitId:d,ranges:s,cellHeights:new Mh(y)});if(Bm([...x,...C],c).result){let e=[{id:WG.id,params:_},...x,...C,IK(s[s.length-1],p,m)],t=[{id:WG.id,params:v},...b,...S];return r&&r.length&&t.push(IK(r[r.length-1],p,m)),l.pushUndoRedo({unitID:f,undoMutations:t,redoMutations:e,id:o}),!0}return!1}};function Zpt(e,t){let n=[],r=[],{unitId:i,subUnitId:a,range:o,shiftDimension:s,cellValue:c={}}=t,l=e.get(B),u=e.get(hG),d=l.getUniverSheetInstance(i)?.getSheetBySheetId(a);if(d){let t=d.getCellMatrix(),l=t.getDataRange();if(o.startColumn<=l.endColumn||o.startRow<=l.endRow){let c,u;if(s===hp.COLUMNS){let e=Math.min(o.endRow,l.endRow),n=0;for(let r=o.startRow;r<=e;r++){let e=t.getRow(r),i=e?Eh(e)-1:0;n=Math.max(n,i)}c={startRow:o.startRow,startColumn:o.startColumn,endRow:e,endColumn:n};let r=o.endColumn-o.startColumn+1;u={startRow:o.startRow,startColumn:c.startColumn+r,endRow:e,endColumn:c.endColumn+r}}else{let e=Math.min(o.endColumn,l.endColumn),t=l.endRow;c={startRow:o.startRow,startColumn:o.startColumn,endRow:t,endColumn:e};let n=o.endRow-o.startRow+1;u={startRow:c.startRow+n,startColumn:o.startColumn,endRow:c.endRow+n,endColumn:e}}let d=UK(e,{unitId:i,subUnitId:a,range:c},{unitId:i,subUnitId:a,range:u},!0);d&&(n.push(...d.redos),r.push(...d.undos))}if(Object.entries(c).length===0)for(let e=o.startRow;e<=o.endRow;e++){c[e]||(c[e]={});for(let t=o.startColumn;t<=o.endColumn;t++)c[e][t]=null}let f={subUnitId:a,unitId:i,cellValue:c},p=UG(e,f),{undos:m,redos:h}=u.onCommandExecute({id:WK.id,params:{...f,range:o}});n.push({id:WG.id,params:f},...h),r.push({id:WG.id,params:p},...m)}return{redo:n,undo:r}}function Qpt(e,t){let n=[],r=[],{unitId:i,subUnitId:a,range:o,shiftDimension:s}=t,c=e.get(B),l=e.get(hG),u=c.getUniverSheetInstance(i)?.getSheetBySheetId(a);if(u){let t=u.getCellMatrix(),c=t.getDataRange(),d={subUnitId:a,unitId:i,cellValue:Ppt([o])},f=UG(e,d),p=l.onCommandExecute({id:WK.id,params:d});if(n.push({id:WG.id,params:d},...p.redos),r.push(...p.undos,{id:WG.id,params:f}),o.startColumn<=c.endColumn||o.startRow<=c.endRow){let l=null,u=null;if(s===hp.COLUMNS&&o.endColumn<c.endColumn){let e=Math.min(o.endRow,c.endRow),n=0;for(let r=o.startRow;r<=e;r++){let e=t.getRow(r),i=e?Eh(e)-1:0;n=Math.max(n,i)}l={startRow:o.startRow,startColumn:o.endColumn+1,endRow:e,endColumn:n};let r=o.endColumn-o.startColumn+1;u={startRow:o.startRow,startColumn:l.startColumn-r,endRow:e,endColumn:l.endColumn-r}}if(s===hp.ROWS&&o.endRow<c.endRow){let e=Math.min(o.endColumn,c.endColumn),t=c.endRow;l={startRow:o.endRow+1,startColumn:o.startColumn,endRow:t,endColumn:e};let n=o.endRow-o.startRow+1;u={startRow:l.startRow-n,startColumn:o.startColumn,endRow:l.endRow-n,endColumn:e}}if(l&&u){let t=UK(e,{unitId:i,subUnitId:a,range:l},{unitId:i,subUnitId:a,range:u},!0);t&&(n.push(...t.redos),r.push(...t.undos))}}}return{redo:n,undo:r}}var $pt=`sheet.command.delete-range-move-left`,GK={type:R.COMMAND,id:$pt,handler:async(e,t)=>{let n=e.get(z),r=e.get($b),i=e.get(B),a=e.get(TK),o=e.get(hG),s=rG(i);if(!s)return!1;let{worksheet:c,workbook:l,subUnitId:u,unitId:d}=s,f=t?.range;if(f||=a.getCurrentLastSelection()?.range,!f)return!1;let p={range:f,subUnitId:u,unitId:d,shiftDimension:hp.COLUMNS},m=o.onCommandExecute({id:GK.id,params:{range:f}}),{redo:h,undo:g}=Qpt(e,p),_=[...m.preRedos??[],...h],v=[...m.undos,...g];if(_.push(...m.redos),_.push(IK(f,l,c)),v.push(...m.preUndos??[]),Bm(_,n).result){let e=o.afterCommandExecute({id:GK.id,params:{range:f}});return Bm(e.redos,n),v.push(...e.undos),_.push(...e.redos),r.pushUndoRedo({unitID:d,undoMutations:v.reverse(),redoMutations:_}),!0}return!1}},emt=`sheet.command.delete-range-move-up`,KK={type:R.COMMAND,id:emt,handler:async(e,t)=>{let n=e.get(z),r=e.get($b),i=e.get(B),a=e.get(TK),o=e.get(hG),s=rG(i);if(!s)return!1;let{unitId:c,subUnitId:l,workbook:u,worksheet:d}=s,f=t?.range;if(f||=a.getCurrentLastSelection()?.range,!f)return!1;let p={range:f,subUnitId:l,unitId:c,shiftDimension:hp.ROWS},m=o.onCommandExecute({id:KK.id,params:{range:f}}),{redo:h,undo:g}=Qpt(e,p),_=[...m.preRedos??[],...h],v=[...m.undos,...g];if(_.push(...m.redos),_.push(IK(f,u,d)),v.push(...m.preUndos??[]),Bm(_,n).result){let e=o.afterCommandExecute({id:KK.id,params:{range:f}});return Bm(e.redos,n),v.push(...e.undos),_.push(...e.redos),r.pushUndoRedo({unitID:c,undoMutations:v.reverse(),redoMutations:_}),!0}return!1}},tmt=`sheet.command.insert-range-move-down`,qK={type:R.COMMAND,id:tmt,handler:async(e,t)=>{let n=e.get(z),r=e.get($b),i=e.get(B),a=e.get(TK),o=e.get(hG),s=e.get(Wy),c=e.get(Rb);if(a.isOverlapping())return s.emit(c.t(`sheets.info.overlappingSelections`)),!1;let l=rG(i);if(!l)return!1;let{unitId:u,subUnitId:d,worksheet:f,workbook:p}=l,m=t?.range;if(m||=a.getCurrentLastSelection()?.range,!m)return!1;let h=[],g=[],_=f.getCellMatrix(),v=_.getDataRange(),y=_.getSlice(v.startRow,v.endRow,m.startColumn,m.endColumn).getDataRange().endRow,b=Math.max(y+(m.endRow-m.startRow+1)-v.endRow,0);if(b>0){let t=m.startRow-1,n=f.getRowHeight(t),r={unitId:u,subUnitId:d,range:{startRow:v.endRow+1,endRow:v.endRow+b,startColumn:v.startColumn,endColumn:v.endColumn},rowInfo:Array(b).fill(void 0).map(()=>({h:n,hd:jp.FALSE}))};h.push({id:CG.id,params:r});let i=SG(e,r);g.push({id:kG.id,params:i})}let x={};Kg.foreach(m,(e,t)=>{let n=f.getCell(e,t);n&&(x[e]||(x[e]={}),x[e][t]={s:n.s})});let{redo:S,undo:C}=Zpt(e,{range:m,subUnitId:d,unitId:u,shiftDimension:hp.ROWS,cellValue:x});h.push(...S),g.push(...C);let w=o.onCommandExecute({id:qK.id,params:{range:m}});if(h.push(...w.redos),h.push(IK(m,p,f)),g.push(...w.preUndos??[]),h.unshift(...w.preRedos??[]),g.unshift(...w.undos),Bm(h,n).result){let e=o.afterCommandExecute({id:qK.id,params:{range:m}});return Bm(e.redos,n),g.push(...e.undos),h.push(...e.redos),r.pushUndoRedo({unitID:u,undoMutations:g.reverse(),redoMutations:h}),!0}return!1}},nmt=`sheet.command.insert-range-move-right`,JK={type:R.COMMAND,id:nmt,handler:async(e,t)=>{let n=e.get(z),r=e.get($b),i=e.get(B),a=e.get(TK),o=e.get(hG),s=e.get(Wy),c=e.get(Rb);if(a.isOverlapping())return s.emit(c.t(`sheets.info.overlappingSelections`)),!1;let l=rG(i);if(!l)return!1;let{workbook:u,worksheet:d,unitId:f,subUnitId:p}=l,m=t?.range;if(m||=a.getCurrentLastSelection()?.range,!m)return!1;let h=[],g=[],_=d.getCellMatrix(),v=_.getDataRange(),y=_.getSlice(m.startRow,m.endRow,v.startColumn,v.endColumn).getDataRange().endColumn,b=Math.max(y+(m.endColumn-m.startColumn+1)-v.endColumn,0);if(b>0){let t=m.startColumn-1,n=d.getColumnWidth(t),r={unitId:f,subUnitId:p,range:{startRow:v.startRow+1,endRow:v.endRow,startColumn:v.endColumn+1,endColumn:v.endColumn+b},colInfo:Array(b).fill(void 0).map(()=>({w:n,hd:jp.FALSE}))};h.push({id:TG.id,params:r});let i=wG(e,r);g.push({id:AG.id,params:i})}let x={};Kg.foreach(m,(e,t)=>{let n=d.getCell(e,t);n&&n.s&&(x[e]||(x[e]={}),x[e][t]={s:n.s})});let{redo:S,undo:C}=Zpt(e,{range:m,subUnitId:p,unitId:f,shiftDimension:hp.COLUMNS,cellValue:x});h.push(...S),g.push(...C);let w=o.onCommandExecute({id:JK.id,params:{range:m}});if(h.push(...w.redos),h.push(IK(m,u,d)),g.push(...w.preUndos??[]),h.unshift(...w.preRedos??[]),g.unshift(...w.undos),Bm(h,n).result){let e=o.afterCommandExecute({id:JK.id,params:{range:m}});return Bm(e.redos,n),g.push(...e.undos),h.push(...e.redos),r.pushUndoRedo({unitID:f,undoMutations:g.reverse(),redoMutations:h}),!0}return!1}},rmt=`sheet.command.insert-row`,YK={type:R.COMMAND,id:rmt,handler:async(e,t)=>{let n=e.get(z),r=e.get(hG),{range:i,direction:a,unitId:o,subUnitId:s,cellValue:c}=t;return await r.beforeCommandExecute({id:YK.id,params:t})?n.syncExecuteCommand(XK.id,{range:i,direction:a,unitId:o,subUnitId:s,cellValue:c}):!1}},XK={type:R.COMMAND,id:`sheet.command.insert-row-by-range`,handler:(e,t)=>{let n=rG(e.get(B),t);if(!n)throw Error(`Workbook or Worksheet not found at InsertRowByRangeCommand`);let{workbook:r,worksheet:i,unitId:a,subUnitId:o}=n,{range:s,direction:c,cellValue:l}=t,{startRow:u,endRow:d}=s;s.rangeType=fh.ROW;let f=c===L.UP?u:u-1;if(f<0||f>i.getRowCount()-1)throw Error(`Anchor row is out of bounds in InsertRowByRangeCommand`);let p=e.get(z),m=e.get($b),h=e.get(hG),g={unitId:a,subUnitId:o,range:s},_=i.getRowHeight(f);_!==i.getConfig().defaultRowHeight&&(g.rowInfo=Array(d-u+1).fill(void 0).map(()=>({h:_,hd:jp.FALSE})));let v=SG(e,g),y=[{id:CG.id,params:g}],b=[{id:kG.id,params:v}];l&&Object.keys(l).length>0&&y.push({id:WG.id,params:{unitId:a,subUnitId:o,cellValue:l}});let x=h.onCommandExecute({id:YK.id,params:t});if(y.unshift(...x.preRedos??[]),y.push(...x.redos??[]),y.push(IK(s,r,i)),b.unshift(...x.preUndos??[]),b.push(...x.undos??[]),Bm(y,p).result){let e=h.afterCommandExecute({id:YK.id,params:t});return Bm(e.redos,p),y.push(...e.redos),b.push(...e.undos),m.pushUndoRedo({unitID:t.unitId,undoMutations:b,redoMutations:y}),!0}return!1}},ZK={type:R.COMMAND,id:`sheet.command.insert-row-before`,handler:async(e,t)=>{let n=e.get(TK).getCurrentSelections()?.map(e=>e.range),r;if(n?.length===1)r=n[0];else return!1;let i=rG(e.get(B));if(!i)return!1;let{worksheet:a,subUnitId:o,unitId:s}=i,c=t.value||0,l=r.startRow,u=r.startRow+c-1,d=a.getColumnCount()-1,f={unitId:s,subUnitId:o,direction:L.UP,range:{startRow:l,endRow:u,startColumn:0,endColumn:d},cellValue:LK(a,l,u,0,d,!0,l-1)};return e.get(z).executeCommand(YK.id,f)}},imt={type:R.COMMAND,id:`sheet.command.insert-row-after`,handler:async e=>{let t=e.get(TK).getCurrentSelections()?.map(e=>e.range),n;if(t?.length===1)n=t[0];else return!1;let r=rG(e.get(B));if(!r)return!1;let{worksheet:i,unitId:a,subUnitId:o}=r,s=n.endRow-n.startRow+1,c=n.endRow+1,l=n.endRow+s,u=i.getColumnCount()-1,d={unitId:a,subUnitId:o,direction:L.DOWN,range:{startRow:c,endRow:l,startColumn:0,endColumn:u,rangeType:fh.ROW},cellValue:LK(i,c,l,0,u,!0,n.endRow)};return e.get(z).executeCommand(YK.id,d)}},QK={type:R.COMMAND,id:`sheet.command.insert-multi-rows-above`,handler:async(e,t)=>{let n=e.get(TK).getCurrentSelections()?.map(e=>e.range),r;if(n?.length===1)r=n[0];else return!1;let i=rG(e.get(B));if(!i)return!1;let{worksheet:a,unitId:o,subUnitId:s}=i,c=t.value||0,l=r.startRow,u=r.startRow+c-1,d=a.getColumnCount()-1,f=LK(a,l,u,0,d,!0,l-1),p={unitId:o,subUnitId:s,direction:L.UP,range:{startRow:l,endRow:u,startColumn:0,endColumn:d,rangeType:fh.ROW},cellValue:f};return e.get(z).executeCommand(YK.id,p)}},$K={type:R.COMMAND,id:`sheet.command.insert-multi-rows-after`,handler:async(e,t)=>{let n=e.get(TK).getCurrentSelections()?.map(e=>e.range),r;if(n?.length===1)r=n[0];else return!1;let i=rG(e.get(B));if(!i)return!1;let{worksheet:a,unitId:o,subUnitId:s}=i,c=t.value||0,l=r.endRow+1,u=r.endRow+c,d=a.getColumnCount()-1,f={unitId:o,subUnitId:s,direction:L.DOWN,range:{startRow:l,endRow:u,startColumn:0,endColumn:d,rangeType:fh.ROW},cellValue:LK(a,l,u,0,d,!0,r.endRow)};return e.get(z).executeCommand(YK.id,f)}},amt=`sheet.command.insert-col`,eq={type:R.COMMAND,id:amt,handler:async(e,t)=>{let n=e.get(z),r=e.get(hG),{range:i,direction:a,subUnitId:o,unitId:s,cellValue:c}=t;return await r.beforeCommandExecute({id:eq.id,params:t})?n.syncExecuteCommand(tq.id,{range:i,direction:a,unitId:s,subUnitId:o,cellValue:c}):!1}},tq={type:R.COMMAND,id:`sheet.command.insert-col-by-range`,handler:(e,t)=>{let n=rG(e.get(B),t);if(!n)throw Error(`Workbook or Worksheet not found at InsertColByRangeCommand`);let{workbook:r,worksheet:i,unitId:a,subUnitId:o}=n,{range:s,direction:c,cellValue:l}=t,{startColumn:u,endColumn:d}=s;s.rangeType=fh.COLUMN;let f=c===L.LEFT?u:u-1;if(f<0||f>i.getColumnCount()-1)throw Error(`Anchor column is out of bounds in InsertColByRangeCommand`);let p=e.get(z),m=e.get($b),h=e.get(hG),g={unitId:a,subUnitId:o,range:s},_=i.getColumnWidth(f);_!==i.getConfig().defaultColumnWidth&&(g.colInfo=Array(d-u+1).fill(void 0).map(()=>({w:_,hd:jp.FALSE})));let v=wG(e,g),y=[{id:TG.id,params:g}],b=[{id:AG.id,params:v}];l&&Object.keys(l).length>0&&y.push({id:WG.id,params:{unitId:a,subUnitId:o,cellValue:l}});let x=h.onCommandExecute({id:eq.id,params:t});if(y.unshift(...x.preRedos??[]),y.push(...x.redos??[]),y.push(IK(s,r,i)),b.unshift(...x.preUndos??[]),b.push(...x.undos??[]),Bm(y,p).result){let e=h.afterCommandExecute({id:eq.id,params:t});return Bm(e.redos,p),y.push(...e.redos),b.push(...e.undos),m.pushUndoRedo({unitID:t.unitId,undoMutations:b.filter(Boolean),redoMutations:y.filter(Boolean)}),!0}return!1}},nq={type:R.COMMAND,id:`sheet.command.insert-col-before`,handler:async(e,t)=>{let n=e.get(TK).getCurrentSelections(),r;if(n?.length===1)r=n[0].range;else return!1;let i=rG(e.get(B));if(!i)return!1;let{worksheet:a,unitId:o,subUnitId:s}=i,c=t.value||0,l=r.startColumn,u=r.startColumn+c-1,d=a.getRowCount()-1,f={unitId:o,subUnitId:s,direction:L.LEFT,range:{startColumn:l,endColumn:u,startRow:0,endRow:d,rangeType:fh.COLUMN},cellValue:LK(a,0,d,l,u,!1,l-1)};return e.get(z).executeCommand(eq.id,f)}},omt={type:R.COMMAND,id:`sheet.command.insert-col-after`,handler:async e=>{let t=e.get(TK).getCurrentSelections(),n;if(t?.length===1)n=t[0].range;else return!1;let r=rG(e.get(B));if(!r)return!1;let{worksheet:i,unitId:a,subUnitId:o}=r,s=n.endColumn-n.startColumn+1,c=n.endColumn+1,l=n.endColumn+s,u=i.getRowCount()-1,d={unitId:a,subUnitId:o,direction:L.RIGHT,range:{startColumn:c,endColumn:l,startRow:0,endRow:u},cellValue:LK(i,0,u,c,l,!1,n.endColumn)};return e.get(z).executeCommand(eq.id,d)}},rq={type:R.COMMAND,id:`sheet.command.insert-multi-cols-before`,handler:async(e,t)=>{let n=e.get(TK).getCurrentSelections(),r;if(n?.length===1)r=n[0].range;else return!1;let i=rG(e.get(B));if(!i)return!1;let{worksheet:a,unitId:o,subUnitId:s}=i,c=t.value||0,l=r.startColumn,u=r.startColumn+c-1,d=a.getRowCount()-1,f={unitId:o,subUnitId:s,direction:L.LEFT,range:{startColumn:l,endColumn:u,startRow:0,endRow:d,rangeType:fh.COLUMN},cellValue:LK(a,0,d,l,u,!1,l-1)};return e.get(z).executeCommand(eq.id,f)}},iq={type:R.COMMAND,id:`sheet.command.insert-multi-cols-right`,handler:async(e,t)=>{let n=e.get(TK).getCurrentSelections(),r;if(n?.length===1)r=n[0].range;else return!1;let i=rG(e.get(B));if(!i)return!1;let{worksheet:a,unitId:o,subUnitId:s}=i,c=t.value||0,l=r.endColumn+1,u=r.endColumn+c,d=a.getRowCount()-1,f={unitId:o,subUnitId:s,direction:L.RIGHT,range:{startColumn:l,endColumn:u,startRow:0,endRow:d},cellValue:LK(a,0,d,l,u,!1,r.endColumn)};return e.get(z).executeCommand(eq.id,f)}},smt=hf((e,t,n,r)=>{if(!r.disposed){let i=IK(e,t,n);r.executeCommand(i.id,i.params)}},300),aq=`sheet.command.remove-row`,oq={type:R.COMMAND,id:`sheet.command.remove-row-by-range`,handler:(e,t)=>{if(!t)return!1;let n=rG(e.get(B),t);if(!n)return!1;let{workbook:r,worksheet:i}=n,a=e.get(hG),{range:o,unitId:s,subUnitId:c}=t,l=_K([o],e,s,c).reverse(),u=[],d=[];l.forEach(e=>{let t=[],n=[],r={unitId:s,subUnitId:c,range:e},a=Tft(r,i),o={unitId:s,subUnitId:c,cellValue:i.getCellMatrix().getSlice(e.startRow,e.endRow,0,i.getColumnCount()-1).getMatrix()};n.push({id:kG.id,params:r}),t.push({id:CG.id,params:a}),t.push({id:WG.id,params:o}),d.push(...n),u.unshift(...t)});let f=a.onCommandExecute({id:aq,params:{range:o}}),p=e.get(z);if(Bm([...f.preRedos??[],...d,...f.redos],p).result){smt(o,r,i,p);let t=a.afterCommandExecute({id:aq,params:{range:o}});return Bm(t.redos,p),e.get($b).pushUndoRedo({unitID:s,undoMutations:[...f.preUndos??[],...u,...f.undos,...t.undos],redoMutations:[...f.preRedos??[],...d,...f.redos,...t.redos]}),!0}return!1}},sq={type:R.COMMAND,id:aq,handler:async(e,t)=>{let n=rG(e.get(B),t);if(!n)return!1;let r=e.get(TK),i=t?.range||r.getCurrentLastSelection()?.range;if(!i)return!1;let a=e.get(hG),o=e.get(z),{worksheet:s,unitId:c,subUnitId:l}=n;return i={...i,startColumn:0,endColumn:Math.max(s.getMaxColumns()-1,0)},await a.beforeCommandExecute({id:sq.id,params:{range:i}})?o.syncExecuteCommand(oq.id,{range:i,unitId:c,subUnitId:l}):!1}},cq=`sheet.command.remove-col`,lq={type:R.COMMAND,id:`sheet.command.remove-col-by-range`,handler:(e,t)=>{if(!t)return!1;let n=rG(e.get(B),t);if(!n)return!1;let{workbook:r,worksheet:i}=n,a=e.get(hG),{range:o,unitId:s,subUnitId:c}=t,l={unitId:s,subUnitId:c,range:o},u=Eft(e,l),d={unitId:s,subUnitId:c,cellValue:i.getCellMatrix().getSlice(0,i.getRowCount()-1,o.startColumn,o.endColumn).getMatrix()},f=a.onCommandExecute({id:cq,params:{range:o}}),p=e.get(z);if(Bm([...f.preRedos??[],{id:AG.id,params:l},...f.redos],p).result){smt(o,r,i,p);let t=a.afterCommandExecute({id:cq,params:{range:o}});return Bm(t.redos,p),e.get($b).pushUndoRedo({unitID:s,undoMutations:[...f.preUndos??[],{id:TG.id,params:u},{id:WG.id,params:d},...f.undos,...t.undos],redoMutations:[...f.preRedos??[],{id:AG.id,params:l},...f.redos,...t.redos]}),!0}return!1}},uq={type:R.COMMAND,id:cq,handler:async(e,t)=>{let n=e.get(TK),r=e.get(hG),i=e.get(z),a=t?.range;if(a||=n.getCurrentLastSelection()?.range,!a)return!1;let o=rG(e.get(B));if(!o)return!1;let{worksheet:s,subUnitId:c,unitId:l}=o;return a={...a,startRow:0,endRow:Math.max(s.getMaxRows()-1,0)},await r.beforeCommandExecute({id:uq.id,params:{range:a}})?i.syncExecuteCommand(lq.id,{range:a,unitId:l,subUnitId:c}):!1}},cmt=(e,t)=>{let n=e.get(B),{subUnitId:r,unitId:i}=t,a=iG(n,t);if(!a)throw Error(`[RemoveSheetUndoMutationFactory]: Worksheet is null error!`);let{workbook:o,worksheet:s}=a,c=s.getConfig();return{index:o.getConfig().sheetOrder.findIndex(e=>e===r),sheet:c,unitId:i}},dq={id:`sheet.mutation.remove-sheet`,type:R.MUTATION,handler:(e,t)=>{let n=e.get(B),{subUnitId:r,unitId:i}=t,a=n.getUniverSheetInstance(i);return a?a.removeSheet(r):!1}};function lmt(e,t){return t.getMergeData().some(t=>t.startRow<e&&e<=t.endRow)}function umt(e,t){return t.getMergeData().some(t=>t.startColumn<e&&e<=t.endColumn)}var dmt=`sheet.command.move-rows`,fq={id:dmt,type:R.COMMAND,handler:(e,t)=>{let n=e.get(TK),{fromRange:{startRow:r},toRange:{startRow:i},range:a}=t,o=(a?[pmt(a)]:n.getCurrentSelections())?.filter(e=>e.range.rangeType===fh.ROW&&e.range.startRow<=r&&r<=e.range.endRow);if(o?.length!==1)return!1;let s=e.get(hG),c=rG(e.get(B),t);if(!c)return!1;let{workbook:l,worksheet:u}=c,d=l.getUnitId(),f=u.getSheetId(),p=e.get(Wy),m=e.get(Rb),h=o[0].range,g=o[0].primary,_=NK(h,u,!1);if(!n_.equals(h,_))return p.emit(m.t(`sheets.info.partOfCell`)),!1;if(lmt(i,u))return p.emit(m.t(`sheets.info.acrossMergedCell`)),!1;let v={...h,startRow:i,endRow:i+h.endRow-h.startRow},y={unitId:d,subUnitId:f,sourceRange:h,targetRange:v},b=Cft(e,y),x=e.get(z),S=s.onCommandExecute({id:fq.id,params:t}),C=[...S.preRedos??[],{id:DG.id,params:y}],w=[...S.preUndos??[],{id:DG.id,params:b}];if(g){let e=i-r<0,t=h.endRow-h.startRow+1,n=e?v:{...v,startRow:v.startRow-t,endRow:v.endRow-t},a={unitId:d,subUnitId:f,type:2,selections:[{range:n,primary:FK(n,u),style:null}]},o={unitId:d,subUnitId:f,type:2,selections:[{range:h,primary:g,style:null}]};C.push({id:VK.id,params:a}),w.push({id:VK.id,params:o})}if(C.push(...S.redos),w.push(...S.undos),Bm(C,x).result){let n=s.afterCommandExecute({id:fq.id,params:t});return Bm(n.redos,x),C.push(...n.redos),w.push(...n.undos),e.get($b).pushUndoRedo({unitID:d,undoMutations:w,redoMutations:C}),!0}return!1}},fmt=`sheet.command.move-cols`,pq={id:fmt,type:R.COMMAND,handler:(e,t)=>{let n=e.get(TK),{fromRange:{startColumn:r},toRange:{startColumn:i},range:a}=t,o=(a?[pmt(a)]:n.getCurrentSelections())?.filter(e=>e.range.rangeType===fh.COLUMN&&e.range.startColumn<=r&&r<=e.range.endColumn);if(o?.length!==1)return!1;let s=e.get(hG),c=rG(e.get(B),t);if(!c)return!1;let{workbook:l,worksheet:u}=c,d=l.getUnitId(),f=u.getSheetId(),p=e.get(Wy),m=e.get(Rb),h=o[0].range,g=o[0].primary,_=NK(h,u,!1);if(!n_.equals(h,_))return p.emit(m.t(`sheets.info.partOfCell`)),!1;if(umt(i,u))return p.emit(m.t(`sheets.info.acrossMergedCell`)),!1;let v={...h,startColumn:i,endColumn:i+h.endColumn-h.startColumn},y={unitId:d,subUnitId:f,sourceRange:h,targetRange:v},b=wft(e,y),x=e.get(z),S=s.onCommandExecute({id:pq.id,params:t}),C=[...S.preRedos??[],{id:OG.id,params:y}],w=[...S.preUndos??[],{id:OG.id,params:b}];if(g){let e=h.endColumn-h.startColumn+1,t=i-r<0?v:{...v,startColumn:v.startColumn-e,endColumn:v.endColumn-e},n={unitId:d,subUnitId:f,type:2,selections:[{range:t,primary:FK(t,u),style:null}]},a={unitId:d,subUnitId:f,type:2,selections:[{range:h,primary:g,style:null}]};C.push({id:VK.id,params:n}),w.push({id:VK.id,params:a})}if(C.push(...S.redos),w.push(...S.undos),Bm(C,x).result){let n=s.afterCommandExecute({id:pq.id,params:t});return Bm(n.redos,x),C.push(...n.redos),w.push(...n.undos),e.get($b).pushUndoRedo({unitID:d,undoMutations:w,redoMutations:C}),!0}return!1}};function pmt(e){return{range:e,primary:null,style:null}}var mmt=`sheet.command.reorder-range`,mq={id:mmt,type:R.COMMAND,handler:(e,t)=>{let{subUnitId:n,unitId:r,range:i,order:a}=t,o=e.get(z),s={id:NG.id,params:{unitId:r,subUnitId:n,order:a,range:i}},c={id:NG.id,params:Dft(s.params)},l=e.get(hG),u=l.onCommandExecute({id:mq.id,params:t}),d=[...u.preRedos??[],s,...u.redos],f=[...u.preUndos??[],c,...u.undos],p=Bm(d,o),{suitableRanges:m,remainingRanges:h}=AK([i],e.get(OK).getSkeleton(r,n)),{undos:g,redos:_}=l.generateMutationsOfAutoHeight({unitId:r,subUnitId:n,ranges:[i],autoHeightRanges:m,lazyAutoHeightRanges:h}),v=l.afterCommandExecute({id:mq.id,params:t});return p.result?(Bm([...v.redos,..._],o),e.get($b).pushUndoRedo({unitID:r,undoMutations:[...f,...v.undos,...g],redoMutations:[...d,...v.redos,..._]}),!0):!1}},hq={MoveRangeCommandId:qpt,InsertRowCommandId:rmt,InsertColCommandId:amt,RemoveColCommandId:cq,RemoveRowCommandId:aq,DeleteRangeMoveLeftCommandId:$pt,DeleteRangeMoveUpCommandId:emt,InsertRangeMoveDownCommandId:tmt,InsertRangeMoveRightCommandId:nmt,MoveColsCommandId:fmt,MoveRowsCommandId:dmt,ReorderRangeCommandId:mmt},gq=e=>{let t={...e},n=Number.isNaN(t.startRow)&&Number.isNaN(t.endRow)&&!Number.isNaN(t.startColumn)&&!Number.isNaN(t.endColumn),r=Number.isNaN(t.startColumn)&&Number.isNaN(t.endColumn)&&!Number.isNaN(t.startRow)&&!Number.isNaN(t.endRow);return(t.rangeType===fh.COLUMN||n)&&(t.startRow=0,t.endRow=Ug-1),(t.rangeType===fh.ROW||r)&&(t.startColumn=0,t.endColumn=Wg-1),t.rangeType===fh.ALL&&(t.startColumn=0,t.endColumn=Wg-1,t.startRow=0,t.endRow=Ug-1),t},_q=e=>{let t=e.rangeType;return e.rangeType===fh.COLUMN?t=fh.ROW:e.rangeType===fh.ROW&&(t=fh.COLUMN),{startRow:e.startColumn,endRow:e.endColumn,startColumn:e.startRow,endColumn:e.endRow,rangeType:t}},vq=(e,t,n)=>{let r={...n},i={...t},a=(e,t)=>{let n=Math.max(e.start,t.start),r=Math.min(e.end,t.end);return r<n?null:{start:n,end:r}},o=e=>e.end-e.start+1,s=(e,t)=>({start:e.start-t.start,end:e.start-t.start+e.end-e.start}),c=(e,t)=>({start:t.start+e.start,end:t.start+e.start+e.end-e.start}),l=t.start>e.start;if(l){let n=Math.min(e.end,t.start)-e.start+1;i.start-=n,i.end-=n}let u=o(e),d=u,f=a(e,r),p=f&&o(f)>=o(r);if(e.end<r.start)r.start-=u,r.end-=u;else if(f){let t=o(f);if(p){let t=c(s(r,e),i);r.start=t.start,r.end=t.end}else f.start>e.start?l?(r.end-=t+u,r.start-=u):r.end-=t:l?r.end-=t:r.start>e.start&&r.end>e.end?(r.start-=u,r.end-=u+t):r.end-=t}let m=a(i,r);return p||(i.start<=r.start?(r.start+=d,r.end+=d):m&&(l?i.end<=r.start||i.start<=r.start&&i.end>=r.start?(r.start+=d,r.end+=d):i.start>=r.start&&i.start<=r.end&&(r.end+=d):r.start<i.start&&r.end>i.start?r.end+=d:(r.start>=i.end||r.start>=i.start&&r.start<=i.end)&&(r.end+=d,r.start+=d))),{step:r.start-n.start,length:o(r)-o(n)}},yq=(e,t)=>{let{fromRange:n,toRange:r}=e.params||{};if(!r||!n)return[];let i=gq(n),a=gq(r),o=gq(t),s=vq({start:i.startRow,end:i.endRow},{start:a.startRow,end:a.endRow},{start:o.startRow,end:o.endRow});return s===null?[{type:1}]:[{type:3,step:s.step||0,length:s.length||0}]},hmt=(e,t)=>{let{fromRange:n,toRange:r}=e.params||{};if(!n||!r)return[t];let i=n.startRow,a=n.endRow-n.startRow+1,o=r.startRow,s=new Mh;return Kg.foreach(t,(e,t)=>{s.setValue(e,t,1)}),s.moveRows(i,a,o),o_(s,e=>e===1)},gmt=(e,t)=>{let{range:n,order:r}=e.params||{};if(!n||!r)return[t];let i=new Mh;Kg.foreach(t,(e,t)=>{i.setValue(e,t,1)});let a=new Mh;return Kg.foreach(n,(e,t)=>{if(Object.prototype.hasOwnProperty.call(r,e)){let n=r[e],o=i.getValue(n,t)??0;a.setValue(e,t,o)}}),a.forValue((e,t,n)=>{i.setValue(e,t,n)}),o_(i,e=>e===1)},bq=(e,t)=>{let{fromRange:n,toRange:r}=e.params||{};if(!r||!n)return[];let i=gq(n),a=gq(r),o=gq(t),s=vq({start:i.startColumn,end:i.endColumn},{start:a.startColumn,end:a.endColumn},{start:o.startColumn,end:o.endColumn});return s===null?[{type:1}]:[{type:2,step:s.step||0,length:s.length||0}]},_mt=(e,t)=>{let{fromRange:n,toRange:r}=e.params||{};if(!n||!r)return[t];let i=n.startColumn,a=n.endColumn-n.startColumn+1,o=r.startColumn,s=new Mh;return Kg.foreach(t,(e,t)=>{s.setValue(e,t,1)}),s.moveColumns(i,a,o),o_(s,e=>e===1)},xq=(e,t)=>{let n=e.params?.toRange,r=e.params?.fromRange;if(!n||!r)return[];let i=[];if(n_.contains(n,t)&&i.push({type:1}),n_.contains(r,t)){i.push({type:1});let e=n_.getRelativeRange(t,r);return[{type:0,range:n_.getPositionRange(e,n)}]}return i},vmt=(e,t)=>{let n=e.params?.toRange,r=e.params?.fromRange;if(!n||!r||!n_.intersects(r,t)&&!n_.intersects(n,t))return[t];if(n_.contains(r,t)){let e=n_.getRelativeRange(t,r);return[n_.getPositionRange(e,n)]}let i=new Mh;Kg.foreach(t,(e,t)=>{i.setValue(e,t,1)});let a=new Mh,o=n_.getIntersects(r,t);o&&Kg.foreach(o,(e,t)=>{i.getValue(e,t)&&(i.setValue(e,t,void 0),a.setValue(e,t,1))});let s=n.startColumn-r.startColumn,c=n.startRow-r.startRow,l={startColumn:n.startColumn-s,endColumn:n.endColumn-s,startRow:n.startRow-c,endRow:n.endRow-c};return l&&Kg.foreach(l,(e,t)=>{let n=e+c,r=t+s;i.setValue(n,r,a.getValue(e,t)??0)}),o_(i,e=>e===1)},Sq=(e,t)=>{let n=gq(e),r=gq(t),i=e=>e.endColumn-e.startColumn+1,a=e=>e.endRow-e.startRow+1;if(n.startRow<=r.startRow&&n.endRow>=r.endRow){if(r.startColumn<n.startColumn&&r.endColumn>=n.startColumn&&r.endColumn<=n.endColumn||r.startColumn<n.startColumn&&r.endColumn>=n.endColumn){let e=n_.getIntersects(r,n);if(e)return{step:0,length:-i(e)}}if(r.startColumn>=n.startColumn&&r.endColumn<=n.endColumn&&a(n)>=a(r))return null;if(r.startColumn>=n.startColumn&&r.startColumn<=n.endColumn&&r.endColumn>n.endColumn){let e=n_.getIntersects(r,n);if(e){let t=-i(e);return{step:-(i(n)-i(e)),length:t}}}if(r.startColumn>n.endColumn)return{step:-i(n),length:0}}return{step:0,length:0}},Cq=(e,t)=>{let n=e.params?.range;if(!n)return[];let r=[],i=Sq(n,t);if(!i)r.push({type:1});else{let{step:e,length:t}=i;r.push({type:2,step:e,length:t})}return r},wq=(e,t,n)=>{let r=e.params?.range;if(!r)return[];let i=[];if(n&&n.length>0){let e=r.startRow;for(let t=r.startRow;t<=r.endRow;t++){if(n.includes(t)){if(t===e){e=t+1;continue}a({...r,startRow:e,endRow:t-1}),e=t+1;continue}t===r.endRow&&a({...r,startRow:e,endRow:r.endRow})}}else a(r);function a(e){let n=Sq(_q(e),_q(t));if(!n)i.push({type:1});else{let{step:e,length:t}=n;i.push({type:3,step:e,length:t})}}return i},ymt=(e,t)=>{let{range:n,order:r}=e.params||{};if(!n||!r)return[];if(n_.contains(n,t)&&t.endRow===t.startRow){let e=[],n=t.startRow;for(let t in r)if(r[t]===n){let r=Number(t);return e.push({type:3,step:r-n,length:0}),e}return[]}return[]},Tq=(e,t)=>{let n=gq(e),r=gq(t),i=e=>e.endColumn-e.startColumn+1;return n.startRow<=r.startRow&&n.endRow>=r.endRow?r.startColumn<n.startColumn&&r.endColumn>=n.startColumn&&r.endColumn<=n.endColumn||r.startColumn<n.startColumn&&r.endColumn>=n.endColumn?{step:0,length:i(n)}:r.startColumn>=n.startColumn&&r.endColumn<=n.endColumn||r.startColumn>=n.startColumn&&r.startColumn<=n.endColumn&&r.endColumn>n.endColumn||r.startColumn>=n.endColumn?{step:i(n),length:0}:{step:0,length:0}:{step:0,length:0}};function bmt(e,t,n){let r=[];if(n_.contains(t,n)&&r.push({type:1}),n_.contains(e,n)){r.push({type:1});let i=n_.getRelativeRange(n,e);return[{type:0,range:n_.getPositionRange(i,t)}]}return r}var Eq=(e,t)=>{let n=e.params?.range;if(!n)return[];let r=[],{step:i,length:a}=Tq(_q(n),_q(t));return r.push({type:3,step:i,length:a}),r},Dq=(e,t)=>{let n=e.params?.range;if(!n)return[];let r=[],{step:i,length:a}=Tq(n,t);return r.push({type:2,step:i,length:a}),r},Oq=(e,t)=>{let n=e.params?.range;if(!n)return[];let r=[],{step:i,length:a}=Tq(_q(n),_q(t));return r.push({type:3,step:i,length:a}),r},xmt=(e,t)=>{let n=e.params?.range;if(!n)return[t];let r=n.endRow-n.startRow+1,i={...n,startRow:n.startRow,endRow:1/0},a=n_.subtract(t,i),o=n_.getIntersects(i,t);if(!o)return[t];let s=new Mh;return a.forEach(e=>{Kg.foreach(e,(e,t)=>{s.setValue(e,t,1)})}),o&&Kg.foreach(o,(e,t)=>{s.setValue(e+r,t,1)}),o_(s,e=>e===1)},kq=(e,t)=>{let n=e.params?.range;if(!n)return[];let r=[],{step:i,length:a}=Tq(n,t);return r.push({type:2,step:i,length:a}),r},Smt=(e,t)=>{let n=e.params?.range;if(!n)return[t];let r=n.endColumn-n.startColumn+1,i={...n,startColumn:n.startColumn,endColumn:1/0},a=n_.subtract(t,i),o=n_.getIntersects(i,t);if(!o)return[t];let s=new Mh;return a.forEach(e=>{Kg.foreach(e,(e,t)=>{s.setValue(e,t,1)})}),o&&Kg.foreach(o,(e,t)=>{s.setValue(e,t+r,1)}),o_(s,e=>e===1)},Aq=(e,t)=>{let n=e.params?.range;if(!n)return[];let r=[],i=Sq(n,t);if(!i)r.push({type:1});else{let{step:e,length:t}=i;r.push({type:2,step:e,length:t})}return r},Cmt=(e,t)=>{let n=e.params?.range;if(!n)return[t];let r={startRow:n.startRow,endRow:n.endRow,startColumn:n.startColumn,endColumn:1/0},i=n.endColumn-n.startColumn+1,a=n_.getIntersects(n,t),o=n_.subtract(t,r),s=n_.getIntersects(r,t);if(!a&&!s)return[t];let c=new Mh;return s&&Kg.foreach(s,(e,t)=>{c.setValue(e,t-i,1)}),a&&Kg.foreach(a,(e,t)=>{c.setValue(e,t-i,0)}),o.forEach(e=>{Kg.foreach(e,(e,t)=>{c.setValue(e,t,1)})}),o_(c,e=>e===1)},jq=(e,t)=>{let n=e.params?.range;if(!n)return[];let r=[],i=Sq(_q(n),_q(t));if(!i)r.push({type:1});else{let{step:e,length:t}=i;r.push({type:3,step:e,length:t})}return r},wmt=(e,t)=>{let n=e.params?.range;if(!n)return[t];let r={...n,startRow:n.startRow,endRow:1/0},i=n.endRow-n.startRow+1,a=n_.getIntersects(n,t),o=n_.subtract(t,r),s=n_.getIntersects(r,t);if(!a&&!s)return[t];let c=new Mh;return s&&Kg.foreach(s,(e,t)=>{c.setValue(e-i,t,1)}),a&&Kg.foreach(a,(e,t)=>{c.setValue(e-i,t,0)}),o.forEach(e=>{Kg.foreach(e,(e,t)=>{c.setValue(e,t,1)})}),o_(c,e=>e===1)},Tmt=(e,t)=>{let n=Og((e.ranges??[e.range]).map(e=>[e.startRow,e.endRow])),r=t.startRow,i=t.endRow;for(let e=n.length-1;e>=0;e--){let[a,o]=n[e];if(a<=t.startRow&&o>=t.endRow)return[];if(o<r){let e=o-a+1;r-=e,i-=e}else if(!(a>i)){let e=Math.max(a,r),t=Math.min(o,i)-e+1;if(i-=t,a<=r){let t=e-r;r-=t}}}return[{...t,startRow:r,endRow:i}]},Emt=(e,t)=>{let n=e.params,r=n.range.startRow,i=n.range.endRow-n.range.startRow+1;if(n.direction===L.UP){if(r<t.startRow)return[{...t,startRow:t.startRow+i,endRow:t.endRow+i}];if(r<=t.endRow)return[{...t,endRow:t.endRow+i}]}else if(r<=t.startRow)return[{...t,startRow:t.startRow+i,endRow:t.endRow+i}];else if(r<=t.endRow+1)return[{...t,endRow:t.endRow+i}];return[t]},Dmt=(e,t)=>{let n=e.params,r=n.range.startColumn,i=n.range.endColumn-n.range.startColumn+1;if(n.direction===L.LEFT){if(r<t.startColumn)return[{...t,startColumn:t.startColumn+i,endColumn:t.endColumn+i}];if(r<=t.endColumn)return[{...t,endColumn:t.endColumn+i}]}else if(r<=t.startColumn)return[{...t,startColumn:t.startColumn+i,endColumn:t.endColumn+i}];else if(r<=t.endColumn+1)return[{...t,endColumn:t.endColumn+i}];return[t]},Mq=(e,t)=>{let n={...t};return e.forEach(e=>{switch(e.type){case 1:n=null;break;case 2:if(!n)return;n.startColumn+=e.step,n.endColumn+=e.step+(e.length||0);break;case 3:if(!n)return;n.startRow+=e.step,n.endRow+=e.step+(e.length||0);break;case 0:n=e.range}}),n&&(n.endColumn<n.startColumn||n.endRow<n.startRow)?null:n},Nq=(e,t)=>{let n=[];switch(t.id){case hq.DeleteRangeMoveLeftCommandId:n=Aq(t,e);break;case hq.DeleteRangeMoveUpCommandId:n=jq(t,e);break;case hq.InsertColCommandId:n=Dq(t,e);break;case hq.InsertRangeMoveDownCommandId:n=Oq(t,e);break;case hq.InsertRangeMoveRightCommandId:n=kq(t,e);break;case hq.InsertRowCommandId:n=Eq(t,e);break;case hq.MoveColsCommandId:n=bq(t,e);break;case hq.MoveRangeCommandId:n=xq(t,e);break;case hq.MoveRowsCommandId:n=yq(t,e);break;case hq.RemoveColCommandId:n=Cq(t,e);break;case hq.RemoveRowCommandId:n=wq(t,e);break;case hq.ReorderRangeCommandId:n=ymt(t,e)}return Mq(n,e)},Omt=(e,t,n)=>[GK.id,KK.id].includes(t.id)||jmt(t,n).some(t=>n_.intersects(t,e))?Nq(e,t):e,Pq=(e,t)=>{let n=[];switch(t.id){case hq.DeleteRangeMoveLeftCommandId:return Cmt(t,e);case hq.DeleteRangeMoveUpCommandId:return wmt(t,e);case hq.InsertRangeMoveDownCommandId:return xmt(t,e);case hq.InsertRangeMoveRightCommandId:return Smt(t,e);case hq.InsertColCommandId:return Dmt(t,e);case hq.InsertRowCommandId:return Emt(t,e);case hq.MoveColsCommandId:return _mt(t,e);case hq.MoveRangeCommandId:return vmt(t,e);case hq.MoveRowsCommandId:return hmt(t,e);case hq.ReorderRangeCommandId:return gmt(t,e);case hq.RemoveColCommandId:n=Cq(t,e);break;case hq.RemoveRowCommandId:return Tmt(t.params,e)}let r=Mq(n,e);return r?[r]:[]},kmt=(e,t,n)=>[GK.id,KK.id,qK.id,`sheet.command.insert-range-move-right`].includes(t.id)||jmt(t,n).some(t=>n_.intersects(t,e))?Pq(e,t):e;function Amt(e,t){let{id:n,params:r}=t,i={length:0,step:0,type:4};switch(n){case dq.id:i.type=1;break;case DG.id:i=vq({start:r.sourceRange.startRow,end:r.sourceRange.endRow},{start:r.targetRange.startRow,end:r.targetRange.endRow},{start:e.startRow,end:e.endRow}),i.type=3;break;case OG.id:i=vq({start:r.sourceRange.startColumn,end:r.sourceRange.endColumn},{start:r.targetRange.startColumn,end:r.targetRange.endColumn},{start:e.startColumn,end:e.endColumn}),i.type=2;break;case AG.id:i=Sq(r.range,e),i?i.type=2:i={step:0,length:0,type:1};break;case kG.id:i=Sq(_q(r.range),_q(e)),i?i.type=3:i={step:0,length:0,type:1};break;case CG.id:i=Tq(_q(r.range),_q(e)),i.type=3;break;case TG.id:i=Tq(r.range,e),i.type=2;break;case EG.id:i=bmt(r.fromRange||new Mh(r.from).getRange(),r.toRange||new Mh(r.to).getRange(),e)}return i?Mq(Array.isArray(i)?i:[i],e):e}function jmt(e,t){let{selectionManagerService:n}=t;switch(e.id){case hq.MoveColsCommandId:{let t=e.params;return[t.fromRange,{...t.toRange,startColumn:t.toRange.startColumn-.5,endColumn:t.toRange.endColumn-.5}]}case hq.MoveRowsCommandId:{let t=e.params;return[t.fromRange,{...t.toRange,startRow:t.toRange.startRow-.5,endRow:t.toRange.startRow-.5}]}case hq.MoveRangeCommandId:{let t=e;return[t.params.fromRange,t.params.toRange]}case hq.InsertRowCommandId:{let t=e.params.range;return[{...t,startRow:t.startRow-.5,endRow:t.endRow-.5}]}case hq.InsertColCommandId:{let t=e.params.range;return[{...t,startColumn:t.startColumn-.5,endColumn:t.endColumn-.5}]}case hq.RemoveRowCommandId:return[e.params.range];case hq.RemoveColCommandId:return[e.params.range];case hq.DeleteRangeMoveUpCommandId:case hq.InsertRangeMoveDownCommandId:{var r;let t=e.params?.range||((r=n.getCurrentSelections())==null||(r=r.map(e=>e.range))==null?void 0:r[0]);return t?[t]:[]}case hq.DeleteRangeMoveLeftCommandId:case hq.InsertRangeMoveRightCommandId:{var i;let t=e.params?.range||((i=n.getCurrentSelections())==null||(i=i.map(e=>e.range))==null?void 0:i[0]);return t?[t]:[]}case hq.ReorderRangeCommandId:{let{range:t,order:n}=e.params,r=[];for(let e=t.startRow;e<=t.endRow;e++)e in n&&r.push({startRow:e,endRow:e,startColumn:t.startColumn,endColumn:t.endColumn});return r}}}function Mmt(e){switch(e.id){case OG.id:{let t=e.params;return[t.sourceRange,{...t.targetRange,startColumn:t.targetRange.startColumn-.5,endColumn:t.targetRange.startColumn-.5}]}case DG.id:{let t=e.params;return[t.sourceRange,{...t.targetRange,startRow:t.targetRange.startRow-.5,endRow:t.targetRange.startRow-.5}]}case EG.id:{let t=e.params;return[new Mh(t.from.value).getRange(),new Mh(t.to.value).getRange()]}case TG.id:{let t=e.params.range;return[{...t,startColumn:t.startColumn-.5,endColumn:t.startColumn-.5}]}case CG.id:{let t=e.params.range;return[{...t,startRow:t.startRow-.5,endRow:t.startRow-.5}]}case AG.id:return[e.params.range];case kG.id:return[e.params.range]}}function Nmt(e,t){let n=e.get(B);switch(t.id){case hq.MoveColsCommandId:{let e=t.params,r=rG(n,e);if(!r)return;let{unitId:i,subUnitId:a}=r,{fromRange:o,toRange:s}=e;return{unitId:i,subUnitId:a,ranges:[o,{...s,startColumn:o.startColumn<s.startColumn?o.endColumn+1:s.startColumn,endColumn:o.startColumn<s.startColumn?s.endColumn-1:o.startColumn-1}]}}case hq.MoveRowsCommandId:{let e=t.params,r=rG(n,e);if(!r)return;let{unitId:i,subUnitId:a}=r,{fromRange:o,toRange:s}=e;return{unitId:i,subUnitId:a,ranges:[o,{...s,startRow:o.startRow<s.startRow?o.endRow+1:s.startRow,endRow:o.startRow<s.startRow?s.endRow-1:o.startRow-1}]}}case hq.MoveRangeCommandId:{let e=t.params,r=rG(n);if(!r)return;let{unitId:i,subUnitId:a}=r,{fromRange:o,toRange:s}=e;return{unitId:i,subUnitId:a,ranges:[o,s]}}case hq.InsertRowCommandId:{let e=t.params,r=rG(n,e);if(!r)return;let{worksheet:i,unitId:a,subUnitId:o}=r,{range:s}=e;return{unitId:a,subUnitId:o,ranges:[...s.startRow>0?[{...s,startRow:s.startRow-1,endRow:s.endRow-1}]:[],{...s,startRow:s.startRow,endRow:i.getRowCount()-1}]}}case hq.InsertColCommandId:{let e=t.params,r=rG(n,e);if(!r)return;let{worksheet:i,unitId:a,subUnitId:o}=r,{range:s}=e;return{unitId:a,subUnitId:o,ranges:[...s.startColumn>0?[{...s,startColumn:s.startColumn-1,endColumn:s.endColumn-1}]:[],{...s,startColumn:s.startColumn,endColumn:i.getColumnCount()-1}]}}case hq.RemoveRowCommandId:{let e=t.params,r=rG(n);if(!r)return;let{worksheet:i,unitId:a,subUnitId:o}=r,{range:s}=e;return{unitId:a,subUnitId:o,ranges:[s,{...s,startRow:s.endRow+1,endRow:i.getRowCount()-1}]}}case hq.RemoveColCommandId:{let e=t.params,r=rG(n);if(!r)return;let{worksheet:i,unitId:a,subUnitId:o}=r,{range:s}=e;return{unitId:a,subUnitId:o,ranges:[s,{...s,startColumn:s.endColumn+1,endColumn:i.getColumnCount()-1}]}}case hq.DeleteRangeMoveUpCommandId:case hq.InsertRangeMoveDownCommandId:{let e=t.params,r=rG(n);if(!r)return;let{worksheet:i,unitId:a,subUnitId:o}=r,{range:s}=e;return{unitId:a,subUnitId:o,ranges:[s,{...s,startRow:s.endRow+1,endRow:i.getRowCount()-1}]}}case hq.DeleteRangeMoveLeftCommandId:case hq.InsertRangeMoveRightCommandId:{let e=t.params,r=rG(n);if(!r)return;let{worksheet:i,unitId:a,subUnitId:o}=r,{range:s}=e;return{unitId:a,subUnitId:o,ranges:[s,{...s,startColumn:s.endColumn+1,endColumn:i.getColumnCount()-1}]}}case hq.ReorderRangeCommandId:{let e=t.params,r=rG(n);if(!r)return;let{unitId:i,subUnitId:a}=r,{range:o,order:s}=e,c=[];for(let e=o.startRow;e<=o.endRow;e++)e in s&&c.push({startRow:e,endRow:e,startColumn:o.startColumn,endColumn:o.endColumn});return{unitId:i,subUnitId:a,ranges:c}}}}var Pmt=xf(`MERGE_REDO`),Fmt=xf(`MERGE_UNDO`),Imt=class extends F{constructor(e,t,n,r,i=!1){super(),this._unitId=e,this._subUnitId=t,this._range=n,this._callback=r,this._skipIntersects=i}onMutation(e){if(e.params?.unitId!==this._unitId)return;if(e.id===EG.id){let t=e.params;if(t.from.subUnitId!==this._subUnitId||t.to.subUnitId!==this._subUnitId)return}else if(e.params?.subUnitId!==this._subUnitId)return;if(!this._range||this._skipIntersects&&(e.id===dq.id||Mmt(e)?.some(e=>n_.intersects(e,this._range))))return;let t=Amt(this._range,e);if(t&&n_.equals(t,this._range))return!1;let n=this._range;this._range=t,this._callback(n,t)}},Fq=class extends F{constructor(e,t,n,r){super(),this._commandService=e,this._sheetInterceptorService=t,this._univerInstanceService=n,this._selectionManagerService=r,Z(this,`interceptor`,new Cf({MERGE_REDO:Pmt,MERGE_UNDO:Fmt})),Z(this,`_watchRanges`,new Set),Z(this,`_refRangeManagerMap`,new Map),Z(this,`_serializer`,Bmt()),Z(this,`_onRefRangeChange`,()=>{this._sheetInterceptorService.interceptCommand({getMutations:e=>{let t=(()=>{switch(e.id){case hq.MoveColsCommandId:{let t=e.params,n=rG(this._univerInstanceService,t);if(!n)return[];let{worksheet:r,unitId:i,subUnitId:a}=n,o=Math.min(t.fromRange.startColumn,t.toRange.startColumn);return this._checkRange([{...t.fromRange,startColumn:o,endColumn:r.getColumnCount()-1}],i,a)}case hq.MoveRowsCommandId:{let t=e.params,n=rG(this._univerInstanceService,t);if(!n)return[];let{worksheet:r,unitId:i,subUnitId:a}=n,o=Math.min(t.fromRange.startRow,t.toRange.startRow);return this._checkRange([{...t.fromRange,startRow:o,endRow:r.getRowCount()-1}],i,a)}case hq.MoveRangeCommandId:{let t=e.params,n=rG(this._univerInstanceService,{unitId:t.fromUnitId,subUnitId:t.fromSubUnitId}),r=rG(this._univerInstanceService,{unitId:t.toUnitId??t.fromUnitId,subUnitId:t.toSubUnitId??t.fromSubUnitId});if(!n&&!r)return[];if(n&&r&&n.unitId===r.unitId&&n.subUnitId===r.subUnitId)return this._checkRange([t.fromRange,t.toRange],n.unitId,n.subUnitId);let i=[];return n&&i.push(...this._checkRange([t.fromRange],n.unitId,n.subUnitId)),r&&i.push(...this._checkRange([t.toRange],r.unitId,r.subUnitId)),i}case hq.InsertRowCommandId:{let t=e.params,n=rG(this._univerInstanceService,t);if(!n)return[];let{worksheet:r,unitId:i,subUnitId:a}=n,o={startRow:Math.max(0,t.range.startRow-1),endRow:r.getRowCount()-1,startColumn:0,endColumn:r.getColumnCount()-1,rangeType:fh.ROW};return this._checkRange([o],i,a)}case hq.InsertColCommandId:{let t=e.params,n=rG(this._univerInstanceService,t);if(!n)return[];let{worksheet:r,unitId:i,subUnitId:a}=n,o={startRow:0,endRow:r.getRowCount()-1,startColumn:Math.max(0,t.range.startColumn-1),endColumn:r.getColumnCount()-1,rangeType:fh.COLUMN};return this._checkRange([o],i,a)}case hq.RemoveRowCommandId:{let t=e.params,n=rG(this._univerInstanceService);if(!n)return[];let{worksheet:r,unitId:i,subUnitId:a}=n,o={startRow:t.range.startRow,endRow:r.getRowCount()-1,startColumn:0,endColumn:r.getColumnCount()-1,rangeType:fh.ROW};return this._checkRange([o],i,a)}case hq.RemoveColCommandId:{let t=e.params,n=rG(this._univerInstanceService);if(!n)return[];let{worksheet:r,unitId:i,subUnitId:a}=n,o={startRow:0,endRow:r.getRowCount()-1,startColumn:t.range.startColumn,endColumn:r.getColumnCount()-1,rangeType:fh.COLUMN};return this._checkRange([o],i,a)}case hq.DeleteRangeMoveUpCommandId:case hq.InsertRangeMoveDownCommandId:{let t=e.params,n=rG(this._univerInstanceService);if(!n)return[];let{worksheet:r,unitId:i,subUnitId:a}=n,o={...t.range,endRow:r.getRowCount()-1};return this._checkRange([o],i,a)}case hq.DeleteRangeMoveLeftCommandId:case hq.InsertRangeMoveRightCommandId:{let t=e.params,n=rG(this._univerInstanceService);if(!n)return[];let{worksheet:r,unitId:i,subUnitId:a}=n,o={...t.range,endColumn:r.getColumnCount()-1};return this._checkRange([o],i,a)}case hq.ReorderRangeCommandId:{let t=e.params,n=rG(this._univerInstanceService);if(!n)return[];let{unitId:r,subUnitId:i}=n,{range:a,order:o}=t,s=[];for(let e=a.startRow;e<=a.endRow;e++)e in o&&s.push({startRow:e,endRow:e,startColumn:a.startColumn,endColumn:a.endColumn});return this._checkRange(s,r,i)}}})();if(!t||t.length===0)return{redos:[],undos:[],preRedos:[],preUndos:[]};let n=t.reduce((t,n)=>{let r=n(e);return t.push(r),t},[]).reduce((e,t)=>(e.redos.push(...t.redos),e.undos.push(...t.undos),e.preRedos.push(...t.preRedos??[]),e.preUndos.push(...t.preUndos??[]),e),{redos:[],undos:[],preUndos:[],preRedos:[]}),r=this.interceptor.fetchThroughInterceptors(this.interceptor.getInterceptPoints().MERGE_REDO)(n.preRedos,null)||[],i=this.interceptor.fetchThroughInterceptors(this.interceptor.getInterceptPoints().MERGE_REDO)(n.redos,null)||[],a=this.interceptor.fetchThroughInterceptors(this.interceptor.getInterceptPoints().MERGE_UNDO)(n.preUndos,null)||[];return{redos:i,undos:this.interceptor.fetchThroughInterceptors(this.interceptor.getInterceptPoints().MERGE_UNDO)(n.undos,null)||[],preRedos:r,preUndos:a}}})}),Z(this,`_checkRange`,(e,t,n)=>{let r=zmt(t,n),i=this._refRangeManagerMap.get(r);if(i){let t=new Set;return[...i.keys()].forEach(n=>{let r=i.get(n),a=this._serializer.deserialize(n),o={...a,startRow:+a.startRow,endRow:+a.endRow,startColumn:+a.startColumn,endColumn:+a.endColumn,rangeType:a.rangeType&&+a.rangeType};e.some(e=>n_.intersects(e,o))&&r&&r.forEach(e=>{t.add(e)})}),[...t]}return[]}),Z(this,`registerRefRange`,(e,t,n,r)=>{let i=n||Lmt(this._univerInstanceService),a=r||Rmt(this._univerInstanceService);if(!i||!a)return Hf(()=>{});let o=zmt(i,a),s=this._serializer.serialize(e),c=this._refRangeManagerMap.get(o);c||(c=new Map,this._refRangeManagerMap.set(o,c));let l=c.get(s);return l?l.add(t):c.set(s,new Set([t])),Hf(()=>{let e=c.get(s);e&&(e.delete(t),e.size||(c.delete(s),c.size||this._refRangeManagerMap.delete(o)))})}),this._onRefRangeChange(),this.interceptor.intercept(this.interceptor.getInterceptPoints().MERGE_REDO,{priority:-1,handler:e=>e}),this.interceptor.intercept(this.interceptor.getInterceptPoints().MERGE_UNDO,{priority:-1,handler:e=>e})}watchRange(e,t,n,r,i){let a;this._watchRanges.size===0&&(a=this._commandService.onCommandExecuted(e=>{if(e.type!==R.MUTATION)return!1;for(let t of this._watchRanges)t.onMutation(e)}));let o=new Imt(e,t,n,r,i);this._watchRanges.add(o);let s=Hf(()=>{this._watchRanges.delete(o),this._watchRanges.size===0&&(a?.dispose(),a=null)}),c=this.disposeWithMe(s);return Hf(()=>{c.dispose(),s.dispose()})}};Fq=dG([uG(0,z),uG(1,M(hG)),uG(2,M(B)),uG(3,M(TK))],Fq);function Lmt(e){return e.getCurrentUnitOfType(N.UNIVER_SHEET)?.getUnitId()}function Rmt(e){var t;return(t=e.getCurrentUnitOfType(N.UNIVER_SHEET))==null||(t=t.getActiveSheet())==null?void 0:t.getSheetId()}function zmt(e,t){return`${e}_${t}`}function Bmt(){let e=[`startRow`,`startColumn`,`endRow`,`endColumn`,`rangeType`];return{deserialize:t=>{let n=e.reduce((e,t,n)=>(e[String(n)]=t,e),{});return t.split(`_`).reduce((e,t,r)=>{let i=String(r);return t&&n[i]&&(e[n[i]]=t),e},{})},serialize:t=>e.reduce((e,n,r)=>{let i=t[n];return i===void 0?`${e}`:`${e}${r>0?`_`:``}${i}`},``)}}var Vmt=[TG.id,CG.id,AG.id,kG.id],Hmt=[DG.id,OG.id];function Iq(e,t){let n=e;if(t!==void 0){let e=[];for(let r=0;r<n.length;r++){let{startRow:i,endRow:a,startColumn:o,endColumn:s}=n[r];if(t===hp.ROWS)for(let t=i;t<=a;t++){let n={startRow:t,endRow:t,startColumn:o,endColumn:s};e.push(n)}else if(t===hp.COLUMNS)for(let t=o;t<=s;t++){let n={startRow:i,endRow:a,startColumn:t,endColumn:t};e.push(n)}}n=e}return n}var Umt=xf(`mergeCellPermissionCheck`),Lq=class extends F{constructor(e,t,n,r,i,a){super(),this._commandService=e,this._refRangeService=t,this._univerInstanceService=n,this._injector=r,this._sheetInterceptorService=i,this._selectionManagerService=a,Z(this,`disposableCollection`,new Uf),Z(this,`interceptor`,new Cf({MERGE_CELL_INTERCEPTOR_CHECK:Umt})),this._onRefRangeChange(),this._initCommandInterceptor(),this._commandExecutedListener()}_initCommandInterceptor(){let e=this;this._sheetInterceptorService.interceptCommand({getMutations(t){switch(t.id){case jK.id:case MK.id:{let t=e._univerInstanceService.getCurrentUnitOfType(N.UNIVER_SHEET),n=t.getUnitId(),r=t?.getActiveSheet();if(!r)return{redos:[],undos:[]};let i=r.getSheetId(),a=r.getConfig().mergeData,o=e._selectionManagerService.getCurrentSelections()?.map(e=>e.range);if(o&&o.length>0&&o.some(e=>a.some(t=>n_.intersects(t,e)))){let t={unitId:n,subUnitId:i,ranges:o},r=jG(e._injector,t);return{redos:[{id:MG.id,params:t}],undos:[{id:oG.id,params:r}]}}}}return{redos:[],undos:[]}}}),this._sheetInterceptorService.interceptRanges({getMutations:({unitId:e,subUnitId:t,ranges:n})=>{let r=[],i=[],a={redos:r,undos:i};if(!n||!n.length)return a;let o=rG(this._univerInstanceService,{unitId:e,subUnitId:t});if(!o)return a;let{worksheet:s}=o,c=s.getMergeData().filter(e=>n.some(t=>n_.intersects(e,t)));return c.length?(r.push({id:MG.id,params:{unitId:e,subUnitId:t,ranges:c}}),i.push({id:oG.id,params:{unitId:e,subUnitId:t,ranges:c}}),{undos:i,redos:r}):a}})}refRangeHandle(e,t,n){switch(e.id){case hq.MoveColsCommandId:{let r=e.params;return this._handleMoveColsCommand(r,t,n)}case hq.MoveRowsCommandId:{let r=e.params;return this._handleMoveRowsCommand(r,t,n)}case YK.id:{let r=e.params,i=r.unitId||t,a=r.subUnitId||n;return this._handleInsertRowCommand(r,i,a)}case eq.id:{let r=e.params,i=r.unitId||t,a=r.subUnitId||n;return this._handleInsertColCommand(r,i,a)}case uq.id:{let r=e.params;return this._handleRemoveColCommand(r,t,n)}case sq.id:{let r=e.params;return this._handleRemoveRowCommand(r,t,n)}case HK.id:{let r=e.params;return this._handleMoveRangeCommand(r,t,n)}case JK.id:{let r=e.params;return this._handleInsertRangeMoveRightCommand(r,t,n)}case qK.id:{let r=e.params;return this._handleInsertRangeMoveDownCommand(r,t,n)}case KK.id:{let r=e.params;return this._handleDeleteRangeMoveUpCommand(r,t,n)}case GK.id:{let r=e.params;return this._handleDeleteRangeMoveLeftCommand(r,t,n)}}return{redos:[],undos:[]}}_onRefRangeChange(){let e=(e,t)=>{let n=this._univerInstanceService.getUniverSheetInstance(e);if(!n)return;let r=n?.getSheetBySheetId(t);if(!r)return;this.disposableCollection.dispose();let i=r.getMergeData(),a=n=>this.refRangeHandle(n,e,t);i.forEach(n=>{this.disposableCollection.add(this._refRangeService.registerRefRange(n,a,e,t))})};this.disposeWithMe(this._commandService.onCommandExecuted(t=>{if(t.id===aK.id){let n=t.params,r=n.subUnitId,i=n.unitId;if(!r||!i)return;e(i,r)}if(t.id===oG.id){let n=t.params,r=n.subUnitId,i=n.unitId;if(!r||!i)return;e(n.unitId,n.subUnitId)}})),this._univerInstanceService.getCurrentTypeOfUnit$(N.UNIVER_SHEET).pipe(Qs(e=>!!e)).subscribe(t=>{let n=t.getActiveSheet();n&&e(t.getUnitId(),n.getSheetId())})}_handleMoveRowsCommand(e,t,n){let r=Rq(this._univerInstanceService,t);if(!r)return this._handleNull();let i=zq(r,n);if(!i)return this._handleNull();let a=[...i.getMergeData()],o={unitId:t,subUnitId:n,ranges:[]},s={unitId:t,subUnitId:n,ranges:[]},{fromRange:c}=e,{startRow:l,endRow:u}=c;if(a.forEach(t=>{if(l<=t.startRow&&u>=t.endRow){o.ranges.push(t);let n=Mq(yq({id:hq.MoveRowsCommandId,params:e},t),t);n&&s.ranges.push(n)}}),o.ranges.length===0)return this._handleNull();let d=jG(this._injector,o),f=aG(this._injector,s);return{preRedos:[{id:MG.id,params:o}],redos:[{id:oG.id,params:s}],preUndos:[{id:MG.id,params:f}],undos:[{id:oG.id,params:d}]}}_handleMoveColsCommand(e,t,n){let r=Rq(this._univerInstanceService,t);if(!r)return this._handleNull();let i=zq(r,n);if(!i)return this._handleNull();let a=[...i.getMergeData()],o={unitId:t,subUnitId:n,ranges:[]},s={unitId:t,subUnitId:n,ranges:[]},{fromRange:c}=e,{startColumn:l,endColumn:u}=c;if(a.forEach(t=>{if(l<=t.startColumn&&u>=t.endColumn){o.ranges.push(t);let n=Mq(bq({id:hq.MoveColsCommandId,params:e},t),t);n&&s.ranges.push(n)}}),o.ranges.length===0)return this._handleNull();let d=jG(this._injector,o),f=aG(this._injector,s);return{preRedos:[{id:MG.id,params:o}],redos:[{id:oG.id,params:s}],preUndos:[{id:MG.id,params:f}],undos:[{id:oG.id,params:d}]}}_handleMoveRangeCommand(e,t,n){let r=Rq(this._univerInstanceService,t);if(!r)return this._handleNull();let i=e.fromSubUnitId??n,a=e.toSubUnitId??i,o=zq(r,i),s=zq(r,a);if(!o||!s)return this._handleNull();let c=o.getMergeData().filter(t=>n_.intersects(t,e.fromRange)),l=s.getMergeData().filter(t=>n_.intersects(t,e.toRange)),u=Iq(c.map(t=>n_.getRelativeRange(t,e.fromRange)).map(t=>n_.getPositionRange(t,e.toRange))).filter(e=>!s.getMergeData().some(t=>n_.equals(e,t))),d=[],f=[];return n===i&&c.length>0&&(d.push({id:MG.id,params:{unitId:t,subUnitId:i,ranges:c}}),f.push({id:oG.id,params:{unitId:t,subUnitId:i,ranges:c}})),n===a&&l.length>0&&(d.push({id:MG.id,params:{unitId:t,subUnitId:a,ranges:l}}),f.push({id:oG.id,params:{unitId:t,subUnitId:a,ranges:l}})),n===a&&u.length>0&&(d.push({id:oG.id,params:{unitId:t,subUnitId:a,ranges:u}}),f.unshift({id:MG.id,params:{unitId:t,subUnitId:a,ranges:u}})),d.length===0?this._handleNull():{redos:d,undos:f}}_handleInsertRowCommand(e,t,n){let r=Rq(this._univerInstanceService,t);if(!r)return this._handleNull();let i=zq(r,n);if(!i)return this._handleNull();let{range:a}=e,{startRow:o,endRow:s}=a,c=I.deepClone(i.getMergeData()).reduce((e,t)=>(o>t.startRow&&o<=t.endRow&&e.push(t),e),[]);if(c.length===0)return this._handleNull();let l=I.deepClone(i.getMergeData()).reduce((e,t)=>{if(o>t.startRow&&o<=t.endRow){let n=s-o+1;t.endRow+=n,this._checkIsMergeCell(t)&&e.push(t)}return e},[]),u={unitId:t,subUnitId:n,ranges:c},d=jG(this._injector,u),f={unitId:t,subUnitId:n,ranges:l},p=aG(this._injector,f);return{redos:[{id:MG.id,params:u},{id:oG.id,params:f}],undos:[{id:MG.id,params:p},{id:oG.id,params:d}]}}_handleInsertColCommand(e,t,n){let{range:r}=e,i=Rq(this._univerInstanceService,t);if(!i)return this._handleNull();let a=zq(i,n);if(!a)return this._handleNull();let{startColumn:o,endColumn:s}=r,c=I.deepClone(a.getMergeData()).reduce((e,t)=>(o>t.startColumn&&o<=t.endColumn&&e.push(t),e),[]);if(c.length===0)return this._handleNull();let l=I.deepClone(a.getMergeData()).reduce((e,t)=>{if(o>t.startColumn&&o<=t.endColumn){let n=s-o+1;t.endColumn+=n,this._checkIsMergeCell(t)&&e.push(t)}return e},[]),u={unitId:t,subUnitId:n,ranges:c},d=jG(this._injector,u),f={unitId:t,subUnitId:n,ranges:l},p=aG(this._injector,f);return{redos:[{id:MG.id,params:u},{id:oG.id,params:f}],undos:[{id:MG.id,params:p},{id:oG.id,params:d}]}}_handleRemoveColCommand(e,t,n){let r=Rq(this._univerInstanceService,t);if(!r)return this._handleNull();let i=zq(r,n);if(!i)return this._handleNull();let{range:a}=e,{startColumn:o,endColumn:s}=a,c=I.deepClone(i.getMergeData()).reduce((e,t)=>(n_.intersects(a,t)&&e.push(t),e),[]);if(c.length===0)return this._handleNull();let l=I.deepClone(i.getMergeData()).reduce((e,t)=>{if(n_.intersects(a,t)){if(o<=t.startColumn&&s>=t.endColumn)return e;o>=t.startColumn&&s<=t.endColumn?t.endColumn-=s-o+1:o<t.startColumn?(t.startColumn=o,t.endColumn-=s-o+1):s>t.endColumn&&(t.endColumn=o-1),this._checkIsMergeCell(t)&&e.push(t)}return e},[]),u={unitId:t,subUnitId:n,ranges:c},d=jG(this._injector,u),f={unitId:t,subUnitId:n,ranges:l},p=aG(this._injector,f),m=[{id:MG.id,params:u}],h=[{id:oG.id,params:f}];return{preUndos:[{id:MG.id,params:p}],undos:[{id:oG.id,params:d}],preRedos:m,redos:h}}_handleRemoveRowCommand(e,t,n){let{range:r}=e,i=Rq(this._univerInstanceService,t);if(!i)return this._handleNull();let a=zq(i,n);if(!a)return this._handleNull();let{startRow:o,endRow:s}=r,c=I.deepClone(a.getMergeData()).reduce((e,t)=>(n_.intersects(r,t)&&e.push(t),e),[]);if(c.length===0)return this._handleNull();let l=I.deepClone(a.getMergeData()).reduce((e,t)=>{if(n_.intersects(r,t)){if(o<=t.startRow&&s>=t.endRow)return e;o>=t.startRow&&s<=t.endRow?t.endRow-=s-o+1:o<t.startRow?(t.startRow=o,t.endRow-=s-o+1):s>t.endRow&&(t.endRow=o-1),this._checkIsMergeCell(t)&&e.push(t)}return e},[]),u={unitId:t,subUnitId:n,ranges:c},d=jG(this._injector,u),f={unitId:t,subUnitId:n,ranges:l},p=aG(this._injector,f),m=[{id:MG.id,params:u}],h=[{id:oG.id,params:f}];return{preUndos:[{id:MG.id,params:p}],undos:[{id:oG.id,params:d}],preRedos:m,redos:h}}_handleInsertRangeMoveRightCommand(e,t,n){let r=Rq(this._univerInstanceService,t);if(!r)return this._handleNull();let i=zq(r,n);if(!i)return this._handleNull();let a=e.range,o=i.getMaxColumns()-1,s=i.getMergeData(),c=[],l=[];s.forEach(e=>{let{startRow:t,endRow:n,startColumn:r,endColumn:i}=a;if(n_.intersects({startRow:t,startColumn:r,endRow:n,endColumn:o},e)&&(c.push(e),n_.contains({startRow:t,startColumn:r,endRow:n,endColumn:o},e))){let t=i-r+1;l.push({startRow:e.startRow,startColumn:e.startColumn+t,endRow:e.endRow,endColumn:e.endColumn+t})}});let u={unitId:t,subUnitId:n,ranges:c},d=jG(this._injector,u),f={unitId:t,subUnitId:n,ranges:l},p=aG(this._injector,f);return{preRedos:[{id:MG.id,params:u}],redos:[{id:oG.id,params:f}],preUndos:[{id:MG.id,params:p}],undos:[{id:oG.id,params:d}]}}_handleInsertRangeMoveDownCommand(e,t,n){let r=Rq(this._univerInstanceService,t);if(!r)return this._handleNull();let i=zq(r,n);if(!i)return this._handleNull();let a=e.range,o=i.getMaxRows()-1,s=i.getMergeData(),c=[],l=[];s.forEach(e=>{let{startRow:t,startColumn:n,endColumn:r,endRow:i}=a;if(n_.intersects({startRow:t,startColumn:n,endRow:o,endColumn:r},e)&&(c.push(e),n_.contains({startRow:t,startColumn:n,endRow:o,endColumn:r},e))){let n=i-t+1;l.push({startRow:e.startRow+n,startColumn:e.startColumn,endRow:e.endRow+n,endColumn:e.endColumn})}});let u={unitId:t,subUnitId:n,ranges:c},d=jG(this._injector,u),f={unitId:t,subUnitId:n,ranges:l},p=aG(this._injector,f),m=[{id:MG.id,params:u}],h=[{id:oG.id,params:f}],g=[{id:MG.id,params:p}];return{redos:h,undos:[{id:oG.id,params:d}],preRedos:m,preUndos:g}}_handleDeleteRangeMoveUpCommand(e,t,n){let r=Rq(this._univerInstanceService,t);if(!r)return this._handleNull();let i=zq(r,n);if(!i)return this._handleNull();let a=e.range,o=i.getMaxRows()-1,s=i.getMergeData(),c=[],l=[];s.forEach(e=>{let{startRow:t,startColumn:n,endColumn:r,endRow:i}=a;if(n_.intersects({startRow:t,startColumn:n,endRow:o,endColumn:r},e)&&(c.push(e),n_.contains({startRow:t,startColumn:n,endRow:o,endColumn:r},e))){let n=i-t+1,r=n_.moveVertical(e,-n);l.push(r)}});let u={unitId:t,subUnitId:n,ranges:c},d=jG(this._injector,u),f={unitId:t,subUnitId:n,ranges:l},p=aG(this._injector,f),m=[{id:MG.id,params:u}],h=[{id:oG.id,params:f}],g=[{id:MG.id,params:p}];return{redos:h,undos:[{id:oG.id,params:d}],preRedos:m,preUndos:g}}_handleDeleteRangeMoveLeftCommand(e,t,n){let r=Rq(this._univerInstanceService,t);if(!r)return this._handleNull();let i=zq(r,n);if(!i)return this._handleNull();let a=e.range,o=i.getMaxColumns()-1,s=i.getMergeData(),c=[],l=[];s.forEach(e=>{let{startRow:t,endRow:n,startColumn:r,endColumn:i}=a;if(n_.intersects({startRow:t,startColumn:r,endRow:n,endColumn:o},e)&&(c.push(e),n_.contains({startRow:t,startColumn:r,endRow:n,endColumn:o},e))){let t=i-r+1;l.push({startRow:e.startRow,startColumn:e.startColumn-t,endRow:e.endRow,endColumn:e.endColumn-t})}});let u={unitId:t,subUnitId:n,ranges:c},d=jG(this._injector,u),f={unitId:t,subUnitId:n,ranges:l},p=aG(this._injector,f);return{preRedos:[{id:MG.id,params:u}],redos:[{id:oG.id,params:f}],undos:[{id:oG.id,params:d}],preUndos:[{id:MG.id,params:p}]}}_checkIsMergeCell(e){return e.startRow!==e.endRow||e.startColumn!==e.endColumn}_handleNull(){return{redos:[],undos:[]}}_commandExecutedListener(){this.disposeWithMe(this._commandService.onCommandExecuted(e=>{if(Hmt.includes(e.id)){if(!e.params)return;let t=this._univerInstanceService.getUniverSheetInstance(e.params.unitId);if(!t)return;let n=t.getSheetBySheetId(e.params.subUnitId);if(!n)return;let{sourceRange:r,targetRange:i}=e.params,a=r.startColumn===i.startColumn&&r.endColumn===i.endColumn,o=a?r.endRow-r.startRow+1:r.endColumn-r.startColumn+1,s=a?r.startRow:r.startColumn,c=a?i.startRow:i.startColumn,l=n.getConfig().mergeData,u=[];l.forEach(e=>{let{startRow:t,endRow:n,startColumn:i,endColumn:l,rangeType:d}=e;n_.intersects(e,r)||(a?s<t&&c>n?(t-=o,n-=o):s>n&&c<=t&&(t+=o,n+=o):s<i&&c>l?(i-=o,l-=o):s>l&&c<=i&&(i+=o,l+=o)),(e.startRow!==e.endRow||e.startColumn!==e.endColumn)&&u.push({startRow:t,endRow:n,startColumn:i,endColumn:l,rangeType:d})}),n.setMergeData(u),this.disposableCollection.dispose();let{unitId:d,subUnitId:f}=e.params,p=e=>this.refRangeHandle(e,d,f);u.forEach(e=>{this.disposableCollection.add(this._refRangeService.registerRefRange(e,p,d,f))})}if(Vmt.includes(e.id)){let t=this._univerInstanceService.getUniverSheetInstance(e.params.unitId);if(!t)return;let n=t.getSheetBySheetId(e.params.subUnitId);if(!n)return;let r=n.getConfig().mergeData,i=e.params;if(!i)return;let{range:a}=i,o=e.id.includes(`row`),s=e.id.includes(`insert`),c=o?a.startRow:a.startColumn,l=o?a.endRow:a.endColumn,u=l-c+1,d=[];r.forEach(e=>{let{startRow:t,endRow:n,startColumn:r,endColumn:i,rangeType:a}=e;s?o?c<=t&&(t+=u,n+=u):c<=r&&(r+=u,i+=u):o?l<t&&(t-=u,n-=u):l<r&&(r-=u,i-=u),(e.startRow!==e.endRow||e.startColumn!==e.endColumn)&&d.push({startRow:t,endRow:n,startColumn:r,endColumn:i,rangeType:a})}),n.setMergeData(d),this.disposableCollection.dispose();let{unitId:f,subUnitId:p}=e.params,m=e=>this.refRangeHandle(e,f,p);d.forEach(e=>{this.disposableCollection.add(this._refRangeService.registerRefRange(e,m,f,p))})}}))}};Lq=dG([uG(0,M(z)),uG(1,M(Fq)),uG(2,M(B)),uG(3,M(Ue)),uG(4,M(hG)),uG(5,M(TK))],Lq);function Rq(e,t){return t?e.getUniverSheetInstance(t):e.getCurrentUnitOfType(N.UNIVER_SHEET)}function zq(e,t){return t?e.getSheetBySheetId(t):e.getActiveSheet()}var Wmt=(e,t,n)=>{let r=e.get(TK).getCurrentSelections(),{value:i,selections:a,unitId:o,subUnitId:s}=t;if(r&&r.length>0){let e=r[r?.length-1].primary;if(e){let{actualColumn:t,actualRow:c}=e,{startRow:l,startColumn:u,endRow:d,endColumn:f}=a[a.length-1];if(i===hp.COLUMNS){let e=n.find(e=>e.startColumn===t&&e.endColumn===t&&c===e.startRow);e&&(f=e.endColumn,l=e.startRow,d=e.endRow)}else if(i===hp.ROWS){let e=n.find(e=>e.startRow===c&&e.endRow===c&&t===e.startColumn);e&&(d=e.endRow,u=e.startColumn,f=e.endColumn)}let p={startRow:l,startColumn:u,endRow:d,endColumn:f,actualRow:c,actualColumn:t,isMerged:!0,isMergedMainCell:l===c&&u===t},m={unitId:o,subUnitId:s,type:3,selections:r.map((e,t,n)=>({range:e.range,style:null,primary:t===n.length-1?p:null}))};return{id:VK.id,params:m}}return null}return null},Gmt=(e,t)=>{let n=e.get(TK).getCurrentSelections(),{unitId:r,subUnitId:i}=t;if(n&&n.length>0&&n[n?.length-1].primary){let e={unitId:r,subUnitId:i,type:3,selections:[...n]};return{id:VK.id,params:e}}return null},Bq={type:R.COMMAND,id:`sheet.command.remove-worksheet-merge`,handler:(e,t)=>{let n=e.get(TK),r=e.get(z),i=e.get($b),a=t?.ranges||n.getCurrentSelections()?.map(e=>e.range);if(!a?.length)return!1;let o=rG(e.get(B),t);if(!o)return!1;let{subUnitId:s,unitId:c,worksheet:l}=o,u={unitId:c,subUnitId:s,ranges:a},d=l.getConfig().mergeData.filter(e=>a.some(t=>n_.intersects(t,e)));if(!d.length)return!1;let f=jG(e,u),p=n.getCurrentSelections(),m=I.deepClone(p),h=I.deepClone(p);if(p.length){let e=h[h.length-1],{startRow:t,startColumn:n}=e.range;e.primary={startRow:t,startColumn:n,endRow:t,endColumn:n,actualRow:t,actualColumn:n,isMerged:!1,isMergedMainCell:!1}}let g={unitId:c,subUnitId:s,cellValue:Kmt(l,d).getMatrix()},_=UG(e,g),v=[{id:MG.id,params:f},{id:WG.id,params:g},{id:VK.id,params:{unitId:c,subUnitId:s,selections:h,type:3}}],y=[{id:oG.id,params:f},{id:WG.id,params:_},{id:VK.id,params:{unitId:c,subUnitId:s,selections:m,type:3}}];return Bm(v,r).result?(i.pushUndoRedo({unitID:c,undoMutations:y,redoMutations:v}),!0):!1}};function Kmt(e,t){let n=new Mh;return t.forEach(t=>{let{startRow:r,startColumn:i,endColumn:a,endRow:o}=t,s=e.getCellMatrix().getValue(r,i);if(s?.s)for(let e=r;e<=o;e++)for(let t=i;t<=a;t++)(e!==r||t!==i)&&n.setValue(e,t,{s:s.s})}),n}function qmt(e,t){return t.some(t=>Jmt(e,t))}function Jmt(e,t){let{startRow:n,startColumn:r,endColumn:i,endRow:a}=t,o=e.getMatrixWithMergedCells(n,r,a,i),s=!1;return o.forValue((t,i,a)=>{if(a&&(t!==n||i!==r)&&e.cellHasValue(a))return s=!0,!1}),s}function Ymt(e,t,n,r){let i=[],a=[],o=n.getSheetId();return r.forEach(r=>{let s={unitId:t,subUnitId:o,cellValue:Xmt(n,r).getData()},c=UG(e,s);i.push({id:WG.id,params:c}),a.push({id:WG.id,params:s})}),{undos:i,redos:a}}function Xmt(e,t){let{startRow:n,startColumn:r,endColumn:i,endRow:a}=t,o=e.getMatrixWithMergedCells(n,r,a,i,gh.Raw),s=new Mh,c=null;return o.forValue((t,i,a)=>{if(a&&t>=n&&i>=r){var o;!c&&e.cellHasValue(a)&&(a.v!==``||(((o=a.p)==null||(o=o.body)==null||(o=o.dataStream)==null?void 0:o.length)??0)>2)&&(c=a),s.setValue(t,i,a.s?{v:null,t:null,f:null,si:null,p:null,s:a.s}:null)}}),s.setValue(n,r,c),s}var Vq={type:R.COMMAND,id:`sheet.command.add-worksheet-merge`,handler:async(e,t)=>{let n=rG(e.get(B),t);if(!n)return!1;let{worksheet:r}=n,{unitId:i,subUnitId:a,selections:o}=t,s=e.get(z),c=e.get($b),l=Iq(o,t.value),u=qmt(r,l);if(u&&!t.defaultMerge){let t=e.get(Ay),n=e.get(Rb);if(!await t.confirm({id:`merge.confirm.add-worksheet-merge`,title:{title:`sheets.merge.confirm.warning`},children:{title:`sheets.merge.confirm.title`},cancelText:n.t(`sheets.merge.confirm.cancel`),confirmText:n.t(`sheets.merge.confirm.confirm`)}))return!1}let d=[],f=[],p={unitId:i,subUnitId:a,ranges:I.deepClone(l)},m={unitId:i,subUnitId:a,ranges:I.deepClone(l)},h=jG(e,p),g=aG(e,m);if(h.ranges.length>0&&d.push({id:MG.id,params:h}),d.push({id:oG.id,params:m}),f.push({id:MG.id,params:g}),h.ranges.length>0&&f.push({id:oG.id,params:h}),u){let t=Ymt(e,i,r,l);d.unshift(...t.redos),f.push(...t.undos)}let _=Wmt(e,t,l);_&&d.push(_);let v=Gmt(e,t);v&&f.push(v);let y=e.get(hG).onCommandExecute({id:Vq.id,params:{unitId:i,subUnitId:a,ranges:l}});return d.push(...y.redos),f.push(...y.undos),Bm(d,s).result?(c.pushUndoRedo({unitID:i,undoMutations:f,redoMutations:d}),!0):!1}},Hq={type:R.COMMAND,id:`sheet.command.add-worksheet-merge-all`,handler:async e=>{let t=Kq(`mergeAll`,e.get(TK).getCurrentSelections()?.map(e=>e.range));if(!t?.length)return!1;let n=rG(e.get(B));if(!n)return!1;let{worksheet:r}=n,i=r.getUnitId(),a=r.getSheetId();return e.get(z).executeCommand(Vq.id,{selections:t,unitId:i,subUnitId:a})}},Uq={type:R.COMMAND,id:`sheet.command.add-worksheet-merge-vertical`,handler:async e=>{let t=Kq(`mergeVertical`,e.get(TK).getCurrentSelections()?.map(e=>e.range));if(!t?.length)return!1;let n=rG(e.get(B));if(!n)return!1;let{worksheet:r}=n,i=r.getUnitId(),a=r.getSheetId();return e.get(z).executeCommand(Vq.id,{value:hp.COLUMNS,selections:t,unitId:i,subUnitId:a})}},Wq={type:R.COMMAND,id:`sheet.command.add-worksheet-merge-horizontal`,handler:async e=>{let t=Kq(`mergeHorizontal`,e.get(TK).getCurrentSelections()?.map(e=>e.range));if(!t?.length)return!1;let n=rG(e.get(B));if(!n)return!1;let{workbook:r,worksheet:i}=n,a=r.getUnitId(),o=i.getSheetId();return e.get(z).executeCommand(Vq.id,{value:hp.ROWS,selections:t,unitId:a,subUnitId:o})}};function Gq(e,t,n,r,i={}){let a=rG(e.get(B),{unitId:t,subUnitId:n});if(!a)return;let o=e.get(z),{defaultMerge:s=!0,isForceMerge:c=!1}=i,{worksheet:l}=a;if(l.getMergeData().some(e=>r.some(t=>n_.intersects(t,e)))){if(!c)throw Error(`The ranges to be merged overlap with the existing merged cells`);o.syncExecuteCommand(Bq.id,{unitId:t,subUnitId:n,ranges:r})}o.executeCommand(Vq.id,{unitId:t,subUnitId:n,selections:r,defaultMerge:s})}function Kq(e,t){return t?e===`mergeAll`?t.filter(e=>e.startRow!==e.endRow||e.startColumn!==e.endColumn):e===`mergeVertical`?t.filter(e=>e.startRow!==e.endRow):e===`mergeHorizontal`?t.filter(e=>e.startColumn!==e.endColumn):t:null}var qq=class{constructor(){Z(this,`_model`,new Map),Z(this,`_ruleChange`,new io),Z(this,`_ruleRefresh`,new io),Z(this,`_resetOrder`,new io),Z(this,`ruleChange$`,this._ruleChange.asObservable()),Z(this,`ruleRefresh$`,this._ruleRefresh.asObservable()),Z(this,`resetOrder$`,this._resetOrder.asObservable()),Z(this,`_worksheetRuleInitStateChange`,new oo(!1)),Z(this,`worksheetRuleInitStateChange$`,this._worksheetRuleInitStateChange.asObservable())}changeRuleInitState(e){this._worksheetRuleInitStateChange.next(e)}getSheetRuleInitState(){return this._worksheetRuleInitStateChange.value}addRule(e,t){this._ensureSubUnitMap(e).set(t.subUnitId,t),this._ruleChange.next({unitId:e,rule:t,type:`add`,subUnitId:t.subUnitId})}deleteRule(e,t){var n;let r=(n=this._model)==null||(n=n.get(e))==null?void 0:n.get(t);if(r){var i;(i=this._model.get(e))==null||i.delete(t),this._ruleChange.next({unitId:e,rule:r,type:`delete`,subUnitId:t})}}setRule(e,t,n){let r=this.getRule(e,t);if(r){var i;(i=this._model)==null||(i=i.get(e))==null||i.set(t,n),this._ruleChange.next({unitId:e,oldRule:r,rule:n,type:`set`,subUnitId:t})}}getRule(e,t){var n;return(n=this._model)==null||(n=n.get(e))==null?void 0:n.get(t)}toObject(){let e={};return[...this._model.keys()].forEach(t=>{let n=this._model.get(t);n?.size&&(e[t]=[],[...n.keys()].forEach(r=>{let i=n.get(r);i&&e[t].push(i)}))}),e}fromObject(e){let t=new Map;Object.keys(e).forEach(n=>{let r=e[n];if(r?.length){let e=new Map;r.forEach(t=>{e.set(t.subUnitId,t)}),t.set(n,e)}}),this._model=t}deleteUnitModel(e){this._model.delete(e)}_ensureSubUnitMap(e){let t=this._model.get(e);return t||(t=new Map,this._model.set(e,t)),t}ruleRefresh(e){this._ruleRefresh.next(e)}resetOrder(){this._resetOrder.next(Math.random())}getTargetByPermissionId(e,t){let n=this._model.get(e);if(!n)return null;for(let[r,i]of n)if(i.permissionId===t)return[e,r]}},Jq={id:`sheet.mutation.add-worksheet-protection`,type:R.MUTATION,handler:(e,t)=>{let n=e.get(qq),{unitId:r,rule:i}=t;return n.addRule(r,i),!0}},Yq={id:`sheet.mutation.delete-worksheet-protection`,type:R.MUTATION,handler:(e,t)=>{let n=e.get(qq),{unitId:r,subUnitId:i}=t;return n.deleteRule(r,i),!0}},Xq={type:R.COMMAND,id:`sheet.command.add-worksheet-protection`,async handler(e,t){if(!t)return!1;let n=e.get(z),r=e.get($b),{rule:i,unitId:a}=t,o=i.subUnitId;if(await n.executeCommand(Jq.id,{unitId:a,rule:i,subUnitId:i.subUnitId})){let e=[{id:Jq.id,params:{unitId:a,rule:i,subUnitId:i.subUnitId}}],t=[{id:Yq.id,params:{unitId:a,subUnitId:o}}];r.pushUndoRedo({unitID:a,redoMutations:e,undoMutations:t})}return!0}},Zmt={type:R.COMMAND,id:`sheet.command.set-worksheet-range-theme-style`,handler:(e,t)=>{let n=e.get(z),r=e.get($b),{unitId:i}=t,a=xft(e,t);return n.syncExecuteCommand(bG.id,t)?(r.pushUndoRedo({unitID:i,undoMutations:[{id:xG.id,params:a}],redoMutations:[{id:bG.id,params:t}]}),!0):!1}},Qmt={type:R.COMMAND,id:`sheet.command.append-row`,handler:(e,t)=>{let n=e.get(z),r=e.get($b),{unitId:i,subUnitId:a,cellValue:o,insertRowNums:s,insertColumnNums:c,maxRows:l,maxColumns:u}=t,d={unitId:i,subUnitId:a,cellValue:o},f=UG(e,d),p=[{id:WG.id,params:d}],m=[{id:WG.id,params:f}];if(s){let t={unitId:i,subUnitId:a,range:{startRow:l,endRow:l,startColumn:0,endColumn:u-1}},n=SG(e,t);p.unshift({id:CG.id,params:t}),m.push({id:kG.id,params:n})}if(c){let t={unitId:i,subUnitId:a,range:{startRow:0,endRow:l-1,startColumn:u,endColumn:u-1+c}},n=wG(e,t);p.unshift({id:TG.id,params:t}),m.push({id:AG.id,params:n})}return Bm(p,n).result?(r.pushUndoRedo({unitID:i,undoMutations:m,redoMutations:p}),!0):!1}},$mt=[`ff`,`fs`,`tr`,`tb`],Zq={type:R.COMMAND,id:`sheet.command.set-style`,handler:(e,t)=>{let n=rG(e.get(B),t);if(!n)return!1;let{unitId:r,subUnitId:i,worksheet:a}=n,{range:o,style:s}=t,c=e.get(z),l=e.get($b),u=e.get(TK),d=o?[o]:u.getCurrentSelections()?.map(e=>e.range);if(!d?.length)return!1;let f=new Mh,p=Wpt(a);if(I.isArray(s.value))for(let e=0;e<d.length;e++)p.forOperableEach(d[e],(e,t,n)=>{f.setValue(e,t,{s:{[s.type]:s.value[e-n.startRow][t-n.startColumn]}})});else for(let e=0;e<d.length;e++){let t={s:{[s.type]:s.value}};p.forOperableEach(d[e],(e,n)=>f.setValue(e,n,t))}let m={subUnitId:i,unitId:r,cellValue:f.getMatrix()},h=e.get(OK).getSkeleton(r,i),g=UG(e,m),_=null;if($mt.includes(t?.style.type)){let{suitableRanges:e,remainingRanges:t}=AK(d,h);_={suitableRanges:e,remainingRanges:t,cellHeights:kK(e,a)}}let v=c.syncExecuteCommand(WG.id,m),y=e.get(hG),b=[],x=[];if(_){let{suitableRanges:e,remainingRanges:t,cellHeights:n}=_,{undos:a,redos:o}=y.generateMutationsOfAutoHeight({unitId:r,subUnitId:i,ranges:e,autoHeightRanges:e,lazyAutoHeightRanges:t,cellHeights:n});b=a,x=o}let{undos:S,redos:C}=y.onCommandExecute({id:Zq.id,params:t}),w=Bm([...C,...x],c);return v&&w.result?(l.pushUndoRedo({unitID:m.unitId,undoMutations:[{id:WG.id,params:g},...S,...b],redoMutations:[{id:WG.id,params:m},...C,...x]}),!0):!1}},Qq={type:R.COMMAND,id:`sheet.command.set-bold`,handler:e=>{let t=e.get(TK).getCurrentLastSelection();if(!t)return!1;let n=rG(e.get(B));if(!n)return!1;let{worksheet:r}=n,{actualRow:i,actualColumn:a}=t.primary,o={style:{type:`bl`,value:r.getRange(i,a).getFontWeight()===kp.BOLD?jp.FALSE:jp.TRUE}};return e.get(z).syncExecuteCommand(Zq.id,o)}},$q={type:R.COMMAND,id:`sheet.command.set-italic`,handler:e=>{let t=e.get(TK).getCurrentLastSelection();if(!t)return!1;let n=rG(e.get(B));if(!n)return!1;let{worksheet:r}=n,i=!0;if(t.primary){let{startRow:e,startColumn:n}=t.primary;i=r.getRange(e,n).getFontStyle()===Op.ITALIC}let a={style:{type:`it`,value:i?jp.FALSE:jp.TRUE}};return e.get(z).syncExecuteCommand(Zq.id,a)}},eJ={type:R.COMMAND,id:`sheet.command.set-underline`,handler:e=>{let t=e.get(TK).getCurrentLastSelection();if(!t)return!1;let n=rG(e.get(B));if(!n)return!1;let{worksheet:r}=n,i=!0;t.primary&&(i=!!r.getRange(t.primary.startRow,t.primary.startColumn).getUnderline().s);let a={style:{type:`ul`,value:{s:i?jp.FALSE:jp.TRUE}}};return e.get(z).syncExecuteCommand(Zq.id,a)}},tJ={type:R.COMMAND,id:`sheet.command.set-stroke`,handler:e=>{let t=e.get(TK).getCurrentLastSelection();if(!t)return!1;let n=rG(e.get(B));if(!n)return!1;let{worksheet:r}=n,i=!0;t.primary&&(i=!!r.getRange(t.primary.actualRow,t.primary.actualColumn).getStrikeThrough().s);let a={style:{type:`st`,value:{s:i?jp.FALSE:jp.TRUE}}};return e.get(z).syncExecuteCommand(Zq.id,a)}};R.COMMAND;var nJ={type:R.COMMAND,id:`sheet.command.set-font-family`,handler:(e,t)=>{if(!t)return!1;let n=e.get(z),r={style:{type:`ff`,value:t.value}};return n.syncExecuteCommand(Zq.id,r)}},rJ={type:R.COMMAND,id:`sheet.command.set-font-size`,handler:(e,t)=>{if(!t)return!1;let n=e.get(z),r={style:{type:`fs`,value:t.value}};return n.syncExecuteCommand(Zq.id,r)}},iJ={type:R.COMMAND,id:`sheet.command.set-text-color`,handler:(e,t)=>{if(!t)return!1;let n=e.get(z),r={style:{type:`cl`,value:{rgb:t.value}}};return n.syncExecuteCommand(Zq.id,r)}},eht={type:R.COMMAND,id:`sheet.command.reset-text-color`,handler:e=>e.get(z).syncExecuteCommand(Zq.id,{style:{type:`cl`,value:{rgb:null}}})},aJ={type:R.COMMAND,id:`sheet.command.set-background-color`,handler:(e,t)=>{if(!t||!t.value)return!1;let n=e.get(z),r={style:{type:`bg`,value:{rgb:t.value}}};return n.syncExecuteCommand(Zq.id,r)}},oJ={type:R.COMMAND,id:`sheet.command.reset-background-color`,handler:e=>e.get(z).syncExecuteCommand(Zq.id,{style:{type:`bg`,value:{rgb:null}}})},sJ={type:R.COMMAND,id:`sheet.command.set-vertical-text-align`,handler:(e,t)=>{if(!t)return!1;let n=e.get(z),r={unitId:t.unitId,subUnitId:t.subUnitId,range:t.range,style:{type:`vt`,value:t.value}};return n.syncExecuteCommand(Zq.id,r)}},cJ={type:R.COMMAND,id:`sheet.command.set-horizontal-text-align`,handler:(e,t)=>{if(!t)return!1;let n=e.get(z),r={unitId:t.unitId,subUnitId:t.subUnitId,range:t.range,style:{type:`ht`,value:t.value}};return n.syncExecuteCommand(Zq.id,r)}},lJ={type:R.COMMAND,id:`sheet.command.set-text-wrap`,handler:(e,t)=>{if(!t)return!1;let n=e.get(z),r={unitId:t.unitId,subUnitId:t.subUnitId,range:t.range,style:{type:`tb`,value:t.value}};return n.syncExecuteCommand(Zq.id,r)}},uJ={type:R.COMMAND,id:`sheet.command.set-text-rotation`,handler:(e,t)=>{if(!t)return!1;let n=typeof t.value==`number`?{a:t.value}:{a:0,v:jp.TRUE},r=e.get(z),i={unitId:t.unitId,subUnitId:t.subUnitId,range:t.range,style:{type:`tr`,value:n}};return r.syncExecuteCommand(Zq.id,i)}},dJ={零:0,一:1,二:2,三:3,四:4,五:5,六:6,七:7,八:8,九:9},fJ=[`零`,`一`,`二`,`三`,`四`,`五`,`六`,`七`,`八`,`九`],pJ=[``,`万`,`亿`,`万亿`,`亿亿`],tht=[``,`十`,`百`,`千`],mJ={十:{value:10,secUnit:!1},百:{value:100,secUnit:!1},千:{value:1e3,secUnit:!1},万:{value:1e4,secUnit:!0},亿:{value:1e8,secUnit:!0}};function hJ(e){if(!e)return 0;let t=0,n=0,r=0,i=!1,a=e.split(``);for(let e=0;e<a.length;e++){let o=dJ[a[e]];if(o!==void 0)r=o,e===a.length-1&&(n+=r);else{let o=mJ[a[e]],s=o.value;i=o.secUnit,i?(n=(n+r)*s,t+=n,n=0):n+=r*s,r=0}}return t+n}function nht(e){let t=``,n=``,r=0,i=!0;for(;e>0;){let a=e%10;a===0?i||(i=!0,n=fJ[a]+n):(i=!1,t=fJ[a],t+=tht[r],n=t+n),r++,e=Math.floor(e/10)}return n}function rht(e){let t=0,n=``,r=``,i=!1;if(e===0)return fJ[0];for(;e>0;){let a=e%1e4;i&&(r=fJ[0]+r),n=nht(a),n+=a===0?pJ[0]:pJ[t],r=n+r,i=a<1e3&&a>0,e=Math.floor(e/1e4),t++}return r}function iht(e){if(!e)return!1;let t=!0;if(e){if(e.length===1)t=e===`日`||e in dJ;else{let n=e.split(``);for(let e=0;e<n.length;e++)if(!(n[e]in dJ||n[e]in mJ)){t=!1;break}}}return t}function aht(e){if(!e)return{isExtendNumber:!1};let t=[...e.matchAll(/\d+/g)];if(!t.length)return{isExtendNumber:!1};let n=t[t.length-1],r=n[0],i=n.index,a=e.substring(0,i),o=e.substring(i+r.length);return{isExtendNumber:!0,rawMatchTxt:r,matchNumber:Number(r),beforeTxt:a,afterTxt:o}}function oht(e){let t;return t=e.length===1?e===`日`||hJ(e)<7:!1,t}function sht(e){let t;return t=e.length===2?e===`周一`||e===`周二`||e===`周三`||e===`周四`||e===`周五`||e===`周六`||e===`周日`:!1,t}function cht(e){let t;return t=e.length===3?e===`星期一`||e===`星期二`||e===`星期三`||e===`星期四`||e===`星期五`||e===`星期六`||e===`星期日`:!1,t}function lht(e,t){let n=0;for(let r=0;r<e.length&&e[r]<t;r++)n++;return n}function uht(e){if(e.length<3)return!0;let t=e[1]-e[0],n=!1;for(let r=2;r<e.length;r++){let i=e[r]-e[r-1];if(i!==t){if(n||i!==-t)return!1;t=i,n=!0}}return!0}function dht(e,t,n){let r=[],i=Math.floor(t/e),a=t%e,o=0;if(i>0){for(let t=0;t<i;t++)for(let i=0;i<n.length;i++)r[n[i]+t*e]=o,o++;for(let t=0;t<n.length&&n[t]<a;t++)r[n[t]+e*i]=o,o++}else for(let e=0;e<n.length&&n[e]<a;e++)r[n[e]]=o,o++;return r}function fht(e,t){let n=[];for(let r=1;r<=t;r++){let t=(r-1)%e.length,i=I.deepClone(e[t]);vJ(i),n.push({v:null,s:null,p:null,f:null,si:null,t:null,...i})}return n}function pht(e,t){let n=[];for(let r=1;r<=t;r++){let t={s:e[(r-1)%e.length]?.s};n.push(t)}return n}function mht(e){let t=!0,n=e[1]/e[0];for(let r=1;r<e.length;r++)if(e[r]/e[r-1]!==n){t=!1;break}return t}function hht(e){let t=[];for(let n=1;n<=e;n++)t.push(n);return t}function ght(e,t,n){let r=[],i=[];for(let t=0;t<e.length;t++)i.push(Number(e[t]?.v));if(e.length>2&&mht(i))for(let n=1;n<=t;n++){let t=(n-1)%e.length,i=I.deepClone(e[t]);vJ(i);let a=Number(e[e.length-1]?.v)*(Number(e[1]?.v)/Number(e[0]?.v))**n;i&&(_J(i)&&(i.v=a),r.push(i))}else{let a=hht(e.length);for(let o=1;o<=t;o++){let t=(o-1)%e.length,s=I.deepClone(e[t]);vJ(s);let c=n===L.DOWN||n===L.RIGHT,l=_ht(e.length+o,i,a,c);s&&(_J(s)&&(s.v=l),r.push(s))}}return r}function _ht(e,t,n,r=!0){function i(e){let t=0;for(let n=0;n<e.length;n++)t+=e[n];return t/e.length}let a=i(n),o=i(t),s=0,c=0;for(let e=0;e<n.length;e++)s+=(n[e]-a)*(t[e]-o),c+=(n[e]-a)*(n[e]-a);let l;l=c===0?r?1:-1:s/c;let u=o-l*a;return Math.round((u+l*e)*1e5)/1e5}function vht(e,t,n){let r=[],i=e[e.length-1],a=aht(`${i?.v}`);if(!a.isExtendNumber)return fht(e,t);let{matchNumber:o,rawMatchTxt:s,beforeTxt:c,afterTxt:l}=a,u=s.length;for(let i=1;i<=t;i++){let t=(i-1)%e.length,a=I.deepClone(e[t]);if(vJ(a),!a||!a.v)continue;let s=Math.abs(o+n*i).toString();s.length<u&&(s=s.padStart(u,`0`));let d=`${c}${s}${l}`;a&&(a.v=d,r.push(a))}return r}function yht(e,t){let n=[];for(let r=1;r<=t;r++){let t=(r-1)%e.length,i=I.deepClone(e[t]);vJ(i),i&&(delete i.v,n.push(i))}return n}function bht(e,t,n,r=0){let i=[[`日`,`一`,`二`,`三`,`四`,`五`,`六`],[`周日`,`周一`,`周二`,`周三`,`周四`,`周五`,`周六`],[`星期日`,`星期一`,`星期二`,`星期三`,`星期四`,`星期五`,`星期六`]];if(r>=i.length)return[];let a=i[r],o=[];for(let r=1;r<=t;r++){let t=(r-1)%e.length,i=I.deepClone(e[t]);vJ(i);let s=0;if(e[e.length-1]?.v===a[0])s=7+n*r;else{let t=`${e[e.length-1]?.v}`;t&&(s=hJ(t.substr(t.length-1,1))+n*r)}s<0&&(s=Math.ceil(Math.abs(s)/7)*7+s);let c=s%7;i&&(i.v=a[c],o.push(i))}return o}function xht(e,t,n){let r=[];for(let i=1;i<=t;i++){let t=(i-1)%e.length,a=I.deepClone(e[t]);vJ(a);let o=hJ(`${e[e.length-1]?.v}`)+n*i,s;s=o<=0?`零`:rht(o),a&&(a.v=s,r.push(a))}return r}var gJ={enWeek1:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],enWeek2:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],enMonth1:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],enMonth2:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],chnMonth1:[`一月`,`二月`,`三月`,`四月`,`五月`,`六月`,`七月`,`八月`,`九月`,`十月`,`十一月`,`十二月`],chnMonth2:[`正月`,`二月`,`三月`,`四月`,`五月`,`六月`,`七月`,`八月`,`九月`,`十月`,`十一月`,`腊月`],chHour1:[`子`,`丑`,`寅`,`卯`,`辰`,`巳`,`午`,`未`,`申`,`酉`,`戌`,`亥`],chHour2:[`子时`,`丑时`,`寅时`,`卯时`,`辰时`,`巳时`,`午时`,`未时`,`申时`,`酉时`,`戌时`,`亥时`],chYear1:[`甲`,`乙`,`丙`,`丁`,`戊`,`己`,`庚`,`辛`,`壬`,`癸`],chSeason1:[`春`,`夏`,`秋`,`冬`],chSeason2:[`春季`,`夏季`,`秋季`,`冬季`]};function Sht(e){let t=!1;return Object.keys(gJ).forEach(n=>{gJ[n].includes(e)&&(t=!0)}),t}function Cht(e){let t=``,n=[];return Object.keys(gJ).forEach(r=>{gJ[r].includes(e)&&(t=r,n.push(...gJ[r]))}),{name:t,series:n}}function wht(e,t,n,r){let i=r.length,a=[];for(let o=1;o<=t;o++){let t=(o-1)%e.length,s=I.deepClone(e[t]);vJ(s);let c=`${e[e.length-1]?.v}`,l=r.indexOf(c)+n*o;l<0&&(l+=Math.abs(n)*i);let u=l%i;s&&(s.v=r[u],a.push(s))}return a}function Tht(e,t){let n=[],r;if(t.startRow<e.startRow)r=L.UP;else if(t.endRow>e.endRow)r=L.DOWN;else if(t.startColumn<e.startColumn)r=L.LEFT;else if(t.endColumn>e.endColumn)r=L.RIGHT;else return[];if(r===L.DOWN||r===L.UP){let i=e.endRow-e.startRow+1,a=t.endRow-t.startRow+1,o=Math.floor(a/i),s=a%i,c={startRow:0,startColumn:0,endRow:e.endRow-e.startRow,endColumn:e.endColumn-e.startColumn};if(r===L.DOWN){for(let t=0;t<o;t++)n.push({repeatStartCell:{row:e.startRow+(t+1)*i,col:e.startColumn},relativeRange:c});s>0&&n.push({repeatStartCell:{row:e.startRow+(o+1)*i,col:e.startColumn},relativeRange:{startRow:0,startColumn:0,endRow:s-1,endColumn:e.endColumn-e.startColumn}})}else{for(let t=0;t<o;t++)n.push({repeatStartCell:{row:e.startRow-(t+1)*i,col:e.startColumn},relativeRange:c});s>0&&n.push({repeatStartCell:{row:e.startRow-(o+1)*i,col:e.startColumn},relativeRange:{startRow:i-s,endRow:i-1,startColumn:0,endColumn:e.endColumn-e.startColumn}})}}if(r===L.RIGHT||r===L.LEFT){let i=e.endColumn-e.startColumn+1,a=t.endColumn-t.startColumn+1,o=Math.floor(a/i),s=a%i,c={startRow:0,startColumn:0,endRow:e.endRow-e.startRow,endColumn:e.endColumn-e.startColumn};if(r===L.RIGHT){for(let t=0;t<o;t++)n.push({repeatStartCell:{row:e.startRow,col:e.startColumn+(t+1)*i},relativeRange:c});s>0&&n.push({repeatStartCell:{row:e.startRow,col:e.startColumn+(o+1)*i},relativeRange:{startRow:0,startColumn:0,endRow:e.endRow-e.startRow,endColumn:s-1}})}else{for(let t=0;t<o;t++)n.push({repeatStartCell:{row:e.startRow,col:e.startColumn-(t+1)*i},relativeRange:c});s>0&&n.push({repeatStartCell:{row:e.startRow,col:e.startColumn-(o+1)*i},relativeRange:{startRow:0,startColumn:i-s,endRow:e.endRow-e.startRow,endColumn:i-1}})}}return n}function _J(e){return!(Lh(e.f)||Rh(e.si)||e.t===Mp.BOOLEAN)}function vJ(e){e&&`custom`in e&&delete e.custom}function Eht(e,t){return t?e.reverse():e}function Dht(e){let t=new Mh;return e.forEach(e=>{let{rows:n,cols:r}=e;n.forEach(e=>{r.forEach(n=>{t.setValue(e,n,{v:null,s:null,p:null,f:null,si:null,custom:null})})})}),t.clone()}var yJ={chnNumChar:dJ,chnNumChar2:fJ,chnUnitSection:pJ,chnUnitChar:tht,chnNameValue:mJ,chineseToNumber:hJ,sectionToChinese:nht,numberToChinese:rht,isChnNumber:iht,matchExtendNumber:aht,isChnWeek1:oht,isChnWeek2:sht,isChnWeek3:cht,getLenS:lht,isEqualDiff:uht,getDataIndex:dht,fillCopy:fht,fillCopyStyles:pht,isEqualRatio:mht,getXArr:hht,fillSeries:ght,forecast:_ht,fillExtendNumber:vht,fillOnlyFormat:yht,fillChnWeek:bht,fillChnNumber:xht,isLoopSeries:Sht,getLoopSeriesInfo:Cht,fillLoopSeries:wht,getAutoFillRepeatRange:Tht,needsUpdateCellValue:_J,removeCellCustom:vJ,reverseIfNeed:Eht,generateNullCellValueRowCol:Dht},bJ=function(e){return e.COPY=`COPY`,e.SERIES=`SERIES`,e.ONLY_FORMAT=`ONLY_FORMAT`,e.NO_FORMAT=`NO_FORMAT`,e}({}),Oht=function(e){return e.NUMBER=`number`,e.DATE=`date`,e.EXTEND_NUMBER=`extendNumber`,e.CHN_NUMBER=`chnNumber`,e.CHN_WEEK2=`chnWeek2`,e.CHN_WEEK3=`chnWeek3`,e.LOOP_SERIES=`loopSeries`,e.FORMULA=`formula`,e.OTHER=`other`,e}({}),kht=function(e){return e.APPEND=`APPEND`,e.DEFAULT=`DEFAULT`,e.ONLY=`ONLY`,e}({}),{chineseToNumber:xJ,fillChnNumber:Aht,fillChnWeek:SJ,fillCopy:CJ,fillExtendNumber:jht,fillLoopSeries:Mht,fillSeries:wJ,getLoopSeriesInfo:TJ,isChnNumber:Nht,isChnWeek2:Pht,isChnWeek3:Fht,isEqualDiff:EJ,isLoopSeries:Iht,matchExtendNumber:DJ,reverseIfNeed:OJ}=yJ,Lht={dateRule:{type:`date`,priority:1100,match:(e,t)=>{if(e?.f||e?.si)return!1;if((typeof e?.v==`number`||e?.t===Mp.NUMBER)&&e.s){if(typeof e.s==`string`){var n;let r=t.get(B).getCurrentUnitOfType(N.UNIVER_SHEET);if(!r)return!1;let i=r.getStyles().get(e.s),a=i==null||(n=i.n)==null?void 0:n.pattern;if(a)return cd(a).isDate}else if(e.s.n&&cd(e.s.n.pattern).isDate)return!0}return!1},isContinue:(e,t)=>e.type===`date`,applyFunctions:{SERIES:(e,t,n)=>{let{data:r}=e;return n===L.LEFT||n===L.UP?(r.reverse(),wJ(r,t,n).reverse()):wJ(r,t,n)}}},numberRule:{type:`number`,priority:1e3,match:e=>typeof e?.v==`number`||e?.t===Mp.NUMBER,isContinue:(e,t)=>e.type===`number`,applyFunctions:{SERIES:(e,t,n)=>{let{data:r}=e;return n===L.LEFT||n===L.UP?(r.reverse(),wJ(r,t,n).reverse()):wJ(r,t,n)}}},extendNumberRule:{type:`extendNumber`,priority:900,match:e=>DJ(`${e?.v}`||``).isExtendNumber,isContinue:(e,t)=>{if(e.type===`extendNumber`){let n=DJ(`${e.cellData?.v}`||``),r=DJ(`${t?.v}`||``);if(n.isExtendNumber&&r.isExtendNumber){let{beforeTxt:e,afterTxt:t}=n,{beforeTxt:i,afterTxt:a}=r;if(e===i&&t===a)return!0}}return!1},applyFunctions:{SERIES:(e,t,n)=>{let{data:r}=e,i=n===L.UP||n===L.LEFT,a;if(r.length===1)return a=i?-1:1,OJ(jht(r,t,a),i);let o=[];for(let e=0;e<r.length;e++){let t=DJ(`${r[e]?.v}`);t.isExtendNumber&&o.push(t.matchNumber)}if(i&&(r.reverse(),o.reverse()),EJ(o)){let e=r.length;return a=o[e-1]-o[e-2],OJ(jht(r,t,a),i)}return CJ(r,t)}}},chnNumberRule:{type:`chnNumber`,priority:830,match:e=>!!Nht(`${e?.v}`||``),isContinue:(e,t)=>e.type===`chnNumber`,applyFunctions:{SERIES:(e,t,n)=>{let{data:r}=e,i=n===L.LEFT||n===L.UP;if(r.length===1){let e=`${r[0]?.v}`,n;return n=i?-1:1,e&&(e===`日`||xJ(e)<7)?OJ(SJ(r,t,n),i):OJ(Aht(r,t,n),i)}let a=!1;for(let e=0;e<r.length;e++)if(r[e]?.v===`日`){a=!0;break}let o=[],s=0;for(let e=0;e<r.length;e++){let t=`${r[e]?.v}`;t===`日`?e===0?o.push(0):(s++,o.push(s*7)):a&&xJ(t)>0&&xJ(t)<7?o.push(xJ(t)+s*7):o.push(xJ(t))}if(i&&(r.reverse(),o.reverse()),EJ(o)){if(a||o[o.length-1]<6&&o[0]>0||o[0]<6&&o[o.length-1]>0){let e=r.length;return OJ(SJ(r,t,o[e-1]-o[e-2]),i)}return OJ(Aht(r,t,o[1]-o[0]),i)}return CJ(r,t)}}},chnWeek2Rule:{type:`chnWeek2`,priority:820,match:e=>!!Pht(`${e?.v}`||``),isContinue:(e,t)=>e.type===`chnWeek2`,applyFunctions:{SERIES:(e,t,n)=>{let{data:r}=e,i=n===L.LEFT||n===L.UP;if(r.length===1){let e;return e=i?-1:1,OJ(SJ(r,t,e,1),i)}let a=[],o=0;for(let e=0;e<r.length;e++){let t=`${r[e]?.v}`,n=t?.substr(t.length-1,1);t===`周日`?e===0?a.push(0):(o++,a.push(o*7)):a.push(xJ(n)+o*7)}if(i&&(r.reverse(),a.reverse()),EJ(a)){let e=r.length;return OJ(SJ(r,t,a[e-1]-a[e-2],1),i)}return CJ(r,t)}}},chnWeek3Rule:{type:`chnWeek3`,priority:810,match:e=>Fht(`${e?.v}`||``),isContinue:(e,t)=>e.type===`chnWeek3`,applyFunctions:{SERIES:(e,t,n)=>{let{data:r}=e,i=n===L.LEFT||n===L.UP;if(r.length===1){let e;return e=i?-1:1,OJ(SJ(r,t,e,2),i)}let a=[],o=0;for(let e=0;e<r.length;e++){let t=`${r[e]?.v}`;if(t){let n=t.substr(t.length-1,1);t===`星期日`?e===0?a.push(0):(o++,a.push(o*7)):a.push(xJ(n)+o*7)}}if(i&&(r.reverse(),a.reverse()),EJ(a)){let e=r.length;return OJ(SJ(r,t,a[e-1]-a[e-2],2),i)}return CJ(r,t)}}},loopSeriesRule:{type:`loopSeries`,priority:800,match:e=>Iht(`${e?.v}`||``),isContinue:(e,t)=>e.type===`loopSeries`&&TJ(`${e.cellData?.v}`||``).name===TJ(`${t?.v}`||``).name,applyFunctions:{SERIES:(e,t,n)=>{let{data:r}=e,i=n===L.LEFT||n===L.UP,{series:a}=TJ(`${r[0]?.v}`||``);if(r.length===1){let e;return e=i?-1:1,OJ(Mht(r,t,e,a),i)}let o=[],s=0;for(let e=0;e<r.length;e++){let t=`${r[e]?.v}`;t&&(t===a[0]?e===0?o.push(0):(s++,o.push(s*a.length)):o.push(a.indexOf(t)+s*7))}if(i&&(r.reverse(),o.reverse()),EJ(o)){let e=r.length;return OJ(Mht(r,t,o[e-1]-o[e-2],a),i)}return CJ(r,t)}}},otherRule:{type:`other`,priority:0,match:()=>!0,isContinue:(e,t)=>e.type===`other`}},{chnNumberRule:Rht,chnWeek2Rule:zht,chnWeek3Rule:Bht,dateRule:Vht,extendNumberRule:Hht,loopSeriesRule:Uht,numberRule:Wht,otherRule:Ght}=Lht,kJ=class extends F{constructor(e,t,n,r){super(),this._commandService=e,this._undoRedoService=t,this._univerInstanceService=n,this._injector=r,Z(this,`_rules`,[]),Z(this,`_hooks`,[]),Z(this,`_applyType$`,new oo(`SERIES`)),Z(this,`_isFillingStyle`,!0),Z(this,`_prevUndos`,[]),Z(this,`_autoFillLocation$`,new oo(null)),Z(this,`autoFillLocation$`,this._autoFillLocation$.asObservable()),Z(this,`_showMenu$`,new oo(!1)),Z(this,`showMenu$`,this._showMenu$.asObservable()),Z(this,`_direction`,L.DOWN),Z(this,`applyType$`,this._applyType$.asObservable()),Z(this,`_menu$`,new oo([{label:`sheets.autoFill.copy`,value:`COPY`,disable:!1},{label:`sheets.autoFill.series`,value:`SERIES`,disable:!1},{label:`sheets.autoFill.formatOnly`,value:`ONLY_FORMAT`,disable:!1},{label:`sheets.autoFill.noFormat`,value:`NO_FORMAT`,disable:!1}])),Z(this,`menu$`,this._menu$.asObservable()),this._init()}_init(){this._rules=[Vht,Wht,Hht,Rht,zht,Bht,Uht,Ght].sort((e,t)=>t.priority-e.priority),this._isFillingStyle=!0}_getOneByPriority(e){return e.length<=0?[]:[e.reduce((e,t)=>(t.priority||0)>(e.priority||0)?t:e,e[0])]}_initPrevUndo(){this._prevUndos=[]}async triggerAutoFill(e,t,n,r,i){if(n.startColumn===r.startColumn&&n.startRow===r.startRow&&n.endColumn===r.endColumn&&n.endRow===r.endRow)return!1;if(r.endColumn<n.endColumn&&r.endColumn>n.startColumn)return this._commandService.executeCommand(MJ.id,{clearRange:{startRow:r.startRow,endRow:r.endRow,startColumn:r.endColumn+1,endColumn:n.endColumn},selectionRange:r});if(r.endRow<n.endRow&&r.endRow>n.startRow)return this._commandService.executeCommand(MJ.id,{clearRange:{startRow:r.endRow+1,endRow:n.endRow,startColumn:r.startColumn,endColumn:r.endColumn},selectionRange:r});let a={startRow:r.startRow,endRow:r.endRow,startColumn:r.startColumn,endColumn:r.endColumn},o=null;if(r.startRow<n.startRow)o=L.UP,a.endRow=n.startRow-1;else if(r.endRow>n.endRow)o=L.DOWN,a.startRow=n.endRow+1;else if(r.startColumn<n.startColumn)o=L.LEFT,a.endColumn=n.startColumn-1;else if(r.endColumn>n.endColumn)o=L.RIGHT,a.startColumn=n.endColumn+1;else return!1;this.direction=o;let s=this._injector.invoke(e=>gK(n,e)),c=this._injector.invoke(e=>gK(a,e));if(!s||!c)return!1;this.autoFillLocation={source:s,target:c,unitId:e,subUnitId:t};let l=[];if(this.getActiveHooks().forEach(n=>{var r;let i=n==null||(r=n.onBeforeFillData)==null?void 0:r.call(n,{source:s,target:c,unitId:e,subUnitId:t},o);i&&l.unshift(i)}),this._initPrevUndo(),i)return this.fillData(i);for(let e=0;e<l.length;e++){let t=this.menu.find(t=>t.value===l[e]);if(t&&!t.disable)return this.fillData(l[e])}let u=this.menu.find(e=>e.disable===!1)?.value;return u?this.fillData(u):!1}addHook(e){if(this._hooks.find(t=>t.id===e.id))throw Error(`Add hook failed, hook id '${e.id}' already exist!`);return e.priority===void 0&&(e.priority=0),e.type===void 0&&(e.type=`APPEND`),this._hooks.push(e),Hf(()=>{let t=this._hooks.findIndex(t=>t===e);t>-1&&this._hooks.splice(t,1)})}registerRule(e){if(this._rules.find(t=>t.type===e.type))throw Error(`Registry rule failed, type '${e.type}' already exist!`);let t=this._rules.findIndex(t=>t.priority<e.priority);this._rules.splice(t===-1?this._rules.length:t,0,e)}getRules(){return this._rules}getAllHooks(){return this._hooks}getActiveHooks(){let{source:e,target:t,unitId:n,subUnitId:r}=this.autoFillLocation||{};if(!e||!t||!n||!r)return[];let i=this._hooks.filter(i=>!i.disable?.call(i,{source:e,target:t,unitId:n,subUnitId:r},this._direction,this.applyType)),a=i.filter(e=>e.type===`ONLY`);if(a.length>0)return this._getOneByPriority(a);let o=this._getOneByPriority(i.filter(e=>e.type===`DEFAULT`)),s=i.filter(e=>e.type===`APPEND`)||[];return[...o,...s]}get applyType(){return this._applyType$.getValue()}set applyType(e){this._applyType$.next(e)}get menu(){return this._menu$.getValue()}get direction(){return this._direction}set direction(e){this._direction=e}isFillingStyle(){return this._isFillingStyle}setFillingStyle(e){this._isFillingStyle=e}get autoFillLocation(){return this._autoFillLocation$.getValue()}set autoFillLocation(e){this._autoFillLocation$.next(e)}setDisableApplyType(e,t){this._menu$.next(this._menu$.getValue().map(n=>n.value===e?{...n,disable:t}:n))}setShowMenu(e){this._showMenu$.next(e)}fillData(e){var t;this.applyType=e;let n=this._univerInstanceService.getCurrentUnitOfType(N.UNIVER_SHEET),r=n?.getUnitId(),i=n==null||(t=n.getActiveSheet())==null?void 0:t.getSheetId(),{source:a,target:o,unitId:s=r,subUnitId:c=i}=this.autoFillLocation||{};if(!a||!o||!s||!c)return!1;let l=this._univerInstanceService.getUnit(s,N.UNIVER_SHEET);if(!l)return!1;let u=l.getSheetBySheetId(c);if(!u)return!1;let d=this.direction;this._prevUndos.length>0&&this._prevUndos.forEach(e=>{this._commandService.syncExecuteCommand(e.id,e.params)}),this._prevUndos=[];let f=n_.union(hK(a),hK(o)),p=this.getActiveHooks();s===r&&c===i&&this._commandService.syncExecuteCommand(VK.id,{selections:[{primary:FK({startRow:a.rows[0],endRow:a.rows[a.rows.length-1],startColumn:a.cols[0],endColumn:a.cols[a.cols.length-1]},u),range:{...f,rangeType:fh.NORMAL}}],unitId:s,subUnitId:c});let m=[],h=[];p.forEach(t=>{let{undos:n,redos:r}=t.onFillData?.call(t,{source:a,target:o,unitId:s,subUnitId:c},d,e)||{};n&&m.push(...n),r&&h.push(...r)});let g=h.every(e=>this._commandService.syncExecuteCommand(e.id,e.params)),{redos:_,undos:v}=this._getAutoHeightUndoRedos(h,l,u);return h.push(..._),m.push(...v),g&&(this._prevUndos=m,this._undoRedoService.pushUndoRedo({unitID:s,undoMutations:m,redoMutations:h})),p.forEach(t=>{var n;(n=t.onAfterFillData)==null||n.call(t,{source:a,target:o,unitId:s,subUnitId:c},d,e)}),this.setShowMenu(!0),!0}_getAutoHeightUndoRedos(e,t,n){if(this.applyType===`NO_FORMAT`)return{undos:[],redos:[]};let r=[],i=n.getConfig().defaultRowHeight,a=n.getRowManager();if(e.forEach(e=>{if(e.id===WG.id){let{cellValue:o}=e.params;new Mh(o).forValue((e,o,s)=>{let c=Object.keys(t.getStyles().get(s?.s)||{});if(s?.p||c.length&&$mt.some(e=>c.includes(e))){let t=n.getCellHeight(e,o),s=a.getRow(e);(!s&&t!==i||s&&t!==a.getRowHeight(e))&&r.push({row:e,autoHeight:t})}})}}),r.length===0)return{undos:[],redos:[]};let o={unitId:t.getUnitId(),subUnitId:n.getSheetId(),rowsAutoHeightInfo:r},s=eK(o,n),c={id:rK.id,params:o};return this._commandService.syncExecuteCommand(c.id,c.params)?{redos:[c],undos:[{id:rK.id,params:s}]}:{undos:[],redos:[]}}};kJ=dG([uG(0,z),uG(1,$b),uG(2,M(B)),uG(3,M(Ue))],kJ);var AJ=se(`univer.auto-fill-service`),jJ={type:R.COMMAND,id:`sheet.command.auto-fill`,handler:async(e,t)=>{let n=rG(e.get(B),t);if(!n)return!1;let{unitId:r,subUnitId:i}=n,{sourceRange:a,targetRange:o,applyType:s}=t;return e.get(AJ).triggerAutoFill(r,i,a,o,s)}};function Kht(e,t){let n=e.get(TK).getCurrentLastSelection();if(!n)return null;let r=rG(e.get(B));if(!r)return null;let{unitId:i,subUnitId:a}=r,{startRow:o,endRow:s,startColumn:c,endColumn:l}=n.range;return t===`down`?o===s?o===0?null:{sourceRange:{startRow:o-1,endRow:o-1,startColumn:c,endColumn:l},targetRange:{startRow:o-1,endRow:s,startColumn:c,endColumn:l},unitId:i,subUnitId:a,applyType:`COPY`}:{sourceRange:{startRow:o,endRow:o,startColumn:c,endColumn:l},targetRange:{startRow:o,endRow:s,startColumn:c,endColumn:l},unitId:i,subUnitId:a,applyType:`COPY`}:c===l?c===0?null:{sourceRange:{startRow:o,endRow:s,startColumn:c-1,endColumn:c-1},targetRange:{startRow:o,endRow:s,startColumn:c-1,endColumn:l},unitId:i,subUnitId:a,applyType:`COPY`}:{sourceRange:{startRow:o,endRow:s,startColumn:c,endColumn:c},targetRange:{startRow:o,endRow:s,startColumn:c,endColumn:l},unitId:i,subUnitId:a,applyType:`COPY`}}async function qht(e,t){let n=Kht(e,t);if(!n)return!1;let r=await e.get(z).executeCommand(jJ.id,n);return r&&e.get(AJ).setShowMenu(!1),r}var Jht={type:R.COMMAND,id:`sheet.command.copy-down`,handler:async e=>qht(e,`down`)},Yht={type:R.COMMAND,id:`sheet.command.copy-right`,handler:async e=>qht(e,`right`)},MJ={id:`sheet.command.auto-clear-content`,type:R.COMMAND,handler:async(e,t)=>{let n=rG(e.get(B));if(!n)return!1;let r=e.get(z),i=e.get($b),a=e.get(hG),o=e.get(TK),{unitId:s,subUnitId:c}=n,{clearRange:l,selectionRange:u}=t,{startColumn:d,startRow:f}=u,p={subUnitId:c,unitId:s,cellValue:Fpt([l])},m=UG(e,p),h=[{id:WG.id,params:p},{id:VK.id,params:{selections:[{primary:{startColumn:d,startRow:f,endColumn:d,endRow:f,actualRow:f,actualColumn:d,isMerged:!1,isMergedMainCell:!1},range:{...u}}],unitId:s,subUnitId:c}}],g=[{id:WG.id,params:m},{id:VK.id,params:{selections:[o.getCurrentLastSelection()],unitId:s,subUnitId:c}}];if(Bm(h,r).result){let e=a.afterCommandExecute({id:WG.id,params:p});return Bm(e.redos,r),i.pushUndoRedo({unitID:s,undoMutations:[...g,...e.undos],redoMutations:[...h,...e.redos]}),!0}return!1}},NJ={id:`sheet.command.clear-selection-content`,type:R.COMMAND,handler:(e,t)=>{let n=rG(e.get(B),{unitId:t?.unitId,subUnitId:t?.subUnitId});if(!n)return!1;let r=e.get(TK),{unitId:i,subUnitId:a}=n,o=t?.ranges||r.getCurrentSelections()?.map(e=>e.range);if(!o?.length)return!1;let s=e.get(OK).getSkeleton(i,a);if(!s)return!1;let c=e.get(z),l=e.get($b),u=e.get(hG),d=[],f=[],p={subUnitId:a,unitId:i,cellValue:Fpt(_K(o,e,i,a))},m=UG(e,p);d.push({id:WG.id,params:p}),f.push({id:WG.id,params:m});let h=u.onCommandExecute({id:NJ.id,params:t});d.push(...h.redos),f.unshift(...h.undos);let g=Bm(d,c),{suitableRanges:_,remainingRanges:v}=AK(o,s),{undos:y,redos:b}=u.generateMutationsOfAutoHeight({unitId:i,subUnitId:a,ranges:_,autoHeightRanges:_,lazyAutoHeightRanges:v}),x=Bm(b,c);return g.result&&x.result?(d.push(...b),f.push(...y),l.pushUndoRedo({unitID:i,undoMutations:f,redoMutations:d}),!0):!1}},PJ=`sheets.config`,FJ={largeSheetCellCountThreshold:6e3,batchSize:3e3},Xht={},IJ=class extends F{constructor(e,t){super(),this._commandService=e,this._univerInstanceService=t,Z(this,`_tasks`,new Map),Z(this,`_idleCallbackId`,null),Z(this,`_beforeUnloadHandler`,null),this._setupBeforeUnloadListener(),this.disposeWithMe(()=>{this._cancelAllTasks(),this._removeBeforeUnloadListener()})}hasPendingTasks(){return this._tasks.size>0}getPendingMutationsCount(){let e=0;for(let t of this._tasks.values())e+=t.mutations.length-t.currentIndex;return e}scheduleMutations(e,t,n){if(n.length===0)return;let r=`${e}_${t}`;this._cancelTask(r),this._tasks.set(r,{unitId:e,subUnitId:t,mutations:n,currentIndex:0}),this._scheduleNextIdle()}cancelScheduledMutations(e,t){let n=`${e}_${t}`;this._cancelTask(n)}_cancelTask(e){this._tasks.delete(e),this._tasks.size===0&&this._idleCallbackId!==null&&(typeof cancelIdleCallback<`u`&&cancelIdleCallback(this._idleCallbackId),this._idleCallbackId=null)}_cancelAllTasks(){this._tasks.clear(),this._idleCallbackId!==null&&(typeof cancelIdleCallback<`u`&&cancelIdleCallback(this._idleCallbackId),this._idleCallbackId=null)}_scheduleNextIdle(){this._idleCallbackId===null&&(this._idleCallbackId=typeof requestIdleCallback<`u`?requestIdleCallback(e=>this._processIdleTasks(e),{timeout:6e4}):setTimeout(()=>{this._processIdleTasks({didTimeout:!1,timeRemaining:()=>16})},16))}_processIdleTasks(e){this._idleCallbackId=null;for(let[t,n]of this._tasks){if(!this._isSheetExist(n.unitId,n.subUnitId)){this._tasks.delete(t);continue}for(n.currentIndex;n.currentIndex<n.mutations.length;){if(e.timeRemaining()<=0&&!e.didTimeout){this._scheduleNextIdle();return}let t=n.mutations[n.currentIndex];this._commandService.syncExecuteCommand(t.id,t.params,{onlyLocal:!0}),n.currentIndex++}this._tasks.delete(t)}this._tasks.size>0&&this._scheduleNextIdle()}_isSheetExist(e,t){let n=this._univerInstanceService.getUnit(e,N.UNIVER_SHEET);return n?n.getSheetBySheetId(t)!==null:!1}_setupBeforeUnloadListener(){typeof window>`u`||(this._beforeUnloadHandler=e=>{if(this.hasPendingTasks())return e.preventDefault(),e.returnValue=``,``},window.addEventListener(`beforeunload`,this._beforeUnloadHandler))}_removeBeforeUnloadListener(){typeof window>`u`||!this._beforeUnloadHandler||(window.removeEventListener(`beforeunload`,this._beforeUnloadHandler),this._beforeUnloadHandler=null)}};IJ=dG([uG(0,z),uG(1,B)],IJ);var Zht={id:`sheet.mutation.copy-worksheet-end`,type:R.MUTATION,handler:()=>!0},Qht=(e,t)=>({subUnitId:t.sheet.id,unitId:t.unitId,subUnitName:t.sheet.name}),LJ={id:`sheet.mutation.insert-sheet`,type:R.MUTATION,handler:(e,t)=>{let n=e.get(B),{sheet:r,index:i,unitId:a,styles:o}=t,s=n.getUniverSheetInstance(a);return s?(o&&s.addStyles(o),s.addWorksheet(r.id,i,vb(r))):!1}};function $ht(e){let t=0;for(let n of Object.keys(e)){let r=e[Number(n)];r&&(t+=Object.keys(r).length)}return t}function egt(e,t,n,r){let i=[],a={},o=0;for(let e in n){let t=Number(e),s=n[t];if(!s)continue;let c=Object.keys(s).length;o>0&&o+c>r&&(i.push(a),a={},o=0),a[t]=s,o+=c,o>=r&&(i.push(a),a={},o=0)}return o>0&&i.push(a),{firstChunkCellData:i.length>0?i[0]:{},remainingMutations:i.slice(1).map(n=>({id:WG.id,params:{unitId:e,subUnitId:t,cellValue:n,__splitChunk__:!0}}))}}var tgt=`sheet.command.copy-sheet`;function ngt(e,t,n,r,i,a,o){let s=e.get(Om).getConfig(PJ),c={...FJ,...s?.largeSheetOperation},l=vb(n.getConfig());l.name=rgt(t,a,l.name);let u=np();l.id=u;let d=t.getSheetIndex(n),{cellData:f}=l,p=$ht(f)>=c.largeSheetCellCountThreshold,m,h=[];if(p){let{firstChunkCellData:e,remainingMutations:t}=egt(r,u,f,c.batchSize),n={...l,cellData:e};m={index:d+1,sheet:n,unitId:r},h=t}else m={index:d+1,sheet:l,unitId:r};let g=Qht(e,m),_=o.onCommandExecute({id:tgt,params:{unitId:r,subUnitId:i,targetSubUnitId:l.id}});return{redos:[..._.preRedos??[],{id:LJ.id,params:m},..._.redos],undos:[..._.preUndos??[],{id:dq.id,params:g},..._.undos],unitId:r,newSheetId:u,isSplit:p,scheduledMutations:h}}var RJ={type:R.COMMAND,id:tgt,handler:(e,t)=>{let n=e.get(z),r=e.get($b),i=e.get(B),a=e.get(hG),o=e.get(Rb),s=e.get(IJ),c=rG(i,t);if(!c)return!1;let{workbook:l,worksheet:u,unitId:d,subUnitId:f}=c,{redos:p,undos:m,newSheetId:h,isSplit:g,scheduledMutations:_}=ngt(e,l,u,d,f,o,a);if(Bm(p,n).result){if(g){if(r.pushUndoRedo({unitID:d,undoMutations:m,redoMutations:[]}),_.length>0){for(let e of _)n.syncExecuteCommand(e.id,e.params,{syncOnly:!0});n.syncExecuteCommand(Zht.id,{unitId:d,subUnitId:h},{syncOnly:!0}),s.scheduleMutations(d,h,_)}}else r.pushUndoRedo({unitID:d,undoMutations:m,redoMutations:p});return!0}return!1}};function rgt(e,t,n){let r=`${n} ${t.t(`sheets.tabs.sheetCopy`,``)}`,i=2;for(;e.checkSheetName(r);)r=`${n} ${t.t(`sheets.tabs.sheetCopy`,`${i}`)}`,i++;return r}var igt={type:R.COMMAND,id:`sheet.command.delete-range-protection`,async handler(e,t){if(!t)return!1;let n=e.get(z),r=e.get($b),{unitId:i,subUnitId:a,rule:o}=t,s={unitId:i,subUnitId:a,ruleIds:[o.id]};return await n.executeCommand(SK.id,s)&&r.pushUndoRedo({unitID:i,redoMutations:[{id:SK.id,params:s}],undoMutations:[{id:CK.id,params:{unitId:i,subUnitId:a,rules:[o]}}]}),!0}},zJ={type:R.COMMAND,id:`sheet.command.delete-worksheet-protection`,handler(e,t){if(!t)return!1;let n=e.get(z),r=e.get($b),{rule:i,unitId:a,subUnitId:o}=t;n.executeCommand(Yq.id,{unitId:a,subUnitId:o});let s=[{id:Yq.id,params:{unitId:a,subUnitId:o}}],c=[{id:Jq.id,params:{unitId:a,rule:i,subUnitId:o}}];return r.pushUndoRedo({unitID:a,redoMutations:s,undoMutations:c}),!0}},agt={type:R.COMMAND,id:`sheet.command.remove-worksheet-range-theme-style`,handler:(e,t)=>{let n=e.get(z),r=e.get($b),{unitId:i}=t,a=Sft(e,t);return n.syncExecuteCommand(xG.id,t)?(r.pushUndoRedo({unitID:i,undoMutations:[{id:bG.id,params:a}],redoMutations:[{id:xG.id,params:t}]}),!0):!1}},BJ={id:`sheet.command.insert-defined-name`,type:R.COMMAND,handler:(e,t)=>{let n=e.get(z),r=e.get($b);if(!t)return!1;let i={...t};return n.syncExecuteCommand(jR.id,i)?(r.pushUndoRedo({unitID:t.unitId,undoMutations:[{id:MR.id,params:i}],redoMutations:[{id:jR.id,params:i}]}),!0):!1}},VJ={id:`sheet.command.insert-sheet`,type:R.COMMAND,handler:(e,t)=>{let n=e.get(z),r=e.get($b),i=e.get(B),a=e.get(Rb),o=$dt(i,{unitId:t?.unitId});if(!o)return!1;let{unitId:s,workbook:c}=o,l=c.getSheets().length,u=t?.sheet,d=u?.id,f=u?.name,p=Cb(u||{});t?(l=t.index??l,p.id=d||np(),p.name=f?c.uniqueSheetName(f):c.generateNewSheetName(`${a.t(`sheets.tabs.sheet`)}`)):(p.id=np(),p.name=c.generateNewSheetName(`${a.t(`sheets.tabs.sheet`)}`));let m={index:l,sheet:p,unitId:s},h=Qht(e,m);return n.syncExecuteCommand(LJ.id,m)?(r.pushUndoRedo({unitID:s,undoMutations:[{id:dq.id,params:h}],redoMutations:[{id:LJ.id,params:m}]}),!0):!1}},HJ={id:`sheet.command.refill`,type:R.COMMAND,handler:async(e,t)=>e.get(AJ).fillData(t.type)},UJ={id:`sheet.mutation.register-worksheet-range-theme-style`,type:R.MUTATION,handler:(e,t)=>{if(!rG(e.get(B),t))return!1;let n=e.get(yG),{unitId:r,rangeThemeStyleJson:i,themeName:a}=t,o=new vG(a,i);return n.registerRangeThemeStyle(r,o),!0}},WJ={id:`sheet.mutation.unregister-worksheet-range-theme-style`,type:R.MUTATION,handler:(e,t)=>{if(!rG(e.get(B),t))return!1;let n=e.get(yG),{unitId:r,themeName:i}=t;return n.unregisterRangeThemeStyle(r,i),!0}},ogt={id:`sheet.command.register-worksheet-range-theme-style`,type:R.COMMAND,handler:(e,t)=>{if(!t)return!1;let{unitId:n,rangeThemeStyle:r}=t,i=e.get(B),a=e.get(z),o=e.get($b);if(!rG(i,t))return!1;let s={unitId:n,themeName:r.getName(),rangeThemeStyleJson:r.toJson()},c={unitId:n,themeName:r.getName()};return a.syncExecuteCommand(UJ.id,s)&&o.pushUndoRedo({unitID:n,undoMutations:[{id:WJ.id,params:c}],redoMutations:[{id:UJ.id,params:s}]}),!0}},GJ={id:`sheet.command.remove-defined-name`,type:R.COMMAND,handler:(e,t)=>{let n=e.get(z),r=e.get($b),i=e.get(hG);if(!t)return!1;let a={...t},o=i.onCommandExecute({id:GJ.id,params:t}),s=[...o.preRedos??[],{id:MR.id,params:a},...o.redos],c=[...o.preUndos??[],{id:jR.id,params:a},...o.undos];return Bm(s,n).result?(r.pushUndoRedo({unitID:t.unitId,undoMutations:c.filter(Boolean),redoMutations:s.filter(Boolean)}),!0):!1}},KJ={id:`sheet.command.remove-sheet`,type:R.COMMAND,handler:(e,t)=>{let n=e.get(z),r=e.get($b),i=e.get(B),a=e.get(hG),o=e.get(Om),s=rG(i,t);if(!s)return!1;let{unitId:c,subUnitId:l,workbook:u,worksheet:d}=s;if(u.getSheets().length<=1)return!1;let f=o.getConfig(PJ),p={...FJ,...f?.largeSheetOperation},m=Vpt(d.getCellMatrix())>=p.largeSheetCellCountThreshold,h={subUnitId:l,unitId:c,subUnitName:d.getName()},g=m?null:cmt(e,h),_=a.onCommandExecute({id:KJ.id,params:{unitId:c,subUnitId:l}}),v=[..._.preRedos??[],{id:dq.id,params:h},..._.redos],y=m?[]:[..._.preUndos??[],{id:LJ.id,params:g},..._.undos];return Bm(v,n).result?(m?r.clearUndoRedo(c):r.pushUndoRedo({unitID:c,undoMutations:y,redoMutations:v}),!0):!1}},qJ=class{constructor(){Z(this,`_borderInfo`,{type:lp.ALL,color:`#000000`,style:cp.THIN,activeBorderType:!1}),Z(this,`_borderInfo$`,new oo(this._borderInfo)),Z(this,`borderInfo$`,this._borderInfo$.asObservable())}dispose(){this._borderInfo$.complete()}setType(e){this._borderInfo.type=e,this.setActiveBorderType(!0),this._refresh()}setColor(e){this._borderInfo.color=e,this._refresh()}setStyle(e){this._borderInfo.style=e,this._refresh()}setActiveBorderType(e){this._borderInfo.activeBorderType=e}getBorderInfo(){return this._borderInfo}_refresh(){this._borderInfo$.next(this._borderInfo)}};function JJ(e,t){let{startRow:n,startColumn:r,endRow:i,endColumn:a}=e;for(let e=n;e<=i;e++)for(let n=r;n<=a;n++)t(e,n)}var YJ=(e,t,n,r)=>{let{mr:i,worksheet:a}=e;t.startRow<0||t.startColumn<0||JJ(t,(e,t)=>{let o=a.getMergedCell(e,t),s=n;if(o&&(n.bc_tr||n.ml_tr||n.bl_tr||n.tl_mr||n.tl_bc||n.tl_br)){if(r){let e=I.deepClone(i.getValue(o.startRow,o.startColumn)?.s);s=e?.bd?Object.assign(e.bd,n):n}i.setValue(o.startRow,o.startColumn,{s:{bd:s}})}else{if(r){let r=I.deepClone(i.getValue(e,t)?.s);s=r?.bd?Object.assign(r.bd,n):n}i.setValue(e,t,{s:{bd:s}})}})},sgt=e=>({topRangeOut:{startRow:e.startRow-1,startColumn:e.startColumn,endRow:e.startRow-1,endColumn:e.endColumn},leftRangeOut:{startRow:e.startRow,startColumn:e.startColumn-1,endRow:e.endRow,endColumn:e.startColumn-1},bottomRangeOut:{startRow:e.endRow+1,startColumn:e.startColumn,endRow:e.endRow+1,endColumn:e.endColumn},rightRangeOut:{startRow:e.startRow,startColumn:e.endColumn+1,endRow:e.endRow,endColumn:e.endColumn+1},topRange:{startRow:e.startRow,startColumn:e.startColumn,endRow:e.startRow,endColumn:e.endColumn},leftRange:{startRow:e.startRow,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.startColumn},bottomRange:{startRow:e.endRow,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn},rightRange:{startRow:e.startRow,startColumn:e.endColumn,endRow:e.endRow,endColumn:e.endColumn}});function cgt(e,t,n){let{style:r,color:i,type:a}=e.getBorderInfo(),o=a===lp.TOP||a===lp.ALL||a===lp.OUTSIDE,s=a===lp.LEFT||a===lp.ALL||a===lp.OUTSIDE,c=a===lp.BOTTOM||a===lp.ALL||a===lp.OUTSIDE,l=a===lp.RIGHT||a===lp.ALL||a===lp.OUTSIDE,u=a===lp.VERTICAL||a===lp.ALL||a===lp.INSIDE,d=a===lp.HORIZONTAL||a===lp.ALL||a===lp.INSIDE,f=a.indexOf(`tlbr`)>-1,p=a.indexOf(`tlbc`)>-1,m=a.indexOf(`tlmr`)>-1,h=a.indexOf(`bltr`)>-1,g=a.indexOf(`mltr`)>-1,_=a.indexOf(`bctr`)>-1,v=n[0],{topRangeOut:y,leftRangeOut:b,bottomRangeOut:x,rightRangeOut:S,topRange:C,leftRange:w,bottomRange:T,rightRange:E}=sgt(v),D=new Mh,{worksheet:O,unitId:k,subUnitId:A}=t;return{worksheet:O,unitId:k,subUnitId:A,style:r,color:i,type:a,top:o,left:s,right:l,bottom:c,vertical:u,horizontal:d,tl_br:f,tl_bc:p,tl_mr:m,bl_tr:h,ml_tr:g,bc_tr:_,topRangeOut:y,leftRangeOut:b,bottomRangeOut:x,rightRangeOut:S,topRange:C,leftRange:w,bottomRange:T,rightRange:E,range:v,mr:D,borderStyle:{s:r,cl:{rgb:i}}}}var lgt=e=>{let{range:t,mr:n,borderStyle:r,vertical:i,horizontal:a,worksheet:o}=e;i&&JJ(t,(e,i)=>{let a=o.getMergedCell(e,i);if(a){let o=n.getValue(a.startRow,a.startColumn)?.s;a.startColumn!==t.startColumn&&n.setValue(e,i,{s:{bd:o?.bd?Object.assign(o.bd,{l:I.deepClone(r)}):{l:I.deepClone(r)}}})}else{if(i!==t.endColumn){let t=n.getValue(e,i)?.s;n.setValue(e,i,{s:{bd:t?.bd?Object.assign(t.bd,{r:I.deepClone(r)}):{r:I.deepClone(r)}}})}if(i!==t.startColumn){let t=n.getValue(e,i)?.s;n.setValue(e,i,{s:{bd:t?.bd?Object.assign(t.bd,{l:I.deepClone(r)}):{l:I.deepClone(r)}}})}}}),a&&JJ(t,(e,i)=>{let a=o.getMergedCell(e,i);if(a){let o=n.getValue(a.startRow,a.startColumn)?.s;a.startRow!==t.startRow&&n.setValue(e,i,{s:{bd:o?.bd?Object.assign(o.bd,{t:I.deepClone(r)}):{t:I.deepClone(r)}}})}else{if(e!==t.endRow){let t=n.getValue(e,i)?.s;n.setValue(e,i,{s:{bd:t?.bd?Object.assign(t.bd,{b:I.deepClone(r)}):{b:I.deepClone(r)}}})}if(e!==t.startRow){let t=n.getValue(e,i)?.s;n.setValue(e,i,{s:{bd:t?.bd?Object.assign(t.bd,{t:I.deepClone(r)}):{t:I.deepClone(r)}}})}}})};function ugt(e){let{borderStyle:t,tl_br:n,tl_bc:r,tl_mr:i,bl_tr:a,ml_tr:o,bc_tr:s}=e,c=(t,n,r)=>{YJ(e,t,n,r)};n&&c(e.range,{tl_br:I.deepClone(t)},!0),r&&c(e.range,{tl_bc:I.deepClone(t)},!0),i&&c(e.range,{tl_mr:I.deepClone(t)},!0),a&&c(e.range,{bl_tr:I.deepClone(t)},!0),o&&c(e.range,{ml_tr:I.deepClone(t)},!0),s&&c(e.range,{bc_tr:I.deepClone(t)},!0)}var dgt=e=>{let{top:t,left:n,right:r,bottom:i,borderStyle:a,bottomRange:o,topRange:s,leftRange:c,rightRange:l,bottomRangeOut:u,topRangeOut:d,leftRangeOut:f,rightRangeOut:p}=e,m=(t,n,r)=>{YJ(e,t,n,r)};t&&(m(d,{b:null}),m(s,{t:I.deepClone(a)},!0)),i&&(m(u,{t:null}),m(o,{b:I.deepClone(a)},!0)),n&&(m(f,{r:null}),m(c,{l:I.deepClone(a)},!0)),r&&(m(p,{l:null}),m(l,{r:I.deepClone(a)},!0))},fgt=e=>{let{range:t,worksheet:n,mr:r,top:i,bottom:a,left:o,right:s,vertical:c,horizontal:l,tl_br:u,tl_bc:d,tl_mr:f,bl_tr:p,ml_tr:m,bc_tr:h,topRange:g,bottomRange:_,leftRange:v,rightRange:y,topRangeOut:b,bottomRangeOut:x,leftRangeOut:S,rightRangeOut:C}=e,w=(t,n,r)=>{YJ(e,t,n,r)};!i&&!a&&!o&&!s&&!c&&!l&&!u&&!d&&!f&&!p&&!m&&!h&&(JJ(t,(e,i)=>{let a=n.getMergedCell(e,i);if(a){if(a.endColumn!==t.endColumn){let t=r.getValue(a.startRow,a.startColumn)?.s;r.setValue(e,i,{s:{bd:t?.bd?Object.assign(t.bd,{r:null}):{r:null}}})}if(a.startColumn!==t.startColumn){let t=r.getValue(a.startRow,a.startColumn)?.s;r.setValue(e,i,{s:{bd:t?.bd?Object.assign(t.bd,{l:null}):{l:null}}})}if(a.endRow!==t.endRow){let t=r.getValue(a.startRow,a.startColumn)?.s;r.setValue(e,i,{s:{bd:t?.bd?Object.assign(t.bd,{b:null}):{b:null}}})}if(a.startRow!==t.startRow){let t=r.getValue(a.startRow,a.startColumn)?.s;r.setValue(e,i,{s:{bd:t?.bd?Object.assign(t.bd,{t:null}):{t:null}}})}}else{if(i!==t.endColumn){let t=r.getValue(e,i)?.s;r.setValue(e,i,{s:{bd:t?.bd?Object.assign(t.bd,{r:null}):{r:null}}})}if(i!==t.startColumn){let t=r.getValue(e,i)?.s;r.setValue(e,i,{s:{bd:t?.bd?Object.assign(t.bd,{l:null}):{l:null}}})}if(e!==t.endRow){let t=r.getValue(e,i)?.s;r.setValue(e,i,{s:{bd:t?.bd?Object.assign(t.bd,{b:null}):{b:null}}})}if(e!==t.startRow){let t=r.getValue(e,i)?.s;r.setValue(e,i,{s:{bd:t?.bd?Object.assign(t.bd,{t:null}):{t:null}}})}}}),w(b,{b:null}),w(g,{t:null},!0),w(x,{t:null}),w(_,{b:null},!0),w(S,{r:null}),w(v,{l:null},!0),w(C,{l:null}),w(y,{r:null},!0),w(t,{tl_br:null},!0),w(t,{tl_bc:null},!0),w(t,{tl_mr:null},!0),w(t,{bl_tr:null},!0),w(t,{ml_tr:null},!0),w(t,{bc_tr:null},!0))},XJ={id:`sheet.command.set-border`,type:R.COMMAND,handler:(e,t)=>{let n=e.get(z),r=e.get($b),i=e.get(B),a=e.get(TK),o=e.get(qJ),s=rG(i,t);if(!s)return!1;let c=t?.ranges||a.getCurrentSelections()?.map(e=>e.range);if(!c?.length)return!1;let{activeBorderType:l}=o.getBorderInfo();if(!l)return!1;let u=cgt(o,s,c);lgt(u),dgt(u),ugt(u),fgt(u);let{unitId:d,subUnitId:f,mr:p}=u,m={unitId:d,subUnitId:f,cellValue:p.getData()},h=UG(e,m);return n.syncExecuteCommand(WG.id,m)?(r.pushUndoRedo({unitID:d,undoMutations:[{id:WG.id,params:h}],redoMutations:[{id:WG.id,params:m}]}),!0):!1}},pgt={id:`sheet.command.set-border-position`,type:R.COMMAND,handler:(e,t)=>{if(!t.value)return!1;let n=e.get(z);return e.get(qJ).setType(t.value),n.syncExecuteCommand(XJ.id)}},mgt={id:`sheet.command.set-border-style`,type:R.COMMAND,handler:(e,t)=>{let n=e.get(z);return e.get(qJ).setStyle(t.value),n.syncExecuteCommand(XJ.id)}},hgt={id:`sheet.command.set-border-color`,type:R.COMMAND,handler:(e,t)=>{let n=e.get(z);return e.get(qJ).setColor(t.value),n.syncExecuteCommand(XJ.id)}},ZJ={id:`sheet.command.set-border-basic`,type:R.COMMAND,handler:(e,t)=>{let{unitId:n,subUnitId:r,value:i,ranges:a}=t,{type:o,color:s,style:c}=i,l=e.get(z),u=e.get(qJ);return u.setType(o),s&&u.setColor(s),u.setStyle(c),l.syncExecuteCommand(XJ.id,{unitId:n,subUnitId:r,ranges:a})}},QJ={type:R.COMMAND,id:`sheet.command.set-col-data`,handler:(e,t)=>{let n=e.get(z),r=e.get($b),i=rG(e.get(B),t);if(!i)return!1;let{columnData:a}=t,{unitId:o,subUnitId:s,worksheet:c}=i,l={subUnitId:s,unitId:o,columnData:a},u=Aft(l,c);return n.syncExecuteCommand(PG.id,l)?(r.pushUndoRedo({unitID:o,undoMutations:[{id:PG.id,params:u}],redoMutations:[{id:PG.id,params:l}]}),!0):!1}},$J={type:R.COMMAND,id:`sheet.command.set-col-visible-on-cols`,handler:(e,t)=>{let{unitId:n,subUnitId:r,ranges:i}=t,a=e.get(hG),o=e.get(z),s=rG(e.get(B),{unitId:n,subUnitId:r});if(!s)return!1;let{worksheet:c}=s,l={unitId:n,subUnitId:r,ranges:i},u={unitId:n,subUnitId:r,reveal:!0,selections:i.map(e=>({range:e,primary:FK(e,c),style:null}))},d=Mft(e,l),f={unitId:n,subUnitId:r,selections:_gt(i).map(e=>({range:e,primary:FK(e,c),style:null}))},p=Bm([{id:IG.id,params:l},{id:VK.id,params:u}],o),m=a.onCommandExecute({id:$J.id,params:t}),h=Bm([...m.redos],o);if(p.result&&h.result){let r=a.afterCommandExecute({id:$J.id,params:t});return Bm(r.redos,o),e.get($b).pushUndoRedo({unitID:n,undoMutations:[{id:FG.id,params:d},{id:VK.id,params:f},...m.undos??[],...r.undos],redoMutations:[...m.preRedos??[],{id:IG.id,params:l},{id:VK.id,params:u},...m.redos,...r.redos]}),!0}return!0}},eY={type:R.COMMAND,id:`sheet.command.set-selected-cols-visible`,handler:e=>{let t=e.get(TK),n=e.get(z),r=t.getCurrentSelections()?.map(e=>e.range).filter(e=>e.rangeType===fh.COLUMN);if(!r?.length)return!1;let i=rG(e.get(B));if(!i)return!1;let{worksheet:a,unitId:o,subUnitId:s}=i,c=r.map(e=>a.getHiddenCols(e.startColumn,e.endColumn)).flat();return n.executeCommand($J.id,{unitId:o,subUnitId:s,ranges:c})}},tY={type:R.COMMAND,id:`sheet.command.set-col-hidden`,handler:(e,t)=>{var n;let r=e.get(TK),i=e.get(hG),a=e.get(B),o=e.get(z),s=t!=null&&(n=t.ranges)!=null&&n.length?t.ranges:r.getCurrentSelections()?.map(e=>e.range).filter(e=>e.rangeType===fh.COLUMN);if(!s?.length)return!1;let c=rG(a,t);if(!c)return!1;let{worksheet:l,unitId:u,subUnitId:d}=c;s=ggt(c.worksheet,s);let f={unitId:u,subUnitId:d,ranges:s},p={unitId:u,subUnitId:d,selections:_gt(s).map(e=>({range:e,primary:FK(e,l),style:null}))},m=jft(e,f),h={unitId:u,subUnitId:d,reveal:!0,selections:s.map(e=>({range:e,primary:FK(e,l),style:null}))},g=Bm([{id:FG.id,params:f},{id:VK.id,params:p}],o),_=i.onCommandExecute({id:tY.id,params:f}),v=Bm([..._.redos],o);if(g.result&&v.result){let t=i.afterCommandExecute({id:tY.id,params:f});return Bm(t.redos,o),e.get($b).pushUndoRedo({unitID:u,undoMutations:[{id:IG.id,params:m},{id:VK.id,params:h},..._.undos??[],...t.undos],redoMutations:[..._.preRedos??[],{id:FG.id,params:f},{id:VK.id,params:p},..._.redos,...t.redos]}),!0}return!1}};function ggt(e,t){let n=e.getRowCount()-1,r=e.getHiddenCols(),i=[];return t.forEach(e=>{let t=r.filter(t=>t.startColumn>=e.startColumn&&t.endColumn<=e.endColumn);if(t.length){let r=e.startColumn;t.forEach(e=>{e.startColumn>r&&(i.push({startColumn:r,endColumn:e.startColumn-1,startRow:0,endRow:n}),r=e.endColumn+1)}),r<=e.endColumn&&i.push({startColumn:r,endColumn:e.endColumn,startRow:0,endRow:n})}else i.push(e)}),i}function _gt(e){return vgt(e).map(e=>{let t=e.startColumn===0?e.endColumn+1:e.startColumn-1;return{...e,startColumn:t,endColumn:t}})}function vgt(e){let t=[],n;return e.sort((e,t)=>e.startColumn-t.startColumn).forEach(e=>{if(!n){n=e;return}n.endColumn===e.startColumn-1?n.endColumn=e.endColumn:(t.push(n),n=e)}),t.push(n),t}var nY={id:`sheet.command.set-defined-name`,type:R.COMMAND,handler:(e,t)=>{let n=e.get(z),r=e.get($b),i=e.get(hG);if(!t)return!1;let a={...t},o=P5e(e,t),s=i.onCommandExecute({id:nY.id,params:t}),c=[...s.preRedos??[],...o?[{id:MR.id,params:o}]:[],{id:jR.id,params:a},...s.redos],l=[...s.preUndos??[],{id:MR.id,params:a},...o?[{id:jR.id,params:o}]:[],...s.undos];return Bm(c,n).result?(r.pushUndoRedo({unitID:t.unitId,undoMutations:l.filter(Boolean),redoMutations:c.filter(Boolean)}),!0):!1}},rY=(e,t)=>{let n=e.get(B).getUniverSheetInstance(t.unitId);if(n==null)throw Error(`universheet is null error!`);let r=n.getSheetBySheetId(t.subUnitId);if(r==null)throw Error(`worksheet is null error!`);let i=r.getConfig().freeze;return{unitId:t.unitId,subUnitId:t.subUnitId,...i}},iY={id:`sheet.mutation.set-frozen`,type:R.MUTATION,handler:(e,t)=>{let n=e.get(B).getUniverSheetInstance(t.unitId);if(n==null)throw Error(`universheet is null error!`);let r=n.getSheetBySheetId(t.subUnitId);if(!r)return!1;let i=r.getConfig(),{startRow:a,startColumn:o,ySplit:s,xSplit:c}=t;return i.freeze={startRow:a,startColumn:o,ySplit:s,xSplit:c},!0}},aY={type:R.COMMAND,id:`sheet.command.set-frozen`,handler:(e,t)=>{let n=e.get(z),r=e.get($b),i=rG(e.get(B),{unitId:t.unitId,subUnitId:t.subUnitId});if(!i)return!1;let{unitId:a,subUnitId:o,worksheet:s}=i,{startColumn:c,startRow:l,xSplit:u,ySplit:d}=t;if(l>=s.getRowCount()||c>=s.getColumnCount()||u>=s.getColumnCount()||d>=s.getRowCount())return!1;let f={unitId:a,subUnitId:o,...t},p=rY(e,f);return n.syncExecuteCommand(iY.id,f)?(r.pushUndoRedo({unitID:a,undoMutations:[{id:iY.id,params:p}],redoMutations:[{id:iY.id,params:f}]}),!0):!1}},oY={type:R.COMMAND,id:`sheet.command.cancel-frozen`,handler:(e,t)=>{let n=e.get(z),r=e.get(B),i=e.get($b),a=rG(r,{unitId:t?.unitId,subUnitId:t?.subUnitId});if(!a)return!1;let{unitId:o,subUnitId:s}=a,c={unitId:o,subUnitId:s,startRow:-1,startColumn:-1,xSplit:0,ySplit:0},l=rY(e,c);return n.syncExecuteCommand(iY.id,c)&&i.pushUndoRedo({unitID:o,undoMutations:[{id:iY.id,params:l}],redoMutations:[{id:iY.id,params:c}]}),!0}},sY={type:R.COMMAND,id:`sheet.command.set-gridlines-color`,handler:(e,t)=>{let n=e.get(z),r=e.get($b),i=rG(e.get(B),t);if(!i)return!1;let{worksheet:a}=i,o=a.getConfig().gridlinesColor;if(o===t?.color)return!1;let{unitId:s,subUnitId:c}=i,l={color:t?.color,unitId:s,subUnitId:c},u={color:o,unitId:s,subUnitId:c};return n.syncExecuteCommand(LG.id,l)?(r.pushUndoRedo({unitID:s,undoMutations:[{id:LG.id,params:u}],redoMutations:[{id:LG.id,params:l}]}),!0):!1}},cY={id:`sheet.mutation.set-range-protection`,type:R.MUTATION,handler:(e,t)=>{let{unitId:n,subUnitId:r,rule:i,ruleId:a}=t;return e.get(xK).setRule(n,r,a,i),!0}},lY={id:`sheet.mutation.set-worksheet-protection`,type:R.MUTATION,handler:(e,t)=>{let{unitId:n,subUnitId:r,rule:i}=t;return e.get(qq).setRule(n,r,i),!0}},ygt={type:R.COMMAND,id:`sheet.command.set-protection`,async handler(e,t){if(!t)return!1;let n=e.get(z),r=e.get($b),i=e.get(xK),{rule:a,oldRule:o}=t,{unitId:s,subUnitId:c}=a,l=[],u=[];return o?.unitType===a.unitType?a.unitType===na.Worksheet?(l.push({id:lY.id,params:{unitId:s,subUnitId:c,rule:a}}),u.push({id:lY.id,params:{unitId:s,subUnitId:c,rule:o}})):(l.push({id:cY.id,params:{unitId:s,subUnitId:c,rule:a,ruleId:a.id}}),u.push({id:cY.id,params:{unitId:s,subUnitId:c,ruleId:o.id,rule:o}})):(o&&(o.unitType===na.Worksheet?(l.push({id:Yq.id,params:{unitId:s,subUnitId:c}}),u.push({id:Jq.id,params:{unitId:s,rule:o,subUnitId:o.subUnitId}})):o.unitType===na.SelectRange&&(l.push({id:SK.id,params:{unitId:s,subUnitId:c,ruleIds:[o.id]}}),u.push({id:CK.id,params:{unitId:s,subUnitId:c,rules:[o]}}))),a.unitType===na.Worksheet?(l.push({id:Jq.id,params:{unitId:s,rule:a,subUnitId:a.subUnitId}}),u.unshift({id:Yq.id,params:{unitId:s,subUnitId:c}})):a.unitType===na.SelectRange&&(a.id=i.createRuleId(s,c),l.push({id:CK.id,params:{unitId:s,subUnitId:c,rules:[a]}}),u.unshift({id:SK.id,params:{unitId:s,subUnitId:c,ruleIds:[a.id]}}))),Bm(l,n).result&&r.pushUndoRedo({unitID:s,undoMutations:u,redoMutations:l}),!0}},uY={id:`sheet.command.set-range-custom-metadata`,type:R.COMMAND,handler:(e,t)=>{let n=rG(e.get(B),t);if(!n)return!1;let r=e.get(z),{unitId:i,subUnitId:a}=n,{range:o,customMetadata:s}=t,{startRow:c,startColumn:l,endRow:u,endColumn:d}=o,f=I.isArray(s),p=new Mh;for(let e=c;e<=u;e++)for(let t=l;t<=d;t++){let n=f?s[e-c][t-l]:s;p.setValue(e,t,n)}return r.syncExecuteCommand(WG.id,{unitId:i,subUnitId:a,cellValue:p.getMatrix()})}},dY={type:R.COMMAND,id:`sheet.command.set-row-data`,handler:(e,t)=>{let n=e.get(z),r=e.get($b),i=rG(e.get(B),t);if(!i)return!1;let{rowData:a}=t,{unitId:o,subUnitId:s,worksheet:c}=i,l={subUnitId:s,unitId:o,rowData:a},u=tpt(l,c);return n.syncExecuteCommand(GG.id,l)?(r.pushUndoRedo({unitID:o,undoMutations:[{id:GG.id,params:u}],redoMutations:[{id:GG.id,params:l}]}),!0):!1}},fY={type:R.COMMAND,id:`sheet.command.set-specific-rows-visible`,handler:(e,t)=>{let{unitId:n,subUnitId:r,ranges:i}=t,a=e.get(z),o=e.get($b),s=e.get(hG),c=rG(e.get(B),{unitId:n,subUnitId:r});if(!c)return!1;let{worksheet:l}=c,u={unitId:n,subUnitId:r,ranges:i},d={unitId:n,subUnitId:r,reveal:!0,selections:i.map(e=>({range:e,primary:FK(e,l),style:null}))},f=npt(e,u),p={unitId:n,subUnitId:r,selections:xgt(i).map(e=>({range:e,primary:FK(e,l),style:null}))},m=Bm([{id:KG.id,params:u},{id:VK.id,params:d}],a),h=s.onCommandExecute({id:fY.id,params:t}),g=Bm([...h.redos],a);if(m.result&&g.result){let e=s.afterCommandExecute({id:fY.id,params:t});return Bm(e.redos,a),o.pushUndoRedo({unitID:n,undoMutations:[...h.preUndos??[],{id:qG.id,params:f},{id:VK.id,params:p},...h.undos??[],...e.undos],redoMutations:[...h.preRedos??[],{id:KG.id,params:u},{id:VK.id,params:d},...h.redos,...e.redos]}),!0}return!0}},pY={type:R.COMMAND,id:`sheet.command.set-selected-rows-visible`,handler:async e=>{let t=e.get(TK),n=e.get(B),r=e.get(z),i=t.getCurrentSelections()?.map(e=>e.range).filter(e=>e.rangeType===fh.ROW);if(!i?.length)return!1;let a=rG(n);if(!a)return!1;let{worksheet:o,unitId:s,subUnitId:c}=a,l=i.map(e=>o.getHiddenRows(e.startRow,e.endRow)).flat();return r.executeCommand(fY.id,{unitId:s,subUnitId:c,ranges:l})}},mY={type:R.COMMAND,id:`sheet.command.set-rows-hidden`,handler:(e,t)=>{var n;let r=e.get(TK),i=e.get(z),a=e.get($b),o=e.get(B),s=e.get(hG),c=t!=null&&(n=t.ranges)!=null&&n.length?t.ranges:r.getCurrentSelections()?.map(e=>e.range).filter(e=>e.rangeType===fh.ROW);if(!c?.length)return!1;let l=rG(o,t);if(!l)return!1;c=bgt(l.worksheet,c);let{unitId:u,subUnitId:d,worksheet:f}=l,p={unitId:u,subUnitId:d,ranges:c},m={unitId:u,subUnitId:d,selections:xgt(c).map(e=>({range:e,primary:FK(e,f),style:null}))},h=rpt(e,p),g={unitId:u,subUnitId:d,reveal:!0,selections:c.map(e=>({range:e,primary:FK(e,f),style:null}))},_=s.onCommandExecute({id:mY.id,params:p});if(Bm([..._.preRedos??[],{id:qG.id,params:p},{id:VK.id,params:m},..._.redos],i).result){let e=s.afterCommandExecute({id:mY.id,params:p});return Bm(e.redos,i),a.pushUndoRedo({unitID:u,undoMutations:[..._.preUndos??[],{id:KG.id,params:h},{id:VK.id,params:g},..._.undos??[],...e.undos],redoMutations:[..._.preRedos??[],{id:qG.id,params:p},{id:VK.id,params:m},..._.redos,...e.redos]}),!0}return!0}};function bgt(e,t){let n=e.getMaxColumns()-1,r=e.getHiddenRows(),i=[];return t.forEach(e=>{let t=r.filter(t=>t.startRow>=e.startRow&&t.endRow<=e.endRow);if(t.length){let r=e.startRow;t.forEach(e=>{e.startRow>r&&(i.push({startRow:r,endRow:e.startRow-1,startColumn:0,endColumn:n}),r=e.endRow+1)}),r<=e.endRow&&i.push({startRow:r,endRow:e.endRow,startColumn:0,endColumn:n})}else i.push(e)}),i}function xgt(e){return Sgt(e).map(e=>{let t=e.startRow===0?e.endRow+1:e.startRow-1;return{...e,startRow:t,endRow:t}})}function Sgt(e){let t=[],n;return e.sort((e,t)=>e.startRow-t.startRow).forEach(e=>{if(!n){n=e;return}e.startRow===n.endRow+1?n.endRow=e.endRow:(t.push(n),n=e)}),t.push(n),t}var Cgt=(e,t)=>{let n=e.get(B).getUniverSheetInstance(t.unitId).getSheetBySheetId(t.subUnitId).getConfig().tabColor;return{...I.deepClone(t),color:n}},hY={id:`sheet.mutation.set-tab-color`,type:R.MUTATION,handler:(e,t)=>{let n=e.get(B).getUniverSheetInstance(t.unitId);if(!n)return!1;let r=n.getSheetBySheetId(t.subUnitId);return r?(r.getConfig().tabColor=t.color,!0):!1}},gY={type:R.COMMAND,id:`sheet.command.set-tab-color`,handler:(e,t)=>{let n=e.get(z),r=e.get($b),i=rG(e.get(B),t);if(!i)return!1;let{unitId:a,subUnitId:o}=i,s={color:t.value,unitId:a,subUnitId:o},c=Cgt(e,s);return n.syncExecuteCommand(hY.id,s)?(r.pushUndoRedo({unitID:a,undoMutations:[{id:hY.id,params:c}],redoMutations:[{id:hY.id,params:s}]}),!0):!1}},wgt={id:`sheet.mutation.set-workbook-name`,type:R.MUTATION,handler:(e,t)=>{let n=e.get(B).getUnit(t.unitId,N.UNIVER_SHEET);return n?(n.setName(t.name),!0):!1}},_Y={type:R.COMMAND,id:`sheet.command.set-workbook-name`,handler:(e,t)=>{let n=e.get(z),r=e.get(hG);if(!$dt(e.get(B),t))return!1;let i=r.onCommandExecute({id:_Y.id,params:t}),a={name:t.name,unitId:t.unitId};return Bm([...i.preRedos??[],{id:wgt.id,params:a},...i.redos],n).result}},Tgt=4,vY={type:R.COMMAND,id:`sheet.command.set-worksheet-activate`,handler:(e,t,n)=>{let r=e.get(z),i=rG(e.get(B),t);if(!i)return!1;let{unitId:a,subUnitId:o}=i;return new Promise(e=>{setTimeout(()=>{e(r.syncExecuteCommand(aK.id,{unitId:a,subUnitId:o},n))},Tgt)})}},yY={type:R.COMMAND,id:`sheet.command.delta-column-width`,handler:async(e,t)=>{let n=e.get(TK).getCurrentSelections();if(!n?.length)return!1;let r=e.get(z),i=e.get($b),a=rG(e.get(B));if(!a)return!1;let{worksheet:o,unitId:s,subUnitId:c}=a,{anchorCol:l,deltaX:u}=t,d=o.getColumnWidth(l)+u,f=n.length===1&&n[0].range.rangeType===fh.ALL,p=n.filter(e=>e.range.rangeType===fh.COLUMN),m=f?fh.ALL:p.some(({range:e})=>{let{startColumn:t,endColumn:n}=e;return t<=l&&l<=n})?fh.COLUMN:fh.NORMAL,h;if(m===fh.ALL){let e=o.getRowCount();h={subUnitId:c,unitId:s,colWidth:d,ranges:Array(o.getColumnCount()).fill(void 0).map((t,n)=>({startRow:0,endRow:e-1,startColumn:n,endColumn:n}))}}else h=m===fh.COLUMN?{subUnitId:c,unitId:s,ranges:p.map(e=>n_.clone(e.range)),colWidth:d}:{subUnitId:c,unitId:s,colWidth:d,ranges:[{startRow:0,endRow:o.getMaxRows()-1,startColumn:l,endColumn:l}]};let g=e.get(OK).getSkeleton(s,c),{suitableRanges:_,remainingRanges:v}=AK(h.ranges,g);kK(_,o);let y=e.get(hG),{undos:b,redos:x}=y.onCommandExecute({id:yY.id,params:h}),S=JG(h,o),C=r.syncExecuteCommand(YG.id,h),{undos:w,redos:T}=y.generateMutationsOfAutoHeight({unitId:s,subUnitId:c,ranges:_,autoHeightRanges:_,lazyAutoHeightRanges:v}),{undos:E,redos:D}=e.get(hG).afterCommandExecute({id:yY.id,params:h}),O=Bm([...x,...D,...T],r);return C&&O.result&&i.pushUndoRedo({unitID:s,undoMutations:[{id:YG.id,params:S},...b,...E,...w],redoMutations:[{id:YG.id,params:h},...x,...D,...T]}),!0}},bY={type:R.COMMAND,id:`sheet.command.set-worksheet-col-width`,handler:(e,t)=>{var n;let r=e.get(TK),i=e.get(z),a=e.get($b),o=e.get(hG),s=t!=null&&(n=t.ranges)!=null&&n.length?t.ranges:r.getCurrentSelections()?.map(e=>e.range);if(!s?.length)return!1;let c=rG(e.get(B),t);if(!c)return!1;let{subUnitId:l,unitId:u,worksheet:d}=c,f=e.get(OK).getSkeleton(u,l),p={subUnitId:l,unitId:u,ranges:s,colWidth:t.value},{suitableRanges:m,remainingRanges:h}=AK(p.ranges,f);kK(m,d);let g=JG(p,d),_=i.syncExecuteCommand(YG.id,p),{undos:v,redos:y}=o.generateMutationsOfAutoHeight({unitId:u,subUnitId:l,ranges:m,autoHeightRanges:m,lazyAutoHeightRanges:h}),b=o.onCommandExecute({id:bY.id,params:p}),x=Bm([...b.redos,...y],i);if(_&&x.result){let e=o.afterCommandExecute({id:bY.id,params:p});return Bm(e.redos,i),a.pushUndoRedo({unitID:u,undoMutations:[...b.preUndos??[],{id:YG.id,params:g},...b.undos,...e.undos,...v],redoMutations:[...b.preRedos??[],{id:YG.id,params:p},...b.redos,...e.redos,...y]}),!0}return!1}},Egt={type:R.COMMAND,id:`sheet.command.set-col-is-auto-width`,handler:async(e,t)=>{let n=e.get(z),r=e.get($b),i=e.get(TK),a=rG(e.get(B),t);if(!a)return!1;let{unitId:o,subUnitId:s}=a,c=[];if(t?.ranges)c=[...t.ranges];else{let e=i.getCurrentSelections();for(let t=0;t<e.length;t++)c.push(e[t].range)}if(!c?.length)return!1;let l={unitId:o,subUnitId:s,ranges:c},{undos:u,redos:d}=e.get(hG).onCommandExecute({id:Egt.id,params:l});return Bm([...d],n).result?(r.pushUndoRedo({unitID:o,undoMutations:[...u],redoMutations:[...d]}),!0):!1}},Dgt={type:R.COMMAND,id:`sheet.command.set-worksheet-column-count`,handler:(e,t)=>{let{unitId:n,subUnitId:r,columnCount:i}=t,a=e.get(z),o=e.get($b);if(!rG(e.get(B),t))return!1;let s={unitId:n,subUnitId:r,columnCount:i},c=ipt(e,s);return a.syncExecuteCommand(XG.id,s)?(o.pushUndoRedo({unitID:n,undoMutations:[{id:XG.id,params:c}],redoMutations:[{id:XG.id,params:s}]}),!0):!1}},Ogt={type:R.COMMAND,id:`sheet.command.set-worksheet-default-style`,handler:(e,t)=>{let n=e.get(z),r=e.get($b),{unitId:i}=t,a=apt(e,t);return n.syncExecuteCommand(ZG.id,t)?(r.pushUndoRedo({unitID:i,undoMutations:[{id:ZG.id,params:a}],redoMutations:[{id:ZG.id,params:t}]}),!0):!1}},kgt=(e,t)=>{let n=iG(e.get(B),t);if(!n)throw Error(`[SetWorksheetHideMutationFactory]: worksheet is null error!`);let{worksheet:r}=n;return{hidden:r.isSheetHidden(),unitId:t.unitId,subUnitId:r.getSheetId()}},xY={id:`sheet.mutation.set-worksheet-hidden`,type:R.MUTATION,handler:(e,t)=>{let n=e.get(B).getUniverSheetInstance(t.unitId);if(n==null)return!1;let r=n.getSheetBySheetId(t.subUnitId);return r?(r.getConfig().hidden=t.hidden,!0):!1}},SY={type:R.COMMAND,id:`sheet.command.set-worksheet-hidden`,handler:(e,t)=>{let n=e.get(z),r=e.get($b),i=e.get(Wy),a=e.get(Rb),o=rG(e.get(B),t);if(!o)return!1;let{workbook:s,worksheet:c,unitId:l,subUnitId:u}=o;if(c.getConfig().hidden===jp.TRUE)return!1;let d={unitId:l,subUnitId:u,hidden:jp.TRUE},f=kgt(e,d);return s.getSheets().filter(e=>e.getConfig().hidden===jp.FALSE).length===1?(i.emit(a.t(`sheets.info.hideSheet`)),!1):n.syncExecuteCommand(xY.id,d)?(r.pushUndoRedo({unitID:l,undoMutations:[{id:xY.id,params:f}],redoMutations:[{id:xY.id,params:d}]}),!0):!1}},Agt=(e,t)=>{let n=iG(e.get(B),t);if(!n)throw Error(`[SetWorksheetNameMutationFactory]: worksheet is null error!`);let{worksheet:r}=n;return{unitId:t.unitId,name:r.getName(),subUnitId:r.getSheetId()}},CY={id:`sheet.mutation.set-worksheet-name`,type:R.MUTATION,handler:(e,t)=>{let n=e.get(B).getUniverSheetInstance(t.unitId);if(n==null)return!1;let r=n.getSheetBySheetId(t.subUnitId);return r?(r.getConfig().name=t.name,!0):!1}},wY={type:R.COMMAND,id:`sheet.command.set-worksheet-name`,handler:(e,t)=>{let n=e.get(z),r=e.get($b),i=e.get(hG),a=rG(e.get(B),t);if(!a)return!1;let{unitId:o,subUnitId:s}=a,c={subUnitId:s,name:t.name,unitId:o},l=Agt(e,c),u=i.onCommandExecute({id:wY.id,params:t}),d=[...u.preRedos??[],{id:CY.id,params:c},...u.redos],f=[...u.preUndos??[],{id:CY.id,params:l},...u.undos];return Bm(d,n).result?(r.pushUndoRedo({unitID:o,undoMutations:f,redoMutations:d}),!0):!1}},jgt=(e,t)=>({...I.deepClone(t),toOrder:t.fromOrder,fromOrder:t.toOrder}),TY={id:`sheet.mutation.set-worksheet-order`,type:R.MUTATION,handler:(e,t)=>{let n=e.get(B).getUniverSheetInstance(t.unitId);if(!n)return!1;let r=n.getConfig();return r.sheetOrder.splice(t.fromOrder,1),r.sheetOrder.splice(t.toOrder,0,t.subUnitId),n.ensureSheetOrderUnique(),!0}},EY={type:R.COMMAND,id:`sheet.command.set-worksheet-order`,handler:(e,t)=>{let n=e.get(z),r=e.get($b),i=rG(e.get(B),t);if(!i)return!1;let{workbook:a,unitId:o,subUnitId:s}=i,c={fromOrder:a.getConfig().sheetOrder.indexOf(s),toOrder:t.order,unitId:o,subUnitId:s},l=jgt(e,c);return n.syncExecuteCommand(TY.id,c)?(r.pushUndoRedo({unitID:o,undoMutations:[{id:TY.id,params:l}],redoMutations:[{id:TY.id,params:c}]}),!0):!1}},DY=class{constructor(){Z(this,`_model`,new Map),Z(this,`_pointChange`,new io),Z(this,`pointChange$`,this._pointChange.asObservable())}addRule(e){this._ensureSubUnitMap(e.unitId).set(e.subUnitId,e),this._pointChange.next(e)}deleteRule(e,t){let n=this._model.get(e)?.get(t);if(n){var r;(r=this._model)==null||(r=r.get(e))==null||r.delete(t),this._pointChange.next(n)}}getRule(e,t){var n;return(n=this._model)==null||(n=n.get(e))==null?void 0:n.get(t)}toObject(){let e={};return[...this._model.keys()].forEach(t=>{let n=this._model.get(t);n?.size&&(e[t]=[],[...n.keys()].forEach(r=>{let i=n.get(r);i&&e[t].push(i)}))}),e}fromObject(e){let t=new Map;Object.keys(e).forEach(n=>{let r=e[n];if(r?.length){let e=new Map;r.forEach(t=>{e.set(t.subUnitId,t)}),t.set(n,e)}}),this._model=t}deleteUnitModel(e){this._model.delete(e)}_ensureSubUnitMap(e){let t=this._model.get(e);return t||(t=new Map,this._model.set(e,t)),t}getTargetByPermissionId(e,t){let n=this._model.get(e);if(!n)return null;for(let[r,i]of n)if(i.permissionId===t)return[e,r]}},OY=class{constructor(e,t,n){Z(this,`type`,na.SelectRange),Z(this,`subType`,ea.Delete),Z(this,`status`,Vb.INIT),Z(this,`value`,!0),Z(this,`id`,void 0),Z(this,`unitId`,void 0),Z(this,`subUnitId`,void 0),Z(this,`permissionId`,void 0),this.unitId=e,this.subUnitId=t,this.permissionId=n,this.id=`${na.SelectRange}.${ea.Delete}.${n}`}},kY=class{constructor(e,t,n){Z(this,`type`,na.SelectRange),Z(this,`subType`,ea.Edit),Z(this,`status`,Vb.INIT),Z(this,`value`,!0),Z(this,`id`,void 0),Z(this,`unitId`,void 0),Z(this,`subUnitId`,void 0),Z(this,`permissionId`,void 0),this.unitId=e,this.subUnitId=t,this.permissionId=n,this.id=`${na.SelectRange}.${ea.Edit}.${n}`}},AY=class{constructor(e,t,n){Z(this,`type`,na.SelectRange),Z(this,`subType`,ea.ManageCollaborator),Z(this,`status`,Vb.INIT),Z(this,`value`,!0),Z(this,`id`,void 0),Z(this,`unitId`,void 0),Z(this,`subUnitId`,void 0),Z(this,`permissionId`,void 0),this.unitId=e,this.subUnitId=t,this.permissionId=n,this.id=`${na.SelectRange}.${ea.ManageCollaborator}.${n}`}},jY=class{constructor(e,t,n){Z(this,`type`,na.SelectRange),Z(this,`subType`,ea.View),Z(this,`status`,Vb.INIT),Z(this,`value`,!1),Z(this,`id`,void 0),Z(this,`unitId`,void 0),Z(this,`subUnitId`,void 0),Z(this,`permissionId`,void 0),this.unitId=e,this.subUnitId=t,this.permissionId=n,this.id=`${na.SelectRange}.${ea.View}.${n}`}},MY=()=>[jY,kY,AY,OY],NY=[ea.Edit,ea.View,ea.ManageCollaborator,ea.Delete],PY=class{constructor(e){this.unitId=e,Z(this,`id`,void 0),Z(this,`value`,!0),Z(this,`type`,na.Workbook),Z(this,`status`,Vb.INIT),Z(this,`subType`,ea.Comment),this.unitId=e,this.id=`${this.type}.${ea.Comment}_${e}`}},FY=class{constructor(e){this.unitId=e,Z(this,`id`,void 0),Z(this,`value`,!0),Z(this,`type`,na.Workbook),Z(this,`status`,Vb.INIT),Z(this,`subType`,ea.Copy),this.unitId=e,this.id=`${this.type}.${ea.Copy}_${e}`}},Mgt=class{constructor(e){this.unitId=e,Z(this,`id`,void 0),Z(this,`value`,!0),Z(this,`type`,na.Workbook),Z(this,`subType`,ea.CopySheet),Z(this,`status`,Vb.INIT),this.unitId=e,this.id=`${this.type}.${ea.CopySheet}_${e}`}},IY=class{constructor(e){this.unitId=e,Z(this,`id`,void 0),Z(this,`value`,!0),Z(this,`type`,na.Workbook),Z(this,`status`,Vb.INIT),Z(this,`subType`,ea.CreatePermissionObject),this.unitId=e,this.id=`${this.type}.${ea.CreatePermissionObject}_${e}`}},LY=class{constructor(e){this.unitId=e,Z(this,`id`,void 0),Z(this,`value`,!0),Z(this,`type`,na.Workbook),Z(this,`status`,Vb.INIT),Z(this,`subType`,ea.CreateSheet),this.unitId=e,this.id=`${this.type}.${ea.CreateSheet}_${e}`}},RY=class{constructor(e){this.unitId=e,Z(this,`value`,!0),Z(this,`type`,na.Workbook),Z(this,`status`,Vb.INIT),Z(this,`id`,void 0),Z(this,`subType`,ea.DeleteColumn),this.id=`${this.type}.${ea.DeleteColumn}_${e}`}},zY=class{constructor(e){this.unitId=e,Z(this,`value`,!0),Z(this,`type`,na.Workbook),Z(this,`status`,Vb.INIT),Z(this,`id`,void 0),Z(this,`subType`,ea.DeleteRow),this.id=`${this.type}.${ea.DeleteRow}_${e}`}},BY=class{constructor(e){this.unitId=e,Z(this,`id`,void 0),Z(this,`value`,!0),Z(this,`type`,na.Workbook),Z(this,`status`,Vb.INIT),Z(this,`subType`,ea.DeleteSheet),this.unitId=e,this.id=`${this.type}.${ea.DeleteSheet}_${e}`}},Ngt=class{constructor(e){this.unitId=e,Z(this,`id`,void 0),Z(this,`value`,!0),Z(this,`type`,na.Workbook),Z(this,`status`,Vb.INIT),Z(this,`subType`,ea.Duplicate),this.unitId=e,this.id=`${this.type}.${ea.Duplicate}_${e}`}},VY=class{constructor(e){this.unitId=e,Z(this,`id`,void 0),Z(this,`value`,!0),Z(this,`type`,na.Workbook),Z(this,`status`,Vb.INIT),Z(this,`subType`,ea.Edit),this.unitId=e,this.id=`${this.type}.${ea.Edit}_${e}`}},Pgt=class{constructor(e){this.unitId=e,Z(this,`id`,void 0),Z(this,`value`,!0),Z(this,`type`,na.Workbook),Z(this,`status`,Vb.INIT),Z(this,`subType`,ea.Export),this.unitId=e,this.id=`${this.type}.${ea.Export}_${e}`}},HY=class{constructor(e){this.unitId=e,Z(this,`id`,void 0),Z(this,`value`,!0),Z(this,`type`,na.Workbook),Z(this,`status`,Vb.INIT),Z(this,`subType`,ea.HideSheet),this.unitId=e,this.id=`${this.type}.${ea.HideSheet}_${e}`}},UY=class{constructor(e){this.unitId=e,Z(this,`value`,!0),Z(this,`type`,na.Workbook),Z(this,`status`,Vb.INIT),Z(this,`id`,void 0),Z(this,`subType`,ea.InsertColumn),this.id=`${this.type}.${ea.InsertColumn}_${e}`}},WY=class{constructor(e){this.unitId=e,Z(this,`value`,!0),Z(this,`type`,na.Workbook),Z(this,`status`,Vb.INIT),Z(this,`id`,void 0),Z(this,`subType`,ea.InsertRow),this.id=`${this.type}.${ea.InsertRow}_${e}`}},GY=class{constructor(e){this.unitId=e,Z(this,`id`,void 0),Z(this,`value`,!0),Z(this,`type`,na.Workbook),Z(this,`status`,Vb.INIT),Z(this,`subType`,ea.ManageCollaborator),this.unitId=e,this.id=`${this.type}.${ea.ManageCollaborator}_${e}`}},KY=class{constructor(e){this.unitId=e,Z(this,`id`,void 0),Z(this,`value`,!0),Z(this,`type`,na.Workbook),Z(this,`status`,Vb.INIT),Z(this,`subType`,ea.MoveSheet),this.unitId=e,this.id=`${this.type}.${ea.MoveSheet}_${e}`}},Fgt=class{constructor(e){this.unitId=e,Z(this,`id`,void 0),Z(this,`value`,!0),Z(this,`type`,na.Workbook),Z(this,`status`,Vb.INIT),Z(this,`subType`,ea.Print),this.unitId=e,this.id=`${this.type}.${ea.Print}_${e}`}},Igt=class{constructor(e){this.unitId=e,Z(this,`id`,void 0),Z(this,`value`,!0),Z(this,`type`,na.Workbook),Z(this,`status`,Vb.INIT),Z(this,`subType`,ea.RecoverHistory),this.unitId=e,this.id=`${this.type}.${ea.RecoverHistory}_${e}`}},qY=class{constructor(e){this.unitId=e,Z(this,`id`,void 0),Z(this,`value`,!0),Z(this,`type`,na.Workbook),Z(this,`status`,Vb.INIT),Z(this,`subType`,ea.RenameSheet),this.unitId=e,this.id=`${this.type}.${ea.RenameSheet}_${e}`}},Lgt=class{constructor(e){this.unitId=e,Z(this,`id`,void 0),Z(this,`value`,!0),Z(this,`type`,na.Workbook),Z(this,`status`,Vb.INIT),Z(this,`subType`,ea.Share),this.unitId=e,this.id=`${this.type}.${ea.Share}_${e}`}},JY=class{constructor(e){this.unitId=e,Z(this,`id`,void 0),Z(this,`value`,!0),Z(this,`type`,na.Workbook),Z(this,`status`,Vb.INIT),Z(this,`subType`,ea.View),this.unitId=e,this.id=`${this.type}.${ea.View}_${e}`}},Rgt=class{constructor(e){this.unitId=e,Z(this,`id`,void 0),Z(this,`value`,!0),Z(this,`type`,na.Workbook),Z(this,`status`,Vb.INIT),Z(this,`subType`,ea.ViewHistory),this.unitId=e,this.id=`${this.type}.${ea.ViewHistory}_${e}`}},YY=class{constructor(e,t){this.unitId=e,this.subUnitId=t,Z(this,`value`,!0),Z(this,`type`,na.Worksheet),Z(this,`status`,Vb.INIT),Z(this,`id`,void 0),Z(this,`subType`,ea.Copy),this.id=`${this.type}.${ea.Copy}_${e}_${t}`}},XY=class{constructor(e,t){this.unitId=e,this.subUnitId=t,Z(this,`value`,!0),Z(this,`type`,na.Worksheet),Z(this,`status`,Vb.INIT),Z(this,`id`,void 0),Z(this,`subType`,ea.DeleteColumn),this.id=`${this.type}.${ea.DeleteColumn}_${e}_${t}`}},ZY=class{constructor(e,t){this.unitId=e,this.subUnitId=t,Z(this,`value`,!0),Z(this,`type`,na.Worksheet),Z(this,`status`,Vb.INIT),Z(this,`id`,void 0),Z(this,`subType`,ea.Delete),this.id=`${this.type}.${ea.Delete}_${e}_${t}`}},QY=class{constructor(e,t){this.unitId=e,this.subUnitId=t,Z(this,`value`,!0),Z(this,`type`,na.Worksheet),Z(this,`status`,Vb.INIT),Z(this,`id`,void 0),Z(this,`subType`,ea.DeleteRow),this.id=`${this.type}.${ea.DeleteRow}_${e}_${t}`}},$Y=class{constructor(e,t){this.unitId=e,this.subUnitId=t,Z(this,`value`,!0),Z(this,`type`,na.Worksheet),Z(this,`status`,Vb.INIT),Z(this,`id`,void 0),Z(this,`subType`,ea.Edit),this.id=`${this.type}.${ea.Edit}_${e}_${t}`}},zgt=class{constructor(e,t){this.unitId=e,this.subUnitId=t,Z(this,`value`,!0),Z(this,`type`,na.Worksheet),Z(this,`status`,Vb.INIT),Z(this,`id`,void 0),Z(this,`subType`,ea.EditExtraObject),this.id=`${this.type}.${ea.EditExtraObject}_${e}_${t}`}},eX=class{constructor(e,t){this.unitId=e,this.subUnitId=t,Z(this,`value`,!0),Z(this,`type`,na.Worksheet),Z(this,`status`,Vb.INIT),Z(this,`id`,void 0),Z(this,`subType`,ea.Filter),this.id=`${this.type}.${ea.Filter}_${e}_${t}`}},tX=class{constructor(e,t){this.unitId=e,this.subUnitId=t,Z(this,`value`,!0),Z(this,`type`,na.Worksheet),Z(this,`status`,Vb.INIT),Z(this,`id`,void 0),Z(this,`subType`,ea.InsertColumn),this.id=`${this.type}.${ea.InsertColumn}_${e}_${t}`}},nX=class{constructor(e,t){this.unitId=e,this.subUnitId=t,Z(this,`value`,!0),Z(this,`type`,na.Worksheet),Z(this,`status`,Vb.INIT),Z(this,`id`,void 0),Z(this,`subType`,ea.InsertHyperlink),this.id=`${this.type}.${ea.InsertHyperlink}_${e}_${t}`}},rX=class{constructor(e,t){this.unitId=e,this.subUnitId=t,Z(this,`value`,!0),Z(this,`type`,na.Worksheet),Z(this,`status`,Vb.INIT),Z(this,`id`,void 0),Z(this,`subType`,ea.InsertRow),this.id=`${this.type}.${ea.InsertRow}_${e}_${t}`}},iX=class{constructor(e,t){this.unitId=e,this.subUnitId=t,Z(this,`value`,!0),Z(this,`type`,na.Worksheet),Z(this,`status`,Vb.INIT),Z(this,`id`,void 0),Z(this,`subType`,ea.ManageCollaborator),this.id=`${this.type}.${ea.ManageCollaborator}_${e}_${t}`}},Bgt=class{constructor(e,t){this.unitId=e,this.subUnitId=t,Z(this,`value`,!0),Z(this,`type`,na.Worksheet),Z(this,`status`,Vb.INIT),Z(this,`id`,void 0),Z(this,`subType`,ea.PivotTable),this.id=`${this.type}.${ea.PivotTable}_${e}_${t}`}},Vgt=class{constructor(e,t){this.unitId=e,this.subUnitId=t,Z(this,`value`,!0),Z(this,`type`,na.Worksheet),Z(this,`status`,Vb.INIT),Z(this,`id`,void 0),Z(this,`subType`,ea.SelectProtectedCells),this.id=`${this.type}.${ea.SelectProtectedCells}_${e}_${t}`}},Hgt=class{constructor(e,t){this.unitId=e,this.subUnitId=t,Z(this,`value`,!0),Z(this,`type`,na.Worksheet),Z(this,`status`,Vb.INIT),Z(this,`id`,void 0),Z(this,`subType`,ea.SelectUnProtectedCells),this.id=`${this.type}.${ea.SelectUnProtectedCells}_${e}_${t}`}},aX=class{constructor(e,t){this.unitId=e,this.subUnitId=t,Z(this,`value`,!0),Z(this,`type`,na.Worksheet),Z(this,`status`,Vb.INIT),Z(this,`id`,void 0),Z(this,`subType`,ea.SetCellStyle),this.id=`${this.type}.${ea.SetCellStyle}_${e}_${t}`}},oX=class{constructor(e,t){this.unitId=e,this.subUnitId=t,Z(this,`value`,!0),Z(this,`type`,na.Worksheet),Z(this,`status`,Vb.INIT),Z(this,`id`,void 0),Z(this,`subType`,ea.SetCellValue),this.id=`${this.type}.${ea.SetCellValue}_${e}_${t}`}},sX=class{constructor(e,t){this.unitId=e,this.subUnitId=t,Z(this,`value`,!0),Z(this,`type`,na.Worksheet),Z(this,`status`,Vb.INIT),Z(this,`id`,void 0),Z(this,`subType`,ea.SetColumnStyle),this.id=`${this.type}.${ea.SetColumnStyle}_${e}_${t}`}},cX=class{constructor(e,t){this.unitId=e,this.subUnitId=t,Z(this,`value`,!0),Z(this,`type`,na.Worksheet),Z(this,`status`,Vb.INIT),Z(this,`id`,void 0),Z(this,`subType`,ea.SetRowStyle),this.id=`${this.type}.${ea.SetRowStyle}_${e}_${t}`}},lX=class{constructor(e,t){this.unitId=e,this.subUnitId=t,Z(this,`value`,!0),Z(this,`type`,na.Worksheet),Z(this,`status`,Vb.INIT),Z(this,`id`,void 0),Z(this,`subType`,ea.Sort),this.id=`${this.type}.${ea.Sort}_${e}_${t}`}},uX=class{constructor(e,t){this.unitId=e,this.subUnitId=t,Z(this,`value`,!0),Z(this,`type`,na.Worksheet),Z(this,`status`,Vb.INIT),Z(this,`id`,void 0),Z(this,`subType`,ea.View),this.id=`${this.type}.${ea.View}_${e}_${t}`}},dX=()=>[VY,Fgt,PY,JY,FY,Pgt,GY,LY,BY,qY,HY,Ngt,Lgt,KY,Mgt,Rgt,Igt,IY,WY,UY,zY,RY],Ugt=[ea.Edit,ea.Print,ea.Comment,ea.View,ea.Copy,ea.Export,ea.ManageCollaborator,ea.CreateSheet,ea.DeleteSheet,ea.RenameSheet,ea.HideSheet,ea.Duplicate,ea.Share,ea.MoveSheet,ea.CopySheet,ea.RecoverHistory,ea.ViewHistory,ea.CreatePermissionObject,ea.InsertRow,ea.InsertColumn,ea.DeleteRow,ea.DeleteColumn],fX=()=>[$Y,uX,iX,ZY],pX=()=>[YY,XY,QY,zgt,eX,tX,rX,nX,Bgt,aX,oX,sX,cX,lX],mX=[ea.Copy,ea.DeleteColumn,ea.DeleteRow,ea.EditExtraObject,ea.Filter,ea.InsertColumn,ea.InsertRow,ea.InsertHyperlink,ea.PivotTable,ea.SetCellStyle,ea.SetCellValue,ea.SetColumnStyle,ea.SetRowStyle,ea.Sort],Wgt=`SHEET_WORKSHEET_PROTECTION_PLUGIN`,Ggt=`SHEET_WORKSHEET_PROTECTION_POINT_PLUGIN`,hX=class extends Wf{constructor(e,t,n,r,i,a,o,s){super(),this._permissionService=e,this._univerInstanceService=t,this._injector=n,this._worksheetProtectionRuleModel=r,this._worksheetProtectionPointRuleModel=i,this._resourceManagerService=a,this._rangeProtectionRuleModel=o,this._logService=s,this._init(),this._initRuleChange(),this._initRuleSnapshot(),this._initPointSnapshot()}_init(){let e=e=>{let t=e.getUnitId(),n=e=>{let n=e.getSheetId();[...fX(),...pX()].forEach(e=>{let r=new e(t,n);this._permissionService.addPermissionPoint(r)}),this._logService.debug(`[WorksheetPermissionService]`,`Initialization completed`,t,n)};e.getSheets().forEach(e=>{n(e)}),e.sheetCreated$.subscribe(e=>{n(e)}),e.sheetDisposed$.subscribe(e=>{let n=e.getSheetId();this._rangeProtectionRuleModel.getSubunitRuleList(t,n).forEach(e=>{[...MY()].forEach(r=>{let i=new r(t,n,e.permissionId);this._permissionService.deletePermissionPoint(i.id)})}),[...fX(),...pX()].forEach(e=>{let r=new e(t,n);this._permissionService.deletePermissionPoint(r.id)})})};this._univerInstanceService.getAllUnitsForType(N.UNIVER_SHEET).forEach(t=>e(t)),this._univerInstanceService.getTypeOfUnitAdded$(N.UNIVER_SHEET).pipe(sc(this.dispose$)).subscribe(t=>e(t.unit)),this._univerInstanceService.getTypeOfUnitDisposed$(N.UNIVER_SHEET).pipe(sc(this.dispose$)).subscribe(e=>{e.getSheets().forEach(t=>{let n=e.getUnitId(),r=t.getSheetId();fX().forEach(e=>{let t=new e(n,r);this._permissionService.deletePermissionPoint(t.id)})})})}_initRuleChange(){this.disposeWithMe(this._worksheetProtectionRuleModel.ruleChange$.subscribe(e=>{switch(e.type){case`add`:break;case`delete`:fX().forEach(t=>{let n=new t(e.unitId,e.subUnitId);this._permissionService.updatePermissionPoint(n.id,!0)});break;case`set`:fX().forEach(t=>{let n=new t(e.unitId,e.subUnitId);this._permissionService.updatePermissionPoint(n.id,e.rule)})}}))}_initRuleSnapshot(){this.disposeWithMe(this._resourceManagerService.registerPluginResource({toJson:()=>{let e=this._worksheetProtectionRuleModel.toObject();return JSON.stringify(e)},parseJson:e=>{if(!e)return{};try{return JSON.parse(e)}catch{return{}}},pluginName:Wgt,businesses:[N.UNIVER_SHEET],onLoad:(e,t)=>{this._worksheetProtectionRuleModel.fromObject(t),Object.keys(t).forEach(t=>{fX().forEach(n=>{let r=new n(e,t);r.value=!1,this._permissionService.addPermissionPoint(r)})}),this._worksheetProtectionRuleModel.changeRuleInitState(!0)},onUnLoad:e=>{let t=this._univerInstanceService.getUnit(e);t&&(t.getSheets().forEach(t=>{let n=t.getSheetId();[...fX(),...pX()].forEach(t=>{let r=new t(e,n);this._permissionService.deletePermissionPoint(r.id)})}),dX().forEach(t=>{let n=new t(e);this._permissionService.deletePermissionPoint(n.id)})),this._worksheetProtectionRuleModel.deleteUnitModel(e)}}))}_initPointSnapshot(){this.disposeWithMe(this._resourceManagerService.registerPluginResource({toJson:()=>{let e=this._worksheetProtectionPointRuleModel.toObject();return JSON.stringify(e)},parseJson:e=>{if(!e)return{};try{return JSON.parse(e)}catch{return{}}},pluginName:Ggt,businesses:[N.UNIVER_SHEET],onLoad:(e,t)=>{this._worksheetProtectionPointRuleModel.fromObject(t),Object.keys(t).forEach(t=>{pX().forEach(n=>{let r=new n(e,t);this._permissionService.addPermissionPoint(r)})})},onUnLoad:e=>{this._worksheetProtectionPointRuleModel.deleteUnitModel(e)}}))}};hX=dG([uG(0,M(Hb)),uG(1,M(B)),uG(2,M(Ue)),uG(3,M(qq)),uG(4,M(DY)),uG(5,M(wy)),uG(6,M(xK)),uG(7,M(Nm))],hX);var gX={id:`sheet.mutation.set-worksheet-permission-points`,type:R.MUTATION,handler:(e,t)=>{let{rule:n}=t;return e.get(DY).addRule(n),!0}},Kgt={type:R.COMMAND,id:`sheet.command.set-worksheet-permission-points`,async handler(e,t){if(!t)return!1;let n=e.get(z),{rule:r}=t;return n.executeCommand(gX.id,{rule:r,unitId:r.unitId,subUnitId:r.subUnitId}),!0}},qgt={type:R.COMMAND,id:`sheet.command.set-worksheet-protection`,async handler(e,t){if(!t)return!1;let n=e.get(z),r=e.get($b),{rule:i,permissionId:a,oldRule:o}=t,{unitId:s,subUnitId:c}=i,l={...i,permissionId:a};if(await n.executeCommand(lY.id,{unitId:s,subUnitId:c,newRule:l})){let e=[{id:lY.id,params:{unitId:s,subUnitId:c,newRule:l}}],t=[{id:lY.id,params:{unitId:s,subUnitId:c,rule:o}}];r.pushUndoRedo({unitID:s,redoMutations:e,undoMutations:t})}return!0}};R.MUTATION,R.COMMAND;var Jgt={type:R.COMMAND,id:`sheet.command.set-worksheet-row-count`,handler:(e,t)=>{let{unitId:n,subUnitId:r,rowCount:i}=t,a=e.get(z),o=e.get($b);if(!rG(e.get(B),t))return!1;let s={unitId:n,subUnitId:r,rowCount:i},c=opt(e,s);return a.syncExecuteCommand(QG.id,s)?(o.pushUndoRedo({unitID:n,undoMutations:[{id:QG.id,params:c}],redoMutations:[{id:QG.id,params:s}]}),!0):!1}},_X={type:R.COMMAND,id:`sheet.command.delta-row-height`,handler:async(e,t)=>{let n=e.get(TK).getCurrentSelections(),r=e.get(hG);if(!n?.length)return!1;let i=rG(e.get(B));if(!i)return!1;let{worksheet:a,subUnitId:o,unitId:s}=i,{anchorRow:c,deltaY:l}=t,u=a.getRowHeight(c)+l,d=n.length===1&&n[0].range.rangeType===fh.ALL,f=n.filter(e=>e.range.rangeType===fh.ROW),p=d?fh.ALL:f.some(({range:e})=>{let{startRow:t,endRow:n}=e;return t<=c&&c<=n})?fh.ROW:fh.NORMAL,m;if(p===fh.ALL){let e=a.getColumnCount();m={subUnitId:o,unitId:s,rowHeight:u,ranges:Array(a.getRowCount()).fill(void 0).map((t,n)=>({startRow:n,endRow:n,startColumn:0,endColumn:e-1}))}}else m=p===fh.ROW?{subUnitId:o,unitId:s,ranges:f.map(e=>n_.clone(e.range)),rowHeight:u}:{subUnitId:o,unitId:s,rowHeight:u,ranges:[{startRow:c,endRow:c,startColumn:0,endColumn:a.getMaxColumns()-1}]};let h=spt(m,a),g={unitId:s,subUnitId:o,ranges:m.ranges,autoHeightInfo:jp.FALSE},_=$G(g,a),v=e.get(z),y=e.get($b),b=r.onCommandExecute({id:_X.id,params:m}),x=Bm([{id:tK.id,params:m},{id:nK.id,params:g}],v),S=Bm([...b.redos],v);if(x.result&&S.result){let e=r.afterCommandExecute({id:_X.id,params:m});return Bm(e.redos,v),y.pushUndoRedo({unitID:s,undoMutations:[...b.preUndos??[],{id:tK.id,params:h},{id:nK.id,params:_},...b.undos,...e.undos],redoMutations:[...b.preRedos??[],{id:tK.id,params:m},{id:nK.id,params:g},...b.redos,...e.redos]}),!0}return!1}},vX={type:R.COMMAND,id:`sheet.command.set-row-height`,handler:(e,t)=>{var n;let r=e.get(TK),i=e.get(z),a=e.get($b),o=e.get(B),s=e.get(hG),c=t!=null&&(n=t.ranges)!=null&&n.length?t.ranges:r.getCurrentSelections()?.map(e=>e.range);if(!c?.length)return!1;let l=rG(o,t);if(!l)return!1;let{unitId:u,subUnitId:d,worksheet:f}=l,p={subUnitId:d,unitId:u,ranges:c,rowHeight:t.value},m=spt(p,f),h={unitId:u,subUnitId:d,ranges:p.ranges,autoHeightInfo:jp.FALSE},g=$G(h,f),_=Bm([{id:tK.id,params:p},{id:nK.id,params:h}],i),v=s.onCommandExecute({id:vX.id,params:p}),y=Bm([...v.redos],i);if(_.result&&y.result){let e=s.afterCommandExecute({id:vX.id,params:p});return Bm(e.redos,i),a.pushUndoRedo({unitID:u,undoMutations:[...v.preRedos??[],{id:tK.id,params:m},{id:nK.id,params:g},...v.undos,...e.undos],redoMutations:[...v.preRedos??[],{id:tK.id,params:p},{id:nK.id,params:h},...v.redos,...e.redos]}),!0}return!1}},yX={type:R.COMMAND,id:`sheet.command.set-row-is-auto-height`,handler:(e,t)=>{var n;let r=e.get(z),i=e.get($b),a=e.get(TK),o=rG(e.get(B),t);if(!o)return!1;let{unitId:s,subUnitId:c,worksheet:l}=o,u=t!=null&&(n=t.ranges)!=null&&n.length?t.ranges:a.getCurrentSelections()?.map(e=>e.range);if(!u?.length)return!1;let d={unitId:s,subUnitId:c,ranges:u,autoHeightInfo:jp.TRUE},f=$G(d,l),p=r.syncExecuteCommand(nK.id,d),m=e.get(OK).getSkeleton(s,c),{suitableRanges:h,remainingRanges:g}=AK(d.ranges,m),_=e.get(hG),{undos:v,redos:y}=_.generateMutationsOfAutoHeight({unitId:s,subUnitId:c,ranges:h,autoHeightRanges:h,lazyAutoHeightRanges:g}),{undos:b,redos:x}=_.onCommandExecute({id:yX.id,params:d}),S=Bm([...x,...y],r);return p&&S.result?(i.pushUndoRedo({unitID:s,undoMutations:[{id:nK.id,params:f},...b,...v],redoMutations:[{id:nK.id,params:d},...x,...y]}),!0):!1}},bX={type:R.COMMAND,id:`sheet.command.set-worksheet-show`,handler:(e,t)=>{let n=rG(e.get(B),t);if(!n)return!1;let{unitId:r,subUnitId:i,worksheet:a}=n;if(a.getConfig().hidden===jp.FALSE)return!1;let o=e.get(z),s=e.get($b),c={unitId:r,subUnitId:i,hidden:jp.FALSE},l=kgt(e,c),u=o.syncExecuteCommand(xY.id,c),d={unitId:r,subUnitId:i},f=o.syncExecuteCommand(aK.id,d);return u&&f?(s.pushUndoRedo({unitID:r,undoMutations:[{id:xY.id,params:l}],redoMutations:[{id:xY.id,params:c}]}),!0):!1}},Ygt={type:R.COMMAND,id:`sheet.command.split-text-to-columns`,handler:(e,t)=>{let n=rG(e.get(B),t);if(!n)return!1;let{unitId:r,subUnitId:i,worksheet:a}=n,{range:o,delimiter:s,customDelimiter:c,treatMultipleDelimitersAsOne:l}=t,{lastRow:u,rs:d,maxLength:f}=kpt(a,o,s,c,l),p=a.getColumnCount(),{startColumn:m}=Kg.transformRange(o,a);if(o.startColumn!==o.endColumn)return!1;let h=e.get(z),g=e.get($b),_=[],v=[],y=m+f+1-p;if(y>0){let t={unitId:r,subUnitId:i,range:{startRow:0,endRow:a.getRowCount()-1,startColumn:p-1,endColumn:p-1+y}};_.push({id:TG.id,params:t});let n=wG(e,t);v.push({id:AG.id,params:n})}let b={startRow:o.startRow,endRow:u,startColumn:m,endColumn:m+f},x=new Mh;for(let e=b.startRow;e<=b.endRow;e++)for(let t=b.startColumn;t<=b.endColumn;t++){let n=d[e-b.startRow];t===0&&n?.length===1?x.setValue(e,t,a.getCell(e,t)):x.setValue(e,t,{v:n?.[t-b.startColumn]||null,p:null,f:null,si:null,custom:null})}let S={unitId:r,subUnitId:i,cellValue:x.clone()},C=UG(e,S);return _.push({id:WG.id,params:S}),v.unshift({id:WG.id,params:C}),Bm(_,h).result?(g.pushUndoRedo({unitID:r,undoMutations:v,redoMutations:_}),!0):!1}},xX=se(`INumfmtService`),Xgt=(e,t)=>{let n=e.get(xX),{values:r,unitId:i,subUnitId:a}=t,o=[],s=[];Object.keys(r).forEach(e=>{r[e].ranges.forEach(e=>{Kg.foreach(e,(e,t)=>{let r=n.getValue(i,a,e,t);r?o.push({pattern:r.pattern,row:e,col:t}):s.push({startColumn:t,endColumn:t,startRow:e,endRow:e})})})});let c=[];if(o.length){let e=TX(i,a,o);Object.keys(e.values).forEach(t=>{let n=e.values[t];n.ranges=uK(n.ranges)}),c.push({id:SX.id,params:TX(i,a,o)})}return s.length&&c.push({id:CX.id,params:{unitId:i,subUnitId:a,ranges:s}}),c},SX={id:`sheet.mutation.set.numfmt`,type:R.MUTATION,handler:(e,t)=>{if(!t)return!1;let{values:n,refMap:r}=t,i=e.get(xX),a=t.unitId,o=t.subUnitId,s=Object.keys(n).reduce((e,t)=>{let i=r[t],a=n[t].ranges;return i&&e.push({...i,ranges:a}),e},[]);return i.setValues(a,o,s),!0}},CX={id:`sheet.mutation.remove.numfmt`,type:R.MUTATION,handler:(e,t)=>{if(!t)return!1;let{unitId:n,subUnitId:r,ranges:i}=t;return e.get(xX).deleteValues(n,r,i),!0}},wX=(e,t)=>{let n=e.get(xX),{ranges:r,unitId:i,subUnitId:a}=t,o=[];if(r.forEach(e=>{Kg.foreach(e,(e,t)=>{let r=n.getValue(i,a,e,t);r&&o.push({pattern:r.pattern,row:e,col:t})})}),!o.length)return[];let s=TX(i,a,o);return Object.keys(s.values).forEach(e=>{let t=s.values[e];t.ranges=uK(t.ranges)}),[{id:SX.id,params:s}]},TX=(e,t,n)=>{let r=Apt(n,`pattern`),i={},a={},o=jpt();return Object.keys(r).forEach(e=>{let t=r[e],n=o();i[n]={pattern:e},t.forEach(e=>{a[n]||(a[n]={ranges:[]}),a[n].ranges.push(Uh(e.row,e.col))})}),{unitId:e,subUnitId:t,refMap:i,values:a}},EX={id:`sheet.command.text-to-number`,type:R.COMMAND,handler:(e,t)=>{let n=rG(e.get(B),t);if(!n)return!1;let r=t?.ranges||e.get(TK).getCurrentSelections()?.map(e=>e.range);if(!r?.length)return!1;let i=e.get(z),a=e.get($b),{worksheet:o,unitId:s,subUnitId:c}=n,l=new Mh,u=[];for(let e=0;e<r.length;e++)for(let t=r[e].startRow;t<=r[e].endRow;t++)for(let n=r[e].startColumn;n<=r[e].endColumn;n++){var d,f;if(l.getValue(t,n))continue;let e=o.getCellRaw(t,n),r=typeof e?.s==`string`?(d=o.getStyleDataByHash(e.s))==null||(d=d.n)==null?void 0:d.pattern:e==null||(f=e.s)==null||(f=f.n)==null?void 0:f.pattern;e&&e.v&&(e.t!==Mp.NUMBER||_h(r))&&Tg(e.v)&&(l.setValue(t,n,{v:Number(e.v),t:Mp.NUMBER}),_h(r)&&u.push({startRow:t,endRow:t,startColumn:n,endColumn:n}))}let p={subUnitId:c,unitId:s,cellValue:l.getMatrix()},m=[{id:WG.id,params:p}],h=[{id:WG.id,params:UG(e,p)}];if(u.length){let t={unitId:s,subUnitId:c,ranges:u};m.push({id:CX.id,params:t}),h.push(...wX(e,t))}return Bm(m,i).result?(a.pushUndoRedo({unitID:s,undoMutations:h,redoMutations:m}),!0):!1}},Zgt={id:`sheet.command.toggle-cell-checkbox`,type:R.COMMAND,handler:(e,t)=>{if(!t)return!1;let{unitId:n,subUnitId:r,row:i,col:a,paragraphIndex:o}=t,s=e.get(B).getUnit(n,N.UNIVER_SHEET)?.getSheetBySheetId(r),c=e.get($b),l=e.get(z);if(!s)return!1;let u=s.getCell(i,a);if(!u?.p)return!1;let d=I.deepClone(u.p),f=new Fv(d),p=dy.paragraph.bullet.toggleChecklist({document:f,paragraphIndex:o});if(!p)return!1;Ev.apply(f.getBody(),p.serialize());let m={unitId:n,subUnitId:r,cellValue:{[i]:{[a]:{p:d,t:Mp.STRING}}}},h={id:WG.id,params:m},g=UG(e,m),_={id:WG.id,params:g},v=[h],y=[_];return c.pushUndoRedo({redoMutations:v,undoMutations:y,unitID:n}),l.syncExecuteCommand(h.id,h.params)}},DX={type:R.COMMAND,id:`sheet.command.toggle-gridlines`,handler:(e,t)=>{let n=e.get(z),r=e.get($b),i=rG(e.get(B),t);if(!i)return!1;let{worksheet:a}=i,o=a.getConfig().showGridlines;if(o===t?.showGridlines)return!1;let{unitId:s,subUnitId:c}=i,l={showGridlines:o===jp.TRUE?jp.FALSE:jp.TRUE,unitId:s,subUnitId:c},u={showGridlines:o,unitId:s,subUnitId:c};return n.syncExecuteCommand(iK.id,l)?(r.pushUndoRedo({unitID:s,undoMutations:[{id:iK.id,params:u}],redoMutations:[{id:iK.id,params:l}]}),!0):!1}},Qgt={id:`sheet.command.unregister-worksheet-range-theme-style`,type:R.COMMAND,handler:(e,t)=>{if(!t||!rG(e.get(B),t))return!1;let n=e.get(z),r=e.get($b),i=e.get(yG),{unitId:a,themeName:o}=t,s={unitId:a,themeName:o},c={unitId:a,themeName:o,rangeThemeStyleJson:i.getRangeThemeStyle(a,o)?.toJson()};return n.syncExecuteCommand(UJ.id,t)?(r.pushUndoRedo({unitID:a,undoMutations:[{id:UJ.id,params:c}],redoMutations:[{id:WJ.id,params:s}]}),!0):!1}},$gt={id:`sheet.mutation.add-range-theme`,type:R.MUTATION,handler:(e,t)=>{if(!t)return!1;let{styleJSON:n,unitId:r}=t,i=e.get(yG),a=new vG(n.name);return a.fromJson(n),i.registerRangeThemeStyle(r,a),!0}},e_t={id:`sheet.mutation.empty`,type:R.MUTATION,handler:()=>!0},OX={id:`sheet.mutation.mark-dirty-filter-change`,type:R.MUTATION,handler:()=>!0},t_t={id:`sheet.mutation.remove-range-theme`,type:R.MUTATION,handler:(e,t)=>{if(!t)return!1;let{styleName:n,unitId:r}=t;return e.get(yG).unregisterRangeThemeStyle(r,n),!0}},n_t={id:`sheet.mutation.set-range-theme`,type:R.MUTATION,handler:(e,t)=>{if(!t)return!1;let{unitId:n,styleName:r,style:i}=t,a=e.get(yG).getRangeThemeStyle(n,r);return a&&(i.headerRowStyle&&a.setHeaderRowStyle(i.headerRowStyle),i.firstRowStyle&&a.setFirstRowStyle(i.firstRowStyle),i.secondRowStyle&&a.setSecondRowStyle(i.secondRowStyle),i.lastRowStyle&&a.setLastRowStyle(i.lastRowStyle)),!0}},kX={id:`sheet.operation.mark-dirty-row-auto-height`,type:R.OPERATION,handler:()=>!0},AX={id:`sheet.operation.cancel-mark-dirty-row-auto-height`,type:R.OPERATION,handler:()=>!0},jX={id:`sheet.operation.scroll-to-cell`,type:R.OPERATION,handler:()=>!0},{getLenS:r_t,getDataIndex:i_t,fillCopy:a_t,fillCopyStyles:o_t,generateNullCellValueRowCol:s_t}=yJ,{otherRule:c_t}=Lht,MX=class extends F{constructor(e,t,n){super(),this._univerInstanceService=e,this._autoFillService=t,this._injector=n,Z(this,`_beforeApplyData`,[]),Z(this,`_copyData`,[]),this._init()}_init(){this._initDefaultHook()}quit(){this._beforeApplyData=[],this._copyData=[]}_initDefaultHook(){this.disposeWithMe(this._autoFillService.addHook({id:`default`,type:`DEFAULT`,priority:0,onBeforeFillData:(e,t)=>this._presetAndCacheData(e,t),onFillData:(e,t,n)=>this._fillData(e,t,n)}))}_presetAndCacheData(e,t){let{unitId:n,subUnitId:r,target:i}=e,a=this._univerInstanceService.getUnit(n)?.getSheetBySheetId(r);if(!a)throw Error(`Worksheet not found for unitId: ${n}, subUnitId: ${r}`);let o=a.getCellMatrix(),s=[];return i.rows.forEach(e=>{let t=[];i.cols.forEach(n=>{t.push(I.deepClone(o.getValue(e,n)))}),s.push(t)}),this._beforeApplyData=s,this._copyData=this._getCopyData(e,t),this._shouldDisableSeries(this._copyData)?(this._autoFillService.setDisableApplyType(`SERIES`,!0),`COPY`):(this._autoFillService.setDisableApplyType(`SERIES`,!1),this._getPreferredApplyType(this._copyData))}_getApplyData(e,t,n,r,i,a=!0,o){let s=[],c=Math.floor(n/t),l=n%t,u=this._autoFillService.getRules();if(!a&&i===`ONLY_FORMAT`)return console.error(`ERROR: only format can not be applied when hasStyle is false`),[];let d={};u.forEach(e=>{d[e.type]=[]}),u.forEach(a=>{let{type:s,applyFunctions:u={}}=a,f=e[s];f&&f.forEach(a=>{let f=r_t(a.index,l),p=a.index.length*c+f,m=this._applyFunctions(a,p,r,i,u,e,o),h=i_t(t,n,a.index);d[s].push({data:m,index:h})})});for(let e=0;e<n;e++)u.forEach(t=>{let{type:n}=t,r=d[n];for(let t=0;t<r.length;t++)e in r[t].index&&s.push(r[t].data[r[t].index[e]])});return s}_applyFunctions(e,t,n,r,i,a,o){let{data:s}=e,c=n===L.UP||n===L.LEFT;if(r===`COPY`){let r=i?.COPY;return r?r(e,t,n,a,o):(c&&s.reverse(),a_t(s,t))}if(r===`SERIES`){let r=i?.SERIES;return r?r(e,t,n,a):(c&&s.reverse(),i?.COPY?i.COPY(e,t,n,a,o):a_t(s,t))}if(r===`ONLY_FORMAT`){let r=i?.ONLY_FORMAT;return r?r(e,t,n,a):o_t(s,t)}}_getCopyData(e,t){let{unitId:n,subUnitId:r,source:i}=e,a=this._univerInstanceService.getUnit(n)?.getSheetBySheetId(r);if(!a)throw Error(`No worksheet found`);let o=a.getCellMatrix(),s=this._autoFillService.getRules(),c=[],l=t===L.DOWN||t===L.UP,u,d;return l?(u=i.cols,d=i.rows):(u=i.rows,d=i.cols),u.forEach(e=>{let t=this._getEmptyCopyDataPiece(),n={type:void 0,cellData:void 0};d.forEach(r=>{let i;i=l?o.getValue(r,e):o.getValue(e,r);let{type:a,isContinue:c}=s.find(e=>e.match(i,this._injector))||c_t;if(c(n,i)){let e=t[a],n=e[e.length-1];n.data.push(i),n.index.push(r-d[0])}else{let e=t[a];e?e.push({data:[i],index:[r-d[0]]}):t[a]=[{data:[i],index:[r-d[0]]}]}n.type=a,n.cellData=i}),c.push(t)}),c}_getEmptyCopyDataPiece(){let e={};return this._autoFillService.getRules().forEach(t=>{e[t.type]=[]}),e}_getMergeApplyData(e,t,n,r,i){let{unitId:a,subUnitId:o}=i,s=this._univerInstanceService.getUnit(a)?.getSheetBySheetId(o);if(!s)throw Error(`No active sheet found`);let c=[];for(let i=e.startRow;i<=e.endRow;i++)for(let a=e.startColumn;a<=e.endColumn;a++){let{isMergedMainCell:e,startRow:o,startColumn:l,endRow:u,endColumn:d}=s.getCellInfoInMergeData(i,a);if(e){if(n===L.DOWN){let e=o+r,n=u+r;for(;n<=t.endRow;)c.push({startRow:e,startColumn:l,endRow:n,endColumn:d}),e+=r,n+=r}else if(n===L.UP){let e=o-r,n=u-r;for(;e>=t.startRow;)c.push({startRow:e,startColumn:l,endRow:n,endColumn:d}),e-=r,n-=r}else if(n===L.RIGHT){let e=l+r,n=d+r;for(;n<=t.endColumn;)c.push({startRow:o,startColumn:e,endRow:u,endColumn:n}),e+=r,n+=r}else if(n===L.LEFT){let e=l-r,n=d-r;for(;e>=t.startColumn;)c.push({startRow:o,startColumn:e,endRow:u,endColumn:n}),e-=r,n-=r}}}return c}_fillData(e,t,n){let r=[],i=[],a=!0;n===`NO_FORMAT`&&(a=!1,n=`SERIES`);let{source:o,target:s,unitId:c,subUnitId:l}=e;if(!o||!s||t==null)return{undos:r,redos:i};let u=hK(o),d=hK(s),{cols:f,rows:p}=s,{cols:m,rows:h}=o,g=this._copyData,_;_=t===L.DOWN||t===L.UP?h.length:m.length;let v=[];if(t===L.DOWN||t===L.UP){let r=p.length,i=[];f.forEach((o,s)=>{let c=g[s],l=this._getApplyData(c,_,r,t,n,a,e);i.push(l)});for(let e=0;e<i[0].length;e++){let t=[];for(let n=0;n<i.length;n++)t.push({s:null,...i[n][e]});v.push(t)}}else{let r=f.length;p.forEach((i,o)=>{let s=g[o],c=this._getApplyData(s,_,r,t,n,a,e),l=[];for(let e=0;e<c.length;e++)l.push({s:null,...c[e]});v.push(l)})}let y=[],b=this._univerInstanceService.getUnit(c)?.getStyles();if(a?(y=this._getMergeApplyData(u,d,t,_,e),v.forEach(e=>{e.forEach(e=>{e&&b&&b&&(e.s=b.getStyleByCell(e))})})):v.forEach((e,t)=>{e.forEach((e,n)=>{e&&b&&(e.s=b.getStyleByCell(this._beforeApplyData[t][n])||null)})}),n===`ONLY_FORMAT`&&v.forEach((e,t)=>{e.forEach((e,n)=>{if(e){let r=this._beforeApplyData[t][n]||{};e.f=r.f,e.si=r.si,e.t=r.t,e.v=r.v}})}),a){var x;let e=[],t=(x=this._univerInstanceService.getUniverSheetInstance(c))==null||(x=x.getSheetBySheetId(l))==null?void 0:x.getMergeData();if(t&&t.forEach(t=>{n_.intersects(t,d)&&e.push(t)}),e.length){let t={unitId:c,subUnitId:l,ranges:e},n=this._injector.invoke(jG,t);i.push({id:MG.id,params:t}),r.unshift({id:oG.id,params:n})}}let S={subUnitId:l,unitId:c,cellValue:s_t([s])},C=this._injector.invoke(UG,S);i.push({id:WG.id,params:S}),r.unshift({id:WG.id,params:C});let w=new Mh;p.forEach((e,t)=>{f.forEach((n,r)=>{v[t][r]&&w.setValue(e,n,v[t][r])})});let T=w.getMatrix(),E={subUnitId:l,unitId:c,cellValue:T},D=this._injector.invoke(UG,E);if(this._autoFillService.getActiveHooks().forEach(r=>{var i;(i=r.onBeforeSubmit)==null||i.call(r,e,t,n,T)}),r.unshift({id:WG.id,params:D}),i.push({id:WG.id,params:E}),y?.length){let e={unitId:c,subUnitId:l,ranges:Iq(y)},t=this._injector.invoke(aG,e);r.unshift({id:MG.id,params:t}),i.push({id:oG.id,params:e})}return{undos:r,redos:i}}_shouldDisableSeries(e){return e.every(e=>Object.keys(e).every(t=>e[t]?.length===0||[`other`,`formula`].includes(t)))}_getPreferredApplyType(e){return e.every(e=>Object.keys(e).every(t=>e[t]?.length===0||e[t]?.length===1&&e[t][0].data.length===1&&t===`number`))?`COPY`:`SERIES`}};MX=dG([uG(0,B),uG(1,AJ),uG(2,M(Ue))],MX);var l_t=`maxCellsPerSheet`,u_t=3e6,d_t=`SHEET_DEFINED_NAME_PLUGIN`,NX=`AllDefaultWorkbook`,PX=class extends F{constructor(e,t){super(),this._definedNamesService=e,this._resourceManagerService=t,this._initialize()}_initialize(){this._initSnapshot()}_initSnapshot(){let e=e=>{let t=this._definedNamesService.getDefinedNameMap(e);return t?JSON.stringify(t):``},t=e=>{if(!e)return{};try{return JSON.parse(e)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:d_t,businesses:[N.UNIVER_SHEET],toJson:t=>e(t),parseJson:e=>t(e),onUnLoad:e=>{this._definedNamesService.removeUnitDefinedName(e)},onLoad:(e,t)=>{this._definedNamesService.registerDefinedNames(e,t)}}))}};PX=dG([uG(0,AR),uG(1,wy)],PX);var f_t=[iY.id],p_t=[CG.id,TG.id,kG.id,AG.id,DG.id,OG.id],FX=class extends F{constructor(e,t,n){super(),this._univerInstanceService=e,this._commandService=t,this._configService=n,Z(this,`_d`,new Uf),Z(this,`_enabled`,!0);let r=this._configService.getConfig(`sheets.config`)?.freezeSync??!0;this.setEnabled(r)}getEnabled(){return this._enabled}setEnabled(e){e?this._d.dispose():this._initOnlyLocalListener(),this._enabled=e}_initOnlyLocalListener(){this._d.add(this._commandService.beforeCommandExecuted((e,t)=>{f_t.includes(e.id)&&(t||={},t.onlyLocal=!0)})),this._d.add(this._commandService.onCommandExecuted((e,t)=>{if(p_t.includes(e.id)&&t?.fromCollab){let{id:n,params:r}=e;n===CG.id?this._handleInsertRowMutation(r,t):n===TG.id?this._handleInsertColMutation(r,t):n===kG.id?this._handleRemoveRowMutation(r,t):n===AG.id?this._handleRemoveColMutation(r,t):n===DG.id?this._handleMoveRowsMutation(r,t):n===OG.id&&this._handleMoveColsMutation(r,t)}}))}_handleInsertRowMutation(e,t){let{range:n,unitId:r,subUnitId:i}=e,a=this._getFreeze(r,i);if(a&&n.startRow<a.startRow){let e=n.endRow-n.startRow+1,o={...a,startRow:Math.max(1,a.startRow+e),ySplit:Math.max(1,a.ySplit+e)};this._sequenceExecute(r,i,o,t)}}_handleInsertColMutation(e,t){let{range:n,unitId:r,subUnitId:i}=e,a=this._getFreeze(r,i);if(a&&n.startColumn<a.startColumn){let e=n.endColumn-n.startColumn+1,o={...a,startColumn:Math.max(1,a.startColumn+e),xSplit:Math.max(1,a.xSplit+e)};this._sequenceExecute(r,i,o,t)}}_handleRemoveRowMutation(e,t){let{range:n,unitId:r,subUnitId:i}=e,a=this._getFreeze(r,i);if(a&&n.startRow<a.startRow){let e=Math.min(a.startRow,n.endRow+1)-n.startRow,o={...a,startRow:Math.max(1,a.startRow-e),ySplit:Math.max(1,a.ySplit-e)};this._sequenceExecute(r,i,o,t)}}_handleRemoveColMutation(e,t){let{range:n,unitId:r,subUnitId:i}=e,a=this._getFreeze(r,i);if(a&&n.startColumn<a.startColumn){let e=Math.min(a.startColumn,n.endColumn+1)-n.startColumn,o={...a,startColumn:Math.max(1,a.startColumn-e),xSplit:Math.max(1,a.xSplit-e)};this._sequenceExecute(r,i,o,t)}}_handleMoveRowsMutation(e,t){let{sourceRange:n,targetRange:r,unitId:i,subUnitId:a}=e,o=this._getFreeze(i,a);if(!o||o.startRow<=0||n.startRow>=o.startRow&&r.startRow>=o.startRow||n.endRow<o.startRow&&r.endRow<o.startRow)return;let s=n.endRow-n.startRow+1,c=Math.max(Math.min(o.startRow,n.endRow+1)-n.startRow,0),l={...o};r.startRow>=o.startRow?(l.startRow=Math.max(1,o.startRow-c),l.ySplit=Math.max(1,o.ySplit-c)):(l.startRow=o.startRow+s-c,l.ySplit=o.ySplit+s-c),this._sequenceExecute(i,a,l,t)}_handleMoveColsMutation(e,t){let{sourceRange:n,targetRange:r,unitId:i,subUnitId:a}=e,o=this._getFreeze(i,a);if(!o||o.startColumn<=0||n.startColumn>=o.startColumn&&r.startColumn>=o.startColumn||n.endColumn<o.startColumn&&r.endColumn<o.startColumn)return;let s=n.endColumn-n.startColumn+1,c=Math.max(Math.min(o.startColumn,n.endColumn+1)-n.startColumn,0),l={...o};r.startColumn>=o.startColumn?(l.startColumn=Math.max(1,o.startColumn-c),l.xSplit=Math.max(1,o.xSplit-c)):(l.startColumn=o.startColumn+s-c,l.xSplit=o.xSplit+s-c),this._sequenceExecute(i,a,l,t)}_getFreeze(e,t){let n=this._univerInstanceService.getUnit(e,N.UNIVER_SHEET);if(!n)return null;let r=n.getSheetBySheetId(t);return r?r.getFreeze():null}_sequenceExecute(e,t,n,r){Bm([{id:iY.id,params:{...n,unitId:e,subUnitId:t,resetScroll:!1}}],this._commandService,r)}};FX=dG([uG(0,M(B)),uG(1,z),uG(2,Om)],FX);var IX=class extends F{constructor(e,t,n,r,i,a,o,s,c){super(),this._commandService=e,this._univerInstanceService=t,this._permissionService=n,this._selectionManagerService=r,this._rangeProtectionRuleModel=i,this._worksheetProtectionRuleModel=a,this._localeService=o,this._lexerTreeBuilder=s,this._definedNamesService=c,Z(this,`disposableCollection`,new Uf),Z(this,`_triggerPermissionUIEvent$`,new io),Z(this,`triggerPermissionUIEvent$`,this._triggerPermissionUIEvent$.asObservable()),this._initialize()}_initialize(){this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(e=>{this._getPermissionCheck(e)})),this.disposeWithMe(this._commandService.onCommandExecuted(e=>{if(e.id===CY.id){let t=rG(this._univerInstanceService,e.params);if(!t)return;let{unitId:n,subUnitId:r}=t,i=this._worksheetProtectionRuleModel.getRule(n,r);i&&this._worksheetProtectionRuleModel.ruleRefresh(i.permissionId),this._rangeProtectionRuleModel.getSubunitRuleList(n,r).length&&this._rangeProtectionRuleModel.ruleRefresh(r)}}))}blockExecuteWithoutPermission(e){throw this._triggerPermissionUIEvent$.next(e),new ff(`have no permission`)}_getPermissionCheck(e){let{id:t}=e,n=!0,r=``,i;switch(t){case WK.id:i=e.params,uh(i.value)&&i.value.f?(n=this._permissionCheckWithFormula(i),r=this._localeService.t(`sheets.permission.dialog.formulaErr`)):(n=this._permissionCheckBySetRangeValue({workbookTypes:[VY],worksheetTypes:[oX,$Y],rangeTypes:[kY]},i),r=this._localeService.t(`sheets.permission.dialog.editErr`));break;case Zq.id:i=e.params,n=this.permissionCheckWithRanges({workbookTypes:[VY],worksheetTypes:[aX,$Y],rangeTypes:[kY]},i.range?[i.range]:void 0,i.unitId,i.subUnitId),r=this._localeService.t(`sheets.permission.dialog.setStyleErr`);break;case XJ.id:i=e.params,n=this.permissionCheckWithRanges({workbookTypes:[VY],worksheetTypes:[aX,$Y],rangeTypes:[kY]},i?.ranges,i?.unitId,i?.subUnitId),r=this._localeService.t(`sheets.permission.dialog.setStyleErr`);break;case jK.id:i=e.params,n=this.permissionCheckWithRanges({workbookTypes:[VY],worksheetTypes:[oX,aX,$Y],rangeTypes:[kY]},i?.ranges,i?.unitId,i?.subUnitId),r=this._localeService.t(`sheets.permission.dialog.editErr`);break;case NJ.id:i=e.params,n=this.permissionCheckWithRanges({workbookTypes:[VY],worksheetTypes:[oX,$Y],rangeTypes:[kY]},i?.ranges,i?.unitId,i?.subUnitId),r=this._localeService.t(`sheets.permission.dialog.editErr`);break;case MK.id:i=e.params,n=this.permissionCheckWithRanges({workbookTypes:[VY],worksheetTypes:[aX,$Y],rangeTypes:[kY]},i?.ranges,i?.unitId,i?.subUnitId),r=this._localeService.t(`sheets.permission.dialog.setStyleErr`);break;case yY.id:n=this.permissionCheckWithoutRange({worksheetTypes:[sX]}),r=this._localeService.t(`sheets.permission.dialog.setRowColStyleErr`);break;case bY.id:i=e.params,n=this.permissionCheckWithoutRange({worksheetTypes:[sX]},i.unitId,i.subUnitId),r=this._localeService.t(`sheets.permission.dialog.setRowColStyleErr`);break;case _X.id:n=this.permissionCheckWithoutRange({worksheetTypes:[cX]}),r=this._localeService.t(`sheets.permission.dialog.setRowColStyleErr`);break;case vX.id:case yX.id:i=e.params,n=this.permissionCheckWithoutRange({worksheetTypes:[cX]},i.unitId,i.subUnitId),r=this._localeService.t(`sheets.permission.dialog.setRowColStyleErr`);break;case fq.id:case pq.id:i=e.params,n=this._permissionCheckByMoveRowsColsCommand(i),r=this._localeService.t(`sheets.permission.dialog.moveRowColErr`);break;case HK.id:i=e.params,n=this._permissionCheckByMoveRangeCommand(i),r=this._localeService.t(`sheets.permission.dialog.moveRangeErr`);break;case XK.id:case tq.id:i=e.params,n=this._permissionCheckByInsertRowColCommand(i),r=this._localeService.t(`sheets.permission.dialog.insertRowColErr`);break;case oq.id:i=e.params,n=this.permissionCheckWithRanges({workbookTypes:[VY,zY],worksheetTypes:[$Y,QY],rangeTypes:[kY]},[i.range],i.unitId,i.subUnitId),r=this._localeService.t(`sheets.permission.dialog.removeRowColErr`);break;case lq.id:i=e.params,n=this.permissionCheckWithRanges({workbookTypes:[VY,RY],worksheetTypes:[$Y,XY],rangeTypes:[kY]},[i.range],i.unitId,i.subUnitId),r=this._localeService.t(`sheets.permission.dialog.removeRowColErr`);break;case EY.id:i=e.params,n=this._permissionCheckByWorksheetCommand([VY,KY],i),r=this._localeService.t(`sheets.permission.dialog.operatorSheetErr`);break;case wY.id:i=e.params,n=this._permissionCheckByWorksheetCommand([VY,qY],i),r=this._localeService.t(`sheets.permission.dialog.operatorSheetErr`);break;case bX.id:i=e.params,n=this._permissionCheckByWorksheetCommand([VY,HY],i),r=this._localeService.t(`sheets.permission.dialog.operatorSheetErr`);break;case $J.id:i=e.params,n=this.permissionCheckWithRanges({workbookTypes:[VY],worksheetTypes:[$Y,sX],rangeTypes:[kY]},i.ranges,i.unitId,i.subUnitId),r=this._localeService.t(`sheets.permission.dialog.setRowColStyleErr`);break;case fY.id:i=e.params,n=this.permissionCheckWithRanges({workbookTypes:[VY],worksheetTypes:[$Y,cX],rangeTypes:[kY]},i.ranges,i.unitId,i.subUnitId),r=this._localeService.t(`sheets.permission.dialog.setRowColStyleErr`);break;case eY.id:n=this.permissionCheckWithRanges({workbookTypes:[VY],worksheetTypes:[$Y,sX],rangeTypes:[kY]}),r=this._localeService.t(`sheets.permission.dialog.setRowColStyleErr`);break;case pY.id:n=this.permissionCheckWithRanges({workbookTypes:[VY],worksheetTypes:[$Y,cX],rangeTypes:[kY]}),r=this._localeService.t(`sheets.permission.dialog.setRowColStyleErr`);break;case JK.id:i=e.params,n=this._permissionCheckWithInsertOrDeleteMoveRange(`right`,i),r=this._localeService.t(`sheets.permission.dialog.insertOrDeleteMoveRangeErr`);break;case qK.id:i=e.params,n=this._permissionCheckWithInsertOrDeleteMoveRange(`down`,i),r=this._localeService.t(`sheets.permission.dialog.insertOrDeleteMoveRangeErr`);break;case GK.id:i=e.params,n=this._permissionCheckWithInsertOrDeleteMoveRange(`left`,i),r=this._localeService.t(`sheets.permission.dialog.insertOrDeleteMoveRangeErr`);break;case KK.id:i=e.params,n=this._permissionCheckWithInsertOrDeleteMoveRange(`up`,i),r=this._localeService.t(`sheets.permission.dialog.insertOrDeleteMoveRangeErr`);break;case jJ.id:i=e.params,n=this.permissionCheckWithRanges({workbookTypes:[VY],worksheetTypes:[oX,$Y],rangeTypes:[kY]},[i.targetRange],i.unitId,i.subUnitId),r=this._localeService.t(`sheets.permission.dialog.autoFillErr`);break;case BJ.id:case nY.id:case GJ.id:i=e.params,n=!i.localSheetId||i.localSheetId===`AllDefaultWorkbook`?this.permissionCheckWithoutRange({workbookTypes:[VY]},i.unitId):this.permissionCheckWithoutRange({workbookTypes:[VY],worksheetTypes:[$Y]},i.unitId,i.localSheetId),r=this._localeService.t(`sheets.permission.dialog.editErr`)}n||this.blockExecuteWithoutPermission(r)}permissionCheckWithRanges(e,t,n,r){let i=rG(this._univerInstanceService,{unitId:n,subUnitId:r});if(!i)return!1;let{unitId:a,subUnitId:o}=i,{workbookTypes:s,worksheetTypes:c,rangeTypes:l}=e;if(s&&s.some(e=>{let t=new e(a);return this._permissionService.getPermissionPoint(t.id)?.value===!1})||c&&c.some(e=>{let t=new e(a,o);return this._permissionService.getPermissionPoint(t.id)?.value===!1}))return!1;if(l&&l.length>0){let e=t??this._selectionManagerService.getCurrentSelections()?.map(e=>e.range);if(!e)return!1;let n=this._rangeProtectionRuleModel.getSubunitRuleList(a,o);if(n.length===0)return!0;for(let t=0;t<n.length;t++){let r=n[t];if(e.some(e=>r.ranges.some(t=>n_.intersects(t,e)))){let e=r.permissionId;if(l.some(t=>{let n=new t(a,o,e);return this._permissionService.getPermissionPoint(n.id)?.value===!1}))return!1}}}return!0}permissionCheckWithoutRange(e,t,n){let r=rG(this._univerInstanceService,{unitId:t,subUnitId:n});if(!r)return!1;let{worksheet:i,unitId:a,subUnitId:o}=r,{workbookTypes:s,worksheetTypes:c,rangeTypes:l}=e;if(s&&s.some(e=>{let t=new e(a);return this._permissionService.getPermissionPoint(t.id)?.value===!1})||c&&c.some(e=>{let t=new e(a,o);return this._permissionService.getPermissionPoint(t.id)?.value===!1}))return!1;if(l&&l.length>0){var u;let e=this._selectionManagerService.getCurrentLastSelection()?.primary;if(!e)return!1;let{actualRow:t,actualColumn:n}=e,r=i.getCell(t,n),s=r==null||(u=r.selectionProtection)==null?void 0:u[0];if(!s?.ruleId)return!0;let c=this._rangeProtectionRuleModel.getRule(a,o,s.ruleId)?.permissionId;if(!c)return!0;if(l.some(e=>{let t=new e(a,o,c);return this._permissionService.getPermissionPoint(t.id)?.value===!1}))return!1}return!0}_permissionCheckWithFormula(e){let t=rG(this._univerInstanceService,e);if(!t)return!1;let{workbook:n,unitId:r,subUnitId:i}=t,a=e.value.f;if(a){let e=a.substring(1),t=this._definedNamesService.getValueByName(r,e);if(t){let e=t.formulaOrRefString;e.startsWith(TL.EQUALS)&&(e=e.slice(1));let r=e.split(`,`);for(let e=0;e<r.length;e++){let t=r[e],{sheetName:i,range:a}=xR(t);if(i){let e=n.getSheetBySheetName(i);if(!e)return!0;let{startRow:t,endRow:r,startColumn:s,endColumn:c}=a;for(let n=t;n<=r;n++)for(let t=s;t<=c;t++){var o;let r=e.getCell(n,t);if((r==null||(o=r.selectionProtection)==null?void 0:o[0])?.[ea.View]===!1)return!1}}}return!0}{let e=this._lexerTreeBuilder.sequenceNodesBuilder(a);if(!e)return!0;for(let t=0;t<e.length;t++){let i=e[t];if(typeof i==`string`||i.nodeType!==hz.REFERENCE)continue;let{token:a}=i,{unitId:o,sheetName:c,range:l}=mz(a),u=n;if(o&&o!==r){let e=this._univerInstanceService.getUnit(o,N.UNIVER_SHEET);if(!e)return!0;u=e}let d=c?u.getSheetBySheetName(c):u.getActiveSheet();if(!d)return!0;if(c){let e=this._permissionService.getPermissionPoint(new uX(u.getUnitId(),d.getSheetId()).id);if(!e||e.value===!1)return!1}let{startRow:f,endRow:p,startColumn:m,endColumn:h}=l;for(let e=f;e<=p;e++)for(let t=m;t<=h;t++){var s;let n=d.getCell(e,t);if((n==null||(s=n.selectionProtection)==null?void 0:s[0])?.[ea.View]===!1)return!1}}return!0}}let{range:c}=e;if(c){let e=this._rangeProtectionRuleModel.getSubunitRuleList(r,i);if(e.length===0)return!0;let t=e.filter(e=>e.ranges.some(e=>n_.intersects(e,c))).map(e=>new kY(r,i,e.permissionId).id);return this._permissionService.composePermission(t).every(e=>e.value)}return!0}_permissionCheckBySetRangeValue(e,t){let{unitId:n,subUnitId:r,value:i,range:a}=t,o=[];return o=(I.isArray(i)||uh(i))&&a?[a]:[new Mh(i).getStartEndScope()],this.permissionCheckWithRanges(e,o,n,r)}_permissionCheckByMoveRowsColsCommand(e){let t=rG(this._univerInstanceService,e);if(!t)return!1;let{worksheet:n,unitId:r,subUnitId:i}=t,{fromRange:a,toRange:o}=e;if(!this.permissionCheckWithRanges({workbookTypes:[VY],worksheetTypes:[oX,$Y],rangeTypes:[kY]},[a],r,i))return!1;let s={...o};return s.endRow===n.getRowCount()-1?s.endColumn=s.startColumn:s.endRow=s.startRow,this.permissionCheckWithRanges({workbookTypes:[VY],worksheetTypes:[oX,$Y],rangeTypes:[kY]},[s],r,i)}_permissionCheckByMoveRangeCommand(e){let{fromUnitId:t,fromSubUnitId:n,fromRange:r,toUnitId:i,toSubUnitId:a,toRange:o}=e,s=rG(this._univerInstanceService,{unitId:t,subUnitId:n});if(!s)return!1;let c=rG(this._univerInstanceService,{unitId:i,subUnitId:a});return!c||!this.permissionCheckWithRanges({workbookTypes:[VY],worksheetTypes:[oX,$Y],rangeTypes:[kY]},[r],s.unitId,s.subUnitId)?!1:this.permissionCheckWithRanges({workbookTypes:[VY],worksheetTypes:[oX,$Y],rangeTypes:[kY]},[o],c.unitId,c.subUnitId)}_permissionCheckByInsertRowColCommand(e){let t=rG(this._univerInstanceService,e);if(!t)return!1;let{worksheet:n,unitId:r,subUnitId:i}=t,{range:a,direction:o}=e,s={...a},c={workbookTypes:[VY],worksheetTypes:[$Y],rangeTypes:[kY]};if(o===L.UP||o===L.DOWN){let e=o===L.UP?a.startRow:a.startRow-1;if(e<0||e>n.getRowCount()-1)return!1;s.startRow=e,s.endRow=e,c.workbookTypes.push(WY),c.worksheetTypes.push(rX)}else if(o===L.LEFT||o===L.RIGHT){let e=o===L.LEFT?a.startColumn:a.startColumn-1;if(e<0||e>n.getColumnCount()-1)return!1;s.startColumn=e,s.endColumn=e,c.workbookTypes.push(UY),c.worksheetTypes.push(tX)}return this.permissionCheckWithRanges(c,[s],r,i)}_permissionCheckByWorksheetCommand(e,t){let n=rG(this._univerInstanceService,t);if(!n)return this._worksheetProtectionRuleModel.resetOrder(),!1;let{unitId:r}=n;return!e.some(e=>{let t=new e(r);return this._permissionService.getPermissionPoint(t.id)?.value===!1})||(this._worksheetProtectionRuleModel.resetOrder(),!1)}_permissionCheckWithInsertOrDeleteMoveRange(e,t){let n=rG(this._univerInstanceService);if(!n)return!1;let{worksheet:r,unitId:i,subUnitId:a}=n,o=t?.range??this._selectionManagerService.getCurrentLastSelection()?.range;if(!o||!this.permissionCheckWithRanges({workbookTypes:[VY],worksheetTypes:[$Y],rangeTypes:[kY]},[o],i,a))return!1;let s=this._rangeProtectionRuleModel.getSubunitRuleList(i,a);if(s.length===0)return!0;let c={...o};return e===`right`||e===`left`?c.endColumn=r.getColumnCount()-1:(e===`down`||e===`up`)&&(c.endRow=r.getRowCount()-1),!s.some(e=>e.ranges.some(e=>n_.intersects(e,c)))}};IX=dG([uG(0,z),uG(1,B),uG(2,Hb),uG(3,M(TK)),uG(4,M(xK)),uG(5,M(qq)),uG(6,M(Rb)),uG(7,M(bz)),uG(8,AR)],IX);var LX=class extends F{constructor(e,t,n,r,i){super(),this._permissionService=e,this._univerInstanceService=t,this._rangeProtectionRuleModel=n,this._worksheetProtectionRuleModel=r,this._worksheetProtectionPointModel=i,Z(this,`_unitPermissionInitStateChange`,new oo(!1)),Z(this,`unitPermissionInitStateChange$`,this._unitPermissionInitStateChange.asObservable()),this._init()}_init(){let e=e=>{let t=e.getUnitId();dX().forEach(e=>{let n=new e(t);this._permissionService.addPermissionPoint(n)})};this._univerInstanceService.getAllUnitsForType(N.UNIVER_SHEET).forEach(t=>e(t)),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(N.UNIVER_SHEET).subscribe(t=>e(t.unit))),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(N.UNIVER_SHEET).subscribe(e=>{let t=e.getUnitId();e.getSheets().forEach(e=>{let n=e.getSheetId();this._rangeProtectionRuleModel.getSubunitRuleList(t,n).forEach(e=>{[...MY()].forEach(r=>{let i=new r(t,n,e.permissionId);this._permissionService.deletePermissionPoint(i.id)})}),[...fX(),...pX()].forEach(e=>{let r=new e(t,n);this._permissionService.deletePermissionPoint(r.id)})}),dX().forEach(e=>{let n=new e(t);this._permissionService.deletePermissionPoint(n.id)}),this._rangeProtectionRuleModel.deleteUnitModel(t),this._worksheetProtectionPointModel.deleteUnitModel(t),this._worksheetProtectionRuleModel.deleteUnitModel(t)}))}changeUnitInitState(e){this._unitPermissionInitStateChange.next(e)}};LX=dG([uG(0,M(Hb)),uG(1,M(B)),uG(2,M(xK)),uG(3,M(qq)),uG(4,M(DY))],LX);var RX=class extends F{constructor(e,t,n,r,i,a,o,s,c,l){super(),this._univerInstanceService=e,this._permissionService=t,this._authzIoService=n,this._rangeProtectionRuleModel=r,this._worksheetProtectionRuleModel=i,this._userManagerService=a,this._worksheetProtectionPointRuleModel=o,this._workbookPermissionService=s,this._undoRedoService=c,this._commandService=l}initPermission(){this._initRangePermissionFromSnapshot(),this._initRangePermissionChange(),this._initWorksheetPermissionFromSnapshot(),this._initWorksheetPermissionChange(),this._initWorksheetPermissionPointsChange(),this._initWorkbookPermissionFromSnapshot(),this._initUserChange(),this._refreshPermissionByCollaCreate()}refreshRangeProtectPermission(){this._initRangePermissionFromSnapshot()}async _initRangePermissionFromSnapshot(){let e=async e=>{let t=[],n=e.getUnitId(),r=e.getSheets(),i=new Map;if(r.forEach(e=>{let r=e.getSheetId();this._rangeProtectionRuleModel.getSubunitRuleList(n,r).forEach(e=>{i.set(e.permissionId,e),t.push({objectID:e.permissionId,unitID:n,objectType:na.SelectRange,actions:NY})})}),!t.length){this._rangeProtectionRuleModel.changeRuleInitState(!0);return}this._authzIoService.batchAllowed(t).then(e=>{e.forEach(e=>{let t=i.get(e.objectID);if(t){if(!this._rangeProtectionRuleModel.getRule(n,t.subUnitId,t.id))return;MY().forEach(r=>{let i=new r(n,t.subUnitId,e.objectID),a=i.subType,o=e.actions.find(e=>e.action===a);o?.allowed!==void 0&&this._permissionService.updatePermissionPoint(i.id,o.allowed)})}}),this._rangeProtectionRuleModel.changeRuleInitState(!0)})};await Promise.all(this._univerInstanceService.getAllUnitsForType(N.UNIVER_SHEET).map(t=>e(t))),this._rangeProtectionRuleModel.changeRuleInitState(!0)}_initRangePermissionChange(){this.disposeWithMe(this._rangeProtectionRuleModel.ruleChange$.subscribe(e=>{e.type===`delete`?this._rangeProtectionRuleModel.getSubunitRuleList(e.unitId,e.subUnitId).length===0&&(this._worksheetProtectionPointRuleModel.deleteRule(e.unitId,e.subUnitId),[...pX()].forEach(t=>{let n=new t(e.unitId,e.subUnitId);this._permissionService.updatePermissionPoint(n.id,n.value)})):this._authzIoService.allowed({objectID:e.rule.permissionId,unitID:e.unitId,objectType:na.SelectRange,actions:NY}).then(t=>{this._rangeProtectionRuleModel.getRule(e.unitId,e.subUnitId,e.rule.id)&&(MY().forEach(n=>{if(e.type===`set`){let{rule:t,oldRule:n}=e;if(t.permissionId===n?.permissionId)return}let r=e.rule,i=new n(r.unitId,r.subUnitId,r.permissionId),a=i.subType,o=t.find(e=>e.action===a);o&&this._permissionService.updatePermissionPoint(i.id,o.allowed)}),this._rangeProtectionRuleModel.ruleRefresh(e.rule.permissionId))})}))}async initWorkbookPermissionChange(e){let t=e||this._univerInstanceService.getCurrentUnitOfType(N.UNIVER_SHEET)?.getUnitId();if(t)return this._authzIoService.allowed({objectID:t,objectType:na.Workbook,unitID:t,actions:Ugt}).then(e=>{dX().forEach(n=>{let r=new n(t),i=r.subType,a=e.find(e=>e.action===i);a&&this._permissionService.updatePermissionPoint(r.id,a.allowed)})})}async _initWorkbookPermissionFromSnapshot(){await Promise.all(this._univerInstanceService.getAllUnitsForType(N.UNIVER_SHEET).map(e=>this.initWorkbookPermissionChange(e.getUnitId()))),this._workbookPermissionService.changeUnitInitState(!0)}_initWorksheetPermissionChange(){this.disposeWithMe(this._worksheetProtectionRuleModel.ruleChange$.subscribe(e=>{e.type===`delete`?([...fX(),...pX()].forEach(t=>{let n=new t(e.unitId,e.subUnitId);this._permissionService.updatePermissionPoint(n.id,!0)}),this._worksheetProtectionPointRuleModel.deleteRule(e.unitId,e.subUnitId)):this._authzIoService.allowed({objectID:e.rule.permissionId,unitID:e.unitId,objectType:na.Worksheet,actions:NY}).then(t=>{let n=this._worksheetProtectionRuleModel.getRule(e.unitId,e.subUnitId);n&&n.permissionId===e.rule.permissionId&&(fX().forEach(n=>{let r=new n(e.unitId,e.subUnitId),i=r.subType,a=t.find(e=>e.action===i);a&&this._permissionService.updatePermissionPoint(r.id,a.allowed)}),this._worksheetProtectionRuleModel.ruleRefresh(e.rule.permissionId))})}))}_initWorksheetPermissionPointsChange(){this.disposeWithMe(this._worksheetProtectionPointRuleModel.pointChange$.subscribe(e=>{this._authzIoService.allowed({objectID:e.permissionId,unitID:e.unitId,objectType:na.Worksheet,actions:mX}).then(t=>{let n=this._worksheetProtectionPointRuleModel.getRule(e.unitId,e.subUnitId);n&&n.permissionId===e.permissionId&&pX().forEach(n=>{let r=new n(e.unitId,e.subUnitId),i=r.subType,a=t.find(e=>e.action===i);a&&this._permissionService.updatePermissionPoint(r.id,a.allowed)})})}))}async _initWorksheetPermissionFromSnapshot(){let e=async e=>{let t=[],n=e.getUnitId(),r=e.getSheets(),i=new Map;if(r.forEach(e=>{let r=e.getSheetId(),a=this._worksheetProtectionRuleModel.getRule(n,r);a&&(i.set(a.permissionId,a),t.push({objectID:a.permissionId,unitID:n,objectType:na.Worksheet,actions:NY}));let o=this._worksheetProtectionPointRuleModel.getRule(n,r);o&&(i.set(o.permissionId,o),t.push({objectID:o.permissionId,unitID:n,objectType:na.Worksheet,actions:mX}))}),!t.length){this._worksheetProtectionRuleModel.changeRuleInitState(!0);return}this._authzIoService.batchAllowed(t).then(e=>{e.forEach(e=>{let t=i.get(e.objectID);if(t){let r=this._worksheetProtectionRuleModel.getRule(n,t.subUnitId)||this._worksheetProtectionPointRuleModel.getRule(n,t.subUnitId);if(!r||r.permissionId!==e.objectID)return;[...fX(),...pX()].forEach(r=>{let i=new r(n,t.subUnitId),a=i.subType,o=e.actions.find(e=>e.action===a);o?.allowed!==void 0&&this._permissionService.updatePermissionPoint(i.id,o.allowed)})}}),this._worksheetProtectionRuleModel.changeRuleInitState(!0)})};await Promise.all(this._univerInstanceService.getAllUnitsForType(N.UNIVER_SHEET).map(t=>e(t))),this._worksheetProtectionRuleModel.changeRuleInitState(!0)}_initUserChange(){this.disposeWithMe(this._userManagerService.currentUser$.pipe(ic(1)).subscribe(()=>{let e=this._permissionService.getAllPermissionPoint();this._permissionService.clearPermissionMap(),this._worksheetProtectionRuleModel.changeRuleInitState(!1),this._univerInstanceService.getAllUnitsForType(N.UNIVER_SHEET).forEach(t=>{let n=t.getUnitId();dX().forEach(t=>{let r=new t(n);e.has(r.id)&&(r=e.get(r.id)),this._permissionService.addPermissionPoint(r)}),t.getSheets().forEach(t=>{let r=t.getSheetId();[...fX(),...pX()].forEach(t=>{let i=new t(n,r);e.has(i.id)&&(i=e.get(i.id)),this._permissionService.addPermissionPoint(i)}),this._rangeProtectionRuleModel.getSubunitRuleList(n,r).forEach(t=>{MY().forEach(i=>{let a=new i(n,r,t.permissionId);e.has(a.id)&&(a=e.get(a.id)),this._permissionService.addPermissionPoint(a)})})}),this._initWorkbookPermissionFromSnapshot(),this._initWorksheetPermissionFromSnapshot(),this._initRangePermissionFromSnapshot()})}))}refreshPermission(e,t){let n=this._worksheetProtectionRuleModel.getTargetByPermissionId(e,t),r=!1;if(n){let[i,a]=n;this._authzIoService.allowed({objectID:t,unitID:e,objectType:na.Worksheet,actions:NY}).then(n=>{if(!this._worksheetProtectionRuleModel.getTargetByPermissionId(e,t))return;let i=``;fX().forEach(t=>{let o=new t(e,a),s=o.subType,c=n.find(e=>e.action===s);c&&(this._permissionService.getPermissionPoint(o.id)?.value!==c.allowed&&(r=!0),this._permissionService.updatePermissionPoint(o.id,c.allowed),i+=`${c.action}_${c.allowed}`)}),this._worksheetProtectionRuleModel.ruleRefresh(`${t}_${i}`),r&&this._undoRedoService.clearUndoRedo(e)})}let i=this._worksheetProtectionPointRuleModel.getTargetByPermissionId(e,t);if(i){let[n,a]=i;this._authzIoService.allowed({objectID:t,unitID:e,objectType:na.Worksheet,actions:mX}).then(n=>{this._worksheetProtectionPointRuleModel.getTargetByPermissionId(e,t)&&(pX().forEach(t=>{let i=new t(e,a),o=i.subType,s=n.find(e=>e.action===o);s&&(this._permissionService.getPermissionPoint(i.id)?.value!==s.allowed&&(r=!0),this._permissionService.updatePermissionPoint(i.id,s.allowed))}),r&&this._undoRedoService.clearUndoRedo(e))})}let a=this._rangeProtectionRuleModel.getTargetByPermissionId(e,t);if(a){let[n,i]=a;this._authzIoService.allowed({objectID:t,unitID:e,objectType:na.SelectRange,actions:NY}).then(n=>{if(!this._rangeProtectionRuleModel.getTargetByPermissionId(e,t))return;let a=``;MY().forEach(o=>{let s=new o(e,i,t),c=s.subType,l=n.find(e=>e.action===c);l&&(this._permissionService.getPermissionPoint(s.id)?.value!==l.allowed&&(r=!0),this._permissionService.updatePermissionPoint(s.id,l.allowed),a+=`${l.action}_${l.allowed}`)}),this._rangeProtectionRuleModel.ruleRefresh(`${t}_${a}`),r&&this._undoRedoService.clearUndoRedo(e)})}}_refreshPermissionByCollaCreate(){this.disposeWithMe(this._commandService.onCommandExecuted((e,t)=>{if(t?.fromCollab&&(e.id===CK.id||e.id===Jq.id||e.id===gX.id)){let t=e.params;this._undoRedoService.clearUndoRedo(t.unitId)}}))}};RX=dG([uG(0,B),uG(1,Hb),uG(2,ky),uG(3,M(xK)),uG(4,M(qq)),uG(5,M(Dy)),uG(6,M(DY)),uG(7,M(LX)),uG(8,M($b)),uG(9,M(z))],RX);var zX=class extends F{constructor(e,t,n){super(),this._commandService=e,this._sheetRangeThemeModel=t,this._univerInstanceService=n,Z(this,`_zebraCacheUpdateSubject`,new io),this._init()}_init(){this._initializeCommandListener(),this._initTriggerCacheUpdateListener()}updateZebraCrossingCache(e,t){this._zebraCacheUpdateSubject.next({unitId:e,subUnitId:t})}_initializeCommandListener(){this.disposeWithMe(this._commandService.onCommandExecuted(e=>{let{id:t}=e,n,r;switch(t){case CG.id:{let t=e.params;n=t.unitId,r=t.subUnitId}break;case KG.id:{let t=e.params;n=t.unitId,r=t.subUnitId}break;case qG.id:{let t=e.params;n=t.unitId,r=t.subUnitId}break;case kG.id:{let t=e.params;n=t.unitId,r=t.subUnitId}break;case tK.id:{let t=e.params;n=t.unitId,r=t.subUnitId}}n&&r&&(this._sheetRangeThemeModel.refreshSheetRowVisibleFuncSet(n,r),this._sheetRangeThemeModel.refreshZebraCrossingCacheBySheet(n,r))}))}_initTriggerCacheUpdateListener(){this.disposeWithMe(this._zebraCacheUpdateSubject.subscribe(({unitId:e,subUnitId:t})=>{this._sheetRangeThemeModel.refreshSheetRowVisibleFuncSet(e,t),this._sheetRangeThemeModel.refreshZebraCrossingCacheBySheet(e,t)}))}};zX=dG([uG(0,M(z)),uG(1,M(yG)),uG(2,M(B))],zX);var BX=class{constructor(e,t){this._selectionProtectionRuleModel=e,this._permissionService=t,Z(this,`_cache`,new Bg(1e4)),this._init()}_init(){this._permissionService.permissionPointUpdate$.pipe(Is(e=>e.type===na.SelectRange),Is(e=>MY().some(t=>e instanceof t)),as(e=>e)).subscribe(e=>{let t=this._selectionProtectionRuleModel.getSubunitRuleList(e.unitId,e.subUnitId);for(let n of t)n.permissionId===e.permissionId&&n.ranges.forEach(t=>{Kg.foreach(t,(t,n)=>{let r=this._createKey(e.unitId,e.subUnitId,t,n);this._cache.delete(r)})})}),this._selectionProtectionRuleModel.ruleChange$.subscribe(e=>{if(e.rule.ranges.forEach(t=>{Kg.foreach(t,(t,n)=>{let r=this._createKey(e.unitId,e.subUnitId,t,n);this._cache.delete(r)})}),e.type===`set`){var t;(t=e.oldRule)==null||t.ranges.forEach(t=>{Kg.foreach(t,(t,n)=>{let r=this._createKey(e.unitId,e.subUnitId,t,n);this._cache.delete(r)})})}})}_createKey(e,t,n,r){return`${e}_${t}_${n}_${r}`}getCellInfo(e,t,n,r){let i=this._selectionProtectionRuleModel.getSubunitRuleList(e,t),a=[];if(!i||!i.length)return a;let o=this._createKey(e,t,n,r),s=this._cache.get(o);if(s)return s;let c=[];for(let a of i)if(a.ranges.some(e=>e.startRow<=n&&e.endRow>=n&&e.startColumn<=r&&e.endColumn>=r)){let n=MY().reduce((n,r)=>{let i=new r(e,t,a.permissionId),o=this._permissionService.getPermissionPoint(i.id);return n[i.subType]=o?.value??i.value,n},{});c.push({...n,ruleId:a.id,ranges:a.ranges})}return this._cache.set(o,c),c}clear(){this._cache.clear()}};BX=dG([uG(0,M(xK)),uG(1,M(Hb))],BX);var VX=class extends F{constructor(e,t,n){super(),this._ruleModel=e,this._permissionService=t,this._univerInstanceService=n,Z(this,`_cellRuleCache`,new Map),Z(this,`_permissionIdCache`,new Map),Z(this,`_cellInfoCache`,new Map),Z(this,`_rowInfoCache`,new Map),Z(this,`_colInfoCache`,new Map),this._initUpdateCellRuleCache(),this._initUpdateCellInfoCache(),this._initUpdateRowColInfoCache(),this._initCache()}_initCache(){this._univerInstanceService.getAllUnitsForType(N.UNIVER_SHEET).forEach(e=>{e.getSheets().forEach(t=>{let n=e.getUnitId(),r=t.getSheetId();this.reBuildCache(n,r)})})}_initUpdateCellInfoCache(){this.disposeWithMe(this._permissionService.permissionPointUpdate$.pipe(Is(e=>e.type===na.SelectRange),as(e=>e)).subscribe(e=>{let{subUnitId:t,unitId:n,permissionId:r}=e,i=this._permissionIdCache.get(r);if(!i)return;let a=this._ruleModel.getRule(n,t,i);if(!a)return;let o=this._ensureCellInfoMap(n,t);a.ranges.forEach(e=>{let{startRow:t,endRow:n,startColumn:r,endColumn:i}=e;for(let e=t;e<=n;e++)for(let t=r;t<=i;t++)o.delete(`${e}-${t}`)})})),this.disposeWithMe(this._ruleModel.ruleChange$.subscribe(e=>{let{unitId:t,subUnitId:n}=e,r=this._ensureCellInfoMap(t,n);if(e.rule.ranges.forEach(e=>{Kg.foreach(e,(e,t)=>{r.delete(`${e}-${t}`)})}),e.type===`set`){var i;(i=e.oldRule)==null||i.ranges.forEach(e=>{Kg.foreach(e,(e,t)=>{this._cellInfoCache.delete(`${e}-${t}`)})})}}))}_initUpdateCellRuleCache(){this.disposeWithMe(this._ruleModel.ruleChange$.subscribe(e=>{let{type:t}=e;t===`add`?this._addCellRuleCache(e):t===`delete`?this._deleteCellRuleCache(e):(this._deleteCellRuleCache({...e,rule:e.oldRule}),this._addCellRuleCache(e))}))}_ensureRuleMap(e,t){let n=this._cellRuleCache.get(e);n||(n=new Map,this._cellRuleCache.set(e,n));let r=n.get(t);return r||(r=new Map,n.set(t,r)),r}_ensureCellInfoMap(e,t){let n=this._cellInfoCache.get(e);n||(n=new Map,this._cellInfoCache.set(e,n));let r=n.get(t);return r||(r=new Map,n.set(t,r)),r}_ensureRowColInfoMap(e,t,n){let r=n===`row`?this._rowInfoCache.get(e):this._colInfoCache.get(e);r||(r=new Map,n===`row`?this._rowInfoCache.set(e,r):this._colInfoCache.set(e,r));let i=r.get(t);return i||(i=new Map,r.set(t,i)),i}_addCellRuleCache(e){let{subUnitId:t,unitId:n,rule:r}=e,i=this._ensureRuleMap(n,t);r.ranges.forEach(e=>{let{startRow:t,endRow:n,startColumn:a,endColumn:o}=e;for(let e=t;e<=n;e++)for(let t=a;t<=o;t++)i.set(`${e}-${t}`,r.id)}),this._permissionIdCache.set(r.permissionId,r.id)}_deleteCellRuleCache(e){let{subUnitId:t,unitId:n,rule:r}=e,i=this._ensureRuleMap(n,t),a=this._ensureCellInfoMap(n,t);r.ranges.forEach(e=>{let{startRow:t,endRow:n,startColumn:r,endColumn:o}=e;for(let e=t;e<=n;e++)for(let t=r;t<=o;t++)i.delete(`${e}-${t}`),a.delete(`${e}-${t}`)}),this._permissionIdCache.delete(r.permissionId)}_getSelectionActions(e,t,n){let r=this._permissionService.getPermissionPoint(new kY(e,t,n.permissionId)?.id)?.value??!1,i=this._permissionService.getPermissionPoint(new jY(e,t,n.permissionId)?.id)?.value??!1,a=this._permissionService.getPermissionPoint(new AY(e,t,n.permissionId)?.id)?.value??!1,o=this._permissionService.getPermissionPoint(new OY(e,t,n.permissionId)?.id)?.value??!1;return{[ea.Edit]:r,[ea.View]:i,[ea.ManageCollaborator]:a,[ea.Delete]:o}}reBuildCache(e,t){let n=this._ensureRuleMap(e,t),r=this._ensureCellInfoMap(e,t);n.clear(),r.clear();let i=this._ensureRowColInfoMap(e,t,`row`),a=this._ensureRowColInfoMap(e,t,`col`);i.clear(),a.clear(),this._ruleModel.getSubunitRuleList(e,t).forEach(o=>{let s=this._getSelectionActions(e,t,o),c={...s,ruleId:o.id,ranges:o.ranges};o.ranges.forEach(e=>{let{startRow:t,endRow:l,startColumn:u,endColumn:d}=e;for(let e=t;e<=l;e++){let t=i.get(`${e}`);t?t.set(o.id,s):i.set(`${e}`,new Map([[o.id,s]]));for(let t=u;t<=d;t++){n.set(`${e}-${t}`,o.id),r.set(`${e}-${t}`,c);let i=a.get(`${t}`);i?i.set(o.id,s):a.set(`${t}`,new Map([[o.id,s]]))}}}),this._permissionIdCache.set(o.permissionId,o.id)})}getRowPermissionInfo(e,t,n,r){let i=this._rowInfoCache.get(e)?.get(t);if(!i)return!0;let a=i.get(`${n}`);return!a||r.every(e=>{for(let t of a.values())if(t[e]===!1)return!1;return!0})}getColPermissionInfo(e,t,n,r){let i=this._colInfoCache.get(e)?.get(t);if(!i)return!0;let a=i.get(`${n}`);return!a||r.every(e=>{for(let t of a.values())if(t[e]===!1)return!1;return!0})}_initUpdateRowColInfoCache(){this.disposeWithMe(this._permissionService.permissionPointUpdate$.pipe(Is(e=>e.type===na.SelectRange),as(e=>e)).subscribe({next:e=>{let{subUnitId:t,unitId:n,permissionId:r}=e,i=this._permissionIdCache.get(r);if(!i)return;let a=this._ruleModel.getRule(n,t,i);if(!a)return;let o=this._ensureRowColInfoMap(n,t,`row`),s=this._ensureRowColInfoMap(n,t,`col`),c=this._getSelectionActions(n,t,a);a.ranges.forEach(e=>{let{startRow:t,endRow:n,startColumn:r,endColumn:a}=e;for(let e=t;e<=n;e++){let t=o.get(`${e}`);t?t.set(i,c):o.set(`${e}`,new Map([[i,c]]));for(let e=r;e<=a;e++){let t=s.get(`${e}`);t?t.set(i,c):s.set(`${e}`,new Map([[i,c]]))}}})}})),this.disposeWithMe(this._ruleModel.ruleChange$.subscribe(e=>{if(e.type===`delete`){let{unitId:t,subUnitId:n,rule:r}=e,i=this._ensureRowColInfoMap(t,n,`row`),a=this._ensureRowColInfoMap(t,n,`col`);r.ranges.forEach(e=>{let{startRow:t,endRow:n,startColumn:o,endColumn:s}=e;for(let e=t;e<=n;e++){i.get(`${e}`)?.delete(r.id);for(let e=o;e<=s;e++)a.get(`${e}`)?.delete(r.id)}})}}))}getCellInfo(e,t,n,r){var i;let a=this._ensureCellInfoMap(e,t),o=a.get(`${n}-${r}`);if(o)return o;let s=(i=this._cellRuleCache.get(e))==null||(i=i.get(t))==null?void 0:i.get(`${n}-${r}`);if(!s)return;let c=this._ruleModel.getRule(e,t,s);if(c){let i={...this._getSelectionActions(e,t,c),ruleId:s,ranges:c.ranges};return a.set(`${n}-${r}`,i),i}}deleteUnit(e){this._cellRuleCache.delete(e),this._cellInfoCache.delete(e),this._rowInfoCache.delete(e),this._colInfoCache.delete(e),this._univerInstanceService.getUnit(e)?.getSheets().forEach(t=>{let n=t.getSheetId();this._ruleModel.getSubunitRuleList(e,n).forEach(e=>{this._permissionIdCache.delete(e.permissionId)})})}};VX=dG([uG(0,M(xK)),uG(1,M(Hb)),uG(2,M(B))],VX);var m_t=`@univerjs/sheets`,h_t=`0.25.1`,HX=class extends F{constructor(e,t){super(),this._commandService=e,this._univerInstanceService=t,Z(this,`_previousSheetIndex`,-1),this.disposeWithMe(this._commandService.beforeCommandExecuted(e=>{if(e.id===dq.id)return this._beforeAdjustActiveSheetOnRemoveSheet(e)})),this.disposeWithMe(this._commandService.onCommandExecuted((e,t)=>{if(e.id===dq.id)return this._adjustActiveSheetOnRemoveSheet(e);if(e.id===xY.id&&e.params.hidden)return this._adjustActiveSheetOnHideSheet(e);if(t?.fromCollab)return!1;if(e.id===LJ.id)return this._adjustActiveSheetOnInsertSheet(e);if(e.id===xY.id&&!e.params.hidden)return this._adjustActiveSheetOnShowSheet(e);if(e.id===VK.id)return this._adjustActiveSheetOnSelection(e)}))}_adjustActiveSheetOnHideSheet(e){let{unitId:t,subUnitId:n}=e.params,r=this._univerInstanceService.getUniverSheetInstance(t);if(!r||r.getActiveSheet()?.getSheetId()!==n)return;let i=g_t(r,r.getActiveSheetIndex());this._switchToNextSheet(t,i)}_beforeAdjustActiveSheetOnRemoveSheet(e){let{unitId:t,subUnitId:n}=e.params,r=this._univerInstanceService.getUniverSheetInstance(t);if(!r)return;let i=r.getSheetBySheetId(n);i&&(this._previousSheetIndex=r.getSheetIndex(i))}_adjustActiveSheetOnRemoveSheet(e){if(this._previousSheetIndex===-1)return;let{unitId:t}=e.params,n=this._univerInstanceService.getUniverSheetInstance(t);if(n&&n.getActiveSheet().getSheetId()===e.params.subUnitId){let e=this._previousSheetIndex,r=g_t(n,e>=1?e-1:0);this._switchToNextSheet(t,r)}}_adjustActiveSheetOnInsertSheet(e){let{unitId:t,sheet:n}=e.params;this._switchToNextSheet(t,n.id)}_adjustActiveSheetOnShowSheet(e){let{unitId:t,subUnitId:n}=e.params;this._switchToNextSheet(t,n)}_adjustActiveSheetOnSelection(e){let{unitId:t,subUnitId:n}=e.params;n!==this._univerInstanceService.getUnit(t)?.getActiveSheet().getSheetId()&&this._switchToNextSheet(t,n)}_switchToNextSheet(e,t){this._commandService.executeCommand(aK.id,{unitId:e,subUnitId:t})}};HX=dG([uG(0,z),uG(1,B)],HX);function g_t(e,t){let n=e.getSheetSize();for(let n=t;n>-1;n--){let t=e.getSheetByIndex(n);if(!t.getConfig().hidden)return t.getSheetId()}for(let r=t;r<n;r++){let t=e.getSheetByIndex(r);if(!t.getConfig().hidden)return t.getSheetId()}throw Error(`[ActiveWorksheetController]: could not find the next unhidden sheet! Collaboration error perhaps.`)}var __t=`ONLY_REGISTER_FORMULA_RELATED_MUTATIONS_KEY`,UX=class extends F{constructor(e,t,n){super(),this._commandService=e,this._configService=t,this._dataSyncPrimaryController=n,[WG,TG,CG,LJ,EG,DG,OG,AG,kG,dq,MG,CX,oG,wgt,CY,SX,NG,e_t,qG,KG,kX,AX,Zht,QG,XG,OX].forEach(e=>{var t;this._commandService.registerCommand(e),(t=this._dataSyncPrimaryController)==null||t.registerSyncingMutations(e)}),(this._configService.getConfig(`ONLY_REGISTER_FORMULA_RELATED_MUTATIONS_KEY`)??!1)||[Vq,Hq,Uq,Wq,Qmt,jK,NJ,MK,RJ,GK,KK,yY,_X,omt,nq,rq,iq,tq,eq,qK,JK,imt,ZK,$K,QK,XK,YK,VJ,pq,HK,fq,oq,uq,lq,sq,KJ,mq,Bq,oJ,eht,aJ,ZJ,hgt,XJ,pgt,mgt,tY,FG,IG,bY,QJ,PG,aY,iY,oY,cJ,uY,WK,vX,mY,dY,GG,eY,pY,$J,fY,Zq,gY,hY,iJ,uJ,lJ,sJ,_Y,vY,aK,SY,xY,wY,EY,TY,rK,tK,yX,nK,YG,Jgt,Dgt,Kpt,VK,jX,BJ,GJ,nY,bX,DX,iK,sY,LG,EX,Kgt,Jq,lY,Yq,gX,Rpt,ygt,igt,Xq,zJ,qgt,CK,SK,cY,Zgt,ZG,Ogt,Ygt,xG,bG,WJ,UJ,Qgt,ogt,Zmt,agt,$gt,n_t,t_t,jJ,Jht,Yht,MJ,HJ].forEach(e=>this.disposeWithMe(this._commandService.registerCommand(e))),this._configService.setConfig(l_t,u_t)}};UX=dG([uG(0,z),uG(1,Om),uG(2,ye(gL))],UX);var WX=class extends F{constructor(e,t){super(),this._univerInstanceService=e,this._commandService=t,this._initialize()}_initialize(){this.disposeWithMe(this._commandService.onCommandExecuted(e=>{if(e.id!==VR.id)return;let{unitData:t}=e.params,n=Object.keys(t),r=[];for(let e=0;e<n.length;e++){let i=n[e],a=t[i];if(a==null)continue;let o=Object.keys(a);for(let e=0;e<o.length;e++){let t=o[e],n=a[t];if(n==null)continue;let s={subUnitId:t,unitId:i,cellValue:this._getMergedCellData(i,t,n)};r.push({id:WG.id,params:s})}}return Bm(r,this._commandService,{onlyLocal:!0,fromFormula:!0,applyFormulaCalculationResult:!0})}))}_getMergedCellData(e,t,n){let r=this._univerInstanceService.getUniverSheetInstance(e),i=r?.getStyles(),a=(r?.getSheetBySheetId(t))?.getCellMatrix(),o=new Mh(n);return o.forValue((e,t,n)=>{let r=$5e(a?.getValue(e,t),n,i);o.setValue(e,t,r)}),o.getMatrix()}};WX=dG([uG(0,M(B)),uG(1,z)],WX);var GX=class extends F{constructor(e){super(),this._sheetInterceptorService=e,this._initialize()}_initialize(){this._initInterceptorCellContent()}_initInterceptorCellContent(){this.disposeWithMe(this._sheetInterceptorService.intercept(sG.CELL_CONTENT,{priority:11,effect:bf.Value|bf.Style,handler:(e,t,n)=>{var r;if(!e)return n(e);let i=t.workbook.getStyles().getStyleByCell(e);return vh(i==null||(r=i.n)==null?void 0:r.pattern)&&e?.t===Mp.NUMBER&&e.v!==void 0&&e.v!==null&&Tg(e.v)?((!e||e===t.rawData)&&(e={...t.rawData}),e.v=Bz(Number(e.v)),n(e)):n(e)}}))}};GX=dG([uG(0,M(hG))],GX);var KX=class extends F{constructor(e,t,n,r){super(),this._permissionService=e,this._worksheetProtectionRuleModel=t,this._sheetInterceptorService=n,this._rangeProtectionCache=r,this._initViewModelByRangeInterceptor(),this._initViewModelBySheetInterceptor()}_initViewModelByRangeInterceptor(){this.disposeWithMe(this._sheetInterceptorService.intercept(sG.CELL_CONTENT,{priority:999,effect:bf.Value|bf.Style,handler:(e,t,n)=>{let{unitId:r,subUnitId:i,row:a,col:o}=t,s=this._rangeProtectionCache.getCellInfo(r,i,a,o);if(s){let r=s[ea.View]===!1,i=!e||e===t.rawData?{...t.rawData}:e;return i.selectionProtection=[s],r?(delete i.s,delete i.v,delete i.p,i):n(i)}return n(e)}}))}_initViewModelBySheetInterceptor(){this.disposeWithMe(this._sheetInterceptorService.intercept(sG.CELL_CONTENT,{priority:999,effect:bf.Value|bf.Style,handler:(e,t,n)=>{let{unitId:r,subUnitId:i}=t;if(this._worksheetProtectionRuleModel.getRule(r,i)?.permissionId){let a=[{[ea.View]:this._permissionService.getPermissionPoint(new uX(r,i).id)?.value??!1,[ea.Edit]:this._permissionService.getPermissionPoint(new $Y(r,i).id)?.value??!1}],o=!a[0]?.[ea.View],s=!e||e===t.rawData?{...e}:e;return s.hasWorksheetRule=!0,s.selectionProtection=a,o?(delete s.s,delete s.v,delete s.p,s):n(s)}return n(e)}}))}};KX=dG([uG(0,Hb),uG(1,M(qq)),uG(2,M(hG)),uG(3,M(VX))],KX);var qX=se(`univer.exclusive-range.service`),v_t=class extends F{constructor(...e){super(...e),Z(this,`_exclusiveRanges`,new Map),Z(this,`_exclusiveRangesChange$`,new io),Z(this,`exclusiveRangesChange$`,this._exclusiveRangesChange$.asObservable())}_ensureUnitMap(e){return this._exclusiveRanges.has(e)||this._exclusiveRanges.set(e,new Map),this._exclusiveRanges.get(e)}_ensureSubunitMap(e,t){let n=this._ensureUnitMap(e);return n.has(t)||n.set(t,new Map),n.get(t)}_ensureFeature(e,t,n){let r=this._ensureSubunitMap(e,t);return r.has(n)||r.set(n,[]),r.get(n)}addExclusiveRange(e,t,n,r){let i=this._ensureFeature(e,t,n);i.push(...r),this._exclusiveRangesChange$.next({unitId:e,subUnitId:t,ranges:i.map(e=>e.range)})}getExclusiveRanges(e,t,n){var r;return(r=this._exclusiveRanges.get(e))==null||(r=r.get(t))==null?void 0:r.get(n)}clearExclusiveRanges(e,t,n){let r=this.getExclusiveRanges(e,t,n);this._exclusiveRangesChange$.next({unitId:e,subUnitId:t,ranges:r?.map(e=>e.range)||[]}),this._ensureFeature(e,t,n),this._exclusiveRanges.get(e).get(t).set(n,[])}clearExclusiveRangesByGroupId(e,t,n,r){let i=this.getExclusiveRanges(e,t,n);this._exclusiveRangesChange$.next({unitId:e,subUnitId:t,ranges:i?.map(e=>e.range)||[]});let a=this.getExclusiveRanges(e,t,n);if(a){let i=a.filter(e=>e.groupId!==r);this._exclusiveRanges.get(e).get(t).set(n,i)}}getInterestGroupId(e){let t=[];return e.forEach(e=>{let n=e.range,{unitId:r,sheetId:i}=n;if(!r||!i)return;let a=this._exclusiveRanges.get(r)?.get(i);if(a)for(let e of a.keys()){let r=a.get(e);if(r){for(let i of r)if(n_.intersects(n,i.range)){t.push(e);break}}}}),t}},JX=class extends F{constructor(e,t,n){super(),this._resourceManagerService=e,this._univerInstanceService=t,this._logService=n}getValue(e,t,n,r){let i=this._univerInstanceService.getUniverSheetInstance(e);if(!i)return;let a=i?.getSheetBySheetId(t);if(!a)return;let o=i.getStyles(),s=a.getCellRaw(n,r);if(s?.s){let e=o.get(s.s);if(e?.n)return e.n}return null}deleteValues(e,t,n){let r=this._univerInstanceService.getUniverSheetInstance(e);if(!r)return;let i=r?.getSheetBySheetId(t);if(!i)return;let a=r.getStyles();n.forEach(e=>{Kg.foreach(e,(e,t)=>{let n=i.getCellRaw(e,t);if(!n)return;let r=n?.s,o={...r&&a.get(r)||{}};delete o.n,n.s=a.setValue(o)})})}setValues(e,t,n){let r=this._univerInstanceService.getUniverSheetInstance(e);if(!r)return;let i=r?.getSheetBySheetId(t);if(!i)return;let a=r.getStyles(),o=i.getCellMatrix();n.forEach(e=>{e.ranges.forEach(t=>{Kg.foreach(t,(t,n)=>{let r=i.getCellRaw(t,n);if(r){let t={...a.getStyleByCell(r)||{},n:{pattern:e.pattern}};r.s=a.setValue(t)}else{let r={n:{pattern:e.pattern}},i=a.setValue(r);i&&o.setValue(t,n,{s:i})}})})})}};JX=dG([uG(0,wy),uG(1,B),uG(2,Nm)],JX);var y_t=[TG.id,CG.id,AG.id,kG.id],b_t=[DG.id,OG.id],YX=class extends F{constructor(e,t,n,r,i,a,o,s){super(),this._selectionProtectionRuleModel=e,this._univerInstanceService=t,this._commandService=n,this._refRangeService=r,this._selectionProtectionRenderModel=i,this._rangeProtectionCache=a,this._sheetInterceptorService=o,this._rangeProtectionRuleModel=s,Z(this,`disposableCollection`,new Uf),this._onRefRangeChange(),this._correctPermissionRange(),this._initReBuildCache(),this._initRemoveSheet()}_onRefRangeChange(){let e=(e,t)=>{let n=this._univerInstanceService.getCurrentUnitOfType(N.UNIVER_SHEET);if(!n||!n?.getSheetBySheetId(t))return;this.disposableCollection.dispose();let r=n=>this.refRangeHandle(n,e,t);this._selectionProtectionRuleModel.getSubunitRuleList(e,t).reduce((e,t)=>[...e,...t.ranges],[]).forEach(n=>{this.disposableCollection.add(this._refRangeService.registerRefRange(n,r,e,t))})};this.disposeWithMe(this._commandService.onCommandExecuted(t=>{if(t.id===vY.id){let n=t.params,r=n.subUnitId,i=n.unitId;if(!r||!i)return;e(i,r)}if(t.id===cY.id||t.id===CK.id){let n=t.params,r=n.subUnitId,i=n.unitId;if(!r||!i)return;e(i,r)}}));let t=this._univerInstanceService.getCurrentUnitOfType(N.UNIVER_SHEET);if(t){let n=t.getActiveSheet();if(!n)return;e(t.getUnitId(),n.getSheetId())}}refRangeHandle(e,t,n){switch(e.id){case fq.id:return this._getRefRangeMutationsByMoveRows(e.params,t,n);case pq.id:return this._getRefRangeMutationsByMoveCols(e.params,t,n);case YK.id:return this._getRefRangeMutationsByInsertRows(e.params,t,n);case eq.id:return this._getRefRangeMutationsByInsertCols(e.params,t,n);case uq.id:return this._getRefRangeMutationsByDeleteCols(e.params,t,n);case sq.id:return this._getRefRangeMutationsByDeleteRows(e.params,t,n)}return{redos:[],undos:[]}}_getRefRangeMutationsByDeleteCols(e,t,n){let r=this._selectionProtectionRuleModel.getSubunitRuleList(t,n).filter(t=>t.ranges.some(t=>n_.intersects(t,e.range))),i=e.range;if(r.length){let e=[],a=[];return r.forEach(r=>{let o=I.deepClone(r);o.ranges=o.ranges.reduce((e,t)=>{if(n_.intersects(t,i)){let n=I.deepClone(t),{startColumn:r,endColumn:a}=i;if(r<=n.startColumn&&a>=n.endColumn)return e;r>=n.startColumn&&a<=n.endColumn?n.endColumn-=a-r+1:r<n.startColumn?(n.startColumn=r,n.endColumn-=a-r+1):a>n.endColumn&&(n.endColumn=r-1),this._checkIsRightRange(n)&&e.push(n)}return e},[]),o.ranges.length?(e.push({id:cY.id,params:{unitId:t,subUnitId:n,rule:o,ruleId:r.id}}),a.push({id:cY.id,params:{unitId:t,subUnitId:n,rule:r,ruleId:r.id}})):(e.push({id:SK.id,params:{unitId:t,subUnitId:n,ruleIds:[r.id]}}),a.push({id:CK.id,params:{unitId:t,subUnitId:n,name:``,rules:[r]}}))}),{redos:e,undos:a}}return{undos:[],redos:[]}}_getRefRangeMutationsByDeleteRows(e,t,n){let r=this._selectionProtectionRuleModel.getSubunitRuleList(t,n).filter(t=>t.ranges.some(t=>n_.intersects(t,e.range))),i=e.range;if(r.length){let e=[],a=[];return r.forEach(r=>{let o=I.deepClone(r);o.ranges=o.ranges.reduce((e,t)=>{if(n_.intersects(t,i)){let n=I.deepClone(t),{startRow:r,endRow:a}=i;if(r<=n.startRow&&a>=n.endRow)return e;r>=n.startRow&&a<=n.endRow?n.endRow-=a-r+1:r<n.startRow?(n.startRow=r,n.endRow-=a-r+1):a>n.endRow&&(n.endRow=r-1),this._checkIsRightRange(n)&&e.push(n)}return e},[]),e.push({id:cY.id,params:{unitId:t,subUnitId:n,rule:o,ruleId:r.id}}),a.push({id:cY.id,params:{unitId:t,subUnitId:n,rule:r,ruleId:r.id}})}),{redos:e,undos:a}}return{undos:[],redos:[]}}_getRefRangeMutationsByInsertCols(e,t,n){let r=e.range.startColumn,i=e.range.endColumn-e.range.startColumn+1,a=this._selectionProtectionRuleModel.getSubunitRuleList(t,n).filter(e=>e.ranges.some(e=>r>e.startColumn&&r<=e.endColumn));if(a.length){let e=[],o=[];return a.forEach(a=>{let s=I.deepClone(a),c=!1;s.ranges.forEach(e=>{r>e.startColumn&&r<=e.endColumn&&(e.endColumn+=i,c=!0)}),c&&(e.push({id:cY.id,params:{unitId:t,subUnitId:n,rule:s,ruleId:a.id}}),o.push({id:cY.id,params:{unitId:t,subUnitId:n,rule:a,ruleId:a.id}}))}),{redos:e,undos:o}}return{undos:[],redos:[]}}_getRefRangeMutationsByInsertRows(e,t,n){let r=e.range.startRow,i=e.range.endRow-e.range.startRow+1,a=this._selectionProtectionRuleModel.getSubunitRuleList(t,n).filter(e=>e.ranges.some(e=>r>e.startRow&&r<=e.endRow));if(a.length){let e=[],o=[];return a.forEach(a=>{let s=I.deepClone(a),c=!1;s.ranges.forEach(e=>{r>e.startRow&&r<=e.endRow&&(e.endRow+=i,c=!0)}),c&&(e.push({id:cY.id,params:{unitId:t,subUnitId:n,rule:s,ruleId:a.id}}),o.push({id:cY.id,params:{unitId:t,subUnitId:n,rule:a,ruleId:a.id}}))}),{redos:e,undos:o}}return{undos:[],redos:[]}}_getRefRangeMutationsByMoveRows(e,t,n){let r=e.toRange,i=r.startRow,a=r.endRow-r.startRow+1,o=this._selectionProtectionRuleModel.getSubunitRuleList(t,n).filter(e=>e.ranges.some(e=>i>e.startRow&&i<=e.endRow));if(o.length){let r=[],s=[];return o.forEach(o=>{let c=I.deepClone(o),l=e.fromRange.startRow,u=!1;c.ranges.forEach(e=>{i>e.startRow&&i<=e.endRow&&(l<e.startRow&&(e.startRow-=a,e.endRow-=a),e.endRow+=a,u=!0)}),u&&(r.push({id:cY.id,params:{unitId:t,subUnitId:n,rule:c,ruleId:o.id}}),s.push({id:cY.id,params:{unitId:t,subUnitId:n,rule:o,ruleId:o.id}}))}),{redos:r,undos:s}}return{undos:[],redos:[]}}_getRefRangeMutationsByMoveCols(e,t,n){let r=e.toRange,i=r.startColumn,a=r.endColumn-r.startColumn+1,o=this._selectionProtectionRuleModel.getSubunitRuleList(t,n).filter(e=>e.ranges.some(e=>i>e.startColumn&&i<=e.endColumn));if(o.length){let r=[],s=[];return o.forEach(o=>{let c=I.deepClone(o),l=e.fromRange.startColumn,u=!1;c.ranges.forEach(e=>{i>e.startColumn&&i<=e.endColumn&&(l<e.startColumn&&(e.startColumn-=a,e.endColumn-=a),e.endColumn+=a,u=!0)}),u&&(r.push({id:cY.id,params:{unitId:t,subUnitId:n,rule:c,ruleId:o.id}}),s.push({id:cY.id,params:{unitId:t,subUnitId:n,rule:o,ruleId:o.id}}))}),{redos:r,undos:s}}return{undos:[],redos:[]}}_correctPermissionRange(){this.disposeWithMe(this._commandService.onCommandExecuted(e=>{if(b_t.includes(e.id)){if(!e.params)return;let t=this._univerInstanceService.getCurrentUnitOfType(N.UNIVER_SHEET);if(!t)return;let n=t.getSheetBySheetId(e.params.subUnitId);if(!n)return;let{sourceRange:r,targetRange:i}=e.params,a=r.startColumn===i.startColumn&&r.endColumn===i.endColumn,o=a?r.endRow-r.startRow+1:r.endColumn-r.startColumn+1,s=a?r.startRow:r.startColumn,c=a?i.startRow:i.startColumn;this._selectionProtectionRuleModel.getSubunitRuleList(t.getUnitId(),n.getSheetId()).forEach(e=>{e.ranges.forEach(e=>{let{startRow:t,endRow:n,startColumn:i,endColumn:l}=e;n_.intersects(e,r)||(a?s<t&&c>n?(t-=o,n-=o):s>n&&c<=t&&(t+=o,n+=o):s<i&&c>l?(i-=o,l-=o):s>l&&c<=i&&(i+=o,l+=o)),this._checkIsRightRange({startRow:t,endRow:n,startColumn:i,endColumn:l})&&(e.startColumn=i,e.endColumn=l,e.startRow=t,e.endRow=n)})}),this.disposableCollection.dispose();let{unitId:l,subUnitId:u}=e.params,d=e=>this.refRangeHandle(e,l,u);this._selectionProtectionRuleModel.getSubunitRuleList(l,u).reduce((e,t)=>[...e,...t.ranges],[]).forEach(e=>{this.disposableCollection.add(this._refRangeService.registerRefRange(e,d,l,u))}),this._selectionProtectionRenderModel.clear()}if(y_t.includes(e.id)){let t=this._univerInstanceService.getUniverSheetInstance(e.params.unitId);if(!t)return;let n=t.getSheetBySheetId(e.params.subUnitId);if(!n)return;let r=e.params;if(!r)return;let{range:i}=r,a=e.id.includes(`row`),o=e.id.includes(`insert`),s=a?i.startRow:i.startColumn,c=a?i.endRow:i.endColumn,l=c-s+1;this._selectionProtectionRuleModel.getSubunitRuleList(t.getUnitId(),n.getSheetId()).forEach(e=>{e.ranges.forEach(e=>{let{startRow:t,endRow:n,startColumn:r,endColumn:i}=e;o?a?s<=t&&(t+=l,n+=l):s<=r&&(r+=l,i+=l):a?c<t&&(t-=l,n-=l):c<r&&(r-=l,i-=l),this._checkIsRightRange({startRow:t,endRow:n,startColumn:r,endColumn:i})&&(e.startColumn=r,e.endColumn=i,e.startRow=t,e.endRow=n)})}),this.disposableCollection.dispose();let{unitId:u,subUnitId:d}=e.params,f=e=>this.refRangeHandle(e,u,d);this._selectionProtectionRuleModel.getSubunitRuleList(u,d).reduce((e,t)=>[...e,...t.ranges],[]).forEach(e=>{this.disposableCollection.add(this._refRangeService.registerRefRange(e,f,u,d))}),this._selectionProtectionRenderModel.clear()}}))}_checkIsRightRange(e){return e.startRow<=e.endRow&&e.startColumn<=e.endColumn}_initReBuildCache(){this.disposeWithMe(this._commandService.onCommandExecuted(e=>{if(y_t.includes(e.id)||b_t.includes(e.id)){let{unitId:t,subUnitId:n}=e.params;this._rangeProtectionCache.reBuildCache(t,n)}}))}_initRemoveSheet(){this._sheetInterceptorService.interceptCommand({getMutations:e=>{let t=[],n=[],r=[],i=[];if(e.id===KJ.id){let n=e.params,i=[],a=[];this._rangeProtectionRuleModel.getSubunitRuleList(n.unitId,n.subUnitId).forEach(e=>{i.push(e.id),a.push(e)}),i.length&&a.length&&(r.push({id:SK.id,params:{unitId:n.unitId,subUnitId:n.subUnitId,ruleIds:i}}),t.push({id:CK.id,params:{unitId:n.unitId,subUnitId:n.subUnitId,name:``,rules:a}}))}return{redos:n,undos:t,preRedos:r,preUndos:i}}})}};YX=dG([uG(0,M(xK)),uG(1,M(B)),uG(2,z),uG(3,M(Fq)),uG(4,M(BX)),uG(5,M(VX)),uG(6,M(hG)),uG(7,M(xK))],YX);var x_t=`SHEET_RANGE_PROTECTION_PLUGIN`,XX=class extends F{constructor(e,t,n,r,i){super(),this._selectionProtectionRuleModel=e,this._permissionService=t,this._resourceManagerService=n,this._selectionProtectionCache=r,this._univerInstanceService=i,this._initSnapshot(),this._initRuleChange()}_initRuleChange(){this.disposeWithMe(this._selectionProtectionRuleModel.ruleChange$.subscribe(e=>{switch(e.type){case`add`:MY().forEach(t=>{let n=new t(e.unitId,e.subUnitId,e.rule.permissionId);this._permissionService.addPermissionPoint(n)});break;case`delete`:MY().forEach(t=>{let n=new t(e.unitId,e.subUnitId,e.rule.permissionId);this._permissionService.deletePermissionPoint(n.id)});break;case`set`:e.oldRule.permissionId!==e.rule.permissionId&&MY().forEach(t=>{let n=new t(e.unitId,e.subUnitId,e.oldRule.permissionId);this._permissionService.deletePermissionPoint(n.id);let r=new t(e.unitId,e.subUnitId,e.rule.permissionId);this._permissionService.addPermissionPoint(r)})}}))}_initSnapshot(){this.disposeWithMe(this._resourceManagerService.registerPluginResource({toJson:e=>{let t=this._selectionProtectionRuleModel.toObject()[e];return t?JSON.stringify(t):``},parseJson:e=>{if(!e)return{};try{return JSON.parse(e)}catch{return{}}},pluginName:x_t,businesses:[N.UNIVER_SHEET],onLoad:(e,t)=>{let n=this._selectionProtectionRuleModel.toObject();n[e]=t,this._selectionProtectionRuleModel.fromObject(n);let r=[];Object.keys(t).forEach(n=>{let i=t[n];this._selectionProtectionRuleModel.getSubunitRuleList(e,n).forEach(t=>{r.push({objectID:t.permissionId,unitID:e,objectType:na.SelectRange,actions:NY})}),i.forEach(t=>{MY().forEach(r=>{let i=new r(e,n,t.permissionId);i.value=!1,this._permissionService.addPermissionPoint(i)})}),this._selectionProtectionCache.reBuildCache(e,n)})},onUnLoad:e=>{this._selectionProtectionCache.deleteUnit(e)}}))}};XX=dG([uG(0,M(xK)),uG(1,M(Hb)),uG(2,M(wy)),uG(3,M(VX)),uG(4,M(B))],XX);var ZX=class extends F{constructor(e){super(),this._sheetRangeThemeModel=e}registerRangeTheme(e,t){this._sheetRangeThemeModel.registerRangeThemeStyle(e,t)}removeRangeThemeRule(e,t){this._sheetRangeThemeModel.removeRangeThemeRule(e,t)}getALLRegisterThemes(e){return this._sheetRangeThemeModel.getALLRegisteredTheme(e)}registerRangeThemeStyle(e,t){this._sheetRangeThemeModel.registerRangeThemeRule(e,t)}getAppliedRangeThemeStyle(e){return this._sheetRangeThemeModel.getRegisteredRangeThemeStyle(e)}getRegisteredRangeThemes(){return this._sheetRangeThemeModel.getRegisteredRangeThemes()}};ZX=dG([uG(0,M(yG))],ZX);var QX=class extends Kb{constructor(e=Xht,t,n){super(),this._config=e,this._injector=t,this._configService=n;let{...r}=Zi({},Xht,this._config);this._configService.setConfig(PJ,r),this._initConfig(),this._initDependencies()}_initConfig(){this._config?.onlyRegisterFormulaRelatedMutations&&this._configService.setConfig(__t,!0),this._config?.isRowStylePrecedeColumnStyle&&this._configService.setConfig(rf,!0),this._config?.autoHeightForMergedCells&&this._configService.setConfig(af,!0)}_initDependencies(){let e=[[qJ],[IJ],[TK],[Fq],[LX],[xX,{useClass:JX}],[hG],[ZX],[OK],[UX],[Lq],[GX],[PX],[zX],[FX],[hX],[qq],[DY],[KX],[RX],[IX],[yG],[BX],[xK],[VX],[YX],[XX],[qX,{useClass:v_t,deps:[TK]}],[AJ,{useClass:kJ}],[MX]];this._config?.notExecuteFormula||e.push([WX]),lf(this._injector,Wb(e,this._config.override)),uf(this._injector,[[hG],[XX],[qX],[RX],[FX]])}onStarting(){uf(this._injector,[[UX],[Lq],[LX],[hX],[KX],[OK],[MX]]),this._config?.onlyRegisterFormulaRelatedMutations||this._injector.add([HX])}onRendered(){uf(this._injector,[[xX]])}onReady(){uf(this._injector,[[HX],[WX],[PX],[zX],[yG],[GX],[BX],[YX],[Fq],[IX]])}};Z(QX,`pluginName`,`SHEET_PLUGIN`),Z(QX,`packageName`,m_t),Z(QX,`version`,h_t),Z(QX,`type`,N.UNIVER_SHEET),QX=dG([Jb(gH),uG(1,M(Ue)),uG(2,Om)],QX);var S_t=(e,t,n,r=1,i=!0,a=!0)=>{let{startRow:o,endRow:s}=Kg.transformRange(e,t),c=n.startRow-r,l=t.getMergedCell(c,n.startColumn),u=!l||l.startRow===c&&l.startColumn===n.startColumn;for(;!t.getRowVisible(c)||!u;)c--,l=t.getMergedCell(c,n.startColumn),u=!l||l.startRow===c&&l.startColumn===n.startColumn;if(c>=o)return{...n,startRow:c,endRow:c};if(a)return w_t(e,t,{...n,startRow:s,endRow:s},r,i,!1)},C_t=(e,t,n,r=1,i=!0,a=!0)=>{let{startRow:o,endRow:s}=Kg.transformRange(e,t),c=n.endRow+r,l=t.getMergedCell(c,n.startColumn),u=!l||l.startRow===c&&l.startColumn===n.startColumn;for(;!t.getRowVisible(c)||!u;)c++,l=t.getMergedCell(c,n.startColumn),u=!l||l.startRow===c&&l.startColumn===n.startColumn;if(c<=s)return{...n,startRow:c,endRow:c};if(a)return T_t(e,t,{...n,startRow:o,endRow:o},r,i,!1)},w_t=(e,t,n,r=1,i=!0,a=!0)=>{let{startColumn:o,endColumn:s}=Kg.transformRange(e,t),c=n.startColumn-r,l=t.getMergedCell(n.startRow,c),u=!l||l.startRow===n.startRow&&l.startColumn===c;for(;!t.getColVisible(c)||!u;)c--,l=t.getMergedCell(n.startRow,c),u=!l||l.startRow===n.startRow&&l.startColumn===c;if(c>=o)return{...n,startColumn:c,endColumn:c};if(a)return S_t(e,t,{...n,startColumn:s,endColumn:s},r,i,!1)},T_t=(e,t,n,r=1,i=!0,a=!0)=>{let{startColumn:o,endColumn:s}=Kg.transformRange(e,t),c=n.endColumn+r,l=t.getMergedCell(n.startRow,c),u=!l||l.startRow===n.startRow&&l.startColumn===c;for(;!t.getColVisible(c)||!u;)c++,l=t.getMergedCell(n.startRow,c),u=!l||l.startRow===n.startRow&&l.startColumn===c;if(c<=s)return{...n,endColumn:c,startColumn:c};if(a)return C_t(e,t,{...n,startColumn:o,endColumn:o},r,i,!1)};function $X(e,t,n){let r=null;return n.getMatrixWithMergedCells(e,t,e,t).forValue((e,t,n)=>(r={actualRow:e,actualColumn:t,startRow:e,startColumn:t,isMerged:n.rowSpan!==void 0||n.colSpan!==void 0,isMergedMainCell:n.rowSpan!==void 0&&n.colSpan!==void 0,endRow:e+(n.rowSpan===void 0?0:n.rowSpan-1),endColumn:t+(n.colSpan===void 0?0:n.colSpan-1),rangeType:fh.NORMAL},!1)),r||{actualColumn:t,actualRow:e,startRow:e,startColumn:t,endRow:e,endColumn:t,isMerged:!1,isMergedMainCell:!1,rangeType:fh.NORMAL}}var E_t=(e,t,n,r,i=1)=>{switch(r){case L.UP:return S_t(e,t,n,i);case L.DOWN:return C_t(e,t,n,i);case L.LEFT:return w_t(e,t,n,i);case L.RIGHT:return T_t(e,t,n,i)}},D_t=(e,t,n)=>{let r,i=-1,a;for(let t=0;t<e.length;t++)if(e[t].primary){r=e[t],i=t,a=r.primary;break}if(i===-1)return null;let o=t===L.LEFT||t===L.UP,s=e[o?i-1>=0?i-1:e.length-1:i+1<e.length?i+1:0];if(!r||!a)return null;let c={...a},{startRow:l,startColumn:u,endRow:d,endColumn:f}=r.range,p=o?c.startRow===l&&c.startColumn===u:c.endRow===d&&c.endColumn===f,m=p&&o;if(!n_.equals(r.range,c)){let e=p?s.range:E_t(r.range,n,c,t);if(!e)return null;let i=m?$X(e.endRow,e.endColumn,n):$X(e.startRow,e.startColumn,n);return{startRow:i.startRow,startColumn:i.startColumn,endRow:i.endRow,endColumn:i.endColumn}}let h=m?$X(s.range.endRow,s.range.endColumn,n):$X(s.range.startRow,s.range.startColumn,n);return{startRow:h.startRow,startColumn:h.startColumn,endRow:h.endRow,endColumn:h.endColumn}};function eZ(e,t){let{startRow:n,startColumn:r,endRow:i,endColumn:a,rangeType:o}=t,s=i<n?i:n,c=i<n?n:i,l=a<r?a:r,u=a<r?r:a,d=e.getNoMergeCellWithCoordByIndex(s,l),f=e.getNoMergeCellWithCoordByIndex(c,u);return{startRow:n,startColumn:r,endRow:i,endColumn:a,rangeType:o,startY:d?.startY||0,endY:f?.endY||0,startX:d?.startX||0,endX:f?.endX||0}}function tZ(e,t){let{range:n,primary:r,style:i}=e;return{rangeWithCoord:eZ(t,n),primaryWithCoord:r&&nZ(t,r),style:i}}function nZ(e,t){let{actualRow:n,actualColumn:r,isMerged:i,isMergedMainCell:a,startRow:o,startColumn:s,endRow:c,endColumn:l}=t,u=e.getNoMergeCellWithCoordByIndex(n,r),d=e.getNoMergeCellWithCoordByIndex(o,s),f=e.getNoMergeCellWithCoordByIndex(c,l);return{actualRow:n,actualColumn:r,isMerged:i,isMergedMainCell:a,startX:u.startX,startY:u.startY,endX:u.endX,endY:u.endY,mergeInfo:{startRow:o,startColumn:s,endRow:c,endColumn:l,startY:d?.startY||0,endY:f?.endY||0,startX:d?.startX||0,endX:f?.endX||0}}}function O_t(e,t,n,r){let{from:i,to:a}=n,{column:o,columnOffset:s,row:c,rowOffset:l}=i,{column:u,columnOffset:d,row:f,rowOffset:p}=a,m=eZ(r,{startColumn:o,endColumn:o,startRow:c,endRow:c}),h=eZ(r,{startColumn:u,endColumn:u,startRow:f,endRow:f}),{startX:g,startY:_}=m,{startX:v,startY:y}=h,b=QC(g+s,1),x=QC(_+l,1),S=QC(v+d-b,1),C=QC(y+p-x,1);return m.startX===h.endX&&(S=0),m.startY===h.endY&&(C=0),{unitId:e,subUnitId:t,left:b,top:x,width:S,height:C}}function k_t(e,t,n,r,i,a){let{column:o,columnOffset:s,row:c,rowOffset:l}=n,{startX:u,startY:d}=eZ(a,{startColumn:o,endColumn:o,startRow:c,endRow:c}),f=QC(u+s,1),p=QC(d+l,1),m=a.getCellIndexAndOffsetByPosition(f+r,p+i);return{unitId:e,subUnitId:t,sheetTransform:{from:{column:o,columnOffset:s,row:c,rowOffset:l},to:m},transform:{left:f,top:p,width:r,height:i}}}var A_t=se(`telemetry.service`);function rZ(e,t){if(e==null)return;let n=t.getRenderById(e);if(n==null)return;let{mainComponent:r,scene:i,engine:a,components:o}=n;return{document:r,docBackground:o.get(hXe.BACKGROUND),scene:i,engine:a}}function iZ(e){return e.getContextValue(My)}function aZ(e){return e.getContextValue(`FOCUSING_SHEET`)&&e.getContextValue(`FOCUSING_UNIVER_EDITOR`)&&!e.getContextValue(`EDITOR_ACTIVATED`)&&!e.getContextValue(`FOCUSING_COMMON_DRAWINGS`)}function oZ(e){return e.getContextValue(`FOCUSING_SHEET`)&&e.getContextValue(`FOCUSING_UNIVER_EDITOR`)&&!e.getContextValue(`FOCUSING_COMMON_DRAWINGS`)}function j_t(e){return e.getContextValue(`FOCUSING_SHEET`)&&e.getContextValue(`FOCUSING_UNIVER_EDITOR`)&&!e.getContextValue(`EDITOR_ACTIVATED`)&&!e.getContextValue(`FOCUSING_FX_BAR_EDITOR`)&&!e.getContextValue(`FOCUSING_COMMON_DRAWINGS`)}function M_t(e){return e.getContextValue(`FOCUSING_SHEET`)&&e.getContextValue(`FOCUSING_UNIVER_EDITOR`)&&e.getContextValue(`EDITOR_ACTIVATED`)}function sZ(e){return e.getContextValue(`FOCUSING_UNIVER_EDITOR`)&&e.getContextValue(`EDITOR_ACTIVATED`)}function cZ(e){return e.getContextValue(`FOCUSING_FX_BAR_EDITOR`)&&e.getContextValue(`FOCUSING_UNIVER_EDITOR`)}function lZ(e){return e.getContextValue(`FOCUSING_SHEET`)&&e.getContextValue(`FOCUSING_UNIVER_EDITOR`)&&e.getContextValue(`EDITOR_ACTIVATED`)&&!e.getContextValue(`FOCUSING_EDITOR_INPUT_FORMULA`)&&!e.getContextValue(`FOCUSING_EDITOR_INPUT_FORMULA`)}function uZ(e){let t=[],n=[],r=[];return e.forEach(e=>{t=t.concat(e.rows),n=n.concat(e.cols)}),t=Array.from(new Set(t)).sort((e,t)=>e-t),n=Array.from(new Set(n)).sort((e,t)=>e-t),e.forEach(e=>{r.push({startRow:t.findIndex(t=>t===e.rows[0]),endRow:t.findIndex(t=>t===e.rows[e.rows.length-1]),startColumn:n.findIndex(t=>t===e.cols[0]),endColumn:n.findIndex(t=>t===e.cols[e.cols.length-1])})}),{ranges:r,mapFunc:(e,r)=>({row:t[e],col:n[r]})}}var dZ=xf(`rangeMovePermissionCheck`),fZ=xf(`rangeFillPermissionCheck`),N_t=function(e){return e[e.FORMULA_EDITOR_SHOW=100]=`FORMULA_EDITOR_SHOW`,e[e.MARK_SELECTION=1e4]=`MARK_SELECTION`,e}({});function pZ(e){let t=e.getColorFromTheme(`primary.600`),n=e.getColorFromTheme(`white`),r=new Zm(t).setAlpha(.07).toRgbString();return{strokeWidth:1,stroke:t,fill:r,widgets:{},widgetSize:6,widgetStrokeWidth:1,widgetStroke:n,autofillSize:6,autofillStrokeWidth:1,autofillStroke:n,rowHeaderFill:r,rowHeaderStroke:t,rowHeaderStrokeWidth:1,columnHeaderFill:r,columnHeaderStroke:t,columnHeaderStrokeWidth:1,expandCornerSize:40}}var mZ=[10,400],hZ=`RANGE_SELECTOR_COMPONENT_KEY`,gZ=`EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY`,_Z=function(e){return e.MAIN=`__SpreadsheetRender__`,e.ROW=`__SpreadsheetRowHeader__`,e.COLUMN=`__SpreadsheetColumnHeader__`,e.LEFT_TOP=`__SpreadsheetLeftTopPlaceholder__`,e}({});function vZ(e){"@babel/helpers - typeof";return vZ=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},vZ(e)}function P_t(e,t){if(vZ(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(vZ(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function F_t(e){var t=P_t(e,`string`);return vZ(t)==`symbol`?t:t+``}function Q(e,t,n){return(t=F_t(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var I_t=class{constructor(){Q(this,`_startColumn`,-1),Q(this,`_startRow`,-1),Q(this,`_endColumn`,-1),Q(this,`_endRow`,-1),Q(this,`_startX`,0),Q(this,`_startY`,0),Q(this,`_endX`,0),Q(this,`_endY`,0),Q(this,`_primary`,void 0),Q(this,`_rangeType`,fh.NORMAL)}get startColumn(){return this._startColumn}get startRow(){return this._startRow}get endColumn(){return this._endColumn}get endRow(){return this._endRow}get startX(){return this._startX}get startY(){return this._startY}get endX(){return this._endX}get endY(){return this._endY}get currentCell(){return this._primary}get rangeType(){return this._rangeType}isEqual(e){let{startColumn:t,startRow:n,endColumn:r,endRow:i}=this,{startColumn:a,startRow:o,endColumn:s,endRow:c}=e;return t===a&&n===o&&r===s&&i===c}highlightToSelection(){if(this._primary)return Nh(this._primary)}getRange(){return{startColumn:this._startColumn,startRow:this._startRow,endColumn:this._endColumn,endRow:this._endRow,startX:this._startX,startY:this._startY,endX:this._endX,endY:this._endY,rangeType:this.rangeType}}getCell(){return this._primary}getRangeType(){return this._rangeType}setRangeType(e){this._rangeType=e}getValue(){return{rangeWithCoord:this.getRange(),primaryWithCoord:this._primary}}setValue(e,t){let{startColumn:n,startRow:r,endColumn:i,endRow:a,startX:o,startY:s,endX:c,endY:l,rangeType:u}=e;this._startColumn=n,this._startRow=r,this._endColumn=i,this._endRow=a,this._startX=o,this._startY=s,this._endX=c,this._endY=l,u!==void 0&&(this._rangeType=u),t!==void 0&&this.setCurrentCell(t)}setCurrentCell(e){this._primary=e}clearCurrentCell(){this._primary=null}},yZ={id:`sheet.command.set-row-header-width`,type:R.COMMAND,handler:async(e,t)=>{if(!t)return!1;let n=e.get(fE);if(!n)return!1;let{unitId:r,subUnitId:i,size:a}=t,o=n.getRenderById(r);if(o){n.getRenderById(r).with(EZ).setRowHeaderSize(o,i,a);let{components:e}=o,t=e.get(`__SpreadsheetRowHeader__`);t&&t.setCustomHeader({headerStyle:{size:a}},i)}return!0}},bZ={id:`sheet.command.set-col-header-height`,type:R.COMMAND,handler:async(e,t)=>{if(!t)return!1;let n=e.get(fE);if(!n)return!1;let{unitId:r,subUnitId:i,size:a}=t,o=n.getRenderById(r);if(o){n.getRenderById(r).with(EZ).setColumnHeaderSize(o,i,a);let{components:e}=o,t=e.get(`__SpreadsheetColumnHeader__`);t&&t.setCustomHeader({headerStyle:{size:a}},i)}return!0}},L_t=class extends rE{render(e,t=!1){let n=I.now();return super.render(e,t),this._afterRender(n),this}_afterRender(e){this.scene.getEngine().renderFrameTimeMetric$.next([`selectionLayer`,I.now()-e])}},xZ=se(`univer.sheet.selection-render-service`),SZ=class extends F{get selectionMoving(){return this._selectionMoving}constructor(e,t,n,r,i){super(),this._injector=e,this._themeService=t,this._shortcutService=n,this._sheetSkeletonManagerService=r,this.contextService=i,Q(this,`_downObserver`,void 0),Q(this,`_scenePointerMoveSub`,void 0),Q(this,`_scenePointerUpSub`,void 0),Q(this,`_controlFillConfig$`,new oo(null)),Q(this,`controlFillConfig$`,this._controlFillConfig$.asObservable()),Q(this,`_selectionControls`,[]),Q(this,`_startRangeWhenPointerDown`,{startY:0,endY:0,startX:0,endX:0,startRow:-1,endRow:-1,startColumn:-1,endColumn:-1}),Q(this,`_activeControlIndex`,-1),Q(this,`_startViewportPosX`,0),Q(this,`_startViewportPosY`,0),Q(this,`_scrollTimer`,void 0),Q(this,`_cancelDownSubscription`,void 0),Q(this,`_cancelUpSubscription`,void 0),Q(this,`_skeleton`,void 0),Q(this,`_scene`,void 0),Q(this,`_highlightHeader`,!0),Q(this,`_rangeType`,fh.NORMAL),Q(this,`_selectionStyle`,void 0),Q(this,`_remainLastEnabled`,!1),Q(this,`_skipLastEnabled`,!1),Q(this,`_singleSelectionEnabled`,!1),Q(this,`_selectionMoveEnd$`,new oo([])),Q(this,`selectionMoveEnd$`,this._selectionMoveEnd$.asObservable()),Q(this,`_selectionMoving$`,new io),Q(this,`selectionMoving$`,this._selectionMoving$.asObservable()),Q(this,`_selectionMoveStart$`,new io),Q(this,`selectionMoveStart$`,this._selectionMoveStart$.asObservable()),Q(this,`_selectionMoving`,!1),Q(this,`_selectionTheme`,void 0),Q(this,`_activeViewport`,void 0),Q(this,`interceptor`,new Cf({RANGE_MOVE_PERMISSION_CHECK:dZ,RANGE_FILL_PERMISSION_CHECK:fZ})),Q(this,`_escapeShortcutDisposable`,null),this._initSelectionThemeFromThemeService(),this._initMoving()}get _shouldDetectMergedCells(){return this._rangeType===fh.NORMAL}_initMoving(){this.disposeWithMe(this._selectionMoving$.subscribe(()=>{this._selectionMoving=!0})),this.disposeWithMe(this._selectionMoveEnd$.subscribe(()=>{this._selectionMoving=!1}))}_setSelectionStyle(e){this._selectionStyle=e}getViewPort(){return this._activeViewport}setSingleSelectionEnabled(e=!1){this._singleSelectionEnabled=e}newSelectionControl(e,t,n){let r=this.getSelectionControls().length,{rowHeaderWidth:i,rowHeaderWidthAndMarginLeft:a,columnHeaderHeight:o,columnHeaderHeightAndMarginTop:s}=t,c=new DZ(e,r,this._selectionTheme,{highlightHeader:this._highlightHeader,rowHeaderWidth:i,columnHeaderHeight:o,rowHeaderOffsetX:Math.max(0,a-i),columnHeaderOffsetY:Math.max(0,s-o)});this._selectionControls.push(c);let l=tZ(n,t);return c.updateRangeBySelectionWithCoord(l,t),c.setControlExtension({skeleton:t,scene:e,themeService:this._selectionTheme,injector:this._injector,selectionHooks:{selectionMoveEnd:()=>{this._selectionMoveEnd$.next(this.getSelectionDataWithStyle())}}}),c}resetSelectionsByModelData(e){let t=this.getSelectionControls(),n=this._skeleton;if(t&&n){for(let r=0,i=e.length;r<i;r++){let i=e[r],a=tZ(i,this._skeleton),o=t[r];o?o.updateRangeBySelectionWithCoord(a,n):this.isSelectionEnabled()&&this.newSelectionControl(this._scene,n,i)}e.length<t.length&&t.splice(e.length).forEach(e=>e.dispose())}}refreshSelectionMoveStart(){this._selectionMoveStart$.next(this.getSelectionDataWithStyle())}refreshSelectionMoveEnd(){this._selectionMoveEnd$.next(this.getSelectionDataWithStyle())}_initSelectionThemeFromThemeService(){let e=this._themeService.getCurrentTheme();this._selectionTheme=new Qb,this._selectionTheme.setTheme(e)}setSelectionTheme(e){this._selectionTheme.setTheme(e)}_changeRuntime(e,t,n){this._skeleton=e,this._scene=t,this._activeViewport=n||t?.getViewports()[0],t.findLayerByZIndex(1)||t.addLayer(new L_t(t,[],1))}getSkeleton(){return this._skeleton}getSelectionDataWithStyle(){let e=this._selectionControls;if(this._skeleton.worksheet){let[t,n]=this._skeleton.getLocation();return e.map(e=>{let r=e.getValue();return r.rangeWithCoord.sheetId=n,r.rangeWithCoord.unitId=t,r})}return[]}getSelectionControls(){return this._selectionControls}_addSelectionControlByModelData(e){let t=this._skeleton,n=e.style??pZ(this._selectionTheme),r=this._scene;return e.style=n,this.newSelectionControl(r,t,e)}_clearAllSelectionControls(){let e=this._selectionControls;for(let t of e)t.dispose();this._selectionControls.length=0}_getFreeze(){return this._sheetSkeletonManagerService.getCurrentParam()?.skeleton.getWorksheetConfig().freeze}_getViewportByCell(e,t){if(e===void 0||t===void 0)return null;let n=this._getFreeze();if(!n||n.startRow<=0&&n.startColumn<=0||e>n.startRow&&t>n.startColumn)return this._scene.getViewport(kw.VIEW_MAIN);if(e<=n.startRow&&t<=n.startColumn)return this._scene.getViewport(kw.VIEW_MAIN_LEFT_TOP);if(e<=n.startRow&&t>n.startColumn)return this._scene.getViewport(kw.VIEW_MAIN_TOP);if(e>n.startRow&&t<=n.startColumn)return this._scene.getViewport(kw.VIEW_MAIN_LEFT)}getActiveRange(){let e=this.getSelectionControls(),t=e&&e[e.length-1].model;return t&&{startRow:t.startRow,startColumn:t.startColumn,endRow:t.endRow,endColumn:t.endColumn}}setActiveSelectionIndex(e){this._activeControlIndex=e}resetActiveSelectionIndex(){this._activeControlIndex=-1}getActiveSelectionControl(){let e=this.getSelectionControls();if(e)return this._activeControlIndex<0?e[e.length-1]:e[this._activeControlIndex]}endSelection(){var e;this._clearUpdatingListeners(),this._selectionMoveEnd$.next(this.getSelectionDataWithStyle()),(e=this._escapeShortcutDisposable)==null||e.dispose(),this._escapeShortcutDisposable=null}_reset(){var e;this._clearAllSelectionControls(),(e=this._downObserver)==null||e.unsubscribe(),this._downObserver=null}_setupPointerMoveListener(e,t,n,r=sE.ALL,i,a){let o=0,s=0,c=i,l=a;this._scrollTimer=cE.create(this._scene,r),this._scrollTimer.startScroll(e?.left??0,e?.top??0,e);let u=this._scene,d=u.getActiveViewportByCoord(mw.FromArray([i,a]));this._scenePointerMoveSub=u.onPointerMove$.subscribeEvent(r=>{let{offsetX:i,offsetY:a}=r,{x:f,y:p}=u.getCoordRelativeToViewport(mw.FromArray([i,a]));this._movingHandler(f,p,t,n);let m=f,h=p,g=this.getActiveSelectionControl(),_=this._getFreeze(),v=g?.model,y=u.getActiveViewportByCoord(mw.FromArray([i,a]))??this._getViewportByCell(v?.endRow,v?.endColumn);if((()=>{if(!d||!y||!e)return!1;let t=[kw.VIEW_MAIN,kw.VIEW_MAIN_LEFT_TOP,kw.VIEW_MAIN_TOP,kw.VIEW_MAIN_LEFT];return t.includes(d.viewportKey)&&t.includes(y.viewportKey)})()){if(!d||!y||!e)return!1;let t=c<e.left&&f>e.left||c>e.left&&f<e.left,n=l<e.top&&p>e.top||l>e.top&&p<e.top;t&&(o+=1),n&&(s+=1);let r=d.viewportKey,u=y.viewportKey;if(r===kw.VIEW_ROW_TOP)a<e.top&&(v?.endRow??0)<(_?.startRow??0)?h=e.top:n&&s%2==1&&e.scrollToViewportPos({viewportScrollY:0});else if(r===kw.VIEW_COLUMN_LEFT)i<e.left&&(v?.endColumn??0)<(_?.startColumn??0)?m=e.left:t&&o%2==1&&e.scrollToViewportPos({viewportScrollX:0});else if(r===u){let t=!1,n=!1;r===kw.VIEW_MAIN_LEFT_TOP?(t=!0,n=!0):r===kw.VIEW_MAIN_TOP?n=!0:r===kw.VIEW_MAIN_LEFT&&(t=!0),(v?.endRow??0)>(_?.startRow??0)&&(n=!1),(v?.endColumn??0)>(_?.startColumn??0)&&(t=!1),t&&(m=e.left),n&&(h=e.top)}else{let i={x:d.scrollX,y:d.scrollY},a={x:y.scrollX,y:y.scrollY},c=i.x!==a.x&&t&&o%2==1,l=i.y!==a.y&&n&&s%2==1;(c||l)&&(e.scrollToBarPos({x:c?i.x:void 0,y:l?i.y:void 0}),c||(m=e.left),l||(h=e.top)),(r===kw.VIEW_MAIN_LEFT_TOP&&u===kw.VIEW_MAIN_LEFT||u===kw.VIEW_MAIN_LEFT_TOP&&r===kw.VIEW_MAIN_LEFT)&&(m=e.left),(r===kw.VIEW_MAIN_LEFT_TOP&&u===kw.VIEW_MAIN_TOP||u===kw.VIEW_MAIN_LEFT_TOP&&r===kw.VIEW_MAIN_TOP)&&(h=e.top)}c=f,l=p}this._scrollTimer.scrolling(m,h,()=>{this._movingHandler(f,p,t,n)})})}getSelectionCellByPosition(e,t){return this.getCellWithCoordByOffset(e,t)}getCellWithCoordByOffset(e,t,n){let r=this._scene,i=n??this._skeleton,a=r.getViewportScrollXY(r.getViewport(kw.VIEW_MAIN)),{scaleX:o,scaleY:s}=r.getAncestorScale();return i.getCellWithCoordByOffset(e-a.x,t-a.y,o,s,a)}_movingHandler(e,t,n,r){let i=this._skeleton,a=this._scene,[o,s]=i.getLocation(),c={startRow:n?.model.startRow??-1,endRow:n?.model.endRow??-1,startColumn:n?.model.startColumn??-1,endColumn:n?.model.endColumn??-1,unitId:o,sheetId:s},l=a.getViewport(kw.VIEW_MAIN),u=this._getViewportByCell(c.endRow,c.endColumn)??l,d=a.getScrollXYInfoByViewport(mw.FromArray([this._startViewportPosX,this._startViewportPosY]),u),{scaleX:f,scaleY:p}=a.getAncestorScale();r===fh.ROW?e=1/0:r===fh.COLUMN&&(t=1/0);let m=this._skeleton.getCellByOffset(e,t,f,p,d);if(!m)return;let h={startRow:Math.min(m.startRow,this._startRangeWhenPointerDown.startRow),startColumn:Math.min(m.startColumn,this._startRangeWhenPointerDown.startColumn),endRow:Math.max(m.endRow,this._startRangeWhenPointerDown.endRow),endColumn:Math.max(m.endColumn,this._startRangeWhenPointerDown.endColumn)};this._shouldDetectMergedCells&&(h=i.expandRangeByMerge(h,this.inRefSelectionMode()));let g=tZ({range:h,primary:void 0,style:null},i);g.rangeWithCoord.unitId=o,g.rangeWithCoord.sheetId=s,g.rangeWithCoord.rangeType=r;let _=c.startRow!==h.startRow||c.startColumn!==h.startColumn||c.endRow!==h.endRow||c.endColumn!==h.endColumn;n!=null&&_&&(n.updateRangeBySelectionWithCoord(g),this._selectionMoving$.next(this.getSelectionDataWithStyle()))}_clearUpdatingListeners(){var e,t,n,r,i;this._scene.enableObjectsEvent(),(e=this._scenePointerMoveSub)==null||e.unsubscribe(),this._scenePointerMoveSub=null,(t=this._scenePointerUpSub)==null||t.unsubscribe(),this._scenePointerUpSub=null,(n=this._cancelDownSubscription)==null||n.unsubscribe(),this._cancelDownSubscription=null,(r=this._cancelUpSubscription)==null||r.unsubscribe(),this._cancelUpSubscription=null,(i=this._scrollTimer)==null||i.dispose()}_addEndingListeners(){var e,t;let n=this._scene,r=n.getEngine()?.activeScene;r&&r!==n&&((e=this._cancelDownSubscription)==null||e.unsubscribe(),this._cancelDownSubscription=null,(t=this._cancelUpSubscription)==null||t.unsubscribe(),this._cancelUpSubscription=null,this._cancelDownSubscription=r.onPointerDown$.subscribeEvent(()=>this._clearUpdatingListeners()),this._cancelUpSubscription=r.onPointerUp$.subscribeEvent(()=>this._clearUpdatingListeners()))}_getSelectionWithCoordByOffset(e,t,n,r,i){let a=this._skeleton;if(a==null)return null;if(this._shouldDetectMergedCells){let o=a?.getCellWithCoordByOffset(e,t,n,r,i,{firstMatch:!0});return o?{primaryWithCoord:o,rangeWithCoord:Nh(o)}:void 0}let{row:o,column:s}=a.getCellIndexByOffset(e,t,n,r,i),{startX:c,startY:l,endX:u,endY:d}=a.getNoMergeCellWithCoordByIndex(o,s),f={startY:l,endY:d,startX:c,endX:u,startRow:o,endRow:o,startColumn:s,endColumn:s};return{primaryWithCoord:{mergeInfo:f,actualRow:o,actualColumn:s,isMerged:!1,isMergedMainCell:!1,startY:l,endY:d,startX:c,endX:u},rangeWithCoord:f}}_checkClearPreviousControls(e){this.getSelectionControls().length!==0&&(!e.ctrlKey&&!e.shiftKey&&!this._remainLastEnabled||this._singleSelectionEnabled&&!e.shiftKey)&&this._clearAllSelectionControls()}_makeSelectionByTwoCells(e,t,n,r,i){let{actualRow:a,actualColumn:o,mergeInfo:s}=e;this._startRangeWhenPointerDown={...e.mergeInfo};let c=Math.min(a,t.startRow,s.startRow),l=Math.max(a,t.endRow,s.endRow),u=Math.min(o,t.startColumn,s.startColumn),d=Math.max(o,t.endColumn,s.endColumn),f=tZ({range:n.expandRangeByMerge({startRow:c,startColumn:u,endRow:l,endColumn:d}),primary:mK(e),style:null},n);i.updateRangeBySelectionWithCoord(f)}isSelectionEnabled(){return this.contextService.getContextValue(EK)}isSelectionDisabled(){return this.contextService.getContextValue(EK)===!1}inRefSelectionMode(){return this.contextService.getContextValue(DK)}};function CZ(e){return{range:{startRow:0,startColumn:0,endRow:e.getRowCount()-1,endColumn:e.getColumnCount()-1,rangeType:fh.ALL},primary:wZ(e).primary,style:null}}function wZ(e){return R_t(e,{startRow:0,startColumn:0,endRow:0,endColumn:0})}function R_t(e,t){let n=e.worksheet.getCellInfoInMergeData(t.startRow,t.startColumn),r=e.worksheet.getCellInfoInMergeData(t.endRow,t.endColumn);return{range:{startRow:n.startRow,startColumn:n.startColumn,endRow:r.endRow,endColumn:r.endColumn,rangeType:fh.NORMAL},primary:{actualRow:n.startRow,actualColumn:n.startColumn,startRow:n.startRow,startColumn:n.startColumn,endRow:n.endRow,endColumn:n.endColumn,isMerged:n.isMerged,isMergedMainCell:n.isMergedMainCell},style:null}}function $(e,t){return function(n,r){t(n,r,e)}}function TZ(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var EZ=class extends F{constructor(e,t){super(),this._context=e,this._sheetSkeletonService=t,Q(this,`_sheetId`,``),Q(this,`_currentSkeleton$`,new oo(null)),Q(this,`currentSkeleton$`,this._currentSkeleton$.asObservable()),Q(this,`_currentSkeletonBefore$`,new oo(null)),Q(this,`currentSkeletonBefore$`,this._currentSkeletonBefore$.asObservable());let{unitId:n,scene:r}=this._context;this._sheetSkeletonService.setScene(n,r),this._initSkeletonsRegisterGetCellHeight(n)}_initSkeletonsRegisterGetCellHeight(e){this._sheetSkeletonService.getSkeletonsByUnitId(e).forEach(e=>e.registerGetCellHeight()),this.disposeWithMe(this._sheetSkeletonService.buildSkeleton$.subscribe(e=>e.registerGetCellHeight()))}dispose(){super.dispose(),this._currentSkeletonBefore$.complete(),this._currentSkeleton$.complete()}getCurrentSkeleton(){return this.getCurrentParam()?.skeleton}getCurrentParam(){return this._getSkeletonParam(this._sheetId)}getSkeleton(e){return this._getSkeleton(e)}getSkeletonParam(e){return this._getSkeletonParam(e)}setCurrent(e){this._setCurrent(e.sheetId)}_setCurrent(e){this._sheetId=e;let t=this._getSkeletonParam(e);if(t)this.reCalculate(t);else{let n=this._context.unit,r=n.getSheetBySheetId(e),i=this._context.unitId;if(!r)return;t=this._sheetSkeletonService.newSkeletonParam(i,e,r,n.getStyles())}this._currentSkeletonBefore$.next(t),this._currentSkeleton$.next(t)}reCalculate(e){let t=e||this.getCurrentParam();t&&(t.dirty&&=(t.skeleton.makeDirty(!0),!1),t.skeleton.calculate())}makeDirty(e,t=!0){let n=this._getSkeletonParam(e.sheetId);n!=null&&(n.dirty=t)}ensureSkeleton(e){return this._sheetSkeletonService.ensureSkeleton(this._context.unitId,e)}_getSkeletonParam(e){return this._sheetSkeletonService.getSkeletonParam(this._context.unitId,e)}_getSkeleton(e){return this._sheetSkeletonService.getSkeleton(this._context.unitId,e)}setColumnHeaderSize(e,t,n){if(!e)return;let r=this.getSkeleton(t);if(!r)return;r.columnHeaderHeight=n,e.scene.getViewports()[0].top=n,e.scene.getViewport(kw.VIEW_COLUMN_RIGHT).setViewportSize({height:n}),e.scene.getViewport(kw.VIEW_COLUMN_LEFT).setViewportSize({height:n}),e.scene.getViewport(kw.VIEW_ROW_BOTTOM).setViewportSize({top:n}),e.scene.getViewport(kw.VIEW_ROW_TOP).setViewportSize({top:n}),e.scene.getViewport(kw.VIEW_LEFT_TOP).setViewportSize({height:n});let i=e?.with(TK),a=e?.with(xZ),o=i.getCurrentSelections();a.resetSelectionsByModelData(o);let s=this._sheetSkeletonService.getSkeletonParam(e.unitId,t);s&&(s.commandId=bZ.id,this._currentSkeleton$.next(s))}setRowHeaderSize(e,t,n){if(!e)return;let r=this.getSkeleton(t);if(!r)return;r.rowHeaderWidth=n;let i=n-(e.scene.getViewport(kw.VIEW_LEFT_TOP).width||46),a=e.scene.getViewports()[0].left;e.scene.getViewports()[0].left=a+i,e.scene.getViewport(kw.VIEW_ROW_BOTTOM).setViewportSize({width:n}),e.scene.getViewport(kw.VIEW_ROW_TOP).setViewportSize({width:n}),e.scene.getViewport(kw.VIEW_COLUMN_LEFT).setViewportSize({left:n});let o=e.scene.getViewport(kw.VIEW_COLUMN_RIGHT).left||0;e.scene.getViewport(kw.VIEW_COLUMN_RIGHT).setViewportSize({left:o+i}),e.scene.getViewport(kw.VIEW_LEFT_TOP).setViewportSize({width:n});let s=e?.with(TK),c=e?.with(xZ),l=s.getCurrentSelections();c.resetSelectionsByModelData(l);let u=this._sheetSkeletonService.getSkeletonParam(e.unitId,t);u&&(u.commandId=yZ.id,this._currentSkeleton$.next(u))}};EZ=TZ([$(1,M(OK))],EZ);var z_t=`__SpreadsheetHelperSelectionTempRect`,B_t=35,V_t=class{constructor(e,t){this._control=e,Q(this,`_startOffsetX`,0),Q(this,`_startOffsetY`,0),Q(this,`_relativeSelectionPositionRow`,0),Q(this,`_relativeSelectionPositionColumn`,0),Q(this,`_relativeSelectionRowLength`,0),Q(this,`_relativeSelectionColumnLength`,0),Q(this,`_scenePointerMoveSub`,void 0),Q(this,`_scenePointerUpSub`,void 0),Q(this,`_disabled`,!1),Q(this,`_helperSelection`,void 0),Q(this,`_scrollTimer`,void 0),Q(this,`_activeViewport`,void 0),Q(this,`_targetSelection`,{startY:0,endY:0,startX:0,endX:0,startRow:-1,endRow:-1,startColumn:-1,endColumn:-1}),Q(this,`_isInMergeState`,!1),Q(this,`_fillControlColors`,[]),Q(this,`_skeleton`,void 0),Q(this,`_scene`,void 0),Q(this,`_themeService`,void 0),Q(this,`_injector`,void 0),Q(this,`_selectionHooks`,void 0),this._skeleton=t.skeleton,this._scene=t.scene,this._themeService=t.themeService,this._injector=t.injector,this._selectionHooks=t.selectionHooks,this._initialControl(),this._initialWidget(),this._initialAutoFill(),this._control.dispose$.subscribe(()=>{this.dispose()})}get isHelperSelection(){return this._control.isHelperSelection}dispose(){var e,t;(e=this._scrollTimer)==null||e.dispose(),this._fillControlColors=[],this._clearObserverEvent(),(t=this._helperSelection)==null||t.dispose()}setDisabled(e){this._disabled=e}_getFreeze(){var e;return(e=mE(N.UNIVER_SHEET,EZ,this._injector.get(B),this._injector.get(fE)))==null||(e=e.getCurrentParam())==null?void 0:e.skeleton.getWorksheetConfig().freeze}_isSelectionInViewport(e,t){let n=this._getFreeze()||{startRow:-1,startColumn:-1,xSplit:0,ySplit:0};switch(t.viewportKey){case kw.VIEW_MAIN:return e.endRow>=n.startRow&&e.endColumn>=n.startColumn;case kw.VIEW_MAIN_TOP:case kw.VIEW_COLUMN_RIGHT:return e.endColumn>=n.startColumn&&e.startRow<n.startRow;case kw.VIEW_MAIN_LEFT:case kw.VIEW_ROW_BOTTOM:return e.endRow>=n.startRow&&e.startColumn<n.startColumn;case kw.VIEW_MAIN_LEFT_TOP:case kw.VIEW_COLUMN_LEFT:case kw.VIEW_ROW_TOP:case kw.VIEW_LEFT_TOP:return e.startRow<n.startRow&&e.startColumn<n.startColumn}}_clearObserverEvent(){var e,t;(e=this._scenePointerMoveSub)==null||e.unsubscribe(),(t=this._scenePointerUpSub)==null||t.unsubscribe(),this._scenePointerMoveSub=null,this._scenePointerUpSub=null}_initialControl(){let{leftControl:e,rightControl:t,topControl:n,bottomControl:r}=this._control;[e,t,n,r].forEach(e=>{e.onPointerEnter$.subscribeEvent(()=>{this._injector.get(xZ,D.OPTIONAL)?.interceptor.fetchThroughInterceptors(dZ)(!1,null)!==!1&&e.setCursor(WC.MOVE)}),e.onPointerLeave$.subscribeEvent(()=>{e.resetCursor()}),e.onPointerDown$.subscribeEvent(this._controlPointerDownHandler.bind(this))})}_controlMoving(e,t){var n;let r=this._scene,i=r.getScrollXYInfoByViewport(mw.FromArray([e,t])),{scaleX:a,scaleY:o}=r.getAncestorScale(),{row:s,column:c}=this._skeleton.getCellIndexByOffset(e,t,a,o,i),l=this._skeleton.getRowCount()-1,u=this._skeleton.getColumnCount()-1,d=Math.max(0,s+this._relativeSelectionPositionRow),f=d+this._relativeSelectionRowLength;f>l&&(f=l,f-d<this._relativeSelectionRowLength&&(d=f-this._relativeSelectionRowLength));let p=Math.max(0,c+this._relativeSelectionPositionColumn),m=p+this._relativeSelectionColumnLength;m>u&&(m=u,m-p<this._relativeSelectionColumnLength&&(p=m-this._relativeSelectionColumnLength));let h=this._skeleton.worksheet.getCellInfoInMergeData(d,p),g=tZ({range:{startRow:d,endRow:f,startColumn:p,endColumn:m},primary:h,style:null},this._skeleton),_=this._skeleton.getNoMergeCellWithCoordByIndex(d,p),v=this._skeleton.getNoMergeCellWithCoordByIndex(f,m),y=_?.startY||0,b=v?.endY||0,x=_?.startX||0,S=v?.endX||0;(n=this._helperSelection)==null||n.transformByState({left:x,top:y,width:S-x,height:b-y}),this._targetSelection={...g.rangeWithCoord},this._control.selectionMoving$.next(g.rangeWithCoord)}_controlPointerDownHandler(e){let{offsetX:t,offsetY:n}=e,r=this._scene,i=r.getCoordRelativeToViewport(mw.FromArray([t,n])),{x:a,y:o}=i,s=r.getScrollXYInfoByViewport(i),{scaleX:c,scaleY:l}=r.getAncestorScale(),u=this._skeleton.getCellIndexByOffset(a,o,c,l,s);this._startOffsetX=a,this._startOffsetY=o;let{row:d,column:f}=u,{startRow:p,startColumn:m,endRow:h,endColumn:g}=this._control.model,_=0,v=0;d<p?--_:d>h&&(_+=1),f<m?--v:f>g&&(v+=1),this._relativeSelectionPositionRow=p-d+_,this._relativeSelectionPositionColumn=m-f+v,this._relativeSelectionRowLength=h-p,this._relativeSelectionColumnLength=g-m;let y=this._control.currentStyle,b=this._getScale();this.isHelperSelection&&(this._helperSelection=new $T(z_t,{stroke:y.stroke,strokeWidth:y.strokeWidth/b}),r.addObject(this._helperSelection));let x=r.getViewport(kw.VIEW_MAIN),S=cE.create(r);this._scrollTimer=S,S.startScroll(a,o,x),r.disableObjectsEvent(),this._scenePointerMoveSub=r.onPointerMove$.subscribeEvent(e=>{if(this._disabled)return;let{offsetX:t,offsetY:n}=e;if(this._injector.get(xZ,D.OPTIONAL)?.interceptor.fetchThroughInterceptors(dZ)(!1,null)===!1)return;let{x:i,y:a}=r.getCoordRelativeToViewport(mw.FromArray([t,n]));this._controlMoving(i,a),r.setCursor(WC.MOVE),S.scrolling(i,a,()=>{this._controlMoving(i,a)})}),this._scenePointerUpSub=r.onPointerUp$.subscribeEvent(()=>{var e,t,n,r;(e=this._helperSelection)==null||e.dispose();let i=this._scene;i.resetCursor(),this._clearObserverEvent(),i.enableObjectsEvent(),(t=this._scrollTimer)==null||t.dispose(),this._control.selectionMoveEnd$.next(this._targetSelection),(n=(r=this._selectionHooks).selectionMoveEnd)==null||n.call(r)})}_initialWidget(){let{topLeftWidget:e,topCenterWidget:t,topRightWidget:n,middleLeftWidget:r,middleRightWidget:i,bottomLeftWidget:a,bottomCenterWidget:o,bottomRightWidget:s}=this._control,c=[WC.NORTH_WEST_RESIZE,WC.NORTH_RESIZE,WC.NORTH_EAST_RESIZE,WC.WEST_RESIZE,WC.EAST_RESIZE,WC.SOUTH_WEST_RESIZE,WC.SOUTH_RESIZE,WC.SOUTH_EAST_RESIZE];[e,t,n,r,i,a,o,s].forEach((e,t)=>{e.onPointerEnter$.subscribeEvent(()=>{e.setCursor(c[t])}),e.onPointerLeave$.subscribeEvent(()=>{e.resetCursor()}),e.onPointerDown$.subscribeEvent(e=>{this._widgetPointerDownEvent(e,c[t])})})}_widgetPointerDownEvent(e,t){let n=this._scene,{offsetX:r,offsetY:i}=e,{x:a,y:o}=n.getCoordRelativeToViewport(mw.FromArray([r,i]));this._startOffsetX=r,this._startOffsetY=i;let{startRow:s,startColumn:c,endRow:l,endColumn:u}=this._control.model,d=Math.min(s,l),f=Math.min(c,u),p=Math.max(s,l),m=Math.max(c,u);this._relativeSelectionPositionRow=d,this._relativeSelectionPositionColumn=f,this._relativeSelectionRowLength=p-d,this._relativeSelectionColumnLength=m-f,t===WC.NORTH_WEST_RESIZE?(this._relativeSelectionPositionRow=p,this._relativeSelectionPositionColumn=m):t===WC.NORTH_RESIZE||t===WC.NORTH_EAST_RESIZE?this._relativeSelectionPositionRow=p:t===WC.WEST_RESIZE||t===WC.SOUTH_WEST_RESIZE?this._relativeSelectionPositionColumn=m:t===WC.SOUTH_RESIZE&&(this._relativeSelectionPositionRow=d);let h=cE.create(n),g=n.getViewport(kw.VIEW_MAIN);h.startScroll(a,o,g),this._scrollTimer=h,n.disableObjectsEvent(),this._scenePointerMoveSub=n.onPointerMove$.subscribeEvent(e=>{let{offsetX:r,offsetY:i}=e,{x:a,y:o}=n.getCoordRelativeToViewport(mw.FromArray([r,i]));this._widgetMoving(a,o,t),n.setCursor(t),h.scrolling(a,o,()=>{this._widgetMoving(a,o,t)})}),this._scenePointerUpSub=n.onPointerUp$.subscribeEvent(()=>{var e,t,n;let r=this._scene;r.resetCursor(),this._clearObserverEvent(),r.enableObjectsEvent(),(e=this._scrollTimer)==null||e.dispose(),this._control.selectionScaled$.next(this._targetSelection),(t=(n=this._selectionHooks).selectionMoveEnd)==null||t.call(n)})}_widgetMoving(e,t,n){let r=this._scene,i=r.getScrollXYInfoByViewport(mw.FromArray([this._startOffsetX,this._startOffsetY])),{scaleX:a,scaleY:o}=r.getAncestorScale(),{row:s,column:c}=this._skeleton.getCellIndexByOffset(e,t,a,o,i),l=this._relativeSelectionPositionRow,u=this._relativeSelectionPositionColumn,d=s,f=c;n===WC.NORTH_WEST_RESIZE?(l=s,u=c,d=this._relativeSelectionPositionRow,f=this._relativeSelectionPositionColumn):n===WC.NORTH_RESIZE?(l=s,u=this._relativeSelectionPositionColumn,d=this._relativeSelectionPositionRow,f=this._relativeSelectionPositionColumn+this._relativeSelectionColumnLength):n===WC.NORTH_EAST_RESIZE?(l=s,u=this._relativeSelectionPositionColumn,d=this._relativeSelectionPositionRow,f=c):n===WC.WEST_RESIZE?(l=this._relativeSelectionPositionRow,u=c,d=this._relativeSelectionPositionRow+this._relativeSelectionRowLength,f=this._relativeSelectionPositionColumn):n===WC.EAST_RESIZE?d=this._relativeSelectionPositionRow+this._relativeSelectionRowLength:n===WC.SOUTH_WEST_RESIZE?(l=this._relativeSelectionPositionRow,u=c,d=s,f=this._relativeSelectionPositionColumn):n===WC.SOUTH_RESIZE&&(l=this._relativeSelectionPositionRow,u=this._relativeSelectionPositionColumn,d=s,f=this._relativeSelectionPositionColumn+this._relativeSelectionColumnLength);let p=tZ({range:this._swapPositions(l,u,d,f),primary:this._skeleton.getCellWithMergeInfoByIndex(l,u),style:null},this._skeleton);this._targetSelection={...p.rangeWithCoord},this._control.updateRangeBySelectionWithCoord(p),this._control.selectionScaling$.next(this._targetSelection)}_initialAutoFill(){let{fillControl:e}=this._control;e.onPointerEnter$.subscribeEvent(t=>{this._injector.get(xZ).interceptor.fetchThroughInterceptors(fZ)(!1,{x:t.offsetX,y:t.offsetY,skeleton:this._skeleton,scene:this._scene})&&e.setCursor(WC.CROSSHAIR)}),e.onPointerLeave$.subscribeEvent(()=>{e.resetCursor()}),e.onPointerDown$.subscribeEvent(this._autoFillForPointerdown.bind(this))}_autoFillMoving(e,t){let n=this._scene,r=n.getViewportScrollXY(this._activeViewport),{scaleX:i,scaleY:a}=n.getAncestorScale(),{row:o,column:s}=this._skeleton.getCellIndexByOffset(e,t,i,a,r),c=n.getCoordRelativeToViewport(mw.FromArray([e,t])),l=this._skeleton.getRowCount()-1,u=this._skeleton.getColumnCount()-1,d=this._relativeSelectionPositionRow,f=this._relativeSelectionPositionColumn,p=this._relativeSelectionPositionRow+this._relativeSelectionRowLength,m=this._relativeSelectionPositionColumn+this._relativeSelectionColumnLength,h=!1,g=!0;if((s<f||s>m)&&o>=d&&o<=p){let e=this._fillRuler(s,f,m,this._relativeSelectionColumnLength,u);f=e.startRowOrColumn,m=e.endRowOrColumn,h=e.isLighten,g=!1}else if((o<d||o>p)&&s>=f&&s<=m){let e=this._fillRuler(o,d,p,this._relativeSelectionRowLength,l);d=e.startRowOrColumn,p=e.endRowOrColumn,h=e.isLighten}else if(Math.abs(this._startOffsetX-c.x-r.x)/2>Math.abs(this._startOffsetY-c.y-r.y)){let e=this._fillRuler(s,f,m,this._relativeSelectionColumnLength,u);f=e.startRowOrColumn,m=e.endRowOrColumn,h=e.isLighten,g=!1}else{let e=this._fillRuler(o,d,p,this._relativeSelectionRowLength,l);d=e.startRowOrColumn,p=e.endRowOrColumn,h=e.isLighten}let _=this._skeleton.getNoMergeCellWithCoordByIndex(d,f),v=this._skeleton.getNoMergeCellWithCoordByIndex(p,m),y=_?.startY||0,b=v?.endY||0,x=_?.startX||0,S=v?.endX||0;h?this._controlHandler((e,t)=>{let n=new Zm(this._fillControlColors[t]).lighten(B_t).toRgbString();e.setProps({fill:n})}):this._controlHandler((e,t)=>{e.setProps({fill:this._fillControlColors[t]})});let C=dK/this._getScale();if(d===p&&g===!0||f===m&&g===!1){var w;(w=this._helperSelection)==null||w.hide()}else{var T,E;(T=this._helperSelection)==null||T.transformByState({left:x-C/2,top:y-C/2,width:S-x,height:b-y}),(E=this._helperSelection)==null||E.show()}this._targetSelection={startY:y,endY:b,startX:x,endX:S,startRow:d,endRow:p,startColumn:f,endColumn:m},this._control.selectionFilling$.next(this._targetSelection)}_autoFillForPointerdown(e){let{offsetX:t,offsetY:n}=e,r=this._scene,{x:i,y:a}=r.getCoordRelativeToViewport(mw.FromArray([t,n]));this._startOffsetX=i,this._startOffsetY=a;let{startRow:o,startColumn:s,endRow:c,endColumn:l}=this._control.model;this._isInMergeState=this._hasMergeInRange(o,s,c,l),this._relativeSelectionPositionRow=o,this._relativeSelectionPositionColumn=s,this._relativeSelectionRowLength=c-o,this._relativeSelectionColumnLength=l-s;let u=this._control.currentStyle,d=u?.stroke,f=u?.strokeWidth,p=pZ(this._themeService);d??=p.stroke,f??=p.strokeWidth;let m=this._getScale();f/=m;let h=dK/m,g=new Zm(d).darken(2).toRgbString();this.isHelperSelection&&(this._helperSelection=new $T(z_t,{stroke:g,strokeWidth:f+h/2}),r.addObject(this._helperSelection)),this._activeViewport=r.getActiveViewportByCoord(mw.FromArray([t,n]));let _=r.getViewport(kw.VIEW_MAIN),v=cE.create(r,this._activeViewport.viewportKey===kw.VIEW_MAIN?sE.ALL:sE.NONE);v.startScroll(i,a,_),this._scrollTimer=v,r.disableObjectsEvent(),this._controlHandler(e=>{this._fillControlColors.push(e.fill)}),this._scenePointerMoveSub=r.onPointerMove$.subscribeEvent(t=>{let{offsetX:n,offsetY:i}=t,a=r.getActiveViewportByCoord(mw.FromArray([n,i]));if(!this._injector.get(xZ).interceptor.fetchThroughInterceptors(fZ)(!1,{x:e.offsetX,y:e.offsetY,skeleton:this._skeleton,scene:this._scene}))return;let{x:l,y:u}=r.getCoordRelativeToViewport(mw.FromArray([n,i]));this._autoFillMoving(l,u),r.setCursor(WC.CROSSHAIR);let d=this._targetSelection;if(_&&a&&this._activeViewport?.viewportKey!==a?.viewportKey){let e;d.startRow===o?d.endRow===c?d.startColumn===s?(v.scrollTimerType=sE.X,e={...d,startColumn:d.endColumn}):(v.scrollTimerType=sE.X,e={...d,endColumn:d.startColumn}):(v.scrollTimerType=sE.Y,e={...d,startRow:d.endRow}):(v.scrollTimerType=sE.Y,e={...d,endRow:d.startRow}),this._isSelectionInViewport(e,a)&&(this._viewportMainScrollBarNeedResetPosition(v.scrollTimerType,this._activeViewport.viewportKey,a.viewportKey)&&_.scrollToBarPos({x:v.scrollTimerType===sE.X?0:void 0,y:v.scrollTimerType===sE.Y?0:void 0}),this._activeViewport=a)}v.scrolling(l,u,()=>{this._autoFillMoving(l,u)})}),this._scenePointerUpSub=r.onPointerUp$.subscribeEvent(()=>{var e,t;(e=this._helperSelection)==null||e.dispose();let n=this._scene;n.resetCursor(),this._clearObserverEvent(),n.enableObjectsEvent(),(t=this._scrollTimer)==null||t.dispose(),this._control.refreshSelectionFilled(this._targetSelection),this._isInMergeState=!1,this._controlHandler((e,t)=>{e.setProps({fill:this._fillControlColors[t]})}),this._fillControlColors=[]})}_viewportMainScrollBarNeedResetPosition(e,t,n){return!((e!==sE.X||t!==kw.VIEW_MAIN_LEFT&&t!==kw.VIEW_MAIN_LEFT_TOP||n!==kw.VIEW_MAIN&&n!==kw.VIEW_MAIN_TOP)&&(e!==sE.Y||t!==kw.VIEW_MAIN_TOP&&t!==kw.VIEW_MAIN_LEFT_TOP||n!==kw.VIEW_MAIN&&n!==kw.VIEW_MAIN_LEFT))}_hasMergeInRange(e,t,n,r){return this._skeleton.worksheet.getMergedCellRange(e,t,n,r).length>0}_swapPositions(e,t,n,r){return{startRow:Math.min(e,n),startColumn:Math.min(t,r),endRow:Math.max(e,n),endColumn:Math.max(t,r)}}_controlHandler(e){let{leftControl:t,rightControl:n,topControl:r,bottomControl:i,backgroundControlTop:a,backgroundControlMiddleLeft:o,backgroundControlMiddleRight:s,backgroundControlBottom:c,fillControl:l}=this._control,u=[t,n,r,i,a,o,s,c,l];for(let t=0,n=u.length;t<n;t++){let n=u[t];e(n,t)}}_fillRuler(e,t,n,r,i){let a=!1;if(e<t){if(this._isInMergeState&&e<t){let n=t-e,i=r+1,a=Math.ceil(n/i),o=t-a*i;o<0&&(o=t-(a-1)*i),t=o}else t=e}else if(e>=t&&e<=n)a=!0,this._isInMergeState||(n=e);else if(this._isInMergeState&&e>n){let t=e-n,a=r+1,o=Math.ceil(t/a),s=n+o*a;s>i&&(s=n+(o-1)*a),n=s}else n=e;return{rowOrColumn:e,startRowOrColumn:t,endRowOrColumn:n,isLighten:a}}_getScale(){let{scaleX:e,scaleY:t}=this._scene.getAncestorScale();return Math.max(e,t)}},H_t=.3,DZ=class extends F{constructor(e,t,n,r){super(),this._scene=e,this._zIndex=t,this._themeService=n,Q(this,`_isHelperSelection`,!0),Q(this,`_enableAutoFill`,!0),Q(this,`_showAutoFill`,!1),Q(this,`_highlightHeader`,!0),Q(this,`_selectionRenderModel`,void 0),Q(this,`_leftBorder`,void 0),Q(this,`_rightBorder`,void 0),Q(this,`_topBorder`,void 0),Q(this,`_bottomBorder`,void 0),Q(this,`_backgroundControlTop`,void 0),Q(this,`_backgroundControlBottom`,void 0),Q(this,`_backgroundControlMiddleLeft`,void 0),Q(this,`_backgroundControlMiddleRight`,void 0),Q(this,`_autoFillControl`,void 0),Q(this,`_selectionShapeGroup`,void 0),Q(this,`_rowHeaderBackground`,void 0),Q(this,`_rowHeaderBorder`,void 0),Q(this,`_rowHeaderGroup`,void 0),Q(this,`_columnHeaderBackground`,void 0),Q(this,`_columnHeaderBorder`,void 0),Q(this,`_columnHeaderGroup`,void 0),Q(this,`_dashedRect`,void 0),Q(this,`_topLeftWidget`,void 0),Q(this,`_topCenterWidget`,void 0),Q(this,`_topRightWidget`,void 0),Q(this,`_middleLeftWidget`,void 0),Q(this,`_middleRightWidget`,void 0),Q(this,`_bottomLeftWidget`,void 0),Q(this,`_bottomCenterWidget`,void 0),Q(this,`_bottomRightWidget`,void 0),Q(this,`_defaultStyle`,void 0),Q(this,`_currentStyle`,void 0),Q(this,`_rowHeaderWidth`,0),Q(this,`_columnHeaderHeight`,0),Q(this,`_rowHeaderOffsetX`,0),Q(this,`_columnHeaderOffsetY`,0),Q(this,`_widgetRects`,[]),Q(this,`_controlExtension`,void 0),Q(this,`_dispose$`,new oo(this)),Q(this,`dispose$`,this._dispose$.asObservable()),Q(this,`selectionMoving$`,new io),Q(this,`selectionMoveEnd$`,new io),Q(this,`selectionScaling$`,new io),Q(this,`selectionScaled$`,new io),Q(this,`selectionFilling$`,new io),Q(this,`_selectionFilled$`,new io),Q(this,`selectionFilled$`,this._selectionFilled$.asObservable()),Q(this,`_antLineOffset`,0),Q(this,`_antRequestNewFrame`,-1),this._enableAutoFill=r?.enableAutoFill??!0,this._highlightHeader=r?.highlightHeader??!0,this._rowHeaderWidth=r?.rowHeaderWidth??0,this._columnHeaderHeight=r?.columnHeaderHeight??0,this._rowHeaderOffsetX=r?.rowHeaderOffsetX??0,this._columnHeaderOffsetY=r?.columnHeaderOffsetY??0,this._initializeSheetBody(),this._initialHeader()}_initializeSheetBody(){this._defaultStyle=pZ(this._themeService),this._currentStyle=pZ(this._themeService),this._selectionRenderModel=new I_t;let e=this._zIndex;this._leftBorder=new $T(`__SpreadsheetSelectionShapeLeftControl__`+e,{zIndex:e}),this._rightBorder=new $T(`__SpreadsheetSelectionShapeRightControl__`+e,{zIndex:e}),this._topBorder=new $T(`__SpreadsheetSelectionTopControl__`+e,{zIndex:e}),this._bottomBorder=new $T(`__SpreadsheetSelectionBottomControl__`+e,{zIndex:e}),this._backgroundControlTop=new $T(`__SpreadsheetSelectionBackgroundControlTop__`+e,{zIndex:e-1,evented:!1}),this._backgroundControlBottom=new $T(`__SpreadsheetSelectionBackgroundControlBottom__`+e,{zIndex:e-1,evented:!1}),this._backgroundControlMiddleLeft=new $T(`__SpreadsheetSelectionBackgroundControlMiddleLeft__`+e,{zIndex:e-1,evented:!1}),this._backgroundControlMiddleRight=new $T(`__SpreadsheetSelectionBackgroundControlMiddleRight__`+e,{zIndex:e-1,evented:!1}),this._autoFillControl=new $T(`__SpreadsheetSelectionFillControl__`+e,{zIndex:e+1}),this._autoFillControl.hide(),this._dashedRect=new Nke(`__SpreadsheetDragDashControl__`+e,{zIndex:e+2,evented:!1,stroke:`#fff`});let t=[this._autoFillControl,this._leftBorder,this._rightBorder,this._topBorder,this._bottomBorder,this._backgroundControlTop,this._backgroundControlMiddleLeft,this._backgroundControlMiddleRight,this._backgroundControlBottom,this._dashedRect];this._widgetRects=this._initialWidget(),this._selectionShapeGroup=new iE(`__SpreadsheetSelectionShape__`+e,...t,...this._widgetRects),this._selectionShapeGroup.hide(),this._selectionShapeGroup.evented=!1,this._selectionShapeGroup.zIndex=e;let n=this.getScene();n.addObject(this._selectionShapeGroup,1),this.disposeWithMe(Hf(n.onTransformChange$.subscribeEvent(e=>{e.type===yw.scale&&(this._updateLayoutOfSelectionControl(this._currentStyle),this._updateControlCoord())})))}_initialHeader(){let e=this._zIndex;this._rowHeaderBackground=new $T(`__SpreadSheetSelectionRowHeaderBackground__`+e,{zIndex:e-1,evented:!1}),this._rowHeaderBorder=new $T(`__SpreadSheetSelectionRowHeaderBorder__`+e,{zIndex:e-1,evented:!1}),this._rowHeaderGroup=new iE(`__SpreadSheetSelectionRowHeaderGroup__`+e,this._rowHeaderBackground,this._rowHeaderBorder),this._rowHeaderGroup.hide(),this._rowHeaderGroup.evented=!1,this._rowHeaderGroup.zIndex=e,this._columnHeaderBackground=new $T(`__SpreadSheetSelectionColumnHeaderBackground__`+e,{zIndex:e-1,evented:!1}),this._columnHeaderBorder=new $T(`__SpreadSheetSelectionColumnHeaderBorder__`+e,{zIndex:e-1,evented:!1}),this._columnHeaderGroup=new iE(`__SpreadSheetSelectionColumnHeaderGroup__`+e,this._columnHeaderBackground,this._columnHeaderBorder),this._columnHeaderGroup.hide(),this._columnHeaderGroup.evented=!1,this._columnHeaderGroup.zIndex=e,this.getScene().addObjects([this._rowHeaderGroup,this._columnHeaderGroup],11)}_initialWidget(){let e=this._zIndex;return this._topLeftWidget=new $T(`__SpreadSheetSelectionTopLeftWidget__`+e,{zIndex:e+1}),this._topCenterWidget=new $T(`__SpreadSheetSelectionTopCenterWidget__`+e,{zIndex:e+1}),this._topRightWidget=new $T(`__SpreadSheetSelectionTopRightWidget__`+e,{zIndex:e+1}),this._middleLeftWidget=new $T(`__SpreadSheetSelectionMiddleLeftWidget__`+e,{zIndex:e+1}),this._middleRightWidget=new $T(`__SpreadSheetSelectionMiddleRightWidget__`+e,{zIndex:e+1}),this._bottomLeftWidget=new $T(`__SpreadSheetSelectionBottomLeftWidget__`+e,{zIndex:e+1}),this._bottomCenterWidget=new $T(`__SpreadSheetSelectionBottomCenterWidget__`+e,{zIndex:e+1}),this._bottomRightWidget=new $T(`__SpreadSheetSelectionBottomRightWidget__`+e,{zIndex:e+1}),[this._topLeftWidget,this._topCenterWidget,this._topRightWidget,this._middleLeftWidget,this._middleRightWidget,this._bottomLeftWidget,this._bottomCenterWidget,this._bottomRightWidget]}get zIndex(){return this._zIndex}get leftControl(){return this._leftBorder}get rightControl(){return this._rightBorder}get topControl(){return this._topBorder}get bottomControl(){return this._bottomBorder}get fillControl(){return this._autoFillControl}get backgroundControlTop(){return this._backgroundControlTop}get backgroundControlBottom(){return this._backgroundControlBottom}get backgroundControlMiddleLeft(){return this._backgroundControlMiddleLeft}get backgroundControlMiddleRight(){return this._backgroundControlMiddleRight}get selectionShape(){return this._selectionShapeGroup}get columnHeaderGroup(){return this._columnHeaderGroup}get rowHeaderGroup(){return this._rowHeaderGroup}get selectionShapeGroup(){return this._selectionShapeGroup}get model(){return this._selectionRenderModel}get topLeftWidget(){return this._topLeftWidget}get topCenterWidget(){return this._topCenterWidget}get topRightWidget(){return this._topRightWidget}get middleLeftWidget(){return this._middleLeftWidget}get middleRightWidget(){return this._middleRightWidget}get bottomLeftWidget(){return this._bottomLeftWidget}get bottomCenterWidget(){return this._bottomCenterWidget}get bottomRightWidget(){return this._bottomRightWidget}get themeService(){return this._themeService}get selectionModel(){return this._selectionRenderModel}set selectionModel(e){this._selectionRenderModel=e}get currentStyle(){return this._currentStyle}set currentStyle(e){this._currentStyle=e}get dashedRect(){return this._dashedRect}get isHelperSelection(){return this._isHelperSelection}get rowHeaderWidth(){return this._rowHeaderWidth}set rowHeaderWidth(e){this._rowHeaderWidth=e}get columnHeaderHeight(){return this._columnHeaderHeight}set columnHeaderHeight(e){this._columnHeaderHeight=e}setControlExtension(e){this._controlExtension=new V_t(this,e)}setControlExtensionDisable(e){this._controlExtension&&this._controlExtension.setDisabled(e)}setEvent(e){this.leftControl.evented=e,this.rightControl.evented=e,this.topControl.evented=e,this.bottomControl.evented=e}refreshSelectionFilled(e){this._selectionFilled$.next(e)}_updateLayoutOfSelectionControl(e){e&&(this.currentStyle=Object.assign({},this._defaultStyle,e));let t=this.currentStyle,{stroke:n,widgets:r,autofillStroke:i,strokeDash:a,isAnimationDash:o}=t,s=t.autofillSize,c=t.strokeWidth,l=t.autofillStrokeWidth,u=this._getScale(),d=(c+dK)/2/u;c/=u,s/=u,l/=u<1?1:u;let f=dK/u,p=qC/u,{startX:m,startY:h,endX:g,endY:_}=this._selectionRenderModel;if(this.leftControl.transformByState({height:_-h,left:-d+p,width:c,strokeWidth:f,top:-f/2+p}),this.leftControl.setProps({fill:n,stroke:fK}),this.rightControl.transformByState({height:_-h,left:g-m-d+p,width:c,strokeWidth:f,top:-f/2+p}),this.rightControl.setProps({fill:n,stroke:fK}),this.topControl.transformByState({width:g-m+c,top:-d+p,left:-d+p,height:c,strokeWidth:f}),this.topControl.setProps({fill:n,stroke:fK}),this.bottomControl.transformByState({width:g-m+c,top:_-h-d+p,height:c,left:-d+p,strokeWidth:f}),this.bottomControl.setProps({fill:n,stroke:fK}),a==null)this.dashedRect.hide(),this._stopAntLineAnimation();else{let e=t.strokeWidth*2/u;this.dashedRect.transformByState({height:_-h,width:g-m,strokeWidth:e,left:-e/2+p,top:-e/2+p}),this.dashedRect.setProps({strokeDashArray:[0,a/u]}),this._stopAntLineAnimation(),o!==!1&&this._startAntLineAnimation(),this.dashedRect.show()}if(this._showAutoFill=this._showAutoFill&&this._enableAutoFill,this._showAutoFill&&!this._hasWidgets(r)){let e={fill:n,stroke:i,strokeScaleEnabled:!1},t={width:s-l,height:s-l,left:g-m-s/2+l/2-p,top:_-h-s/2+l/2-p,strokeWidth:l};this._autoFillControl.setProps(e),this._autoFillControl.transformByState(t),this._autoFillControl.show()}else this._autoFillControl.hide();this._updateBackgroundControl(t),this._updateHeaderBackground(t),this._updateWidgets(t)}_updateControlCoord(){let{startX:e,startY:t}=this._selectionRenderModel;this.selectionShapeGroup.show(),this.selectionShapeGroup.translate(e,t),this.selectionShapeGroup.makeDirtyNoDebounce(!0)}updateStyle(e){this._updateLayoutOfSelectionControl(e),this._updateControlCoord()}updateRange(e,t){this._selectionRenderModel.setValue(e,t),this._showAutoFill=t!==null,this._updateLayoutOfSelectionControl(),this._updateControlCoord()}updateRangeBySelectionWithCoord(e,t){t&&(this._rowHeaderWidth=t.rowHeaderWidth,this._columnHeaderHeight=t.columnHeaderHeight,this._rowHeaderOffsetX=Math.max(0,t.rowHeaderWidthAndMarginLeft-t.rowHeaderWidth),this._columnHeaderOffsetY=Math.max(0,t.columnHeaderHeightAndMarginTop-t.columnHeaderHeight)),this._selectionRenderModel.setValue(e.rangeWithCoord,e.primaryWithCoord),this._showAutoFill=e.primaryWithCoord!==null,this._updateLayoutOfSelectionControl(e.style),this._updateControlCoord()}update(e,t=0,n=0,r,i){this._rowHeaderWidth=t,this._columnHeaderHeight=n,this._rowHeaderOffsetX=0,this._columnHeaderOffsetY=0,this.updateRangeBySelectionWithCoord({rangeWithCoord:e,primaryWithCoord:i,style:r}),r&&this.updateStyle(r)}updateCurrCell(e){this._showAutoFill=e!==null,this._selectionRenderModel.setCurrentCell(e)}clearHighlight(){this._showAutoFill=!1,this._selectionRenderModel.clearCurrentCell(),this._updateLayoutOfSelectionControl(this._currentStyle)}getScene(){return this._scene}dispose(){var e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w;(e=this._leftBorder)==null||e.dispose(),(t=this._rightBorder)==null||t.dispose(),(n=this._topBorder)==null||n.dispose(),(r=this._bottomBorder)==null||r.dispose(),(i=this._backgroundControlTop)==null||i.dispose(),(a=this._backgroundControlMiddleLeft)==null||a.dispose(),(o=this._backgroundControlMiddleRight)==null||o.dispose(),(s=this._backgroundControlBottom)==null||s.dispose(),this._autoFillControl.dispose(),(c=this._selectionShapeGroup)==null||c.dispose(),(l=this._rowHeaderBackground)==null||l.dispose(),(u=this._rowHeaderBorder)==null||u.dispose(),(d=this._rowHeaderGroup)==null||d.dispose(),(f=this._rowHeaderBackground)==null||f.dispose(),(p=this._columnHeaderBackground)==null||p.dispose(),(m=this._columnHeaderBorder)==null||m.dispose(),(h=this._columnHeaderGroup)==null||h.dispose(),(g=this._topLeftWidget)==null||g.dispose(),(_=this._topCenterWidget)==null||_.dispose(),(v=this._topRightWidget)==null||v.dispose(),(y=this._middleLeftWidget)==null||y.dispose(),(b=this._middleRightWidget)==null||b.dispose(),(x=this._bottomLeftWidget)==null||x.dispose(),(S=this._bottomCenterWidget)==null||S.dispose(),(C=this._bottomRightWidget)==null||C.dispose(),(w=this._controlExtension)==null||w.dispose(),super.dispose(),this._dispose$.next(this),this._dispose$.complete()}getCurrentCellInfo(){let e=this.model.currentCell;if(e){let t;if(e.isMerged){let n=e.mergeInfo;t={startRow:n.startRow,endRow:n.endRow,startColumn:n.startColumn,endColumn:n.endColumn,startX:n.startX,endX:n.endX,startY:n.startY,endY:n.endY}}else{let{actualRow:n,actualColumn:r,startX:i,endX:a,startY:o,endY:s}=e;t={startRow:n,endRow:n,startColumn:r,endColumn:r,startX:i,endX:a,startY:o,endY:s}}return t}}getValue(){return{...this._selectionRenderModel.getValue(),style:this._currentStyle}}getRange(){return this._selectionRenderModel.getValue().rangeWithCoord}enableHelperSelection(){this._isHelperSelection=!0}disableHelperSelection(){this._isHelperSelection=!1}_updateHeaderBackground(e){let{startX:t,startY:n,endX:r,endY:i,rangeType:a}=this._selectionRenderModel,o=this._currentStyle,s=this._getScale(),{stroke:c,rowHeaderFill:l=o.rowHeaderFill,rowHeaderStroke:u=o.rowHeaderStroke,columnHeaderFill:d=o.columnHeaderFill,columnHeaderStroke:f=o.columnHeaderStroke}=e,{rowHeaderStrokeWidth:p=o.rowHeaderStrokeWidth,columnHeaderStrokeWidth:m=o.columnHeaderStrokeWidth}=e;p/=s,m/=s;let h=this._rowHeaderWidth,g=this._columnHeaderHeight,_=this._rowHeaderOffsetX,v=this._columnHeaderOffsetY;if(this._highlightHeader&&g>0){let e=d;a===fh.COLUMN&&(e=new Zm(c).setAlpha(H_t).toString()),this._columnHeaderBackground.setProps({fill:e}),this._columnHeaderBackground.resize(r-t,g),this._columnHeaderBorder.setProps({fill:f}),this._columnHeaderBorder.transformByState({width:r-t,height:m,top:g-m+1/s}),this._columnHeaderGroup.show(),this._columnHeaderGroup.translate(t,v)}else this._columnHeaderGroup.hide();if(this._columnHeaderGroup.makeDirty(!0),this._highlightHeader&&h>0){let e=l;a===fh.ROW&&(e=new Zm(c).setAlpha(H_t).toString()),this._rowHeaderBackground.setProps({fill:e}),this._rowHeaderBackground.resize(h,i-n),this._rowHeaderBorder.setProps({fill:u}),this._rowHeaderBorder.transformByState({width:p,height:i-n,left:h-p+1/s}),this._rowHeaderGroup.show(),this._rowHeaderGroup.translate(_,n)}else this._rowHeaderGroup.hide();this._rowHeaderGroup.makeDirty(!0)}_updateBackgroundControl(e){let{startX:t,startY:n,endX:r,endY:i}=this._selectionRenderModel,a=this._getScale(),{fill:o=e.fill}=e,{strokeWidth:s}=e;s/=a;let c=this._selectionRenderModel.highlightToSelection();if(!c){this._backgroundControlTop.resize(r-t,i-n),this._backgroundControlTop.setProps({fill:o}),this._backgroundControlBottom.resize(0,0),this._backgroundControlMiddleLeft.resize(0,0),this._backgroundControlMiddleRight.resize(0,0);return}let{startX:l,startY:u,endX:d,endY:f}=c,p=s/2,m={left:-p,top:-p,width:r-t+p*2,height:u-n+p};m.height<0&&(m.width=0,m.height=0),this._backgroundControlTop.transformByState(m);let h={left:-p,top:u-n,width:l-t+p,height:f-u};h.width<0&&(h.width=0,h.height=0),this._backgroundControlMiddleLeft.transformByState(h);let g={left:d-t-p,top:u-n,width:r-d+p*2,height:f-u};g.width<0&&(g.width=0,g.height=0),this._backgroundControlMiddleRight.transformByState(g);let _={left:-p,top:f-n,width:r-t+p*2,height:i-f+p};_.height<0&&(_.width=0,_.height=0),this._backgroundControlBottom.transformByState(_),this._backgroundControlTop.setProps({fill:o}),this._backgroundControlMiddleLeft.setProps({fill:o}),this._backgroundControlMiddleRight.setProps({fill:o}),this._backgroundControlBottom.setProps({fill:o})}_updateWidgets(e){let{startX:t,startY:n,endX:r,endY:i}=this._selectionRenderModel,{stroke:a=e.stroke,widgets:o=e.widgets,widgetStroke:s=e.widgetStroke}=e,c=this._getScale(),{widgetSize:l,widgetStrokeWidth:u}=e;l/=c,u/=c;let d={left:-l/2+u/2,center:(r-t)/2-l/2+u/2,right:r-t-l/2+u/2,top:-l/2,middle:(i-n)/2-l/2,bottom:i-n-l/2+u/2},f=l-u;this._widgetRects.forEach(e=>{e.setProps({fill:a,stroke:s})}),o.tl===!0?(this._topLeftWidget.transformByState({height:f,width:f,left:d.left,top:d.top,strokeWidth:u}),this._topLeftWidget.show()):this._topLeftWidget.hide(),o.tc===!0?(this._topCenterWidget.transformByState({height:f,width:f,left:d.center,top:d.top,strokeWidth:u}),this._topCenterWidget.show()):this._topCenterWidget.hide(),o.tr===!0?(this._topRightWidget.transformByState({height:f,width:f,left:d.right,top:d.top,strokeWidth:u}),this._topRightWidget.show()):this._topRightWidget.hide(),o.ml===!0?(this._middleLeftWidget.transformByState({height:f,width:f,left:d.left,top:d.middle,strokeWidth:u}),this._middleLeftWidget.show()):this._middleLeftWidget.hide(),o.mr===!0?(this._middleRightWidget.transformByState({height:f,width:f,left:d.right,top:d.middle,strokeWidth:u}),this._middleRightWidget.show()):this._middleRightWidget.hide(),o.bl===!0?(this._bottomLeftWidget.transformByState({height:f,width:f,left:d.left,top:d.bottom,strokeWidth:u}),this._bottomLeftWidget.show()):this._bottomLeftWidget.hide(),o.bc===!0?(this._bottomCenterWidget.transformByState({height:f,width:f,left:d.center,top:d.bottom,strokeWidth:u}),this._bottomCenterWidget.show()):this._bottomCenterWidget.hide(),o.br===!0?(this._bottomRightWidget.transformByState({height:f,width:f,left:d.right,top:d.bottom,strokeWidth:u}),this._bottomRightWidget.show()):this._bottomRightWidget.hide()}_hasWidgets(e){if(e==null)return!1;let t=Object.keys(e);if(t.length===0)return!1;for(let n of t)if(e[n]===!0)return!0;return!1}_getScale(){let{scaleX:e,scaleY:t}=this._scene.getAncestorScale();return Math.max(e,t)}_stopAntLineAnimation(){this._antLineOffset=0,xCe(this._antRequestNewFrame)}_startAntLineAnimation(){let e=this._getScale();this._antLineOffset+=.6/e,this._antLineOffset>160/e&&(this._antLineOffset=0),this.dashedRect.setProps({strokeDashOffset:-this._antLineOffset}),this._antRequestNewFrame=XC(()=>{this._startAntLineAnimation()})}},U_t=1e4,OZ=se(`univer.mark-selection-service`),kZ=class extends F{constructor(e,t,n,r){super(),this._currentService=e,this._sheetSkeletonService=t,this._renderManagerService=n,this._themeService=r,Q(this,`_shapeMap`,new Map)}addShape(e,t=[],n=U_t){let r=this._currentService.getCurrentUnitOfType(N.UNIVER_SHEET),i=r.getActiveSheet()?.getSheetId();if(!i)return null;let a=np(),o={selection:e,subUnitId:i,unitId:r.getUnitId(),zIndex:n,control:null,exits:t};return this._shapeMap.set(a,o),this.refreshShapes(),a}addShapeWithNoFresh(e,t=[],n=U_t){let r=this._currentService.getCurrentUnitOfType(N.UNIVER_SHEET),i=r.getActiveSheet()?.getSheetId();if(!i)return null;let a=np();return this._shapeMap.set(a,{selection:e,subUnitId:i,unitId:r.getUnitId(),zIndex:n,control:null,exits:t}),a}refreshShapes(){let e=this._currentService.getCurrentUnitOfType(N.UNIVER_SHEET);if(!e)return;let t=e.getUnitId(),n=e.getActiveSheet()?.getSheetId();this._shapeMap.forEach(e=>{let{unitId:r,subUnitId:i,selection:a,control:o,zIndex:s}=e;if(o?.dispose(),r!==t||i!==n)return;let c=this._renderManagerService.getRenderById(r);if(!c)return;let l=this._sheetSkeletonService.getSkeleton(r,i);if(!l)return;let{scene:u}=c,{rowHeaderWidth:d,columnHeaderHeight:f}=l,p=new DZ(u,s,this._themeService,{enableAutoFill:!1,highlightHeader:!1,rowHeaderWidth:d,columnHeaderHeight:f}),m=tZ(a,l);p.updateRangeBySelectionWithCoord(m),e.control=p})}getShapeMap(){return this._shapeMap}removeShape(e){let t=this._shapeMap.get(e);if(!t)return;let{control:n}=t;n?.dispose(),this._shapeMap.delete(e)}removeAllShapes(){for(let e of this._shapeMap.values()){let{control:t}=e;t?.dispose()}this._shapeMap.clear()}};kZ=TZ([$(0,B),$(1,M(OK)),$(2,fE),$(3,M(Qb))],kZ);function W_t(e){return{strokeWidth:1.5,stroke:e.getColorFromTheme(`primary.600`),fill:`rgba(178, 178, 178, 0.10)`,widgets:{},strokeDash:8}}function G_t(e){if(e==null)return e;let t={};return e.p!==void 0&&(t.p=e.p===null?null:fb(e.p)),e.s!==void 0&&(t.s=e.s===null||typeof e.s==`string`?e.s:fb(e.s)),e.v!==void 0&&(t.v=e.v),e.t!==void 0&&(t.t=e.t),e.f!==void 0&&(t.f=e.f),e.ref!==void 0&&(t.ref=e.ref),e.xf!==void 0&&(t.xf=e.xf),e.si!==void 0&&(t.si=e.si),e.custom!==void 0&&(t.custom=e.custom===null?null:fb(e.custom)),e.rowSpan!==void 0&&(t.rowSpan=e.rowSpan),e.colSpan!==void 0&&(t.colSpan=e.colSpan),e.plain!==void 0&&(t.plain=e.plain),t}var K_t=10;function q_t(e){let t=e.match(/data-copy-id="([^\s]+)"/);return t&&t[1]?t[1]:null}var J_t=class{constructor(){Q(this,`_cache`,new Bg(K_t)),Q(this,`_lastCopyId$`,new oo(null)),Q(this,`lastCopyId$`,this._lastCopyId$.asObservable())}set(e,t){this._cache.set(e,t),this._lastCopyId$.next(e)}get(e){return this._cache.get(e)}del(e){this._cache.delete(e),this._lastCopyId$.getValue()===e&&this._lastCopyId$.next(null)}clear(){this._cache.clear(),this._lastCopyId$.next(null)}clearWithUnitId(e){this._cache.forEach((t,n)=>{t.unitId===e&&this._cache.delete(n)})}getLastCopyId(){return this._lastCopyId$.getValue()}};new J_t;function AZ(e,t){let n=t??e.style,r={},i=e.tagName.toLowerCase();switch(i){case`b`:case`em`:case`strong`:r.bl=jp.TRUE;break;case`s`:r.st={s:jp.TRUE};break;case`u`:r.ul={s:jp.TRUE};break;case`i`:r.it=jp.TRUE;break;case`sub`:case`sup`:r.va=i===`sup`?Ap.SUPERSCRIPT:Ap.SUBSCRIPT}return Y_t(n,r),r}function Y_t(e,t){if(e instanceof CSSStyleDeclaration)for(let n=0;n<e.length;n++){let r=e[n];X_t(r,e.getPropertyValue(r),t)}else for(let n in e){let r=e[n];X_t(n,r,t)}}function X_t(e,t,n){switch(e){case`font-family`:n.ff=t;break;case`font-size`:{let e=Number.parseInt(t);Number.isNaN(e)||(t.endsWith(`pt`)?n.fs=e:t.endsWith(`px`)&&(n.fs=e*.75));break}case`font-style`:t===`italic`&&(n.it=jp.TRUE);break;case`font-weight`:(Number(t)>400||t===`bold`)&&(n.bl=jp.TRUE);break;case`text-decoration`:/underline/.test(t)?n.ul={s:jp.TRUE}:/overline/.test(t)?n.ol={s:jp.TRUE}:/line-through/.test(t)&&(n.st={s:jp.TRUE});break;case`color`:try{let e=new Zm(t);e.isValid&&(n.cl={rgb:e.toRgbString()})}catch{}break;case`background-color`:{let e=new Zm(t);e.isValid&&(n.bg={rgb:e.toRgbString()});break}}}function Z_t(e){if(e.nodeType===Node.TEXT_NODE){e.textContent=(e.textContent||``).replace(/\r?\n[\t ]*/g,` `);return}e.childNodes.forEach(Z_t)}function Q_t(e){let t=document.implementation.createHTMLDocument(``),n=t.createRange();n.selectNodeContents(t.body);let r=n.createContextualFragment(e);return yYe(r,{strippedSelector:`script, iframe, object, embed`}),Z_t(r),t.body.append(r),t.body}function $_t(e){let t=e.style,n={};for(let e=0;e<t.length;e++){let r=t[e],i=t.getPropertyValue(r);switch(r){case`margin-top`:{let e=Number.parseInt(i);n.spaceAbove={v:/pt/.test(i)?lw(e):e};break}case`margin-bottom`:{let e=Number.parseInt(i);n.spaceBelow={v:/pt/.test(i)?lw(e):e};break}case`line-height`:n.lineSpacing=Number.parseFloat(i)}}return Object.getOwnPropertyNames(n).length?n:null}function jZ(e,t){let n=[];for(let t=0,r=e.length;t<r;t++)e[t]===kv.PARAGRAPH&&n.push({startIndex:t});if(t)for(let e of n)t.bullet&&(e.bullet=I.deepClone(t.bullet)),t.paragraphStyle&&(e.paragraphStyle=I.deepClone(t.paragraphStyle));return n}function evt(e,t,n){let r=t.length,i=(n?.length??0)===1&&n[0].st===0&&n[0].ed===r;if(e.p){var a;return i&&(a=e.p.body)!=null&&(a=a.textRuns)!=null&&a.length?(e.p.body.textRuns=[],{...e,s:n[0].ts}):e}return i?{...e,s:n[0].ts}:e}var tvt=[`color`,`background`,`font-size`,`text-align`,`vertical-align`,`font-weight`,`font-style`,`font-family`,`text-decoration`,`white-space`,`word-wrap`,`border-left`,`border-right`,`border-top`,`border-bottom`,`--data-rotate`];function nvt(e,t){let n=e.tagName.toLowerCase();return typeof t==`string`?n===t:Array.isArray(t)?t.some(e=>e===n):t(e)}var MZ=class e{static use(e){if(this._pluginList.includes(e))throw Error(`Univer paste plugin ${e.name} already added`);this._pluginList.push(e)}constructor(e){Q(this,`_styleMap`,new Map),Q(this,`_styleCache`,new Map),Q(this,`_styleRules`,[]),Q(this,`_afterProcessRules`,[]),Q(this,`_dom`,null),Q(this,`_msoNumfmtMap`,new Map),Q(this,`_getCurrentSkeleton`,void 0),this._getCurrentSkeleton=e.getCurrentSkeleton}convert(t){let n=e._pluginList.find(e=>e.checkPasteType(t));n&&(this._styleRules=[...n.stylesRules],this._afterProcessRules=[...n.afterProcessRules]);let r=new Mh;this._dom=Q_t(t);let i=this._dom.querySelector(`style`);if(i){this._parseMsoNumfmtFromCssText(i.textContent??``);let e=document.createElement(`div`),t=e.attachShadow({mode:`open`});document.body.appendChild(e),t.appendChild(i);for(let e of i.sheet.cssRules){let t=e,n=t.selectorText,r=t.style;this._styleMap.set(n,r)}i.remove(),e.remove()}let a={dataStream:``,textRuns:[]},o=[],s=[],c=t.match(/<table\b[^>]*>([\s\S]*?)<\/table>/gi);this.process(null,this._dom.childNodes,a,[]);let{paragraphs:l,dataStream:u,textRuns:d,payloads:f,customRanges:p}=a;if(l){let e=l.map(e=>e.startIndex+1);e.unshift(0);for(let t=0;t<e.length;t++){let n;if(t===e.length-1){if(n=`${u.substring(e[t])}\r\n`,n===`\r
608
608
  `)continue}else n=`${u.substring(e[t],e[t+1]-1)}\r\n`;let i=[];d?.forEach(n=>{n.st>=e[t]&&n.ed<=e[t+1]&&i.push({st:n.st-e[t],ed:n.ed-e[t],ts:n.ts})});let a=[];p?.forEach(n=>{n.startIndex>=e[t]&&n.endIndex<=e[t+1]&&a.push({...n,startIndex:n.startIndex-e[t],endIndex:n.endIndex-e[t]})});let s=this._generateDocumentDataModelSnapshot({body:{dataStream:n,textRuns:i,paragraphs:jZ(n),customRanges:a}}),c=Object.keys(r.getMatrix()).length===0;r.setValue(c?0:r.getLength(),0,{v:n,p:s}),o.push({})}}else if(u){let e=`${u}\r\n`,t={dataStream:e,textRuns:d,paragraphs:jZ(e),payloads:f,customRanges:p};if(!p?.length)r.setValue(0,0,evt({v:u},u,d));else{let e=this._generateDocumentDataModelSnapshot({body:t});r.setValue(0,0,evt({v:u,p:e},u,d))}o.push({})}return c&&c.forEach((e,t)=>{let n=r.getDataRange().endRow+1,{cellMatrix:i,rowProperties:a,colProperties:c}=this._parseTable(e,t);i&&i.forValue((e,t,i)=>{r.setValue(n+e,t,i)}),c&&s.push(...c),o.push(...a)}),this.dispose(),{rowProperties:o,colProperties:s,cellMatrix:r}}_parseMsoNumfmtFromCssText(e){let t=/([^{]+)\{([^}]*)\}/g,n;for(;(n=t.exec(e))!==null;){let e=n[1].trim(),t=n[2].match(/mso-number-format\s*:\s*("(?:[^"\\]|\\.)*"|[^;]+)/i);if(!t)continue;let r=t[1].trim();r.startsWith(`"`)&&r.endsWith(`"`)&&(r=r.slice(1,-1));let i=uvt(r);e.split(`,`).forEach(e=>{this._msoNumfmtMap.set(e.trim(),i)})}}_getMsoNumfmtForNode(e){for(let t of e.classList){let e=this._msoNumfmtMap.get(`.${t}`);if(e)return e}if(e.id){let t=this._msoNumfmtMap.get(`#${e.id}`);if(t)return t}return this._msoNumfmtMap.get(e.nodeName.toLowerCase())}_getStyleBySelectorText(e,t){return this._styleMap.get(e)?.getPropertyValue(t)||``}_getStyle(e,t){let n=ivt(t),r=e.style,i=``;for(let t=0;t<tvt.length;t++){let a=tvt[t];if(a===`background`){let t=``;e.classList.forEach(e=>{t=this._getStyleBySelectorText(`.${e}`,`background-color`)||this._getStyleBySelectorText(`.${e}`,a)});let o=r.getPropertyValue(`background-color`)||t||this._getStyleBySelectorText(`#${e.id}`,`background-color`)||this._getStyleBySelectorText(`#${e.id}`,a)||this._getStyleBySelectorText(e.nodeName.toLowerCase(),a)||this._getStyleBySelectorText(e.nodeName,`background-color`)||n[`background-color`]||``;o&&(i+=`background:${o};`);continue}if(a===`text-decoration`){let t=``;e.classList.forEach(e=>{t=this._getStyleBySelectorText(`.${e}`,`text-decoration-line`)||this._getStyleBySelectorText(`.${e}`,a)});let o=r.getPropertyValue(`text-decoration-line`)||r.getPropertyValue(`text-decoration`)||t||this._getStyleBySelectorText(`#${e.id}`,`text-decoration-line`)||this._getStyleBySelectorText(`#${e.id}`,a)||this._getStyleBySelectorText(e.nodeName.toLowerCase(),a)||this._getStyleBySelectorText(e.nodeName,`text-decoration-line`)||n[`text-decoration-line`]||``;o&&(i+=`text-decoration:${o};`);continue}let o=``;e.classList.forEach(e=>{o=this._getStyleBySelectorText(`.${e}`,a)}),o=r.getPropertyValue(a)||this._getStyleBySelectorText(`#${e.id}`,a)||o||this._getStyleBySelectorText(e.nodeName.toLowerCase(),a)||n[a]||``,o&&(i+=`${a}:${o};`)}return i}_parseTable(e,t){let n=new Mh,r=ovt(e)??[],{rowProperties:i=[]}=rvt(e),a=this._parseTableByHtml(this._dom,t,this._getCurrentSkeleton()?.skeleton);return a&&a.forValue((e,t,r)=>{var i,a;let o=QYe(void 0,r.style);if(r!=null&&(i=r.richTextParma)!=null&&(i=i.p)!=null&&(i=i.body)!=null&&(i=i.textRuns)!=null&&i.length){var s,c,l;let e=r==null||(s=r.richTextParma)==null||(s=s.v)==null?void 0:s.length;for(let t=0;t<(r==null||(c=r.richTextParma)==null||(c=c.p)==null||(c=c.body)==null||(c=c.textRuns)==null?void 0:c.length);t++){var u;let n=r==null||(u=r.richTextParma)==null||(u=u.p)==null||(u=u.body)==null?void 0:u.textRuns[t];if(n.st===0&&n.ed===e){var d;o={...n.ts,...o},r==null||(d=r.richTextParma)==null||(d=d.p)==null||(d=d.body)==null||d.textRuns.splice(t,1),t--}}if((r==null||(l=r.richTextParma)==null||(l=l.p)==null||(l=l.body)==null||(l=l.textRuns)==null?void 0:l.length)===0){var f;r.content=r==null||(f=r.richTextParma)==null?void 0:f.v,delete r.richTextParma}}let p=r!=null&&(a=r.richTextParma)!=null&&(a=a.p)!=null&&(a=a.body)!=null&&a.textRuns?{v:r.richTextParma.v,p:r.richTextParma.p,s:o,rowSpan:r.rowSpan,colSpan:r.colSpan}:{v:r.content,s:o,rowSpan:r.rowSpan,colSpan:r.colSpan};r.numfmtPattern&&(p.s={...p.s,n:{pattern:r.numfmtPattern}},p.v=Number(p.v)),n.setValue(e,t,p)}),{rowProperties:i,colProperties:r,cellMatrix:n}}_parseTableByHtml(e,t,n){let r=new Mh,i=e.querySelectorAll(`table`)[t];if(!i)return r;let a=this._getStyle(i,``),o=i?.querySelectorAll(`tr`);for(let e=0;e<o.length;e++){let t=o[e],i=this._getStyle(t,a),l=t.querySelectorAll(`td, th`),u=0;for(let t=0;t<l.length;){let a=l[t],o=``,d=Number(a.getAttribute(`rowSpan`))||1,f=Number(a.getAttribute(`colSpan`))||1;if(o=this._getStyle(a,i),e>0){var s;let t=r.getValue(e-1,u);if(t!=null&&(s=t.style)!=null&&s.includes(`border-bottom`)&&o.includes(`border-top`)){let e=cvt(t.style,`border-bottom`);e&&NM(e.substr(e.indexOf(`:`)+1))!==`none`&&(o=o.replace(/border-top:[^;]+;/,``))}}if(t>0){var c;let t=r.getValue(e,u-1);if(t!=null&&(c=t.style)!=null&&c.includes(`border-right`)&&o.includes(`border-left`)){let e=cvt(t.style,`border-right`);e&&NM(e.substr(e.indexOf(`:`)+1))!==`none`&&(o=o.replace(/border-left:[^;]+;/,``))}}let p=``,m,h,g=this._getMsoNumfmtForNode(a);if(g){p=a.innerHTML,p.includes(`mso-spacerun:yes`)&&(p=dvt(p));let e=wh(p);if(typeof e?.v==`number`&&(e.z===g||nd(g,e.v)===p))p=e.v.toString(),h=g;else if(e&&e.z)p=e.v.toString(),h=e.z;else if(!e){let e=fvt(p);e!==null&&!Number.isNaN(e)&&nd(g,e)===p&&(p=e.toString(),h=g)}}if(!h){let e=this._getCellTextAndRichText(a,o,n);p=e.cellText,m=e.cellRichStyle}let _={rowSpan:d,colSpan:f,content:p,style:o,richTextParma:{p:m,v:p},numfmtPattern:h};if(r.getValue(e,u)){u+=1;continue}d>1||f>1?lvt(r,o,_,{colSpan:f,rowSpan:d,rowIndex:e,colIndex:t,colSetValueIndex:u}):r.setValue(e,u,_),u+=f,t++}}return r}_parseCellHtml(e,t,n,r=new Map,i){for(let a of t)if(a.nodeType===Node.TEXT_NODE){let t=a.nodeValue?.replace(/[\r\n]/g,``),i;e&&r.has(e)&&(i=r.get(e)),n.dataStream+=t,i&&Object.getOwnPropertyNames(i).length&&n.textRuns.push({st:n.dataStream.length-t.length,ed:n.dataStream.length,ts:i})}else if(a.nodeType===Node.COMMENT_NODE||a.nodeName===`STYLE`)continue;else if(a.nodeName.toLowerCase()===`br`)n.paragraphs||=[],n.paragraphs.push({startIndex:n.dataStream.length}),n.dataStream+=`\r`;else if(a.nodeType===Node.ELEMENT_NODE){let t=this._getStyle(a,i),o=e?r.get(e):{},s=AZ(a,ivt(t));r.set(a,{...o,...s});let{childNodes:c}=a;this._parseCellHtml(a,c,n,r,t)}}_getCellTextAndRichText(e,t,n){if(e.innerHTML.includes(`mso-spacerun:yes`)){let t=dvt(e.innerHTML),n=wh(t);if(n&&n.z&&typeof n.v==`number`)return{cellText:t,cellRichStyle:void 0}}let r=``,i;if(/<[^>]+>/.test(e.innerHTML)&&n){let a={dataStream:``,textRuns:[]};this._parseCellHtml(null,e.childNodes,a,void 0,t);let o=n.getBlankCellDocumentModel()?.documentModel,s=o?.getSnapshot(),c=`${a.dataStream}\r\n`,l={...s,body:{dataStream:c,textRuns:a.textRuns,paragraphs:jZ(c)}};o?.reset(l),i=o?.getSnapshot(),r=a.dataStream}else r=svt(e.innerHTML.replace(/[\r\n]/g,``));return{cellText:r,cellRichStyle:i}}_generateDocumentDataModelSnapshot(e){let t=this._getCurrentSkeleton();if(t==null)return null;let{skeleton:n}=t,r=n.getBlankCellDocumentModel()?.documentModel,i={...r?.getSnapshot(),...e};return r?.reset(i),r?.getSnapshot()}process(e,t,n,r){for(let a of t)if(a.nodeName.toLowerCase()===`table`){var i;r.push({index:(n==null||(i=n.paragraphs)==null?void 0:i.length)||0})}else if(a.nodeType===Node.TEXT_NODE){if(a.nodeValue?.trim()===``)continue;let t=a.nodeValue?.replace(/[\r\n]/g,``),r;e&&this._styleCache.has(e)&&(r=this._styleCache.get(e));let i={dataStream:``,textRuns:[]};n.dataStream+=t,i.dataStream+=t,r&&Object.getOwnPropertyNames(r).length&&(n.textRuns.push({st:n.dataStream.length-t.length,ed:n.dataStream.length,ts:r}),i.textRuns.push({st:n.dataStream.length-t.length,ed:n.dataStream.length,ts:r}))}else if(_x.includes(a.nodeName.toLowerCase()))continue;else if(a.nodeName.toLowerCase()===`br`)n.paragraphs||=[],n.paragraphs.push({startIndex:n.dataStream.length}),n.dataStream+=`\r`;else if(a.nodeType===Node.ELEMENT_NODE){if(a.nodeName===`STYLE`)continue;let t=a,i=this._processBeforeLink(t,{body:n}),o=e?this._styleCache.get(e):{},s=this._styleRules.find(({filter:e})=>nvt(a,e)),c=s?s.getStyle(a):AZ(a);this._styleCache.set(a,{...o,...c});let{childNodes:l}=a;this.process(a,l,n,r);let u=this._afterProcessRules.find(({filter:e})=>nvt(a,e));u&&u.handler(n,a),this._processAfterLink(t,{body:n},i)}}_processBeforeLink(e,t){return t.body.dataStream.length}_processAfterLink(e,t,n){let r=t.body,i=e;if(i.tagName.toUpperCase()===`A`){let e=i.href;if(!Qf(e))return;r.customRanges=r.customRanges??[],r.customRanges.push({startIndex:n,endIndex:r.dataStream.length-1,rangeId:i.dataset.rangeid??np(),rangeType:Ip.HYPERLINK,properties:{url:e}})}}dispose(){this._dom=null,this._styleCache.clear(),this._styleMap.clear(),this._msoNumfmtMap.clear()}};Q(MZ,`_pluginList`,[]);function rvt(e){let t=e.matchAll(/<tr([\s\S]*?)>([\s\S]*?)<\/tr>/gi);if(!t)return{rowProperties:[],rowCount:0};let n=Array.from(t).map(e=>avt(e[1])).map(e=>{if(!e.height){let t=e.style,n=t&&t.match(/height\s*:\s*(\d+(\.\d+)?)px/);e.height=`${n?Number.parseInt(n[1],10):24}`}return e});return{rowProperties:n,rowCount:n.length}}function ivt(e){let t={};return e.split(`;`).forEach(e=>{let[n,r]=e.split(`:`);t[n]=r}),t}function avt(e){if(!e)return{};let t={},n=/([\w-]+)\s*=\s*(?:(['"])([^'"]*)\2|(\S+))/g,r;for(;(r=n.exec(e))!==null;){let[,e,,n,i]=r;t[e]=n===void 0?i:n}return t}function ovt(e){let t=e.match(/<colgroup([\s\S]*?)>(.*?)<\/colgroup>/),n=/<col([\s\S]*?)>/g,r;if(r=t?.[2]?t[2].matchAll(n):e.matchAll(n),!r)return null;let i=Array.from(r).map(e=>avt(e[1])),a=[];return i.forEach(e=>{let t=Number(e.span);if(t)for(let n=0;n<t;n++){let t={...e};delete t.span,a.push(t)}else a.push(e)}),a}function svt(e){let t={"&lt;":`<`,"&gt;":`>`,"&amp;":`&`,"&quot;":`"`,"&#39;":`'`,"&nbsp;":` `};return e.replace(/&lt;|&gt;|&amp;|&quot;|&#39;|&nbsp;|<br>/g,e=>t[e])}function cvt(e,t){if(!e||!t)return null;let n=RegExp(`(${t}\\s*:\\s*[^;]+);`,`i`),r=e.match(n);return r?r[1]:null}function lvt(e,t,n,r){let{rowSpan:i,colSpan:a,rowIndex:o,colSetValueIndex:s}=r;for(let r=o;r<o+i;r++)for(let i=s;i<s+a;i++)r===o&&i===s?e.setValue(r,i,{...n,style:t}):e.setValue(r,i,{style:t})}function uvt(e){let t=e.replace(/\\([0-9a-fA-F]{4})/g,(e,t)=>String.fromCharCode(Number.parseInt(t,16)));return t=t.replace(/\\\\/g,`\0BACKSLASH\0`),t=t.replace(/\\([^\\])/g,`$1`),t=t.replace(/\x00BACKSLASH\x00/g,`\\`),t}function dvt(e){return e.replace(/<span[^>]*mso-spacerun:yes[^>]*>/gi,``).replace(/<\/span>/gi,``).replace(/\u00A0|&nbsp;/gi,``)}function fvt(e){let t=e.match(/\(?-?\d[\d,]*(\.\d+)?%?\)?/);if(!t)return null;let n=t[0],r=n.includes(`%`);n=n.replace(/[,%]/g,``),/^\(.*\)$/.test(n)&&(n=`-${n.slice(1,-1)}`);let i=Number(n);return r&&(i/=100),i}var pvt={name:`univer-sheet-paste-plugin-lark`,checkPasteType(e){return/lark-record-clipboard/i.test(e)},stylesRules:[{filter:[`s`],getStyle(e){let t=AZ(e);return{st:{s:jp.TRUE},...t}}}],afterProcessRules:[{filter(e){return e.tagName===`DIV`&&/ace-line/i.test(e.className)},handler(e){e.paragraphs??=[],e.paragraphs.push({startIndex:e.dataStream.length}),e.dataStream+=`\r`}}]},mvt={name:`univer-sheet-paste-plugin-univer`,checkPasteType(e){return/UniverNormal/i.test(e)},stylesRules:[],afterProcessRules:[{filter(e){return e.tagName===`P`&&/UniverNormal/i.test(e.className)},handler(e,t){e.paragraphs??=[];let n={startIndex:e.dataStream.length},r=$_t(t);r&&(n.paragraphStyle=r),e.paragraphs.push(n),e.dataStream+=`\r`}}]},hvt={name:`univer-sheet-paste-plugin-word`,checkPasteType(e){return/word|mso/i.test(e)},stylesRules:[{filter:[`b`],getStyle(e){let t=AZ(e);return{bl:jp.TRUE,...t}}}],afterProcessRules:[{filter(e){return e.tagName===`P`&&/mso/i.test(e.className)},handler(e,t){e.paragraphs??=[];let n={startIndex:e.dataStream.length},r=$_t(t);r&&(n.paragraphStyle=r),e.paragraphs.push(n),e.dataStream+=`\r`}}]},NZ=function(e){return e.COPY=`COPY`,e.CUT=`CUT`,e}({});function gvt(e,t,n,r,i){return`<tr${FZ(PZ(n.map(t=>t.onCopyRow?.call(t,e)).filter(e=>!!e)))}>${t.map(t=>{if(!i.has(`${e}-${t}`)){let a=r.getValue(e,t);if(a?.rowSpan&&a?.colSpan)for(let n=e;n<e+a.rowSpan;n++)for(let e=t;e<t+a.colSpan;e++)i.add(`${n}-${e}`);return _vt(e,t,n,r)}return null}).filter(e=>!!e).join(``)}</tr>`}function _vt(e,t,n,r){let i=r.getValue(e,t);return`<td${FZ(PZ(n.map(n=>n.onCopyCellStyle?.call(n,e,t,i?.rowSpan,i?.colSpan)).filter(e=>!!e)))}>${n.reduce((n,r)=>n||r.onCopyCellContent?.call(r,e,t)||``,``)}</td>`}function vvt(e,t){return`<colgroup>${e.map(e=>`<col ${FZ(PZ(t.map(t=>t.onCopyColumn?.call(t,e)).filter(e=>!!e)))} />`).join(``)}</colgroup>`}function PZ(e){return e.reduce((e,t)=>(Object.keys(t).forEach(n=>{e[n]?e[n]+=`;${t[n]}`:e[n]=t[n]}),e),{})}function FZ(e){return Object.keys(e).reduce((t,n)=>`${t} ${n}="${e[n]}"`,``)}var yvt=class{convert(e,t,n,r){let{cols:i,rows:a}=t;if(!i.length)return``;let o=vvt(i,n),s=[],c=new Set;return a.forEach(t=>{s.push(gvt(t,i,n,e,c))}),`<google-sheets-html-origin><table data-copy-id="${r}" xmlns="http://www.w3.org/1999/xhtml" cellspacing="0" cellpadding="0" dir="ltr" style="table-layout:fixed;font-size:10pt;font-family:Arial;width:0px;border-collapse:collapse;border:none">${o}
609
609
  <tbody>${s.join(``)}</tbody></table>`}},bvt=(e,t,n=!1)=>{let r=e=>e.endRow-e.startRow+1,i=e=>e.endColumn-e.startColumn+1,a=r(t)%r(e),o=i(t)%i(e),s={startRow:0,endRow:r(e)-1,startColumn:0,endColumn:i(e)-1},c=Math.floor(r(t)/r(e)),l=Math.floor(i(t)/i(e)),u=[];if(!a&&!o)for(let n=1;n<=c;n++)for(let a=1;a<=l;a++){let o=r(e)*(n-1),c=i(e)*(a-1),l={startRow:o+t.startRow,endRow:o+t.startRow,startColumn:c+t.startColumn,endColumn:c+t.startColumn};u.push({repeatRelativeRange:s,startRange:l})}else if(!a&&o&&!n)for(let n=1;n<=c;n++){let i=r(e)*(n-1),a={startRow:i+t.startRow,endRow:i+t.startRow,startColumn:0+t.startColumn,endColumn:0+t.startColumn};u.push({repeatRelativeRange:s,startRange:a})}else if(a&&!o&&!n)for(let n=1;n<=l;n++){let r=i(e)*(n-1),a={startRow:0+t.startRow,endRow:0+t.startRow,startColumn:r+t.startColumn,endColumn:r+t.startColumn};u.push({repeatRelativeRange:s,startRange:a})}else{let e={startRow:t.startRow,endRow:t.startRow,startColumn:t.startColumn,endColumn:t.startColumn};u.push({startRange:e,repeatRelativeRange:s})}return u};function xvt(e){return e?[/<td[^>]*class=".*?xl.*?"[^>]*>/i,/xmlns:x="urn:schemas-microsoft-com:office:excel"/i,/ProgId="Excel.Sheet"/i,/xmlns:o="urn:schemas-microsoft-com:office:office"/i,/@mso-|mso-excel/i,/<x:ExcelWorkbook>/i].some(t=>t.test(e)):!1}function Svt(e){return e?(e.match(/<img[^>]*src\s*=\s*["']data:image\/[^;]+;base64,[^"']*["'][^>]*>/i)||[]).length>0:!1}function Cvt(...e){if(e.length===1)return e[0];let t=new Mh;return e.forEach(e=>{e&&new Mh(e).forValue((e,n,r)=>{t.setValue(e,n,{...t.getValue(e,n),...r})})}),t.getMatrix()}function wvt(e,t){return e.id===t.id&&e.params.unitId===t.params.unitId&&e.params.subUnitId===t.params.subUnitId}function Tvt(e){let t=[];for(let n=0;n<e.length;){let r=1;if(e[n].id===WG.id){let i=e[n],a=[i];for(;n+r<e.length&&wvt(i,e[n+r]);)a.push(e[n+r]),r+=1;let o=Cvt(...a.map(e=>e.params.cellValue||{}));t.push({...i,params:{...i.params,cellValue:o}})}else t.push(e[n]);n+=r}return t}function Evt(e,t={}){let{maxCellsPerChunk:n=2500,threshold:r=6e3,maxChunks:i=10}=t;if(e.id!==WG.id)return[e];let{cellValue:a}=e.params;if(!a)return[e];let o=new Mh(a),s=0,c=1/0,l=-1/0,u=1/0,d=-1/0;if(o.forValue((e,t)=>{s++,c=Math.min(c,e),l=Math.max(l,e),u=Math.min(u,t),d=Math.max(d,t)}),c===1/0||s<=r)return[e];let f=[],p=d-u+1,m=Math.max(1,Math.floor(n/p)),h=l-c+1;Math.ceil(h/m)>i&&(m=Math.ceil(h/i));for(let t=c;t<=l;t+=m){let n=Math.min(t+m-1,l),r=new Mh,i=!1;for(let e=t;e<=n;e++)for(let t=u;t<=d;t++){let n=o.getValue(e,t);n!==void 0&&(r.setValue(e,t,n),i=!0)}i&&f.push({...e,params:{...e.params,cellValue:r.getMatrix(),__splitChunk__:!0}})}return f.length>0?f:[e]}function IZ(e,t){let{startRow:n,endRow:r,startColumn:i,endColumn:a}=e;for(let e=n;e<=r;e++)for(let n=i;n<=a;n++)if(t.rows.includes(e)&&t.cols.includes(n))return!0}function Dvt(e,t){let{startRow:n,endRow:r,startColumn:i,endColumn:a}=t;for(let t=n;t<=r;t++)if(!e.rows.includes(t))return!1;for(let t=i;t<=a;t++)if(!e.cols.includes(t))return!1;return!0}function Ovt(e){let t=e.trim().split(`