/*!
 * Copyright (c) HANDSONCODE sp. z o. o.
 * 
 * HANDSONTABLE is a software distributed by HANDSONCODE sp. z o. o., a Polish corporation based in
 * Gdynia, Poland, at Aleja Zwyciestwa 96-98, registered by the District Court in Gdansk under number
 * 538651, EU tax ID number: PL5862294002, share capital: PLN 67,200.00.
 * 
 * This software is protected by applicable copyright laws, including international treaties, and dual-
 * licensed - depending on whether your use for commercial purposes, meaning intended for or
 * resulting in commercial advantage or monetary compensation, or not.
 * 
 * If your use is strictly personal or solely for evaluation purposes, meaning for the purposes of testing
 * the suitability, performance, and usefulness of this software outside the production environment,
 * you agree to be bound by the terms included in the "handsontable-non-commercial-license.pdf" file.
 * 
 * Your use of this software for commercial purposes is subject to the terms included in an applicable
 * license agreement.
 * 
 * In any case, you must not make any such use of this software as to develop software which may be
 * considered competitive with this software.
 * 
 * UNLESS EXPRESSLY AGREED OTHERWISE, HANDSONCODE PROVIDES THIS SOFTWARE ON AN "AS IS"
 * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, AND IN NO EVENT AND UNDER NO
 * LEGAL THEORY, SHALL HANDSONCODE BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY DIRECT,
 * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER ARISING FROM
 * USE OR INABILITY TO USE THIS SOFTWARE.
 * 
 * Version: 18.1.0
 * Release date: 01/09/2026 (built at 01/09/2026 11:40:25)
 */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("Handsontable",[],t):"object"==typeof exports?exports.Handsontable=t():e.Handsontable=t()}("u">typeof self?self:this,()=>(()=>{var e={603(e,t,r){"use strict";r.r(t),r.d(t,{EOF:()=>ev,LexerDefinitionErrorType:()=>C,NoViableAltException:()=>t_,Parser:()=>rs,resolveGrammar:()=>tE,defaultParserErrorProvider:()=>ty,EarlyExitException:()=>tP,CstParser:()=>ra,Option:()=>eN,createSyntaxDiagramsCode:()=>rh,Alternation:()=>eL,assignOccurrenceIndices:()=>tA,ParserDefinitionErrorType:()=>S,GAstVisitor:()=>eU,Rule:()=>eI,defaultGrammarValidatorErrorProvider:()=>tS,defaultGrammarResolverErrorProvider:()=>tw,tokenMatcher:()=>eE,clearCache:()=>rb,RepetitionMandatory:()=>eO,Terminal:()=>eP,RepetitionMandatoryWithSeparator:()=>ek,createTokenInstance:()=>eR,RepetitionWithSeparator:()=>e_,defaultLexerErrorProvider:()=>es,MismatchedTokenException:()=>tH,Repetition:()=>eH,tokenLabel:()=>eh,validateGrammar:()=>tT,NotAllInputParsedException:()=>tL,tokenName:()=>ed,Lexer:()=>el,generateParserModule:()=>rf,NonTerminal:()=>eM,EMPTY_ALT:()=>ri,generateParserFactory:()=>rm,EmbeddedActionsParser:()=>rl,isRecognitionException:()=>tk,createToken:()=>ew,serializeGrammar:()=>eD,Flat:()=>ex,serializeProduction:()=>eF,VERSION:()=>v});var n,o,i,s,a,l,h,d,u,c,g,p,m,f,b,C,y,w,S,v="6.5.0",R=r(642),E=r(713),T={},A=new E.RegExpParser;function M(e){var t=e.toString();if(T.hasOwnProperty(t))return T[t];var r=A.pattern(t);return T[t]=r,r}var I=(n=function(e,t){return(n=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),x="Complement Sets are not supported for first char optimization",N='Unable to use "first char" lexer optimizations:\n';function O(e,t,r){var n=X(e);t[n]=n,!0===r&&function(e,t){var r=String.fromCharCode(e),n=r.toUpperCase();if(n!==r){var o=X(n.charCodeAt(0));t[o]=o}else{var i=r.toLowerCase();if(i!==r){var o=X(i.charCodeAt(0));t[o]=o}}}(e,t)}function k(e,t){return(0,R.I6)(e.value,function(e){return"number"==typeof e?(0,R.gR)(t,e):void 0!==(0,R.I6)(t,function(t){return e.from<=t&&t<=e.to})})}var H=function(e){function t(t){var r=e.call(this)||this;return r.targetCharCodes=t,r.found=!1,r}return I(t,e),t.prototype.visitChildren=function(t){if(!0!==this.found){switch(t.type){case"Lookahead":this.visitLookahead(t);return;case"NegativeLookahead":this.visitNegativeLookahead(t);return}e.prototype.visitChildren.call(this,t)}},t.prototype.visitCharacter=function(e){(0,R.gR)(this.targetCharCodes,e.value)&&(this.found=!0)},t.prototype.visitSet=function(e){e.complement?void 0===k(e,this.targetCharCodes)&&(this.found=!0):void 0!==k(e,this.targetCharCodes)&&(this.found=!0)},t}(E.BaseRegExpVisitor);function _(e,t){if(!(t instanceof RegExp))return void 0!==(0,R.I6)(t,function(t){return(0,R.gR)(e,t.charCodeAt(0))});var r=M(t),n=new H(e);return n.visit(r),n.found}var L=(o=function(e,t){return(o=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),P="PATTERN",D="defaultMode",F="modes",B="boolean"==typeof RegExp("(?:)").sticky,V=/[^\\][\$]/,U=/[^\\[][\^]|^\^/;function z(e){var t=e.ignoreCase?"i":"";return RegExp("^(?:"+e.source+")",t)}function W(e){var t=e.ignoreCase?"iy":"y";return RegExp(""+e.source,t)}function G(e){var t=e.PATTERN;if((0,R.gd)(t))return!1;if((0,R.Tn)(t))return!0;if((0,R.zy)(t,"exec"))return!0;if((0,R.Kg)(t))return!1;throw Error("non exhaustive match")}function $(e){return!!(0,R.Kg)(e)&&1===e.length&&e.charCodeAt(0)}var Y={test:function(e){for(var t=e.length,r=this.lastIndex;r<t;r++){var n=e.charCodeAt(r);if(10===n)return this.lastIndex=r+1,!0;if(13===n)return 10===e.charCodeAt(r+1)?this.lastIndex=r+2:this.lastIndex=r+1,!0}return!1},lastIndex:0};function j(e,t){if((0,R.zy)(e,"LINE_BREAKS"))return!1;if((0,R.gd)(e.PATTERN)){try{_(t,e.PATTERN)}catch(e){return{issue:C.IDENTIFY_TERMINATOR,errMsg:e.message}}return!1}if((0,R.Kg)(e.PATTERN))return!1;if(G(e))return{issue:C.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}function q(e){return(0,R.Tj)(e,function(e){return(0,R.Kg)(e)&&e.length>0?e.charCodeAt(0):e})}function K(e,t,r){void 0===e[t]?e[t]=[r]:e[t].push(r)}function X(e){return e<256?e:Q[e]}var Q=[];function Z(e,t){var r=e.tokenTypeIdx;return r===t.tokenTypeIdx||!0===t.isParent&&!0===t.categoryMatchesMap[r]}function J(e,t){return e.tokenTypeIdx===t.tokenTypeIdx}var ee=1,et={};function er(e){var t,r,n,o=function(e){for(var t=(0,R.T9)(e),r=e,n=!0;n;){r=(0,R.oE)((0,R.Bq)((0,R.Tj)(r,function(e){return e.CATEGORIES})));var o=(0,R.iv)(r,t);t=t.concat(o),(0,R.Im)(o)?n=!1:r=o}return t}(e);t=o,(0,R.jJ)(t,function(e){var t,r;en(e)||(et[ee]=e,e.tokenTypeIdx=ee++),eo(e)&&!(0,R.cy)(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),eo(e)||(e.CATEGORIES=[]),t=e,(0,R.zy)(t,"categoryMatches")||(e.categoryMatches=[]),r=e,(0,R.zy)(r,"categoryMatchesMap")||(e.categoryMatchesMap={})}),r=o,(0,R.jJ)(r,function(e){!function e(t,r){(0,R.jJ)(t,function(e){r.categoryMatchesMap[e.tokenTypeIdx]=!0}),(0,R.jJ)(r.CATEGORIES,function(n){var o=t.concat(r);(0,R.gR)(o,n)||e(o,n)})}([],e)}),n=o,(0,R.jJ)(n,function(e){e.categoryMatches=[],(0,R.jJ)(e.categoryMatchesMap,function(t,r){e.categoryMatches.push(et[r].tokenTypeIdx)})}),(0,R.jJ)(o,function(e){e.isParent=e.categoryMatches.length>0})}function en(e){return(0,R.zy)(e,"tokenTypeIdx")}function eo(e){return(0,R.zy)(e,"CATEGORIES")}function ei(e){return(0,R.zy)(e,"tokenTypeIdx")}var es={buildUnableToPopLexerModeMessage:function(e){return"Unable to pop Lexer Mode after encountering Token ->"+e.image+"<- The Mode Stack is empty"},buildUnexpectedCharactersMessage:function(e,t,r,n,o){return"unexpected character: ->"+e.charAt(t)+"<- at offset: "+t+", skipped "+r+" characters."}};(i=C||(C={}))[i.MISSING_PATTERN=0]="MISSING_PATTERN",i[i.INVALID_PATTERN=1]="INVALID_PATTERN",i[i.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",i[i.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",i[i.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",i[i.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",i[i.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",i[i.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",i[i.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",i[i.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",i[i.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",i[i.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",i[i.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",i[i.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",i[i.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",i[i.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",i[i.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK";var ea={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:["\n","\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:es,traceInitPerf:!1,skipValidations:!1};Object.freeze(ea);var el=function(){function e(e,t){var r=this;if(void 0===t&&(t=ea),this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.config=void 0,this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},"boolean"==typeof t)throw Error("The second argument to the Lexer constructor is now an ILexerConfig Object.\na boolean 2nd argument is no longer supported");this.config=(0,R.h1)(ea,t);var n=this.config.traceInitPerf;!0===n?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):"number"==typeof n&&(this.traceInitMaxIdent=n,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",function(){var n,o=!0;r.TRACE_INIT("Lexer Config handling",function(){if(r.config.lineTerminatorsPattern===ea.lineTerminatorsPattern)r.config.lineTerminatorsPattern=Y;else if(r.config.lineTerminatorCharacters===ea.lineTerminatorCharacters)throw Error("Error: Missing <lineTerminatorCharacters> property on the Lexer config.\n	For details See: https://sap.github.io/chevrotain/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS");if(t.safeMode&&t.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');r.trackStartLines=/full|onlyStart/i.test(r.config.positionTracking),r.trackEndLines=/full/i.test(r.config.positionTracking),(0,R.cy)(e)?((n={modes:{}}).modes[D]=(0,R.T9)(e),n[D]=D):(o=!1,n=(0,R.lR)(e))}),!1===r.config.skipValidations&&(r.TRACE_INIT("performRuntimeChecks",function(){var e,t;r.lexerDefinitionErrors=r.lexerDefinitionErrors.concat((e=n,r.trackStartLines,r.config.lineTerminatorCharacters,t=[],(0,R.zy)(e,D)||t.push({message:"A MultiMode Lexer cannot be initialized without a <"+D+"> property in its definition\n",type:C.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),(0,R.zy)(e,F)||t.push({message:"A MultiMode Lexer cannot be initialized without a <"+F+"> property in its definition\n",type:C.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),(0,R.zy)(e,F)&&(0,R.zy)(e,D)&&!(0,R.zy)(e.modes,e.defaultMode)&&t.push({message:"A MultiMode Lexer cannot be initialized with a "+D+": <"+e.defaultMode+">which does not exist\n",type:C.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),(0,R.zy)(e,F)&&(0,R.jJ)(e.modes,function(e,r){(0,R.jJ)(e,function(e,n){(0,R.b0)(e)&&t.push({message:"A Lexer cannot be initialized using an undefined Token Type. Mode:"+("<"+r+"> at index: <")+n+">\n",type:C.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED})})}),t))}),r.TRACE_INIT("performWarningRuntimeChecks",function(){var e,t,o,i,s,a,l,h;r.lexerDefinitionWarning=r.lexerDefinitionWarning.concat((e=n,t=r.trackStartLines,o=r.config.lineTerminatorCharacters,i=[],s=!1,a=(0,R.oE)((0,R.Bq)((0,R.LG)(e.modes,function(e){return e}))),l=(0,R.ku)(a,function(e){return e[P]===el.NA}),h=q(o),t&&(0,R.jJ)(l,function(e){var t=j(e,h);if(!1!==t){var r={message:function(e,t){if(t.issue===C.IDENTIFY_TERMINATOR)return"Warning: unable to identify line terminator usage in pattern.\n	The problem is in the <"+e.name+"> Token Type\n	 Root cause: "+t.errMsg+".\n	For details See: https://sap.github.io/chevrotain/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR";if(t.issue===C.CUSTOM_LINE_BREAK)return"Warning: A Custom Token Pattern should specify the <line_breaks> option.\n	The problem is in the <"+e.name+"> Token Type\n	For details See: https://sap.github.io/chevrotain/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK";throw Error("non exhaustive match")}(e,t),type:t.issue,tokenType:e};i.push(r)}else(0,R.zy)(e,"LINE_BREAKS")?!0===e.LINE_BREAKS&&(s=!0):_(h,e.PATTERN)&&(s=!0)}),t&&!s&&i.push({message:"Warning: No LINE_BREAKS Found.\n	This Lexer has been defined to track line and column information,\n	But none of the Token Types can be identified as matching a line terminator.\n	See https://sap.github.io/chevrotain/docs/guide/resolving_lexer_errors.html#LINE_BREAKS \n	for details.",type:C.NO_LINE_BREAKS_FLAGS}),i))})),n.modes=n.modes?n.modes:{},(0,R.jJ)(n.modes,function(e,t){n.modes[t]=(0,R.ku)(e,function(e){return(0,R.b0)(e)})});var i=(0,R.HP)(n.modes);if((0,R.jJ)(n.modes,function(e,n){r.TRACE_INIT("Mode: <"+n+"> processing",function(){if(r.modes.push(n),!1===r.config.skipValidations&&r.TRACE_INIT("validatePatterns",function(){var t,n,o,s,a,l,h,d,u,c,g,p,m,f,b,y,w,S,v,T,A,I,x,N,O,k,H,_,D,F,B,z,W;r.lexerDefinitionErrors=r.lexerDefinitionErrors.concat((t=[],a=e,l=(0,R.pb)(a,function(e){return!(0,R.zy)(e,P)}),n={errors:(0,R.Tj)(l,function(e){return{message:"Token Type: ->"+e.name+"<- missing static 'PATTERN' property",type:C.MISSING_PATTERN,tokenTypes:[e]}}),valid:(0,R.iv)(a,l)},t=t.concat(n.errors),s=(h=n.valid,d=(0,R.pb)(h,function(e){var t=e[P];return!(0,R.gd)(t)&&!(0,R.Tn)(t)&&!(0,R.zy)(t,"exec")&&!(0,R.Kg)(t)}),o={errors:(0,R.Tj)(d,function(e){return{message:"Token Type: ->"+e.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:C.INVALID_PATTERN,tokenTypes:[e]}}),valid:(0,R.iv)(h,d)}).valid,t=(t=(t=(t=(t=t.concat(o.errors)).concat((u=s,c=[],g=(0,R.pb)(u,function(e){return(0,R.gd)(e[P])}),(c=(c=(c=(c=c.concat((p=g,m=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.found=!1,t}return L(t,e),t.prototype.visitEndAnchor=function(e){this.found=!0},t}(E.BaseRegExpVisitor),f=(0,R.pb)(p,function(e){var t=e[P];try{var r=M(t),n=new m;return n.visit(r),n.found}catch(e){return V.test(t.source)}}),(0,R.Tj)(f,function(e){return{message:"Unexpected RegExp Anchor Error:\n	Token Type: ->"+e.name+"<- static 'PATTERN' cannot contain end of input anchor '$'\n	See sap.github.io/chevrotain/docs/guide/resolving_lexer_errors.html#ANCHORS	for details.",type:C.EOI_ANCHOR_FOUND,tokenTypes:[e]}})))).concat((b=g,y=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.found=!1,t}return L(t,e),t.prototype.visitStartAnchor=function(e){this.found=!0},t}(E.BaseRegExpVisitor),w=(0,R.pb)(b,function(e){var t=e[P];try{var r=M(t),n=new y;return n.visit(r),n.found}catch(e){return U.test(t.source)}}),(0,R.Tj)(w,function(e){return{message:"Unexpected RegExp Anchor Error:\n	Token Type: ->"+e.name+"<- static 'PATTERN' cannot contain start of input anchor '^'\n	See https://sap.github.io/chevrotain/docs/guide/resolving_lexer_errors.html#ANCHORS	for details.",type:C.SOI_ANCHOR_FOUND,tokenTypes:[e]}})))).concat((S=g,v=(0,R.pb)(S,function(e){var t=e[P];return t instanceof RegExp&&(t.multiline||t.global)}),(0,R.Tj)(v,function(e){return{message:"Token Type: ->"+e.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:C.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[e]}})))).concat((T=g,A=[],I=(0,R.Tj)(T,function(e){return(0,R.TS)(T,function(t,r){return e.PATTERN.source!==r.PATTERN.source||(0,R.gR)(A,r)||r.PATTERN===el.NA||(A.push(r),t.push(r)),t},[])}),I=(0,R.oE)(I),x=(0,R.pb)(I,function(e){return e.length>1}),(0,R.Tj)(x,function(e){var t=(0,R.Tj)(e,function(e){return e.name});return{message:"The same RegExp pattern ->"+(0,R.$1)(e).PATTERN+"<-has been used in all of the following Token Types: "+t.join(", ")+" <-",type:C.DUPLICATE_PATTERNS_FOUND,tokenTypes:e}})))).concat((N=g,O=(0,R.pb)(N,function(e){return e[P].test("")}),(0,R.Tj)(O,function(e){return{message:"Token Type: ->"+e.name+"<- static 'PATTERN' must not match an empty string",type:C.EMPTY_MATCH_PATTERN,tokenTypes:[e]}})))))).concat((k=s,H=(0,R.pb)(k,function(e){if(!(0,R.zy)(e,"GROUP"))return!1;var t=e.GROUP;return t!==el.SKIPPED&&t!==el.NA&&!(0,R.Kg)(t)}),(0,R.Tj)(H,function(e){return{message:"Token Type: ->"+e.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:C.INVALID_GROUP_TYPE_FOUND,tokenTypes:[e]}})))).concat((_=s,D=i,F=(0,R.pb)(_,function(e){return void 0!==e.PUSH_MODE&&!(0,R.gR)(D,e.PUSH_MODE)}),(0,R.Tj)(F,function(e){return{message:"Token Type: ->"+e.name+"<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->"+e.PUSH_MODE+"<-which does not exist",type:C.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[e]}})))).concat((B=s,z=[],W=(0,R.TS)(B,function(e,t,r){var n,o=t.PATTERN;return o===el.NA||((0,R.Kg)(o)?e.push({str:o,idx:r,tokenType:t}):(0,R.gd)(o)&&(n=o,void 0===(0,R.I6)([".","\\","[","]","|","^","$","(",")","?","*","+","{"],function(e){return -1!==n.source.indexOf(e)}))&&e.push({str:o.source,idx:r,tokenType:t})),e},[]),(0,R.jJ)(B,function(e,t){(0,R.jJ)(W,function(r){var n=r.str,o=r.idx,i=r.tokenType;if(t<o&&function(e,t){if((0,R.gd)(t)){var r=t.exec(e);return null!==r&&0===r.index}if((0,R.Tn)(t))return t(e,0,[],{});if((0,R.zy)(t,"exec"))return t.exec(e,0,[],{});if("string"==typeof t)return t===e;throw Error("non exhaustive match")}(n,e.PATTERN)){var s="Token: ->"+i.name+"<- can never be matched.\nBecause it appears AFTER the Token Type ->"+e.name+"<-in the lexer's definition.\nSee https://sap.github.io/chevrotain/docs/guide/resolving_lexer_errors.html#UNREACHABLE";z.push({message:s,type:C.UNREACHABLE_PATTERN,tokenTypes:[e,i]})}})}),z))))}),(0,R.Im)(r.lexerDefinitionErrors)){var o;er(e),r.TRACE_INIT("analyzeTokenTypes",function(){var n,i,s,a,l,h,d,u,c,g,p,m,f,b,C,y,w;n={lineTerminatorCharacters:r.config.lineTerminatorCharacters,positionTracking:t.positionTracking,ensureOptimizations:t.ensureOptimizations,safeMode:t.safeMode,tracer:r.TRACE_INIT.bind(r)},(b=(n=(0,R.NT)(n,{useSticky:B,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r","\n"],tracer:function(e,t){return t()}})).tracer)("initCharCodeToOptimizedIndexMap",function(){if((0,R.Im)(Q)){Q=Array(65536);for(var e=0;e<65536;e++)Q[e]=e>255?255+~~(e/255):e}}),b("Reject Lexer.NA",function(){i=(0,R.ku)(e,function(e){return e[P]===el.NA})}),C=!1,b("Transform Patterns",function(){C=!1,s=(0,R.Tj)(i,function(e){var t=e[P];if((0,R.gd)(t)){var r=t.source;return 1===r.length&&"^"!==r&&"$"!==r&&"."!==r?r:2!==r.length||"\\"!==r[0]||(0,R.gR)(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],r[1])?n.useSticky?W(t):z(t):r[1]}if((0,R.Tn)(t))return C=!0,{exec:t};if((0,R.zy)(t,"exec"))return C=!0,t;if("string"==typeof t)if(1===t.length)return t;else{var o=new RegExp(t.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"));return n.useSticky?W(o):z(o)}throw Error("non exhaustive match")})}),b("misc mapping",function(){a=(0,R.Tj)(i,function(e){return e.tokenTypeIdx}),l=(0,R.Tj)(i,function(e){var t=e.GROUP;if(t!==el.SKIPPED){if((0,R.Kg)(t))return t;if((0,R.b0)(t))return!1;throw Error("non exhaustive match")}}),h=(0,R.Tj)(i,function(e){var t=e.LONGER_ALT;if(t)return(0,R.qh)(i,t)}),d=(0,R.Tj)(i,function(e){return e.PUSH_MODE}),u=(0,R.Tj)(i,function(e){return(0,R.zy)(e,"POP_MODE")})}),b("Line Terminator Handling",function(){var e=q(n.lineTerminatorCharacters);c=(0,R.Tj)(i,function(e){return!1}),"onlyOffset"!==n.positionTracking&&(c=(0,R.Tj)(i,function(t){return(0,R.zy)(t,"LINE_BREAKS")?t.LINE_BREAKS:!1===j(t,e)?_(e,t.PATTERN):void 0}))}),b("Misc Mapping #2",function(){g=(0,R.Tj)(i,G),p=(0,R.Tj)(s,$),m=(0,R.TS)(i,function(e,t){var r=t.GROUP;return(0,R.Kg)(r)&&r!==el.SKIPPED&&(e[r]=[]),e},{}),f=(0,R.Tj)(s,function(e,t){return{pattern:s[t],longerAlt:h[t],canLineTerminator:c[t],isCustom:g[t],short:p[t],group:l[t],push:d[t],pop:u[t],tokenTypeIdx:a[t],tokenType:i[t]}})}),y=!0,w=[],n.safeMode||b("First Char Optimization",function(){w=(0,R.TS)(i,function(e,t,r){if("string"==typeof t.PATTERN){var o;K(e,X(t.PATTERN.charCodeAt(0)),f[r])}else if((0,R.cy)(t.START_CHARS_HINT))(0,R.jJ)(t.START_CHARS_HINT,function(t){var n=X("string"==typeof t?t.charCodeAt(0):t);o!==n&&(o=n,K(e,n,f[r]))});else if((0,R.gd)(t.PATTERN))if(t.PATTERN.unicode)y=!1,n.ensureOptimizations&&(0,R.Zi)(""+N+"	Unable to analyze < "+t.PATTERN.toString()+" > pattern.\n	The regexp unicode flag is not currently supported by the regexp-to-ast library.\n	This will disable the lexer's first char optimizations.\n	For details See: https://sap.github.io/chevrotain/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE");else{var i=function(e,t){void 0===t&&(t=!1);try{var r=M(e);return function e(t,r,n){switch(t.type){case"Disjunction":for(var o=0;o<t.value.length;o++)e(t.value[o],r,n);break;case"Alternative":for(var i=t.value,o=0;o<i.length;o++){var s=i[o];switch(s.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}switch(s.type){case"Character":O(s.value,r,n);break;case"Set":if(!0===s.complement)throw Error(x);(0,R.jJ)(s.value,function(e){if("number"==typeof e)O(e,r,n);else if(!0===n)for(var t=e.from;t<=e.to;t++)O(t,r,n);else{for(var t=e.from;t<=e.to&&t<256;t++)O(t,r,n);if(e.to>=256)for(var o=e.from>=256?e.from:256,i=e.to,s=X(o),a=X(i),l=s;l<=a;l++)r[l]=l}});break;case"Group":e(s.value,r,n);break;default:throw Error("Non Exhaustive Match")}var a=void 0!==s.quantifier&&0===s.quantifier.atLeast;if("Group"===s.type&&!1===function e(t){return!!t.quantifier&&0===t.quantifier.atLeast||!!t.value&&((0,R.cy)(t.value)?(0,R.Si)(t.value,e):e(t.value))}(s)||"Group"!==s.type&&!1===a)break}break;default:throw Error("non exhaustive match!")}return(0,R.zu)(r)}(r.value,{},r.flags.ignoreCase)}catch(r){if(r.message===x)t&&(0,R.x5)(""+N+"	Unable to optimize: < "+e.toString()+" >\n	Complement Sets cannot be automatically optimized.\n	This will disable the lexer's first char optimizations.\n	See: https://sap.github.io/chevrotain/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.");else{var n="";t&&(n="\n	This will disable the lexer's first char optimizations.\n	See: https://sap.github.io/chevrotain/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details."),(0,R.Zi)(N+"\n	Failed parsing: < "+e.toString()+" >\n	Using the regexp-to-ast library version: "+E.VERSION+"\n	Please open an issue at: https://github.com/bd82/regexp-to-ast/issues"+n)}}return[]}(t.PATTERN,n.ensureOptimizations);(0,R.Im)(i)&&(y=!1),(0,R.jJ)(i,function(t){K(e,t,f[r])})}else n.ensureOptimizations&&(0,R.Zi)(""+N+"	TokenType: <"+t.name+"> is using a custom token pattern without providing <start_chars_hint> parameter.\n	This will disable the lexer's first char optimizations.\n	For details See: https://sap.github.io/chevrotain/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE"),y=!1;return e},[])}),b("ArrayPacking",function(){w=(0,R.VS)(w)}),o={emptyGroups:m,patternIdxToConfig:f,charCodeToPatternIdxToConfig:w,hasCustom:C,canBeOptimized:y}}),r.patternIdxToConfig[n]=o.patternIdxToConfig,r.charCodeToPatternIdxToConfig[n]=o.charCodeToPatternIdxToConfig,r.emptyGroups=(0,R.h1)(r.emptyGroups,o.emptyGroups),r.hasCustom=o.hasCustom||r.hasCustom,r.canModeBeOptimized[n]=o.canBeOptimized}})}),r.defaultMode=n.defaultMode,!(0,R.Im)(r.lexerDefinitionErrors)&&!r.config.deferDefinitionErrorsHandling)throw Error("Errors detected in definition of Lexer:\n"+(0,R.Tj)(r.lexerDefinitionErrors,function(e){return e.message}).join("-----------------------\n"));(0,R.jJ)(r.lexerDefinitionWarning,function(e){(0,R.x5)(e.message)}),r.TRACE_INIT("Choosing sub-methods implementations",function(){if(B?(r.chopInput=R.zK,r.match=r.matchWithTest):(r.updateLastIndex=R.tE,r.match=r.matchWithExec),o&&(r.handleModes=R.tE),!1===r.trackStartLines&&(r.computeNewColumn=R.zK),!1===r.trackEndLines&&(r.updateTokenEndLineColumnLocation=R.tE),/full/i.test(r.config.positionTracking))r.createTokenInstance=r.createFullToken;else if(/onlyStart/i.test(r.config.positionTracking))r.createTokenInstance=r.createStartOnlyToken;else if(/onlyOffset/i.test(r.config.positionTracking))r.createTokenInstance=r.createOffsetOnlyToken;else throw Error('Invalid <positionTracking> config option: "'+r.config.positionTracking+'"');r.hasCustom?(r.addToken=r.addTokenUsingPush,r.handlePayload=r.handlePayloadWithCustom):(r.addToken=r.addTokenUsingMemberAccess,r.handlePayload=r.handlePayloadNoCustom)}),r.TRACE_INIT("Failed Optimization Warnings",function(){var e=(0,R.TS)(r.canModeBeOptimized,function(e,t,r){return!1===t&&e.push(r),e},[]);if(t.ensureOptimizations&&!(0,R.Im)(e))throw Error("Lexer Modes: < "+e.join(", ")+' > cannot be optimized.\n	 Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.\n	 Or inspect the console log for details on how to resolve these issues.')}),r.TRACE_INIT("clearRegExpParserCache",function(){T={}}),r.TRACE_INIT("toFastProperties",function(){(0,R.Bl)(r)})})}return e.prototype.tokenize=function(e,t){if(void 0===t&&(t=this.defaultMode),!(0,R.Im)(this.lexerDefinitionErrors))throw Error("Unable to Tokenize because Errors detected in definition of Lexer:\n"+(0,R.Tj)(this.lexerDefinitionErrors,function(e){return e.message}).join("-----------------------\n"));return this.tokenizeInternal(e,t)},e.prototype.tokenizeInternal=function(e,t){var r,n,o,i,s,a,l,h,d,u,c,g,p,m,f,b,C,y,w=this,S=e,v=S.length,E=0,T=0,A=Array(this.hasCustom?0:Math.floor(e.length/10)),M=[],I=this.trackStartLines?1:void 0,x=this.trackStartLines?1:void 0,N=(r=this.emptyGroups,n={},o=(0,R.HP)(r),(0,R.jJ)(o,function(e){var t=r[e];if((0,R.cy)(t))n[e]=[];else throw Error("non exhaustive match")}),n),O=this.trackStartLines,k=this.config.lineTerminatorsPattern,H=0,_=[],L=[],P=[],D=[];Object.freeze(D);var F=void 0;function B(){return _}function V(e){var t=L[X(e)];return void 0===t?D:t}var U=function(e){if(1===P.length&&void 0===e.tokenType.PUSH_MODE){var t=w.config.errorMessageProvider.buildUnableToPopLexerModeMessage(e);M.push({offset:e.startOffset,line:void 0!==e.startLine?e.startLine:void 0,column:void 0!==e.startColumn?e.startColumn:void 0,length:e.image.length,message:t})}else{P.pop();var r=(0,R.HV)(P);_=w.patternIdxToConfig[r],L=w.charCodeToPatternIdxToConfig[r],H=_.length;var n=w.canModeBeOptimized[r]&&!1===w.config.safeMode;F=L&&n?V:B}};function z(e){P.push(e),L=this.charCodeToPatternIdxToConfig[e],H=(_=this.patternIdxToConfig[e]).length,H=_.length;var t=this.canModeBeOptimized[e]&&!1===this.config.safeMode;F=L&&t?V:B}for(z.call(this,t);E<v;){h=null;var W=S.charCodeAt(E),G=F(W),$=G.length;for(i=0;i<$;i++){var Y=(y=G[i]).pattern;d=null;var j=y.short;if(!1!==j?W===j&&(h=Y):!0===y.isCustom?null!==(C=Y.exec(S,E,A,N))?(h=C[0],void 0!==C.payload&&(d=C.payload)):h=null:(this.updateLastIndex(Y,E),h=this.match(Y,e,E)),null!==h){if(void 0!==(l=y.longerAlt)){var q=_[l],K=q.pattern;u=null,!0===q.isCustom?null!==(C=K.exec(S,E,A,N))?(a=C[0],void 0!==C.payload&&(u=C.payload)):a=null:(this.updateLastIndex(K,E),a=this.match(K,e,E)),a&&a.length>h.length&&(h=a,d=u,y=q)}break}}if(null!==h){if(c=h.length,void 0!==(g=y.group)&&(p=y.tokenTypeIdx,m=this.createTokenInstance(h,E,p,y.tokenType,I,x,c),this.handlePayload(m,d),!1===g?T=this.addToken(A,T,m):N[g].push(m)),e=this.chopInput(e,c),E+=c,x=this.computeNewColumn(x,c),!0===O&&!0===y.canLineTerminator){var Q=0,Z=void 0,J=void 0;k.lastIndex=0;do!0===(Z=k.test(h))&&(J=k.lastIndex-1,Q++);while(!0===Z);0!==Q&&(I+=Q,x=c-J,this.updateTokenEndLineColumnLocation(m,g,J,Q,I,x,c))}this.handleModes(y,U,z,m)}else{for(var ee=E,et=I,er=x,en=!1;!en&&E<v;)for(S.charCodeAt(E),e=this.chopInput(e,1),E++,s=0;s<H;s++){var eo=_[s],Y=eo.pattern,j=eo.short;if(!1!==j?S.charCodeAt(E)===j&&(en=!0):!0===eo.isCustom?en=null!==Y.exec(S,E,A,N):(this.updateLastIndex(Y,E),en=null!==Y.exec(e)),!0===en)break}f=E-ee,b=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(S,ee,f,et,er),M.push({offset:ee,line:et,column:er,length:f,message:b})}}return this.hasCustom||(A.length=T),{tokens:A,groups:N,errors:M}},e.prototype.handleModes=function(e,t,r,n){if(!0===e.pop){var o=e.push;t(n),void 0!==o&&r.call(this,o)}else void 0!==e.push&&r.call(this,e.push)},e.prototype.chopInput=function(e,t){return e.substring(t)},e.prototype.updateLastIndex=function(e,t){e.lastIndex=t},e.prototype.updateTokenEndLineColumnLocation=function(e,t,r,n,o,i,s){var a,l;void 0!==t&&(l=(a=r===s-1)?-1:0,(1!==n||!0!==a)&&(e.endLine=o+l,e.endColumn=i-1+-l))},e.prototype.computeNewColumn=function(e,t){return e+t},e.prototype.createTokenInstance=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return null},e.prototype.createOffsetOnlyToken=function(e,t,r,n){return{image:e,startOffset:t,tokenTypeIdx:r,tokenType:n}},e.prototype.createStartOnlyToken=function(e,t,r,n,o,i){return{image:e,startOffset:t,startLine:o,startColumn:i,tokenTypeIdx:r,tokenType:n}},e.prototype.createFullToken=function(e,t,r,n,o,i,s){return{image:e,startOffset:t,endOffset:t+s-1,startLine:o,endLine:o,startColumn:i,endColumn:i+s-1,tokenTypeIdx:r,tokenType:n}},e.prototype.addToken=function(e,t,r){return 666},e.prototype.addTokenUsingPush=function(e,t,r){return e.push(r),t},e.prototype.addTokenUsingMemberAccess=function(e,t,r){return e[t]=r,++t},e.prototype.handlePayload=function(e,t){},e.prototype.handlePayloadNoCustom=function(e,t){},e.prototype.handlePayloadWithCustom=function(e,t){null!==t&&(e.payload=t)},e.prototype.match=function(e,t,r){return null},e.prototype.matchWithTest=function(e,t,r){return!0===e.test(t)?t.substring(r,e.lastIndex):null},e.prototype.matchWithExec=function(e,t){var r=e.exec(t);return null!==r?r[0]:r},e.prototype.TRACE_INIT=function(e,t){if(!0!==this.traceInitPerf)return t();this.traceInitIndent++;var r=Array(this.traceInitIndent+1).join("	");this.traceInitIndent<this.traceInitMaxIdent&&console.log(r+"--\x3e <"+e+">");var n=(0,R.O1)(t),o=n.time,i=n.value,s=o>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&s(r+"<-- <"+e+"> time: "+o+"ms"),this.traceInitIndent--,i},e.SKIPPED="This marks a skipped Token pattern, this means each token identified by it willbe consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.",e.NA=/NOT_APPLICABLE/,e}();function eh(e){return eu(e)?e.LABEL:e.name}function ed(e){return e.name}function eu(e){return(0,R.Kg)(e.LABEL)&&""!==e.LABEL}var ec="categories",eg="label",ep="group",em="push_mode",ef="pop_mode",eb="longer_alt",eC="line_breaks",ey="start_chars_hint";function ew(e){return eS(e)}function eS(e){var t=e.pattern,r={};if(r.name=e.name,(0,R.b0)(t)||(r.PATTERN=t),(0,R.zy)(e,"parent"))throw"The parent property is no longer supported.\nSee: https://github.com/SAP/chevrotain/issues/564#issuecomment-349062346 for details.";return(0,R.zy)(e,ec)&&(r.CATEGORIES=e[ec]),er([r]),(0,R.zy)(e,eg)&&(r.LABEL=e[eg]),(0,R.zy)(e,ep)&&(r.GROUP=e[ep]),(0,R.zy)(e,ef)&&(r.POP_MODE=e[ef]),(0,R.zy)(e,em)&&(r.PUSH_MODE=e[em]),(0,R.zy)(e,eb)&&(r.LONGER_ALT=e[eb]),(0,R.zy)(e,eC)&&(r.LINE_BREAKS=e[eC]),(0,R.zy)(e,ey)&&(r.START_CHARS_HINT=e[ey]),r}var ev=eS({name:"EOF",pattern:el.NA});function eR(e,t,r,n,o,i,s,a){return{image:t,startOffset:r,endOffset:n,startLine:o,endLine:i,startColumn:s,endColumn:a,tokenTypeIdx:e.tokenTypeIdx,tokenType:e}}function eE(e,t){return Z(e,t)}er([ev]);var eT=(s=function(e,t){return(s=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}s(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),eA=function(){function e(e){this.definition=e}return e.prototype.accept=function(e){e.visit(this),(0,R.jJ)(this.definition,function(t){t.accept(e)})},e}(),eM=function(e){function t(t){var r=e.call(this,[])||this;return r.idx=1,(0,R.kp)(r,(0,R.Up)(t,function(e){return void 0!==e})),r}return eT(t,e),Object.defineProperty(t.prototype,"definition",{get:function(){return void 0!==this.referencedRule?this.referencedRule.definition:[]},set:function(e){},enumerable:!0,configurable:!0}),t.prototype.accept=function(e){e.visit(this)},t}(eA),eI=function(e){function t(t){var r=e.call(this,t.definition)||this;return r.orgText="",(0,R.kp)(r,(0,R.Up)(t,function(e){return void 0!==e})),r}return eT(t,e),t}(eA),ex=function(e){function t(t){var r=e.call(this,t.definition)||this;return r.ignoreAmbiguities=!1,(0,R.kp)(r,(0,R.Up)(t,function(e){return void 0!==e})),r}return eT(t,e),t}(eA),eN=function(e){function t(t){var r=e.call(this,t.definition)||this;return r.idx=1,(0,R.kp)(r,(0,R.Up)(t,function(e){return void 0!==e})),r}return eT(t,e),t}(eA),eO=function(e){function t(t){var r=e.call(this,t.definition)||this;return r.idx=1,(0,R.kp)(r,(0,R.Up)(t,function(e){return void 0!==e})),r}return eT(t,e),t}(eA),ek=function(e){function t(t){var r=e.call(this,t.definition)||this;return r.idx=1,(0,R.kp)(r,(0,R.Up)(t,function(e){return void 0!==e})),r}return eT(t,e),t}(eA),eH=function(e){function t(t){var r=e.call(this,t.definition)||this;return r.idx=1,(0,R.kp)(r,(0,R.Up)(t,function(e){return void 0!==e})),r}return eT(t,e),t}(eA),e_=function(e){function t(t){var r=e.call(this,t.definition)||this;return r.idx=1,(0,R.kp)(r,(0,R.Up)(t,function(e){return void 0!==e})),r}return eT(t,e),t}(eA),eL=function(e){function t(t){var r=e.call(this,t.definition)||this;return r.idx=1,r.ignoreAmbiguities=!1,r.hasPredicates=!1,(0,R.kp)(r,(0,R.Up)(t,function(e){return void 0!==e})),r}return eT(t,e),t}(eA),eP=function(){function e(e){this.idx=1,(0,R.kp)(this,(0,R.Up)(e,function(e){return void 0!==e}))}return e.prototype.accept=function(e){e.visit(this)},e}();function eD(e){return(0,R.Tj)(e,eF)}function eF(e){function t(e){return(0,R.Tj)(e,eF)}if(e instanceof eM)return{type:"NonTerminal",name:e.nonTerminalName,idx:e.idx};if(e instanceof ex)return{type:"Flat",definition:t(e.definition)};if(e instanceof eN)return{type:"Option",idx:e.idx,definition:t(e.definition)};if(e instanceof eO)return{type:"RepetitionMandatory",name:e.name,idx:e.idx,definition:t(e.definition)};if(e instanceof ek)return{type:"RepetitionMandatoryWithSeparator",name:e.name,idx:e.idx,separator:eF(new eP({terminalType:e.separator})),definition:t(e.definition)};else if(e instanceof e_)return{type:"RepetitionWithSeparator",name:e.name,idx:e.idx,separator:eF(new eP({terminalType:e.separator})),definition:t(e.definition)};else if(e instanceof eH)return{type:"Repetition",name:e.name,idx:e.idx,definition:t(e.definition)};else if(e instanceof eL)return{type:"Alternation",name:e.name,idx:e.idx,definition:t(e.definition)};else if(e instanceof eP){var r={type:"Terminal",name:e.terminalType.name,label:eh(e.terminalType),idx:e.idx},n=e.terminalType.PATTERN;return e.terminalType.PATTERN&&(r.pattern=(0,R.gd)(n)?n.source:n),r}else if(e instanceof eI)return{type:"Rule",name:e.name,orgText:e.orgText,definition:t(e.definition)};else throw Error("non exhaustive match")}var eB=function(){function e(){}return e.prototype.walk=function(e,t){var r=this;void 0===t&&(t=[]),(0,R.jJ)(e.definition,function(n,o){var i=(0,R.gv)(e.definition,o+1);if(n instanceof eM)r.walkProdRef(n,i,t);else if(n instanceof eP)r.walkTerminal(n,i,t);else if(n instanceof ex)r.walkFlat(n,i,t);else if(n instanceof eN)r.walkOption(n,i,t);else if(n instanceof eO)r.walkAtLeastOne(n,i,t);else if(n instanceof ek)r.walkAtLeastOneSep(n,i,t);else if(n instanceof e_)r.walkManySep(n,i,t);else if(n instanceof eH)r.walkMany(n,i,t);else if(n instanceof eL)r.walkOr(n,i,t);else throw Error("non exhaustive match")})},e.prototype.walkTerminal=function(e,t,r){},e.prototype.walkProdRef=function(e,t,r){},e.prototype.walkFlat=function(e,t,r){var n=t.concat(r);this.walk(e,n)},e.prototype.walkOption=function(e,t,r){var n=t.concat(r);this.walk(e,n)},e.prototype.walkAtLeastOne=function(e,t,r){var n=[new eN({definition:e.definition})].concat(t,r);this.walk(e,n)},e.prototype.walkAtLeastOneSep=function(e,t,r){var n=eV(e,t,r);this.walk(e,n)},e.prototype.walkMany=function(e,t,r){var n=[new eN({definition:e.definition})].concat(t,r);this.walk(e,n)},e.prototype.walkManySep=function(e,t,r){var n=eV(e,t,r);this.walk(e,n)},e.prototype.walkOr=function(e,t,r){var n=this,o=t.concat(r);(0,R.jJ)(e.definition,function(e){var t=new ex({definition:[e]});n.walk(t,o)})},e}();function eV(e,t,r){return[new eN({definition:[new eP({terminalType:e.separator})].concat(e.definition)})].concat(t,r)}var eU=function(){function e(){}return e.prototype.visit=function(e){switch(e.constructor){case eM:return this.visitNonTerminal(e);case ex:return this.visitFlat(e);case eN:return this.visitOption(e);case eO:return this.visitRepetitionMandatory(e);case ek:return this.visitRepetitionMandatoryWithSeparator(e);case e_:return this.visitRepetitionWithSeparator(e);case eH:return this.visitRepetition(e);case eL:return this.visitAlternation(e);case eP:return this.visitTerminal(e);case eI:return this.visitRule(e);default:throw Error("non exhaustive match")}},e.prototype.visitNonTerminal=function(e){},e.prototype.visitFlat=function(e){},e.prototype.visitOption=function(e){},e.prototype.visitRepetition=function(e){},e.prototype.visitRepetitionMandatory=function(e){},e.prototype.visitRepetitionMandatoryWithSeparator=function(e){},e.prototype.visitRepetitionWithSeparator=function(e){},e.prototype.visitAlternation=function(e){},e.prototype.visitTerminal=function(e){},e.prototype.visitRule=function(e){},e}(),ez=(a=function(e,t){return(a=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});function eW(e,t){return void 0===t&&(t=[]),e instanceof eN||e instanceof eH||e instanceof e_||(e instanceof eL?(0,R.zN)(e.definition,function(e){return eW(e,t)}):!(e instanceof eM&&(0,R.gR)(t,e))&&e instanceof eA&&(e instanceof eM&&t.push(e),(0,R.Si)(e.definition,function(e){return eW(e,t)})))}function eG(e){if(e instanceof eM)return"SUBRULE";if(e instanceof eN)return"OPTION";if(e instanceof eL)return"OR";if(e instanceof eO)return"AT_LEAST_ONE";if(e instanceof ek)return"AT_LEAST_ONE_SEP";else if(e instanceof e_)return"MANY_SEP";else if(e instanceof eH)return"MANY";else if(e instanceof eP)return"CONSUME";else throw Error("non exhaustive match")}var e$=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.separator="-",t.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]},t}return ez(t,e),t.prototype.reset=function(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}},t.prototype.visitTerminal=function(e){var t=e.terminalType.name+this.separator+"Terminal";(0,R.zy)(this.dslMethods,t)||(this.dslMethods[t]=[]),this.dslMethods[t].push(e)},t.prototype.visitNonTerminal=function(e){var t=e.nonTerminalName+this.separator+"Terminal";(0,R.zy)(this.dslMethods,t)||(this.dslMethods[t]=[]),this.dslMethods[t].push(e)},t.prototype.visitOption=function(e){this.dslMethods.option.push(e)},t.prototype.visitRepetitionWithSeparator=function(e){this.dslMethods.repetitionWithSeparator.push(e)},t.prototype.visitRepetitionMandatory=function(e){this.dslMethods.repetitionMandatory.push(e)},t.prototype.visitRepetitionMandatoryWithSeparator=function(e){this.dslMethods.repetitionMandatoryWithSeparator.push(e)},t.prototype.visitRepetition=function(e){this.dslMethods.repetition.push(e)},t.prototype.visitAlternation=function(e){this.dslMethods.alternation.push(e)},t}(eU),eY=new e$;function ej(e){if(e instanceof eM)return ej(e.referencedRule);if(e instanceof eP)return[e.terminalType];if(e instanceof ex||e instanceof eN||e instanceof eH||e instanceof eO||e instanceof ek||e instanceof e_||e instanceof eP||e instanceof eI)return function(e){for(var t,r=[],n=e.definition,o=0,i=n.length>o,s=!0;i&&s;)s=eW(t=n[o]),r=r.concat(ej(t)),o+=1,i=n.length>o;return(0,R.sb)(r)}(e);if(e instanceof eL){var t,r;return t=e,r=(0,R.Tj)(t.definition,function(e){return ej(e)}),(0,R.sb)((0,R.Bq)(r))}throw Error("non exhaustive match")}var eq="_~IN~_",eK=(l=function(e,t){return(l=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}l(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),eX=function(e){function t(t){var r=e.call(this)||this;return r.topProd=t,r.follows={},r}return eK(t,e),t.prototype.startWalking=function(){return this.walk(this.topProd),this.follows},t.prototype.walkTerminal=function(e,t,r){},t.prototype.walkProdRef=function(e,t,r){var n,o,i=(n=e.referencedRule,o=e.idx,n.name+o+eq+this.topProd.name),s=ej(new ex({definition:t.concat(r)}));this.follows[i]=s},t}(eB),eQ=(h=function(e,t){return(h=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}h(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});function eZ(e,t){!0===isNaN(e.startOffset)?(e.startOffset=t.startOffset,e.endOffset=t.endOffset):e.endOffset<t.endOffset==!0&&(e.endOffset=t.endOffset)}function eJ(e,t){!0===isNaN(e.startOffset)?(e.startOffset=t.startOffset,e.startColumn=t.startColumn,e.startLine=t.startLine,e.endOffset=t.endOffset,e.endColumn=t.endColumn,e.endLine=t.endLine):e.endOffset<t.endOffset==!0&&(e.endOffset=t.endOffset,e.endColumn=t.endColumn,e.endLine=t.endLine)}function e0(e,t,r){void 0===e.children[t]?e.children[t]=[r]:e.children[t].push(r)}var e1=function(e){function t(t){var r=e.call(this)||this;return r.result=[],r.ruleIdx=t,r}return eQ(t,e),t.prototype.collectNamedDSLMethod=function(e,t,r){if(!(0,R.b0)(e.name)){var n,o=void 0;if(e instanceof eN||e instanceof eH||e instanceof eO||e instanceof eL)o=new t({definition:e.definition,idx:e.idx});else if(e instanceof ek||e instanceof e_)o=new t({definition:e.definition,idx:e.idx,separator:e.separator});else throw Error("non exhaustive match");var i=[o],s=(n=this.ruleIdx,e.idx|r|n);this.result.push({def:i,key:s,name:e.name,orgProd:e})}},t.prototype.visitOption=function(e){this.collectNamedDSLMethod(e,eN,512)},t.prototype.visitRepetition=function(e){this.collectNamedDSLMethod(e,eH,768)},t.prototype.visitRepetitionMandatory=function(e){this.collectNamedDSLMethod(e,eO,1024)},t.prototype.visitRepetitionMandatoryWithSeparator=function(e){this.collectNamedDSLMethod(e,ek,1536)},t.prototype.visitRepetitionWithSeparator=function(e){this.collectNamedDSLMethod(e,e_,1280)},t.prototype.visitAlternation=function(e){var t=this;this.collectNamedDSLMethod(e,eL,256);var r=e.definition.length>1;(0,R.jJ)(e.definition,function(n,o){if(!(0,R.b0)(n.name)){var i,s,a=n.definition;a=r?[new eN({definition:n.definition})]:n.definition;var l=(i=t.ruleIdx,s=e.idx,256|s|i|o+1<<24);t.result.push({def:a,key:l,name:n.name,orgProd:n})}})},t}(eU),e2=(d=function(e,t){return(d=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}d(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),e3=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.path=r,n.nextTerminalName="",n.nextTerminalOccurrence=0,n.nextTerminalName=n.path.lastTok.name,n.nextTerminalOccurrence=n.path.lastTokOccurrence,n}return e2(t,e),t.prototype.walkTerminal=function(e,t,r){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){var n=new ex({definition:t.concat(r)});this.possibleTokTypes=ej(n),this.found=!0}},t}(function(e){function t(t,r){var n=e.call(this)||this;return n.topProd=t,n.path=r,n.possibleTokTypes=[],n.nextProductionName="",n.nextProductionOccurrence=0,n.found=!1,n.isAtEndOfPath=!1,n}return e2(t,e),t.prototype.startWalking=function(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=(0,R.T9)(this.path.ruleStack).reverse(),this.occurrenceStack=(0,R.T9)(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes},t.prototype.walk=function(t,r){void 0===r&&(r=[]),this.found||e.prototype.walk.call(this,t,r)},t.prototype.walkProdRef=function(e,t,r){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){var n=t.concat(r);this.updateExpectedNext(),this.walk(e.referencedRule,n)}},t.prototype.updateExpectedNext=function(){(0,R.Im)(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())},t}(eB)),e6=function(e){function t(t,r){var n=e.call(this)||this;return n.topRule=t,n.occurrence=r,n.result={token:void 0,occurrence:void 0,isEndOfRule:void 0},n}return e2(t,e),t.prototype.startWalking=function(){return this.walk(this.topRule),this.result},t}(eB),e5=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return e2(t,e),t.prototype.walkMany=function(t,r,n){if(t.idx===this.occurrence){var o=(0,R.$1)(r.concat(n));this.result.isEndOfRule=void 0===o,o instanceof eP&&(this.result.token=o.terminalType,this.result.occurrence=o.idx)}else e.prototype.walkMany.call(this,t,r,n)},t}(e6),e4=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return e2(t,e),t.prototype.walkManySep=function(t,r,n){if(t.idx===this.occurrence){var o=(0,R.$1)(r.concat(n));this.result.isEndOfRule=void 0===o,o instanceof eP&&(this.result.token=o.terminalType,this.result.occurrence=o.idx)}else e.prototype.walkManySep.call(this,t,r,n)},t}(e6),e9=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return e2(t,e),t.prototype.walkAtLeastOne=function(t,r,n){if(t.idx===this.occurrence){var o=(0,R.$1)(r.concat(n));this.result.isEndOfRule=void 0===o,o instanceof eP&&(this.result.token=o.terminalType,this.result.occurrence=o.idx)}else e.prototype.walkAtLeastOne.call(this,t,r,n)},t}(e6),e7=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return e2(t,e),t.prototype.walkAtLeastOneSep=function(t,r,n){if(t.idx===this.occurrence){var o=(0,R.$1)(r.concat(n));this.result.isEndOfRule=void 0===o,o instanceof eP&&(this.result.token=o.terminalType,this.result.occurrence=o.idx)}else e.prototype.walkAtLeastOneSep.call(this,t,r,n)},t}(e6);function e8(e,t,r){void 0===r&&(r=[]),r=(0,R.T9)(r);var n=[],o=0;function i(i){var s=e8(i.concat((0,R.gv)(e,o+1)),t,r);return n.concat(s)}for(;r.length<t&&o<e.length;){var s=e[o];if(s instanceof ex)return i(s.definition);if(s instanceof eM)return i(s.definition);if(s instanceof eN)n=i(s.definition);else if(s instanceof eO){var a=s.definition.concat([new eH({definition:s.definition})]);return i(a)}else if(s instanceof ek){var a=[new ex({definition:s.definition}),new eH({definition:[new eP({terminalType:s.separator})].concat(s.definition)})];return i(a)}else if(s instanceof e_){var a=s.definition.concat([new eH({definition:[new eP({terminalType:s.separator})].concat(s.definition)})]);n=i(a)}else if(s instanceof eH){var a=s.definition.concat([new eH({definition:s.definition})]);n=i(a)}else if(s instanceof eL)return(0,R.jJ)(s.definition,function(e){n=i(e.definition)}),n;else if(s instanceof eP)r.push(s.terminalType);else throw Error("non exhaustive match");o++}return n.push({partialPath:r,suffixDef:(0,R.gv)(e,o)}),n}function te(e,t,r,n){var o="EXIT_NONE_TERMINAL",i=[o],s="EXIT_ALTERNATIVE",a=!1,l=t.length,h=l-n-1,d=[],u=[];for(u.push({idx:-1,def:e,ruleStack:[],occurrenceStack:[]});!(0,R.Im)(u);){var c=u.pop();if(c===s){a&&(0,R.HV)(u).idx<=h&&u.pop();continue}var g=c.def,p=c.idx,m=c.ruleStack,f=c.occurrenceStack;if(!(0,R.Im)(g)){var b=g[0];if(b===o){var C={idx:p,def:(0,R.gv)(g),ruleStack:(0,R.gc)(m),occurrenceStack:(0,R.gc)(f)};u.push(C)}else if(b instanceof eP)if(p<l-1){var y=p+1;if(r(t[y],b.terminalType)){var C={idx:y,def:(0,R.gv)(g),ruleStack:m,occurrenceStack:f};u.push(C)}}else if(p===l-1)d.push({nextTokenType:b.terminalType,nextTokenOccurrence:b.idx,ruleStack:m,occurrenceStack:f}),a=!0;else throw Error("non exhaustive match");else if(b instanceof eM){var w=(0,R.T9)(m);w.push(b.nonTerminalName);var S=(0,R.T9)(f);S.push(b.idx);var C={idx:p,def:b.definition.concat(i,(0,R.gv)(g)),ruleStack:w,occurrenceStack:S};u.push(C)}else if(b instanceof eN){var v={idx:p,def:(0,R.gv)(g),ruleStack:m,occurrenceStack:f};u.push(v),u.push(s);var E={idx:p,def:b.definition.concat((0,R.gv)(g)),ruleStack:m,occurrenceStack:f};u.push(E)}else if(b instanceof eO){var T=new eH({definition:b.definition,idx:b.idx}),A=b.definition.concat([T],(0,R.gv)(g)),C={idx:p,def:A,ruleStack:m,occurrenceStack:f};u.push(C)}else if(b instanceof ek){var M=new eP({terminalType:b.separator}),T=new eH({definition:[M].concat(b.definition),idx:b.idx}),A=b.definition.concat([T],(0,R.gv)(g)),C={idx:p,def:A,ruleStack:m,occurrenceStack:f};u.push(C)}else if(b instanceof e_){var v={idx:p,def:(0,R.gv)(g),ruleStack:m,occurrenceStack:f};u.push(v),u.push(s);var M=new eP({terminalType:b.separator}),I=new eH({definition:[M].concat(b.definition),idx:b.idx}),A=b.definition.concat([I],(0,R.gv)(g)),E={idx:p,def:A,ruleStack:m,occurrenceStack:f};u.push(E)}else if(b instanceof eH){var v={idx:p,def:(0,R.gv)(g),ruleStack:m,occurrenceStack:f};u.push(v),u.push(s);var I=new eH({definition:b.definition,idx:b.idx}),A=b.definition.concat([I],(0,R.gv)(g)),E={idx:p,def:A,ruleStack:m,occurrenceStack:f};u.push(E)}else if(b instanceof eL)for(var x=b.definition.length-1;x>=0;x--){var N={idx:p,def:b.definition[x].definition.concat((0,R.gv)(g)),ruleStack:m,occurrenceStack:f};u.push(N),u.push(s)}else if(b instanceof ex)u.push({idx:p,def:b.definition.concat((0,R.gv)(g)),ruleStack:m,occurrenceStack:f});else if(b instanceof eI)u.push(function(e,t,r,n){var o=(0,R.T9)(r);o.push(e.name);var i=(0,R.T9)(n);return i.push(1),{idx:t,def:e.definition,ruleStack:o,occurrenceStack:i}}(b,p,m,f));else throw Error("non exhaustive match")}}return d}var tt=(u=function(e,t){return(u=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}u(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});(c=y||(y={}))[c.OPTION=0]="OPTION",c[c.REPETITION=1]="REPETITION",c[c.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",c[c.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",c[c.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",c[c.ALTERNATION=5]="ALTERNATION";var tr=function(e){function t(t,r,n){var o=e.call(this)||this;return o.topProd=t,o.targetOccurrence=r,o.targetProdType=n,o}return tt(t,e),t.prototype.startWalking=function(){return this.walk(this.topProd),this.restDef},t.prototype.checkIsTarget=function(e,t,r,n){return e.idx===this.targetOccurrence&&this.targetProdType===t&&(this.restDef=r.concat(n),!0)},t.prototype.walkOption=function(t,r,n){this.checkIsTarget(t,y.OPTION,r,n)||e.prototype.walkOption.call(this,t,r,n)},t.prototype.walkAtLeastOne=function(t,r,n){this.checkIsTarget(t,y.REPETITION_MANDATORY,r,n)||e.prototype.walkOption.call(this,t,r,n)},t.prototype.walkAtLeastOneSep=function(t,r,n){this.checkIsTarget(t,y.REPETITION_MANDATORY_WITH_SEPARATOR,r,n)||e.prototype.walkOption.call(this,t,r,n)},t.prototype.walkMany=function(t,r,n){this.checkIsTarget(t,y.REPETITION,r,n)||e.prototype.walkOption.call(this,t,r,n)},t.prototype.walkManySep=function(t,r,n){this.checkIsTarget(t,y.REPETITION_WITH_SEPARATOR,r,n)||e.prototype.walkOption.call(this,t,r,n)},t}(eB),tn=function(e){function t(t,r,n){var o=e.call(this)||this;return o.targetOccurrence=t,o.targetProdType=r,o.targetRef=n,o.result=[],o}return tt(t,e),t.prototype.checkIsTarget=function(e,t){e.idx===this.targetOccurrence&&this.targetProdType===t&&(void 0===this.targetRef||e===this.targetRef)&&(this.result=e.definition)},t.prototype.visitOption=function(e){this.checkIsTarget(e,y.OPTION)},t.prototype.visitRepetition=function(e){this.checkIsTarget(e,y.REPETITION)},t.prototype.visitRepetitionMandatory=function(e){this.checkIsTarget(e,y.REPETITION_MANDATORY)},t.prototype.visitRepetitionMandatoryWithSeparator=function(e){this.checkIsTarget(e,y.REPETITION_MANDATORY_WITH_SEPARATOR)},t.prototype.visitRepetitionWithSeparator=function(e){this.checkIsTarget(e,y.REPETITION_WITH_SEPARATOR)},t.prototype.visitAlternation=function(e){this.checkIsTarget(e,y.ALTERNATION)},t}(eU);function to(e){for(var t=Array(e),r=0;r<e;r++)t[r]=[];return t}function ti(e){for(var t=[""],r=0;r<e.length;r++){for(var n=e[r],o=[],i=0;i<t.length;i++){var s=t[i];o.push(s+"_"+n.tokenTypeIdx);for(var a=0;a<n.categoryMatches.length;a++){var l="_"+n.categoryMatches[a];o.push(s+l)}}t=o}return t}function ts(e,t){for(var r=(0,R.Tj)(e,function(e){return e8([e],1)}),n=to(r.length),o=(0,R.Tj)(r,function(e){var t={};return(0,R.jJ)(e,function(e){var r=ti(e.partialPath);(0,R.jJ)(r,function(e){t[e]=!0})}),t}),i=r,s=1;s<=t;s++){var a=i;i=to(a.length);for(var l=function(e){for(var r=a[e],l=0;l<r.length;l++){var h=r[l].partialPath,d=r[l].suffixDef,u=ti(h);if(function(e,t,r){for(var n=0;n<e.length;n++)if(n!==r){for(var o=e[n],i=0;i<t.length;i++)if(!0===o[t[i]])return!1}return!0}(o,u,e)||(0,R.Im)(d)||h.length===t){var c=n[e];if(!1===th(c,h)){c.push(h);for(var g=0;g<u.length;g++){var p=u[g];o[e][p]=!0}}}else{var m=e8(d,s+1,h);i[e]=i[e].concat(m),(0,R.jJ)(m,function(t){var r=ti(t.partialPath);(0,R.jJ)(r,function(t){o[e][t]=!0})})}}},h=0;h<a.length;h++)l(h)}return n}function ta(e,t,r,n){var o=new tn(e,y.ALTERNATION,n);return t.accept(o),ts(o.result,r)}function tl(e,t,r,n){var o=new tn(e,r);t.accept(o);var i=o.result,s=new tr(t,e,r).startWalking();return ts([new ex({definition:i}),new ex({definition:s})],n)}function th(e,t){e:for(var r=0;r<e.length;r++){var n=e[r];if(n.length===t.length){for(var o=0;o<n.length;o++){var i=t[o],s=n[o];if(!1==(i===s||void 0!==s.categoryMatchesMap[i.tokenTypeIdx]))continue e}return!0}}return!1}function td(e){return(0,R.Si)(e,function(e){return(0,R.Si)(e,function(e){return(0,R.Si)(e,function(e){return(0,R.Im)(e.categoryMatches)})})})}var tu=(g=function(e,t){return(g=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}g(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});function tc(e){return eG(e)+"_#_"+e.idx+"_#_"+tg(e)}function tg(e){return e instanceof eP?e.terminalType.name:e instanceof eM?e.nonTerminalName:""}var tp=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.allProductions=[],t}return tu(t,e),t.prototype.visitNonTerminal=function(e){this.allProductions.push(e)},t.prototype.visitOption=function(e){this.allProductions.push(e)},t.prototype.visitRepetitionWithSeparator=function(e){this.allProductions.push(e)},t.prototype.visitRepetitionMandatory=function(e){this.allProductions.push(e)},t.prototype.visitRepetitionMandatoryWithSeparator=function(e){this.allProductions.push(e)},t.prototype.visitRepetition=function(e){this.allProductions.push(e)},t.prototype.visitAlternation=function(e){this.allProductions.push(e)},t.prototype.visitTerminal=function(e){this.allProductions.push(e)},t}(eU),tm=/^[a-zA-Z_]\w*$/,tf=new RegExp(tm.source.replace("^","^\\$")),tb=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.alternations=[],t}return tu(t,e),t.prototype.visitAlternation=function(e){this.alternations.push(e)},t}(eU),tC=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.allProductions=[],t}return tu(t,e),t.prototype.visitRepetitionWithSeparator=function(e){this.allProductions.push(e)},t.prototype.visitRepetitionMandatory=function(e){this.allProductions.push(e)},t.prototype.visitRepetitionMandatoryWithSeparator=function(e){this.allProductions.push(e)},t.prototype.visitRepetition=function(e){this.allProductions.push(e)},t}(eU),ty={buildMismatchTokenMessage:function(e){var t=e.expected,r=e.actual;return e.previous,e.ruleName,"Expecting "+(eu(t)?"--\x3e "+eh(t)+" <--":"token of type --\x3e "+t.name+" <--")+" but found --\x3e '"+r.image+"' <--"},buildNotAllInputParsedMessage:function(e){var t=e.firstRedundant;return e.ruleName,"Redundant input, expecting EOF but found: "+t.image},buildNoViableAltMessage:function(e){var t=e.expectedPathsPerAlt,r=e.actual,n=(e.previous,e.customUserDescription);e.ruleName;var o="Expecting: ",i="\nbut found: '"+(0,R.$1)(r).image+"'";if(n)return o+n+i;var s=(0,R.TS)(t,function(e,t){return e.concat(t)},[]),a=(0,R.Tj)(s,function(e){return"["+(0,R.Tj)(e,function(e){return eh(e)}).join(", ")+"]"});return o+"one of these possible Token sequences:\n"+(0,R.Tj)(a,function(e,t){return"  "+(t+1)+". "+e}).join("\n")+i},buildEarlyExitMessage:function(e){var t=e.expectedIterationPaths,r=e.actual,n=e.customUserDescription;e.ruleName;var o="Expecting: ",i="\nbut found: '"+(0,R.$1)(r).image+"'";return n?o+n+i:o+("expecting at least one iteration which starts with one of these possible Token sequences::\n  <"+(0,R.Tj)(t,function(e){return"["+(0,R.Tj)(e,function(e){return eh(e)}).join(",")+"]"}).join(" ,"))+">"+i}};Object.freeze(ty);var tw={buildRuleNotFoundError:function(e,t){return"Invalid grammar, reference to a rule which is not defined: ->"+t.nonTerminalName+"<-\ninside top level rule: ->"+e.name+"<-"}},tS={buildDuplicateFoundError:function(e,t){var r=e.name,n=(0,R.$1)(t),o=n.idx,i=eG(n),s=n instanceof eP?n.terminalType.name:n instanceof eM?n.nonTerminalName:"",a="->"+i+(o>0?o:"")+"<- "+(s?"with argument: ->"+s+"<-":"")+"\n                  appears more than once ("+t.length+" times) in the top level rule: ->"+r+"<-.                  \n                  For further details see: https://sap.github.io/chevrotain/docs/FAQ.html#NUMERICAL_SUFFIXES \n                  ";return(a=a.replace(/[ \t]+/g," ")).replace(/\s\s+/g,"\n")},buildInvalidNestedRuleNameError:function(e,t){return"Invalid nested rule name: ->"+t.name+"<- inside rule: ->"+e.name+"<-\nit must match the pattern: ->"+tf.toString()+"<-.\nNote that this means a nested rule name must start with the '$'(dollar) sign."},buildDuplicateNestedRuleNameError:function(e,t){return"Duplicate nested rule name: ->"+(0,R.$1)(t).name+"<- inside rule: ->"+e.name+"<-\nA nested name must be unique in the scope of a top level grammar rule."},buildNamespaceConflictError:function(e){return"Namespace conflict found in grammar.\nThe grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <"+e.name+">.\nTo resolve this make sure each Terminal and Non-Terminal names are unique\nThis is easy to accomplish by using the convention that Terminal names start with an uppercase letter\nand Non-Terminal names start with a lower case letter."},buildAlternationPrefixAmbiguityError:function(e){var t=(0,R.Tj)(e.prefixPath,function(e){return eh(e)}).join(", "),r=0===e.alternation.idx?"":e.alternation.idx;return"Ambiguous alternatives: <"+e.ambiguityIndices.join(" ,")+"> due to common lookahead prefix\n"+("in <OR"+r+"> inside <")+e.topLevelRule.name+"> Rule,\n<"+t+"> may appears as a prefix path in all these alternatives.\nSee: https://sap.github.io/chevrotain/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX\nFor Further details."},buildAlternationAmbiguityError:function(e){var t=(0,R.Tj)(e.prefixPath,function(e){return eh(e)}).join(", "),r=0===e.alternation.idx?"":e.alternation.idx,n="Ambiguous Alternatives Detected: <"+e.ambiguityIndices.join(" ,")+"> in <OR"+r+"> inside <"+e.topLevelRule.name+"> Rule,\n<"+t+"> may appears as a prefix path in all these alternatives.\n";return n+"See: https://sap.github.io/chevrotain/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES\nFor Further details."},buildEmptyRepetitionError:function(e){var t=eG(e.repetition);return 0!==e.repetition.idx&&(t+=e.repetition.idx),"The repetition <"+t+"> within Rule <"+e.topLevelRule.name+"> can never consume any tokens.\nThis could lead to an infinite loop."},buildTokenNameError:function(e){return"Invalid Grammar Token name: ->"+e.tokenType.name+"<- it must match the pattern: ->"+e.expectedPattern.toString()+"<-"},buildEmptyAlternationError:function(e){return"Ambiguous empty alternative: <"+(e.emptyChoiceIdx+1)+">"+(" in <OR"+e.alternation.idx+"> inside <")+e.topLevelRule.name+"> Rule.\nOnly the last alternative may be an empty alternative."},buildTooManyAlternativesError:function(e){return"An Alternation cannot have more than 256 alternatives:\n"+("<OR"+e.alternation.idx+"> inside <"+e.topLevelRule.name+"> Rule.\n has ")+(e.alternation.definition.length+1)+" alternatives."},buildLeftRecursionError:function(e){var t=e.topLevelRule.name,r=t+" --\x3e "+R.Tj(e.leftRecursionPath,function(e){return e.name}).concat([t]).join(" --\x3e ");return"Left Recursion found in grammar.\nrule: <"+t+"> can be invoked from itself (directly or indirectly)\nwithout consuming any Tokens. The grammar path that causes this is: \n "+r+"\n To fix this refactor your grammar to remove the left recursion.\nsee: https://en.wikipedia.org/wiki/LL_parser#Left_Factoring."},buildInvalidRuleNameError:function(e){return"Invalid grammar rule name: ->"+e.topLevelRule.name+"<- it must match the pattern: ->"+e.expectedPattern.toString()+"<-"},buildDuplicateRuleNameError:function(e){return"Duplicate definition, rule: ->"+(e.topLevelRule instanceof eI?e.topLevelRule.name:e.topLevelRule)+"<- is already defined in the grammar: ->"+e.grammarName+"<-"}},tv=(p=function(e,t){return(p=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}p(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),tR=function(e){function t(t,r){var n=e.call(this)||this;return n.nameToTopRule=t,n.errMsgProvider=r,n.errors=[],n}return tv(t,e),t.prototype.resolveRefs=function(){var e=this;(0,R.jJ)((0,R.zu)(this.nameToTopRule),function(t){e.currTopLevel=t,t.accept(e)})},t.prototype.visitNonTerminal=function(e){var t=this.nameToTopRule[e.nonTerminalName];if(t)e.referencedRule=t;else{var r=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:r,type:S.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}},t}(eU);function tE(e){e=(0,R.NT)(e,{errMsgProvider:tw});var t,r={};return(0,R.jJ)(e.rules,function(e){r[e.name]=e}),(t=new tR(r,e.errMsgProvider)).resolveRefs(),t.errors}function tT(e){var t,r,n,o,i,s,a,l,h,d,u,c,g,p,m,f,b,C,w,v,E,T,A,M,I,x,N,O,k,H,_,L,P;return t=(e=(0,R.NT)(e,{errMsgProvider:tS,ignoredIssues:{}})).rules,r=e.maxLookahead,n=e.tokenTypes,o=e.ignoredIssues,i=e.errMsgProvider,s=e.grammarName,a=R.Tj(t,function(e){var t,r,n,o,s,a;return t=e,r=i,n=new tp,t.accept(n),o=n.allProductions,s=R.$z(o,tc),a=R.Up(s,function(e){return e.length>1}),R.Tj(R.zu(a),function(e){var n=R.$1(e),o=r.buildDuplicateFoundError(t,e),i=eG(n),s={message:o,type:S.DUPLICATE_PRODUCTIONS,ruleName:t.name,dslName:i,occurrence:n.idx},a=tg(n);return a&&(s.parameter=a),s})}),l=R.Tj(t,function(e){return function e(t,r,n,o){void 0===o&&(o=[]);var i=[],s=function e(t){var r=[];if(R.Im(t))return r;var n=R.$1(t);if(n instanceof eM)r.push(n.referencedRule);else if(n instanceof ex||n instanceof eN||n instanceof eO||n instanceof ek||n instanceof e_||n instanceof eH)r=r.concat(e(n.definition));else if(n instanceof eL)r=R.Bq(R.Tj(n.definition,function(t){return e(t.definition)}));else if(n instanceof eP);else throw Error("non exhaustive match");var o=eW(n),i=t.length>1;if(!o||!i)return r;var s=R.gv(t);return r.concat(e(s))}(r.definition);if(R.Im(s))return[];var a=t.name;R.gR(s,t)&&i.push({message:n.buildLeftRecursionError({topLevelRule:t,leftRecursionPath:o}),type:S.LEFT_RECURSION,ruleName:a});var l=R.iv(s,o.concat([t])),h=R.Tj(l,function(r){var i=R.T9(o);return i.push(r),e(t,r,n,i)});return i.concat(R.Bq(h))}(e,e,i)}),h=[],d=[],u=[],(0,R.Si)(l,R.Im)&&(h=(0,R.Tj)(t,function(e){var t,r,n,o;return t=e,r=i,n=new tb,t.accept(n),o=n.alternations,R.TS(o,function(e,n){var o=R.gc(n.definition),i=R.Tj(o,function(e,o){var i=te([e],[],null,1);return R.Im(i)?{message:r.buildEmptyAlternationError({topLevelRule:t,alternation:n,emptyChoiceIdx:o}),type:S.NONE_LAST_EMPTY_ALT,ruleName:t.name,occurrence:n.idx,alternative:o+1}:null});return e.concat(R.oE(i))},[])}),d=(0,R.Tj)(t,function(e){var t,n,s,a,l,h,d;return t=e,n=r,s=o,a=i,l=new tb,t.accept(l),h=l.alternations,(d=s[t.name])&&(h=(0,R.ku)(h,function(e){return d[eG(e)+(0===e.idx?"":e.idx)]})),h=(0,R.ku)(h,function(e){return!0===e.ignoreAmbiguities}),R.TS(h,function(e,r){var o,i,s,l,h,d,u,c,g,p,m,f,b=ta(r.idx,t,r.maxLookahead||n,r),C=(o=b,i=r,s=t,l=a,h=[],d=(0,R.TS)(o,function(e,t,r){return!0===i.definition[r].ignoreAmbiguities||(0,R.jJ)(t,function(t){var n=[r];(0,R.jJ)(o,function(e,o){r!==o&&th(e,t)&&!0!==i.definition[o].ignoreAmbiguities&&n.push(o)}),n.length>1&&!th(h,t)&&(h.push(t),e.push({alts:n,path:t}))}),e},[]),R.Tj(d,function(e){var t=(0,R.Tj)(e.alts,function(e){return e+1});return{message:l.buildAlternationAmbiguityError({topLevelRule:s,alternation:i,ambiguityIndices:t,prefixPath:e.path}),type:S.AMBIGUOUS_ALTS,ruleName:s.name,occurrence:i.idx,alternatives:[e.alts]}})),y=(u=b,c=r,g=t,p=a,m=[],f=(0,R.TS)(u,function(e,t,r){var n=(0,R.Tj)(t,function(e){return{idx:r,path:e}});return e.concat(n)},[]),(0,R.jJ)(f,function(e){if(!0!==c.definition[e.idx].ignoreAmbiguities){var t=e.idx,r=e.path,n=(0,R.JW)(f,function(e){var n;return!0!==c.definition[e.idx].ignoreAmbiguities&&e.idx<t&&(n=e.path,n.length<r.length&&(0,R.Si)(n,function(e,t){var n=r[t];return e===n||n.categoryMatchesMap[e.tokenTypeIdx]}))}),o=(0,R.Tj)(n,function(e){var r=[e.idx+1,t+1],n=0===c.idx?"":c.idx;return{message:p.buildAlternationPrefixAmbiguityError({topLevelRule:g,alternation:c,ambiguityIndices:r,prefixPath:e.path}),type:S.AMBIGUOUS_PREFIX_ALTS,ruleName:g.name,occurrence:n,alternatives:r}});m=m.concat(o)}}),m);return e.concat(C,y)},[])}),w=t,v=r,E=i,T=[],(0,R.jJ)(w,function(e){var t=new tC;e.accept(t);var r=t.allProductions;(0,R.jJ)(r,function(t){var r=function(e){if(e instanceof eN)return y.OPTION;if(e instanceof eH)return y.REPETITION;if(e instanceof eO)return y.REPETITION_MANDATORY;if(e instanceof ek)return y.REPETITION_MANDATORY_WITH_SEPARATOR;if(e instanceof e_)return y.REPETITION_WITH_SEPARATOR;else if(e instanceof eL)return y.ALTERNATION;else throw Error("non exhaustive match")}(t),n=t.maxLookahead||v,o=tl(t.idx,e,r,n)[0];if((0,R.Im)((0,R.Bq)(o))){var i=E.buildEmptyRepetitionError({topLevelRule:e,repetition:t});T.push({message:i,type:S.NO_NON_EMPTY_LOOKAHEAD,ruleName:e.name})}})}),u=T),A=t,M=n,I=i,x=[],N=(0,R.Tj)(M,function(e){return e.name}),(0,R.jJ)(A,function(e){var t=e.name;if((0,R.gR)(N,t)){var r=I.buildNamespaceConflictError(e);x.push({message:r,type:S.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:t})}}),c=x,g=R.Tj(n,function(e){var t,r,n;return t=e,r=i,n=[],t.name.match(tm)||n.push({message:r.buildTokenNameError({tokenType:t,expectedPattern:tm}),type:S.INVALID_TOKEN_NAME}),n}),O=t,k=i,H=[],(0,R.jJ)(O,function(e){var t=new e1("");e.accept(t);var r=(0,R.Tj)(t.result,function(e){return e.orgProd});H.push((0,R.Tj)(r,function(t){var r,n,o,i;return r=e,n=t,o=k,i=[],n.name.match(tf)||i.push({message:o.buildInvalidNestedRuleNameError(r,n),type:S.INVALID_NESTED_RULE_NAME,ruleName:r.name}),i}))}),p=(0,R.Bq)(H),_=t,L=i,P=[],(0,R.jJ)(_,function(e){var t=new e1("");e.accept(t);var r=(0,R.$z)(t.result,function(e){return e.name}),n=(0,R.Up)(r,function(e){return e.length>1});(0,R.jJ)((0,R.zu)(n),function(t){var r=(0,R.Tj)(t,function(e){return e.orgProd}),n=L.buildDuplicateNestedRuleNameError(e,r);P.push({message:n,type:S.DUPLICATE_NESTED_NAME,ruleName:e.name})})}),m=P,f=(0,R.Tj)(t,function(e){var t,r,n,o;return t=e,r=i,n=new tb,t.accept(n),o=n.alternations,R.TS(o,function(e,n){return n.definition.length>255&&e.push({message:r.buildTooManyAlternativesError({topLevelRule:t,alternation:n}),type:S.TOO_MANY_ALTS,ruleName:t.name,occurrence:n.idx}),e},[])}),b=(0,R.Tj)(t,function(e){var t,r,n,o;return t=e,r=i,n=[],(o=t.name).match(tm)||n.push({message:r.buildInvalidRuleNameError({topLevelRule:t,expectedPattern:tm}),type:S.INVALID_RULE_NAME,ruleName:o}),n}),C=(0,R.Tj)(t,function(e){var r=e,n=t,o=s,a=i,l=[];if((0,R.TS)(n,function(e,t){return t.name===r.name?e+1:e},0)>1){var h=a.buildDuplicateRuleNameError({topLevelRule:r,grammarName:o});l.push({message:h,type:S.DUPLICATE_RULE_NAME,ruleName:r.name})}return l}),R.Bq(a.concat(g,p,m,u,l,h,d,c,f,b,C))}function tA(e){(0,R.jJ)(e.rules,function(e){var t=new e$;e.accept(t),(0,R.jJ)(t.dslMethods,function(e){(0,R.jJ)(e,function(e,t){e.idx=t+1})})})}var tM="MismatchedTokenException",tI="NoViableAltException",tx="EarlyExitException",tN="NotAllInputParsedException",tO=[tM,tI,tx,tN];function tk(e){return(0,R.gR)(tO,e.name)}function tH(e,t,r){this.name=tM,this.message=e,this.token=t,this.previousToken=r,this.resyncedTokens=[]}function t_(e,t,r){this.name=tI,this.message=e,this.token=t,this.previousToken=r,this.resyncedTokens=[]}function tL(e,t){this.name=tN,this.message=e,this.token=t,this.resyncedTokens=[]}function tP(e,t,r){this.name=tx,this.message=e,this.token=t,this.previousToken=r,this.resyncedTokens=[]}Object.freeze(tO),tH.prototype=Error.prototype,t_.prototype=Error.prototype,tL.prototype=Error.prototype,tP.prototype=Error.prototype;var tD={},tF="InRuleRecoveryException";function tB(e){this.name=tF,this.message=e}tB.prototype=Error.prototype;var tV=function(){function e(){}return e.prototype.initRecoverable=function(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=(0,R.zy)(e,"recoveryEnabled")?e.recoveryEnabled:rn.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=tU)},e.prototype.getTokenToInsert=function(e){var t=eR(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return t.isInsertedInRecovery=!0,t},e.prototype.canTokenTypeBeInsertedInRecovery=function(e){return!0},e.prototype.tryInRepetitionRecovery=function(e,t,r,n){for(var o=this,i=this.findReSyncTokenType(),s=this.exportLexerState(),a=[],l=!1,h=this.LA(1),d=this.LA(1),u=function(){var e=o.LA(0),t=new tH(o.errorMessageProvider.buildMismatchTokenMessage({expected:n,actual:h,previous:e,ruleName:o.getCurrRuleFullName()}),h,o.LA(0));t.resyncedTokens=(0,R.gc)(a),o.SAVE_ERROR(t)};!l;)if(this.tokenMatcher(d,n))return void u();else if(r.call(this)){u(),e.apply(this,t);return}else this.tokenMatcher(d,i)?l=!0:(d=this.SKIP_TOKEN(),this.addToResyncTokens(d,a));this.importLexerState(s)},e.prototype.shouldInRepetitionRecoveryBeTried=function(e,t,r){return!(!1===r||void 0===e||void 0===t||this.tokenMatcher(this.LA(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,t)))},e.prototype.getFollowsForInRuleRecovery=function(e,t){var r=this.getCurrentGrammarPath(e,t);return this.getNextPossibleTokenTypes(r)},e.prototype.tryInRuleRecovery=function(e,t){if(this.canRecoverWithSingleTokenInsertion(e,t))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){var r=this.SKIP_TOKEN();return this.consumeToken(),r}throw new tB("sad sad panda")},e.prototype.canPerformInRuleRecovery=function(e,t){return this.canRecoverWithSingleTokenInsertion(e,t)||this.canRecoverWithSingleTokenDeletion(e)},e.prototype.canRecoverWithSingleTokenInsertion=function(e,t){var r=this;if(!this.canTokenTypeBeInsertedInRecovery(e)||(0,R.Im)(t))return!1;var n=this.LA(1);return void 0!==(0,R.I6)(t,function(e){return r.tokenMatcher(n,e)})},e.prototype.canRecoverWithSingleTokenDeletion=function(e){return this.tokenMatcher(this.LA(2),e)},e.prototype.isInCurrentRuleReSyncSet=function(e){var t=this.getCurrFollowKey(),r=this.getFollowSetFromFollowKey(t);return(0,R.gR)(r,e)},e.prototype.findReSyncTokenType=function(){for(var e=this.flattenFollowSet(),t=this.LA(1),r=2;;){var n=t.tokenType;if((0,R.gR)(e,n))return n;t=this.LA(r),r++}},e.prototype.getCurrFollowKey=function(){if(1===this.RULE_STACK.length)return tD;var e=this.getLastExplicitRuleShortName(),t=this.getLastExplicitRuleOccurrenceIndex(),r=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:t,inRule:this.shortRuleNameToFullName(r)}},e.prototype.buildFullFollowKeyStack=function(){var e=this,t=this.RULE_STACK,r=this.RULE_OCCURRENCE_STACK;return(0,R.Im)(this.LAST_EXPLICIT_RULE_STACK)||(t=(0,R.Tj)(this.LAST_EXPLICIT_RULE_STACK,function(t){return e.RULE_STACK[t]}),r=(0,R.Tj)(this.LAST_EXPLICIT_RULE_STACK,function(t){return e.RULE_OCCURRENCE_STACK[t]})),(0,R.Tj)(t,function(n,o){return 0===o?tD:{ruleName:e.shortRuleNameToFullName(n),idxInCallingRule:r[o],inRule:e.shortRuleNameToFullName(t[o-1])}})},e.prototype.flattenFollowSet=function(){var e=this,t=(0,R.Tj)(this.buildFullFollowKeyStack(),function(t){return e.getFollowSetFromFollowKey(t)});return(0,R.Bq)(t)},e.prototype.getFollowSetFromFollowKey=function(e){if(e===tD)return[ev];var t=e.ruleName+e.idxInCallingRule+eq+e.inRule;return this.resyncFollows[t]},e.prototype.addToResyncTokens=function(e,t){return this.tokenMatcher(e,ev)||t.push(e),t},e.prototype.reSyncTo=function(e){for(var t=[],r=this.LA(1);!1===this.tokenMatcher(r,e);)r=this.SKIP_TOKEN(),this.addToResyncTokens(r,t);return(0,R.gc)(t)},e.prototype.attemptInRepetitionRecovery=function(e,t,r,n,o,i,s){},e.prototype.getCurrentGrammarPath=function(e,t){return{ruleStack:this.getHumanReadableRuleStack(),occurrenceStack:(0,R.T9)(this.RULE_OCCURRENCE_STACK),lastTok:e,lastTokOccurrence:t}},e.prototype.getHumanReadableRuleStack=function(){var e=this;return(0,R.Im)(this.LAST_EXPLICIT_RULE_STACK)?(0,R.Tj)(this.RULE_STACK,function(t){return e.shortRuleNameToFullName(t)}):(0,R.Tj)(this.LAST_EXPLICIT_RULE_STACK,function(t){return e.shortRuleNameToFullName(e.RULE_STACK[t])})},e}();function tU(e,t,r,n,o,i,s){var a=this.getKeyForAutomaticLookahead(n,o),l=this.firstAfterRepMap[a];if(void 0===l){var h=this.getCurrRuleFullName();l=new i(this.getGAstProductions()[h],o).startWalking(),this.firstAfterRepMap[a]=l}var d=l.token,u=l.occurrence,c=l.isEndOfRule;1===this.RULE_STACK.length&&c&&void 0===d&&(d=ev,u=1),this.shouldInRepetitionRecoveryBeTried(d,u,s)&&this.tryInRepetitionRecovery(e,t,r,d)}var tz=function(){function e(){}return e.prototype.initLooksAhead=function(e){this.dynamicTokensEnabled=(0,R.zy)(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:rn.dynamicTokensEnabled,this.maxLookahead=(0,R.zy)(e,"maxLookahead")?e.maxLookahead:rn.maxLookahead,this.lookAheadFuncsCache=(0,R.rF)()?new Map:[],(0,R.rF)()?(this.getLaFuncFromCache=this.getLaFuncFromMap,this.setLaFuncCache=this.setLaFuncCacheUsingMap):(this.getLaFuncFromCache=this.getLaFuncFromObj,this.setLaFuncCache=this.setLaFuncUsingObj)},e.prototype.preComputeLookaheadFunctions=function(e){var t=this;(0,R.jJ)(e,function(e){t.TRACE_INIT(e.name+" Rule Lookahead",function(){var r,n=(eY.reset(),e.accept(eY),r=eY.dslMethods,eY.reset(),r),o=n.alternation,i=n.repetition,s=n.option,a=n.repetitionMandatory,l=n.repetitionMandatoryWithSeparator,h=n.repetitionWithSeparator;(0,R.jJ)(o,function(r){var n=0===r.idx?"":r.idx;t.TRACE_INIT(""+eG(r)+n,function(){var n,o,i,s,a,l,h,d,u=(n=r.idx,o=r.maxLookahead||t.maxLookahead,i=r.hasPredicates,s=t.dynamicTokensEnabled,a=t.lookAheadBuilderForAlternatives,h=td(l=ta(n,e,o))?J:Z,a(l,i,h,s)),c=(d=t.fullRuleNameToShort[e.name],256|r.idx|d);t.setLaFuncCache(c,u)})}),(0,R.jJ)(i,function(r){t.computeLookaheadFunc(e,r.idx,768,y.REPETITION,r.maxLookahead,eG(r))}),(0,R.jJ)(s,function(r){t.computeLookaheadFunc(e,r.idx,512,y.OPTION,r.maxLookahead,eG(r))}),(0,R.jJ)(a,function(r){t.computeLookaheadFunc(e,r.idx,1024,y.REPETITION_MANDATORY,r.maxLookahead,eG(r))}),(0,R.jJ)(l,function(r){t.computeLookaheadFunc(e,r.idx,1536,y.REPETITION_MANDATORY_WITH_SEPARATOR,r.maxLookahead,eG(r))}),(0,R.jJ)(h,function(r){t.computeLookaheadFunc(e,r.idx,1280,y.REPETITION_WITH_SEPARATOR,r.maxLookahead,eG(r))})})})},e.prototype.computeLookaheadFunc=function(e,t,r,n,o,i){var s=this;this.TRACE_INIT(""+i+(0===t?"":t),function(){var i,a,l,h,d,u=(i=o||s.maxLookahead,a=s.dynamicTokensEnabled,l=s.lookAheadBuilderForOptional,d=td(h=tl(t,e,n,i))?J:Z,l(h[0],d,a)),c=t|r|s.fullRuleNameToShort[e.name];s.setLaFuncCache(c,u)})},e.prototype.lookAheadBuilderForOptional=function(e,t,r){return function(e,t,r){var n=(0,R.Si)(e,function(e){return 1===e.length}),o=e.length;if(!n||r)return function(){t:for(var r=0;r<o;r++){for(var n=e[r],i=n.length,s=0;s<i;s++)if(!1===t(this.LA(s+1),n[s]))continue t;return!0}return!1};var i=(0,R.Bq)(e);if(1===i.length&&(0,R.Im)(i[0].categoryMatches)){var s=i[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===s}}var a=(0,R.TS)(i,function(e,t,r){return e[t.tokenTypeIdx]=!0,(0,R.jJ)(t.categoryMatches,function(t){e[t]=!0}),e},[]);return function(){return!0===a[this.LA(1).tokenTypeIdx]}}(e,t,r)},e.prototype.lookAheadBuilderForAlternatives=function(e,t,r,n){var o=e.length,i=(0,R.Si)(e,function(e){return(0,R.Si)(e,function(e){return 1===e.length})});if(t)return function(t){for(var n=(0,R.Tj)(t,function(e){return e.GATE}),i=0;i<o;i++){var s=e[i],a=s.length,l=n[i];if(void 0===l||!1!==l.call(this))t:for(var h=0;h<a;h++){for(var d=s[h],u=d.length,c=0;c<u;c++)if(!1===r(this.LA(c+1),d[c]))continue t;return i}}};if(!i||n)return function(){for(var t=0;t<o;t++){var n=e[t],i=n.length;t:for(var s=0;s<i;s++){for(var a=n[s],l=a.length,h=0;h<l;h++)if(!1===r(this.LA(h+1),a[h]))continue t;return t}}};var s=(0,R.Tj)(e,function(e){return(0,R.Bq)(e)}),a=(0,R.TS)(s,function(e,t,r){return(0,R.jJ)(t,function(t){(0,R.zy)(e,t.tokenTypeIdx)||(e[t.tokenTypeIdx]=r),(0,R.jJ)(t.categoryMatches,function(t){(0,R.zy)(e,t)||(e[t]=r)})}),e},[]);return function(){return a[this.LA(1).tokenTypeIdx]}},e.prototype.getKeyForAutomaticLookahead=function(e,t){return t|e|this.getLastExplicitRuleShortName()},e.prototype.getLaFuncFromCache=function(e){},e.prototype.getLaFuncFromMap=function(e){return this.lookAheadFuncsCache.get(e)},e.prototype.getLaFuncFromObj=function(e){return this.lookAheadFuncsCache[e]},e.prototype.setLaFuncCache=function(e,t){},e.prototype.setLaFuncCacheUsingMap=function(e,t){this.lookAheadFuncsCache.set(e,t)},e.prototype.setLaFuncUsingObj=function(e,t){this.lookAheadFuncsCache[e]=t},e}(),tW=/^\s*function\s*(\S*)\s*\(/,tG="name";function t$(e){var t=e.name;return t||e.toString().match(tW)[1]}function tY(e,t){var r=Object.getOwnPropertyDescriptor(e,tG);return(!!(0,R.b0)(r)||!!r.configurable)&&(Object.defineProperty(e,tG,{enumerable:!1,configurable:!0,writable:!1,value:t}),!0)}function tj(e,t){for(var r=(0,R.HP)(e),n=r.length,o=0;o<n;o++)for(var i=e[r[o]],s=i.length,a=0;a<s;a++){var l=i[a];void 0===l.tokenTypeIdx&&(void 0!==l.fullName?this[l.fullName](l.children,t):this[l.name](l.children,t))}}(m=w||(w={}))[m.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",m[m.MISSING_METHOD=1]="MISSING_METHOD";var tq=["constructor","visit","validateVisitor"],tK=function(){function e(){}return e.prototype.initTreeBuilder=function(e){if(this.LAST_EXPLICIT_RULE_STACK=[],this.CST_STACK=[],this.outputCst=(0,R.zy)(e,"outputCst")?e.outputCst:rn.outputCst,this.nodeLocationTracking=(0,R.zy)(e,"nodeLocationTracking")?e.nodeLocationTracking:rn.nodeLocationTracking,this.outputCst)if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=eJ,this.setNodeLocationFromNode=eJ,this.cstPostRule=R.tE,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=R.tE,this.setNodeLocationFromNode=R.tE,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=eZ,this.setNodeLocationFromNode=eZ,this.cstPostRule=R.tE,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=R.tE,this.setNodeLocationFromNode=R.tE,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=R.tE,this.setNodeLocationFromNode=R.tE,this.cstPostRule=R.tE,this.setInitialNodeLocation=R.tE;else throw Error('Invalid <nodeLocationTracking> config option: "'+e.nodeLocationTracking+'"');else this.cstInvocationStateUpdate=R.tE,this.cstFinallyStateUpdate=R.tE,this.cstPostTerminal=R.tE,this.cstPostNonTerminal=R.tE,this.cstPostRule=R.tE,this.getLastExplicitRuleShortName=this.getLastExplicitRuleShortNameNoCst,this.getPreviousExplicitRuleShortName=this.getPreviousExplicitRuleShortNameNoCst,this.getLastExplicitRuleOccurrenceIndex=this.getLastExplicitRuleOccurrenceIndexNoCst,this.manyInternal=this.manyInternalNoCst,this.orInternal=this.orInternalNoCst,this.optionInternal=this.optionInternalNoCst,this.atLeastOneInternal=this.atLeastOneInternalNoCst,this.manySepFirstInternal=this.manySepFirstInternalNoCst,this.atLeastOneSepFirstInternal=this.atLeastOneSepFirstInternalNoCst},e.prototype.setInitialNodeLocationOnlyOffsetRecovery=function(e){e.location={startOffset:NaN,endOffset:NaN}},e.prototype.setInitialNodeLocationOnlyOffsetRegular=function(e){e.location={startOffset:this.LA(1).startOffset,endOffset:NaN}},e.prototype.setInitialNodeLocationFullRecovery=function(e){e.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}},e.prototype.setInitialNodeLocationFullRegular=function(e){var t=this.LA(1);e.location={startOffset:t.startOffset,startLine:t.startLine,startColumn:t.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}},e.prototype.cstNestedInvocationStateUpdate=function(e,t){var r={name:e,fullName:this.shortRuleNameToFull[this.getLastExplicitRuleShortName()]+e,children:{}};this.setInitialNodeLocation(r),this.CST_STACK.push(r)},e.prototype.cstInvocationStateUpdate=function(e,t){this.LAST_EXPLICIT_RULE_STACK.push(this.RULE_STACK.length-1);var r={name:e,children:{}};this.setInitialNodeLocation(r),this.CST_STACK.push(r)},e.prototype.cstFinallyStateUpdate=function(){this.LAST_EXPLICIT_RULE_STACK.pop(),this.CST_STACK.pop()},e.prototype.cstNestedFinallyStateUpdate=function(){var e=this.CST_STACK.pop();this.cstPostRule(e)},e.prototype.cstPostRuleFull=function(e){var t=this.LA(0),r=e.location;r.startOffset<=t.startOffset==!0?(r.endOffset=t.endOffset,r.endLine=t.endLine,r.endColumn=t.endColumn):(r.startOffset=NaN,r.startLine=NaN,r.startColumn=NaN)},e.prototype.cstPostRuleOnlyOffset=function(e){var t=this.LA(0),r=e.location;r.startOffset<=t.startOffset==!0?r.endOffset=t.endOffset:r.startOffset=NaN},e.prototype.cstPostTerminal=function(e,t){var r=this.CST_STACK[this.CST_STACK.length-1];void 0===r.children[e]?r.children[e]=[t]:r.children[e].push(t),this.setNodeLocationFromToken(r.location,t)},e.prototype.cstPostNonTerminal=function(e,t){if(!0!==this.isBackTracking()){var r=this.CST_STACK[this.CST_STACK.length-1];e0(r,t,e),this.setNodeLocationFromNode(r.location,e.location)}},e.prototype.getBaseCstVisitorConstructor=function(){if((0,R.b0)(this.baseCstVisitorConstructor)){var e,t,r,n=(e=this.className,t=this.allRuleNames,tY(r=function(){},e+"BaseSemantics"),r.prototype={visit:function(e,t){if((0,R.cy)(e)&&(e=e[0]),!(0,R.b0)(e))if(void 0!==e.fullName)return this[e.fullName](e.children,t);else return this[e.name](e.children,t)},validateVisitor:function(){var e,r,n,o,i,s,a,l=(e=this,r=t,s=(n=e,o=r,i=(0,R.Tj)(o,function(e){if(!(0,R.Tn)(n[e]))return{msg:"Missing visitor method: <"+e+"> on "+t$(n.constructor)+" CST Visitor.",type:w.MISSING_METHOD,methodName:e}}),(0,R.oE)(i)),a=function(e,t){var r=[];for(var n in e)tm.test(n)&&(0,R.Tn)(e[n])&&!(0,R.gR)(tq,n)&&!(0,R.gR)(t,n)&&r.push({msg:"Redundant visitor method: <"+n+"> on "+t$(e.constructor)+" CST Visitor\nThere is no Grammar Rule corresponding to this method's name.\nFor utility methods on visitor classes use methods names that do not match /"+tm.source+"/.",type:w.REDUNDANT_METHOD,methodName:n});return r}(e,r),s.concat(a));if(!(0,R.Im)(l)){var h=(0,R.Tj)(l,function(e){return e.msg});throw Error("Errors Detected in CST Visitor <"+t$(this.constructor)+">:\n	"+h.join("\n\n").replace(/\n/g,"\n	"))}}},r.prototype.constructor=r,r._RULE_NAMES=t,r);return this.baseCstVisitorConstructor=n,n}return this.baseCstVisitorConstructor},e.prototype.getBaseCstVisitorConstructorWithDefaults=function(){if((0,R.b0)(this.baseCstVisitorWithDefaultsConstructor)){var e,t,r,n,o,i=(e=this.className,t=this.allRuleNames,r=this.getBaseCstVisitorConstructor(),tY(n=function(){},e+"BaseSemanticsWithDefaults"),o=Object.create(r.prototype),(0,R.jJ)(t,function(e){o[e]=tj}),n.prototype=o,n.prototype.constructor=n,n);return this.baseCstVisitorWithDefaultsConstructor=i,i}return this.baseCstVisitorWithDefaultsConstructor},e.prototype.nestedRuleBeforeClause=function(e,t){var r;return void 0!==e.NAME?(r=e.NAME,this.nestedRuleInvocationStateUpdate(r,t),r):void 0},e.prototype.nestedAltBeforeClause=function(e,t,r,n){var o,i,s=(o=this.getLastExplicitRuleShortName(),t|r|o|n+1<<24);return void 0!==e.NAME?(i=e.NAME,this.nestedRuleInvocationStateUpdate(i,s),{shortName:s,nestedName:i}):void 0},e.prototype.nestedRuleFinallyClause=function(e,t){var r=this.CST_STACK,n=r[r.length-1];this.nestedRuleFinallyStateUpdate();var o=r[r.length-1];e0(o,t,n),this.setNodeLocationFromNode(o.location,n.location)},e.prototype.getLastExplicitRuleShortName=function(){var e=this.LAST_EXPLICIT_RULE_STACK[this.LAST_EXPLICIT_RULE_STACK.length-1];return this.RULE_STACK[e]},e.prototype.getLastExplicitRuleShortNameNoCst=function(){var e=this.RULE_STACK;return e[e.length-1]},e.prototype.getPreviousExplicitRuleShortName=function(){var e=this.LAST_EXPLICIT_RULE_STACK[this.LAST_EXPLICIT_RULE_STACK.length-2];return this.RULE_STACK[e]},e.prototype.getPreviousExplicitRuleShortNameNoCst=function(){var e=this.RULE_STACK;return e[e.length-2]},e.prototype.getLastExplicitRuleOccurrenceIndex=function(){var e=this.LAST_EXPLICIT_RULE_STACK[this.LAST_EXPLICIT_RULE_STACK.length-1];return this.RULE_OCCURRENCE_STACK[e]},e.prototype.getLastExplicitRuleOccurrenceIndexNoCst=function(){var e=this.RULE_OCCURRENCE_STACK;return e[e.length-1]},e.prototype.nestedRuleInvocationStateUpdate=function(e,t){this.RULE_OCCURRENCE_STACK.push(1),this.RULE_STACK.push(t),this.cstNestedInvocationStateUpdate(e,t)},e.prototype.nestedRuleFinallyStateUpdate=function(){this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstNestedFinallyStateUpdate()},e}(),tX=function(){function e(){}return e.prototype.initLexerAdapter=function(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1},Object.defineProperty(e.prototype,"input",{get:function(){return this.tokVector},set:function(e){if(!0!==this.selfAnalysisDone)throw Error("Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=e,this.tokVectorLength=e.length},enumerable:!0,configurable:!0}),e.prototype.SKIP_TOKEN=function(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):rr},e.prototype.LA=function(e){var t=this.currIdx+e;return t<0||this.tokVectorLength<=t?rr:this.tokVector[t]},e.prototype.consumeToken=function(){this.currIdx++},e.prototype.exportLexerState=function(){return this.currIdx},e.prototype.importLexerState=function(e){this.currIdx=e},e.prototype.resetLexerState=function(){this.currIdx=-1},e.prototype.moveToTerminatedState=function(){this.currIdx=this.tokVector.length-1},e.prototype.getLexerPosition=function(){return this.exportLexerState()},e}(),tQ=function(){function e(){}return e.prototype.ACTION=function(e){return e.call(this)},e.prototype.consume=function(e,t,r){return this.consumeInternal(t,e,r)},e.prototype.subrule=function(e,t,r){return this.subruleInternal(t,e,r)},e.prototype.option=function(e,t){return this.optionInternal(t,e)},e.prototype.or=function(e,t){return this.orInternal(t,e)},e.prototype.many=function(e,t){return this.manyInternal(e,t)},e.prototype.atLeastOne=function(e,t){return this.atLeastOneInternal(e,t)},e.prototype.CONSUME=function(e,t){return this.consumeInternal(e,0,t)},e.prototype.CONSUME1=function(e,t){return this.consumeInternal(e,1,t)},e.prototype.CONSUME2=function(e,t){return this.consumeInternal(e,2,t)},e.prototype.CONSUME3=function(e,t){return this.consumeInternal(e,3,t)},e.prototype.CONSUME4=function(e,t){return this.consumeInternal(e,4,t)},e.prototype.CONSUME5=function(e,t){return this.consumeInternal(e,5,t)},e.prototype.CONSUME6=function(e,t){return this.consumeInternal(e,6,t)},e.prototype.CONSUME7=function(e,t){return this.consumeInternal(e,7,t)},e.prototype.CONSUME8=function(e,t){return this.consumeInternal(e,8,t)},e.prototype.CONSUME9=function(e,t){return this.consumeInternal(e,9,t)},e.prototype.SUBRULE=function(e,t){return this.subruleInternal(e,0,t)},e.prototype.SUBRULE1=function(e,t){return this.subruleInternal(e,1,t)},e.prototype.SUBRULE2=function(e,t){return this.subruleInternal(e,2,t)},e.prototype.SUBRULE3=function(e,t){return this.subruleInternal(e,3,t)},e.prototype.SUBRULE4=function(e,t){return this.subruleInternal(e,4,t)},e.prototype.SUBRULE5=function(e,t){return this.subruleInternal(e,5,t)},e.prototype.SUBRULE6=function(e,t){return this.subruleInternal(e,6,t)},e.prototype.SUBRULE7=function(e,t){return this.subruleInternal(e,7,t)},e.prototype.SUBRULE8=function(e,t){return this.subruleInternal(e,8,t)},e.prototype.SUBRULE9=function(e,t){return this.subruleInternal(e,9,t)},e.prototype.OPTION=function(e){return this.optionInternal(e,0)},e.prototype.OPTION1=function(e){return this.optionInternal(e,1)},e.prototype.OPTION2=function(e){return this.optionInternal(e,2)},e.prototype.OPTION3=function(e){return this.optionInternal(e,3)},e.prototype.OPTION4=function(e){return this.optionInternal(e,4)},e.prototype.OPTION5=function(e){return this.optionInternal(e,5)},e.prototype.OPTION6=function(e){return this.optionInternal(e,6)},e.prototype.OPTION7=function(e){return this.optionInternal(e,7)},e.prototype.OPTION8=function(e){return this.optionInternal(e,8)},e.prototype.OPTION9=function(e){return this.optionInternal(e,9)},e.prototype.OR=function(e){return this.orInternal(e,0)},e.prototype.OR1=function(e){return this.orInternal(e,1)},e.prototype.OR2=function(e){return this.orInternal(e,2)},e.prototype.OR3=function(e){return this.orInternal(e,3)},e.prototype.OR4=function(e){return this.orInternal(e,4)},e.prototype.OR5=function(e){return this.orInternal(e,5)},e.prototype.OR6=function(e){return this.orInternal(e,6)},e.prototype.OR7=function(e){return this.orInternal(e,7)},e.prototype.OR8=function(e){return this.orInternal(e,8)},e.prototype.OR9=function(e){return this.orInternal(e,9)},e.prototype.MANY=function(e){this.manyInternal(0,e)},e.prototype.MANY1=function(e){this.manyInternal(1,e)},e.prototype.MANY2=function(e){this.manyInternal(2,e)},e.prototype.MANY3=function(e){this.manyInternal(3,e)},e.prototype.MANY4=function(e){this.manyInternal(4,e)},e.prototype.MANY5=function(e){this.manyInternal(5,e)},e.prototype.MANY6=function(e){this.manyInternal(6,e)},e.prototype.MANY7=function(e){this.manyInternal(7,e)},e.prototype.MANY8=function(e){this.manyInternal(8,e)},e.prototype.MANY9=function(e){this.manyInternal(9,e)},e.prototype.MANY_SEP=function(e){this.manySepFirstInternal(0,e)},e.prototype.MANY_SEP1=function(e){this.manySepFirstInternal(1,e)},e.prototype.MANY_SEP2=function(e){this.manySepFirstInternal(2,e)},e.prototype.MANY_SEP3=function(e){this.manySepFirstInternal(3,e)},e.prototype.MANY_SEP4=function(e){this.manySepFirstInternal(4,e)},e.prototype.MANY_SEP5=function(e){this.manySepFirstInternal(5,e)},e.prototype.MANY_SEP6=function(e){this.manySepFirstInternal(6,e)},e.prototype.MANY_SEP7=function(e){this.manySepFirstInternal(7,e)},e.prototype.MANY_SEP8=function(e){this.manySepFirstInternal(8,e)},e.prototype.MANY_SEP9=function(e){this.manySepFirstInternal(9,e)},e.prototype.AT_LEAST_ONE=function(e){this.atLeastOneInternal(0,e)},e.prototype.AT_LEAST_ONE1=function(e){return this.atLeastOneInternal(1,e)},e.prototype.AT_LEAST_ONE2=function(e){this.atLeastOneInternal(2,e)},e.prototype.AT_LEAST_ONE3=function(e){this.atLeastOneInternal(3,e)},e.prototype.AT_LEAST_ONE4=function(e){this.atLeastOneInternal(4,e)},e.prototype.AT_LEAST_ONE5=function(e){this.atLeastOneInternal(5,e)},e.prototype.AT_LEAST_ONE6=function(e){this.atLeastOneInternal(6,e)},e.prototype.AT_LEAST_ONE7=function(e){this.atLeastOneInternal(7,e)},e.prototype.AT_LEAST_ONE8=function(e){this.atLeastOneInternal(8,e)},e.prototype.AT_LEAST_ONE9=function(e){this.atLeastOneInternal(9,e)},e.prototype.AT_LEAST_ONE_SEP=function(e){this.atLeastOneSepFirstInternal(0,e)},e.prototype.AT_LEAST_ONE_SEP1=function(e){this.atLeastOneSepFirstInternal(1,e)},e.prototype.AT_LEAST_ONE_SEP2=function(e){this.atLeastOneSepFirstInternal(2,e)},e.prototype.AT_LEAST_ONE_SEP3=function(e){this.atLeastOneSepFirstInternal(3,e)},e.prototype.AT_LEAST_ONE_SEP4=function(e){this.atLeastOneSepFirstInternal(4,e)},e.prototype.AT_LEAST_ONE_SEP5=function(e){this.atLeastOneSepFirstInternal(5,e)},e.prototype.AT_LEAST_ONE_SEP6=function(e){this.atLeastOneSepFirstInternal(6,e)},e.prototype.AT_LEAST_ONE_SEP7=function(e){this.atLeastOneSepFirstInternal(7,e)},e.prototype.AT_LEAST_ONE_SEP8=function(e){this.atLeastOneSepFirstInternal(8,e)},e.prototype.AT_LEAST_ONE_SEP9=function(e){this.atLeastOneSepFirstInternal(9,e)},e.prototype.RULE=function(e,t,r){if(void 0===r&&(r=ro),(0,R.gR)(this.definedRulesNames,e)){var n={message:tS.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:S.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(n)}this.definedRulesNames.push(e);var o=this.defineRule(e,t,r);return this[e]=o,o},e.prototype.OVERRIDE_RULE=function(e,t,r){void 0===r&&(r=ro);var n,o,i,s=[];s=s.concat((n=this.definedRulesNames,o=this.className,i=[],R.gR(n,e)||i.push({message:"Invalid rule override, rule: ->"+e+"<- cannot be overridden in the grammar: ->"+o+"<-as it is not defined in any of the super grammars ",type:S.INVALID_RULE_OVERRIDE,ruleName:e}),i)),this.definitionErrors.push.apply(this.definitionErrors,s);var a=this.defineRule(e,t,r);return this[e]=a,a},e.prototype.BACKTRACK=function(e,t){return function(){this.isBackTrackingStack.push(1);var r=this.saveRecogState();try{return e.apply(this,t),!0}catch(e){if(tk(e))return!1;throw e}finally{this.reloadRecogState(r),this.isBackTrackingStack.pop()}}},e.prototype.getGAstProductions=function(){return this.gastProductionsCache},e.prototype.getSerializedGastProductions=function(){return eD((0,R.zu)(this.gastProductionsCache))},e}(),tZ=function(){function e(){}return e.prototype.initRecognizerEngine=function(e,t){if(this.className=t$(this.constructor),this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=J,this.definedRulesNames=[],this.tokensMap={},this.allRuleNames=[],this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},(0,R.zy)(t,"serializedGrammar"))throw Error("The Parser's configuration can no longer contain a <serializedGrammar> property.\n	See: https://sap.github.io/chevrotain/docs/changes/BREAKING_CHANGES.html#_6-0-0\n	For Further details.");if((0,R.cy)(e)){if((0,R.Im)(e))throw Error("A Token Vocabulary cannot be empty.\n	Note that the first argument for the parser constructor\n	is no longer a Token vector (since v4.0).");if("number"==typeof e[0].startOffset)throw Error("The Parser constructor no longer accepts a token vector as the first argument.\n	See: https://sap.github.io/chevrotain/docs/changes/BREAKING_CHANGES.html#_4-0-0\n	For Further details.")}if((0,R.cy)(e))this.tokensMap=(0,R.TS)(e,function(e,t){return e[t.name]=t,e},{});else if((0,R.zy)(e,"modes")&&(0,R.Si)((0,R.Bq)((0,R.zu)(e.modes)),ei)){var r=(0,R.Bq)((0,R.zu)(e.modes)),n=(0,R.sb)(r);this.tokensMap=(0,R.TS)(n,function(e,t){return e[t.name]=t,e},{})}else if((0,R.Gv)(e))this.tokensMap=(0,R.lR)(e);else throw Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=ev;var o=(0,R.Si)((0,R.zu)(e),function(e){return(0,R.Im)(e.categoryMatches)});this.tokenMatcher=o?J:Z,er((0,R.zu)(this.tokensMap))},e.prototype.defineRule=function(e,t,r){if(this.selfAnalysisDone)throw Error("Grammar rule <"+e+"> may not be defined after the 'performSelfAnalysis' method has been called'\nMake sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.");var n,o=(0,R.zy)(r,"resyncEnabled")?r.resyncEnabled:ro.resyncEnabled,i=(0,R.zy)(r,"recoveryValueFunc")?r.recoveryValueFunc:ro.recoveryValueFunc,s=this.ruleShortNameIdx<<12;function a(e){try{if(!0!==this.outputCst)return t.apply(this,e);t.apply(this,e);var r=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(r),r}catch(e){return this.invokeRuleCatch(e,o,i)}finally{this.ruleFinallyStateUpdate()}}return this.ruleShortNameIdx++,this.shortRuleNameToFull[s]=e,this.fullRuleNameToShort[e]=s,(n=function(t,r){return void 0===t&&(t=0),this.ruleInvocationStateUpdate(s,e,t),a.call(this,r)}).ruleName=e,n.originalGrammarAction=t,n},e.prototype.invokeRuleCatch=function(e,t,r){var n=1===this.RULE_STACK.length,o=t&&!this.isBackTracking()&&this.recoveryEnabled;if(tk(e)){if(o){var i=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(i)){if(e.resyncedTokens=this.reSyncTo(i),!this.outputCst)return r();var s=this.CST_STACK[this.CST_STACK.length-1];return s.recoveredNode=!0,s}if(this.outputCst){var s=this.CST_STACK[this.CST_STACK.length-1];s.recoveredNode=!0,e.partialCstResult=s}throw e}if(n)return this.moveToTerminatedState(),r()}throw e},e.prototype.optionInternal=function(e,t){var r=this.getKeyForAutomaticLookahead(512,t),n=this.nestedRuleBeforeClause(e,r);try{return this.optionInternalLogic(e,t,r)}finally{void 0!==n&&this.nestedRuleFinallyClause(r,n)}},e.prototype.optionInternalNoCst=function(e,t){var r=this.getKeyForAutomaticLookahead(512,t);return this.optionInternalLogic(e,t,r)},e.prototype.optionInternalLogic=function(e,t,r){var n,o,i=this,s=this.getLaFuncFromCache(r);if(void 0!==e.DEF){if(n=e.DEF,void 0!==(o=e.GATE)){var a=s;s=function(){return o.call(i)&&a.call(i)}}}else n=e;if(!0===s.call(this))return n.call(this)},e.prototype.atLeastOneInternal=function(e,t){var r=this.getKeyForAutomaticLookahead(1024,e),n=this.nestedRuleBeforeClause(t,r);try{return this.atLeastOneInternalLogic(e,t,r)}finally{void 0!==n&&this.nestedRuleFinallyClause(r,n)}},e.prototype.atLeastOneInternalNoCst=function(e,t){var r=this.getKeyForAutomaticLookahead(1024,e);this.atLeastOneInternalLogic(e,t,r)},e.prototype.atLeastOneInternalLogic=function(e,t,r){var n,o,i=this,s=this.getLaFuncFromCache(r);if(void 0!==t.DEF){if(n=t.DEF,void 0!==(o=t.GATE)){var a=s;s=function(){return o.call(i)&&a.call(i)}}}else n=t;if(!0===s.call(this))for(var l=this.doSingleRepetition(n);!0===s.call(this)&&!0===l;)l=this.doSingleRepetition(n);else throw this.raiseEarlyExitException(e,y.REPETITION_MANDATORY,t.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,t],s,1024,e,e9)},e.prototype.atLeastOneSepFirstInternal=function(e,t){var r=this.getKeyForAutomaticLookahead(1536,e),n=this.nestedRuleBeforeClause(t,r);try{this.atLeastOneSepFirstInternalLogic(e,t,r)}finally{void 0!==n&&this.nestedRuleFinallyClause(r,n)}},e.prototype.atLeastOneSepFirstInternalNoCst=function(e,t){var r=this.getKeyForAutomaticLookahead(1536,e);this.atLeastOneSepFirstInternalLogic(e,t,r)},e.prototype.atLeastOneSepFirstInternalLogic=function(e,t,r){var n=this,o=t.DEF,i=t.SEP;if(!0===this.getLaFuncFromCache(r).call(this)){o.call(this);for(var s=function(){return n.tokenMatcher(n.LA(1),i)};!0===this.tokenMatcher(this.LA(1),i);)this.CONSUME(i),o.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,s,o,e7],s,1536,e,e7)}else throw this.raiseEarlyExitException(e,y.REPETITION_MANDATORY_WITH_SEPARATOR,t.ERR_MSG)},e.prototype.manyInternal=function(e,t){var r=this.getKeyForAutomaticLookahead(768,e),n=this.nestedRuleBeforeClause(t,r);try{return this.manyInternalLogic(e,t,r)}finally{void 0!==n&&this.nestedRuleFinallyClause(r,n)}},e.prototype.manyInternalNoCst=function(e,t){var r=this.getKeyForAutomaticLookahead(768,e);return this.manyInternalLogic(e,t,r)},e.prototype.manyInternalLogic=function(e,t,r){var n,o,i=this,s=this.getLaFuncFromCache(r);if(void 0!==t.DEF){if(n=t.DEF,void 0!==(o=t.GATE)){var a=s;s=function(){return o.call(i)&&a.call(i)}}}else n=t;for(var l=!0;!0===s.call(this)&&!0===l;)l=this.doSingleRepetition(n);this.attemptInRepetitionRecovery(this.manyInternal,[e,t],s,768,e,e5,l)},e.prototype.manySepFirstInternal=function(e,t){var r=this.getKeyForAutomaticLookahead(1280,e),n=this.nestedRuleBeforeClause(t,r);try{this.manySepFirstInternalLogic(e,t,r)}finally{void 0!==n&&this.nestedRuleFinallyClause(r,n)}},e.prototype.manySepFirstInternalNoCst=function(e,t){var r=this.getKeyForAutomaticLookahead(1280,e);this.manySepFirstInternalLogic(e,t,r)},e.prototype.manySepFirstInternalLogic=function(e,t,r){var n=this,o=t.DEF,i=t.SEP;if(!0===this.getLaFuncFromCache(r).call(this)){o.call(this);for(var s=function(){return n.tokenMatcher(n.LA(1),i)};!0===this.tokenMatcher(this.LA(1),i);)this.CONSUME(i),o.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,s,o,e4],s,1280,e,e4)}},e.prototype.repetitionSepSecondInternal=function(e,t,r,n,o){for(;r();)this.CONSUME(t),n.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,t,r,n,o],r,1536,e,o)},e.prototype.doSingleRepetition=function(e){var t=this.getLexerPosition();return e.call(this),this.getLexerPosition()>t},e.prototype.orInternalNoCst=function(e,t){var r=(0,R.cy)(e)?e:e.DEF,n=this.getKeyForAutomaticLookahead(256,t),o=this.getLaFuncFromCache(n).call(this,r);if(void 0!==o)return r[o].ALT.call(this);this.raiseNoAltException(t,e.ERR_MSG)},e.prototype.orInternal=function(e,t){var r=this.getKeyForAutomaticLookahead(256,t),n=this.nestedRuleBeforeClause(e,r);try{var o=(0,R.cy)(e)?e:e.DEF,i=this.getLaFuncFromCache(r).call(this,o);if(void 0!==i){var s=o[i],a=this.nestedAltBeforeClause(s,t,256,i);try{return s.ALT.call(this)}finally{void 0!==a&&this.nestedRuleFinallyClause(a.shortName,a.nestedName)}}this.raiseNoAltException(t,e.ERR_MSG)}finally{void 0!==n&&this.nestedRuleFinallyClause(r,n)}},e.prototype.ruleFinallyStateUpdate=function(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),0===this.RULE_STACK.length&&!1===this.isAtEndOfInput()){var e=this.LA(1),t=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new tL(t,e))}},e.prototype.subruleInternal=function(e,t,r){var n;try{var o=void 0!==r?r.ARGS:void 0;return n=e.call(this,t,o),this.cstPostNonTerminal(n,void 0!==r&&void 0!==r.LABEL?r.LABEL:e.ruleName),n}catch(t){this.subruleInternalError(t,r,e.ruleName)}},e.prototype.subruleInternalError=function(e,t,r){throw tk(e)&&void 0!==e.partialCstResult&&(this.cstPostNonTerminal(e.partialCstResult,void 0!==t&&void 0!==t.LABEL?t.LABEL:r),delete e.partialCstResult),e},e.prototype.consumeInternal=function(e,t,r){var n;try{var o=this.LA(1);!0===this.tokenMatcher(o,e)?(this.consumeToken(),n=o):this.consumeInternalError(e,o,r)}catch(r){n=this.consumeInternalRecovery(e,t,r)}return this.cstPostTerminal(void 0!==r&&void 0!==r.LABEL?r.LABEL:e.name,n),n},e.prototype.consumeInternalError=function(e,t,r){var n,o=this.LA(0);throw n=void 0!==r&&r.ERR_MSG?r.ERR_MSG:this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:t,previous:o,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new tH(n,t,o))},e.prototype.consumeInternalRecovery=function(e,t,r){if(this.recoveryEnabled&&"MismatchedTokenException"===r.name&&!this.isBackTracking()){var n=this.getFollowsForInRuleRecovery(e,t);try{return this.tryInRuleRecovery(e,n)}catch(e){if(e.name===tF)throw r;throw e}}throw r},e.prototype.saveRecogState=function(){var e=this.errors,t=(0,R.T9)(this.RULE_STACK);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:t,CST_STACK:this.CST_STACK,LAST_EXPLICIT_RULE_STACK:this.LAST_EXPLICIT_RULE_STACK}},e.prototype.reloadRecogState=function(e){this.errors=e.errors,this.importLexerState(e.lexerState),this.RULE_STACK=e.RULE_STACK},e.prototype.ruleInvocationStateUpdate=function(e,t,r){this.RULE_OCCURRENCE_STACK.push(r),this.RULE_STACK.push(e),this.cstInvocationStateUpdate(t,e)},e.prototype.isBackTracking=function(){return 0!==this.isBackTrackingStack.length},e.prototype.getCurrRuleFullName=function(){var e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]},e.prototype.shortRuleNameToFullName=function(e){return this.shortRuleNameToFull[e]},e.prototype.isAtEndOfInput=function(){return this.tokenMatcher(this.LA(1),ev)},e.prototype.reset=function(){this.resetLexerState(),this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.LAST_EXPLICIT_RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]},e}(),tJ=function(){function e(){}return e.prototype.initErrorHandler=function(e){this._errors=[],this.errorMessageProvider=(0,R.NT)(e.errorMessageProvider,rn.errorMessageProvider)},e.prototype.SAVE_ERROR=function(e){if(tk(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:(0,R.T9)(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")},Object.defineProperty(e.prototype,"errors",{get:function(){return(0,R.T9)(this._errors)},set:function(e){this._errors=e},enumerable:!0,configurable:!0}),e.prototype.raiseEarlyExitException=function(e,t,r){for(var n=this.getCurrRuleFullName(),o=tl(e,this.getGAstProductions()[n],t,this.maxLookahead)[0],i=[],s=1;s<=this.maxLookahead;s++)i.push(this.LA(s));var a=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:o,actual:i,previous:this.LA(0),customUserDescription:r,ruleName:n});throw this.SAVE_ERROR(new tP(a,this.LA(1),this.LA(0)))},e.prototype.raiseNoAltException=function(e,t){for(var r=this.getCurrRuleFullName(),n=ta(e,this.getGAstProductions()[r],this.maxLookahead),o=[],i=1;i<=this.maxLookahead;i++)o.push(this.LA(i));var s=this.LA(0),a=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:n,actual:o,previous:s,customUserDescription:t,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new t_(a,this.LA(1),s))},e}(),t0=function(){function e(){}return e.prototype.initContentAssist=function(){},e.prototype.computeContentAssist=function(e,t){var r=this.gastProductionsCache[e];if((0,R.b0)(r))throw Error("Rule ->"+e+"<- does not exist in this grammar.");return te([r],t,this.tokenMatcher,this.maxLookahead)},e.prototype.getNextPossibleTokenTypes=function(e){var t=(0,R.$1)(e.ruleStack);return new e3(this.getGAstProductions()[t],e).startWalking()},e}(),t1={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(t1);var t2=eS({name:"RECORDING_PHASE_TOKEN",pattern:el.NA});er([t2]);var t3=eR(t2,"This IToken indicates the Parser is in Recording Phase\n	See: https://sap.github.io/chevrotain/docs/guide/internals.html#grammar-recording for details",-1,-1,-1,-1,-1,-1);Object.freeze(t3);var t6={name:"This CSTNode indicates the Parser is in Recording Phase\n	See: https://sap.github.io/chevrotain/docs/guide/internals.html#grammar-recording for details",children:{}},t5=function(){function e(){}return e.prototype.initGastRecorder=function(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1},e.prototype.enableRecording=function(){var e=this;this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",function(){for(var t=function(t){var r=t>0?t:"";e["CONSUME"+r]=function(e,r){return this.consumeInternalRecord(e,t,r)},e["SUBRULE"+r]=function(e,r){return this.subruleInternalRecord(e,t,r)},e["OPTION"+r]=function(e){return this.optionInternalRecord(e,t)},e["OR"+r]=function(e){return this.orInternalRecord(e,t)},e["MANY"+r]=function(e){this.manyInternalRecord(t,e)},e["MANY_SEP"+r]=function(e){this.manySepFirstInternalRecord(t,e)},e["AT_LEAST_ONE"+r]=function(e){this.atLeastOneInternalRecord(t,e)},e["AT_LEAST_ONE_SEP"+r]=function(e){this.atLeastOneSepFirstInternalRecord(t,e)}},r=0;r<10;r++)t(r);e.consume=function(e,t,r){return this.consumeInternalRecord(t,e,r)},e.subrule=function(e,t,r){return this.subruleInternalRecord(t,e,r)},e.option=function(e,t){return this.optionInternalRecord(t,e)},e.or=function(e,t){return this.orInternalRecord(t,e)},e.many=function(e,t){this.manyInternalRecord(e,t)},e.atLeastOne=function(e,t){this.atLeastOneInternalRecord(e,t)},e.ACTION=e.ACTION_RECORD,e.BACKTRACK=e.BACKTRACK_RECORD,e.LA=e.LA_RECORD})},e.prototype.disableRecording=function(){var e=this;this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",function(){for(var t=0;t<10;t++){var r=t>0?t:"";delete e["CONSUME"+r],delete e["SUBRULE"+r],delete e["OPTION"+r],delete e["OR"+r],delete e["MANY"+r],delete e["MANY_SEP"+r],delete e["AT_LEAST_ONE"+r],delete e["AT_LEAST_ONE_SEP"+r]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA})},e.prototype.ACTION_RECORD=function(e){},e.prototype.BACKTRACK_RECORD=function(e,t){return function(){return!0}},e.prototype.LA_RECORD=function(e){return rr},e.prototype.topLevelRuleRecord=function(e,t){try{var r=new eI({definition:[],name:e});return r.name=e,this.recordingProdStack.push(r),t.call(this),this.recordingProdStack.pop(),r}catch(e){if(!0!==e.KNOWN_RECORDER_ERROR)try{e.message=e.message+'\n	 This error was thrown during the "grammar recording phase" For more info see:\n	https://sap.github.io/chevrotain/docs/guide/internals.html#grammar-recording'}catch(e){}throw e}},e.prototype.optionInternalRecord=function(e,t){return t4.call(this,eN,e,t)},e.prototype.atLeastOneInternalRecord=function(e,t){t4.call(this,eO,t,e)},e.prototype.atLeastOneSepFirstInternalRecord=function(e,t){t4.call(this,ek,t,e,!0)},e.prototype.manyInternalRecord=function(e,t){t4.call(this,eH,t,e)},e.prototype.manySepFirstInternalRecord=function(e,t){t4.call(this,e_,t,e,!0)},e.prototype.orInternalRecord=function(e,t){return t9.call(this,e,t)},e.prototype.subruleInternalRecord=function(e,t,r){if(t8(t),!e||!1===(0,R.zy)(e,"ruleName")){var n=Error("<SUBRULE"+t7(t)+"> argument is invalid expecting a Parser method reference but got: <"+JSON.stringify(e)+">\n inside top level rule: <"+this.recordingProdStack[0].name+">");throw n.KNOWN_RECORDER_ERROR=!0,n}var o=(0,R.se)(this.recordingProdStack),i=new eM({idx:t,nonTerminalName:e.ruleName,referencedRule:void 0});return o.definition.push(i),this.outputCst?t6:t1},e.prototype.consumeInternalRecord=function(e,t,r){if(t8(t),!en(e)){var n=Error("<CONSUME"+t7(t)+"> argument is invalid expecting a TokenType reference but got: <"+JSON.stringify(e)+">\n inside top level rule: <"+this.recordingProdStack[0].name+">");throw n.KNOWN_RECORDER_ERROR=!0,n}var o=(0,R.se)(this.recordingProdStack),i=new eP({idx:t,terminalType:e});return o.definition.push(i),t3},e}();function t4(e,t,r,n){void 0===n&&(n=!1),t8(r);var o=(0,R.se)(this.recordingProdStack),i=(0,R.Tn)(t)?t:t.DEF,s=new e({definition:[],idx:r});return(0,R.zy)(t,"NAME")&&(s.name=t.NAME),n&&(s.separator=t.SEP),(0,R.zy)(t,"MAX_LOOKAHEAD")&&(s.maxLookahead=t.MAX_LOOKAHEAD),this.recordingProdStack.push(s),i.call(this),o.definition.push(s),this.recordingProdStack.pop(),t1}function t9(e,t){var r=this;t8(t);var n=(0,R.se)(this.recordingProdStack),o=!1===(0,R.cy)(e),i=!1===o?e:e.DEF,s=new eL({definition:[],idx:t,ignoreAmbiguities:o&&!0===e.IGNORE_AMBIGUITIES});return(0,R.zy)(e,"NAME")&&(s.name=e.NAME),(0,R.zy)(e,"MAX_LOOKAHEAD")&&(s.maxLookahead=e.MAX_LOOKAHEAD),s.hasPredicates=(0,R.zN)(i,function(e){return(0,R.Tn)(e.GATE)}),n.definition.push(s),(0,R.jJ)(i,function(e){var t=new ex({definition:[]});s.definition.push(t),(0,R.zy)(e,"NAME")&&(t.name=e.NAME),(0,R.zy)(e,"IGNORE_AMBIGUITIES")?t.ignoreAmbiguities=e.IGNORE_AMBIGUITIES:(0,R.zy)(e,"GATE")&&(t.ignoreAmbiguities=!0),r.recordingProdStack.push(t),e.ALT.call(r),r.recordingProdStack.pop()}),t1}function t7(e){return 0===e?"":""+e}function t8(e){if(e<0||e>255){var t=Error("Invalid DSL Method idx value: <"+e+">\n	Idx value must be a none negative value smaller than "+256);throw t.KNOWN_RECORDER_ERROR=!0,t}}var re=function(){function e(){}return e.prototype.initPerformanceTracer=function(e){if((0,R.zy)(e,"traceInitPerf")){var t=e.traceInitPerf,r="number"==typeof t;this.traceInitMaxIdent=r?t:1/0,this.traceInitPerf=r?t>0:t}else this.traceInitMaxIdent=0,this.traceInitPerf=rn.traceInitPerf;this.traceInitIndent=-1},e.prototype.TRACE_INIT=function(e,t){if(!0!==this.traceInitPerf)return t();this.traceInitIndent++;var r=Array(this.traceInitIndent+1).join("	");this.traceInitIndent<this.traceInitMaxIdent&&console.log(r+"--\x3e <"+e+">");var n=(0,R.O1)(t),o=n.time,i=n.value,s=o>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&s(r+"<-- <"+e+"> time: "+o+"ms"),this.traceInitIndent--,i},e}(),rt=(f=function(e,t){return(f=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}f(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),rr=eR(ev,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(rr);var rn=Object.freeze({recoveryEnabled:!1,maxLookahead:4,ignoredIssues:{},dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:ty,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),ro=Object.freeze({recoveryValueFunc:function(){},resyncEnabled:!0});function ri(e){return void 0===e&&(e=void 0),function(){return e}}(b=S||(S={}))[b.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",b[b.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",b[b.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",b[b.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",b[b.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",b[b.LEFT_RECURSION=5]="LEFT_RECURSION",b[b.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",b[b.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",b[b.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",b[b.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",b[b.INVALID_NESTED_RULE_NAME=10]="INVALID_NESTED_RULE_NAME",b[b.DUPLICATE_NESTED_NAME=11]="DUPLICATE_NESTED_NAME",b[b.NO_NON_EMPTY_LOOKAHEAD=12]="NO_NON_EMPTY_LOOKAHEAD",b[b.AMBIGUOUS_PREFIX_ALTS=13]="AMBIGUOUS_PREFIX_ALTS",b[b.TOO_MANY_ALTS=14]="TOO_MANY_ALTS";var rs=function(){function e(e,t){void 0===t&&(t=rn),this.ignoredIssues=rn.ignoredIssues,this.definitionErrors=[],this.selfAnalysisDone=!1,this.initErrorHandler(t),this.initLexerAdapter(),this.initLooksAhead(t),this.initRecognizerEngine(e,t),this.initRecoverable(t),this.initTreeBuilder(t),this.initContentAssist(),this.initGastRecorder(t),this.initPerformanceTracer(t),(0,R.zy)(t,"ignoredIssues")&&t.ignoredIssues!==rn.ignoredIssues&&(0,R.x5)("The <ignoredIssues> IParserConfig property is soft-deprecated and will be removed in future versions.\n	Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead."),this.ignoredIssues=(0,R.zy)(t,"ignoredIssues")?t.ignoredIssues:rn.ignoredIssues,this.skipValidations=(0,R.zy)(t,"skipValidations")?t.skipValidations:rn.skipValidations}return e.performSelfAnalysis=function(e){e.performSelfAnalysis()},e.prototype.performSelfAnalysis=function(){var t=this;this.TRACE_INIT("performSelfAnalysis",function(){t.selfAnalysisDone=!0;var r=t.className;t.TRACE_INIT("toFastProps",function(){(0,R.Bl)(t)}),t.TRACE_INIT("Grammar Recording",function(){try{t.enableRecording(),(0,R.jJ)(t.definedRulesNames,function(e){var r=t[e].originalGrammarAction,n=void 0;t.TRACE_INIT(e+" Rule",function(){n=t.topLevelRuleRecord(e,r)}),t.gastProductionsCache[e]=n})}finally{t.disableRecording()}});var n=[];if(t.TRACE_INIT("Grammar Resolving",function(){n=tE({rules:(0,R.zu)(t.gastProductionsCache)}),t.definitionErrors.push.apply(t.definitionErrors,n)}),t.TRACE_INIT("Grammar Validations",function(){if((0,R.Im)(n)&&!1===t.skipValidations){var e=tT({rules:(0,R.zu)(t.gastProductionsCache),maxLookahead:t.maxLookahead,tokenTypes:(0,R.zu)(t.tokensMap),ignoredIssues:t.ignoredIssues,errMsgProvider:tS,grammarName:r});t.definitionErrors.push.apply(t.definitionErrors,e)}}),(0,R.Im)(t.definitionErrors)&&(t.recoveryEnabled&&t.TRACE_INIT("computeAllProdsFollows",function(){var e,r,n=(e=(0,R.zu)(t.gastProductionsCache),r={},(0,R.jJ)(e,function(e){var t=new eX(e).startWalking();(0,R.kp)(r,t)}),r);t.resyncFollows=n}),t.TRACE_INIT("ComputeLookaheadFunctions",function(){t.preComputeLookaheadFunctions((0,R.zu)(t.gastProductionsCache))})),t.TRACE_INIT("expandAllNestedRuleNames",function(){var e,r,n,o=(e=(0,R.zu)(t.gastProductionsCache),r=t.fullRuleNameToShort,n={allRuleNames:[]},(0,R.jJ)(e,function(e){var t=r[e.name];n.allRuleNames.push(e.name);var o=new e1(t);e.accept(o),(0,R.jJ)(o.result,function(t){t.def,t.key;var r=t.name;n.allRuleNames.push(e.name+r)})}),n);t.allRuleNames=o.allRuleNames}),!e.DEFER_DEFINITION_ERRORS_HANDLING&&!(0,R.Im)(t.definitionErrors))throw Error("Parser Definition Errors detected:\n "+(0,R.Tj)(t.definitionErrors,function(e){return e.message}).join("\n-------------------------------\n"))})},e.DEFER_DEFINITION_ERRORS_HANDLING=!1,e}();(0,R.XJ)(rs,[tV,tz,tK,tX,tZ,tQ,tJ,t0,t5,re]);var ra=function(e){function t(t,r){void 0===r&&(r=rn);var n=(0,R.lR)(r);return n.outputCst=!0,e.call(this,t,n)||this}return rt(t,e),t}(rs),rl=function(e){function t(t,r){void 0===r&&(r=rn);var n=(0,R.lR)(r);return n.outputCst=!1,e.call(this,t,n)||this}return rt(t,e),t}(rs);function rh(e,t){var r=void 0===t?{}:t,n=r.resourceBase,o=void 0===n?"https://unpkg.com/chevrotain@"+v+"/diagrams/":n,i=r.css;return"\n\x3c!-- This is a generated file --\x3e\n<!DOCTYPE html>\n<meta charset=\"utf-8\">\n<style>\n  body {\n    background-color: hsl(30, 20%, 95%)\n  }\n</style>\n\n\n<link rel='stylesheet' href='"+(void 0===i?"https://unpkg.com/chevrotain@"+v+"/diagrams/diagrams.css":i)+"'>\n"+("\n<script src='"+o+"vendor/railroad-diagrams.js'><\/script>\n<script src='"+o+"src/diagrams_builder.js'><\/script>\n<script src='"+o+"src/diagrams_behavior.js'><\/script>\n<script src='"+o+"src/main.js'><\/script>\n")+'\n<div id="diagrams" align="center"></div>    \n'+("\n<script>\n    window.serializedGrammar = "+JSON.stringify(e,null,"  ")+";\n<\/script>\n")+'\n<script>\n    var diagramsDiv = document.getElementById("diagrams");\n    main.drawDiagramsFromSerializedGrammar(serializedGrammar, diagramsDiv);\n<\/script>\n'}function rd(e){var t;return"\nfunction "+e.name+"(tokenVocabulary, config) {\n    // invoke super constructor\n    // No support for embedded actions currently, so we can 'hardcode'\n    // The use of CstParser.\n    chevrotain.CstParser.call(this, tokenVocabulary, config)\n\n    const $ = this\n\n    "+(t=e.rules,(0,R.Tj)(t,function(e){var t;return rp(1,'$.RULE("'+(t=e).name+'", function() {')+"\n"+rg(t.definition,2)+(rp(2,"})")+"\n")}).join("\n"))+"\n\n    // very important to call this after all the rules have been defined.\n    // otherwise the parser may not work correctly as it will lack information\n    // derived during the self analysis phase.\n    this.performSelfAnalysis(this)\n}\n\n// inheritance as implemented in javascript in the previous decade... :(\n"+e.name+".prototype = Object.create(chevrotain.CstParser.prototype)\n"+e.name+".prototype.constructor = "+e.name+"    \n    "}function ru(e,t,r){var n=rp(r,"$."+(e+t.idx)+"(");return t.name||t.separator?(n+="{\n",t.name&&(n+=rp(r+1,'NAME: "'+t.name+'"')+",\n"),t.separator&&(n+=rp(r+1,"SEP: this.tokensMap."+t.separator.name)+",\n"),n+="DEF: "+rc(t.definition,r+2)+"\n",n+=rp(r,"}")+"\n"):n+=rc(t.definition,r+1),n+=rp(r,")")+"\n"}function rc(e,t){var r="function() {\n";return r+=rg(e,t),r+=rp(t,"}")+"\n"}function rg(e,t){var r="";return(0,R.jJ)(e,function(e){r+=function(e,t){var r;if(e instanceof eM)return rp(t,"$.SUBRULE"+e.idx+"($."+e.nonTerminalName+")\n");if(e instanceof eN)return ru("OPTION",e,t);if(e instanceof eO)return ru("AT_LEAST_ONE",e,t);if(e instanceof ek)return ru("AT_LEAST_ONE_SEP",e,t);if(e instanceof e_)return ru("MANY_SEP",e,t);else if(e instanceof eH)return ru("MANY",e,t);else if(e instanceof eL)return rp(t,"$.OR"+e.idx+"([")+"\n"+(0,R.Tj)(e.definition,function(e){var r,n,o;return r=e,o=rp(n=t+1,"{")+"\n",r.name&&(o+=rp(n+1,'NAME: "'+r.name+'",')+"\n"),o+=rp(n+1,"ALT: function() {")+"\n",o+=rg(r.definition,n+1),o+=rp(n+1,"}")+"\n",o+=rp(n,"}")}).join(",\n")+"\n"+rp(t,"])\n");else if(e instanceof eP)return r=e.terminalType.name,rp(t,"$.CONSUME"+e.idx+"(this.tokensMap."+r+")\n");else if(e instanceof ex)return rg(e.definition,t);else throw Error("non exhaustive match")}(e,t+1)}),r}function rp(e,t){return Array(4*e+1).join(" ")+t}function rm(e){var t,n=Function("tokenVocabulary","config","chevrotain","    \n"+rd(t={name:e.name,rules:e.rules})+"\nreturn new "+t.name+"(tokenVocabulary, config)    \n");return function(t){return n(e.tokenVocabulary,t,r(603))}}function rf(e){var t;return"\n(function (root, factory) {\n    if (typeof define === 'function' && define.amd) {\n        // AMD. Register as an anonymous module.\n        define(['chevrotain'], factory);\n    } else if (typeof module === 'object' && module.exports) {\n        // Node. Does not work with strict CommonJS, but\n        // only CommonJS-like environments that support module.exports,\n        // like Node.\n        module.exports = factory(require('chevrotain'));\n    } else {\n        // Browser globals (root is window)\n        root.returnExports = factory(root.b);\n    }\n}(typeof self !== 'undefined' ? self : this, function (chevrotain) {\n\n"+rd(t={name:e.name,rules:e.rules})+"\n    \nreturn {\n    "+t.name+": "+t.name+" \n}\n}));\n"}function rb(){console.warn("The clearCache function was 'soft' removed from the Chevrotain API.\n	 It performs no action other than printing this message.\n	 Please avoid using it as it will be completely removed in the future")}},642(e,t,r){"use strict";function n(e){return e&&0===e.length}function o(e){return null==e?[]:Object.keys(e)}function i(e){for(var t=[],r=Object.keys(e),n=0;n<r.length;n++)t.push(e[r[n]]);return t}function s(e,t){for(var r=[],n=o(e),i=0;i<n.length;i++){var s=n[i];r.push(t.call(null,e[s],s))}return r}function a(e,t){for(var r=[],n=0;n<e.length;n++)r.push(t.call(null,e[n],n));return r}function l(e){return n(e)?void 0:e[0]}function h(e){var t=e&&e.length;return t?e[t-1]:void 0}function d(e,t){if(Array.isArray(e))for(var r=0;r<e.length;r++)t.call(null,e[r],r);else if(N(e))for(var n=o(e),r=0;r<n.length;r++){var i=n[r],s=e[i];t.call(null,s,i)}else throw Error("non exhaustive match")}function u(e){return"string"==typeof e}function c(e){return void 0===e}function g(e){return e instanceof Function}function p(e,t){return void 0===t&&(t=1),e.slice(t,e.length)}function m(e,t){return void 0===t&&(t=1),e.slice(0,e.length-t)}function f(e,t){var r=[];if(Array.isArray(e))for(var n=0;n<e.length;n++){var o=e[n];t.call(null,o)&&r.push(o)}return r}function b(e,t){return f(e,function(e){return!t(e)})}function C(e,t){for(var r=Object.keys(e),n={},o=0;o<r.length;o++){var i=r[o],s=e[i];t(s)&&(n[i]=s)}return n}function y(e,t){return!!N(e)&&e.hasOwnProperty(t)}function w(e,t){return void 0!==R(e,function(e){return e===t})}function S(e){for(var t=[],r=0;r<e.length;r++)t.push(e[r]);return t}function v(e){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}function R(e,t){for(var r=0;r<e.length;r++){var n=e[r];if(t.call(null,n))return n}}function E(e,t){for(var r=[],n=0;n<e.length;n++){var o=e[n];t.call(null,o)&&r.push(o)}return r}function T(e,t,r){for(var n=Array.isArray(e),s=n?e:i(e),a=n?[]:o(e),l=r,h=0;h<s.length;h++)l=t.call(null,l,s[h],n?h:a[h]);return l}function A(e){return b(e,function(e){return null==e})}function M(e,t){void 0===t&&(t=function(e){return e});var r=[];return T(e,function(e,n){var o=t(n);return w(r,o)?e:(r.push(o),e.concat(n))},[])}function I(e){return Array.isArray(e)}function x(e){return e instanceof RegExp}function N(e){return e instanceof Object}function O(e,t){for(var r=0;r<e.length;r++)if(!t(e[r],r))return!1;return!0}function k(e,t){return b(e,function(e){return w(t,e)})}function H(e,t){for(var r=0;r<e.length;r++)if(t(e[r]))return!0;return!1}function _(e,t){for(var r=0;r<e.length;r++)if(e[r]===t)return r;return -1}function L(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];for(var n=0;n<t.length;n++)for(var i=t[n],s=o(i),a=0;a<s.length;a++){var l=s[a];e[l]=i[l]}return e}function P(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];for(var n=0;n<t.length;n++){var i=t[n];if(!c(i))for(var s=o(i),a=0;a<s.length;a++){var l=s[a];y(e,l)||(e[l]=i[l])}}return e}function D(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return P.apply(null,[{}].concat(e))}function F(e,t){var r={};return d(e,function(e){var n=t(e),o=r[n];o?o.push(e):r[n]=[e]}),r}function B(e,t){for(var r=v(e),n=o(t),i=0;i<n.length;i++){var s=n[i],a=t[s];r[s]=a}return r}function V(){}function U(e){return e}function z(e){for(var t=[],r=0;r<e.length;r++){var n=e[r];t.push(void 0!==n?n:void 0)}return t}function W(e){console&&console.error&&console.error("Error: "+e)}function G(e){console&&console.warn&&console.warn("Warning: "+e)}function $(){return"function"==typeof Map}function Y(e,t){t.forEach(function(t){var r=t.prototype;Object.getOwnPropertyNames(r).forEach(function(n){if("constructor"!==n){var o=Object.getOwnPropertyDescriptor(r,n);o&&(o.get||o.set)?Object.defineProperty(e.prototype,n,o):e.prototype[n]=t.prototype[n]}})})}function j(e){function t(){}t.prototype=e;var r=new t;function n(){return typeof r.bar}return n(),n(),e}function q(e){return e[e.length-1]}function K(e){var t=new Date().getTime(),r=e();return{time:new Date().getTime()-t,value:r}}r.d(t,{$1:()=>l,$z:()=>F,Bl:()=>j,Bq:()=>function e(t){for(var r=[],n=0;n<t.length;n++){var o=t[n];Array.isArray(o)?r=r.concat(e(o)):r.push(o)}return r},Gv:()=>N,HP:()=>o,HV:()=>h,I6:()=>R,Im:()=>n,JW:()=>E,Kg:()=>u,LG:()=>s,NT:()=>D,O1:()=>K,Si:()=>O,T9:()=>S,TS:()=>T,Tj:()=>a,Tn:()=>g,Up:()=>C,VS:()=>z,XJ:()=>Y,Zi:()=>W,b0:()=>c,cy:()=>I,gR:()=>w,gc:()=>m,gd:()=>x,gv:()=>p,h1:()=>B,iv:()=>k,jJ:()=>d,kp:()=>L,ku:()=>b,lR:()=>v,oE:()=>A,pb:()=>f,qh:()=>_,rF:()=>$,sb:()=>M,se:()=>q,tE:()=>V,x5:()=>G,zK:()=>U,zN:()=>H,zu:()=>i,zy:()=>y})},713(e,t){var r,n;"u">typeof self&&self,void 0===(n="function"==typeof(r=function(){function e(){}e.prototype.saveState=function(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}},e.prototype.restoreState=function(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx},e.prototype.pattern=function(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar("/");var t=this.disjunction();this.consumeChar("/");for(var r={type:"Flags",global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};this.isRegExpFlag();)switch(this.popChar()){case"g":a(r,"global");break;case"i":a(r,"ignoreCase");break;case"m":a(r,"multiLine");break;case"u":a(r,"unicode");break;case"y":a(r,"sticky")}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:r,value:t}},e.prototype.disjunction=function(){var e=[];for(e.push(this.alternative());"|"===this.peekChar();)this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e}},e.prototype.alternative=function(){for(var e=[];this.isTerm();)e.push(this.term());return{type:"Alternative",value:e}},e.prototype.term=function(){return this.isAssertion()?this.assertion():this.atom()},e.prototype.assertion=function(){switch(this.popChar()){case"^":return{type:"StartAnchor"};case"$":return{type:"EndAnchor"};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary"};case"B":return{type:"NonWordBoundary"}}throw Error("Invalid Assertion Escape");case"(":switch(this.consumeChar("?"),this.popChar()){case"=":e="Lookahead";break;case"!":e="NegativeLookahead"}l(e);var e,t=this.disjunction();return this.consumeChar(")"),{type:e,value:t}}throw Error("Internal Error - Should never get here!")},e.prototype.quantifier=function(e){var t;switch(this.popChar()){case"*":t={atLeast:0,atMost:1/0};break;case"+":t={atLeast:1,atMost:1/0};break;case"?":t={atLeast:0,atMost:1};break;case"{":var r=this.integerIncludingZero();switch(this.popChar()){case"}":t={atLeast:r,atMost:r};break;case",":t=this.isDigit()?{atLeast:r,atMost:this.integerIncludingZero()}:{atLeast:r,atMost:1/0},this.consumeChar("}")}if(!0===e&&void 0===t)return;l(t)}if(!0!==e||void 0!==t)return l(t),"?"===this.peekChar(0)?(this.consumeChar("?"),t.greedy=!1):t.greedy=!0,t.type="Quantifier",t},e.prototype.atom=function(){var e;switch(this.peekChar()){case".":e=this.dotAll();break;case"\\":e=this.atomEscape();break;case"[":e=this.characterClass();break;case"(":e=this.group()}return void 0===e&&this.isPatternCharacter()&&(e=this.patternCharacter()),l(e),this.isQuantifier()&&(e.quantifier=this.quantifier()),e},e.prototype.dotAll=function(){return this.consumeChar("."),{type:"Set",complement:!0,value:[i("\n"),i("\r"),i("\u2028"),i("\u2029")]}},e.prototype.atomEscape=function(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}},e.prototype.decimalEscapeAtom=function(){return{type:"GroupBackReference",value:this.positiveInteger()}},e.prototype.characterClassEscape=function(){var e,t=!1;switch(this.popChar()){case"d":e=h;break;case"D":e=h,t=!0;break;case"s":e=u;break;case"S":e=u,t=!0;break;case"w":e=d;break;case"W":e=d,t=!0}return l(e),{type:"Set",value:e,complement:t}},e.prototype.controlEscapeAtom=function(){var e;switch(this.popChar()){case"f":e=i("\f");break;case"n":e=i("\n");break;case"r":e=i("\r");break;case"t":e=i("	");break;case"v":e=i("\v")}return l(e),{type:"Character",value:e}},e.prototype.controlLetterEscapeAtom=function(){this.consumeChar("c");var e=this.popChar();if(!1===/[a-zA-Z]/.test(e))throw Error("Invalid ");return{type:"Character",value:e.toUpperCase().charCodeAt(0)-64}},e.prototype.nulCharacterAtom=function(){return this.consumeChar("0"),{type:"Character",value:i("\0")}},e.prototype.hexEscapeSequenceAtom=function(){return this.consumeChar("x"),this.parseHexDigits(2)},e.prototype.regExpUnicodeEscapeSequenceAtom=function(){return this.consumeChar("u"),this.parseHexDigits(4)},e.prototype.identityEscapeAtom=function(){return{type:"Character",value:i(this.popChar())}},e.prototype.classPatternCharacterAtom=function(){switch(this.peekChar()){case"\n":case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:return{type:"Character",value:i(this.popChar())}}},e.prototype.characterClass=function(){var e=[],t=!1;for(this.consumeChar("["),"^"===this.peekChar(0)&&(this.consumeChar("^"),t=!0);this.isClassAtom();){var r=this.classAtom();if("Character"===r.type&&this.isRangeDash()){this.consumeChar("-");var n=this.classAtom();if("Character"===n.type){if(n.value<r.value)throw Error("Range out of order in character class");e.push({from:r.value,to:n.value})}else s(r.value,e),e.push(i("-")),s(n.value,e)}else s(r.value,e)}return this.consumeChar("]"),{type:"Set",complement:t,value:e}},e.prototype.classAtom=function(){switch(this.peekChar()){case"]":case"\n":case"\r":case"\u2028":case"\u2029":throw Error("TBD");case"\\":return this.classEscape();default:return this.classPatternCharacterAtom()}},e.prototype.classEscape=function(){switch(this.consumeChar("\\"),this.peekChar()){case"b":return this.consumeChar("b"),{type:"Character",value:i("\b")};case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}},e.prototype.group=function(){var e=!0;this.consumeChar("("),"?"===this.peekChar(0)?(this.consumeChar("?"),this.consumeChar(":"),e=!1):this.groupIdx++;var t=this.disjunction();this.consumeChar(")");var r={type:"Group",capturing:e,value:t};return e&&(r.idx=this.groupIdx),r},e.prototype.positiveInteger=function(){var e=this.popChar();if(!1===o.test(e))throw Error("Expecting a positive integer");for(;n.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)},e.prototype.integerIncludingZero=function(){var e=this.popChar();if(!1===n.test(e))throw Error("Expecting an integer");for(;n.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)},e.prototype.patternCharacter=function(){var e=this.popChar();switch(e){case"\n":case"\r":case"\u2028":case"\u2029":case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":throw Error("TBD");default:return{type:"Character",value:i(e)}}},e.prototype.isRegExpFlag=function(){switch(this.peekChar(0)){case"g":case"i":case"m":case"u":case"y":return!0;default:return!1}},e.prototype.isRangeDash=function(){return"-"===this.peekChar()&&this.isClassAtom(1)},e.prototype.isDigit=function(){return n.test(this.peekChar(0))},e.prototype.isClassAtom=function(e){switch(void 0===e&&(e=0),this.peekChar(e)){case"]":case"\n":case"\r":case"\u2028":case"\u2029":return!1;default:return!0}},e.prototype.isTerm=function(){return this.isAtom()||this.isAssertion()},e.prototype.isAtom=function(){if(this.isPatternCharacter())return!0;switch(this.peekChar(0)){case".":case"\\":case"[":case"(":return!0;default:return!1}},e.prototype.isAssertion=function(){switch(this.peekChar(0)){case"^":case"$":return!0;case"\\":switch(this.peekChar(1)){case"b":case"B":return!0;default:return!1}case"(":return"?"===this.peekChar(1)&&("="===this.peekChar(2)||"!"===this.peekChar(2));default:return!1}},e.prototype.isQuantifier=function(){var e=this.saveState();try{return void 0!==this.quantifier(!0)}catch(e){return!1}finally{this.restoreState(e)}},e.prototype.isPatternCharacter=function(){switch(this.peekChar()){case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":case"/":case"\n":case"\r":case"\u2028":case"\u2029":return!1;default:return!0}},e.prototype.parseHexDigits=function(e){for(var t="",n=0;n<e;n++){var o=this.popChar();if(!1===r.test(o))throw Error("Expecting a HexDecimal digits");t+=o}return{type:"Character",value:parseInt(t,16)}},e.prototype.peekChar=function(e){return void 0===e&&(e=0),this.input[this.idx+e]},e.prototype.popChar=function(){var e=this.peekChar(0);return this.consumeChar(),e},e.prototype.consumeChar=function(e){if(void 0!==e&&this.input[this.idx]!==e)throw Error("Expected: '"+e+"' but found: '"+this.input[this.idx]+"' at offset: "+this.idx);if(this.idx>=this.input.length)throw Error("Unexpected end of input");this.idx++};var t,r=/[0-9a-fA-F]/,n=/[0-9]/,o=/[1-9]/;function i(e){return e.charCodeAt(0)}function s(e,t){void 0!==e.length?e.forEach(function(e){t.push(e)}):t.push(e)}function a(e,t){if(!0===e[t])throw"duplicate flag "+t;e[t]=!0}function l(e){if(void 0===e)throw Error("Internal Error - Should never get here!")}var h=[];for(t=i("0");t<=i("9");t++)h.push(t);var d=[i("_")].concat(h);for(t=i("a");t<=i("z");t++)d.push(t);for(t=i("A");t<=i("Z");t++)d.push(t);var u=[i(" "),i("\f"),i("\n"),i("\r"),i("	"),i("\v"),i("	"),i("\xa0"),i(" "),i(" "),i(" "),i(" "),i(" "),i(" "),i(" "),i(" "),i(" "),i(" "),i(" "),i(" "),i("\u2028"),i("\u2029"),i(" "),i(" "),i("　"),i("\uFEFF")];function c(){}return c.prototype.visitChildren=function(e){for(var t in e){var r=e[t];e.hasOwnProperty(t)&&(void 0!==r.type?this.visit(r):Array.isArray(r)&&r.forEach(function(e){this.visit(e)},this))}},c.prototype.visit=function(e){switch(e.type){case"Pattern":this.visitPattern(e);break;case"Flags":this.visitFlags(e);break;case"Disjunction":this.visitDisjunction(e);break;case"Alternative":this.visitAlternative(e);break;case"StartAnchor":this.visitStartAnchor(e);break;case"EndAnchor":this.visitEndAnchor(e);break;case"WordBoundary":this.visitWordBoundary(e);break;case"NonWordBoundary":this.visitNonWordBoundary(e);break;case"Lookahead":this.visitLookahead(e);break;case"NegativeLookahead":this.visitNegativeLookahead(e);break;case"Character":this.visitCharacter(e);break;case"Set":this.visitSet(e);break;case"Group":this.visitGroup(e);break;case"GroupBackReference":this.visitGroupBackReference(e);break;case"Quantifier":this.visitQuantifier(e)}this.visitChildren(e)},c.prototype.visitPattern=function(e){},c.prototype.visitFlags=function(e){},c.prototype.visitDisjunction=function(e){},c.prototype.visitAlternative=function(e){},c.prototype.visitStartAnchor=function(e){},c.prototype.visitEndAnchor=function(e){},c.prototype.visitWordBoundary=function(e){},c.prototype.visitNonWordBoundary=function(e){},c.prototype.visitLookahead=function(e){},c.prototype.visitNegativeLookahead=function(e){},c.prototype.visitCharacter=function(e){},c.prototype.visitSet=function(e){},c.prototype.visitGroup=function(e){},c.prototype.visitGroupBackReference=function(e){},c.prototype.visitQuantifier=function(e){},{RegExpParser:e,BaseRegExpVisitor:c,VERSION:"0.4.0"}})?r.apply(t,[]):r)||(e.exports=n)},732(e){function t(){}t.prototype={on:function(e,t,r){var n=this.e||(this.e={});return(n[e]||(n[e]=[])).push({fn:t,ctx:r}),this},once:function(e,t,r){var n=this;function o(){n.off(e,o),t.apply(r,arguments)}return o._=t,this.on(e,o,r)},emit:function(e){for(var t=[].slice.call(arguments,1),r=((this.e||(this.e={}))[e]||[]).slice(),n=0,o=r.length;n<o;n++)r[n].fn.apply(r[n].ctx,t);return this},off:function(e,t){var r=this.e||(this.e={}),n=r[e],o=[];if(n&&t)for(var i=0,s=n.length;i<s;i++)n[i].fn!==t&&n[i].fn._!==t&&o.push(n[i]);return o.length?r[e]=o:delete r[e],this}},e.exports=t,e.exports.TinyEmitter=t}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,r),i.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.d({},{iz:()=>tK,f1:()=>ig});var e,t,n,o,i,s,a,l,h,d,u,c,g,p,m,f,b,C,y,w,S,v,R,E,T,A,M,I,x,N,O,k,H,_,L,P,D,F,B,V,U,z,W,G,$,Y,j,q,K,X,Q,Z,J,ee,et,er,en,eo={};r.r(eo),r.d(eo,{AbsPlugin:()=>iS,AddressPlugin:()=>iy,ArrayPlugin:()=>iw,BitShiftPlugin:()=>iv,BitwiseLogicOperationsPlugin:()=>iA,BooleanPlugin:()=>iM,CharPlugin:()=>iI,CodePlugin:()=>ix,ComplexPlugin:()=>aR,ConditionalAggregationPlugin:()=>sM,CountBlankPlugin:()=>iN,CountUniquePlugin:()=>iO,DatabasePlugin:()=>iH,DateTimePlugin:()=>i_,DegreesPlugin:()=>iB,DeltaPlugin:()=>iV,ExpPlugin:()=>iU,FinancialPlugin:()=>iz,FormulaTextPlugin:()=>iq,HyperlinkPlugin:()=>iK,InformationPlugin:()=>iX,IsEvenPlugin:()=>iQ,IsOddPlugin:()=>iZ,LogarithmPlugin:()=>iJ,LookupPlugin:()=>sk,MathConstantsPlugin:()=>i1,MathPlugin:()=>aw,MatrixPlugin:()=>i6,MedianPlugin:()=>i5,ModuloPlugin:()=>i4,NumericAggregationPlugin:()=>sr,PercentilePlugin:()=>i8,PowerPlugin:()=>si,RadiansPlugin:()=>ss,RadixConversionPlugin:()=>sa,RandomPlugin:()=>sp,RomanPlugin:()=>sH,RoundingPlugin:()=>sC,SequencePlugin:()=>sm,SimpleArithmerticPlugin:()=>sP,SqrtPlugin:()=>sy,StatisticalAggregationPlugin:()=>a_,StatisticalPlugin:()=>ay,SumprodPlugin:()=>sI,TextPlugin:()=>sx,TrigonometryPlugin:()=>sN}),(R=e||(e={})).RELATIVE="RELATIVE",R.ABSOLUTE="ABSOLUTE";class ei{constructor(e,t,r){this.type=e,this.col=t,this.sheet=r}static absolute(t,r){return new ei(e.ABSOLUTE,t,r)}static relative(t,r){return new ei(e.RELATIVE,t,r)}static compareByAbsoluteAddress(e){return(t,r)=>t.toSimpleColumnAddress(e).col-r.toSimpleColumnAddress(e).col}isColumnAbsolute(){return this.type===e.ABSOLUTE}isColumnRelative(){return this.type===e.RELATIVE}isAbsolute(){return this.type===e.ABSOLUTE&&void 0!==this.sheet}moved(e,t,r){let n=void 0===this.sheet?void 0:e;return new ei(this.type,this.col+t,n)}shiftedByColumns(e){return new ei(this.type,this.col+e,this.sheet)}toSimpleColumnAddress(e){let t=r5(this,e),r=this.col;return this.isColumnRelative()&&(r=e.col+this.col),rZ(t,r)}shiftRelativeDimensions(e,t){let r=this.isColumnRelative()?this.col+e:this.col;return new ei(this.type,r,this.sheet)}shiftAbsoluteDimensions(e,t){let r=this.isColumnAbsolute()?this.col+e:this.col;return new ei(this.type,r,this.sheet)}withSheet(e){return new ei(this.type,this.col,e)}isInvalid(e){return this.toSimpleColumnAddress(e).col<0}hash(t){let r=t&&void 0!==this.sheet?`#${this.sheet}`:"";switch(this.type){case e.RELATIVE:return`${r}#COLR${this.col}`;case e.ABSOLUTE:return`${r}#COLA${this.col}`}}unparse(t){let r=this.toSimpleColumnAddress(t);if(rJ(r))return;let n=eN(r.col),o=this.type===e.ABSOLUTE?"$":"";return`${o}${n}`}exceedsSheetSizeLimits(e){return this.col>=e}}class es{constructor(e,t,r){this.type=e,this.row=t,this.sheet=r}static absolute(t,r){return new es(e.ABSOLUTE,t,r)}static relative(t,r){return new es(e.RELATIVE,t,r)}static compareByAbsoluteAddress(e){return(t,r)=>t.toSimpleRowAddress(e).row-r.toSimpleRowAddress(e).row}isRowAbsolute(){return this.type===e.ABSOLUTE}isRowRelative(){return this.type===e.RELATIVE}isAbsolute(){return this.type===e.ABSOLUTE&&void 0!==this.sheet}moved(e,t,r){let n=void 0===this.sheet?void 0:e;return new es(this.type,this.row+r,n)}shiftedByRows(e){return new es(this.type,this.row+e,this.sheet)}toSimpleRowAddress(e){let t=r5(this,e),r=this.row;return this.isRowRelative()&&(r=e.row+this.row),rX(t,r)}shiftRelativeDimensions(e,t){let r=this.isRowRelative()?this.row+t:this.row;return new es(this.type,r,this.sheet)}shiftAbsoluteDimensions(e,t){let r=this.isRowAbsolute()?this.row+t:this.row;return new es(this.type,r,this.sheet)}withSheet(e){return new es(this.type,this.row,e)}isInvalid(e){return this.toSimpleRowAddress(e).row<0}hash(t){let r=t&&void 0!==this.sheet?`#${this.sheet}`:"";switch(this.type){case e.RELATIVE:return`${r}#ROWR${this.row}`;case e.ABSOLUTE:return`${r}#ROWA${this.row}`}}unparse(t){let r=this.toSimpleRowAddress(t);if(rQ(r))return;let n=this.type===e.ABSOLUTE?"$":"";return`${n}${r.row+1}`}exceedsSheetSizeLimits(e){return this.row>=e}}(E=t||(t={})).CELL_REFERENCE_RELATIVE="CELL_REFERENCE",E.CELL_REFERENCE_ABSOLUTE="CELL_REFERENCE_ABSOLUTE",E.CELL_REFERENCE_ABSOLUTE_COL="CELL_REFERENCE_ABSOLUTE_COL",E.CELL_REFERENCE_ABSOLUTE_ROW="CELL_REFERENCE_ABSOLUTE_ROW";class ea{constructor(e,t,r,n){this.col=e,this.row=t,this.type=r,this.sheet=n}static fromColAndRow(e,t,r){return(e.isColumnAbsolute()&&t.isRowAbsolute()?ea.absolute.bind(this):e.isColumnAbsolute()?ea.absoluteCol.bind(this):t.isRowAbsolute()?ea.absoluteRow.bind(this):ea.relative.bind(this))(e.col,t.row,r)}static relative(e,r,n){return new ea(e,r,t.CELL_REFERENCE_RELATIVE,n)}static absolute(e,r,n){return new ea(e,r,t.CELL_REFERENCE_ABSOLUTE,n)}static absoluteCol(e,r,n){return new ea(e,r,t.CELL_REFERENCE_ABSOLUTE_COL,n)}static absoluteRow(e,r,n){return new ea(e,r,t.CELL_REFERENCE_ABSOLUTE_ROW,n)}toSimpleCellAddress(e){let r=r5(this,e);return this.type===t.CELL_REFERENCE_ABSOLUTE?r0(r,this.col,this.row):this.type===t.CELL_REFERENCE_ABSOLUTE_ROW?r0(r,e.col+this.col,this.row):this.type===t.CELL_REFERENCE_ABSOLUTE_COL?r0(r,this.col,e.row+this.row):r0(r,e.col+this.col,e.row+this.row)}toColumnAddress(){return new ei(this.isColumnRelative()?e.RELATIVE:e.ABSOLUTE,this.col,this.sheet)}toRowAddress(){return new es(this.isRowRelative()?e.RELATIVE:e.ABSOLUTE,this.row,this.sheet)}toSimpleColumnAddress(e){let t=r5(this,e),r=this.col;return this.isColumnRelative()&&(r+=e.col),rZ(t,r)}toSimpleRowAddress(e){let t=r5(this,e),r=this.row;return this.isRowRelative()&&(r+=e.row),rX(t,r)}isRowAbsolute(){return this.type===t.CELL_REFERENCE_ABSOLUTE||this.type===t.CELL_REFERENCE_ABSOLUTE_ROW}isColumnAbsolute(){return this.type===t.CELL_REFERENCE_ABSOLUTE||this.type===t.CELL_REFERENCE_ABSOLUTE_COL}isColumnRelative(){return this.type===t.CELL_REFERENCE_RELATIVE||this.type===t.CELL_REFERENCE_ABSOLUTE_ROW}isRowRelative(){return this.type===t.CELL_REFERENCE_RELATIVE||this.type===t.CELL_REFERENCE_ABSOLUTE_COL}isAbsolute(){return this.type===t.CELL_REFERENCE_ABSOLUTE&&void 0!==this.sheet}shiftedByRows(e){return new ea(this.col,this.row+e,this.type,this.sheet)}shiftedByColumns(e){return new ea(this.col+e,this.row,this.type,this.sheet)}moved(e,t,r){let n=void 0===this.sheet?void 0:e;return new ea(this.col+t,this.row+r,this.type,n)}withSheet(e){return new ea(this.col,this.row,this.type,e)}isInvalid(e){return r1(this.toSimpleCellAddress(e))}shiftRelativeDimensions(e,t){return new ea(this.isColumnAbsolute()?this.col:this.col+e,this.isRowAbsolute()?this.row:this.row+t,this.type,this.sheet)}shiftAbsoluteDimensions(e,t){return new ea(this.isColumnRelative()?this.col:this.col+e,this.isRowRelative()?this.row:this.row+t,this.type,this.sheet)}hash(e){let r=e&&void 0!==this.sheet?`#${this.sheet}`:"";switch(this.type){case t.CELL_REFERENCE_RELATIVE:return`${r}#${this.row}R${this.col}`;case t.CELL_REFERENCE_ABSOLUTE:return`${r}#${this.row}A${this.col}`;case t.CELL_REFERENCE_ABSOLUTE_COL:return`${r}#${this.row}AC${this.col}`;case t.CELL_REFERENCE_ABSOLUTE_ROW:return`${r}#${this.row}AR${this.col}`}}unparse(e){let r=this.toSimpleCellAddress(e);if(r1(r))return;let n=eN(r.col),o=this.type===t.CELL_REFERENCE_ABSOLUTE||this.type===t.CELL_REFERENCE_ABSOLUTE_ROW?"$":"",i=this.type===t.CELL_REFERENCE_ABSOLUTE||this.type===t.CELL_REFERENCE_ABSOLUTE_COL?"$":"";return`${i}${n}${o}${r.row+1}`}exceedsSheetSizeLimits(e,t){return this.row>=t||this.col>=e}}let el="A-Za-z\xc0-ʯ",eh=`${el}0-9_.`,ed=`[${el}0-9_]+`,eu=`(${ed}|'(((?!').|'')*)')!`,ec=`(${eu})?\\$?[A-Za-z]+\\$?[0-9]+`,eg=`(${eu})?\\$?[A-Za-z]+`,ep=`(${eu})?\\$?[0-9]+`,em="[rR][0-9]*[cC][0-9]*",ef=`(${ec})[^${eh}]`,eb=`[${el}_][${eh}]*`,eC=["0","1","2","3","4","5","6","7","8","9"],ey=[...Array.from(Array(26)).map((e,t)=>t+65),...Array.from(Array(26)).map((e,t)=>t+97),...Array.from(Array(496)).map((e,t)=>t+192)].map(e=>String.fromCharCode(e)),ew=RegExp(`^(${eu})?(\\$?)([A-Za-z]+)(\\$?)([0-9]+)$`),eS=RegExp(`^(${eu})?(\\$?)([A-Za-z]+)$`),ev=RegExp(`^(${eu})?(\\$?)([0-9]+)$`),eR=RegExp(`^${ed}$`),eE=(e,t,r)=>{let n=ew.exec(e);if(!n)return;let o=ex(n[6]),i=Number(n[8])-1,s=eH(ek(n),r);if(null!==s)if("$"===n[5]&&"$"===n[7])return ea.absolute(o,i,s);else if("$"===n[5])return ea.absoluteCol(o,i-t.row,s);else if("$"===n[7])return ea.absoluteRow(o-t.col,i,s);else return ea.relative(o-t.col,i-t.row,s)},eT=(e,t,r)=>{let n=eS.exec(e);if(!n)return;let o=ex(n[6]),i=eH(ek(n),r);if(null!==i)if("$"===n[5])return ei.absolute(o,i);else return ei.relative(o-t.col,i)},eA=(e,t,r)=>{let n=ev.exec(e);if(!n)return;let o=Number(n[6])-1,i=eH(ek(n),r);if(null!==i)if("$"===n[5])return es.absolute(o,i);else return es.relative(o-t.row,i)},eM=(e,t,r)=>{let n=ew.exec(t);if(!n)return;let o=ex(n[6]),i=Number(n[8])-1,s=eH(ek(n),e);if(null!==s)return r0(void 0===s?r:s,o,i)},eI=(e,t,r)=>{let n=eN(t.col),o=eO(t.sheet,e);if(void 0!==o)if(r!==t.sheet)return`${o}!${n}${t.row+1}`;else return`${n}${t.row+1}`};function ex(e){return 1===e.length?e.toUpperCase().charCodeAt(0)-65:e.split("").reduce((e,t)=>26*e+(t.toUpperCase().charCodeAt(0)-64),0)-1}function eN(e){let t="";for(;e>=0;)t=String.fromCharCode(e%26+97)+t,e=Math.floor(e/26)-1;return t.toUpperCase()}function eO(e,t){let r=t(e);if(void 0!==r)if(eR.test(r))return r;else return r=r.replace(/'/g,"''"),`'${r}'`}function ek(e){var t;let r=null!=(t=e[3])?t:e[2];return r?r.replace(/''/g,"'"):null}function eH(e,t){if(!e)return;let r=t(e);return void 0===r?null:r}var e_=r(603);let eL=(e,t)=>({type:e,message:t});(T=n||(n={})).LexingError="LexingError",T.ParserError="ParsingError",T.StaticOffsetError="StaticOffsetError",T.StaticOffsetOutOfRangeError="StaticOffsetOutOfRangeError",T.RangeOffsetNotAllowed="RangeOffsetNotAllowed",T.InvalidRangeSize="InvalidRangeSize",(A=o||(o={})).EMPTY="EMPTY",A.NUMBER="NUMBER",A.STRING="STRING",A.MINUS_UNARY_OP="MINUS_UNARY_OP",A.PLUS_UNARY_OP="PLUS_UNARY_OP",A.PERCENT_OP="PERCENT_OP",A.CONCATENATE_OP="CONCATENATE_OP",A.EQUALS_OP="EQUALS_OP",A.NOT_EQUAL_OP="NOT_EQUAL_OP",A.GREATER_THAN_OP="GREATER_THAN_OP",A.LESS_THAN_OP="LESS_THAN_OP",A.GREATER_THAN_OR_EQUAL_OP="GREATER_THAN_OR_EQUAL_OP",A.LESS_THAN_OR_EQUAL_OP="LESS_THAN_OR_EQUAL_OP",A.PLUS_OP="PLUS_OP",A.MINUS_OP="MINUS_OP",A.TIMES_OP="TIMES_OP",A.DIV_OP="DIV_OP",A.POWER_OP="POWER_OP",A.FUNCTION_CALL="FUNCTION_CALL",A.NAMED_EXPRESSION="NAMED_EXPRESSION",A.PARENTHESIS="PARENTHESES",A.CELL_REFERENCE="CELL_REFERENCE",A.CELL_RANGE="CELL_RANGE",A.COLUMN_RANGE="COLUMN_RANGE",A.ROW_RANGE="ROW_RANGE",A.ERROR="ERROR",A.ERROR_WITH_RAW_INPUT="ERROR_WITH_RAW_INPUT",A.ARRAY="ARRAY",(M=i||(i={}))[M.RELATIVE=0]="RELATIVE",M[M.START_ABSOLUTE=1]="START_ABSOLUTE",M[M.BOTH_ABSOLUTE=2]="BOTH_ABSOLUTE";let eP=(e,t)=>({type:o.CELL_REFERENCE,reference:e,leadingWhitespace:null==t?void 0:t.image}),eD=(e,t,r,n)=>(ez(e,t,r),{type:o.CELL_RANGE,start:e,end:t,sheetReferenceType:r,leadingWhitespace:n}),eF=(e,t,r)=>({type:o.ARRAY,args:e,leadingWhitespace:null==t?void 0:t.image,internalWhitespace:null==r?void 0:r.image}),eB=(e,t)=>({type:o.ERROR,error:e,leadingWhitespace:null==t?void 0:t.image}),eV=(e,t,r)=>({type:o.ERROR_WITH_RAW_INPUT,error:t,rawInput:e,leadingWhitespace:null==r?void 0:r.image}),eU=()=>({type:o.ERROR,error:rK.parsingError()});function ez(e,t,r){if(void 0!==e.sheet&&void 0===t.sheet||void 0===e.sheet&&void 0!==t.sheet)throw Error("Start address inconsistent with end address");if(void 0===e.sheet&&r!==i.RELATIVE||void 0!==e.sheet&&r===i.RELATIVE)throw Error("Sheet address inconsistent with sheet reference type")}function eW(e,t){return(null!=t?t:"")+e}let eG={[o.PLUS_OP]:"+",[o.MINUS_OP]:"-",[o.TIMES_OP]:"*",[o.DIV_OP]:"/",[o.CONCATENATE_OP]:"&",[o.POWER_OP]:"^",[o.EQUALS_OP]:"=",[o.NOT_EQUAL_OP]:"<>",[o.GREATER_THAN_OP]:">",[o.GREATER_THAN_OR_EQUAL_OP]:">=",[o.LESS_THAN_OP]:"<",[o.LESS_THAN_OR_EQUAL_OP]:"<="};class e${constructor(e){this.functionRegistry=e,this.cache=new Map}set(e,t){let r=tw(t,this.functionRegistry),n={ast:t,relativeDependencies:r,hasVolatileFunction:eY(t,this.functionRegistry.isFunctionVolatile),hasStructuralChangeFunction:eY(t,this.functionRegistry.isFunctionDependentOnSheetStructureChange)};return this.cache.set(e,n),n}get(e){return this.cache.get(e)}maybeSetAndThenGet(e,t){let r=this.cache.get(e);return void 0!==r?r.ast:(this.set(e,t),t)}}let eY=(e,t)=>{switch(e.type){case o.EMPTY:case o.NUMBER:case o.STRING:case o.ERROR:case o.ERROR_WITH_RAW_INPUT:case o.CELL_REFERENCE:case o.CELL_RANGE:case o.COLUMN_RANGE:case o.ROW_RANGE:case o.NAMED_EXPRESSION:return!1;case o.PERCENT_OP:case o.PLUS_UNARY_OP:case o.MINUS_UNARY_OP:return eY(e.value,t);case o.CONCATENATE_OP:case o.EQUALS_OP:case o.NOT_EQUAL_OP:case o.LESS_THAN_OP:case o.GREATER_THAN_OP:case o.LESS_THAN_OR_EQUAL_OP:case o.GREATER_THAN_OR_EQUAL_OP:case o.MINUS_OP:case o.PLUS_OP:case o.TIMES_OP:case o.DIV_OP:case o.POWER_OP:return eY(e.left,t)||eY(e.right,t);case o.PARENTHESIS:return eY(e.expression,t);case o.FUNCTION_CALL:if(t(e.procedureName))return!0;return e.args.some(e=>eY(e,t));case o.ARRAY:return e.args.some(e=>e.some(e=>eY(e,t)))}};class ej{}ej.DistinctSigns="Distinct signs.",ej.WrongArgNumber="Wrong number of arguments.",ej.EmptyArg="Empty function argument.",ej.EmptyArray="Empty array not allowed.",ej.ArrayDimensions="Array dimensions are not compatible.",ej.NoSpaceForArrayResult="No space for array result.",ej.ValueSmall="Value too small.",ej.ValueLarge="Value too large.",ej.BadCriterion="Incorrect criterion.",ej.RangeManySheets="Range spans more than one sheet.",ej.CellRangeExpected="Cell range expected.",ej.WrongDimension="Wrong range dimension.",ej.ScalarExpected="Cell range not allowed.",ej.NumberCoercion="Value cannot be coerced to number.",ej.NumberExpected="Number argument expected.",ej.IntegerExpected="Value needs to be an integer.",ej.BadMode="Mode not recognized.",ej.DateBounds="Date outside of bounds.",ej.OutOfSheet="Resulting reference is out of the sheet.",ej.WrongType="Wrong type of argument.",ej.NaN="NaN or infinite value encountered.",ej.EqualLength="Ranges need to be of equal length.",ej.Negative="Value cannot be negative.",ej.NotBinary="String does not represent a binary number.",ej.NotOctal="String does not represent an octal number.",ej.NotHex="String does not represent a hexadecimal number.",ej.EndStartPeriod="End period needs to be at least start period.",ej.CellRefExpected="Cell reference expected.",ej.EmptyRange="Empty range not allowed.",ej.BadRef="Address is not correct.",ej.NumberRange="Number-only range expected.",ej.ValueNotFound="Value not found.",ej.ValueBaseLarge="Value in base too large.",ej.ValueBaseSmall="Value in base too small.",ej.ValueBaseLong="Value in base too long.",ej.NegativeLength="Length cannot be negative.",ej.PatternNotFound="Pattern not found.",ej.OneValue="Needs at least one value.",ej.TwoValues="Range needs to contain at least two elements.",ej.ThreeValues="Range needs to contain at least three elements.",ej.IndexBounds="Index out of bounds.",ej.IndexLarge="Index too large.",ej.Formula="Expected formula.",ej.NegativeCount="Count cannot be negative.",ej.ParseError="Parsing error.",ej.SheetRef="Sheet does not exist.",ej.PeriodLong="Period number cannot exceed life length.",ej.InvalidDate="Invalid date.",ej.BitshiftLong="Result of bitshift is too long.",ej.EmptyString="Empty-string argument not allowed.",ej.LengthBounds="Length out of bounds.",ej.NegativeTime="Time cannot be negative.",ej.NoDefault="No default option.",ej.NoConditionMet="None of the conditions were met.",ej.Selector="Selector cannot exceed the number of arguments.",ej.StartEndDate="Start date needs to be earlier than end date.",ej.IncorrectDateTime="String does not represent correct DateTime.",ej.CharacterCodeBounds="Character code out of bounds.",ej.NonZero="Argument cannot be 0.",ej.LessThanOne="Argument cannot be less than 1.",ej.WeekendString="Incorrect weekend bitmask string.",ej.InvalidRoman="Invalid roman numeral.",ej.WrongOrder="Wrong order of values.",ej.ComplexNumberExpected="Complex number expected.",ej.ShouldBeIorJ="Should be 'i' or 'j'.",ej.SizeMismatch="Array dimensions mismatched.",ej.ResultTooLong="Result exceeds the maximum allowed length.",ej.FunctionName=e=>`Function name ${e} not recognized.`,ej.NamedExpressionName=e=>`Named expression ${e} not recognized.`,ej.LicenseKey=e=>`License key is ${e}.`;let eq=(0,e_.createToken)({name:"AdditionOp",pattern:e_.Lexer.NA}),eK=(0,e_.createToken)({name:"PlusOp",pattern:/\+/,categories:eq}),eX=(0,e_.createToken)({name:"MinusOp",pattern:/-/,categories:eq}),eQ=(0,e_.createToken)({name:"MultiplicationOp",pattern:e_.Lexer.NA}),eZ=(0,e_.createToken)({name:"TimesOp",pattern:/\*/,categories:eQ}),eJ=(0,e_.createToken)({name:"DivOp",pattern:/\//,categories:eQ}),e0=(0,e_.createToken)({name:"PowerOp",pattern:/\^/}),e1=(0,e_.createToken)({name:"PercentOp",pattern:/%/}),e2=(0,e_.createToken)({name:"BooleanOp",pattern:e_.Lexer.NA}),e3=(0,e_.createToken)({name:"EqualsOp",pattern:/=/,categories:e2}),e6=(0,e_.createToken)({name:"NotEqualOp",pattern:/<>/,categories:e2}),e5=(0,e_.createToken)({name:"GreaterThanOp",pattern:/>/,categories:e2}),e4=(0,e_.createToken)({name:"LessThanOp",pattern:/</,categories:e2}),e9=(0,e_.createToken)({name:"GreaterThanOrEqualOp",pattern:/>=/,categories:e2}),e7=(0,e_.createToken)({name:"LessThanOrEqualOp",pattern:/<=/,categories:e2}),e8=(0,e_.createToken)({name:"ConcatenateOp",pattern:/&/}),te=(0,e_.createToken)({name:"LParen",pattern:/\(/}),tt=(0,e_.createToken)({name:"RParen",pattern:/\)/}),tr=(0,e_.createToken)({name:"ArrayLParen",pattern:/{/}),tn=(0,e_.createToken)({name:"ArrayRParen",pattern:/}/}),to=(0,e_.createToken)({name:"StringLiteral",pattern:/"([^"\\]*(\\.[^"\\]*)*)"/}),ti=(0,e_.createToken)({name:"ErrorLiteral",pattern:/#[A-Za-z0-9\/]+[?!]?/}),ts=(0,e_.createToken)({name:"RangeSeparator",pattern:RegExp(":")}),ta=(0,e_.createToken)({name:"ColumnRange",pattern:RegExp(`${eg}:${eg}`)}),tl=(0,e_.createToken)({name:"RowRange",pattern:RegExp(`${ep}:${ep}`)}),th=(0,e_.createToken)({name:"ProcedureName",pattern:RegExp(`([${el}][${eh}]*)\\(`)}),td=new class{constructor(){this.POSSIBLE_START_CHARACTERS=[...ey,...eC,"$","'","_"],this.cellReferenceRegexp=RegExp(ef,"y")}match(e,t){this.cellReferenceRegexp.lastIndex=t;let r=this.cellReferenceRegexp.exec(e+"@");return null==r||null==r[1]?null:(r[0]=r[1],r)}},tu=(0,e_.createToken)({name:"CellReference",pattern:td.match.bind(td),start_chars_hint:td.POSSIBLE_START_CHARACTERS,line_breaks:!1}),tc=new class{constructor(){this.POSSIBLE_START_CHARACTERS=[...ey,"_"],this.namedExpressionRegexp=RegExp(eb,"y"),this.r1c1CellRefRegexp=RegExp(`^${em}$`)}match(e,t){this.namedExpressionRegexp.lastIndex=t;let r=this.namedExpressionRegexp.exec(e);return null==r||null==r[0]||this.r1c1CellRefRegexp.test(r[0])?null:r}},tg=(0,e_.createToken)({name:"NamedExpression",pattern:tc.match.bind(tc),start_chars_hint:tc.POSSIBLE_START_CHARACTERS,line_breaks:!1});class tp extends e_.EmbeddedActionsParser{constructor(e,t){super(e.allTokens,{outputCst:!1,maxLookahead:7}),this.resolveSheetReference=t,this.booleanExpressionOrEmpty=this.RULE("booleanExpressionOrEmpty",()=>{let e;return this.OR([{ALT:()=>this.SUBRULE(this.booleanExpression)},{ALT:(0,e_.EMPTY_ALT)({type:o.EMPTY,leadingWhitespace:null==e?void 0:e.image})}])}),this.procedureExpression=this.RULE("procedureExpression",()=>{var e;let t,r,n,i=this.CONSUME(th),s=i.image.toUpperCase().slice(0,-1),a=null!=(e=this.lexerConfig.functionMapping[s])?e:s,l=[],h=this.SUBRULE(this.booleanExpressionOrEmpty);this.MANY(()=>{var e;let t=this.CONSUME(this.lexerConfig.ArgSeparator);h.type===o.EMPTY&&(h.leadingWhitespace=null==(e=t.leadingWhitespace)?void 0:e.image),l.push(h),h=this.SUBRULE2(this.booleanExpressionOrEmpty)}),l.push(h),1===l.length&&l[0].type===o.EMPTY&&(l.length=0);let d=this.CONSUME(tt);return t=i.leadingWhitespace,r=d.leadingWhitespace,{type:o.FUNCTION_CALL,procedureName:a,args:l,leadingWhitespace:null==t?void 0:t.image,internalWhitespace:null==r?void 0:r.image,hyperlink:n}}),this.namedExpressionExpression=this.RULE("namedExpressionExpression",()=>{let e,t,r=this.CONSUME(tg);return e=r.image,t=r.leadingWhitespace,{type:o.NAMED_EXPRESSION,expressionName:e,leadingWhitespace:null==t?void 0:t.image}}),this.offsetProcedureExpression=this.RULE("offsetProcedureExpression",()=>{let e=[];return this.CONSUME(this.lexerConfig.OffsetProcedureName),this.CONSUME(te),this.MANY_SEP({SEP:this.lexerConfig.ArgSeparator,DEF:()=>{e.push(this.SUBRULE(this.booleanExpression))}}),this.CONSUME(tt),this.handleOffsetHeuristic(e)}),this.columnRangeExpression=this.RULE("columnRangeExpression",()=>{var e;let t=this.CONSUME(ta),[r,i]=t.image.split(":"),s=this.ACTION(()=>eT(r,this.formulaAddress,this.resolveSheetReference)),a=this.ACTION(()=>eT(i,this.formulaAddress,this.resolveSheetReference));if(void 0===s||void 0===a)return eB(new rK(d.REF));if(s.exceedsSheetSizeLimits(this.lexerConfig.maxColumns)||a.exceedsSheetSizeLimits(this.lexerConfig.maxColumns))return eV(t.image,new rK(d.NAME),t.leadingWhitespace);if(void 0===s.sheet&&void 0!==a.sheet)return this.parsingError(n.ParserError,"Malformed range expression");let{firstEnd:l,secondEnd:h,sheetRefType:u}=tp.fixSheetIdsForRangeEnds(s,a);return e=t.leadingWhitespace,ez(l,h,u),{type:o.COLUMN_RANGE,start:l,end:h,sheetReferenceType:u,leadingWhitespace:null==e?void 0:e.image}}),this.rowRangeExpression=this.RULE("rowRangeExpression",()=>{var e;let t=this.CONSUME(tl),[r,i]=t.image.split(":"),s=this.ACTION(()=>eA(r,this.formulaAddress,this.resolveSheetReference)),a=this.ACTION(()=>eA(i,this.formulaAddress,this.resolveSheetReference));if(void 0===s||void 0===a)return eB(new rK(d.REF));if(s.exceedsSheetSizeLimits(this.lexerConfig.maxRows)||a.exceedsSheetSizeLimits(this.lexerConfig.maxRows))return eV(t.image,new rK(d.NAME),t.leadingWhitespace);if(void 0===s.sheet&&void 0!==a.sheet)return this.parsingError(n.ParserError,"Malformed range expression");let{firstEnd:l,secondEnd:h,sheetRefType:u}=tp.fixSheetIdsForRangeEnds(s,a);return e=t.leadingWhitespace,ez(l,h,u),{type:o.ROW_RANGE,start:l,end:h,sheetReferenceType:u,leadingWhitespace:null==e?void 0:e.image}}),this.cellReference=this.RULE("cellReference",()=>{let e=this.CONSUME(tu),t=this.ACTION(()=>eE(e.image,this.formulaAddress,this.resolveSheetReference));return void 0===t?eV(e.image,new rK(d.REF),e.leadingWhitespace):t.exceedsSheetSizeLimits(this.lexerConfig.maxColumns,this.lexerConfig.maxRows)?eV(e.image,new rK(d.NAME),e.leadingWhitespace):eP(t,e.leadingWhitespace)}),this.endRangeReference=this.RULE("endRangeReference",e=>{var t;let r=this.CONSUME(tu),n=this.ACTION(()=>eE(e.image,this.formulaAddress,this.resolveSheetReference)),o=this.ACTION(()=>eE(r.image,this.formulaAddress,this.resolveSheetReference));return void 0===n||void 0===o?this.ACTION(()=>eV(`${e.image}:${r.image}`,new rK(d.REF),e.leadingWhitespace)):n.exceedsSheetSizeLimits(this.lexerConfig.maxColumns,this.lexerConfig.maxRows)||o.exceedsSheetSizeLimits(this.lexerConfig.maxColumns,this.lexerConfig.maxRows)?this.ACTION(()=>eV(`${e.image}:${r.image}`,new rK(d.NAME),e.leadingWhitespace)):this.buildCellRange(n,o,null==(t=e.leadingWhitespace)?void 0:t.image)}),this.endOfRangeExpression=this.RULE("endOfRangeExpression",e=>this.OR([{ALT:()=>this.SUBRULE(this.endRangeReference,{ARGS:[e]})},{ALT:()=>{var t;let r=this.SUBRULE(this.offsetProcedureExpression),i=this.ACTION(()=>eE(e.image,this.formulaAddress,this.resolveSheetReference));return void 0===i?eB(new rK(d.REF)):r.type===o.CELL_REFERENCE?this.buildCellRange(i,r.reference,null==(t=e.leadingWhitespace)?void 0:t.image):this.parsingError(n.RangeOffsetNotAllowed,"Range offset not allowed here")}}])),this.cellRangeExpression=this.RULE("cellRangeExpression",()=>{let e=this.CONSUME(tu);return this.CONSUME2(ts),this.SUBRULE(this.endOfRangeExpression,{ARGS:[e]})}),this.endRangeWithOffsetStartReference=this.RULE("endRangeWithOffsetStartReference",e=>{let t=this.CONSUME(tu),r=this.ACTION(()=>eE(t.image,this.formulaAddress,this.resolveSheetReference));return void 0===r?this.ACTION(()=>eB(new rK(d.REF))):this.buildCellRange(e.reference,r,e.leadingWhitespace)}),this.endOfRangeWithOffsetStartExpression=this.RULE("endOfRangeWithOffsetStartExpression",e=>this.OR([{ALT:()=>this.SUBRULE(this.endRangeWithOffsetStartReference,{ARGS:[e]})},{ALT:()=>{let t=this.SUBRULE(this.offsetProcedureExpression);return t.type===o.CELL_REFERENCE?this.buildCellRange(e.reference,t.reference,e.leadingWhitespace):this.parsingError(n.RangeOffsetNotAllowed,"Range offset not allowed here")}}])),this.offsetExpression=this.RULE("offsetExpression",()=>{let e,t=this.SUBRULE(this.offsetProcedureExpression);return(this.OPTION(()=>{this.CONSUME(ts),e=t.type===o.CELL_RANGE?this.parsingError(n.RangeOffsetNotAllowed,"Range offset not allowed here"):this.SUBRULE(this.endOfRangeWithOffsetStartExpression,{ARGS:[t]})}),void 0!==e)?e:t}),this.insideArrayExpression=this.RULE("insideArrayExpression",()=>{let e=[[]];return e[e.length-1].push(this.SUBRULE(this.booleanExpression)),this.MANY(()=>{this.OR([{ALT:()=>{this.CONSUME(this.lexerConfig.ArrayColSeparator),e[e.length-1].push(this.SUBRULE2(this.booleanExpression))}},{ALT:()=>{this.CONSUME(this.lexerConfig.ArrayRowSeparator),e.push([]),e[e.length-1].push(this.SUBRULE3(this.booleanExpression))}}])}),eF(e)}),this.parenthesisExpression=this.RULE("parenthesisExpression",()=>{let e,t,r=this.CONSUME(te),n=this.SUBRULE(this.booleanExpression),i=this.CONSUME(tt);return e=r.leadingWhitespace,t=i.leadingWhitespace,{type:o.PARENTHESIS,expression:n,leadingWhitespace:null==e?void 0:e.image,internalWhitespace:null==t?void 0:t.image}}),this.arrayExpression=this.RULE("arrayExpression",()=>this.OR([{ALT:()=>{let e=this.CONSUME(tr),t=this.SUBRULE(this.insideArrayExpression),r=this.CONSUME(tn);return eF(t.args,e.leadingWhitespace,r.leadingWhitespace)}},{ALT:()=>this.SUBRULE(this.parenthesisExpression)}])),this.numericStringToNumber=e=>Number(e.replace(this.lexerConfig.decimalSeparator,".")),this.positiveAtomicExpression=this.RULE("positiveAtomicExpression",()=>{var e;return this.OR(null!=(e=this.atomicExpCache)?e:this.atomicExpCache=[{ALT:()=>this.SUBRULE(this.arrayExpression)},{ALT:()=>this.SUBRULE(this.cellRangeExpression)},{ALT:()=>this.SUBRULE(this.columnRangeExpression)},{ALT:()=>this.SUBRULE(this.rowRangeExpression)},{ALT:()=>this.SUBRULE(this.offsetExpression)},{ALT:()=>this.SUBRULE(this.cellReference)},{ALT:()=>this.SUBRULE(this.procedureExpression)},{ALT:()=>this.SUBRULE(this.namedExpressionExpression)},{ALT:()=>{let e,t,r=this.CONSUME(this.lexerConfig.NumberLiteral);return e=this.numericStringToNumber(r.image),t=r.leadingWhitespace,{type:o.NUMBER,value:e,leadingWhitespace:null==t?void 0:t.image}}},{ALT:()=>{var e,t;return e=this.CONSUME(to),{type:o.STRING,value:e.image.slice(1,-1),leadingWhitespace:null==(t=e.leadingWhitespace)?void 0:t.image}}},{ALT:()=>{let e=this.CONSUME(ti),t=e.image.toUpperCase(),r=this.lexerConfig.errorMapping[t];return r?eB(new rK(r),e.leadingWhitespace):this.parsingError(n.ParserError,"Unknown error literal")}}])}),this.rightUnaryOpAtomicExpression=this.RULE("rightUnaryOpAtomicExpression",()=>{let e=this.SUBRULE(this.positiveAtomicExpression),t=this.OPTION(()=>this.CONSUME(e1));if(t){let r;return r=t.leadingWhitespace,{type:o.PERCENT_OP,value:e,leadingWhitespace:null==r?void 0:r.image}}return e}),this.atomicExpression=this.RULE("atomicExpression",()=>this.OR([{ALT:()=>{let e=this.CONSUME(eq),t=this.SUBRULE(this.atomicExpression);if((0,e_.tokenMatcher)(e,eK)){let r;return r=e.leadingWhitespace,{type:o.PLUS_UNARY_OP,value:t,leadingWhitespace:null==r?void 0:r.image}}if((0,e_.tokenMatcher)(e,eX)){let r;return r=e.leadingWhitespace,{type:o.MINUS_UNARY_OP,value:t,leadingWhitespace:null==r?void 0:r.image}}return this.customParsingError=eL(n.ParserError,"Mismatched token type"),this.customParsingError}},{ALT:()=>this.SUBRULE2(this.rightUnaryOpAtomicExpression)}])),this.powerExpression=this.RULE("powerExpression",()=>{let e=this.SUBRULE(this.atomicExpression);return this.MANY(()=>{let t=this.CONSUME(e0),r=this.SUBRULE2(this.atomicExpression);if((0,e_.tokenMatcher)(t,e0)){let n,i;n=e,i=t.leadingWhitespace,e={type:o.POWER_OP,left:n,right:r,leadingWhitespace:null==i?void 0:i.image}}else this.ACTION(()=>{throw Error("Operator not supported")})}),e}),this.multiplicationExpression=this.RULE("multiplicationExpression",()=>{let e=this.SUBRULE(this.powerExpression);return this.MANY(()=>{let t=this.CONSUME(eQ),r=this.SUBRULE2(this.powerExpression);if((0,e_.tokenMatcher)(t,eZ)){let n,i;n=e,i=t.leadingWhitespace,e={type:o.TIMES_OP,left:n,right:r,leadingWhitespace:null==i?void 0:i.image}}else if((0,e_.tokenMatcher)(t,eJ)){let n,i;n=e,i=t.leadingWhitespace,e={type:o.DIV_OP,left:n,right:r,leadingWhitespace:null==i?void 0:i.image}}else this.ACTION(()=>{throw Error("Operator not supported")})}),e}),this.additionExpression=this.RULE("additionExpression",()=>{let e=this.SUBRULE(this.multiplicationExpression);return this.MANY(()=>{let t=this.CONSUME(eq),r=this.SUBRULE2(this.multiplicationExpression);if((0,e_.tokenMatcher)(t,eK)){let n,i;n=e,i=t.leadingWhitespace,e={type:o.PLUS_OP,left:n,right:r,leadingWhitespace:null==i?void 0:i.image}}else if((0,e_.tokenMatcher)(t,eX)){let n,i;n=e,i=t.leadingWhitespace,e={type:o.MINUS_OP,left:n,right:r,leadingWhitespace:null==i?void 0:i.image}}else this.ACTION(()=>{throw Error("Operator not supported")})}),e}),this.concatenateExpression=this.RULE("concatenateExpression",()=>{let e=this.SUBRULE(this.additionExpression);return this.MANY(()=>{let t,r,n=this.CONSUME(e8),i=this.SUBRULE2(this.additionExpression);t=e,r=n.leadingWhitespace,e={type:o.CONCATENATE_OP,left:t,right:i,leadingWhitespace:null==r?void 0:r.image}}),e}),this.booleanExpression=this.RULE("booleanExpression",()=>{let e=this.SUBRULE(this.concatenateExpression);return this.MANY(()=>{let t=this.CONSUME(e2),r=this.SUBRULE2(this.concatenateExpression);if((0,e_.tokenMatcher)(t,e3)){let n,i;n=e,i=t.leadingWhitespace,e={type:o.EQUALS_OP,left:n,right:r,leadingWhitespace:null==i?void 0:i.image}}else if((0,e_.tokenMatcher)(t,e6)){let n,i;n=e,i=t.leadingWhitespace,e={type:o.NOT_EQUAL_OP,left:n,right:r,leadingWhitespace:null==i?void 0:i.image}}else if((0,e_.tokenMatcher)(t,e5)){let n,i;n=e,i=t.leadingWhitespace,e={type:o.GREATER_THAN_OP,left:n,right:r,leadingWhitespace:null==i?void 0:i.image}}else if((0,e_.tokenMatcher)(t,e4)){let n,i;n=e,i=t.leadingWhitespace,e={type:o.LESS_THAN_OP,left:n,right:r,leadingWhitespace:null==i?void 0:i.image}}else if((0,e_.tokenMatcher)(t,e9)){let n,i;n=e,i=t.leadingWhitespace,e={type:o.GREATER_THAN_OR_EQUAL_OP,left:n,right:r,leadingWhitespace:null==i?void 0:i.image}}else if((0,e_.tokenMatcher)(t,e7)){let n,i;n=e,i=t.leadingWhitespace,e={type:o.LESS_THAN_OR_EQUAL_OP,left:n,right:r,leadingWhitespace:null==i?void 0:i.image}}else this.ACTION(()=>{throw Error("Operator not supported")})}),e}),this.formula=this.RULE("formula",()=>(this.CONSUME(e3),this.SUBRULE(this.booleanExpression))),this.lexerConfig=e,this.formulaAddress=r0(0,0,0),this.performSelfAnalysis()}parseFromTokens(e,t){this.input=e;let r=this.formulaWithContext(t),o=[];return this.customParsingError&&o.push(this.customParsingError),(o=o.concat(this.errors.map(e=>({type:n.ParserError,message:e.message})))).length>0&&(r=eU()),{ast:r,errors:o}}reset(){super.reset(),this.customParsingError=void 0}formulaWithContext(e){return this.formulaAddress=e,this.formula()}buildCellRange(e,t,r){if(void 0===e.sheet&&void 0!==t.sheet)return this.parsingError(n.ParserError,"Malformed range expression");let{firstEnd:o,secondEnd:i,sheetRefType:s}=tp.fixSheetIdsForRangeEnds(e,t);return eD(o,i,s,r)}static fixSheetIdsForRangeEnds(e,t){let r=tp.rangeSheetReferenceType(e.sheet,t.sheet),n=void 0!==e.sheet&&void 0===t.sheet?t.withSheet(e.sheet):t;return{firstEnd:e,secondEnd:n,sheetRefType:r}}handleOffsetHeuristic(e){var r;let s,a,l,h,u=e[0];if(u.type!==o.CELL_REFERENCE)return this.parsingError(n.StaticOffsetError,"First argument to OFFSET is not a reference");let c=e[1];if(c.type===o.NUMBER&&Number.isInteger(c.value))s=c.value;else if(c.type===o.PLUS_UNARY_OP&&c.value.type===o.NUMBER&&Number.isInteger(c.value.value))s=c.value.value;else{if(!(c.type===o.MINUS_UNARY_OP&&c.value.type===o.NUMBER&&Number.isInteger(c.value.value)))return this.parsingError(n.StaticOffsetError,"Second argument to OFFSET is not a static number");s=-c.value.value}let g=e[2];if(g.type===o.NUMBER&&Number.isInteger(g.value))a=g.value;else if(g.type===o.PLUS_UNARY_OP&&g.value.type===o.NUMBER&&Number.isInteger(g.value.value))a=g.value.value;else{if(!(g.type===o.MINUS_UNARY_OP&&g.value.type===o.NUMBER&&Number.isInteger(g.value.value)))return this.parsingError(n.StaticOffsetError,"Third argument to OFFSET is not a static number");a=-g.value.value}let p=e[3];if(void 0===p)l=1;else{if(p.type!==o.NUMBER)return this.parsingError(n.StaticOffsetError,"Fourth argument to OFFSET is not a static number");if((l=p.value)<1)return this.parsingError(n.StaticOffsetError,"Fourth argument to OFFSET is too small number");if(!Number.isInteger(l))return this.parsingError(n.StaticOffsetError,"Fourth argument to OFFSET is not integer")}let m=e[4];if(void 0===m)h=1;else{if(m.type!==o.NUMBER)return this.parsingError(n.StaticOffsetError,"Fifth argument to OFFSET is not a static number");if((h=m.value)<1)return this.parsingError(n.StaticOffsetError,"Fifth argument to OFFSET is too small number");if(!Number.isInteger(h))return this.parsingError(n.StaticOffsetError,"Fifth argument to OFFSET is not integer")}let f=new ea(u.reference.col+a,u.reference.row+s,u.reference.type,null!=(r=u.reference.sheet)?r:void 0),b=f.col,C=f.row;if((u.reference.type===t.CELL_REFERENCE_RELATIVE||u.reference.type===t.CELL_REFERENCE_ABSOLUTE_COL)&&(C+=this.formulaAddress.row),(u.reference.type===t.CELL_REFERENCE_RELATIVE||u.reference.type===t.CELL_REFERENCE_ABSOLUTE_ROW)&&(b+=this.formulaAddress.col),b<0||C<0)return eB(new rK(d.REF,ej.OutOfSheet));if(1===h&&1===l)return eP(f);{let e=new ea(f.col+h-1,f.row+l-1,f.type,f.sheet);return eD(f,e,null==u.reference.sheet?i.RELATIVE:i.BOTH_ABSOLUTE)}}parsingError(e,t){return this.customParsingError=eL(e,t),eU()}static rangeSheetReferenceType(e,t){return void 0===e?i.RELATIVE:void 0===t?i.START_ABSOLUTE:i.BOTH_ABSOLUTE}}class tm{constructor(e){this.lexerConfig=e,this.lexer=new e_.Lexer(e.allTokens,{ensureOptimizations:!0})}tokenizeFormula(e){let t=this.lexer.tokenize(e),r=t.tokens;return r=this.trimTrailingWhitespaces(r),r=this.skipWhitespacesInsideRanges(r),t.tokens=r=this.skipWhitespacesBeforeArgSeparators(r),t}skipWhitespacesInsideRanges(e){return tm.filterTokensByNeighbors(e,(e,t,r)=>((0,e_.tokenMatcher)(e,tu)||(0,e_.tokenMatcher)(e,ts))&&(0,e_.tokenMatcher)(t,this.lexerConfig.WhiteSpace)&&((0,e_.tokenMatcher)(r,tu)||(0,e_.tokenMatcher)(r,ts)))}skipWhitespacesBeforeArgSeparators(e){return tm.filterTokensByNeighbors(e,(e,t,r)=>!(0,e_.tokenMatcher)(e,this.lexerConfig.ArgSeparator)&&(0,e_.tokenMatcher)(t,this.lexerConfig.WhiteSpace)&&(0,e_.tokenMatcher)(r,this.lexerConfig.ArgSeparator))}static filterTokensByNeighbors(e,t){if(e.length<3)return e;let r=0,n=[e[r++]];for(;r<e.length-1;)t(e[r-1],e[r],e[r+1])||n.push(e[r]),++r;return n.push(e[r]),n}trimTrailingWhitespaces(e){return e.length>0&&(0,e_.tokenMatcher)(e[e.length-1],this.lexerConfig.WhiteSpace)&&e.pop(),e}}class tf{constructor(e,t,r){this.config=e,this.sheetMapping=t,this.namedExpressions=r}unparse(e,t){return"="+this.unparseAst(e,t)}unparseAst(e,t){var r,n;switch(e.type){case o.EMPTY:return eW("",e.leadingWhitespace);case o.NUMBER:return eW(tb(e.value,this.config.decimalSeparator),e.leadingWhitespace);case o.STRING:return eW('"'+e.value+'"',e.leadingWhitespace);case o.FUNCTION_CALL:{let r=e.args.map(e=>void 0!==e?this.unparseAst(e,t):"").join(this.config.functionArgSeparator),n=(this.config.translationPackage.isFunctionTranslated(e.procedureName)?this.config.translationPackage.getFunctionTranslation(e.procedureName):e.procedureName)+"("+r+eW(")",e.internalWhitespace);return eW(n,e.leadingWhitespace)}case o.NAMED_EXPRESSION:return eW((null==(r=this.namedExpressions.nearestNamedExpression(e.expressionName,t.sheet))?void 0:r.displayName)||e.expressionName,e.leadingWhitespace);case o.CELL_REFERENCE:return eW((void 0!==e.reference.sheet?this.unparseSheetName(e.reference.sheet)+"!":"")+(null!=(n=e.reference.unparse(t))?n:this.config.translationPackage.getErrorTranslation(d.REF)),e.leadingWhitespace);case o.COLUMN_RANGE:case o.ROW_RANGE:case o.CELL_RANGE:return eW(this.formatRange(e,t),e.leadingWhitespace);case o.PLUS_UNARY_OP:{let r=this.unparseAst(e.value,t);return eW("+",e.leadingWhitespace)+r}case o.MINUS_UNARY_OP:{let r=this.unparseAst(e.value,t);return eW("-",e.leadingWhitespace)+r}case o.PERCENT_OP:return this.unparseAst(e.value,t)+eW("%",e.leadingWhitespace);case o.ERROR:return eW(this.config.translationPackage.getErrorTranslation(e.error?e.error.type:d.ERROR),e.leadingWhitespace);case o.ERROR_WITH_RAW_INPUT:return eW(e.rawInput,e.leadingWhitespace);case o.PARENTHESIS:{let r="("+this.unparseAst(e.expression,t)+eW(")",e.internalWhitespace);return eW(r,e.leadingWhitespace)}case o.ARRAY:{let r="{"+e.args.map(e=>e.map(e=>this.unparseAst(e,t)).join(this.config.arrayColumnSeparator)).join(this.config.arrayRowSeparator)+eW("}",e.internalWhitespace);return eW(r,e.leadingWhitespace)}default:{let r=this.unparseAst(e.left,t),n=this.unparseAst(e.right,t);return r+eW(eG[e.type],e.leadingWhitespace)+n}}}unparseSheetName(e){let t=eO(e,e=>this.sheetMapping.getSheetNameOrThrowError(e,{includePlaceholders:!0}));if(void 0===t)throw new tK(e);return t}formatRange(e,t){let r="",n="";void 0!==e.start.sheet&&e.sheetReferenceType!==i.RELATIVE&&(r=this.unparseSheetName(e.start.sheet)+"!"),void 0!==e.end.sheet&&e.sheetReferenceType===i.BOTH_ABSOLUTE&&(n=this.unparseSheetName(e.end.sheet)+"!");let o=e.start.unparse(t),s=e.end.unparse(t);return void 0===o||void 0===s?this.config.translationPackage.getErrorTranslation(d.REF):`${r}${o}:${n}${s}`}}function tb(e,t){return e.toString().replace(".",t)}class tC{constructor(e,t,r){this.config=e,this.functionRegistry=t,this.resolveSheetReference=r,this.statsCacheUsed=0,this.lexerConfig=(e=>{let t,r,n=e.translationPackage.getFunctionTranslation("OFFSET"),o=e.errorMapping,i=e.translationPackage.buildFunctionMapping(),s=new RegExp("standard"===e.ignoreWhiteSpace?"[ \\t\\n\\r]+":"\\s+"),a=(0,e_.createToken)({name:"WhiteSpace",pattern:s}),l=(0,e_.createToken)({name:"ArrayRowSep",pattern:e.arrayRowSeparator}),h=(0,e_.createToken)({name:"ArrayColSep",pattern:e.arrayColumnSeparator}),d=(0,e_.createToken)({name:"NumberLiteral",pattern:RegExp(`(([${e.decimalSeparator}]\\d+)|(\\d+([${e.decimalSeparator}]\\d*)?))(e[+-]?\\d+)?`)}),u=(0,e_.createToken)({name:"OffsetProcedureName",pattern:RegExp(n,"i")});e.functionArgSeparator===e.arrayColumnSeparator?(t=h,r=[]):e.functionArgSeparator===e.arrayRowSeparator?(t=l,r=[]):r=[t=(0,e_.createToken)({name:"ArgSeparator",pattern:e.functionArgSeparator})];let c=[a,eK,eX,eZ,eJ,e0,e3,e6,e1,e9,e7,e5,e4,te,tt,tr,tn,u,th,ts,...r,ta,tl,d,to,ti,e8,e2,eq,eQ,tu,tg,l,h];return{ArgSeparator:t,NumberLiteral:d,OffsetProcedureName:u,ArrayRowSeparator:l,ArrayColSeparator:h,WhiteSpace:a,allTokens:c,errorMapping:o,functionMapping:i,decimalSeparator:e.decimalSeparator,maxColumns:e.maxColumns,maxRows:e.maxRows}})(e),this.lexer=new tm(this.lexerConfig),this.formulaParser=new tp(this.lexerConfig,this.resolveSheetReference),this.cache=new e$(this.functionRegistry)}parse(e,t){this.formulaAddress=t;let r=this.tokenizeFormula(e);if(r.errors.length>0){let e=r.errors.map(e=>({type:n.LexingError,message:e.message}));return{ast:eU(),errors:e,hasVolatileFunction:!1,hasStructuralChangeFunction:!1,dependencies:[]}}let o=this.computeHashFromTokens(r.tokens,t),i=this.cache.get(o);if(void 0!==i)++this.statsCacheUsed;else{let e=this.bindWhitespacesToTokens(r.tokens),n=this.formulaParser.parseFromTokens(e,t);if(n.errors.length>0)return Object.assign(Object.assign({},n),{hasVolatileFunction:!1,hasStructuralChangeFunction:!1,dependencies:[]});i=this.cache.set(o,n.ast)}let{ast:s,hasVolatileFunction:a,hasStructuralChangeFunction:l}=i,h=this.convertReversedRangesToRegularRanges(s),d=tw(h,this.functionRegistry);return{ast:h,errors:[],hasVolatileFunction:a,hasStructuralChangeFunction:l,dependencies:d}}convertReversedRangesToRegularRanges(e){switch(e.type){case o.EMPTY:case o.NUMBER:case o.STRING:case o.ERROR:case o.ERROR_WITH_RAW_INPUT:case o.CELL_REFERENCE:case o.NAMED_EXPRESSION:return e;case o.CELL_RANGE:{let{start:t,end:r}=e,n=this.orderCellRangeEnds(t,r);return Object.assign(Object.assign({},e),{start:n.start,end:n.end})}case o.COLUMN_RANGE:{let{start:t,end:r}=e,n=this.orderColumnRangeEnds(t,r);return Object.assign(Object.assign({},e),{start:n.start,end:n.end})}case o.ROW_RANGE:{let{start:t,end:r}=e,n=this.orderRowRangeEnds(t,r);return Object.assign(Object.assign({},e),{start:n.start,end:n.end})}case o.PERCENT_OP:case o.PLUS_UNARY_OP:case o.MINUS_UNARY_OP:{let t=this.convertReversedRangesToRegularRanges(e.value);return Object.assign(Object.assign({},e),{value:t})}case o.CONCATENATE_OP:case o.EQUALS_OP:case o.NOT_EQUAL_OP:case o.LESS_THAN_OP:case o.GREATER_THAN_OP:case o.LESS_THAN_OR_EQUAL_OP:case o.GREATER_THAN_OR_EQUAL_OP:case o.MINUS_OP:case o.PLUS_OP:case o.TIMES_OP:case o.DIV_OP:case o.POWER_OP:{let t=this.convertReversedRangesToRegularRanges(e.left),r=this.convertReversedRangesToRegularRanges(e.right);return Object.assign(Object.assign({},e),{left:t,right:r})}case o.PARENTHESIS:{let t=this.convertReversedRangesToRegularRanges(e.expression);return Object.assign(Object.assign({},e),{expression:t})}case o.FUNCTION_CALL:{let t=e.args.map(e=>this.convertReversedRangesToRegularRanges(e));return Object.assign(Object.assign({},e),{args:t})}case o.ARRAY:{let t=e.args.map(e=>e.map(e=>this.convertReversedRangesToRegularRanges(e)));return Object.assign(Object.assign({},e),{args:t})}}}orderCellRangeEnds(e,t){let r=[e,t],[n,o]=r.map(e=>e.toColumnAddress()).sort(ei.compareByAbsoluteAddress(this.formulaAddress)),[i,s]=r.map(e=>e.toRowAddress()).sort(es.compareByAbsoluteAddress(this.formulaAddress)),[a,l]=r.map(e=>e.sheet).sort(tC.compareSheetIds.bind(this));return{start:ea.fromColAndRow(n,i,a),end:ea.fromColAndRow(o,s,l)}}orderColumnRangeEnds(e,t){let r=[e,t],[n,o]=r.sort(ei.compareByAbsoluteAddress(this.formulaAddress)),[i,s]=r.map(e=>e.sheet).sort(tC.compareSheetIds.bind(this));return{start:new ei(n.type,n.col,i),end:new ei(o.type,o.col,s)}}orderRowRangeEnds(e,t){let r=[e,t],[n,o]=r.sort(es.compareByAbsoluteAddress(this.formulaAddress)),[i,s]=r.map(e=>e.sheet).sort(tC.compareSheetIds.bind(this));return{start:new es(n.type,n.row,i),end:new es(o.type,o.row,s)}}static compareSheetIds(e,t){return(e=null!=e?e:1/0)-(t=null!=t?t:1/0)}fetchCachedResultForAst(e){let t=this.computeHashFromAst(e);return this.fetchCachedResult(t)}fetchCachedResult(e){let t=this.cache.get(e);if(void 0===t)throw Error("There is no AST with such key in the cache");{let{ast:e,hasVolatileFunction:r,hasStructuralChangeFunction:n,relativeDependencies:o}=t;return{ast:e,errors:[],hasVolatileFunction:r,hasStructuralChangeFunction:n,dependencies:o}}}computeHashFromTokens(e,t){var r;let n="",o=0;for(;o<e.length;){let i=e[o];if((0,e_.tokenMatcher)(i,tu)){let e=eE(i.image,t,this.resolveSheetReference);n=void 0===e?n.concat(i.image):n.concat(e.hash(!0))}else if((0,e_.tokenMatcher)(i,th)){let e=i.image.toUpperCase().slice(0,-1),t=null!=(r=this.lexerConfig.functionMapping[e])?r:e;n=n.concat(t,"(")}else if((0,e_.tokenMatcher)(i,ta)){let[e,r]=i.image.split(":"),o=eT(e,t,this.resolveSheetReference),s=eT(r,t,this.resolveSheetReference);n=void 0===o||void 0===s?n.concat("!REF"):n.concat(o.hash(!0),":",s.hash(!0))}else if((0,e_.tokenMatcher)(i,tl)){let[e,r]=i.image.split(":"),o=eA(e,t,this.resolveSheetReference),s=eA(r,t,this.resolveSheetReference);n=void 0===o||void 0===s?n.concat("!REF"):n.concat(o.hash(!0),":",s.hash(!0))}else n=n.concat(i.image);o++}return n}rememberNewAst(e){let t=this.computeHashFromAst(e);return this.cache.maybeSetAndThenGet(t,e)}computeHashFromAst(e){return"="+this.computeHashOfAstNode(e)}computeHashOfAstNode(e){switch(e.type){case o.EMPTY:return e.leadingWhitespace||"";case o.NUMBER:return eW(tb(e.value,this.config.decimalSeparator),e.leadingWhitespace);case o.STRING:return eW('"'+e.value+'"',e.leadingWhitespace);case o.NAMED_EXPRESSION:return eW(e.expressionName,e.leadingWhitespace);case o.FUNCTION_CALL:{let t=e.args.map(e=>this.computeHashOfAstNode(e)).join(this.config.functionArgSeparator),r=e.procedureName+"("+t+eW(")",e.internalWhitespace);return eW(r,e.leadingWhitespace)}case o.CELL_REFERENCE:return eW(e.reference.hash(!0),e.leadingWhitespace);case o.COLUMN_RANGE:case o.ROW_RANGE:case o.CELL_RANGE:return eW(e.start.hash(e.sheetReferenceType!==i.RELATIVE)+":"+e.end.hash(e.sheetReferenceType===i.BOTH_ABSOLUTE),e.leadingWhitespace);case o.MINUS_UNARY_OP:return eW("-"+this.computeHashOfAstNode(e.value),e.leadingWhitespace);case o.PLUS_UNARY_OP:return eW("+"+this.computeHashOfAstNode(e.value),e.leadingWhitespace);case o.PERCENT_OP:return this.computeHashOfAstNode(e.value)+eW("%",e.leadingWhitespace);case o.ERROR:return eW(this.config.translationPackage.getErrorTranslation(e.error?e.error.type:d.ERROR),e.leadingWhitespace);case o.ERROR_WITH_RAW_INPUT:return eW(e.rawInput,e.leadingWhitespace);case o.ARRAY:return eW("{"+e.args.map(e=>e.map(e=>this.computeHashOfAstNode(e)).join(",")).join(";")+eW("}",e.internalWhitespace),e.leadingWhitespace);case o.PARENTHESIS:{let t="("+this.computeHashOfAstNode(e.expression)+eW(")",e.internalWhitespace);return eW(t,e.leadingWhitespace)}default:return this.computeHashOfAstNode(e.left)+eW(eG[e.type],e.leadingWhitespace)+this.computeHashOfAstNode(e.right)}}bindWhitespacesToTokens(e){let t=[],r=e[0];(0,e_.tokenMatcher)(r,this.lexerConfig.WhiteSpace)||t.push(r);for(let r=1;r<e.length;++r){let n=e[r];if((0,e_.tokenMatcher)(n,this.lexerConfig.WhiteSpace))continue;let o=e[r-1];(0,e_.tokenMatcher)(o,this.lexerConfig.WhiteSpace)&&(n.leadingWhitespace=o),t.push(n)}return t}tokenizeFormula(e){return this.lexer.tokenizeFormula(e)}}let ty=(e,t,r,n)=>{switch(e.type){case o.EMPTY:case o.NUMBER:case o.STRING:case o.ERROR:return;case o.NAMED_EXPRESSION:n&&r.push(new tT(e.expressionName));return;case o.CELL_REFERENCE:n&&r.push(new tS(e.reference));return;case o.CELL_RANGE:n&&e.start.sheet===e.end.sheet&&r.push(new tv(e.start,e.end));return;case o.COLUMN_RANGE:n&&e.start.sheet===e.end.sheet&&r.push(new tR(e.start,e.end));return;case o.ROW_RANGE:n&&e.start.sheet===e.end.sheet&&r.push(new tE(e.start,e.end));return;case o.PERCENT_OP:case o.PLUS_UNARY_OP:case o.MINUS_UNARY_OP:return void ty(e.value,t,r,!0);case o.CONCATENATE_OP:case o.EQUALS_OP:case o.NOT_EQUAL_OP:case o.LESS_THAN_OP:case o.GREATER_THAN_OP:case o.LESS_THAN_OR_EQUAL_OP:case o.GREATER_THAN_OR_EQUAL_OP:case o.MINUS_OP:case o.PLUS_OP:case o.TIMES_OP:case o.DIV_OP:case o.POWER_OP:ty(e.left,t,r,!0),ty(e.right,t,r,!0);return;case o.PARENTHESIS:ty(e.expression,t,r,n);return;case o.FUNCTION_CALL:{let n=!t.doesFunctionNeedArgumentToBeComputed(e.procedureName);e.args.forEach(e=>ty(e,t,r,n));return}}},tw=(e,t)=>{let r=[];return ty(e,t,r,!0),r};class tS{constructor(e){this.dependency=e}absolutize(e){return this.dependency.toSimpleCellAddress(e)}}class tv{constructor(e,t){this.start=e,this.end=t}absolutize(e){return new r8(this.start.toSimpleCellAddress(e),this.end.toSimpleCellAddress(e))}}class tR{constructor(e,t){this.start=e,this.end=t}absolutize(e){let t=this.start.toSimpleColumnAddress(e),r=this.end.toSimpleColumnAddress(e);return new ne(t.sheet,t.col,r.col)}}class tE{constructor(e,t){this.start=e,this.end=t}absolutize(e){let t=this.start.toSimpleRowAddress(e),r=this.end.toSimpleRowAddress(e);return new nt(t.sheet,t.row,r.row)}}class tT{constructor(e){this.name=e}absolutize(e){return this}}let tA=(e,t)=>e.map(e=>e.absolutize(t)),tM=Symbol("Empty value");function tI(e){return e instanceof tx?e.val:e}class tx{constructor(e,t){this.val=e,this.format=t}fromNumber(e){return new this.constructor(e)}}function tN(e,t){if("number"==typeof e)return t;{let r=e.fromNumber(t);return r.format=e.format,r}}class tO extends tx{getDetailedType(){return s.NUMBER_DATE}}class tk extends tx{getDetailedType(){return s.NUMBER_CURRENCY}}class tH extends tx{getDetailedType(){return s.NUMBER_TIME}}class t_ extends tx{getDetailedType(){return s.NUMBER_DATETIME}}class tL extends tx{getDetailedType(){return s.NUMBER_PERCENT}}function tP(e){return"number"==typeof e||e instanceof tx}function tD(e){return e instanceof tx?{type:e.getDetailedType(),format:e.format}:{type:s.NUMBER_RAW}}(I=s||(s={})).NUMBER_RAW="NUMBER_RAW",I.NUMBER_DATE="NUMBER_DATE",I.NUMBER_TIME="NUMBER_TIME",I.NUMBER_DATETIME="NUMBER_DATETIME",I.NUMBER_CURRENCY="NUMBER_CURRENCY",I.NUMBER_PERCENT="NUMBER_PERCENT";class tF{constructor(e,t,r,n){this._data=e,this.range=t,this.dependencyGraph=r,this._hasOnlyNumbers=n,this.size=void 0===e?new nR(t.effectiveWidth(r),t.effectiveHeight(r)):new nR(e[0].length,e.length)}get data(){return this.ensureThatComputed(),this._data}static fromRange(e,t,r){return new tF(e,t,r,!0)}static onlyNumbers(e){return new tF(e,void 0,void 0,!0)}static onlyValues(e){return new tF(e,void 0,void 0,void 0)}static onlyRange(e,t){return new tF(void 0,e,t,void 0)}static fromScalar(e){return new tF([[e]],void 0,void 0,void 0)}isAdHoc(){return void 0===this.range}width(){return this.size.width}height(){return this.size.height}valuesFromTopLeftCorner(){this.ensureThatComputed();let e=[];for(let t=0;t<this._data.length;t++)for(let r=0;r<this._data[0].length;r++)e.push(this._data[t][r]);return e}*effectiveAddressesFromData(e){for(let t=0;t<this.data.length;++t){let r=this.data[t];for(let n=0;n<r.length;++n)yield r0(e.sheet,e.col+n,e.row+t)}}*entriesFromTopLeftCorner(e){this.ensureThatComputed();for(let t=0;t<this.size.height;++t)for(let r=0;r<this.size.width;++r)yield[this._data[t][r],r0(e.sheet,e.col+r,e.row+t)]}*iterateValuesFromTopLeftCorner(){yield*this.valuesFromTopLeftCorner()}numberOfElements(){return this.size.width*this.size.height}hasOnlyNumbers(){if(void 0===this._hasOnlyNumbers){for(let e of(this._hasOnlyNumbers=!0,this.data))for(let t of e)if("number"!=typeof t)return this._hasOnlyNumbers=!1,!1}return this._hasOnlyNumbers}rawNumbers(){return this._data}rawData(){var e;return this.ensureThatComputed(),null!=(e=this._data)?e:[]}sameDimensionsAs(e){return this.width()===e.width()&&this.height()===e.height()}ensureThatComputed(){void 0===this._data&&(this._hasOnlyNumbers=!0,this._data=this.range.addressesArrayMap(this.dependencyGraph,e=>{let t=this.dependencyGraph.getCellValue(e);return t instanceof tF?(this._hasOnlyNumbers=!1,new rK(d.VALUE,ej.ScalarExpected)):(tP(t)||(this._hasOnlyNumbers=!1),t)}))}}class tB{constructor(){this.changes=new Map}static empty(){return new tB}addAll(e){for(let t of e.changes.values())this.add(t.address,t);return this}addChange(e,t,r){this.addInterpreterValue(e,t,r)}exportChanges(e){let t=[];return this.changes.forEach(r=>{let n=e.exportChange(r);Array.isArray(n)?t=t.concat(n):t.push(n)}),t}getChanges(){return Array.from(this.changes.values())}isEmpty(){return 0===this.changes.size}add(e,t){let r=t.value;if(r instanceof tF)for(let t of r.effectiveAddressesFromData(e))this.changes.delete(r3(t));this.changes.set(r3(e),t)}addInterpreterValue(e,t,r){this.add(t,{address:t,value:e,oldValue:r})}}class tV{constructor(e,t,r,n){this.displayName=e,this.address=t,this.added=r,this.options=n}normalizeExpressionName(){return this.displayName.toLowerCase()}copy(){return new tV(this.displayName,this.address,this.added,this.options)}}class tU{constructor(){this.mapping=new Map}has(e){return this.mapping.has(this.normalizeExpressionName(e))}isNameAvailable(e){let t=this.normalizeExpressionName(e),r=this.mapping.get(t);return!(r&&r.added)}add(e){this.mapping.set(e.normalizeExpressionName(),e)}get(e){return this.mapping.get(this.normalizeExpressionName(e))}getExisting(e){let t=this.mapping.get(this.normalizeExpressionName(e));return t&&t.added?t:void 0}remove(e){let t=this.normalizeExpressionName(e),r=this.mapping.get(t);r&&(r.added=!1)}getAllNamedExpressions(){return Array.from(this.mapping.values()).filter(e=>e.added)}normalizeExpressionName(e){return e.toLowerCase()}}class tz{constructor(){this.mapping=new Map}add(e){this.mapping.set(this.normalizeExpressionName(e.displayName),e)}get(e){return this.mapping.get(this.normalizeExpressionName(e))}has(e){return this.mapping.has(this.normalizeExpressionName(e))}getAllNamedExpressions(){return Array.from(this.mapping.values()).filter(e=>e.added)}isNameAvailable(e){let t=this.normalizeExpressionName(e);return!this.mapping.has(t)}remove(e){let t=this.normalizeExpressionName(e);this.mapping.get(t)&&this.mapping.delete(t)}normalizeExpressionName(e){return e.toLowerCase()}}class tW{constructor(){this.nextNamedExpressionRow=0,this.workbookStore=new tU,this.worksheetStores=new Map,this.addressCache=new Map}isNameAvailable(e,t){var r,n;return void 0===t?this.workbookStore.isNameAvailable(e):null==(n=null==(r=this.worksheetStore(t))?void 0:r.isNameAvailable(e))||n}namedExpressionInAddress(e){let t=this.addressCache.get(e);return t&&t.added?t:void 0}namedExpressionForScope(e,t){var r;return void 0===t?this.workbookStore.getExisting(e):null==(r=this.worksheetStore(t))?void 0:r.get(e)}nearestNamedExpression(e,t){var r,n;return null!=(n=null==(r=this.worksheetStore(t))?void 0:r.get(e))?n:this.workbookStore.getExisting(e)}isExpressionInScope(e,t){var r,n;return null!=(n=null==(r=this.worksheetStore(t))?void 0:r.has(e))&&n}isNameValid(e){let t=RegExp(`^${ec}$`),r=RegExp(`^${em}$`),n=RegExp(`^${eb}$`);return!(t.test(e)||r.test(e))&&n.test(e)}addNamedExpression(e,t,r){let n=void 0===t?this.workbookStore:this.worksheetStoreOrCreate(t),o=n.get(e);return void 0!==o?(o.added=!0,o.displayName=e,o.options=r):(o=new tV(e,this.nextAddress(),!0,r),n.add(o)),this.addressCache.set(o.address.row,o),o}restoreNamedExpression(e,t){let r=void 0===t?this.workbookStore:this.worksheetStoreOrCreate(t);return e.added=!0,r.add(e),this.addressCache.set(e.address.row,e),e}namedExpressionOrPlaceholder(e,t){var r;return null!=(r=this.worksheetStoreOrCreate(t).get(e))?r:this.workbookNamedExpressionOrPlaceholder(e)}workbookNamedExpressionOrPlaceholder(e){let t=this.workbookStore.get(e);return void 0===t&&(t=new tV(e,this.nextAddress(),!1),this.workbookStore.add(t)),t}remove(e,t){let r,n=null==(r=void 0===t?this.workbookStore:this.worksheetStore(t))?void 0:r.get(e);if(void 0===r||void 0===n||!n.added)throw Error("Named expression does not exist");r.remove(e),r instanceof tz&&0===r.mapping.size&&this.worksheetStores.delete(t),this.addressCache.delete(n.address.row)}getAllNamedExpressionsNamesInScope(e){return this.getAllNamedExpressions().filter(({scope:t})=>t===e).map(e=>e.expression.displayName)}getAllNamedExpressionsNames(){return this.getAllNamedExpressions().map(e=>e.expression.displayName)}getAllNamedExpressions(){let e=[];return this.workbookStore.getAllNamedExpressions().forEach(t=>{e.push({expression:t,scope:void 0})}),this.worksheetStores.forEach((t,r)=>{t.getAllNamedExpressions().forEach(t=>{e.push({expression:t,scope:r})})}),e}getAllNamedExpressionsForScope(e){var t,r;return void 0===e?this.workbookStore.getAllNamedExpressions():null!=(r=null==(t=this.worksheetStores.get(e))?void 0:t.getAllNamedExpressions())?r:[]}worksheetStoreOrCreate(e){let t=this.worksheetStores.get(e);return t||(t=new tz,this.worksheetStores.set(e,t)),t}worksheetStore(e){return this.worksheetStores.get(e)}nextAddress(){return r0(tW.SHEET_FOR_WORKBOOK_EXPRESSIONS,0,this.nextNamedExpressionRow++)}}tW.SHEET_FOR_WORKBOOK_EXPRESSIONS=-1;let tG=e=>{switch(e.type){case o.EMPTY:case o.NUMBER:case o.STRING:case o.ERROR:case o.ERROR_WITH_RAW_INPUT:return!1;case o.CELL_REFERENCE:return!e.reference.isAbsolute();case o.CELL_RANGE:case o.COLUMN_RANGE:case o.ROW_RANGE:return!e.start.isAbsolute();case o.NAMED_EXPRESSION:return!1;case o.PERCENT_OP:case o.PLUS_UNARY_OP:case o.MINUS_UNARY_OP:return tG(e.value);case o.CONCATENATE_OP:case o.EQUALS_OP:case o.NOT_EQUAL_OP:case o.LESS_THAN_OP:case o.GREATER_THAN_OP:case o.LESS_THAN_OR_EQUAL_OP:case o.GREATER_THAN_OR_EQUAL_OP:case o.MINUS_OP:case o.PLUS_OP:case o.TIMES_OP:case o.DIV_OP:case o.POWER_OP:return tG(e.left)||tG(e.right);case o.PARENTHESIS:return tG(e.expression);case o.FUNCTION_CALL:return e.args.some(e=>tG(e));case o.ARRAY:return e.args.some(e=>e.some(e=>tG(e)))}};class t${constructor(e,t,r){if(this.sheet=e,this.rowStart=t,this.rowEnd=r,t<0)throw Error("Starting row cant be less than 0");if(r<t)throw Error("Row span cant end before start")}get numberOfRows(){return this.rowEnd-this.rowStart+1}get start(){return this.rowStart}get end(){return this.rowEnd}static fromNumberOfRows(e,t,r){return new t$(e,t,t+r-1)}static fromRowStartAndEnd(e,t,r){return new t$(e,t,r)}*rows(){for(let e=this.rowStart;e<=this.rowEnd;++e)yield e}intersect(e){if(this.sheet!==e.sheet)throw Error("Can't intersect spans from different sheets");let t=Math.max(this.rowStart,e.rowStart),r=Math.min(this.rowEnd,e.rowEnd);return t>r?null:new t$(this.sheet,t,r)}firstRow(){return new t$(this.sheet,this.rowStart,this.rowStart)}}class tY{constructor(e,t,r){if(this.sheet=e,this.columnStart=t,this.columnEnd=r,t<0)throw Error("Starting column cant be less than 0");if(r<t)throw Error("Column span cant end before start")}get numberOfColumns(){return this.columnEnd-this.columnStart+1}get start(){return this.columnStart}get end(){return this.columnEnd}static fromNumberOfColumns(e,t,r){return new tY(e,t,t+r-1)}static fromColumnStartAndEnd(e,t,r){return new tY(e,t,r)}*columns(){for(let e=this.columnStart;e<=this.columnEnd;++e)yield e}intersect(e){if(this.sheet!==e.sheet)throw Error("Can't intersect spans from different sheets");let t=Math.max(this.columnStart,e.columnStart),r=Math.min(this.columnEnd,e.columnEnd);return t>r?null:new tY(this.sheet,t,r)}firstColumn(){return new tY(this.sheet,this.columnStart,this.columnStart)}}(x=a||(a={})).BUILD_ENGINE_TOTAL="BUILD_ENGINE_TOTAL",x.PARSER="PARSER",x.GRAPH_BUILD="GRAPH_BUILD",x.COLLECT_DEPENDENCIES="COLLECT_DEPENDENCIES",x.PROCESS_DEPENDENCIES="PROCESS_DEPENDENCIES",x.TOP_SORT="TOP_SORT",x.BUILD_COLUMN_INDEX="BUILD_COLUMN_INDEX",x.EVALUATION="EVALUATION",x.VLOOKUP="VLOOKUP",x.TRANSFORM_ASTS="TRANSFORM_ASTS",x.TRANSFORM_ASTS_POSTPONED="TRANSFORM_ASTS_POSTPONED",x.ADJUSTING_ADDRESS_MAPPING="ADJUSTING_ADDRESS_MAPPING",x.ADJUSTING_ARRAY_MAPPING="ADJUSTING_ARRAY_MAPPING",x.ADJUSTING_RANGES="ADJUSTING_RANGES",x.ADJUSTING_GRAPH="ADJUSTING_GRAPH",x.CRITERION_FUNCTION_FULL_CACHE_USED="CRITERION_FUNCTION_FULL_CACHE_USED",x.CRITERION_FUNCTION_PARTIAL_CACHE_USED="CRITERION_FUNCTION_PARTIAL_CACHE_USED";class tj{constructor(){this.stats=new Map([[a.CRITERION_FUNCTION_FULL_CACHE_USED,0],[a.CRITERION_FUNCTION_PARTIAL_CACHE_USED,0]]),this.startTimes=new Map}incrementCriterionFunctionFullCacheUsed(){var e;let t=(null!=(e=this.stats.get(a.CRITERION_FUNCTION_FULL_CACHE_USED))?e:0)+1;this.stats.set(a.CRITERION_FUNCTION_FULL_CACHE_USED,t)}incrementCriterionFunctionPartialCacheUsed(){var e;let t=(null!=(e=this.stats.get(a.CRITERION_FUNCTION_PARTIAL_CACHE_USED))?e:0)+1;this.stats.set(a.CRITERION_FUNCTION_PARTIAL_CACHE_USED,t)}reset(){this.stats.clear(),this.startTimes.clear(),this.stats.set(a.CRITERION_FUNCTION_FULL_CACHE_USED,0),this.stats.set(a.CRITERION_FUNCTION_PARTIAL_CACHE_USED,0)}start(e){if(this.startTimes.get(e))throw Error(`Statistics ${e} already started`);this.startTimes.set(e,Date.now())}end(e){var t;let r=Date.now(),n=this.startTimes.get(e);if(n){let o=null!=(t=this.stats.get(e))?t:0;o+=r-n,this.stats.set(e,o),this.startTimes.delete(e)}else throw Error(`Statistics ${e} not started`)}measure(e,t){this.start(e);let r=t();return this.end(e),r}snapshot(){return new Map(this.stats)}}class tq extends tj{incrementCriterionFunctionFullCacheUsed(){}incrementCriterionFunctionPartialCacheUsed(){}start(e){}end(e){}}class tK extends Error{constructor(e){super(`There's no sheet with id = ${e}`)}}class tX extends Error{constructor(e){super(`There's no sheet with name '${e}'`)}}class tQ extends Error{constructor(e){super(`Sheet with name ${e} already exists`)}}class tZ extends Error{constructor(){super("Sheet size limit exceeded")}}class tJ extends Error{constructor(){super("This is not a formula")}}class t0 extends Error{constructor(e){super(`Address (row = ${e.row}, col = ${e.col}) is invalid`)}}class t1 extends Error{constructor(e){super(`Invalid arguments, expected ${e}`)}}class t2 extends Error{constructor(e,t){super(`Sheets ${e} and ${t} are not equal.`)}}class t3 extends Error{constructor(e){super(`Name of Named Expression '${e}' is already present`)}}class t6 extends Error{constructor(e){super(`Name of Named Expression '${e}' is invalid`)}}class t5 extends Error{constructor(e){super(`Named Expression '${e}' does not exist`)}}class t4 extends Error{constructor(){super("There is no operation to undo")}}class t9 extends Error{constructor(){super("There is no operation to redo")}}class t7 extends Error{constructor(){super("There is nothing to paste")}}function t8(e,t){switch(typeof t){case"function":case"symbol":return t.toString();case"bigint":return"BigInt("+t.toString()+")";default:if(t instanceof RegExp)return"RegExp("+t.toString()+")";return t}}class re extends Error{constructor(e){super(`Unable to parse value: ${JSON.stringify(e,t8,4)}`)}}class rt extends Error{constructor(e,t){super(`Expected value of type: ${e} for config parameter: ${t}`)}}class rr extends Error{constructor(e){super(`Config parameter ${e} cannot be empty.`)}}class rn extends Error{constructor(e,t){super(`Config parameter ${e} should be at least ${t}`)}}class ro extends Error{constructor(e,t){super(`Config parameter ${e} should be at most ${t}`)}}class ri extends Error{constructor(e,t){super(`Expected one of ${e} for config parameter: ${t}`)}}class rs extends Error{constructor(){super("Computations are suspended")}}class ra extends Error{constructor(e){super(`Translation for ${e} is missing in the translation package you're using.`)}}class rl extends Error{constructor(e){super(`Cannot register translation for function with id: ${e}`)}}class rh extends Error{constructor(){super("Language not registered.")}}class rd extends Error{constructor(){super("Language already registered.")}}class ru extends Error{static functionNotDeclaredInPlugin(e,t){return new ru(`Function with id ${e} not declared in plugin ${t}`)}static functionMethodNotFound(e,t){return new ru(`Function method ${e} not found in plugin ${t}`)}}class rc extends Error{static cannotRegisterFunctionWithId(e){return new rc(`Cannot register function with id ${e}`)}static cannotUnregisterFunctionWithId(e){return new rc(`Cannot unregister function with id ${e}`)}static cannotUnregisterProtectedPlugin(){return new rc("Cannot unregister protected plugin")}}class rg extends Error{constructor(){super("Cannot perform this operation, source location has an array inside.")}}class rp extends Error{constructor(){super("Cannot perform this operation, target location has an array inside.")}}class rm extends Error{constructor(){super("Relative addresses not allowed in named expressions.")}}class rf extends Error{constructor(e,t){super(`Alias id ${e} in plugin ${t} already defined as a function or alias.`)}}class rb{constructor(e){this.policy=e,this.mapping=new Map}getCell(e,t={}){let r=this.mapping.get(e.sheet);if(!r){if(t.throwIfSheetNotExists)throw new tK(e.sheet);return}let n=r.getCell(e);if(!n&&t.throwIfCellNotExists)throw Error("Vertex for address missing in AddressMapping");return n}getCellOrThrow(e){let t=this.mapping.get(e.sheet);if(!t)throw new tK(e.sheet);let r=t.getCell(e);if(!r)throw Error("Vertex for address missing in AddressMapping");return r}getStrategyForSheetOrThrow(e){let t=this.mapping.get(e);if(void 0===t)throw new tK(e);return t}addSheetWithStrategy(e,t,r={throwIfSheetAlreadyExists:!0}){let n=this.mapping.get(e);if(n){if(r.throwIfSheetAlreadyExists)throw Error("Sheet already added");return n}return this.mapping.set(e,t),t}addSheetOrChangeStrategy(e,t){let r=this.createStrategyBasedOnBoundaries(t),n=this.mapping.get(e);return n?r instanceof rG?n:(this.moveStrategyContent(n,r,e),this.mapping.set(e,r),r):(this.mapping.set(e,r),r)}moveStrategyContent(e,t,r){for(let[n,o]of e.getEntries(r))t.setCell(n,o)}addSheetAndSetStrategyBasedOnBoundaries(e,t,r={throwIfSheetAlreadyExists:!0}){this.addSheetWithStrategy(e,this.createStrategyBasedOnBoundaries(t),r)}createStrategyBasedOnBoundaries(e){let{height:t,width:r,fill:n}=e;return new(this.policy.call(n))(r,t)}addSheetStrategyPlaceholderIfNotExists(e){this.mapping.has(e)||this.mapping.set(e,new rG(0,0))}removeSheetIfExists(e){return this.mapping.delete(e)}getCellValue(e){let t=this.getCell(e);return void 0===t?tM:t instanceof rT?t.getArrayCellValue(e):t.getCellValue()}getRawValue(e){let t=this.getCell(e);return t instanceof rU?t.getValues().rawValue:t instanceof rT?t.getArrayCellRawValue(e):null}setCell(e,t){let r=this.mapping.get(e.sheet);if(!r)throw Error("Sheet not initialized");r.setCell(e,t)}moveCell(e,t){let r=this.mapping.get(e.sheet);if(!r)throw Error("Sheet not initialized.");if(this.has(t))throw Error("Cannot move cell. Destination already occupied.");let n=r.getCell(e);if(void 0===n)throw Error("Cannot move cell. No cell with such address.");this.setCell(t,n),this.removeCell(e)}removeCell(e){let t=this.mapping.get(e.sheet);if(!t)throw Error("Sheet not initialized");t.removeCell(e)}has(e){let t=this.mapping.get(e.sheet);return void 0!==t&&t.has(e)}getSheetHeight(e){return this.getStrategyForSheetOrThrow(e).getHeight()}getSheetWidth(e){return this.getStrategyForSheetOrThrow(e).getWidth()}addRows(e,t,r){this.getStrategyForSheetOrThrow(e).addRows(t,r)}removeRows(e){this.getStrategyForSheetOrThrow(e.sheet).removeRows(e)}addColumns(e,t,r){this.getStrategyForSheetOrThrow(e).addColumns(t,r)}removeColumns(e){this.getStrategyForSheetOrThrow(e.sheet).removeColumns(e)}*verticesFromRowsSpan(e){yield*this.mapping.get(e.sheet).verticesFromRowsSpan(e)}*verticesFromColumnsSpan(e){yield*this.mapping.get(e.sheet).verticesFromColumnsSpan(e)}*entriesFromRowsSpan(e){let t=this.getStrategyForSheetOrThrow(e.sheet);yield*t.entriesFromRowsSpan(e)}*entriesFromColumnsSpan(e){let t=this.getStrategyForSheetOrThrow(e.sheet);yield*t.entriesFromColumnsSpan(e)}*entries(){for(let[e,t]of this.mapping.entries())yield*t.getEntries(e)}*sheetEntries(e){let t=this.getStrategyForSheetOrThrow(e);yield*t.getEntries(e)}hasAnyEntries(e){return!this.sheetEntries(e).next().done}}class rC{constructor(){this.arrayMapping=new Map}getArray(e){let t=this.getArrayByCorner(e.start);if(null==t?void 0:t.getRange().sameAs(e))return t}getArrayByCorner(e){return this.arrayMapping.get(r3(e))}setArray(e,t){this.arrayMapping.set(r3(e.start),t)}removeArray(e){"string"==typeof e?this.arrayMapping.delete(e):this.arrayMapping.delete(r3(e.start))}count(){return this.arrayMapping.size}*arraysInRows(e){for(let[t,r]of this.arrayMapping.entries())r.spansThroughSheetRows(e.sheet,e.rowStart,e.rowEnd)&&(yield[t,r])}*arraysInCols(e){for(let[t,r]of this.arrayMapping.entries())r.spansThroughSheetColumn(e.sheet,e.columnStart,e.columnEnd)&&(yield[t,r])}isFormulaArrayInRow(e,t){for(let r of this.arrayMapping.values())if(r.spansThroughSheetRows(e,t))return!0;return!1}isFormulaArrayInAllRows(e){let t=!0;for(let r of e.rows())this.isFormulaArrayInRow(e.sheet,r)||(t=!1);return t}isFormulaArrayInColumn(e,t){for(let r of this.arrayMapping.values())if(r.spansThroughSheetColumn(e,t))return!0;return!1}isFormulaArrayInAllColumns(e){let t=!0;for(let r of e.columns())this.isFormulaArrayInColumn(e.sheet,r)||(t=!1);return t}isFormulaArrayInRange(e){for(let t of this.arrayMapping.values())if(t.getRange().doesOverlap(e))return!0;return!1}isFormulaArrayAtAddress(e){for(let t of this.arrayMapping.values())if(t.getRange().addressInRange(e))return!0;return!1}moveArrayVerticesAfterRowByRows(e,t,r){this.updateArrayVerticesInSheet(e,(e,n)=>{let o=n.getRange();return t<=o.start.row?[o.shifted(0,r),n]:void 0})}moveArrayVerticesAfterColumnByColumns(e,t,r){this.updateArrayVerticesInSheet(e,(e,n)=>{let o=n.getRange();return t<=o.start.col?[o.shifted(r,0),n]:void 0})}updateArrayVerticesInSheet(e,t){let r=[];for(let[n,o]of this.arrayMapping.entries()){if(o.sheet!==e)continue;let i=t(n,o);void 0!==i&&(this.removeArray(n),r.push(i))}r.forEach(([e,t])=>{this.setArray(e,t)})}}class ry{constructor(e){this.size=e}width(){return this.size.width}height(){return this.size.height}get(e,t){throw Error("Array not computed yet.")}simpleRangeValue(){throw Error("Array not computed yet.")}}class rw{constructor(e){if(this.size=new nR(e.length>0?e[0].length:0,e.length),this.array=e,this.size.width<=0||this.size.height<=0)throw Error("Incorrect array size")}static fromInterpreterValue(e){return new rw(e instanceof tF?e.data:[[e]])}simpleRangeValue(){return tF.onlyValues(this.array)}addRows(e,t){this.array.splice(e,0,...this.nullArrays(t,this.width())),this.size.height+=t}addColumns(e,t){for(let r=0;r<this.height();r++)this.array[r].splice(e,0,...Array(t).fill(tM));this.size.width+=t}removeRows(e,t){if(this.outOfBound(0,e)||this.outOfBound(0,t))throw Error("Array index out of bound");let r=t-e+1;this.array.splice(e,r),this.size.height-=r}removeColumns(e,t){if(this.outOfBound(e,0)||this.outOfBound(t,0))throw Error("Array index out of bound");let r=t-e+1;for(let t of this.array)t.splice(e,r);this.size.width-=r}nullArrays(e,t){let r=[];for(let n=0;n<e;++n)r.push(Array(t).fill(tM));return r}get(e,t){if(this.outOfBound(e,t))throw Error("Array index out of bound");return this.array[t][e]}set(e,t,r){if(this.outOfBound(e,t))throw Error("Array index out of bound");this.array[t][e]=r}width(){return this.size.width}height(){return this.size.height}raw(){return this.array}resize(e){if(this.height()<e.height&&isFinite(e.height)&&this.addRows(this.height(),e.height-this.height()),this.height()>e.height||(this.width()<e.width&&isFinite(e.width)&&this.addColumns(this.width(),e.width-this.width()),this.width()>e.width))throw Error("Resizing to smaller array")}outOfBound(e,t){return e<0||t<0||t>this.size.height-1||e>this.size.width-1}}class rS{constructor(e,t){this.error=e,this.size=t}get(e,t){return this.error}width(){return this.size.width}height(){return this.size.height}simpleRangeValue(){return this.error}}class rv{}class rR extends rv{constructor(){super()}}class rE extends rR{constructor(e,t,r){super(),this.formula=e,this.cellAddress=t,this.version=r}get width(){return 1}get height(){return 1}static fromAst(e,t,r,n){return r.isScalar()?new rA(e,t,n):new rT(e,t,r,n)}getFormula(e){return this.ensureRecentData(e),this.formula}ensureRecentData(e){if(this.version!=e.version()){let[t,r,n]=e.applyTransformations(this.formula,this.cellAddress,this.version);this.formula=t,this.cellAddress=r,this.version=n}}getAddress(e){return this.ensureRecentData(e),this.cellAddress}}class rT extends rE{constructor(e,t,r,n=0){super(e,t,n),r.isRef?this.array=new rS(new rK(d.REF,ej.NoSpaceForArrayResult),nR.error()):this.array=new ry(r)}get width(){return this.array.width()}get height(){return this.array.height()}get sheet(){return this.cellAddress.sheet}get leftCorner(){return this.cellAddress}setCellValue(e){if(e instanceof rK)return this.setErrorValue(e),e;let t=rw.fromInterpreterValue(e);return t.resize(this.array.size),this.array=t,e}getCellValue(){if(this.array instanceof ry)throw Error("Array not computed yet.");return this.array.simpleRangeValue()}valueOrUndef(){if(!(this.array instanceof ry))return this.array.simpleRangeValue()}getArrayCellValue(e){let t=e.col-this.cellAddress.col,r=e.row-this.cellAddress.row;try{return this.array.get(t,r)}catch(e){return new rK(d.REF)}}getArrayCellRawValue(e){let t=this.getArrayCellValue(e);if(!(t instanceof rK)&&t!==tM)return tI(t)}setArrayCellValue(e,t){let r=e.col-this.cellAddress.col,n=e.row-this.cellAddress.row;this.array instanceof rw&&this.array.set(r,n,t)}setNoSpace(){return this.array=new rS(new rK(d.SPILL,ej.NoSpaceForArrayResult),nR.error()),this.getCellValue()}getRange(){return r8.spanFrom(this.cellAddress,this.width,this.height)}getRangeOrUndef(){return r8.spanFromOrUndef(this.cellAddress,this.width,this.height)}setAddress(e){this.cellAddress=e}setFormula(e){this.formula=e}spansThroughSheetRows(e,t,r=t){return this.cellAddress.sheet===e&&this.cellAddress.row<=r&&t<this.cellAddress.row+this.height}spansThroughSheetColumn(e,t,r=t){return this.cellAddress.sheet===e&&this.cellAddress.col<=r&&t<this.cellAddress.col+this.width}isComputed(){return!(this.array instanceof ry)}columnsFromArray(){return tY.fromNumberOfColumns(this.cellAddress.sheet,this.cellAddress.col,this.width)}rowsFromArray(){return t$.fromNumberOfRows(this.cellAddress.sheet,this.cellAddress.row,this.height)}ensureRecentData(e){}isLeftCorner(e){return r4(this.cellAddress,e)}setErrorValue(e){this.array=new rS(e,this.array.size)}}class rA extends rE{constructor(e,t,r){super(e,t,r)}valueOrUndef(){return this.cachedCellValue}setCellValue(e){return this.cachedCellValue=e,this.cachedCellValue}getCellValue(){if(void 0!==this.cachedCellValue)return this.cachedCellValue;throw Error("Value of the formula cell is not computed.")}isComputed(){return void 0!==this.cachedCellValue}}class rM extends rv{constructor(e){super(),this.range=e,this.functionCache=new Map,this.criterionFunctionCache=new Map,this.dependentCacheRanges=new Set,this.bruteForce=!1}get start(){return this.range.start}get end(){return this.range.end}get sheet(){return this.range.start.sheet}getFunctionValue(e){return this.functionCache.get(e)}setFunctionValue(e,t){this.functionCache.set(e,t)}getCriterionFunctionValue(e,t){var r;return null==(r=this.getCriterionFunctionValues(e).get(t))?void 0:r[0]}getCriterionFunctionValues(e){var t;return null!=(t=this.criterionFunctionCache.get(e))?t:new Map}setCriterionFunctionValues(e,t){this.criterionFunctionCache.set(e,t)}addDependentCacheRange(e){e!==this&&this.dependentCacheRanges.add(e)}clearCache(){this.functionCache.clear(),this.criterionFunctionCache.clear(),this.dependentCacheRanges.forEach(e=>e.criterionFunctionCache.clear()),this.dependentCacheRanges.clear()}}let rI=(e,t,r,n,o)=>{let i,s;if(t instanceof rM){let e=t.range.intersectionWith(r);return void 0!==e?Array.from(e.addresses(o)):[]}return t instanceof rE?(i=t.getFormula(n),s=t.getAddress(n),tw(i,e).filter(e=>e instanceof tS).map(e=>e.dependency.toSimpleCellAddress(s)).filter(e=>r.addressInRange(e))):[]};(N=l||(l={}))[N.ON_STACK=0]="ON_STACK",N[N.PROCESSED=1]="PROCESSED",N[N.POPPED=2]="POPPED";class rx{constructor(e=[],t=[]){this.nodesSparseArray=e,this.edgesSparseArray=t,this.entranceTime=[],this.low=[],this.parent=[],this.inSCC=[],this.nodeStatus=[],this.order=[],this.sccNonSingletons=[],this.timeCounter=0}getTopSortedWithSccSubgraphFrom(e,t,r){let n=e.reverse();return n.forEach(e=>this.runDFS(e)),this.postprocess(n,r,t)}getAdjacentNodeIds(e){return this.edgesSparseArray[e].filter(e=>void 0!==e&&this.nodesSparseArray[e])}runDFS(e){if(void 0!==this.nodeStatus[e])return;this.nodeStatus[e]=l.ON_STACK;let t=[e],r=[];for(;t.length>0;){let e=t[t.length-1];switch(this.nodeStatus[e]){case l.ON_STACK:this.handleOnStack(e,r,t);break;case l.PROCESSED:this.handleProcessed(e,r,t);break;case l.POPPED:t.pop()}}}handleOnStack(e,t,r){this.entranceTime[e]=this.timeCounter,this.low[e]=this.timeCounter,this.timeCounter++,t.push(e),this.getAdjacentNodeIds(e).forEach(t=>{void 0===this.entranceTime[t]&&(r.push(t),this.parent[t]=e,this.nodeStatus[t]=l.ON_STACK)}),this.nodeStatus[e]=l.PROCESSED}handleProcessed(e,t,r){let n=this.entranceTime[e];if(this.getAdjacentNodeIds(e).forEach(t=>{this.inSCC[t]||(n=this.parent[t]===e?Math.min(n,this.low[t]):Math.min(n,this.entranceTime[t]))}),this.low[e]=n,n===this.entranceTime[e]){let r=[];do r.push(t[t.length-1]),t.pop();while(r[r.length-1]!==e);r.forEach(e=>{this.inSCC[e]=!0}),this.order.push(...r),r.length>1&&r.forEach(e=>{this.sccNonSingletons[e]=!0})}r.pop(),this.nodeStatus[e]=l.POPPED}postprocess(e,t,r){let n=[];e.forEach(e=>{n[e]=!0});let o=[],i=[];return this.order.reverse(),this.order.forEach(e=>{let s=this.getAdjacentNodeIds(e);this.sccNonSingletons[e]||s.includes(e)?(i.push(this.nodesSparseArray[e]),t(this.nodesSparseArray[e]),s.forEach(e=>n[e]=!0)):(o.push(this.nodesSparseArray[e]),n[e]&&r(this.nodesSparseArray[e])&&s.forEach(e=>n[e]=!0))}),{sorted:o,cycled:i}}}class rN{constructor(e,t){this.rawValue=e,this.processFn=t,this.processedValue=null}getProcessedValue(){return null===this.processedValue&&(this.processedValue=this.processFn(this.rawValue)),this.processedValue}markAsModified(){this.processedValue=null}}class rO{constructor(e){this.dependencyQuery=e,this.nodesSparseArray=[],this.edgesSparseArray=[],this.dirtyAndVolatileNodeIds=new rN({dirty:[],volatile:[]},e=>this.processDirtyAndVolatileNodeIds(e)),this.infiniteRangeIds=new Set,this.changingWithStructureNodeIds=[],this.nextId=0}getNodes(){return this.nodesSparseArray.filter(e=>void 0!==e)}hasNode(e){return null!=e.idInGraph}existsEdge(e,t){let r=e.idInGraph,n=t.idInGraph;return void 0!==r&&void 0!==n&&this.edgesSparseArray[r].includes(n)}adjacentNodes(e){let t=e.idInGraph;if(void 0===t)throw this.missingNodeError(e);return new Set(this.edgesSparseArray[t].filter(e=>void 0!==e).map(e=>this.nodesSparseArray[e]).filter(e=>void 0!==e))}adjacentNodesCount(e){let t=e.idInGraph;if(void 0===t)throw this.missingNodeError(e);return this.fixEdgesArrayForNode(t).length}addNodeIfNotExists(e){let t=e.idInGraph;if(void 0!==t)return t;let r=this.nextId;return this.nextId++,this.nodesSparseArray[r]=e,this.edgesSparseArray[r]=[],e.idInGraph=r,r}addEdge(e,t){let r=this.getNodeIdIfNotNumber(e),n=this.getNodeIdIfNotNumber(t);if(void 0===r)throw this.missingNodeError(e);if(void 0===n)throw this.missingNodeError(t);this.edgesSparseArray[r].includes(n)||this.edgesSparseArray[r].push(n)}removeNode(e){let t=e.idInGraph;if(void 0===t)throw this.missingNodeError(e);this.edgesSparseArray[t].length>0&&(this.edgesSparseArray[t].forEach(e=>this.dirtyAndVolatileNodeIds.rawValue.dirty.push(e)),this.dirtyAndVolatileNodeIds.markAsModified());let r=this.removeDependencies(e);return delete this.nodesSparseArray[t],delete this.edgesSparseArray[t],this.infiniteRangeIds.delete(t),e.idInGraph=void 0,r}removeEdge(e,t){let r=this.getNodeIdIfNotNumber(e),n=this.getNodeIdIfNotNumber(t);if(void 0===r)throw this.missingNodeError(e);if(void 0===n)throw this.missingNodeError(t);let o=this.edgesSparseArray[r].indexOf(n);if(-1===o)throw Error("Edge does not exist");delete this.edgesSparseArray[r][o]}removeEdgeIfExists(e,t){let r=this.getNodeIdIfNotNumber(e),n=this.getNodeIdIfNotNumber(t);if(void 0===r||void 0===n)return;let o=this.edgesSparseArray[r].indexOf(n);-1!==o&&delete this.edgesSparseArray[r][o]}topSortWithScc(){return this.getTopSortedWithSccSubgraphFrom(this.getNodes(),()=>!0,()=>{})}getTopSortedWithSccSubgraphFrom(e,t,r){let n=new rx(this.nodesSparseArray,this.edgesSparseArray),o=e.map(e=>e.idInGraph).filter(e=>void 0!==e);return n.getTopSortedWithSccSubgraphFrom(o,t,r)}markNodeAsVolatile(e){let t=e.idInGraph;void 0!==t&&(this.dirtyAndVolatileNodeIds.rawValue.volatile.push(t),this.dirtyAndVolatileNodeIds.markAsModified())}markNodeAsDirty(e){let t=e.idInGraph;void 0!==t&&(this.dirtyAndVolatileNodeIds.rawValue.dirty.push(t),this.dirtyAndVolatileNodeIds.markAsModified())}getDirtyAndVolatileNodes(){return this.dirtyAndVolatileNodeIds.getProcessedValue()}clearDirtyNodes(){this.dirtyAndVolatileNodeIds.rawValue.dirty=[],this.dirtyAndVolatileNodeIds.markAsModified()}markNodeAsChangingWithStructure(e){let t=e.idInGraph;void 0!==t&&this.changingWithStructureNodeIds.push(t)}markChangingWithStructureNodesAsDirty(){this.changingWithStructureNodeIds.length<=0||(this.dirtyAndVolatileNodeIds.rawValue.dirty=[...this.dirtyAndVolatileNodeIds.rawValue.dirty,...this.changingWithStructureNodeIds],this.dirtyAndVolatileNodeIds.markAsModified())}markNodeAsInfiniteRange(e){let t=this.getNodeIdIfNotNumber(e);void 0!==t&&this.infiniteRangeIds.add(t)}getInfiniteRanges(){return[...this.infiniteRangeIds].map(e=>this.nodesSparseArray[e])}getNodeIdIfNotNumber(e){return"number"==typeof e?e:e.idInGraph}fixEdgesArrayForNode(e){let t=this.edgesSparseArray[e];return this.edgesSparseArray[e]=t.filter(e=>void 0!==e&&this.nodesSparseArray[e]),this.edgesSparseArray[e]}removeDependencies(e){let t=this.dependencyQuery(e);return t.forEach(([t,r])=>{this.removeEdgeIfExists(r,e)}),t}processDirtyAndVolatileNodeIds({dirty:e,volatile:t}){return[...new Set([...e,...t])].map(e=>this.nodesSparseArray[e]).filter(e=>void 0!==e)}missingNodeError(e){return Error(`Unknown node ${JSON.stringify(e)}`)}}class rk{constructor(){this.rangeMapping=new Map}getNumberOfRangesInSheet(e){var t,r;return null!=(r=null==(t=this.rangeMapping.get(e))?void 0:t.size)?r:0}addOrUpdateVertex(e){let t=this.rangeMapping.get(e.sheet);void 0===t&&(t=new Map,this.rangeMapping.set(e.sheet,t));let r=rk.calculateRangeKey(e.start,e.end);t.set(r,e)}removeVertexIfExists(e){let t=e.sheet,r=this.rangeMapping.get(t);if(void 0===r)return;let n=rk.calculateRangeKey(e.start,e.end);r.delete(n),0===r.size&&this.rangeMapping.delete(t)}getRangeVertex(e,t){let r=this.rangeMapping.get(e.sheet),n=rk.calculateRangeKey(e,t);return null==r?void 0:r.get(n)}getVertexOrThrow(e,t){let r=this.getRangeVertex(e,t);if(!r)throw Error("Range does not exist");return r}truncateRanges(e,t){let r=[],n=[],o=[],i=e.sheet;for(let[s,a]of this.entriesFromSheet(e.sheet)){let l=a.range;e.start<=t(a.range.end)&&(l.removeSpan(e),l.shouldBeRemoved()?(this.removeByKey(i,s),r.push(a)):n.push([s,a]),o.push(a))}let s=[];for(let[e,r]of(n.sort((e,r)=>rk.compareBy(e[1],r[1],t)),n)){let t=rk.calculateRangeKey(r.range.start,r.range.end);if(t===e)continue;let n=this.getByKey(i,t);this.removeByKey(i,e),void 0!==n&&r!=n?s.push([n,r]):this.addOrUpdateVertex(r)}return{verticesToRemove:r,verticesToMerge:s,verticesWithChangedSize:o}}moveAllRangesInSheetAfterAddingRows(e,t,r){return this.updateVerticesFromSheet(e,(e,n)=>t<=n.start.row?(n.range.shiftByRows(r),{changedSize:!1,vertex:n}):t>n.start.row&&t<=n.end.row?(n.range.expandByRows(r),{changedSize:!0,vertex:n}):void 0)}moveAllRangesInSheetAfterAddingColumns(e,t,r){return this.updateVerticesFromSheet(e,(e,n)=>t<=n.start.col?(n.range.shiftByColumns(r),{changedSize:!1,vertex:n}):t>n.start.col&&t<=n.end.col?(n.range.expandByColumns(r),{changedSize:!0,vertex:n}):void 0)}moveRangesInsideSourceRange(e,t,r,n){this.updateVerticesFromSheet(e.sheet,(o,i)=>e.containsRange(i.range)?(i.range.shiftByColumns(t),i.range.shiftByRows(r),i.range.moveToSheet(n),{changedSize:!1,vertex:i}):void 0)}*rangesInSheet(e){let t=this.rangeMapping.get(e);t&&(yield*t.values())}*rangeVerticesContainedInRange(e){for(let t of this.rangesInSheet(e.sheet))e.containsRange(t.range)&&(yield t)}findSmallerRange(e){if(e.height()>1&&Number.isFinite(e.height())){let t=r0(e.end.sheet,e.end.col,e.end.row-1),r=this.getRangeVertex(e.start,t);if(void 0!==r)return{smallerRangeVertex:r,restRange:r8.fromSimpleCellAddresses(r0(e.start.sheet,e.start.col,e.end.row),e.end)}}return{restRange:e}}static calculateRangeKey(e,t){return`${e.col},${e.row},${t.col},${t.row}`}static compareBy(e,t,r){let n=r(e.range.start),o=r(t.range.start);return n!==o?n-o:r(e.range.end)-r(t.range.end)}*entriesFromSheet(e){let t=this.rangeMapping.get(e);t&&(yield*t.entries())}removeByKey(e,t){let r=this.rangeMapping.get(e);if(!r)throw Error(`Sheet ${e} not found`);r.delete(t)}getByKey(e,t){var r;return null==(r=this.rangeMapping.get(e))?void 0:r.get(t)}updateVerticesFromSheet(e,t){let r=[];for(let[n,o]of this.entriesFromSheet(e)){let i=t(n,o);void 0!==i&&(this.removeByKey(e,n),r.push(i))}return r.forEach(e=>{this.addOrUpdateVertex(e.vertex)}),{verticesWithChangedSize:r.filter(e=>e.changedSize).map(e=>e.vertex)}}}class rH{constructor(e,t,r){this.functions=e,this.errors=t,this.ui=r,this._protectedTranslations={VERSION:"VERSION"},this.checkUI(),this.checkErrors(),this.checkFunctionTranslations(this.functions),Object.assign(this.functions,this._protectedTranslations)}extendFunctions(e){this.checkFunctionTranslations(e),Object.assign(this.functions,e)}buildFunctionMapping(){return Object.keys(this.functions).reduce((e,t)=>(e[this.functions[t]]=t,e),{})}buildErrorMapping(){return Object.keys(this.errors).reduce((e,t)=>(e[this.errors[t]]=t,e),{})}isFunctionTranslated(e){return void 0!==this.functions[e]}getFunctionTranslations(e){let t=[];for(let r of e)this.isFunctionTranslated(r)&&t.push(this.functions[r]);return t}getFunctionTranslation(e){let t=this.functions[e];if(void 0!==t)return t;throw new ra(`functions.${e}`)}getMaybeFunctionTranslation(e){return this.functions[e]}getErrorTranslation(e){if(e===d.LIC)return`#${d.LIC}!`;let t=this.errors[e];if(void 0!==t)return t;throw new ra(`errors.${e}`)}getUITranslation(e){let t=this.ui[e];if(void 0!==t)return t;throw new ra(`ui.${e}`)}checkUI(){for(let e of Object.values(h))if(!(e in this.ui))throw new ra(`ui.${e}`)}checkErrors(){for(let e of Object.values(d))if(!(e in this.errors)&&e!==d.LIC)throw new ra(`errors.${e}`)}checkFunctionTranslations(e){let t=new Set(Object.getOwnPropertyNames(e));for(let e of Object.getOwnPropertyNames(this._protectedTranslations))if(t.has(e))throw new rl(e)}}(h||(h={})).NEW_SHEET_PREFIX="NEW_SHEET_PREFIX";class r_{constructor(e,t,r=!1){this.id=e,this.displayName=t,this.isPlaceholder=r}get canonicalName(){return rL.canonicalizeSheetName(this.displayName)}}class rL{constructor(e){this.lastSheetId=-1,this.mappingFromCanonicalNameToId=new Map,this.allSheets=new Map,this.sheetNamePrefix=e.getUITranslation(h.NEW_SHEET_PREFIX)}static canonicalizeSheetName(e){return e.toLowerCase()}getSheetId(e,t={}){var r;return null==(r=this._getSheetByName(e,t))?void 0:r.id}getSheetIdOrThrowError(e){let t=this._getSheetByName(e,{});if(void 0===t)throw new tX(e);return t.id}getSheetName(e){var t;return null==(t=this._getSheet(e,{}))?void 0:t.displayName}getSheetNameOrThrowError(e,t={}){return this._getSheetOrThrowError(e,t).displayName}*iterateSheetNames(e={}){for(let t of this.allSheets.values())(e.includePlaceholders||!t.isPlaceholder)&&(yield t.displayName)}getSheetNames(e={}){return Array.from(this.iterateSheetNames(e))}numberOfSheets(e={}){return this.getSheetNames(e).length}hasSheetWithId(e,t={}){return void 0!==this._getSheet(e,t)}hasSheetWithName(e){return void 0!==this._getSheetByName(e,{})}addSheet(e=`${this.sheetNamePrefix}${this.lastSheetId+2}`){let t=this._getSheetByName(e,{includePlaceholders:!0});if(t){if(!t.isPlaceholder)throw new tQ(e);return t.isPlaceholder=!1,t.id}this.lastSheetId++;let r=new r_(this.lastSheetId,e);return this._storeSheetInMappings(r),r.id}addSheetWithId(e,t){let r=this._getSheetByName(t,{includePlaceholders:!0});if(r){if(r.id!==e||!r.isPlaceholder)throw new tQ(t);r.isPlaceholder=!1;return}e>this.lastSheetId&&(this.lastSheetId=e);let n=new r_(e,t);this._storeSheetInMappings(n)}addPlaceholderIfNotExists(e){let t=this._getSheetByName(e,{includePlaceholders:!0});if(t)return t.id;this.lastSheetId++;let r=new r_(this.lastSheetId,e,!0);return this._storeSheetInMappings(r),r.id}addPlaceholderWithId(e,t){if(this._getSheetByName(t,{includePlaceholders:!0}))throw new tQ(t);if(this.hasSheetWithId(e,{includePlaceholders:!0}))throw Error(`Sheet with id ${e} already exists`);e>this.lastSheetId&&(this.lastSheetId=e);let r=new r_(e,t,!0);this._storeSheetInMappings(r)}removeSheetIfExists(e,t={}){let r=this._getSheet(e,t);return!!r&&(this.allSheets.delete(e),this.mappingFromCanonicalNameToId.delete(r.canonicalName),e===this.lastSheetId&&this.lastSheetId--,!0)}markSheetAsPlaceholder(e){this._getSheetOrThrowError(e,{}).isPlaceholder=!0}renameSheet(e,t){let r,n=this._getSheetOrThrowError(e,{}),o=n.displayName;if(o===t)return{previousDisplayName:void 0};let i=this._getSheetByName(t,{includePlaceholders:!0});if(void 0!==i&&i.id!==n.id)if(i.isPlaceholder)this.mappingFromCanonicalNameToId.delete(i.canonicalName),this.allSheets.delete(i.id),i.id===this.lastSheetId&&this.lastSheetId--,r=i.id;else throw new tQ(t);let s=n.canonicalName;return this.mappingFromCanonicalNameToId.delete(s),n.displayName=t,this._storeSheetInMappings(n),{previousDisplayName:o,mergedWithPlaceholderSheet:r}}_storeSheetInMappings(e){this.allSheets.set(e.id,e),this.mappingFromCanonicalNameToId.set(e.canonicalName,e.id)}_getSheet(e,t){let r=this.allSheets.get(e);if(void 0!==r)return t.includePlaceholders||!r.isPlaceholder?r:void 0}_getSheetByName(e,t){let r=this.mappingFromCanonicalNameToId.get(rL.canonicalizeSheetName(e));if(void 0!==r)return this._getSheet(r,t)}_getSheetOrThrowError(e,t){let r=this._getSheet(e,t);if(void 0===r)throw new tK(e);return r}}class rP{constructor(e,t){this.sheetMapping=e,this.addressMapping=t}ensureSheetRegistered(e){let t=this.sheetMapping.addPlaceholderIfNotExists(e);return this.addressMapping.addSheetStrategyPlaceholderIfNotExists(t),t}}function rD(e){if(!Array.isArray(e))throw new t1("an array of arrays.");for(let t=0;t<e.length;t++)if(!Array.isArray(e[t]))throw new t1("an array of arrays.")}function rF(e){let t=0,r=0,n=0;for(let o=0;o<e.length;o++){let i=0;for(let t=0;t<e[o].length;t++)null!=e[o][t]&&(i=t+1,++n);t=Math.max(t,i),i>0&&(r=o+1)}let o=t*r;return{height:r,width:t,fill:0===o?0:n/o}}class rB{constructor(e,t,r,n,o,i,s,a){this.addressMapping=e,this.rangeMapping=t,this.sheetMapping=r,this.arrayMapping=n,this.stats=o,this.lazilyTransformingAstService=i,this.functionRegistry=s,this.namedExpressions=a,this.changes=tB.empty(),this.dependencyQueryAddresses=e=>{if(e instanceof rM)return this.rangeDependencyQuery(e).map(([e,t])=>e);{let t=this.formulaDependencyQuery(e);if(void 0===t)return[];{let[e,r]=t;return r.map(t=>t instanceof tT?this.namedExpressions.namedExpressionOrPlaceholder(t.name,e.sheet).address:r6(t)?t:r7(t.start,t.end))}}},this.dependencyQueryVertices=e=>{if(e instanceof rM)return this.rangeDependencyQuery(e);{let t=this.formulaDependencyQuery(e);if(void 0===t)return[];{let[e,r]=t;return r.map(t=>{if(t instanceof r8)return[t.start,this.rangeMapping.getVertexOrThrow(t.start,t.end)];if(!(t instanceof tT))return[t,this.addressMapping.getCellOrThrow(t)];{let r=this.namedExpressions.namedExpressionOrPlaceholder(t.name,e.sheet);return[r.address,this.addressMapping.getCellOrThrow(r.address)]}})}}},this.rangeDependencyQuery=e=>{let t,r=[],{smallerRangeVertex:n,restRange:o}=this.rangeMapping.findSmallerRange(e.range);for(let i of(void 0!==n&&this.graph.adjacentNodes(n).has(e)?(t=o,r.push([new r8(n.start,n.end),n])):t=e.range,t.addresses(this))){let e=this.addressMapping.getCell(i);void 0!==e&&r.push([i,e])}return r},this.formulaDependencyQuery=e=>{let t;return e instanceof rE?(t=e.getAddress(this.lazilyTransformingAstService),[t,tA(tw(e.getFormula(this.lazilyTransformingAstService),this.functionRegistry),t)]):void 0},this.graph=new rO(this.dependencyQueryVertices),this.sheetReferenceRegistrar=new rP(r,e)}static buildEmpty(e,t,r,n,o){return new rB(new rb(t.chooseAddressMappingPolicy),new rk,new rL(t.translationPackage),new rC,o,e,r,n)}setFormulaToCell(e,t,r,n,o,i){let s=rE.fromAst(t,e,n,this.lazilyTransformingAstService.version());return this.exchangeOrAddFormulaVertex(s),this.processCellDependencies(r,s),this.graph.markNodeAsDirty(s),o&&this.markAsVolatile(s),i&&this.markAsDependentOnStructureChange(s),this.correctInfiniteRangesDependency(e),this.getAndClearContentChanges()}setParsingErrorToCell(e,t){let r=this.shrinkPossibleArrayAndGetCell(e);return this.exchangeOrAddGraphNode(r,t),this.addressMapping.setCell(e,t),this.graph.markNodeAsDirty(t),this.correctInfiniteRangesDependency(e),this.getAndClearContentChanges()}setValueToCell(e,t){let r=this.shrinkPossibleArrayAndGetCell(e);if(r instanceof rT&&this.arrayMapping.removeArray(r.getRange()),r instanceof rU)r.getValues().rawValue!==t.rawValue&&(r.setValues(t),this.graph.markNodeAsDirty(r));else{let n=new rU(t.parsedValue,t.rawValue);this.exchangeOrAddGraphNode(r,n),this.addressMapping.setCell(e,n),this.graph.markNodeAsDirty(n)}return this.correctInfiniteRangesDependency(e),this.getAndClearContentChanges()}setCellEmpty(e){let t=this.shrinkPossibleArrayAndGetCell(e);if(void 0===t)return tB.empty();if(this.graph.adjacentNodes(t).size>0){let r=new rV;this.exchangeGraphNode(t,r),0===this.graph.adjacentNodesCount(r)?(this.removeVertex(r),this.addressMapping.removeCell(e)):(this.graph.markNodeAsDirty(r),this.addressMapping.setCell(e,r))}else this.removeVertex(t),this.addressMapping.removeCell(e);return this.getAndClearContentChanges()}clearDirtyVertices(){this.graph.clearDirtyNodes()}verticesToRecompute(){return this.graph.getDirtyAndVolatileNodes()}processCellDependencies(e,t){let r=t.idInGraph;if(void 0===r)throw Error("End vertex not found");e.forEach(e=>{if(e instanceof r8){let t=this.getRange(e.start,e.end);void 0===t&&(t=new rM(e),this.rangeMapping.addOrUpdateVertex(t)),this.graph.addNodeIfNotExists(t);let n=t.idInGraph;if(void 0===n)throw Error("Range vertex not found");e.isFinite()||this.graph.markNodeAsInfiniteRange(n);let{smallerRangeVertex:o,restRange:i}=this.rangeMapping.findSmallerRange(e);if(void 0!==o){if(this.graph.addEdge(o,n),t.bruteForce)for(let r of(t.bruteForce=!1,e.addresses(this)))this.graph.removeEdge(this.fetchCell(r),n)}else t.bruteForce=!0;let s=this.arrayMapping.getArray(i);if(void 0!==s)this.graph.addEdge(s,n);else for(let e of i.addresses(this)){let{vertex:t,id:r}=this.fetchCellOrCreateEmpty(e);this.graph.addEdge(null!=r?r:t,n)}this.graph.addEdge(n,r),e.isFinite()&&this.correctInfiniteRangesDependenciesByRangeVertex(t)}else if(e instanceof tT){let n=t.getAddress(this.lazilyTransformingAstService).sheet,{vertex:o,id:i}=this.fetchNamedExpressionVertex(e.name,n);this.graph.addEdge(null!=i?i:o,r)}else{let{vertex:t,id:n}=this.fetchCellOrCreateEmpty(e);this.graph.addEdge(null!=n?n:t,r)}})}fetchNamedExpressionVertex(e,t){let r=this.namedExpressions.namedExpressionOrPlaceholder(e,t);return this.fetchCellOrCreateEmpty(r.address)}exchangeNode(e,t){let r=this.fetchCellOrCreateEmpty(e).vertex,n=this.fetchCellOrCreateEmpty(t).vertex;this.addressMapping.removeCell(e),this.exchangeGraphNode(r,n)}fetchCellOrCreateEmpty(e){let t=this.addressMapping.getCell(e);if(void 0!==t)return{vertex:t,id:void 0};let r=new rV,n=this.graph.addNodeIfNotExists(r);return this.addressMapping.setCell(e,r),{vertex:r,id:n}}removeRows(e){this.stats.measure(a.ADJUSTING_GRAPH,()=>{for(let[t,r]of this.addressMapping.entriesFromRowsSpan(e)){for(let e of this.graph.adjacentNodes(r))this.graph.markNodeAsDirty(e);if(r instanceof rT)if(!r.isLeftCorner(t))continue;else this.shrinkArrayToCorner(r),this.arrayMapping.removeArray(r.getRange());this.removeVertex(r)}}),this.stats.measure(a.ADJUSTING_ADDRESS_MAPPING,()=>{this.addressMapping.removeRows(e)});let t=this.stats.measure(a.ADJUSTING_RANGES,()=>{let t=this.truncateRanges(e,e=>e.row);return this.getArrayVerticesRelatedToRanges(t)});return this.stats.measure(a.ADJUSTING_ARRAY_MAPPING,()=>{this.fixArraysAfterRemovingRows(e.sheet,e.rowStart,e.numberOfRows)}),this.addStructuralNodesToChangeSet(),{affectedArrays:t,contentChanges:this.getAndClearContentChanges()}}addSheet(e){this.addressMapping.addSheetOrChangeStrategy(e,rF([])),this.stats.measure(a.ADJUSTING_ADDRESS_MAPPING,()=>{this.markAllCellsAsDirtyInSheet(e)}),this.stats.measure(a.ADJUSTING_RANGES,()=>{this.markAllRangesAsDirtyInSheet(e)})}removeSheet(e){this.clearSheet(e);let t=!this.addressMapping.hasAnyEntries(e),r=0===this.rangeMapping.getNumberOfRangesInSheet(e);t&&r?(this.sheetMapping.removeSheetIfExists(e),this.addressMapping.removeSheetIfExists(e)):this.sheetMapping.markSheetAsPlaceholder(e)}mergeSheets(e,t){if(!this.isPlaceholder(t))throw Error(`Cannot merge sheets: sheet ${t} is not a placeholder`);this.mergeRangeVertices(e,t),this.mergeCellVertices(e,t),this.addressMapping.removeSheetIfExists(t),this.addStructuralNodesToChangeSet()}clearSheet(e){let t=new Set;for(let[r,n]of this.addressMapping.sheetEntries(e))n instanceof rT?t.add(n):this.setCellEmpty(r);for(let e of t.values())this.setArrayEmpty(e);this.addStructuralNodesToChangeSet()}removeColumns(e){this.stats.measure(a.ADJUSTING_GRAPH,()=>{for(let[t,r]of this.addressMapping.entriesFromColumnsSpan(e)){for(let e of this.graph.adjacentNodes(r))this.graph.markNodeAsDirty(e);if(r instanceof rT)if(!r.isLeftCorner(t))continue;else this.shrinkArrayToCorner(r),this.arrayMapping.removeArray(r.getRange());this.removeVertex(r)}}),this.stats.measure(a.ADJUSTING_ADDRESS_MAPPING,()=>{this.addressMapping.removeColumns(e)});let t=this.stats.measure(a.ADJUSTING_RANGES,()=>{let t=this.truncateRanges(e,e=>e.col);return this.getArrayVerticesRelatedToRanges(t)});return this.stats.measure(a.ADJUSTING_ARRAY_MAPPING,()=>this.fixArraysAfterRemovingColumns(e.sheet,e.columnStart,e.numberOfColumns)),this.addStructuralNodesToChangeSet(),{affectedArrays:t,contentChanges:this.getAndClearContentChanges()}}addRows(e){this.stats.measure(a.ADJUSTING_ADDRESS_MAPPING,()=>{this.addressMapping.addRows(e.sheet,e.rowStart,e.numberOfRows)});let t=this.stats.measure(a.ADJUSTING_RANGES,()=>{let t=this.rangeMapping.moveAllRangesInSheetAfterAddingRows(e.sheet,e.rowStart,e.numberOfRows);return this.fixRangesWhenAddingRows(e.sheet,e.rowStart,e.numberOfRows),this.getArrayVerticesRelatedToRanges(t.verticesWithChangedSize)});for(let t of(this.stats.measure(a.ADJUSTING_ARRAY_MAPPING,()=>{this.fixArraysAfterAddingRow(e.sheet,e.rowStart,e.numberOfRows)}),this.addressMapping.verticesFromRowsSpan(e)))this.graph.markNodeAsDirty(t);return this.addStructuralNodesToChangeSet(),{affectedArrays:t}}addColumns(e){this.stats.measure(a.ADJUSTING_ADDRESS_MAPPING,()=>{this.addressMapping.addColumns(e.sheet,e.columnStart,e.numberOfColumns)});let t=this.stats.measure(a.ADJUSTING_RANGES,()=>{let t=this.rangeMapping.moveAllRangesInSheetAfterAddingColumns(e.sheet,e.columnStart,e.numberOfColumns);return this.fixRangesWhenAddingColumns(e.sheet,e.columnStart,e.numberOfColumns),this.getArrayVerticesRelatedToRanges(t.verticesWithChangedSize)});for(let t of(this.stats.measure(a.ADJUSTING_ARRAY_MAPPING,()=>this.fixArraysAfterAddingColumn(e.sheet,e.columnStart,e.numberOfColumns)),this.addressMapping.verticesFromColumnsSpan(e)))this.graph.markNodeAsDirty(t);return this.addStructuralNodesToChangeSet(),{affectedArrays:t,contentChanges:this.getAndClearContentChanges()}}isThereSpaceForArray(e){let t=e.getRangeOrUndef();if(void 0===t)return!1;for(let r of t.addresses(this)){let t=this.addressMapping.getCell(r);if(void 0!==t&&!(t instanceof rV)&&t!==e)return!1}return!0}moveCells(e,t,r,n){for(let o of e.addressesWithDirection(t,r,this)){let i=r0(n,o.col+t,o.row+r),s=this.addressMapping.getCell(o),a=this.addressMapping.getCell(i);if(this.addressMapping.removeCell(o),void 0!==s){let t;for(let r of(this.graph.markNodeAsDirty(s),this.addressMapping.setCell(i,s),this.graph.adjacentNodes(s)))r instanceof rM&&!e.containsRange(r.range)&&(t=null!=t?t:this.fetchCellOrCreateEmpty(o).vertex,this.graph.addEdge(t,r),this.graph.removeEdge(s,r));t&&(this.graph.markNodeAsDirty(t),this.addressMapping.setCell(o,t))}if(void 0!==a){for(let e of(void 0===s&&this.addressMapping.removeCell(i),this.graph.adjacentNodes(a)))s=null!=s?s:this.fetchCellOrCreateEmpty(i).vertex,this.graph.addEdge(s,e),this.graph.markNodeAsDirty(s);this.removeVertex(a)}}for(let t of this.rangeMapping.rangeVerticesContainedInRange(e))for(let r of this.graph.adjacentNodes(t))if(r instanceof rM&&!e.containsRange(r.range))for(let e of(this.graph.removeEdge(t,r),t.range.addresses(this))){let{vertex:t,id:n}=this.fetchCellOrCreateEmpty(e);this.graph.addEdge(null!=n?n:t,r),this.addressMapping.setCell(e,t),this.graph.markNodeAsDirty(t)}this.rangeMapping.moveRangesInsideSourceRange(e,t,r,n)}setArrayEmpty(e){let t=r8.spanFrom(e.getAddress(this.lazilyTransformingAstService),e.width,e.height),r=this.graph.adjacentNodes(e);for(let e of t.addresses(this))this.addressMapping.removeCell(e);for(let t of r.values()){let r=rI(this.functionRegistry,t,e.getRange(),this.lazilyTransformingAstService,this);for(let e of r){let{vertex:r,id:n}=this.fetchCellOrCreateEmpty(e);this.graph.addEdge(null!=n?n:r,t)}r.length>0&&this.graph.markNodeAsDirty(t)}this.removeVertex(e),this.arrayMapping.removeArray(e.getRange())}addVertex(e,t){this.graph.addNodeIfNotExists(t),this.addressMapping.setCell(e,t)}addArrayVertex(e,t){this.graph.addNodeIfNotExists(t),this.setAddressMappingForArrayVertex(t,e)}*arrayFormulaNodes(){for(let e of this.graph.getNodes())e instanceof rT&&(yield e)}*entriesFromRowsSpan(e){yield*this.addressMapping.entriesFromRowsSpan(e)}*entriesFromColumnsSpan(e){yield*this.addressMapping.entriesFromColumnsSpan(e)}fetchCell(e){return this.addressMapping.getCellOrThrow(e)}getCell(e){return this.addressMapping.getCell(e,{throwIfSheetNotExists:!0})}getCellValue(e){return this.isPlaceholder(e.sheet)?new rK(d.REF,ej.SheetRef):this.addressMapping.getCellValue(e)}getRawValue(e){return this.isPlaceholder(e.sheet)?null:this.addressMapping.getRawValue(e)}getScalarValue(e){if(this.isPlaceholder(e.sheet))return new rK(d.REF,ej.SheetRef);let t=this.addressMapping.getCellValue(e);return t instanceof tF?new rK(d.VALUE,ej.ScalarExpected):t}existsEdge(e,t){return this.graph.existsEdge(e,t)}getSheetId(e){return this.sheetMapping.getSheetIdOrThrowError(e)}getSheetHeight(e){return this.addressMapping.getSheetHeight(e)}getSheetWidth(e){return this.addressMapping.getSheetWidth(e)}getArray(e){return this.arrayMapping.getArray(e)}getRange(e,t){return this.rangeMapping.getRangeVertex(e,t)}topSortWithScc(){return this.graph.topSortWithScc()}markAsVolatile(e){this.graph.markNodeAsVolatile(e)}markAsDependentOnStructureChange(e){this.graph.markNodeAsChangingWithStructure(e)}forceApplyPostponedTransformations(){for(let e of this.graph.getNodes())e instanceof rA&&e.ensureRecentData(this.lazilyTransformingAstService)}*rawValuesFromRange(e){for(let t of e.addresses(this)){let e=this.getScalarValue(t);e!==tM&&(yield[tI(e),t])}}computeListOfValuesInRange(e){let t=[];for(let r of e.addresses(this)){let e=this.getScalarValue(r);t.push(e)}return t}shrinkArrayToCorner(e){for(let t of(this.cleanAddressMappingUnderArray(e),this.adjacentArrayVertices(e))){let r;r=t instanceof rE?this.formulaDirectDependenciesToArray(t,e):this.rangeDirectDependenciesToArray(t,e);let n=!1;for(let[o,i]of r)e.isLeftCorner(o)&&(n=!0),this.graph.addEdge(i,t),this.graph.markNodeAsDirty(i);n||this.graph.removeEdge(e,t)}this.graph.markNodeAsDirty(e)}isArrayInternalCell(e){let t=this.getCell(e);return t instanceof rT&&!t.isLeftCorner(e)}getAndClearContentChanges(){let e=this.changes;return this.changes=tB.empty(),e}getAdjacentNodesAddresses(e){let t=this.graph.adjacentNodes(e),r=[];return t.forEach(e=>{e instanceof rM?r.push(r7(e.start,e.end)):e instanceof rE&&r.push(e.getAddress(this.lazilyTransformingAstService))}),r}markAllCellsAsDirtyInSheet(e){for(let[,t]of this.addressMapping.sheetEntries(e))this.graph.markNodeAsDirty(t)}markAllRangesAsDirtyInSheet(e){for(let t of this.rangeMapping.rangesInSheet(e))this.graph.markNodeAsDirty(t)}mergeRangeVertices(e,t){for(let r of Array.from(this.rangeMapping.rangesInSheet(t))){if(!this.graph.hasNode(r))continue;let n=r.start,o=r.end;if(n.sheet!==t&&o.sheet!==t)continue;let i=r0(e,n.col,n.row),s=r0(e,o.col,o.row),a=this.rangeMapping.getRangeVertex(i,s);a?(this.rerouteDependents(r,a),this.removeVertexAndRerouteDependencies(r,a),this.rangeMapping.removeVertexIfExists(r),this.graph.markNodeAsDirty(a)):(this.rangeMapping.removeVertexIfExists(r),r.range.moveToSheet(e),this.rangeMapping.addOrUpdateVertex(r),this.graph.markNodeAsDirty(r))}}mergeCellVertices(e,t){for(let[r,n]of Array.from(this.addressMapping.sheetEntries(t))){let t=r0(e,r.col,r.row),o=this.getCell(t);o?(this.rerouteDependents(n,o),this.removeVertexAndCleanupDependencies(n),this.addressMapping.removeCell(r),this.graph.markNodeAsDirty(o)):(this.addressMapping.moveCell(r,t),this.graph.markNodeAsDirty(n))}}isPlaceholder(e){return e!==tW.SHEET_FOR_WORKBOOK_EXPRESSIONS&&!this.sheetMapping.hasSheetWithId(e,{includePlaceholders:!1})}exchangeGraphNode(e,t){this.graph.addNodeIfNotExists(t);let r=this.graph.adjacentNodes(e);this.removeVertex(e),r.forEach(e=>{this.graph.hasNode(e)&&this.graph.addEdge(t,e)})}setArray(e,t){this.arrayMapping.setArray(e,t)}correctInfiniteRangesDependency(e){let t=this.graph.getInfiniteRanges().filter(t=>t.range.addressInRange(e));if(t.length<=0)return;let{vertex:r,id:n}=this.fetchCellOrCreateEmpty(e),o=null!=n?n:r.idInGraph;if(void 0===o)throw Error("Vertex not found");t.forEach(e=>{this.graph.addEdge(o,e)})}exchangeOrAddGraphNode(e,t){e?this.exchangeGraphNode(e,t):this.graph.addNodeIfNotExists(t)}getArrayVerticesRelatedToRanges(e){let t=new Set;return e.forEach(e=>{this.graph.hasNode(e)&&this.graph.adjacentNodes(e).forEach(e=>{e instanceof rT&&t.add(e)})}),t}correctInfiniteRangesDependenciesByRangeVertex(e){this.graph.getInfiniteRanges().forEach(t=>{let r=e.range.intersectionWith(t.range);void 0!==r&&r.addresses(this).forEach(e=>{let{vertex:r,id:n}=this.fetchCellOrCreateEmpty(e);this.graph.addEdge(null!=n?n:r,t)})})}cleanAddressMappingUnderArray(e){for(let t of e.getRange().addresses(this)){let r=e.getArrayCellValue(t);this.getCell(t)===e?e.isLeftCorner(t)?this.changes.addChange(new rK(d.REF),t,r):(this.addressMapping.removeCell(t),this.changes.addChange(tM,t,r)):this.changes.addChange(tM,t,r)}}*formulaDirectDependenciesToArray(e,t){var r;let[,n]=null!=(r=this.formulaDependencyQuery(e))?r:[];if(void 0!==n){for(let e of n)if(!(e instanceof tT)&&!(e instanceof r8)&&t.getRange().addressInRange(e)){let t=this.fetchCellOrCreateEmpty(e).vertex;yield[e,t]}}}*rangeDirectDependenciesToArray(e,t){let{restRange:r}=this.rangeMapping.findSmallerRange(e.range);for(let e of r.addresses(this))if(t.getRange().addressInRange(e)){let t=this.fetchCellOrCreateEmpty(e).vertex;yield[e,t]}}*adjacentArrayVertices(e){for(let t of this.graph.adjacentNodes(e))(t instanceof rE||t instanceof rM)&&(yield t)}addStructuralNodesToChangeSet(){this.graph.markChangingWithStructureNodesAsDirty()}fixRangesWhenAddingRows(e,t,r){for(let n of Array.from(this.rangeMapping.rangesInSheet(e)))if(n.range.includesRow(t+r))if(n.bruteForce)for(let e of n.range.rangeWithSameWidth(t,r).addresses(this)){let{vertex:t,id:r}=this.fetchCellOrCreateEmpty(e);this.graph.addEdge(null!=r?r:t,n)}else{let e=n,t=this.rangeMapping.findSmallerRange(e.range);if(void 0!==t.smallerRangeVertex)continue;for(;void 0===t.smallerRangeVertex;){let r=new rM(r8.spanFrom(e.range.start,e.range.width(),e.range.height()-1));this.rangeMapping.addOrUpdateVertex(r),this.graph.addNodeIfNotExists(r);let n=new r8(r0(e.range.start.sheet,e.range.start.col,e.range.end.row),e.range.end);this.addAllFromRange(n,e),this.graph.addEdge(r,e),e=r,t=this.rangeMapping.findSmallerRange(e.range)}this.graph.addEdge(t.smallerRangeVertex,e),this.addAllFromRange(t.restRange,e),this.graph.removeEdge(t.smallerRangeVertex,n)}}addAllFromRange(e,t){for(let r of e.addresses(this)){let{vertex:e,id:n}=this.fetchCellOrCreateEmpty(r);this.graph.addEdge(null!=n?n:e,t)}}fixRangesWhenAddingColumns(e,t,r){for(let n of this.rangeMapping.rangesInSheet(e))if(n.range.includesColumn(t+r)){for(let o of(n.bruteForce?n.range.rangeWithSameHeight(t,r):r8.spanFrom(r0(e,t,n.range.end.row),r,1)).addresses(this)){let{vertex:e,id:t}=this.fetchCellOrCreateEmpty(o);this.graph.addEdge(null!=t?t:e,n)}}}exchangeOrAddFormulaVertex(e){let t=e.getAddress(this.lazilyTransformingAstService),r=r8.spanFrom(t,e.width,e.height),n=this.shrinkPossibleArrayAndGetCell(t);if(e instanceof rT&&this.setArray(r,e),this.exchangeOrAddGraphNode(n,e),this.addressMapping.setCell(t,e),e instanceof rT){if(!this.isThereSpaceForArray(e))return;for(let t of r.addresses(this)){if(e.isLeftCorner(t))continue;let r=this.getCell(t);this.exchangeOrAddGraphNode(r,e)}}for(let t of r.addresses(this))this.addressMapping.setCell(t,e)}setAddressMappingForArrayVertex(e,t){if(this.addressMapping.setCell(t,e),!(e instanceof rT))return;let r=r8.spanFromOrUndef(t,e.width,e.height);if(void 0!==r&&(this.setArray(r,e),this.isThereSpaceForArray(e)))for(let t of r.addresses(this))this.addressMapping.setCell(t,e)}truncateRanges(e,t){let{verticesToRemove:r,verticesToMerge:n,verticesWithChangedSize:o}=this.rangeMapping.truncateRanges(e,t);for(let[e,t]of n)this.rerouteDependents(t,e),this.removeVertexAndCleanupDependencies(t);for(let e of r)this.removeVertexAndCleanupDependencies(e);return o}fixArraysAfterAddingRow(e,t,r){if(this.arrayMapping.moveArrayVerticesAfterRowByRows(e,t,r),!(t<=0))for(let[,n]of this.arrayMapping.arraysInRows(t$.fromRowStartAndEnd(e,t-1,t-1))){let o=n.getRange();for(let i=o.start.col;i<=o.end.col;++i)for(let s=t;s<=o.end.row;++s){let t=r0(e,i,s),o=r0(e,i,s+r),a=n.getArrayCellValue(t);this.addressMapping.moveCell(o,t),this.changes.addChange(tM,o,a)}}}fixArraysAfterRemovingRows(e,t,r){if(this.arrayMapping.moveArrayVerticesAfterRowByRows(e,t,-r),!(t<=0))for(let[,r]of this.arrayMapping.arraysInRows(t$.fromRowStartAndEnd(e,t-1,t-1)))if(this.isThereSpaceForArray(r))for(let e of r.getRange().addresses(this))this.addressMapping.setCell(e,r);else this.setNoSpaceIfArray(r)}fixArraysAfterAddingColumn(e,t,r){if(this.arrayMapping.moveArrayVerticesAfterColumnByColumns(e,t,r),!(t<=0))for(let[,n]of this.arrayMapping.arraysInCols(tY.fromColumnStartAndEnd(e,t-1,t-1))){let o=n.getRange();for(let i=o.start.row;i<=o.end.row;++i)for(let s=t;s<=o.end.col;++s){let t=r0(e,s,i),o=r0(e,s+r,i),a=n.getArrayCellValue(t);this.addressMapping.moveCell(o,t),this.changes.addChange(tM,o,a)}}}fixArraysAfterRemovingColumns(e,t,r){if(this.arrayMapping.moveArrayVerticesAfterColumnByColumns(e,t,-r),!(t<=0))for(let[,r]of this.arrayMapping.arraysInCols(tY.fromColumnStartAndEnd(e,t-1,t-1)))if(this.isThereSpaceForArray(r))for(let e of r.getRange().addresses(this))this.addressMapping.setCell(e,r);else this.setNoSpaceIfArray(r)}shrinkPossibleArrayAndGetCell(e){let t=this.getCell(e);return t instanceof rT?(this.setNoSpaceIfArray(t),this.getCell(e)):t}setNoSpaceIfArray(e){e instanceof rT&&(this.shrinkArrayToCorner(e),e.setNoSpace())}removeVertex(e){this.removeVertexAndCleanupDependencies(e),e instanceof rM&&this.rangeMapping.removeVertexIfExists(e)}rerouteDependents(e,t){let r=this.graph.adjacentNodes(e);this.graph.removeEdgeIfExists(t,e),r.forEach(e=>{this.graph.hasNode(e)&&this.graph.addEdge(t,e)})}removeVertexAndRerouteDependencies(e,t){let r=this.graph.removeNode(e);this.graph.removeEdgeIfExists(t,e),r.forEach(([e,r])=>{this.graph.hasNode(r)&&this.graph.addEdge(r,t)})}removeVertexAndCleanupDependencies(e){let t=new Set(this.graph.removeNode(e)),r=new Set;for(;t.size>0;){let e=t.values().next().value;t.delete(e);let[n,o]=e;this.graph.hasNode(o)&&0===this.graph.adjacentNodesCount(o)&&((o instanceof rM||o instanceof rV)&&this.graph.removeNode(o).forEach(e=>t.add(e)),o instanceof rM?(this.rangeMapping.removeVertexIfExists(o),r.add(o.sheet)):o instanceof rV&&r6(n)&&(this.addressMapping.removeCell(n),r.add(n.sheet)))}this.cleanupPlaceholderSheets(r)}cleanupPlaceholderSheets(e){for(let t of e)this.isPlaceholder(t)&&!this.addressMapping.hasAnyEntries(t)&&0===this.rangeMapping.getNumberOfRangesInSheet(t)&&(this.sheetMapping.removeSheetIfExists(t,{includePlaceholders:!0}),this.addressMapping.removeSheetIfExists(t))}}class rV extends rR{constructor(){super()}getCellValue(){return tM}}class rU extends rR{constructor(e,t){super(),this.parsedValue=e,this.rawValue=t}getValues(){return{parsedValue:this.parsedValue,rawValue:this.rawValue}}setValues(e){this.parsedValue=e.parsedValue,this.rawValue=e.rawValue}getCellValue(){return this.parsedValue}}class rz extends rR{constructor(e,t){super(),this.errors=e,this.rawInput=t}getCellValue(){let e=this.errors.map(e=>e.message).find(e=>e);return rK.parsingError(e)}getFormula(){return this.rawInput}}class rW{constructor(e,t){this.width=e,this.height=t,this.mapping=new Map}getCell(e){var t;return null==(t=this.mapping.get(e.col))?void 0:t.get(e.row)}setCell(e,t){this.width=Math.max(this.width,e.col+1),this.height=Math.max(this.height,e.row+1);let r=this.mapping.get(e.col);r||(r=new Map,this.mapping.set(e.col,r)),r.set(e.row,t)}has(e){var t;return!!(null==(t=this.mapping.get(e.col))?void 0:t.get(e.row))}getHeight(){return this.height}getWidth(){return this.width}removeCell(e){var t;null==(t=this.mapping.get(e.col))||t.delete(e.row)}addRows(e,t){this.mapping.forEach(r=>{let n=new Map;r.forEach((o,i)=>{i>=e&&(n.set(i+t,o),r.delete(i))}),n.forEach((e,t)=>{r.set(t,e)})}),this.height+=t}addColumns(e,t){let r=new Map;this.mapping.forEach((n,o)=>{o>=e&&(r.set(o+t,n),this.mapping.delete(o))}),r.forEach((e,t)=>{this.mapping.set(t,e)}),this.width+=t}removeRows(e){this.mapping.forEach(t=>{let r=new Map;t.forEach((n,o)=>{o>=e.rowStart&&(t.delete(o),o>e.rowEnd&&r.set(o-e.numberOfRows,n))}),r.forEach((e,r)=>{t.set(r,e)})});let t=Math.max(0,Math.min(this.height-1,e.rowEnd)-e.rowStart+1);this.height=Math.max(0,this.height-t)}removeColumns(e){let t=new Map;this.mapping.forEach((r,n)=>{n>=e.columnStart&&(this.mapping.delete(n),n>e.columnEnd&&t.set(n-e.numberOfColumns,r))}),t.forEach((e,t)=>{this.mapping.set(t,e)});let r=Math.max(0,Math.min(this.width-1,e.columnEnd)-e.columnStart+1);this.width=Math.max(0,this.width-r)}*getEntries(e){for(let[t,r]of this.mapping)for(let[n,o]of r)yield[r0(e,t,n),o]}*verticesFromColumn(e){let t=this.mapping.get(e);if(void 0!==t)for(let[e,r]of t)yield r}*verticesFromRow(e){for(let t of this.mapping.values()){let r=t.get(e);void 0!==r&&(yield r)}}*verticesFromColumnsSpan(e){for(let t of e.columns()){let e=this.mapping.get(t);if(void 0!==e)for(let[t,r]of e)yield r}}*verticesFromRowsSpan(e){for(let t of this.mapping.values())for(let r of e.rows()){let e=t.get(r);void 0!==e&&(yield e)}}*entriesFromRowsSpan(e){for(let[t,r]of this.mapping.entries())for(let n of e.rows()){let o=r.get(n);void 0!==o&&(yield[r0(e.sheet,t,n),o])}}*entriesFromColumnsSpan(e){for(let t of e.columns()){let r=this.mapping.get(t);if(void 0!==r)for(let[n,o]of r.entries())yield[r0(e.sheet,t,n),o]}}*vertices(){for(let[e,t]of this.mapping)for(let[e,r]of t)void 0!==r&&(yield r)}}class rG{constructor(e,t){this.width=e,this.height=t,this.mapping=Array(t);for(let r=0;r<t;r++)this.mapping[r]=Array(e)}getCell(e){return this.getCellVertex(e.col,e.row)}setCell(e,t){this.width=Math.max(this.width,e.col+1),this.height=Math.max(this.height,e.row+1),this.mapping[e.row]||(this.mapping[e.row]=Array(this.width)),this.mapping[e.row][e.col]=t}has(e){let t=this.mapping[e.row];return!!t&&!!t[e.col]}getHeight(){return this.height}getWidth(){return this.width}removeCell(e){void 0!==this.mapping[e.row]&&delete this.mapping[e.row][e.col]}addRows(e,t){let r=[];for(let e=0;e<t;e++)r.push(Array(this.width));this.mapping.splice(e,0,...r),this.height+=t}addColumns(e,t){for(let r=0;r<this.height;r++)void 0!==this.mapping[r]&&this.mapping[r].splice(e,0,...Array(t));this.width+=t}removeRows(e){this.mapping.splice(e.rowStart,e.numberOfRows);let t=Math.max(0,Math.min(this.height-1,e.rowEnd)-e.rowStart+1);this.height=Math.max(0,this.height-t)}removeColumns(e){for(let t=0;t<this.height;t++)void 0!==this.mapping[t]&&this.mapping[t].splice(e.columnStart,e.numberOfColumns);let t=Math.max(0,Math.min(this.width-1,e.columnEnd)-e.columnStart+1);this.width=Math.max(0,this.width-t)}*getEntries(e){for(let t=0;t<this.height;++t)for(let r=0;r<this.width;++r){let n=this.getCellVertex(r,t);n&&(yield[r0(e,r,t),n])}}*verticesFromColumn(e){for(let t=0;t<this.height;++t){let r=this.getCellVertex(e,t);r&&(yield r)}}*verticesFromRow(e){for(let t=0;t<this.width;++t){let r=this.getCellVertex(t,e);r&&(yield r)}}*verticesFromColumnsSpan(e){for(let t=e.columnStart;t<=e.columnEnd;++t)for(let e=0;e<this.height;++e){let r=this.getCellVertex(t,e);r&&(yield r)}}*verticesFromRowsSpan(e){for(let t=0;t<this.width;++t)for(let r=e.rowStart;r<=e.rowEnd;++r){let e=this.getCellVertex(t,r);e&&(yield e)}}*entriesFromRowsSpan(e){for(let t=0;t<this.width;++t)for(let r=e.rowStart;r<=e.rowEnd;++r){let n=this.getCellVertex(t,r);n&&(yield[r0(e.sheet,t,r),n])}}*entriesFromColumnsSpan(e){for(let t=e.columnStart;t<=e.columnEnd;++t)for(let r=0;r<this.height;++r){let n=this.getCellVertex(t,r);n&&(yield[r0(e.sheet,t,r),n])}}*vertices(){for(let e=0;e<this.height;++e)for(let t=0;t<this.width;++t){let r=this.getCellVertex(t,e);r&&(yield r)}}getCellVertex(e,t){var r;return null==(r=this.mapping[t])?void 0:r[e]}}(O=d||(d={})).DIV_BY_ZERO="DIV_BY_ZERO",O.NAME="NAME",O.VALUE="VALUE",O.NUM="NUM",O.NA="NA",O.CYCLE="CYCLE",O.REF="REF",O.SPILL="SPILL",O.LIC="LIC",O.ERROR="ERROR",(k=u||(u={})).FORMULA="FORMULA",k.VALUE="VALUE",k.ARRAY="ARRAY",k.EMPTY="EMPTY",k.ARRAYFORMULA="ARRAYFORMULA",(H=c||(c={})).EMPTY="EMPTY",H.NUMBER="NUMBER",H.STRING="STRING",H.BOOLEAN="BOOLEAN",H.ERROR="ERROR",(g||(g={})).NUMBER="NUMBER";let r$=Object.assign(Object.assign({},c),g),rY=Object.assign(Object.assign({},c),s),rj=e=>{switch(e){case r$.EMPTY:return 0;case r$.NUMBER:return 1;case r$.STRING:return 2;case r$.BOOLEAN:return 3;case r$.ERROR:return 4}throw Error("Cell value not computed")},rq=e=>{if(e===tM)return r$.EMPTY;if(e instanceof rK||e instanceof tF)return r$.ERROR;if("string"==typeof e)return r$.STRING;if(tP(e))return r$.NUMBER;if("boolean"==typeof e)return r$.BOOLEAN;throw Error("Cell value not computed")};class rK{constructor(e,t,r){this.type=e,this.message=t,this.root=r}static parsingError(e){return new rK(d.ERROR,`${ej.ParseError}${e?" "+e:""}`)}attachRootVertex(e){return void 0===this.root?new rK(this.type,this.message,e):this}}let rX=(e,t)=>({sheet:e,row:t}),rQ=e=>e.row<0,rZ=(e,t)=>({sheet:e,col:t}),rJ=e=>e.col<0,r0=(e,t,r)=>({sheet:e,col:t,row:r}),r1=e=>e.col<0||e.row<0,r2=(e,t,r,n)=>r0(t,e.col+r,e.row+n),r3=e=>`${e.sheet},${e.row},${e.col}`;function r6(e){return e&&("object"==typeof e||"function"==typeof e)&&"number"==typeof(null==e?void 0:e.sheet)&&"number"==typeof(null==e?void 0:e.col)&&"number"==typeof(null==e?void 0:e.row)}let r5=(e,t)=>{var r;return null!=(r=e.sheet)?r:t.sheet},r4=(e,t)=>e.sheet===t.sheet&&e.col===t.col&&e.row===t.row;function r9(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"start"in e&&r6(e.start)&&"end"in e&&r6(e.end)}let r7=(e,t)=>({start:e,end:t});class r8{constructor(e,t){if(e.sheet!==t.sheet)throw new t2(e.sheet,t.sheet);this.start=r0(e.sheet,e.col,e.row),this.end=r0(t.sheet,t.col,t.row)}get sheet(){return this.start.sheet}static fromSimpleCellAddresses(e,t){if(e.sheet!==t.sheet)throw new t2(e.sheet,t.sheet);let r=t.col-e.col,n=t.row-e.row;return Number.isFinite(n)&&Number.isFinite(r)?new r8(e,t):Number.isFinite(n)?new nt(e.sheet,e.row,t.row):new ne(e.sheet,e.col,t.col)}static fromAst(e,t){return e.type===o.CELL_RANGE?r8.fromCellRange(e,t):e.type===o.COLUMN_RANGE?ne.fromColumnRange(e,t):nt.fromRowRangeAst(e,t)}static fromAstOrUndef(e,t){try{return r8.fromAst(e,t)}catch(e){return}}static fromCellRange(e,t){return new r8(e.start.toSimpleCellAddress(t),e.end.toSimpleCellAddress(t))}static spanFrom(e,t,r){let n=r8.spanFromOrUndef(e,t,r);if(void 0===n)throw Error("AbsoluteCellRange: Wrong range size");return n}static spanFromOrUndef(e,t,r){if(!Number.isFinite(t)&&Number.isFinite(r)){if(0===e.col)return new nt(e.sheet,e.row,e.row+r-1)}else if(!Number.isFinite(r)&&Number.isFinite(t)){if(0!==e.row)return;return new ne(e.sheet,e.col,e.col+t-1)}else if(Number.isFinite(r)&&Number.isFinite(t))return new r8(e,r0(e.sheet,e.col+t-1,e.row+r-1))}static fromCoordinates(e,t,r,n,o){return new r8(r0(e,t,r),r0(e,n,o))}isFinite(){return Number.isFinite(this.size())}doesOverlap(e){return this.start.sheet==e.start.sheet&&!(this.end.row<e.start.row)&&!(this.start.row>e.end.row)&&!(this.end.col<e.start.col)&&!(this.start.col>e.end.col)}addressInRange(e){return this.sheet===e.sheet&&this.start.row<=e.row&&this.end.row>=e.row&&this.start.col<=e.col&&this.end.col>=e.col}columnInRange(e){return this.sheet===e.sheet&&this.start.col<=e.col&&this.end.col>=e.col}rowInRange(e){return this.sheet===e.sheet&&this.start.row<=e.row&&this.end.row>=e.row}containsRange(e){return this.addressInRange(e.start)&&this.addressInRange(e.end)}intersectionWith(e){if(this.sheet!==e.start.sheet)return;let t=Math.max(this.start.row,e.start.row),r=Math.min(this.end.row,e.end.row),n=Math.max(this.start.col,e.start.col),o=Math.min(this.end.col,e.end.col);if(!(t>r)&&!(n>o))return new r8(r0(this.sheet,n,t),r0(this.sheet,o,r))}includesRow(e){return this.start.row<e&&this.end.row>=e}includesColumn(e){return this.start.col<e&&this.end.col>=e}shiftByRows(e){this.start.row+=e,this.end.row+=e}expandByRows(e){this.end.row+=e}shiftByColumns(e){this.start.col+=e,this.end.col+=e}shifted(e,t){return r8.spanFrom(r0(this.sheet,this.start.col+e,this.start.row+t),this.width(),this.height())}expandByColumns(e){this.end.col+=e}moveToSheet(e){this.start.sheet=e,this.end.sheet=e}removeSpan(e){e instanceof t$?this.removeRows(e.start,e.end):this.removeColumns(e.start,e.end)}shouldBeRemoved(){return 0>=this.width()||0>=this.height()}rangeWithSameWidth(e,t){return r8.spanFrom(r0(this.sheet,this.start.col,e),this.width(),t)}rangeWithSameHeight(e,t){return r8.spanFrom(r0(this.sheet,e,this.start.row),t,this.height())}toString(){return`${this.start.sheet},${this.start.col},${this.start.row},${this.end.col},${this.end.row}`}width(){return this.end.col-this.start.col+1}height(){return this.end.row-this.start.row+1}size(){return this.height()*this.width()}arrayOfAddressesInRange(){let e=[];for(let t=0;t<this.height();++t){e[t]=[];for(let r=0;r<this.width();++r){let n=r0(this.sheet,this.start.col+r,this.start.row+t);e[t].push(n)}}return e}withStart(e){return new r8(e,this.end)}sameDimensionsAs(e){return this.width()===e.width()&&this.height()===e.height()}sameAs(e){return r4(this.start,e.start)&&r4(this.end,e.end)}addressesArrayMap(e,t){let r=[],n=this.start.row;for(;n<=this.effectiveEndRow(e);){let o=this.start.col,i=[];for(;o<=this.effectiveEndColumn(e);)i.push(t(r0(this.start.sheet,o,n))),o++;r.push(i),n++}return r}addresses(e){let t=[],r=this.start.row,n=this.effectiveEndRow(e),o=this.effectiveEndColumn(e);for(;r<=n;){let e=this.start.col;for(;e<=o;)t.push(r0(this.start.sheet,e,r)),e++;r++}return t}*addressesWithDirection(e,t,r){if(e>0)if(t>0){let e=this.effectiveEndRow(r);for(;e>=this.start.row;){let t=this.effectiveEndColumn(r);for(;t>=this.start.col;)yield r0(this.start.sheet,t,e),t-=1;e-=1}}else{let e=this.start.row;for(;e<=this.effectiveEndRow(r);){let t=this.effectiveEndColumn(r);for(;t>=this.start.col;)yield r0(this.start.sheet,t,e),t-=1;e+=1}}else if(t>0){let e=this.effectiveEndRow(r);for(;e>=this.start.row;){let t=this.start.col;for(;t<=this.effectiveEndColumn(r);)yield r0(this.start.sheet,t,e),t+=1;e-=1}}else{let e=this.start.row;for(;e<=this.effectiveEndRow(r);){let t=this.start.col;for(;t<=this.effectiveEndColumn(r);)yield r0(this.start.sheet,t,e),t+=1;e+=1}}}getAddress(e,t){if(e<0||t<0||t>this.height()-1||e>this.width()-1)throw Error("Index out of bound");return r0(this.start.sheet,this.start.col+e,this.start.row+t)}exceedsSheetSizeLimits(e,t){return this.end.col>=e||this.end.row>=t}effectiveEndColumn(e){return this.end.col}effectiveEndRow(e){return this.end.row}effectiveWidth(e){return this.width()}effectiveHeight(e){return this.height()}removeRows(e,t){if(!(e>this.end.row)){if(t<this.start.row)return this.shiftByRows(-(t-e+1));e<=this.start.row&&(this.start.row=e),this.end.row-=Math.min(t,this.end.row)-e+1}}removeColumns(e,t){if(!(e>this.end.col)){if(t<this.start.col)return this.shiftByColumns(-(t-e+1));e<=this.start.col&&(this.start.col=e),this.end.col-=Math.min(t,this.end.col)-e+1}}}class ne extends r8{constructor(e,t,r){super(r0(e,t,0),r0(e,r,1/0))}static fromColumnRange(e,t){let r=e.start.toSimpleColumnAddress(t),n=e.end.toSimpleColumnAddress(t);if(r.sheet!==n.sheet)throw new t2(r.sheet,n.sheet);return new ne(r.sheet,r.col,n.col)}shouldBeRemoved(){return 0>=this.width()}shiftByRows(e){}expandByRows(e){}shifted(e,t){return new ne(this.sheet,this.start.col+e,this.end.col+e)}rangeWithSameHeight(e,t){return new ne(this.sheet,e,e+t-1)}exceedsSheetSizeLimits(e,t){return this.end.col>=e}effectiveEndRow(e){return this.effectiveHeight(e)-1}effectiveHeight(e){return e.getSheetHeight(this.sheet)}removeRows(e,t){}}class nt extends r8{constructor(e,t,r){super(r0(e,0,t),r0(e,1/0,r))}static fromRowRangeAst(e,t){let r=e.start.toSimpleRowAddress(t),n=e.end.toSimpleRowAddress(t);if(r.sheet!==n.sheet)throw new t2(r.sheet,n.sheet);return new nt(r.sheet,r.row,n.row)}shouldBeRemoved(){return 0>=this.height()}shiftByColumns(e){}expandByColumns(e){}shifted(e,t){return new nt(this.sheet,this.start.row+t,this.end.row+t)}rangeWithSameWidth(e,t){return new nt(this.sheet,e,e+t-1)}exceedsSheetSizeLimits(e,t){return this.end.row>=t}effectiveEndColumn(e){return this.effectiveWidth(e)-1}effectiveWidth(e){return e.getSheetWidth(this.sheet)}removeColumns(e,t){}}class nr{constructor(e,t,r){this.formulaAddress=e,this.arraysFlag=t,this.formulaVertex=r}}let nn=/^\s*([+-]?)\s*(([\d\.,]+(e[+-]?\d+)?)\s*([ij]?)|([ij]))\s*(([+-])\s*([+-]?)\s*(([\d\.,]+(e[+-]?\d+)?)\s*([ij]?)|([ij])))?$/;class no{constructor(e,t,r){this.config=e,this.dateTimeHelper=t,this.numberLiteralsHelper=r,this.lt=(e,t)=>0>this.compare(e,t),this.leq=(e,t)=>0>=this.compare(e,t),this.gt=(e,t)=>this.compare(e,t)>0,this.geq=(e,t)=>this.compare(e,t)>=0,this.eq=(e,t)=>0===this.compare(e,t),this.neq=(e,t)=>0!==this.compare(e,t),this.pow=(e,t)=>Math.pow(tI(e),tI(t)),this.addWithEpsilonRaw=(e,t)=>{let r=e+t;return Math.abs(r)<this.actualEps*Math.abs(e)?0:r},this.addWithEpsilon=(e,t)=>{let r=nb(e,t);return this.ExtendedNumberFactory(this.addWithEpsilonRaw(tI(e),tI(t)),r)},this.unaryMinus=e=>tN(e,-tI(e)),this.unaryPlus=e=>e,this.unaryPercent=e=>new tL(tI(e)/100),this.concat=(e,t)=>e.concat(t),this.nonstrictadd=(e,t)=>{if(e instanceof rK)return e;if(t instanceof rK)return t;if("number"==typeof e)if("number"==typeof t)return this.addWithEpsilonRaw(e,t);else return e;if("number"==typeof t)return t;return 0},this.subtract=(e,t)=>{let r=nb(e,t),n=tI(e),o=n-tI(t);return Math.abs(o)<this.actualEps*Math.abs(n)&&(o=0),this.ExtendedNumberFactory(o,r)},this.divide=(e,t)=>{let r=tI(e),n=tI(t);if(0===n)return new rK(d.DIV_BY_ZERO);{let o=nC(e,t);return this.ExtendedNumberFactory(r/n,o)}},this.multiply=(e,t)=>{let r=nC(e,t);return this.ExtendedNumberFactory(tI(e)*tI(t),r)},this.manyToExactComplex=e=>{let t=[];for(let r of e)if(r instanceof rK)return r;else if(tP(r)||"string"==typeof r){let e=this.coerceScalarToComplex(r);e instanceof rK||t.push(e)}return t},this.coerceNumbersExactRanges=e=>this.manyToNumbers(e,this.manyToExactNumbers),this.coerceNumbersCoerceRangesDropNulls=e=>this.manyToNumbers(e,this.manyToCoercedNumbersDropNulls),this.manyToExactNumbers=e=>{let t=[];for(let r of e)if(r instanceof rK)return r;else tP(r)&&t.push(tI(r));return t},this.manyToOnlyNumbersDropNulls=e=>{let t=[];for(let r of e)if(r instanceof rK)return r;else if(tP(r))t.push(tI(r));else if(r!==tM)return new rK(d.VALUE,ej.NumberExpected);return t},this.manyToCoercedNumbersDropNulls=e=>{let t=[];for(let r of e){if(r instanceof rK)return r;if(r===tM)continue;let e=this.coerceScalarToNumberOrError(r);tP(e)&&t.push(tI(e))}return t},this.collator=function(e){let t=e.caseSensitive?e.accentSensitive?"variant":"case":e.accentSensitive?"accent":"base",r=e.caseFirst,n=e.ignorePunctuation;return new Intl.Collator(e.localeLang,{sensitivity:t,caseFirst:r,ignorePunctuation:n})}(e),this.actualEps=e.smartRounding?e.precisionEpsilon:0}eqMatcherFunction(e){let t=this.buildRegex(e);return e=>"string"==typeof e&&t.test(this.normalizeString(e))}neqMatcherFunction(e){let t=this.buildRegex(e);return e=>"string"!=typeof e||!t.test(this.normalizeString(e))}searchString(e,t){var r;let n=this.buildRegex(e,!1).exec(t);return null!=(r=null==n?void 0:n.index)?r:-1}requiresRegex(e){if(!this.config.useRegularExpressions&&!this.config.useWildcards)return!this.config.matchWholeCell;for(let t=0;t<e.length;t++){let r=e.charAt(t);if(np(r)||this.config.useRegularExpressions&&nf(r))return!0}return!1}floatCmp(e,t){let r=tI(e),n=tI(t),o=1+this.actualEps;return n>=0&&r*o>=n&&r<=n*o||n<=0&&r*o<=n&&r>=n*o?0:r>n?1:-1}coerceScalarToNumberOrError(e){var t;return e instanceof rK?e:null!=(t=this.coerceToMaybeNumber(e))?t:new rK(d.VALUE,ej.NumberCoercion)}coerceToMaybeNumber(e){var t;return null!=(t=this.coerceNonDateScalarToMaybeNumber(e))?t:"string"==typeof e?this.dateTimeHelper.dateStringToDateNumber(e):void 0}coerceNonDateScalarToMaybeNumber(e){if(e===tM)return 0;if("string"==typeof e){if(""===e)return 0;let t=this.coerceStringToMaybePercentNumber(e);if(void 0!==t)return t;let r=this.coerceStringToMaybeCurrencyNumber(e);return void 0!==r?r:this.numberLiteralsHelper.numericStringToMaybeNumber(e.trim())}return tP(e)?e:"boolean"==typeof e?Number(e):void 0}coerceStringToMaybePercentNumber(e){let t=e.trim();if(t.endsWith("%")){let e=t.slice(0,t.length-1).trim(),r=this.numberLiteralsHelper.numericStringToMaybeNumber(e);if(void 0!==r)return new tL(r/100)}}coerceStringToMaybeCurrencyNumber(e){let t=this.currencyMatcher(e.trim());if(void 0!==t){let[e,r]=t,n=this.numberLiteralsHelper.numericStringToMaybeNumber(r);if(void 0!==n)return new tk(n,e)}}currencyMatcher(e){for(let t of this.config.currencySymbol){if(e.startsWith(t))return[t,e.slice(t.length).trim()];if(e.endsWith(t))return[t,e.slice(0,e.length-t.length).trim()]}}coerceComplexExactRanges(e){let t=[];for(let r of e)if(r instanceof tF)t.push(r);else if(r!==tM){let e=this.coerceScalarToComplex(r);if(e instanceof rK)return e;t.push(e)}let r=[];for(let e of t)if(e instanceof tF){let t=this.manyToExactComplex(e.valuesFromTopLeftCorner());if(t instanceof rK)return t;r.push(...t)}else r.push(e);return r}coerceScalarToComplex(e){return e instanceof rK?e:e===tM?[0,0]:tP(e)?[tI(e),0]:"string"==typeof e?this.coerceStringToComplex(e):new rK(d.NUM,ej.ComplexNumberExpected)}ExtendedNumberFactory(e,t){let{type:r,format:n}=t;switch(r){case s.NUMBER_RAW:return e;case s.NUMBER_CURRENCY:return new tk(e,null!=n?n:this.config.currencySymbol[0]);case s.NUMBER_DATE:return new tO(e,n);case s.NUMBER_DATETIME:return new t_(e,n);case s.NUMBER_TIME:return new tH(e,n);case s.NUMBER_PERCENT:return new tL(e,n)}}buildRegex(e,t=!0){let r;e=this.normalizeString(e);let n=this.config.useWildcards,o=this.config.useRegularExpressions;if(o)try{RegExp(e)}catch(e){o=!1,n=!1}return(r=o?function(e,t){let r="";for(let n=0;n<e.length;n++){let o=e.charAt(n);np(o)||nf(o)||t?r+=o:r+=o.toLowerCase()}return r}(e,this.config.caseSensitive):n?function(e,t){let r="";for(let n=0;n<e.length;n++){let o=e.charAt(n);if("~"===o){if(n==e.length-1){r+="~";continue}let t=e.charAt(n+1);np(t)||nf(t)?r+="\\"+t:r+=t,n++}else np(o)?r+="."+o:nf(o)?r+="\\"+o:t?r+=o:r+=o.toLowerCase()}return r}(e,this.config.caseSensitive):function(e,t){let r="";for(let n=0;n<e.length;n++){let o=e.charAt(n);np(o)||nf(o)?r+="\\"+o:t?r+=o:r+=o.toLowerCase()}return r}(e,this.config.caseSensitive),this.config.matchWholeCell&&t)?RegExp("^("+r+")$"):RegExp(r)}normalizeString(e){return this.config.caseSensitive||(e=e.toLowerCase()),this.config.accentSensitive||(e=nS(e,"nfd").replace(/[\u0300-\u036f]/g,"")),e}compare(e,t){if("string"==typeof e||"string"==typeof t){let r="string"==typeof e?this.dateTimeHelper.dateStringToDateNumber(e):e,n="string"==typeof t?this.dateTimeHelper.dateStringToDateNumber(t):t;if(tP(r)&&tP(n))return this.floatCmp(r,n)}return(e===tM?e=nl(t):t===tM&&(t=nl(e)),"string"==typeof e&&"string"==typeof t)?this.stringCmp(e,t):"boolean"==typeof e&&"boolean"==typeof t?nc(na(e),na(t)):tP(e)&&tP(t)?this.floatCmp(e,t):e===tM&&t===tM?0:nc(rj(rq(e)),rj(rq(t)))}stringCmp(e,t){return this.collator.compare(e,t)}manyToNumbers(e,t){let r=[];for(let t of e)if(t instanceof tF)r.push(t);else{let e=tI(this.coerceScalarToNumberOrError(t));if(e instanceof rK)return e;r.push(e)}let n=[];for(let e of r)if(e instanceof tF){let r=t(e.valuesFromTopLeftCorner());if(r instanceof rK)return r;n.push(...r)}else n.push(e);return n}coerceStringToComplex(e){let t,r,n=nn.exec(e);return null===n?new rK(d.NUM,ej.ComplexNumberExpected):(t=void 0!==n[6]?"-"===n[1]?[0,-1]:[0,1]:this.parseComplexToken(n[1]+n[3],n[5]))instanceof rK||void 0===n[8]?t:(r=void 0!==n[14]?"-"===n[9]?[0,-1]:[0,1]:this.parseComplexToken(n[9]+n[11],n[13]))instanceof rK?r:""!==n[5]||""===n[13]?new rK(d.NUM,ej.ComplexNumberExpected):"+"===n[8]?[t[0]+r[0],t[1]+r[1]]:[t[0]-r[0],t[1]-r[1]]}parseComplexToken(e,t){let r=tI(this.coerceNonDateScalarToMaybeNumber(e));return void 0===r?new rK(d.NUM,ej.ComplexNumberExpected):""===t?[r,0]:[0,r]}}function ni([e,t],r){if(!isFinite(e)||!isFinite(t))return new rK(d.NUM,ej.NaN);if(r=null!=r?r:"i",0===t)return`${e}`;let n=`${-1===t||1===t?"":Math.abs(t)}${r}`;return 0===e?`${t<0?"-":""}${n}`:`${e}${t<0?"-":"+"}${n}`}function ns(e){return e instanceof tF?e:tF.fromScalar(e)}function na(e){return Number(e)}function nl(e){return"string"==typeof e?"":tP(e)?0:"boolean"!=typeof e&&tM}function nh(e){if(e instanceof rK||"boolean"==typeof e)return e;{if(e===tM)return!1;if(tP(e))return 0!==tI(e);let t=e.toUpperCase();return"TRUE"===t||"FALSE"!==t&&""!==t&&void 0}}function nd(e){return e instanceof rK||"string"==typeof e?e:e===tM?"":tP(e)?tI(e).toString():e?"TRUE":"FALSE"}function nu(e){return e===tM?0:e}function nc(e,t){let r=tI(e),n=tI(t);return r>n?1:r<n?-1:0}function ng(e){return isNaN(e)||e===1/0||e===-1/0}function np(e){return["*","?"].includes(e)}let nm=["{","}","[","]","(",")","<",">","=",".","+","-",",","\\","$","^","!"];function nf(e){return nm.includes(e)}function nb(e,t){let{type:r,format:n}=tD(e),{type:o,format:i}=tD(t);if(r===s.NUMBER_RAW)return{type:o,format:i};if(o===s.NUMBER_RAW)return{type:r,format:n};if((r===s.NUMBER_DATETIME||r===s.NUMBER_DATE)&&(o===s.NUMBER_DATETIME||o===s.NUMBER_DATE))return{type:s.NUMBER_RAW};if(r===s.NUMBER_TIME){if(o===s.NUMBER_DATE)return{type:s.NUMBER_DATETIME,format:`${i} ${n}`};if(o===s.NUMBER_DATETIME)return{type:s.NUMBER_DATETIME,format:i}}if(o===s.NUMBER_TIME){if(r===s.NUMBER_DATE)return{type:s.NUMBER_DATETIME,format:`${n} ${i}`};if(r===s.NUMBER_DATETIME)return{type:s.NUMBER_DATETIME,format:n}}return{type:r,format:n}}function nC(e,t){let{type:r,format:n}=tD(e),{type:o,format:i}=tD(t);return(r===s.NUMBER_PERCENT&&(r=s.NUMBER_RAW,n=void 0),o===s.NUMBER_PERCENT&&(o=s.NUMBER_RAW,i=void 0),r===s.NUMBER_RAW)?{type:o,format:i}:o===s.NUMBER_RAW?{type:r,format:n}:{type:s.NUMBER_RAW}}function ny(e){return nS(e.toLowerCase(),"nfd").replace(/[\u0300-\u036f]/g,"")}function nw(e,t){var r;if(e.isAdHoc())return null==(r=e.data[0])?void 0:r[0];let n=e.range;if(t.formulaAddress.sheet===n.sheet){if(1===n.width()){let r=t.formulaAddress.row-n.start.row;if(r>=0&&r<n.height())return e.data[r][0]}else if(1===n.height()){let r=t.formulaAddress.col-n.start.col;if(r>=0&&r<n.width())return e.data[0][r]}}}function nS(e,t){return e.normalize(t.toUpperCase())}(_=p||(p={})).STRING="STRING",_.NUMBER="NUMBER",_.BOOLEAN="BOOLEAN",_.SCALAR="SCALAR",_.NOERROR="NOERROR",_.RANGE="RANGE",_.INTEGER="INTEGER",_.COMPLEX="COMPLEX",_.ANY="ANY";class nv{constructor(e){this.coerceScalarToNumberOrError=e=>this.arithmeticHelper.coerceScalarToNumberOrError(e),this.runFunction=(e,t,r,n)=>{let o=this.evaluateArguments(e,t,r),i=o.map(([e])=>e),s=o.map(([,e])=>e),a=o.map(([,,e])=>e),l=this.buildMetadataForEachArgumentValue(i.length,r),h=t.arraysFlag&&!r.vectorizationForbidden;if(!this.isNumberOfArgumentValuesValid(l,i.length))return new rK(d.NA,ej.WrongArgNumber);let[u,c]=h?this.calculateSizeOfVectorizedResultArray(i,l):[1,1];if(1===u&&1===c){let e=this.vectorizeAndBroadcastArgumentsIfNecessary(h,i,l,0,0);return this.calculateSingleCellOfResultArray(t,e,l,s,a,n,r.returnNumberType)}let g=[...Array(u).keys()].map(e=>[...Array(c).keys()].map(o=>{let d=this.vectorizeAndBroadcastArgumentsIfNecessary(h,i,l,e,o),u=this.calculateSingleCellOfResultArray(t,d,l,s,a,n,r.returnNumberType);if(u instanceof tF)throw Error("Function returning array cannot be vectorized.");return u}));return tF.onlyValues(g)},this.runFunctionWithReferenceArgument=(e,t,r,n,i,s=()=>new rK(d.NA,ej.CellRefExpected))=>{let a;if(0===e.length)return this.returnNumberWrapper(n(),r.returnNumberType);if(e.length>1)return new rK(d.NA,ej.WrongArgNumber);let l=e[0];for(;l.type===o.PARENTHESIS;)l=l.expression;if(l.type===o.CELL_REFERENCE)a=l.reference.toSimpleCellAddress(t.formulaAddress);else if(l.type===o.CELL_RANGE||l.type===o.COLUMN_RANGE||l.type===o.ROW_RANGE)try{a=r8.fromAst(l,t.formulaAddress).start}catch(e){return new rK(d.REF,ej.CellRefExpected)}return void 0!==a?this.returnNumberWrapper(i(a),r.returnNumberType):this.runFunction(e,t,r,s)},this.interpreter=e,this.dependencyGraph=e.dependencyGraph,this.columnSearch=e.columnSearch,this.config=e.config,this.serialization=e.serialization,this.arraySizePredictor=e.arraySizePredictor,this.dateTimeHelper=e.dateTimeHelper,this.arithmeticHelper=e.arithmeticHelper}evaluateAst(e,t){return this.interpreter.evaluateAst(e,t)}arraySizeForAst(e,t){return this.arraySizePredictor.checkArraySizeForAst(e,t)}listOfScalarValues(e,t){let r=[];for(let n of e){let e=n.type===o.EMPTY,i=this.evaluateAst(n,t);if(i instanceof tF)for(let t of i.valuesFromTopLeftCorner())r.push([t,!0,e]);else r.push([i,!1,e])}return r}coerceToType(e,t,r){let n;if(e instanceof tF)switch(t.argumentType){case p.RANGE:case p.ANY:n=e;break;default:{let t=nw(e,r);if(void 0===t)return;e=t}}if(!(e instanceof tF))switch(t.argumentType){case p.INTEGER:case p.NUMBER:let o=this.coerceScalarToNumberOrError(e);if(!tP(o)){n=o;break}let i=tI(o);if(void 0!==t.maxValue&&i>t.maxValue)return new rK(d.NUM,ej.ValueLarge);if(void 0!==t.minValue&&i<t.minValue)return new rK(d.NUM,ej.ValueSmall);if(void 0!==t.lessThan&&i>=t.lessThan)return new rK(d.NUM,ej.ValueLarge);if(void 0!==t.greaterThan&&i<=t.greaterThan)return new rK(d.NUM,ej.ValueSmall);if(t.argumentType===p.INTEGER&&!Number.isInteger(i))return new rK(d.NUM,ej.IntegerExpected);n=o;break;case p.STRING:n=nd(e);break;case p.BOOLEAN:n=nh(e);break;case p.SCALAR:case p.NOERROR:case p.ANY:n=e;break;case p.RANGE:if(e instanceof rK)return e;n=ns(e);break;case p.COMPLEX:return this.arithmeticHelper.coerceScalarToComplex(tI(e))}return t.passSubtype||void 0===n?n:tI(n)}calculateSingleCellOfResultArray(e,t,r,n,o,i,s){let a=this.coerceArgumentsToRequiredTypes(e,t,r,n,o);if(a instanceof rK)return a;let l=i(...a);return this.returnNumberWrapper(l,s)}coerceArgumentsToRequiredTypes(e,t,r,n,o){let i=[];for(let s=0;s<r.length;s++){let a=r[s],l=t[s],h=void 0===l?null==a?void 0:a.defaultValue:o[s]&&(null==a?void 0:a.emptyAsDefault)&&(null==a?void 0:a.defaultValue)!==void 0?a.defaultValue:l;if(void 0===h){i.push(void 0);continue}let u=this.coerceToType(h,a,e);if(void 0===u&&!n[s])return new rK(d.VALUE,ej.WrongType);if(u instanceof rK&&a.argumentType!==p.SCALAR)return u;i.push(u)}return i}vectorizeAndBroadcastArgumentsIfNecessary(e,t,r,n,o){return t.map((t,i)=>e&&this.isRangePassedAsAScalarArgument(t,r[i])?this.vectorizeAndBroadcastRangeArgument(t,n,o):t)}vectorizeAndBroadcastRangeArgument(e,t,r){var n;let o=1===e.height()?0:t,i=1===e.width()?0:r;return null==(n=e.data[o])?void 0:n[i]}evaluateArguments(e,t,r){return r.expandRanges?this.listOfScalarValues(e,t):e.map(e=>[this.evaluateAst(e,t),!1,e.type===o.EMPTY])}buildMetadataForEachArgumentValue(e,t){let r=t.parameters?[...t.parameters]:[];if(void 0!==t.repeatLastArgs&&Number.isInteger(t.repeatLastArgs)&&t.repeatLastArgs>0)for(;e>r.length;)r.push(...r.slice(r.length-t.repeatLastArgs));return r}isNumberOfArgumentValuesValid(e,t){return!(t>e.length)&&(!(t<e.length)||e.slice(t).every(e=>(null==e?void 0:e.optionalArg)||(null==e?void 0:e.defaultValue)!==void 0))}calculateSizeOfVectorizedResultArray(e,t){let r=e.filter((e,r)=>this.isRangePassedAsAScalarArgument(e,t[r]));return[Math.max(1,...r.map(e=>e.height())),Math.max(1,...r.map(e=>e.width()))]}isRangePassedAsAScalarArgument(e,t){return null!=e&&null!=t&&e instanceof tF&&![p.RANGE,p.ANY].includes(t.argumentType)}metadata(e){let t=this.constructor.implementedFunctions[e];if(void 0!==t)return t;throw Error(`No metadata for function ${e}.`)}returnNumberWrapper(e,t,r){return void 0!==t&&tP(e)?this.arithmeticHelper.ExtendedNumberFactory(tI(e),{type:t,format:r}):e}}class nR{constructor(e,t,r=!1){this.width=e,this.height=t,this.isRef=r}static error(){return new nR(1,1,!0)}static scalar(){return new nR(1,1,!1)}isScalar(){return 1===this.width&&1===this.height||this.isRef}}class nE{constructor(e,t){this.config=e,this.functionRegistry=t}checkArraySize(e,t){return this.checkArraySizeForAst(e,{formulaAddress:t,arraysFlag:this.config.useArrayArithmetic})}checkArraySizeForAst(e,t){switch(e.type){case o.FUNCTION_CALL:return this.checkArraySizeForFunction(e,t);case o.COLUMN_RANGE:case o.ROW_RANGE:case o.CELL_RANGE:{let r=r8.fromAstOrUndef(e,t.formulaAddress);if(void 0===r)return nR.error();return new nR(r.width(),r.height(),!0)}case o.ARRAY:{let r=[],n=[];for(let o of e.args){let e=o.map(e=>this.checkArraySizeForAst(e,t)),i=Math.min(...e.map(e=>e.height)),s=e.reduce((e,t)=>e+t.width,0);r.push(i),n.push(s)}return new nR(Math.min(...n),r.reduce((e,t)=>e+t,0))}case o.STRING:case o.NUMBER:return nR.scalar();case o.CELL_REFERENCE:return new nR(1,1,!0);case o.DIV_OP:case o.CONCATENATE_OP:case o.EQUALS_OP:case o.GREATER_THAN_OP:case o.GREATER_THAN_OR_EQUAL_OP:case o.LESS_THAN_OP:case o.LESS_THAN_OR_EQUAL_OP:case o.MINUS_OP:case o.NOT_EQUAL_OP:case o.PLUS_OP:case o.POWER_OP:case o.TIMES_OP:{let r=this.checkArraySizeForAst(e.left,t),n=this.checkArraySizeForAst(e.right,t);if(!t.arraysFlag&&(r.height>1||r.width>1||n.height>1||n.width>1))return nR.error();return new nR(Math.max(r.width,n.width),Math.max(r.height,n.height))}case o.MINUS_UNARY_OP:case o.PLUS_UNARY_OP:case o.PERCENT_OP:{let r=this.checkArraySizeForAst(e.value,t);if(!t.arraysFlag&&(r.height>1||r.width>1))return nR.error();return new nR(r.width,r.height)}case o.PARENTHESIS:return this.checkArraySizeForAst(e.expression,t);case o.EMPTY:default:return nR.error()}}checkArraySizeForFunction(e,t){let r=this.functionRegistry.getArraySizeFunction(e.procedureName);if(void 0!==r)return r(e,t);let n=this.functionRegistry.getMetadata(e.procedureName);if(void 0===n||n.expandRanges||!t.arraysFlag||n.vectorizationForbidden||void 0===n.parameters)return new nR(1,1);let o=e.args.map(e=>{var r;return this.checkArraySizeForAst(e,new nr(t.formulaAddress,t.arraysFlag||null!=(r=null==n?void 0:n.enableArrayArithmeticForArguments)&&r))}),i=[...n.parameters];if(void 0!==n.repeatLastArgs&&i.length<o.length&&(o.length-i.length)%n.repeatLastArgs!=0)return nR.error();for(;i.length<o.length;){if(void 0===n.repeatLastArgs)return nR.error();i.push(...i.slice(i.length-n.repeatLastArgs))}let s=1,a=1;for(let e=0;e<o.length;e++)i[e].argumentType!==p.RANGE&&i[e].argumentType!==p.ANY&&(a=Math.max(a,o[e].height),s=Math.max(s,o[e].width));return new nR(s,a)}}class nT{constructor(e,t,r){var n;this.value=t,this.address=r,this.type=e.type,this.message=null!=(n=e.message)?n:""}toString(){return this.value}valueOf(){return this.value}}function nA(e,t,r){if(void 0===e)return im.defaultConfig[r];if("string"==typeof t)if(typeof e===t)return e;else throw new rt(t,r);if(t.includes(e))return e;throw new ri(t.map(e=>`'${e}'`).join(" "),r)}function nM(e,t,r){if(e<r)throw new rn(t,r)}function nI(e,t,r,n){if(t(e))return e;if(void 0===e)return im.defaultConfig[n];throw new rt(r,n)}function nx(...e){let t=new Map;e.forEach(e=>{let r=t.get(e.value)||[];r.push(e.name),t.set(e.value,r)});let r=[];for(let e of t.values())e.length>1&&r.push(e);if(r.length>0){r.forEach(e=>e.sort());let e=r.map(e=>`[${e}]`).join("; ");throw Error(`Config initialization failed. Parameters in conflict: ${e}`)}}function nN(e,t,r){if(typeof e!==t)throw new rt(t,r)}let nO=RegExp("^ss(\\.(s+|0+))?$"),nk=RegExp("^[0-9/.\\-: ]+[ap]?m?$"),nH=RegExp("\\s+"),n_=RegExp("[ /.-]"),nL=nB(function(e){let t=e.toLowerCase().trim(),r=(t.endsWith("am/pm")?t.substring(0,t.length-5):t.endsWith("a/p")?t.substring(0,e.length-3):t).trim().split(":");return{itemsCount:r.length,hourItem:r.indexOf("hh"),minuteItem:r.indexOf("mm"),secondItem:r.findIndex(e=>nO.test(e))}}),nP=nB(function(e){let t=e.toLowerCase().trim().split(n_);return{itemsCount:t.length,dayItem:t.indexOf("dd"),monthItem:t.indexOf("mm"),shortYearItem:t.indexOf("yy"),longYearItem:t.indexOf("yyyy")}});function nD(e,t){var r,n,o;let i;if(void 0===t)return;let{itemsCount:s,hourItem:a,minuteItem:l,secondItem:h}=nL(t);if("am"===e[e.length-1]||"a"===e[e.length-1]?(i=!1,e.pop()):("pm"===e[e.length-1]||"p"===e[e.length-1])&&(i=!0,e.pop()),e.length!==s)return;let d=Number(null!=(r=e[h])?r:"0");if(!Number.isFinite(d))return;let u=Math.round(1e3*d)/1e3,c=Number(null!=(n=e[l])?n:"0");if(!(Number.isFinite(c)&&Number.isInteger(c)))return;let g=Number(null!=(o=e[a])?o:"0");if(Number.isFinite(g)&&Number.isInteger(g)&&(void 0===i||!(g<0)&&!(g>12)))return{hours:void 0!==i?g%12+12*!!i:g,minutes:c,seconds:u}}function nF(e,t){var r;if(void 0===t)return;let{itemsCount:n,dayItem:o,monthItem:i,shortYearItem:s,longYearItem:a}=nP(t);if(e.length!==n)return;let l=Number(e[o]);if(!(Number.isFinite(l)&&Number.isInteger(l)))return;let h=Number(e[i]);if(!(Number.isFinite(h)&&Number.isInteger(h))||e[a]&&e[s])return;let d=Number(null!=(r=e[a])?r:e[s]);if(Number.isFinite(d)&&Number.isInteger(d)&&(!e[a]||!(d<1e3)&&!(d>9999))&&(!e[s]||!(d<0)&&!(d>99)))return{year:d,month:h,day:l}}function nB(e){let t={};return r=>{let n=t[r];if(void 0!==n)return n;let o=e(r);return t[r]=o,o}}let nV=[31,28,31,30,31,30,31,31,30,31,30,31],nU=[0,31,59,90,120,151,181,212,243,273,304,334];function nz(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"year"in e&&"number"==typeof e.year&&"month"in e&&"number"==typeof e.month&&"day"in e&&"number"==typeof e.day}function nW(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"hours"in e&&"number"==typeof e.hours&&"minutes"in e&&"number"==typeof e.minutes&&"seconds"in e&&"number"==typeof e.seconds}let nG={year:9999,month:12,day:31};class n${constructor(e){this.config=e,this.minDateAbsoluteValue=this.dateToNumberFromZero(e.nullDate),this.maxDateValue=this.dateToNumber(nG),this.leapYear1900=e.leapYear1900,!this.leapYear1900&&0<=this.dateToNumber({year:1900,month:2,day:28})?this.epochYearZero=this.numberToSimpleDate(2).year:this.epochYearZero=this.numberToSimpleDate(1).year,this.parseDateTime=e.parseDateTime}getWithinBounds(e){return e<=this.maxDateValue&&e>=0?e:void 0}dateStringToDateNumber(e){let{dateTime:t,dateFormat:r="",timeFormat:n=""}=this.parseDateTimeFromConfigFormats(e);if(void 0!==t)if(nW(t))if(nz(t))return new t_(nK(t)+this.dateToNumber(t),r+" "+n);else return new tH(nK(t),n);else if(nz(t))return new tO(this.dateToNumber(t),r);else return 0}parseDateTimeFromConfigFormats(e){return this.parseDateTimeFromFormats(e,this.config.dateFormats,this.config.timeFormats)}getNullYear(){return this.config.nullYear}getEpochYearZero(){return this.epochYearZero}isValidDate(e){if(isNaN(e.year)||isNaN(e.month)||isNaN(e.day)||e.day!==Math.round(e.day)||e.month!==Math.round(e.month)||e.year!==Math.round(e.year))return!1;if(e.year<1582)return!1;if(e.month<1||e.month>12)return!1;if(e.day<1)return!1;else if(this.isLeapYear(e.year)&&2===e.month)return e.day<=29;else return e.day<=nV[e.month-1]}dateToNumber(e){return this.dateToNumberFromZero(e)-this.minDateAbsoluteValue}relativeNumberToAbsoluteNumber(e){return e+this.minDateAbsoluteValue-!!this.leapYear1900}numberToSimpleDate(e){var t;let r,n=Math.floor(e)+this.minDateAbsoluteValue,o=Math.floor(n/365.2425);this.dateToNumberFromZero({year:o+1,month:1,day:1})<=n?o++:this.dateToNumberFromZero({year:o-1,month:1,day:1})>n&&o--;let i=n-this.dateToNumberFromZero({year:o,month:1,day:1}),s=(t=i-(this.isLeapYear(o)&&i>=59?1:0),r=0,nU[6]<=t&&(r+=6),nU[r+3]<=t&&(r+=3),nU[r+2]<=t?r+=2:nU[r+1]<=t&&(r+=1),r),a=i-nU[s]-(this.isLeapYear(o)&&s>1?1:0);return{year:o,month:s+1,day:a+1}}numberToSimpleDateTime(e){let t=nq(e%1),r=Math.floor(t.hours/24);return t.hours=t.hours%24,Object.assign(Object.assign({},this.numberToSimpleDate(Math.floor(e)+r)),t)}leapYearsCount(e){return Math.floor(e/4)-Math.floor(e/100)+Math.floor(e/400)+(this.config.leapYear1900&&e>=1900?1:0)}daysInMonth(e,t){return this.isLeapYear(e)&&2===t?29:nV[t-1]}endOfMonth(e){return{year:e.year,month:e.month,day:this.daysInMonth(e.year,e.month)}}toBasisUS(e,t){return 31===e.day&&(e.day=30),30===e.day&&31===t.day&&(t.day=30),2===e.month&&e.day===this.daysInMonth(e.year,e.month)&&(e.day=30,2===t.month&&t.day===this.daysInMonth(t.year,t.month)&&(t.day=30)),[e,t]}yearLengthForBasis(e,t){return e.year!==t.year?e.year+1!==t.year||e.month<t.month||e.month===t.month&&e.day<t.day?(this.leapYearsCount(t.year)-this.leapYearsCount(e.year-1))/(t.year-e.year+1)+365:this.countLeapDays(t)!==this.countLeapDays({year:e.year,month:e.month,day:e.day-1})?366:365:this.isLeapYear(e.year)?366:365}parseSingleFormat(e,t,r){let n=this.parseDateTime(e,t,r);if(!nz(n)||(n.year>=0&&n.year<100&&(n.year<this.getNullYear()?n.year+=2e3:n.year+=1900),this.isValidDate(n)))return n}parseDateTimeFromFormats(e,t,r){let n=0===t.length?[void 0]:t,o=0===r.length?[void 0]:r;for(let t of n)for(let r of o){let n=this.parseSingleFormat(e,t,r);if(void 0!==n)return{dateTime:n,timeFormat:r,dateFormat:t}}return{}}countLeapDays(e){return e.month>2||2===e.month&&e.day>=29?this.leapYearsCount(e.year):this.leapYearsCount(e.year-1)}dateToNumberFromZero(e){return 365*e.year+nU[e.month-1]+e.day-1+(e.month<=2?this.leapYearsCount(e.year-1):this.leapYearsCount(e.year))}isLeapYear(e){return!(e%4)&&(!!(e%100)||!(e%400)||1900===e&&this.config.leapYear1900)}}function nY(e,t){let r=12*e.year+e.month-1+t;return{year:Math.floor(r/12),month:r%12+1,day:e.day}}function nj(e){return Math.round(3600*e*24)/86400}function nq(e){let t=24*e*3600,r=function(e,t=1){return Math.round(e*t)/t}(t%60,1e5)%60,n=(t-r)/60,o=Math.round(n%60)%60;return{hours:Math.round((n-o)/60),minutes:o,seconds:r}}function nK(e){return((e.seconds/60+e.minutes)/60+e.hours)/24}function nX(e){return{year:e.year,month:e.month,day:Math.min(30,e.day)}}let nQ=/(\\.|dd|DD|d|D|mm|MM|m|M|YYYY|YY|yyyy|yy|HH|hh|H|h|ss(\.(0+|s+))?|s|AM\/PM|am\/pm|A\/P|a\/p|\[mm]|\[MM]|\[hh]|\[HH])/g,nZ=/(\\.|[#0]+(\.[#0]*)?)/g;function nJ(e,t){return{type:e,value:t}}function n0(e,t){let r=[],n=0;for(let o=0;o<e.length;++o){let i=e[o];if(i.index!==n){let e=t.substr(n,i.index-n);r.push(nJ(m.FREE_TEXT,e))}i[0].startsWith("\\")?r.push(nJ(m.FREE_TEXT,i[0])):r.push(nJ(m.FORMAT,i[0])),n=i.index+i[0].length}let o=e[e.length-1];if(o.index+o[0].length<t.length){let e=t.substr(o.index+o[0].length,t.length);r.push(nJ(m.FREE_TEXT,e))}return r}function n1(e){let t=function(e){let t;nQ.lastIndex=0;let r=[];do null!==(t=nQ.exec(e))&&r.push(t);while(t);return r}(e);if(!t.every(e=>n2(e)))return{type:f.DATE,tokens:n0(t,e)}}(L=m||(m={})).FORMAT="FORMAT",L.FREE_TEXT="FREE_TEXT",(P=f||(f={})).DATE="DATE",P.NUMBER="NUMBER",P.STRING="STRING";function n2(e){return e[0].startsWith("\\")}function n3(e,t){let r=`${e}`;for(;r.length<t;)r="0"+r;return r}function n6(e,t){return e.split(t).length-1}let n5="length",n4=e=>(e+"").replace(/\-/g,""),n9=e=>e.codePointAt(0)-65,n7={invalid:()=>"The license key for HyperFormula is invalid.",expired:({keyValidityDate:e})=>`The license key for HyperFormula expired on ${e}, and is not valid for the installed version.`,missing:()=>"The license key for HyperFormula is missing."},n8=!1;var oe=b||(b={});oe.Number=class{constructor(e){var t;this.value=e,this.value=tN(this.value,0===(t=tI(this.value))?0:t)}},oe.String=class{constructor(e){this.value=e}},oe.Boolean=class{constructor(e){this.value=e}};class ot{static getSingletonInstance(){return ot.instance||(ot.instance=new ot),ot.instance}}oe.Empty=ot,oe.Formula=class{constructor(e){this.formula=e}},oe.Error=class{constructor(e,t){this.value=new rK(e,t)}};class or{constructor(e,t,r){this.config=e,this.dateHelper=t,this.numberLiteralsHelper=r}parse(e){if(null==e)return b.Empty.getSingletonInstance();if("number"==typeof e)if(ng(e))return new b.Error(d.NUM,ej.ValueLarge);else return new b.Number(e);if("boolean"==typeof e)return new b.Boolean(e);if(e instanceof Date){let t=this.dateHelper.dateToNumber({day:e.getDate(),month:e.getMonth()+1,year:e.getFullYear()})+nK({hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds()+e.getMilliseconds()/1e3});return t<0?new b.Error(d.NUM,ej.DateBounds):new b.Number(t%1==0?new tO(t,"Date()"):t<1?new tH(t,"Date()"):new t_(t,"Date()"))}if("string"==typeof e){let r;if("true"===(r=e.toLowerCase())||"false"===r)return new b.Boolean("true"===e.toLowerCase());{var t;let r;if(e.startsWith("="))return new b.Formula(e);if(t=this.config.errorMapping,r=e.toUpperCase(),/#[A-Za-z0-9\/]+[?!]?/.test(r)&&Object.prototype.hasOwnProperty.call(t,r))return new b.Error(this.config.errorMapping[e.toUpperCase()]);let n,o=e.trim(),i=0;if(o.endsWith("%"))i=1,o=o.slice(0,o.length-1);else{let e=this.currencyMatcher(o);void 0!==e&&(i=2,[n,o]=e)}let s=this.numberLiteralsHelper.numericStringToMaybeNumber(o);if(void 0!==s){let e;return e=1===i?new tL(s/100):2===i?new tk(s,n):s,new b.Number(e)}let a=this.dateHelper.dateStringToDateNumber(o);return void 0!==a?new b.Number(a):new b.String(e.startsWith("'")?e.slice(1):e)}}else throw new re(e)}currencyMatcher(e){for(let t of this.config.currencySymbol){if(e.startsWith(t))return[t,e.slice(t.length)];if(e.endsWith(t))return[t,e.slice(0,e.length-t.length)]}}}(D=C||(C={}))[D.COPY=0]="COPY",D[D.CUT=1]="CUT",(F=y||(y={}))[F.VALUE=0]="VALUE",F[F.EMPTY=1]="EMPTY",F[F.FORMULA=2]="FORMULA",F[F.PARSING_ERROR=3]="PARSING_ERROR";class on{constructor(e,t,r,n,o){this.sourceLeftCorner=e,this.width=t,this.height=r,this.type=n,this.content=o}*getContent(e){if(void 0!==this.content)for(let t=0;t<this.height;++t)for(let r=0;r<this.width;++r)yield[r0(e.sheet,e.col+r,e.row+t),this.content[t][r]]}}class oo{constructor(e,t,r){this.dependencyGraph=t,this.operations=r,this.maxRows=e.maxRows,this.maxColumns=e.maxColumns}cut(e,t,r){this.clipboard=new on(e,t,r,C.CUT)}copy(e,t,r){let n=[];for(let o=0;o<r;++o){n[o]=[];for(let r=0;r<t;++r){let t=this.operations.getClipboardCell(r0(e.sheet,e.col+r,e.row+o));n[o].push(t)}}this.clipboard=new on(e,t,r,C.COPY,n)}abortCut(){this.clipboard&&this.clipboard.type===C.CUT&&this.clear()}clear(){this.clipboard=void 0}ensureItIsPossibleToCopyPaste(e){if(void 0===this.clipboard)return;if(r1(e)||!this.dependencyGraph.sheetMapping.hasSheetWithId(e.sheet))throw new t1("a valid target address.");let t=r8.spanFrom(e,this.clipboard.width,this.clipboard.height);if(t.exceedsSheetSizeLimits(this.maxColumns,this.maxRows))throw new tZ;if(this.dependencyGraph.arrayMapping.isFormulaArrayInRange(t))throw Error("It is not possible to paste onto an array")}isCutClipboard(){return void 0!==this.clipboard&&this.clipboard.type===C.CUT}isCopyClipboard(){return void 0!==this.clipboard&&this.clipboard.type===C.COPY}}class oi{performEagerTransformations(e,t){for(let r of e.arrayFormulaNodes()){let[n,o]=this.transformSingleAst(r.getFormula(e.lazilyTransformingAstService),r.getAddress(e.lazilyTransformingAstService)),i=t.rememberNewAst(n);r.setFormula(i),r.setAddress(o)}}transformSingleAst(e,t){return[this.transformAst(e,t),this.fixNodeAddress(t)]}transformAst(e,t){switch(e.type){case o.CELL_REFERENCE:return this.transformCellReferenceAst(e,t);case o.CELL_RANGE:return this.transformCellRangeAst(e,t);case o.COLUMN_RANGE:return this.transformColumnRangeAst(e,t);case o.ROW_RANGE:return this.transformRowRangeAst(e,t);case o.EMPTY:case o.ERROR:case o.NUMBER:case o.NAMED_EXPRESSION:case o.ERROR_WITH_RAW_INPUT:case o.STRING:return e;case o.PERCENT_OP:case o.MINUS_UNARY_OP:case o.PLUS_UNARY_OP:return Object.assign(Object.assign({},e),{value:this.transformAst(e.value,t)});case o.FUNCTION_CALL:return Object.assign(Object.assign({},e),{procedureName:e.procedureName,args:e.args.map(e=>this.transformAst(e,t))});case o.PARENTHESIS:return Object.assign(Object.assign({},e),{expression:this.transformAst(e.expression,t)});case o.ARRAY:return Object.assign(Object.assign({},e),{args:e.args.map(e=>e.map(e=>this.transformAst(e,t)))});default:return Object.assign(Object.assign({},e),{left:this.transformAst(e.left,t),right:this.transformAst(e.right,t)})}}transformCellReferenceAst(e,t){let r=this.transformCellAddress(e.reference,t);return r instanceof ea?Object.assign(Object.assign({},e),{reference:r}):r===d.REF?eB(new rK(d.REF)):e}transformCellRangeAst(e,t){let r=this.transformCellRange(e.start,e.end,t);return Array.isArray(r)?Object.assign(Object.assign({},e),{start:r[0],end:r[1]}):r===d.REF?eB(new rK(d.REF)):e}transformColumnRangeAst(e,t){let r=this.transformColumnRange(e.start,e.end,t);return Array.isArray(r)?Object.assign(Object.assign({},e),{start:r[0],end:r[1]}):r===d.REF?eB(new rK(d.REF)):e}transformRowRangeAst(e,t){let r=this.transformRowRange(e.start,e.end,t);return Array.isArray(r)?Object.assign(Object.assign({},e),{start:r[0],end:r[1]}):r===d.REF?eB(new rK(d.REF)):e}}class os extends oi{constructor(e){super(),this.columnsSpan=e}get sheet(){return this.columnsSpan.sheet}isIrreversible(){return!1}transformRowRangeAst(e,t){return e}transformCellRange(e,t,r){return this.transformRange(e,t,r)}transformRowRange(e,t,r){throw Error("Not implemented")}transformColumnRange(e,t,r){return this.transformRange(e,t,r)}transformCellAddress(e,t){let r=r5(e,t);if(r!==this.columnsSpan.sheet&&t.sheet!==this.columnsSpan.sheet)return!1;let n=e.toSimpleColumnAddress(t);if(r===this.columnsSpan.sheet&&t.sheet!==this.columnsSpan.sheet)if(this.columnsSpan.columnStart<=n.col)return e.shiftedByColumns(this.columnsSpan.numberOfColumns);else return!1;if(t.sheet===this.columnsSpan.sheet&&r!==this.columnsSpan.sheet)return!e.isColumnAbsolute()&&!(t.col<this.columnsSpan.columnStart)&&e.shiftedByColumns(-this.columnsSpan.numberOfColumns);if(e.isColumnAbsolute())if(e.col<this.columnsSpan.columnStart)return!1;else return e.shiftedByColumns(this.columnsSpan.numberOfColumns);if(e.toSimpleColumnAddress(t).col<this.columnsSpan.columnStart)if(t.col<this.columnsSpan.columnStart)return!1;else return e.shiftedByColumns(-this.columnsSpan.numberOfColumns);return!!(t.col<this.columnsSpan.columnStart)&&e.shiftedByColumns(this.columnsSpan.numberOfColumns)}fixNodeAddress(e){return this.columnsSpan.sheet===e.sheet&&this.columnsSpan.columnStart<=e.col?Object.assign(Object.assign({},e),{col:e.col+this.columnsSpan.numberOfColumns}):e}transformRange(e,t,r){let n=this.transformCellAddress(e,r),o=this.transformCellAddress(t,r);return n===d.REF||o===d.REF?d.REF:(!!n||!!o)&&[n||e,o||t]}}class oa extends oi{constructor(e){super(),this.rowsSpan=e}get sheet(){return this.rowsSpan.sheet}isIrreversible(){return!1}transformColumnRangeAst(e,t){return e}transformCellRange(e,t,r){return this.transformRange(e,t,r)}transformRowRange(e,t,r){return this.transformRange(e,t,r)}transformColumnRange(e,t,r){throw Error("Not implemented")}transformCellAddress(e,t){let r=r5(e,t);if(r!==this.rowsSpan.sheet&&t.sheet!==this.rowsSpan.sheet)return!1;let n=e.toSimpleRowAddress(t);if(r===this.rowsSpan.sheet&&t.sheet!==this.rowsSpan.sheet)if(this.rowsSpan.rowStart<=n.row)return e.shiftedByRows(this.rowsSpan.numberOfRows);else return!1;if(t.sheet===this.rowsSpan.sheet&&r!==this.rowsSpan.sheet)return!e.isRowAbsolute()&&!(t.row<this.rowsSpan.rowStart)&&e.shiftedByRows(-this.rowsSpan.numberOfRows);if(e.isRowAbsolute())if(e.row<this.rowsSpan.rowStart)return!1;else return e.shiftedByRows(this.rowsSpan.numberOfRows);if(n.row<this.rowsSpan.rowStart)if(t.row<this.rowsSpan.rowStart)return!1;else return e.shiftedByRows(-this.rowsSpan.numberOfRows);return!!(t.row<this.rowsSpan.rowStart)&&e.shiftedByRows(this.rowsSpan.numberOfRows)}fixNodeAddress(e){return this.rowsSpan.sheet===e.sheet&&this.rowsSpan.rowStart<=e.row?Object.assign(Object.assign({},e),{row:e.row+this.rowsSpan.numberOfRows}):e}transformRange(e,t,r){let n=this.transformCellAddress(e,r),o=this.transformCellAddress(t,r);return n===d.REF||o===d.REF?d.REF:(!!n||!!o)&&[n||e,o||t]}}class ol extends oi{constructor(e){super(),this.sheet=e}isIrreversible(){return!0}fixNodeAddress(e){return e}transformCellAddress(e,t){return!!e.isInvalid(t)&&d.REF}transformCellRange(e,t,r){return!!(e.isInvalid(r)||t.isInvalid(r))&&d.REF}transformColumnRange(e,t,r){return!!(e.isInvalid(r)||t.isInvalid(r))&&d.REF}transformRowRange(e,t,r){return!!(e.isInvalid(r)||t.isInvalid(r))&&d.REF}}class oh extends oi{constructor(e,t,r,n){super(),this.sourceRange=e,this.toRight=t,this.toBottom=r,this.toSheet=n,this.dependentFormulaTransformer=new od(e,t,r,n)}get sheet(){return this.sourceRange.sheet}isIrreversible(){return!0}transformSingleAst(e,t){return this.sourceRange.addressInRange(t)?[this.transformAst(e,t),this.fixNodeAddress(t)]:this.dependentFormulaTransformer.transformSingleAst(e,t)}fixNodeAddress(e){return r0(this.toSheet,e.col+this.toRight,e.row+this.toBottom)}transformCellAddress(e,t){return this.transformAddress(e,t)}transformCellRange(e,t,r){return this.transformRange(e,t,r)}transformColumnRange(e,t,r){return this.transformRange(e,t,r)}transformRowRange(e,t,r){return this.transformRange(e,t,r)}transformAddress(e,t){let r=this.sourceRange;if(e instanceof ea){let n=e.toSimpleCellAddress(t);if(r.addressInRange(n))return e.shiftAbsoluteDimensions(this.toRight,this.toBottom)}return e.shiftRelativeDimensions(-this.toRight,-this.toBottom)}transformRange(e,t,r){let n=this.sourceRange;if(e instanceof ea&&t instanceof ea){let o=e.toSimpleCellAddress(r),i=t.toSimpleCellAddress(r);if(n.addressInRange(o)&&n.addressInRange(i))return[e.shiftAbsoluteDimensions(this.toRight,this.toBottom),t.shiftAbsoluteDimensions(this.toRight,this.toBottom)]}return[e.shiftRelativeDimensions(-this.toRight,-this.toBottom),t.shiftRelativeDimensions(-this.toRight,-this.toBottom)]}}class od extends oi{constructor(e,t,r,n){super(),this.sourceRange=e,this.toRight=t,this.toBottom=r,this.toSheet=n}get sheet(){return this.sourceRange.sheet}isIrreversible(){return!0}fixNodeAddress(e){return e}transformCellAddress(e,t){return!!this.shouldMove(e,t)&&e.moved(this.toSheet,this.toRight,this.toBottom)}transformCellRange(e,t,r){return this.transformRange(e,t,r)}transformColumnRange(e,t,r){return this.transformRange(e,t,r)}transformRowRange(e,t,r){return this.transformRange(e,t,r)}shouldMove(e,t){return e instanceof ea?this.sourceRange.addressInRange(e.toSimpleCellAddress(t)):e instanceof es?this.sourceRange.rowInRange(e.toSimpleRowAddress(t))&&!this.sourceRange.isFinite():this.sourceRange.columnInRange(e.toSimpleColumnAddress(t))&&!this.sourceRange.isFinite()}transformRange(e,t,r){let n=this.transformCellAddress(e,r),o=this.transformCellAddress(t,r);return!!n&&!!o&&[n,o]}}class ou extends oi{constructor(e){super(),this.columnsSpan=e}get sheet(){return this.columnsSpan.sheet}isIrreversible(){return!0}transformRowRangeAst(e,t){return e}transformCellRange(e,t,r){return this.transformRange(e,t,r)}transformRowRange(e,t,r){throw Error("Not implemented")}transformColumnRange(e,t,r){return this.transformRange(e,t,r)}transformCellAddress(e,t){let r=r5(e,t);if(this.columnsSpan.sheet!==t.sheet&&this.columnsSpan.sheet!==r)return!1;if(this.columnsSpan.sheet!==t.sheet&&this.columnsSpan.sheet===r){let r=e.toSimpleColumnAddress(t);if(r.col<this.columnsSpan.columnStart)return!1;if(r.col>this.columnsSpan.columnEnd)return e.shiftedByColumns(-this.columnsSpan.numberOfColumns)}if(this.columnsSpan.sheet===t.sheet&&this.columnsSpan.sheet!==r){if(e.isColumnAbsolute())return!1;else if(t.col<this.columnsSpan.columnStart)return!1;else if(t.col>this.columnsSpan.columnEnd)return e.shiftedByColumns(this.columnsSpan.numberOfColumns)}if(this.columnsSpan.sheet===t.sheet&&this.columnsSpan.sheet===r)if(e.isColumnAbsolute()){if(e.col<this.columnsSpan.columnStart)return!1;else if(e.col>this.columnsSpan.columnEnd)return e.shiftedByColumns(-this.columnsSpan.numberOfColumns)}else{let r=e.toSimpleColumnAddress(t);if(r.col<this.columnsSpan.columnStart){if(t.col<this.columnsSpan.columnStart)return!1;else if(t.col>this.columnsSpan.columnEnd)return e.shiftedByColumns(this.columnsSpan.numberOfColumns)}else if(r.col>this.columnsSpan.columnEnd){if(t.col<this.columnsSpan.columnStart)return e.shiftedByColumns(-this.columnsSpan.numberOfColumns);else if(t.col>this.columnsSpan.columnEnd)return!1}}return d.REF}fixNodeAddress(e){return this.columnsSpan.sheet===e.sheet&&this.columnsSpan.columnStart<=e.col?Object.assign(Object.assign({},e),{col:e.col-this.columnsSpan.numberOfColumns}):e}transformRange(e,t,r){let n=r5(e,r),o=e,i=t;if(this.columnsSpan.sheet===n){let n=e.toSimpleColumnAddress(r),s=t.toSimpleColumnAddress(r);if(this.columnsSpan.columnStart<=n.col&&this.columnsSpan.columnEnd>=s.col)return d.REF;n.col>=this.columnsSpan.columnStart&&n.col<=this.columnsSpan.columnEnd&&(o=e.shiftedByColumns(this.columnsSpan.columnEnd-n.col+1)),s.col>=this.columnsSpan.columnStart&&s.col<=this.columnsSpan.columnEnd&&(i=t.shiftedByColumns(-(s.col-this.columnsSpan.columnStart+1)))}let s=this.transformCellAddress(o,r),a=this.transformCellAddress(i,r);if(!1===s&&!1===a)return[o,i];if(s!==d.REF&&a!==d.REF)return[s||o,a||i];throw Error("Cannot happen")}}class oc extends oi{constructor(e){super(),this.rowsSpan=e}get sheet(){return this.rowsSpan.sheet}isIrreversible(){return!0}transformColumnRangeAst(e,t){return e}transformCellAddress(e,t){let r=r5(e,t);if(this.rowsSpan.sheet!==t.sheet&&this.rowsSpan.sheet!==r)return!1;if(this.rowsSpan.sheet!==t.sheet&&this.rowsSpan.sheet===r){let r=e.toSimpleRowAddress(t);if(r.row<this.rowsSpan.rowStart)return!1;if(r.row>this.rowsSpan.rowEnd)return e.shiftedByRows(-this.rowsSpan.numberOfRows)}if(this.rowsSpan.sheet===t.sheet&&this.rowsSpan.sheet!==r){if(e.isRowAbsolute())return!1;else if(t.row<this.rowsSpan.rowStart)return!1;else if(t.row>this.rowsSpan.rowEnd)return e.shiftedByRows(this.rowsSpan.numberOfRows)}if(this.rowsSpan.sheet===t.sheet&&this.rowsSpan.sheet===r)if(e.isRowAbsolute()){if(e.row<this.rowsSpan.rowStart)return!1;else if(e.row>this.rowsSpan.rowEnd)return e.shiftedByRows(-this.rowsSpan.numberOfRows)}else{let r=e.toSimpleRowAddress(t);if(r.row<this.rowsSpan.rowStart){if(t.row<this.rowsSpan.rowStart)return!1;else if(t.row>this.rowsSpan.rowEnd)return e.shiftedByRows(this.rowsSpan.numberOfRows)}else if(r.row>this.rowsSpan.rowEnd){if(t.row<this.rowsSpan.rowStart)return e.shiftedByRows(-this.rowsSpan.numberOfRows);else if(t.row>this.rowsSpan.rowEnd)return!1}}return d.REF}transformCellRange(e,t,r){return this.transformRange(e,t,r)}transformRowRange(e,t,r){return this.transformRange(e,t,r)}transformColumnRange(e,t,r){throw Error("Not implemented")}fixNodeAddress(e){return this.rowsSpan.sheet===e.sheet&&this.rowsSpan.rowStart<=e.row?Object.assign(Object.assign({},e),{row:e.row-this.rowsSpan.numberOfRows}):e}transformRange(e,t,r){let n=r5(e,r),o=e,i=t;if(this.rowsSpan.sheet===n){let n=e.toSimpleRowAddress(r),s=t.toSimpleRowAddress(r);if(this.rowsSpan.rowStart<=n.row&&this.rowsSpan.rowEnd>=s.row)return d.REF;n.row>=this.rowsSpan.rowStart&&n.row<=this.rowsSpan.rowEnd&&(o=e.shiftedByRows(this.rowsSpan.rowEnd-n.row+1)),s.row>=this.rowsSpan.rowStart&&s.row<=this.rowsSpan.rowEnd&&(i=t.shiftedByRows(-(s.row-this.rowsSpan.rowStart+1)))}let s=this.transformCellAddress(o,r),a=this.transformCellAddress(i,r);return!1===s&&!1===a?[o,i]:s===d.REF||a===d.REF?d.REF:[s||o,a||i]}}class og extends oi{constructor(e,t){super(),this.sheetIdToKeep=e,this.sheetBeingMerged=t}get sheet(){return this.sheetIdToKeep}isIrreversible(){return!0}transformCellAddress(e,t){return this.updateSheetInAddress(e)}transformCellRange(e,t,r){return this.transformRange(e,t)}transformColumnRange(e,t,r){return this.transformRange(e,t)}transformRowRange(e,t,r){return this.transformRange(e,t)}fixNodeAddress(e){return e}transformRange(e,t){let r=this.updateSheetInAddress(e),n=this.updateSheetInAddress(t);return(!!r||!!n)&&[r||e,n||t]}updateSheetInAddress(e){return e.sheet===this.sheetBeingMerged&&e.withSheet(this.sheetIdToKeep)}}class op{constructor(e,t){this.sheet=e,this.indexes=t}normalizedIndexes(){return oy(this.indexes)}rowsSpans(){return this.normalizedIndexes().map(e=>t$.fromNumberOfRows(this.sheet,e[0],e[1]))}}class om{constructor(e,t){this.sheet=e,this.indexes=t}normalizedIndexes(){return ow(this.indexes)}rowsSpans(){return this.normalizedIndexes().map(e=>t$.fromNumberOfRows(this.sheet,e[0],e[1]))}}class of{constructor(e,t){this.sheet=e,this.indexes=t}normalizedIndexes(){return ow(this.indexes)}columnsSpans(){return this.normalizedIndexes().map(e=>tY.fromNumberOfColumns(this.sheet,e[0],e[1]))}}class ob{constructor(e,t){this.sheet=e,this.indexes=t}normalizedIndexes(){return oy(this.indexes)}columnsSpans(){return this.normalizedIndexes().map(e=>tY.fromNumberOfColumns(this.sheet,e[0],e[1]))}}class oC{constructor(e,t,r,n,o,i,s,a,l){this.dependencyGraph=t,this.columnSearch=r,this.cellContentParser=n,this.parser=o,this.stats=i,this.lazilyTransformingAstService=s,this.namedExpressions=a,this.arraySizePredictor=l,this.changes=tB.empty(),this.allocateNamedExpressionAddressSpace(),this.maxColumns=e.maxColumns,this.maxRows=e.maxRows}get sheetMapping(){return this.dependencyGraph.sheetMapping}get addressMapping(){return this.dependencyGraph.addressMapping}removeRows(e){let t=[];for(let r of e.rowsSpans()){let e=this.doRemoveRows(r);e&&t.push(e)}return t}addRows(e){for(let t of e.rowsSpans())this.doAddRows(t)}addColumns(e){for(let t of e.columnsSpans())this.doAddColumns(t)}removeColumns(e){let t=[];for(let r of e.columnsSpans()){let e=this.doRemoveColumns(r);e&&t.push(e)}return t}clearSheet(e){this.dependencyGraph.clearSheet(e),this.columnSearch.removeSheet(e)}addSheet(e){let t=this.sheetMapping.addSheet(e);return this.dependencyGraph.addSheet(t),{sheetName:this.sheetMapping.getSheetNameOrThrowError(t),sheetId:t}}addSheetWithId(e,t){this.sheetMapping.addSheetWithId(e,t),this.dependencyGraph.addSheet(e)}addPlaceholderSheetWithId(e,t){this.sheetMapping.addPlaceholderWithId(e,t),this.addressMapping.addSheetStrategyPlaceholderIfNotExists(e)}removeSheet(e){return this.dependencyGraph.removeSheet(e),this.columnSearch.removeSheet(e),this.namedExpressions.getAllNamedExpressionsForScope(e).map(t=>this.removeNamedExpression(t.normalizeExpressionName(),e))}removeSheetByName(e){let t=this.sheetMapping.getSheetIdOrThrowError(e);return this.removeSheet(t)}renameSheet(e,t){let r,{previousDisplayName:n,mergedWithPlaceholderSheet:o}=this.sheetMapping.renameSheet(e,t);return void 0!==o&&(this.dependencyGraph.mergeSheets(e,o),this.stats.measure(a.TRANSFORM_ASTS,()=>{let t=new og(e,o);t.performEagerTransformations(this.dependencyGraph,this.parser),r=this.lazilyTransformingAstService.addTransformation(t)})),{previousDisplayName:n,version:r,mergedPlaceholderSheetId:o}}moveRows(e,t,r,n){let o=t$.fromNumberOfRows(e,n,r);this.lazilyTransformingAstService.beginCombinedMode(e),this.doAddRows(o),n<t&&(t+=r);let i=r0(e,0,t),s=r0(e,0,n);this.moveCells(i,1/0,r,s);let a=t$.fromNumberOfRows(e,t,r);return this.doRemoveRows(a),this.lazilyTransformingAstService.commitCombinedMode()}moveColumns(e,t,r,n){let o=tY.fromNumberOfColumns(e,n,r);this.lazilyTransformingAstService.beginCombinedMode(e),this.doAddColumns(o),n<t&&(t+=r);let i=r0(e,t,0),s=r0(e,n,0);this.moveCells(i,r,1/0,s);let a=tY.fromNumberOfColumns(e,t,r);return this.doRemoveColumns(a),this.lazilyTransformingAstService.commitCombinedMode()}moveCells(e,t,r,n){this.ensureItIsPossibleToMoveCells(e,t,r,n);let o=r8.spanFrom(e,t,r),i=r8.spanFrom(n,t,r),s=n.col-e.col,l=n.row-e.row,h=n.sheet,d=this.getRangeClipboardCells(i),u=this.dependencyGraph.rawValuesFromRange(i);this.columnSearch.removeValues(u);let c=this.dependencyGraph.rawValuesFromRange(o);this.columnSearch.moveValues(c,s,l,h);let g=0;this.stats.measure(a.TRANSFORM_ASTS,()=>{let e=new oh(o,s,l,h);e.performEagerTransformations(this.dependencyGraph,this.parser),g=this.lazilyTransformingAstService.addTransformation(e)}),this.dependencyGraph.moveCells(o,s,l,h);let p=this.updateNamedExpressionsForMovedCells(e,t,r,n);return{version:g,overwrittenCellsData:d,addedGlobalNamedExpressions:p}}setRowOrder(e,t){let r=[],n=[];for(let[o,i]of t)if(o!==i){let t=r8.spanFrom({sheet:e,col:0,row:o},1/0,1),s=this.getRangeClipboardCells(t);n=n.concat(s),r.push(s.map(([{sheet:e,col:t},r])=>[{sheet:e,col:t,row:i},r]))}return r.forEach(t=>this.restoreClipboardCells(e,t.values())),n}setColumnOrder(e,t){let r=[],n=[];for(let[o,i]of t)if(o!==i){let t=r8.spanFrom({sheet:e,col:o,row:0},1,1/0),s=this.getRangeClipboardCells(t);n=n.concat(s),r.push(s.map(([{sheet:e,col:t,row:r},n])=>[{sheet:e,col:i,row:r},n]))}return r.forEach(t=>this.restoreClipboardCells(e,t.values())),n}addNamedExpression(e,t,r,n){let o=this.namedExpressions.addNamedExpression(e,r,n);this.storeNamedExpressionInCell(o.address,t),this.adjustNamedExpressionEdges(o,e,r)}restoreNamedExpression(e,t,r){let n=e.displayName;this.restoreCell(e.address,t);let o=this.namedExpressions.restoreNamedExpression(e,r);this.adjustNamedExpressionEdges(o,n,r)}changeNamedExpressionExpression(e,t,r,n){let o=this.namedExpressions.namedExpressionForScope(e,r);if(!o)throw new t5(e);let i=o.copy();o.options=n;let s=this.getClipboardCell(o.address);return this.storeNamedExpressionInCell(o.address,t),[i,s]}removeNamedExpression(e,t){let r=this.namedExpressions.namedExpressionForScope(e,t);if(!r)throw new t5(e);this.namedExpressions.remove(r.displayName,t);let n=this.getClipboardCell(r.address);if(void 0!==t){let t=this.namedExpressions.workbookNamedExpressionOrPlaceholder(e);this.dependencyGraph.exchangeNode(r.address,t.address)}else this.dependencyGraph.setCellEmpty(r.address);return[r,n]}ensureItIsPossibleToMoveCells(e,t,r,n){var o,i,s;if(r1(e)||!(oS(t)&&oS(r)||(o=e,i=t,s=r,0===o.row&&oS(i)&&s===1/0||0===o.col&&oS(s)&&i===1/0))||r1(n)||!this.sheetMapping.hasSheetWithId(e.sheet)||!this.sheetMapping.hasSheetWithId(n.sheet))throw new t1("a valid range of cells to move.");let a=r8.spanFrom(e,t,r),l=r8.spanFrom(n,t,r);if(l.exceedsSheetSizeLimits(this.maxColumns,this.maxRows))throw new tZ;if(this.dependencyGraph.arrayMapping.isFormulaArrayInRange(a))throw new rg;if(this.dependencyGraph.arrayMapping.isFormulaArrayInRange(l))throw new rp}restoreClipboardCells(e,t){let r=[];for(let[n,o]of t)if(this.restoreCell(n,o),o.type===y.FORMULA){let{dependencies:t}=this.parser.fetchCachedResult(o.hash);r.push(...this.updateNamedExpressionsForTargetAddress(e,n,t))}return r}restoreCell(e,t){switch(t.type){case y.VALUE:this.setValueToCell(t,e);break;case y.FORMULA:this.setFormulaToCellFromCache(t.hash,e);break;case y.EMPTY:this.setCellEmpty(e);break;case y.PARSING_ERROR:this.setParsingErrorToCell(t.rawInput,t.errors,e)}}getOldContent(e){let t=this.dependencyGraph.getCell(e);if(void 0===t||t instanceof rV)return[e,{type:y.EMPTY}];if(t instanceof rU)return[e,Object.assign({type:y.VALUE},t.getValues())];if(t instanceof rE)return[t.getAddress(this.lazilyTransformingAstService),{type:y.FORMULA,hash:this.parser.computeHashFromAst(t.getFormula(this.lazilyTransformingAstService))}];if(t instanceof rz)return[e,{type:y.PARSING_ERROR,rawInput:t.rawInput,errors:t.errors}];throw Error("Trying to copy unsupported type")}getClipboardCell(e){let t=this.dependencyGraph.getCell(e);if(void 0===t||t instanceof rV)return{type:y.EMPTY};if(t instanceof rU)return Object.assign({type:y.VALUE},t.getValues());if(t instanceof rT){let r=t.getArrayCellValue(e);return r===tM?{type:y.EMPTY}:{type:y.VALUE,parsedValue:r,rawValue:t.getArrayCellRawValue(e)}}if(t instanceof rA)return{type:y.FORMULA,hash:this.parser.computeHashFromAst(t.getFormula(this.lazilyTransformingAstService))};if(t instanceof rz)return{type:y.PARSING_ERROR,rawInput:t.rawInput,errors:t.errors};throw Error("Trying to copy unsupported type")}getSheetClipboardCells(e){let t=this.dependencyGraph.getSheetHeight(e),r=this.dependencyGraph.getSheetWidth(e),n=Array(t);for(let o=0;o<t;o++){n[o]=Array(r);for(let t=0;t<r;t++){let r=r0(e,t,o);n[o][t]=this.getClipboardCell(r)}}return n}getRangeClipboardCells(e){let t=[];for(let r of e.addresses(this.dependencyGraph))t.push([r,this.getClipboardCell(r)]);return t}setCellContent(e,t){let r=this.cellContentParser.parse(t),o=this.getOldContent(e);if(r instanceof b.Formula){let t=this.parser.parse(r.formula,e),{ast:o,errors:i}=t;if(i.length>0)this.setParsingErrorToCell(r.formula,i,e);else try{let r=this.arraySizePredictor.checkArraySize(o,e);if(r.width<=0||r.height<=0)throw Error("Incorrect array size");this.setFormulaToCell(e,r,t)}catch(o){if(!o.message)throw o;let t={type:n.InvalidRangeSize,message:"Invalid range size."};this.setParsingErrorToCell(r.formula,[t],e)}}else r instanceof b.Empty?this.setCellEmpty(e):this.setValueToCell({parsedValue:r.value,rawValue:t},e);return o}setSheetContent(e,t){this.clearSheet(e);for(let r=0;r<t.length;r++)for(let n=0;n<t[r].length;n++){let o=r0(e,n,r);this.setCellContent(o,t[r][n])}}setParsingErrorToCell(e,t,r){this.removeCellValueFromColumnSearch(r);let n=new rz(t,e),o=this.dependencyGraph.setParsingErrorToCell(r,n);this.columnSearch.applyChanges(o.getChanges()),this.changes.addAll(o),this.changes.addChange(n.getCellValue(),r)}setFormulaToCell(e,t,{ast:r,hasVolatileFunction:n,hasStructuralChangeFunction:o,dependencies:i}){this.removeCellValueFromColumnSearch(e);let s=this.dependencyGraph.setFormulaToCell(e,r,tA(i,e),t,n,o);this.columnSearch.applyChanges(s.getChanges()),this.changes.addAll(s)}setValueToCell(e,t){this.changeCellValueInColumnSearch(t,e.parsedValue);let r=this.dependencyGraph.setValueToCell(t,e);this.columnSearch.applyChanges(r.getChanges().filter(e=>!r4(e.address,t))),this.changes.addAll(r),this.changes.addChange(e.parsedValue,t)}setCellEmpty(e){if(this.dependencyGraph.isArrayInternalCell(e))return;this.removeCellValueFromColumnSearch(e);let t=this.dependencyGraph.setCellEmpty(e);this.columnSearch.applyChanges(t.getChanges()),this.changes.addAll(t),this.changes.addChange(tM,e)}setFormulaToCellFromCache(e,t){let{ast:r,hasVolatileFunction:n,hasStructuralChangeFunction:o,dependencies:i}=this.parser.fetchCachedResult(e),s=tA(i,t),[a]=new ol(t.sheet).transformSingleAst(r,t);this.parser.rememberNewAst(a);let l=s.filter(e=>e instanceof tT||(e instanceof r8?!(r1(e.start)||r1(e.end)):!r1(e))),h=this.arraySizePredictor.checkArraySize(r,t);this.dependencyGraph.setFormulaToCell(t,a,l,h,n,o)}rowEffectivelyNotInSheet(e,t){return e>=this.dependencyGraph.addressMapping.getSheetHeight(t)}getAndClearContentChanges(){let e=this.changes;return this.changes=tB.empty(),e}forceApplyPostponedTransformations(){this.dependencyGraph.forceApplyPostponedTransformations(),this.columnSearch.forceApplyPostponedTransformations()}doRemoveRows(e){if(this.rowEffectivelyNotInSheet(e.rowStart,e.sheet))return;let t=[];for(let[r]of this.dependencyGraph.entriesFromRowsSpan(e))t.push({address:r,cellType:this.getClipboardCell(r)});let{affectedArrays:r,contentChanges:n}=this.dependencyGraph.removeRows(e);this.columnSearch.applyChanges(n.getChanges());let o=0;return this.stats.measure(a.TRANSFORM_ASTS,()=>{let t=new oc(e);t.performEagerTransformations(this.dependencyGraph,this.parser),o=this.lazilyTransformingAstService.addTransformation(t)}),this.rewriteAffectedArrays(r),{version:o,removedCells:t,rowFrom:e.rowStart,rowCount:e.numberOfRows}}doRemoveColumns(e){if(this.columnEffectivelyNotInSheet(e.columnStart,e.sheet))return;let t=[];for(let[r]of this.dependencyGraph.entriesFromColumnsSpan(e))t.push({address:r,cellType:this.getClipboardCell(r)});let{affectedArrays:r,contentChanges:n}=this.dependencyGraph.removeColumns(e);this.columnSearch.applyChanges(n.getChanges()),this.columnSearch.removeColumns(e);let o=0;return this.stats.measure(a.TRANSFORM_ASTS,()=>{let t=new ou(e);t.performEagerTransformations(this.dependencyGraph,this.parser),o=this.lazilyTransformingAstService.addTransformation(t)}),this.rewriteAffectedArrays(r),{version:o,removedCells:t,columnFrom:e.columnStart,columnCount:e.numberOfColumns}}doAddRows(e){if(this.rowEffectivelyNotInSheet(e.rowStart,e.sheet))return;let{affectedArrays:t}=this.dependencyGraph.addRows(e);this.stats.measure(a.TRANSFORM_ASTS,()=>{let t=new oa(e);t.performEagerTransformations(this.dependencyGraph,this.parser),this.lazilyTransformingAstService.addTransformation(t)}),this.rewriteAffectedArrays(t)}rewriteAffectedArrays(e){for(let t of e.values()){if(t.array.size.isRef)continue;let e=t.getFormula(this.lazilyTransformingAstService),r=t.getAddress(this.lazilyTransformingAstService),n=this.parser.computeHashFromAst(e);this.setFormulaToCellFromCache(n,r)}}doAddColumns(e){if(this.columnEffectivelyNotInSheet(e.columnStart,e.sheet))return;let{affectedArrays:t,contentChanges:r}=this.dependencyGraph.addColumns(e);this.columnSearch.addColumns(e),this.columnSearch.applyChanges(r.getChanges()),this.stats.measure(a.TRANSFORM_ASTS,()=>{let t=new os(e);t.performEagerTransformations(this.dependencyGraph,this.parser),this.lazilyTransformingAstService.addTransformation(t)}),this.rewriteAffectedArrays(t)}columnEffectivelyNotInSheet(e,t){return e>=this.dependencyGraph.addressMapping.getSheetWidth(t)}adjustNamedExpressionEdges(e,t,r){if(void 0===r)return;let{vertex:n,id:o}=this.dependencyGraph.fetchCellOrCreateEmpty(e.address),i=null!=o?o:n.idInGraph,s=this.namedExpressions.workbookNamedExpressionOrPlaceholder(t),{vertex:a,id:l}=this.dependencyGraph.fetchCellOrCreateEmpty(s.address),h=null!=l?l:a.idInGraph;for(let t of this.dependencyGraph.graph.adjacentNodes(a))if(t instanceof rA&&t.getAddress(this.lazilyTransformingAstService).sheet===r){let r=t.getFormula(this.lazilyTransformingAstService),n=t.getAddress(this.lazilyTransformingAstService),{dependencies:o}=this.parser.fetchCachedResultForAst(r);for(let r of tA(o,n))r instanceof tT&&r.name.toLowerCase()===e.displayName.toLowerCase()&&(this.dependencyGraph.graph.removeEdgeIfExists(h,t),this.dependencyGraph.graph.addEdge(i,t))}}storeNamedExpressionInCell(e,t){let r=this.cellContentParser.parse(t);if(r instanceof b.Formula){let t=this.parser.parse(r.formula,r0(-1,0,0));if(tG(t.ast))throw new rm;let{ast:n,hasVolatileFunction:o,hasStructuralChangeFunction:i,dependencies:s}=t;this.dependencyGraph.setFormulaToCell(e,n,tA(s,e),nR.scalar(),o,i)}else r instanceof b.Empty?this.setCellEmpty(e):this.setValueToCell({parsedValue:r.value,rawValue:t},e)}updateNamedExpressionsForMovedCells(e,t,r,n){if(e.sheet===n.sheet)return[];let o=[];for(let i of r8.spanFrom(n,t,r).addresses(this.dependencyGraph)){let t=this.addressMapping.getCell(i,{throwIfCellNotExists:!0});if(t instanceof rA&&i.sheet!==e.sheet){let r=t.getFormula(this.lazilyTransformingAstService),{dependencies:n}=this.parser.fetchCachedResultForAst(r);o.push(...this.updateNamedExpressionsForTargetAddress(e.sheet,i,n))}}return o}updateNamedExpressionsForTargetAddress(e,t,r){if(e===t.sheet)return[];let n=[],o=this.addressMapping.getCellOrThrow(t);for(let i of tA(r,t)){if(!(i instanceof tT))continue;let r=i.name,s=this.dependencyGraph.fetchNamedExpressionVertex(r,e).vertex,a=this.namedExpressions.isExpressionInScope(r,t.sheet)?this.dependencyGraph.fetchNamedExpressionVertex(r,t.sheet).vertex:this.copyOrFetchGlobalNamedExpressionVertex(r,s,n);a!==s&&(this.dependencyGraph.graph.removeEdgeIfExists(s,o),this.dependencyGraph.graph.addEdge(a,o))}return n}allocateNamedExpressionAddressSpace(){this.dependencyGraph.addressMapping.addSheetWithStrategy(tW.SHEET_FOR_WORKBOOK_EXPRESSIONS,new rW(0,0))}copyOrFetchGlobalNamedExpressionVertex(e,t,r){let n=this.namedExpressions.namedExpressionForScope(e);if(void 0===n)if(n=this.namedExpressions.addNamedExpression(e),r.push(n.normalizeExpressionName()),t instanceof rA){let{ast:e,hasVolatileFunction:r,hasStructuralChangeFunction:o,dependencies:i}=this.parser.fetchCachedResultForAst(t.getFormula(this.lazilyTransformingAstService));this.dependencyGraph.setFormulaToCell(n.address,e,tA(i,n.address),nR.scalar(),r,o)}else t instanceof rV?this.setCellEmpty(n.address):t instanceof rU&&this.setValueToCell(t.getValues(),n.address);return this.dependencyGraph.fetchCellOrCreateEmpty(n.address).vertex}removeCellValueFromColumnSearch(e){if(this.isNotComputed(e))return;let t=this.dependencyGraph.getCellValue(e);this.columnSearch.remove(tI(t),e)}changeCellValueInColumnSearch(e,t){if(this.isNotComputed(e))return;let r=this.dependencyGraph.getCellValue(e);this.columnSearch.change(tI(r),tI(t),e)}isNotComputed(e){let t=this.dependencyGraph.getCell(e);return!!t&&t instanceof rE&&!t.isComputed()}}function oy(e){if(e.length<=1)return e;let t=[...e].sort(([e],[t])=>e-t),r=t.reduce((e,[t,r])=>{let n=e[e.length-1],o=n[0]+n[1];return t<=o?n[1]+=Math.max(0,r-(o-t)):e.push([t,r]),e},[t[0]]),n=0;for(let e=0;e<r.length;++e)r[e][0]-=n,n+=r[e][1];return r}function ow(e){if(e.length<=1)return e;let t=[...e].sort(([e],[t])=>e-t),r=t.reduce((e,[t,r])=>{let n=e[e.length-1];return t===n[0]?n[1]=Math.max(n[1],r):e.push([t,r]),e},[t[0]]),n=0;for(let e=0;e<r.length;++e)r[e][0]+=n,n+=r[e][1];return r}function oS(e){return Number.isInteger(e)&&e>0}class ov{getReferencedOldDataVersions(){return[]}}class oR extends ov{constructor(e,t){super(),this.command=e,this.rowsRemovals=t}doUndo(e){e.undoRemoveRows(this)}doRedo(e){e.redoRemoveRows(this)}getReferencedOldDataVersions(){return this.rowsRemovals.filter(e=>e.version>0).map(e=>e.version-1)}}class oE extends ov{constructor(e,t,r,n,o,i,s){super(),this.sourceLeftCorner=e,this.width=t,this.height=r,this.destinationLeftCorner=n,this.overwrittenCellsData=o,this.addedGlobalNamedExpressions=i,this.version=s}doUndo(e){e.undoMoveCells(this)}doRedo(e){e.redoMoveCells(this)}getReferencedOldDataVersions(){return this.version>0?[this.version-1]:[]}}class oT extends ov{constructor(e){super(),this.command=e}doUndo(e){e.undoAddRows(this)}doRedo(e){e.redoAddRows(this)}}class oA extends ov{constructor(e,t,r){super(),this.sheetId=e,this.rowMapping=t,this.oldContent=r}doUndo(e){e.undoSetRowOrder(this)}doRedo(e){e.redoSetRowOrder(this)}}class oM extends ov{constructor(e,t,r){super(),this.sheetId=e,this.columnMapping=t,this.oldContent=r}doUndo(e){e.undoSetColumnOrder(this)}doRedo(e){e.redoSetColumnOrder(this)}}class oI extends ov{constructor(e,t,r){super(),this.sheetId=e,this.oldSheetContent=t,this.newSheetContent=r}doUndo(e){e.undoSetSheetContent(this)}doRedo(e){e.redoSetSheetContent(this)}}class ox extends ov{constructor(e,t,r,n,o){super(),this.sheet=e,this.startRow=t,this.numberOfRows=r,this.targetRow=n,this.version=o,this.undoStart=this.startRow<this.targetRow?this.targetRow-this.numberOfRows:this.targetRow,this.undoEnd=this.startRow>this.targetRow?this.startRow+this.numberOfRows:this.startRow}doUndo(e){e.undoMoveRows(this)}doRedo(e){e.redoMoveRows(this)}getReferencedOldDataVersions(){return this.version>0?[this.version-1]:[]}}class oN extends ov{constructor(e,t,r,n,o){super(),this.sheet=e,this.startColumn=t,this.numberOfColumns=r,this.targetColumn=n,this.version=o,this.undoStart=this.startColumn<this.targetColumn?this.targetColumn-this.numberOfColumns:this.targetColumn,this.undoEnd=this.startColumn>this.targetColumn?this.startColumn+this.numberOfColumns:this.startColumn}doUndo(e){e.undoMoveColumns(this)}doRedo(e){e.redoMoveColumns(this)}getReferencedOldDataVersions(){return this.version>0?[this.version-1]:[]}}class oO extends ov{constructor(e){super(),this.command=e}doUndo(e){e.undoAddColumns(this)}doRedo(e){e.redoAddColumns(this)}}class ok extends ov{constructor(e,t){super(),this.command=e,this.columnsRemovals=t}doUndo(e){e.undoRemoveColumns(this)}doRedo(e){e.redoRemoveColumns(this)}getReferencedOldDataVersions(){return this.columnsRemovals.filter(e=>e.version>0).map(e=>e.version-1)}}class oH extends ov{constructor(e,t){super(),this.sheetName=e,this.sheetId=t}doUndo(e){e.undoAddSheet(this)}doRedo(e){e.redoAddSheet(this)}}class o_ extends ov{constructor(e,t,r,n){super(),this.sheetName=e,this.sheetId=t,this.oldSheetContent=r,this.scopedNamedExpressions=n}doUndo(e){e.undoRemoveSheet(this)}doRedo(e){e.redoRemoveSheet(this)}}class oL extends ov{constructor(e,t,r,n,o){super(),this.sheetId=e,this.oldName=t,this.newName=r,this.version=n,this.mergedPlaceholderSheetId=o}doUndo(e){e.undoRenameSheet(this)}doRedo(e){e.redoRenameSheet(this)}getReferencedOldDataVersions(){return void 0!==this.version&&this.version>0?[this.version-1]:[]}}class oP extends ov{constructor(e,t){super(),this.sheetId=e,this.oldSheetContent=t}doUndo(e){e.undoClearSheet(this)}doRedo(e){e.redoClearSheet(this)}}class oD extends ov{constructor(e){super(),this.cellContents=e}doUndo(e){e.undoSetCellContents(this)}doRedo(e){e.redoSetCellContents(this)}}class oF extends ov{constructor(e,t,r,n){super(),this.targetLeftCorner=e,this.oldContent=t,this.newContent=r,this.addedGlobalNamedExpressions=n}doUndo(e){e.undoPaste(this)}doRedo(e){e.redoPaste(this)}}class oB extends ov{constructor(e,t,r,n){super(),this.name=e,this.newContent=t,this.scope=r,this.options=n}doUndo(e){e.undoAddNamedExpression(this)}doRedo(e){e.redoAddNamedExpression(this)}}class oV extends ov{constructor(e,t,r){super(),this.namedExpression=e,this.content=t,this.scope=r}doUndo(e){e.undoRemoveNamedExpression(this)}doRedo(e){e.redoRemoveNamedExpression(this)}}class oU extends ov{constructor(e,t,r,n,o){super(),this.namedExpression=e,this.newContent=t,this.oldContent=r,this.scope=n,this.options=o}doUndo(e){e.undoChangeNamedExpression(this)}doRedo(e){e.redoChangeNamedExpression(this)}}class oz extends ov{constructor(){super(...arguments),this.operations=[]}add(e){this.operations.push(e)}*reversedOperations(){for(let e=this.operations.length-1;e>=0;e--)yield this.operations[e]}doUndo(e){e.undoBatch(this)}doRedo(e){e.redoBatch(this)}getReferencedOldDataVersions(){return this.operations.flatMap(e=>e.getReferencedOldDataVersions())}}class oW{constructor(e,t){this.operations=t,this.oldData=new Map,this.undoStack=[],this.redoStack=[],this.undoLimit=e.undoLimit}saveOperation(e){void 0!==this.batchUndoEntry?this.batchUndoEntry.add(e):this.addUndoEntry(e)}beginBatchMode(){this.batchUndoEntry=new oz}commitBatchMode(){if(void 0===this.batchUndoEntry)throw Error("Batch mode wasn't started");this.addUndoEntry(this.batchUndoEntry),this.batchUndoEntry=void 0}storeDataForVersion(e,t,r){0===this.undoLimit||(this.oldData.has(e)||this.oldData.set(e,[]),this.oldData.get(e).push([t,r]))}clearRedoStack(){this.cleanupOldDataForEntries(this.redoStack,this.undoStack),this.redoStack=[]}clearUndoStack(){this.cleanupOldDataForEntries(this.undoStack,this.redoStack),this.undoStack=[]}isUndoStackEmpty(){return 0===this.undoStack.length}isRedoStackEmpty(){return 0===this.redoStack.length}undo(){let e=this.undoStack.pop();if(!e)throw Error("Attempted to undo without operation on stack");this.undoEntry(e),this.redoStack.push(e)}undoBatch(e){for(let t of e.reversedOperations())this.undoEntry(t)}undoRemoveRows(e){this.operations.forceApplyPostponedTransformations();let{command:{sheet:t},rowsRemovals:r}=e;for(let e=r.length-1;e>=0;--e){let n=r[e];for(let{address:e,cellType:r}of(this.operations.addRows(new om(t,[[n.rowFrom,n.rowCount]])),n.removedCells))this.operations.restoreCell(e,r);this.restoreOldDataFromVersion(n.version-1)}}undoRemoveColumns(e){this.operations.forceApplyPostponedTransformations();let{command:{sheet:t},columnsRemovals:r}=e;for(let e=r.length-1;e>=0;--e){let n=r[e];for(let{address:e,cellType:r}of(this.operations.addColumns(new of(t,[[n.columnFrom,n.columnCount]])),n.removedCells))this.operations.restoreCell(e,r);this.restoreOldDataFromVersion(n.version-1)}}undoAddRows(e){let t=e.command.rowsSpans();for(let r=t.length-1;r>=0;--r){let n=t[r];this.operations.removeRows(new op(e.command.sheet,[[n.rowStart,n.numberOfRows]]))}}undoAddColumns(e){let t=e.command.columnsSpans();for(let r=t.length-1;r>=0;--r){let n=t[r];this.operations.removeColumns(new ob(e.command.sheet,[[n.columnStart,n.numberOfColumns]]))}}undoSetCellContents(e){for(let t of e.cellContents){let e=t.address,[r,n]=t.oldContent;r4(e,r)||this.operations.setCellEmpty(e),this.operations.restoreCell(r,n)}}undoPaste(e){for(let t of(this.restoreOperationOldContent(e.oldContent),e.addedGlobalNamedExpressions))this.operations.removeNamedExpression(t)}undoMoveRows(e){this.operations.forceApplyPostponedTransformations();let{sheet:t}=e;this.operations.moveRows(t,e.undoStart,e.numberOfRows,e.undoEnd),this.restoreOldDataFromVersion(e.version-1)}undoMoveColumns(e){this.operations.forceApplyPostponedTransformations();let{sheet:t}=e;this.operations.moveColumns(t,e.undoStart,e.numberOfColumns,e.undoEnd),this.restoreOldDataFromVersion(e.version-1)}undoMoveCells(e){for(let t of(this.operations.forceApplyPostponedTransformations(),this.operations.moveCells(e.destinationLeftCorner,e.width,e.height,e.sourceLeftCorner),this.restoreOperationOldContent(e.overwrittenCellsData),this.restoreOldDataFromVersion(e.version-1),e.addedGlobalNamedExpressions))this.operations.removeNamedExpression(t)}undoAddSheet(e){let{sheetName:t}=e;this.operations.removeSheetByName(t)}undoRemoveSheet(e){this.operations.forceApplyPostponedTransformations();let{oldSheetContent:t,sheetId:r,scopedNamedExpressions:n,sheetName:o}=e;this.operations.addSheetWithId(r,o);for(let e=0;e<t.length;e++){let n=t[e];for(let t=0;t<n.length;t++){let o=n[t],i=r0(r,t,e);this.operations.restoreCell(i,o)}}for(let[e,t]of n)this.operations.restoreNamedExpression(e,t,r)}undoRenameSheet(e){this.operations.forceApplyPostponedTransformations(),this.operations.renameSheet(e.sheetId,e.oldName),void 0!==e.mergedPlaceholderSheetId&&void 0!==e.version&&(this.operations.addPlaceholderSheetWithId(e.mergedPlaceholderSheetId,e.newName),this.restoreOldDataFromVersion(e.version-1))}undoClearSheet(e){let{oldSheetContent:t,sheetId:r}=e;for(let e=0;e<t.length;e++){let n=t[e];for(let t=0;t<n.length;t++){let o=n[t],i=r0(r,t,e);this.operations.restoreCell(i,o)}}}undoSetSheetContent(e){let{oldSheetContent:t,sheetId:r}=e;this.operations.clearSheet(r);for(let e=0;e<t.length;e++){let n=t[e];for(let t=0;t<n.length;t++){let o=n[t],i=r0(r,t,e);this.operations.restoreCell(i,o)}}}undoAddNamedExpression(e){this.operations.removeNamedExpression(e.name,e.scope)}undoRemoveNamedExpression(e){this.operations.restoreNamedExpression(e.namedExpression,e.content,e.scope)}undoChangeNamedExpression(e){this.operations.restoreNamedExpression(e.namedExpression,e.oldContent,e.scope)}undoSetRowOrder(e){this.restoreOperationOldContent(e.oldContent)}undoSetColumnOrder(e){this.restoreOperationOldContent(e.oldContent)}redo(){let e=this.redoStack.pop();if(!e)throw Error("Attempted to redo without operation on stack");this.redoEntry(e),this.undoStack.push(e)}redoBatch(e){for(let t of e.operations)this.redoEntry(t)}redoRemoveRows(e){this.operations.removeRows(e.command)}redoMoveCells(e){this.operations.moveCells(e.sourceLeftCorner,e.width,e.height,e.destinationLeftCorner)}redoRemoveColumns(e){this.operations.removeColumns(e.command)}redoPaste(e){let{targetLeftCorner:t,newContent:r}=e,n=r.length,o=r[0].length;for(let e=0;e<n;++e)for(let n=0;n<o;++n){let o=r0(t.sheet,t.col+n,t.row+e);this.operations.restoreCell(o,r[e][n])}}redoSetCellContents(e){for(let t of e.cellContents)this.operations.setCellContent(t.address,t.newContent)}redoAddRows(e){this.operations.addRows(e.command)}redoAddColumns(e){this.operations.addColumns(e.command)}redoRemoveSheet(e){this.operations.removeSheetByName(e.sheetName)}redoAddSheet(e){this.operations.addSheetWithId(e.sheetId,e.sheetName)}redoRenameSheet(e){this.operations.renameSheet(e.sheetId,e.newName)}redoMoveRows(e){this.operations.moveRows(e.sheet,e.startRow,e.numberOfRows,e.targetRow)}redoMoveColumns(e){this.operations.moveColumns(e.sheet,e.startColumn,e.numberOfColumns,e.targetColumn)}redoClearSheet(e){this.operations.clearSheet(e.sheetId)}redoSetSheetContent(e){let{sheetId:t,newSheetContent:r}=e;this.operations.setSheetContent(t,r)}redoAddNamedExpression(e){this.operations.addNamedExpression(e.name,e.newContent,e.scope,e.options)}redoRemoveNamedExpression(e){this.operations.removeNamedExpression(e.namedExpression.displayName,e.scope)}redoChangeNamedExpression(e){this.operations.changeNamedExpressionExpression(e.namedExpression.displayName,e.newContent,e.scope,e.options)}redoSetRowOrder(e){this.operations.setRowOrder(e.sheetId,e.rowMapping)}redoSetColumnOrder(e){this.operations.setColumnOrder(e.sheetId,e.columnMapping)}addUndoEntry(e){this.undoStack.push(e);let t=Math.max(0,this.undoStack.length-this.undoLimit);if(t>0){let e=this.undoStack.splice(0,t);this.cleanupOldDataForEntries(e,[...this.undoStack,...this.redoStack])}}cleanupOrphanedOldData(){let e=this.collectReferencedOldDataVersions(this.undoStack,this.redoStack);for(let t of this.oldData.keys())e.has(t)||this.oldData.delete(t)}cleanupOldDataForEntries(e,t){let r=this.collectReferencedOldDataVersions(t);for(let t of e)for(let e of t.getReferencedOldDataVersions())r.has(e)||this.oldData.delete(e)}collectReferencedOldDataVersions(...e){var t,r;return new Set([...e.flatMap(e=>e.flatMap(e=>e.getReferencedOldDataVersions())),...null!=(r=null==(t=this.batchUndoEntry)?void 0:t.getReferencedOldDataVersions())?r:[]])}undoEntry(e){e.doUndo(this)}restoreOperationOldContent(e){for(let[t,r]of e)this.operations.restoreCell(t,r)}redoEntry(e){e.doRedo(this)}restoreOldDataFromVersion(e){for(let t of this.oldData.get(e)||[]){let[e,r]=t;this.operations.setFormulaToCellFromCache(r,e)}}}class oG{constructor(e,t,r,n,o,i,s,a,l,h){this.operations=t,this.undoRedo=r,this.clipboardOperations=n,this.dependencyGraph=o,this.columnSearch=i,this.parser=s,this.cellContentParser=a,this.lazilyTransformingAstService=l,this.namedExpressions=h,this.maxRows=e.maxRows,this.maxColumns=e.maxColumns}get sheetMapping(){return this.dependencyGraph.sheetMapping}addRows(e,...t){let r=new om(e,t);this.ensureItIsPossibleToAddRows(e,...t),this.undoRedo.clearRedoStack(),this.clipboardOperations.abortCut(),this.operations.addRows(r),this.undoRedo.saveOperation(new oT(r))}removeRows(e,...t){let r=new op(e,t);this.ensureItIsPossibleToRemoveRows(e,...t),this.undoRedo.clearRedoStack(),this.clipboardOperations.abortCut();let n=this.operations.removeRows(r);this.undoRedo.saveOperation(new oR(r,n))}addColumns(e,...t){let r=new of(e,t);this.ensureItIsPossibleToAddColumns(e,...t),this.undoRedo.clearRedoStack(),this.clipboardOperations.abortCut(),this.operations.addColumns(r),this.undoRedo.saveOperation(new oO(r))}removeColumns(e,...t){let r=new ob(e,t);this.ensureItIsPossibleToRemoveColumns(e,...t),this.undoRedo.clearRedoStack(),this.clipboardOperations.abortCut();let n=this.operations.removeColumns(r);this.undoRedo.saveOperation(new ok(r,n))}moveCells(e,t,r,n){this.undoRedo.clearRedoStack(),this.clipboardOperations.abortCut();let{version:o,overwrittenCellsData:i,addedGlobalNamedExpressions:s}=this.operations.moveCells(e,t,r,n);this.undoRedo.saveOperation(new oE(e,t,r,n,i,s,o))}moveRows(e,t,r,n){this.ensureItIsPossibleToMoveRows(e,t,r,n),this.undoRedo.clearRedoStack(),this.clipboardOperations.abortCut();let o=this.operations.moveRows(e,t,r,n);this.undoRedo.saveOperation(new ox(e,t,r,n,o))}moveColumns(e,t,r,n){this.ensureItIsPossibleToMoveColumns(e,t,r,n),this.undoRedo.clearRedoStack();let o=this.operations.moveColumns(e,t,r,n);this.undoRedo.saveOperation(new oN(e,t,r,n,o))}cut(e,t,r){this.clipboardOperations.cut(e,t,r)}ensureItIsPossibleToCopy(e,t,r){if(!o$(t))throw new t1("width to be positive integer.");if(!o$(r))throw new t1("height to be positive integer.")}copy(e,t,r){this.ensureItIsPossibleToCopy(e,t,r),this.clipboardOperations.copy(e,t,r)}paste(e){let t=this.clipboardOperations.clipboard;if(void 0===t)throw new t7;if(this.clipboardOperations.isCutClipboard())this.moveCells(t.sourceLeftCorner,t.width,t.height,e);else if(this.clipboardOperations.isCopyClipboard()){this.clipboardOperations.ensureItIsPossibleToCopyPaste(e);let r=r8.spanFrom(e,t.width,t.height),n=this.operations.getRangeClipboardCells(r);this.undoRedo.clearRedoStack();let o=this.operations.restoreClipboardCells(t.sourceLeftCorner.sheet,t.getContent(e));this.undoRedo.saveOperation(new oF(e,n,t.content,o))}}beginUndoRedoBatchMode(){this.undoRedo.beginBatchMode()}commitUndoRedoBatchMode(){this.undoRedo.commitBatchMode()}isClipboardEmpty(){return void 0===this.clipboardOperations.clipboard}clearClipboard(){this.clipboardOperations.clear()}addSheet(e){void 0!==e&&this.ensureItIsPossibleToAddSheet(e),this.undoRedo.clearRedoStack();let{sheetName:t,sheetId:r}=this.operations.addSheet(e);return this.undoRedo.saveOperation(new oH(t,r)),t}removeSheet(e){this.ensureScopeIdIsValid(e),this.undoRedo.clearRedoStack(),this.clipboardOperations.abortCut();let t=this.sheetMapping.getSheetNameOrThrowError(e),r=this.operations.getSheetClipboardCells(e),n=this.operations.removeSheet(e);this.undoRedo.saveOperation(new o_(t,e,r,n))}renameSheet(e,t){this.ensureItIsPossibleToRenameSheet(e,t);let{previousDisplayName:r,version:n,mergedPlaceholderSheetId:o}=this.operations.renameSheet(e,t);return void 0!==r&&(this.undoRedo.clearRedoStack(),this.undoRedo.saveOperation(new oL(e,r,t,n,o))),r}clearSheet(e){this.ensureScopeIdIsValid(e),this.undoRedo.clearRedoStack(),this.clipboardOperations.abortCut();let t=this.operations.getSheetClipboardCells(e);this.operations.clearSheet(e),this.undoRedo.saveOperation(new oP(e,t))}setCellContents(e,t){if(t instanceof Array){for(let e=0;e<t.length;e++)if(!(t[e]instanceof Array))throw new t1("an array of arrays or a raw cell value.")}else t=[[t]];this.ensureItIsPossibleToChangeCellContents(e,t),this.undoRedo.clearRedoStack();let r=[];for(let n=0;n<t.length;n++)for(let o=0;o<t[n].length;o++){let i={sheet:e.sheet,row:e.row+n,col:e.col+o},s=t[n][o];this.clipboardOperations.abortCut();let a=this.operations.setCellContent(i,s);r.push({address:i,newContent:s,oldContent:a})}this.undoRedo.saveOperation(new oD(r))}setSheetContent(e,t){this.ensureScopeIdIsValid(e),this.ensureItIsPossibleToChangeSheetContents(e,t),rD(t),this.undoRedo.clearRedoStack(),this.clipboardOperations.abortCut();let r=this.operations.getSheetClipboardCells(e);this.operations.setSheetContent(e,t),this.undoRedo.saveOperation(new oI(e,r,t))}setRowOrder(e,t){this.validateSwapRowIndexes(e,t),this.testRowOrderForArrays(e,t),this.undoRedo.clearRedoStack(),this.clipboardOperations.abortCut();let r=this.operations.setRowOrder(e,t);this.undoRedo.saveOperation(new oA(e,t,r))}validateSwapRowIndexes(e,t){if(!this.sheetMapping.hasSheetWithId(e))throw new tK(e);this.validateRowOrColumnMapping(e,t,"row")}testColumnOrderForArrays(e,t){for(let[r,n]of t)if(r!==n){let t=r8.spanFrom({sheet:e,col:r,row:0},1,1/0);if(this.dependencyGraph.arrayMapping.isFormulaArrayInRange(t))throw new rg}}setColumnOrder(e,t){this.validateSwapColumnIndexes(e,t),this.testColumnOrderForArrays(e,t),this.undoRedo.clearRedoStack(),this.clipboardOperations.abortCut();let r=this.operations.setColumnOrder(e,t);this.undoRedo.saveOperation(new oM(e,t,r))}validateSwapColumnIndexes(e,t){if(!this.sheetMapping.hasSheetWithId(e))throw new tK(e);this.validateRowOrColumnMapping(e,t,"column")}testRowOrderForArrays(e,t){for(let[r,n]of t)if(r!==n){let t=r8.spanFrom({sheet:e,col:0,row:r},1/0,1);if(this.dependencyGraph.arrayMapping.isFormulaArrayInRange(t))throw new rg}}mappingFromOrder(e,t,r){if(!this.sheetMapping.hasSheetWithId(e))throw new tK(e);let n="row"===r?this.dependencyGraph.getSheetHeight(e):this.dependencyGraph.getSheetWidth(e);if(t.length!==n)throw new t1(`number of ${r}s provided to be sheet ${"row"===r?"height":"width"}.`);let o=[];for(let e=0;e<n;e++)t[e]!==e&&o.push([e,t[e]]);return o}undo(){if(this.undoRedo.isUndoStackEmpty())throw new t4;this.clipboardOperations.abortCut(),this.undoRedo.undo()}redo(){if(this.undoRedo.isRedoStackEmpty())throw new t9;this.clipboardOperations.abortCut(),this.undoRedo.redo()}addNamedExpression(e,t,r,n){this.ensureItIsPossibleToAddNamedExpression(e,t,r),this.operations.addNamedExpression(e,t,r,n),this.undoRedo.clearRedoStack(),this.clipboardOperations.abortCut(),this.undoRedo.saveOperation(new oB(e,t,r,n))}changeNamedExpressionExpression(e,t,r,n){this.ensureItIsPossibleToChangeNamedExpression(e,r,t);let[o,i]=this.operations.changeNamedExpressionExpression(e,r,t,n);this.undoRedo.clearRedoStack(),this.clipboardOperations.abortCut(),this.undoRedo.saveOperation(new oU(o,r,i,t,n))}removeNamedExpression(e,t){this.ensureScopeIdIsValid(t);let[r,n]=this.operations.removeNamedExpression(e,t);return this.undoRedo.clearRedoStack(),this.clipboardOperations.abortCut(),this.undoRedo.saveOperation(new oV(r,n,t)),r}ensureItIsPossibleToAddNamedExpression(e,t,r){this.ensureScopeIdIsValid(r),this.ensureNamedExpressionNameIsValid(e,r),this.ensureNamedExpressionIsValid(t)}ensureItIsPossibleToChangeNamedExpression(e,t,r){if(this.ensureScopeIdIsValid(r),void 0===this.namedExpressions.namedExpressionForScope(e,r))throw new t5(e);this.ensureNamedExpressionIsValid(t)}isItPossibleToRemoveNamedExpression(e,t){if(this.ensureScopeIdIsValid(t),void 0===this.namedExpressions.namedExpressionForScope(e,t))throw new t5(e)}ensureItIsPossibleToAddRows(e,...t){if(!this.sheetMapping.hasSheetWithId(e))throw new tK(e);if(this.dependencyGraph.getSheetHeight(e)+t.map(e=>e[1]).reduce((e,t)=>e+t,0)>this.maxRows)throw new tZ;for(let[e,r]of t)if(!oY(e)||!o$(r))throw new t1("row number to be nonnegative and number of rows to add to be positive.")}ensureItIsPossibleToRemoveRows(e,...t){for(let[r,n]of t){let t=r+n-1;if(!oY(r)||!oY(t))throw new t1("starting and ending row to be nonnegative.");if(t<r)throw new t1("starting row to be smaller than the ending row.");if(!this.sheetMapping.hasSheetWithId(e))throw new tK(e)}}ensureItIsPossibleToAddColumns(e,...t){if(!this.sheetMapping.hasSheetWithId(e))throw new tK(e);if(this.dependencyGraph.getSheetWidth(e)+t.map(e=>e[1]).reduce((e,t)=>e+t,0)>this.maxColumns)throw new tZ;for(let[e,r]of t)if(!oY(e)||!o$(r))throw new t1("column number to be nonnegative and number of columns to add to be positive.")}ensureItIsPossibleToRemoveColumns(e,...t){for(let[r,n]of t){let t=r+n-1;if(!oY(r)||!oY(t))throw new t1("starting and ending column to be nonnegative.");if(t<r)throw new t1("starting column to be smaller than the ending column.");if(!this.sheetMapping.hasSheetWithId(e))throw new tK(e)}}ensureItIsPossibleToMoveRows(e,t,r,n){this.ensureItIsPossibleToAddRows(e,[n,r]);let o=r0(e,0,t),i=r0(e,0,n);if(!this.sheetMapping.hasSheetWithId(e)||r1(o)||r1(i)||!o$(r)||n<=t+r&&n>=t)throw new t1("a valid range of rows to move.");let s=this.dependencyGraph.getSheetWidth(e),a=r8.spanFrom(o,s,r);if(this.dependencyGraph.arrayMapping.isFormulaArrayInRange(a))throw new rg;if(n>0&&this.dependencyGraph.arrayMapping.isFormulaArrayInAllRows(t$.fromNumberOfRows(e,n-1,2)))throw new rp}ensureItIsPossibleToMoveColumns(e,t,r,n){this.ensureItIsPossibleToAddColumns(e,[n,r]);let o=r0(e,t,0),i=r0(e,n,0);if(!this.sheetMapping.hasSheetWithId(e)||r1(o)||r1(i)||!o$(r)||n<=t+r&&n>=t)throw new t1("a valid range of columns to move.");let s=this.dependencyGraph.getSheetHeight(e),a=r8.spanFrom(o,r,s);if(this.dependencyGraph.arrayMapping.isFormulaArrayInRange(a))throw new rg;if(n>0&&this.dependencyGraph.arrayMapping.isFormulaArrayInAllColumns(tY.fromNumberOfColumns(e,n-1,2)))throw new rp}ensureItIsPossibleToAddSheet(e){if(this.sheetMapping.hasSheetWithName(e))throw new tQ(e)}ensureItIsPossibleToRenameSheet(e,t){if(!this.sheetMapping.hasSheetWithId(e))throw new tK(e);let r=this.sheetMapping.getSheetId(t);if(void 0!==r&&r!==e)throw new tQ(t)}ensureItIsPossibleToChangeContent(e){if(r1(e))throw new t0(e);if(!this.sheetMapping.hasSheetWithId(e.sheet))throw new tK(e.sheet)}ensureItIsPossibleToChangeCellContents(e,t){let r=rF(t),n=r8.spanFrom(e,r.width,r.height);for(let e of(this.ensureRangeInSizeLimits(n),n.addresses(this.dependencyGraph)))this.ensureItIsPossibleToChangeContent(e)}ensureItIsPossibleToChangeSheetContents(e,t){let r=rF(t),n=r8.spanFrom(r0(e,0,0),r.width,r.height);this.ensureRangeInSizeLimits(n)}ensureRangeInSizeLimits(e){if(e.exceedsSheetSizeLimits(this.maxColumns,this.maxRows))throw new tZ}isThereSomethingToUndo(){return!this.undoRedo.isUndoStackEmpty()}isThereSomethingToRedo(){return!this.undoRedo.isRedoStackEmpty()}getAndClearContentChanges(){return this.operations.getAndClearContentChanges()}ensureScopeIdIsValid(e){if(void 0!==e&&!this.sheetMapping.hasSheetWithId(e))throw new tK(e)}validateRowOrColumnMapping(e,t,r){let n="row"===r?this.dependencyGraph.getSheetHeight(e):this.dependencyGraph.getSheetWidth(e),o=t.map(([e,t])=>e).sort((e,t)=>e-t),i=t.map(([e,t])=>t).sort((e,t)=>e-t);for(let e=0;e<o.length;e++){if(!oY(o[e])||o[e]>=n)throw new t1(`${r} numbers to be nonnegative integers and less than sheet ${"row"===r?"height":"width"}.`);if(o[e]===o[e+1])throw new t1(`source ${r} numbers to be unique.`);if(o[e]!==i[e])throw new t1(`target ${r} numbers to be permutation of source ${r} numbers.`)}}ensureNamedExpressionNameIsValid(e,t){if(!this.namedExpressions.isNameValid(e))throw new t6(e);if(!this.namedExpressions.isNameAvailable(e,t))throw new t3(e)}ensureNamedExpressionIsValid(e){let t=this.cellContentParser.parse(e);if(t instanceof b.Formula&&tG(this.parser.parse(t.formula,r0(-1,0,0)).ast))throw new rm}}function o$(e){return Number.isInteger(e)&&e>0}function oY(e){return Number.isInteger(e)&&e>=0}class oj{constructor(e,t,r,n,o,i){this.config=e,this.stats=t,this.interpreter=r,this.lazilyTransformingAstService=n,this.dependencyGraph=o,this.columnSearch=i}run(){this.stats.start(a.TOP_SORT);let{sorted:e,cycled:t}=this.dependencyGraph.topSortWithScc();this.stats.end(a.TOP_SORT),this.stats.measure(a.EVALUATION,()=>{this.recomputeFormulas(t,e)})}partialRun(e){let t=tB.empty();return this.stats.measure(a.EVALUATION,()=>{this.dependencyGraph.graph.getTopSortedWithSccSubgraphFrom(e,e=>this.recomputeVertex(e,t),e=>this.processVertexOnCycle(e,t))}),t}runAndForget(e,t,r){let n=[];for(let e of tA(r,t))if(e instanceof r8&&void 0===this.dependencyGraph.getRange(e.start,e.end)){let t=new rM(e);this.dependencyGraph.rangeMapping.addOrUpdateVertex(t),n.push(t)}let o=this.evaluateAstToCellValue(e,new nr(t,this.config.useArrayArithmetic));return n.forEach(e=>{this.dependencyGraph.rangeMapping.removeVertexIfExists(e)}),o}recomputeVertex(e,t){if(e instanceof rE){let r=e.isComputed()?e.getCellValue():void 0,n=this.recomputeFormulaVertexValue(e);if(n!==r){let o=e.getAddress(this.lazilyTransformingAstService);return t.addChange(n,o),this.columnSearch.change(tI(r),tI(n),o),!0}return!1}return!(e instanceof rM)||(e.clearCache(),!0)}processVertexOnCycle(e,t){if(e instanceof rM)e.clearCache();else if(e instanceof rE){let r=e.getAddress(this.lazilyTransformingAstService);this.columnSearch.remove(tI(e.valueOrUndef()),r);let n=new rK(d.CYCLE,void 0,e);e.setCellValue(n),t.addChange(n,r)}}recomputeFormulas(e,t){e.forEach(e=>{e instanceof rE&&e.setCellValue(new rK(d.CYCLE,void 0,e))}),t.forEach(e=>{if(e instanceof rE){let t=this.recomputeFormulaVertexValue(e),r=e.getAddress(this.lazilyTransformingAstService);this.columnSearch.add(tI(t),r)}else e instanceof rM&&e.clearCache()})}recomputeFormulaVertexValue(e){let t=e.getAddress(this.lazilyTransformingAstService);if(e instanceof rT&&(e.array.size.isRef||!this.dependencyGraph.isThereSpaceForArray(e)))return e.setNoSpace();{let r=e.getFormula(this.lazilyTransformingAstService),n=this.evaluateAstToCellValue(r,new nr(t,this.config.useArrayArithmetic,e));return e.setCellValue(n)}}evaluateAstToCellValue(e,t){let r=this.interpreter.evaluateAst(e,t);return r instanceof tF?r:r===tM&&this.config.evaluateNullToZero?0:r}}class oq{constructor(e,t){this.address=e,this.newValue=t}get col(){return this.address.col}get row(){return this.address.row}get sheet(){return this.address.sheet}get value(){return this.newValue}}class oK{constructor(e,t){this.name=e,this.newValue=t}}class oX{constructor(e,t,r,n){this.config=e,this.namedExpressions=t,this.sheetMapping=r,this.lazilyTransformingService=n}exportChange(e){let t=e.value,r=e.address;if(r.sheet===tW.SHEET_FOR_WORKBOOK_EXPRESSIONS){let e=this.namedExpressions.namedExpressionInAddress(r.row);if(!e)throw Error("Missing named expression");return new oK(e.displayName,this.exportScalarOrRange(t))}if(!(t instanceof tF))return new oq(r,this.exportValue(t));{let e=[];for(let[n,o]of t.entriesFromTopLeftCorner(r))e.push(new oq(o,this.exportValue(n)));return e}}exportValue(e){return e instanceof tF?this.detailedError(new rK(d.VALUE,ej.ScalarExpected)):this.config.smartRounding&&tP(e)?this.cellValueRounding(tI(e)):e instanceof rK?this.detailedError(e):e===tM?null:tI(e)}exportScalarOrRange(e){return e instanceof tF?e.rawData().map(e=>e.map(e=>this.exportValue(e))):this.exportValue(e)}detailedError(e){var t,r;let n,o=null==(t=e.root)?void 0:t.getAddress(this.lazilyTransformingService);return void 0!==o&&(n=o.sheet===tW.SHEET_FOR_WORKBOOK_EXPRESSIONS?null==(r=this.namedExpressions.namedExpressionInAddress(o.row))?void 0:r.displayName:eI(this.sheetMapping.getSheetNameOrThrowError.bind(this.sheetMapping),o,-1)),new nT(e,this.config.translationPackage.getErrorTranslation(e.type),n)}cellValueRounding(e){if(0===e)return e;let t=Math.floor(Math.log10(Math.abs(e))),r=Math.pow(10,this.config.precisionRounding-t);return e<0?-Math.round(-e*r)/r:Math.round(e*r)/r}}class oQ{constructor(e,t,r,n,o,i){this.dependencyGraph=e,this.columnSearch=t,this.parser=r,this.cellContentParser=n,this.stats=o,this.arraySizePredictor=i,this.buildStrategy=new oZ(e,t,r,o,n,i)}buildGraph(e,t){let r=t.measure(a.COLLECT_DEPENDENCIES,()=>this.buildStrategy.run(e));this.dependencyGraph.getAndClearContentChanges(),t.measure(a.PROCESS_DEPENDENCIES,()=>this.processDependencies(r))}processDependencies(e){e.forEach((e,t)=>{this.dependencyGraph.processCellDependencies(e,t)})}}class oZ{constructor(e,t,r,n,o,i){this.dependencyGraph=e,this.columnIndex=t,this.parser=r,this.stats=n,this.cellContentParser=o,this.arraySizePredictor=i}run(e){let t=new Map;for(let r in e){let n=this.dependencyGraph.getSheetId(r),o=e[r];for(let e=0;e<o.length;++e){let r=o[e];for(let o=0;o<r.length;++o){let i=r[o],s=r0(n,o,e),l=this.cellContentParser.parse(i);if(l instanceof b.Formula){let e=this.stats.measure(a.PARSER,()=>this.parser.parse(l.formula,s));if(e.errors.length>0){this.shrinkArrayIfNeeded(s);let t=new rz(e.errors,l.formula);this.dependencyGraph.addVertex(s,t)}else{this.shrinkArrayIfNeeded(s);let r=this.arraySizePredictor.checkArraySize(e.ast,s);if(r.isScalar()){let r=new rA(e.ast,s,0);t.set(r,tA(e.dependencies,s)),this.dependencyGraph.addVertex(s,r),e.hasVolatileFunction&&this.dependencyGraph.markAsVolatile(r),e.hasStructuralChangeFunction&&this.dependencyGraph.markAsDependentOnStructureChange(r)}else{let n=new rT(e.ast,s,new nR(r.width,r.height));t.set(n,tA(e.dependencies,s)),this.dependencyGraph.addArrayVertex(s,n)}}}else if(l instanceof b.Empty);else{this.shrinkArrayIfNeeded(s);let e=new rU(l.value,i);this.columnIndex.add(tI(l.value),s),this.dependencyGraph.addVertex(s,e)}}}}return t}shrinkArrayIfNeeded(e){let t=this.dependencyGraph.getCell(e);t instanceof rT&&this.dependencyGraph.shrinkArrayToCorner(t)}}let oJ=new Map([["gpl-v3",1],["missing",2],["invalid",3],["expired",4]]);class o0 extends nv{version(e,t){return this.runFunction(e.args,t,this.metadata("VERSION"),()=>{let e,{licenseKeyValidityState:t,licenseKey:r}=this.config;return oJ.has(r)?e=oJ.get(r):oJ.has(t)?e=oJ.get(t):"valid"===t&&(e=r.slice(-5)),`HyperFormula v${ig.version}, ${e}`})}}function o1(e,t){var r;let n=t.implementedFunctions[e],o=null==(r=t.aliases)?void 0:r[e];if(void 0!==o){if(void 0!==n)throw new rf(e,t.name);n=t.implementedFunctions[o]}if(void 0===n)throw ru.functionNotDeclaredInPlugin(e,t.name);return n}o0.implementedFunctions={VERSION:{method:"version",parameters:[]}};class o2{constructor(e){if(this.config=e,this.functions=new Map,this.arraySizeFunctions=new Map,this.volatileFunctions=new Set,this.arrayFunctions=new Set,this.structuralChangeFunctions=new Set,this.functionsWhichDoesNotNeedArgumentsToBeComputed=new Set,this.functionsMetadata=new Map,this.doesFunctionNeedArgumentToBeComputed=e=>this.functionsWhichDoesNotNeedArgumentsToBeComputed.has(e),this.isFunctionVolatile=e=>this.volatileFunctions.has(e),this.isArrayFunction=e=>this.arrayFunctions.has(e),this.isFunctionDependentOnSheetStructureChange=e=>this.structuralChangeFunctions.has(e),e.functionPlugins.length>0)for(const t of(this.instancePlugins=new Map,e.functionPlugins))o2.loadPluginFunctions(t,this.instancePlugins);else this.instancePlugins=new Map(o2.plugins);for(const[e,t]of o2.protectedFunctions())o2.loadFunctionUnprotected(t,e,this.instancePlugins);for(const[e,t]of this.instancePlugins.entries())this.categorizeFunction(e,o1(e,t))}static registerFunctionPlugin(e,t){this.loadPluginFunctions(e,this.plugins),void 0!==t&&this.loadTranslations(t)}static registerFunction(e,t,r){this.loadPluginFunction(t,e,this.plugins),void 0!==r&&this.loadTranslations(r)}static unregisterFunction(e){if(this.functionIsProtected(e))throw rc.cannotUnregisterFunctionWithId(e);this.plugins.delete(e)}static unregisterFunctionPlugin(e){for(let t of this.protectedPlugins())if(t===e)throw rc.cannotUnregisterProtectedPlugin();for(let[t,r]of this.plugins.entries())r===e&&this.plugins.delete(t)}static unregisterAll(){this.plugins.clear()}static getRegisteredFunctionIds(){return[...Array.from(this.plugins.keys()),...Array.from(this._protectedPlugins.keys())]}static getPlugins(){return Array.from(new Set(this.plugins.values()).values())}static getFunctionPlugin(e){if(!this.functionIsProtected(e))return this.plugins.get(e)}static functionIsProtected(e){return this._protectedPlugins.has(e)}static loadTranslations(e){let t=new Set(ig.getRegisteredLanguagesCodes());Object.keys(e).forEach(r=>{t.has(r)&&ig.getLanguage(r).extendFunctions(e[r])})}static loadPluginFunctions(e,t){Object.keys(e.implementedFunctions).forEach(r=>{this.loadPluginFunction(e,r,t)}),void 0!==e.aliases&&Object.keys(e.aliases).forEach(r=>{this.loadPluginFunction(e,r,t)})}static loadPluginFunction(e,t,r){if(this.functionIsProtected(t))throw rc.cannotRegisterFunctionWithId(t);this.loadFunctionUnprotected(e,t,r)}static handleDeprecatedMetadata(e,t){t&&void 0!==t.arrayFunction&&(console.warn(`${e}: 'arrayFunction' parameter is deprecated since 3.1.0; Use 'enableArrayArithmeticForArguments' instead.`),t.enableArrayArithmeticForArguments=t.arrayFunction),t&&void 0!==t.arraySizeMethod&&(console.warn(`${e}: 'arraySizeMethod' parameter is deprecated since 3.1.0; Use 'sizeOfResultArrayMethod' instead.`),t.sizeOfResultArrayMethod=t.arraySizeMethod)}static loadFunctionUnprotected(e,t,r){let n=o1(t,e),o=n.method;if(this.handleDeprecatedMetadata(t,n),Object.prototype.hasOwnProperty.call(e.prototype,o))r.set(t,e);else throw ru.functionMethodNotFound(o,e.name)}static*protectedFunctions(){for(let[e,t]of this._protectedPlugins)void 0!==t&&(yield[e,t])}static*protectedPlugins(){for(let[,e]of this._protectedPlugins)void 0!==e&&(yield e)}initializePlugins(e){let t=[];for(let[r,n]of this.instancePlugins.entries()){let o=t.find(e=>e instanceof n);void 0===o&&(o=new n(e),t.push(o));let i=o1(r,n),s=i.method;this.functions.set(r,[s,o]);let a=i.sizeOfResultArrayMethod;void 0!==a&&this.arraySizeFunctions.set(r,[a,o])}}getFunctionPlugin(e){if(!o2.functionIsProtected(e))return this.instancePlugins.get(e)}getFunction(e){let t=this.functions.get(e);if(void 0!==t&&this.config.translationPackage.isFunctionTranslated(e)){let[e,r]=t;return(t,n)=>r[e](t,n)}}getArraySizeFunction(e){let t=this.arraySizeFunctions.get(e);if(void 0!==t&&this.config.translationPackage.isFunctionTranslated(e)){let[e,r]=t;return(t,n)=>r[e](t,n)}}getMetadata(e){return this.functionsMetadata.get(e)}getPlugins(){let e=new Set;for(let[t,r]of this.instancePlugins)o2.functionIsProtected(t)||e.add(r);return Array.from(e)}getRegisteredFunctionIds(){return Array.from(this.functions.keys())}categorizeFunction(e,t){t.isVolatile&&this.volatileFunctions.add(e),t.enableArrayArithmeticForArguments&&this.arrayFunctions.add(e),t.doesNotNeedArgumentsToBeComputed&&this.functionsWhichDoesNotNeedArgumentsToBeComputed.add(e),t.isDependentOnSheetStructureChange&&this.structuralChangeFunctions.add(e),this.functionsMetadata.set(e,t)}}o2.plugins=new Map,o2._protectedPlugins=new Map([["VERSION",o0],["OFFSET",void 0]]),(B=w||(w={})).GREATER_THAN="GREATER_THAN",B.GREATER_THAN_OR_EQUAL="GREATER_THAN_OR_EQUAL",B.LESS_THAN="LESS_THAN",B.LESS_THAN_OR_EQUAL="LESS_THAN_OR_EQUAL",B.NOT_EQUAL="NOT_EQUAL",B.EQUAL="EQUAL";let o3=(e,t)=>({operator:e,value:t});class o6{constructor(e){var t,r,n,o;this.trueString=null!=(r=null==(t=e.translationPackage.getMaybeFunctionTranslation("TRUE"))?void 0:t.toLowerCase())?r:"true",this.falseString=null!=(o=null==(n=e.translationPackage.getMaybeFunctionTranslation("FALSE"))?void 0:n.toLowerCase())?o:"false"}fromCellValue(e,t){if("string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e)return;let r=this.parseCriterion(e,t);if(void 0!==r)return{raw:e,lambda:o4(r,t)}}parseCriterion(e,t){if("number"==typeof e||"boolean"==typeof e)return o3(w.EQUAL,e);if("string"==typeof e){let r,n,o=o5.exec(e);o?(n=function(e){switch(e){case">":return w.GREATER_THAN;case">=":return w.GREATER_THAN_OR_EQUAL;case"<":return w.LESS_THAN;case"<=":return w.LESS_THAN_OR_EQUAL;case"<>":return w.NOT_EQUAL;case"=":return w.EQUAL;default:return}}(o[1]),r=o[2]):(n=w.EQUAL,r=e);let i=t.coerceToMaybeNumber(r),s=r.toLowerCase()===this.trueString||r.toLowerCase()!==this.falseString&&void 0;if(void 0===n)return;if(""===r)return o3(n,null);if(void 0!==i)return o3(n,tI(i));if(n===w.EQUAL||n===w.NOT_EQUAL)return o3(n,null!=s?s:r)}}}let o5=/([<>=]+)(.*)/,o4=(e,t)=>{switch(e.operator){case w.GREATER_THAN:if("number"==typeof e.value)return r=>"number"==typeof r&&t.floatCmp(r,e.value)>0;return e=>!1;case w.GREATER_THAN_OR_EQUAL:if("number"==typeof e.value)return r=>"number"==typeof r&&t.floatCmp(r,e.value)>=0;return e=>!1;case w.LESS_THAN:if("number"==typeof e.value)return r=>"number"==typeof r&&0>t.floatCmp(r,e.value);return e=>!1;case w.LESS_THAN_OR_EQUAL:if("number"==typeof e.value)return r=>"number"==typeof r&&0>=t.floatCmp(r,e.value);return e=>!1;case w.EQUAL:if("number"==typeof e.value)return r=>{if("number"==typeof r)return 0===t.floatCmp(r,e.value);if("string"!=typeof r)return!1;{if(""===r)return!1;let n=t.coerceToMaybeNumber(r);return void 0!==n&&0===t.floatCmp(n,e.value)}};if("string"==typeof e.value)return t.eqMatcherFunction(e.value);if("boolean"==typeof e.value)return t=>"boolean"==typeof t&&t===e.value;else return e=>e===tM;case w.NOT_EQUAL:if("number"==typeof e.value)return r=>{if("number"==typeof r)return 0!==t.floatCmp(r,e.value);if("string"!=typeof r)return!0;{if(""===r)return!0;let n=t.coerceToMaybeNumber(r);return void 0===n||0!==t.floatCmp(n,e.value)}};if("string"==typeof e.value)return t.neqMatcherFunction(e.value);if("boolean"==typeof e.value)return t=>"boolean"!=typeof t||t!==e.value;else return e=>e!==tM}};class o9{constructor(e,t,r,n,o,i,s,a,l,h){this.config=e,this.dependencyGraph=t,this.columnSearch=r,this.stats=n,this.arithmeticHelper=o,this.functionRegistry=i,this.namedExpressions=s,this.serialization=a,this.arraySizePredictor=l,this.dateTimeHelper=h,this.equalOp=(e,t)=>o8(this.arithmeticHelper.eq,e,t),this.notEqualOp=(e,t)=>o8(this.arithmeticHelper.neq,e,t),this.greaterThanOp=(e,t)=>o8(this.arithmeticHelper.gt,e,t),this.lessThanOp=(e,t)=>o8(this.arithmeticHelper.lt,e,t),this.greaterThanOrEqualOp=(e,t)=>o8(this.arithmeticHelper.geq,e,t),this.lessThanOrEqualOp=(e,t)=>o8(this.arithmeticHelper.leq,e,t),this.concatOp=(e,t)=>o8(this.arithmeticHelper.concat,nd(e),nd(t)),this.plusOp=(e,t)=>o8(this.arithmeticHelper.addWithEpsilon,this.arithmeticHelper.coerceScalarToNumberOrError(e),this.arithmeticHelper.coerceScalarToNumberOrError(t)),this.minusOp=(e,t)=>o8(this.arithmeticHelper.subtract,this.arithmeticHelper.coerceScalarToNumberOrError(e),this.arithmeticHelper.coerceScalarToNumberOrError(t)),this.timesOp=(e,t)=>o8(this.arithmeticHelper.multiply,this.arithmeticHelper.coerceScalarToNumberOrError(e),this.arithmeticHelper.coerceScalarToNumberOrError(t)),this.powerOp=(e,t)=>o8(this.arithmeticHelper.pow,this.arithmeticHelper.coerceScalarToNumberOrError(e),this.arithmeticHelper.coerceScalarToNumberOrError(t)),this.divOp=(e,t)=>o8(this.arithmeticHelper.divide,this.arithmeticHelper.coerceScalarToNumberOrError(e),this.arithmeticHelper.coerceScalarToNumberOrError(t)),this.unaryMinusOp=e=>o7(this.arithmeticHelper.unaryMinus,this.arithmeticHelper.coerceScalarToNumberOrError(e)),this.percentOp=e=>o7(this.arithmeticHelper.unaryPercent,this.arithmeticHelper.coerceScalarToNumberOrError(e)),this.unaryPlusOp=e=>this.arithmeticHelper.unaryPlus(e),this.functionRegistry.initializePlugins(this),this.criterionBuilder=new o6(e)}evaluateAst(e,t){var r,n,o;let i=this.evaluateAstWithoutPostprocessing(e,t);if(tP(i))if(ng(tI(i)))return new rK(d.NUM,ej.NaN);else{i=tN(i,0===(r=tI(i))?0:r)}return i instanceof tF&&1===i.height()&&1===i.width()&&([[i]]=i.data),n=i,o=t.formulaVertex,n instanceof rK&&void 0!==o?n.attachRootVertex(o):n}evaluateAstWithoutPostprocessing(e,t){switch(e.type){case o.EMPTY:return tM;case o.CELL_REFERENCE:{let r=e.reference.toSimpleCellAddress(t.formulaAddress);if(r1(r))return new rK(d.REF,ej.BadRef);if(!this.isSheetValid(e.reference))return new rK(d.REF,ej.SheetRef);return this.dependencyGraph.getCellValue(r)}case o.NUMBER:case o.STRING:return e.value;case o.CONCATENATE_OP:{let r=this.evaluateAst(e.left,t),n=this.evaluateAst(e.right,t);return this.binaryRangeWrapper(this.concatOp,r,n,t)}case o.EQUALS_OP:{let r=this.evaluateAst(e.left,t),n=this.evaluateAst(e.right,t);return this.binaryRangeWrapper(this.equalOp,r,n,t)}case o.NOT_EQUAL_OP:{let r=this.evaluateAst(e.left,t),n=this.evaluateAst(e.right,t);return this.binaryRangeWrapper(this.notEqualOp,r,n,t)}case o.GREATER_THAN_OP:{let r=this.evaluateAst(e.left,t),n=this.evaluateAst(e.right,t);return this.binaryRangeWrapper(this.greaterThanOp,r,n,t)}case o.LESS_THAN_OP:{let r=this.evaluateAst(e.left,t),n=this.evaluateAst(e.right,t);return this.binaryRangeWrapper(this.lessThanOp,r,n,t)}case o.GREATER_THAN_OR_EQUAL_OP:{let r=this.evaluateAst(e.left,t),n=this.evaluateAst(e.right,t);return this.binaryRangeWrapper(this.greaterThanOrEqualOp,r,n,t)}case o.LESS_THAN_OR_EQUAL_OP:{let r=this.evaluateAst(e.left,t),n=this.evaluateAst(e.right,t);return this.binaryRangeWrapper(this.lessThanOrEqualOp,r,n,t)}case o.PLUS_OP:{let r=this.evaluateAst(e.left,t),n=this.evaluateAst(e.right,t);return this.binaryRangeWrapper(this.plusOp,r,n,t)}case o.MINUS_OP:{let r=this.evaluateAst(e.left,t),n=this.evaluateAst(e.right,t);return this.binaryRangeWrapper(this.minusOp,r,n,t)}case o.TIMES_OP:{let r=this.evaluateAst(e.left,t),n=this.evaluateAst(e.right,t);return this.binaryRangeWrapper(this.timesOp,r,n,t)}case o.POWER_OP:{let r=this.evaluateAst(e.left,t),n=this.evaluateAst(e.right,t);return this.binaryRangeWrapper(this.powerOp,r,n,t)}case o.DIV_OP:{let r=this.evaluateAst(e.left,t),n=this.evaluateAst(e.right,t);return this.binaryRangeWrapper(this.divOp,r,n,t)}case o.PLUS_UNARY_OP:{let r=this.evaluateAst(e.value,t);return this.unaryRangeWrapper(this.unaryPlusOp,r,t)}case o.MINUS_UNARY_OP:{let r=this.evaluateAst(e.value,t);return this.unaryRangeWrapper(this.unaryMinusOp,r,t)}case o.PERCENT_OP:{let r=this.evaluateAst(e.value,t);return this.unaryRangeWrapper(this.percentOp,r,t)}case o.FUNCTION_CALL:{if("valid"!==this.config.licenseKeyValidityState&&!o2.functionIsProtected(e.procedureName))return new rK(d.LIC,ej.LicenseKey(this.config.licenseKeyValidityState));let r=this.functionRegistry.getFunction(e.procedureName);if(void 0!==r)return r(e,new nr(t.formulaAddress,t.arraysFlag||this.functionRegistry.isArrayFunction(e.procedureName),t.formulaVertex));return new rK(d.NAME,ej.FunctionName(e.procedureName))}case o.NAMED_EXPRESSION:{let r=this.namedExpressions.nearestNamedExpression(e.expressionName,t.formulaAddress.sheet);if(r)return this.dependencyGraph.getCellValue(r.address);return new rK(d.NAME,ej.NamedExpressionName(e.expressionName))}case o.CELL_RANGE:{if(!this.isSheetValid(e.start)||!this.isSheetValid(e.end))return new rK(d.REF,ej.SheetRef);if(!this.rangeSpansOneSheet(e))return new rK(d.REF,ej.RangeManySheets);let r=r8.fromCellRange(e,t.formulaAddress),n=this.dependencyGraph.getArray(r);if(n){let e=n.array;if(e instanceof ry)throw Error("Array should be already computed");if(e instanceof rK)return e;if(e instanceof rw)return tF.fromRange(e.raw(),r,this.dependencyGraph);else throw Error("Unknown array")}return tF.onlyRange(r,this.dependencyGraph)}case o.COLUMN_RANGE:{if(!this.isSheetValid(e.start)||!this.isSheetValid(e.end))return new rK(d.REF,ej.SheetRef);if(!this.rangeSpansOneSheet(e))return new rK(d.REF,ej.RangeManySheets);let r=ne.fromColumnRange(e,t.formulaAddress);return tF.onlyRange(r,this.dependencyGraph)}case o.ROW_RANGE:{if(!this.isSheetValid(e.start)||!this.isSheetValid(e.end))return new rK(d.REF,ej.SheetRef);if(!this.rangeSpansOneSheet(e))return new rK(d.REF,ej.RangeManySheets);let r=nt.fromRowRangeAst(e,t.formulaAddress);return tF.onlyRange(r,this.dependencyGraph)}case o.PARENTHESIS:return this.evaluateAst(e.expression,t);case o.ARRAY:{let r,n=[];for(let o of e.args){let e,i=[];for(let r of o){let n=ns(this.evaluateAst(r,t)),o=n.height();if(void 0===e)e=o,i.push(...n.data);else if(e!==o)return new rK(d.REF,ej.SizeMismatch);else for(let e=0;e<o;e++)i[e].push(...n.data[e])}let s=i[0].length;if(void 0===r)r=s,n.push(...i);else{if(r!==s)return new rK(d.REF,ej.SizeMismatch);n.push(...i)}}return tF.onlyValues(n)}case o.ERROR_WITH_RAW_INPUT:case o.ERROR:return e.error}}isSheetValid(e){return void 0===e.sheet||e.sheet===tW.SHEET_FOR_WORKBOOK_EXPRESSIONS||this.dependencyGraph.sheetMapping.hasSheetWithId(e.sheet,{includePlaceholders:!1})}rangeSpansOneSheet(e){return e.start.sheet===e.end.sheet}unaryRangeWrapper(e,t,r){var n;if(t instanceof tF&&!r.arraysFlag&&(t=null!=(n=nw(t,r))?n:new rK(d.VALUE,ej.ScalarExpected)),t instanceof rK)return t;if(t instanceof tF){let r=t.data.map(t=>t.map(e));return tF.onlyValues(r)}return e(t)}binaryRangeWrapper(e,t,r,n){var o,i;if(t instanceof tF&&!n.arraysFlag&&(t=null!=(o=nw(t,n))?o:new rK(d.VALUE,ej.ScalarExpected)),t instanceof rK)return t;if(r instanceof tF&&!n.arraysFlag&&(r=null!=(i=nw(r,n))?i:new rK(d.VALUE,ej.ScalarExpected)),r instanceof rK)return r;if(t instanceof tF||r instanceof tF){if(!(t instanceof tF))if(r.isAdHoc()){let n=r.data;for(let r=0;r<n.length;r++)for(let o=0;o<n[0].length;o++)n[r][o]=e(t,n[r][o]);return tF.onlyValues(n)}else t=tF.fromScalar(t);if(!(r instanceof tF))if(t.isAdHoc()){let n=t.data;for(let t=0;t<n.length;t++)for(let o=0;o<n[0].length;o++)n[t][o]=e(n[t][o],r);return tF.onlyValues(n)}else r=tF.fromScalar(r);if(t.width()===r.width()&&t.height()===r.height()){if(t.isAdHoc()){let n=t.data,o=r.data;for(let t=0;t<n.length;t++)for(let r=0;r<n[0].length;r++)n[t][r]=e(n[t][r],o[t][r]);return tF.onlyValues(n)}if(r.isAdHoc()){let n=t.data,o=r.data;for(let t=0;t<n.length;t++)for(let r=0;r<n[0].length;r++)o[t][r]=e(n[t][r],o[t][r]);return tF.onlyValues(o)}}let n=Math.max(t.width(),r.width()),o=Math.max(t.height(),r.height()),i=Array(o);for(let e=0;e<o;e++)i[e]=Array(n);for(let s=0;s<o;s++){let o=1!==t.height()?s:0,a=1!==r.height()?s:0;for(let l=0;l<n;l++){let n=1!==t.width()?l:0,h=1!==r.width()?l:0;o<t.height()&&a<r.height()&&n<t.width()&&h<r.width()?i[s][l]=e(t.data[o][n],r.data[a][h]):i[s][l]=new rK(d.NA)}}return tF.onlyValues(i)}return e(t,r)}}function o7(e,t){return t instanceof rK?t:e(t)}function o8(e,t,r){return t instanceof rK?t:r instanceof rK?r:e(t,r)}class ie{constructor(e){this.sheet=e,this.transformations=[]}add(e){this.transformations.push(e)}performEagerTransformations(e,t){this.transformations.forEach(r=>r.performEagerTransformations(e,t))}transformSingleAst(e,t){let[r,n]=[e,t];return this.transformations.forEach(e=>{[r,n]=e.transformSingleAst(r,n)}),[r,n]}isIrreversible(){return!0}}class it{constructor(e,t){this.stats=e,this.maxPendingLazyTransformations=t,this.transformations=[],this.versionOffset=0}version(){return this.versionOffset+this.transformations.length}addTransformation(e){return void 0!==this.combinedTransformer?this.combinedTransformer.add(e):this.transformations.push(e),this.version()}beginCombinedMode(e){this.combinedTransformer=new ie(e)}commitCombinedMode(){if(void 0===this.combinedTransformer)throw Error("Combined mode wasn't started");return this.transformations.push(this.combinedTransformer),this.combinedTransformer=void 0,this.version()}applyTransformations(e,t,r){this.stats.start(a.TRANSFORM_ASTS_POSTPONED);let n=this.version();for(let o=Math.max(r,this.versionOffset);o<n;o++){let r=this.transformations[o-this.versionOffset];r.isIrreversible()&&(this.undoRedo.storeDataForVersion(o,t,this.parser.computeHashFromAst(e)),this.parser.rememberNewAst(e));let[n,i]=r.transformSingleAst(e,t);e=n,t=i}let o=this.parser.rememberNewAst(e);return this.stats.end(a.TRANSFORM_ASTS_POSTPONED),[o,t,n]}*getTransformationsFrom(e,t){let r=this.version();for(let n=Math.max(e,this.versionOffset);n<r;n++){let e=this.transformations[n-this.versionOffset];(!t||t(e))&&(yield e)}}needsCompaction(){return this.transformations.length>=this.maxPendingLazyTransformations}compact(){this.versionOffset+=this.transformations.length,this.transformations=[]}}function ir(e,t){return typeof e==typeof t?e===tM?0:e<t?-1:+(e>t):e===tM?-1:t===tM?1:t instanceof rK||"number"==typeof e&&"string"==typeof t||"number"==typeof e&&"boolean"==typeof t?-1:"string"==typeof e&&"number"==typeof t?1:"string"==typeof e&&"boolean"==typeof t?-1:1}class io{constructor(e){this.dependencyGraph=e}advancedFind(e,t,{returnOccurrence:r}={returnOccurrence:"first"}){let n=t.range,o=void 0===n?t.valuesFromTopLeftCorner():this.dependencyGraph.computeListOfValuesInRange(n),i="first"===r?0:o.length-1,s="first"===r?e=>e<o.length:e=>e>=0,a="first"===r?e=>e+1:e=>e-1;for(let t=i;s(t);t=a(t))if(e(tI(o[t])))return t;return -1}basicFind(e,t,r,{ordering:n,ifNoMatch:o,returnOccurrence:i}){let s="string"==typeof e?ny(e):e,a=t.range;return void 0===a?this.findNormalizedValue(s,t.valuesFromTopLeftCorner(),o,i):"none"===n?this.findNormalizedValue(s,this.dependencyGraph.computeListOfValuesInRange(a),o,i):function(e,t,{searchCoordinate:r,orderingDirection:n,ifNoMatch:o},i){let s=t.start[r],a="col"===r?t.effectiveEndColumn(i):t.effectiveEndRow(i),l="col"===r?e=>tI(i.getCellValue(r0(t.sheet,e,t.start.row))):e=>tI(i.getCellValue(r0(t.sheet,t.start.col,e))),h="asc"===n?(e,t)=>ir(e,t):(e,t)=>-ir(e,t),d=function(e,t,r){let n=t,o=r;for(;n<o;){let t=Math.ceil((n+o)/2);e(t)?n=t:o=t-1}return n===o&&e(n)?n:-1}(t=>h(e,l(t))>=0,s,a),u=l(d);if(u===e)return d-s;if("returnLowerBound"===o){if(-1===d)return"asc"===n?-1:0;if(typeof u!=typeof e)return -1;if("asc"===n)return d-s;let t=d+1;return t<=a?t-s:-1}if("returnUpperBound"===o){if(-1===d)return"asc"===n?0:-1;if(typeof u!=typeof e)return -1;if("desc"===n)return d-s;let t=d+1;return t<=a?t-s:-1}return -1}(s,a,{searchCoordinate:r,orderingDirection:n,ifNoMatch:o},this.dependencyGraph)}findNormalizedValue(e,t,r="returnNotFound",n="first"){let o=t.map(tI).map(e=>"string"==typeof e?ny(e):e);if("returnNotFound"===r)return"first"===n?o.indexOf(e):o.lastIndexOf(e);let i="returnLowerBound"===r?(e,t)=>ir(e,t):(e,t)=>-ir(e,t),s="returnLowerBound"===r?-1/0:1/0,a=-1,l="first"===n?0:o.length-1,h="first"===n?e=>e<o.length:e=>e>=0,d="first"===n?e=>e+1:e=>e-1;for(let t=l;h(t);t=d(t)){let r=o[t];if(r===e)return t;!(i(r,e)>0)&&0>i(s,r)&&(s=r,a=t)}return a}}class ii extends io{constructor(e){super(e),this.dependencyGraph=e}add(e,t){}remove(e,t){}change(e,t,r){}applyChanges(e){}addColumns(e){}removeColumns(e){}removeSheet(e){}moveValues(e,t,r,n){}removeValues(e){}forceApplyPostponedTransformations(){}find(e,t,r){return this.basicFind(e,t,"row",r)}}class is{constructor(e,t,r){this.dependencyGraph=e,this.config=t,this.stats=r,this.index=new Map,this.transformingService=this.dependencyGraph.lazilyTransformingAstService,this.binarySearchStrategy=new ii(e)}add(e,t){if(e!==tM&&!(e instanceof rK))if(e instanceof tF)for(let[r,n]of e.entriesFromTopLeftCorner(t))this.addSingleCellValue(tI(r),n);else this.addSingleCellValue(e,t)}remove(e,t){if(void 0!==e)if(e instanceof tF)for(let[r,n]of e.entriesFromTopLeftCorner(t))this.removeSingleValue(tI(r),n);else this.removeSingleValue(e,t)}change(e,t,r){e!==t&&(this.remove(e,r),this.add(t,r))}applyChanges(e){for(let t of e)void 0!==t.oldValue&&this.change(tI(t.oldValue),tI(t.value),t.address)}moveValues(e,t,r,n){for(let[o,i]of e){let e=r2(i,n,t,r);this.remove(o,i),this.add(o,e)}}removeValues(e){for(let[t,r]of e)this.remove(t,r)}find(e,t,{ordering:r,ifNoMatch:n,returnOccurrence:o}){null==o&&(o="none"===r?"first":"last");let i=this.findUsingColumnIndex(e,t,o);return void 0!==i?i:this.binarySearchStrategy.find(e,t,{ordering:r,ifNoMatch:n,returnOccurrence:o})}findUsingColumnIndex(e,t,r){let n=t.range;if(void 0===n)return;this.ensureRecentData(n.sheet,n.start.col,e);let o=this.getColumnMap(n.sheet,n.start.col);if(!o)return -1;let i="string"==typeof e?ny(e):e,s=o.get(i);if(!s||!s.index||0===s.index.length)return;let a=is.findRowBelongingToRange(s,n,r);return void 0!==a?a-n.start.row:void 0}static findRowBelongingToRange(e,t,r){let n=t.start.row,o=t.end.row,i="first"===r?ia(n,e.index,"upperBound"):ia(o,e.index,"lowerBound");if(-1===i)return;let s=e.index[i];return s>=n&&s<=o?s:void 0}advancedFind(e,t,r={returnOccurrence:"first"}){return this.binarySearchStrategy.advancedFind(e,t,r)}addColumns(e){let t=this.index.get(e.sheet);t&&t.splice(e.columnStart,0,...Array(e.numberOfColumns))}removeColumns(e){let t=this.index.get(e.sheet);t&&t.splice(e.columnStart,e.numberOfColumns)}removeSheet(e){this.index.delete(e)}forceApplyPostponedTransformations(){for(let[e,t]of this.index)t.forEach((t,r)=>{if(t)for(let n of t.keys())this.ensureRecentData(e,r,n)})}getColumnMap(e,t){this.index.has(e)||this.index.set(e,[]);let r=this.index.get(e),n=r[t];return n||(n=new Map,r[t]=n),n}getValueIndex(e,t,r){let n=this.getColumnMap(e,t),o=this.getColumnMap(e,t).get(r);return o||(o={version:this.transformingService.version(),index:[]},n.set(r,o)),o}ensureRecentData(e,t,r){let n=this.getValueIndex(e,t,r),o=this.transformingService.version();if(n.version!==o){for(let o of this.transformingService.getTransformationsFrom(n.version,t=>t.sheet===e&&(t instanceof oa||t instanceof oc)))o instanceof oa?this.addRows(t,o.rowsSpan,r):o instanceof oc&&this.removeRows(t,o.rowsSpan,r);n.version=o}}addSingleCellValue(e,t){this.stats.measure(a.BUILD_COLUMN_INDEX,()=>{this.ensureRecentData(t.sheet,t.col,e),"string"==typeof e&&(e=ny(e));let r=this.getValueIndex(t.sheet,t.col,e);is.addValue(r,t.row)})}removeSingleValue(e,t){this.stats.measure(a.BUILD_COLUMN_INDEX,()=>{this.ensureRecentData(t.sheet,t.col,e);let r=this.getColumnMap(t.sheet,t.col);"string"==typeof e&&(e=ny(e));let n=r.get(e);if(!n)return;let o=ia(t.row,n.index);o>-1&&n.index.splice(o,1),0===n.index.length&&r.delete(e),0===r.size&&delete this.index.get(t.sheet)[t.col]})}addRows(e,t,r){let n=this.getValueIndex(t.sheet,e,r);is.shiftRows(n,t.rowStart,t.numberOfRows)}removeRows(e,t,r){let n=this.getValueIndex(t.sheet,e,r);is.removeRowsFromValues(n,t),is.shiftRows(n,t.rowEnd+1,-t.numberOfRows)}static addValue(e,t){let r=ia(t,e.index,"lowerBound");e.index[r]!==t&&e.index.splice(r+1,0,t)}static removeRowsFromValues(e,t){let r=ia(t.rowStart,e.index,"upperBound"),n=ia(t.rowEnd,e.index,"lowerBound");r>-1&&n>-1&&r<=n&&e.index[r]<=t.rowEnd&&e.index.splice(r,n-r+1)}static shiftRows(e,t,r){let n=ia(t,e.index,"upperBound");if(-1!==n)for(let t=n;t<e.index.length;++t)e.index[t]+=r}}function ia(e,t,r="upperBound"){let n=0,o=t.length-1;for(;n<=o;){let r=Math.floor((n+o)/2);if(e>t[r])n=r+1;else{if(!(e<t[r]))return r;o=r-1}}let i="lowerBound"===r?o:n;return i>=0&&i<=t.length?i:-1}class il{constructor(e){this.config=e;const t="."===this.config.thousandSeparator?`\\${this.config.thousandSeparator}`:this.config.thousandSeparator,r="."===this.config.decimalSeparator?`\\${this.config.decimalSeparator}`:this.config.decimalSeparator;this.numberPattern=RegExp(`^([+-]?((${r}\\d+)|(\\d+(${t}\\d{3,})*(${r}\\d*)?)))([eE][+-]?\\d+)?$`),this.allThousandSeparatorsRegex=RegExp(`${t}`,"g")}numericStringToMaybeNumber(e){if(this.numberPattern.test(e)){let t=this.numericStringToNumber(e);if(!isNaN(t))return t}}numericStringToNumber(e){return Number(e.replace(this.allThousandSeparatorsRegex,"").replace(this.config.decimalSeparator,"."))}}class ih{constructor(e,t,r){this.dependencyGraph=e,this.unparser=t,this.exporter=r}getCellHyperlink(e){let t=this.dependencyGraph.getCell(e);if(t instanceof rA){let e=t.getFormula(this.dependencyGraph.lazilyTransformingAstService);if("HYPERLINK"===e.procedureName)return e.hyperlink}}getCellFormula(e,t){let r=this.dependencyGraph.getCell(e);if(r instanceof rA){let n=r.getFormula(this.dependencyGraph.lazilyTransformingAstService);return t=null!=t?t:e,this.unparser.unparse(n,t)}if(r instanceof rT){let n=r.getAddress(this.dependencyGraph.lazilyTransformingAstService);if(n.row!==e.row||n.col!==e.col||n.sheet!==e.sheet)return;t=null!=t?t:e;let o=r.getFormula(this.dependencyGraph.lazilyTransformingAstService);if(void 0!==o)return this.unparser.unparse(o,t)}else if(r instanceof rz)return r.getFormula()}getCellSerialized(e,t){var r;return null!=(r=this.getCellFormula(e,t))?r:this.getRawValue(e)}getCellValue(e){return this.exporter.exportValue(this.dependencyGraph.getScalarValue(e))}getRawValue(e){return this.dependencyGraph.getRawValue(e)}getSheetValues(e){return this.genericSheetGetter(e,e=>this.getCellValue(e))}getSheetFormulas(e){return this.genericSheetGetter(e,e=>this.getCellFormula(e))}genericSheetGetter(e,t){let r=this.dependencyGraph.getSheetHeight(e),n=this.dependencyGraph.getSheetWidth(e),o=Array(r);for(let i=0;i<r;i++){o[i]=Array(n);for(let r=0;r<n;r++){let n=r0(e,r,i);o[i][r]=t(n)}for(let e=n-1;e>=0;e--)if(null===o[i][e]||void 0===o[i][e])o[i].pop();else break}for(let e=r-1;e>=0;e--)if(0===o[e].length)o.pop();else break;return o}genericAllSheetsGetter(e){let t={};for(let r of this.dependencyGraph.sheetMapping.iterateSheetNames()){let n=this.dependencyGraph.sheetMapping.getSheetIdOrThrowError(r);t[r]=e(n)}return t}getSheetSerialized(e){return this.genericSheetGetter(e,e=>this.getCellSerialized(e))}getAllSheetsValues(){return this.genericAllSheetsGetter(e=>this.getSheetValues(e))}getAllSheetsFormulas(){return this.genericAllSheetsGetter(e=>this.getSheetFormulas(e))}getAllSheetsSerialized(){return this.genericAllSheetsGetter(e=>this.getSheetSerialized(e))}getAllNamedExpressionsSerialized(){let e=[],t=0;for(let r of this.dependencyGraph.sheetMapping.iterateSheetNames())e[this.dependencyGraph.sheetMapping.getSheetIdOrThrowError(r)]=t,t++;return this.dependencyGraph.namedExpressions.getAllNamedExpressions().map(t=>({name:t.expression.displayName,expression:this.getCellSerialized(t.expression.address),scope:void 0!==t.scope?e[t.scope]:void 0,options:t.expression.options}))}withNewConfig(e,t){let r=new tf(e,this.dependencyGraph.sheetMapping,t);return new ih(this.dependencyGraph,r,this.exporter)}}class id{static buildFromSheets(e,t={},r=[]){let n=new im(t);return this.buildEngine(n,e,r)}static buildFromSheet(e,t={},r=[]){let n=new im(t),o=n.translationPackage.getUITranslation(h.NEW_SHEET_PREFIX)+"1";return this.buildEngine(n,{[o]:e},r)}static buildEmpty(e={},t=[]){return this.buildEngine(new im(e),{},t)}static rebuildWithConfig(e,t,r,n){return this.buildEngine(e,t,r,n)}static buildEngine(e,t={},r=[],n=e.useStats?new tj:new tq){n.start(a.BUILD_ENGINE_TOTAL);let o=new tW,i=new o2(e),s=new it(n,e.maxPendingLazyTransformations),l=rB.buildEmpty(s,e,i,o,n),h=e.useColumnIndex?new is(l,e,n):new ii(l),d=l.sheetMapping,u=l.addressMapping;for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let n=t[r];rD(n);let o=rF(n);if(o.height>e.maxRows||o.width>e.maxColumns)throw new tZ;let i=d.addSheet(r);u.addSheetAndSetStrategyBasedOnBoundaries(i,o,{throwIfSheetAlreadyExists:!0})}let c=new tC(e,i,l.sheetReferenceRegistrar.ensureSheetRegistered.bind(l.sheetReferenceRegistrar));s.parser=c;let g=new tf(e,d,o),p=new n$(e),m=new il(e),f=new no(e,p,m),b=new or(e,p,m),C=new nE(e,i),y=new oC(e,l,h,b,c,n,s,o,C),w=new oW(e,y);s.undoRedo=w;let S=new oo(e,l,y),v=new oG(e,y,w,S,l,h,c,b,s,o),R=new oX(e,o,d,s),E=new ih(l,g,R),T=new o9(e,l,h,n,f,i,o,E,C,p);n.measure(a.GRAPH_BUILD,()=>{new oQ(l,h,c,b,n,C).buildGraph(t,n)}),r.forEach(e=>{v.ensureItIsPossibleToAddNamedExpression(e.name,e.expression,e.scope),v.operations.addNamedExpression(e.name,e.expression,e.scope,e.options)});let A=new oj(e,n,T,s,l,h);return A.run(),n.end(a.BUILD_ENGINE_TOTAL),{config:e,stats:n,dependencyGraph:l,columnSearch:h,parser:c,unparser:g,cellContentParser:b,evaluator:A,lazilyTransformingAstService:s,crudOperations:v,exporter:R,namedExpressions:o,serialization:E,functionRegistry:i}}}var iu=r(732);(V=S||(S={})).SheetAdded="sheetAdded",V.SheetRemoved="sheetRemoved",V.SheetRenamed="sheetRenamed",V.NamedExpressionAdded="namedExpressionAdded",V.NamedExpressionRemoved="namedExpressionRemoved",V.ValuesUpdated="valuesUpdated",V.EvaluationSuspended="evaluationSuspended",V.EvaluationResumed="evaluationResumed";class ic extends iu.TinyEmitter{emit(e,...t){return super.emit(e,...t),this}}class ig{constructor(e,t,r,n,o,i,s,a,l,h,d,u,c,g){this._config=e,this._stats=t,this._dependencyGraph=r,this._columnSearch=n,this._parser=o,this._unparser=i,this._cellContentParser=s,this._evaluator=a,this._lazilyTransformingAstService=l,this._crudOperations=h,this._exporter=d,this._namedExpressions=u,this._serialization=c,this._functionRegistry=g,this._emitter=new ic,this._evaluationSuspended=!1}static get defaultConfig(){return ib({})}get graph(){return this.dependencyGraph.graph}get rangeMapping(){return this.dependencyGraph.rangeMapping}get arrayMapping(){return this.dependencyGraph.arrayMapping}get sheetMapping(){return this.dependencyGraph.sheetMapping}get addressMapping(){return this.dependencyGraph.addressMapping}get dependencyGraph(){return this._dependencyGraph}get evaluator(){return this._evaluator}get columnSearch(){return this._columnSearch}get lazilyTransformingAstService(){return this._lazilyTransformingAstService}get licenseKeyValidityState(){return this._config.licenseKeyValidityState}static buildFromArray(e,t={},r=[]){return this.buildFromEngineState(id.buildFromSheet(e,t,r))}static buildFromSheets(e,t={},r=[]){return this.buildFromEngineState(id.buildFromSheets(e,t,r))}static buildEmpty(e={},t=[]){return this.buildFromEngineState(id.buildEmpty(e,t))}static getLanguage(e){nN(e,"string","languageCode");let t=this.registeredLanguages.get(e);if(void 0!==t)return t;throw new rh}static registerLanguage(e,t){if(nN(e,"string","languageCode"),this.registeredLanguages.has(e))throw new rd;this.registeredLanguages.set(e,new rH(Object.assign({},t.functions),Object.assign({},t.errors),Object.assign({},t.ui)))}static unregisterLanguage(e){if(nN(e,"string","languageCode"),this.registeredLanguages.has(e))this.registeredLanguages.delete(e);else throw new rh}static getRegisteredLanguagesCodes(){return Array.from(this.registeredLanguages.keys())}static registerFunctionPlugin(e,t){o2.registerFunctionPlugin(e,t)}static unregisterFunctionPlugin(e){o2.unregisterFunctionPlugin(e)}static registerFunction(e,t,r){nN(e,"string","functionId"),o2.registerFunction(e,t,r)}static unregisterFunction(e){nN(e,"string","functionId"),o2.unregisterFunction(e)}static unregisterAllFunctions(){o2.unregisterAll()}static getRegisteredFunctionNames(e){nN(e,"string","code");let t=o2.getRegisteredFunctionIds();return this.getLanguage(e).getFunctionTranslations(t)}static getFunctionPlugin(e){return nN(e,"string","functionId"),o2.getFunctionPlugin(e)}static getAllFunctionPlugins(){return o2.getPlugins()}static buildFromEngineState(e){return new ig(e.config,e.stats,e.dependencyGraph,e.columnSearch,e.parser,e.unparser,e.cellContentParser,e.evaluator,e.lazilyTransformingAstService,e.crudOperations,e.exporter,e.namedExpressions,e.serialization,e.functionRegistry)}getCellValue(e){if(!r6(e))throw new rt("SimpleCellAddress","cellAddress");return this.ensureEvaluationIsNotSuspended(),this._serialization.getCellValue(e)}getCellFormula(e){if(!r6(e))throw new rt("SimpleCellAddress","cellAddress");return this._serialization.getCellFormula(e)}getCellHyperlink(e){if(!r6(e))throw new rt("SimpleCellAddress","cellAddress");return this.ensureEvaluationIsNotSuspended(),this._serialization.getCellHyperlink(e)}getCellSerialized(e){if(!r6(e))throw new rt("SimpleCellAddress","cellAddress");return this.ensureEvaluationIsNotSuspended(),this._serialization.getCellSerialized(e)}getSheetValues(e){return nN(e,"number","sheetId"),this.ensureEvaluationIsNotSuspended(),this._serialization.getSheetValues(e)}getSheetFormulas(e){return nN(e,"number","sheetId"),this._serialization.getSheetFormulas(e)}getSheetSerialized(e){return nN(e,"number","sheetId"),this.ensureEvaluationIsNotSuspended(),this._serialization.getSheetSerialized(e)}getAllSheetsDimensions(){return this._serialization.genericAllSheetsGetter(e=>this.getSheetDimensions(e))}getSheetDimensions(e){return nN(e,"number","sheetId"),{width:this.dependencyGraph.getSheetWidth(e),height:this.dependencyGraph.getSheetHeight(e)}}getAllSheetsValues(){return this.ensureEvaluationIsNotSuspended(),this._serialization.getAllSheetsValues()}getAllSheetsFormulas(){return this._serialization.getAllSheetsFormulas()}getAllSheetsSerialized(){return this.ensureEvaluationIsNotSuspended(),this._serialization.getAllSheetsSerialized()}updateConfig(e){Object.entries(e).every(([e,t])=>this._config[e]===t)||this.rebuildWithConfig(e)}getConfig(){return this._config.getConfig()}rebuildAndRecalculate(){this.rebuildWithConfig({})}getStats(){return this._stats.snapshot()}undo(){return this._crudOperations.undo(),this.recomputeIfDependencyGraphNeedsIt()}redo(){return this._crudOperations.redo(),this.recomputeIfDependencyGraphNeedsIt()}isThereSomethingToUndo(){return this._crudOperations.isThereSomethingToUndo()}isThereSomethingToRedo(){return this._crudOperations.isThereSomethingToRedo()}isItPossibleToSetCellContents(e){let t;if(r6(e))t=new r8(e,e);else if(r9(e))t=new r8(e.start,e.end);else throw new rt("SimpleCellAddress | SimpleCellRange","address");try{for(let e of(this._crudOperations.ensureRangeInSizeLimits(t),t.addresses(this._dependencyGraph)))this._crudOperations.ensureItIsPossibleToChangeContent(e)}catch(e){return!1}return!0}setCellContents(e,t){return this._crudOperations.setCellContents(e,t),this.recomputeIfDependencyGraphNeedsIt()}swapRowIndexes(e,t){return nN(e,"number","sheetId"),this._crudOperations.setRowOrder(e,t),this.recomputeIfDependencyGraphNeedsIt()}isItPossibleToSwapRowIndexes(e,t){nN(e,"number","sheetId");try{return this._crudOperations.validateSwapRowIndexes(e,t),this._crudOperations.testRowOrderForArrays(e,t),!0}catch(e){return!1}}setRowOrder(e,t){nN(e,"number","sheetId");let r=this._crudOperations.mappingFromOrder(e,t,"row");return this.swapRowIndexes(e,r)}isItPossibleToSetRowOrder(e,t){nN(e,"number","sheetId");try{let r=this._crudOperations.mappingFromOrder(e,t,"row");return this._crudOperations.validateSwapRowIndexes(e,r),this._crudOperations.testRowOrderForArrays(e,r),!0}catch(e){return!1}}swapColumnIndexes(e,t){return nN(e,"number","sheetId"),this._crudOperations.setColumnOrder(e,t),this.recomputeIfDependencyGraphNeedsIt()}isItPossibleToSwapColumnIndexes(e,t){nN(e,"number","sheetId");try{return this._crudOperations.validateSwapColumnIndexes(e,t),this._crudOperations.testColumnOrderForArrays(e,t),!0}catch(e){return!1}}setColumnOrder(e,t){nN(e,"number","sheetId");let r=this._crudOperations.mappingFromOrder(e,t,"column");return this.swapColumnIndexes(e,r)}isItPossibleToSetColumnOrder(e,t){nN(e,"number","sheetId");try{let r=this._crudOperations.mappingFromOrder(e,t,"column");return this._crudOperations.validateSwapColumnIndexes(e,r),this._crudOperations.testColumnOrderForArrays(e,r),!0}catch(e){return!1}}isItPossibleToAddRows(e,...t){nN(e,"number","sheetId");let r=ow(t);try{return this._crudOperations.ensureItIsPossibleToAddRows(e,...r),!0}catch(e){return!1}}addRows(e,...t){return nN(e,"number","sheetId"),this._crudOperations.addRows(e,...t),this.recomputeIfDependencyGraphNeedsIt()}isItPossibleToRemoveRows(e,...t){nN(e,"number","sheetId");let r=oy(t);try{return this._crudOperations.ensureItIsPossibleToRemoveRows(e,...r),!0}catch(e){return!1}}removeRows(e,...t){return nN(e,"number","sheetId"),this._crudOperations.removeRows(e,...t),this.recomputeIfDependencyGraphNeedsIt()}isItPossibleToAddColumns(e,...t){nN(e,"number","sheetId");let r=ow(t);try{return this._crudOperations.ensureItIsPossibleToAddColumns(e,...r),!0}catch(e){return!1}}addColumns(e,...t){return nN(e,"number","sheetId"),this._crudOperations.addColumns(e,...t),this.recomputeIfDependencyGraphNeedsIt()}isItPossibleToRemoveColumns(e,...t){nN(e,"number","sheetId");let r=oy(t);try{return this._crudOperations.ensureItIsPossibleToRemoveColumns(e,...r),!0}catch(e){return!1}}removeColumns(e,...t){return nN(e,"number","sheetId"),this._crudOperations.removeColumns(e,...t),this.recomputeIfDependencyGraphNeedsIt()}isItPossibleToMoveCells(e,t){if(!r6(t))throw new rt("SimpleCellAddress","destinationLeftCorner");if(!r9(e))throw new rt("SimpleCellRange","source");try{let r=new r8(e.start,e.end);return this._crudOperations.operations.ensureItIsPossibleToMoveCells(r.start,r.width(),r.height(),t),!0}catch(e){return!1}}moveCells(e,t){if(!r6(t))throw new rt("SimpleCellAddress","destinationLeftCorner");if(!r9(e))throw new rt("SimpleCellRange","source");let r=new r8(e.start,e.end);return this._crudOperations.moveCells(r.start,r.width(),r.height(),t),this.recomputeIfDependencyGraphNeedsIt()}isItPossibleToMoveRows(e,t,r,n){nN(e,"number","sheetId"),nN(t,"number","startRow"),nN(r,"number","numberOfRows"),nN(n,"number","targetRow");try{return this._crudOperations.ensureItIsPossibleToMoveRows(e,t,r,n),!0}catch(e){return!1}}moveRows(e,t,r,n){return nN(e,"number","sheetId"),nN(t,"number","startRow"),nN(r,"number","numberOfRows"),nN(n,"number","targetRow"),this._crudOperations.moveRows(e,t,r,n),this.recomputeIfDependencyGraphNeedsIt()}isItPossibleToMoveColumns(e,t,r,n){nN(e,"number","sheetId"),nN(t,"number","startColumn"),nN(r,"number","numberOfColumns"),nN(n,"number","targetColumn");try{return this._crudOperations.ensureItIsPossibleToMoveColumns(e,t,r,n),!0}catch(e){return!1}}moveColumns(e,t,r,n){return nN(e,"number","sheetId"),nN(t,"number","startColumn"),nN(r,"number","numberOfColumns"),nN(n,"number","targetColumn"),this._crudOperations.moveColumns(e,t,r,n),this.recomputeIfDependencyGraphNeedsIt()}copy(e){if(!r9(e))throw new rt("SimpleCellRange","source");let t=new r8(e.start,e.end);return this._crudOperations.copy(t.start,t.width(),t.height()),this.getRangeValues(e)}cut(e){if(!r9(e))throw new rt("SimpleCellRange","source");let t=new r8(e.start,e.end);return this._crudOperations.cut(t.start,t.width(),t.height()),this.getRangeValues(e)}paste(e){if(!r6(e))throw new rt("SimpleCellAddress","targetLeftCorner");return this.ensureEvaluationIsNotSuspended(),this._crudOperations.paste(e),this.recomputeIfDependencyGraphNeedsIt()}isClipboardEmpty(){return this._crudOperations.isClipboardEmpty()}clearClipboard(){this._crudOperations.clearClipboard()}clearRedoStack(){this._crudOperations.undoRedo.clearRedoStack()}clearUndoStack(){this._crudOperations.undoRedo.clearUndoStack()}getRangeValues(e){if(!r9(e))throw new rt("SimpleCellRange","source");return new r8(e.start,e.end).arrayOfAddressesInRange().map(e=>e.map(e=>this.getCellValue(e)))}getRangeFormulas(e){if(!r9(e))throw new rt("SimpleCellRange","source");return new r8(e.start,e.end).arrayOfAddressesInRange().map(e=>e.map(e=>this.getCellFormula(e)))}getRangeSerialized(e){if(!r9(e))throw new rt("SimpleCellRange","source");return new r8(e.start,e.end).arrayOfAddressesInRange().map(e=>e.map(e=>this.getCellSerialized(e)))}getFillRangeData(e,t,r=!1){if(!r9(e))throw new rt("SimpleCellRange","source");if(!r9(t))throw new rt("SimpleCellRange","target");let n=new r8(e.start,e.end),o=new r8(t.start,t.end);return this.ensureEvaluationIsNotSuspended(),o.arrayOfAddressesInRange().map(o=>o.map(o=>{let i=((o.row-(r?t:e).start.row)%n.height()+n.height())%n.height()+e.start.row,s=((o.col-(r?t:e).start.col)%n.width()+n.width())%n.width()+e.start.col;return this._serialization.getCellSerialized({row:i,col:s,sheet:n.sheet},o)}))}isItPossibleToAddSheet(e){nN(e,"string","sheetName");try{return this._crudOperations.ensureItIsPossibleToAddSheet(e),!0}catch(e){return!1}}addSheet(e){void 0!==e&&nN(e,"string","sheetName");let t=this._crudOperations.addSheet(e);return this.recomputeIfDependencyGraphNeedsIt(),this._emitter.emit(S.SheetAdded,t),t}isItPossibleToRemoveSheet(e){nN(e,"number","sheetId");try{return this._crudOperations.ensureScopeIdIsValid(e),!0}catch(e){return!1}}removeSheet(e){nN(e,"number","sheetId");let t=this.sheetMapping.getSheetName(e);this._crudOperations.removeSheet(e);let r=this.recomputeIfDependencyGraphNeedsIt();return this._emitter.emit(S.SheetRemoved,t,r),r}isItPossibleToClearSheet(e){nN(e,"number","sheetId");try{return this._crudOperations.ensureScopeIdIsValid(e),!0}catch(e){return!1}}clearSheet(e){return nN(e,"number","sheetId"),this._crudOperations.clearSheet(e),this.recomputeIfDependencyGraphNeedsIt()}isItPossibleToReplaceSheetContent(e,t){nN(e,"number","sheetId");try{return this._crudOperations.ensureScopeIdIsValid(e),this._crudOperations.ensureItIsPossibleToChangeSheetContents(e,t),!0}catch(e){return!1}}setSheetContent(e,t){return nN(e,"number","sheetId"),this._crudOperations.setSheetContent(e,t),this.recomputeIfDependencyGraphNeedsIt()}simpleCellAddressFromString(e,t){return nN(e,"string","cellAddress"),nN(t,"number","sheetId"),eM(this.sheetMapping.getSheetId.bind(this.sheetMapping),e,t)}simpleCellRangeFromString(e,t){return nN(e,"string","cellRange"),nN(t,"number","sheetId"),((e,t,r)=>{let n=t.split(":");if(2!==n.length)return;let[o,i]=n,s=eM(e,o,r);if(void 0===s)return;let a=eM(e,i,s.sheet);if(void 0!==a&&s.sheet===a.sheet)return r7(s,a)})(this.sheetMapping.getSheetId.bind(this.sheetMapping),e,t)}simpleCellAddressToString(e,t={}){if(!r6(e))throw new rt("SimpleCellAddress","cellAddress");let r="number"==typeof t?t:t.includeSheetName?e.sheet+1:e.sheet;return eI(this.sheetMapping.getSheetNameOrThrowError.bind(this.sheetMapping),e,r)}simpleCellRangeToString(e,t={}){if(!r9(e))throw new rt("SimpleCellRange","cellRange");let r="number"==typeof t?t:t.includeSheetName?e.start.sheet+e.end.sheet+1:e.start.sheet;var n=this.sheetMapping.getSheetNameOrThrowError.bind(this.sheetMapping);let o=eI(n,e.start,r),i=eI(n,e.end,e.start.sheet);if(void 0!==o&&void 0!==i)return`${o}:${i}`}getCellDependents(e){let t;if(r6(e))t=this._dependencyGraph.addressMapping.getCell(e);else if(r9(e))t=this._dependencyGraph.rangeMapping.getRangeVertex(e.start,e.end);else throw new rt("SimpleCellAddress | SimpleCellRange",e);return void 0===t?[]:this._dependencyGraph.getAdjacentNodesAddresses(t)}getCellPrecedents(e){let t;if(r6(e))t=this._dependencyGraph.addressMapping.getCell(e);else if(r9(e))t=this._dependencyGraph.rangeMapping.getRangeVertex(e.start,e.end);else throw new rt("SimpleCellAddress | SimpleCellRange",e);return void 0===t?[]:this._dependencyGraph.dependencyQueryAddresses(t)}getSheetName(e){return nN(e,"number","sheetId"),this.sheetMapping.getSheetName(e)}getSheetNames(){return this.sheetMapping.getSheetNames()}getSheetId(e){return nN(e,"string","sheetName"),this.sheetMapping.getSheetId(e)}doesSheetExist(e){return nN(e,"string","sheetName"),this.sheetMapping.hasSheetWithName(e)}getCellType(e){if(!r6(e))throw new rt("SimpleCellAddress","cellAddress");var t=this.dependencyGraph.getCell(e);if(t instanceof rT)if(t.isLeftCorner(e))return u.ARRAYFORMULA;else return u.ARRAY;return t instanceof rA||t instanceof rz?u.FORMULA:t instanceof rU?u.VALUE:u.EMPTY}doesCellHaveSimpleValue(e){if(!r6(e))throw new rt("SimpleCellAddress","cellAddress");return this.getCellType(e)===u.VALUE}doesCellHaveFormula(e){if(!r6(e))throw new rt("SimpleCellAddress","cellAddress");let t=this.getCellType(e);return t===u.FORMULA||t===u.ARRAYFORMULA}isCellEmpty(e){if(!r6(e))throw new rt("SimpleCellAddress","cellAddress");return this.getCellType(e)===u.EMPTY}isCellPartOfArray(e){if(!r6(e))throw new rt("SimpleCellAddress","cellAddress");let t=this.getCellType(e);return t===u.ARRAY||t===u.ARRAYFORMULA}getCellValueType(e){if(!r6(e))throw new rt("SimpleCellAddress","cellAddress");return this.ensureEvaluationIsNotSuspended(),rq(this.dependencyGraph.getCellValue(e))}getCellValueDetailedType(e){if(!r6(e))throw new rt("SimpleCellAddress","cellAddress");this.ensureEvaluationIsNotSuspended();var t=this.dependencyGraph.getCellValue(e);return tP(t)?t instanceof tx?t.getDetailedType():s.NUMBER_RAW:rq(t)}getCellValueFormat(e){if(!r6(e))throw new rt("SimpleCellAddress","cellAddress");this.ensureEvaluationIsNotSuspended();var t=this.dependencyGraph.getCellValue(e);if(tP(t))return t instanceof tx?t.format:void 0}countSheets(){return this.sheetMapping.numberOfSheets()}isItPossibleToRenameSheet(e,t){nN(e,"number","sheetId"),nN(t,"string","newName");try{return this._crudOperations.ensureItIsPossibleToRenameSheet(e,t),!0}catch(e){return!1}}renameSheet(e,t){nN(e,"number","sheetId"),nN(t,"string","newName");let r=this._crudOperations.renameSheet(e,t);this.recomputeIfDependencyGraphNeedsIt(),void 0!==r&&this._emitter.emit(S.SheetRenamed,r,t)}batch(e){this.suspendEvaluation(),this._crudOperations.beginUndoRedoBatchMode();try{e()}catch(e){throw this._crudOperations.commitUndoRedoBatchMode(),this.resumeEvaluation(),e}return this._crudOperations.commitUndoRedoBatchMode(),this.resumeEvaluation()}suspendEvaluation(){this._evaluationSuspended=!0,this._emitter.emit(S.EvaluationSuspended)}resumeEvaluation(){this._evaluationSuspended=!1;let e=this.recomputeIfDependencyGraphNeedsIt();return this._emitter.emit(S.EvaluationResumed,e),e}isEvaluationSuspended(){return this._evaluationSuspended}isItPossibleToAddNamedExpression(e,t,r){nN(e,"string","expressionName"),void 0!==r&&nN(r,"number","scope");try{return this._crudOperations.ensureItIsPossibleToAddNamedExpression(e,t,r),!0}catch(e){return!1}}addNamedExpression(e,t,r,n){nN(e,"string","expressionName"),void 0!==r&&nN(r,"number","scope"),this._crudOperations.addNamedExpression(e,t,r,n);let o=this.recomputeIfDependencyGraphNeedsIt();return this._emitter.emit(S.NamedExpressionAdded,e,o),o}getNamedExpressionValue(e,t){nN(e,"string","expressionName"),void 0!==t&&nN(t,"number","scope"),this.ensureEvaluationIsNotSuspended(),this._crudOperations.ensureScopeIdIsValid(t);let r=this._namedExpressions.namedExpressionForScope(e,t);return r?this._serialization.getCellValue(r.address):void 0}getNamedExpressionFormula(e,t){nN(e,"string","expressionName"),void 0!==t&&nN(t,"number","scope"),this._crudOperations.ensureScopeIdIsValid(t);let r=this._namedExpressions.namedExpressionForScope(e,t);if(void 0!==r)return this._serialization.getCellFormula(r.address)}getNamedExpression(e,t){nN(e,"string","expressionName"),void 0!==t&&nN(t,"number","scope");let r=this._namedExpressions.namedExpressionForScope(e,t);if(void 0!==r)return{name:e,scope:t,expression:this._serialization.getCellFormula(r.address),options:r.options}}isItPossibleToChangeNamedExpression(e,t,r){nN(e,"string","expressionName"),void 0!==r&&nN(r,"number","scope");try{return this._crudOperations.ensureItIsPossibleToChangeNamedExpression(e,t,r),!0}catch(e){return!1}}changeNamedExpression(e,t,r,n){return nN(e,"string","expressionName"),void 0!==r&&nN(r,"number","scope"),this._crudOperations.changeNamedExpressionExpression(e,r,t,n),this.recomputeIfDependencyGraphNeedsIt()}isItPossibleToRemoveNamedExpression(e,t){nN(e,"string","expressionName"),void 0!==t&&nN(t,"number","scope");try{return this._crudOperations.isItPossibleToRemoveNamedExpression(e,t),!0}catch(e){return!1}}removeNamedExpression(e,t){nN(e,"string","expressionName"),void 0!==t&&nN(t,"number","scope");let r=this._crudOperations.removeNamedExpression(e,t);if(!r)return[];{let e=this.recomputeIfDependencyGraphNeedsIt();return this._emitter.emit(S.NamedExpressionRemoved,r.displayName,e),e}}listNamedExpressions(e){return void 0!==e&&nN(e,"number","scope"),this._crudOperations.ensureScopeIdIsValid(e),this._namedExpressions.getAllNamedExpressionsNamesInScope(e)}getAllNamedExpressionsSerialized(){return this._serialization.getAllNamedExpressionsSerialized()}normalizeFormula(e){nN(e,"string","formulaString");let{ast:t,address:r}=this.extractTemporaryFormula(e);if(void 0===t)throw new tJ;return this._unparser.unparse(t,r)}calculateFormula(e,t){nN(e,"string","formulaString"),nN(t,"number","sheetId"),this._crudOperations.ensureScopeIdIsValid(t);let{ast:r,address:n,dependencies:o}=this.extractTemporaryFormula(e,t);if(void 0===r)throw new tJ;let i=this.evaluator.runAndForget(r,n,o);return this._exporter.exportScalarOrRange(i)}getNamedExpressionsFromFormula(e){nN(e,"string","formulaString");let{ast:t,dependencies:r}=this.extractTemporaryFormula(e);if(void 0===t)throw new tJ;return[...new Set(r.filter(e=>e instanceof tT).map(e=>e.name))]}validateFormula(e){nN(e,"string","formulaString");let{ast:t}=this.extractTemporaryFormula(e);return void 0!==t}getRegisteredFunctionNames(){return ig.getLanguage(this._config.language).getFunctionTranslations(this._functionRegistry.getRegisteredFunctionIds())}getFunctionPlugin(e){return nN(e,"string","functionId"),this._functionRegistry.getFunctionPlugin(e)}getAllFunctionPlugins(){return this._functionRegistry.getPlugins()}numberToDateTime(e){return nN(e,"number","val"),this._evaluator.interpreter.dateTimeHelper.numberToSimpleDateTime(e)}numberToDate(e){return nN(e,"number","val"),this._evaluator.interpreter.dateTimeHelper.numberToSimpleDate(e)}numberToTime(e){return nN(e,"number","val"),nq(e)}on(e,t){this._emitter.on(e,t)}once(e,t){this._emitter.once(e,t)}off(e,t){this._emitter.off(e,t)}destroy(){for(let[e,t]of Object.entries(this))t instanceof Function?this[e]=function(e){return()=>{throw Error(`The "${e}" method cannot be called because this HyperFormula instance has been destroyed`)}}(t):delete this[e]}ensureEvaluationIsNotSuspended(){if(this._evaluationSuspended)throw new rs}extractTemporaryFormula(e,t=1){let r=this._cellContentParser.parse(e),n={sheet:t,col:0,row:0};if(!(r instanceof b.Formula))return{address:n,dependencies:[]};let{ast:o,errors:i,dependencies:s}=this._parser.parse(r.formula,n);return i.length>0?{address:n,dependencies:[]}:{ast:o,address:n,dependencies:s}}rebuildWithConfig(e){let t=this._config.mergeConfig(e),r=this._config.mergeConfig({language:e.language}),n=this._serialization.withNewConfig(r,this._namedExpressions).getAllSheetsSerialized(),o=this._serialization.getAllNamedExpressionsSerialized(),i=id.rebuildWithConfig(t,n,o,this._stats);this._config=i.config,this._stats=i.stats,this._dependencyGraph=i.dependencyGraph,this._columnSearch=i.columnSearch,this._parser=i.parser,this._unparser=i.unparser,this._cellContentParser=i.cellContentParser,this._evaluator=i.evaluator,this._lazilyTransformingAstService=i.lazilyTransformingAstService,this._crudOperations=i.crudOperations,this._exporter=i.exporter,this._namedExpressions=i.namedExpressions,this._serialization=i.serialization,this._functionRegistry=i.functionRegistry}compactLazyTransformationsIfNeeded(){var e;this._lazilyTransformingAstService.needsCompaction()&&(this._dependencyGraph.forceApplyPostponedTransformations(),this._columnSearch.forceApplyPostponedTransformations(),this._lazilyTransformingAstService.compact(),null==(e=this._lazilyTransformingAstService.undoRedo)||e.cleanupOrphanedOldData())}recomputeIfDependencyGraphNeedsIt(){if(this._evaluationSuspended)return[];{let e=this._crudOperations.getAndClearContentChanges(),t=this.dependencyGraph.verticesToRecompute();this.dependencyGraph.clearDirtyVertices(),this.compactLazyTransformationsIfNeeded(),t.length>0&&e.addAll(this.evaluator.partialRun(t));let r=e.exportChanges(this._exporter);return e.isEmpty()||this._emitter.emit(S.ValuesUpdated,r),r}}}ig.version="3.3.0",ig.buildDate="20/05/2026 14:43:58",ig.releaseDate="20/05/2026",ig.languages={},ig.registeredLanguages=new Map;let ip=new WeakMap;class im{constructor(e={},t=!0){const{accentSensitive:r,caseSensitive:n,caseFirst:o,chooseAddressMappingPolicy:i,context:s,currencySymbol:a,dateFormats:l,decimalSeparator:h,evaluateNullToZero:d,functionArgSeparator:u,functionPlugins:c,ignorePunctuation:g,leapYear1900:p,localeLang:m,language:f,ignoreWhiteSpace:b,licenseKey:C,matchWholeCell:y,arrayColumnSeparator:w,arrayRowSeparator:S,maxRows:v,maxColumns:R,nullYear:E,nullDate:T,parseDateTime:A,precisionEpsilon:M,precisionRounding:I,stringifyDateTime:x,stringifyDuration:N,smartRounding:O,timeFormats:k,thousandSeparator:H,useArrayArithmetic:_,useStats:L,undoLimit:P,maxPendingLazyTransformations:D,useColumnIndex:F,useRegularExpressions:B,useWildcards:V}=e;t&&im.warnDeprecatedOptions(e),this.useArrayArithmetic=nA(_,"boolean","useArrayArithmetic"),this.accentSensitive=nA(r,"boolean","accentSensitive"),this.caseSensitive=nA(n,"boolean","caseSensitive"),this.caseFirst=nA(o,["upper","lower","false"],"caseFirst"),this.ignorePunctuation=nA(g,"boolean","ignorePunctuation"),this.chooseAddressMappingPolicy=null!=i?i:im.defaultConfig.chooseAddressMappingPolicy,this.dateFormats=[...nI(l,Array.isArray,"array","dateFormats")],this.timeFormats=[...nI(k,Array.isArray,"array","timeFormats")],this.functionArgSeparator=nA(u,"string","functionArgSeparator"),this.decimalSeparator=nA(h,[".",","],"decimalSeparator"),this.language=nA(f,"string","language"),this.ignoreWhiteSpace=nA(b,["standard","any"],"ignoreWhiteSpace"),this.licenseKey=nA(C,"string","licenseKey"),this.thousandSeparator=nA(H,["",","," ","."],"thousandSeparator"),this.arrayColumnSeparator=nA(w,[",",";"],"arrayColumnSeparator"),this.arrayRowSeparator=nA(S,[";","|"],"arrayRowSeparator"),this.localeLang=nA(m,"string","localeLang"),this.functionPlugins=[...null!=c?c:im.defaultConfig.functionPlugins],this.smartRounding=nA(O,"boolean","smartRounding"),this.evaluateNullToZero=nA(d,"boolean","evaluateNullToZero"),this.nullYear=nA(E,"number","nullYear"),nM(this.nullYear,"nullYear",0),function(e,t){if(e>100)throw new ro(t,100)}(this.nullYear,"nullYear"),this.precisionRounding=nA(I,"number","precisionRounding"),nM(this.precisionRounding,"precisionRounding",0),this.precisionEpsilon=nA(M,"number","precisionEpsilon"),nM(this.precisionEpsilon,"precisionEpsilon",0),this.useColumnIndex=nA(F,"boolean","useColumnIndex"),this.useStats=nA(L,"boolean","useStats"),this.parseDateTime=nA(A,"function","parseDateTime"),this.stringifyDateTime=nA(x,"function","stringifyDateTime"),this.stringifyDuration=nA(N,"function","stringifyDuration"),this.translationPackage=ig.getLanguage(this.language),this.errorMapping=this.translationPackage.buildErrorMapping(),this.nullDate=nI(T,nz,"IDate","nullDate"),this.leapYear1900=nA(p,"boolean","leapYear1900"),this.undoLimit=nA(P,"number","undoLimit"),this.maxPendingLazyTransformations=nA(D,"number","maxPendingLazyTransformations"),this.useRegularExpressions=nA(B,"boolean","useRegularExpressions"),this.useWildcards=nA(V,"boolean","useWildcards"),this.matchWholeCell=nA(y,"boolean","matchWholeCell"),nM(this.undoLimit,"undoLimit",0),nM(this.maxPendingLazyTransformations,"maxPendingLazyTransformations",1),this.maxRows=nA(v,"number","maxRows"),nM(this.maxRows,"maxRows",1),this.maxColumns=nA(R,"number","maxColumns"),this.currencySymbol=this.setupCurrencySymbol(a),nM(this.maxColumns,"maxColumns",1),this.context=s,ip.set(this,{licenseKeyValidityState:function(e){let t={template:"missing",vars:{}};if("gpl-v3"===e||"internal-use-in-handsontable"===e||"hftrial-0168e-1f2b7-47158-70b05-0842f"===e)t.template="valid";else if("string"==typeof e&&function(e){if((e=(e+"").replace(/\-/g,""))[n5]!==n9("Z"))return!1;let t=0;return 0===[[0,n9("G")+1],[n9("H"),n9("H")-1],[n9("G")+n9("H"),n9("G")]].reduce((r,[n,o],i)=>{let s,a,l,h,d;return r|=(parseInt(`${parseInt((s=e,a=t+n-2*(0!==i),l=o+2*!!i,parseInt(s.substr(a,l),16)+(h=e,d=t+n+o,parseInt(h.substr(d,2),16)+[]).padStart(2,"0")),10)}`,10)%97||2)>>1,t+=2,r},n9("A"))}(e)){var r,n;let o,i,s,a,l,h,d,u,c,[g,p,m]="20/05/2026".split("/"),f=Math.floor(new Date(`${p}/${g}/${m}`).getTime()/864e5),b=25===n4(r=e)[n5]?(o=n4(r),i=parseInt("12",16),s=n9("F"),parseInt(o.substr(i,s),16)/(a=n4(r),l=n9("C"),h=n9("Y")>>4,parseInt(a.substr(l,h),16)||(~~![][n5]<<3)+1)):0;t.vars.keyValidityDate=(d=["January","February","March","April","May","June","July","August","September","October","November","December"][(n=new Date((b+1)*864e5)).getMonth()],u=n.getDate(),c=n.getFullYear(),`${d} ${u}, ${c}`),f>b?t.template="expired":t.template="valid"}else""!==e&&(t.template="invalid");return n8||"valid"===t.template||(console.warn(n7[t.template](t.vars)),n8=!0),t.template}(this.licenseKey)}),nx({value:this.decimalSeparator,name:"decimalSeparator"},{value:this.functionArgSeparator,name:"functionArgSeparator"},{value:this.thousandSeparator,name:"thousandSeparator"}),nx({value:this.arrayRowSeparator,name:"arrayRowSeparator"},{value:this.arrayColumnSeparator,name:"arrayColumnSeparator"})}setupCurrencySymbol(e){let t=[...nI(e,Array.isArray,"array","currencySymbol")];return t.forEach(e=>{if("string"!=typeof e)throw new rt("string[]","currencySymbol");if(""===e)throw new rr("currencySymbol")}),t}get licenseKeyValidityState(){return ip.get(this).licenseKeyValidityState}getConfig(){return ib(this)}mergeConfig(e){let t=Object.assign({},this.getConfig(),e);return im.warnDeprecatedOptions(e),new im(t,!1)}static warnDeprecatedOptions(e){}static warnDeprecatedIfUsed(e,t,r,n){void 0!==e&&(void 0===n?console.warn(`${t} option is deprecated since ${r}`):console.warn(`${t} option is deprecated since ${r}, please use ${n}`))}}function ib(e){var t;let r={};for(let n in im.defaultConfig){let o=null!=(t=e[n])?t:im.defaultConfig[n];Array.isArray(o)?r[n]=[...o]:r[n]=o}return r}im.defaultConfig={accentSensitive:!1,currencySymbol:["$"],caseSensitive:!1,caseFirst:"lower",context:void 0,chooseAddressMappingPolicy:new class{call(){return rG}},dateFormats:["DD/MM/YYYY","DD/MM/YY"],decimalSeparator:".",evaluateNullToZero:!1,functionArgSeparator:",",functionPlugins:[],ignorePunctuation:!1,language:"enGB",ignoreWhiteSpace:"standard",licenseKey:"",leapYear1900:!1,localeLang:"en",matchWholeCell:!0,arrayColumnSeparator:",",arrayRowSeparator:";",maxRows:4e4,maxColumns:18278,nullYear:30,nullDate:{year:1899,month:12,day:30},parseDateTime:function(e,t,r){var n;if(void 0===t&&void 0===r)return;let o=e.replace(nH," ").trim().toLowerCase();if(n=o,!nk.test(n))return;let i=o.substring(o.length-2);"am"===i||"pm"===i?o=o.substring(0,o.length-2).trim():"a"===(i=o.substring(o.length-1))||"p"===i?o=o.substring(0,o.length-1).trim():i=void 0;let s=o.split(n_);s.length>=2&&s[s.length-2].includes(":")&&(s[s.length-2]=s[s.length-2]+"."+s[s.length-1],s.pop());let a=s[s.length-1].split(":");if(void 0!==i&&a.push(i),1===s.length)return nD(a,r);if(1===a.length)return nF(s,t);let l=nF(s.slice(0,s.length-1),t),h=nD(a,r);return void 0===l||void 0===h?void 0:Object.assign(Object.assign({},l),h)},precisionEpsilon:1e-13,precisionRounding:10,smartRounding:!0,stringifyDateTime:function(e,t){let r=n1(t);if(void 0===r)return;let n=r.tokens,o="",i=!1,s=n.some(e=>e.type===m.FORMAT&&("a/p"===e.value||"A/P"===e.value||"am/pm"===e.value||"AM/PM"===e.value));for(let t=0;t<n.length;t++){let r=n[t];if(r.type===m.FREE_TEXT){o+=r.value;continue}switch(r.value.toLowerCase()){case"h":case"hh":i=!0,o+=n3(s?(e.hours+11)%12+1:e.hours,r.value.length);break;case"d":case"dd":o+=n3(e.day,r.value.length);break;case"s":case"ss":o+=n3(Math.floor(e.seconds),r.value.length);break;case"m":case"mm":t+1<n.length&&n[t+1].value.startsWith(":")&&(i=!0),i?o+=n3(e.minutes,r.value.length):o+=n3(e.month,r.value.length),i=!0;break;case"yy":o+=n3(e.year%100,r.value.length);break;case"yyyy":o+=e.year;break;case"am/pm":case"a/p":{let[t,n]=r.value.split("/");o+=e.hours<12?t:n;break}default:if(nO.test(r.value)){let t=r.value.length-3;o+=`${e.seconds<10?"0":""}${Math.floor(e.seconds*Math.pow(10,t))/Math.pow(10,t)}`;continue}return}}return o},stringifyDuration:function(e,t){let r=n1(t);if(void 0===r)return;let n=r.tokens,o="";for(let t of n){if(t.type===m.FREE_TEXT){o+=t.value;continue}switch(t.value.toLowerCase()){case"h":case"hh":o+=n3(e.hours,t.value.length),e.hours=0;break;case"[hh]":o+=n3(e.hours,t.value.length-2),e.hours=0;break;case"m":case"mm":o+=n3(e.minutes,t.value.length),e.minutes=0;break;case"[mm]":o+=n3(e.minutes+60*e.hours,t.value.length-2),e.minutes=0,e.hours=0;break;case"s":case"ss":o+=n3(Math.floor(e.seconds),t.value.length);break;default:if(nO.test(t.value)){let r=Math.max(t.value.length-3,0);o+=`${e.seconds<10?"0":""}${Math.floor(e.seconds*Math.pow(10,r))/Math.pow(10,r)}`;continue}return}}return o},timeFormats:["hh:mm","hh:mm:ss.sss"],thousandSeparator:"",undoLimit:20,maxPendingLazyTransformations:50,useRegularExpressions:!1,useWildcards:!0,useColumnIndex:!1,useStats:!1,useArrayArithmetic:!1};let iC={errors:{CYCLE:"#CYCLE!",DIV_BY_ZERO:"#DIV/0!",ERROR:"#ERROR!",NA:"#N/A",NAME:"#NAME?",NUM:"#NUM!",REF:"#REF!",SPILL:"#SPILL!",VALUE:"#VALUE!"},functions:{FILTER:"FILTER",ADDRESS:"ADDRESS",ARRAY_CONSTRAIN:"ARRAY_CONSTRAIN",ARRAYFORMULA:"ARRAYFORMULA",ABS:"ABS",ACOS:"ACOS",ACOSH:"ACOSH",ACOT:"ACOT",ACOTH:"ACOTH",AND:"AND",ARABIC:"ARABIC",ASIN:"ASIN",ASINH:"ASINH",ATAN2:"ATAN2",ATAN:"ATAN",ATANH:"ATANH",AVERAGE:"AVERAGE",AVERAGEA:"AVERAGEA",AVERAGEIF:"AVERAGEIF",BASE:"BASE",BIN2DEC:"BIN2DEC",BIN2HEX:"BIN2HEX",BIN2OCT:"BIN2OCT",BITAND:"BITAND",BITLSHIFT:"BITLSHIFT",BITOR:"BITOR",BITRSHIFT:"BITRSHIFT",BITXOR:"BITXOR",CEILING:"CEILING",CHAR:"CHAR",CHOOSE:"CHOOSE",CLEAN:"CLEAN",CODE:"CODE",COLUMN:"COLUMN",COLUMNS:"COLUMNS",CONCATENATE:"CONCATENATE",CORREL:"CORREL",COS:"COS",COSH:"COSH",COT:"COT",COTH:"COTH",COUNT:"COUNT",COUNTA:"COUNTA",COUNTBLANK:"COUNTBLANK",COUNTIF:"COUNTIF",COUNTIFS:"COUNTIFS",COUNTUNIQUE:"COUNTUNIQUE",CSC:"CSC",CSCH:"CSCH",CUMIPMT:"CUMIPMT",CUMPRINC:"CUMPRINC",DATE:"DATE",DATEDIF:"DATEDIF",DATEVALUE:"DATEVALUE",DAY:"DAY",DAYS360:"DAYS360",DAYS:"DAYS",DB:"DB",DAVERAGE:"DAVERAGE",DCOUNT:"DCOUNT",DCOUNTA:"DCOUNTA",DGET:"DGET",DMAX:"DMAX",DMIN:"DMIN",DPRODUCT:"DPRODUCT",DSTDEV:"DSTDEV",DSTDEVP:"DSTDEVP",DSUM:"DSUM",DVAR:"DVAR",DVARP:"DVARP",DDB:"DDB",DEC2BIN:"DEC2BIN",DEC2HEX:"DEC2HEX",DEC2OCT:"DEC2OCT",DECIMAL:"DECIMAL",DEGREES:"DEGREES",DELTA:"DELTA",DOLLARDE:"DOLLARDE",DOLLARFR:"DOLLARFR",EDATE:"EDATE",EFFECT:"EFFECT",EOMONTH:"EOMONTH",ERF:"ERF",ERFC:"ERFC",EVEN:"EVEN",EXACT:"EXACT",EXP:"EXP",FALSE:"FALSE",FIND:"FIND",FORMULATEXT:"FORMULATEXT",FV:"FV",FVSCHEDULE:"FVSCHEDULE",HEX2BIN:"HEX2BIN",HEX2DEC:"HEX2DEC",HEX2OCT:"HEX2OCT",HLOOKUP:"HLOOKUP",HOUR:"HOUR",HYPERLINK:"HYPERLINK",IF:"IF",IFERROR:"IFERROR",IFNA:"IFNA",IFS:"IFS",INDEX:"INDEX",INT:"INT",INTERVAL:"INTERVAL",IPMT:"IPMT",IRR:"IRR",ISBINARY:"ISBINARY",ISBLANK:"ISBLANK",ISERR:"ISERR",ISERROR:"ISERROR",ISEVEN:"ISEVEN",ISFORMULA:"ISFORMULA",ISLOGICAL:"ISLOGICAL",ISNA:"ISNA",ISNONTEXT:"ISNONTEXT",ISNUMBER:"ISNUMBER",ISODD:"ISODD",ISOWEEKNUM:"ISOWEEKNUM",ISPMT:"ISPMT",ISREF:"ISREF",ISTEXT:"ISTEXT",LEFT:"LEFT",LEN:"LEN",LN:"LN",LOG10:"LOG10",LOG:"LOG",LOWER:"LOWER",MATCH:"MATCH",MAX:"MAX",MAXA:"MAXA",MAXIFS:"MAXIFS",MAXPOOL:"MAXPOOL",MEDIAN:"MEDIAN",MEDIANPOOL:"MEDIANPOOL",MID:"MID",MIN:"MIN",MINA:"MINA",MINIFS:"MINIFS",MINUTE:"MINUTE",MIRR:"MIRR",MMULT:"MMULT",MOD:"MOD",MONTH:"MONTH",N:"N",NA:"NA",NETWORKDAYS:"NETWORKDAYS","NETWORKDAYS.INTL":"NETWORKDAYS.INTL",NOMINAL:"NOMINAL",NOT:"NOT",NOW:"NOW",NPER:"NPER",NPV:"NPV",OCT2BIN:"OCT2BIN",OCT2DEC:"OCT2DEC",OCT2HEX:"OCT2HEX",ODD:"ODD",OFFSET:"OFFSET",OR:"OR",PI:"PI",PMT:"PMT",PDURATION:"PDURATION",PRODUCT:"PRODUCT",POWER:"POWER",PPMT:"PPMT",PROPER:"PROPER",PV:"PV",RADIANS:"RADIANS",RAND:"RAND",RATE:"RATE",REPLACE:"REPLACE",REPT:"REPT",RIGHT:"RIGHT",ROMAN:"ROMAN",ROUND:"ROUND",ROUNDDOWN:"ROUNDDOWN",ROUNDUP:"ROUNDUP",ROW:"ROW",ROWS:"ROWS",RRI:"RRI",SEARCH:"SEARCH",SEC:"SEC",SECH:"SECH",SECOND:"SECOND",SEQUENCE:"SEQUENCE",SHEET:"SHEET",SHEETS:"SHEETS",SIN:"SIN",SINH:"SINH",SLN:"SLN",SPLIT:"SPLIT",SQRT:"SQRT",STDEVA:"STDEVA","STDEV.P":"STDEV.P",STDEVPA:"STDEVPA","STDEV.S":"STDEV.S",SUBSTITUTE:"SUBSTITUTE",SUBTOTAL:"SUBTOTAL",SUM:"SUM",SUMIF:"SUMIF",SUMIFS:"SUMIFS",SUMPRODUCT:"SUMPRODUCT",SUMSQ:"SUMSQ",SWITCH:"SWITCH",SYD:"SYD",T:"T",TAN:"TAN",TANH:"TANH",TBILLEQ:"TBILLEQ",TBILLPRICE:"TBILLPRICE",TBILLYIELD:"TBILLYIELD",TEXT:"TEXT",TEXTJOIN:"TEXTJOIN",TIME:"TIME",TIMEVALUE:"TIMEVALUE",TODAY:"TODAY",TRANSPOSE:"TRANSPOSE",TRIM:"TRIM",TRUE:"TRUE",TRUNC:"TRUNC",UNICHAR:"UNICHAR",UNICODE:"UNICODE",UPPER:"UPPER",VALUE:"VALUE",VARA:"VARA","VAR.P":"VAR.P",VARPA:"VARPA","VAR.S":"VAR.S",VLOOKUP:"VLOOKUP",WEEKDAY:"WEEKDAY",WEEKNUM:"WEEKNUM",WORKDAY:"WORKDAY","WORKDAY.INTL":"WORKDAY.INTL",XNPV:"XNPV",XOR:"XOR",XLOOKUP:"XLOOKUP",YEAR:"YEAR",YEARFRAC:"YEARFRAC","HF.ADD":"HF.ADD","HF.CONCAT":"HF.CONCAT","HF.DIVIDE":"HF.DIVIDE","HF.EQ":"HF.EQ","HF.GT":"HF.GT","HF.GTE":"HF.GTE","HF.LT":"HF.LT","HF.LTE":"HF.LTE","HF.MINUS":"HF.MINUS","HF.MULTIPLY":"HF.MULTIPLY","HF.NE":"HF.NE","HF.POW":"HF.POW","HF.UMINUS":"HF.UMINUS","HF.UNARY_PERCENT":"HF.UNARY_PERCENT","HF.UPLUS":"HF.UPLUS",VARP:"VARP",VAR:"VAR",STDEVP:"STDEVP",STDEV:"STDEV","EXPON.DIST":"EXPON.DIST",FISHER:"FISHER",FISHERINV:"FISHERINV",GAMMA:"GAMMA","GAMMA.DIST":"GAMMA.DIST",GAMMALN:"GAMMALN","GAMMALN.PRECISE":"GAMMALN.PRECISE","GAMMA.INV":"GAMMA.INV",GAUSS:"GAUSS",FACT:"FACT",FACTDOUBLE:"FACTDOUBLE",COMBIN:"COMBIN",COMBINA:"COMBINA",GCD:"GCD",LCM:"LCM",MROUND:"MROUND",MULTINOMIAL:"MULTINOMIAL",QUOTIENT:"QUOTIENT",RANDBETWEEN:"RANDBETWEEN",SERIESSUM:"SERIESSUM",SIGN:"SIGN",SQRTPI:"SQRTPI",SUMX2MY2:"SUMX2MY2",SUMX2PY2:"SUMX2PY2",SUMXMY2:"SUMXMY2",EXPONDIST:"EXPONDIST",GAMMADIST:"GAMMADIST",GAMMAINV:"GAMMAINV","BETA.DIST":"BETA.DIST",BETADIST:"BETADIST","BETA.INV":"BETA.INV",BETAINV:"BETAINV","BINOM.DIST":"BINOM.DIST",BINOMDIST:"BINOMDIST","BINOM.INV":"BINOM.INV",BESSELI:"BESSELI",BESSELJ:"BESSELJ",BESSELK:"BESSELK",BESSELY:"BESSELY","CHISQ.DIST":"CHISQ.DIST","CHISQ.DIST.RT":"CHISQ.DIST.RT","CHISQ.INV":"CHISQ.INV","CHISQ.INV.RT":"CHISQ.INV.RT",CHIDIST:"CHIDIST",CHIINV:"CHIINV","F.DIST":"F.DIST","F.DIST.RT":"F.DIST.RT","F.INV":"F.INV","F.INV.RT":"F.INV.RT",FDIST:"FDIST",FINV:"FINV",WEIBULL:"WEIBULL","WEIBULL.DIST":"WEIBULL.DIST",POISSON:"POISSON","POISSON.DIST":"POISSON.DIST","HYPGEOM.DIST":"HYPGEOM.DIST",HYPGEOMDIST:"HYPGEOMDIST","T.DIST":"T.DIST","T.DIST.2T":"T.DIST.2T","T.DIST.RT":"T.DIST.RT","T.INV":"T.INV","T.INV.2T":"T.INV.2T",TDIST:"TDIST",TINV:"TINV",LOGINV:"LOGINV","LOGNORM.DIST":"LOGNORM.DIST","LOGNORM.INV":"LOGNORM.INV",LOGNORMDIST:"LOGNORMDIST","NORM.DIST":"NORM.DIST","NORM.INV":"NORM.INV","NORM.S.DIST":"NORM.S.DIST","NORM.S.INV":"NORM.S.INV",NORMDIST:"NORMDIST",NORMINV:"NORMINV",NORMSDIST:"NORMSDIST",NORMSINV:"NORMSINV",PHI:"PHI","NEGBINOM.DIST":"NEGBINOM.DIST",NEGBINOMDIST:"NEGBINOMDIST",COMPLEX:"COMPLEX",IMABS:"IMABS",IMAGINARY:"IMAGINARY",IMARGUMENT:"IMARGUMENT",IMCONJUGATE:"IMCONJUGATE",IMCOS:"IMCOS",IMCOSH:"IMCOSH",IMCOT:"IMCOT",IMCSC:"IMCSC",IMCSCH:"IMCSCH",IMDIV:"IMDIV",IMEXP:"IMEXP",IMLN:"IMLN",IMLOG10:"IMLOG10",IMLOG2:"IMLOG2",IMPOWER:"IMPOWER",IMPRODUCT:"IMPRODUCT",IMREAL:"IMREAL",IMSEC:"IMSEC",IMSECH:"IMSECH",IMSIN:"IMSIN",IMSINH:"IMSINH",IMSQRT:"IMSQRT",IMSUB:"IMSUB",IMSUM:"IMSUM",IMTAN:"IMTAN",LARGE:"LARGE",SMALL:"SMALL",PERCENTILE:"PERCENTILE","PERCENTILE.INC":"PERCENTILE.INC","PERCENTILE.EXC":"PERCENTILE.EXC",QUARTILE:"QUARTILE","QUARTILE.INC":"QUARTILE.INC","QUARTILE.EXC":"QUARTILE.EXC",AVEDEV:"AVEDEV",CONFIDENCE:"CONFIDENCE","CONFIDENCE.NORM":"CONFIDENCE.NORM","CONFIDENCE.T":"CONFIDENCE.T",DEVSQ:"DEVSQ",GEOMEAN:"GEOMEAN",HARMEAN:"HARMEAN",CRITBINOM:"CRITBINOM","COVARIANCE.P":"COVARIANCE.P","COVARIANCE.S":"COVARIANCE.S",COVAR:"COVAR",PEARSON:"PEARSON",RSQ:"RSQ",STANDARDIZE:"STANDARDIZE","Z.TEST":"Z.TEST",ZTEST:"ZTEST","F.TEST":"F.TEST",FTEST:"FTEST",STEYX:"STEYX",SLOPE:"SLOPE","CHISQ.TEST":"CHISQ.TEST",CHITEST:"CHITEST","T.TEST":"T.TEST",TTEST:"TTEST",SKEW:"SKEW","SKEW.P":"SKEW.P",WEIBULLDIST:"WEIBULLDIST",VARS:"VARS",TINV2T:"TINV2T",TDISTRT:"TDISTRT",TDIST2T:"TDIST2T",STDEVS:"STDEVS",FINVRT:"FINVRT",FDISTRT:"FDISTRT",CHIDISTRT:"CHIDISTRT",CHIINVRT:"CHIINVRT",COVARIANCEP:"COVARIANCEP",COVARIANCES:"COVARIANCES",LOGNORMINV:"LOGNORMINV",POISSONDIST:"POISSONDIST",SKEWP:"SKEWP","CEILING.MATH":"CEILING.MATH",FLOOR:"FLOOR","FLOOR.MATH":"FLOOR.MATH","CEILING.PRECISE":"CEILING.PRECISE","FLOOR.PRECISE":"FLOOR.PRECISE","ISO.CEILING":"ISO.CEILING"},langCode:"enGB",ui:{NEW_SHEET_PREFIX:"Sheet"}};(U=v||(v={}))[U.FullyAbsolute=1]="FullyAbsolute",U[U.RowAbsoluteColRelative=2]="RowAbsoluteColRelative",U[U.RowRelativeColAbsolute=3]="RowRelativeColAbsolute",U[U.FullyRelative=4]="FullyRelative";class iy extends nv{verifyAddressArguments(e,t,r,n){if(n){if(e<1||t<1)return new rK(d.VALUE,ej.LessThanOne)}else if(v.FullyAbsolute==r){if(e<1||t<1)return new rK(d.VALUE,ej.LessThanOne)}else if(v.RowAbsoluteColRelative==r){if(e<1)return new rK(d.VALUE,ej.LessThanOne)}else if(v.RowRelativeColAbsolute==r&&t<1)return new rK(d.VALUE,ej.LessThanOne)}address(e,t){return this.runFunction(e.args,t,this.metadata("ADDRESS"),(e,t,r,n,o)=>{let i=this.verifyAddressArguments(e,t,r,n);if(void 0!==i)return i;let s=eN(t-1),a="";null!=o&&(a=`${o}!`);let l=0==t?"C":`C[${t}]`,h=0==e?"R":`R[${e}]`;return v.FullyRelative==r?n?`${a}${s}${e}`:`${a}${h}${l}`:v.RowRelativeColAbsolute==r?n?`${a}$${s}${e}`:`${a}${h}C${t}`:v.RowAbsoluteColRelative==r?n?`${a}${s}$${e}`:`${a}R${e}${l}`:n?`${a}$${s}$${e}`:`${a}R${e}C${t}`})}}iy.implementedFunctions={ADDRESS:{method:"address",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER},{argumentType:p.NUMBER,optionalArg:!0,defaultValue:1,minValue:1,maxValue:4,emptyAsDefault:!0},{argumentType:p.BOOLEAN,optionalArg:!0,defaultValue:!0,emptyAsDefault:!0},{argumentType:p.STRING,optionalArg:!0}]}};class iw extends nv{arrayformula(e,t){return this.runFunction(e.args,t,this.metadata("ARRAYFORMULA"),e=>e)}arrayformulaArraySize(e,t){if(1!==e.args.length)return nR.error();let r=this.metadata("ARRAYFORMULA");return e.args.map(e=>{var n;return this.arraySizeForAst(e,new nr(t.formulaAddress,t.arraysFlag||null!=(n=null==r?void 0:r.enableArrayArithmeticForArguments)&&n))})[0]}arrayconstrain(e,t){return this.runFunction(e.args,t,this.metadata("ARRAY_CONSTRAIN"),(e,t,r)=>{t=Math.min(t,e.height()),r=Math.min(r,e.width());let n=e.data,o=[];for(let e=0;e<t;e++)o.push(n[e].slice(0,r));return tF.onlyValues(o)})}arrayconstrainArraySize(e,t){if(3!==e.args.length)return nR.error();let r=this.metadata("ARRAY_CONSTRAIN"),{height:n,width:i}=e.args.map(e=>{var n;return this.arraySizeForAst(e,new nr(t.formulaAddress,t.arraysFlag||null!=(n=null==r?void 0:r.enableArrayArithmeticForArguments)&&n))})[0];return(e.args[1].type===o.NUMBER&&(n=Math.min(n,e.args[1].value)),e.args[2].type===o.NUMBER&&(i=Math.min(i,e.args[2].value)),n<1||i<1||!Number.isInteger(n)||!Number.isInteger(i))?nR.error():new nR(i,n)}filter(e,t){return this.runFunction(e.args,t,this.metadata("FILTER"),(e,...t)=>{for(let r of t)if(e.width()!==r.width()||e.height()!==r.height())return new rK(d.NA,ej.EqualLength);if(e.width()>1&&e.height()>1)return new rK(d.NA,ej.WrongDimension);let r=e.data,n=[];for(let o=0;o<e.height();o++){let i=[];for(let n=0;n<e.width();n++){let e=!0;for(let r of t)if(!0!==nh(r.data[o][n])){e=!1;break}e&&i.push(r[o][n])}i.length>0&&n.push(i)}return n.length>0?tF.onlyValues(n):new rK(d.NA,ej.EmptyRange)})}filterArraySize(e,t){if(e.args.length<=1)return nR.error();let r=this.metadata("FILTER"),n=e.args.map(e=>{var n;return this.arraySizeForAst(e,new nr(t.formulaAddress,t.arraysFlag||null!=(n=null==r?void 0:r.enableArrayArithmeticForArguments)&&n))});return new nR(Math.max(...n.map(e=>e.width)),Math.max(...n.map(e=>e.height)))}}iw.implementedFunctions={ARRAYFORMULA:{method:"arrayformula",sizeOfResultArrayMethod:"arrayformulaArraySize",enableArrayArithmeticForArguments:!0,parameters:[{argumentType:p.ANY}]},ARRAY_CONSTRAIN:{method:"arrayconstrain",sizeOfResultArrayMethod:"arrayconstrainArraySize",parameters:[{argumentType:p.RANGE},{argumentType:p.INTEGER,minValue:1},{argumentType:p.INTEGER,minValue:1}],vectorizationForbidden:!0},FILTER:{method:"filter",sizeOfResultArrayMethod:"filterArraySize",enableArrayArithmeticForArguments:!0,parameters:[{argumentType:p.RANGE},{argumentType:p.RANGE}],repeatLastArgs:1}};class iS extends nv{abs(e,t){return this.runFunction(e.args,t,this.metadata("ABS"),Math.abs)}}iS.implementedFunctions={ABS:{method:"abs",parameters:[{argumentType:p.NUMBER}]}};class iv extends nv{bitlshift(e,t){return this.runFunction(e.args,t,this.metadata("BITLSHIFT"),iR)}bitrshift(e,t){return this.runFunction(e.args,t,this.metadata("BITRSHIFT"),iE)}}function iR(e,t){return t<0?iE(e,-t):iT(e*Math.pow(2,t))}function iE(e,t){return t<0?iR(e,-t):iT(Math.floor(e/Math.pow(2,t)))}function iT(e){return e>0xffffffffffff?new rK(d.NUM,ej.BitshiftLong):e}iv.implementedFunctions={BITLSHIFT:{method:"bitlshift",parameters:[{argumentType:p.INTEGER,minValue:0},{argumentType:p.INTEGER,minValue:-53,maxValue:53}]},BITRSHIFT:{method:"bitrshift",parameters:[{argumentType:p.INTEGER,minValue:0},{argumentType:p.INTEGER,minValue:-53,maxValue:53}]}};class iA extends nv{bitand(e,t){return this.runFunction(e.args,t,this.metadata("BITAND"),(e,t)=>e&t)}bitor(e,t){return this.runFunction(e.args,t,this.metadata("BITOR"),(e,t)=>e|t)}bitxor(e,t){return this.runFunction(e.args,t,this.metadata("BITXOR"),(e,t)=>e^t)}}iA.implementedFunctions={BITAND:{method:"bitand",parameters:[{argumentType:p.INTEGER,minValue:0},{argumentType:p.INTEGER,minValue:0}]},BITOR:{method:"bitor",parameters:[{argumentType:p.INTEGER,minValue:0},{argumentType:p.INTEGER,minValue:0}]},BITXOR:{method:"bitxor",parameters:[{argumentType:p.INTEGER,minValue:0},{argumentType:p.INTEGER,minValue:0}]}};class iM extends nv{literalTrue(e,t){return this.runFunction(e.args,t,this.metadata("TRUE"),()=>!0)}literalFalse(e,t){return this.runFunction(e.args,t,this.metadata("FALSE"),()=>!1)}conditionalIf(e,t){return this.runFunction(e.args,t,this.metadata("IF"),(e,t,r)=>e?t:r)}ifs(e,t){return this.runFunction(e.args,t,this.metadata("IFS"),(...e)=>{for(let t=0;t<e.length;t+=2)if(e[t])return e[t+1];return new rK(d.NA,ej.NoConditionMet)})}and(e,t){return this.runFunction(e.args,t,this.metadata("AND"),(...e)=>e.filter(e=>void 0!==e).every(e=>!!e))}or(e,t){return this.runFunction(e.args,t,this.metadata("OR"),(...e)=>e.filter(e=>void 0!==e).some(e=>e))}not(e,t){return this.runFunction(e.args,t,this.metadata("NOT"),e=>!e)}xor(e,t){return this.runFunction(e.args,t,this.metadata("XOR"),(...e)=>{let t=0;return e.filter(e=>void 0!==e).forEach(e=>{e&&t++}),t%2==1})}switch(e,t){return this.runFunction(e.args,t,this.metadata("SWITCH"),(e,...t)=>{let r=t.length,n=0;for(;n+1<r;n+=2)if(!(t[n]instanceof rK)&&this.arithmeticHelper.eq(e,t[n]))return t[n+1];return n<r?t[n]:new rK(d.NA,ej.NoDefault)})}iferror(e,t){return this.runFunction(e.args,t,this.metadata("IFERROR"),(e,t)=>e instanceof rK?t:e)}ifna(e,t){return this.runFunction(e.args,t,this.metadata("IFNA"),(e,t)=>e instanceof rK&&e.type===d.NA?t:e)}choose(e,t){return this.runFunction(e.args,t,this.metadata("CHOOSE"),(e,...t)=>e>t.length?new rK(d.NUM,ej.Selector):t[e-1])}}iM.implementedFunctions={TRUE:{method:"literalTrue",parameters:[]},FALSE:{method:"literalFalse",parameters:[]},IF:{method:"conditionalIf",parameters:[{argumentType:p.BOOLEAN},{argumentType:p.SCALAR,passSubtype:!0},{argumentType:p.SCALAR,defaultValue:!1,passSubtype:!0}]},IFS:{method:"ifs",parameters:[{argumentType:p.BOOLEAN},{argumentType:p.SCALAR,passSubtype:!0}],repeatLastArgs:2},AND:{method:"and",parameters:[{argumentType:p.BOOLEAN}],repeatLastArgs:1,expandRanges:!0},OR:{method:"or",parameters:[{argumentType:p.BOOLEAN}],repeatLastArgs:1,expandRanges:!0},XOR:{method:"xor",parameters:[{argumentType:p.BOOLEAN}],repeatLastArgs:1,expandRanges:!0},NOT:{method:"not",parameters:[{argumentType:p.BOOLEAN}]},SWITCH:{method:"switch",parameters:[{argumentType:p.NOERROR},{argumentType:p.SCALAR,passSubtype:!0},{argumentType:p.SCALAR,passSubtype:!0}],repeatLastArgs:1},IFERROR:{method:"iferror",parameters:[{argumentType:p.SCALAR,passSubtype:!0},{argumentType:p.SCALAR,passSubtype:!0}]},IFNA:{method:"ifna",parameters:[{argumentType:p.SCALAR,passSubtype:!0},{argumentType:p.SCALAR,passSubtype:!0}]},CHOOSE:{method:"choose",parameters:[{argumentType:p.INTEGER,minValue:1},{argumentType:p.SCALAR,passSubtype:!0}],repeatLastArgs:1}};class iI extends nv{char(e,t){return this.runFunction(e.args,t,this.metadata("CHAR"),e=>e<1||e>=256?new rK(d.VALUE,ej.CharacterCodeBounds):String.fromCharCode(Math.trunc(e)))}unichar(e,t){return this.runFunction(e.args,t,this.metadata("CHAR"),e=>e<1||e>=1114112?new rK(d.VALUE,ej.CharacterCodeBounds):String.fromCodePoint(Math.trunc(e)))}}iI.implementedFunctions={CHAR:{method:"char",parameters:[{argumentType:p.NUMBER}]},UNICHAR:{method:"unichar",parameters:[{argumentType:p.NUMBER}]}};class ix extends nv{code(e,t){return this.runFunction(e.args,t,this.metadata("CODE"),e=>0===e.length?new rK(d.VALUE,ej.EmptyString):e.charCodeAt(0))}unicode(e,t){return this.runFunction(e.args,t,this.metadata("UNICODE"),e=>{var t;return null!=(t=e.codePointAt(0))?t:new rK(d.VALUE,ej.EmptyString)})}}ix.implementedFunctions={CODE:{method:"code",parameters:[{argumentType:p.STRING}]},UNICODE:{method:"unicode",parameters:[{argumentType:p.STRING}]}};class iN extends nv{countblank(e,t){return this.runFunction(e.args,t,this.metadata("COUNTBLANK"),(...e)=>{let t=0;return e.forEach(e=>{e===tM&&t++}),t})}}iN.implementedFunctions={COUNTBLANK:{method:"countblank",parameters:[{argumentType:p.SCALAR}],repeatLastArgs:1,expandRanges:!0}};class iO extends nv{countunique(e,t){return this.runFunction(e.args,t,this.metadata("COUNTUNIQUE"),(...e)=>{let t=new Set,r=new Set;for(let n of e)n instanceof rK?r.add(n.type):""!==n&&t.add(n);return t.size+r.size})}}iO.implementedFunctions={COUNTUNIQUE:{method:"countunique",parameters:[{argumentType:p.SCALAR}],repeatLastArgs:1,expandRanges:!0}};let ik=[{argumentType:p.RANGE},{argumentType:p.SCALAR},{argumentType:p.RANGE}];class iH extends nv{withDatabaseArgs(e,t,r,n){return this.runFunction(e.args,t,this.metadata(r),(e,t,r)=>{let o=this.resolveFieldIndex(e,t);if(o instanceof rK)return o;let i=this.buildDatabaseCriteria(e,r);return i instanceof rK?i:n(e.data,o,i)})}dcount(e,t){return this.withDatabaseArgs(e,t,"DCOUNT",(e,t,r)=>{let n=0;for(let o=1;o<e.length;o++)if(this.rowMatchesCriteria(e[o],r)){let r=e[o][t];if(r instanceof rK)return r;tP(r)&&n++}return n})}dcounta(e,t){return this.withDatabaseArgs(e,t,"DCOUNTA",(e,t,r)=>{let n=0;for(let o=1;o<e.length;o++)if(this.rowMatchesCriteria(e[o],r)){let r=e[o][t];if(r instanceof rK)return r;r!==tM&&null!=r&&n++}return n})}dproduct(e,t){return this.withDatabaseArgs(e,t,"DPRODUCT",(e,t,r)=>{let n=1,o=!1;for(let i=1;i<e.length;i++)if(this.rowMatchesCriteria(e[i],r)){let r=e[i][t];if(r instanceof rK)return r;tP(r)&&(n*=tI(r),o=!0)}return o?n:0})}dsum(e,t){return this.withDatabaseArgs(e,t,"DSUM",(e,t,r)=>{let n=0;for(let o=1;o<e.length;o++)if(this.rowMatchesCriteria(e[o],r)){let r=e[o][t];if(r instanceof rK)return r;tP(r)&&(n+=tI(r))}return n})}daverage(e,t){return this.withDatabaseArgs(e,t,"DAVERAGE",(e,t,r)=>{let n=0,o=0;for(let i=1;i<e.length;i++)if(this.rowMatchesCriteria(e[i],r)){let r=e[i][t];if(r instanceof rK)return r;tP(r)&&(n+=tI(r),o++)}return 0===o?new rK(d.DIV_BY_ZERO):n/o})}dget(e,t){return this.withDatabaseArgs(e,t,"DGET",(e,t,r)=>{let n,o=0;for(let i=1;i<e.length;i++)if(this.rowMatchesCriteria(e[i],r)){if(++o>1)return new rK(d.NUM,ej.ValueLarge);n=e[i][t]}return 0===o?new rK(d.VALUE,ej.WrongType):n instanceof rK?n:n===tM||null==n?0:n})}dmax(e,t){return this.withDatabaseArgs(e,t,"DMAX",(e,t,r)=>{let n=-1/0,o=!1;for(let i=1;i<e.length;i++)if(this.rowMatchesCriteria(e[i],r)){let r=e[i][t];if(r instanceof rK)return r;if(tP(r)){let e=tI(r);e>n&&(n=e),o=!0}}return o?n:0})}dmin(e,t){return this.withDatabaseArgs(e,t,"DMIN",(e,t,r)=>{let n=1/0,o=!1;for(let i=1;i<e.length;i++)if(this.rowMatchesCriteria(e[i],r)){let r=e[i][t];if(r instanceof rK)return r;if(tP(r)){let e=tI(r);e<n&&(n=e),o=!0}}return o?n:0})}dstdev(e,t){return this.withDatabaseArgs(e,t,"DSTDEV",(e,t,r)=>{let n=this.collectNumericValues(e,t,r);if(n instanceof rK)return n;if(n.length<=1)return new rK(d.DIV_BY_ZERO);let o=n.reduce((e,t)=>e+t,0)/n.length;return Math.sqrt(n.reduce((e,t)=>e+Math.pow(t-o,2),0)/(n.length-1))})}dstdevp(e,t){return this.withDatabaseArgs(e,t,"DSTDEVP",(e,t,r)=>{let n=this.collectNumericValues(e,t,r);if(n instanceof rK)return n;if(0===n.length)return new rK(d.DIV_BY_ZERO);let o=n.reduce((e,t)=>e+t,0)/n.length;return Math.sqrt(n.reduce((e,t)=>e+Math.pow(t-o,2),0)/n.length)})}dvar(e,t){return this.withDatabaseArgs(e,t,"DVAR",(e,t,r)=>{let n=this.collectNumericValues(e,t,r);if(n instanceof rK)return n;if(n.length<=1)return new rK(d.DIV_BY_ZERO);let o=n.reduce((e,t)=>e+t,0)/n.length;return n.reduce((e,t)=>e+Math.pow(t-o,2),0)/(n.length-1)})}dvarp(e,t){return this.withDatabaseArgs(e,t,"DVARP",(e,t,r)=>{let n=this.collectNumericValues(e,t,r);if(n instanceof rK)return n;if(0===n.length)return new rK(d.DIV_BY_ZERO);let o=n.reduce((e,t)=>e+t,0)/n.length;return n.reduce((e,t)=>e+Math.pow(t-o,2),0)/n.length})}collectNumericValues(e,t,r){let n=[];for(let o=1;o<e.length;o++)if(this.rowMatchesCriteria(e[o],r)){let r=e[o][t];if(r instanceof rK)return r;tP(r)&&n.push(tI(r))}return n}resolveFieldIndex(e,t){if(t instanceof rK)return t;let r=e.data[0];if("string"==typeof t){let e=t.toLowerCase();for(let t=0;t<r.length;t++){let n=r[t];if("string"==typeof n&&n.toLowerCase()===e)return t}return new rK(d.VALUE,ej.WrongType)}let n="boolean"==typeof t?Number(t):t;if(tP(n)){let e=Math.trunc(tI(n));return!Number.isFinite(e)||e<1||e>r.length?new rK(d.VALUE,ej.WrongType):e-1}return new rK(d.VALUE,ej.WrongType)}buildDatabaseCriteria(e,t){var r;let n=e.data[0],o=t.data,i=o[0];for(let e of i)if(e instanceof rK)return e;let s=i.map(e=>{if("string"!=typeof e)return -1;let t=e.toLowerCase();return n.findIndex(e=>"string"==typeof e&&e.toLowerCase()===t)}),a=[];for(let e=1;e<o.length;e++){let t=[];for(let n=0;n<i.length;n++){let i=s[n];if(-1===i)continue;let a=null==(r=o[e])?void 0:r[n];if(a===tM||null==a)continue;if(a instanceof rK)return a;let l=tP(a)?tI(a):a,h=this.interpreter.criterionBuilder.fromCellValue(l,this.arithmeticHelper);if(void 0===h)return new rK(d.VALUE,ej.BadCriterion);t.push({columnIndex:i,lambda:h.lambda})}a.push(t)}return a}rowMatchesCriteria(e,t){return 0!==t.length&&t.some(t=>0===t.length||t.every(t=>{let r=e[t.columnIndex],n=tP(r)?tI(r):r;return t.lambda(n)}))}}iH.implementedFunctions={DCOUNT:{method:"dcount",parameters:ik},DCOUNTA:{method:"dcounta",parameters:ik},DPRODUCT:{method:"dproduct",parameters:ik},DSTDEV:{method:"dstdev",parameters:ik},DSTDEVP:{method:"dstdevp",parameters:ik},DSUM:{method:"dsum",parameters:ik},DVAR:{method:"dvar",parameters:ik},DVARP:{method:"dvarp",parameters:ik},DAVERAGE:{method:"daverage",parameters:ik},DGET:{method:"dget",parameters:ik},DMAX:{method:"dmax",parameters:ik},DMIN:{method:"dmin",parameters:ik}};class i_ extends nv{constructor(){super(...arguments),this.isoweeknumCore=e=>{let t=Math.floor(this.dateTimeHelper.relativeNumberToAbsoluteNumber(e)),r=this.dateTimeHelper.numberToSimpleDate(e),n=this.dateTimeHelper.dateToNumber({year:r.year,month:1,day:1}),o=this.dateTimeHelper.relativeNumberToAbsoluteNumber(n),i=Math.floor((t-1)/7)-Math.floor((o+((4-o)%7+7)%7-1)/7)+1;return 0===i?this.isoweeknumCore(e-7)+1:i},this.days360Core=(e,t,r)=>{let n,o,i=this.dateTimeHelper.numberToSimpleDate(e),s=this.dateTimeHelper.numberToSimpleDate(t);return r?(n=nX(i),o=nX(s)):[n,o]=this.dateTimeHelper.toBasisUS(i,s),360*(o.year-n.year)+30*(o.month-n.month)+o.day-n.day}}date(e,t){return this.runFunction(e.args,t,this.metadata("DATE"),(e,t,r)=>{let n=Math.trunc(r),o=Math.trunc(t),i=Math.trunc(e);i<this.dateTimeHelper.getEpochYearZero()&&(i+=this.dateTimeHelper.getEpochYearZero());let s=Math.floor((o-1)/12),a={year:i+=s,month:o-=12*s,day:1};if(this.dateTimeHelper.isValidDate(a)){let e=this.dateTimeHelper.dateToNumber(a)+(n-1);return void 0===(e=this.dateTimeHelper.getWithinBounds(e))?new rK(d.NUM,ej.DateBounds):e}return new rK(d.VALUE,ej.InvalidDate)})}time(e,t){return this.runFunction(e.args,t,this.metadata("TIME"),(e,t,r)=>{let n=nK({hours:Math.trunc(e),minutes:Math.trunc(t),seconds:Math.trunc(r)});return n<0?new rK(d.NUM,ej.NegativeTime):n%1})}eomonth(e,t){return this.runFunction(e.args,t,this.metadata("EOMONTH"),(e,t)=>{let r=this.dateTimeHelper.numberToSimpleDate(e),n=this.dateTimeHelper.dateToNumber(this.dateTimeHelper.endOfMonth(nY(r,t)));return void 0===(n=this.dateTimeHelper.getWithinBounds(n))?new rK(d.NUM,ej.DateBounds):n})}day(e,t){return this.runFunction(e.args,t,this.metadata("DAY"),e=>this.dateTimeHelper.numberToSimpleDate(e).day)}days(e,t){return this.runFunction(e.args,t,this.metadata("DAYS"),(e,t)=>Math.trunc(e)-Math.trunc(t))}month(e,t){return this.runFunction(e.args,t,this.metadata("MONTH"),e=>this.dateTimeHelper.numberToSimpleDate(e).month)}year(e,t){return this.runFunction(e.args,t,this.metadata("YEAR"),e=>this.dateTimeHelper.numberToSimpleDate(e).year)}hour(e,t){return this.runFunction(e.args,t,this.metadata("HOUR"),e=>nq(nj(e)%1).hours)}minute(e,t){return this.runFunction(e.args,t,this.metadata("MINUTE"),e=>nq(nj(e)%1).minutes)}second(e,t){return this.runFunction(e.args,t,this.metadata("SECOND"),e=>nq(nj(e)%1).seconds)}text(e,t){return this.runFunction(e.args,t,this.metadata("TEXT"),(e,t)=>(function(e,t,r,n){let o=r.stringifyDateTime(n.numberToSimpleDateTime(e),t);if(void 0!==o)return o;let i=r.stringifyDuration(nq(e),t);if(void 0!==i)return i;let s=function(e){let t,r=(nZ.lastIndex=0,null!==(t=nZ.exec(e))?[t]:[]);if(!r.every(e=>n2(e)))return{type:f.NUMBER,tokens:n0(r,e)}}(t);return void 0!==s?function(e,t){let r="";for(let n=0;n<e.length;++n){let o=e[n];if(o.type===m.FREE_TEXT){r+=o.value;continue}let i=o.value.split("."),s=i[0],a=i[1]||"",l=i[1]?".":"",h=Number(t.toFixed(a.length)).toString().split("."),d=h[0]||"",u=h[1]||"";if(s.length>d.length){let e=n6(s.substr(0,s.length-d.length),"0");d=n3(d,e+d.length)}let c=n6(a.substr(u.length,a.length-u.length),"0");r+=d+l+(u=function(e,t){let r=`${e}`;for(;r.length<t;)r+="0";return r}(u,c+u.length))}return r}(s.tokens,e):t})(e,t,this.config,this.dateTimeHelper))}weekday(e,t){return this.runFunction(e.args,t,this.metadata("WEEKDAY"),(e,t)=>{let r=Math.floor(this.dateTimeHelper.relativeNumberToAbsoluteNumber(e));if(3===t)return(r-1)%7;let n=iD.get(t);return void 0===n?new rK(d.NUM,ej.BadMode):(r-n)%7+1})}weeknum(e,t){return this.runFunction(e.args,t,this.metadata("WEEKNUM"),(e,t)=>{let r=Math.floor(this.dateTimeHelper.relativeNumberToAbsoluteNumber(e)),n=this.dateTimeHelper.numberToSimpleDate(e),o=this.dateTimeHelper.dateToNumber({year:n.year,month:1,day:1}),i=this.dateTimeHelper.relativeNumberToAbsoluteNumber(o);if(21===t)return this.isoweeknumCore(e);let s=iD.get(t);return void 0===s?new rK(d.NUM,ej.BadMode):Math.floor((r-s)/7)-Math.floor((i-s)/7)+1})}isoweeknum(e,t){return this.runFunction(e.args,t,this.metadata("ISOWEEKNUM"),this.isoweeknumCore)}datevalue(e,t){return this.runFunction(e.args,t,this.metadata("DATEVALUE"),e=>{let{dateTime:t}=this.dateTimeHelper.parseDateTimeFromConfigFormats(e);return void 0===t?new rK(d.VALUE,ej.IncorrectDateTime):nz(t)?(nW(t)?Math.trunc(nK(t)):0)+this.dateTimeHelper.dateToNumber(t):0})}timevalue(e,t){return this.runFunction(e.args,t,this.metadata("TIMEVALUE"),e=>{let t=this.dateTimeHelper.dateStringToDateNumber(e);return void 0===t?new rK(d.VALUE,ej.IncorrectDateTime):tI(t)%1})}now(e,t){return this.runFunction(e.args,t,this.metadata("NOW"),()=>{let e=new Date(Date.now());return nK({hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds()})+this.dateTimeHelper.dateToNumber({year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()})})}today(e,t){return this.runFunction(e.args,t,this.metadata("TODAY"),()=>{let e=new Date(Date.now());return this.dateTimeHelper.dateToNumber({year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()})})}edate(e,t){return this.runFunction(e.args,t,this.metadata("EDATE"),(e,t)=>{var r;let n={year:(r=nY(this.dateTimeHelper.numberToSimpleDate(e),t)).year,month:r.month,day:Math.min(r.day,nV[r.month-1])},o=this.dateTimeHelper.dateToNumber(n);return void 0===(o=this.dateTimeHelper.getWithinBounds(o))?new rK(d.NUM,ej.DateBounds):o})}datedif(e,t){return this.runFunction(e.args,t,this.metadata("DATEDIF"),(e,t,r)=>{if(e>t)return new rK(d.NUM,ej.StartEndDate);if("D"===r)return Math.floor(t)-Math.floor(e);let n=this.dateTimeHelper.numberToSimpleDate(e),o=this.dateTimeHelper.numberToSimpleDate(t);switch(r){case"M":return(o.year-n.year)*12+(o.month-n.month)-(o.day<n.day);case"YM":return(12+(o.month-n.month)-(o.day<n.day))%12;case"Y":if(o.month>n.month||o.month===n.month&&o.day>=n.day)return o.year-n.year;return o.year-n.year-1;case"MD":if(o.day>=n.day)return o.day-n.day;{let e=1===o.month?12:o.month-1,t=1===o.month?o.year-1:o.year;return this.dateTimeHelper.daysInMonth(t,e)+o.day-n.day}case"YD":if(o.month>n.month||o.month===n.month&&o.day>=n.day)return Math.floor(t)-this.dateTimeHelper.dateToNumber({year:o.year,month:n.month,day:n.day});return Math.floor(t)-Math.floor(e)-365*(o.year-n.year-1)-this.dateTimeHelper.leapYearsCount(o.year-1)+this.dateTimeHelper.leapYearsCount(n.year);default:return new rK(d.NUM,ej.BadMode)}})}days360(e,t){return this.runFunction(e.args,t,this.metadata("DAYS360"),this.days360Core)}yearfrac(e,t){return this.runFunction(e.args,t,this.metadata("YEARFRAC"),(e,t,r)=>{switch((e=Math.trunc(e))>(t=Math.trunc(t))&&([e,t]=[t,e]),r){case 0:return this.days360Core(e,t,!1)/360;case 1:return(t-e)/this.dateTimeHelper.yearLengthForBasis(this.dateTimeHelper.numberToSimpleDate(e),this.dateTimeHelper.numberToSimpleDate(t));case 2:return(t-e)/360;case 3:return(t-e)/365;case 4:return this.days360Core(e,t,!0)/360}throw Error("Should not be reachable.")})}interval(e,t){return this.runFunction(e.args,t,this.metadata("INTERVAL"),e=>{let t=(e=Math.trunc(e))%60,r=(e=Math.trunc(e/60))%60,n=(e=Math.trunc(e/60))%24,o=(e=Math.trunc(e/24))%30,i=(e=Math.trunc(e/30))%12,s=Math.trunc(e/12);return"P"+(s>0?`${s}Y`:"")+(i>0?`${i}M`:"")+(o>0?`${o}D`:"")+"T"+(n>0?`${n}H`:"")+(r>0?`${r}M`:"")+(t>0?`${t}S`:"")})}networkdays(e,t){return this.runFunction(e.args,t,this.metadata("NETWORKDAYS"),(e,t,r)=>this.networkdayscore(e,t,1,r))}networkdaysintl(e,t){return this.runFunction(e.args,t,this.metadata("NETWORKDAYS.INTL"),(e,t,r,n)=>this.networkdayscore(e,t,r,n))}workday(e,t){return this.runFunction(e.args,t,this.metadata("WORKDAY"),(e,t,r)=>this.workdaycore(e,t,1,r))}workdayintl(e,t){return this.runFunction(e.args,t,this.metadata("WORKDAY.INTL"),(e,t,r,n)=>this.workdaycore(e,t,r,n))}networkdayscore(e,t,r,n){let o=1;(e=Math.trunc(e))>(t=Math.trunc(t))&&([e,t]=[t,e],o=-1);let i=iP(r);if(i instanceof rK)return i;let s=this.simpleRangeToFilteredHolidays(i,n);return s instanceof rK?s:o*this.countWorkdays(e,t,i,s)}workdaycore(e,t,r,n){e=Math.trunc(e),t=Math.trunc(t);let o=iP(r);if(o instanceof rK)return o;let i=this.simpleRangeToFilteredHolidays(o,n);if(i instanceof rK)return i;if(t>0){let r=1;for(;this.countWorkdays(e+1,e+r,o,i)<t;)r*=2;let n=1;for(;n+1<r;){let s=Math.trunc((n+r)/2);this.countWorkdays(e+1,e+s,o,i)<t?n=s:r=s}return e+r}if(!(t<0))return e;{t*=-1;let r=1;for(;this.countWorkdays(e-r,e-1,o,i)<t;)r*=2;let n=1;for(;n+1<r;){let s=Math.trunc((n+r)/2);this.countWorkdays(e-s,e-1,o,i)<t?n=s:r=s}return e-r}}countWorkdays(e,t,r,n){let o=Math.floor(this.dateTimeHelper.relativeNumberToAbsoluteNumber(t)),i=Math.floor(this.dateTimeHelper.relativeNumberToAbsoluteNumber(e)),s=0;for(let e=0;e<7;e++)"0"===r.charAt(e)&&(s+=Math.floor((o+6-e)/7),s-=Math.floor((i-1+6-e)/7));return s-(iL(t+1,n)-iL(e,n))}simpleRangeToFilteredHolidays(e,t){var r;let n=null!=(r=null==t?void 0:t.valuesFromTopLeftCorner())?r:[];for(let e of n)if(e instanceof rK)return e;let o=[];for(let e of n)if(e!==tM)if(!tP(e))return new rK(d.VALUE,ej.WrongType);else o.push(Math.trunc(tI(e)));return[...new Set(o)].sort((e,t)=>e-t).filter(t=>{let r=this.dateTimeHelper.relativeNumberToAbsoluteNumber(t);return"0"===e.charAt((r-1)%7)})}}function iL(e,t){if(0===t.length||e<=t[0])return 0;if(t[t.length-1]<e)return t.length;let r=0,n=t.length-1;for(;r+1<n;){let o=Math.floor((n+r)/2);t[o]>=e?n=o:r=o}return n}function iP(e){var t;return"number"!=typeof e&&"string"!=typeof e?new rK(d.VALUE,ej.WrongType):"string"!=typeof e?null!=(t=iF.get(e))?t:new rK(d.NUM,ej.BadMode):7===e.length&&/^(0|1)*$/.test(e)&&"1111111"!==e?e:new rK(d.NUM,ej.WeekendString)}i_.implementedFunctions={DATE:{method:"date",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER},{argumentType:p.NUMBER}],returnNumberType:s.NUMBER_DATE},TIME:{method:"time",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER},{argumentType:p.NUMBER}],returnNumberType:s.NUMBER_TIME},MONTH:{method:"month",parameters:[{argumentType:p.NUMBER,minValue:0}]},YEAR:{method:"year",parameters:[{argumentType:p.NUMBER,minValue:0}]},HOUR:{method:"hour",parameters:[{argumentType:p.NUMBER,minValue:0}]},MINUTE:{method:"minute",parameters:[{argumentType:p.NUMBER,minValue:0}]},SECOND:{method:"second",parameters:[{argumentType:p.NUMBER,minValue:0}]},TEXT:{method:"text",parameters:[{argumentType:p.NUMBER},{argumentType:p.STRING}]},EOMONTH:{method:"eomonth",parameters:[{argumentType:p.NUMBER,minValue:0},{argumentType:p.NUMBER}],returnNumberType:s.NUMBER_DATE},DAY:{method:"day",parameters:[{argumentType:p.NUMBER,minValue:0}]},DAYS:{method:"days",parameters:[{argumentType:p.NUMBER,minValue:0},{argumentType:p.NUMBER,minValue:0}]},WEEKDAY:{method:"weekday",parameters:[{argumentType:p.NUMBER,minValue:0},{argumentType:p.NUMBER,defaultValue:1}]},WEEKNUM:{method:"weeknum",parameters:[{argumentType:p.NUMBER,minValue:0},{argumentType:p.NUMBER,defaultValue:1}]},ISOWEEKNUM:{method:"isoweeknum",parameters:[{argumentType:p.NUMBER,minValue:0}]},DATEVALUE:{method:"datevalue",parameters:[{argumentType:p.STRING}],returnNumberType:s.NUMBER_DATE},TIMEVALUE:{method:"timevalue",parameters:[{argumentType:p.STRING}],returnNumberType:s.NUMBER_TIME},NOW:{method:"now",parameters:[],isVolatile:!0,returnNumberType:s.NUMBER_DATETIME},TODAY:{method:"today",parameters:[],isVolatile:!0,returnNumberType:s.NUMBER_DATE},EDATE:{method:"edate",parameters:[{argumentType:p.NUMBER,minValue:0},{argumentType:p.NUMBER}],returnNumberType:s.NUMBER_DATE},DAYS360:{method:"days360",parameters:[{argumentType:p.NUMBER,minValue:0},{argumentType:p.NUMBER,minValue:0},{argumentType:p.BOOLEAN,defaultValue:!1}]},DATEDIF:{method:"datedif",parameters:[{argumentType:p.NUMBER,minValue:0},{argumentType:p.NUMBER,minValue:0},{argumentType:p.STRING}]},YEARFRAC:{method:"yearfrac",parameters:[{argumentType:p.NUMBER,minValue:0},{argumentType:p.NUMBER,minValue:0},{argumentType:p.INTEGER,defaultValue:0,minValue:0,maxValue:4}]},INTERVAL:{method:"interval",parameters:[{argumentType:p.NUMBER,minValue:0}]},NETWORKDAYS:{method:"networkdays",parameters:[{argumentType:p.NUMBER,minValue:0},{argumentType:p.NUMBER,minValue:0},{argumentType:p.RANGE,optionalArg:!0}]},"NETWORKDAYS.INTL":{method:"networkdaysintl",parameters:[{argumentType:p.NUMBER,minValue:0},{argumentType:p.NUMBER,minValue:0},{argumentType:p.NOERROR,defaultValue:1},{argumentType:p.RANGE,optionalArg:!0}]},WORKDAY:{method:"workday",parameters:[{argumentType:p.NUMBER,minValue:0},{argumentType:p.NUMBER},{argumentType:p.RANGE,optionalArg:!0}]},"WORKDAY.INTL":{method:"workdayintl",parameters:[{argumentType:p.NUMBER,minValue:0},{argumentType:p.NUMBER},{argumentType:p.NOERROR,defaultValue:1},{argumentType:p.RANGE,optionalArg:!0}]}};let iD=new Map([[1,0],[2,1],[11,1],[12,2],[13,3],[14,4],[15,5],[16,6],[17,0]]),iF=new Map([[1,"0000011"],[2,"1000001"],[3,"1100000"],[4,"0110000"],[5,"0011000"],[6,"0001100"],[7,"0000110"],[11,"0000001"],[12,"1000000"],[13,"0100000"],[14,"0010000"],[15,"0001000"],[16,"0000100"],[17,"0000010"]]);class iB extends nv{degrees(e,t){return this.runFunction(e.args,t,this.metadata("DEGREES"),e=>180/Math.PI*e)}}iB.implementedFunctions={DEGREES:{method:"degrees",parameters:[{argumentType:p.NUMBER}]}};class iV extends nv{delta(e,t){return this.runFunction(e.args,t,this.metadata("DELTA"),(e,t)=>+(e===t))}}iV.implementedFunctions={DELTA:{method:"delta",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER,defaultValue:0}]}};class iU extends nv{exp(e,t){return this.runFunction(e.args,t,this.metadata("EXP"),Math.exp)}}iU.implementedFunctions={EXP:{method:"exp",parameters:[{argumentType:p.NUMBER}]}};class iz extends nv{pmt(e,t){return this.runFunction(e.args,t,this.metadata("PMT"),iW)}ipmt(e,t){return this.runFunction(e.args,t,this.metadata("IPMT"),iG)}ppmt(e,t){return this.runFunction(e.args,t,this.metadata("PPMT"),iY)}fv(e,t){return this.runFunction(e.args,t,this.metadata("FV"),i$)}cumipmt(e,t){return this.runFunction(e.args,t,this.metadata("CUMIPMT"),(e,t,r,n,o,i)=>{if(n>o)return new rK(d.NUM,ej.EndStartPeriod);let s=0;for(let a=n;a<=o;a++)s+=iG(e,a,t,r,0,i);return s})}cumprinc(e,t){return this.runFunction(e.args,t,this.metadata("CUMPRINC"),(e,t,r,n,o,i)=>{if(n>o)return new rK(d.NUM,ej.EndStartPeriod);let s=0;for(let a=n;a<=o;a++)s+=iY(e,a,t,r,0,i);return s})}db(e,t){return this.runFunction(e.args,t,this.metadata("DB"),(e,t,r,n,o)=>{if(12===o&&n>r||n>r+1)return new rK(d.NUM,ej.PeriodLong);if(t>=e)return 0;let i=Math.round((1-Math.pow(t/e,1/r))*1e3)/1e3,s=e*i*o/12;if(1===n)return s;let a=s;for(let t=0;t<n-2;t++)a+=(e-a)*i;return n===r+1?(e-a)*i*(12-o)/12:(e-a)*i})}ddb(e,t){return this.runFunction(e.args,t,this.metadata("DDB"),(e,t,r,n,o)=>{let i;if(n>r)return new rK(d.NUM);let s=o/r;return s>=1?(s=1,i=1===n?e:0):i=e*Math.pow(1-s,n-1),Math.max(i-Math.max(t,e*Math.pow(1-s,n)),0)})}dollarde(e,t){return this.runFunction(e.args,t,this.metadata("DOLLARDE"),(e,t)=>{if(t<1)return new rK(d.DIV_BY_ZERO);for(t=Math.trunc(t);t>10;)t/=10;return Math.trunc(e)+(e-Math.trunc(e))*10/t})}dollarfr(e,t){return this.runFunction(e.args,t,this.metadata("DOLLARFR"),(e,t)=>{if(t<1)return new rK(d.DIV_BY_ZERO);for(t=Math.trunc(t);t>10;)t/=10;return Math.trunc(e)+(e-Math.trunc(e))*t/10})}effect(e,t){return this.runFunction(e.args,t,this.metadata("EFFECT"),(e,t)=>Math.pow(1+e/(t=Math.trunc(t)),t)-1)}ispmt(e,t){return this.runFunction(e.args,t,this.metadata("ISPMT"),(e,t,r,n)=>0===r?new rK(d.DIV_BY_ZERO):n*e*(t/r-1))}nominal(e,t){return this.runFunction(e.args,t,this.metadata("NOMINAL"),(e,t)=>(Math.pow(e+1,1/(t=Math.trunc(t)))-1)*t)}nper(e,t){return this.runFunction(e.args,t,this.metadata("NPER"),(e,t,r,n,o)=>0===e?0===t?new rK(d.DIV_BY_ZERO):(-r-n)/t:(o&&(t*=1+e),Math.log((t-n*e)/(r*e+t))/Math.log(1+e)))}rate(e,t){return this.runFunction(e.args,t,this.metadata("RATE"),(e,t,r,n,o,i)=>{if(i<=-1)return new rK(d.VALUE);let s=i;o=+!!o;for(let i=0;i<50;i++){let i,a;if(s<=-1)break;if(1e-7>Math.abs(s))i=r*(1+e*s)+t*(1+s*o)*e+n;else{let a=Math.pow(1+s,e);i=r*a+t*(1/s+o)*(a-1)+n}if(1e-7>Math.abs(i))return s;if(1e-7>Math.abs(s))a=r*e+t*o*e;else{let n=Math.pow(1+s,e),i=e*Math.pow(1+s,e-1);a=r*i+t*(1/s+o)*i+-1/(s*s)*t*(n-1)}s-=i/a}return new rK(d.NUM)})}pv(e,t){return this.runFunction(e.args,t,this.metadata("PV"),(e,t,r,n,o)=>{if(o=+!!o,-1===e)if(0===t)return new rK(d.NUM);else return new rK(d.DIV_BY_ZERO);return 0===e?-r*t-n:((1-Math.pow(1+e,t))*r*(1+e*o)/e-n)/Math.pow(1+e,t)})}rri(e,t){return this.runFunction(e.args,t,this.metadata("RRI"),(e,t,r)=>0===t||r<0&&t>0||r>0&&t<0?new rK(d.NUM):Math.pow(r/t,1/e)-1)}sln(e,t){return this.runFunction(e.args,t,this.metadata("SLN"),(e,t,r)=>0===r?new rK(d.DIV_BY_ZERO):(e-t)/r)}syd(e,t){return this.runFunction(e.args,t,this.metadata("SYD"),(e,t,r,n)=>n>r?new rK(d.NUM):(e-t)*(r-n+1)*2/(r*(r+1)))}tbilleq(e,t){return this.runFunction(e.args,t,this.metadata("TBILLEQ"),(e,t,r)=>{if((e=Math.round(e))>=(t=Math.round(t)))return new rK(d.NUM);let n=this.dateTimeHelper.numberToSimpleDate(e),o=this.dateTimeHelper.numberToSimpleDate(t);if(o.year>n.year+1||o.year===n.year+1&&(o.month>n.month||o.month===n.month&&o.day>n.day))return new rK(d.NUM);let i=360-r*(t-e);return 0===i?0:i<0?new rK(d.NUM):365*r/i})}tbillprice(e,t){return this.runFunction(e.args,t,this.metadata("TBILLPRICE"),(e,t,r)=>{if((e=Math.round(e))>=(t=Math.round(t)))return new rK(d.NUM);let n=this.dateTimeHelper.numberToSimpleDate(e),o=this.dateTimeHelper.numberToSimpleDate(t);if(o.year>n.year+1||o.year===n.year+1&&(o.month>n.month||o.month===n.month&&o.day>n.day))return new rK(d.NUM);let i=360-r*(t-e);return 0===i?0:i<0?new rK(d.NUM):100*(1-r*(t-e)/360)})}tbillyield(e,t){return this.runFunction(e.args,t,this.metadata("TBILLYIELD"),(e,t,r)=>{if((e=Math.round(e))>=(t=Math.round(t)))return new rK(d.NUM);let n=this.dateTimeHelper.numberToSimpleDate(e),o=this.dateTimeHelper.numberToSimpleDate(t);return o.year>n.year+1||o.year===n.year+1&&(o.month>n.month||o.month===n.month&&o.day>n.day)?new rK(d.NUM):(100-r)*360/(r*(t-e))})}fvschedule(e,t){return this.runFunction(e.args,t,this.metadata("FVSCHEDULE"),(e,t)=>{let r=t.valuesFromTopLeftCorner();for(let e of r)if(e instanceof rK)return e;for(let t of r)if(tP(t))e*=1+tI(t);else if(t!==tM)return new rK(d.VALUE,ej.NumberExpected);return e})}npv(e,t){return this.runFunction(e.args,t,this.metadata("NPV"),(e,...t)=>{let r=this.arithmeticHelper.coerceNumbersExactRanges(t);return r instanceof rK?r:ij(e,r)})}mirr(e,t){return this.runFunction(e.args,t,this.metadata("MIRR"),(e,t,r)=>{let n=this.arithmeticHelper.manyToExactNumbers(e.valuesFromTopLeftCorner());if(n instanceof rK)return n;let o=!1,i=!1,s=[],a=[];for(let e of n)e>0?(o=!0,s.push(e),a.push(0)):(e<0?(i=!0,a.push(e)):a.push(0),s.push(0));if(!o||!i)return new rK(d.DIV_BY_ZERO);let l=n.length,h=ij(r,s);if(h instanceof rK)return h;let u=ij(t,a);return u instanceof rK?u:Math.pow(-h*Math.pow(1+r,l)/u/(1+t),1/(l-1))-1})}pduration(e,t){return this.runFunction(e.args,t,this.metadata("PDURATION"),(e,t,r)=>(Math.log(r)-Math.log(t))/Math.log(1+e))}xnpv(e,t){return this.runFunction(e.args,t,this.metadata("XNPV"),(e,t,r)=>{let n=t.valuesFromTopLeftCorner();for(let e of n)if("number"!=typeof e)return new rK(d.VALUE,ej.NumberExpected);let o=r.valuesFromTopLeftCorner();for(let e of o)if("number"!=typeof e)return new rK(d.VALUE,ej.NumberExpected);if(o.length!==n.length)return new rK(d.NUM,ej.EqualLength);let i=o.length,s=0;if(o[0]<0)return new rK(d.NUM,ej.ValueSmall);for(let t=0;t<i;t++){if(o[t]=Math.floor(o[t]),o[t]<o[0])return new rK(d.NUM,ej.ValueSmall);s+=n[t]/Math.pow(1+e,(o[t]-o[0])/365)}return s})}irr(e,t){return this.runFunction(e.args,t,this.metadata("IRR"),(e,t)=>{if(t<=-1)return new rK(d.VALUE);let r=this.arithmeticHelper.manyToExactNumbers(e.valuesFromTopLeftCorner());if(r instanceof rK)return r;let n=r.some(e=>e>0),o=r.some(e=>e<0);return n&&o?function(e,t){let r=t;for(let t=0;t<50;t++){let t=0,n=0;for(let o=0;o<e.length;o++){let i=Math.pow(1+r,o);if(!isFinite(i)||0===i)return new rK(d.NUM);t+=e[o]/i,o>0&&(n-=o*e[o]/(i*(1+r)))}if(1e-10>Math.abs(t))return r;if(1e-10>Math.abs(n))break;let o=r-t/n;if(!isFinite(o))break;if(o<=-1&&(o=(r-1)/2),1e-10>Math.abs(o-r))return o;r=o}return new rK(d.NUM)}(r,t):new rK(d.NUM)})}}function iW(e,t,r,n,o){if(0===e)return(-r-n)/t;{let i=Math.pow(1+e,t);return(n*e+r*e*i)*(o?1/(1+e):1)/(1-i)}}function iG(e,t,r,n,o,i){let s=iW(e,r,n,o,i);return 1===t?e*(i?0:-n):e*(i?i$(e,t-2,s,n,i)-s:i$(e,t-1,s,n,i))}function i$(e,t,r,n,o){if(0===e)return-n-r*t;{let i=Math.pow(1+e,t);return r*(o?1+e:1)*(1-i)/e-n*i}}function iY(e,t,r,n,o,i){return iW(e,r,n,o,i)-iG(e,t,r,n,o,i)}function ij(e,t){let r=0;for(let n=t.length-1;n>=0;n--){if(r+=t[n],-1===e)if(0===r)continue;else return new rK(d.DIV_BY_ZERO);r/=1+e}return r}iz.implementedFunctions={PMT:{method:"pmt",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER},{argumentType:p.NUMBER},{argumentType:p.NUMBER,defaultValue:0},{argumentType:p.NUMBER,defaultValue:0}],returnNumberType:s.NUMBER_CURRENCY},IPMT:{method:"ipmt",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER},{argumentType:p.NUMBER},{argumentType:p.NUMBER},{argumentType:p.NUMBER,defaultValue:0},{argumentType:p.NUMBER,defaultValue:0}],returnNumberType:s.NUMBER_CURRENCY},PPMT:{method:"ppmt",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER},{argumentType:p.NUMBER},{argumentType:p.NUMBER},{argumentType:p.NUMBER,defaultValue:0},{argumentType:p.NUMBER,defaultValue:0}],returnNumberType:s.NUMBER_CURRENCY},FV:{method:"fv",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER},{argumentType:p.NUMBER},{argumentType:p.NUMBER,defaultValue:0},{argumentType:p.NUMBER,defaultValue:0}],returnNumberType:s.NUMBER_CURRENCY},CUMIPMT:{method:"cumipmt",parameters:[{argumentType:p.NUMBER,greaterThan:0},{argumentType:p.NUMBER,greaterThan:0},{argumentType:p.NUMBER,greaterThan:0},{argumentType:p.INTEGER,minValue:1},{argumentType:p.INTEGER,minValue:1},{argumentType:p.INTEGER,minValue:0,maxValue:1}],returnNumberType:s.NUMBER_CURRENCY},CUMPRINC:{method:"cumprinc",parameters:[{argumentType:p.NUMBER,greaterThan:0},{argumentType:p.NUMBER,greaterThan:0},{argumentType:p.NUMBER,greaterThan:0},{argumentType:p.INTEGER,minValue:1},{argumentType:p.INTEGER,minValue:1},{argumentType:p.INTEGER,minValue:0,maxValue:1}],returnNumberType:s.NUMBER_CURRENCY},DB:{method:"db",parameters:[{argumentType:p.NUMBER,minValue:0},{argumentType:p.NUMBER,minValue:0},{argumentType:p.INTEGER,minValue:0},{argumentType:p.INTEGER,minValue:0},{argumentType:p.INTEGER,minValue:1,maxValue:12,defaultValue:12}],returnNumberType:s.NUMBER_CURRENCY},DDB:{method:"ddb",parameters:[{argumentType:p.NUMBER,minValue:0},{argumentType:p.NUMBER,minValue:0},{argumentType:p.INTEGER,minValue:0},{argumentType:p.NUMBER,minValue:0},{argumentType:p.NUMBER,greaterThan:0,defaultValue:2}],returnNumberType:s.NUMBER_CURRENCY},DOLLARDE:{method:"dollarde",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER,minValue:0}]},DOLLARFR:{method:"dollarfr",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER,minValue:0}]},EFFECT:{method:"effect",parameters:[{argumentType:p.NUMBER,minValue:0},{argumentType:p.NUMBER,minValue:1}],returnNumberType:s.NUMBER_PERCENT},ISPMT:{method:"ispmt",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER},{argumentType:p.NUMBER},{argumentType:p.NUMBER}]},NOMINAL:{method:"nominal",parameters:[{argumentType:p.NUMBER,minValue:0},{argumentType:p.NUMBER,minValue:1}],returnNumberType:s.NUMBER_PERCENT},NPER:{method:"nper",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER},{argumentType:p.NUMBER},{argumentType:p.NUMBER,defaultValue:0},{argumentType:p.NUMBER,defaultValue:0}]},PV:{method:"pv",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER},{argumentType:p.NUMBER},{argumentType:p.NUMBER,defaultValue:0},{argumentType:p.NUMBER,defaultValue:0}],returnNumberType:s.NUMBER_CURRENCY},RATE:{method:"rate",parameters:[{argumentType:p.NUMBER,greaterThan:0},{argumentType:p.NUMBER},{argumentType:p.NUMBER},{argumentType:p.NUMBER,defaultValue:0},{argumentType:p.NUMBER,defaultValue:0},{argumentType:p.NUMBER,defaultValue:.1}],returnNumberType:s.NUMBER_PERCENT},RRI:{method:"rri",parameters:[{argumentType:p.NUMBER,greaterThan:0},{argumentType:p.NUMBER},{argumentType:p.NUMBER}],returnNumberType:s.NUMBER_PERCENT},SLN:{method:"sln",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER},{argumentType:p.NUMBER}],returnNumberType:s.NUMBER_CURRENCY},SYD:{method:"syd",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER},{argumentType:p.NUMBER,greaterThan:0},{argumentType:p.NUMBER,greaterThan:0}],returnNumberType:s.NUMBER_CURRENCY},TBILLEQ:{method:"tbilleq",parameters:[{argumentType:p.NUMBER,minValue:0},{argumentType:p.NUMBER,minValue:0},{argumentType:p.NUMBER,greaterThan:0}],returnNumberType:s.NUMBER_PERCENT},TBILLPRICE:{method:"tbillprice",parameters:[{argumentType:p.NUMBER,minValue:0},{argumentType:p.NUMBER,minValue:0},{argumentType:p.NUMBER,greaterThan:0}],returnNumberType:s.NUMBER_CURRENCY},TBILLYIELD:{method:"tbillyield",parameters:[{argumentType:p.NUMBER,minValue:0},{argumentType:p.NUMBER,minValue:0},{argumentType:p.NUMBER,greaterThan:0}],returnNumberType:s.NUMBER_PERCENT},FVSCHEDULE:{method:"fvschedule",parameters:[{argumentType:p.NUMBER},{argumentType:p.RANGE}],returnNumberType:s.NUMBER_CURRENCY},NPV:{method:"npv",parameters:[{argumentType:p.NUMBER},{argumentType:p.ANY}],repeatLastArgs:1,returnNumberType:s.NUMBER_CURRENCY},MIRR:{method:"mirr",parameters:[{argumentType:p.RANGE},{argumentType:p.NUMBER},{argumentType:p.NUMBER}],returnNumberType:s.NUMBER_PERCENT},PDURATION:{method:"pduration",parameters:[{argumentType:p.NUMBER,greaterThan:0},{argumentType:p.NUMBER,greaterThan:0},{argumentType:p.NUMBER,greaterThan:0}]},XNPV:{method:"xnpv",parameters:[{argumentType:p.NUMBER,greaterThan:-1},{argumentType:p.RANGE},{argumentType:p.RANGE}]},IRR:{method:"irr",parameters:[{argumentType:p.RANGE},{argumentType:p.NUMBER,defaultValue:.1}],returnNumberType:s.NUMBER_PERCENT}};class iq extends nv{formulatext(e,t){return this.runFunctionWithReferenceArgument(e.args,t,this.metadata("FORMULATEXT"),()=>new rK(d.NA,ej.WrongArgNumber),e=>{var t;return null!=(t=this.serialization.getCellFormula(e))?t:new rK(d.NA,ej.Formula)})}}iq.implementedFunctions={FORMULATEXT:{method:"formulatext",parameters:[{argumentType:p.NOERROR}],doesNotNeedArgumentsToBeComputed:!0,isDependentOnSheetStructureChange:!0,vectorizationForbidden:!0}};class iK extends nv{hyperlink(e,t){return this.runFunction(e.args,t,this.metadata("HYPERLINK"),(t,r)=>(e.hyperlink=t,null!=r?r:t))}}iK.implementedFunctions={HYPERLINK:{method:"hyperlink",parameters:[{argumentType:p.STRING},{argumentType:p.STRING,optionalArg:!0}]}};class iX extends nv{isbinary(e,t){return this.runFunction(e.args,t,this.metadata("ISBINARY"),e=>/^[01]{1,10}$/.test(e))}iserr(e,t){return this.runFunction(e.args,t,this.metadata("ISERR"),e=>e instanceof rK&&e.type!==d.NA)}iserror(e,t){return this.runFunction(e.args,t,this.metadata("ISERROR"),e=>e instanceof rK)}isformula(e,t){return this.runFunctionWithReferenceArgument(e.args,t,this.metadata("ISFORMULA"),()=>new rK(d.NA,ej.WrongArgNumber),e=>this.dependencyGraph.addressMapping.getCell(e)instanceof rE)}isblank(e,t){return this.runFunction(e.args,t,this.metadata("ISBLANK"),e=>e===tM)}isna(e,t){return this.runFunction(e.args,t,this.metadata("ISNA"),e=>e instanceof rK&&e.type==d.NA)}isnumber(e,t){return this.runFunction(e.args,t,this.metadata("ISNUMBER"),tP)}islogical(e,t){return this.runFunction(e.args,t,this.metadata("ISLOGICAL"),e=>"boolean"==typeof e)}isref(e,t){return this.runFunction(e.args,t,this.metadata("ISREF"),e=>e instanceof rK&&(e.type==d.REF||e.type==d.CYCLE))}istext(e,t){return this.runFunction(e.args,t,this.metadata("ISTEXT"),e=>"string"==typeof e)}isnontext(e,t){return this.runFunction(e.args,t,this.metadata("ISNONTEXT"),e=>"string"!=typeof e)}column(e,t){return this.runFunctionWithReferenceArgument(e.args,t,this.metadata("COLUMN"),()=>t.formulaAddress.col+1,e=>e.col+1)}columns(e,t){if(1!==e.args.length)return new rK(d.NA,ej.WrongArgNumber);if(e.args.some(e=>e.type===o.EMPTY))return new rK(d.NUM,ej.EmptyArg);let r=e.args[0];for(;r.type===o.PARENTHESIS;)r=r.expression;if(r.type===o.CELL_RANGE||r.type===o.COLUMN_RANGE)return r.end.col-r.start.col+1;{if(r.type===o.CELL_REFERENCE)return 1;if(r.type===o.ROW_RANGE)return this.config.maxColumns;let e=this.evaluateAst(r,t);return e instanceof tF?e.width():e instanceof rK?e:1}}row(e,t){return this.runFunctionWithReferenceArgument(e.args,t,this.metadata("ROW"),()=>t.formulaAddress.row+1,e=>e.row+1)}rows(e,t){if(1!==e.args.length)return new rK(d.NA,ej.WrongArgNumber);if(e.args.some(e=>e.type===o.EMPTY))return new rK(d.NUM,ej.EmptyArg);let r=e.args[0];for(;r.type===o.PARENTHESIS;)r=r.expression;if(r.type===o.CELL_RANGE||r.type===o.ROW_RANGE)return r.end.row-r.start.row+1;{if(r.type===o.CELL_REFERENCE)return 1;if(r.type===o.COLUMN_RANGE)return this.config.maxRows;let e=this.evaluateAst(r,t);return e instanceof tF?e.height():e instanceof rK?e:1}}index(e,t){return this.runFunction(e.args,t,this.metadata("INDEX"),(e,t,r)=>{var n,o,i,s,a,l;return r<1||t<1?new rK(d.VALUE,ej.LessThanOne):r>e.width()||t>e.height()?new rK(d.NUM,ej.ValueLarge):null!=(l=null!=(i=null==(o=null==(n=null==e?void 0:e.data)?void 0:n[t-1])?void 0:o[r-1])?i:null==(a=null==(s=null==e?void 0:e.data)?void 0:s[0])?void 0:a[0])?l:new rK(d.VALUE,ej.CellRangeExpected)})}na(e,t){return new rK(d.NA)}sheet(e,t){return this.runFunctionWithReferenceArgument(e.args,t,this.metadata("SHEET"),()=>t.formulaAddress.sheet+1,e=>e.sheet+1,e=>{let t=this.dependencyGraph.sheetMapping.getSheetId(e);return void 0!==t?t+1:new rK(d.NA,ej.SheetRef)})}sheets(e,t){return this.runFunctionWithReferenceArgument(e.args,t,this.metadata("SHEETS"),()=>this.dependencyGraph.sheetMapping.numberOfSheets(),()=>1,()=>new rK(d.VALUE,ej.CellRefExpected))}}iX.implementedFunctions={COLUMN:{method:"column",parameters:[{argumentType:p.NOERROR,optionalArg:!0}],isDependentOnSheetStructureChange:!0,doesNotNeedArgumentsToBeComputed:!0,vectorizationForbidden:!0},COLUMNS:{method:"columns",parameters:[{argumentType:p.RANGE}],isDependentOnSheetStructureChange:!0,doesNotNeedArgumentsToBeComputed:!0,vectorizationForbidden:!0},ISBINARY:{method:"isbinary",parameters:[{argumentType:p.STRING}]},ISERR:{method:"iserr",parameters:[{argumentType:p.SCALAR}]},ISFORMULA:{method:"isformula",parameters:[{argumentType:p.NOERROR}],doesNotNeedArgumentsToBeComputed:!0,vectorizationForbidden:!0},ISNA:{method:"isna",parameters:[{argumentType:p.SCALAR}]},ISREF:{method:"isref",parameters:[{argumentType:p.SCALAR}],vectorizationForbidden:!0},ISERROR:{method:"iserror",parameters:[{argumentType:p.SCALAR}]},ISBLANK:{method:"isblank",parameters:[{argumentType:p.SCALAR}]},ISNUMBER:{method:"isnumber",parameters:[{argumentType:p.SCALAR}]},ISLOGICAL:{method:"islogical",parameters:[{argumentType:p.SCALAR}]},ISTEXT:{method:"istext",parameters:[{argumentType:p.SCALAR}]},ISNONTEXT:{method:"isnontext",parameters:[{argumentType:p.SCALAR}]},INDEX:{method:"index",parameters:[{argumentType:p.RANGE},{argumentType:p.NUMBER},{argumentType:p.NUMBER,defaultValue:1}]},NA:{method:"na",parameters:[]},ROW:{method:"row",parameters:[{argumentType:p.NOERROR,optionalArg:!0}],isDependentOnSheetStructureChange:!0,doesNotNeedArgumentsToBeComputed:!0,vectorizationForbidden:!0},ROWS:{method:"rows",parameters:[{argumentType:p.RANGE}],isDependentOnSheetStructureChange:!0,doesNotNeedArgumentsToBeComputed:!0,vectorizationForbidden:!0},SHEET:{method:"sheet",parameters:[{argumentType:p.STRING}],doesNotNeedArgumentsToBeComputed:!0,vectorizationForbidden:!0},SHEETS:{method:"sheets",parameters:[{argumentType:p.STRING}],doesNotNeedArgumentsToBeComputed:!0,vectorizationForbidden:!0}};class iQ extends nv{iseven(e,t){return this.runFunction(e.args,t,this.metadata("ISEVEN"),e=>e%2==0)}}iQ.implementedFunctions={ISEVEN:{method:"iseven",parameters:[{argumentType:p.NUMBER}]}};class iZ extends nv{isodd(e,t){return this.runFunction(e.args,t,this.metadata("ISODD"),e=>e%2==1)}}iZ.implementedFunctions={ISODD:{method:"isodd",parameters:[{argumentType:p.NUMBER}]}};class iJ extends nv{log10(e,t){return this.runFunction(e.args,t,this.metadata("LOG10"),Math.log10)}log(e,t){return this.runFunction(e.args,t,this.metadata("LOG"),(e,t)=>Math.log(e)/Math.log(t))}ln(e,t){return this.runFunction(e.args,t,this.metadata("LN"),Math.log)}}iJ.implementedFunctions={LOG10:{method:"log10",parameters:[{argumentType:p.NUMBER}]},LOG:{method:"log",parameters:[{argumentType:p.NUMBER,greaterThan:0},{argumentType:p.NUMBER,defaultValue:10,greaterThan:0}]},LN:{method:"ln",parameters:[{argumentType:p.NUMBER}]}};let i0=parseFloat(Math.PI.toFixed(14));class i1 extends nv{pi(e,t){return this.runFunction(e.args,t,this.metadata("PI"),()=>i0)}sqrtpi(e,t){return this.runFunction(e.args,t,this.metadata("SQRTPI"),e=>Math.sqrt(i0*e))}}function i2(e,t){return new nR(t.width,e.height)}function i3(e,t,r){return new nR(1+(e.width-t)/r,1+(e.height-t)/r)}i1.implementedFunctions={PI:{method:"pi",parameters:[]},SQRTPI:{method:"sqrtpi",parameters:[{argumentType:p.NUMBER,minValue:0}]}};class i6 extends nv{mmult(e,t){return this.runFunction(e.args,t,this.metadata("MMULT"),(e,t)=>{if(!e.hasOnlyNumbers()||!t.hasOnlyNumbers())return new rK(d.VALUE,ej.NumberRange);if(t.height()!==e.width())return new rK(d.VALUE,ej.ArrayDimensions);let r=i2(e.size,t.size),n=this.createKernel(function(e,t,r){let n=0;for(let o=0;o<r;++o)n+=e[this.thread.y][o]*t[o][this.thread.x];return n},r)(e.rawNumbers(),t.rawNumbers(),e.width());return tF.onlyNumbers(n)})}mmultArraySize(e,t){if(2!==e.args.length)return nR.error();let r=this.metadata("MMULT"),[n,o]=e.args.map(e=>{var n;return this.arraySizeForAst(e,new nr(t.formulaAddress,t.arraysFlag||null!=(n=null==r?void 0:r.enableArrayArithmeticForArguments)&&n))});return i2(n,o)}maxpool(e,t){return this.runFunction(e.args,t,this.metadata("MAXPOOL"),(e,t,r=t)=>{if(!e.hasOnlyNumbers())return new rK(d.VALUE,ej.NumberRange);let n=i3(e.size,t,r),o=this.createKernel(function(e,t,r){let n=this.thread.x*r,o=this.thread.y*r,i=e[o][n];for(let r=0;r<t;r++)for(let s=0;s<t;s++)i=Math.max(i,e[o+r][n+s]);return i},n)(e.rawNumbers(),t,r);return tF.onlyNumbers(o)})}medianpool(e,t){return this.runFunction(e.args,t,this.metadata("MEDIANPOOL"),(e,t,r=t)=>{if(!e.hasOnlyNumbers())return new rK(d.VALUE,ej.NumberRange);let n=i3(e.size,t,r),o=this.createKernel(function(e,t,r){let n=this.thread.x*r,o=this.thread.y*r,i=e[o][n];for(let r=0;r<t;r++)for(let s=0;s<t;s++)i=Math.max(i,e[o+r][n+s]);let s=e[o][n];for(let r=0;r<t;r++)for(let i=0;i<t;i++)s=Math.min(s,e[o+r][n+i]);let a=t*t,l=s,h=i,d=42;for(let r=0;r<32;r++){let r=(l+h)/2,i=0;for(let s=0;s<t;s++)for(let a=0;a<t;a++)e[o+s][n+a]>r&&i++;if(t%2==0)if(i===a/2){d=r;break}else i>a/2?l=r:h=r;else if(i===(a-1)/2){d=r;break}else i>(a-1)/2?l=r:h=r}return d},n)(e.rawNumbers(),t,r);return tF.onlyNumbers(o)})}maxpoolArraySize(e,t){let r;if(e.args.length<2||e.args.length>3)return nR.error();let n=this.metadata("MAXPOOL"),i=e.args.map(e=>{var r;return this.arraySizeForAst(e,new nr(t.formulaAddress,t.arraysFlag||null!=(r=null==n?void 0:n.enableArrayArithmeticForArguments)&&r))})[0],s=e.args[1],a=r=s.type===o.NUMBER?s.value:1;if(3===e.args.length){let t=e.args[2];a=t.type===o.NUMBER?t.value:1}return r>i.width||r>i.height||a>r||(i.width-r)%a!=0||(i.height-r)%a!=0?nR.error():i3(i,r,a)}medianpoolArraySize(e,t){return this.maxpoolArraySize(e,t)}transpose(e,t){return this.runFunction(e.args,t,this.metadata("TRANSPOSE"),e=>{let t=e.rawData(),r=e.size,n=[];for(let e=0;e<r.width;++e){n[e]=[];for(let o=0;o<r.height;++o)n[e][o]=t[o][e]}return tF.onlyValues(n)})}transposeArraySize(e,t){if(1!==e.args.length)return nR.error();let r=this.metadata("TRANSPOSE"),[n]=e.args.map(e=>{var n;return this.arraySizeForAst(e,new nr(t.formulaAddress,t.arraysFlag||null!=(n=null==r?void 0:r.enableArrayArithmeticForArguments)&&n))});return new nR(n.height,n.width)}createKernel(e,t){return function(...r){let n=[];for(let o=0;o<t.height;++o){n.push([]);for(let i=0;i<t.width;++i)n[o][i]=e.apply({thread:{x:i,y:o}},r)}return n}}}i6.implementedFunctions={MMULT:{method:"mmult",sizeOfResultArrayMethod:"mmultArraySize",parameters:[{argumentType:p.RANGE},{argumentType:p.RANGE}],vectorizationForbidden:!0},TRANSPOSE:{method:"transpose",sizeOfResultArrayMethod:"transposeArraySize",parameters:[{argumentType:p.RANGE}],vectorizationForbidden:!0},MAXPOOL:{method:"maxpool",sizeOfResultArrayMethod:"maxpoolArraySize",parameters:[{argumentType:p.RANGE},{argumentType:p.NUMBER},{argumentType:p.NUMBER,optionalArg:!0}],vectorizationForbidden:!0},MEDIANPOOL:{method:"medianpool",sizeOfResultArrayMethod:"medianpoolArraySize",parameters:[{argumentType:p.RANGE},{argumentType:p.NUMBER},{argumentType:p.NUMBER,optionalArg:!0}],vectorizationForbidden:!0}};class i5 extends nv{median(e,t){return this.runFunction(e.args,t,this.metadata("MEDIAN"),(...e)=>{let t=this.arithmeticHelper.coerceNumbersExactRanges(e);return t instanceof rK?t:0===t.length?new rK(d.NUM,ej.OneValue):(t.sort((e,t)=>e-t),t.length%2==0)?(t[t.length/2-1]+t[t.length/2])/2:t[Math.floor(t.length/2)]})}large(e,t){return this.runFunction(e.args,t,this.metadata("LARGE"),(e,t)=>{let r=this.arithmeticHelper.manyToExactNumbers(e.valuesFromTopLeftCorner());return r instanceof rK?r:(r.sort((e,t)=>e-t),(t=Math.trunc(t))>r.length)?new rK(d.NUM,ej.ValueLarge):r[r.length-t]})}small(e,t){return this.runFunction(e.args,t,this.metadata("SMALL"),(e,t)=>{let r=this.arithmeticHelper.manyToExactNumbers(e.valuesFromTopLeftCorner());return r instanceof rK?r:(r.sort((e,t)=>e-t),(t=Math.trunc(t))>r.length)?new rK(d.NUM,ej.ValueLarge):r[t-1]})}}i5.implementedFunctions={MEDIAN:{method:"median",parameters:[{argumentType:p.ANY}],repeatLastArgs:1},LARGE:{method:"large",parameters:[{argumentType:p.RANGE},{argumentType:p.NUMBER,minValue:1}]},SMALL:{method:"small",parameters:[{argumentType:p.RANGE},{argumentType:p.NUMBER,minValue:1}]}};class i4 extends nv{mod(e,t){return this.runFunction(e.args,t,this.metadata("MOD"),(e,t)=>0===t?new rK(d.DIV_BY_ZERO):e%t)}}function i9(e,t){let r=e.length,n=t*(r-1),o=Math.floor(n);return o+1<r?e[o]+(n-o)*(e[o+1]-e[o]):e[o]}function i7(e,t){let r=e.length,n=t*(r+1);if(n<1)return new rK(d.NUM,ej.ValueSmall);if(n>r)return new rK(d.NUM,ej.ValueLarge);let o=Math.floor(n);return o<r?e[o-1]+(n-o)*(e[o]-e[o-1]):e[o-1]}i4.implementedFunctions={MOD:{method:"mod",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER}]}};class i8 extends nv{percentile(e,t){return this.runFunction(e.args,t,this.metadata("PERCENTILE.INC"),(e,t)=>{let r=this.getSortedValues(e);return r instanceof rK?r:i9(r,t)})}percentileExc(e,t){return this.runFunction(e.args,t,this.metadata("PERCENTILE.EXC"),(e,t)=>{let r=this.getSortedValues(e);return r instanceof rK?r:i7(r,t)})}quartile(e,t){return this.runFunction(e.args,t,this.metadata("QUARTILE.INC"),(e,t)=>{if((t=Math.trunc(t))<0)return new rK(d.NUM,ej.ValueSmall);if(t>4)return new rK(d.NUM,ej.ValueLarge);let r=this.getSortedValues(e);return r instanceof rK?r:i9(r,t/4)})}quartileExc(e,t){return this.runFunction(e.args,t,this.metadata("QUARTILE.EXC"),(e,t)=>{if((t=Math.trunc(t))<1)return new rK(d.NUM,ej.ValueSmall);if(t>3)return new rK(d.NUM,ej.ValueLarge);let r=this.getSortedValues(e);return r instanceof rK?r:i7(r,t/4)})}getSortedValues(e){let t=this.arithmeticHelper.manyToExactNumbers(e.valuesFromTopLeftCorner());return t instanceof rK?t:0===t.length?new rK(d.NUM,ej.OneValue):(t.sort((e,t)=>e-t),t)}}function se(e){return tP(e)&&!Number.isFinite(tI(e))?0:e}i8.implementedFunctions={"PERCENTILE.INC":{method:"percentile",parameters:[{argumentType:p.RANGE},{argumentType:p.NUMBER,minValue:0,maxValue:1}]},"PERCENTILE.EXC":{method:"percentileExc",parameters:[{argumentType:p.RANGE},{argumentType:p.NUMBER,greaterThan:0,lessThan:1}]},"QUARTILE.INC":{method:"quartile",parameters:[{argumentType:p.RANGE},{argumentType:p.NUMBER}]},"QUARTILE.EXC":{method:"quartileExc",parameters:[{argumentType:p.RANGE},{argumentType:p.NUMBER}]}},i8.aliases={PERCENTILE:"PERCENTILE.INC",QUARTILE:"QUARTILE.INC"};class st{constructor(e,t,r){this.sumsq=e,this.sum=t,this.count=r}static single(e){return new st(e*e,e,1)}compose(e){return new st(this.sumsq+e.sumsq,this.sum+e.sum,this.count+e.count)}averageValue(){return this.count>0?this.sum/this.count:void 0}varSValue(){return this.count>1?(this.sumsq-this.sum*this.sum/this.count)/(this.count-1):void 0}varPValue(){return this.count>0?(this.sumsq-this.sum*this.sum/this.count)/this.count:void 0}}st.empty=new st(0,0,0);class sr extends nv{constructor(){super(...arguments),this.addWithEpsilonRaw=(e,t)=>this.arithmeticHelper.addWithEpsilonRaw(e,t)}sum(e,t){return this.doSum(e.args,t)}sumsq(e,t){return this.reduce(e.args,t,0,"SUMSQ",this.addWithEpsilonRaw,e=>Math.pow(tI(e),2),sn)}max(e,t){return this.doMax(e.args,t)}maxa(e,t){return se(this.reduce(e.args,t,-1/0,"MAXA",(e,t)=>Math.max(e,t),tI,so))}min(e,t){return this.doMin(e.args,t)}mina(e,t){return se(this.reduce(e.args,t,1/0,"MINA",(e,t)=>Math.min(e,t),tI,so))}count(e,t){return this.doCount(e.args,t)}counta(e,t){return this.doCounta(e.args,t)}average(e,t){return this.doAverage(e.args,t)}averagea(e,t){var r;let n=this.reduce(e.args,t,st.empty,"_AGGREGATE_A",(e,t)=>e.compose(t),e=>st.single(tI(e)),so);return n instanceof rK?n:null!=(r=n.averageValue())?r:new rK(d.DIV_BY_ZERO)}vars(e,t){return this.doVarS(e.args,t)}varp(e,t){return this.doVarP(e.args,t)}vara(e,t){var r;let n=this.reduceAggregateA(e.args,t);return n instanceof rK?n:null!=(r=n.varSValue())?r:new rK(d.DIV_BY_ZERO)}varpa(e,t){var r;let n=this.reduceAggregateA(e.args,t);return n instanceof rK?n:null!=(r=n.varPValue())?r:new rK(d.DIV_BY_ZERO)}stdevs(e,t){return this.doStdevS(e.args,t)}stdevp(e,t){return this.doStdevP(e.args,t)}stdeva(e,t){let r=this.reduceAggregateA(e.args,t);if(r instanceof rK)return r;{let e=r.varSValue();return void 0===e?new rK(d.DIV_BY_ZERO):Math.sqrt(e)}}stdevpa(e,t){let r=this.reduceAggregateA(e.args,t);if(r instanceof rK)return r;{let e=r.varPValue();return void 0===e?new rK(d.DIV_BY_ZERO):Math.sqrt(e)}}product(e,t){return this.doProduct(e.args,t)}subtotal(e,t){if(e.args.length<2)return new rK(d.NA,ej.WrongArgNumber);let r=this.coerceToType(this.evaluateAst(e.args[0],t),{argumentType:p.NUMBER},t),n=e.args.slice(1);switch(r){case 1:case 101:return this.doAverage(n,t);case 2:case 102:return this.doCount(n,t);case 3:case 103:return this.doCounta(n,t);case 4:case 104:return this.doMax(n,t);case 5:case 105:return this.doMin(n,t);case 6:case 106:return this.doProduct(n,t);case 7:case 107:return this.doStdevS(n,t);case 8:case 108:return this.doStdevP(n,t);case 9:case 109:return this.doSum(n,t);case 10:case 110:return this.doVarS(n,t);case 11:case 111:return this.doVarP(n,t);default:return new rK(d.VALUE,ej.BadMode)}}reduceAggregate(e,t){return this.reduce(e,t,st.empty,"_AGGREGATE",(e,t)=>e.compose(t),e=>st.single(tI(e)),sn)}reduceAggregateA(e,t){return this.reduce(e,t,st.empty,"_AGGREGATE_A",(e,t)=>e.compose(t),e=>st.single(tI(e)),so)}doAverage(e,t){var r;let n=this.reduceAggregate(e,t);return n instanceof rK?n:null!=(r=n.averageValue())?r:new rK(d.DIV_BY_ZERO)}doVarS(e,t){var r;let n=this.reduceAggregate(e,t);return n instanceof rK?n:null!=(r=n.varSValue())?r:new rK(d.DIV_BY_ZERO)}doVarP(e,t){var r;let n=this.reduceAggregate(e,t);return n instanceof rK?n:null!=(r=n.varPValue())?r:new rK(d.DIV_BY_ZERO)}doStdevS(e,t){let r=this.reduceAggregate(e,t);if(r instanceof rK)return r;{let e=r.varSValue();return void 0===e?new rK(d.DIV_BY_ZERO):Math.sqrt(e)}}doStdevP(e,t){let r=this.reduceAggregate(e,t);if(r instanceof rK)return r;{let e=r.varPValue();return void 0===e?new rK(d.DIV_BY_ZERO):Math.sqrt(e)}}doCount(e,t){return this.reduce(e,t,0,"COUNT",(e,t)=>e+t,tI,e=>+!!tP(e))}doCounta(e,t){return this.reduce(e,t,0,"COUNTA",(e,t)=>e+t,tI,e=>+(e!==tM))}doMax(e,t){return se(this.reduce(e,t,-1/0,"MAX",(e,t)=>Math.max(e,t),tI,sn))}doMin(e,t){return se(this.reduce(e,t,1/0,"MIN",(e,t)=>Math.min(e,t),tI,sn))}doSum(e,t){return this.reduce(e,t,0,"SUM",this.addWithEpsilonRaw,tI,sn)}doProduct(e,t){return this.reduce(e,t,1,"PRODUCT",(e,t)=>e*t,tI,sn)}reduce(e,t,r,n,i,s,a){return e.length<1?new rK(d.NA,ej.WrongArgNumber):e.reduce((e,l)=>{let h;if(e instanceof rK)return e;if(l.type===o.CELL_RANGE||l.type===o.COLUMN_RANGE||l.type===o.ROW_RANGE){let o=this.evaluateRange(l,t,r,n,i,s,a);return o instanceof rK?o:i(o,e)}if((h=this.evaluateAst(l,t))instanceof tF)return Array.from(h.valuesFromTopLeftCorner()).map(a).filter(e=>void 0!==e).map(e=>e instanceof rK?e:s(e)).reduce((e,t)=>e instanceof rK?e:t instanceof rK?t:i(e,t),e);if(l.type===o.CELL_REFERENCE){if(void 0===(h=a(h)))return e}else if(void 0===(h=a(h=this.coerceScalarToNumberOrError(h))))return e;return h instanceof rK?h:i(e,s(h))},r)}evaluateRange(e,t,r,n,o,i,s){let a;try{a=r8.fromAst(e,t.formulaAddress)}catch(e){if(e instanceof t2)return new rK(d.REF,ej.RangeManySheets);throw e}if(!this.isSheetValid(a))return new rK(d.REF,ej.SheetRef);let l=this.dependencyGraph.getRange(a.start,a.end);if(void 0===l)throw Error("Range does not exists in graph");let h=l.getFunctionValue(n);return void 0===h&&(h=this.getRangeValues(n,a,l,i,s).reduce((e,t)=>e instanceof rK?e:t instanceof rK?t:o(e,t),r),l.setFunctionValue(n,h)),h}isSheetValid(e){return this.dependencyGraph.sheetMapping.hasSheetWithId(e.start.sheet,{includePlaceholders:!1})&&this.dependencyGraph.sheetMapping.hasSheetWithId(e.end.sheet,{includePlaceholders:!1})}getRangeValues(e,t,r,n,o){let i,s=[],{smallerRangeVertex:a,restRange:l}=this.dependencyGraph.rangeMapping.findSmallerRange(t);if(void 0!==a&&this.dependencyGraph.existsEdge(a,r)){let t=a.getFunctionValue(e);if(void 0!==t)s.push(t);else for(let e of a.range.addresses(this.dependencyGraph)){let t=o(this.dependencyGraph.getScalarValue(e));t instanceof rK?s.push(t):void 0!==t&&s.push(n(t))}i=l}else i=t;for(let e of i.addresses(this.dependencyGraph)){let t=o(this.dependencyGraph.getScalarValue(e));t instanceof rK?s.push(t):void 0!==t&&s.push(n(t))}return s}}function sn(e){return tP(e)||e instanceof rK?e:void 0}function so(e){return"boolean"==typeof e?na(e):tP(e)||e instanceof rK?e:"string"==typeof e?0:void 0}sr.implementedFunctions={SUM:{method:"sum",parameters:[{argumentType:p.ANY}],repeatLastArgs:1},SUMSQ:{method:"sumsq",parameters:[{argumentType:p.ANY}],repeatLastArgs:1},MAX:{method:"max",parameters:[{argumentType:p.ANY}],repeatLastArgs:1},MIN:{method:"min",parameters:[{argumentType:p.ANY}],repeatLastArgs:1},MAXA:{method:"maxa",parameters:[{argumentType:p.ANY}],repeatLastArgs:1},MINA:{method:"mina",parameters:[{argumentType:p.ANY}],repeatLastArgs:1},COUNT:{method:"count",parameters:[{argumentType:p.ANY}],repeatLastArgs:1},COUNTA:{method:"counta",parameters:[{argumentType:p.ANY}],repeatLastArgs:1},AVERAGE:{method:"average",parameters:[{argumentType:p.ANY}],repeatLastArgs:1},AVERAGEA:{method:"averagea",parameters:[{argumentType:p.ANY}],repeatLastArgs:1},PRODUCT:{method:"product",parameters:[{argumentType:p.ANY}],repeatLastArgs:1},"VAR.S":{method:"vars",parameters:[{argumentType:p.ANY}],repeatLastArgs:1},"VAR.P":{method:"varp",parameters:[{argumentType:p.ANY}],repeatLastArgs:1},VARA:{method:"vara",parameters:[{argumentType:p.ANY}],repeatLastArgs:1},VARPA:{method:"varpa",parameters:[{argumentType:p.ANY}],repeatLastArgs:1},"STDEV.S":{method:"stdevs",parameters:[{argumentType:p.ANY}],repeatLastArgs:1},"STDEV.P":{method:"stdevp",parameters:[{argumentType:p.ANY}],repeatLastArgs:1},STDEVA:{method:"stdeva",parameters:[{argumentType:p.ANY}],repeatLastArgs:1},STDEVPA:{method:"stdevpa",parameters:[{argumentType:p.ANY}],repeatLastArgs:1},SUBTOTAL:{method:"subtotal",parameters:[{argumentType:p.NUMBER},{argumentType:p.ANY}],repeatLastArgs:1}},sr.aliases={VAR:"VAR.S",VARP:"VAR.P",STDEV:"STDEV.S",STDEVP:"STDEV.P",VARS:"VAR.S",STDEVS:"STDEV.S"};class si extends nv{power(e,t){return this.runFunction(e.args,t,this.metadata("POWER"),Math.pow)}}si.implementedFunctions={POWER:{method:"power",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER}]}};class ss extends nv{radians(e,t){return this.runFunction(e.args,t,this.metadata("RADIANS"),e=>Math.PI/180*e)}}ss.implementedFunctions={RADIANS:{method:"radians",parameters:[{argumentType:p.NUMBER}]}};class sa extends nv{dec2bin(e,t){return this.runFunction(e.args,t,this.metadata("DEC2BIN"),(e,t)=>sh(e,2,t))}dec2oct(e,t){return this.runFunction(e.args,t,this.metadata("DEC2OCT"),(e,t)=>sh(e,8,t))}dec2hex(e,t){return this.runFunction(e.args,t,this.metadata("DEC2HEX"),(e,t)=>sh(e,16,t))}bin2dec(e,t){return this.runFunction(e.args,t,this.metadata("BIN2DEC"),e=>{let t=sl(e,2,10);return void 0===t?new rK(d.NUM,ej.NotBinary):sg(t,2)})}bin2oct(e,t){return this.runFunction(e.args,t,this.metadata("BIN2OCT"),(e,t)=>{let r=sl(e,2,10);return void 0===r?new rK(d.NUM,ej.NotBinary):sh(sg(r,2),8,t)})}bin2hex(e,t){return this.runFunction(e.args,t,this.metadata("BIN2HEX"),(e,t)=>{let r=sl(e,2,10);return void 0===r?new rK(d.NUM,ej.NotBinary):sh(sg(r,2),16,t)})}oct2dec(e,t){return this.runFunction(e.args,t,this.metadata("OCT2DEC"),e=>{let t=sl(e,8,10);return void 0===t?new rK(d.NUM,ej.NotOctal):sg(t,8)})}oct2bin(e,t){return this.runFunction(e.args,t,this.metadata("OCT2BIN"),(e,t)=>{let r=sl(e,8,10);return void 0===r?new rK(d.NUM,ej.NotOctal):sh(sg(r,8),2,t)})}oct2hex(e,t){return this.runFunction(e.args,t,this.metadata("OCT2HEX"),(e,t)=>{let r=sl(e,8,10);return void 0===r?new rK(d.NUM,ej.NotOctal):sh(sg(r,8),16,t)})}hex2dec(e,t){return this.runFunction(e.args,t,this.metadata("HEX2DEC"),e=>{let t=sl(e,16,10);return void 0===t?new rK(d.NUM,ej.NotHex):sg(t,16)})}hex2bin(e,t){return this.runFunction(e.args,t,this.metadata("HEX2BIN"),(e,t)=>{let r=sl(e,16,10);return void 0===r?new rK(d.NUM,ej.NotHex):sh(sg(r,16),2,t)})}hex2oct(e,t){return this.runFunction(e.args,t,this.metadata("HEX2OCT"),(e,t)=>{let r=sl(e,16,10);return void 0===r?new rK(d.NUM,ej.NotHex):sh(sg(r,16),8,t)})}base(e,t){return this.runFunction(e.args,t,this.metadata("BASE"),su)}decimal(e,t){return this.runFunction(e.args,t,this.metadata("DECIMAL"),(e,t)=>{let r=sl(e,t,255);return void 0===r?new rK(d.NUM,ej.NotHex):parseInt(r,t)})}}function sl(e,t,r){let n=RegExp(`^[${"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".substr(0,t)}]+$`);if(!(e.length>r)&&n.test(e))return e}function sh(e,t,r){if(e>-sd(t)-1)return new rK(d.NUM,ej.ValueBaseLarge);if(e<sd(t))return new rK(d.NUM,ej.ValueBaseSmall);let n=sc(e,t);return void 0===r||e<0?n:n.length>r?new rK(d.NUM,ej.ValueBaseLong):n3(n,r)}function sd(e){return-Math.pow(e,10)/2}function su(e,t,r){let n=sc(e,t);return void 0!==r&&r>n.length?n3(n,r):n}function sc(e,t){let r=e<0?Math.pow(t,10):0;return(e+r).toString(t).toUpperCase()}function sg(e,t){let r=parseInt(e,t),n=Math.pow(t,10);return r>=n/2?r-n:r}sa.implementedFunctions={DEC2BIN:{method:"dec2bin",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER,optionalArg:!0,minValue:1,maxValue:10}]},DEC2OCT:{method:"dec2oct",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER,optionalArg:!0,minValue:1,maxValue:10}]},DEC2HEX:{method:"dec2hex",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER,optionalArg:!0,minValue:1,maxValue:10}]},BIN2DEC:{method:"bin2dec",parameters:[{argumentType:p.STRING}]},BIN2OCT:{method:"bin2oct",parameters:[{argumentType:p.STRING},{argumentType:p.NUMBER,optionalArg:!0,minValue:0,maxValue:10}]},BIN2HEX:{method:"bin2hex",parameters:[{argumentType:p.STRING},{argumentType:p.NUMBER,optionalArg:!0,minValue:0,maxValue:10}]},OCT2DEC:{method:"oct2dec",parameters:[{argumentType:p.STRING}]},OCT2BIN:{method:"oct2bin",parameters:[{argumentType:p.STRING},{argumentType:p.NUMBER,optionalArg:!0,minValue:0,maxValue:10}]},OCT2HEX:{method:"oct2hex",parameters:[{argumentType:p.STRING},{argumentType:p.NUMBER,optionalArg:!0,minValue:0,maxValue:10}]},HEX2DEC:{method:"hex2dec",parameters:[{argumentType:p.STRING}]},HEX2BIN:{method:"hex2bin",parameters:[{argumentType:p.STRING},{argumentType:p.NUMBER,optionalArg:!0,minValue:0,maxValue:10}]},HEX2OCT:{method:"hex2oct",parameters:[{argumentType:p.STRING},{argumentType:p.NUMBER,optionalArg:!0,minValue:0,maxValue:10}]},DECIMAL:{method:"decimal",parameters:[{argumentType:p.STRING},{argumentType:p.NUMBER,minValue:2,maxValue:36}]},BASE:{method:"base",parameters:[{argumentType:p.NUMBER,minValue:0},{argumentType:p.NUMBER,minValue:2,maxValue:36},{argumentType:p.NUMBER,optionalArg:!0,minValue:0,maxValue:255}]}};class sp extends nv{rand(e,t){return this.runFunction(e.args,t,this.metadata("RAND"),Math.random)}randbetween(e,t){return this.runFunction(e.args,t,this.metadata("RANDBETWEEN"),(e,t)=>t<e?new rK(d.NUM,ej.WrongOrder):((e=Math.ceil(e))===(t=Math.floor(t)+1)&&(t+=1),e+Math.floor(Math.random()*(t-e))))}}sp.implementedFunctions={RAND:{method:"rand",parameters:[],isVolatile:!0},RANDBETWEEN:{method:"randbetween",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER}],isVolatile:!0}};class sm extends nv{static isValidDimension(e){return Number.isFinite(e)&&e>=sm.MIN_DIMENSION}static parseLiteralDimension(e){if(e.type===o.NUMBER)return Math.trunc(e.value);if(e.type===o.STRING){let t=Number(e.value);return Number.isFinite(t)?Math.trunc(t):void 0}if(e.type===o.PLUS_UNARY_OP&&e.value.type===o.NUMBER)return Math.trunc(e.value.value);if(e.type===o.MINUS_UNARY_OP&&e.value.type===o.NUMBER)return Math.trunc(-e.value.value);if(e.type===o.FUNCTION_CALL){if("TRUE"===e.procedureName&&0===e.args.length)return 1;if("FALSE"===e.procedureName&&0===e.args.length)return 0}}sequence(e,t){return this.runFunction(e.args,t,this.metadata("SEQUENCE"),(e,t,r,n)=>{if(!Number.isFinite(e)||!Number.isFinite(t))return new rK(d.VALUE,ej.ValueLarge);if(e<0||t<0)return new rK(d.VALUE,ej.LessThanOne);let o=Math.trunc(e),i=Math.trunc(t);if(!sm.isValidDimension(o)||!sm.isValidDimension(i))return new rK(d.VALUE,ej.LessThanOne);if(o>this.config.maxRows||i>this.config.maxColumns)return new rK(d.VALUE,ej.ValueLarge);let s=[];for(let e=0;e<o;e++){let t=[];for(let o=0;o<i;o++)t.push(r+(e*i+o)*n);s.push(t)}return tF.onlyNumbers(s)})}sequenceArraySize(e,t){if(e.args.length<1||e.args.length>4)return nR.error();let r=e.args[0],n=e.args.length>1?e.args[1]:void 0;if(r.type===o.EMPTY)return nR.error();let i=sm.parseLiteralDimension(r);if(void 0===i)return nR.error();let s=void 0===n||n.type===o.EMPTY?1:sm.parseLiteralDimension(n);return void 0===s||!sm.isValidDimension(i)||!sm.isValidDimension(s)||i>this.config.maxRows||s>this.config.maxColumns?nR.error():new nR(s,i)}}function sf(e){let t=Math.ceil(e);return t%2==1?t:t+1}function sb(e){let t=Math.ceil(e);return t%2==0?t:t+1}sm.MIN_DIMENSION=1,sm.implementedFunctions={SEQUENCE:{method:"sequence",sizeOfResultArrayMethod:"sequenceArraySize",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER,defaultValue:1,emptyAsDefault:!0},{argumentType:p.NUMBER,defaultValue:1,emptyAsDefault:!0},{argumentType:p.NUMBER,defaultValue:1,emptyAsDefault:!0}],vectorizationForbidden:!0}};class sC extends nv{roundup(e,t){return this.runFunction(e.args,t,this.metadata("ROUNDDOWN"),(e,t)=>{let r=Math.pow(10,t);return e<0?-Math.ceil(-e*r)/r:Math.ceil(e*r)/r})}rounddown(e,t){return this.runFunction(e.args,t,this.metadata("ROUNDDOWN"),(e,t)=>{let r=Math.pow(10,t);return e<0?-Math.floor(-e*r)/r:Math.floor(e*r)/r})}round(e,t){return this.runFunction(e.args,t,this.metadata("ROUND"),(e,t)=>{let r=Math.pow(10,t);return e<0?-Math.round(-e*r)/r:Math.round(e*r)/r})}intFunc(e,t){return this.runFunction(e.args,t,this.metadata("INT"),e=>e<0?-Math.floor(-e):Math.floor(e))}even(e,t){return this.runFunction(e.args,t,this.metadata("EVEN"),e=>e<0?-sb(-e):sb(e))}odd(e,t){return this.runFunction(e.args,t,this.metadata("ODD"),e=>e<0?-sf(-e):sf(e))}ceilingmath(e,t){return this.runFunction(e.args,t,this.metadata("CEILING.MATH"),(e,t,r)=>0===t||0===e?0:(t=Math.abs(t),1===r&&e<0&&(t=-t),Math.ceil(e/t)*t))}ceiling(e,t){return this.runFunction(e.args,t,this.metadata("CEILING"),(e,t)=>0===e?0:0===t?new rK(d.DIV_BY_ZERO):e>0&&t<0?new rK(d.NUM,ej.DistinctSigns):Math.ceil(e/t)*t)}ceilingprecise(e,t){return this.runFunction(e.args,t,this.metadata("CEILING.PRECISE"),(e,t)=>0===t||0===e?0:Math.ceil(e/(t=Math.abs(t)))*t)}floormath(e,t){return this.runFunction(e.args,t,this.metadata("FLOOR.MATH"),(e,t,r)=>0===t||0===e?0:(t=Math.abs(t),1===r&&e<0&&(t*=-1),Math.floor(e/t)*t))}floor(e,t){return this.runFunction(e.args,t,this.metadata("FLOOR"),(e,t)=>0===e?0:0===t?new rK(d.DIV_BY_ZERO):e>0&&t<0?new rK(d.NUM,ej.DistinctSigns):Math.floor(e/t)*t)}floorprecise(e,t){return this.runFunction(e.args,t,this.metadata("FLOOR.PRECISE"),(e,t)=>0===t||0===e?0:Math.floor(e/(t=Math.abs(t)))*t)}}sC.implementedFunctions={ROUNDUP:{method:"roundup",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER,defaultValue:0}]},ROUNDDOWN:{method:"rounddown",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER,defaultValue:0}]},ROUND:{method:"round",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER,defaultValue:0}]},INT:{method:"intFunc",parameters:[{argumentType:p.NUMBER}]},EVEN:{method:"even",parameters:[{argumentType:p.NUMBER}]},ODD:{method:"odd",parameters:[{argumentType:p.NUMBER}]},"CEILING.MATH":{method:"ceilingmath",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER,defaultValue:1},{argumentType:p.NUMBER,defaultValue:0}]},CEILING:{method:"ceiling",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER}]},"CEILING.PRECISE":{method:"ceilingprecise",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER,defaultValue:1}]},"FLOOR.MATH":{method:"floormath",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER,defaultValue:1},{argumentType:p.NUMBER,defaultValue:0}]},FLOOR:{method:"floor",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER}]},"FLOOR.PRECISE":{method:"floorprecise",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER,defaultValue:1}]}},sC.aliases={"ISO.CEILING":"CEILING.PRECISE",TRUNC:"ROUNDDOWN"};class sy extends nv{sqrt(e,t){return this.runFunction(e.args,t,this.metadata("SQRT"),Math.sqrt)}}sy.implementedFunctions={SQRT:{method:"sqrt",parameters:[{argumentType:p.NUMBER}]}};class sw{constructor(e,t,r,n,o){this.interpreter=e,this.cacheKey=t,this.reduceInitialValue=r,this.composeFunction=n,this.mapFunction=o,this.dependencyGraph=this.interpreter.dependencyGraph}compute(e,t){for(let r of t)if(!r.conditionRange.sameDimensionsAs(e))return new rK(d.VALUE,ej.EqualLength);let r=this.tryToGetRangeVertexForRangeValue(e),n=t.map(e=>this.tryToGetRangeVertexForRangeValue(e.conditionRange));if(!(r&&n.every(e=>void 0!==e)))return this.evaluateRangeValue(e,t);{let o=t.map(e=>e.criterionPackage.raw).join(","),i=this.findAlreadyComputedValueInCache(r,this.cacheKey(t),o);if(void 0!==i)return this.interpreter.stats.incrementCriterionFunctionFullCacheUsed(),i;let s=this.buildNewCriterionCache(this.cacheKey(t),t.map(e=>e.conditionRange.range),e.range);return s.has(o)||s.set(o,[this.evaluateRangeValue(e,t),t.map(e=>e.criterionPackage.lambda)]),r.setCriterionFunctionValues(this.cacheKey(t),s),n.forEach(e=>{void 0!==e&&e.addDependentCacheRange(r)}),s.get(o)[0]}}tryToGetRangeVertexForRangeValue(e){let t=e.range;if(void 0!==t)return this.dependencyGraph.getRange(t.start,t.end)}reduceFunction(e){let t=this.reduceInitialValue;for(let r of e)t=this.composeFunction(t,r);return t}findAlreadyComputedValueInCache(e,t,r){return e.getCriterionFunctionValue(t,r)}evaluateRangeValue(e,t){let r=t.map(e=>e.criterionPackage.lambda),n=Array.from(e.valuesFromTopLeftCorner()).map(this.mapFunction)[Symbol.iterator](),o=sR(r,t.map(e=>e.conditionRange.iterateValuesFromTopLeftCorner()),n);return this.reduceFunction(o)}buildNewCriterionCache(e,t,r){let n,o=this.dependencyGraph.getRange(r.start,r.end),{smallerRangeVertex:i,restConditionRanges:s,restValuesRange:a}=((e,t,r)=>{if(r.end.row>r.start.row){let n=r0(r.end.sheet,r.end.col,r.end.row-1),o=e.getRange(r.start,n);if(void 0!==o)return{smallerRangeVertex:o,restValuesRange:r.withStart(r0(r.start.sheet,r.start.col,r.end.row)),restConditionRanges:t.map(e=>e.withStart(r0(e.start.sheet,e.start.col,e.end.row)))}}return{restValuesRange:r,restConditionRanges:t}})(this.dependencyGraph,t,r);n=void 0!==i&&this.dependencyGraph.existsEdge(i,o)?i.getCriterionFunctionValues(e):new Map;let l=new Map;return n.forEach(([e,t],r)=>{let n=sR(t,s.map(e=>sv(this.dependencyGraph,e)),Array.from(sv(this.dependencyGraph,a)).map(this.mapFunction)[Symbol.iterator]()),o=this.composeFunction(e,this.reduceFunction(n));this.interpreter.stats.incrementCriterionFunctionPartialCacheUsed(),l.set(r,[o,t])}),l}}class sS{constructor(e,t){this.conditionRange=e,this.criterionPackage=t}}function*sv(e,t){for(let r of t.addresses(e))yield tI(e.getScalarValue(r))}function*sR(e,t,r){for(let n of r){let r=t.map(e=>(function(e){let t=e[Symbol.iterator](),{done:r,value:n}=t.next();return r?{rest:function*(){}()}:{value:n,rest:t}})(e));if(!r.every(e=>Object.prototype.hasOwnProperty.call(e,"value")))return;(function(e,t){let r=[];for(let n=0;n<Math.min(e.length,t.length);n++)r.push([e[n],t[n]]);return r})(r.map(e=>tI(e.value)),e).every(([e,t])=>t(e))&&(yield n),t=r.map(e=>e.rest)}}class sE{constructor(e,t){this.sum=e,this.count=t}static single(e){return new sE(e,1)}compose(e){return new sE(this.sum+e.sum,this.count+e.count)}averageValue(){return this.count>0?this.sum/this.count:void 0}}function sT(e){return tP(e)&&!Number.isFinite(tI(e))?0:e}function sA(e){return e instanceof rK?e:tP(e)?tI(e):void 0}sE.empty=new sE(0,0);class sM extends nv{sumif(e,t){let r="SUMIF",n=(e,t,n)=>this.computeConditionalAggregationFunction(null!=n?n:e,[e,t],r,0,(e,t)=>this.arithmeticHelper.nonstrictadd(e,t),sA);return this.runFunction(e.args,t,this.metadata(r),n)}sumifs(e,t){let r="SUMIFS",n=(e,...t)=>this.computeConditionalAggregationFunction(e,t,r,0,(e,t)=>this.arithmeticHelper.nonstrictadd(e,t),sA);return this.runFunction(e.args,t,this.metadata(r),n)}averageif(e,t){let r="AVERAGEIF",n=(e,t,n)=>{let o=this.computeConditionalAggregationFunction(null!=n?n:e,[e,t],r,sE.empty,(e,t)=>e.compose(t),e=>tP(e)?sE.single(tI(e)):sE.empty);return o instanceof rK?o:o.averageValue()||new rK(d.DIV_BY_ZERO)};return this.runFunction(e.args,t,this.metadata(r),n)}countif(e,t){let r="COUNTIF",n=(e,t)=>this.computeConditionalAggregationFunction(e,[e,t],r,0,(e,t)=>e+t,()=>1);return this.runFunction(e.args,t,this.metadata(r),n)}countifs(e,t){let r="COUNTIFS",n=(...e)=>this.computeConditionalAggregationFunction(e[0],e,r,0,(e,t)=>e+t,()=>1);return this.runFunction(e.args,t,this.metadata(r),n)}minifs(e,t){let r="MINIFS",n=(e,t)=>void 0===t||void 0===e?void 0===t?e:t:Math.min(e,t),o=(e,...t)=>sT(this.computeConditionalAggregationFunction(e,t,r,1/0,n,sA));return this.runFunction(e.args,t,this.metadata(r),o)}maxifs(e,t){let r="MAXIFS",n=(e,t)=>void 0===t||void 0===e?void 0===t?e:t:Math.max(e,t),o=(e,...t)=>sT(this.computeConditionalAggregationFunction(e,t,r,-1/0,n,sA));return this.runFunction(e.args,t,this.metadata(r),o)}computeConditionalAggregationFunction(e,t,r,n,o,i){let s=[];for(let e=0;e<t.length;e+=2){let r=t[e],n=this.interpreter.criterionBuilder.fromCellValue(t[e+1],this.arithmeticHelper);if(void 0===n)return new rK(d.VALUE,ej.BadCriterion);s.push(new sS(r,n))}return new sw(this.interpreter,e=>[r,...e.map(e=>`${e.conditionRange.range.sheet},${e.conditionRange.range.start.col},${e.conditionRange.range.start.row}`)].join(","),n,o,i).compute(e,s)}}sM.implementedFunctions={SUMIF:{method:"sumif",parameters:[{argumentType:p.RANGE},{argumentType:p.NOERROR},{argumentType:p.RANGE,optionalArg:!0}]},COUNTIF:{method:"countif",parameters:[{argumentType:p.RANGE},{argumentType:p.NOERROR}]},AVERAGEIF:{method:"averageif",parameters:[{argumentType:p.RANGE},{argumentType:p.NOERROR},{argumentType:p.RANGE,optionalArg:!0}]},SUMIFS:{method:"sumifs",parameters:[{argumentType:p.RANGE},{argumentType:p.RANGE},{argumentType:p.NOERROR}],repeatLastArgs:2},COUNTIFS:{method:"countifs",parameters:[{argumentType:p.RANGE},{argumentType:p.NOERROR}],repeatLastArgs:2},MINIFS:{method:"minifs",parameters:[{argumentType:p.RANGE},{argumentType:p.RANGE},{argumentType:p.NOERROR}],repeatLastArgs:2},MAXIFS:{method:"maxifs",parameters:[{argumentType:p.RANGE},{argumentType:p.RANGE},{argumentType:p.NOERROR}],repeatLastArgs:2}};class sI extends nv{sumproduct(e,t){return this.runFunction(e.args,t,this.metadata("SUMPRODUCT"),(...e)=>{let t=e[0].width(),r=e[0].height();for(let n of e)if(n.width()!==t||n.height()!==r)return new rK(d.VALUE,ej.EqualLength);let n=0,o=e.map(e=>e.iterateValuesFromTopLeftCorner());for(let e=0;e<t*r;e++){let e=1;for(let t of o){let r=t.next().value;if(r instanceof rK)return r;let n=this.coerceScalarToNumberOrError(r);tP(n)?e*=tI(n):e=0}n+=e}return n})}}sI.implementedFunctions={SUMPRODUCT:{method:"sumproduct",parameters:[{argumentType:p.RANGE}],repeatLastArgs:1}};class sx extends nv{concatenate(e,t){return this.runFunction(e.args,t,this.metadata("CONCATENATE"),(...e)=>"".concat(...e))}split(e,t){return this.runFunction(e.args,t,this.metadata("SPLIT"),(e,t)=>{let r=e.split(" ");return t>=r.length||t<0?new rK(d.VALUE,ej.IndexBounds):r[t]})}len(e,t){return this.runFunction(e.args,t,this.metadata("LEN"),e=>e.length)}lower(e,t){return this.runFunction(e.args,t,this.metadata("LOWER"),e=>e.toLowerCase())}trim(e,t){return this.runFunction(e.args,t,this.metadata("TRIM"),e=>e.replace(/^ +/g,"").replace(/ +$/g,"").replace(/ +/g," "))}proper(e,t){return this.runFunction(e.args,t,this.metadata("PROPER"),e=>e.replace(/\p{L}+/gu,e=>e.charAt(0).toUpperCase()+e.substring(1).toLowerCase()))}clean(e,t){return this.runFunction(e.args,t,this.metadata("CLEAN"),e=>e.replace(/[\u0000-\u001F]/g,""))}exact(e,t){return this.runFunction(e.args,t,this.metadata("EXACT"),(e,t)=>e===t)}rept(e,t){return this.runFunction(e.args,t,this.metadata("REPT"),(e,t)=>t<0?new rK(d.VALUE,ej.NegativeCount):e.repeat(t))}right(e,t){return this.runFunction(e.args,t,this.metadata("RIGHT"),(e,t)=>t<0?new rK(d.VALUE,ej.NegativeLength):0===t?"":e.slice(-t))}left(e,t){return this.runFunction(e.args,t,this.metadata("LEFT"),(e,t)=>t<0?new rK(d.VALUE,ej.NegativeLength):e.slice(0,t))}mid(e,t){return this.runFunction(e.args,t,this.metadata("MID"),(e,t,r)=>t<1?new rK(d.VALUE,ej.LessThanOne):r<0?new rK(d.VALUE,ej.NegativeLength):e.substring(t-1,t+r-1))}replace(e,t){return this.runFunction(e.args,t,this.metadata("REPLACE"),(e,t,r,n)=>t<1?new rK(d.VALUE,ej.LessThanOne):r<0?new rK(d.VALUE,ej.NegativeLength):e.substring(0,t-1)+n+e.substring(t+r-1))}search(e,t){return this.runFunction(e.args,t,this.metadata("SEARCH"),(e,t,r)=>{if(r<1||r>t.length)return new rK(d.VALUE,ej.LengthBounds);let n=e.toLowerCase(),o=t.substring(r-1).toLowerCase(),i=this.arithmeticHelper.requiresRegex(n)?this.arithmeticHelper.searchString(n,o):o.indexOf(n);return i>-1?i+r:new rK(d.VALUE,ej.PatternNotFound)})}substitute(e,t){return this.runFunction(e.args,t,this.metadata("SUBSTITUTE"),(e,t,r,n)=>{let o,i=RegExp(this.escapeRegExpSpecialCharacters(t),"g");if(void 0===n)return e.replace(i,r);if(n<1)return new rK(d.VALUE,ej.LessThanOne);let s=0;for(;null!==(o=i.exec(e));)if(n===++s)return e.substring(0,o.index)+r+e.substring(i.lastIndex);return e})}find(e,t){return this.runFunction(e.args,t,this.metadata("FIND"),(e,t,r)=>{if(r<1||r>t.length)return new rK(d.VALUE,ej.IndexBounds);let n=t.substring(r-1).indexOf(e)+r;return n>0?n:new rK(d.VALUE,ej.PatternNotFound)})}t(e,t){return this.runFunction(e.args,t,this.metadata("T"),e=>e instanceof rK||"string"==typeof e?e:"")}n(e,t){return this.runFunction(e.args,t,this.metadata("N"),e=>{var t;let r=e instanceof tF?null==(t=e.data[0])?void 0:t[0]:e;return r instanceof rK||"number"==typeof r?r:"boolean"==typeof r?+!!r:0})}upper(e,t){return this.runFunction(e.args,t,this.metadata("UPPER"),e=>e.toUpperCase())}value(e,t){return this.runFunction(e.args,t,this.metadata("VALUE"),e=>{if(e instanceof rK||tP(e))return e;if("string"!=typeof e)return new rK(d.VALUE,ej.NumberCoercion);let t=e.trim(),r=/^\(([^()]+)\)$/.exec(t);if(r){let e=this.parseStringToNumber(r[1]);if(void 0!==e)return-e}let n=this.parseStringToNumber(t);return void 0!==n?n:new rK(d.VALUE,ej.NumberCoercion)})}textjoin(e,t){return this.runFunction(e.args,t,this.metadata("TEXTJOIN"),(e,t,...r)=>{let n=this.flattenArgToStrings(e);if(n instanceof rK)return n;let o=[];for(let e of r){let t=this.flattenArgToStrings(e);if(t instanceof rK)return t;o.push(...t)}let i=t?o.filter(e=>""!==e):o;if(0===i.length)return"";let s=i.reduce((e,t,r)=>0===r?t:e+n[(r-1)%n.length]+t,"");return s.length>32767?new rK(d.VALUE,ej.ResultTooLong):s})}flattenArgToStrings(e){let t=e instanceof tF?e.valuesFromTopLeftCorner():[e],r=[];for(let e of t){if(e instanceof rK)return e;let t=nd(e);if(t instanceof rK)return t;r.push(t)}return r}parseStringToNumber(e){let t=e.trim();if(""!==t)return this.arithmeticHelper.coerceToMaybeNumber(t)}escapeRegExpSpecialCharacters(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}}sx.implementedFunctions={CONCATENATE:{method:"concatenate",parameters:[{argumentType:p.STRING}],repeatLastArgs:1,expandRanges:!0},EXACT:{method:"exact",parameters:[{argumentType:p.STRING},{argumentType:p.STRING}]},SPLIT:{method:"split",parameters:[{argumentType:p.STRING},{argumentType:p.NUMBER}]},LEN:{method:"len",parameters:[{argumentType:p.STRING}]},LOWER:{method:"lower",parameters:[{argumentType:p.STRING}]},MID:{method:"mid",parameters:[{argumentType:p.STRING},{argumentType:p.NUMBER},{argumentType:p.NUMBER}]},TRIM:{method:"trim",parameters:[{argumentType:p.STRING}]},T:{method:"t",parameters:[{argumentType:p.SCALAR}]},N:{method:"n",parameters:[{argumentType:p.ANY}]},PROPER:{method:"proper",parameters:[{argumentType:p.STRING}]},CLEAN:{method:"clean",parameters:[{argumentType:p.STRING}]},REPT:{method:"rept",parameters:[{argumentType:p.STRING},{argumentType:p.NUMBER}]},RIGHT:{method:"right",parameters:[{argumentType:p.STRING},{argumentType:p.NUMBER,defaultValue:1}]},LEFT:{method:"left",parameters:[{argumentType:p.STRING},{argumentType:p.NUMBER,defaultValue:1}]},REPLACE:{method:"replace",parameters:[{argumentType:p.STRING},{argumentType:p.NUMBER},{argumentType:p.NUMBER},{argumentType:p.STRING}]},SEARCH:{method:"search",parameters:[{argumentType:p.STRING},{argumentType:p.STRING},{argumentType:p.NUMBER,defaultValue:1}]},SUBSTITUTE:{method:"substitute",parameters:[{argumentType:p.STRING},{argumentType:p.STRING},{argumentType:p.STRING},{argumentType:p.NUMBER,optionalArg:!0}]},FIND:{method:"find",parameters:[{argumentType:p.STRING},{argumentType:p.STRING},{argumentType:p.NUMBER,defaultValue:1}]},UPPER:{method:"upper",parameters:[{argumentType:p.STRING}]},VALUE:{method:"value",parameters:[{argumentType:p.SCALAR}]},TEXTJOIN:{method:"textjoin",repeatLastArgs:1,parameters:[{argumentType:p.ANY},{argumentType:p.BOOLEAN},{argumentType:p.ANY}]}};class sN extends nv{acos(e,t){return this.runFunction(e.args,t,this.metadata("ACOS"),Math.acos)}asin(e,t){return this.runFunction(e.args,t,this.metadata("ASIN"),Math.asin)}cos(e,t){return this.runFunction(e.args,t,this.metadata("COS"),Math.cos)}sin(e,t){return this.runFunction(e.args,t,this.metadata("SIN"),Math.sin)}tan(e,t){return this.runFunction(e.args,t,this.metadata("TAN"),Math.tan)}atan(e,t){return this.runFunction(e.args,t,this.metadata("ATAN"),Math.atan)}atan2(e,t){return this.runFunction(e.args,t,this.metadata("ATAN2"),(e,t)=>0===e&&0===t?new rK(d.DIV_BY_ZERO):Math.atan2(t,e))}cot(e,t){return this.runFunction(e.args,t,this.metadata("COT"),e=>0===e?new rK(d.DIV_BY_ZERO):1/Math.tan(e))}acot(e,t){return this.runFunction(e.args,t,this.metadata("ACOT"),e=>0===e?i0/2:Math.atan(1/e))}sec(e,t){return this.runFunction(e.args,t,this.metadata("SEC"),e=>1/Math.cos(e))}csc(e,t){return this.runFunction(e.args,t,this.metadata("CSC"),e=>0===e?new rK(d.DIV_BY_ZERO):1/Math.sin(e))}sinh(e,t){return this.runFunction(e.args,t,this.metadata("SINH"),Math.sinh)}asinh(e,t){return this.runFunction(e.args,t,this.metadata("ASINH"),Math.asinh)}cosh(e,t){return this.runFunction(e.args,t,this.metadata("COSH"),Math.cosh)}acosh(e,t){return this.runFunction(e.args,t,this.metadata("ACOSH"),Math.acosh)}tanh(e,t){return this.runFunction(e.args,t,this.metadata("TANH"),Math.tanh)}atanh(e,t){return this.runFunction(e.args,t,this.metadata("ATANH"),Math.atanh)}coth(e,t){return this.runFunction(e.args,t,this.metadata("COTH"),e=>0===e?new rK(d.DIV_BY_ZERO):1/Math.tanh(e))}acoth(e,t){return this.runFunction(e.args,t,this.metadata("ACOTH"),e=>0===e?new rK(d.NUM,ej.NonZero):Math.atanh(1/e))}sech(e,t){return this.runFunction(e.args,t,this.metadata("SECH"),e=>1/Math.cosh(e))}csch(e,t){return this.runFunction(e.args,t,this.metadata("CSCH"),e=>0===e?new rK(d.DIV_BY_ZERO):1/Math.sinh(e))}}sN.implementedFunctions={ACOS:{method:"acos",parameters:[{argumentType:p.NUMBER}]},ASIN:{method:"asin",parameters:[{argumentType:p.NUMBER}]},COS:{method:"cos",parameters:[{argumentType:p.NUMBER}]},SIN:{method:"sin",parameters:[{argumentType:p.NUMBER}]},TAN:{method:"tan",parameters:[{argumentType:p.NUMBER}]},ATAN:{method:"atan",parameters:[{argumentType:p.NUMBER}]},ATAN2:{method:"atan2",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER}]},COT:{method:"cot",parameters:[{argumentType:p.NUMBER}]},SEC:{method:"sec",parameters:[{argumentType:p.NUMBER}]},CSC:{method:"csc",parameters:[{argumentType:p.NUMBER}]},SINH:{method:"sinh",parameters:[{argumentType:p.NUMBER}]},COSH:{method:"cosh",parameters:[{argumentType:p.NUMBER}]},TANH:{method:"tanh",parameters:[{argumentType:p.NUMBER}]},COTH:{method:"coth",parameters:[{argumentType:p.NUMBER}]},SECH:{method:"sech",parameters:[{argumentType:p.NUMBER}]},CSCH:{method:"csch",parameters:[{argumentType:p.NUMBER}]},ACOT:{method:"acot",parameters:[{argumentType:p.NUMBER}]},ASINH:{method:"asinh",parameters:[{argumentType:p.NUMBER}]},ACOSH:{method:"acosh",parameters:[{argumentType:p.NUMBER}]},ATANH:{method:"atanh",parameters:[{argumentType:p.NUMBER}]},ACOTH:{method:"acoth",parameters:[{argumentType:p.NUMBER}]}};class sO extends io{constructor(e){super(e),this.dependencyGraph=e}find(e,t,r){return this.basicFind(e,t,"col",r)}}class sk extends nv{constructor(){super(...arguments),this.rowSearch=new sO(this.dependencyGraph)}vlookup(e,t){return this.runFunction(e.args,t,this.metadata("VLOOKUP"),(e,t,r,n)=>{let o=t.range;return void 0===o?new rK(d.VALUE,ej.WrongType):r<1?new rK(d.VALUE,ej.LessThanOne):r>o.width()?new rK(d.REF,ej.IndexLarge):this.doVlookup(nu(e),t,r-1,{ordering:n?"asc":"none",ifNoMatch:n?"returnLowerBound":"returnNotFound"})})}hlookup(e,t){return this.runFunction(e.args,t,this.metadata("HLOOKUP"),(e,t,r,n)=>{let o=t.range;return void 0===o?new rK(d.VALUE,ej.WrongType):r<1?new rK(d.VALUE,ej.LessThanOne):r>o.height()?new rK(d.REF,ej.IndexLarge):this.doHlookup(nu(e),t,r-1,{ordering:n?"asc":"none",ifNoMatch:n?"returnLowerBound":"returnNotFound"})})}xlookup(e,t){return this.runFunction(e.args,t,this.metadata("XLOOKUP"),(e,t,r,n,o,i)=>{if(![0,-1,1,2].includes(o)||![1,-1,2,-2].includes(i))return new rK(d.VALUE,ej.BadMode);let s=t instanceof tF?t:tF.fromScalar(t),a=r instanceof tF?r:tF.fromScalar(r);return this.doXlookup(nu(e),s,a,n,2===o,{ordering:2===i?"asc":-2===i?"desc":"none",returnOccurrence:-1===i?"last":"first",ifNoMatch:-1===o?"returnLowerBound":1===o?"returnUpperBound":"returnNotFound"})})}xlookupArraySize(e){var t,r;let n=null==(t=null==e?void 0:e.args)?void 0:t[1],o=null==(r=null==e?void 0:e.args)?void 0:r[2];if((null==n?void 0:n.start)==null||(null==n?void 0:n.end)==null||(null==o?void 0:o.start)==null||(null==o?void 0:o.end)==null)return nR.error();let i=n.end.row-n.start.row+1,s=n.end.col-n.start.col+1,a=o.end.row-o.start.row+1,l=o.end.col-o.start.col+1,h=1===s&&a===i,d=1===i&&l===s;return h||d?h?new nR(l,1):new nR(1,a):nR.error()}match(e,t){return this.runFunction(e.args,t,this.metadata("MATCH"),(e,t,r)=>this.doMatch(nu(e),t,r))}searchInRange(e,t,r,n,o){return r&&"string"==typeof e&&this.arithmeticHelper.requiresRegex(e)?o.advancedFind(this.arithmeticHelper.eqMatcherFunction(e),t,{returnOccurrence:n.returnOccurrence}):o.find(e,t,n)}doVlookup(e,t,r,n){let o,i;this.dependencyGraph.stats.start(a.VLOOKUP);let s=t.range;o=void 0===s?tF.onlyValues(t.data.map(e=>[e[0]])):tF.onlyRange(r8.spanFrom(s.start,1,s.height()),this.dependencyGraph);let l=this.searchInRange(e,o,"none"===n.ordering,n,this.columnSearch);if(this.dependencyGraph.stats.end(a.VLOOKUP),-1===l)return new rK(d.NA,ej.ValueNotFound);if(void 0===s)i=t.data[l][r];else{let e=r0(s.sheet,s.start.col+r,s.start.row+l);i=this.dependencyGraph.getCellValue(e)}return i instanceof tF?new rK(d.VALUE,ej.WrongType):i}doHlookup(e,t,r,n){let o,i,s=t.range;o=void 0===s?tF.onlyValues([t.data[0]]):tF.onlyRange(r8.spanFrom(s.start,s.width(),1),this.dependencyGraph);let a=this.searchInRange(e,o,"none"===n.ordering,n,this.rowSearch);if(-1===a)return new rK(d.NA,ej.ValueNotFound);if(void 0===s)i=t.data[r][a];else{let e=r0(s.sheet,s.start.col+a,s.start.row+r);i=this.dependencyGraph.getCellValue(e)}return i instanceof tF?new rK(d.VALUE,ej.WrongType):i}doXlookup(e,t,r,n,o,i){let s=1===t.width()&&r.height()===t.height(),a=1===t.height()&&r.width()===t.width();if(!s&&!a)return new rK(d.VALUE,ej.WrongDimension);let l=s?this.columnSearch:this.rowSearch,h=this.searchInRange(e,t,o,i,l);if(-1===h)return n==d.NA?new rK(d.NA,ej.ValueNotFound):n;let u=s?[r.data[h]]:r.data.map(e=>[e[h]]);return tF.onlyValues(u)}doMatch(e,t,r){if(![-1,0,1].includes(r))return new rK(d.VALUE,ej.BadMode);if(t.width()>1&&t.height()>1)return new rK(d.NA);let n=(1===t.width()?this.columnSearch:this.rowSearch).find(e,t,0===r?{ordering:"none",ifNoMatch:"returnNotFound"}:{ordering:-1===r?"desc":"asc",ifNoMatch:-1===r?"returnUpperBound":"returnLowerBound"});return -1===n?new rK(d.NA,ej.ValueNotFound):n+1}}sk.implementedFunctions={VLOOKUP:{method:"vlookup",parameters:[{argumentType:p.NOERROR},{argumentType:p.RANGE},{argumentType:p.NUMBER},{argumentType:p.BOOLEAN,defaultValue:!0}]},HLOOKUP:{method:"hlookup",parameters:[{argumentType:p.NOERROR},{argumentType:p.RANGE},{argumentType:p.NUMBER},{argumentType:p.BOOLEAN,defaultValue:!0}]},XLOOKUP:{method:"xlookup",sizeOfResultArrayMethod:"xlookupArraySize",parameters:[{argumentType:p.NOERROR},{argumentType:p.RANGE},{argumentType:p.RANGE},{argumentType:p.SCALAR,optionalArg:!0,defaultValue:d.NA},{argumentType:p.NUMBER,optionalArg:!0,defaultValue:0},{argumentType:p.NUMBER,optionalArg:!0,defaultValue:1}]},MATCH:{method:"match",parameters:[{argumentType:p.NOERROR},{argumentType:p.RANGE},{argumentType:p.NUMBER,defaultValue:1}]}};class sH extends nv{roman(e,t){return this.runFunction(e.args,t,this.metadata("ROMAN"),(e,t)=>{var r,n;let o;return(e=Math.trunc(e),!1===t?t=4:!0===t&&(t=0),(t=tI(this.coerceScalarToNumberOrError(t)))instanceof rK)?t:(t=Math.trunc(t))<0?new rK(d.VALUE,ej.ValueSmall):t>4?new rK(d.VALUE,ej.ValueLarge):(r=e,n=t,o={val:r%1e3,acc:"M".repeat(Math.floor(r/1e3))},4===n&&(sL(o,"IM",999,1e3),sL(o,"ID",499,500)),n>=3&&(sL(o,"VM",995,1e3),sL(o,"VD",495,500)),n>=2&&(sL(o,"XM",990,1e3),sL(o,"XD",490,500)),n>=1&&(sL(o,"LM",950,1e3),sL(o,"LD",450,500)),sL(o,"CM",900,1e3),sL(o,"CD",400,500),sL(o,"D",500,900),o.acc+="C".repeat(Math.floor(o.val/100)),o.val%=100,n>=2&&(sL(o,"IC",99,100),sL(o,"IL",49,50)),n>=1&&(sL(o,"VC",95,100),sL(o,"VL",45,50)),sL(o,"XC",90,100),sL(o,"XL",40,50),sL(o,"L",50,90),o.acc+="X".repeat(Math.floor(o.val/10)),o.val%=10,sL(o,"IX",9,10),sL(o,"IV",4,5),sL(o,"V",5,9),o.acc+="I".repeat(o.val),o.acc)})}arabic(e,t){return this.runFunction(e.args,t,this.metadata("ARABIC"),e=>{e=e.trim().toUpperCase();let t=!1;if(e.startsWith("-")&&(e=e.slice(1),t=!0,""===e))return new rK(d.VALUE,ej.InvalidRoman);let r={input:e,acc:0};return(s_(r,{token:"MMM",val:3e3},{token:"MM",val:2e3},{token:"M",val:1e3}),s_(r,{token:"IM",val:999},{token:"VM",val:995},{token:"XM",val:990},{token:"LM",val:950},{token:"CM",val:900}),s_(r,{token:"D",val:500},{token:"ID",val:499},{token:"VD",val:495},{token:"XD",val:490},{token:"LD",val:450},{token:"CD",val:400}),s_(r,{token:"CCC",val:300},{token:"CC",val:200},{token:"C",val:100}),s_(r,{token:"IC",val:99},{token:"VC",val:95},{token:"XC",val:90}),s_(r,{token:"L",val:50},{token:"IL",val:49},{token:"VL",val:45},{token:"XL",val:40}),s_(r,{token:"XXX",val:30},{token:"XX",val:20},{token:"X",val:10}),s_(r,{token:"IX",val:9}),s_(r,{token:"V",val:5},{token:"IV",val:4}),s_(r,{token:"III",val:3},{token:"II",val:2},{token:"I",val:1}),""!==r.input)?new rK(d.VALUE,ej.InvalidRoman):t?-r.acc:r.acc})}}function s_(e,...t){for(let r of t)if(e.input.startsWith(r.token)){e.input=e.input.slice(r.token.length),e.acc+=r.val;break}}function sL(e,t,r,n){e.val>=r&&e.val<n&&(e.val-=r,e.acc+=t)}sH.implementedFunctions={ROMAN:{method:"roman",parameters:[{argumentType:p.NUMBER,minValue:1,lessThan:4e3},{argumentType:p.NOERROR,optionalArg:!0,defaultValue:0}]},ARABIC:{method:"arabic",parameters:[{argumentType:p.STRING}]}};class sP extends nv{add(e,t){return this.runFunction(e.args,t,this.metadata("HF.ADD"),this.arithmeticHelper.addWithEpsilon)}concat(e,t){return this.runFunction(e.args,t,this.metadata("HF.CONCAT"),this.arithmeticHelper.concat)}divide(e,t){return this.runFunction(e.args,t,this.metadata("HF.DIVIDE"),this.arithmeticHelper.divide)}eq(e,t){return this.runFunction(e.args,t,this.metadata("HF.EQ"),this.arithmeticHelper.eq)}gt(e,t){return this.runFunction(e.args,t,this.metadata("HF.GT"),this.arithmeticHelper.gt)}gte(e,t){return this.runFunction(e.args,t,this.metadata("HF.GTE"),this.arithmeticHelper.geq)}lt(e,t){return this.runFunction(e.args,t,this.metadata("HF.LT"),this.arithmeticHelper.lt)}lte(e,t){return this.runFunction(e.args,t,this.metadata("HF.LTE"),this.arithmeticHelper.leq)}minus(e,t){return this.runFunction(e.args,t,this.metadata("HF.MINUS"),this.arithmeticHelper.subtract)}multiply(e,t){return this.runFunction(e.args,t,this.metadata("HF.MULTIPLY"),this.arithmeticHelper.multiply)}ne(e,t){return this.runFunction(e.args,t,this.metadata("HF.NE"),this.arithmeticHelper.neq)}pow(e,t){return this.runFunction(e.args,t,this.metadata("HF.POW"),this.arithmeticHelper.pow)}uminus(e,t){return this.runFunction(e.args,t,this.metadata("HF.UMINUS"),this.arithmeticHelper.unaryMinus)}upercent(e,t){return this.runFunction(e.args,t,this.metadata("HF.UNARY_PERCENT"),this.arithmeticHelper.unaryPercent)}uplus(e,t){return this.runFunction(e.args,t,this.metadata("HF.UPLUS"),this.arithmeticHelper.unaryPlus)}}sP.implementedFunctions={"HF.ADD":{method:"add",parameters:[{argumentType:p.NUMBER,passSubtype:!0},{argumentType:p.NUMBER,passSubtype:!0}]},"HF.CONCAT":{method:"concat",parameters:[{argumentType:p.STRING,passSubtype:!0},{argumentType:p.STRING,passSubtype:!0}]},"HF.DIVIDE":{method:"divide",parameters:[{argumentType:p.NUMBER,passSubtype:!0},{argumentType:p.NUMBER,passSubtype:!0}]},"HF.EQ":{method:"eq",parameters:[{argumentType:p.NOERROR,passSubtype:!0},{argumentType:p.NOERROR,passSubtype:!0}]},"HF.GT":{method:"gt",parameters:[{argumentType:p.NOERROR,passSubtype:!0},{argumentType:p.NOERROR,passSubtype:!0}]},"HF.GTE":{method:"gte",parameters:[{argumentType:p.NOERROR,passSubtype:!0},{argumentType:p.NOERROR,passSubtype:!0}]},"HF.LT":{method:"lt",parameters:[{argumentType:p.NOERROR,passSubtype:!0},{argumentType:p.NOERROR,passSubtype:!0}]},"HF.LTE":{method:"lte",parameters:[{argumentType:p.NOERROR,passSubtype:!0},{argumentType:p.NOERROR,passSubtype:!0}]},"HF.MINUS":{method:"minus",parameters:[{argumentType:p.NUMBER,passSubtype:!0},{argumentType:p.NUMBER,passSubtype:!0}]},"HF.MULTIPLY":{method:"multiply",parameters:[{argumentType:p.NUMBER,passSubtype:!0},{argumentType:p.NUMBER,passSubtype:!0}]},"HF.NE":{method:"ne",parameters:[{argumentType:p.NOERROR,passSubtype:!0},{argumentType:p.NOERROR,passSubtype:!0}]},"HF.POW":{method:"pow",parameters:[{argumentType:p.NUMBER,passSubtype:!0},{argumentType:p.NUMBER,passSubtype:!0}]},"HF.UMINUS":{method:"uminus",parameters:[{argumentType:p.NUMBER,passSubtype:!0}]},"HF.UNARY_PERCENT":{method:"upercent",parameters:[{argumentType:p.NUMBER,passSubtype:!0}]},"HF.UPLUS":{method:"uplus",parameters:[{argumentType:p.NUMBER,passSubtype:!0}]}};var sD=Math;function sF(e,t){for(var r=0,n=0;r<e.length;++r)n=t*n+e[r];return n}function sB(e,t,r,n,o){if(0===t)return r;if(1===t)return n;for(var i=2/e,s=n,a=1;a<t;++a)s=n*a*i+o*r,r=n,n=s;return s}function sV(e,t,r,n,o){return function(r,i){if(n){if(0===r)return 1==n?-1/0:1/0;else if(r<0)return NaN}if(0===i)return e(r);if(1===i)return t(r);if(i<0)return NaN;i|=0;var s=e(r),a=t(r);return sB(r,i,s,a,o)}}var sU=function(){var e=[0xd6759744e,-0x31c78f292,651619640.7,-11214424.18,77392.33017,-184.9052456].reverse(),t=[0xd675973ab,0x3d5d6d39,9494680.718,59272.64853,267.8532712,1].reverse(),r=[1,-.001098628627,2734510407e-14,-2073370639e-15,2093887211e-16].reverse(),n=[-.01562499995,1430488765e-13,-6911147651e-15,7621095161e-16,-934935152e-16].reverse();function o(o){var i=0,s=0,a=0,l=o*o;if(o<8)i=(s=sF(e,l))/(a=sF(t,l));else{var h=o-.785398164;s=sF(r,l=64/l),a=sF(n,l),i=sD.sqrt(.636619772/o)*(sD.cos(h)*s-sD.sin(h)*a*8/o)}return i}var i=[0x10d925ddd8,-0x1d6950b23,242396853.1,-2972611.439,15704.4826,-30.16036606].reverse(),s=[0x21b24bbb9a,0x891f618a,18583304.74,99447.43394,376.9991397,1].reverse(),a=[1,.00183105,-3516396496e-14,2457520174e-15,-240337019e-15].reverse(),l=[.04687499995,-2002690873e-13,8449199096e-15,-88228987e-14,105787412e-15].reverse();function h(e){var t=0,r=0,n=0,o=e*e,h=sD.abs(e)-2.356194491;return 8>Math.abs(e)?t=(r=e*sF(i,o))/(n=sF(s,o)):(r=sF(a,o=64/o),n=sF(l,o),t=sD.sqrt(.636619772/sD.abs(e))*(sD.cos(h)*r-sD.sin(h)*n*8/sD.abs(e)),e<0&&(t=-t)),t}return function e(t,r){if(r=Math.round(r),!isFinite(t))return isNaN(t)?t:0;if(r<0)return(r%2?-1:1)*e(t,-r);if(t<0)return(r%2?-1:1)*e(-t,r);if(0===r)return o(t);if(1===r)return h(t);if(0===t)return 0;var n=0;if(t>r)n=sB(t,r,o(t),h(t),-1);else{for(var i=2*sD.floor((r+sD.floor(sD.sqrt(40*r)))/2),s=!1,a=0,l=0,d=1,u=0,c=2/t,g=i;g>0;g--)u=g*c*d-a,a=d,d=u,sD.abs(d)>1e10&&(d*=1e-10,a*=1e-10,n*=1e-10,l*=1e-10),s&&(l+=d),s=!s,g==r&&(n=a);n/=l=2*l-d}return n}}(),sz=(z=[-0xb04cc5cd,0x1a4fa4b91,-512359803.6,10879881.29,-86327.92757,228.4622733].reverse(),W=[0x954bf890d,745249964.8,7189466.438,47447.2647,226.1030244,1].reverse(),G=[1,-.001098628627,2734510407e-14,-2073370639e-15,2093887211e-16].reverse(),$=[-.01562499995,1430488765e-13,-6911147651e-15,7621095161e-16,-934945152e-16].reverse(),Y=[-4900604943e3,127527439e4,-0xbffb0414e,734926455.1,-4237922.726,8511.937935].reverse(),j=[249958057e5,0x62d2b66f40,0xde8afbbf,22459040.02,102042.605,354.9632885,1].reverse(),q=[1,.00183105,-3516396496e-14,2457520174e-15,-240337019e-15].reverse(),K=[.04687499995,-2002690873e-13,8449199096e-15,-88228987e-14,105787412e-15].reverse(),sV(function(e){var t=0,r=0,n=0,o=e*e,i=e-.785398164;return e<8?t=(r=sF(z,o))/(n=sF(W,o))+.636619772*sU(e,0)*sD.log(e):(r=sF(G,o=64/o),n=sF($,o),t=sD.sqrt(.636619772/e)*(sD.sin(i)*r+sD.cos(i)*n*8/e)),t},function(e){var t=0,r=0,n=0,o=e*e,i=e-2.356194491;return e<8?t=(r=e*sF(Y,o))/(n=sF(j,o))+.636619772*(sU(e,1)*sD.log(e)-1/e):(r=sF(q,o=64/o),n=sF(K,o),t=sD.sqrt(.636619772/e)*(sD.sin(i)*r+sD.cos(i)*n*8/e)),t},"BESSELY",1,-1)),sW=(X=[1,3.5156229,3.0899424,1.2067492,.2659732,.0360768,.0045813].reverse(),Q=[.39894228,.01328592,.00225319,-.00157565,.00916281,-.02057706,.02635537,-.01647633,.00392377].reverse(),Z=[.5,.87890594,.51498869,.15084934,.02658733,.00301532,32411e-8].reverse(),J=[.39894228,-.03988024,-.00362018,.00163801,-.01031555,.02282967,-.02895312,.01787654,-.00420059].reverse(),function e(t,r){if(0===(r=Math.round(r)))return t<=3.75?sF(X,t*t/14.0625):sD.exp(sD.abs(t))/sD.sqrt(sD.abs(t))*sF(Q,3.75/sD.abs(t));if(1===r)return t<3.75?t*sF(Z,t*t/14.0625):(t<0?-1:1)*sD.exp(sD.abs(t))/sD.sqrt(sD.abs(t))*sF(J,3.75/sD.abs(t));if(r<0)return NaN;if(0===sD.abs(t))return 0;if(t==1/0)return 1/0;var n,o=0,i=2/sD.abs(t),s=0,a=1,l=0;for(n=2*sD.round((r+sD.round(sD.sqrt(40*r)))/2);n>0;n--)l=n*i*a+s,s=a,a=l,sD.abs(a)>1e10&&(a*=1e-10,s*=1e-10,o*=1e-10),n==r&&(o=s);return o*=e(t,0)/a,t<0&&r%2?-o:o}),sG=(ee=[-.57721566,.4227842,.23069756,.0348859,.00262698,1075e-7,74e-7].reverse(),et=[1.25331414,-.07832358,.02189568,-.01062446,.00587872,-.0025154,53208e-8].reverse(),er=[1,.15443144,-.67278579,-.18156897,-.01919402,-.00110404,-4686e-8].reverse(),en=[1.25331414,.23498619,-.0365562,.01504268,-.00780353,.00325614,-68245e-8].reverse(),sV(function(e){return e<=2?-sD.log(e/2)*sW(e,0)+sF(ee,e*e/4):sD.exp(-e)/sD.sqrt(e)*sF(et,2/e)},function(e){return e<=2?sD.log(e/2)*sW(e,1)+1/e*sF(er,e*e/4):sD.exp(-e)/sD.sqrt(e)*sF(en,2/e)},"BESSELK",2,1));function s$(e){let t,r,n,o,i=[-1.3026537197817094,.6419697923564902,.019476473204185836,-.00956151478680863,-946595344482036e-18,366839497852761e-18,42523324806907e-18,-20278578112534e-18,-1624290004647e-18,130365583558e-17,15626441722e-18,-85238095915e-18,6529054439e-18,5059343495e-18,-991364156e-18,-227365122e-18,96467911e-18,2394038e-18,-6886027e-18,894487e-18,313092e-18,-112708e-18,381e-18,7106e-18,-1523e-18,-94e-18,121e-18,-28e-18],s=i.length-1,a=!1,l=0,h=0;if(0===e)return 0;for(e<0&&(e=-e,a=!0),r=4*(t=2/(2+e))-2;s>0;s--)n=l,l=r*l-h+i[s],h=n;return o=t*Math.exp(-e*e+.5*(i[0]+r*l)-h),a?o-1:1-o}function sY(e){return 1-s$(e)}function sj(e){let t,r,n,o,i=0;if(e>=2)return -100;if(e<=0)return 100;for(t=-.70711*((2.30753+.27061*(n=Math.sqrt(-2*Math.log((o=e<1?e:2-e)/2))))/(1+n*(.99229+.04481*n))-n);i<2;i++)r=sY(t)-o,t+=r/(1.1283791670955126*Math.exp(-t*t)-t*r);return e<1?t:-t}function sq(e){let t,r,n,o,i=[-1.716185138865495,24.76565080557592,-379.80425647094563,629.3311553128184,866.9662027904133,-31451.272968848367,-36144.413418691176,66456.14382024054],s=[-30.8402300119739,315.35062697960416,-1015.1563674902192,-3107.771671572311,22538.11842098015,4755.846277527881,-134659.9598649693,-115132.2596755535],a=!1,l=0,h=0,d=0,u=e;if(e>171.6243769536076)return 1/0;if(u<=0){if(!(o=u%1))return 1/0;a=(1&u?-1:1)*Math.PI/Math.sin(Math.PI*o),u=1-u}for(t=0,n=u,r=u<1?u++:(u-=l=(0|u)-1)-1;t<8;++t)d=(d+i[t])*r,h=h*r+s[t];if(o=d/h+1,n<u)o/=n;else if(n>u)for(t=0;t<l;++t)o*=u,u++;return a&&(o=a/o),o}let sK=function(e,t,r){return sZ(e,t)*r};function sX(e){let t,r,n=0,o=[76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],i=1.000000000190015;for(r=(t=e)+5.5,r-=(e+.5)*Math.log(r);n<6;n++)i+=o[n]/++t;return Math.log(2.5066282746310007*i/e)-r}function sQ(e,t){let r,n=sX(e),o=e,i=1/e,s=i,a=t+1-e,l=1/1e-30,h=1/a,d=h,u=1,c=-~(8.5*Math.log(e>=1?e:1/e)+.4*e+17);if(t<0||e<=0)return NaN;if(t<e+1){for(;u<=c;u++)i+=s*=t/++o;return i*Math.exp(-t+e*Math.log(t)-n)}for(;u<=c;u++)a+=2,d*=(h=1/(h=(r=-u*(u-e))*h+a))*(l=a+r/l);return 1-d*Math.exp(-t+e*Math.log(t)-n)}function sZ(e,t){let r,n,o,i,s,a=0,l=t-1,h=sX(t);if(e>=1)return Math.max(100,t+100*Math.sqrt(t));if(e<=0)return 0;for(t>1?(i=Math.log(l),s=Math.exp(l*(i-1)-h),r=(2.30753+.27061*(n=Math.sqrt(-2*Math.log(e<.5?e:1-e))))/(1+n*(.99229+.04481*n))-n,e<.5&&(r=-r),r=Math.max(.001,t*Math.pow(1-1/(9*t)-r/(3*Math.sqrt(t)),3))):r=e<(n=1-t*(.253+.12*t))?Math.pow(e/n,1/t):1-Math.log(1-(e-n)/(1-n));a<12;a++){if(r<=0)return 0;if(o=(sQ(t,r)-e)/(n=t>1?s*Math.exp(-(r-l)+l*(Math.log(r)-i)):Math.exp(-r+l*Math.log(r)-h)),(r-=n=o/(1-.5*Math.min(1,o*((t-1)/r-1))))<=0&&(r=.5*(r+n)),Math.abs(n)<1e-8*r)break}return r}let sJ=function(e,t,r){return Math.exp(-.5*Math.log(2*Math.PI)-Math.log(r)-Math.pow(e-t,2)/(2*r*r))},s0=function(e,t,r){return .5*(1+s$((e-t)/Math.sqrt(2*r*r)))},s1=function(e,t,r){return -1.4142135623730951*r*sj(2*e)+t};function s2(e,t){if(!(e<=0)&&!(t<=0))return e+t>170?Math.exp(s3(e,t)):sq(e)*sq(t)/sq(e+t)}function s3(e,t){return sX(e)+sX(t)-sX(e+t)}function s6(e,t,r){var n,o,i,s,a,l,h,d,u,c=t-1,g=r-1,p=0;if(e<=0)return 0;if(e>=1)return 1;for(t>=1&&r>=1?(a=(2.30753+.27061*(i=Math.sqrt(-2*Math.log(e<.5?e:1-e))))/(1+i*(.99229+.04481*i))-i,e<.5&&(a=-a),l=(a*a-3)/6,d=a*Math.sqrt(l+(h=2/(1/(2*t-1)+1/(2*r-1))))/h-(1/(2*r-1)-1/(2*t-1))*(l+5/6-2/(3*h)),a=t/(t+r*Math.exp(2*d))):(n=Math.log(t/(t+r)),o=Math.log(r/(t+r)),d=(i=Math.exp(t*n)/t)+(s=Math.exp(r*o)/r),a=e<i/d?Math.pow(t*d*e,1/t):1-Math.pow(r*d*(1-e),1/r)),u=-sX(t)-sX(r)+sX(t+r);p<10&&0!==a&&1!==a&&(s=(s5(a,t,r)-e)/(i=Math.exp(c*Math.log(a)+g*Math.log(1-a)+u)),(a-=i=s/(1-.5*Math.min(1,s*(c/a-g/(1-a)))))<=0&&(a=.5*(a+i)),a>=1&&(a=.5*(a+i+1)),!(Math.abs(i)<1e-8*a)||!(p>0));p++);return a}function s5(e,t,r){var n=0===e||1===e?0:Math.exp(sX(t+r)-sX(t)-sX(r)+t*Math.log(e)+r*Math.log(1-e));return!(e<0)&&!(e>1)&&(e<(t+1)/(t+r+2)?n*s4(e,t,r)/t:1-n*s4(1-e,r,t)/r)}function s4(e,t,r){var n,o,i,s,a=1,l=t+r,h=t+1,d=t-1,u=1,c=1-l*e/h;for(1e-30>Math.abs(c)&&(c=1e-30),s=c=1/c;a<=100&&(n=2*a,1e-30>Math.abs(c=1+(o=a*(r-a)*e/((d+n)*(t+n)))*c)&&(c=1e-30),1e-30>Math.abs(u=1+o/u)&&(u=1e-30),s*=(c=1/c)*u,1e-30>Math.abs(c=1+(o=-(t+a)*(l+a)*e/((t+n)*(h+n)))*c)&&(c=1e-30),1e-30>Math.abs(u=1+o/u)&&(u=1e-30),s*=i=(c=1/c)*u,!(3e-7>Math.abs(i-1)));a++);return s}let s9=function(e,t,r){return 0===r||1===r?+(t*r===e):ae(t,e)*Math.pow(r,e)*Math.pow(1-r,t-e)},s7=function(e,t,r){if(e<0)return 0;if(e>=t)return 1;if(r<0||r>1||t<=0)return NaN;var n=(e=Math.floor(e))+1,o=t-e,i=n+o,s=Math.exp(sX(i)-sX(o)-sX(n)+n*Math.log(r)+o*Math.log(1-r));return Math.round(1e10*(1-(r<(n+1)/(i+2)?s*s8(r,n,o,1e-10):1-s*s8(1-r,o,n,1e-10))))/1e10};function s8(e,t,r,n){for(var o,i=0,s=1,a=1,l=1,h=0,d=0;Math.abs((a-d)/a)>n;)d=a,i=a+(o=-(t+h)*(t+r+h)*e/(t+2*h)/(t+2*h+1))*i,s=l+o*s,h+=1,a=i+(o=h*(r-h)*e/(t+2*h-1)/(t+2*h))*a,i/=l=s+o*l,s/=l,a/=l,l=1;return a/t}function ae(e,t){var r,n;return e>170||t>170?Math.exp((r=e,n=t,at(r)-at(n)-at(r-n))):ar(e)/ar(t)/ar(e-t)}function at(e){return e<0?NaN:sX(e+1)}function ar(e){return e<0?NaN:sq(e+1)}let an=function(e,t){return e<0?0:sQ(t/2,e/2)},ao=function(e,t){return 2*sZ(e,.5*t)},ai=function(e,t,r){return e<0?0:s5(t*e/(t*e+r),t/2,r/2)},as=function(e,t,r){return r/(t*(1/s6(e,t/2,r/2)-1))},aa={pdf:function(e,t){return t<0||e%1!=0||e<0?0:Math.pow(t,e)*Math.exp(-t)/ar(e)},cdf:function(e,t){var r=0;if(e<0)return 0;for(var n=0;r<=e;r++)n+=aa.pdf(r,t);return n}},al={pdf:function(e,t,r,n){if(e<0||e<r-(t-n)||e>n||e>r)return 0;if(2*r>t)if(2*n>t)return al.pdf(t-r-n+e,t,t-r,t-n);else return al.pdf(n-e,t,t-r,n);if(2*n>t)return al.pdf(r-e,t,r,t-n);if(r<n)return al.pdf(e,t,n,r);for(var o=1,i=0,s=0;s<e;s++){for(;o>1&&i<n;)o*=1-r/(t-i),i++;o*=(n-s)*(r-s)/((s+1)*(t-r-n+s+1))}for(;i<n;i++)o*=1-r/(t-i);return Math.min(1,Math.max(0,o))},cdf:function e(t,r,n,o){if(t<0||t<n-(r-o))return 0;if(t>=o||t>=n)return 1;if(2*n>r)if(2*o>r)return e(r-n-o+t,r,r-n,r-o);else return 1-al.cdf(o-t-1,r,r-n,o);if(2*o>r)return 1-al.cdf(n-t-1,r,n,r-o);if(n<o)return al.cdf(t,r,o,n);for(var i=1,s=1,a=0,l=0;l<t;l++){for(;i>1&&a<o;){var h=1-n/(r-a);s*=h,i*=h,a++}s*=(o-l)*(n-l)/((l+1)*(r-n-o+l+1)),i+=s}for(;a<o;a++)i*=1-n/(r-a);return Math.min(1,Math.max(0,i))}},ah=function(e,t){var r=t/2;return s5((e+Math.sqrt(e*e+t))/(2*Math.sqrt(e*e+t)),r,r)},ad=function(e,t){var r=s6(2*Math.min(e,1-e),.5*t,.5);return r=Math.sqrt(t*(1-r)/r),e>.5?r:-r},au={pdf:function(e,t,r){return e===e>>>0&&(e<0?0:ae(e+t-1,t-1)*Math.pow(1-r,e)*Math.pow(r,t))},cdf:function(e,t,r){var n=0,o=0;if(e<0)return 0;for(;o<=e;o++)n+=au.pdf(o,t,r);return n}};function ac(e){for(var t=0,r=e.length;--r>=0;)t+=e[r];return t}function ag(e){return ac(e)/e.length}function ap(e){for(var t,r=ag(e),n=0,o=e.length;--o>=0;)n+=(t=e[o]-r)*t;return n}function am(e,t){return ap(e)/(e.length-!!t)}function af(e,t){return Math.sqrt(am(e,t))}function ab(e,t){var r,n=ag(e),o=ag(t),i=e.length,s=Array(i);for(r=0;r<i;r++)s[r]=(e[r]-n)*(t[r]-o);return ac(s)/(i-1)}function aC(e,t){return ab(e,t)/af(e,1)/af(t,1)}class ay extends nv{erf(e,t){return this.runFunction(e.args,t,this.metadata("ERF"),(e,t)=>void 0===t?s$(e):s$(t)-s$(e))}erfc(e,t){return this.runFunction(e.args,t,this.metadata("ERFC"),sY)}expondist(e,t){return this.runFunction(e.args,t,this.metadata("EXPON.DIST"),(e,t,r)=>{let n,o,i,s;return r?(n=e,o=t,n<0?0:1-Math.exp(-o*n)):(i=e,s=t,i<0?0:s*Math.exp(-s*i))})}fisher(e,t){return this.runFunction(e.args,t,this.metadata("FISHER"),e=>Math.log((1+e)/(1-e))/2)}fisherinv(e,t){return this.runFunction(e.args,t,this.metadata("FISHERINV"),e=>1-2/(Math.exp(2*e)+1))}gamma(e,t){return this.runFunction(e.args,t,this.metadata("GAMMA"),sq)}gammadist(e,t){return this.runFunction(e.args,t,this.metadata("GAMMA.DIST"),(e,t,r,n)=>{var o,i,s,a,l,h;return n?(o=e,i=t,s=r,o<0?0:sQ(i,o/s)):(a=e,l=t,h=r,a<0?0:0===a&&1===l?1/h:Math.exp((l-1)*Math.log(a)-a/h-sX(l)-l*Math.log(h)))})}gammaln(e,t){return this.runFunction(e.args,t,this.metadata("GAMMALN"),sX)}gammainv(e,t){return this.runFunction(e.args,t,this.metadata("GAMMA.INV"),sK)}gauss(e,t){return this.runFunction(e.args,t,this.metadata("GAUSS"),e=>s0(e,0,1)-.5)}betadist(e,t){return this.runFunction(e.args,t,this.metadata("BETA.DIST"),(e,t,r,n,o,i)=>{var s,a,l,h,u,c;return e<=o?new rK(d.NUM,ej.ValueSmall):e>=i?new rK(d.NUM,ej.ValueLarge):(e=(e-o)/(i-o),n)?(s=e,a=t,l=r,s>1||s<0?+(s>1):s5(s,a,l)):(h=e,u=t,c=r,h>1||h<0?0:1==u&&1==c?1:u<512&&c<512?Math.pow(h,u-1)*Math.pow(1-h,c-1)/s2(u,c):Math.exp((u-1)*Math.log(h)+(c-1)*Math.log(1-h)-s3(u,c)))})}betainv(e,t){return this.runFunction(e.args,t,this.metadata("BETA.INV"),(e,t,r,n,o)=>n>=o?new rK(d.NUM,ej.WrongOrder):s6(e,t,r)*(o-n)+n)}binomialdist(e,t){return this.runFunction(e.args,t,this.metadata("BINOM.DIST"),(e,t,r,n)=>e>t?new rK(d.NUM,ej.WrongOrder):(e=Math.trunc(e),t=Math.trunc(t),n)?s7(e,t,r):s9(e,t,r))}binomialinv(e,t){return this.runFunction(e.args,t,this.metadata("BINOM.INV"),(e,t,r)=>{let n=-1,o=e=Math.trunc(e);for(;o>n+1;){let i=Math.trunc((n+o)/2);s7(i,e,t)>=r?o=i:n=i}return o})}besselifn(e,t){return this.runFunction(e.args,t,this.metadata("BESSELI"),(e,t)=>sW(e,Math.trunc(t)))}besseljfn(e,t){return this.runFunction(e.args,t,this.metadata("BESSELJ"),(e,t)=>sU(e,Math.trunc(t)))}besselkfn(e,t){return this.runFunction(e.args,t,this.metadata("BESSELK"),(e,t)=>sG(e,Math.trunc(t)))}besselyfn(e,t){return this.runFunction(e.args,t,this.metadata("BESSELY"),(e,t)=>sz(e,Math.trunc(t)))}chisqdist(e,t){return this.runFunction(e.args,t,this.metadata("CHISQ.DIST"),(e,t,r)=>{var n,o;return(t=Math.trunc(t),r)?an(e,t):(n=e,o=t,n<0?0:0===n&&2===o?.5:Math.exp((o/2-1)*Math.log(n)-n/2-o/2*Math.log(2)-sX(o/2)))})}chisqdistrt(e,t){return this.runFunction(e.args,t,this.metadata("CHISQ.DIST.RT"),(e,t)=>1-an(e,Math.trunc(t)))}chisqinv(e,t){return this.runFunction(e.args,t,this.metadata("CHISQ.INV"),(e,t)=>ao(e,Math.trunc(t)))}chisqinvrt(e,t){return this.runFunction(e.args,t,this.metadata("CHISQ.INV.RT"),(e,t)=>ao(1-e,Math.trunc(t)))}fdist(e,t){return this.runFunction(e.args,t,this.metadata("F.DIST"),(e,t,r,n)=>{var o,i,s;return(t=Math.trunc(t),r=Math.trunc(r),n)?ai(e,t,r):(o=e,i=t,s=r,o<0?0:i<=2?0===o&&i<2?1/0:0===o&&2===i?1:1/s2(i/2,s/2)*Math.pow(i/s,i/2)*Math.pow(o,i/2-1)*Math.pow(1+i/s*o,-(i+s)/2):s/(s+o*i)*i/2*s9((i-2)/2,(i+s-2)/2,i*o/(s+o*i)))})}fdistrt(e,t){return this.runFunction(e.args,t,this.metadata("F.DIST.RT"),(e,t,r)=>1-ai(e,Math.trunc(t),Math.trunc(r)))}finv(e,t){return this.runFunction(e.args,t,this.metadata("F.INV"),(e,t,r)=>as(e,Math.trunc(t),Math.trunc(r)))}finvrt(e,t){return this.runFunction(e.args,t,this.metadata("F.INV.RT"),(e,t,r)=>as(1-e,Math.trunc(t),Math.trunc(r)))}weibulldist(e,t){return this.runFunction(e.args,t,this.metadata("WEIBULL.DIST"),(e,t,r,n)=>{var o,i,s,a,l,h;return n?(o=e,i=r,s=t,o<0?0:1-Math.exp(-Math.pow(o/i,s))):(a=e,l=r,h=t,a<0||l<0||h<0?0:h/l*Math.pow(a/l,h-1)*Math.exp(-Math.pow(a/l,h)))})}poissondist(e,t){return this.runFunction(e.args,t,this.metadata("POISSON.DIST"),(e,t,r)=>(e=Math.trunc(e),r)?aa.cdf(e,t):aa.pdf(e,t))}hypgeomdist(e,t){return this.runFunction(e.args,t,this.metadata("HYPGEOM.DIST"),(e,t,r,n,o)=>e>t||e>r||t>n||r>n||e+n<r+t?new rK(d.NUM,ej.ValueLarge):(e=Math.trunc(e),t=Math.trunc(t),r=Math.trunc(r),n=Math.trunc(n),o)?al.cdf(e,n,r,t):al.pdf(e,n,r,t))}tdist(e,t){return this.runFunction(e.args,t,this.metadata("T.DIST"),(e,t,r)=>{var n,o;return(t=Math.trunc(t),r)?ah(e,t):(n=e,1/(Math.sqrt(o=(o=t)>1e100?1e100:o)*s2(.5,o/2))*Math.pow(1+n*n/o,-((o+1)/2)))})}tdist2t(e,t){return this.runFunction(e.args,t,this.metadata("T.DIST.2T"),(e,t)=>(1-ah(e,Math.trunc(t)))*2)}tdistrt(e,t){return this.runFunction(e.args,t,this.metadata("T.DIST.RT"),(e,t)=>1-ah(e,Math.trunc(t)))}tdistold(e,t){return this.runFunction(e.args,t,this.metadata("TDIST"),(e,t,r)=>r*(1-ah(e,Math.trunc(t))))}tinv(e,t){return this.runFunction(e.args,t,this.metadata("T.INV"),(e,t)=>ad(e,Math.trunc(t)))}tinv2t(e,t){return this.runFunction(e.args,t,this.metadata("T.INV.2T"),(e,t)=>ad(1-e/2,Math.trunc(t)))}lognormdist(e,t){return this.runFunction(e.args,t,this.metadata("LOGNORM.DIST"),(e,t,r,n)=>{var o,i,s,a,l,h;return n?(o=e,i=t,s=r,o<0?0:.5+.5*s$((Math.log(o)-i)/Math.sqrt(2*s*s))):(a=e,l=t,h=r,a<=0?0:Math.exp(-Math.log(a)-.5*Math.log(2*Math.PI)-Math.log(h)-Math.pow(Math.log(a)-l,2)/(2*h*h)))})}lognorminv(e,t){return this.runFunction(e.args,t,this.metadata("LOGNORM.INV"),(e,t,r)=>{var n,o;return n=e,o=t,Math.exp(-1.4142135623730951*r*sj(2*n)+o)})}normdist(e,t){return this.runFunction(e.args,t,this.metadata("NORM.DIST"),(e,t,r,n)=>n?s0(e,t,r):sJ(e,t,r))}norminv(e,t){return this.runFunction(e.args,t,this.metadata("NORM.INV"),(e,t,r)=>s1(e,t,r))}normsdist(e,t){return this.runFunction(e.args,t,this.metadata("NORM.S.DIST"),(e,t)=>t?s0(e,0,1):sJ(e,0,1))}normsinv(e,t){return this.runFunction(e.args,t,this.metadata("NORM.S.INV"),e=>s1(e,0,1))}phi(e,t){return this.runFunction(e.args,t,this.metadata("PHI"),e=>sJ(e,0,1))}negbinomdist(e,t){return this.runFunction(e.args,t,this.metadata("NEGBINOM.DIST"),(e,t,r,n)=>(e=Math.trunc(e),t=Math.trunc(t),n)?au.cdf(e,t,r):au.pdf(e,t,r))}confidencenorm(e,t){return this.runFunction(e.args,t,this.metadata("CONFIDENCE.NORM"),(e,t,r)=>(function(){var e,t=[].slice.call(arguments),r=[,,];return e=4===t.length?Math.abs(s1(t[1]/2,0,1)*t[2]/Math.sqrt(t[3])):Math.abs(s1(t[1]/2,0,1)*af(t[2])/Math.sqrt(t[2].length)),r[0]=t[0]-e,r[1]=t[0]+e,r})(1,e,t,Math.trunc(r))[1]-1)}confidencet(e,t){return this.runFunction(e.args,t,this.metadata("CONFIDENCE.T"),(e,t,r)=>1===(r=Math.trunc(r))?new rK(d.DIV_BY_ZERO):function(){var e,t=[].slice.call(arguments),r=[,,];return e=4===t.length?Math.abs(ad(t[1]/2,t[3]-1)*t[2]/Math.sqrt(t[3])):Math.abs(ad(t[1]/2,t[2].length-1)*af(t[2],!0)/Math.sqrt(t[2].length)),r[0]=t[0]-e,r[1]=t[0]+e,r}(1,e,t,r)[1]-1)}standardize(e,t){return this.runFunction(e.args,t,this.metadata("STANDARDIZE"),(e,t,r)=>(e-t)/r)}}ay.implementedFunctions={ERF:{method:"erf",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER,optionalArg:!0}]},ERFC:{method:"erfc",parameters:[{argumentType:p.NUMBER}]},"EXPON.DIST":{method:"expondist",parameters:[{argumentType:p.NUMBER,minValue:0},{argumentType:p.NUMBER,greaterThan:0},{argumentType:p.BOOLEAN}]},FISHER:{method:"fisher",parameters:[{argumentType:p.NUMBER,greaterThan:-1,lessThan:1}]},FISHERINV:{method:"fisherinv",parameters:[{argumentType:p.NUMBER}]},GAMMA:{method:"gamma",parameters:[{argumentType:p.NUMBER}]},"GAMMA.DIST":{method:"gammadist",parameters:[{argumentType:p.NUMBER,minValue:0},{argumentType:p.NUMBER,greaterThan:0},{argumentType:p.NUMBER,greaterThan:0},{argumentType:p.BOOLEAN}]},GAMMALN:{method:"gammaln",parameters:[{argumentType:p.NUMBER,greaterThan:0}]},"GAMMA.INV":{method:"gammainv",parameters:[{argumentType:p.NUMBER,minValue:0,lessThan:1},{argumentType:p.NUMBER,greaterThan:0},{argumentType:p.NUMBER,greaterThan:0}]},GAUSS:{method:"gauss",parameters:[{argumentType:p.NUMBER}]},"BETA.DIST":{method:"betadist",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER,greaterThan:0},{argumentType:p.NUMBER,greaterThan:0},{argumentType:p.BOOLEAN},{argumentType:p.NUMBER,defaultValue:0},{argumentType:p.NUMBER,defaultValue:1}]},"BETA.INV":{method:"betainv",parameters:[{argumentType:p.NUMBER,greaterThan:0,maxValue:1},{argumentType:p.NUMBER,greaterThan:0},{argumentType:p.NUMBER,greaterThan:0},{argumentType:p.NUMBER,defaultValue:0},{argumentType:p.NUMBER,defaultValue:1}]},"BINOM.DIST":{method:"binomialdist",parameters:[{argumentType:p.NUMBER,minValue:0},{argumentType:p.NUMBER,minValue:0},{argumentType:p.NUMBER,minValue:0,maxValue:1},{argumentType:p.BOOLEAN}]},"BINOM.INV":{method:"binomialinv",parameters:[{argumentType:p.NUMBER,minValue:0},{argumentType:p.NUMBER,minValue:0,maxValue:1},{argumentType:p.NUMBER,greaterThan:0,lessThan:1}]},BESSELI:{method:"besselifn",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER,minValue:0}]},BESSELJ:{method:"besseljfn",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER,minValue:0}]},BESSELK:{method:"besselkfn",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER,minValue:0}]},BESSELY:{method:"besselyfn",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER,minValue:0}]},"CHISQ.DIST":{method:"chisqdist",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER,minValue:1,maxValue:1e10},{argumentType:p.BOOLEAN}]},"CHISQ.DIST.RT":{method:"chisqdistrt",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER,minValue:1,maxValue:1e10}]},"CHISQ.INV":{method:"chisqinv",parameters:[{argumentType:p.NUMBER,minValue:0,maxValue:1},{argumentType:p.NUMBER,minValue:1,maxValue:1e10}]},"CHISQ.INV.RT":{method:"chisqinvrt",parameters:[{argumentType:p.NUMBER,minValue:0,maxValue:1},{argumentType:p.NUMBER,minValue:1}]},"F.DIST":{method:"fdist",parameters:[{argumentType:p.NUMBER,minValue:0},{argumentType:p.NUMBER,minValue:1},{argumentType:p.NUMBER,minValue:1},{argumentType:p.BOOLEAN}]},"F.DIST.RT":{method:"fdistrt",parameters:[{argumentType:p.NUMBER,minValue:0},{argumentType:p.NUMBER,minValue:1},{argumentType:p.NUMBER,minValue:1}]},"F.INV":{method:"finv",parameters:[{argumentType:p.NUMBER,minValue:0,maxValue:1},{argumentType:p.NUMBER,minValue:1},{argumentType:p.NUMBER,minValue:1}]},"F.INV.RT":{method:"finvrt",parameters:[{argumentType:p.NUMBER,minValue:0,maxValue:1},{argumentType:p.NUMBER,minValue:1},{argumentType:p.NUMBER,minValue:1}]},"WEIBULL.DIST":{method:"weibulldist",parameters:[{argumentType:p.NUMBER,minValue:0},{argumentType:p.NUMBER,greaterThan:0},{argumentType:p.NUMBER,greaterThan:0},{argumentType:p.BOOLEAN}]},"POISSON.DIST":{method:"poissondist",parameters:[{argumentType:p.NUMBER,minValue:0},{argumentType:p.NUMBER,minValue:0},{argumentType:p.BOOLEAN}]},"HYPGEOM.DIST":{method:"hypgeomdist",parameters:[{argumentType:p.NUMBER,minValue:0},{argumentType:p.NUMBER,greaterThan:0},{argumentType:p.NUMBER,greaterThan:0},{argumentType:p.NUMBER,greaterThan:0},{argumentType:p.BOOLEAN}]},"T.DIST":{method:"tdist",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER,minValue:1},{argumentType:p.BOOLEAN}]},"T.DIST.2T":{method:"tdist2t",parameters:[{argumentType:p.NUMBER,minValue:0},{argumentType:p.NUMBER,minValue:1}]},"T.DIST.RT":{method:"tdistrt",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER,minValue:1}]},TDIST:{method:"tdistold",parameters:[{argumentType:p.NUMBER,minValue:0},{argumentType:p.NUMBER,minValue:1},{argumentType:p.INTEGER,minValue:1,maxValue:2}]},"T.INV":{method:"tinv",parameters:[{argumentType:p.NUMBER,greaterThan:0,lessThan:1},{argumentType:p.NUMBER,minValue:1}]},"T.INV.2T":{method:"tinv2t",parameters:[{argumentType:p.NUMBER,greaterThan:0,maxValue:1},{argumentType:p.NUMBER,minValue:1}]},"LOGNORM.DIST":{method:"lognormdist",parameters:[{argumentType:p.NUMBER,greaterThan:0},{argumentType:p.NUMBER},{argumentType:p.NUMBER,greaterThan:0},{argumentType:p.BOOLEAN}]},"LOGNORM.INV":{method:"lognorminv",parameters:[{argumentType:p.NUMBER,greaterThan:0,lessThan:1},{argumentType:p.NUMBER},{argumentType:p.NUMBER,greaterThan:0}]},"NORM.DIST":{method:"normdist",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER},{argumentType:p.NUMBER,greaterThan:0},{argumentType:p.BOOLEAN}]},"NORM.INV":{method:"norminv",parameters:[{argumentType:p.NUMBER,greaterThan:0,lessThan:1},{argumentType:p.NUMBER},{argumentType:p.NUMBER,greaterThan:0}]},"NORM.S.DIST":{method:"normsdist",parameters:[{argumentType:p.NUMBER},{argumentType:p.BOOLEAN}]},"NORM.S.INV":{method:"normsinv",parameters:[{argumentType:p.NUMBER,greaterThan:0,lessThan:1}]},PHI:{method:"phi",parameters:[{argumentType:p.NUMBER}]},"NEGBINOM.DIST":{method:"negbinomdist",parameters:[{argumentType:p.NUMBER,minValue:0},{argumentType:p.NUMBER,minValue:1},{argumentType:p.NUMBER,minValue:0,maxValue:1},{argumentType:p.BOOLEAN}]},"CONFIDENCE.NORM":{method:"confidencenorm",parameters:[{argumentType:p.NUMBER,greaterThan:0,lessThan:1},{argumentType:p.NUMBER,greaterThan:0},{argumentType:p.NUMBER,minValue:1}]},"CONFIDENCE.T":{method:"confidencet",parameters:[{argumentType:p.NUMBER,greaterThan:0,lessThan:1},{argumentType:p.NUMBER,greaterThan:0},{argumentType:p.NUMBER,minValue:1}]},STANDARDIZE:{method:"standardize",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER},{argumentType:p.NUMBER,greaterThan:0}]}},ay.aliases={NEGBINOMDIST:"NEGBINOM.DIST",EXPONDIST:"EXPON.DIST",BETADIST:"BETA.DIST",NORMDIST:"NORM.DIST",NORMINV:"NORM.INV",NORMSDIST:"NORM.S.DIST",NORMSINV:"NORM.S.INV",LOGNORMDIST:"LOGNORM.DIST",LOGINV:"LOGNORM.INV",TINV:"T.INV.2T",HYPGEOMDIST:"HYPGEOM.DIST",POISSON:"POISSON.DIST",WEIBULL:"WEIBULL.DIST",FINV:"F.INV.RT",FDIST:"F.DIST.RT",CHIDIST:"CHISQ.DIST.RT",CHIINV:"CHISQ.INV.RT",GAMMADIST:"GAMMA.DIST","GAMMALN.PRECISE":"GAMMALN",GAMMAINV:"GAMMA.INV",BETAINV:"BETA.INV",BINOMDIST:"BINOM.DIST",CONFIDENCE:"CONFIDENCE.NORM",CRITBINOM:"BINOM.INV",WEIBULLDIST:"WEIBULL.DIST",TINV2T:"T.INV.2T",TDISTRT:"T.DIST.RT",TDIST2T:"T.DIST.2T",FINVRT:"F.INV.RT",FDISTRT:"F.DIST.RT",CHIDISTRT:"CHISQ.DIST.RT",CHIINVRT:"CHISQ.INV.RT",LOGNORMINV:"LOGNORM.INV",POISSONDIST:"POISSON.DIST"};class aw extends nv{fact(e,t){return this.runFunction(e.args,t,this.metadata("FACT"),e=>{e=Math.trunc(e);let t=1;for(let r=1;r<=e;r++)t*=r;return t})}factdouble(e,t){return this.runFunction(e.args,t,this.metadata("FACTDOUBLE"),e=>{e=Math.trunc(e);let t=1;for(let r=e;r>=1;r-=2)t*=r;return t})}combin(e,t){return this.runFunction(e.args,t,this.metadata("COMBIN"),(e,t)=>t>e?new rK(d.NUM,ej.WrongOrder):aS(e=Math.trunc(e),t=Math.trunc(t)))}combina(e,t){return this.runFunction(e.args,t,this.metadata("COMBINA"),(e,t)=>(e=Math.trunc(e))+(t=Math.trunc(t))-1>=1030?new rK(d.NUM,ej.ValueLarge):0===e&&0===t?1:aS(e+t-1,t))}gcd(e,t){return this.runFunction(e.args,t,this.metadata("GCD"),(...e)=>{let t=this.arithmeticHelper.coerceNumbersCoerceRangesDropNulls(e);if(t instanceof rK)return t;let r=0;for(let e of t){if(e<0)return new rK(d.NUM,ej.ValueSmall);r=av(r,Math.trunc(e))}return r>Number.MAX_SAFE_INTEGER?new rK(d.NUM,ej.ValueLarge):r})}lcm(e,t){return this.runFunction(e.args,t,this.metadata("LCM"),(...e)=>{let t=this.arithmeticHelper.coerceNumbersCoerceRangesDropNulls(e);if(t instanceof rK)return t;let r=1;for(let e of t){var n,o;if(e<0)return new rK(d.NUM,ej.ValueSmall);n=r,o=Math.trunc(e),r=0===n||0===o?0:n*(o/av(n,o))}return r>Number.MAX_SAFE_INTEGER?new rK(d.NUM,ej.ValueLarge):r})}mround(e,t){return this.runFunction(e.args,t,this.metadata("MROUND"),(e,t)=>0===t?0:e>0&&t<0||e<0&&t>0?new rK(d.NUM,ej.DistinctSigns):Math.round(e/t)*t)}multinomial(e,t){return this.runFunction(e.args,t,this.metadata("MULTINOMIAL"),(...e)=>{let t=0,r=1;for(let n of e){if(n<0)return new rK(d.NUM,ej.ValueSmall);n=Math.trunc(n);for(let e=1;e<=n;e++)r*=(t+e)/e;t+=n}return Math.round(r)})}quotient(e,t){return this.runFunction(e.args,t,this.metadata("QUOTIENT"),(e,t)=>0===t?new rK(d.DIV_BY_ZERO):Math.trunc(e/t))}seriessum(e,t){return this.runFunction(e.args,t,this.metadata("SERIESSUM"),(e,t,r,n)=>{let o=this.arithmeticHelper.manyToOnlyNumbersDropNulls(n.valuesFromTopLeftCorner());if(o instanceof rK)return o;let i=0;for(let t of(o.reverse(),o))i*=Math.pow(e,r),i+=t;return i*Math.pow(e,t)})}sign(e,t){return this.runFunction(e.args,t,this.metadata("SIGN"),e=>e>0?1:e<0?-1:0)}sumx2my2(e,t){return this.runFunction(e.args,t,this.metadata("SUMX2MY2"),(e,t)=>{let r=e.valuesFromTopLeftCorner(),n=t.valuesFromTopLeftCorner();if(r.length!==n.length)return new rK(d.NA,ej.EqualLength);let o=r.length,i=0;for(let e=0;e<o;e++){let t=r[e],o=n[e];if(t instanceof rK)return t;if(o instanceof rK)return o;"number"==typeof t&&"number"==typeof o&&(i+=Math.pow(t,2)-Math.pow(o,2))}return i})}sumx2py2(e,t){return this.runFunction(e.args,t,this.metadata("SUMX2PY2"),(e,t)=>{let r=e.valuesFromTopLeftCorner(),n=t.valuesFromTopLeftCorner();if(r.length!==n.length)return new rK(d.NA,ej.EqualLength);let o=r.length,i=0;for(let e=0;e<o;e++){let t=r[e],o=n[e];if(t instanceof rK)return t;if(o instanceof rK)return o;"number"==typeof t&&"number"==typeof o&&(i+=Math.pow(t,2)+Math.pow(o,2))}return i})}sumxmy2(e,t){return this.runFunction(e.args,t,this.metadata("SUMXMY2"),(e,t)=>{let r=e.valuesFromTopLeftCorner(),n=t.valuesFromTopLeftCorner();if(r.length!==n.length)return new rK(d.NA,ej.EqualLength);let o=r.length,i=0;for(let e=0;e<o;e++){let t=r[e],o=n[e];if(t instanceof rK)return t;if(o instanceof rK)return o;"number"==typeof t&&"number"==typeof o&&(i+=Math.pow(t-o,2))}return i})}}function aS(e,t){2*t>e&&(t=e-t);let r=1;for(let n=1;n<=t;n++)r*=(e-t+n)/n;return Math.round(r)}function av(e,t){for(e<t&&([e,t]=[t,e]);t>0;)[e,t]=[t,e%t];return e}aw.implementedFunctions={FACT:{method:"fact",parameters:[{argumentType:p.NUMBER,minValue:0,maxValue:170}]},FACTDOUBLE:{method:"factdouble",parameters:[{argumentType:p.NUMBER,minValue:0,maxValue:288}]},COMBIN:{method:"combin",parameters:[{argumentType:p.NUMBER,minValue:0,lessThan:1030},{argumentType:p.NUMBER,minValue:0}]},COMBINA:{method:"combina",parameters:[{argumentType:p.NUMBER,minValue:0},{argumentType:p.NUMBER,minValue:0}]},GCD:{method:"gcd",parameters:[{argumentType:p.ANY}],repeatLastArgs:1},LCM:{method:"lcm",parameters:[{argumentType:p.ANY}],repeatLastArgs:1},MROUND:{method:"mround",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER}]},MULTINOMIAL:{method:"multinomial",parameters:[{argumentType:p.NUMBER}],repeatLastArgs:1,expandRanges:!0},QUOTIENT:{method:"quotient",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER}]},SERIESSUM:{method:"seriessum",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER},{argumentType:p.NUMBER},{argumentType:p.RANGE}]},SIGN:{method:"sign",parameters:[{argumentType:p.NUMBER}]},SUMX2MY2:{method:"sumx2my2",parameters:[{argumentType:p.RANGE},{argumentType:p.RANGE}]},SUMX2PY2:{method:"sumx2py2",parameters:[{argumentType:p.RANGE},{argumentType:p.RANGE}]},SUMXMY2:{method:"sumxmy2",parameters:[{argumentType:p.RANGE},{argumentType:p.RANGE}]}};class aR extends nv{complex(e,t){return this.runFunction(e.args,t,this.metadata("COMPLEX"),(e,t,r)=>"i"!==r&&"j"!==r?new rK(d.VALUE,ej.ShouldBeIorJ):ni([e,t],r))}imabs(e,t){return this.runFunction(e.args,t,this.metadata("IMABS"),aO)}imaginary(e,t){return this.runFunction(e.args,t,this.metadata("IMAGINARY"),([e,t])=>t)}imreal(e,t){return this.runFunction(e.args,t,this.metadata("IMREAL"),([e,t])=>e)}imargument(e,t){return this.runFunction(e.args,t,this.metadata("IMARGUMENT"),([e,t])=>0===e&&0===t?new rK(d.DIV_BY_ZERO):Math.atan2(t,e))}imconjugate(e,t){return this.runFunction(e.args,t,this.metadata("IMCONJUGATE"),([e,t])=>ni([e,-t]))}imcos(e,t){return this.runFunction(e.args,t,this.metadata("IMCOS"),e=>ni(aA(e)))}imcosh(e,t){return this.runFunction(e.args,t,this.metadata("IMCOSH"),e=>ni(aM(e)))}imcot(e,t){return this.runFunction(e.args,t,this.metadata("IMCOT"),e=>ni(aT(aA(e),aI(e))))}imcsc(e,t){return this.runFunction(e.args,t,this.metadata("IMCSC"),e=>ni(aT([1,0],aI(e))))}imcsch(e,t){return this.runFunction(e.args,t,this.metadata("IMCSCH"),e=>ni(aT([1,0],ax(e))))}imsec(e,t){return this.runFunction(e.args,t,this.metadata("IMSEC"),e=>ni(aT([1,0],aA(e))))}imsech(e,t){return this.runFunction(e.args,t,this.metadata("IMSECH"),e=>ni(aT([1,0],aM(e))))}imsin(e,t){return this.runFunction(e.args,t,this.metadata("IMSIN"),e=>ni(aI(e)))}imsinh(e,t){return this.runFunction(e.args,t,this.metadata("IMSINH"),e=>ni(ax(e)))}imtan(e,t){return this.runFunction(e.args,t,this.metadata("IMTAN"),e=>ni(aT(aI(e),aA(e))))}imdiv(e,t){return this.runFunction(e.args,t,this.metadata("IMDIV"),(e,t)=>ni(aT(e,t)))}improduct(e,t){return this.runFunction(e.args,t,this.metadata("IMPRODUCT"),(...e)=>{let t=this.arithmeticHelper.coerceComplexExactRanges(e);if(t instanceof rK)return t;let r=[1,0];for(let e of t)r=aE(r,e);return ni(r)})}imsum(e,t){return this.runFunction(e.args,t,this.metadata("IMSUM"),(...e)=>{let t=this.arithmeticHelper.coerceComplexExactRanges(e);if(t instanceof rK)return t;let r=[0,0];for(let e of t)r=function([e,t],[r,n]){return[e+r,t+n]}(r,e);return ni(r)})}imsub(e,t){return this.runFunction(e.args,t,this.metadata("IMSUB"),(e,t)=>ni(function([e,t],[r,n]){return[e-r,t-n]}(e,t)))}imexp(e,t){return this.runFunction(e.args,t,this.metadata("IMEXP"),e=>ni(aN(e)))}imln(e,t){return this.runFunction(e.args,t,this.metadata("IMLN"),e=>ni(ak(e)))}imlog10(e,t){return this.runFunction(e.args,t,this.metadata("IMLOG10"),e=>{let[t,r]=ak(e),n=Math.log(10);return ni([t/n,r/n])})}imlog2(e,t){return this.runFunction(e.args,t,this.metadata("IMLOG2"),e=>{let[t,r]=ak(e),n=Math.log(2);return ni([t/n,r/n])})}impower(e,t){return this.runFunction(e.args,t,this.metadata("IMPOWER"),(e,t)=>ni(aH(e,t)))}imsqrt(e,t){return this.runFunction(e.args,t,this.metadata("IMSQRT"),e=>ni(aH(e,.5)))}}function aE([e,t],[r,n]){return[e*r-t*n,e*n+r*t]}function aT([e,t],[r,n]){let o=Math.pow(r,2)+Math.pow(n,2),[i,s]=aE([e,t],[r,-n]);return[i/o,s/o]}function aA([e,t]){return[Math.cos(e)*Math.cosh(t),-Math.sin(e)*Math.sinh(t)]}function aM([e,t]){return[Math.cosh(e)*Math.cos(t),Math.sinh(e)*Math.sin(t)]}function aI([e,t]){return[Math.sin(e)*Math.cosh(t),Math.cos(e)*Math.sinh(t)]}function ax([e,t]){return[Math.sinh(e)*Math.cos(t),Math.cosh(e)*Math.sin(t)]}function aN([e,t]){return[Math.exp(e)*Math.cos(t),Math.exp(e)*Math.sin(t)]}function aO([e,t]){return Math.sqrt(e*e+t*t)}function ak([e,t]){return[Math.log(aO([e,t])),Math.atan2(t,e)]}function aH(e,t){let[r,n]=ak(e);return aN([t*r,t*n])}aR.implementedFunctions={COMPLEX:{method:"complex",parameters:[{argumentType:p.NUMBER},{argumentType:p.NUMBER},{argumentType:p.STRING,defaultValue:"i"}]},IMABS:{method:"imabs",parameters:[{argumentType:p.COMPLEX}]},IMAGINARY:{method:"imaginary",parameters:[{argumentType:p.COMPLEX}]},IMREAL:{method:"imreal",parameters:[{argumentType:p.COMPLEX}]},IMARGUMENT:{method:"imargument",parameters:[{argumentType:p.COMPLEX}]},IMCONJUGATE:{method:"imconjugate",parameters:[{argumentType:p.COMPLEX}]},IMCOS:{method:"imcos",parameters:[{argumentType:p.COMPLEX}]},IMCOSH:{method:"imcosh",parameters:[{argumentType:p.COMPLEX}]},IMCOT:{method:"imcot",parameters:[{argumentType:p.COMPLEX}]},IMCSC:{method:"imcsc",parameters:[{argumentType:p.COMPLEX}]},IMCSCH:{method:"imcsch",parameters:[{argumentType:p.COMPLEX}]},IMSEC:{method:"imsec",parameters:[{argumentType:p.COMPLEX}]},IMSECH:{method:"imsech",parameters:[{argumentType:p.COMPLEX}]},IMSIN:{method:"imsin",parameters:[{argumentType:p.COMPLEX}]},IMSINH:{method:"imsinh",parameters:[{argumentType:p.COMPLEX}]},IMTAN:{method:"imtan",parameters:[{argumentType:p.COMPLEX}]},IMDIV:{method:"imdiv",parameters:[{argumentType:p.COMPLEX},{argumentType:p.COMPLEX}]},IMPRODUCT:{method:"improduct",parameters:[{argumentType:p.ANY}],repeatLastArgs:1},IMSUM:{method:"imsum",parameters:[{argumentType:p.ANY}],repeatLastArgs:1},IMSUB:{method:"imsub",parameters:[{argumentType:p.COMPLEX},{argumentType:p.COMPLEX}]},IMEXP:{method:"imexp",parameters:[{argumentType:p.COMPLEX}]},IMLN:{method:"imln",parameters:[{argumentType:p.COMPLEX}]},IMLOG10:{method:"imlog10",parameters:[{argumentType:p.COMPLEX}]},IMLOG2:{method:"imlog2",parameters:[{argumentType:p.COMPLEX}]},IMPOWER:{method:"impower",parameters:[{argumentType:p.COMPLEX},{argumentType:p.NUMBER}]},IMSQRT:{method:"imsqrt",parameters:[{argumentType:p.COMPLEX}]}};class a_ extends nv{avedev(e,t){return this.runFunction(e.args,t,this.metadata("AVEDEV"),(...e)=>{let t=this.arithmeticHelper.coerceNumbersExactRanges(e);if(t instanceof rK)return t;if(0===t.length)return new rK(d.DIV_BY_ZERO);let r=ag(t);return t.reduce((e,t)=>e+Math.abs(t-r),0)/t.length})}devsq(e,t){return this.runFunction(e.args,t,this.metadata("DEVSQ"),(...e)=>{let t=this.arithmeticHelper.coerceNumbersExactRanges(e);return t instanceof rK?t:0===t.length?0:ap(t)})}geomean(e,t){return this.runFunction(e.args,t,this.metadata("GEOMEAN"),(...e)=>{let t=this.arithmeticHelper.coerceNumbersExactRanges(e);if(t instanceof rK)return t;if(0===t.length)return new rK(d.NUM,ej.OneValue);for(let e of t)if(e<=0)return new rK(d.NUM,ej.ValueSmall);return Math.pow(function(e){for(var t=1,r=e.length;--r>=0;)t*=e[r];return t}(t),1/t.length)})}harmean(e,t){return this.runFunction(e.args,t,this.metadata("HARMEAN"),(...e)=>{let t=this.arithmeticHelper.coerceNumbersExactRanges(e);if(t instanceof rK)return t;if(0===t.length)return new rK(d.NUM,ej.OneValue);for(let e of t)if(e<=0)return new rK(d.NUM,ej.ValueSmall);return t.length/t.reduce((e,t)=>e+1/t,0)})}correl(e,t){return this.runFunction(e.args,t,this.metadata("CORREL"),(e,t)=>{if(e.numberOfElements()!==t.numberOfElements())return new rK(d.NA,ej.EqualLength);let r=aL(e,t);return r instanceof rK?r:r[0].length<=1?new rK(d.DIV_BY_ZERO,ej.TwoValues):aC(r[0],r[1])})}rsq(e,t){return this.runFunction(e.args,t,this.metadata("RSQ"),(e,t)=>{if(e.numberOfElements()!==t.numberOfElements())return new rK(d.NA,ej.EqualLength);let r=aL(e,t);return r instanceof rK?r:r[0].length<=1?new rK(d.DIV_BY_ZERO,ej.TwoValues):Math.pow(aC(r[0],r[1]),2)})}covariancep(e,t){return this.runFunction(e.args,t,this.metadata("COVARIANCE.P"),(e,t)=>{if(e.numberOfElements()!==t.numberOfElements())return new rK(d.NA,ej.EqualLength);let r=aL(e,t);if(r instanceof rK)return r;let n=r[0].length;return n<1?new rK(d.DIV_BY_ZERO,ej.OneValue):1===n?0:ab(r[0],r[1])*(n-1)/n})}covariances(e,t){return this.runFunction(e.args,t,this.metadata("COVARIANCE.S"),(e,t)=>{if(e.numberOfElements()!==t.numberOfElements())return new rK(d.NA,ej.EqualLength);let r=aL(e,t);return r instanceof rK?r:r[0].length<=1?new rK(d.DIV_BY_ZERO,ej.TwoValues):ab(r[0],r[1])})}ztest(e,t){return this.runFunction(e.args,t,this.metadata("Z.TEST"),(e,t,r)=>{let n=this.arithmeticHelper.manyToExactNumbers(e.valuesFromTopLeftCorner());if(n instanceof rK)return n;let o=n.length;if(void 0===r){if(o<2)return new rK(d.DIV_BY_ZERO,ej.TwoValues);r=af(n,!0)}return o<1?new rK(d.NA,ej.OneValue):0===r?new rK(d.DIV_BY_ZERO):1-s0((ag(n)-t)/(r/Math.sqrt(o)),0,1)})}ftest(e,t){return this.runFunction(e.args,t,this.metadata("F.TEST"),(e,t)=>{let r=this.arithmeticHelper.manyToExactNumbers(e.valuesFromTopLeftCorner()),n=this.arithmeticHelper.manyToExactNumbers(t.valuesFromTopLeftCorner());if(r instanceof rK)return r;if(n instanceof rK)return n;if(r.length<=1||n.length<=1)return new rK(d.DIV_BY_ZERO);let o=am(r,!0),i=am(n,!0);if(0===o||0===i)return new rK(d.DIV_BY_ZERO);let s=ai(o/i,r.length-1,n.length-1);return 2*Math.min(s,1-s)})}steyx(e,t){return this.runFunction(e.args,t,this.metadata("STEYX"),(e,t)=>{if(e.numberOfElements()!==t.numberOfElements())return new rK(d.NA,ej.EqualLength);let r=aL(e,t);if(r instanceof rK)return r;let n=r[0].length;return n<=2?new rK(d.DIV_BY_ZERO,ej.ThreeValues):Math.sqrt((ap(r[0])-Math.pow(ab(r[0],r[1])*(n-1),2)/ap(r[1]))/(n-2))})}slope(e,t){return this.runFunction(e.args,t,this.metadata("SLOPE"),(e,t)=>{if(e.numberOfElements()!==t.numberOfElements())return new rK(d.NA,ej.EqualLength);let r=aL(e,t);if(r instanceof rK)return r;let n=r[0].length;return n<=1?new rK(d.DIV_BY_ZERO,ej.TwoValues):ab(r[0],r[1])*(n-1)/ap(r[1])})}chisqtest(e,t){return this.runFunction(e.args,t,this.metadata("CHISQ.TEST"),(e,t)=>{let r=e.height(),n=e.width();if(t.height()!==r||t.width()!==n)return new rK(d.NA,ej.EqualLength);let o=aL(e,t);if(o instanceof rK)return o;if(o[0].length<=1)return new rK(d.DIV_BY_ZERO,ej.TwoValues);let i=0;for(let e=0;e<o[0].length;e++){if(0===o[1][e])return new rK(d.DIV_BY_ZERO);i+=Math.pow(o[0][e]-o[1][e],2)/o[1][e]}return i<0?new rK(d.NUM,ej.NaN):1-an(i,r>1&&n>1?(r-1)*(n-1):r*n-1)})}ttest(e,t){return this.runFunction(e.args,t,this.metadata("T.TEST"),(e,t,r,n)=>{let o=this.arithmeticHelper.manyToExactNumbers(e.valuesFromTopLeftCorner()),i=this.arithmeticHelper.manyToExactNumbers(t.valuesFromTopLeftCorner());if(o instanceof rK)return o;if(i instanceof rK)return i;let s=o.length,a=i.length;if(1===n){if(a!==s)return new rK(d.NA,ej.EqualLength);if(s<=1)return new rK(d.DIV_BY_ZERO,ej.TwoValues);let e=Array(s);for(let t=0;t<s;t++)e[t]=o[t]-i[t];let t=af(e,!0);return 0===t?new rK(d.DIV_BY_ZERO):r*(1-ah(Math.abs(Math.sqrt(s)*ag(e)/t),s-1))}if(2===n){if(s<=1||a<=1)return new rK(d.DIV_BY_ZERO,ej.TwoValues);let e=(ap(o)+ap(i))/(s+a-2);return 0===e?new rK(d.DIV_BY_ZERO):r*(1-ah(Math.abs((ag(o)-ag(i))/Math.sqrt(e*(1/s+1/a))),s+a-2))}{if(s<=1||a<=1)return new rK(d.DIV_BY_ZERO,ej.TwoValues);let e=am(o,!0),t=am(i,!0);return 0===e&&0===t?new rK(d.DIV_BY_ZERO):r*(1-ah(Math.abs((ag(o)-ag(i))/Math.sqrt(e/s+t/a)),Math.pow(e/s+t/a,2)/(Math.pow(e/s,2)/(s-1)+Math.pow(t/a,2)/(a-1))))}})}skew(e,t){return this.runFunction(e.args,t,this.metadata("SKEW"),(...e)=>{let t=this.arithmeticHelper.coerceNumbersExactRanges(e);if(t instanceof rK)return t;let r=t.length;if(r<3)return new rK(d.DIV_BY_ZERO,ej.ThreeValues);let n=ag(t),o=af(t,!0);return 0===o?new rK(d.DIV_BY_ZERO):t.reduce((e,t)=>e+Math.pow((t-n)/o,3),0)*r/(r-1)/(r-2)})}skewp(e,t){return this.runFunction(e.args,t,this.metadata("SKEW.P"),(...e)=>{let t=this.arithmeticHelper.coerceNumbersExactRanges(e);if(t instanceof rK)return t;let r=t.length;if(r<3)return new rK(d.DIV_BY_ZERO,ej.ThreeValues);let n=ag(t),o=af(t,!1);return 0===o?new rK(d.DIV_BY_ZERO):t.reduce((e,t)=>e+Math.pow((t-n)/o,3),0)/r})}}function aL(e,t){let r,n,o=e.iterateValuesFromTopLeftCorner(),i=t.iterateValuesFromTopLeftCorner(),s=[],a=[];for(;r=o.next(),n=i.next(),!r.done&&!n.done;){let e=r.value,t=n.value;if(e instanceof rK)return e;if(t instanceof rK)return t;tP(e)&&tP(t)&&(s.push(tI(e)),a.push(tI(t)))}return[s,a]}a_.implementedFunctions={AVEDEV:{method:"avedev",parameters:[{argumentType:p.ANY}],repeatLastArgs:1},DEVSQ:{method:"devsq",parameters:[{argumentType:p.ANY}],repeatLastArgs:1},GEOMEAN:{method:"geomean",parameters:[{argumentType:p.ANY}],repeatLastArgs:1},HARMEAN:{method:"harmean",parameters:[{argumentType:p.ANY}],repeatLastArgs:1},CORREL:{method:"correl",parameters:[{argumentType:p.RANGE},{argumentType:p.RANGE}]},RSQ:{method:"rsq",parameters:[{argumentType:p.RANGE},{argumentType:p.RANGE}]},"COVARIANCE.P":{method:"covariancep",parameters:[{argumentType:p.RANGE},{argumentType:p.RANGE}]},"COVARIANCE.S":{method:"covariances",parameters:[{argumentType:p.RANGE},{argumentType:p.RANGE}]},"Z.TEST":{method:"ztest",parameters:[{argumentType:p.RANGE},{argumentType:p.NUMBER},{argumentType:p.NUMBER,optionalArg:!0}]},"F.TEST":{method:"ftest",parameters:[{argumentType:p.RANGE},{argumentType:p.RANGE}]},STEYX:{method:"steyx",parameters:[{argumentType:p.RANGE},{argumentType:p.RANGE}]},SLOPE:{method:"slope",parameters:[{argumentType:p.RANGE},{argumentType:p.RANGE}]},"CHISQ.TEST":{method:"chisqtest",parameters:[{argumentType:p.RANGE},{argumentType:p.RANGE}]},"T.TEST":{method:"ttest",parameters:[{argumentType:p.RANGE},{argumentType:p.RANGE},{argumentType:p.INTEGER,minValue:1,maxValue:2},{argumentType:p.INTEGER,minValue:1,maxValue:3}]},SKEW:{method:"skew",parameters:[{argumentType:p.ANY}],repeatLastArgs:1},"SKEW.P":{method:"skewp",parameters:[{argumentType:p.ANY}],repeatLastArgs:1}},a_.aliases={COVAR:"COVARIANCE.P",FTEST:"F.TEST",PEARSON:"CORREL",ZTEST:"Z.TEST",CHITEST:"CHISQ.TEST",TTEST:"T.TEST",COVARIANCEP:"COVARIANCE.P",COVARIANCES:"COVARIANCE.S",SKEWP:"SKEW.P"};class aP extends ig{}aP.HyperFormula=ig,aP.ErrorType=d,aP.CellError=rK,aP.CellType=u,aP.CellValueType=r$,aP.CellValueDetailedType=rY,aP.DetailedCellError=nT,aP.ExportedCellChange=oq,aP.ExportedNamedExpressionChange=oK,aP.ConfigValueTooBigError=ro,aP.ConfigValueTooSmallError=rn,aP.EvaluationSuspendedError=rs,aP.ExpectedOneOfValuesError=ri,aP.ExpectedValueOfTypeError=rt,aP.ArraySize=nR,aP.SimpleRangeValue=tF,aP.EmptyValue=tM,aP.FunctionPlugin=nv,aP.FunctionArgumentType=p,aP.FunctionPluginValidationError=ru,aP.InvalidAddressError=t0,aP.InvalidArgumentsError=t1,aP.LanguageNotRegisteredError=rh,aP.LanguageAlreadyRegisteredError=rd,aP.MissingTranslationError=ra,aP.NamedExpressionDoesNotExistError=t5,aP.NamedExpressionNameIsAlreadyTakenError=t3,aP.NamedExpressionNameIsInvalidError=t6,aP.NoOperationToRedoError=t9,aP.NoOperationToUndoError=t4,aP.NoRelativeAddressesAllowedError=rm,aP.NoSheetWithIdError=tK,aP.NoSheetWithNameError=tX,aP.NotAFormulaError=tJ,aP.NothingToPasteError=t7,aP.ProtectedFunctionTranslationError=rl,aP.SheetNameAlreadyTakenError=tQ,aP.SheetSizeLimitExceededError=tZ,aP.SourceLocationHasArrayError=rg,aP.TargetLocationHasArrayError=rp,aP.UnableToParseError=re;let aD=im.defaultConfig.language;for(let e of(ig.registerLanguage(aD,iC),ig.languages[iC.langCode]=iC,Object.getOwnPropertyNames(eo)))e.startsWith("_")||ig.registerFunctionPlugin(eo[e]);window.HyperFormula=ig})(),(()=>{"use strict";let e,t,o,i;r.d(n,{default:()=>w7});var s={};r.r(s),r.d(s,{arrayAvg:()=>en,arrayEach:()=>J,arrayFilter:()=>Q,arrayFlatten:()=>function e(t){return X(t,(t,r)=>t.concat(Array.isArray(r)?e(r):r),[])},arrayMap:()=>Z,arrayMax:()=>et,arrayMin:()=>er,arrayReduce:()=>X,arraySum:()=>ee,arrayToString:()=>eu,arrayUnique:()=>es,extendArray:()=>q,getDifferenceOfArrays:()=>ea,getIntersectionOfArrays:()=>el,getUnionOfArrays:()=>eh,insertValuesInPlace:()=>ei,pivot:()=>K,removeIndexesInPlace:()=>eo,stringToArray:()=>ed,to2dArray:()=>j});var a={};r.r(a),r.d(a,{_BLOCKING_MODAL_STATES:()=>e3,_LICENSE_EXPIRED_TITLE:()=>eZ,_PURCHASE_LICENSE_TEXT:()=>eJ,_formatExpiryClause:()=>eX,_formatIsoDate:()=>e9,_getLicenseState:()=>te,_injectProductInfo:()=>e4,isDefined:()=>e_,isEmpty:()=>eP,isRegExp:()=>eD,isUndefined:()=>eL,stringify:()=>eH});var l={};r.r(l),r.d(l,{throwWithCause:()=>tr});var h={};r.r(h),r.d(h,{assignObjectDefaults:()=>tw,clone:()=>tl,createObjectPropListener:()=>tC,deepClone:()=>ta,deepExtend:()=>ts,deepMerge:()=>tS,deepObjectSize:()=>tb,defineGetter:()=>tg,duckSchema:()=>tn,extend:()=>ti,getProperty:()=>tm,hasOwnProperty:()=>ty,inherit:()=>to,isKeyValueObject:()=>tv,isObject:()=>tu,isObjectEqual:()=>td,isPlainObject:()=>tc,mixin:()=>th,objectEach:()=>tp,setProperty:()=>tf});var d={};r.r(d),r.d(d,{cancelAnimationFrame:()=>tE,cancelIdleTask:()=>tA,getComparisonFunction:()=>tx,isCSR:()=>tI,isTouchSupported:()=>tM,requestAnimationFrame:()=>tR,requestIdleTask:()=>tT});var u={};r.r(u),r.d(u,{isChrome:()=>tL,isChromeWebKit:()=>tP,isEdge:()=>tU,isEdgeWebKit:()=>tz,isFirefox:()=>tD,isFirefoxWebKit:()=>tF,isIOS:()=>tG,isIpadOS:()=>t$,isLinuxOS:()=>tq,isMacOS:()=>tj,isMobileBrowser:()=>tW,isSafari:()=>tB,isSafariBefore261:()=>tV,isWindowsOS:()=>tY,setBrowserMeta:()=>tH,setPlatformMeta:()=>t_});var c={};r.r(c),r.d(c,{HTML_CHARACTERS:()=>rf,SANITIZER_WARN_KEY:()=>rb,addClass:()=>rd,addEvent:()=>rz,clearTextSelection:()=>rj,closest:()=>re,closestDown:()=>rt,empty:()=>rm,eventTargetEl:()=>t4,fastInnerHTML:()=>rw,fastInnerText:()=>rS,findFirstParentWithClass:()=>rr,getCaretPosition:()=>rG,getChildEl:()=>ns,getCssTransform:()=>r0,getDeepActiveElement:()=>ni,getFractionalScalingCompensation:()=>rK,getFrameElement:()=>t9,getMaximumScrollLeft:()=>rO,getMaximumScrollTop:()=>rN,getParent:()=>t6,getParentWindow:()=>t7,getScrollLeft:()=>rI,getScrollTop:()=>rM,getScrollableElement:()=>rx,getScrollbarWidth:()=>rX,getSelectionEndPosition:()=>r$,getSelectionText:()=>rY,getShadowHostChain:()=>no,getStyle:()=>rP,getTrimmingContainer:()=>rL,getWindowScrollLeft:()=>rA,getWindowScrollTop:()=>rT,hasAccessToParentWindow:()=>t8,hasClass:()=>rh,hasHorizontalScrollbar:()=>rZ,hasVerticalScrollbar:()=>rQ,hasZeroHeight:()=>rR,index:()=>ro,innerHeight:()=>rV,innerWidth:()=>rU,isBottomMostColumnHeader:()=>rs,isChildOf:()=>rn,isDetached:()=>r5,isHTMLElement:()=>ne,isHTMLInputElement:()=>nr,isHTMLTableCellElement:()=>nt,isInput:()=>r2,isInternalElement:()=>t5,isOutsideInput:()=>r3,isShadowRoot:()=>nn,isVisible:()=>rv,makeElementContentEditableAndSelectItsContent:()=>r9,matchesCSSRules:()=>rD,missingSanitizerMessage:()=>rC,observeVisibilityChangeOnce:()=>r4,offset:()=>rE,outerHeight:()=>rB,outerWidth:()=>rF,overlayContainsElement:()=>ri,removeAttribute:()=>rg,removeClass:()=>ru,removeContentEditableFromElementAndDeselect:()=>r7,removeEvent:()=>rW,removeTextNodes:()=>rp,resetCssTransform:()=>r1,runWithSelectedContendEditableElement:()=>r8,selectElementIfAllowed:()=>r6,setAttribute:()=>rc,setCaretPosition:()=>rq,setOverlayPosition:()=>rJ});var g={};r.r(g),r.d(g,{curry:()=>ng,curryRight:()=>np,debounce:()=>nd,fastCall:()=>nm,isFunction:()=>na,partial:()=>nc,pipe:()=>nu,throttle:()=>nl,throttleAfterHits:()=>nh});var p={};r.r(p),r.d(p,{KEY_CODES:()=>nf,isCtrlKey:()=>nw,isCtrlMetaKey:()=>nS,isFunctionKey:()=>ny,isKey:()=>nv,isPrintableChar:()=>nC});var m={};r.r(m),r.d(m,{getFirstChangedTouch:()=>nN,getTouchPointById:()=>nO,hasTouchList:()=>nx,isImmediatePropagationStopped:()=>nE,isLeftClick:()=>nA,isMiddleClick:()=>nM,isRightClick:()=>nT,isTouchEvent:()=>nI,offsetRelativeTo:()=>nk,stopImmediatePropagation:()=>nR});var f={};r.r(f),r.d(f,{_dataToHTML:()=>ot,htmlToGridSettings:()=>os,instanceToHTML:()=>oe,replaceTdCellsWithTextContent:()=>oi});var b={};r.r(b),r.d(b,{equalsIgnoreCase:()=>ol,escapeHtml:()=>op,isJSON:()=>od,isPercentValue:()=>ou,localeLowerCase:()=>ow,randomString:()=>oh,sanitize:()=>om,stripTags:()=>oc,substitute:()=>tK,toHyphen:()=>of,toUpperCaseFirst:()=>oa});var C={};r.r(C),r.d(C,{clamp:()=>ox,getParsedNumber:()=>oN,isCommaThousandsGroupedInteger:()=>oR,isDotThousandsGroupedFloat:()=>oT,isDotThousandsGroupedInteger:()=>oE,isLossyNumericConversion:()=>ok,isNumeric:()=>oS,isNumericLike:()=>ov,isUnsignedNumber:()=>oH,rangeEach:()=>oA,rangeEachReverse:()=>oM,valueAccordingPercent:()=>oI});var y={};r.r(y),r.d(y,{cloneRow:()=>af,countFirstRowKeys:()=>ag,createEmptySpreadsheetData:()=>ad,createSpreadsheetData:()=>al,createSpreadsheetObjectData:()=>ah,dataRowToChangesArray:()=>au,hasChangeForCell:()=>ac,isArrayOfArrays:()=>ap,isArrayOfObjects:()=>am,spreadsheetColumnIndex:()=>aa,spreadsheetColumnLabel:()=>as});var w={};r.r(w),r.d(w,{CANCEL:()=>aG,CHECKBOX_CHECKED:()=>hg,CHECKBOX_RENDERER_NAMESPACE:()=>hc,CHECKBOX_UNCHECKED:()=>hp,COMMON_NAMESPACE:()=>az,CONTEXTMENU_ITEMS_ADD_COMMENT:()=>li,CONTEXTMENU_ITEMS_ALIGNMENT:()=>lh,CONTEXTMENU_ITEMS_ALIGNMENT_BOTTOM:()=>lf,CONTEXTMENU_ITEMS_ALIGNMENT_CENTER:()=>lu,CONTEXTMENU_ITEMS_ALIGNMENT_JUSTIFY:()=>lg,CONTEXTMENU_ITEMS_ALIGNMENT_LEFT:()=>ld,CONTEXTMENU_ITEMS_ALIGNMENT_MIDDLE:()=>lm,CONTEXTMENU_ITEMS_ALIGNMENT_RIGHT:()=>lc,CONTEXTMENU_ITEMS_ALIGNMENT_TOP:()=>lp,CONTEXTMENU_ITEMS_BORDERS:()=>lb,CONTEXTMENU_ITEMS_BORDERS_BOTTOM:()=>lw,CONTEXTMENU_ITEMS_BORDERS_LEFT:()=>lS,CONTEXTMENU_ITEMS_BORDERS_RIGHT:()=>ly,CONTEXTMENU_ITEMS_BORDERS_TOP:()=>lC,CONTEXTMENU_ITEMS_CLEAR_COLUMN:()=>a2,CONTEXTMENU_ITEMS_COPY:()=>a3,CONTEXTMENU_ITEMS_COPY_COLUMN_HEADERS_ONLY:()=>a4,CONTEXTMENU_ITEMS_COPY_WITH_COLUMN_GROUP_HEADERS:()=>a5,CONTEXTMENU_ITEMS_COPY_WITH_COLUMN_HEADERS:()=>a6,CONTEXTMENU_ITEMS_CUT:()=>a9,CONTEXTMENU_ITEMS_EDIT_COMMENT:()=>ls,CONTEXTMENU_ITEMS_EXPORT:()=>a7,CONTEXTMENU_ITEMS_EXPORT_FILE_CSV:()=>a8,CONTEXTMENU_ITEMS_EXPORT_FILE_XLSX:()=>le,CONTEXTMENU_ITEMS_FREEZE_COLUMN:()=>lt,CONTEXTMENU_ITEMS_HIDE_COLUMN:()=>lT,CONTEXTMENU_ITEMS_HIDE_ROW:()=>lM,CONTEXTMENU_ITEMS_INSERT_LEFT:()=>aK,CONTEXTMENU_ITEMS_INSERT_RIGHT:()=>aX,CONTEXTMENU_ITEMS_MERGE_CELLS:()=>ln,CONTEXTMENU_ITEMS_NESTED_ROWS_DETACH_CHILD:()=>lE,CONTEXTMENU_ITEMS_NESTED_ROWS_INSERT_CHILD:()=>lR,CONTEXTMENU_ITEMS_NO_ITEMS:()=>aY,CONTEXTMENU_ITEMS_READ_ONLY:()=>a1,CONTEXTMENU_ITEMS_READ_ONLY_COMMENT:()=>ll,CONTEXTMENU_ITEMS_REDO:()=>a0,CONTEXTMENU_ITEMS_REMOVE_BORDERS:()=>lv,CONTEXTMENU_ITEMS_REMOVE_COLUMN:()=>aZ,CONTEXTMENU_ITEMS_REMOVE_COMMENT:()=>la,CONTEXTMENU_ITEMS_REMOVE_ROW:()=>aQ,CONTEXTMENU_ITEMS_ROW_ABOVE:()=>aj,CONTEXTMENU_ITEMS_ROW_BELOW:()=>aq,CONTEXTMENU_ITEMS_SHOW_COLUMN:()=>lA,CONTEXTMENU_ITEMS_SHOW_ROW:()=>lI,CONTEXTMENU_ITEMS_UNDO:()=>aJ,CONTEXTMENU_ITEMS_UNFREEZE_COLUMN:()=>lr,CONTEXTMENU_ITEMS_UNMERGE_CELLS:()=>lo,CONTEXT_MENU_ITEMS_NAMESPACE:()=>a$,DATA_PROVIDER_BUTTONS_REFETCH:()=>hL,DATA_PROVIDER_ERRORS_CREATE:()=>hO,DATA_PROVIDER_ERRORS_FETCH:()=>hN,DATA_PROVIDER_ERRORS_REMOVE:()=>hH,DATA_PROVIDER_ERRORS_REQUEST_FAILED:()=>h_,DATA_PROVIDER_ERRORS_UPDATE:()=>hk,DATA_PROVIDER_NAMESPACE:()=>hx,EMPTY_DATA_STATE_BUTTONS_FILTERS_RESET:()=>hA,EMPTY_DATA_STATE_DESCRIPTION:()=>hR,EMPTY_DATA_STATE_DESCRIPTION_FILTERS:()=>hT,EMPTY_DATA_STATE_DESCRIPTION_LOADING:()=>hI,EMPTY_DATA_STATE_NAMESPACE:()=>hS,EMPTY_DATA_STATE_TITLE:()=>hv,EMPTY_DATA_STATE_TITLE_FILTERS:()=>hE,EMPTY_DATA_STATE_TITLE_LOADING:()=>hM,EXPORT_FILE_DIALOG_TITLE:()=>hw,EXPORT_FILE_NAMESPACE:()=>hy,FILTERS_BUTTONS_CANCEL:()=>l7,FILTERS_BUTTONS_CLEAR:()=>l4,FILTERS_BUTTONS_OK:()=>l9,FILTERS_BUTTONS_PLACEHOLDER_SEARCH:()=>l8,FILTERS_BUTTONS_PLACEHOLDER_SECOND_VALUE:()=>ht,FILTERS_BUTTONS_PLACEHOLDER_VALUE:()=>he,FILTERS_BUTTONS_SELECT_ALL:()=>l5,FILTERS_CONDITIONS_AFTER:()=>lj,FILTERS_CONDITIONS_AFTER_OR_EQUAL:()=>lq,FILTERS_CONDITIONS_BEFORE:()=>lK,FILTERS_CONDITIONS_BEFORE_OR_EQUAL:()=>lX,FILTERS_CONDITIONS_BEGINS_WITH:()=>lP,FILTERS_CONDITIONS_BETWEEN:()=>l$,FILTERS_CONDITIONS_BY_VALUE:()=>lV,FILTERS_CONDITIONS_CONTAINS:()=>lF,FILTERS_CONDITIONS_EMPTY:()=>lk,FILTERS_CONDITIONS_ENDS_WITH:()=>lD,FILTERS_CONDITIONS_EQUAL:()=>l_,FILTERS_CONDITIONS_GREATER_THAN:()=>lU,FILTERS_CONDITIONS_GREATER_THAN_OR_EQUAL:()=>lz,FILTERS_CONDITIONS_LESS_THAN:()=>lW,FILTERS_CONDITIONS_LESS_THAN_OR_EQUAL:()=>lG,FILTERS_CONDITIONS_NAMESPACE:()=>lN,FILTERS_CONDITIONS_NONE:()=>lO,FILTERS_CONDITIONS_NOT_BETWEEN:()=>lY,FILTERS_CONDITIONS_NOT_CONTAIN:()=>lB,FILTERS_CONDITIONS_NOT_EMPTY:()=>lH,FILTERS_CONDITIONS_NOT_EQUAL:()=>lL,FILTERS_CONDITIONS_TODAY:()=>lQ,FILTERS_CONDITIONS_TOMORROW:()=>lZ,FILTERS_CONDITIONS_YESTERDAY:()=>lJ,FILTERS_DIVS_FILTER_BY_CONDITION:()=>l0,FILTERS_DIVS_FILTER_BY_VALUE:()=>l1,FILTERS_LABELS_CONJUNCTION:()=>l2,FILTERS_LABELS_DISJUNCTION:()=>l3,FILTERS_NAMESPACE:()=>lx,FILTERS_VALUES_BLANK_CELLS:()=>l6,LOADING_NAMESPACE:()=>hm,LOADING_TITLE:()=>hf,NOTIFICATION_BUTTONS_CLOSE:()=>hC,NOTIFICATION_NAMESPACE:()=>hb,OK:()=>aW,PAGINATION_COUNTER_SECTION:()=>hs,PAGINATION_FIRST_PAGE:()=>hl,PAGINATION_LAST_PAGE:()=>hu,PAGINATION_NAMESPACE:()=>hr,PAGINATION_NAV_SECTION:()=>ha,PAGINATION_NEXT_PAGE:()=>hd,PAGINATION_PAGE_SIZE_AUTO:()=>ho,PAGINATION_PAGE_SIZE_SECTION:()=>hi,PAGINATION_PREV_PAGE:()=>hh,PAGINATION_SECTION:()=>hn});var S={};r.r(S),r.d(S,{ISO_DATETIME_REGEX:()=>cN,ISO_DATE_REGEX:()=>cS,TIME_REGEX:()=>cM,getNormalizedDate:()=>cv,getRelativeLocalDate:()=>c_,getTodayLocalDate:()=>cH,isSameLocalDay:()=>cL,isValidISODate:()=>cA,isValidISODateTime:()=>ck,isValidTime:()=>cx,parseToLocalDate:()=>cR,parseToLocalDateTime:()=>cO,parseToLocalTime:()=>cI});let v=e=>["tabindex",e],R=()=>["role","presentation"],E=()=>["role","gridcell"],T=()=>["role","gridcell button"],A=()=>["role","rowheader"],M=()=>["role","rowgroup"],I=()=>["role","columnheader"],x=()=>["role","row"],N=()=>["role","listbox"],O=()=>["scope","col"],k=()=>["scope","row"],H=e=>["aria-label",e],_=()=>["aria-hidden","true"],L=function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];return["aria-disabled",e]},P=e=>["aria-haspopup",e],D=e=>["aria-rowcount",e],F=e=>["aria-colcount",e],B=e=>["aria-rowindex",e],V=e=>["aria-colindex",e],U=e=>["aria-expanded",e],z=()=>["aria-readonly","true"],W=()=>["aria-invalid","true"],G=e=>["aria-checked",e],$=()=>["aria-selected","true"],Y=()=>["aria-busy","true"];function j(e){let t=e.length,r=0;for(;r<t;)e[r]=[e[r]],r+=1}function q(e,t){let r=t.length,n=0;for(;n<r;)e.push(t[n]),n+=1}function K(e){let t=[];if(!e||0===e.length||!e[0]||0===e[0].length)return t;let r=e.length,n=e[0].length;for(let o=0;o<r;o++)for(let r=0;r<n;r++)t[r]||(t[r]=[]),t[r][o]=e[o][r];return t}function X(e,t,r,n){let o=-1,i=Array.isArray(e)?e:Array.from(e),s=i.length;n&&s&&(o+=1,r=i[o]);let a=r;for(o+=1;o<s;)a=t(a,i[o],o,i),o+=1;return a}function Q(e,t){let r=0,n=Array.isArray(e)?e:Array.from(e),o=n.length,i=[],s=-1;for(;r<o;){let e=n[r];t(e,r,n)&&(i[s+=1]=e),r+=1}return i}function Z(e,t){let r=0,n=Array.isArray(e)?e:Array.from(e),o=n.length,i=[],s=-1;for(;r<o;){let e=n[r];i[s+=1]=t(e,r,n),r+=1}return i}function J(e,t){let r,n=0,o=(r=Array.isArray(e)?e:Array.from(e)).length;for(;n<o&&!1!==t(r[n],n,r);)n+=1;return r}function ee(e){return X(e,(e,t)=>e+t,0)}function et(e){return X(e,(e,t)=>void 0!==e&&e>t?e:t,e[0])}function er(e){return X(e,(e,t)=>void 0!==e&&e<t?e:t,e[0])}function en(e){return e.length?ee(e)/e.length:0}function eo(e,t){let r=0;for(let n=0;n<e.length;n++)t.has(n)||(e[r]=e[n],r+=1);return e.length=r,e}function ei(e,t,r,n){if(r<=0)return e;let o=e.length,i=Math.min(t,o);e.length=o+r;for(let t=o-1;t>=i;t--)e[t+r]=e[t];return e.fill(n,i,i+r),e}function es(e){let t=[],r=new Set;return J(e,e=>{r.has(e)||(r.add(e),t.push(e))}),t}function ea(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];let[n,...o]=[...t],i=n;return J(o,e=>{let t=new Set(e);i=i.filter(e=>!t.has(e))}),i}function el(){let e;for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];let o=[];J(r,(t,n)=>{"function"==typeof t?n===r.length-1&&(e=t):o.push(t)});let[i,...s]=o,a=i;return J(s,t=>{if(e)a=a.filter(r=>t.some(t=>e(r,t)));else{let e=new Set(t);a=a.filter(t=>e.has(t))}}),a}function eh(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];let[n,...o]=[...t],i=new Set(n);return J(o,e=>{J(e,e=>{i.has(e)||i.add(e)})}),Array.from(i)}function ed(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ";return e.split(t)}function eu(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ";return e.join(t)}function ec(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return X(Array.from(e),(e,t,n)=>e+t.replace(/\r?\n\s*/g,"")+(r[n]?r[n]:""),"").trim()}function eg(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];let o=document.createElement("template");o.innerHTML=Array.from(e).reduce((e,t,n)=>e+t+(r[n]??""),"");let i=o.content.cloneNode(!0),s={};return i.querySelectorAll("[data-ref]").forEach(e=>{let t=e.dataset.ref??null;delete e.dataset.ref,null!==t&&(s[t]=e)}),{fragment:i,refs:s}}let ep={"non-commercial-and-evaluation":"non-commercial-and-evaluation"},em=/^[0-9a-fA-F]{25}$/;function ef(e){return"entitlement"===function(e){if("string"!=typeof e)return"unknown";let t=e.trim(),r=t.toLowerCase();if(Object.prototype.hasOwnProperty.call(ep,r))return ep[r];let n=t.lastIndexOf("[");return -1!==n&&-1!==t.indexOf("]",n)?"entitlement":em.test(t.replace(/-/g,""))?"legacy":"unknown"}(e)}let eb=["usage_until","release_until"],eC=[0x428a2f98,0xd728ae22,0x71374491,0x23ef65cd,0xb5c0fbcf,0xec4d3b2f,0xe9b5dba5,0x8189dbbc,0x3956c25b,0xf348b538,0x59f111f1,0xb605d019,0x923f82a4,0xaf194f9b,0xab1c5ed5,0xda6d8118,0xd807aa98,0xa3030242,0x12835b01,0x45706fbe,0x243185be,0x4ee4b28c,0x550c7dc3,0xd5ffb4e2,0x72be5d74,0xf27b896f,0x80deb1fe,0x3b1696b1,0x9bdc06a7,0x25c71235,0xc19bf174,0xcf692694,0xe49b69c1,0x9ef14ad2,0xefbe4786,0x384f25e3,0xfc19dc6,0x8b8cd5b5,0x240ca1cc,0x77ac9c65,0x2de92c6f,0x592b0275,0x4a7484aa,0x6ea6e483,0x5cb0a9dc,0xbd41fbd4,0x76f988da,0x831153b5,0x983e5152,0xee66dfab,0xa831c66d,0x2db43210,0xb00327c8,0x98fb213f,0xbf597fc7,0xbeef0ee4,0xc6e00bf3,0x3da88fc2,0xd5a79147,0x930aa725,0x6ca6351,0xe003826f,0x14292967,0xa0e6e70,0x27b70a85,0x46d22ffc,0x2e1b2138,0x5c26c926,0x4d2c6dfc,0x5ac42aed,0x53380d13,0x9d95b3df,0x650a7354,0x8baf63de,0x766a0abb,0x3c77b2a8,0x81c2c92e,0x47edaee6,0x92722c85,0x1482353b,0xa2bfe8a1,0x4cf10364,0xa81a664b,0xbc423001,0xc24b8b70,0xd0f89791,0xc76c51a3,0x654be30,0xd192e819,0xd6ef5218,0xd6990624,0x5565a910,0xf40e3585,0x5771202a,0x106aa070,0x32bbd1b8,0x19a4c116,0xb8d2d0c8,0x1e376c08,0x5141ab53,0x2748774c,0xdf8eeb99,0x34b0bcb5,0xe19b48a8,0x391c0cb3,0xc5c95a63,0x4ed8aa4a,0xe3418acb,0x5b9cca4f,0x7763e373,0x682e6ff3,0xd6b2b8a3,0x748f82ee,0x5defb2fc,0x78a5636f,0x43172f60,0x84c87814,0xa1f0ab72,0x8cc70208,0x1a6439ec,0x90befffa,0x23631e28,0xa4506ceb,0xde82bde9,0xbef9a3f7,0xb2c67915,0xc67178f2,0xe372532b,0xca273ece,0xea26619c,0xd186b8c7,0x21c0c207,0xeada7dd6,0xcde0eb1e,0xf57d4f7f,0xee6ed178,0x6f067aa,0x72176fba,0xa637dc5,0xa2c898a6,0x113f9804,0xbef90dae,0x1b710b35,0x131c471b,0x28db77f5,0x23047d84,0x32caab7b,0x40c72493,0x3c9ebe0a,0x15c9bebc,0x431d67c4,0x9c100d4c,0x4cc5d4be,0xcb3e42b6,0x597f299c,0xfc657e2a,0x5fcb6fab,0x3ad6faec,0x6c44198c,0x4a475817];function ey(e){return`00000000${(e>>>0).toString(16)}`.slice(-8)}function ew(e){let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(`${e}`);if(null===t)return null;let r=parseInt(t[1],10),n=parseInt(t[2],10),o=parseInt(t[3],10);if(r<100)return null;let i=Date.UTC(r,n-1,o),s=new Date(i);return s.getUTCFullYear()!==r||s.getUTCMonth()!==n-1||s.getUTCDate()!==o?null:i}let eS=/^[A-Za-z0-9\-_]+$/,ev=/^[0-9a-f]+$/;function eR(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function eE(e){return"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e&&e>=0}function eT(e){return Array.isArray(e)&&e.every(e=>"string"==typeof e)}function eA(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:!0,writable:!0,configurable:!0})}let eM=null,eI=null;function ex(e,t){var r;if(r=e.products,!Object.prototype.hasOwnProperty.call(r,t))return null;let n=e.products[t];return eR(n)?n:null}let eN=Object.freeze({unrestricted:!0,products:Object.freeze({})});function eO(e){return 864e5*Math.floor(e/864e5)}function ek(e,t){return(e-eO(t))/864e5}function eH(e){let t;switch(typeof e){case"string":case"number":t=`${e}`;break;case"object":t=null===e?"":e.toString();break;case"undefined":t="";break;default:t=e.toString()}return t}function e_(e){return void 0!==e}function eL(e){return void 0===e}function eP(e){return null===e||""===e||eL(e)}function eD(e){return"[object RegExp]"===Object.prototype.toString.call(e)}let eF="length",eB=e=>parseInt(e,16),eV=e=>parseInt(e,10),eU=(e,t,r)=>e.substr(t,r),ez=e=>(e.codePointAt(0)??0)-65,eW=e=>`${e}`.replace(/\-/g,""),eG=e=>eB(eU(eW(e),eB("12"),ez("F")))/(eB(eU(eW(e),ez("B"),~~![][eF]))||9),e$=()=>"u">typeof location&&/^([a-z0-9\-]+\.)?\x68\x61\x6E\x64\x73\x6F\x6E\x74\x61\x62\x6C\x65\x2E\x63\x6F\x6D$/i.test(location.host),eY=!1,ej=new Set,eq={invalid:()=>ec`
    The license key for Handsontable is invalid.\x20
    If you need any help, contact us at support@handsontable.com.`,expired:e=>{let{keyValidityDate:t,hotVersion:r}=e;return ec`
    The license key for Handsontable expired on ${t}, and is not valid for the installed\x20
    version ${r}. Renew your license key at handsontable.com or downgrade to a version released prior\x20
    to ${t}. If you need any help, contact us at sales@handsontable.com.`},missing:()=>ec`
    The license key for Handsontable is missing. Use your purchased key to activate the product.\x20
    Alternatively, you can activate Handsontable to use for non-commercial purposes by\x20
    passing the key: 'non-commercial-and-evaluation'. If you need any help, contact\x20
    us at support@handsontable.com.`,non_commercial:()=>""},eK={invalid:()=>ec`
    The license key for Handsontable is invalid.\x20
    <a href="https://handsontable.com/docs/tutorial-license-key.html" target="_blank">Read more</a> on how to\x20
    install it properly or contact us at <a href="mailto:support@handsontable.com">support@handsontable.com</a>.`,expired:e=>{let{keyValidityDate:t,hotVersion:r}=e;return ec`
    The license key for Handsontable expired on ${t}, and is not valid for the installed\x20
    version ${r}. <a href="https://handsontable.com/pricing" target="_blank">Renew</a> your\x20
    license key or downgrade to a version released prior to ${t}. If you need any\x20
    help, contact us at <a href="mailto:sales@handsontable.com">sales@handsontable.com</a>.`},missing:()=>ec`
    The license key for Handsontable is missing. Use your purchased key to activate the product.\x20
    Alternatively, you can activate Handsontable to use for non-commercial purposes by\x20
    passing the key: 'non-commercial-and-evaluation'.\x20
    <a href="https://handsontable.com/docs/tutorial-license-key.html" target="_blank">Read more</a> about it in\x20
    the documentation or contact us at <a href="mailto:support@handsontable.com">support@handsontable.com</a>.`,non_commercial:()=>""};function eX(e){return 0===e?"expires today":`expires in ${e} ${1===e?"day":"days"}`}function eQ(e){return`${e} (UTC)`}let eZ="Your Handsontable license key has expired.",eJ="To continue using Handsontable, you need to purchase a license.";function e0(e){let{licensedUntil:t}=e;return ec`
    Your Handsontable subscription license expired on ${eQ(t)}. To continue using the\x20
    software, contact sales@handsontable.com to purchase a valid license key.`}let e1={trial_notice:{severity:"warn",message:e=>{let{daysRemaining:t}=e;return ec`
      Your Handsontable license key ${eX(t)}.\x20
      ${eJ}`}},trial_soft_stop:{severity:"error",message:e=>{let{licensedUntil:t}=e;return ec`
      Your Handsontable trial license key expired on ${eQ(t)}.\x20
      ${eJ}`}},trial_hard_stop:{severity:"error",message:e=>{let{licensedUntil:t}=e;return ec`
      Your Handsontable trial license key expired on ${eQ(t)}. You may no longer use\x20
      Handsontable under the trial license. To continue using the software, contact\x20
      sales@handsontable.com to purchase a valid license.`}},usage_notice:{severity:"warn",message:e=>{let{licensedUntil:t}=e;return ec`
      Your Handsontable subscription license expires on ${eQ(t)}.\x20
      To renew your license, contact sales@handsontable.com.`}},usage_soft_stop:{severity:"error",message:e0},usage_hard_stop:{severity:"error",message:e0},release_expired:{severity:"error",message:e=>{let{licensedUntil:t,hotVersion:r}=e;return ec`
      The license key for Handsontable expired on ${t}, and is not valid for the installed\x20
      version ${r}. Renew your license key or downgrade to a version released on or before\x20
      ${t}. If you need any help, contact us at sales@handsontable.com.`}}},e2={trial_soft_stop:()=>ec`
    ${eZ} ${eJ}\x20
    <a href="mailto:sales@handsontable.com">Contact Sales</a>.`,release_expired:e=>{let{licensedUntil:t,hotVersion:r}=e;return ec`
    The license key for Handsontable expired on ${t}, and is not valid for the installed\x20
    version ${r}. <a href="https://handsontable.com/pricing" target="_blank">Renew</a> your license\x20
    key or downgrade to a version released on or before ${t}. If you need any help, contact us\x20
    at <a href="mailto:sales@handsontable.com">sales@handsontable.com</a>.`}},e3=Object.freeze(["trial_hard_stop","invalid","missing"]);function e6(e){return -1!==e3.indexOf(e)}function e5(e){return"string"==typeof e?e.trim():e}function e4(e){let t,{className:r,key:n,element:o,releaseDate:i}=e;if(ef(n=e5(n)))return function(e){let{className:t,key:r,element:n,releaseDate:o}=e;if(e$())return null;let{lifecycle:i,channels:s}=te(r,o),{state:a}=i,l={daysRemaining:i.daysRemaining,licensedUntil:i.licensedUntil??void 0,hotVersion:"18.1.0"};if(s.console&&!ej.has(r??"")){let e="invalid"===a?{severity:"warn",message:()=>eq.invalid({})}:e1[a];e&&(console[e.severity](e.message(l)),ej.add(r??""))}if(!s.ui||!n||e6(a))return null;let h=e2[a];if(!h)return null;let d=n.ownerDocument,u=d.createElement("div"),c=d.createElement("div");return u.className=`handsontable ${t}`,c.className=`${t}_inner`,c.innerHTML=h(l),u.appendChild(c),n.appendChild(u),u}({className:r,key:n,element:o,releaseDate:i});let s=!eP(n),a="string"==typeof n&&("non-commercial-and-evaluation"===n.toLowerCase()||"ht68e-1f2b7-47158-70b05-0842f"===n.toLowerCase()),l="18.1.0",h="invalid",d="invalid",u=tt(n=eW(n||""));if(a)h="non_commercial",d="valid";else if(s||u)if(u){let[e,r,o]=(i??"01/09/2026"??"").split("/").map(Number),s=Math.floor(Date.UTC(o,r-1,e)/864e5),a=eG(n);t=new Intl.DateTimeFormat("en-US",{year:"numeric",month:"long",day:"2-digit",timeZone:"UTC"}).format((a+1)*864e5),s>a?(h="expired",d="expired"):(h="valid",d="valid")}else h="invalid",d="invalid";else h="missing",d="missing";if(e$()&&(h="valid",d="valid"),eY||"valid"===h||(eq[h]({keyValidityDate:t,hotVersion:l})&&console["non_commercial"===h?"info":"warn"](eq[h]({keyValidityDate:t,hotVersion:l})),eY=!0),"valid"!==d&&!e6(d)&&o&&eK[d]({keyValidityDate:t,hotVersion:l})){let e=document.createElement("div"),n=document.createElement("div");return e.className=`handsontable ${r}`,n.className=`${r}_inner`,n.innerHTML=eK[d]({keyValidityDate:t,hotVersion:l}),e.appendChild(n),o.appendChild(e),e}return null}function e9(e){return new Date(e).toISOString().slice(0,10)}let e7=Object.freeze({console:!0,ui:!0});function e8(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return{state:e,isTrial:!1,daysRemaining:null,licensedUntil:t}}function te(e,t){let r,n,o=e5(e);if(e$())return{lifecycle:e8("legacy_valid"),channels:e7,grants:eN};if(!ef(o))return{lifecycle:function(e,t){if("string"==typeof e&&("non-commercial-and-evaluation"===e.toLowerCase()||"ht68e-1f2b7-47158-70b05-0842f"===e.toLowerCase()))return e8("non_commercial");if(eP(e))return e8("missing");let r=eW(e||"");if(!tt(r))return e8("invalid");let[n,o,i]=(t??"01/09/2026"??"").split("/").map(Number),s=Math.floor(Date.UTC(i,o-1,n)/864e5),a=eG(r);return s>a?e8("legacy_expired",e9((a+1)*864e5)):e8("legacy_valid")}(o,t),channels:e7,grants:eN};let i=((r=`${o}`)!==eM&&(eM=r,eI=function(e){let t,r,n=e.lastIndexOf("[");if(-1===n)return null;let o=e.indexOf("]",n);if(-1===o)return null;let i=e.slice(n+1,o);if(i.length<=128)return null;let s=i.slice(0,-128),a=i.slice(-128);if(!eS.test(s)||!ev.test(a)||function(e){let t=e.length,r=Math.ceil((t+17)/128),n=new Uint8Array(128*r);n.set(e),n[t]=128;let o=8*t,i=n.length;n[i-7]=255&Math.floor(o/0x1000000000000),n[i-6]=255&Math.floor(o/0x10000000000),n[i-5]=255&Math.floor(o/0x100000000),n[i-4]=o>>>24&255,n[i-3]=o>>>16&255,n[i-2]=o>>>8&255,n[i-1]=255&o;let s=[0x6a09e667,0xf3bcc908,0xbb67ae85,0x84caa73b,0x3c6ef372,0xfe94f82b,0xa54ff53a,0x5f1d36f1,0x510e527f,0xade682d1,0x9b05688c,0x2b3e6c1f,0x1f83d9ab,0xfb41bd6b,0x5be0cd19,0x137e2179],a=Array(80),l=Array(80);for(let e=0;e<r;e+=1){let t=128*e;for(let e=0;e<16;e+=1){let r=t+8*e;a[e]=(n[r]<<24|n[r+1]<<16|n[r+2]<<8|n[r+3])>>>0,l[e]=(n[r+4]<<24|n[r+5]<<16|n[r+6]<<8|n[r+7])>>>0}for(let e=16;e<80;e+=1){let t=a[e-2],r=l[e-2],n=a[e-15],o=l[e-15],i=(t>>>19|r<<13)^(r>>>29|t<<3)^t>>>6,s=(n>>>1|o<<31)^(n>>>8|o<<24)^n>>>7,h=(o>>>1|n<<31)^(o>>>8|n<<24)^(o>>>7|n<<25),d=(((r>>>19|t<<13)^(t>>>29|r<<3)^(r>>>6|t<<26))>>>0)+(l[e-7]>>>0)+(h>>>0)+(l[e-16]>>>0);l[e]=d>>>0,a[e]=(i>>>0)+(a[e-7]>>>0)+(s>>>0)+(a[e-16]>>>0)+Math.floor(d/0x100000000)>>>0}let r=s[0],o=s[1],i=s[2],h=s[3],d=s[4],u=s[5],c=s[6],g=s[7],p=s[8],m=s[9],f=s[10],b=s[11],C=s[12],y=s[13],w=s[14],S=s[15];for(let e=0;e<80;e+=1){let t=(p>>>14|m<<18)^(p>>>18|m<<14)^(m>>>9|p<<23),n=(m>>>14|p<<18)^(m>>>18|p<<14)^(p>>>9|m<<23),s=(r>>>28|o<<4)^(o>>>2|r<<30)^(o>>>7|r<<25),v=(o>>>28|r<<4)^(r>>>2|o<<30)^(r>>>7|o<<25),R=p&f^~p&C,E=r&i^r&d^i&d,T=o&h^o&u^h&u,A=(S>>>0)+(n>>>0)+((m&b^~m&y)>>>0)+(eC[2*e+1]>>>0)+(l[e]>>>0),M=A>>>0,I=(w>>>0)+(t>>>0)+(R>>>0)+(eC[2*e]>>>0)+(a[e]>>>0)+Math.floor(A/0x100000000)>>>0,x=(v>>>0)+(T>>>0),N=x>>>0,O=(s>>>0)+(E>>>0)+Math.floor(x/0x100000000)>>>0;w=C,S=y,C=f,y=b,f=p,b=m;let k=(g>>>0)+M;m=k>>>0,p=(c>>>0)+I+Math.floor(k/0x100000000)>>>0,c=d,g=u,d=i,u=h,i=r,h=o;let H=M+N;o=H>>>0,r=I+O+Math.floor(H/0x100000000)>>>0}let v=[r,o,i,h,d,u,c,g,p,m,f,b,C,y,w,S];for(let e=0;e<16;e+=2){let t=(s[e+1]>>>0)+(v[e+1]>>>0);s[e+1]=t>>>0,s[e]=(s[e]>>>0)+(v[e]>>>0)+Math.floor(t/0x100000000)>>>0}}return s.map(ey).join("")}(function(e){let t=[];for(let r=0;r<e.length;r+=1){let n=e.charCodeAt(r);if(n>=55296&&n<=56319&&r+1<e.length){let t=e.charCodeAt(r+1);t>=56320&&t<=57343&&(n=(n-55296)*1024+(t-56320)+65536,r+=1)}n<128?t.push(n):n<2048?t.push(192|n>>6,128|63&n):n<65536?t.push(224|n>>12,128|n>>6&63,128|63&n):t.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|63&n)}return t}(s))!==a)return null;let l=null===(r=function(e){let t=`${e}`.replace(/-/g,"+").replace(/_/g,"/").replace(/=+$/,"");if(!/^[A-Za-z0-9+/]*$/.test(t)||t.length%4==1)return null;let r=[];for(let e=0;e<t.length;e+=4){let n=[0,1,2,3].map(r=>{let n=t.charAt(e+r);return""===n?-1:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(n)});r.push(n[0]<<2|n[1]>>4),-1!==n[2]&&r.push((15&n[1])<<4|n[2]>>2),-1!==n[3]&&r.push((3&n[2])<<6|n[3])}return r}(s))?null:function(e){let t="",r=0;for(;r<e.length;){let n,o=e[r];o<128?(n=o,r+=1):o<224?(n=(31&o)<<6|63&e[r+1],r+=2):o<240?(n=(15&o)<<12|(63&e[r+1])<<6|63&e[r+2],r+=3):(n=(7&o)<<18|(63&e[r+1])<<12|(63&e[r+2])<<6|63&e[r+3],r+=4),n>=65536?(n-=65536,t+=String.fromCharCode(55296+(n>>10),56320+(1023&n))):t+=String.fromCharCode(n)}return t}(r);if(null===l)return null;try{t=JSON.parse(l)}catch(e){return null}if(!eR(t)||!eR(t.products))return null;let h={},d=t.products,u=!1;return(Object.keys(d).forEach(e=>{let t=function(e){if(!eR(e)||!eT(e.capabilities))return null;let t=eb.filter(t=>void 0!==e[t]);if(1!==t.length||null===ew(`${e[t[0]]}`)||!eE(e.notice)||!eE(e.grace)||void 0!==e.flags&&!eT(e.flags))return null;let r={};return Object.keys(e).forEach(t=>eA(r,t,e[t])),eA(r,"capabilities",e.capabilities.slice()),eA(r,"notice",e.notice),eA(r,"grace",e.grace),eA(r,"flags",void 0===e.flags?[]:e.flags.slice()),eA(r,t[0],e[t[0]]),r}(d[e]);if(null===t){u=!0;return}eA(h,e,t)}),u)?null:{products:h}}(r)),eI),s=null===i?null:ex(i,"handsontable");if(null===i||null===s)return{lifecycle:e8("invalid"),channels:e7,grants:eN};let a=t||"01/09/2026";return{lifecycle:function(e,t){let r=-1!==e.flags.indexOf("trial");if(void 0!==e.release_until){let n=e.release_until;return{state:n>=t.buildDate||null===ew(t.buildDate)?"release_valid":"release_expired",isTrial:r,daysRemaining:null,licensedUntil:n}}let n=`${e.usage_until}`,o=ew(n)??eO(t.now),i=function(e,t,r){let n=e+864e5;if(r>=n)return r<n+864e5*t.grace?"soft_stop":"hard_stop";let o=ek(e,r);return t.notice>0&&o<=t.notice?"notice":"valid"}(o,e,t.now);return{state:`${r?"trial":"usage"}_${i}`,isTrial:r,daysRemaining:ek(o,t.now),licensedUntil:n}}(s,{now:Date.now(),buildDate:function(e){let[t,r,n]=`${e}`.split("/");return t&&r&&n?`${n}-${r.padStart(2,"0")}-${t.padStart(2,"0")}`:""}(a)}),channels:{console:-1===s.flags.indexOf("no-console-warns"),ui:-1===s.flags.indexOf("no-ui-warns")},grants:(n={},Object.keys(i.products).forEach(e=>{let t=ex(i,e);null!==t&&eA(n,e,{capabilities:t.capabilities.slice()})}),{unrestricted:!1,products:n})}}function tt(e){let t=[][eF],r=t;if(e[eF]!==ez("Z"))return!1;for(let t="",n="B<H4P+".split(""),o=ez(n.shift()??"A");o;o=ez(n.shift()??"A"))--o<""[eF]?r|=(eV(`${eV(eB(t)+(eB(eU(e,Math.abs(o),2))+String([])).padStart(2,"0"))}`)%97||2)>>1:t=eU(e,o,o?1===n[eF]?9:8:6);return r===t}function tr(e){let t=Error(e);throw t.cause={handsontable:!0},t}function tn(e){let t;if(Array.isArray(e))t=e.length?Array(e.length).fill(null):[];else{let r=Object.create(null);tp(e,(e,t)=>{"__children"!==t&&(e&&"object"==typeof e&&!Array.isArray(e)?r[t]=tn(e):Array.isArray(e)?e.length&&"object"==typeof e[0]&&!Array.isArray(e[0])?r[t]=[tn(e[0])]:r[t]=[]:r[t]=null)}),t=r}return t}function to(e,t){return t.prototype.constructor=t,e.prototype=new t,e.prototype.constructor=e,e}function ti(e,t,r){let n=Array.isArray(r);return tp(t,(t,o)=>{"__proto__"!==o&&"constructor"!==o&&"prototype"!==o&&(!1===n||r.includes(o))&&(e[o]=t)}),e}function ts(e,t){tp(t,(r,n)=>{if("__proto__"===n||"constructor"===n||"prototype"===n)return;let o=t[n];o&&"object"==typeof o?(e[n]||(Array.isArray(o)?e[n]=[]:"[object Date]"===Object.prototype.toString.call(o)?e[n]=o:e[n]={}),ts(e[n],o)):e[n]=o})}function ta(e){if(Array.isArray(e))return e.map(e=>ta(e));if(e instanceof Date)return new Date(e);if("object"==typeof e&&null!==e){let t={};for(let[r,n]of Object.entries(e))"__proto__"!==r&&"constructor"!==r&&"prototype"!==r&&(t[r]=ta(n));return t}return e}function tl(e){let t={};return tp(e,(e,r)=>{t[r]=e}),t}function th(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return e.MIXINS||(e.MIXINS=[]),J(r,t=>{e.MIXINS.push(t.MIXIN_NAME),tp(t,(t,r)=>{if(void 0!==e.prototype[r]&&tr(`Mixin conflict. Property '${r}' already exist and cannot be overwritten.`),"function"==typeof t)e.prototype[r]=t;else{let n,o;Object.defineProperty(e.prototype,r,{get:(n=`_${r}`,function(){let e;return void 0===this[n]&&(this[n]=((Array.isArray(e=t)||tc(e))&&(e=ta(e)),e)),this[n]}),set:(o=`_${r}`,function(e){this[o]=e}),configurable:!0})}})}),e}function td(e,t){let r=e=>{if(void 0===e)return"undefined";if(Array.isArray(e))return`[${e.map(r).join(",")}]`;if(e instanceof Date)return JSON.stringify(e);if(null!==e&&"object"==typeof e){let t=Object.entries(e).sort((e,t)=>{let[r]=e,[n]=t;return r.localeCompare(n)}).map(e=>{let[t,n]=e;return`${JSON.stringify(t)}:${r(n)}`});return`{${t.join(",")}}`}return JSON.stringify(e)};return r(e)===r(t)}function tu(e){return tc(e)}function tc(e){return"[object Object]"===Object.prototype.toString.call(e)}function tg(e,t,r,n){n.value=r,n.writable=!1!==n.writable,n.enumerable=!1!==n.enumerable,n.configurable=!1!==n.configurable,Object.defineProperty(e,t,n)}function tp(e,t){for(let r in e)if((!e.hasOwnProperty||e.hasOwnProperty&&Object.prototype.hasOwnProperty.call(e,r))&&!1===t(e[r],r,e))break;return e}function tm(e,t){let r=t.split("."),n=e;for(let e of r)if(void 0===(n=n[e]))return;return n}function tf(e,t,r){if("string"!=typeof t||null===e||"object"!=typeof e)return;let n=t.split("."),o=e;for(let e=0;e<n.length;e+=1){let t=n[e];if("__proto__"===t||"constructor"===t||"prototype"===t)return;if(e!==n.length-1){ty(o,t)||(o[t]={});let e=o[t];if(!tc(e))return;o=e}else Object.defineProperty(o,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}}function tb(e){if(!tc(e))return 0;let t=function(e){let r=0;return tc(e)?tp(e,(e,n)=>{"__children"!==n&&(r+=t(e))}):r+=1,r};return t(e)}function tC(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"value",r=`_${t}`,n={_touched:!1,[r]:e,isTouched(){return!!this._touched},value:void 0};return Object.defineProperty(n,t,{get(){return this[r]},set(e){this._touched=!0,this[r]=e},enumerable:!0,configurable:!0}),n}function ty(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function tw(e,t){if("object"!=typeof e||null===e)return t;if("object"!=typeof t||null===t)return e;let r={};return Object.keys(t).forEach(n=>{let o=t[n],i=e[n];tc(o)?r[n]=tw(tc(i)?i:{},o):r[n]=ty(e,n)&&void 0!==i?i:o}),Object.keys(e).forEach(t=>{ty(r,t)||(r[t]=e[t])}),r}function tS(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={...e};return Object.keys(t).forEach(e=>{if("__proto__"===e||"constructor"===e||"prototype"===e)return;let n=t[e],o=r[e];tc(n)&&tc(o)?r[e]=tS(o,n):r[e]=n}),r}function tv(e){return tc(e)&&e_(e.key)&&e_(e.value)}function tR(e){return window.requestAnimationFrame(e)}function tE(e){window.cancelAnimationFrame(e)}function tT(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;return"function"==typeof window.requestIdleCallback?window.requestIdleCallback(()=>e(),{timeout:t}):window.requestAnimationFrame(e)}function tA(e){"function"==typeof window.cancelIdleCallback?window.cancelIdleCallback(e):window.cancelAnimationFrame(e)}function tM(){return"ontouchstart"in window}function tI(){return"u">typeof window}function tx(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e||(e="object"==typeof Intl?new Intl.Collator(t,r).compare:"function"==typeof String.prototype.localeCompare?(e,t)=>`${e}`.localeCompare(t):(e,t)=>e===t?0:e>t?-1:1)}let tN=e=>{let t={value:!1,test(r,n){t.value=e(r,n)}};return t},tO={chrome:tN((e,t)=>/Chrome/.test(e)&&/Google/.test(t??"")),chromeWebKit:tN(e=>/CriOS/.test(e)),edge:tN(e=>/Edge/.test(e)),edgeWebKit:tN(e=>/EdgiOS/.test(e)),firefox:tN(e=>/Firefox/.test(e)),firefoxWebKit:tN(e=>/FxiOS/.test(e)),mobile:tN(e=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(e)),safari:tN((e,t)=>/Safari/.test(e)&&/Apple Computer/.test(t??"")),safariBefore261:tN((e,t)=>{if(!/Safari/.test(e)||!/Apple Computer/.test(t??""))return!1;let r=/Version\/(\d+(?:\.\d+)?)/i.exec(e);return(r?Number.parseFloat(r[1]):0)<26.1})},tk={mac:tN(e=>/^Mac/.test(e)),win:tN(e=>/^Win/.test(e)),linux:tN(e=>/^Linux/.test(e)),ios:tN(e=>/iPhone|iPad|iPod/i.test(e))};function tH(){let{userAgent:e=navigator.userAgent,vendor:t=navigator.vendor}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};tp(tO,r=>{let{test:n}=r;return n(e,t)})}function t_(){let{platform:e=navigator.platform}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};tp(tk,t=>{let{test:r}=t;return r(e)})}function tL(){return tO.chrome.value}function tP(){return tO.chromeWebKit.value}function tD(){return tO.firefox.value}function tF(){return tO.firefoxWebKit.value}function tB(){return tO.safari.value}function tV(){return tO.safariBefore261.value}function tU(){return tO.edge.value}function tz(){return tO.edgeWebKit.value}function tW(){return tO.mobile.value}function tG(){return tk.ios.value}function t$(){let{maxTouchPoints:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:navigator;return(e??0)>2&&tk.mac.value}function tY(){return tk.win.value}function tj(){return tk.mac.value}function tq(){return tk.linux.value}function tK(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return`${e}`.replace(/(?:\\)?\[([^[\]]+)]/g,(e,r)=>"\\"===e.charAt(0)?e.substr(1,e.length-1):void 0===t[r]?"":String(t[r]))}function tX(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];e_(console)&&console.log(...t)}function tQ(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];e_(console)&&console.warn(...t)}tI()&&(tH(),t_());let tZ=new WeakMap;function tJ(e,t){for(var r=arguments.length,n=Array(r>2?r-2:0),o=2;o<r;o++)n[o-2]=arguments[o];let i=tZ.get(e);void 0===i&&(i=new Set,tZ.set(e,i)),i.has(t)||(i.add(t),tQ(...n))}let t0=new Set;function t1(e,t){t0.has(e)||e_(console)&&(t0.add(e),console.warn(t))}function t2(e,t){t1(e,`Deprecated: ${t}`)}function t3(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];e_(console)&&console.error(...t)}function t6(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=-1,n=null,o=e;for(;null!==o;){if(r===t){n=ne(o)?o:null;break}nn(o)?o=o.host:(r+=1,o=o.parentNode)}return n}function t5(e,t){let r=e.closest(".handsontable");return!!r&&(r.parentNode===t||r===t)}function t4(e){return e.target}function t9(e){let{frameElement:t}=e;return e.parent&&Object.getPrototypeOf(e.parent)&&t instanceof HTMLIFrameElement?t:null}function t7(e){return t9(e)?e.parent:null}function t8(e){return!!Object.getPrototypeOf(e.parent)}function re(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,{ELEMENT_NODE:n,DOCUMENT_FRAGMENT_NODE:o}=Node,i=e;for(;null!=i&&i!==r;){let{nodeType:e,nodeName:r}=i;if(e===n&&ne(i)&&(t.includes(r)||t.includes(i)))return i;i=nn(i)?i.host:i.parentNode}return null}function rt(e,t,r){let n=[],o=ne(e)?e:null;for(;o&&(o=re(o,t,r))&&(!r||r.contains(o));)if(n.push(o),nn(o)){let{host:e}=o;o=ne(e)?e:null}else o=o.parentElement;let i=n.length;return i?n[i-1]:null}function rr(e,t){let r={element:void 0,classNames:[]},n=e;for(;null!==n&&n!==e.ownerDocument.documentElement&&!r.element;){if("string"==typeof t&&n.classList.contains(t))r.element=n,r.classNames.push(t);else if(t instanceof RegExp){let e=Array.from(n.classList).filter(e=>t.test(e));e.length&&(r.element=n,r.classNames.push(...e))}n=n.parentElement}return r}function rn(e,t){let r=e.parentNode,n=[];for("string"==typeof t?n=e instanceof Document?Array.from(e.querySelectorAll(t)):Array.from(e.ownerDocument.querySelectorAll(t)):n.push(t);null!==r;){if(n.indexOf(r)>-1)return!0;r=r.parentNode}return!1}function ro(e){let t=0,r=e;if(r.previousSibling)for(;r=r.previousSibling;)t+=1;return t}function ri(e,t,r){let n=r.parentElement?.querySelector(`.ht_clone_${e}`);return!!n&&n.contains(t)}function rs(e){if(!e||!e.classList||!e.parentNode||!e.parentNode.parentNode||e.classList.contains("hiddenHeader")||"none"===e.style.display)return!1;let t=e.parentNode,r=Array.from(t?.parentNode?.childNodes??[]);return(t?r.indexOf(t):-1)+(Number.parseInt(e.getAttribute("rowspan")??"",10)||1)>=r.length}function ra(e){return e&&e.length?e.filter(e=>!!e):[]}function rl(e,t){if(!e||!e.length)return t?{regexFree:[],regexes:[]}:[];let r=[],n=[];return n.push(...e.filter(e=>{let n=e instanceof RegExp;return n&&t&&r.push(e),!n})),t?{regexFree:n,regexes:r}:n}function rh(e,t){return void 0!==e.classList&&"string"==typeof t&&""!==t&&e.classList.contains(t)}function rd(e,t){"string"==typeof t&&(t=t.split(" ")),(t=ra(t)).length>0&&e.classList.add(...t)}function ru(e,t){"string"==typeof t?t=t.split(" "):t instanceof RegExp&&(t=[t]);let{regexFree:r,regexes:n}=rl(t,!0);(r=ra(r)).length>0&&e.classList.remove(...r),n.forEach(t=>{e.classList.forEach(r=>{t.test(r)&&e.classList.remove(r)})})}function rc(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0;Array.isArray(t)||(t=[[t,r??""]]),t.forEach(t=>{Array.isArray(t)&&""!==t[0]&&e.setAttribute(t[0],String(t[1]))})}function rg(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];"string"==typeof t?t=t.split(" "):t instanceof RegExp&&(t=[t]);let{regexFree:r,regexes:n}=rl(t,!0);if(r.forEach(t=>{""!==t&&e.removeAttribute(t)}),n.length>0){let t=e.getAttributeNames();for(let r=0;r<t.length;r++){let o=t[r];for(let t=0;t<n.length;t++)if(n[t].test(o)){e.removeAttribute(o);break}}}}function rp(e){if(3===e.nodeType)e.parentNode?.removeChild(e);else if(["TABLE","THEAD","TBODY","TFOOT","TR"].indexOf(e.nodeName)>-1){let t=e.childNodes;for(let e=t.length-1;e>=0;e--)rp(t[e])}}function rm(e){let t;for(;t=e.lastChild;)e.removeChild(t)}let rf=/(<([^>]*)>|&([^;]*);)/,rb="sanitizer";function rC(e){return`HTML content is being written to the DOM ("${e}") without a sanitizer. Configure the "sanitizer" option to prevent XSS vulnerabilities.`}let ry={};function rw(e,t){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"innerHTML",o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:ry;if(rf.test(t)){let i;"function"==typeof r?i=r(t,n)??"":(!1!==r&&tJ(o,rb,rC(n)),i=t),e.innerHTML=i}else rS(e,t)}function rS(e,t){let r=e.firstChild;r&&3===r.nodeType&&null===r.nextSibling?r.textContent=t:(rm(e),e.appendChild(e.ownerDocument.createTextNode(t)))}function rv(e){if("function"==typeof e.checkVisibility)return e.checkVisibility();let t=e.ownerDocument.documentElement,r=e.ownerDocument.defaultView,n=e;for(;n!==t;){if(null===n)return!1;if(nn(n)){let e=n.host;if(e.impl)return rv(e.impl);return rv(e)}if(n.nodeType===Node.DOCUMENT_FRAGMENT_NODE)return!1;else if(n.nodeType===Node.ELEMENT_NODE&&ne(n)&&r?.getComputedStyle(n).display==="none")return!1;n=n.parentNode}return!0}function rR(e){let t=e.ownerDocument.defaultView,r=e;for(;r.parentElement;){if("0px"===r.style.height||"0"===r.style.height){let e=t?.getComputedStyle(r).getPropertyValue("overflow");return"hidden"===e||"clip"===e}r=r.parentElement}return!1}function rE(e){let t,r,n,o=e.ownerDocument,i=o.defaultView,s=o.documentElement,a=e;for(t=a.offsetLeft,r=a.offsetTop,n=a;(a=ne(a.offsetParent)?a.offsetParent:null)&&a!==o.body&&"offsetLeft"in a;)t+=a.offsetLeft,r+=a.offsetTop,n=a;return n&&"fixed"===n.style.position&&(t+=(i?.pageXOffset??0)||s.scrollLeft,r+=(i?.pageYOffset??0)||s.scrollTop),{left:t,top:r}}function rT(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window;return e.scrollY}function rA(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window;return e.scrollX}function rM(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window;return e instanceof Window?rT(t):e.scrollTop}function rI(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window;return e instanceof Window?rA(t):e.scrollLeft}function rx(e){let t=e.ownerDocument,r=t.defaultView,n=["auto","scroll"],o=e.parentElement;for(;o&&o.style&&t.body!==o;){let{overflow:e,overflowX:t,overflowY:i}=o.style;if([e,t,i].includes("scroll")||(r&&({overflow:e,overflowX:t,overflowY:i}=r.getComputedStyle(o)),n.includes(e)||n.includes(t)||n.includes(i))||o.clientHeight<=o.scrollHeight+1&&(n.includes(i)||n.includes(e))||o.clientWidth<=o.scrollWidth+1&&(n.includes(t)||n.includes(e)))return o;o=o.parentElement}return r??t.documentElement}function rN(e){return e.scrollHeight-e.clientHeight}function rO(e){return e.scrollWidth-e.clientWidth}let rk=["scroll","hidden","auto","clip"],rH=["visible","clip","hidden","scroll","auto","overlay"];function r_(e,t){return rk.includes(e)&&("clip"!==e||"visible"!==t&&""!==t)}function rL(e){let t=e.ownerDocument,r=t.defaultView,n=e.parentElement;for(;n&&n.style&&t.body!==n;){if(r){let{x:e,y:t}=function(e,t){let[r="",n=r]=e.style.overflow.split(/\s+/).filter(Boolean),o=(e,r,n)=>{let o=e||r;return rH.includes(o)?o:t.getPropertyValue(n)};return{x:o(e.style.overflowX,r,"overflow-x"),y:o(e.style.overflowY,n,"overflow-y")}}(n,r.getComputedStyle(n));if(r_(e,t)||r_(t,e))return n}else if("visible"!==n.style.overflow&&""!==n.style.overflow)return n;n=n.parentElement}return r??t.documentElement}function rP(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window;if(!e)return;if(e instanceof Window)return"width"===t?`${e.innerWidth}px`:"height"===t?`${e.innerHeight}px`:void 0;let n=e.style.getPropertyValue(t)||e.style[t];if(""!==n&&void 0!==n)return n;let o=r.getComputedStyle(e),i=o.getPropertyValue(t)||o[t];if(""!==i&&void 0!==i)return i}function rD(e,t){let r=!1;return t instanceof CSSStyleRule&&t.selectorText&&("msMatchesSelector"in e&&"function"==typeof e.msMatchesSelector?r=e.msMatchesSelector(t.selectorText):e.matches&&(r=e.matches(t.selectorText))),r}function rF(e){return e.offsetWidth}function rB(e){return e.offsetHeight}function rV(e){return e instanceof Window?e.innerHeight:e.clientHeight}function rU(e){return e instanceof Window?e.innerWidth:e.clientWidth}function rz(e,t,r){e.addEventListener(t,r,!1)}function rW(e,t,r){e.removeEventListener(t,r,!1)}function rG(e){return e.selectionStart?e.selectionStart:0}function r$(e){return e.selectionEnd?e.selectionEnd:0}function rY(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window,t=e.document,r="";return e.getSelection?r=e.getSelection()?.toString()??"":"selection"in t&&t.selection&&"Control"!==t.selection.type&&(r=t.selection.createRange().text),r}function rj(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window;if(e.getSelection){let t=e.getSelection();t?.empty?t.empty():t?.removeAllRanges&&t.removeAllRanges()}}function rq(e,t,r){if(void 0===r&&(r=t),e.setSelectionRange){e.focus();try{e.setSelectionRange(t,r)}catch(o){let n=e.parentElement;if(n){let o=n.style.display;n.style.display="block",e.setSelectionRange(t,r),n.style.display=o}}}}function rK(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;return tY()?2*!Number.isInteger(e.defaultView?.devicePixelRatio||1):0}function rX(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;return void 0===t&&(t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,t=function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=e.createElement("div");r.style.height="200px",r.style.width="100%";let n=e.createElement("div");n.classList.add("htScrollbarTest"),t&&n.classList.add("htScrollbarSafariTest"),n.style.boxSizing="content-box",n.style.height="150px",n.style.left="0px",n.style.overflow="hidden",n.style.position="absolute",n.style.top="0px",n.style.width="200px",n.style.visibility="hidden",n.appendChild(r),e.body.appendChild(n);let o=r.offsetWidth;n.style.overflow="scroll";let i=r.offsetWidth;return o===i&&(i=n.clientWidth),e.body.removeChild(n),o-i},r=t();return 0===r&&tV()&&!tW()&&!t$()?t(!0):r}(e)),t}function rQ(e){return e instanceof Window?e.document.body.scrollHeight>e.innerHeight:e.offsetWidth!==e.clientWidth}function rZ(e){return e instanceof Window?e.document.body.scrollWidth>e.innerWidth:e.offsetHeight!==e.clientHeight}function rJ(e,t,r){e.style.transform=`translate3d(${t},${r},0)`}function r0(e){let t;return e.style.transform&&""!==(t=e.style.transform)?["transform",t]:-1}function r1(e){e.style.transform&&""!==e.style.transform&&(e.style.transform="")}function r2(e){return e&&(["INPUT","SELECT","TEXTAREA"].indexOf(e.nodeName)>-1||"true"===e.contentEditable)}function r3(e){return r2(e)&&"hotInput"in e.dataset==!1}function r6(e){let t=ni(e.ownerDocument);ne(t)&&!r3(t)&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&e.select()}function r5(e){return!e.parentNode}function r4(e,t){let r=new IntersectionObserver((e,r)=>{e.forEach(e=>{e.isIntersecting&&(t(),r.disconnect())})});return r.observe(e),r}function r9(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],n=e.ownerDocument,o=n.createRange(),i=n.defaultView?.getSelection();if(rc(e,"contenteditable",!0),r){let t=_();rc(e,t[0],t[1])}t&&rd(e,"invisibleSelection"),o.selectNodeContents(e),i?.removeAllRanges(),i?.addRange(o)}function r7(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],r=e.ownerDocument.defaultView?.getSelection();e.hasAttribute("aria-hidden")&&e.removeAttribute("aria-hidden"),r?.removeAllRanges(),t&&ru(e,"invisibleSelection"),e.removeAttribute("contenteditable")}function r8(e,t){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2];r9(e,r),t(),r7(e,r)}function ne(e){if("object"!=typeof e||null===e)return!1;let t=e.ownerDocument?.defaultView?.Element;return!!(t&&e instanceof t)}function nt(e){return ne(e)&&("TD"===e.tagName||"TH"===e.tagName)}function nr(e){return"INPUT"===e.tagName}function nn(e){return"object"==typeof e&&null!==e&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}function no(e){let t=[],r=e.getRootNode();for(;nn(r);){let{host:e}=r;if(!ne(e))break;t.push(e),r=e.getRootNode()}return t}function ni(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}function ns(e,t){return e.childNodes[t]||null}function na(e){return"function"==typeof e}function nl(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:200,r=0,n={lastCallThrottled:!0},o=null;return function(){for(var i=arguments.length,s=Array(i),a=0;a<i;a++)s[a]=arguments[a];let l=Date.now(),h=!1;n.lastCallThrottled=!0,r||(r=l,h=!0);let d=t-(l-r);return h?(n.lastCallThrottled=!1,e.apply(this,s)):(o&&clearTimeout(o),o=setTimeout(()=>{n.lastCallThrottled=!1,e.apply(this,s),r=0,o=null},d)),n}}function nh(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:200,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,n=nl(e,t),o=r;function i(){for(var t=arguments.length,r=Array(t),i=0;i<t;i++)r[i]=arguments[i];return o?(o-=1,e.apply(this,r)):n.apply(this,r)}return i.clearHits=function(){o=r},i}function nd(e){let t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:200,n=null;function o(){for(var o=arguments.length,i=Array(o),s=0;s<o;s++)i[s]=arguments[s];return n&&clearTimeout(n),n=setTimeout(()=>{n=null,t=e.apply(this,i)},r),t}return o.cancel=function(){null!==n&&(clearTimeout(n),n=null)},o}function nu(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];let[n,...o]=t;return function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return X(o,(e,t)=>t(e),n.apply(this,t))}}function nc(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return function(){for(var t=arguments.length,n=Array(t),o=0;o<t;o++)n[o]=arguments[o];return e.apply(this,r.concat(n))}}function ng(e){let t=e.length;return function r(n){return function(){for(var o=arguments.length,i=Array(o),s=0;s<o;s++)i[s]=arguments[s];let a=n.concat(i);return a.length>=t?e.apply(this,a):r(a)}}([])}function np(e){let t=e.length;return function r(n){return function(){for(var o=arguments.length,i=Array(o),s=0;s<o;s++)i[s]=arguments[s];let a=n.concat(i.reverse());return a.length>=t?e.apply(this,a):r(a)}}([])}function nm(e,t,r,n,o,i,s,a){if(e_(a))return e.call(t,r,n,o,i,s,a);if(e_(s))return e.call(t,r,n,o,i,s);if(e_(i))return e.call(t,r,n,o,i);if(e_(o))return e.call(t,r,n,o);if(e_(n))return e.call(t,r,n);else if(e_(r))return e.call(t,r);return e.call(t)}let nf={ALT:18,ARROW_DOWN:40,ARROW_LEFT:37,ARROW_RIGHT:39,ARROW_UP:38,AUDIO_DOWN:tD()?182:174,AUDIO_MUTE:tD()?181:173,AUDIO_UP:tD()?183:175,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND_LEFT:91,COMMAND_RIGHT:93,COMMAND_FIREFOX:224,CONTROL:17,DELETE:46,END:35,ENTER:13,ESCAPE:27,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,F13:124,F14:125,F15:126,F16:127,F17:128,F18:129,F19:130,HOME:36,INSERT:45,MEDIA_NEXT:176,MEDIA_PLAY_PAUSE:179,MEDIA_PREV:177,MEDIA_STOP:178,NULL:0,NUM_LOCK:144,PAGE_DOWN:34,PAGE_UP:33,PAUSE:19,PERIOD:190,SCROLL_LOCK:145,SHIFT:16,SPACE:32,TAB:9,A:65,C:67,D:68,F:70,L:76,O:79,P:80,S:83,V:86,X:88,Y:89,Z:90},nb=[nf.ALT,nf.ARROW_DOWN,nf.ARROW_LEFT,nf.ARROW_RIGHT,nf.ARROW_UP,nf.AUDIO_DOWN,nf.AUDIO_MUTE,nf.AUDIO_UP,nf.BACKSPACE,nf.CAPS_LOCK,nf.DELETE,nf.END,nf.ENTER,nf.ESCAPE,nf.F1,nf.F2,nf.F3,nf.F4,nf.F5,nf.F6,nf.F7,nf.F8,nf.F9,nf.F10,nf.F11,nf.F12,nf.F13,nf.F14,nf.F15,nf.F16,nf.F17,nf.F18,nf.F19,nf.HOME,nf.INSERT,nf.MEDIA_NEXT,nf.MEDIA_PLAY_PAUSE,nf.MEDIA_PREV,nf.MEDIA_STOP,nf.NULL,nf.NUM_LOCK,nf.PAGE_DOWN,nf.PAGE_UP,nf.PAUSE,nf.SCROLL_LOCK,nf.SHIFT,nf.TAB];function nC(e){return 32===e||e>=48&&e<=57||e>=96&&e<=111||e>=186&&e<=192||e>=219&&e<=222||e>=226||e>=65&&e<=90}function ny(e){return nb.includes(e)}function nw(e){let t=[];return tj()?t.push(nf.COMMAND_LEFT,nf.COMMAND_RIGHT,nf.COMMAND_FIREFOX):t.push(nf.CONTROL),t.includes(e)}function nS(e){return[nf.CONTROL,nf.COMMAND_LEFT,nf.COMMAND_RIGHT,nf.COMMAND_FIREFOX].includes(e)}function nv(e,t){let r=t.split("|"),n=!1;return J(r,t=>{if(e===nf[t])return n=!0,!1}),n}function nR(e){e.isImmediatePropagationEnabled=!1,e.cancelBubble=!0}function nE(e){return!1===e.isImmediatePropagationEnabled}function nT(e){return 2===e.button}function nA(e){return 0===e.button}function nM(e){return 1===e.button}function nI(e){return"u">typeof TouchEvent&&e instanceof TouchEvent}function nx(e){return"touches"in e&&"changedTouches"in e}function nN(e){if(!nx(e)||0===e.changedTouches.length)return null;let{identifier:t,clientX:r,clientY:n}=e.changedTouches[0];return{identifier:t,clientX:r,clientY:n}}function nO(e,t){if(!nx(e))return null;for(let r=0;r<e.touches.length;r++){let n=e.touches[r];if(n.identifier===t)return{identifier:n.identifier,clientX:n.clientX,clientY:n.clientY}}return null}function nk(e,t){let r={x:e.offsetX,y:e.offsetY},n=t4(e);if(!ne(t)||n!==t&&n.contains(t))return r;for(;n!==t;)r.x+=n.offsetLeft,r.y+=n.offsetTop,n=n.offsetParent;return r}let nH=["afterCellMetaReset","afterChange","afterContextMenuDefaultOptions","beforeContextMenuSetItems","afterDropdownMenuDefaultOptions","beforeDropdownMenuSetItems","afterContextMenuHide","beforeContextMenuShow","afterContextMenuShow","afterCopyLimit","beforeCreateCol","afterColumnSequenceCacheUpdate","afterColumnSequenceChange","afterCreateCol","beforeCreateRow","afterCreateRow","beforeAlter","afterDeselect","afterDestroy","afterDocumentKeyDown","afterDrawSelection","beforeRemoveCellClassNames","beforeCompositionStart","afterGetCellMeta","afterGetColHeader","afterGetRowHeader","afterInit","afterLoadData","afterUpdateData","afterDataProviderFetch","afterDataProviderFetchError","afterDataProviderFetchAbort","hasExternalDataSource","beforeRowsMutation","afterRowsMutation","afterRowsMutationError","afterMomentumScroll","afterOnCellCornerMouseDown","afterOnSelectionHandleMouseDown","afterOnSelectionEdgeMouseDown","beforeMoveCells","afterMoveCells","afterOnCellCornerDblClick","afterOnCellMouseDown","afterOnCellMouseUp","afterOnCellContextMenu","afterOnCellMouseOver","afterOnCellMouseOut","afterOnCellMouseOverOutside","afterRemoveCol","afterRemoveRow","beforeRenderer","afterRenderer","afterRowSequenceCacheUpdate","afterRowSequenceChange","beforeViewportScrollVertically","beforeViewportScrollHorizontally","beforeViewportScroll","afterScrollHorizontally","afterScrollVertically","afterScroll","afterSelection","afterSelectionByProp","afterSelectionEnd","afterSelectionEndByProp","afterSelectionFocusSet","beforeSelectColumns","afterSelectColumns","beforeSelectRows","afterSelectRows","beforeSelectAll","afterSelectAll","afterSetCellMeta","afterRemoveCellMeta","afterSetDataAtCell","afterSetDataAtRowProp","afterSetSourceDataAtCell","afterSetTheme","afterUpdateSettings","afterValidate","beforeLanguageChange","afterLanguageChange","beforeAutofill","afterAutofill","beforeCellAlignment","beforeChange","beforeChangeRender","beforeHeightChange","beforeWidthChange","beforeDrawBorders","beforeGetCellMeta","beforeRemoveCellMeta","beforeInit","beforeInitWalkontable","beforeLoadData","beforeUpdateData","beforeDataProviderFetch","beforeKeyDown","beforeOnCellMouseDown","beforeOnCellMouseUp","beforeOnCellContextMenu","beforeOnCellMouseOver","beforeOnCellMouseOut","beforeOnCellMouseOverOutside","beforeRemoveCol","beforeRemoveRow","beforeViewRender","afterViewRender","beforeRender","afterRender","beforeRowWrap","beforeColumnWrap","beforeSetCellMeta","beforeSelectionFocusSet","beforeSetRangeStartOnly","beforeSetRangeStart","beforeSetRangeEnd","beforeSelectionHighlightSet","beforeTouchScroll","beforeValidate","beforeValueRender","construct","init","modifyColHeader","modifyColWidth","modifyFiltersMultiSelectValue","modifyFocusedElement","modifyRowHeader","modifyRowHeight","modifyRowHeightByOverlayName","modifyData","modifySourceData","modifyRowData","modifyGetCellCoords","modifyGetCoordsElement","modifyFocusOnTabNavigation","beforeHighlightingRowHeader","beforeHighlightingColumnHeader","beforeColumnSort","afterColumnSort","modifyAutofillRange","modifyCopyableRange","beforeCut","afterCut","beforeCopy","afterCopy","beforePaste","afterPaste","beforeColumnFreeze","afterColumnFreeze","beforeColumnMove","afterColumnMove","afterCustomBordersUpdate","beforeColumnUnfreeze","afterColumnUnfreeze","beforeRowCollapse","afterRowCollapse","beforeRowExpand","afterRowExpand","beforeRowMove","afterRowMove","beforeColumnResize","afterColumnResize","beforeRowResize","afterRowResize","afterGetColumnHeaderRenderers","afterGetRowHeaderRenderers","beforeStretchingColumnWidth","beforeFilter","afterFilter","beforePageChange","afterPageChange","beforePageSizeChange","afterPageSizeChange","afterPageSizeVisibilityChange","afterPageCounterVisibilityChange","afterPageNavigationVisibilityChange","afterFormulasValuesUpdate","afterNamedExpressionAdded","afterNamedExpressionRemoved","afterSheetAdded","afterSheetRenamed","afterSheetRemoved","modifyColumnHeaderHeight","modifySinglePassLayout","modifyColumnHeaderValue","beforeUndo","beforeUndoStackChange","afterUndo","afterUndoStackChange","beforeRedo","beforeRedoStackChange","afterRedo","afterRedoStackChange","modifyRowHeaderWidth","modifyTransformFocus","modifyTransformStart","modifyTransformEnd","afterModifyTransformFocus","afterModifyTransformStart","afterModifyTransformEnd","afterViewportRowCalculatorOverride","afterViewportColumnCalculatorOverride","afterPluginsInitialized","beforeHideRows","afterHideRows","beforeUnhideRows","afterUnhideRows","beforeHideColumns","afterHideColumns","beforeUnhideColumns","afterUnhideColumns","beforeTrimRow","afterTrimRow","beforeUntrimRow","afterUntrimRow","beforeDropdownMenuShow","afterDropdownMenuShow","afterDropdownMenuHide","beforeAddChild","afterAddChild","beforeDetachChild","afterDetachChild","beforeBeginEditing","afterDialogHide","afterDialogShow","beforeDialogHide","beforeDialogShow","dialogFocusPreviousElement","dialogFocusNextElement","afterDialogFocus","beforeLoadingShow","afterLoadingShow","beforeLoadingHide","afterLoadingHide","beforeEmptyDataStateShow","afterEmptyDataStateShow","beforeEmptyDataStateHide","afterEmptyDataStateHide","beforeNotificationShow","afterNotificationShow","beforeNotificationHide","afterNotificationHide","afterBeginEditing","beforeMergeCells","afterMergeCells","beforeUnmergeCells","afterUnmergeCells","afterListen","afterUnlisten","afterRefreshDimensions","beforeRefreshDimensions","beforeColumnCollapse","afterColumnCollapse","beforeColumnExpand","afterColumnExpand","modifyAutoColumnSizeSeed"],n_=new Map([["modifyRow","8.0.0"],["modifyCol","8.0.0"],["unmodifyRow","8.0.0"],["unmodifyCol","8.0.0"],["skipLengthCache","8.0.0"],["hiddenColumn","8.0.0"],["hiddenRow","8.0.0"],["persistentStateSave","17.0.0"],["persistentStateLoad","17.0.0"],["persistentStateReset","17.0.0"]]),nL=new Map([]);class nP{#e=new Map;constructor(){nH.forEach(e=>this.#t(e))}getList(e){return this.#e.get(e)??null}getHooks(e){let t=this.#e.get(e),r=[];if(t){let e=t.head;for(;e;)r.push(e),e=e.next}return r}add(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=this.#e.get(e);n||(n=this.#t(e),nH.push(e));for(let e=n.head;null!==e;e=e.next)if(e.callback===t)return;let o=Number.isInteger(r.orderIndex)?r.orderIndex??0:0,i=!!r.runOnce,s=!!r.initialHook;if(s){for(let e=n.head;null!==e;e=e.next)if(e.initialHook){e.callback=t;return}}this.#r(n,{callback:t,orderIndex:o,runOnce:i,initialHook:s,next:null})}has(e){let t=this.#e.get(e);return!!t&&null!==t.head}remove(e,t){let r=this.#e.get(e);if(!r)return!1;let n=null,o=r.head;for(;null!==o;){if(o.callback===t)return n?n.next=o.next:r.head=o.next,o===r.tail&&(r.tail=n),!0;n=o,o=o.next}return!1}destroy(){this.#e.clear()}#r(e,t){if(null===e.head){e.head=t,e.tail=t;return}if(t.orderIndex>=e.tail.orderIndex){e.tail.next=t,e.tail=t;return}let r=null,n=e.head;for(;null!==n&&n.orderIndex<=t.orderIndex;)r=n,n=n.next;null===r?(t.next=e.head,e.head=t):(t.next=n,r.next=t)}#t(e){let t={head:null,tail:null};return this.#e.set(e,t),t}}let nD=ec`The plugin hook "[hookName]" was removed in Handsontable [removedInVersion].\x20
  Please consult release notes https://github.com/handsontable/handsontable/releases/tag/[removedInVersion] to\x20
  learn about the migration path.`;class nF{static getSingleton(){return nB}globalBucket=new nP;getBucket(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return e?(e.pluginHookBucket||(e.pluginHookBucket=new nP),e.pluginHookBucket):this.globalBucket}add(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3?arguments[3]:void 0;return Array.isArray(t)?J(t,t=>this.add(e,t,r)):(n_.has(e)&&tQ(tK(nD,{hookName:e,removedInVersion:n_.get(e)})),nL.has(e)&&tQ(nL.get(e)),this.getBucket(r).add(e,t,{orderIndex:n,runOnce:!1})),this}once(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3?arguments[3]:void 0;return Array.isArray(t)?J(t,t=>this.once(e,t,r)):this.getBucket(r).add(e,t,{orderIndex:n,runOnce:!0}),this}addAsFixed(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return Array.isArray(t)?J(t,t=>this.addAsFixed(e,t,r)):this.getBucket(r).add(e,t,{initialHook:!0}),this}remove(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return this.getBucket(r).remove(e,t)}has(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this.getBucket(t).has(e)}run(e,t,r,n,o,i,s,a){return r=this.#n(this.getBucket().getList(t),e,t,null,r,n,o,i,s,a),r=this.#n(this.getBucket(e).getList(t),e,t,e,r,n,o,i,s,a)}#n(e,t,r,n,o,i,s,a,l,h){if(null===e||null===e.head)return o;let d=e.head,u=e.tail;for(;null!==d;){let e=nm(d.callback,t,o,i,s,a,l,h);if(void 0!==e&&(o=e),d.runOnce&&this.remove(r,d.callback,n),d===u)break;d=d.next}return o}destroy(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.getBucket(e).destroy()}register(e){this.isRegistered(e)||nH.push(e)}deregister(e){this.isRegistered(e)&&nH.splice(nH.indexOf(e),1)}isDeprecated(e){return nL.has(e)||n_.has(e)}isRegistered(e){return nH.indexOf(e)>=0}getRegistered(){return nH}}let nB=new nF,nV=new Map;function nU(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"common";nV.has(e)||nV.set(e,new Map);let t=nV.get(e);return{register:function(e,r){t.set(e,r)},getItem:function(e){return t.get(e)},hasItem:function(e){return t.has(e)},getNames:function(){return[...t.keys()]},getValues:function(){return[...t.values()]},clear:function(){nV.delete(e),t.clear()}}}let{register:nz,getItem:nW,hasItem:nG,getNames:n$,getValues:nY}=nU("editors");class nj{#o;#i={};constructor(e){this.#o=e;const t=this.#i;nF.getSingleton().add("afterDestroy",function(){t[this.guid]=null})}getConstructor(){return this.#o}getInstance(e){return e.guid in this.#i||(this.#i[e.guid]=new this.#o(e)),this.#i[e.guid]}}let nq=new WeakMap;function nK(e){return"function"==typeof e}function nX(e){return nK(e)||tr("Editor class must be a constructor function."),e}function nQ(e){return"string"!=typeof e?nX(e):(nG(e)||tr(`No registered editor found under "${e}" name`),nW(e).getConstructor())}function nZ(e,t){let r="string"==typeof e?e:null,n=t;e&&nK(e)&&(n=e,r=e.EDITOR_TYPE??null),n||tr("Editor class is required to register an editor.");let o=nX(n),i=new nj(o);null!==r&&nz(r,i),nq.set(o,i)}let nJ={_hooksStorage:Object.create(null),addHook(e,t){return this._hooksStorage[e]||(this._hooksStorage[e]=[]),this.hot.addHook(e,t),this._hooksStorage[e].push(t),this},removeHooksByKey(e){J(this._hooksStorage[e]||[],t=>{this.hot.removeHook(e,t)})},clearHooks(){tp(this._hooksStorage,(e,t)=>this.removeHooksByKey(t)),this._hooksStorage={}}};function n0(e,t){let{instance:r,visualRow:n,visualCol:o,valueSetter:i}=t;return na(i)?i.call(r,e,n,o,t):e}function n1(e,t){let{instance:r,visualRow:n,visualCol:o,valueGetter:i}=t;return na(i)?i.call(r,e,n,o,t):e}tg(nJ,"MIXIN_NAME","hooksRefRegisterer",{writable:!1,enumerable:!1});let n2=Object.freeze({VIRGIN:"STATE_VIRGIN",EDITING:"STATE_EDITING",WAITING:"STATE_WAITING",FINISHED:"STATE_FINISHED"});class n3{static get EDITOR_TYPE(){return"base"}state=n2.VIRGIN;_opened=!1;_fullEditMode=!1;_closeCallback=null;_closeAfterDataChange=!0;TD=null;row=null;col=null;prop=null;originalValue=null;constructor(e){this.hot=e,this.init()}_fireCallbacks(e){this._closeCallback&&(this._closeCallback(e),this._closeCallback=null)}init(){}getValue(){tr("Editor getValue() method unimplemented")}setValue(e){tr("Editor setValue() method unimplemented")}open(e){tr("Editor open() method unimplemented")}close(){tr("Editor close() method unimplemented")}focus(){tr("Editor focus() method unimplemented")}prepare(e,t,r,n,o,i){this.TD=n,this.row=e,this.col=t,this.prop=r,this.originalValue=o,this.cellProperties=i,this.state=this.isOpened()?this.state:n2.VIRGIN}extend(){return class extends this.constructor{}}saveValue(e,t){let r,n,o,i;if(t){let e=this.hot.getSelectedRangeActive(),t=e?.getTopStartCorner(),s=e?.getBottomEndCorner();r=t?.row??this.row,n=t?.col??this.col,o=s?.row??this.row,i=s?.col??this.col}else[r,n,o,i]=[this.row,this.col,null,null];let s=this.hot.runHooks("modifyGetCellCoords",r,n,!1,"meta");Array.isArray(s)&&([r,n]=s),this.hot.populateFromArray(r,n,e,o,i,"edit")}beginEditing(e,t){if(this.state!==n2.VIRGIN)return;if(null===this.row||null===this.col)return void tQ("Editor opened without valid cell coordinates.");let r=this.hot,n=r.rowIndexMapper.getRenderableFromVisualIndex(this.row),o=r.columnIndexMapper.getRenderableFromVisualIndex(this.col);if(null!==n&&null!==o&&r.view.scrollViewport({row:n,col:o}),this.state=n2.EDITING,this.isInFullEditMode()){let t=n1(this.originalValue,this.hot.getCellMeta(this.row,this.col)),r="string"==typeof e?e:eH(t);this.setValue(r)}this.open(t),this._opened=!0,this.focus(),r.view.render(),r.runHooks("afterBeginEditing",this.row,this.col),this.addHook("beforeDialogShow",()=>this.cancelChanges())}finishEditing(e,t,r){if(r){let e=this._closeCallback;this._closeCallback=t=>{e&&e(t),r(t),this.hot.view.render()}}if(!this.isWaiting()){if(this.state===n2.VIRGIN)return void this.hot._registerTimeout(()=>{this._fireCallbacks(!0)});if(this.state===n2.EDITING){if(e){this.cancelChanges(),this.hot.view.render();return}let r=this.getValue();this.cellProperties.trimWhitespace&&(r="string"==typeof r?String.prototype.trim.call(r||""):r),"function"==typeof this.cellProperties.valueParser&&(r=this.cellProperties.valueParser(r,this.cellProperties)),this.state=n2.WAITING,this.saveValue([[r]],t),this.hot.getCellValidator(this.cellProperties)?this.hot.addHookOnce("postAfterValidate",e=>{this.state=n2.FINISHED,this.discardEditor(e)}):(this.state=n2.FINISHED,this.discardEditor(!0))}}}cancelChanges(){this.state=n2.FINISHED,this.discardEditor()}discardEditor(e){if(this.state===n2.FINISHED)if(!1===e&&!0!==this.cellProperties.allowInvalid){if(null===this.row||null===this.col)return;this.hot.selectCell(this.row,this.col),this.focus(),this.state=n2.EDITING,this._fireCallbacks(!1)}else this.close(),this._opened=!1,this._fullEditMode=!1,this.state=n2.VIRGIN,this._fireCallbacks(!0),this.hot.getShortcutManager().setActiveContextName("grid")}enableFullEditMode(){this._fullEditMode=!0}isInFullEditMode(){return this._fullEditMode}isOpened(){return this._opened}isWaiting(){return this.state===n2.WAITING}getEditedCellRect(){let e=this.getEditedCell();if(!e)return;let{wtOverlays:t,wtViewport:r}=this.hot.view._wt,n=this.hot.rootWindow,o=rE(e),i=rF(e),s=rE(this.hot.rootElement),a=rF(this.hot.rootElement),l=t.topOverlay?.holder,h=t.inlineStartOverlay?.holder,d=l!==n?l.scrollTop:0,u=h!==n?h.scrollLeft:0,c=n.innerWidth-s.left-a,{wtTable:g}=t.getParentOverlay(e)??this.hot.view._wt,p=g.name,m=["master","inline_start"].includes(p)?d:0,f=["master","top","bottom"].includes(p)?u:0,b=+(o.top!==s.top),C=o.top-s.top-b-m,y=0;y=this.hot.isRtl()?n.innerWidth-o.left-i-c-1+f:o.left-s.left-1-f,["top","top_inline_start_corner"].includes(p)&&(C+=t.topOverlay?.getOverlayOffset()??0),["inline_start","top_inline_start_corner"].includes(p)&&(y+=Math.abs(t.inlineStartOverlay?.getOverlayOffset()??0));let w=this.hot.hasColHeaders(),S=this.hot.rowIndexMapper.getRenderableFromVisualIndex(this.row??0),v=this.hot.columnIndexMapper.getRenderableFromVisualIndex(this.col??0),R=this.hot.rowIndexMapper.getRenderableIndexesLength()-this.hot.view._wt.getSetting("fixedRowsBottom");(w&&(S??0)<=0||S===R)&&(C+=1),(v??0)<=0&&(y+=1);let E=r.rowsRenderCalculator?.startPosition??0,T=r.columnsRenderCalculator?.startPosition??0,A=Math.abs(t.inlineStartOverlay?.getScrollPosition()??0),M=t.topOverlay?.getScrollPosition()??0,I=rX(this.hot.rootDocument),x=this.#s(e,p,E,M,I),N=this.#a(e,p,g,i,T,A),O=n.getComputedStyle(e),k=Number.parseInt(O[this.hot.isRtl()?"borderRightWidth":"borderLeftWidth"],10)>0?0:1,H=Number.parseInt(O.borderTopWidth,10)>0?0:1,_=rF(e)+k,L=rB(e)+H,P=l&&rQ(l)?I:0,D=h&&rZ(h)?I:0,F=this.hot.view.maximumVisibleElementWidth(N)-P+k;return{top:C,start:y,height:L,maxHeight:Math.max(this.hot.view.maximumVisibleElementHeight(x??0)-D+H,this.hot.stylesHandler.getDefaultRowHeight()??0),width:_,maxWidth:F}}#s(e,t,r,n,o){let i=e.offsetTop,{wtOverlays:s}=this.hot.view._wt;if(["inline_start","master"].includes(t)&&(i+=r-n),["bottom","bottom_inline_start_corner"].includes(t)&&s.bottomOverlay?.clone){let{wtViewport:e,wtTable:t}=s.bottomOverlay.clone;i+=e.getWorkspaceHeight()-t.getHeight()-o}return i}#a(e,t,r,n,o,i){let s=e.offsetLeft;return this.hot.isRtl()?s=(s>=0?r.getWidth()-e.offsetLeft:Math.abs(s))+(o-i-n):["top","master","bottom"].includes(t)&&(s+=o-i),s}getEditedCellsLayerClass(){switch(this.checkEditorSection()){case"inline-start":return"ht_clone_left ht_clone_inline_start";case"bottom":return"ht_clone_bottom";case"bottom-inline-start-corner":return"ht_clone_bottom_left_corner ht_clone_bottom_inline_start_corner";case"top":return"ht_clone_top";case"top-inline-start-corner":return"ht_clone_top_left_corner ht_clone_top_inline_start_corner";default:return"ht_clone_master"}}getEditedCell(){return null===this.row||null===this.col?null:this.hot.getCell(this.row,this.col,!0)}checkEditorSection(){if(null===this.row||null===this.col)return"";let e=this.hot.countRows(),t=this.hot.getSettings(),r="";return this.row<(t.fixedRowsTop??0)?r=this.col<(t.fixedColumnsStart??0)?"top-inline-start-corner":"top":t.fixedRowsBottom&&this.row>=e-t.fixedRowsBottom?r=this.col<(t.fixedColumnsStart??0)?"bottom-inline-start-corner":"bottom":this.col<(t.fixedColumnsStart??0)&&(r="inline-start"),r}}th(n3,nJ);let n6=0,n5=class{constructor(e=null){this.context=e||this,this.context.eventListeners||(this.context.eventListeners=[])}addEventListener(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!this.context)return()=>{};function o(e){var t;let n;r.call(this,(n=(t=e).stopImmediatePropagation,t.stopImmediatePropagation=function(){n.apply(this),nR(this)},t))}return this.context.eventListeners.push({element:e,event:t,callback:r,callbackProxy:o,options:n,eventManager:this}),e.addEventListener(t,o,n),n6+=1,()=>{this.removeEventListener(e,t,r)}}removeEventListener(e,t,r){let n,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!this.context)return;let i=this.context.eventListeners.length;for(;i;)if(i-=1,(n=this.context.eventListeners[i]).event===t&&n.element===e){if(r&&r!==n.callback||o&&n.eventManager!==this)continue;this.context.eventListeners.splice(i,1),n.element.removeEventListener(n.event,n.callbackProxy,n.options),n6-=1}}clearEvents(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.context)return;let t=this.context.eventListeners.length;for(;t;){t-=1;let r=this.context.eventListeners[t];e&&r.eventManager!==this||(this.context.eventListeners.splice(t,1),r.element.removeEventListener(r.event,r.callbackProxy,r.options),n6-=1)}}clear(){this.clearEvents()}destroy(){this.clearEvents(),this.context=null}destroyWithOwnEventsOnly(){this.clearEvents(!0),this.context=null}fireEvent(e,t){let r,n="document"in e?e.document:void 0,o="window"in e?e:void 0;n||(o=(n=e.ownerDocument?e.ownerDocument:e).defaultView);let i={bubbles:!0,cancelable:"mousemove"!==t,view:o,detail:0,screenX:0,screenY:0,clientX:1,clientY:1,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:void 0};n.createEvent?(r=n.createEvent("MouseEvents")).initMouseEvent(t,i.bubbles,i.cancelable,i.view,i.detail,i.screenX,i.screenY,i.clientX,i.clientY,i.ctrlKey,i.altKey,i.shiftKey,i.metaKey,i.button,i.relatedTarget||n.body.parentNode):r=n.createEventObject(),e.dispatchEvent?e.dispatchEvent(r):e.fireEvent(`on${t}`,r)}};class n4{destroyed=!1;#l=!1;constructor(e,t,r){this.hot=e,this.tableMeta=t,this.selection=r,this.eventManager=new n5(e),this.hot.addHook("afterDocumentKeyDown",e=>this.#h(e)),this.hot.addHook("beforeCompositionStart",e=>this.#h(e)),this.hot.addHook("afterRowSequenceCacheUpdate",()=>this.#d()),this.hot.addHook("afterColumnSequenceCacheUpdate",()=>this.#d()),this.hot.view._wt.update("onCellDblClick",(e,t,r)=>this.#u(e,t))}getActiveEditor(){return this.activeEditor}prepareEditor(){if(this.#l=!1,this.activeEditor&&this.activeEditor.isWaiting())return void this.closeEditor(!1,!1,e=>{e&&this.prepareEditor()});let e=this.hot.getSelectedRangeActive()?.highlight;if(!e||e.isHeader())return;let{row:t,col:r}=e,n=this.hot.runHooks("modifyGetCellCoords",t,r,!1,"meta"),o=t,i=r;if(Array.isArray(n)&&([o,i]=n),this.cellProperties=this.hot.getCellMeta(o,i),!this.isCellEditable())return void this.clearActiveEditor();let s=this.hot.getCell(t,r,!0);if(s){var a;let e,n=this.hot.getCellEditor(this.cellProperties),l=this.hot.colToProp(i),h=this.hot.getSourceDataAtCell(this.hot.toPhysicalRow(o),i);this.activeEditor=(a=this.hot,nK(n)?(nq.get(n)||nZ(null,n),e=nq.get(n)):"string"==typeof n?e=nW(n):tr('Only strings and functions can be passed as "editor" parameter'),e||tr(`No editor registered under name "${n}"`),e.getInstance(a)),this.activeEditor.prepare(t,r,l,s,h,this.cellProperties)}}isEditorOpened(){return this.activeEditor&&this.activeEditor.isOpened()}openEditor(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!this.isCellEditable())return void this.clearActiveEditor();let n=this.hot.getSelectedRangeActive(),o=this.hot.runHooks("beforeBeginEditing",n.highlight.row,n.highlight.col,e,t,r);(t instanceof MouseEvent&&"boolean"!=typeof o&&(o=0===this.hot.selection.getLayerLevel()&&n.isSingle()),!1===o)?this.clearActiveEditor():(this.activeEditor||(this.hot.scrollToFocusedCell(),this.prepareEditor()),this.activeEditor&&(r&&this.activeEditor.enableFullEditMode(),this.activeEditor.beginEditing(e,t)))}closeEditor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2?arguments[2]:void 0;this.activeEditor?this.activeEditor.finishEditing(e,t,r):r&&r(!1)}closeEditorAndSaveChanges(e){this.closeEditor(!1,e)}closeEditorAndRestoreOriginalValue(e){this.closeEditor(!0,e)}clearActiveEditor(){this.activeEditor=void 0}isCellEditable(){let e=this.hot.getSelectedRangeActive();if(!e)return!1;let t=this.hot.getCellEditor(this.cellProperties),{row:r,col:n}=e.highlight;return!(null===r||null===n||this.cellProperties.readOnly||!t||this.#c(r,n))}moveSelectionAfterEnter(e){if(!this.hot.getSelected())return;let t={..."function"==typeof this.tableMeta.enterMoves?this.tableMeta.enterMoves(e):this.tableMeta.enterMoves};e.shiftKey&&(t.row=-(t.row??0),t.col=-(t.col??0)),this.hot.selection.isMultiple()?this.selection.transformFocus(t.row??0,t.col??0):this.selection.transformStart(t.row??0,t.col??0,!0)}#c(e,t){return this.hot.rowIndexMapper.isHidden(this.hot.toPhysicalRow(e))||this.hot.columnIndexMapper.isHidden(this.hot.toPhysicalColumn(t))}#d(e){let t=this.activeEditor??e;if(t&&null!==t.row&&null!==t.col&&this.#c(t.row,t.col)){if(t.isWaiting()){this.#l||(this.#l=!0,this.hot.addHookOnce("postAfterValidate",()=>{this.#l=!1,this.hot._registerTimeout(()=>this.#d(t),0)}));return}t.state!==n2.EDITING||this.#l||(this.#l=!0,this.hot._registerTimeout(()=>{this.#l=!1,!this.destroyed&&t.state===n2.EDITING&&null!==t.row&&null!==t.col&&this.#c(t.row,t.col)&&t.finishEditing(!1,!1,e=>{e||t.finishEditing(!0)})},0))}}#h(e){let t=this.hot.getSelectedRangeActive();if(!this.hot.isListening()||!t||t.highlight.isHeader()||nE(e))return;let{keyCode:r}=e,n=(e.ctrlKey||e.metaKey)&&!e.altKey;this.activeEditor&&(!this.activeEditor||this.activeEditor.isWaiting())||ny(r)||nS(r)||n||this.isEditorOpened()||this.openEditor("",e)}#u(e,t){t?.isCell()&&(this.hot.getShortcutManager().isCtrlPressed()?this.clearActiveEditor():this.openEditor(null,e,!0))}destroy(){this.destroyed=!0,this.eventManager.destroy()}}let n9=new WeakMap;n4.getInstance=function(e,t,r){let n=n9.get(e);return n||(n=new n4(e,t,r),n9.set(e,n)),n};let n7={"&nbsp;":" ","&amp;":"&","&lt;":"<","&gt;":">"},n8=RegExp(Object.keys(n7).map(e=>`(${e})`).join("|"),"gi");function oe(e){let t=e.hasColHeaders(),r=e.hasRowHeaders(),n=[t?-1:0,r?-1:0,e.countRows()-1,e.countCols()-1],o=e.getData(...n),i=o.length,s=i>0?o[0].length:0,a=["<table>","</table>"],l=t?["<thead>","</thead>"]:[],h=["<tbody>","</tbody>"],d=+!!r,u=+!!t;for(let n=0;n<i;n+=1){let i=t&&0===n,a=[];for(let t=0;t<s;t+=1){let s=!i&&r&&0===t,l="";if(i)l=`<th>${e.getColHeader(t-d)}</th>`;else if(s)l=`<th>${e.getRowHeader(n-u)}</th>`;else{let r=o[n][t],{hidden:i,rowspan:s,colspan:a}=e.getCellMetaTransient(n-u,t-d);if(!i){let e=[];if(s&&e.push(`rowspan="${s}"`),a&&e.push(`colspan="${a}"`),eP(r))l=`<td ${e.join(" ")}></td>`;else{let t=String(r).replaceAll("<","&lt;").replaceAll(">","&gt;").replace(/(<br(\s*|\/)>(\r\n|\n)?|\r\n|\n)/g,"<br>\r\n").replace(/\x20/gi,"&nbsp;").replace(/\t/gi,"&#9;");l=`<td ${e.join(" ")}>${t}</td>`}}}a.push(l)}let c=["<tr>",...a,"</tr>"].join("");i?l.splice(1,0,c):h.splice(-1,0,c)}return a.splice(1,0,l.join(""),h.join("")),a.join("")}function ot(e){let t=e.length,r=["<table>"];for(let n=0;n<t;n+=1){let o=e[n],i=o.length,s=[];0===n&&r.push("<tbody>");for(let e=0;e<i;e+=1){let t=o[e],r=eP(t)?"":t.toString().replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replace(/(<br(\s*|\/)>(\r\n|\n)?|\r\n|\n)/g,"<br>\r\n").replace(/\x20{2,}/gi,e=>`<span style="mso-spacerun: yes">${"&nbsp;".repeat(e.length-1)} </span>`).replace(/\t/gi,"&#9;");s.push(`<td>${r}</td>`)}r.push("<tr>",...s,"</tr>"),n+1===t&&r.push("</tbody>")}return r.push("</table>"),r.join("")}let or=/<td\b[^>]*>/i,on=/<\/\s*td\s*>/i,oo=/<p.*?>/g;function oi(e){let t=[],r=0;for(;r<e.length;){let n,o=e.substring(r).match(or);if(!o){t.push(e.substring(r));break}let i=r+(o.index??0),s=o[0],a=i+s.length;t.push(e.substring(r,i));let l=function(e,t){let r=1,n=t;for(;r>0;){let t=e.substring(n),o=t.match(or),i=t.match(on);if(!i)break;let s=n+(i.index??0),a=i[0].length,l=o?n+(o.index??0):e.length;if(l<s)r+=1,n=l+(o?.[0].length??0);else{if(0==(r-=1))return{start:s,length:a};n=s+a}}return null}(e,a);if(!l){t.push(e.substring(i));break}let h=e.substring(i,l.start+l.length),d=l.start-i,u=h.substring(s.length,d).trim().replaceAll(/\n\s+/g," ").replaceAll(oo,"\n").replace(/^\n+/,"").replaceAll(/<\/(.*)>\s+$/mg,"</$1>");do n=u,u=u.replace(/<(?!br\b)[^>]+>/gi,"");while(u!==n);u=u.replaceAll(/^&nbsp;$/mg,""),t.push(`${s}${u}</td>`),r=l.start+l.length}return t.join("")}function os(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document,n={},o=e,i=null;if("string"==typeof o){let e=oi(o);o=(i=new(r.defaultView?.DOMParser??DOMParser)().parseFromString(e,"text/html")).querySelector("table")}if(!o||"TABLE"!==((t=o)&&t.nodeName||""))return;let s=o,a=i?.querySelector('meta[name$="enerator"]')??null,l=null!==s.querySelector("tbody th"),h=s.querySelector("tr"),d=h?Array.from(h.cells).reduce((e,t)=>e+t.colSpan,0)-!!l:0,u=s.tFoot&&Array.from(s.tFoot.rows)||[],c=[],g=!1,p=0,m=0;if(s.tHead){let e=Array.from(s.tHead.rows).filter(e=>{let t=null!==e.querySelector("td");return t&&c.push(e),!t});g=(p=e.length)>0,p>1?n.nestedHeaders=Array.from(e).reduce((e,t)=>{let r=Array.from(t.cells).reduce((e,t,r)=>{if(l&&0===r)return e;let{colSpan:n,innerHTML:o}=t;return e.push(n>1?{label:o,colspan:n}:o),e},[]);return e.push(r),e},[]):g&&(n.colHeaders=Array.from(e[0].children).reduce((e,t,r)=>(l&&0===r||e.push(t.innerHTML),e),[]))}c.length&&(n.fixedRowsTop=c.length),u.length&&(n.fixedRowsBottom=u.length);let f=[...c,...Array.from(s.tBodies).reduce((e,t)=>(Array.from(t.rows).forEach(t=>{e.push(t)}),e),[]),...u],b=Array.from({length:m=f.length},()=>Array.from({length:d})),C=[],y=[];for(let e=0;e<m;e++){let t=Array.from(f[e].cells),r=t.length;for(let n=0;n<r;n++){let r=t[n],{nodeName:o,innerHTML:i,rowSpan:s,colSpan:l}=r,h=b[e].findIndex(e=>void 0===e);if("TD"===o){if(s>1||l>1){for(let t=e;t<e+s;t++)if(t<m)for(let e=h;e<h+l;e++)b[t][e]=null;let t=r.getAttribute("style");t&&t.includes("mso-ignore:colspan")||C.push({col:h,row:e,rowspan:s,colspan:l})}let t="";t=a&&/excel/gi.test(a.content)?i.replace(/[\r\n][\x20]{0,2}/g," ").replace(/<br(\s*|\/)>[\r\n]?[\x20]{0,3}/gim,"\r\n"):i.replace(/<br(\s*|\/)>[\r\n]?/gim,"\r\n"),b[e][h]=t.replace(n8,e=>n7[e])}else y.push(i)}}return C.length&&(n.mergeCells=C),y.length&&(n.rowHeaders=y),b.length&&(n.data=b),n}function oa(e){return e[0].toUpperCase()+e.substr(1)}function ol(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];let n=[],o=t.length;for(;o;){let e=eH(t[o-=1]).toLowerCase();-1===n.indexOf(e)&&n.push(e)}return 1===n.length}function oh(){let e=new Uint16Array(4);return globalThis.crypto.getRandomValues(e),Array.from(e,e=>e.toString(16).padStart(4,"0")).join("")}function od(e){if("string"!=typeof e)return!1;try{let t=JSON.parse(e);return"object"==typeof t&&null!==t}catch{return!1}}function ou(e){return/^(?:\d\d?%|100%)$/.test(e)}function oc(e){let t=String(e),r="",n=0,o=!1,i="";for(let e=0;e<t.length;e++){let s=t[e];n>0&&!o&&('"'===s||"'"===s)?(o=!0,i=s):o&&s===i?o=!1:o||"<"!==s?!o&&">"===s&&n>0?n-=1:0===n&&(r+=s):n+=1}return r}let og={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function op(e){return String(e).replace(/[&<>"']/g,e=>og[e])}function om(e){return t2("helper.sanitize","`sanitize()` is deprecated and will be removed in Handsontable 19.0.0. It returns its input unchanged. Use the `sanitizer` option to supply your own sanitizer."),e}function of(e){return"string"!=typeof e?e:e.replace(/([A-Z])/g,"-$1").replaceAll("_","-").toLowerCase()}let ob="Iİ\xcc\xcdĨ",oC=ob.toLowerCase(),oy=new Map;function ow(e,t){return!function(e){let t,r=oy.get(e);if(void 0!==r)return r;try{t=ob.toLocaleLowerCase(e)!==oC}catch{t=!1}return oy.set(e,t),t}(t)?e.toLowerCase():e.toLocaleLowerCase(t)}function oS(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if("number"==typeof e)return!isNaN(e)&&isFinite(e);if("string"==typeof e){if(0===e.length)return!1;if(1===e.length)return/\d/.test(e);let r=Array.from(new Set([".",...t])).map(e=>`\\${e}`).join("|");return RegExp(`^[+-]?(((${r})?\\d+((${r})\\d+)?(e[+-]?\\d+)?)|(0x[a-f\\d]+))$`,"i").test(e.trim())}return"object"==typeof e&&null!==e&&"number"==typeof e.valueOf()&&!(e instanceof Date)}function ov(e){return oS(e,[","])}function oR(e,t){return"."===t&&"string"==typeof e&&/^[+-]?[1-9]\d{0,2}(,\d{3})+$/.test(e.trim())}function oE(e,t){return","===t&&"string"==typeof e&&/^[+-]?[1-9]\d{0,2}(\.\d{3})+$/.test(e.trim())}function oT(e,t){return","===t&&"string"==typeof e&&/^[+-]?[1-9]\d{0,2}(\.\d{3})+,\d+$/.test(e.trim())}function oA(e,t,r){let n,o,i;for("function"==typeof t?(n=-1,o=e,i=t):(n=e-1,o=t,i=r);++n<=o&&!1!==i(n););}function oM(e,t,r){let n,o,i=e+1;for("function"==typeof t?(o=t,n=0):(o=r,n=t);--i>=n&&!1!==o(i););}function oI(e,t){return Number.parseInt(String(e*(t=isNaN(t=Number.parseInt(t.toString().replace("%",""),10))?0:t)/100),10)}function ox(e,t,r){return Math.min(e,t)===e?t:Math.max(e,r)===e?r:e}function oN(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{decimalSeparator:r}=t,n=e.trim();if(oR(e,r))return Number.parseFloat(n.replaceAll(",",""));if(oE(e,r))return Number.parseFloat(n.replaceAll(".",""));if(oT(e,r))return Number.parseFloat(n.replaceAll(".","").replace(",","."));let o=n.replace(",",".");return!1===isNaN(Number.parseFloat(o))?Number.parseFloat(o):null}function oO(e){let t=/^([+-]?)(\d*)(?:\.(\d*))?(?:e([+-]?\d+))?$/i.exec(e.trim());if(null===t||""===t[2]&&(t[3]??"")==="")return e.trim();let r="-"===t[1]?"-":"",n=t[2],o=t[3]??"",i=Number.parseInt(t[4]??"0",10);if(Math.abs(i)>1e3)return e.trim();let s=`${n}${o}`,a=n.length+i;a>s.length&&(s=s.padEnd(a,"0")),a<1&&(s=`${"0".repeat(1-a)}${s}`,a=1);let l=s.slice(0,a).replace(/^0+(?=\d)/,""),h=s.slice(a);return`${r}${l}${h.length>0?`.${h}`:""}`}function ok(e,t){let r=Object.is(t,-0)?"-0":String(t);return oO(e.replace(",","."))!==oO(r)}function oH(e){return Number.isInteger(e)&&"number"==typeof e&&e>=0}let o_=new Map([["asc",[-1,1]],["desc",[1,-1]]]),oL=e=>`The priority '${e}' is already declared in a map.`,oP=e=>`The priority '${e}' is not a number.`,oD=e=>`The id '${e}' is already declared in a map.`;function oF(){let{errorIdExists:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=new Map,r=na(e)?e:oD;function n(){return[...t]}function o(e){return t.has(e)}return{addItem:function(e,n){o(e)&&tr(String(r(e))),t.set(e,n)},clear:function(){t.clear()},getId:function(e){let[t]=n().find(t=>{let[r,n]=t;return e===n&&r})||[null];return t},getItem:function(e){return t.get(e)},getItems:n,getValues:function(){return[...t.values()]},hasItem:o,removeItem:function(e){return t.delete(e)}}}let oB=e=>`'${e}' value is already declared in a unique set.`,oV=e=>`There is already registered "${e}" plugin.`,oU=function(){let{errorPriorityExists:e,errorPriorityNaN:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=new Map,n=na(e)?e:oL,o=na(t)?t:oP;return{addItem:function(e,t){oS(e)||tr(String(o(e))),r.has(e)&&tr(String(n(e))),r.set(e,t)},getItems:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"asc",[t,n]=o_.get(e)||o_.get("asc");return[...r].sort((e,r)=>e[0]<r[0]?t:n).map(e=>e[1])}}}({errorPriorityExists:e=>`There is already registered plugin on priority "${e}".`,errorPriorityNaN:e=>`The priority "${e}" is not a number.`}),oz=function(){let{errorItemExists:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=new Set,r=na(e)?e:oB;return{addItem:function(e){t.has(e)&&tr(String(r(e))),t.add(e)},clear:function(){t.clear()},getItems:function(){return[...t]}}}({errorItemExists:oV}),oW=oF({errorIdExists:oV});function oG(){return[...oU.getItems(),...oz.getItems()]}function o$(e){let t=oa(e);return oW.getItem(t)}function oY(e,t,r){var n,o,i,s,a,l;let h,[d,u,c]=(n=e,o=t,i=r,"function"==typeof n&&(n=(o=n).PLUGIN_KEY,i=o.PLUGIN_PRIORITY),[n,o,i]);void 0===o$(d)&&(s=d,a=u,l=c,h=oa(s),oW.hasItem(h)&&tr(oV(h)),void 0===l?oz.addItem(h):oU.addItem(l,h),oW.addItem(h,a))}let{register:oj,getItem:oq,hasItem:oK,getNames:oX,getValues:oQ}=nU("renderers");function oZ(e){return"function"==typeof e?e:(oK(e)||tr(`No registered renderer found under "${e}" name`),oq(e))}function oJ(e,t){"string"!=typeof e&&(t=e,e=e.RENDERER_TYPE),oj(e,t)}let{register:o0,getItem:o1,hasItem:o2,getNames:o3,getValues:o6}=nU("validators");function o5(e){return"function"==typeof e?e:(o2(e)||tr(`No registered validator found under "${e}" name`),o1(e))}function o4(e,t){"string"!=typeof e&&(t=e,e=e.VALIDATOR_TYPE),o0(e,t)}function o9(e,t,r){return"function"==typeof t.valueFormatter?t.valueFormatter(e,t):"function"==typeof r&&"function"==typeof r.valueFormatter?r.valueFormatter.call(t,e,t):e}function o7(e,t){let[r]=t,n=t[6];try{e(...t),n._isBaseRendererCalled||r.getCellRenderer({renderer:"base"})(...t)}finally{n._isBaseRendererCalled=!1}}class o8{rowHeights=new Map;columnHeaderHeights=new Map;measure(e){if(this.rowHeights.clear(),this.columnHeaderHeights.clear(),!e?.wtTable)return;let t=e.wtSettings.getSetting("stylesHandler").areCellsBorderBox();this.#g(e.wtTable,t),[e.wtOverlays?.topOverlay?.clone,e.wtOverlays?.bottomOverlay?.clone].forEach(e=>{e?.wtTable&&this.#g(e.wtTable,t)}),this.#p(e.wtTable)}hasColumnHeaderTallerThan(e){for(let t of this.columnHeaderHeights.values())if(t>e)return!0;return!1}#g(e,t){let{TBODY:r,rowFilter:n}=e;if(!r||!n)return;let o=t?rB:rV,i=+!t,s=r.childNodes.length;for(;s;){let e;s-=1;let a=n.renderedToSource(s),l=r.childNodes[s],h=l.querySelector("th");e=h?o(h):o(l)-i,t||(e+=1),this.rowHeights.set(a,e)}}#p(e){let{THEAD:t}=e;if(!t)return;let r=t.childNodes;for(let e=0,t=r.length;e<t;e++){let t,n=r[e].childNodes;for(let e=0;e<n.length;e++){let r=n[e];if(r instanceof HTMLTableCellElement&&r.rowSpan<=1){let e=rV(r);(void 0===t||e>t)&&(t=e)}}void 0!==t&&this.columnHeaderHeights.set(e,t)}}}function ie(e){if("sourceCapabilities"in e&&e.sourceCapabilities)return!0===e.sourceCapabilities.firesTouchEvents}function it(e,t,r,n,o){let i=0;for(let s=r;s<=n;s++){let r=e.getCell({row:t,col:s},!0);if(!ne(r))continue;let n=e.domBindings.geometryReader.offsetWidth(r);if(o<i+n)return s;i+=n}return null}function ir(e,t,r,n,o){let i=0;for(let s=r;s<=n;s++){let r=e.getCell({row:s,col:t},!0);if(!ne(r))continue;let n=e.domBindings.geometryReader.offsetHeight(r);if(o<i+n)return s;i+=n}return null}function io(e){return{facadeGetter:e.getFacade(),rootDocument:e.rootDocument,rootWindow:e.rootWindow,geometryReader:e.geometryReader,wtSettings:e.wtSettings,eventManager:e.makeEventManager(),wtTable:e.getWtTable(),selectionManager:e.getSelectionManager()}}let ii=class{#m;#f;#b=null;#C=[null,null];#y=[null,null];#w=null;#S=0;#v=null;#R=!1;#E=null;#T=!1;#A=null;#M=0;#I=!1;#x=!1;#N=null;constructor(e,t=null){this.#m=e,this.#f=t,this.registerEvents()}registerEvents(){this.#m.eventManager.addEventListener(this.#m.wtTable.holder,"contextmenu",e=>this.onContextMenu(e)),this.#m.eventManager.addEventListener(this.#m.wtTable.TABLE,"mouseover",e=>this.onMouseOver(e)),this.#m.eventManager.addEventListener(this.#m.wtTable.TABLE,"mouseout",e=>this.onMouseOut(e)),this.#m.wtTable.isMaster&&(this.#m.eventManager.addEventListener(this.#m.rootDocument,"mousemove",e=>this.onMouseMove(e)),this.#m.eventManager.addEventListener(this.#m.rootDocument,"mouseup",()=>{this.#x=!1,this.#N=null}));let e=()=>{this.#m.eventManager.addEventListener(this.#m.wtTable.holder,"touchstart",e=>this.onTouchStart(e)),this.#m.eventManager.addEventListener(this.#m.wtTable.holder,"touchend",e=>this.onTouchEnd(e)),this.#m.eventManager.addEventListener(this.#m.wtTable.holder,"touchmove",e=>this.onTouchMove(e)),this.#m.eventManager.addEventListener(this.#m.wtTable.holder,"touchcancel",()=>this.onTouchCancel()),this.#m.eventManager.addEventListener(this.#m.wtTable.holder,"scroll",()=>this.onHolderScroll())},t=()=>{this.#m.eventManager.addEventListener(this.#m.wtTable.holder,"mouseup",e=>{this.#O(e)||this.onMouseUp(e)}),this.#m.eventManager.addEventListener(this.#m.wtTable.holder,"mousedown",e=>{this.#O(e)||this.onMouseDown(e)})};tW()?e():(tM()&&e(),t())}selectedCellWasTouched(e){let t=this.parentCell(e).coords;if(this.#b&&t){let[e,r]=[t.row,this.#b.from.row],[n,o]=[t.col,this.#b.from.col];return e===r&&n===o}return!1}parentCell(e){let t={coords:null,TD:null},r=rt(e,["TD","TH"],this.#m.wtTable.TABLE);if(r)t.coords=this.#m.wtTable.getCoords(r),t.TD=r;else if(rh(e,"wtBorder")&&rh(e,"current")){let e=this.#m.selectionManager.getFocusSelection()?.cellRange;e&&(t.coords=e.highlight,t.TD=this.#m.wtTable.getCell(t.coords))}else if(rh(e,"wtBorder")&&rh(e,"area")){let e=this.#m.selectionManager.getAreaSelection()?.cellRange;e&&(t.coords=e.to,t.TD=this.#m.wtTable.getCell(t.coords))}return t}#O(e){if(!1===ie(e))return!1;let t=Date.now()-this.#M<500;return this.#I&&t?("mouseup"===e.type&&(this.#I=!1),!0):(this.#I=!1,!1)}onMouseDown(e){let t=ni(this.#m.rootDocument),r=t4(e),n=t4(e);if(t&&!["TD","TH"].includes(t.nodeName)&&(n===t||t6(r,0)===t||t6(r,1)===t))return;let o=this.parentCell(n);rh(n,"corner")?this.#m.wtSettings.getSetting("onCellCornerMouseDown",e,n):o.TD&&(this.#x=!0,this.#N=null,this.#m.wtSettings.has("onCellMouseDown")&&this.callListener("onCellMouseDown",e,o.coords,o.TD)),!this.touchApplied&&0===e.button&&o.TD&&(this.#y[0]=o.TD,null!==this.#C[0]&&clearTimeout(this.#C[0]),this.#C[0]=setTimeout(()=>{this.#y[0]=null},1e3))}onContextMenu(e){if(this.#k(),this.#m.wtSettings.has("onCellContextMenu")){let t=this.parentCell(t4(e));t.TD&&this.callListener("onCellContextMenu",e,t.coords,t.TD)}}onMouseOver(e){if(!this.#m.wtSettings.has("onCellMouseOver"))return;let t=this.#m.wtTable.TABLE,r=rt(t4(e),["TD","TH"],t),n=this.#f||this;if(r&&r!==n.lastMouseOver&&rn(r,t)){n.lastMouseOver=r;let t=this.#m.wtTable.getCoords(r);t&&this.callListener("onCellMouseOver",e,t,r)}}onMouseMove(e){if(!this.#x)return;let{coords:t,isOutside:r}=this.#H(e.clientX,e.clientY);if(r){let r=this.#N;if(!r||r.row!==t.row||r.col!==t.col){let r=this.#m.wtTable.getCell(t);r instanceof HTMLElement&&(this.#N={row:t.row,col:t.col},this.callListener("onCellMouseOverOutside",e,t,r))}}else this.#N=null}#H(e,t){return function(e,t,r){let n=e.wtSettings.getSetting("rtlMode"),o=e.facadeGetter(),i=e.wtSettings.getSetting("fixedColumnsStart"),s=e.wtSettings.getSetting("fixedRowsTop"),a=e.wtSettings.getSetting("fixedRowsBottom"),l=o.wtScroll.getFirstPartiallyVisibleRow(),h=o.wtScroll.getLastPartiallyVisibleRow(),d=o.wtScroll.getFirstPartiallyVisibleColumn(),u=o.wtScroll.getLastPartiallyVisibleColumn(),c=e.geometryReader.getBoundingClientRect(e.wtTable.wtRootElement),g=e.wtSettings.getSetting("columnHeaders").length>0?o.wtViewport.getColumnHeaderHeight():0,p=e.wtSettings.getSetting("rowHeaders").length>0?o.wtViewport.getRowHeaderWidth():0,m=e.rootWindow,f=o.wtViewport.isHorizontallyScrollableByWindow()?Math.min(0,c.left):c.left,b=o.wtViewport.isVerticallyScrollableByWindow()?Math.min(0,c.top):c.top,C=o.wtViewport.isHorizontallyScrollableByWindow()?m.innerWidth:c.left+o.wtViewport.getViewportWidth()+p,y=o.wtViewport.isVerticallyScrollableByWindow()?m.innerHeight:c.top+o.wtViewport.getViewportHeight()+g,w=ox(t,f,C),S=ox(r,b,y),v=null;if(i>0){let t=o.getCell({row:l,col:0},!0);if(ne(t)){let r=e.geometryReader.getBoundingClientRect(t);v=it(o,l,0,i-1,n?r.right-w:w-r.left)}}if(null===v){let t=o.getCell({row:l,col:d},!0);if(ne(t)){let r=e.geometryReader.getBoundingClientRect(t),i=n?r.right-w:w-r.left;null===(v=it(o,l,d,u,i))&&(v=i<0?d:u)}else v=d}let R=null;if(s>0){let t=o.getCell({row:0,col:d},!0);ne(t)&&(R=ir(o,d,0,s-1,S-e.geometryReader.getBoundingClientRect(t).top))}if(null===R&&a>0){let t=e.wtSettings.getSetting("totalRows"),r=t-a,n=t-1,i=o.getCell({row:r,col:d},!0);if(ne(i)){let t=S-e.geometryReader.getBoundingClientRect(i).top;t>=0&&null===(R=ir(o,d,r,n,t))&&(R=n)}}if(null===R){let t=o.getCell({row:l,col:d},!0);ne(t)?null===(R=ir(o,d,l,h,S-e.geometryReader.getBoundingClientRect(t).top))&&(R=h):R=l}return{coords:o.createCellCoords(R,v),isOutside:t<f||t>C||r<b||r>y}}(this.#m,e,t)}onMouseOut(e){if(!this.#m.wtSettings.has("onCellMouseOut"))return;let t=this.#m.wtTable.TABLE,r=rt(t4(e),["TD","TH"],t),n=rt(e.relatedTarget,["TD","TH"],t),o=this.#f||this;if(r&&r!==n&&rn(r,t)){let t=this.#m.wtTable.getCoords(r);t&&this.callListener("onCellMouseOut",e,t,r),null===n&&(o.lastMouseOver=null)}}onMouseUp(e){this.#x=!1,this.#N=null;let t=this.parentCell(t4(e));(t.TD&&this.#m.wtSettings.has("onCellMouseUp")&&this.callListener("onCellMouseUp",e,t.coords,t.TD),this.touchApplied)?this.#_(e,t):0===e.button&&(t.TD&&t.TD===this.#y[0]&&t.TD===this.#y[1]?(this.#L(e,t),this.#y[0]=null,this.#y[1]=null):t.TD&&t.TD===this.#y[0]&&(this.#y[1]=t.TD,null!==this.#C[1]&&clearTimeout(this.#C[1]),this.#C[1]=setTimeout(()=>{this.#y[1]=null},500)))}#_(e,t){if(this.#R||!t.TD||!t.coords){this.#w=null;return}let r=Date.now();if(null!==this.#w&&this.#w.row===t.coords.row&&this.#w.col===t.coords.col&&r-this.#S<1e3){this.#L(e,t),this.#w=null;return}this.#w=t.coords.clone(),this.#S=r}#L(e,t){rh(t4(e),"corner")?this.callListener("onCellCornerDblClick",e,t.coords,t.TD):this.callListener("onCellDblClick",e,t.coords,t.TD)}onTouchStart(e){this.#b=this.#m.selectionManager.getFocusSelection()?.cellRange??null,this.touchApplied=!0,this.#T=!1,this.#R=!1,this.#A=e,this.#P(e)}onTouchEnd(e){let t=this.#T,r=!t&&!this.#R&&null!==this.#A,n=this.#A;this.#k(),this.#A=null,r&&null!==n&&this.onMouseDown(n);let o=t4(e),i=this.parentCell(o)?.coords,s=null!=i&&(i.row??-1)>=0&&(i.col??-1)>=0;e.cancelable&&s&&this.#m.wtSettings.getSetting("isDataViewInstance")&&(tG()&&(tP()||tF())&&this.selectedCellWasTouched(o)&&!["A","BUTTON","INPUT"].includes(o.tagName)?e.preventDefault():this.selectedCellWasTouched(o)||"INPUT"===o.tagName&&"checkbox"===o.type||e.preventDefault()),!t||this.#R?(this.onMouseUp(e),this.#M=Date.now(),this.#I=!0):(this.#w=null,this.#I=!1),this.touchApplied=!1,this.#T=!1,this.#R=!1}onTouchCancel(){this.#k(),this.touchApplied=!1,this.#x=!1,this.#T=!1,this.#R=!1,this.#A=null,this.#w=null,this.#I=!1}#P(e){this.#k();let t=e.touches[0];t&&(this.#E={x:t.clientX,y:t.clientY},this.#v=setTimeout(()=>{this.#v=null,this.#R=!0,this.#E=null,this.onMouseDown(e),this.#y[0]=null,this.#y[1]=null,this.#w=null,null!==this.#C[0]&&clearTimeout(this.#C[0]),null!==this.#C[1]&&clearTimeout(this.#C[1]);let r=e.target;if(!r)return;let n=new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0,clientX:t.clientX,clientY:t.clientY,screenX:t.screenX,screenY:t.screenY});r.dispatchEvent(n)},500))}onHolderScroll(){this.momentumScrolling||(this.momentumScrolling={}),this.touchApplied&&(this.#T=!0),this.#k(),clearTimeout(this.momentumScrolling._timeout),this.momentumScrolling.ongoing||this.#m.wtSettings.getSetting("onBeforeTouchScroll"),this.momentumScrolling.ongoing=!0,this.momentumScrolling._timeout=setTimeout(()=>{this.touchApplied||(this.momentumScrolling.ongoing=!1,this.#m.wtSettings.getSetting("onAfterMomentumScroll"))},200)}#k(){null!==this.#v&&(clearTimeout(this.#v),this.#v=null),this.#E=null}onTouchMove(e){if(null===this.#E)return;let t=e.touches[0];if(!t){this.#T=!0,this.#k();return}let r=Math.abs(t.clientX-this.#E.x),n=Math.abs(t.clientY-this.#E.y);(r>10||n>10)&&(this.#T=!0,this.#k())}callListener(e,t,r,n){let o=this.#m.wtSettings.getSettingPure(e);o&&o(t,r,n,this.#m.facadeGetter())}destroy(){null!==this.#C[0]&&clearTimeout(this.#C[0]),null!==this.#C[1]&&clearTimeout(this.#C[1]),this.#k(),this.momentumScrolling&&clearTimeout(this.momentumScrolling._timeout),this.#m.eventManager.destroy()}},is="bottom",ia="inline_start",il="top_inline_start_corner",ih="bottom_inline_start_corner",id=["top",is,ia,il,ih],iu=new Map([["top","ht_clone_top"],[is,`ht_clone_${is}`],[ia,`ht_clone_${ia} ht_clone_left`],[il,`ht_clone_${il} ht_clone_top_left_corner`],[ih,`ht_clone_${ih} ht_clone_bottom_left_corner`]]),ic={getCell(e){if(null===e.row||null===e.col)return -5;let t=e.row,r=e.col,n=this.wtSettings.getSetting("onModifyGetCellCoords",t,r,!this.isMaster,"render");if(n&&Array.isArray(n)&&([t,r]=n),this.isRowBeforeRenderedRows(t))return -1;if(this.isRowAfterRenderedRows(t))return -2;if(this.isColumnBeforeRenderedColumns(r))return -3;if(this.isColumnAfterRenderedColumns(r))return -4;let o=this.getRow(t);!o&&t>=0&&tr("TR was expected to be rendered but is not");let i=(!1!==o?o:null)?.childNodes[this.columnFilter.sourceColumnToVisibleRowHeadedColumn(r)];return!i&&r>=0&&tr("TD or TH was expected to be rendered but is not"),i},getRow(e){let t=null,r=null;if((e<0?(t=this.rowFilter?.sourceRowToVisibleColHeadedRow(e),r=this.THEAD):(t=this.rowFilter?.sourceToRendered(e),r=this.TBODY),null!=t&&null!==r)&&!(r.childNodes.length<t+1))return r.childNodes[t];return!1},getColumnHeader(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.THEAD.childNodes[t],n=r?.childNodes[this.columnFilter.sourceColumnToVisibleRowHeadedColumn(e)];return ne(n)?n:void 0},getColumnHeaders(e){let t=[],r=this.columnFilter.sourceColumnToVisibleRowHeadedColumn(e);return this.THEAD.childNodes.forEach(e=>{let n=e.childNodes[r];nt(n)&&t.push(n)}),t},getRowHeader(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(t>=this.wtSettings.getSetting("rowHeaders").length)return;let r=this.rowFilter.sourceToRendered(e),n=r<0?this.rowFilter.sourceRowToVisibleColHeadedRow(e):r,o=r<0?this.THEAD:this.TBODY,i=o?.childNodes[n],s=i?.childNodes[t];return ne(s)?s:void 0},getRowHeaders(e){let t=[],r=this.wtSettings.getSetting("rowHeaders").length;for(let n=0;n<r;n++){let r=this.TBODY.childNodes[this.rowFilter.sourceToRendered(e)],o=r?.childNodes[n];o&&t.push(o)}return t},getCoords(e){let t=e;if("TD"!==t.nodeName&&"TH"!==t.nodeName&&(t=re(t,["TD","TH"])),null===t)return null;let r=t.parentNode;if(!r)return null;let n=r.parentNode;if(!n)return null;let o=ne(r)?ro(r):0,i=nt(t)?t.cellIndex:0;ri(il,t,this.wtRootElement)||ri("top",t,this.wtRootElement)?"THEAD"===n.nodeName&&(o-=n.childNodes.length):ri(ih,t,this.wtRootElement)||ri("bottom",t,this.wtRootElement)?o=this.wtSettings.getSetting("totalRows")-n.childNodes.length+o:n===this.THEAD?o=this.rowFilter.visibleColHeadedRowToSourceRow(o):this.rowFilter&&(o=this.rowFilter.renderedToSource(o)),ri(il,t,this.wtRootElement)||ri(ia,t,this.wtRootElement)||ri(ih,t,this.wtRootElement)?i=this.columnFilter.offsettedTH(i):this.columnFilter&&(i=this.columnFilter.visibleRowHeadedColumnToSourceColumn(i));let s=this.wtSettings.getSetting("onModifyGetCoordsElement",o,i);return s&&Array.isArray(s)&&([o,i]=s),this.wot.createCellCoords(o,i)},getTrForRow(e){return this.TBODY.childNodes[this.rowFilter.sourceToRendered(e)]}};tg(ic,"MIXIN_NAME","cellAccess",{writable:!1,enumerable:!1});let ig={fixTableDomTree(){let e=this.deps.rootDocument;this.TBODY=this.TABLE.querySelector("tbody"),this.TBODY||(this.TBODY=e.createElement("tbody"),this.TABLE.appendChild(this.TBODY)),this.THEAD=this.TABLE.querySelector("thead"),this.THEAD||(this.THEAD=e.createElement("thead"),this.TABLE.insertBefore(this.THEAD,this.TBODY)),this.COLGROUP=this.TABLE.querySelector("colgroup"),this.COLGROUP||(this.COLGROUP=e.createElement("colgroup"),this.TABLE.insertBefore(this.COLGROUP,this.THEAD))},createSpreader(e){let t,r=e.parentNode;return r&&r.nodeType===Node.ELEMENT_NODE&&ne(r)&&rh(r,"wtHolder")||((t=this.deps.rootDocument.createElement("div")).className="wtSpreader",r&&e.before(t),t.appendChild(e)),t&&(t.style.position="relative",this.wtSettings.getSetting("ariaTags")&&rc(t,[R()])),t},createHider(e){let t,r=e.parentNode;return r&&r.nodeType===Node.ELEMENT_NODE&&ne(r)&&rh(r,"wtHolder")||((t=this.deps.rootDocument.createElement("div")).className="wtHider",r&&e.before(t),t.appendChild(e)),t&&this.wtSettings.getSetting("ariaTags")&&rc(t,[R()]),t},createHolder(e){let t,r=e.parentNode;if(!r||r.nodeType!==Node.ELEMENT_NODE||!ne(r)||!rh(r,"wtHolder")){if((t=this.deps.rootDocument.createElement("div")).style.position="relative",t.className="wtHolder",this.isMaster&&rc(t,[v(-1)]),r&&e.before(t),this.isMaster){let e=t.parentNode;ne(e)&&(e.className+="ht_master handsontable",e.setAttribute("dir",this.wtSettings.getSettingPure("rtlMode")?"rtl":"ltr"),this.wtSettings.getSetting("ariaTags")&&rc(e,[R()]))}t.appendChild(e)}return t&&this.wtSettings.getSetting("ariaTags")&&rc(t,[R()]),t}};tg(ig,"MIXIN_NAME","domScaffold",{writable:!1,enumerable:!1});class ip{nextSize=0;nextOffset=0;setSize(e){this.nextSize=e}setOffset(e){this.nextOffset=e}}class im{size=new ip;workingSpace=0;sharedSize=null;setSize(e){this.size.setSize(e)}setOffset(e){this.size.setOffset(e)}getViewSize(){return this.size}isShared(){return null!==this.sharedSize}isPlaceOn(e){return this.workingSpace===e}append(e){this.workingSpace=1,e.workingSpace=2,this.sharedSize=e.getViewSize()}prepend(e){this.workingSpace=2,e.workingSpace=1,this.sharedSize=e.getViewSize()}}class ib{rootNode;nodesPool;sizeSet=new im;collectedNodes=[];childNodeType;visualIndex=0;constructor(e,t,r){this.rootNode=e,this.nodesPool=t,this.childNodeType="string"==typeof r?r.toUpperCase():r}setSize(e){return this.sizeSet.setSize(e),this}setOffset(e){return this.sizeSet.setOffset(e),this}isSharedViewSet(){return this.sizeSet.isShared()}getNode(e){return e<this.collectedNodes.length?this.collectedNodes[e]:null}getCurrentNode(){let e=this.collectedNodes.length;return e>0?this.collectedNodes[e-1]:null}getRenderedChildCount(){let{rootNode:e,sizeSet:t}=this,r=0;if(this.isSharedViewSet()){let n=e.firstElementChild;for(;n;){if(n.tagName===this.childNodeType)r+=1;else if(t.isPlaceOn(1))break;n=n.nextElementSibling}}else r=e.childElementCount;return r}start(){this.collectedNodes.length=0,this.visualIndex=0;let{rootNode:e,sizeSet:t}=this,r=this.isSharedViewSet(),{nextSize:n}=t.getViewSize(),o=this.getRenderedChildCount();for(;o<n;){let n=this.nodesPool();!r||t.isPlaceOn(2)?e.appendChild(n):e.insertBefore(n,e.firstChild),o+=1}let i=r&&t.isPlaceOn(1);for(;o>n;){let t=i?e.firstChild:e.lastChild;t&&e.removeChild(t),o-=1}}render(){let{rootNode:e,sizeSet:t}=this,r=this.visualIndex;this.isSharedViewSet()&&t.isPlaceOn(2)&&t.sharedSize&&(r+=t.sharedSize.nextSize);let n=e.children[r];if(n){if(n.tagName!==this.childNodeType){let e=this.nodesPool();n.replaceWith(e),n=e}}else n=this.nodesPool(),e.appendChild(n);this.collectedNodes.push(n),this.visualIndex+=1}end(){}}class iC extends ib{prependView(e){return this.sizeSet.prepend(e.sizeSet),e.sizeSet.append(this.sizeSet),this}appendView(e){return this.sizeSet.append(e.sizeSet),e.sizeSet.prepend(this.sizeSet),this}}class iy{nodeType;constructor(e){this.nodeType=e.toUpperCase()}setRootDocument(e){this.rootDocument=e}obtain(e,t){return this.rootDocument.createElement(this.nodeType)}}class iw{nodesPool=null;renderedNodes=0;constructor(e,t){this.nodesPool="string"==typeof e?new iy(e):null,this.nodeType=e,void 0!==t&&(this.rootNode=t)}setTable(e){this.nodesPool&&this.nodesPool.setRootDocument(e.rootDocument),this.table=e}render(){}}class iS extends iw{orderViews=new WeakMap;constructor(){super("TH")}obtainOrderView(e){return this.orderViews.has(e)||this.orderViews.set(e,new iC(e,()=>this.nodesPool.obtain(),this.nodeType)),this.orderViews.get(e)}render(){let{rowsToRender:e,rowHeaderFunctions:t,rowHeadersCount:r,rows:n,cells:o}=this.table;for(let i=0;i<e;i++){let e=this.table.renderedRowToSource(i),s=n.getRenderedNode(i);if(!s)continue;let a=this.obtainOrderView(s),l=o.obtainOrderView(s);a.appendView(l).setSize(r).setOffset(0).start();for(let n=0;n<r;n++){a.render();let r=a.getCurrentNode();r&&(r.className="",r.removeAttribute("style"),rg(r,[/aria-(.*)/,/role/]),this.table.isAriaEnabled()&&rc(r,[A(),k(),V(n+1),v(-1)]),t[n](e,r,n))}a.end()}}}class iv extends iw{orderView;constructor(e){super("TR",e),this.orderView=new ib(e,()=>this.nodesPool.obtain(),this.nodeType)}getRenderedNode(e){return this.orderView.getNode(e)}render(){let{columnHeadersCount:e}=this.table;this.table.isAriaEnabled()&&rc(this.rootNode,[M()]),this.orderView.setSize(e).setOffset(0).start();for(let t=0;t<e;t++){this.orderView.render();let e=this.orderView.getCurrentNode();e&&this.table.isAriaEnabled()&&rc(e,[x(),B(t+1)])}this.orderView.end()}}class iR extends iw{orderViews=new WeakMap;constructor(){super("TH")}obtainOrderView(e){return this.orderViews.has(e)||this.orderViews.set(e,new ib(e,()=>this.nodesPool.obtain(),this.nodeType)),this.orderViews.get(e)}render(){let{columnHeadersCount:e,columnHeaderFunctions:t,columnsToRender:r,rowHeadersCount:n,columnHeaderRows:o}=this.table,i=r+n;for(let r=0;r<e;r++){let e=o.getRenderedNode(r);if(!e)continue;let s=this.obtainOrderView(e);s.setSize(i).setOffset(0).start();for(let e=0;e<i;e++){s.render();let o=e-n,i=this.table.renderedColumnToSource(o),a=s.getCurrentNode();a&&(a.className="",a.removeAttribute("style"),rg(a,[/aria-(.*)/,/role/]),this.table.isAriaEnabled()&&rc(a,[V(e+1),v(-1),I(),...o>=0?[O()]:[T(),H("Select whole grid")]]),t[r](i,a,r))}s.end(),this.#D(e)}}#D(e){let{children:t}=e,r=null;for(let e=t.length-1;e>=0;e--){let n=t[e];null!==r||rh(n,"hiddenHeader")?rh(n,"htLastVisibleHeader")&&ru(n,"htLastVisibleHeader"):(r=n,rh(n,"htLastVisibleHeader")||rd(n,"htLastVisibleHeader"))}}}let iE=!1;class iT extends iw{orderView;constructor(e){super("COL",e),this.orderView=new ib(e,()=>this.nodesPool.obtain(),this.nodeType)}render(){let{columnsToRender:e,rowHeadersCount:t}=this.table,r=e+t;!iE&&e>1e3&&(iE=!0,tQ(ec`Performance tip: Handsontable rendered more than 1000 visible columns.\x20
        Consider limiting the number of rendered columns by specifying the table width and/or\x20
        turning off the "renderAllColumns" option.`)),this.orderView.setSize(r).setOffset(0).start();for(let e=0;e<r;e++){this.orderView.render();let r=this.orderView.getCurrentNode();if(r)if(e<t){let t=this.table.renderedColumnToSource(e);r.style.width=`${this.table.columnUtils.getHeaderWidth(t)}px`}else{let n=this.table.renderedColumnToSource(e-t);r.style.width=`${this.table.columnUtils.getWidth(n)}px`}}this.orderView.end();let n=this.rootNode.firstChild;n&&rd(n,"rowHeader")}}let iA="ht__row_even",iM="ht__row_odd",iI=!1;class ix extends iw{constructor(e){super("TR",e),this.orderView=new ib(e,()=>this.nodesPool.obtain(),this.nodeType)}getRenderedNode(e){return this.orderView.getNode(e)}render(){let{rowsToRender:e}=this.table;!iI&&e>1e3&&(iI=!0,tQ(ec`Performance tip: Handsontable rendered more than 1000 visible rows.\x20
        Consider limiting the number of rendered rows by specifying the table height and/or\x20
        turning off the "renderAllRows" option.`)),this.table.isAriaEnabled()&&rc(this.rootNode,[M()]),this.orderView.setSize(e).setOffset(this.table.renderedRowToSource(0)).start();for(let t=0;t<e;t++){this.orderView.render();let e=this.orderView.getCurrentNode(),r=this.table.renderedRowToSource(t);e&&(this.table.isAriaEnabled()&&rc(e,[x(),B(r+(this.table.rowUtils?.deps?.getColumnHeaders()?.length??0)+1)]),(r+1)%2==0?rh(e,iA)||(ru(e,iM),rd(e,iA)):rh(e,iM)||(ru(e,iA),rd(e,iM)))}this.orderView.end()}}class iN extends iw{orderViews=new WeakMap;constructor(){super("TD")}obtainOrderView(e){return this.orderViews.has(e)||this.orderViews.set(e,new iC(e,()=>this.nodesPool.obtain(),this.nodeType)),this.orderViews.get(e)}render(){let{rowsToRender:e,columnsToRender:t,rows:r,rowHeaders:n}=this.table;for(let o=0;o<e;o++){let e=this.table.renderedRowToSource(o),i=r.getRenderedNode(o);if(!i)continue;let s=this.obtainOrderView(i),a=n.obtainOrderView(i);s.prependView(a).setSize(t).setOffset(0).start();for(let r=0;r<t;r++){s.render();let t=this.table.renderedColumnToSource(r),n=s.getCurrentNode();n&&(rh(n,"hide")||(n.className=""),n.removeAttribute("style"),n.removeAttribute("dir"),rg(n,[/aria-(.*)/,/role/]),this.table.cellRenderer(e,t,n),this.table.isAriaEnabled()&&rc(n,[...n.hasAttribute("role")?[]:[E()],v(-1),V(t+(this.table.rowUtils?.deps?.getRowHeaders()?.length??0)+1)]))}s.end()}}}class iO{rowHeaders=null;columnHeaderRows=null;columnHeaders=null;colGroup=null;rows=null;cells=null;rowFilter=null;columnFilter=null;rowUtils=null;columnUtils=null;rowsToRender=0;columnsToRender=0;rowHeaderFunctions=[];rowHeadersCount=0;columnHeaderFunctions=[];columnHeadersCount=0;#F=!1;#B=!1;#V=-1;#U=-1;#z=-1;#W=-1;constructor(e,{cellRenderer:t,stylesHandler:r}={}){this.rootNode=e,this.rootDocument=this.rootNode.ownerDocument,this.cellRenderer=t,this.stylesHandler=r}setActiveOverlayName(e){this.activeOverlayName=e}setAxisUtils(e,t){this.rowUtils=e,this.columnUtils=t}setViewportSize(e,t){this.rowsToRender=e,this.columnsToRender=t}setColumnHeadersRenderSkippable(e){this.#F=e}setFilters(e,t){this.rowFilter=e,this.columnFilter=t}setHeaderContentRenderers(e,t){this.rowHeaderFunctions=e,this.rowHeadersCount=e.length,this.columnHeaderFunctions=t,this.columnHeadersCount=t.length}setRenderers(e){let{rowHeaders:t,columnHeaderRows:r,columnHeaders:n,colGroup:o,rows:i,cells:s}=e;t.setTable(this),r.setTable(this),n.setTable(this),o.setTable(this),i.setTable(this),s.setTable(this),this.rowHeaders=t,this.columnHeaderRows=r,this.columnHeaders=n,this.colGroup=o,this.rows=i,this.cells=s}renderedRowToSource(e){return this.rowFilter.renderedToSource(e)}renderedColumnToSource(e){return this.columnFilter.renderedToSource(e)}isAriaEnabled(){return this.rowUtils.wtSettings.getSetting("ariaTags")}#G(){return this.#F&&this.#B&&this.#V===(this.columnFilter?this.columnFilter.offset:0)&&this.#U===this.columnsToRender&&this.#z===this.columnHeadersCount&&this.#W===this.rowHeadersCount}#$(){this.#B=!0,this.#V=this.columnFilter?this.columnFilter.offset:0,this.#U=this.columnsToRender,this.#z=this.columnHeadersCount,this.#W=this.rowHeadersCount}render(){this.#G()||(this.columnHeaderRows.render(),this.columnHeaders.render(),this.#$()),this.rows.render(),this.rowHeaders.render(),this.cells.render(),this.columnUtils.calculateWidths(),this.colGroup.render();let{rowsToRender:e,rows:t}=this;for(let r=0;r<e;r++){let e=t.getRenderedNode(r),n=this.rowUtils;if(e&&e.firstChild){let t=this.renderedRowToSource(r),o=n.getHeightByOverlayName(t,this.activeOverlayName);if(o){let t=o-!this.stylesHandler.areCellsBorderBox();e.firstChild.style.height=`${t}px`}else e.firstChild.style.height=""}}}}class ik{constructor({TABLE:e,THEAD:t,COLGROUP:r,TBODY:n,rowUtils:o,columnUtils:i,cellRenderer:s,stylesHandler:a}={}){this.renderer=new iO(e,{cellRenderer:s,stylesHandler:a}),this.renderer.setRenderers({rowHeaders:new iS,columnHeaderRows:new iv(t),columnHeaders:new iR,colGroup:new iT(r),rows:new ix(n),cells:new iN}),this.renderer.setAxisUtils(o,i)}setActiveOverlayName(e){return this.renderer.setActiveOverlayName(e),this}setFilters(e,t){return this.renderer.setFilters(e,t),this}setViewportSize(e,t){return this.renderer.setViewportSize(e,t),this}setHeaderContentRenderers(e,t){return this.renderer.setHeaderContentRenderers(e,t),this}setColumnHeadersRenderSkippable(e){return this.renderer.setColumnHeadersRenderSkippable(e),this}render(){this.renderer.render()}}class iH{#m;#Y;wtSettings;headerWidths=new Map;get deps(){return this.#m}constructor(e){this.#m=e,this.#Y=e.columnSizeSource,this.wtSettings=e.wtSettings}getWidth(e){return this.#Y.getSize(e)||this.#Y.getDefaultSize()}getHeaderHeight(e){let t=this.wtSettings.getSetting("stylesHandler").getDefaultRowHeight(),r=this.wtSettings.getSetting("columnHeaderHeight"),n=Array.isArray(r)?r[e]:r;return null!=n?t?Math.max(t,n):n:t}getHeaderWidth(e){let{columnFilter:t}=this.#m.getWtTable();if(t)return this.headerWidths.get(t.sourceToRendered(e))}calculateWidths(){let{wtSettings:e}=this,t=e.getSetting("rowHeaderWidth");if(null!=(t=e.getSetting("onModifyRowHeaderWidth",t))){let r=e.getSetting("rowHeaders").length,n=e.getSetting("defaultColumnWidth");for(let e=0;e<r;e++){let r=Array.isArray(t)?t[e]:t;r=null==r?n:r,this.headerWidths.set(e,r)}}}}class i_{#m;#j;wtSettings;get deps(){return this.#m}constructor(e){this.#m=e,this.#j=e.rowSizeSource,this.wtSettings=e.wtSettings}getHeight(e){let t=this.#j.getSize(e),r=this.#m.getWtViewport().oversizedRows[e];return void 0!==r&&(t=void 0===t?r:Math.max(t,r)),t}getHeightByOverlayName(e,t){let r=this.#j.getSizeForOverlay(e,t),n=this.#m.getWtViewport().oversizedRows[e];return void 0!==n&&(r=void 0===r?n:Math.max(r,n)),r}}let iL=class{offset;total;countTH;constructor(e,t,r){this.offset=e,this.total=t,this.countTH=r}offsetted(e){return e+this.offset}unOffsetted(e){return e-this.offset}renderedToSource(e){return this.offsetted(e)}sourceToRendered(e){return this.unOffsetted(e)}offsettedTH(e){return e-this.countTH}unOffsettedTH(e){return e+this.countTH}visibleRowHeadedColumnToSourceColumn(e){return this.renderedToSource(this.offsettedTH(e))}sourceColumnToVisibleRowHeadedColumn(e){return this.unOffsettedTH(this.sourceToRendered(e))}},iP=class{offset;total;countTH;constructor(e,t,r){this.offset=e,this.total=t,this.countTH=r}offsetted(e){return e+this.offset}unOffsetted(e){return e-this.offset}renderedToSource(e){return this.offsetted(e)}sourceToRendered(e){return this.unOffsetted(e)}offsettedTH(e){return e-this.countTH}unOffsettedTH(e){return e+this.countTH}visibleColHeadedRowToSourceRow(e){return this.renderedToSource(this.offsettedTH(e))}sourceRowToVisibleColHeadedRow(e){return this.unOffsettedTH(this.sourceToRendered(e))}};function iD(e){let{wtSettings:t}=e,r=e.THEAD.childNodes,n=t.getSetting("stylesHandler").getDefaultRowHeight(),o=t.getSetting("columnHeaders");for(let t=0,i=o.length;t<i;t++){let o=e.getColumnHeaderHeight(t);if(o>n){if(!r[t]||0===r[t].childNodes.length)return;let e=r[t].childNodes[0];ne(e)&&(e.style.height=`${o}px`)}}}function iF(e){let t=e.deps.getWtOverlays(),r=t.topInlineStartCornerOverlay?.clone;if(!r?.wtTable?.THEAD)return;let n=e.wtSettings.getSetting("columnHeaders");if(!n.length)return;let o=r.wtTable.THEAD.childNodes,i=t.topOverlay?.clone,s=[e.THEAD,i?.wtTable?.THEAD];for(let t=0,r=n.length;t<r;t++){let r=o[t];if(!ne(r))continue;let n=e.deps.geometryReader.getBoundingClientRect(r).height;s.forEach(r=>{let o=r?.childNodes[t];if(!ne(o)||0===o.childNodes.length)return;let i=o.childNodes[0];!ne(i)||Math.abs(e.deps.geometryReader.getBoundingClientRect(o).height-n)>.1&&(i.style.height=`${n}px`)})}}function iB(e){let{TBODY:t,rowFilter:r}=e;if(!t||!r)return;let n=e.wtSettings.getSetting("stylesHandler").areCellsBorderBox(),o=t.childNodes;for(let t=0;t<o.length;t++){let i=o[t].firstChild;if(!ne(i))continue;let s=r.renderedToSource(t),a=e.rowUtils.getHeightByOverlayName(s,e.name);i.style.height=a?`${a-!n}px`:""}}function iV(e){let{wtSettings:t}=e;return!t.getSetting("externalRowCalculator")&&!!t.getSetting("fixedColumnsStart")&&e.getFirstRenderedColumn()>0}function iU(e,t){let r,n,o,i,s,{deferShrinkDetection:a=!1,recordedRows:l}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e.wtSettings.getSetting("externalRowCalculator"))return!1;let h=e.TBODY.childNodes.length,d=e.wtSettings.getSetting("stylesHandler"),u=h*d.getDefaultRowHeight(),c=e.deps.geometryReader.innerHeight(e.TBODY)-1,g=d.areCellsBorderBox(),p=g?t=>e.deps.geometryReader.outerHeight(t):t=>e.deps.geometryReader.innerHeight(t),m=+!g,f=+!!g;if(u===c&&!e.wtSettings.getSetting("fixedRowsBottom"))return!a&&void 0!==t&&t.size>0&&(e.deps.getWtViewport().invalidateRowHeightCache(),!0);let b=e.deps.getWtViewport(),C=!1;for(;h;){h-=1,o=e.rowFilter.renderedToSource(h),r=e.getRowHeight(o),s=(i=e.getTrForRow(o)).querySelector("th");let a=0===h?f:0;if(n=s?p(s):p(i)-m,!r&&d.getDefaultRowHeight()<n-a||void 0!==r&&r<n){g||(n+=1),b.oversizedRows[o]=n,l?.add(o);let e=t?.get(o);(void 0===e||Math.abs(n-e)>1)&&(C=!0),t?.delete(o)}}return!a&&void 0!==t&&t.size>0&&(C=!0),C&&b.invalidateRowHeightCache(),C}function iz(e,t){let r=Math.max(e.getFirstRenderedRow(),0),n=Math.max(e.getFirstRenderedColumn(),0),o=new iP(r,e.wtSettings.getSetting("totalRows"),t.columnHeadersCount),i=new iL(n,e.wtSettings.getSetting("totalColumns"),t.rowHeadersCount);return e.rowFilter=o,e.columnFilter=i,{rowFilter:o,columnFilter:i}}function iW(e){return!!e&&e.isScrollDrivenDraw&&e.verticalScrolling&&!e.horizontalScrolling}function iG(e,t,r,n){e.tableRenderer.setHeaderContentRenderers(t.rowHeaders,t.columnHeaders),(e.is("bottom")||e.is(ih))&&e.tableRenderer.setHeaderContentRenderers(t.rowHeaders,[]),e.tableRenderer.setColumnHeadersRenderSkippable(n);let o=function(e){let{wtSettings:t}=e,r=e.deps.getWtViewport();if(!e.isMaster&&!e.is("bottom")||t.getSetting("externalRowCalculator"))return;let n=e.getRenderedRowsCount(),o=new Map;for(let t=0;t<n;t++){let n=e.rowFilter.renderedToSource(t),i=r.oversizedRows?.[n];i&&!r.frozenOversizedRows.has(n)&&(o.set(n,i),delete r.oversizedRows[n])}return o}(e);e.tableRenderer.setActiveOverlayName(e.name).setViewportSize(e.getRenderedRowsCount(),e.getRenderedColumnsCount()).setFilters(r.rowFilter,r.columnFilter).render(),e.deps.getWtViewport().renderCycleSeq+=1,iD(e),(e.isMaster||e.is("bottom"))&&iU(e,o)}function i$(e,t){e.deps.getSelectionManager().setActiveOverlay(e.facadeGetter()).render(t)}function iY(e,t){let r=e.deps.getWtOverlays();t.positionChanged=r.topOverlay.resetFixedPosition(),r.bottomOverlay.clone&&(t.positionChanged=r.bottomOverlay.resetFixedPosition()||t.positionChanged),t.positionChanged=r.inlineStartOverlay.resetFixedPosition()||t.positionChanged,r.topInlineStartCornerOverlay&&r.topInlineStartCornerOverlay.resetFixedPosition(),r.bottomInlineStartCornerOverlay&&r.bottomInlineStartCornerOverlay.clone&&r.bottomInlineStartCornerOverlay.resetFixedPosition()}function ij(e){return{wot:e.wot,facadeGetter:e.getFacade(),wtSettings:e.wtSettings,rootDocument:e.rootDocument,rootTable:e.rootTable,geometryReader:e.geometryReader,rowSizeSource:e.rowSizeSource,columnSizeSource:e.columnSizeSource,getWtTable:e.getWtTable,getWtViewport:e.getWtViewport,getWtOverlays:e.getWtOverlays,getSelectionManager:e.getSelectionManager,getCloneSource:e.getCloneSource,getParentTableOffset:e.getParentTableOffset,getColumnHeaders:e.getColumnHeaders,getRowHeaders:e.getRowHeaders,isDrawn:e.isDrawn,setDrawn:e.setDrawn}}class iq{TBODY=null;THEAD=null;COLGROUP=null;hasTableHeight=!0;hasTableWidth=!0;isTableVisible=!1;tableOffset=0;holderOffset=0;#m;get deps(){return this.#m}alignOverlaysWithTrimmingContainer(){}constructor(e,t){this.isMaster="master"===t,this.name=t,this.#m=e,this.facadeGetter=e.facadeGetter,this.wtSettings=e.wtSettings,this.wot=this.#m.wot,this.TABLE=e.rootTable,rp(this.TABLE),this.spreader=this.createSpreader(this.TABLE),this.hider=this.createHider(this.spreader),this.holder=this.createHolder(this.hider),this.wtRootElement=this.holder.parentNode,this.isMaster&&this.alignOverlaysWithTrimmingContainer(),this.fixTableDomTree(),this.rowFilter=null,this.columnFilter=null,this.correctHeaderWidth=!1;const r=this.wtSettings.getSettingPure("rowHeaderWidth");this.wtSettings.update("rowHeaderWidth",()=>this._modifyRowHeaderWidth(r)),this.rowUtils=new i_(this.#m),this.columnUtils=new iH(this.#m),this.tableRenderer=new ik({TABLE:this.TABLE,THEAD:this.THEAD??void 0,COLGROUP:this.COLGROUP??void 0,TBODY:this.TBODY??void 0,rowUtils:this.rowUtils,columnUtils:this.columnUtils,cellRenderer:this.wtSettings.getSettingPure("cellRenderer"),stylesHandler:this.wtSettings.getSetting("stylesHandler")})}is(e){return this.name===e}draw(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return!function(e,t){let{wtSettings:r}=e,n=r.getSetting("rowHeaders"),o=r.getSetting("columnHeaders"),i={runFastDraw:t,performRedraw:!0,positionChanged:!1,syncFrozenRows:!1,rowHeaders:n,columnHeaders:o,rowHeadersCount:n.length,columnHeadersCount:o.length};e.isMaster?function(e,t){var r,n;let{wtSettings:o}=e,i=e.deps.getWtOverlays(),s=e.deps.getWtViewport(),a=(r=e,{rowsRenderCalculator:(n=s).rowsRenderCalculator,columnsRenderCalculator:n.columnsRenderCalculator,rowFilter:r.rowFilter,columnFilter:r.columnFilter,correctHeaderWidth:r.correctHeaderWidth});if(i.isScrollDrivenDraw=t.runFastDraw,i.beforeDraw(),e.holderOffset=e.deps.geometryReader.offset(e.holder),s.rowHeightCache.ensureBuilt(),s.columnWidthCache.ensureBuilt(),s.usesLayoutSnapshotForCalculators()&&i.prepareHeaderBorders(),s.beginDrawLayout(),t.runFastDraw=s.createCalculators(t.runFastDraw,{stationaryBands:i.isScrollDrivenDraw&&s.allowsStationaryBands()}),t.rowHeadersCount&&!o.getSetting("fixedColumnsStart")){let r=i.inlineStartOverlay.getScrollPosition(),n=e.correctHeaderWidth;e.correctHeaderWidth=0!==r,n!==e.correctHeaderWidth&&(t.runFastDraw=!1)}if(t.runFastDraw)i.refresh(!0),iF(e);else{e.tableOffset=e.deps.geometryReader.offset(e.TABLE);let r=iz(e,t);t.syncFrozenRows=iV(e),t.syncFrozenRows||s.releaseFrozenOversizedRows(),e.alignOverlaysWithTrimmingContainer();let n={},l=s.renderCycleSeq;if(o.getSetting("beforeDraw",!0,n),t.performRedraw=!0!==n.skipRender,t.performRedraw){if(iG(e,t,r,iW(i)),!o.getSetting("externalRowCalculator")){let e=s.usesLayoutSnapshotForCalculators()&&s.rowHeightCache.isCurrent()&&s.columnWidthCache.isCurrent();s.rowHeightCache.ensureBuilt(),s.columnWidthCache.ensureBuilt(),e||s.createVisibleCalculators()}let n=t.syncFrozenRows?function(e){let t=e.deps.getWtViewport(),{frozenOversizedRows:r}=t;if(0===r.size)return;t.frozenClearRowCacheBuildSeq=t.rowHeightCache.buildSeq;let{wtSettings:n}=e,o=new Map,i=e=>{if(!r.has(e))return;let n=t.oversizedRows[e];void 0!==n&&o.set(e,n),delete t.oversizedRows[e],r.delete(e)},s=e.getRenderedRowsCount();for(let t=0;t<s;t++)i(e.rowFilter.renderedToSource(t));let a=n.getSetting("totalRows"),l=n.getSetting("fixedRowsTop"),h=n.getSetting("fixedRowsBottom");for(let e=0;e<l;e++)i(e);for(let e=Math.max(0,a-h);e<a;e++)i(e);return o}(e):void 0;i.refresh(!1),iF(e),function(e,t){let r=e.deps.getWtOverlays(),n=iV(e),o=n?[r.inlineStartOverlay,r.topInlineStartCornerOverlay,r.bottomInlineStartCornerOverlay].filter(e=>e?.needFullRender).map(e=>e?.clone?.wtTable).filter(e=>!!e?.TBODY):[],i=()=>void 0!==t&&t.size>0&&(e.deps.getWtViewport().invalidateRowHeightCache(),!0),s=()=>{let r=e.deps.getWtViewport();return void 0!==t&&r.rowHeightCache.buildSeq!==r.frozenClearRowCacheBuildSeq&&(r.invalidateRowHeightCache(),!0)};if(!n||0===o.length){let e=i();return(!!s()||!!e)&&(r.adjustElementsSize(),!0)}let a=new Set,l=!1;o.forEach(e=>{l=iU(e,t,{deferShrinkDetection:!0,recordedRows:a})||l});let{frozenOversizedRows:h}=e.deps.getWtViewport();a.forEach(e=>h.add(e)),l=i()||l;let d=s(),u=[r.topOverlay?.clone?.wtTable,r.bottomOverlay?.clone?.wtTable,...o];if(l){iB(e);let t=new Set;iU(e,void 0,{recordedRows:t}),t.forEach(e=>h.delete(e)),t.size>0&&u.push(e)}return(a.size>0||l)&&(u.includes(e)||u.push(e),u.forEach(e=>{e&&iB(e)})),(!!l||!!d)&&(r.adjustElementsSize(),!0)}(e,n)&&!o.getSetting("externalRowCalculator")&&(s.rowHeightCache.ensureBuilt(),s.columnWidthCache.ensureBuilt(),s.createVisibleCalculators()),i.applyToDOM(),o.getSetting("onDraw",!0)}else!function(e,t,r,n){let{wtSettings:o}=e;t.renderCycleSeq===n&&(e.correctHeaderWidth=r.correctHeaderWidth,(null===r.rowFilter||r.rowFilter.total===o.getSetting("totalRows"))&&(t.rowsRenderCalculator=r.rowsRenderCalculator,null!==r.rowFilter&&(e.rowFilter=r.rowFilter)),(null===r.columnFilter||r.columnFilter.total===o.getSetting("totalColumns"))&&(t.columnsRenderCalculator=r.columnsRenderCalculator,null!==r.columnFilter&&(e.columnFilter=r.columnFilter)))}(e,s,a,l)}iY(e,t),t.positionChanged?(t.performRedraw?i.refreshAll():(iY(e,t),i$(e,t.runFastDraw)),i.adjustElementsSize()):i$(e,t.runFastDraw),i.afterDraw(!t.runFastDraw&&t.performRedraw),e.deps.setDrawn(!0)}(e,i):function(e,t){if(!t.runFastDraw){e.tableOffset=e.deps.getParentTableOffset();let r=iz(e,t),n=e.deps.getCloneSource().wtOverlays;iG(e,t,r,iW(n)),e.is("bottom")&&e.deps.getCloneSource().wtOverlays.adjustElementsSize()}i$(e,t.runFastDraw),e.deps.setDrawn(!0)}(e,i)}(this,e),this}_modifyRowHeaderWidth(e){let t="function"==typeof e?e():e;return Array.isArray(t)?(t=[...t])[t.length-1]=this._correctRowHeaderWidth(t[t.length-1]):t=this._correctRowHeaderWidth(t),t}_correctRowHeaderWidth(e){let t="number"==typeof e?e:this.wtSettings.getSetting("defaultColumnWidth");return this.correctHeaderWidth&&(t+=1),t}destroy(){}}th(iq,ic),th(iq,ig),th(iq,{getRowHeight(e){return this.rowUtils.getHeight(e)},getColumnHeaderHeight(e){return this.columnUtils.getHeaderHeight(e)},getColumnWidth(e){return this.columnUtils.getWidth(e)},hasDefinedSize(){return this.hasTableHeight&&this.hasTableWidth},getWidth(){return this.deps.geometryReader.outerWidth(this.TABLE)},getHeight(){return this.deps.geometryReader.outerHeight(this.TABLE)},getTotalWidth(){let e=this.deps.geometryReader.outerWidth(this.hider);return 0!==e?e:this.getWidth()},getTotalHeight(){let e=this.deps.geometryReader.outerHeight(this.hider);return 0!==e?e:this.getHeight()},isVisible(){return rv(this.TABLE)}}),th(iq,{isColumnHeaderRendered(e){return!(e>=0)&&Math.abs(e)<=this.wtSettings.getSetting("rowHeaders").length},isRowHeaderRendered(e){return!(e>=0)&&Math.abs(e)<=this.wtSettings.getSetting("columnHeaders").length},isRowBeforeRenderedRows(e){let t=this.getFirstRenderedRow();return e<0&&t<=0?!this.isRowHeaderRendered(e):e<t},isRowAfterRenderedRows(e){return e>this.getLastRenderedRow()},isColumnBeforeRenderedColumns(e){let t=this.getFirstRenderedColumn();return e<0&&t<=0?!this.isColumnHeaderRendered(e):e<t},isColumnAfterRenderedColumns(e){return this.columnFilter&&e>this.getLastRenderedColumn()},isColumnAfterViewport(e){return this.columnFilter&&e>this.getLastVisibleColumn()},isRowAfterViewport(e){return this.rowFilter&&e>this.getLastVisibleRow()},isColumnBeforeViewport(e){return this.columnFilter&&0>this.columnFilter.sourceToRendered(e)&&e>=0},isLastRowFullyVisible(){return this.getLastVisibleRow()===this.getLastRenderedRow()},isLastColumnFullyVisible(){return this.getLastVisibleColumn()===this.getLastRenderedColumn()},allRowsInViewport(){return this.wtSettings.getSetting("totalRows")===this.getVisibleRowsCount()},allColumnsInViewport(){return this.wtSettings.getSetting("totalColumns")===this.getVisibleColumnsCount()}});let iK=iq,iX={getFirstRenderedRow(){return 0===this.getRenderedRowsCount()?-1:0},getFirstVisibleRow(){return this.getFirstRenderedRow()},getFirstPartiallyVisibleRow(){return this.getFirstRenderedRow()},getLastRenderedRow(){return this.getRenderedRowsCount()-1},getLastVisibleRow(){return this.getLastRenderedRow()},getLastPartiallyVisibleRow(){return this.getLastRenderedRow()},getRenderedRowsCount(){return Math.min(this.wtSettings.getSetting("totalRows")??0,this.wtSettings.getSetting("fixedRowsTop"))},getVisibleRowsCount(){return this.getRenderedRowsCount()},getColumnHeadersCount(){return this.deps.getColumnHeaders().length}};tg(iX,"MIXIN_NAME","stickyRowsTop",{writable:!1,enumerable:!1});let iQ={getFirstRenderedRow(){return this.deps.getWtViewport().rowsRenderCalculator?.startRow??-1},getFirstVisibleRow(){return this.deps.getWtViewport().rowsVisibleCalculator?.startRow??-1},getFirstPartiallyVisibleRow(){return this.deps.getWtViewport().rowsPartiallyVisibleCalculator?.startRow??-1},getLastRenderedRow(){return this.deps.getWtViewport().rowsRenderCalculator?.endRow??-1},getLastVisibleRow(){return this.deps.getWtViewport().rowsVisibleCalculator?.endRow??-1},getLastPartiallyVisibleRow(){return this.deps.getWtViewport().rowsPartiallyVisibleCalculator?.endRow??-1},getRenderedRowsCount(){return this.deps.getWtViewport().rowsRenderCalculator?.count??0},getVisibleRowsCount(){return this.deps.getWtViewport().rowsVisibleCalculator?.count??0},getColumnHeadersCount(){return this.deps.getColumnHeaders().length}};tg(iQ,"MIXIN_NAME","calculatedRows",{writable:!1,enumerable:!1});let iZ={getFirstRenderedColumn(){return this.deps.getWtViewport().columnsRenderCalculator?.startColumn??-1},getFirstVisibleColumn(){return this.deps.getWtViewport().columnsVisibleCalculator?.startColumn??-1},getFirstPartiallyVisibleColumn(){return this.deps.getWtViewport().columnsPartiallyVisibleCalculator?.startColumn??-1},getLastRenderedColumn(){return this.deps.getWtViewport().columnsRenderCalculator?.endColumn??-1},getLastVisibleColumn(){return this.deps.getWtViewport().columnsVisibleCalculator?.endColumn??-1},getLastPartiallyVisibleColumn(){return this.deps.getWtViewport().columnsPartiallyVisibleCalculator?.endColumn??-1},getRenderedColumnsCount(){return this.deps.getWtViewport().columnsRenderCalculator?.count??0},getVisibleColumnsCount(){return this.deps.getWtViewport().columnsVisibleCalculator?.count??0},getRowHeadersCount(){return this.deps.getRowHeaders().length}};tg(iZ,"MIXIN_NAME","calculatedColumns",{writable:!1,enumerable:!1});class iJ extends iK{constructor(e){super(e,"top")}}th(iJ,iX),th(iJ,iZ);let i0=class{#m;constructor(e){this.#m=e}scrollViewport(e,t,r){if(e.col<0||e.row<0)return!1;let n=this.scrollViewportHorizontally(e.col,t),o=this.scrollViewportVertically(e.row,r);return n||o}scrollViewportHorizontally(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"auto",{wtSettings:r}=this.#m;if(!this.#m.isDrawn())return!1;let n=r.getSetting("totalColumns"),o=tC(t);if(!Number.isInteger(e=r.getSetting("onBeforeViewportScrollHorizontally",e,o))||e<0||e>n)return!1;t=o.value;let i=r.getSetting("fixedColumnsStart"),s=this.#m.getInlineStartOverlay(),a="auto"===t;if(a&&e<i)return!1;let l=this.getFirstVisibleColumn(),h=this.getLastVisibleColumn(),d=!1;return(a&&(e<l||e>h)||!a)&&(d=s.scrollTo(e,a?e>=this.getLastPartiallyVisibleColumn():"end"===t)),d}scrollViewportVertically(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"auto",{wtSettings:r}=this.#m;if(!this.#m.isDrawn())return!1;let n=r.getSetting("totalRows"),o=tC(t);if(!Number.isInteger(e=r.getSetting("onBeforeViewportScrollVertically",e,o))||e<0||e>n)return!1;t=o.value;let i=r.getSetting("fixedRowsBottom"),s=r.getSetting("fixedRowsTop"),a=this.#m.getTopOverlay(),l="auto"===t;if(l&&(e<s||e>n-i-1))return!1;let h=this.getFirstVisibleRow(),d=this.getLastVisibleRow(),u=!1;return(l&&(e<h||e>d)||!l)&&(u=a.scrollTo(e,l?e>=this.getLastPartiallyVisibleRow():"bottom"===t)),u}getFirstVisibleRow(){return this.#m.getWtTable().getFirstVisibleRow()}getLastVisibleRow(){return this.#q(this.#m.getWtTable().getLastVisibleRow())}getFirstPartiallyVisibleRow(){return this.#m.getWtTable().getFirstPartiallyVisibleRow()}getLastPartiallyVisibleRow(){return this.#q(this.#m.getWtTable().getLastPartiallyVisibleRow())}getFirstVisibleColumn(){return this.#m.getWtTable().getFirstVisibleColumn()}getLastVisibleColumn(){return this.#K(this.#m.getWtTable().getLastVisibleColumn())}getFirstPartiallyVisibleColumn(){return this.#m.getWtTable().getFirstPartiallyVisibleColumn()}getLastPartiallyVisibleColumn(){return this.#K(this.#m.getWtTable().getLastPartiallyVisibleColumn())}#K(e){let{wtSettings:t,rootWindow:r,geometryReader:n}=this.#m,o=this.#m.getInlineStartOverlay(),i=this.#m.getWtTable(),s=this.#m.getWtViewport(),a=t.getSetting("totalColumns");if(o.mainTableScrollableElement===r){let l=t.getSetting("rtlMode"),h=null;if(l){let e=n.getBoundingClientRect(i.TABLE),t=r.document,o=n.offsetWidth(t.documentElement);h=Math.abs(e.right-o)}else h=n.offset(i.wtRootElement).left;let d=Math.abs(rI(r,r));if(h>d){let t=n.innerWidth(r),i=s.getRowHeaderWidth();for(let r=1;r<=a;r++)if(h+(i+=o.sumCellSizes(r-1,r))-d>=t){e=r-2;break}}}return e}#q(e){let{wtSettings:t,rootWindow:r,geometryReader:n}=this.#m,o=this.#m.getTopOverlay(),i=this.#m.getWtTable(),s=this.#m.getWtViewport(),a=t.getSetting("totalRows");if(o.mainTableScrollableElement===r){let t=n.offset(i.wtRootElement),l=rM(r,r);if(t.top>l){let i=n.innerHeight(r),h=s.getColumnHeaderHeight();for(let r=1;r<=a;r++)if(h+=o.sumCellSizes(r-1,r),t.top+h-l>=i){e=r-2;break}}}return e}};class i1{row=null;col=null;#X=!1;constructor(e,t,r=!1){this.#X=r,void 0!==e&&(this.row=e),void 0!==t&&(this.col=t)}isValid(e){let{countRows:t,countCols:r,countRowHeaders:n,countColHeaders:o}={countRows:0,countCols:0,countRowHeaders:0,countColHeaders:0,...e};if(!Number.isInteger(this.row)||!Number.isInteger(this.col))return!1;let i=this.row,s=this.col;return!(i<-o)&&!(s<-n)&&!(i>=t)&&!(s>=r)}isSet(){return null!==this.row&&null!==this.col}isEqual(e){return e===this||this.row===e.row&&this.col===e.col}isHeader(){return!this.isCell()}isCell(){return null!==this.row&&null!==this.col&&this.row>=0&&this.col>=0}isRtl(){return this.#X}isSouthEastOf(e){if(null===this.row||null===this.col||null===e.row||null===e.col)return!1;let t=this.row,r=this.col,n=e.row,o=e.col;return t>=n&&(this.#X?r<=o:r>=o)}isNorthWestOf(e){if(null===this.row||null===this.col||null===e.row||null===e.col)return!1;let t=this.row,r=this.col,n=e.row,o=e.col;return t<=n&&(this.#X?r>=o:r<=o)}isSouthWestOf(e){if(null===this.row||null===this.col||null===e.row||null===e.col)return!1;let t=this.row,r=this.col,n=e.row,o=e.col;return t>=n&&(this.#X?r>=o:r<=o)}isNorthEastOf(e){if(null===this.row||null===this.col||null===e.row||null===e.col)return!1;let t=this.row,r=this.col,n=e.row,o=e.col;return t<=n&&(this.#X?r<=o:r>=o)}normalize(){return this.row=null===this.row?this.row:Math.max(this.row,0),this.col=null===this.col?this.col:Math.max(this.col,0),this}assign(e){return Number.isInteger(e?.row)&&(this.row=e.row),Number.isInteger(e?.col)&&(this.col=e.col),e instanceof i1&&(this.#X=e.isRtl()),this}clone(){return new i1(this.row??void 0,this.col??void 0,this.#X)}toObject(){return{row:this.row,col:this.col}}}class i2{#X=!1;constructor(e,t=e,r=e,n=!1){this.highlight=e.clone(),this.from=t.clone(),this.to=r.clone(),this.#X=n}setHighlight(e){return this.highlight=e.clone(),this}setFrom(e){return this.from=e.clone(),this}setTo(e){return this.to=e.clone(),this}normalize(){return this.highlight.normalize(),this.from.normalize(),this.to.normalize(),this}isValid(e){return this.from.isValid(e)&&this.to.isValid(e)}isSingle(){return this.isSingleCell()||this.isSingleHeader()}isSingleCell(){return null!==this.from.row&&null!==this.from.col&&null!==this.to.row&&null!==this.to.col&&this.#Q(this.from.row)>=0&&this.from.row===this.to.row&&this.#Q(this.from.col)>=0&&this.from.col===this.to.col}isSingleHeader(){return null!==this.from.row&&null!==this.from.col&&null!==this.to.row&&null!==this.to.col&&(0>this.#Q(this.from.row)||0>this.#Q(this.from.col))&&this.from.row===this.to.row&&this.from.col===this.to.col}isHeader(){return!!(this.from.isHeader()&&this.to.isHeader())||0>this.#Q(this.from.col)&&0>this.#Q(this.to.col)||0>this.#Q(this.from.row)&&0>this.#Q(this.to.row)}containsHeaders(){return this.from.isHeader()||this.to.isHeader()}getOuterHeight(){return Math.max(this.#Q(this.from.row),this.#Q(this.to.row))-Math.min(this.#Q(this.from.row),this.#Q(this.to.row))+1}getOuterWidth(){return Math.max(this.#Q(this.from.col),this.#Q(this.to.col))-Math.min(this.#Q(this.from.col),this.#Q(this.to.col))+1}getHeight(){if(0>this.#Q(this.from.row)&&0>this.#Q(this.to.row))return 0;let e=Math.max(this.#Q(this.from.row),0),t=Math.max(this.#Q(this.to.row),0);return Math.max(e,t)-Math.min(e,t)+1}getWidth(){if(0>this.#Q(this.from.col)&&0>this.#Q(this.to.col))return 0;let e=Math.max(this.#Q(this.from.col),0),t=Math.max(this.#Q(this.to.col),0);return Math.max(e,t)-Math.min(e,t)+1}getCellsCount(){return this.getWidth()*this.getHeight()}includes(e){if(null===this.from.row||null===this.from.col||null===this.to.row||null===this.to.col||null===e.row||null===e.col)return!1;let t=this.#Q(e.row),r=this.#Q(e.col),n=this.getOuterTopStartCorner(),o=this.getOuterBottomEndCorner();return this.#Q(n.row)<=t&&this.#Q(o.row)>=t&&this.#Q(n.col)<=r&&this.#Q(o.col)>=r}includesRange(e){return this.includes(e.getOuterTopStartCorner())&&this.includes(e.getOuterBottomEndCorner())}isEqual(e){if(null===this.from.row||null===this.from.col||null===this.to.row||null===this.to.col||null===e.from.row||null===e.from.col||null===e.to.row||null===e.to.col)return!1;let t=Math.min(this.#Q(this.from.row),this.#Q(this.to.row)),r=Math.max(this.#Q(this.from.row),this.#Q(this.to.row)),n=Math.min(this.#Q(this.from.col),this.#Q(this.to.col)),o=Math.max(this.#Q(this.from.col),this.#Q(this.to.col)),i=Math.min(this.#Q(e.from.row),this.#Q(e.to.row)),s=Math.max(this.#Q(e.from.row),this.#Q(e.to.row)),a=Math.min(this.#Q(e.from.col),this.#Q(e.to.col)),l=Math.max(this.#Q(e.from.col),this.#Q(e.to.col));return t===i&&r===s&&n===a&&o===l}overlaps(e){return e.isSouthEastOf(this.getOuterTopLeftCorner())&&e.isNorthWestOf(this.getOuterBottomRightCorner())}isSouthEastOf(e){return this.getOuterTopLeftCorner().isSouthEastOf(e)||this.getOuterBottomRightCorner().isSouthEastOf(e)}isNorthWestOf(e){return this.getOuterTopLeftCorner().isNorthWestOf(e)||this.getOuterBottomRightCorner().isNorthWestOf(e)}isOverlappingHorizontally(e){return this.#Q(this.getOuterTopEndCorner().col)>=this.#Q(e.getOuterTopStartCorner().col)&&this.#Q(this.getOuterTopEndCorner().col)<=this.#Q(e.getOuterTopEndCorner().col)||this.#Q(this.getOuterTopStartCorner().col)<=this.#Q(e.getOuterTopEndCorner().col)&&this.#Q(this.getOuterTopStartCorner().col)>=this.#Q(e.getOuterTopStartCorner().col)}isOverlappingVertically(e){return this.#Q(this.getOuterBottomStartCorner().row)>=this.#Q(e.getOuterTopRightCorner().row)&&this.#Q(this.getOuterBottomStartCorner().row)<=this.#Q(e.getOuterBottomStartCorner().row)||this.#Q(this.getOuterTopEndCorner().row)<=this.#Q(e.getOuterBottomStartCorner().row)&&this.#Q(this.getOuterTopEndCorner().row)>=this.#Q(e.getOuterTopRightCorner().row)}expand(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],r=this.getOuterTopStartCorner(),n=this.getOuterBottomEndCorner();if(this.#Q(e.row)<this.#Q(r.row)||this.#Q(e.col)<this.#Q(r.col)||this.#Q(e.row)>this.#Q(n.row)||this.#Q(e.col)>this.#Q(n.col)){let o=this.getVerticalDirection(),i=this.getHorizontalDirection();return this.from=this._createCellCoords(Math.min(this.#Q(r.row),this.#Q(e.row)),Math.min(this.#Q(r.col),this.#Q(e.col))),this.to=this._createCellCoords(Math.max(this.#Q(n.row),this.#Q(e.row)),Math.max(this.#Q(n.col),this.#Q(e.col))),t&&(this.#Q(e.row)<this.#Q(r.row)&&"N-S"===o?this.flipDirectionVertically():this.#Q(e.row)>this.#Q(n.row)&&"S-N"===o&&this.flipDirectionVertically(),this.#Q(e.col)<this.#Q(r.col)&&"W-E"===i?this.flipDirectionHorizontally():this.#Q(e.col)>this.#Q(n.col)&&"E-W"===i&&this.flipDirectionHorizontally()),!0}return!1}expandByRange(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(this.includesRange(e)||!this.overlaps(e))return!1;let r=this.getOuterTopStartCorner(),n=this.getOuterBottomEndCorner(),o=this.getDirection(),i=e.getOuterTopStartCorner(),s=e.getOuterBottomEndCorner(),a=Math.min(this.#Q(r.row),this.#Q(i.row)),l=Math.min(this.#Q(r.col),this.#Q(i.col)),h=Math.max(this.#Q(n.row),this.#Q(s.row)),d=Math.max(this.#Q(n.col),this.#Q(s.col)),u=this._createCellCoords(a,l),c=this._createCellCoords(h,d);return this.from=u,this.to=c,this.setDirection(o),t&&(this.highlight.row===this.getOuterBottomRightCorner().row&&"N-S"===this.getVerticalDirection()&&this.flipDirectionVertically(),this.highlight.col===this.getOuterTopRightCorner().col&&"W-E"===this.getHorizontalDirection()&&this.flipDirectionHorizontally()),!0}getDirection(){if(this.from.isNorthWestOf(this.to));else if(this.from.isNorthEastOf(this.to))return"NE-SW";else if(this.from.isSouthEastOf(this.to))return"SE-NW";else if(this.from.isSouthWestOf(this.to))return"SW-NE";return"NW-SE"}setDirection(e){switch(e){case"NW-SE":[this.from,this.to]=[this.getOuterTopLeftCorner(),this.getOuterBottomRightCorner()];break;case"NE-SW":[this.from,this.to]=[this.getOuterTopRightCorner(),this.getOuterBottomLeftCorner()];break;case"SE-NW":[this.from,this.to]=[this.getOuterBottomRightCorner(),this.getOuterTopLeftCorner()];break;case"SW-NE":[this.from,this.to]=[this.getOuterBottomLeftCorner(),this.getOuterTopRightCorner()]}}getVerticalDirection(){return["NE-SW","NW-SE"].indexOf(this.getDirection())>-1?"N-S":"S-N"}getHorizontalDirection(){return["NW-SE","SW-NE"].indexOf(this.getDirection())>-1?"W-E":"E-W"}getInlineDirection(){return this.getHorizontalDirection()===(this.#X?"E-W":"W-E")?"start-end":"end-start"}flipDirectionVertically(){switch(this.getDirection()){case"NW-SE":this.setDirection("SW-NE");break;case"NE-SW":this.setDirection("SE-NW");break;case"SE-NW":this.setDirection("NE-SW");break;case"SW-NE":this.setDirection("NW-SE")}}flipDirectionHorizontally(){switch(this.getDirection()){case"NW-SE":this.setDirection("NE-SW");break;case"NE-SW":this.setDirection("NW-SE");break;case"SE-NW":this.setDirection("SW-NE");break;case"SW-NE":this.setDirection("SE-NW")}}getTopStartCorner(){return this._createCellCoords(Math.min(this.#Q(this.from.row),this.#Q(this.to.row)),Math.min(this.#Q(this.from.col),this.#Q(this.to.col))).normalize()}getTopLeftCorner(){return this.#X?this.getTopEndCorner():this.getTopStartCorner()}getBottomEndCorner(){return this._createCellCoords(Math.max(this.#Q(this.from.row),this.#Q(this.to.row)),Math.max(this.#Q(this.from.col),this.#Q(this.to.col))).normalize()}getBottomRightCorner(){return this.#X?this.getBottomStartCorner():this.getBottomEndCorner()}getTopEndCorner(){return this._createCellCoords(Math.min(this.#Q(this.from.row),this.#Q(this.to.row)),Math.max(this.#Q(this.from.col),this.#Q(this.to.col))).normalize()}getTopRightCorner(){return this.#X?this.getTopStartCorner():this.getTopEndCorner()}getBottomStartCorner(){return this._createCellCoords(Math.max(this.#Q(this.from.row),this.#Q(this.to.row)),Math.min(this.#Q(this.from.col),this.#Q(this.to.col))).normalize()}getBottomLeftCorner(){return this.#X?this.getBottomEndCorner():this.getBottomStartCorner()}getOuterTopStartCorner(){return this._createCellCoords(Math.min(this.#Q(this.from.row),this.#Q(this.to.row)),Math.min(this.#Q(this.from.col),this.#Q(this.to.col)))}getOuterTopLeftCorner(){return this.#X?this.getOuterTopEndCorner():this.getOuterTopStartCorner()}getOuterBottomEndCorner(){return this._createCellCoords(Math.max(this.#Q(this.from.row),this.#Q(this.to.row)),Math.max(this.#Q(this.from.col),this.#Q(this.to.col)))}getOuterBottomRightCorner(){return this.#X?this.getOuterBottomStartCorner():this.getOuterBottomEndCorner()}getOuterTopEndCorner(){return this._createCellCoords(Math.min(this.#Q(this.from.row),this.#Q(this.to.row)),Math.max(this.#Q(this.from.col),this.#Q(this.to.col)))}getOuterTopRightCorner(){return this.#X?this.getOuterTopStartCorner():this.getOuterTopEndCorner()}getOuterBottomStartCorner(){return this._createCellCoords(Math.max(this.#Q(this.from.row),this.#Q(this.to.row)),Math.min(this.#Q(this.from.col),this.#Q(this.to.col)))}getOuterBottomLeftCorner(){return this.#X?this.getOuterBottomEndCorner():this.getOuterBottomStartCorner()}isCorner(e){return e.isEqual(this.getOuterTopLeftCorner())||e.isEqual(this.getOuterTopRightCorner())||e.isEqual(this.getOuterBottomLeftCorner())||e.isEqual(this.getOuterBottomRightCorner())}getOppositeCorner(e){if(e instanceof i1){if(e.isEqual(this.getOuterBottomEndCorner()))return this.getOuterTopStartCorner();else if(e.isEqual(this.getOuterTopStartCorner()))return this.getOuterBottomEndCorner();else if(e.isEqual(this.getOuterTopEndCorner()))return this.getOuterBottomStartCorner();else if(e.isEqual(this.getOuterBottomStartCorner()))return this.getOuterTopEndCorner()}}getBordersSharedWith(e){if(!this.includesRange(e))return[];let t={top:Math.min(this.#Q(this.from.row),this.#Q(this.to.row)),bottom:Math.max(this.#Q(this.from.row),this.#Q(this.to.row)),left:Math.min(this.#Q(this.from.col),this.#Q(this.to.col)),right:Math.max(this.#Q(this.from.col),this.#Q(this.to.col))},r={top:Math.min(this.#Q(e.from.row),this.#Q(e.to.row)),bottom:Math.max(this.#Q(e.from.row),this.#Q(e.to.row)),left:Math.min(this.#Q(e.from.col),this.#Q(e.to.col)),right:Math.max(this.#Q(e.from.col),this.#Q(e.to.col))},n=[];return t.top===r.top&&n.push("top"),t.right===r.right&&n.push(this.#X?"left":"right"),t.bottom===r.bottom&&n.push("bottom"),t.left===r.left&&n.push(this.#X?"right":"left"),n}getInner(){let e=this.getOuterTopStartCorner(),t=this.getOuterBottomEndCorner(),r=[];if(null===e.row||null===e.col||null===t.row||null===t.col)return r;let n=this.#Q(e.row),o=this.#Q(e.col),i=this.#Q(t.row),s=this.#Q(t.col);for(let e=n;e<=i;e++)for(let t=o;t<=s;t++)(this.from.row!==e||this.from.col!==t)&&(this.to.row!==e||this.to.col!==t)&&r.push(this._createCellCoords(e,t));return r}getAll(){let e=this.getOuterTopStartCorner(),t=this.getOuterBottomEndCorner(),r=[];if(null===e.row||null===e.col||null===t.row||null===t.col)return r;let n=this.#Q(e.row),o=this.#Q(e.col),i=this.#Q(t.row),s=this.#Q(t.col);for(let a=n;a<=i;a++)for(let l=o;l<=s;l++)n===a&&o===l?r.push(e):i===a&&s===l?r.push(t):r.push(this._createCellCoords(a,l));return r}forAll(e){let t=this.getOuterTopStartCorner(),r=this.getOuterBottomEndCorner();if(null===t.row||null===t.col||null===r.row||null===r.col)return;let n=this.#Q(t.row),o=this.#Q(t.col),i=this.#Q(r.row),s=this.#Q(r.col);for(let t=n;t<=i;t++)for(let r=o;r<=s;r++)if(!1===e(t,r))return}clone(){return new i2(this.highlight,this.from,this.to,this.#X)}toObject(){return{from:this.from.toObject(),to:this.to.toObject()}}_createCellCoords(e,t){return new i1(e??void 0,t??void 0,this.#X)}#Q(e){return e??0}}function i3(e){return"function"==typeof e?.getTopStartCorner}class i6{#Z;constructor(e){this.#Z=e}clientWidth(e){return e.clientWidth}clientHeight(e){return e.clientHeight}offsetWidth(e){return e.offsetWidth}offsetHeight(e){return e.offsetHeight}offsetTop(e){return e.offsetTop}offsetLeft(e){return e.offsetLeft}offsetParent(e){return e.offsetParent}isRendered(e){return e.isConnected&&e.getClientRects().length>0}scrollWidth(e){return e.scrollWidth}scrollHeight(e){return e.scrollHeight}getBoundingClientRect(e){return e.getBoundingClientRect()}outerWidth(e){return rF(e)}outerHeight(e){return rB(e)}innerHeight(e){return rV(e)}innerWidth(e){return rU(e)}offset(e){return rE(e)}getScrollbarWidth(e){return rX(e)}getComputedStyle(e){return this.#Z.getComputedStyle(e)}getStyle(e,t){return rP(e,t,this.#Z)}getMaximumScrollTop(e){return rN(e)}getMaximumScrollLeft(e){return rO(e)}}class i5{#J;constructor(e){this.#J=e}getSize(e){return this.#J.getSetting("rowHeight",e)}getSizeForOverlay(e,t){return this.#J.getSetting("rowHeightByOverlayName",e,t)}getDefaultSize(){return this.#J.getSetting("stylesHandler").getDefaultRowHeight()}isUniform(){return this.#J.getSetting("rowHeightsUniform")}}class i4{#J;constructor(e){this.#J=e}getSize(e){return this.#J.getSetting("columnWidth",e)}getDefaultSize(){return this.#J.getSetting("defaultColumnWidth")}isUniform(){return this.#J.getSetting("columnWidthsUniform")}}class i9{guid=`wt_${oh()}`;drawInterrupted=!1;drawn=!1;activeOverlayName="master";get eventManager(){return new n5(this)}get rootDocument(){return this.domBindings.rootDocument}get rootWindow(){return this.domBindings.rootWindow}getSetting(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return this.wtSettings.getSetting(e,...r)}update(e,t){this.wtSettings.update(e,t)}constructor(e,t,r){this.domBindings={rootTable:e,rootDocument:e.ownerDocument,rootWindow:e.ownerDocument.defaultView,geometryReader:r??new i6(e.ownerDocument.defaultView)},this.wtSettings=t,this.engineContext=function(e){return{wot:e,wtSettings:e.wtSettings,rootDocument:e.domBindings.rootDocument,rootWindow:e.domBindings.rootWindow,rootTable:e.domBindings.rootTable,geometryReader:e.domBindings.geometryReader,rowSizeSource:new i5(e.wtSettings),columnSizeSource:new i4(e.wtSettings),makeEventManager:()=>e.eventManager,getFacade:()=>e.wtSettings.getSetting("facade",e),isDrawn:()=>e.drawn,setDrawn:t=>{e.drawn=t},getWtTable:()=>e.wtTable,getWtViewport:()=>e.wtViewport,getWtOverlays:()=>e.wtOverlays,getWtEvent:()=>e.wtEvent,getSelectionManager:()=>e.selectionManager,getCloneSource:()=>e.cloneSource,getParentTableOffset:()=>e.cloneSource.wtTable.tableOffset,getColumnHeaders:()=>e.wtSettings.getSetting("columnHeaders"),getRowHeaders:()=>e.wtSettings.getSetting("rowHeaders"),getTopOverlay:()=>e.wtOverlays.topOverlay,getInlineStartOverlay:()=>e.wtOverlays.inlineStartOverlay,getBottomOverlay:()=>e.wtOverlays.bottomOverlay}}(this),this.wtScroll=new i0(function(e){return{wtSettings:e.wtSettings,rootWindow:e.rootWindow,geometryReader:e.geometryReader,isDrawn:e.isDrawn,getWtTable:e.getWtTable,getWtViewport:e.getWtViewport,getTopOverlay:e.getTopOverlay,getInlineStartOverlay:e.getInlineStartOverlay}}(this.engineContext))}findOriginalHeaders(){let e=[];if(this.wtTable.THEAD&&this.wtTable.THEAD.childNodes.length&&this.wtTable.THEAD.childNodes[0].childNodes.length){for(let t=0,r=this.wtTable.THEAD.childNodes[0].childNodes.length;t<r;t++)e.push(this.wtTable.THEAD.childNodes[0].childNodes[t].innerHTML);this.wtSettings.getSetting("columnHeaders").length||this.wtSettings.update("columnHeaders",[function(t,r){rS(r,e[t])}])}}createCellCoords(e,t){return new i1(e,t,this.wtSettings.getSetting("rtlMode"))}createCellRange(e,t,r){return new i2(e,t,r,this.wtSettings.getSetting("rtlMode"))}draw(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.drawInterrupted=!1,!this.wtTable.isVisible()||rR(this.wtTable.wtRootElement.parentNode)?this.drawInterrupted=!0:this.wtTable.draw(e),this}getCell(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(null===e.row||null===e.col)return;if(!t)return this.wtTable.getCell(e);let r=this.wtSettings.getSetting("totalRows"),n=this.wtSettings.getSetting("fixedRowsTop"),o=this.wtSettings.getSetting("fixedRowsBottom"),i=this.wtSettings.getSetting("fixedColumnsStart");if(e.row<n&&e.col<i)return this.wtOverlays.topInlineStartCornerOverlay.clone?.wtTable.getCell(e);if(e.row<n)return this.wtOverlays.topOverlay.clone?.wtTable.getCell(e);if(e.col<i&&e.row>=r-o)return this.wtOverlays.bottomInlineStartCornerOverlay?.clone?.wtTable.getCell(e);if(e.col<i)return this.wtOverlays.inlineStartOverlay.clone?.wtTable.getCell(e);if(e.row<r&&e.row>=r-o)return this.wtOverlays.bottomOverlay?.clone?.wtTable.getCell(e);return this.wtTable.getCell(e)}scrollViewport(e,t,r){return null!==e.row&&null!==e.col&&this.wtScroll.scrollViewport(e,t,r)}scrollViewportHorizontally(e,t){return this.wtScroll.scrollViewportHorizontally(e,t)}scrollViewportVertically(e,t){return this.wtScroll.scrollViewportVertically(e,t)}getViewport(){return[this.wtTable.getFirstVisibleRow(),this.wtTable.getFirstVisibleColumn(),this.wtTable.getLastVisibleRow(),this.wtTable.getLastVisibleColumn()]}getOverlayByName(e){return null}exportSettingsAsClassNames(){}destroy(){this.wtOverlays.destroy(),this.wtEvent.destroy()}}class i7 extends i9{cloneSource;cloneOverlay;constructor(e,t,r){super(e,t,r.geometryReader),this.cloneSource=r.source,this.cloneOverlay=r.overlay,this.wtTable=this.cloneOverlay.createTable(ij(this.engineContext)),this.wtViewport=r.viewport,this.selectionManager=r.selectionManager,this.wtEvent=new ii(io(this.engineContext),r.event),this.findOriginalHeaders()}}class i8{wtSettings;#m;get deps(){return this.#m}constructor(e,t){tg(this,"wot",e.wot,{writable:!1}),this.#m=e,this.facadeGetter=e.facadeGetter,this.wtSettings=e.wtSettings;const{TABLE:r,hider:n,spreader:o,holder:i,wtRootElement:s}=e.getWtTable();this.type=t,this.TABLE=r,this.hider=n,this.spreader=o,this.holder=i,this.wtRootElement=s,this.trimmingContainer=rL(this.hider.parentNode?.parentNode??this.hider),this.needFullRender=this.shouldBeRendered(),this.clone=this.makeClone()}prepareHeaderBorders(){}hasRenderingStateChanged(){return this.needFullRender!==this.shouldBeRendered()}updateStateOfRendering(e){"before"===e&&this.shouldBeRendered()?this.needFullRender=!0:"after"!==e||this.shouldBeRendered()||(this.needFullRender=!1)}shouldBeRendered(){return!0}updateTrimmingContainer(){this.trimmingContainer=rL(this.hider.parentNode?.parentNode??this.hider)}updateMainScrollableElement(){let e=this.#m.getWtTable(),{rootWindow:t}=this.#m,r=this.#m.geometryReader.getComputedStyle(e.wtRootElement.parentNode).getPropertyValue("overflow"),n=this.wtSettings.getSetting("preventOverflow");"hidden"===r||"clip"===r?this.mainTableScrollableElement=this.#m.getWtTable().holder:"horizontal"===n&&"top"===this.type||"vertical"===n&&this.type===ia?this.mainTableScrollableElement=t:this.mainTableScrollableElement=rx(e.TABLE)}getRelativeCellPosition(e,t,r){if(!this.clone||!1===this.clone.wtTable.holder.contains(e))return void tQ(`The provided element is not a child of the ${this.type} overlay`);let n=this.mainTableScrollableElement===this.#m.rootWindow,o=r<this.wtSettings.getSetting("fixedColumnsStart"),i=t<this.wtSettings.getSetting("fixedRowsTop"),s=t>=this.wtSettings.getSetting("totalRows")-this.wtSettings.getSetting("fixedRowsBottom"),a=this.clone.wtTable.spreader,{geometryReader:l}=this.#m,h={start:this.getRelativeStartPosition(a),top:l.offsetTop(a)},d={start:this.getRelativeStartPosition(e),top:l.offsetTop(e)};return n?this.getRelativeCellPositionWithinWindow(i,o,d,h):this.getRelativeCellPositionWithinHolder(i,s,o,d,h)}getRelativeStartPosition(e){let{geometryReader:t}=this.#m;return this.isRtl()?t.offsetWidth(t.offsetParent(e))-t.offsetLeft(e)-t.offsetWidth(e):t.offsetLeft(e)}getRelativeCellPositionWithinWindow(e,t,r,n){let{geometryReader:o}=this.#m,i=o.getBoundingClientRect(this.#m.getWtTable().wtRootElement),s=this.#m.getWtOverlays().scrollableElement!==this.#m.rootWindow,a={horizontal:s?this.#m.getWtOverlays().inlineStartOverlay.getScrollPosition():0,vertical:s?this.#m.getWtOverlays().topOverlay.getScrollPosition():0},l=0,h=0;if(t){let e=i.left;this.isRtl()&&(e=this.#m.rootWindow.innerWidth-(i.left+i.width+o.getScrollbarWidth())),l=e<=0?-1*e:0}else l=n.start-a.horizontal;return h=e&&this.clone?o.getBoundingClientRect(this.clone.wtTable.TABLE).top-i.top:n.top-a.vertical,{start:r.start+l,top:r.top+h}}getRelativeCellPositionWithinHolder(e,t,r,n,o){let i={horizontal:this.#m.getWtOverlays().inlineStartOverlay.getScrollPosition(),vertical:this.#m.getWtOverlays().topOverlay.getScrollPosition()},s=0,a=0;if(r||(s=i.horizontal-o.start),t&&this.clone){let{geometryReader:e}=this.#m,t=e.getBoundingClientRect(this.#m.getWtTable().wtRootElement);a=-1*e.getBoundingClientRect(this.clone.wtTable.TABLE).top+t.top}else e||(a=i.vertical-o.top);return{start:n.start-s,top:n.top-a}}makeClone(){var e;-1===id.indexOf(this.type)&&tr(`Clone type "${this.type}" is not supported.`);let t=this.#m.getWtTable(),{wtSettings:r}=this,{rootDocument:n,rootWindow:o}=this.#m,i=n.createElement("div"),s=n.createElement("table"),a=t.wtRootElement.parentNode;a||tr("The Walkontable root element has no parent node."),i.className=`${iu.get(this.type)} handsontable`,i.setAttribute("dir",this.isRtl()?"rtl":"ltr"),i.style.position="absolute",i.style.top="0",i.style.overflow="visible",this.isRtl()?i.style.right="0":i.style.left="0",r.getSetting("ariaTags")&&rc(i,[R()]),s.className=t.TABLE.className;let l=t.TABLE.getAttribute("role");l&&s.setAttribute("role",l),i.appendChild(s),a.appendChild(i);let h=this.wtSettings.getSetting("preventOverflow"),d=this.#m.geometryReader.getComputedStyle(a).getPropertyValue("overflow");return"hidden"===d||"clip"===d?this.mainTableScrollableElement=t.holder:"horizontal"===h&&"top"===this.type||"vertical"===h&&this.type===ia?this.mainTableScrollableElement=o:this.mainTableScrollableElement=rx(t.TABLE),new i7(s,this.wtSettings,(e=this.#m,{source:e.wot,overlay:this,viewport:e.getWtViewport(),event:e.getWtEvent(),selectionManager:e.getSelectionManager(),geometryReader:e.geometryReader}))}refresh(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.needFullRender&&this.clone){let t=this.clone.cloneSource;t.activeOverlayName=this.clone.wtTable.name,this.clone.draw(e),t.activeOverlayName="master"}}reset(){if(!this.clone)return;let e=this.clone.wtTable.holder,t=this.clone.wtTable.hider;[e.style,t.style,e.parentNode.style].forEach(e=>{e.width="",e.height=""})}isRtl(){return this.wtSettings.getSetting("rtlMode")}destroy(){this.clone instanceof i7&&this.clone.wtEvent.destroy(),this.clone?.eventManager.destroy()}}let se=e=>{let t=e.wtSettings.getSetting("stylesHandler"),r=t.getCSSVariableValue("cell-autofill-size");return Object.freeze({width:r,height:r,borderWidth:t.getCSSVariableValue("cell-autofill-border-width"),borderStyle:"solid",borderColor:t.getCSSVariableValue("cell-autofill-border-color")})};class st extends i8{cachedFixedRowsTop=-1;constructor(e){super(e,"top"),this.cachedFixedRowsTop=this.wtSettings.getSetting("fixedRowsTop")}createTable(e){return new iJ(e)}shouldBeRendered(){return this.wtSettings.getSetting("shouldRenderTopOverlay")}resetFixedPosition(){if(!this.needFullRender||!this.shouldBeRendered()||!this.deps.getWtTable().holder.parentNode||!this.clone)return!1;let e=this.clone.wtTable.holder.parentNode,{rootWindow:t}=this.deps,r=this.wtSettings.getSetting("preventOverflow"),n=0,o=!1;if(this.trimmingContainer!==t||r&&"vertical"===r)n=this.getScrollPosition(),r1(e);else{let t=this.deps.getWtTable(),{geometryReader:r}=this.deps;o=Math.ceil(r.getBoundingClientRect(t.hider).bottom)===r.offsetHeight(e),n=this.getOverlayOffset(),rJ(e,"0px",`${n}px`)}let i=this.adjustHeaderBordersPosition(n,o);return this.adjustElementsSize(),i}setScrollPosition(e){let{rootWindow:t}=this.deps,r=this.mainTableScrollableElement,n=()=>r===t?t.scrollY:r.scrollTop,o=n(),i=!1;e!==o&&(r===t?t.scrollTo(t.scrollX,e):r.scrollTop=e,i=o!==n());return i}onScroll(){this.wtSettings.getSetting("onScrollHorizontally")}sumCellSizes(e,t){return this.deps.getWtViewport().sumRowHeights(e,t)}adjustElementsSize(){this.updateTrimmingContainer(),this.needFullRender&&(this.adjustRootElementSize(),this.adjustRootChildrenSize())}adjustRootElementSize(){if(!this.clone)return;let e=this.deps.getWtTable(),t=this.deps.getWtViewport(),{rootDocument:r,rootWindow:n}=this.deps,o=this.clone.wtTable.holder.parentNode.style,i=this.wtSettings.getSetting("preventOverflow");if(this.trimmingContainer!==n||"horizontal"===i){let n=t.getWorkspaceWidth();t.hasVerticalScroll()&&(n-=this.deps.geometryReader.getScrollbarWidth(r)),n=Math.min(n,this.deps.geometryReader.scrollWidth(e.wtRootElement)),o.width=`${n}px`}else o.width="";this.clone.wtTable.holder.style.width=o.width;let s=this.deps.geometryReader.outerHeight(this.clone.wtTable.TABLE);e.hasDefinedSize()||(s=0),o.height=`${s}px`}shouldReserveSelectionCornerOffset(e){if(!e||!e.cellRange)return!1;let t=this.wtSettings.getSetting("fixedRowsTop"),r=e.cellRange.getBottomEndCorner().row;if(null===r||r>=t)return!1;if(tW())return!0;let n=e.settings.border,o=n?.cornerVisible;return"function"==typeof o?!!o(e.settings.layerLevel):!!o}adjustRootChildrenSize(){if(!this.clone)return;let{holder:e}=this.clone.wtTable,t=se(this.wot),r=this.deps.getSelectionManager().getFocusSelection(),n=this.shouldReserveSelectionCornerOffset(r)?parseInt(t.height,10)/2:0;this.clone.wtTable.hider.style.width=this.hider.style.width;let o=e.parentNode;e.style.width=o.style.width,e.style.height=`${parseInt(o.style.height,10)+n}px`}applyToDOM(){let e=this.wtSettings.getSetting("totalRows")??0,t=this.deps.getWtViewport().rowsRenderCalculator;"number"==typeof t?.startPosition?this.spreader.style.top=`${t.startPosition}px`:0===e||null===t?this.spreader.style.top="0":tr("Incorrect value of the rowsRenderCalculator"),this.spreader.style.bottom="",this.needFullRender&&this.syncOverlayOffset()}syncOverlayOffset(){if(!this.clone)return;let e=this.isRtl()?"right":"left",{spreader:t}=this.clone.wtTable,r=this.deps.getWtViewport().columnsRenderCalculator;"number"==typeof r?.startPosition?t.style[e]=`${r.startPosition}px`:t.style[e]=""}scrollTo(e,t){let{wot:r,wtSettings:n}=this,{geometryReader:o}=this.deps,i=(r.cloneSource?r.cloneSource:r).wtTable.holder,s=n.getSetting("columnHeaders"),a=+!(0!==n.getSetting("fixedRowsTop")||!(s.length>0)||rh(i.parentNode,"innerBorderTop")),l=this.getTableParentOffset(),h=0;if(t&&(this.deps.getWtTable().getRowHeight(e)??0)>this.deps.getWtViewport().getViewportHeight()&&(t=!1),t&&o.offsetHeight(i)!==o.clientHeight(i)&&(h=o.getScrollbarWidth(this.deps.rootDocument)),t){let t=n.getSetting("fixedRowsBottom"),o=n.getSetting("totalRows");l+=this.sumCellSizes(0,e+1),l-=r.wtViewport.getViewportHeight()-this.sumCellSizes(o-t,o),l+=1,l+=a}else l+=this.sumCellSizes(n.getSetting("fixedRowsTop"),e);return l+=h,o.getMaximumScrollTop(this.mainTableScrollableElement)===l-a&&a>0&&this.deps.getWtOverlays().expandHiderVerticallyBy(a),this.setScrollPosition(l)}getTableParentOffset(){return this.mainTableScrollableElement===this.deps.rootWindow?this.deps.getWtTable().holderOffset.top:0}getScrollPosition(){return rM(this.mainTableScrollableElement,this.deps.rootWindow)}getOverlayOffset(){let{rootWindow:e}=this.deps,t=this.wtSettings.getSetting("preventOverflow"),r=0;if(this.trimmingContainer===e&&(!t||"vertical"!==t)){let e=this.deps.getWtTable().getTotalHeight(),t=this.clone?this.clone.wtTable.getTotalHeight():0;(r=Math.max(this.getScrollPosition()-this.getTableParentOffset(),0))>e-t&&(r=0)}return r}prepareHeaderBorders(){this.needFullRender&&this.shouldBeRendered()&&this.deps.getWtTable().holder.parentNode&&this.clone&&this.trimmingContainer!==this.deps.rootWindow&&this.adjustHeaderBordersPosition(this.getScrollPosition())}adjustHeaderBordersPosition(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.deps.getWtTable().holder.parentNode,n=this.#ee(e,t);return n.hasEmptyColumns?rd(r,"emptyColumns"):ru(r,"emptyColumns"),"add"===n.innerBorderTop?rd(r,"innerBorderTop"):"remove"===n.innerBorderTop&&ru(r,"innerBorderTop"),"keep"!==n.innerBorderTop&&(this.cachedFixedRowsTop=this.wtSettings.getSetting("fixedRowsTop")),n.positionChanged}#ee(e,t){let{wtSettings:r}=this,n=this.deps.getWtTable().holder.parentNode,o=r.getSetting("totalColumns")??0,i="horizontal"===r.getSetting("preventOverflow"),s="keep",a=!1;if(!t&&!i){let t=r.getSetting("fixedRowsTop"),o=this.cachedFixedRowsTop!==t,i=r.getSetting("columnHeaders");if((o||0===t)&&i.length>0){let t=rh(n,"innerBorderTop");e||0===r.getSetting("totalRows")?(s="add",a=!t):(s="remove",a=t)}}return{hasEmptyColumns:!o,innerBorderTop:s,positionChanged:a}}}let sr={getFirstRenderedRow(){let e=this.getRenderedRowsCount();return 0===e?-1:(this.wtSettings.getSetting("totalRows")??0)-e},getFirstVisibleRow(){return this.getFirstRenderedRow()},getFirstPartiallyVisibleRow(){return this.getFirstRenderedRow()},getLastRenderedRow(){return 0===this.getRenderedRowsCount()?-1:(this.wtSettings.getSetting("totalRows")??0)-1},getLastVisibleRow(){return this.getLastRenderedRow()},getLastPartiallyVisibleRow(){return this.getLastRenderedRow()},getRenderedRowsCount(){return Math.min(this.wtSettings.getSetting("totalRows")??0,this.wtSettings.getSetting("fixedRowsBottom"))},getVisibleRowsCount(){return this.getRenderedRowsCount()},getColumnHeadersCount:()=>0};tg(sr,"MIXIN_NAME","stickyRowsBottom",{writable:!1,enumerable:!1});class sn extends iK{constructor(e){super(e,"bottom")}}th(sn,sr),th(sn,iZ);class so extends i8{cachedFixedRowsBottom=-1;constructor(e){super(e,"bottom"),this.cachedFixedRowsBottom=this.wtSettings.getSetting("fixedRowsBottom")}createTable(e){return new sn(e)}shouldBeRendered(){return this.wtSettings.getSetting("shouldRenderBottomOverlay")}resetFixedPosition(){if(!this.needFullRender||!this.shouldBeRendered()||!this.deps.getWtTable().holder.parentNode||!this.clone)return!1;let{rootWindow:e}=this.deps,t=this.clone.wtTable.holder.parentNode;t.style.top="";let r=0,n=this.wtSettings.getSetting("preventOverflow");if(this.trimmingContainer!==e||n&&"vertical"===n)r=this.getScrollPosition(),this.repositionOverlay();else{r=this.getOverlayOffset();let{geometryReader:e}=this.deps,n=e.getBoundingClientRect(this.deps.getWtTable().TABLE),o=e.getBoundingClientRect(this.deps.getWtTable().holder),i=Math.max(0,n.bottom-o.bottom);t.style.bottom=`${r-i}px`}let o=this.adjustHeaderBordersPosition(r);return this.adjustElementsSize(),o}repositionOverlay(){if(!this.clone)return;let e=this.deps.getWtTable(),t=this.deps.getWtViewport(),{rootDocument:r}=this.deps,n=this.clone.wtTable.holder.parentNode,o=0;t.hasVerticalScroll()||(o+=t.getWorkspaceHeight()-e.getTotalHeight()),t.hasVerticalScroll()&&t.hasHorizontalScroll()&&(o+=this.deps.geometryReader.getScrollbarWidth(r)),n.style.bottom=`${o}px`}setScrollPosition(e){let{rootWindow:t}=this.deps,r=this.mainTableScrollableElement,n=()=>r===t?t.scrollY:r.scrollTop,o=n(),i=!1;e!==o&&(r===t?t.scrollTo(t.scrollX,e):r.scrollTop=e,i=o!==n());return i}onScroll(){this.wtSettings.getSetting("onScrollHorizontally")}sumCellSizes(e,t){return this.deps.getWtViewport().sumRowHeights(e,t)}adjustElementsSize(){this.updateTrimmingContainer(),this.needFullRender&&(this.adjustRootElementSize(),this.adjustRootChildrenSize())}adjustRootElementSize(){if(!this.clone)return;let e=this.deps.getWtTable(),t=this.deps.getWtViewport(),{rootDocument:r,rootWindow:n}=this.deps,o=this.clone.wtTable.holder.parentNode.style,i=this.wtSettings.getSetting("preventOverflow");if(this.trimmingContainer!==n||"horizontal"===i){let n=t.getWorkspaceWidth();t.hasVerticalScroll()&&(n-=this.deps.geometryReader.getScrollbarWidth(r)),n=Math.min(n,this.deps.geometryReader.scrollWidth(e.wtRootElement)),o.width=`${n}px`}else o.width="";this.clone.wtTable.holder.style.width=o.width;let s=this.deps.geometryReader.outerHeight(this.clone.wtTable.TABLE);e.hasDefinedSize()||(s=0),o.height=`${s}px`}adjustRootChildrenSize(){if(!this.clone)return;let{holder:e}=this.clone.wtTable;this.clone.wtTable.hider.style.width=this.hider.style.width;let t=e.parentNode;e.style.width=t.style.width,e.style.height=t.style.height}applyToDOM(){let e=this.wtSettings.getSetting("totalRows"),t=this.deps.getWtViewport().rowsRenderCalculator;"number"==typeof t?.startPosition?this.spreader.style.top=`${t.startPosition}px`:0===e||null===t?this.spreader.style.top="0":tr("Incorrect value of the rowsRenderCalculator"),this.spreader.style.bottom="",this.needFullRender&&this.syncOverlayOffset()}syncOverlayOffset(){if(!this.clone)return;let e=this.isRtl()?"right":"left",{spreader:t}=this.clone.wtTable,r=this.deps.getWtViewport().columnsRenderCalculator;"number"==typeof r?.startPosition?t.style[e]=`${r.startPosition}px`:t.style[e]=""}scrollTo(e,t){let r=this.getTableParentOffset(),{geometryReader:n}=this.deps,o=(this.wot.cloneSource?this.wot.cloneSource:this.wot).wtTable.holder,i=0;return t&&n.offsetHeight(o)!==n.clientHeight(o)&&(i=n.getScrollbarWidth(this.deps.rootDocument)),t?(r+=this.sumCellSizes(0,e+1),r-=this.deps.getWtViewport().getViewportHeight(),r+=1):r+=this.sumCellSizes(this.wtSettings.getSetting("fixedRowsBottom"),e),r+=i,this.setScrollPosition(r)}getTableParentOffset(){return this.mainTableScrollableElement===this.deps.rootWindow?this.deps.getWtTable().holderOffset.top:0}getScrollPosition(){return rM(this.mainTableScrollableElement,this.deps.rootWindow)}getOverlayOffset(){let{rootWindow:e}=this.deps,t=this.wtSettings.getSetting("preventOverflow"),r=0;if(this.trimmingContainer===e&&(!t||"vertical"!==t)&&this.clone){let e=this.deps.getWtTable().getTotalHeight(),t=this.clone.wtTable.getTotalHeight(),n=this.deps.geometryReader.clientHeight(this.deps.rootDocument.documentElement);(r=Math.max(this.getTableParentOffset()-this.getScrollPosition()-n+e,0))>e-t&&(r=0)}return r}prepareHeaderBorders(){this.needFullRender&&this.shouldBeRendered()&&this.deps.getWtTable().holder.parentNode&&this.clone&&this.trimmingContainer!==this.deps.rootWindow&&this.adjustHeaderBordersPosition(this.getScrollPosition())}adjustHeaderBordersPosition(e){let t=this.deps.getWtTable().holder.parentNode,r=this.#ee(e);return"add"===r.innerBorderBottom?rd(t,"innerBorderBottom"):"remove"===r.innerBorderBottom&&ru(t,"innerBorderBottom"),"keep"!==r.innerBorderBottom&&(this.cachedFixedRowsBottom=this.wtSettings.getSetting("fixedRowsBottom")),r.positionChanged}#ee(e){let{wtSettings:t}=this,r=this.deps.getWtTable().holder.parentNode,n=t.getSetting("fixedRowsBottom"),o=this.cachedFixedRowsBottom!==n,i=t.getSetting("columnHeaders"),s="keep",a=!1;if((o||0===n)&&i.length>0){let n=rh(r,"innerBorderBottom");e||0===t.getSetting("totalRows")?(s="add",a=!n):(s="remove",a=n)}return{innerBorderBottom:s,positionChanged:a}}}let si={getFirstRenderedColumn(){return 0===this.getRenderedColumnsCount()?-1:0},getFirstVisibleColumn(){return this.getFirstRenderedColumn()},getFirstPartiallyVisibleColumn(){return this.getFirstRenderedColumn()},getLastRenderedColumn(){return this.getRenderedColumnsCount()-1},getLastVisibleColumn(){return this.getLastRenderedColumn()},getLastPartiallyVisibleColumn(){return this.getLastRenderedColumn()},getRenderedColumnsCount(){return Math.min(this.wtSettings.getSetting("totalColumns")??0,this.wtSettings.getSetting("fixedColumnsStart"))},getVisibleColumnsCount(){return this.getRenderedColumnsCount()},getRowHeadersCount(){return this.deps.getRowHeaders().length}};tg(si,"MIXIN_NAME","stickyColumnsStart",{writable:!1,enumerable:!1});class ss extends iK{constructor(e){super(e,ia)}}th(ss,iQ),th(ss,si);class sa extends i8{constructor(e){super(e,ia)}createTable(e){return new ss(e)}shouldBeRendered(){return this.wtSettings.getSetting("shouldRenderInlineStartOverlay")}resetFixedPosition(){let e=this.deps.getWtTable();if(!this.needFullRender||!this.shouldBeRendered()||!e.holder.parentNode||!this.clone)return!1;let{rootWindow:t}=this.deps,r=this.clone.wtTable.holder.parentNode,n=this.wtSettings.getSetting("preventOverflow"),o=0;this.trimmingContainer!==t||n&&"horizontal"===n?(o=this.getScrollPosition(),r1(r)):(o=this.getOverlayOffset()*(this.isRtl()?-1:1),rJ(r,`${o}px`,"0px"));let i=this.adjustHeaderBordersPosition(o);return this.adjustElementsSize(),i}setScrollPosition(e){let{rootWindow:t}=this.deps,r=this.mainTableScrollableElement,n=()=>r===t?t.scrollX:r.scrollLeft;this.isRtl()&&(e=-e);let o=n(),i=!1;if(e!==o){var s;s=e,r===t?t.scrollTo(s,t.scrollY):r.scrollLeft=s,i=o!==n()}return i}onScroll(){this.wtSettings.getSetting("onScrollVertically")}sumCellSizes(e,t){let r=this.wtSettings.getSetting("defaultColumnWidth"),n=e,o=0;for(;n<t;)o+=this.deps.getWtTable().getColumnWidth(n)||r,n+=1;return o}adjustElementsSize(){this.updateTrimmingContainer(),this.needFullRender&&(this.adjustRootElementSize(),this.adjustRootChildrenSize())}adjustRootElementSize(){if(!this.clone)return;let e=this.deps.getWtTable(),t=this.deps.getWtViewport(),{rootDocument:r,rootWindow:n}=this.deps,o=this.clone.wtTable.holder.parentNode.style,i=this.wtSettings.getSetting("preventOverflow");if(this.trimmingContainer!==n||"vertical"===i){let n=t.getWorkspaceHeight();if(t.hasHorizontalScroll()){let t=this.deps.geometryReader.clientHeight(e.holder);n=t>0?t:n-this.deps.geometryReader.getScrollbarWidth(r)}n=Math.min(n,this.deps.geometryReader.scrollHeight(e.wtRootElement)),o.height=`${n}px`}else o.height="";this.clone.wtTable.holder.style.height=o.height;let s=this.deps.geometryReader.outerWidth(this.clone.wtTable.TABLE);o.width=`${s}px`}adjustRootChildrenSize(){if(!this.clone)return;let{holder:e}=this.clone.wtTable,t=se(this.wot),r=this.deps.getSelectionManager().getFocusSelection()?parseInt(t.width,10)/2:0;this.clone.wtTable.hider.style.height=this.hider.style.height;let n=e.parentNode;e.style.height=n.style.height,e.style.width=`${parseInt(n.style.width,10)+r}px`}applyToDOM(){let e=this.wtSettings.getSetting("totalColumns"),t=this.isRtl()?"right":"left",r=this.deps.getWtViewport().columnsRenderCalculator;"number"==typeof r?.startPosition?this.spreader.style[t]=`${r.startPosition}px`:0===e||null===r?this.spreader.style[t]="0":tr("Incorrect value of the columnsRenderCalculator"),this.isRtl()?this.spreader.style.left="":this.spreader.style.right="",this.needFullRender&&this.syncOverlayOffset()}syncOverlayOffset(){if(!this.clone)return;let e=this.deps.getWtViewport().rowsRenderCalculator;"number"==typeof e?.startPosition?this.clone.wtTable.spreader.style.top=`${e.startPosition}px`:this.clone.wtTable.spreader.style.top=""}scrollTo(e,t){let{wtSettings:r}=this,{geometryReader:n}=this.deps,o=r.getSetting("rowHeaders"),i=r.getSetting("fixedColumnsStart"),s=(this.wot.cloneSource?this.wot.cloneSource:this.wot).wtTable.holder,a=+!(0!==i||!(o.length>0)||rh(s.parentNode,"innerBorderInlineStart")),l=this.getTableParentOffset(),h=0;return t&&this.deps.getWtTable().getColumnWidth(e)>this.deps.getWtViewport().getViewportWidth()&&(t=!1),t&&n.offsetWidth(s)!==n.clientWidth(s)&&(h=n.getScrollbarWidth(this.deps.rootDocument)),t?(l+=this.sumCellSizes(0,e+1),l-=this.deps.getWtViewport().getViewportWidth(),l+=a):l+=this.sumCellSizes(this.wtSettings.getSetting("fixedColumnsStart"),e),l+=h,n.getMaximumScrollLeft(this.mainTableScrollableElement)===l-a&&a>0&&this.deps.getWtOverlays().expandHiderHorizontallyBy(a),this.setScrollPosition(l)}getTableParentOffset(){let e=this.wtSettings.getSetting("preventOverflow"),t=0;return e||this.trimmingContainer!==this.deps.rootWindow||(t=this.deps.getWtTable().holderOffset.left),t}getScrollPosition(){return Math.abs(rI(this.mainTableScrollableElement,this.deps.rootWindow))}getOverlayOffset(){let{rootWindow:e}=this.deps,t=this.wtSettings.getSetting("preventOverflow"),r=0;return this.trimmingContainer===e&&(!t||"horizontal"!==t)&&(r=this.isRtl()?Math.abs(Math.min(this.getTableParentOffset()-this.getScrollPosition(),0)):Math.max(this.getScrollPosition()-this.getTableParentOffset(),0))>this.deps.getWtTable().getTotalWidth()-(this.clone?this.clone.wtTable.getTotalWidth():0)&&(r=0),r}prepareHeaderBorders(){this.needFullRender&&this.shouldBeRendered()&&this.deps.getWtTable().holder.parentNode&&this.clone&&this.trimmingContainer!==this.deps.rootWindow&&this.adjustHeaderBordersPosition(this.getScrollPosition())}adjustHeaderBordersPosition(e){let t=this.deps.getWtTable().holder.parentNode,r=this.#ee(e);return r.hasEmptyRows?rd(t,"emptyRows"):ru(t,"emptyRows"),"add"===r.innerBorder?rd(t,"innerBorderLeft innerBorderInlineStart"):"remove"===r.innerBorder&&ru(t,"innerBorderLeft innerBorderInlineStart"),r.positionChanged}#ee(e){let{wtSettings:t}=this,r=this.deps.getWtTable().holder.parentNode,n=t.getSetting("rowHeaders"),o=t.getSetting("fixedColumnsStart"),i=t.getSetting("totalRows"),s="vertical"===t.getSetting("preventOverflow"),a="keep",l=!1;if(!s){if(o&&!n.length)a="add";else if(!o&&n.length){let t=rh(r,"innerBorderInlineStart");e?(a="add",l=!t):(a="remove",l=t)}}return{hasEmptyRows:!i,innerBorder:a,positionChanged:l}}}class sl extends iK{constructor(e){super(e,il)}}th(sl,iX),th(sl,si);class sh extends i8{constructor(e,t,r){super(e,il),this.topOverlay=t,this.inlineStartOverlay=r}createTable(e){return new sl(e)}shouldBeRendered(){return this.wtSettings.getSetting("shouldRenderTopOverlay")&&this.wtSettings.getSetting("shouldRenderInlineStartOverlay")}setScrollPosition(e){return!1}getScrollPosition(){return 0}getTableParentOffset(){return 0}getOverlayOffset(){return 0}onScroll(){}sumCellSizes(e,t){return 0}adjustElementsSize(){}applyToDOM(){}scrollTo(e,t){return!1}resetFixedPosition(){if(this.updateTrimmingContainer(),!this.deps.getWtTable().holder.parentNode||!this.clone)return!1;let e=this.clone.wtTable.holder.parentNode;if(this.trimmingContainer===this.deps.rootWindow){let t=this.inlineStartOverlay.getOverlayOffset()*(this.isRtl()?-1:1),r=this.topOverlay.getOverlayOffset();rJ(e,`${t}px`,`${r}px`)}else r1(e);let{geometryReader:t}=this.deps,r=t.outerHeight(this.clone.wtTable.TABLE),n=t.outerWidth(this.clone.wtTable.TABLE);return this.deps.getWtTable().hasDefinedSize()||(r=0),e.style.height=`${r}px`,e.style.width=`${n}px`,!0}}class sd extends iK{constructor(e){super(e,ih)}}th(sd,sr),th(sd,si);class su extends i8{constructor(e,t,r){super(e,ih),this.bottomOverlay=t,this.inlineStartOverlay=r}createTable(e){return new sd(e)}shouldBeRendered(){return this.wtSettings.getSetting("shouldRenderBottomOverlay")&&this.wtSettings.getSetting("shouldRenderInlineStartOverlay")}resetFixedPosition(){let{wot:e}=this;this.updateTrimmingContainer();let{clone:t}=this;if(!e.wtTable.holder.parentNode||!t)return!1;let r=t.wtTable.holder.parentNode;if(r.style.top="",this.trimmingContainer===this.deps.rootWindow){let e=this.inlineStartOverlay.getOverlayOffset(),{geometryReader:t}=this.deps,n=t.getBoundingClientRect(this.deps.getWtTable().TABLE),o=t.getBoundingClientRect(this.deps.getWtTable().holder),i=Math.max(0,n.bottom-o.bottom),s=this.bottomOverlay.getOverlayOffset()-i;r.style[this.isRtl()?"right":"left"]=`${e}px`,r.style.bottom=`${s}px`}else r1(r),this.repositionOverlay();let n=this.deps.geometryReader.outerHeight(t.wtTable.TABLE),o=this.deps.geometryReader.outerWidth(t.wtTable.TABLE);return this.deps.getWtTable().hasDefinedSize()||(n=0),r.style.height=`${n}px`,r.style.width=`${o}px`,!0}setScrollPosition(e){return!1}getScrollPosition(){return 0}getTableParentOffset(){return 0}getOverlayOffset(){return 0}onScroll(){}sumCellSizes(e,t){return 0}adjustElementsSize(){}applyToDOM(){}scrollTo(e,t){return!1}repositionOverlay(){if(!this.clone)return;let e=this.deps.getWtTable(),t=this.deps.getWtViewport(),{rootDocument:r}=this.deps,n=this.clone.wtTable.holder.parentNode,o=0;t.hasVerticalScroll()||(o+=t.getWorkspaceHeight()-e.getTotalHeight()),t.hasVerticalScroll()&&t.hasHorizontalScroll()&&(o+=this.deps.geometryReader.getScrollbarWidth(r)),n.style.bottom=`${o}px`}}class sc{#m;#et=!1;#x=!1;constructor(e){this.#m=e}registerListeners(){let{eventManager:e,rootDocument:t}=this.#m;this.#et&&(this.#et=!1,this.#er("relative",0,0)),this.#x=!1,e.addEventListener(t,"mousedown",e=>{e instanceof MouseEvent&&(this.#x=this.#en(e))}),e.addEventListener(t,"mouseup",()=>{this.#x=!1,this.#et&&this.deactivate()})}tryActivate(e,t){this.#x&&!this.#et&&!tB()&&(e||t)&&this.#eo()}syncOffsets(){if(!this.#et)return;let e=this.#m.getWtViewport(),t=e.rowsRenderCalculator?.startPosition,r=e.columnsRenderCalculator?.startPosition;if("number"!=typeof t||"number"!=typeof r)return;let n=t-this.#ei(),o=r-this.#es();this.#er("sticky",n,o)}destroy(){this.#et&&this.#er("relative",0,0),this.#et=!1,this.#x=!1}#eo(){let e=this.#m.wtTable.spreader,t=this.#m.wtSettings.getSetting("rtlMode"),r=(Number.parseInt(e.style.top,10)||0)-this.#ei(),n=(Number.parseInt(e.style[t?"right":"left"],10)||0)-this.#es();this.#et=!0,this.#er("sticky",r,n)}deactivate(){let e=this.#m.wtTable.spreader,t=this.#m.getWtViewport(),r=this.#m.wtSettings.getSetting("rtlMode");this.#m.refreshAll();let n=Number.parseInt(e.style.top,10)||0,o=Number.parseInt(e.style[r?"right":"left"],10)||0,i=t.rowsRenderCalculator?.startPosition,s=t.columnsRenderCalculator?.startPosition,a="number"==typeof i?i-n:this.#ei(),l="number"==typeof s?s-o:this.#es();this.#ea(a,l),this.#et=!1,this.#er("relative",0,0),this.#m.refreshAll(),this.#m.applyToDOM()}#ei(){let e=this.#m.getTopOverlay();return e.getScrollPosition()-e.getTableParentOffset()}#es(){let e=this.#m.getInlineStartOverlay();return this.#X()&&this.#el()?Math.abs(e.getScrollPosition()):Math.abs(e.getScrollPosition())-e.getTableParentOffset()}#ea(e,t){if(this.#el()){let{rootWindow:r}=this.#m,n=this.#X()?t:t+this.#m.getInlineStartOverlay().getTableParentOffset();r.scrollTo(n,e+this.#m.getTopOverlay().getTableParentOffset())}else this.#m.wtTable.holder.scrollTop=e,this.#m.wtTable.holder.scrollLeft=this.#X()?-t:t}#eh(e){e.style.top="",e.style.bottom="",e.style.left="",e.style.right=""}#er(e,t,r){let n=this.#m.wtTable.spreader,o=this.#X(),i=o?"right":"left",s="sticky"===e;n.style.position=e,s?(n.style.top=`${t}px`,n.style.bottom="",n.style[i]=`${r}px`,n.style[o?"left":"right"]=""):this.#eh(n),this.#el()||(this.#ed(this.#m.getInlineStartOverlay(),e,s,t,null,o),this.#ed(this.#m.getTopOverlay(),e,s,null,r,o),this.#ed(this.#m.getBottomOverlay(),e,s,null,r,o))}#ed(e,t,r,n,o,i){if(!e.needFullRender||!e.clone)return;let s=e.clone.wtTable.spreader;s.style.position=t,r?(null!==n&&(s.style.top=`${n}px`),null!==o&&(s.style[i?"right":"left"]=`${o}px`,s.style[i?"left":"right"]="")):this.#eh(s)}#en(e){return this.#el()?e.target===this.#m.rootDocument.documentElement:e.target===this.#m.getScrollableElement()}#el(){return this.#m.getScrollableElement()===this.#m.rootWindow}#X(){return this.#m.wtSettings.getSetting("rtlMode")}}class sg{#m;#eu=0;#ec=null;#eg=new ResizeObserver(e=>{tR(()=>{Array.isArray(e)&&e.length&&(this.#eu+=1,300===this.#eu&&(tQ("The ResizeObserver callback was fired too many times in direct succession.\nThis may be due to an infinite loop caused by setting a dynamic height/width (for example, with the `dvh` units) to a Handsontable container's parent. \nThe observer will be disconnected."),this.#eg.disconnect()),null!==this.#ec&&clearTimeout(this.#ec),this.#ec=setTimeout(()=>{this.#eu=0},100),this.#m.wtSettings.getSetting("onContainerElementResize"))})});constructor(e){this.#m=e}observe(){let e=this.#m.wtTable.wtRootElement.parentElement;e&&this.#eg.observe(e)}resetResizeCount(){this.#eu=0}destroy(){null!==this.#ec&&(clearTimeout(this.#ec),this.#ec=null),this.#eg.disconnect()}}class sp{#m;#ep={width:null,height:null};constructor(e){this.#m=e}updateLastSpreaderSize(){let e=this.#m.wtTable.spreader,{geometryReader:t}=this.#m,r=t.clientWidth(e),n=t.clientHeight(e),o=r!==this.#ep.width||n!==this.#ep.height;return o&&(this.#ep.width=r,this.#ep.height=n),o}adjustElementsSize(){let{wtSettings:e,rootWindow:t,geometryReader:r}=this.#m,n=this.#m.getWtViewport(),{wtTable:o}=this.#m,i=this.#m.getTopOverlay(),s=this.#m.getInlineStartOverlay(),a=this.#m.getBottomOverlay(),l=this.#m.getScrollableElement(),h=l===t,d=e.getSetting("totalColumns"),u=e.getSetting("totalRows"),c=n.getRowHeaderWidth(),g=n.getColumnHeaderHeight(),p=+!e.getSetting("externalRowCalculator"),m=g+i.sumCellSizes(0,u)+p,f=c+s.sumCellSizes(0,d),b=o.hider.style,C=+!!(!h&&l instanceof HTMLElement&&l.scrollTop>Math.max(0,m-r.clientHeight(o.holder))),y=+!!(!h&&l instanceof HTMLElement&&l.scrollLeft>Math.max(0,f-r.clientWidth(o.holder)));b.width=`${f+y}px`,b.height=`${m+C}px`,i.adjustElementsSize(),s.adjustElementsSize(),a.adjustElementsSize()}expandHiderVerticallyBy(e){let{hider:t}=this.#m.wtTable;t.style.height=`${parseInt(t.style.height,10)+e}px`}expandHiderHorizontallyBy(e){let{hider:t}=this.#m.wtTable;t.style.width=`${parseInt(t.style.width,10)+e}px`}}class sm{#m;#em;#ef=!1;#eb=null;#eC=!1;#ey=!1;#ew=!1;#eS=!1;#ev;#eR;#eE=!1;#eT=null;#eA=null;constructor(e){this.#m=e,this.#em=this.#eM(),this.#ev=this.#m.rootWindow.scrollX,this.#eR=this.#m.rootWindow.scrollY}get scrollableElement(){return this.#em}get isScrollableElementProvisional(){return this.#ef}get verticalScrolling(){return this.#ew}set verticalScrolling(e){this.#ew=e}get horizontalScrolling(){return this.#eS}set horizontalScrolling(e){this.#eS=e}setRenderingStateChanged(e){this.#eE=e}cacheScrollCallbackPositions(){this.#eT=this.#m.getTopOverlay().getScrollPosition(),this.#eA=this.#m.getInlineStartOverlay().getScrollPosition()}syncScrollPositions(){if(this.#m.getDestroyed())return;let e=this.#m.getTopOverlay(),t=this.#m.getInlineStartOverlay(),r=this.#m.getBottomOverlay(),n=this.#m.getWtViewport(),{wtSettings:o}=this.#m,i=this.#em,s=e.clone?.wtTable.holder,a=t.clone?.wtTable.holder,l=o.getSetting("preventOverflow"),h=i instanceof HTMLElement?i.scrollLeft:0,d=i instanceof HTMLElement?i.scrollTop:0;if(n.isHorizontallyScrollableByWindow()&&("boolean"==typeof l&&l||"horizontal"!==l)&&i instanceof Window&&(h=i.scrollX),n.isVerticallyScrollableByWindow()&&("boolean"==typeof l&&l||"vertical"!==l)&&i instanceof Window&&(d=i.scrollY),this.#eS=this.#ev!==h,this.#ew=this.#eR!==d,this.#ev=h,this.#eR=d,this.#m.tryActivateStickyScroll(this.#ew,this.#eS),this.#eS){ne(s)&&(s.scrollLeft=h);let e=r.needFullRender?r.clone?.wtTable.holder:null;e&&(e.scrollLeft=h)}this.#ew&&ne(a)&&(n.isVerticallyScrollableByWindow()?a.scrollTop=0:a.scrollTop=d),this.#m.refreshAll(),this.#m.syncStickyScrollOffsets()}fireScrollCallbacksAndReset(){this.#ew&&this.#eI()&&this.#m.getInlineStartOverlay().onScroll(),this.#eS&&this.#ex()&&this.#m.getTopOverlay().onScroll(),this.#ew=!1,this.#eS=!1}syncScrollWithMaster(){if(!this.#eE)return;let e=this.#m.getTopOverlay(),t=this.#m.getBottomOverlay(),r=this.#m.getInlineStartOverlay(),n=e.mainTableScrollableElement;if(!(n instanceof HTMLElement))return;let{scrollLeft:o,scrollTop:i}=n;e.needFullRender&&e.clone&&(e.clone.wtTable.holder.scrollLeft=o),t.needFullRender&&t.clone&&(t.clone.wtTable.holder.scrollLeft=o),r.needFullRender&&r.clone&&(r.clone.wtTable.holder.scrollTop=i),this.#eE=!1}resetSizesMeasuredBeforeLayoutSettled(){if(!this.#eC)return;this.#ey=!0;let e=this.#m.getWtViewport();e.resetAllOversizedRows(),e.invalidateColumnWidthCache()}confirmSizesRemeasured(){this.#ey&&(this.#ey=!1,this.#eC=!1)}resolveProvisionalLayout(){if(!this.#ef||!this.#m.geometryReader.isRendered(this.#m.wtTable.wtRootElement))return;let{rootWindow:e}=this.#m,t=this.#eN();if(t===e&&this.#m.getTopOverlay().trimmingContainer!==e){this.#ef=t!==this.#eb,this.#eb=t;return}this.updateMainScrollableElements(),this.#eC=!0}updateMainScrollableElements(){this.#m.eventManager.clearEvents(!0),this.#m.getInlineStartOverlay().updateMainScrollableElement(),this.#m.getTopOverlay().updateMainScrollableElement(),this.#m.getBottomOverlay().needFullRender&&this.#m.getBottomOverlay().updateMainScrollableElement(),this.#em=this.#eM(),this.#m.registerListeners()}#eI(){let e=this.#m.getTopOverlay().getScrollPosition();return this.#eT!==e&&(this.#eT=e,!0)}#ex(){let e=this.#m.getInlineStartOverlay().getScrollPosition();return this.#eA!==e&&(this.#eA=e,!0)}#eM(){let{wtTable:e,geometryReader:t}=this.#m;return this.#ef=!t.isRendered(e.wtRootElement),this.#eb=null,this.#eN()}#eN(){let e,{wtTable:t,geometryReader:r}=this.#m,n=t.wtRootElement.parentNode;return null!==n&&1===n.nodeType&&("hidden"===(e=r.getComputedStyle(n).getPropertyValue("overflow"))||"clip"===e)?t.holder:rx(t.TABLE)}}class sf{#m;#eO=!1;#ek;constructor(e){this.#m=e,this.#ek=this.#eH()}registerListeners(){let e,{rootDocument:t,rootWindow:r,wtTable:n,wtSettings:o,eventManager:i}=this.#m,s=this.#m.getTopOverlay(),a=this.#m.getInlineStartOverlay(),{mainTableScrollableElement:l}=s,{mainTableScrollableElement:h}=a;i.addEventListener(t.documentElement,"keydown",e=>this.#e_(e)),i.addEventListener(t.documentElement,"keyup",()=>this.#eL()),i.addEventListener(t,"visibilitychange",()=>this.#eL()),this.#m.registerStickyScrollListeners(),i.addEventListener(l,"scroll",e=>this.#eP(e),{passive:!0}),l!==h&&i.addEventListener(h,"scroll",e=>this.#eP(e),{passive:!0});let d=this.#m.getScrollableElement()===r,u=o.getSetting("preventWheel"),c={passive:d};i.addEventListener(n.wtRootElement,"wheel",e=>this.#eD(e,u),c),this.#m.getCloneableOverlays().forEach(e=>{e.clone&&i.addEventListener(e.clone.wtTable.holder,"wheel",e=>this.#eD(e,u),c)}),i.addEventListener(r,"resize",()=>{tR(()=>{clearTimeout(e),o.getSetting("onWindowResize"),e=setTimeout(()=>{this.#m.resetResizeCount()},200)})}),d||this.#m.observeResize()}#eP(e){let{rootWindow:t}=this.#m,r=this.#m.getInlineStartOverlay().mainTableScrollableElement,n=this.#m.getTopOverlay().mainTableScrollableElement,o=e.target;(!this.#eO||(n===t||o===t||n instanceof HTMLElement&&t4(e).contains(n))&&(r===t||o===t||r instanceof HTMLElement&&t4(e).contains(r)))&&this.#m.syncScrollPositions()}#eD(e,t){if(e.ctrlKey)return;let{rootWindow:r}=this.#m,n=this.#m.getInlineStartOverlay().mainTableScrollableElement,o=this.#m.getTopOverlay().mainTableScrollableElement,i=e.target,s=o!==r&&i!==r&&!(i instanceof Node&&o instanceof HTMLElement&&i.contains(o)),a=n!==r&&i!==r&&!(i instanceof Node&&n instanceof HTMLElement&&i.contains(n));if(this.#eO&&(s||a)||this.#m.getScrollableElement()===r)return;let l=this.#eF(e);(t||this.#m.getScrollableElement()!==r&&l)&&e.preventDefault()}#e_(e){this.#eO=nv(e.keyCode,"ARROW_UP|ARROW_RIGHT|ARROW_DOWN|ARROW_LEFT")}#eL(){this.#eO=!1}#eF(e){let t,r;"wheelDeltaY"in e||"wheelDeltaX"in e?(t=isNaN(e.deltaY)?-1*(e.wheelDeltaY??0):e.deltaY,r=isNaN(e.deltaX)?-1*(e.wheelDeltaX??0):e.deltaX):(t=e.deltaY,r=e.deltaX),1===e.deltaMode&&(r+=r*this.#ek,t+=t*this.#ek);let n=this.#m.scrollVertically(t),o=this.#m.scrollHorizontally(r);return n||o}#eH(){let{rootDocument:e,geometryReader:t}=this.#m,r=t.getComputedStyle(e.body),n=parseInt(r.lineHeight,10),o=1.2*parseInt(r.fontSize,10);return n||o}}class sb{#m;scrollbarSize=0;destroyed=!1;isScrollDrivenDraw=!1;#eB;#eV;#eU;get verticalScrolling(){return this.#eU.verticalScrolling}set verticalScrolling(e){this.#eU.verticalScrolling=e}get horizontalScrolling(){return this.#eU.horizontalScrolling}set horizontalScrolling(e){this.#eU.horizontalScrolling=e}get scrollableElement(){return this.#eU.scrollableElement}get isScrollableElementProvisional(){return this.#eU.isScrollableElementProvisional}#ez=[];#eW=nd(this.#eG.bind(this),200);#e$;#eY;constructor(e){this.#m=e,this.wot=e.wot,this.wtSettings=e.wtSettings,this.wtTable=e.wtTable;const{rootDocument:t}=e;this.eventManager=e.eventManager,this.scrollbarSize=this.#m.geometryReader.getScrollbarWidth(t),this.#e$=new sc(this.#m.makeStickyScrollDeps(this)),this.#eY=new sg(this.#m.makeResizeMonitorDeps()),this.#eV=new sp(this.#m.makeSpreaderSizeDeps(this)),this.#eU=new sm(this.#m.makeScrollSyncDeps(this,this.#e$)),this.#eB=new sf(this.#m.makeNativeScrollInputDeps(this,this.#e$,this.#eY)),this.initOverlays(),this.#eU.cacheScrollCallbackPositions(),this.destroyed=!1,this.registerListeners()}getOverlays(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=[...this.#ez];return e&&t.push(this.wtTable),t}initOverlays(){let e=this.#m.makeOverlayDeps;this.topOverlay=new st(e()),this.bottomOverlay=new so(e()),this.inlineStartOverlay=new sa(e()),this.topInlineStartCornerOverlay=new sh(e(),this.topOverlay,this.inlineStartOverlay),this.bottomInlineStartCornerOverlay=new su(e(),this.bottomOverlay,this.inlineStartOverlay),this.#ez=[this.topOverlay,this.bottomOverlay,this.inlineStartOverlay,this.topInlineStartCornerOverlay,this.bottomInlineStartCornerOverlay]}prepareHeaderBorders(){this.topOverlay.prepareHeaderBorders(),this.bottomOverlay.clone&&this.bottomOverlay.prepareHeaderBorders(),this.inlineStartOverlay.prepareHeaderBorders()}beforeDraw(){this.isScrollDrivenDraw||this.#eU.resetSizesMeasuredBeforeLayoutSettled(),this.#eU.setRenderingStateChanged(this.#ez.reduce((e,t)=>t.hasRenderingStateChanged()||e,!1)),this.#ez.forEach(e=>e.updateStateOfRendering("before"))}afterDraw(e){this.syncScrollWithMaster(),this.#ez.forEach(e=>{let t=e.hasRenderingStateChanged();e.updateStateOfRendering("after"),t&&!e.needFullRender&&e.reset()}),e&&this.#eU.confirmSizesRemeasured(),this.isScrollDrivenDraw||this.#eU.resolveProvisionalLayout()}refreshAll(){if(this.wot.drawn){if(!this.wtTable.holder.parentNode)return void this.destroy();this.wot.draw(!0),this.#eU.fireScrollCallbacksAndReset()}}registerListeners(){this.#eB.registerListeners()}scrollVertically(e){if(!(this.scrollableElement instanceof HTMLElement))return!1;let t=this.scrollableElement,r=t.scrollTop;return t.scrollTop+=e,r!==t.scrollTop}scrollHorizontally(e){if(!(this.scrollableElement instanceof HTMLElement))return!1;let t=this.scrollableElement,r=t.scrollLeft;return t.scrollLeft+=e,r!==t.scrollLeft}syncScrollPositions(){this.#eU.syncScrollPositions()}syncScrollWithMaster(){this.#eU.syncScrollWithMaster()}updateMainScrollableElements(){this.#eU.updateMainScrollableElements()}destroy(){this.#eW.cancel(),this.#eY.destroy(),this.#e$.destroy(),this.eventManager.destroy(),this.topOverlay.destroy(),this.bottomOverlay.clone&&this.bottomOverlay.destroy(),this.inlineStartOverlay.destroy(),this.topInlineStartCornerOverlay&&this.topInlineStartCornerOverlay.destroy(),this.bottomInlineStartCornerOverlay&&this.bottomInlineStartCornerOverlay.clone&&this.bottomInlineStartCornerOverlay.destroy(),this.destroyed=!0}refresh(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.isScrollDrivenDraw&&(this.verticalScrolling||this.horizontalScrolling),r=e||this.isScrollDrivenDraw&&this.verticalScrolling&&!this.horizontalScrolling;t?this.#eW():this.#eG(),this.bottomOverlay.clone&&this.bottomOverlay.refresh(r),this.inlineStartOverlay.refresh(e),this.topOverlay.refresh(e),this.topInlineStartCornerOverlay&&this.topInlineStartCornerOverlay.refresh(e),this.bottomInlineStartCornerOverlay&&this.bottomInlineStartCornerOverlay.clone&&this.bottomInlineStartCornerOverlay.refresh(r)}updateLastSpreaderSize(){return this.#eV.updateLastSpreaderSize()}refreshColumnHeaderHeights(){[this.wot.wtTable,this.topOverlay.clone?.wtTable,this.inlineStartOverlay.clone?.wtTable,this.topInlineStartCornerOverlay?.clone?.wtTable].forEach(e=>{e&&iD(e)}),iF(this.wot.wtTable),this.adjustElementsSize()}adjustElementsSize(){this.#eV.adjustElementsSize()}expandHiderVerticallyBy(e){this.#eV.expandHiderVerticallyBy(e)}expandHiderHorizontallyBy(e){this.#eV.expandHiderHorizontallyBy(e)}applyToDOM(){this.wtTable.isVisible()&&(this.topOverlay.applyToDOM(),this.bottomOverlay.clone&&this.bottomOverlay.applyToDOM(),this.inlineStartOverlay.applyToDOM(),this.#e$.syncOffsets())}getParentOverlay(e){if(!e)return null;let t=[this.topOverlay,this.inlineStartOverlay,this.bottomOverlay,this.topInlineStartCornerOverlay,this.bottomInlineStartCornerOverlay],r=null;return J(t,t=>{t&&t.clone&&t.clone.wtTable.TABLE.contains(e)&&(r=t.clone)}),r}syncOverlayTableClassNames(){let e=this.wtTable.TABLE;J([this.topOverlay,this.inlineStartOverlay,this.bottomOverlay,this.topInlineStartCornerOverlay,this.bottomInlineStartCornerOverlay],t=>{t&&t.clone&&(t.clone.wtTable.TABLE.className=e.className)})}#eG(){this.destroyed||this.updateLastSpreaderSize()&&this.adjustElementsSize()}}class sC{settings={};defaults=Object.freeze(function(e){return{facade:void 0,table:void 0,isDataViewInstance:!0,externalRowCalculator:!1,singlePassLayout:!0,currentRowClassName:null,currentColumnClassName:null,preventOverflow:()=>!1,preventWheel:!1,data:void 0,fixedColumnsStart:0,fixedRowsTop:0,fixedRowsBottom:0,shouldRenderInlineStartOverlay:()=>e.getSetting("fixedColumnsStart")>0||e.getSetting("rowHeaders").length>0,shouldRenderTopOverlay:()=>e.getSetting("fixedRowsTop")>0||e.getSetting("columnHeaders").length>0,shouldRenderBottomOverlay:()=>e.getSetting("fixedRowsBottom")>0,minSpareRows:0,rowHeaders:()=>[],columnHeaders:()=>[],totalRows:void 0,totalColumns:void 0,cellRenderer:(t,r,n)=>{let o=e.getSetting("data",t,r);rS(n,null==o?"":o)},columnWidth(){},rowHeight(){},rowHeightByOverlayName(){},rowHeightsUniform:()=>!1,columnWidthsUniform:()=>!1,defaultColumnWidth:50,selections:null,hideBorderOnMouseDownOver:!1,viewportRowCalculatorOverride:null,viewportColumnCalculatorOverride:null,viewportRowRenderingThreshold:null,viewportColumnRenderingThreshold:null,viewportRowRenderingOffsetIsAuto:!0,viewportColumnRenderingOffsetIsAuto:!0,onCellMouseDown:null,onCellContextMenu:null,onCellMouseOver:null,onCellMouseOverOutside:null,onCellMouseOut:null,onCellMouseUp:null,onCellDblClick:null,onCellCornerMouseDown:null,onCellCornerDblClick:null,onSelectionHandleMouseDown:null,onSelectionEdgeMouseDown:null,beforeDraw:null,onDraw:null,onBeforeRemoveCellClassNames:null,onAfterDrawSelection:null,onBeforeDrawBorders:null,onBeforeViewportScrollHorizontally:e=>e,onBeforeViewportScrollVertically:e=>e,onScrollHorizontally:null,onScrollVertically:null,onBeforeTouchScroll:null,onAfterMomentumScroll:null,onModifyRowHeaderWidth:null,onModifyGetCellCoords:null,onModifyGetCoordsElement:null,onModifyGetCoords:null,onBeforeHighlightingRowHeader:e=>e,onBeforeHighlightingColumnHeader:e=>e,onWindowResize:null,onContainerElementResize:null,renderAllColumns:!1,renderAllRows:!1,groups:!1,rowHeaderWidth:null,columnHeaderHeight:null,headerClassName:null,rtlMode:!1,ariaTags:!0,stylesHandler:null}}(this));constructor(e){tp(this.defaults,(t,r)=>{void 0!==e[r]?this.settings[r]=e[r]:void 0===t?tr(`A required setting "${r}" was not provided`):this.settings[r]=t})}update(e,t){return void 0===t?tp(e,(e,t)=>{this.settings[t]=e}):this.settings[e]=t,this}getSetting(e,t,r,n,o){return"function"==typeof this.settings[e]?this.settings[e](t,r,n,o):void 0!==t&&Array.isArray(this.settings[e])?this.settings[e][t]:this.settings[e]}getSettingPure(e){return this.settings[e]}has(e){return!!this.settings[e]}}var sy=new WeakSet;class sw extends iK{#ej=(sy.add(this),null);#eq=null;#eK=null;#eX=null;constructor(e){super(e,"master")}alignOverlaysWithTrimmingContainer(){let e=sy.has(this),t=rL(this.wtRootElement),{geometryReader:r}=this.deps;if(t instanceof HTMLElement){if(e){if(this.#eX!==t){this.#eq?.disconnect(),this.#eK?.disconnect(),this.#ej=null,this.#eX=t;let e=()=>{this.#ej=null},r=new ResizeObserver(e);r.observe(t),this.#eq=r;let n=new ResizeObserver(e);n.observe(this.hider),this.#eK=n}let e=r.offsetWidth(t),n=r.offsetHeight(t),o=r.scrollWidth(t),i=r.scrollHeight(t),s=r.getStyle(t,"overflow")??"",a=r.getStyle(t,"height")??"",l=r.offsetHeight(this.hider),h=r.offsetWidth(this.hider),d=this.#ej;if(null!==d&&d.trimmingOffsetWidth===e&&d.trimmingOffsetHeight===n&&d.trimmingScrollWidth===o&&d.trimmingScrollHeight===i&&d.trimmingOverflow===s&&d.trimmingHeight===a&&d.hiderOffsetHeight===l&&d.hiderOffsetWidth===h){let e=this.holder.style;e.width=d.holderWidth,e.height=d.holderHeight,e.overflow="",this.hasTableHeight=d.hasTableHeight,this.hasTableWidth=d.hasTableWidth}else{let d=t.parentElement,u=this.holder.style,c=e,g=n,p=["auto","hidden","scroll","clip"],m=s?s.split(" ").some(e=>p.includes(e)):[r.getStyle(t,"overflowX"),r.getStyle(t,"overflowY")].some(e=>e&&p.includes(e)),f="auto"===a;if(d&&m){let e=t.cloneNode(!1);e.style.overflow="auto",e.style.position="absolute",e.style.border="0",e.style.padding="0",t.nextElementSibling?d.insertBefore(e,t.nextElementSibling):d.appendChild(e);let n=parseInt(r.getComputedStyle(e).height,10);if(d.removeChild(e),0===n){g=0;let e=r.getComputedStyle(t),n=e.overflowX,o=e.overflowY;("auto"===n||"scroll"===n)&&"auto"!==o&&"scroll"!==o&&(f=!0)}}g=Math.min(g,i),c=Math.min(c,o);let b=f?"auto":`${g}px`,C=`${c}px`,y="auto"===b||g>0,w=c>0;u.height=b,u.width=C,u.overflow="",this.hasTableHeight=y,this.hasTableWidth=w,c>0&&(this.#ej={trimmingOffsetWidth:e,trimmingOffsetHeight:n,trimmingScrollWidth:o,trimmingScrollHeight:i,trimmingOverflow:s,trimmingHeight:a,hiderOffsetHeight:l,hiderOffsetWidth:h,holderWidth:C,holderHeight:b,hasTableHeight:y,hasTableWidth:w})}}}else this.wtSettings.getSetting("preventOverflow")||(this.holder.style.overflow="visible",this.wtRootElement.style.overflow="visible");this.isTableVisible=rv(this.TABLE)}destroy(){this.#eq?.disconnect(),this.#eK?.disconnect(),this.#ej=null,this.#eq=null,this.#eK=null,this.#eX=null}}th(sw,iQ),th(sw,iZ);class sS{count=0;startRow=0;endRow=0;startPosition=0;isVisibleInTrimmingContainer=!0;initialize(e){let{totalRows:t}=e;this.count=t,this.endRow=this.count-1}process(){}finalize(){}}class sv{count=0;startRow=null;endRow=null;startPosition=null;isVisibleInTrimmingContainer=!1;initialize(){}process(e,t){let{totalCalculatedHeight:r,zeroBasedScrollOffset:n,innerViewportHeight:o}=t;r<=n&&(this.startRow=e),r>=n&&r<=o&&null===this.startRow&&(this.startRow=e),this.endRow=e}finalize(e){let{scrollOffset:t,viewportHeight:r,horizontalScrollbarHeight:n,totalRows:o,needReverse:i,positionCache:s,rowHeight:a}=e;if(s){if(this.endRow===o-1&&i)for(this.startRow=this.endRow;this.startRow>0;){let e=s.getOffset(this.endRow)+a-s.getOffset(this.startRow-1);if(this.startRow-=1,e>=r-n)break}this.startPosition=null!==this.startRow?s.getOffset(this.startRow):null,t+r-n<0||t>s.getOffset(e.lastProcessedIndex)+a?this.isVisibleInTrimmingContainer=!1:this.isVisibleInTrimmingContainer=!0,null!==this.endRow&&o<this.endRow&&(this.endRow=o-1),null!==this.startRow&&null!==this.endRow&&(this.count=this.endRow-this.startRow+1)}}}class sR extends sv{rowStartOffset=0;rowEndOffset=0;scrollOffset=0;finalize(e){super.finalize(e);let{overrideFn:t,totalRows:r,positionCache:n}=e;if(this.scrollOffset=e.zeroBasedScrollOffset,null!==this.startRow&&"function"==typeof t){let e=this.startRow,r=this.endRow;t(this),this.rowStartOffset=e-this.startRow,this.rowEndOffset=null!==this.endRow&&null!==r?this.endRow-r:0}null!==this.startRow&&this.startRow<0&&(this.startRow=0),this.startPosition=null!==this.startRow&&n?n.getOffset(this.startRow):null,null!==this.endRow&&r<this.endRow&&(this.endRow=r-1),null!==this.startRow&&null!==this.endRow&&(this.count=this.endRow-this.startRow+1)}}class sE{count=0;startRow=null;endRow=null;startPosition=null;isVisibleInTrimmingContainer=!1;initialize(){}process(e,t){let{totalCalculatedHeight:r,zeroBasedScrollOffset:n,innerViewportHeight:o,rowHeight:i}=t;r>=n&&r+i<=o&&(null===this.startRow&&(this.startRow=e),this.endRow=e)}finalize(e){let{scrollOffset:t,viewportHeight:r,horizontalScrollbarHeight:n,totalRows:o,needReverse:i,positionCache:s,rowHeight:a}=e;if(s){if(this.endRow===o-1&&i)for(this.startRow=this.endRow;this.startRow>0;){let e=s.getOffset(this.endRow)+a-s.getOffset(this.startRow-1);if(e<=r-n&&(this.startRow-=1),e>=r-n)break}this.startPosition=null!==this.startRow?s.getOffset(this.startRow):null,t+r-n<(null===this.startRow?0:e.getRowHeight(this.startRow))||t>s.getOffset(e.lastProcessedIndex)?this.isVisibleInTrimmingContainer=!1:this.isVisibleInTrimmingContainer=!0,null!==this.endRow&&o<this.endRow&&(this.endRow=o-1),null!==this.startRow&&null!==this.endRow&&(this.count=this.endRow-this.startRow+1)}}}class sT{count=0;startColumn=0;endColumn=0;startPosition=0;isVisibleInTrimmingContainer=!0;initialize(e){let{totalColumns:t}=e;this.count=t,this.endColumn=this.count-1}process(){}finalize(){}}class sA{count=0;startColumn=null;endColumn=null;startPosition=null;isVisibleInTrimmingContainer=!1;initialize(){}process(e,t){let{totalCalculatedWidth:r,zeroBasedScrollOffset:n,viewportWidth:o}=t;r<=n&&(this.startColumn=e),r>=n&&r<=n+(n>0?o+1:o)&&(null===this.startColumn||void 0===this.startColumn)&&(this.startColumn=e),this.endColumn=e}finalize(e){let{scrollOffset:t,viewportWidth:r,inlineStartOffset:n,zeroBasedScrollOffset:o,totalColumns:i,needReverse:s,positionCache:a,columnWidth:l}=e;if(a){if(this.endColumn===i-1&&s)for(this.startColumn=this.endColumn;this.startColumn>0;){let e=a.getOffset(this.endColumn)+l-a.getOffset(this.startColumn-1);if(this.startColumn-=1,e>r)break}this.startPosition=null!==this.startColumn?a.getOffset(this.startColumn):null,t+r-(o>0?r+1:r)<-1*n||t>a.getOffset(e.lastProcessedIndex)+l||-1*t-r>0?this.isVisibleInTrimmingContainer=!1:this.isVisibleInTrimmingContainer=!0,null!==this.endColumn&&i<this.endColumn&&(this.endColumn=i-1),null!==this.startColumn&&null!==this.endColumn&&(this.count=this.endColumn-this.startColumn+1)}}}class sM extends sA{columnStartOffset=0;columnEndOffset=0;scrollOffset=0;finalize(e){super.finalize(e);let{overrideFn:t,totalColumns:r,positionCache:n}=e;if(this.scrollOffset=e.zeroBasedScrollOffset,null!==this.startColumn&&"function"==typeof t){let e=this.startColumn,r=this.endColumn;t(this),this.columnStartOffset=e-this.startColumn,this.columnEndOffset=null!==this.endColumn&&null!==r?this.endColumn-r:0}null!==this.startColumn&&this.startColumn<0&&(this.startColumn=0),this.startPosition=null!==this.startColumn&&n?n.getOffset(this.startColumn):null,null!==this.endColumn&&r<this.endColumn&&(this.endColumn=r-1),null!==this.startColumn&&null!==this.endColumn&&(this.count=this.endColumn-this.startColumn+1)}}class sI{count=0;startColumn=null;endColumn=null;startPosition=null;isVisibleInTrimmingContainer=!1;initialize(){}process(e,t){let{totalCalculatedWidth:r,zeroBasedScrollOffset:n,viewportWidth:o,columnWidth:i}=t;r>=n&&r+i<=n+(n>0?o+1:o)&&((null===this.startColumn||void 0===this.startColumn)&&(this.startColumn=e),this.endColumn=e)}finalize(e){let{scrollOffset:t,viewportWidth:r,inlineStartOffset:n,zeroBasedScrollOffset:o,totalColumns:i,needReverse:s,positionCache:a,columnWidth:l}=e;if(!a)return;if(this.endColumn===i-1&&s)for(this.startColumn=this.endColumn;this.startColumn>0;){let e=a.getOffset(this.endColumn)+l-a.getOffset(this.startColumn-1);if(e<=r&&(this.startColumn-=1),e>=r)break}this.startPosition=null!==this.startColumn?a.getOffset(this.startColumn):null;let h=null===this.startColumn?0:e.getColumnWidth(this.startColumn);t+r-(o>0?r+1:r)<-1*n||t>a.getOffset(e.lastProcessedIndex)||-1*t-r>-1*h?this.isVisibleInTrimmingContainer=!1:this.isVisibleInTrimmingContainer=!0,null!==this.endColumn&&i<this.endColumn&&(this.endColumn=i-1),null!==this.startColumn&&null!==this.endColumn&&(this.count=this.endColumn-this.startColumn+1)}}function sx(e,t,r){let n=e>=0?t(e):NaN;return isNaN(n)?r:n}function sN(e,t){let r=0;for(;r<e;){let n=r+e>>>1;t(n)?r=n+1:e=n}return r}class sO{prefixSum=null;#eQ;#eZ;constructor(e,t){this.#eQ=e,this.#eZ=t}getOffset(e){return e<=0?0:Math.min(e,this.#eZ)*this.#eQ}findIndexAtOffset(e){return e<=0||0===this.#eZ?0:Math.min(Math.floor(e/this.#eQ),this.#eZ-1)}getSizeAt(e){return e<0||e>=this.#eZ?0:this.#eQ}getTotalSize(){return this.#eZ*this.#eQ}}class sk{prefixSum=null;#eJ;#eZ;#e0;#e1;#e2;constructor(e,t,r,n){const o=new Map;for(const i of Object.keys(e)){const s=Number(i);if(void 0!==e[s]&&s>=0&&s<t){const e=r(s);o.set(s,isNaN(e)?n:e)}}const i=Float64Array.from(o.keys()).sort();let s=t-1;for(;s>=0&&o.has(s);)s-=1;const a=sx(s,r,n),l=new Float64Array(i.length+1);for(let e=0;e<i.length;e++)l[e+1]=l[e]+(o.get(i[e])-a);this.#eJ=a,this.#eZ=t,this.#e0=i,this.#e1=l,this.#e2=o}getOffset(e){if(e<=0)return 0;let t=Math.min(e,this.#eZ);return t*this.#eJ+this.#e1[this.#e3(t)]}findIndexAtOffset(e){return e<=0||0===this.#eZ?0:Math.min(sN(this.#eZ,t=>this.getOffset(t+1)<=e),this.#eZ-1)}getSizeAt(e){return e<0||e>=this.#eZ?0:this.#e2.get(e)??this.#eJ}getTotalSize(){return this.#eZ*this.#eJ+this.#e1[this.#e1.length-1]}#e3(e){let t=this.#e0;return sN(t.length,r=>t[r]<e)}}class sH{prefixSum;#eZ;constructor(e,t,r){const n=new Float64Array(e+1);n[0]=0;for(let o=0;o<e;o++){const e=t(o);n[o+1]=n[o]+(isNaN(e)?r:e)}this.prefixSum=n,this.#eZ=e}getOffset(e){return e<=0?0:e>=this.#eZ?this.prefixSum[this.#eZ]:this.prefixSum[e]}findIndexAtOffset(e){return e<=0||0===this.#eZ?0:Math.min(sN(this.#eZ,t=>this.prefixSum[t+1]<=e),this.#eZ-1)}getSizeAt(e){return e<0||e>=this.#eZ?0:this.prefixSum[e+1]-this.prefixSum[e]}getTotalSize(){return this.prefixSum[this.#eZ]}}class s_{totalItems=0;#e6=null;#e5;#e4;#e9;#e7;#e8;#te;buildSeq=0;constructor({totalItemsFn:e,sizeFn:t,defaultSizeFn:r,isUniformFn:n,sparseExceptionsFn:o,onBuildFn:i}){this.#e5=e,this.#e4=t,this.#e9=r,this.#e7=n,this.#e8=o,this.#te=i}get prefixSum(){return this.#e6?.prefixSum??null}build(){let e=this.#e5(),t=this.#e4,r=this.#e9();if(this.totalItems=e,this.buildSeq+=1,this.#te?.(),this.#e7?.()){let n=sx(e-1,t,r);this.#e6=new sO(n,e);return}let n=this.#e8?.();if(n){this.#e6=new sk(n,e,t,r);return}this.#e6=new sH(e,t,r)}getOffset(e){return this.#e6?.getOffset(e)??0}findIndexAtOffset(e){return this.#e6?.findIndexAtOffset(e)??0}getSizeAt(e){return this.#e6?.getSizeAt(e)??0}getTotalSize(){return this.#e6?.getTotalSize()??0}ensureBuilt(){this.isCurrent()||this.build()}invalidate(){this.#e6=null,this.totalItems=0}isBuilt(){return null!==this.prefixSum}isCurrent(){return null!==this.#e6&&this.totalItems===this.#e5()}}function sL(e){let{geometryReader:t}=e.deps;if(e.isVerticallyScrollableByWindow()){let r=e.deps.rootDocument.documentElement;return t.scrollHeight(r)>t.clientHeight(r)}let{holder:r,hider:n}=e.wtTable,o=t.clientHeight(r),i=t.offsetHeight(n);return o<i||i>e.getWorkspaceHeight()}function sP(e){let{rootDocument:t,rootWindow:r,geometryReader:n}=e.deps,o=e.deps.getTopOverlay().trimmingContainer;return o===r?n.clientHeight(t.documentElement):n.outerHeight(o)>0&&n.clientHeight(o)>0?n.clientHeight(o):Math.max(n.clientHeight(t.documentElement),1)}function sD(e){let t,{rootDocument:r,rootWindow:n,geometryReader:o}=e.deps,i=e.deps.getInlineStartOverlay().trimmingContainer;if(i===n){let n=e.wtSettings.getSetting("totalColumns");t=o.offsetWidth(e.wtTable.holder),e.getRowHeaderWidth()+e.sumColumnWidths(0,n)>t&&(t=o.clientWidth(r.documentElement))}else t=o.clientWidth(i);return t}function sF(e,t){let{totalCount:r,zeroBasedScrollOffset:n,scrollEnd:o,positionCache:i,setSizeField:s,setTotalCalculated:a,getTotalCalculated:l}=t;e._initialize(e);let h=0;n>0&&r>0&&(h=i.findIndexAtOffset(n),a(e,i.getOffset(h)));let d=-1;for(let t=h;t<r;t++){let r=i.getSizeAt(t);if(s(e,r),e._process(t,e),d=t,a(e,l(e)+r),l(e)>=o){e.needReverse=!1;break}}e.lastProcessedIndex=d,e._finalize(e)}class sB{calculationTypes=[];calculationResults=new Map;constructor(e){this.calculationTypes=e}_initialize(e){this.calculationTypes.forEach(t=>{let[r,n]=t;this.calculationResults.set(r,n),n.initialize(e)})}_process(e,t){this.calculationTypes.forEach(r=>{let[,n]=r;return n.process(e,t)})}_finalize(e){this.calculationTypes.forEach(t=>{let[,r]=t;return r.finalize(e)})}getResultsFor(e){return this.calculationResults.get(e)}}class sV extends sB{viewportHeight=0;scrollOffset=0;zeroBasedScrollOffset=0;totalRows=0;rowHeight=0;overrideFn=null;horizontalScrollbarHeight=0;innerViewportHeight=0;totalCalculatedHeight=0;needReverse=!0;positionCache=null;lastProcessedIndex=-1;constructor({calculationTypes:e,viewportHeight:t,scrollOffset:r,totalRows:n,overrideFn:o,horizontalScrollbarHeight:i,rowHeightCache:s}){super(e),this.viewportHeight=t,this.scrollOffset=r,this.zeroBasedScrollOffset=Math.max(r,0),this.totalRows=n,this.overrideFn=o,this.horizontalScrollbarHeight=i??0,this.innerViewportHeight=this.zeroBasedScrollOffset+this.viewportHeight-this.horizontalScrollbarHeight,this.positionCache=s,this.calculate()}calculate(){this.positionCache&&sF(this,{totalCount:this.totalRows,zeroBasedScrollOffset:this.zeroBasedScrollOffset,scrollEnd:this.innerViewportHeight,positionCache:this.positionCache,setSizeField:(e,t)=>{e.rowHeight=t},setTotalCalculated:(e,t)=>{e.totalCalculatedHeight=t},getTotalCalculated:e=>e.totalCalculatedHeight})}getResultsFor(e){return this.calculationResults.get(e)}getRowHeight(e){return this.positionCache?.getSizeAt(e)??0}}class sU extends sB{viewportWidth=0;scrollOffset=0;zeroBasedScrollOffset=0;totalColumns=0;columnWidth=0;overrideFn=null;inlineStartOffset=0;totalCalculatedWidth=0;needReverse=!0;positionCache=null;lastProcessedIndex=-1;constructor({calculationTypes:e,viewportWidth:t,scrollOffset:r,totalColumns:n,overrideFn:o,inlineStartOffset:i,columnWidthCache:s}){super(e),this.viewportWidth=t,this.scrollOffset=r,this.zeroBasedScrollOffset=Math.max(r,0),this.totalColumns=n,this.overrideFn=o,this.inlineStartOffset=i,this.positionCache=s,this.calculate()}calculate(){this.positionCache&&sF(this,{totalCount:this.totalColumns,zeroBasedScrollOffset:this.zeroBasedScrollOffset,scrollEnd:this.zeroBasedScrollOffset+this.viewportWidth,positionCache:this.positionCache,setSizeField:(e,t)=>{e.columnWidth=t},setTotalCalculated:(e,t)=>{e.totalCalculatedWidth=t},getTotalCalculated:e=>e.totalCalculatedWidth})}getResultsFor(e){return this.calculationResults.get(e)}getColumnWidth(e){return this.positionCache?.getSizeAt(e)??0}}function sz(e,t,r,n,o){let i=Math.sign(e);if(0===i)if(t.startOffset>1)i=-1;else{if(!(t.endOffset>1))return null;i=1}let s=Math.min(Math.ceil(r.count/2),o),a=i>0?Math.min(s,n-1-r.end):Math.min(s,r.start);return a<=0?null:{side:i,extension:a}}function sW(e,t,r,n){let o=r-t;return o<=0?0:Math.max(0,Math.min(o,n-1-e))}function sG(e){return"scroll"===e?"scroll":"hidden"===e?"hidden":"auto"}function s$(e){let{geometryReader:t,wtSettings:r,rootDocument:n,rootWindow:o}=e,i=e.getWtViewport(),s=e.getWtTable(),a=e.getTopOverlay().trimmingContainer===o,l=r.getSetting("rtlMode"),h=t.getScrollbarWidth(n);i.rowHeightCache.ensureBuilt(),i.columnWidthCache.ensureBuilt();let d=i.getRowHeaderWidth(),u=i.getColumnHeaderHeight(),c=+!r.getSetting("externalRowCalculator"),g=d+i.columnWidthCache.getTotalSize(),p=u+i.rowHeightCache.getTotalSize()+c,m=a?n.documentElement:s.holder,f=sG(t.getStyle(m,"overflow-x")),b=sG(t.getStyle(m,"overflow-y"));if(a){let e=n.documentElement,r=t.clientWidth(e),o=t.clientHeight(e);return{scrollMode:"window",workspaceWidth:r,workspaceHeight:o,totalContentWidth:g,totalContentHeight:p,scrollbarSize:h,overflowX:f,overflowY:b,rowHeaderWidth:d,columnHeaderHeight:u,isRtl:l,windowContext:{documentScrollWidth:t.scrollWidth(e),documentScrollHeight:t.scrollHeight(e),documentClientWidth:r,documentClientHeight:o,currentHiderWidth:t.offsetWidth(s.hider),currentHiderHeight:t.offsetHeight(s.hider)}}}return{scrollMode:"element",workspaceWidth:sD(i),workspaceHeight:sP(i),totalContentWidth:g,totalContentHeight:p,scrollbarSize:h,overflowX:f,overflowY:b,rowHeaderWidth:d,columnHeaderHeight:u,isRtl:l}}function sY(e){let{hasVerticalScroll:t,hasHorizontalScroll:r}="window"===e.scrollMode?function(e){let t=e.windowContext;if(!t)return{hasVerticalScroll:!1,hasHorizontalScroll:!1};let r=t.documentScrollHeight-t.currentHiderHeight+e.totalContentHeight,n=t.documentScrollWidth-t.currentHiderWidth+e.totalContentWidth;return{hasVerticalScroll:"scroll"===e.overflowY||"hidden"!==e.overflowY&&r>t.documentClientHeight,hasHorizontalScroll:"scroll"===e.overflowX||"hidden"!==e.overflowX&&n>t.documentClientWidth}}(e):function(e){let{totalContentWidth:t,totalContentHeight:r,workspaceWidth:n,workspaceHeight:o,scrollbarSize:i}=e,s="scroll"===e.overflowY,a="scroll"===e.overflowX,l="hidden"===e.overflowY,h="hidden"===e.overflowX,d=s||!l&&r>o,u=a||!h&&t>n-(d?i:0);return!u||d||l||(d=r>o-i),{hasVerticalScroll:d,hasHorizontalScroll:u}}(e),{workspaceWidth:n,workspaceHeight:o,scrollbarSize:i}=e,s=n-(t?i:0),a=o-(r?i:0),l=n-e.rowHeaderWidth,h=o-e.columnHeaderHeight,d=s-e.rowHeaderWidth,u=a-e.columnHeaderHeight;return Object.freeze({scrollMode:e.scrollMode,hasVerticalScroll:t,hasHorizontalScroll:r,workspaceWidth:n,workspaceHeight:o,innerWidth:s,innerHeight:a,viewportWidth:d,viewportHeight:u,renderViewportWidth:l,renderViewportHeight:h,visibleViewportWidth:d,visibleViewportHeight:u,rowHeaderWidth:e.rowHeaderWidth,columnHeaderHeight:e.columnHeaderHeight,totalContentWidth:e.totalContentWidth,totalContentHeight:e.totalContentHeight,hiderWidth:e.totalContentWidth,hiderHeight:e.totalContentHeight,scrollbarSize:i,isRtl:e.isRtl})}class sj{#m;#tt;#tr=null;renderCycleSeq=0;#tn=-1;get deps(){return this.#m}constructor(e){const{wtSettings:t,wtTable:r,rowSizeSource:n,columnSizeSource:o}=e;this.#m=e,this.#tt=e.layoutDeps,this.wot=e.wot,this.wtSettings=t,this.wtTable=r,this.oversizedRows={},this.frozenOversizedRows=new Set,this.frozenClearRowCacheBuildSeq=0,this.hasOversizedColumnHeadersMarked={},this.clientHeight=0,this.rowHeaderWidth=NaN,this.rowsVisibleCalculator=null,this.columnsVisibleCalculator=null,this.rowsRenderCalculator=null,this.columnsRenderCalculator=null,this.rowsCalculatorTypes=new Map([["rendered",()=>this.wtSettings.getSetting("renderAllRows")?new sS:new sR],["fullyVisible",()=>new sE],["partiallyVisible",()=>new sv]]),this.columnsCalculatorTypes=new Map([["rendered",()=>this.wtSettings.getSetting("renderAllColumns")?new sT:new sM],["fullyVisible",()=>new sI],["partiallyVisible",()=>new sA]]),this.rowHeightCache=new s_({totalItemsFn:()=>t.getSetting("totalRows"),sizeFn:e=>r.getRowHeight(e)??NaN,defaultSizeFn:()=>n.getDefaultSize(),isUniformFn:()=>n.isUniform()&&0===Object.keys(this.oversizedRows).length,sparseExceptionsFn:()=>n.isUniform()?this.oversizedRows:null,onBuildFn:()=>{this.#tn=r.getFirstRenderedRow()}}),this.columnWidthCache=new s_({totalItemsFn:()=>t.getSetting("totalColumns"),sizeFn:e=>r.getColumnWidth(e),defaultSizeFn:()=>o.getDefaultSize(),isUniformFn:()=>o.isUniform()}),this.eventManager=e.eventManager,this.eventManager.addEventListener(this.#m.rootWindow,"resize",()=>{this.clientHeight=this.getWorkspaceHeight(),this.invalidateLayout()})}beginDrawLayout(){return this.#tr=sY(s$(this.#tt)),this.#tr}getLayout(){return null===this.#tr&&(this.#tr=sY(s$(this.#tt))),this.#tr}invalidateLayout(){this.#tr=null}sumRowHeights(e,t){let r=this.rowHeightCache;r.ensureBuilt();let n=r.getOffset(t)-r.getOffset(e);return new Set([this.#tn,this.wtTable.getFirstRenderedRow()]).forEach(o=>{if(o>=0&&o>=e&&o<t&&o<r.totalItems){let e=this.wtTable.getRowHeight(o),t=void 0===e?this.#m.rowSizeSource.getDefaultSize():e;n+=t-r.getSizeAt(o)}}),n}invalidateRowHeightCache(){this.rowHeightCache.invalidate(),this.invalidateLayout()}resetAllOversizedRows(){this.oversizedRows={},this.frozenOversizedRows.clear(),this.invalidateRowHeightCache()}releaseFrozenOversizedRows(){this.frozenOversizedRows.clear()}invalidateColumnWidthCache(){this.columnWidthCache.invalidate(),this.invalidateLayout()}invalidateAllCaches(){this.rowHeightCache.invalidate(),this.columnWidthCache.invalidate(),this.invalidateLayout()}resetHasOversizedColumnHeadersMarked(){tp(this.hasOversizedColumnHeadersMarked,(e,t,r)=>{r[t]=void 0})}}th(sj,{getWorkspaceHeight(){return this.usesLayoutSnapshotForCalculators()?this.getLayout().workspaceHeight:sP(this)},getViewportHeight(){let e=this.getWorkspaceHeight(),t=this.getColumnHeaderHeight();return t>0&&(e-=t),e},getWorkspaceWidth(){return this.usesLayoutSnapshotForCalculators()?this.getLayout().workspaceWidth:sD(this)},getViewportWidth(){let e=this.getWorkspaceWidth(),t=this.getRowHeaderWidth();return t>0?e-t:e},hasVerticalScroll(){return!this.wtSettings.getSetting("singlePassLayout")||this.isVerticallyScrollableByWindow()?sL(this):this.getLayout().hasVerticalScroll},hasHorizontalScroll(){return!this.wtSettings.getSetting("singlePassLayout")||this.isVerticallyScrollableByWindow()?function(e){let{geometryReader:t}=e.deps;if(e.isVerticallyScrollableByWindow()){let r=e.deps.rootDocument.documentElement;return t.scrollWidth(r)>t.clientWidth(r)}let{hider:r}=e.wtTable,n=t.offsetWidth(r),o=sL(e)?t.getScrollbarWidth():0;return n>sD(e)-o}(this):this.getLayout().hasHorizontalScroll},isVerticallyScrollableByWindow(){return this.deps.getTopOverlay().trimmingContainer===this.deps.rootWindow},isHorizontallyScrollableByWindow(){return this.deps.getInlineStartOverlay().trimmingContainer===this.deps.rootWindow},sumColumnWidths(e,t){let r=0,n=e;for(;n<t;)r+=this.wtTable.getColumnWidth(n),n+=1;return r},getWorkspaceOffset(){return this.deps.geometryReader.offset(this.wtTable.holder)},getColumnHeaderHeight(){return this.wtSettings.getSetting("columnHeaders").length?isNaN(this.columnHeaderHeight)&&(this.columnHeaderHeight=this.wtTable.THEAD?this.deps.geometryReader.outerHeight(this.wtTable.THEAD):0):this.columnHeaderHeight=0,this.columnHeaderHeight},getRowHeaderWidth(){let e=this.wtSettings.getSetting("rowHeaderWidth"),t=this.wtSettings.getSetting("rowHeaders");if(e){this.rowHeaderWidth=0;for(let r=0,n=t.length;r<n;r++){let t=Array.isArray(e)?e[r]:e;this.rowHeaderWidth+=t??NaN}}if(isNaN(this.rowHeaderWidth))if(t.length){let e=this.wtTable.TABLE.querySelector("TH");this.rowHeaderWidth=0;for(let r=0,n=t.length;r<n;r++)e?(this.rowHeaderWidth+=this.deps.geometryReader.outerWidth(e),e=e.nextSibling):this.rowHeaderWidth+=50}else this.rowHeaderWidth=0;return this.rowHeaderWidth=this.wtSettings.getSetting("onModifyRowHeaderWidth",this.rowHeaderWidth)||this.rowHeaderWidth,this.rowHeaderWidth}}),th(sj,{createRowsCalculator(){let e,t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["rendered","fullyVisible","partiallyVisible"],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"visible",{wtSettings:o,wtTable:i}=this,s=o.getSetting("totalRows"),a=this.usesLayoutSnapshotForCalculators(),l=0;if(a){let t=this.getLayout();e="render"===n?t.renderViewportHeight:t.visibleViewportHeight}else e=this.getViewportHeight();this.rowHeaderWidth=NaN;let h=this.deps.getTopOverlay(),d=this.deps.getBottomOverlay(),u=h.getScrollPosition()-h.getTableParentOffset(),c=o.getSetting("fixedRowsTop"),g=o.getSetting("fixedRowsBottom");if(c&&u>=0&&(u+=t=h.sumCellSizes(0,c),e-=t),g&&d.clone&&(e-=t=d.sumCellSizes(s-g,s)),!a){let{geometryReader:e}=this.deps;e.clientHeight(i.holder)!==e.offsetHeight(i.holder)&&(l=e.getScrollbarWidth(this.deps.rootDocument))}return new sV({calculationTypes:r.flatMap(e=>{let t=this.rowsCalculatorTypes.get(e);return t?[[e,t()]]:[]}),viewportHeight:e,scrollOffset:u,totalRows:s,overrideFn:o.getSettingPure("viewportRowCalculatorOverride"),horizontalScrollbarHeight:l,rowHeightCache:this.rowHeightCache})},createColumnsCalculator(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["rendered","fullyVisible","partiallyVisible"],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"visible",{wtSettings:n,wtTable:o}=this,i=this.deps.getInlineStartOverlay(),s=n.getSetting("totalColumns"),a=this.usesLayoutSnapshotForCalculators();if(a){let t=this.getLayout();e="render"===r?t.renderViewportWidth:t.visibleViewportWidth}else e=this.getViewportWidth();let l=Math.abs(i.getScrollPosition())-i.getTableParentOffset();this.columnHeaderHeight=NaN;let h=n.getSetting("fixedColumnsStart");if(h&&l>=0){let t=i.sumCellSizes(0,h);l+=t,e-=t}if(!a){let{geometryReader:t}=this.deps;t.clientWidth(o.holder)!==t.offsetWidth(o.holder)&&(e-=t.getScrollbarWidth(this.deps.rootDocument))}return new sU({calculationTypes:t.flatMap(e=>{let t=this.columnsCalculatorTypes.get(e);return t?[[e,t()]]:[]}),viewportWidth:e,scrollOffset:l,totalColumns:s,overrideFn:n.getSettingPure("viewportColumnCalculatorOverride"),inlineStartOffset:i.getTableParentOffset(),columnWidthCache:this.columnWidthCache})},createCalculators(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],{stationaryBands:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{wtSettings:r}=this,n=this.usesLayoutSnapshotForCalculators(),o=n?["fullyVisible","partiallyVisible"]:void 0,i=this.createRowsCalculator(o),s=this.createColumnsCalculator(o),a=n?this.createRowsCalculator(["rendered"],"render"):i,l=n?this.createColumnsCalculator(["rendered"],"render"):s;if(e&&!r.getSetting("renderAllRows")){let t=i.getResultsFor("fullyVisible"),r=i.getResultsFor("partiallyVisible");e=this.areAllProposedVisibleRowsAlreadyRendered(t,r)}if(e&&!r.getSetting("renderAllColumns")){let t=s.getResultsFor("fullyVisible"),r=s.getResultsFor("partiallyVisible");e=this.areAllProposedVisibleColumnsAlreadyRendered(t,r)}if(!e){let e=a.getResultsFor("rendered")??null,r=l.getResultsFor("rendered")??null;t&&(this.applyRenderedColumnsBandOverscan(r),this.applyRenderedRowsBandOverscan(e),this.stabilizeRenderedRowsBand(e),this.stabilizeRenderedColumnsBand(r)),this.rowsRenderCalculator=e,this.columnsRenderCalculator=r}return this.rowsVisibleCalculator=i.getResultsFor("fullyVisible")??null,this.columnsVisibleCalculator=s.getResultsFor("fullyVisible")??null,this.rowsPartiallyVisibleCalculator=i.getResultsFor("partiallyVisible")??null,this.columnsPartiallyVisibleCalculator=s.getResultsFor("partiallyVisible")??null,e},createVisibleCalculators(){let e=this.createRowsCalculator(["fullyVisible","partiallyVisible"]),t=this.createColumnsCalculator(["fullyVisible","partiallyVisible"]);this.rowsVisibleCalculator=e.getResultsFor("fullyVisible")??null,this.columnsVisibleCalculator=t.getResultsFor("fullyVisible")??null,this.rowsPartiallyVisibleCalculator=e.getResultsFor("partiallyVisible")??null,this.columnsPartiallyVisibleCalculator=t.getResultsFor("partiallyVisible")??null},usesLayoutSnapshotForCalculators(){return this.wtSettings.getSetting("singlePassLayout")&&!this.isVerticallyScrollableByWindow()&&!this.isHorizontallyScrollableByWindow()&&this.wtSettings.getSetting("rowHeightsUniform")&&this.wtSettings.getSetting("columnWidthsUniform")},allowsStationaryBands(){return this.wtSettings.getSetting("singlePassLayout")&&!this.isVerticallyScrollableByWindow()&&!this.isHorizontallyScrollableByWindow()},applyRenderedColumnsBandOverscan(e){let t=this.columnsRenderCalculator;if(!(e instanceof sM)||!(t instanceof sM)||null===e.startColumn||null===e.endColumn||!this.wtSettings.getSetting("viewportColumnRenderingOffsetIsAuto")||e.columnStartOffset>1||e.columnEndOffset>1||!this.wtSettings.getSetting("columnWidthsUniform"))return;let r=sz(e.scrollOffset-t.scrollOffset,{startOffset:t.columnStartOffset,endOffset:t.columnEndOffset},{start:e.startColumn,end:e.endColumn,count:e.count},this.wtSettings.getSetting("totalColumns"),8);r&&(r.side>0?(e.endColumn+=r.extension,e.count+=r.extension,e.columnEndOffset+=r.extension):(e.startColumn-=r.extension,e.count+=r.extension,e.columnStartOffset+=r.extension,e.startPosition=this.columnWidthCache.getOffset(e.startColumn)))},applyRenderedRowsBandOverscan(e){let t=this.rowsRenderCalculator;if(!(e instanceof sR)||!(t instanceof sR)||null===e.startRow||null===e.endRow||!this.wtSettings.getSetting("viewportRowRenderingOffsetIsAuto")||e.rowStartOffset>1||e.rowEndOffset>1||!this.wtSettings.getSetting("rowHeightsUniform"))return;let r=sz(e.scrollOffset-t.scrollOffset,{startOffset:t.rowStartOffset,endOffset:t.rowEndOffset},{start:e.startRow,end:e.endRow,count:e.count},this.wtSettings.getSetting("totalRows"),4);r&&(r.side>0?(e.endRow+=r.extension,e.count+=r.extension,e.rowEndOffset+=r.extension):(e.startRow-=r.extension,e.count+=r.extension,e.rowStartOffset+=r.extension,e.startPosition=this.rowHeightCache.getOffset(e.startRow)))},stabilizeRenderedRowsBand(e){let t=this.rowsRenderCalculator;if(!e||!t||null===e.endRow)return;let r=sW(e.endRow,e.count,t.count,this.wtSettings.getSetting("totalRows"));e.endRow+=r,e.count+=r},stabilizeRenderedColumnsBand(e){let t=this.columnsRenderCalculator;if(!e||!t||null===e.endColumn)return;let r=sW(e.endColumn,e.count,t.count,this.wtSettings.getSetting("totalColumns"));e.endColumn+=r,e.count+=r},areAllProposedVisibleRowsAlreadyRendered(e,t){if(!this.rowsVisibleCalculator||!this.rowsRenderCalculator||!e||!t)return!1;let{startRow:r,endRow:n}=e,{startRow:o,endRow:i}=t;if(null===r&&null===n){if(!e.isVisibleInTrimmingContainer&&null!==o&&!this.wtTable.isRowBeforeRenderedRows(o)&&null!==i&&!this.wtTable.isRowAfterRenderedRows(i))return!0;r=o,n=i}if(null===r||null===n)return!1;let{startRow:s,endRow:a,rowStartOffset:l,rowEndOffset:h}=this.rowsRenderCalculator;if(null===s||null===a)return!1;let d=this.wtSettings.getSetting("totalRows")-1,u=this.wtSettings.getSetting("viewportRowRenderingThreshold");return"number"==typeof u&&Number.isInteger(u)&&u>0?(r=Math.max(0,r-Math.min(l,u)),n=Math.min(d,n+Math.min(h,u))):"auto"===u&&(r=Math.max(0,r-Math.ceil(l/2)),n=Math.min(d,n+Math.ceil(h/2))),!(r<s)&&(r!==s||!(r>0))&&!(n>a)&&(n!==a||!(n<d))},areAllProposedVisibleColumnsAlreadyRendered(e,t){if(!this.columnsVisibleCalculator||!this.columnsRenderCalculator||!e||!t)return!1;let{startColumn:r,endColumn:n}=e,{startColumn:o,endColumn:i}=t;if(null===r&&null===n){if(!e.isVisibleInTrimmingContainer&&null!==o&&!this.wtTable.isColumnBeforeRenderedColumns(o)&&null!==i&&!this.wtTable.isColumnAfterRenderedColumns(i))return!0;r=o,n=i}if(null===r||null===n)return!1;let{startColumn:s,endColumn:a,columnStartOffset:l,columnEndOffset:h}=this.columnsRenderCalculator;if(null===s||null===a)return!1;let d=this.wtSettings.getSetting("totalColumns")-1,u=this.wtSettings.getSetting("viewportColumnRenderingThreshold");return"number"==typeof u&&Number.isInteger(u)&&u>0?(r=Math.max(0,r-Math.min(l,u)),n=Math.min(d,n+Math.min(h,u))):"auto"===u&&(r=Math.max(0,r-Math.ceil(l/2)),n=Math.min(d,n+Math.ceil(h/2))),!(r<s)&&(r!==s||!(r>0))&&!(n>a)&&(n!==a||!(n<d))}});class sq{#to=null;#ti=null;setActiveOverlay(e){return this.#ti=e,this}setActiveSelection(e){return this.#to=e,this}scan(){let e=this.#to.settings.selectionType,t=new Set;return"active-header"===e?(this.scanColumnsInHeadersRange(e=>t.add(e)),this.scanRowsInHeadersRange(e=>t.add(e))):"area"===e?this.scanCellsRange(e=>t.add(e)):"focus"===e?(this.scanColumnsInHeadersRange(e=>t.add(e)),this.scanRowsInHeadersRange(e=>t.add(e)),this.scanCellsRange(e=>t.add(e))):"fill"===e?this.scanCellsRange(e=>t.add(e)):"header"===e?(this.scanColumnsInHeadersRange(e=>t.add(e)),this.scanRowsInHeadersRange(e=>t.add(e))):"row"===e?(this.scanRowsInHeadersRange(e=>t.add(e)),this.scanRowsInCellsRange(e=>t.add(e))):"column"===e&&(this.scanColumnsInHeadersRange(e=>t.add(e)),this.scanColumnsInCellsRange(e=>t.add(e))),t}scanColumnsInHeadersRange(e){let[t,r,n,o]=this.#to.getCorners(),{wtTable:i}=this.#ti,s=i.getRenderedColumnsCount(),a=i.getColumnHeadersCount(),l=0;for(let h=-i.getRowHeadersCount();h<s;h++){let s=i.columnFilter.renderedToSource(h);if(!(s<r)&&!(s>o)){for(let h=-a;h<0;h++){if(h<t||h>n)continue;let d=h+a,u=i.getColumnHeader(s,d),c=this.#ti.getSetting("onBeforeHighlightingColumnHeader",s,d,{selectionType:this.#to.settings.selectionType,columnCursor:l,selectionWidth:o-r+1});null!==c&&(c!==s&&(u=i.getColumnHeader(c,d)),ne(u)&&e(u))}l+=1}}}scanRowsInHeadersRange(e){let[t,r,n,o]=this.#to.getCorners(),{wtTable:i}=this.#ti,s=i.getRenderedRowsCount(),a=i.getRowHeadersCount(),l=0;for(let h=-i.getColumnHeadersCount();h<s;h++){let s=i.rowFilter.renderedToSource(h);if(!(s<t)&&!(s>n)){for(let h=-a;h<0;h++){if(h<r||h>o)continue;let d=h+a,u=i.getRowHeader(s,d),c=this.#ti.getSetting("onBeforeHighlightingRowHeader",s,d,{selectionType:this.#to.settings.selectionType,rowCursor:l,selectionHeight:n-t+1});null!==c&&(c!==s&&(u=i.getRowHeader(c,d)),ne(u)&&e(u))}l+=1}}}scanCellsRange(e){let{wtTable:t}=this.#ti;this.#ts((r,n)=>{let o=t.getCell(this.#ti.createCellCoords(r,n));if(!ne(o))return;let i=this.#ti.getSetting("onAfterDrawSelection",r,n,this.#to.settings.layerLevel);"string"==typeof i&&rd(o,i),e(o)})}scanRowsInCellsRange(e){let[t,,r]=this.#to.getCorners(),{wtTable:n}=this.#ti;this.#ta((o,i)=>{if(o>=t&&o<=r){let t=n.getCell(this.#ti.createCellCoords(o,i));ne(t)&&e(t)}})}scanColumnsInCellsRange(e){let[,t,,r]=this.#to.getCorners(),{wtTable:n}=this.#ti;this.#ta((o,i)=>{if(i>=t&&i<=r){let t=n.getCell(this.#ti.createCellCoords(o,i));ne(t)&&e(t)}})}#ts(e){let[t,r,n,o]=this.#to.getCorners();if(t<0&&n<0||r<0&&o<0)return;let{wtTable:i}=this.#ti,s=t!==n||r!==o;if(r=Math.max(r??0,0),o=Math.max(o??0,0),t=Math.max(t??0,0),n=Math.max(n??0,0),s){if(r=Math.max(r,i.getFirstRenderedColumn()),o=Math.min(o,i.getLastRenderedColumn()),t=Math.max(t,i.getFirstRenderedRow()),n=Math.min(n,i.getLastRenderedRow()),o<r||n<t)return}else if(!ne(i.getCell(this.#ti.createCellCoords(t,r))))return;for(let i=t;i<=n;i+=1)for(let t=r;t<=o;t+=1)e(i,t)}#ta(e){let{wtTable:t}=this.#ti,r=t.getRenderedRowsCount(),n=t.getRenderedColumnsCount();for(let o=0;o<r;o+=1){let r=t.rowFilter.renderedToSource(o);for(let o=0;o<n;o+=1)e(r,t.columnFilter.renderedToSource(o))}}}let sK="active-header",sX="custom-selection",sQ="ht-border-style-",sZ=class{constructor(e,t){if(!t)return;this.eventManager=e.eventManager,this.wot=e,this.settings=t,this.mouseDown=!1,this.main=null,this.top=null,this.bottom=null,this.start=null,this.end=null,this.topStyle=null,this.bottomStyle=null,this.startStyle=null,this.endStyle=null,this.cornerDefaultStyle=se(this.wot),this.cornerCenterPointOffset=-Math.ceil(parseInt(String(this.cornerDefaultStyle.width),10)/2),this.corner=null,this.cornerStyle=null,this.createBorders(t),this.registerListeners()}registerListeners(){let e=this.wot.rootDocument.body;if(this.eventManager.addEventListener(e,"mousedown",()=>this.onMouseDown()),this.eventManager.addEventListener(e,"mouseup",()=>this.onMouseUp()),this.main)for(let e=0,t=this.main.childNodes.length;e<t;e++){let t=this.main,r=t.childNodes[e];this.eventManager.addEventListener(r,"mouseenter",r=>this.onMouseEnter(r,t.childNodes[e]))}}onMouseDown(){this.mouseDown=!0}onMouseUp(){this.mouseDown=!1}onMouseEnter(e,t){if(!this.mouseDown||!this.wot.getSetting("hideBorderOnMouseDownOver"))return;e.preventDefault(),nR(e);let r=this.wot.rootDocument.body,n=this.wot.domBindings.geometryReader.getBoundingClientRect(t);t.style.display="none";let o=e=>{(function(e){if(e.clientY<Math.floor(n.top)||e.clientY>Math.ceil(n.top+n.height)||e.clientX<Math.floor(n.left)||e.clientX>Math.ceil(n.left+n.width))return!0})(e)&&(this.eventManager.removeEventListener(r,"mousemove",o),t.style.display="block")};this.eventManager.addEventListener(r,"mousemove",o)}createBorders(e){let{rootDocument:t}=this.wot;this.main=t.createElement("div");let r=["top","start","bottom","end","corner"],n=this.main.style;n.position="absolute",n.top="0",n.left="0";let o=e.selectionType===sX,i=[];for(let s=0;s<5;s++){let a=r[s],l=t.createElement("div"),h=t=>{let r=this.settings[a];return r&&r[t]?r[t]:e.border?.[t]};l.className=`wtBorder ${this.settings.className||""}`,this.settings[a]?.hide&&(l.className+=" hidden"),n=l.style;let d=h("style");d?(["start","end"].includes(a)?l.className+=` ${sQ}${d}-vertical`:l.className+=` ${sQ}${d}-horizontal`,n.setProperty("--ht-custom-border-size",`${h("width")}px`),n.setProperty("--ht-custom-border-color",String(h("color")??""))):n.backgroundColor=String(h("color")??""),n.height=`${h("width")}px`,n.width=`${h("width")}px`,o&&(n.zIndex=`${h("width")??1}`),i.push(l),this.main.appendChild(l)}this.top=i[0],this.start=i[1],this.bottom=i[2],this.end=i[3],this.topStyle=this.top.style,this.startStyle=this.start.style,this.bottomStyle=this.bottom.style,this.endStyle=this.end.style,this.corner=i[4],this.corner.className+=" corner",this.cornerStyle=this.corner.style,this.cornerStyle.width=`${this.cornerDefaultStyle.width}px`,this.cornerStyle.height=`${this.cornerDefaultStyle.height}px`,this.cornerStyle.border=[`${this.cornerDefaultStyle.borderWidth}px`,this.cornerDefaultStyle.borderStyle,this.cornerDefaultStyle.borderColor].join(" "),tW()&&this.wot.getSetting("isDataViewInstance")&&this.createMultipleSelectorHandles(),this.disappear();let{wtTable:s}=this.wot,a=s.bordersHolder;a||((a=t.createElement("div")).className="htBorders",s.bordersHolder=a,s.spreader.appendChild(a)),a.appendChild(this.main)}createMultipleSelectorHandles(){let{rootDocument:e,wtSettings:t}=this.wot,r=t.getSetting("stylesHandler"),n=r.getCSSVariableValue("cell-mobile-handle-size"),o=r.getCSSVariableValue("cell-mobile-handle-border-radius"),i=r.getCSSVariableValue("cell-mobile-handle-background-color"),s=r.getCSSVariableValue("cell-mobile-handle-background-opacity"),a=r.getCSSVariableValue("cell-mobile-handle-border-width"),l=r.getCSSVariableValue("cell-mobile-handle-border-color");for(let t of(this.selectionHandles={top:e.createElement("div"),topHitArea:e.createElement("div"),bottom:e.createElement("div"),bottomHitArea:e.createElement("div"),styles:{}},this.selectionHandles.top.className="topSelectionHandle topLeftSelectionHandle",this.selectionHandles.topHitArea.className="topSelectionHandle-HitArea topLeftSelectionHandle-HitArea",this.selectionHandles.bottom.className="bottomSelectionHandle bottomRightSelectionHandle",this.selectionHandles.bottomHitArea.className="bottomSelectionHandle-HitArea bottomRightSelectionHandle-HitArea",this.selectionHandles.styles={top:this.selectionHandles.top.style,topHitArea:this.selectionHandles.topHitArea.style,bottom:this.selectionHandles.bottom.style,bottomHitArea:this.selectionHandles.bottomHitArea.style},[this.selectionHandles.styles.bottomHitArea,this.selectionHandles.styles.topHitArea]))t.position="absolute",t.height="40px",t.width="40px",t.borderRadius=`${parseInt(String(40/1.5),10)}px`;for(let e of[this.selectionHandles.styles.bottom,this.selectionHandles.styles.top])e.position="absolute",e.height=`${n}px`,e.width=`${n}px`,e.borderRadius=`${o}px`,e.background=`color-mix(in srgb, ${i} ${s}%, transparent)`,e.border=`${a}px solid ${l}`;this.main.appendChild(this.selectionHandles.top),this.main.appendChild(this.selectionHandles.bottom),this.main.appendChild(this.selectionHandles.topHitArea),this.main.appendChild(this.selectionHandles.bottomHitArea)}createAdjustHandles(){let{rootDocument:e}=this.wot,t=t=>{let r=e.createElement("div");return r.className=`wtSelectionHandle wtSelectionHandle--${t}`,r.style.display="none",this.main.appendChild(r),this.eventManager.addEventListener(r,"mousedown",e=>{nT(e)||(nR(e),e.preventDefault(),this.wot.getSetting("onSelectionHandleMouseDown",e,t))}),r},r=t("top"),n=t("bottom"),o=t("start"),i=t("end");return this.adjustHandles={top:r,bottom:n,start:o,end:i,styles:{top:r.style,bottom:n.style,start:o.style,end:i.style}},this.adjustHandles}createMoveZone(){let{rootDocument:e}=this.wot,t=t=>{let r=e.createElement("div");return r.className="wtMoveZone",r.style.position="absolute",r.style.display="none",r.style.zIndex="100",r.style.pointerEvents="auto",r.style.cursor="grab",this.main.appendChild(r),this.eventManager.addEventListener(r,"mousedown",e=>{nT(e)||(nR(e),e.preventDefault(),this.wot.getSetting("onSelectionEdgeMouseDown",e,t))}),r},r=t("top"),n=t("bottom"),o=t("start"),i=t("end");this.moveZone={top:r,bottom:n,start:o,end:i,styles:{top:r.style,bottom:n.style,start:o.style,end:i.style}}}positionMoveZone(e,t,r,n){let o=this.wot.wtSettings.getSetting("rtlMode")?"right":"left",i=this.moveZone.styles,s=Math.floor(3);i.top[o]=`${t}px`,i.top.top=`${e-s}px`,i.top.width=`${r}px`,i.top.height="6px",i.top.display="block",i.bottom[o]=`${t}px`,i.bottom.top=`${e+n-s}px`,i.bottom.width=`${r}px`,i.bottom.height="6px",i.bottom.display="block",i.start[o]=`${t-s}px`,i.start.top=`${e}px`,i.start.width="6px",i.start.height=`${n}px`,i.start.display="block",i.end[o]=`${t+r-s}px`,i.end.top=`${e}px`,i.end.width="6px",i.end.height=`${n}px`,i.end.display="block"}isSouthEastOfAreaSelection(e,t){let r=this.wot.selectionManager.getAreaSelection();if(!r)return!1;if(!r.cellRange)return!0;let n=r.cellRange.getBottomEndCorner();return n.row===e&&n.col===t}updateMultipleSelectionHandlesPosition(e,t,r,n,o,i){let s=this.wot.wtSettings.getSetting("rtlMode")?"right":"left",{top:a,topHitArea:l,bottom:h,bottomHitArea:d}=this.selectionHandles.styles,u=parseInt(a.borderWidth,10),c=parseInt(a.width,10),g=parseInt(l.width,10),p=this.wot.wtTable.getWidth(),m=this.wot.wtTable.getHeight();a.top=`${parseInt(String(r-c-1),10)}px`,a[s]=`${parseInt(String(n-c-1),10)}px`,l.top=`${parseInt(String(r-g/4*3),10)}px`,l[s]=`${parseInt(String(n-g/4*3),10)}px`;let f=Math.min(parseInt(String(n+o),10),p-c-2*u),b=Math.min(parseInt(String(n+o-g/4),10),p-g-2*u);h[s]=`${f}px`,d[s]=`${b}px`;let C=Math.min(parseInt(String(r+i),10),m-c-2*u),y=Math.min(parseInt(String(r+i-g/4),10),m-g-2*u);h.top=`${C}px`,d.top=`${y}px`;let w=this.settings.border?.cornerVisible;w&&"function"==typeof w&&w()?(a.display="block",l.display="block",this.isSouthEastOfAreaSelection(e,t)?(h.display="block",d.display="block"):(h.display="none",d.display="none")):(a.display="none",h.display="none",l.display="none",d.display="none"),e===this.wot.wtSettings.getSetting("fixedRowsTop")||t===this.wot.wtSettings.getSetting("fixedColumnsStart")?(a.zIndex="9999",l.zIndex="9999"):(a.zIndex="",l.zIndex="")}isFrozenBoundaryEdge(e,t){if("row"===e){let e=this.wot.getSetting("fixedRowsTop");return e>0&&t===e}let r=this.wot.getSetting("fixedColumnsStart");return r>0&&t===r}isFrozenStartBoundaryOppositeEdge(e,t){if("row"===e){let e=this.wot.getSetting("fixedRowsTop");return e>0&&t===e-1}let r=this.wot.getSetting("fixedColumnsStart");return r>0&&t===r-1}isBoundaryCornerScrolledOut(e,t){let r=this.wot.cloneSource?.wtTable;if(!r)return!1;let n="row"===e?r.getFirstVisibleRow():r.getFirstVisibleColumn();return n>=0&&t<n}isFrozenBottomBoundaryEdge(e){let t=this.wot.getSetting("fixedRowsBottom"),r=this.wot.getSetting("totalRows");return t>0&&e===r-t-1}isFrozenBottomBoundaryOppositeEdge(e){let t=this.wot.getSetting("fixedRowsBottom"),r=this.wot.getSetting("totalRows");return t>0&&e===r-t}isBottomBoundaryCornerScrolledOut(e){let t=this.wot.cloneSource?.wtTable;if(!t)return!1;let r=t.getLastVisibleRow();return r>=0&&e>r}drawFrozenBoundaryEdge(e){let{wtTable:t}=this.wot,r=t.name,n="top"===r,o="inline_start"===r,i="top_inline_start_corner"===r,s="bottom"===r,a="bottom_inline_start_corner"===r;if(!n&&!o&&!i&&!s&&!a)return!1;let l=this.wot.wtSettings.getSetting("rtlMode"),[h,d,u,c]=e,g=this.settings.border?.width??0,p=Math.ceil(g/2),m=this.isFrozenBoundaryEdge("row",h)&&!this.isBoundaryCornerScrolledOut("row",h),f=this.isFrozenBoundaryEdge("column",d)&&!this.isBoundaryCornerScrolledOut("column",d),b=this.isFrozenBottomBoundaryEdge(u)&&!this.isBottomBoundaryCornerScrolledOut(u);if(m&&(n||i)){let e=Math.max(d,t.getFirstRenderedColumn()),r=Math.min(c,t.getLastRenderedColumn());if(this.drawRowFreezeEdge(e,r,l,p))return!0}if(f&&(o||i||a)){let e=Math.max(h,t.getFirstRenderedRow()),r=Math.min(u,t.getLastRenderedRow());if(this.drawColumnFreezeEdge(e,r,l,p))return!0}if(b&&(s||a)){let e=Math.max(d,t.getFirstRenderedColumn()),r=Math.min(c,t.getLastRenderedColumn());if(this.drawRowFreezeBottomEdge(e,r,l,p))return!0}return!!(i&&m&&f&&this.drawFrozenBoundaryCorner(l,g)||a&&b&&f&&this.drawFrozenBottomBoundaryCorner(l,g))}drawHorizontalFreezeEdge(e,t,r,n,o,i,s){let{geometryReader:a}=this.wot.domBindings;if(n<r)return!1;let{wtTable:l}=this.wot,h=l.getCell(this.wot.createCellCoords(e,r)),d=l.getCell(this.wot.createCellCoords(e,n));if(!ne(h)||!ne(d))return!1;let u=a.offset(l.TABLE),c=a.offset(h),g=a.offset(d),p=+(0!==r);if(this.disappear(),t.top=`${s(h,c,u.top)}px`,o){let e=c.left+a.outerWidth(h),r=u.left+a.outerWidth(l.TABLE);t.right=`${r-e-p}px`,t.width=`${e-g.left+i-(1-p)}px`}else{t.left=`${c.left-u.left-p}px`;let e=g.left+a.outerWidth(d)-c.left+i-(1-p);t.width=`${e}px`}return t.display="block",!0}drawRowFreezeEdge(e,t,r,n){let o=this.wot.getSetting("fixedRowsTop")-1;return this.drawHorizontalFreezeEdge(o,this.topStyle,e,t,r,n,(e,t,r)=>t.top+this.wot.domBindings.geometryReader.outerHeight(e)-r-1)}drawRowFreezeBottomEdge(e,t,r,n){let o=this.wot.getSetting("fixedRowsBottom"),i=this.wot.getSetting("totalRows");return this.drawHorizontalFreezeEdge(i-o,this.bottomStyle,e,t,r,n,(e,t,r)=>t.top-r-parseInt(this.bottomStyle.height,10)+n)}drawColumnFreezeEdge(e,t,r,n){if(t<e)return!1;let{geometryReader:o}=this.wot.domBindings,{wtTable:i}=this.wot,s=this.wot.getSetting("fixedColumnsStart")-1,a=i.getCell(this.wot.createCellCoords(e,s)),l=i.getCell(this.wot.createCellCoords(t,s));if(!ne(a)||!ne(l))return!1;let h=o.offset(i.TABLE),d=o.offset(a),u=o.offset(l),c=0===e,g=d.top-h.top-1,p=u.top+o.outerHeight(l)-d.top+n;if(c&&(g+=1,p=Math.max(p-1,0)),this.disappear(),this.startStyle.top=`${g}px`,r){let e=h.left+o.outerWidth(i.TABLE);this.startStyle.right=`${e-d.left-1}px`}else{let e=d.left+o.outerWidth(a);this.startStyle.left=`${e-h.left-1}px`}return this.startStyle.height=`${p}px`,this.startStyle.display="block",!0}drawFreezeCorner(e,t,r,n,o){let{geometryReader:i}=this.wot.domBindings,{wtTable:s}=this.wot,a=this.wot.getSetting("fixedColumnsStart")-1,l=s.getCell(this.wot.createCellCoords(e,a));if(!ne(l))return!1;let h=i.offset(s.TABLE),d=i.offset(l);if(this.disappear(),t.top=`${o(l,d,h.top)}px`,t.height=`${n}px`,t.width=`${n}px`,r){let e=h.left+i.outerWidth(s.TABLE);t.right=`${e-d.left-1}px`}else{let e=d.left+i.outerWidth(l);t.left=`${e-h.left-1}px`}return t.display="block",!0}drawFrozenBoundaryCorner(e,t){let r=this.wot.getSetting("fixedRowsTop")-1;return this.drawFreezeCorner(r,this.topStyle,e,t,(e,t,r)=>t.top+this.wot.domBindings.geometryReader.outerHeight(e)-r-1)}drawFrozenBottomBoundaryCorner(e,t){let r=this.wot.getSetting("fixedRowsBottom"),n=this.wot.getSetting("totalRows"),o=Math.ceil(t/2);return this.drawFreezeCorner(n-r,this.bottomStyle,e,t,(e,r,n)=>r.top-n-t+o)}getFillHandleAnchor(e,t,r){let{geometryReader:n}=this.wot.domBindings;if(r){let{top:t,left:r}=n.getBoundingClientRect(e);return{top:t,left:r}}let o=n.offset(this.wot.wtTable.hider);return{top:t.top-o.top,left:t.left-o.left}}isCornerLiftedAtInlineEnd(e,t,r,n,o){if(e!==this.wot.getSetting("totalColumns")-1)return!1;let{geometryReader:i}=this.wot.domBindings,s=parseInt(String(this.cornerDefaultStyle.width),10)/2;return o?t-s<0:t+i.outerWidth(r)+s>=i.innerWidth(n)}isCornerLiftedAtBlockEnd(e,t,r,n){if(this.isFrozenBottomBoundaryEdge(e))return!0;if(e!==this.wot.getSetting("totalRows")-1)return!1;let{geometryReader:o}=this.wot.domBindings,i=parseInt(String(this.cornerDefaultStyle.height),10)/2;return t+o.outerHeight(r)+i>=o.innerHeight(n)}appear(e){let t;if(this.disabled||this.drawFrozenBoundaryEdge(e))return;let[r,n,o,i]=e,s=r,a=n,l=o,h=i;if(r<0&&o<0||n<0&&i<0)return void this.disappear();let{wtTable:d,rootDocument:u,rootWindow:c}=this.wot,{geometryReader:g}=this.wot.domBindings,p=r!==o||n!==i,m=d.getFirstRenderedRow(),f=d.getLastRenderedRow(),b=d.getFirstRenderedColumn(),C=d.getLastRenderedColumn();if(b<0&&C<0||m<0&&f<0)return void this.disappear();if(p){if(n=Math.max(n,b),i=Math.min(i,C),r=Math.max(r,m),o=Math.min(o,f),i<n||o<r||!ne(t=d.getCell(this.wot.createCellCoords(r,n))))return void this.disappear()}else if(!ne(t=d.getCell(this.wot.createCellCoords(r,n))))return void this.disappear();let y=p?d.getCell(this.wot.createCellCoords(o,i)):t,w=t,S=ne(y)?y:w,v=g.offset(w),R=p?g.offset(S):v,E=g.offset(d.TABLE),T=v.top,A=v.left,M=this.wot.wtSettings.getSetting("rtlMode"),I=0,x=0;if(M){let e=g.outerWidth(d.TABLE),t=g.outerWidth(w),r=c.innerWidth-E.left-e;x=A+t-R.left,I=c.innerWidth-A-t-r-1}else x=R.left+g.outerWidth(S)-A,I=A-E.left-1;if(this.isEntireColumnSelected(r,o)){let e=r,o=this.getDimensionsFromHeader("columns",n,i,e,E),s=null;o&&([s,I,x]=o),s&&(t=s)}let N=T-E.top-1,O=R.top+g.outerHeight(S)-T;if(this.isEntireRowSelected(n,i)){let e=n,i=this.getDimensionsFromHeader("rows",r,o,e,E),s=null;i&&([s,N,O]=i),s&&(t=s)}let k=g.getComputedStyle(w);parseInt(k.borderTopWidth,10)>0&&(N+=1,O=O>0?O-1:0),parseInt(k[M?"borderRightWidth":"borderLeftWidth"],10)>0&&(I+=1,x=x>0?x-1:0);let H=M?"right":"left",_=!this.settings.end?.hide,L=!this.settings.bottom?.hide,P=parseInt(this.bottomStyle.height,10),D=parseInt(this.endStyle.width,10),F=Math.ceil(P/2),B=Math.ceil(D/2),V=_?B:0,U=L?F:0;this.topStyle.top=`${N}px`,this.topStyle[H]=`${I}px`,this.topStyle.width=`${x+V}px`,this.topStyle.display="block",this.startStyle.top=`${N}px`,this.startStyle[H]=`${I}px`,this.startStyle.height=`${O+U}px`,this.startStyle.display="block",this.bottomStyle.top=`${N+O-P+F}px`,this.bottomStyle[H]=`${I}px`,this.bottomStyle.width=`${x+V}px`,this.bottomStyle.display="block",this.endStyle.top=`${N}px`,this.endStyle[H]=`${I+x-D+B}px`,this.endStyle.height=`${O+U}px`,this.endStyle.display="block";let z=d.name,W=h<this.wot.getSetting("fixedColumnsStart");this.isFrozenBoundaryEdge("row",s)&&("inline_start"===z||d.isMaster&&W)&&(this.topStyle.display="none"),this.isFrozenBoundaryEdge("column",a)&&(d.isMaster||"top"===z||"bottom"===z)&&(this.startStyle.display="none"),this.isFrozenBottomBoundaryEdge(l)&&("inline_start"===z||d.isMaster&&W)&&(this.bottomStyle.display="none");let G=this.settings.border?.cornerVisible;G="function"==typeof G?G(this.settings.layerLevel):G;let $=this.wot.getSetting("onModifyGetCellCoords",o,i,!1,"render"),[Y,j]=[o,i];if($&&Array.isArray($)&&([,,Y,j]=$),!tW()&&G&&this.isSouthEastOfAreaSelection(Y,j)){let e=Number(this.cornerDefaultStyle.borderWidth);this.cornerStyle.top=`${N+O+this.cornerCenterPointOffset-e}px`,this.cornerStyle[H]=`${I+x+this.cornerCenterPointOffset-Number(this.cornerDefaultStyle.borderWidth)}px`,this.cornerStyle.borderRightWidth=`${this.cornerDefaultStyle.borderWidth}px`,this.cornerStyle.borderLeftWidth=`${this.cornerDefaultStyle.borderWidth}px`,this.cornerStyle.borderBottomWidth=`${this.cornerDefaultStyle.borderWidth}px`,this.cornerStyle.width=String(this.cornerDefaultStyle.width),this.cornerStyle.display="none";let t=rL(d.TABLE),r=Object.is(t,c);r&&(t=u.documentElement);let n=parseInt(String(this.cornerDefaultStyle.borderWidth),10)-1,s=Math.ceil(parseInt(String(this.cornerDefaultStyle.width),10)/2),a=Math.ceil(parseInt(String(this.cornerDefaultStyle.height),10)/2),l=this.getFillHandleAnchor(S,R,r);if(this.isCornerLiftedAtInlineEnd(i,l.left,S,t,M)){let e=Math.floor(I+x+this.cornerCenterPointOffset-s-n);rd(this.corner,"wtCornerInlineEndEdge"),this.cornerStyle[H]=`${e-1}px`}else ru(this.corner,"wtCornerInlineEndEdge");if(this.isCornerLiftedAtBlockEnd(o,l.top,S,t)){let e=Math.floor(N+O+this.cornerCenterPointOffset-a-n);rd(this.corner,"wtCornerBlockEndEdge"),this.cornerStyle.top=`${e-1}px`}else ru(this.corner,"wtCornerBlockEndEdge");this.cornerStyle.display="block"}else this.cornerStyle.display="none";tW()&&this.wot.getSetting("isDataViewInstance")&&this.updateMultipleSelectionHandlesPosition(o,i,N,I,x,O);let q=this.settings.border?.adjustHandlesVisible;if(q="function"==typeof q?q(this.settings.layerLevel):q,!tW()&&q&&this.wot.getSetting("isDataViewInstance")){let t=this.adjustHandles??this.createAdjustHandles();this.positionAdjustHandles(N,I,x,O,e),(this.isFrozenBoundaryEdge("row",e[0])||this.isFrozenBottomBoundaryOppositeEdge(e[0]))&&(t.styles.top.display="none"),this.isFrozenBoundaryEdge("column",e[1])&&(t.styles.start.display="none"),(this.isFrozenStartBoundaryOppositeEdge("row",e[2])||this.isFrozenBottomBoundaryEdge(e[2]))&&(t.styles.bottom.display="none"),this.isFrozenStartBoundaryOppositeEdge("column",e[3])&&(t.styles.end.display="none")}else this.adjustHandles&&(this.adjustHandles.styles.top.display="none",this.adjustHandles.styles.bottom.display="none",this.adjustHandles.styles.start.display="none",this.adjustHandles.styles.end.display="none");let K=this.settings.border?.moveEnabled;K="function"==typeof K?K(this.settings.layerLevel):K,!tW()&&K&&this.wot.getSetting("isDataViewInstance")?(this.moveZone||this.createMoveZone(),this.positionMoveZone(N,I,x,O)):this.moveZone&&(this.moveZone.styles.top.display="none",this.moveZone.styles.bottom.display="none",this.moveZone.styles.start.display="none",this.moveZone.styles.end.display="none")}isEntireColumnSelected(e,t){return e===this.wot.wtTable.getFirstRenderedRow()&&t===this.wot.wtTable.getLastRenderedRow()}isEntireRowSelected(e,t){return e===this.wot.wtTable.getFirstRenderedColumn()&&t===this.wot.wtTable.getLastRenderedColumn()}getDimensionsFromHeader(e,t,r,n,o){let{geometryReader:i}=this.wot.domBindings,{wtTable:s}=this.wot,a=s.wtRootElement.parentNode,l=null,h=null,d=null,u=null,c=null,g=null,p=null;switch(e){case"rows":l=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return s.getRowHeader(t[0],t[1])},h=e=>i.outerHeight(e),d="ht__selection--rows",c="top";break;case"columns":l=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return s.getColumnHeader(t[0],t[1])},h=e=>i.outerWidth(e),d="ht__selection--columns",c="left"}if(d&&a.classList.contains(d)){let e=this.wot.getSetting("columnHeaders").length;if(g=l?.(t,e-n),p=l?.(r,e-n),!g||!p)return!1;let s=i.offset(g),a=i.offset(p),d=s[c],m=a[c];return[g,u=d-o[c]-1,m+h(p)-d]}return!1}positionAdjustHandles(e,t,r,n,o){let i=this.wot.wtSettings.getSetting("rtlMode")?"right":"left",[s,a,l,h]=o,d=this.wot.getSetting("totalRows")-1,u=this.wot.getSetting("totalColumns")-1,c=this.wot.wtSettings.getSetting("stylesHandler"),g=c.getCSSVariableValue("cell-selection-handle-size"),p=c.getCSSVariableValue("cell-selection-handle-length"),m=parseInt(null!=g?String(g):"8",10),f=parseInt(null!=p?String(p):"24",10),b=this.adjustHandles.styles;b.top.display="none",b.bottom.display="none",b.start.display="none",b.end.display="none",s>0&&(b.top[i]=`${t+Math.round(r/2)-Math.round(f/2)}px`,b.top.top=`${e-Math.round(m/2)}px`,b.top.display="block"),l<d&&(b.bottom[i]=`${t+Math.round(r/2)-Math.round(f/2)}px`,b.bottom.top=`${e+n-Math.round(m/2)}px`,b.bottom.display="block"),a>0&&(b.start[i]=`${t-Math.round(m/2)}px`,b.start.top=`${e+Math.round(n/2)-Math.round(f/2)}px`,b.start.display="block"),h<u&&(b.end[i]=`${t+r-Math.round(m/2)}px`,b.end.top=`${e+Math.round(n/2)-Math.round(f/2)}px`,b.end.display="block")}changeBorderStyle(e,t){let r=this[e],n=r.style,o=t[e];!o||o.hide?rd(r,"hidden"):(rh(r,"hidden")&&ru(r,"hidden"),n.backgroundColor=String(o.color??""),("top"===e||"bottom"===e)&&(n.height=`${o.width}px`),("start"===e||"end"===e)&&(n.width=`${o.width}px`))}changeBorderToDefaultStyle(e){let t=this[e].style;t.backgroundColor="#000",t.width="1px",t.height="1px"}toggleHiddenClass(e,t){this.changeBorderToDefaultStyle(e);let r=this[e];t?rd(r,"hidden"):ru(r,"hidden")}disappear(){this.topStyle.display="none",this.bottomStyle.display="none",this.startStyle.display="none",this.endStyle.display="none",this.cornerStyle.display="none",tW()&&this.wot.getSetting("isDataViewInstance")&&(this.selectionHandles.styles.top.display="none",this.selectionHandles.styles.topHitArea.display="none",this.selectionHandles.styles.bottom.display="none",this.selectionHandles.styles.bottomHitArea.display="none"),this.adjustHandles&&(this.adjustHandles.styles.top.display="none",this.adjustHandles.styles.bottom.display="none",this.adjustHandles.styles.start.display="none",this.adjustHandles.styles.end.display="none"),this.moveZone&&(this.moveZone.styles.top.display="none",this.moveZone.styles.bottom.display="none",this.moveZone.styles.start.display="none",this.moveZone.styles.end.display="none")}destroy(){this.eventManager.destroyWithOwnEventsOnly(),this.main?.parentNode?.removeChild(this.main)}};class sJ{#ti=null;#tl;#th=new sq;#td=new WeakMap;#tu=new WeakSet;#tc=new Map;constructor(e){this.#tl=e}setActiveOverlay(e){return this.#ti=e,this.#th.setActiveOverlay(this.#ti),this.#td.has(this.#ti)||this.#td.set(this.#ti,new Set),this}getFocusSelection(){return null!==this.#tl?this.#tl.getFocus():null}getAreaSelection(){return null!==this.#tl?this.#tl.createLayeredArea():null}getBorderInstance(e){if(!e.settings.border)return null;if(this.#tc.has(e)){let t=this.#tc.get(e);if(t.has(this.#ti))return t.get(this.#ti);let r=new sZ(this.#ti,e.settings);return t.set(this.#ti,r),r}let t=new sZ(this.#ti,e.settings);return this.#tc.set(e,new Map([[this.#ti,t]])),t}getBorderInstances(e){return Array.from(this.#tc.get(e)?.values()??[])}#tg(e){if(e.isEmpty())return!0;let{wtTable:t}=this.#ti,[r,n,o,i]=e.getCorners(),s=t.getFirstRenderedRow(),a=t.getLastRenderedRow(),l=t.getFirstRenderedColumn(),h=t.getLastRenderedColumn();return s<0&&a<0||l<0&&h<0||o<s||r>a||i<l||n>h}destroyBorders(e){this.#tc.get(e)?.forEach(e=>e.destroy()),this.#tc.delete(e)}refreshAllBorderHandleStyles(){this.#tc.forEach(e=>{e.forEach(e=>{"updateMultipleSelectorHandlesStyles"in e&&"function"==typeof e.updateMultipleSelectorHandlesStyles&&e.updateMultipleSelectorHandlesStyles()})})}render(e){if(null===this.#tl)return;e&&this.#tp();let t=Array.from(this.#tl),r=new Map,n=new Map;for(let e=0;e<t.length;e++){let o=t[e],{className:i,headerAttributes:s,createLayers:a,selectionType:l}=o.settings;if(this.#tu.has(o)||(this.#tu.add(o),o.addLocalHook("destroy",()=>this.destroyBorders(o))),l===sX&&this.#tg(o)){this.#tc.get(o)?.get(this.#ti)?.disappear();continue}let h=this.getBorderInstance(o);if(o.isEmpty()){h?.disappear();continue}if(i){let e=this.#th.setActiveSelection(o).scan(),t=l===sK;e.forEach(e=>{if(r.has(e)){let t=r.get(e);t.has(i)&&!0===a?t.set(i,(t.get(i)??0)+1):t.set(i,1)}else r.set(e,new Map([[i,1]]));s&&(n.has(e)||n.set(e,[]),"TH"===e.nodeName&&n.get(e).push(...s)),t&&this.#tm(e,i,r)})}let d=o.getCorners();l===sK&&i&&(this.#tf(d,i,r),this.#tb(d,i,r),this.#tC(d,i,r)),this.#ti.getSetting("onBeforeDrawBorders",d,l),h?.appear(d)}r.forEach((e,t)=>{let r=Array.from(e).map(e=>{let[t,r]=e;return 1===r?t:[t,...Array.from({length:r-1},(e,r)=>`${t}-${r+1}`)]}).flat();r.forEach(e=>this.#td.get(this.#ti)?.add(e)),rd(t,r),"TD"===t.nodeName&&Array.isArray(this.#tl.options?.cellAttributes)&&rc(t,this.#tl.options.cellAttributes)}),Array.from(n.keys()).forEach(e=>{rc(e,[...n.get(e)])})}#tm(e,t,r){if("TH"!==e.nodeName)return;let n=e.previousElementSibling;null!==n&&"TH"===n.nodeName&&this.#ty(r,n,`${t}-prev`),this.#tw(e,t,r)}#tw(e,t,r){let n=e.parentElement;if(null===n||"TR"!==n.nodeName||null===n.parentElement||"TBODY"!==n.parentElement.nodeName)return;let o=n.previousElementSibling;if(null!==o&&"TR"===o.nodeName)for(let e=0;e<o.children.length;e++){let n=o.children[e];if("TH"!==n.nodeName)break;this.#ty(r,n,`${t}-prev-row`)}}#ty(e,t,r){e.has(t)?e.get(t).set(r,1):e.set(t,new Map([[r,1]]))}#tf(e,t,r){let n=this.#ti,o=n.getSetting("fixedColumnsStart");if(o<=0)return;let{wtTable:i}=n;if(i.getLastRenderedColumn()!==o-1||Math.min(e[1],e[3])!==o)return;let s=`${t}-seam`,a=i.getColumnHeadersCount();for(let e=0;e<a;e++){let t=i.getColumnHeader(o-1,e);ne(t)&&this.#ty(r,t,s)}}#tb(e,t,r){let n=this.#ti,o=n.getSetting("fixedRowsTop");if(o<=0)return;let{wtTable:i}=n,s=o-1;if(i.getLastRenderedRow()!==s||Math.min(e[0],e[2])!==o)return;let a=`${t}-row-seam-top`,l=i.getRowHeadersCount();for(let e=0;e<l;e++){let t=i.getRowHeader(s,e);ne(t)&&"TH"===t.nodeName&&this.#ty(r,t,a)}}#tC(e,t,r){let n=this.#ti,o=n.getSetting("fixedRowsBottom");if(o<=0)return;let{wtTable:i}=n,s=n.getSetting("totalRows")-o;if(i.getFirstRenderedRow()!==s||Math.max(e[0],e[2])!==s-1)return;let a=`${t}-row-seam-bottom`,l=i.getRowHeadersCount();for(let e=0;e<l;e++){let t=i.getRowHeader(s,e);ne(t)&&"TH"===t.nodeName&&this.#ty(r,t,a)}}#tp(){let e=this.#td.get(this.#ti);if(!e)return;let t=this.#ti.wtSettings.getSetting("onBeforeRemoveCellClassNames");if(Array.isArray(t))for(let r=0;r<t.length;r++)e.add(t[r]);e.forEach(e=>{let t=this.#ti.wtTable.TABLE.querySelectorAll(`.${e}`),r=[];Array.isArray(this.#tl.options?.cellAttributes)&&(r=this.#tl.options.cellAttributes.map(e=>e[0])),Array.isArray(this.#tl.options?.headerAttributes)&&(r=[...r,...this.#tl.options.headerAttributes.map(e=>e[0])]);for(let n=0,o=t.length;n<o;n++)ru(t[n],e),rg(t[n],r)}),e.clear()}}class s0 extends i9{constructor(e,t){super(e,new sC(t)),this.wtTable=new sw(ij(this.engineContext)),this.wtViewport=new sj(function(e){return{wot:e.wot,rootDocument:e.rootDocument,rootWindow:e.rootWindow,geometryReader:e.geometryReader,rowSizeSource:e.rowSizeSource,columnSizeSource:e.columnSizeSource,layoutDeps:{geometryReader:e.geometryReader,wtSettings:e.wtSettings,rootDocument:e.rootDocument,rootWindow:e.rootWindow,getWtTable:e.getWtTable,getWtViewport:e.getWtViewport,getTopOverlay:e.getTopOverlay,getInlineStartOverlay:e.getInlineStartOverlay},wtSettings:e.wtSettings,eventManager:e.makeEventManager(),wtTable:e.getWtTable(),getTopOverlay:e.getTopOverlay,getInlineStartOverlay:e.getInlineStartOverlay,getBottomOverlay:e.getBottomOverlay}}(this.engineContext)),this.selectionManager=new sJ(this.wtSettings.getSetting("selections")),this.wtEvent=new ii(io(this.engineContext)),this.wtOverlays=new sb(function(e){return{wot:e.wot,wtSettings:e.wtSettings,rootDocument:e.rootDocument,rootWindow:e.rootWindow,geometryReader:e.geometryReader,eventManager:e.makeEventManager(),wtTable:e.getWtTable(),makeOverlayDeps:()=>({wot:e.wot,facadeGetter:e.getFacade(),wtSettings:e.wtSettings,rootDocument:e.rootDocument,rootWindow:e.rootWindow,geometryReader:e.geometryReader,getWtTable:e.getWtTable,getWtViewport:e.getWtViewport,getWtOverlays:e.getWtOverlays,getWtEvent:e.getWtEvent,getSelectionManager:e.getSelectionManager}),makeStickyScrollDeps:t=>({wtSettings:e.wtSettings,rootDocument:e.rootDocument,rootWindow:e.rootWindow,eventManager:t.eventManager,wtTable:e.getWtTable(),getWtViewport:e.getWtViewport,getTopOverlay:e.getTopOverlay,getBottomOverlay:e.getBottomOverlay,getInlineStartOverlay:e.getInlineStartOverlay,getScrollableElement:()=>t.scrollableElement,refreshAll:()=>t.refreshAll(),applyToDOM:()=>t.applyToDOM()}),makeResizeMonitorDeps:()=>({wtSettings:e.wtSettings,wtTable:e.getWtTable()}),makeSpreaderSizeDeps:t=>({wtSettings:e.wtSettings,rootWindow:e.rootWindow,geometryReader:e.geometryReader,wtTable:e.getWtTable(),getWtViewport:e.getWtViewport,getTopOverlay:e.getTopOverlay,getInlineStartOverlay:e.getInlineStartOverlay,getBottomOverlay:e.getBottomOverlay,getScrollableElement:()=>t.scrollableElement}),makeScrollSyncDeps:(t,r)=>({wtSettings:e.wtSettings,rootWindow:e.rootWindow,geometryReader:e.geometryReader,wtTable:e.getWtTable(),getWtViewport:e.getWtViewport,getTopOverlay:()=>t.topOverlay,getInlineStartOverlay:()=>t.inlineStartOverlay,getBottomOverlay:()=>t.bottomOverlay,eventManager:t.eventManager,getDestroyed:()=>t.destroyed,refreshAll:()=>t.refreshAll(),registerListeners:()=>t.registerListeners(),tryActivateStickyScroll:(e,t)=>r.tryActivate(e,t),syncStickyScrollOffsets:()=>r.syncOffsets()}),makeNativeScrollInputDeps:(t,r,n)=>({wtSettings:e.wtSettings,rootDocument:e.rootDocument,rootWindow:e.rootWindow,geometryReader:e.geometryReader,wtTable:e.getWtTable(),eventManager:t.eventManager,getTopOverlay:()=>t.topOverlay,getInlineStartOverlay:()=>t.inlineStartOverlay,getCloneableOverlays:()=>[t.topOverlay,t.bottomOverlay,t.inlineStartOverlay,t.topInlineStartCornerOverlay,t.bottomInlineStartCornerOverlay],getScrollableElement:()=>t.scrollableElement,syncScrollPositions:()=>t.syncScrollPositions(),scrollVertically:e=>t.scrollVertically(e),scrollHorizontally:e=>t.scrollHorizontally(e),registerStickyScrollListeners:()=>r.registerListeners(),resetResizeCount:()=>n.resetResizeCount(),observeResize:()=>n.observe()})}}(this.engineContext)),this.exportSettingsAsClassNames(),this.findOriginalHeaders()}exportSettingsAsClassNames(){let e=[],t=[];tp({rowHeaders:"htRowHeaders",columnHeaders:"htColumnHeaders"},(r,n)=>{this.wtSettings.getSetting(n).length&&t.push(r),e.push(r)}),ru(this.wtTable.wtRootElement.parentNode,e),rd(this.wtTable.wtRootElement.parentNode,t)}destroy(){this.wtTable.destroy(),super.destroy()}getOverlayByName(e){if(!id.includes(e))return null;let t=e.replace(/_([a-z])/g,(e,t)=>t.toUpperCase());return this.wtOverlays[`${t}Overlay`]??null}}class s1{constructor(e){e instanceof i9?this._wot=e:this._initFromSettings(e)}_initFromSettings(e){e.facade=e=>{let t=new s1(e);return()=>t},this._wot=new s0(e.table,e)}get guid(){return this._wot.guid}get rootDocument(){return this._wot.domBindings.rootDocument}get rootWindow(){return this._wot.domBindings.rootWindow}get wtSettings(){return this._wot.wtSettings}get cloneSource(){return this._wot.cloneSource}get cloneOverlay(){return this._wot.cloneOverlay}get selectionManager(){return this._wot.selectionManager}get wtViewport(){return this._wot.wtViewport}get wtOverlays(){return this._wot.wtOverlays}get wtTable(){return this._wot.wtTable}get wtEvent(){return this._wot.wtEvent}get wtScroll(){return this._wot.wtScroll}get drawn(){return this._wot.drawn}set drawn(e){this._wot.drawn=e}get activeOverlayName(){return this._wot.activeOverlayName}get drawInterrupted(){return this._wot.drawInterrupted}set drawInterrupted(e){this._wot.drawInterrupted=e}get lastMouseOver(){return this._wot.lastMouseOver}set lastMouseOver(e){this._wot.lastMouseOver=e}get momentumScrolling(){return this._wot.momentumScrolling}set momentumScrolling(e){this._wot.momentumScrolling=e}get touchApplied(){return this._wot.touchApplied}set touchApplied(e){this._wot.touchApplied=e}get domBindings(){return this._wot.domBindings}get eventListeners(){return this._wot.eventListeners}set eventListeners(e){this._wot.eventListeners=e}get eventManager(){return this._wot.eventManager}createCellCoords(e,t){return this._wot.createCellCoords(e,t)}createCellRange(e,t,r){return this._wot.createCellRange(e,t,r)}draw(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._wot.draw(e),this}getCell(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._wot.getCell(e,t)}scrollViewport(e,t,r){return this._wot.scrollViewport(e,t,r)}scrollViewportHorizontally(e,t){return this._wot.scrollViewportHorizontally(e,t)}scrollViewportVertically(e,t){return this._wot.scrollViewportVertically(e,t)}getViewport(){return this._wot.getViewport()}getOverlayName(){return this._wot.cloneOverlay?this._wot.cloneOverlay.type:"master"}getOverlayByName(e){return this._wot.getOverlayByName(e)}exportSettingsAsClassNames(){this._wot.exportSettingsAsClassNames()}update(e,t){return this._wot.wtSettings.update(e,t),this}getSetting(e,t,r,n,o){return this._wot.wtSettings.getSetting(e,t,r,n,o)}hasSetting(e){return this._wot.wtSettings.has(e)}destroy(){this._wot.destroy()}}function s2(e){let{isShiftKey:t,isLeftClick:r,isRightClick:n,coords:o,selection:i,controller:s,cellCoordsFactory:a}=e,l=i.isSelected()?i.getSelectedRange().current():null,h=i.isSelectedByCorner(),d=i.isSelectedByRowHeader();i.markSource("mouse");let u=o.row??-1,c=o.col??-1;if(t&&l)u>=0&&c>=0&&!s.cell?i.setRangeEnd(o):h&&u<0&&!s.column?i.setRangeEnd(a(l.to.row??0,c)):d&&c<0&&!s.row?i.setRangeEnd(a(u,l.to.col??0)):(!h&&!d&&c<0||h&&c<0)&&!s.row?i.selectRows(Math.max(l.from.row??0,0),u,c):(!h&&!d&&u<0||d&&u<0)&&!s.column&&i.selectColumns(Math.max(l.from.col??0,0),c,u);else{let e=!i.inInSelection(o),t=r||n&&e;u<0&&c>=0&&!s.column?t&&i.selectColumns(c,c,u):c<0&&u>=0&&!s.row?t&&i.selectRows(u,u,c):c>=0&&u>=0&&!s.cell?t&&i.setRangeStart(o):c<0&&u<0&&i.selectAll(!0,!0,{disableHeadersHighlight:!0,focusPosition:{row:0,col:0}})}i.markEndSource()}function s3(e){let{isLeftClick:t,coords:r,selection:n,controller:o,cellCoordsFactory:i}=e;if(!t)return;let s=n.isSelectedByRowHeader(),a=n.isSelectedByColumnHeader(),l=n.tableProps.countCols(),h=n.tableProps.countRows();n.markSource("mouse"),a&&!o.column?n.setRangeEnd(i(h-1,r.col??0)):s&&!o.row?n.setRangeEnd(i(r.row??0,l-1)):o.cell||n.setRangeEnd(r),n.markEndSource()}function s6(e){let{isLeftClick:t,selection:r,cellRangeMapper:n}=e;if(!t||"multiple"!==r.settings.selectionMode)return;let o=r.getSelectedRange(),i=o.clone().map(e=>n.toRenderable(e)),s=i.current();if(s&&i.size()>1&&!s.isHeader()&&!r.isMultiple(s)){let e=i.findAll(s).filter(e=>{let{layer:t}=e;return o.peekByIndex(t)?.isSingleCell()}).map(e=>{let{layer:t}=e;return t});if(e.length>=2)return void(e.length>=o.size()?r.deselect():(o.removeLayers(e),r.markSource("deselect"),r.refresh(),r.markEndSource()));r.markSource("deselect"),r.refresh(),r.markEndSource()}}let s5=new Map([["touchstart",s2],["touchend",s6],["mousedown",s2],["mouseover",s3],["mousemove",s3],["mouseup",s6]]);function s4(e,t){let r=s5.get(e.type);r&&r({isShiftKey:e.shiftKey,isLeftClick:nA(e)||"touchstart"===e.type,isRightClick:nT(e),...t})}let s9=new WeakMap,s7=Symbol("rootInstance");function s8(e){return s9.has(e)}function ae(e){return e.getSettings().sanitizer??!0}function at(e,t,r){if(!t)return t;let{sanitizer:n}=e.getSettings();return"function"==typeof n?n(t,r)??"":(rf.test(t)&&tJ(e.rootElement,rb,rC(r)),t)}function ar(e){return null==e||"number"==typeof e}class an{eventManager;settings;#tS=0;#tv=0;postponedAdjustElementsSize=!1;renderSizeProbe=new o8;#tR=!1;#tE=!1;#x=!1;#tT=!1;#tA=null;#tM=0;#tI=0;#tx=null;#tN=!1;#tO=null;constructor(e){this.hot=e,this.eventManager=new n5(this.hot),this.settings=this.hot.getSettings(),this.createElements(),this.registerEvents(),this.initializeWalkontable()}render(){if(!this.hot.isRenderSuspended()){let e=this.hot.forceFullRender;this.hot.runHooks("beforeRender",e),this.#tk(),this._wt.draw(!e),this.#tH(),this.postponedAdjustElementsSize&&(this.postponedAdjustElementsSize=!1,this.adjustElementsSize(!0)),this.hot.runHooks("afterRender",e),this.hot.forceFullRender=!1}}adjustElementsSize(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e?this._wt.wtOverlays.adjustElementsSize():this.postponedAdjustElementsSize=!0}getCellAtCoords(e,t){let r=this._wt.getCell(e,t);return"number"==typeof r&&r<0?null:r}scrollViewport(e,t,r){return this._wt.scrollViewport(e,t,r)}scrollViewportHorizontally(e,t){return this._wt.scrollViewportHorizontally(e,t)}scrollViewportVertically(e,t){return this._wt.scrollViewportVertically(e,t)}createElements(){let{rootElement:e,rootDocument:t}=this.hot,r=e.getAttribute("style");r&&(e.dataset.originalstyle=r),rd(e,"handsontable"),this.#tA=t.createElement("table"),rd(this.#tA,"htCore"),this.hot.getSettings().tableClassName&&rd(this.#tA,this.hot.getSettings().tableClassName),this.settings.ariaTags&&(rc(this.#tA,[R()]),rc(e,[["role","treegrid"],D(-1),F(this.hot.countCols()),["aria-multiselectable","true"]])),this.THEAD=t.createElement("thead"),this.#tA.appendChild(this.THEAD),this.TBODY=t.createElement("tbody"),this.#tA.appendChild(this.TBODY),this.hot.table=this.#tA,this.hot.container.insertBefore(this.#tA,this.hot.container.firstChild)}registerEvents(){let{rootWrapperElement:e,rootElement:t,rootDocument:r,selection:n,rootWindow:o}=this.hot,i=r.documentElement;this.eventManager.addEventListener(t,"mousedown",e=>{this.#t_(e)||!nM(e)&&(this.#tE=!0,this.isTextSelectionAllowed(t4(e))||(rj(o),e.preventDefault(),o.focus()))}),this.eventManager.addEventListener(t,"mouseup",e=>{this.#t_(e)||(this.#tE=!1)}),this.eventManager.addEventListener(t,"mousemove",e=>{this.#tE&&!this.isTextSelectionAllowed(t4(e))&&(this.settings.fragmentSelection&&rj(o),e.preventDefault())}),this.eventManager.addEventListener(i,"keyup",e=>{n.isInProgress()&&!e.shiftKey&&n.finish()}),this.eventManager.addEventListener(i,"mouseup",o=>{n.isInProgress()&&nA(o)&&n.finish();let i=this.#x,s=this.#tT;if(this.#x=!1,this.#tT=!1,this.#t_(o))return;let a=ni(r),l=ne(a)?a:null,h=null!==l&&r3(l);if(null!==l&&r2(l)&&!h)return;let d=o.composedPath(),u=d.includes(e??t)||this.hot.rootPortalElement&&d.includes(this.hot.rootPortalElement),c=this.hot.getFocusManager().isForeignFocusTarget(l)||!i&&!this.hot.getFocusManager().hasBrowserFocus()&&!u;if(!h&&!c&&(n.isSelected()||n.isSelectedByAnyHeader()||this.#tL(d)||nT(o))||this.hot.unlisten(),!s&&null!==l&&c&&n.isSelected()&&!this.#tL(d)&&!nT(o)){let e=d.length>0?d[0]:o.target,t=ne(e)?e:l;("function"==typeof this.settings.outsideClickDeselects?this.settings.outsideClickDeselects(t):this.settings.outsideClickDeselects)&&this.hot.deselectCell()}}),this.eventManager.addEventListener(i,"contextmenu",e=>{n.isInProgress()&&nT(e)&&(n.finish(),this.#x=!1)}),this.eventManager.addEventListener(i,"touchend",()=>{n.isInProgress()&&n.finish(),this.#x=!1,this.#tN=!0,null!==this.#tO&&clearTimeout(this.#tO),this.#tO=this.hot._registerTimeout(()=>{this.#tN=!1,this.#tO=null},500)}),this.eventManager.addEventListener(i,"mousedown",e=>{let n=e.composedPath(),o=n.length>0?n[0]:e.target,i=e.clientX,s=e.clientY;if(this.#tT=!1,this.#x||!t||!this.hot.view||this.#t_(e))return;let{holder:a}=this._wt.wtTable;if(o===a){let e=rX(r),n=t.getRootNode(),o=nn(n)?n:r;if(o.elementFromPoint(i+e,s)!==a||o.elementFromPoint(i,s+e)!==a)return}else if(this.#tL(n))return;this.#tT=!0,("function"==typeof this.settings.outsideClickDeselects?this.settings.outsideClickDeselects(o):this.settings.outsideClickDeselects)?this.hot.deselectCell():this.hot.destroyEditor(!1,!1)});let s=t7(o);for(;null!==s;)this.eventManager.addEventListener(s.document.documentElement,"click",()=>{this.hot.unlisten()}),s=t7(s);this.eventManager.addEventListener(this.#tA,"selectstart",e=>{this.settings.fragmentSelection||r2(t4(e))||e.preventDefault()})}invalidateIndexSizesCache(){this._wt.wtViewport.invalidateRowHeightCache(),this._wt.wtViewport.invalidateColumnWidthCache()}invalidateColumnWidthCache(){this._wt.wtViewport.invalidateColumnWidthCache()}invalidateRowHeightCache(){this._wt.wtViewport.invalidateRowHeightCache()}translateFromRenderableToVisualCoords(e){let{row:t,col:r}=e;return this.hot._createCellCoords(...this.translateFromRenderableToVisualIndex(t,r))}translateFromRenderableToVisualIndex(e,t){let r=e>=0?this.hot.rowIndexMapper.getVisualFromRenderableIndex(e):e,n=t>=0?this.hot.columnIndexMapper.getVisualFromRenderableIndex(t):t;return[null===r?e:r,null===n?t:n]}countRenderableIndexes(e,t){let r=Math.min(e.getNotTrimmedIndexesLength(),t),n=e.getNearestNotHiddenIndex(r-1,-1);return null===n?0:(e.getRenderableFromVisualIndex(n)??0)+1}countRenderableColumns(){return this.countRenderableIndexes(this.hot.columnIndexMapper,this.settings.maxCols)}countRenderableRows(){return this.countRenderableIndexes(this.hot.rowIndexMapper,this.settings.maxRows)}countNotHiddenRowIndexes(e,t){return this.countNotHiddenIndexes(e,t,this.hot.rowIndexMapper,this.countRenderableRows())}countNotHiddenColumnIndexes(e,t){return this.countNotHiddenIndexes(e,t,this.hot.columnIndexMapper,this.countRenderableColumns())}countNotHiddenIndexes(e,t,r,n){if(isNaN(e)||e<0)return 0;let o=r.getNearestNotHiddenIndex(e,t<0?-1:1),i=r.getRenderableFromVisualIndex(o);if(null===i||!Number.isInteger(i))return 0;let s=0;return t<0?s=i+1:t>0&&(s=n-i),s}countNotHiddenFixedColumnsStart(){let e=this.hot.countCols(),t=Math.min(Number(this.settings.fixedColumnsStart)||0,e)-1;return this.countNotHiddenColumnIndexes(t,-1)}countNotHiddenFixedRowsTop(){let e=this.hot.countRows(),t=Math.min(Number(this.settings.fixedRowsTop)||0,e)-1;return this.countNotHiddenRowIndexes(t,-1)}countNotHiddenFixedRowsBottom(){let e=Math.max(this.hot.countRows()-(Number(this.settings.fixedRowsBottom)||0),0);return this.countNotHiddenRowIndexes(e,1)}countRenderableColumnsInRange(e,t){let r=0;for(let n=e;n<=t;n++)null!==this.hot.columnIndexMapper.getRenderableFromVisualIndex(n)&&(r+=1);return r}countRenderableRowsInRange(e,t){let r=0;for(let n=e;n<=t;n++)null!==this.hot.rowIndexMapper.getRenderableFromVisualIndex(n)&&(r+=1);return r}isMainTableNotFullyCoveredByOverlays(){let e=this.countNotHiddenFixedRowsTop()+this.countNotHiddenFixedRowsBottom(),t=this.countNotHiddenFixedColumnsStart();return this.hot.countRenderedRows()>e&&this.hot.countRenderedCols()>t}initializeWalkontable(){let e={ariaTags:this.settings.ariaTags,rtlMode:this.hot.isRtl(),externalRowCalculator:this.hot.getPlugin("autoRowSize")&&this.hot.getPlugin("autoRowSize").isEnabled(),singlePassLayout:()=>this.hot.runHooks("modifySinglePassLayout",!0),table:this.#tA,isDataViewInstance:()=>s8(this.hot),preventOverflow:()=>this.settings.preventOverflow,preventWheel:()=>this.settings.preventWheel,viewportColumnRenderingThreshold:()=>this.settings.viewportColumnRenderingThreshold,viewportRowRenderingThreshold:()=>this.settings.viewportRowRenderingThreshold,viewportColumnRenderingOffsetIsAuto:()=>"auto"===this.settings.viewportColumnRenderingOffset,viewportRowRenderingOffsetIsAuto:()=>"auto"===this.settings.viewportRowRenderingOffset,data:(e,t)=>{let[r,n]=this.translateFromRenderableToVisualIndex(e,t);return this.hot.getDataAtCell(r,n)},totalRows:()=>this.countRenderableRows(),totalColumns:()=>this.countRenderableColumns(),fixedColumnsStart:()=>this.countNotHiddenFixedColumnsStart(),fixedRowsTop:()=>this.countNotHiddenFixedRowsTop(),fixedRowsBottom:()=>this.countNotHiddenFixedRowsBottom(),shouldRenderInlineStartOverlay:()=>(this.settings.fixedColumnsStart??0)>0||e.rowHeaders().length>0,shouldRenderTopOverlay:()=>(this.settings.fixedRowsTop??0)>0||e.columnHeaders().length>0,shouldRenderBottomOverlay:()=>(this.settings.fixedRowsBottom??0)>0,minSpareRows:()=>this.settings.minSpareRows,renderAllRows:this.settings.renderAllRows,renderAllColumns:this.settings.renderAllColumns,rowHeaders:()=>{let e=[];return this.hot.hasRowHeaders()&&e.push((e,t)=>{let r=e>=0?this.hot.rowIndexMapper.getVisualFromRenderableIndex(e):e;this.appendRowHeader(r,t)}),this.hot.runHooks("afterGetRowHeaderRenderers",e),this.#tv=e.length,this.hot.getSettings().ariaTags&&this.#tP()===this.hot.countCols()&&this.#tD(this.#tv),e},columnHeaders:()=>{let e=[];return this.hot.hasColHeaders()&&e.push((e,t)=>{let r=e>=0?this.hot.columnIndexMapper.getVisualFromRenderableIndex(e):e;this.appendColHeader(r,t)}),this.hot.runHooks("afterGetColumnHeaderRenderers",e),this.#tS=e.length,e},columnWidth:e=>{let t=this.hot.columnIndexMapper.getVisualFromRenderableIndex(e);return this.hot.getColWidth(null===t?e:t)},rowHeight:e=>{let t=this.hot.rowIndexMapper.getVisualFromRenderableIndex(e);return this.hot.getRowHeight(null===t?e:t)},rowHeightByOverlayName:(e,t)=>{let r=this.hot.rowIndexMapper.getVisualFromRenderableIndex(e),n=null===r?e:r;return this.hot.runHooks("modifyRowHeightByOverlayName",this.hot.getRowHeight(n),n,t)},rowHeightsUniform:()=>{let{rowHeights:e,minRowHeights:t}=this.hot.getSettings();return ar(e)&&ar(t)&&!this.hot.hasHook("modifyRowHeight")},columnWidthsUniform:()=>ar(this.hot.getSettings().colWidths)&&!this.hot.hasHook("modifyColWidth"),cellRenderer:(e,t,r)=>{let[n,o]=this.translateFromRenderableToVisualIndex(e,t),i=this.hot.runHooks("modifyGetCellCoords",n,o,!1,"meta"),s=n,a=o;Array.isArray(i)&&([s,a]=i);let l=this.hot.getCellMeta(s,a),h=this.hot.colToProp(a),d=this.hot.getDataAtRowProp(s,h);this.hot.hasHook("beforeValueRender")&&(d=this.hot.runHooks("beforeValueRender",d,l));let u=this.hot.getCellRenderer(l),c=o9(d,l,u);this.hot.runHooks("beforeRenderer",r,n,o,h,d,l),o7(u,[this.hot,r,n,o,h,c,l]),this.hot.runHooks("afterRenderer",r,n,o,h,d,l)},selections:this.hot.selection.highlight,hideBorderOnMouseDownOver:()=>this.settings.fragmentSelection,onWindowResize:()=>{this.hot&&!this.hot.isDestroyed&&this.hot.refreshDimensions()},onContainerElementResize:()=>{this.hot&&!this.hot.isDestroyed&&rv(this.hot.rootElement)&&this.hot.refreshDimensions()},onCellMouseDown:(e,t,r,n)=>{let o=this.translateFromRenderableToVisualCoords(t),i={row:!1,column:!1,cell:!1};this.hot.listen(),this.activeWt=n,this.#x=!0,this.#tx={row:e.clientX,col:e.clientY},this.hot.runHooks("beforeOnCellMouseDown",e,o,r,i),nE(e)||(s4(e,{coords:o,selection:this.hot.selection,controller:i,cellCoordsFactory:(e,t)=>this.hot._createCellCoords(e,t)}),this.hot.runHooks("afterOnCellMouseDown",e,o,r),this.activeWt=this._wt)},onCellContextMenu:(e,t,r,n)=>{let o=this.translateFromRenderableToVisualCoords(t);this.activeWt=n,this.#x=!1,this.hot.selection.isInProgress()&&this.hot.selection.finish(),this.hot.runHooks("beforeOnCellContextMenu",e,o,r),nE(e)||(this.hot.runHooks("afterOnCellContextMenu",e,o,r),this.activeWt=this._wt)},onCellMouseOut:(e,t,r,n)=>{let o=this.translateFromRenderableToVisualCoords(t);this.activeWt=n,this.hot.runHooks("beforeOnCellMouseOut",e,o,r),nE(e)||(this.hot.runHooks("afterOnCellMouseOut",e,o,r),this.activeWt=this._wt)},onCellMouseOver:(e,t,r,n)=>{let o=this.translateFromRenderableToVisualCoords(t),i={row:!1,column:!1,cell:!1};this.activeWt=n,this.hot.runHooks("beforeOnCellMouseOver",e,o,r,i),nE(e)||(this.#x&&(!this.#tx||this.#tx.row!==e.clientX||this.#tx.col!==e.clientY)&&s4(e,{coords:o,selection:this.hot.selection,controller:i,cellCoordsFactory:(e,t)=>this.hot._createCellCoords(e,t)}),this.hot.runHooks("afterOnCellMouseOver",e,o,r),this.activeWt=this._wt,this.#tx=null)},onCellMouseOverOutside:(e,t,r,n)=>{let o=this.translateFromRenderableToVisualCoords(t),i={row:!1,column:!1,cell:!1};this.activeWt=n,this.hot.runHooks("beforeOnCellMouseOverOutside",e,o,r,i),nE(e)||(s4(e,{coords:o,selection:this.hot.selection,controller:i,cellCoordsFactory:(e,t)=>this.hot._createCellCoords(e,t)}),this.hot.runHooks("afterOnCellMouseOverOutside",e,o,r),this.activeWt=this._wt,this.#tx=null)},onCellMouseUp:(e,t,r,n)=>{let o=this.translateFromRenderableToVisualCoords(t);if(this.activeWt=n,this.hot.runHooks("beforeOnCellMouseUp",e,o,r),!nE(e)&&!this.hot.isDestroyed){var i;s4(e,{coords:o,selection:this.hot.selection,cellRangeMapper:(i=this.hot,nV?.get(i.guid)?.get("cellRangeMapper"))}),this.hot.runHooks("afterOnCellMouseUp",e,o,r),this.activeWt=this._wt}},onCellCornerMouseDown:e=>{e.preventDefault(),this.hot.runHooks("afterOnCellCornerMouseDown",e)},onCellCornerDblClick:e=>{e.preventDefault(),this.hot.runHooks("afterOnCellCornerDblClick",e)},onSelectionHandleMouseDown:(e,t)=>{this.hot.runHooks("afterOnSelectionHandleMouseDown",e,t)},onSelectionEdgeMouseDown:(e,t)=>{this.hot.runHooks("afterOnSelectionEdgeMouseDown",e,t)},beforeDraw:(e,t)=>this.beforeRender(e,t),onDraw:e=>this.afterRender(e),onBeforeViewportScrollVertically:(e,t)=>{let r=this.hot.rowIndexMapper,n=e<0,o=e;if(!n){let t=r.getVisualFromRenderableIndex(e);if(null===t)return e;o=t}return(o=this.hot.runHooks("beforeViewportScrollVertically",o,t),this.hot.runHooks("beforeViewportScroll"),n)?o:r.getRenderableFromVisualIndex(o)},onBeforeViewportScrollHorizontally:(e,t)=>{let r=this.hot.columnIndexMapper,n=e<0,o=e;if(!n){let t=r.getVisualFromRenderableIndex(e);if(null===t)return e;o=t}return(o=this.hot.runHooks("beforeViewportScrollHorizontally",o,t),this.hot.runHooks("beforeViewportScroll"),n)?o:r.getRenderableFromVisualIndex(o)},onScrollVertically:()=>{this.hot.runHooks("afterScrollVertically"),this.hot.runHooks("afterScroll")},onScrollHorizontally:()=>{this.hot.runHooks("afterScrollHorizontally"),this.hot.runHooks("afterScroll")},onBeforeRemoveCellClassNames:()=>this.hot.runHooks("beforeRemoveCellClassNames"),onBeforeHighlightingRowHeader:(e,t,r)=>{let n=this.hot.rowIndexMapper,o=e<0,i=e;o||(i=n.getVisualFromRenderableIndex(e)??e);let s=this.hot.runHooks("beforeHighlightingRowHeader",i,t,r);return o?s:n.getRenderableFromVisualIndex(n.getNearestNotHiddenIndex(s,1))},onBeforeHighlightingColumnHeader:(e,t,r)=>{let n=this.hot.columnIndexMapper,o=e<0,i=e;o||(i=n.getVisualFromRenderableIndex(e)??e);let s=this.hot.runHooks("beforeHighlightingColumnHeader",i,t,r);return o?s:n.getRenderableFromVisualIndex(n.getNearestNotHiddenIndex(s,1))},onAfterDrawSelection:(e,t,r)=>{let n,[o,i]=this.translateFromRenderableToVisualIndex(e,t),s=this.hot.selection.getSelectedRange();if(s.size()>0){let e=s.peekByIndex(r??0);n=[e.from.row,e.from.col,e.to.row,e.to.col]}return this.hot.runHooks("afterDrawSelection",o,i,n,r)},onBeforeDrawBorders:(e,t)=>{let[r,n,o,i]=e,s=[this.hot.rowIndexMapper.getVisualFromRenderableIndex(r),this.hot.columnIndexMapper.getVisualFromRenderableIndex(n),this.hot.rowIndexMapper.getVisualFromRenderableIndex(o),this.hot.columnIndexMapper.getVisualFromRenderableIndex(i)];return this.hot.runHooks("beforeDrawBorders",s,t)},onBeforeTouchScroll:()=>this.hot.runHooks("beforeTouchScroll"),onAfterMomentumScroll:()=>this.hot.runHooks("afterMomentumScroll"),onModifyRowHeaderWidth:e=>this.hot.runHooks("modifyRowHeaderWidth",e),onModifyGetCellCoords:(e,t,r,n)=>{let o=this.hot.rowIndexMapper,i=this.hot.columnIndexMapper,s=t>=0?i.getVisualFromRenderableIndex(t):t,a=e>=0?o.getVisualFromRenderableIndex(e):e,l=this.hot.runHooks("modifyGetCellCoords",a,s,r,n);if(Array.isArray(l)){let[e,t,r,n]=l;return[e>=0?o.getRenderableFromVisualIndex(o.getNearestNotHiddenIndex(e,1)):e,t>=0?i.getRenderableFromVisualIndex(i.getNearestNotHiddenIndex(t,1)):t,r>=0?o.getRenderableFromVisualIndex(o.getNearestNotHiddenIndex(r,-1)):r,n>=0?i.getRenderableFromVisualIndex(i.getNearestNotHiddenIndex(n,-1)):n]}},onModifyGetCoordsElement:(e,t)=>{let r=this.hot.rowIndexMapper,n=this.hot.columnIndexMapper,o=t>=0?n.getVisualFromRenderableIndex(t):t,i=e>=0?r.getVisualFromRenderableIndex(e):e,s=this.hot.runHooks("modifyGetCoordsElement",i,o);if(Array.isArray(s)){let[e,t]=s;return[e>=0?r.getRenderableFromVisualIndex(r.getNearestNotHiddenIndex(e,1)):e,t>=0?n.getRenderableFromVisualIndex(n.getNearestNotHiddenIndex(t,1)):t]}},viewportRowCalculatorOverride:e=>{let t="auto"===this.settings.viewportRowRenderingOffset?1:this.settings.viewportRowRenderingOffset;if((t??0)>0){let r=this.countRenderableRows(),n=e.startRow,o=e.endRow;e.startRow=Math.max(n-(t??0),0),e.endRow=Math.min(o+(t??0),r-1)}this.hot.runHooks("afterViewportRowCalculatorOverride",e)},viewportColumnCalculatorOverride:e=>{let t="auto"===this.settings.viewportColumnRenderingOffset?1:this.settings.viewportColumnRenderingOffset;if((t??0)>0){let r=this.countRenderableColumns(),n=e.startColumn,o=e.endColumn;e.startColumn=Math.max(n-(t??0),0),e.endColumn=Math.min(o+(t??0),r-1)}this.hot.runHooks("afterViewportColumnCalculatorOverride",e)},rowHeaderWidth:()=>this.settings.rowHeaderWidth,columnHeaderHeight:()=>{let e=this.hot.runHooks("modifyColumnHeaderHeight"),t=this.settings.columnHeaderHeight,r=this.renderSizeProbe.columnHeaderHeights,n=Math.max(Array.isArray(t)?t.length:0,r.size?Math.max(...r.keys())+1:0);if(0===n)return t||e;let o=[];for(let i=0;i<n;i++){let n,s=Array.isArray(t)?t[i]:t;"number"==typeof s?n=s:"number"==typeof e&&(n=e);let a=r.get(i),l=[];"number"==typeof n&&l.push(n),"number"==typeof a&&l.push(a),o[i]=l.length?Math.max(...l):void 0}return o},stylesHandler:()=>this.hot.stylesHandler};this.hot.runHooks("beforeInitWalkontable",e),this._wt=new s1(e),this.activeWt=this._wt;let t=this._wt.wtTable.spreader,{width:r,height:n}=this.hot.rootElement.getBoundingClientRect();this.setLastSize(r,n),this.eventManager.addEventListener(t,"mousedown",e=>{e.target===t&&3===e.which&&e.stopPropagation()}),this.eventManager.addEventListener(t,"contextmenu",e=>{e.target===t&&3===e.which&&e.stopPropagation()}),this.eventManager.addEventListener(this.hot.rootDocument.documentElement,"click",()=>{this.settings.observeDOMVisibility&&this._wt.drawInterrupted&&this.hot.render()})}isTextSelectionAllowed(e){if(r2(e))return!0;let t=rn(e,this._wt.wtTable.spreader);if(!0===this.settings.fragmentSelection&&t)return!0;let r=this.hot.getSelectedRangeActive()?.isSingleCell()??!1;return!!("cell"===this.settings.fragmentSelection&&r&&t||!this.settings.fragmentSelection&&this.isCellEdited()&&r)}isMouseDown(){return this.#x}#t_(e){return ie(e)??this.#tN}#tL(e){let{rootElement:t,rootPortalElement:r}=this.hot;return!!(e.includes(t)||r&&e.includes(r))||!e.some(e=>nn(e))&&no(t).some(t=>e.includes(t))}isCellEdited(){let e=this.hot.getActiveEditor();return e?.isOpened()}beforeRender(e,t){e&&this.hot.runHooks("beforeViewRender",this.hot.forceFullRender,t)}#tk(){this.hot.stylesHandler.recacheValuesMeasuredWithoutStyles()&&(this.#tR=!0),this.#tR&&(this._wt.wtViewport.resetAllOversizedRows(),this.invalidateColumnWidthCache())}afterRender(e){if(this.#tR=!1,e){this.renderSizeProbe.measure(this._wt);let e=this.hot.stylesHandler.getDefaultRowHeight()??0;this.renderSizeProbe.hasColumnHeaderTallerThan(e)&&this._wt.wtOverlays.refreshColumnHeaderHeights(),this.hot.runHooks("afterViewRender",this.hot.forceFullRender)}}appendRowHeader(e,t){if(t.firstChild){let r=t.firstChild;if(!rh(r,"relative")){rm(t),this.appendRowHeader(e,t);return}this.updateCellHeader(r.querySelector(".rowHeader"),e,this.hot.getRowHeader)}else{let{rootDocument:r,getRowHeader:n}=this.hot,o=r.createElement("div"),i=r.createElement("span");o.className="relative",i.className="rowHeader",this.updateCellHeader(i,e,n),o.appendChild(i),t.appendChild(o)}this.hot.runHooks("afterGetRowHeader",e,t)}appendColHeader(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.hot.getColHeader,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=()=>{let t=e>=0?this.hot.getColumnMeta(e).headerClassName:null;return t?(Array.isArray(t)?t:t.split(" ")).flatMap(e=>e.split(" ")).filter(e=>e.length>0):[]};if(t.firstChild){let i=t.firstChild;rh(i,"relative")?(this.updateCellHeader(i.querySelector(".colHeader"),e,r,n),i.className="",rd(i,["relative",...o()])):(rm(t),this.appendColHeader(e,t,r,n))}else{let{rootDocument:i}=this.hot,s=i.createElement("div"),a=i.createElement("span"),l=o();s.classList.add("relative",...l),a.className="colHeader",this.settings.ariaTags&&(rc(s,[R()]),rc(a,[R()])),this.updateCellHeader(a,e,r,n),s.appendChild(a),t.appendChild(s)}this.hot.runHooks("afterGetColHeader",e,t,n)}updateCellHeader(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=t,i=this._wt.wtOverlays.getParentOverlay(e)||this._wt;e.parentNode&&(rh(e,"colHeader")?o=i.wtTable.columnFilter.sourceToRendered(t):rh(e,"rowHeader")&&(o=i.wtTable.rowFilter.sourceToRendered(t))),o>-1?rw(e,String(r(t,n)),ae(this.hot),"header",this.hot.rootElement):(rS(e,String.fromCharCode(160)),rd(e,"cornerHeader"))}maximumVisibleElementWidth(e){let t=this._wt.wtViewport.getWorkspaceWidth()-e;return t>0?t:0}maximumVisibleElementHeight(e){let t=this._wt.wtViewport.getWorkspaceHeight()-e;return t>0?t:0}setLastSize(e,t){this.#tM=e,this.#tI=t}getLastSize(){return{width:this.#tM,height:this.#tI}}getFirstRenderedVisibleRow(){if(!this._wt.wtViewport.rowsRenderCalculator)return null;let e=this.hot.rowIndexMapper,t=e.getVisualFromRenderableIndex(this._wt.wtTable.getFirstRenderedRow());return e.getNearestNotHiddenIndex(t??0,1)}getLastRenderedVisibleRow(){if(!this._wt.wtViewport.rowsRenderCalculator)return null;let e=this.hot.rowIndexMapper,t=e.getVisualFromRenderableIndex(this._wt.wtTable.getLastRenderedRow());return e.getNearestNotHiddenIndex(t??this.hot.countRows()-1,-1)}getFirstRenderedVisibleColumn(){if(!this._wt.wtViewport.columnsRenderCalculator)return null;let e=this.hot.columnIndexMapper,t=e.getVisualFromRenderableIndex(this._wt.wtTable.getFirstRenderedColumn());return e.getNearestNotHiddenIndex(t??0,1)}getLastRenderedVisibleColumn(){if(!this._wt.wtViewport.columnsRenderCalculator)return null;let e=this.hot.columnIndexMapper,t=e.getVisualFromRenderableIndex(this._wt.wtTable.getLastRenderedColumn());return e.getNearestNotHiddenIndex(t??this.hot.countCols()-1,-1)}getFirstFullyVisibleRow(){return this.hot.rowIndexMapper.getVisualFromRenderableIndex(this._wt.wtScroll.getFirstVisibleRow())}getLastFullyVisibleRow(){return this.hot.rowIndexMapper.getVisualFromRenderableIndex(this._wt.wtScroll.getLastVisibleRow())}getFirstFullyVisibleColumn(){return this.hot.columnIndexMapper.getVisualFromRenderableIndex(this._wt.wtScroll.getFirstVisibleColumn())}getLastFullyVisibleColumn(){return this.hot.columnIndexMapper.getVisualFromRenderableIndex(this._wt.wtScroll.getLastVisibleColumn())}getFirstPartiallyVisibleRow(){return this.hot.rowIndexMapper.getVisualFromRenderableIndex(this._wt.wtScroll.getFirstPartiallyVisibleRow())}getLastPartiallyVisibleRow(){return this.hot.rowIndexMapper.getVisualFromRenderableIndex(this._wt.wtScroll.getLastPartiallyVisibleRow())}getFirstPartiallyVisibleColumn(){return this.hot.columnIndexMapper.getVisualFromRenderableIndex(this._wt.wtScroll.getFirstPartiallyVisibleColumn())}getLastPartiallyVisibleColumn(){return this.hot.columnIndexMapper.getVisualFromRenderableIndex(this._wt.wtScroll.getLastPartiallyVisibleColumn())}getColumnHeadersCount(){return this.#tS}getRowHeadersCount(){return this.#tv}getViewportWidth(){return this._wt.wtViewport.getViewportWidth()}getWorkspaceWidth(){return this._wt.wtViewport.getWorkspaceWidth()}getViewportHeight(){return this._wt.wtViewport.getViewportHeight()}getWorkspaceHeight(){return this._wt.wtViewport.getWorkspaceHeight()}getElementOverlayName(e){return(this._wt.wtOverlays.getParentOverlay(e)??this._wt).wtTable.name}getOverlayByName(e){return this._wt.getOverlayByName(e)}getActiveOverlayName(){return this._wt.activeOverlayName}isVisible(){return this._wt.wtTable.isVisible()}hasVerticalScroll(){return this._wt.wtViewport.hasVerticalScroll()}hasHorizontalScroll(){return this._wt.wtViewport.hasHorizontalScroll()}getTableWidth(){return this._wt.wtTable.getWidth()}getTableHeight(){return this._wt.wtTable.getHeight()}getTotalTableWidth(){return this._wt.wtTable.getTotalWidth()}getTotalTableHeight(){return this._wt.wtTable.getTotalHeight()}getTableOffset(){return this._wt.wtViewport.getWorkspaceOffset()}getTableScrollPosition(){return{left:this._wt.wtTable.holder.scrollLeft,top:this._wt.wtTable.holder.scrollTop}}setTableScrollPosition(e){this._wt.wtTable.holder.scrollLeft=e.left,this._wt.wtTable.holder.scrollTop=e.top}getRowHeaderWidth(){return this._wt.wtViewport.getRowHeaderWidth()}getColumnHeaderHeight(){return this._wt.wtViewport.getColumnHeaderHeight()}isVerticallyScrollableByWindow(){return this._wt.wtViewport.isVerticallyScrollableByWindow()}isHorizontallyScrollableByWindow(){return this._wt.wtViewport.isHorizontallyScrollableByWindow()}#tP(){return parseInt(this.hot.rootElement.getAttribute("aria-colcount")??"0",10)}#tD(e){let t=this.#tP()+e;rc(this.hot.rootElement,[F(t)])}#tH(){let e=this.hot.rootElement;this.hasVerticalScroll()?rd(e,"htHasScrollY"):ru(e,"htHasScrollY"),this.isVerticallyScrollableByWindow()?rd(e,"htVerticallyScrollableByWindow"):ru(e,"htVerticallyScrollableByWindow"),this.hasHorizontalScroll()?rd(e,"htHasScrollX"):ru(e,"htHasScrollX"),this.isHorizontallyScrollableByWindow()?rd(e,"htHorizontallyScrollableByWindow"):ru(e,"htHorizontallyScrollableByWindow"),0===rX()?rd(e,"htScrollbarHidden"):ru(e,"htScrollbarHidden")}destroy(){this._wt.destroy(),this.eventManager.destroy()}}let ao="ABCDEFGHIJKLMNOPQRSTUVWXYZ",ai=ao.length;function as(e){let t,r=e+1,n="";for(;r>0;)n=String.fromCharCode(65+(t=(r-1)%ai))+n,r=parseInt(String((r-t)/ai),10);return n}function aa(e){let t=0;if(e)for(let r=0,n=e.length-1;r<e.length;r+=1,n-=1)t+=ai**n*(ao.indexOf(e[r])+1);return t-1}function al(){let e,t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4,o=[];for(e=0;e<r;e++){let r=[];for(t=0;t<n;t++)r.push(as(t)+(e+1));o.push(r)}return o}function ah(){let e,t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4,o=[];for(e=0;e<r;e++){let r={};for(t=0;t<n;t++)r[`prop${t}`]=as(t)+(e+1);o.push(r)}return o}function ad(e,t){let r,n=[];for(let o=0;o<e;o++){r=[];for(let e=0;e<t;e++)r.push("");n.push(r)}return n}function au(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=e,n=[];return Array.isArray(e)&&Array.isArray(e[0])||(r=[e]),r.forEach((e,r)=>{Array.isArray(e)?e.forEach((e,o)=>{n.push([r+t,o,e])}):Object.keys(e).forEach(o=>{n.push([r+t,o,e[o]])})}),n}function ac(e,t,r){return e.some(e=>{let[n,o]=e;return n===t&&o===r})}function ag(e){let t=0;return Array.isArray(e)&&(e[0]&&Array.isArray(e[0])?t=e[0].length:e[0]&&tc(e[0])&&(t=tb(e[0]))),t}function ap(e){return!!(Array.isArray(e)&&e.length&&e.every(e=>Array.isArray(e)))}function am(e){return!!(Array.isArray(e)&&e.length&&e.every(e=>"object"==typeof e&&!Array.isArray(e)&&null!==e))}function af(e){return Array.isArray(e)?e.slice():null!==e&&"object"==typeof e?{...e}:e}let ab={_localHooks:Object.create(null),addLocalHook(e,t){return this._localHooks[e]||(this._localHooks[e]=[]),this._localHooks[e].push(t),this},removeLocalHook(e,t){if(this._localHooks[e]){let r=this._localHooks[e].indexOf(t);r>-1&&this._localHooks[e].splice(r,1)}return this},runLocalHooks(e,t,r,n,o,i,s){if(this._localHooks[e]){let a=this._localHooks[e].length;for(let l=0;l<a;l++)nm(this._localHooks[e][l],this,t,r,n,o,i,s)}},clearLocalHooks(){return this._localHooks={},this}};tg(ab,"MIXIN_NAME","localHooks",{writable:!1,enumerable:!1});class aC{indexedValues=[];initValueOrFn;#tF;constructor(e=null,{skipUnchangedWrites:t=!1}={}){this.initValueOrFn=e,this.#tF=t}get skipUnchangedWrites(){return this.#tF}getValues(e){return this.indexedValues}getValueAtIndex(e){let t=this.indexedValues;if(e<t.length)return t[e]}setValues(e){this.indexedValues=e.slice(),this.runLocalHooks("change")}setValueAtIndex(e,t){return!!(e<this.indexedValues.length)&&(!!this.skipUnchangedWrites&&this.indexedValues[e]===t||(this.indexedValues[e]=t,this.runLocalHooks("change"),!0))}clear(){this.setDefaultValues()}getLength(){return this.getValues().length}setDefaultValues(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.indexedValues.length;if(na(this.initValueOrFn)){let t=Array(e),r=this.initValueOrFn;for(let n=0;n<e;n+=1)t[n]=r(n);this.indexedValues=t}else this.indexedValues=Array(e).fill(this.initValueOrFn);this.runLocalHooks("change")}init(e){return this.setDefaultValues(e),this.runLocalHooks("init"),this}insert(e,t){this.runLocalHooks("change")}remove(e){this.runLocalHooks("change")}destroy(){this.clearLocalHooks(),this.indexedValues=[],this.initValueOrFn=null}}function ay(e,t,r){return[...e.slice(0,t),...r,...e.slice(t)]}function aw(e,t){if(t.length<=16)return Q(e,e=>!1===t.includes(e));let r=new Set(t);return Q(e,e=>!1===r.has(e))}function aS(e,t){if(0===t.length)return e.slice();let r=Int32Array.from(t).sort();return Z(e,e=>{let t=0,n=r.length;for(;t<n;){let o=Math.floor((t+n)/2);r[o]<e?t=o+1:n=o}return e-t})}function av(e,t){let r=t[0],n=t.length;return Z(e,e=>e>=r?e+n:e)}th(aC,ab);class aR extends aC{#tB=!0;#tV=0;constructor(){super(e=>e,{skipUnchangedWrites:!0})}getValues(){if(this.#tB){let e=Array(this.#tV);for(let t=0;t<this.#tV;t+=1)e[t]=t;return e}return this.indexedValues}getValueAtIndex(e){return this.#tB?e>=0&&e<this.#tV?e:void 0:super.getValueAtIndex(e)}getLength(){return this.#tB?this.#tV:this.indexedValues.length}setValues(e){this.#tU(e)?(this.#tB=!0,this.#tV=e.length,this.indexedValues=[]):(this.#tB=!1,this.indexedValues=e.slice()),this.runLocalHooks("change")}setValueAtIndex(e,t){return!!(e<this.getLength())&&(!!this.skipUnchangedWrites&&this.getValueAtIndex(e)===t||(this.#tz(),super.setValueAtIndex(e,t)))}setDefaultValues(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.getLength();this.#tB=!0,this.#tV=e,this.indexedValues=[],this.runLocalHooks("change")}insert(e,t){if(this.#tB&&this.#tW(e,t)){this.#tV+=t.length,super.insert(e,t);return}this.#tz();let r=av(this.getValues(),t);this.indexedValues=ay(r,e,t),super.insert(e,t)}remove(e){if(this.#tB){this.#tV-=this.#tG(e),super.remove(e);return}let t=aw(this.getValues(),e);this.indexedValues=aS(t,e),super.remove(e)}destroy(){this.#tB=!0,this.#tV=0,super.destroy()}#tz(){this.#tB&&(this.indexedValues=this.getValues(),this.#tB=!1)}#tU(e){for(let t=0;t<e.length;t+=1)if(e[t]!==t)return!1;return!0}#tW(e,t){for(let r=0;r<t.length;r+=1)if(t[r]!==e+r)return!1;return!0}#tG(e){let t=new Set;for(let r=0;r<e.length;r+=1){let n=e[r];n>=0&&n<this.#tV&&t.add(n)}return t.size}}class aE extends aC{#t$=!0;#tV=0;#tY=null;#tj;#tq;constructor(e=!1,t={}){super(e,t),this.#tq="function"==typeof e?e:null,this.#tj=!0===e}#tK(e,t){return null!==this.#tq?!0===this.#tq(e,t):this.#tj}getValues(){return this.#t$?Array(this.#tV).fill(this.#tj):this.#tY}getValueAtIndex(e){if(!(e<0)&&!(e>=this.#tV))return this.#t$?this.#tj:this.#tY[e]}getLength(){return this.#tV}setValues(e){this.#tV=e.length;let t=!0;for(let r=0;r<e.length;r+=1)if(!0===e[r]!==this.#tj){t=!1;break}if(t)this.#t$=!0,this.#tY=null;else{let t=Array(e.length);for(let r=0;r<e.length;r+=1)t[r]=!0===e[r];this.#t$=!1,this.#tY=t}this.runLocalHooks("change")}setValueAtIndex(e,t){if(e<0||e>=this.#tV)return!1;let r=!0===t;if(this.#t$){if(r===this.#tj)return this.skipUnchangedWrites||this.runLocalHooks("change"),!0;this.#tz()}return!!this.skipUnchangedWrites&&this.#tY[e]===r||(this.#tY[e]=r,this.runLocalHooks("change"),!0)}setDefaultValues(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.#tV;if(this.#tV=e,null!==this.#tq){let t=Array(e);for(let r=0;r<e;r+=1)t[r]=this.#tK(r,r);this.#tY=t,this.#t$=!1}else this.#t$=!0,this.#tY=null;this.runLocalHooks("change")}insert(e,t){let r=t.length;if(r>0)if(this.#t$)this.#tV+=r;else{let e=t[0],n=Array(r);for(let e=0;e<r;e+=1)n[e]=this.#tK(t[e],e);let o=this.#tY;this.#tY=o.slice(0,e).concat(n,o.slice(e)),this.#tV+=r}super.insert(e,t)}remove(e){if(this.#t$){let t=new Set;for(let r=0;r<e.length;r+=1){let n=e[r];n>=0&&n<this.#tV&&t.add(n)}this.#tV-=t.size}else{let t=new Set(e),r=this.#tY,n=[];for(let e=0;e<this.#tV;e+=1)!1===t.has(e)&&n.push(r[e]);this.#tY=n,this.#tV=n.length}super.remove(e)}destroy(){this.#t$=!0,this.#tV=0,this.#tY=null,super.destroy()}#tz(){this.#t$&&(this.#tY=Array(this.#tV).fill(this.#tj),this.#t$=!1)}}class aT extends aE{constructor(e=!1){super(e,{skipUnchangedWrites:!0})}getHiddenIndexes(){return X(this.getValues(),(e,t,r)=>(t&&e.push(r),e),[])}}function aA(e,t,r,n){let o=r.length?r[0]:void 0;return[...e.slice(0,o),...r.map((e,t)=>na(n)?n(e,t):n),...void 0===o?[]:e.slice(o)]}function aM(e,t){if(t.length<=16)return Q(e,(e,r)=>!1===t.includes(r));let r=new Set(t);return Q(e,(e,t)=>!1===r.has(t))}class aI extends aC{orderOfIndexes=[];getValues(){return this.orderOfIndexes.map(e=>this.indexedValues[e])}setValues(e){this.orderOfIndexes=[...Array(e.length).keys()],super.setValues(e)}setValueAtIndex(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.orderOfIndexes.length;return e<this.indexedValues.length&&(this.indexedValues[e]=t,!1===this.orderOfIndexes.includes(e)&&this.orderOfIndexes.splice(r,0,e),this.runLocalHooks("change"),!0)}clearValue(e){this.orderOfIndexes=aw(this.orderOfIndexes,[e]),na(this.initValueOrFn)?super.setValueAtIndex(e,this.initValueOrFn(e)):super.setValueAtIndex(e,this.initValueOrFn)}getLength(){return this.orderOfIndexes.length}setDefaultValues(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.indexedValues.length;this.orderOfIndexes.length=0,super.setDefaultValues(e)}insert(e,t){this.indexedValues=aA(this.indexedValues,e,t,this.initValueOrFn),this.orderOfIndexes=av(this.orderOfIndexes,t),super.insert(e,t)}remove(e){this.indexedValues=aM(this.indexedValues,e),this.orderOfIndexes=aw(this.orderOfIndexes,e),this.orderOfIndexes=aS(this.orderOfIndexes,e),super.remove(e)}getEntries(){return this.orderOfIndexes.map(e=>[e,this.getValueAtIndex(e)])}}class ax extends aE{constructor(e=!1){super(e,{skipUnchangedWrites:!0})}getTrimmedIndexes(){return X(this.getValues(),(e,t,r)=>(t&&e.push(r),e),[])}}let aN=new Map([["hiding",aT],["index",aC],["indexesSequence",aR],["linkedPhysicalIndexToValue",aI],["physicalIndexToValue",class extends aC{insert(e,t){this.indexedValues=aA(this.indexedValues,e,t,this.initValueOrFn),super.insert(e,t)}remove(e){this.indexedValues=aM(this.indexedValues,e),super.remove(e)}}],["trimming",ax]]),aO=0;class ak{collection=new Map;register(e,t){!1===this.collection.has(e)&&(this.collection.set(e,t),t.addLocalHook("change",()=>this.runLocalHooks("change",t)),aO+=1)}unregister(e){let t=this.collection.get(e);void 0!==t&&(t.destroy(),this.collection.delete(e),this.runLocalHooks("change",t),aO-=1)}unregisterAll(){this.collection.forEach((e,t)=>this.unregister(t)),this.collection.clear()}get(e){return eL(e)?Array.from(this.collection.values()):this.collection.get(e)}getLength(){return this.collection.size}removeFromEvery(e){this.collection.forEach(t=>{t.remove(e)})}insertToEvery(e,t){this.collection.forEach(r=>{r.insert(e,t)})}initEvery(e){this.collection.forEach(t=>{t.init(e)})}}th(ak,ab);class aH extends ak{mergedValuesCache=[];aggregationFunction;fallbackValue;constructor(e,t){super(),this.aggregationFunction=e,this.fallbackValue=t}getMergedValues(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];if(!0===e)return this.mergedValuesCache;let t=this.get(),r=t.length;if(0===r)return[];let n=Z(t,e=>e.getValues()),o=e_(n[0])&&n[0].length||0,i=Array(o),s=Array(r);for(let e=0;e<o;e+=1){for(let t=0;t<r;t+=1)s[t]=n[t][e];i[e]=this.aggregationFunction(s)}return i}getMergedValueAtIndex(e,t){let r=this.getMergedValues(t)[e];return e_(r)?r:this.fallbackValue}updateCache(){this.mergedValuesCache=this.getMergedValues(!1)}}class a_{#tX=[];subscribe(e){return this.addLocalHook("change",e),this._write(this.#tX),this}unsubscribe(){return this.runLocalHooks("unsubscribe"),this.clearLocalHooks(),this}_write(e){return e.length>0&&this.runLocalHooks("change",e),this}_writeInitialChanges(e){this.#tX=e}}function aL(e,t){let r=[],n=0,o=0;for(;n<e.length&&o<t.length;n++,o++)e[n]!==t[o]&&r.push({op:"replace",index:o,oldValue:e[n],newValue:t[o]});for(;n<t.length;n++)r.push({op:"insert",index:n,oldValue:void 0,newValue:t[n]});for(;o<e.length;o++)r.push({op:"remove",index:o,oldValue:e[o],newValue:void 0});return r}th(a_,ab);class aP{#tQ=new Set;#tZ=[];#tJ=[];#t0=!1;#t1=!1;constructor({initialIndexValue:e}={}){this.#t1=e??!1}createObserver(){let e=new a_;return this.#tQ.add(e),e.addLocalHook("unsubscribe",()=>{this.#tQ.delete(e)}),e._writeInitialChanges(aL(this.#tZ,this.#tJ)),e}emit(e){let t=this.#tJ;(!this.#t0||this.#tZ.length!==e.length)&&(0===e.length?e=Array(t.length).fill(this.#t1):this.#tZ=Array(e.length).fill(this.#t1),this.#t0||(this.#t0=!0,t=this.#tZ));let r=aL(t,e);this.#tQ.forEach(e=>e._write(r)),this.#tJ=e}}class aD{indexesSequence=new aR;trimmingMapsCollection=new aH(e=>e.some(e=>!0===e),!1);hidingMapsCollection=new aH(e=>e.some(e=>!0===e),!1);variousMapsCollection=new ak;hidingChangesObservable=new aP({initialIndexValue:!1});notTrimmedIndexesCache=[];notHiddenIndexesCache=[];isBatched=!1;indexesSequenceChanged=!1;indexesChangeSource=void 0;trimmedIndexesChanged=!1;hiddenIndexesChanged=!1;renderablePhysicalIndexesCache=[];fromPhysicalToVisualIndexesCache=new Int32Array(0);fromVisualToRenderableIndexesCache=new Int32Array(0);#t2=new WeakMap;#t3=new Set;constructor(){this.indexesSequence.addLocalHook("change",()=>{this.indexesSequenceChanged=!0,this.updateCache(),this.runLocalHooks("indexesSequenceChange",this.indexesChangeSource),this.runLocalHooks("change",this.indexesSequence,null)}),this.trimmingMapsCollection.addLocalHook("change",e=>{this.trimmedIndexesChanged=!0,this.updateCache(),this.runLocalHooks("change",e,this.trimmingMapsCollection)}),this.hidingMapsCollection.addLocalHook("change",e=>{this.hiddenIndexesChanged=!0,this.updateCache(),this.runLocalHooks("change",e,this.hidingMapsCollection)}),this.variousMapsCollection.addLocalHook("change",e=>{this.#t6(e),this.runLocalHooks("change",e,this.variousMapsCollection)})}suspendOperations(){this.isBatched=!0}resumeOperations(){this.isBatched=!1,this.updateCache(),this.#t5()}createChangesObserver(e){return"hiding"!==e&&tr(`Unsupported index map type "${e}".`),this.hidingChangesObservable.createObserver()}createAndRegisterIndexMap(e,t,r,n){return this.registerMap(e,function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return aN.has(e)||tr(`The provided map type ("${e}") does not exist.`),new(aN.get(e))(t,r)}(t,r,n))}registerMap(e,t){(this.trimmingMapsCollection.get(e)||this.hidingMapsCollection.get(e)||this.variousMapsCollection.get(e))&&tr(`Map with name "${e}" has been already registered.`),t instanceof ax?this.trimmingMapsCollection.register(e,t):t instanceof aT?this.hidingMapsCollection.register(e,t):this.variousMapsCollection.register(e,t);let r=this.getNumberOfIndexes();return r>0&&t.init(r),t}unregisterMap(e){this.trimmingMapsCollection.unregister(e),this.hidingMapsCollection.unregister(e),this.variousMapsCollection.unregister(e)}unregisterAll(){this.trimmingMapsCollection.unregisterAll(),this.hidingMapsCollection.unregisterAll(),this.variousMapsCollection.unregisterAll()}getPhysicalFromVisualIndex(e){let t=this.notTrimmedIndexesCache[e];return e_(t)?t:null}getPhysicalFromRenderableIndex(e){let t=this.renderablePhysicalIndexesCache[e];return e_(t)?t:null}getVisualFromPhysicalIndex(e){if(!Number.isInteger(e))return null;let t=this.fromPhysicalToVisualIndexesCache[e];return void 0===t||-1===t?null:t}getVisualFromRenderableIndex(e){return this.getVisualFromPhysicalIndex(this.getPhysicalFromRenderableIndex(e))}getRenderableFromVisualIndex(e){if(!Number.isInteger(e))return null;let t=this.fromVisualToRenderableIndexesCache[e];return void 0===t||-1===t?null:t}getNearestNotHiddenIndex(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(null===this.getPhysicalFromVisualIndex(e))return null;let n=this.fromVisualToRenderableIndexesCache,o=n[e];if("number"==typeof o&&-1!==o)return e;let i=n.length;for(let r=e+t;r>=0&&r<i;r+=t)if(-1!==n[r])return r;return r?this.getNearestNotHiddenIndex(e,-t,!1):null}initToLength(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.getNumberOfIndexes();this.notTrimmedIndexesCache=[...Array(e).keys()],this.notHiddenIndexesCache=[...Array(e).keys()],this.suspendOperations(),this.indexesChangeSource="init",this.indexesSequence.init(e),this.indexesChangeSource=void 0,this.trimmingMapsCollection.initEvery(e),this.resumeOperations(),this.suspendOperations(),this.hidingMapsCollection.initEvery(e),this.variousMapsCollection.initEvery(e),this.resumeOperations(),this.runLocalHooks("init")}fitToLength(e){let t=this.getNumberOfIndexes();if(e<t){let t=[...Array(this.getNumberOfIndexes()-e).keys()].map(t=>t+e);this.removeIndexes(t)}else this.insertIndexes(t,e-t)}getIndexesSequence(){return this.indexesSequence.getValues()}setIndexesSequence(e){void 0===this.indexesChangeSource&&(this.indexesChangeSource="update"),this.indexesSequence.setValues(e),"update"===this.indexesChangeSource&&(this.indexesChangeSource=void 0)}getNotTrimmedIndexes(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];if(!0===e)return this.notTrimmedIndexesCache;let t=this.getIndexesSequence(),r=this.trimmingMapsCollection.getMergedValues(),n=[];for(let e=0;e<t.length;e+=1){let o=t[e];!0!==r[o]&&n.push(o)}return n}getNotTrimmedIndexesLength(){return this.getNotTrimmedIndexes().length}getNotHiddenIndexes(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];if(!0===e)return this.notHiddenIndexesCache;let t=this.getIndexesSequence(),r=this.hidingMapsCollection.getMergedValues(),n=[];for(let e=0;e<t.length;e+=1){let o=t[e];!0!==r[o]&&n.push(o)}return n}getNotHiddenIndexesLength(){return this.getNotHiddenIndexes().length}getRenderableIndexes(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];if(!0===e)return this.renderablePhysicalIndexesCache;let t=this.getNotTrimmedIndexes(),r=this.hidingMapsCollection.getMergedValues(),n=[];for(let e=0;e<t.length;e+=1){let o=t[e];!0!==r[o]&&n.push(o)}return n}getRenderableIndexesLength(){return this.getRenderableIndexes().length}getNumberOfIndexes(){return this.getIndexesSequence().length}moveIndexes(e,t){"number"==typeof e&&(e=[e]);let r=Z(e,e=>this.getPhysicalFromVisualIndex(e)).filter(e=>null!==e),n=this.getNotTrimmedIndexesLength(),o=e.length,i=aw(this.getIndexesSequence(),r),s=i.filter(e=>!1===this.isTrimmed(e)),a=i.indexOf(s[s.length-1])+1;if(t+o<n){let e=s[t];a=i.indexOf(e)}this.indexesChangeSource="move",this.setIndexesSequence(ay(i,a,r)),this.indexesChangeSource=void 0}isTrimmed(e){return this.trimmingMapsCollection.getMergedValueAtIndex(e)}isHidden(e){return this.hidingMapsCollection.getMergedValueAtIndex(e)}insertIndexes(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"start",n=this.getNotTrimmedIndexes()[e],o=e_(n)?n:this.getNumberOfIndexes(),i=this.getIndexesSequence().includes(n)?this.getIndexesSequence().indexOf(n):this.getNumberOfIndexes(),s=Z(Array(t).fill(o),(e,t)=>e+t);this.suspendOperations(),this.indexesChangeSource="insert",this.indexesSequence.insert(i,s),this.indexesChangeSource=void 0;let a="end"===r?s.map(e=>e+1):s;this.trimmingMapsCollection.insertToEvery(i,a),this.hidingMapsCollection.insertToEvery(i,a),this.variousMapsCollection.insertToEvery(i,a),this.resumeOperations()}removeIndexes(e){this.suspendOperations(),this.indexesChangeSource="remove",this.indexesSequence.remove(e),this.indexesChangeSource=void 0,this.trimmingMapsCollection.removeFromEvery(e),this.hidingMapsCollection.removeFromEvery(e),this.variousMapsCollection.removeFromEvery(e),this.resumeOperations()}observeMapChange(e,t){return(e instanceof ax||e instanceof aT)&&tr('The "observeMapChange" method does not support trimming or hiding maps.'),this.#t2.has(e)||this.#t2.set(e,new Set),this.#t2.get(e).add(t),()=>{let r=this.#t2.get(e);r&&(r.delete(t),0===r.size&&this.#t2.delete(e))}}#t6(e){this.#t2.has(e)&&(this.isBatched?this.#t3.add(e):this.#t4(e))}#t4(e){let t=this.#t2.get(e);t&&t.forEach(t=>t(e))}#t5(){this.#t3.size>0&&(this.#t3.forEach(e=>this.#t4(e)),this.#t3.clear())}updateCache(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.indexesSequenceChanged||this.trimmedIndexesChanged||this.hiddenIndexesChanged;(!0===e||!1===this.isBatched&&!0===t)&&(this.trimmingMapsCollection.updateCache(),this.hidingMapsCollection.updateCache(),this.notTrimmedIndexesCache=this.getNotTrimmedIndexes(!1),this.notHiddenIndexesCache=this.getNotHiddenIndexes(!1),this.renderablePhysicalIndexesCache=this.getRenderableIndexes(!1),this.cacheFromPhysicalToVisualIndexes(),this.cacheFromVisualToRenderableIndexes(),this.hiddenIndexesChanged&&this.hidingChangesObservable.emit(this.hidingMapsCollection.getMergedValues()),this.runLocalHooks("cacheUpdated",{indexesSequenceChanged:this.indexesSequenceChanged,trimmedIndexesChanged:this.trimmedIndexesChanged,hiddenIndexesChanged:this.hiddenIndexesChanged}),this.indexesSequenceChanged=!1,this.trimmedIndexesChanged=!1,this.hiddenIndexesChanged=!1)}#t9(e,t){return e.length===t?(e.fill(-1),e):new Int32Array(t).fill(-1)}cacheFromPhysicalToVisualIndexes(){let e=this.getNotTrimmedIndexesLength(),t=this.#t9(this.fromPhysicalToVisualIndexesCache,this.getNumberOfIndexes());for(let r=0;r<e;r+=1){let e=this.getPhysicalFromVisualIndex(r);null!==e&&(t[e]=r)}this.fromPhysicalToVisualIndexesCache=t}cacheFromVisualToRenderableIndexes(){let e=this.getRenderableIndexesLength(),t=this.#t9(this.fromVisualToRenderableIndexesCache,this.getNotTrimmedIndexesLength());for(let r=0;r<e;r+=1){let e=this.getPhysicalFromRenderableIndex(r),n=this.getVisualFromPhysicalIndex(e);null!==n&&(t[n]=r)}this.fromVisualToRenderableIndexesCache=t}destroy(){this.#t2=new WeakMap,this.#t3.clear(),this.unregisterAll()}}function aF(e){let t=/^([a-zA-Z]{2})-([a-zA-Z]{2})$/.exec(e);return t?`${t[1].toLowerCase()}-${t[2].toUpperCase()}`:e}function aB(e){e_(e)&&t3(ec`Language with code "${e}" was not found. You should register particular language\x20
    before using it. Read more about this issue at: https://docs.handsontable.com/i18n/missing-language-code.`)}th(aD,ab);let{register:aV,getValues:aU}=nU("phraseFormatters");aV("pluralize",function(e,t){return Array.isArray(e)&&Number.isInteger(t)?e[t]:e}),aV("substitute",function e(t,r){return Array.isArray(t)?t.map(t=>e(t,r)):tK(t,r)});let az="Common:",aW=`${az}ok`,aG=`${az}cancel`,a$="ContextMenu:items",aY=`${a$}.noItems`,aj=`${a$}.insertRowAbove`,aq=`${a$}.insertRowBelow`,aK=`${a$}.insertColumnOnTheLeft`,aX=`${a$}.insertColumnOnTheRight`,aQ=`${a$}.removeRow`,aZ=`${a$}.removeColumn`,aJ=`${a$}.undo`,a0=`${a$}.redo`,a1=`${a$}.readOnly`,a2=`${a$}.clearColumn`,a3=`${a$}.copy`,a6=`${a$}.copyWithHeaders`,a5=`${a$}.copyWithGroupHeaders`,a4=`${a$}.copyHeadersOnly`,a9=`${a$}.cut`,a7=`${a$}.export`,a8=`${a$}.exportFileCsv`,le=`${a$}.exportFileXlsx`,lt=`${a$}.freezeColumn`,lr=`${a$}.unfreezeColumn`,ln=`${a$}.mergeCells`,lo=`${a$}.unmergeCells`,li=`${a$}.addComment`,ls=`${a$}.editComment`,la=`${a$}.removeComment`,ll=`${a$}.readOnlyComment`,lh=`${a$}.align`,ld=`${a$}.align.left`,lu=`${a$}.align.center`,lc=`${a$}.align.right`,lg=`${a$}.align.justify`,lp=`${a$}.align.top`,lm=`${a$}.align.middle`,lf=`${a$}.align.bottom`,lb=`${a$}.borders`,lC=`${a$}.borders.top`,ly=`${a$}.borders.right`,lw=`${a$}.borders.bottom`,lS=`${a$}.borders.left`,lv=`${a$}.borders.remove`,lR=`${a$}.nestedHeaders.insertChildRow`,lE=`${a$}.nestedHeaders.detachFromParent`,lT=`${a$}.hideColumn`,lA=`${a$}.showColumn`,lM=`${a$}.hideRow`,lI=`${a$}.showRow`,lx="Filters:",lN=`${lx}conditions`,lO=`${lN}.none`,lk=`${lN}.isEmpty`,lH=`${lN}.isNotEmpty`,l_=`${lN}.isEqualTo`,lL=`${lN}.isNotEqualTo`,lP=`${lN}.beginsWith`,lD=`${lN}.endsWith`,lF=`${lN}.contains`,lB=`${lN}.doesNotContain`,lV=`${lN}.byValue`,lU=`${lN}.greaterThan`,lz=`${lN}.greaterThanOrEqualTo`,lW=`${lN}.lessThan`,lG=`${lN}.lessThanOrEqualTo`,l$=`${lN}.isBetween`,lY=`${lN}.isNotBetween`,lj=`${lN}.after`,lq=`${lN}.afterOrEqual`,lK=`${lN}.before`,lX=`${lN}.beforeOrEqual`,lQ=`${lN}.today`,lZ=`${lN}.tomorrow`,lJ=`${lN}.yesterday`,l0=`${lx}labels.filterByCondition`,l1=`${lx}labels.filterByValue`,l2=`${lx}labels.conjunction`,l3=`${lx}labels.disjunction`,l6=`${lx}values.blankCells`,l5=`${lx}buttons.selectAll`,l4=`${lx}buttons.clear`,l9=`${lx}buttons.ok`,l7=`${lx}buttons.cancel`,l8=`${lx}buttons.placeholder.search`,he=`${lx}buttons.placeholder.value`,ht=`${lx}buttons.placeholder.secondValue`,hr="Pagination:",hn=`${hr}section.pagination`,ho=`${hr}.pageSize.auto`,hi=`${hr}section.pageSize`,hs=`${hr}section.counter`,ha=`${hr}section.navigation`,hl=`${hr}firstPage`,hh=`${hr}prevPage`,hd=`${hr}nextPage`,hu=`${hr}lastPage`,hc="CheckboxRenderer:",hg=`${hc}checked`,hp=`${hc}unchecked`,hm="Loading:",hf=`${hm}title`,hb="Notification:",hC=`${hb}buttons.close`,hy="ExportFile:",hw=`${hy}dialog.title`,hS="EmptyDataState:",hv=`${hS}title`,hR=`${hS}description`,hE=`${hS}title.filters`,hT=`${hS}description.filters`,hA=`${hS}buttons.filters.reset`,hM=`${hS}title.loading`,hI=`${hS}description.loading`,hx="DataProvider:",hN=`${hx}errors.fetch`,hO=`${hx}errors.create`,hk=`${hx}errors.update`,hH=`${hx}errors.remove`,h_=`${hx}errors.requestFailed`,hL=`${hx}buttons.refetch`,hP={languageCode:"en-US",[aW]:"OK",[aG]:"Cancel",[aY]:"No available options",[aj]:"Insert row above",[aq]:"Insert row below",[aK]:"Insert column left",[aX]:"Insert column right",[aQ]:["Remove row","Remove rows"],[aZ]:["Remove column","Remove columns"],[aJ]:"Undo",[a0]:"Redo",[a1]:"Read only",[a2]:"Clear column",[lh]:"Alignment",[ld]:"Left",[lu]:"Center",[lc]:"Right",[lg]:"Justify",[lp]:"Top",[lm]:"Middle",[lf]:"Bottom",[lt]:"Freeze column",[lr]:"Unfreeze column",[lb]:"Borders",[lC]:"Top",[ly]:"Right",[lw]:"Bottom",[lS]:"Left",[lv]:"Remove border(s)",[li]:"Add comment",[ls]:"Edit comment",[la]:"Delete comment",[ll]:"Read-only comment",[ln]:"Merge cells",[lo]:"Unmerge cells",[a3]:"Copy",[a6]:["Copy with header","Copy with headers"],[a5]:["Copy with group header","Copy with group headers"],[a4]:["Copy header only","Copy headers only"],[a9]:"Cut",[a7]:"Export",[a8]:"To CSV",[le]:"To Excel",[hw]:"Exporting…",[lR]:"Insert child row",[lE]:"Detach from parent",[lT]:["Hide column","Hide columns"],[lA]:["Show column","Show columns"],[lM]:["Hide row","Hide rows"],[lI]:["Show row","Show rows"],[lO]:"None",[lk]:"Is empty",[lH]:"Is not empty",[l_]:"Is equal to",[lL]:"Is not equal to",[lP]:"Begins with",[lD]:"Ends with",[lF]:"Contains",[lB]:"Does not contain",[lU]:"Greater than",[lz]:"Greater than or equal to",[lW]:"Less than",[lG]:"Less than or equal to",[l$]:"Is between",[lY]:"Is not between",[lj]:"After",[lq]:"After or equal to",[lK]:"Before",[lX]:"Before or equal to",[lQ]:"Today",[lZ]:"Tomorrow",[lJ]:"Yesterday",[l6]:"Blank cells",[l0]:"Filter by condition",[l1]:"Filter by value",[l2]:"And",[l3]:"Or",[l5]:"Select all",[l4]:"Clear",[l9]:"OK",[l7]:"Cancel",[l8]:"Search",[he]:"Value",[ht]:"Second value",[hn]:"Pagination",[hi]:"Page size",[ho]:"Auto",[hs]:"[start] - [end] of [total]",[ha]:"Page [currentPage] of [totalPages]",[hl]:"Go to first page",[hh]:"Go to previous page",[hd]:"Go to next page",[hu]:"Go to last page",[hg]:"Checked",[hp]:"Unchecked",[hf]:"Loading...",[hC]:"Close",[hv]:"No data available",[hR]:"There’s nothing to display yet.",[hE]:"No results found",[hT]:"It looks like your current filters are hiding all results.",[hA]:"Reset filters",[hM]:"Loading data",[hI]:"Please wait.",[hN]:"Could not load data",[hO]:"Could not create rows",[hk]:"Could not update rows",[hH]:"Could not remove rows",[h_]:"Request failed",[hL]:"Refetch"},hD=hP.languageCode,{register:hF,getItem:hB,hasItem:hV,getValues:hU}=nU("languagesDictionaries");function hz(e,t){let r=e,n=t;return tc(e)&&(r=String((n=e).languageCode)),function(e,t){e!==hD&&tp(hB(hD),(e,r)=>{eL(t[r])&&(t[r]=e)})}(r,n),hF(r,ta(n)),ta(n)}function hW(e){return hV(e)?ta(hB(e)):null}hz(hP);function hG(e,t,r){var n,o;let i=hW(e);if(null===i)return null;let s=i[t];if(eL(s))return null;let a=(n=s,o=r,aU().reduce((e,t)=>t(e,o),n));return Array.isArray(a)?a[0]:a}class h${constructor(e,t){this.settings=e,this.cellRange=t||null}isEmpty(){return null===this.cellRange}add(e){return this.isEmpty()?this.cellRange=this.settings.createCellRange(e):this.cellRange.expand(e),this}replace(e,t){if(!this.isEmpty()){if(this.cellRange.from.isEqual(e))return this.cellRange.from=t,!0;if(this.cellRange.to.isEqual(e))return this.cellRange.to=t,!0}return!1}clear(){return this.cellRange=null,this}getCorners(){let e=this.cellRange.getOuterTopStartCorner(),t=this.cellRange.getOuterBottomEndCorner();return[e.row??0,e.col??0,t.row??0,t.col??0]}destroy(){this.runLocalHooks("destroy")}}th(h$,ab);let hY=h$,hj=class extends hY{visualCellRange=null;constructor(e,t){super(e,null),this.visualCellRange=t||null,this.commit()}add(e){return null===this.visualCellRange?this.visualCellRange=this.settings.createCellRange(e):this.visualCellRange.expand(e),this}clear(){return this.visualCellRange=null,super.clear()}trimToVisibleCellsRangeOnly(e){let{from:t,to:r}=e,n="N-S"===e.getVerticalDirection()?1:-1,o="start-end"===e.getInlineDirection()?1:-1,i=this.getNearestNotHiddenCoords(t,n,o),s=this.getNearestNotHiddenCoords(r,-n,-o);if(null===i||null===s)return null;let a=i.row??0,l=s.row??0,h=i.col??0,d=s.col??0,u=1===o&&h>d||-1===o&&h<d;return 1===n&&a>l||-1===n&&a<l||u?null:this.settings.createCellRange(i,i,s)}getNearestNotHiddenCoords(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t;if(null===e.row||null===e.col)return null;let n=this.getNearestNotHiddenIndex(this.settings.rowIndexMapper,e.row,t);if(null===n)return null;let o=this.getNearestNotHiddenIndex(this.settings.columnIndexMapper,e.col,r);return null===o?null:this.settings.createCellCoords(n,o)}getNearestNotHiddenIndex(e,t,r){return t<0?t:e.getNearestNotHiddenIndex(t,r)}commit(){if(null===this.visualCellRange)return this;let e=this.trimToVisibleCellsRangeOnly(this.visualCellRange);return null===e?this.cellRange=null:this.cellRange=this.createRenderableCellRange(e.from,e.to),this}syncWith(e){let t=e.from.clone().normalize(),r="N-S"===e.getVerticalDirection()?1:-1,n="W-E"===e.getHorizontalDirection()?1:-1,o=this.visualCellRange?this.settings.visualToRenderableCoords(this.visualCellRange.highlight):null,i=null;if((null===o||null===o.col||null===o.row)&&(i=this.getNearestNotHiddenCoords(t,r,n)),null!==i&&e.includes(i)){let t=e.highlight.clone();if((t.row??-1)>=0&&(t.row=i.row),(t.col??-1)>=0&&(t.col=i.col),null===this.cellRange){let e=this.settings.visualToRenderableCoords(t);this.cellRange=this.settings.createCellRange(e)}e.setHighlight(t)}return"focus"===this.settings.selectionType&&null!==o&&null===i&&null!==this.visualCellRange&&e.setHighlight(this.visualCellRange.highlight),this}getCorners(){let{from:e,to:t}=this.cellRange;return[Math.min(e.row??0,t.row??0),Math.min(e.col??0,t.col??0),Math.max(e.row??0,t.row??0),Math.max(e.col??0,t.col??0)]}getVisualCorners(){let e=this.cellRange,t=this.settings.renderableToVisualCoords(e.getTopStartCorner()),r=this.settings.renderableToVisualCoords(e.getBottomEndCorner());return[t.row,t.col,r.row,r.col]}createRenderableCellRange(e,t){let r=this.settings.visualToRenderableCoords(e),n=this.settings.visualToRenderableCoords(t);return null===r.row||null===r.col||null===n.row||null===n.col?null:this.settings.createCellRange(r,r,n)}};function hq(e){let{activeHeaderClassName:t,...r}=e;return new hj({className:t,...r,selectionType:sK})}function hK(e){let{areaCornerVisible:t,adjustHandlesVisible:r,moveEnabled:n,...o}=e;return new hj({className:"area",createLayers:!0,border:{width:1,color:"#4b89ff",cornerVisible:t,adjustHandlesVisible:r,moveEnabled:n},...o,selectionType:"area"})}function hX(e){let{...t}=e;return new hj({className:"highlight",...t,selectionType:"area"})}function hQ(e){let{columnClassName:t,...r}=e;return new hj({className:t,...r,selectionType:"column"})}function hZ(e){let{headerClassName:t,...r}=e;return new hj({className:t,...r,selectionType:"header"})}function hJ(e){let{rowClassName:t,...r}=e;return new hj({className:t,...r,selectionType:"row"})}class h0{layerLevel=0;layeredAreas=new Map;areas=new Map;rowHeaders=new Map;columnHeaders=new Map;activeRowHeaders=new Map;activeColumnHeaders=new Map;activeCornerHeaders=new Map;rowHighlights=new Map;columnHighlights=new Map;customSelections=[];constructor(e){this.options=e,this.focus=function(e){let{cellCornerVisible:t,cellMoveEnabled:r,...n}=e;return new hj({className:"current",headerAttributes:[$()],border:{width:2,color:"#4b89ff",cornerVisible:t,moveEnabled:r},...n,selectionType:"focus"})}(e),this.fill=function(e){let{...t}=e;return new hj({className:"fill",border:{width:1,color:"#ff0000"},...t,selectionType:"fill"})}(e)}isEnabledFor(e,t){let r=e;"focus"===e&&(r="current");let n=this.options.disabledCellSelection;if("function"!=typeof n)return!0;let o=n(t.row,t.col);return"string"==typeof o&&(o=[o]),!o||Array.isArray(o)&&!o.includes(r)}useLayerLevel(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.layerLevel=e,this}getFocus(){return this.focus}getFill(){return this.fill}createLayeredArea(){return this.#t7(this.layeredAreas,hK)}getLayeredAreas(){return[...this.layeredAreas.values()]}createArea(){return this.#t7(this.areas,hX)}getAreas(){return[...this.areas.values()]}createRowHeader(){return this.#t7(this.rowHeaders,hZ)}getRowHeaders(){return[...this.rowHeaders.values()]}createColumnHeader(){return this.#t7(this.columnHeaders,hZ)}getColumnHeaders(){return[...this.columnHeaders.values()]}createActiveRowHeader(){return this.#t7(this.activeRowHeaders,hq)}getActiveRowHeaders(){return[...this.activeRowHeaders.values()]}createActiveColumnHeader(){return this.#t7(this.activeColumnHeaders,hq)}getActiveColumnHeaders(){return[...this.activeColumnHeaders.values()]}createActiveCornerHeader(){return this.#t7(this.activeCornerHeaders,hq)}getActiveCornerHeaders(){return[...this.activeCornerHeaders.values()]}createRowHighlight(){return this.#t7(this.rowHighlights,hJ)}getRowHighlights(){return[...this.rowHighlights.values()]}createColumnHighlight(){return this.#t7(this.columnHighlights,hQ)}getColumnHighlights(){return[...this.columnHighlights.values()]}getCustomSelections(){return[...this.customSelections.values()]}addCustomSelection(e){this.customSelections.push(function(e){let{border:t,visualCellRange:r,...n}=e;return new hj({...t,...n,selectionType:sX},r)}({...this.options,...e}))}updateHighlightClassNames(e){"rowClassName"in e&&(this.options.rowClassName=e.rowClassName,J(this.rowHighlights.values(),t=>{t.settings.className=e.rowClassName})),"columnClassName"in e&&(this.options.columnClassName=e.columnClassName,J(this.columnHighlights.values(),t=>{t.settings.className=e.columnClassName})),"headerClassName"in e&&(this.options.headerClassName=e.headerClassName,J(this.rowHeaders.values(),t=>{t.settings.className=e.headerClassName}),J(this.columnHeaders.values(),t=>{t.settings.className=e.headerClassName})),"activeHeaderClassName"in e&&(this.options.activeHeaderClassName=e.activeHeaderClassName,J(this.activeRowHeaders.values(),t=>{t.settings.className=e.activeHeaderClassName}),J(this.activeColumnHeaders.values(),t=>{t.settings.className=e.activeHeaderClassName}),J(this.activeCornerHeaders.values(),t=>{t.settings.className=e.activeHeaderClassName}))}clear(){this.focus.clear(),this.fill.clear(),this.areas.forEach(e=>e.clear()),this.layeredAreas.forEach(e=>e.clear()),this.rowHeaders.forEach(e=>e.clear()),this.columnHeaders.forEach(e=>e.clear()),this.activeRowHeaders.forEach(e=>e.clear()),this.activeColumnHeaders.forEach(e=>e.clear()),this.activeCornerHeaders.forEach(e=>e.clear()),this.rowHighlights.forEach(e=>e.clear()),this.columnHighlights.forEach(e=>e.clear())}#t7(e,t){let r=this.layerLevel;if(e.has(r))return e.get(r);let n=t({layerLevel:r,...this.options});return e.set(r,n),n}[Symbol.iterator](){return[this.focus,this.fill,...this.areas.values(),...this.layeredAreas.values(),...this.rowHeaders.values(),...this.columnHeaders.values(),...this.activeRowHeaders.values(),...this.activeColumnHeaders.values(),...this.activeCornerHeaders.values(),...this.rowHighlights.values(),...this.columnHighlights.values(),...this.customSelections][Symbol.iterator]()}}class h1{ranges=[];createCellRange;constructor(e){this.createCellRange=e}isEmpty(){return 0===this.size()}set(e){return this.clear(),this.ranges.push(this.createCellRange(e)),this}add(e){return this.ranges.push(this.createCellRange(e)),this}push(e){return this.ranges.push(e),this}pop(){return this.ranges.pop()}current(){return this.peekByIndex(this.size()-1)}previous(){return this.peekByIndex(this.size()-2)}includes(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>!0;return this.ranges.some((r,n)=>r.includes(e)&&t(r,n))}findAll(e){let t=[];return this.ranges.forEach((r,n)=>{r.isEqual(e)&&t.push({range:r,layer:n})}),t}remove(e){return this.ranges=this.ranges.filter(t=>!e.some(e=>e.isEqual(t))),this}removeLayers(e){return this.ranges=this.ranges.filter((t,r)=>!e.includes(r)),this}clear(){return this.ranges.length=0,this}size(){return this.ranges.length}clone(){let e=new h1(this.createCellRange);return e.ranges=this.ranges.map(e=>e.clone()),e}map(e){return this.ranges=this.ranges.map((t,r)=>e(t,r)),this}peekByIndex(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t>=0&&t<this.size()&&(e=this.ranges[t]),e}[Symbol.iterator](){return this.ranges[Symbol.iterator]()}}class h2{#t8;#re=0;#rt={x:0,y:0};constructor(e,t){this.#t8=e,this.tableApi=t}setActiveLayerIndex(e){this.#re=e}getCurrentSelection(){return this.#t8.peekByIndex(this.#re)}transformStart(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.#rt=this.calculateOffset();let n=this.tableApi.createCellCoords(e,t),o=this.getCurrentSelection().highlight,i=this.tableApi.visualToRenderableCoords(o),s=0,a=0;if(this.runLocalHooks("beforeTransformStart",n),null!==i.row&&null!==i.col){let{width:e,height:t}=this.#rr(),{row:i,col:l}=this.#rn(o),h=this.tableApi.fixedRowsBottom(),d=this.tableApi.minSpareRows(),u=this.tableApi.minSpareCols(),c=this.tableApi.autoWrapRow(),g=this.tableApi.autoWrapCol(),p=this.tableApi.createCellCoords((i??0)+(n.row??0),(l??0)+(n.col??0));if((p.row??0)>=t){let n=tC(r&&d>0&&0===h),o=(p.col??0)+1,i=o>=e,s=this.tableApi.createCellCoords((p.row??0)-t,i?o-e:o);if(this.runLocalHooks("beforeColumnWrap",n,this.#ro(s),i),n.value)this.runLocalHooks("insertRowRequire",this.countRenderableRows());else if(g){if(this.shouldSwitchSelectionLayer()&&i&&this.#t8.size()>1){this.#ri();let e=this.#rs("forward");null!==e&&s.assign(e)}p.assign(s)}}else if((p.row??0)<0){let r=tC(g),n=(p.col??0)-1,o=n<0,i=this.tableApi.createCellCoords(t+(p.row??0),o?e+n:n);if(this.runLocalHooks("beforeColumnWrap",r,this.#ro(i),o),g){if(this.shouldSwitchSelectionLayer()&&o&&this.#t8.size()>1){this.#ra();let e=this.#rs("backward");null!==e&&i.assign(e)}p.assign(i)}}if({width:e,height:t}=this.#rr(),(p.col??0)>=e){let n=tC(r&&u>0),o=(p.row??0)+1,i=o>=t,s=this.tableApi.createCellCoords(i?o-t:o,(p.col??0)-e);if(this.runLocalHooks("beforeRowWrap",n,this.#ro(s),i),n.value)this.runLocalHooks("insertColRequire",this.countRenderableColumns());else if(c){if(this.shouldSwitchSelectionLayer()&&i&&this.#t8.size()>1){this.#ri();let e=this.#rs("forward");null!==e&&s.assign(e)}p.assign(s)}}else if((p.col??0)<0){let r=tC(c),n=(p.row??0)-1,o=n<0,i=this.tableApi.createCellCoords(o?t+n:n,e+(p.col??0));if(this.runLocalHooks("beforeRowWrap",r,this.#ro(i),o),c){if(this.shouldSwitchSelectionLayer()&&o&&this.#t8.size()>1){this.#ra();let e=this.#rs("backward");null!==e&&i.assign(e)}p.assign(i)}}let{rowDir:m,colDir:f}=this.#rl(p);s=m,a=f,o=this.#ro(p)}return this.runLocalHooks("afterTransformStart",o,s,a),{selectionLayer:this.#re,visualCoords:o}}transformEnd(e,t){this.#rt=this.calculateOffset();let r=this.tableApi.createCellCoords(e,t),n=this.getCurrentSelection(),o=this.tableApi.visualToRenderableCoords(n.highlight),i=this.#rh(n.to.row??0,n.from.row??0),s=this.#rd(n.to.col??0,n.from.col??0),a=n.to.clone(),l=0,h=0;if(this.runLocalHooks("beforeTransformEnd",r),null!==o.row&&null!==o.col&&null!==i&&null!==s){let{row:e,col:t}=this.#rn(n.highlight),o=this.tableApi.createCellCoords(i+(r.row??0),s+(r.col??0)),d=n.getTopStartCorner(),u=n.getTopEndCorner(),c=n.getBottomEndCorner();if((r.col??0)<0&&s>=(t??0)&&(o.col??0)<(t??0)){let e=(o.col??0)-(t??0);o.col=(this.#rd(d.col??0,u.col??0)??0)+e}else if((r.col??0)>0&&s<=(t??0)&&(o.col??0)>(t??0)){let e=this.#rd(u.col??0,d.col??0),t=Math.max((o.col??0)-(e??0),1);o.col=(e??0)+t}if((r.row??0)<0&&i>=(e??0)&&(o.row??0)<(e??0)){let t=(o.row??0)-(e??0);o.row=(this.#rh(d.row??0,c.row??0)??0)+t}else if((r.row??0)>0&&i<=(e??0)&&(o.row??0)>(e??0)){let e=this.#rh(c.row??0,d.row??0),t=Math.max((o.row??0)-(e??0),1);o.row=(e??0)+t}let{rowDir:g,colDir:p}=this.#rl(o);l=g,h=p;let m=this.#ro(o);0===r.row&&0!==r.col?a.col=m.col:0!==r.row&&0===r.col?a.row=m.row:(a.row=m.row,a.col=m.col)}return this.runLocalHooks("afterTransformEnd",a,l,h),{selectionLayer:this.#re,visualCoords:a}}calculateOffset(){tr("`calculateOffset` is not implemented")}countRenderableRows(){tr("`countRenderableRows` is not implemented")}countRenderableColumns(){tr("`countRenderableColumns` is not implemented")}shouldSwitchSelectionLayer(){tr("`shouldSwitchSelectionLayer` is not implemented")}#ri(){let e=this.#re+1;this.setActiveLayerIndex(e>=this.#t8.size()?0:e),this.#rt=this.calculateOffset()}#ra(){let e=this.#re-1;this.setActiveLayerIndex(e<0?this.#t8.size()-1:e),this.#rt=this.calculateOffset()}#rl(e){let{width:t,height:r}=this.#rr(),n=0,o=0;return(e.row??0)<0?(n=-1,e.row=0):(e.row??0)>0&&(e.row??0)>=r&&(n=1,e.row=r-1),(e.col??0)<0?(o=-1,e.col=0):(e.col??0)>0&&(e.col??0)>=t&&(o=1,e.col=t-1),{rowDir:n,colDir:o}}#rr(){return{width:this.#rt.x+this.countRenderableColumns(),height:this.#rt.y+this.countRenderableRows()}}#rs(e){if(!["forward","backward"].includes(e))return null;let t=this.getCurrentSelection().getTopStartCorner(),r=this.getCurrentSelection().getBottomEndCorner(),[n,o,i,s]="forward"===e?[t.row,r.row,t.col,r.col]:[r.row,t.row,r.col,t.col],a=this.#rh(n??0,o??0),l=this.#rd(i??0,s??0);return null===a||null===l?null:this.tableApi.createCellCoords(a,l)}#rh(e,t){let r=this.tableApi.findFirstNonHiddenRenderableRow(e,t);return null===r?null:this.#rt.y+r}#rd(e,t){let r=this.tableApi.findFirstNonHiddenRenderableColumn(e,t);return null===r?null:this.#rt.x+r}#rn(e){let{row:t,col:r}=this.tableApi.visualToRenderableCoords(e);return(null===t||null===r)&&tr("Renderable coords are not visible."),this.tableApi.createCellCoords(this.#rt.y+t,this.#rt.x+r)}#ro(e){let t=e.clone();return t.col=(e.col??0)-this.#rt.x,t.row=(e.row??0)-this.#rt.y,this.tableApi.renderableToVisualCoords(t)}}th(h2,ab);class h3 extends h2{calculateOffset(){return{x:this.tableApi.navigableHeaders()?this.tableApi.countRowHeaders():0,y:this.tableApi.navigableHeaders()?this.tableApi.countColHeaders():0}}countRenderableRows(){return this.tableApi.countRenderableRows()}countRenderableColumns(){return this.tableApi.countRenderableColumns()}shouldSwitchSelectionLayer(){return!1}}class h6 extends h2{calculateOffset(){let e=this.getCurrentSelection(),{row:t,col:r}=e.getOuterTopStartCorner(),n=t??0,o=r??0,i=this.tableApi.countRenderableColumnsInRange(0,o-1),s=this.tableApi.countRenderableRowsInRange(0,n-1),a=e.highlight.isHeader(),l=a?Math.abs(o):0,h=a?Math.abs(n):0;return{x:o<0?l:-i,y:n<0?h:-s}}countRenderableRows(){let e=this.getCurrentSelection();return this.tableApi.countRenderableRowsInRange(0,e.getOuterBottomEndCorner().row??0)}countRenderableColumns(){let e=this.getCurrentSelection();return this.tableApi.countRenderableColumnsInRange(0,e.getOuterBottomEndCorner().col??0)}transformEnd(e,t){tr("`transformEnd` is not valid for focus selection use `transformStart` instead")}shouldSwitchSelectionLayer(){return!0}}let h5=[3,2],h4=[["number"],["number","string"],["number","undefined"],["number","string","undefined"]],h9=Symbol("root"),h7=Symbol("child");function h8(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:h9;t!==h9&&t!==h7&&tr("The second argument is used internally only and cannot be overwritten.");let r=Array.isArray(e),n=t===h9,o=0;if(r){let t=e[0];0===e.length?o=1:n&&t instanceof i2?o=3:n&&Array.isArray(t)?o=h8(t,h7):e.length>=2&&e.length<=4&&(e.some((e,t)=>!h4[t].includes(typeof e))||(o=2))}return o}function de(e){let{createCellCoords:t,createCellRange:r,keepDirection:n=!1,propToCol:o}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return h5.includes(e)||tr("Unsupported selection ranges schema type was provided."),function(i){let s=3===e,a=s?i.from.row:i[0],l=s?i.from.col:i[1],h=s?i.to.row:i[2],d=s?i.to.col:i[3];"function"==typeof o&&("string"==typeof l&&(l=o(l)),"string"==typeof d&&(d=o(d))),eL(h)&&(h=a),eL(d)&&(d=l);let u=l,c=d;if(!n){let e=a,t=h,r=u,n=c;a=Math.min(e??0,t??0),u=Math.min(r??0,n??0),h=Math.max(e??0,t??0),c=Math.max(r??0,n??0)}return r(s?i.highlight.clone():t(a??0,u??0),t(a??0,u??0),t(h??0,c??0))}}function dt(e){return"object"==typeof e&&null!==e&&Number.isInteger(e.row)&&Number.isInteger(e.col)}function dr(e,t,r){if(!r||t<0)return t;let n=e.getNearestNotHiddenIndex(t,1,!0);return null===n?t:n}class dn{settings;tableProps;inProgress=!1;selectedRange=new h1((e,t,r)=>this.tableProps.createCellRange(e,t,r));highlight;#ru;#rc;selectedByRowHeader=new Set;selectedByColumnHeader=new Set;#rg=!1;#rp=!1;#rm="unknown";#rf=-1;#rb=0;#rC=null;constructor(e,t){var r=this;this.settings=e,this.tableProps=t,this.highlight=new h0({headerClassName:e.currentHeaderClassName,activeHeaderClassName:e.activeHeaderClassName,rowClassName:e.currentRowClassName,columnClassName:e.currentColClassName,cellAttributes:[$()],rowIndexMapper:this.tableProps.rowIndexMapper,columnIndexMapper:this.tableProps.columnIndexMapper,disabledCellSelection:(e,t)=>this.tableProps.isDisabledCellSelection(e,t),cellCornerVisible:()=>this.isCellCornerVisible(),areaCornerVisible:e=>this.isAreaCornerVisible(e),adjustHandlesVisible:e=>this.isAdjustHandlesVisibleFor(e),moveEnabled:()=>this.isRangeMovable(),cellMoveEnabled:()=>this.isSingleCellMovable(),visualToRenderableCoords:e=>this.tableProps.visualToRenderableCoords(e),renderableToVisualCoords:e=>this.tableProps.renderableToVisualCoords(e),createCellCoords:(e,t)=>this.tableProps.createCellCoords(e,t),createCellRange:(e,t,r)=>this.tableProps.createCellRange(e,t,r)}),this.#ru=new h3(this.selectedRange,{...this.tableProps,navigableHeaders:()=>!!e.navigableHeaders,fixedRowsBottom:()=>Number(e.fixedRowsBottom),minSpareRows:()=>Number(e.minSpareRows),minSpareCols:()=>Number(e.minSpareCols),autoWrapRow:()=>!!e.autoWrapRow,autoWrapCol:()=>!!e.autoWrapCol}),this.#rc=new h6(this.selectedRange,{...this.tableProps,navigableHeaders:()=>!!e.navigableHeaders,fixedRowsBottom:()=>0,minSpareRows:()=>0,minSpareCols:()=>0,autoWrapRow:()=>!0,autoWrapCol:()=>!0}),this.#ru.addLocalHook("beforeTransformStart",function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.runLocalHooks("beforeModifyTransformStart",...t)}),this.#ru.addLocalHook("afterTransformStart",function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.runLocalHooks("afterModifyTransformStart",...t)}),this.#ru.addLocalHook("beforeTransformEnd",function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.runLocalHooks("beforeModifyTransformEnd",...t)}),this.#ru.addLocalHook("afterTransformEnd",function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.runLocalHooks("afterModifyTransformEnd",...t)}),this.#ru.addLocalHook("insertRowRequire",function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.runLocalHooks("insertRowRequire",...t)}),this.#ru.addLocalHook("insertColRequire",function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.runLocalHooks("insertColRequire",...t)}),this.#ru.addLocalHook("beforeRowWrap",function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.runLocalHooks("beforeRowWrap",...t)}),this.#ru.addLocalHook("beforeColumnWrap",function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.runLocalHooks("beforeColumnWrap",...t)}),this.#rc.addLocalHook("beforeTransformStart",function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.runLocalHooks("beforeModifyTransformFocus",...t)}),this.#rc.addLocalHook("afterTransformStart",function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.runLocalHooks("afterModifyTransformFocus",...t)})}updateHighlightClassNames(){this.highlight.updateHighlightClassNames({rowClassName:this.settings.currentRowClassName,columnClassName:this.settings.currentColClassName,headerClassName:this.settings.currentHeaderClassName,activeHeaderClassName:this.settings.activeHeaderClassName})}getSelectedRange(){return this.selectedRange}getActiveSelectedRange(){return this.selectedRange.peekByIndex(this.#rb)}getActiveSelectionLayerIndex(){return this.#rb}setActiveSelectionLayerIndex(e){this.#rb=e}markSource(e){this.#rm=e}markEndSource(){this.#rm="unknown"}getSelectionSource(){return this.#rm}setExpectedLayers(e){this.#rf=e}begin(){this.inProgress=!0}finish(){this.runLocalHooks("afterSelectionFinished",Array.from(this.selectedRange)),this.inProgress=!1,this.#rf=-1}isInProgress(){return this.inProgress}setRangeStart(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e,o="multiple"===this.settings.selectionMode,i=eL(t)?this.tableProps.getShortcutManager().isCtrlPressed():t,s=e.clone();this.#rp=!1,this.#rg=!1,this.runLocalHooks(`beforeSetRangeStart${r?"Only":""}`,s),(!o||o&&!i&&eL(t))&&(this.selectedRange.clear(),this.highlight.getAreas().forEach(e=>e.clear()),this.highlight.getLayeredAreas().forEach(e=>e.clear()),this.highlight.getRowHeaders().forEach(e=>e.clear()),this.highlight.getColumnHeaders().forEach(e=>e.clear()),this.highlight.getActiveRowHeaders().forEach(e=>e.clear()),this.highlight.getActiveColumnHeaders().forEach(e=>e.clear()),this.highlight.getActiveCornerHeaders().forEach(e=>e.clear()),this.highlight.getRowHighlights().forEach(e=>e.clear()),this.highlight.getColumnHighlights().forEach(e=>e.clear())),this.selectedRange.add(s).current()?.setHighlight(n.clone()),0===this.getLayerLevel()&&(this.selectedByRowHeader.clear(),this.selectedByColumnHeader.clear()),r||this.setRangeEnd(e)}setRangeStartOnly(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e;this.setRangeStart(e,t,!0,r)}setRangeEnd(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getLayerLevel();if(this.selectedRange.isEmpty())return;this.setActiveSelectionLayerIndex(t);let r=e.clone(),n=this.tableProps.countRows(),o=this.tableProps.countCols(),i=this.getActiveSelectedRange()?.clone().setTo(e).isSingleHeader();if((n>0||o>0)&&(0===n&&(r.col??0)<0&&!i||0===o&&(r.row??0)<0&&!i))return;this.runLocalHooks("beforeSetRangeEnd",r),this.begin();let s=this.getActiveSelectedRange();if(!s)return;if(this.settings.navigableHeaders||s.highlight.normalize(),"single"===this.settings.selectionMode)s.setFrom(s.highlight),s.setTo(s.highlight);else{let e=s.getHorizontalDirection(),t=s.getVerticalDirection(),n=this.isMultiple();s.setTo(r),n&&(e!==s.getHorizontalDirection()||1===s.getWidth()&&!s.includes(s.highlight))&&s.from.assign({col:s.highlight.col??void 0}),n&&(t!==s.getVerticalDirection()||1===s.getHeight()&&!s.includes(s.highlight))&&s.from.assign({row:s.highlight.row??void 0})}n>0&&o>0&&(!this.settings.navigableHeaders||this.settings.navigableHeaders&&!s.isSingleHeader())&&s.to.normalize(),this.runLocalHooks("beforeHighlightSet"),this.setRangeFocus(this.getActiveSelectedRange()?.highlight??s.highlight,t),this.applyAndCommit(this.getActiveSelectedRange()??s,t);let a=-1===this.#rf||this.selectedRange.size()===this.#rf;this.runLocalHooks("afterSetRangeEnd",e,a)}applyAndCommit(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.getActiveSelectedRange(),t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getLayerLevel();if(!e)return;let r=this.tableProps.countRows(),n=this.tableProps.countCols();this.highlight.useLayerLevel(t);let o=this.highlight.createArea(),i=this.highlight.createLayeredArea(),s=this.highlight.createRowHeader(),a=this.highlight.createColumnHeader(),l=this.highlight.createActiveRowHeader(),h=this.highlight.createActiveColumnHeader(),d=this.highlight.createActiveCornerHeader(),u=this.highlight.createRowHighlight(),c=this.highlight.createColumnHighlight();if(o?.clear(),i?.clear(),s?.clear(),a?.clear(),l?.clear(),h?.clear(),d?.clear(),u?.clear(),c?.clear(),this.highlight.isEnabledFor("area",e.highlight)&&(this.isMultiple()||t>=1)&&(o?.add(e.from).add(e.to).commit(),i?.add(e.from).add(e.to).commit(),1===t)){let e=this.selectedRange.peekByIndex(t-1);e&&(this.highlight.useLayerLevel(t-1),this.highlight.createArea()?.add(e.from).commit().syncWith(e),this.highlight.createLayeredArea()?.add(e.from).commit().syncWith(e),this.highlight.useLayerLevel(t))}this.highlight.isEnabledFor("header",e.highlight)&&this.#ry(e,r,n,s,a,l,h,d,u,c)}#ry(e,t,r,n,o,i,s,a,l,h){if(!e.isSingleHeader()){let t=this.tableProps.createCellCoords(Math.max(e.from.row??0,0),-1),r=this.tableProps.createCellCoords(e.to.row??0,-1),i=this.tableProps.createCellCoords(-1,Math.max(e.from.col??0,0)),s=this.tableProps.createCellCoords(-1,e.to.col??0);"single"===this.settings.selectionMode?(n?.add(t).commit(),o?.add(i).commit(),l?.add(t).commit(),h?.add(i).commit()):(n?.add(t).add(r).commit(),o?.add(i).add(s).commit(),l?.add(t).add(r).commit(),h?.add(i).add(s).commit())}let d=!this.#rp&&this.isEntireRowSelected()&&(r>0&&r===e.getWidth()||0===r&&this.isSelectedByRowHeader()),u=!this.#rp&&this.isEntireColumnSelected()&&(t>0&&t===e.getHeight()||0===t&&this.isSelectedByColumnHeader());d&&i?.add(this.tableProps.createCellCoords(Math.max(e.from.row??0,0),Math.min(-this.tableProps.countRowHeaders(),-1))).add(this.tableProps.createCellCoords(Math.max(e.to.row??0,0),-1)).commit(),u&&s?.add(this.tableProps.createCellCoords(Math.min(-this.tableProps.countColHeaders(),-1),Math.max(e.from.col??0,0))).add(this.tableProps.createCellCoords(-1,Math.max(e.to.col??0,0))).commit(),d&&u&&a?.add(this.tableProps.createCellCoords(-this.tableProps.countColHeaders(),-this.tableProps.countRowHeaders())).add(this.tableProps.createCellCoords(-1,-1)).commit()}setRangeFocus(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getLayerLevel();if(this.selectedRange.isEmpty())return;this.setActiveSelectionLayerIndex(t),this.#ru.setActiveLayerIndex(t),this.#rc.setActiveLayerIndex(t);let r=this.getActiveSelectedRange();if(this.inProgress||this.runLocalHooks("beforeSetFocus",e),!r)return;let n=this.highlight.getFocus();n.clear(),r.setHighlight(e),this.inProgress||this.runLocalHooks("beforeHighlightSet"),this.highlight.isEnabledFor("focus",r.highlight)&&n.add(r.highlight).commit().syncWith(r),this.inProgress||(this.#rg=!0,this.runLocalHooks("afterSetFocus",r.highlight))}transformStart(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!this.isSelected())return;let{visualCoords:n}=this.#ru.transformStart(e,t,r);this.setRangeStart(n,void 0,!1,n)}transformEnd(e,t){if(!this.isSelected())return;let{visualCoords:r,selectionLayer:n}=this.#ru.transformEnd(e,t);this.setRangeEnd(r,n)}transformFocus(e,t){if(!this.isSelected())return;let{selectionLayer:r,visualCoords:n}=this.#rc.transformStart(e,t);this.setRangeFocus(n.normalize(),r)}shiftRows(e,t){if(!this.isSelected())return;let r=this.getActiveSelectedRange();if(this.isSelectedByCorner())this.selectAll(!0,!0,{disableHeadersHighlight:!0});else if(r&&(this.isSelectedByColumnHeader()||(r.getOuterTopStartCorner().row??0)>=e)){let{from:n,to:o,highlight:i}=r,s=this.tableProps.countRows(),a=this.isSelectedByRowHeader(),l=this.isSelectedByColumnHeader(),h=l?-1:0,d=n.row===o.row,u=e=>dr(this.tableProps.rowIndexMapper,e,d);this.getSelectedRange().pop();let c=this.tableProps.createCellCoords(u(ox((n.row??0)+(l?0:t),h,s-1)),n.col??0),g=this.tableProps.createCellCoords(u(ox((o.row??0)+t,h,s-1)),o.col??0);this.markSource("shift"),(i.row??0)>=e?this.setRangeStartOnly(c,!0,this.tableProps.createCellCoords(u(ox((i.row??0)+t,0,s-1)),i.col??0)):this.setRangeStartOnly(c,!0),a&&this.selectedByRowHeader.add(this.getLayerLevel()),l&&this.selectedByColumnHeader.add(this.getLayerLevel()),this.setRangeEnd(g),this.markEndSource()}}shiftColumns(e,t){if(!this.isSelected())return;let r=this.getActiveSelectedRange();if(this.isSelectedByCorner())this.selectAll(!0,!0,{disableHeadersHighlight:!0});else if(r&&(this.isSelectedByRowHeader()||(r.getOuterTopStartCorner().col??0)>=e)){let{from:n,to:o,highlight:i}=r,s=this.tableProps.countCols(),a=this.isSelectedByRowHeader(),l=this.isSelectedByColumnHeader(),h=a?-1:0,d=n.col===o.col,u=e=>dr(this.tableProps.columnIndexMapper,e,d);this.getSelectedRange().pop();let c=this.tableProps.createCellCoords(n.row??0,u(ox((n.col??0)+(a?0:t),h,s-1))),g=this.tableProps.createCellCoords(o.row??0,u(ox((o.col??0)+t,h,s-1)));this.markSource("shift"),(i.col??0)>=e?this.setRangeStartOnly(c,!0,this.tableProps.createCellCoords(i.row??0,u(ox((i.col??0)+t,0,s-1)))):this.setRangeStartOnly(c,!0),a&&this.selectedByRowHeader.add(this.getLayerLevel()),l&&this.selectedByColumnHeader.add(this.getLayerLevel()),this.setRangeEnd(g),this.markEndSource()}}getLayerLevel(){return this.selectedRange.size()-1}isSelected(){return!this.selectedRange.isEmpty()}isMultiple(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.getActiveSelectedRange();if(!this.isSelected()||!e)return!1;let t=tC(!e.isSingle());return this.runLocalHooks("afterIsMultipleSelection",t),t.value}#rw(){return!(!0!==this.settings.moveCells||this.settings.disableVisualSelection||this.tableProps.isEditorOpened())&&!!this.tableProps.isPluginEnabled("moveCells")&&function(e){let{rangeCount:t,isEntireRow:r,isEntireColumn:n,isHeader:o}=e;return 1===t&&!r&&!n&&!o}({rangeCount:this.getSelectedRange().size(),isEntireRow:this.isEntireRowSelected(),isEntireColumn:this.isEntireColumnSelected(),isHeader:this.isSelectedByRowHeader()||this.isSelectedByColumnHeader()})}isRangeMovable(){let e=this.getActiveSelectedRange();return this.#rw()&&!!e&&!e.isSingle()}isSingleCellMovable(){let e=this.getActiveSelectedRange();return this.#rw()&&!!e&&e.isSingle()}isFocusSelectionChanged(){return this.isSelected()&&this.#rg}isSelectedByRowHeader(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.getLayerLevel();return!this.isSelectedByCorner()&&(-1===e?this.selectedByRowHeader.size>0:this.selectedByRowHeader.has(e))}isEntireRowSelected(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.getLayerLevel(),t=e=>{let{col:t}=e.getOuterTopStartCorner(),r=this.tableProps.countRowHeaders(),n=this.tableProps.countCols();return(r>0&&(t??0)<0||0===r)&&e.getWidth()===n};if(-1===e)return Array.from(this.selectedRange).some(e=>t(e));let r=this.selectedRange.peekByIndex(e);return!!r&&t(r)}isSelectedByColumnHeader(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.getLayerLevel();return!this.isSelectedByCorner()&&(-1===e?this.selectedByColumnHeader.size>0:this.selectedByColumnHeader.has(e))}isEntireColumnSelected(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.getLayerLevel(),t=e=>{let{row:t}=e.getOuterTopStartCorner(),r=this.tableProps.countColHeaders(),n=this.tableProps.countRows();return(r>0&&(t??0)<0||0===r)&&e.getHeight()===n};if(-1===e)return Array.from(this.selectedRange).some(e=>t(e));let r=this.selectedRange.peekByIndex(e);return!!r&&t(r)}isSelectedByAnyHeader(){return this.isSelectedByRowHeader(-1)||this.isSelectedByColumnHeader(-1)||this.isSelectedByCorner()}isSelectedByCorner(){return this.selectedByColumnHeader.has(this.getLayerLevel())&&this.selectedByRowHeader.has(this.getLayerLevel())}inInSelection(e){return this.selectedRange.includes(e)}getLayerContaining(e){if(this.selectedRange.isEmpty())return null;for(let t=this.selectedRange.size()-1;t>=0;t--)if(this.selectedRange.peekByIndex(t)?.includes(e))return t;return null}isCellCornerVisible(){return this.settings.fillHandle&&!this.tableProps.isEditorOpened()&&!this.isMultiple()}isCellVisible(e){let t=this.tableProps.visualToRenderableCoords(e);return null!==t.row&&null!==t.col}isAreaCornerVisible(e){return(!Number.isInteger(e)||e===this.getLayerLevel())&&this.settings.fillHandle&&!this.tableProps.isEditorOpened()&&this.isMultiple()}isAdjustHandlesVisibleFor(e){return!(!0!==this.settings.selectionHandles||this.tableProps.isEditorOpened()||!this.tableProps.isPluginEnabled("selectionHandles")||"single"===this.settings.selectionMode||this.#rC!==e||this.isEntireRowSelected(e)||this.isEntireColumnSelected(e))}getHandlesHoveredLayer(){return this.#rC}setHandlesHoveredLayer(e){this.#rC!==e&&(this.#rC=e,this.refresh())}clear(){this.selectedRange.clear(),this.highlight.clear()}deselect(){this.isSelected()&&(this.inProgress=!1,this.clear(),this.runLocalHooks("afterDeselect"))}selectAll(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{focusPosition:!1,disableHeadersHighlight:!1},n=this.tableProps.countRows(),o=this.tableProps.countCols(),i=this.tableProps.countRowHeaders(),s=this.tableProps.countColHeaders(),a=t?-s:0,l=e?-i:0;if(0===a&&0===l&&(0===n||0===o))return;let h=this.getActiveSelectedRange()?.highlight,{focusPosition:d,disableHeadersHighlight:u}=r;dt(d)&&(h=this.tableProps.createCellCoords(ox(d.row,a,n-1),ox(d.col,l,o-1)));let c=this.tableProps.createCellCoords(a,l),g=this.tableProps.createCellCoords(n-1,o-1);this.clear(),this.runLocalHooks("beforeSelectAll",c,g,h),this.setRangeStartOnly(c,void 0,h),this.#rp=u??!1,l<0&&this.selectedByRowHeader.add(this.getLayerLevel()),a<0&&this.selectedByColumnHeader.add(this.getLayerLevel()),this.setRangeEnd(g),this.runLocalHooks("afterSelectAll",c,g,h),this.finish()}selectCells(e){var t=this;let r=h8(e);if(1===r)return!1;0===r&&tr(ec`Unsupported format of the selection ranges was passed. To select cells pass\x20
        the coordinates as an array of arrays ([[rowStart, columnStart/columnPropStart, rowEnd,\x20
        columnEnd/columnPropEnd]]) or as an array of CellRange objects.`);let n=de(r,{createCellCoords:function(){for(var e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];return t.tableProps.createCellCoords(...r)},createCellRange:function(){for(var e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];return t.tableProps.createCellRange(...r)},propToCol:e=>this.tableProps.propToCol(e),keepDirection:!0}),o=this.settings.navigableHeaders,i={countRows:this.tableProps.countRows(),countCols:this.tableProps.countCols(),countRowHeaders:o?this.tableProps.countRowHeaders():0,countColHeaders:o?this.tableProps.countColHeaders():0},s=!e.some(e=>{let t=n(e),r=t.isValid(i);return!(r&&!t.containsHeaders()||r&&t.containsHeaders()&&t.isSingleHeader())});return s&&(this.clear(),this.setExpectedLayers(e.length),e.forEach(e=>{let{from:t,to:r}=n(e);this.setRangeStartOnly(t.clone(),!1),this.setRangeEnd(r.clone())}),this.finish()),s}selectColumns(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n="string"==typeof e?this.tableProps.propToCol(e):e,o="string"==typeof t?this.tableProps.propToCol(t):t,i=this.tableProps.countRows(),s=this.tableProps.countCols(),a=this.tableProps.countColHeaders(),l=0===a?0:-a,h=this.tableProps.createCellCoords(l,n),d=this.tableProps.createCellCoords(i-1,o),u=this.tableProps.createCellRange(h,h,d).isValid({countRows:i,countCols:s,countRowHeaders:0,countColHeaders:a});if(u){let e=0,t=0;dt(r)?(e=ox(r.row??0,l,i-1),t=ox(r.col??0,Math.min(n,o),Math.max(n,o))):(e=ox("number"==typeof r?r:0,l,i-1),t=n);let s=this.tableProps.createCellCoords(e,t),h=0===a?0:ox(s.row??0,l,-1),d=this.tableProps.createCellCoords(h,n),u=this.tableProps.createCellCoords(i-1,o);this.runLocalHooks("beforeSelectColumns",d,u,s),this.setRangeStartOnly(d,void 0,s),this.selectedByColumnHeader.add(this.getLayerLevel()),this.setRangeEnd(u),this.runLocalHooks("afterSelectColumns",d,u,s),"mouse"!==this.getSelectionSource()&&this.finish()}return u}selectRows(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=this.tableProps.countRows(),o=this.tableProps.countCols(),i=this.tableProps.countRowHeaders(),s=0===i?0:-i,a=this.tableProps.createCellCoords(e,s),l=this.tableProps.createCellCoords(t,o-1),h=this.tableProps.createCellRange(a,a,l).isValid({countRows:n,countCols:o,countRowHeaders:i,countColHeaders:0});if(h){let n=0,a=0;dt(r)?(n=ox(r.row??0,Math.min(e,t),Math.max(e,t)),a=ox(r.col??0,s,o-1)):(n=e,a=ox("number"==typeof r?r:0,s,o-1));let l=this.tableProps.createCellCoords(n,a),h=0===i?0:ox(l.col??0,s,-1),d=this.tableProps.createCellCoords(e,h),u=this.tableProps.createCellCoords(t,o-1);this.runLocalHooks("beforeSelectRows",d,u,l),this.setRangeStartOnly(d,void 0,l),this.selectedByRowHeader.add(this.getLayerLevel()),this.setRangeEnd(u),this.runLocalHooks("afterSelectRows",d,u,l),"mouse"!==this.getSelectionSource()&&this.finish()}return h}importSelection(e){let{ranges:t,activeRange:r,activeSelectionLayer:n,selectedByRowHeader:o,selectedByColumnHeader:i,disableHeadersHighlight:s}=e;0!==t.length&&(this.selectedRange.clear(),this.highlight.clear(),this.inProgress=!1,this.#rp=s,this.selectedByRowHeader=new Set(o),this.selectedByColumnHeader=new Set(i),this.setActiveSelectionLayerIndex(0),t.forEach((e,t)=>{this.selectedRange.push(e),this.applyAndCommit(e,t)}),this.setRangeFocus(r.highlight,n),this.#rp=!1,this.inProgress=!1)}exportSelection(){return{ranges:Array.from(this.selectedRange).map(e=>e.clone()),activeRange:this.getActiveSelectedRange(),activeSelectionLayer:this.getActiveSelectionLayerIndex(),selectedByRowHeader:Array.from(this.selectedByRowHeader),selectedByColumnHeader:Array.from(this.selectedByColumnHeader),disableHeadersHighlight:this.#rp}}refresh(){if(!this.isSelected())return;let e=this.tableProps.countRows(),t=this.tableProps.countCols();if(0===e||0===t)return void this.deselect();let r=this.selectedRange.ranges.map(e=>e.clone());"unknown"===this.getSelectionSource()&&this.markSource("refresh");let n=new Set(this.selectedByRowHeader),o=new Set(this.selectedByColumnHeader);this.clear(),this.setExpectedLayers(r.length),r.forEach(r=>{let{from:n,to:o,highlight:i}=r,s=e-1,a=t-1;i.assign({row:ox(i.row??0,this.settings.navigableHeaders?-1/0:0,s),col:ox(i.col??0,this.settings.navigableHeaders?-1/0:0,a)}),n.assign({row:ox(n.row??0,-1/0,s),col:ox(n.col??0,-1/0,a)}),o.assign({row:ox(o.row??0,-1/0,s),col:ox(o.col??0,-1/0,a)}),this.setRangeStartOnly(n,!0,i),this.setRangeEnd(o)}),this.selectedByRowHeader=n,this.selectedByColumnHeader=o,this.finish(),this.markEndSource()}commit(){if(this.highlight.getCustomSelections().forEach(e=>{e.commit()}),!this.isSelected())return;let e=this.getLayerLevel(),t=this.getActiveSelectedRange();t&&this.highlight.isEnabledFor("focus",t.highlight)&&this.highlight.getFocus().commit().syncWith(t);for(let e=0;e<this.selectedRange.size();e+=1){this.highlight.useLayerLevel(e);let t=this.highlight.createArea(),r=this.highlight.createLayeredArea(),n=this.highlight.createRowHeader(),o=this.highlight.createColumnHeader(),i=this.highlight.createActiveRowHeader(),s=this.highlight.createActiveColumnHeader(),a=this.highlight.createActiveCornerHeader(),l=this.highlight.createRowHighlight(),h=this.highlight.createColumnHighlight();t?.commit(),r?.commit(),n?.commit(),o?.commit(),i?.commit(),s?.commit(),a?.commit(),l?.commit(),h?.commit()}this.highlight.useLayerLevel(e)}}th(dn,ab);let{register:di,getItem:ds,hasItem:da,getNames:dl,getValues:dh}=nU("cellTypes");function dd(e){return da(e)||tr(`You declared cell type "${e}" as a string that is not mapped to a known object.
                 Cell type must be an object or a string mapped to an object registered by
                 "Handsontable.cellTypes.registerCellType" method`),ds(e)}function du(e,t){"string"!=typeof e&&(e=(t=e).CELL_TYPE);let{editor:r,renderer:n,validator:o}=t;r&&nZ(e,r),n&&oJ(e,n),o&&o4(e,o),di(e,t)}function dc(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,n="string"==typeof t.type?dd(t.type):t.type;if(e._automaticallyAssignedMetaProps&&tp(t,(t,r)=>{e._automaticallyAssignedMetaProps.delete(r)}),!tc(n))return;r!==e||e._automaticallyAssignedMetaProps||(e._automaticallyAssignedMetaProps=new Set);let o={};tp(n,(t,n)=>{"CELL_TYPE"!==n&&(r._automaticallyAssignedMetaProps?.has(n)||!ty(r,n))&&(o[n]=t,e._automaticallyAssignedMetaProps?.add(n))}),ti(e,o)}let dg=()=>({_automaticallyAssignedMetaProps:void 0,_userDefinedMetaProps:void 0,_persistedMetaProps:void 0,activeHeaderClassName:"ht__active_highlight",allowEmpty:!0,allowHtml:!1,allowInsertColumn:!0,allowInsertRow:!0,allowInvalid:!0,allowRemoveColumn:!0,allowRemoveRow:!0,ariaTags:!0,autoColumnSize:void 0,autoRowSize:void 0,autoWrapCol:!1,autoWrapRow:!1,bindRowsWithHeaders:void 0,cell:[],cells:void 0,checkedTemplate:void 0,className:void 0,colHeaders:null,collapsibleColumns:void 0,columnHeaderHeight:void 0,columns:void 0,columnSorting:void 0,columnSummary:void 0,colWidths:void 0,commentedCellClassName:"htCommentCell",comments:!1,contextMenu:void 0,copyable:!0,copyPaste:!0,currentColClassName:void 0,currentHeaderClassName:"ht__highlight",currentRowClassName:void 0,customBorders:!1,customBordersProgressive:!1,data:void 0,dataProvider:void 0,dataDotNotation:!0,dataSchema:void 0,dateFormat:{year:"numeric",month:"2-digit",day:"2-digit"},timeFormat:{hour:"2-digit",minute:"2-digit"},dateTimeFormat:{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1},defaultDate:void 0,disableVisualSelection:!1,dialog:!1,dragToScroll:!0,dropdownMenu:void 0,editor:void 0,emptyDataState:!1,enterBeginsEditing:!0,enterCommits:!0,enterMoves:{col:0,row:1},exportFile:void 0,fillHandle:{autoInsertRow:!1},filter:!0,filteringCaseSensitive:!1,filters:void 0,filterSelectedItems:!0,fixedColumnsLeft:0,fixedColumnsStart:0,fixedRowsBottom:0,fixedRowsTop:0,formulas:void 0,fragmentSelection:!1,hashLength:void 0,hashRevealDelay:void 0,hashSymbol:"*",headerClassName:void 0,height:void 0,hiddenColumns:void 0,hiddenRows:void 0,initialState:void 0,invalidCellClassName:"htInvalid",imeFastEdit:!1,isEmptyCol(e){let t,r,n=!!this.getSettings().dataSchema,o=this.getSchema(),i=this.colToProp(e),s=this.countRows();for(t=0;t<s;t++)if(!1===eP(r=this.getDataAtCell(t,e))){if("object"==typeof r){if(!1===td(o[i],r))return!1;continue}if(n&&o[i]===r)continue;return!1}return!0},isEmptyRow(e){let t,r,n=!!this.getSettings().dataSchema,o=this.getSchema(),i=this.countCols();for(t=0;t<i;t++)if(!1===eP(r=this.getDataAtCell(e,t))){let e=this.colToProp(t);if("object"==typeof r){if(!1===td(o[e],r))return!1;continue}if(n&&o[e]===r)continue;return!1}return!0},label:void 0,language:"en-US",layoutDirection:"inherit",layout:void 0,licenseKey:void 0,locale:"en-US",loading:!1,notification:!1,manualColumnFreeze:void 0,manualColumnMove:void 0,manualColumnResize:void 0,manualRowMove:void 0,manualRowResize:void 0,maxCols:1/0,maxRows:1/0,maxSelections:void 0,mergeCells:!1,minCols:0,minRowHeights:void 0,minRows:0,minSpareCols:0,minSpareRows:0,multiColumnSorting:void 0,navigableHeaders:!1,tabNavigation:!0,nestedHeaders:void 0,nestedRows:void 0,noWordWrapClassName:"htNoWrap",numericFormat:void 0,preserveNumericLiteral:!1,observeDOMVisibility:!0,outsideClickDeselects:!0,pagination:void 0,placeholder:void 0,placeholderCellClassName:"htPlaceholder",preventOverflow:!1,preventWheel:!1,readOnly:!1,readOnlyCellClassName:"htDimmed",renderAllRows:!1,renderAllColumns:!1,renderer:void 0,valueFormatter:void 0,valueParser:void 0,rowHeaders:void 0,rowHeaderWidth:void 0,rowHeights:void 0,search:!1,searchInput:!0,selectionMode:"multiple",selectionHandles:!1,moveCells:!1,selectOptions:void 0,skipColumnOnPaste:!1,skipRowOnPaste:!1,sortByRelevance:!0,sourceSortFunction:void 0,source:void 0,startCols:5,startRows:5,stretchH:"none",strict:void 0,tableClassName:void 0,textEllipsis:!1,themeName:void 0,theme:void 0,colorScheme:void 0,density:void 0,injectCoreCss:!0,tabMoves:{row:0,col:1},title:void 0,trimDropdown:!0,trimRows:void 0,trimWhitespace:!0,type:"text",uncheckedTemplate:void 0,undo:!0,validator:void 0,sourceDataValidator:void 0,sourceDataWarningMessage:void 0,valueGetter:void 0,valueSetter:void 0,viewportColumnRenderingOffset:"auto",viewportRowRenderingOffset:"auto",viewportColumnRenderingThreshold:0,viewportRowRenderingThreshold:0,visibleRows:10,width:void 0,wordWrap:!0,sanitizer:void 0,parsePastedValue:!1});class dp{metaCtor=class{};constructor(e){this.meta=this.metaCtor.prototype,ti(this.meta,dg()),this.meta.instance=e}getMetaConstructor(){return this.metaCtor}getMeta(){return this.meta}updateMeta(e){ti(this.meta,e),dc(this.meta,{...e,type:e.type??this.meta.type},e)}}class dm{constructor(e){const t=e.getMetaConstructor();this.meta=new t}getMeta(){return this.meta}updateMeta(e){ti(this.meta,e),dc(this.meta,e,e)}}function df(e){oH(e)||null==e||tr("Assertion failed: Expecting an unsigned number or null/undefined argument.")}class db{#rS=new Map;#tV=0;#rv=[];#rR=0;#rE=-1;#rT=!0;#rA=!1;constructor(e){this.valueFactory=e}obtain(e){oH(e)||tr("Assertion failed: Expecting an unsigned number.");let t=e;this.#rv.length>0&&-1===(t=this.#rM(e))&&(this.#rI(),t=e);let r=this.#rS.get(t);if(void 0===r){r=this.valueFactory(e),this.#rS.set(t,r),e>=this.#tV&&(this.#tV=e+1);let n=t>e?t:e;n>=this.#rR&&(this.#rR=n+1),t>this.#rE?this.#rE=t:this.#rT=!1}return r}has(e){return void 0!==this.getIfExists(e)}insert(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;df(e);let r=null==e?this.#tV:e;this.#tV+=t,r>=this.#rR||(this.#rR+=t,this.#rx({start:r,amount:t,isInsert:!0}))}remove(e){let t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(df(e),null==e){let e=this.#tV-r;t=e<0?Math.max(this.#tV+e,0):e}else t=e;let n=Math.max(Math.min(this.#tV-t,r),0),o=t>=this.#rR;this.#tV-=n,this.#rR>this.#tV&&(this.#rR=this.#tV),o||this.#rx({start:t,amount:r,isInsert:!1})}size(){return this.#rv.length>0&&this.#rI(),this.#rS.size}values(){return this.#rv.length>0&&this.#rI(),this.#rA=!0,this.#rS.values()}entries(){return this.#rv.length>0&&this.#rI(),this.#rA=!0,this.#rS.entries()}evict(e){if(this.#rv.length>0){let t=this.#rM(e);-1!==t&&this.#rS.delete(t);return}this.#rS.delete(e)}getIfExists(e){if(this.#rv.length>0){let t=this.#rM(e);return -1===t?void 0:this.#rS.get(t)}return this.#rS.get(e)}clear(){this.#rS.clear(),this.#rv=[],this.#tV=0,this.#rR=0,this.#rE=-1,this.#rT=!0,this.#rA=!1}#rx(e){let t=this.#rv,r=t.length>0?t[t.length-1]:void 0;!(void 0!==r&&r.isInsert===e.isInsert&&this.#rN(r,e))&&(t.push(e),t.length>=1024&&this.#rI())}#rN(e,t){return t.isInsert?t.start>=e.start&&t.start<=e.start+e.amount&&(e.amount+=t.amount,!0):t.start===e.start?(e.amount+=t.amount,!0):t.start+t.amount===e.start&&(e.start=t.start,e.amount+=t.amount,!0)}#rM(e){let t=this.#rv,r=e;for(let e=t.length-1;e>=0;e--){let{start:n,amount:o,isInsert:i}=t[e];if(i){if(r>=n+o)r-=o;else if(r>=n)return -1}else r>=n&&(r+=o)}return r}#rI(){let e=this.#rv;if(this.#rv=[],1===e.length&&!e[0].isInsert&&!this.#rA&&this.#rT&&this.#rE===this.#rS.size-1)return void this.#rO(e[0].start,e[0].amount);let t=Array(e.length),r=1/0;for(let n=e.length-1;n>=0;n--)e[n].start<r&&(r=e[n].start),t[n]=r;let n=!1;for(let e of this.#rS.keys())if(e>=r){n=!0;break}if(!n)return;let o=new Map,i=-1,s=!0,a=-1;for(let[r,n]of this.#rS){let l=this.#rk(r,e,t);-1!==l&&(o.set(l,n),l>i&&(i=l),l<=a&&(s=!1),a=l)}this.#rS=o,this.#rA=!1,this.#rR=i+1,this.#rE=i,this.#rT=s}#rO(e,t){let r=this.#rS,n=r.size,o=Math.max(n-t,e);for(let n=e;n<o;n++)r.set(n,r.get(n+t));for(let e=o;e<n;e++)r.delete(e);this.#rE=o-1,this.#rR=o}#rk(e,t,r){let n=e;for(let e=0;e<t.length&&!(n<r[e]);e++){let{start:r,amount:o,isInsert:i}=t[e];if(i)n>=r&&(n+=o);else if(n>=r+o)n-=o;else if(n>=r)return -1}return n}[Symbol.iterator](){return this.entries()}}let dC=["data","width"];class dy{metas=new db(()=>this._createMeta());constructor(e){this.globalMeta=e,this.metas=new db(()=>this._createMeta())}updateMeta(e,t){let r=this.getMeta(e);ti(r,t),dc(r,t)}createColumn(e,t){this.metas.insert(e,t)}removeColumn(e,t){this.metas.remove(e,t)}getMeta(e){return this.metas.obtain(e)}getMetaConstructor(e){return this.metas.obtain(e).constructor}clearCache(){this.metas.clear()}_createMeta(){return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];function r(){}to(r,e);for(let e=0;e<t.length;e++)r.prototype[t[e]]=void 0;return r}(this.globalMeta.getMetaConstructor(),dC).prototype}}class dw{metas=new db(()=>this._createRow());#rH=0;constructor(e){this.columnMeta=e}enableUserDefinedMetaRecording(){this.#rH>0&&(this.#rH-=1)}disableUserDefinedMetaRecording(){this.#rH+=1}updateMeta(e,t,r){let n=this.getMeta(e,t);ti(n,r),dc(n,r)}createRow(e,t){this.metas.insert(e,t)}createColumn(e,t){for(let[,r]of this.metas)r.insert(e,t)}removeRow(e,t){this.metas.remove(e,t)}removeColumn(e,t){for(let[,r]of this.metas)r.remove(e,t)}getMeta(e,t,r){let n=this.metas.obtain(e).obtain(t);return void 0===r?n:n[r]}hasMeta(e,t){return this.metas.has(e)&&this.metas.obtain(e).has(t)}getMetaIfExists(e,t){return this.metas.getIfExists(e)?.getIfExists(t)}createTransientMeta(e){return this._createMeta(e)}setMeta(e,t,r,n){let o=this.metas.obtain(e).obtain(t);o._automaticallyAssignedMetaProps?.delete(r),o[r]=n,void 0===o._persistedMetaProps&&(o._persistedMetaProps=new Set),o._persistedMetaProps.add(r),0===this.#rH?(void 0===o._userDefinedMetaProps&&(o._userDefinedMetaProps=new Set),o._userDefinedMetaProps.add(r)):o._userDefinedMetaProps?.delete(r)}removeMeta(e,t,r){let n=this.metas.getIfExists(e)?.getIfExists(t);void 0!==n&&(delete n[r],n._userDefinedMetaProps?.delete(r),n._persistedMetaProps?.delete(r))}getMetas(){let e=[],t=Array.from(this.metas.values());for(let r=0;r<t.length;r++)e_(t[r])&&e.push(...Array.from(t[r].values()));return e}getMetasAtRow(e){oH(e)||tr("Assertion failed: Expecting an unsigned number.");let t=this.metas.getIfExists(e);return void 0===t?[]:Array.from(t).sort((e,t)=>{let[r]=e,[n]=t;return r-n}).map(e=>{let[,t]=e;return t})}getUserDefinedMetas(){let e=[];for(let[t,r]of this.metas)for(let[n,o]of r){let r=o._userDefinedMetaProps;void 0!==r&&r.forEach(r=>{ty(o,r)&&e.push({physicalRow:t,physicalColumn:n,key:r,value:o[r]})})}return e}evictRow(e){let t=this.metas.getIfExists(e);if(void 0===t)return[];let r=!1,n=[];for(let[e,o]of t){let i=o._persistedMetaProps,s=void 0!==i&&i.size>0,a=!1===o.valid;s||a?r=!0:(t.evict(e),n.push(e))}return r||this.metas.evict(e),n}clearCache(){this.metas.clear()}_createRow(){return new db(e=>this._createMeta(e))}_createMeta(e){return new(this.columnMeta.getMetaConstructor(e))}}class dS{constructor(e,t={},r=[]){this.hot=e,this.globalMeta=new dp(e),this.tableMeta=new dm(this.globalMeta),this.columnMeta=new dy(this.globalMeta),this.cellMeta=new dw(this.columnMeta),r.forEach(e=>new e(this)),this.globalMeta.updateMeta(t)}getGlobalMeta(){return this.globalMeta.getMeta()}updateGlobalMeta(e){this.globalMeta.updateMeta(e)}getTableMeta(){return this.tableMeta.getMeta()}updateTableMeta(e){this.tableMeta.updateMeta(e)}getColumnMeta(e){return this.columnMeta.getMeta(e)}updateColumnMeta(e,t){this.columnMeta.updateMeta(e,t)}getCellMeta(e,t,r){let n=this.cellMeta.getMeta(e,t);return n.visualRow=r.visualRow,n.visualCol=r.visualColumn,n.row=e,n.col=t,r.skipMetaExtension||this.runLocalHooks("afterGetCellMeta",n),n}getCellMetaUncached(e,t,r){let n=this.cellMeta.getMetaIfExists(e,t)??this.cellMeta.createTransientMeta(t);return n.visualRow=r.visualRow,n.visualCol=r.visualColumn,n.row=e,n.col=t,n}getCellMetaTransient(e,t,r){let n=this.cellMeta.getMetaIfExists(e,t);if(void 0!==n)return n.visualRow=r.visualRow,n.visualCol=r.visualColumn,n.row=e,n.col=t,this.runLocalHooks("afterGetCellMeta",n),n;let o=this.cellMeta.createTransientMeta(t);return o.visualRow=r.visualRow,o.visualCol=r.visualColumn,o.row=e,o.col=t,this.runLocalHooks("extendTransientCellMeta",o),o}getCellMetaKeyValue(e,t,r){return"string"!=typeof r&&tr("The passed cell meta object key is not a string"),this.cellMeta.getMeta(e,t,r)}setCellMeta(e,t,r,n){this.cellMeta.setMeta(e,t,r,n)}updateCellMeta(e,t,r){this.cellMeta.updateMeta(e,t,r)}removeCellMeta(e,t,r){this.cellMeta.removeMeta(e,t,r)}getCellsMeta(){return this.cellMeta.getMetas()}getCellsMetaAtRow(e){return this.cellMeta.getMetasAtRow(e)}getUserDefinedCellMetas(){return this.cellMeta.getUserDefinedMetas()}enableUserDefinedMetaRecording(){this.cellMeta.enableUserDefinedMetaRecording()}disableUserDefinedMetaRecording(){this.cellMeta.disableUserDefinedMetaRecording()}createRow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;this.cellMeta.createRow(e,t)}removeRow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;this.cellMeta.removeRow(e,t)}createColumn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;this.cellMeta.createColumn(e,t),this.columnMeta.createColumn(e,t)}removeColumn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;this.cellMeta.removeColumn(e,t),this.columnMeta.removeColumn(e,t)}clearCellsCache(){this.cellMeta.clearCache()}clearCache(){this.cellMeta.clearCache(),this.columnMeta.clearCache()}}th(dS,ab);class dv{metaSyncMemo=new Map;#r_=0;#rL=0;#rP=!1;constructor(e){this.metaManager=e,e.addLocalHook("afterGetCellMeta",e=>{this.extendCellMeta(e)}),e.addLocalHook("extendTransientCellMeta",e=>{this.extendTransientCellMeta(e)}),nF.getSingleton().add("beforeRender",e=>{e&&this.metaSyncMemo.clear()},this.metaManager.hot);const t=()=>this.#rD();nF.getSingleton().add("afterScrollVertically",t,this.metaManager.hot),nF.getSingleton().add("afterViewRender",t,this.metaManager.hot)}extendCellMeta(e){let t=e.row,r=e.col;if(this.metaSyncMemo.get(t)?.has(r))return;this.#rF(e,e=>{this.metaManager.updateCellMeta(t,r,e)});let n=this.metaSyncMemo.get(t);void 0===n&&(n=new Set,this.metaSyncMemo.set(t,n)),n.add(r)}extendTransientCellMeta(e){this.#rF(e,t=>{ti(e,t),dc(e,t)})}#rF(e,t){let r=e.row,n=e.col,o=e.visualRow,i=e.visualCol,s=this.metaManager.hot,a=s.colToProp(i);e.prop=a,s.runHooks("beforeGetCellMeta",o,i,e);let l=ty(e,"type")?e.type:null,h=na(e.cells)?e.cells(r,n,a):null;l&&(h?h.type=h.type??l:h={type:l}),h&&t(h),s.runHooks("afterGetCellMeta",o,i,e)}#rD(){let e=this.metaManager.hot,t=e.getFirstRenderedVisibleRow(),r=e.getLastRenderedVisibleRow();if(!Number.isInteger(t)||!Number.isInteger(r)||r<t)return;let n=r-t+1,o=t-n,i=r+n,s=this.#r_,a=this.#rL;this.#rP&&(this.#rB(s,Math.min(a,o-1)),this.#rB(Math.max(s,i+1),a)),this.#r_=o,this.#rL=i,this.#rP=!0}#rB(e,t){if(e>t)return;let r=this.metaManager.hot,n=r.getSelectedRangeLast(),o=n?n.highlight.row:null;for(let n=e;n<=t;n++){let e=r.toPhysicalRow(n);n!==o&&Number.isInteger(e)&&this.#rV(e)}}#rV(e){let t=this.metaManager.cellMeta.evictRow(e);if(0===t.length)return;let r=this.metaSyncMemo.get(e);if(void 0!==r){for(let e=0;e<t.length;e++)r.delete(t[e]);0===r.size&&this.metaSyncMemo.delete(e)}}}class dR{metaManager;usageTracker=new Set;propDescriptors=new Map([["ariaTags",{initOnly:!0}],["fixedColumnsLeft",{target:"fixedColumnsStart",onChange(e){this.metaManager.hot.isRtl()&&"fixedColumnsLeft"===e&&tr("The `fixedColumnsLeft` is not supported for RTL. Please use option `fixedColumnsStart`."),this.usageTracker.has("fixedColumnsLeft")&&this.usageTracker.has("fixedColumnsStart")&&tr("The `fixedColumnsLeft` and `fixedColumnsStart` should not be used together. Please use only the option `fixedColumnsStart`.")}}],["layoutDirection",{initOnly:!0}],["renderAllColumns",{initOnly:!0}],["renderAllRows",{initOnly:!0}]]);constructor(e){this.metaManager=e,this.extendMetaProps()}#rU=(e,t,r)=>{r||tr(`The \`${e}\` option can not be updated after the Handsontable is initialized.`)};extendMetaProps(){this.propDescriptors.forEach((e,t)=>{let{initOnly:r,target:n,onChange:o}=e,i="string"==typeof n,s=i?n:t,a=`_${s}`;this.metaManager.globalMeta.meta[a]=this.metaManager.globalMeta.meta[s],o?(this.installPropWatcher(t,a,o),i&&this.installPropWatcher(n,a,o)):r&&(this.installPropWatcher(t,a,this.#rU),this.metaManager.globalMeta.meta._initOnlySettings||(this.metaManager.globalMeta.meta._initOnlySettings=[]),this.metaManager.globalMeta.meta._initOnlySettings.push(t))})}installPropWatcher(e,t,r){let{usageTracker:n}=this,o=r.bind(this);Object.defineProperty(this.metaManager.globalMeta.meta,e,{get(){return this[t]},set(r){let i=!n.has(e);n.add(e),o(e,r,i),this[t]=r},enumerable:!0,configurable:!0})}}let dE=class{dataType="array";colToProp=e=>void 0;propToCol=e=>void 0;countCachedColumns;constructor(e,t=[]){this.hot=e,this.data=t}modifyRowData(e){let t;return this.hot.hasHook("modifyRowData")&&(t=this.hot.runHooks("modifyRowData",e)),void 0===t||Number.isInteger(t)?this.data[e]:t}getData(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.data?.length?e||this.hot.hasHook("modifySourceData")||this.hot.hasHook("modifyRowData")?this.getByRange(null,null,e):this.data.map(af):this.data}setData(e){this.data=e}getAtColumn(e){let t=[];return J(this.data,(r,n)=>{let o=this.getAtCell(n,e);t.push(o)}),t}getAtRow(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=void 0===t&&void 0===r,{dataDotNotation:i}=this.hot.getSettings(),s=null,a=null;if(Array.isArray(s=this.modifyRowData(e)))a=[],o?s.forEach((t,r)=>{a[r]=this.getAtPhysicalCell(e,r,s)}):oA(t,r,r=>{a[r-t]=this.getAtPhysicalCell(e,r,s)});else if(tc(s)||na(s))if(a=n?[]:{},!o||n){let o=this.countFirstRowKeys()-1;oA(0,o,l=>{let h=this.colToProp(l);if(l>=(t||0)&&l<=(r||o)&&!Number.isInteger(h)){let t=this.getAtPhysicalCell(e,h,s);n?a.push(t):i?null!==a&&tf(a,h,t):a[h]=t}})}else tp(s,(t,r)=>{let n=this.getAtPhysicalCell(e,r,s);i?null!==a&&tf(a,r,n):a[r]=n});return a}setAtCell(e,t,r){let n;if("string"==typeof e){let t=Number(e);if(Number.isNaN(t)||!Number.isInteger(t)||t<0)return;n=t}else{if("number"!=typeof e||!Number.isInteger(e)||e<0)return;n=e}if(n>=this.countRows()||"number"==typeof t&&t>=this.countFirstRowKeys())return;if(this.hot.hasHook("modifySourceData")){let e=tC(r);this.hot.runHooks("modifySourceData",n,t,e,"set"),e.isTouched()&&(r=e.value)}let o=this.modifyRowData(n);if(Number.isInteger(t))Array.isArray(o)?o[t]=r:tc(o)&&tf(o,String(t),r);else if(Array.isArray(o)){let e=Number(t);!Number.isNaN(e)&&Number.isInteger(e)&&e>=0&&e<this.countFirstRowKeys()&&(o[e]=r)}else tc(o)&&tf(o,String(t),r)}getAtPhysicalCell(e,t,r){let n=null;if(r)if("string"==typeof t){let{dataDotNotation:e}=this.hot.getSettings();n=e?tm(r,t):r[t]}else n="function"==typeof t?t(r):r[t];if(this.hot.hasHook("modifySourceData")){let r=tC(n);this.hot.runHooks("modifySourceData",e,t,r,"get"),r.isTouched()&&(n=r.value)}return n}getAtCell(e,t){let r=this.modifyRowData(e);return this.getAtPhysicalCell(e,this.colToProp(t),r)}getByRange(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=!1,o=null,i=null,s=null,a=null;null===e||null===t?(n=!0,o=0,s=this.countRows()-1):(o=Math.min(e.row,t.row),i=Math.min(e.col,t.col),s=Math.max(e.row,t.row),a=Math.max(e.col,t.col));let l=[];return oA(o,s,e=>{l.push(n?this.getAtRow(e,void 0,void 0,r):this.getAtRow(e,i,a,r))}),l}getCopyable(e,t){let r=this.propToCol(t);return"number"==typeof r&&this.hot.getCellMetaTransient(e,r).copyable?this.getAtCell(this.hot.toPhysicalRow(e),r):""}countRows(){if(this.hot.hasHook("modifySourceLength")){let e=this.hot.runHooks("modifySourceLength");if("number"==typeof e&&Number.isInteger(e))return e}return this.data.length}countFirstRowKeys(){return ag(this.data??[])}destroy(){this.data=null,this.hot=null}},dT=/^(\r\n|\n\r|\r|\n)/,dA=/^[^\t\r\n]+/,dM=/^\t/;function dI(e){let t,r,n,o,i,s="";for(t=0,r=e.length;t<r;t+=1){for(n=0,o=e[t].length;n<o;n+=1)n>0&&(s+="	"),"string"==typeof(i=e[t][n])?i.indexOf("\n")>-1?s+=`"${i.replaceAll('"','""')}"`:s+=i:null==i?s+="":s+=i;t!==r-1&&(s+="\n")}return s}class dx{static get DESTINATION_RENDERER(){return 1}static get DESTINATION_CLIPBOARD_GENERATOR(){return 2}tableMeta;constructor(e,t,r){this.hot=e,this.metaManager=r,this.tableMeta=r.getTableMeta(),this.dataSource=t,this.colToPropCache=[],this.propToColCache=new Map,this.refreshDuckSchema(),this.createMap()}createMap(){let e=this.getSchema();void 0===e&&tr("trying to create `columns` definition but you didn't provide `schema` nor `data`");let t=this.tableMeta.columns;this.colToPropCache=[],this.propToColCache=new Map,t?this.#rz(t,e):this.recursiveDuckColumns(e)}#rz(e,t){let r=0,n=0,o="function"==typeof e;if(o){let e=tb(t);r=e>0?e:this.countFirstRowKeys()}else r=Math.min(this.tableMeta.maxCols??1/0,e.length);for(let t=0;t<r;t++){let r=o?e(t):e[t];if(tc(r)){if(void 0!==r.data){let e=o?n:t,i=r.data;this.colToPropCache[e]=i,this.propToColCache.set(i,e)}n+=1}}}countFirstRowKeys(){return ag(this.dataSource??[])}recursiveDuckColumns(e,t,r){let n,o=t??0,i=r??"";return"object"!=typeof e||null===e||Array.isArray(e)||tp(e,(e,t)=>{null===e?(n=i+t,this.colToPropCache.push(n),this.propToColCache.set(n,o),o+=1):"object"==typeof e&&null!==e&&(o=this.recursiveDuckColumns(e,o,`${t}.`))}),o}colToProp(e){if(!1===Number.isInteger(e))return e;let t=this.hot.toPhysicalColumn(e);return null===t?e:this.colToPropCache&&e_(this.colToPropCache[t])?this.colToPropCache[t]:t}propToCol(e){let t=this.propToColCache.get(e);if(void 0!==t)return this.hot.toVisualColumn(t);if("number"!=typeof e)return e;let r=this.hot.toVisualColumn(e);return null!==r?r:e}getSchema(){let e=this.tableMeta.dataSchema;return e?"function"==typeof e?e():e:this.duckSchema}createDuckSchema(){return this.dataSource&&this.dataSource[0]?tn(this.dataSource[0]):{}}refreshDuckSchema(){this.duckSchema=this.createDuckSchema()}createRow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,{source:r,mode:n="above"}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=this.hot.countSourceRows(),i=o,s=0,a=e;if(("number"!=typeof a||a>=o)&&(a=o),a<this.hot.countRows()&&(i=this.hot.toPhysicalRow(a)),!1===this.hot.runHooks("beforeCreateRow",a,t,r)||null===i)return{delta:0};let l=this.tableMeta.maxRows,h=this.getSchema().length,d=[];for(;s<t&&o+s<(l??1/0);){let e=null;if("array"===this.hot.dataType)this.tableMeta.dataSchema?e=ta(this.getSchema()):(e=[],oA(h-1,()=>e.push(null)));else if("function"===this.hot.dataType){let t=this.tableMeta.dataSchema;"function"!=typeof t&&tr("`dataSchema` must be a function when `dataType` is `function`"),e=t(a+s)}else ts(e={},this.getSchema());d.push(e),s+=1}this.hot.rowIndexMapper.insertIndexes(a,s),"below"===n&&(i=Math.min(i+1,o)),this.spliceData(i,0,d);let u=this.hot.toVisualRow(i);return this.hot.countSourceRows()===d.length&&this.hot.columnIndexMapper.initToLength(this.hot.getInitialColumnCount()),s>0&&(null==e?this.metaManager.createRow(null,s):"auto"!==r&&this.metaManager.createRow(i,t)),this.hot.runHooks("afterCreateRow",u,s,r),{delta:s,startPhysicalIndex:i}}createCol(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,{source:r,mode:n="start"}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.hot.isColumnModificationAllowed()||tr("Cannot create new column. When data source in an object, you can only have as much columns as defined in first data row, data schema or in the 'columns' setting.If you want to be able to add new columns, you have to use array datasource.");let o=this.dataSource??[],i=this.tableMeta.maxCols,s=this.hot.countSourceCols(),a=this.hot.countCols(),l=this.hot.countSourceRows(),h="number"==typeof e&&e<=s?e:a;if(!1===this.hot.runHooks("beforeCreateCol",h,t,r))return{delta:0};let d=h<a?this.hot.toPhysicalColumn(h):s,u="end"===n?Math.min(d+1,s):d,c=Math.max(0,Math.min(t,(i??1/0)-a));return this.#rW(o,u,h,a,l,c),c>0&&(null==e?this.metaManager.createColumn(null,c):"auto"!==r&&this.metaManager.createColumn(u,t)),this.hot.columnIndexMapper.insertIndexes(h,c,n),this.hot.runHooks("afterCreateCol",this.hot.toVisualColumn(u),c,r),this.refreshDuckSchema(),{delta:c,startPhysicalIndex:u}}#rW(e,t,r,n,o,i){if(i<=0)return;let s=i;"number"==typeof r&&(s=Math.max(0,Math.min(i,r-n+1)));let a=i-s;if(s>0)if(o>0)for(let t=0;t<o;t++){void 0===e[t]&&(e[t]=[]);for(let r=0;r<s;r++)e[t].push(null)}else for(let t=0;t<s;t++)e.push([null]);if(a>0)for(let r=0;r<o;r++)ei(e[r],t+s,a,null)}removeRow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2?arguments[2]:void 0,n=Number.isInteger(e)?e:-t,o=this.visualRowsToPhysical(n,t),i=this.hot.countRows();if(n=(i+n)%i,!1===this.hot.runHooks("beforeRemoveRow",n,o.length,o,r))return!1;let s=o.length;if(this.filterData(n,s,o),n<this.hot.countRows()){this.hot.rowIndexMapper.removeIndexes(o);let e=e_(this.tableMeta.columns)||e_(this.tableMeta.dataSchema)||this.tableMeta.colHeaders;0!==this.hot.rowIndexMapper.getNotTrimmedIndexesLength()||e||this.hot.columnIndexMapper.setIndexesSequence([])}let a=o.slice(0).sort((e,t)=>t-e);return this.#rG(a,(e,t)=>{this.metaManager.removeRow(e,t)}),this.hot.runHooks("afterRemoveRow",n,s,o,r),!0}removeCol(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2?arguments[2]:void 0;("object"===this.hot.dataType||this.tableMeta.columns)&&tr("cannot remove column with object data source or columns option specified");let n="number"!=typeof e?-t:e;n=(this.hot.countCols()+n)%this.hot.countCols();let o=this.visualColumnsToPhysical(n,t),i=o.slice(0).sort((e,t)=>t-e);if(!1===this.hot.runHooks("beforeRemoveCol",n,t,o,r))return!1;let s=!0,a=i.length,l=this.dataSource??[];for(let e=0;e<a;e++)s&&o[0]!==o[e]-e&&(s=!1);return this.#r$(l,s,o,i,t),n<this.hot.countCols()&&(this.hot.columnIndexMapper.removeIndexes(o),this.tableMeta.rowHeaders||0!==this.hot.columnIndexMapper.getNotTrimmedIndexesLength()||this.hot.rowIndexMapper.setIndexesSequence([])),this.hot.runHooks("afterRemoveCol",n,t,o,r),this.refreshDuckSchema(),!0}#r$(e,t,r,n,o){if(t)for(let t=0,n=this.hot.countSourceRows();t<n;t++)e[t].splice(r[0],o),0===t&&this.metaManager.removeColumn(r[0],o);else{let t=new Set(r),o=this.hot.countSourceRows();for(let r=0;r<o;r++)eo(e[r],t);o>0&&this.#rG(n,(e,t)=>{this.metaManager.removeColumn(e,t)})}}#rG(e,t){let r=0;for(let n=0;n<e.length;n++)(n+1>=e.length||e[n+1]!==e[n]-1)&&(t(e[n],n-r+1),r=n+1)}spliceCol(e,t,r){for(var n=arguments.length,o=Array(n>3?n-3:0),i=3;i<n;i++)o[i-3]=arguments[i];let s=this.hot.getDataAtCol(e),a=s.slice(t,t+r);q(o,s.slice(t+r));let l=0;for(;l<r;)o.push(null),l+=1;return j(o),this.hot.populateFromArray(t,e,o,void 0,void 0,"spliceCol"),a}spliceRow(e,t,r){for(var n=arguments.length,o=Array(n>3?n-3:0),i=3;i<n;i++)o[i-3]=arguments[i];let s=this.hot.getSourceDataAtRow(e),a=s.slice(t,t+r);q(o,s.slice(t+r));let l=0;for(;l<r;)o.push(null),l+=1;return this.hot.populateFromArray(e,t,[o],void 0,void 0,"spliceRow"),a}spliceData(e,t,r){if(!1!==this.hot.runHooks("beforeDataSplice",e,t,r)){let t=[...this.dataSource.slice(0,e),...r,...this.dataSource.slice(e)];this.dataSource.length=0,t.forEach(e=>this.dataSource.push(e))}}filterData(e,t,r){let n=this.hot.runHooks("filterData",e,t,r);Array.isArray(n)?(this.dataSource.length=0,n.forEach(e=>{this.dataSource.push(e)})):eo(this.dataSource,new Set(r))}get(e,t){let r=this.hot.toPhysicalRow(e),n=this.dataSource[r],o=this.hot.runHooks("modifyRowData",r);n="number"!=typeof o?o:n;let{dataDotNotation:i}=this.hot.getSettings(),s=null;if(n&&ty(n,t))s=n[t];else if(i&&"string"==typeof t&&t.indexOf(".")>-1){let e=n;if(!e)return null;let r=t.split(".");for(let t=0,n=r.length;t<n;t++)if(void 0===(e=e[r[t]]))return null;s=e}else"function"==typeof t&&(s=t(this.dataSource.slice(r,r+1)[0]));let a=this.propToCol(t),l="number"==typeof a?this.hot.toPhysicalColumn(a):null;if("number"==typeof a&&oH(r)&&oH(l)&&(s=n1(s,this.metaManager.getCellMetaUncached(r,l,{visualRow:e,visualColumn:a}))),this.hot.hasHook("modifyData")){let t=tC(s);this.hot.runHooks("modifyData",e,a,t,"get"),t.isTouched()&&(s=t.value)}return s}getCopyable(e,t){let r=this.propToCol(t);return"number"==typeof r&&this.hot.getCellMetaTransient(e,r).copyable?this.get(e,t):""}set(e,t,r){let n=this.hot.toPhysicalRow(e),o=r,i=this.dataSource[n],s=this.hot.runHooks("modifyRowData",n);if(i="number"!=typeof s?s:i,this.hot.hasHook("modifyData")){let r=tC(o);this.hot.runHooks("modifyData",e,this.propToCol(t),r,"set"),r.isTouched()&&(o=r.value)}let{dataDotNotation:a}=this.hot.getSettings();if(i&&ty(i,t))i[t]=o;else if(a&&"string"==typeof t&&t.indexOf(".")>-1){let e,r=i,n=0,s=t.split(".");for(n=0,e=s.length-1;n<e;n++){if("__proto__"===s[n]||"constructor"===s[n]||"prototype"===s[n])return;void 0===r[s[n]]&&(r[s[n]]={}),r=r[s[n]]}r[s[n]]=o}else if("function"==typeof t)t(this.dataSource.slice(n,n+1)[0],o);else{if("__proto__"===t||"constructor"===t||"prototype"===t)return;i[t]=o}}visualRowsToPhysical(e,t){let r=this.hot.countRows(),n=[],o=(r+e)%r,i=t;for(;o<r&&i;)n.push(this.hot.toPhysicalRow(o)),i-=1,o+=1;return n}visualColumnsToPhysical(e,t){let r=this.hot.countCols(),n=[],o=(r+e)%r,i=t;for(;o<r&&i;){let e=this.hot.toPhysicalColumn(o);n.push(e),i-=1,o+=1}return n}clear(){for(let e=0;e<this.hot.countSourceRows();e++)for(let t=0;t<this.hot.countCols();t++)this.set(e,this.colToProp(t),"")}getLength(){let e,t=this.tableMeta.maxRows;return e=(t??0)<0||0===t?0:t||1/0,Math.min(this.hot.rowIndexMapper.getNotTrimmedIndexesLength(),e)}getAll(){let e={row:0,col:0},t={row:Math.max(this.hot.countRows()-1,0),col:Math.max(this.hot.countCols()-1,0)};return e.row-t.row!=0||this.hot.countSourceRows()?this.getRange(e,t,dx.DESTINATION_RENDERER):[]}countCachedColumns(){return this.colToPropCache.length}getRange(e,t,r){let n,o,i,s=[],a=this.tableMeta.maxRows,l=this.tableMeta.maxCols;if(0===a||0===l)return[];let h=r===dx.DESTINATION_CLIPBOARD_GENERATOR?this.getCopyable:this.get,d=Math.min(Math.max((a??1/0)-1,0),Math.max(e.row,t.row)),u=Math.min(Math.max((l??1/0)-1,0),Math.max(e.col,t.col));for(n=Math.min(e.row,t.row);n<=d;n++){i=[];let r=n>=0?this.hot.toPhysicalRow(n):n;for(o=Math.min(e.col,t.col);o<=u&&null!==r;o++)i.push(h.call(this,n,this.colToProp(o)));null!==r&&s.push(i)}return s}getText(e,t){return dI(this.getRange(e,t,dx.DESTINATION_RENDERER))}getCopyableText(e,t){return dI(this.getRange(e,t,dx.DESTINATION_CLIPBOARD_GENERATOR))}destroy(){this.hot=null,this.metaManager=null,this.dataSource=null,this.duckSchema=null,this.colToPropCache.length=0,this.propToColCache.clear(),this.propToColCache=void 0}}function dN(e,t,r,n,o,i,s){let a=e.sourceDataValidator;if(!na(a)||!0===a(t,e,s))return;!1===e.allowInvalid&&o.setAtCell(r,n,null);let l=e.sourceDataWarningMessage;if(l){let e=i.get(l)??[];e.push({row:r,col:n,value:t,message:l}),i.set(l,e)}}function dO(e,t){let r=e.countSourceRows(),n=e.countSourceCols();if(0===r||0===n)return;let o=e.getSettings(),i=e._getDataSource(),s=new Map,{fullScan:a,columns:l}=function(e,t){let r=e._getMetaManager(),n=[];for(let o=0;o<t;o+=1){let t=e.columnIndexMapper.getVisualFromPhysicalIndex(o);if(null===t)continue;let i=r.getCellMetaUncached(0,o,{visualRow:0,visualColumn:t}),s=i.sourceDataValidator;if(na(s)){if(!0!==s.rowIndependent)return{fullScan:!0,columns:[]};n.push({physicalColumn:o,cellMeta:i})}}return{fullScan:!1,columns:n}}(e,n),h=Array.isArray(o.cell)&&o.cell.length>0||e._getMetaManager().getUserDefinedCellMetas().length>0;(a||0!==l.length||h)&&(a||h?function(e,t,r,n,o,i){let{rowIndexMapper:s,columnIndexMapper:a}=e,l=e._getMetaManager();for(let e=0;e<r;e+=1)for(let r=0;r<n;r+=1){let n=s.getVisualFromPhysicalIndex(e),h=a.getVisualFromPhysicalIndex(r);if(null===n||null===h)continue;let d=l.getCellMetaUncached(e,r,{visualRow:n,visualColumn:h});na(d.sourceDataValidator)&&dN(d,t.getAtCell(e,r),e,r,t,o,i)}}(e,i,r,n,s,t):function(e,t,r,n,o,i){for(let s=0;s<r;s+=1)if(null!==n(s))for(let r=0;r<e.length;r+=1){let{physicalColumn:n,cellMeta:a}=e[r];dN(a,t.getAtCell(s,n),s,n,t,o,i)}}(l,i,r,t=>e.rowIndexMapper.getVisualFromPhysicalIndex(t),s,t),s.forEach((e,t)=>{dk(t,e)}))}function dk(e,t){!function(){let{logFunction:e=tX,message:t="",items:r=[],maxSample:n=5,itemFormatter:o=e=>`${e}`}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Array.isArray(r)||0===r.length)return;let i=r.length,s=r.slice(0,n).map(e=>`  - ${o(e)}`),a=i>n?`  - ...and ${i-n} more`:"";e(tK(t,{itemsCount:`${i} cell${i>1?"s":""}`,affectedCells:["Affected cells:",...s,...a?[a]:[]].join("\n")}))}({logFunction:tQ,message:e,items:t,itemFormatter:e=>{let{row:t,col:r,value:n}=e,o=eH(n),i=o.length>64?`${o.slice(0,64)}...`:o;return`row ${t}, col ${r}, value: "${i}"`}})}function dH(e,t,r,n){let{hotInstance:o,dataMap:i,dataSource:s,internalSource:a,source:l,metaManager:h,firstRun:d}=n,u=oa(a),c=o.getSettings();Array.isArray(c.dataSchema)?o.dataType="array":na(c.dataSchema)?o.dataType="function":o.dataType="object",i&&i.destroy(),e=o.runHooks(`before${u}`,e,d,l);let g=new dx(o,e,h);t(g),"object"==typeof e&&null!==e?e.push&&e.splice||(e=[e]):null===e?e=function(e,t,r){let n=t.getSchema(),o=[];for(let t=0,i=r.startRows;t<i;t++){let t;if(("object"===e.dataType||"function"===e.dataType)&&r.dataSchema)t=ta(n);else if("array"===e.dataType)t=ta(n[0]);else{t=[];for(let e=0,n=r.startCols;e<n;e++)t.push(null)}o.push(t)}return o}(o,g,c):tr(`${a} only accepts array of objects or array of arrays (${typeof e} given)`),Array.isArray(e[0])&&(o.dataType="array"),c.data=e,g.dataSource=e,s.data=e,s.dataType=o.dataType,s.colToProp=e=>g.colToProp(e),s.propToCol=e=>g.propToCol(e),s.countCachedColumns=g.countCachedColumns.bind(g),r(g),d||dO(o,a),o.runHooks(`after${u}`,e,d,l),d||(o.runHooks("afterChange",null,a),o.view.adjustElementsSize(),o.render()),o.getSettings().ariaTags&&rc(o.rootElement,[D(-1),F(o.countCols()+(o.view?o.countRowHeaders():0))])}class d_{#rY;#rj;constructor({rowIndexMapper:e,columnIndexMapper:t}){this.#rY=e,this.#rj=t}toRenderable(e){let t="N-S"===e.getVerticalDirection()?1:-1,r="W-E"===e.getHorizontalDirection()?1:-1,n=this.#rq(e.from,t,r);if(null===n)return null;let o=this.#rq(e.to,-t,-r);if(null===o)return null;let i=e.clone();return i.from=n,i.to=o,i.includes(e.highlight)||(i.highlight=n),i}#rq(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t;if(null===e.row||null===e.col)return null;let n=this.#rK(this.#rY,e.row,t);if(null===n)return null;let o=this.#rK(this.#rj,e.col,r);return null===o?null:e.clone().assign({row:n,col:o})}#rK(e,t,r){return t<0?t:e.getNearestNotHiddenIndex(t,r)}}function dL(e){ne(e)&&e.scrollIntoView({block:"nearest",inline:"nearest"})}function dP(e){let{selection:t,view:r}=e,n=e.getSelectedRangeActive(),o=t.getSelectionSource(),i=r.getFirstFullyVisibleColumn()??-1,s=r.getLastFullyVisibleColumn()??-1,a=n?.getTopStartCorner().col??-1,l=n?.getBottomEndCorner().col??-1,h=a<=i,d=l>=s,u=r.getFirstFullyVisibleRow()??-1,c=r.getLastFullyVisibleRow()??-1,g=n?.getTopStartCorner().row??-1,p=n?.getBottomEndCorner().row??-1,m=g<=u,f=p>=c;return{getComputedColumnTarget:e=>"mouse"===o||"keyboard"===o?e.col??-1:h&&d?n?.highlight.col??-1:h?a:d?l:e.col??-1,getComputedRowTarget:e=>"mouse"===o||"keyboard"===o?e.row??-1:m&&f?n?.highlight.row??-1:m?g:f?p:e.row??-1}}let dD=Object.freeze({CELL:"cell",MIXED:"mixed"});class dF{#rX;#rQ=null;#rZ=!1;#rJ;#r0=1;#r1=null;#r2=new Map;#r3=!1;#r6=!1;constructor(e){this.#rX=e}init(){var e=this;let t=this.#rX.getSettings();this.#rJ=t.imeFastEdit?dD.MIXED:dD.CELL,this.#rX.addHook("afterUpdateSettings",function(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return e.#r5(r[0])}),this.#rX.addHook("afterSelection",function(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return e.#r4()}),this.#rX.addHook("afterSelectionFocusSet",function(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return e.#r4()}),this.#rX.addHook("afterSelectionEnd",function(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return e.#r9()}),this.#rX.addHook("afterRender",function(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return e.#r7()}),this.#rQ=new n5(this.#rX);let r=[this.#rX.rootWrapperElement??this.#rX.rootElement,this.#rX.rootPortalElement].filter(e=>ne(e));r.forEach(e=>{this.#rQ.addEventListener(e,"focusin",()=>{this.#rZ=!0}),this.#rQ.addEventListener(e,"focusout",e=>{let t=e.relatedTarget;this.#rZ=ne(t)&&r.some(e=>e.contains(t))})})}hasBrowserFocus(){return this.#rZ}isForeignFocusTarget(e){let{rootElement:t,rootWrapperElement:r,rootPortalElement:n,rootDocument:o}=this.#rX,i=!!r&&r.contains(e)&&!t.contains(e);return!(null===e||e===o.body||e===o.documentElement||t5(e,t)||i||n&&n.contains(e))&&!no(t).includes(e)}getFocusMode(){return this.#rJ}setFocusMode(e){Object.values(dD).includes(e)?this.#rJ=e:tQ(`"${e}" is not a valid focus mode.`)}getRefocusDelay(){return this.#r0}setRefocusDelay(e){this.#r0=e}setRefocusElementGetter(e){this.#r1=e}suspend(){this.#r6=!0}resume(){this.#r6=!1}getRefocusElement(){return"function"==typeof this.#r1?this.#r1():this.#rX.getActiveEditor()?.TEXTAREA}focusElement(e,t){return!!ne(e)&&!!e.isConnected&&(e.focus(t),!0)}focusOnHighlightedCell(e){let t=e=>{let t=this.#rX.getSelectedRangeActive()?.highlight;if(!t)return;let r=this.#rX.runHooks("modifyFocusedElement",t.row,t.col,e);ne(r)||(r=e),r&&!this.#rX.getActiveEditor()?.isOpened?.()&&this.focusElement(r,{preventScroll:!0})};e?t(e):this.#r8(e=>t(e))}refocusToEditorTextarea(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.#r0;this.#rX.getSettings().imeFastEdit&&!this.#rX.getActiveEditor()?.isOpened?.()&&(this.#rX.getActiveEditor()?.refreshValue?.(),this.#r2.has(e)||this.#r2.set(e,nd(()=>{this.#rX.isDestroyed||this.getRefocusElement()?.select()},e)),this.#r2.get(e)())}#r8(e){let t=this.#rX.getSelectedRangeActive()?.highlight;if(!t||!this.#rX.selection.isCellVisible(t)||null===t.row||null===t.col)return void e(null);let{row:r,col:n}=t,o=this.#rX.getCell(r,n,!0);null===o?this.#rX.addHookOnce("afterScroll",()=>{e(this.#rX.getCell(r,n,!0))}):e(o)}#ne(){let e=this.#r6;this.#r8(t=>{let r=ni(this.#rX.rootDocument),n=ne(r)?r:null;e&&n&&r3(n)||(n&&r3(n)&&n.blur(),this.focusOnHighlightedCell(t))})}#r9(){if(this.#r6){let e=ni(this.#rX.rootDocument),t=ne(e)?e:null;if(t&&r3(t))return}this.#r8(e=>{this.getFocusMode()===dD.MIXED&&e?.nodeName==="TD"&&this.refocusToEditorTextarea()})}#r4(){this.#r3=!0}#r7(){this.#r3&&(this.#r3=!1,this.#ne())}#r5(e){"boolean"==typeof e.imeFastEdit&&this.setFocusMode(e.imeFastEdit?dD.MIXED:dD.CELL)}}let dB=Object.freeze({INLINE:"inline",MODAL:"modal"}),dV=Object.freeze({UNKNOWN:"unknown",CLICK:"click",TAB_FROM_ABOVE:"tab_from_above",TAB_FROM_BELOW:"tab_from_below"});function dU(e,t){let r=e.rootDocument.createElement("div");return r.style.display="none",r.classList.add("htFocusCatcher"),r.dataset.htFocusSource=t,r}function dz(e){let{rowIndexMapper:t,columnIndexMapper:r}=e,{navigableHeaders:n}=e.getSettings(),o=n&&e.countColHeaders()>0?-e.countColHeaders():0,i=n&&e.countRowHeaders()>0?-e.countRowHeaders():0,s=0===o?t.getVisualFromRenderableIndex(o):o,a=0===i?r.getVisualFromRenderableIndex(i):i;return null===s||null===a?null:e._createCellCoords(s,a)}function dW(e){let{rowIndexMapper:t,columnIndexMapper:r}=e,{navigableHeaders:n}=e.getSettings(),o=t.getRenderableIndexesLength()-1,i=r.getRenderableIndexesLength()-1;if(o<0){if(!n||0===e.countColHeaders())return null;o=-1}if(i<0){if(!n||0===e.countColHeaders())return null;i=-1}return e._createCellCoords(t.getVisualFromRenderableIndex(o)??o,r.getVisualFromRenderableIndex(i)??i)}let dG="gridDefault",d$="grid.tabNavigation",dY="editorManager.handlingEditor";function dj(e){let t,r=t=>{if(!t)return null;let{rowIndexMapper:r,columnIndexMapper:n}=e;if(r.isHidden(t.row)||n.isHidden(t.col))return null;let o=dz(e),i=dW(e);return null===o||null===i?null:(t.row=ox(t.row,o.row??t.row,i.row??t.row),t.col=ox(t.col,o.col??t.col,i.col??t.col),t)},n={wrapped:!1,flipped:!1},o=!0,i=!1;e.addHook("afterSelection",()=>{o&&(t=e.getSelectedRangeActive()?.highlight)}),e.addHook("beforeRowWrap",(e,t,r)=>{n.wrapped=!0,n.flipped=r}),e.addHook("beforeEmptyDataStateShow",()=>{i=!0}),e.addHook("beforeEmptyDataStateHide",()=>{i=!1});let s=e.getShortcutManager().getContext("grid");s?.addShortcuts([{keys:[["Tab"],["Shift","Tab"]],preventDefault:!1,stopPropagation:!1,relativeToGroup:dG,group:d$,position:"before",callback(){let{tabNavigation:t}=e.getSettings();e.getSelectedRangeActive()&&!t&&(o=!1)}},{keys:[["Tab"],["Shift","Tab"]],preventDefault:!1,stopPropagation:!1,relativeToGroup:dG,group:d$,callback(r){let{tabNavigation:i,autoWrapRow:s}=e.getSettings();o=!0,(!i||!e.selection.isSelected()||s&&n.wrapped&&n.flipped||!s&&n.wrapped)&&(s&&n.wrapped&&n.flipped&&(t=r.shiftKey?dz(e):dW(e)),n.wrapped=!1,n.flipped=!1)},position:"after"}]);let a=e.rootGridContentElement??e.rootElement;e.getFocusScopeManager().registerScope("grid",a,{contains:t=>!!(a===t||a.contains(t))||null===t.closest(".htMenu")&&e.rootPortalElement.contains(t),runOnlyIf:()=>{let{navigableHeaders:t}=e.getSettings();return!((i||!t)&&0===e.countRenderedRows()&&0===e.countRenderedCols()&&e.countRowHeaders()>0&&e.countColHeaders()>0)&&!!(!t&&e.countRenderedRows()>0&&e.countRenderedCols()>0||t&&(e.countRowHeaders()>0||e.countColHeaders()>0))},onActivate:n=>{if("tab_from_above"===n){let n=r(t)??dz(e);if(n){let t=e.runHooks("modifyFocusOnTabNavigation","from_above",n),{row:r,col:o}=n;!1!==t&&null!==r&&null!==o&&(e.selectCell(r,o),e.getFocusManager().focusOnHighlightedCell())}}else if("tab_from_below"===n){let n=r(t)??dW(e);if(n){let t=e.runHooks("modifyFocusOnTabNavigation","from_below",n),{row:r,col:o}=n;!1!==t&&null!==r&&null!==o&&e.selectCell(r,o)}}}})}let dq=new Map([[" ","space"],["spacebar","space"],["scroll","scrolllock"],["del","delete"],["esc","escape"],["medianexttrack","mediatracknext"],["mediaprevioustrack","mediatrackprevious"],["volumeup","audiovolumeup"],["volumedown","audiovolumedown"],["volumemute","audiovolumemute"],["multiply","*"],["add","+"],["divide","/"],["subtract","-"],["left","arrowleft"],["right","arrowright"],["up","arrowup"],["down","arrowdown"]]),dK=e=>e.map(e=>{let t=e.toLowerCase();return dq.has(t)?dq.get(t)??t:t}).sort((e,t)=>e.localeCompare(t)).join("+"),dX=new Map([[96,"numpad0"],[97,"numpad1"],[98,"numpad2"],[99,"numpad3"],[100,"numpad4"],[101,"numpad5"],[102,"numpad6"],[103,"numpad7"],[104,"numpad8"],[105,"numpad9"],[106,"multiply"],[107,"add"],[108,"decimal"],[109,"subtract"],[110,"decimal"],[111,"divide"],[112,"f1"],[113,"f2"],[114,"f3"],[115,"f4"],[116,"f5"],[117,"f6"],[118,"f7"],[119,"f8"],[120,"f9"],[121,"f10"],[122,"f11"],[123,"f12"],[186,"semicolon"],[187,"equal"],[188,"comma"],[189,"minus"],[190,"period"],[191,"slash"],[192,"backquote"],[219,"bracketleft"],[220,"backslash"],[221,"bracketright"],[222,"quote"]]),dQ=e=>{let{which:t,key:r}=e;if(dX.has(t))return dX.get(t)??r.toLowerCase();let n=String.fromCharCode(t).toLowerCase();return/^[a-z0-9]$/.test(n)?n:r.toLowerCase()},dZ=["meta","alt","shift","control"],dJ=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=[];return e.altKey&&r.push("alt"),t&&(e.ctrlKey||e.metaKey)?r.push("control/meta"):(e.ctrlKey&&r.push("control"),e.metaKey&&r.push("meta")),e.shiftKey&&r.push("shift"),r},d0=Symbol("shortcut-context");function d1(e){return tc(e)&&e.__kindOf===d0}let d2=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"table",r=oF({errorIdExists:t=>`The "${t}" shortcut is already registered in the "${e}" context.`}),n=function(){let{keys:e,callback:t,group:n,runOnlyIf:o=()=>!0,captureCtrl:i=!1,preventDefault:s=!0,stopPropagation:a=!1,relativeToGroup:l,position:h,forwardToContext:d}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};eL(n)&&tr("You need to define the shortcut's group."),!1===na(t)&&tr("The shortcut's callback needs to be a function."),!1===Array.isArray(e)&&tr(ec`Pass the shortcut\'s keys as an array of arrays,\x20
      using the KeyboardEvent.key properties:\x20
      declare https: //developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values.`);let u={callback:t,group:n,runOnlyIf:o,captureCtrl:i,preventDefault:s,stopPropagation:a};e_(l)&&(u.relativeToGroup=l,u.position=h),d1(d)&&(u.forwardToContext=d),e.forEach(e=>{let t=dK(e);if(r.hasItem(t)){let e=r.getItem(t),n=e.findIndex(e=>e.group===l);-1!==n?"before"===h?n-=1:n+=1:n=e.length,e.splice(n,0,u)}else r.addItem(t,[u])})},o=e=>{let t=dK(e);r.removeItem(t)};return{__kindOf:d0,scope:t,addShortcut:n,addShortcuts:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e.forEach(e=>{tp(t,(r,n)=>{!1===Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=t[n])}),n(e)})},getShortcuts:e=>{let t=dK(e),n=r.getItem(t);return e_(n)?n.slice():[]},hasShortcut:e=>{let t=dK(e);return r.hasItem(t)},removeShortcutsByKeys:o,removeShortcutsByGroup:e=>{r.getItems().forEach(t=>{let[r,n]=t,i=n.filter(t=>t.group!==e);0===i.length?o(r.split("+")):(n.length=0,n.push(...i))})}}},d3=(o=new Set,{press(e){o.add(e)},release(e){o.delete(e)},releaseAll(){o.clear()},isPressed:e=>o.has(e)}),d6=new WeakMap,d5=e=>{if("string"==typeof e.key){let t=dQ(e);dZ.includes(t)&&d3.press(t)}},d4=e=>{if("string"==typeof e.key){let t=dQ(e);dZ.includes(t)&&d3.release(t)}},d9=[{name:"editorCloseAndSave",callback(e){e._getEditorManager().closeEditorAndSaveChanges()}},{name:"editorCloseAndSaveByArrowKeys",callback(e,t,r){let n=e._getEditorManager(),o=n.getActiveEditor();o?.isInFullEditMode()&&o?.state===n2.EDITING||(n.closeEditorAndSaveChanges(),e.getSelected()&&(r.includes("arrowdown")?e.selection.transformStart(1,0):r.includes("arrowup")?e.selection.transformStart(-1,0):r.includes("arrowleft")?e.selection.transformStart(0,-1*e.getDirectionFactor()):r.includes("arrowright")&&e.selection.transformStart(0,e.getDirectionFactor())),t.preventDefault())}},{name:"editorCloseAndSaveByEnter",callback(e,t){let r=e._getEditorManager();r.closeEditorAndSaveChanges(t.ctrlKey||t.metaKey),r.moveSelectionAfterEnter(t)}},{name:"editorCloseWithoutSaving",callback(e){let t=e._getEditorManager();t.closeEditorAndRestoreOriginalValue(e.getShortcutManager().isCtrlPressed()),t.activeEditor?.focus()}},{name:"editorFastOpen",callback(e,t){let r=e.getSelectedRangeActive()?.highlight;r?.isHeader()||e._getEditorManager().openEditor(null,t,!0)}},{name:"editorOpen",callback(e,t,r){let{selection:n}=e,o=e._getEditorManager(),i=e.getSelectedRange(),s=e.getSelectedRangeActive(),a=s?.highlight;if((i?.some(e=>n.isMultiple(e))||(i?.length??0)>1)&&!s?.isHeader()&&e.countRenderedCols()>0&&e.countRenderedRows()>0){let o=e.getSettings(),i="function"==typeof o.enterMoves?o.enterMoves(t):o.enterMoves;r.includes("shift")?n.transformFocus(-(i?.row??0),-(i?.col??0)):n.transformFocus(i?.row??0,i?.col??0);return}a?.isHeader()||(e.getSettings().enterBeginsEditing?o.cellProperties.readOnly?o.moveSelectionAfterEnter(t):o.openEditor(null,t,!0):o.moveSelectionAfterEnter(t),nR(t))}},{name:"extendCellsSelectionDown",callback(e){let{selection:t}=e,r=e.getSelectedRangeActive()?.highlight;!t.isSelectedByColumnHeader()&&!t.isSelectedByCorner()&&(r?.isCell()||r?.isHeader()&&t.isSelectedByRowHeader())&&(t.markSource("keyboard"),t.transformEnd(1,0),t.markEndSource())}},{name:"extendCellsSelectionDownByViewportHeight",callback(e){let{selection:t,rowIndexMapper:r}=e,n=e.getSelectedRangeActive();if(!n)return;let{to:o}=n,i=o.row??0,s=Math.min(i+e.countVisibleRows(),e.countRows()-1),a=r.getNearestNotHiddenIndex(s,-1);if(null!==a){let r=e._createCellCoords(a,o.col??0),n=i-(e.getFirstFullyVisibleRow()??0),s=Math.min((r.row??0)-n,e.countRows()-1);t.markSource("keyboard"),t.setRangeEnd(r,e.getActiveSelectionLayerIndex()),t.markEndSource(),e.scrollViewportTo({row:s,verticalSnap:"top",horizontalSnap:"start"})}}},{name:"extendCellsSelectionLeft",callback(e){let{selection:t}=e,r=e.getSelectedRangeActive()?.highlight;!t.isSelectedByRowHeader()&&!t.isSelectedByCorner()&&(r?.isCell()||r?.isHeader()&&t.isSelectedByColumnHeader())&&(t.markSource("keyboard"),t.transformEnd(0,-1*e.getDirectionFactor()),t.markEndSource())}},{name:"extendCellsSelectionRight",callback(e){let{selection:t}=e,r=e.getSelectedRangeActive()?.highlight;!t.isSelectedByRowHeader()&&!t.isSelectedByCorner()&&(r?.isCell()||r?.isHeader()&&t.isSelectedByColumnHeader())&&(t.markSource("keyboard"),t.transformEnd(0,e.getDirectionFactor()),t.markEndSource())}},{name:"extendCellsSelectionToColumns",callback(e){let{selection:t}=e,r=e.getSelectedRangeActive();if(!r)return;let{highlight:n,from:o,to:i}=r;t.markSource("keyboard"),t.isSelectedByRowHeader()?t.selectAll(!0,!0):e.selectColumns(o.col??0,i.col??0,n),t.markEndSource()}},{name:"extendCellsSelectionToMostBottom",callback(e){let{selection:t,rowIndexMapper:r}=e,n=e.getSelectedRangeActive();if(!n)return;let{highlight:o,from:i,to:s}=n,a=o.isHeader()&&t.isSelectedByRowHeader();if(o.isCell()||a){let n=r.getNearestNotHiddenIndex(e.countRows()-1,-1),l=i.clone();l.row=o.row,t.markSource("keyboard"),t.setRangeStart(l,void 0,!1,o.clone()),a&&t.selectedByRowHeader.add(t.getLayerLevel()),t.setRangeEnd(e._createCellCoords(n??0,s.col??0)),t.markEndSource()}}},{name:"extendCellsSelectionToMostInlineEnd",callback(e){let{selection:t,columnIndexMapper:r}=e,n=e.getSelectedRangeActive();if(!n)return;let{highlight:o,from:i,to:s}=n;if(!t.isSelectedByRowHeader()&&!t.isSelectedByCorner()&&o.isCell()){let n=r.getNearestNotHiddenIndex(e.countCols()-1,-1),a=i.clone();a.col=o.col,t.markSource("keyboard"),t.setRangeStart(a,void 0,!1,o.clone()),t.setRangeEnd(e._createCellCoords(s.row??0,n??0)),t.markEndSource()}}},{name:"extendCellsSelectionToMostInlineStart",callback(e){let{selection:t,columnIndexMapper:r}=e,n=e.getSelectedRangeActive();if(!n)return;let{highlight:o,from:i,to:s}=n;if(!t.isSelectedByRowHeader()&&!t.isSelectedByCorner()&&o.isCell()){let n=Number(e.getSettings().fixedColumnsStart)||0,a=r.getNearestNotHiddenIndex(n,1),l=i.clone();l.col=o.col,t.markSource("keyboard"),t.setRangeStart(l,void 0,!1,o.clone()),t.setRangeEnd(e._createCellCoords(s.row??0,a??0)),t.markEndSource()}}},{name:"extendCellsSelectionToMostLeft",callback(e){let{selection:t,columnIndexMapper:r}=e,n=e.getSelectedRangeActive();if(!n)return;let{highlight:o,from:i,to:s}=n,a=o.isHeader()&&t.isSelectedByColumnHeader();if(o.isCell()||a){let n=e.isRtl()?r.getNearestNotHiddenIndex(e.countCols()-1,-1):r.getNearestNotHiddenIndex(0,1),l=i.clone();l.col=o.col,t.markSource("keyboard"),t.setRangeStart(l,void 0,!1,o.clone()),a&&t.selectedByColumnHeader.add(t.getLayerLevel()),t.setRangeEnd(e._createCellCoords(s.row??0,n??0)),t.markEndSource()}}},{name:"extendCellsSelectionToMostRight",callback(e){let{selection:t,columnIndexMapper:r}=e,n=e.getSelectedRangeActive();if(!n)return;let{highlight:o,from:i,to:s}=n,a=o.isHeader()&&t.isSelectedByColumnHeader();if(o.isCell()||a){let n=e.isRtl()?r.getNearestNotHiddenIndex(0,1):r.getNearestNotHiddenIndex(e.countCols()-1,-1),l=i.clone();l.col=o.col,t.markSource("keyboard"),t.setRangeStart(l,void 0,!1,o.clone()),a&&t.selectedByColumnHeader.add(t.getLayerLevel()),t.setRangeEnd(e._createCellCoords(s.row??0,n??0)),t.markEndSource()}}},{name:"extendCellsSelectionToMostTop",callback(e){let{selection:t,rowIndexMapper:r}=e,n=e.getSelectedRangeActive();if(!n)return;let{highlight:o,from:i,to:s}=n,a=o.isHeader()&&t.isSelectedByRowHeader();if(o.isCell()||a){let n=r.getNearestNotHiddenIndex(0,1),l=i.clone();l.row=o.row,t.markSource("keyboard"),t.setRangeStart(l,void 0,!1,o.clone()),a&&t.selectedByRowHeader.add(t.getLayerLevel()),t.setRangeEnd(e._createCellCoords(n??0,s.col??0)),t.markEndSource()}}},{name:"extendCellsSelectionToRows",callback(e){let{selection:t}=e,r=e.getSelectedRangeActive();if(!r)return void t.markEndSource();let{highlight:n,from:o,to:i}=r;t.markSource("keyboard"),t.isSelectedByColumnHeader()?t.selectAll(!0,!0):e.selectRows(o.row??0,i.row??0,n),t.markEndSource()}},{name:"extendCellsSelectionUp",callback(e){let{selection:t}=e,r=e.getSelectedRangeActive()?.highlight;!t.isSelectedByColumnHeader()&&!t.isSelectedByCorner()&&(r?.isCell()||r?.isHeader()&&t.isSelectedByRowHeader())&&(t.markSource("keyboard"),t.transformEnd(-1,0),t.markEndSource())}},{name:"extendCellsSelectionUpByViewportHeight",callback(e){let{selection:t,rowIndexMapper:r}=e,n=e.getSelectedRangeActive();if(!n)return;let{to:o}=n,i=o.row??0,s=Math.max(i-e.countVisibleRows(),0),a=r.getNearestNotHiddenIndex(s,1);if(null!==a){let r=e._createCellCoords(a,o.col??0),n=i-(e.getFirstFullyVisibleRow()??0),s=Math.max((r.row??0)-n,0);t.markSource("keyboard"),t.setRangeEnd(r,e.getActiveSelectionLayerIndex()),t.markEndSource(),e.scrollViewportTo({row:s,verticalSnap:"top",horizontalSnap:"start"})}}},{name:"moveCellSelectionDown",callback(e){let{selection:t}=e;t.markSource("keyboard"),t.transformStart(1,0),t.markEndSource()}},{name:"moveCellSelectionDownByViewportHeight",callback(e){let{selection:t}=e,{navigableHeaders:r}=e.getSettings(),n=r?e.countColHeaders():0,o=e.getSelectedRangeActive()?.highlight.row??0,i=e.countVisibleRows()+n;i=0===i?1:i,o===e.countRows()-1?i=1:o+i>e.countRows()&&(i=e.countRows()-o-1),t.markSource("keyboard"),t.transformStart(i,0),t.markEndSource();let s=e.getSettings().fixedRowsBottom??0,a=e.countRows(),l=e.getSelectedRangeActive()?.highlight.row??0;l<0?e.scrollViewportTo({row:0}):s>0&&l>=a-s&&e.scrollViewportTo({row:a-s-1,verticalSnap:"bottom"})}},{name:"moveCellSelectionInlineEnd",callback(e,t){let{selection:r}=e,n=e.getSettings(),o=e.getSelectedRange(),i=e.getSelectedRangeActive(),s="function"==typeof n.tabMoves?n.tabMoves(t):n.tabMoves;r.markSource("keyboard"),(o?.some(e=>r.isMultiple(e))||(o?.length??0)>1)&&!i?.isHeader()&&e.countRenderedCols()>0&&e.countRenderedRows()>0?r.transformFocus(-(s?.row??0),-(s?.col??0)):r.transformStart(-(s?.row??0),-(s?.col??0)),r.markEndSource()}},{name:"moveCellSelectionInlineStart",callback(e,t){let{selection:r}=e,n=e.getSettings(),o=e.getSelectedRange(),i=e.getSelectedRangeActive(),s="function"==typeof n.tabMoves?n.tabMoves(t):n.tabMoves;r.markSource("keyboard"),(o?.some(e=>r.isMultiple(e))||(o?.length??0)>1)&&!i?.isHeader()&&e.countRenderedCols()>0&&e.countRenderedRows()>0?r.transformFocus(s?.row??0,s?.col??0):r.transformStart(s?.row??0,s?.col??0),r.markEndSource()}},{name:"moveCellSelectionLeft",callback(e){let{selection:t}=e;t.markSource("keyboard"),t.transformStart(0,-1*e.getDirectionFactor()),t.markEndSource()}},{name:"moveCellSelectionRight",callback(e){let{selection:t}=e;t.markSource("keyboard"),t.transformStart(0,e.getDirectionFactor()),t.markEndSource()}},{name:"moveCellSelectionToMostBottom",callback(e){let{selection:t}=e,r=e.getSelectedRangeActive()?.highlight.col??0,n=e.rowIndexMapper.getNearestNotHiddenIndex(e.countRows()-1,-1);null===n&&(n=-1),t.setRangeStart(e._createCellCoords(n,r))}},{name:"moveCellSelectionToMostBottomInlineEnd",callback(e){let{selection:t,rowIndexMapper:r,columnIndexMapper:n}=e,o=Number(e.getSettings().fixedRowsBottom)||0,i=r.getNearestNotHiddenIndex(e.countRows()-o-1,-1),s=n.getNearestNotHiddenIndex(e.countCols()-1,-1);t.markSource("keyboard"),t.setRangeStart(e._createCellCoords(i??-1,s??-1)),t.markEndSource()}},{name:"moveCellSelectionToMostInlineEnd",callback(e){let{selection:t,columnIndexMapper:r}=e;t.markSource("keyboard"),t.setRangeStart(e._createCellCoords(e.getSelectedRangeActive()?.highlight.row??0,r.getNearestNotHiddenIndex(e.countCols()-1,-1)??0)),t.markEndSource()}},{name:"moveCellSelectionToMostInlineStart",callback(e){let{selection:t,columnIndexMapper:r}=e,n=Number(e.getSettings().fixedColumnsStart)||0,o=e.getSelectedRangeActive()?.highlight.row??0,i=r.getNearestNotHiddenIndex(n,1);t.markSource("keyboard"),t.setRangeStart(e._createCellCoords(o,i??0)),t.markEndSource()}},{name:"moveCellSelectionToMostLeft",callback(e){let{selection:t,columnIndexMapper:r}=e,n=e.getSelectedRangeActive()?.highlight.row??0,o=e.isRtl()?r.getNearestNotHiddenIndex(e.countCols()-1,-1):r.getNearestNotHiddenIndex(0,1);null===o&&(o=e.isRtl()?-1:-e.countRowHeaders()),t.markSource("keyboard"),t.setRangeStart(e._createCellCoords(n,o)),t.markEndSource()}},{name:"moveCellSelectionToMostRight",callback(e){let{selection:t,columnIndexMapper:r}=e,n=e.getSelectedRangeActive()?.highlight.row??0,o=e.isRtl()?r.getNearestNotHiddenIndex(0,1):r.getNearestNotHiddenIndex(e.countCols()-1,-1);null===o&&(o=e.isRtl()?-e.countRowHeaders():-1),t.markSource("keyboard"),t.setRangeStart(e._createCellCoords(n,o)),t.markEndSource()}},{name:"moveCellSelectionToMostTop",callback(e){let{selection:t}=e,r=e.getSelectedRangeActive()?.highlight.col??0,n=e.rowIndexMapper.getNearestNotHiddenIndex(0,1);null===n&&(n=-e.countColHeaders()),t.markSource("keyboard"),t.setRangeStart(e._createCellCoords(n,r)),t.markEndSource()}},{name:"moveCellSelectionToMostTopInlineStart",callback(e){let{selection:t,rowIndexMapper:r,columnIndexMapper:n}=e,o=Number(e.getSettings().fixedRowsTop)||0,i=Number(e.getSettings().fixedColumnsStart)||0,s=r.getNearestNotHiddenIndex(o,1),a=n.getNearestNotHiddenIndex(i,1);t.markSource("keyboard"),t.setRangeStart(e._createCellCoords(s??0,a??0)),t.markEndSource()}},{name:"moveCellSelectionUp",callback(e){let{selection:t}=e;t.markSource("keyboard"),t.transformStart(-1,0),t.markEndSource()}},{name:"moveCellSelectionUpByViewportHight",callback(e){let{selection:t}=e,{navigableHeaders:r}=e.getSettings(),n=r?e.countColHeaders():0,o=e.getSelectedRangeActive()?.highlight.row??0,i=e.countVisibleRows()+n;i=0===i?-1:-i,o===-n?i=-1:o+i<n&&(i=-(o+n)),t.markSource("keyboard"),t.transformStart(i,0),t.markEndSource();let s=e.getSettings().fixedRowsTop??0;(e.getSelectedRangeActive()?.highlight.row??0)<s&&e.scrollViewportTo({row:s,verticalSnap:"top"})}},{name:"emptySelectedCells",callback(e){e.emptySelectedCells(),e._getEditorManager().prepareEditor()}},{name:"scrollToFocusedCell",callback(e){let t=e.getSelectedRangeActive()?.highlight;if(!t)return;let r=e.getFirstFullyVisibleRow()-1,n=e.getFirstFullyVisibleColumn()-1,o=e.getLastFullyVisibleRow()+1,i=e.getLastFullyVisibleColumn()+1,s=e._createCellCoords(r,n),a=e._createCellCoords(o,i);if(!e._createCellRange(s,s,a).includes(t)&&((t.row??-1)>=0||(t.col??-1)>=0)){let r={};if((t.col??-1)>=0){let n=Math.floor(e.countVisibleCols()/2);r.col=Math.max((t.col??0)-n,0)}if((t.row??-1)>=0){let n=Math.floor(e.countVisibleRows()/2);r.row=Math.max((t.row??0)-n,0)}e.scrollViewportTo({...r,verticalSnap:"top",horizontalSnap:"start"})}}},{name:"selectAllCells",callback(e){let{selection:t}=e;t.markSource("keyboard"),t.selectAll(!0,!0,{disableHeadersHighlight:!0}),t.markEndSource()}},{name:"selectAllCellsAndHeaders",callback(e){let{selection:t}=e;t.markSource("keyboard"),t.selectAll(!0,!0,{disableHeadersHighlight:!1}),t.markEndSource()}},{name:"populateSelectedCellsData",callback(e){let t=e.getSelectedRange();if(!t)return;let r=t[t.length-1].highlight.normalize(),n=r.row??0,o=r.col??0,i=e.getDataAtCell(n,o),s=new Map;for(let r=0;r<t.length;r++)t[r].forAll((t,r)=>{if(t>=0&&r>=0&&(t!==n||r!==o)){let{readOnly:n}=e.getCellMetaTransient(t,r);n||s.set(`${t}x${r}`,[t,r,i])}});e.setDataAtCell(Array.from(s.values()))}},{name:"tabNavigation",callback(e){let t={wrapped:!1,flipped:!1},r=!1,n=!1;return e.addHook("afterSelection",(e,o,i,s,a)=>{r&&(t.wrapped&&t.flipped||n)&&(n=!1,a.value=!0)}),e.addHook("beforeRowWrap",(e,r,n)=>{t.wrapped=!0,t.flipped=n}),{before(){let{tabNavigation:t}=e.getSettings();r=!0,t||(n=!0)},after(n){let{tabNavigation:o,autoWrapRow:i}=e.getSettings();if(r=!1,!o||!e.selection.isSelected()||i&&t.wrapped&&t.flipped||!i&&t.wrapped)return t.wrapped=!1,t.flipped=!1,e.deselectCell(),!1;n.preventDefault()}}}}];function d7(e){let t={};return d9.forEach(r=>{let{name:n,callback:o}=r;t[n]=function(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return o(e,...r)}}),t}function d8(e){let t=e.getShortcutManager().addContext("editor"),r=d7(e);t.addShortcuts([{keys:[["Enter"],["Enter","Shift"]],callback:(e,t)=>r.editorCloseAndSaveByEnter(e,t)},{keys:[["Enter","Control/Meta"],["Enter","Control/Meta","Shift"]],captureCtrl:!0,callback:(e,t)=>r.editorCloseAndSaveByEnter(e,t)},{keys:[["Tab"],["Tab","Shift"],["PageDown"],["PageUp"]],forwardToContext:e.getShortcutManager().getContext("grid"),callback:(e,t)=>r.editorCloseAndSave(e,t)},{keys:[["ArrowDown"],["ArrowUp"],["ArrowLeft"],["ArrowRight"]],preventDefault:!1,callback:(e,t)=>r.editorCloseAndSaveByArrowKeys(e,t)},{keys:[["Escape"],["Escape","Control/Meta"]],callback:()=>r.editorCloseWithoutSaving()}],{group:dY})}function ue(e){let t=e.getShortcutManager().addContext("grid"),r=d7(e);t.addShortcuts([{keys:[["F2"]],callback:e=>r.editorFastOpen(e)},{keys:[["Enter"],["Enter","Shift"]],callback:(e,t)=>r.editorOpen(e,t)},{keys:[["Backspace"],["Delete"]],callback:()=>r.emptySelectedCells()}],{group:dY,runOnlyIf:()=>e_(e.getSelected())}),t.addShortcuts([{keys:[["Control/Meta","A"]],callback:()=>r.selectAllCells(),runOnlyIf:()=>e_(e.getSelected())&&!e.getSelectedRangeActive()?.highlight.isHeader()},{keys:[["Control/Meta","A"]],callback:()=>{},runOnlyIf:()=>!!(e_(e.getSelected())&&e.getSelectedRangeActive()?.highlight.isHeader()),preventDefault:!0},{keys:[["Control/Meta","Shift","Space"]],callback:()=>r.selectAllCellsAndHeaders()},{keys:[["Control/Meta","Enter"]],callback:()=>r.populateSelectedCellsData(),runOnlyIf:()=>e_(e.getSelected())&&!e.getSelectedRangeActive()?.highlight.isHeader()&&(e.getSelectedRangeActive()?.getCellsCount()??0)>1},{keys:[["Control","Space"]],captureCtrl:!0,callback:()=>r.extendCellsSelectionToColumns()},{keys:[["Shift","Space"]],stopPropagation:!0,callback:()=>r.extendCellsSelectionToRows()},{keys:[["ArrowUp"]],callback:()=>r.moveCellSelectionUp()},{keys:[["ArrowUp","Control/Meta"]],captureCtrl:!0,callback:()=>r.moveCellSelectionToMostTop()},{keys:[["ArrowUp","Shift"]],callback:()=>r.extendCellsSelectionUp()},{keys:[["ArrowUp","Shift","Control/Meta"]],captureCtrl:!0,callback:()=>r.extendCellsSelectionToMostTop(),runOnlyIf:()=>e_(e.getSelected())&&!(e.selection.isSelectedByCorner()||e.selection.isSelectedByColumnHeader())},{keys:[["ArrowDown"]],callback:()=>r.moveCellSelectionDown()},{keys:[["ArrowDown","Control/Meta"]],captureCtrl:!0,callback:()=>r.moveCellSelectionToMostBottom()},{keys:[["ArrowDown","Shift"]],callback:()=>r.extendCellsSelectionDown()},{keys:[["ArrowDown","Shift","Control/Meta"]],captureCtrl:!0,callback:()=>r.extendCellsSelectionToMostBottom(),runOnlyIf:()=>e_(e.getSelected())&&!(e.selection.isSelectedByCorner()||e.selection.isSelectedByColumnHeader())},{keys:[["ArrowLeft"]],callback:()=>r.moveCellSelectionLeft()},{keys:[["ArrowLeft","Control/Meta"]],captureCtrl:!0,callback:()=>r.moveCellSelectionToMostLeft()},{keys:[["ArrowLeft","Shift"]],callback:()=>r.extendCellsSelectionLeft()},{keys:[["ArrowLeft","Shift","Control/Meta"]],captureCtrl:!0,callback:()=>r.extendCellsSelectionToMostLeft(),runOnlyIf:()=>e_(e.getSelected())&&!(e.selection.isSelectedByCorner()||e.selection.isSelectedByRowHeader())},{keys:[["ArrowRight"]],callback:()=>r.moveCellSelectionRight()},{keys:[["ArrowRight","Control/Meta"]],captureCtrl:!0,callback:()=>r.moveCellSelectionToMostRight()},{keys:[["ArrowRight","Shift"]],callback:()=>r.extendCellsSelectionRight()},{keys:[["ArrowRight","Shift","Control/Meta"]],captureCtrl:!0,callback:()=>r.extendCellsSelectionToMostRight(),runOnlyIf:()=>e_(e.getSelected())&&!(e.selection.isSelectedByCorner()||e.selection.isSelectedByRowHeader())},{keys:[["Home"]],captureCtrl:!0,callback:()=>r.moveCellSelectionToMostInlineStart(),runOnlyIf:()=>e_(e.getSelected())&&e.view.isMainTableNotFullyCoveredByOverlays()},{keys:[["Home","Shift"]],callback:()=>r.extendCellsSelectionToMostInlineStart()},{keys:[["Home","Control/Meta"]],captureCtrl:!0,callback:()=>r.moveCellSelectionToMostTopInlineStart(),runOnlyIf:()=>e_(e.getSelected())&&e.view.isMainTableNotFullyCoveredByOverlays()},{keys:[["End"]],captureCtrl:!0,callback:()=>r.moveCellSelectionToMostInlineEnd(),runOnlyIf:()=>e_(e.getSelected())&&e.view.isMainTableNotFullyCoveredByOverlays()},{keys:[["End","Shift"]],callback:()=>r.extendCellsSelectionToMostInlineEnd()},{keys:[["End","Control/Meta"]],captureCtrl:!0,callback:()=>r.moveCellSelectionToMostBottomInlineEnd(),runOnlyIf:()=>e_(e.getSelected())&&e.view.isMainTableNotFullyCoveredByOverlays()},{keys:[["PageUp"]],callback:()=>r.moveCellSelectionUpByViewportHight()},{keys:[["PageUp","Shift"]],callback:()=>r.extendCellsSelectionUpByViewportHeight()},{keys:[["PageDown"]],callback:()=>r.moveCellSelectionDownByViewportHeight()},{keys:[["PageDown","Shift"]],callback:()=>r.extendCellsSelectionDownByViewportHeight()},{keys:[["Tab"]],preventDefault:!1,callback:e=>r.moveCellSelectionInlineStart(e)},{keys:[["Shift","Tab"]],preventDefault:!1,callback:e=>r.moveCellSelectionInlineEnd(e)},{keys:[["Control/Meta","Backspace"]],callback:()=>r.scrollToFocusedCell()}],{runOnlyIf:()=>{let{navigableHeaders:t}=e.getSettings();return e_(e.getSelected())&&(t||!t&&e.countRenderedRows()>0&&e.countRenderedCols()>0)},group:dG});let n=r.tabNavigation();t.addShortcuts([{keys:[["Tab"],["Shift","Tab"]],preventDefault:!1,stopPropagation:!1,relativeToGroup:dG,group:d$,position:"before",callback:e=>n.before(e)},{keys:[["Tab"],["Shift","Tab"]],preventDefault:!1,stopPropagation:!1,relativeToGroup:dG,group:d$,callback:e=>n.after(e),position:"after"}])}function ut(e){let{classNames:t}=rr(e,/ht-theme-[a-zA-Z0-9_-]+/);return t.pop()}let ur="handsontable-core-styles";class un{#rX;#nt;#nr;#nn=null;#no=!1;#ni;#ns={};#na={};#nl;constructor({hot:e,rootElement:t,rootDocument:r,onThemeChange:n=e=>{},injectCoreCss:o=!0}){this.#rX=e,this.#nr=t,this.#ni=r,this.#nl=n,o&&this.#nh()}getCSSVariableValue(e){if(this.#ns[`--ht-${e}`])return this.#ns[`--ht-${e}`];let t=this.#nd(`--ht-${e}`)??this.#nu(`--ht-${e}`);if(null!==t)return this.#ns[`--ht-${e}`]=t,t}getStyleForTD(e){return this.#na?.td?.[e]}getDefaultRowHeight(e){let t=this.#nc();return void 0!==e&&e===this.#rX.view.getFirstRenderedVisibleRow()?(t??0)+1:t}areCellsBorderBox(){return"border-box"===this.getStyleForTD("box-sizing")}useTheme(e){"string"==typeof e&&/ht-theme-.*/.test(e)?(this.#ng(),e!==this.#nt&&(this.#nt=e),this.#nl(this.#nt),this.#np()):tQ(`${e} isn't a valid theme name. Please ensure it follows the format ht-theme-<theme-name>.`)}getThemeName(){return this.#nt}#nh(){if(!this.#rX||!this.#ni||!this.#ni.head)return;let e=this.#ni.getElementById(ur);if(e&&e instanceof HTMLStyleElement)return;let t=this.#ni.createElement("style");t.id=ur,t.textContent='/*!\n * Copyright (c) HANDSONCODE sp. z o. o.\n *\n * HANDSONTABLE is a software distributed by HANDSONCODE sp. z o. o., a Polish corporation based in\n * Gdynia, Poland, at Aleja Zwyciestwa 96-98, registered by the District Court in Gdansk under number\n * 538651, EU tax ID number: PL5862294002, share capital: PLN 67,200.00.\n *\n * This software is protected by applicable copyright laws, including international treaties, and dual-\n * licensed - depending on whether your use for commercial purposes, meaning intended for or\n * resulting in commercial advantage or monetary compensation, or not.\n *\n * If your use is strictly personal or solely for evaluation purposes, meaning for the purposes of testing\n * the suitability, performance, and usefulness of this software outside the production environment,\n * you agree to be bound by the terms included in the "handsontable-non-commercial-license.pdf" file.\n *\n * Your use of this software for commercial purposes is subject to the terms included in an applicable\n * license agreement.\n *\n * In any case, you must not make any such use of this software as to develop software which may be\n * considered competitive with this software.\n *\n * UNLESS EXPRESSLY AGREED OTHERWISE, HANDSONCODE PROVIDES THIS SOFTWARE ON AN "AS IS"\n * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, AND IN NO EVENT AND UNDER NO\n * LEGAL THEORY, SHALL HANDSONCODE BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY DIRECT,\n * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER ARISING FROM\n * USE OR INABILITY TO USE THIS SOFTWARE.\n *\n * Version: 18.1.0\n * Release date: 01/09/2026 (built at 01/09/2026 11:40:23)\n */\n.ht-root-wrapper{font-family:var(--ht-font-family),-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;flex-direction:column;height:100%;display:flex;position:relative}.ht-root-wrapper.ht-shadow-dom{isolation:isolate}.ht-root-wrapper.ht-slot-bottom-filled .ht-wrapper:not(.htHorizontallyScrollableByWindow) .ht_master .wtHolder,.ht-root-wrapper.ht-slot-bottom-filled .ht-wrapper:not(.htVerticallyScrollableByWindow) .ht_master .wtHolder,.ht-root-wrapper.ht-slot-top-filled .ht-wrapper:not(.htHorizontallyScrollableByWindow) .ht_master .wtHolder,.ht-root-wrapper.ht-slot-top-filled .ht-wrapper:not(.htVerticallyScrollableByWindow) .ht_master .wtHolder{background-color:var(--ht-background-color);box-shadow:inset 0 0 0 1px var(--ht-border-color)}.htFocusCatcher{opacity:0;z-index:-1;border:0;outline:0;width:0;height:0;margin:0;padding:0;position:absolute;display:block!important}.ht-grid{flex:auto;min-height:0;position:relative}.ht-grid-content{height:100%}.ht-slot-top,.ht-slot-bottom{flex:none;overflow-x:auto}.ht-slot-element{box-sizing:border-box;border:1px solid var(--ht-border-color);width:100%}.ht-slot-top>.ht-slot-element:not(:first-of-type){border-top-width:0}.ht-slot-top>.ht-slot-element:last-of-type,.ht-slot-bottom>.ht-slot-element:not(:last-of-type){border-bottom-width:0}.ht-slot-bottom>.ht-slot-element:first-of-type{border-top-width:0}.htScrollbarTest{scrollbar-width:auto;scrollbar-color:var(--ht-scrollbar-thumb-color)var(--ht-scrollbar-track-color)}.htScrollbarSafariTest::-webkit-scrollbar{width:9px;height:9px}.handsontable{font-family:var(--ht-font-family),-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;font-size:var(--ht-font-size);line-height:var(--ht-line-height);font-weight:var(--ht-font-weight);letter-spacing:var(--ht-letter-spacing);color:var(--ht-foreground-color);touch-action:manipulation;position:relative}.handsontable .wtHolder{scrollbar-width:auto;scrollbar-color:var(--ht-scrollbar-thumb-color)var(--ht-scrollbar-track-color)}.handsontable .wtHolder::-webkit-scrollbar{width:9px;height:9px}.handsontable .wtHolder::-webkit-scrollbar-track{background:var(--ht-scrollbar-track-color);border-radius:var(--ht-scrollbar-border-radius)}.handsontable .wtHolder::-webkit-scrollbar-thumb{background-color:var(--ht-scrollbar-thumb-color);border-radius:var(--ht-scrollbar-border-radius)}.handsontable .wtHolder::-webkit-scrollbar-corner{background:var(--ht-scrollbar-track-color)}.handsontable .wtHolder:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))::-webkit-scrollbar-corner{border-bottom-right-radius:var(--ht-scrollbar-border-radius)}.handsontable .wtHolder:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))::-webkit-scrollbar-corner{border-bottom-left-radius:var(--ht-scrollbar-border-radius)}.handsontable.ht-wrapper{width:100%;height:100%}.handsontable.ht-wrapper:not(.htFirstDatasetColumnNotRendered) :where(table.htCore>tbody>tr,.htGhostTable>table>tbody>tr)>td:first-of-type{border-inline-start-width:1px}.handsontable.htGhostTable.htNestedHeaders table{border-spacing:0;border-collapse:collapse}.handsontable.htGhostTable table thead th{border-bottom-width:0}.handsontable.htGhostTable table tbody tr:first-of-type th:first-child,.handsontable.htGhostTable table tbody tr:first-of-type td:first-child{height:calc(var(--ht-cell-vertical-padding)*2 + var(--ht-line-height) + 1px)}.handsontable.htGhostTable table tbody tr th,.handsontable.htGhostTable table tbody tr td{height:calc(var(--ht-cell-vertical-padding)*2 + var(--ht-line-height) + 1px);border-top-width:0}.handsontable:not(.htHorizontallyScrollableByWindow).htHasScrollX .ht_master .wtHolder,.handsontable:not(.htHorizontallyScrollableByWindow).htHasScrollY .ht_master .wtHolder,.handsontable:not(.htVerticallyScrollableByWindow).htHasScrollX .ht_master .wtHolder,.handsontable:not(.htVerticallyScrollableByWindow).htHasScrollY .ht_master .wtHolder{background-color:var(--ht-background-color);box-shadow:inset 0 0 0 1px var(--ht-border-color)}.handsontable :where(table.htCore>tbody,.htGhostTable>table>tbody)>tr.ht__row_even>th{background-color:var(--ht-row-header-even-background-color)}.handsontable :where(table.htCore>tbody,.htGhostTable>table>tbody)>tr.ht__row_even>td{background-color:var(--ht-row-cell-even-background-color)}.handsontable :where(table.htCore>tbody,.htGhostTable>table>tbody)>tr.ht__row_odd>th{background-color:var(--ht-row-header-odd-background-color)}.handsontable :where(table.htCore>tbody,.htGhostTable>table>tbody)>tr.ht__row_odd>td{background-color:var(--ht-row-cell-odd-background-color)}.handsontable :where(table.htCore>thead>tr,.htGhostTable>table>thead>tr,table.htCore>tbody>tr,.htGhostTable>table>tbody>tr)>th,.handsontable :where(table.htCore>tbody>tr,.htGhostTable>table>tbody>tr)>td{height:calc(var(--ht-cell-vertical-padding)*2 + var(--ht-line-height) + 1px);padding:var(--ht-cell-vertical-padding)var(--ht-cell-horizontal-padding);vertical-align:top;border-top-width:0;border-inline-width:0 1px;font-size:var(--ht-font-size);line-height:var(--ht-line-height);white-space:pre-wrap;empty-cells:show;box-sizing:border-box;color:var(--ht-foreground-color);border-style:solid;border-bottom-width:1px;border-top-color:var(--ht-cell-vertical-border-color);border-bottom-color:var(--ht-cell-vertical-border-color);border-inline-start-color:var(--ht-cell-horizontal-border-color);border-inline-end-color:var(--ht-cell-horizontal-border-color);outline:0;overflow:hidden}.handsontable :where(table.htCore>thead>tr,.htGhostTable>table>thead>tr,table.htCore>tbody>tr,.htGhostTable>table>tbody>tr)>th.invisibleSelection,.handsontable :where(table.htCore>tbody>tr,.htGhostTable>table>tbody>tr)>td.invisibleSelection{outline:none}.handsontable :where(table.htCore>thead>tr,.htGhostTable>table>thead>tr,table.htCore>tbody>tr,.htGhostTable>table>tbody>tr)>th.invisibleSelection::selection,.handsontable :where(table.htCore>tbody>tr,.htGhostTable>table>tbody>tr)>td.invisibleSelection::selection{background:0 0}.handsontable :where(table.htCore>thead>tr,.htGhostTable>table>thead>tr,table.htCore>tbody>tr,.htGhostTable>table>tbody>tr)>th{text-align:center;font-weight:var(--ht-header-font-weight);white-space:nowrap;color:var(--ht-header-foreground-color);background-color:var(--ht-header-background-color);position:relative;overflow:visible}.handsontable :where(table.htCore>thead>tr,.htGhostTable>table>thead>tr,table.htCore>tbody>tr,.htGhostTable>table>tbody>tr)>th:last-child{border-inline-width:0 1px;border-bottom-width:1px;border-inline-end-color:var(--ht-border-color)}.handsontable :where(table.htCore>thead>tr,.htGhostTable>table>thead>tr,table.htCore>tbody>tr,.htGhostTable>table>tbody>tr)>th:last-child.ht__active_highlight{border-inline-end-color:var(--ht-header-active-border-color)}.handsontable :where(table.htCore>thead>tr,.htGhostTable>table>thead>tr,table.htCore>tbody>tr,.htGhostTable>table>tbody>tr)>th:first-child{border-inline-start-color:var(--ht-border-color)}.handsontable :where(table.htCore>thead>tr,.htGhostTable>table>thead>tr,table.htCore>tbody>tr,.htGhostTable>table>tbody>tr)>th:first-child.ht__active_highlight{border-inline-start-color:var(--ht-header-active-border-color)}.handsontable :where(table.htCore>thead>tr,.htGhostTable>table>thead>tr,table.htCore>tbody>tr,.htGhostTable>table>tbody>tr)>th:first-child,.handsontable :where(table.htCore>thead>tr,.htGhostTable>table>thead>tr,table.htCore>tbody>tr,.htGhostTable>table>tbody>tr)>th:nth-child(2){border-inline-start-width:1px}.handsontable :where(table.htCore>thead>tr,.htGhostTable>table>thead>tr,table.htCore>tbody>tr,.htGhostTable>table>tbody>tr)>th.current{box-shadow:inset 0 0 0 1px var(--ht-cell-selection-border-color)}.handsontable :where(table.htCore>thead>tr,.htGhostTable>table>thead>tr,table.htCore>tbody>tr,.htGhostTable>table>tbody>tr)>th.active{color:var(--ht-header-active-foreground-color);background-color:var(--ht-header-active-background-color)}.handsontable :where(table.htCore>thead>tr,.htGhostTable>table>thead>tr,table.htCore>tbody>tr,.htGhostTable>table>tbody>tr)>th.ht__highlight{color:var(--ht-header-highlighted-foreground-color);background-color:var(--ht-header-highlighted-background-color)}.handsontable :where(table.htCore>thead>tr,.htGhostTable>table>thead>tr,table.htCore>tbody>tr,.htGhostTable>table>tbody>tr)>th.ht__active_highlight{border-color:var(--ht-header-active-border-color);color:var(--ht-header-active-foreground-color);background-color:var(--ht-header-active-background-color)}.handsontable :where(table.htCore>thead>tr,.htGhostTable>table>thead>tr,table.htCore>tbody>tr,.htGhostTable>table>tbody>tr)>th.ht__active_highlight-prev,.handsontable :where(table.htCore>thead>tr,.htGhostTable>table>thead>tr,table.htCore>tbody>tr,.htGhostTable>table>tbody>tr)>th.ht__active_highlight-seam{border-inline-end-color:var(--ht-header-active-border-color)}.handsontable :where(table.htCore,.htGhostTable>table)>tbody>tr.ht__row_odd>th.ht__highlight,.handsontable :where(table.htCore,.htGhostTable>table)>tbody>tr.ht__row_even>th.ht__highlight{color:var(--ht-header-row-highlighted-foreground-color);background-color:var(--ht-header-row-highlighted-background-color)}.handsontable :where(table.htCore,.htGhostTable>table)>tbody>tr.ht__row_odd>th.ht__active_highlight,.handsontable :where(table.htCore,.htGhostTable>table)>tbody>tr.ht__row_even>th.ht__active_highlight{color:var(--ht-header-row-active-foreground-color);background-color:var(--ht-header-row-active-background-color)}.handsontable :where(table.htCore,.htGhostTable>table)>tbody>tr:first-of-type>th:first-child:empty:after,.handsontable :where(table.htCore,.htGhostTable>table)>tbody>tr:first-of-type>td:first-child:empty:after{content:"";min-height:var(--ht-line-height);display:block}.handsontable :where(table.htCore,.htGhostTable>table)>tbody>tr>th{color:var(--ht-header-row-foreground-color);background-color:var(--ht-header-row-background-color);padding:0}.handsontable :where(table.htCore,.htGhostTable>table)>tbody>tr>th .relative{padding:var(--ht-cell-vertical-padding)var(--ht-cell-horizontal-padding);min-height:100%}.handsontable :where(table.htCore,.htGhostTable>table)>tbody>tr>td:first-child{border-inline-start-color:var(--ht-border-color)}.handsontable :where(table.htCore,.htGhostTable>table)>tbody>tr>td:last-child{border-inline-end-color:var(--ht-border-color)}.handsontable :where(table.htCore,.htGhostTable>table)>tbody>tr>th.ht__active_highlight-prev-row{border-bottom-color:var(--ht-header-active-border-color)}.handsontable :where(table.htCore,.htGhostTable>table)>thead>tr>th{padding:0}.handsontable :where(table.htCore,.htGhostTable>table)>thead>tr>th.ht__active_highlight{box-shadow:-1px 0 0 0 var(--ht-header-active-border-color)}.handsontable :where(table.htCore,.htGhostTable>table)>thead>tr>th .relative{padding:var(--ht-cell-vertical-padding)var(--ht-cell-horizontal-padding);flex-direction:row;align-items:center;gap:2px;display:flex}.handsontable :where(table.htCore,.htGhostTable>table)>thead>tr>th .relative .colHeader{text-overflow:ellipsis;vertical-align:top;flex:auto;min-width:0;overflow:hidden}.handsontable :where(table.htCore>thead,table.htCore>tbody,.htGhostTable>table>thead,.htGhostTable>table>tbody)>tr:first-child>th,.handsontable :where(table.htCore>thead,table.htCore>tbody,.htGhostTable>table>thead,.htGhostTable>table>tbody)>tr:first-child>td{border-top-color:var(--ht-border-color);border-top-width:1px}.handsontable :where(table.htCore>thead,table.htCore>tbody,.htGhostTable>table>thead,.htGhostTable>table>tbody)>tr:first-child>th.ht__active_highlight,.handsontable :where(table.htCore>thead,table.htCore>tbody,.htGhostTable>table>thead,.htGhostTable>table>tbody)>tr:first-child>th.ht__active_highlight-row-seam-bottom,.handsontable :where(table.htCore>thead,table.htCore>tbody,.htGhostTable>table>thead,.htGhostTable>table>tbody)>tr:first-child>td.ht__active_highlight,.handsontable :where(table.htCore>thead,table.htCore>tbody,.htGhostTable>table>thead,.htGhostTable>table>tbody)>tr:first-child>td.ht__active_highlight-row-seam-bottom{border-top-color:var(--ht-header-active-border-color)}.handsontable :where(table.htCore>thead,table.htCore>tbody,.htGhostTable>table>thead,.htGhostTable>table>tbody)>tr:last-child>th,.handsontable :where(table.htCore>thead,table.htCore>tbody,.htGhostTable>table>thead,.htGhostTable>table>tbody)>tr:last-child>td{border-bottom-color:var(--ht-border-color)}.handsontable :where(table.htCore>thead,table.htCore>tbody,.htGhostTable>table>thead,.htGhostTable>table>tbody)>tr:last-child>th.ht__active_highlight,.handsontable :where(table.htCore>thead,table.htCore>tbody,.htGhostTable>table>thead,.htGhostTable>table>tbody)>tr:last-child>th.ht__active_highlight-row-seam-top,.handsontable :where(table.htCore>thead,table.htCore>tbody,.htGhostTable>table>thead,.htGhostTable>table>tbody)>tr:last-child>td.ht__active_highlight,.handsontable :where(table.htCore>thead,table.htCore>tbody,.htGhostTable>table>thead,.htGhostTable>table>tbody)>tr:last-child>td.ht__active_highlight-row-seam-top{border-bottom-color:var(--ht-header-active-border-color)}.handsontable div[class^=ht_clone] thead .ht__highlight .relative:after{content:"";height:var(--ht-header-highlighted-shadow-size);background-color:var(--ht-accent-color);display:block;position:absolute;bottom:-1px;left:-1px;right:-1px}.handsontable div[class^=ht_clone] thead tr:only-of-type .ht__highlight .relative:after{bottom:0}.handsontable div[class^=ht_clone] tbody .ht__highlight .relative:after{content:"";width:var(--ht-header-highlighted-shadow-size);background-color:var(--ht-accent-color);display:block;position:absolute;top:-1px;bottom:-1px;right:-1px}.handsontable div[class^=ht_clone] :where(table.htCore>tbody>tr,.htGhostTable>table>tbody>tr)>td:first-of-type{border-inline-start-width:1px}.handsontable :where(table.htCore,.htGhostTable>table)>thead>tr:not(:last-child)>th{overflow:hidden}.handsontable .hide{display:none}.handsontable .relative{box-sizing:border-box;position:relative}.handsontable .wtHider{width:0}.handsontable .wtSpreader{width:0;height:auto;position:relative}.handsontable .htAutoSize{visibility:hidden;position:absolute;top:-99000px;left:-99000px}.handsontable .htTextEllipsis{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.handsontable table.htCore,.handsontable:where(.htGhostTable)>table,.handsontable :where(table.htCore,.htGhostTable>table)>thead,.handsontable :where(table.htCore,.htGhostTable>table)>tbody,.handsontable input:not(:where(table.htCore>tbody>tr>td:not(.htCustomMenuRenderer) :not(.htCheckboxRendererInput),.htGhostTable>table>tbody>tr>td:not(.htCustomMenuRenderer) :not(.htCheckboxRendererInput))),.handsontable textarea:not(:where(table.htCore>tbody>tr>td:not(.htCustomMenuRenderer) :not(.htCheckboxRendererInput),.htGhostTable>table>tbody>tr>td:not(.htCustomMenuRenderer) :not(.htCheckboxRendererInput))),.handsontable div:not(:where(table.htCore>tbody>tr>td:not(.htCustomMenuRenderer) :not(.htCheckboxRendererInput),.htGhostTable>table>tbody>tr>td:not(.htCustomMenuRenderer) :not(.htCheckboxRendererInput))){box-sizing:content-box}.handsontable input:not(:where(table.htCore>tbody>tr>td:not(.htCustomMenuRenderer) :not(.htCheckboxRendererInput),.htGhostTable>table>tbody>tr>td:not(.htCustomMenuRenderer) :not(.htCheckboxRendererInput))),.handsontable textarea:not(:where(table.htCore>tbody>tr>td:not(.htCustomMenuRenderer) :not(.htCheckboxRendererInput),.htGhostTable>table>tbody>tr>td:not(.htCustomMenuRenderer) :not(.htCheckboxRendererInput))){min-height:initial}.handsontable .htCore{border-spacing:0;border-collapse:separate;table-layout:fixed;cursor:default;background-color:var(--ht-background-color);border-width:0;outline-width:0;width:0;margin:0}.handsontable :where(table.htCore,.htGhostTable>table)>colgroup>col,.handsontable :where(table.htCore,.htGhostTable>table)>colgroup>col.rowHeader{width:64px}.handsontable :where(table.htCore,.htGhostTable>table)>colgroup>col.hidden{width:0!important}.handsontable span.colHeader,.handsontable span.rowHeader{font-size:var(--ht-font-size);line-height:var(--ht-line-height);display:inline-block}.handsontable :where(table.htCore>thead,table.htCore>tbody,.htGhostTable>table>thead,.htGhostTable>table>tbody)>tr.hidden,.handsontable :where(table.htCore>thead,table.htCore>tbody,.htGhostTable>table>thead,.htGhostTable>table>tbody)>tr.hidden>td,.handsontable :where(table.htCore>thead,table.htCore>tbody,.htGhostTable>table>thead,.htGhostTable>table>tbody)>tr.hidden>th{display:none}.handsontable a:not(:where(table.htCore>tbody>tr>td:not(.htCustomMenuRenderer) :not(.htCheckboxRendererInput),.htGhostTable>table>tbody>tr>td:not(.htCustomMenuRenderer) :not(.htCheckboxRendererInput))){color:var(--ht-link-color)}.handsontable a:not(:where(table.htCore>tbody>tr>td:not(.htCustomMenuRenderer) :not(.htCheckboxRendererInput),.htGhostTable>table>tbody>tr>td:not(.htCustomMenuRenderer) :not(.htCheckboxRendererInput))):hover{color:var(--ht-link-hover-color)}.handsontable .ht_clone_top :where(table.htCore>thead>tr)>th:nth-child(2),.handsontable .ht_clone_top_inline_start_corner :where(table.htCore>thead>tr)>th:nth-child(2){border-inline-width:0 1px}.handsontable.htRowHeaders :where(table.htCore)>thead>tr>th:nth-child(2){border-inline-start-width:1px}.handsontable .ht_master:not(.innerBorderInlineStart):not(.emptyColumns) :where(table.htCore)>tbody>tr>th,.handsontable .ht_master:not(.innerBorderInlineStart):not(.emptyColumns) :where(table.htCore)>thead>tr>th:first-child,.handsontable .ht_master:not(.innerBorderInlineStart):not(.emptyColumns)~.handsontable:not(.htGhostTable) :where(table.htCore)>tbody>tr>th,.handsontable .ht_master:not(.innerBorderInlineStart):not(.emptyColumns)~.handsontable:not(.ht_clone_top):not(.htGhostTable) :where(table.htCore)>thead>tr>th:first-child{border-inline-width:1px 0}.handsontable .ht_master:not(.innerBorderTop):not(.innerBorderBottom) :where(table.htCore)>thead>tr:last-child>th,.handsontable .ht_master:not(.innerBorderTop):not(.innerBorderBottom)~.handsontable :where(table.htCore)>thead>tr:last-child>th,.handsontable .ht_master:not(.innerBorderTop):not(.innerBorderBottom) :where(table.htCore)>thead>tr.lastChild>th,.handsontable .ht_master:not(.innerBorderTop):not(.innerBorderBottom)~.handsontable :where(table.htCore)>thead>tr.lastChild>th{border-bottom-width:0}.handsontable.htAutoRowSize .ht_master.innerBorderTop :where(table.htCore)>tbody>tr:first-child>th,.handsontable.htAutoRowSize .ht_master.innerBorderTop :where(table.htCore)>tbody>tr:first-child>td,.handsontable.htAutoRowSize .ht_master.innerBorderTop~.ht_clone_inline_start :where(table.htCore)>tbody>tr:first-child>th,.handsontable.htAutoRowSize .ht_master.innerBorderTop~.ht_clone_inline_start :where(table.htCore)>tbody>tr:first-child>td{border-top-width:0}.handsontable .ht_master table.htCore>thead,.handsontable .ht_master table.htCore>tbody>tr>th,.handsontable .ht_clone_inline_start table.htCore>thead{visibility:hidden}.ht_master,.ht_clone_inline_start,.ht_clone_top,.ht_clone_bottom,.ht_master .wtHolder,.ht_clone_inline_start .wtHolder,.ht_clone_top .wtHolder,.ht_clone_bottom .wtHolder{overflow:hidden}.ht_master .wtHolder{overflow:auto}[dir=rtl].handsontable :where(table.htCore>tbody>tr,.htGhostTable>table>tbody>tr)>td[dir=ltr]{border-inline-width:1px 0}[dir=rtl].handsontable :where(table.htCore,.htGhostTable>table)>tbody>tr>td[dir=ltr]:last-child{border-inline-start-color:var(--ht-border-color)}[dir=rtl].handsontable div[class^=ht_clone] tbody .ht__highlight .relative:after{left:-1px;right:auto}.handsontable.ht-wrapper{border-radius:var(--ht-border-radius)}.handsontable.ht-wrapper:not(.htColumnHeaders) .ht_master .htCore>tbody>tr:first-child>td:first-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:var(--ht-border-radius)}.handsontable.ht-wrapper:not(.htColumnHeaders) .ht_master .htCore>tbody>tr:first-child>td:first-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:var(--ht-border-radius)}.handsontable.ht-wrapper:not(.htColumnHeaders) .ht_master .htCore>tbody>tr:first-child>td:last-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:var(--ht-border-radius)}.handsontable.ht-wrapper:not(.htColumnHeaders) .ht_master .htCore>tbody>tr:first-child>td:last-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:var(--ht-border-radius)}.handsontable.ht-wrapper:not(.htColumnHeaders) .ht_clone_top_inline_start_corner .htCore>tbody>tr:first-child>td:first-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:var(--ht-border-radius)}.handsontable.ht-wrapper:not(.htColumnHeaders) .ht_clone_top_inline_start_corner .htCore>tbody>tr:first-child>td:first-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:var(--ht-border-radius)}.handsontable.ht-wrapper:not(.htColumnHeaders) .ht_clone_top .htCore>tbody>tr:first-child>td:first-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:var(--ht-border-radius)}.handsontable.ht-wrapper:not(.htColumnHeaders) .ht_clone_top .htCore>tbody>tr:first-child>td:first-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:var(--ht-border-radius)}.handsontable.ht-wrapper:not(.htColumnHeaders) .ht_clone_top .htCore>tbody>tr:first-child>td:last-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:var(--ht-border-radius)}.handsontable.ht-wrapper:not(.htColumnHeaders) .ht_clone_top .htCore>tbody>tr:first-child>td:last-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:var(--ht-border-radius)}:is(.handsontable.ht-wrapper:not(.htColumnHeaders) .ht_clone_inline_start .htCore>tbody>tr:first-child>th:first-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),.handsontable.ht-wrapper:not(.htColumnHeaders) .ht_clone_inline_start .htCore>tbody>tr:first-child>td:first-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-left-radius:var(--ht-border-radius)}:is(.handsontable.ht-wrapper:not(.htColumnHeaders) .ht_clone_inline_start .htCore>tbody>tr:first-child>th:first-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),.handsontable.ht-wrapper:not(.htColumnHeaders) .ht_clone_inline_start .htCore>tbody>tr:first-child>td:first-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-right-radius:var(--ht-border-radius)}.handsontable.ht-wrapper .ht_master .wtHolder,.handsontable.ht-wrapper .ht_master .htCore{border-radius:var(--ht-border-radius)}.handsontable.ht-wrapper .ht_master .htCore>thead>tr:first-child>th:first-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:var(--ht-border-radius)}.handsontable.ht-wrapper .ht_master .htCore>thead>tr:first-child>th:first-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:var(--ht-border-radius)}.handsontable.ht-wrapper .ht_master .htCore>thead>tr:first-child>th:not(.hiddenHeader).htLastVisibleHeader:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:var(--ht-border-radius)}.handsontable.ht-wrapper .ht_master .htCore>thead>tr:first-child>th:not(.hiddenHeader).htLastVisibleHeader:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:var(--ht-border-radius)}.handsontable.ht-wrapper .ht_master .htCore>thead>tr:last-child>th:first-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-left-radius:var(--ht-border-radius)}.handsontable.ht-wrapper .ht_master .htCore>thead>tr:last-child>th:first-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-right-radius:var(--ht-border-radius)}.handsontable.ht-wrapper .ht_master .htCore>thead>tr:last-child>th:not(.hiddenHeader).htLastVisibleHeader:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-right-radius:var(--ht-border-radius)}.handsontable.ht-wrapper .ht_master .htCore>thead>tr:last-child>th:not(.hiddenHeader).htLastVisibleHeader:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-left-radius:var(--ht-border-radius)}.handsontable.ht-wrapper .ht_master .htCore>tbody>tr:last-child>td:first-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-left-radius:var(--ht-border-radius)}.handsontable.ht-wrapper .ht_master .htCore>tbody>tr:last-child>td:first-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-right-radius:var(--ht-border-radius)}.handsontable.ht-wrapper .ht_master .htCore>tbody>tr:last-child>td:last-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-right-radius:var(--ht-border-radius)}.handsontable.ht-wrapper .ht_master .htCore>tbody>tr:last-child>td:last-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-left-radius:var(--ht-border-radius)}.handsontable.ht-wrapper .ht_clone_top_inline_start_corner .htCore:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:var(--ht-border-radius)}.handsontable.ht-wrapper .ht_clone_top_inline_start_corner .htCore:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:var(--ht-border-radius)}.handsontable.ht-wrapper .ht_clone_top_inline_start_corner .htCore>thead>tr:first-child>th:first-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:var(--ht-border-radius)}.handsontable.ht-wrapper .ht_clone_top_inline_start_corner .htCore>thead>tr:first-child>th:first-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:var(--ht-border-radius)}.handsontable.ht-wrapper .ht_clone_top .htCore:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:var(--ht-border-radius);border-top-right-radius:var(--ht-border-radius)}.handsontable.ht-wrapper .ht_clone_top .htCore:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:var(--ht-border-radius);border-top-left-radius:var(--ht-border-radius)}.handsontable.ht-wrapper .ht_clone_top .htCore>thead>tr:first-child>th:first-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:var(--ht-border-radius)}.handsontable.ht-wrapper .ht_clone_top .htCore>thead>tr:first-child>th:first-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:var(--ht-border-radius)}.handsontable.ht-wrapper .ht_clone_top .htCore>thead>tr:first-child>th:not(.hiddenHeader).htLastVisibleHeader:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:var(--ht-border-radius)}.handsontable.ht-wrapper .ht_clone_top .htCore>thead>tr:first-child>th:not(.hiddenHeader).htLastVisibleHeader:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:var(--ht-border-radius)}.handsontable.ht-wrapper .ht_clone_inline_start .htCore:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:var(--ht-border-radius);border-bottom-left-radius:var(--ht-border-radius)}.handsontable.ht-wrapper .ht_clone_inline_start .htCore:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:var(--ht-border-radius);border-bottom-right-radius:var(--ht-border-radius)}.handsontable.ht-wrapper .ht_clone_inline_start .htCore>thead>tr:first-child>th:first-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:var(--ht-border-radius)}.handsontable.ht-wrapper .ht_clone_inline_start .htCore>thead>tr:first-child>th:first-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:var(--ht-border-radius)}:is(.handsontable.ht-wrapper .ht_clone_inline_start .htCore>tbody>tr:last-child>th:first-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),.handsontable.ht-wrapper .ht_clone_inline_start .htCore>tbody>tr:last-child>td:first-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-bottom-left-radius:var(--ht-border-radius)}:is(.handsontable.ht-wrapper .ht_clone_inline_start .htCore>tbody>tr:last-child>th:first-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),.handsontable.ht-wrapper .ht_clone_inline_start .htCore>tbody>tr:last-child>td:first-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-bottom-right-radius:var(--ht-border-radius)}.handsontable.ht-wrapper .ht_clone_bottom_inline_start_corner .htCore:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-left-radius:var(--ht-border-radius)}.handsontable.ht-wrapper .ht_clone_bottom_inline_start_corner .htCore:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-right-radius:var(--ht-border-radius)}:is(.handsontable.ht-wrapper .ht_clone_bottom_inline_start_corner .htCore>:where(thead,tbody)>tr:last-child>th:first-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),.handsontable.ht-wrapper .ht_clone_bottom_inline_start_corner .htCore>:where(thead,tbody)>tr:last-child>td:first-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-bottom-left-radius:var(--ht-border-radius)}:is(.handsontable.ht-wrapper .ht_clone_bottom_inline_start_corner .htCore>:where(thead,tbody)>tr:last-child>th:first-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),.handsontable.ht-wrapper .ht_clone_bottom_inline_start_corner .htCore>:where(thead,tbody)>tr:last-child>td:first-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-bottom-right-radius:var(--ht-border-radius)}.handsontable.ht-wrapper .ht_clone_bottom .htCore:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-right-radius:var(--ht-border-radius);border-bottom-left-radius:var(--ht-border-radius)}.handsontable.ht-wrapper .ht_clone_bottom .htCore:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-left-radius:var(--ht-border-radius);border-bottom-right-radius:var(--ht-border-radius)}:is(.handsontable.ht-wrapper .ht_clone_bottom .htCore>:where(thead,tbody)>tr:last-child>th:first-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),.handsontable.ht-wrapper .ht_clone_bottom .htCore>:where(thead,tbody)>tr:last-child>td:first-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-bottom-left-radius:var(--ht-border-radius)}:is(.handsontable.ht-wrapper .ht_clone_bottom .htCore>:where(thead,tbody)>tr:last-child>th:first-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),.handsontable.ht-wrapper .ht_clone_bottom .htCore>:where(thead,tbody)>tr:last-child>td:first-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-bottom-right-radius:var(--ht-border-radius)}:is(.handsontable.ht-wrapper .ht_clone_bottom .htCore>:where(thead,tbody)>tr:last-child>th:last-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),.handsontable.ht-wrapper .ht_clone_bottom .htCore>:where(thead,tbody)>tr:last-child>td:last-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-bottom-right-radius:var(--ht-border-radius)}:is(.handsontable.ht-wrapper .ht_clone_bottom .htCore>:where(thead,tbody)>tr:last-child>th:last-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),.handsontable.ht-wrapper .ht_clone_bottom .htCore>:where(thead,tbody)>tr:last-child>td:last-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-bottom-left-radius:var(--ht-border-radius)}.handsontable.ht-wrapper.htHasScrollX:not(.htHorizontallyScrollableByWindow) .htCore:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),.handsontable.ht-wrapper.htHasScrollX:not(.htHorizontallyScrollableByWindow) .htCore:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-right-radius:0;border-bottom-left-radius:0}:is(.handsontable.ht-wrapper.htHasScrollX:not(.htHorizontallyScrollableByWindow) .htCore>thead>tr:last-child>th:first-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),.handsontable.ht-wrapper.htHasScrollX:not(.htHorizontallyScrollableByWindow) .htCore>tbody>tr:last-child>td:first-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),.handsontable.ht-wrapper.htHasScrollX:not(.htHorizontallyScrollableByWindow) .htCore>tbody>tr:last-child>th:first-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-bottom-left-radius:0}:is(.handsontable.ht-wrapper.htHasScrollX:not(.htHorizontallyScrollableByWindow) .htCore>thead>tr:last-child>th:first-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),.handsontable.ht-wrapper.htHasScrollX:not(.htHorizontallyScrollableByWindow) .htCore>tbody>tr:last-child>td:first-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),.handsontable.ht-wrapper.htHasScrollX:not(.htHorizontallyScrollableByWindow) .htCore>tbody>tr:last-child>th:first-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-bottom-right-radius:0}.handsontable.ht-wrapper.htHasScrollX:not(.htHorizontallyScrollableByWindow) .htCore>thead>tr:last-child>th:not(.hiddenHeader).htLastVisibleHeader:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-right-radius:0}.handsontable.ht-wrapper.htHasScrollX:not(.htHorizontallyScrollableByWindow) .htCore>tbody>tr:last-child>td:last-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-right-radius:0}.handsontable.ht-wrapper.htHasScrollX:not(.htHorizontallyScrollableByWindow) .htCore>tbody>tr:last-child>th:last-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-right-radius:0}.handsontable.ht-wrapper.htHasScrollX:not(.htHorizontallyScrollableByWindow) .htCore>thead>tr:last-child>th:not(.hiddenHeader).htLastVisibleHeader:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-left-radius:0}.handsontable.ht-wrapper.htHasScrollX:not(.htHorizontallyScrollableByWindow) .htCore>tbody>tr:last-child>td:last-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-left-radius:0}.handsontable.ht-wrapper.htHasScrollX:not(.htHorizontallyScrollableByWindow) .htCore>tbody>tr:last-child>th:last-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-left-radius:0}.handsontable.ht-wrapper.htHasScrollY:not(.htVerticallyScrollableByWindow) .htCore:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:0;border-bottom-right-radius:0}.handsontable.ht-wrapper.htHasScrollY:not(.htVerticallyScrollableByWindow) .htCore:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:0;border-bottom-left-radius:0}.handsontable.ht-wrapper.htHasScrollY:not(.htVerticallyScrollableByWindow) .htCore>thead>tr:first-child>th:not(.hiddenHeader).htLastVisibleHeader:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:0}.handsontable.ht-wrapper.htHasScrollY:not(.htVerticallyScrollableByWindow) .htCore>tbody>tr:first-child>td:last-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:0}.handsontable.ht-wrapper.htHasScrollY:not(.htVerticallyScrollableByWindow) .htCore>tbody>tr:first-child>th:last-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:0}.handsontable.ht-wrapper.htHasScrollY:not(.htVerticallyScrollableByWindow) .htCore>thead>tr:first-child>th:not(.hiddenHeader).htLastVisibleHeader:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:0}.handsontable.ht-wrapper.htHasScrollY:not(.htVerticallyScrollableByWindow) .htCore>tbody>tr:first-child>td:last-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:0}.handsontable.ht-wrapper.htHasScrollY:not(.htVerticallyScrollableByWindow) .htCore>tbody>tr:first-child>th:last-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:0}.handsontable.ht-wrapper.htHasScrollY:not(.htVerticallyScrollableByWindow) .htCore>thead>tr:last-child>th:not(.hiddenHeader).htLastVisibleHeader:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-right-radius:0}.handsontable.ht-wrapper.htHasScrollY:not(.htVerticallyScrollableByWindow) .htCore>tbody>tr:last-child>td:last-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-right-radius:0}.handsontable.ht-wrapper.htHasScrollY:not(.htVerticallyScrollableByWindow) .htCore>tbody>tr:last-child>th:last-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-right-radius:0}.handsontable.ht-wrapper.htHasScrollY:not(.htVerticallyScrollableByWindow) .htCore>thead>tr:last-child>th:not(.hiddenHeader).htLastVisibleHeader:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-left-radius:0}.handsontable.ht-wrapper.htHasScrollY:not(.htVerticallyScrollableByWindow) .htCore>tbody>tr:last-child>td:last-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-left-radius:0}.handsontable.ht-wrapper.htHasScrollY:not(.htVerticallyScrollableByWindow) .htCore>tbody>tr:last-child>th:last-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-left-radius:0}.ht-root-wrapper{border-radius:var(--ht-border-radius)}.ht-root-wrapper.ht-slot-bottom-filled .ht-wrapper:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),.ht-root-wrapper.ht-slot-bottom-filled .ht_master .wtHolder:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-right-radius:0;border-bottom-left-radius:0}.ht-root-wrapper.ht-slot-bottom-filled .ht-wrapper:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-right-radius:0;border-bottom-left-radius:0}.ht-root-wrapper.ht-slot-bottom-filled .ht_master .wtHolder:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-right-radius:0;border-bottom-left-radius:0}.ht-root-wrapper.ht-slot-bottom-filled .htCore:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),.ht-root-wrapper.ht-slot-bottom-filled .htCore:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-right-radius:0;border-bottom-left-radius:0}:is(.ht-root-wrapper.ht-slot-bottom-filled .htCore>thead>tr:last-child>th:first-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),.ht-root-wrapper.ht-slot-bottom-filled .htCore>tbody>tr:last-child>td:first-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),.ht-root-wrapper.ht-slot-bottom-filled .htCore>tbody>tr:last-child>th:first-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-bottom-left-radius:0}:is(.ht-root-wrapper.ht-slot-bottom-filled .htCore>thead>tr:last-child>th:first-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),.ht-root-wrapper.ht-slot-bottom-filled .htCore>tbody>tr:last-child>td:first-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),.ht-root-wrapper.ht-slot-bottom-filled .htCore>tbody>tr:last-child>th:first-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-bottom-right-radius:0}.ht-root-wrapper.ht-slot-bottom-filled .htCore>thead>tr:last-child>th:not(.hiddenHeader).htLastVisibleHeader:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-right-radius:0}.ht-root-wrapper.ht-slot-bottom-filled .htCore>tbody>tr:last-child>td:last-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-right-radius:0}.ht-root-wrapper.ht-slot-bottom-filled .htCore>tbody>tr:last-child>th:last-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-right-radius:0}.ht-root-wrapper.ht-slot-bottom-filled .htCore>thead>tr:last-child>th:not(.hiddenHeader).htLastVisibleHeader:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-left-radius:0}.ht-root-wrapper.ht-slot-bottom-filled .htCore>tbody>tr:last-child>td:last-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-left-radius:0}.ht-root-wrapper.ht-slot-bottom-filled .htCore>tbody>tr:last-child>th:last-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-left-radius:0}.ht-root-wrapper.ht-slot-top-filled .ht-wrapper:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),.ht-root-wrapper.ht-slot-top-filled .ht_master .wtHolder:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:0;border-top-right-radius:0}.ht-root-wrapper.ht-slot-top-filled .ht-wrapper:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:0;border-top-right-radius:0}.ht-root-wrapper.ht-slot-top-filled .ht_master .wtHolder:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:0;border-top-right-radius:0}.ht-root-wrapper.ht-slot-top-filled .htCore:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),.ht-root-wrapper.ht-slot-top-filled .htCore:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:0;border-top-right-radius:0}:is(.ht-root-wrapper.ht-slot-top-filled .htCore>thead>tr:first-child>th:first-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),.ht-root-wrapper.ht-slot-top-filled .htCore>tbody>tr:first-child>td:first-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),.ht-root-wrapper.ht-slot-top-filled .htCore>tbody>tr:first-child>th:first-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-left-radius:0}:is(.ht-root-wrapper.ht-slot-top-filled .htCore>thead>tr:first-child>th:first-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),.ht-root-wrapper.ht-slot-top-filled .htCore>tbody>tr:first-child>td:first-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),.ht-root-wrapper.ht-slot-top-filled .htCore>tbody>tr:first-child>th:first-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-right-radius:0}.ht-root-wrapper.ht-slot-top-filled .htCore>thead>tr:first-child>th:not(.hiddenHeader).htLastVisibleHeader:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:0}.ht-root-wrapper.ht-slot-top-filled .htCore>tbody>tr:first-child>td:last-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:0}.ht-root-wrapper.ht-slot-top-filled .htCore>tbody>tr:first-child>th:last-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:0}.ht-root-wrapper.ht-slot-top-filled .htCore>thead>tr:first-child>th:not(.hiddenHeader).htLastVisibleHeader:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:0}.ht-root-wrapper.ht-slot-top-filled .htCore>tbody>tr:first-child>td:last-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:0}.ht-root-wrapper.ht-slot-top-filled .htCore>tbody>tr:first-child>th:last-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:0}.ht-root-wrapper .ht-slot-element{border-radius:var(--ht-border-radius)}.ht-root-wrapper .ht-slot-bottom>.ht-slot-element:not(:last-of-type){border-radius:0}.ht-root-wrapper .ht-slot-bottom>.ht-slot-element:last-of-type:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),.ht-root-wrapper .ht-slot-bottom>.ht-slot-element:last-of-type:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:0;border-top-right-radius:0}.ht-root-wrapper .ht-slot-top>.ht-slot-element:not(:first-of-type){border-radius:0}.ht-root-wrapper .ht-slot-top>.ht-slot-element:first-of-type:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),.ht-root-wrapper .ht-slot-top>.ht-slot-element:first-of-type:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-right-radius:0;border-bottom-left-radius:0}.handsontable.mobile,.handsontable.mobile .wtHolder{-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:#0000;-webkit-overflow-scrolling:touch}.handsontable.mobile .handsontableInput:focus{box-shadow:inset 0 0 0 2px var(--ht-accent-color);-webkit-appearance:none}.handsontable .topSelectionHandle,.handsontable .topSelectionHandle-HitArea,.handsontable .bottomSelectionHandle,.handsontable .bottomSelectionHandle-HitArea{inset-inline-start:-10000px;inset-inline-end:unset;z-index:9999;top:-10000px}.handsontable.hide-tween{animation:.2s forwards opacity-hide}.handsontable.show-tween{animation:.3s forwards opacity-show}.ht_clone_master{z-index:100}.ht_clone_inline_start{z-index:120}.ht_clone_bottom{z-index:130}.ht_clone_bottom_inline_start_corner{z-index:150}.ht_clone_top{z-index:160}.ht_clone_top_inline_start_corner{z-index:180}.ht_editor_hidden{z-index:-1}.ht_editor_visible{z-index:200}.handsontable td.area{position:relative}.handsontable td.area:before{content:"";background:var(--ht-cell-selection-background-color,#1a42e8);position:absolute;inset:0}.handsontable td.area-1{position:relative}.handsontable td.area-1:before{content:"";background:var(--ht-cell-selection-background-color,#1a42e8);position:absolute;inset:0}.handsontable td.area-2{position:relative}.handsontable td.area-2:before{content:"";background:var(--ht-cell-selection-background-color,#1a42e8);position:absolute;inset:0}.handsontable td.area-3{position:relative}.handsontable td.area-3:before{content:"";background:var(--ht-cell-selection-background-color,#1a42e8);position:absolute;inset:0}.handsontable td.area-4{position:relative}.handsontable td.area-4:before{content:"";background:var(--ht-cell-selection-background-color,#1a42e8);position:absolute;inset:0}.handsontable td.area-5{position:relative}.handsontable td.area-5:before{content:"";background:var(--ht-cell-selection-background-color,#1a42e8);position:absolute;inset:0}.handsontable td.area-6{position:relative}.handsontable td.area-6:before{content:"";background:var(--ht-cell-selection-background-color,#1a42e8);position:absolute;inset:0}.handsontable td.area-7{position:relative}.handsontable td.area-7:before{content:"";background:var(--ht-cell-selection-background-color,#1a42e8);position:absolute;inset:0}.handsontable td.area:before{opacity:.14}.handsontable td.area-1:before{opacity:.21}.handsontable td.area-2:before{opacity:.28}.handsontable td.area-3:before{opacity:.35}.handsontable td.area-4:before{opacity:.42}.handsontable td.area-5:before{opacity:.49}.handsontable td.area-6:before{opacity:.56}.handsontable td.area-7:before{opacity:.63}.handsontable td.area{border-color:color-mix(in srgb,var(--ht-border-color),var(--ht-foreground-color)10%)}.handsontable .wtSelectionHandle{box-sizing:border-box;z-index:115;background:var(--ht-cell-selection-handle-background-color);border:var(--ht-cell-selection-handle-border-width)solid var(--ht-cell-selection-handle-border-color);border-radius:var(--ht-cell-selection-handle-border-radius);animation:ht-selection-handle-fade-in var(--ht-table-transition)ease-in-out backwards;position:absolute}.handsontable .wtSelectionHandle:hover{background:color-mix(in srgb,var(--ht-cell-selection-handle-border-color)30%,var(--ht-cell-selection-handle-background-color))}@media (prefers-reduced-motion:reduce){.handsontable .wtSelectionHandle{animation:none}}.handsontable .wtSelectionHandle--top,.handsontable .wtSelectionHandle--bottom{width:var(--ht-cell-selection-handle-length);height:var(--ht-cell-selection-handle-size);cursor:ns-resize}.handsontable .wtSelectionHandle--start,.handsontable .wtSelectionHandle--end{width:var(--ht-cell-selection-handle-size);height:var(--ht-cell-selection-handle-length);cursor:ew-resize}.handsontable.ht__resizing-selection--top .wtSelectionHandle:not(.wtSelectionHandle--top),.handsontable.ht__resizing-selection--bottom .wtSelectionHandle:not(.wtSelectionHandle--bottom),.handsontable.ht__resizing-selection--start .wtSelectionHandle:not(.wtSelectionHandle--start),.handsontable.ht__resizing-selection--end .wtSelectionHandle:not(.wtSelectionHandle--end){display:none!important}.handsontable.ht__resizing-selection--top,.handsontable.ht__resizing-selection--top *,.handsontable.ht__resizing-selection--bottom,.handsontable.ht__resizing-selection--bottom *{cursor:ns-resize!important}.handsontable.ht__resizing-selection--start,.handsontable.ht__resizing-selection--start *,.handsontable.ht__resizing-selection--end,.handsontable.ht__resizing-selection--end *{cursor:ew-resize!important}.handsontable.ht__resizing-selection--top .wtSelectionHandle--top,.handsontable.ht__resizing-selection--bottom .wtSelectionHandle--bottom,.handsontable.ht__resizing-selection--start .wtSelectionHandle--start,.handsontable.ht__resizing-selection--end .wtSelectionHandle--end{background:color-mix(in srgb,var(--ht-cell-selection-handle-border-color)30%,var(--ht-cell-selection-handle-background-color))}.handsontable .wtMoveZone{cursor:grab}.handsontable .wtMoveZone:active,.handsontable.ht__moving{cursor:grabbing}.handsontable.ht__moving *{cursor:grabbing!important}.handsontable.ht__moving .wtBorder.area,.handsontable.ht__moving .wtBorder.current{display:none!important}.handsontable.ht__moving .wtSelectionHandle,.handsontable.ht__moving .wtMoveZone{visibility:hidden!important}.handsontable .wtBorder{font-size:0;position:absolute}.handsontable .wtBorder:first-child,.handsontable .wtBorder:nth-child(3){z-index:2}.handsontable .wtBorder:nth-child(2),.handsontable .wtBorder:nth-child(4){z-index:1}.handsontable .wtBorder.hidden{display:none!important}.handsontable .wtBorder.current{z-index:10;background-color:var(--ht-cell-selection-border-color)!important}.handsontable .wtBorder.area{z-index:8;background-color:var(--ht-cell-selection-border-color)!important}.handsontable .wtBorder.fill{z-index:6;background-color:var(--ht-cell-autofill-fill-border-color,#68696c)!important}.handsontable .wtBorder.corner{cursor:crosshair;z-index:110;font-size:0;border-radius:var(--ht-cell-autofill-border-radius)!important;background-color:var(--ht-cell-autofill-background-color,#1a42e8)!important;border-color:var(--ht-cell-autofill-border-color)!important}.handsontable .wtBorder.corner:after{content:"";border-radius:var(--ht-cell-autofill-border-radius);inset:min(0px,(var(--ht-cell-autofill-size) - var(--ht-cell-autofill-hit-area-size))/2);background:0 0;position:absolute}.handsontable .wtBorder.corner.wtCornerInlineEndEdge:after{inset-inline-end:0}.handsontable .wtBorder.corner.wtCornerBlockEndEdge:after{inset-block-end:0}@keyframes ht-selection-handle-fade-in{0%{opacity:0}to{opacity:1}}.hot-display-license-info{font-family:var(--ht-font-family),-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;padding:var(--ht-license-vertical-padding,16px)var(--ht-license-horizontal-padding,16px);font-size:var(--ht-font-size-small);line-height:var(--ht-line-height-small);color:var(--ht-license-foreground-color);background-color:var(--ht-license-background-color,#f7f7f9);text-align:left;min-width:300px}.hot-display-license-info a{font-size:var(--ht-license-font-size);color:var(--ht-link-color)}.hot-display-license-info a:hover{color:var(--ht-link-hover-color)}.ht-license-badge-wrapper{z-index:1050;pointer-events:none;position:absolute;inset:0;overflow:hidden}.ht-license-badge-on .ht-license-badge-corner thead tr:first-child th:first-child:after{content:"";inline-size:min(var(--ht-license-badge-size,16px),100%);block-size:min(var(--ht-license-badge-size,16px),100%);background-color:var(--ht-license-badge-color,var(--ht-disabled-color,#a3a3a3));pointer-events:none;margin:auto;position:absolute;inset:0;inset-inline-start:clamp(0px,100% - var(--ht-license-badge-size,16px),6px);-webkit-mask-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width=%2714.8626%27 height=%2716%27 viewBox=%270 0 14.8626 16%27 fill=%27none%27 xmlns=%27http://www.w3.org/2000/svg%27%3E%3Cpath d=%27M0 0H3.28665V4.35577H7.03576V0H10.306V11.407H7.03576V6.90834H3.28665V11.407H0V0Z%27 fill=%27%23000%27/%3E%3Cpath d=%27M11.0991 12.236H14.8633V16.0001H11.0991V12.236Z%27 fill=%27%23000%27/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width=%2714.8626%27 height=%2716%27 viewBox=%270 0 14.8626 16%27 fill=%27none%27 xmlns=%27http://www.w3.org/2000/svg%27%3E%3Cpath d=%27M0 0H3.28665V4.35577H7.03576V0H10.306V11.407H7.03576V6.90834H3.28665V11.407H0V0Z%27 fill=%27%23000%27/%3E%3Cpath d=%27M11.0991 12.236H14.8633V16.0001H11.0991V12.236Z%27 fill=%27%23000%27/%3E%3C/svg%3E");-webkit-mask-position:50%;mask-position:50%;-webkit-mask-size:contain;mask-size:contain;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.ht-license-badge-on .ht-license-badge-corner thead tr:first-child th:first-child:hover:after{background-color:var(--ht-license-badge-hover-color,var(--ht-read-only-color,#68696c))}[dir=rtl] .ht-license-badge-on .ht-license-badge-corner thead tr:first-child th:first-child:after{inset-inline-start:0;inset-inline-end:clamp(0px,100% - var(--ht-license-badge-size,16px),6px)}.ht-license-badge{clip-path:inset(50%);white-space:nowrap;color:#0000;background:0 0;border:0;block-size:1px;inline-size:1px;margin:0;padding:0;position:absolute;inset-block-start:0;inset-inline-start:0;overflow:hidden}.ht-license-popover{font-family:var(--ht-font-family),-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;z-index:1051;inline-size:auto;max-inline-size:min(var(--ht-license-popover-width,320px),100vw - 32px);border-radius:var(--ht-border-radius,8px);background-color:var(--ht-license-popover-background-color,#16171a);max-block-size:100%;color:var(--ht-license-popover-foreground-color,#fff);font-size:var(--ht-font-size-small,12px);line-height:var(--ht-line-height-small,18px);text-align:start;pointer-events:auto;box-shadow:var(--ht-shadow-x,0)var(--ht-shadow-y,0)var(--ht-shadow-blur,8px)color-mix(in srgb,var(--ht-shadow-color,#000)var(--ht-shadow-opacity,100%),transparent);flex-direction:column;padding:16px;display:none;position:absolute;inset-block-start:0;inset-inline-start:var(--ht-license-badge-area-width,50px);inset-inline-end:0;overflow:visible}.ht-license-popover:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:0}.ht-license-popover:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:0}.ht-license-popover:before{content:"";border-block-start:var(--ht-license-popover-tail-size,5px)solid var(--ht-license-popover-background-color,#16171a);border-inline-start:var(--ht-license-popover-tail-size,5px)solid #0000;block-size:0;inline-size:0;position:absolute;inset-block-start:0;inset-inline-end:100%}.ht-license-popover__content{min-block-size:0;overflow-y:auto}.ht-license-badge-wrapper.is-corner-hover:not(.is-dismissed) .ht-license-popover,.ht-license-badge-wrapper:not(.is-dismissed):hover .ht-license-popover,.ht-license-popover.is-open{display:flex}.ht-license-badge-wrapper.is-cornerless .ht-license-badge{display:none}.ht-license-badge-wrapper.is-cornerless .ht-license-popover{inset-inline-start:0}.ht-license-badge-wrapper.is-cornerless .ht-license-popover:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:var(--ht-border-radius,8px)}.ht-license-badge-wrapper.is-cornerless .ht-license-popover:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:var(--ht-border-radius,8px)}.ht-license-badge-wrapper.is-cornerless .ht-license-popover:before{display:none}.ht-license-popover__title{margin-block-end:8px;padding-inline-end:16px;font-weight:700}.ht-license-popover__body{color:var(--ht-license-popover-body-color,#d5d6d8);margin:0 0 12px}.ht-license-popover__link{color:var(--ht-license-popover-link-color,#3ba0ff);text-decoration:none}.ht-license-popover__link:hover{text-decoration:underline}.ht-license-popover__close{block-size:20px;inline-size:20px;color:inherit;cursor:pointer;background:0 0;border:0;justify-content:center;align-items:center;padding:0;line-height:1;display:flex;position:absolute;inset-block-start:12px;inset-inline-end:12px}.ht-license-popover__close:before{content:"✕";font-size:14px}.ht-dialog.ht-license-lock{z-index:1070}.ht-dialog.ht-license-lock:before{content:"";block-size:calc(var(--ht-line-height,20px) + var(--ht-density-cell-vertical,4px)*2);background-color:var(--ht-header-background-color);border-block-end:1px solid var(--ht-cell-horizontal-border-color,var(--ht-border-color));position:absolute;inset-block-start:0;inset-inline:0}.ht-dialog.ht-license-lock:after{content:"";inline-size:var(--ht-license-badge-size,16px);block-size:var(--ht-license-badge-size,16px);background-color:var(--ht-license-badge-color,var(--ht-disabled-color,#a3a3a3));position:absolute;inset-block-start:calc(var(--ht-density-cell-vertical,4px) + (var(--ht-line-height,20px) - var(--ht-license-badge-size,16px))/2);inset-inline-start:var(--ht-cell-horizontal-padding,8px);-webkit-mask-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width=%2714.8626%27 height=%2716%27 viewBox=%270 0 14.8626 16%27 fill=%27none%27 xmlns=%27http://www.w3.org/2000/svg%27%3E%3Cpath d=%27M0 0H3.28665V4.35577H7.03576V0H10.306V11.407H7.03576V6.90834H3.28665V11.407H0V0Z%27 fill=%27%23000%27/%3E%3Cpath d=%27M11.0991 12.236H14.8633V16.0001H11.0991V12.236Z%27 fill=%27%23000%27/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width=%2714.8626%27 height=%2716%27 viewBox=%270 0 14.8626 16%27 fill=%27none%27 xmlns=%27http://www.w3.org/2000/svg%27%3E%3Cpath d=%27M0 0H3.28665V4.35577H7.03576V0H10.306V11.407H7.03576V6.90834H3.28665V11.407H0V0Z%27 fill=%27%23000%27/%3E%3Cpath d=%27M11.0991 12.236H14.8633V16.0001H11.0991V12.236Z%27 fill=%27%23000%27/%3E%3C/svg%3E");-webkit-mask-size:contain;mask-size:contain;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.ht-dialog.ht-license-lock .ht-dialog__content-wrapper{padding-block-start:calc(var(--ht-line-height,20px) + var(--ht-density-cell-vertical,4px)*2)}.ht-dialog.ht-license-lock .ht-dialog__content-wrapper-inner,.ht-dialog.ht-license-lock .ht-dialog__content{min-inline-size:0}.ht-dialog.ht-license-lock a.ht-button{text-decoration:none;display:inline-block}.ht-dialog.ht-license-lock .ht-dialog__title,.ht-dialog.ht-license-lock .ht-dialog__description{word-break:break-word;overflow-wrap:break-word}.handsontable .htAutocompleteArrow{cursor:default;width:var(--ht-icon-size);height:var(--ht-icon-size);float:right;top:calc((var(--ht-line-height) - var(--ht-icon-size))/2);margin-inline-start:calc(var(--ht-gap-size)*2);margin-inline-end:1px;font-size:0;position:relative}.handsontable .htAutocompleteArrow:after{content:"";opacity:.6;display:block;position:absolute;top:0;left:0}[dir=rtl].handsontable .htAutocompleteArrow{float:left}.handsontable .htCheckboxRendererInput{width:var(--ht-checkbox-size);height:var(--ht-checkbox-size);vertical-align:middle;cursor:pointer;margin:0;outline:none;margin-top:-2px;display:inline-block;position:relative}.handsontable .htCheckboxRendererInput:first-child{margin-inline-end:var(--ht-gap-size)}.handsontable .htCheckboxRendererInput:last-child{margin-inline-start:var(--ht-gap-size)}.handsontable .htCheckboxRendererInput:before{content:"";width:var(--ht-checkbox-size);height:var(--ht-checkbox-size);border-radius:var(--ht-checkbox-border-radius);border:1px solid var(--ht-checkbox-border-color);background-color:var(--ht-checkbox-background-color);box-sizing:border-box;pointer-events:none;transition:all var(--ht-table-transition)ease-in-out;display:inline-block;position:absolute;top:0;left:0}.handsontable .htCheckboxRendererInput:after{content:"";color:var(--ht-checkbox-icon-color);pointer-events:none;display:block;position:absolute;top:0;left:0;width:var(--ht-checkbox-size)!important;height:var(--ht-checkbox-size)!important}.handsontable .htCheckboxRendererInput:checked:before{border-color:var(--ht-checkbox-checked-border-color);background-color:var(--ht-checkbox-checked-background-color)}.handsontable .htCheckboxRendererInput:checked:after{color:var(--ht-checkbox-checked-icon-color)}.handsontable .htCheckboxRendererInput:checked:disabled:before{border-color:var(--ht-checkbox-checked-disabled-border-color);background-color:var(--ht-checkbox-checked-disabled-background-color)}.handsontable .htCheckboxRendererInput:checked:disabled:after{color:var(--ht-checkbox-checked-disabled-icon-color)}.handsontable .htCheckboxRendererInput:checked:focus:before{border-color:var(--ht-checkbox-checked-focus-border-color);background-color:var(--ht-checkbox-checked-focus-background-color)}.handsontable .htCheckboxRendererInput:checked:focus:after{color:var(--ht-checkbox-checked-focus-icon-color)}.handsontable .htCheckboxRendererInput:focus:before{border-color:var(--ht-checkbox-focus-border-color);background-color:var(--ht-checkbox-focus-background-color);outline:1px solid var(--ht-checkbox-focus-ring-color)}.handsontable .htCheckboxRendererInput:focus:after{color:var(--ht-checkbox-focus-icon-color)}.handsontable .htCheckboxRendererInput:disabled{cursor:initial}.handsontable .htCheckboxRendererInput:disabled:before{border-color:var(--ht-checkbox-disabled-border-color);background-color:var(--ht-checkbox-disabled-background-color)}.handsontable .htCheckboxRendererInput:disabled:after{color:var(--ht-checkbox-disabled-icon-color)}.handsontable .htCheckboxRendererInput:indeterminate:before{border-color:var(--ht-checkbox-indeterminate-border-color);background-color:var(--ht-checkbox-indeterminate-background-color)}.handsontable .htCheckboxRendererInput:indeterminate:after{color:var(--ht-checkbox-indeterminate-icon-color)}.handsontable .htCheckboxRendererInput:indeterminate:disabled:before{border-color:var(--ht-checkbox-indeterminate-disabled-border-color);background-color:var(--ht-checkbox-indeterminate-disabled-background-color)}.handsontable .htCheckboxRendererInput:indeterminate:disabled:after{color:var(--ht-checkbox-indeterminate-disabled-icon-color)}.handsontable .htCheckboxRendererInput:indeterminate:focus:before{border-color:var(--ht-checkbox-indeterminate-focus-border-color);background-color:var(--ht-checkbox-indeterminate-focus-background-color)}.handsontable .htCheckboxRendererInput:indeterminate:focus:after{color:var(--ht-checkbox-indeterminate-focus-icon-color)}.handsontable .htCheckboxRendererInput.noValue{opacity:.5}.handsontable .htCheckboxRendererLabel{font-size:inherit;line-height:inherit;cursor:pointer;color:inherit;margin:0;display:inline-block;position:relative}.handsontable .htCheckboxRendererLabel.fullWidth{width:100%}.handsontable .htPlaceholder{color:var(--ht-placeholder-color)}.handsontable .htDimmed{color:var(--ht-read-only-color)!important;background-color:var(--ht-cell-read-only-background-color)!important}.handsontable .htLeft{text-align:left}.handsontable .htCenter{text-align:center}.handsontable .htRight{text-align:right}.handsontable .htJustify{text-align:justify}.handsontable .htTop{vertical-align:top}.handsontable .htMiddle{vertical-align:middle}.handsontable .htBottom{vertical-align:bottom}.handsontable .htInvalid{background-color:var(--ht-cell-error-background-color)!important}.handsontable .htNoWrap{white-space:nowrap}.handsontable .htSearchResult{background-color:var(--ht-cell-success-background-color)!important}.handsontable .ht-multi-select-renderer{padding:var(--ht-cell-vertical-padding)var(--ht-cell-horizontal-padding);overflow:hidden}.handsontable .ht-multi-select-chips-container{align-items:center;gap:var(--ht-gap-size);flex-wrap:nowrap;max-width:100%;display:flex;overflow:hidden}.handsontable .ht-multi-select-chip{align-items:center;gap:var(--ht-gap-size);padding:var(--ht-chip-vertical-padding)calc((var(--ht-line-height) - var(--ht-icon-size))/2)var(--ht-chip-vertical-padding)var(--ht-chip-horizontal-padding);border-radius:var(--ht-chip-border-radius);background:var(--ht-chip-background);white-space:nowrap;box-sizing:border-box;flex-shrink:0;max-width:100px;display:inline-flex}.handsontable .ht-multi-select-chip-label{text-overflow:ellipsis;color:var(--ht-foreground-color);font-style:normal;font-weight:var(--ht-font-weight);line-height:var(--ht-line-height,40px);letter-spacing:var(--ht-letter-spacing,0);padding:0 var(--ht-chip-gap);overflow:hidden}.handsontable .ht-multi-select-chip-remove{cursor:pointer;color:var(--ht-icon-button-icon-color);background-position:50%;background-repeat:no-repeat;background-size:contain;flex-shrink:0;justify-content:center;align-items:center;padding:0;display:flex;position:relative;width:var(--ht-icon-size)!important;height:var(--ht-icon-size)!important}.handsontable .ht-multi-select-chip-remove:before{content:"";display:block;position:absolute;top:0;left:0}.handsontable .ht-multi-select-chip-remove:hover{background-color:var(--ht-icon-button-hover-background-color)}.handsontable .ht-multi-select-overflow{padding:var(--ht-chip-vertical-padding)var(--ht-chip-horizontal-padding);background:var(--ht-chip-background);border-radius:var(--ht-chip-border-radius);color:var(--ht-foreground-color);white-space:nowrap;flex-shrink:0;justify-content:center;align-items:center;display:inline-flex}.handsontableInputHolder{position:absolute;top:0;left:0}.handsontableInputHolder .handsontableInput{padding:calc(var(--ht-cell-vertical-padding,4px) + 1px)calc(var(--ht-cell-horizontal-padding,8px) + 1px);color:var(--ht-cell-editor-foreground-color);background-color:var(--ht-cell-editor-background-color,#fff);box-shadow:inset 0 0 0 var(--ht-cell-editor-border-width,2px)var(--ht-cell-editor-border-color,#1a42e8),0 0 var(--ht-cell-editor-shadow-blur-radius,0)0 var(--ht-cell-editor-shadow-color,transparent);box-sizing:border-box;border:none;border-radius:0;outline-width:0;margin:0;display:block;font-family:inherit!important;font-size:inherit!important;line-height:inherit!important;-webkit-appearance:none!important}.handsontableInputHolder .handsontableInput:focus{outline:none}.htSelectEditor{position:absolute}.htSelectEditor select{width:100%;height:100%;padding:calc(var(--ht-cell-vertical-padding,4px) + 1px)calc(var(--ht-cell-horizontal-padding,8px) + 1px);white-space:nowrap;text-overflow:ellipsis;color:var(--ht-cell-editor-foreground-color);background-color:var(--ht-cell-editor-background-color,#fff);box-shadow:inset 0 0 0 var(--ht-cell-editor-border-width,2px)var(--ht-cell-editor-border-color,#1a42e8),0 0 var(--ht-cell-editor-shadow-blur-radius,0)0 var(--ht-cell-editor-shadow-color,transparent);box-sizing:border-box;border:none;border-radius:0;margin:0;padding-inline-end:26px;position:absolute;inset:0;overflow:hidden;font-family:inherit!important;font-size:inherit!important;line-height:inherit!important;-webkit-appearance:none!important}.htSelectEditor select:focus{outline:none}.htSelectEditor .htAutocompleteArrow{z-index:1;pointer-events:none;margin-inline-end:4px;top:50%;transform:translateY(-50%)}.handsontable.listbox{box-shadow:var(--ht-menu-shadow-x,0)var(--ht-menu-shadow-y,0)var(--ht-menu-shadow-blur,8px)color-mix(in srgb,var(--ht-menu-shadow-color,#000)var(--ht-menu-shadow-opacity,100%),transparent);border:var(--ht-menu-border-width,1px)solid var(--ht-menu-border-color,#e5e5e9);margin:0}.handsontable.listbox .ht_master{background-color:var(--ht-background-color);overflow:hidden}.handsontable.listbox .wtHolder{overflow:auto;border-radius:0!important}.handsontable.listbox .wtHider,.handsontable.listbox .htCore{border-radius:0!important}.handsontable.listbox table{overflow:hidden}.handsontable.listbox table th,.handsontable.listbox table tr:first-child th,.handsontable.listbox table tr:last-child th,.handsontable.listbox table tr:first-child td,.handsontable.listbox table td{border-color:#0000!important}.handsontable.listbox table th,.handsontable.listbox table td{white-space:nowrap;text-overflow:ellipsis;border-radius:0!important}.handsontable.listbox table .wtBorder{visibility:hidden}.handsontable.listbox table strong{color:inherit;font-weight:700}.handsontable.listbox table tr td:hover td{cursor:pointer;background:color-mix(in srgb,var(--ht-menu-item-hover-color)var(--ht-menu-item-hover-color-opacity,100%),transparent)!important;box-shadow:none!important}.handsontable.listbox table td{transition:var(--ht-table-transition)background ease-in-out}.handsontable.listbox table td:hover{cursor:pointer;background-color:color-mix(in srgb,var(--ht-menu-item-hover-color)var(--ht-menu-item-hover-color-opacity,100%),transparent)!important}.handsontable.listbox table td.current:not([aria-expanded=true]){box-shadow:inset 0 0 0 1px var(--ht-accent-color)}.handsontable.listbox table td.htDimmed{cursor:default;font-style:inherit;color:inherit!important}.handsontable.listbox table td.htDimmed:not(.handsontable.listbox table td:hover){background-color:inherit!important}.handsontable.listbox table thead th{text-align:left;height:auto!important}.handsontable.listbox table thead th .relative{padding-top:calc(var(--ht-cell-vertical-padding) + var(--ht-gap-size));padding-bottom:calc(var(--ht-cell-vertical-padding) + var(--ht-gap-size))}.handsontable.listbox .ht_clone_top .wtHider{overflow:hidden}.handsontable.listbox .ht_clone_top table{border-radius:0}.handsontable.listbox .htBorders div{background:0 0!important}.handsontable.autocompleteEditor tr.ht__row_even th,.handsontable.autocompleteEditor tr.ht__row_even td,.handsontable.autocompleteEditor tr.ht__row_odd th,.handsontable.autocompleteEditor tr.ht__row_odd td{background-color:var(--ht-background-color,#fff)}[dir=rtl].handsontable.listbox table thead th{text-align:right}.handsontableEditor{position:absolute}.handsontableEditor .ht-multi-select-editor{box-shadow:var(--ht-menu-shadow-x,0)var(--ht-menu-shadow-y,0)var(--ht-menu-shadow-blur,8px)color-mix(in srgb,var(--ht-menu-shadow-color,#000)var(--ht-menu-shadow-opacity,100%),transparent);scrollbar-width:auto;scrollbar-color:var(--ht-scrollbar-thumb-color)var(--ht-scrollbar-track-color);border-radius:0 0 var(--ht-menu-border-radius)var(--ht-menu-border-radius);border:var(--ht-menu-border-width)solid var(--ht-menu-border-color);background:var(--ht-background-color);width:max-content;min-width:120px;padding:var(--ht-menu-vertical-padding)var(--ht-menu-horizontal-padding);overflow-y:auto}.handsontableEditor .ht-multi-select-editor .ht-multi-select-editor-search-input-wrapper{padding:var(--ht-menu-item-vertical-padding)var(--ht-menu-item-horizontal-padding);align-items:center;gap:var(--ht-gap-size);align-self:stretch;display:flex;position:relative}.handsontableEditor .ht-multi-select-editor .ht-multi-select-editor-search-icon{left:calc(var(--ht-menu-item-horizontal-padding) + 10px);opacity:.5;pointer-events:none;z-index:1;background-position:50%;background-repeat:no-repeat;background-size:contain;width:16px;height:16px;position:absolute;top:50%;transform:translateY(-50%)}.handsontableEditor .ht-multi-select-editor input.ht-multi-select-editor-search-input{box-sizing:border-box;border-radius:var(--ht-input-border-radius);width:100%;color:var(--ht-input-foreground-color);background-color:var(--ht-input-background-color);border:1px solid var(--ht-input-border-color);transition:var(--ht-table-transition)all ease-in-out;line-height:var(--ht-line-height);font-size:var(--ht-font-size);padding:var(--ht-input-vertical-padding)var(--ht-menu-item-horizontal-padding)var(--ht-input-vertical-padding)32px}.handsontableEditor .ht-multi-select-editor input.ht-multi-select-editor-search-input:hover{border-color:var(--ht-input-hover-border-color);color:var(--ht-input-hover-foreground-color);background-color:var(--ht-input-hover-background-color)}.handsontableEditor .ht-multi-select-editor input.ht-multi-select-editor-search-input:disabled{border-color:var(--ht-input-disabled-border-color);color:var(--ht-input-disabled-foreground-color);background-color:var(--ht-input-disabled-background-color)}.handsontableEditor .ht-multi-select-editor input.ht-multi-select-editor-search-input:focus{border-color:var(--ht-input-focus-border-color);color:var(--ht-input-focus-foreground-color);background-color:var(--ht-input-focus-background-color);outline-offset:0;box-shadow:none;outline:none}.handsontableEditor .ht-multi-select-editor input.ht-multi-select-editor-search-input::placeholder{color:var(--ht-foreground-color);opacity:.6}.handsontableEditor .ht-multi-select-editor .ht-multi-select-editor-separator{background-color:var(--ht-menu-border-color);width:100%;height:1px;margin:var(--ht-menu-vertical-padding)0 var(--ht-menu-vertical-padding)0;padding:0}.handsontableEditor .ht-multi-select-editor ul{width:100%;padding:var(--ht-gap-size)var(--ht-menu-horizontal-padding);flex-direction:column;align-items:flex-start;margin:0;list-style:none;display:flex}.handsontableEditor .ht-multi-select-editor ul li{background:var(--ht-background-color);padding:var(--ht-menu-item-vertical-padding)var(--ht-menu-item-horizontal-padding);-webkit-user-select:none;user-select:none;cursor:pointer;align-self:stretch;align-items:center;display:flex}.handsontableEditor .ht-multi-select-editor ul li *{cursor:pointer}.handsontableEditor .ht-multi-select-editor ul li.ht-multi-select-editor-item-selected{background:color-mix(in srgb,var(--ht-menu-item-active-color)var(--ht-menu-item-active-color-opacity,100%),transparent)}.handsontableEditor .ht-multi-select-editor ul li div{flex:1 0 0;align-items:center;display:flex}.handsontableEditor .ht-multi-select-editor ul li div input{-webkit-appearance:none;appearance:none;width:var(--ht-checkbox-size);height:var(--ht-checkbox-size);margin:0;padding:0;display:flex;position:relative}.handsontableEditor .ht-multi-select-editor ul li div input:after{content:"";display:block;position:absolute;top:0;left:0}.handsontableEditor .ht-multi-select-editor ul li div input:before{content:"";box-sizing:border-box;width:var(--ht-checkbox-size);height:var(--ht-checkbox-size);border-radius:var(--ht-checkbox-border-radius);border:1px solid var(--ht-checkbox-border-color);background:var(--ht-checkbox-background-color);background-position:50%;background-repeat:no-repeat;display:block;position:absolute;top:0;left:0}.handsontableEditor .ht-multi-select-editor ul li div input:checked:before{border-color:var(--ht-checkbox-checked-border-color);background:var(--ht-checkbox-checked-background-color)}.handsontableEditor .ht-multi-select-editor ul li div input:checked:after{color:var(--ht-checkbox-checked-icon-color);background-color:currentColor}.handsontableEditor .ht-multi-select-editor ul li div input:focus{outline:none}.handsontableEditor .ht-multi-select-editor ul li div label{color:var(--ht-foreground-color);text-overflow:ellipsis;font-size:var(--ht-font-size);font-style:normal;font-weight:400;line-height:var(--ht-line-height);letter-spacing:var(--ht-letter-spacing);width:100%;padding:0 0 0 calc(var(--ht-gap-size)*2);overflow:hidden}.handsontableEditor .ht-multi-select-editor ul li:hover{background:color-mix(in srgb,var(--ht-menu-item-hover-color)var(--ht-menu-item-hover-color-opacity,100%),transparent)}.handsontableEditor .ht-multi-select-editor ul li:has(input:focus){background:color-mix(in srgb,var(--ht-menu-item-hover-color)var(--ht-menu-item-hover-color-opacity,100%),transparent)}.handsontable .htUISelectCaption{width:100%;padding:var(--ht-input-vertical-padding)var(--ht-input-horizontal-padding);font-family:inherit;font-size:var(--ht-font-size);line-height:var(--ht-line-height);font-weight:var(--ht-font-weight);border-radius:var(--ht-input-border-radius);box-sizing:border-box;cursor:pointer;border:var(--ht-input-border-width)solid var(--ht-input-border-color);color:var(--ht-input-foreground-color);background-color:var(--ht-input-background-color);text-overflow:ellipsis;white-space:nowrap;transition:var(--ht-table-transition)all ease-in-out;margin:0;padding-inline-end:calc(var(--ht-input-horizontal-padding) + var(--ht-icon-size));overflow:hidden;outline:none!important}.handsontable .htUISelectCaption:after{content:"";right:calc(var(--ht-input-horizontal-padding) - var(--ht-icon-size)/4);display:block;position:absolute;top:50%;transform:translateY(-50%)}.handsontable .htUISelectCaption:hover{border-color:var(--ht-input-hover-border-color);color:var(--ht-input-hover-foreground-color);background-color:var(--ht-input-hover-background-color)}.handsontable .htUISelectCaption:disabled{border-color:var(--ht-input-disabled-border-color);color:var(--ht-input-disabled-foreground-color);background-color:var(--ht-input-disabled-background-color)}.handsontable .htUISelectCaption:focus{border-color:var(--ht-input-focus-border-color);color:var(--ht-input-focus-foreground-color);background-color:var(--ht-input-focus-background-color)}.handsontable .htUISelect{cursor:pointer;position:relative;outline:none!important}.handsontable .htUISelect:focus .htUISelectCaption{border-color:var(--ht-input-focus-border-color);color:var(--ht-input-focus-foreground-color);background-color:var(--ht-input-focus-background-color)}[dir=rtl].handsontable .htUISelectCaption:after{right:auto;left:calc(var(--ht-input-horizontal-padding) - var(--ht-icon-size)/4)}.handsontable .htFiltersMenuCondition .htUIInput input,.handsontable .htFiltersMenuValue .htUIMultipleSelectSearch input{width:100%;padding:var(--ht-input-vertical-padding)var(--ht-input-horizontal-padding);font-family:inherit;font-size:var(--ht-font-size);line-height:var(--ht-line-height);font-weight:var(--ht-font-weight);border-radius:var(--ht-input-border-radius);box-sizing:border-box;cursor:pointer;border:var(--ht-input-border-width)solid var(--ht-input-border-color);color:var(--ht-input-foreground-color);background-color:var(--ht-input-background-color);transition:var(--ht-table-transition)all ease-in-out;outline:none!important}.handsontable .htFiltersMenuCondition .htUIInput input:hover,.handsontable .htFiltersMenuValue .htUIMultipleSelectSearch input:hover{border-color:var(--ht-input-hover-border-color);color:var(--ht-input-hover-foreground-color);background-color:var(--ht-input-hover-background-color)}.handsontable .htFiltersMenuCondition .htUIInput input:disabled,.handsontable .htFiltersMenuValue .htUIMultipleSelectSearch input:disabled{border-color:var(--ht-input-disabled-border-color);color:var(--ht-input-disabled-foreground-color);background-color:var(--ht-input-disabled-background-color)}.handsontable .htFiltersMenuCondition .htUIInput input:focus,.handsontable .htFiltersMenuValue .htUIMultipleSelectSearch input:focus{border-color:var(--ht-input-focus-border-color);color:var(--ht-input-focus-foreground-color);background-color:var(--ht-input-focus-background-color)}.handsontable .htUIInput{text-align:center;padding:0;position:relative;outline:none!important}.handsontable .htUIInputIcon{position:absolute}.handsontable .htUIInput.htUIButton input,.handsontable .ht-button{min-width:64px;padding:var(--ht-button-vertical-padding)var(--ht-button-horizontal-padding);font-family:inherit;font-size:var(--ht-font-size);line-height:var(--ht-line-height);font-weight:var(--ht-font-weight);border-radius:var(--ht-button-border-radius);box-sizing:border-box;cursor:pointer;transition:var(--ht-table-transition)all ease-in-out;border-style:solid;border-width:1px;outline:none!important}.handsontable .htUIInput.htUIButtonCancel input,.handsontable .ht-button--secondary{border-color:var(--ht-secondary-button-border-color);background-color:var(--ht-secondary-button-background-color);color:var(--ht-secondary-button-foreground-color)}.handsontable .htUIInput.htUIButtonCancel input:hover,.handsontable .ht-button--secondary:hover{border-color:var(--ht-secondary-button-hover-border-color);background-color:var(--ht-secondary-button-hover-background-color);color:var(--ht-secondary-button-hover-foreground-color)}.handsontable .htUIInput.htUIButtonCancel input:disabled,.handsontable .ht-button--secondary:disabled{border-color:var(--ht-secondary-button-disabled-border-color);background-color:var(--ht-secondary-button-disabled-background-color);color:var(--ht-secondary-button-disabled-foreground-color)}.handsontable .htUIInput.htUIButtonCancel input:focus,.handsontable .ht-button--secondary:focus{border-color:var(--ht-secondary-button-focus-border-color);background-color:var(--ht-secondary-button-focus-background-color);color:var(--ht-secondary-button-focus-foreground-color);box-shadow:0 0 0 1px var(--ht-accent-color)}.htUIInput.htUIButtonOK input,.ht-button--primary{border-color:var(--ht-primary-button-border-color);background-color:var(--ht-primary-button-background-color);color:var(--ht-primary-button-foreground-color)}.htUIInput.htUIButtonOK input:hover,.ht-button--primary:hover{border-color:var(--ht-primary-button-hover-border-color);background-color:var(--ht-primary-button-hover-background-color);color:var(--ht-primary-button-hover-foreground-color)}.htUIInput.htUIButtonOK input:disabled,.ht-button--primary:disabled{border-color:var(--ht-primary-button-disabled-border-color);background-color:var(--ht-primary-button-disabled-background-color);color:var(--ht-primary-button-disabled-foreground-color)}.htUIInput.htUIButtonOK input:focus,.ht-button--primary:focus{border-color:var(--ht-primary-button-focus-border-color);background-color:var(--ht-primary-button-focus-background-color);color:var(--ht-primary-button-focus-foreground-color);box-shadow:0 0 0 1px var(--ht-accent-color)}.handsontable .htUIRadio{padding:var(--ht-gap-size)calc(2*var(--ht-gap-size));align-items:center;gap:var(--ht-gap-size);cursor:pointer;margin:0;padding-bottom:0;display:inline-flex;position:relative}.handsontable .htUIRadio:first-child{padding-inline-start:0}.handsontable .htUIRadio>input[type=radio]{width:var(--ht-radio-size);height:var(--ht-radio-size);-webkit-appearance:none;appearance:none;cursor:pointer;border-radius:calc(.5*var(--ht-radio-size));outline:none;margin:0;position:relative}.handsontable .htUIRadio>input[type=radio]:before{content:"";border-radius:calc(.5*var(--ht-radio-size));border:1px solid var(--ht-radio-border-color);background-color:var(--ht-radio-background-color);display:block;position:absolute;inset:0}.handsontable .htUIRadio>input[type=radio]:after{content:"";color:var(--ht-radio-icon-color);display:block;position:absolute}.handsontable .htUIRadio>input[type=radio]:checked:before{border-color:var(--ht-radio-checked-border-color);background-color:var(--ht-radio-checked-background-color)}.handsontable .htUIRadio>input[type=radio]:checked:after{color:var(--ht-radio-checked-icon-color)}.handsontable .htUIRadio>input[type=radio]:checked:disabled{cursor:initial}.handsontable .htUIRadio>input[type=radio]:checked:disabled:before{border-color:var(--ht-radio-checked-disabled-border-color);background-color:var(--ht-radio-checked-disabled-background-color)}.handsontable .htUIRadio>input[type=radio]:checked:disabled:after{color:var(--ht-radio-checked-disabled-icon-color)}.handsontable .htUIRadio>input[type=radio]:checked:focus:before{border-color:var(--ht-radio-checked-focus-border-color);background-color:var(--ht-radio-checked-focus-background-color)}.handsontable .htUIRadio>input[type=radio]:checked:focus:after{color:var(--ht-radio-checked-focus-icon-color)}.handsontable .htUIRadio>input[type=radio]:disabled{cursor:initial}.handsontable .htUIRadio>input[type=radio]:disabled:before{border-color:var(--ht-radio-disabled-border-color);background-color:var(--ht-radio-disabled-background-color)}.handsontable .htUIRadio>input[type=radio]:disabled:after{color:var(--ht-radio-disabled-icon-color)}.handsontable .htUIRadio>input[type=radio]:focus:before{border-color:var(--ht-radio-focus-border-color);background-color:var(--ht-radio-focus-background-color);outline:1px solid var(--ht-radio-focus-ring-color)}.handsontable .htUIRadio>input[type=radio]:focus:after{color:var(--ht-radio-focus-icon-color)}.handsontable .htUIRadio label{vertical-align:middle;cursor:pointer;color:inherit}.handsontable .htUIRadio label:before{content:"";display:block;position:absolute;inset:0}.handsontable .collapsibleIndicator,.handsontable .ht_nestingButton{width:var(--ht-icon-button-hit-area-size);height:var(--ht-icon-button-hit-area-size);margin:calc(-1*(var(--ht-icon-button-hit-area-size) - var(--ht-icon-size))/2 + 1px);box-sizing:border-box;cursor:pointer;text-indent:-100px;flex-shrink:0;font-size:0;position:relative;overflow:visible}.handsontable .collapsibleIndicator:before,.handsontable .ht_nestingButton:before{content:"";width:var(--ht-icon-size);height:var(--ht-icon-size);margin-top:calc(-.5*var(--ht-icon-size));margin-left:calc(-.5*var(--ht-icon-size));border-radius:var(--ht-collapse-button-border-radius);transition:var(--ht-table-transition)all ease-in-out;z-index:1;display:block;position:absolute;top:50%;left:50%}.handsontable .collapsibleIndicator:after,.handsontable .ht_nestingButton:after{content:"";width:var(--ht-icon-size);height:var(--ht-icon-size);margin-top:calc(-.5*var(--ht-icon-size));margin-left:calc(-.5*var(--ht-icon-size));border-radius:var(--ht-collapse-button-border-radius);transition:var(--ht-table-transition)all ease-in-out;z-index:0;display:block;position:absolute;top:50%;left:50%}.handsontable .collapsibleIndicator.expanded:before,.handsontable .collapsibleIndicator.ht_nestingCollapse:before,.handsontable .ht_nestingButton.expanded:before,.handsontable .ht_nestingButton.ht_nestingCollapse:before{color:var(--ht-collapse-button-open-icon-color)}.handsontable .collapsibleIndicator.expanded:after,.handsontable .collapsibleIndicator.ht_nestingCollapse:after,.handsontable .ht_nestingButton.expanded:after,.handsontable .ht_nestingButton.ht_nestingCollapse:after{background-color:var(--ht-collapse-button-open-background-color);box-shadow:0 0 0 1px var(--ht-collapse-button-open-border-color)}.handsontable .collapsibleIndicator.expanded:hover:before,.handsontable .collapsibleIndicator.ht_nestingCollapse:hover:before,.handsontable .ht_nestingButton.expanded:hover:before,.handsontable .ht_nestingButton.ht_nestingCollapse:hover:before{color:var(--ht-collapse-button-open-hover-icon-color)}.handsontable .collapsibleIndicator.expanded:hover:after,.handsontable .collapsibleIndicator.ht_nestingCollapse:hover:after,.handsontable .ht_nestingButton.expanded:hover:after,.handsontable .ht_nestingButton.ht_nestingCollapse:hover:after{background-color:var(--ht-collapse-button-open-hover-background-color);box-shadow:0 0 0 1px var(--ht-collapse-button-open-hover-border-color)}.handsontable .collapsibleIndicator.collapsed:before,.handsontable .collapsibleIndicator.ht_nestingExpand:before,.handsontable .ht_nestingButton.collapsed:before,.handsontable .ht_nestingButton.ht_nestingExpand:before{color:var(--ht-collapse-button-close-icon-color)}.handsontable .collapsibleIndicator.collapsed:after,.handsontable .collapsibleIndicator.ht_nestingExpand:after,.handsontable .ht_nestingButton.collapsed:after,.handsontable .ht_nestingButton.ht_nestingExpand:after{background-color:var(--ht-collapse-button-close-background-color);box-shadow:0 0 0 1px var(--ht-collapse-button-close-border-color)}.handsontable .collapsibleIndicator.collapsed:hover:before,.handsontable .collapsibleIndicator.ht_nestingExpand:hover:before,.handsontable .ht_nestingButton.collapsed:hover:before,.handsontable .ht_nestingButton.ht_nestingExpand:hover:before{color:var(--ht-collapse-button-close-hover-icon-color)}.handsontable .collapsibleIndicator.collapsed:hover:after,.handsontable .collapsibleIndicator.ht_nestingExpand:hover:after,.handsontable .ht_nestingButton.collapsed:hover:after,.handsontable .ht_nestingButton.ht_nestingExpand:hover:after{background-color:var(--ht-collapse-button-close-hover-background-color);box-shadow:0 0 0 1px var(--ht-collapse-button-close-hover-border-color)}.handsontable th.ht__active_highlight .collapsibleIndicator.collapsed:before,.handsontable th.ht__active_highlight .collapsibleIndicator.ht_nestingExpand:before,.handsontable th.ht__active_highlight .ht_nestingButton.collapsed:before,.handsontable th.ht__active_highlight .ht_nestingButton.ht_nestingExpand:before{color:var(--ht-collapse-button-close-icon-active-color)}.handsontable th.ht__active_highlight .collapsibleIndicator.collapsed:hover:before,.handsontable th.ht__active_highlight .collapsibleIndicator.ht_nestingExpand:hover:before,.handsontable th.ht__active_highlight .ht_nestingButton.collapsed:hover:before,.handsontable th.ht__active_highlight .ht_nestingButton.ht_nestingExpand:hover:before{color:var(--ht-collapse-button-close-hover-icon-active-color)}.handsontable th.ht__active_highlight .collapsibleIndicator.expanded:before,.handsontable th.ht__active_highlight .collapsibleIndicator.ht_nestingCollapse:before,.handsontable th.ht__active_highlight .ht_nestingButton.expanded:before,.handsontable th.ht__active_highlight .ht_nestingButton.ht_nestingCollapse:before{color:var(--ht-collapse-button-open-icon-active-color)}.handsontable th.ht__active_highlight .collapsibleIndicator.expanded:hover:before,.handsontable th.ht__active_highlight .collapsibleIndicator.ht_nestingCollapse:hover:before,.handsontable th.ht__active_highlight .ht_nestingButton.expanded:hover:before,.handsontable th.ht__active_highlight .ht_nestingButton.ht_nestingCollapse:hover:before{color:var(--ht-collapse-button-open-hover-icon-active-color)}.handsontable thead th.htRowspanHeader+th{border-inline-start-width:0}.handsontable thead th.htRowspanHeader{vertical-align:bottom;height:auto;overflow:visible}.handsontable thead th.htRowspanHeader.ht__active_highlight{border-inline-start-color:var(--ht-header-active-border-color);z-index:1}.handsontable.htRowHeaders.htHasRowspanHeaders :where(table.htCore)>thead>tr:last-child>th:first-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-left-radius:0}.handsontable.htRowHeaders.htHasRowspanHeaders :where(table.htCore)>thead>tr:last-child>th:first-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-right-radius:0}.handsontable.htHasRowspanHeaders .ht_clone_inline_start .htCore>tbody>tr:first-child>th:first-child:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:0}.handsontable.htHasRowspanHeaders .ht_clone_inline_start .htCore>tbody>tr:first-child>th:first-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:0}.handsontable .ht_master:not(.innerBorderTop):not(.innerBorderBottom) thead th.htRowspanBottomLevel,.handsontable .ht_master:not(.innerBorderTop):not(.innerBorderBottom)~.handsontable thead th.htRowspanBottomLevel{border-bottom-width:0}.handsontable thead th.hiddenHeader:not(:first-of-type){display:none}.handsontable thead th.hiddenHeaderText .colHeader{opacity:0}.handsontable th.ht_nestingLevels>.relative{align-items:center;gap:5px;display:flex}.handsontable th.ht_nestingLevels span:last-child{padding-left:calc(var(--ht-icon-size) + 5px)}.handsontable th.ht_nestingLevels span.ht_nestingLevel{display:inline-block}.handsontable th.ht_nestingLevels span.ht_nestingLevel_empty{order:-2;width:5px;height:1px;display:inline-block;position:relative}.handsontable th.ht_nestingLevels .ht_nestingButton{cursor:pointer;order:-1;position:relative}.handsontable th.beforeHiddenColumn,.handsontable th.afterHiddenColumn{position:relative}.handsontable th.beforeHiddenColumn:before,.handsontable th.beforeHiddenColumn:after,.handsontable th.afterHiddenColumn:before,.handsontable th.afterHiddenColumn:after{color:var(--ht-hidden-indicator-color);position:absolute;top:50%;transform:translateY(-50%);width:10px!important;height:10px!important}.handsontable th.beforeHiddenColumn:after{content:"";display:block;right:-2px}.handsontable th.afterHiddenColumn:before{content:"";display:block;left:-2px}.handsontable th.ht__active_highlight.beforeHiddenColumn:before,.handsontable th.ht__active_highlight.beforeHiddenColumn:after,.handsontable th.ht__active_highlight.afterHiddenColumn:before,.handsontable th.ht__active_highlight.afterHiddenColumn:after{color:var(--ht-icon-button-active-icon-color,var(--ht-icon-active-button-icon-color))}[dir=rtl].handsontable th.beforeHiddenColumn:after{right:initial;left:-2px;transform:translateY(-50%)rotate(180deg)}[dir=rtl].handsontable th.afterHiddenColumn:before{right:-2px;left:initial;transform:translateY(-50%)rotate(180deg)}.handsontable th.beforeHiddenRow,.handsontable th.afterHiddenRow{position:relative}.handsontable th.beforeHiddenRow:before,.handsontable th.beforeHiddenRow:after,.handsontable th.afterHiddenRow:before,.handsontable th.afterHiddenRow:after{color:var(--ht-hidden-indicator-color);position:absolute;left:50%;transform:translate(-50%);width:10px!important;height:10px!important}.handsontable th.beforeHiddenRow:after{content:"";display:block;bottom:-2px}.handsontable th.afterHiddenRow:before{content:"";display:block;top:-2px}.handsontable th.ht__active_highlight.beforeHiddenRow:before,.handsontable th.ht__active_highlight.beforeHiddenRow:after,.handsontable th.ht__active_highlight.afterHiddenRow:before,.handsontable th.ht__active_highlight.afterHiddenRow:after{color:var(--ht-icon-button-active-icon-color,var(--ht-icon-active-button-icon-color))}.handsontable .changeType{box-sizing:border-box;width:var(--ht-icon-button-hit-area-size);height:var(--ht-icon-button-hit-area-size);margin:calc(-1*(var(--ht-icon-button-hit-area-size) - var(--ht-icon-size))/2 + 1px);box-shadow:none;color:inherit;z-index:1;background:0 0;border:none;outline:none;flex-shrink:0;padding:0;position:relative;overflow:visible}.handsontable .changeType:before{content:"";width:var(--ht-icon-size);height:var(--ht-icon-size);margin-top:calc(-.5*var(--ht-icon-size));margin-left:calc(-.5*var(--ht-icon-size));color:var(--ht-icon-button-icon-color);z-index:1;display:block;position:absolute;top:50%;left:50%}.handsontable .changeType:after{content:"";width:var(--ht-icon-size);height:var(--ht-icon-size);margin-top:calc(-.5*var(--ht-icon-size));margin-left:calc(-.5*var(--ht-icon-size));border-radius:var(--ht-icon-button-border-radius);box-shadow:0 0 0 1px var(--ht-icon-button-border-color);background-color:var(--ht-icon-button-background-color);z-index:0;display:block;position:absolute;top:50%;left:50%}.handsontable .changeType:hover{cursor:pointer}.handsontable .changeType:hover:before{color:var(--ht-icon-button-hover-icon-color)}.handsontable .changeType:hover:after{box-shadow:0 0 0 1px var(--ht-icon-button-hover-border-color);background-color:var(--ht-icon-button-hover-background-color)}.handsontable .ht__active_highlight .changeType:before{color:var(--ht-icon-button-active-icon-color,var(--ht-icon-active-button-icon-color))}.handsontable .ht__active_highlight .changeType:after{box-shadow:0 0 0 1px var(--ht-icon-button-active-border-color,var(--ht-icon-active-button-border-color));background-color:var(--ht-icon-button-active-background-color,var(--ht-icon-active-button-background-color))}.handsontable .ht__active_highlight .changeType:hover:before{color:var(--ht-icon-button-active-hover-icon-color,var(--ht-icon-active-button-hover-icon-color))}.handsontable .ht__active_highlight .changeType:hover:after{box-shadow:0 0 0 1px var(--ht-icon-button-active-hover-border-color,var(--ht-icon-active-button-hover-border-color));background-color:var(--ht-icon-button-active-hover-background-color,var(--ht-icon-active-button-hover-background-color))}.handsontable th.htFiltersActive{background-color:var(--ht-header-filter-background-color)}.handsontable th.htFiltersActive.ht__active_highlight{background-color:color-mix(in srgb,var(--ht-header-active-background-color),var(--ht-header-filter-background-color)20%)}.handsontable.htDropdownMenu>.ht_master,.handsontable.htContextMenu>.ht_master,.handsontable.htFiltersConditionsMenu>.ht_master{box-shadow:var(--ht-menu-shadow-x,0)var(--ht-menu-shadow-y,0)var(--ht-menu-shadow-blur,8px)color-mix(in srgb,var(--ht-menu-shadow-color,#000)var(--ht-menu-shadow-opacity,100%),transparent);border:var(--ht-menu-border-width,1px)solid var(--ht-menu-border-color,#e5e5e9);border-radius:var(--ht-menu-border-radius);padding:var(--ht-menu-vertical-padding,8px)var(--ht-menu-horizontal-padding,0);background-color:var(--ht-background-color,#fff);overflow:hidden}.handsontable.htDropdownMenu:not(.htGhostTable),.handsontable.htContextMenu:not(.htGhostTable),.handsontable.htFiltersConditionsMenu:not(.htGhostTable){z-index:1060;display:none;position:absolute}.handsontable.htDropdownMenu .ht_clone_top,.handsontable.htDropdownMenu .ht_clone_bottom,.handsontable.htDropdownMenu .ht_clone_inline_start,.handsontable.htDropdownMenu .ht_clone_top_inline_start_corner,.handsontable.htDropdownMenu .ht_clone_bottom_inline_start_corner,.handsontable.htContextMenu .ht_clone_top,.handsontable.htContextMenu .ht_clone_bottom,.handsontable.htContextMenu .ht_clone_inline_start,.handsontable.htContextMenu .ht_clone_top_inline_start_corner,.handsontable.htContextMenu .ht_clone_bottom_inline_start_corner,.handsontable.htFiltersConditionsMenu .ht_clone_top,.handsontable.htFiltersConditionsMenu .ht_clone_bottom,.handsontable.htFiltersConditionsMenu .ht_clone_inline_start,.handsontable.htFiltersConditionsMenu .ht_clone_top_inline_start_corner,.handsontable.htFiltersConditionsMenu .ht_clone_bottom_inline_start_corner{display:none}.handsontable.htDropdownMenu table.htCore,.handsontable.htContextMenu table.htCore,.handsontable.htFiltersConditionsMenu table.htCore{overflow:hidden}.handsontable.htDropdownMenu .htCustomMenuRenderer .table.htCore,.handsontable.htContextMenu .htCustomMenuRenderer .table.htCore,.handsontable.htFiltersConditionsMenu .htCustomMenuRenderer .table.htCore{box-shadow:none}.handsontable.htDropdownMenu.handsontable:focus,.handsontable.htContextMenu.handsontable:focus,.handsontable.htFiltersConditionsMenu.handsontable:focus{outline:none}.handsontable.htDropdownMenu .wtBorder,.handsontable.htContextMenu .wtBorder,.handsontable.htFiltersConditionsMenu .wtBorder{visibility:hidden}.handsontable.htDropdownMenu tbody tr:first-of-type td:first-child,.handsontable.htDropdownMenu tbody tr:first-of-type th:first-child,.handsontable.htContextMenu tbody tr:first-of-type td:first-child,.handsontable.htContextMenu tbody tr:first-of-type th:first-child,.handsontable.htFiltersConditionsMenu tbody tr:first-of-type td:first-child,.handsontable.htFiltersConditionsMenu tbody tr:first-of-type th:first-child{height:calc(var(--ht-cell-vertical-padding)*2 + var(--ht-line-height) + 1px)}.handsontable.htDropdownMenu table tbody tr td,.handsontable.htContextMenu table tbody tr td,.handsontable.htFiltersConditionsMenu table tbody tr td{padding:var(--ht-menu-item-vertical-padding,4px)var(--ht-menu-item-horizontal-padding,8px);white-space:nowrap;text-overflow:ellipsis;background:var(--ht-background-color,#fff);cursor:pointer;transition:var(--ht-table-transition)background ease-in-out;border-width:0;position:relative;overflow:hidden}.handsontable.htDropdownMenu table tbody tr td:first-child,.handsontable.htContextMenu table tbody tr td:first-child,.handsontable.htFiltersConditionsMenu table tbody tr td:first-child{border-top-width:0;border-inline-end-width:0;border-bottom-width:0;border-inline-start-width:0}.handsontable.htDropdownMenu table tbody tr td.htDimmed,.handsontable.htContextMenu table tbody tr td.htDimmed,.handsontable.htFiltersConditionsMenu table tbody tr td.htDimmed{font-style:normal;color:inherit!important;background-color:inherit!important}.handsontable.htDropdownMenu table tbody tr td:not(.handsontable.htDropdownMenu table tbody tr td.htCustomMenuRenderer,.handsontable.htDropdownMenu table tbody tr td.htDisabled,.handsontable.htContextMenu table tbody tr td.htCustomMenuRenderer,.handsontable.htContextMenu table tbody tr td.htDisabled,.handsontable.htFiltersConditionsMenu table tbody tr td.htCustomMenuRenderer,.handsontable.htFiltersConditionsMenu table tbody tr td.htDisabled):hover,.handsontable.htContextMenu table tbody tr td:not(.handsontable.htDropdownMenu table tbody tr td.htCustomMenuRenderer,.handsontable.htDropdownMenu table tbody tr td.htDisabled,.handsontable.htContextMenu table tbody tr td.htCustomMenuRenderer,.handsontable.htContextMenu table tbody tr td.htDisabled,.handsontable.htFiltersConditionsMenu table tbody tr td.htCustomMenuRenderer,.handsontable.htFiltersConditionsMenu table tbody tr td.htDisabled):hover,.handsontable.htFiltersConditionsMenu table tbody tr td:not(.handsontable.htDropdownMenu table tbody tr td.htCustomMenuRenderer,.handsontable.htDropdownMenu table tbody tr td.htDisabled,.handsontable.htContextMenu table tbody tr td.htCustomMenuRenderer,.handsontable.htContextMenu table tbody tr td.htDisabled,.handsontable.htFiltersConditionsMenu table tbody tr td.htCustomMenuRenderer,.handsontable.htFiltersConditionsMenu table tbody tr td.htDisabled):hover{cursor:pointer;background:color-mix(in srgb,var(--ht-menu-item-hover-color)var(--ht-menu-item-hover-color-opacity,100%),transparent)!important}.handsontable.htDropdownMenu table tbody tr td:not(.handsontable.htDropdownMenu table tbody tr td.htCustomMenuRenderer,.handsontable.htDropdownMenu table tbody tr td.htDisabled,.handsontable.htContextMenu table tbody tr td.htCustomMenuRenderer,.handsontable.htContextMenu table tbody tr td.htDisabled,.handsontable.htFiltersConditionsMenu table tbody tr td.htCustomMenuRenderer,.handsontable.htFiltersConditionsMenu table tbody tr td.htDisabled).current:not([aria-expanded=true]),.handsontable.htContextMenu table tbody tr td:not(.handsontable.htDropdownMenu table tbody tr td.htCustomMenuRenderer,.handsontable.htDropdownMenu table tbody tr td.htDisabled,.handsontable.htContextMenu table tbody tr td.htCustomMenuRenderer,.handsontable.htContextMenu table tbody tr td.htDisabled,.handsontable.htFiltersConditionsMenu table tbody tr td.htCustomMenuRenderer,.handsontable.htFiltersConditionsMenu table tbody tr td.htDisabled).current:not([aria-expanded=true]),.handsontable.htFiltersConditionsMenu table tbody tr td:not(.handsontable.htDropdownMenu table tbody tr td.htCustomMenuRenderer,.handsontable.htDropdownMenu table tbody tr td.htDisabled,.handsontable.htContextMenu table tbody tr td.htCustomMenuRenderer,.handsontable.htContextMenu table tbody tr td.htDisabled,.handsontable.htFiltersConditionsMenu table tbody tr td.htCustomMenuRenderer,.handsontable.htFiltersConditionsMenu table tbody tr td.htDisabled).current:not([aria-expanded=true]){box-shadow:inset 0 0 0 1px var(--ht-accent-color)}.handsontable.htDropdownMenu table tbody tr td.htSubmenu .htItemWrapper,.handsontable.htContextMenu table tbody tr td.htSubmenu .htItemWrapper,.handsontable.htFiltersConditionsMenu table tbody tr td.htSubmenu .htItemWrapper{margin-inline-end:calc(2*var(--ht-gap-size,4px) + var(--ht-icon-size))}.handsontable.htDropdownMenu table tbody tr td.htSubmenu .htItemWrapper:after,.handsontable.htContextMenu table tbody tr td.htSubmenu .htItemWrapper:after,.handsontable.htFiltersConditionsMenu table tbody tr td.htSubmenu .htItemWrapper:after{content:"";top:50%;right:calc(var(--ht-menu-item-horizontal-padding) + var(--ht-gap-size)*2);display:block;position:absolute;transform:translateY(-50%)}.handsontable.htDropdownMenu table tbody tr td.htSeparator,.handsontable.htContextMenu table tbody tr td.htSeparator,.handsontable.htFiltersConditionsMenu table tbody tr td.htSeparator{border-top:1px solid var(--ht-border-color);cursor:default;height:0;padding:0}.handsontable.htDropdownMenu table tbody tr td.htDisabled,.handsontable.htContextMenu table tbody tr td.htDisabled,.handsontable.htFiltersConditionsMenu table tbody tr td.htDisabled{color:var(--ht-disabled-color);cursor:default}.handsontable.htDropdownMenu table tbody tr td.htDisabled:hover,.handsontable.htContextMenu table tbody tr td.htDisabled:hover,.handsontable.htFiltersConditionsMenu table tbody tr td.htDisabled:hover{background:var(--ht-background-color);color:var(--ht-disabled-color)}.handsontable.htDropdownMenu table tbody tr td.htHidden,.handsontable.htContextMenu table tbody tr td.htHidden,.handsontable.htFiltersConditionsMenu table tbody tr td.htHidden{display:none}:is(.handsontable.htDropdownMenu table tbody tr td:has(.htItemWrapper .selected),.handsontable.htContextMenu table tbody tr td:has(.htItemWrapper .selected),.handsontable.htFiltersConditionsMenu table tbody tr td:has(.htItemWrapper .selected)){background-color:color-mix(in srgb,var(--ht-menu-item-active-color)var(--ht-menu-item-active-color-opacity,100%),transparent)}.handsontable.htDropdownMenu table tbody tr td .htItemWrapper,.handsontable.htContextMenu table tbody tr td .htItemWrapper,.handsontable.htFiltersConditionsMenu table tbody tr td .htItemWrapper{margin-inline:calc(2*var(--ht-gap-size,4px))}.handsontable.htDropdownMenu table tbody tr td .htItemWrapper:before,.handsontable.htContextMenu table tbody tr td .htItemWrapper:before,.handsontable.htFiltersConditionsMenu table tbody tr td .htItemWrapper:before{vertical-align:text-bottom;margin-right:12px}.handsontable.htDropdownMenu table tbody tr td .htItemWrapper span.selected,.handsontable.htContextMenu table tbody tr td .htItemWrapper span.selected,.handsontable.htFiltersConditionsMenu table tbody tr td .htItemWrapper span.selected{font-size:0;inset:0}.handsontable.htDropdownMenu table tbody tr td .htItemWrapper span.selected:after,.handsontable.htContextMenu table tbody tr td .htItemWrapper span.selected:after,.handsontable.htFiltersConditionsMenu table tbody tr td .htItemWrapper span.selected:after{content:"";top:50%;right:calc(var(--ht-menu-item-horizontal-padding) + var(--ht-gap-size)*2);color:var(--ht-accent-color);display:block;position:absolute;transform:translateY(-50%)}.handsontable.htDropdownMenu table tbody tr td div span.selected,.handsontable.htContextMenu table tbody tr td div span.selected,.handsontable.htFiltersConditionsMenu table tbody tr td div span.selected{position:absolute;inset-inline-end:0}.handsontable.htDropdownMenu table tbody tr td .htUIButton,.handsontable.htContextMenu table tbody tr td .htUIButton,.handsontable.htFiltersConditionsMenu table tbody tr td .htUIButton{width:calc(50% - var(--ht-gap-size))}.handsontable.htDropdownMenu table tbody tr td .htUIButton input,.handsontable.htContextMenu table tbody tr td .htUIButton input,.handsontable.htFiltersConditionsMenu table tbody tr td .htUIButton input{width:100%}.handsontable .htUIClearAll a,.handsontable .htUISelectAll a{padding:var(--ht-gap-size);text-decoration:none;display:inline-block}.handsontable .htUIMultipleSelect .ht_master .wtHolder{background:0 0;box-shadow:none!important;border-radius:0!important;overflow-y:scroll!important}.handsontable .htUIMultipleSelect .ht_master .wtHolder .htCore{box-shadow:none}[dir=rtl].handsontable.htDropdownMenu table tbody tr td.htSubmenu .htItemWrapper:after,[dir=rtl].handsontable.htContextMenu table tbody tr td.htSubmenu .htItemWrapper:after,[dir=rtl].handsontable.htFiltersConditionsMenu table tbody tr td.htSubmenu .htItemWrapper:after{left:calc(4*var(--ht-gap-size));right:auto;transform:translateY(-50%)rotate(180deg)}[dir=rtl].handsontable.htDropdownMenu table tbody tr td .htItemWrapper span.selected:after,[dir=rtl].handsontable.htContextMenu table tbody tr td .htItemWrapper span.selected:after,[dir=rtl].handsontable.htFiltersConditionsMenu table tbody tr td .htItemWrapper span.selected:after{left:calc(4*var(--ht-gap-size));right:auto}.handsontable.htFiltersConditionsMenu:not(.htGhostTable){z-index:1070}.handsontable .ht_master table td.htCustomMenuRenderer{cursor:auto}.handsontable .ht_master table td.htCustomMenuRenderer.htFiltersMenuActionBar{padding-top:calc(var(--ht-menu-item-vertical-padding,4px)*2)}.handsontable .htFiltersMenuLabel{font-size:var(--ht-font-size-small);line-height:var(--ht-line-height-small);font-weight:var(--ht-font-weight);margin-bottom:calc(var(--ht-gap-size,2px)*2)}.handsontable .htFiltersMenuLabel:empty{display:none}.handsontable .htFiltersMenuCondition{padding-top:calc(var(--ht-gap-size,2px)*3)!important;padding-bottom:0!important}.handsontable .htFiltersMenuCondition .border{border-bottom:1px solid var(--ht-border-color)!important}.handsontable .htFiltersMenuCondition .htUIInput{margin-top:calc(var(--ht-gap-size,2px)*2)}.handsontable .htFiltersMenuValue{padding-top:calc(var(--ht-gap-size,2px)*3)!important;border-bottom:1px solid var(--ht-border-color)!important;padding-bottom:0!important}.handsontable .htFiltersMenuOperators{padding-top:calc(var(--ht-gap-size,2px)*2)!important;padding-bottom:0!important}.handsontable .htUISelectionControls{margin:0 calc(var(--ht-gap-size,2px)*-1);padding-top:calc(var(--ht-gap-size,2px)*2)!important;padding-bottom:var(--ht-gap-size,2px)!important}.handsontable .htUIMultipleSelectHot{--ht-cell-horizontal-padding:calc(var(--ht-menu-item-horizontal-padding,2px) + var(--ht-gap-size,2px)*2);--ht-cell-vertical-padding:4px;width:calc(100% + var(--ht-menu-item-horizontal-padding,2px)*2 + var(--ht-gap-size,2px)*4);margin:0 calc((var(--ht-menu-item-horizontal-padding,2px) + var(--ht-gap-size,2px)*2)*-1);overflow:initial!important}.handsontable .htUIMultipleSelectHot:before{content:"";background-color:var(--ht-border-color);width:100%;height:1px;display:block;position:absolute;top:-1px;left:0}.handsontable .htUIMultipleSelectHot .wtHolder{box-sizing:border-box;padding:0;overflow-x:hidden}.handsontable .htUIMultipleSelectHot .wtHolder .wtSpreader{padding:calc(var(--ht-gap-size)*2)0}.handsontable .htUIMultipleSelectHot .wtHolder td{padding:var(--ht-cell-vertical-padding)var(--ht-cell-horizontal-padding);height:auto!important}.handsontable .htUIClearAll,.handsontable .htUISelectAll{margin-right:var(--ht-gap-size,4px);margin-bottom:var(--ht-gap-size,4px);display:inline-block}.handsontable .htUIClearAll a,.handsontable .htUISelectAll a{font-size:var(--ht-font-size);line-height:var(--ht-line-height);color:var(--ht-link-color);border-radius:var(--ht-button-border-radius)}.handsontable .htUIClearAll a:hover,.handsontable .htUISelectAll a:hover{color:var(--ht-link-hover-color)}.handsontable .htUIClearAll a:focus,.handsontable .htUISelectAll a:focus{outline:1px solid var(--ht-link-hover-color)}.handsontable .htUIMultipleSelect .ht_master .wtHolder{overflow:auto}.handsontable .htUIMultipleSelect .ht_master .wtHolder .wtHider,.handsontable .htUIMultipleSelect .ht_master .wtHolder .htCore,.handsontable .htUIMultipleSelect .ht_master .wtHolder tr,.handsontable .htUIMultipleSelect .ht_master .wtHolder td{background:0 0}.handsontable .htUIInput.htUIButton{cursor:pointer;display:inline-block}.handsontable .htUIInput.htUIButtonOK{margin-inline-start:0;margin-inline-end:calc(2*var(--ht-gap-size,2px))}.handsontable td a.ht-hyperlink{color:var(--ht-link-color);text-decoration:underline}.handsontable td a.ht-hyperlink:hover{color:var(--ht-link-hover-color)}.handsontable .htCommentCell{position:relative}.handsontable .htCommentCell:after{content:"";top:0;border-inline-start:var(--ht-comments-indicator-size,4px)solid #0000;border-inline-end:none;border-top:var(--ht-comments-indicator-size,4px)solid var(--ht-comments-indicator-color,#1a42e8);display:block;position:absolute;inset-inline-start:unset;inset-inline-end:0}.htCommentsContainer .htComments{z-index:1059;display:none;position:absolute}.htCommentsContainer .htCommentTextArea{font-family:var(--ht-font-family),-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;box-shadow:var(--ht-menu-shadow-x,0)var(--ht-menu-shadow-y,0)var(--ht-menu-shadow-blur,8px)color-mix(in srgb,var(--ht-menu-shadow-color,#000)var(--ht-menu-shadow-opacity,100%),transparent);width:240px;height:88px;font-size:var(--ht-font-size);line-height:var(--ht-line-height);font-weight:var(--ht-font-weight);padding:var(--ht-comments-textarea-vertical-padding)var(--ht-comments-textarea-horizontal-padding);border:var(--ht-comments-textarea-border-width,1px)solid var(--ht-comments-textarea-border-color,transparent);border-inline-start:var(--ht-comments-textarea-border-width,1px)solid var(--ht-comments-textarea-border-color,#1a42e8);color:var(--ht-comments-textarea-foreground-color);background-color:var(--ht-comments-textarea-background-color,#fff);box-sizing:border-box;-webkit-appearance:none;margin:0 -1px;outline:0!important}.htCommentsContainer .htCommentTextArea:focus{border:var(--ht-comments-textarea-focus-border-width,1px)solid var(--ht-comments-textarea-focus-border-color,#1a42e8);color:var(--ht-comments-textarea-focus-foreground-color);background-color:var(--ht-comments-textarea-focus-background-color,#fff)}.htBorders .wtBorder.ht-border-style-dashed-vertical{background-image:repeating-linear-gradient(to bottom,var(--ht-custom-border-color)0 5px,transparent 0 10px)}.htBorders .wtBorder.ht-border-style-dashed-horizontal{background-image:repeating-linear-gradient(to right,var(--ht-custom-border-color)0 5px,transparent 0 10px)}.htBorders .wtBorder.ht-border-style-dotted-horizontal{background-image:radial-gradient(circle,var(--ht-custom-border-color)calc(var(--ht-custom-border-size)/2),transparent 0);background-size:calc(var(--ht-custom-border-size)*2)var(--ht-custom-border-size);background-repeat:repeat-x}.htBorders .wtBorder.ht-border-style-dotted-vertical{background-image:radial-gradient(circle,var(--ht-custom-border-color)calc(var(--ht-custom-border-size)/2),transparent 0);background-size:var(--ht-custom-border-size)calc(var(--ht-custom-border-size)*2);background-repeat:repeat-y}.handsontable .colHeader.columnSorting.sortAction{box-sizing:border-box;min-width:min(var(--ht-icon-size,16px) + 8px,100%);flex-grow:0;max-width:100%;margin-inline:auto;position:static}.handsontable .colHeader.columnSorting.sortAction:before,.handsontable .colHeader.columnSorting.sortAction:after{margin-inline:var(--ht-sort-indicator-offset);margin-inline-end:var(--ht-sort-indicator-offset-end)}.handsontable .htLeft .colHeader.columnSorting.sortAction{margin-left:0;margin-right:auto}.handsontable .htRight .colHeader.columnSorting.sortAction{margin-left:auto;margin-right:0}.handsontable th .relative{--ht-sort-indicator-offset:var(--ht-cell-horizontal-padding);--ht-sort-indicator-offset-end:var(--ht-cell-horizontal-padding);--ht-sort-indicator-reserve:var(--ht-cell-horizontal-padding);--ht-sort-indicator-reserve-end:var(--ht-sort-indicator-reserve);--ht-header-button-slot:calc(var(--ht-icon-size,16px) + 2px)}.handsontable .relative.has-header-button{--ht-sort-indicator-offset-end:calc(var(--ht-cell-horizontal-padding) + var(--ht-icon-size,16px) + (var(--ht-icon-button-hit-area-size,24px) - var(--ht-icon-size,16px))*.5);--ht-sort-indicator-reserve-end:var(--ht-cell-horizontal-padding)}.handsontable .relative.has-sort-indicator.has-header-button{column-gap:calc(2px + var(--ht-header-button-slot))}.handsontable .relative.has-sort-indicator{--ht-sort-indicator-reserve:calc(var(--ht-cell-horizontal-padding) + var(--ht-icon-size,16px) + 2px);padding-inline-end:var(--ht-sort-indicator-reserve-end)}.handsontable .relative.htRight.has-sort-indicator,.handsontable .htRight .relative.has-sort-indicator{--ht-header-button-slot:0px;padding-inline-start:var(--ht-sort-indicator-reserve);padding-inline-end:var(--ht-cell-horizontal-padding)}.handsontable .columnSorting:not(.indicatorDisabled){position:relative}.handsontable .columnSorting:not(.indicatorDisabled).sortAction:hover{cursor:pointer;text-decoration:none}.handsontable .columnSorting:not(.indicatorDisabled).sortAction:before{content:"";width:var(--ht-icon-size,16px);text-align:right;display:block;position:absolute;top:50%;right:2px;transform:translateY(-50%)}.handsontable .htRight .columnSorting.sortAction:before{text-align:left;left:2px;right:auto}[dir=rtl] .handsontable .relative.htRight.has-sort-indicator,[dir=rtl] .handsontable .htRight .relative.has-sort-indicator{--ht-header-button-slot:calc(var(--ht-icon-size,16px) + 2px);padding-inline-start:var(--ht-cell-horizontal-padding);padding-inline-end:var(--ht-sort-indicator-reserve-end)}[dir=rtl] .handsontable .relative.htLeft.has-sort-indicator,[dir=rtl] .handsontable .htLeft .relative.has-sort-indicator{--ht-header-button-slot:0px;padding-inline-start:var(--ht-sort-indicator-reserve);padding-inline-end:var(--ht-cell-horizontal-padding)}[dir=rtl] .handsontable .columnSorting.sortAction:before{text-align:left;left:2px;right:auto}[dir=rtl] .handsontable .htLeft .columnSorting.sortAction:before{text-align:right;left:auto;right:2px}.htGhostTable .htCore .relative{--ht-sort-indicator-offset:0px;--ht-sort-indicator-offset-end:0px;--ht-header-button-slot:0px}.htGhostTable .htCore .relative.has-header-button{--ht-sort-indicator-reserve:var(--ht-cell-horizontal-padding);--ht-sort-indicator-reserve-end:var(--ht-cell-horizontal-padding)}.htGhostTable .htCore span.colHeader.columnSorting:not(.indicatorDisabled):before{content:"*";padding-inline-end:calc(var(--ht-icon-size,16px) + 2px);display:inline-block;position:relative}.handsontable .colHeader.columnSorting:after{content:"";text-align:right;width:8px;margin-top:4px;font-size:8px;display:block;position:absolute;top:50%;right:0;transform:translateY(-50%)}.handsontable .colHeader.columnSorting[class^=sort-]:after,.handsontable .colHeader.columnSorting[class*=\\ sort-]:after{content:"+"}.handsontable .colHeader.columnSorting.sort-1:after{content:"1"}.handsontable .colHeader.columnSorting.sort-2:after{content:"2"}.handsontable .colHeader.columnSorting.sort-3:after{content:"3"}.handsontable .colHeader.columnSorting.sort-4:after{content:"4"}.handsontable .colHeader.columnSorting.sort-5:after{content:"5"}.handsontable .colHeader.columnSorting.sort-6:after{content:"6"}.handsontable .colHeader.columnSorting.sort-7:after{content:"7"}.handsontable .htRight .colHeader.columnSorting:after,[dir=rtl] .handsontable .colHeader.columnSorting:after{text-align:left;left:0;right:auto}[dir=rtl] .handsontable .htLeft .colHeader.columnSorting:after{text-align:right;left:auto;right:0}.htGhostTable th div:has(.changeType) span.colHeader.columnSorting:not(.indicatorDisabled){padding-inline-end:var(--ht-gap-size)}.handsontable .htRowHeaders .ht_master.innerBorderInlineStart~.ht_clone_top_inline_start_corner :where(table.htCore>thead>tr)>th:nth-child(2),.handsontable .htRowHeaders .ht_master.innerBorderInlineStart~.ht_clone_inline_start :where(table.htCore>tbody>tr)>td:first-of-type{border-left:0}.handsontable .ht_clone_top_inline_start_corner th.ht__active_highlight{box-shadow:none}.handsontable .manualColumnResizer{cursor:col-resize;opacity:0;z-index:210;background:0 0;width:10px;margin:0;position:absolute;top:0}.handsontable .manualColumnResizer:before,.handsontable .manualColumnResizer:after{content:"";background:var(--ht-resize-indicator-color);border-radius:2px;width:2px;height:calc(100% - 12px);max-height:16px;margin-top:.5px;display:block;position:absolute;top:50%;left:1px;transform:translateY(-50%)}.handsontable .manualColumnResizer:after{left:auto;right:0}.handsontable .manualColumnResizer:hover,.handsontable .manualColumnResizer.active{opacity:1}.handsontable .manualColumnResizerGuide{inset-inline-end:unset;width:0;border-inline-end:1px solid var(--ht-accent-color);border-inline-start:none;margin-inline-start:5px;margin-inline-end:unset;display:none;position:absolute;top:0}.handsontable .manualColumnResizerGuide.active{z-index:209;display:block}.handsontable .manualRowResizer{z-index:210;cursor:row-resize;opacity:0;background:0 0;height:10px;margin:0;position:absolute;left:0}.handsontable .manualRowResizer:before,.handsontable .manualRowResizer:after{content:"";background:var(--ht-resize-indicator-color);border-radius:2px;width:calc(100% - 12px);max-width:16px;height:2px;display:block;position:absolute;top:1px;left:50%;transform:translate(-50%)}.handsontable .manualRowResizer:after{top:auto;bottom:0}.handsontable .manualRowResizer:hover,.handsontable .manualRowResizer.active{opacity:1}.handsontable .manualRowResizerGuide{border-bottom:1px solid var(--ht-accent-color);border-top:none;height:0;margin-top:5px;display:none;position:absolute;bottom:0;left:0}.handsontable .manualRowResizerGuide.active{z-index:209;display:block}.handsontable tbody td[rowspan][class*=area][class*=highlight]:not([class*=fullySelectedMergedCell]):before{opacity:0}.handsontable tbody td[rowspan][class*=area][class*=highlight][class*=fullySelectedMergedCell-multiple]:before,.handsontable tbody td[rowspan][class*=area][class*=highlight][class*=fullySelectedMergedCell-0]:before{opacity:.14}.handsontable tbody td[rowspan][class*=area][class*=highlight][class*=fullySelectedMergedCell-1]:before{opacity:.21}.handsontable tbody td[rowspan][class*=area][class*=highlight][class*=fullySelectedMergedCell-2]:before{opacity:.28}.handsontable tbody td[rowspan][class*=area][class*=highlight][class*=fullySelectedMergedCell-3]:before{opacity:.35}.handsontable tbody td[rowspan][class*=area][class*=highlight][class*=fullySelectedMergedCell-4]:before{opacity:.42}.handsontable tbody td[rowspan][class*=area][class*=highlight][class*=fullySelectedMergedCell-5]:before{opacity:.49}.handsontable tbody td[rowspan][class*=area][class*=highlight][class*=fullySelectedMergedCell-6]:before{opacity:.56}.handsontable tbody td[rowspan][class*=area][class*=highlight][class*=fullySelectedMergedCell-7]:before{opacity:.63}.handsontable .ht__manualColumnMove.after-selection--columns thead th.ht__highlight,.handsontable .ht__manualColumnMove.after-selection--columns thead th.ht__active_highlight,.handsontable.ht__manualColumnMove.after-selection--columns thead th.ht__highlight,.handsontable.ht__manualColumnMove.after-selection--columns thead th.ht__active_highlight{cursor:move;cursor:-moz-grab;cursor:-webkit-grab;cursor:grab}.handsontable .ht__manualColumnMove.on-moving--columns *,.handsontable .ht__manualColumnMove.on-moving--columns thead th.ht__highlight,.handsontable.ht__manualColumnMove.on-moving--columns *,.handsontable.ht__manualColumnMove.on-moving--columns thead th.ht__highlight{cursor:move;cursor:-moz-grabbing;cursor:-webkit-grabbing;cursor:grabbing}.handsontable .ht__manualColumnMove.on-moving--columns .manualColumnResizer,.handsontable.ht__manualColumnMove.on-moving--columns .manualColumnResizer{display:none}.handsontable .ht__manualColumnMove--guideline,.handsontable .ht__manualColumnMove--backlight,.handsontable.ht__manualColumnMove--guideline,.handsontable.ht__manualColumnMove--backlight{height:100%;display:none;position:absolute}.handsontable .ht__manualColumnMove--guideline,.handsontable.ht__manualColumnMove--guideline{z-index:205;background:var(--ht-move-indicator-color,#1a42e8);width:1px;margin-inline:-.5px 0;top:0}.handsontable .ht__manualColumnMove--backlight,.handsontable.ht__manualColumnMove--backlight{z-index:205;pointer-events:none;background:color-mix(in srgb,var(--ht-move-backlight-color)var(--ht-move-backlight-opacity,100%),transparent);display:none}.handsontable .on-moving--columns.show-ui .ht__manualColumnMove--guideline,.handsontable .on-moving--columns .ht__manualColumnMove--backlight,.handsontable.on-moving--columns.show-ui .ht__manualColumnMove--guideline,.handsontable.on-moving--columns .ht__manualColumnMove--backlight{display:block}.handsontable .wtHider{position:relative}.handsontable .ht__manualRowMove.after-selection--rows tbody th.ht__highlight,.handsontable.ht__manualRowMove.after-selection--rows tbody th.ht__highlight{cursor:move;cursor:-moz-grab;cursor:-webkit-grab;cursor:grab}.handsontable .ht__manualRowMove.on-moving--rows *,.handsontable .ht__manualRowMove.on-moving--rows tbody th.ht__highlight,.handsontable.ht__manualRowMove.on-moving--rows *,.handsontable.ht__manualRowMove.on-moving--rows tbody th.ht__highlight{cursor:move;cursor:-moz-grabbing;cursor:-webkit-grabbing;cursor:grabbing}.handsontable .ht__manualRowMove.on-moving--rows .manualRowResizer,.handsontable.ht__manualRowMove.on-moving--rows .manualRowResizer{display:none}.handsontable .ht__manualRowMove--guideline,.handsontable .ht__manualRowMove--backlight,.handsontable.ht__manualRowMove--guideline,.handsontable.ht__manualRowMove--backlight{width:100%;display:none;position:absolute}.handsontable .ht__manualRowMove--guideline,.handsontable.ht__manualRowMove--guideline{border-top:1px solid var(--ht-move-indicator-color);z-index:205;left:0}.handsontable .ht__manualRowMove--backlight,.handsontable.ht__manualRowMove--backlight{z-index:205;pointer-events:none;background:color-mix(in srgb,var(--ht-move-backlight-color)var(--ht-move-backlight-opacity,100%),transparent);display:none}.handsontable .on-moving--rows.show-ui .ht__manualRowMove--guideline,.handsontable .on-moving--rows .ht__manualRowMove--backlight,.handsontable.on-moving--rows.show-ui .ht__manualRowMove--guideline,.handsontable.on-moving--rows .ht__manualRowMove--backlight{display:block}.ht-dialog{scrollbar-width:auto;scrollbar-color:var(--ht-scrollbar-thumb-color)var(--ht-scrollbar-track-color);font-size:var(--ht-font-size);line-height:var(--ht-line-height);letter-spacing:var(--ht-letter-spacing);z-index:1060;opacity:0;border-radius:var(--ht-border-radius);border:1px solid var(--ht-border-color);width:100%;height:100%;display:none;position:absolute;top:0;left:0;overflow-y:auto;box-sizing:border-box!important}.ht-dialog[dir=rtl]{left:auto;right:0}.ht-dialog:focus{border:1px solid var(--ht-accent-color);outline:none}.ht-dialog:has(.htFocusCatcher:focus){border:1px solid var(--ht-accent-color);outline:none}.ht-dialog *{box-sizing:border-box!important}.ht-dialog--background-solid{background-color:var(--ht-dialog-solid-background-color)}.ht-dialog--background-semi-transparent{background-color:color-mix(in srgb,var(--ht-dialog-semi-transparent-background-color)var(--ht-dialog-semi-transparent-background-opacity,100%),transparent)}.ht-dialog--animation{transition:opacity var(--ht-table-transition)ease-in-out}.ht-dialog--show{opacity:1}.ht-dialog__content-wrapper{width:100%;min-height:100%;padding:calc(var(--ht-gap-size)*4);border-radius:var(--ht-border-radius);justify-content:center;align-items:center;display:flex}.ht-dialog__content{padding:var(--ht-dialog-content-padding-horizontal)var(--ht-dialog-content-padding-vertical);max-width:480px;color:var(--ht-foreground-color);position:relative}.ht-dialog__content--background{box-shadow:var(--ht-shadow-x,0)var(--ht-shadow-y,0)var(--ht-shadow-blur,8px)color-mix(in srgb,var(--ht-shadow-color,#000)var(--ht-shadow-opacity,100%),transparent);border-radius:var(--ht-dialog-content-border-radius);background-color:var(--ht-dialog-content-background-color)}.ht-dialog--confirm .ht-dialog__content-wrapper{text-align:center;padding:calc(var(--ht-gap-size)*2)}.ht-dialog--confirm .ht-dialog__content-wrapper-inner{max-width:480px;padding:calc(var(--ht-gap-size)*2);border-radius:var(--ht-border-radius);flex-direction:column;justify-content:center;align-items:center;display:flex}.ht-dialog--confirm .ht-dialog__content-wrapper-inner--background{box-shadow:var(--ht-shadow-x,0)var(--ht-shadow-y,0)var(--ht-shadow-blur,8px)color-mix(in srgb,var(--ht-shadow-color,#000)var(--ht-shadow-opacity,100%),transparent);border-radius:var(--ht-dialog-content-border-radius);background-color:var(--ht-dialog-content-background-color)}.ht-dialog--confirm .ht-dialog__content-wrapper-inner:focus{box-shadow:0 0 0 1px var(--ht-accent-color);outline:none}.ht-dialog--confirm .ht-dialog__content{justify-content:center;align-items:center;gap:var(--ht-gap-size);flex-direction:column;display:flex}.ht-dialog--confirm .ht-dialog__content:has(.ht-dialog__buttons){gap:calc(var(--ht-gap-size)*2)}.ht-dialog--confirm .ht-dialog__title{font-size:var(--ht-font-size);font-weight:var(--ht-font-weight);line-height:var(--ht-line-height);margin:0}.ht-dialog--confirm .ht-dialog__description{color:var(--ht-foreground-secondary-color);font-size:var(--ht-font-size-small);line-height:var(--ht-line-height-small);font-weight:var(--ht-font-weight);margin:0}.ht-dialog--confirm .ht-dialog__buttons{justify-content:center;gap:calc(var(--ht-gap-size)*2);flex-flow:wrap;display:flex}.ht-notification{z-index:1070;pointer-events:none;position:absolute;inset:0;overflow:visible}.ht-notification__stack{overscroll-behavior:contain;pointer-events:auto;-webkit-overflow-scrolling:touch;scrollbar-width:auto;scrollbar-color:var(--ht-scrollbar-thumb-color)var(--ht-scrollbar-track-color);flex-direction:column;gap:10px;max-width:min(420px,100% - 40px);min-height:0;padding:10px;display:flex;position:absolute;overflow:hidden auto}.ht-notification__stack--top-start{top:10px;align-items:flex-start;max-height:calc(100% - 40px);inset-inline-start:10px}.ht-notification__stack--top-end{top:10px;align-items:flex-end;max-height:calc(100% - 40px);inset-inline-end:10px}.ht-notification__stack--bottom-start{bottom:10px;align-items:flex-start;max-height:calc(100% - 40px);inset-inline-start:10px}.ht-notification__stack--bottom-end{bottom:10px;align-items:flex-end;max-height:calc(100% - 40px);inset-inline-end:10px}.ht-notification__toast{box-shadow:var(--ht-shadow-x,0)var(--ht-shadow-y,0)var(--ht-shadow-blur,8px)color-mix(in srgb,var(--ht-shadow-color,#000)var(--ht-shadow-opacity,100%),transparent);pointer-events:auto;max-width:100%;color:var(--ht-notification-foreground-color,var(--ht-foreground-color));background-color:var(--ht-notification-background-color,var(--ht-background-color));border:1px solid var(--ht-notification-border-color,var(--ht-border-color));border-radius:var(--ht-border-radius,4px);font-size:var(--ht-font-size);line-height:var(--ht-line-height);letter-spacing:var(--ht-letter-spacing);outline:none;flex-shrink:0;display:flex;position:relative}.ht-notification__toast:focus-visible{box-shadow:0 0 0 1px var(--ht-accent-color)}.ht-notification__toast--animate{opacity:0;transition:opacity var(--ht-table-transition,.15s)ease-out,transform var(--ht-table-transition,.15s)ease-out}.ht-notification__toast--animate.ht-notification__toast--stack-top:not(.ht-notification__toast--visible){transform:translateY(-6px)}.ht-notification__toast--animate.ht-notification__toast--stack-bottom:not(.ht-notification__toast--visible){transform:translateY(6px)}.ht-notification__toast--visible{opacity:1;transform:translateY(0)}.ht-notification__toast--info .ht-notification__accent{display:none}.ht-notification__toast--success .ht-notification__accent{background-color:var(--ht-notification-success-accent,#37bc6c)}.ht-notification__toast--warning .ht-notification__accent{background-color:var(--ht-notification-warning-accent,#fbe952)}.ht-notification__toast--error .ht-notification__accent{background-color:var(--ht-notification-error-accent,#fa4d32)}.ht-notification__toast-inner{width:100%;min-width:0;direction:inherit;flex-direction:row;align-items:stretch;gap:0;padding:10px;display:flex}.ht-notification__accent{box-sizing:border-box;border-radius:4px;flex:0 0 4px;align-self:stretch;margin-inline-end:10px}.ht-notification__body{flex:auto;min-width:0}.ht-notification__title{margin:0 0 var(--ht-gap-size);font-size:var(--ht-font-size);font-weight:var(--ht-font-weight,600)}.ht-notification__message{font-size:var(--ht-font-size-small);word-break:break-word;margin:0}.ht-notification__actions{gap:var(--ht-gap-size);margin-top:var(--ht-gap-size);flex-wrap:wrap;display:flex}.ht-notification__close{box-sizing:border-box;width:var(--ht-icon-button-hit-area-size);height:var(--ht-icon-button-hit-area-size);color:var(--ht-icon-button-icon-color,inherit);cursor:pointer;border-radius:var(--ht-icon-button-border-radius,var(--ht-border-radius,4px));background:0 0;border:none;flex:none;align-self:flex-start;margin-inline-start:4px;padding:0;position:relative;overflow:visible}.ht-notification__close:before{content:"";top:50%;margin-top:calc(-.5*var(--ht-icon-size));margin-inline-start:calc(-.5*var(--ht-icon-size));display:block;position:absolute;inset-inline-start:50%}.ht-notification__close:hover{color:var(--ht-icon-button-hover-icon-color,inherit);background-color:var(--ht-icon-button-hover-background-color,color-mix(in srgb,var(--ht-foreground-color)8%,transparent))}.ht-notification__close:focus-visible{outline:2px solid var(--ht-accent-color);outline-offset:2px}.handsontable.ht-pagination{width:100%;color:var(--ht-pagination-bar-foreground-color);background:var(--ht-pagination-bar-background-color);font-size:var(--ht-font-size);line-height:var(--ht-line-height);box-sizing:border-box;overflow-x:auto}.handsontable.ht-pagination:not(.ht-slot-element){border:1px solid var(--ht-border-color);border-radius:var(--ht-border-radius)}.handsontable.ht-pagination .ht-pagination__inner{justify-content:space-between;align-items:center;gap:calc(var(--ht-gap-size)*4);padding-inline:var(--ht-pagination-bar-horizontal-padding);padding-block:var(--ht-pagination-bar-vertical-padding);flex-wrap:wrap;min-width:230px;display:flex}.handsontable.ht-pagination .ht-page-size-section{align-items:center;gap:calc(var(--ht-gap-size)*2);display:flex}.handsontable.ht-pagination .ht-page-size-section__label{white-space:nowrap}.handsontable.ht-pagination .ht-page-size-section__select-wrapper{border-radius:var(--ht-input-border-radius);position:relative}.handsontable.ht-pagination .ht-page-size-section__select-wrapper select{padding-inline-start:var(--ht-gap-size);padding-inline-end:calc(var(--ht-gap-size) + var(--ht-icon-size));padding-top:var(--ht-gap-size);padding-bottom:var(--ht-gap-size);border-radius:var(--ht-input-border-radius);color:var(--ht-input-foreground-color);background-color:var(--ht-input-background-color);border:1px solid var(--ht-input-border-color);line-height:calc(var(--ht-line-height) - 4px);-webkit-appearance:none;font-size:inherit;cursor:pointer}.handsontable.ht-pagination .ht-page-size-section__select-wrapper select:disabled{opacity:.4;cursor:default;color:var(--ht-input-disabled-foreground-color);background-color:var(--ht-input-disabled-background-color);border-color:var(--ht-input-disabled-border-color)}.handsontable.ht-pagination .ht-page-size-section__select-wrapper select:hover:not(:disabled){color:var(--ht-input-hover-foreground-color);background-color:var(--ht-input-hover-background-color);border-color:var(--ht-input-hover-border-color)}.handsontable.ht-pagination .ht-page-size-section__select-wrapper select:focus{color:var(--ht-input-focus-foreground-color);background-color:var(--ht-input-focus-background-color);border-color:var(--ht-input-focus-border-color);outline:none}.handsontable.ht-pagination .ht-page-size-section__select-wrapper:after{content:"";background-color:var(--ht-foreground-color);pointer-events:none;display:block;position:absolute;inset-block-end:50%;inset-inline-end:var(--ht-gap-size);transform:translateY(50%)}.handsontable.ht-pagination .ht-page-counter-section{margin-inline-end:auto}.handsontable.ht-pagination .ht-page-navigation-section{align-items:center;gap:1px;display:flex}.handsontable.ht-pagination .ht-page-navigation-section__button{font-size:inherit;border:1px solid var(--ht-pagination-button-border-color);color:var(--ht-pagination-button-foreground-color);background-color:var(--ht-pagination-button-background-color);border-radius:var(--ht-icon-button-large-border-radius);padding:var(--ht-icon-button-large-padding);cursor:pointer}.handsontable.ht-pagination .ht-page-navigation-section__button:before{content:"";display:block}.handsontable.ht-pagination .ht-page-navigation-section__button--disabled{cursor:default;pointer-events:none;color:var(--ht-pagination-button-disabled-foreground-color);background-color:var(--ht-pagination-button-disabled-background-color);border-color:var(--ht-pagination-button-disabled-border-color)}.handsontable.ht-pagination .ht-page-navigation-section__button:hover:not(:disabled){border-color:var(--ht-pagination-button-hover-border-color);color:var(--ht-pagination-button-hover-foreground-color);background-color:var(--ht-pagination-button-hover-background-color)}.handsontable.ht-pagination .ht-page-navigation-section__button:focus{border-color:var(--ht-pagination-button-focus-border-color);color:var(--ht-pagination-button-focus-foreground-color);background-color:var(--ht-pagination-button-focus-background-color);outline:none}.handsontable.ht-pagination .ht-page-navigation-section__label{white-space:nowrap;text-align:center;min-width:100px}.ht-loading__icon-svg{width:var(--ht-icon-size);height:var(--ht-icon-size);color:var(--ht-accent-color);transform-origin:50%;animation:1s linear infinite ht-loading-spin;display:block}.ht-loading__content{align-items:center;gap:calc(var(--ht-gap-size)*2);display:flex}.ht-loading__title{font-size:var(--ht-font-size);font-weight:var(--ht-font-weight);line-height:var(--ht-line-height);margin:0}.ht-loading__description{color:var(--ht-foreground-secondary-color);font-size:var(--ht-font-size-small);line-height:var(--ht-line-height-small);font-weight:var(--ht-font-weight);margin:0}@keyframes ht-loading-spin{to{transform:rotate(360deg)}}.ht-empty-data-state{scrollbar-width:auto;scrollbar-color:var(--ht-scrollbar-thumb-color)var(--ht-scrollbar-track-color);z-index:999;border:1px solid var(--ht-border-color);border-radius:var(--ht-border-radius);box-sizing:border-box;background-color:var(--ht-background-color);width:100%;display:none;position:absolute;left:0;overflow-y:auto}.ht-empty-data-state *{box-sizing:border-box!important}.ht-empty-data-state__content-wrapper{text-align:center;width:100%;min-height:100%;padding:calc(var(--ht-gap-size)*2);border-radius:var(--ht-border-radius);justify-content:center;align-items:center;display:flex}.ht-empty-data-state__content-wrapper-inner{max-width:480px;padding:calc(var(--ht-gap-size)*2);border-radius:var(--ht-border-radius);flex-direction:column;justify-content:center;align-items:center;display:flex}.ht-empty-data-state__content-wrapper-inner:focus{box-shadow:0 0 0 1px var(--ht-accent-color);outline:none}.ht-empty-data-state__content{justify-content:center;align-items:center;gap:var(--ht-gap-size);flex-direction:column;display:flex}.ht-empty-data-state__title{font-size:var(--ht-font-size);font-weight:var(--ht-font-weight);line-height:var(--ht-line-height);margin:0}.ht-empty-data-state__description{color:var(--ht-foreground-secondary-color);font-size:var(--ht-font-size-small);line-height:var(--ht-line-height-small);font-weight:var(--ht-font-weight);margin:0}.ht-empty-data-state__buttons{justify-content:center;gap:calc(var(--ht-gap-size)*2);flex-flow:wrap;display:flex}.ht-empty-data-state__buttons--has-buttons{margin-top:calc(var(--ht-gap-size)*2)}.ht-empty-data-state__spinner{width:28px;height:28px;margin-bottom:calc(var(--ht-gap-size)*2);border:2px solid var(--ht-border-color);border-top-color:var(--ht-accent-color);border-radius:50%;flex-shrink:0;animation:.75s linear infinite ht-empty-data-state-spin}@media (prefers-reduced-motion:reduce){.ht-empty-data-state__spinner{border-top-color:var(--ht-border-color);animation:none}}.ht-empty-data-state--loading .ht-empty-data-state__content{gap:calc(var(--ht-gap-size)*.5)}.ht-empty-data-state--disable-top-border{border-top-width:0}.ht-empty-data-state--disable-top-border:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),.ht-empty-data-state--disable-top-border:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:0;border-top-right-radius:0}.ht-empty-data-state--disable-inline-border{border-inline-start-width:0}.ht-empty-data-state--disable-inline-border:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:0;border-bottom-left-radius:0}.ht-empty-data-state--disable-inline-border:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:0;border-bottom-right-radius:0}.ht-empty-data-state--disable-bottom-border{border-bottom-width:0}.ht-empty-data-state--disable-bottom-border:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),.ht-empty-data-state--disable-bottom-border:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-right-radius:0;border-bottom-left-radius:0}.ht-root-wrapper.ht-slot-bottom-filled .ht-empty-data-state:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),.ht-root-wrapper.ht-slot-bottom-filled .ht-empty-data-state:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-bottom-right-radius:0;border-bottom-left-radius:0}@keyframes ht-empty-data-state-spin{to{transform:rotate(360deg)}}',this.#ni.head.appendChild(t)}#nc(){let e=this.getCSSVariableValue("line-height"),t=this.getCSSVariableValue("cell-vertical-padding"),r=Math.round(Number.parseFloat(this.getStyleForTD("border-bottom-width")??""));return null===e||null===t||isNaN(r)?null:e+2*t+r}#np(){this.#no=!this.#nm(),this.#nn=getComputedStyle(this.#nr);let e=this.#nf(["box-sizing","border-bottom-width"]);this.#na.td={...this.#na.td,...{"box-sizing":e["box-sizing"],"border-bottom-width":e["border-bottom-width"]}}}#nf(e){let t=this.#ni,r=this.#nr,n=t.createElement("table"),o=t.createElement("tbody"),i=t.createElement("tr"),s=t.createElement("tr"),a=t.createElement("td");n.className="htCore",s.appendChild(a),o.appendChild(i),o.appendChild(s),n.appendChild(o),r.appendChild(n);let l=getComputedStyle(a),h={};return e.forEach(e=>{h[e]=l.getPropertyValue(e)}),r.removeChild(n),h}#nd(e){let t=Math.ceil(Number.parseFloat(this.#nu(e)??""));return Number.isNaN(t)?null:t}#nu(e){let t=this.#nn?.getPropertyValue(e)??null;return""===t?null:t}#ng(){this.#na={},this.#ns={}}#nm(){if(!this.#nr.isConnected)return!1;let e=this.#nr.ownerDocument.defaultView;return null!==e&&""!==e.getComputedStyle(this.#nr).display}recacheValuesMeasuredWithoutStyles(){return!!this.#no&&!!this.#nm()&&(this.clearCache(),!0)}clearCache(){this.#ng(),this.#np()}}let uo=null,ui=0,us={TOP:"top",BOTTOM:"bottom"},ua="ht-slot-element";class ul{#f;#nb=new Map;#nC=0;#ny=[];#nw;#nS;constructor(e,{itemClass:t="",onContentChange:r=()=>{}}={}){this.#f=e,this.#nw=t,this.#nS=r}getElement(){return this.#f}has(e){return this.#nb.has(e)}add(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=this.#nb.get(e),o=n?n.seq:this.#nC;n&&n.element.remove(),this.#nw&&t.classList.add(this.#nw),this.#nb.set(e,{element:t,weight:r,seq:o}),n||(this.#nC+=1),this.#nv(),this.#nS()}remove(e){let t=this.#nb.get(e);t&&(this.#nw&&t.element.classList.remove(this.#nw),t.element.remove(),this.#nb.delete(e),this.#nS())}setOrder(e){this.#ny=Array.isArray(e)?e.slice():[],this.#nv()}getOrder(){return this.#nR()}clear(){this.#nb.forEach(e=>e.element.remove()),this.#nb.clear(),this.#nS()}#nR(){let e=this.#ny;return Array.from(this.#nb.keys()).sort((t,r)=>{let n=e.indexOf(t),o=e.indexOf(r);if(-1!==n||-1!==o)return(-1===n?1/0:n)-(-1===o?1/0:o);let i=this.#nb.get(t),s=this.#nb.get(r);return i.weight!==s.weight?i.weight-s.weight:i.seq-s.seq})}#nv(){let e=this.#f.firstChild;this.#nR().forEach(t=>{let r=this.#nb.get(t).element;r===e?e=e.nextSibling:this.#f.insertBefore(r,e)})}}function uh(e,t){let r=t.parentElement;if(!r)return;let n=null!==t.querySelector(`:scope > .${ua}`);r.classList.toggle(`ht-slot-${e}-filled`,n)}class ud{#nE;constructor(e){this.#nE=new Map(Object.keys(e).map(t=>[t,new ul(e[t],{itemClass:ua,onContentChange:()=>uh(t,e[t])})]))}getSlot(e){let t=this.#nE.get(e);return t||tr(`Unknown layout slot "${e}".`),t}register(e,t,r){let{side:n,weight:o=0}=r;this.getSlot(n).add(e,t,o)}unregister(e,t){this.getSlot(t).remove(e)}applyConfig(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Object.values(us).forEach(t=>this.getSlot(t).setOrder(e?.[t]??[]))}destroy(){this.#nE.forEach(e=>e.clear())}}let uu="licenseNotification",uc=`plugin:${uu}`,ug="hot-display-license-info";function up(e){return e.rootSlotBottomElement?.querySelector(`.${ug}`)??null}let um="mailto:sales@handsontable.com",uf="mailto:support@handsontable.com",ub="https://handsontable.com/docs/tutorial-license-key.html",uC={trial_valid:{title:"Handsontable Trial",body:e=>{let{daysRemaining:t}=e;return`Your Handsontable license key ${eX(t)}. ${eJ}`},linkText:"Contact Sales",linkHref:um,dismissible:!1},trial_notice:{title:"Handsontable Trial",body:e=>{let{daysRemaining:t}=e;return`Your Handsontable license key ${eX(t)}. ${eJ}`},linkText:"Contact Sales",linkHref:um,dismissible:!1},trial_soft_stop:{title:"Handsontable Trial Expired",body:()=>`${eZ} ${eJ}`,linkText:"Contact Sales",linkHref:um,dismissible:!0}},uy={trial_hard_stop:e=>{let{licensedUntil:t}=e;return{title:`Your Handsontable trial license key expired on ${t}.`,description:"You may no longer use Handsontable under the trial license. To continue using the software, contact sales@handsontable.com to purchase a valid license.",action:{text:"Contact Sales",href:um}}},invalid:()=>({title:"The license key for Handsontable is invalid.",description:"",action:{text:"Contact Support",href:uf},docsLink:{text:"Read more",href:ub,trailingText:" on how to install it properly, or contact us at support@handsontable.com."}}),missing:()=>({title:"The license key for Handsontable is missing.",description:"Use your purchased key to activate the product. Alternatively, you can activate Handsontable to use for non-commercial purposes by passing the key: 'non-commercial-and-evaluation'. ",action:{text:"Contact Support",href:uf},docsLink:{text:"Read more",href:ub,trailingText:" about it in the documentation, or contact us at support@handsontable.com."}})},uw="ht-license-popover",uS="is-open",uv="is-dismissed",uR="is-corner-hover",uE="is-cornerless";function uT(e){let t=e.view?.getOverlayByName(il),r=t?.clone?.wtTable;return r?.TABLE?{table:r.TABLE,thead:r.THEAD??null}:null}let uA="ht-dialog",uM="licenseLock",uI=`plugin:${uM}`,ux=(e,t)=>`width: var(--ht-icon-size);
  height: var(--ht-icon-size);
  -webkit-mask-size: contain;
  -webkit-mask-image: url("${e[t]}");
  background-color: currentColor;`,uN="--ht-",uO=["font-family"],uk=["tokens.","colors.","sizing.","density."];function uH(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o="";return Object.entries(e).forEach(e=>{let[i,s]=e,a=of(i),l=r?`${r}-${a}`:a;if(tc(s))o+=uH(s,t,l,n);else(!n.lightDarkOnly||Array.isArray(s)&&s.length>=2&&"string"==typeof s[0]&&"string"==typeof s[1])&&(o+=`${function(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return`${uN}${e?`${e}-`:""}${of(t)}: ${function e(t,r){var n;let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if("string"==typeof t&&"string"==typeof(n=t)&&uk.some(e=>n.includes(e)))return t.includes("tokens.")?`var(${uN}${of(t.split(".").slice(1).join("-"))})`:`var(${uN}${of(t.split(".").join("-"))})`;if(Array.isArray(t)){if(t.length>=2){let[n,i]=t;return"string"==typeof n&&"string"==typeof i?"light"===o.resolveScheme?e(n,r,o):"dark"===o.resolveScheme?e(i,r,o):`light-dark(${e(n,r,o)}, ${e(i,r,o)})`:"string"==typeof n?e(n,r,o):"string"==typeof i?e(i,r,o):""}return e(t[0],r,o)}return r&&uO.includes(r)?String(t):of(String(t))}(r,t,n)};`}(t,l,s,n)}
`)}),o}let u_=new Set(["name","sizing","density","icons","colors","tokens","colorScheme"]),uL=new Set(["light","dark","auto"]),uP=new Set(["default","compact","comfortable"]),uD=new Set(["arrowRight","arrowRightWithBar","arrowLeft","arrowLeftWithBar","arrowDown","menu","selectArrow","arrowNarrowUp","arrowNarrowDown","check","checkbox","caretHiddenLeft","caretHiddenRight","caretHiddenUp","caretHiddenDown","collapseOff","collapseOn","radio","chipClose","search"]),uF=new Set(["fontFamily","fontSize","fontSizeSmall","lineHeight","lineHeightSmall","fontWeight","letterSpacing","gapSize","iconSize","tableTransition","borderRadius","borderColor","accentColor","foregroundColor","foregroundSecondaryColor","backgroundColor","backgroundSecondaryColor","placeholderColor","readOnlyColor","disabledColor","shadowColor","shadowX","shadowY","shadowBlur","shadowOpacity","barForegroundColor","barBackgroundColor","barHorizontalPadding","barVerticalPadding","cellHorizontalBorderColor","cellVerticalBorderColor","cellHorizontalPadding","cellVerticalPadding","rowHeaderOddBackgroundColor","rowHeaderEvenBackgroundColor","rowCellOddBackgroundColor","rowCellEvenBackgroundColor","cellEditorBorderWidth","cellEditorBorderColor","cellEditorForegroundColor","cellEditorBackgroundColor","cellEditorShadowBlurRadius","cellEditorShadowColor","cellSuccessBackgroundColor","cellErrorBackgroundColor","cellReadOnlyBackgroundColor","cellSelectionBorderColor","cellSelectionBackgroundColor","cellAutofillSize","cellAutofillHitAreaSize","cellAutofillBorderWidth","cellAutofillBorderRadius","cellAutofillBorderColor","cellAutofillBackgroundColor","cellAutofillFillBorderColor","cellMobileHandleSize","cellMobileHandleBorderWidth","cellMobileHandleBorderRadius","cellMobileHandleBorderColor","cellMobileHandleBackgroundColor","cellMobileHandleBackgroundOpacity","cellSelectionHandleSize","cellSelectionHandleLength","cellSelectionHandleBorderWidth","cellSelectionHandleBorderRadius","cellSelectionHandleBorderColor","cellSelectionHandleBackgroundColor","resizeIndicatorColor","moveBacklightColor","moveBacklightOpacity","moveIndicatorColor","hiddenIndicatorColor","scrollbarBorderRadius","scrollbarTrackColor","scrollbarThumbColor","headerFontWeight","headerForegroundColor","headerBackgroundColor","headerHighlightedShadowSize","headerHighlightedForegroundColor","headerHighlightedBackgroundColor","headerActiveBorderColor","headerActiveForegroundColor","headerActiveBackgroundColor","headerFilterBackgroundColor","headerRowForegroundColor","headerRowBackgroundColor","headerRowHighlightedForegroundColor","headerRowHighlightedBackgroundColor","headerRowActiveForegroundColor","headerRowActiveBackgroundColor","checkboxSize","checkboxBorderRadius","checkboxBorderColor","checkboxBackgroundColor","checkboxIconColor","checkboxFocusBorderColor","checkboxFocusBackgroundColor","checkboxFocusIconColor","checkboxFocusRingColor","checkboxDisabledBorderColor","checkboxDisabledBackgroundColor","checkboxDisabledIconColor","checkboxCheckedBorderColor","checkboxCheckedBackgroundColor","checkboxCheckedIconColor","checkboxCheckedFocusBorderColor","checkboxCheckedFocusBackgroundColor","checkboxCheckedFocusIconColor","checkboxCheckedDisabledBorderColor","checkboxCheckedDisabledBackgroundColor","checkboxCheckedDisabledIconColor","checkboxIndeterminateBorderColor","checkboxIndeterminateBackgroundColor","checkboxIndeterminateIconColor","checkboxIndeterminateFocusBorderColor","checkboxIndeterminateFocusBackgroundColor","checkboxIndeterminateFocusIconColor","checkboxIndeterminateDisabledBorderColor","checkboxIndeterminateDisabledBackgroundColor","checkboxIndeterminateDisabledIconColor","radioSize","radioBorderColor","radioBackgroundColor","radioIconColor","radioFocusBorderColor","radioFocusBackgroundColor","radioFocusIconColor","radioFocusRingColor","radioDisabledBorderColor","radioDisabledBackgroundColor","radioDisabledIconColor","radioCheckedBorderColor","radioCheckedBackgroundColor","radioCheckedIconColor","radioCheckedFocusBorderColor","radioCheckedFocusBackgroundColor","radioCheckedFocusIconColor","radioCheckedDisabledBorderColor","radioCheckedDisabledBackgroundColor","radioCheckedDisabledIconColor","iconButtonBorderRadius","iconButtonLargeBorderRadius","iconButtonLargePadding","iconButtonBorderColor","iconButtonBackgroundColor","iconButtonIconColor","iconButtonHitAreaSize","iconButtonHoverBorderColor","iconButtonHoverBackgroundColor","iconButtonHoverIconColor","iconButtonActiveBorderColor","iconButtonActiveBackgroundColor","iconButtonActiveIconColor","iconButtonActiveHoverBorderColor","iconButtonActiveHoverBackgroundColor","iconButtonActiveHoverIconColor","collapseButtonBorderRadius","collapseButtonOpenBorderColor","collapseButtonOpenBackgroundColor","collapseButtonOpenIconColor","collapseButtonOpenIconActiveColor","collapseButtonOpenHoverBorderColor","collapseButtonOpenHoverBackgroundColor","collapseButtonOpenHoverIconColor","collapseButtonOpenHoverIconActiveColor","collapseButtonCloseBorderColor","collapseButtonCloseBackgroundColor","collapseButtonCloseIconColor","collapseButtonCloseIconActiveColor","collapseButtonCloseHoverBorderColor","collapseButtonCloseHoverBackgroundColor","collapseButtonCloseHoverIconColor","collapseButtonCloseHoverIconActiveColor","buttonBorderRadius","buttonHorizontalPadding","buttonVerticalPadding","primaryButtonBorderColor","primaryButtonForegroundColor","primaryButtonBackgroundColor","primaryButtonDisabledBorderColor","primaryButtonDisabledForegroundColor","primaryButtonDisabledBackgroundColor","primaryButtonHoverBorderColor","primaryButtonHoverForegroundColor","primaryButtonHoverBackgroundColor","primaryButtonFocusBorderColor","primaryButtonFocusForegroundColor","primaryButtonFocusBackgroundColor","secondaryButtonBorderColor","secondaryButtonForegroundColor","secondaryButtonBackgroundColor","secondaryButtonDisabledBorderColor","secondaryButtonDisabledForegroundColor","secondaryButtonDisabledBackgroundColor","secondaryButtonHoverBorderColor","secondaryButtonHoverForegroundColor","secondaryButtonHoverBackgroundColor","secondaryButtonFocusBorderColor","secondaryButtonFocusForegroundColor","secondaryButtonFocusBackgroundColor","commentsTextareaHorizontalPadding","commentsTextareaVerticalPadding","commentsTextareaBorderWidth","commentsTextareaBorderColor","commentsTextareaForegroundColor","commentsTextareaBackgroundColor","commentsTextareaFocusBorderWidth","commentsTextareaFocusBorderColor","commentsTextareaFocusForegroundColor","commentsTextareaFocusBackgroundColor","commentsIndicatorSize","commentsIndicatorColor","licenseHorizontalPadding","licenseVerticalPadding","licenseForegroundColor","licenseBackgroundColor","linkColor","linkHoverColor","inputBorderWidth","inputBorderRadius","inputHorizontalPadding","inputVerticalPadding","inputBorderColor","inputForegroundColor","inputBackgroundColor","inputHoverBorderColor","inputHoverForegroundColor","inputHoverBackgroundColor","inputDisabledBorderColor","inputDisabledForegroundColor","inputDisabledBackgroundColor","inputFocusBorderColor","inputFocusForegroundColor","inputFocusBackgroundColor","menuBorderWidth","menuBorderRadius","menuHorizontalPadding","menuVerticalPadding","menuItemHorizontalPadding","menuItemVerticalPadding","menuBorderColor","menuShadowX","menuShadowY","menuShadowBlur","menuShadowColor","menuShadowOpacity","menuItemHoverColor","menuItemHoverColorOpacity","menuItemActiveColor","menuItemActiveColorOpacity","dialogSemiTransparentBackgroundColor","dialogSemiTransparentBackgroundOpacity","dialogSolidBackgroundColor","dialogContentPaddingHorizontal","dialogContentPaddingVertical","dialogContentBorderRadius","dialogContentBackgroundColor","notificationForegroundColor","notificationBackgroundColor","notificationBorderColor","notificationSuccessAccent","notificationWarningAccent","notificationErrorAccent","paginationBarForegroundColor","paginationBarBackgroundColor","paginationBarHorizontalPadding","paginationBarVerticalPadding","paginationButtonBorderColor","paginationButtonForegroundColor","paginationButtonBackgroundColor","paginationButtonHoverBorderColor","paginationButtonHoverForegroundColor","paginationButtonHoverBackgroundColor","paginationButtonDisabledForegroundColor","paginationButtonDisabledBackgroundColor","paginationButtonDisabledBorderColor","paginationButtonFocusBorderColor","paginationButtonFocusForegroundColor","paginationButtonFocusBackgroundColor","chipBackground","chipBorderRadius","chipVerticalPadding","chipHorizontalPadding","chipGap"]);function uB(e){if(!uL.has(e)){let t=[...uL].join(", ");tr(`[ThemeBuilder] Invalid color scheme: "${e}". Must be one of: ${t}.`)}return e}function uV(e){if(!uP.has(e)){let t=[...uP].join(", ");tr(`[ThemeBuilder] Invalid density: "${e}". Must be one of: ${t}.`)}return e}function uU(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},{type:o="key",warnMissing:i=!1}=n;if(!e){i&&tQ(`[ThemeBuilder] No ${o}s provided in ${r}. All ${o}s are missing.`);return}if(Object.keys(e).forEach(e=>{t.has(e)||tQ(`[ThemeBuilder] Unknown ${o} key: "${e}" in ${r}. This may be a custom ${o} or a typo.`)}),i){let n=[];t.forEach(t=>{t in e||n.push(t)}),n.length>0&&tQ(`[ThemeBuilder] Missing ${o}(s) in ${r}: ${n.join(", ")}`)}}function uz(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{requiredFields:n=[]}=r;("object"!=typeof e||null===e)&&tr(`[ThemeBuilder] ${t} must be an object.`);let{name:o,sizing:i,density:s,icons:a,colors:l,tokens:h,colorScheme:d}=e;if(uU(e,u_,t,{type:"param"}),n.forEach(r=>{void 0===e[r]&&tr(`[ThemeBuilder] ${t}.${r} is required.`)}),void 0!==o&&("string"!=typeof o||""===o.trim())&&tr(`[ThemeBuilder] ${t}.name must be a non-empty string.`),void 0===i||tc(i)||tr(`[ThemeBuilder] ${t}.sizing must be an object.`),void 0!==s){tc(s)||"string"==typeof s||tr(`[ThemeBuilder] ${t}.density must be a string or an object.`);var u=`${t}.density`;if(tc(s)){s.type&&s.sizes||tr(`[ThemeBuilder] ${u} must be a string or an object with a 'type' and 'sizes' property.`),uV(String(s.type));var c=s.sizes,g=`${u}.sizes`;tc(c)&&"object"==typeof c&&null!==c?Object.keys(c).forEach(e=>{uP.has(e)||tQ(`[ThemeBuilder] Unknown density size key: "${e}" in ${g}.sizes. This may be a custom density size or a typo.`)}):tr(`[ThemeBuilder] ${g}.sizes must be an object.`)}else"string"==typeof s&&uV(s)}void 0!==a&&(tc(a)||tr(`[ThemeBuilder] ${t}.icons must be an object.`),uU(a,uD,`${t}.icons`,{type:"icon",warnMissing:n.includes("icons")})),void 0!==l&&(tc(l)||tr(`[ThemeBuilder] ${t}.colors must be an object.`),function e(t,r){Object.entries(t).forEach(t=>{let[n,o]=t,i=`${r}.${n}`;"string"!=typeof o&&(tc(o)?e(o,i):tr(`[ThemeBuilder] ${i} must be a string or an object.`))})}(l,`${t}.colors`)),void 0!==h&&(tc(h)||tr(`[ThemeBuilder] ${t}.tokens must be an object.`),uU(h,uF,`${t}.tokens`,{type:"token",warnMissing:n.includes("tokens")})),void 0!==d&&uB(String(d))}function uW(e){return null==e||!1===e||""===e}function uG(e){return"auto"===e?"light dark":e}class u${hot;themeStyles=null;themeClassName="";themeConfig=null;scopeClassName;#nT=null;#nA={};#nM=null;constructor({hot:e,themeObject:t,overrides:r}){this.hot=e,this.scopeClassName=`ht-scope-${e.guid}`,r&&this.#nI(r),this.update(t)}#nx(e,t,r,n){if(!uW(e))try{return r(String(e))}catch{return tQ(`[ThemeManager] Ignoring the \`${t}\` option: ${JSON.stringify(e)} is not a supported value.`),n}}#nI(e){let t={...this.#nA};Object.prototype.hasOwnProperty.call(e,"colorScheme")&&(t.colorScheme=this.#nx(e.colorScheme,"colorScheme",uB,this.#nA.colorScheme)),Object.prototype.hasOwnProperty.call(e,"density")&&(t.density=this.#nx(e.density,"density",uV,this.#nA.density));let r=t.colorScheme!==this.#nA.colorScheme||t.density!==this.#nA.density;return this.#nA=t,r}#nN(e){if(!this.themeConfig)return"";let t={resolveScheme:e,lightDarkOnly:!0},r="";return this.themeConfig.colors&&(r+=uH(this.themeConfig.colors,"colors","",t)),this.themeConfig.tokens&&(r+=uH(this.themeConfig.tokens,"","",t)),r}#nO(){let{colorScheme:e,density:t}=this.#nA;if(!e&&!t)return"";let r=`.${this.themeClassName}.${this.scopeClassName}`,n=t?this.themeConfig?.density?.sizes?.[t]:void 0,o="";if(n)o+=`${r} {
${uH(n,"density")}}
`;else if(t){let e=`${this.themeConfig?.name}:${t}`;this.#nM!==e&&(this.#nM=e,tQ(`[ThemeManager] The "${this.themeConfig?.name}" theme has no "${t}" density sizes, so the \`density\` option has no effect. Add the sizes to the theme configuration.`))}return e&&(o+=`${r} {
color-scheme: ${uG(e)};
`,o+=this.#nN("dark"===e?"dark":"light"),o+="}\n","auto"===e&&(o+=`@media (prefers-color-scheme: dark) {
${r} {
${this.#nN("dark")}}
}
`)),o}#nk(){var e,t;let r;if(!this.themeConfig||!this.hot||!this.hot.rootDocument||!this.hot.rootWrapperElement)return;let n=uG(this.themeConfig.colorScheme);this.themeStyles||(this.themeStyles=this.hot.rootDocument.createElement("style"),this.themeStyles.setAttribute("data-hot-theme-style","true")),this.themeStyles.textContent=`:where(.${this.themeClassName}) {
`,this.themeConfig.sizing&&(this.themeStyles.textContent+=uH(this.themeConfig.sizing,"sizing")),this.themeConfig.density&&this.themeConfig.density.type&&this.themeConfig.density.sizes&&this.themeConfig.density.sizes[this.themeConfig.density.type]&&(this.themeStyles.textContent+=uH(this.themeConfig.density.sizes[this.themeConfig.density.type],"density")),this.themeConfig.colors&&(this.themeStyles.textContent+=uH(this.themeConfig.colors,"colors")),this.themeConfig.tokens&&(this.themeStyles.textContent+=uH(this.themeConfig.tokens)),this.themeConfig.icons&&(this.themeStyles.textContent+=(e=this.themeConfig.icons,r=t?`[class*=${t}] `:"",`${r}.htDropdownMenu table tbody tr td.htSubmenu .htItemWrapper::after,
${r}.htContextMenu table tbody tr td.htSubmenu .htItemWrapper::after,
${r}.htFiltersConditionsMenu table tbody tr td.htSubmenu .htItemWrapper::after {
  ${ux(e,"arrowRight")}
}

${r}.ht-page-size-section__select-wrapper::after {
  ${ux(e,"arrowDown")}
}

${r}.changeType::before {
  ${ux(e,"menu")}
}

${r}.htUISelectCaption::after,
.htAutocompleteArrow::after {
  ${ux(e,"selectArrow")}
}

${r}.columnSorting.sortAction.ascending::before {
  ${ux(e,"arrowNarrowUp")}
}

${r}.columnSorting.sortAction.descending::before {
  ${ux(e,"arrowNarrowDown")}
}

${r}.ht-page-navigation-section .ht-page-first::before {
  ${ux(e,"arrowLeftWithBar")}
}

${r}[dir="rtl"] .ht-page-navigation-section .ht-page-first::before {
  ${ux(e,"arrowRightWithBar")}
}

${r}.ht-page-navigation-section .ht-page-prev::before {
  ${ux(e,"arrowLeft")}
}

${r}[dir="rtl"] .ht-page-navigation-section .ht-page-prev::before {
  ${ux(e,"arrowRight")}
}

${r}.ht-page-navigation-section .ht-page-next::before {
  ${ux(e,"arrowRight")}
}

${r}[dir="rtl"] .ht-page-navigation-section .ht-page-next::before {
  ${ux(e,"arrowLeft")}
}

${r}.ht-page-navigation-section .ht-page-last::before {
  ${ux(e,"arrowRightWithBar")}
}

${r}[dir="rtl"] .ht-page-navigation-section .ht-page-last::before {
  ${ux(e,"arrowLeftWithBar")}
}

${r}.htDropdownMenu table tbody tr td .htItemWrapper span.selected::after,
${r}.htContextMenu table tbody tr td .htItemWrapper span.selected::after,
${r}.htFiltersConditionsMenu table tbody tr td .htItemWrapper span.selected::after {
  ${ux(e,"check")}
}

${r}.htCheckboxRendererInput {
  appearance: none;
}

${r}.htCheckboxRendererInput::after {
  ${ux(e,"checkbox")}
}

${r}th.beforeHiddenColumn::after {
  ${ux(e,"caretHiddenLeft")}
}

${r}th.afterHiddenColumn::before {
  ${ux(e,"caretHiddenRight")}
}

${r}th.beforeHiddenRow::after {
  ${ux(e,"caretHiddenUp")}
}

${r}th.afterHiddenRow::before {
  ${ux(e,"caretHiddenDown")}
}

${r}.collapsibleIndicator::before,
${r}.ht_nestingButton::before {
  ${ux(e,"collapseOff")}
}

${r}.collapsibleIndicator.collapsed::before,
${r}.ht_nestingButton.ht_nestingExpand::before {
  ${ux(e,"collapseOn")}
}

${r}.htUIRadio > input[type="radio"]::after {
  ${ux(e,"radio")}
}

${r}.ht-multi-select-chip-remove::before {
  ${ux(e,"chipClose")}
}

${r}.ht-notification__close::before {
  ${ux(e,"chipClose")}
}

${r}.ht-multi-select-editor-search-icon {
  ${ux(e,"search")}
}

${r}.ht-multi-select-editor-item-selected input::after {
  ${ux(e,"checkbox")}
}`)),this.themeStyles.textContent+="}\n",this.themeStyles.textContent+=`.${this.themeClassName} {
color-scheme: ${n};
}
`,this.themeStyles.textContent+=this.#nO(),this.themeStyles.parentNode!==this.hot.rootWrapperElement&&this.hot.rootWrapperElement.prepend(this.themeStyles)}getClassName(){return this.themeClassName}getOverrides(){return{...this.#nA}}getColorScheme(){return this.#nA.colorScheme??this.themeConfig?.colorScheme}getDensityType(){return this.#nA.density??this.themeConfig?.density?.type}setOverrides(e){return!!this.#nI(e)&&(this.#nk(),!0)}update(e){this.hot&&(void 0===e.getThemeConfig&&tr('[ThemeManager] The "theme" option must be an instance of ThemeBuilder.'),this.themeConfig=e.getThemeConfig(),this.themeClassName=`ht-theme-${this.themeConfig.name}`,"function"==typeof e.subscribe&&(this.#nT?.(),this.#nT=e.subscribe(e=>{this.hot?.stylesHandler&&(this.themeConfig=e,this.#nk(),this.hot.stylesHandler.clearCache(),this.hot.render(),this.hot.runHooks("afterSetTheme",this.themeClassName,!1))})),this.mount(),this.hot.runHooks("afterSetTheme",this.themeClassName,!0))}mount(){this.#nH(),this.#nk()}unmount(){this.#n_(),this.themeStyles&&this.themeStyles.remove()}#nH(){[this.hot?.rootWrapperElement,this.hot?.rootPortalElement].forEach(e=>{e&&rd(e,this.scopeClassName)})}#n_(){[this.hot?.rootWrapperElement,this.hot?.rootPortalElement].forEach(e=>{e&&ru(e,this.scopeClassName)})}destroy(){this.#nT?.(),this.unmount(),this.hot.themeManager=null}}let uY={size_0:"0px",size_0_5:"2px",size_1:"4px",size_2:"8px",size_1_5:"6px",size_3:"12px",size_4:"16px",size_5:"20px",size_6:"24px",size_7:"28px",size_8:"32px",size_9:"36px",size_10:"40px",size_0_25:"1px"},uj={default:{cellVertical:"sizing.size_1",cellHorizontal:"sizing.size_2",barsHorizontal:"sizing.size_4",barsVertical:"sizing.size_2",gap:"sizing.size_1",buttonHorizontal:"sizing.size_3",buttonVertical:"sizing.size_1_5",dialogHorizontal:"sizing.size_2",dialogVertical:"sizing.size_2",inputHorizontal:"sizing.size_3",inputVertical:"sizing.size_1_5",menuVertical:"sizing.size_2",menuHorizontal:"sizing.size_0",menuItemVertical:"sizing.size_1",menuItemHorizontal:"sizing.size_3"},compact:{cellVertical:"sizing.size_0_5",cellHorizontal:"sizing.size_1_5",barsHorizontal:"sizing.size_2",barsVertical:"sizing.size_1",gap:"sizing.size_0_5",buttonHorizontal:"sizing.size_2",buttonVertical:"sizing.size_0_5",dialogHorizontal:"sizing.size_1_5",dialogVertical:"sizing.size_1_5",inputHorizontal:"sizing.size_2",inputVertical:"sizing.size_0_5",menuVertical:"sizing.size_2",menuHorizontal:"sizing.size_0",menuItemVertical:"sizing.size_0_5",menuItemHorizontal:"sizing.size_2"},comfortable:{cellVertical:"sizing.size_2",cellHorizontal:"sizing.size_3",barsHorizontal:"sizing.size_4",barsVertical:"sizing.size_2",gap:"sizing.size_1_5",buttonHorizontal:"sizing.size_4",buttonVertical:"sizing.size_2",dialogHorizontal:"sizing.size_3",dialogVertical:"sizing.size_3",inputHorizontal:"sizing.size_4",inputVertical:"sizing.size_2",menuVertical:"sizing.size_3",menuHorizontal:"sizing.size_0",menuItemVertical:"sizing.size_2",menuItemHorizontal:"sizing.size_2"}},uq=["sizing","icons","colors","tokens"],uK=["name","icons","colors","tokens"];class uX{#nL;#nP;#nD=new Set;#nF="auto";#nB="default";constructor(e){uz(e,"themeConfig",{requiredFields:uK}),this.#nL={name:void 0,sizing:uY,density:{type:this.#nB,sizes:uj},icons:{},colors:{},tokens:{},colorScheme:this.#nF},this.#nV(e),this.#nL=this.#nP}#nU(){let e=this.getThemeConfig();this.#nD.forEach(t=>t(e))}#nz(e,t){if("string"!=typeof t){let r=tS(e.density,t);e.density=r,void 0!==t.type&&(this.#nB=t.type,this.#nL?.density&&(this.#nL.density.type=t.type))}else e.density.type=t,this.#nB=t,this.#nL?.density&&(this.#nL.density.type=t)}#nV(e){let t=ta(this.#nL);void 0!==e.name&&(void 0!==this.#nL.name?tQ('[ThemeBuilder] The "name" property can only be set during `registerTheme()` and cannot be updated via `params()`.'):t.name=e.name),uq.forEach(r=>{void 0!==e[r]&&tc(e[r])&&(t[r]=tS(t[r],e[r]))}),void 0!==e.density&&this.#nz(t,e.density),void 0!==e.colorScheme&&(t.colorScheme=e.colorScheme,this.#nF=e.colorScheme,this.#nL?.colorScheme&&(this.#nL.colorScheme=e.colorScheme)),this.#nP=t}subscribe(e){return"function"!=typeof e&&tr("[ThemeBuilder] listener must be a function."),this.#nD.add(e),()=>this.#nD.delete(e)}params(e){return uz(e,"params"),this.#nV(e),this.#nU(),this}setColorScheme(e){return this.#nF=uB(e),this.#nP.colorScheme=this.#nF,this.#nL.colorScheme=this.#nF,this.#nU(),this}setDensityType(e){return this.#nB=uV(e),this.#nP.density.type=this.#nB,this.#nL.density.type=this.#nB,this.#nU(),this}getThemeConfig(){return this.#nP}}let{hasItem:uQ,getItem:uZ,getNames:uJ,getValues:u0,register:u1}=nU("themes");function u2(e){return uQ(e)}function u3(e){return uQ(e)?uZ(e):void tQ(`Theme "${e}" is not registered. Please ensure it is registered before using it.`)}function u6(){return uJ()}function u5(){return u0()}function u4(e,t){let r=e,n=ta(t);return"string"==typeof e&&tc(t)?n.name=e:"string"!=typeof e&&tc(e)&&(r=(n=ta(e)).name??""),{themeName:r,themeConfigObject:n}}function u9(e,t){let{themeName:r,themeConfigObject:n}=u4(e,t),o=new uX(n);return uQ(r)?(tQ(`Theme "${r}" is already registered. Registration skipped.`),u3(r)):(u1(r,o),o)}function u7(e,t){let{themeName:r,themeConfigObject:n}=u4(e,t);if(!uQ(r))return void tQ(`Theme "${r}" is not registered. Cannot reinitialize a non-existent theme.`);let o=new uX(n);return u1(r,o),o}let u8={name:"main",density:"default",icons:{arrowRight:"data:image/svg+xml;charset=utf-8,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6.64648 10.9393L9.93938 7.64644L6.64648 4.35354' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E%0A",arrowRightWithBar:"data:image/svg+xml;charset=utf-8,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4.9292 4.64188L8.27934 7.99203L4.9292 11.3422M11.0711 4.08353V11.3422' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E",arrowLeft:"data:image/svg+xml;charset=utf-8,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9.49268 11.2929L6.19978 8.00001L9.49268 4.70712' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E%0A",arrowLeftWithBar:"data:image/svg+xml;charset=utf-8,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11.0713 4.64188L7.72115 7.99203L11.0713 11.3422M4.92936 4.08353L4.92936 11.3422' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E",arrowDown:"data:image/svg+xml;charset=utf-8,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cg opacity='0.6'%3E%3Cpath d='M11.5859 6L8.29304 9.29289L5.00015 6' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/g%3E%3C/svg%3E",menu:"data:image/svg+xml;charset=utf-8,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11.0002 6.66663C11.4262 6.66663 11.6487 7.15963 11.3917 7.47813L11.3537 7.52013L8.35372 10.5201C8.26762 10.6062 8.15307 10.6579 8.03156 10.6656C7.91005 10.6732 7.78992 10.6363 7.69372 10.5616L7.64672 10.5201L4.64672 7.52013L4.60522 7.47313L4.57822 7.43463L4.55122 7.38663L4.54272 7.36863L4.52922 7.33513L4.51322 7.28113L4.50822 7.25463L4.50322 7.22463L4.50122 7.19613V7.13713L4.50372 7.10813L4.50822 7.07813L4.51322 7.05213L4.52922 6.99813L4.54272 6.96463L4.57772 6.89863L4.61022 6.85363L4.64672 6.81313L4.69372 6.77163L4.73222 6.74463L4.78022 6.71763L4.79822 6.70913L4.83172 6.69563L4.88572 6.67963L4.91222 6.67463L4.94222 6.66963L4.97072 6.66763L11.0002 6.66663Z' fill='currentColor'/%3E%3C/svg%3E%0A",selectArrow:"data:image/svg+xml;charset=utf-8,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11.0002 6.66663C11.4262 6.66663 11.6487 7.15963 11.3917 7.47813L11.3537 7.52013L8.35372 10.5201C8.26762 10.6062 8.15307 10.6579 8.03156 10.6656C7.91005 10.6732 7.78992 10.6363 7.69372 10.5616L7.64672 10.5201L4.64672 7.52013L4.60522 7.47313L4.57822 7.43463L4.55122 7.38663L4.54272 7.36863L4.52922 7.33513L4.51322 7.28113L4.50822 7.25463L4.50322 7.22463L4.50122 7.19613V7.13713L4.50372 7.10813L4.50822 7.07813L4.51322 7.05213L4.52922 6.99813L4.54272 6.96463L4.57772 6.89863L4.61022 6.85363L4.64672 6.81313L4.69372 6.77163L4.73222 6.74463L4.78022 6.71763L4.79822 6.70913L4.83172 6.69563L4.88572 6.67963L4.91222 6.67463L4.94222 6.66963L4.97072 6.66763L11.0002 6.66663Z' fill='currentColor'/%3E%3C/svg%3E%0A",arrowNarrowUp:"data:image/svg+xml;charset=utf-8,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8.00008 12.6667L8.00008 3.33335M8.00008 3.33335L5.33342 6.00002M8.00008 3.33335L10.6667 6.00002' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E%0A",arrowNarrowDown:"data:image/svg+xml;charset=utf-8,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8.00004 3.33331V12.6666M8.00004 12.6666L10.6667 9.99998M8.00004 12.6666L5.33337 9.99998' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E%0A",check:"data:image/svg+xml;charset=utf-8,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3.33337 8.00002L6.66671 11.3334L13.3334 4.66669' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E%0A",checkbox:"data:image/svg+xml;charset=utf-8,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 8L7 10L11 6' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E%0A",caretHiddenLeft:"data:image/svg+xml,%3Csvg width='10' height='10' viewBox='0 0 10 10' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6.08482 1.35771L6.11503 1.3551H6.17649L6.2067 1.35771L6.23795 1.36239L6.26503 1.3676L6.32128 1.38427L6.35618 1.39833L6.42493 1.43479L6.4718 1.46864L6.51399 1.50667L6.55722 1.55562L6.58534 1.59573L6.61347 1.64573L6.62232 1.66448L6.63639 1.69937L6.65305 1.75562L6.65826 1.78323L6.66347 1.81448L6.66555 1.84417L6.66659 1.87489V8.12489C6.66659 8.56864 6.15305 8.80042 5.82128 8.53271L5.77753 8.49312L2.65253 5.36812C2.56286 5.27844 2.50899 5.15912 2.50103 5.03254C2.49307 4.90596 2.53157 4.78083 2.6093 4.68062L2.65253 4.63167L5.77753 1.50667L5.82649 1.46344L5.86659 1.43531L5.91659 1.40719L5.93534 1.39833L5.97024 1.38427L6.02649 1.3676L6.05409 1.36239L6.08482 1.35771Z' fill='currentColor'/%3E%3C/svg%3E",caretHiddenRight:"data:image/svg+xml,%3Csvg width='10' height='10' viewBox='0 0 10 10' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3.33337 1.87499C3.33337 1.43124 3.84692 1.19947 4.17869 1.46718L4.22244 1.50676L7.34744 4.63176C7.43711 4.72145 7.49098 4.84077 7.49894 4.96735C7.5069 5.09392 7.4684 5.21905 7.39067 5.31926L7.34744 5.36822L4.22244 8.49322L4.17348 8.53645L4.13337 8.56457L4.08337 8.5927L4.06462 8.60155L4.02973 8.61562L3.97348 8.63228L3.94587 8.63749L3.91462 8.6427L3.88494 8.64478L3.85421 8.64582L3.82348 8.64478L3.79327 8.64218L3.76202 8.63749L3.73494 8.63228L3.67869 8.61562L3.64379 8.60155L3.57504 8.5651L3.52817 8.53124L3.48598 8.49322L3.44275 8.44426L3.41462 8.40416L3.3865 8.35416L3.37764 8.33541L3.36358 8.30051L3.34692 8.24426L3.34171 8.21666L3.3365 8.18541L3.33442 8.15572L3.33337 1.87499Z' fill='currentColor'/%3E%3C/svg%3E",caretHiddenUp:"data:image/svg+xml;charset=utf-8,%3Csvg width='8' height='8' viewBox='0 0 8 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3.76425 2.43099C3.82165 2.3736 3.89801 2.33913 3.97902 2.33403C4.06003 2.32894 4.14012 2.35358 4.20425 2.40333L4.23558 2.43099L6.23558 4.43099L6.26325 4.46233L6.28125 4.48799L6.29925 4.51999L6.30492 4.53199L6.31392 4.55433L6.32458 4.59033L6.32792 4.60799L6.33125 4.62799L6.33258 4.64699L6.33325 4.66666L6.33258 4.68633L6.33092 4.70566L6.32792 4.72566L6.32458 4.74299L6.31392 4.77899L6.30492 4.80133L6.28158 4.84533L6.25992 4.87533L6.23558 4.90233L6.20425 4.92999L6.17858 4.94799L6.14658 4.96599L6.13458 4.97166L6.11225 4.98066L6.07625 4.99133L6.05858 4.99466L6.03858 4.99799L6.01958 4.99933L5.99992 4.99999H1.99992C1.71592 4.99999 1.56758 4.67133 1.73892 4.45899L1.76425 4.43099L3.76425 2.43099Z' fill='currentColor'/%3E%3C/svg%3E%0A",caretHiddenDown:"data:image/svg+xml;charset=utf-8,%3Csvg width='8' height='8' viewBox='0 0 8 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5.9999 3C6.2839 3 6.43224 3.32867 6.2609 3.541L6.23557 3.569L4.23557 5.569C4.17817 5.62639 4.10181 5.66087 4.0208 5.66596C3.93979 5.67106 3.8597 5.64642 3.79557 5.59667L3.76424 5.569L1.76424 3.569L1.73657 3.53767L1.71857 3.512L1.70057 3.48L1.6949 3.468L1.6859 3.44567L1.67524 3.40967L1.6719 3.392L1.66857 3.372L1.66724 3.353V3.31367L1.6689 3.29433L1.6719 3.27433L1.67524 3.257L1.6859 3.221L1.6949 3.19867L1.71824 3.15467L1.7399 3.12467L1.76424 3.09767L1.79557 3.07L1.82124 3.052L1.85324 3.034L1.86524 3.02833L1.88757 3.01933L1.92357 3.00867L1.94124 3.00533L1.96124 3.002L1.98024 3.00067L5.9999 3Z' fill='currentColor'/%3E%3C/svg%3E%0A",collapseOff:"data:image/svg+xml;charset=utf-8,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4.33325 8H11.6666' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E%0A",collapseOn:"data:image/svg+xml;charset=utf-8,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M7.49988 11.6667C7.49988 11.9428 7.72374 12.1667 7.99988 12.1667C8.27602 12.1667 8.49988 11.9428 8.49988 11.6667V8.50002H11.6666C11.9427 8.50002 12.1666 8.27616 12.1666 8.00002C12.1666 7.72388 11.9427 7.50002 11.6666 7.50002H8.49988V4.33337C8.49988 4.05723 8.27602 3.83337 7.99988 3.83337C7.72374 3.83337 7.49988 4.05723 7.49988 4.33337V7.50002H4.33325C4.05711 7.50002 3.83325 7.72388 3.83325 8.00002C3.83325 8.27616 4.05711 8.50002 4.33325 8.50002H7.49988V11.6667Z' fill='currentColor'/%3E%3C/svg%3E%0A",radio:"data:image/svg+xml;charset=utf-8,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='8' cy='8' r='4' fill='currentColor'/%3E%3C/svg%3E%0A",chipClose:"data:image/svg+xml;charset=utf-8,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 4L4 12M4 4L12 12' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E%0A",search:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32' fill='none'%3E%3Cg opacity='0.5'%3E%3Cpath d='M28 28L20 20M4 13.3333C4 14.559 4.24141 15.7727 4.71046 16.905C5.1795 18.0374 5.86699 19.0663 6.73367 19.933C7.60035 20.7997 8.62925 21.4872 9.76162 21.9562C10.894 22.4253 12.1077 22.6667 13.3333 22.6667C14.559 22.6667 15.7727 22.4253 16.905 21.9562C18.0374 21.4872 19.0663 20.7997 19.933 19.933C20.7997 19.0663 21.4872 18.0374 21.9562 16.905C22.4253 15.7727 22.6667 14.559 22.6667 13.3333C22.6667 12.1077 22.4253 10.894 21.9562 9.76162C21.4872 8.62925 20.7997 7.60035 19.933 6.73367C19.0663 5.86699 18.0374 5.1795 16.905 4.71046C15.7727 4.24141 14.559 4 13.3333 4C12.1077 4 10.894 4.24141 9.76162 4.71046C8.62925 5.1795 7.60035 5.86699 6.73367 6.73367C5.86699 7.60035 5.1795 8.62925 4.71046 9.76162C4.24141 10.894 4 12.1077 4 13.3333Z' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/g%3E%3C/svg%3E"},colors:{white:"#ffffffff",black:"#000000ff",primary:{100:"#6180ffff",200:"#5573f0ff",300:"#4669f6ff",400:"#2e56fcff",500:"#1a42e8ff",600:"#1535bcff"},palette:{50:"#f7f7f9ff",100:"#e7e7e9ff",200:"#b9b9bbff",300:"#a3a3a3ff",400:"#68696cff",500:"#404144ff",600:"#313132ff",700:"#282829ff",800:"#222222ff",900:"#1e1e1fff",950:"#050506ff"},transparent:"#ffffff00"},tokens:{fontFamily:"Inter",fontSize:"14px",fontSizeSmall:"12px",lineHeight:"20px",lineHeightSmall:"18px",fontWeight:"400",letterSpacing:"0px",borderColor:["colors.palette.100","colors.palette.700"],accentColor:["colors.primary.500","colors.primary.300"],foregroundColor:["colors.palette.800","colors.palette.200"],foregroundSecondaryColor:["colors.palette.400","colors.palette.300"],backgroundColor:["colors.white","colors.palette.950"],backgroundSecondaryColor:["colors.palette.50","colors.palette.900"],placeholderColor:["colors.palette.300","colors.palette.400"],readOnlyColor:["colors.palette.400","colors.palette.300"],disabledColor:["colors.palette.300","colors.palette.400"],gapSize:"density.gap",iconSize:"sizing.size_4",tableTransition:"0.15s",borderRadius:"sizing.size_1",barForegroundColor:"tokens.foregroundColor",barBackgroundColor:"tokens.backgroundSecondaryColor",barHorizontalPadding:"density.barsHorizontal",barVerticalPadding:"density.barsVertical",shadowColor:["colors.palette.800","colors.palette.200"],shadowX:"sizing.size_0",shadowY:"sizing.size_2",shadowBlur:"sizing.size_4",shadowOpacity:"8%",cellHorizontalPadding:"density.cellHorizontal",cellVerticalPadding:"density.cellVertical",cellHorizontalBorderColor:"tokens.borderColor",cellVerticalBorderColor:"tokens.borderColor",cellSelectionBorderColor:"tokens.accentColor",cellSelectionBackgroundColor:["colors.primary.400","colors.primary.200"],cellSuccessBackgroundColor:"#37bc6c33",cellErrorBackgroundColor:"#fa4d3233",cellReadOnlyBackgroundColor:"tokens.backgroundSecondaryColor",cellAutofillSize:"sizing.size_1_5",cellAutofillHitAreaSize:"sizing.size_3",cellAutofillBorderWidth:"sizing.size_0_25",cellAutofillBorderRadius:"sizing.size_1",cellAutofillBorderColor:"tokens.backgroundColor",cellAutofillBackgroundColor:"tokens.accentColor",cellAutofillFillBorderColor:"tokens.foregroundColor",cellEditorBorderWidth:"2px",cellEditorBorderColor:"tokens.accentColor",cellEditorForegroundColor:["colors.palette.950","colors.white"],cellEditorBackgroundColor:"tokens.backgroundColor",cellEditorShadowBlurRadius:"0px",cellEditorShadowColor:"tokens.accentColor",cellMobileHandleSize:"sizing.size_3",cellMobileHandleBorderWidth:"sizing.size_0_25",cellMobileHandleBorderRadius:"sizing.size_3",cellMobileHandleBorderColor:"tokens.accentColor",cellMobileHandleBackgroundColor:"tokens.accentColor",cellMobileHandleBackgroundOpacity:"40%",cellSelectionHandleSize:"sizing.size_2",cellSelectionHandleLength:"sizing.size_4",cellSelectionHandleBorderWidth:"sizing.size_0_25",cellSelectionHandleBorderRadius:"sizing.size_3",cellSelectionHandleBorderColor:"tokens.accentColor",cellSelectionHandleBackgroundColor:"tokens.backgroundColor",headerFontWeight:"tokens.fontWeight",headerForegroundColor:"tokens.foregroundColor",headerBackgroundColor:"tokens.backgroundSecondaryColor",headerHighlightedShadowSize:"0px",headerHighlightedForegroundColor:["colors.palette.950","colors.white"],headerHighlightedBackgroundColor:["colors.palette.100","colors.palette.700"],headerActiveBorderColor:["colors.primary.400","colors.primary.200"],headerActiveForegroundColor:"colors.white",headerActiveBackgroundColor:"tokens.accentColor",headerFilterBackgroundColor:"tokens.cellSuccessBackgroundColor",headerRowForegroundColor:"tokens.foregroundColor",headerRowBackgroundColor:"tokens.backgroundSecondaryColor",headerRowHighlightedForegroundColor:["colors.palette.950","colors.white"],headerRowHighlightedBackgroundColor:["colors.palette.100","colors.palette.700"],headerRowActiveForegroundColor:"colors.white",headerRowActiveBackgroundColor:"tokens.accentColor",rowHeaderOddBackgroundColor:"tokens.headerRowBackgroundColor",rowHeaderEvenBackgroundColor:"tokens.headerRowBackgroundColor",rowCellOddBackgroundColor:"tokens.backgroundColor",rowCellEvenBackgroundColor:"tokens.backgroundColor",buttonBorderRadius:"sizing.size_1",buttonHorizontalPadding:"density.buttonHorizontal",buttonVerticalPadding:"density.buttonVertical",primaryButtonBorderColor:"colors.transparent",primaryButtonForegroundColor:"colors.white",primaryButtonBackgroundColor:"tokens.accentColor",primaryButtonDisabledBorderColor:"colors.transparent",primaryButtonDisabledForegroundColor:"tokens.disabledColor",primaryButtonDisabledBackgroundColor:["colors.palette.100","colors.palette.700"],primaryButtonHoverBorderColor:"colors.transparent",primaryButtonHoverForegroundColor:"tokens.backgroundColor",primaryButtonHoverBackgroundColor:["colors.primary.600","colors.primary.100"],primaryButtonFocusBorderColor:"tokens.backgroundColor",primaryButtonFocusForegroundColor:"tokens.backgroundColor",primaryButtonFocusBackgroundColor:"tokens.accentColor",secondaryButtonBorderColor:"tokens.borderColor",secondaryButtonForegroundColor:"tokens.foregroundColor",secondaryButtonBackgroundColor:"tokens.backgroundColor",secondaryButtonDisabledBorderColor:"tokens.borderColor",secondaryButtonDisabledForegroundColor:"tokens.disabledColor",secondaryButtonDisabledBackgroundColor:["colors.palette.100","colors.palette.700"],secondaryButtonHoverBorderColor:"tokens.borderColor",secondaryButtonHoverForegroundColor:"tokens.foregroundColor",secondaryButtonHoverBackgroundColor:["colors.palette.100","colors.palette.700"],secondaryButtonFocusBorderColor:"tokens.borderColor",secondaryButtonFocusForegroundColor:"tokens.foregroundColor",secondaryButtonFocusBackgroundColor:"tokens.backgroundColor",iconButtonBorderRadius:"sizing.size_0_5",iconButtonLargeBorderRadius:"sizing.size_1",iconButtonLargePadding:"sizing.size_1",iconButtonBorderColor:["colors.palette.50","colors.palette.900"],iconButtonBackgroundColor:"tokens.backgroundSecondaryColor",iconButtonIconColor:["colors.palette.300","colors.palette.400"],iconButtonHitAreaSize:"sizing.size_6",iconButtonHoverBorderColor:["colors.palette.100","colors.palette.700"],iconButtonHoverBackgroundColor:["colors.palette.100","colors.palette.700"],iconButtonHoverIconColor:["colors.palette.300","colors.palette.400"],iconButtonActiveBorderColor:["colors.primary.400","colors.primary.200"],iconButtonActiveBackgroundColor:"tokens.accentColor",iconButtonActiveIconColor:"colors.white",iconButtonActiveHoverBorderColor:["colors.primary.400","colors.primary.200"],iconButtonActiveHoverBackgroundColor:["colors.primary.400","colors.primary.200"],iconButtonActiveHoverIconColor:"colors.white",collapseButtonBorderRadius:"sizing.size_1",collapseButtonOpenBorderColor:["colors.palette.200","colors.palette.500"],collapseButtonOpenBackgroundColor:["colors.white","colors.palette.950"],collapseButtonOpenIconColor:["colors.palette.400","colors.palette.300"],collapseButtonOpenIconActiveColor:["colors.palette.400","colors.palette.300"],collapseButtonOpenHoverBorderColor:["colors.palette.200","colors.palette.500"],collapseButtonOpenHoverBackgroundColor:["colors.palette.50","colors.palette.900"],collapseButtonOpenHoverIconColor:["colors.palette.400","colors.palette.300"],collapseButtonOpenHoverIconActiveColor:["colors.palette.400","colors.palette.300"],collapseButtonCloseBorderColor:["colors.palette.200","colors.palette.500"],collapseButtonCloseBackgroundColor:["colors.palette.100","colors.palette.700"],collapseButtonCloseIconColor:["colors.palette.400","colors.palette.300"],collapseButtonCloseIconActiveColor:["colors.palette.400","colors.palette.300"],collapseButtonCloseHoverBorderColor:["colors.palette.200","colors.palette.500"],collapseButtonCloseHoverBackgroundColor:["colors.palette.100","colors.palette.700"],collapseButtonCloseHoverIconColor:["colors.palette.400","colors.palette.300"],collapseButtonCloseHoverIconActiveColor:["colors.palette.400","colors.palette.300"],linkColor:["colors.primary.600","colors.primary.100"],linkHoverColor:"tokens.accentColor",inputBorderWidth:"1px",inputBorderRadius:"sizing.size_1",inputHorizontalPadding:"density.inputHorizontal",inputVerticalPadding:"density.inputVertical",inputBorderColor:"tokens.borderColor",inputForegroundColor:"tokens.foregroundColor",inputBackgroundColor:"tokens.backgroundSecondaryColor",inputHoverBorderColor:"tokens.borderColor",inputHoverForegroundColor:"tokens.foregroundColor",inputHoverBackgroundColor:"tokens.backgroundColor",inputDisabledBorderColor:"tokens.borderColor",inputDisabledForegroundColor:"tokens.disabledColor",inputDisabledBackgroundColor:["colors.palette.200","colors.palette.500"],inputFocusBorderColor:"tokens.accentColor",inputFocusForegroundColor:"tokens.foregroundColor",inputFocusBackgroundColor:"tokens.backgroundColor",checkboxSize:"tokens.iconSize",checkboxBorderRadius:"sizing.size_1",checkboxBorderColor:["colors.palette.200","colors.palette.500"],checkboxBackgroundColor:"tokens.backgroundColor",checkboxIconColor:"colors.transparent",checkboxFocusBorderColor:["colors.palette.200","colors.palette.500"],checkboxFocusBackgroundColor:"tokens.backgroundColor",checkboxFocusIconColor:"colors.transparent",checkboxFocusRingColor:"tokens.accentColor",checkboxDisabledBorderColor:["colors.palette.200","colors.palette.500"],checkboxDisabledBackgroundColor:["colors.palette.100","colors.palette.700"],checkboxDisabledIconColor:"colors.transparent",checkboxCheckedBorderColor:["colors.primary.400","colors.primary.200"],checkboxCheckedBackgroundColor:"tokens.accentColor",checkboxCheckedIconColor:"colors.white",checkboxCheckedFocusBorderColor:"tokens.backgroundColor",checkboxCheckedFocusBackgroundColor:"tokens.accentColor",checkboxCheckedFocusIconColor:"colors.white",checkboxCheckedDisabledBorderColor:["colors.palette.200","colors.palette.500"],checkboxCheckedDisabledBackgroundColor:["colors.palette.100","colors.palette.700"],checkboxCheckedDisabledIconColor:"tokens.disabledColor",checkboxIndeterminateBorderColor:["colors.primary.400","colors.primary.200"],checkboxIndeterminateBackgroundColor:"tokens.accentColor",checkboxIndeterminateIconColor:"colors.white",checkboxIndeterminateFocusBorderColor:"tokens.backgroundColor",checkboxIndeterminateFocusBackgroundColor:"tokens.accentColor",checkboxIndeterminateFocusIconColor:"colors.white",checkboxIndeterminateDisabledBorderColor:["colors.palette.200","colors.palette.600"],checkboxIndeterminateDisabledBackgroundColor:["colors.palette.200","colors.palette.500"],checkboxIndeterminateDisabledIconColor:"tokens.disabledColor",radioSize:"tokens.iconSize",radioBorderColor:["colors.palette.200","colors.palette.500"],radioBackgroundColor:"tokens.backgroundColor",radioIconColor:"colors.transparent",radioFocusBorderColor:"tokens.borderColor",radioFocusBackgroundColor:"tokens.backgroundColor",radioFocusIconColor:"colors.transparent",radioFocusRingColor:"tokens.accentColor",radioDisabledBorderColor:["colors.palette.200","colors.palette.500"],radioDisabledBackgroundColor:["colors.palette.100","colors.palette.700"],radioDisabledIconColor:"colors.transparent",radioCheckedBorderColor:"tokens.accentColor",radioCheckedBackgroundColor:"tokens.backgroundColor",radioCheckedIconColor:"tokens.accentColor",radioCheckedFocusBorderColor:["colors.primary.400","colors.primary.200"],radioCheckedFocusBackgroundColor:"tokens.backgroundColor",radioCheckedFocusIconColor:["colors.primary.400","colors.primary.200"],radioCheckedDisabledBorderColor:["colors.palette.200","colors.palette.500"],radioCheckedDisabledBackgroundColor:["colors.palette.100","colors.palette.700"],radioCheckedDisabledIconColor:"tokens.disabledColor",moveBacklightColor:["colors.palette.800","colors.palette.200"],moveBacklightOpacity:"8%",moveIndicatorColor:"tokens.accentColor",resizeIndicatorColor:["colors.palette.300","colors.palette.400"],hiddenIndicatorColor:["colors.palette.300","colors.palette.400"],menuBorderWidth:"1px",menuBorderRadius:"sizing.size_1",menuHorizontalPadding:"density.menuHorizontal",menuVerticalPadding:"density.menuVertical",menuItemHorizontalPadding:"density.menuItemHorizontal",menuItemVerticalPadding:"density.menuItemVertical",menuBorderColor:"tokens.borderColor",menuShadowX:"tokens.shadowX",menuShadowY:"tokens.shadowY",menuShadowBlur:"tokens.shadowBlur",menuShadowColor:["colors.palette.950","colors.white"],menuShadowOpacity:"8%",menuItemHoverColor:["colors.palette.800","colors.palette.200"],menuItemHoverColorOpacity:"4%",menuItemActiveColor:"tokens.accentColor",menuItemActiveColorOpacity:"8%",commentsTextareaHorizontalPadding:"density.cellHorizontal",commentsTextareaVerticalPadding:"density.cellVertical",commentsTextareaBorderWidth:"1px",commentsTextareaBorderColor:"colors.transparent",commentsTextareaForegroundColor:"tokens.foregroundColor",commentsTextareaBackgroundColor:"tokens.backgroundSecondaryColor",commentsTextareaFocusBorderWidth:"1px",commentsTextareaFocusBorderColor:"tokens.accentColor",commentsTextareaFocusForegroundColor:"tokens.foregroundColor",commentsTextareaFocusBackgroundColor:"tokens.backgroundColor",commentsIndicatorSize:"sizing.size_1_5",commentsIndicatorColor:"tokens.accentColor",licenseHorizontalPadding:"tokens.barHorizontalPadding",licenseVerticalPadding:"tokens.barVerticalPadding",licenseForegroundColor:"tokens.barForegroundColor",licenseBackgroundColor:"tokens.barBackgroundColor",paginationBarForegroundColor:"tokens.barForegroundColor",paginationBarBackgroundColor:"tokens.barBackgroundColor",paginationBarHorizontalPadding:"tokens.barHorizontalPadding",paginationBarVerticalPadding:"tokens.barVerticalPadding",paginationButtonBorderColor:"tokens.paginationBarBackgroundColor",paginationButtonForegroundColor:"tokens.foregroundSecondaryColor",paginationButtonBackgroundColor:"tokens.paginationBarBackgroundColor",paginationButtonHoverBorderColor:["colors.palette.100","colors.palette.700"],paginationButtonHoverForegroundColor:"tokens.foregroundColor",paginationButtonHoverBackgroundColor:["colors.palette.100","colors.palette.700"],paginationButtonDisabledBorderColor:"tokens.paginationBarBackgroundColor",paginationButtonDisabledForegroundColor:"tokens.disabledColor",paginationButtonDisabledBackgroundColor:"tokens.paginationBarBackgroundColor",paginationButtonFocusBorderColor:"tokens.accentColor",paginationButtonFocusForegroundColor:"tokens.foregroundColor",paginationButtonFocusBackgroundColor:"tokens.paginationBarBackgroundColor",dialogSemiTransparentBackgroundColor:["colors.white","colors.palette.950"],dialogSemiTransparentBackgroundOpacity:"80%",dialogSolidBackgroundColor:["colors.white","colors.palette.950"],dialogContentPaddingHorizontal:"density.dialogHorizontal",dialogContentPaddingVertical:"density.dialogVertical",dialogContentBorderRadius:"sizing.size_2",dialogContentBackgroundColor:"tokens.backgroundSecondaryColor",notificationForegroundColor:"tokens.foregroundColor",notificationBackgroundColor:"tokens.backgroundColor",notificationBorderColor:"tokens.backgroundColor",notificationSuccessAccent:"#37bc6cff",notificationWarningAccent:"#fbe952ff",notificationErrorAccent:"#fa4d32ff",chipBackground:"tokens.backgroundSecondaryColor",chipBorderRadius:"sizing.size_0_5",chipVerticalPadding:"sizing.size_0",chipHorizontalPadding:"sizing.size_0_5",chipGap:"sizing.size_1",scrollbarBorderRadius:"sizing.size_2",scrollbarTrackColor:"tokens.backgroundSecondaryColor",scrollbarThumbColor:["colors.palette.300","colors.palette.400"]}},ce=null;function ct(e){if(0===e.length)return[];let t=[...e];return t.sort((e,t)=>{let[r]=e,[n]=t;return r===n?0:r>n?1:-1}),X(t,(e,t)=>{let[r,n]=t,o=e[e.length-1],[i,s]=o,a=i+s;if(r<=a){let e=Math.max(n-(a-r),0);o[1]+=e}else e.push([r,n]);return e},[t[0]])}let cr=new Map,cn=[{name:"persistentState",version:"17.0.0",migrationUrl:"https://handsontable.com/docs/javascript-data-grid/changelog-17/"},{name:"correctFormat",version:"18.0.0",migrationUrl:"https://handsontable.com/docs/javascript-data-grid/migration-from-17.1-to-18.0/"}];function co(e,t,r,n,o,i,s){let a=s.ariaTags,l=[],h=[],d=[],u=[];s._isBaseRendererCalled=!0,s.className&&rd(t,s.className),s.readOnly?(l.push(s.readOnlyCellClassName),a&&u.push(z())):a&&d.push(z()[0]),!1===s.valid&&s.invalidCellClassName?(l.push(s.invalidCellClassName),a&&u.push(W())):(h.push(s.invalidCellClassName),a&&d.push(W()[0])),!1===s.wordWrap&&s.noWordWrapClassName&&l.push(s.noWordWrapClassName),eP(i)&&s.placeholder&&l.push(s.placeholderCellClassName),s.textEllipsis&&l.push("htTextEllipsis"),ru(t,h),rd(t,l),rg(t,d),rc(t,u)}function ci(e,t,r){e.addEventListener(t,r,!1)}function cs(e,t,r){e.removeEventListener(t,r,!1)}function ca(e){return e.ownerDocument.defaultView.getComputedStyle(e)}function cl(e){let t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={minHeight:200,maxHeight:300,minWidth:100,maxWidth:300,textContent:e=>e.value,...r},o=e.body,i=e.createTextNode(""),s=e.createElement("span");function a(){i.textContent=n.textContent(t),s.style.position="absolute",s.style.fontSize=ca(t).fontSize,s.style.fontFamily=ca(t).fontFamily,s.style.whiteSpace="pre",o.appendChild(s);let e=Number.parseInt(ca(t)?.paddingInlineStart||"0",10),r=Number.parseInt(ca(t)?.paddingInlineEnd||"0",10),a=s.clientWidth+e+r+1;o.removeChild(s);let l=t.style;l.height=`${n.minHeight}px`,n.minWidth>a?l.width=`${n.minWidth}px`:a>n.maxWidth?l.width=`${n.maxWidth}px`:l.width=`${a}px`;let h=t.scrollHeight?t.scrollHeight-1:0;n.minHeight>h?l.height=`${n.minHeight}px`:n.maxHeight<h?(l.height=`${n.maxHeight}px`,l.overflowY="visible"):l.height=`${h}px`}function l(){e.defaultView.setTimeout(a,0)}function h(e,t){if("inherit"===e)return t;let r=Number.parseInt(String(e),10);if(!isNaN(r))return r}return{init:function(e,r){let o=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t=e;if(r&&r.minHeight){let e=h(r.minHeight,t.clientHeight);void 0!==e&&(n.minHeight=e)}if(r&&r.maxHeight){let e=h(r.maxHeight,t.clientHeight);void 0!==e&&(n.maxHeight=e)}if(r&&r.minWidth){let e=h(r.minWidth,t.clientWidth);void 0!==e&&(n.minWidth=e)}if(r&&r.maxWidth){let e=h(r.maxWidth,t.clientWidth);void 0!==e&&(n.maxWidth=e)}s.firstChild||(s.className="autoResize",s.style.display="inline-block",s.appendChild(i)),"TEXTAREA"===t.nodeName&&(t.style.resize="none",t.style.height=`${n.minHeight}px`,t.style.minWidth=`${n.minWidth}px`,t.style.maxWidth=`${n.maxWidth}px`,t.style.overflowY="hidden"),o&&(ci(t,"input",a),ci(t,"keydown",l)),a()},resize:a,unObserve(){cs(t,"input",a),cs(t,"keydown",l)}}}function ch(e,t){let r=rG(t),n=t.value.split("\n"),o=r,i=0;for(let t=0;t<n.length;t++){let s=n[t];0!==t&&(i+=n[t-1].length+1);let a=i+s.length;if("home"===e?o=i:"end"===e&&(o=a),r<=a)break}rq(t,o,o)}co.RENDERER_TYPE="base";let cd="ht_editor_hidden",cu="textEditor";class cc extends n3{static get EDITOR_TYPE(){return"text"}eventManager=new n5(this);autoResize=cl(this.hot.rootDocument);constructor(e){super(e),this.eventManager=new n5(this),this.createElements(),this.bindEvents(),this.hot.addHookOnce("afterDestroy",()=>this.destroy())}getValue(){return this.TEXTAREA.value}setValue(e){this.TEXTAREA.value=e}open(){this._opened=!0,this.refreshDimensions(),this.showEditableElement(),this.hot.getShortcutManager().setActiveContextName("editor"),this.registerShortcuts()}close(){this._opened=!1,this.autoResize.unObserve(),t5(ni(this.hot.rootDocument),this.hot.rootElement)&&this.hot.listen(),this.hideEditableElement(),this.unregisterShortcuts()}prepare(e,t,r,n,o,i){let s=this.state;if(super.prepare(e,t,r,n,o,i),!i.readOnly){this.refreshDimensions(!0);let{allowInvalid:e}=i;e&&!this.isOpened()&&(this.TEXTAREA.value=""),s===n2.FINISHED||this.isOpened()||this.hideEditableElement()}}beginEditing(e,t){this.state===n2.VIRGIN&&(this.TEXTAREA.value="",super.beginEditing(e,t))}focus(){this.TEXTAREA.select(),rq(this.TEXTAREA,this.TEXTAREA.value.length,this.TEXTAREA.value.length)}createElements(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"textarea",{rootDocument:t}=this.hot;this.TEXTAREA=t.createElement(e),rc(this.TEXTAREA,[["data-hot-input",""],v(-1)]),rd(this.TEXTAREA,"handsontableInput"),this.textareaStyle=this.TEXTAREA.style,this.textareaStyle.width="0",this.textareaStyle.height="0",this.textareaStyle.overflowY="visible",this.TEXTAREA_PARENT=t.createElement("DIV"),rd(this.TEXTAREA_PARENT,"handsontableInputHolder"),rh(this.TEXTAREA_PARENT,this.layerClass)&&ru(this.TEXTAREA_PARENT,this.layerClass),rd(this.TEXTAREA_PARENT,cd),this.textareaParentStyle=this.TEXTAREA_PARENT.style,this.TEXTAREA_PARENT.appendChild(this.TEXTAREA),this.hot.rootElement.appendChild(this.TEXTAREA_PARENT)}hideEditableElement(){tU()&&(this.textareaStyle.textIndent="-99999px"),this.textareaStyle.overflowY="visible",this.textareaParentStyle.opacity="0",this.textareaParentStyle.height="1px",ru(this.TEXTAREA_PARENT,this.layerClass),rd(this.TEXTAREA_PARENT,cd)}showEditableElement(){this.textareaParentStyle.height="",this.textareaParentStyle.overflow="",this.textareaParentStyle.position="",this.textareaParentStyle[this.hot.isRtl()?"left":"right"]="auto",this.textareaParentStyle.opacity="1",this.textareaStyle.textIndent="";let e=this.TEXTAREA_PARENT.childNodes,t=!1;oA(e.length-1,r=>{if(rh(e[r],"handsontableEditor"))return t=!0,!1}),rh(this.TEXTAREA_PARENT,cd)&&ru(this.TEXTAREA_PARENT,cd),t?this.layerClass="ht_editor_visible":this.layerClass=this.getEditedCellsLayerClass(),rd(this.TEXTAREA_PARENT,this.layerClass)}refreshValue(){let e=this.hot.toPhysicalRow(this.row),t=this.hot.getSourceDataAtCell(e,this.col);this.originalValue=t,this.setValue(t),this.refreshDimensions()}refreshDimensions(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.state!==n2.EDITING&&!e)return;if(this.TD=this.getEditedCell(),!this.TD){e||this.close();return}let t=this.getEditedCellRect();if(!t)return;let{top:r,start:n,width:o,maxWidth:i,height:s,maxHeight:a}=t;this.textareaParentStyle.top=`${r}px`,this.textareaParentStyle[this.hot.isRtl()?"right":"left"]=`${n}px`,this.showEditableElement();let l=this.hot.rootWindow.getComputedStyle(this.TD);this.TEXTAREA.style.fontSize=l.fontSize,this.TEXTAREA.style.fontFamily=l.fontFamily,this.TEXTAREA.style.backgroundColor=this.TD.style.backgroundColor,this.autoResize.init(this.TEXTAREA,{minWidth:Math.min(o,i),minHeight:Math.min(s,a),maxWidth:i,maxHeight:a},!0)}bindEvents(){tG()&&this.eventManager.addEventListener(this.TEXTAREA,"focusout",()=>this.finishEditing(!1)),this.addHook("afterScrollHorizontally",()=>this.refreshDimensions()),this.addHook("afterScrollVertically",()=>this.refreshDimensions()),this.addHook("afterColumnResize",()=>{this.refreshDimensions(),this.state===n2.EDITING&&this.focus()}),this.addHook("afterRowResize",()=>{this.refreshDimensions(),this.state===n2.EDITING&&this.focus()})}destroy(){this.eventManager.destroy(),this.clearHooks()}registerShortcuts(){let e=this.hot.getShortcutManager().getContext("editor"),t=()=>{this.hot.rootDocument.execCommand("insertText",!1,"\n")};e.addShortcuts([{keys:[["Control","Enter"]],callback:()=>(t(),!1),runOnlyIf:e=>!this.hot.selection.isMultiple()&&!e?.altKey},{keys:[["Meta","Enter"]],callback:()=>(t(),!1),runOnlyIf:()=>!this.hot.selection.isMultiple()},{keys:[["Alt","Enter"]],callback:()=>(t(),!1)},{keys:[["Home"]],callback:(e,t)=>{ch(t?.[0]??"",this.TEXTAREA)}},{keys:[["End"]],callback:(e,t)=>{ch(t?.[0]??"",this.TEXTAREA)}}],{runOnlyIf:()=>e_(this.hot.getSelected()),group:cu})}unregisterShortcuts(){this.hot.getShortcutManager().getContext("editor").removeShortcutsByGroup(cu)}}function cg(e,t,r,n,o,i,s){let a=i;eP(a)&&s.placeholder&&(a=s.placeholder);let l=eH(a),h=l;s.trimWhitespace&&(h=l.trim()),rS(t,h)}cg.RENDERER_TYPE="text";let cp={CELL_TYPE:"text",editor:cc,renderer:cg},cm=function(e,t){var r,n,o;let i,s,a,l,h,d,u,c=arguments.length>2&&void 0!==arguments[2]&&arguments[2],g=this,p=new n5(g),m=!0,f=!1,b=null,C={...t.initialState,...t};c===s7&&s9.set(this,!0),this.rootContainer=e,this.rootWrapperElement=null,this.rootGridElement=null,this.rootGridContentElement=null,this.rootSlotTopElement=null,this.rootSlotBottomElement=null,this.rootOverlaysElement=null,this.rootPortalElement=null,this.rootElement=s8(this)?e.ownerDocument.createElement("div"):e,this.rootDocument=e.ownerDocument,this.rootWindow=this.rootDocument.defaultView,s8(this)&&(this.rootWrapperElement=this.rootDocument.createElement("div"),this.rootSlotTopElement=this.rootDocument.createElement("div"),this.rootGridElement=this.rootDocument.createElement("div"),this.rootGridContentElement=this.rootDocument.createElement("div"),this.rootOverlaysElement=this.rootDocument.createElement("div"),this.rootSlotBottomElement=this.rootDocument.createElement("div"),this.rootPortalElement=this.rootDocument.createElement("div"),rd(this.rootElement,["ht-wrapper","handsontable"]),rd(this.rootWrapperElement,"ht-root-wrapper"),nn(this.rootContainer.getRootNode())&&rd(this.rootWrapperElement,"ht-shadow-dom"),rd(this.rootSlotTopElement,"ht-slot-top"),rd(this.rootGridElement,"ht-grid"),rd(this.rootGridContentElement,"ht-grid-content"),rd(this.rootOverlaysElement,"ht-overlay"),rd(this.rootSlotBottomElement,"ht-slot-bottom"),this.rootGridContentElement.appendChild(this.rootElement),this.rootGridElement.appendChild(this.rootGridContentElement),this.rootWrapperElement.appendChild(this.rootSlotTopElement),this.rootWrapperElement.appendChild(this.rootGridElement),this.rootWrapperElement.appendChild(this.rootSlotBottomElement),this.rootWrapperElement.appendChild(this.rootOverlaysElement),this.rootContainer.appendChild(this.rootWrapperElement),this.rootWrapperElement.__hotInstance=this,rd(this.rootPortalElement,"ht-portal"),this.rootDocument.body.appendChild(this.rootPortalElement)),this.isDestroyed=!1,this.renderSuspendedCounter=0,this.executionSuspendedCounter=0;let y=C?.layoutDirection??"inherit",w=["rtl","ltr"].includes(y)?y:this.rootWindow.getComputedStyle(this.rootElement).direction;this.rootElement.setAttribute("dir",w),this.rootWrapperElement?.setAttribute("dir",w),this.isRtl=function(){return"rtl"===w},this.isLtr=function(){return!g.isRtl()},this.getDirectionFactor=function(){return g.isLtr()?1:-1},this.stylesHandler=new un({hot:g,rootElement:g.rootElement,rootDocument:g.rootDocument,onThemeChange:e=>{s8(this)&&(ru(this.rootWrapperElement,/ht-theme-.*/g),ru(this.rootPortalElement,/ht-theme-.*/g),e&&(rd(this.rootWrapperElement,e),rd(this.rootPortalElement,e),getComputedStyle(this.rootWrapperElement).getPropertyValue("--ht-line-height")||tQ(`The "${e}" theme is enabled, but its stylesheets are missing or not imported correctly. Import the correct CSS files in order to use that theme.`)),this.view?._wt?.selectionManager?.refreshAllBorderHandleStyles())},injectCoreCss:"boolean"!=typeof t?.injectCoreCss||t.injectCoreCss}),this.themeManager=null,hV(i=aF(o=C.language))||(i=hD,aB(o)),C.language=i;let S=Object.fromEntries(Object.entries(C).filter(e=>{let[t]=e;return!(nF.getSingleton().isRegistered(t)||nF.getSingleton().isDeprecated(t))})),v=new dS(g,S,[dv,dR]),R=v.getTableMeta(),E=v.getGlobalMeta(),T=oF();this.container=this.rootDocument.createElement("div"),this.rootElement.insertBefore(this.container,this.rootElement.firstChild),this.guid=`ht_${oh()}`,cr.set(this.guid,this),this.columnIndexMapper=new aD,this.rowIndexMapper=new aD,this.columnIndexMapper.addLocalHook("indexesSequenceChange",e=>{g.runHooks("afterColumnSequenceChange",e)}),this.rowIndexMapper.addLocalHook("indexesSequenceChange",e=>{g.runHooks("afterRowSequenceChange",e)}),p.addEventListener(this.rootDocument.documentElement,"compositionstart",e=>{g.runHooks("beforeCompositionStart",e)}),a=new dE(g);let A=nU(this.guid);A.register("cellRangeMapper",new d_({rowIndexMapper:this.rowIndexMapper,columnIndexMapper:this.columnIndexMapper})),this.rootElement.id&&"ht_"!==this.rootElement.id.substring(0,3)||(this.rootElement.id=this.guid);let M=new dn(R,{rowIndexMapper:g.rowIndexMapper,columnIndexMapper:g.columnIndexMapper,countCols:()=>g.countCols(),countRows:()=>g.countRows(),propToCol:e=>s.propToCol(e),isEditorOpened:()=>{let e=g.getActiveEditor();return!!e&&e.isOpened()},isPluginEnabled:e=>g.getPlugin(e)?.enabled===!0,countRenderableColumns:()=>g.view.countRenderableColumns(),countRenderableRows:()=>g.view.countRenderableRows(),countRowHeaders:()=>g.countRowHeaders(),countColHeaders:()=>g.countColHeaders(),countRenderableRowsInRange:(e,t)=>g.view.countRenderableRowsInRange(e,t),countRenderableColumnsInRange:(e,t)=>g.view.countRenderableColumnsInRange(e,t),getShortcutManager:()=>g.getShortcutManager(),createCellCoords:(e,t)=>g._createCellCoords(e,t),createCellRange:(e,t,r)=>g._createCellRange(e,t,r),visualToRenderableCoords:e=>{let{row:t,col:r}=e;return g._createCellCoords(t>=0?g.rowIndexMapper.getRenderableFromVisualIndex(t):t,r>=0?g.columnIndexMapper.getRenderableFromVisualIndex(r):r)},renderableToVisualCoords:e=>{let{row:t,col:r}=e;return g._createCellCoords(t>=0?g.rowIndexMapper.getVisualFromRenderableIndex(t):t,r>=0?g.columnIndexMapper.getVisualFromRenderableIndex(r):r)},findFirstNonHiddenRenderableRow:(e,t)=>{let r=t>e?1:-1,n=Math.min(e,t),o=Math.max(e,t),i=g.rowIndexMapper.getNearestNotHiddenIndex(e,r);return null===i||1===r&&i>o||-1===r&&i<n?null:i>=0?g.rowIndexMapper.getRenderableFromVisualIndex(i):i},findFirstNonHiddenRenderableColumn:(e,t)=>{let r=t>e?1:-1,n=Math.min(e,t),o=Math.max(e,t),i=g.columnIndexMapper.getNearestNotHiddenIndex(e,r);return null===i||1===r&&i>o||-1===r&&i<n?null:i>=0?g.columnIndexMapper.getRenderableFromVisualIndex(i):i},isDisabledCellSelection:(e,t)=>e<0||t<0?g.getSettings().disableVisualSelection:g.getCellMeta(e,t).disableVisualSelection});this.selection=M;let I=e=>{let{hiddenIndexesChanged:t}=e;this.forceFullRender=!0,t&&this.selection.commit()};function x(e,t){let r="className"===e?g.rootElement:g.table;if(m)void 0!==t&&rd(r,t);else{let n=[],o=[];if(E[e]){let t=E[e];n=Array.isArray(t)?t:ed(String(t))}t&&(o=Array.isArray(t)?t:ed(t));let i=ea(n,o),s=ea(o,n);i.length&&ru(r,i),s.length&&rd(r,s)}E[e]=t}function N(e){let t={};return ty(e,"colorScheme")&&(t.colorScheme=e.colorScheme),ty(e,"density")&&(t.density=e.density),t}function O(){return{colorScheme:R.colorScheme,density:R.density}}function k(e,t){let r;(g.themeManager?.destroy(),void 0===e)?(r=uQ("main")?u3("main"):u9(u8),r=u3("main")):r="function"!=typeof e.getThemeConfig?u9(e):e,g.themeManager=function(e){let{hot:t,themeObject:r,overrides:n}=e;return new u$({hot:t,themeObject:r,overrides:n})}({hot:g,themeObject:r,overrides:t})}function H(){let e=!1;return{validatorsInQueue:0,valid:!0,addValidatorToQueue(){this.validatorsInQueue+=1,e=!1},removeValidatorFormQueue(){this.validatorsInQueue=this.validatorsInQueue-1<0?0:this.validatorsInQueue-1,this.checkIfQueueIsEmpty()},onQueueEmpty(e){},checkIfQueueIsEmpty(){0===this.validatorsInQueue&&!1===e&&(e=!0,this.onQueueEmpty(this.valid))}}}function _(e,t){return!!t?.isOpened()&&ac(e,t.row,t.prop)}function L(e,t,r){if(!e.length)return void r();let n=g.getActiveEditor(),o=H(),i=!0,a=t=>{let[r,n,,o]=t,i=e.findIndex(e=>{let[t,o]=e;return t===r&&o===n});-1!==i&&(e[i][3]=o)},l=(e,t)=>{"string"==typeof t&&t.endsWith("Validator")&&e?.forEach(a)};g.addHook("afterChange",l),o.onQueueEmpty=()=>{g.removeHook("afterChange",l),n&&i&&n._closeAfterDataChange&&_(e,n)&&n.cancelChanges(),r()};for(let r=e.length-1;r>=0;r--){let n,[a,l,,h]=e[r],d=s.propToCol(l);Number.isInteger(d)?(n=g.getCellMetaTransient(a,d),g.getCellValidator(n)&&(n=g.getCellMeta(a,d))):n={...Object.getPrototypeOf(R),...R},g.getCellValidator(n)&&(o.addValidatorToQueue(),g.validateCell(h,n,function(t,r){return function(n){"boolean"!=typeof n&&tr("Validation error: result is not boolean"),!1===n&&!1===r.allowInvalid&&(i=!1,e.splice(t,1),r.valid=!0),o.removeValidatorFormQueue()}}(r,n),t))}o.checkIfQueueIsEmpty()}function P(e,t){for(let t=e.length-1;t>=0;t--){let r=!1;if(null===e[t]){e.splice(t,1);continue}if(null!==e[t][2]&&void 0!==e[t][2]||null!==e[t][3]&&void 0!==e[t][3]){if(R.allowInsertRow)for(;e[t][0]>g.countRows()-1;){let n=e[t][0]-(g.countRows()-1),{delta:o}=s.createRow(void 0,n,{source:"auto"});if(0===o){r=!0;break}}if("array"===g.dataType&&(!R.columns||0===R.columns.length)&&R.allowInsertColumn)for(;Number(s.propToCol(e[t][1]))>g.countCols()-1;){let n=Number(s.propToCol(e[t][1]))-(g.countCols()-1),{delta:o}=s.createCol(void 0,n,{source:"auto"});if(0===o){r=!0;break}}r||s.set(e[t][0],e[t][1],e[t][3])}}let r=e.length>0,n=h.getActiveEditor(),o=n?._closeAfterDataChange,i=_(e,n);r?(l.adjustRowsAndCols(),g.runHooks("beforeChangeRender",e,t),n?.isOpened()&&o&&i&&h.closeEditor(),g.view.adjustElementsSize(),g.render(),(n?.isOpened()&&o&&i||!n?.isOpened())&&h.prepareEditor(),g.runHooks("afterChange",e,t||"edit"),n&&void 0!==n.refreshValue&&(!n.isOpened()||i)&&n.refreshValue()):g.render()}function D(e,t,r){return Array.isArray(e)?e:[[e,t,r]]}function F(e,t){let r=g.runHooks("beforeChange",e,t||"edit"),n=e.filter(e=>null!==e);if(!1===r||0===n.length)return g.getActiveEditor()?.cancelChanges(),[];for(let e=n.length-1;e>=0;e--){let t,[r,o,,i]=n[e],a=s.propToCol(o);t=Number.isInteger(a)?g.getCellMetaTransient(r,a):{...Object.getPrototypeOf(R),...R},n[e][3]=n0(i,t)}return n}this.columnIndexMapper.addLocalHook("cacheUpdated",e=>{I(e),this.runHooks("afterColumnSequenceCacheUpdate",e)}),this.rowIndexMapper.addLocalHook("cacheUpdated",e=>{I(e),this.runHooks("afterRowSequenceCacheUpdate",e)}),this.selection.addLocalHook("afterSetRangeEnd",(e,t)=>{let r=tC(!1),n=this.selection.getSelectedRange(),{from:o,to:i}=n.current(),s=n.size()-1;this.runHooks("afterSelection",o.row,o.col,i.row,i.col,r,s),this.runHooks("afterSelectionByProp",o.row,g.colToProp(o.col),i.row,g.colToProp(i.col),r,s);let a=M.getSelectionSource();t&&!["loadData","updateData","deselect","shift"].includes(a)&&(!r.isTouched()||r.isTouched()&&!r.value)&&u.scrollTo(e);let l=M.isSelectedByRowHeader(),d=M.isSelectedByColumnHeader();l&&d?rd(this.rootElement,["ht__selection--rows","ht__selection--columns"]):l?(ru(this.rootElement,"ht__selection--columns"),rd(this.rootElement,"ht__selection--rows")):d?(ru(this.rootElement,"ht__selection--rows"),rd(this.rootElement,"ht__selection--columns")):ru(this.rootElement,["ht__selection--rows","ht__selection--columns"]),["shift","refresh","loadData","updateData","deselect"].includes(a)||h.closeEditor(),["refresh","loadData","updateData","deselect"].includes(a)||(g.view.render(),h.prepareEditor())}),this.selection.addLocalHook("beforeSetFocus",e=>{this.runHooks("beforeSelectionFocusSet",e.row,e.col)}),this.selection.addLocalHook("afterSetFocus",e=>{let t=tC(!1);this.runHooks("afterSelectionFocusSet",e.row,e.col,t),(!t.isTouched()||t.isTouched()&&!t.value)&&u.scrollTo(e),h.closeEditor(),g.view.render(),h.prepareEditor()}),this.selection.addLocalHook("afterSelectionFinished",e=>{let t=e.length-1,{from:r,to:n}=e[t];this.runHooks("afterSelectionEnd",r.row,r.col,n.row,n.col,t),this.runHooks("afterSelectionEndByProp",r.row,g.colToProp(r.col),n.row,g.colToProp(n.col),t),["refresh","deselect"].includes(M.getSelectionSource())&&(g.view.render(),h.prepareEditor())}),this.selection.addLocalHook("afterIsMultipleSelection",e=>{let t=this.runHooks("afterIsMultipleSelection",e.value);e.value&&(e.value=t)}),this.selection.addLocalHook("afterDeselect",()=>{h.closeEditor(),g.view.render(),ru(this.rootElement,["ht__selection--rows","ht__selection--columns"]),this.runHooks("afterDeselect")}),this.selection.addLocalHook("beforeHighlightSet",()=>g.runHooks("beforeSelectionHighlightSet")).addLocalHook("beforeSetRangeStart",function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return g.runHooks("beforeSetRangeStart",...t)}).addLocalHook("beforeSetRangeStartOnly",function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return g.runHooks("beforeSetRangeStartOnly",...t)}).addLocalHook("beforeSetRangeEnd",function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return g.runHooks("beforeSetRangeEnd",...t)}).addLocalHook("beforeSelectColumns",function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return g.runHooks("beforeSelectColumns",...t)}).addLocalHook("afterSelectColumns",function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return g.runHooks("afterSelectColumns",...t)}).addLocalHook("beforeSelectRows",function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return g.runHooks("beforeSelectRows",...t)}).addLocalHook("afterSelectRows",function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return g.runHooks("afterSelectRows",...t)}).addLocalHook("beforeSelectAll",function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return g.runHooks("beforeSelectAll",...t)}).addLocalHook("afterSelectAll",function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return g.runHooks("afterSelectAll",...t)}).addLocalHook("beforeModifyTransformStart",function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return g.runHooks("modifyTransformStart",...t)}).addLocalHook("afterModifyTransformStart",function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return g.runHooks("afterModifyTransformStart",...t)}).addLocalHook("beforeModifyTransformFocus",function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return g.runHooks("modifyTransformFocus",...t)}).addLocalHook("afterModifyTransformFocus",function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return g.runHooks("afterModifyTransformFocus",...t)}).addLocalHook("beforeModifyTransformEnd",function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return g.runHooks("modifyTransformEnd",...t)}).addLocalHook("afterModifyTransformEnd",function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return g.runHooks("afterModifyTransformEnd",...t)}).addLocalHook("beforeRowWrap",function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return g.runHooks("beforeRowWrap",...t)}).addLocalHook("beforeColumnWrap",function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return g.runHooks("beforeColumnWrap",...t)}).addLocalHook("insertRowRequire",e=>g.alter("insert_row_above",e,1,"auto")).addLocalHook("insertColRequire",e=>g.alter("insert_col_start",e,1,"auto")),l={alter(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0;if(!1!==g.runHooks("beforeAlter",e,t,r,n,o)){var i,a;switch(e){case"insert_row_below":case"insert_row_above":let d=g.countSourceRows();if(R.maxRows===d)return;let u="insert_row_below"===e?"below":"above",c="number"==typeof t?t:"below"===u?d:0,{delta:p,startPhysicalIndex:m}=s.createRow(c,r,{source:n,mode:u});M.shiftRows(g.toVisualRow(m),p);break;case"insert_col_start":case"insert_col_end":let f="insert_col_end"===e?"end":"start",b="end"===f?g.countSourceCols():0,C="number"==typeof t?t:b,{delta:y,startPhysicalIndex:w}=s.createCol(C,r,{source:n,mode:f});if(y){if(Array.isArray(R.colHeaders)){let e=[g.toVisualColumn(w),0];e.length+=y,Array.prototype.splice.apply(R.colHeaders,e)}M.shiftColumns(g.toVisualColumn(w),y)}break;case"remove_row":let S;i=Array.isArray(t)?ct(t):[[t,r]],S=0,J(i,e=>{let[t,r]=e,o=eP(t)?g.countRows()-1:Math.max(t-S,0);Number.isInteger(t)&&(t=Math.max(t-S,0));let i=g.countRows();if(!s.removeRow(t,r,n))return;if(M.isSelected()){let{row:e}=g.getSelectedRangeActive().highlight;e>=t&&e<=t+r-1&&h.closeEditor(!0)}let a=g.countRows(),l=R.fixedRowsTop;l>=o+1&&(R.fixedRowsTop-=Math.min(r,l-o));let d=R.fixedRowsBottom;if(d){let e=i-a,r=Number.isInteger(t)?o:Math.max(i-e,0),n=Math.min(r+e-1,i-1)-Math.max(r,i-d)+1;n>0&&(R.fixedRowsBottom-=Math.min(n,d))}if(0===a)M.deselect();else if("ContextMenu.removeRow"===n){let e=M.getSelectedRange(),t=e.pop();e.clear().set(t.from).current().setTo(t.to),M.refresh()}else M.shiftRows(t,-r);S+=r});break;case"remove_col":let v;a=Array.isArray(t)?ct(t):[[t,r]],v=0,J(a,e=>{let[t,r]=e,o=eP(t)?g.countCols()-1:Math.max(t-v,0),i=g.toPhysicalColumn(o);if(Number.isInteger(t)&&(t=Math.max(t-v,0)),!s.removeCol(t,r,n))return;if(M.isSelected()){let{col:e}=g.getSelectedRangeActive().highlight;e>=t&&e<=t+r-1&&h.closeEditor(!0)}if(0===g.countCols())M.deselect();else if("ContextMenu.removeColumn"===n){let e=M.getSelectedRange(),t=e.pop();e.clear().set(t.from).current().setTo(t.to),M.refresh()}else M.shiftColumns(t,-r);let a=R.fixedColumnsStart;a>=o+1&&(R._fixedColumnsStart-=Math.min(r,a-o)),Array.isArray(R.colHeaders)&&(void 0===i&&(i=-1),R.colHeaders.splice(i,r)),v+=r});break;default:tr(`There is no such action "${e}"`)}o||l.adjustRowsAndCols(),g.view.adjustElementsSize(),g.view.render()}},adjustRowsAndCols(){let e=R.minRows,t=R.minSpareRows,r=R.minCols,n=R.minSpareCols;if(e){let t=g.countRows();t<e&&s.createRow(t,e-t,{source:"auto"})}if(t){let e=g.countEmptyRows(!0);if(e<t){let r=Math.min(t-e,R.maxRows-g.countSourceRows());s.createRow(g.countRows(),r,{source:"auto"})}}{let e=0,t=n>0&&!R.columns&&"array"===g.dataType;if(t)for(let t=g.countCols()-1;t>=0&&g.isEmptyCol(t)&&!((e+=1)>=n);t--);let o=g.countCols();if(r&&!R.columns&&o<r){let t=r-o;e+=t,s.createCol(o,t,{source:"auto"})}if(t&&e<n){o=g.countCols();let t=Math.min(n-e,R.maxCols-o);s.createCol(o,t,{source:"auto"})}}},populateFromArray(e,t,r,n,o){let i,s,a,l,h,d=[],u={},c=[],p=e.row,m=e.col;if(0===(s=t.length))return!1;let f=0,b=0;switch(tc(r)&&(f=r.col-m+1,b=r.row-p+1),o){case"shift_down":let C=K(t),y=C.length,w=Math.max(y,f),S=g.getData().slice(p),v=K(S).slice(m,m+w);for(a=0;a<w;a+=1)if(a<y){for(i=0,s=C[a].length;i<b-s;i+=1)C[a].push(C[a][i%s]);a<v.length?c.push(C[a].concat(v[a])):c.push(C[a].concat(Array(S.length).fill(null)))}else c.push(C[a%y].concat(v[a]));g.populateFromArray(p,m,K(c));break;case"shift_right":let E=t.length,T=Math.max(E,b),A=g.getData().slice(p).map(e=>e.slice(m));for(i=0;i<T;i+=1)if(i<E){for(a=0,l=t[i].length;a<f-l;a+=1)t[i].push(t[i][a%l]);if(i<A.length)for(let e=0;e<A[i].length;e+=1)t[i].push(A[i][e]);else t[i].push(...Array(A[0].length).fill(null))}else t.push(t[i%s].slice(0,T).concat(A[i]));g.populateFromArray(p,m,t);break;default:u.row=e.row,u.col=e.col;let M=0,I=0,x=!0,N="Autofill.fill"===n||"autofill.fill"===n,O=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=t[e%t.length];return null!==r?n[r%n.length]:n},k=t.length,H=r?r.row-e.row+1:0;for(i=0,s=r?H:Math.max(k,H);i<s&&!(r&&u.row>r.row&&H>k||!R.allowInsertRow&&u.row>g.countRows()-1)&&!(u.row>=R.maxRows);i++){let t=i-M,o=N?i:t,c=O(o).length,p=r?r.col-e.col+1:0;if(l=r?p:Math.max(c,p),u.col=e.col,h=g.getCellMetaTransient(u.row,u.col),("CopyPaste.paste"===n||"Autofill.fill"===n||"autofill.fill"===n)&&h.skipRowOnPaste){M+=1,u.row+=1,"CopyPaste.paste"===n&&(s+=1);continue}for(a=0,I=0;a<l&&!(r&&u.col>r.col&&p>c||!R.allowInsertColumn&&u.col>g.countCols()-1)&&!(u.col>=R.maxCols);a++){if(h=g.getCellMetaTransient(u.row,u.col),("CopyPaste.paste"===n||"Autofill.fill"===n||"autofill.fill"===n)&&h.skipColumnOnPaste){I+=1,u.col+=1,"CopyPaste.paste"===n&&(l+=1);continue}if(h.readOnly&&"UndoRedo.undo"!==n){u.col+=1;continue}let e=a-I,t=N?a:e,r=!!h.valueSetter,i=O(o,t),s=g.getSourceDataAtCell(u.row,u.col)??null;if(null!==i&&"object"==typeof i)if(Array.isArray(i)&&null===s&&(s=[]),r||"object"==typeof s&&null!==s){if(null!==s){let e=tn(Array.isArray(s)?s:s[0]||s),t=tn(Array.isArray(i)?i:i[0]||i);r||"edit"===n||td(e,t)||Array.isArray(e)&&Array.isArray(t)?i=ta(i):x=!1}}else x=!1,h.parsePastedValue&&"CopyPaste.paste"===n&&(x=!0),"edit"===n&&(x=!0,i=ta(i));else r||null===s||"object"!=typeof s||(x=!1);x&&d.push([u.row,u.col,i]),x=!0,u.col+=1}u.row+=1}g.setDataAtCell(d,null,null,n||"populateFromArray")}}},this.init=function(){let e=R.theme,t=R.themeName,r=ut(g.rootContainer);if(s8(g)&&!r&&(tc(e)||!e&&!t)&&k(e,O()),a.setData(R.data),g.runHooks("beforeInit"),(tW()||t$())&&rd(g.rootElement,"mobile"),this.updateSettings(C,!0),this.view=new an(this),h=n4.getInstance(g,R,M),u=function(e){let{selection:t}=e,r=!1,n=!1;return{resume(){n=!1},suspend(){n=!0},skipNextScrollCycle(){r=!0},scrollTo(o){let i;if(r||n){r=!1;return}t.isFocusSelectionChanged()?i=t=>{e.scrollViewportTo(t.toObject(),()=>{let t=e.getSelectedRangeActive();if(!t)return;let{row:r,col:n}=t.highlight;null!==r&&null!==n&&dL(e.getCell(r,n,!0))})}:t.isSelectedByCorner()?i=()=>{}:t.isSelectedByRowHeader()?i=t=>{let r=dP(e).getComputedRowTarget(t);e.scrollViewportTo({row:r},()=>{let t=!!e.getSettings().rowHeaders;dL(e.getCell(r,t?-1:0,!0))})}:t.isSelectedByColumnHeader()?i=t=>{let r=dP(e).getComputedColumnTarget(t);e.scrollViewportTo({col:r},()=>{let t=!!e.getSettings().colHeaders;dL(e.getCell(t?-1:0,r,!0))})}:1===t.getSelectedRange().size()&&t.isMultiple()?i=t=>{let r=dP(e),n={row:r.getComputedRowTarget(t),col:r.getComputedColumnTarget(t)};e.scrollViewportTo(n,()=>{let{row:t,col:r}=n;dL(e.getCell(t,r,!0))})}:1!==t.getSelectedRange().size()||t.isMultiple()?t.getSelectedRange().size()>1&&(i=t=>{let r=dP(e),n={row:r.getComputedRowTarget(t),col:r.getComputedColumnTarget(t)};e.scrollViewportTo(n,()=>{let{row:t,col:r}=n;dL(e.getCell(t,r,!0))})}):i=t=>{let r=e.selection.getSelectionSource(),{row:n,col:o}=t,i=()=>{dL(e.getCell(n,o,!0))};if(n<0&&o>=0)e.scrollViewportTo({col:o},i);else if(o<0&&n>=0)e.scrollViewportTo({row:n},i);else{if("mouse"===r&&(o===e.view.getLastPartiallyVisibleColumn()||n===e.view.getLastPartiallyVisibleRow()))return;e.scrollViewportTo({row:n,col:o},i)}},i?.(o)}}}(g),d.init(),s8(this)){var n,o=g.rootPortalElement;let e=o.ownerDocument;if(!uo){(uo=e.createElement("div")).setAttribute("role","status"),uo.setAttribute("aria-live","assertive"),uo.setAttribute("aria-atomic","true");let t=uo.style;t.position="absolute",t.width="1px",t.height="1px",t.margin="-1px",t.overflow="hidden",t.clipPath="rect(0 0 0 0)",t.whiteSpace="nowrap",o.appendChild(uo)}ui+=1,function(e){let t=e.rootSlotBottomElement;if(!t)return;let r=e4({className:ug,key:e.getSettings().licenseKey,element:t,releaseDate:"01/09/2026"});if(r){let t;(t=e.rootSlotBottomElement)&&(r.classList.add(ua),t.appendChild(r),uh(us.BOTTOM,t),e.getFocusScopeManager().registerScope(uu,r,{shortcutsContextName:uc,runOnlyIf:()=>null!==up(e),onActivate:t=>{let r,n=(r=up(e))?Array.from(r.querySelectorAll("a[href]")):[];n.length>0&&("tab_from_above"===t?n[0]?.focus():"tab_from_below"===t&&n[n.length-1]?.focus())}}))}}(g),function(e,t){let{lifecycle:r,channels:n}=t,o=uy[r.state];o?function(e,t){let r=e.rootOverlaysElement;if(!r)return;let n=e.getFocusScopeManager(),o=e.getShortcutManager(),i=e.isRtl(),s=`${e.guid}-license-lock-title`,a=`${e.guid}-license-lock-description`,l=`${uA} ${uA}--confirm handsontable ht-license-lock ${uA}--background-solid ${uA}--show`,{refs:h}=eg`
    <div data-ref="lock" class="${l}"
      role="alertdialog" aria-modal="true"
      aria-labelledby="${s}" aria-describedby="${a}"
      tabindex="-1" dir="${i?"rtl":"ltr"}" style="display: block;">
      <div class="${uA}__content-wrapper">
        <div data-ref="inner" tabindex="-1" class="${uA}__content-wrapper-inner">
          <div class="${uA}__content">
            <h2 data-ref="title" id="${s}" class="${uA}__title"></h2>
            <p data-ref="description" id="${a}" class="${uA}__description"></p>
          </div>
          <div class="${uA}__buttons">
            <a data-ref="contactButton" class="ht-button ht-button--secondary" rel="noopener"></a>
          </div>
        </div>
      </div>
    </div>
  `,d=h.lock;if(h.title.textContent=t.title,h.description.textContent=t.description,h.contactButton.textContent=t.action.text,h.contactButton.setAttribute("href",t.action.href),t.docsLink){let r=e.rootDocument.createElement("a");r.href=t.docsLink.href,r.target="_blank",r.rel="noopener",r.textContent=t.docsLink.text,h.description.appendChild(r),h.description.appendChild(e.rootDocument.createTextNode(t.docsLink.trailingText))}let u=()=>Array.from(d.querySelectorAll("a[href], button")),c=()=>{let{view:t}=e,r=t.isHorizontallyScrollableByWindow()?t.getTotalTableWidth():t.getWorkspaceWidth();d.style.width=`${r}px`};e.addHook("afterViewRender",c),(o.getContext(uI)??o.addContext(uI)).addShortcut({keys:[["Tab"],["Shift","Tab"]],callback:t=>{let r=u(),n=r.indexOf(e.rootDocument.activeElement),o=t.shiftKey?-1:1;r[(n+o+r.length)%r.length]?.focus()},group:uM}),n.registerScope(uM,d,{shortcutsContextName:uI,type:"modal",onActivate:e=>{let t=u();"tab_from_below"===e?t[t.length-1]?.focus():h.contactButton.focus()}}),r.appendChild(d),e.addHookOnce("afterInit",()=>{c(),e.deselectCell()})}(e,o(r)):n.ui&&function(e,t){var r;let n,o=uC[t.state],i=e.rootOverlaysElement;if(!o||!i)return;let s=`${e.guid}-license-popover`,{refs:a}=eg`
    <div data-ref="wrapper" class="${"ht-license-badge-wrapper"}">
      <button data-ref="badge" type="button" class="${"ht-license-badge"}"
        aria-label="Handsontable license information"></button>
      <div data-ref="popover" id="${s}" class="${uw}"
        role="${o.dismissible?"dialog":"tooltip"}" aria-labelledby="${s}-title">
        <div class="${uw}__content">
          <div data-ref="popoverTitle" id="${s}-title" class="${uw}__title"></div>
          <p data-ref="popoverBody" class="${uw}__body"></p>
          <a data-ref="popoverLink" class="${uw}__link" target="_blank" rel="noopener noreferrer"></a>
        </div>
        ${o.dismissible?`<button data-ref="closeButton" type="button" class="${uw}__close" aria-label="Close"></button>`:""}
      </div>
    </div>
  `,l=a.wrapper,h=a.badge,d=()=>e.hasRowHeaders()&&e.hasColHeaders(),u=()=>{let t=d();l.classList.toggle(uE,!t),e.rootElement?.classList.toggle("ht-license-badge-on",t),uT(e)?.table.classList.toggle("ht-license-badge-corner",t)};u(),e.addHook("afterRender",()=>u());let c=0,g=()=>{let t=uT(e);if(!t||!d())return;let r=t.table.offsetWidth;r>0&&Math.abs(r-c)>1&&(c=r,l.style.setProperty("--ht-license-badge-area-width",`${r}px`))},p=e.rootWindow;if("function"==typeof p.ResizeObserver){let t=new p.ResizeObserver(()=>g()),r=null,n=()=>{let n=uT(e)?.table??null;n!==r&&(t.disconnect(),r=n,n&&t.observe(n))};n(),e.addHook("afterRender",()=>n()),e.addHook("afterDestroy",()=>t.disconnect())}else g(),e.addHook("afterRender",()=>g());h.tabIndex=-1;let m=a.popover;a.popoverTitle.textContent=o.title,a.popoverBody.textContent=o.body(t),a.popoverLink.href=o.linkHref,a.popoverLink.textContent=o.linkText,a.popoverLink.tabIndex=-1;let f=!1;m.addEventListener("mouseenter",()=>{f=!0}),m.addEventListener("mouseleave",()=>{f=!1}),r=()=>{f||l.classList.contains(uR)||l.classList.remove(uv)},(n=e.rootElement)&&(n.addEventListener("mouseover",t=>{let n=t.target instanceof e.rootWindow.Element?t.target:null,o=uT(e)?.thead??null,i=!l.classList.contains(uE)&&null!==n&&null!==o&&o.contains(n);l.classList.toggle(uR,i),r()}),n.addEventListener("mouseleave",()=>{l.classList.remove(uR),r()})),o.dismissible&&(m.classList.add(uS),a.closeButton.tabIndex=-1,a.closeButton.addEventListener("click",()=>{m.classList.remove(uS),l.classList.add(uv)})),i.appendChild(l)}(e,r)}(n=g,te(n.getSettings().licenseKey,"01/09/2026"));let t={top:-1,bottom:-1};this.addHook("afterRender",()=>{if(g.isDestroyed)return;let{view:e}=g;if(!e)return;let r=e.isHorizontallyScrollableByWindow()?e.getTotalTableWidth():e.getWorkspaceWidth();0===r&&g.rootWrapperElement&&(r=g.rootWrapperElement.offsetWidth),g.rootSlotBottomElement&&r!==t.bottom&&(t.bottom=r,g.rootSlotBottomElement.style.width=`${r}px`),g.rootSlotTopElement&&r!==t.top&&(t.top=r,g.rootSlotTopElement.style.width=`${r}px`)})}g.runHooks("init"),this.render(),m&&null===g.rootElement.offsetParent&&(b=r4(g.rootElement,()=>{g&&!g.isDestroyed&&g.view&&(g.view._wt.wtOverlays.updateLastSpreaderSize(),g.view.adjustElementsSize(),g.render())})),"object"==typeof m&&(g.runHooks("afterChange",m[0],m[1]),m=!1),g.runHooks("afterInit")},this._createCellCoords=function(e,t){return g.view._wt.createCellCoords(e,t)},this._createCellRange=function(e,t,r){return g.view._wt.createCellRange(e,t,r)},this.validateCell=function(e,t,r,n){var o;let i=g.getCellValidator(t);function s(e){let n=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(!n||!0===t.hidden)return void r(e);let o=t.visualCol,i=t.visualRow,s=g.getCell(i,o,!0);if(s&&"TH"!==s.nodeName){let e=g.rowIndexMapper.getRenderableFromVisualIndex(i),t=g.columnIndexMapper.getRenderableFromVisualIndex(o);g.view._wt.getSetting("cellRenderer",e,t,s)}r(e)}if(eD(i)&&(o=i,i=function(e,t){t(o.test(e))}),na(i)){let r=na(t.prop)?t.visualCol:t.prop;e=g.runHooks("beforeValidate",e,t.visualRow,r,n),g._registerMicrotask(()=>{i.call(t,e,o=>{g&&(o=g.runHooks("afterValidate",o,e,t.visualRow,r,n),t.valid=o,s(o),g.runHooks("postAfterValidate",o,e,t.visualRow,r,n))})})}else g._registerMicrotask(()=>{t.valid=!0,s(t.valid,!1)})},this.setDataAtCell=function(e,t,r,n){let o,i,l,h=D(e,t,r),d=[],u=n;for(o=0,i=h.length;o<i;o++){let[e,t,r]=h[o];"object"!=typeof h[o]&&tr("Method `setDataAtCell` accepts row number or changes array of arrays as its first parameter"),"number"!=typeof h[o][1]&&tr("Method `setDataAtCell` accepts row and column number as its parameters. If you want to use object property name, use method `setDataAtRowProp`");let n="number"==typeof t?t:0;l=n>=this.countCols()?n:s.colToProp(n),d.push([e,l,a.getAtCell(this.toPhysicalRow(e),t),r])}u||"object"!=typeof e||(u=t);let c=F(d,u);g.runHooks("afterSetDataAtCell",c,u),L(c,u,()=>{P(c,u)})},this.setDataAtRowProp=function(e,t,r,n){let o,i,s=D(e,t,r),l=[],h=n;for(o=0,i=s.length;o<i;o++){let[e,t,r]=s[o];l.push([e,t,a.getAtCell(this.toPhysicalRow(e),t),r])}h||"object"!=typeof e||(h=t);let d=F(l,h);g.runHooks("afterSetDataAtRowProp",d,h),L(d,h,()=>{P(d,h)})},this.listen=function(){g&&!g.isListening()&&(cr.forEach(e=>{g!==e&&e.unlisten()}),ce=g.guid,g.runHooks("afterListen"))},this.unlisten=function(){this.isListening()&&(ce=null,g.runHooks("afterUnlisten"))},this.isListening=function(){return ce===g.guid},this.destroyEditor=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];h.closeEditor(e),g.view.render(),t&&M.isSelected()&&h.prepareEditor()},this.populateFromArray=function(e,t,r,n,o,i,s){("object"!=typeof r||"object"!=typeof r[0])&&tr("populateFromArray parameter `input` must be an array of arrays");let a="number"==typeof n?g._createCellCoords(n,o):void 0;return l.populateFromArray(g._createCellCoords(e,t),r,a,i,s)},this.spliceCol=function(e,t,r){for(var n=arguments.length,o=Array(n>3?n-3:0),i=3;i<n;i++)o[i-3]=arguments[i];return s.spliceCol(e,t,r,...o)},this.spliceRow=function(e,t,r){for(var n=arguments.length,o=Array(n>3?n-3:0),i=3;i<n;i++)o[i-3]=arguments[i];return s.spliceRow(e,t,r,...o)},this.getSelected=function(){if(M.isSelected())return Z(M.getSelectedRange().ranges,e=>{let{from:t,to:r}=e;return[t.row,t.col,r.row,r.col]})},this.getSelectedLast=function(){let e,t=g.getSelected();return t&&t.length>0&&(e=t[t.length-1]),e},this.getSelectedActive=function(){let e=g.getSelectedRangeActive();if(!e)return;let{from:t,to:r}=e;return[t.row,t.col,r.row,r.col]},this.getSelectedRange=function(){if(M.isSelected())return Array.from(M.getSelectedRange())},this.getSelectedRangeLast=function(){let e,t=g.getSelectedRange();return t&&t.length>0&&(e=t[t.length-1]),e},this.getSelectedRangeActive=function(){return M.getActiveSelectedRange()},this.getActiveSelectionLayerIndex=function(){return M.getActiveSelectionLayerIndex()},this.emptySelectedCells=function(e){if(!M.isSelected()||0===this.countRows()||0===this.countCols())return;let t=[];J(M.getSelectedRange(),e=>{if(e.isSingleHeader())return;let r=e.getTopStartCorner(),n=e.getBottomEndCorner(),o=Math.max(r.row,0),i=Math.min(n.row,this.countRows()-1),s=Math.max(r.col,0),a=Math.min(n.col,this.countCols()-1);if(o>i||s>a)return;let l=e=>{oA(s,a,r=>{this.getCellMetaTransient(e,r).readOnly||t.push([e,r,null])})};oA(o,i,l)}),t.length>0&&this.setDataAtCell(t,e)},this.isRenderSuspended=function(){return this.renderSuspendedCounter>0},this.suspendRender=function(){this.renderSuspendedCounter+=1},this.resumeRender=function(){let e=this.renderSuspendedCounter-1;this.renderSuspendedCounter=Math.max(e,0),this.isRenderSuspended()||e!==this.renderSuspendedCounter||g.view.render()},this.render=function(){this.view&&(this.forceFullRender=!0,this.isRenderSuspended()||g.view.render())},this.batchRender=function(e){g.suspendRender();let t=e();return g.resumeRender(),t},this.isExecutionSuspended=function(){return this.executionSuspendedCounter>0},this.suspendExecution=function(){this.executionSuspendedCounter+=1,this.columnIndexMapper.suspendOperations(),this.rowIndexMapper.suspendOperations()},this.resumeExecution=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.executionSuspendedCounter-1;this.executionSuspendedCounter=Math.max(t,0),(!this.isExecutionSuspended()&&t===this.executionSuspendedCounter||e)&&(this.columnIndexMapper.resumeOperations(),this.rowIndexMapper.resumeOperations())},this.batchExecution=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];g.suspendExecution();let r=e();return g.resumeExecution(t),r},this.batch=function(e){g.suspendRender(),g.suspendExecution();let t=e();return g.resumeExecution(),g.resumeRender(),t},this.refreshDimensions=function(){if(!g.view)return;let e=g.view,{width:t,height:r}=e.getLastSize(),{width:n,height:o}=g.rootElement.getBoundingClientRect(),i=n!==t||o!==r;!1!==g.runHooks("beforeRefreshDimensions",{width:t,height:r},{width:n,height:o},i)&&((i||e._wt.wtOverlays.scrollableElement===g.rootWindow)&&(e.setLastSize(n,o),e.adjustElementsSize(),g.render()),g.runHooks("afterRefreshDimensions",{width:t,height:r},{width:n,height:o},i))},this.updateData=function(e,t){dH(e,e=>{s=e},e=>{s=e,g.columnIndexMapper.fitToLength(this.getInitialColumnCount()),g.rowIndexMapper.fitToLength(this.countSourceRows()),l.adjustRowsAndCols(),M.markSource("updateData"),M.refresh(),M.markEndSource()},{hotInstance:g,dataMap:s,dataSource:a,internalSource:"updateData",source:t,metaManager:v,firstRun:m})},this.loadData=function(e,t){dH(e,e=>{s=e},()=>{v.clearCellsCache(),g.initIndexMappers(),l.adjustRowsAndCols(),M.markSource("loadData"),M.refresh(),M.markEndSource(),m&&(m=[null,"loadData"])},{hotInstance:g,dataMap:s,dataSource:a,internalSource:"loadData",source:t,metaManager:v,firstRun:m})},this.getInitialColumnCount=function(){let e=R.columns,t=0;if(Array.isArray(e))t=e.length;else if(na(e))if("array"===g.dataType){let r=g.countSourceCols();for(let n=0;n<r;n+=1)e(n)&&(t+=1)}else("object"===g.dataType||"function"===g.dataType)&&(t=s.colToPropCache.length);else if(e_(R.dataSchema)){let e=s.getSchema();t=Array.isArray(e)?e.length:tb(e)}else t=g.countSourceCols();return t},this.initIndexMappers=function(){this.columnIndexMapper.initToLength(this.getInitialColumnCount()),this.rowIndexMapper.initToLength(this.countSourceRows())},this.getData=function(e,t,r,n){return eL(e)?s.getAll():s.getRange(g._createCellCoords(e,t),g._createCellCoords(r,n),dx.DESTINATION_RENDERER)},this.getCopyableText=function(e,t,r,n){return s.getCopyableText(g._createCellCoords(e,t),g._createCellCoords(r,n))},this.getCopyableData=function(e,t){return s.getCopyable(e,s.colToProp(t))},this.getCopyableSourceData=function(e,t){return a.getCopyable(e,s.colToProp(t))},this.getSchema=function(){return s.getSchema()},this.updateSettings=function(e){var t,r;let n,o,i,a,h,d,u,c=arguments.length>1&&void 0!==arguments[1]&&arguments[1],p=(m?g.loadData:g.updateData).bind(this);for(d in e_(e.rows)&&tr('The "rows" setting is no longer supported. Do you mean startRows, minRows or maxRows?'),e_(e.cols)&&tr('The "cols" setting is no longer supported. Do you mean startCols, minCols or maxCols?'),e_(e.ganttChart)&&tr('Since 8.0.0 the "ganttChart" setting is no longer supported.'),o=Array.isArray((t=e).columns)?t.columns:[],i=Array.isArray(t.cell)?t.cell:[],a=[t,...o,...i],cn.forEach(e=>{let{name:t,version:r,migrationUrl:n}=e;a.some(e=>tc(e)&&e_(e[t]))&&t1(`Core.removedOption.${t}`,`The "${t}" setting was removed in Handsontable ${r} and is ignored. See ${n} for the migration path.`)}),B=null,e_(e.rowHeights)&&e_(e.minRowHeights)&&tQ("Both `rowHeights` and `minRowHeights` are defined in your configuration. As one is the alias of the other, only one of them can be used at a time. `rowHeights` will be used as the row height configuration."),e)if("data"===d||"language"===d);else if("className"===d)x("className",e.className);else if("tableClassName"===d&&g.table)x("tableClassName",e.tableClassName),g.view._wt.wtOverlays.syncOverlayTableClassNames();else if(nF.getSingleton().isRegistered(d)||nF.getSingleton().isDeprecated(d)){let t=e[d];na(t)?(nF.getSingleton().addAsFixed(d,t,g),R[d]=t):Array.isArray(t)&&(nF.getSingleton().add(d,t,g),R[d]=t)}else!c&&ty(e,d)&&(E[d]=e[d]);let b=ut(g.rootContainer),C=ty(e,"themeName"),y=ty(e,"theme");if(C&&y&&tQ("Both `theme` and `themeName` are defined in your configuration. These options are aliases and cannot be used together. The `themeName` option will be ignored."),c){let t;y&&"string"==typeof e.theme?t=e.theme:C&&"string"==typeof e.themeName&&e.themeName&&!y?(t=e.themeName,R.theme=e.themeName,R.themeName=void 0):b?t=b:g.themeManager&&(t=g.themeManager.getClassName()),g.useTheme(t??null)}else{let t=g.getCurrentThemeName();if(y&&"string"==typeof e.theme&&t!==e.theme)g.themeManager?.destroy(),g.useTheme(e.theme);else if(C&&!y&&t!==e.themeName)g.themeManager?.destroy(),R.theme=e.themeName,R.themeName=void 0,g.useTheme(e.themeName);else if(s8(g)&&!b&&tc(e.theme))if(null===g.themeManager)k(e.theme,O()),g.useTheme(g.themeManager.getClassName());else{let t;t="function"!=typeof e.theme.getThemeConfig?u9(e.theme):e.theme,g.themeManager.update(t),g.useTheme(g.themeManager.getClassName())}}let w=(!!ty(h=N(e),"colorScheme")||!!ty(h,"density"))&&(g.themeManager?!!g.themeManager.setOverrides(h)&&!c&&(g.stylesHandler.clearCache(),!0):(uW(h.colorScheme)&&uW(h.density)||f||(f=!0,tQ("The `colorScheme` and `density` options require the theme engine, so they have no effect when the theme is enabled by a CSS class name. Pass a theme config object or a `ThemeBuilder` instance to the `theme` option, or remove the `ht-theme-*` class from the container element to use the default theme.")),!1));!0===g.runHooks("hasExternalDataSource")?(e.data&&tQ('The "data" setting is ignored when "hasExternalDataSource" returns `true`.'),c||ty(e,"data")||ty(e,"dataProvider")?p([],"updateSettings"):void 0!==e.columns&&(s.createMap(),g.initIndexMappers())):void 0===e.data&&void 0===R.data?p(null,"updateSettings"):void 0!==e.data?p(e.data,"updateSettings"):void 0!==e.columns&&(s.createMap(),g.initIndexMappers()),!m&&e.language&&(hV(n=aF(r=e.language))?(g.runHooks("beforeLanguageChange",n),E.language=n,g.runHooks("afterLanguageChange",n)):aB(r));let S=g.countCols(),T=R.columns;if(void 0!==e.cell||void 0!==e.cells||void 0!==e.columns){let e=v.getUserDefinedCellMetas();v.clearCache(),e.forEach(e=>{let{physicalRow:t,physicalColumn:r,key:n,value:o}=e;v.setCellMeta(t,r,n,o)})}if(S>0)for(d=0,u=0;d<S;d++){if(T){let e=na(T)?T(d):T[u];e&&v.updateColumnMeta(u,e)}u+=1}if(e_(e.cell)){v.disableUserDefinedMetaRecording();try{e.cell.forEach(e=>{g.setCellMetaObject(e.row,e.col,e)})}finally{v.enableUserDefinedMetaRecording()}}g.runHooks("afterCellMetaReset"),m&&dO(g,"init");let A=g.rootElement.style.height;""!==A&&(A=parseInt(g.rootElement.style.height,10)),c&&g.rootElement.getAttribute("style")&&(g.rootElement.dataset.initialstyle=g.rootElement.getAttribute("style")??"");let I=e.height;if(void 0!==e.height)if(na(I)&&(I=I()),null===(I=g.runHooks("beforeHeightChange",I))){let e=g.rootElement.dataset.initialstyle;e&&(e.indexOf("height")>-1||e.indexOf("overflow")>-1)?g.rootElement.setAttribute("style",e):(g.rootElement.style.height="",g.rootElement.style.overflow="")}else void 0!==I&&(g.rootElement.style.height=isNaN(I)?`${I}`:`${I}px`,g.rootElement.style.overflow="clip");if(void 0!==e.width){let t=e.width;na(t)&&(t=t()),t=g.runHooks("beforeWidthChange",t),g.rootElement.style.width=isNaN(t)?`${t}`:`${t}px`}if(void 0!==e.height||void 0!==e.width){let e=g.rootElement.style.height,t=g.rootElement.style.width,r=/%|v(?:w|h|min|max)/i.test(t),n=""!==t&&"auto"!==t&&!r;if(!e){let e=g.rootElement.style.overflowX;(""===e||"clip"===e)&&(g.rootElement.style.overflowX=n?"clip":"")}}c||(g.view&&(g.view._wt.wtViewport.resetHasOversizedColumnHeadersMarked(),g.view._wt.exportSettingsAsClassNames(),g.view.invalidateIndexSizesCache()),M.updateHighlightClassNames(),g.runHooks("afterUpdateSettings",e)),l.adjustRowsAndCols(),g.view&&!m&&(g.render(),g.view._wt.wtOverlays.adjustElementsSize()),w&&g.themeManager&&g.runHooks("afterSetTheme",g.themeManager.getClassName(),!1),!c&&g.view&&(""===A||""===I||void 0===I)&&A!==I&&g.view._wt.wtOverlays.updateMainScrollableElements(),s8(g)&&W?.applyConfig(R.layout)},this.getValue=function(){let e=g.getSelectedRangeActive();if(R.getValue){if(na(R.getValue))return R.getValue.call(g);else if(e&&"string"==typeof R.getValue){let t=e.highlight.row??0;return g.getData()[t][R.getValue]}}else if(e)return g.getDataAtCell(e.highlight.row,e.highlight.col);return null},this.getSettings=function(){return R},this.clear=function(){this.selectAll(),this.emptySelectedCells(),this.deselectCell()},this.alter=function(e,t,r,n,o){l.alter(e,t,r,n,o)},this.getCell=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=t,o=e;if(t>=0){if(g.columnIndexMapper.isHidden(g.toPhysicalColumn(t)))return null;n=g.columnIndexMapper.getRenderableFromVisualIndex(t)}if(e>=0){if(g.rowIndexMapper.isHidden(g.toPhysicalRow(e)))return null;o=g.rowIndexMapper.getRenderableFromVisualIndex(e)}return null===o||null===n||void 0===o||void 0===n?null:g.view.getCellAtCoords(g._createCellCoords(o,n),r)},this.getCoords=function(e){let t=g.view._wt.wtTable.getCoords(e);if(null===t)return null;let{row:r,col:n}=t,o=r,i=n;return null!==r&&r>=0&&(o=g.rowIndexMapper.getVisualFromRenderableIndex(r)),null!==n&&n>=0&&(i=g.columnIndexMapper.getVisualFromRenderableIndex(n)),g._createCellCoords(o,i)},this.colToProp=function(e){return s.colToProp(e)},this.propToCol=function(e){return s.propToCol(e)},this.toVisualRow=e=>g.rowIndexMapper.getVisualFromPhysicalIndex(e),this.toVisualColumn=e=>g.columnIndexMapper.getVisualFromPhysicalIndex(e),this.toPhysicalRow=e=>g.rowIndexMapper.getPhysicalFromVisualIndex(e),this.toPhysicalColumn=e=>g.columnIndexMapper.getPhysicalFromVisualIndex(e),this.getDataAtCell=function(e,t){return s.get(e,s.colToProp(t))},this.getDataAtRowProp=function(e,t){return s.get(e,t)},this.getDataAtCol=function(e){let t=[],r=s.getRange(g._createCellCoords(0,e),g._createCellCoords(R.data.length-1,e),dx.DESTINATION_RENDERER);for(let e=0;e<r.length;e+=1)for(let n=0;n<r[e].length;n+=1)t.push(r[e][n]);return t},this.getDataAtProp=function(e){let t=[],r=s.getRange(g._createCellCoords(0,s.propToCol(e)),g._createCellCoords(R.data.length-1,s.propToCol(e)),dx.DESTINATION_RENDERER);for(let e=0;e<r.length;e+=1)for(let n=0;n<r[e].length;n+=1)t.push(r[e][n]);return t},this.getSourceData=function(e,t,r,n){return void 0===e?a.getData():a.getByRange(g._createCellCoords(e,t??null),g._createCellCoords(r??null,n??null))},this.getSourceDataArray=function(e,t,r,n){return void 0===e?a.getData(!0):a.getByRange(g._createCellCoords(e,t??null),g._createCellCoords(r??null,n??null),!0)},this.getSourceDataAtCol=function(e){return a.getAtColumn(e)},this.setSourceDataAtCell=function(e,t,r,n){let o=D(e,t,r),i=g.hasHook("afterSetSourceDataAtCell"),s=[],l=(e,t)=>{let r=g.toVisualRow(e),n=g.toVisualColumn(t);return Number.isInteger(n)?g.getCellMetaTransient(r,n):{...Object.getPrototypeOf(R),...R}};i&&J(o,e=>{let[t,r,n]=e,o=n0(n,l(t,r));s.push([t,r,a.getAtCell(t,r),o])}),J(o,e=>{let[t,r,o]=e,i=l(t,r),s=n0(o,i);(function(e,t,r){let n=t.sourceDataValidator;if(!na(n)||!0===n(e,t,r))return!0;let{row:o,col:i,sourceDataWarningMessage:s,allowInvalid:a}=t;return s&&dk(s,[{row:o,col:i,value:e}]),!0===a})(s,i,n??"setSourceDataAtCell")&&a.setAtCell(t,r,s)}),i&&this.runHooks("afterSetSourceDataAtCell",s,n),this.render();let h=g.getActiveEditor();h&&e_(h.refreshValue)&&h.refreshValue()},this.getSourceDataAtRow=function(e){return a.getAtRow(e)},this.getSourceDataAtCell=function(e,t){return a.getAtCell(e,t)},this.getDataAtRow=function(e){return s.getRange(g._createCellCoords(e,0),g._createCellCoords(e,this.countCols()-1),dx.DESTINATION_RENDERER)[0]||[]},this.getDataType=function(e,t,r,n){let o=void 0===e?[0,0,g.countRows(),g.countCols()]:[e,t,r,n],[i,s]=o,[,,a,l]=o,h=null,d=null;void 0===a&&(a=i),void 0===l&&(l=s);let u="mixed";return oA(Math.max(Math.min(i,a),0),Math.max(i,a),e=>{let t=!0;return oA(Math.max(Math.min(s,l),0),Math.max(s,l),r=>(d=g.getCellMetaTransient(e,r).type??null,h?t=h===d:h=d,t)),u=t?d??"mixed":"mixed",t}),u},this.removeCellMeta=function(e,t,r){let[n,o]=[g.toPhysicalRow(e),g.toPhysicalColumn(t)],i=v.getCellMetaKeyValue(n,o,r);!1!==g.runHooks("beforeRemoveCellMeta",e,t,r,i)&&(v.removeCellMeta(n,o,r),g.runHooks("afterRemoveCellMeta",e,t,r,i))},this.spliceCellsMeta=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;for(var r=arguments.length,n=Array(r>2?r-2:0),o=2;o<r;o++)n[o-2]=arguments[o];n.length>0&&!Array.isArray(n[0])&&tr("The 3rd argument (cellMetaRows) has to be passed as an array of cell meta objects array."),t>0&&v.removeRow(g.toPhysicalRow(e),t),n.length>0&&J(n.reverse(),t=>{v.createRow(g.toPhysicalRow(e)),J(t,(t,r)=>{this.setCellMetaObject(e,r,t)})}),g.render()},this.setCellMetaObject=function(e,t,r){"object"==typeof r&&tp(r,(r,n)=>{this.setCellMeta(e,t,n,r)})},this._setCellMetaDeclarative=function(e,t,r,n){let o=e,i=t;e<g.countRows()&&(o=g.toPhysicalRow(e)),t<g.countCols()&&(i=g.toPhysicalColumn(t)),v.disableUserDefinedMetaRecording();try{v.setCellMeta(o,i,r,n)}finally{v.enableUserDefinedMetaRecording()}},this.setCellMeta=function(e,t,r,n){if(!1===g.runHooks("beforeSetCellMeta",e,t,r,n))return;let o=e,i=t;e<g.countRows()&&(o=g.toPhysicalRow(e)),t<g.countCols()&&(i=g.toPhysicalColumn(t)),v.setCellMeta(o,i,r,n),g.runHooks("afterSetCellMeta",e,t,r,n)},this.getCellsMeta=function(){return v.getCellsMeta()},this.getCellMeta=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{skipMetaExtension:!1},n=g.toPhysicalRow(e),o=g.toPhysicalColumn(t);return null===n&&(n=e),null===o&&(o=t),v.getCellMeta(n,o,{visualRow:e,visualColumn:t,...r})},this.getCellMetaTransient=function(e,t){let r=g.toPhysicalRow(e),n=g.toPhysicalColumn(t);return null===r&&(r=e),null===n&&(n=t),v.getCellMetaTransient(r,n,{visualRow:e,visualColumn:t})},this.getColumnMeta=function(e){return v.getColumnMeta(g.toPhysicalColumn(e))},this.getCellMetaAtRow=function(e){return v.getCellsMetaAtRow(e)},this.isColumnModificationAllowed=function(){return!("object"===g.dataType||R.columns)},this.getCellRenderer=function(e,t){let r="number"==typeof e?g.getCellMeta(e,t).renderer:e.renderer;return"string"==typeof r?oZ(r):eL(r)?oZ("text"):r},this.getCellEditor=function(e,t){let r="number"==typeof e?g.getCellMeta(e,t).editor:e.editor;return"string"==typeof r?nQ(r):eL(r)?nQ("text"):r},this.getCellValidator=function(e,t){let r="number"==typeof e?g.getCellMeta(e,t).validator:e.validator;return"string"==typeof r?o5(r):r},this.validateCells=function(e){this._validateCells(e)},this.validateRows=function(e,t){Array.isArray(e)||tr("validateRows parameter `rows` must be an array"),this._validateCells(t,e)},this.validateColumns=function(e,t){Array.isArray(e)||tr("validateColumns parameter `columns` must be an array"),this._validateCells(t,void 0,e)},this._validateCells=function(e,t,r){let n=H();e&&(n.onQueueEmpty=e);let o=g.countRows()-1;for(;o>=0;){if(void 0!==t&&-1===t.indexOf(o)){o-=1;continue}let e=g.countCols()-1;for(;e>=0;){if(void 0!==r&&-1===r.indexOf(e)){e-=1;continue}n.addValidatorToQueue();let t=o,i=e,s=g.getCellMetaTransient(t,i);g.validateCell(g.getDataAtCell(t,i),s,e=>{"boolean"!=typeof e&&tr("Validation error: result is not boolean"),!1===e&&(n.valid=!1,g.getCellMeta(t,i,{skipMetaExtension:!0}).valid=!1),n.removeValidatorFormQueue()},"validateCells"),e-=1}o-=1}n.checkIfQueueIsEmpty()},this.getRowHeader=function(e){let t=R.rowHeaders,r=e;if(void 0!==r&&(r=g.runHooks("modifyRowHeader",r)),void 0===r){let e=[];oA(g.countRows()-1,t=>{e.push(g.getRowHeader(t))}),t=e}else Array.isArray(t)&&void 0!==t[r]?t=t[r]:na(t)?t=t(r):t&&"string"!=typeof t&&"number"!=typeof t&&(t=r+1);return t},this.hasRowHeaders=function(){return!!R.rowHeaders},this.hasColHeaders=function(){if(void 0!==R.colHeaders&&null!==R.colHeaders)return!!R.colHeaders;for(let e=0,t=g.countCols();e<t;e++)if(g.getColHeader(e))return!0;return!1};let B=null;this.getColHeader=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,r=g.runHooks("modifyColHeader",e);if(void 0===r){let e=[],t=g.countCols();for(let r=0;r<t;r++)e.push(g.getColHeader(r));return e}let n=R.colHeaders,o=R.columns,i="function"==typeof o?o:null,s=g.toPhysicalColumn(r),a=null;if(null!==i){let e=g.countCols();if(null===B||B.columns!==i||B.columnsLen!==e){let t=[];for(let r=0;r<e;r++)i(r)&&t.push(r);B={columns:i,columnsLen:e,indexes:t}}a=i(B.indexes[s])??null}return!1===R.colHeaders?n=null:a&&a.title?n=a.title:o&&!na(o)&&o[s]&&o[s].title?n=o[s].title:Array.isArray(R.colHeaders)&&void 0!==R.colHeaders[s]?n=R.colHeaders[s]:na(R.colHeaders)?n=R.colHeaders(s):R.colHeaders&&"string"!=typeof R.colHeaders&&"number"!=typeof R.colHeaders&&(n=as(r)),n=g.runHooks("modifyColumnHeaderValue",n,e,t)},this._getColWidthFromSettings=function(e){let t;if(e>=0&&(t=g.getCellMeta(0,e).width),(void 0===t||t===R.width)&&(t=R.colWidths),null!=t){switch(typeof t){case"object":t=t[e];break;case"function":t=t(e)}"string"==typeof t&&(t=Number.parseInt(t,10))}return t},this.getColWidth=function(e,t){let r=g._getColWidthFromSettings(e);return void 0===(r=g.runHooks("modifyColWidth",r,e,t))&&(r=50),r},this._getRowHeightFromSettings=function(e){let t=g.stylesHandler.getDefaultRowHeight(e),r=R.rowHeights??R.minRowHeights;if(null!=r){switch(typeof r){case"object":r=r[e];break;case"function":r=r(e)}"string"==typeof r&&(r=Number.parseInt(r,10))}let n=r;return null!=n&&null!==t&&n<t?t:n},this.getRowHeight=function(e,t){let r=g._getRowHeightFromSettings(e);return g.runHooks("modifyRowHeight",r,e,t)},this.countSourceRows=function(){return a.countRows()},this.countSourceCols=function(){return a.countFirstRowKeys()},this.countRows=function(){return s.getLength()},this.countCols=function(){return Math.min(R.maxCols,g.columnIndexMapper.getNotTrimmedIndexesLength())},this.countRenderedRows=function(){let e=g.view;return e?._wt.drawn?e._wt.wtTable.getRenderedRowsCount():-1},this.countVisibleRows=function(){let e=g.view;return e?._wt.drawn?e._wt.wtTable.getVisibleRowsCount():-1},this.countRenderedCols=function(){let e=g.view;return e?._wt.drawn?e._wt.wtTable.getRenderedColumnsCount():-1},this.countVisibleCols=function(){let e=g.view;return e?._wt.drawn?e._wt.wtTable.getVisibleColumnsCount():-1},this.countRowHeaders=function(){let e=g.view;return e?e.getRowHeadersCount():0},this.countColHeaders=function(){let e=g.view;return e?e.getColumnHeadersCount():0},this.countEmptyRows=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=0;return oM(g.countRows()-1,r=>{if(g.isEmptyRow(r))t+=1;else if(!0===e)return!1}),t},this.countEmptyCols=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=0;return oM(g.countCols()-1,r=>{if(g.isEmptyCol(r))t+=1;else if(!0===e)return!1}),t},this.isEmptyRow=function(e){return R.isEmptyRow.call(g,e)},this.isEmptyCol=function(e){return R.isEmptyCol.call(g,e)},this.selectCell=function(e,t,r,n){let o=!(arguments.length>4)||void 0===arguments[4]||arguments[4],i=!(arguments.length>5)||void 0===arguments[5]||arguments[5];if(eL(e)||eL(t))return!1;let s=[[null==e||Number.isNaN(Number(e))?0:Number(e),null==t||"number"==typeof t&&Number.isNaN(t)?0:t,eL(r)?void 0:r,eL(n)?void 0:n]];return g.selectCells(s,o,i)},this.selectCells=function(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[[]],r=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=!(arguments.length>2)||void 0===arguments[2]||arguments[2];!1===r&&u.suspend(),!1===n&&d.suspend();try{e=M.selectCells(t)}finally{u.resume(),d.resume()}return e&&n&&g.listen(),e},this.selectColumns=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,r=arguments.length>2?arguments[2]:void 0;return M.selectColumns(e,t,r)},this.selectRows=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,r=arguments.length>2?arguments[2]:void 0;return M.selectRows(e,t,r)},this.deselectCell=function(){M.deselect()},this.selectAll=function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,r=arguments.length>2?arguments[2]:void 0;u.skipNextScrollCycle(),M.selectAll(e,t,r)};let V=(e,t)=>e.getNearestNotHiddenIndex(t,1,!0);this.scrollViewportTo=function(e,t){"number"==typeof e&&(e={row:arguments[0],col:arguments[1],verticalSnap:arguments[2]?"bottom":"top",horizontalSnap:arguments[3]?"end":"start",considerHiddenIndexes:arguments[4]??!0});let{row:r,col:n,considerHiddenIndexes:o}=e??{},i=r,s=n;if(na(t)&&this.addHookOnce("afterScroll",t),void 0===o||o){var a,l;let e,t,o,h,d=(a=r,l=n,e=void 0!==a&&Number.isInteger(a)&&a>=0,t=void 0!==l&&Number.isInteger(l)&&l>=0,o=e?V(g.rowIndexMapper,a):void 0,h=t?V(g.columnIndexMapper,l):void 0,null!==o&&null!==h&&{renderableRow:e?g.rowIndexMapper.getRenderableFromVisualIndex(o)??void 0:a,renderableColumn:t?g.columnIndexMapper.getRenderableFromVisualIndex(h)??void 0:l});if(!1===d)return!1;i=d.renderableRow,s=d.renderableColumn}let h=Number.isInteger(i),d=Number.isInteger(s),u=!1;return h&&i>=0&&d&&s>=0?u=g.view.scrollViewport(g._createCellCoords(i,s),e.horizontalSnap,e.verticalSnap):h&&i>=0&&(d&&s<0||!d)?u=g.view.scrollViewportVertically(i,e.verticalSnap):d&&s>=0&&(h&&i<0||!h)&&(u=g.view.scrollViewportHorizontally(s,e.horizontalSnap)),na(t)&&(u?this.view.render():(this.removeHook("afterScroll",t),this._registerMicrotask(()=>t()))),u},this.scrollToFocusedCell=function(e){if(!g.selection.isSelected())return!1;na(e)&&g.addHookOnce("afterScroll",e);let{highlight:t}=g.getSelectedRangeActive(),r=g.scrollViewportTo(t.toObject());return r?g.view.render():na(e)&&(g.removeHook("afterScroll",e),g._registerMicrotask(()=>e())),r},this.destroy=function(){g._clearTimeouts(),g._clearMicrotasks(),b?.disconnect(),b=null,g.view&&g.view.destroy(),a&&a.destroy(),a=null,s8(this)&&(0!==ui&&(1===ui&&(uo.remove(),uo=null),ui-=1),this.getFocusScopeManager().destroy(),W?.destroy(),g.themeManager?.destroy()),this.getShortcutManager().destroy(),A.clear(),v.clearCache(),cr.delete(this.guid),p.destroy(),h&&h.destroy(),g.rootContainer&&rm(g.rootContainer),g.rootPortalElement&&g.rootPortalElement.remove(),g.batchExecution(()=>{g.rowIndexMapper.destroy(),g.columnIndexMapper.destroy(),T.getItems().forEach(e=>{let[,t]=e;t.destroy()}),T.clear(),g.runHooks("afterDestroy")},!0),nF.getSingleton().destroy(g),tp(g,(e,t,r)=>{var n;na(e)?r[t]=(n=t,()=>{tr(`The "${n}" method cannot be called because this Handsontable instance has been destroyed`)}):"guid"!==t&&(r[t]=null)}),g.isDestroyed=!0,s&&s.destroy(),s=null,l=null,M=null,h=null,g=null},this.getActiveEditor=function(){return h?.getActiveEditor()},this.getFirstRenderedVisibleRow=function(){return g.view.getFirstRenderedVisibleRow()},this.getLastRenderedVisibleRow=function(){return g.view.getLastRenderedVisibleRow()},this.getFirstRenderedVisibleColumn=function(){return g.view.getFirstRenderedVisibleColumn()},this.getLastRenderedVisibleColumn=function(){return g.view.getLastRenderedVisibleColumn()},this.getFirstFullyVisibleRow=function(){return g.view.getFirstFullyVisibleRow()},this.getLastFullyVisibleRow=function(){return g.view.getLastFullyVisibleRow()},this.getFirstFullyVisibleColumn=function(){return g.view.getFirstFullyVisibleColumn()},this.getLastFullyVisibleColumn=function(){return g.view.getLastFullyVisibleColumn()},this.getFirstPartiallyVisibleRow=function(){return g.view.getFirstPartiallyVisibleRow()},this.getLastPartiallyVisibleRow=function(){return g.view.getLastPartiallyVisibleRow()},this.getFirstPartiallyVisibleColumn=function(){return g.view.getFirstPartiallyVisibleColumn()},this.getLastPartiallyVisibleColumn=function(){return g.view.getLastPartiallyVisibleColumn()},this.getPlugin=function(e){return T.getItem(oa(e))},this.getPluginName=function(e){return T.getId(e)},this.getInstance=function(){return g},this.addHook=function(e,t,r){nF.getSingleton().add(e,t,g,r)},this.hasHook=function(e){return nF.getSingleton().has(e,g)||nF.getSingleton().has(e)},this.addHookOnce=function(e,t,r){nF.getSingleton().once(e,t,g,r)},this.removeHook=function(e,t){nF.getSingleton().remove(e,t,g)},this.runHooks=function(e,t,r,n,o,i,s){return nF.getSingleton().run(g,e,t,r,n,o,i,s)},this.getTranslatedPhrase=function(e,t){return hG(R.language,e,t)},this.toHTML=()=>oe(this),this.toTableElement=()=>{let e=g.rootDocument.createElement("div");return e.insertAdjacentHTML("afterbegin",oe(g)),e.firstElementChild},this.timeouts=[],this.useTheme=e=>{let t=!!m;this.stylesHandler.useTheme(e??void 0);let r=this.stylesHandler.getThemeName();!t&&r&&(ut(this.rootContainer)&&(ru(this.rootContainer,/ht-theme-.*/g),rd(this.rootContainer,r)),g.render(),g.scrollViewportTo(0,0)),this.runHooks("afterSetTheme",r,t)},this.getCurrentThemeName=()=>g.stylesHandler.getThemeName()??null,this.getTableHeight=()=>g.rootElement.offsetHeight,this.getTableWidth=()=>g.rootElement.offsetWidth,this._registerTimeout=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=e;return"function"==typeof r&&(r=setTimeout(r,t)),this.timeouts.push(r),r},this._clearTimeouts=function(){J(this.timeouts,e=>{clearTimeout(e)})},this.microtasks=[],this._registerMicrotask=function(e){let t={cancelled:!1};this.microtasks.push(t),this.rootWindow.queueMicrotask(()=>{t.cancelled||e()})},this._clearMicrotasks=function(){J(this.microtasks,e=>{e.cancelled=!0}),this.microtasks.length=0},this._getEditorManager=function(){return h},this._getDataSource=function(){return a},this._getMetaManager=function(){return v};let U=(e=>{let{ownerWindow:t,handleEvent:r,beforeKeyDown:n,afterKeyDown:o}=e,i=oF({errorIdExists:e=>`The "${e}" context name is already registered.`}),s="grid",a=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"table",r=d2(e,t);return i.addItem(e,r),r},l=()=>s,h=e=>i.getItem(e),d=!1,u=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:l(),n=d1(r)?r:h(r),o=!1;if(!n?.hasShortcut(t))return o;let i=n?.getShortcuts(t)??[];for(let r=0;r<i.length;r++){let{callback:n,runOnlyIf:s,preventDefault:a,stopPropagation:l,captureCtrl:h,forwardToContext:c}=i[r];if(s?.(e)===!0){if(d=h??!1,o=!1===n(e,t),d=!1,a&&e.preventDefault(),l&&(nR(e),e.stopPropagation()),o)break;c&&u(e,t,c)}}return o},c=function(e,t,r,n,o){let i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,s=e=>{if(!1!==t(e)){if(!1===r(e)||229===e.keyCode||"string"!=typeof e.key||nE(e))return;let t=dQ(e),i=[];dZ.includes(t)||(i=dJ(e));let s=o(e,[t].concat(i));!s&&(tj()&&i.includes("meta")||!tj()&&i.includes("control"))&&(s=o(e,[t].concat(dJ(e,!0)))),n(e);return}if(!1===na(i)||229===e.keyCode||"string"!=typeof e.key||nE(e))return;let s=dQ(e),a=[];dZ.includes(s)||(a=dJ(e));let l=i(e,[s].concat(a));!l&&(tj()&&a.includes("meta")||!tj()&&a.includes("control"))&&(l=i(e,[s].concat(dJ(e,!0)))),n(e)},a=()=>{d3.releaseAll()};return{mount:()=>{let t=e;for(;t;){let{documentElement:e}=t.document,r=d6.get(e)??0;0===r&&(e.addEventListener("keydown",d5),e.addEventListener("keyup",d4)),d6.set(e,r+1),e.addEventListener("keydown",s),e.addEventListener("blur",a),t=t7(t)}},unmount:()=>{let t=e;for(;t;){let{documentElement:e}=t.document,r=d6.get(e)??0;r<=1?(e.removeEventListener("keydown",d5),e.removeEventListener("keyup",d4),d6.delete(e)):d6.set(e,r-1),e.removeEventListener("keydown",s),e.removeEventListener("blur",a),t=t7(t)}},isPressed:e=>d3.isPressed(e),releasePressedKeys:()=>d3.releaseAll()}}(t,e=>{let t=h(l());return r(e,t?.scope??"table")},n,o,u,(e,t)=>{let r=i.getItems();for(let n=0;n<r.length;n+=1){let[,o]=r[n];if("global"===o.scope&&u(e,t,o))return!0}return!1});return c.mount(),{addContext:a,getActiveContextName:l,getContext:h,getOrCreateContext:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"table";return h(e)??a(e,t)},setActiveContextName:e=>{i.hasItem(e)||tr(ec`You've tried to activate the "${e}" shortcut context\x20
        that does not exist. Before activation, register the context using the "addContext" method.`),s=e},hasEventShortcut:(e,t)=>{let r=h(e);return!!r&&((e,t)=>{if("string"!=typeof e.key)return[];let r=dQ(e),n=dZ.includes(r),o=n?[]:dJ(e),i=[[r].concat(o)];return!n&&("function"==typeof t&&t()?o.includes("meta"):o.includes("control"))&&i.push([r].concat(dJ(e,!0))),i})(t,tj).some(e=>r.hasShortcut(e))},isCtrlPressed:()=>!d&&(c.isPressed("control")||c.isPressed("meta")),releasePressedKeys:()=>c.releasePressedKeys(),destroy:()=>c.unmount()}})({handleEvent:(e,t)=>"global"===t||g.isListening(),beforeKeyDown:e=>g.runHooks("beforeKeyDown",e),afterKeyDown:e=>{this.isDestroyed||g.runHooks("afterDocumentKeyDown",e)},ownerWindow:this.rootWindow});this.addHook("beforeOnCellMouseDown",e=>{!1===e.ctrlKey&&!1===e.metaKey&&U.releasePressedKeys()}),this.getShortcutManager=function(){return U},d=new dF(g);let z=s8(this)?function(e){let t=oF({errorIdExists:e=>`The "${e}" focus scope is already registered.`}),r=e.getShortcutManager(),n=null;function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:dV.UNKNOWN;n!==e&&(null!==n&&i(n),(n=e).activate(t),r.setActiveContextName(e.getShortcutsContextName()))}function i(e){s(),n===e&&(n=null,e.deactivate())}function s(){let r=t.getValues(),o=r.filter(e=>e.runOnlyIf()&&"modal"===e.getType());r.forEach(t=>{o.length>0&&o.includes(t)||0===o.length||t.hasContainerDetached()?t.enable():t.disable(),t===n?t.contains(ni(e.rootDocument))?t.deactivateFocusCatchers():t.activateFocusCatchers():t.runOnlyIf()?t.activateFocusCatchers():t.deactivateFocusCatchers()})}function a(r,s){if(!r.isConnected||!rv(r))return;let a=t.getValues().filter(e=>e.runOnlyIf()),l=!1;a.forEach(t=>{!l&&t.contains(r)&&(l=!0,s!==dV.UNKNOWN&&e.listen(),o(t,s))}),!l&&n&&(i(n),e.unlisten())}let l=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=!1;function n(e){r||t.onFocus?.(e)}function o(e){t.onClick?.(e)}function i(e){"Tab"===e.key&&t.onTabKeyDown?.(e)}function s(){r=!0}function a(){r=!1}return{mount:()=>{let t=e;for(;t;){let{documentElement:e}=t.document;e.addEventListener("focusin",n),e.addEventListener("click",o),e.addEventListener("keydown",i),e.addEventListener("mousedown",s),e.addEventListener("mouseup",a),t=t7(t)}},unmount:()=>{let t=e;for(;t;){let{documentElement:e}=t.document;e.removeEventListener("focusin",n),e.removeEventListener("click",o),e.removeEventListener("keydown",i),e.removeEventListener("mousedown",s),e.removeEventListener("mouseup",a),t=t7(t)}}}}(e.rootWindow,{onFocus:e=>{a(t4(e),t4(e).dataset.htFocusSource??dV.UNKNOWN)},onClick:e=>{a(t4(e),dV.CLICK)},onTabKeyDown:()=>{s()}});return l.mount(),{getActiveScopeId:function(){return n?t.getId(n):null},registerScope:function(n,o){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.hasItem(n)&&tr(`Scope with id "${n}" already registered`);let s=function(e,t){let r,n,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i={shortcutsContextName:"grid",type:dB.INLINE,contains:e=>e===t||t.contains(e),runOnlyIf:()=>!0,enableFocusCatchers:!0,...o},s=!1===i.enableFocusCatchers?null:(r=dU(e,dV.TAB_FROM_ABOVE),n=dU(e,dV.TAB_FROM_BELOW),t.prepend(r),t.append(n),{activate(){r.tabIndex=0,n.tabIndex=0},deactivate(){r.tabIndex=-1,n.tabIndex=-1},destroy(){r.remove(),n.remove()}});return{getType:()=>i.type,hasContainerDetached:()=>!e.rootWrapperElement.contains(t),getShortcutsContextName:()=>i.shortcutsContextName,runOnlyIf:()=>i.runOnlyIf(),contains:e=>i.contains(e),activate:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:dV.UNKNOWN;i.onActivate?.(e)},deactivate:()=>{i.onDeactivate?.()},activateFocusCatchers:()=>{s?.activate()},deactivateFocusCatchers:()=>{s?.deactivate()},enable:()=>{t.removeAttribute("inert")},disable:()=>{t.setAttribute("inert","true")},destroy:()=>{s?.destroy()}}}(e,o,i);t.addItem(n,s),r.getOrCreateContext(s.getShortcutsContextName())},unregisterScope:function(e){t.hasItem(e)||tr(`Scope with id "${e}" not found`),t.getItem(e).destroy(),t.removeItem(e)},activateScope:(e,r)=>(function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:dV.UNKNOWN;t.hasItem(e)||tr(`Scope with id "${e}" not found`);let n=r??dV.UNKNOWN;o(t.getItem(e),n)})(e,r),deactivateScope:e=>{!t.hasItem(e)&&tr(`Scope with id "${e}" not found`),i(t.getItem(e))},destroy:()=>l.unmount()}}(g):null,W=s8(this)?new ud({top:g.rootSlotTopElement,bottom:g.rootSlotBottomElement}):null;this.getFocusManager=function(){return d},this.getFocusScopeManager=function(){return s8(g)||tr("The FocusScopeManager is only available for the main Handsontable instance."),z},this.getLayoutManager=function(){return s8(g)||tr("The LayoutManager is only available for the main Handsontable instance."),W};let G=C.theme,$=C.themeName,Y=ut(g.rootContainer);s8(g)&&!Y&&(tc(G)||!G&&!$)&&k(G,N(C)),oG().forEach(e=>{let t=o$(e);t&&T.addItem(e,new t(this))}),r=g,[ue,d8].forEach(e=>e(r)),s8(this)&&(n=g,[dj].forEach(e=>e(n))),U.setActiveContextName("grid"),nF.getSingleton().run(g,"construct")};du(cp),oJ(co);let cf=function(e,t){let r=new cm(e,t||{},s7);return r.init(),r};cf.editors={BaseEditor:n3,TextEditor:cc},cf.dom={empty:rm},cf.helper={},cf.Core=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new cm(e,t,s7)},cf.DefaultSettings=dg(),cf.hooks=nF.getSingleton(),cf.CellCoords=i1,cf.CellRange=i2,cf.packageName="handsontable",cf.buildDate="01/09/2026 11:40:25",cf.version="18.1.0",cf.languages={dictionaryKeys:w,getLanguageDictionary:hW,getLanguagesDictionaries:function(){return hU()},registerLanguageDictionary:hz,getTranslatedPhrase:hG},cf.themes={hasTheme:u2,getTheme:u3,getThemeNames:u6,getThemes:u5,registerTheme:u9,reinitTheme:u7};let cb="handsontableEditor";class cC extends cc{static get EDITOR_TYPE(){return"handsontable"}isFlippedVertically=!1;isFlippedHorizontally=!1;open(){super.open();let e=this.htContainer.style;this.htEditor&&(this.htEditor.rootPortalElement=null,this.htEditor.destroy(),e.width="",e.height="",e.overflow=""),"none"===e.display&&(e.display=""),this.htEditor=new this.hot.constructor(this.htContainer,this.htOptions),this.htEditor.rootPortalElement=this.hot.rootPortalElement,this.htEditor.init(),this.htEditor.rootElement.style.display="",this.cellProperties.strict?this.htEditor.selectCell(0,0):this.htEditor.deselectCell(),rq(this.TEXTAREA,0,this.TEXTAREA.value.length),this.htEditor.updateSettings({width:this.getTargetDropdownWidth(),height:this.getTargetDropdownHeight()}),this.refreshDimensions(),this.flipDropdownVerticallyIfNeeded(),this.flipDropdownHorizontallyIfNeeded()}close(){this.htEditor&&(this.htEditor.rootElement.style.display="none"),this.removeHooksByKey("beforeKeyDown"),super.close()}prepare(e,t,r,n,o,i){super.prepare(e,t,r,n,o,i);let{hot:s}=this,a=this.setValue.bind(this),l={startRows:0,startCols:0,minRows:0,minCols:0,className:"listbox",copyPaste:!1,autoColumnSize:!1,autoRowSize:!1,readOnly:!0,fillHandle:!1,autoWrapCol:!1,autoWrapRow:!1,ariaTags:!1,themeName:this.hot.getCurrentThemeName(),afterOnCellMouseDown(e,t){if(t.row<0||t.col<0)return;let r=this.getDataAtCell(t.row,t.col);void 0!==r&&a(r),s.destroyEditor()},preventWheel:!0,layoutDirection:this.hot.isRtl()?"rtl":"ltr"};this.cellProperties.handsontable&&ti(l,i.handsontable),this.htOptions=l}beginEditing(e,t){let r=this.hot.getSettings().onBeginEditing;r&&!1===r()||super.beginEditing(e,t)}createElements(){super.createElements();let e=this.hot.rootDocument.createElement("DIV");e.className="handsontableEditor",this.TEXTAREA_PARENT.appendChild(e),this.htContainer=e,this.assignHooks()}finishEditing(e,t,r){if(this.htEditor&&this.htEditor.isListening()&&this.hot.listen(),this.htEditor&&this.htEditor.getSelectedActive()){let e=this.htEditor.getValue();void 0!==e&&this.setValue(e)}super.finishEditing(e,t,r)}flipDropdownVerticallyIfNeeded(){let{view:e}=this.hot,t=this.getEditedCellRect();if(!t)return{isFlipped:!1,spaceAbove:0,spaceBelow:0};let r=t.top;e.isVerticallyScrollableByWindow()&&(r=Math.max(r+(e.getTableOffset().top-this.hot.rootWindow.scrollY),0));let n=this.getDropdownHeight(),o=e.getWorkspaceHeight()-r-t.height,i=n>o&&r>o+t.height;return i?this.flipDropdownVertically():this.unflipDropdownVertically(),{isFlipped:i,spaceAbove:r,spaceBelow:o}}flipDropdownVertically(){let e=this.htEditor.rootElement.style;e.position="absolute",e.top=`${-this.getDropdownHeight()}px`,this.isFlippedVertically=!0}unflipDropdownVertically(){let e=this.htEditor.rootElement.style;e.position="absolute",e.top="",this.isFlippedVertically=!1}flipDropdownHorizontallyIfNeeded(){let{view:e}=this.hot,t=this.getEditedCellRect();if(!t)return{isFlipped:!1,spaceInlineStart:0,spaceInlineEnd:0};let r=t.start+t.width,n=e.getWorkspaceWidth();e.isHorizontallyScrollableByWindow()&&(r=Math.max(r+(e.getTableOffset().left-this.hot.rootWindow.scrollX),0),n=this.hot.rootDocument.documentElement.clientWidth);let o=this.getDropdownWidth(),i=n-r+t.width,s=o>i&&r>i;return s?this.flipDropdownHorizontally():this.unflipDropdownHorizontally(),{isFlipped:s,spaceInlineStart:r,spaceInlineEnd:i}}flipDropdownHorizontally(){let e=this.htEditor.rootElement.style,{width:t}=this.getEditedCellRect()??{width:0};e.position="absolute",e[this.hot.isRtl()?"right":"left"]=`${-(this.getDropdownWidth()-t)}px`,this.isFlippedHorizontally=!0}unflipDropdownHorizontally(){let e=this.htEditor.rootElement.style;e.position="absolute",e[this.hot.isRtl()?"right":"left"]="",this.isFlippedHorizontally=!1}getDropdownHeight(){return this.htEditor.getTableHeight()}getDropdownWidth(){return this.htEditor.getTableWidth()}getTargetDropdownWidth(){return this.htEditor.view.getTableWidth()}getTargetDropdownHeight(){return this.htEditor.view.getTableHeight()+1}assignHooks(){this.hot.addHook("afterDestroy",()=>{this.htEditor&&(this.htEditor.rootPortalElement=null,this.htEditor.destroy())}),this.hot.addHook("afterSetTheme",(e,t)=>{t||this.close()})}registerShortcuts(){let e=this.hot.getShortcutManager().getContext("editor");super.registerShortcuts();let t=(e,t)=>{let r=this.htEditor;if(void 0!==e&&(e<0||this.isFlippedVertically&&e>r.countRows()-1?r.deselectCell():r.selectCell(e,0),r.getData().length))return t.preventDefault(),nR(t),this.hot.listen(),this.TEXTAREA.focus(),!1};e.addShortcuts([{keys:[["ArrowUp"]],callback:e=>{let r,n=this.htEditor;if(!n.getSelectedActive()&&this.isFlippedVertically)r=n.countRows()-1;else if(n.getSelectedActive()){let e=n.getSelectedActive();r=this.isFlippedVertically?Math.max(0,e[0]-1):e[0]-1}return t(r,e)},preventDefault:!1},{keys:[["ArrowDown"]],callback:e=>{let r,n=this.htEditor;if(n.getSelectedActive()||this.isFlippedVertically){if(n.getSelectedActive()){let e=n.getSelectedActive();this.isFlippedVertically?r=e[0]+1:this.isFlippedVertically||(r=Math.min(n.countRows()-1,e[0]+1))}}else r=0;return t(r,e)},preventDefault:!1}],{group:cb,relativeToGroup:dY,position:"before"})}unregisterShortcuts(){super.unregisterShortcuts(),this.hot.getShortcutManager().getContext("editor").removeShortcutsByGroup(cb)}}class cy extends cC{static get EDITOR_TYPE(){return"autocomplete"}query=null;strippedChoices=[];rawChoices=[];#nW=this.hot.guid.slice(0,9);getValue(){let e=this.rawChoices.find(e=>{let t=this.stripValueIfNeeded(e);return(this.#nG(t)?t.value:t)===this.TEXTAREA.value});return e_(e)?e:this.TEXTAREA.value}createElements(){super.createElements(),rd(this.htContainer,"autocompleteEditor"),rd(this.htContainer,-1===this.hot.rootWindow.navigator.platform.indexOf("Mac")?"":"htMacScroll"),this.hot.getSettings().ariaTags&&rc(this.TEXTAREA,[["type","text"],["role","combobox"],P("listbox"),["aria-autocomplete","list"]])}prepare(e,t,r,n,o,i){super.prepare(e,t,r,n,o,i),this.hot.getSettings().ariaTags&&rc(this.TEXTAREA,[U("false"),["aria-controls",`${this.#nW}-listbox-${e}-${t}`]]),this.htOptions={...this.htOptions,valueGetter:e=>this.#nG(e)?e.value:e}}open(){super.open();let e=this.cellProperties.trimDropdown,t=void 0===e||e,r=this.hot.getSettings().ariaTags,n=Array.isArray(this.cellProperties.source)?this.cellProperties.source:null,o=n?.length,{row:i,col:s}=this;if(this.showEditableElement(),this.focus(),this.addHook("beforeKeyDown",e=>this.onBeforeKeyDown(e)),this.htEditor.addHook("afterScroll",this.#n$),this.htEditor.updateSettings({colWidths:t?[rF(this.TEXTAREA)-2]:void 0,autoColumnSize:!0,modifyColWidth:t?void 0:e=>Math.max(e??0,rF(this.TEXTAREA)-2),renderer:(e,t,i,s,a,l,h)=>{cg(e,t,i,s,a,l,h);let{filteringCaseSensitive:d,allowHtml:u}=this.cellProperties,c=this.cellProperties.locale,g=this.query,p=eH(l);if(u)rw(t,p,!1,"html",this.hot.rootElement);else if(p&&g&&g.length>0){let r=!0===d?p.indexOf(g):ow(p,c).indexOf(ow(g,c));if(-1!==r){let n=p.slice(r,r+g.length),{rootDocument:o}=e;t.innerHTML="",t.appendChild(o.createTextNode(p.slice(0,r)));let i=o.createElement("strong");i.textContent=n,t.appendChild(i),t.appendChild(o.createTextNode(p.slice(r+g.length)))}}r&&rc(t,[["role","option"],...n?[["aria-setsize",o??0]]:[],...n?[["aria-posinset",n.indexOf(l)+1]]:[],["id",`${this.htEditor.rootElement.id}_${i}-${s}`]])},afterSelectionEnd:(e,t)=>{if(r){let r=e=>{rc(e,[$()]),rc(this.TEXTAREA,"aria-activedescendant",e.id)},n=this.htEditor.getCell(e,t,!0);null!==n?r(n):this.htEditor.addHookOnce("afterScrollVertically",()=>{let n=this.htEditor.getCell(e,t,!0);null!==n&&r(n)})}}}),r){let e=R();rc(this.htEditor.view._wt.wtOverlays.wtTable.TABLE,e[0],e[1]),rc(this.htEditor.rootElement,[N(),["aria-live","polite"],["aria-relevant","text"],["id",`${this.#nW}-listbox-${i}-${s}`]]),rc(this.TEXTAREA,...U("true"))}this.hot._registerTimeout(()=>{this.queryChoices(this.TEXTAREA.value)})}close(){this.removeHooksByKey("beforeKeyDown"),super.close(),this.hot.getSettings().ariaTags&&rc(this.TEXTAREA,[U("false")])}discardEditor(e){super.discardEditor(e),this.hot.view.render()}queryChoices(e){let t=this.cellProperties.source;this.query=e,"function"==typeof t?t.call(this.cellProperties,e,e=>{this.rawChoices=e,this.updateChoicesList(this.stripValuesIfNeeded(e))}):Array.isArray(t)?(this.rawChoices=t,this.updateChoicesList(this.stripValuesIfNeeded(t))):this.updateChoicesList([])}updateChoicesList(e){let t=rG(this.TEXTAREA),r=r$(this.TEXTAREA),n=this.cellProperties.sortByRelevance,o=this.cellProperties.filter,i=this.stripValueIfNeeded(this.getValue()),s=this.#nG(i)?i.value:i,a=null,l=e;n||(l=[...l].sort((e,t)=>eH(e).localeCompare(eH(t))));let h=[],d=this.cellProperties.locale,u=this.cellProperties.filteringCaseSensitive,c=u?s:ow(String(s),d);for(let e=0;e<l.length;e++){let t=this.#nG(l[e])?oc(eH(l[e].value)):oc(eH(l[e]));if(-1!==(u?t:ow(t,d)).indexOf(String(c))&&(h.push(e),!1===o))break}!1===o?String(i).length>0&&(a=h[0]):a=(l=h.map(e=>l[e])).indexOf(c)>-1?l.indexOf(c):0,this.strippedChoices=l,0===l.length?this.htEditor.rootElement.style.display="none":this.htEditor.rootElement.style.display="",this.htEditor.loadData(K([l])),l.length>0&&(this.updateDropdownDimensions(),this.flipDropdownVerticallyIfNeeded(),this.flipDropdownHorizontallyIfNeeded(),!0===this.cellProperties.strict&&this.highlightBestMatchingChoice(a??void 0)),this.hot.listen(),rq(this.TEXTAREA,t,t===r?void 0:r)}flipDropdownVerticallyIfNeeded(){let e=super.flipDropdownVerticallyIfNeeded(),{isFlipped:t,spaceAbove:r,spaceBelow:n}=e;return this.limitDropdownIfNeeded(t?r:n),e}limitDropdownIfNeeded(e){let t=this.getDropdownHeight();if(t>e){let r=this.htEditor.stylesHandler.getDefaultRowHeight()??0;if(0===r)return;let n=Math.max(Math.ceil(e/r)-1,1)*r;this.isFlippedVertically&&(this.htEditor.rootElement.style.top=`${parseInt(this.htEditor.rootElement.style.top,10)+t-n}px`),this.setDropdownHeight(n)}}updateDropdownDimensions(){let e=rK(),t=this.getTargetEditorWidth()+e,r=this.getTargetEditorHeight()+e;this.htEditor.updateSettings({width:t,height:r}),this.#nY(),this.htEditor.view._wt.wtTable.alignOverlaysWithTrimmingContainer()}setDropdownHeight(e){this.htEditor.updateSettings({height:e}),this.#nY(),this.htEditor.view._wt.wtTable.alignOverlaysWithTrimmingContainer()}highlightBestMatchingChoice(e){"number"==typeof e?this.htEditor.selectCell(e,0,void 0,void 0,void 0,!1):this.htEditor.deselectCell()}getTargetEditorHeight(){let e=0;if(!this.hot.getCurrentThemeName()){let t=this.htContainer.querySelector(".htCore");if(t){let r=this.hot.rootWindow.getComputedStyle(t);e=parseInt(r.borderTopWidth,10)+parseInt(r.borderBottomWidth,10)}}return Array.from({length:Math.min(this.cellProperties.visibleRows,this.strippedChoices.length)},(e,t)=>t).reduce((e,t)=>e+((this.hot.stylesHandler.getDefaultRowHeight()??0)+ +(0===t)),0)+e}getTargetEditorWidth(){let e=0;if(!this.hot.getCurrentThemeName()){let t=this.htContainer.querySelector(".htCore");if(t){let r=this.hot.rootWindow.getComputedStyle(t);e=parseInt(r.borderInlineStartWidth,10)+parseInt(r.borderInlineEndWidth,10)}}return this.htEditor.getColWidth(0)+e}stripValueIfNeeded(e){return this.stripValuesIfNeeded([e])[0]}stripValuesIfNeeded(e){let{allowHtml:t}=this.cellProperties,r=e=>eH(t?e:oc(String(e)));return e.every(e=>tv(e))?e.map(e=>({key:r(e.key),value:r(e.value)})):e.map(e=>r(e))}#n$=nd(()=>{this.focus()},100);#nY(){this.htEditor.view.hasVerticalScroll()&&this.htEditor.updateSettings({width:this.getTargetEditorWidth()+rX(this.hot.rootDocument)})}#nG(e){return tc(e)&&e_(e.key)&&e_(e.value)}onBeforeKeyDown(e){if(nC(e.keyCode)||e.keyCode===nf.BACKSPACE||e.keyCode===nf.DELETE||e.keyCode===nf.INSERT){let t=10;e.keyCode===nf.C&&(e.ctrlKey||e.metaKey)||(this.isOpened()||(t+=10),this.htEditor&&this.hot._registerTimeout(()=>{this.queryChoices(this.TEXTAREA.value)},t))}}}class cw extends n3{static get EDITOR_TYPE(){return"checkbox"}beginEditing(e,t){if(t&&"mouseup"===t.type&&"TD"===t4(t).nodeName){let e=this.TD.querySelector('input[type="checkbox"]');rh(e,"htBadValue")||e.click()}}finishEditing(){}init(){}open(){}close(){}getValue(){}setValue(){}focus(){}}let cS=/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;function cv(e){let t=new Date(e);return Number.isNaN(new Date(`${e}T00:00`).getDate())?t:new Date(t.getTime()+6e4*t.getTimezoneOffset())}function cR(e){if(eP(e))return null;if("string"==typeof e&&cS.test(e)){let[t,r,n]=e.split("-").map(Number);return new Date(t,r-1,n)}return null}let cE=[31,28,31,30,31,30,31,31,30,31,30,31];function cT(e){return e%4==0&&e%100!=0||e%400==0}function cA(e){if("string"!=typeof e||!cS.test(e))return!1;let t=+e.slice(0,4),r=+e.slice(5,7);return+e.slice(8,10)<=(2===r&&cT(t)?29:cE[r-1])}let cM=/^([01]\d|2[0-3]):([0-5]\d)(?::([0-5]\d)(?:\.(\d{1,3}))?)?$/;function cI(e){if(eP(e)||"string"!=typeof e)return null;let t=cM.exec(e);if(!t)return null;let r=Number(t[1]),n=Number(t[2]),o=void 0!==t[3]?Number(t[3]):0,i=t[4];return new Date(1970,0,1,r,n,o,void 0!==i?Number(i.padEnd(3,"0").slice(0,3)):0)}function cx(e){return"string"==typeof e&&cM.test(e)}let cN=/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])(?:[T ]([01]\d|2[0-3]):([0-5]\d)(?::([0-5]\d)(?:\.(\d{1,3}))?)?)?$/;function cO(e){if(eP(e)||"string"!=typeof e)return null;let t=cN.exec(e);if(!t)return null;let[r]=e.split(/[T ]/),[n,o,i]=r.split("-").map(Number);return new Date(n,o-1,i,void 0!==t[3]?Number(t[3]):0,void 0!==t[4]?Number(t[4]):0,void 0!==t[5]?Number(t[5]):0,void 0!==t[6]?Number(t[6].padEnd(3,"0").slice(0,3)):0)}function ck(e){if("string"!=typeof e)return!1;let t=cN.exec(e);if(!t)return!1;let r=+e.slice(0,4),n=+t[1];return+t[2]<=(2===n&&cT(r)?29:cE[n-1])}function cH(){let e=new Date;return new Date(e.getFullYear(),e.getMonth(),e.getDate())}function c_(e){let t=cH();return t.setDate(t.getDate()+e),t}function cL(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}class cP extends cc{static get EDITOR_TYPE(){return"date"}init(){super.init(),this.hot.addHook("afterSetTheme",(e,t)=>{t||this.close()})}prepare(e,t,r,n,o,i){super.prepare(e,t,r,n,o,i),void 0!==i.datePickerConfig&&tJ(this.hot.rootElement,"datePickerConfig",'The "datePickerConfig" option is not supported. The native date input is used instead of Pikaday.');let s=this.hot.toPhysicalRow(e);this.originalValue=this.hot.getSourceDataAtCell(s,t)}createElements(e){super.createElements("input"),this.TEXTAREA.setAttribute("type","date")}setValue(e){if(eP(e)&&(e=this.cellProperties.defaultDate),!cA(e)){tQ(ec`DateEditor: value must be in ISO date format ("YYYY-MM-DD")\x20
        required by the native date input. Received:`,e),super.setValue("");return}super.setValue(e)}focus(){this.TEXTAREA.select()}open(){super.open();try{this.TEXTAREA.showPicker()}catch{}}}class cD extends cy{static get EDITOR_TYPE(){return"dropdown"}prepare(e,t,r,n,o,i){i.filter=!1,i.strict=!0,super.prepare(e,t,r,n,o,i)}finishEditing(e,t,r){if(this.isOpened()){let t=this.hot.getSelectedRangeActive();(eL(t)||e_(t)&&!t.includes(this.hot._createCellCoords(this.row,this.col)))&&(e=!0)}super.finishEditing(e,t,r)}}class cF extends cP{static get EDITOR_TYPE(){return"intl-date"}}let cB=/^\d{4}-\d{2}-\d{2}$/,cV=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}$/;class cU extends cc{static get EDITOR_TYPE(){return"intl-datetime"}init(){super.init(),this.hot.addHook("afterSetTheme",(e,t)=>{t||this.close()})}prepare(e,t,r,n,o,i){super.prepare(e,t,r,n,o,i);let s=this.hot.toPhysicalRow(e);this.originalValue=this.hot.getSourceDataAtCell(s,t)}createElements(e){super.createElements("input"),this.TEXTAREA.setAttribute("type","datetime-local"),this.TEXTAREA.setAttribute("step","1"),this.TEXTAREA.setAttribute("dir","ltr")}setValue(e){if(eP(e))return void super.setValue("");if(!ck(e)){tQ(ec`IntlDatetimeEditor: value must be in ISO date-time format ("YYYY-MM-DDTHH:mm:ss")\x20
        required by the native datetime-local input. Received:`,e),super.setValue("");return}let t=String(e).replace(" ","T").replace(/\.\d+$/,"");cB.test(t)?t+="T00:00:00":cV.test(t)&&(t+=":00"),super.setValue(t)}getValue(){let e=super.getValue();return e&&cV.test(e)?`${e}:00`:e}focus(){this.TEXTAREA.select()}open(){super.open();try{this.TEXTAREA.showPicker()}catch{}}}class cz extends cc{static get EDITOR_TYPE(){return"time"}init(){super.init(),this.hot.addHook("afterSetTheme",(e,t)=>{t||this.close()})}createElements(e){super.createElements("input"),this.TEXTAREA.setAttribute("type","time"),this.TEXTAREA.setAttribute("dir","ltr")}setValue(e){if(!cx(e)){tQ(ec`TimeEditor: value must be in 24-hour time format ("HH:mm", "HH:mm:ss" or "HH:mm:ss.SSS")\x20
        required by the native time input. Received:`,e),super.setValue("");return}super.setValue(e)}focus(){this.TEXTAREA.select()}open(){super.open();try{this.TEXTAREA.showPicker()}catch{}}}class cW extends cz{static get EDITOR_TYPE(){return"intl-time"}}class cG extends cc{static get EDITOR_TYPE(){return"numeric"}}class c$ extends cc{autoResize=cl(this.hot.rootDocument,{textContent:e=>"•".repeat(e.value.length)});#nj="";#nq=null;#nK=null;#nX=!1;static get EDITOR_TYPE(){return"password"}createElements(){super.createElements(),this.TEXTAREA=this.hot.rootDocument.createElement("input"),this.TEXTAREA.setAttribute("type","password"),this.TEXTAREA.dataset.hotInput="",this.TEXTAREA.className="handsontableInput",this.textareaStyle=this.TEXTAREA.style,this.textareaStyle.width="0",this.textareaStyle.height="0",rm(this.TEXTAREA_PARENT);let e=v(-1);this.TEXTAREA.setAttribute(e[0],String(e[1])),this.TEXTAREA_PARENT.appendChild(this.TEXTAREA)}open(){super.open();let e=this.cellProperties.hashRevealDelay,t=String(this.cellProperties.hashSymbol||"*");if(e>0){this.#nX=!0;let r=t[0];this.TEXTAREA.setAttribute("type","text"),this.TEXTAREA.setAttribute("autocomplete","off"),this.TEXTAREA.setAttribute("spellcheck","false"),this.TEXTAREA.setAttribute("autocapitalize","off"),this.TEXTAREA.setAttribute("autocorrect","off"),this.TEXTAREA.value=r.repeat(this.#nj.length),this.#nK=t=>this.#nQ(t,r,e),this.TEXTAREA.addEventListener("input",this.#nK)}}close(){this.#nK&&(this.TEXTAREA.removeEventListener("input",this.#nK),this.#nK=null),null!==this.#nq&&(clearTimeout(this.#nq),this.#nq=null),this.#nX=!1,this.#nj="",this.TEXTAREA.setAttribute("type","password"),this.TEXTAREA.removeAttribute("autocomplete"),this.TEXTAREA.removeAttribute("spellcheck"),this.TEXTAREA.removeAttribute("autocapitalize"),this.TEXTAREA.removeAttribute("autocorrect"),super.close()}getValue(){return this.#nX?this.#nj:super.getValue()}setValue(e){if(this.#nX){this.#nj=e??"";let t=String(this.cellProperties.hashSymbol||"*")[0];this.TEXTAREA.value=t.repeat(this.#nj.length)}else this.cellProperties?.hashRevealDelay>0?this.#nj=e??"":super.setValue(e)}#nQ(e,t,r){let{inputType:n,data:o}=e;if(o&&("insertText"===n||"insertFromPaste"===n||"insertFromDrop"===n||"insertReplacementText"===n||"insertCompositionText"===n)){let e=this.TEXTAREA.selectionStart??0,n=e-o.length,i=this.TEXTAREA.value.length-e;this.#nj=this.#nj.slice(0,n)+o+this.#nj.slice(this.#nj.length-i),this.TEXTAREA.value=t.repeat(n)+o+t.repeat(i),this.TEXTAREA.setSelectionRange(e,e),null!==this.#nq&&clearTimeout(this.#nq),this.#nq=this.hot._registerTimeout(()=>{let e=this.TEXTAREA.selectionStart;this.TEXTAREA.value=t.repeat(this.#nj.length),this.TEXTAREA.setSelectionRange(e,e),this.#nq=null},r)}else if(n?.startsWith("delete")){let e=this.#nj.length,r=this.TEXTAREA.selectionStart??0,n=e-this.TEXTAREA.value.length;this.#nj=this.#nj.slice(0,r)+this.#nj.slice(r+n),this.TEXTAREA.value=t.repeat(this.#nj.length),this.TEXTAREA.setSelectionRange(r,r),null!==this.#nq&&(clearTimeout(this.#nq),this.#nq=null)}else{let e=this.#nj.length,n=this.TEXTAREA.value;if(n.length>e){let o=n.slice(e);this.#nj+=o,this.TEXTAREA.value=t.repeat(e)+o,null!==this.#nq&&clearTimeout(this.#nq),this.#nq=this.hot._registerTimeout(()=>{this.TEXTAREA.value=t.repeat(this.#nj.length),this.#nq=null},r)}else this.#nj=this.#nj.slice(0,n.length),this.TEXTAREA.value=t.repeat(this.#nj.length),null!==this.#nq&&(clearTimeout(this.#nq),this.#nq=null)}}}let cY="ht_editor_visible",cj="selectEditor";class cq extends n3{static get EDITOR_TYPE(){return"select"}init(){this.selectWrapper=this.hot.rootDocument.createElement("div"),this.select=this.hot.rootDocument.createElement("select"),this.select.dataset.hotInput="true",this.selectWrapper.style.display="none";let e=this.hot.rootDocument.createElement("DIV"),t=this.hot.getSettings().ariaTags;e.className="htAutocompleteArrow",t&&e.setAttribute(..._()),e.appendChild(this.hot.rootDocument.createTextNode(String.fromCharCode(9660))),rd(this.selectWrapper,"htSelectEditor"),this.selectWrapper.appendChild(this.select),this.selectWrapper.insertBefore(e,this.selectWrapper.firstChild),this.hot.rootElement.appendChild(this.selectWrapper),this.registerHooks(),this.hot.addHookOnce("afterDestroy",()=>this.destroy())}getValue(){return this.select.value}setValue(e){this.select.value=null==e?"":String(e)}open(){this._opened=!0,this.refreshDimensions(),this.selectWrapper.style.display="",this.hot.getShortcutManager().setActiveContextName("editor"),this.registerShortcuts()}close(){this._opened=!1,this.selectWrapper.style.display="none",rh(this.selectWrapper,cY)&&ru(this.selectWrapper,cY),this.unregisterShortcuts(),this.removeHooksByKey("beforeDialogShow")}focus(){this.select.focus()}registerHooks(){this.addHook("afterScrollHorizontally",()=>this.refreshDimensions()),this.addHook("afterScrollVertically",()=>this.refreshDimensions()),this.addHook("afterColumnResize",()=>this.refreshDimensions()),this.addHook("afterRowResize",()=>this.refreshDimensions())}prepare(e,t,r,n,o,i){let s;super.prepare(e,t,r,n,o,i);let a=this.cellProperties.selectOptions;s="function"==typeof a?this.prepareOptions(a(this.row,this.col,this.prop)):this.prepareOptions(a),rm(this.select);let l=ae(this.hot);if(Array.isArray(s))for(let e=0;e<s.length;e++){let t=this.hot.rootDocument.createElement("OPTION");t.value=String(s[e]),rw(t,String(s[e]),l,"selectEditor",this.hot.rootElement),this.select.appendChild(t)}else tp(s,(e,t)=>{let r=this.hot.rootDocument.createElement("OPTION");r.value=t,rw(r,String(e),l,"selectEditor",this.hot.rootElement),this.select.appendChild(r)})}prepareOptions(e){return Array.isArray(e)||"object"==typeof e?e:{}}refreshValue(){let e=this.hot.getSourceDataAtCell(this.row,this.prop);this.originalValue=e,this.setValue(e),this.refreshDimensions()}refreshDimensions(){if(this.state!==n2.EDITING)return;if(this.TD=this.getEditedCell(),!this.TD)return void this.close();let e=this.getEditedCellRect();if(!e)return;let{top:t,start:r,width:n,height:o}=e,i=this.selectWrapper.style;i.height=`${o}px`,i.width=`${n}px`,i.top=`${t}px`,i[this.hot.isRtl()?"right":"left"]=`${r}px`,i.margin="0px",rd(this.selectWrapper,cY)}registerShortcuts(){let e=this.hot.getShortcutManager().getContext("editor");this.isInFullEditMode()&&e.addShortcuts([{keys:[["ArrowUp"]],callback:()=>{let e=this.select.selectedIndex-1;e>=0&&(this.select[e].selected=!0)}},{keys:[["ArrowDown"]],callback:()=>{let e=this.select.selectedIndex+1;e<=this.select.length-1&&(this.select[e].selected=!0)}}],{group:cj})}unregisterShortcuts(){this.hot.getShortcutManager().getContext("editor").removeShortcutsByGroup(cj)}destroy(){this.clearHooks()}}function cK(e){return e.querySelector('input[type="checkbox"]')}function cX(e,t){return tv(t)?Array.isArray(e)&&e.some(e=>tv(e)?td(e,t):e===t):e.includes(t)}class cQ{input;eventManager;enabled;onInput=this._onInput.bind(this);constructor({input:e,eventManager:t}){this.input=e,this.eventManager=t,this.enabled=!0}getInputElement(){return this.input}setValue(e){this.input.value=e}toggle(e){this.enabled=e,this.input&&(e?this.listen():this.unlisten())}listen(){this.eventManager.addEventListener(this.input,"input",this.onInput)}unlisten(){this.eventManager.removeEventListener(this.input,"input",this.onInput)}_onInput(){this.#nZ(this.input.value)}#nZ(e){this.runLocalHooks("triggerFilter",e)}}th(cQ,ab);let cZ="ht-multi-select-editor",cJ=`${cZ}-search-input-wrapper`,c0=`${cZ}-search-icon`,c1=`${cZ}-search-input`,c2=`${cZ}-separator`,c3=`${cZ}-item-`,c6=`${cZ}-item-selected`;function c5(e){let t=cK(e);rd(e,c6),t&&!t.checked&&(t.checked=!0)}function c4(e){let t=cK(e);ru(e,c6),t&&t.checked&&(t.checked=!1)}function c9(e){let{dropdownListElement:t,index:r}=e,n=t.children[r];if(n){let e=cK(n);e&&e.blur()}}class c7{#nJ=null;#n0=null;#n1=null;#n2=null;#n3=null;#n6=null;#n5=null;#ni=null;#rQ=new n5(this);#n4={visibleRowsNumberSetting:null,entriesCount:0,flippedVertically:!1,currentlySelectedItemIndex:0,checkboxChangeListeners:new Map,areCheckboxesDisabled:!1,sourceSortFunction:null};constructor(e,t){this.#n0=e,this.#ni=this.#n0.ownerDocument,this.#nJ=t,this.init()}init(){if(!this.#ni||!this.#n0)return;this.#n1=function(e){let{root:t}=e;return t.createElement("ul")}({root:this.#ni}),this.#n2=function(e){let{root:t}=e,r=t.createElement("input");return rc(r,[H("Search options"),["type","text"],["size",3],["placeholder","Search..."],["id",c1]]),rd(r,c1),r}({root:this.#ni});let e=function(e){let{root:t}=e,r=t.createElement("div");return rd(r,c0),rc(r,[_()]),r}({root:this.#ni});this.#n6=function(e){let{root:t}=e,r=t.createElement("div");return r.className=cJ,r}({root:this.#ni}),this.#n3=function(e){let{root:t}=e,r=t.createElement("div");return r.className=c2,r}({root:this.#ni}),this.#n6.appendChild(e),this.#n6.appendChild(this.#n2),this.#n0.appendChild(this.#n6),this.#n0.appendChild(this.#n3),this.#n0.appendChild(this.#n1),this.#n5=new cQ({input:this.#n2,eventManager:this.#rQ})}setVisibleRowsNumberSetting(e){this.#n4.visibleRowsNumberSetting=e}setSourceSortFunction(e){this.#n4.sourceSortFunction=e??null}setSearchInputVisibility(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];this.#n6&&this.#n3&&this.#n5&&(this.#n6.style.display=e?"":"none",this.#n3.style.display=e?"":"none",this.#n5.toggle(e))}fillDropdown(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];this.removeAllDropdownItems(),this.#n4.currentlySelectedItemIndex=0,Array.isArray(t)||(t=[]);let r=e;this.#n4.sourceSortFunction&&(r=this.#n4.sourceSortFunction(e.slice())),this.#ni&&this.#n1&&null!==this.#nJ&&(r.forEach((e,r)=>{let n="object"==typeof e&&null!==e&&"value"in e?e.value:e;this.#n9({rootDocument:this.#ni,itemKey:"object"==typeof e&&null!==e&&"key"in e?e.key:void 0,itemValue:String(n??e),indexWithinList:r,checked:cX(t,e),disabled:this.#n4.areCheckboxesDisabled})}),this.#n4.entriesCount=r.length,this.runLocalHooks("afterDropdownFill"))}updateDimensions(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.#n7(),n=this.#n8(e),o=n?e.spaceAbove:e.spaceBelow;if(!t&&n&&(this.#n4.flippedVertically=!0),this.#n4.entriesCount>0&&o<this.getHeight(!0)){let e=Math.max(Math.floor((o-this.#oe())/r)-1,1);this.#n4.actualRenderedItemsCount=this.#n4.visibleRowsNumberSetting?Math.min(e,this.#n4.visibleRowsNumberSetting):e}else this.#n4.actualRenderedItemsCount=Math.min(this.#n4.entriesCount,this.#n4.visibleRowsNumberSetting??this.#n4.entriesCount);this.#n0&&(this.#n4.actualRenderedItemsCount&&this.#n4.entriesCount>this.#n4.actualRenderedItemsCount?this.#n0.style.height=`${this.getHeight()}px`:this.#n0.style.height="",this.#ot(e),this.#n0.scrollTop=0)}getDropdownWidth(){return this.#n1?function(e){let{dropdownListElement:t}=e;return t.offsetWidth}({dropdownListElement:this.#n1}):0}deselectAllItems(){this.#n1&&function(e){let{dropdownListElement:t}=e;t.querySelectorAll(`.${c6}`).forEach(e=>c4(e))}({dropdownListElement:this.#n1})}focusFirstItem(){this.#n4.entriesCount>0&&this.#or(0)}focusItem(e){this.#or(e)}focusPreviousItem(){if(this.#n1){if(0===this.#n4.currentlySelectedItemIndex)return void this.focusSearchInput();c9({dropdownListElement:this.#n1,index:this.#n4.currentlySelectedItemIndex}),this.#or(this.#n4.currentlySelectedItemIndex-1)}}focusNextItem(){this.#n1&&this.#n4.currentlySelectedItemIndex!==this.#n4.entriesCount-1&&(c9({dropdownListElement:this.#n1,index:this.#n4.currentlySelectedItemIndex}),this.#or(this.#n4.currentlySelectedItemIndex+1))}focusSearchInput(){this.#n2&&this.#n2.focus()}reset(){this.removeAllDropdownItems(),this.#on(),this.#n2&&(this.#n2.value=""),this.#n0&&(this.#n0.style.position="",this.#n0.style.top="",this.#n0.style.height="",this.#n0.scrollTop=0)}isFlippedVertically(){return this.#n4.flippedVertically}getHeight(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.#ni||!this.#n0)return 0;let r=this.#ni.defaultView.getComputedStyle(this.#n0);return this.#oo(e)+this.#oe()+(!0===t?2*parseInt(r.getPropertyValue("--ht-menu-vertical-padding"),10):0)}getInputController(){return this.#n5}removeAllDropdownItems(){this.#n1&&(Array.from(this.#n1.children).forEach(e=>this.#oi(e)),this.#n4.checkboxChangeListeners.clear(),this.#n1.innerHTML="")}disableCheckboxes(){this.#n4.areCheckboxesDisabled=!0,this.#n1&&function(e){let{dropdownListElement:t}=e;t.querySelectorAll('input[type="checkbox"]:not(:checked)').forEach(e=>{e.dataset.disabled="true"})}({dropdownListElement:this.#n1})}enableCheckboxes(){this.#n4.areCheckboxesDisabled=!1,this.#n1&&function(e){let{dropdownListElement:t}=e;t.querySelectorAll('input[type="checkbox"]').forEach(e=>{e.dataset.disabled="false"})}({dropdownListElement:this.#n1})}#or(e){this.#n4.currentlySelectedItemIndex=e,this.#n1&&function(e){let{dropdownListElement:t,index:r}=e,n=t.children[r];if(n){let e=cK(n);e&&e.focus()}}({dropdownListElement:this.#n1,index:e})}#n8(e){let{spaceAbove:t,spaceBelow:r,cellHeight:n}=e;return this.getHeight(!0)>r&&t>r+n}#ot(e){if(!this.#n0)return;let{cellHeight:t}=e;this.#n4.flippedVertically?(this.#n0.style.position="absolute",this.#n0.style.top=`${-this.getHeight(!1,!0)-t-2}px`):(this.#n0.style.position="",this.#n0.style.top="")}#n7(){if(!this.#ni||!this.#n0)return 0;let e=this.#ni.defaultView.getComputedStyle(this.#n0);return 2*parseInt(e.getPropertyValue("--ht-menu-item-vertical-padding"),10)+parseInt(e.getPropertyValue("--ht-line-height"),10)}#oo(e){let t=this.#n4.entriesCount;return(e?t:this.#n4.actualRenderedItemsCount??t)*this.#n7()}#oe(){if(!this.#n5?.enabled||!this.#n6||!this.#n3||!this.#ni||!this.#n0)return 0;let e=this.#ni.defaultView.getComputedStyle(this.#n0);return this.#n6.offsetHeight+(this.#n3.offsetHeight+2*parseInt(e.getPropertyValue("--ht-menu-vertical-padding"),10))}#n9(e){let{rootDocument:t,itemKey:r,itemValue:n,indexWithinList:o,checked:i=!1,disabled:s=!1}=e;if(!this.#n1||null===this.#nJ)return;let a=function(e){let{rootDocument:t,instanceId:r,itemKey:n,itemValue:o,indexWithinList:i,checked:s=!1,disabled:a=!1}=e,l=t.createElement("li"),h=t.createElement("div"),d=t.createElement("input"),u=t.createElement("label");return d.id=`${r}-${c3}${i}`,d.type="checkbox",d.dataset.value=o,d.dataset.index=String(i),d.dataset.disabled=a&&!s?"true":"false",n&&(d.dataset.key=n),u.htmlFor=d.id,u.textContent=o,h.appendChild(d),h.appendChild(u),l.appendChild(h),l}({rootDocument:t,instanceId:this.#nJ,itemKey:r,itemValue:n,indexWithinList:o,checked:i,disabled:s});i&&c5(a),this.#os(a),this.#n1.appendChild(a)}#os(e){let t=cK(e);if(!t||!this.#n1)return;let r=()=>{if("true"===t.dataset.disabled&&t.checked){t.checked=!1;return}t.checked?(c5(e),this.runLocalHooks("afterDropdownItemChecked",t.dataset.key,t.dataset.value)):(c4(e),this.runLocalHooks("afterDropdownItemUnchecked",t.dataset.key,t.dataset.value))},n=e=>{let r=t4(e);r!==t&&"true"!==t.dataset.disabled&&"LABEL"!==r.tagName&&(t.checked=!t.checked,t.dispatchEvent(new Event("change")))};this.#n4.checkboxChangeListeners.set(t,{change:r,click:n}),this.#rQ.addEventListener(t,"change",r),this.#rQ.addEventListener(e,"click",n)}#oi(e){let t=cK(e);if(!t)return;let r=this.#n4.checkboxChangeListeners.get(t);r&&(this.#rQ.removeEventListener(t,"change",r.change),this.#rQ.removeEventListener(e,"click",r.click),this.#n4.checkboxChangeListeners.delete(t))}#on(){this.#n4.visibleRowsNumberSetting=null,this.#n4.entriesCount=0,this.#n4.flippedVertically=!1,this.#n4.currentlySelectedItemIndex=0,this.#n4.checkboxChangeListeners.clear(),this.#n4.areCheckboxesDisabled=!1,this.#n4.sourceSortFunction=null}}th(c7,ab);class c8{selectedItems;maxSelectionsCount;constructor(e){Array.isArray(e)?this.selectedItems=new Set(e):this.selectedItems=new Set,this.maxSelectionsCount=1/0}setMaxSelectionCount(e){this.maxSelectionsCount=e}add(e){this.selectedItems.size>=this.maxSelectionsCount||(Array.isArray(e)?e.forEach(e=>this.selectedItems.add(e)):this.selectedItems.add(e))}remove(e){if(!tv(e))return this.selectedItems.delete(e);{let t=Array.from(this.selectedItems).find(t=>td(t,e));if(void 0!==t)return this.selectedItems.delete(t),!0}return!1}has(e){return cX(this.getItemsArray(),e)}clear(){this.selectedItems.clear()}getSize(){return this.selectedItems.size}getItemsArray(){return Array.from(this.selectedItems)}}let ge="multiselect",gt="multiselectEditor";class gr extends n3{_closeAfterDataChange=!1;#oa=new c8;#ol=null;dropdownContainerElement=null;dropdownController=null;static get EDITOR_TYPE(){return ge}constructor(e){super(e),this.eventManager=new n5(this),this.createElements(),this.bindEvents()}createElements(){let{rootDocument:e}=this.hot;this.#ol=e.createElement("div"),this.#ol.style.display="none",rd(this.#ol,"handsontableEditor"),this.dropdownContainerElement=this.hot.rootDocument.createElement("div"),rd(this.dropdownContainerElement,"ht-multi-select-editor handsontableEditor"),rc(this.dropdownContainerElement,[H("Select options"),["role","group"]]),this.#ol.appendChild(this.dropdownContainerElement),this.hot.rootElement.appendChild(this.#ol),this.dropdownController=new c7(this.dropdownContainerElement,this.hot.guid)}prepare(e,t,r,n,o,i){super.prepare(e,t,r,n,o,i);let s="string"==typeof o&&od(o)?JSON.parse(o):o,a=el(Array.isArray(s)?s:[s],this.#oh(),(e,t)=>JSON.stringify(e)===JSON.stringify(t));this.dropdownController.reset(),a.length>=this.#od("maxSelections")&&this.#ou(),this.#oc(a),this.dropdownController.setSourceSortFunction(this.#od("sourceSortFunction")??null),this.dropdownController.fillDropdown(this.#oh(),a),this.dropdownController.setVisibleRowsNumberSetting(this.#od("visibleRows")),this.dropdownController.setSearchInputVisibility(this.#od("searchInput")),void 0!==i.maxSelections&&this.#oa.setMaxSelectionCount(this.#od("maxSelections"))}finishEditing(e,t,r){super.finishEditing(e,t,r)}bindEvents(){this.dropdownController.addLocalHook("afterDropdownItemChecked",(e,t)=>{this.#og(e,t),this.#oa.getSize()>=this.#od("maxSelections")&&this.#ou()}),this.dropdownController.addLocalHook("afterDropdownItemUnchecked",(e,t)=>{this.#op(e,t),this.#oa.getSize()<this.#od("maxSelections")&&this.#om()}),this.addHook("afterDestroy",()=>this.destroy()),this.addHook("afterChange",(e,t)=>this.#of(e,t)),this.addHook("afterScrollHorizontally",()=>this.refreshDimensions()),this.addHook("afterScrollVertically",()=>this.refreshDimensions()),this.dropdownController.getInputController().addLocalHook("triggerFilter",e=>this.#ob(e))}open(e){let t=e&&"keyCode"in e?e.keyCode:0,r=e&&"key"in e?e.key:"";if(t&&nC(t)){let n=1===r.length?r:String.fromCharCode(t);this.dropdownController.getInputController().enabled&&(this.dropdownController.getInputController().setValue(n),this.#ob(n)),e?.preventDefault(),this.enableFullEditMode()}this.#oC(),this.refreshDimensions(),this.hot.getShortcutManager().setActiveContextName("editor"),this.#oy(),this.dropdownController.getInputController().listen(),this.dropdownController.updateDimensions(this.#ow())}close(){this.#oS(),this.#ov(),this.dropdownController.getInputController().unlisten()}getValue(){return this.#oa.getItemsArray()}setValue(){}refreshDimensions(){if(!this.getEditedCell())return void this.close();let{top:e,start:t,height:r}=this.getEditedCellRect(),n=this.#ol.style;n.top=`${e+r}px`,n[this.hot.isRtl()?"right":"left"]=`${t}px`,rd(this.#ol,"ht_editor_visible")}focus(){!1===this.#od("searchInput")?this.dropdownController.focusFirstItem():this.dropdownController.focusSearchInput()}getInputElement(){return this.dropdownController.getInputController().getInputElement()}destroy(){this.close(),this.dropdownController.reset()}#oh(){return this.cellProperties.source??[]}#oy(){let e=this.hot.getShortcutManager().getContext("editor");e.addShortcuts([{keys:[["ArrowUp"]],callback:()=>{this.dropdownController.focusPreviousItem()}},{keys:[["ArrowDown"]],callback:()=>{ni(this.hot.rootDocument)===this.getInputElement()?this.dropdownController.focusFirstItem():this.dropdownController.focusNextItem()}}],{group:gt}),e.addShortcuts([{keys:[["enter"],["shift","enter"],["control/meta","enter"],["control/meta","shift","enter"]],runOnlyIf:()=>!this.#od("enterCommits"),callback:e=>{let t=ni(this.hot.rootDocument);return t instanceof HTMLInputElement&&"checkbox"===t.type&&(t.checked=!t.checked,t.dispatchEvent(new Event("change"))),e.preventDefault(),!1}},{keys:[["space"]],runOnlyIf:()=>!this.#od("enterCommits"),callback:e=>{e.preventDefault()}}],{group:gt,relativeToGroup:dY,position:"before"})}#ov(){this.hot.getShortcutManager().getContext("editor").removeShortcutsByGroup(gt)}#oC(){this.#ol.style.display=""}#oS(){this.#ol.style.display="none"}#ou(){this.dropdownController.disableCheckboxes()}#om(){this.dropdownController.enableCheckboxes()}#ob(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.#od("filterSelectedItems")??!0,r=this.cellProperties.locale,n=this.#oh().filter(n=>{let o="object"==typeof n&&null!==n&&"value"in n?n.value:n;return!!(!t&&this.#oa.has(n))||(this.cellProperties.filteringCaseSensitive?String(o).includes(e):ow(String(o),r).includes(ow(e,r)))});this.dropdownController.fillDropdown(n,this.#oa.getItemsArray()),this.dropdownController.updateDimensions(this.#ow(),!0)}#ow(){let e=this.getEditedCellRect(),t=this.hot.view.isVerticallyScrollableByWindow(),r=this.hot.view.getWorkspaceHeight(),n=e.top;t&&(n=Math.max(n+(this.hot.view.getTableOffset().top-this.hot.rootWindow.scrollY),0));let o=r-n-e.height;return{spaceAbove:n,spaceBelow:o,cellHeight:e.height}}#oR(){let e=this.#oa.getItemsArray();this.saveValue([[e]])}#og(e,t){e?this.#oa.add({key:e,value:t}):this.#oa.add(t),this.#oR(),this.refreshDimensions()}#op(e,t){e?this.#oa.remove({key:e,value:t}):this.#oa.remove(t),this.#oR(),this.refreshDimensions()}#oc(e){e.length>0?this.#oa=new c8(e):this.#oa=new c8}#od(e){return this.cellProperties[e]}#of(e,t){this.isOpened()&&t===`${ge}-renderer`&&Array.isArray(e)&&e.length>0&&e[0][0]===this.cellProperties.visualRow&&this.hot.propToCol(e[0][1])===this.cellProperties.visualCol&&(this.#oc(e[0][3]),this.dropdownController.fillDropdown(this.#oh(),this.#oa.getItemsArray()),this.dropdownController.focusItem(0),this.#oa.getSize()>=this.#od("maxSelections")?this.#ou():this.#om())}}function gn(e,t,r,n,o,i,s){rw(t,null==i?"":i,!1)}function go(e,t,r,n,o,i,s){let{rootDocument:a}=e,l=s.allowHtml?gn:cg,h=a.createElement("DIV"),d=e.getSettings().ariaTags;if(h.className="htAutocompleteArrow",d&&h.setAttribute(..._()),h.appendChild(a.createTextNode(String.fromCharCode(9660))),l.apply(this,[e,t,r,n,o,i,s]),t.firstChild||t.appendChild(a.createTextNode(String.fromCharCode(160))),t.insertBefore(h,t.firstChild),rd(t,"htAutocomplete"),!e.acArrowListener){let o=new n5(e);e.acArrowListener=function(o){rh(t4(o),"htAutocompleteArrow")&&e.view._wt.getSetting("onCellDblClick",null,e._createCellCoords(r,n),t)},o.addEventListener(e.rootElement,"mousedown",e.acArrowListener),e.addHookOnce("afterDestroy",()=>{o.destroy()})}}function gi(e,t,r,n,o,i,s){go.apply(this,[e,t,r,n,o,i,s])}gn.RENDERER_TYPE="html",go.RENDERER_TYPE="autocomplete",gi.RENDERER_TYPE="dropdown";let gs="#bad-value#",ga="ht-loading",gl=new WeakMap,gh=new WeakMap,gd="data-row",gu="data-col",gc="checkbox";function gg(e,t,r,n,o,i,s){let a,l,{rootDocument:h}=e,d=e.getSettings().ariaTags;!function(e){let t=gh.get(e);if(!t){let{rootElement:r}=e;(t=new n5(e)).addEventListener(r,"click",t=>(function(e,t){let r=t4(e);if(!gp(r)||!r.hasAttribute(gd)||!r.hasAttribute(gu))return;let n=Number.parseInt(r.getAttribute(gd),10),o=Number.parseInt(r.getAttribute(gu),10);t.getCellMetaTransient(n,o).readOnly&&e.preventDefault()})(t,e)),t.addEventListener(r,"mouseup",t=>{var r,n;let o;return r=t,n=e,void(!gp(o=t4(r))||o.hasAttribute(gd)&&o.hasAttribute(gu)&&setTimeout(n.listen,10))}),t.addEventListener(r,"change",t=>(function(e,t){let r=t4(e);if(!gp(r)||!r.hasAttribute(gd)||!r.hasAttribute(gu))return;let n=Number.parseInt(r.getAttribute(gd),10),o=Number.parseInt(r.getAttribute(gu),10),i=t.getCellMetaTransient(n,o);if(!i.readOnly){let e=null;e=r.checked?void 0===i.uncheckedTemplate||i.checkedTemplate:void 0!==i.uncheckedTemplate&&i.uncheckedTemplate,t.setDataAtCell(n,o,e)}})(t,e)),gh.set(e,t)}}(e);let u=((a=h.createElement("input")).className="htCheckboxRendererInput",a.type="checkbox",a.setAttribute("tabindex","-1"),a.cloneNode(!1)),c=u,g=s.label,p=!1;void 0===s.checkedTemplate&&(s.checkedTemplate=!0),void 0===s.uncheckedTemplate&&(s.uncheckedTemplate=!1),rm(t);let m=s.locale;i===s.checkedTemplate||ow(eH(i),m)===ow(eH(s.checkedTemplate),m)?u.checked=!0:i===s.uncheckedTemplate||ow(eH(i),m)===ow(eH(s.uncheckedTemplate),m)?u.checked=!1:eP(i)?rd(u,"noValue"):(u.style.display="none",rd(u,"htBadValue"),p=!0),rc(u,[[gd,r],[gu,n]]),d&&rc(u,[H(u.checked?e.getTranslatedPhrase(hg):e.getTranslatedPhrase(hp)),G(u.checked),["role","checkbox"]]),function(){if(!p&&g){let s="";if(g.value){let e=g.value;s="function"==typeof g.value?String(e(r,n,o,i)):String(g.value)}else if(g.property){let t=e.getDataAtRowProp(r,String(g.property));s=null!==t?String(t):""}let a=function(e,t,r){let n=e.createElement("label");n.className=`htCheckboxRendererLabel ${r?"fullWidth":""}`;let o=e.createTextNode(t);if(r){let t=e.createElement("span");t.appendChild(o),n.appendChild(t)}else n.appendChild(o);return n.cloneNode(!0)}(h,s,!0!==g.separated);"before"===g.position?g.separated?(t.appendChild(a),t.appendChild(u)):(a.appendChild(u),c=a):g.position&&"after"!==g.position||(g.separated?(t.appendChild(u),t.appendChild(a)):(a.insertBefore(u,a.firstChild),c=a))}}();function f(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=e.getSelectedRange(),n=[],o=new Map,i=[],s=0;if(r){for(let a=0;a<r.length;a++){let{row:l,col:h}=r[a].getTopStartCorner(),{row:d,col:u}=r[a].getBottomEndCorner();if(null!==l&&null!==h&&null!==d&&null!==u){for(let r=l;r<=d;r+=1)for(let a=h;a<=u;a+=1){let l=e.getCellMetaTransient(r,a);if(l.hidden)continue;let h={checkedTemplate:l.checkedTemplate,uncheckedTemplate:l.uncheckedTemplate};if("checkbox"!==l.type){!0!==t||l.readOnly||(o.has(n.length)?o.set(n.length,[...o.get(n.length),[r,a,null]]):o.set(n.length,[[r,a,null]]));continue}if(!0===l.readOnly)continue;void 0===l.checkedTemplate&&(l.checkedTemplate=!0),void 0===l.uncheckedTemplate&&(l.uncheckedTemplate=!1);let d=e.getDataAtCell(r,a);!1===t?[l.checkedTemplate,String(l.checkedTemplate)].includes(d)?i.push([r,a,l.uncheckedTemplate,h]):[l.uncheckedTemplate,String(l.uncheckedTemplate),null,void 0].includes(d)&&i.push([r,a,l.checkedTemplate,h]):i.push([r,a,l.uncheckedTemplate,h]),s+=1}n.push(s),s=0}}if((i=i.every(e=>{let[,,t]=e;return t===i[0][2]})?i.map(e=>{let[t,r,n]=e;return[t,r,n]}):i.map(e=>{let[t,r,,n]=e;return[t,r,n?.checkedTemplate]})).length>0){let r=[];if(n.forEach((e,t)=>{let n=i.splice(0,e);o.size&&o.has(t)&&(n=[...n,...o.get(t)??[]]),r.push(n)}),t){let t=[];r.forEach(e=>{e.forEach(e=>{t.push(e)})}),t.length>0&&e.setDataAtCell(t)}else r.forEach(t=>{t.length>0&&e.setDataAtCell(t)})}}}function b(){let t=e.getSelectedRange();if(t){for(let r=0;r<t.length;r++){let n=t[r].getTopStartCorner(),o=t[r].getBottomEndCorner();if(null!==n.row&&null!==n.col&&null!==o.row&&null!==o.col)for(let t=n.row;t<=o.row;t++)for(let r=n.col;r<=o.col;r++){if(e.getCellMetaTransient(t,r).readOnly)continue;let n=e.getCell(t,r);if(ne(n)&&n.querySelectorAll("input[type=checkbox]").length>0)return!0}}return!1}}g&&(!g||g.separated)||t.appendChild(c),p&&t.appendChild(h.createTextNode(gs)),gl.has(e)||(gl.set(e,!0),l=e.getShortcutManager().getContext("grid"),l?.addShortcuts([{keys:[["space"]],callback:()=>(f(),!b()),runOnlyIf:()=>!!e.getSelectedRangeActive()?.highlight.isCell()},{keys:[["enter"]],callback:()=>(f(),!b()),runOnlyIf:()=>{let t=e.getSelectedRangeActive();return!!(e.getSettings().enterBeginsEditing&&t?.highlight.isCell()&&!e.selection.isMultiple())}},{keys:[["delete"],["backspace"]],callback:()=>(f(!0),!b()),runOnlyIf:()=>!!e.getSelectedRangeActive()?.highlight.isCell()}],{group:"checkboxRenderer",relativeToGroup:dY,position:"before"}))}function gp(e){return"INPUT"===e.tagName&&"checkbox"===e.getAttribute("type")}function gm(e,t,r,n,o,i,s){go.apply(this,[e,t,r,n,o,i,s])}nF.getSingleton().add("modifyAutoColumnSizeSeed",function(e,t,r){let{label:n,type:o,row:i,column:s,prop:a}=t;if(o!==gc||!n)return;let{value:l,property:h}=n,d=r;if(l)d="function"==typeof l?l(i,s,a,r):l;else if(h){let e=this.getDataAtRowProp(i,String(h));d=null!==e?e:r}return`${eH(d).length}`}),gg.RENDERER_TYPE=gc,gm.RENDERER_TYPE="handsontable";let gf={year:"numeric",month:"2-digit",day:"2-digit"},gb=new WeakSet;function gC(e,t){let{dateFormat:r,locale:n,allowEmpty:o,instance:i}=t;if(eP(e))return o?e:gs;if("string"==typeof r)return i&&!gb.has(i)&&(gb.add(i),tQ("The dateFormat option as a string is not supported. Use an Intl.DateTimeFormatOptions object instead.")),e;let s=cR(e);if(null===s)return gs;let a=tc(r)?r:gf;return new Intl.DateTimeFormat(n,a).format(s)}function gy(e,t,r,n,o,i,s){cg.apply(this,[e,t,r,n,o,i,s])}function gw(e,t,r,n,o,i,s){gy.apply(this,[e,t,r,n,o,i,s])}gy.valueFormatter=gC,gy.RENDERER_TYPE="date",gw.valueFormatter=gC,gw.RENDERER_TYPE="intl-date";let gS={year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1},gv=new WeakSet;function gR(e,t){let{dateTimeFormat:r,locale:n,allowEmpty:o,instance:i}=t;if(eP(e))return o?e:gs;if("string"==typeof r)return i&&!gv.has(i)&&(gv.add(i),tQ("The dateTimeFormat option as a string is not supported. Use an Intl.DateTimeFormatOptions object instead.")),e;let s=cO(e);if(null===s)return gs;let a=tc(r)?r:gS;return new Intl.DateTimeFormat(n,a).format(s)}function gE(e,t,r,n,o,i,s){cg.apply(this,[e,t,r,n,o,i,s])}gE.valueFormatter=gR,gE.RENDERER_TYPE="intl-datetime";let gT={hour:"numeric",minute:"2-digit"},gA=new WeakSet;function gM(e,t){let{timeFormat:r,locale:n,allowEmpty:o,instance:i}=t;if(eP(e))return o?e:gs;let s=cI(e);if(null===s)return gs;"string"==typeof r&&i&&!gA.has(i)&&(gA.add(i),tQ("The timeFormat option as a string is not supported. Use an Intl.DateTimeFormatOptions object instead."));let a=tc(r)?r:gT;return new Intl.DateTimeFormat(n,a).format(s)}function gI(e,t,r,n,o,i,s){cg.apply(this,[e,t,r,n,o,i,s]),t.dir="ltr"}function gx(e,t,r,n,o,i,s){gI.apply(this,[e,t,r,n,o,i,s])}gI.valueFormatter=gM,gI.RENDERER_TYPE="time",gx.RENDERER_TYPE="intl-time";let gN={useGrouping:!1,maximumFractionDigits:20},gO=new Map,gk=new WeakSet;function gH(e,t){return oS(e)&&(e=function(e,t){let{numericFormat:r,locale:n}=t,o=r??gN,i=`${n??""}:${JSON.stringify(o)}`,s=gO.get(i);return void 0===s&&(s=new Intl.NumberFormat(n,o),gO.set(i,s)),s.format(e)}(e,t)),e}function g_(e,t,r,n,o,i,s){let a=s.numericFormat;if(a?.pattern!==void 0||a?.culture!==void 0){let e=s.instance;gk.has(e)||(gk.add(e),tQ("The numericFormat.pattern and numericFormat.culture options are not supported. Use Intl.NumberFormat options instead (numericFormat: { style, currency, ... })."))}if(oS(e.getDataAtCell(r,n))){let e=[];if(Array.isArray(s.className))e=s.className;else{let t=s.className??"";t.length&&(e=t.split(" "))}0>e.indexOf("htLeft")&&0>e.indexOf("htCenter")&&0>e.indexOf("htRight")&&0>e.indexOf("htJustify")&&e.push("htRight"),0>e.indexOf("htNumeric")&&e.push("htNumeric"),s.className=e.join(" "),t.dir="ltr"}cg.apply(this,[e,t,r,n,o,i,s])}function gL(e,t,r,n,o,i){rw(t,i,ae(e),"password",e.rootElement)}function gP(e,t,r,n,o,i,s){cg.apply(this,[e,t,r,n,o,i,s])}function gD(e,t){let r=e=>{let t;return tc(t=e)&&e_(t.key)&&e_(t.value)?r(e.key)&&r(e.value):null==e},n=e;(r(n)&&(n=""),""===n)?t(!!this.allowEmpty):this.strict&&this.source?"function"==typeof this.source?this.source(n,gF(n,t)):gF(n,t)(this.source):t(!0)}function gF(e,t){return function(r){let n=!1;for(let t=0,o=r.length;t<o;t++)if(td(e,r[t])){n=!0;break}t(n)}}function gB(e,t){return!!(t.allowEmpty&&eP(e)||"string"==typeof e&&e.startsWith("="))||cA(e)}function gV(e,t){t(!!(this.allowEmpty&&eP(e))||cA(e))}function gU(e,t){gD.apply(this,[e,t])}function gz(e,t){gV.call(this,e,t)}function gW(e,t){return!!(t.allowEmpty&&eP(e)||"string"==typeof e&&e.startsWith("="))||ck(e)}function gG(e,t){t(!!(this.allowEmpty&&eP(e))||ck(e))}function g$(e,t){return!!(t.allowEmpty&&eP(e)||"string"==typeof e&&e.startsWith("="))||cx(e)}function gY(e,t){t(!!(this.allowEmpty&&eP(e))||cx(e))}function gj(e,t){gY.call(this,e,t)}function gq(e,t){let r=e;(null==r&&(r=""),this.allowEmpty&&""===r)?t(!0):(this.allowEmpty||""!==r)&&Array.isArray(r)?0===r.length?t(!0):this.source?"function"==typeof this.source?this.source(r,gK(r,t)):gK(r,t)(this.source):t(!0):t(!1)}function gK(e,t){return function(r){let n=!0;for(let t=0,o=e.length;t<o;t++){let o=!1;for(let n=0,i=r.length;n<i;n++)if(tv(e[t])&&!tv(r[n])||!tv(e[t])&&tv(r[n])){o=!1;break}else tv(e[t])&&tv(r[n])&&td(e[t],r[n])?o=!0:"string"==typeof e[t]&&"string"==typeof r[n]&&e[t]===r[n]&&(o=!0);if(!o){n=!1;break}}t(n)}}function gX(e,t){let r=e;null==r&&(r=""),t(!!this.allowEmpty&&""===r||""!==r&&oS(e))}function gQ(e){return tc(e)&&void 0!==e.value?e.value:e}function gZ(e,t,r){return tv(this.getSourceDataAtCell(this.toPhysicalRow(t),this.toPhysicalColumn(r)))?tv(e)?e:{key:e,value:e}:e}g_.valueFormatter=gH,g_.RENDERER_TYPE="numeric",gL.valueFormatter=function(e,t){let r=t.hashLength||eH(e).length,n=String(t.hashSymbol??"*"),o="";for(let e=0;e<r;e++)o+=n;return o},gL.RENDERER_TYPE="password",gP.RENDERER_TYPE="select",gD.VALIDATOR_TYPE="autocomplete",gB.rowIndependent=!0,gV.VALIDATOR_TYPE="date",gU.VALIDATOR_TYPE="dropdown",gz.VALIDATOR_TYPE="intl-date",gW.rowIndependent=!0,gG.VALIDATOR_TYPE="intl-datetime",g$.rowIndependent=!0,gY.VALIDATOR_TYPE="time",gj.VALIDATOR_TYPE="intl-time",gq.VALIDATOR_TYPE="multiselect",gX.VALIDATOR_TYPE="numeric";let gJ="ht-multi-select",g0=`${gJ}-chip`,g1=`${gJ}-chip-remove`,g2=`${gJ}-chip-label`,g3=`${gJ}-overflow`,g6=new WeakSet,g5=new WeakMap,g4=new WeakMap;function g9(e,t){return tv(e)?e[t]:e}function g7(e){if(null==e||""===e)return[];if(Array.isArray(e))return e;if("string"==typeof e)try{let t=JSON.parse(e);return Array.isArray(t)?t:[t]}catch{return e.trim()?[e]:[]}return[e]}function g8(e){return Array.isArray(e)?eu(e.map(e=>tv(e)?e.value:e),", "):e}let pe={CELL_TYPE:"multiselect",_complexDataFormat:!0,editor:gr,renderer:function(e,t,r,n,o,i,s){co(e,t,r,n,o,i,s);let a=i;if(eP(a)&&s.placeholder)return void rS(t,a=eH(a=s.placeholder));let{rootDocument:l}=e,h=e.getSettings().ariaTags,d=e.toPhysicalRow(r),u=g7(e.getSourceDataAtCell(d,n));if(rm(t),rd(t,"ht-multi-select-renderer"),0===u.length)return void t.appendChild(l.createTextNode(""));let c=l.createElement("div");c.className="ht-multi-select-chips-container",u.forEach(e=>{var t;let i,s,a,d,u=(t=h??!1,i=l.createElement("span"),s=g9(e,"value"),rd(i,g0),i.dataset.row=String(r),i.dataset.col=String(n),i.dataset.prop=String(o),i.title=s,rd(a=l.createElement("span"),g2),a.textContent=s,i.appendChild(a),rd(d=l.createElement("span"),g1),t&&d.setAttribute(..._()),i.dataset.key=g9(e,"key"),i.appendChild(d),i);c.appendChild(u)}),t.appendChild(c),g4.has(e)||(g4.set(e,new n5(e)),g4.get(e).addEventListener(e.rootElement,"click",t=>{var r,n;if(!rh(t4(t),g1))return;t.preventDefault(),t.stopPropagation();let o=t4(t).closest(`.${g0}`);if(!o)return;let i=Number(o.dataset.row??0),s=Number(o.dataset.col??0),a=e.toPhysicalRow(i),l=e.getSourceDataAtCell(a,s),h=o.dataset.key,d=(r=g7(l),n=h,r.filter(e=>g9(e,"key")!==n));e.setDataAtCell(i,s,d,"multiselect-renderer")}),e.addHook("beforeOnCellMouseDown",function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];let n=t[0];rh(t4(n),g1)&&nR(n)})),function(e,t,r){let n=t.querySelectorAll(`.${g0}`);for(let e=0;e<n.length;e++)n[e].style.display="";if(null===e||0===n.length)return;let o=t.querySelector(`.${g3}`);if(o)o.style.display="",o.style.visibility="hidden";else{var i;let e;i=n.length,rd(e=r.createElement("span"),g3),e.textContent=`+${i}`,(o=e).style.visibility="hidden",t.appendChild(o)}let s=parseFloat(r.defaultView.getComputedStyle(t).gap)||0,a=o.offsetWidth,l=0,h=0;for(let t=0;t<n.length;t++){let r=l+n[t].offsetWidth+(t<n.length-1?s:0);if(r<=e-(t<n.length-1?a+s:0))l=r,h+=1;else break}let d=n.length-h;if(d>0){for(let e=h;e<n.length;e++)n[e].style.display="none";o.textContent=`+${d}`,o.style.visibility="visible"}else o.style.display="none"}(function(e,t){let r=e.getColWidth(t);if(g5.has(e)){let n=g5.get(e);n[t]?.width!==r&&g5.set(e,{...n,[t]:{width:r}})}else g5.set(e,{[t]:{width:r}});return g6.has(e)||(e.addHook("beforeColumnResize",function(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];let o=r[0],i=r[1],s=g5.get(e);s?.[i]?.width!==o&&g5.set(e,{...s,[i]:{width:o}})}),g6.add(e)),g5.get(e)?.[t]?.width??r}(e,n),c,l)},validator:gq,valueGetter:g8,valueSetter:function(e,t,r){if(Array.isArray(e)){let n=this.getSourceDataAtCell(this.toPhysicalRow(t),r);if(Array.isArray(n)&&n.length>0&&tv(n[0]))return e.map(e=>tv(e)?e:{key:e,value:e})}return e},parsePastedValue:!0},pt=[];function pr(e,t){if(Array.isArray(e)){"string"!=typeof t&&tr("registerConflict(blockedTargetKeys[], incompatibleSettingKeys) expects incompatibleSettingKeys to be a string.");for(let r=0;r<e.length;r+=1)pt.push({blockedKey:e[r],incompatibleSettingKey:t});return}if("string"!=typeof e&&tr("registerConflict expects a string blocked target key when the first argument is not an array."),Array.isArray(t)){for(let r=0;r<t.length;r+=1){let n=t[r];"string"!=typeof n&&tr("registerConflict(blockedTargetKey, incompatibleSettingKeys) expects incompatibleSettingKeys to be a string array."),pt.push({blockedKey:e,incompatibleSettingKey:n})}return}"string"==typeof t?pt.push({blockedKey:e,incompatibleSettingKey:t}):tr("Invalid registerConflict arguments.")}let pn=new Map([["plugin",function(e){return!!o$(e)}],["cell-type",da],["editor",nG],["renderer",oK],["validator",o2]]),po=Symbol("mainSetting"),pi=[],ps=null;class pa{static get PLUGIN_KEY(){return"base"}static get SETTING_KEYS(){return[this.PLUGIN_KEY]}static get DEFAULT_SETTINGS(){return{}}static get SETTINGS_VALIDATORS(){return null}static PLUGIN_DEPS;#oE=null;eventManager=new n5(this);pluginName=null;pluginsInitializedCallbacks=[];isPluginsReady=!1;enabled=!1;initialized=!1;#e={};constructor(e){tg(this,"hot",e,{writable:!1}),ps=null,this.hot.addHook("afterPluginsInitialized",()=>this.onAfterPluginsInitialized()),this.hot.addHook("afterUpdateSettings",e=>{this.onUpdateSettings(e)}),this.hot.addHook("beforeInit",()=>this.init())}init(){this.pluginName=this.hot.getPluginName(this),this.updatePluginSettings(this.hot.getSettings()[this.constructor.PLUGIN_KEY]);let e=this.constructor.PLUGIN_DEPS,t=Array.isArray(e)?e:[];if(t.length>0){let e=[];if(t.forEach(t=>{let[r,n]=t.split(":");pn.has(r)||tr(`Unknown plugin dependency type "${r}" was found.`),pn.get(r)(n)||e.push(` - ${n} (${r})`)}),e.length>0){let t=`The ${this.pluginName} plugin requires the following modules:
${e.join("\n")}
`;pi.push(t)}}if(ps||(ps=oG()),ps.indexOf(this.pluginName)>=0&&ps.splice(ps.indexOf(this.pluginName),1),this.hot.addHookOnce("afterPluginsInitialized",()=>{if(this.isEnabled&&this.isEnabled()){if(this.isHardConflictBlocked()){this.hot.getSettings()[this.constructor.PLUGIN_KEY]=!1;return}this.enablePlugin()}}),0===ps.length){if(pi.length>0){let e=`${pi.join("\n")}
You have to import and register them manually.`;pi.length=0,tr(e)}this.hot.runHooks("afterPluginsInitialized")}this.initialized=!0}isHardConflictBlocked(){let e=this.constructor.PLUGIN_KEY,t=function(e,t){for(let r=0;r<pt.length;r+=1){let n=pt[r];if(n.blockedKey===t&&e[n.incompatibleSettingKey])return n}return null}(this.hot.getSettings(),e);if(t){let{incompatibleSettingKey:r}=t;return tQ(ec`The \`${e}\` plugin cannot be used with the \`${r}\` option.\x20
        This combination is not supported. The plugin will remain disabled.`),!0}return!1}enablePlugin(){this.enabled=!0}disablePlugin(){this.eventManager?.clear(),this.clearHooks(),this.enabled=!1}getSetting(e){let t,r=this.constructor.DEFAULT_SETTINGS,n=this.constructor.SETTINGS_VALIDATORS;if(void 0===e)return tc(this.#oE)?tw(this.#oE,r):this.#oE;if((Array.isArray(this.#oE)||tc(this.#oE))&&r[po]===e)t=Array.isArray(this.#oE)?this.#oE:this.#oE[e]??r[e];else if(e.includes(".")){let n=tc(this.#oE)?tm(this.#oE,e):void 0,o=tm(r,e);t=tc(n)?tw(n,tc(o)?o:{}):void 0!==n?n:o}else t=tc(this.#oE)?tw(this.#oE,r)[e]:r[e];if("function"==typeof t&&n&&"object"==typeof n){let r=n[e];if(r&&"function"==typeof r){let n=t;return this.#oT(n,r,e)}}return t}#oT(e,t,r){var n=this;return function(){for(var o=arguments.length,i=Array(o),s=0;s<o;s++)i[s]=arguments[s];let a=e(...i);if(!1===t(a)){let e=i.map(e=>"string"==typeof e?`"${e}"`:"").join(", "),t=i.length>0?e:"";tQ(`${n.pluginName} Plugin: "${r}" function (${t}) result \
               is not valid and will be ignored.`);return}return a}}updatePluginSettings(e){let t=this.constructor.SETTINGS_VALIDATORS;if(t&&"function"==typeof t&&"object"!=typeof e)return!1===t(e)?void tQ(`${this.pluginName} Plugin: option is not valid and it will be ignored.`):(this.#oE=e,this.#oE);if(t&&"object"==typeof t&&tc(e)){tc(this.#oE)||(this.#oE={...this.constructor.DEFAULT_SETTINGS});let r=tc(this.#oE)?this.#oE:{};return Object.keys(t).forEach(n=>{if(!(n in e))return;let o=t[n];!1===(!o||o(e[n]))?tQ(`${this.pluginName} Plugin: "${n}" option is not valid and it will be ignored.`):r[n]=e[n]}),this.#oE}return this.#oE=e,e}addHook(e,t,r){this.#e[e]=this.#e[e]||[];let n=this.#e[e];this.hot.addHook(e,t,r),n.push(t),this.#e[e]=n}removeHooks(e){J(this.#e[e]||[],t=>{this.hot.removeHook(e,t)})}clearHooks(){let e=this.#e;tp(e,(e,t)=>this.removeHooks(t)),Object.keys(e).forEach(t=>delete e[t])}callOnPluginsReady(e){this.isPluginsReady?e():this.pluginsInitializedCallbacks.push(e)}#oA(e){if(!e)return!1;let t=this.constructor.SETTING_KEYS;if("boolean"==typeof t)return t;for(let r=0;r<t.length;r++)if(void 0!==e[t[r]])return!0;return!1}onAfterPluginsInitialized(){J(this.pluginsInitializedCallbacks,e=>e()),this.pluginsInitializedCallbacks.length=0,this.isPluginsReady=!0}onUpdateSettings(e){if(!this.isEnabled)return;let t=this.#oA(e);if(this.enabled&&!this.isEnabled()&&this.disablePlugin(),!this.enabled&&this.isEnabled()){if(this.isHardConflictBlocked())return;this.enablePlugin()}this.enabled&&this.isEnabled()&&this.isHardConflictBlocked()?this.disablePlugin():this.enabled&&this.isEnabled()&&t&&(this.updatePluginSettings(e[this.constructor.PLUGIN_KEY]),this.updatePlugin(e))}updatePlugin(e){}destroy(){this.#oE=null,this.eventManager?.destroy(),this.clearHooks(),tp(this,(e,t)=>{"hot"!==t&&Reflect.set(this,t,null)}),delete this.t,Reflect.deleteProperty(this,"hot")}}let pl=class{hot=null;container=null;injected=!1;rows=[];columns=[];samples=null;settings={useHeaders:!0};table=null;constructor(e){this.hot=e}addRow(e,t){this.columns.length&&tr("Doesn't support multi-dimensional table"),this.rows.length||(this.container=this.createContainer(this.hot.rootElement.className));let r={row:e};this.rows.push(r),this.samples=t,this.table=this.createTable(this.hot.table.className),this.table.colGroup.appendChild(this.createColGroupsCol(e)),this.table.tr.appendChild(this.createRow(e)),this.container.container.appendChild(this.table.fragment),r.table=this.table.table}addColumnHeadersRow(e){if(null!=this.hot.getColHeader(0)){let t={row:-1};this.rows.push(t),this.container=this.createContainer(this.hot.rootElement.className),this.samples=e,this.table=this.createTable(this.hot.table.className),this.table.colGroup.appendChild(this.createColGroupsCol()),this.appendColumnHeadersRow(),this.container.container.appendChild(this.table.fragment),t.table=this.table.table}}addColumn(e,t){this.rows.length&&tr("Doesn't support multi-dimensional table"),this.columns.length||(this.container=this.createContainer(this.hot.rootElement.className));let r={col:e};this.columns.push(r),this.samples=t,this.table=this.createTable(this.hot.table.className),this.getSetting("useHeaders")&&null!==this.hot.getColHeader(e)&&this.hot.view.appendColHeader(e,this.table.th,void 0,-1),this.table.tBody.appendChild(this.createCol(e)),this.container.container.appendChild(this.table.fragment),r.table=this.table.table}getHeights(e){this.injected||this.injectTable(),J(this.rows,t=>{let{height:r}=t.table.getBoundingClientRect();e(t.row,Math.round(r))})}getWidths(e){this.injected||this.injectTable(),J(this.columns,t=>{let{width:r}=t.table.getBoundingClientRect();e(t.col,Math.ceil(r))})}setSettings(e){this.settings=e}setSetting(e,t){this.settings||(this.settings={useHeaders:!0}),this.settings[e]=t}getSettings(){return this.settings}getSetting(e){return this.settings?this.settings[e]:null}createColGroupsCol(e){let t=this.hot.rootDocument.createDocumentFragment();return this.hot.hasRowHeaders()&&t.appendChild(this.createColElement(-1,-1)),this.samples.forEach(r=>{J(r.strings,r=>{t.appendChild(this.createColElement(r.col,e))})}),t}createRow(e){let t=this.hot.rootDocument,r=t.createDocumentFragment(),n=t.createElement("th");return this.hot.hasRowHeaders()&&(this.hot.view.appendRowHeader(e,n),r.appendChild(n)),this.samples.forEach(n=>{J(n.strings,n=>{let o=n.col,i=this.hot.getCellMetaTransient(e,o),s=t.createElement("td");s.setAttribute("ghost-table","1"),this.#oM(s,e,o,n.value,i),r.appendChild(s)})}),r}appendColumnHeadersRow(){let e=this.hot.rootDocument,t=e.createElement("tr"),r=[];if(this.hot.hasRowHeaders()){let n=e.createElement("th");r.push([-1,n]),t.appendChild(n)}this.samples.forEach(n=>{J(n.strings,n=>{let o=n.col,i=e.createElement("th");r.push([o,i]),t.appendChild(i)})}),this.table.tHead.appendChild(t),J(r,e=>{let[t,r]=e;this.hot.view.appendColHeader(t,r)})}createCol(e){let t=this.hot.rootDocument,r=t.createDocumentFragment();return this.samples.forEach(n=>{J(n.strings,n=>{let o=n.row,i=this.hot.getCellMetaTransient(o,e),s=t.createElement("td"),a=t.createElement("tr");s.setAttribute("ghost-table","1"),this.#oM(s,o,e,n.value,i),a.appendChild(s),r.appendChild(a)})}),r}clean(){this.rows.length=0,this.rows[-1]=void 0,this.columns.length=0,this.samples&&this.samples.clear(),this.samples=null,this.removeTable()}injectTable(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.injected||((e||this.hot.rootElement).appendChild(this.container.fragment),this.injected=!0)}removeTable(){this.injected&&this.container.container.parentNode&&(this.container.container.parentNode.removeChild(this.container.container),this.container=null,this.injected=!1)}createColElement(e,t){let r=this.hot.rootDocument.createElement("col"),n=0;t>=0&&e>=0&&(n=Number(this.hot.getCellMetaTransient(t,e).colspan));let o=this.hot.getColWidth(e);if(n>1)for(let t=e+1;t<e+n;t++)o+=this.hot.getColWidth(t);return r.style.width=`${o}px`,r}createTable(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=this.hot.rootDocument,r=t.createDocumentFragment(),n=t.createElement("table"),o=t.createElement("thead"),i=t.createElement("tbody"),s=t.createElement("colgroup"),a=t.createElement("tr"),l=t.createElement("th");return this.isVertical()&&n.appendChild(s),this.isHorizontal()&&(a.appendChild(l),o.appendChild(a),n.style.tableLayout="auto",n.style.width="auto"),n.appendChild(o),this.isVertical()&&i.appendChild(a),n.appendChild(i),rd(n,e),r.appendChild(n),{fragment:r,table:n,tHead:o,tBody:i,colGroup:s,tr:a,th:l}}createContainer(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=this.hot.rootDocument,r=t.createDocumentFragment(),n=t.createElement("div");return rd(n,`htGhostTable htAutoSize ${e.trim()}`),r.appendChild(n),{fragment:r,container:n}}#oM(e,t,r,n,o){let i=[this.hot,e,t,r,this.hot.colToProp(r),n,o];o7(this.hot.getCellRenderer(o),i)}isVertical(){return!!(this.rows.length&&!this.columns.length)}isHorizontal(){return!!(this.columns.length&&!this.rows.length)}};class ph{static get SAMPLE_COUNT(){return 3}samples=null;dataFactory=null;customSampleCount=null;allowDuplicates=!1;includeHidden=!1;constructor(e){this.dataFactory=e}getSampleCount(){return this.customSampleCount?this.customSampleCount:ph.SAMPLE_COUNT}setSampleCount(e){this.customSampleCount=e}setAllowDuplicates(e){this.allowDuplicates=e}setIncludeHidden(e){this.includeHidden=e}generateRowSamples(e,t){return this.generateSamples("row",t,e)}generateColumnSamples(e,t){return this.generateSamples("col",t,e)}generateSamples(e,t,r){let n=new Map,{from:o,to:i}="number"==typeof r?{from:r,to:r}:r;return oA(o,i,r=>{let o=this.generateSample(e,t,r);n.set(r,o)}),n}generateSample(e,t,r,n){this.#oI(e);let o=n??new Map,i="row"===e?"col":"row",s=[];n&&n.forEach(e=>{e.strings.forEach(e=>{let{value:t}=e;return s.push(t)})});let a=t=>{let n="row"===e?this.dataFactory(r,t,this):this.dataFactory(t,r,this);!1!==n&&this.#ox(o,s,i,t,n.value,n.bundleSeed)};return Array.isArray(t)?t.forEach(a):oA(t.from,t.to,a),o}generateSampleFromValues(e,t){this.#oI(e);let r=new Map,n="row"===e?"col":"row",o=[];return t.forEach(e=>{let{index:t,value:i}=e;this.#ox(r,o,n,t,i,void 0)}),r}#oI(e){"row"!==e&&"col"!==e&&tr("Unsupported sample type")}#ox(e,t,r,n,o,i){let s,a="string"==typeof i&&i.length>0?i:null,l=null!==a;s=null!==a?a:tc(o)?`${Object.keys(o).length}`:Array.isArray(o)?`${o.length}`:`${eH(o).length}`,e.has(s)||e.set(s,{needed:this.getSampleCount(),strings:[]});let h=e.get(s);h&&h.needed&&(!(t.indexOf(o)>-1)||this.allowDuplicates||l)&&(h.strings.push({value:o,[r]:n}),t.push(o),h.needed-=1)}}nF.getSingleton().register("modifyAutoColumnSizeSeed");let pd="autoColumnSize";class pu extends pa{static get PLUGIN_KEY(){return pd}static get PLUGIN_PRIORITY(){return 10}static get SETTING_KEYS(){return!0}static get DEFAULT_SETTINGS(){return{useHeaders:!0,samplingRatio:null,allowSampleDuplicates:!1}}static get CALCULATION_STEP(){return 50}static get SYNC_CALCULATION_LIMIT(){return 50}static get CALCULATION_CELLS_BUDGET(){return 1e5}ghostTable=new pl(this.hot);samplesGenerator=new ph((e,t)=>{let r=this.hot.toPhysicalRow(e),n=this.hot.toPhysicalColumn(t);if(this.hot.rowIndexMapper.isHidden(r)||this.hot.columnIndexMapper.isHidden(n))return!1;let o=this.hot.getCellMetaTransient(e,t),i="",s="";if(o.hidden)return!1;o.spanned||(s=i=o9(this.hot.getDataAtCell(e,t),o,this.hot.getCellRenderer(o)));let a="";return this.hot.hasHook("modifyAutoColumnSizeSeed")&&(a=String(this.hot.runHooks("modifyAutoColumnSizeSeed",a,o,s)??a)),{value:i,bundleSeed:a}});inProgress=!1;measuredColumns=0;columnWidthsMap;#oN=!1;#oO=[];#ok=new Map;#oH=new Map;#o_=null;constructor(e){super(e),this.columnWidthsMap=this.hot.columnIndexMapper.createAndRegisterIndexMap("autoColumnSize","physicalIndexToValue",null,{skipUnchangedWrites:!0}),this.addHook("beforeColumnResize",this.#oL)}isEnabled(){return!1!==this.hot.getSettings()[pd]&&!this.hot.getSettings().colWidths}enablePlugin(){if(this.enabled)return;this.ghostTable.setSetting("useHeaders",this.getSetting("useHeaders")),this.samplesGenerator.setAllowDuplicates(this.getSetting("allowSampleDuplicates"));let e=this.getSetting("samplingRatio");e&&!isNaN(e)&&this.samplesGenerator.setSampleCount(parseInt(String(e),10)),this.addHook("afterLoadData",this.#oP),this.addHook("beforeChangeRender",this.#oD),this.addHook("afterSetCellMeta",this.#oF),this.addHook("afterSetSourceDataAtCell",this.#oB),this.addHook("afterFormulasValuesUpdate",this.#oV),this.addHook("beforeRender",this.#oU),this.addHook("modifyColWidth",(e,t)=>this.getColumnWidth(t,e),-10),this.addHook("init",this.#oz),this.hot.rowIndexMapper.addLocalHook("cacheUpdated",this.#oW),this.hot.columnIndexMapper.addLocalHook("cacheUpdated",this.#oG),this.#o_=this.hot.columnIndexMapper.observeMapChange(this.columnWidthsMap,()=>{this.hot.view?.invalidateColumnWidthCache()}),super.enablePlugin()}updatePlugin(){this.findColumnsWhereHeaderWasChanged().forEach(e=>{this.#ok.set(e,null)}),this.#oH.clear(),super.updatePlugin()}disablePlugin(){this.#o_&&(this.#o_(),this.#o_=null),this.hot.rowIndexMapper.removeLocalHook("cacheUpdated",this.#oW),this.hot.columnIndexMapper.removeLocalHook("cacheUpdated",this.#oG),super.disablePlugin(),this.addHook("beforeColumnResize",this.#oL)}calculateVisibleColumnsWidth(){if(!this.hot.countRows())return;let e=this.getFirstVisibleColumn(),t=this.getLastVisibleColumn();if(-1===e||-1===t)return;let r=this.hot.forceFullRender;this.calculateColumnsWidth({from:e,to:t},void 0,r)}calculateColumnsWidth(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{from:0,to:this.hot.countCols()-1},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{from:0,to:this.hot.countRows()-1},r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n="number"==typeof e?{from:e,to:e}:e,o="number"==typeof t?{from:t,to:t}:t;oA(n.from,n.to,e=>{let t=this.hot.toPhysicalColumn(e);if(null===t&&(t=e),r||null===this.columnWidthsMap.getValueAtIndex(t)&&!this.hot._getColWidthFromSettings(t)){let n=r?this.#oH.get(t):void 0;void 0!==n?this.#o$(e,n):this.#oY(e,o)}}),this.ghostTable.columns.length&&(this.#oj(),this.measuredColumns=n.to+1,this.ghostTable.clean())}calculateAllColumnsWidth(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{from:0,to:this.hot.countRows()-1},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r="number"==typeof e?{from:e,to:e}:e,n=this.hot.countCols()-1,o=0,i=r.from,s=null,a=0;this.inProgress=!0;let l=e=>{let r=this.hot.toPhysicalColumn(e);return null===r&&(r=e),t||null===this.columnWidthsMap.getValueAtIndex(r)&&!this.hot._getColWidthFromSettings(r)},h=(e,t)=>{let a=e,h=t;for(;a>0&&o<=n;){if(null===s){if(!l(o)){o+=1,a-=1;continue}s=new Map,i=r.from}if(i<=r.to){if(h<=0)return!1;let e=Math.min(r.to,i+h-1);this.samplesGenerator.generateSample("col",{from:i,to:e},o,s),h-=e-i+1,i=e+1}if(i>r.to){let e=this.hot.toPhysicalColumn(o);this.#o$(o,s),this.#oH.set(null===e?o:e,s),s=null,o+=1,a-=1}}return o>n},d=()=>{this.ghostTable.columns.length&&(this.#oj(),this.measuredColumns=o,this.ghostTable.clean())},u=()=>{if(!this.hot){tA(a),this.inProgress=!1;return}let e=h(pu.CALCULATION_STEP+1,pu.CALCULATION_CELLS_BUDGET);d(),e?(tA(a),this.inProgress=!1,this.hot.view.adjustElementsSize()):a=tT(u)},c=this.getSyncCalculationLimit();c>=0&&(h(c+1,1/0),d()),o<=n?u():this.inProgress=!1}#oq(){if(0===this.#ok.size)return;let e=this.#ok;this.#ok=new Map;let t=this.hot.countRows(),r=[],n=[];if(e.forEach((e,o)=>{let i=this.hot.toPhysicalColumn(o);if(null===i||this.hot._getColWidthFromSettings(i))return;let s=this.columnWidthsMap.getValueAtIndex(i);null===e||null==s||2*e.length>=t?r.push(o):n.push({visualColumn:o,cells:e,cachedWidth:s})}),this.#oK(n,r),r.length>0){let e={from:0,to:t-1};r.forEach(t=>{this.#oY(t,e)})}this.ghostTable.columns.length&&(this.#oj(),this.ghostTable.clean())}#oK(e,t){if(0===e.length)return;let r=new Map,n=[],o=e.map(e=>{let{visualColumn:t,cells:r}=e;return{visualColumn:t,samples:this.samplesGenerator.generateSample("col",r.map(e=>e.row),t)}}),i=new Map(o.map(e=>{let{visualColumn:t,samples:r}=e;return[t,r]})),s=this.#oX(o);if(e.forEach(e=>{let o=s.get(e.visualColumn);void 0!==o&&o>e.cachedWidth?(r.set(e.visualColumn,o),this.#oQ(e,i.get(e.visualColumn))):e.cells.some(e=>!e.hasOldValue)?t.push(e.visualColumn):(n.push(e),this.#oQ(e,i.get(e.visualColumn)))}),n.length>0){let e=this.#oX(n.map(e=>{let{visualColumn:t,cells:r}=e;return{visualColumn:t,samples:this.samplesGenerator.generateSampleFromValues("col",r.map(e=>({index:e.row,value:this.#oZ(e.row,t,e.oldValue)})))}}));n.forEach(r=>{let{visualColumn:n,cachedWidth:o}=r,i=e.get(n);void 0!==i&&i>=o&&t.push(n)})}r.size>0&&this.hot.batchExecution(()=>{r.forEach((e,t)=>{this.columnWidthsMap.setValueAtIndex(this.hot.toPhysicalColumn(t),e)})},!0)}#oQ(e,t){let r=this.hot.toPhysicalColumn(e.visualColumn),n=null===r?void 0:this.#oH.get(r);if(void 0===n)return;let o=new Set(e.cells.map(e=>e.row));if(n.forEach((e,t)=>{let r=e.strings.filter(e=>{let{row:t}=e;return void 0===t||!o.has(t)});0===r.length?n.delete(t):e.strings=r}),void 0===t)return;let i=this.samplesGenerator.getSampleCount(),s=!1;t.forEach((e,t)=>{let r=n.get(t);void 0===r?n.set(t,e):(r.strings.push(...e.strings),r.strings.length>2*i&&(s=!0))}),s&&null!==r&&this.#oH.delete(r)}#oX(e){let t=new Map,r=e.filter(e=>{let{samples:t}=e;return t.size>0});if(0===r.length)return t;let n=this.ghostTable.getSetting("useHeaders");this.ghostTable.setSetting("useHeaders",!1);try{r.forEach(e=>{let{visualColumn:t,samples:r}=e;this.#o$(t,r)}),this.ghostTable.getWidths((e,r)=>{t.set(e,r)})}finally{this.ghostTable.clean(),this.ghostTable.setSetting("useHeaders",n)}return t}#oZ(e,t,r){let n=this.hot.getCellMetaTransient(e,t);return o9(r,n,this.hot.getCellRenderer(n))}#oY(e,t){this.samplesGenerator.generateColumnSamples(e,t).forEach((e,t)=>{let r=this.hot.toPhysicalColumn(t);this.#o$(t,e),this.#oH.set(null===r?t:r,e)})}#o$(e,t){this.ghostTable.addColumn(e,new Map(t))}#oj(){this.hot.batchExecution(()=>{this.ghostTable.getWidths((e,t)=>{let r=this.hot.toPhysicalColumn(e);this.columnWidthsMap.setValueAtIndex(r,t)})},!0)}recalculateAllColumnsWidth(){this.hot.view.isVisible()&&(this.#ok.clear(),this.calculateAllColumnsWidth({from:0,to:this.hot.countRows()-1},!0),this.#oH.clear())}getSyncCalculationLimit(){let e=this.hot.getSettings()[pd],t=pu.SYNC_CALCULATION_LIMIT,r=this.hot.countCols()-1;if(tc(e)){let n=e.syncLimit;if("string"==typeof n&&ou(n))t=oI(r,n);else{let e=Number(n);t=Number.isFinite(e)?Math.trunc(e):0}}return Math.min(t,r)}getColumnWidth(e,t){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],n=t;return void 0===n&&(n=this.columnWidthsMap.getValueAtIndex(this.hot.toPhysicalColumn(e)),r&&"number"==typeof n&&(n=Math.max(n,50))),n}getFirstVisibleColumn(){return this.hot.getFirstRenderedVisibleColumn()??-1}getLastVisibleColumn(){return this.hot.getLastRenderedVisibleColumn()??-1}findColumnsWhereHeaderWasChanged(){return this.hot.getColHeader().reduce((e,t,r)=>{let n=this.#oO.length;if(n-1<r||this.#oO[r]!==t){let t=this.hot.toVisualColumn(r);null!==t&&e.push(t)}return n-1<r?this.#oO.push(t):this.#oO[r]=t,e},[])}clearCache(e){Array.isArray(e)?this.hot.batchExecution(()=>{e.forEach(e=>{this.columnWidthsMap.setValueAtIndex(e,null),this.#oH.delete(e)})},!0):(this.columnWidthsMap.clear(),this.#oH.clear())}isNeedRecalculate(){return!!this.columnWidthsMap.getValues().slice(0,this.measuredColumns).filter(e=>null===e).length}#oU=()=>{this.calculateVisibleColumnsWidth(),this.inProgress||this.#oq()};#oP=(e,t)=>{this.#ok.clear(),t||this.recalculateAllColumnsWidth()};#oD=e=>{e.forEach(e=>{let[t,r,n]=e;if("function"==typeof r)return;let o=this.hot.propToCol(r);if(null===o||!Number.isInteger(o))return;let i=this.#ok.get(o);if(null===i)return;let s={row:t,oldValue:n,hasOldValue:!0};void 0===i?this.#ok.set(o,[s]):i.push(s)})};#oB=()=>{this.#oH.clear()};#oF=(e,t)=>{let r=this.hot.toPhysicalColumn(t);null!==r&&this.#oH.delete(r)};#oW=e=>{let{indexesSequenceChanged:t,trimmedIndexesChanged:r,hiddenIndexesChanged:n}=e;(t||r||n)&&this.#oH.clear()};#oG=e=>{e.indexesSequenceChanged&&this.#oH.clear()};#oL=(e,t,r)=>{let n=e;return r&&(this.calculateColumnsWidth(t,void 0,!0),n=this.getColumnWidth(t,void 0,!1)??n),n};#oz=()=>{this.#oO=this.hot.getColHeader(),this.recalculateAllColumnsWidth(),this.#oN=!0};#oV=e=>{if(!this.#oN)return;let t=this.hot.getPlugin("formulas"),r=t?.sheetId;e.forEach(e=>{let t=e.address;if(null!=r&&t?.sheet!==r)return;let n=Number(t?.col),o=Number(t?.row);if(!Number.isInteger(n))return;let i=this.hot.toVisualColumn(n);if(null===i)return;let s=this.#ok.get(i);if(null===s)return;let a=Number.isInteger(o)?this.hot.toVisualRow(o):null;if(null===a)return void this.#ok.set(i,null);let l={row:a,oldValue:void 0,hasOldValue:!1};void 0===s?this.#ok.set(i,[l]):s.push(l)})};destroy(){this.hot?.rowIndexMapper.removeLocalHook("cacheUpdated",this.#oW),this.hot?.columnIndexMapper.removeLocalHook("cacheUpdated",this.#oG),this.ghostTable.clean(),super.destroy()}}function pc(e,t,r,n,o){let i=0;for(let s=r;s<=n;s++){let r=e.getCell(t,s,!0);if(!r)continue;let n=r.offsetWidth;if(o<i+n)return s;i+=n;let{colspan:a}=e.getCellMetaTransient(t,s);void 0!==a&&a>1&&(s+=a-1)}return null}function pg(e,t,r,n,o){let i=0;for(let s=r;s<=n;s++){let r=e.getCell(s,t,!0);if(!r)continue;let n=r.offsetHeight;if(o<i+n)return s;i+=n;let{rowspan:a}=e.getCellMetaTransient(s,t);void 0!==a&&a>1&&(s+=a-1)}return null}function pp(e,t,r,n,o){for(let i=t;i<=r;i++){let t=!1,r=!1,s=null;for(let a=n;a<=o;a++){let n=e.getCell(a,i,!0),{rowspan:o}=e.getCellMetaTransient(a,i);if(void 0!==o&&o>1||null!==n&&n===s){t=!0;break}null!==n&&(s=n,r=!0)}if(!t&&r)return i}return t}function pm(e,t,r,n,o){for(let i=t;i<=r;i++){let t=!1,r=!1,s=null;for(let a=n;a<=o;a++){let n=e.getCell(i,a,!0),{colspan:o}=e.getCellMetaTransient(i,a);if(void 0!==o&&o>1||null!==n&&n===s){t=!0;break}null!==n&&(s=n,r=!0)}if(!t&&r)return i}return t}function pf(e,t,r){let{view:n,columnIndexMapper:o,rowIndexMapper:i}=e,s=e.isRtl(),a=n.countNotHiddenFixedColumnsStart(),l=n.countNotHiddenFixedRowsTop(),h=n.countNotHiddenFixedRowsBottom(),d=e.getFirstPartiallyVisibleRow(),u=e.getLastPartiallyVisibleRow(),c=e.getFirstPartiallyVisibleColumn(),g=e.getLastPartiallyVisibleColumn(),p=e.rootElement.getBoundingClientRect(),m=e.hasColHeaders()?n.getColumnHeaderHeight():0,f=e.hasRowHeaders()?n.getRowHeaderWidth():0,{rootWindow:b}=e,C=n.isHorizontallyScrollableByWindow()?Math.min(0,p.left):p.left,y=n.isVerticallyScrollableByWindow()?Math.min(0,p.top):p.top,w=n.isHorizontallyScrollableByWindow()?b.innerWidth:p.left+n.getViewportWidth()+f,S=n.isVerticallyScrollableByWindow()?b.innerHeight:p.top+n.getViewportHeight()+m,v=ox(t,C,w),R=ox(r,y,S),E=d??0,T=u??E,A=null;if(a>0){let t=o.getVisualFromRenderableIndex(0),r=o.getVisualFromRenderableIndex(a-1),n=null!==t?o.getNearestNotHiddenIndex(t,1):null;if(null!==n&&null!==r){let t=pm(e,E,T,n,r),o=e.getCell(t,n,!0);if(o instanceof HTMLElement){let i=o.getBoundingClientRect();A=pc(e,t,n,r,s?i.right-v:v-i.left)}}}if(null===A){let t=pm(e,E,T,c,g),r=e.getCell(t,c,!0);if(r instanceof HTMLElement){let n=r.getBoundingClientRect(),o=s?n.right-v:v-n.left;null===(A=pc(e,t,c,g,o))&&(A=o<0?c??0:g??e.countCols()-1)}else A=c??0}null===A&&tr("Failed to resolve cell coordinates from mouse position.");let M=c??0,I=g??M,x=null;if(l>0){let t=i.getVisualFromRenderableIndex(0),r=i.getVisualFromRenderableIndex(l-1),n=null!==t?i.getNearestNotHiddenIndex(t,1):null;if(null!==n&&null!==r){let t=pp(e,M,I,n,r),o=e.getCell(n,t,!0);o instanceof HTMLElement&&(x=pg(e,t,n,r,R-o.getBoundingClientRect().top))}}if(null===x&&h>0){let t=i.getNotHiddenIndexesLength(),r=i.getVisualFromRenderableIndex(t-h),n=i.getVisualFromRenderableIndex(t-1),o=null!==r?i.getNearestNotHiddenIndex(r,1):null,s=null!==n?i.getNearestNotHiddenIndex(n,-1):null;if(null!==o&&null!==s){let t=pp(e,M,I,o,s),r=e.getCell(o,t,!0);if(r instanceof HTMLElement){let n=R-r.getBoundingClientRect().top;n>=0&&null===(x=pg(e,t,o,s,n))&&(x=s)}}}if(null===x){let t=d??0,r=u??t,n=pp(e,M,I,t,r),o=e.getCell(d,n,!0);if(o instanceof HTMLElement){let t=R-o.getBoundingClientRect().top;null===(x=pg(e,n,d,u,t))&&(x=t<0?d??0:u??e.countRows()-1)}else x=d??0}return null===x&&tr("Failed to resolve cell coordinates from mouse position."),e._createCellCoords(x,A)}let pb=Object.freeze({horizontal:"horizontal",vertical:"vertical"});nF.getSingleton().register("modifyAutofillRange"),nF.getSingleton().register("beforeAutofill"),nF.getSingleton().register("afterAutofill");let pC="fillHandle",py="autoRowSize",pw="htFirstDatasetColumnNotRendered",pS="htAutoRowSize";class pv extends pa{static get PLUGIN_KEY(){return py}static get PLUGIN_PRIORITY(){return 40}static get SETTING_KEYS(){return!0}static get DEFAULT_SETTINGS(){return{useHeaders:!0,samplingRatio:null,allowSampleDuplicates:!1}}static get CALCULATION_STEP(){return 50}static get SYNC_CALCULATION_LIMIT(){return 500}headerHeight=null;ghostTable=new pl(this.hot);samplesGenerator=new ph((e,t)=>{let r,n,o=this.hot.toPhysicalColumn(t);return!this.hot.columnIndexMapper.isHidden(o)&&(!(e>=0)||!(t>=0)||!(r=this.hot.getCellMetaTransient(e,t)).hidden)&&(e>=0?(n=this.hot.getDataAtCell(e,t),r&&(n=o9(n,r,this.hot.getCellRenderer(r)))):-1===e&&(n=this.hot.getColHeader(t)),{value:n})});inProgress=!1;measuredRows=0;rowHeightsMap;#oJ=[];#o_=null;#oN=!1;#o0=!1;constructor(e){super(e),this.rowHeightsMap=this.hot.rowIndexMapper.createAndRegisterIndexMap("autoRowSize","physicalIndexToValue",null,{skipUnchangedWrites:!0}),this.addHook("beforeRowResize",this.#o1)}isEnabled(){let e=this.hot.getSettings()[py];return!0===e||tc(e)}enablePlugin(){if(this.enabled)return;this.samplesGenerator.setAllowDuplicates(this.getSetting("allowSampleDuplicates"));let e=this.getSetting("samplingRatio");e&&!isNaN(e)&&this.samplesGenerator.setSampleCount(e),this.addHook("afterLoadData",this.#oP),this.addHook("beforeChangeRender",this.#oD),this.addHook("beforeColumnResize",this.#oL),this.addHook("afterFormulasValuesUpdate",this.#oV),this.addHook("beforeViewRender",this.#o2),this.addHook("beforeRender",this.#oU),this.addHook("modifyRowHeight",(e,t)=>this.getRowHeight(t,e)),this.addHook("init",this.#oz),this.addHook("modifyColumnHeaderHeight",()=>this.getColumnHeaderHeight()),this.#o_=this.hot.rowIndexMapper.observeMapChange(this.rowHeightsMap,()=>{this.hot.view?.invalidateRowHeightCache()}),rd(this.hot.rootElement,pS),super.enablePlugin()}disablePlugin(){this.#o_&&(this.#o_(),this.#o_=null),this.headerHeight=null,ru(this.hot.rootElement,pS),super.disablePlugin(),this.#o3(!1),this.addHook("beforeRowResize",this.#o1)}calculateVisibleRowsHeight(){if(!this.hot.countCols())return;let e=this.getFirstVisibleRow(),t=this.getLastVisibleRow();if(-1===e||-1===t)return;let r=this.hot.forceFullRender;this.calculateRowsHeight({from:e,to:t},void 0,r)}calculateRowsHeight(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{from:0,to:this.hot.countRows()-1},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{from:0,to:this.hot.countCols()-1},r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n="number"==typeof e?{from:e,to:e}:e,o="number"==typeof t?{from:t,to:t}:t;if((r||null===this.headerHeight)&&null!==this.hot.getColHeader(0)){let e=this.samplesGenerator.generateRowSamples(-1,o);this.ghostTable.addColumnHeadersRow(e.get(-1))}oA(n.from,n.to,e=>{let t=this.hot.toPhysicalRow(e);null===t&&(t=e),(r||null===this.rowHeightsMap.getValueAtIndex(t))&&this.samplesGenerator.generateRowSamples(e,o).forEach((e,t)=>this.ghostTable.addRow(t,e))}),this.ghostTable.rows.length&&(this.hot.batchExecution(()=>{this.ghostTable.getHeights((e,t)=>{e<0?this.headerHeight=t:this.rowHeightsMap.setValueAtIndex(this.hot.toPhysicalRow(e),t)})},!0),this.measuredRows=n.to+1,this.ghostTable.clean())}calculateAllRowsHeight(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{from:0,to:this.hot.countCols()-1},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=0,n=this.hot.countRows()-1,o=0;this.inProgress=!0;let i=()=>{if(!this.hot){tA(o),this.inProgress=!1;return}this.calculateRowsHeight({from:r,to:Math.min(r+pv.CALCULATION_STEP,n)},e,t),(r=r+pv.CALCULATION_STEP+1)<n?o=tT(i):(tA(o),this.inProgress=!1,this.hot.view.adjustElementsSize())},s=this.getSyncCalculationLimit();s>=0&&(this.calculateRowsHeight({from:0,to:s},e,t),r=s+1),r<n?i():(this.inProgress=!1,this.hot.view.adjustElementsSize())}#o6(e){let t={from:0,to:this.hot.countCols()-1};e.forEach(e=>{this.samplesGenerator.generateRowSamples(e,t).forEach((e,t)=>this.ghostTable.addRow(t,e))}),this.ghostTable.rows.length&&(this.hot.batchExecution(()=>{this.ghostTable.getHeights((e,t)=>{let r=this.hot.toPhysicalRow(e);this.rowHeightsMap.setValueAtIndex(r,t)})},!0),this.ghostTable.clean())}recalculateAllRowsHeight(){this.hot.view.isVisible()&&this.calculateAllRowsHeight({from:0,to:this.hot.countCols()-1},!0)}getSyncCalculationLimit(){let e=this.hot.getSettings()[py],t=pv.SYNC_CALCULATION_LIMIT,r=this.hot.countRows()-1;if(tc(e))if(ou(t=this.getSetting("syncLimit")))t=oI(r,t);else{let e=Number(t);t=Number.isFinite(e)?Math.trunc(e):0}return Math.min(t,r)}getRowHeight(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.hot.stylesHandler.getDefaultRowHeight(e)??0;if(e<0)return this.headerHeight??t;let r=this.hot.toPhysicalRow(e);if(this.hot.rowIndexMapper.isHidden(r))return t;let n=this.rowHeightsMap.getValueAtIndex(r),o=t;return null!=n&&n>t&&(o=n,e===this.hot.view.getFirstRenderedVisibleRow()&&(o+=1)),o}getColumnHeaderHeight(){return this.headerHeight}getFirstVisibleRow(){return this.hot.getFirstRenderedVisibleRow()??-1}getLastVisibleRow(){return this.hot.getLastRenderedVisibleRow()??-1}clearCache(e){this.headerHeight=null,Array.isArray(e)?this.hot.batchExecution(()=>{e.forEach(e=>{this.rowHeightsMap.setValueAtIndex(e,null)})},!0):this.rowHeightsMap.clear()}clearCacheByRange(e){let{from:t,to:r}="number"==typeof e?{from:e,to:e}:e;this.hot.batchExecution(()=>{oA(Math.min(t,r),Math.max(t,r),e=>{this.rowHeightsMap.setValueAtIndex(e,null)})},!0)}isNeedRecalculate(){return!!this.rowHeightsMap.getValues().slice(0,this.measuredRows).filter(e=>null===e).length}#o3(e){let t=this.hot.getFirstRenderedVisibleColumn(),r=this.hot.columnIndexMapper.getPhysicalFromVisualIndex(t);!1===e||r===this.hot.columnIndexMapper.getPhysicalFromRenderableIndex(0)?ru(this.hot.rootElement,pw):rd(this.hot.rootElement,pw)}#o2=()=>{this.#o3()};#oU=()=>{this.calculateVisibleRowsHeight(),this.inProgress||(this.#o6(this.#oJ),this.#oJ=[])};#oL=()=>{this.#o0||(this.#o0=!0,this.hot._registerTimeout(()=>{this.#o0=!1,this.recalculateAllRowsHeight()},0))};#o1=(e,t,r)=>{let n=e;return r&&(this.calculateRowsHeight(t,void 0,!0),n=this.getRowHeight(t)),n};#oP=(e,t)=>{t||this.recalculateAllRowsHeight()};#oD=e=>{let t=new Set;e.forEach(e=>{let[r]=e;t.add(Number(r))}),t.forEach(e=>{this.#oJ.push(e)})};#oz=()=>{this.recalculateAllRowsHeight(),this.#oN=!0};#oV=e=>{if(!this.#oN)return;let t=this.hot.getPlugin("formulas"),r=t?.sheetId,n=e.reduce((e,t)=>{if(null!=r&&t.address?.sheet!==r)return e;let n=Number(t.address?.row);if(Number.isInteger(n)){let t=this.hot.toVisualRow(n);null!==t&&-1===e.indexOf(t)&&e.push(t)}return e},[]);this.#oJ.push(...n)};destroy(){this.ghostTable.clean(),super.destroy()}}let pR=class extends aC{constructor(){super(e=>e)}insert(e,t){let r=av(this.indexedValues,t);this.indexedValues=aA(r,e,t,this.initValueOrFn),super.insert(e,t)}remove(e){let t=aM(this.indexedValues,e);this.indexedValues=aS(t,e),super.remove(e)}},pE=class extends aC{constructor(){super(e=>e)}insert(e,t){this.indexedValues=aA(this.indexedValues,e,t,(e,t)=>this.getNextValue(t)),super.insert(e,t)}remove(e){this.indexedValues=aM(this.indexedValues,e),super.remove(e)}getNextValue(e){return Math.max(...this.getValues())+1+e}},pT="bindRowsWithHeaders",pA=new Map([["loose",pR],["strict",pE]]),pM="collapsibleColumns",pI=["nestedHeaders"],px="collapsibleIndicator",pN="collapsibleColumns.visibleWhen",pO=new Map([["collapse",{hideColumn:!0,beforeHook:"beforeColumnCollapse",afterHook:"afterColumnCollapse"}],["expand",{hideColumn:!1,beforeHook:"beforeColumnExpand",afterHook:"afterColumnExpand"}]]),pk=["sortEmptyCells","indicator","headerAction","compareFunctionFactory"];class pH{sortingStates;sortEmptyCells=!1;indicator=!0;headerAction=!0;mapName;constructor(e,t){this.hot=e,this.mapName=t,this.sortingStates=this.hot.columnIndexMapper.createAndRegisterIndexMap(t,"linkedPhysicalIndexToValue")}updateAllColumnsProperties(e){tc(e)&&tp(e,(e,t)=>{pk.includes(t)&&(this[t]=e)})}getAllColumnsProperties(){let e={sortEmptyCells:this.sortEmptyCells,indicator:this.indicator,headerAction:this.headerAction};return"function"==typeof this.compareFunctionFactory&&(e.compareFunctionFactory=this.compareFunctionFactory),e}getSortOrderOfColumn(e){return this.sortingStates.getValueAtIndex(this.hot.toPhysicalColumn(e))?.sortOrder}getIndexOfColumnInSortQueue(e){return e=this.hot.toPhysicalColumn(e),this.sortingStates.getEntries().findIndex(t=>{let[r]=t;return r===e})}getNumberOfSortedColumns(){return this.sortingStates.getLength()}isListOfSortedColumnsEmpty(){return 0===this.getNumberOfSortedColumns()}isColumnSorted(e){return tc(this.sortingStates.getValueAtIndex(this.hot.toPhysicalColumn(e)))}getSortStates(){return null===this.sortingStates?[]:this.sortingStates.getEntries().map(e=>{let[t,r]=e;return{column:this.hot.toVisualColumn(t),...r}})}getColumnSortState(e){let t=this.getSortOrderOfColumn(e);if(void 0!==t)return{column:e,sortOrder:t}}setSortStates(e){this.sortingStates.clear();for(let t=0;t<e.length;t+=1){let r=e[t];this.sortingStates.setValueAtIndex(this.hot.toPhysicalColumn(r.column),{sortOrder:r.sortOrder})}}destroy(){this.hot.columnIndexMapper.unregisterMap(this.mapName),Reflect.set(this,"sortingStates",null)}}function p_(e,t,r){if("boolean"==typeof e)return Number(e);if("string"==typeof e){let n=r.get(e);return void 0===n&&(n=ow(e,t),r.set(e,n)),n}return e}function pL(e,t,r){let n=t.locale,o=new Map;return function(t,i){let{sortEmptyCells:s}=r,a=p_(t,n,o),l=p_(i,n,o);return a===l?pW:eP(a)?eP(l)?pW:s&&"asc"===e?pG:p$:eP(l)?s&&"asc"===e?p$:pG:function(e,t,r){let n=isNaN(e),o=isNaN(t);if(n&&!o)return"asc"===r?p$:pG;if(!n&&o)return"asc"===r?pG:p$;let i=e,s=t;n||o||(i=parseFloat(String(e)),s=parseFloat(String(t)));let a=i,l=s;return a<l?"asc"===r?pG:p$:a>l?"asc"===r?p$:pG:pW}(a,l,e)}}let pP="default",{register:pD,getItem:pF,hasItem:pB}=nU("sorting.compareFunctionFactory"),{register:pV,getItem:pU}=nU("sorting.mainSortComparator");function pz(e){return pB(e)?pF(e):pF(pP)}pD("checkbox",function(e,t,r){let n=t.checkedTemplate,o=t.uncheckedTemplate,{sortEmptyCells:i}=r,s=pL(e,t,r);return function(t,r){var a,l;let h=eP(t),d=eP(r),u=h?o:t,c=d?o:r;if(!1===i){if(h&&!1===d)return p$;if(!1===h&&d)return pG}let g=(a=u===o||u===n,l=c===o||c===n,!1===a&&l?"asc"===e?pG:p$:a&&!1===l?"asc"===e?p$:pG:!1===a&&!1===l?s(t,r):null);return null!==g?g:u===o&&c===n?"asc"===e?pG:p$:u===n&&c===o?"asc"===e?p$:pG:pW}}),pD("date",function(e,t,r){return pZ(cR,e,r)}),pD("intl-date",function(e,t,r){return pZ(cR,e,r)}),pD(pP,pL),pD("numeric",function(e,t,r){return function(t,n){let o=parseFloat(t),i=parseFloat(n),{sortEmptyCells:s}=r;if(o===i||isNaN(o)&&isNaN(i))return pW;if(s){if(eP(t))return"asc"===e?pG:p$;if(eP(n))return"asc"===e?p$:pG}return isNaN(o)?p$:isNaN(i)?pG:o<i?"asc"===e?pG:p$:o>i?"asc"===e?p$:pG:pW}}),pD("time",function(e,t,r){return pZ(cI,e,r)}),pD("intl-time",function(e,t,r){return pZ(cI,e,r)}),pD("intl-datetime",function(e,t,r){return pZ(cO,e,r)});let pW=0,pG=-1,p$=1,pY="desc",pj="colHeader";function pq(e){if(!1===tc(e))return!1;let{column:t,sortOrder:r}=e;return Number.isInteger(t)&&["asc",pY].includes(r)}function pK(e){return e===pY?void 0:"asc"===e?pY:"asc"}function pX(e){return e.querySelector(`.${pj}`)}function pQ(e,t,r){if(t<0||e>=0||nT(r))return!1;if(-1===e)return!0;let n="function"==typeof t4(r)?.closest?t4(r).closest("th"):null;return null!==n&&rs(n)}function pZ(e,t,r){let n=new Map,o=t=>{let r=n.get(t);return void 0===r&&(r=e(t)?.getTime()??null,n.set(t,r)),r};return function(e,n){let{sortEmptyCells:i}=r;if(e===n)return pW;if(eP(e))return eP(n)?pW:i&&"asc"===t?pG:p$;if(eP(n))return i&&"asc"===t?p$:pG;let s=o(e),a=o(n);return null===s?p$:null===a?pG:a>s?"asc"===t?pG:p$:a<s?"asc"===t?p$:pG:pW}}let pJ="ascending",p0="descending",p1="indicatorDisabled",p2="columnSorting",p3="sortAction",p6=new Map([["asc",pJ],[pY,p0]]),p5="columnSorting",p4="append",p9="has-sort-indicator";pV(p5,function(e,t){var r,n;let o,i=(r=e[0],o=(n=t[0]).columnSorting,(o?.compareFunctionFactory?o.compareFunctionFactory:pz(n.type??""))(r,n,o));return function(e,t){return i(e[1],t[1])}}),nF.getSingleton().register("beforeColumnSort"),nF.getSingleton().register("afterColumnSort");let p7=new WeakMap;class p8 extends pa{static get PLUGIN_KEY(){return p5}static get PLUGIN_PRIORITY(){return 50}columnStatesManager=null;columnMetaCache=null;#o5=null;pluginKey=p5;indexesSequenceCache=null;isEnabled(){return!!this.hot.getSettings()[this.pluginKey]}enablePlugin(){if(p7.has(this.hot)&&p7.get(this.hot)!==this.pluginKey){var e,t;this.hot.updateSettings({[this.pluginKey]:!1}),e=p7.get(this.hot),t=this.pluginKey,tQ(ec`Plugins \`columnSorting\` and \`multiColumnSorting\` should not be enabled simultaneously.\x20
    Only \`${e}\` will work. The \`${t}\` plugin will remain disabled.`);return}this.enabled||(p7.set(this.hot,this.pluginKey),this.columnStatesManager=new pH(this.hot,`${this.pluginKey}.sortingStates`),this.columnMetaCache=this.hot.columnIndexMapper.createAndRegisterIndexMap(`${this.pluginKey}.columnMeta`,"physicalIndexToValue",e=>{let t=this.hot.toVisualColumn(e);return null===t&&(t=e),this.getMergedPluginSettings(t)}),this.addHook("afterGetColHeader",this.#o4),this.addHook("beforeOnCellMouseDown",this.#o9),this.addHook("afterOnCellMouseDown",(e,t)=>this.onAfterOnCellMouseDown(e,t)),this.addHook("afterOnCellMouseUp",this.#o7),this.eventManager.addEventListener(this.hot.rootDocument.documentElement,"mouseup",()=>this.#o7()),this.addHook("afterColumnMove",this.#o8),this.addHook("afterInit",this.#ie),this.addHook("afterLoadData",this.#oP),this.addHook("afterDataProviderFetch",this.#it,-1),this.hot.view&&this.#ie(),this.registerShortcuts(),super.enablePlugin())}disablePlugin(){let e=(e,t)=>{var r,n;let o=pX(t);!1!==(r=e,n=t,!(r<0)&&rs(n))&&null!==o&&(this.updateHeaderClasses(o),this.#ir(o))};p7.delete(this.hot),this.hot.addHook("afterGetColHeader",e),this.hot.addHookOnce("afterViewRender",()=>{this.hot.removeHook("afterGetColHeader",e)}),this.hot.batchExecution(()=>{null!==this.indexesSequenceCache&&(this.hot.rowIndexMapper.setIndexesSequence(this.indexesSequenceCache.getValues()),this.hot.rowIndexMapper.unregisterMap(this.pluginKey),this.indexesSequenceCache=null)},!0),this.hot.columnIndexMapper.unregisterMap(`${this.pluginKey}.columnMeta`),this.columnStatesManager?.destroy(),this.columnMetaCache=null,this.columnStatesManager=null,this.#o5=null,this.unregisterShortcuts(),super.disablePlugin()}registerShortcuts(){this.hot.getShortcutManager().getContext("grid")?.addShortcut({keys:[["Enter"]],callback:()=>{let e=this.hot.getSelectedRangeActive();if(!e)return!1;let{highlight:t}=e;return this.sort(this.getColumnNextConfig(t.col??0)),!1},runOnlyIf:()=>{let e=this.hot.getSelectedRangeActive()?.highlight,t=e&&null!==e.row&&null!==e.col?this.hot.getCell(e.row,e.col,!0):null;return!!(e&&this.hot.getSelectedRangeActive()?.isSingle()&&this.hot.selection.isCellVisible(e)&&null!==e.row&&e.row<0&&null!==e.col&&e.col>=0&&t&&rs(t))},relativeToGroup:dY,position:"before",group:p5})}unregisterShortcuts(){this.hot.getShortcutManager().getContext("grid")?.removeShortcutsByGroup(p5)}sort(e){let t=this.columnStatesManager.getSortStates(),r=this.getNormalizedSortConfigs(e),n=this.areValidSortConfigs(r);!1!==this.hot.runHooks("beforeColumnSort",t,r,n)&&(0===t.length&&null===this.indexesSequenceCache&&(this.indexesSequenceCache=this.hot.rowIndexMapper.createAndRegisterIndexMap(this.pluginKey,"indexesSequence"),this.indexesSequenceCache.setValues(this.hot.rowIndexMapper.getIndexesSequence())),n&&(this.columnStatesManager?.setSortStates(r),this.sortByPresetSortStates(r)),this.hot.runHooks("afterColumnSort",t,n?r:t,n),n&&this.hot.render())}clearSort(){this.sort([])}isSorted(){return this.enabled&&!this.columnStatesManager?.isListOfSortedColumnsEmpty()}getSortConfig(e){return void 0!==e?this.columnStatesManager?.getColumnSortState(e):this.columnStatesManager?.getSortStates()}setSortConfig(e){let t=this.getNormalizedSortConfigs(e);this.areValidSortConfigs(t)&&this.columnStatesManager?.setSortStates(t)}getNormalizedSortConfigs(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Array.isArray(e)?e.slice(0,1):[e]}areValidSortConfigs(e){let t=this.hot.countCols();return function(e){if(e.some(e=>!1===pq(e)))return!1;let t=e.filter(pq).map(e=>e.column);return new Set(t).size===t.length}(e)&&e.every(e=>{let{column:r}=e;return r<=t&&r>=0})}getColumnNextConfig(e){let t=this.columnStatesManager?.getSortOrderOfColumn(e);if(e_(t)){let r=pK(t);return void 0!==r?{column:e,sortOrder:r}:void 0}let r=this.hot.countCols();if(Number.isInteger(e)&&e>=0&&e<r)return{column:e,sortOrder:pK()??"asc"}}getNextSortConfig(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p4,r=this.columnStatesManager.getIndexOfColumnInSortQueue(e),n=-1!==r,o=this.columnStatesManager.getSortStates(),i=this.getColumnNextConfig(e);if(n){if(eL(i))return[...o.slice(0,r),...o.slice(r+1)];if(t===p4)return[...o.slice(0,r),...o.slice(r+1),i];if("replace"===t)return[...o.slice(0,r),i,...o.slice(r+1)]}return void 0!==i?o.concat(i):o}getPluginColumnConfig(e){if(tc(e)){let t=e[this.pluginKey];if(tc(t))return t}return{}}getMergedPluginSettings(e){let t=this.hot.getSettings()[this.pluginKey],r=this.columnStatesManager?.getAllColumnsProperties()??{},n=Object.getPrototypeOf(this.hot.getCellMetaTransient(0,e));if(Array.isArray(n.columns))return Object.assign(r,t,this.getPluginColumnConfig(n.columns[e]));if(na(n.columns)){let o=n.columns(e);return Object.assign(r,t,this.getPluginColumnConfig(o))}return Object.assign(r,t)}getFirstCellSettings(e){let t=Object.create(this.hot.getCellMetaTransient(0,e));return t[this.pluginKey]=this.columnMetaCache?.getValueAtIndex(this.hot.toPhysicalColumn(e)),t}getNumberOfRowsToSort(e){let t=this.hot.getSettings(),r=t.fixedRowsBottom||0;return(t.maxRows??1/0)<=e?Math.max(0,(t.maxRows??0)-r):Math.max(0,e-(t.minSpareRows??0)-r)}sortByPresetSortStates(e){if(this.hot.rowIndexMapper.setIndexesSequence(this.indexesSequenceCache.getValues()),0===e.length)return;let t=[],r=this.hot.countRows(),n=this.hot.getSettings().fixedRowsTop||0,o=this.getNumberOfRowsToSort(r),i=t=>Z(e,e=>this.hot.getDataAtCell(t,e.column));for(let e=n;e<o;e+=1)t.push([this.hot.toPhysicalRow(e),...i(e)]);let s=Z(t,e=>e[0]);!function(e,t){for(var r=arguments.length,n=Array(r>2?r-2:0),o=2;o<r;o++)n[o-2]=arguments[o];let i=pU(t);e.sort(i(...n))}(t,this.pluginKey,Z(e,e=>e.sortOrder),Z(e,e=>this.getFirstCellSettings(e.column)));for(let e=o;e<r;e+=1)t.push([e,...i(e)]);let a=Z(t,e=>e[0]),l=new Map(Z(s,(e,t)=>[e,a[t]])),h=Z(this.hot.rowIndexMapper.getIndexesSequence(),e=>l.get(e)??e);this.hot.rowIndexMapper.setIndexesSequence(h)}#ie=()=>{let e=this.hot.getSettings()[this.pluginKey];this.sortBySettings(e)};sortBySettings(e){if(tc(e)){this.columnStatesManager.updateAllColumnsProperties(e);let{initialConfig:t}=e;(Array.isArray(t)||tc(t))&&this.sort(t)}else this.hot.render()}#o4=(e,t)=>{var r,n;let o=pX(t);if(!1===(r=e,n=t,!(r<0)&&rs(n))||null===o)return;let i=this.getFirstCellSettings(e)[this.pluginKey],s=i.indicator,a=i.headerAction;if(this.updateHeaderClasses(o,this.columnStatesManager??void 0,e,s,a),this.#ir(o),this.hot.getSettings().ariaTags){let r=this.columnStatesManager?.getSortOrderOfColumn(e);rc(t,"aria-sort",r?`${r}ending`:"none")}};updateHeaderClasses(e,t,r,n,o){ru(e,Array.from(p6.values()).concat(p3,p1,p2)),!1!==this.enabled&&void 0!==t&&void 0!==r&&rd(e,function(e,t,r,n){let o=[p2];if(n&&o.push(p3),!1===r)return o.push(p1),o;let i=e.getSortOrderOfColumn(t);if(void 0!==i){let e=p6.get(i);void 0!==e&&o.push(e)}return o}(t,r,n??!1,o??!1))}#ir(e){let t=e.parentElement;null===t||(rh(e,p3)&&(rh(e,pJ)||rh(e,p0))?rd(t,p9):ru(t,p9))}onUpdateSettings(e){super.onUpdateSettings(e),null!==this.columnMetaCache&&this.columnMetaCache.init(this.hot.columnIndexMapper.getNumberOfIndexes());let t=e[this.pluginKey];e_(t)&&this.sortBySettings(t)}#oP=e=>{!0===e&&this.hot.view&&this.#ie()};#it=e=>{this.setSortConfig(e?.columnSortConfig??[])};wasClickableHeaderClicked(e,t){return this.getFirstCellSettings(t)[this.pluginKey].headerAction&&rh(t4(e),pj)}#o9=(e,t,r,n)=>{this.#o5=null,!1!==pQ(t.row,t.col,e)&&this.wasClickableHeaderClicked(e,t.col)&&this.hot.getShortcutManager().isCtrlPressed()&&(n.column=!0)};onAfterOnCellMouseDown(e,t){if(!1===pQ(t.row,t.col,e)||!1===this.wasClickableHeaderClicked(e,t.col))return;let r=this.hot.getShortcutManager().isCtrlPressed();r&&(this.hot.deselectCell(),this.hot.selectColumns(t.col));let n=this.hot.getActiveEditor(),o=!!(n?.isOpened()&&this.hot.getCellValidator(n.row,n.col));this.#o5={column:t.col,isCtrlPressed:r,validation:o?new Promise(e=>{this.hot.addHookOnce("postAfterValidate",()=>e())}):null,consumedByMove:!1}}applyHeaderClickSort(e){this.sort(this.getColumnNextConfig(e.column))}#o7=()=>{let e=this.#o5;if(null!==e&&(this.#o5=null,!(e.consumedByMove||this.#io()))){if(null===e.validation)return void this.applyHeaderClickSort(e);e.validation.then(()=>this.applyHeaderClickSort(e))}};#o8=()=>{null!==this.#o5&&(this.#o5.consumedByMove=!0)};#io(){let e=this.hot.getPlugin("manualColumnMove");return e?.isDragging()===!0}destroy(){this.#o5=null,this.columnStatesManager?.destroy(),super.destroy()}}function me(e){return null==e||isNaN(e)}let mt=class{endpoints=[];settingsType="array";currentEndpoint=null;cellsToSetCache=[];#ii=null;constructor(e,t){this.plugin=e,this.hot=this.plugin.hot,this.settings=t}initEndpoints(){this.endpoints=this.parseSettings(),this.refreshAllEndpoints()}getEndpoint(e){return"function"===this.settingsType?this.fillMissingEndpointData(this.settings)[e]:this.endpoints[e]}countPhysicalRows(){return this.hot.rowIndexMapper.getNumberOfIndexes()}countAddressableRows(){let e,t=this.hot.getSettings().maxRows;return e=(t??0)<0||0===t?0:t||1/0,Math.min(this.countPhysicalRows(),e)}isEndpointOutOfBounds(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=e.destinationRow+t,o=this.hot.toVisualRow(n);return n>=this.countPhysicalRows()||e.destinationColumn+r>=this.hot.countCols()||null!==o&&o>=this.hot.countRows()}getAllEndpoints(){return"function"===this.settingsType?this.fillMissingEndpointData(this.settings):this.endpoints}cacheSummaryDestinations(e){this.#ii=new Map,J(e,e=>{let t=this.#ii.get(e.destinationRow);void 0===t&&(t=new Set,this.#ii.set(e.destinationRow,t)),t.add(e.destinationColumn)})}isSummaryDestination(e,t){return null===this.#ii&&this.cacheSummaryDestinations(this.getAllEndpoints()),this.#ii.get(e)?.has(t)===!0}fillMissingEndpointData(e){return this.parseSettings(e.call(this))}parseSettings(e){let t=[],r=e;if(!r&&"function"==typeof this.settings){this.settingsType="function";return}return r||(r=this.settings),J(r,e=>{let r={};this.assignSetting(e,r,"ranges",[[0,this.countAddressableRows()-1]]),this.assignSetting(e,r,"reversedRowCoords",!1),this.assignSetting(e,r,"destinationRow",Error(`
        You must provide a destination row for the Column Summary plugin in order to work properly!
      `)),this.assignSetting(e,r,"destinationColumn",Error(`
        You must provide a destination column for the Column Summary plugin in order to work properly!
      `)),this.assignSetting(e,r,"sourceColumn",e.destinationColumn),this.assignSetting(e,r,"type","sum"),this.assignSetting(e,r,"forceNumeric",!1),this.assignSetting(e,r,"suppressDataTypeErrors",!0),this.assignSetting(e,r,"customFunction",null),this.assignSetting(e,r,"readOnly",!0),this.assignSetting(e,r,"roundFloat",!1),t.push(r)}),t}assignSetting(e,t,r,n){if("ranges"===r&&void 0===e[r]){t[r]=n;return}if("ranges"!==r||0!==e[r].length)if(void 0===e[r]){if(n instanceof Error)throw n;t[r]=n}else"destinationRow"===r&&t.reversedRowCoords?t[r]=this.countAddressableRows()-e[r]-1:t[r]=e[r]}resetSetupBeforeStructureAlteration(e,t,r){if("function"!==this.settingsType)return;let n=e.indexOf("row")>-1?"row":"col",o=this.getAllEndpoints();J(o,o=>{"row"===n&&o.destinationRow>=t&&("insert_row"===e?o.alterRowOffset=r:"remove_row"===e&&(o.alterRowOffset=-1*r)),"col"===n&&o.destinationColumn>=t&&("insert_col"===e?o.alterColumnOffset=r:"remove_col"===e&&(o.alterColumnOffset=-1*r))}),this.resetAllEndpoints(o,!1)}resetSetupAfterStructureAlteration(e,t,r,n,o){let i=!(arguments.length>5)||void 0===arguments[5]||arguments[5];if("auto"===o)return;if("function"===this.settingsType){let e=()=>(this.hot.removeHook("beforeViewRender",e),this.refreshAllEndpoints());this.hot.addHookOnce("beforeViewRender",e);return}let s=e.indexOf("row")>-1?"row":"col",a=e.indexOf("remove")>-1?-1:1,l=this.getAllEndpoints(),h=0===e.indexOf("move_row");J(l,e=>{"row"===s&&e.destinationRow>=t&&(e.alterRowOffset=a*r),"col"===s&&e.destinationColumn>=t&&(e.alterColumnOffset=a*r)}),this.resetAllEndpoints(l,!h),h?J(l,e=>{this.extendEndpointRanges(e,t,n?.[0]??0,n?.length??0),this.recreatePhysicalRanges(e),this.clearOffsetInformation(e)}):J(l,e=>{this.shiftEndpointCoordinates(e,t)}),i&&this.refreshAllEndpoints()}clearOffsetInformation(e){e.alterRowOffset=void 0,e.alterColumnOffset=void 0}extendEndpointRanges(e,t,r,n){J(e.ranges,e=>{e[1]&&(t>=e[0]&&t<=e[1]?r>e[1]?e[1]+=n:r<e[0]&&(e[0]-=n):r>=e[0]&&r<=e[1]&&(e[1]-=n,t<=e[0]&&(e[0]+=1,e[1]+=1)))})}recreatePhysicalRanges(e){let t=e.ranges,r=[],n=[];J(t,e=>{let t=[];if(e[1])for(let r=e[0];r<=e[1];r++)t.push(this.hot.toPhysicalRow(r));else t.push(this.hot.toPhysicalRow(e[0]));n.push(t)}),J(n,e=>{let t=[];J(e,(n,o)=>{0===o?t.push(n):e[o]!==e[o-1]+1&&(t.push(e[o-1]),r.push(t),(t=[]).push(n)),o===e.length-1&&(t.push(n),r.push(t))})}),e.ranges=r}shiftEndpointCoordinates(e,t){e.alterRowOffset&&0!==e.alterRowOffset?(e.destinationRow+=e.alterRowOffset||0,J(e.ranges,r=>{J(r,(n,o)=>{n>=t&&(r[o]+=e.alterRowOffset||0)})})):e.alterColumnOffset&&0!==e.alterColumnOffset&&(e.destinationColumn+=e.alterColumnOffset||0,e.sourceColumn+=e.alterColumnOffset||0)}resetAllEndpoints(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.getAllEndpoints(),t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];e.some(e=>this.isEndpointOutOfBounds(e,e.alterRowOffset||0,e.alterColumnOffset||0))||(this.cellsToSetCache=[],J(e,e=>{this.resetEndpointValue(e,t)}),this.cellsToSetCache.length&&this.hot.setDataAtCell(this.cellsToSetCache,null,void 0,"ColumnSummary.reset"),this.cellsToSetCache=[])}refreshAllEndpoints(){let e=this.getAllEndpoints();this.cellsToSetCache=[],this.cacheSummaryDestinations(e),J(e,e=>{this.currentEndpoint=e,this.plugin.calculate(e),this.setEndpointValue(e,"init")}),this.currentEndpoint=null,this.cellsToSetCache.length&&this.hot.setDataAtCell(this.cellsToSetCache,null,void 0,"ColumnSummary.reset"),this.cellsToSetCache=[]}refreshChangedEndpoints(e){let t=this.getAllEndpoints(),r=[];this.cellsToSetCache=[],this.cacheSummaryDestinations(t),J(e,(e,n,o)=>{`${e[2]||""}`!=`${e[3]}`&&J(t,(e,t)=>{this.hot.propToCol(o[n][1])===e.sourceColumn&&-1===r.indexOf(t)&&r.push(t)})}),J(r,e=>{this.refreshEndpoint(t[e])}),this.cellsToSetCache.length&&this.hot.setDataAtCell(this.cellsToSetCache,null,void 0,"ColumnSummary.reset"),this.cellsToSetCache=[]}refreshEndpointsBySourceColumns(e){let t=e instanceof Set?e:new Set(e),r=this.getAllEndpoints(),n=r.filter(e=>t.has(e.sourceColumn));0!==n.length&&(this.cellsToSetCache=[],this.cacheSummaryDestinations(r),J(n,e=>{this.refreshEndpoint(e)}),this.cellsToSetCache.length&&this.hot.setDataAtCell(this.cellsToSetCache,null,void 0,"ColumnSummary.reset"),this.cellsToSetCache=[])}refreshCellMetas(){this.endpoints.forEach(e=>{let t=this.hot.toVisualRow(e.destinationRow),r=e.destinationColumn;null!==t&&(this.hot._setCellMetaDeclarative(t,r,"readOnly",e.readOnly),this.hot._setCellMetaDeclarative(t,r,"className","columnSummaryResult"))})}refreshEndpoint(e){this.currentEndpoint=e,this.plugin.calculate(e),this.setEndpointValue(e,void 0),this.currentEndpoint=null}resetEndpointValue(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],r=e.alterRowOffset||0,n=e.alterColumnOffset||0,o=this.hot.toVisualRow(e.destinationRow+(t?r:0));null!==o&&this.cellsToSetCache.push([o,this.hot.toVisualColumn(e.destinationColumn+(t?n:0)),""])}setEndpointValue(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.isEndpointOutOfBounds(e))return void this.throwOutOfBoundsWarning();let n=this.hot.toVisualRow(e.destinationRow);if(null!==n){let r=e.destinationColumn,o=this.hot.getCellMetaTransient(n,r);("init"===t||o.readOnly!==e.readOnly)&&(this.hot._setCellMetaDeclarative(n,r,"readOnly",e.readOnly),this.hot._setCellMetaDeclarative(n,r,"className","columnSummaryResult"))}e.result=function(e,t){if("number"!=typeof e)return e;switch(typeof t){case"number":return e.toFixed(Math.min(Math.max(0,t),100));case"boolean":return t?Math.round(e).toString():e;case"string":if("auto"===t){let t=Math.round(e).toString().length;return e.toFixed(8-t)}return e;default:return e}}(e.result,e.roundFloat),null!==n&&(r?this.hot.setDataAtCell(n,e.destinationColumn,e.result,"ColumnSummary.set"):this.cellsToSetCache.push([n,e.destinationColumn,e.result])),e.alterRowOffset=void 0,e.alterColumnOffset=void 0}throwOutOfBoundsWarning(){tQ("One of the Column Summary plugins' destination points you provided is beyond the table boundaries!")}},mr="columnSummary";class mn{#is=!0;#ia=null;#il=new ResizeObserver(e=>this.#ih(e));setObservedElement(e){this.#ia=e}unobserve(){this.#ia&&this.#il.unobserve(this.#ia)}observe(){this.#is=!0,this.#ia&&this.#il.observe(this.#ia)}destroy(){this.#il.disconnect()}#ih(e){if(this.#is||!Array.isArray(e)||!e.length){this.#is=!1;return}e.forEach(e=>{let{borderBoxSize:t}=e,{inlineSize:r,blockSize:n}=t[0];this.runLocalHooks("resize",r,n)})}}th(mn,ab);class mo{static get CLASS_EDITOR_CONTAINER(){return"htCommentsContainer"}static get CLASS_EDITOR(){return"htComments"}static get CLASS_INPUT(){return"htCommentTextArea"}static get CLASS_CELL(){return"htCommentCell"}#ni;#id;#X=!1;#iu=null;#ic=null;#ig=null;#ip=!0;#eg=new mn;constructor(e,t,r){var n=this;this.#ni=e,this.#id=r,this.#X=t,this.#ic=this.createEditor(),this.#ig=this.#ic.style,this.#eg.setObservedElement(this.getInputElement()),this.#eg.addLocalHook("resize",function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];n.runLocalHooks("resize",...t)}),this.hide()}setPosition(e,t){this.#ig&&(this.#ig.left=`${e}px`,this.#ig.top=`${t}px`)}setSize(e,t){if(e&&t){let r=this.getInputElement();r.style.width=`${e}px`,r.style.height=`${t}px`}}getSize(){return{width:rF(this.getInputElement()),height:rB(this.getInputElement())}}observeSize(){this.#eg.observe()}resetSize(){let e=this.getInputElement();e.style.width="",e.style.height=""}setReadOnlyState(e){this.getInputElement().readOnly=e}show(){this.#ig&&(this.#ig.display="block"),this.#ip=!1}hide(){this.#eg.unobserve(),!this.#ip&&this.#ig&&(this.#ig.display="none"),this.#ip=!0}isVisible(){return this.#ig?.display==="block"}setValue(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.getInputElement().value=e||""}getValue(){return this.getInputElement().value}isFocused(){return ni(this.#ni)===this.getInputElement()}focus(){this.getInputElement().focus()}createEditor(){let e=this.#ni.createElement("div"),t=this.#ni.createElement("textarea");return e.style.display="none",this.#iu=this.#ni.createElement("div"),this.#iu.setAttribute("dir",this.#X?"rtl":"ltr"),rd(this.#iu,mo.CLASS_EDITOR_CONTAINER),this.#id.appendChild(this.#iu),rd(e,mo.CLASS_EDITOR),rd(t,mo.CLASS_INPUT),t.dataset.hotInput="true",e.appendChild(t),this.#iu.appendChild(e),e}getInputElement(){return this.#ic?.querySelector(`.${mo.CLASS_INPUT}`)??null}getEditorElement(){return this.#ic}destroy(){let e=this.#iu?this.#iu.parentNode:null;this.#ic?.parentNode?.removeChild(this.#ic),this.#ic=null,this.#ig=null,this.#eg.destroy(),e&&this.#iu&&e.removeChild(this.#iu)}}th(mo,ab);class mi{wasLastActionShow=!0;showDebounced=null;hidingTimer=null;constructor(e){this.updateDelay(e)}hide(){this.wasLastActionShow=!1,this.hidingTimer=setTimeout(()=>{!1===this.wasLastActionShow&&this.runLocalHooks("hide")},250)}show(e){this.wasLastActionShow=!0,this.showDebounced?.(e)}cancelHiding(){this.wasLastActionShow=!0,clearTimeout(this.hidingTimer??void 0),this.hidingTimer=null}updateDelay(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:250;this.showDebounced=nd(e=>{this.wasLastActionShow&&this.runLocalHooks("show",e.from.row,e.from.col)},e)}destroy(){this.clearLocalHooks()}}th(mi,ab);let ms="---------";function ma(e,t){let r={};return J(e,e=>{e.forAll((e,n)=>{e>=0&&n>=0&&(r[e]||(r[e]=[]),r[e][n]=t(e,n))})}),r}function ml(e,t,r,n,o){J(e,e=>{e.forAll((e,i)=>{var s,a,l,h,d,u;let c,g;e>=0&&i>=0&&(s=e,a=i,l=t,h=r,d=n,u=o,c=d(s,a),g=h,c.className&&(g="vertical"===l?function(e,t){if(-1!==e.indexOf(t))return e;let r=e.replace("htTop","").replace("htMiddle","").replace("htBottom","").replace("  ","");return`${r} ${t}`}(c.className,h):function(e,t){if(-1!==e.indexOf(t))return e;let r=e.replace("htLeft","").replace("htCenter","").replace("htRight","").replace("htJustify","").replace("  ","");return`${r} ${t}`}(c.className,h)),u(s,a,"className",g))})})}function mh(e){return`<span class="selected">${String.fromCharCode(10003)}</span>${e}`}function md(e,t){let r=!1;return Array.isArray(e)&&J(e,e=>(e.forAll((e,n)=>{if(e>=0&&n>=0&&t(e,n))return r=!0,!1}),r)),r}function mu(e,t){let r={top:0,left:0};if(t!==e.ownerDocument){let{frameElement:e}=t.defaultView,{top:n,left:o}=e.getBoundingClientRect();r.top=n,r.left=o}return r}let mc="comments",mg="comment",mp="value",mm="style",mf="readOnly",mb=`plugin:${mc}`;class mC{commands={};commonCallback=null;constructor(e){this.hot=e}registerCommand(e,t){this.commands[e]=t}setCommonCallback(e){this.commonCallback=e}execute(e){let t;for(var r,n=arguments.length,o=Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];let s=e.split(":"),a=s[0],l=2===s.length?s[1]:null,h=this.commands[a];if(h||tr(`Menu command '${a}' not exists.`),l&&h.submenu&&(r=l,J(h.submenu.items,e=>{let n=e.key?e.key.split(":"):null;if(Array.isArray(n)&&n[1]===r)return t=e,!1}),h=t),!0===h.disabled||"function"==typeof h.disabled&&!0===h.disabled.call(this.hot)||ty(h,"submenu"))return;let d=[];"function"==typeof h.callback&&d.push(h.callback),"function"==typeof this.commonCallback&&d.push(this.commonCallback),o.unshift(s.join(":")),J(d,e=>e.apply(this.hot,o))}}let my="alignment",mw="clear_column",mS="col_left",mv="col_right",mR="make_read_only",mE="redo",mT="remove_col",mA="remove_row",mM="row_above",mI="row_below",mx="no_items",mN="undo",mO=[mM,mI,mS,mv,mw,mA,mT,mN,mE,mR,my,ms,mx],mk={[ms]:function(){return{name:ms}},[mx]:function(){return{key:mx,name(){return this.getTranslatedPhrase(aY)},disabled:!0,isCommand:!1}},[mM]:function(){return{key:mM,name(){return this.getTranslatedPhrase(aj)},callback(){let e=this.getSelectedRangeActive();if(!e)return;let t=e.getTopLeftCorner();null!==t.row&&this.alter("insert_row_above",t.row,1,"ContextMenu.rowAbove")},disabled(){let e=this.getSelectedRangeActive();return!!(!e||this.selection.isSelectedByColumnHeader()||e.isSingleHeader()&&null!==e.highlight.row&&e.highlight.row<0||this.countSourceRows()>=(this.getSettings().maxRows??1/0))||!!this.selection.isSelectedByCorner()&&0===this.countRows()},hidden(){return!this.getSettings().allowInsertRow}}},[mI]:function(){return{key:mI,name(){return this.getTranslatedPhrase(aq)},callback(){let e=this.getSelectedRangeActive();if(!e)return;let t=e.getBottomRightCorner();null!==t.row&&this.alter("insert_row_below",t.row,1,"ContextMenu.rowBelow")},disabled(){let e=this.getSelectedRangeActive();return!!(!e||this.selection.isSelectedByColumnHeader()||e.isSingleHeader()&&null!==e.highlight.row&&e.highlight.row<0||this.countSourceRows()>=(this.getSettings().maxRows??1/0))},hidden(){return!this.getSettings().allowInsertRow}}},[mS]:function(){return{key:mS,name(){return this.getTranslatedPhrase(aK)},callback(){let e=this.getSelectedRangeActive();if(!e)return;let t=e.getTopLeftCorner(),r=this.isRtl()?"insert_col_end":"insert_col_start";null!==t.col&&this.alter(r,t.col,1,"ContextMenu.columnLeft")},disabled(){if(!this.isColumnModificationAllowed())return!0;let e=this.getSelectedRangeActive();return!!(!e||this.selection.isSelectedByRowHeader()||e.isSingleHeader()&&(e.highlight.col??0)<0||this.countSourceCols()>=(this.getSettings().maxCols??1/0))||!!this.selection.isSelectedByCorner()&&0===this.countCols()},hidden(){return!this.getSettings().allowInsertColumn}}},[mv]:function(){return{key:mv,name(){return this.getTranslatedPhrase(aX)},callback(){let e=this.getSelectedRangeActive();if(!e)return;let t=e.getTopRightCorner(),r=this.isRtl()?"insert_col_start":"insert_col_end";null!==t.col&&this.alter(r,t.col,1,"ContextMenu.columnRight")},disabled(){if(!this.isColumnModificationAllowed())return!0;let e=this.getSelectedRangeActive();return!!(!e||this.selection.isSelectedByRowHeader()||e.isSingleHeader()&&(e.highlight.col??0)<0||this.countSourceCols()>=(this.getSettings().maxCols??1/0))},hidden(){return!this.getSettings().allowInsertColumn}}},[mw]:function(){return{key:mw,name(){return this.getTranslatedPhrase(a2)},callback(e,t){let r=t[0].start.col,n=t[0].end.col;this.countRows()&&this.populateFromArray(0,r,[[null]],Math.max(t[0].start.row,t[0].end.row),n,"ContextMenu.clearColumn")},disabled(){let e=this.getSelectedRangeActive();if(!e||e.isSingleHeader()&&(null===e.highlight.col||e.highlight.col<0)||!this.selection.isSelectedByColumnHeader())return!0;let t=!1;return e.forAll((e,r)=>{if(e<0||r<0)return!0;let{readOnly:n}=this.getCellMetaTransient(e,r);return!!n||(t=!0,!1)}),!t}}},[mA]:function(){return{key:mA,name(){let e=this.getSelected(),t=0;if(e)if(e.length>1)t=1;else{let[r,,n]=e[0];r-n!=0&&(t=1)}return this.getTranslatedPhrase(aQ,t)},callback(){this.alter("remove_row",function(e){let t=h8(e.getSelected());if(0===t||1===t)return[];let r=de(t,{createCellCoords:e._createCellCoords.bind(e),createCellRange:e._createCellRange.bind(e)}),n=new Set;return J(e.getSelected()??[],e=>{let{from:t,to:o}=r(e),i=Math.max(t.row??0,0);J(Array.from(Array((o.row??0)-i+1),(e,t)=>i+t),e=>{n.has(e)||n.add(e)})}),X(Array.from(n).sort((e,t)=>e-t),(e,t,r,n)=>(0!==r&&t===n[r-1]+1?e[e.length-1][1]+=1:e.push([t,1]),e),[])}(this),1,"ContextMenu.removeRow")},disabled(){let e=this.getSelectedRangeActive();if(!e||e.isSingleHeader()&&null!==e.highlight.row&&e.highlight.row<0)return!0;let t=this.countRows();return this.selection.isSelectedByCorner()?0===t:this.selection.isSelectedByColumnHeader()||0===t},hidden(){return!this.getSettings().allowRemoveRow}}},[mT]:function(){return{key:mT,name(){let e=this.getSelected(),t=0;if(e)if(e.length>1)t=1;else{let[,r,,n]=e[0];r-n!=0&&(t=1)}return this.getTranslatedPhrase(aZ,t)},callback(){this.alter("remove_col",function(e){let t=h8(e.getSelected());if(0===t||1===t)return[];let r=de(t,{createCellCoords:e._createCellCoords.bind(e),createCellRange:e._createCellRange.bind(e)}),n=new Set;return J(e.getSelected()??[],e=>{let{from:t,to:o}=r(e),i=Math.max(t.col??0,0);J(Array.from(Array((o.col??0)-i+1),(e,t)=>i+t),e=>{n.has(e)||n.add(e)})}),X(Array.from(n).sort((e,t)=>e-t),(e,t,r,n)=>(0!==r&&t===n[r-1]+1?e[e.length-1][1]+=1:e.push([t,1]),e),[])}(this),void 0,"ContextMenu.removeColumn")},disabled(){if(!this.isColumnModificationAllowed())return!0;let e=this.getSelectedRangeActive();if(!e||e.isSingleHeader()&&null!==e.highlight.col&&e.highlight.col<0)return!0;let t=this.countCols();return this.selection.isSelectedByCorner()?0===t:this.selection.isSelectedByRowHeader()||0===t},hidden(){return!this.getSettings().allowRemoveColumn}}},[mN]:function(){return{key:mN,name(){return this.getTranslatedPhrase(aJ)},callback(){this.getPlugin("undoRedo").undo()},hidden(){let e=this.getPlugin("undoRedo");return!e||!e.isEnabled()},disabled(){return!this.getPlugin("undoRedo").isUndoAvailable()}}},[mE]:function(){return{key:mE,name(){return this.getTranslatedPhrase(a0)},callback(){this.getPlugin("undoRedo").redo()},hidden(){let e=this.getPlugin("undoRedo");return!e||!e.isEnabled()},disabled(){return!this.getPlugin("undoRedo").isRedoAvailable()}}},[mR]:function(){return{key:mR,checkable:!0,ariaChecked(){return md(this.getSelectedRange()??[],(e,t)=>!!this.getCellMetaTransient(e,t).readOnly)},ariaLabel(){return this.getTranslatedPhrase(a1)},name(){let e=this.getTranslatedPhrase(a1);return md(this.getSelectedRange()??[],(e,t)=>!!this.getCellMetaTransient(e,t).readOnly)&&(e=mh(e)),e},callback(){let e=this.getSelectedRange()??[],t=md(e,(e,t)=>!!this.getCellMetaTransient(e,t).readOnly);for(let r of e)r.forAll((e,r)=>{e>=0&&r>=0&&this.setCellMeta(e,r,"readOnly",!t)});this.render()},disabled(){let e=this.getSelectedRangeActive();return!(!(!e||e.isSingleHeader()||this.selection.isSelectedByCorner())&&0!==this.countRows()&&0!==this.countCols()&&this.getSelectedRange()?.length)}}},[my]:function(){return{key:my,name(){return this.getTranslatedPhrase(lh)},disabled(){if(0===this.countRows()||0===this.countCols())return!0;let e=this.getSelectedRangeActive();return!!(!e||e.isSingleHeader())||!(this.getSelectedRange()&&!this.selection.isSelectedByCorner())},submenu:{items:[{key:`${my}:left`,name(){return this.getTranslatedPhrase(ld)},callback(){let e=this.getSelectedRange()??[],t=ma(e,(e,t)=>this.getCellMetaTransient(e,t).className),r="horizontal",n="htLeft";this.runHooks("beforeCellAlignment",t,e,r,n),ml(e,r,n,(e,t)=>this.getCellMetaTransient(e,t),(e,t,r,n)=>this.setCellMeta(e,t,r,n)),this.render()},disabled:!1},{key:`${my}:center`,name(){return this.getTranslatedPhrase(lu)},callback(){let e=this.getSelectedRange()??[],t=ma(e,(e,t)=>this.getCellMetaTransient(e,t).className),r="horizontal",n="htCenter";this.runHooks("beforeCellAlignment",t,e,r,n),ml(e,r,n,(e,t)=>this.getCellMetaTransient(e,t),(e,t,r,n)=>this.setCellMeta(e,t,r,n)),this.render()},disabled:!1},{key:`${my}:right`,name(){return this.getTranslatedPhrase(lc)},callback(){let e=this.getSelectedRange()??[],t=ma(e,(e,t)=>this.getCellMetaTransient(e,t).className),r="horizontal",n="htRight";this.runHooks("beforeCellAlignment",t,e,r,n),ml(e,r,n,(e,t)=>this.getCellMetaTransient(e,t),(e,t,r,n)=>this.setCellMeta(e,t,r,n)),this.render()},disabled:!1},{key:`${my}:justify`,name(){return this.getTranslatedPhrase(lg)},callback(){let e=this.getSelectedRange()??[],t=ma(e,(e,t)=>this.getCellMetaTransient(e,t).className),r="horizontal",n="htJustify";this.runHooks("beforeCellAlignment",t,e,r,n),ml(e,r,n,(e,t)=>this.getCellMetaTransient(e,t),(e,t,r,n)=>this.setCellMeta(e,t,r,n)),this.render()},disabled:!1},{name:ms},{key:`${my}:top`,name(){return this.getTranslatedPhrase(lp)},callback(){let e=this.getSelectedRange()??[],t=ma(e,(e,t)=>this.getCellMetaTransient(e,t).className),r="vertical",n="htTop";this.runHooks("beforeCellAlignment",t,e,r,n),ml(e,r,n,(e,t)=>this.getCellMetaTransient(e,t),(e,t,r,n)=>this.setCellMeta(e,t,r,n)),this.render()},disabled:!1},{key:`${my}:middle`,name(){return this.getTranslatedPhrase(lm)},callback(){let e=this.getSelectedRange()??[],t=ma(e,(e,t)=>this.getCellMetaTransient(e,t).className),r="vertical",n="htMiddle";this.runHooks("beforeCellAlignment",t,e,r,n),ml(e,r,n,(e,t)=>this.getCellMetaTransient(e,t),(e,t,r,n)=>this.setCellMeta(e,t,r,n)),this.render()},disabled:!1},{key:`${my}:bottom`,name(){return this.getTranslatedPhrase(lf)},callback(){let e=this.getSelectedRange()??[],t=ma(e,(e,t)=>this.getCellMetaTransient(e,t).className),r="vertical",n="htBottom";this.runHooks("beforeCellAlignment",t,e,r,n),ml(e,r,n,(e,t)=>this.getCellMetaTransient(e,t),(e,t,r,n)=>this.setCellMeta(e,t,r,n)),this.render()},disabled:!1}]}}}};function mH(){let e={};return tp(mk,(t,r)=>{e[r]=t()}),e}class m_{predefinedItems=mH();constructor(e,t=null){this.hot=e,this.defaultOrderPattern=t||[]}setPredefinedItems(e){let t={};this.defaultOrderPattern.length=0,tp(e,(e,r)=>{let n="";if(e.name===ms)t[ms]=e,n=ms;else if(isNaN(parseInt(r,10)))e.key=void 0===e.key?r:e.key,t[r]=e,n=String(e.key??"");else{let r=String(e.key??"");if(t[r])return void ti(t[r],e);t[r]=e,n=r}this.defaultOrderPattern.push(n)}),this.predefinedItems=t}getItems(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=[],o=e;return(o&&o.items?o=o.items:Array.isArray(o)||(o=t),tc(o))?tp(o,(e,t)=>{let o=r["string"==typeof e?e:t];(o||(o=e),tc(e))?ti(o,e):"string"==typeof o&&(o={name:o}),void 0===o.key&&(o.key=t),n.push(o)}):J(o,(e,t)=>{let o=r[e];!o&&mO.indexOf(e)>=0||(o||(o={name:e,key:`${t}`}),tc(e)&&ti(o,e),void 0===o.key&&(o.key=t),n.push(o))}),n}(e,this.defaultOrderPattern,this.predefinedItems)}}class mL{top;topRelative;left;leftRelative;scrollTop;scrollLeft;cellHeight;cellWidth;constructor(e,t){const r=t.scrollY,n=t.scrollX;let o=0,i=0,s=0,a=0,l=0,h=0;this.rootWindow=t,this.type=this.getSourceType(e),"literal"===this.type?(o=parseInt(String(e.top),10),s=parseInt(String(e.left),10),l=e.height||0,h=e.width||0,i=o,a=s,o+=r,s+=n):"event"===this.type&&(o=parseInt(String(e.pageY),10),s=parseInt(String(e.pageX),10),l=t4(e).clientHeight,h=t4(e).clientWidth,i=o-r,a=s-n),this.top=o,this.topRelative=i,this.left=s,this.leftRelative=a,this.scrollTop=r,this.scrollLeft=n,this.cellHeight=l,this.cellWidth=h}getSourceType(e){let t="literal";return e instanceof Event&&(t="event"),t}fitsAbove(e){return this.topRelative>=e.offsetHeight}fitsBelow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.rootWindow.innerHeight;return this.topRelative+e.offsetHeight<=t}fitsOnRight(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.rootWindow.document.documentElement.clientWidth;return this.leftRelative+this.cellWidth+e.offsetWidth<=t}fitsOnLeft(e){return this.leftRelative>=e.offsetWidth}}class mP{#iu=null;#im=null;#ib=null;#iC=!1;#rt={above:0,below:0,left:0,right:0};constructor(e){this.#iC=e}setOffset(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.#rt[e]=t,this}setElement(e){return this.#iu=e,this}setParentElement(e){return this.#im=e,this}updatePosition(e){this.#ib=new mL(e,this.#iu.ownerDocument.defaultView),this.#iC?(this.#ib.fitsBelow(this.#iu)?this.setPositionBelowCursor():this.#ib.fitsAbove(this.#iu)?this.setPositionAboveCursor():this.setPositionBelowCursor(),this.updateHorizontalPosition()):(this.setPositionBelowCursor(),this.setPositionOnRightOfCursor())}updateHorizontalPosition(){"rtl"===this.#iu.dir?this.#ib.fitsOnLeft(this.#iu)?this.setPositionOnLeftOfCursor():this.setPositionOnRightOfCursor():this.#ib.fitsOnRight(this.#iu)?this.setPositionOnRightOfCursor():this.setPositionOnLeftOfCursor()}setPositionAboveCursor(){let e=this.#rt.above+this.#ib.top-this.#iu.offsetHeight;if(this.#im){let t=this.#im.ownerDocument.defaultView.getComputedStyle(this.#im.querySelector(".ht_master")),r=Number.parseInt(t.paddingTop,10),n=Number.parseInt(t.borderTop,10);e=this.#ib.top+this.#ib.cellHeight-this.#iu.scrollHeight+r+n}this.#iu.style.top=`${e}px`}setPositionBelowCursor(){let e=this.#rt.below+this.#ib.top+1;if(this.#im){let t=this.#im.ownerDocument.defaultView.getComputedStyle(this.#im.querySelector(".ht_master")),r=Number.parseInt(t.paddingTop,10),n=Number.parseInt(t.borderTop,10);e=this.#ib.top-r-n}this.#iu.style.top=`${e}px`}setPositionOnRightOfCursor(){let e=this.#ib.left;if(this.#im){let t=Number.parseInt(this.#im.ownerDocument.defaultView.getComputedStyle(this.#im.querySelector(".htCore")).borderRightWidth,10);e+=this.#ib.cellWidth+t}else e+=this.#rt.right;this.#iu.style.left=`${e}px`}setPositionOnLeftOfCursor(){let e=this.#rt.left+this.#ib.left-this.#iu.offsetWidth;this.#im&&(e-=Number.parseInt(this.#im.ownerDocument.defaultView.getComputedStyle(this.#im.querySelector(".htCore")).borderLeftWidth,10)),this.#iu.style.left=`${e}px`}}function mD(e){let{initialPage:t=-1,size:r=()=>0,onItemSelect:n=()=>{},onClear:o=()=>{}}=e,i=new Set,s=ox(t,-1,l()-1);function a(e,t){let r=l()-1;return(e<0&&(e=r),e>r&&(e=0),i.has(e))?-1:(i.add(e),!1===n(e,!1)&&(e=a(1===t?++e:--e,t)),e)}function l(){return Math.max(r(),0)}return{setCurrentPage:function(e){e>-1&&e<l()&&!1!==n(e,!0)&&(s=e)},setPageCursorAt:function(e){e>-1&&e<l()&&(s=e)},getCurrentPage:function(){return s},toFirstItem:function(){l()>0&&(i.clear(),s=a(0,1))},toLastItem:function(){l()>0&&(i.clear(),s=a(l()-1,-1))},toNextItem:function(){l()>0&&(i.clear(),s=a(++s,1))},toPreviousItem:function(){l()>0&&(i.clear(),s=a(--s,-1))},getSize:l,clear:function(){i.clear(),s=t,o()}}}function mF(e){return ty(e,"submenu")}function mB(e){return RegExp(ms,"i").test(e.name??"")}function mV(e,t){return!0===e.disabled||"function"==typeof e.disabled&&!0===e.disabled.call(t)}function mU(e){return ty(e,"disableSelection")}function mz(e,t){let r=e.slice(0);for(;0<r.length;)if(r[0].name===t)r.shift();else break;return r}let mW="menu";class mG{hotMenu=null;hotSubMenus={};menuItems=null;origOutsideClickDeselects=void 0;#iy=null;#iw=null;#iS;#iv=null;#iR=null;#iE=!1;#iT=null;#iA=[];get tableBorderWidth(){return void 0===this.#iS&&this.hotMenu&&(this.#iS=parseInt(this.hotMenu.rootWindow.getComputedStyle(this.hotMenu.view._wt.wtTable.TABLE).borderWidth,10)),this.#iS}constructor(e,t){if(this.hot=e,this.options={parent:null,name:null,className:"",keepInViewport:!0,standalone:!1,minWidth:215,container:this.hot.rootPortalElement,...t},this.container=this.createContainer(this.options.name),this.positioner=new mP(this.options.keepInViewport),this.parentMenu=this.options.parent||null,this.eventManager=new n5(this),this.registerEvents(),this.isSubMenu()){var r=this;this.addLocalHook("afterSelectionChange",function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.parentMenu.runLocalHooks("afterSelectionChange",...t)})}this.hot.addHook("afterSetTheme",(e,t)=>{if(this.options.container!==this.hot.rootPortalElement){let t=this.options.container;ru(t,/ht-theme-.*/g),rd(t,e)}t||this.close()})}registerEvents(){let e=this.hot.rootWindow;for(;e;)this.eventManager.addEventListener(e.document,"mousedown",e=>this.onDocumentMouseDown(e)),this.eventManager.addEventListener(e.document,"touchstart",e=>this.onDocumentMouseDown(e)),this.eventManager.addEventListener(e.document,"contextmenu",e=>this.onDocumentContextMenu(e)),e=t7(e)}#iM(){this.#iI();let e=this.hot.rootWindow;for(;e;)this.#iA.push(this.eventManager.addEventListener(e.document,"scroll",e=>this.onDocumentScroll(e),{capture:!0,passive:!0})),e=t7(e)}#iI(){this.#iA.forEach(e=>e()),this.#iA.length=0}setMenuItems(e){this.menuItems=e}getNavigator(){return this.#iy}getKeyboardShortcutsCtrl(){return this.#iw}getSelectedItem(){if(!this.hasSelectedItem())return null;let e=this.hotMenu.getSelectedActive()[0];return this.#ix(e)}getItemPositionByKey(e){return(this.hotMenu?.getSourceData()??this.menuItems??[]).findIndex(t=>t.key===e)}#ix(e){return this.hotMenu?.getSourceDataAtRow(e)||null}hasSelectedItem(){return Array.isArray(this.hotMenu.getSelectedActive())}isSubMenu(){return null!==this.parentMenu}open(){var e,t,r=this;this.runLocalHooks("beforeOpen"),this.container.removeAttribute("style"),this.container.style.display="block";let n=nd(function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.openSubMenu(t[0])},300),o=Number(this.options.minWidth)||215,i=!1,s=Q(this.menuItems,e=>{var t;return e.key===mx&&(i=!0),t=this.hot,!e.hidden||!("function"==typeof e.hidden&&e.hidden.call(t))});if(s.length<1&&!i)s.push(mH()[mx]);else if(0===s.length)return;this.#iM();let a=!1,l={data:s=function(e){var t;let r,n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ms,i=e.slice(0);return t=i=mz(i,o),(r=t.slice(0)).reverse(),(r=mz(r,o)).reverse(),n=[],J(i=r,(e,t)=>{t>0?n[n.length-1].name!==e.name&&n.push(e):n.push(e)}),i=n}(s),colHeaders:!1,autoColumnSize:!0,autoWrapRow:!1,modifyColWidth:e=>e_(e)&&e<o?o:e,autoRowSize:!1,readOnly:!0,editor:!1,copyPaste:!1,hiddenRows:!0,maxCols:1,columns:[{data:"name",renderer:(e=this.hot,(t,r,n,o,i,s,a)=>{let l=t.getSourceDataAtRow(n),h=e.rootDocument.createElement("div"),d="function"==typeof s?s.call(e):s,u="function"==typeof l.ariaLabel?l.ariaLabel.call(e):l.ariaLabel,c="function"==typeof l.ariaChecked?l.ariaChecked.call(e):l.ariaChecked;if(a.readOnlyCellClassName="",rm(r),rd(h,"htItemWrapper"),e.getSettings().ariaTags){let t=!mV(l,e)&&!mU(l)&&!mB(l);rc(r,[...!0===l.checkable?[["role","menuitemcheckbox"],H(u),G(c)]:[["role","menuitem"],H(d)],...t?[v(-1)]:[],...mV(l,e)?[L()]:[],...mF(l)?[U(!1)]:[]])}r.className="",r.appendChild(h),mB(l)?rd(r,"htSeparator"):"function"==typeof l.renderer?(rd(r,"htCustomMenuRenderer"),r.appendChild(l.renderer(t,h,n,o,i,d))):rw(h,String(d),ae(e),"contextMenu",e.rootElement),mV(l,e)?rd(r,"htDisabled"):mU(l)?rd(r,"htSelectionDisabled"):mF(l)&&rd(r,"htSubmenu")})}],renderAllRows:!0,fragmentSelection:!1,outsideClickDeselects:!1,disableVisualSelection:"area",layoutDirection:this.hot.isRtl()?"rtl":"ltr",ariaTags:!1,themeName:this.hot.getCurrentThemeName(),modifyRowHeight:(e,t)=>{let r=this.#ix(t);return r&&r.name===ms?1:e},beforeRefreshDimensions:()=>!1,beforeOnCellMouseOver:(e,t)=>{this.#iE||this.#iy.setPageCursorAt(t.row)},afterOnCellMouseOver:(e,t)=>{this.#iE||(this.isAllSubMenusClosed()?n(t.row):this.openSubMenu(t.row))},afterOnCellContextMenu:e=>{e.preventDefault(),tY()&&a&&this.hasSelectedItem()&&this.close(!0)},afterSelection:(e,t,r,n,o)=>{this.hotMenu.view.isMouseDown()&&(o.value=!0),this.runLocalHooks("afterSelectionChange",this.getSelectedItem())},beforeOnCellMouseUp:e=>{this.hasSelectedItem()&&(a=!this.isCommandPassive(this.getSelectedItem()),this.executeCommand(e))},afterOnCellMouseUp:e=>{(!tY()||!nT(e))&&a&&this.hasSelectedItem()&&(tW()||t$()?this.hot._registerTimeout(()=>this.close(!0),325):this.close(!0))},afterUnlisten:()=>{!this.hasSelectedItem()&&this.isOpened()&&this.hotMenu.listen()}};this.origOutsideClickDeselects=this.hot.getSettings().outsideClickDeselects,this.hot.getSettings().outsideClickDeselects=!1,this.hotMenu=new this.hot.constructor(this.container,l),this.hotMenu.addHook("afterInit",()=>this.onAfterInit()),this.hotMenu.init(),this.#iy=(t=this.hotMenu,mD({size:()=>t.countRows(),onItemSelect(e,r){let n=t.getCell(e,0);if(!n||rh(n,"htSeparator")||rh(n,"htDisabled")||rh(n,"htSelectionDisabled"))return!1;t.selectCell(e,0,...r?[e,0,!1,!1]:[])},onClear(){t.deselectCell()}})),this.#iw=function(e){let t,r,n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=[];function s(e,t){h(t).addShortcuts(e,{group:mW})}function a(e,t){let r=h(t);e.forEach(e=>{let{keys:t}=e;t.forEach(e=>r.removeShortcutsByKeys(e))}),i.push({shortcuts:e,contextName:t??mW}),s(e,t)}function l(e){return e?`${mW}:${e}`:mW}function h(t){let r=e.hotMenu.getShortcutManager(),n=l(t);return r.getContext(n)??r.addContext(n)}return s((t=e.hot,r=e.hotMenu,[{keys:[["Control/Meta","A"]],...(n=t.getShortcutManager().getContext("grid"))?{forwardToContext:n}:{},callback:()=>e.close(!0)},{keys:[["Tab"],["Shift","Tab"]],callback:(r,n)=>{let o=t.getSettings(),i="function"==typeof o.tabMoves?o.tabMoves(r):o.tabMoves;i&&(n?.includes("shift")?t.selection.transformStart(-i.row,-i.col):t.selection.transformStart(i.row,i.col)),e.close(!0)}},{keys:[["Escape"]],callback:()=>e.close()},{keys:[["ArrowDown"]],callback:()=>e.getNavigator()?.toNextItem()},{keys:[["ArrowUp"]],callback:()=>e.getNavigator()?.toPreviousItem()},{keys:[[t.isRtl()?"ArrowLeft":"ArrowRight"]],callback:()=>{let t=r?.getSelectedActive();if(t){let r=e.openSubMenu(t[0]);r&&r.getNavigator()?.toFirstItem()}}},{keys:[[t.isRtl()?"ArrowRight":"ArrowLeft"]],callback:()=>{r?.getSelectedActive()&&e.isSubMenu()&&(e.close(),e.isSubMenu()&&e.parentMenu?.hotMenu?.listen())}},{keys:[["Control/Meta","ArrowUp"],["Home"]],callback:()=>e.getNavigator()?.toFirstItem()},{keys:[["Control/Meta","ArrowDown"],["End"]],callback:()=>e.getNavigator()?.toLastItem()},{keys:[["Enter"],["Space"]],callback:t=>{let n=r?.getSelectedActive();if(n)if(r?.getSourceDataAtRow(n[0])?.submenu){let t=e.openSubMenu(n[0]);t&&t.getNavigator()?.toFirstItem()}else e.executeCommand(t),e.close(!0)}},{keys:[["PageUp"]],callback:()=>{r?.getSelectedActive()?r?.selection.transformStart(-r.countVisibleRows(),0):e.getNavigator()?.toFirstItem()}},{keys:[["PageDown"]],callback:()=>{r?.getSelectedActive()?r?.selection.transformStart(r.countVisibleRows(),0):e.getNavigator()?.toLastItem()}}])),o.forEach(e=>{let{shortcuts:t,contextName:r}=e;a(t,r)}),{addCustomShortcuts:a,getCustomShortcuts:function(){return[...i]},getContext:h,listen:function(t){e.hotMenu.getShortcutManager().setActiveContextName(l(t))}}}(this),this.#iw.listen(),this.focus(),this.isSubMenu()&&this.addLocalHook("afterOpen",()=>this.parentMenu.runLocalHooks("afterSubmenuOpen",this)),this.runLocalHooks("afterOpen",this)}close(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isOpened()){if(e&&this.isSubMenu())this.parentMenu.close();else if(this.#iy.clear(),this.closeAllSubMenus(),this.container.style.display="none",this.hotMenu.destroy(),this.hotMenu=null,this.#iv=null,this.#iR=null,this.#iI(),null!==this.#iT&&(this.hot.rootWindow.cancelAnimationFrame(this.#iT),this.#iT=null),this.#iE=!1,this.hot.getSettings().outsideClickDeselects=this.origOutsideClickDeselects,this.runLocalHooks("afterClose"),this.isSubMenu()){if(this.hot.getSettings().ariaTags){let e=this.parentMenu.hotMenu.getSelectedActive();if(e){let t=this.parentMenu.hotMenu.getCell(e[0],0);t&&rc(t,[U(!1)])}}this.parentMenu.hotMenu.listen()}}}openSubMenu(e){if(!this.hotMenu)return!1;let t=this.hotMenu.getCell(e,0);if(this.closeAllSubMenus(),!t||!rh(t,"htSubmenu"))return!1;let r=this.#ix(e),n=new mG(this.hot,{parent:this,name:"function"==typeof r.name?r.name.call(this.hot):r.name,className:this.options.className,keepInViewport:!0,container:this.options.container});return n.setMenuItems(r.submenu.items),n.open(),n.setPosition(t.getBoundingClientRect(),()=>t.isConnected?t.getBoundingClientRect():null),this.hotSubMenus[r.key]=n,this.hot.getSettings().ariaTags&&rc(t,[U(!0)]),n}closeSubMenu(e){let t=this.#ix(e),r=this.hotSubMenus[t.key];if(r){r.destroy(),delete this.hotSubMenus[t.key];let n=this.hotMenu.getCell(e,0);n&&this.hot.getSettings().ariaTags&&rc(n,[U(!1)])}}closeAllSubMenus(){J(this.hotMenu.getData(),(e,t)=>this.closeSubMenu(t))}isAllSubMenusClosed(){return 0===Object.keys(this.hotSubMenus).length}focus(){this.isOpened()&&(this.hotMenu.rootElement.focus({preventScroll:!0}),this.getKeyboardShortcutsCtrl().listen(),this.hotMenu.listen())}destroy(){let e=this.container.parentNode;this.clearLocalHooks(),this.close(),this.parentMenu=null,this.eventManager.destroy(),e&&e.removeChild(this.container)}isOpened(){return null!==this.hotMenu}executeCommand(e){if(!this.isOpened()||!this.hasSelectedItem())return;let t=this.getSelectedItem();if(this.runLocalHooks("select",t,e),this.isCommandPassive(t))return;let r=this.hot.getSelectedRange(),n=r?Z(r,e=>({start:e.getTopStartCorner(),end:e.getBottomEndCorner()})):[];this.runLocalHooks("executeCommand",t.key,n,e),this.isSubMenu()&&this.parentMenu.runLocalHooks("executeCommand",t.key,n,e)}isCommandPassive(e){return!1===e.isCommand||mB(e)||mV(e,this.hot)||mF(e)}setOffset(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.positioner.setOffset(e,t)}setPosition(e,t){this.isSubMenu()&&this.positioner.setParentElement(this.parentMenu.container),this.positioner.setElement(this.container).updatePosition(e),this.#iv=t??null,this.#iN()}#iN(){let e=this.container.getBoundingClientRect(),t=this.#iv?.()??this.hot.rootElement.getBoundingClientRect();this.#iR={offsetLeft:e.left-t.left,offsetTop:e.top-t.top}}updateMenuDimensions(){let{wtTable:e}=this.hotMenu.view._wt,t=this.hotMenu.getSettings().data,r=e.hider.style,n=e.holder.style,o=parseInt(r.width,10),i=X(t??[],(e,t,r)=>{let n=this.hotMenu.getCell(r,0),o=n?rB(n):0;return e+("object"==typeof t&&null!==t&&"name"in t&&t.name===ms?1:o)},0);n.width=`${o}px`,n.height=`${i}px`,r.height=n.height}createContainer(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=this.options.container,r=t.ownerDocument,n=e,o=null;return n&&(n=n.replace(/[^A-Za-z0-9]/g,"_"),n=`${this.options.className}Sub_${n}`,o=r.querySelector(`.${this.options.className}.${n}`)),o||(rd(o=r.createElement("div"),`htMenu handsontable ${this.options.className}`),n&&rd(o,n),t.appendChild(o)),o}onAfterInit(){this.updateMenuDimensions(),this.hot.getSettings().ariaTags&&rc(this.hotMenu.rootElement,[["role","menu"],v(-1)])}onDocumentMouseDown(e){this.isOpened()&&(this.options.standalone&&this.hotMenu&&!rn(t4(e),this.hotMenu.rootElement)?this.close(!0):(this.isAllSubMenusClosed()||this.isSubMenu())&&!rn(t4(e),".htMenu")&&this.close(!0))}onDocumentScroll(e){!this.isOpened()||null===this.#iR||!ne(e.target)||rn(e.target,".htMenu")||this.#iO(e.target)}#iO(e){let t;if(this.#iv)t=this.#iv();else{if(e===this.hot.rootElement||rn(e,this.hot.rootElement))return void this.close(!0);t=this.hot.rootElement.getBoundingClientRect()}if(null===t)return void this.close(!0);let{offsetLeft:r,offsetTop:n}=this.#iR,o=this.container.getBoundingClientRect(),i=t.left+r-o.left,s=t.top+n-o.top;(0!==i||0!==s)&&(this.container.style.left=`${(Number.parseFloat(this.container.style.left)||0)+i}px`,this.container.style.top=`${(Number.parseFloat(this.container.style.top)||0)+s}px`,this.#ik())}#ik(){this.#iE=!0,null!==this.#iT&&this.hot.rootWindow.cancelAnimationFrame(this.#iT),this.#iT=this.hot.rootWindow.requestAnimationFrame(()=>{this.#iT=this.hot.rootWindow.requestAnimationFrame(()=>{this.#iE=!1,this.#iT=null})})}onDocumentContextMenu(e){this.isOpened()&&rh(t4(e),"htCore")&&rn(t4(e),this.hotMenu.rootElement)&&e.preventDefault()}}th(mG,ab);let m$="contextMenu";nF.getSingleton().register("afterContextMenuDefaultOptions"),nF.getSingleton().register("beforeContextMenuShow"),nF.getSingleton().register("afterContextMenuShow"),nF.getSingleton().register("afterContextMenuHide"),nF.getSingleton().register("afterContextMenuExecute");class mY extends pa{static get PLUGIN_KEY(){return m$}static get PLUGIN_PRIORITY(){return 70}static get PLUGIN_DEPS(){return["plugin:AutoColumnSize"]}static get SEPARATOR(){return{name:ms}}static get DEFAULT_ITEMS(){return[mM,mI,ms,mS,mv,ms,mA,mT,ms,mN,mE,ms,mR,ms,my]}commandExecutor=new mC(this.hot);itemsFactory=null;menu=null;isEnabled(){return!!this.hot.getSettings()[m$]}enablePlugin(){var e=this;if(this.enabled)return;let t=this.hot.getSettings()[m$],r="object"!=typeof t||null===t||Array.isArray(t)?null:t;r&&"function"==typeof r.callback&&this.commandExecutor.setCommonCallback(r.callback),this.menu=new mG(this.hot,{className:"htContextMenu",keepInViewport:!0,container:r?.uiContainer||this.hot.rootPortalElement}),this.menu.addLocalHook("afterOpen",this.#iH),this.menu.addLocalHook("afterClose",this.#i_),this.menu.addLocalHook("executeCommand",function(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];e.executeCommand.call(e,...r)}),this.addHook("afterOnCellContextMenu",this.#iL),this.addHook("beforeDialogShow",()=>this.close()),this.registerShortcuts(),super.enablePlugin()}updatePlugin(){this.disablePlugin(),this.enablePlugin(),super.updatePlugin()}disablePlugin(){this.close(),this.menu&&(this.menu.destroy(),this.menu=null),this.unregisterShortcuts(),super.disablePlugin()}registerShortcuts(){this.hot.getShortcutManager().getContext("grid")?.addShortcut({keys:[["Control/Meta","Shift","Backslash"],["Shift","F10"]],callback:()=>{let e=this.hot.getSelectedRangeActive();if(!e)return;let{highlight:t}=e;if(null===t.row||null===t.col)return;this.hot.scrollToFocusedCell();let r=this.hot.getCell(t.row,t.col,!0);if(!r)return;let n=r.getBoundingClientRect(),o=mu(this.menu.container,this.hot.rootDocument);this.open({left:n.left+o.left,top:n.top+o.top-1+n.height},{left:n.width,above:-n.height},()=>{let e=this.hot.getCell(t.row,t.col,!0);return e?e.getBoundingClientRect():null}),this.menu.getNavigator().toFirstItem()},runOnlyIf:()=>{let e=this.hot.getSelectedRangeActive()?.highlight;return!!e&&this.hot.selection.isCellVisible(e)&&!this.menu.isOpened()},group:m$})}unregisterShortcuts(){this.hot.getShortcutManager().getContext("grid")?.removeShortcutsByGroup(m$)}open(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{above:0,below:0,left:0,right:0},r=arguments.length>2?arguments[2]:void 0;this.menu?.isOpened()||(this.hot.runHooks("beforeContextMenuShow",this),this.prepareMenuItems(),this.menu.open(),tp(t,(e,t)=>{this.menu.setOffset(t,e)}),this.menu.setPosition(e,r))}close(){this.menu?.close(),this.itemsFactory=null}executeCommand(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];null===this.itemsFactory&&this.prepareMenuItems(),this.commandExecutor.execute(e,...r)}prepareMenuItems(){this.itemsFactory=new m_(this.hot,mY.DEFAULT_ITEMS);let e=this.hot.getSettings()[m$],t={items:this.itemsFactory.getItems(e)};this.hot.runHooks("afterContextMenuDefaultOptions",t),this.itemsFactory.setPredefinedItems(t.items);let r=this.itemsFactory.getItems(e);this.hot.runHooks("beforeContextMenuSetItems",r),this.menu.setMenuItems(r),J(r,e=>{this.commandExecutor.registerCommand(String(e.key??""),e)})}#iL=e=>{let t,r,n=this.hot.getSettings(),o=n.rowHeaders,i=n.colHeaders,s=t4(e);if(this.close(),rh(s,"handsontableInput"))return;if(e.preventDefault(),e.stopPropagation(),!(o||i)&&(r=s.parentNode,!("TD"===s.nodeName||ne(r)&&"TD"===r.nodeName))&&!(rh(s,"current")&&rh(s,"wtBorder")))return;let a=mu(this.menu.container,this.hot.rootDocument),l=s.closest("td, th");if(l){let e=this.hot.getCoords(l);if(e&&null!==e.row&&null!==e.col){let{row:r,col:n}=e;t=()=>{let e=this.hot.getCell(r,n,!0);return e?e.getBoundingClientRect():null}}}this.open({top:e.clientY+a.top,left:e.clientX+a.left},void 0,t)};#iH=()=>{this.hot.runHooks("afterContextMenuShow",this)};#i_=()=>{this.hot.listen(),this.hot.runHooks("afterContextMenuHide",this)};destroy(){this.close(),this.menu&&this.menu.destroy(),super.destroy()}}class mj{constructor(){this.data={}}setData(e,t){this.data[e]=t}getData(e){return this.data[e]||void 0}}class mq{constructor(){this.clipboardData=new mj}preventDefault(){}composedPath(){return[]}}class mK{#iP;#iD;#iF;#iB;#iV;#iU;constructor({countRows:e,countColumns:t,rowsLimit:r,columnsLimit:n,countColumnHeaders:o}){this.#iD=e,this.#iF=t,this.#iB=r,this.#iV=n,this.#iU=o}setSelectedRange(e){this.#iP=e}getCellsRange(){if(0===this.#iD()||0===this.#iF())return null;let{row:e,col:t}=this.#iP.getTopStartCorner(),{row:r,col:n}=this.#iP.getBottomEndCorner();if(null===e||null===t||null===r||null===n)return null;let o=this.#iz(e,r),i=this.#iW(t,n);return{isRangeTrimmed:r!==o||n!==i,startRow:e,startCol:t,endRow:o,endCol:i}}getMostBottomColumnHeadersRange(){if(0===this.#iF()||0===this.#iU())return null;let{col:e}=this.#iP.getTopStartCorner(),{col:t}=this.#iP.getBottomEndCorner();if(null===e||null===t)return null;let r=this.#iW(e,t);return{isRangeTrimmed:t!==r,startRow:-1,startCol:e,endRow:-1,endCol:r}}getAllColumnHeadersRange(){if(0===this.#iF()||0===this.#iU())return null;let{col:e}=this.#iP.getTopStartCorner(),{col:t}=this.#iP.getBottomEndCorner();if(null===e||null===t)return null;let r=this.#iW(e,t);return{isRangeTrimmed:t!==r,startRow:-this.#iU(),startCol:e,endRow:-1,endCol:r}}#iW(e,t){return Math.min(t,Math.max(e+this.#iV()-1,e))}#iz(e,t){return Math.min(t,Math.max(e+this.#iB()-1,e))}}function mX(e){let t=[],r=[],n=new Set,o=new Set;return J(e,e=>{oA(Math.min(e.startRow,e.endRow),Math.max(e.startRow,e.endRow),e=>{n.has(e)||(n.add(e),t.push(e))}),oA(Math.min(e.startCol,e.endCol),Math.max(e.startCol,e.endCol),e=>{o.has(e)||(o.add(e),r.push(e))})}),{rows:t,columns:r}}nF.getSingleton().register("afterCopyLimit"),nF.getSingleton().register("modifyCopyableRange"),nF.getSingleton().register("beforeCut"),nF.getSingleton().register("afterCut"),nF.getSingleton().register("beforePaste"),nF.getSingleton().register("afterPaste"),nF.getSingleton().register("beforeCopy"),nF.getSingleton().register("afterCopy");let mQ="copyPaste",mZ=["fragmentSelection"],mJ="application/ht-source-data-json-html",m0='<meta name="generator" content="Handsontable"/><style type="text/css">td{white-space:normal}br{mso-data-placement:same-cell}</style>';class m1 extends pa{static get PLUGIN_KEY(){return mQ}static get SETTING_KEYS(){return[mQ,...mZ]}static get PLUGIN_PRIORITY(){return 80}static get DEFAULT_SETTINGS(){return{pasteMode:"overwrite",rowsLimit:1/0,columnsLimit:1/0,copyColumnHeaders:!1,copyColumnGroupHeaders:!1,copyColumnHeadersOnly:!1}}columnsLimit=1/0;rowsLimit=1/0;pasteMode="overwrite";uiContainer=this.hot.rootDocument.body;#iG=!1;#i$=!1;#iY=!1;#ij="cells-only";#iq=new WeakSet;#iK=!1;#iX=!1;#iQ=new mK({countRows:()=>this.hot.countRows(),countColumns:()=>this.hot.countCols(),rowsLimit:()=>this.rowsLimit,columnsLimit:()=>this.columnsLimit,countColumnHeaders:()=>this.hot.view.getColumnHeadersCount()});#iZ=!1;copyableRanges=[];isEnabled(){return!!this.hot.getSettings()[mQ]}enablePlugin(){if(this.enabled)return;this.pasteMode=this.getSetting("pasteMode")??this.pasteMode,this.rowsLimit=isNaN(this.getSetting("rowsLimit"))?this.rowsLimit:this.getSetting("rowsLimit"),this.columnsLimit=isNaN(this.getSetting("columnsLimit"))?this.columnsLimit:this.getSetting("columnsLimit"),this.#iG=this.getSetting("copyColumnHeaders"),this.#i$=this.getSetting("copyColumnGroupHeaders"),this.#iY=this.getSetting("copyColumnHeadersOnly"),this.uiContainer=this.getSetting("uiContainer")??this.uiContainer,this.addHook("afterContextMenuDefaultOptions",this.#iJ),this.addHook("afterSelection",this.#i0),this.addHook("afterSelectionEnd",this.#i1);let e=e=>t=>{this.#iq.has(t)||(this.#iq.add(t),e(t))};this.eventManager.addEventListener(this.hot.rootDocument,"copy",e(e=>this.onCopy(e))),this.eventManager.addEventListener(this.hot.rootDocument,"cut",e(e=>this.onCut(e))),this.eventManager.addEventListener(this.hot.rootDocument,"paste",e(e=>this.onPaste(e)));let t=this.hot.rootElement.getRootNode();nn(t)&&(this.eventManager.addEventListener(t,"copy",e(e=>this.onCopy(e))),this.eventManager.addEventListener(t,"cut",e(e=>this.onCut(e))),this.eventManager.addEventListener(t,"paste",e(e=>this.onPaste(e)))),tB()&&(this.eventManager.addEventListener(this.hot.rootDocument.body,"mouseenter",this.#i2),this.eventManager.addEventListener(this.hot.rootDocument.body,"mouseleave",this.#i3),this.addHook("afterSelection",this.#i6)),super.enablePlugin()}updatePlugin(){this.disablePlugin(),this.enablePlugin(),super.updatePlugin()}disablePlugin(){super.disablePlugin()}copy(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"cells-only";this.#ij=e,this.#iK=!0,this.#i5("copy")}copyCellsOnly(){this.copy("cells-only")}copyColumnHeadersOnly(){this.copy("column-headers-only")}copyWithAllColumnHeaders(){this.copy("with-column-group-headers")}copyWithColumnHeaders(){this.copy("with-column-headers")}cut(){this.#iX=!0,this.#i5("cut")}getRangedCopyableData(e){return dI(this.getRangedData(e))}getRangedData(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=[],{rows:n,columns:o}=mX(e);return J(n,e=>{let n=[];J(o,r=>{if(e<0)n.push(this.hot.getColHeader(r,e));else{let o=t?this.hot.getCopyableSourceData(e,r):this.hot.getCopyableData(e,r);t&&(tc(o)||Array.isArray(o))&&(o=JSON.stringify(o)),n.push(o)}}),r.push(n)}),r}paste(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;if(!e&&!t)return;let r=new mq;e&&r.clipboardData.setData("text/plain",e),t&&r.clipboardData.setData("text/html",t),this.onPaste(r)}setCopyableText(){let e=this.hot.getSelectedRangeActive();if(!e)return;if(e.isSingleHeader()){this.copyableRanges=[];return}this.#iQ.setSelectedRange(e);let t=new Map([["headers",null],["cells",null]]);"column-headers-only"===this.#ij?t.set("headers",this.#iQ.getMostBottomColumnHeadersRange()):("with-column-headers"===this.#ij?t.set("headers",this.#iQ.getMostBottomColumnHeadersRange()):"with-column-group-headers"===this.#ij&&t.set("headers",this.#iQ.getAllColumnHeadersRange()),t.set("cells",this.#iQ.getCellsRange())),this.copyableRanges=Array.from(t.values()).filter(e=>null!==e).map(e=>{let{startRow:t,startCol:r,endRow:n,endCol:o}=e;return{startRow:t,startCol:r,endRow:n,endCol:o}}),this.copyableRanges=this.hot.runHooks("modifyCopyableRange",this.copyableRanges);let r=t.get("cells");if(null!=r&&r.isRangeTrimmed){let{startRow:e,startCol:t,endRow:n,endCol:o}=r;this.hot.runHooks("afterCopyLimit",n-e+1,o-t+1,this.rowsLimit,this.columnsLimit)}}isEditorOpened(){return this.hot.getActiveEditor()?.isOpened()}#i5(e){if(tB()){let t=this.hot.getSelectedRangeActive();if(t){let{row:r,col:n}=t.highlight;if(null!==r&&null!==n){let t=this.hot.getCell(r,n,!0);t&&r8(t,()=>{this.hot.rootDocument.execCommand(e)})}}}else this.hot.rootDocument.execCommand(e)}#i4(e){let{rows:t}=mX(e),r=0;for(let e=0;e<t.length&&!(t[e]>=0);e++)r+=1;return{columnHeadersCount:r}}populateValues(e){let{plainData:t,originalPlainData:r,sourceData:n}=e;if(!t.length)return[null,null,null,null];let o=this.hot.getSelectedRangeActive(),i=t.length,s=t[0].length,a=[];if(!o)return[null,null,null,null];let{row:l,col:h}=o.getTopStartCorner(),{row:d,col:u}=o.getBottomEndCorner();if(null===l||null===h||null===d||null===u)return[null,null,null,null];let c=l,g=h,p=l,m=h;for(;a.length<i||c<=d;){let{skipRowOnPaste:e,visualRow:o}=this.hot.getCellMeta(c,h);if(c=o+1,!0===e)continue;p=o,g=h;let l=[],d=a.length%i;for(;l.length<s||g<=u;){let{skipColumnOnPaste:e,visualCol:i,parsePastedValue:a}=this.hot.getCellMeta(o,g);this.hot.getSourceDataAtCell(o,g);let h=l.length%s;if(g=i+1,!0===e)continue;m=i;let u=n?.[d]?.[h],c=r?.[d]?.[h],p=t[d][h];a&&n&&od(u)&&p===c&&(p=JSON.parse(u)),l.push(p)}a.push(l)}return this.#iZ=!0,this.hot.populateFromArray(l,h,a,void 0,void 0,"CopyPaste.paste",this.pasteMode),[l,h,p,m]}#i9(){if(this.hot.isListening()){let e=this.hot.getSelectedRangeActive();if(e){let{row:t,col:r}=e.highlight;if(null===t||null===r)return;let n=this.hot.getCell(t,r,!0);n&&r9(n)}}}#i7(){if(this.hot.isListening()){let e=this.hot.getSelectedRangeActive();if(e){let{row:t,col:r}=e.highlight;if(null===t||null===r)return;let n=this.hot.getCell(t,r,!0);n?.hasAttribute("contenteditable")&&r7(n)}}}#i8(e){let t=e.composedPath();return t.some(e=>nn(e))?t[0]:("target"in e?e.target:null)??t[0]}onCopy(e){let t=this.#i8(e),r=this.hot.getFocusManager().getRefocusElement(),n=ne(t)&&"hotInput"in t.dataset;if(!this.hot.isListening()&&!this.#iK||this.isEditorOpened()||ne(t)&&(n&&t!==r||!n&&t!==this.hot.rootDocument.body&&!t5(t,this.hot.rootElement)))return;e.preventDefault(),this.setCopyableText(),this.#iK=!1;let o=this.getRangedData(this.copyableRanges),i=this.getRangedData(this.copyableRanges,!0),s=this.#i4(this.copyableRanges);this.hot.runHooks("beforeCopy",o,this.copyableRanges,s)&&(this.#se(e,o,i),this.hot.runHooks("afterCopy",o,this.copyableRanges,s)),this.#ij="cells-only"}onCut(e){let t=this.#i8(e),r=this.hot.getFocusManager().getRefocusElement(),n=ne(t)&&"hotInput"in t.dataset;if(!this.hot.isListening()&&!this.#iX||this.isEditorOpened()||ne(t)&&(n&&t!==r||!n&&t!==this.hot.rootDocument.body&&!t5(t,this.hot.rootElement)))return;e.preventDefault(),this.setCopyableText(),this.#iX=!1;let o=this.getRangedData(this.copyableRanges),i=this.getRangedData(this.copyableRanges,!0);this.hot.runHooks("beforeCut",o,this.copyableRanges)&&(this.#se(e,o,i),this.hot.emptySelectedCells("CopyPaste.cut"),this.hot.runHooks("afterCut",o,this.copyableRanges))}onPaste(e){let t=this.#i8(e),r=this.hot.getFocusManager().getRefocusElement(),n=ne(t)&&"hotInput"in t.dataset;if(!this.hot.isListening()||this.isEditorOpened()||!this.hot.getSelected()||ne(t)&&(n&&t!==r||!n&&t!==this.hot.rootDocument.body&&!t5(t,this.hot.rootElement)))return;e.preventDefault?.();let o=this.#st(e),{pastedSourceData:i}=o,{pastedData:s}=o;if("string"==typeof s&&(s=function(e){let t,r=[[""]];if(0===e.length)return r;let n=0,o=0;for(;e.length>0&&t!==e.length;)if(t=e.length,e.match(dM))e=e.replace(dM,""),n+=1,r[o][n]="";else if(e.match(dT))e=e.replace(dT,""),n=0,r[o+=1]=[""];else{let t="";if(e.startsWith('"')){let r=function(e){let t=0;for(;t<e.length;){if('"'===e[t]){if('"'===e[t+1]){t+=2;continue}let r=e[t+1];if(void 0===r||"	"===r||"\r"===r||"\n"===r)return t}t+=1}return -1}(e.slice(1));if(-1!==r){let n=0,o=e.slice(1);for(;n<r;)'"'===o[n]&&'"'===o[n+1]?(t+='"',n+=2):(t+=o[n],n+=1);e=e.slice(r+2)}else{let r=0,n=!0;for(;n;){let o=e.slice(0,1);'"'===o&&(r+=1),t+=o,(0===(e=e.slice(1)).length||e.match(/^[\t\r\n]/)&&r%2==0)&&(n=!1)}t=t.replace(/^"/,"").replace(/"$/,"").replace(/["]*/g,e=>Array(Math.floor(e.length/2)).fill('"').join(""))}}else{let r=e.match(dA);t=r?r[0]:"",e=e.slice(t.length)}r[o][n]=t}return r}(s)),void 0===s||Array.isArray(s)&&0===s.length)return;let a=ta(s);if(!1===this.hot.runHooks("beforePaste",s,this.copyableRanges))return;let[l,h,d,u]=this.populateValues({plainData:s,sourceData:i,originalPlainData:a});null!==l&&null!==h&&null!==d&&null!==u&&this.hot.selectCell(l,h,Math.min(this.hot.countRows()-1,d),Math.min(this.hot.countCols()-1,u)),this.hot.runHooks("afterPaste",s,this.copyableRanges)}#st(e){let t,r;if(e&&void 0!==e.clipboardData){let n=e.clipboardData,o=at(this.hot,n.getData(mJ)??"","CopyPaste.paste.sourceData");if(o){let e=os(o,this.hot.rootDocument);r=e?.data}let i=at(this.hot,n.getData("text/html")??"","CopyPaste.paste");if(i&&/(<table)|(<TABLE)/g.test(i)){let e=os(i,this.hot.rootDocument);t=e?.data}else"string"==typeof(t=n.getData("text/plain"))&&(t=t.replace(/(\r\n|\r|\n)$/,""))}else"u"<typeof ClipboardEvent&&void 0!==this.hot.rootWindow.clipboardData&&(t=this.hot.rootWindow.clipboardData.getData("Text"));return{pastedData:t,pastedSourceData:r}}#se(e,t,r){let n=dI(t);if(e&&e.clipboardData){let o=ot(t),i=ot(r);e.clipboardData.setData("text/plain",n),e.clipboardData.setData("text/html",[m0,o].join("")),e.clipboardData.setData(mJ,[m0,i].join(""))}else"u"<typeof ClipboardEvent&&this.hot.rootWindow.clipboardData.setData("Text",n)}#iJ=e=>{var t,r,n,o,i;e.items.push({name:"---------"},(t=this,{key:"copy",name(){return this.getTranslatedPhrase(a3)},callback(){t.copyCellsOnly()},disabled(){if(0===this.countRows()||0===this.countCols())return!0;let e=this.getSelectedRangeActive();if(!e||e.isSingleHeader())return!0;let t=this.getSelected();return!t||!!(t.length>1)},hidden:!1})),this.#iG&&e.items.push((r=this,{key:"copy_with_column_headers",name(){let e=this.getSelectedRangeActive(),t=e?ox(e.getWidth()-1,0,1):0;return this.getTranslatedPhrase(a6,t)},callback(){r.copyWithColumnHeaders()},disabled(){if(!this.hasColHeaders())return!0;let e=this.getSelectedRangeActive();if(!e||e.isSingleHeader())return!0;let t=this.getSelected();return!t||!!(t.length>1)},hidden:!1})),this.#i$&&e.items.push((n=this,{key:"copy_with_column_group_headers",name(){let e=this.getSelectedRangeActive(),t=e?ox(e.getWidth()-1,0,1):0;return this.getTranslatedPhrase(a5,t)},callback(){n.copyWithAllColumnHeaders()},disabled(){if(!this.hasColHeaders()||!this.getSettings().nestedHeaders)return!0;let e=this.getSelectedRangeActive();if(!e||e.isSingleHeader())return!0;let t=this.getSelected();return!t||!!(t.length>1)},hidden:!1})),this.#iY&&e.items.push((o=this,{key:"copy_column_headers_only",name(){let e=this.getSelectedRangeActive(),t=e?ox(e.getWidth()-1,0,1):0;return this.getTranslatedPhrase(a4,t)},callback(){o.copyColumnHeadersOnly()},disabled(){if(!this.hasColHeaders())return!0;let e=this.getSelectedRangeActive();if(!e||e.isSingleHeader())return!0;let t=this.getSelected();return!t||!!(t.length>1)},hidden:!1})),e.items.push((i=this,{key:"cut",name(){return this.getTranslatedPhrase(a9)},callback(){i.cut()},disabled(){if(0===this.countRows()||0===this.countCols())return!0;let e=this.getSelectedRangeActive();if(!e||e.isSingleHeader())return!0;let t=this.getSelected();return!t||!!(t.length>1)},hidden:!1}))};#i0=(e,t,r,n,o)=>{this.#iZ&&(o.value=!0),this.#iZ=!1};#i1=()=>{this.isEditorOpened()||this.hot.getSettings().fragmentSelection||this.setCopyableText()};#i2=()=>{this.#i7()};#i3=()=>{this.#i9()};#i6=()=>{this.#i7()};destroy(){super.destroy()}}function m2(e,t){return`border_row${e}col${t}`}function m3(e,t,r){return e>=t+r?e-r:e>=t?-1:e}function m6(){return{width:1,color:"#000"}}function m5(){return{hide:!0}}function m4(e){return(e_(e.start)||e_(e.left))&&(e.start=e.start??e.left),(e_(e.end)||e_(e.right))&&(e.end=e.end??e.right),delete e.left,delete e.right,e}function m9(e){return e_(e.start)&&(e.left=e.start),e_(e.end)&&(e.right=e.end),e}function m7(e,t){return{id:m2(e,t),border:{width:1,color:"#000",cornerVisible:!1},row:e,col:t,top:m5(),bottom:m5(),start:m5(),end:m5()}}function m8(e,t,r){ty(t,r)&&e_(t[r])&&(t[r]?tc(t[r])||(t[r]=m6()):t[r]=m5(),e[r]=t[r])}function fe(e,t){let r=!1;return J(e.getSelectedRange()??[],n=>{n.forAll((n,o)=>{if(n<0||o<0)return;let i=e.getCellMeta(n,o).borders;if(i){if(!t)return r=!0,!1;else if(!ty(i[t],"hide")||!1===i[t].hide)return r=!0,!1}})}),r}function ft(e){return`<span class="selected">${String.fromCharCode(10003)}</span>${e}`}let fr=new Map([["left","start"],["right","end"]]),fn="customBorders";function fo(e){return"object"==typeof e&&null!==e}function fi(e){return fo(e)&&"string"==typeof e.id&&"number"==typeof e.row&&"number"==typeof e.col}function fs(e){return fo(e)&&"number"==typeof e.row&&"number"==typeof e.col}let fa=["dashed","dotted","solid"];class fl extends pa{static get PLUGIN_KEY(){return fn}static get PLUGIN_PRIORITY(){return 90}static get SETTING_KEYS(){return[fn,"customBordersProgressive"]}savedBorders=[];#sr=new Map;#sn=new Map;#so=new Map;#si=!0;#ss=null;#sa=!1;#sl=!1;#sh=!1;#sd=null;#su=0;#sc=5e3;#sg=0;#sp=null;#sm=null;isEnabled(){return!!this.hot.getSettings()[fn]}enablePlugin(){this.enabled||(this.addHook("afterContextMenuDefaultOptions",e=>this.#iJ(e)),this.addHook("init",()=>this.#sf()),this.addHook("beforeCreateRow",this.#sb),this.addHook("afterCreateRow",this.#sC),this.addHook("beforeRemoveRow",this.#sy),this.addHook("afterRemoveRow",this.#sw),this.addHook("beforeCreateCol",this.#sS),this.addHook("afterCreateCol",this.#sv),this.addHook("beforeRemoveCol",this.#sR),this.addHook("afterRemoveCol",this.#sE),this.addHook("beforeRowMove",this.#sT),this.addHook("afterRowMove",this.#sA),this.addHook("beforeColumnMove",this.#sM),this.addHook("afterColumnMove",this.#o8),this.addHook("beforeViewRender",this.#o2),this.addHook("afterSetCellMeta",this.#oF),this.addHook("afterRemoveCellMeta",this.#sI),super.enablePlugin())}disablePlugin(){this.#sx(),this.hideBorders(),super.disablePlugin()}updatePlugin(){this.disablePlugin(),this.enablePlugin(),this.changeBorderSettings(),super.updatePlugin()}setBorders(e,t){let r=["top","bottom","start","end"],n=null;t&&(this.checkSettingsCohesion([t]),r=Object.keys(t),n=m4(t));let o=de(h8(e),{createCellCoords:this.hot._createCellCoords.bind(this.hot),createCellRange:this.hot._createCellRange.bind(this.hot)});J(e,e=>{o(e).forAll((e,t)=>(J(r,r=>{this.prepareBorderFromCustomAdded(e,t,n,fr.get(r)??r)}),!0))}),this.hot.render()}getBorders(e){if(!Array.isArray(e))return this.savedBorders;let t=de(h8(e),{createCellCoords:this.hot._createCellCoords.bind(this.hot),createCellRange:this.hot._createCellRange.bind(this.hot)}),r=[];return J(e,e=>{t(e).forAll((e,t)=>(J(this.savedBorders,n=>{n.row===e&&n.col===t&&r.push(m9(n))}),!0))}),r}clearBorders(e){e?this.setBorders(e):(this.#sN(),this.hot.render())}insertBorderIntoSettings(e,t){this.checkSavedBorders(e)||(this.savedBorders.push(e),this.#sr.set(e.id,this.savedBorders.length-1)),this.#sO(e),this.#sk(e.id)}prepareBorderFromCustomAdded(e,t,r,n){let o=this.hot.countRows(),i=this.hot.countCols();if(e>=o||t>=i)return;let s=m7(e,t);if(r){var a;let n=this.#sH(e,t);fi(n)&&((s=m4(ta(n))).row=e,s.col=t,s.id=m2(e,t)),a=s,ty(r,"border")&&r.border&&(a.border=r.border),m8(a,r,"top"),m8(a,r,"bottom"),m8(a,r,"start"),m8(a,r,"end"),s=a}4===this.countHide(s)?this.removeAllBorders(e,t):this.#s_(e,t,m9(s))&&this.insertBorderIntoSettings(s,n)}prepareBorderFromCustomAddedRange(e,t){let r=Math.min(e.to.row,this.hot.countRows()-1),n=Math.min(e.to.col,this.hot.countCols()-1);oA(e.from.row,r,r=>{oA(e.from.col,n,n=>{let{border:o,add:i}=this.#sL(r,n,t,e);i>0&&this.#s_(r,n,m9(o))&&this.insertBorderIntoSettings(o,void 0)})})}#sH(e,t){let r=this.#ss;if(null===r||!this.#sa)return this.hot.getCellMeta(e,t).borders;let n=`${e},${t}`,o=r.has(n);return r.add(n),o?this.hot.getCellMeta(e,t).borders:void 0}#s_(e,t,r){let n=this.hot.hasHook(null===r?"beforeRemoveCellMeta":"beforeSetCellMeta");this.#sl=!0;try{null===r?this.hot.removeCellMeta(e,t,"borders"):this.hot.setCellMeta(e,t,"borders",r)}finally{this.#sl=!1}if(!n)return!0;let o=this.hot.getCellMetaTransient(e,t);return null===r?!ty(o,"borders"):o.borders===r}#sL(e,t,r,n){let o=this.#sH(e,t),i=fi(o)?m4(ta(o)):m7(e,t),s=0,a=(e,t)=>{e&&ty(r,t)&&(i[t]=function(e,t){if(e&&tc(e)&&Object.keys(e).length>0)return e;if(t&&tc(t)){let e={...t};return delete e.cornerVisible,e}return e}(r[t],r.border),s+=1)};return a(e===n.from.row,"top"),a(e===n.to.row,"bottom"),a(t===n.from.col,"start"),a(t===n.to.col,"end"),fo(r.border)&&(i.border=r.border),{border:i,add:s}}removeAllBorders(e,t){if(!this.#s_(e,t,null))return;let r=m2(e,t);this.spliceBorder(r),this.#sP(e,r),this.#sk(r)}setBorder(e,t,r,n){let o,i=this.hot.getCellMeta(e,t).borders;o=fi(i)?m4(i):m7(e,t),n?(o[r]=m5(),4===this.countHide(o)?this.removeAllBorders(e,t):this.#s_(e,t,m9(o))&&this.insertBorderIntoSettings(o,void 0)):(o[r]=m6(),this.#s_(e,t,m9(o))&&this.insertBorderIntoSettings(o,void 0))}prepareBorder(e,t,r){J(e,e=>{if(!fs(e.start)||!fs(e.end))return;let{start:n,end:o}={start:e.start,end:e.end};if(n.row===o.row&&n.col===o.col)"noBorders"===t?this.removeAllBorders(n.row,n.col):this.setBorder(n.row,n.col,t,r);else switch(t){case"noBorders":oA(n.col,o.col,e=>{oA(n.row,o.row,t=>{this.removeAllBorders(t,e)})});break;case"top":oA(n.col,o.col,e=>{this.setBorder(n.row,e,t,r)});break;case"bottom":oA(n.col,o.col,e=>{this.setBorder(o.row,e,t,r)});break;case"start":oA(n.row,o.row,e=>{this.setBorder(e,n.col,t,r)});break;case"end":oA(n.row,o.row,e=>{this.setBorder(e,o.col,t,r)})}}),this.hot.render()}createCustomBorders(e){let t=null===this.#ss,r=this.#sa;t&&(this.#ss=new Set),this.#sa=!0;try{J(e,e=>{let t=m4(e);t.range?this.prepareBorderFromCustomAddedRange(t.range,t):this.prepareBorderFromCustomAdded(t.row??0,t.col??0,t,void 0)})}finally{this.#sa=r,t&&(this.#ss=null)}}countHide(e){let{top:t,bottom:r,start:n,end:o}=e;return X([t,r,n,o],(e,t)=>{let r=e;return t&&t.hide&&(r+=1),r},0)}hideBorders(){this.#sD()}#sD(){let{customSelections:e}=this.hot.selection.highlight,t=new Set(this.#sn.values());for(let r=e.length-1;r>=0;r--)t.has(e[r])&&(e[r].destroy(),e.splice(r,1));this.#sn.clear()}#sN(){this.#sx();let e=[];J(this.savedBorders,t=>{this.#s_(t.row,t.col,null)||e.push(t)}),this.savedBorders=e,this.#sF(),this.#so.clear(),this.#si=!0,this.#sD()}#sB(){this.#so.clear(),J(this.savedBorders,e=>{let t=this.#so.get(e.row);t?t.push(e):this.#so.set(e.row,[e])}),this.#si=!1}#sO(e){if(this.#si)return;if(!this.#sr.has(e.id))return void this.#sP(e.row,e.id);let t=this.#so.get(e.row);if(!t)return void this.#so.set(e.row,[e]);let r=t.findIndex(t=>t.id===e.id);-1===r?t.push(e):t[r]=e}#sP(e,t){if(this.#si)return;let r=this.#so.get(e);if(!r)return;let n=r.findIndex(e=>e.id===t);-1!==n&&(r.splice(n,1),0===r.length&&this.#so.delete(e))}#sV(){let e,t,r;this.#si&&this.#sB();let n=this.hot.view,o=n.getFirstRenderedVisibleRow(),i=n.getLastRenderedVisibleRow(),s=n.getFirstRenderedVisibleColumn(),a=n.getLastRenderedVisibleColumn();if(null===o||null===i||null===s||null===a){this.#sn.size>0&&this.#sD();return}let l=this.hot.getSettings(),h=Number(l.fixedRowsTop)||0,d=Number(l.fixedRowsBottom)||0,u=Number(l.fixedColumnsStart)||0,c=this.hot.countRows(),g=this.hot.countCols(),p=(e=[],t=c-d,(r=(t,r)=>{t<=r&&e.push([t,r])})(0,Math.min(h,c)-1),r(Math.max(o,h),Math.min(i,t-1)),r(Math.max(t,h),c-1),e),m=new Set;J(p,e=>{let[t,r]=e;for(let e=t;e<=r;e++){let t=this.#so.get(e);t&&J(t,e=>{var t;t=e.col,!(t<0)&&!(t>=g)&&(t<u||t>=g-0||t>=s&&t<=a)&&(m.add(e.id),this.#sn.has(e.id)||this.#sU(e))})}}),J(Array.from(this.#sn.keys()),e=>{m.has(e)||this.#sk(e)})}#sU(e){let t=this.hot._createCellCoords(e.row,e.col),r=this.hot._createCellRange(t,t,t),{customSelections:n}=this.hot.selection.highlight;this.hot.selection.highlight.addCustomSelection({border:e,visualCellRange:r}),this.#sn.set(e.id,n[n.length-1])}spliceBorder(e){let t=this.#sr.get(e)??-1;t>-1&&(this.savedBorders.splice(t,1),this.#sF())}#sF(){this.#sr.clear(),J(this.savedBorders,(e,t)=>{this.#sr.set(e.id,t)})}checkSavedBorders(e){let t=!1;if(4===this.countHide(e))this.spliceBorder(e.id),t=!0;else{let r=this.#sr.get(e.id);void 0!==r&&(this.savedBorders[r]=e,t=!0)}return t}changeBorderSettings(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=this.hot.getSettings()[fn];if(Array.isArray(t)){let r=ta(t.filter(fo));this.checkSettingsCohesion(r),this.#sN();let n=this.#sz();if(n.enabled&&r.length>0){this.#sW(r,n.chunkSize),e&&this.hot.render();return}this.createCustomBorders(r)}else void 0!==t&&this.createCustomBorders(this.savedBorders);e&&this.hot.render(),this.hot.runHooks("afterCustomBordersUpdate")}#sz(){let e=this.hot.getSettings().customBordersProgressive;return!0===e?{enabled:!0,chunkSize:5e3}:fo(e)?{enabled:!0,chunkSize:"number"==typeof e.chunkSize&&e.chunkSize>0?Math.floor(e.chunkSize):5e3}:{enabled:!1,chunkSize:5e3}}#sW(e,t){this.#sg+=1,this.#sd=e,this.#su=0,this.#sc=t,this.#ss=new Set,this.#sG(this.#sg)}#sG(e){this.hot._registerTimeout(()=>this.#s$(e),0)}#s$(e){if(e!==this.#sg||null===this.#sd)return;let t=this.#sd,r=Math.min(this.#su+this.#sc,t.length);this.createCustomBorders(t.slice(this.#su,r)),this.#su=r,this.hot.render(),this.#su>=t.length?this.#sY():this.#sG(e)}#sj(){if(null===this.#sd)return;let e=this.#sd;for(;this.#su<e.length;){let t=Math.min(this.#su+this.#sc,e.length);this.createCustomBorders(e.slice(this.#su,t)),this.#su=t}this.#sY()}#sY(){this.#sg+=1,this.#sd=null,this.#su=0,this.#ss=null,this.hot.runHooks("afterCustomBordersUpdate")}#sx(){null!==this.#sd&&(this.#sg+=1,this.#sd=null,this.#su=0,this.#ss=null)}checkSettingsCohesion(e){let t=e.some(e=>e_(e.left)||e_(e.right)),r=e.some(e=>e_(e.start)||e_(e.end));t&&r&&tr('The "left"/"right" and "start"/"end" options should not be used together. Please use only the option "start"/"end".'),this.hot.isRtl()&&t&&tr('The "left"/"right" properties are not supported for RTL. Please use option "start"/"end".'),this.#sq(e)}#sq(e){e.forEach(e=>{Object.keys(e).forEach(t=>{let r=e[t];if(!fo(r))return;let{style:n}=r;e_(n)&&"string"==typeof n&&!fa.includes(n)?(tQ(`The "${n}" border style is not supported. Please use one of the following styles: ${fa.join(", ")}.
The border style will be ignored.`),delete r.style):e_(n)&&"solid"===n&&delete r.style})})}#sK(e,t){let r=[];J(this.savedBorders,n=>{let o=t(n[e]);-1!==o&&(n[e]=o,n.id=m2(n.row,n.col),r.push(n))}),this.savedBorders.length=0,J(r,e=>this.savedBorders.push(e)),this.#sX(!1)}#sQ(e,t,r){J(this.savedBorders,(n,o)=>{let i=t[o];if("number"!=typeof i)return;let s=r(i);"number"==typeof s&&(n[e]=s,n.id=m2(n.row,n.col))}),this.#sX()}#sX(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];this.#sF(),this.#si=!0,this.#sD(),e&&this.hot.render()}#sk(e){let t=this.#sn.get(e);if(!t)return;let{customSelections:r}=this.hot.selection.highlight,n=r.indexOf(t);n>-1&&r.splice(n,1),t.destroy(),this.#sn.delete(e)}#iJ(e){if(!this.hot.getSettings()[fn]||"object"!=typeof e||null===e)return;let{items:t}=e;if(Array.isArray(t)){var r,n,o,i,s;let e,a;t.push({name:"---------"},{key:"borders",name(){return this.getTranslatedPhrase(lb)},disabled(){let e=this.getSelectedRangeActive();return!!(!e||e.isSingleHeader())||this.selection.isSelectedByCorner()},submenu:{items:[(r=this,{key:"borders:top",name(){let e=this.getTranslatedPhrase(lC);return fe(this,"top")&&(e=ft(e)),e},callback(e,t){let n=fe(this,"top");r.prepareBorder(t,"top",n)}}),(n=this,e=n.hot.isRtl()?"start":"end",{key:"borders:right",name(){let t=this.getTranslatedPhrase(ly);return fe(this,e)&&(t=ft(t)),t},callback(t,r){let o=fe(this,e);n.prepareBorder(r,e,o)}}),(o=this,{key:"borders:bottom",name(){let e=this.getTranslatedPhrase(lw);return fe(this,"bottom")&&(e=ft(e)),e},callback(e,t){let r=fe(this,"bottom");o.prepareBorder(t,"bottom",r)}}),(i=this,a=i.hot.isRtl()?"end":"start",{key:"borders:left",name(){let e=this.getTranslatedPhrase(lS);return fe(this,a)&&(e=ft(e)),e},callback(e,t){let r=fe(this,a);i.prepareBorder(t,a,r)}}),(s=this,{key:"borders:no_borders",name(){return this.getTranslatedPhrase(lv)},callback(e,t){s.prepareBorder(t,"noBorders",void 0)},disabled(){return!fe(this)}})]}})}}#sf(){this.changeBorderSettings(!1),this.savedBorders.length>0&&this.hot.addHookOnce("afterInit",()=>this.hot.render())}#o2=()=>{this.#sV()};#oF=(e,t,r,n)=>{!this.#sl&&"borders"===r&&fo(n)&&(this.prepareBorderFromCustomAdded(e,t,m4(ta(n)),void 0),this.#sZ())};#sZ(){this.#sh||(this.#sh=!0,this.hot._registerMicrotask(()=>{this.#sh=!1,this.hot.render()}))}#sI=(e,t,r)=>{if(this.#sl||"borders"!==r)return;let n=m2(e,t);this.spliceBorder(n),this.#sP(e,n),this.#sk(n)};#sJ(e){"auto"!==e&&this.#sj()}#sb=(e,t,r)=>{this.#sJ(r)};#sy=(e,t,r,n)=>{this.#sJ(n)};#sS=(e,t,r)=>{this.#sJ(r)};#sR=(e,t,r,n)=>{this.#sJ(n)};#sC=(e,t,r)=>{"auto"!==r&&this.#sK("row",r=>r>=e?r+t:r)};#sw=(e,t)=>{this.#sK("row",r=>m3(r,e,t))};#sv=(e,t,r)=>{"auto"!==r&&this.#sK("col",r=>r>=e?r+t:r)};#sE=(e,t)=>{this.#sK("col",r=>m3(r,e,t))};#sT=(e,t,r,n)=>{this.#sj(),this.#sp=n?this.savedBorders.map(e=>this.hot.toPhysicalRow(e.row)):null};#sA=(e,t,r,n,o)=>{let i=this.#sp;this.#sp=null,i&&o&&this.#sQ("row",i,e=>this.hot.toVisualRow(e))};#sM=(e,t,r,n)=>{this.#sj(),this.#sm=n?this.savedBorders.map(e=>this.hot.toPhysicalColumn(e.col)):null};#o8=(e,t,r,n,o)=>{let i=this.#sm;this.#sm=null,i&&o&&this.#sQ("col",i,e=>this.hot.toVisualColumn(e))};destroy(){this.#sx(),this.savedBorders=[],this.#sr.clear(),this.#so.clear(),this.#sn.clear(),this.#sp=null,this.#sm=null,super.destroy()}}let fh="dataProvider",fd={rowId:void 0,fetchRows:void 0,onRowsCreate:void 0,onRowsUpdate:void 0,onRowsRemove:void 0},fu={rowId:e=>"string"==typeof e||na(e),fetchRows:e=>na(e),onRowsCreate:e=>na(e),onRowsUpdate:e=>na(e),onRowsRemove:e=>na(e)},fc=Object.freeze({page:1,pageSize:10,sort:null,filters:null}),fg=new Set(["edit",void 0,"CopyPaste.paste","CopyPaste.cut","Autofill.fill","ContextMenu.clearColumn","DataProvider.revert"]),fp="DataProvider: cannot send row update because `rowId` resolves to null or undefined for that row.";function fm(e,t,r){if(!1===e.runHooks("beforeRowsMutation",t,r))return!1}function ff(e,t,r){e.runHooks("afterRowsMutation",t,r)}function fb(e,t,r,n){e.runHooks("afterRowsMutationError",t,r,n)}function fC(e,t,r){var n=e.getSourceDataAtRow(e.toPhysicalRow(r));if(null!=t){if(na(t))return t(n);if("string"==typeof t)return tm(n,t)}}function fy(e,t,r){for(let n=0;n<e.countRows();n+=1)if(fC(e,t,n)===r)return n;return -1}function fw(e,t,r){let n=Object.entries(r);return 0===n.length?Promise.resolve(!0):new Promise(r=>{let o=n.length,i=!0,s=()=>{0==(o-=1)&&r(i)};n.forEach(r=>{let[n,o]=r,a=e.propToCol(n);if(void 0===a||a<0)return void s();let l=e.getCellMeta(t,a);e.getCellValidator(l)?e.validateCell(o,l,e=>{!1===e&&!1===l.allowInvalid&&(i=!1),s()},"DataProvider.updateRows"):s()})})}async function fS(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=t.getOnRowsUpdate();if(!na(o))return;let i={rows:r},{revertOptimistic:s}=n,{onRequestFailed:a}=t;try{await o(r)}catch(r){fb(e,"update",r,i),t.logError("Row update failed:",r),na(s)&&s(),e.render(),a?.("update",r);return}try{ff(e,"update",i),await t.fetchData()}catch(r){fb(e,"update",r,i),t.logError("Data reload failed:",r),na(s)&&s(),e.render()}}async function fv(e,t,r){let{getRowIdOption:n,commitRowsUpdate:o}=t,i={rows:r};if(!1===fm(e,"update",i))return;let s=n();if((await Promise.all(r.map(async t=>{let r=fy(e,s,t.id);return r<0||fw(e,r,t.changes??{})}))).some(e=>!e)){fb(e,"update",Error("Row update validation failed"),i),t3("Row update failed: validation failed for one or more cells");return}await o(r)}async function fR(e,t,r){let{getRowIdOption:n,commitRowsUpdate:o}=t,i=new Map;r.forEach(e=>{let t=e[0];i.has(t)||i.set(t,[]),i.get(t).push(e)});let s=[...i.keys()].sort((e,t)=>e-t),a=n(),l=s.map(t=>{var r;let n,o,s,l,h,{changesObj:d,rowData:u}=(o=(r=i.get(t))[0][0],l=(s=e.getSourceDataAtRow(e.toPhysicalRow(o)))&&"object"==typeof s&&!Array.isArray(s),h={},r.forEach(t=>{let[,r,,n]=t,o="number"==typeof r?r:e.propToCol(r);h[l?e.colToProp(o):o]=n}),Array.isArray(s)?(n=[...s],r.forEach(t=>{let[,r,,o]=t;n["number"==typeof r?r:e.propToCol(r)]=o})):n=l?{...s,...h}:{...h},{changesObj:h,rowData:n});return{id:fC(e,a,t),changes:d,rowData:u}}),h={rows:l},d=()=>{r?.length&&e.batch(()=>{r.forEach(t=>{let[r,n,o]=t;e.setDataAtRowProp(r,n,o,"DataProvider.revert")})})};if(l.some(e=>null==e.id)){d(),fb(e,"update",Error(fp),h),t3("Row update failed:",fp),e.render();return}if(!1===fm(e,"update",h))return void d();if((await Promise.all(s.map((t,r)=>fw(e,t,l[r].changes)))).some(e=>!e)){d(),fb(e,"update",Error("Row update validation failed"),h),t3("Row update failed: validation failed for one or more cells"),e.render();return}await o(l,{revertOptimistic:d})}function fE(e,t){if(!Array.isArray(t)||0===t.length)return null;let r=[];for(let n=0;n<t.length;n++){let o=t[n],i=e.toVisualColumn(o.column),s=e.colToProp(i);null!=s&&r.push({prop:String(s),operation:o.operation,conditions:o.conditions.map(e=>({name:e.name,args:Array.isArray(e.args)?[...e.args]:[]}))})}return 0===r.length?null:r}let fT="pagination",fA="columnSorting";function fM(e,t){if("string"==typeof t){let r=t.trim();r&&e.push(r)}}function fI(e,t){!e||"object"!=typeof e||Array.isArray(e)||(fM(t,e.message),fM(t,e.error),"string"==typeof e.detail&&fM(t,e.detail))}pr("dataProvider",["manualRowMove","manualColumnMove","trimRows","multiColumnSorting"]);class fx extends pa{static get PLUGIN_KEY(){return fh}static get PLUGIN_PRIORITY(){return 950}static get SETTING_KEYS(){return[fh]}static get DEFAULT_SETTINGS(){return fd}static get SETTINGS_VALIDATORS(){return fu}#s0={...fc};#s1=null;#s2={tail:Promise.resolve()};constructor(e){super(e),this.addHook("hasExternalDataSource",this.#s3)}isEnabled(){return!!this.hot.getSettings()[fh]}enablePlugin(){this.enabled||(this.#s6(),this.addHook("hasExternalDataSource",this.#s3),this.addHook("afterInit",this.#sf),this.addHook("modifyRowHeader",this.#s5),this.addHook("beforeColumnSort",this.#s4),this.addHook("beforeUndoStackChange",this.#s9),this.addHook("afterChange",this.#s7),this.addHook("beforeAlter",this.#s8),this.addHook("afterPageChange",this.#ae),this.addHook("afterPageSizeChange",this.#at),this.addHook("beforeFilter",this.#ar),super.enablePlugin())}updatePlugin(){this.disablePlugin(),this.enablePlugin(),this.hot.view&&this.#an(),super.updatePlugin()}disablePlugin(){this.#ao(),this.#s0={...fc},super.disablePlugin()}getQueryParameters(){return this.#ai(this.#s0)}getRowId(e){return fC(this.hot,this.#as(),e)}async fetchData(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this.#aa();if(!na(t))return this.hot.render(),null;let r=this.#al(e),n=this.#ah(),{signal:o}=n;if(!1===this.hot.runHooks("beforeDataProviderFetch",r))return this.#s1=null,this.hot.render(),null;let i=this.#ai(r);try{var s,a,l,h;let n,d=await t(i,{signal:o});if(o.aborted)return this.#ad(r,void 0),null;let u=Array.isArray(d?.rows)?d.rows:[],c="number"==typeof d?.totalRows&&d.totalRows>=0?d.totalRows:u.length,g=this.#ai(r),p=(s=g.page,a=g.pageSize,Math.max(1,Math.min(s,Math.max(1,Math.ceil(c/("number"==typeof a&&a>=1?a:10))))));if(p!==g.page)return this.fetchData({...e,page:p,skipLoading:e.skipLoading});this.#s0=g,this.hot.loadData(u,fh);let m=(l=this.hot,h=g.sort??null,(n=function(e,t){if(null==e||"object"!=typeof e||"string"!=typeof e.prop)return null;let r=e.order??e.sortOrder;if("asc"!==r&&"desc"!==r||"function"!=typeof t)return null;let n=t(e.prop);return"number"!=typeof n?null:{column:n,sortOrder:r}}(h,e=>l.propToCol(e)))&&"object"==typeof n&&"column"in n?n:[]),f=function(e,t){if(null==t||!Array.isArray(t)||0===t.length)return[];let r=[];for(let n=0;n<t.length;n++){let o=t[n],i=e.propToCol(o.prop);if(null==i||i<0)continue;let s=e.toPhysicalColumn(i);r.push({column:s,operation:o.operation,conditions:(o.conditions||[]).map(e=>({name:e.name??"",args:Array.isArray(e.args)?[...e.args]:[]}))})}return r}(this.hot,g.filters??null);return this.hot.runHooks("afterDataProviderFetch",{...d,rows:u,totalRows:c,queryParameters:g,columnSortConfig:m,filtersConditionsStack:f}),this.hot.render(),{rows:u,totalRows:c}}catch(e){if(o.aborted||e instanceof Error&&"AbortError"===e.name)return this.#ad(r,e),null;throw this.hot.runHooks("afterDataProviderFetchError",e,this.#ai(r)),this.#au("fetch",e),e}finally{this.#s1===n&&(this.#s1=null)}}async createRows(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this.#ac();if(!na(t))return;let r={position:e.position??"below",referenceRowId:e.referenceRowId,rowsAmount:e.rowsAmount??1};return this.#ag("create",{rowsCreate:r},()=>Promise.resolve(t(r)),async()=>{await this.fetchData({skipLoading:!0})})}async removeRows(e){let t=this.#ap();if(!na(t))return;let r=Array.isArray(e)?e:[e];return r.forEach(e=>{null==e&&tr("DataProvider: `removeRows` requires every id to be non-null.")}),this.#ag("remove",{rowsRemove:r},()=>t(r),async()=>{let e=this.#s0.page,t=this.hot.countRows();if(r.length>=t&&t>=1&&e>1)return void await this.fetchData({page:e-1,skipLoading:!0});let n=await this.fetchData({skipLoading:!0});n?.rows.length===0&&e>1&&await this.fetchData({page:e-1,skipLoading:!0})})}async updateRows(e){var t,r;if(!na(this.#am())||!Array.isArray(e)||0===e.length)return;e.forEach(e=>{null==e.id&&tr("DataProvider: `updateRows` requires every entry to include a non-null `id`.")});let n=(t=this.hot,r=this.#as(),e.map(e=>{let n,o=fy(t,r,e.id);return n=o>=0?t.getSourceDataAtRow(t.toPhysicalRow(o)):void 0!==e.rowData?e.rowData:{},{id:e.id,changes:e.changes,rowData:n&&"object"==typeof n?n:{}}}));return this.#af(()=>fv(this.hot,{getRowIdOption:()=>this.#as(),commitRowsUpdate:e=>this.#ab(e)},n))}#aC(){let e=this.hot.getSettings()[fh];return e&&"object"==typeof e?e:void 0}#as(){let e=this.#aC();return e?e.rowId:void 0}#aa(){let e=this.#aC();return e&&na(e.fetchRows)?e.fetchRows:void 0}#ac(){let e=this.#aC();return e&&na(e.onRowsCreate)?e.onRowsCreate:void 0}#am(){let e=this.#aC();return e&&na(e.onRowsUpdate)?e.onRowsUpdate:void 0}#ap(){let e=this.#aC();return e&&na(e.onRowsRemove)?e.onRowsRemove:void 0}#ai(e){var t;return{page:e.page,pageSize:e.pageSize,sort:null===e.sort?null:{...e.sort},filters:null===(t=e.filters)?null:t.map(e=>({prop:e.prop,operation:e.operation,conditions:(e.conditions||[]).map(e=>({name:e.name,args:Array.isArray(e.args)?[...e.args]:[]}))}))}}#s6(){var e,t,r,n;e=this.hot,t=this.#s0,function(e,t){if(!e?.enabled)return;let r="function"==typeof e.getCurrentPageSize?e.getCurrentPageSize():void 0,n=e.getSetting("pageSize"),o=e.getSetting("initialPage"),i="function"==typeof e.getCurrentPage?e.getCurrentPage():void 0;"number"==typeof r?t.pageSize=r:"number"==typeof n&&(t.pageSize=n),"number"==typeof i&&i>=1?t.page=i:"number"==typeof o&&o>=1&&(t.page=o)}(e.getPlugin(fT),t),r=this.hot,n=this.#s0,function(e,t,r){if(!e?.enabled||"function"!=typeof r)return;let n=e.getSortConfig(),o=Array.isArray(n)?n[0]:n;o&&"number"==typeof o.column?t.sort={prop:r(o.column),order:o.sortOrder}:t.sort=null}(r.getPlugin(fA),n,e=>String(r.colToProp(e))),function(e,t,r){if(!na(r()))return;let n=e.getPlugin("filters");n&&n.enabled&&(t.filters=fE(e,n.exportConditions())??null)}(this.hot,this.#s0,()=>this.#aa())}#ay(){if(!this.#s1)return;let e=Error("DataProvider fetch superseded by a newer request");e.name="AbortError",this.#s1.abort(e)}#al(e){var t;let r={...this.#s0,...e};return t=this.hot,r.sort=function(e,t){if(null==e||"object"!=typeof e)return null;if("number"==typeof e.column&&"function"==typeof t)return{prop:t(e.column),order:e.sortOrder};let r=e.order??e.sortOrder;return"string"==typeof e.prop&&("asc"===r||"desc"===r)?{prop:e.prop,order:r}:null}(r.sort,e=>String(t.colToProp(e))),"number"!=typeof r.page||Number.isNaN(r.page)||(r.page=Math.max(1,r.page)),r}#ah(){this.#ay();let e=new AbortController;return this.#s1=e,e}#ad(e,t){let r=this.#ai(e);this.hot.runHooks("afterDataProviderFetchAbort",r,t)}#ao(){this.#s1?.abort(),this.#s1=null}#af(e){var t;let r;return t=this.#s2,r=t.tail.then(e),t.tail=r.catch(()=>{}),r}#au(e,t){let r=this.hot.getPlugin("notification");if(!r?.enabled)return;let n=this.hot.getTranslatedPhrase({fetch:hN,create:hO,update:hk,remove:hH}[e]??h_),o=function(e){let t=[];if(null==e)return"Unknown error";if("string"==typeof e)return e.trim()||"Unknown error";if("object"!=typeof e)return String(e);let r=e.response,n=r?.data??e.data??e.body;if(null!=n)if("string"==typeof n)try{fI(JSON.parse(n),t)}catch{fM(t,n)}else fI(n,t);"string"==typeof e.error&&fM(t,e.error),"string"==typeof e.message&&fM(t,e.message);let o=t.find(e=>!("string"==typeof e&&/^\d{3}$/.test(e.trim())));return o||(t.length>0?t[0]:String(e))}(t),i="",s={variant:"error",title:n,message:o};"fetch"===e&&(s.duration=0,s.actions=[{label:this.hot.getTranslatedPhrase(hL),type:"primary",callback:()=>{i&&r.hide(i),this.#an()}}]),i=r.showMessage(s)}#ab(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return fS(this.hot,{getOnRowsUpdate:()=>this.#am(),fetchData:()=>this.fetchData({skipLoading:!0}),logError:t3,onRequestFailed:(e,t)=>this.#au(e,t)},e,t)}#ag(e,t,r,n){return function(e,t,r,n,o){let{enqueueMutation:i,runBeforeRowsMutation:s,runAfterRowsMutation:a,runAfterRowsMutationError:l,logError:h,onRequestFailed:d}=e;return i(async()=>{if(!1===s(t,r))return;let e="create"===t?"Row create":"Row remove";try{await n()}catch(n){l(t,n,r),h(`${e} failed:`,n),d?.(t,n);return}try{a(t,r),await o()}catch(e){l(t,e,r),h("Data reload failed:",e)}})}({enqueueMutation:e=>this.#af(e),runBeforeRowsMutation:(e,t)=>fm(this.hot,e,t),runAfterRowsMutation:(e,t)=>ff(this.hot,e,t),runAfterRowsMutationError:(e,t,r)=>fb(this.hot,e,t,r),logError:t3,onRequestFailed:(e,t)=>this.#au(e,t)},e,t,r,n)}#an(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.fetchData(e).catch(e=>(t3("Data fetch failed:",e),null))}#s3=()=>{var e;return!(!(e=this.hot.getSettings().dataProvider)||"object"!=typeof e||Array.isArray(e))&&Object.keys(fu).every(t=>fu[t](e[t]))};#sf=()=>{this.#an()};#ae=(e,t)=>{!function(e,t,r){let{hot:n,getQueryPage:o,goToPage:i}=e,s=n.getPlugin(fT);s?.enabled&&r!==o()&&i(r).catch(()=>{let e=n.getPlugin(fT);e?.enabled&&e.revertPageTo(t)})}({hot:this.hot,getQueryPage:()=>this.#s0.page,goToPage:async e=>{await this.fetchData({page:e})}},e,t)};#at=(e,t)=>{!function(e,t,r){let{hot:n,getQueryPage:o,getQueryPageSize:i,setPageSize:s}=e,a=n.getPlugin(fT);if(!a?.enabled)return;let l="auto"===r||"number"!=typeof r||!Number.isFinite(r)||r<1?10:r;(l!==i()||1!==o())&&s(l).catch(()=>{let e=n.getPlugin(fT);e?.enabled&&e.revertPageSizeTo(t)})}({hot:this.hot,getQueryPage:()=>this.#s0.page,getQueryPageSize:()=>this.#s0.pageSize,setPageSize:async e=>{await this.fetchData({pageSize:e,page:1})}},e,t)};#ar=e=>(function(e,t){let{hot:r,hasFetchFn:n,applyFiltersAndRefetch:o}=e;if(n())return o(fE(r,t)),!1})({hot:this.hot,hasFetchFn:()=>na(this.#aa()),applyFiltersAndRefetch:e=>{this.#s0.filters=e??null,this.#s0.page=1,this.#an()}},e);#s4=(e,t,r)=>(function(e,t,r){let{hot:n,hasFetchFn:o,applyQueryParametersFromPlugins:i,fetchData:s}=e;if(o()&&r)return n.getPlugin(fA).setSortConfig(t),i(),s({skipLoading:!0}),!1})({hot:this.hot,hasFetchFn:()=>na(this.#aa()),applyQueryParametersFromPlugins:()=>this.#s6(),fetchData:e=>this.#an(e)},t,r);#s5=e=>(function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,{page:n,pageSize:o}=e;return(n-1)*("number"==typeof o&&o>=1?o:r)+t})(this.#s0,e);#s9=(e,t)=>{if(na(this.#am())&&fg.has(t))return!1};#s7=(e,t)=>{var r;if(r=na(this.#am()),!(r&&e?.length&&"DataProvider.revert"!==t&&fg.has(t))||0)return;let n=function(e,t){if(!t)return[];let r=t.filter(e=>e[2]!==e[3]);return 0===r.length?[]:r.filter(t=>{let r=e.propToCol(t[1]);return void 0!==r&&!(r<0)&&!1!==e.getCellMetaTransient(t[0],r).valid})}(this.hot,e);0!==n.length&&this.#af(()=>fR(this.hot,{getRowIdOption:()=>this.#as(),commitRowsUpdate:(e,t)=>this.#ab(e,t)},n))};#s8=(e,t,r)=>{var n;return n={hot:this.hot,getOnRowsCreate:()=>this.#ac(),getOnRowsRemove:()=>this.#ap(),getRowIdOption:()=>this.#as(),getRowId:e=>this.getRowId(e),createRows:e=>this.createRows(e),removeRows:e=>this.removeRows(e)},"insert_row_above"===e||"insert_row_below"===e?function(e,t,r,n){let{hot:o,getOnRowsCreate:i,getRowId:s,createRows:a}=e;if(!na(i()))return;let l=o.countSourceRows();if(o.getSettings().maxRows===l)return;let h="insert_row_below"===t?"below":"above",d=r??("below"===h?l:0);return a({position:h,referenceRowId:"number"==typeof d&&d>=0?s(d):void 0,rowsAmount:"number"==typeof n&&n>=1?n:1}),!1}(n,e,t,r):"remove_row"===e?function(e,t,r){let{hot:n,getOnRowsRemove:o,getRowIdOption:i,removeRows:s}=e;if(!na(o()))return;let a=function(e,t,r,n){let o=[],i=()=>e.countRows(),s=(r,n)=>{for(let s=0;s<n;s+=1){let n=r+s;if(n>=0&&n<i()){let r=fC(e,t,n);null==r&&tr(`DataProvider: cannot remove row at visual index ${n} because \`rowId\` resolves to null or undefined.`),o.push(r)}}};if(Array.isArray(r))r.forEach(e=>{let[t,r]=e;s(null==t?Math.max(0,i()-(r??1)):Math.max(0,t),r??1)});else{let e="number"==typeof n&&n>=1?n:1;s(null==r?Math.max(0,i()-e):Math.max(0,r),e)}return o}(n,i(),t,r);if(0!==a.length)return s(a),!1}(n,t,r):void 0};destroy(){this.#ao(),super.destroy()}}class fN{#aw=null;#aS=0;#av=null;#aR;constructor(e){this.#aR=e}get isActive(){return null!==this.#aw}configure(e){this.#av=e}update(e){this.#aS=e,0===e?this.stop():this.isActive||this.#aE()}stop(){null!==this.#aw&&(clearTimeout(this.#aw),this.#aw=null),this.#aS=0}#aE=()=>{if(this.runLocalHooks("tick",this.#aS),0===this.#aS)return;let e=function(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:200,o=Math.min(Math.abs(e),r),i=t.max-t.min;return Math.round(t.max-Math.log(1+o/r*n)/Math.log(1+n)*i)}(this.#aS,this.#av.intervalRange,this.#av.rampDistance);this.#aw=this.#aR(this.#aE,e)}}th(fN,ab);class fO{#aT;#aA;constructor(e){this.#aT=new fN(e),this.#aA=new fN(e),this.#aT.addLocalHook("tick",e=>this.runLocalHooks("scrollHorizontal",e)),this.#aA.addLocalHook("tick",e=>this.runLocalHooks("scrollVertical",e))}get isActive(){return this.#aT.isActive||this.#aA.isActive}get isHorizontalActive(){return this.#aT.isActive}get isVerticalActive(){return this.#aA.isActive}configure(e){this.#aT.configure(e),this.#aA.configure(e)}update(e){let{x:t,y:r}=e;this.#aT.update(t),this.#aA.update(r)}stop(){this.#aT.stop(),this.#aA.stop()}stopHorizontal(){this.#aT.stop()}stopVertical(){this.#aA.stop()}destroy(){this.stop(),this.#aT=null,this.#aA=null}}th(fO,ab);let fk="dragToScroll";class fH extends pa{static get PLUGIN_KEY(){return fk}static get PLUGIN_PRIORITY(){return 100}static get DEFAULT_SETTINGS(){return{interval:{min:20,max:500},rampDistance:120}}boundaries=null;callback=null;listening=!1;#aM=new fO((e,t)=>this.hot._registerTimeout(e,t)).addLocalHook("scrollHorizontal",e=>this.#aI(e)).addLocalHook("scrollVertical",e=>this.#ax(e));#aN=!1;#aO=null;#ak=null;#aH=null;#a_=null;#aL=null;isEnabled(){return!!this.hot.getSettings()[fk]}enablePlugin(){this.enabled||(this.#aM.configure({intervalRange:this.getSetting("interval"),rampDistance:this.getSetting("rampDistance")}),this.addHook("beforeOnCellMouseDown",(e,t,r,n)=>{this.#aP("cell",e,"object"==typeof n&&null!==n?n:null)}),this.addHook("afterOnCellCornerMouseDown",e=>this.#aP("corner",e)),this.addHook("afterOnSelectionEdgeMouseDown",this.#aD),this.addHook("afterOnSelectionHandleMouseDown",this.#aF),this.addHook("afterSelection",this.#i0),this.addHook("afterScroll",this.#aB),this.registerEvents(),super.enablePlugin())}updatePlugin(){this.disablePlugin(),this.enablePlugin(),super.updatePlugin()}disablePlugin(){this.#aM.stop(),this.unregisterEvents(),super.disablePlugin()}setBoundaries(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{left:0,right:this.hot.rootWindow.innerWidth,top:0,bottom:this.hot.rootWindow.innerHeight};this.boundaries=e}setCallback(e){this.callback=e}check(e,t){let r=0,n=0,{boundaries:o}=this;o&&(t<o.top?n=t-o.top:t>o.bottom&&(n=t-o.bottom),e<o.left?r=e-o.left:e>o.right&&(r=e-o.right)),this.#aN=0!==n||0!==r,this.callback&&this.callback(r,n)}listen(){this.listening=!0}unlisten(){this.listening=!1,this.#aO=null,this.#aL=null,this.#ak=null,this.#aH=null,this.#aN=!1,this.#a_=null,this.#aM.stop()}isListening(){return this.listening}registerEvents(){let{rootWindow:e}=this.hot,t=e;for(;t;)this.eventManager.addEventListener(t.document,"contextmenu",()=>this.unlisten()),this.eventManager.addEventListener(t.document,"mouseup",()=>this.unlisten()),this.eventManager.addEventListener(t.document,"keydown",e=>{"key"in e&&"Escape"===e.key&&this.unlisten()}),this.eventManager.addEventListener(t.document,"mousemove",e=>{this.#aV(e)}),this.eventManager.addEventListener(t.document,"touchstart",this.#aU),this.eventManager.addEventListener(t.document,"touchmove",this.#az),this.eventManager.addEventListener(t.document,"touchend",this.#aW),this.eventManager.addEventListener(t.document,"touchcancel",this.#aW),t=t7(t)}unregisterEvents(){this.eventManager.clear()}#aP(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(nT(t)||"cell"===e&&"single"===this.hot.getSettings().selectionMode)return;this.#aO=e,this.#a_=r;let n=this.hot.view._wt.wtOverlays.topOverlay.mainTableScrollableElement;if(n===this.hot.rootWindow)this.setBoundaries();else{let e=n.getBoundingClientRect();this.setBoundaries({left:e.left+this.hot.view.getRowHeaderWidth(),right:e.right,top:e.top+this.hot.view.getColumnHeaderHeight(),bottom:e.bottom})}this.setCallback((e,t)=>{let{selection:r}=this.hot,n=r.isSelectedByRowHeader()?0:e,o=r.isSelectedByColumnHeader()?0:t;this.#aM.update({x:n,y:o})}),this.listen()}#aD=e=>{this.hot.getPlugin("moveCells")?.isDragActive()===!0&&this.#aP("move",e)};#aF=e=>{this.hot.getPlugin("selectionHandles")?.isDragActive()===!0&&this.#aP("handle",e)};#aU=e=>{if(null!==this.#aL)return;let t=nN(e);null===t||this.hot.getPlugin("multipleSelectionHandles")?.isDraggedBy(t.identifier)===!0&&(this.#aL=t.identifier,this.#aP("handle",e))};#az=e=>{if(!this.isListening()||null===this.#aL)return;let t=nO(e,this.#aL);null!==t&&this.#aG(t.clientX,t.clientY)};#aW=e=>{null===this.#aL||null===nO(e,this.#aL)&&this.unlisten()};#aI(e){let t=(this.hot.isRtl()?e<0:e>0)?this.hot.getLastFullyVisibleColumn()+1:this.hot.getFirstPartiallyVisibleColumn()-1;this.hot.scrollViewportTo({col:t},()=>{})||this.#aM.stopHorizontal()}#ax(e){let t=this.hot.getFirstFullyVisibleRow(),r=this.hot.getLastFullyVisibleRow();this.hot.scrollViewportTo({row:e>0?r+1:t-1},()=>{})||this.#aM.stopVertical()}#i0=(e,t,r,n,o)=>{this.listening&&this.#aN&&(o.value=!0)};#aV(e){this.isListening()&&this.#aG(e.clientX,e.clientY)}#aG(e,t){this.#ak=e,this.#aH=t,this.check(e,t)}#aB=()=>{if("cell"!==this.#aO||!this.#aN||null===this.#ak||null===this.#aH||"single"===this.hot.getSettings().selectionMode||this.#a_?.row||this.#a_?.column)return;let{selection:e,view:t}=this.hot,r=pf(this.hot,this.#ak,this.#aH);if(!r)return;let n=r.row??0,o=r.col??0,i=t.getFirstFullyVisibleRow()??0,s=t.getLastFullyVisibleRow()??0,a=t.getFirstFullyVisibleColumn()??0,l=t.getLastFullyVisibleColumn()??0;n>s?n=s:n<i&&(n=i),o>l?o=l:o<a&&(o=a),e.isSelectedByRowHeader()&&(o=this.hot.countCols()-1),e.isSelectedByColumnHeader()&&(n=this.hot.countRows()-1);let h=this.hot._createCellCoords(n,o),d=this.hot.getSelectedRangeLast();d&&d.to.row===h.row&&d.to.col===h.col||e.setRangeEnd(h)};destroy(){this.#aM.destroy(),super.destroy()}}nF.getSingleton().register("afterDropdownMenuDefaultOptions"),nF.getSingleton().register("beforeDropdownMenuShow"),nF.getSingleton().register("afterDropdownMenuShow"),nF.getSingleton().register("afterDropdownMenuHide"),nF.getSingleton().register("afterDropdownMenuExecute");let f_="dropdownMenu",fL="changeType",fP="has-header-button";class fD extends pa{static get PLUGIN_KEY(){return f_}static get PLUGIN_PRIORITY(){return 230}static get PLUGIN_DEPS(){return["plugin:AutoColumnSize"]}static get DEFAULT_ITEMS(){return[mS,mv,ms,mT,ms,mw,ms,mR,ms,my]}commandExecutor=new mC(this.hot);itemsFactory=null;menu=null;#a$=!1;constructor(e){super(e),this.hot.addHook("afterGetColHeader",this.#o4)}isEnabled(){return!!this.hot.getSettings()[f_]}enablePlugin(){if(this.enabled)return;this.itemsFactory=new m_(this.hot,fD.DEFAULT_ITEMS),this.addHook("beforeOnCellMouseDown",this.#o9),this.addHook("beforeViewportScrollHorizontally",this.#aY),this.addHook("beforeDialogShow",()=>this.close());let e=this.hot.getSettings()[f_],t={items:this.itemsFactory.getItems(e)};this.registerEvents(),"function"==typeof e.callback&&this.commandExecutor.setCommonCallback(e.callback),this.registerShortcuts(),super.enablePlugin(),this.callOnPluginsReady(()=>{var r=this;this.hot.runHooks("afterDropdownMenuDefaultOptions",t),this.itemsFactory.setPredefinedItems(t.items);let n=this.itemsFactory.getItems(e);this.menu&&this.menu.destroy(),this.menu=new mG(this.hot,{className:"htDropdownMenu",keepInViewport:!0,container:("object"==typeof e?e.uiContainer:null)||this.hot.rootPortalElement}),this.hot.runHooks("beforeDropdownMenuSetItems",n),this.menu.setMenuItems(n),this.menu.addLocalHook("afterOpen",()=>this.#iH()),this.menu.addLocalHook("afterSubmenuOpen",e=>this.#aj(e)),this.menu.addLocalHook("afterClose",()=>this.#i_()),this.menu.addLocalHook("executeCommand",function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return r.executeCommand(e,...n)}),J(n,e=>{this.commandExecutor.registerCommand(e.key,e)})})}updatePlugin(){this.disablePlugin(),this.enablePlugin(),super.updatePlugin()}disablePlugin(){this.close(),this.menu&&this.menu.destroy(),this.unregisterShortcuts(),super.disablePlugin()}registerShortcuts(){let e=this.hot.getShortcutManager().getContext("grid"),t=()=>{let e=this.hot.getSelectedRangeActive();if(!e)return;let{highlight:t}=e,r=t.isHeader()?this.hot.getCell(t.row??0,t.col??0,!0):null,n=t.isHeader()&&(t.col??-1)>=0&&!!r&&rs(r),o=t.isHeader()&&(t.col??-1)>=0&&r&&rh(r,"hiddenHeader");if((n||o||t.isCell())&&(t.col??-1)>=0){let e=n||o?t.row??-1:-1;this.hot.selectColumns(t.col??0,t.col??0,e);let r=this.hot.getSelectedRangeActive();if(!r)return;let{from:i}=r,s=mu(this.menu?.container??this.hot.rootElement,this.hot.rootDocument),a=this.hot.getCell(e,i.col??0,!0)?.querySelector(`.${fL}`);if(!a)for(let r=-this.hot.view.getColumnHeadersCount();r<=-1;r++){let n=this.hot.getCell(r,i.col??0,!0)?.querySelector(`.${fL}`);if(n){a=n,e=r,this.hot.selectColumns(t.col??0,t.col??0,e);break}}if(!a&&o)for(let t=(i.col??0)-1;t>=0;t--){let r=this.hot.getCell(e,t,!0);if(!r||rh(r,"hiddenHeader"))continue;let n=r?.querySelector(`.${fL}`);n&&(a=n,this.hot.selectColumns(t,t,e));break}if(!a||!ne(a))return;let l=this.#aq(a),h=a.closest("th"),d=h&&Number.parseInt(h.getAttribute("rowspan")??"1",10)>1,u=d?h.getBoundingClientRect().top+h.clientHeight:l.bottom,c=h?this.hot.getCoords(h):null,g=c?.row??e,p=c?.col??null;this.open({left:l.left+s.left,top:u+s.top},{left:l.width,right:0,above:0,below:d?-1:3},null===p?void 0:()=>{let e=this.hot.getCell(g,p,!0),t=e?.querySelector(`.${fL}`);return t?t.getBoundingClientRect():null}),this.menu?.getNavigator()?.toFirstItem()}};e?.addShortcuts([{keys:[["Shift","Alt","ArrowDown"],["Control/Meta","Enter"]],callback:t,runOnlyIf:()=>{let e=this.hot.getSelectedRangeActive()?.highlight,t=e?.isHeader()?this.hot.getCell(e.row??0,e.col??0,!0):null,r=e?.isHeader()&&(e.col??-1)>=0&&t&&rh(t,"hiddenHeader");return!!(e&&!this.menu?.isOpened()&&e.isHeader()&&(this.hot.selection.isCellVisible(e)||r))},captureCtrl:!0,group:f_},{keys:[["Shift","Alt","ArrowDown"]],callback:t,runOnlyIf:()=>{let e=this.hot.getSelectedRangeActive()?.highlight;return!!(e&&this.hot.selection.isCellVisible(e)&&e.isCell()&&!this.menu?.isOpened())},group:f_}])}unregisterShortcuts(){this.hot.getShortcutManager().getContext("grid")?.removeShortcutsByGroup(f_)}registerEvents(){this.eventManager.addEventListener(this.hot.rootElement,"click",e=>this.#aK(e))}open(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{above:0,below:0,left:0,right:0},r=arguments.length>2?arguments[2]:void 0;this.menu?.isOpened()||(this.hot.runHooks("beforeDropdownMenuShow",this),this.menu?.open(),tp(t,(e,t)=>{this.menu?.setOffset(t,e)}),this.menu?.setPosition(e,r))}close(){this.menu?.close()}executeCommand(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];this.commandExecutor.execute(e,...r)}setListening(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];if(this.menu?.isOpened()){let t=this.menu.hotMenu;e?t.listen():t.unlisten()}}#aX(e){e.getKeyboardShortcutsCtrl()?.addCustomShortcuts([{keys:[["Control/Meta","A"]],callback:()=>!1}])}#aK(e){let t=t4(e);if(rh(t,fL)){let r=mu(this.menu?.container??this.hot.rootElement,this.hot.rootDocument),n=this.#aq(t),o=t.closest("th"),i=o?this.hot.getCoords(o):null,s=i?.col??null,a=i?.row??-1;e.stopPropagation(),this.#a$=!1,this.open({left:n.left+r.left,top:n.bottom+r.top},{left:n.width,right:0,above:0,below:3},null===s?void 0:()=>{let e=this.hot.getCell(a,s,!0),t=e?.querySelector(`.${fL}`);return t?t.getBoundingClientRect():null})}}#aq(e){let t=e.getBoundingClientRect(),r=Number.parseFloat(this.hot.rootWindow.getComputedStyle(e,"::before").width);if(Number.isFinite(r)&&t.width>=r&&t.height>=r){let e=t.left+(t.width-r)/2,n=t.top+(t.height-r)/2;return{top:n,left:e,right:e+r,bottom:n+r,width:r,height:r}}return{top:t.top,left:t.left,right:t.right,bottom:t.bottom,width:t.width,height:t.height}}#o4=(e,t)=>{if(e<0||!rs(t))return;let r=t.querySelector(`.${fL}`);if(this.enabled&&r){ne(r.parentNode)&&rd(r.parentNode,fP);return}if(!this.enabled){if(r){let e=r.parentNode;e?.removeChild(r),ne(e)&&ru(e,fP)}return}let n=this.hot.rootDocument.createElement("button");n.className=fL,n.type="button",n.tabIndex=-1,this.hot.getSettings().ariaTags&&(rc(n,[_(),H(" ")]),rc(t,[P("menu")])),n.onclick=function(){return!1};let o=t.firstChild;if(!o)return;let i=o.querySelector(".colHeader");i?o.insertBefore(n,i.nextSibling):o.appendChild(n),ne(o)&&rd(o,fP)};#iH(){this.hot.runHooks("afterDropdownMenuShow",this),this.#aX(this.menu)}#aj(e){this.#aX(e)}#i_(){this.hot.listen(),this.hot.runHooks("afterDropdownMenuHide",this)}#aY=e=>this.#a$?null:e;#o9=e=>{rh(t4(e),fL)&&(this.#a$=!0)};destroy(){this.close(),this.menu&&this.menu.destroy(),super.destroy()}}function fF(e){return e&&"columnHeaders"in e?(t2("ExportFile.columnHeaders","The `columnHeaders` export option is deprecated and will be removed in Handsontable 19.0.0. Use `colHeaders` instead."),"colHeaders"in e)?e:{...e,colHeaders:e.columnHeaders}:e}fD.SEPARATOR={name:ms};let fB=class{options={};constructor(e){this.hot=e}setOptions(e){this.options=fF(e)}_extractDataMatrix(e){let{startRow:t,startCol:r,endRow:n,endCol:o}=this._getDataRange(),i=this.options,s=[];for(let a=t;a<=n;a++){if(!1===i.exportHiddenRows&&this._isHiddenRow(a))continue;let t=[];for(let n=r;n<=o;n++)!1===i.exportHiddenColumns&&this._isHiddenColumn(n)||t.push(e(a,n));s.push(t)}return s}getData(){return this._extractDataMatrix((e,t)=>this.hot.getDataAtCell(e,t))}getRowHeaders(){let e=[];if(this.options.rowHeaders){let{startRow:t,endRow:r}=this._getDataRange(),n=this.hot.getRowHeader();for(let o=t;o<=r;o++)!1===this.options.exportHiddenRows&&this._isHiddenRow(o)||e.push(n[o])}return e}getColumnHeaders(){let e=[];if(this.options.colHeaders){let{startCol:t,endCol:r}=this._getDataRange(),n=this.hot.getColHeader();for(let o=t;o<=r;o++)!1===this.options.exportHiddenColumns&&this._isHiddenColumn(o)||e.push(n[o])}return e}_getDataRange(){let e=this.hot.countCols()-1,t=this.hot.countRows()-1,[r=0,n=0,o=t,i=e]=this.options.range;return r=Math.max(r,0),n=Math.max(n,0),{startRow:r,startCol:n,endRow:o=Math.min(o,t),endCol:i=Math.min(i,e)}}getSourceData(){return this._extractDataMatrix((e,t)=>this.hot.getSourceDataAtCell(e,t))}getExcludedHiddenRows(){let e=new Set;if(!1!==this.options.exportHiddenRows)return e;let{startRow:t,endRow:r}=this._getDataRange();for(let n=t;n<=r;n++)this._isHiddenRow(n)&&e.add(this.hot.toPhysicalRow(n));return e}getExcludedHiddenColumns(){let e=new Set;if(!1!==this.options.exportHiddenColumns)return e;let{startCol:t,endCol:r}=this._getDataRange();for(let n=t;n<=r;n++)this._isHiddenColumn(n)&&e.add(this.hot.toPhysicalColumn(n));return e}getHiddenRowDataIndices(){if("hide"!==this.options.exportHiddenRows)return[];let{startRow:e,endRow:t}=this._getDataRange(),r=[],n=0;for(let o=e;o<=t;o++)this._isHiddenRow(o)&&r.push(n),n+=1;return r}getHiddenColumnDataIndices(){if("hide"!==this.options.exportHiddenColumns)return[];let{startCol:e,endCol:t}=this._getDataRange(),r=[],n=0;for(let o=e;o<=t;o++)this._isHiddenColumn(o)&&r.push(n),n+=1;return r}getFormulasSeparator(){let e=this.hot.getPlugin("formulas");return e&&e.isEnabled()?e.engine?.getConfig()?.functionArgSeparator??",":","}getCellsMeta(){return this._extractDataMatrix((e,t)=>this.hot.getCellMetaTransient(e,t))}getCellElements(){return this._extractDataMatrix((e,t)=>this.hot.getCell(e,t))}getMergeCells(){let{startRow:e,startCol:t,endRow:r,endCol:n}=this._getDataRange(),o=this.hot.getPlugin("mergeCells");if(!o||!o.isEnabled())return[];let i=o.mergedCellsCollection.mergedCells,s=[],a=!1===this.options.exportHiddenRows,l=!1===this.options.exportHiddenColumns,h=e=>!a||!this._isHiddenRow(e),d=e=>!l||!this._isHiddenColumn(e);return i.forEach(o=>{let i=o.row+o.rowspan-1,a=o.col+o.colspan-1;if(o.row<e||i>r||o.col<t||a>n||!h(o.row)||!d(o.col))return;let l=this._countVisibleBefore(o.row,e,h),u=this._countVisibleBefore(o.col,t,d),c=this._countVisibleBefore(i+1,o.row,h),g=this._countVisibleBefore(a+1,o.col,d);c<=1&&g<=1||s.push({row:l,col:u,rowspan:c,colspan:g})}),s}getColumnsWidths(){let{startCol:e,endCol:t}=this._getDataRange(),r=this.options,n=[];for(let o=e;o<=t;o++){if(!1===r.exportHiddenColumns&&this._isHiddenColumn(o))continue;let e=this._isHiddenColumn(o)?this._getNaturalColWidth(o):this.hot.getColWidth(o);n.push(e)}return n}getRowsHeights(){let{startRow:e,endRow:t}=this._getDataRange(),r=this.options,n=[];for(let o=e;o<=t;o++){if(!1===r.exportHiddenRows&&this._isHiddenRow(o))continue;let e=this._isHiddenRow(o)?this._getNaturalRowHeight(o):this.hot.getRowHeight(o);n.push(e)}return n}getFrozenRows(){return this.hot.getSettings().fixedRowsTop||0}getFrozenColumns(){return this.hot.getSettings().fixedColumnsStart||0}getNestedColumnHeaders(){let e=this.hot.getPlugin("nestedHeaders");if(!e||!e.isEnabled())return null;let t=e.getLayersCount(),{startCol:r,endCol:n}=this._getDataRange(),o=!!this.options.exportHiddenColumns,i=[];for(let s=0;s<t;s++){let t=[],a=r;for(;a<=n;){if(!o&&this._isHiddenColumn(a)){a+=1;continue}a=o?this._appendNestedHeaderWithHidden(e,s,a,n,t):this._appendNestedHeaderWithoutHidden(e,s,a,n,t)}i.push(t)}return i}_appendNestedHeaderWithHidden(e,t,r,n,o){let i=e.getStateManager().getHeaderTreeNodeData(t,r);if(!i||i.columnIndex===r){let e=i?.origColspan??1,t=Math.min(e,n-r+1),s=(i?.headerClassNames??[]).join(" ");return o.push({label:i?.label??"",colspan:t,className:s}),r+e}return o.push({label:"",colspan:1,className:""}),r+1}_appendNestedHeaderWithoutHidden(e,t,r,n,o){let i=e.getHeaderSettings(t,r);if(!i||i.isRoot){let e=i?.colspan??1,t=0;for(let o=r;o<r+e&&o<=n;o++)this._isHiddenColumn(o)||(t+=1);let s=(i?.headerClassNames??[]).join(" ");return o.push({label:i?.label??"",colspan:t,className:s}),r+e}return o.push({label:"",colspan:1,className:""}),r+1}getColumnHeadersClassNames(){if(!this.options.colHeaders)return[];let{startCol:e,endCol:t}=this._getDataRange(),r=this.options,n=[];for(let o=e;o<=t;o++){if(!1===r.exportHiddenColumns&&this._isHiddenColumn(o))continue;let e=this.hot.getColumnMeta(o).headerClassName,t="";Array.isArray(e)?t=e.join(" "):"string"==typeof e&&(t=e),n.push(t)}return n}getLayoutDirection(){return"rtl"===this.hot.getSettings().layoutDirection?"rtl":"ltr"}getColumnSummaries(){let e=this.hot.getPlugin("columnSummary");if(!e||!e.isEnabled())return[];let{startRow:t,startCol:r,endRow:n,endCol:o}=this._getDataRange(),i=e.endpoints.getAllEndpoints(),s=new Set;i.forEach(e=>{if(void 0===e.destinationRow)return;let r=this._physicalRowToDataIndex(e.destinationRow,t,n);null!==r&&s.add(r)});let a=[];return i.forEach(e=>{let i=this._transformEndpointToSummary(e,t,n,r,o,s);null!==i&&a.push(i)}),a}_transformEndpointToSummary(e,t,r,n,o,i){if(void 0===e.destinationRow||void 0===e.destinationColumn)return null;let s=this._physicalRowToDataIndex(e.destinationRow,t,r),a=this._physicalColToDataIndex(e.destinationColumn,n,o);if(null===s||null===a)return null;let l=e.sourceColumn??e.destinationColumn,h=this._physicalColToDataIndex(l,n,o);if(null===h)return null;let d=e.ranges||[[0,this.hot.countRows()-1]],u=[];return(d.forEach(e=>{let n=e[0],o=void 0!==e[1]?e[1]:e[0];for(let e=n;e<=o;e++){let n=this._physicalRowToDataIndex(e,t,r);if(!(null===n||i.has(n))){if(u.length>0){let e=u[u.length-1];if(e[1]+1===n){e[1]=n;continue}}u.push([n,n])}}}),0===u.length)?null:{destRow:s,destCol:a,type:String(e.type||"sum").toLowerCase(),sourceCol:h,sourceRanges:u}}_countVisibleBefore(e,t,r){let n=0;for(let o=t;o<e;o++)r(o)&&(n+=1);return n}_physicalRowToDataIndex(e,t,r){let n=this.hot.toVisualRow(e);return null===n||n<t||n>r||!1===this.options.exportHiddenRows&&this._isHiddenRow(n)?null:this._countVisibleBefore(n,t,e=>!1!==this.options.exportHiddenRows||!this._isHiddenRow(e))}_physicalColToDataIndex(e,t,r){let n=this.hot.toVisualColumn(e);return null===n||n<t||n>r||!1===this.options.exportHiddenColumns&&this._isHiddenColumn(n)?null:this._countVisibleBefore(n,t,e=>!1!==this.options.exportHiddenColumns||!this._isHiddenColumn(e))}_getNaturalColWidth(e){let t=this.hot.getSettings(),r=this.hot.getColumnMeta(e).width;if(null!=r)return r;let{colWidths:n,defaultColumnWidth:o}=t,i=o??50;return Array.isArray(n)?n[e]??i:"function"==typeof n?n(e)??i:"number"==typeof n?n:i}_getNaturalRowHeight(e){let{rowHeights:t,defaultRowHeight:r}=this.hot.getSettings(),n=r??23;return Array.isArray(t)?t[e]??n:"function"==typeof t?t(e)??n:"number"==typeof t?t:n}_isHiddenRow(e){return this.hot.rowIndexMapper.isHidden(this.hot.toPhysicalRow(e))}_isHiddenColumn(e){return this.hot.columnIndexMapper.isHidden(this.hot.toPhysicalColumn(e))}};class fV{static get DEFAULT_OPTIONS(){return{mimeType:"text/plain",fileExtension:"txt",filename:"Handsontable [YYYY]-[MM]-[DD]",encoding:"utf-8",bom:!1,colHeaders:!1,rowHeaders:!1,exportHiddenColumns:!1,exportHiddenRows:!1,range:[]}}get binary(){return!1}isBinary(){return this.binary}isText(){return!this.binary}export(){tr("export() must be implemented by subclass")}dataProvider;constructor(e,t){this.dataProvider=e,this.options=this._mergeOptions(t),this.dataProvider.setOptions(this.options)}_mergeOptions(e){let t=tl(this.constructor.DEFAULT_OPTIONS),r=new Date;return t=ti(tl(fV.DEFAULT_OPTIONS),t),(t=ti(t,fF(e))).filename=tK(t.filename,{YYYY:r.getFullYear(),MM:`${r.getMonth()+1}`.padStart(2,"0"),DD:`${r.getDate()}`.padStart(2,"0")}),t}}let fU=fV,fz=class extends fU{static get DEFAULT_OPTIONS(){return{mimeType:"text/csv",fileExtension:"csv",bom:!0,columnDelimiter:",",rowDelimiter:"\r\n",sanitizeValues:!1}}_mergeOptions(e){let t=super._mergeOptions(e),r={};return"hide"===t.exportHiddenRows&&(r.exportHiddenRows=!1),"hide"===t.exportHiddenColumns&&(r.exportHiddenColumns=!1),Object.keys(r).length>0?ti(t,r):t}export(){let e=this.options,t=this.dataProvider.getData(),r=this.dataProvider.getColumnHeaders(),n=r.length>0,o=this.dataProvider.getRowHeaders(),i=o.length>0,s=e.bom?String.fromCharCode(65279):"";return n&&(r=r.map(t=>this._escapeCell(t,{force:!0,sanitizeValue:e.sanitizeValues})),i&&(s+=e.columnDelimiter),s+=r.join(e.columnDelimiter),s+=e.rowDelimiter),t.forEach((t,r)=>{r>0&&(s+=e.rowDelimiter),i&&(s+=this._escapeCell(o[r],{sanitizeValue:e.sanitizeValues}),s+=e.columnDelimiter);let n=t.map(t=>this._escapeCell(t,{sanitizeValue:e.sanitizeValues})).join(e.columnDelimiter);s+=n}),s}_escapeCell(e){let{force:t=!1,sanitizeValue:r=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=eH(e);return""===n||(r&&(t=!0),r instanceof RegExp?n=this.#aQ(n,r):"function"==typeof r?n=r(n):r&&(n=this.#aZ(n)),(t||n.indexOf("\r")>=0||n.indexOf('"')>=0||n.indexOf("\n")>=0||n.indexOf(this.options.columnDelimiter)>=0)&&(n=n.replaceAll('"','""'),n=`"${n}"`)),n}#aZ(e){return e.startsWith("=")||e.startsWith("+")||e.startsWith("-")||e.startsWith("@")||e.startsWith("	")||e.startsWith("\r")?`'${e}`:e}#aQ(e,t){return t.test(e)?`'${e}`:e}},fW={sum:"SUM",min:"MIN",max:"MAX",count:"COUNT",average:"AVERAGE"};function fG(e){let t="",r=e;for(;r>0;)t=String.fromCharCode(65+(r-1)%26)+t,r=Math.floor((r-1)/26);return t}function f$(e){let t=0;for(let r=0;r<e.length;r++)t=26*t+(e.charCodeAt(r)-64);return t}function fY(e,t){let r=0;return e.forEach(e=>{e<t&&(r+=1)}),r}function fj(e){return Array.isArray(e)?e.filter(e=>"string"==typeof e&&e.length>0):"string"==typeof e?e.split(" ").filter(e=>e.length>0):[]}let fq=new WeakMap,fK=new WeakMap,fX=new Set(["htLeft","htRight","htCenter","htJustify","htTop","htMiddle","htBottom"]);function fQ(e){if(!e)return null;let t=e.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/);if(!t||0===(e_(t[4])?Number.parseFloat(t[4]):1))return null;let r=Number.parseInt(t[1],10).toString(16).padStart(2,"0"),n=Number.parseInt(t[2],10).toString(16).padStart(2,"0"),o=Number.parseInt(t[3],10).toString(16).padStart(2,"0");return`#${r}${n}${o}`.toUpperCase()}function fZ(e){if(!e||"string"!=typeof e)return"FF000000";let t=e.startsWith("#")?e.slice(1):e;if(3===t.length){let e=t[0]+t[0],r=t[1]+t[1],n=t[2]+t[2];return`FF${e}${r}${n}`.toUpperCase()}return 6===t.length?`FF${t}`.toUpperCase():8===t.length?t.toUpperCase():"FF000000"}function fJ(e){return e?f0({className:e}):null}function f0(e){if(!e?.className)return null;let t=fj(e.className),r={};return t.includes("htLeft")?r.horizontal="left":t.includes("htCenter")?r.horizontal="center":t.includes("htRight")?r.horizontal="right":t.includes("htJustify")&&(r.horizontal="justify"),t.includes("htTop")?r.vertical="top":t.includes("htMiddle")?r.vertical="middle":t.includes("htBottom")&&(r.vertical="bottom"),Object.keys(r).length>0?r:null}let f1=Date.UTC(1899,11,30);function f2(e){return Math.round((Date.UTC(e.getFullYear(),e.getMonth(),e.getDate())-f1)/864e5)}let f3={csv:fz,xlsx:class extends fU{static get BINARY(){return!0}get binary(){return!0}static get DEFAULT_OPTIONS(){return{mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",fileExtension:"xlsx",bom:!1,engine:null,compression:null,conditionalFormatting:[],exportFormulas:!1,headerStyle:{backgroundColor:"#F2F2F2",border:{style:"thin"}}}}async export(){let e=this.options.engine;e&&"function"==typeof e.Workbook||tr("Missing or invalid ExcelJS engine. Pass the ExcelJS module via the `engines` option in the exportFile plugin settings: `exportFile: { engines: { xlsx: ExcelJS } }`.");let t=this.options.sheets;new Set(t&&t.length>0?t.map(e=>e.instance.rootDocument):[this.dataProvider.hot.rootDocument]).forEach(e=>{fq.delete(e),fK.delete(e)});let r=new e.Workbook;if(t&&t.length>0){let e=new Set;t.forEach(t=>{let n=new fB(t.instance),o={...this.options,...fF(t)};n.setOptions(o);let i=t.name||"Sheet",s=i,a=1;for(;e.has(s);)s=`${i}${a}`,a+=1;e.add(s);let l=r.addWorksheet(s);this.#aJ(r,l,n,o)})}else{let e=r.addWorksheet("Sheet1");this.#aJ(r,e,this.dataProvider,this.options)}return r.xlsx.writeBuffer(this.#a0())}#aJ(e,t,r,n){let o=r.getData(),i=r.getCellsMeta(),s=this.#a1(e,i),a=r.getCellElements(),l=r.getColumnHeaders(),h=r.getColumnHeadersClassNames(),d=r.getRowHeaders(),u=r.getColumnsWidths(),c=r.getRowsHeights(),g=r.getMergeCells(),p=r.getFrozenRows(),m=r.getFrozenColumns(),f=r.getNestedColumnHeaders(),b="rtl"===r.getLayoutDirection(),C=n.exportFormulas??!1,y=new Map;r.getColumnSummaries().forEach(e=>{y.set(`${e.destRow}:${e.destCol}`,e)});let w=C?r.getSourceData():null,S=C?r.getFormulasSeparator():",",v=l.length>0,R=d.length>0,E=null!==f&&v,T=0;E?T=f.length:v&&(T=1);let A=T+1,M=R?2:1,I=C?r.getExcludedHiddenRows():null,x=C?r.getExcludedHiddenColumns():null,N=r.getHiddenRowDataIndices(),O=r.getHiddenColumnDataIndices(),{rootDocument:k,rootWindow:H}=r.hot;this.#a2(t,u,R),O.length>0&&this.#a3(t,O,R),this.#a6(t,p,m,T,R,b);let _=this.#a5(n.headerStyle),L=this.#a4(n.headerStyle);E?(this.#a9(t,f,R,M,_,L),this.#a7(t,f,R,M)):v&&this.#a8(t,l,h,R,M,_,L);let P=!(y.size>0)&&i.some(e=>e.some(e=>e?.readOnly===!0));this.#le(t,o,{exportFormulas:C,formulasSeparator:S,dataRowOffset:A,dataColOffset:M,excludedHiddenRows:I,excludedHiddenCols:x,summaryMap:y,sourceData:w,hasRowHeaders:R,headerFill:_,headerBorder:L,hasReadOnlyCells:P,rootDocument:k,rootWindow:H,validationMap:s,cellsMeta:i,cellElements:a,rowHeaders:d,rowsHeights:c}),N.length>0&&this.#lt(t,N,A),P&&t.protect("",{selectLockedCells:!0,selectUnlockedCells:!0,formatColumns:!0,formatRows:!0,sort:!0,autoFilter:!0}),g.forEach(e=>{let r=e.row+A,n=e.col+M,o=r+e.rowspan-1,i=n+e.colspan-1;t.mergeCells(r,n,o,i)});let{conditionalFormatting:D}=n;return D&&D.length>0&&this.#lr(t,D,A,M,o.length,o[0]?.length??0),o.length}#le(e,t,r){for(let n=0;n<t.length;n++){let o=t[n],i=n+r.dataRowOffset,s=e.getRow(i);if(e_(r.rowsHeights[n])&&(s.height=.75*r.rowsHeights[n]),r.hasRowHeaders){let e=s.getCell(1);e.value=r.rowHeaders[n]??null,r.headerFill&&(e.fill=r.headerFill),r.headerBorder&&(e.border=r.headerBorder)}this.#ln(s,o,n,r),s.commit()}}#ln(e,t,r,n){for(let o=0;o<t.length;o++){let i=t[o],s=e.getCell(o+n.dataColOffset),a=n.cellsMeta[r][o],l=n.summaryMap.get(`${r}:${o}`),h=n.sourceData?.[r][o],{value:d,numFmt:u}=this.#lo(i,a,h,l,n);s.value=d,u&&(s.numFmt=u);let c=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(!e){if(!r||!n)return null;let e=fj(t);return e.some(e=>!fX.has(e))?function(e,t,r){let n=r.join(" "),o=fK.get(e);if(o||(o=new Map,fK.set(e,o)),o.has(n))return o.get(n);let i=e.createElement("div");i.className="handsontable",i.style.cssText="position:absolute;top:-99999px;left:-99999px;visibility:hidden;pointer-events:none;";let s=e.createElement("table"),a=e.createElement("tbody"),l=e.createElement("tr"),h=e.createElement("td");h.className=n;let d=e.createElement("td");d.className=r.filter(e=>fX.has(e)).join(" "),l.appendChild(h),l.appendChild(d),a.appendChild(l),s.appendChild(a),i.appendChild(s),e.body.appendChild(i);let u=t.getComputedStyle(h),c=t.getComputedStyle(d),g=u.backgroundColor,p=c.backgroundColor,m=u.color,f=c.color;e.body.removeChild(i);let b={fontBold:Number.parseInt(u.fontWeight,10)>=700||"bold"===u.fontWeight,fontItalic:"italic"===u.fontStyle,fontUnderline:(u.textDecorationLine||u.textDecoration||"").includes("underline"),fontColor:m!==f?fQ(m):null,backgroundColor:g!==p?fQ(g):null};return o.set(n,b),b}(r,n,e):null}let o=e.ownerDocument?.defaultView;if(!o)return null;let i=o.getComputedStyle(e),s=fj(t),a=s.some(e=>!fX.has(e));return{fontBold:Number.parseInt(i.fontWeight,10)>=700||"bold"===i.fontWeight,fontItalic:"italic"===i.fontStyle,fontUnderline:(i.textDecorationLine||i.textDecoration||"").includes("underline"),fontColor:a?fQ(i.color):null,backgroundColor:a?function(e,t,r){let n=t.join(" "),o=fq.get(e);if(o||(o=new Map,fq.set(e,o)),o.has(n))return o.get(n)??null;let i=e.createElement("div");i.className="handsontable",i.style.cssText="position:absolute;top:-99999px;left:-99999px;visibility:hidden;pointer-events:none;";let s=e.createElement("table"),a=e.createElement("tbody"),l=e.createElement("tr"),h=e.createElement("td");h.className=n;let d=e.createElement("td");d.className=t.filter(e=>fX.has(e)).join(" "),l.appendChild(h),l.appendChild(d),a.appendChild(l),s.appendChild(a),i.appendChild(s),e.body.appendChild(i);let u=r.getComputedStyle(h).backgroundColor,c=r.getComputedStyle(d).backgroundColor;e.body.removeChild(i);let g=u!==c?fQ(u):null;return o.set(n,g),g}(e.ownerDocument,s,o):null}}(n.cellElements[r][o],a.className,n.rootDocument,n.rootWindow);this.#li(s,a,c,n),n.hasReadOnlyCells&&(s.protection={locked:!0===a.readOnly})}}#li(e,t,r,n){let o=f0(t);o&&(e.alignment=o);let i=function(e){if(!e?.borders)return null;let{borders:t}=e,r={};return["top","bottom","left","right"].forEach(e=>{var n;t[e]&&t[e].width>0&&(r[e]={style:(n=t[e].width)>=3?"thick":2===n?"medium":"thin",color:{argb:fZ(t[e].color)}})}),Object.keys(r).length>0?r:null}(t);i&&(e.border=i);let s=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=e?.readOnly===!0,n=t?.fontBold||!1,o=t?.fontItalic||!1,i=t?.fontUnderline||!1,s=t?.fontColor??null;if(!n&&!o&&!i&&!s&&!r)return null;let a={};return n&&(a.bold=!0),o&&(a.italic=!0),i&&(a.underline=!0),s?a.color={argb:fZ(s)}:r&&(a.color={argb:"FF808080"}),Object.keys(a).length>0?a:null}(t,r);s&&(e.font=s);let a=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=null;return(t?.backgroundColor?r=fZ(t.backgroundColor):e?.readOnly===!0&&(r="FFF0F0F0"),r)?{type:"pattern",pattern:"solid",fgColor:{argb:r}}:null}(t,r);a&&(e.fill=a);let l=Array.isArray(t.source)?n.validationMap.get(JSON.stringify(t.source))??null:null,h=t&&l&&("dropdown"===t.type||"autocomplete"===t.type)&&Array.isArray(t.source)?{type:"list",allowBlank:!0,formulae:[l]}:null;h&&(e.dataValidation=h),t.comment?.value&&(e.note=String(t.comment.value))}#lo(e,t,r,n,o){var i,s,a,l,h;let{exportFormulas:d,formulasSeparator:u,dataRowOffset:c,dataColOffset:g,excludedHiddenRows:p,excludedHiddenCols:m}=o;if(n&&d){let r=function(e,t,r){let n=fW[e.type];if(!n)return null;let o=fG(e.sourceCol+r),i=e.sourceRanges.map(e=>{let[r,n]=e,i=r+t,s=n+t;return i===s?`${o}${i}`:`${o}${i}:${o}${s}`});return{formula:`${n}(${i.join(",")})`}}(n,c,g),o=this.#ls(e,t);return{value:r?{...r,result:e}:o,numFmt:null}}if(d&&"string"==typeof(i=r)&&i.startsWith("=")){let e,t,n;return{value:{formula:(s=c-1,a=g-1,l=p??void 0,h=m??void 0,e=r.startsWith("=")?r.slice(1):r,t=(l?.size??0)>0,n=(h?.size??0)>0,(0!==s||0!==a||t||n)&&(e=e.replace(/("(?:[^"]|"")*"|'[^']*')|(?<!\d)(\$?)([A-Z]{1,3})(\$?)(\d{1,7})(?!\()/g,(e,r,o,i,d,u)=>{if(void 0!==r)return r;let c=f$(i)-1,g=Number.parseInt(u,10)-1,p=n&&h?fY(h,c):0,m=t&&l?fY(l,g):0,f=f$(i)+a-p,b=Number.parseInt(u,10)+s-m;return`${o}${fG(f)}${d}${b}`})),u&&","!==u&&(e=function(e,t){let r="",n=!1,o="";for(let i=0;i<e.length;i++){let s=e[i];n?(r+=s,s===o&&(e[i+1]===o?(r+=e[i+1],i+=1):n=!1)):'"'===s||"'"===s?(n=!0,o=s,r+=s):e.startsWith(t,i)?(r+=",",i+=t.length-1):r+=s}return r}(e,u)),e)},numFmt:null}}if("intl-datetime"===t.type){let t=function(e){if(!e)return null;let t=String(e).match(/^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])(?:[T ]([01]\d|2[0-3]):([0-5]\d)(?::([0-5]\d)(?:\.\d{1,3})?)?)?$/);if(!t)return null;let r=parseInt(t[1],10),n=parseInt(t[2],10),o=parseInt(t[3],10),i=t[4]?parseInt(t[4],10):0,s=t[5]?parseInt(t[5],10):0,a=t[6]?parseInt(t[6],10):0,l=new Date(r,n-1,o);return Number.isNaN(l.getTime())?null:f2(l)+(3600*i+60*s+a)/86400}(e);if(null!==t)return{value:t,numFmt:"mm-dd-yy h:mm:ss"}}if("date"===t.type||"intl-date"===t.type){let t=function(e){if(!e)return null;let t=String(e).match(/^(\d{4})-(\d{2})-(\d{2})$/);if(!t)return null;let r=new Date(parseInt(t[1],10),parseInt(t[2],10)-1,parseInt(t[3],10));return Number.isNaN(r.getTime())?null:f2(r)}(e);if(null!==t)return{value:t,numFmt:"mm-dd-yy"}}if("time"===t.type||"intl-time"===t.type){let t=function(e){if(!e)return null;let t=String(e).trim(),r=t.match(/^(\d{1,2}):(\d{2})(?::(\d{2}))?$/);if(r){let e=parseInt(r[1],10),t=parseInt(r[2],10),n=r[3]?parseInt(r[3],10):0;return e>23||t>59||n>59?null:(3600*e+60*t+n)/86400}let n=t.match(/^(\d{1,2}):(\d{2})(?::(\d{2}))?\s*(AM|PM)$/i);if(n){let e=parseInt(n[1],10),t=parseInt(n[2],10),r=n[3]?parseInt(n[3],10):0,o=n[4].toUpperCase();return e>12||t>59||r>59?null:("AM"===o&&12===e?e=0:"PM"===o&&12!==e&&(e+=12),(3600*e+60*t+r)/86400)}return null}(e);if(null!==t)return{value:t,numFmt:"h:mm:ss"}}return"checkbox"===t.type?{value:this.#la(e,t),numFmt:null}:"multiselect"===t.type?{value:this.#ll(e),numFmt:null}:"numeric"===t.type?{value:this.#ls(e,t),numFmt:function(e,t){if(!e)return null;let{style:r,currency:n,minimumFractionDigits:o=0,maximumFractionDigits:i,useGrouping:s=!0}=e,a=i??o,l=a>0?`.${"0".repeat(a)}`:"",h=!1!==s?"#,##0":"0";if("percent"===r)return`${h}${l}%`;if("currency"===r&&n){let{symbol:e,isPrefix:r}=function(e,t){try{let r=new Intl.NumberFormat(t||"en",{style:"currency",currency:e,minimumFractionDigits:0,maximumFractionDigits:0}).formatToParts(0),n=r.find(e=>"currency"===e.type)?.value??e,o=r.findIndex(e=>"currency"===e.type),i=r.findIndex(e=>"integer"===e.type);return{symbol:n,isPrefix:o<i}}catch{return{symbol:e,isPrefix:!0}}}(n,t);return r?`${e}${h}${l}`:`${h}${l}${e}`}return`${h}${l}`}(t.numericFormat,t.locale)}:{value:this.#ls(e,t),numFmt:null}}#ls(e,t){if(null==e)return null;if("numeric"===t.type){if("number"==typeof e)return e;let t=Number(e);return Number.isNaN(t)?eH(e):t}return eH(e)}#la(e,t){return e===(t.checkedTemplate??!0)}#ll(e){return Array.isArray(e)?0===e.length?null:e.map(e=>null!==e&&"object"==typeof e?String(e.value):String(e)).join(", "):null==e?null:eH(e)}#a5(e){return e?.backgroundColor?{type:"pattern",pattern:"solid",fgColor:{argb:fZ(e.backgroundColor)}}:null}#a4(e){if(!e?.border)return null;let{style:t="thin",color:r}=e.border,n=r?{style:t,color:{argb:fZ(r)}}:{style:t};return{top:n,bottom:n,left:n,right:n}}#a0(){let{compression:e}=this.options,t=null;return(!0===e?t=6:"number"==typeof e&&e>=1&&e<=9&&(t=e),null===t)?{}:{zip:{compression:"DEFLATE",compressionOptions:{level:t}}}}#lr(e,t,r,n,o,i){0!==o&&0!==i&&t.forEach(t=>{let{rows:s,cols:a,rules:l}=t;if(!l||0===l.length)return;let h=(s?s[0]:0)+r,d=(s?s[1]:o-1)+r,u=(a?a[0]:0)+n,c=(a?a[1]:i-1)+n;e.addConditionalFormatting({ref:this.#lh(h,u,d,c),rules:l})})}#lh(e,t,r,n){return`${fG(t)}${e}:${fG(n)}${r}`}#a2(e,t,r){r&&(e.getColumn(1).width=5);let n=+!!r;for(let r=0;r<t.length;r++)e.getColumn(r+1+n).width=Math.max(t[r]/7,1)}#a3(e,t,r){let n=+!!r;t.forEach(t=>{e.getColumn(t+1+n).hidden=!0})}#lt(e,t,r){t.forEach(t=>{e.getRow(t+r).hidden=!0})}#a6(e,t,r,n,o,i){let s=t>0||r>0;if(!s&&!i)return;let a={};i&&(a.rightToLeft=!0),s&&(a.state="frozen",a.xSplit=r+ +!!o,a.ySplit=t+n),e.views=[a]}#a8(e,t,r,n,o,i,s){let a=e.getRow(1);if(n){let e=a.getCell(1);e.value="",i&&(e.fill=i),s&&(e.border=s)}for(let e=0;e<t.length;e++){let n=a.getCell(e+o);n.value=t[e]??null;let l=fJ(r[e]);l&&(n.alignment=l),i&&(n.fill=i),s&&(n.border=s)}a.commit()}#a9(e,t,r,n,o,i){for(let s=0;s<t.length;s++){let a=t[s],l=e.getRow(s+1);if(r&&0===s){let e=l.getCell(1);e.value="",o&&(e.fill=o),i&&(e.border=i)}let h=n;a.forEach(e=>{let t=l.getCell(h);t.value=e.label??null;let r=fJ(e.className);r&&(t.alignment=r),o&&(t.fill=o),i&&(t.border=i),h+=e.colspan}),l.commit()}}#a7(e,t,r,n){r&&t.length>1&&e.mergeCells(1,1,t.length,1);for(let r=0;r<t.length;r++){let o=t[r],i=r+1,s=n;o.forEach(t=>{t.colspan>1&&e.mergeCells(i,s,i,s+t.colspan-1),s+=t.colspan})}}#a1(e,t){let r=new Map;for(let e=0;e<t.length;e++)for(let n=0;n<t[e].length;n++){let o=t[e][n];if(("dropdown"===o.type||"autocomplete"===o.type)&&Array.isArray(o.source)&&o.source.length>0){let e=JSON.stringify(o.source);r.has(e)||r.set(e,o.source)}}if(0===r.size)return new Map;let n=new Set(e.worksheets.map(e=>e.name)),o="_HotValidation",i=1;for(;n.has(o);)o=`_HotValidation${i}`,i+=1;let s=e.addWorksheet(o);s.state="veryHidden";let a=new Map,l=1;return r.forEach((e,t)=>{for(let t=0;t<e.length;t++){let r=e[t];s.getCell(t+1,l).value=tv(r)?String(r.value):String(r)}let r=fG(l),n=o.replaceAll("'","''"),i=`'${n}'!$${r}$1:$${r}$${e.length}`;a.set(t,i),l+=1}),a}}};function f6(e){let t=e.getSettings(),r=!!(t.colHeaders||t.nestedHeaders),n=!!t.rowHeaders,o=e.getSelectedRangeLast(),i={colHeaders:r,rowHeaders:n};return!o||o.isSingleCell()||(o.from.row??0)<0&&(o.from.col??0)<0?i:{...i,range:[Math.max(0,Math.min(o.from.row??0,o.to.row??0)),Math.max(0,Math.min(o.from.col??0,o.to.col??0)),Math.max(o.from.row??0,o.to.row??0),Math.max(o.from.col??0,o.to.col??0)]}}let f5="exportFile";function f4(e){return tc(e)?e:void 0}class f9{id;elements=[];hidden=!1;stateId="";state;constructor(e,{id:t,stateless:r=!0}){this.hot=e,this.id=t,this.stateId=`Filters.component.${this.id}`,this.state=r?null:this.hot.columnIndexMapper.createAndRegisterIndexMap(this.stateId,"linkedPhysicalIndexToValue")}getElements(){return this.elements}reset(){J(this.elements,e=>e.reset())}hide(){this.hidden=!0}show(){this.hidden=!1}isHidden(){return null===this.hot||this.hidden}restoreState(e){this.state&&this.setState(this.state.getValueAtIndex(e))}setState(e){tr("The state setting logic is not implemented")}saveState(e){this.state&&this.state.setValueAtIndex(e,this.getState())}getState(){return tr("The state gathering logic is not implemented"),{}}getMenuItemDescriptor(){return tr("The menu item descriptor logic is not implemented"),{}}destroy(){this.hot?.columnIndexMapper.unregisterMap(this.stateId),this.clearLocalHooks(),J(this.elements,e=>e.destroy()),this.state=null,this.elements.length=0,this.hot=null}}th(f9,ab);let f7={};function f8(e,t){f7[e]||tr(`Filter condition "${e}" does not exist.`);let{condition:r,descriptor:n}=f7[e],o=t;return n.inputValuesDecorator&&(o=(0,n.inputValuesDecorator)(o)),function(e){return r.apply(e.meta.instance,[e,o])}}function be(e){return f7[e]||tr(`Filter condition "${e}" does not exist.`),f7[e].descriptor}function bt(e,t,r){r.key=e,f7[e]={condition:t,descriptor:r}}let br="none";bt(br,function(){return!0},{name:lO,inputsCount:0,showOperators:!1});let bn="empty";bt(bn,function(e){return eP(e.value)},{name:lk,inputsCount:0,showOperators:!0});let bo="not_empty";bt(bo,function(e,t){return!f8(bn,t)(e)},{name:lH,inputsCount:0,showOperators:!0}),bt("eq",function(e,t){let[r]=t;return!0===e.meta.preserveNumericLiteral&&"numeric"===e.meta.type&&oS(e.value)&&oS(r)?Number(e.value)===Number(r):ow(eH(e.value),e.meta.locale)===eH(r)},{name:l_,inputsCount:1,showOperators:!0}),bt("neq",function(e,t){return!f8("eq",t)(e)},{name:lL,inputsCount:1,showOperators:!0}),bt("gt",function(e,t){let[r]=t,n=r;return"numeric"===e.meta.type&&(n=parseFloat(n)),e.value>n},{name:lU,inputsCount:1,showOperators:!0}),bt("gte",function(e,t){let[r]=t,n=r;return"numeric"===e.meta.type&&(n=parseFloat(n)),e.value>=n},{name:lz,inputsCount:1,showOperators:!0}),bt("lt",function(e,t){let[r]=t,n=r;return"numeric"===e.meta.type&&(n=parseFloat(n)),e.value<n},{name:lW,inputsCount:1,showOperators:!0}),bt("lte",function(e,t){let[r]=t,n=r;return"numeric"===e.meta.type&&(n=Number.parseFloat(n)),e.value<=n},{name:lG,inputsCount:1,showOperators:!0});let bi="between";bt(bi,function(e,t){let[r,n]=t,o=r,i=n;if("numeric"===e.meta.type){let e=parseFloat(o),t=parseFloat(i);o=Math.min(e,t),i=Math.max(e,t)}else if("date"===e.meta.type){let t=cR(e.value),r=cR(o),n=cR(i);return null!==t&&null!==r&&null!==n&&t.getTime()>=r.getTime()&&t.getTime()<=n.getTime()}return e.value>=o&&e.value<=i},{name:l$,inputsCount:2,showOperators:!0});let bs="not_between";bt(bs,function(e,t){return!f8(bi,t)(e)},{name:lY,inputsCount:2,showOperators:!0});let ba="begins_with";bt(ba,function(e,t){let[r]=t;return ow(eH(e.value),e.meta.locale).startsWith(eH(r))},{name:lP,inputsCount:1,showOperators:!0});let bl="ends_with";bt(bl,function(e,t){let[r]=t;return ow(eH(e.value),e.meta.locale).endsWith(eH(r))},{name:lD,inputsCount:1,showOperators:!0});let bh="contains";bt(bh,function(e,t){let[r]=t;return ow(eH(e.value),e.meta.locale).indexOf(eH(r))>=0},{name:lF,inputsCount:1,showOperators:!0});let bd="not_contains";bt(bd,function(e,t){return!f8(bh,t)(e)},{name:lB,inputsCount:1,showOperators:!0});let bu="date_before";bt(bu,function(e,t){let[r]=t,n=cR(e.value),o=cR(r);return null!==n&&null!==o&&n.getTime()<o.getTime()},{name:lK,inputsCount:1,showOperators:!0,inputType:"date"});let bc="date_before_or_equal";bt(bc,function(e,t){let[r]=t,n=cR(e.value),o=cR(r);return null!==n&&null!==o&&n.getTime()<=o.getTime()},{name:lX,inputsCount:1,showOperators:!0,inputType:"date"});let bg="date_after";bt(bg,function(e,t){let[r]=t,n=cR(e.value),o=cR(r);return null!==n&&null!==o&&n.getTime()>o.getTime()},{name:lj,inputsCount:1,showOperators:!0,inputType:"date"});let bp="date_after_or_equal";bt(bp,function(e,t){let[r]=t,n=cR(e.value),o=cR(r);return null!==n&&null!==o&&n.getTime()>=o.getTime()},{name:lq,inputsCount:1,showOperators:!0,inputType:"date"});let bm="date_tomorrow";bt(bm,function(e){let t=cR(e.value);return null!==t&&cL(t,c_(1))},{name:lZ,inputsCount:0});let bf="date_today";bt(bf,function(e){let t=cR(e.value);return null!==t&&cL(t,cH())},{name:lQ,inputsCount:0});let bb="date_yesterday";bt(bb,function(e){let t=cR(e.value);return null!==t&&cL(t,c_(-1))},{name:lJ,inputsCount:0});let bC="intl_date_before";bt(bC,function(e,t){let[r]=t,n=cR(e.value),o=cR(r);return null!==n&&null!==o&&n<o},{name:lK,inputsCount:1,showOperators:!0,inputType:"date"});let by="intl_date_before_or_equal";bt(by,function(e,t){let[r]=t,n=cR(e.value),o=cR(r);return null!==n&&null!==o&&n<=o},{name:lX,inputsCount:1,showOperators:!0,inputType:"date"});let bw="intl_date_after";bt(bw,function(e,t){let[r]=t,n=cR(e.value),o=cR(r);return null!==n&&null!==o&&n>o},{name:lj,inputsCount:1,showOperators:!0,inputType:"date"});let bS="intl_date_after_or_equal";bt(bS,function(e,t){let[r]=t,n=cR(e.value),o=cR(r);return null!==n&&null!==o&&n>=o},{name:lq,inputsCount:1,showOperators:!0,inputType:"date"});let bv="intl_date_between";bt(bv,function(e,t){let[r,n]=t,o=cR(e.value),i=cR(r),s=cR(n);return null!==o&&null!==i&&null!==s&&o>=i&&o<=s},{name:l$,inputsCount:2,showOperators:!0,inputType:"date"});let bR="intl_date_tomorrow";bt(bR,function(e){let t=cR(e.value);if(null===t)return!1;let r=new Date;return r.setDate(r.getDate()+1),t.getFullYear()===r.getFullYear()&&t.getMonth()===r.getMonth()&&t.getDate()===r.getDate()},{name:lZ,inputsCount:0,inputType:"date"});let bE="intl_date_today";bt(bE,function(e){let t=cR(e.value);if(null===t)return!1;let r=new Date;return t.getFullYear()===r.getFullYear()&&t.getMonth()===r.getMonth()&&t.getDate()===r.getDate()},{name:lQ,inputsCount:0,inputType:"date"});let bT="intl_date_yesterday";bt(bT,function(e){let t=cR(e.value);if(null===t)return!1;let r=new Date;return r.setDate(r.getDate()-1),t.getFullYear()===r.getFullYear()&&t.getMonth()===r.getMonth()&&t.getDate()===r.getDate()},{name:lJ,inputsCount:0,inputType:"date"});let bA="intl_time_before";bt(bA,function(e,t){let[r]=t,n=cI(e.value),o=cI(r);return null!==n&&null!==o&&n<o},{name:lK,inputsCount:1,showOperators:!0,inputType:"time"});let bM="intl_time_before_or_equal";bt(bM,function(e,t){let[r]=t,n=cI(e.value),o=cI(r);return null!==n&&null!==o&&n<=o},{name:lX,inputsCount:1,showOperators:!0,inputType:"time"});let bI="intl_time_after";bt(bI,function(e,t){let[r]=t,n=cI(e.value),o=cI(r);return null!==n&&null!==o&&n>o},{name:lj,inputsCount:1,showOperators:!0,inputType:"time"});let bx="intl_time_after_or_equal";bt(bx,function(e,t){let[r]=t,n=cI(e.value),o=cI(r);return null!==n&&null!==o&&n>=o},{name:lq,inputsCount:1,showOperators:!0,inputType:"time"});let bN="intl_time_between";bt(bN,function(e,t){let[r,n]=t,o=cI(e.value),i=cI(r),s=cI(n);return null!==o&&null!==i&&null!==s&&o>=i&&o<=s},{name:l$,inputsCount:2,showOperators:!0,inputType:"time"});let bO="intl_datetime_before";bt(bO,function(e,t){let[r]=t,n=cO(e.value),o=cO(r);return null!==n&&null!==o&&n<o},{name:lK,inputsCount:1,showOperators:!0,inputType:"datetime-local"});let bk="intl_datetime_before_or_equal";bt(bk,function(e,t){let[r]=t,n=cO(e.value),o=cO(r);return null!==n&&null!==o&&n<=o},{name:lX,inputsCount:1,showOperators:!0,inputType:"datetime-local"});let bH="intl_datetime_after";bt(bH,function(e,t){let[r]=t,n=cO(e.value),o=cO(r);return null!==n&&null!==o&&n>o},{name:lj,inputsCount:1,showOperators:!0,inputType:"datetime-local"});let b_="intl_datetime_after_or_equal";bt(b_,function(e,t){let[r]=t,n=cO(e.value),o=cO(r);return null!==n&&null!==o&&n>=o},{name:lq,inputsCount:1,showOperators:!0,inputType:"datetime-local"});let bL="intl_datetime_between";bt(bL,function(e,t){let[r,n]=t,o=cO(e.value),i=cO(r),s=cO(n);return null!==o&&null!==i&&null!==s&&o>=i&&o<=s},{name:l$,inputsCount:2,showOperators:!0,inputType:"datetime-local"});let bP="intl_datetime_tomorrow";bt(bP,function(e){let t=cO(e.value);if(null===t)return!1;let r=new Date;return r.setDate(r.getDate()+1),t.getFullYear()===r.getFullYear()&&t.getMonth()===r.getMonth()&&t.getDate()===r.getDate()},{name:lZ,inputsCount:0,inputType:"datetime-local"});let bD="intl_datetime_today";bt(bD,function(e){let t=cO(e.value);if(null===t)return!1;let r=new Date;return t.getFullYear()===r.getFullYear()&&t.getMonth()===r.getMonth()&&t.getDate()===r.getDate()},{name:lQ,inputsCount:0,inputType:"datetime-local"});let bF="intl_datetime_yesterday";bt(bF,function(e){let t=cO(e.value);if(null===t)return!1;let r=new Date;return r.setDate(r.getDate()-1),t.getFullYear()===r.getFullYear()&&t.getMonth()===r.getMonth()&&t.getDate()===r.getDate()},{name:lJ,inputsCount:0,inputType:"datetime-local"});let bB="text",bV={numeric:[br,ms,bn,bo,ms,"eq","neq",ms,"gt","gte","lt","lte",bi,bs],[bB]:[br,ms,bn,bo,ms,"eq","neq",ms,ba,bl,ms,bh,bd],date:[br,ms,bn,bo,ms,"eq","neq",ms,bu,bc,bg,bp,bi,ms,bm,bf,bb],"intl-date":[br,ms,bn,bo,ms,"eq","neq",ms,bC,by,bw,bS,bv,ms,bR,bE,bT],"intl-time":[br,ms,bn,bo,ms,"eq","neq",ms,ba,bl,ms,bh,bd,ms,bA,bM,bI,bx,bN],"intl-datetime":[br,ms,bn,bo,ms,"eq","neq",ms,bO,bk,bH,b_,bL,ms,bP,bD,bF]},bU="built",bz="building",bW=["click","input","keydown","keypress","keyup","focus","blur","change"];class bG{static get DEFAULTS(){return tl({className:"",value:"",tagName:"div",children:[],wrapIt:!0})}eventManager=new n5(this);constructor(e,t){this.hot=e,this.options=ti(bG.DEFAULTS,t),this._element=e.rootDocument.createElement(this.options.wrapIt?"div":this.options.tagName??"div")}setValue(e){this.options.value=e,this.update()}getValue(){return this.options.value}get element(){return this.buildState===bz||(this.buildState===bU?this.update():(this.buildState=bz,this.build(),this.buildState=bU)),this._element}isBuilt(){return this.buildState===bU}translateIfPossible(e){return"string"==typeof e&&e.startsWith(lx)?this.hot?.getTranslatedPhrase(e)??e:e}build(){if(!this._element||!this.hot)return;let e=this._element,{eventManager:t}=this,r=(e,r)=>{t?.addEventListener(e,r,e=>this.runLocalHooks(r,e,this))};if(this.buildState||(this.buildState=bz),e.dataset.hotInput="true",void 0!==this.options.tabIndex&&e.setAttribute("tabindex",String(this.options.tabIndex)),void 0!==this.options.role&&e.setAttribute("role",this.options.role),this.options.className&&rd(e,this.options.className),this.options.children?.length)J(this.options.children,t=>{let r=t.element;r&&e.appendChild(r)});else if(this.options.wrapIt){let t=this.hot.rootDocument.createElement(this.options.tagName??"div");t.dataset.hotInput="true",tp(this.options,(e,r)=>{void 0!==t[r]&&"className"!==r&&"tagName"!==r&&"children"!==r&&(t[r]=this.translateIfPossible(e))}),e.appendChild(t),J(bW,e=>r(t,e))}else J(bW,t=>r(e,t))}update(){}reset(){this.options.value="",this.update()}show(){let e=this.element;e&&(e.style.display="")}hide(){let e=this.element;e&&(e.style.display="none")}focus(){}destroy(){this.eventManager?.destroy(),this.eventManager=null,this.hot=null,this._element?.parentNode&&this._element.parentNode.removeChild(this._element),this._element=null}}th(bG,ab);class b$ extends bG{static get DEFAULTS(){return tl({placeholder:"",type:"text",tagName:"input",tabIndex:-1})}#ld=null;constructor(e,t){super(e,ti(b$.DEFAULTS,t)),this.registerHooks()}registerHooks(){this.addLocalHook("keyup",e=>this.#lu(e)),this.addLocalHook("input",e=>this.#lu(e)),this.addLocalHook("change",e=>this.#lu(e))}build(){if(super.build(),!this._element||!this.hot)return;let e=this.hot.rootDocument.createElement("div");this.#ld=this._element.firstChild,rd(this._element,"htUIInput"),rd(e,"htUIInputIcon"),this._element.appendChild(e),this.update()}update(){this.isBuilt()&&this.#ld&&(this.#ld.type=String(this.options.type??"text"),this.#ld.placeholder=String(this.translateIfPossible(this.options.placeholder)??""),this.#ld.value=String(this.translateIfPossible(this.options.value)??""))}setType(e){this.options.type=e,this.isBuilt()&&this.update()}focus(){this.isBuilt()&&this.#ld?.focus()}#lu(e){this.options.value=t4(e).value}}class bY extends bG{static get DEFAULTS(){return tl({className:"htUISelect",wrapIt:!1,tabIndex:-1})}#lc=null;#lg=[];#lp=null;#lm=null;#lf=null;constructor(e,t){super(e,ti(bY.DEFAULTS,t)),this.registerHooks()}getMenu(){return this.#lc}registerHooks(){this.addLocalHook("click",()=>this.#lb())}setItems(e){this.#lg=this.translateNames(e),this.#lc&&this.#lc.setMenuItems(this.#lg)}translateNames(e){return J(e,e=>{e.name=this.translateIfPossible(e.name)}),e}build(){if(super.build(),!this.hot||!this._element)return;let e=this.hot,t=this._element;this.#lc=new mG(e,{className:"htSelectUI htFiltersConditionsMenu",keepInViewport:!1,standalone:!0,container:this.options.menuContainer}),this.#lc.setMenuItems(this.#lg);let r=new bG(e,{className:"htUISelectCaption"}),n=new bG(e,{className:"htUISelectDropdown"});if(this.#lp=r,this.#lm=r.element,this.#lf=n,e.getSettings().ariaTags){let e=n.element;e&&rc(e,[_()]),rc(t,[N()])}J([r,n],e=>{let r=e.element;r&&t.appendChild(r)}),this.#lc.addLocalHook("select",e=>this.#lC(e)),this.#lc.addLocalHook("afterClose",()=>this.#ly()),this.update()}update(){let e;this.isBuilt()&&(e=this.options.value?this.options.value.name:this.#lc?.hot?.getTranslatedPhrase(lO),this.#lm&&(this.#lm.textContent=e??null),super.update())}openOptions(){let e=this.element;if(!e)return;let t=e.getBoundingClientRect();this.#lc&&(this.#lc.open(),this.#lc.setPosition({left:this.hot?.isLtr()?t.left-5:t.left-31,top:t.top-1,width:t.width,height:t.height},()=>e.isConnected?e.getBoundingClientRect():null),this.#lc?.getNavigator()?.toFirstItem(),this.#lc?.getKeyboardShortcutsCtrl()?.addCustomShortcuts([{keys:[["Tab"],["Shift","Tab"]],callback:e=>{this.closeOptions(),this.runLocalHooks("tabKeydown",e)}},{keys:[["Control/Meta","A"]],callback:()=>!1}]))}closeOptions(){this.#lc&&this.#lc.close()}focus(){this.isBuilt()&&this.element?.focus()}#lC(e){e.name!==ms&&(this.options.value=e,this.update(),this.runLocalHooks("select",this.options.value))}#ly(){this.runLocalHooks("afterClose")}#lb(){this.openOptions()}destroy(){this.#lc&&(this.#lc.destroy(),this.#lc=null),this.#lp&&this.#lp.destroy(),this.#lf&&this.#lf.destroy(),super.destroy()}}class bj extends f9{name="";addSeparator=!1;constructor(e,t){super(e,{id:t.id,stateless:!1}),this.name=t.name,this.addSeparator=t.addSeparator,this.elements.push(new bY(e,{menuContainer:t.menuContainer})),this.elements.push(new b$(e,{placeholder:he})),this.elements.push(new b$(e,{placeholder:ht})),this.registerHooks()}registerHooks(){this.getSelectElement().addLocalHook("select",e=>this.#lw(e)).addLocalHook("afterClose",()=>this.runLocalHooks("afterClose")).addLocalHook("tabKeydown",e=>this.runLocalHooks("selectTabKeydown",e)),J(this.getInputElements(),e=>{e.addLocalHook("keydown",e=>this.#lS(e))})}setState(e){if(this.reset(),!e)return;let t=tl(e.command);"string"==typeof t.name&&t.name.startsWith(lN)&&(t.name=this.hot?.getTranslatedPhrase(t.name)??t.name),this.getSelectElement().setValue(t),J(e.args,(e,r)=>{if(r>(t.inputsCount??0)-1)return!1;let n=this.getInputElement(r);n.setType(t.inputType??"text"),n.setValue(e),n[(t.inputsCount??0)>r?"show":"hide"](),r||this.hot?._registerTimeout(()=>n.focus(),10)})}getState(){let e=this.getSelectElement().getValue()||be(br),t=[];return J(this.getInputElements(),(r,n)=>{(e.inputsCount??0)>n&&t.push(r.getValue())}),{command:e,args:t}}updateState(e,t){let r=e?be(e.name):be(br);this.state?.setValueAtIndex(t,{command:r,args:e?e.args:[]}),e||J(this.getInputElements(),e=>e.setValue(null))}getSelectElement(){return this.elements.find(e=>e instanceof bY)}getInputElement(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.getInputElements()[e]}getInputElements(){return this.elements.filter(e=>e instanceof b$)}getMenuItemDescriptor(){return{key:this.id,name:this.name,isCommand:!1,disableSelection:!0,hidden:()=>this.isHidden(),renderer:(e,t,r,n,o,i)=>{ne(t.parentNode)&&(rd(t.parentNode,"htFiltersMenuCondition"),this.addSeparator&&rd(t.parentNode,"border"));let s=this.hot?.rootDocument.createElement("div")??t.ownerDocument.createElement("div");return rd(s,"htFiltersMenuLabel"),s.textContent=i,t.appendChild(s),t.parentElement?.hasAttribute("ghost-table")||J(this.elements,e=>{let r=e.element;r&&t.appendChild(r)}),t}}}reset(){let e=this.hot?.getPlugin("filters").getSelectedColumn()??null,t=[be(br)];if(null!==e){var r;let n,o,{visualIndex:i}=e;r=this.hot?.getDataType(0,i,this.hot.countRows(),i)??"text",n=[],bV[o=r]||(o=bB),J(bV[o],e=>{let t;t=e===ms?{name:ms}:{...be(e)},n.push(t)}),t=n}J(this.getInputElements(),e=>e.hide()),this.getSelectElement().setItems(t),super.reset(),this.getSelectElement().setValue(t[0])}#lw(e){J(this.getInputElements(),(t,r)=>{t.setType(e.inputType??"text"),t[(e.inputsCount??0)>r?"show":"hide"](),0===r&&this.hot?._registerTimeout(()=>t.focus(),10)}),this.runLocalHooks("change",e)}#lS(e){nv(e.keyCode,"ESCAPE")&&(this.runLocalHooks("cancel"),nR(e))}}let bq={};function bK(e,t,r){bq[e]={name:t,func:r}}let bX="conjunction";bK(bX,l2,function(e,t){return e.every(e=>e.func(t))});let bQ="disjunction";bK(bQ,l3,function(e,t){return e.some(e=>e.func(t))});let bZ="disjunctionWithExtraCondition";bK(bZ,l3,function(e,t){e.length<3&&tr("Operation doesn't work on less then three conditions.");let r=e[e.length-1];return e.slice(0,e.length-1).some(e=>!!e.func(t))&&!!r.func(t)});class bJ extends bG{static get DEFAULTS(){return tl({type:"radio",tagName:"input",className:"htUIRadio",label:{}})}#ld=null;#lv=null;constructor(e,t){super(e,ti(bJ.DEFAULTS,t))}build(){if(super.build(),!this.hot||!this._element)return;let e=this.hot.rootDocument.createElement("label"),t=this.options.label;e.textContent=String(this.translateIfPossible(t.textContent)??""),e.htmlFor=String(this.translateIfPossible(t.htmlFor)??""),this.#lv=e,this.#ld=this._element.firstChild,this.#ld.checked=this.options.checked,this._element.appendChild(e),this.update()}update(){if(!this.isBuilt())return;let e=this.options.label;this.#lv&&(this.#lv.textContent=String(this.translateIfPossible(e.textContent)??""))}isChecked(){return!!this.isBuilt()&&!!this.#ld&&this.#ld.checked}setChecked(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];this.isBuilt()&&this.#ld&&(this.#ld.checked=e)}focus(){this.isBuilt()&&this.#ld?.focus()}}class b0 extends f9{name="";constructor(e,t){super(e,{id:t.id,stateless:!1}),this.name=t.name,this.buildOperatorsElement(e)}getMenuItemDescriptor(){return{key:this.id,name:this.name,isCommand:!1,disableSelection:!0,hidden:()=>this.isHidden(),renderer:(e,t)=>(ne(t.parentNode)&&rd(t.parentNode,"htFiltersMenuOperators"),J(this.elements,e=>{let r=e.element;r&&t.appendChild(r)}),t)}}buildOperatorsElement(e){let t=[bX,bQ];J(t,r=>{let n=new bJ(e,{name:"operator",label:{htmlFor:r,textContent:bq[r].name},value:r,checked:r===t[0],id:r});n.addLocalHook("change",e=>this.#lR(e)),this.elements.push(n)})}setChecked(e){this.elements.length<e&&tr(ec`Radio button with index ${e} doesn't exist.`),J(this.elements,(t,r)=>{t.setChecked(r===e)})}getActiveOperationId(){let e=this.elements.find(e=>e instanceof bJ&&e.isChecked());return e?String(e.getValue()??bX):bX}getState(){return this.getActiveOperationId()}setState(e){this.reset(),e&&this.getActiveOperationId()!==e&&J(this.elements,t=>{t.setChecked(t.getValue()===e)})}updateState(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:bX,t=arguments.length>1?arguments[1]:void 0,r=e;r===bZ&&(r=bQ),this.state?.setValueAtIndex(t,r)}reset(){this.setChecked(0)}#lR(e){this.setState(t4(e).value)}}function b1(e){let t=new Set(e);return function(e){return t.has(e)}}function b2(e){return null==e?"":e}function b3(e,t){return Array.from(new Set(e)).map(e=>b2(e)).sort(t??((e,t)=>"number"==typeof e&&"number"==typeof t?e-t:e===t?0:e>t?1:-1))}function b6(e,t,r,n){let o,i=[],s=e===t;return s||(o=b1(t)),e.forEach(e=>{let t,a=!1;(s||o(e))&&(a=!0);let l={checked:a,value:e,visualValue:(""===(t=e)&&(t=`(${r})`),t)};n&&n(l),i.push(l)}),i}function b5(e){if(null!==e&&"object"==typeof e&&"type"in e){if("date"===e.type||"intl-date"===e.type)return(e,t)=>{if(""===e&&""===t)return 0;if(""===e)return -1;if(""===t)return 1;let r=cR(e),n=cR(t);return null===r&&null===n?0:null===r?1:null===n?-1:r-n};if("intl-datetime"===e.type)return(e,t)=>{if(""===e&&""===t)return 0;if(""===e)return -1;if(""===t)return 1;let r=cO(e),n=cO(t);return null===r&&null===n?0:null===r?1:null===n?-1:r-n}}}tx();class b4 extends bG{static get DEFAULTS(){return tl({href:"#",tagName:"a",tabIndex:-1,role:"button"})}#lE=null;constructor(e,t){super(e,ti(b4.DEFAULTS,t))}build(){super.build(),this._element&&(this.#lE=this._element.firstChild)}update(){if(!this.isBuilt())return;let e=this.options.textContent;this.#lE&&(this.#lE.textContent=String(this.translateIfPossible(e)))}focus(){this.isBuilt()&&this.#lE&&this.#lE.focus()}activate(){this.#lE?.click()}}let b9="multipleSelect.itemBox";class b7 extends bG{static get DEFAULTS(){return tl({className:"htUIMultipleSelect",value:[]})}#lg=[];#lT=null;#lA=null;#lM="";#lI=null;#lx=null;#lN=null;constructor(e,t){super(e,ti(b7.DEFAULTS,t)),this.#lI=new b$(e,{placeholder:l8,className:"htUIMultipleSelectSearch"}),this.#lx=new b4(e,{textContent:l5,className:"htUISelectAll"}),this.#lN=new b4(e,{textContent:l4,className:"htUIClearAll"}),this.registerHooks()}getItemsBox(){return this.#lT}registerHooks(){this.#lI?.addLocalHook("keydown",e=>this.#lS(e)),this.#lI?.addLocalHook("input",e=>this.#nK(e)),this.#lx?.addLocalHook("click",e=>this.#lO(e)),this.#lN?.addLocalHook("click",e=>this.#lk(e))}setItems(e){this.#lg=e,this.#lA=null,this.#lT?.loadData(this.#lg)}setLocale(e){this.#lM!==e&&(this.#lA=null),this.#lM=e}#lH(){return null===this.#lA&&(this.#lA=this.#lg.map(e=>ow(`${e.value}`,this.getLocale()))),this.#lA}getLocale(){return this.#lM}getItems(){return[...this.#lg]}getValue(){var e;let t;return e=this.#lg,t=[],e.forEach(e=>{e.checked&&t.push(e.value)}),t}getSearchInputElement(){return this.#lI}getSelectAllElement(){return this.#lx}getClearAllElement(){return this.#lN}isSelectedAllValues(){return this.#lg.length===this.getValue().length}build(){if(super.build(),!this.hot||!this._element)return;let e=this.hot,t=this._element,{rootDocument:r}=e,n=r.createElement("div"),o=new bG(e,{className:"htUISelectionControls",children:[this.#lx,this.#lN].filter(e=>null!==e)}),i=this.#lI?.element,s=o.element;i&&t.appendChild(i),s&&t.appendChild(s),t.appendChild(n),this.#lT?.destroy(),rd(n,"htUIMultipleSelectHot"),this.#lT=new e.constructor(n,{data:[[]],columns:[{data:"checked",type:"checkbox",label:{property:"visualValue",position:"after"}}],beforeRenderer:(e,t,r,n,o,i)=>{e.title=i.instance.getDataAtRowProp(t,i.label.property)},afterListen:()=>{this.runLocalHooks("focus",this)},beforeOnCellMouseUp:()=>{this.#lT?.listen()},modifyColWidth:e=>{let t=(this.#lT?.container.scrollWidth??0)-rX(r);return void 0!==e&&e<t?t:e},autoColumnSize:!0,autoRowSize:!1,hiddenRows:!0,maxCols:1,autoWrapCol:!0,height:110,copyPaste:!1,disableVisualSelection:"area",fillHandle:!1,fragmentSelection:"cell",tabMoves:{row:1,col:0},themeName:e.getCurrentThemeName(),layoutDirection:e.isRtl()?"rtl":"ltr"}),this.#lT.init();let a=this.#lT.getShortcutManager().getContext("grid");a&&(a.removeShortcutsByKeys(["Tab"]),a.removeShortcutsByKeys(["Shift","Tab"]),a.addShortcut({keys:[["Escape"]],callback:e=>{this.runLocalHooks("keydown",e,this)},group:b9}),a.addShortcut({keys:[["Tab"],["Shift","Tab"]],callback:e=>{this.#lT?.deselectCell(),this.runLocalHooks("keydown",e,this),this.runLocalHooks("listTabKeydown",e,this)},group:b9}))}focus(){this.isBuilt()&&this.#lT?.listen()}reset(){this.#lI?.reset(),this.#lx?.reset(),this.#lN?.reset()}update(){var e;let t;this.isBuilt()&&this.#lT&&0!==this.#lT.rootElement.offsetHeight&&(this.#lT.updateSettings({data:(e=this.#lg,t=b1(this.options.value),e.map(e=>(e.checked=t(e.value),e)))}),super.update())}destroy(){this.#lT?.destroy(),this.#lI?.destroy(),this.#lN?.destroy(),this.#lx?.destroy(),this.#lI=null,this.#lN=null,this.#lx=null,this.#lT=null,this.#lg.length=0,this.#lA=null,super.destroy()}#nK(e){let t=ow(t4(e).value.trim(),this.getLocale()),r=this.#lH();if("apply"===this.options.searchMode){let e=this.#lT?.getPlugin("hiddenRows"),n=[];e&&e.showRows(e.getHiddenRows()),this.#lg.forEach((e,o)=>{e.checked=r[o].indexOf(t)>=0,e.checked||n.push(o)}),e&&e.hideRows(n),this.#lT?.view.adjustElementsSize(),this.#lT?.render()}else{let e;e=""===t?[...this.#lg]:this.#lg.filter((e,n)=>r[n].indexOf(t)>=0),this.#lT?.loadData(e)}}#lS(e){this.runLocalHooks("keydown",e,this),nv(e.keyCode,"ARROW_DOWN")&&(e.preventDefault(),nR(e),this.#lT?.listen(),this.#lT?.selectCell(0,0))}#lO(e){let t=[];e.preventDefault(),this.#lT&&(this.#lT.getSourceData().forEach((e,r)=>{e.checked=!0,t.push(au(e,r)[0])}),this.#lT.setSourceDataAtCell(t))}#lk(e){let t=[];e.preventDefault(),this.#lT&&(this.#lT.getSourceData().forEach((e,r)=>{e.checked=!1,t.push(au(e,r)[0])}),this.#lT.setSourceDataAtCell(t))}}let b8="by_value";bt(b8,function(e,t){let[r]=t;return r(e.value)},{name:"By value",inputsCount:0,inputValuesDecorator(e){let[t]=e;return[b1(t)]},showOperators:!1});class Ce extends f9{name="";searchMode;hiddenWhen;constructor(e,t){super(e,{id:t.id,stateless:!1}),this.name=t.name,this.searchMode=t.searchMode,this.hiddenWhen=t.hiddenWhen,this.elements.push(new b7(e,{searchMode:this.searchMode})),this.registerHooks()}registerHooks(){this.getMultipleSelectElement().addLocalHook("keydown",e=>this.#lS(e)).addLocalHook("listTabKeydown",e=>this.runLocalHooks("listTabKeydown",e)),this.hot?.addHook("modifyFiltersMultiSelectValue",(e,t)=>this.#l_(e,t))}getElements(){let e=this.getMultipleSelectElement();return[e.getSearchInputElement(),e.getSelectAllElement(),e.getClearAllElement(),this.getMultipleSelectElement()]}setState(e){if(e&&e.command.key===b8){super.reset();let t=this.getMultipleSelectElement();t.setItems(e.itemsSnapshot),t.setValue(e.args[0]),t.setLocale(e.locale);return}this.reset()}getState(){let e=this.getMultipleSelectElement(),t=e.getItems();return{command:{key:e.isSelectedAllValues()||!t.length?br:b8},args:[e.getValue()],itemsSnapshot:t}}updateState(e){let t=(t,r,n,o,i)=>{let[s]=Q(r,e=>e.name===b8),a={};if(s){let r=o(t,i);n&&(s.args[0]=n);let{itemsSnapshot:l,selectedValues:h}=this.#lL(t,r,s.args[0]),d=e.editedConditionStack.column;a.locale=this.hot?.getCellMetaTransient(0,d).locale,a.args=[h],a.command=be(b8),a.itemsSnapshot=l}else a.args=[],a.command=be(br);this.state?.setValueAtIndex(t,a)};t(e.editedConditionStack.column,e.editedConditionStack.conditions,e.conditionArgsChange,e.filteredRowsFactory),e.dependentConditionStacks.length&&t(e.dependentConditionStacks[0].column,e.dependentConditionStacks[0].conditions,void 0,e.filteredRowsFactory,e.editedConditionStack)}#lL(e,t,r){let n=this.hot?.getTranslatedPhrase(l6)??"",o=Z(t,e=>e.value),i=this.hot?.hasHook("modifyFiltersMultiSelectValue")?new Map(t.map(t=>[t.value,this.hot?.getCellMetaTransient(t.row,e)])):null,s=b3(o,b5(t[0]?.meta)),a=[];return{itemsSnapshot:b6(s,r,n,e=>{e.checked&&a.push(e.value),this.#lP(e,i)}),selectedValues:a}}getMultipleSelectElement(){return this.elements.find(e=>e instanceof b7)}getMenuItemDescriptor(){return{key:this.id,name:this.name,isCommand:!1,disableSelection:!0,hidden:()=>this.isHidden()||"function"==typeof this.hiddenWhen&&this.hiddenWhen(),renderer:(e,t,r,n,o,i)=>{ne(t.parentNode)&&rd(t.parentNode,"htFiltersMenuValue");let s=this.hot?.rootDocument.createElement("div")??t.ownerDocument.createElement("div");return rd(s,"htFiltersMenuLabel"),s.textContent=i,t.appendChild(s),t.parentElement?.hasAttribute("ghost-table")||J(this.elements,e=>{let r=e.element;r&&t.appendChild(r)}),t}}}reset(){let e=this.hot?.getTranslatedPhrase(l6)??"",t=this._getColumnVisibleValues(),r=t.map(e=>e.value),n=this.hot?.hasHook("modifyFiltersMultiSelectValue")?new Map(t.map(e=>[e.value,e.meta])):null,o=b3(r,b5(t[0]?.meta)),i=b6(o,o,e,e=>{this.#lP(e,n)});this.getMultipleSelectElement().setItems(i),super.reset(),this.getMultipleSelectElement().setValue(o);let s=this.hot?.getPlugin("filters").getSelectedColumn()??null;null!==s&&this.getMultipleSelectElement().setLocale(this.hot?.getCellMetaTransient(0,s.visualIndex).locale)}#lS(e){nv(e.keyCode,"ESCAPE")&&(this.runLocalHooks("cancel"),nR(e)),nv(e.keyCode,"ENTER")&&("apply"===this.searchMode&&this.runLocalHooks("accept"),nR(e))}#lP(e,t){t&&this.hot?.hasHook("modifyFiltersMultiSelectValue")&&(e.visualValue=this.hot?.runHooks("modifyFiltersMultiSelectValue",e.visualValue,t.get(e.value)))}#l_(e,t){return t.valueFormatter?t.valueFormatter(e,t):e}_getColumnVisibleValues(){let e=this.hot?.getPlugin("filters"),t=e?.getSelectedColumn()??null;return e&&null!==t?e._getValueListDataAtColumn(t.visualIndex):[]}}class Ct extends f9{name="";static get BUTTON_OK(){return"ok"}static get BUTTON_CANCEL(){return"cancel"}constructor(e,t){super(e,{id:t.id,stateless:!0}),this.name=t.name,this.elements.push(new b$(e,{type:"button",value:l9,className:"htUIButton htUIButtonOK",identifier:Ct.BUTTON_OK})),this.elements.push(new b$(e,{type:"button",value:l7,className:"htUIButton htUIButtonCancel",identifier:Ct.BUTTON_CANCEL})),this.registerHooks()}registerHooks(){J(this.elements,e=>{e.addLocalHook("click",(e,t)=>this.#lD(e,t))})}getMenuItemDescriptor(){return{key:this.id,name:this.name,isCommand:!1,disableSelection:!0,hidden:()=>this.isHidden(),renderer:(e,t)=>(ne(t.parentNode)&&rd(t.parentNode,"htFiltersMenuActionBar"),J(this.elements,e=>{let r=e.element;r&&t.appendChild(r)}),t)}}accept(){this.runLocalHooks("accept")}cancel(){this.runLocalHooks("cancel")}#lD(e,t){t.options.identifier===Ct.BUTTON_OK?this.accept():this.cancel()}}let Cr="ConditionCollection.filteringStates";class Cn{isMapRegistrable;filteringStates;constructor(e,t=!0){this.hot=e,this.isMapRegistrable=t,!0===this.isMapRegistrable?this.filteringStates=this.hot.columnIndexMapper.createAndRegisterIndexMap(Cr,"linkedPhysicalIndexToValue"):(this.filteringStates=new aI,this.filteringStates.init(this.hot.columnIndexMapper.getNumberOfIndexes()))}isEmpty(){return 0===this.getFilteredColumns().length}isMatch(e,t){let r=this.filteringStates.getValueAtIndex(t),n=r?.conditions??[],o=r?.operation;return this.isMatchInConditions(n,e,o)}isMatchInConditions(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:bX;if(e.length){let n;return(bq[r]||tr(`Operation with id "${r}" does not exist.`),n=bq[r].func,function(e,t){return n(e,t)})(e,t)}return!0}addCondition(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:bX,n=arguments.length>3?arguments[3]:void 0,o=this.hot.getCellMetaTransient(0,e).locale,i=t.args.map(e=>"string"==typeof e?ow(e,o):e),s=t.name||t.command.key;this.runLocalHooks("beforeAdd",e);let a=this.getOperation(e);a?a!==r&&tr(ec`The column of index ${e} has been already applied with a \`${a}\`\x20
        filter operation. Use \`removeConditions\` to clear the current conditions and then add new ones.\x20
        Mind that you cannot mix different types of operations (for instance, if you use \`conjunction\`,\x20
        use it consequently for a particular column).`):eL(bq[r])&&tr(ec`Unexpected operation named \`${r}\`. Possible ones are\x20
        \`disjunction\` and \`conjunction\`.`);let l=this.getConditions(e);0===l.length?this.filteringStates.setValueAtIndex(e,{operation:r,conditions:[{name:s,args:i,func:f8(s,i)}]},n):l.push({name:s,args:i,func:f8(s,i)}),this.runLocalHooks("afterAdd",e)}getConditions(e){return this.filteringStates.getValueAtIndex(e)?.conditions??[]}getOperation(e){return this.filteringStates.getValueAtIndex(e)?.operation}getFilteredColumns(){return this.filteringStates.getEntries().map(e=>{let[t]=e;return t})}getColumnStackPosition(e){return this.getFilteredColumns().indexOf(e)}exportAllConditions(){return this.filteringStates.getEntries().reduce((e,t)=>{let[r,n]=t,{operation:o,conditions:i}=n;return e.push({column:r,operation:o,conditions:i.map(e=>{let{name:t,args:r}=e;return{name:t,args:[...r]}})}),e},[])}importAllConditions(e){this.clean(),e.forEach(e=>{e.conditions.forEach(t=>{this.addCondition(e.column,t,e.operation)})})}removeConditions(e){this.runLocalHooks("beforeRemove",e),this.filteringStates.clearValue(e),this.runLocalHooks("afterRemove",e)}clean(){this.runLocalHooks("beforeClean"),this.filteringStates.clear(),this.runLocalHooks("afterClean")}hasConditions(e,t){let r=this.getConditions(e);return t?r.some(e=>e.name===t):r.length>0}destroy(){this.isMapRegistrable&&this.hot.columnIndexMapper.unregisterMap(Cr),this.clearLocalHooks(),this.filteringStates=null}}th(Cn,ab);let Co=class{conditionCollection;columnDataFactory;constructor(e,t=()=>[]){this.conditionCollection=e,this.columnDataFactory=t}filter(){let e=[];return J(this.conditionCollection.getFilteredColumns(),(t,r)=>{let n;if(r){let r=Z(e,e=>e.row);n=this.columnDataFactory(t,r)}else n=this.columnDataFactory(t);e=this.filterByColumn(t,n)}),e}filterByColumn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=[];return J(t,t=>{void 0!==t&&this.conditionCollection.isMatch(t,e)&&r.push(t)}),r}};class Ci{conditionCollection;columnDataFactory;changes=[];grouping=!1;latestEditedColumnPosition=-1;latestOrderStack=[];#lF=null;constructor(e,t,r=()=>[]){this.hot=e,this.conditionCollection=t,this.columnDataFactory=r,this.conditionCollection.addLocalHook("beforeRemove",e=>this.#lB(e)),this.conditionCollection.addLocalHook("afterRemove",e=>this.updateStatesAtColumn(e)),this.conditionCollection.addLocalHook("afterAdd",e=>this.updateStatesAtColumn(e)),this.conditionCollection.addLocalHook("beforeClean",()=>this.#lV()),this.conditionCollection.addLocalHook("afterClean",()=>this.#lU())}groupChanges(){this.grouping=!0}flush(){this.grouping=!1,this.#lz(()=>{J(this.changes,e=>{this.updateStatesAtColumn(e)})}),this.changes.length=0}#lz(e){if(null!==this.#lF)return void e();this.#lF=new Map;try{e()}finally{this.#lF=null}}#lW(e,t){if(t||null===this.#lF)return this.columnDataFactory(e,t);let r=this.#lF.get(e);return r||(r=this.columnDataFactory(e),this.#lF.set(e,r)),r}#lB(e){this.latestEditedColumnPosition=this.conditionCollection.getColumnStackPosition(e)}updateStatesAtColumn(e,t){if(this.grouping){-1===this.changes.indexOf(e)&&this.changes.push(e);return}this.#lz(()=>this.#lG(e,t))}#lG(e,t){var r=this;let n=this.conditionCollection.exportAllConditions(),o=this.conditionCollection.getColumnStackPosition(e);-1===o&&(o=this.latestEditedColumnPosition);let i=n.slice(0,o),s=n.slice(o);s.length&&s[0].column===e&&s.shift();let a=ng(function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],o=new Cn(r.hot,!1),i=[].concat(e,n);o.importAllConditions(i);let s=r.#lW(Number(t)),a=b1(Z(o.isEmpty()?s:new Co(o,(e,t)=>r.#lW(e,t)).filter(),e=>e.row));return o.destroy(),Q(s,e=>a(e.row))})(i),l=[...this.conditionCollection.getConditions(e)];this.runLocalHooks("update",{editedConditionStack:{column:e,conditions:l},dependentConditionStacks:s,filteredRowsFactory:a,conditionArgsChange:t})}#lV(){this.latestOrderStack=this.conditionCollection.getFilteredColumns()}#lU(){this.#lz(()=>{J(this.latestOrderStack,e=>{this.updateStatesAtColumn(e)})})}destroy(){this.clearLocalHooks(),tp(this,(e,t)=>{this[t]=null})}}th(Ci,ab);let Cs="filters",Ca="filters";class Cl extends pa{static get PLUGIN_KEY(){return Ca}static get PLUGIN_PRIORITY(){return 250}static get DEFAULT_SETTINGS(){return{searchMode:"show"}}static get SETTINGS_VALIDATORS(){return{searchMode:e=>"string"==typeof e&&["show","apply"].includes(e)}}static get PLUGIN_DEPS(){return["plugin:DropdownMenu","plugin:HiddenRows","cell-type:checkbox"]}dropdownMenuPlugin=null;conditionCollection=null;conditionUpdateObserver=null;components=new Map([["filter_by_condition",null],["filter_operators",null],["filter_by_condition2",null],["filter_by_value",null],["filter_action_bar",null]]);filtersRowsMap=null;#l$;#lY=new WeakSet;#lj=[];#lq=[];#lK=!1;constructor(e){super(e),this.hot.addHook("afterGetColHeader",this.#o4)}#lX(e){return this.components.get(e)??null}#lQ(){return this.components.get("filter_operators")??null}#lZ(){return this.components.get("filter_by_value")??null}isEnabled(){return!!this.hot.getSettings()[Ca]}enablePlugin(){if(this.enabled)return;this.#lK=!0===this.hot.runHooks("hasExternalDataSource"),this.filtersRowsMap=this.hot.rowIndexMapper.createAndRegisterIndexMap(this.pluginName??"","trimming"),this.dropdownMenuPlugin=this.hot.getPlugin("dropdownMenu");let e=this.hot.getSettings().dropdownMenu,t="object"==typeof e?e.uiContainer:null,r=ne(t)?t:this.hot.rootPortalElement,n=e=>(e.addLocalHook("accept",()=>this.#lJ("accept")),e.addLocalHook("cancel",()=>this.#lJ("cancel")),e.addLocalHook("change",t=>this.#l0(e,t)),e),o=()=>`${this.hot.getTranslatedPhrase(l0)}:`,i=()=>`${this.hot.getTranslatedPhrase(l1)}:`;if(!this.components.get("filter_by_condition")){let e=new bj(this.hot,{id:"filter_by_condition",name:o,addSeparator:!1,menuContainer:r});e.addLocalHook("afterClose",()=>this.#l1()),this.components.set("filter_by_condition",n(e))}if(this.components.get("filter_operators")||this.components.set("filter_operators",new b0(this.hot,{id:"filter_operators",name:"Operators"})),!this.components.get("filter_by_condition2")){let e=new bj(this.hot,{id:"filter_by_condition2",name:"",addSeparator:!0,menuContainer:r});e.addLocalHook("afterClose",()=>this.#l1()),this.components.set("filter_by_condition2",n(e))}if(!this.components.get("filter_by_value")){let e=this.getSetting("searchMode");this.components.set("filter_by_value",n(new Ce(this.hot,{id:"filter_by_value",name:i,searchMode:e,hiddenWhen:()=>this.#lK})))}if(this.components.get("filter_action_bar")||this.components.set("filter_action_bar",n(new Ct(this.hot,{id:"filter_action_bar",name:"Action bar"}))),this.conditionCollection||(this.conditionCollection=new Cn(this.hot)),this.conditionUpdateObserver||(this.conditionUpdateObserver=new Ci(this.hot,this.conditionCollection,(e,t)=>this.getDataMapAtColumn(e,t)),this.conditionUpdateObserver.addLocalHook("update",e=>this.#l2(e))),this.components.forEach(e=>e?.show()),this.addHook("afterDropdownMenuDefaultOptions",this.#l3),this.addHook("beforeDropdownMenuShow",this.#l6),this.addHook("afterDropdownMenuShow",this.#l5),this.addHook("afterDropdownMenuHide",this.#l4),this.addHook("afterChange",this.#of),this.addHook("afterUpdateData",this.#l9),this.addHook("afterDataProviderFetch",this.#it),this.addHook("afterDataProviderFetchError",this.#l7),this.hot.getSettings().dropdownMenu&&this.dropdownMenuPlugin&&(this.dropdownMenuPlugin.disablePlugin(),this.dropdownMenuPlugin.enablePlugin()),!this.#l$&&this.dropdownMenuPlugin?.enabled){let e=[{focus:()=>{let e=this.#l$;if(!e)return;let t=e.getMenu(),r=t.getNavigator(),n=e.getLastMenuPage();t.focus(),n>0?r?.setCurrentPage(n):r?.toFirstItem()}},...Array.from(this.components).map(e=>{let[,t]=e;return t?.getElements()??[]}).flat()];this.#l$=function(e,t){let r,n=-1,o=mD({initialPage:0,size:()=>t.length,onItemSelect:(e,r)=>{let n=t[e];return n instanceof b7?r:(!ne(n.element)||!!rv(n.element))&&void n.focus()}}),i=e=>()=>{r.isOpened()&&r.getKeyboardShortcutsCtrl().listen(Cs),o.setCurrentPage(t.indexOf(e))};function s(e){let i=r.getKeyboardShortcutsCtrl(),s=e.getKeyboardShortcutsCtrl();o.clear(),s.addCustomShortcuts([{keys:[["Tab"],["Shift","Tab"]],forwardToContext:i.getContext(Cs),callback:()=>{e.isSubMenu()&&e.close(),i.listen(Cs)}}]),e.isSubMenu()||i.addCustomShortcuts([{keys:[["Tab"],["Shift","Tab"]],callback:e=>{let t=r.getNavigator();t.getCurrentPage()>-1&&(n=t.getCurrentPage()),t.clear(),e.shiftKey?o.toPreviousItem():o.toNextItem()}},{keys:[["Escape"]],callback:()=>{r.close()}},{keys:[["Enter"],["Space"]],preventDefault:!1,callback:e=>{let r=t[o.getCurrentPage()];r instanceof bY&&(r.openOptions(),e.preventDefault()),r instanceof b4&&(r.activate(),e.preventDefault()),r instanceof bG||e.preventDefault()}}],Cs)}function a(e){e.addLocalHook("afterSelectionChange",e=>{e.key.startsWith("filter_")||o.clear()}),e.addLocalHook("afterSubmenuOpen",s),e.addLocalHook("afterOpen",s),r=e}return t.forEach(e=>{e instanceof bG&&(e.addLocalHook("click",i(e)),e.addLocalHook("focus",i(e)),e.addLocalHook("afterClose",i(e)))}),a(e),{...o,listen:function(){r.focus(),r.getKeyboardShortcutsCtrl().listen(Cs)},setMenu:a,getMenu:function(){return r},getLastMenuPage:function(){return n}}}(this.dropdownMenuPlugin.menu,e);let t=e=>{this.#l$?.listen(),e.preventDefault(),nv(e.keyCode,"TAB")&&(e.shiftKey?this.#l$?.toPreviousItem():this.#l$?.toNextItem())};this.components.get("filter_by_value")?.addLocalHook("listTabKeydown",t),this.components.get("filter_by_condition")?.addLocalHook("selectTabKeydown",t)}this.registerShortcuts(),super.enablePlugin()}updatePlugin(){this.disablePlugin(),this.enablePlugin(),super.updatePlugin()}disablePlugin(){this.enabled&&(this.dropdownMenuPlugin?.enabled&&this.dropdownMenuPlugin.menu?.clearLocalHooks(),this.components.forEach((e,t)=>{e?.destroy(),this.components.set(t,null)}),this.conditionCollection?.destroy(),this.conditionCollection=null,this.hot.rowIndexMapper.unregisterMap(this.pluginName??"")),this.unregisterShortcuts(),super.disablePlugin()}registerShortcuts(){this.hot.getShortcutManager().getContext("grid")?.addShortcut({keys:[["Alt","A"]],stopPropagation:!0,callback:()=>{let e=this.hot.getSelected();this.clearConditions(),this.filter(),e&&this.hot.selectCells(e)},group:Ca})}unregisterShortcuts(){this.hot.getShortcutManager().getContext("grid")?.removeShortcutsByGroup(Ca)}addCondition(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:bX;if(t===b8&&this.#lK)return;let o=this.hot.toPhysicalColumn(e);this.conditionCollection?.addCondition(o,{command:{key:t},args:r},n)}removeConditions(e){let t=this.hot.toPhysicalColumn(e);this.conditionCollection?.removeConditions(t)}clearConditions(e){if(void 0===e)this.conditionCollection?.clean();else{let t=this.hot.toPhysicalColumn(e);this.conditionCollection?.removeConditions(t)}}importConditions(e){this.conditionUpdateObserver?.groupChanges(),this.conditionCollection?.importAllConditions(e),this.conditionUpdateObserver?.flush()}exportConditions(){return this.conditionCollection?.exportAllConditions()??[]}filter(){let{navigableHeaders:e}=this.hot.getSettings(),t=!this.conditionCollection?.isEmpty(),r=this.exportConditions();this.#lK&&(this.#lq=ta(this.#lj));let n=this.hot.runHooks("beforeFilter",r,this.#lj);if(!1!==n&&t){let t=Z(this._createDataFilter().filter(),e=>e.row),r=b1(t),n=this.hot.countSourceRows(),o=Array(n);for(let e=0;e<n;e++)o[e]=!r(e);this.hot.batchExecution(()=>{this.filtersRowsMap?.setValues(o)},!0),e||t.length||this.hot.deselectCell(),this.#lj=this.exportConditions()}else!1===n||t?this.#lK?this.#lj=this.exportConditions():this.importConditions(this.#lj):(this.#lj=this.exportConditions(),this.filtersRowsMap?.clear());if(this.hot.selection.isSelected()){let t=this.hot.getSelectedRangeActive()?.highlight.col;null!=t&&this.hot.selectCell(e?-1:0,t)}!1!==n&&(this.hot.runHooks("afterFilter",r),this.hot.view.adjustElementsSize(),this.hot.render())}getSelectedColumn(){let e=this.hot.getSelectedRangeActive()?.highlight;return e&&null!==e.col?{visualIndex:e.col,physicalIndex:this.hot.toPhysicalColumn(e.col)}:null}getDataMapAtColumn(e,t){let r=t?t.length:this.hot.countSourceRows(),n=this.hot.toVisualColumn(e),o=[];for(let i=0;i<r;i++){let r=t?t[i]:i,s=this.hot._getMetaManager().getCellMetaUncached(r,e,{visualRow:r,visualColumn:e}),a=n1(this.hot.getSourceDataAtCell(r,n),s);if(this.hot.hasHook("modifyData")){let t=tC(a);this.hot.runHooks("modifyData",r,e,t,"get"),t.isTouched()&&(a=t.value)}o.push({row:r,meta:s,value:b2(a)})}return o}#of=e=>{if(e){let t=new Set;J(e,e=>{let[,r]=e,n=this.hot.propToCol(r),o=this.hot.toPhysicalColumn(n);this.conditionCollection?.hasConditions(o)&&t.add(o)}),t.forEach(e=>{this.updateValueComponentCondition(e)})}};updateValueComponentCondition(e){let t=this.hot.toVisualColumn(e),r=b3(this.hot.getDataAtCol(t),b5(this.hot.countRows()>0?this.hot.getCellMetaTransient(0,t):null));this.conditionUpdateObserver?.updateStatesAtColumn(e,r)}restoreComponents(e){let t=this.getSelectedColumn()?.physicalIndex??-1;e.forEach(e=>{e.isHidden()||e.restoreState(t)}),this.updateDependentComponentsVisibility()}#l9=(e,t)=>{if(t||this.#lK||!this.conditionCollection)return;let r=this.conditionCollection?.getFilteredColumns()??[];0!==r.length&&J(r,e=>{this.conditionUpdateObserver?.updateStatesAtColumn(e)})};#it=e=>{this.importConditions(e?.filtersConditionsStack??[])};#l7=()=>{this.importConditions(this.#lq)};#l5=()=>{let e=this.dropdownMenuPlugin?.menu;e&&(this.restoreComponents(Array.from(this.components.values()).filter(e=>null!==e)),e.updateMenuDimensions())};#l4=()=>{this.components.get("filter_by_condition")?.getSelectElement()?.closeOptions(),this.components.get("filter_by_condition2")?.getSelectElement()?.closeOptions()};#l6=()=>{let e=this.dropdownMenuPlugin?.menu;e&&(this.#lY.has(e)||this.#l$?.setMenu(e),this.#lY.add(e))};#l3=e=>{e.items.push({name:ms}),this.components.forEach(t=>{t&&e.items.push(t.getMenuItemDescriptor())})};getOperationBasedOnArguments(e,t,r,n){let o=e,i=t.command?.key,s=r.command?.key,a=n.command?.key;return o===bQ&&i!==br&&s!==br&&a!==br?o=bZ:a!==br&&(i===br||s===br)&&(o=bX),o}#lJ(e){if("accept"===e){let e=this.getSelectedColumn();if(null===e)return void this.dropdownMenuPlugin?.close();let{physicalIndex:t}=e,r={command:{key:br},args:[]},n=this.#lX("filter_by_condition")?.getState()??r,o=this.#lX("filter_by_condition2")?.getState()??r,i=this.#lZ()?.getState()??r,s=this.getOperationBasedOnArguments(this.#lQ()?.getActiveOperationId()??bX,n,o,i);this.conditionUpdateObserver?.groupChanges();let a=this.conditionCollection?.getColumnStackPosition(t);(void 0===a||-1===a)&&(a=void 0),this.conditionCollection?.removeConditions(t);let l=n.command?.key,h=o.command?.key,d=i.command?.key;l!==br&&(this.conditionCollection?.addCondition(t,n,s,a),h!==br&&this.conditionCollection?.addCondition(t,o,s,a)),d===br||this.#lK||this.conditionCollection?.addCondition(t,i,s,a),this.conditionUpdateObserver?.flush(),this.components.forEach(e=>e?.saveState(t)),this.filter()}this.dropdownMenuPlugin?.close()}#l0(e,t){let r=this.dropdownMenuPlugin?.menu;this.updateDependentComponentsVisibility(),e.constructor!==bj||t.inputsCount||this.setListeningDropdownMenu(),r?.updateMenuDimensions()}#l1(){this.setListeningDropdownMenu()}setListeningDropdownMenu(){this.dropdownMenuPlugin&&this.dropdownMenuPlugin.setListening()}updateDependentComponentsVisibility(){let e=this.#lX("filter_by_condition"),t=(e?.getState()??{command:{key:br}}).command,r=[this.components.get("filter_by_condition2"),this.components.get("filter_operators")].filter(e=>null!=e);t?.showOperators?this.showComponents(...r):this.hideComponents(...r)}#o4=(e,t)=>{let r=this.hot.toPhysicalColumn(e);this.enabled&&this.conditionCollection?.hasConditions(r)&&rs(t)?rd(t,"htFiltersActive"):ru(t,"htFiltersActive")};_getValueListDataAtColumn(e){let t=this.hot.toPhysicalColumn(e),r=this.conditionCollection?.getColumnStackPosition(t)??-1;if(-1===r||this.#lK)return Z(this.hot.getDataAtCol(e),(t,r)=>({value:b2(t),meta:this.hot.getCellMetaTransient(r,e)}));let n=this.getDataMapAtColumn(t),o=(this.conditionCollection?.exportAllConditions()??[]).slice(0,r);if(0===o.length)return n;let i=new Cn(this.hot,!1);i.importAllConditions(o);let s=b1(Z(this._createDataFilter(i).filter(),e=>e.row));return i.destroy(),Q(n,e=>s(e.row))}_createDataFilter(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.conditionCollection;return e||(e=new Cn(this.hot,!1)),new Co(e,(e,t)=>this.getDataMapAtColumn(e,t))}#l2(e){if(!this.dropdownMenuPlugin?.enabled)return;let t=e.editedConditionStack,r=t.conditions,n=t.column,o=e.conditionArgsChange;Array.isArray(o)&&(this.#lj=this.#lj.map(e=>(e.column===n&&r.length>0&&e.conditions.forEach(e=>{"by_value"===e.name&&(e.args=[[...o]])}),e)));let i=r.filter(e=>e.name===b8),s=r.filter(e=>e.name!==b8);if(i.length>=2||s.length>=3)tQ(ec`The filter conditions have been applied properly, but couldn’t be displayed visually.\x20
        The dropdown menu supports at most 2 regular conditions and 1 'filter by value' condition per column,\x20
        but more were provided. For more details see the documentation.`);else{let t=this.conditionCollection?.getOperation(n);this.#lX("filter_by_condition")?.updateState(s[0],n),this.#lX("filter_by_condition2")?.updateState(s[1],n),this.#lQ()?.updateState(t??bX,n),this.#lZ()?.updateState(e)}}getIndexesOfComponents(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];let n=this.dropdownMenuPlugin?.menu;return n?t.map(e=>n.getItemPositionByKey(String(e.getMenuItemDescriptor().key))).filter(e=>-1!==e):[]}changeComponentsVisibility(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if(!this.dropdownMenuPlugin)return;let o=this.dropdownMenuPlugin.menu;if(!o)return;let i=o.hotMenu;if(!i)return;let s=i.getPlugin("hiddenRows"),a=this.getIndexesOfComponents(...r);e?s.showRows(a):s.hideRows(a),i.render()}hideComponents(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];this.changeComponentsVisibility(!1,...t)}showComponents(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];this.changeComponentsVisibility(!0,...t)}destroy(){this.enabled&&(this.components.forEach((e,t)=>{null!==e&&(e.destroy(),this.components.set(t,null))}),this.conditionCollection?.destroy(),this.conditionUpdateObserver?.destroy(),this.hot.rowIndexMapper.unregisterMap(this.pluginName??"")),super.destroy()}}let Ch="internal-use-in-handsontable",Cd={licenseKey:Ch,maxRows:1/0,useArrayArithmetic:!0,useColumnIndex:!1,useStats:!1,evaluateNullToZero:!0,precisionEpsilon:1e-13,precisionRounding:14,smartRounding:!0,leapYear1900:!1,nullDate:{year:1899,month:12,day:30},nullYear:30,dateFormats:["YYYY-MM-DD"],timeFormats:["hh:mm","hh:mm:ss","hh:mm:ss.sss"],matchWholeCell:!0,useRegularExpressions:!1,useWildcards:!0,functionArgSeparator:",",thousandSeparator:"",decimalSeparator:".",language:"enGB"},Cu=["maxRows","maxColumns"];function Cc(e){return Object.keys(e).reduce((t,r)=>(Cu.includes(r)||(t[r]=e[r]),t),{})}function Cg(e){let t=e[Ck];return{language:t?.language?.langCode}}function Cp(e){return Object.keys(e).reduce((t,r)=>("hyperformula"!==r&&(t[r]=e[r]),t),{})}function Cm(){let e="engine_relationship",t=nU(Ck);return t.hasItem(e)||t.register(e,new Map),t.getItem(e)}function Cf(){let e="shared_engine_usage",t=nU(Ck);return t.hasItem(e)||t.register(e,new Map),t.getItem(e)}function Cb(e,t,r){var n,o,i,s;let a,l,h,d,u=t[Ck],c=(a=t[Ck],l=a?.engine,h=Cc(Cp(l?.hyperformula?l:{})),d=Cg(t),{...Cd,...h,...d}),g=Cm(),p=Cf();n=e,(o=u.functions)&&o.forEach(e=>{let{name:t,plugin:r,translations:o}=e;try{n.registerFunction(t,r,o)}catch(e){tQ(e instanceof Error?e.message:String(e))}}),function(e,t){if(t){let{langCode:r}=t;try{e.registerLanguage(r,t)}catch(e){tQ(e instanceof Error?e.message:String(e))}}}(e,u.language);let m=e.buildEmpty(c);return g.set(m,[r]),p.set(m,[r.guid]),i=m,(s=u.namedExpressions)&&(i.suspendEvaluation(),s.forEach(e=>{let{name:t,expression:r,scope:n,options:o}=e;try{i.addNamedExpression(t,r,n,o)}catch(e){tQ(e instanceof Error?e.message:String(e))}}),i.resumeEvaluation()),m.on("sheetAdded",()=>{m.rebuildAndRecalculate()}),m.on("sheetRemoved",()=>{m.rebuildAndRecalculate()}),m}function CC(e){let t=Cm();return new Map((0===t.size?[]:Array.from(t.get(e)??[])).map(e=>[e.getPlugin("formulas").sheetId,e]))}function Cy(e,t){if(e){let r=Cm(),n=r.get(e),o=Cf(),i=o.get(e);n&&n.includes(t)&&(n.splice(n.indexOf(t),1),0===n.length&&r.delete(e)),i&&i.includes(t.guid)&&(i.splice(i.indexOf(t.guid),1),0===i.length&&(o.delete(e),e.destroy()))}}function Cw(e,t){return"string"==typeof e&&"date"===t}function CS(e){let t=Math.round((e-Math.floor(e))*86400),r=Math.floor(t/3600),n=Math.floor(t%3600/60),o=t%60,i=`${String(r).padStart(2,"0")}:${String(n).padStart(2,"0")}`;return o>0?`${i}:${String(o).padStart(2,"0")}`:i}function Cv(e){let t=new Date(Date.UTC(1899,11,30)+864e5*e),r=t.getUTCFullYear(),n=String(t.getUTCMonth()+1).padStart(2,"0"),o=String(t.getUTCDate()).padStart(2,"0");return`${r}-${n}-${o}`}function CR(e){let t=[...e].sort((e,t)=>e-t),r=[];return t.forEach(e=>{let t=r[r.length-1];void 0===t||e>t[0]+t[1]?r.push([e,1]):e===t[0]+t[1]&&(t[1]+=1)}),r}function CE(e){return Array.isArray(e)?g8(e):e}let CT=new Set(["http:","https:","mailto:","tel:"]);function CA(e,t,r){var n,o;let i,s,a;return(i=new Set(e),s=Array.from(Array(r).keys()).filter(e=>!1===i.has(e)),n=0===t?s[t]??0:s[t-1]+1,a=[],e.forEach(e=>{let t={from:e,to:n};a.forEach(e=>{let r=e.from>e.to,n=e.to<=t.from;e.from>t.from&&n&&r&&(t.from+=1)}),t.from>=n&&(n+=1),a.push(t)}),o=a).forEach((e,t)=>{o.slice(t+1).forEach(t=>{let r=t.from<t.to;t.from>e.from&&r&&(t.from-=1)})}),o}let CM=class{#l8;#he;#ht;#hr=[];#hn=[];#ho;#hi=[];#hs=null;constructor(e,t,r){this.#l8=e,this.#he=t,this.#ht=r,this.#he.addLocalHook("indexesSequenceChange",()=>{this.#hs=null}),this.#he.addLocalHook("cacheUpdated",e=>{e.trimmedIndexesChanged&&(this.#hs=null)})}#ha(){if(null===this.#hs){let e=this.#he.getIndexesSequence(),t=this.#he.getNotTrimmedIndexes(),r=Array(e.length),n=Array(e.length).fill(-1);for(let t=0;t<e.length;t+=1)r[e[t]]=t;for(let e=0;e<t.length;e+=1)n[t[e]]=e;this.#hs={physicalIndexOfHf:e,hfIndexOfPhysical:r,visualIndexOfPhysical:n}}return this.#hs}setRemovedHfIndexes(e){return this.#hi=e.map(e=>{let t=this.#he.getVisualFromPhysicalIndex(e);return this.getHfIndexFromVisualIndex(t??-1)}),this.#hi}getRemovedHfIndexes(){return this.#hi}getHfIndexFromVisualIndex(e){let t=this.#he.getNotTrimmedIndexes()[e];return void 0===t?-1:this.#ha().hfIndexOfPhysical[t]??-1}getVisualIndexFromHfIndex(e){let{physicalIndexOfHf:t,visualIndexOfPhysical:r}=this.#ha(),n=t[e];return void 0===n?-1:r[n]}syncMoves(e){let t=`move${oa(this.#l8)}s`,r=this.#ht.getEngine();r&&r.batch(()=>{e.forEach(e=>{let n=e.from!==e.to,o=e.from+1!==e.to;n&&o&&r[t](this.#ht.getSheetId(),e.from,1,e.to)})})}storeMovesInformation(e,t,r){!1!==r&&(this.#hn=e.map(e=>this.getHfIndexFromVisualIndex(e)),this.#ho=this.getHfIndexFromVisualIndex(t))}calculateAndSyncMoves(e,t){if(this.#ht.isPerformingUndoRedo()||!1===e||!1===t)return;let r=CA(this.#hn,this.#ho??0,this.#he.getNumberOfIndexes());null===this.#ht.getSheetId()?this.#ht.getPostponeAction(()=>this.syncMoves(r)):this.syncMoves(r)}getIndexesChangeSyncMethod(){let e=`set${oa(this.#l8)}Order`;return t=>{if(this.#ht.isPerformingUndoRedo())return;let r=this.#he.getIndexesSequence();if("update"===t&&r.length>0){let t,n=Array(r.length);for(let e=0;e<r.length;e+=1)n[r[e]]=e;let o=this.#hr.map(e=>n[e]??-1),i=this.#ht.getEngine().getSheetDimensions(this.#ht.getSheetId());t="row"===this.#l8?i.height:i.width;let s=o.length;for(let e=s;e<t;e+=1)o.push(e);this.#ht.getEngine()[e](this.#ht.getSheetId(),o)}this.#hr=r}}#hl(){let e=this.#he.getIndexesSequence();if(e.every((e,t)=>e===t)||0===e.length)return;let t=this.#ht.getEngine(),r=this.#ht.getSheetId();if(null===t||null===r)return void this.#ht.getPostponeAction()(()=>this.#hl());let n=`set${oa(this.#l8)}Order`,o=t.getSheetDimensions(r),i="row"===this.#l8?o.height:o.width,s=Array(e.length);for(let t=0;t<e.length;t+=1)s[e[t]]=t;for(let e=s.length;e<i;e+=1)s.push(e);t[n](r,s)}init(){this.#hl(),this.#hr=this.#he.getIndexesSequence()}},CI=class{#hh;#hd;#hu;#hc=!1;#hg=!1;#hp=null;#hm=null;constructor(e,t,r){this.#hh=new CM("row",e,this),this.#hd=new CM("column",t,this),this.#hu=r}getForAxis(e){return"row"===e?this.#hh:this.#hd}setPerformUndo(e){this.#hc=e}setPerformRedo(e){this.#hg=e}isPerformingUndoRedo(){return this.#hc||this.#hg}getSheetId(){return this.#hm}getEngine(){return this.#hp}getPostponeAction(){return this.#hu}setupSyncEndpoint(e,t){this.#hp=e,this.#hm=t,this.#hh.init(),this.#hd.init()}};function Cx(e){return"object"==typeof e&&null!==e}function CN(e){return"object"==typeof e&&null!==e}function CO(e){return"object"==typeof e&&null!==e&&"value"in e}let Ck="formulas",CH=["maxRows","maxColumns","language"];nF.getSingleton().register("afterNamedExpressionAdded"),nF.getSingleton().register("afterNamedExpressionRemoved"),nF.getSingleton().register("afterSheetAdded"),nF.getSingleton().register("afterSheetRemoved"),nF.getSingleton().register("afterSheetRenamed"),nF.getSingleton().register("afterFormulasValuesUpdate");let C_=e=>"UndoRedo.undo"===e||"UndoRedo.redo"===e||"auto"===e,CL="ht-hyperlink";class CP extends pa{static get PLUGIN_KEY(){return Ck}static get PLUGIN_PRIORITY(){return 260}static get SETTING_KEYS(){return[Ck,...CH]}#hf=!1;#hb=!1;#hC=!1;#hy=null;#hw=null;#hS=!1;#hv=null;#hR=!1;#hE=!1;#hT=[];#hA=[];#hM=!1;#hI(e){let t;if(!e.address||e.address.sheet!==this.sheetId||"number"!=typeof e.newValue)return e;let r=this.rowAxisSyncer.getVisualIndexFromHfIndex(e.address.row),n=this.columnAxisSyncer.getVisualIndexFromHfIndex(e.address.col);if(r<0||n<0)return e;let o=this.hot._getMetaManager().getCellMetaUncached(this.hot.toPhysicalRow(r)??r,this.hot.toPhysicalColumn(n)??n,{visualRow:r,visualColumn:n});if("date"===o.type)t=Cv(e.newValue);else{if("time"!==o.type)return e;t=CS(e.newValue)}let i=Object.assign(Object.create(Object.getPrototypeOf(e)),e);return i.newValue=t,i}#hx=e=>{let t=e.map(e=>this.#hI(e));this.hot.runHooks("afterFormulasValuesUpdate",t)};#hN=(e,t)=>{this.hot.runHooks("afterNamedExpressionAdded",e,t)};#hO=(e,t)=>{this.hot.runHooks("afterNamedExpressionRemoved",e,t)};#hk=e=>{this.hot.runHooks("afterSheetAdded",e)};#hH=(e,t)=>{this.engine?.getSheetId(t)===this.sheetId&&this.#h_(t),this.hot.runHooks("afterSheetRenamed",e,t)};#hL=(e,t)=>{this.hot.runHooks("afterSheetRemoved",e,t)};#hP=[["valuesUpdated",this.#hx],["namedExpressionAdded",this.#hN],["namedExpressionRemoved",this.#hO],["sheetAdded",this.#hk],["sheetRenamed",this.#hH],["sheetRemoved",this.#hL]];staticRegister=nU("formulas");engine=null;sheetId=null;sheetName=null;indexSyncer=null;rowAxisSyncer=null;columnAxisSyncer=null;isEnabled(){return!!this.hot.getSettings()[Ck]}enablePlugin(){if(!this.enabled){if(this.engine=function(e){let t=e.getSettings(),r=t[Ck];if(!r||!0===r)return null;let n=r?.engine;if(void 0===n)return null;if("function"==typeof n.hyperformula)return Cb(n.hyperformula,t,e);if("function"==typeof n)return Cb(n,t,e);if("object"==typeof n&&eL(n.hyperformula)){let t=Cm(),r=Cf().get(n);return t.has(n)||t.set(n,[]),t.get(n).push(e),r&&r.push(e.guid),n.getConfig().licenseKey||n.updateConfig({licenseKey:Ch}),(n.getConfig().leapYear1900!==Cd.leapYear1900||!1===td(n.getConfig().nullDate,Cd.nullDate))&&tQ(ec`If you use HyperFormula with Handsontable, keep the default \`leapYear1900\` and \`nullDate\` 
      settings. Otherwise, HyperFormula's dates may not sync correctly with Handsontable's dates.`),n}return null}(this.hot)??this.engine,!this.engine)return void tQ("Missing the required `engine` key in the Formulas settings. Please fill it with either an engine class or an engine instance.");if(null!==this.sheetName&&!this.engine.doesSheetExist(this.sheetName)){let e=this.addSheet(this.sheetName,this.#hD());"string"==typeof e&&this.#h_(e)}this.addHook("beforeLoadData",this.#hF),this.addHook("afterLoadData",this.#oP),this.addHook("beforeUpdateData",this.#hF),this.addHook("afterUpdateData",this.#oP),this.addHook("modifyData",this.#hB),this.addHook("modifySourceData",this.#hV),this.addHook("beforeValidate",this.#hU),this.addHook("afterSetSourceDataAtCell",this.#oB),this.addHook("afterSetDataAtCell",this.#hz),this.addHook("afterSetDataAtRowProp",this.#hz),this.addHook("beforeCreateRow",this.#sb),this.addHook("beforeCreateCol",this.#sS),this.addHook("afterCreateRow",this.#sC),this.addHook("afterCreateCol",this.#sv),this.addHook("beforeRemoveRow",this.#sy),this.addHook("beforeRemoveCol",this.#sR),this.addHook("afterRemoveRow",this.#sw),this.addHook("afterRemoveCol",this.#sE),this.indexSyncer=new CI(this.hot.rowIndexMapper,this.hot.columnIndexMapper,e=>{this.hot.addHookOnce("init",()=>{e()})}),this.rowAxisSyncer=this.indexSyncer.getForAxis("row"),this.columnAxisSyncer=this.indexSyncer.getForAxis("column"),this.hot.addHook("afterRowSequenceChange",this.rowAxisSyncer.getIndexesChangeSyncMethod()),this.hot.addHook("afterColumnSequenceChange",this.columnAxisSyncer.getIndexesChangeSyncMethod()),this.hot.addHook("beforeRowMove",(e,t,r,n)=>{this.rowAxisSyncer.storeMovesInformation(e,t,n)}),this.hot.addHook("beforeColumnMove",(e,t,r,n)=>{this.columnAxisSyncer.storeMovesInformation(e,t,n)}),this.hot.addHook("afterRowMove",(e,t,r,n,o)=>{this.rowAxisSyncer.calculateAndSyncMoves(n,o)}),this.hot.addHook("afterColumnMove",(e,t,r,n,o)=>{this.columnAxisSyncer.calculateAndSyncMoves(n,o)}),this.hot.addHook("beforeColumnFreeze",(e,t)=>{let r=this.hot.getSettings().fixedColumnsStart;this.columnAxisSyncer.storeMovesInformation([e],r,t)}),this.hot.addHook("afterColumnFreeze",(e,t)=>{this.columnAxisSyncer.calculateAndSyncMoves(t,t)}),this.hot.addHook("beforeColumnUnfreeze",(e,t)=>{let r=this.hot.getSettings().fixedColumnsStart;this.columnAxisSyncer.storeMovesInformation([e],r-1,t)}),this.hot.addHook("afterColumnUnfreeze",(e,t)=>{this.columnAxisSyncer.calculateAndSyncMoves(t,t)}),this.addHook("afterCellMetaReset",this.#hW),this.addHook("beforeUndo",()=>{this.indexSyncer.setPerformUndo(!0),this.#hA=[],this.#hM=!1,this.#hT=this.engine.undo()??[]}),this.addHook("beforeRedo",e=>{if("object"!=typeof e||null===e||!("actionType"in e))return!1;this.indexSyncer.setPerformRedo(!0),this.#hS="move_cells"===e.actionType,this.#hA=[],this.#hM=!1,this.#hT=this.#hS?[]:this.engine.redo()??[]}),this.addHook("afterUndo",()=>{this.indexSyncer.setPerformUndo(!1),this.indexSyncer.setPerformRedo(!1),this.#hS=!1,this.#hG()}),this.addHook("afterRedo",()=>{this.indexSyncer.setPerformRedo(!1),this.#hG()}),this.addHook("afterRedo",()=>{this.#hS=!1}),this.addHook("afterDetachChild",this.#h$),this.addHook("beforeAutofill",this.#hY),this.addHook("beforeMoveCells",this.#hj),this.addHook("afterMoveCells",this.#hq),this.addHook("afterRenderer",this.#hK),this.#hP?.forEach(e=>{let[t,r]=e;return this.engine.on(t,r)}),this.#hX(),this.registerShortcuts(),super.enablePlugin()}}disablePlugin(){this.#hQ(),this.unregisterShortcuts(),this.#hP?.forEach(e=>{let[t,r]=e;return this.engine?.off(t,r)}),this.engine&&Cy(this.engine,this.hot),this.engine=null,super.disablePlugin()}updatePlugin(e){var t,r;let n,o,i,s,a=(n=(t=this.hot.getSettings())[Ck],o=n?.engine,i=Cc(Cp(o?.hyperformula?o:{})),s=Cg(t),{...i,...s});this.engine&&(r=this.engine.getConfig(),Object.keys(a).some(e=>void 0!==a[e]&&a[e]!==r[e]))&&this.engine.updateConfig(a);let l=this.hot.getSettings()[Ck];if(void 0!==l&&"boolean"!=typeof l&&void 0!==l.sheetName&&this.engine?.getSheetId(l.sheetName)!==this.sheetId&&this.switchSheet(l.sheetName),!e.data&&null===this.sheetName){let e=this.hot.getSettings()[Ck],t=CN(e)?e.sheetName:void 0;if(t&&this.engine?.doesSheetExist(t))this.switchSheet(t);else{let e=this.addSheet(t??void 0,this.#hD());"string"==typeof e&&this.#h_(e)}}this.#hX(),super.updatePlugin(e)}destroy(){this.#hP?.forEach(e=>{let[t,r]=e;return this.engine?.off(t,r)}),this.#hP=null,this.engine&&Cy(this.engine,this.hot),this.engine=null,super.destroy()}#h_(e){let t=this.engine?.getSheetId(e)??null;this.sheetName=(null===t?null:this.engine?.getSheetName(t))??e,this.sheetId=t}addSheet(e,t){if(e_(t)&&!ap(t))return tQ("The provided data should be an array of arrays."),!1;if(null!=e&&this.engine?.doesSheetExist(e))return tQ("Sheet with the provided name already exists."),!1;try{let r=this.engine.addSheet(e??void 0);return t&&this.engine.setSheetContent(this.engine.getSheetId(r),t),r}catch(e){return tQ(e instanceof Error?e.message:String(e)),!1}}switchSheet(e){if(!this.engine?.doesSheetExist(e))return void t3(`The sheet named \`${e}\` does not exist, switch aborted.`);this.#h_(e);let t=this.engine.getSheetSerialized(this.sheetId);t.length>0&&this.hot.loadData(t,`${oa(Ck)}.switchSheet`)}getCellType(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.sheetId,n=this.hot.toPhysicalRow(e),o=this.hot.toPhysicalColumn(t);return null!==n&&null!==o?this.engine.getCellType({sheet:r,row:this.rowAxisSyncer.getHfIndexFromVisualIndex(e),col:this.columnAxisSyncer.getHfIndexFromVisualIndex(t)}):"EMPTY"}isFormulaCellType(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.sheetId;return this.engine.doesCellHaveFormula({sheet:r,row:this.rowAxisSyncer.getHfIndexFromVisualIndex(e),col:this.columnAxisSyncer.getHfIndexFromVisualIndex(t)})}registerShortcuts(){this.hot.getShortcutManager().getContext("grid")?.addShortcut({keys:[["Alt","Enter"]],callback:()=>{let e=this.hot.getSelectedRangeActive()?.highlight;if(!e||null===e.row||null===e.col)return;let t=this.#hZ(e.row,e.col);null!==t&&this.hot.rootWindow.open(t,"_blank","noopener,noreferrer")},stopPropagation:!0,runOnlyIf:()=>{let e=this.hot.getSelectedRangeActive()?.highlight;return this.#hb&&!!e?.isCell()&&null!==e.row&&null!==e.col&&null!==this.#hZ(e.row,e.col)},group:Ck})}unregisterShortcuts(){this.hot.getShortcutManager().getContext("grid")?.removeShortcutsByGroup(Ck)}#hX(){let e=this.hot.getSettings()[Ck],t=this.#hb;this.#hb=CN(e)&&!0===e.hyperlinks,t&&!this.#hb&&this.#hQ()}#hQ(){this.hot.rootElement?.querySelectorAll(`a.${CL}`).forEach(e=>this.#hJ(e))}#hJ(e){let{parentNode:t}=e;for(;e.firstChild;)t?.insertBefore(e.firstChild,e);e.remove()}#h0(e){if(null===e.firstElementChild)return;let t=e.querySelector(`a.${CL}`);for(;null!==t;)this.#hJ(t),t=e.querySelector(`a.${CL}`)}#hZ(e,t){if(null===this.sheetName||!this.engine?.doesSheetExist(this.sheetName)||!this.rowAxisSyncer||!this.columnAxisSyncer||!this.isFormulaCellType(e,t))return null;let r=this.engine.getCellHyperlink({sheet:this.sheetId,row:this.rowAxisSyncer.getHfIndexFromVisualIndex(e),col:this.columnAxisSyncer.getHfIndexFromVisualIndex(t)});if(void 0===r)return null;let n=function(e,t){let r;if("string"!=typeof e||""===e.trim())return null;try{r=new URL(e,t)}catch(e){return null}return CT.has(r.protocol)?r.href:null}(r,this.hot.rootDocument.baseURI);return null===n&&tJ(this,"formulas-hyperlink-refused",`A "HYPERLINK" formula points at a URL that Handsontable refuses to link to ("${r}"). Only the "http", "https", "mailto" and "tel" schemes can be linked.`),n}renderDependentSheets(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=new Set;e.forEach(e=>{let t=Cx(e)?e.address?.sheet:void 0;void 0===t||r.has(t)||r.add(t)}),this.engine&&CC(this.engine).forEach((e,n)=>{(t||n!==this.sheetId)&&r.has(n)&&(e.render(),e.view?.adjustElementsSize())})}validateDependentCells(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=e=>{let{row:t,col:r,sheet:n}=(Cx(e)?e.address:void 0)??{};return e_(n)?`${n}:${t}x${r}`:""},n=new Set(t.map(e=>r(e)));e.forEach(e=>{let{row:t,col:o,sheet:i}=(Cx(e)?e.address:void 0)??{};if(void 0===t||void 0===o||t>=this.hot.countRows()||o>=this.hot.countCols())return;let s=r(e);if(void 0!==i&&!n.has(s)&&this.engine){let e=CC(this.engine).get(i);if(!e)return;e.validateCell(e.getDataAtCell(t,o),e.getCellMeta(t,o),()=>{})}})}#h1(e,t,r){"UndoRedo.undo"!==t&&"UndoRedo.redo"!==t||!e?.length||(this.#hM=!0,r&&e.forEach(e=>{let[t,r]=e;if("string"!=typeof r&&"number"!=typeof r)return;let n=this.hot.propToCol(r);if(!oS(t)||!oS(n))return;let o=this.rowAxisSyncer.getHfIndexFromVisualIndex(t),i=this.columnAxisSyncer.getHfIndexFromVisualIndex(n);-1!==o&&-1!==i&&this.#hA.push({address:{row:o,col:i,sheet:this.sheetId}})}))}#hG(){let e=this.#hT,t=this.#hA,r=this.#hM;this.#hT=[],this.#hA=[],this.#hM=!1,r&&e.length&&this.validateDependentCells(e,t)}syncChangeWithEngine(e,t,r){let n={row:this.rowAxisSyncer.getHfIndexFromVisualIndex(e),col:this.columnAxisSyncer.getHfIndexFromVisualIndex(t),sheet:this.sheetId};if(!this.engine?.isItPossibleToSetCellContents(n))return void tQ(`Not possible to set cell data at ${JSON.stringify(n)}`);let o=this.hot.getCellMetaTransient(e,t);if(Cw(r,o.type))if(cA(r));else{var i;!1===("string"==typeof(i=r)&&i.startsWith("="))&&(r=`'${r}`)}return this.engine?.setCellContents(n,r)}#h2(e,t,r){if(tc(r)&&null!==r){let n=this.hot.toVisualRow(e),o=this.hot.toVisualColumn(t),i=this.hot.getCellMetaTransient(n,o);null!=(r=n1(r,i))&&(r=Object(r).toString())}return CE(r)}#hD(e,t,r,n){let o,i=this.#hE;this.#hE=!0;try{o=this.hot.getSourceDataArray(e,t,r,n)}finally{this.#hE=i}let s=this.hot.countCols();if(!(s<this.hot.countSourceCols()&&Array.isArray(this.hot.getSourceDataAtRow(0))))return o.map((e,t)=>(Array.isArray(e)?e:[]).map((e,r)=>this.#h2(t,r,e)));let a=t??0;return o.map((e,t)=>{let r=Array.isArray(e)?e:[],n=[];for(let e=0;e<s;e++){let o=this.hot.colToProp(e);if("number"!=typeof o)continue;let i=o-a;i<0||i>=r.length||n.push(this.#h2(t,e,r[i]))}return n})}#hU=(e,t,r)=>{let n=this.hot.propToCol(r);if(this.isFormulaCellType(t,n)){let e={row:this.rowAxisSyncer.getHfIndexFromVisualIndex(t),col:this.columnAxisSyncer.getHfIndexFromVisualIndex(n),sheet:this.sheetId},r=this.hot.getCellMetaTransient(t,n),o=this.engine.getCellValue(e);return"date"===r.type&&oS(o)?o=Cv(o):"time"===r.type&&oS(o)&&(o=CS(o)),CO(o)?o.value:o}return e};#hY=(e,t,r)=>{let{row:n,col:o}=t.getTopStartCorner(),{row:i,col:s}=t.getBottomEndCorner(),{row:a,col:l}=r.getTopStartCorner(),{row:h,col:d}=r.getBottomEndCorner();if(null===n||null===o||null===i||null===s||null===a||null===l||null===h||null===d)return;let u=this.rowAxisSyncer.getHfIndexFromVisualIndex(n),c=this.columnAxisSyncer.getHfIndexFromVisualIndex(o),g=this.rowAxisSyncer.getHfIndexFromVisualIndex(i),p=this.columnAxisSyncer.getHfIndexFromVisualIndex(s),m=this.rowAxisSyncer.getHfIndexFromVisualIndex(a),f=this.columnAxisSyncer.getHfIndexFromVisualIndex(l),b=this.rowAxisSyncer.getHfIndexFromVisualIndex(h),C=this.columnAxisSyncer.getHfIndexFromVisualIndex(d);if(null===u||null===c||null===g||null===p||null===m||null===f||null===b||null===C)return;let y={start:{row:u,col:c,sheet:this.sheetId},end:{row:g,col:p,sheet:this.sheetId}},w={start:{row:m,col:f,sheet:this.sheetId},end:{row:b,col:C,sheet:this.sheetId}};if(!1===this.engine.isItPossibleToSetCellContents(w))return!1;let S=this.engine.getFillRangeData(y,w),{row:v,col:R}=y.start,{row:E,col:T}=y.end,A=E-v+1,M=T-R+1;for(let e=0;e<S.length;e+=1)for(let t=0;t<S[e].length;t+=1){let r=S[e][t],n=v+e%A,o=R+t%M;Cw(r,this.hot.getCellMeta(n,o).type)&&(r.startsWith("'")?S[e][t]=r.slice(1):!1===this.isFormulaCellType(n,o,this.sheetId)&&(S[e][t]=r))}return S};#hF=(()=>{var e=this;return function(t,r){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";n.includes(oa(Ck))||(e.#hC=eL(e.hot.getSettings().data))}})();#hW=()=>{if(this.#hC){null!==this.sheetName&&this.switchSheet(this.sheetName);return}let e=this.#hD();e.forEach((t,r)=>{t.forEach((t,n)=>{Cw(t,this.hot._getMetaManager().getCellMetaUncached(this.hot.toPhysicalRow(r)??r,this.hot.toPhysicalColumn(n)??n,{visualRow:r,visualColumn:n}).type)&&(cA(t)?e[r][n]=t:t.startsWith("=")||(e[r][n]=`'${t}`))})}),this.#hf=!0;let t=this.engine.setSheetContent(this.sheetId,e);this.indexSyncer.setupSyncEndpoint(this.engine,this.sheetId),this.renderDependentSheets(t),this.#hf=!1};#oP=(()=>{var e=this;return function(t,r){var n,o;let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(i.includes(oa(Ck))||!e.engine)return;let s=e.hot.getSettings()[Ck],a=CN(s)?s.sheetName:void 0,l=(n=e.engine,null==(o=a??e.sheetName)?n.addSheet():n.doesSheetExist(o)?o:n.addSheet(o));if(e.#h_(l),"updateSettings"!==i)if(e.#hC)null!==e.sheetName&&e.switchSheet(e.sheetName);else{let t=e.#hD();if(e.engine.isItPossibleToReplaceSheetContent(e.sheetId,t)){e.#hf=!0;let r=e.engine.setSheetContent(e.sheetId,t);e.indexSyncer.setupSyncEndpoint(e.engine,e.sheetId),e.renderDependentSheets(r),e.#hf=!1}else{e.#hf=!0;let t=e.engine.setSheetContent(e.sheetId,[[]]);e.renderDependentSheets(t),e.#hf=!1,tQ("The loaded data could not be passed to the formula engine, so the formulas were cleared. It most likely exceeds the engine's `maxRows` or `maxColumns` limit.")}}}})();#hB=(e,t,r,n)=>{if("get"!==n||this.#hf||null===this.sheetName||!this.engine?.doesSheetExist(this.sheetName)||null===e||null===t)return;let o=this.getCellType(e,t);if("VALUE"===o||"EMPTY"===o){var i,s;r.value="string"==typeof(i=r.value)&&"string"==typeof(s=i)&&"'"===s.charAt(0)&&"="===s.charAt(1)?i.substr(1):i;return}let a={row:this.rowAxisSyncer.getHfIndexFromVisualIndex(e),col:this.columnAxisSyncer.getHfIndexFromVisualIndex(t),sheet:this.sheetId},l=this.engine.getCellValue(a),h=this.hot._getMetaManager().getCellMetaUncached(this.hot.toPhysicalRow(e)??e,this.hot.toPhysicalColumn(t)??t,{visualRow:e,visualColumn:t});"date"===h.type&&oS(l)?l=Cv(l):"time"===h.type&&oS(l)&&(l=CS(l)),r.value=CO(l)?l.value:l};#hK=(e,t,r)=>{if(!this.#hb||this.#hf)return;this.#h0(e);let n=this.#hZ(t,r);if(null===n)return;let o=this.hot.rootDocument.createElement("a");for(o.className=CL,o.href=n,o.target="_blank",o.rel="noopener noreferrer",o.tabIndex=-1;e.firstChild;)o.appendChild(e.firstChild);e.appendChild(o)};#hV=(e,t,r,n)=>{if("get"!==n||this.#hf||this.#hE||null===this.sheetName||!this.engine?.doesSheetExist(this.sheetName))return;let o=this.hot.toVisualRow(e),i=this.hot.propToCol(t);if(null===o||null===i)return;let s=this.getCellType(o,i);if("VALUE"===s||"EMPTY"===s)return;let a=this.engine.getSheetDimensions(this.engine.getSheetId(this.sheetName));if(0===a.width&&0===a.height)return;let l={row:this.rowAxisSyncer.getHfIndexFromVisualIndex(o),col:this.columnAxisSyncer.getHfIndexFromVisualIndex(i),sheet:this.sheetId};r.value=this.engine.getCellSerialized(l)};#hz=(e,t)=>{if(C_(t))return void this.#h1(e,t,!0);if(this.#hR||!e?.length)return;let r=[],n=[],o=this.engine.batch(()=>{e.forEach(e=>{let[t,o,,i]=e;if("string"!=typeof o&&"number"!=typeof o)return;let s=this.hot.propToCol(o),a=this.hot.toPhysicalRow(t),l=this.hot.toPhysicalColumn(s),h={row:this.rowAxisSyncer.getHfIndexFromVisualIndex(t),col:this.columnAxisSyncer.getHfIndexFromVisualIndex(s),sheet:this.sheetId};i=this.#h2(a,l,i),null!==a&&null!==l?this.syncChangeWithEngine(t,s,i):r.push([t,s,i]),n.push({address:h})})});r.length&&this.hot.addHookOnce("afterChange",()=>{let e=this.engine.batch(()=>{r.forEach(e=>{let[t,r,n]=e;this.syncChangeWithEngine(t,r,n)})});this.renderDependentSheets(e,!0)}),this.renderDependentSheets(o),this.validateDependentCells(o,n)};#oB=(e,t)=>{if(C_(t))return void this.#h1(e,t,!1);if(this.#hR)return;let r=[],n=[];e.forEach(e=>{let[t,o,,i]=e;if("string"!=typeof o&&"number"!=typeof o)return;let s=this.hot.propToCol(o);if(!oS(s))return;let a={row:this.rowAxisSyncer.getHfIndexFromVisualIndex(t),col:this.columnAxisSyncer.getHfIndexFromVisualIndex(s),sheet:this.sheetId};this.engine?.isItPossibleToSetCellContents(a)?(i=CE(i),n.push({address:a}),r.push(...this.engine.setCellContents(a,i))):tQ(`Not possible to set source cell data at ${JSON.stringify(a)}`)}),this.renderDependentSheets(r),this.validateDependentCells(r,n)};#sb=(e,t)=>{let r=this.rowAxisSyncer.getHfIndexFromVisualIndex(e);if(e>=this.hot.countRows()&&(r=e),null===this.sheetId||!this.engine?.doesSheetExist(this.sheetName)||!this.engine?.isItPossibleToAddRows(this.sheetId,[r,t]))return!1};#sS=(e,t)=>{let r=this.columnAxisSyncer.getHfIndexFromVisualIndex(e);if(e>=this.hot.countCols()&&(r=e),null===this.sheetId||!this.engine?.doesSheetExist(this.sheetName)||!this.engine?.isItPossibleToAddColumns(this.sheetId,[r,t]))return!1};#sy=(e,t,r)=>!1!==this.rowAxisSyncer.setRemovedHfIndexes(r).every(e=>this.engine?.isItPossibleToRemoveRows(this.sheetId,[e,1]))&&void 0;#sR=(e,t,r)=>!1!==this.columnAxisSyncer.setRemovedHfIndexes(r).every(e=>this.engine?.isItPossibleToRemoveColumns(this.sheetId,[e,1]))&&void 0;#sC=(e,t,r)=>{if(C_(r))return;let n=this.engine.addRows(this.sheetId,[this.rowAxisSyncer.getHfIndexFromVisualIndex(e),t]);this.renderDependentSheets(n)};#sv=(e,t,r)=>{if(C_(r))return;let n=this.engine.addColumns(this.sheetId,[this.columnAxisSyncer.getHfIndexFromVisualIndex(e),t]);this.renderDependentSheets(n)};#sw=(e,t,r,n)=>{if(C_(n))return;let o=CR(this.rowAxisSyncer.getRemovedHfIndexes()),i=this.engine.batch(()=>{this.#h3(o,"removeRows")});this.renderDependentSheets(i)};#sE=(e,t,r,n)=>{if(C_(n))return;let o=CR(this.columnAxisSyncer.getRemovedHfIndexes()),i=this.engine.batch(()=>{this.#h3(o,"removeColumns")});this.renderDependentSheets(i)};#h6(e,t,r){let n=e.getHfIndexFromVisualIndex(t);if(n<0)return!1;for(let o=1;o<=r-t;o++)if(e.getHfIndexFromVisualIndex(t+o)!==n+o)return!1;return!0}#hj=(e,t,r)=>{if(!i3(e))return this.#hy=null,!1;if(!this.engine||null===this.sheetId)return;let n=e.getTopStartCorner(),o=e.getBottomEndCorner(),i=n.row,s=n.col,a=o.row,l=o.col,h=t.row,d=t.col;if(!this.#h6(this.rowAxisSyncer,i,a)||!this.#h6(this.columnAxisSyncer,s,l)||!this.#h6(this.rowAxisSyncer,h,h+(a-i))||!this.#h6(this.columnAxisSyncer,d,d+(l-s)))return this.#hy=null,!1;let u=this.rowAxisSyncer.getHfIndexFromVisualIndex(i),c=this.columnAxisSyncer.getHfIndexFromVisualIndex(s),g=this.rowAxisSyncer.getHfIndexFromVisualIndex(a),p=this.columnAxisSyncer.getHfIndexFromVisualIndex(l),m=this.rowAxisSyncer.getHfIndexFromVisualIndex(h),f=this.columnAxisSyncer.getHfIndexFromVisualIndex(d),b={start:{sheet:this.sheetId,row:u,col:c},end:{sheet:this.sheetId,row:g,col:p}},C={sheet:this.sheetId,row:m,col:f};if(!r&&!this.engine.isItPossibleToMoveCells(b,C))return this.#hy=null,!1;if(r){let e={start:C,end:{sheet:this.sheetId,row:m+(g-u),col:f+(p-c)}};if(!this.engine.isItPossibleToSetCellContents(e))return this.#hy=null,!1}this.#hy={source:b,dest:C,isCopy:r,rect:{fromRow:i,fromCol:s,toRow:a,toCol:l,targetRow:h,targetCol:d,isCopy:r}}};commitPendingMoveCells(){if(!this.engine||!this.#hy)return!1;let{source:e,dest:t,isCopy:r,rect:n}=this.#hy;if(this.#hy=null,this.#hv=null,this.indexSyncer?.isPerformingUndoRedo()&&!this.#hS)return this.#hw=n,!0;try{r?(this.engine.copy(e),this.#hv=this.engine.paste(t)):this.#hv=this.engine.batch(()=>{this.engine.moveCells(e,t)})}catch(t){let e=t instanceof Error?t.message:String(t);return tQ(`Formulas: HyperFormula operation failed during ${r?"copy/paste":"moveCells"}: ${e}`),!1}return this.#hw=n,!0}#hq=()=>{let e=this.#hw,t=this.#hv;this.#hw=null,this.#hv=null,this.engine&&null!==e&&(this.#h5(e),null!==t&&this.renderDependentSheets(t,!0))};#h5(e){let{fromRow:t,fromCol:r,toRow:n,toCol:o,targetRow:i,targetCol:s,isCopy:a}=e,l=n-t+1,h=o-r+1,d=[];for(let e=0;e<l;e++){let t=[];for(let r=0;r<h;r++){let n=this.rowAxisSyncer.getHfIndexFromVisualIndex(i+e),o=this.columnAxisSyncer.getHfIndexFromVisualIndex(s+r),a=this.engine.getCellSerialized({sheet:this.sheetId,row:n,col:o});t.push(a??null)}d.push(t)}this.#hR=!0;try{if(!a){let e=Array.from({length:h}).fill(null),i=Array.from({length:l},()=>e.slice());this.hot.populateFromArray(t,r,i,n,o,"auto")}this.hot.populateFromArray(i,s,d,i+l-1,s+h-1,"auto")}finally{this.#hR=!1}}#h3(e,t){for(let r=e.length;r>0;r-=1e3){let n=e.slice(Math.max(0,r-1e3),r);"removeRows"===t?this.engine.removeRows(this.sheetId,...n):this.engine.removeColumns(this.sheetId,...n)}}#h$=(e,t,r)=>{this.#hf=!0;let n=t.__children,o=Array.isArray(n)?n.length:0,i=this.#hD(r,0,r+o,this.hot.countSourceCols());this.#hf=!1,i.forEach((e,t)=>{e.forEach((e,n)=>{this.engine?.setCellContents({col:n,row:r+t,sheet:this.sheetId},[[e]])})})}}nF.getSingleton().register("beforeHideColumns"),nF.getSingleton().register("afterHideColumns"),nF.getSingleton().register("beforeUnhideColumns"),nF.getSingleton().register("afterUnhideColumns");let CD="hiddenColumns",CF=Symbol("skipColumnOnPasteByHiddenColumns");nF.getSingleton().register("beforeHideRows"),nF.getSingleton().register("afterHideRows"),nF.getSingleton().register("beforeUnhideRows"),nF.getSingleton().register("afterUnhideRows");let CB="hiddenRows",CV=Symbol("skipRowOnPasteByHiddenRows");nF.getSingleton().register("beforeColumnFreeze"),nF.getSingleton().register("afterColumnFreeze"),nF.getSingleton().register("beforeColumnUnfreeze"),nF.getSingleton().register("afterColumnUnfreeze");let CU="manualColumnFreeze",Cz=class{_element=null;state=0;constructor(e){this.hot=e,this.inlineProperty=e.isRtl()?"right":"left"}appendTo(e){e.appendChild(this._element),this.state=2}build(){0===this.state&&(this._element=this.hot.rootDocument.createElement("div"),this.state=1)}destroy(){this.isAppended()&&this._element.parentElement?.removeChild(this._element),this._element=null,this.state=0}isAppended(){return 2===this.state}isBuilt(){return this.state>=1}setPosition(e,t){oS(e)&&(this._element.style.top=e+"px"),oS(t)&&(this._element.style[this.inlineProperty]=t+"px")}getPosition(){let e=this._element.style;return{top:e.top?Number.parseInt(e.top,10):0,start:e[this.inlineProperty]?Number.parseInt(e[this.inlineProperty],10):0}}setSize(e,t){oS(e)&&(this._element.style.width=e+"px"),oS(t)&&(this._element.style.height=t+"px")}getSize(){return{width:this._element.style.width?Number.parseInt(this._element.style.width,10):0,height:this._element.style.height?Number.parseInt(this._element.style.height,10):0}}setOffset(e,t){if(oS(e)&&(this._element.style.marginTop=e+"px"),oS(t)){let e=`margin${oa(this.inlineProperty)}`;this._element.style[e]=t+"px"}}getOffset(){let e=this._element.style,t=`margin${oa(this.inlineProperty)}`;return{top:e.marginTop?Number.parseInt(e.marginTop,10):0,start:e[t]?Number.parseInt(e[t],10):0}}},CW=class extends Cz{build(){super.build(),rd(this._element,"ht__manualColumnMove--backlight")}},CG=class extends Cz{build(){super.build(),rd(this._element,"ht__manualColumnMove--guideline")}};nF.getSingleton().register("beforeColumnMove"),nF.getSingleton().register("afterColumnMove");let C$="manualColumnMove",CY="ht__manualColumnMove",Cj="show-ui",Cq="on-moving--columns",CK="after-selection--columns";class CX extends pa{static get PLUGIN_KEY(){return C$}static get PLUGIN_PRIORITY(){return 120}#h4=new CW(this.hot);#h9=new CG(this.hot);#h7=[];#h8=0;#de=!1;#dt=!1;#dr={x:0,y:0};#dn={};#di;#ds;#da;#dl;#dh;#dd=0;isEnabled(){return!!this.hot.getSettings()[C$]}enablePlugin(){this.enabled||(this.addHook("beforeOnCellMouseDown",this.#o9),this.addHook("beforeOnCellMouseOver",this.#du),this.addHook("beforeOnCellMouseOverOutside",(e,t,r,n)=>this.#dc(n)),this.addHook("afterScrollVertically",this.#dg),this.addHook("afterLoadData",this.#oP),this.buildPluginUI(),this.registerEvents(),rd(this.hot.rootElement,CY),super.enablePlugin())}updatePlugin(){this.disablePlugin(),this.enablePlugin(),this.moveBySettingsOrLoad(),super.updatePlugin()}disablePlugin(){ru(this.hot.rootElement,CY),this.unregisterEvents(),this.#h4.destroy(),this.#h9.destroy(),super.disablePlugin()}moveColumn(e,t){return this.moveColumns([e],t)}moveColumns(e,t){let r=this.#di,n=this.isMovePossible(e,t),o=this.hot.runHooks("beforeColumnMove",e,t,r,n);if(this.#di=void 0,!1===o)return!1;n&&this.hot.columnIndexMapper.moveIndexes(e,t);let i=n&&this.isColumnOrderChanged(e,t);return this.hot.runHooks("afterColumnMove",e,t,r,n,i),i}dragColumn(e,t){return this.dragColumns([e],t)}dragColumns(e,t){let r=this.countFinalIndex(e,t);return this.#di=t,this.moveColumns(e,r)}isDragging(){return this.enabled&&this.#de&&this.#dt}isMovePossible(e,t){let r=this.hot.columnIndexMapper.getNotTrimmedIndexesLength(),n=e.length+t>r,o=e.some(e=>e<0),i=e.some(e=>e>=r);return!n&&!(t<0)&&!o&&!i}isColumnOrderChanged(e,t){return e.some((e,r)=>e-r!==t)}countFinalIndex(e,t){let r=X(e,(e,r)=>r<t?e+1:e,0);return t-r}getColumnsWidth(e,t){let r=this.hot.columnIndexMapper,n=0;for(let o=e;o<=t;o+=1){let e=r.getRenderableFromVisualIndex(o);o<0?n+=this.hot.view._wt.wtViewport.getRowHeaderWidth()||0:null!==e&&(n+=this.hot.view._wt.wtTable.getColumnWidth(e)||0)}return n}moveBySettingsOrLoad(){let e=this.hot.getSettings()[C$];Array.isArray(e)&&this.moveColumns(e,0)}isFixedColumnsStart(e){return e<(this.hot.getSettings().fixedColumnsStart??0)}prepareColumnsToMoving(e,t){let r=[];return oA(e,t,e=>{r.push(e)}),r}refreshPositions(){let e=this.hot.view.getFirstFullyVisibleColumn()??0,t=this.#ds??0,r=this.#dh??0,n=this.#da??0;this.isFixedColumnsStart(t)&&e>0&&this.hot.scrollViewportTo({col:this.hot.columnIndexMapper.getNearestNotHiddenIndex(e-1,-1)??void 0});let o=this.hot.view._wt.wtTable,i=this.hot.view._wt.wtOverlays.scrollableElement,s=i instanceof Window?i.scrollX:i.scrollLeft,a=this.hot.view.THEAD.offsetLeft+this.getColumnsWidth(0,t-1),l=o.hider.offsetWidth,h=o.TBODY?.offsetLeft??0,d=this.#h4.getOffset().start,u=this.#h4.getSize().width,c=0,g=this.#dp(i,s,n);if(this.#dl){let e=this.hot.view._wt.wtOverlays.inlineStartOverlay.clone;c=e?.wtTable.getColumnHeader(-1)?.offsetWidth??0}this.isFixedColumnsStart(t)&&(a+=s),a+=c,a=this.#dm(t,a,g,e,r);let p=g,m=a;g+u+d>=l?p=l-u-d:g+d<h+c&&(p=h+c+Math.abs(d)),a>=l-1?m=l-1:0===m?m=1:i instanceof Window&&t<r&&(m-=n<=i.scrollX?n:0),this.#h4.setPosition(void 0,p),this.#h9.setPosition(void 0,m)}#dp(e,t,r){if(this.hot.isRtl()){let n=this.hot.rootWindow,o=rF(this.hot.rootElement),i=n.innerWidth-r-o;return n.innerWidth-this.#dn.eventPageX-i-(e instanceof Window?0:t)}return this.#dn.eventPageX-(r-(e instanceof Window?0:t))}#dm(e,t,r,n,o){return e<0?(o>0?this.#dn.col=0:this.#dn.col=n>0?n-1:n,t):this.#df(e,t,r)}#df(e,t,r){let n=t+this.#dn.TD.offsetWidth,o=t,i=e;for(;i<this.#h8;){let e=this.getColumnsWidth(i,i);if(e>0&&r<o+e||o+e>=n){if(e/2+o<=r){let t=i+1;for(;t<this.#h8&&0===this.getColumnsWidth(t,t);)t+=1;return this.#dn.col=t,o+e}break}o+=e,i+=1}return this.#dn.col=i,o}registerEvents(){let{documentElement:e}=this.hot.rootDocument;this.eventManager.addEventListener(e,"mousemove",e=>this.#aV(e)),this.eventManager.addEventListener(e,"mouseup",()=>this.#db())}unregisterEvents(){this.eventManager.clear()}#o9=(e,t,r,n)=>{let o=this.hot.view._wt.wtTable,i=this.hot.selection.isSelectedByColumnHeader(),s=this.hot.getSelectedRangeActive();if(!s||!i||this.#de||0!==e.button){this.#de=!1,this.#dt=!1,this.#h7.length=0,ru(this.hot.rootElement,[Cq,Cj]);return}let a=this.#h9.isBuilt()&&!this.#h9.isAppended(),l=this.#h4.isBuilt()&&!this.#h4.isAppended();a&&l&&(this.#h9.appendTo(o.hider),this.#h4.appendTo(o.hider));let{from:h,to:d}=s,u=Math.min(h.col??0,d.col??0),c=Math.max(h.col??0,d.col??0);if(t.row<0&&t.col>=u&&t.col<=c){n.column=!0,this.#de=!0,this.#dr={x:e.clientX,y:e.clientY};let i=r.firstChild?nk(e,r.firstChild).x:e.offsetX;this.#dn.eventPageX=e.pageX,this.#ds=t.col,this.#dn.TD=r,this.#dn.col=t.col,this.#h7=this.prepareColumnsToMoving(u,c),this.#dl=!!this.hot.getSettings().rowHeaders,this.#h8=this.hot.countCols(),this.#dh=this.hot.getSettings().fixedColumnsStart,this.#da=rE(this.hot.rootElement).left;let s=this.#dl?-1:0;this.#dd=this.#dC(t.row+o.getColumnHeadersCount());let a=o.holder.scrollTop+this.#dd+1,l=t.col<(this.#dh??0),h=this.hot.view._wt.wtOverlays.inlineStartOverlay.getOverlayOffset(),d=Math.abs(i-(this.hot.isRtl()?r.offsetWidth:0)),g=this.getColumnsWidth(u,t.col-1)+d,p=this.getColumnsWidth(s,u-1)+(l?h:0)+g;this.#h4.setPosition(a,p),this.#h4.setSize(this.getColumnsWidth(u,c),o.hider.offsetHeight-a),this.#h4.setOffset(0,-g),this.#dt=!1,rd(this.hot.rootElement,Cq)}else ru(this.hot.rootElement,CK),this.#de=!1,this.#dt=!1,this.#h7.length=0};#aV(e){this.#de&&((Math.abs(e.clientX-this.#dr.x)>3||Math.abs(e.clientY-this.#dr.y)>3)&&(this.#dt=!0),this.#dn.eventPageX=e.pageX,this.refreshPositions())}#du=(e,t,r,n)=>{this.hot.getSelectedRangeActive()&&this.#de&&(this.#h7.indexOf(t.col)>-1?ru(this.hot.rootElement,Cj):rd(this.hot.rootElement,Cj),n.row=!0,n.column=!0,n.cell=!0,this.#ds=t.col,this.#dn.TD=r)};#dc(e){this.#de&&(e.row=!0,e.column=!0,e.cell=!0)}#db(){let e=this.#dn.col,t=this.#h7.length,r=this.#dt;if(this.#ds=void 0,this.#de=!1,this.#dt=!1,ru(this.hot.rootElement,[Cq,Cj,CK]),this.hot.selection.isSelectedByColumnHeader()&&rd(this.hot.rootElement,CK),!r||t<1||void 0===e){this.#h7.length=0;return}let n=this.#h7[0],o=this.hot.toPhysicalColumn(n),i=this.dragColumns(this.#h7,e);if(this.#h7.length=0,!0===i){this.hot.view.adjustElementsSize(),this.hot.render();let e=this.hot.toVisualColumn(o);this.hot.selectColumns(e,e+t-1)}}#dg=()=>{let e=this.hot.view._wt.wtTable,t=this.#dd+1+e.holder.scrollTop;this.#h4.setPosition(t),this.#h4.setSize(void 0,e.hider.offsetHeight-t)};#dC(e){let t=this.hot.view._wt.wtTable,r=0;for(let n=0;n<e;n++)r+=t.getColumnHeaderHeight(n);return r}buildPluginUI(){this.#h4.build(),this.#h9.build()}#oP=()=>{this.moveBySettingsOrLoad()};destroy(){this.#h4.destroy(),this.#h9.destroy(),super.destroy()}}function CQ(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"horizontal",r=e.getBoundingClientRect(),n="vertical"===t?r.height:r.width,o="vertical"===t?e.offsetHeight:e.offsetWidth;if(!Number.isFinite(n)||!Number.isFinite(o)||n<=0||o<=0||n>=o&&n-o<=1)return 1;let i=n/o;return Number.isFinite(i)&&i>0?i:1}function CZ(e,t){return!Number.isFinite(t)||t<=0?e:Math.round(e/t)}function CJ(e,t){return!e.parentNode||t>1}function C0(e,t){return!!e?.parentNode&&t>=2}let C1="manualColumnResize";class C2 extends pa{static get PLUGIN_KEY(){return C1}static get PLUGIN_PRIORITY(){return 130}#dy=null;#dw=null;#dS=[];#dv=null;#dR=null;#dE=null;#dT=null;#dA=null;#dM=1;#dI=this.hot.rootDocument.createElement("DIV");#dx=this.hot.rootDocument.createElement("DIV");#de=null;#dN=!1;#dO=0;#dk=null;#dH;#o_=null;#d_;constructor(e){super(e),rd(this.#dI,"manualColumnResizer"),rd(this.#dx,"manualColumnResizerGuide")}get inlineDir(){return this.hot.isRtl()?"right":"left"}isEnabled(){return!!this.hot.getSettings()[C1]}enablePlugin(){this.enabled||(this.#dH=this.hot.columnIndexMapper.createAndRegisterIndexMap(this.pluginName,"physicalIndexToValue",null,{skipUnchangedWrites:!0}),this.#dH.addLocalHook("init",()=>this.#dL()),this.hot.columnIndexMapper.getNumberOfIndexes()>0&&this.#dL(),this.#o_=this.hot.columnIndexMapper.observeMapChange(this.#dH,()=>{this.hot.view?.invalidateColumnWidthCache()}),this.addHook("modifyColWidth",this.#dP,1),this.addHook("beforeStretchingColumnWidth",this.#dD,1),this.addHook("beforeColumnResize",this.#oL),this.bindEvents(),super.enablePlugin())}updatePlugin(){this.disablePlugin(),this.enablePlugin(),super.updatePlugin()}disablePlugin(){this.#o_&&(this.#o_(),this.#o_=null),this.#d_=this.#dH.getValues(),this.hot.columnIndexMapper.unregisterMap(this.pluginName),super.disablePlugin()}saveManualColumnWidths(){t2("ManualColumnResize.saveManualColumnWidths","`saveManualColumnWidths()` is deprecated and will be removed in Handsontable 19.0.0. The PersistentState plugin has been removed.")}loadManualColumnWidths(){return t2("ManualColumnResize.loadManualColumnWidths","`loadManualColumnWidths()` is deprecated and will be removed in Handsontable 19.0.0. The PersistentState plugin has been removed."),[]}setManualSize(e,t){let r=Math.max(t,20),n=this.hot.toPhysicalColumn(e);return this.#dH.setValueAtIndex(n,r),r}clearManualSize(e){let t=this.hot.toPhysicalColumn(e);this.#dH.setValueAtIndex(t,null)}#dL(){let e=this.hot.getSettings()[C1];Array.isArray(e)?(this.hot.batchExecution(()=>{e.forEach((e,t)=>{this.#dH.setValueAtIndex(t,e)})},!0),this.#d_=e):!0===e&&Array.isArray(this.#d_)&&this.hot.batchExecution(()=>{this.#d_.forEach((e,t)=>{this.#dH.setValueAtIndex(t,e)})},!0)}setupHandlePosition(e){let t;if(CJ(e,this.#dO))return;this.#dy=e;let{_wt:r}=this.hot.view,n=r.wtTable.getCoords(this.#dy);if(!n)return;let o=n.col;if(null===o||o<0)return;let i=rB(this.#dy),s=o<r.getSetting("fixedColumnsStart"),a=n.row??0,l=n.col??0;s&&(t=r.wtOverlays.topInlineStartCornerOverlay.getRelativeCellPosition(this.#dy,a,l)),t||(t=r.wtOverlays.topOverlay.getRelativeCellPosition(this.#dy,a,l)),this.#dw=this.hot.columnIndexMapper.getVisualFromRenderableIndex(o),this.#dS=[];let h=this.hot.selection.isSelectedByCorner()||this.hot.selection.isSelectedByColumnHeader();if(this.hot.selection.isSelected()&&h){let e=this.hot.getSelectedRange()??[],t=new Set;J(e,e=>{let r=e.getTopStartCorner().col,n=e.getBottomEndCorner().col;null!==r&&null!==n&&oA(r,n,e=>{t.has(e)||(t.add(e),this.#dS.push(e))})})}null===this.#dw||(this.#dS.includes(this.#dw)||(this.#dS=[this.#dw]),t&&(this.#dA=t.start-6,this.#dT=rF(this.#dy),this.#dM=CQ(this.#dy),this.#dI.style.top=`${t.top}px`,this.#dI.style[this.inlineDir]=`${this.#dA+this.#dT}px`,this.#dI.style.height=`${i}px`,this.hot.rootElement.appendChild(this.#dI)))}refreshHandlePosition(){this.#dI.style[this.inlineDir]=`${(this.#dA??0)+(this.#dv??0)}px`}setupGuidePosition(){let e=rB(this.#dI),t=Number.parseInt(this.#dI.style.top,10)+e,r=this.hot.view.getTableHeight();rd(this.#dI,"active"),rd(this.#dx,"active"),this.#dx.style.top=`${t}px`,this.refreshGuidePosition(),this.#dx.style.height=`${r-e}px`,this.hot.rootElement.appendChild(this.#dx)}refreshGuidePosition(){this.#dx.style[this.inlineDir]=this.#dI.style[this.inlineDir]}hideHandleAndGuide(){ru(this.#dI,"active"),ru(this.#dx,"active")}checkIfColumnHeader(e){let t=re(e,["THEAD"],this.hot.rootElement),{topOverlay:r,topInlineStartCornerOverlay:n}=this.hot.view._wt.wtOverlays;return[r.clone.wtTable.THEAD,n.clone.wtTable.THEAD].includes(t)}getClosestTHParent(e){return"TABLE"!==e.tagName?"TH"===e.tagName?e:this.getClosestTHParent(e.parentNode):null}#dF(e){if(!r5(t4(e))&&!0!==this.#dN&&this.checkIfColumnHeader(t4(e))){let t=this.getClosestTHParent(t4(e));if(!t)return;let r=t.getAttribute("colspan");t&&(null===r||"1"===r)&&!this.#de&&this.setupHandlePosition(t)}}afterMouseDownTimeout(){let e=C0(this.#dy,this.#dO),t=()=>{this.hot.view.adjustElementsSize(),this.hot.render()},r=(e,r)=>{let n=this.hot.runHooks("beforeColumnResize",this.#dR,e,!0);!1!==n&&("number"==typeof n&&(this.#dR=n),this.setManualSize(e,this.#dR??0),this.hot.runHooks("afterColumnResize",this.#dR,e,!0),r&&t())};this.#dO>=2&&(this.#dS.length>1?(J(this.#dS,e=>{r(e)}),t()):J(this.#dS,e=>{r(e,!0)})),this.#dk=null,this.#dO=0,e&&this.#dy&&this.setupHandlePosition(this.#dy)}#dB(e){t4(e).parentNode===this.hot.rootElement&&rh(t4(e),"manualColumnResizer")&&this.#dy&&(this.setupHandlePosition(this.#dy),this.setupGuidePosition(),this.#de=!0,null===this.#dk&&(this.#dk=this.hot._registerTimeout(()=>this.afterMouseDownTimeout(),500)),this.#dO+=1,this.startX=e.pageX,this.#dR=this.#dT)}#aV(e){if(this.#de){let t=CZ((e.pageX-this.startX)*this.hot.getDirectionFactor(),this.#dM);this.#dv=(this.#dT??0)+t,J(this.#dS,e=>{this.#dR=this.setManualSize(e,this.#dv??0)}),this.refreshHandlePosition(),this.refreshGuidePosition()}}#db(){let e=()=>{this.hot.view.adjustElementsSize(),this.hot.render()},t=(t,r)=>{let n=this.hot.runHooks("beforeColumnResize",this.#dR,t,!1);!1===n?(this.setManualSize(t,this.#dT??0),this.#dR=this.#dT):"number"==typeof n&&(this.#dR=n,this.setManualSize(t,this.#dR)),r&&e(),!1!==n&&this.hot.runHooks("afterColumnResize",this.#dR,t,!1)};this.#de&&(this.hideHandleAndGuide(),this.#de=!1,this.#dR!==this.#dT&&(this.#dS.length>1?(J(this.#dS,e=>{t(e)}),e()):J(this.#dS,e=>{t(e,!0)})),this.#dy&&this.setupHandlePosition(this.#dy))}#dV(){this.hideHandleAndGuide(),this.hot.rootElement.removeChild(this.#dI),this.hot.rootElement.removeChild(this.#dx),this.#de=!1,this.#dN=!0,this.hot._registerMicrotask(()=>{this.#dN=!1})}bindEvents(){let{rootWindow:e,rootElement:t}=this.hot;this.eventManager.addEventListener(t,"mouseover",e=>this.#dF(e)),this.eventManager.addEventListener(t,"mousedown",e=>this.#dB(e)),this.eventManager.addEventListener(e,"mousemove",e=>this.#aV(e)),this.eventManager.addEventListener(e,"mouseup",()=>this.#db()),this.eventManager.addEventListener(this.#dI,"contextmenu",()=>this.#dV())}#dP=(e,t)=>{let r=e;if(this.enabled){let e=this.hot.toPhysicalColumn(t),n=this.#dH.getValueAtIndex(e);this.hot.getSettings()[C1]&&n&&(r=n)}return r};#dD=(e,t)=>{let r=this.#dH.getValueAtIndex(this.hot.toPhysicalColumn(t));return"number"==typeof r?r:e};#oL=()=>{this.hot.view._wt.wtViewport.resetHasOversizedColumnHeadersMarked()};destroy(){super.destroy()}}let C3=class{_element=null;state=0;constructor(e){this.hot=e}appendTo(e){e.appendChild(this._element),this.state=2}build(){0===this.state&&(this._element=this.hot.rootDocument.createElement("div"),this.state=1)}destroy(){this.isAppended()&&this._element.parentElement?.removeChild(this._element),this._element=null,this.state=0}isAppended(){return 2===this.state}isBuilt(){return this.state>=1}setPosition(e,t){null!=e&&(this._element.style.top=e+"px"),null!=t&&(this._element.style.left=t+"px")}getPosition(){return{top:this._element.style.top?Number.parseInt(this._element.style.top,10):0,left:this._element.style.left?Number.parseInt(this._element.style.left,10):0}}setSize(e,t){e&&(this._element.style.width=e+"px"),t&&(this._element.style.height=t+"px")}getSize(){return{width:this._element.style.width?Number.parseInt(this._element.style.width,10):0,height:this._element.style.height?Number.parseInt(this._element.style.height,10):0}}setOffset(e,t){e&&(this._element.style.marginTop=e+"px"),t&&(this._element.style.marginLeft=t+"px")}getOffset(){return{top:this._element.style.marginTop?Number.parseInt(this._element.style.marginTop,10):0,left:this._element.style.marginLeft?Number.parseInt(this._element.style.marginLeft,10):0}}},C6=class extends C3{build(){super.build(),rd(this._element,"ht__manualRowMove--backlight")}},C5=class extends C3{build(){super.build(),rd(this._element,"ht__manualRowMove--guideline")}};nF.getSingleton().register("beforeRowMove"),nF.getSingleton().register("afterRowMove");let C4="manualRowMove",C9="ht__manualRowMove",C7="show-ui",C8="on-moving--rows",ye="after-selection--rows";class yt extends pa{static get PLUGIN_KEY(){return C4}static get PLUGIN_PRIORITY(){return 140}static get SETTING_KEYS(){return[C4]}#h4=new C6(this.hot);#h9=new C5(this.hot);#dU=[];#de;#dn={};#di;isEnabled(){return!!this.hot.getSettings()[C4]}enablePlugin(){this.enabled||(this.addHook("beforeOnCellMouseDown",this.#o9),this.addHook("beforeOnCellMouseOver",this.#du),this.addHook("beforeOnCellMouseOverOutside",(e,t,r,n)=>this.#dc(n)),this.addHook("afterScrollHorizontally",this.#dz),this.addHook("afterLoadData",this.#oP),this.buildPluginUI(),this.registerEvents(),rd(this.hot.rootElement,C9),super.enablePlugin())}updatePlugin(){this.disablePlugin(),this.enablePlugin(),this.moveBySettingsOrLoad(),super.updatePlugin()}disablePlugin(){ru(this.hot.rootElement,C9),this.unregisterEvents(),this.#h4.destroy(),this.#h9.destroy(),super.disablePlugin()}moveRow(e,t){return this.moveRows([e],t)}moveRows(e,t){let r=this.#di,n=this.isMovePossible(e,t),o=this.hot.runHooks("beforeRowMove",e,t,r,n);if(this.#di=void 0,!1===o)return!1;n&&this.hot.rowIndexMapper.moveIndexes(e,t);let i=n&&this.isRowOrderChanged(e,t);return this.hot.runHooks("afterRowMove",e,t,r,n,i),i}dragRow(e,t){return this.dragRows([e],t)}dragRows(e,t){let r=this.countFinalIndex(e,t);return this.#di=t,this.moveRows(e,r)}isMovePossible(e,t){let r=this.hot.rowIndexMapper.getNotTrimmedIndexesLength(),n=e.length+t>r,o=e.some(e=>e<0),i=e.some(e=>e>=r);return!n&&!(t<0)&&!o&&!i}isRowOrderChanged(e,t){return e.some((e,r)=>e-r!==t)}countFinalIndex(e,t){let r=X(e,(e,r)=>r<t?e+1:e,0);return t-r}getRowsHeight(e,t){let r=this.hot.rowIndexMapper,n=0;for(let o=e;o<=t;o++){let e=r.getRenderableFromVisualIndex(o);if(null!==e){let t=this.hot.view._wt,r=t?.wtTable?.getRowHeight(e);n+=(null!=r?r:0)||(this.hot.stylesHandler.getDefaultRowHeight()??0)}}return n}moveBySettingsOrLoad(){let e=this.hot.getSettings()[C4];Array.isArray(e)&&this.moveRows(e,0)}isFixedRowTop(e){return e<(this.hot.getSettings().fixedRowsTop??0)}isFixedRowBottom(e){return e>this.hot.countRows()-1-(this.hot.getSettings().fixedRowsBottom??0)}prepareRowsToMoving(){let e=this.hot.getSelectedRangeActive(),t=[];if(!e)return t;let{from:r,to:n}=e;return oA(Math.min(r.row??0,n.row??0),Math.max(r.row??0,n.row??0),e=>{t.push(e)}),t}refreshPositions(){let e=this.#dn.coords,t=this.#dn.TD;if(!e||!t)return;let r=this.hot.getFirstFullyVisibleRow(),n=this.hot.getLastFullyVisibleRow(),o=this.hot.countRows();if(this.isFixedRowTop(e.row)&&r>0){let e=this.hot.rowIndexMapper.getNearestNotHiddenIndex(r-1,-1);null!==e&&this.hot.scrollViewportTo(e)}if(this.isFixedRowBottom(e.row)&&n<o){let e=this.hot.rowIndexMapper.getNearestNotHiddenIndex(n+1,1);null!==e&&this.hot.scrollViewportTo(e,void 0,!0)}let i=this.hot.view._wt.wtTable,s=this.hot.rootElement,a=rE(s),l=rL(s),h=i.holder.scrollTop,d=l instanceof HTMLElement?l.scrollTop:0,u=a.top-d,c=(this.#dn.eventPageY??0)-u+h,g=i.hider.offsetHeight,p=i.TBODY?.offsetTop??0,m=this.#h4.getOffset().top,f=this.#h4.getSize().height,b=t.offsetHeight/2,C=t.offsetHeight,y=this.hot.view.THEAD.offsetHeight+this.getRowsHeight(0,e.row-1),w=c>=y+b;this.isFixedRowTop(e.row)&&(y+=this.hot.view._wt.wtOverlays.topOverlay.getOverlayOffset()),e.row<0?this.#dn.row=r>0?r-1:r:w?(this.#dn.row=e.row+1,y+=0===e.row?C-1:C):this.#dn.row=e.row;let S=c,v=y;c+f+m>=g?S=g-f-m:c+m<p&&(S=p+Math.abs(m)),y>=g-1&&(v=g-1),this.#h4.setPosition(S),this.#h9.setPosition(v)}registerEvents(){let{documentElement:e}=this.hot.rootDocument;this.eventManager.addEventListener(e,"mousemove",e=>this.#aV(e)),this.eventManager.addEventListener(e,"mouseup",()=>this.#db())}unregisterEvents(){this.eventManager.clear()}#o9=(e,t,r,n)=>{let{wtTable:o,wtViewport:i}=this.hot.view._wt,s=this.hot.selection.isSelectedByRowHeader(),a=this.hot.getSelectedRangeActive();if(!a||!s||this.#de||0!==e.button){this.#de=!1,this.#dU.length=0,ru(this.hot.rootElement,[C8,C7]);return}let l=this.#h9.isBuilt()&&!this.#h9.isAppended(),h=this.#h4.isBuilt()&&!this.#h4.isAppended();l&&h&&(this.#h9.appendTo(o.hider),this.#h4.appendTo(o.hider));let{from:d,to:u}=a,c=Math.min(d.row??0,u.row??0),g=Math.max(d.row??0,u.row??0);if(t.col<0&&t.row>=c&&t.row<=g){n.row=!0,this.#de=!0,this.#dn.eventPageY=e.pageY,this.#dn.coords=t,this.#dn.TD=r,this.#dU=this.prepareRowsToMoving();let s=o.holder.scrollLeft+i.getRowHeaderWidth(),a=this.getRowsHeight(c,t.row-1)+(e.clientY-r.getBoundingClientRect().top);this.#h4.setPosition(null,s),this.#h4.setSize(o.hider.offsetWidth-s,this.getRowsHeight(c,g)),this.#h4.setOffset(-a,null),rd(this.hot.rootElement,C8),this.refreshPositions()}else ru(this.hot.rootElement,ye),this.#de=!1,this.#dU.length=0};#aV(e){this.#de&&(this.#dn.eventPageY=e.pageY,this.refreshPositions())}#du=(e,t,r,n)=>{this.hot.getSelectedRangeActive()&&this.#de&&(this.#dU.indexOf(t.row)>-1?ru(this.hot.rootElement,C7):rd(this.hot.rootElement,C7),n.row=!0,n.column=!0,n.cell=!0,this.#dn.coords=t,this.#dn.TD=r)};#dc(e){this.#de&&(e.row=!0,e.column=!0,e.cell=!0)}#db(){let e=this.#dn.row,t=this.#dU.length;if(this.#de=!1,ru(this.hot.rootElement,[C8,C7,ye]),this.hot.selection.isSelectedByRowHeader()&&rd(this.hot.rootElement,ye),t<1||void 0===e)return;let r=this.#dU[0],n=this.hot.toPhysicalRow(r),o=this.dragRows(this.#dU,e);if(this.#dU.length=0,!0===o){this.hot.view.adjustElementsSize(),this.hot.render();let e=this.hot.toVisualRow(n);this.hot.selectRows(e,e+t-1)}}#dz=()=>{let e=this.hot.view._wt.wtTable,t=this.hot.view._wt.wtViewport.getRowHeaderWidth()+e.holder.scrollLeft;this.#h4.setPosition(null,t),this.#h4.setSize(e.hider.offsetWidth-t)};buildPluginUI(){this.#h4.build(),this.#h9.build()}#oP=()=>{this.moveBySettingsOrLoad()};destroy(){this.#h4.destroy(),this.#h9.destroy(),super.destroy()}}let yr="manualRowResize";class yn extends pa{static get PLUGIN_KEY(){return yr}static get PLUGIN_PRIORITY(){return 30}#dy=null;#dW=null;#dG=[];#d$=null;#dR=null;#dE=null;#dY=null;#dA=null;#dj=1;#dI=this.hot.rootDocument.createElement("DIV");#dx=this.hot.rootDocument.createElement("DIV");#de=!1;#dN=!1;#dO=0;#dk=null;#dq;#o_=null;#d_;constructor(e){super(e),rd(this.#dI,"manualRowResizer"),rd(this.#dx,"manualRowResizerGuide")}get inlineDir(){return this.hot.isRtl()?"right":"left"}isEnabled(){return!!this.hot.getSettings()[yr]}enablePlugin(){this.enabled||(this.#dq=this.hot.rowIndexMapper.createAndRegisterIndexMap(this.pluginName,"physicalIndexToValue",null,{skipUnchangedWrites:!0}),this.#dq.addLocalHook("init",()=>this.#dL()),this.hot.rowIndexMapper.getNumberOfIndexes()>0&&this.#dL(),this.#o_=this.hot.rowIndexMapper.observeMapChange(this.#dq,()=>{this.hot.view?.invalidateRowHeightCache()}),this.addHook("modifyRowHeight",this.#dK),this.bindEvents(),super.enablePlugin())}updatePlugin(){this.disablePlugin(),this.enablePlugin(),super.updatePlugin()}disablePlugin(){this.#o_&&(this.#o_(),this.#o_=null),this.#d_=this.#dq.getValues(),this.hot.rowIndexMapper.unregisterMap(this.pluginName),super.disablePlugin()}saveManualRowHeights(){t2("ManualRowResize.saveManualRowHeights","`saveManualRowHeights()` is deprecated and will be removed in Handsontable 19.0.0. The PersistentState plugin has been removed.")}loadManualRowHeights(){return t2("ManualRowResize.loadManualRowHeights","`loadManualRowHeights()` is deprecated and will be removed in Handsontable 19.0.0. The PersistentState plugin has been removed."),[]}setManualSize(e,t){let r=this.hot.toPhysicalRow(e),n=Math.max(t,this.hot.stylesHandler.getDefaultRowHeight()??0);return null!==r&&this.#dq.setValueAtIndex(r,n),n}getLastDesiredRowHeight(){return this.#d$??0}setupHandlePosition(e){let t;if(CJ(e,this.#dO))return;this.#dy=e;let{view:r}=this.hot,{_wt:n}=r,o=n.wtTable.getCoords(this.#dy);if(!o)return;let i=o.row;if(null===i||i<0)return;let s=rF(this.#dy),a=i<n.getSetting("fixedRowsTop"),l=i>=r.countNotHiddenRowIndexes(0,1)-n.getSetting("fixedRowsBottom"),h=o.row??0,d=o.col??0;a?t=n.wtOverlays.topInlineStartCornerOverlay.getRelativeCellPosition(this.#dy,h,d):l&&(t=n.wtOverlays.bottomInlineStartCornerOverlay.getRelativeCellPosition(this.#dy,h,d)),t||(t=n.wtOverlays.inlineStartOverlay.getRelativeCellPosition(this.#dy,h,d)),this.#dW=this.hot.rowIndexMapper.getVisualFromRenderableIndex(i),this.#dG=[];let u=this.hot.selection.isSelectedByCorner()||this.hot.selection.isSelectedByRowHeader();if(this.hot.selection.isSelected()&&u){let e=this.hot.getSelectedRange()??[],t=new Set;J(e,e=>{let r=e.getTopStartCorner().row,n=e.getBottomStartCorner().row;null!==r&&null!==n&&oA(r,n,e=>{t.has(e)||(t.add(e),this.#dG.push(e))})})}null===this.#dW||(this.#dG.includes(this.#dW)||(this.#dG=[this.#dW]),t&&(this.#dA=t.top-6,this.#dY=rB(this.#dy),this.#dj=CQ(this.#dy,"vertical"),this.#dI.style.top=`${this.#dA+this.#dY}px`,this.#dI.style[this.inlineDir]=`${t.start}px`,this.#dI.style.width=`${s}px`,this.hot.rootElement.appendChild(this.#dI)))}refreshHandlePosition(){this.#dI.style.top=`${(this.#dA??0)+(this.#d$??0)}px`}setupGuidePosition(){let e=rF(this.#dI),t=Number.parseInt(this.#dI.style[this.inlineDir],10)+e,r=this.hot.view.getTableWidth();rd(this.#dI,"active"),rd(this.#dx,"active"),this.#dx.style.top=this.#dI.style.top,this.#dx.style[this.inlineDir]=`${t}px`,this.#dx.style.width=`${r-e}px`,this.hot.rootElement.appendChild(this.#dx)}refreshGuidePosition(){this.#dx.style.top=this.#dI.style.top}hideHandleAndGuide(){ru(this.#dI,"active"),ru(this.#dx,"active")}checkIfRowHeader(e){let t=re(e,["TBODY"],this.hot.rootElement),{inlineStartOverlay:r,topInlineStartCornerOverlay:n,bottomInlineStartCornerOverlay:o}=this.hot.view._wt.wtOverlays;return[r.clone?.wtTable.TBODY,n.clone?.wtTable.TBODY,o.clone?.wtTable.TBODY].includes(t)}getClosestTHParent(e){return"TABLE"!==e.tagName?"TH"===e.tagName?e:this.getClosestTHParent(e.parentNode):null}getActualRowHeight(e){let t=this.hot.view._wt.wtTable.getRowHeight(e);return void 0!==t&&null!==this.#dR&&this.#dR<t?t:this.#dR}#dF(e){if(!r5(t4(e))&&!0!==this.#dN&&this.checkIfRowHeader(t4(e))){let t=this.getClosestTHParent(t4(e));t&&!this.#de&&this.setupHandlePosition(t)}}afterMouseDownTimeout(){let e=C0(this.#dy,this.#dO),t=()=>{this.hot.view.adjustElementsSize(),this.hot.render()},r=(e,r)=>{let n=this.hot.runHooks("beforeRowResize",this.getActualRowHeight(e),e,!0);!1!==n&&("number"==typeof n&&(this.#dR=n),this.setManualSize(e,this.#dR),this.hot.runHooks("afterRowResize",this.getActualRowHeight(e),e,!0),r&&t())};this.#dO>=2&&(this.#dG.length>1?(J(this.#dG,e=>{r(e)}),t()):J(this.#dG,e=>{r(e,!0)})),this.#dk=null,this.#dO=0,e&&this.#dy&&this.setupHandlePosition(this.#dy)}#dB(e){t4(e).parentNode===this.hot.rootElement&&rh(t4(e),"manualRowResizer")&&(this.setupHandlePosition(this.#dy),this.setupGuidePosition(),this.#de=!0,null===this.#dk&&(this.#dk=this.hot._registerTimeout(()=>this.afterMouseDownTimeout(),500)),this.#dO+=1,this.#dE=e.pageY,this.#dR=this.#dY)}#aV(e){if(this.#de){let t=CZ(e.pageY-(this.#dE??0),this.#dj);this.#d$=(this.#dY??0)+t,J(this.#dG,e=>{this.#dR=this.setManualSize(e,this.#d$)}),this.refreshHandlePosition(),this.refreshGuidePosition()}}#db(){let e=()=>{this.hot.view.adjustElementsSize(),this.hot.render()},t=(t,r)=>{let n=this.hot.runHooks("beforeRowResize",this.getActualRowHeight(t),t,!1);!1===n?(this.setManualSize(t,this.#dY),this.#dR=this.#dY):"number"==typeof n&&(this.#dR=n,this.setManualSize(t,this.#dR)),r&&e(),!1!==n&&this.hot.runHooks("afterRowResize",this.getActualRowHeight(t),t,!1)};this.#de&&(this.hideHandleAndGuide(),this.#de=!1,this.#dR!==this.#dY&&(this.#dG.length>1?(J(this.#dG,e=>{t(e)}),e()):J(this.#dG,e=>{t(e,!0)})),this.setupHandlePosition(this.#dy))}#dV(){this.hideHandleAndGuide(),this.hot.rootElement.removeChild(this.#dI),this.hot.rootElement.removeChild(this.#dx),this.#de=!1,this.#dN=!0,this.hot._registerMicrotask(()=>{this.#dN=!1})}bindEvents(){let{rootElement:e,rootWindow:t}=this.hot;this.eventManager.addEventListener(e,"mouseover",e=>this.#dF(e)),this.eventManager.addEventListener(e,"mousedown",e=>this.#dB(e)),this.eventManager.addEventListener(t,"mousemove",e=>this.#aV(e)),this.eventManager.addEventListener(t,"mouseup",()=>this.#db()),this.eventManager.addEventListener(this.#dI,"contextmenu",()=>this.#dV())}#dK=(e,t)=>{let r=e;if(this.enabled){let e=this.hot.toPhysicalRow(t),n=this.#dq.getValueAtIndex(e);this.hot.getSettings()[yr]&&n&&(r=this.hot.getPlugin("autoRowSize")?.isEnabled()?Math.max(n,r??0):n)}return r};#dL(){let e=this.hot.getSettings()[yr];this.hot.batchExecution(()=>{Array.isArray(e)?(e.forEach((e,t)=>{this.#dq.setValueAtIndex(t,e)}),this.#d_=e):!0===e&&Array.isArray(this.#d_)&&this.#d_.forEach((e,t)=>{this.#dq.setValueAtIndex(t,e)})},!0)}destroy(){super.destroy()}}let yo=class{row;col;rowspan;colspan;removed=!1;cellCoordsFactory;cellRangeFactory;#dX=null;constructor(e,t,r,n,o,i){this.row=e,this.col=t,this.rowspan=r,this.colspan=n,this.cellCoordsFactory=o,this.cellRangeFactory=i}static NEGATIVE_VALUES_WARNING(e){let{row:t,col:r,rowspan:n,colspan:o}=e;return ec`The merged cell declared with {row: ${t}, col: ${r},\x20
      rowspan: ${n}, colspan: ${o}} contains negative values, which is\x20
      not supported. It will not be added to the collection.`}static IS_OUT_OF_BOUNDS_WARNING(e){let{row:t,col:r}=e;return ec`The merged cell declared at [${t}, ${r}] is positioned\x20
      (or positioned partially) outside of the table range. It was not added to the table, please fix your setup.`}static IS_SINGLE_CELL(e){let{row:t,col:r}=e;return ec`The merged cell declared at [${t}, ${r}] has both "rowspan"\x20
      and "colspan" declared as "1", which makes it a single cell. It cannot be added to the collection.`}static ZERO_SPAN_WARNING(e){let{row:t,col:r}=e;return ec`The merged cell declared at [${t}, ${r}] has "rowspan"\x20
      or "colspan" declared as "0", which is not supported. It cannot be added to the collection.`}static containsNegativeValues(e){let{row:t,col:r,rowspan:n,colspan:o}=e;return t<0||r<0||n<0||o<0}static isSingleCell(e){let{rowspan:t,colspan:r}=e;return 1===r&&1===t}static containsZeroSpan(e){let{rowspan:t,colspan:r}=e;return 0===r||0===t}static isOutOfBounds(e,t,r){return e.row<0||e.col<0||e.row>=t||e.row+e.rowspan-1>=t||e.col>=r||e.col+e.colspan-1>=r}normalize(e){let t=e.countRows(),r=e.countCols();this.row<0?this.row=0:this.row>t-1&&(this.row=t-1),this.col<0?this.col=0:this.col>r-1&&(this.col=r-1),this.row+this.rowspan>t-1&&(this.rowspan=t-this.row),this.col+this.colspan>r-1&&(this.colspan=r-this.col),this.#dX=null}includes(e,t){return this.row<=e&&this.col<=t&&this.row+this.rowspan-1>=e&&this.col+this.colspan-1>=t}includesHorizontally(e){return this.col<=e&&this.col+this.colspan-1>=e}includesVertically(e){return this.row<=e&&this.row+this.rowspan-1>=e}shift(e,t){let r=e[0]||e[1],n=t+Math.abs(e[0]||e[1])-1,o=e[0]?"colspan":"rowspan",i=e[0]?"col":"row",s=Math.min(t,n),a=Math.max(t,n),l=this[i],h=this[i]+this[o]-1;if(l>=t&&(this[i]+=r),r>0)t<=h&&t>l&&(this[o]+=r);else if(r<0)if(s<=l&&a>=h)return this.removed=!0,this.#dX=null,!1;else if(l>=s&&l<=a){let e=a-l+1,t=Math.abs(r)-e;this[i]-=t+r,this[o]-=e}else l<=s&&h>=a?this[o]+=r:l<=s&&h>=s&&h<a&&(this[o]-=h-s+1);return this.#dX=null,!0}isFarther(e,t){return!e||("down"===t?e.row+e.rowspan-1<this.row+this.rowspan-1:"up"===t?e.row>this.row:"right"===t?e.col+e.colspan-1<this.col+this.colspan-1:"left"===t?e.col>this.col:null)}getLastRow(){return this.row+this.rowspan-1}getLastColumn(){return this.col+this.colspan-1}relocate(e,t){this.row=e,this.col=t,this.#dX=null}getRange(){return this.#dX||(this.#dX=this.cellRangeFactory(this.cellCoordsFactory(this.row,this.col),this.cellCoordsFactory(this.row,this.col),this.cellCoordsFactory(this.getLastRow(),this.getLastColumn()))),this.#dX}};class yi{plugin;mergedCells=[];mergedCellsMatrix=new Map;constructor(e){this.plugin=e,this.hot=e.hot}static IS_OVERLAPPING_WARNING(e){let{row:t,col:r}=e;return ec`The merged cell declared at [${t}, ${r}], overlaps\x20
      with the other declared merged cell. The overlapping merged cell was not added to the table, please\x20
      fix your setup.`}get(e,t){return!!this.mergedCellsMatrix.has(e)&&(this.mergedCellsMatrix.get(e).get(t)??!1)}getByRange(e){let{row:t,col:r}=e.getTopStartCorner(),{row:n,col:o}=e.getBottomEndCorner();if(null===t||null===n||null===r||null===o)return!1;let i=this.mergedCells.length,s=!1;for(let e=0;e<i;e++){let i=this.mergedCells[e],{row:a,col:l,rowspan:h,colspan:d}=i;if(a>=t&&a+h-1<=n&&l>=r&&l+d-1<=o){s=i;break}}return s}getByVisualRow(e){let t=this.mergedCellsMatrix.get(e);return t?Array.from(new Set(t.values())):[]}getByVisualColumn(e){let t=[];for(let r=0;r<this.mergedCells.length;r++){let n=this.mergedCells[r];n.col<=e&&e<=n.col+n.colspan-1&&this.get(n.row,n.col)===n&&t.push(n)}return t}filterOverlappingMergeCells(e){let t=new Set;return this.mergedCells.forEach(e=>{let{row:r,col:n,colspan:o,rowspan:i}=e;for(let e=r;e<r+i;e++)for(let r=n;r<n+o;r++)t.add(`r${e},c${r}`)}),e.filter(e=>{let{row:r,col:n,colspan:o,rowspan:i}=e,s=new Set,a=!1;for(let l=r;l<r+i;l++){for(let r=n;r<n+o;r++){let n=`r${l},c${r}`;if(t.has(n)){tQ(yi.IS_OVERLAPPING_WARNING(e)),a=!0;break}s.add(n)}if(a)break}return a||s.forEach(e=>t.add(e)),!a})}getWithinRange(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],{row:r,col:n}=e.getTopStartCorner(),{row:o,col:i}=e.getBottomEndCorner();if(null===r||null===o||null===n||null===i)return[];let s=[];for(let e=0;e<this.mergedCells.length;e++){let a=this.mergedCells[e],{row:l,col:h,rowspan:d,colspan:u}=a;(t?l<=o&&l+d-1>=r&&h<=i&&h+u-1>=n:l>=r&&l<=o&&h>=n&&h<=i)&&this.get(l,h)===a&&s.push(a)}return s.length>1&&s.sort((e,t)=>Math.max(e.row,r)-Math.max(t.row,r)||Math.max(e.col,n)-Math.max(t.col,n)),s}add(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=e.row,n=e.col,o=new yo(r,n,e.rowspan,e.colspan,this.hot._createCellCoords,this.hot._createCellRange),i=this.get(r,n),s=!t&&this.isOverlapping(o);return i||s?(s&&tQ(yi.IS_OVERLAPPING_WARNING(o)),!1):(this.hot&&o.normalize(this.hot),this.mergedCells.push(o),this.#dQ(o),o)}remove(e,t){let r=this.get(e,t),n=r?this.mergedCells.indexOf(r):-1;return!!r&&-1!==n&&(this.mergedCells.splice(n,1),this.#dZ(r),r)}clear(){J(this.mergedCells,e=>{let{row:t,col:r,rowspan:n,colspan:o}=e;oA(t,t+n,e=>{oA(r,r+o,t=>{let r=this.hot.getCell(e,t);r&&(r.removeAttribute("rowspan"),r.removeAttribute("colspan"),r.style.display="")})})}),this.mergedCells.length=0,this.mergedCellsMatrix=new Map}isOverlapping(e){let t=e.getRange();if(!t)return!1;for(let e=0;e<this.mergedCells.length;e++){let r=this.mergedCells[e].getRange();if(r&&r.overlaps(t))return!0}return!1}isFirstRenderableMergedCell(e,t){let r=this.get(e,t);if(!r)return!1;let{row:n,col:o,rowspan:i,colspan:s}=r,a=this.hot.view.getActiveOverlayName(),l=["top","top_inline_start_corner"].includes(a)?0:this.hot.getFirstRenderedVisibleRow(),h=["inline_start","top_inline_start_corner","bottom_inline_start_corner"].includes(a)?0:this.hot.getFirstRenderedVisibleColumn(),d=ox(l,n,n+i-1),u=ox(h,o,o+s-1);return this.hot.rowIndexMapper.getNearestNotHiddenIndex(d,1)===e&&this.hot.columnIndexMapper.getNearestNotHiddenIndex(u,1)===t}getFirstRenderableCoords(e,t){let r=this.get(e,t);if(!r||this.isFirstRenderableMergedCell(e,t))return this.hot._createCellCoords(e,t);let n=this.hot.rowIndexMapper.getNearestNotHiddenIndex(r.row,1)??r.row,o=this.hot.columnIndexMapper.getNearestNotHiddenIndex(r.col,1)??r.col;return this.hot._createCellCoords(n,o)}getStartMostColumnIndex(e,t){return this.#dJ(e,"col",-1,t)}getEndMostColumnIndex(e,t){return this.#dJ(e,"col",1,t)}getTopMostRowIndex(e,t){return this.#dJ(e,"row",-1,t)}getBottomMostRowIndex(e,t){return this.#dJ(e,"row",1,t)}#d0(e,t,r){let{row:n,col:o}=e.getTopStartCorner(),{row:i,col:s}=e.getBottomEndCorner(),a=n??0,l=o??0,h=i??0,d=s??0,u="row"===t,c=u?a:l,g=u?h:d,p=u?l:a,m=u?d:h,f=new Map;for(let e=0;e<this.mergedCells.length;e++){let t=this.mergedCells[e],n=u?t.row:t.col,o=n+(u?t.rowspan:t.colspan)-1,i=u?t.col:t.row,s=i+(u?t.colspan:t.rowspan)-1;if(o<c||n>g||s<p||i>m||this.get(t.row,t.col)!==t)continue;let a=1===r?o:n,l=Math.min(s,m)-Math.max(i,p)+1,h=Math.max(n,c),d=Math.min(o,g);for(let e=h;e<=d;e++){let t=f.get(e);t||(t={extents:new Set,coveredCells:0},f.set(e,t)),t.extents.add(a),t.coveredCells+=l}}return f}#dJ(e,t,r,n){let{row:o,col:i}=e.getTopStartCorner(),{row:s,col:a}=e.getBottomEndCorner(),l="row"===t,h=(l?o:i)??0,d=(l?s:a)??0,u=l?(a??0)-(i??0)+1:(s??0)-(o??0)+1,c=e=>1===r?e>=n:e<=n,g=this.#d0(e,t,r),p=Array.from(g.keys()).sort((e,t)=>(e-t)*r),m=null,f=0;for(let e=0;e<p.length;e++){let t=p[e],{extents:r,coveredCells:n}=g.get(t);if(n<u&&r.add(t),1===r.size){let e=r.values().next().value;if(c(e)){m=t,f=e;break}}}let b=1===r?Math.max(h,n):Math.min(d,n);for(;b>=h&&b<=d&&g.has(b);)b+=r;let C=b>=h&&b<=d;return null===m?C?b:n:!C||(m-b)*r<=0?f:b}shiftCollections(e,t,r){let n=[0,0];switch(e){case"right":n[0]+=r;break;case"left":n[0]-=r;break;case"down":n[1]+=r;break;case"up":n[1]-=r}let o=[];this.mergedCells.forEach(e=>{e.shift(n,t),e.removed&&o.push(e)}),o.forEach(e=>{this.mergedCells.splice(this.mergedCells.indexOf(e),1)}),this.mergedCellsMatrix.clear(),this.mergedCells.forEach(e=>{this.#dQ(e)})}capturePhysicalSpans(e){let t="column"===e,r=t?"col":"row",n=t?"colspan":"rowspan",o=t?e=>this.hot.toPhysicalColumn(e):e=>this.hot.toPhysicalRow(e),i=new Map;return this.mergedCells.forEach(e=>{let t=[];for(let i=0;i<e[n];i++)t.push(o(e[r]+i));i.set(e,t)}),i}static detectContiguousRuns(e){if(0===e.length)return[];let t=[],r=e[0],n=1;for(let o=1;o<e.length;o++)e[o]===e[o-1]+1?n+=1:(t.push({start:r,length:n}),r=e[o],n=1);return t.push({start:r,length:n}),t}translateAfterAxisMove(e,t){let r="column"===e,n=r?"col":"row",o=r?"colspan":"rowspan",i=r?"row":"col",s=r?"rowspan":"colspan",a=r?e=>this.hot.toVisualColumn(e):e=>this.hot.toVisualRow(e),l=[];this.mergedCells.forEach(e=>{let r=t.get(e);if(!r)return void l.push({row:e.row,col:e.col,rowspan:e.rowspan,colspan:e.colspan});let h=r.map(a).filter(e=>null!==e&&e>=0).sort((e,t)=>e-t);0!==h.length&&yi.detectContiguousRuns(h).forEach(t=>{let r={[n]:t.start,[o]:t.length,[i]:e[i],[s]:e[s]};(1!==r.colspan||1!==r.rowspan)&&l.push(r)})}),this.mergedCells.length=0,this.mergedCellsMatrix.clear(),l.forEach(e=>{this.add(e,!0)})}#dQ(e){for(let t=e.row;t<e.row+e.rowspan;t++)for(let r=e.col;r<e.col+e.colspan;r++)this.mergedCellsMatrix.has(t)||this.mergedCellsMatrix.set(t,new Map),this.mergedCellsMatrix.get(t).set(r,e)}relocateInMatrix(e){e.forEach(e=>{let{mergedCell:t}=e;return this.#dZ(t)}),e.forEach(e=>{let{mergedCell:t,row:r,col:n}=e;t.relocate(r,n),this.#dQ(t)})}removeFromMatrix(e){e.forEach(e=>this.#dZ(e))}#dZ(e){for(let t=e.row;t<e.row+e.rowspan;t++)for(let r=e.col;r<e.col+e.colspan;r++)this.mergedCellsMatrix.get(t)?.delete(r)}}let ys=class{currentFillData=null;constructor(e){this.plugin=e,this.mergedCellsCollection=this.plugin.mergedCellsCollection}getDirection(e,t){return t[0]===e[0]&&t[1]===e[1]&&t[3]===e[3]?"down":t[2]===e[2]&&t[1]===e[1]&&t[3]===e[3]?"up":t[1]===e[1]&&t[2]===e[2]?"right":"left"}snapDragArea(e,t,r,n){let o=t.slice(0),i=this.getAutofillSize(e,t,r),[s,a,l,h]=e,d=["up","down"].indexOf(r)>-1?l-s+1:h-a+1,u=Math.floor(i/d)*d,c=i-u,g=this.getFarthestCollection(e,t,r,n);if(g){if("down"===r){let e=g.row+g.rowspan-s-c;o[2]+e>=this.plugin.hot.countRows()?o[2]-=c:o[2]+=c?e:0}else if("right"===r){let e=g.col+g.colspan-a-c;o[3]+e>=this.plugin.hot.countCols()?o[3]-=c:o[3]+=c?e:0}else if("up"===r){let e=l-c-g.row+1;o[0]+e<0?o[0]+=c:o[0]-=c?e:0}else if("left"===r){let e=h-c-g.col+1;o[1]+e<0?o[1]+=c:o[1]-=c?e:0}}return this.updateCurrentFillCache({baseArea:e,dragDirection:r,foundMergedCells:n,fillSize:i,dragArea:o,cycleLength:d}),o}updateCurrentFillCache(e){this.currentFillData||(this.currentFillData={}),ti(this.currentFillData,e)}getAutofillSize(e,t,r){let[n,o,i,s]=e,[a,l,h,d]=t;switch(r){case"up":return n-a;case"down":return h-i;case"left":return o-l;case"right":return d-s;default:return 0}}getDragArea(e,t,r){let[n,o,i,s]=e,[a,l,h,d]=t;switch(r){case"up":return[a,l,n-1,s];case"down":{let e=this.mergedCellsCollection.get(h,s);return[i+1,o,h+(e?e.rowspan-1:0),s]}case"left":return[a,l,i,o-1];case"right":{let e=this.mergedCellsCollection.get(h,s);return[n,s+(e?e.colspan-1:0),h,d]}default:return[0,0,0,0]}}getFarthestCollection(e,t,r,n){let[o,i,s,a]=e,l=["up","down"].indexOf(r)>-1,h=l?s:a,d=l?o:i,u=this.getAutofillSize(e,t,r),c=l?s-o+1:a-i+1,g=Math.floor(u/c)*c,p=u-g,m=null,f=null,b=null;switch(r){case"up":m="includesVertically",b=h-p+1;break;case"left":m="includesHorizontally",b=h-p+1;break;case"down":m="includesVertically",b=d+p-1;break;case"right":m="includesHorizontally",b=d+p-1}return J(n,e=>{e[m](b)&&e.isFarther(f,r)&&(f=e)}),f}recreateAfterDataPopulation(e){if(!this.currentFillData)return;let t=this.getRangeFromChanges(e),r=this.currentFillData.foundMergedCells,n=this.currentFillData.dragDirection,o=(e,r)=>{switch(n){case"up":return e.row-r>=t.from.row;case"down":return e.row+e.rowspan-1+r<=t.to.row;case"left":return e.col-r>=t.from.column;case"right":return e.col+e.colspan-1+r<=t.to.column;default:return null}},i=0,s=null,a=1;do for(let e=0;e<r.length;e+=1){if(o(s=r[e],i=a*this.currentFillData.cycleLength))switch(n){case"up":this.plugin.mergedCellsCollection.add({row:s.row-i,rowspan:s.rowspan,col:s.col,colspan:s.colspan},!0);break;case"down":this.plugin.mergedCellsCollection.add({row:s.row+i,rowspan:s.rowspan,col:s.col,colspan:s.colspan},!0);break;case"left":this.plugin.mergedCellsCollection.add({row:s.row,rowspan:s.rowspan,col:s.col-i,colspan:s.colspan},!0);break;case"right":this.plugin.mergedCellsCollection.add({row:s.row,rowspan:s.rowspan,col:s.col+i,colspan:s.colspan},!0)}e===r.length-1&&(a+=1)}while(null!==s&&o(s,i));this.currentFillData=null,this.plugin.hot.render(),r.length>0&&this.plugin.ifChromeForceRepaint()}getRangeFromChanges(e){let t=null,r=null,n=null,o=null;return J(e,e=>{let i=e[0],s=this.plugin.hot.propToCol(e[1]);(null===t||i<t)&&(t=i),(null===r||i>r)&&(r=i),(null===n||s<n)&&(n=s),(null===o||s>o)&&(o=s)}),{from:{row:t??0,column:n??0},to:{row:r??0,column:o??0}}}dragAreaOverlapsCollections(e,t,r){let[n,o,i,s]=this.getDragArea(e,t,r),a=this.plugin.hot._createCellCoords(n,o),l=this.plugin.hot._createCellCoords(i,s),h=this.plugin.hot._createCellRange(a,a,l);if(0===this.mergedCellsCollection.getWithinRange(h,!0).length)return!1;let d=this.mergedCellsCollection.getWithinRange(h,!1);return 0===d.length||("up"===r||"down"===r?!d.every(e=>{let{colspan:t}=e;return t===h.getWidth()}):!d.every(e=>{let{rowspan:t}=e;return t===h.getHeight()}))}},ya=class{plugin;fullySelectedMergedCellClassName="fullySelectedMergedCell";constructor(e){this.plugin=e,this.hot=e.hot}getSelectedMergedCellClassName(e,t,r,n){let o=Math.min(r[0],r[2]),i=Math.min(r[1],r[3]),s=Math.max(r[0],r[2]),a=Math.max(r[1],r[3]);if(void 0===n)return;let l=this.plugin.mergedCellsCollection;if(!l.isFirstRenderableMergedCell(e,t))return;let h=l.get(e,t);if(!h)return;let d=h.getLastRow(),u=h.getLastColumn();return o<=h.row&&i<=h.col&&s>=d&&a>=u?`${this.fullySelectedMergedCellClassName}-${n}`:this.isMergeCellFullySelected(h,this.hot.getSelectedRange())?`${this.fullySelectedMergedCellClassName}-multiple`:void 0}isMergeCellFullySelected(e,t){let r=[];if(!t||!e)return!1;for(let t=0;t<e.rowspan;t+=1)for(let n=0;n<e.colspan;n+=1)r.push(this.hot._createCellCoords(e.row+t,e.col+n));for(let e=0;e<r.length;e+=1){let n=[];for(let o=0;o<t.length;o+=1)n[o]=t[o].includes(r[e]);if(!n.includes(!0))return!1}return!0}getSelectedMergedCellClassNameToRemove(){let e=[];for(let t=0;t<=7;t+=1)e.push(`${this.fullySelectedMergedCellClassName}-${t}`);return e.push(`${this.fullySelectedMergedCellClassName}-multiple`),e}};class yl{#d1=[];#d2=null;#d3=null;#d6;#rY;#rj;constructor({mergedCellsGetter:e,rowIndexMapper:t,columnIndexMapper:r}){this.#d6=e,this.#rY=t,this.#rj=r}getCurrentVerticalNode(){return this.#d3??void 0}getFirstVerticalNode(){return this.#d5("vertical")}getNextVerticalNode(){return this.#d4(this.#d3,"vertical",1)}getPrevVerticalNode(){return this.#d4(this.#d3,"vertical",-1)}getCurrentHorizontalNode(){return this.#d2??void 0}getFirstHorizontalNode(){return this.#d5("horizontal")}getNextHorizontalNode(){return this.#d4(this.#d2,"horizontal",1)}getPrevHorizontalNode(){return this.#d4(this.#d2,"horizontal",-1)}setPrevNodeAsActive(){this.#d3&&(this.#d3=this.#d9(this.#d3,"vertical",-1)),this.#d2&&(this.#d2=this.#d9(this.#d2,"horizontal",-1))}setNextNodeAsActive(){this.#d3&&(this.#d3=this.#d9(this.#d3,"vertical",1)),this.#d2&&(this.#d2=this.#d9(this.#d2,"horizontal",1))}buildFocusOrder(e){this.#d1=e.map(e=>{let t=e.getTopStartCorner(),r=e.getBottomEndCorner(),n=e.highlight.clone().normalize();return{rowFrom:t.row??0,rowTo:r.row??0,colFrom:t.col??0,colTo:r.col??0,highlightRow:n.row??0,highlightCol:n.col??0}});let t=null;for(let e=0;e<this.#d1.length;e++){let{highlightRow:r,highlightCol:n}=this.#d1[e],o=this.#d7(e,r,n);o&&(t=o)}this.#d2=t,this.#d3=t}setActiveNode(e,t,r){if(void 0===r)return this;let n=this.#d7(r,e,t);return n&&(this.#d2=n,this.#d3=n),this}#d7(e,t,r){let n=this.#d1[e];if(!n)return null;let o=this.#d6(t,r);return o?this.#d8(e,o):t<n.rowFrom||t>n.rowTo||r<n.colFrom||r>n.colTo||this.#rY.isHidden(t)||this.#rj.isHidden(r)?null:{selectionLayer:e,rowStart:t,rowEnd:t,colStart:r,colEnd:r}}#d8(e,t){let r=this.#d1[e],n=t.row,o=t.row+t.rowspan-1,i=t.col,s=t.col+t.colspan-1;return n<r.rowFrom||o>r.rowTo||i<r.colFrom||s>r.colTo||null===this.#ue(n,o,i,s)?null:{selectionLayer:e,rowStart:n,rowEnd:o,colStart:i,colEnd:s}}#ue(e,t,r,n){let o=this.#rY.getNearestNotHiddenIndex(e,1),i=this.#rj.getNearestNotHiddenIndex(r,1);return null===o||o>t||null===i||i>n?null:{row:o,column:i}}#ut(e){return this.#ue(e.rowStart,e.rowEnd,e.colStart,e.colEnd)??{row:e.rowStart,column:e.colStart}}#d4(e,t,r){if(e)return this.#d9(e,t,r)??void 0}#d9(e,t,r){let n=this.#d1.length;if(0===n)return null;let o=this.#d1[e.selectionLayer]?e.selectionLayer:0,i=this.#ur(o,this.#ut(e),t,r);for(let e=1;null===i&&e<=n;e++){let s=((o+e*r)%n+n)%n;i=this.#ur(s,null,t,r)}return i}#d5(e){for(let t=0;t<this.#d1.length;t++){let r=this.#ur(t,null,e,1);if(r)return r}}#ur(e,t,r,n){let o=this.#d1[e];if(!o)return null;let i=null===t?this.#un(o,n):this.#uo(o,t,r,n);for(;null!==i;){let t=this.#d6(i.row,i.column);if(!t)return{selectionLayer:e,rowStart:i.row,rowEnd:i.row,colStart:i.column,colEnd:i.column};let s=this.#d8(e,t);if(s&&this.#ui(s,i,r,n))return s;i=this.#us(o,i,t,r,n)}return null}#ui(e,t,r,n){let o=this.#ue(e.rowStart,e.rowEnd,e.colStart,e.colEnd);return null!==o&&(1===n?o.row===t.row&&o.column===t.column:"horizontal"===r?o.row===t.row:o.column===t.column)}#us(e,t,r,n,o){if("horizontal"===n){let i=1===o?Math.min(r.col+r.colspan-1,e.colTo):Math.max(r.col,e.colFrom);return this.#uo(e,{row:t.row,column:i},n,o)}let i=1===o?Math.min(r.row+r.rowspan-1,e.rowTo):Math.max(r.row,e.rowFrom);return this.#uo(e,{row:i,column:t.column},n,o)}#un(e,t){let r=1===t?this.#rY.getNearestNotHiddenIndex(e.rowFrom,1):this.#rY.getNearestNotHiddenIndex(e.rowTo,-1),n=1===t?this.#rj.getNearestNotHiddenIndex(e.colFrom,1):this.#rj.getNearestNotHiddenIndex(e.colTo,-1);return null===r||r<e.rowFrom||r>e.rowTo||null===n||n<e.colFrom||n>e.colTo?null:{row:r,column:n}}#uo(e,t,r,n){if("horizontal"===r){let r=this.#rj.getNearestNotHiddenIndex(t.column+n,n);if(null!==r&&r>=e.colFrom&&r<=e.colTo)return{row:t.row,column:r};let o=this.#rY.getNearestNotHiddenIndex(t.row+n,n),i=1===n?this.#rj.getNearestNotHiddenIndex(e.colFrom,1):this.#rj.getNearestNotHiddenIndex(e.colTo,-1);return null===o||o<e.rowFrom||o>e.rowTo||null===i||i<e.colFrom||i>e.colTo?null:{row:o,column:i}}let o=this.#rY.getNearestNotHiddenIndex(t.row+n,n);if(null!==o&&o>=e.rowFrom&&o<=e.rowTo)return{row:o,column:t.column};let i=this.#rj.getNearestNotHiddenIndex(t.column+n,n),s=1===n?this.#rY.getNearestNotHiddenIndex(e.rowFrom,1):this.#rY.getNearestNotHiddenIndex(e.rowTo,-1);return null===i||i<e.colFrom||i>e.colTo||null===s||s<e.rowFrom||s>e.rowTo?null:{row:s,column:i}}}function yh(e,t,r){let{rowIndexMapper:n,stylesHandler:o}=e,i=0;for(let s=t;s<t+r;s++)n.isHidden(s)||(i+=e.getRowHeight(s)??o.getDefaultRowHeight(s));return i}nF.getSingleton().register("beforeMergeCells"),nF.getSingleton().register("afterMergeCells"),nF.getSingleton().register("beforeUnmergeCells"),nF.getSingleton().register("afterUnmergeCells");let yd="mergeCells";class yu extends pa{static get PLUGIN_KEY(){return yd}static get PLUGIN_PRIORITY(){return 150}static get DEFAULT_SETTINGS(){return{[po]:"cells",virtualized:!1,cells:[]}}#ua=null;#ul={row:0,col:0};#uh=new yl({mergedCellsGetter:(e,t)=>this.mergedCellsCollection.get(e,t),rowIndexMapper:this.hot.rowIndexMapper,columnIndexMapper:this.hot.columnIndexMapper});#ud=(function(e){let t=e.hot,{rowIndexMapper:r,columnIndexMapper:n}=t,o=new Map;return{before:function(){},after:function(i,s,a){let l=e.mergedCellsCollection.get(s,a);if(!1===l){i.removeAttribute("rowspan"),i.removeAttribute("colspan"),o.has(s)&&!t.getSettings().rowHeaders&&(i.style.height=`${o.get(s)}px`,o.delete(s)),i.style.display="";return}let{row:h,col:d,colspan:u,rowspan:c}=l,[g,p]=e.translateMergedCellToRenderable(h,c,d,u),m=e.getSetting("virtualized");if(0===d&&!t.getSettings().rowHeaders){let e=t._getRowHeightFromSettings(s);if(void 0!==e){let r=t.stylesHandler.areCellsBorderBox();o.set(s,e-!r)}else if(tB()){let e=yh(t,h,c);o.set(s,e/c)}}let f=r.getRenderableFromVisualIndex(s)??0,b=n.getRenderableFromVisualIndex(a)??0,C=r.getNearestNotHiddenIndex(h,1),y=n.getNearestNotHiddenIndex(d,1);m&&([C,y]=function(e,t,r){let n=e.view.getActiveOverlayName();if(!["top","top_inline_start_corner"].includes(n)){let r=e.getFirstRenderedVisibleRow();null!==t&&null!==r&&(t=Math.max(t,r))}if(!["inline_start","top_inline_start_corner","bottom_inline_start_corner"].includes(n)){let t=e.getFirstRenderedVisibleColumn();null!==r&&null!==t&&(r=Math.max(r,t))}return[t,r]}(t,C,y));let w=Math.min(c,g-f+1),S=Math.min(u,p-b+1);C===s&&y===a?(i.setAttribute("rowspan",String(w)),i.setAttribute("colspan",String(S))):(i.removeAttribute("rowspan"),i.removeAttribute("colspan"),i.style.display="none")}}})(this);#sm=null;#sp=null;#uu=!1;#uc=new WeakMap;#ug=new WeakSet;isEnabled(){return!!this.hot.getSettings()[yd]}enablePlugin(){this.enabled||(this.mergedCellsCollection=new yi(this),this.autofillCalculations=new ys(this),this.selectionCalculations=new ya(this),this.addHook("afterInit",this.#sf),this.addHook("modifyTransformFocus",this.#up),this.addHook("modifyTransformStart",this.#um),this.addHook("modifyTransformEnd",this.#uf),this.addHook("beforeSelectionHighlightSet",this.#ub),this.addHook("beforeSetRangeStart",this.#uC),this.addHook("beforeSetRangeStartOnly",this.#uC),this.addHook("beforeSelectionFocusSet",this.#uy),this.addHook("afterSelectionFocusSet",this.#uw),this.addHook("afterSelectionEnd",this.#i1),this.addHook("modifyGetCellCoords",this.#uS),this.addHook("modifyGetCoordsElement",this.#uS),this.addHook("afterIsMultipleSelection",this.#uv),this.addHook("afterRenderer",(e,t,r)=>this.#ud.after(e,t,r)),this.addHook("afterContextMenuDefaultOptions",e=>this.#uR(e)),this.addHook("afterGetCellMeta",this.#uE),this.addHook("afterViewportRowCalculatorOverride",this.#uT),this.addHook("afterViewportColumnCalculatorOverride",this.#uA),this.addHook("modifyAutofillRange",this.#uM),this.addHook("afterCreateCol",this.#sv),this.addHook("afterRemoveCol",this.#sE),this.addHook("afterCreateRow",this.#sC),this.addHook("afterRemoveRow",this.#sw),this.addHook("beforeColumnMove",this.#sM),this.addHook("afterColumnMove",this.#o8),this.addHook("beforeRowMove",this.#sT),this.addHook("afterRowMove",this.#sA),this.addHook("beforeColumnFreeze",this.#uI),this.addHook("afterColumnFreeze",this.#ux),this.addHook("beforeColumnUnfreeze",this.#uI),this.addHook("afterColumnUnfreeze",this.#ux),this.addHook("afterChange",this.#of),this.addHook("beforeDrawBorders",this.#uN),this.addHook("afterDrawSelection",this.#uO),this.addHook("beforeRemoveCellClassNames",this.#uk),this.addHook("beforeBeginEditing",this.#uH),this.addHook("modifyRowHeightByOverlayName",this.#u_),this.addHook("modifySinglePassLayout",this.#uL),this.addHook("beforeUndoStackChange",(e,t)=>{if("MergeCells"===t)return!1}),this.addHook("afterMergeCells",this.#uP),this.registerShortcuts(),this.hot.rowIndexMapper.addLocalHook("cacheUpdated",this.#uD),super.enablePlugin())}disablePlugin(){this.hot.rowIndexMapper.removeLocalHook("cacheUpdated",this.#uD),this.clearCollections(),this.unregisterShortcuts(),this.hot.render(),this.#uu=!1,super.disablePlugin()}destroy(){this.hot?.rowIndexMapper.removeLocalHook("cacheUpdated",this.#uD),super.destroy()}updatePlugin(){this.disablePlugin(),this.enablePlugin(),this.generateFromSettings(),this.#uu=!0,this.#uF(),super.updatePlugin()}ifChromeForceRepaint(){if(!tL())return;let e=[],t=[];this.mergedCellsCollection.mergedCells.forEach(e=>{let{row:r,rowspan:n}=e;for(let e=r+1;e<r+n;e++)t.push(e)}),(t=[...new Set(t)]).forEach(t=>{let r=this.hot.rowIndexMapper.getRenderableFromVisualIndex(t);null!==r&&this.hot.view._wt.wtOverlays.getOverlays(!0).map(e=>"master"===e.name?e:e.clone.wtTable).forEach(t=>{let n=t.getRow(r);n&&(n.style.background=rP(n,"backgroundColor")?.replace(")",", 0.99)")??"",e.push(n))})}),this.hot._registerTimeout(()=>{e.forEach(e=>{e.style.background=rP(e,"backgroundColor")?.replace(", 0.99)","")??""})},1)}validateSetting(e){return!!e&&(yo.containsNegativeValues(e)?(tQ(yo.NEGATIVE_VALUES_WARNING(e)),!1):yo.isOutOfBounds(e,this.hot.countRows(),this.hot.countCols())?(tQ(yo.IS_OUT_OF_BOUNDS_WARNING(e)),!1):yo.isSingleCell(e)?(tQ(yo.IS_SINGLE_CELL(e)),!1):!yo.containsZeroSpan(e)||(tQ(yo.ZERO_SPAN_WARNING(e)),!1))}generateFromSettings(){let e=this.getSetting("cells").filter(e=>this.validateSetting(e)),t=this.mergedCellsCollection.filterOverlappingMergeCells(e),r=[];t.forEach(e=>{let{row:t,col:n,rowspan:o,colspan:i}=e,s=this.hot._createCellCoords(t,n),a=this.hot._createCellCoords(t+o-1,n+i-1),l=this.hot._createCellRange(s,s,a);this.mergeRange(l,!0,!0);for(let e=t;e<t+o;e++)for(let o=n;o<n+i;o++)(e!==t||o!==n)&&r.push([e,o,null])}),0!==r.length&&this.hot.setDataAtCell(r,void 0,void 0,this.pluginName??void 0)}clearCollections(){J(this.mergedCellsCollection.mergedCells,e=>{this.#uB(e)}),this.mergedCellsCollection.clear()}canMergeRange(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return!!t||this.validateSetting(e)}mergeSelection(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.hot.getSelectedRangeActive();if(!e)return;e.setDirection(this.hot.isRtl()?"NE-SW":"NW-SE");let{from:t,to:r}=e;this.unmergeRange(e,!0),this.mergeRange(e),null!==t.row&&null!==t.col&&null!==r.row&&null!==r.col&&this.hot.selectCell(t.row,t.col,r.row,r.col,!1)}unmergeSelection(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.hot.getSelectedRangeActive();if(!e)return;let{from:t,to:r}=e;this.unmergeRange(e,!0),null!==t.row&&null!==t.col&&null!==r.row&&null!==r.col&&this.hot.selectCell(t.row,t.col,r.row,r.col,!1)}mergeRange(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=e.getTopStartCorner(),o=e.getBottomEndCorner();if(null===n.row||null===n.col||null===o.row||null===o.col)return!1;let i={row:n.row,col:n.col,rowspan:o.row-n.row+1,colspan:o.col-n.col+1},s=[],a=null;return!!this.canMergeRange(i,t)&&(this.hot.runHooks("beforeMergeCells",e,t),oA(0,i.rowspan-1,e=>{oA(0,i.colspan-1,t=>{let r=null;s[e]||(s[e]=[]),0===e&&0===t?r=this.hot.getSourceDataAtCell(this.hot.toPhysicalRow(i.row),this.hot.toPhysicalColumn(i.col)):this.hot.setCellMeta(i.row+e,i.col+t,"hidden",!0),s[e][t]=r})}),this.hot.setCellMeta(i.row,i.col,"spanned",!0),!this.mergedCellsCollection.add(i,t)||(r?a=[i.row,i.col,s]:this.hot.populateFromArray(i.row,i.col,s,void 0,void 0,this.pluginName??void 0),t||this.ifChromeForceRepaint(),this.hot.runHooks("afterMergeCells",e,i,t),a))}#uB(e){oA(0,e.rowspan-1,t=>{oA(0,e.colspan-1,r=>{this.hot.removeCellMeta(e.row+t,e.col+r,"hidden"),this.hot.removeCellMeta(e.row+t,e.col+r,"copyable")})}),this.hot.removeCellMeta(e.row,e.col,"spanned"),this.hot.removeCellMeta(e.row,e.col,"rowspan"),this.hot.removeCellMeta(e.row,e.col,"colspan")}unmergeRange(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.mergedCellsCollection.getWithinRange(e);0!==r.length&&(this.hot.runHooks("beforeUnmergeCells",e,t),J(r,e=>{this.mergedCellsCollection.remove(e.row,e.col),this.#uB(e)}),this.hot.runHooks("afterUnmergeCells",e,t),this.hot.render())}toggleMerge(e){let{from:t,to:r}=e.clone().normalize();if(null===t.row||null===t.col||null===r.row||null===r.col)return;let n=this.mergedCellsCollection.get(t.row,t.col);!1!==n&&n.row===t.row&&n.col===t.col&&n.row+n.rowspan-1===r.row&&n.col+n.colspan-1===r.col?this.unmergeRange(e):this.mergeSelection(e)}merge(e,t,r,n){let o=this.hot._createCellCoords(e,t),i=this.hot._createCellCoords(r,n);this.mergeRange(this.hot._createCellRange(o,o,i))}unmerge(e,t,r,n){let o=this.hot._createCellCoords(e,t),i=this.hot._createCellCoords(r,n);this.unmergeRange(this.hot._createCellRange(o,o,i))}#sf=()=>{this.generateFromSettings(),this.hot.render(),this.#uu=!0,this.#uF()};#uP=(e,t)=>{let r=this.mergedCellsCollection.get(t.row,t.col);r&&this.#uV(r)};#uD=e=>{let{trimmedIndexesChanged:t,hiddenIndexesChanged:r,indexesSequenceChanged:n}=e;this.hot&&this.#uu&&(t||r||n)&&this.#uU()};#uV(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.#uz(),r=this.hot.toPhysicalColumn(e.col);if(null===r)return;let n=this.#uc.get(e),o=t&&n?n.physicalRow:this.hot.toPhysicalRow(e.row);null!==o&&this.#uc.set(e,{physicalRow:o,physicalColumn:r})}#uF(){let e=this.#uz();this.mergedCellsCollection.mergedCells.forEach(t=>this.#uV(t,e))}#uW(e){this.mergedCellsCollection.mergedCells.forEach(t=>{let r=this.#uc.get(t);if(!r)return;let n=e(r.physicalRow);n!==r.physicalRow&&this.#uc.set(t,{physicalRow:n,physicalColumn:r.physicalColumn})})}#uz(){let{rowIndexMapper:e}=this.hot;return e.getNotTrimmedIndexesLength()<e.getNumberOfIndexes()}#uU(){let{mergedCells:e}=this.mergedCellsCollection;if(0===e.length)return;let t=[],r=[];e.forEach(e=>{let n=this.#uc.get(e);if(!n)return;let o=this.hot.toVisualColumn(n.physicalColumn),i=null===o?null:this.hot.toVisualRow(n.physicalRow);for(let t=1;null!==o&&null===i&&t<e.rowspan;t++)i=this.hot.toVisualRow(n.physicalRow+t);if(null===o||null===i){this.#ug.add(e),r.push(e);return}(this.#ug.delete(e)||e.row!==i||e.col!==o)&&t.push({mergedCell:e,row:i,col:o})}),r.length>0&&this.mergedCellsCollection.removeFromMatrix(r),t.length>0&&this.mergedCellsCollection.relocateInMatrix(t)}registerShortcuts(){let e=this.hot.getShortcutManager().getContext("grid");e&&e.addShortcut({keys:[["Control","m"]],callback:()=>{let e=this.hot.getSelectedRangeActive();e&&!e.isSingleHeader()&&(this.toggleMerge(e),this.hot.render())},runOnlyIf:e=>!e?.altKey,group:yd})}unregisterShortcuts(){let e=this.hot.getShortcutManager().getContext("grid");e?.removeShortcutsByGroup(yd)}#uv=e=>{if(e){let t=this.mergedCellsCollection.mergedCells,r=this.hot.getSelectedRangeActive();if(!r)return e;let n=r.getTopStartCorner(),o=r.getBottomEndCorner();for(let e=0;e<t.length;e+=1)if(n.row===t[e].row&&n.col===t[e].col&&o.row===t[e].row+t[e].rowspan-1&&o.col===t[e].col+t[e].colspan-1)return!1}return e};#up=e=>{this.#ul.row=e.row,this.#ul.col=e.col};#um=e=>{let t=this.hot.getSelectedRangeActive();if(!t)return;let{highlight:r}=t,{columnIndexMapper:n,rowIndexMapper:o}=this.hot;if(this.#ua&&(null!==this.#ua.row&&null!==o.getRenderableFromVisualIndex(this.#ua.row)&&(r.row=this.#ua.row),null!==this.#ua.col&&null!==n.getRenderableFromVisualIndex(this.#ua.col)&&(r.col=this.#ua.col),this.#ua=null),null===r.row||null===r.col)return;let i=this.mergedCellsCollection.get(r.row,r.col);if(!i)return;let s=i.col,a=i.col+i.colspan-1;if(e.col<0){let t=r.col>=s&&r.col<=a?s-1:a,o=n.getNearestNotHiddenIndex(t,-1);null===o?e.col=-this.hot.view.countRenderableColumnsInRange(0,r.col):e.col=-Math.max(this.hot.view.countRenderableColumnsInRange(o,r.col)-1,1)}else if(e.col>0){let t=r.col>=s&&r.col<=a?a+1:s,o=n.getNearestNotHiddenIndex(t,1);null===o?e.col=this.hot.view.countRenderableColumnsInRange(r.col,this.hot.countCols()):e.col=Math.max(this.hot.view.countRenderableColumnsInRange(r.col,o)-1,1)}let l=i.row,h=i.row+i.rowspan-1;if(e.row<0){let t=r.row>=l&&r.row<=h?l-1:h,n=o.getNearestNotHiddenIndex(t,-1);null===n?e.row=-this.hot.view.countRenderableRowsInRange(0,r.row):e.row=-Math.max(this.hot.view.countRenderableRowsInRange(n,r.row)-1,1)}else if(e.row>0){let t=r.row>=l&&r.row<=h?h+1:l,n=o.getNearestNotHiddenIndex(t,1);null===n?e.row=this.hot.view.countRenderableRowsInRange(r.row,this.hot.countRows()):e.row=Math.max(this.hot.view.countRenderableRowsInRange(r.row,n)-1,1)}};#uf=e=>{let t=this.hot.getSelectedRangeActive();if(!t)return;let r=t.clone(),{to:n}=t,o=n.row??0,i=n.col??0,{columnIndexMapper:s,rowIndexMapper:a}=this.hot,l=(e,t)=>{r.expand(this.hot._createCellCoords(e,t));for(let e=0;e<this.mergedCellsCollection.mergedCells.length;e+=1){let t=this.mergedCellsCollection.mergedCells[e].getRange();t&&r.expandByRange(t)}};if(e.col<0){let n=this.mergedCellsCollection.getStartMostColumnIndex(t,i)+e.col;l(o,n),"E-W"===t.getHorizontalDirection()&&"E-W"===r.getHorizontalDirection()&&(n=r.getTopStartCorner().col??n);let a=s.getNearestNotHiddenIndex(n,1);null!==a&&(e.col=-Math.max(this.hot.view.countRenderableColumnsInRange(a,i)-1,1))}else if(e.col>0){let n=this.mergedCellsCollection.getEndMostColumnIndex(t,i)+e.col;l(o,n),"W-E"===t.getHorizontalDirection()&&"W-E"===r.getHorizontalDirection()&&(n=r.getBottomEndCorner().col??n);let a=s.getNearestNotHiddenIndex(n,-1);null!==a&&(e.col=Math.max(this.hot.view.countRenderableColumnsInRange(i,a)-1,1))}if(e.row<0){let n=this.mergedCellsCollection.getTopMostRowIndex(t,o)+e.row;l(n,i),"S-N"===t.getVerticalDirection()&&"S-N"===r.getVerticalDirection()&&(n=r.getTopStartCorner().row??n);let s=a.getNearestNotHiddenIndex(n,1);null!==s&&(e.row=-Math.max(this.hot.view.countRenderableRowsInRange(s,o)-1,1))}else if(e.row>0){let n=this.mergedCellsCollection.getBottomMostRowIndex(t,o)+e.row;l(n,i),"N-S"===t.getVerticalDirection()&&"N-S"===r.getVerticalDirection()&&(n=r.getBottomStartCorner().row??n);let s=a.getNearestNotHiddenIndex(n,-1);null!==s&&(e.row=Math.max(this.hot.view.countRenderableRowsInRange(o,s)-1,1))}};#ub=()=>{let e=this.hot.getSelectedRangeLast();if(!e)return;let{highlight:t}=e;if(this.hot.selection.isSelectedByColumnHeader()||this.hot.selection.isSelectedByRowHeader()){this.#ua=t.clone();return}for(let t=0;t<this.mergedCellsCollection.mergedCells.length;t+=1){let r=this.mergedCellsCollection.mergedCells[t].getRange();r&&e.expandByRange(r,!1)}for(let t=0;t<this.mergedCellsCollection.mergedCells.length;t+=1){let r=this.mergedCellsCollection.mergedCells[t].getRange();r&&e.expandByRange(r,!1)}if(null===t.row||null===t.col)return;let r=this.mergedCellsCollection.get(t.row,t.col);this.#ua=t.clone(),r&&t.assign(r)};#uS=(e,t,r,n)=>{if(e<0||t<0)return;let o=this.mergedCellsCollection.get(e,t);if(!o)return;let{row:i,col:s,colspan:a,rowspan:l}=o,h=i+l-1,d=s+a-1;if("render"===n&&this.getSetting("virtualized")){let e=this.hot.view.getActiveOverlayName(),t=["top","top_inline_start_corner"].includes(e)?0:this.hot.getFirstRenderedVisibleRow(),r=["inline_start","top_inline_start_corner","bottom_inline_start_corner"].includes(e)?0:this.hot.getFirstRenderedVisibleColumn();return[ox(t,i,h),ox(r,s,d),ox(this.hot.getLastRenderedVisibleRow(),i,h),ox(this.hot.getLastRenderedVisibleColumn(),s,d)]}return[i,s,h,d]};#uR(e){var t;e.items.push({name:"---------"},(t=this,{key:"mergeCells",name(){let e=this.getSelectedActive();if(e&&t.mergedCellsCollection){let r=t.mergedCellsCollection.get(e[0],e[1]);if(!1!==r&&r.row===e[0]&&r.col===e[1]&&r.row+r.rowspan-1===e[2]&&r.col+r.colspan-1===e[3])return this.getTranslatedPhrase(lo)}return this.getTranslatedPhrase(ln)},callback(){let e=this.getSelectedRangeActive();if(!e)return;e.setDirection(this.isRtl()?"NE-SW":"NW-SE");let{from:r,to:n}=e;t.toggleMerge(e),null!==r.row&&null!==r.col&&null!==n.row&&null!==n.col&&this.selectCell(r.row,r.col,n.row,n.col,!1)},disabled(){let e=this.getSelectedActive();return!e||yo.isSingleCell({row:e[0],col:e[1],rowspan:e[2]-e[0]+1,colspan:e[3]-e[1]+1})||this.selection.isSelectedByCorner()},hidden:!1}))}#uC=()=>{this.#ua=null};#uy=()=>{if(!this.#ua||this.#ua.isCell())return;let e=this.hot.getSelectedRangeActive();if(!e)return;let t=e.getVerticalDirection(),r=e.getHorizontalDirection(),n=this.#ua.clone().normalize();null!==n.row&&null!==n.col&&(this.#uh.setActiveNode(n.row,n.col),this.#ul.row>0||this.#ul.col>0?this.#uh.setPrevNodeAsActive():("E-W"===r&&this.#ul.col<0||"S-N"===t&&this.#ul.row<0)&&this.#uh.setNextNodeAsActive())};#uw=(e,t)=>{let{columnIndexMapper:r,rowIndexMapper:n}=this.hot,o=this.hot.getActiveSelectionLayerIndex(),i=null,s=null;if(this.#ul.col<0){let{rowEnd:e,colEnd:t,selectionLayer:a}=this.#uh.getPrevHorizontalNode();s=r.getNearestNotHiddenIndex(t,-1),i=n.getNearestNotHiddenIndex(e,-1),o=a}else if(this.#ul.col>0){let{rowStart:e,colStart:t,selectionLayer:a}=this.#uh.getNextHorizontalNode();s=r.getNearestNotHiddenIndex(t,1),i=n.getNearestNotHiddenIndex(e,1),o=a}else if(this.#ul.row<0){let{rowEnd:e,colEnd:t,selectionLayer:a}=this.#uh.getPrevVerticalNode();s=r.getNearestNotHiddenIndex(t,-1),i=n.getNearestNotHiddenIndex(e,-1),o=a}else if(this.#ul.row>0){let{rowStart:e,colStart:t,selectionLayer:a}=this.#uh.getNextVerticalNode();s=r.getNearestNotHiddenIndex(t,1),i=n.getNearestNotHiddenIndex(e,1),o=a}if(null!==i||null!==s){this.hot.selection.setActiveSelectionLayerIndex(o);let r=this.hot.getSelectedRangeActive(),n=i??0,a=s??0,l=this.hot._createCellCoords(n,a),h=this.mergedCellsCollection.get(n,a),d=this.hot.selection.highlight.getFocus();e=n,t=a,r&&(h?r.highlight.assign({row:this.hot.rowIndexMapper.getNearestNotHiddenIndex(h.row,1)??void 0,col:this.hot.columnIndexMapper.getNearestNotHiddenIndex(h.col,1)??void 0}):r.highlight.assign(l)),d.clear(),d.add(l).commit()}this.#uh.setActiveNode(e,t,o),this.#ul={row:0,col:0}};#i1=()=>{let e=this.hot.getSelectedRange();e&&this.#uh.buildFocusOrder(e)};#uE=(e,t,r)=>{let n=this.mergedCellsCollection.get(e,t);n&&(n.row!==e||n.col!==t?(r.copyable=!1,r.hidden=!0):(r.rowspan=n.rowspan,r.colspan=n.colspan,r.spanned=!0))};#uT=e=>{if(this.getSetting("virtualized"))return;let t=this.hot.countCols();this.modifyViewportRowStart(e,t),this.modifyViewportRowEnd(e,t)};modifyViewportRowStart(e,t){let r=this.hot.rowIndexMapper,n=r.getVisualFromRenderableIndex(e.startRow)??0,o=this.mergedCellsCollection.getByVisualRow(n);for(let n=0;n<o.length;n+=1){let i=o[n],s=r.getNearestNotHiddenIndex(i.row,1),a=null!==s?r.getRenderableFromVisualIndex(s):null;if(null!==a&&a<e.startRow){e.startRow=a,this.modifyViewportRowStart(e,t);return}}}modifyViewportRowEnd(e,t){let r=this.hot.rowIndexMapper,n=r.getVisualFromRenderableIndex(e.endRow)??0,o=this.mergedCellsCollection.getByVisualRow(n);for(let n=0;n<o.length;n+=1){let i=o[n],s=i.row+i.rowspan-1,a=r.getNearestNotHiddenIndex(s,-1);if(null!==a){let n=r.getRenderableFromVisualIndex(a);if(null!==n&&n>e.endRow){e.endRow=n,this.modifyViewportRowEnd(e,t);return}}}}#uA=e=>{if(this.getSetting("virtualized"))return;let t=this.hot.countRows();this.modifyViewportColumnStart(e,t),this.modifyViewportColumnEnd(e,t)};modifyViewportColumnStart(e,t){let r=this.hot.columnIndexMapper,n=r.getVisualFromRenderableIndex(e.startColumn)??0,o=this.mergedCellsCollection.getByVisualColumn(n);for(let n=0;n<o.length;n+=1){let i=o[n],s=r.getNearestNotHiddenIndex(i.col,1);if(null!==s){let n=r.getRenderableFromVisualIndex(s);if(null!==n&&n<e.startColumn){e.startColumn=n,this.modifyViewportColumnStart(e,t);return}}}}modifyViewportColumnEnd(e,t){let r=this.hot.columnIndexMapper,n=r.getVisualFromRenderableIndex(e.endColumn)??0,o=this.mergedCellsCollection.getByVisualColumn(n);for(let n=0;n<o.length;n+=1){let i=o[n],s=i.col+i.colspan-1,a=r.getNearestNotHiddenIndex(s,-1);if(null!==a){let n=r.getRenderableFromVisualIndex(a);if(null!==n&&n>e.endColumn){e.endColumn=n,this.modifyViewportColumnEnd(e,t);return}}}}translateMergedCellToRenderable(e,t,r,n){let o,i,{rowIndexMapper:s,columnIndexMapper:a}=this.hot;return o=0===t?s.getNearestNotHiddenIndex(e,1):s.getNearestNotHiddenIndex(e+t-1,-1),i=0===n?a.getNearestNotHiddenIndex(r,1):a.getNearestNotHiddenIndex(r+n-1,-1),[e>=0&&null!==o?s.getRenderableFromVisualIndex(o)??e:e,r>=0&&null!==i?a.getRenderableFromVisualIndex(i)??r:r]}#uM=(e,t)=>{let r=this.autofillCalculations.getDirection(t,e);if(this.autofillCalculations.dragAreaOverlapsCollections(t,e,r))return t;let n=this.hot._createCellCoords(t[0],t[1]),o=this.hot._createCellCoords(t[2],t[3]),i=this.hot._createCellRange(n,n,o),s=this.mergedCellsCollection.getWithinRange(i);return 0===s.length?e:this.autofillCalculations.snapDragArea(t,e,r,s)};#sv=(e,t)=>{this.mergedCellsCollection.shiftCollections("right",e,t),this.#uF(),this.#uU()};#sE=(e,t)=>{this.mergedCellsCollection.shiftCollections("left",e,t),this.#uF(),this.#uU()};#sC=(e,t,r)=>{if("auto"!==r){if(this.mergedCellsCollection.shiftCollections("down",e,t),this.#uz()){let r=this.hot.toPhysicalRow(e);null!==r&&this.#uW(e=>e>=r?e+t:e)}this.#uF(),this.#uU()}};#sw=(e,t,r)=>{this.mergedCellsCollection.shiftCollections("up",e,t),this.#uz()&&Array.isArray(r)&&this.#uW(e=>e-r.reduce((t,r)=>t+ +(r<e),0)),this.#uF(),this.#uU()};#sM=(e,t,r,n)=>{if(!n||!this.#uu){this.#sm=null;return}this.#sm=this.mergedCellsCollection.capturePhysicalSpans("column")};#o8=(e,t,r,n,o)=>{let i=this.#sm;this.#sm=null,o&&i&&(this.mergedCellsCollection.translateAfterAxisMove("column",i),this.#uF(),this.hot.render())};#sT=(e,t,r,n)=>{if(!n||!this.#uu){this.#sp=null;return}this.#sp=this.mergedCellsCollection.capturePhysicalSpans("row")};#sA=(e,t,r,n,o)=>{let i=this.#sp;this.#sp=null,o&&i&&(this.mergedCellsCollection.translateAfterAxisMove("row",i),this.#uF(),this.hot.render())};#uI=(e,t)=>{if(!t||!this.#uu){this.#sm=null;return}this.#sm=this.mergedCellsCollection.capturePhysicalSpans("column")};#ux=(e,t)=>{let r=this.#sm;this.#sm=null,t&&r&&(this.mergedCellsCollection.translateAfterAxisMove("column",r),this.#uF(),this.hot.render())};#of=(e,t)=>{"Autofill.fill"===t&&this.autofillCalculations.recreateAfterDataPopulation(e)};#uN=(e,t)=>{if(t&&"area"===t){let t=this.hot.getSelectedRangeActive();t&&J(this.mergedCellsCollection.getWithinRange(t),r=>{t.getBottomEndCorner().row===r.getLastRow()&&t.getBottomEndCorner().col===r.getLastColumn()&&(e[2]=r.row,e[3]=r.col)})}};#uO=(e,t,r,n)=>{if(r)return this.selectionCalculations.getSelectedMergedCellClassName(e,t,r,n)};#uk=()=>this.selectionCalculations.getSelectedMergedCellClassNameToRemove();#uH=(e,t,r,n)=>{if(!(n instanceof MouseEvent))return;let o=this.hot.getSelectedRangeActive();if(!o)return;let i=this.mergedCellsCollection.getByRange(o);if(!i)return;let s=this.hot._createCellCoords(i.row,i.col),a=this.hot._createCellCoords(i.row+i.rowspan-1,i.col+i.colspan-1);return 0===this.hot.selection.getLayerLevel()&&o.isEqual(this.hot._createCellRange(s,s,a))};#uL=()=>!1;#u_=(e,t,r)=>{let n,o;if(this.hot.getSettings().rowHeaders||"bottom"===r||"bottom_inline_start_corner"===r)return e;if("master"===r)n=this.hot.getFirstRenderedVisibleColumn(),o=this.hot.getLastRenderedVisibleColumn();else{let t=this.hot.view.getOverlayByName(r),i=t?.clone?.wtTable;if(!i)return e;n=this.hot.columnIndexMapper.getVisualFromRenderableIndex(i.getFirstRenderedColumn()),o=this.hot.columnIndexMapper.getVisualFromRenderableIndex(i.getLastRenderedColumn())}if(null==n||!this.mergedCellsCollection.get(t,n))return e;let i=this.hot._createCellCoords(t,n),s=this.hot._createCellCoords(t,o??n),a=this.hot._createCellRange(i,i,s),l=this.mergedCellsCollection.getWithinRange(a,!0),h=l.reduce((e,t)=>{let{rowspan:r}=t;return Math.max(e,r)},1),d=0;return l.length>1&&l[0].rowspan<h&&(d=h-l[0].rowspan),l.forEach(n=>{let{rowspan:o}=n,i=0;i="top"===r||"top_inline_start_corner"===r?Math.min(h,this.hot.view.countNotHiddenFixedRowsTop()-t):o-d,e=Math.max(e??0,yh(this.hot,t,i))}),e}}function yc(e){let{pointerRow:t,pointerCol:r,grabRowOffset:n,grabColOffset:o,rangeHeight:i,rangeWidth:s,totalRows:a,totalCols:l}=e;return{row:Math.min(Math.max(0,t-n),Math.max(0,a-i)),col:Math.min(Math.max(0,r-o),Math.max(0,l-s))}}let yg=["className"];function yp(e,t,r,n,o){let i=[];for(let s=t;s<=n;s++)for(let t=r;t<=o;t++){let r=e.getCellMetaTransient(s,t),n=null;for(let e of yg)ty(r,e)&&((n=n??{})[e]=r[e]);null!==n&&i.push({row:s,col:t,meta:n})}return i}let ym="moveCells",yf="sort",yb="multiColumnSorting";pV(yb,function(e,t){let r=t.map((t,r)=>{var n;let o;return n=e[r],((o=t.multiColumnSorting).compareFunctionFactory?o.compareFunctionFactory:pz(t.type))(n,t,o)});return function(e,t){for(let n=0;n<r.length;n+=1){let o=r[n](e[n+1],t[n+1]);if(o!==pW)return o}return pW}});class yC extends pa{static get PLUGIN_KEY(){return"multipleSelectionHandles"}static get PLUGIN_PRIORITY(){return 160}dragged=[];#uG=null;#u$=null;#uY=new Map;isEnabled(){return tW()}enablePlugin(){this.enabled||(this.addHook("afterScroll",this.#aB),this.registerListeners(),super.enablePlugin())}disablePlugin(){this.#uj(),super.disablePlugin()}registerListeners(){let{rootElement:e}=this.hot,t=e=>{if(this.#uG=null,this.#u$=null,1===this.dragged.length)return this.dragged.splice(0,this.dragged.length),!0;let t=this.dragged.indexOf(e);if(-1===t)return!1;this.dragged.splice(t,1)},r=(e,t)=>{let r=nN(e);return null!==r&&(this.#uY.set(r.identifier,t),this.dragged.push(t),!0)},n=e=>{let r=!1;for(let[n,o]of[...this.#uY])null===nO(e,n)&&(this.#uY.delete(n),t(o),r=!0);r&&(this.#uG=null,this.#u$=null,0===this.dragged.length&&(this.touchStartRange=void 0))};for(let t of(this.eventManager.addEventListener(e,"touchstart",e=>{let t,n=t4(e);return rh(n,"topSelectionHandle-HitArea")?!!(t=this.hot.getSelectedRangeActive())&&!!r(e,"top")&&(this.touchStartRange={width:t.getWidth(),height:t.getHeight(),direction:t.getDirection()},e.preventDefault(),!1):rh(n,"bottomSelectionHandle-HitArea")?!!(t=this.hot.getSelectedRangeActive())&&!!r(e,"bottom")&&(this.touchStartRange={width:t.getWidth(),height:t.getHeight(),direction:t.getDirection()},e.preventDefault(),!1):void 0}),["touchend","touchcancel"]))this.eventManager.addEventListener(e,t,e=>{let t=t4(e);if(n(e),rh(t,"topSelectionHandle-HitArea")||rh(t,"bottomSelectionHandle-HitArea"))return e.preventDefault(),!1});this.eventManager.addEventListener(e,"touchmove",e=>{if(0===this.dragged.length)return;let t=this.#uq(e);if(null!==t){if(null!==this.#uG&&2>Math.abs(t.clientX-this.#uG.clientX)&&2>Math.abs(t.clientY-this.#uG.clientY))return void e.preventDefault();this.#uG=t,this.#uK(t.clientX,t.clientY),e.preventDefault()}})}getCurrentRangeCoords(e,t,r,n,o){let i=e.getTopStartCorner(),s=e.getBottomEndCorner(),a=e.getBottomStartCorner(),l=e.getTopEndCorner(),h={start:null,end:null};switch(r){case"NE-SW":switch(n){case"NE-SW":case"NW-SE":h="top"===o?{start:this.hot._createCellCoords(t.row??0,e.highlight.col??0),end:this.hot._createCellCoords(a.row??0,t.col??0)}:{start:this.hot._createCellCoords(e.highlight.row??0,t.col??0),end:this.hot._createCellCoords(t.row??0,i.col??0)};break;case"SE-NW":"bottom"===o&&(h={start:this.hot._createCellCoords(s.row??0,t.col??0),end:this.hot._createCellCoords(t.row??0,i.col??0)})}break;case"NW-SE":switch(n){case"NE-SW":"top"===o?h={start:t,end:a}:h.end=t;break;case"NW-SE":"top"===o?h={start:t,end:s}:h.end=t;break;case"SE-NW":"top"===o?h={start:t,end:i}:h.end=t;break;case"SW-NE":"top"===o?h={start:t,end:l}:h.end=t}break;case"SW-NE":switch(n){case"NW-SE":h="bottom"===o?{start:this.hot._createCellCoords(t.row??0,i.col??0),end:this.hot._createCellCoords(a.row??0,t.col??0)}:{start:this.hot._createCellCoords(i.row??0,t.col??0),end:this.hot._createCellCoords(t.row??0,s.col??0)};break;case"SW-NE":h="top"===o?{start:this.hot._createCellCoords(e.highlight.row??0,t.col??0),end:this.hot._createCellCoords(t.row??0,s.col??0)}:{start:this.hot._createCellCoords(t.row??0,i.col??0),end:this.hot._createCellCoords(i.row??0,t.col??0)};break;case"SE-NW":"bottom"===o?h={start:this.hot._createCellCoords(t.row??0,l.col??0),end:this.hot._createCellCoords(i.row??0,t.col??0)}:"top"===o&&(h={start:a,end:t})}break;case"SE-NW":switch(n){case"NW-SE":case"NE-SW":case"SW-NE":"top"===o&&(h.end=t);break;case"SE-NW":"top"===o?h.end=t:h={start:t,end:i}}}return h}isDragged(){return this.dragged.length>0}isDraggedBy(e){return this.#uY.has(e)}#uj(){this.dragged.splice(0,this.dragged.length),this.#uY.clear(),this.touchStartRange=void 0,this.#uG=null,this.#u$=null}#uq(e){for(let t of this.#uY.keys()){let r=nO(e,t);if(null!==r)return r}return null}#aB=()=>{if(0===this.dragged.length||null===this.#uG)return;let{clientX:e,clientY:t}=this.#uG;this.#uK(e,t)};#uK(e,t){let r=this.hot.getSelectedRangeActive();if(!r||void 0===this.touchStartRange)return;let n=pf(this.hot,e,t),o=Math.max(n.row??0,0),i=Math.max(n.col??0,0);if(this.#u$?.row===o&&this.#u$?.col===i)return;this.#u$={row:o,col:i};let s=this.hot._createCellCoords(o,i),a=r.getDirection();1===r.getWidth()&&1===r.getHeight()&&this.hot.selection.setRangeEnd(s);let l=this.getCurrentRangeCoords(r,s,this.touchStartRange.direction,a,this.dragged[0]);null!==l.start&&this.hot.selection.setRangeStart(l.start),null!==l.end&&this.hot.selection.setRangeEnd(l.end)}}function yy(){let{label:e="",colspan:t=1,origColspan:r=1,rowspan:n=1,origRowspan:o=1,collapsible:i=!1,columnDropMode:s="adopt",crossHiddenColumns:a=[],isCollapsed:l=!1,isHidden:h=!1,isRoot:d=!1,isPlaceholder:u=!1,isRowspanPlaceholder:c=!1,headerClassNames:g=[],visibleWhen:p}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{label:e,colspan:t,origColspan:r,rowspan:n,origRowspan:o,collapsible:i,columnDropMode:s,isCollapsed:l,crossHiddenColumns:a,isHidden:h,isRoot:d,isPlaceholder:u,isRowspanPlaceholder:c,headerClassNames:g,visibleWhen:p}}function yw(){return{label:"",isPlaceholder:!0}}let yS=["collapsed","expanded","always"],yv=["label","collapsible"];class yR{#rS=[];#uX=0;#iV=1/0;setColumnsLimit(e){this.#iV=e}setData(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.#rS=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1/0,r=[],n=[];if(0===t)return r;let o=e=>{if(""===e)return!0;if(!tc(e))return!1;let{label:t,colspan:r,rowspan:n,headerClassName:o,visibleWhen:i}=e;return""===eH(t)&&(void 0===r||1===r)&&(void 0===n||1===n)&&void 0===o&&void 0===i},i=e=>{let t=yy();if(tc(e)){let{label:r,colspan:n,rowspan:o,headerClassName:i,visibleWhen:s,columnDropMode:a}=e;t.label=eH(r),"number"==typeof n&&n>1&&(t.colspan=n,t.origColspan=n),"number"==typeof o&&o>1&&(t.rowspan=o,t.origRowspan=o),"string"==typeof i&&(t.headerClassNames=[...i.split(" ")]),"string"==typeof s&&yS.includes(s)&&(t.visibleWhen=s),"split"===a&&(t.columnDropMode="split")}else t.label=eH(e);return t};J(e,function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],s=[],a=0,l=0;for(r.push(s);(a<e.length||n[l]>0)&&!(l>=t);){let r=e[a];if(n[l]>0){o(r)&&(a+=1),s.push(yy()),n[l]-=1,l+=1;continue}if(a>=e.length)break;let h=i(r),d=h.origColspan;if(l+d>=t&&(h.colspan=d-=l+d-t,h.origColspan=d),h.origRowspan>1)for(let e=0;e<d;e++)n[l+e]=Math.max(n[l+e]??0,h.origRowspan-1);if(s.push(h),h.colspan>1)for(let e=0;e<h.colspan-1;e++)s.push(yw());l+=d,a+=1}});let s=Math.max(...Z(r,e=>e.length));return J(r,e=>{if(e.length<s){let t=Z(Array(s-e.length),()=>yy());e.splice(e.length,0,...t)}}),r}(e,this.#iV),this.#uX=this.#rS.length}setNormalizedData(e){this.#rS=e,this.#uX=e.length}getData(){return this.#rS}mergeWith(e){J(e,e=>{let{row:t,col:r,...n}=e,o=this.getHeaderSettings(t,r);null!==o&&ti(o,n,yv)})}map(e){J(this.#rS,t=>{J(t,t=>{let r=e({...t});tc(r)&&ti(t,r,yv)})})}getHeaderSettings(e,t){if(e>=this.#uX||e<0)return null;let r=this.#rS[e];return!1===Array.isArray(r)||t>=r.length?null:r[t]??null}getHeadersSettings(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=[];if(e>=this.#uX||e<0)return n;let o=this.#rS[e],i=0;for(let e=t;e<o.length;e++){let t=o[e];if(t.isPlaceholder&&tr("The first column settings cannot overlap the other header layers"),i+=t.colspan,n.push(t),t.colspan>1&&(e+=t.colspan-1),i===r)break;i>r&&tr("The last column settings cannot overlap the other header layers")}return n}insertColumns(e,t){J(this.#rS,r=>{if(e>0&&e<r.length&&r[e].isPlaceholder){let n=e-1;for(;n>0&&r[n].isPlaceholder;)n-=1;r[n].colspan=(r[n].colspan??1)+t,r[n].origColspan=(r[n].origColspan??1)+t;let o=[];for(let e=0;e<t;e++)o.push(yw());r.splice(e,0,...o)}else{let n=[];for(let e=0;e<t;e++)n.push(yy());r.splice(Math.min(e,r.length),0,...n)}})}removeColumns(e,t){let r=e+t;this.#rS=this.#rS.map(t=>{let n=[],o=0;for(;o<t.length;){let i=t[o],s=o+(i.isPlaceholder?1:i.origColspan??1)-1,a=0;for(let t=o;t<=s;t++)(t<e||t>=r)&&(a+=1);if(a>0){n.push(yy({...i,colspan:a,origColspan:a,isPlaceholder:!1}));for(let e=1;e<a;e++)n.push(yw())}o=s+1}return n})}getLayersCount(){return this.#uX}getColumnsCount(){return this.#uX>0?this.#rS[0].length:0}clear(){this.#rS=[],this.#uX=0}}let yE="DF-pre-order";function yT(e,t){let r=e.call(t,this);for(let n=0;n<this.childs.length;n++){if(!1===r)return!1;r=yT.call(this.childs[n],e,t)}return r}function yA(e,t){for(let r=0;r<this.childs.length;r++)if(!1===yA.call(this.childs[r],e,t))return!1;return e.call(t,this)}let yM=new Map([[yE,yT],["DF-post-order",yA],["BF",function(e,t){let r=[this];!function n(){if(0===r.length)return;let o=r.shift();r.push(...o.childs),!1!==e.call(t,o)&&n()}()}]]);class yI{data;parent=null;childs=[];constructor(e){this.data=e}addChild(e){e.parent=this,this.childs.push(e)}cloneTree(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this,t=new yI({...e.data});for(let r=0;r<e.childs.length;r++)t.addChild(this.cloneTree(e.childs[r]));return t}replaceTreeWith(e){this.data={...e.data},this.childs=[];for(let t=0;t<e.childs.length;t++)this.addChild(e.childs[t])}walkDown(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"BF";yM.has(t)||tr(`Traversal strategy "${t}" does not exist`),yM.get(t).call(this,e,this)}walkUp(e){let t=r=>{!1!==e.call(this,r)&&null!==r.parent&&t(r.parent)};t(this)}}class yx{#uQ=new Map;#uZ=new Map;#uJ=null;constructor(e){this.#uJ=e}getRoots(){return Array.from(this.#uQ.values())}getRootByColumn(e){let t;return this.#uZ.has(e)&&(t=this.#uQ.get(this.#uZ.get(e))),t}getNode(e,t){let r,n=this.getRootByColumn(t);if(!n)return;let o=t-this.#uZ.get(t),i=0;return n.walkDown(n=>{let{origColspan:s,headerLevel:a}=n.data;if(e===a){if(o>=i&&o<=i+s-1)return(r=n).data.isRoot=t===r.data.columnIndex,!1;i+=s}}),r}rebuildTreeIndex(){let e=0;this.#uZ.clear(),J(this.#uQ,t=>{let[,r]=t,{colspan:n}=r.data;for(let t=e;t<e+n;t++)this.#uZ.set(t,e);e+=n})}buildTree(){this.clear();let e=this.#uJ.getColumnsCount(),t=0;for(;t<e;){let e=this.#uJ.getHeaderSettings(0,t),r=new yI({...yy(),headerLevel:0,columnIndex:t});this.#uQ.set(t,r),this.buildLeaves(r,t,0,e.origColspan),t+=e.origColspan}this.rebuildTreeIndex()}buildLeaves(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,o=this.#uJ.getHeadersSettings(r,t,n);r+=1,J(o,n=>{let o,i={...n,headerLevel:r-1,columnIndex:t};1===r?(e.data=i,o=e):(o=new yI(i),e.addChild(o)),r<this.#uJ.getLayersCount()&&this.buildLeaves(o,t,r,n.origColspan),t+=n.origColspan})}clear(){this.#uQ.clear(),this.#uZ.clear()}}function yN(e,t){let{data:r,childs:n}=e;if(r.isCollapsed){if(n.length>0){let e=n.find(e=>{let{data:t}=e;return!t.isHidden});e&&yN(e,t)}else for(let e=0;e<r.colspan;e++)t(r.columnIndex+e);return}if(0===n.length){for(let e=0;e<r.origColspan;e++)t(r.columnIndex+e);return}n.forEach(e=>yN(e,t))}function yO(e){return e.childs.length>0&&e.childs.some(e=>{let{data:t}=e;return void 0!==t.visibleWhen})}function yk(e,t){let{childs:r}=e;if(0!==r.length)return r[0].data[t]}function yH(e){return yk(e,"origColspan")===e.data.origColspan}function y_(e){let{data:t,childs:r}=e;if(!t.isCollapsed||t.isHidden||t.origColspan<=1)return{rollbackModification:()=>{},affectedColumns:[],colspanCompensation:0};if(yO(e))return t.isCollapsed=!1,{rollbackModification:()=>yL(e),affectedColumns:[],colspanCompensation:0};if(yH(e))return y_(r[0]);t.isCollapsed=!1;let n=r.filter(e=>{let{data:t}=e;return t.clonedTree}),o=new Set,i=0;if(n.length>0)J(n,e=>{let t=e.data.clonedTree;e.replaceTreeWith(t);let r=e.data;r.clonedTree=null,i+=r.colspan,yN(e,e=>{o.add(e)})});else if(0===r.length){let{colspan:e,origColspan:r,columnIndex:n}=t;i=r-e;for(let e=1;e<r;e++)o.add(n+e)}return e.walkUp(e=>{let{data:t}=e;t.colspan+=i,t.colspan>=t.origColspan?(t.colspan=t.origColspan,t.isCollapsed=!1):yH(e)&&(t.isCollapsed=yk(e,"isCollapsed"))}),{rollbackModification:()=>yL(e),affectedColumns:Array.from(o),colspanCompensation:i}}function yL(e){let{data:t,childs:r}=e;if(t.isCollapsed||t.isHidden||t.origColspan<=1)return{rollbackModification:()=>{},affectedColumns:[],colspanCompensation:0};if(yO(e))return t.isCollapsed=!0,{rollbackModification:()=>y_(e),affectedColumns:[],colspanCompensation:0};if(yH(e))return yL(r[0]);let n=new Set,o=0;if(r.length>0){let e=r.findIndex(e=>{let{data:t}=e;return!t.isHidden}),i=r.filter((t,r)=>r>e);if(-1===e||0===i.length)return{rollbackModification:()=>{},affectedColumns:[],colspanCompensation:0};J(i,e=>{yN(e,e=>{n.add(e)}),e.data.clonedTree=e.cloneTree(),e.walkDown(e=>{let{data:t}=e;t.isHidden=!0})}),o=t.colspan-r[e].data.colspan}else{let{origColspan:e,columnIndex:r}=t,i=new Set(t.crossHiddenColumns),s=[];for(let t=r;t<r+e;t++)i.has(t)||s.push(t);if(s.length<=1)return{rollbackModification:()=>{},affectedColumns:[],colspanCompensation:0};J(s.slice(1),e=>{n.add(e)}),o=s.length-1}return t.isCollapsed=!0,e.walkUp(e=>{let{data:t}=e;t.colspan-=o,t.colspan<=1?(t.colspan=1,t.isCollapsed=!0):yH(e)&&(t.isCollapsed=yk(e,"isCollapsed"))}),{rollbackModification:()=>y_(e),affectedColumns:Array.from(n),colspanCompensation:o}}let yP=new Map([["collapse",yL],["expand",y_]]);function yD(e){let t=[];return J(e,e=>{e.walkDown(e=>{var r,n;let o,i=e.data,{origColspan:s,columnIndex:a,headerLevel:l,crossHiddenColumns:h}=i,d=(Array.isArray((r=t)[n=l])?o=r[n]:(o=[],r[n]=o),o),u=!1;for(let e=a;e<a+s;e++)if(h.includes(e)||u)d.push(yw());else{let e=function(e){let{crossHiddenColumns:t,columnDropMode:r,...n}=yy(e);return n}(i);e.isRoot=!0,d.push(e),u=!0}})}),function(e){for(let t=0;t<e.length;t++){let r=e[t];for(let n=0;n<r.length;n++){let o=r[n];if(!o||!o.isRoot||!o.origRowspan||o.origRowspan<=1)continue;let i=Math.min(o.origRowspan,e.length-t),s=o.origColspan||1;for(let r=1;r<i;r++){let o=t+r;if(e[o])for(let t=n;t<n+s&&t<e[o].length;t++)e[o][t]={label:"",isPlaceholder:!0,isRowspanPlaceholder:!0}}}}}(t),t}function yF(e,t){e.forEach(e=>{e.walkDown(e=>{let r=e.data,{columnIndex:n,origColspan:o}=r,i=[];for(let e=n;e<n+o;e++)t.isVisible(e)||i.push(e);r.crossHiddenColumns=i,r.colspan=o-i.length,r.isHidden=0===r.colspan})})}function yB(e){let t=[],r=0;for(;r<e.length;){let n=e[r],o=n.isPlaceholder?1:Math.max(1,n.origColspan??1);for(let e=0;e<o;e++)t[r+e]=r;r+=o}return t}function yV(e,t,r){if(void 0!==r)return r>=0?r:-1-e;let n=t[e];return void 0===n?-1-e:n}function yU(){return{getPhysicalFromVisual:e=>e}}class yz{#uJ=new yR;#u0=new yR;#u1=new yx(this.#u0);#u2=[[]];#u3=null;#u6=null;#u5=new Map;setState(e){this.#uJ.setData(e),this.#u4();let t=!1;try{this.#u9()}catch(e){this.#u1.clear(),this.#u0.clear(),this.#uJ.clear(),t=!0}return this.#u7(),t}setColumnsLimit(e){this.#uJ.setColumnsLimit(e)}setColumnArrangement(e){this.#u6=e}rebuildState(){let e=this.#u8();this.#u9(),this.#ce(),this.#ct(e),this.#u7()}#u8(){let e=[];return this.#u1.getRoots().forEach(t=>{t.walkDown(t=>{let{isCollapsed:r,headerLevel:n,authoredColumnIndex:o}=t.data;r&&"number"==typeof o&&o>=0&&e.push({headerLevel:n,authoredColumnIndex:o})})}),e}#ct(e){e.forEach(e=>{let{headerLevel:t,authoredColumnIndex:r}=e,n=this.#cr(t,r);1===n.length&&this.#cn("collapse",t,n[0].data.columnIndex)})}#cr(e,t){let r=[];return this.#u1.getRoots().forEach(n=>{n.walkDown(n=>{n.data.headerLevel===e&&n.data.authoredColumnIndex===t&&r.push(n)})}),r}mergeStateWith(e){let t=Z(e,e=>{let{row:t,...r}=e;return{row:t<0?this.rowCoordsToLevel(t)??t:t,...r}});this.#co(()=>this.#uJ.mergeWith(t),e=>e)}mapState(e){this.#co(()=>this.#uJ.map(e),e=>e)}insertColumns(e,t,r){this.#u4(),this.#co(()=>this.#uJ.insertColumns(t,r),t=>t>=e?t+r:t)}removeColumns(e,t,r){let n=e+t;this.#u4(),this.#co(()=>{[...r].sort((e,t)=>t-e).forEach(e=>this.#uJ.removeColumns(e,1))},r=>r<e?r:r>=n?r-t:e)}#co(e,t){let r=this.#ci();e(),this.#u9(),this.#ce(),this.#cs(r,t),this.#u7()}#ci(){let e=[];return this.#u1.getRoots().forEach(t=>{t.walkDown(t=>{let r=t.data;r.isCollapsed&&e.push({headerLevel:r.headerLevel,columnIndex:r.columnIndex})})}),e}#cs(e,t){e.forEach(e=>{let{headerLevel:r,columnIndex:n}=e;this.#cn("collapse",r,t(n))})}mapNodes(e){let t=[];return this.#u1.getRoots().forEach(r=>{r.walkDown(r=>{let n=e(r.data);void 0!==n&&t.push(n)})}),t}triggerNodeModification(e,t,r){let{actionResult:n,modified:o}=this.#cn(e,t,r);return o&&(this.#u2=yD(this.#u1.getRoots())),n}#cn(e,t,r){let n;t<0&&(t=this.rowCoordsToLevel(t)??0);let o=this.#u1.getNode(t,r);return o?{actionResult:((n=yP.get(e))||tr(`The node modifier action ("${e}") does not exist.`),n(o,r)??void 0),modified:!0}:{actionResult:void 0,modified:!1}}triggerColumnModification(e,t){return this.triggerNodeModification(e,-1,t)}syncVisibility(e){this.#u3=e,yF(this.#u1.getRoots(),e),this.#u2=yD(this.#u1.getRoots())}#u7(){this.#ce(),this.#u2=yD(this.#u1.getRoots())}#ce(){this.#u3&&yF(this.#u1.getRoots(),this.#u3)}#u9(){var e,t;let r,n=this.#u6??yU();this.#u0.setNormalizedData((e=this.#uJ.getData(),t=this.#u5,r=e.length>0?e[0].length:0,e.map((e,o)=>(function(e,t,r,n,o){let i=yB(e),s=e=>{let r=t.getPhysicalFromVisual(e);return yV(r,i,o?.get(r)?.get(n))},a=[],l=0;for(;l<r;){let t=s(l),n=1;for(;l+n<r&&s(l+n)===t;)n+=1;let o=t>=0?e[t]:yy();a.push(function(e,t,r){let n={...e,colspan:t,origColspan:t,isPlaceholder:!1,authoredColumnIndex:r};return Array.isArray(n.headerClassNames)&&(n.headerClassNames=n.headerClassNames.slice()),Array.isArray(n.crossHiddenColumns)&&(n.crossHiddenColumns=n.crossHiddenColumns.slice()),n}(o,n,t));for(let e=1;e<n;e++)a.push(yw());l+=n}return a})(e,n,r,o,t)))),this.#u1.buildTree()}reparentColumns(e){let t=this.#u6??yU(),r=this.#uJ.getData(),n=r.length,o=n>0?r[0].length:0;if(n<=1||0===o)return;let i=r.map(e=>yB(e)),s=(e,r)=>{let n=t.getPhysicalFromVisual(e);return yV(n,i[r],this.#u5.get(n)?.get(r))},a=(e,r)=>yV(t.getPhysicalFromVisual(e),i[r]),l=new Set(e),h=(e,t)=>{let r=e-1,n=e+1;for(;r>=0&&l.has(r);)r-=1;for(;n<o&&l.has(n);)n+=1;if(r<0||n>=o)return -1;let i=s(r,t);return i===s(n,t)&&i>=0?i:-1},d=[];e.forEach(e=>{let o=t.getPhysicalFromVisual(e),s=-1;for(let t=0;t<n-1;t++){let n=h(e,t);n>=0&&r[t][n]?.columnDropMode!=="split"&&(s=t)}for(let t=0;t<n-1;t++){let r=a(e,t),n=t<=s?this.#ca(e,t,h,a,i):r;d.push({physical:o,level:t,identity:n===r?null:n})}}),d.forEach(e=>{let{physical:t,level:r,identity:n}=e;this.#cl(t,r,n)})}#ca(e,t,r,n,o){let i=r(e,t);if(i>=0)return i;let s=r(e,t+1);return s>=0?o[t][s]:n(e,t)}#u4(){this.#u5=new Map}#cl(e,t,r){if(null===r){let r=this.#u5.get(e);r?.delete(t),r?.size===0&&this.#u5.delete(e);return}this.#u5.has(e)||this.#u5.set(e,new Map),this.#u5.get(e).set(t,r)}rowCoordsToLevel(e){if(e>=0)return null;let t=e+Math.max(this.getLayersCount(),1);return t<0?null:t}levelToRowCoords(e){if(e<0)return null;let t=e-Math.max(this.getLayersCount(),1);return t>=0?null:t}getHeaderSettings(e,t){return(e<0&&(e=this.rowCoordsToLevel(e)??0),null===e||e>=this.getLayersCount())?null:this.#u2[e]?.[t]??null}getHeaderTreeNodeData(e,t){let r=this.getHeaderTreeNode(e,t);return r?{...r.data}:null}getHeaderTreeNode(e,t){let r=e;if(e<0&&(r=this.rowCoordsToLevel(e)),null===r||r>=this.getLayersCount())return null;let n=this.#u1.getNode(r,t);return n||null}findTopMostEntireHeaderLevel(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,r=t-e+1,n=!1,o=null;for(let i=e;i<=t;i++){let s=this.#u1.getRootByColumn(i);if(!s)break;n=!0,s.walkDown(n=>{let{columnIndex:i,headerLevel:s,origColspan:a,isHidden:l}=n.data;!l&&a<=r&&i>=e&&i+a-1<=t&&(null===o||s<o)&&(o=s)},yE)}return n&&null===o?-1:this.levelToRowCoords(o??0)}findLeftMostColumnIndex(e,t){let{isRoot:r}=this.getHeaderSettings(e,t)??{isRoot:!0};if(r)return t;let n=t-1;for(;n>=0;){let{isRoot:t}=this.getHeaderSettings(e,n)??{isRoot:!0};if(t)break;n-=1}return n}findRightMostColumnIndex(e,t){let{isRoot:r,origColspan:n}=this.getHeaderSettings(e,t)??{isRoot:!0,origColspan:1};if(r)return t+n-1;let o=t+1;for(;o<this.getColumnsCount();){let{isRoot:t}=this.getHeaderSettings(e,o)??{isRoot:!0};if(t)break;o+=1}return o-1}getLayersCount(){return this.#uJ.getLayersCount()}getColumnsCount(){return this.#u0.getColumnsCount()}getVisibleWhenHiddenColumns(){let e=[];return this.#u1.getRoots().forEach(t=>{t.walkDown(t=>{let r=t.childs;if(!0!==t.data.collapsible||0===r.length||!yO(t))return;let n=!0===t.data.isCollapsed,o=r.filter(e=>{let t=e.data.visibleWhen??"expanded";return"expanded"===t&&n||"collapsed"===t&&!n});o.length===r.length&&o.shift(),o.forEach(t=>{let{data:{columnIndex:r,origColspan:n}}=t;for(let t=0;t<n;t++)e.push(r+t)})})}),e}getCollapsedGroups(){let e=[];return this.#u1.getRoots().forEach(t=>{t.walkDown(t=>{let{isCollapsed:r,headerLevel:n,columnIndex:o,origColspan:i}=t.data;r&&e.push({headerLevel:n,columnIndex:o,origColspan:i})})}),e}clear(){this.#u2=[],this.#uJ.clear(),this.#u0.clear(),this.#u1.clear(),this.#u3=null,this.#u5=new Map}}function yW(e){return{isVisible(t){let r=e.columnIndexMapper.getPhysicalFromVisualIndex(t);return null!==r&&!e.columnIndexMapper.isHidden(r)}}}let yG=class{headersStateManager;layersCount=0;widthsMap;constructor({hot:e,headersStateManager:t}){this.hot=e,this.headersStateManager=t,this.widthsMap=this.hot.columnIndexMapper.createAndRegisterIndexMap("nestedHeaders.widthsMap","physicalIndexToValue")}setLayersCount(e){return this.layersCount=e,this}getWidth(e){return this.widthsMap.getValueAtIndex(this.hot.toPhysicalColumn(e))}buildWidthsMap(){let e=this.#ch(),t=e.size>0,r=this.hot.getCurrentThemeName(),n=new Map;t&&e.forEach(e=>{let t=this.widthsMap.getValueAtIndex(e);null!=t&&n.set(e,t)}),this.container=this.hot.rootDocument.createElement("div"),this.container.classList.add("handsontable","htGhostTable","htAutoSize","htNestedHeaders"),r&&this.container.classList.add(r),this.#cd(this.container),this.hot.rootDocument.body.appendChild(this.container);let o=this.container.querySelector('[data-ghost-table="rendered"]');if(!o){this.container.remove(),this.container=null;return}let i=o.querySelectorAll("th[data-column]"),s=new Map;for(let e=0;e<i.length;e++){let t=i[e];if(t.colSpan>1||void 0===t.dataset.column)continue;let r=Number.parseInt(t.dataset.column,10);s.set(r,t)}this.widthsMap.clear(),s.forEach((r,o)=>{let i,s=this.hot.toPhysicalColumn(o);this.hot.columnIndexMapper.isHidden(s)||(t&&e.has(s)&&(i=n.get(s)),null==i&&(i=r.getBoundingClientRect().width),this.widthsMap.setValueAtIndex(s,i))}),this.container.remove(),this.container=null}#ch(){let e=new Set,t=this.hot.countCols();for(let r=0;r<t;r++){let t=this.headersStateManager.getHeaderTreeNode(-1,r);if(!t)continue;let n=!1;t.walkUp(e=>{if(!0===e.data.isCollapsed)return n=!0,!1}),n&&e.add(this.hot.toPhysicalColumn(r))}return e}#cd(e){let t=this.hot.getSettings(),r=!!t.dropdownMenu,n=!!t.collapsibleColumns,o=this.hot.countCols();e.innerHTML=this.#cu(o,r,n)}#cu(e,t,r){let n="";for(let o=0;o<this.layersCount;o++){let i="";for(let n=0;n<e;n++){let e=this.headersStateManager.getHeaderSettings(o,n);if(e&&!e.isPlaceholder&&!e.isHidden&&!e.isRowspanPlaceholder){let o=(e.rowspan??0)>1?` rowspan="${e.rowspan}"`:"";i+=`<th data-column="${n}" colspan="${e.colspan}"${o}>${this.#cc(e,t,r)}</th>`}}n+=`<tr>${i}</tr>`}return`<table data-ghost-table="rendered"><thead>${n}</thead></table>`}#cc(e,t,r){let n=String(e.label),o=rf.test(n)?at(this.hot,n,"header"):n,i=r&&(e.origColspan>1||e.colspan>1);return`<div class="relative"><span class="colHeader">${o}</span>${t?'<button class="changeType"></button>':""}${i?'<div class="collapsibleIndicator expanded">-</div>':""}</div>`}clear(){this.widthsMap.clear(),this.container=null}},y$="nestedHeaders";class yY extends pa{static get PLUGIN_KEY(){return y$}static get PLUGIN_PRIORITY(){return 280}#cg=new yz;#cp=!1;#cm=null;#cf=null;#cb=e=>{let{indexesSequenceChanged:t,hiddenIndexesChanged:r}=e;!this.enabled||((t&&"move"===this.hot.columnIndexMapper.indexesChangeSource||this.#cp)&&(this.#cC(),this.#cg.rebuildState(),this.#cp=!1,this.#cm=null,this.#cf=null),this.#cg.syncVisibility(yW(this.hot)),r&&this.ghostTable.buildWidthsMap())};#o8=()=>{this.enabled&&this.hot.columnIndexMapper.isBatched&&(this.#cp=!0)};#sM=(e,t,r,n)=>{this.enabled&&!1!==n&&(this.#cm=e.map(e=>this.hot.toPhysicalColumn(e)),this.#cf=this.hot.columnIndexMapper.getIndexesSequence())};#cC(){let e=this.#cm,t=this.#cf;if(null===e||null===t)return;let r=this.hot.columnIndexMapper.getIndexesSequence();if(t.length===r.length&&t.every((e,t)=>e===r[t])||!this.#cy(e,t,r))return;let n=[];e.forEach(e=>{let t=this.hot.columnIndexMapper.getVisualFromPhysicalIndex(e);null!==t&&n.push(t)}),this.#cg.reparentColumns(n)}#cy(e,t,r){let n=new Set(e),o=t.filter(e=>!n.has(e)),i=r.filter(e=>!n.has(e));return o.length===i.length&&o.every((e,t)=>e===i[t])}#cw=null;#cS=!1;#cv=null;#cR=null;#cE=null;#cT=null;#cA=!1;ghostTable=new yG({hot:this.hot,headersStateManager:this.#cg});detectedOverlappedHeaders=!1;#cM=!1;isEnabled(){return!!this.hot.getSettings()[y$]}enablePlugin(){if(this.enabled)return;let{nestedHeaders:e}=this.hot.getSettings();Array.isArray(e)&&Array.isArray(e[0])||tQ(ec`Your Nested Headers plugin configuration is invalid. The settings has to be\x20
                        passed as an array of arrays e.q. [['A1', { label: 'A2', colspan: 2 }]]`),this.addHook("init",this.#oz),this.addHook("afterLoadData",this.#oP),this.addHook("afterCreateCol",this.#sv),this.addHook("afterRemoveCol",this.#sE),this.addHook("beforeColumnMove",this.#sM),this.addHook("afterColumnMove",this.#o8),this.addHook("beforeOnCellMouseDown",this.#o9),this.addHook("afterOnCellMouseDown",this.#cI),this.addHook("beforeOnCellMouseOver",this.#du),this.addHook("afterOnCellMouseOver",this.#cx),this.addHook("beforeOnCellMouseUp",this.#cN),this.addHook("beforeSelectionHighlightSet",this.#ub),this.addHook("modifyTransformStart",this.#um),this.addHook("afterSelection",this.#cO),this.addHook("afterSelectionFocusSet",this.#cO),this.addHook("beforeViewportScrollHorizontally",this.#aY),this.addHook("afterGetColumnHeaderRenderers",this.#ck),this.addHook("modifyColWidth",this.#dP),this.addHook("modifyColumnHeaderHeight",this.#cH),this.addHook("modifyColumnHeaderValue",this.#c_),this.addHook("beforeHighlightingColumnHeader",this.#cL),this.addHook("beforeCopy",this.#cP),this.addHook("beforeSelectColumns",this.#cD),this.addHook("beforeViewRender",this.#o2),this.addHook("afterViewportColumnCalculatorOverride",this.#uA),this.addHook("modifyFocusedElement",this.#cF),this.hot.columnIndexMapper.addLocalHook("cacheUpdated",this.#cb),this.hot.columnIndexMapper.addLocalHook("cacheUpdated",this.#cO),this.hot.rowIndexMapper.addLocalHook("cacheUpdated",this.#cO),super.enablePlugin(),this.updatePlugin()}updatePlugin(){var e;if(!this.hot.view)return;let{nestedHeaders:t}=this.hot.getSettings();this.#cE=null,this.#cT=null,this.#cg.setColumnsLimit(this.hot.countCols()),this.#cg.setColumnArrangement((e=this.hot,{getPhysicalFromVisual(t){let r=e.columnIndexMapper.getPhysicalFromVisualIndex(t);return null===r?t:r}})),Array.isArray(t)&&(this.detectedOverlappedHeaders=this.#cg.setState(t)),this.#cM=this.#cg.mapNodes(e=>{let{origRowspan:t}=e;return t>1||void 0}).length>0,this.#cM?rd(this.hot.rootElement,"htHasRowspanHeaders"):ru(this.hot.rootElement,"htHasRowspanHeaders"),this.detectedOverlappedHeaders&&tQ(ec`Your Nested Headers plugin setup contains overlapping headers. This kind of configuration\x20
                        is currently not supported.`),this.enabled&&this.#cg.syncVisibility(yW(this.hot)),this.#cA=!0,super.updatePlugin()}disablePlugin(){this.hot.rowIndexMapper.removeLocalHook("cacheUpdated",this.#cO),this.hot.columnIndexMapper.removeLocalHook("cacheUpdated",this.#cO),this.hot.columnIndexMapper.removeLocalHook("cacheUpdated",this.#cb),this.clearColspans(),this.#cg.clear(),this.#cE=null,this.#cT=null,ru(this.hot.rootElement,"htHasRowspanHeaders"),this.ghostTable.clear(),super.disablePlugin()}getStateManager(){return this.#cg}getLayersCount(){return this.#cg.getLayersCount()}getHeaderSettings(e,t){return this.#cg.getHeaderSettings(e,t)}clearColspans(){if(!this.hot.view)return;let{_wt:e}=this.hot.view,t=e.getSetting("columnHeaders").length,r=e.wtTable.THEAD,n=e.wtOverlays.topOverlay.clone?.wtTable.THEAD,o=e.wtOverlays.topInlineStartCornerOverlay?.clone?.wtTable.THEAD??null;if(r&&n)for(let e=0;e<t;e++){let t=r.childNodes[e];if(!t)break;let i=n.childNodes[e],s=o?o.childNodes[e]:null;for(let e=0,r=t.childNodes.length;e<r;e++){let r=t.childNodes[e];if(r.removeAttribute("colspan"),r.removeAttribute("rowspan"),r.style.display="",ru(r,"hiddenHeader"),i&&i.childNodes[e]){let t=i.childNodes[e];t.removeAttribute("colspan"),t.removeAttribute("rowspan"),t.style.display="",ru(t,"hiddenHeader")}if(o&&s&&s.childNodes[e]){let t=s.childNodes[e];t.removeAttribute("colspan"),t.removeAttribute("rowspan"),t.style.display="",ru(t,"hiddenHeader")}}}}headerRendererFactory(e){let t=this.hot.view._wt.getSetting("fixedColumnsStart");return(r,n)=>{let{columnIndexMapper:o}=this.hot,i=o.getVisualFromRenderableIndex(r);null===i&&(i=r),n.removeAttribute("colspan"),n.removeAttribute("rowspan"),n.style.display="",ru(n,"hiddenHeader"),ru(n,"hiddenHeaderText"),ru(n,"htRowspanHeader"),ru(n,"htRowspanBottomLevel");let{colspan:s,rowspan:a,isHidden:l,isPlaceholder:h,isRowspanPlaceholder:d,headerClassNames:u}=this.#cg.getHeaderSettings(e,i)??{};if(d?(rd(n,"hiddenHeader"),n.style.display="none"):h||l?rd(n,"hiddenHeader"):(this.#cB(n,s,i,r,t),this.#cV(n,a,e)),this.hot.view.appendColHeader(i,n,(e,t)=>this.getColumnHeaderValue(e,t),e),e+(a??1)!==this.getLayersCount()&&ru(n,["beforeHiddenColumn","afterHiddenColumn"]),!h&&!l&&!d){let e=n.querySelector("div.relative");e&&u&&u.length>0&&(ru(e,this.hot.getColumnMeta(i).headerClassName??[]),rd(e,u))}}}#cB(e,t,r,n,o){if(void 0===t||t<=1)return;let{wtOverlays:i}=this.hot.view._wt,s=i.topInlineStartCornerOverlay?.clone?.wtTable.THEAD?.contains(e),a=i.inlineStartOverlay?.clone?.wtTable.THEAD?.contains(e);i.topOverlay?.clone?.wtTable.THEAD?.contains(e)&&r<o&&rd(e,"hiddenHeaderText");let l=s||a?Math.min(t,o-n):t;l>1&&e.setAttribute("colspan",String(l))}#cV(e,t,r){if(void 0===t||t<=1)return;let n=r+t===this.getLayersCount();rd(e,"htRowspanHeader"),n&&rd(e,"htRowspanBottomLevel"),e.setAttribute("rowspan",String(t))}getColumnHeaderValue(e,t){let{isHidden:r,isPlaceholder:n,isRowspanPlaceholder:o}=this.#cg.getHeaderSettings(t,e)??{};return n||r||o?"":this.hot.getColHeader(e,t)}#cO=()=>{let e=this.hot?.getSelectedRangeActive();if(!e)return;let{highlight:t}=e;if(null!==t.row&&null!==t.col&&t.isHeader()&&t.col>=0&&null!==t.row&&null!==t.col){let{isRowspanPlaceholder:e}=this.#cg.getHeaderSettings(t.row,t.col)??{},r=e?this.#cU(t.row,t.col):t.row,n=this.#cg.findLeftMostColumnIndex(r,t.col),o=this.hot.selection.highlight.getFocus(),i=o.visualCellRange;if(null===i)return;i.highlight.row=r,i.highlight.col=n,i.from.row=r,i.from.col=n,i.to.row=r,i.to.col=n,o.commit()}};#cU(e,t){let r=-this.getLayersCount();for(let n=e;n>=r;n--){let{isRowspanPlaceholder:e}=this.#cg.getHeaderSettings(n,t)??{};if(!e)return n}return e}#cz(e,t){let r=this.#cg.findLeftMostColumnIndex(e,t),{rowspan:n=1}=this.#cg.getHeaderSettings(e,r)??{};return n}#cW(e,t){let r=this.#cg.getHeaderSettings(e,t);if(!r)return!1;let{isPlaceholder:n,isRowspanPlaceholder:o,isHidden:i}=r;return o?e<-1:!n&&!o&&!i}#cG(e,t,r){if(![-1,1].includes(r))return null;for(let n=t;n>=0&&n<this.hot.countCols();n+=r)if(this.#cW(e,n))return n;return null}#aY=(e,t)=>{let r=this.hot.getSelectedRangeActive();if(!r)return e;let{highlight:n}=r,{navigableHeaders:o}=this.hot.getSettings(),i=this.hot.selection.isSelectedByColumnHeader(),s=o?n.row:this.#cR?.row,a=i?e:n.col,l=null!=s&&null!=a&&s<0&&a>=0;if(this.#cR=null,!l||null==s||null==a)return e;let h=this.hot.getFirstFullyVisibleColumn(),d=this.hot.getLastFullyVisibleColumn(),u=d-h+1,c=this.#cg.findLeftMostColumnIndex(s,a),g=this.#cg.findRightMostColumnIndex(s,a),p=g-c+1;if(c<h&&g>d)return c;if(i){let e=null;return c>=h&&g>d?p>u?(t.value="start",e=c):(t.value="end",e=g):c<h&&g<=d&&(p>u?(t.value="end",e=g):(t.value="start",e=c)),e}return c<=h?c:g};#cL=(e,t,r)=>{let n=this.#cg.getHeaderTreeNodeData(t,e);if(!n)return e;let{columnCursor:o,selectionType:i,selectionWidth:s}=r,{isRoot:a,colspan:l=1}=this.#cg.getHeaderSettings(t,e)??{};if("header"===i){if(!a)return n.columnIndex}else if(i===sK&&(l>s-o||!a))return null;return e};#cP=(e,t,r)=>{let{columnHeadersCount:n}=r;if(0!==n)for(let r=0;r<t.length;r++){let{startRow:n,startCol:o,endRow:i,endCol:s}=t[r],a=i-n+1,l=o-s+1;if(n>=0||1===l)break;for(let t=o;t<=s;t++)for(let r=n;r<=i;r++){let n=a+r,i=t-o;0!==i&&!1===this.#cg.getHeaderTreeNodeData(r,t)?.isRoot&&(e[n][i]="")}}};#o9=(e,t,r,n)=>{this.#cE=null,this.#cT=null,this._getHeaderTreeNodeDataByCoords(t)&&(n.column=!0)};#cI=(e,t)=>{if(null===t.row||null===t.col)return;let r={row:t.row,col:t.col},n=this._getHeaderTreeNodeDataByCoords(r);if(!n)return;this.#cw={row:t.row,col:t.col,clone:()=>t.clone()},this.#cS=!0;let{selection:o}=this.hot,i=o.isSelected()?o.getSelectedRange().current():null,s=null,{columnIndex:a,origColspan:l}=n,h=!o.inInSelection(t);e.shiftKey&&i?s=(t.col??0)<(i.from.col??0)?[i.getTopEndCorner().col??0,a,t.row??0]:(t.col??0)>(i.from.col??0)?[i.getTopStartCorner().col??0,a+l-1,t.row??0]:[a,a+l-1,t.row??0]:(nA(e)||nT(e)&&h||nI(e))&&(s=[a,a+l-1,t.row]),null!==s&&o.selectColumns(...s)};#du=(e,t,r,n)=>{let o;if(this.#cv=null,!this.hot.view.isMouseDown()||n.column)return;let i=this._getHeaderTreeNodeDataByCoords(t);if(!i)return;let{columnIndex:s,origColspan:a}=i,l=this.hot.getSelectedRangeActive();if(!l)return;let h=l.getTopStartCorner(),d=l.getBottomEndCorner(),{from:u}=l;n.column=!0,n.cell=!0;let c=ox(t.row??0,-1/0,-1);o=(t.col??0)<(u.col??0)?[d.col??0,s,c]:(t.col??0)>(u.col??0)?[h.col??0,s+a-1,c]:[s,s+a-1,c],this.#cv=o};#cx=()=>{if(null===this.#cv)return;let e=this.#cv;this.#cv=null,this.hot.selection.selectColumns(...e)};#cN=()=>{this.#cS=!1};#ub=()=>{let{navigableHeaders:e}=this.hot.getSettings();if(!this.hot.view.isMouseDown()||!this.#cS||!e)return;let t=this.hot.getSelectedRangeLast();if(!t)return;let r=t.getTopStartCorner().col,n=t.getBottomEndCorner().col,o=this.#cg.getHeaderTreeNodeData(this.#cw.row,this.#cw.col);if(!o)return;let{columnIndex:i,origColspan:s}=o;if(t.setHighlight(this.#cw),null!==r&&null!==n&&(s>t.getWidth()||i<r||i+s-1>n)){let e=this.#cg.findTopMostEntireHeaderLevel(ox(r,i,i+s-1),ox(n,i,i+s-1));t.highlight.row=e,t.highlight.col=t.from.col}};#um=e=>{let t=this.hot.getSelectedRangeActive();if(!t)return;let{highlight:r}=t,{row:n,col:o}=this.#cT??{};Number.isInteger(n)&&Number.isInteger(o)&&(r.row!==n||r.col!==o)&&(this.#cE=null);let i=r.row??0,s=r.col??0,a=e.row,l=e.col,h=s+e.col,d=i+e.row;if(0!==e.row&&h>=0){let t=Math.sign(e.row),r=-this.getLayersCount(),n=d;for(;n<=-1&&n>=r;){let{isRowspanPlaceholder:e}=this.#cg.getHeaderSettings(n,h)??{};if(!e)break;n+=t}e.row=n-i,d=n}if(0===a&&0!==l&&i<0){if(null!==this.#cE){let e=this.#cG(this.#cE,h,Math.sign(l));null!==e&&(h=e,d=this.#cE)}h<0&&l<0&&null!==this.#cE&&(d=this.#cE);let t=this.#cg.findLeftMostColumnIndex(i,s),r=this.#cg.findRightMostColumnIndex(i,s),{isRowspanPlaceholder:n}=this.#cg.getHeaderSettings(d,h)??{},o=d===i&&h>=t&&h<=r,a=d===i&&n&&l>0&&i<-1;o||a||(d=this.#cU(d,h)),e.row=d-i,this.#cz(d,h)>1&&!Number.isInteger(this.#cE)&&(this.#cE=function(e,t,r,n){if(e<=r)return e;for(let r=e+1;r<=-1;r++){let e=n(r,t);if(!e)continue;let{isPlaceholder:o,isRowspanPlaceholder:i,isHidden:s}=e;if(!o&&!i&&!s)return r}return e}(i,h,-this.getLayersCount(),(e,t)=>{let r=this.#cg.getHeaderSettings(e,t);return r?{...r,isRowspanPlaceholder:r.isRowspanPlaceholder??!1}:null}))}let u=this.hot._createCellCoords(d,h),c=u.isHeader()&&(u.col??-1)>=0;if(c&&0===a||(this.#cE=null),c&&null!==r.row&&null!==r.col&&null!==u.row&&null!==u.col){let{isRowspanPlaceholder:t}=this.#cg.getHeaderSettings(r.row,r.col)??{},{isRowspanPlaceholder:n}=this.#cg.getHeaderSettings(u.row,u.col)??{},o=this.#cg.findLeftMostColumnIndex(u.row,u.col),i=this.#cg.findRightMostColumnIndex(u.row,u.col);if(n){let e=this.#cU(u.row,u.col);o=this.#cg.findLeftMostColumnIndex(e,u.col),i=this.#cg.findRightMostColumnIndex(e,u.col)}if(t){let e=this.#cU(r.row,r.col);o=this.#cg.findLeftMostColumnIndex(e,r.col),i=this.#cg.findRightMostColumnIndex(e,r.col),l<0?o=Math.max(o,Math.min(r.col,u.col)):l>0&&(i=Math.min(i,Math.max(r.col,u.col)))}if(e.col<0){let t=r.col>=o&&r.col<=i?o-1:i,n=this.hot.columnIndexMapper.getNearestNotHiddenIndex(t,-1);null===n?e.col=-this.hot.view.countRenderableColumnsInRange(0,r.col):e.col=-Math.max(this.hot.view.countRenderableColumnsInRange(n,r.col)-1,1)}else if(e.col>0){let n=r.col>=o&&r.col<=i?i+1:o,s=this.hot.columnIndexMapper.getNearestNotHiddenIndex(n,1);null===s?(e.col=this.hot.view.countRenderableColumnsInRange(r.col,this.hot.countCols()),t&&(e.col+=1,r.row<-1&&(e.row=1,e.col=-(r.col+1)))):e.col=Math.max(this.hot.view.countRenderableColumnsInRange(r.col,s)-1,1)}}this.#cT={row:i+e.row,col:s+e.col}};#cD=(e,t,r)=>{let n=e.row,o=this._getHeaderTreeNodeDataByCoords({row:n,col:e.col}),i=this._getHeaderTreeNodeDataByCoords({row:n,col:t.col});this.#cR=r.clone(),t.col<e.col?(o&&(e.col=o.columnIndex+o.origColspan-1),i&&(t.col=i.columnIndex)):t.col>=e.col&&(o&&(e.col=o.columnIndex),i&&(t.col=i.columnIndex+i.origColspan-1))};#ck=e=>{if(this.#cg.getLayersCount()>0){e.length=0;for(let t=0;t<this.#cg.getLayersCount();t++)e.push(this.headerRendererFactory(t))}};#uA=e=>{this.#c$(e),this.#cY(e)};#c$(e){let t=this.#cg.getLayersCount(),r=e.startColumn,n=!!t;for(let o=0;o<t;o++){let t=this.#cg.findLeftMostColumnIndex(o,e.startColumn),i=this.hot.columnIndexMapper.getRenderableFromVisualIndex(t);if(t>=0&&(n=!1),oS(i)&&null!==i&&i<e.startColumn){r=i;break}}e.startColumn=n?this.#cg.getHeaderTreeNodeData(0,r)?.columnIndex??r:r}#cY(e){let t=this.hot.columnIndexMapper,r=this.#cg.getLayersCount(),n=t.getVisualFromRenderableIndex(e.endColumn);if(null!==n)for(let o=0;o<r;o++){let r=this.#cg.findRightMostColumnIndex(o,n),i=t.getNearestNotHiddenIndex(r,-1),s=null===i?null:t.getRenderableFromVisualIndex(i);if(null!==s&&s>e.endColumn){e.endColumn=s;break}}}#dP=(e,t)=>{if(!1===this.hot.getSettings().autoColumnSize)return e;let r=this.ghostTable.getWidth(t)??0;return e>r?e:r};#cH=()=>{if(!this.#cM)return;let e=this.hot.rootWindow.getComputedStyle(this.hot.rootElement),t=Math.round(2*Number.parseFloat(e.getPropertyValue("--ht-cell-vertical-padding"))+Number.parseFloat(e.getPropertyValue("--ht-line-height"))+1);if(Number.isFinite(t))return Array(this.getLayersCount()).fill(t)};#c_=(e,t,r)=>{let{label:n}=this.#cg.getHeaderTreeNodeData(r,t)??{label:""};return n};#cF=(e,t)=>{if(e<0)return this.hot.getCell(e,this.#cg.findLeftMostColumnIndex(e,t),!0)??void 0};#oz=()=>{this.updatePlugin()};#oP=(e,t)=>{t||this.updatePlugin()};#sv=(e,t)=>{let r=this.hot.columnIndexMapper.getPhysicalFromVisualIndex(e)??e;this.#cg.insertColumns(e,r,t),this.#cA=!0};#sE=(e,t,r)=>{this.#cg.removeColumns(e,t,r),this.#cA=!0};#o2=()=>{this.#cA&&(this.ghostTable.setLayersCount(this.getLayersCount()).buildWidthsMap(),this.#cA=!1)};destroy(){this.#cg.clear(),ru(this.hot.rootElement,"htHasRowspanHeaders"),super.destroy()}_getHeaderTreeNodeDataByCoords(e){if(!(e.row>=0)&&!(e.col<0))return this.#cg.getHeaderTreeNodeData(e.row,e.col)}}class yj{data=null;parentReference=new WeakMap;cache={levels:[],levelCount:0,rows:[],nodeInfo:new WeakMap};constructor(e,t){this.hot=t,this.plugin=e}setData(e){this.data=e}getData(){return this.data}getRawSourceData(){let e=null;return this.plugin.disableCoreAPIModifiers(),e=this.hot.getSourceData(),this.plugin.enableCoreAPIModifiers(),e}updateWithData(e){this.setData(e),this.rewriteCache()}rewriteCache(){this.cache={levels:[],levelCount:0,rows:[],nodeInfo:new WeakMap},oA(0,this.data.length-1,e=>{this.cacheNode(this.data[e],0,null)})}cacheNode(e,t,r){e&&"object"==typeof e&&(this.cache.levels[t]||(this.cache.levels[t]=[],this.cache.levelCount+=1),this.cache.levels[t].push(e),this.cache.rows.push(e),this.cache.nodeInfo.set(e,{parent:r,row:this.cache.rows.length-1,level:t}),this.hasChildren(e)&&e.__children&&J(e.__children,r=>{this.cacheNode(r,t+1,e)}))}getDataObject(e){return null==e?null:this.cache.rows[e]}readTreeNodes(e,t,r,n){let o=!1,i=t;if("number"!=typeof i)return i;let s=e;return(s||(s={__children:this.data},o=!0,i-=1),null!=r&&i===r)?{result:s,end:!0}:null!=n&&s===n?{result:i,end:!0}:(i+=1,s.__children&&J(s.__children,e=>{if(this.parentReference.set(e,o?null:s),"number"!=typeof(i=this.readTreeNodes(e,i,r,n)))return!1}),i)}mockParent(){let e=this.mockNode();return e.__children=this.data,e}mockNode(){let e={};return tp(this.data[0],(t,r)=>{e[r]=null}),e}getRowIndex(e){if(null==e||"object"!=typeof e)return null;let t=this.cache.nodeInfo.get(e);return t?t.row:null}getRowIndexWithinParent(e){let t=null;t="number"!=typeof e?e:this.getDataObject(e);let r=this.getRowParent(e);return null==r?this.data.indexOf(t):r.__children.indexOf(t)}countAllRows(){let e={__children:this.data};return this.countChildren(e)}countChildren(e){let t=0,r="number"==typeof e?this.getDataObject(e):e;return r&&r.__children?(J(r.__children,e=>{t+=1,e.__children&&(t+=this.countChildren(e))}),t):0}getRowParent(e){let t;return t="number"!=typeof e?e:this.getDataObject(e),this.getRowObjectParent(t)}getRowObjectParent(e){if(!e||"object"!=typeof e)return null;let t=this.cache.nodeInfo.get(e);return t?t.parent:null}getRowLevel(e){let t=null;return(t="number"!=typeof e?e:this.getDataObject(e))?this.getRowObjectLevel(t):null}getRowObjectLevel(e){if(null==e||"object"!=typeof e)return null;let t=this.cache.nodeInfo.get(e);return t?t.level:null}hasChildren(e){let t="number"==typeof e?this.getDataObject(e):e;return!!(t&&t.__children&&t.__children.length)}isChild(e){return null!==this.getRowParent(e)}getChild(e,t){return e.__children?.[t]||null}isRowHighestLevel(e){return!this.isChild(e)}isParent(e){let t="number"==typeof e?this.getDataObject(e):e;return!!(t&&t.__children&&0!==t.__children.length)}addChild(e,t){let r=t;this.hot.runHooks("beforeAddChild",e,r);let n=null;e&&(n=this.getRowIndex(e)),this.hot.runHooks("beforeCreateRow",n+this.countChildren(e)+1,1);let o=e;e||(o=this.mockParent()),o.__children||(o.__children=[]),r||(r=this.mockNode()),o.__children.push(r),this.rewriteCache();let i=this.getRowIndex(r)??0;this.hot.rowIndexMapper.insertIndexes(i,1),this.hot.runHooks("afterCreateRow",i,1),this.hot.runHooks("afterAddChild",e,r)}addChildAtIndex(e,t,r){let n,o=r;if(o||(o=this.mockNode()),this.hot.runHooks("beforeAddChild",e,o,t),e){let r=this.getRowIndex(e)??0,i=r+t+1;this.hot.runHooks("beforeCreateRow",i,1),e.__children.splice(t,0,o),this.rewriteCache(),this.plugin.disableCoreAPIModifiers(),this.hot.setSourceDataAtCell(r,"__children",e.__children,"NestedRows.addChildAtIndex"),this.hot.rowIndexMapper.insertIndexes(i,1),this.plugin.enableCoreAPIModifiers(),this.hot.runHooks("afterCreateRow",i,1),n=i}else this.plugin.disableCoreAPIModifiers(),this.hot.alter("insert_row_above",t,1,"NestedRows.addChildAtIndex"),this.plugin.enableCoreAPIModifiers(),n=this.getRowIndex(this.data[t])??0;o=this.getDataObject(n)??null,this.hot.runHooks("afterAddChild",e,o,t)}addSibling(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"below",r=this.translateTrimmedRow(e),n=this.getRowParent(r),o=this.getRowIndexWithinParent(r);switch(t){case"below":this.addChildAtIndex(n,o+1,null);break;case"above":this.addChildAtIndex(n,o,null)}}detachFromParent(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],r=null,n=[];if(Array.isArray(e)?(oA(e[0],e[2],e=>{let t=this.translateTrimmedRow(e);n.push(this.getDataObject(t))}),oA(0,n.length-2,e=>{let t=n[e];null!=t&&this.detachFromParent(t,!1)}),r=n[n.length-1]??null):r=e,!r)return;let o=this.getRowIndex(r)??0,i=this.countChildren(r),s=this.getRowIndexWithinParent(r),a=this.getRowParent(r),l=this.getRowParent(a),h=this.getRowIndex(l)??0,d=null;if(this.hot.runHooks("beforeDetachChild",a,r),null!=s){let e=Array.from(Array(o+i+1).keys()).splice(-1*(i+1));if(this.hot.runHooks("beforeRemoveRow",o,i+1,e,this.plugin.pluginName),a.__children.splice(s,1),this.rewriteCache(),this.hot.runHooks("afterRemoveRow",o,i+1,e,this.plugin.pluginName),l){d=h+this.countChildren(l);let e=this.getChild(l,this.countChildren(l)-1),t=this.getRowIndex(e)??0;this.hot.runHooks("beforeCreateRow",t+1,i+1,this.plugin.pluginName),l.__children.push(r)}else d=this.hot.countRows()+1,this.hot.runHooks("beforeCreateRow",d-2,i+1,this.plugin.pluginName),this.data.push(r)}this.rewriteCache(),this.hot.runHooks("afterCreateRow",d-2,i+1,this.plugin.pluginName),this.hot.runHooks("afterDetachChild",a,r,this.getRowIndex(r)),t&&this.hot.render()}filterData(e,t,r){let n=[];J(r,e=>{let t=this.getDataObject(e);null!=t&&n.push(t)}),J(n,e=>{let t=this.getRowIndexWithinParent(e),r=this.getRowParent(e);null===r?this.data.splice(t,1):r.__children.splice(t,1)}),this.rewriteCache()}spliceData(e,t,r){let n=this.getDataObject(e-1),o=null,i=e;n&&n.__children&&0===n.__children.length?(o=n,i=0):e<this.countAllRows()&&(o=this.getRowParent(e),i=this.getRowIndexWithinParent(e)),o?r?o.__children.splice(i,t,...r):o.__children.splice(i,t):r?this.data.splice(i,t,...r):this.data.splice(i,t),this.rewriteCache()}syncRowWithRawSource(e){let t=e,r=t;do null!==(r=this.getRowParent(r))&&(t=r);while(null!==r);this.plugin.disableCoreAPIModifiers(),this.hot.setSourceDataAtCell(this.getRowIndexWithinParent(t),"__children",t.__children,"NestedRows.syncRowWithRawSource"),this.plugin.enableCoreAPIModifiers()}moveRow(e,t,r,n){let o=t===this.hot.countRows(),i=this.getRowParent(e),s=this.getRowIndexWithinParent(e),a=i.__children.slice(s,s+1),l=e>t,h=o?this.getRowParent(t-1):this.getRowParent(t);null==h&&(h=this.getRowParent(t-1)),null==h&&(h=this.getDataObject(t-1)),h?h.__children||(h.__children=[]):(h=this.getDataObject(t)).__children=[];let d=o||r||n?h.__children.length:this.getRowIndexWithinParent(t),u=i===h;h.__children.splice(d,0,a[0]),i.__children.splice(s+(l&&u?1:0),1),this.syncRowWithRawSource(i),u||this.syncRowWithRawSource(h)}translateTrimmedRow(e){return this.plugin.collapsingUI?this.plugin.collapsingUI.translateTrimmedRow(e):e}untranslateTrimmedRow(e){return this.plugin.collapsingUI?this.plugin.collapsingUI.untranslateTrimmedRow(e):e}}let yq=class{constructor(e,t){this.hot=t,this.plugin=e}};class yK extends yq{static get CSS_CLASSES(){return{indicatorContainer:"ht_nestingLevels",parent:"ht_nestingParent",indicator:"ht_nestingLevel",emptyIndicator:"ht_nestingLevel_empty",button:"ht_nestingButton",expandButton:"ht_nestingExpand",collapseButton:"ht_nestingCollapse"}}constructor(e,t){super(e,t),this.dataManager=this.plugin.dataManager,this.collapsingUI=this.plugin.collapsingUI,this.rowHeaderWidthCache=null}appendLevelIndicators(e,t){let r=this.hot.toPhysicalRow(e),n=this.dataManager.getDataObject(r);if(!n)return;let o=this.dataManager.getRowLevel(r),i=t.getElementsByTagName("DIV")[0],s=i.querySelector("span.rowHeader"),a=i.querySelectorAll('[class^="ht_nesting"]'),l=this.hot.getSettings().ariaTags;if(J(a,e=>{e&&i.removeChild(e)}),rd(t,yK.CSS_CLASSES.indicatorContainer),o){let{rootDocument:e}=this.hot,t=s.cloneNode(!0);i.innerHTML="",oA(0,o-1,()=>{let t=e.createElement("SPAN");rd(t,yK.CSS_CLASSES.emptyIndicator),i.appendChild(t)}),i.appendChild(t)}if(this.dataManager.hasChildren(n)){let e=this.hot.rootDocument.createElement("DIV");l&&rc(e,[_()]),rd(t,yK.CSS_CLASSES.parent),this.collapsingUI.areChildrenCollapsed(r)?(rd(e,`${yK.CSS_CLASSES.button} ${yK.CSS_CLASSES.expandButton}`),l&&rc(t,[U(!1)])):(rd(e,`${yK.CSS_CLASSES.button} ${yK.CSS_CLASSES.collapseButton}`),l&&rc(t,[U(!0)])),i.appendChild(e)}}updateRowHeaderWidth(e){let t=e;t||(t=this.dataManager.cache.levelCount);let r=11;r=2*this.hot.stylesHandler.getCSSVariableValue("cell-horizontal-padding"),this.rowHeaderWidthCache=Math.max(50,r+10*t+25),this.hot.render()}}let yX=new Map([["collapse",{beforeHook:"beforeRowCollapse",afterHook:"afterRowCollapse"}],["expand",{beforeHook:"beforeRowExpand",afterHook:"afterRowExpand"}]]),yQ=class extends yq{collapsedRowsStash;constructor(e,t){var r;super(e,t),r=this,this.dataManager=this.plugin.dataManager,this.collapsedRows=[],this.collapsedRowsStash={stash:function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];r.lastCollapsedRows=r.collapsedRows.slice(0),r.expandMultipleChildren(r.lastCollapsedRows??[],e)},shiftStash:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=null==t?1/0:t;J(r.lastCollapsedRows??[],(t,i)=>{t>=e&&t<o&&(r.lastCollapsedRows[i]=t+n)})},applyStash:function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];r.collapseMultipleChildren(r.lastCollapsedRows??[],e),r.lastCollapsedRows=void 0},trimStash:(e,t)=>{oA(e,e+t-1,e=>{let t=this.lastCollapsedRows.indexOf(e);t>-1&&this.lastCollapsedRows.splice(t,1)})}}}collapseChildren(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],n=[],o=null,i=null,s=null;isNaN(e)?(o=e,i=this.dataManager.getRowIndex(o)):(o=this.dataManager.getDataObject(e),i=e);let a=!!o&&this.dataManager.hasChildren(o);return a&&J(o.__children,e=>{let t=this.dataManager.getRowIndex(e);null!==t&&n.push(t)}),s=this.collapseRows(n,!0,!1),r&&this.trimRows(s),t&&this.renderAndAdjust(),a&&null!==i&&-1===this.collapsedRows.indexOf(i)&&this.collapsedRows.push(i),s}collapseMultipleChildren(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],n=[];J(e,e=>{n.push(...this.collapseChildren(e,!1,!1))}),r&&this.trimRows(n),t&&this.renderAndAdjust()}collapseRow(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];this.collapseRows([e],t)}collapseRows(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=[];return J(e,e=>{n.push(e),t&&this.collapseChildRows(e,n)}),r&&this.trimRows(n),n}collapseChildRows(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=(arguments.length>2&&arguments[2],arguments.length>3&&void 0!==arguments[3]&&arguments[3]);this.dataManager.hasChildren(e)&&J(this.dataManager.getDataObject(e).__children??[],e=>{let r=this.dataManager.getRowIndex(e);null!==r&&(t.push(r),this.collapseChildRows(r,t))}),r&&this.trimRows(t)}expandRow(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];this.expandRows([e],t)}expandRows(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=[];return J(e,e=>{n.push(e),t&&this.expandChildRows(e,n)}),r&&this.untrimRows(n),n}expandChildRows(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=(arguments.length>2&&arguments[2],arguments.length>3&&void 0!==arguments[3]&&arguments[3]);this.dataManager.hasChildren(e)&&J(this.dataManager.getDataObject(e).__children??[],e=>{if(!this.isAnyParentCollapsed(e)){let r=this.dataManager.getRowIndex(e);null!==r&&(t.push(r),this.expandChildRows(r,t))}}),r&&this.untrimRows(t)}expandChildren(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],n=[],o=null,i=null,s=null;isNaN(e)?(o=e,i=this.dataManager.getRowIndex(e)):(o=this.dataManager.getDataObject(e),i=e);let a=null===i?-1:this.collapsedRows.indexOf(i);return a>-1&&this.collapsedRows.splice(a,1),o&&this.dataManager.hasChildren(o)&&J(o.__children,e=>{let t=this.dataManager.getRowIndex(e);null!==t&&n.push(t)}),s=this.expandRows(n,!0,!1),r&&this.untrimRows(s),t&&this.renderAndAdjust(),s}expandMultipleChildren(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],n=[];J(e,e=>{n.push(...this.expandChildren(e,!1,!1))}),r&&this.untrimRows(n),t&&this.renderAndAdjust()}getCollapsedParents(){return this.collapsedRows.slice().sort((e,t)=>e-t)}toggleCollapsedRows(e,t){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2];return this.applyCollapsedRowsChange(e,t,r).performed}applyCollapsedRowsChange(e,t){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],n=yX.get(t);if(n||tr(`Unsupported action is passed (${t}).`),!Array.isArray(e))return{performed:!1,vetoed:!1};let o="collapse"===t,i=this.getCollapsedParents(),s=e.length>0&&e.every(e=>this.#cj(e)),a=this.#cq(i,e,o);if(r&&!1===this.hot.runHooks(n.beforeHook,i,a,s))return{performed:!1,vetoed:!0};s&&(o?this.collapseMultipleChildren(e,!1,!0):this.expandMultipleChildren(e,!1,!0));let l=!this.#cK(i);return l&&this.renderAndAdjust(),r&&this.hot.runHooks(n.afterHook,i,a,s,l),{performed:l,vetoed:!1}}#cq(e,t,r){let n=t.filter(e=>this.#cj(e));if(r){let t=e.slice();return n.forEach(e=>{-1===t.indexOf(e)&&t.push(e)}),t.sort((e,t)=>e-t)}return e.filter(e=>-1===n.indexOf(e))}#cj(e){if(!Number.isInteger(e)||e<0)return!1;let t=this.dataManager.getDataObject(e);return!!t&&this.dataManager.hasChildren(t)}#cK(e){let t=this.getCollapsedParents();return t.length===e.length&&t.every((t,r)=>t===e[r])}collapseAll(){this.toggleCollapsedRows(this.#cX(),"collapse")}expandAll(){this.toggleCollapsedRows(this.#cX(),"expand")}#cX(){let e=this.dataManager.getData()??[],t=[];return J(e,e=>{if(this.dataManager.hasChildren(e)){let r=this.dataManager.getRowIndex(e);null!==r&&t.push(r)}}),t}getCollapsedParentsShallowestFirst(){return this.getCollapsedParents().map(e=>({row:e,level:this.dataManager.getRowLevel(e)??0})).sort((e,t)=>e.level-t.level).map(e=>{let{row:t}=e;return t})}trimRows(e){this.hot.batchExecution(()=>{J(e,e=>{this.plugin.collapsedRowsMap.setValueAtIndex(e,!0)})},!0)}untrimRows(e){this.hot.batchExecution(()=>{J(e,e=>{this.plugin.collapsedRowsMap.setValueAtIndex(e,!1)})},!0)}areChildrenCollapsed(e){let t=isNaN(e)?e:this.dataManager.getDataObject(e),r=!0;return null==t&&(t={__children:this.dataManager.data}),t&&this.dataManager.hasChildren(t)&&J(t.__children,e=>{let t=this.dataManager.getRowIndex(e);if(null===t||!this.plugin.collapsedRowsMap.getValueAtIndex(t))return r=!1,!1}),r}isAnyParentCollapsed(e){let t=e;for(;null!==t;){t=this.dataManager.getRowParent(t);let e=this.dataManager.getRowIndex(t);if(null!==e&&this.collapsedRows.indexOf(e)>-1)return!0}return!1}toggleState(e,t,r){if(t.col>=0)return;let n=this.translateTrimmedRow(t.row);rh(t4(e),yK.CSS_CLASSES.button)&&(this.toggleCollapsedRows([n],this.areChildrenCollapsed(n)?"expand":"collapse"),nR(e))}translateTrimmedRow(e){return this.hot.toPhysicalRow(e)}untranslateTrimmedRow(e){return this.hot.toVisualRow(e)}renderAndAdjust(){this.hot.view.adjustElementsSize(),this.hot.render()}};class yZ extends yq{dataManager=this.plugin.dataManager;#cQ={row_above:(e,t)=>{let r=t[t.length-1];this.dataManager.addSibling(r.start.row,"above")},row_below:(e,t)=>{let r=t[t.length-1];this.dataManager.addSibling(r.start.row,"below")}};appendOptions(e){let t=[{key:"add_child",name(){return String(this.getTranslatedPhrase(lR))},callback:()=>{let e=this.hot.getSelectedActive(),t=this.dataManager.translateTrimmedRow(e?.[0]??0),r=this.dataManager.getDataObject(t);this.dataManager.addChild(r)},disabled:()=>{let e=this.hot.getSelectedActive();return!e||(e[0]??0)<0||this.hot.selection.isSelectedByColumnHeader()||this.hot.countRows()>=(this.hot.getSettings().maxRows??1/0)}},{key:"detach_from_parent",name(){return String(this.getTranslatedPhrase(lE))},callback:()=>{this.dataManager.detachFromParent(this.hot.getSelectedActive()??[])},disabled:()=>{let e=this.hot.getSelectedActive(),t=this.dataManager.translateTrimmedRow(e?.[0]??0);return!this.dataManager.getRowParent(t)||!e||(e[0]??0)<0||this.hot.selection.isSelectedByColumnHeader()||this.hot.countRows()>=(this.hot.getSettings().maxRows??1/0)}},{name:"---------"}];return oA(0,e.items.length-1,r=>{if(0===r)return J(t,(t,n)=>{e.items.splice(r+n,0,t)}),!1}),this.modifyRowInsertingOptions(e)}modifyRowInsertingOptions(e){return oA(0,e.items.length-1,t=>{let r=this.#cQ[e.items[t].key];null!=r&&(e.items[t].callback=r)}),e}}class yJ{movedToCollapsed=!1;constructor(e){this.plugin=e,this.hot=e.hot,this.dataManager=e.dataManager,this.collapsingUI=e.collapsingUI}onBeforeRowMove(e,t,r,n){if(this.displayAPICompatibilityWarning({rows:e,finalIndex:t,dropIndex:r,movePossible:n}))return!1;this.movedToCollapsed=!1;let o=r===this.hot.countRows(),i=o?this.hot.countSourceRows():this.dataManager.translateTrimmedRow(r??0),s=!0,a=e.map(e=>{if(!s)return -1;let t=this.dataManager.translateTrimmedRow(e);return s=this.shouldAllowMoving(t,i),t}),l=-1===a.indexOf(i);if(!s)return!1;if(!l)return;let h=this.getBaseParent(a),d=this.getTargetParent(o,i),u=h===d;return this.movedToCollapsed=this.collapsingUI.areChildrenCollapsed(d),this.collapsingUI.collapsedRowsStash.stash(),this.shiftCollapsibleParentsLocations(a,i,u),this.moveRows(a,i,d),this.dataManager.rewriteCache(),this.moveCellsMeta(a,i),this.collapsingUI.collapsedRowsStash.applyStash(!1),this.hot.runHooks("afterRowMove",e,t,r,n,n&&this.isRowOrderChanged(e,t)),this.hot.render(),this.selectCells(e,r),!1}displayAPICompatibilityWarning(e){let{rows:t,finalIndex:r,dropIndex:n,movePossible:o}=e,i=!1;return eL(n)&&(tQ(ec`Since version 8.0.0 of the Handsontable the 'moveRows' method isn't used for moving rows\x20
      when the NestedRows plugin is enabled. Please use the 'dragRows' method instead.`),this.hot.runHooks("afterRowMove",t,r,n,o,!1),i=!0),i}shouldAllowMoving(e,t){return!(this.dataManager.isParent(e)||this.dataManager.isRowHighestLevel(e)||e===t||0===t)}getBaseParent(e){return this.dataManager.getRowParent(e[0])}getTargetParent(e,t){let r=this.dataManager.getRowParent(e?t-1:t);return null==r&&(r=this.dataManager.getRowParent(t-1)),r}shiftCollapsibleParentsLocations(e,t,r){r||(Math.max(...e)<=t?this.collapsingUI.collapsedRowsStash.shiftStash(e[0],t,-1*e.length):this.collapsingUI.collapsedRowsStash.shiftStash(t,e[0],e.length))}moveRows(e,t,r){let n=t===this.dataManager.getRowIndex(r)+this.dataManager.countChildren(r)+1;this.hot.batchRender(()=>{e.forEach(e=>{this.dataManager.moveRow(e,t,this.movedToCollapsed,n)})})}moveCellsMeta(e,t){let r=[],n=Math.max(...e)<t;e.forEach(e=>{r.push(this.hot.getCellMetaAtRow(e))}),this.hot.spliceCellsMeta(e[0],e.length),this.hot.spliceCellsMeta(t-(n?r.length:0),0,...r)}selectCells(e,t){let r=e.length,n=0,o=0;if(this.movedToCollapsed){let i=null,s=t??0;i=(e[r-1]??0)<s?this.dataManager.translateTrimmedRow(s-r):this.dataManager.translateTrimmedRow(s);let a=this.dataManager.getRowParent(null===i?this.hot.countSourceRows()-1:i-1),l=this.dataManager.getRowIndex(a)??0;o=n=this.dataManager.untranslateTrimmedRow(l)}else(e[r-1]??0)<(t??0)?n=(o=(t??0)-1)-r+1:o=(n=t??0)+r-1;this.hot.selectCells([[n,0,o,this.hot.countCols()-1]],!1)}isRowOrderChanged(e,t){return e.some((e,r)=>e-r!==t)}}let y0="nestedRows",y1=`
<div data-ref="container" class="ht-pagination handsontable">
  <div class="ht-pagination__inner">
    <div data-ref="pageSizeSection" class="ht-page-size-section">
      <span data-ref="pageSizeLabel" class="ht-page-size-section__label"></span>
      <div class="ht-page-size-section__select-wrapper">
        <select data-ref="pageSizeSelect" name="pageSize" data-hot-input></select>
      </div>
    </div>
    <div data-ref="pageCounterSection" class="ht-page-counter-section"></div>
    <nav data-ref="pageNavSection" class="ht-page-navigation-section">
      <button data-ref="first" class="ht-page-navigation-section__button ht-page-first"></button>
      <button data-ref="prev" class="ht-page-navigation-section__button ht-page-prev"></button>
      <span data-ref="pageNavLabel" class="ht-page-navigation-section__label"></span>
      <button data-ref="next" class="ht-page-navigation-section__button ht-page-next"></button>
      <button data-ref="last" class="ht-page-navigation-section__button ht-page-last"></button>
    </nav>
  </div>
</div>
`;class y2{#nr;#cZ;#X=!1;#cJ=null;#nt;#c0;#c1;constructor({rootElement:e,uiContainer:t,isRtl:r,themeName:n,phraseTranslator:o,a11yAnnouncer:i}){this.#nr=e,this.#cZ=t,this.#X=r,this.#nt=n,this.#c0=o,this.#c1=i,this.install()}install(){if(this.#cJ?.container)return;let e=eg`${y1}`,{container:t,first:r,prev:n,next:o,last:i,pageSizeSelect:s}=e.refs;this.#cJ=e.refs,t.setAttribute("dir",this.#X?"rtl":"ltr"),t.tabIndex=-1;let a=(e,t,r)=>{t.addEventListener(e,e=>{e.currentTarget.disabled||r()})};a("click",r,()=>this.runLocalHooks("firstPageClick")),a("click",n,()=>this.runLocalHooks("prevPageClick")),a("click",o,()=>this.runLocalHooks("nextPageClick")),a("click",i,()=>this.runLocalHooks("lastPageClick")),s.addEventListener("change",()=>{let e="auto"===s.value?"auto":Number.parseInt(s.value,10);this.runLocalHooks("pageSizeChange",e)}),this.setCounterSectionVisibility(!1),this.setNavigationSectionVisibility(!1),this.setPageSizeSectionVisibility(!1),this.#cZ&&(this.#cZ.appendChild(e.fragment),rd(t,[this.#nt??"","handsontable"]))}getContainer(){return this.#cJ.container}getFocusableElements(){let{first:e,prev:t,next:r,last:n,pageSizeSelect:o}=this.#cJ;return[o,e,t,r,n].filter(e=>!e.disabled)}updateTheme(e){if(this.#nt=e,this.#cZ){let{container:e}=this.#cJ;ru(e,/ht-theme-.*/g),this.#nt&&rd(e,this.#nt)}return this}getHeight(){return this.#cJ.container.offsetHeight}updateState(e){let{currentPage:t,totalPages:r,firstVisibleRowIndex:n,lastVisibleRowIndex:o,totalRenderedRows:i,pageSizeList:s,pageSize:a,autoPageSize:l,counterStartRow:h,counterEndRow:d}=e,{first:u,prev:c,next:g,last:p,pageCounterSection:m,pageNavSection:f,pageNavLabel:b,pageSizeSelect:C,pageSizeLabel:y}=this.#cJ,w=this.#c0(hs,{start:h??n+1,end:d??o+1,total:i}),S=this.#c0(ha,{currentPage:t,totalPages:r}),v=this.#c0(hi);m.textContent=w,b.textContent=S,C.textContent="",y.textContent=`${v}:`,rc(f,[H(this.#c0(hn))]),rc(C,[H(this.#c0(hi))]),this.#c1(S),s.forEach(e=>{let t=new Option(String(("auto"===e?this.#c0(ho):e)??""),String(e??""));(l&&"auto"===e||!l&&e===a)&&(t.selected=!0),C.add(t)});let R=1===t,E=t===r;if("none"!==f.style.display){let e=this.#nr.ownerDocument.activeElement;R?(rd(u,"ht-page-navigation-section__button--disabled"),rd(c,"ht-page-navigation-section__button--disabled"),u.disabled=!0,c.disabled=!0):(ru(u,"ht-page-navigation-section__button--disabled"),ru(c,"ht-page-navigation-section__button--disabled"),u.disabled=!1,c.disabled=!1),E?(rd(g,"ht-page-navigation-section__button--disabled"),rd(p,"ht-page-navigation-section__button--disabled"),g.disabled=!0,p.disabled=!0):(ru(g,"ht-page-navigation-section__button--disabled"),ru(p,"ht-page-navigation-section__button--disabled"),g.disabled=!1,p.disabled=!1),[u,c,g,p].includes(e)&&(c.disabled?g.focus():g.disabled&&c.focus())}return rc(u,[H(this.#c0(hl)),L(R)]),rc(c,[H(this.#c0(hh)),L(R)]),rc(g,[H(this.#c0(hd)),L(E)]),rc(p,[H(this.#c0(hu)),L(E)]),this}setPageSizeSectionVisibility(e){let{pageSizeSection:t,pageSizeSelect:r}=this.#cJ;return t.style.display=e?"":"none",r.disabled=!e,this.#c2(),this}setCounterSectionVisibility(e){return this.#cJ.pageCounterSection.style.display=e?"":"none",this.#c2(),this}setNavigationSectionVisibility(e){let{pageNavSection:t,first:r,prev:n,next:o,last:i}=this.#cJ;return t.style.display=e?"":"none",r.disabled=!e,n.disabled=!e,o.disabled=!e,i.disabled=!e,this.#c2(),this}#c2(){let{container:e,pageSizeSection:t,pageCounterSection:r,pageNavSection:n}=this.#cJ,o="none"!==t.style.display||"none"!==r.style.display||"none"!==n.style.display;this.#cZ||(o?rd(this.#nr.querySelector(".ht-wrapper"),"htPagination"):ru(this.#nr.querySelector(".ht-wrapper"),"htPagination")),e.style.display=o?"":"none"}destroy(){this.#cJ?.container.remove(),this.#cJ=null}}th(y2,ab);let y3=new Map([["fixed",class{pageSize=1;totalItems=0;totalPages=0;calculate(e){let{pageSize:t,totalItems:r}=e;this.pageSize=Math.max(t,1),this.totalItems=r,this.totalPages=Math.max(1,Math.ceil(this.totalItems/this.pageSize))}getTotalPages(){return this.totalPages}getState(e){if((e-=1)<0||e>=this.getTotalPages())return;let t=e*this.pageSize,r=Math.max(0,Math.min(t+this.pageSize-1,this.totalItems-1));return{startIndex:t,endIndex:r,pageSize:this.pageSize}}}],["auto",class{pages=[];calculate(e){let{itemsSizeProvider:t,viewportSizeProvider:r}=e,n=t(),o=r(),i=[],s=0,a=0,l=0;for(let e=0;e<n.length;e++){let t=n[e];l>0&&a+t>=o&&(i.push({startIndex:s,endIndex:e-1,pageSize:l}),s=e,a=0,l=0),a+=t,l+=1}i.push({startIndex:s,endIndex:Math.max(0,n.length-1),pageSize:l}),this.pages=i}getTotalPages(){return this.pages.length}getState(e){if(!((e-=1)<0||e>=this.getTotalPages()))return this.pages[e]}}]]);function y6(e){return y3.has(e)||tr(`Unknown pagination strategy type: ${e}`),new(y3.get(e))}pr("pagination",["nestedRows","mergeCells","fixedRowsTop","fixedRowsBottom"]);let y5="pagination",y4=`plugin:${y5}`,y9=ec`The \`auto\` page size setting requires the \`autoRowSize\`\x20
  plugin to be enabled. Set the \`autoRowSize: true\` in the configuration to ensure correct behavior.`,y7="search",y8=function(e,t,r,n,o){let i=e.getCellMeta(t,r);i.isSearchResult=o;let s=i._persistedMetaProps;o?(void 0===s&&(i._persistedMetaProps=s=new Set),s.add("isSearchResult")):s?.delete("isSearchResult")},we=function(e,t,r){if(eL(e)||null===e||!e.toLocaleLowerCase||0===e.length||eL(t)||null===t)return!1;let n=r.locale;return -1!==ow(String(t),n).indexOf(ow(e,n))};function wt(e){let{edge:t,target:r,oppositeIndex:n}=e,o=Math.max(0,r);return"top"===t||"start"===t?Math.min(o,n):Math.max(o,n)}let wr="selectionHandles";class wn{viewportWidth=0;overwriteColumnWidthFn;baseWidths=new Map;stretchedWidths=new Map;constructor(e){this.overwriteColumnWidthFn=e}prepare(e){let{viewportWidth:t}=e;this.viewportWidth=t,this.baseWidths.clear(),this.stretchedWidths.clear()}setColumnBaseWidth(e,t){this.baseWidths.set(e,t)}calculate(){}getWidths(){return Array.from(this.stretchedWidths)}}class wo extends wn{calculate(){let e=Array.from(this.baseWidths).reduce((e,t)=>{let[,r]=t;return e+r},0);if(this.viewportWidth-e<0)return void this.stretchedWidths.clear();let t=this.viewportWidth/e,r=[],n=[],o=this.viewportWidth,i=0;if(this.baseWidths.forEach((e,s)=>{let a=Math.round(e*t),l=this.overwriteColumnWidthFn(a,s);a===l&&a>=50?(r.push([s,l]),i+=l):a!==l&&(r.push([s,l]),n.push(s),o-=l)}),o<=50)return void this.stretchedWidths.clear();let s=o/i,a=-1,l=0;r.forEach((e,t)=>{let[o,i]=e,h=i;n.includes(o)||(h=Math.round(i*s)),this.stretchedWidths.set(o,h),a=o,t<r.length-1&&(l+=h)}),this.stretchedWidths.size>1&&this.stretchedWidths.set(a,Math.round(this.viewportWidth-l))}}class wi extends wn{#c3=0;#c6=-1;prepare(e){super.prepare(e),this.#c3=0,this.#c6=-1}setColumnBaseWidth(e,t){super.setColumnBaseWidth(e,t),this.#c6=e,this.#c3=t}calculate(){if(-1===this.#c6)return;let e=Array.from(this.baseWidths).reduce((e,t)=>{let[,r]=t;return e+r},0),t=this.viewportWidth-e+this.#c3;t<this.#c3?this.stretchedWidths.clear():this.stretchedWidths.set(this.#c6,t)}}class ws{#rX;#c5;#c4=new Map([["all",new wo(this.#c9.bind(this))],["last",new wi(this.#c9.bind(this))]]);#c7="none";constructor(e){this.#rX=e,this.#c5=this.#rX.columnIndexMapper.createAndRegisterIndexMap("stretchColumns","physicalIndexToValue")}useStrategy(e){this.#c7="string"==typeof e&&this.#c4.has(e)?e:"none"}refreshStretching(){"none"===this.#c7?this.#c5.clear():this.#rX.batchExecution(()=>{this.#c5.clear();let e=this.#c4.get(this.#c7);if(!e)return;let t=this.#rX.view.getViewportWidth();this.#c8()&&(t-=rX(this.#rX.rootDocument)),e.prepare({viewportWidth:t});for(let t=0;t<this.#rX.countCols();t++)this.#rX.columnIndexMapper.isHidden(this.#rX.toPhysicalColumn(t))||e.setColumnBaseWidth(t,this.#ge(t));e.calculate(),e.getWidths().forEach(e=>{let[t,r]=e;this.#c5.setValueAtIndex(this.#rX.toPhysicalColumn(t),r)})},!0)}getStretchedWidth(e){return this.#c5.getValueAtIndex(this.#rX.toPhysicalColumn(e))}#c8(){let{view:e,stylesHandler:t}=this.#rX;if(e.isVerticallyScrollableByWindow())return!1;let r=e.getViewportHeight(),n=this.#rX.countRows(),o=t.getDefaultRowHeight(),i=0,s=!1;for(let e=0;e<n;e++)if(!this.#rX.rowIndexMapper.isHidden(this.#rX.toPhysicalRow(e))&&(i+=this.#rX.getRowHeight(e)??o)>r){s=!0;break}return s}#ge(e){return this.#rX.getColWidth(e,"StretchColumns")??50}#c9(e,t){return this.#rX.runHooks("beforeStretchingColumnWidth",e,t)}}class wa extends pa{static get PLUGIN_KEY(){return"stretchColumns"}static get PLUGIN_PRIORITY(){return 155}static get SETTING_KEYS(){return!0}#gt=new ws(this.hot);#gr=null;#eg=new ResizeObserver(e=>{requestAnimationFrame(()=>{this.hot?.view?.isHorizontallyScrollableByWindow()&&e.forEach(e=>{let{contentRect:t}=e;null!==this.#gr&&this.#gr!==t.width&&(this.hot?.view?.adjustElementsSize(),this.hot?.refreshDimensions()),this.#gr=t.width})})});isEnabled(){return["all","last"].includes(this.hot.getSettings().stretchH??"")}enablePlugin(){this.enabled||(this.#gt.useStrategy(this.hot.getSettings().stretchH),this.#eg.observe(this.hot.rootElement),this.addHook("beforeRender",this.#oU),this.addHook("modifyColWidth",this.#dP,10),super.enablePlugin())}updatePlugin(){this.#gt.useStrategy(this.hot.getSettings().stretchH),super.updatePlugin()}disablePlugin(){super.disablePlugin(),this.#eg.unobserve(this.hot.rootElement)}getColumnWidth(e){return this.#gt.getStretchedWidth(e)}#dP=(e,t,r)=>{if(r===this.pluginName)return;let n=this.getColumnWidth(t);return"number"==typeof n?n:e};#oU=e=>{e&&this.#gt.refreshStretching()};destroy(){this.#eg.disconnect(),this.#eg=null,this.#gt=null,super.destroy()}}let wl="trimRows";class wh{actionType="";constructor(e){this.actionType=e}undo(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];tr("Not implemented")}redo(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];tr("Not implemented")}}class wd extends wh{stateBefore;range;type;alignment;constructor({stateBefore:e,range:t,type:r,alignment:n}){super("cell_alignment"),this.stateBefore=e,this.range=t,this.type=r,this.alignment=n}static startRegisteringEvents(e,t){e.addHook("beforeCellAlignment",(e,r,n,o)=>{t.done(()=>new wd({stateBefore:e,range:r,type:n,alignment:o}))})}undo(e,t){J(this.range,t=>{t.forAll((t,r)=>(t>=0&&r>=0&&e.setCellMeta(t,r,"className",this.stateBefore[t][r]||" htLeft"),!0))}),e.addHookOnce("afterViewRender",t),e.render()}redo(e,t){ml(this.range,this.type,this.alignment,(t,r)=>e.getCellMetaTransient(t,r),(t,r,n,o)=>e.setCellMeta(t,r,n,o)),e.addHookOnce("afterViewRender",t),e.render()}}class wu extends wh{columns;finalColumnIndex;constructor({columns:e,finalIndex:t}){super("col_move"),this.columns=e.slice(),this.finalColumnIndex=t}static startRegisteringEvents(e,t){e.addHook("beforeColumnMove",(e,r)=>{!1!==e&&t.done(()=>new wu({columns:e,finalIndex:r}))})}undo(e,t){let r=e.getPlugin("manualColumnMove");e.addHookOnce("afterViewRender",t),CA(this.columns,this.finalColumnIndex,e.columnIndexMapper.getNumberOfIndexes()).reverse().forEach(e=>{let{from:t,to:n}=e;t<n&&(n-=1),r.moveColumn(n,t)}),e.render(),e.deselectCell(),e.selectColumns(this.columns[0],this.columns[0]+this.columns.length-1)}redo(e,t){let r=e.getPlugin("manualColumnMove");e.addHookOnce("afterViewRender",t),r.moveColumns(this.columns.slice(),this.finalColumnIndex),e.render(),e.deselectCell(),e.selectColumns(this.finalColumnIndex,this.finalColumnIndex+this.columns.length-1)}}class wc extends wh{previousSortState;nextSortState;constructor({currentSortState:e,newSortState:t}){super("col_sort"),this.previousSortState=e,this.nextSortState=t}static startRegisteringEvents(e,t){e.addHook("beforeColumnSort",(e,r,n)=>{n&&t.done(()=>new wc({currentSortState:e,newSortState:r}))})}undo(e,t){let r=e.getPlugin("columnSorting"),n=e.getPlugin("multiColumnSorting"),o=n.isEnabled()?n:r;this.previousSortState.length?o.sort(this.previousSortState):o.clearSort(),t()}redo(e,t){let r=e.getPlugin("columnSorting"),n=e.getPlugin("multiColumnSorting");(n.isEnabled()?n:r).sort(this.nextSortState),t()}}let wg=[{readKey:"fixedRowsTop",writeKey:"fixedRowsTop"},{readKey:"fixedRowsBottom",writeKey:"fixedRowsBottom"}],wp=[{readKey:"fixedColumnsStart",writeKey:"_fixedColumnsStart"}];function wm(e,t,r){let n=e.getSettings(),o=t.map(e=>{let{readKey:t}=e;return n[t]??0}),i=()=>{let e=!1;return t.forEach((t,r)=>{let{readKey:i,writeKey:s}=t;(n[i]??0)<o[r]&&(n[s]=o[r],e=!0)}),e},s=()=>{i()};e.addHookOnce("beforeRender",s),r(),e.removeHook("beforeRender",s),i()&&e.render()}class wf extends wh{index;amount;constructor({index:e,amount:t}){super("insert_col"),this.index=e,this.amount=t}static startRegisteringEvents(e,t){e.addHook("afterCreateCol",(e,r,n)=>{t.done(()=>new wf({index:e,amount:r}),n)})}undo(e,t){e.addHookOnce("afterRemoveCol",t),wm(e,wp,()=>{e.alter("remove_col",this.index,this.amount,"UndoRedo.undo")})}redo(e,t){e.addHookOnce("afterCreateCol",t),e.alter("insert_col_start",this.index,this.amount,"UndoRedo.redo")}}class wb extends wh{index;amount;constructor({index:e,amount:t}){super("insert_row"),this.index=e,this.amount=t}static startRegisteringEvents(e,t){e.addHook("afterCreateRow",(e,r,n)=>{t.done(()=>new wb({index:e,amount:r}),n)})}undo(e,t){let r=e.countRows(),n=e.getSettings().minSpareRows;this.index>=r&&this.index-(n??0)<r&&(this.index-=n??0),e.addHookOnce("afterRemoveRow",t),wm(e,wg,()=>{e.alter("remove_row",this.index,this.amount,"UndoRedo.undo")})}redo(e,t){e.addHookOnce("afterCreateRow",t),e.alter("insert_row_above",this.index,this.amount,"UndoRedo.redo")}}class wC extends wh{constructor({changes:e,selected:t,countCols:r,countRows:n}){super("change"),this.changes=e,this.selected=t,this.countCols=r,this.countRows=n}static startRegisteringEvents(e,t){e.addHook("beforeChange",function(r,n){if(!(r&&r.length))return;let o=r.filter(e=>null!=e&&Array.isArray(e));if(0===o.length)return;o.find(e=>{let[,,t,r]=e;return t!==r});let i=o.length,s=()=>{let t=o.map(e=>[...e]);t.forEach(t=>{t[1]=e.propToCol(t[1])});let r=i>1?this.getSelected():[[t[0][0],t[0][1]]];return new wC({changes:t,selected:r,countCols:e.countCols(),countRows:e.countRows()})};t.done(s,n)},1e3)}undo(e,t){let r=ta(this.changes);for(let e=0,t=r.length;e<t;e++)r[e].splice(3,1);e.addHookOnce("afterChange",()=>{let r=e.countRows()-this.countRows;r>0&&e.alter("remove_row",void 0,r,"UndoRedo.undo");let n=e.countCols()-this.countCols;n>0&&e.isColumnModificationAllowed()&&e.alter("remove_col",void 0,n,"UndoRedo.undo"),e.scrollToFocusedCell(),e.selectCells(this.selected,!1,!1),t()}),e.setDataAtCell(r,null,null,"UndoRedo.undo")}redo(e,t){let r=ta(this.changes);for(let e=0,t=r.length;e<t;e++)r[e].splice(2,1);e.addHookOnce("afterChange",()=>{e.selectCells(this.selected,!1,!1),t()}),e.setDataAtCell(r,null,null,"UndoRedo.redo")}}class wy extends wh{conditionsStack;previousConditionsStack;constructor({conditionsStack:e,previousConditionsStack:t}){super("filter"),this.conditionsStack=e,this.previousConditionsStack=t}static startRegisteringEvents(e,t){e.addHook("beforeFilter",(e,r)=>{t.done(()=>new wy({conditionsStack:e,previousConditionsStack:r}))})}undo(e,t){let r=e.getPlugin("filters");e.addHookOnce("afterViewRender",t),r.importConditions(this.previousConditionsStack),r.filter()}redo(e,t){let r=e.getPlugin("filters");e.addHookOnce("afterViewRender",t),r.importConditions(this.conditionsStack),r.filter()}}class ww extends wh{cellRange;constructor({data:e,cellRange:t}){super("merge_cells"),this.cellRange=t,this.data=e}static startRegisteringEvents(e,t){e.addHook("beforeMergeCells",(r,n)=>{if(n)return;let o=r.getTopStartCorner(),i=r.getBottomEndCorner(),s=e.getData(o.row??void 0,o.col??void 0,i.row??void 0,i.col??void 0);t.done(()=>new ww({data:s,cellRange:r}))})}undo(e,t){let r=e.getPlugin("mergeCells");e.addHookOnce("afterViewRender",t),r.unmergeRange(this.cellRange,!0);let n=this.cellRange.getTopStartCorner();e.populateFromArray(n.row??0,n.col??0,this.data,void 0,void 0,"MergeCells")}redo(e,t){let r=e.getPlugin("mergeCells");e.addHookOnce("afterViewRender",t),r.mergeRange(this.cellRange)}}function wS(e,t,r,n,o){let i=[];for(let s=t;s<=n;s++){let t=e.toPhysicalRow(s),n=[];for(let i=r;i<=o;i++)n.push(e.getSourceDataAtCell(t,i));i.push(n)}return{fromRow:t,fromCol:r,toRow:n,toCol:o,data:i,meta:yp(e,t,r,n,o)}}function wv(e,t){let{fromRow:r,fromCol:n,toRow:o,toCol:i,data:s,meta:a}=t;e.populateFromArray(r,n,s,o,i,"UndoRedo.undo");let l=new Map(a.map(e=>[`${e.row}:${e.col}`,e.meta]));yp(e,r,n,o,i).forEach(t=>{let{row:r,col:n,meta:o}=t,i=l.get(`${r}:${n}`);for(let t of yg)ty(o,t)&&!(i&&ty(i,t))&&e.removeCellMeta(r,n,t)}),a.forEach(t=>{let{row:r,col:n,meta:o}=t;for(let t of yg)ty(o,t)&&e.setCellMeta(r,n,t,o[t])})}class wR extends wh{sourceSnapshot;targetSnapshot;isCopy;constructor({sourceSnapshot:e,targetSnapshot:t,isCopy:r}){super("move_cells"),this.sourceSnapshot=e,this.targetSnapshot=t,this.isCopy=r}static startRegisteringEvents(e,t){let r=null;e.addHook("beforeMoveCells",(t,n,o)=>{if(!i3(t))return r=null,!1;let i=t.getTopStartCorner(),s=t.getBottomEndCorner(),a=i.row,l=i.col,h=s.row,d=s.col,u=h-a+1,c=d-l+1,g=n.row+u-1,p=n.col+c-1;r={sourceSnapshot:wS(e,a,l,h,d),targetSnapshot:wS(e,n.row,n.col,g,p),isCopy:o}}),e.addHook("afterMoveCells",()=>{if(null===r)return;let e=r;r=null,t.done(()=>new wR(e))})}undo(e,t){e.batch(()=>{wv(e,this.targetSnapshot),this.isCopy||wv(e,this.sourceSnapshot)}),e.render(),e.deselectCell();let{fromRow:r,fromCol:n,toRow:o,toCol:i}=this.sourceSnapshot;e.selectCells([[r,n,o,i]],!1,!1),t()}redo(e,t){let{fromRow:r,fromCol:n,toRow:o,toCol:i}=this.sourceSnapshot,{fromRow:s,fromCol:a}=this.targetSnapshot,l=o-r+1,h=i-n+1,d=e._createCellRange(e._createCellCoords(r,n),e._createCellCoords(r,n),e._createCellCoords(o,i)),u=e._createCellCoords(s,a),c=()=>{e.render();let r=s+l-1,n=a+h-1;e.selectCells([[s,a,r,n]],!1,!1),t()},g=e.getPlugin("moveCells");g?(e.addHookOnce("afterMoveCells",c),g.moveCellRange(d,u,this.isCopy)||(e.removeHook("afterMoveCells",c),t({wasRedone:!1}))):t({wasRedone:!1})}}function wE(e,t,r,n,o){let i=[];return oA(n,o,n=>{oA(t,r,t=>{let r=e.getCellMeta(t,n);i.push([r.visualRow,r.visualCol,r])})}),i}function wT(e,t,r,n){let o=e.getPlugin("mergeCells");if(!o?.enabled)return[];let i="row"===t?"rowspan":"colspan",s=r+n-1,a=[];return o.mergedCellsCollection?.mergedCells.forEach(e=>{let n=e[t],o=n+e[i]-1;if(n<=s&&o>=r){let{row:t,col:r,rowspan:n,colspan:o}=e;a.push({row:t,col:r,rowspan:n,colspan:o})}}),a}function wA(e,t){if(!t||0===t.length)return;let r=e.getPlugin("mergeCells");r?.enabled&&t.forEach(t=>{let{row:n,col:o,rowspan:i,colspan:s}=t,a=n+i-1,l=o+s-1,h=e._createCellCoords(n,o),d=e._createCellCoords(a,l),u=e._createCellRange(h,h,d);r.unmergeRange(u,!0),r.merge(n,o,a,l)})}class wM extends wh{index;indexes;data;amount;headers;columnPositions;rowPositions;fixedColumnsStart;removedCellMetas;removedMergedCells;constructor({index:e,indexes:t,data:r,amount:n,headers:o,columnPositions:i,rowPositions:s,fixedColumnsStart:a,removedCellMetas:l,removedMergedCells:h}){super("remove_col"),this.index=e,this.indexes=t,this.data=r,this.amount=n,this.headers=o,this.columnPositions=i.slice(0),this.rowPositions=s.slice(0),this.fixedColumnsStart=a,this.removedCellMetas=l,this.removedMergedCells=h}static startRegisteringEvents(e,t){e.addHook("beforeRemoveCol",(r,n,o,i)=>{t.done(()=>{let t=e.getSourceDataArray(),o=(e.countCols()+r)%e.countCols(),i=o+n-1,s=[],a=[],l=[];if(oA(t.length-1,r=>{var n;let a;s.push((n=t[r],a=[],oA(o,i,t=>{a.push(n[e.toPhysicalColumn(t)])}),a))}),oA(n-1,t=>{l.push(e.toPhysicalColumn(o+t))}),Array.isArray(e.getSettings().colHeaders)){let t=e.getSettings().colHeaders;oA(n-1,r=>{a.push(t[e.toPhysicalColumn(o+r)]||null)})}return new wM({index:o,indexes:l,data:s,amount:n,headers:a,columnPositions:e.columnIndexMapper.getIndexesSequence(),rowPositions:e.rowIndexMapper.getIndexesSequence(),fixedColumnsStart:e.getSettings().fixedColumnsStart??0,removedCellMetas:wE(e,0,e.countRows(),o,i),removedMergedCells:wT(e,"col",o,n)})},i)})}undo(e,t){e.getSettings()._fixedColumnsStart=this.fixedColumnsStart;let r=this.indexes.slice(0).sort((e,t)=>e-t),n=(e,t,n)=>n[this.indexes.indexOf(r[t])],o=this.data.length,i=[];for(let e=0;e<o;e++)i.push(Z(this.data[e],n));let s=Z(this.headers,n),a=[];e.columnIndexMapper.setIndexesSequence(this.columnPositions),e.alter("insert_col_start",e.toVisualColumn(this.indexes[0]),this.indexes.length,"UndoRedo.undo"),e.batchExecution(()=>{e.rowIndexMapper.setIndexesSequence(this.rowPositions),e.columnIndexMapper.setIndexesSequence(this.columnPositions)},!0),J(e.getSourceDataArray(),(e,t)=>{J(r,(r,n)=>{e[r]=i[t][n],a.push([t,r,e[r]])})}),void 0!==this.headers&&J(s,(t,n)=>{e.getSettings().colHeaders[r[n]]=t}),this.removedCellMetas.forEach(t=>{let[r,n,o]=t;e.setCellMetaObject(r,n,o)}),wA(e,this.removedMergedCells),e.addHookOnce("afterViewRender",t),e.setSourceDataAtCell(a,void 0,void 0,"UndoRedo.undo")}redo(e,t){e.addHookOnce("afterRemoveCol",t),e.alter("remove_col",this.index,this.amount,"UndoRedo.redo")}}class wI extends wh{index;data;fixedRowsBottom;fixedRowsTop;rowIndexesSequence;removedCellMetas;removedMergedCells;constructor({index:e,data:t,fixedRowsBottom:r,fixedRowsTop:n,rowIndexesSequence:o,removedCellMetas:i,removedMergedCells:s}){super("remove_row"),this.index=e,this.data=t,this.fixedRowsBottom=r,this.fixedRowsTop=n,this.rowIndexesSequence=o,this.removedCellMetas=i,this.removedMergedCells=s}static startRegisteringEvents(e,t){e.addHook("beforeRemoveRow",(r,n,o,i)=>{t.done(()=>{let t=e.toPhysicalRow(r),o=t+n-1,i=[];for(let r=0;r<n;r++){let n=ta(e.getSourceDataAtRow(t+r));n&&"object"==typeof n&&!Array.isArray(n)&&delete n.__children,i.push(n)}return new wI({index:t,data:i,fixedRowsBottom:e.getSettings().fixedRowsBottom??0,fixedRowsTop:e.getSettings().fixedRowsTop??0,rowIndexesSequence:e.rowIndexMapper.getIndexesSequence(),removedCellMetas:wE(e,t,o,0,e.countCols()-1),removedMergedCells:wT(e,"row",r,n)})},i)})}undo(e,t){let r=e.getSettings(),n=[];r.fixedRowsBottom=this.fixedRowsBottom,r.fixedRowsTop=this.fixedRowsTop,this.data.forEach((e,t)=>{Object.keys(e).forEach(r=>{let o=Number.parseInt(r,10);n.push([this.index+t,isNaN(o)?r:o,e[r]])})}),e.rowIndexMapper.setIndexesSequence(this.rowIndexesSequence),e.alter("insert_row_above",e.toVisualRow(this.index),this.data.length,"UndoRedo.undo"),e.rowIndexMapper.setIndexesSequence(this.rowIndexesSequence),this.removedCellMetas.forEach(t=>{let[r,n,o]=t;e.setCellMetaObject(r,n,o)}),wA(e,this.removedMergedCells),e.addHookOnce("afterViewRender",t),e.setSourceDataAtCell(n,void 0,void 0,"UndoRedo.undo")}redo(e,t){e.addHookOnce("afterRemoveRow",t),e.alter("remove_row",e.toVisualRow(this.index),this.data.length,"UndoRedo.redo")}}class wx extends wh{rows;finalRowIndex;constructor({rows:e,finalIndex:t}){super("row_move"),this.rows=e.slice(),this.finalRowIndex=t}static startRegisteringEvents(e,t){e.addHook("beforeRowMove",(e,r)=>{!1!==e&&t.done(()=>new wx({rows:e,finalIndex:r}))})}undo(e,t){let r=e.getPlugin("manualRowMove");e.addHookOnce("afterViewRender",t),CA(this.rows,this.finalRowIndex,e.rowIndexMapper.getNumberOfIndexes()).reverse().forEach(e=>{let{from:t,to:n}=e;t<n&&(n-=1),r.moveRow(n,t)}),e.render(),e.deselectCell(),e.selectRows(this.rows[0],this.rows[0]+this.rows.length-1)}redo(e,t){let r=e.getPlugin("manualRowMove");e.addHookOnce("afterViewRender",t),r.moveRows(this.rows.slice(),this.finalRowIndex),e.render(),e.deselectCell(),e.selectRows(this.finalRowIndex,this.finalRowIndex+this.rows.length-1)}}class wN extends wh{cellRange;constructor({cellRange:e}){super("unmerge_cells"),this.cellRange=e}static startRegisteringEvents(e,t){e.addHook("afterUnmergeCells",(e,r)=>{r||t.done(()=>new wN({cellRange:e}))})}undo(e,t){let r=e.getPlugin("mergeCells");e.addHookOnce("afterViewRender",t),r.mergeRange(this.cellRange,!0)}redo(e,t){let r=e.getPlugin("mergeCells");e.addHookOnce("afterViewRender",t),r.unmergeRange(this.cellRange,!0),e.render()}}let wO="undoRedo";nF.getSingleton().register("beforeUndo"),nF.getSingleton().register("afterUndo"),nF.getSingleton().register("beforeRedo"),nF.getSingleton().register("afterRedo");let wk="ht-dialog",wH=["primary","secondary"];function w_(e){return"string"==typeof e&&wH.includes(e)}function wL(e){return w_(e)?e:"secondary"}let wP=new Map([["base",function(){let e=null,t={};return{TEMPLATE_NAME:"base",dialogA11YOptions:()=>({role:"dialog"}),compile:function(){let r=eg`${`
      <div data-ref="contentElement" class="${wk}__content"></div>
    `}`;return Object.assign(t,r.refs),e=r.fragment,r},focusableElements:function(){return null===e&&tr("Compile the template first."),[]}}}],["confirm",function(e){let{id:t="",title:r="",description:n="",buttons:o=[]}=e,i=null,s={};return{TEMPLATE_NAME:"confirm",dialogA11YOptions:()=>({role:"alertdialog",ariaLabelledby:`${t}-dialog-confirm-title`,ariaDescribedby:n?`${t}-dialog-confirm-description`:void 0}),compile:function(){let e=eg`${`
      <div tabindex="-1" data-ref="contentElement" class="${wk}__content-wrapper-inner">
        <div class="${wk}__content">
          <h2
            id="${t}-dialog-confirm-title"
            class="${wk}__title">${oc(r)}</h2>
          <p
            id="${t}-dialog-confirm-description"
            class="${wk}__description">${oc(n)}</p>
        </div>
        ${o.length>0?`
          <div data-ref="buttonsContainer" class="${wk}__buttons">
            ${o.map(e=>`
              <button class="ht-button ht-button--${wL(e.type)}">${oc(e.text)}</button>
            `).join("")}
          </div>
        `:""}
      </div>
    `}`;return Object.assign(s,e.refs),i=e.fragment,e},focusableElements:function(){null===i&&tr("Compile the template first.");let{contentElement:e,buttonsContainer:t}=s,r=[];return t?r.push(...Array.from(t.children)):r.push(e),r}}}]]),wD=`
<div data-ref="dialogElement" class="${wk}">
  <div data-ref="dialogWrapperElement" class="${wk}__content-wrapper">
</div>
`;class wF{#gn;#cJ;#X=!1;#go=!1;#gi=wP.get("base")();#gs=[];#ga;#gl;constructor({overlayContainer:e,isRtl:t,sanitizer:r,warnScope:n}){this.#gn=e,this.#X=t,this.#ga=r,this.#gl=n,this.install()}useTemplate(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!wP.has(e)||"base"===e){let t=Array.from(wP.keys()).filter(e=>"base"!==e).join(", ");tr(ec`Invalid template: ${e}.\x20
        Valid templates are: ${t}.`)}this.#gi=wP.get(e)(t),this.#gs=(t.buttons??[]).map(e=>e.callback)}useDefaultTemplate(){this.#gi=wP.get("base")(),this.#gs=[]}install(){if(this.#cJ?.dialogElement)return;let e=eg`${wD}`;this.#cJ=e.refs;let{dialogElement:t}=this.#cJ;rc(t,[["aria-modal","true"],["dir",this.#X?"rtl":"ltr"]]),t.addEventListener("transitionstart",()=>this.#gh()),t.addEventListener("transitionend",()=>this.#gd()),this.#gn&&this.#gn.appendChild(e.fragment)}getContainer(){return this.#cJ.dialogElement}getFocusableElements(){return this.#gi.focusableElements()}updateDialog(e){let{isVisible:t,content:r,customClassName:n,background:o,contentBackground:i,animation:s,a11y:a}=e,l=this.#gi.compile(),{dialogElement:h,dialogWrapperElement:d}=this.#cJ;d.innerHTML="",d.appendChild(l.fragment),Object.assign(this.#cJ,l.refs);let{contentElement:u,buttonsContainer:c}=this.#cJ;"base"!==this.#gi.TEMPLATE_NAME&&Object.assign(a,this.#gi.dialogA11YOptions());let g=n?` ${n}`:"",p=o?` ${wk}--background-${o}`:"",m=s?` ${wk}--animation`:"",f=t?` ${wk}--show`:"";(h.className=[wk,`${wk}--${this.#gi.TEMPLATE_NAME}`,"handsontable",g,p,m,f].join(" "),"base"===this.#gi.TEMPLATE_NAME&&rc(h,[v(-1)]),rc(h,["alertdialog"===a.role?["role","alertdialog"]:["role","dialog"]]),a.ariaLabel&&!a.ariaLabelledby?rc(h,[H(a.ariaLabel)]):rg(h,"aria-label"),a.ariaLabelledby)?rc(h,[["aria-labelledby",a.ariaLabelledby]]):rg(h,"aria-labelledby"),a.ariaDescribedby?rc(h,[["aria-describedby",a.ariaDescribedby]]):rg(h,"aria-describedby");let b=i?` ${wk}__content--background`:"";return rd(u,`${wk}__content${b}`),"base"===this.#gi.TEMPLATE_NAME?(u.innerHTML="","string"==typeof r?rw(u,r,this.#ga,"dialog",this.#gl):(ne(r)||r instanceof DocumentFragment)&&u.appendChild(r)):c&&Array.from(c.children).forEach((e,t)=>{let r=this.#gs[t];r&&e.addEventListener("click",r)}),this}showDialog(e){let{dialogElement:t}=this.#cJ;return t.style.display="block",e&&t.offsetHeight,rd(t,`${wk}--show`),this.#go=!1,this}hideDialog(e){let{dialogElement:t}=this.#cJ;return ru(t,`${wk}--show`),(!e||this.#go)&&e||(t.style.display="none"),this.#go=!1,this}focusDialog(){this.#cJ.dialogElement.focus()}updateWidth(e){return this.#cJ.dialogElement.style.width=`${e}px`,this}destroyDialog(){this.#cJ?.dialogElement.remove(),this.#cJ=void 0}#gd(){let{dialogElement:e}=this.#cJ;rh(e,`${wk}--show`)||(e.style.display="none")}#gh(){this.#go=!0}}th(wF,ab);let wB="dialog",wV=`plugin:${wB}`;class wU extends pa{static get PLUGIN_KEY(){return wB}static get PLUGIN_PRIORITY(){return 360}static get DEFAULT_SETTINGS(){return{template:null,content:"",customClassName:"",background:"solid",contentBackground:!1,animation:!0,closable:!1,a11y:{role:"dialog",ariaLabel:"Dialog",ariaLabelledby:"",ariaDescribedby:""}}}static get SETTINGS_VALIDATORS(){return{template:e=>tc(e)&&typeof["alert","confirm"].includes(String(e.type))&&"string"==typeof e.title&&(void 0===e?.description||"string"==typeof e?.description)&&(void 0===e?.buttons||Array.isArray(e?.buttons)&&e.buttons.every(e=>tc(e)&&"string"==typeof e.text&&w_(e.type)&&(void 0===e.callback||"function"==typeof e.callback))),content:e=>"string"==typeof e||ne(e)||"u">typeof DocumentFragment&&e instanceof DocumentFragment,customClassName:e=>"string"==typeof e,background:e=>"string"==typeof e&&["solid","semi-transparent"].includes(e),contentBackground:e=>"boolean"==typeof e,animation:e=>"boolean"==typeof e,closable:e=>"boolean"==typeof e,a11y:e=>tc(e)&&(void 0===e?.role||"string"==typeof e?.role&&["dialog","alertdialog"].includes(e.role))&&(void 0===e?.ariaLabel||"string"==typeof e?.ariaLabel)&&(void 0===e?.ariaLabelledby||"string"==typeof e?.ariaLabelledby)&&(void 0===e?.ariaDescribedby||"string"==typeof e?.ariaDescribedby)}}#gu=null;#gc=!1;#gg=null;isEnabled(){return!!this.hot.getSettings()[wB]}enablePlugin(){this.enabled||(this.#gu||(this.#gu=new wF({overlayContainer:this.hot.rootOverlaysElement,sanitizer:ae(this.hot),warnScope:this.hot.rootElement,isRtl:this.hot.isRtl()})),this.#oy(),this.#gp(),this.addHook("afterViewRender",()=>this.#gm()),super.enablePlugin())}updatePlugin(){this.disablePlugin(),this.enablePlugin(),super.updatePlugin()}disablePlugin(){this.hide(),this.#ov(),this.#gf(),this.#gu?.destroyDialog(),this.#gu=null,super.disablePlugin()}isVisible(){return this.#gc}show(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.enabled){if(this.isVisible())return void this.update(e);this.hot.runHooks("beforeDialogShow"),this.update(e),this.#gu.showDialog(this.getSetting("animation")),this.#gc=!0,this.hot.getFocusScopeManager().activateScope(wB),this.#gg=this.hot.selection.exportSelection(),this.hot.deselectCell(),this.hot.runHooks("afterDialogShow")}}hide(){if(this.isVisible()){if(this.hot.runHooks("beforeDialogHide"),this.#gu.hideDialog(this.getSetting("animation")),this.#gc=!1,this.hot.getFocusScopeManager().deactivateScope(wB),this.#gg&&this.#gg.ranges.length>0&&this.#gg.activeRange){let e=this.#gg;this.hot.selection.importSelection({ranges:e.ranges,activeRange:e.activeRange,activeSelectionLayer:e.activeSelectionLayer,selectedByRowHeader:e.selectedByRowHeader,selectedByColumnHeader:e.selectedByColumnHeader,disableHeadersHighlight:e.disableHeadersHighlight}),this.hot.view.render(),this.#gg=null}else this.hot.view.render(),this.#gg=null;this.hot.runHooks("afterDialogHide")}}update(e){if(!this.enabled)return;this.updatePluginSettings(e);let t=this.getSetting("template");t!==wU.DEFAULT_SETTINGS.template&&this.getSetting("content")!==wU.DEFAULT_SETTINGS.content&&tr("The `template` option cannot be used together with the `content` option."),t?this.#gu.useTemplate(t.type,{...t,id:this.hot.guid}):this.#gu.useDefaultTemplate(),this.#gu.updateDialog({isVisible:this.isVisible(),content:this.getSetting("content"),customClassName:this.getSetting("customClassName"),background:this.getSetting("background"),contentBackground:this.getSetting("contentBackground"),animation:this.getSetting("animation"),a11y:this.getSetting("a11y")})}showAlert(e,t){let{title:r="Alert",description:n}=tc(e)?e:{title:e};this.show({template:{type:"confirm",title:r,description:n,buttons:[{text:this.hot.getTranslatedPhrase(aW),type:"primary",callback:function(){for(var e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];return t?.(...r)}}]},contentBackground:!1,background:"solid",animation:!0,closable:!1})}showConfirm(e,t,r){let{title:n="Confirm",description:o}=tc(e)?e:{title:e};this.show({template:{type:"confirm",title:n,description:o,buttons:[{text:this.hot.getTranslatedPhrase(aG),type:"secondary",callback:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return r?.(...t)}},{text:this.hot.getTranslatedPhrase(aW),type:"primary",callback:function(){for(var e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];return t?.(...r)}}]},contentBackground:!0,background:"semi-transparent",animation:!0,closable:!1})}focus(){this.#gu.focusDialog()}#oy(){let e=this.hot.getShortcutManager(),t=e.getContext(wV)??e.addContext(wV);t.addShortcut({keys:[["Escape"]],callback:()=>{this.hide()},runOnlyIf:()=>this.#gc&&!!this.getSetting("closable"),group:wB}),t.addShortcut({keys:[["Shift","Tab"],["Tab"]],preventDefault:!1,callback:e=>{this.hot._registerTimeout(()=>{e.shiftKey?this.hot.runHooks("dialogFocusPreviousElement"):this.hot.runHooks("dialogFocusNextElement")})},group:wB})}#ov(){let e=this.hot.getShortcutManager().getContext(wV);e?.removeShortcutsByGroup(wB)}#gp(){this.hot.getFocusScopeManager().registerScope(wB,this.#gu.getContainer(),{shortcutsContextName:wV,type:"modal",runOnlyIf:()=>this.isVisible(),onActivate:e=>{let t=this.hot.isListening(),r=this.#gu.getFocusableElements();r.length>0?"tab_from_above"===e?r[0]?.focus():"tab_from_below"===e&&r[r.length-1]?.focus():"tab_from_above"!==e&&"tab_from_below"!==e&&t&&!this.#gu.getContainer().contains(this.hot.rootDocument.activeElement)&&this.#gu.getContainer().focus(),t&&this.hot.runHooks("afterDialogFocus","unknown"===e?"show":e)}})}#gf(){this.hot.getFocusScopeManager().unregisterScope(wB)}#gm(){let{view:e}=this.hot,t=e.isHorizontallyScrollableByWindow()?e.getTotalTableWidth():e.getWorkspaceWidth();this.#gu.updateWidth(t)}destroy(){this.#gu?.destroyDialog(),this.#gu=null,this.#gc=!1,this.#gg=null,super.destroy()}}let wz="loading",wW="ht-notification",wG=["top-start","top-end","bottom-start","bottom-end"];class w${#gb;#ga;#gl;#X=!1;#gC=null;#gy=new Map;constructor({overlayElement:e,sanitizer:t,warnScope:r,isRtl:n}){this.#gb=e,this.#ga=t,this.#gl=r,this.#X=n}install(){if(this.#gC)return;let e=this.#gb.ownerDocument,t=e.createElement("div");t.className=`${wW} handsontable`,t.setAttribute("dir",this.#X?"rtl":"ltr"),wG.forEach(r=>{let n=e.createElement("div");n.className=`${wW}__stack ${wW}__stack--${r}`,n.dataset.htNotificationPosition=r,n.tabIndex=-1,t.appendChild(n),this.#gy.set(r,n)}),this.#gb.appendChild(t),this.#gC=t}getHost(){return this.#gC}getStack(e){return this.#gy.get(e)}setRtl(e){this.#X=e,this.#gC&&this.#gC.setAttribute("dir",e?"rtl":"ltr")}setSanitizer(e){this.#ga=e}createToastElement(e,t,r){let n=this.#gb.ownerDocument,o=n.createElement("div"),i="error"===e.variant;o.className=`${wW}__toast ${wW}__toast--${e.variant}`,o.dataset.htNotificationId=e.id,o.setAttribute("role",i?"alert":"status"),o.setAttribute("aria-live",i?"assertive":"polite"),o.setAttribute("aria-atomic","true"),r&&(o.classList.add(`${wW}__toast--animate`),o.classList.add(e.position.startsWith("top")?`${wW}__toast--stack-top`:`${wW}__toast--stack-bottom`));let s=n.createElement("div");s.className=`${wW}__toast-inner`;let a=n.createElement("div");a.className=`${wW}__accent`,a.setAttribute("aria-hidden","true"),s.appendChild(a);let l=n.createElement("div");if(l.className=`${wW}__body`,e.title){let t=n.createElement("div");t.className=`${wW}__title`,t.textContent=oc(e.title),l.appendChild(t)}let h=n.createElement("div");if(h.className=`${wW}__message`,"string"==typeof e.message?rw(h,e.message,this.#ga,"notification",this.#gl):h.appendChild(e.message),l.appendChild(h),e.actions?.length){let t=n.createElement("div");t.className=`${wW}__actions`,e.actions.forEach((e,r)=>{let o=n.createElement("button");o.type="button",o.className=`ht-button ht-button--${wL(e.type)}`,o.textContent=oc(e.label),o.dataset.htNotificationAction=String(r),t.appendChild(o)}),l.appendChild(t)}if(s.appendChild(l),e.closable){let e=n.createElement("button");e.type="button",e.className=`${wW}__close`,e.setAttribute("aria-label",t),s.appendChild(e)}o.appendChild(s),o.tabIndex=-1,s.querySelectorAll("button").forEach(e=>{e.tabIndex=-1});let d=this.#gb.ownerDocument.defaultView;return r?d.requestAnimationFrame(()=>{d.requestAnimationFrame(()=>{o.classList.add(`${wW}__toast--visible`)})}):o.classList.add(`${wW}__toast--visible`),{element:o}}static getFocusables(e){let t=Array.from(e.querySelectorAll("button")).filter(e=>!e.disabled);return t.length>0?t:[e]}static setSequentialFocusWithinHost(e,t){if(!e)return;let r=t?0:-1;e.querySelectorAll(`.${wW}__toast`).forEach(e=>{let t=Array.from(e.querySelectorAll("button")).filter(e=>!e.disabled);t.forEach(e=>{e.tabIndex=r}),0===t.length?e.tabIndex=r:e.tabIndex=-1})}destroy(){this.#gC?.remove(),this.#gC=null,this.#gy.clear()}}let wY="notification",wj=`plugin:${wY}`,wq=`plugin:${wY}:global`,wK=new Set(wG),wX=new Set(["info","success","warning","error"]);class wQ extends pa{static get PLUGIN_KEY(){return wY}static get PLUGIN_PRIORITY(){return 375}static get DEFAULT_SETTINGS(){return{stackLimit:10,animation:!0}}static get SETTINGS_VALIDATORS(){return{stackLimit:e=>"number"==typeof e&&e>0&&Number.isInteger(e),animation:e=>"boolean"==typeof e}}#gu=null;#gw=new Map;#gS={"top-start":[],"top-end":[],"bottom-start":[],"bottom-end":[]};#gv=null;#gR=!1;#gE=!1;#gT=!1;#gA=!1;#gM=null;isEnabled(){return!!this.hot.getSettings()[wY]}enablePlugin(){this.enabled||(this.#gu||(this.#gu=new w$({overlayElement:this.hot.rootOverlaysElement,sanitizer:ae(this.hot),warnScope:this.hot.rootElement,isRtl:this.hot.isRtl()})),this.#gu.install(),this.#gp(),this.#gI(),this.eventManager.addEventListener(this.hot.rootDocument,"focusin",this.#gx,!0),this.addHook("afterUpdateSettings",this.#gN),this.eventManager.addEventListener(this.hot.rootDocument,"visibilitychange",()=>{this.#gO()&&this.#gk()}),super.enablePlugin(),this.#gM=this.#gH())}updatePlugin(e){let t=this.#gH();e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,wY)&&null!==this.#gM&&this.#g_(this.#gM,t)||(this.disablePlugin(),this.enablePlugin()),super.updatePlugin()}disablePlugin(){this.hideAll(),this.#gL(),this.#gf(),super.disablePlugin(),this.#gu?.destroy(),this.#gu=null,this.#gv=null,this.#gR=!1,this.#gM=null}showMessage(e){if(!this.enabled)return"";let t=this.#gP(e);if(!1===this.hot.runHooks("beforeNotificationShow",t))return"";let r=this.getSetting("stackLimit");return this.#gD(t.position)>=r?this.#gS[t.position].push(t):this.#gF(t),t.id}hide(e){if(!this.enabled||!e)return;let t=this.#gw.get(e);if(!t)return void this.#gB(e);if(!1===this.hot.runHooks("beforeNotificationHide",e)){t.durationMs>0&&t.remainingMs<=0&&(t.remainingMs=t.durationMs);return}let r=this.hot.rootDocument.activeElement,n=r instanceof this.hot.rootWindow.HTMLElement&&t.element.contains(r);this.#gV(t,!0),this.hot.runHooks("afterNotificationHide",e),this.#gU(t.options.position),this.#gz(n)}hideAll(){this.enabled&&(wG.forEach(e=>{this.#gS[e].length=0}),[...this.#gw.keys()].forEach(e=>this.hide(e)))}isVisible(e){return void 0===e?this.#gw.size>0:this.#gw.has(e)}getQueueSize(){return wG.reduce((e,t)=>e+this.#gS[t].length,0)}destroy(){wG.forEach(e=>{this.#gS[e].length=0}),this.#gw.clear(),this.#gL(),this.#gf(),this.#gu?.destroy(),this.#gu=null,this.#gv=null,this.#gR=!1,this.#gM=null,super.destroy()}#gH(){return{stackLimit:this.getSetting("stackLimit"),animation:this.getSetting("animation")}}#g_(e,t){return e.stackLimit===t.stackLimit&&e.animation===t.animation}#gN=()=>{if(!this.enabled||!this.#gu)return;let e=this.hot.rootElement.getAttribute("dir");"rtl"===e||"ltr"===e?this.#gu.setRtl("rtl"===e):this.#gu.setRtl(this.hot.isRtl()),this.#gu.setSanitizer(ae(this.hot))};#gP(e){tc(e)&&("string"==typeof e.message||"u">typeof HTMLElement&&e.message instanceof HTMLElement)||tr("Notification.showMessage expects an object with a `message` string or HTMLElement.");let t=`htn-${oh()}`,r=e.variant&&wX.has(e.variant)?e.variant:"info",n=e.position&&wK.has(e.position)?e.position:"bottom-end",o="number"==typeof e.duration&&e.duration>=0?e.duration:4e3,i="boolean"!=typeof e.closable||e.closable,s=Array.isArray(e.actions)?e.actions.map(e=>{tc(e)&&"string"==typeof e.label&&"function"==typeof e.callback||tr("Each notification action needs `label` (string) and `callback` (function).");let t=wL(e.type);return{label:e.label,type:t,callback:e.callback}}):[];return{id:t,variant:r,title:"string"==typeof e.title?e.title:void 0,message:e.message,duration:o,position:n,closable:i,actions:s}}#gD(e){let t=0;return this.#gw.forEach(r=>{r.options.position===e&&(t+=1)}),t}#gF(e){let t=this.hot.getTranslatedPhrase(hC),r=this.getSetting("animation"),{element:n}=this.#gu.createToastElement(e,t,r),o=this.#gu.getStack(e.position);o||tr(`Unknown notification position "${e.position}".`),e.position.startsWith("top")?o.prepend(n):o.appendChild(n),e.position.startsWith("bottom")&&this.hot.rootWindow.requestAnimationFrame(()=>{this.enabled&&(o.scrollTop=o.scrollHeight)});let i=e.duration,s={id:e.id,options:e,element:n,durationMs:i,remainingMs:i,paused:!1};this.#gw.set(e.id,s),this.#gW(s),this.#gR&&this.#gG(),this.hot.runHooks("afterNotificationShow",e.id,e),i>0&&this.#gk()}#gW(e){e.toastEventDisposers=[this.eventManager.addEventListener(e.element,"click",t=>{this.#g$(t,e)}),this.eventManager.addEventListener(e.element,"mouseenter",()=>{e.paused=!0}),this.eventManager.addEventListener(e.element,"mouseleave",()=>{e.paused=!1,e.durationMs>0&&!this.hot.rootDocument.hidden&&this.#gk()})]}#g$(e,t){let r=e.target;if(!(r instanceof this.hot.rootWindow.HTMLElement))return;if(r.closest(`.${wW}__close`))return void this.hide(t.id);let n=r.closest("[data-ht-notification-action]");if(!n||!t.element.contains(n))return;let o=Number.parseInt(n.dataset.htNotificationAction??"",10),i=t.options.actions[o];i&&i.callback()}#gY(){let e=this.#gu?.getHost();e&&w$.setSequentialFocusWithinHost(e,!1),this.#gR=!1}#gG(){let e=this.#gu?.getHost();e&&0!==this.#gw.size&&(w$.setSequentialFocusWithinHost(e,!0),this.#gR=!0)}#gj(){let e=this.#gu?.getHost();if(!e||0===this.#gw.size)return;let t=this.hot.rootDocument.activeElement;t instanceof this.hot.rootWindow.HTMLElement&&!e.contains(t)&&(this.#gv=t),this.hot.listen(),this.hot.getFocusScopeManager().activateScope(wY)}#gq(){let e=this.hot.getFocusScopeManager();"grid"!==e.getActiveScopeId()&&e.activateScope("grid")}#gK(){let e=this.hot.getFocusScopeManager();if(this.#gA=!0,e.getActiveScopeId()===wY)e.deactivateScope(wY);else{this.#gA=!1,this.#gY();let e=this.#gv;this.#gv=null,e?.isConnected&&this.hot.getFocusManager().focusElement(e,{preventScroll:!0}),this.#gq()}}#gX(){let e=this.hot.rootDocument,t=this.#gu?.getHost();t?.contains(e.activeElement)&&this.#gK()}#gp(){this.#gT||(this.hot.getFocusScopeManager().registerScope(wY,this.#gu.getHost(),{shortcutsContextName:wj,runOnlyIf:()=>this.#gw.size>0,enableFocusCatchers:!1,onActivate:()=>{this.#gu?.getHost()&&(this.#gG(),this.#gQ())},onDeactivate:()=>{if(this.#gY(),this.#gA){this.#gA=!1;let e=this.#gv;this.#gv=null,e?.isConnected&&this.hot.getFocusManager().focusElement(e,{preventScroll:!0}),this.#gq()}}}),this.#gT=!0)}#gI(){let e=this.hot.getShortcutManager(),t=e.getContext(wj)??e.addContext(wj),r=e.getOrCreateContext(wq,"global"),n=e.getContext("grid"),o={keys:[["f6"]],preventDefault:!0,callback:()=>{this.#gj()},runOnlyIf:()=>this.#gZ(),group:wY};r.addShortcut(o),n&&n.addShortcut(o),t.addShortcut({keys:[["Escape"]],callback:()=>this.#gX(),runOnlyIf:()=>this.#gu?.getHost()?.contains(this.hot.rootDocument.activeElement)===!0,group:wY}),t.addShortcut({keys:[["Tab"]],preventDefault:!0,callback:()=>this.#gJ(),runOnlyIf:()=>this.#g0(),group:wY}),t.addShortcut({keys:[["Shift","Tab"]],preventDefault:!0,callback:()=>this.#gX(),runOnlyIf:()=>this.#g1(),group:wY})}#gL(){let e=this.hot.getShortcutManager();e.getContext(wj)?.removeShortcutsByGroup(wY),e.getContext(wq)?.removeShortcutsByGroup(wY),e.getContext("grid")?.removeShortcutsByGroup(wY)}#gx=e=>{if(0===this.#gw.size)return;let t=this.#gu?.getHost(),r=e.target;if(r instanceof this.hot.rootWindow.HTMLElement&&t){if(t.contains(r)){if(null!==this.#gv)return;let r=e.relatedTarget;r instanceof this.hot.rootWindow.HTMLElement&&this.hot.rootWrapperElement.contains(r)&&!t.contains(r)&&(this.#gv=r);return}this.#gY()}};#g2(){let e=this.#gu?.getHost();if(!e)return[];let t=[...e.querySelectorAll(`.${wW}__toast`)],r=[];for(let e=0;e<t.length;e+=1)r.push(...w$.getFocusables(t[e]));return r}#g3(){return this.#g2()[0]}#g6(){if(0===this.#gw.size)return null;let e=this.hot.rootDocument.activeElement,t=this.#gu?.getHost();if(!(e instanceof this.hot.rootWindow.HTMLElement)||!t?.contains(e))return null;let r=this.#g2();if(0===r.length)return null;let n=r.indexOf(e);return -1===n?null:(this.#gR||this.#gG(),{list:r,idx:n})}#g0(){let e=this.#g6();return null!==e&&e.idx===e.list.length-1}#g1(){let e=this.#g6();return null!==e&&0===e.idx}#gJ(){let e=this.hot.getFocusScopeManager();this.#gA=!1,e.getActiveScopeId()===wY?e.deactivateScope(wY):this.#gY(),this.hot.listen(),e.activateScope("grid",dV.TAB_FROM_ABOVE),this.#gv=null}#gf(){this.#gT&&(this.hot.getFocusScopeManager().unregisterScope(wY),this.#gT=!1)}#gV(e,t){e.toastEventDisposers&&(e.toastEventDisposers.forEach(e=>e()),e.toastEventDisposers=null),this.#gw.delete(e.id),t&&e.element.remove()}#g5(e){let t=this.#gu?.getHost();return!!t&&e instanceof this.hot.rootWindow.HTMLElement&&t.contains(e)}#g4(e){let t=!1;return this.#gw.forEach(r=>{r.element.contains(e)&&(t=!0)}),t}#g9(){this.hot.listen();let e=this.hot.getFocusScopeManager();e.getActiveScopeId()===wY&&e.deactivateScope(wY),e.activateScope(wY)}#gQ(){let e=this.hot.rootDocument;if(!this.enabled||0===this.#gw.size||this.#g4(e.activeElement))return;let t=this.#g3();t&&this.hot.getFocusManager().focusElement(t)}#g7(e){if(!(e instanceof this.hot.rootWindow.HTMLElement))return!1;let t=e.closest(".ht-root-wrapper");return null!==t?t===this.hot.rootWrapperElement:this.hot.rootDocument.querySelectorAll(".ht-root-wrapper").length<=1}#gZ(){if(!this.enabled||0===this.#gw.size)return!1;let e=this.#gu?.getHost();if(!e)return!1;let t=this.hot.rootDocument.activeElement;return!(t instanceof this.hot.rootWindow.HTMLElement&&e.contains(t))&&this.#g7(t)}#g8(){this.#gK()}#gz(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.hot.rootDocument,r=this.#gu?.getHost(),n=t.activeElement;if(this.#gw.size>0){let t=n instanceof this.hot.rootWindow.HTMLElement&&r?.contains(n)===!0;t&&!this.#g4(n)?this.#g9():!t&&e&&this.#g9();return}let o=this.#gR,i=this.#g5(t.activeElement);(o||e||i)&&this.#g8()}#gU(e){let t=this.getSetting("stackLimit");for(;this.#gS[e].length>0&&this.#gD(e)<t;){let t=this.#gS[e].shift();this.#gF(t)}}#gB(e){wG.forEach(t=>{let r=this.#gS[t],n=r.findIndex(t=>t.id===e);n>=0&&r.splice(n,1)})}#gk(){!this.#gE&&this.enabled&&(this.#gE=!0,this.hot._registerTimeout(()=>{this.#gE=!1,this.enabled&&(this.#pe(),this.#gO()&&this.#gk())},200))}#pe(){let e=!this.hot.rootDocument.hidden,t=[];this.#gw.forEach(r=>{r.durationMs<=0||!r.paused&&e&&(r.remainingMs-=200,r.remainingMs<=0&&t.push(r.id))}),t.forEach(e=>this.hide(e))}#gO(){if(this.hot.rootDocument.hidden)return!1;let e=!1;return this.#gw.forEach(t=>{t.durationMs>0&&!t.paused&&(e=!0)}),e}}let wZ="ht-empty-data-state",wJ=`<div data-ref="emptyDataStateElement" class="${wZ} handsontable">
  <div class="${wZ}__content-wrapper">
    <div data-ref="emptyDataStateInner" class="${wZ}__content-wrapper-inner"></div>
  </div>
</div>`,w0=function(e){let{title:t,description:r,buttons:n}=e,o=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=o?`<div class="${wZ}__spinner" aria-hidden="true"></div>`:"";return`
  ${i}
  <div class="${wZ}__content">
    ${t?`<h2 class="${wZ}__title">${oc(t)}</h2>`:""}
    ${r?`<p class="${wZ}__description">${oc(r)}</p>`:""}
  </div>
  <div
    data-ref="emptyDataStateButtons"
    class="${wZ}__buttons${n?.length&&n.length>0?` ${wZ}__buttons--has-buttons`:""}"
  >${!o&&n?.length&&n.length>0?n.map(e=>`<button class="ht-button ht-button--${wL(e.type)}">${oc(e.text)}</button>`).join(""):""}</div>`};class w1{#pt;#ni;#cJ=null;#pr=null;constructor({gridContainer:e,rootDocument:t}){this.#pt=e,this.#ni=t,this.install()}install(){if(this.#cJ?.emptyDataStateElement)return;let e=eg`${wJ}`;this.#cJ=e.refs;let{emptyDataStateInner:t,emptyDataStateElement:r}=this.#cJ;rc(t,[v(-1)]),rc(r,[v(-1)]),this.#pt&&this.#pt.appendChild(e.fragment)}getElement(){return this.#cJ?.emptyDataStateElement}getFocusableElements(){let{emptyDataStateButtons:e,emptyDataStateInner:t}=this.#cJ,r=Array.from(e?.children??[]);return 0===r.length?[t]:r}show(){this.#cJ?.emptyDataStateElement&&(this.#cJ.emptyDataStateElement.style.display="block")}hide(){this.#cJ?.emptyDataStateElement&&(this.#pr?.remove(),this.#pr=null,this.#cJ.emptyDataStateElement.style.display="none")}updateContent(e){let t,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],{emptyDataStateElement:n,emptyDataStateInner:o}=this.#cJ;t="string"==typeof e?{title:e}:{title:e?.title,description:e?.description,buttons:e?.buttons};let i=eg`${w0(t,r)}`;r?(rd(n,`${wZ}--loading`),rc(o,[Y()])):(ru(n,`${wZ}--loading`),rg(o,Y()[0])),this.#cJ={...this.#cJ,...i.refs},o.innerHTML="",o.appendChild(i.fragment),!r&&t.buttons?.length&&t.buttons.length>0&&Array.from(this.#cJ.emptyDataStateButtons.children).forEach((e,r)=>{e.addEventListener("click",t.buttons[r].callback)})}updateClassNames(e){let{emptyDataStateElement:t}=this.#cJ;e.countRenderableColumns()>0&&e.getColumnHeadersCount()>0?rd(t,`${wZ}--disable-top-border`):ru(t,`${wZ}--disable-top-border`),e.countRenderableRows()>0&&e.getRowHeadersCount()>0?rd(t,`${wZ}--disable-inline-border`):ru(t,`${wZ}--disable-inline-border`),e.hasHorizontalScroll()&&!e.isHorizontallyScrollableByWindow()?rd(t,`${wZ}--disable-bottom-border`):ru(t,`${wZ}--disable-bottom-border`)}updateSize(e){var t;let r,n,o=arguments.length>1&&void 0!==arguments[1]&&arguments[1],{emptyDataStateElement:i}=this.#cJ,s=e.hasHorizontalScroll()?rX(e.hot.rootDocument):0,a=e.countRenderableRows(),l=e.countRenderableColumns(),h=e.getColumnHeadersCount();i.style.top=l>0?`${e.getColumnHeaderHeight()}px`:"0px",i.style.insetInlineStart="0px";let d={element:this.#pr};!function(e,t,r,n,o){if(0!==r){o.element?.remove(),o.element=null;return}o.element||(o.element=e.createElement("div"),o.element.classList.add(`${n}-placeholder`),t._wt.wtTable.holder.appendChild(o.element)),o.element.style.width="100%",o.element.style.height="150px"}(this.#ni,e,a,wZ,d),this.#pr=d.element;let u=(t=a>0||!0===o&&l>0,r=e.getWorkspaceWidth(),e.isHorizontallyScrollableByWindow()?l>0?r=e.getTotalTableWidth():t&&(r=e.getViewportWidth()):e.getTableWidth()-e.getRowHeaderWidth()<e.getViewportWidth()&&l>0&&(r=e.getTableWidth()),r),c=(n=e.getTableHeight(),e.isVerticallyScrollableByWindow()||e.hasVerticalScroll()?n=l>0?e.hot.getTableHeight()-e.getColumnHeaderHeight():e.hot.getTableHeight():h>0&&l>0?n=e.getViewportHeight()-s:h>0&&0===l&&(n=e.getWorkspaceHeight()-s),n);i.style.width=`${u}px`,i.style.height=`${c}px`}destroy(){this.#cJ?.emptyDataStateElement?.remove(),this.#pr?.remove(),this.#pr=null,this.#cJ=null}}let w2="emptyDataState",w3=Object.freeze({UNKNOWN:"unknown",FILTERS:"filters",LOADING:"loading"}),w6=`plugin:${w2}`,w5="customEditor";nZ(n3),nZ(cy),nZ(cw),nZ(cP),nZ(cD),nZ(cC),nZ(cF),nZ(cU),nZ(cW),nZ(cG),nZ(c$),nZ(cq),nZ(cc),nZ(cz),nZ(gr),oJ(go),oJ(co),oJ(gg),oJ(gi),oJ(gm),oJ(gn),oJ(gw),oJ(gE),oJ(gx),oJ(g_),oJ(gL),oJ(gP),oJ(cg),oJ(gI),oJ(gy),o4(gD),o4(gU),o4(gV),o4(gz),o4(gG),o4(gj),o4(gq),o4(gX),o4(gY),du({CELL_TYPE:"autocomplete",editor:cy,renderer:go,validator:gD,valueGetter:gQ,valueSetter:gZ,parsePastedValue:!0}),du({CELL_TYPE:"checkbox",editor:cw,renderer:gg,valueSetter:function(e,t,r){let{checkedTemplate:n,uncheckedTemplate:o}=this.getCellMetaTransient(t,r),i=eH(e),s=i===eH(n),a=i===eH(o);return s||a?s?n:o:e}}),du({CELL_TYPE:"date",editor:cP,renderer:gy,validator:gV,sourceDataValidator:gB,sourceDataWarningMessage:'Source data warning ([itemsCount]). Invalid value for "date" cell type.\n\n[affectedCells]\n\nExpected a value compatible with the ISO 8601 date format ("YYYY-MM-DD").',valueFormatter:gC}),du({CELL_TYPE:"dropdown",editor:cD,renderer:gi,validator:gU,filter:!1,strict:!0,valueGetter:function(e){return gQ.call(this,e)},valueSetter:function(e,t,r,n){return gZ.call(this,e,t,r)},parsePastedValue:!0}),du({CELL_TYPE:"handsontable",editor:cC,renderer:gm}),du({CELL_TYPE:"intl-date",editor:cF,renderer:gw,validator:gz,sourceDataValidator:gB,sourceDataWarningMessage:'Source data warning ([itemsCount]). Invalid value for "intl-date" cell type.\n\n[affectedCells]\n\nExpected a value compatible with the ISO 8601 date format ("YYYY-MM-DD").',valueFormatter:gC}),du({CELL_TYPE:"intl-datetime",editor:cU,renderer:gE,validator:gG,sourceDataValidator:gW,sourceDataWarningMessage:'Source data warning ([itemsCount]). Invalid value for "intl-datetime" cell type.\n\n[affectedCells]\n\nExpected a value compatible with the ISO 8601 date-time format ("YYYY-MM-DDTHH:mm:ss").',valueFormatter:gR}),du({CELL_TYPE:"intl-time",editor:cW,renderer:gx,validator:gj,sourceDataValidator:g$,sourceDataWarningMessage:'Source data warning ([itemsCount]). Invalid value for "intl-time" cell type.\n\n[affectedCells]\n\nExpected a value compatible with the 24-hour time format ("HH:mm", "HH:mm:ss" or "HH:mm:ss.SSS").',valueFormatter:gM}),du(pe),du("multiSelect",pe),du({CELL_TYPE:"numeric",editor:cG,renderer:g_,validator:gX,dataType:"number",valueSetter:function(e,t,r,n){if("string"!=typeof e)return e;let o=function(e){let t=e?.numericFormat,r=t?.culture??e?.locale;if("string"==typeof r&&r.length>0)try{let e=new Intl.NumberFormat(r).formatToParts(1.1).find(e=>{let{type:t}=e;return"decimal"===t});if(e?.value==="."||e?.value===",")return e.value}catch{}let n=t?.pattern;if("string"==typeof n){let e=n.lastIndexOf("."),t=n.lastIndexOf(",");if(e>-1&&t>-1)return e>t?".":",";if(t>-1&&-1===e||e>-1&&-1===t)return"."}}(n),i=oR(e,o),s=oE(e,o),a=oT(e,o);if(ov(e)||i||s||a){let t=oN(e,{decimalSeparator:o});if(null==t)return e;let r=/^[+-]?0x/i.test(e.trim()),l=e.trim().replace(/e[+-]?\d+$/i,""),h=!Number.isFinite(t)||0===t&&/[1-9]/.test(l);return!0===n.preserveNumericLiteral&&!(i||s||a)&&!r&&!h&&oS(e)&&ok(e,t)?e.trim():t}return e},valueFormatter:gH}),du({CELL_TYPE:"password",editor:c$,renderer:gL,copyable:!1}),du({CELL_TYPE:"select",editor:cq,renderer:gP}),du(cp),du({CELL_TYPE:"time",editor:cz,renderer:gI,validator:gY,sourceDataValidator:g$,sourceDataWarningMessage:'Source data warning ([itemsCount]). Invalid value for "time" cell type.\n\n[affectedCells]\n\nExpected a value compatible with the 24-hour time format ("HH:mm", "HH:mm:ss" or "HH:mm:ss.SSS").',valueFormatter:gM}),oY(pu),oY(class e extends pa{static get PLUGIN_KEY(){return"autofill"}static get PLUGIN_PRIORITY(){return 20}static get SETTING_KEYS(){return[pC]}static get DEFAULT_SETTINGS(){return{direction:void 0,autoInsertRow:!0}}static get SETTINGS_VALIDATORS(){return{direction:e=>void 0===e||"string"==typeof e&&Object.values(pb).includes(e),autoInsertRow:e=>"boolean"==typeof e}}addingStarted=!1;mouseDownOnCellCorner=!1;mouseDragOutside=!1;handleDraggedCells=0;directions=[];autoInsertRow=!1;#pn=null;#po=null;isEnabled(){return!!this.hot.getSettings()[pC]}enablePlugin(){if(this.enabled)return;let e=this.hot.getSettings()[pC],t={};"string"==typeof e?t.direction=e:e&&"object"==typeof e&&Object.assign(t,e),this.updatePluginSettings(t),this.getSetting("direction")?this.directions=[this.getSetting("direction")]:this.directions=Object.values(pb),this.autoInsertRow=this.getSetting("autoInsertRow"),1===this.directions.length&&this.directions.includes("horizontal")&&(this.autoInsertRow=!1),this.registerEvents(),this.addHook("afterOnCellCornerMouseDown",this.#pi),this.addHook("afterOnCellCornerDblClick",this.#ps),this.addHook("beforeOnCellMouseOver",(e,t)=>this.#pa(t)),this.addHook("afterScroll",this.#aB),super.enablePlugin()}updatePlugin(){this.disablePlugin(),this.enablePlugin(),super.updatePlugin()}disablePlugin(){super.disablePlugin()}getSelectionData(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.hot.getSelectedRangeLast();if(!t)return[];let{row:r,col:n}=t.getTopStartCorner(),{row:o,col:i}=t.getBottomEndCorner(),s=this.hot.runHooks("modifyCopyableRange",[{startRow:r,startCol:n,endRow:o,endCol:i}]),a=[],l=[],h=new Set,d=new Set,u=[];return J(s,e=>{for(let t=e.startRow;t<=e.endRow;t+=1)h.has(t)||(h.add(t),a.push(t));for(let t=e.startCol;t<=e.endCol;t+=1)d.has(t)||(d.add(t),l.push(t))}),J(a,t=>{let r=[];J(l,n=>{let o=e?this.hot.getSourceDataAtCell(t,n):null;e&&(tc(o)||Array.isArray(o))?r.push(this.hot.getCopyableSourceData(t,n)):r.push(this.hot.getCopyableData(t,n))}),u.push(r)}),u}fillIn(){var e;let t,r,n;if(this.hot.selection.highlight.getFill().isEmpty())return!1;let[o,i,s,a]=this.hot.selection.highlight.getFill().getVisualCorners(),l=this.hot.getSelectedRangeLast();if(!l)return!1;let h=l.getTopStartCorner(),d=l.getBottomEndCorner();this.resetSelectionOfDraggedArea();let u=[h.row??0,h.col??0,d.row??0,d.col??0],c=this.hot.runHooks("modifyAutofillRange",[Math.min(h.row??0,o??0),Math.min(h.col??0,i??0),Math.max(d.row??0,s??0),Math.max(d.col??0,a??0)],u),{directionOfDrag:g,startOfDragCoords:p,endOfDragCoords:m}=(e=(e,t)=>this.hot._createCellCoords(e,t),c[0]===u[0]&&c[1]<u[1]?(n="left",t=e(c[0],c[1]),r=e(c[2],u[1]-1)):c[2]===u[2]&&c[0]===u[0]&&c[3]>u[3]?(n="right",t=e(c[0],u[3]+1),r=e(c[2],c[3])):c[0]<u[0]&&c[1]===u[1]?(n="up",t=e(c[0],c[1]),r=e(u[0]-1,c[3])):c[2]>u[2]&&c[1]===u[1]&&(n="down",t=e(u[2]+1,c[1]),r=e(c[2],c[3])),t&&t.normalize(),r&&r.normalize(),{directionOfDrag:n,startOfDragCoords:t,endOfDragCoords:r});if(p&&m&&null!==p.row&&null!==p.col&&null!==m.row&&null!==m.col&&p.row>-1&&p.col>-1){let e=p.row,t=p.col,r=m.row,n=m.col,o=this.getSelectionData(),i=this.getSelectionData(!0),s=l.clone(),a=this.hot._createCellRange(p,p,m),h=this.hot.runHooks("beforeAutofill",o,s,a,g);if(!1===h)return this.hot.selection.highlight.getFill().clear(),this.hot.render(),!1;let d=h;d=this.#pl(h,d,g,e,r,t,n),d=this.#ph(d,i,{row:e,col:t},{row:r,col:n},g),this.hot.populateFromArray(e,t,d,r,n,`${this.pluginName}.fill`,void 0),this.setSelection(c,s),this.hot.runHooks("afterAutofill",d,s,a,g),this.hot.render()}else this.hot.view.render();return!0}#pl(e,t,r,n,o,i,s){if("up"!==r&&"left"!==r||1===e.length&&0===e[0].length)return t;let a=[];if("up"===r){let t=o-n+1,r=t%e.length;for(let n=0;n<t;n++)a.push(e[(n+(e.length-r))%e.length])}else{let t=s-i+1,r=t%e[0].length;for(let n=0;n<e.length;n++){a.push([]);for(let o=0;o<t;o++)a[n].push(e[n][(o+(e[n].length-r))%e[n].length])}}return a}#ph(e,t,r,n,o){if(!t.some(e=>e.some(e=>tc(e)||Array.isArray(e))))return e;let i=this.#pd(e,t,r,n,o);return i.length?i:e}addRow(){this.hot._registerTimeout(()=>{this.hot.alter("insert_row_below",void 0,1,`${this.pluginName}.fill`),this.addingStarted=!1},200)}addNewRowIfNeeded(){if(!this.hot.selection.highlight.getFill().isEmpty()&&!1===this.addingStarted&&this.autoInsertRow){let e=this.hot.getSelectedRangeLast()?.getBottomEndCorner().row??null,t=this.hot.selection.highlight.getFill().getVisualCorners(),r=this.hot.countRows();null!==e&&e<r-1&&t[2]===r-1&&(this.addingStarted=!0,this.addRow())}}getIndexOfLastAdjacentFilledInRow(e){let t,r=this.hot.getData(),n=this.hot.countRows();for(let o=e[2]+1;o<n;o++){for(let t=e[1];t<=e[3];t++)if(!eP(r[o][t]))return -1;let n=r[o][e[1]-1],i=r[o][e[3]+1];eP(n)&&eP(i)||(t=o)}return t}addSelectionFromStartAreaToSpecificRowIndex(e,t){this.hot.selection.highlight.getFill().clear().add(this.hot._createCellCoords(e[0],e[1])).add(this.hot._createCellCoords(t,e[3])).commit()}setSelection(e,t){let r=Z(e,e=>Math.max(e,0)),n=r[0],o=r[1],i=r[2],s=r[3],a=n,l=o,h=i,d=s;if(t){let{row:e,col:r}=t.getTopStartCorner(),{row:u,col:c}=t.getBottomEndCorner(),g=e??0,p=r??0;a=n<g?i:i>(u??0)||t.from.row===g?n:i,l=o<p?s:s>(c??0)||t.from.col===p?o:s,h=a===n?i:n,d=l===o?s:o}this.hot.selectCell(a,l,h,d,!1,!1)}selectAdjacent(){let e=this.hot.getSelectedRangeLast();if(!e)return!1;let t=e.getTopStartCorner(),r=e.getBottomEndCorner(),n=[t.row??0,t.col??0,r.row??0,r.col??0],o=this.getIndexOfLastAdjacentFilledInRow(n);return -1!==o&&void 0!==o&&(this.addSelectionFromStartAreaToSpecificRowIndex(n,o),!0)}resetSelectionOfDraggedArea(){this.handleDraggedCells=0,this.hot.selection.highlight.getFill().clear()}redrawBorders(e){let t=this.directions,r=this.hot.getSelectedRangeLast();if(!r||!e||null===e.row||null===e.col)return;let n=this.hot._createCellCoords(e.row,e.col),o=r.getBottomEndCorner(),i=r.getTopStartCorner(),s=r.getBottomEndCorner(),a=(n.row??0)<(i.row??0)||(n.row??0)>(s.row??0),l=(n.col??0)<(i.col??0)||(n.col??0)>(s.col??0);r.includes(n)&&(this.#pn=null),"vertical"===this.#pn&&!a&&l?t.includes("horizontal")&&(this.#pn="horizontal"):"horizontal"===this.#pn&&!l&&a&&t.includes("vertical")&&(this.#pn="vertical");let h=o.row,d=o.col;null===this.#pn&&(a&&!l&&t.includes("vertical")?this.#pn="vertical":l&&!a&&t.includes("horizontal")&&(this.#pn="horizontal")),"vertical"===this.#pn&&t.includes("vertical")?(h=n.row??0,d=i.col??0):"horizontal"===this.#pn&&t.includes("horizontal")&&(h=i.row??0,d=n.col??0);let u=this.hot._createCellCoords(h??0,d??0);this.hot.selection.highlight.getFill().clear().add(r.from).add(r.to).add(u).commit(),this.hot.view.render()}getIfMouseWasDraggedOutside(e){let{documentElement:t}=this.hot.rootDocument,r=rE(this.hot.table).top-(this.hot.rootWindow.pageYOffset||t.scrollTop)+rB(this.hot.table),n=rE(this.hot.table).left-(this.hot.rootWindow.pageXOffset||t.scrollLeft)+rF(this.hot.table);return e.clientY>r&&e.clientX<=n}registerEvents(){let{documentElement:e}=this.hot.rootDocument;this.eventManager.addEventListener(e,"mouseup",()=>this.#db()),this.eventManager.addEventListener(e,"mousemove",e=>this.#aV(e))}#pd(e,t,r,n,o){let i=[];for(let o=Math.min(r.row,n.row);o<=Math.max(r.row,n.row);o+=1){i.push([]);for(let s=Math.min(r.col,n.col);s<=Math.max(r.col,n.col);s+=1){let a=this.hot.getSourceDataAtCell(o,s),l=this.hot.getCellMetaTransient(o,s),h=l.source,d=Array.isArray(h)?h[0]:void 0,u=l._complexDataFormat||tc(d)||Array.isArray(d),c=o-Math.min(r.row,n.row),g=s-Math.min(r.col,n.col),p=c%t.length,m=g%t[0].length;tc(a)||Array.isArray(a)||u?i[c][g]=t[p][m]:i[c][g]=e[p][m]}}return i}#ps=()=>{this.selectAdjacent()&&this.fillIn()};#pi=()=>{this.handleDraggedCells=1,this.mouseDownOnCellCorner=!0,this.#pn=null,this.#po=null};#pa(e){this.mouseDownOnCellCorner&&!this.hot.view.isMouseDown()&&this.handleDraggedCells&&(this.handleDraggedCells+=1,this.hot.selection.highlight.getFill().isEmpty()&&this.redrawBorders(e),this.addNewRowIfNeeded())}#db(){this.handleDraggedCells&&(this.handleDraggedCells>1&&this.fillIn(),this.handleDraggedCells=0,this.mouseDownOnCellCorner=!1,this.#pn=null)}#aV(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(this.mouseDownOnCellCorner){let{clientX:r,clientY:n}=e,o=pf(this.hot,r,n),i=this.hot.getSelectedRangeLast();this.#po={clientX:r,clientY:n},t&&this.handleDraggedCells>0&&i&&!i.includes(o)&&(this.handleDraggedCells+=1),this.redrawBorders(o)}let r=this.getIfMouseWasDraggedOutside(e);!1===this.addingStarted&&this.handleDraggedCells>0&&r?(this.mouseDragOutside=!0,this.addingStarted=!0):this.mouseDragOutside=!1,this.mouseDragOutside&&this.autoInsertRow&&this.addRow()}#aB=()=>{this.mouseDownOnCellCorner&&this.#po&&this.#aV(this.#po,!1)};destroy(){super.destroy()}}),oY(pv),oY(class e extends pa{static get PLUGIN_KEY(){return pT}static get PLUGIN_PRIORITY(){return 210}headerIndexes=null;isEnabled(){return!!this.hot.getSettings()[pT]}enablePlugin(){if(this.enabled)return;let e=pA.get(this.getSetting())??pA.get("loose");e&&(this.headerIndexes=this.hot.rowIndexMapper.registerMap("bindRowsWithHeaders",new e),this.addHook("modifyRowHeader",this.#s5),super.enablePlugin())}disablePlugin(){this.hot.rowIndexMapper.unregisterMap("bindRowsWithHeaders"),super.disablePlugin()}#s5=e=>this.headerIndexes.getValueAtIndex(this.hot.toPhysicalRow(e));destroy(){super.destroy()}}),oY(class e extends pa{static get PLUGIN_KEY(){return pM}static get PLUGIN_PRIORITY(){return 290}static get PLUGIN_DEPS(){return["plugin:NestedHeaders"]}static get SETTING_KEYS(){return[pM,...pI]}nestedHeadersPlugin=null;headerStateManager=null;#pu=null;#pc=null;isEnabled(){return!!this.hot.getSettings()[pM]}enablePlugin(){if(this.enabled)return;let{nestedHeaders:e}=this.hot.getSettings();e||tQ("You need to configure the Nested Headers plugin in order to use collapsible headers."),this.pluginName&&(this.#pu=this.hot.columnIndexMapper.createAndRegisterIndexMap(this.pluginName,"hiding")),this.#pc=this.hot.columnIndexMapper.createAndRegisterIndexMap(pN,"hiding"),this.nestedHeadersPlugin=this.hot.getPlugin("nestedHeaders"),this.headerStateManager=this.nestedHeadersPlugin.getStateManager(),this.addHook("init",this.#oz),this.addHook("afterLoadData",this.#oP),this.addHook("afterGetColHeader",this.#o4),this.addHook("beforeOnCellMouseDown",this.#o9),this.addHook("afterCreateCol",this.#pg),this.addHook("afterRemoveCol",this.#pg),this.addHook("beforeColumnMove",this.#sM),this.addHook("afterColumnMove",this.#pg),this.registerShortcuts(),super.enablePlugin(),this.updatePlugin()}updatePlugin(){if(this.hot.view){if(!this.nestedHeadersPlugin?.detectedOverlappedHeaders){let{collapsibleColumns:e}=this.hot.getSettings();"boolean"==typeof e?this.headerStateManager?.mapState(e=>({collapsible:Number(e.origColspan)>1})):Array.isArray(e)&&(this.headerStateManager?.mapState(()=>({collapsible:!1})),this.headerStateManager?.mergeStateWith(e))}this.#pp(),super.updatePlugin()}}disablePlugin(){this.pluginName&&this.hot.columnIndexMapper.unregisterMap(this.pluginName),this.hot.columnIndexMapper.unregisterMap(pN),this.#pu=null,this.#pc=null,this.nestedHeadersPlugin=null,this.unregisterShortcuts(),this.clearButtons(),super.disablePlugin()}registerShortcuts(){this.hot.getShortcutManager().getContext("grid")?.addShortcut({keys:[["Enter"]],callback:()=>{let e=this.hot.getSelectedRangeActive();if(!e)return;let{row:t,col:r}=e.highlight;if(null===t||null===r)return;let{collapsible:n,isCollapsed:o,columnIndex:i}=this.headerStateManager?.getHeaderTreeNodeData(t,r)??{collapsible:!1,isCollapsed:!1,columnIndex:0,headerLevel:0};if(n)return o?this.expandSection({row:t,col:i}):this.collapseSection({row:t,col:i}),!1},runOnlyIf:()=>!!(this.hot.getSelectedRangeActive()?.isSingle()&&this.hot.getSelectedRangeActive()?.highlight.isHeader()),group:pM,relativeToGroup:dY,position:"before"})}unregisterShortcuts(){this.hot.getShortcutManager().getContext("grid")?.removeShortcutsByGroup(pM)}clearButtons(){if(!this.hot.view)return;let e=this.hot.view._wt.getSetting("columnHeaders").length,t=this.hot.view._wt.wtTable.THEAD,r=this.hot.view._wt.wtOverlays.topOverlay?.clone?.wtTable.THEAD??null,n=this.hot.view._wt.wtOverlays.topInlineStartCornerOverlay?this.hot.view._wt.wtOverlays.topInlineStartCornerOverlay.clone?.wtTable.THEAD??null:null,o=function(e){e&&e.parentNode&&e.parentNode.removeChild(e)};t&&r&&oA(0,e-1,e=>{let i=t.childNodes[e],s=r.childNodes[e],a=n?n.childNodes[e]:null;oA(0,i.childNodes.length-1,e=>{let t=i.childNodes[e].querySelector(`.${px}`);o(t),s&&s.childNodes[e]&&o(t=s.childNodes[e].querySelector(`.${px}`)),n&&a&&a.childNodes[e]&&o(t=a.childNodes[e].querySelector(`.${px}`))})})}expandSection(e){this.toggleCollapsibleSection([e],"expand")}collapseSection(e){this.toggleCollapsibleSection([e],"collapse")}toggleAllCollapsibleSections(e){let t=this.headerStateManager?.mapNodes(t=>{let{collapsible:r,origColspan:n,headerLevel:o,columnIndex:i,isCollapsed:s}=t;if(!0===r&&Number(n)>1&&(s&&"expand"===e||!s&&"collapse"===e))return{row:this.headerStateManager?.levelToRowCoords(Number(o))??0,col:i}});this.toggleCollapsibleSection(t,e)}collapseAll(){this.toggleAllCollapsibleSections("collapse")}expandAll(){this.toggleAllCollapsibleSections("expand")}toggleCollapsibleSection(e,t){if(void 0!==t&&pO.has(t)||tr(`Unsupported action is passed (${t}).`),!Array.isArray(e))return;let r=Q(e,e=>{let{row:t}=e;return t<0}),n=this.#pm(r,t),o=[],i=[],s=this.headerStateManager?.getVisibleWhenHiddenColumns()??[];n&&J(r,e=>{let{row:r,col:n}=e,{affectedColumns:s,rollbackModification:a}=this.headerStateManager?.triggerNodeModification(t,r,n)??{colspanCompensation:0,affectedColumns:[],rollbackModification:()=>{}};o.push(a),s.length>0&&i.push(...s)});let a=this.getCollapsedColumns(),l=[];"collapse"===t?l=es([...a,...i]):"expand"===t&&(l=Q(a,e=>!i.includes(e)));let h=pO.get(t);if(!1===this.hot.runHooks(h.beforeHook,a,l,n))return void J(o,e=>{e()});this.hot.batchExecution(()=>{J(i,e=>{this.#pu?.setValueAtIndex(this.hot.toPhysicalColumn(e),h.hideColumn)})},!0);let d=this.headerStateManager?.getVisibleWhenHiddenColumns()??[],u=ea(d,s),c=u.length>0||d.length!==s.length;c&&this.#pp(d);let g=this.getCollapsedColumns().length!==a.length||c,p="collapse"===t?es([...i,...u]):u;g&&p.length>0&&this.#pf(p),this.hot.runHooks(h.afterHook,a,l,n,g),this.hot.view.adjustElementsSize(),this.hot.render()}#pm(e,t){if(0===e.length)return!1;let r=!0;return J(e,e=>{let{row:n,col:o}=e,{collapsible:i,isCollapsed:s}=this.headerStateManager?.getHeaderTreeNodeData(n,o)??{};if(!i||s&&"collapse"===t||!s&&"expand"===t)return r=!1,!1}),r}#pf(e){let t=this.hot.getSelectedRangeActive();if(!t)return;let{row:r,col:n}=t.highlight;if(null!==r&&null!==n&&(this.hot.rowIndexMapper.isHidden(r)||this.hot.columnIndexMapper.isHidden(n))&&e.includes(n)){let e=r>=0?this.hot.rowIndexMapper.getNearestNotHiddenIndex(r,1,!0):r,t=n>=0?this.hot.columnIndexMapper.getNearestNotHiddenIndex(n,1,!0):n;null!==e&&null!==t&&this.hot.selectCell(e,t)}}getCollapsedColumns(){return this.#pu?.getHiddenIndexes()??[]}#pp(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.headerStateManager?.getVisibleWhenHiddenColumns()??[];if(!this.#pc)return;let t=this.#pc,r=Z(e,e=>this.hot.toPhysicalColumn(e)),n=t.getHiddenIndexes();(r.length!==n.length||0!==ea(r,n).length)&&this.hot.batchExecution(()=>{t.clear(),J(r,e=>{t.setValueAtIndex(e,!0)})},!0)}#pg=()=>{this.#pp()};#sM=(e,t,r,n)=>{let o=this.headerStateManager;if(!1===n||!o)return;let i=new Map(this.#pb(e,t).map((e,t)=>[e,t]));o.getCollapsedGroups().forEach(e=>{let{headerLevel:t,columnIndex:r,origColspan:n}=e;if(this.#pC(r,n,i)){let e=o.levelToRowCoords(t);null!==e&&this.toggleCollapsibleSection([{row:e,col:r}],"expand")}})};#pb(e,t){let r=new Set(e),n=[];for(let e=0,t=this.hot.countCols();e<t;e++)r.has(e)||n.push(e);return[...n.slice(0,t),...e,...n.slice(t)]}#pC(e,t,r){let n=1/0,o=-1/0,i=0;for(let s=e;s<e+t;s++){let e=r.get(s);void 0!==e&&(n=Math.min(n,e),o=Math.max(o,e),i+=1)}return i>0&&o-n!=i-1}#o4=(e,t,r)=>{let{collapsible:n,origColspan:o,isCollapsed:i}=this.headerStateManager?.getHeaderSettings(r,e)??{},s=!0===n&&(o??0)>1&&e>=(this.hot.getSettings().fixedColumnsStart??0),a=this.hot.getSettings().ariaTags,l=t.querySelector(`.${px}`);if(rg(t,[U("")[0]]),s){l||(rd(l=this.hot.rootDocument.createElement("div"),px),t.querySelector("div:first-child")?.appendChild(l));let e=l;ru(e,["collapsed","expanded"]),i?(rd(e,"collapsed"),rS(e,"+"),a&&rc(t,...U(!1))):(rd(e,"expanded"),rS(e,"-"),a&&rc(t,...U(!0))),a&&rc(e,..._())}else l?.remove()};#o9=(e,t)=>{let r=t4(e);rh(r,px)&&(rh(r,"expanded")?(this.eventManager.fireEvent(r,"mouseup"),this.toggleCollapsibleSection([t],"collapse")):rh(r,"collapsed")&&(this.eventManager.fireEvent(r,"mouseup"),this.toggleCollapsibleSection([t],"expand")),nR(e))};#oz=()=>{this.updatePlugin()};#oP=(e,t)=>{t||this.updatePlugin()};destroy(){this.#pu=null,this.#pc=null,super.destroy()}}),oY(p8),oY(class e extends pa{static get PLUGIN_KEY(){return mr}static get PLUGIN_PRIORITY(){return 220}endpoints=null;#py=!1;isEnabled(){return!!this.hot.getSettings()[mr]}enablePlugin(){this.enabled||(this.settings=this.hot.getSettings()[mr],this.endpoints=new mt(this,this.settings),this.addHook("afterInit",this.#sf),this.addHook("afterChange",this.#of),this.addHook("afterUpdateSettings",this.#gN),this.addHook("afterLoadData",this.#oP),this.addHook("afterUpdateData",this.#l9),this.addHook("beforeCreateRow",(e,t)=>{this.endpoints.resetSetupBeforeStructureAlteration("insert_row",e,t)}),this.addHook("beforeCreateCol",(e,t)=>{this.endpoints.resetSetupBeforeStructureAlteration("insert_col",e,t)}),this.addHook("beforeRemoveRow",(e,t)=>{this.endpoints.resetSetupBeforeStructureAlteration("remove_row",e,t)}),this.addHook("beforeRemoveCol",(e,t)=>{this.endpoints.resetSetupBeforeStructureAlteration("remove_col",e,t)}),this.addHook("afterCreateRow",(e,t,r)=>{this.endpoints.resetSetupAfterStructureAlteration("insert_row",e,t,null,r)}),this.addHook("afterCreateCol",(e,t,r)=>{this.endpoints.resetSetupAfterStructureAlteration("insert_col",e,t,null,r)}),this.addHook("afterRemoveRow",(e,t,r,n)=>this.endpoints.resetSetupAfterStructureAlteration("remove_row",e,t,r,n)),this.addHook("afterRemoveCol",(e,t,r,n)=>this.endpoints.resetSetupAfterStructureAlteration("remove_col",e,t,r,n)),this.addHook("afterRowMove",this.#sA),this.addHook("afterFormulasValuesUpdate",this.#oV),super.enablePlugin())}disablePlugin(){this.endpoints=null,this.settings=null,this.currentEndpoint=null,super.disablePlugin()}updatePlugin(){this.disablePlugin(),this.enablePlugin(),this.endpoints.initEndpoints(),super.updatePlugin()}calculate(e){switch(e.type.toLowerCase()){case"sum":e.result=this.calculateSum(e);break;case"min":case"max":e.result=this.calculateMinMax(e,e.type);break;case"count":e.result=this.countEntries(e);break;case"average":e.result=this.calculateAverage(e);break;case"custom":e.result=e.customFunction.call(this,e)}}calculateSum(e){let t=0;for(let r of e.ranges)t+=this.getPartialSum(r,e.sourceColumn);return t}getPartialSum(e,t){let r=0,n=e[1]||e[0],o=null,i=0;do{let e=this.getCellValue(n,t);if(null!==(o=me(e)?null:Number(e))){let e=(`${o}`.split(".")[1]||[]).length||1;e>i&&(i=e)}r+=o??0,n-=1}while(n>=e[0]);return Math.round(r*10**i)/10**i}calculateMinMax(e,t){let r=null;for(let n of e.ranges){let o=this.getPartialMinMax(n,e.sourceColumn,t);if(null===r&&null!==o&&(r=o),null!==o)switch(t){case"min":r=Math.min(r,o);break;case"max":r=Math.max(r,o)}}return null===r?"Not enough data":r}getPartialMinMax(e,t,r){let n,o=null,i=e[1]||e[0];do{let e=this.getCellValue(i,t);if(n=me(e)?null:Number(e),null===o)o=n;else if(null!==n)switch(r){case"min":o=Math.min(o,n);break;case"max":o=Math.max(o,n)}i-=1}while(i>=e[0]);return o}countEmpty(e,t){let r,n=0,o=e[1]||e[0];do null===(r=me(r=this.getCellValue(o,t))?null:r)&&(n+=1),o-=1;while(o>=e[0]);return n}countEntries(e){let t=0;for(let r of e.ranges){let n=void 0===r[1]?1:r[1]-r[0]+1,o=this.countEmpty(r,e.sourceColumn);t+=n,t-=o}return t}calculateAverage(e){return this.calculateSum(e)/this.countEntries(e)}getCellValue(e,t){let r=this.hot.toVisualRow(e),n=null!==r?this.hot.getDataAtCell(r,t):this.hot.getSourceDataAtCell(e,t);return(null!==r?(this.hot.getCellMetaTransient(r,t).className||"").indexOf("columnSummaryResult")>-1:this.endpoints.isSummaryDestination(e,t))?null:(this.endpoints.currentEndpoint.forceNumeric&&("string"==typeof n&&(n=n.replace(/,/,".")),n=parseFloat(n)),isNaN(Number(n))&&!this.endpoints.currentEndpoint.suppressDataTypeErrors&&tr(ec`ColumnSummary plugin: cell at (${e}, ${t}) is not in a\x20
          numeric format. Cannot do the calculation.`),n)}#sf=()=>{this.endpoints.initEndpoints()};#gN=e=>{void 0!==e.columns&&this.endpoints.refreshCellMetas()};#of=(e,t)=>{e&&"ColumnSummary.reset"!==t&&"ColumnSummary.set"!==t&&"loadData"!==t&&this.endpoints.refreshChangedEndpoints(e)};#oP=(e,t)=>{t||this.endpoints.refreshAllEndpoints()};#l9=(e,t)=>{t||this.endpoints.refreshAllEndpoints()};#oV=e=>{if(this.#py||!this.endpoints||!e?.length)return;let t=this.hot.getPlugin("formulas");if(!t?.enabled)return;let r=t.sheetId,n=new Set;if(e.forEach(e=>{e?.address?.sheet===r&&n.add(e.address.col)}),0===n.size)return;let o=new Set;if(this.endpoints.getAllEndpoints().forEach(e=>{let r=t.columnAxisSyncer.getHfIndexFromVisualIndex(e.sourceColumn??0);n.has(r)&&o.add(e.sourceColumn??0)}),0!==o.size){this.#py=!0;try{this.endpoints.refreshEndpointsBySourceColumns(o)}finally{this.#py=!1}}};#sA=(e,t)=>{this.endpoints.resetSetupBeforeStructureAlteration("move_row",e[0],e.length),this.endpoints.resetSetupAfterStructureAlteration("move_row",t,e.length,e,this.pluginName)}}),oY(class e extends pa{static get PLUGIN_KEY(){return mc}static get PLUGIN_PRIORITY(){return 60}static get DEFAULT_SETTINGS(){return{displayDelay:250}}range={};#ic=null;#pw=null;#pS=!1;#pv=!1;#pR=!1;#pE=null;#pT="";isEnabled(){return!!this.hot.getSettings()[mc]}enablePlugin(){this.enabled||(this.#ic||(this.#ic=new mo(this.hot.rootDocument,this.hot.isRtl(),this.hot.rootPortalElement),this.#ic?.addLocalHook("resize",(e,t)=>this.#pA(e,t)),this.hot.addHook("afterSetTheme",(e,t)=>{t||this.hide()})),this.#pw||(this.#pw=new mi(this.getSetting("displayDelay"))),this.addHook("afterContextMenuDefaultOptions",e=>this.addToContextMenu(e)),this.addHook("afterRenderer",(e,t,r,n,o,i)=>this.#hK(e,i)),this.addHook("afterScroll",this.#aB),this.addHook("afterBeginEditing",()=>this.hide()),this.addHook("afterDocumentKeyDown",this.#h),this.addHook("beforeCompositionStart",this.#h),this.#pw?.addLocalHook("hide",()=>this.hide()),this.#pw?.addLocalHook("show",(e,t)=>this.showAtCell(e,t)),this.registerShortcuts(),this.registerListeners(),super.enablePlugin())}updatePlugin(){this.#pw?.updateDelay(this.getSetting("displayDelay")),super.updatePlugin()}disablePlugin(){this.unregisterShortcuts(),super.disablePlugin()}registerShortcuts(){let e=this.hot.getShortcutManager(),t=e.getContext("grid"),r=e.addContext(mb);t?.addShortcut({keys:[["Control","Alt","M"]],callback:()=>{let t=this.hot.getSelectedRangeActive();this.#pv=!0,this.hot.scrollToFocusedCell(()=>{t&&this.setRange(t),this.show(),this.focusEditor(),e.setActiveContextName(mb),this.hot._registerTimeout(()=>{this.#pv=!1})})},stopPropagation:!0,runOnlyIf:()=>!!this.hot.getSelectedRangeActive()?.highlight.isCell(),group:mc}),r.addShortcut({keys:[["Escape"]],callback:()=>{this.#ic?.setValue(this.#pT),this.hide(),e.setActiveContextName("grid")},runOnlyIf:()=>!!(this.#ic?.isVisible()&&this.#ic?.isFocused()),group:mc}),r.addShortcut({keys:[["Control/Meta","Enter"]],callback:()=>{this.hide(),e.setActiveContextName("grid")},runOnlyIf:()=>!!(this.#ic?.isVisible()&&this.#ic?.isFocused()),group:mc}),r.addShortcut({keys:[["Shift","Tab"],["Tab"]],forwardToContext:e.getContext("grid"),callback:()=>{this.#pR=!0,this.#ic?.setValue(this.#ic?.getValue()),this.setComment(),this.hide(),e.setActiveContextName("grid")},group:mc})}unregisterShortcuts(){this.hot.getShortcutManager().getContext("grid")?.removeShortcutsByGroup(mc)}registerListeners(){let{rootDocument:e}=this.hot,t=this.getEditorInputElement();this.eventManager.addEventListener(e,"mouseover",this.#dF),this.eventManager.addEventListener(e,"mousedown",this.#dB),this.eventManager.addEventListener(e,"mouseup",()=>this.#db()),t&&(this.eventManager.addEventListener(t,"focus",()=>this.#pM()),this.eventManager.addEventListener(t,"blur",()=>this.#pI()),this.eventManager.addEventListener(t,"keydown",this.#px));let r=this.getEditorInputElement();r&&this.eventManager.addEventListener(r,"mousedown",this.#pN)}setRange(e){this.range=e}clearRange(){this.range={}}targetIsCellWithComment(e){let t=re(t4(e),["TD"]);return!!(t&&rh(t,"htCommentCell")&&re(t,[this.hot.rootElement]))}targetIsCommentTextArea(e){return this.getEditorInputElement()===e.target}setComment(e){this.range.from||tr('Before using this method, first set cell range (hot.getPlugin("comment").setRange())');let t=this.#ic?.getValue(),r="";null!=e?r=e:null!=t&&(r=t);let{row:n,col:o}=this.#pO();this.updateCommentMeta(n,o,{[mp]:r}),this.hot.render()}setCommentAtCell(e,t,r){this.setRange({from:this.hot._createCellCoords(e,t)}),this.setComment(r)}removeComment(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];this.range.from||tr('Before using this method, first set cell range (hot.getPlugin("comment").setRange())');let{row:t,col:r}=this.#pO();this.hot.setCellMeta(t,r,mg,void 0),e&&this.hot.render(),this.hide()}removeCommentAtCell(e,t){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2];this.setRange({from:this.hot._createCellCoords(e,t)}),this.removeComment(r)}getComment(){let{row:e,col:t}=this.#pO();return this.getCommentMeta(e,t,mp)}getCommentAtCell(e,t){return this.getCommentMeta(e,t,mp)}show(){this.range.from||tr('Before using this method, first set cell range (hot.getPlugin("comment").setRange())');let{row:e,col:t}=this.#pO();if(e<0||e>this.hot.countRows()-1||t<0||t>this.hot.countCols()-1)return!1;let r=this.hot.getCellMeta(e,t);this.#pw?.cancelHiding();let n=r[mg];return this.#ic?.setValue((n?n[mp]:null)??""),this.#ic?.show(),this.refreshEditor(!0),!0}showAtCell(e,t){return this.setRange({from:this.hot._createCellCoords(e,t)}),this.show()}hide(){this.#ic?.hide()}refreshEditor(){var e;let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!t&&(!this.range.from||!this.#ic?.isVisible())||!this.#ic)return;let{rowIndexMapper:r,columnIndexMapper:n}=this.hot,{row:o,col:i}=this.#pO(),s=r.getRenderableFromVisualIndex(o),a=n.getRenderableFromVisualIndex(i),l=null===s;if(this.#ic.setPosition(0,0),null===s){let e=r.getNearestNotHiddenIndex(o,-1);s=null!==e?r.getRenderableFromVisualIndex(e):null}if(null===a){let e=n.getNearestNotHiddenIndex(i,-1);a=null!==e?n.getRenderableFromVisualIndex(e):null}let h=null===s,d=null===a;s=s??0,a=a??0;let{rootWindow:u,view:{_wt:c}}=this.hot,{wtTable:g}=c,p=c.getCell({row:s,col:a},!0),m=this.hot.getCellMeta(o,i).colspan??1,f=this.getCommentMeta(o,i,mm);f?this.#ic.setSize(f.width,f.height):this.#ic.resetSize();let b=d?0:(e=g.getColumnWidth(a),m>1?rF(p):e),C=l&&!h?rB(p):0,{left:y,top:w,width:S,height:v}=p.getBoundingClientRect(),{width:R,height:E}=this.#ic.getSize(),{innerWidth:T,innerHeight:A}=this.hot.rootWindow,M=this.hot.rootDocument.documentElement,I=rX(this.hot.rootDocument),x=rQ(this.hot.rootWindow)?I:0,N=rZ(this.hot.rootWindow)?I:0,O=y+u.scrollX+b-(m>1),k=w+u.scrollY+C;this.hot.isRtl()&&(O-=R+b),this.hot.isLtr()&&y+S+R>T-x?O=y+u.scrollX-R-1:this.hot.isRtl()&&O<-(M.scrollWidth-M.clientWidth)&&(O=y+u.scrollX+b+1),w+E>A-N&&(k-=E-v+1);let H=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8,{innerWidth:n,innerHeight:o,verticalScrollbarWidth:i=0,horizontalScrollbarWidth:s=0}=t,a=Math.max(0,n-i-2*r),l=Math.max(0,o-s-2*r);return{width:Math.min(e.width,a),height:Math.min(e.height,l)}}({width:R,height:E},{innerWidth:T,innerHeight:A,verticalScrollbarWidth:x,horizontalScrollbarWidth:N});(H.width!==R||H.height!==E)&&this.#ic.setSize(H.width,H.height);let _=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8,{innerWidth:n,innerHeight:o,scrollX:i,scrollY:s,verticalScrollbarWidth:a=0,horizontalScrollbarWidth:l=0}=t,h=i+n-a,d=s+o-l,{x:u,y:c}=e;return u<i?u=i+r:u+e.width>h&&(u=Math.max(i+r,h-e.width-r)),c<s?c=s+r:c+e.height>d&&(c=Math.max(s+r,d-e.height-r)),{x:u,y:c}}({x:O,y:k,width:H.width,height:H.height},{innerWidth:T,innerHeight:A,scrollX:u.scrollX,scrollY:u.scrollY,verticalScrollbarWidth:x,horizontalScrollbarWidth:N});this.#ic.setPosition(_.x,_.y),this.#ic.setReadOnlyState(this.getCommentMeta(o,i,mf)??!1),this.#ic.observeSize()}focusEditor(){this.#ic?.focus()}updateCommentMeta(e,t,r){let n,o=this.hot.getCellMeta(e,t)[mg];o?ts(n=ta(o),r):n=r,this.hot.setCellMeta(e,t,mg,n)}getCommentMeta(e,t,r){let n=this.hot.getCellMeta(e,t)[mg];if(n)return n[r]}#dB=e=>{if(this.hot.view&&this.hot.view._wt&&!this.#pS&&!this.targetIsCommentTextArea(e)){let t=re(t4(e),["TD"]),r=null;t&&(r=this.hot.getCoords(t)),(!t||this.range.from&&r&&(this.range.from.row!==r.row||this.range.from.col!==r.col))&&this.hide()}};#pN=e=>{e.stopPropagation()};#dF=e=>{let{rootDocument:t}=this.hot,r=t4(e);if(!(this.#pS||this.#ic?.isFocused()||rh(r,"wtBorder"))&&this.#pE!==r&&this.#ic)if(this.#pE=t.elementFromPoint(e.clientX,e.clientY),this.targetIsCellWithComment(e)){let e=this.hot.getCoords(r);if(e){let t=this.hot._createCellRange(e);this.#pw?.show(t)}}else rn(r,t)&&!this.targetIsCommentTextArea(e)&&this.#pw?.hide()};#db(){this.#pS=!1}#hK(e,t){let r=t[mg];if(null!==r&&"object"==typeof r&&r[mp]){let r=t.commentedCellClassName;"string"==typeof r&&rd(e,r)}}#pI(){if(this.#pR){this.#pR=!1;return}this.#pT="",this.hot.getShortcutManager().setActiveContextName("grid"),this.setComment()}#pM(){this.#pT=this.getComment()??"",this.hot.listen(),this.hot.getShortcutManager().setActiveContextName(mb)}#px=e=>{this.#ic?.isVisible()&&(this.hot.getShortcutManager().hasEventShortcut(mb,e)||e.stopPropagation())};#pA(e,t){let{row:r,col:n}=this.#pO();this.updateCommentMeta(r,n,{[mm]:{width:e,height:t}})}#h=e=>{this.#ic?.isFocused()&&nR(e)};#aB=()=>{this.#pv||this.hide()};addToContextMenu(e){var t,r,n;e.items.push({name:ms},(t=this,{key:"commentsAddEdit",name(){let e=this.getSelectedRangeActive()?.highlight;return e?.isCell()&&null!==e.row&&null!==e.col&&t.getCommentAtCell(e.row,e.col)?this.getTranslatedPhrase(ls):this.getTranslatedPhrase(li)},callback(){let e=this.getSelectedRangeActive();e&&t.setRange({from:e.from,to:e.to}),t.show(),t.focusEditor()},disabled(){let e=this.getSelectedRangeActive();return!!(!e||e.highlight.isHeader()||this.selection.isEntireRowSelected()&&this.selection.isEntireColumnSelected())||0===this.countRenderedRows()||0===this.countRenderedCols()}}),(r=this,{key:"commentsRemove",name(){return this.getTranslatedPhrase(la)},callback(){let e=this.getSelectedRangeActive();e&&(e.forAll((e,t)=>{e>=0&&t>=0&&r.removeCommentAtCell(e,t,!1)}),this.render())},disabled(){let e=this.getSelectedRangeActive();return!!(!e||e.highlight.isHeader()||this.selection.isEntireRowSelected()&&this.selection.isEntireColumnSelected())||0===this.countRenderedRows()||0===this.countRenderedCols()}}),(n=this,{key:"commentsReadOnly",name(){let e=this.getTranslatedPhrase(ll);return md(this.getSelectedRange()??[],(e,t)=>!!n.getCommentMeta(e,t,mf))?mh(e):e},callback(){let e=this.getSelectedRangeActive();e&&e.forAll((e,t)=>{if(e>=0&&t>=0){let r=!!n.getCommentMeta(e,t,mf);n.updateCommentMeta(e,t,{[mf]:!r})}})},disabled(){let e=this.getSelectedRangeActive();return!!(!e||e.highlight.isHeader()||!n.getCommentAtCell(e.highlight.row,e.highlight.col)||this.selection.isEntireRowSelected()&&this.selection.isEntireColumnSelected())||0===this.countRenderedRows()||0===this.countRenderedCols()}}))}getEditorInputElement(){return this.#ic?.getInputElement()??null}#pO(){if(this.range instanceof i2){let{row:e,col:t}=this.range.highlight;return{row:e??0,col:t??0}}return{row:this.range.from.row??0,col:this.range.from.col??0}}destroy(){this.#ic?.destroy(),this.#pw?.destroy(),super.destroy()}}),oY(mY),oY(m1),oY(fl),oY(fx),oY(fH),oY(fD),oY(class e extends pa{static get PLUGIN_KEY(){return f5}static get PLUGIN_PRIORITY(){return 240}static get SETTING_KEYS(){return[f5]}isEnabled(){return!0}enablePlugin(){this.enabled||(this.addHook("afterContextMenuDefaultOptions",this.#iJ),super.enablePlugin())}disablePlugin(){super.disablePlugin()}#iJ=e=>{var t;"object"==typeof e&&null!==e&&e.items.push({name:"---------"},(t=this,{key:"export_file",name(){return this.getTranslatedPhrase(a7)},hidden(){return void 0===this.getSettings()[f5]},submenu:{items:[{key:"export_file:csv",name(){return this.getTranslatedPhrase(a8)},callback(){t.downloadFile("csv",f6(this))},disabled:!1},{key:"export_file:xlsx",name(){return this.getTranslatedPhrase(le)},callback(){t.downloadFileAsync("xlsx",f6(this)).catch(e=>{t3("ExportFile: XLSX export failed.",e)})},hidden:()=>!t.supportsExportFormat("xlsx")}]}}))};exportAsString(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this._createTypeFormatter(e,t);return r.binary&&tr(`Export format type "${e}" cannot be exported as a string (binary format).`),r.export()}exportAsBlob(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this._createTypeFormatter(e,t);return r.binary&&tr(`exportAsBlob() does not support binary formats such as "${e}". Use exportAsBlobAsync() instead.`),this._createBlob(r)}async exportAsBlobAsync(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this._createBlob(this._createTypeFormatter(e,t))}downloadFile(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this._createTypeFormatter(e,t);r.binary&&tr(`downloadFile() does not support binary formats such as "${e}". Use downloadFileAsync() instead.`);let n=`${r.options.filename}.${r.options.fileExtension}`;this.#pk(this._createBlob(r),n)}async downloadFileAsync(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this._createTypeFormatter(e,t),n=this.hot.getPlugin("dialog"),o=n?.isEnabled(),{rootWindow:i}=this.hot,s=`${r.options.filename}.${r.options.fileExtension}`,a=async()=>{let e=await Promise.resolve(this._createBlob(r));this.#pk(e,s)};if(o&&r.binary){n.show({content:function(e){let{fragment:t}=eg`
    <div class="${ga}__content">
      <i class="${ga}__icon">
        <svg class="${ga}__icon-svg"
          xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 16 16">
          <path stroke="currentColor" stroke-width="2" d="M15 8a7 7 0 1 1-3.5-6.062"></path>
        </svg>
      </i>
      <div class="${ga}__text">
        <h2 class="${ga}__title">${op(e)}</h2>
      </div>
    </div>
  `;return t}(this.hot.getTranslatedPhrase(hw)),customClassName:ga,background:"semi-transparent",closable:!1,animation:!1}),await new Promise(e=>{i.requestAnimationFrame(()=>{i.requestAnimationFrame(e)})});try{await a()}finally{n.hide()}return}await a()}#pk(e,t){let{rootDocument:r,rootWindow:n}=this.hot,o=n.URL||n.webkitURL,i=o.createObjectURL(e),s=r.createElement("a");s.style.display="none",s.setAttribute("href",i),s.setAttribute("download",t),r.body.appendChild(s),s.dispatchEvent(new MouseEvent("click")),r.body.removeChild(s),this.hot._registerTimeout(()=>{o.revokeObjectURL(i)},100)}supportsExportFormat(e){if(!f3[e])return!1;if("xlsx"===e){let e=f4(this.hot.getSettings()[f5]);return void 0!==e&&tc(e.engines)&&!!e.engines?.xlsx}return!0}_createTypeFormatter(e){var t;let r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};f3[e]||tr(`Export format type "${e}" is not supported.`);let o=f4(this.hot.getSettings()[f5]),i=o&&tc(o.engines)?o.engines:void 0,s=i?.[e],a=void 0!==s?{engine:s,...n}:n,l=(t=new fB(this.hot),"function"==typeof(r=f3[e])?new r(t,a):null);return null===l&&tr(`Export format type "${e}" is not supported.`),l}_createBlob(e){"u"<typeof Blob&&tr("Blob is not available in this environment.");let t=e.export(),{mimeType:r,encoding:n}=e.options;return t instanceof Promise?t.then(e=>new Blob([e],{type:r})):new Blob([t],{type:`${r};charset=${n}`})}}),oY(Cl),oY(CP),oY(class e extends pa{static get PLUGIN_KEY(){return CD}static get PLUGIN_PRIORITY(){return 310}static get DEFAULT_SETTINGS(){return{copyPasteEnabled:!0,indicators:!1,columns:[]}}#pH=null;isEnabled(){return!!this.hot.getSettings()[CD]}enablePlugin(){this.enabled||(this.#pH=this.hot.columnIndexMapper.createAndRegisterIndexMap(this.pluginName??"","hiding"),this.#pH.addLocalHook("init",()=>this.#dL()),this.hot.columnIndexMapper.getNumberOfIndexes()>0&&this.#dL(),this.addHook("afterContextMenuDefaultOptions",this.#iJ),this.addHook("afterGetCellMeta",this.#uE),this.addHook("modifyColWidth",this.#dP,2),this.addHook("afterGetColHeader",this.#o4),this.addHook("modifyCopyableRange",this.#p_),super.enablePlugin())}updatePlugin(){this.disablePlugin(),this.enablePlugin(),super.updatePlugin()}disablePlugin(){super.disablePlugin(),this.hot.columnIndexMapper.unregisterMap(this.pluginName??""),this.resetCellsMeta()}showColumns(e){let t=this.getHiddenColumns(),r=this.isValidConfig(e),n=t,o=this.#pH.getValues().slice(),i=e.length>0;r&&i&&(J(e.map(e=>this.hot.toPhysicalColumn(e)),e=>{o[e]=!1}),n=X(o,(e,t,r)=>(t&&e.push(this.hot.toVisualColumn(r)),e),[])),!1!==this.hot.runHooks("beforeUnhideColumns",t,n,r&&i)&&(r&&i&&this.#pH.setValues(o),this.hot.view.adjustElementsSize(),this.hot.runHooks("afterUnhideColumns",t,n,r&&i,r&&n.length<t.length))}showColumn(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];this.showColumns(t)}hideColumns(e){let t=this.getHiddenColumns(),r=this.isValidConfig(e),n=t;r&&(n=Array.from(new Set(t.concat(e)))),!1!==this.hot.runHooks("beforeHideColumns",t,n,r)&&(r&&this.hot.batchExecution(()=>{J(e,e=>{this.#pH.setValueAtIndex(this.hot.toPhysicalColumn(e),!0)})},!0),this.hot.runHooks("afterHideColumns",t,n,r,r&&n.length>t.length))}hideColumn(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];this.hideColumns(t)}getHiddenColumns(){return Z(this.#pH.getHiddenIndexes(),e=>this.hot.toVisualColumn(e))}isHidden(e){return this.#pH.getValueAtIndex(this.hot.toPhysicalColumn(e))||!1}isValidConfig(e){let t=this.hot.countCols();return!!Array.isArray(e)&&e.length>0&&e.every(e=>Number.isInteger(e)&&e>=0&&e<t)}resetCellsMeta(){J(this.hot.getCellsMeta(),e=>{e[CF]&&(delete e.skipColumnOnPaste,delete e[CF])})}#dP=(e,t)=>this.isHidden(t)?0:this.getSetting("indicators")&&(this.isHidden(t+1)||this.isHidden(t-1))&&"number"==typeof e&&this.hot.hasColHeaders()?e+15:void 0;#uE=(e,t,r)=>{if(!1===this.getSetting("copyPasteEnabled")&&(this.isHidden(t)?!0!==r.skipColumnOnPaste&&(r.skipColumnOnPaste=!0,r[CF]=!0):r[CF]&&(delete r.skipColumnOnPaste,delete r[CF])),this.isHidden(t-1))r.className=r.className||"",-1===r.className.indexOf("afterHiddenColumn")&&(r.className+=" afterHiddenColumn");else if(r.className){let e=r.className.split(" ");if(e.length>0){let t=e.indexOf("afterHiddenColumn");t>-1&&e.splice(t,1),r.className=e.join(" ")}}};#p_=e=>{if(this.getSetting("copyPasteEnabled"))return e;let t=[],r=(e,r,n,o)=>{t.push({startRow:e,endRow:r,startCol:n,endCol:o})};return J(e,e=>{let t=!0,n=0;oA(e.startCol,e.endCol,o=>{this.isHidden(o)?(t||r(e.startRow,e.endRow,n,o-1),t=!0):(t&&(n=o),o===e.endCol&&r(e.startRow,e.endRow,n,o),t=!1)})}),t};#o4=(e,t)=>{if(!this.getSetting("indicators")||e<0)return;let r=[];e>=1&&this.isHidden(e-1)&&r.push("afterHiddenColumn"),e<this.hot.countCols()-1&&this.isHidden(e+1)&&r.push("beforeHiddenColumn"),rd(t,r)};#iJ=e=>{var t,r;let n;e.items.push({name:ms},(t=this,{key:"hidden_columns_hide",name(){let e=this.getSelectedActive(),t=0;if(Array.isArray(e)){let[,r,,n]=e;r-n!=0&&(t=1)}return this.getTranslatedPhrase(lT,t)},callback(){let e=this.getSelectedRangeActive();if(!e)return;let{from:r,to:n}=e;if(null===r.col||null===n.col)return;let o=Math.max(Math.min(r.col,n.col),0),i=Math.max(r.col,n.col),s=[];for(let e=o;e<=i;e+=1)s.push(e);t.hideColumns(s);let a=s[s.length-1],l=this.columnIndexMapper.getNearestNotHiddenIndex(a,1,!0);null!==l&&Number.isInteger(l)&&l>=0?this.selectColumns(l):this.deselectCell(),this.view.adjustElementsSize(),this.render()},disabled:!1,hidden(){return!(this.selection.isSelectedByColumnHeader()||this.selection.isSelectedByCorner())}}),(r=this,n=[],{key:"hidden_columns_show",name(){let e=+(n.length>1);return this.getTranslatedPhrase(lA,e)},callback(){if(0===n.length)return;let e=n[0],t=n[n.length-1];e=this.columnIndexMapper.getNearestNotHiddenIndex(e-1,-1)??0,t=this.columnIndexMapper.getNearestNotHiddenIndex(t+1,1)??this.countCols()-1,r.showColumns(n),this.view.adjustElementsSize(),this.render(),t-e+1!==this.countCols()&&this.selectColumns(e,t)},disabled:!1,hidden(){let e=Z(r.getHiddenColumns(),e=>this.toPhysicalColumn(e));if(!(this.selection.isSelectedByColumnHeader()||this.selection.isSelectedByCorner())||e.length<1)return!0;n.length=0;let t=this.getSelectedRangeActive();if(!t)return!0;let o=t.getTopStartCorner().col,i=t.getBottomEndCorner().col,s=this.columnIndexMapper,a=null!==o?s.getRenderableFromVisualIndex(o):null,l=null!==i?s.getRenderableFromVisualIndex(i):null,h=s.getNotTrimmedIndexes(),d=[];if(o!==i){if(null===o||null===i)return!0;if(i-o+1>(l??0)-(a??0)+1){let t=h.slice(o,i+1),r=new Set(e);t.forEach(e=>{r.has(e)&&d.push(e)})}}else if(0===a&&null!==o&&a<o)d.push(...h.slice(0,o));else if(null===a)d.push(...h.slice(0,this.countCols()));else{let e=this.countCols()-1,t=s.getNearestNotHiddenIndex(e,-1),r=null!==t?s.getRenderableFromVisualIndex(t):null;null!==l&&null!==i&&l===r&&e>i&&d.push(...h.slice(i+1))}return J(d,e=>{n.push(this.toVisualColumn(e))}),0===n.length}}))};#dL(){let e=this.getSetting("columns");Array.isArray(e)&&this.hideColumns(e)}destroy(){this.#pH=null,super.destroy()}}),oY(class e extends pa{static get PLUGIN_KEY(){return CB}static get PLUGIN_PRIORITY(){return 320}static get DEFAULT_SETTINGS(){return{copyPasteEnabled:!0,indicators:!1,rows:[]}}#pL=null;isEnabled(){return!!this.hot.getSettings()[CB]}enablePlugin(){this.enabled||(this.#pL=this.hot.rowIndexMapper.createAndRegisterIndexMap(this.pluginName,"hiding"),this.#pL.addLocalHook("init",()=>this.#dL()),this.hot.rowIndexMapper.getNumberOfIndexes()>0&&this.#dL(),this.addHook("afterContextMenuDefaultOptions",this.#iJ),this.addHook("afterGetCellMeta",this.#uE),this.addHook("modifyRowHeight",this.#dK),this.addHook("afterGetRowHeader",this.#pP),this.addHook("modifyCopyableRange",this.#p_),super.enablePlugin())}updatePlugin(){this.disablePlugin(),this.enablePlugin(),super.updatePlugin()}disablePlugin(){super.disablePlugin(),this.hot.rowIndexMapper.unregisterMap(this.pluginName),this.resetCellsMeta()}showRows(e){let t=this.getHiddenRows(),r=this.isValidConfig(e),n=t,o=this.#pL.getValues().slice(),i=e.length>0;r&&i&&(J(e.map(e=>this.hot.toPhysicalRow(e)),e=>{o[e]=!1}),n=X(o,(e,t,r)=>(t&&e.push(this.hot.toVisualRow(r)),e),[])),!1!==this.hot.runHooks("beforeUnhideRows",t,n,r&&i)&&(r&&i&&this.#pL.setValues(o),this.hot.runHooks("afterUnhideRows",t,n,r&&i,r&&n.length<t.length))}showRow(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];this.showRows(t)}hideRows(e){let t=this.getHiddenRows(),r=this.isValidConfig(e),n=t;r&&(n=Array.from(new Set(t.concat(e)))),!1!==this.hot.runHooks("beforeHideRows",t,n,r)&&(r&&this.hot.batchExecution(()=>{J(e,e=>{this.#pL.setValueAtIndex(this.hot.toPhysicalRow(e),!0)})},!0),this.hot.runHooks("afterHideRows",t,n,r,r&&n.length>t.length))}hideRow(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];this.hideRows(t)}getHiddenRows(){return Z(this.#pL.getHiddenIndexes(),e=>this.hot.toVisualRow(e))}isHidden(e){return this.#pL.getValueAtIndex(this.hot.toPhysicalRow(e))||!1}isValidConfig(e){let t=this.hot.countRows();return!!Array.isArray(e)&&e.length>0&&e.every(e=>Number.isInteger(e)&&e>=0&&e<t)}resetCellsMeta(){J(this.hot.getCellsMeta(),e=>{e[CV]&&(delete e.skipRowOnPaste,delete e[CV])})}#dK=(e,t)=>this.isHidden(t)?0:e;#uE=(e,t,r)=>{if(!1===this.getSetting("copyPasteEnabled")&&(this.isHidden(e)?!0!==r.skipRowOnPaste&&(r.skipRowOnPaste=!0,r[CV]=!0):r[CV]&&(delete r.skipRowOnPaste,delete r[CV])),this.isHidden(e-1))r.className=r.className||"",-1===r.className.indexOf("afterHiddenRow")&&(r.className+=" afterHiddenRow");else if(r.className){let e=r.className.split(" ");if(e.length>0){let t=e.indexOf("afterHiddenRow");t>-1&&e.splice(t,1),r.className=e.join(" ")}}};#p_=e=>{if(this.getSetting("copyPasteEnabled"))return e;let t=[],r=(e,r,n,o)=>{t.push({startRow:e,endRow:r,startCol:n,endCol:o})};return J(e,e=>{let t=!0,n=0;oA(e.startRow,e.endRow,o=>{this.isHidden(o)?(t||r(n,o-1,e.startCol,e.endCol),t=!0):(t&&(n=o),o===e.endRow&&r(n,o,e.startCol,e.endCol),t=!1)})}),t};#pP=(e,t)=>{if(!this.getSetting("indicators")||e<0)return;let r=[];e>=1&&this.isHidden(e-1)&&r.push("afterHiddenRow"),e<this.hot.countRows()-1&&this.isHidden(e+1)&&r.push("beforeHiddenRow"),rd(t,r)};#iJ=e=>{var t,r;let n;e.items.push({name:ms},(t=this,{key:"hidden_rows_hide",name(){let e=this.getSelectedActive(),t=0;if(Array.isArray(e)){let[r,,n]=e;r-n!=0&&(t=1)}return this.getTranslatedPhrase(lM,t)},callback(){let e=this.getSelectedRangeActive();if(!e)return;let{from:r,to:n}=e;if(null===r.row||null===n.row)return;let o=Math.max(Math.min(r.row,n.row),0),i=Math.max(r.row,n.row),s=[];for(let e=o;e<=i;e+=1)s.push(e);t.hideRows(s);let a=s[s.length-1],l=this.rowIndexMapper.getNearestNotHiddenIndex(a,1,!0);null!==l&&Number.isInteger(l)&&l>=0?this.selectRows(l):this.deselectCell(),this.view.adjustElementsSize(),this.render()},disabled:!1,hidden(){return!(this.selection.isSelectedByRowHeader()||this.selection.isSelectedByCorner())}}),(r=this,n=[],{key:"hidden_rows_show",name(){let e=+(n.length>1);return this.getTranslatedPhrase(lI,e)},callback(){if(0===n.length)return;let e=n[0],t=n[n.length-1];e=this.rowIndexMapper.getNearestNotHiddenIndex(e-1,-1)??0,t=this.rowIndexMapper.getNearestNotHiddenIndex(t+1,1)??this.countRows()-1,r.showRows(n),this.view.adjustElementsSize(),this.render(),t-e+1!==this.countRows()&&this.selectRows(e,t)},disabled:!1,hidden(){let e=Z(r.getHiddenRows(),e=>this.toPhysicalRow(e));if(!(this.selection.isSelectedByRowHeader()||this.selection.isSelectedByCorner())||e.length<1)return!0;n.length=0;let t=this.getSelectedRangeActive();if(!t)return!0;let o=t.getTopStartCorner().row,i=t.getBottomEndCorner().row,s=this.rowIndexMapper,a=null!==o?s.getRenderableFromVisualIndex(o):null,l=null!==i?s.getRenderableFromVisualIndex(i):null,h=s.getNotTrimmedIndexes(),d=[];if(o!==i){if(null===o||null===i)return!0;if(i-o+1>(l??0)-(a??0)+1){let t=h.slice(o,i+1),r=new Set(e);t.forEach(e=>{r.has(e)&&d.push(e)})}}else if(0===a&&null!==o&&a<o)d.push(...h.slice(0,o));else if(null===a)d.push(...h.slice(0,this.countRows()));else{let e=this.countRows()-1,t=s.getRenderableFromVisualIndex(s.getNearestNotHiddenIndex(e,-1)??e);if(null===l)return!0;null!==i&&l===t&&e>i&&d.push(...h.slice(i+1))}return J(d,e=>{n.push(this.toVisualRow(e))}),0===n.length}}))};#dL(){let e=this.getSetting("rows");Array.isArray(e)&&this.hideRows(e)}destroy(){this.#pL=null,super.destroy()}}),oY(class e extends pa{static get PLUGIN_KEY(){return CU}static get PLUGIN_PRIORITY(){return 110}#pD=!1;isEnabled(){return!!this.hot.getSettings()[CU]}enablePlugin(){this.enabled||(this.addHook("afterContextMenuDefaultOptions",e=>{this.#pF(e)}),this.addHook("beforeColumnMove",this.#sM),super.enablePlugin())}disablePlugin(){this.#pD=!1,super.disablePlugin()}updatePlugin(){this.disablePlugin(),this.enablePlugin(),super.updatePlugin()}freezeColumn(e){let t=this.hot.getSettings(),r=(t.fixedColumnsStart??0)<this.hot.countCols()&&e>(t.fixedColumnsStart??0)-1;this.#pD||(this.#pD=!0),!1!==this.hot.runHooks("beforeColumnFreeze",e,r)&&(r&&(this.hot.columnIndexMapper.moveIndexes(e,t.fixedColumnsStart??0),t._fixedColumnsStart+=1),this.hot.runHooks("afterColumnFreeze",e,r))}unfreezeColumn(e){let t=this.hot.getSettings(),r=t.fixedColumnsStart??0,n=r>0&&e<=r-1;this.#pD||(this.#pD=!0),!1!==this.hot.runHooks("beforeColumnUnfreeze",e,n)&&(n&&(t._fixedColumnsStart-=1,this.hot.columnIndexMapper.moveIndexes(e,t.fixedColumnsStart??0)),this.hot.runHooks("afterColumnUnfreeze",e,n))}#pF(e){var t,r;e.items.push({name:"---------"},(t=this,{key:"freeze_column",name(){return this.getTranslatedPhrase(lt)},callback(e,r){let[{start:{col:n}}]=r;t.freezeColumn(n),this.view.adjustElementsSize(),this.render()},hidden(){let e=this.getSelectedRange(),t=!1;return void 0===e||e.length>1?t=!0:(e[0].from.col!==e[0].to.col||e[0].from.col<=(this.getSettings().fixedColumnsStart??0)-1)&&(t=!0),t}}),(r=this,{key:"unfreeze_column",name(){return this.getTranslatedPhrase(lr)},callback(e,t){let[{start:{col:n}}]=t;r.unfreezeColumn(n),this.view.adjustElementsSize(),this.render()},hidden(){let e=this.getSelectedRange(),t=!1;if(void 0===e)t=!0;else if(e.length>1)t=!0;else{let r=e[0].from.col,n=e[0].to.col,o=this.getSettings().fixedColumnsStart??0;(r!==n||null!==r&&r>=o)&&(t=!0)}return t}}))}#sM=(e,t)=>{if(this.#pD){let r=this.hot.getSettings().fixedColumnsStart??0;if(t<r||e.some(e=>e<r))return!1}}}),oY(CX),oY(C2),oY(yt),oY(yn),oY(yu),oY(class e extends pa{static get PLUGIN_KEY(){return ym}static get PLUGIN_PRIORITY(){return 25}static get SETTING_KEYS(){return[ym]}#pB=null;#pV=null;#pU="";#pz=null;isEnabled(){return!0===this.hot.getSettings()[ym]}enablePlugin(){this.enabled||(this.addHook("afterOnSelectionEdgeMouseDown",this.#aD),this.addHook("afterScroll",this.#aB),this.#oy(),super.enablePlugin())}updatePlugin(){this.disablePlugin(),this.enablePlugin(),super.updatePlugin()}disablePlugin(){this.#ov(),super.disablePlugin(),this.#pW(!1,null)}destroy(){this.#pW(!1,null),super.destroy()}isDragActive(){return null!==this.#pB}moveCellRange(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=e.getTopStartCorner(),o=e.getBottomEndCorner(),i=n.row,s=n.col,a=o.row,l=o.col,h=a-i+1,d=l-s+1,u=t.row,c=t.col,g=u+h-1,p=c+d-1;if(u===i&&c===s)return!1;if(h*d>1e5)return tQ("The moved range spans more than 100000 cells — the operation was skipped."),!1;if(u<0||c<0||g>=this.hot.countRows()||p>=this.hot.countCols()||i<0||s<0||a>=this.hot.countRows()||l>=this.hot.countCols()||this.#pG(u,c,h,d)||!r&&this.#pG(i,s,h,d))return!1;let m=this.hot.getPlugin("mergeCells");if(m?.enabled){let t=this.hot._createCellRange(this.hot._createCellCoords(u,c),this.hot._createCellCoords(u,c),this.hot._createCellCoords(g,p));if(m.mergedCellsCollection.getWithinRange(e,!0).length>0||m.mergedCellsCollection.getWithinRange(t,!0).length>0)return!1}if(!1===this.hot.runHooks("beforeMoveCells",e,t,r))return!1;let f=this.hot.getPlugin("formulas"),b=f?.enabled===!0;if(b&&!f.commitPendingMoveCells())return!1;let C=this.#p$(i,s,a,l);this.hot.batch(()=>{if(this.#pY({fromRow:i,fromCol:s,toRow:a,toCol:l,targetRow:u,targetCol:c,isCopy:r}),!b){if(!r){let e=Array.from({length:h},()=>Array(d).fill(null));this.hot.populateFromArray(i,s,e,a,l,"auto")}this.hot.populateFromArray(u,c,C,g,p,"auto")}});let y=this.hot._createCellRange(this.hot._createCellCoords(u,c),this.hot._createCellCoords(u,c),this.hot._createCellCoords(g,p));return this.hot.runHooks("afterMoveCells",e,y,r),this.hot.selectCells([[u,c,g,p]]),!0}#p$(e,t,r,n){let o=[];for(let i=e;i<=r;i++){let e=this.hot.toPhysicalRow(i),r=[];for(let o=t;o<=n;o++)r.push(this.hot.getSourceDataAtCell(e,o));o.push(r)}return o}#aD=e=>{let t=this.hot.selection;if(nT(e)||this.#pB||!t.isRangeMovable()&&!t.isSingleCellMovable())return;let r=t.getSelectedRange().current();if(!r)return;this.hot.listen();let n=r.getTopStartCorner(),o=r.getBottomEndCorner(),i=pf(this.hot,e.clientX,e.clientY),s=n.row,a=n.col,l=o.row,h=o.col;this.#pB={fromRow:s,fromCol:a,toRow:l,toCol:h,grabRowOffset:Math.min(l-s,Math.max(0,(i.row??s)-s)),grabColOffset:Math.min(h-a,Math.max(0,(i.col??a)-a)),pressRow:i.row,pressCol:i.col},this.#pz={clientX:e.clientX,clientY:e.clientY},this.#pU=this.hot.rootDocument.body.style.cursor,this.hot.rootDocument.body.style.cursor="grabbing",rd(this.hot.rootElement,"ht__moving"),this.#pj(),this.#pq(s,a,l,h),this.eventManager.addEventListener(this.hot.rootDocument.documentElement,"mousemove",this.#aV),this.eventManager.addEventListener(this.hot.rootDocument.documentElement,"mouseup",this.#db)};#aV=e=>{e instanceof this.hot.rootWindow.MouseEvent&&this.#pB&&(this.#pz={clientX:e.clientX,clientY:e.clientY},this.#pK(e.clientX,e.clientY))};#aB=()=>{this.#pB&&this.#pz&&this.#pK(this.#pz.clientX,this.#pz.clientY)};#pK(e,t){let r=this.#pB;if(!r)return;let{fromRow:n,fromCol:o,toRow:i,toCol:s,grabRowOffset:a,grabColOffset:l}=r,h=pf(this.hot,e,t),d=yc({pointerRow:h.row??n,pointerCol:h.col??o,grabRowOffset:a,grabColOffset:l,rangeHeight:i-n+1,rangeWidth:s-o+1,totalRows:this.hot.countRows(),totalCols:this.hot.countCols()});this.#pq(d.row,d.col,d.row+i-n,d.col+s-o)}#db=e=>{this.#pW(!0,e)};#oy(){this.hot.getShortcutManager().getContext("grid")?.addShortcut({keys:[["Escape"]],callback:()=>this.#pW(!1,null),runOnlyIf:()=>null!==this.#pB,group:ym})}#ov(){this.hot.getShortcutManager().getContext("grid")?.removeShortcutsByGroup(ym)}#pW(e,t){let r=this.#pB;if(!r||(this.#pB=null,this.#pz=null,this.eventManager.removeEventListener(this.hot.rootDocument.documentElement,"mousemove",this.#aV),this.eventManager.removeEventListener(this.hot.rootDocument.documentElement,"mouseup",this.#db),this.#pV?.remove(),this.#pV=null,ru(this.hot.rootElement,"ht__moving"),this.hot.rootDocument.body.style.cursor=this.#pU,!e||!t))return;let n=pf(this.hot,t.clientX,t.clientY);if(n.row===r.pressRow&&n.col===r.pressCol){null!==n.row&&null!==n.col&&this.hot.selectCell(n.row,n.col);return}let o=yc({pointerRow:n.row??r.fromRow,pointerCol:n.col??r.fromCol,grabRowOffset:r.grabRowOffset,grabColOffset:r.grabColOffset,rangeHeight:r.toRow-r.fromRow+1,rangeWidth:r.toCol-r.fromCol+1,totalRows:this.hot.countRows(),totalCols:this.hot.countCols()}),i=this.hot._createCellRange(this.hot._createCellCoords(r.fromRow,r.fromCol),this.hot._createCellCoords(r.fromRow,r.fromCol),this.hot._createCellCoords(r.toRow,r.toCol));this.moveCellRange(i,this.hot._createCellCoords(o.row,o.col),t.ctrlKey||t.metaKey)}#pj(){let e=this.hot.rootDocument.createElement("div"),t=this.hot.rootWindow.getComputedStyle(this.hot.rootElement),r=t.getPropertyValue("--ht-cell-selection-border-width").trim()||"1px",n=t.getPropertyValue("--ht-cell-selection-border-color").trim()||"#4b89ff";e.className="wtMoveGhost",Object.assign(e.style,{position:"fixed",display:"none",pointerEvents:"none",zIndex:"10000",boxSizing:"border-box",border:`${r} dashed ${n}`}),this.hot.rootDocument.body.appendChild(e),this.#pV=e}#pq(e,t,r,n){if(!this.#pV)return;let o=this.hot.rowIndexMapper.getNearestNotHiddenIndex(Math.max(e,this.hot.getFirstRenderedVisibleRow()),1),i=this.hot.rowIndexMapper.getNearestNotHiddenIndex(Math.min(r,this.hot.getLastRenderedVisibleRow()),-1),s=this.hot.columnIndexMapper.getNearestNotHiddenIndex(Math.max(t,this.hot.getFirstRenderedVisibleColumn()),1),a=this.hot.columnIndexMapper.getNearestNotHiddenIndex(Math.min(n,this.hot.getLastRenderedVisibleColumn()),-1);if(null===o||null===i||null===s||null===a||o>i||s>a||o>r||i<e||s>n||a<t){this.#pV.style.display="none";return}let l=this.hot.getCell(o,s,!0),h=this.hot.getCell(i,a,!0);if(!l||!h){this.#pV.style.display="none";return}let d=l.getBoundingClientRect(),u=h.getBoundingClientRect(),c=Math.min(d.left,u.left),g=Math.max(d.right,u.right);Object.assign(this.#pV.style,{display:"block",top:`${d.top}px`,left:`${c}px`,width:`${g-c}px`,height:`${u.bottom-d.top}px`})}#pG(e,t,r,n){for(let o=0;o<r;o++)for(let r=0;r<n;r++)if(this.hot.getCellMetaTransient(e+o,t+r).readOnly)return!0;return!1}#pY(e){let{fromRow:t,fromCol:r,toRow:n,toCol:o,targetRow:i,targetCol:s,isCopy:a}=e,l=i-t,h=s-r,d=i+(n-t),u=s+(o-r),c=yp(this.hot,t,r,n,o),g=yp(this.hot,i,s,d,u),p=new Map(c.map(e=>{let{row:t,col:r,meta:n}=e;return[`${t}:${r}`,n]}));c.forEach(e=>{let{row:t,col:r,meta:n}=e;yg.forEach(e=>{ty(n,e)&&this.hot.setCellMeta(t+l,r+h,e,n[e])})}),g.forEach(e=>{let{row:t,col:r,meta:n}=e,o=p.get(`${t-l}:${r-h}`);yg.forEach(e=>{ty(n,e)&&!(o&&ty(o,e))&&this.hot.removeCellMeta(t,r,e)})}),a||c.forEach(e=>{let{row:t,col:r}=e;t>=i&&t<=d&&r>=s&&r<=u||yg.forEach(e=>this.hot.removeCellMeta(t,r,e))})}}),oY(class e extends p8{static get PLUGIN_KEY(){return yb}static get PLUGIN_PRIORITY(){return 170}static get SETTING_KEYS(){return[yb]}pluginKey=yb;isEnabled(){return!!this.hot.getSettings()[this.pluginKey]}enablePlugin(){this.enabled||super.enablePlugin()}disablePlugin(){super.disablePlugin()}registerShortcuts(){super.registerShortcuts(),this.hot.getShortcutManager().getContext("grid")?.addShortcut({keys:[["Shift","Enter"]],callback:()=>{let e=this.hot.getSelectedRangeActive();if(e){let{highlight:t}=e;if((t.row??0)===-1&&(t.col??0)>=0){let e=this.getNextSortConfig(t.col??0,p4);this.sort(e)}}return!1},runOnlyIf:()=>{let e=this.hot.getSelectedRangeActive()?.highlight;return!!(e&&this.hot.getSelectedRangeActive()?.isSingle()&&this.hot.selection.isCellVisible(e)&&e.isHeader())},relativeToGroup:dY,position:"before",group:yb})}unregisterShortcuts(){super.unregisterShortcuts(),this.hot.getShortcutManager().getContext("grid")?.removeShortcutsByGroup(yb)}sort(e){super.sort(e)}clearSort(){super.clearSort()}isSorted(){return super.isSorted()}getSortConfig(e){return super.getSortConfig(e)}setSortConfig(e){super.setSortConfig(e)}getNormalizedSortConfigs(e){return Array.isArray(e)?e:void 0!==e?[e]:[]}updateHeaderClasses(e,t,r,n,o){let i,s,a;super.updateHeaderClasses(e,t,r,n,o),ru(e,(i=e.className.split(" "),s=RegExp(`^${yf}-[0-9]{1,2}$`),i.filter(e=>s.test(e)))),!1!==this.enabled&&void 0!==t&&void 0!==r&&rd(e,(a=[],!1===(n??!1)||t.isColumnSorted(r)&&t.getNumberOfSortedColumns()>1&&a.push(`${yf}-${t.getIndexOfColumnInSortQueue(r)+1}`),a))}applyHeaderClickSort(e){e.isCtrlPressed?this.sort(this.getNextSortConfig(e.column,p4)):this.sort(this.getColumnNextConfig(e.column))}}),oY(yC),oY(yY),oY(class e extends pa{static get PLUGIN_KEY(){return y0}static get PLUGIN_PRIORITY(){return 300}dataManager=null;headersUI=null;collapsingUI=null;contextMenuUI=null;rowMoveController=null;collapsedRowsMap=null;#pX=!1;#pQ=!1;#pZ=!0;isEnabled(){return!!this.hot.getSettings()[y0]}enablePlugin(){this.enabled||(this.collapsedRowsMap=this.hot.rowIndexMapper.createAndRegisterIndexMap("nestedRows","trimming"),this.dataManager=new yj(this,this.hot),this.collapsingUI=new yQ(this,this.hot),this.headersUI=new yK(this,this.hot),this.contextMenuUI=new yZ(this,this.hot),this.rowMoveController=new yJ(this),this.addHook("afterInit",this.#sf),this.addHook("afterRender",this.#r7),this.addHook("beforeViewRender",this.#o2),this.addHook("modifyRowData",this.onModifyRowData.bind(this)),this.addHook("modifySourceLength",this.onModifySourceLength.bind(this)),this.addHook("beforeDataSplice",this.onBeforeDataSplice.bind(this)),this.addHook("filterData",this.#pJ),this.addHook("afterContextMenuDefaultOptions",this.#iJ),this.addHook("afterGetRowHeader",this.#pP),this.addHook("beforeOnCellMouseDown",this.#o9),this.addHook("beforeRemoveRow",this.#sy),this.addHook("afterRemoveRow",this.#sw),this.addHook("beforeAddChild",this.#p0),this.addHook("afterAddChild",this.#p1),this.addHook("beforeDetachChild",this.#p2),this.addHook("afterDetachChild",this.#h$),this.addHook("modifyRowHeaderWidth",this.#p3),this.addHook("afterCreateRow",this.#sC),this.addHook("beforeRowMove",this.#sT),this.addHook("beforeLoadData",this.#hF),this.addHook("beforeUpdateData",this.#hF),this.registerShortcuts(),super.enablePlugin())}disablePlugin(){this.hot.rowIndexMapper.unregisterMap("nestedRows"),this.unregisterShortcuts(),super.disablePlugin()}updatePlugin(){let e=this.collapsingUI?.getCollapsedParents()??[];this.disablePlugin();let t=this.dataManager.getData();this.enablePlugin(),this.dataManager.updateWithData(t),e.length>0&&this.collapsingUI.toggleCollapsedRows(e,"collapse",!1),super.updatePlugin()}registerShortcuts(){this.hot.getShortcutManager().getContext("grid")?.addShortcut({keys:[["Enter"]],callback:()=>{let e=this.hot.getSelectedRangeActive();if(!e)return!1;let{highlight:t}=e,r=this.collapsingUI.translateTrimmedRow(t.row??0);return this.collapsingUI.toggleCollapsedRows([r],this.collapsingUI.areChildrenCollapsed(r)?"expand":"collapse"),!1},runOnlyIf:()=>{let e=this.hot.getSelectedRangeActive()?.highlight;return!!(e&&this.hot.getSelectedRangeActive()?.isSingle()&&this.hot.selection.isCellVisible(e)&&-1===e.col&&null!==e.row&&e.row>=0)},group:y0,relativeToGroup:dY,position:"before"})}unregisterShortcuts(){this.hot.getShortcutManager().getContext("grid")?.removeShortcutsByGroup(y0)}collapseAll(){this.#p6()&&this.collapsingUI.collapseAll()}expandAll(){this.#p6()&&this.collapsingUI.toggleCollapsedRows(this.collapsingUI.getCollapsedParentsShallowestFirst(),"expand")}collapseParent(e){return this.#p5(e,"collapse")}expandParent(e){return this.#p5(e,"expand")}toggleParent(e){let t=this.#p4(e);if(null===t)return!1;let r=this.dataManager.isParent(t)&&this.collapsingUI.areChildrenCollapsed(t);return this.collapsingUI.toggleCollapsedRows([t],r?"expand":"collapse")}getCollapsedParents(){return this.#p6()?this.collapsingUI.getCollapsedParents():[]}isParentCollapsed(e){let t=this.#p4(e);return null!==t&&!!this.dataManager.isParent(t)&&this.collapsingUI.areChildrenCollapsed(t)}isParent(e){let t=this.#p9(e);return null!==t&&this.dataManager.isParent(t)}getRowLevel(e){let t=this.#p9(e);return null===t?null:this.dataManager.getRowLevel(t)}getRowParent(e){let t=this.#p9(e);if(null===t)return null;let r=this.dataManager.getRowParent(t),n=this.dataManager.getRowIndex(r);if(null===n)return null;let o=this.hot.toVisualRow(n);return null===o?null:o}countChildren(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.#p9(e);if(null===r)return 0;if(t)return this.dataManager.countChildren(r);let n=this.dataManager.getDataObject(r);return(n?.__children??[]).length}expandToRow(e){if(!this.#p6()||!Number.isInteger(e)||e<0)return!1;let t=[],r=this.dataManager.getRowParent(e);for(;null!==r;){let e=this.dataManager.getRowIndex(r);if(null===e)break;this.collapsingUI.getCollapsedParents().indexOf(e)>-1&&t.push(e),r=this.dataManager.getRowParent(r)}return 0!==t.length&&this.collapsingUI.toggleCollapsedRows(t.reverse(),"expand")}expandToLevel(e){if(!this.#p6()||!Number.isInteger(e)||e<0)return;let t=[],r=[];this.hot.batch(()=>{let n=this.dataManager.getData()??[];this.#p7(n,(n,o)=>{o>=e?t.push(n):r.push(n)}),r.length>0&&this.collapsingUI.applyCollapsedRowsChange(r,"expand").vetoed||t.length>0&&this.collapsingUI.toggleCollapsedRows(t.reverse(),"collapse")})}#p7(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;e.forEach(e=>{if(!this.dataManager.hasChildren(e))return;let n=this.dataManager.getRowIndex(e);null!==n&&t(n,r),this.#p7(e.__children??[],t,r+1)})}#p6(){return this.enabled&&!!this.dataManager&&!!this.collapsingUI}#p9(e){if(!this.#p6()||!Number.isInteger(e)||e<0)return null;let t=this.hot.toPhysicalRow(e);return null==t?null:t}#p4(e){return this.#p9(e)}#p5(e,t){let r=this.#p4(e);return null!==r&&this.collapsingUI.toggleCollapsedRows([r],t)}#sT=(e,t,r,n)=>this.rowMoveController.onBeforeRowMove(e,t,r,n);disableCoreAPIModifiers(){this.#pQ=!0}enableCoreAPIModifiers(){this.#pQ=!1}#o9=(e,t,r)=>{this.collapsingUI.toggleState(e,t,r)};onModifyRowData(e){if(!this.#pQ)return this.dataManager.getDataObject(e)}onModifySourceLength(){if(!this.#pQ)return this.dataManager.countAllRows()}onBeforeDataSplice(e,t,r){return!!(this.#pQ||this.dataManager.isRowHighestLevel(e))||(this.dataManager.spliceData(e,t,[r]),!1)}#pJ=(e,t,r)=>(this.collapsingUI.collapsedRowsStash.stash(),this.collapsingUI.collapsedRowsStash.trimStash(r[0],t),this.collapsingUI.collapsedRowsStash.shiftStash(r[0],null,-1*t),this.dataManager.filterData(e,t,r),this.#pX=!0,this.dataManager.getData().slice());#iJ=e=>this.contextMenuUI.appendOptions(e);#pP=(e,t)=>{this.headersUI.appendLevelIndicators(e,t)};#p3=e=>Math.max(this.headersUI.rowHeaderWidthCache??0,e);#sw=(e,t,r,n)=>{n!==this.pluginName&&this.hot._registerTimeout(()=>{this.#pX=!1,this.headersUI.updateRowHeaderWidth(),this.collapsingUI.collapsedRowsStash.applyStash()})};#sy=(e,t,r)=>{let n=Array.from(r.reduce((e,t)=>{if(this.dataManager.isParent(t)){let r=this.dataManager.getDataObject(t)?.__children;return e.add(t),Array.isArray(r)&&r.forEach(t=>{let r=this.dataManager.getRowIndex(t);null!==r&&e.add(r)}),e}return e.add(t)},new Set));r.length=0,r.push(...n)};#p0=()=>{this.collapsingUI.collapsedRowsStash.stash()};#p1=(e,t)=>{let r=this.dataManager.getRowIndex(t);null!==r&&this.collapsingUI.collapsedRowsStash.shiftStash(r),this.collapsingUI.collapsedRowsStash.applyStash(),this.headersUI.updateRowHeaderWidth(void 0)};#p2=()=>{this.collapsingUI.collapsedRowsStash.stash()};#h$=(e,t,r)=>{this.collapsingUI.collapsedRowsStash.shiftStash(r,null,-1),this.collapsingUI.collapsedRowsStash.applyStash(),this.headersUI.updateRowHeaderWidth(void 0)};#sC=()=>{this.dataManager.rewriteCache()};#sf=()=>{this.headersUI.updateRowHeaderWidth(void 0)};#r7=()=>{this.#pZ&&this.hot.view&&(this.#pZ=!1,this.hot.rootWindow.requestAnimationFrame(()=>{this.hot&&this.hot.view&&!this.hot.isDestroyed&&this.hot.view.adjustElementsSize(!0)}))};#o2=(e,t)=>{this.#pX&&(t.skipRender=!0)};#hF=e=>{if(!(Array.isArray(e)&&(0===e.length||am(e)))){t3("The Nested Rows plugin requires an Array of Objects as a dataset to be provided. The plugin has been disabled."),this.hot.getSettings()[y0]=!1,this.disablePlugin();return}this.dataManager.setData(e),this.dataManager.rewriteCache()};destroy(){super.destroy()}}),oY(class e extends pa{static get PLUGIN_KEY(){return y5}static get PLUGIN_PRIORITY(){return 900}static get DEFAULT_SETTINGS(){return{pageSize:10,pageSizeList:["auto",5,10,20,50,100],initialPage:1,showPageSize:!0,showCounter:!0,showNavigation:!0,uiContainer:null}}#p8=null;#me=1;#mt=10;#gu=null;#mr=null;#mn=!1;#mo=!1;#lK=!1;#mi=null;isEnabled(){return!!this.hot.getSettings()[y5]}enablePlugin(){if(this.enabled)return;let e=this.hot.getSettings()[y5];e?.initialPage!==void 0&&(this.#me=this.getSetting("initialPage")),e?.pageSize!==void 0&&(this.#mt=this.getSetting("pageSize")),this.#lK=!0===this.hot.runHooks("hasExternalDataSource"),this.#mi=null,this.#p8=this.hot.rowIndexMapper.createAndRegisterIndexMap(this.pluginName,"hiding",!1),"auto"!==this.#mt||this.hot.getPlugin("autoRowSize")?.enabled||tQ(y9),this.#mr=y6("auto"===this.#mt?"auto":"fixed"),this.#gu||(this.#gu=new y2({rootElement:this.hot.rootGridElement,uiContainer:this.getSetting("uiContainer"),isRtl:this.hot.isRtl(),themeName:this.hot.getCurrentThemeName(),phraseTranslator:(e,t)=>this.hot.getTranslatedPhrase(e,t),a11yAnnouncer:e=>{var t;return t=String(e??""),void(uo&&(uo.textContent="",setTimeout(()=>{uo&&(uo.textContent=t)},100)))}}),this.#ms(),this.#gu.addLocalHook("firstPageClick",()=>this.firstPage()).addLocalHook("prevPageClick",()=>this.prevPage()).addLocalHook("nextPageClick",()=>this.nextPage()).addLocalHook("lastPageClick",()=>this.lastPage()).addLocalHook("pageSizeChange",e=>this.setPageSize(e))),s8(this.hot)&&!this.getSetting("uiContainer")&&this.hot.getLayoutManager().register(y5,this.#gu.getContainer(),{side:"bottom",weight:100}),this.addHook("init",this.#oz,-1),this.addHook("beforeSelectAll",this.#ma),this.addHook("beforeSelectColumns",this.#ma),this.addHook("beforeSetRangeEnd",this.#ml),this.addHook("beforeSelectionHighlightSet",this.#ub),this.addHook("beforePaste",this.#mh),this.addHook("afterViewRender",this.#gm),this.addHook("afterLanguageChange",this.#md),this.addHook("beforeHeightChange",this.#mu),this.addHook("afterSetTheme",this.#mc),this.addHook("afterDataProviderFetch",this.#it,-1),this.hot.rowIndexMapper.addLocalHook("cacheUpdated",this.#mg),this.#gp(),super.enablePlugin()}#it=e=>{let{queryParameters:t,totalRows:r}=e;if(!this.#lK)return;let n=this.#me,o=this.#mt,{page:i,pageSize:s}=t;"number"==typeof i&&i>=1&&this.#mp(i),"auto"===s?this.#mm("auto"):"number"==typeof s&&s>=1&&this.#mm(s),this.#lK&&"number"==typeof r&&r>=0&&(this.#mi=r),this.#mf(),n!==this.#me&&this.hot.runHooks("afterPageChange",n,this.#me),o!==this.#mt&&this.hot.runHooks("afterPageSizeChange",o,this.#mt)};#mp(e){this.#me=e}#mm(e){this.#mr=y6("auto"===e?"auto":"fixed"),this.#mt=e}#mf(){this.#mb(),this.hot.view.adjustElementsSize(),this.hot.render()}revertPageTo(e){let t=this.#me;this.#mp(e),this.hot.scrollViewportTo({row:0}),this.#mf(),this.hot.runHooks("afterPageChange",t,e)}revertPageSizeTo(e){let t=this.#mt;this.#mm(e),this.#mf(),this.hot.runHooks("afterPageSizeChange",t,e)}updatePlugin(){this.disablePlugin(),this.enablePlugin(),this.#mf(),super.updatePlugin()}disablePlugin(){this.hot.rowIndexMapper.removeLocalHook("cacheUpdated",this.#mg).unregisterMap(this.pluginName),this.#gf(),s8(this.hot)&&this.hot.getLayoutManager().unregister(y5,"bottom"),this.#gu?.destroy(),this.#gu=null,super.disablePlugin()}getPaginationData(){let e=this.#mr?.getTotalPages()??0,t=-1,r=-1;if(this.#lK){let e=this.hot.countRows();e>0&&(t=0,r=e-1)}else{let e=this.#mr?.getState(this.#me);if(!e)return{currentPage:this.#me,totalPages:0,pageSize:0,pageSizeList:[],autoPageSize:!1,numberOfRenderedRows:0,firstVisibleRowIndex:t,lastVisibleRowIndex:r};let{pageSize:n,startIndex:o}=e,i=this.hot.countRows(),s=0,a=o;for(;s<n&&!(a>=i);){if(this.hot.rowIndexMapper.isHidden(this.hot.toPhysicalRow(a))){a+=1;continue}-1===t&&(t=a),r=a,s+=1,a+=1}}let n=this.#mr?.getState(this.#me);return{currentPage:this.#me,totalPages:e,pageSize:n?.pageSize??this.#mt,pageSizeList:[...this.getSetting("pageSizeList")??[]],autoPageSize:"auto"===this.#mt,numberOfRenderedRows:this.hot.rowIndexMapper.getRenderableIndexesLength(),firstVisibleRowIndex:t,lastVisibleRowIndex:r}}getCurrentPage(){return this.#me}getCurrentPageSize(){return this.#mt}setPage(e){let t=this.#me;!1!==this.hot.runHooks("beforePageChange",t,e)&&(this.#mp(e),this.#mf(),this.hot.scrollViewportTo({row:0}),this.hot.runHooks("afterPageChange",t,this.#me))}resetPage(){this.setPage(this.getSetting("initialPage"))}setPageSize(e){let t=this.#mt;!1!==this.hot.runHooks("beforePageSizeChange",t,e)&&("auto"!==e||this.hot.getPlugin("autoRowSize")?.enabled||tQ(y9),this.#mm(e),this.#mf(),this.hot.runHooks("afterPageSizeChange",t,this.#mt))}resetPageSize(){this.setPageSize(this.getSetting("pageSize"))}resetPagination(){this.resetPage(),this.resetPageSize(),this.#ms()}nextPage(){this.setPage(this.#me+1)}prevPage(){this.setPage(this.#me-1)}firstPage(){this.setPage(1)}lastPage(){this.setPage(this.#mr?.getTotalPages()??1)}hasPreviousPage(){return this.#me>1}hasNextPage(){return this.#me<(this.#mr?.getTotalPages()??0)}getCurrentPageData(){let{firstVisibleRowIndex:e,lastVisibleRowIndex:t}=this.getPaginationData();return -1===e||-1===t?[]:this.hot.getData(e,0,t,this.hot.countCols()-1)}showPageSizeSection(){this.#gu?.setPageSizeSectionVisibility(!0),this.hot.runHooks("afterPageSizeVisibilityChange",!0)}hidePageSizeSection(){this.#gu?.setPageSizeSectionVisibility(!1),this.hot.runHooks("afterPageSizeVisibilityChange",!1)}showPageCounterSection(){this.#gu?.setCounterSectionVisibility(!0),this.hot.runHooks("afterPageCounterVisibilityChange",!0)}hidePageCounterSection(){this.#gu?.setCounterSectionVisibility(!1),this.hot.runHooks("afterPageCounterVisibilityChange",!1)}showPageNavigationSection(){this.#gu?.setNavigationSectionVisibility(!0),this.hot.runHooks("afterPageNavigationVisibilityChange",!0)}hidePageNavigationSection(){this.#gu?.setNavigationSectionVisibility(!1),this.hot.runHooks("afterPageNavigationVisibilityChange",!1)}#ms(){this.getSetting("showPageSize")?this.showPageSizeSection():this.hidePageSizeSection(),this.getSetting("showCounter")?this.showPageCounterSection():this.hidePageCounterSection(),this.getSetting("showNavigation")?this.showPageNavigationSection():this.hidePageNavigationSection()}#mb(){this.#mn=!0,this.#p8?.clear();let e=this.hot.rowIndexMapper.getRenderableIndexes(),t=e.length,{stylesHandler:r}=this.hot,n=this.#lK,o=n?this.#mi??t:t;this.#mr?.calculate({pageSize:this.#mt,totalItems:o,viewportSizeProvider:()=>{let e=this.hot.view;if(e.isVerticallyScrollableByWindow()){let t=getComputedStyle(this.hot.rootDocument.body),r=Number.parseInt(t.marginTop,10)+Number.parseInt(t.marginBottom,10),n=this.hot.hasColHeaders()?e._wt.wtViewport.getColumnHeaderHeight():0,o=this.#gu?.getHeight();return e.getWorkspaceHeight()-(o??0)-n-r}let t=e.hasHorizontalScroll()?rX():0;return e.getViewportHeight()-t},itemsSizeProvider:()=>this.hot.rowIndexMapper.getRenderableIndexes().map(e=>{let t=this.hot.toVisualRow(e);return this.hot.getRowHeight(t)??r.getDefaultRowHeight(t)})});let i=this.#mr?.getTotalPages();if(this.#me=ox(this.#me,1,i??1),!n&&e.length>0){let t=this.#mr?.getState(this.#me);if(t){let{startIndex:r,pageSize:n}=t;e.splice(r,n)}}!n&&e.length>0?this.hot.batchExecution(()=>{e.forEach(e=>this.#p8?.setValueAtIndex(e,!0))},!0):n||this.hot.rowIndexMapper.updateCache(!0),this.#mn=!1;let s={...this.getPaginationData(),totalRenderedRows:n?o:t};if(n){let e=this.#mr?.getState(this.#me)?.pageSize??this.#mt;s.counterStartRow=(this.#me-1)*e+1,s.counterEndRow=Math.min(this.#me*e,o)}this.#gu?.updateState(s)}#gp(){let e=this.#gu?.getContainer();e&&this.hot.getFocusScopeManager().registerScope(y5,e,{shortcutsContextName:y4,runOnlyIf:()=>!!this.getSetting("showPageSize")||!!this.getSetting("showNavigation"),onActivate:e=>{let t=this.#gu?.getFocusableElements();t&&t.length>0&&("tab_from_above"===e?t[0]?.focus():"tab_from_below"===e&&t[t.length-1]?.focus())}})}#gf(){this.hot.getFocusScopeManager().unregisterScope(y5)}#ma=(e,t)=>{let{firstVisibleRowIndex:r,lastVisibleRowIndex:n}=this.getPaginationData();(this.#me>1||e.row>=0)&&(e.row=r),t.row=n};#ml=e=>{if(this.hot.selection.isSelectedByColumnHeader()){let{lastVisibleRowIndex:t}=this.getPaginationData();e.row=t}};#ub=()=>{if(!this.hot.getSettings().navigableHeaders)return;let e=this.hot.getSelectedRangeLast();if(e&&!e.isSingle()){let{highlight:t}=e,r=e.getTopStartCorner().row,n=e.getBottomEndCorner().row;null!==t.row&&null!==r&&null!==n&&(t.row=ox(t.row,r,n))}};#mh=(e,t)=>{let{firstVisibleRowIndex:r,lastVisibleRowIndex:n}=this.getPaginationData();if(-1===r||-1===n)return!1;t.forEach(t=>{let{startRow:r}=t;if(0===e.length)return;let o=Math.min(e.length-(n-r+1),e.length);e.splice(0,o)})};#gm=()=>{if("auto"!==this.#mt||this.#mo){this.#mo=!1;return}this.#mo=!0,this.#mf()};#mu=e=>{if(this.getSetting("uiContainer")||!("number"==typeof e||"string"==typeof e&&/^\d+$/.test(e)||"string"==typeof e&&e.endsWith("px")))return e;let t="string"==typeof e&&e.endsWith("px")?e:`${e}px`;return`calc(${t} - ${this.#gu?.getHeight()}px)`};#oz=()=>{"auto"!==this.#mt&&this.#mb()};#md=()=>{this.#mf()};#mc=e=>{this.#gu?.updateTheme(e)};#mg=()=>{!this.#mn&&this.hot?.view&&this.#mb()};destroy(){this.#p8=null,this.#mr=null,this.#gu?.destroy(),this.#gu=null,super.destroy()}}),oY(class e extends pa{static get PLUGIN_KEY(){return y7}static get PLUGIN_PRIORITY(){return 190}callback=y8;queryMethod=we;searchResultClass="htSearchResult";isEnabled(){return!!this.hot.getSettings()[y7]}enablePlugin(){if(this.enabled)return;let e=this.hot.getSettings()[y7];this.updatePluginSettings(e),this.addHook("beforeRenderer",this.#mC),super.enablePlugin()}disablePlugin(){let e=(e,t,r,n,o,i)=>this.#mC(e,t,r,n,o,i);this.hot.addHook("beforeRenderer",e),this.hot.addHookOnce("afterViewRender",()=>{this.hot.removeHook("beforeRenderer",e)}),super.disablePlugin()}updatePlugin(){this.disablePlugin(),this.enablePlugin(),super.updatePlugin()}query(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getCallback(),r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.getQueryMethod(),n=this.hot.countRows(),o=this.hot.countCols(),i=[],s=this.hot;return oA(0,n-1,n=>{oA(0,o-1,o=>{let a=this.hot.getDataAtCell(n,o),l=this.hot.getCellMeta(n,o),h=l.search,d=h?.callback??t,u=(h?.queryMethod??r)(e,a,l);u&&i.push({row:n,col:o,data:a}),d&&d(s,n,o,a,u)})}),i}getCallback(){return this.callback}setCallback(e){this.callback=e}getQueryMethod(){return this.queryMethod}setQueryMethod(e){this.queryMethod=e}getSearchResultClass(){return this.searchResultClass}setSearchResultClass(e){this.searchResultClass=e}updatePluginSettings(e){tc(e)&&(e.searchResultClass&&this.setSearchResultClass(String(e.searchResultClass)),e.queryMethod&&this.setQueryMethod(e.queryMethod),e.callback&&this.setCallback(e.callback))}#mC=(e,t,r,n,o,i)=>{let s=i.className||[],a=[];"string"==typeof s?a=s.split(" "):Array.isArray(s)&&a.push(...s);let l=i.isSearchResult;this.isEnabled()&&l?a.includes(this.searchResultClass)||a.push(`${this.searchResultClass}`):a.includes(this.searchResultClass)&&a.splice(a.indexOf(this.searchResultClass),1),i.className=a.join(" ")};destroy(){super.destroy()}}),oY(class e extends pa{static get PLUGIN_KEY(){return wr}static get PLUGIN_PRIORITY(){return 24}static get SETTING_KEYS(){return[wr]}#pB=null;#my=null;#pU="";#pz=null;isEnabled(){return!0===this.hot.getSettings()[wr]}isDragActive(){return null!==this.#pB}enablePlugin(){this.enabled||(this.addHook("afterOnSelectionHandleMouseDown",this.#mw),this.addHook("beforeOnCellMouseOver",this.#mS),this.addHook("afterScroll",this.#aB),this.eventManager.addEventListener(this.hot.rootElement,"mouseleave",this.#mv),this.eventManager.addEventListener(this.hot.rootDocument.documentElement,"mouseup",this.#mR),super.enablePlugin())}updatePlugin(){this.disablePlugin(),this.enablePlugin(),super.updatePlugin()}disablePlugin(){super.disablePlugin(),this.#pW(),this.hot.selection.setHandlesHoveredLayer(null)}destroy(){this.#pW(),super.destroy()}#mS=(e,t)=>{this.#my=t,this.#pB||this.hot.selection.setHandlesHoveredLayer(this.hot.selection.getLayerContaining(t))};#mw=(e,t)=>{if(nT(e))return;let r=this.hot.selection,n=r.getHandlesHoveredLayer()??r.getLayerLevel(),o=r.getSelectedRange().peekByIndex(n);if(!o)return;let i=o.getTopStartCorner(),s=o.getBottomEndCorner(),a=o.highlight,l=i.row,h=i.col,d=s.row,u=s.col;this.#pB={edge:t,layer:n,fromRow:l,fromCol:h,toRow:d,toCol:u,focusRow:a.row??l,focusCol:a.col??h},this.#pz={clientX:e.clientX,clientY:e.clientY},this.#pU=this.hot.rootDocument.body.style.cursor,this.hot.rootDocument.body.style.cursor="top"===t||"bottom"===t?"ns-resize":"ew-resize",rd(this.hot.rootElement,`ht__resizing-selection--${t}`),this.eventManager.addEventListener(this.hot.rootDocument.documentElement,"mousemove",this.#aV),this.eventManager.addEventListener(this.hot.rootDocument.documentElement,"mouseup",this.#pW)};#aV=e=>{e instanceof this.hot.rootWindow.MouseEvent&&this.#pB&&(this.#pz={clientX:e.clientX,clientY:e.clientY},this.#mE(e.clientX,e.clientY))};#aB=()=>{this.#pB&&this.#pz&&this.#mE(this.#pz.clientX,this.#pz.clientY)};#mE(e,t){let r,n;if(!this.#pB)return;let{edge:o,layer:i,fromRow:s,toRow:a,fromCol:l,toCol:h,focusRow:d,focusCol:u}=this.#pB,c=pf(this.hot,e,t);"top"===o?(r=this.hot._createCellCoords(a,h),n=this.hot._createCellCoords(wt({edge:o,target:c.row,oppositeIndex:a}),l)):"bottom"===o?(r=this.hot._createCellCoords(s,l),n=this.hot._createCellCoords(wt({edge:o,target:c.row,oppositeIndex:s}),h)):"start"===o?(r=this.hot._createCellCoords(a,h),n=this.hot._createCellCoords(s,wt({edge:o,target:c.col,oppositeIndex:h}))):(r=this.hot._createCellCoords(s,l),n=this.hot._createCellCoords(a,wt({edge:o,target:c.col,oppositeIndex:l})));let g=this.hot.selection.getSelectedRange().peekByIndex(i);if(!g)return;let p=Math.min(Math.max(d,Math.min(r.row,n.row)),Math.max(r.row,n.row)),m=Math.min(Math.max(u,Math.min(r.col,n.col)),Math.max(r.col,n.col));g.setFrom(r),g.setTo(r),g.setHighlight(this.hot._createCellCoords(p,m)),this.hot.selection.setRangeEnd(n,i)}#mv=()=>{this.#pB||this.hot.selection.setHandlesHoveredLayer(null)};#mR=()=>{!this.#pB&&this.#my&&this.hot.selection.setHandlesHoveredLayer(this.hot.selection.getLayerContaining(this.#my))};#pW=()=>{this.#pB&&(this.#pB=null,this.#pz=null,this.eventManager.removeEventListener(this.hot.rootDocument.documentElement,"mousemove",this.#aV),this.eventManager.removeEventListener(this.hot.rootDocument.documentElement,"mouseup",this.#pW),ru(this.hot.rootElement,["ht__resizing-selection--top","ht__resizing-selection--bottom","ht__resizing-selection--start","ht__resizing-selection--end"]),this.hot.rootDocument.body.style.cursor=this.#pU)}}),oY(wa),oY(class e extends pa{static get PLUGIN_KEY(){return"touchScroll"}static get PLUGIN_PRIORITY(){return 200}static get SETTING_KEYS(){return!0}scrollbars=[];clones=[];lockedCollection=!1;freezeOverlays=!1;isEnabled(){return tM()}enablePlugin(){this.enabled||(this.addHook("afterViewRender",this.#gm),this.registerEvents(),super.enablePlugin())}updatePlugin(){this.lockedCollection=!1,super.updatePlugin()}disablePlugin(){super.disablePlugin()}registerEvents(){this.addHook("beforeTouchScroll",this.#mT),this.addHook("afterMomentumScroll",this.#mA)}#gm=()=>{if(this.lockedCollection)return;let{topOverlay:e,bottomOverlay:t,inlineStartOverlay:r,topInlineStartCornerOverlay:n,bottomInlineStartCornerOverlay:o}=this.hot.view._wt.wtOverlays;this.lockedCollection=!0,this.scrollbars.length=0,this.scrollbars.push(e),t.clone&&this.scrollbars.push(t),this.scrollbars.push(r),n&&this.scrollbars.push(n),o&&o.clone&&this.scrollbars.push(o),this.clones=[],e.needFullRender&&this.clones.push(e.clone?.wtTable.holder.parentNode),t.needFullRender&&this.clones.push(t.clone?.wtTable.holder.parentNode),r.needFullRender&&this.clones.push(r.clone?.wtTable.holder.parentNode),n&&this.clones.push(n.clone?.wtTable.holder.parentNode),o&&o.clone&&this.clones.push(o.clone.wtTable.holder.parentNode)};#mT=()=>{this.freezeOverlays=!0,J(this.clones,e=>{rd(e,"hide-tween")})};#mA=()=>{this.freezeOverlays=!1,J(this.clones,e=>{ru(e,"hide-tween"),rd(e,"show-tween")}),this.hot._registerTimeout(()=>{J(this.clones,e=>{ru(e,"show-tween")})},400),J(this.scrollbars,e=>{e.refresh(),e.resetFixedPosition()}),this.hot.view._wt.wtOverlays.syncScrollWithMaster()}}),oY(class e extends pa{static get PLUGIN_KEY(){return wl}static get PLUGIN_PRIORITY(){return 330}static get SETTING_KEYS(){return[wl]}trimmedRowsMap=null;isEnabled(){return!!this.hot.getSettings()[wl]}enablePlugin(){this.enabled||(this.trimmedRowsMap=this.hot.rowIndexMapper.createAndRegisterIndexMap("trimRows","trimming"),this.trimmedRowsMap.addLocalHook("init",this.#dL),this.hot.rowIndexMapper.getNumberOfIndexes()>0&&this.#dL(),super.enablePlugin())}updatePlugin(){let e=this.hot.getSettings()[wl];Array.isArray(e)&&this.hot.batchExecution(()=>{this.trimmedRowsMap.clear(),J(e,e=>{this.trimmedRowsMap.setValueAtIndex(e,!0)})},!0),super.updatePlugin()}disablePlugin(){this.hot.rowIndexMapper.unregisterMap("trimRows"),super.disablePlugin()}getTrimmedRows(){return this.trimmedRowsMap.getTrimmedIndexes()}trimRows(e){let t=this.getTrimmedRows(),r=this.isValidConfig(e),n=t;r&&(n=Array.from(new Set(t.concat(e)))),!1!==this.hot.runHooks("beforeTrimRow",t,n,r)&&(r&&this.hot.batchExecution(()=>{J(e,e=>{this.trimmedRowsMap.setValueAtIndex(e,!0)})},!0),this.hot.runHooks("afterTrimRow",t,n,r,r&&n.length>t.length))}trimRow(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];this.trimRows(t)}untrimRows(e){let t=this.getTrimmedRows(),r=this.isValidConfig(e),n=t,o=this.trimmedRowsMap.getValues().slice(),i=e.length>0;r&&i&&(J(e,e=>{o[e]=!1}),n=X(o,(e,t,r)=>(t&&e.push(r),e),[])),!1!==this.hot.runHooks("beforeUntrimRow",t,n,r&&i)&&(r&&i&&this.trimmedRowsMap.setValues(o),this.hot.runHooks("afterUntrimRow",t,n,r&&i,r&&n.length<t.length))}untrimRow(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];this.untrimRows(t)}isTrimmed(e){return this.trimmedRowsMap.getValueAtIndex(e)||!1}untrimAll(){this.untrimRows(this.getTrimmedRows())}isValidConfig(e){let t=this.hot.countSourceRows();return e.every(e=>Number.isInteger(e)&&e>=0&&e<t)}#dL=()=>{let e=this.hot.getSettings()[wl];Array.isArray(e)&&this.hot.batchExecution(()=>{J(e,e=>{this.trimmedRowsMap.setValueAtIndex(e,!0)})},!0)};destroy(){super.destroy()}}),oY(class e extends pa{static get PLUGIN_KEY(){return"undoRedo"}static get PLUGIN_PRIORITY(){return 1e3}static get SETTING_KEYS(){return!0}doneActions=[];undoneActions=[];ignoreNewActions=!1;constructor(e){super(e),function(e,t){[wd,wu,wc,wf,wb,wC,wy,ww,wR,wM,wI,wx,wN].forEach(r=>r.startRegisteringEvents(e,t))}(e,this)}isEnabled(){return!!this.hot.getSettings().undo}enablePlugin(){this.enabled||(this.addHook("afterChange",this.#of),this.registerShortcuts(),super.enablePlugin())}disablePlugin(){super.disablePlugin(),this.clear(),this.unregisterShortcuts()}registerShortcuts(){let e=this.hot.getShortcutManager().getContext("grid");e?.addShortcuts([{keys:[["Control/Meta","z"]],callback:()=>{this.undo()}},{keys:[["Control/Meta","y"],["Control/Meta","Shift","z"]],callback:()=>{this.redo()}}],{runOnlyIf:e=>!e?.altKey,group:wO})}unregisterShortcuts(){let e=this.hot.getShortcutManager().getContext("grid");e?.removeShortcutsByGroup(wO)}done(e,t){if(this.ignoreNewActions||"UndoRedo.undo"===t||"UndoRedo.redo"===t||"auto"===t)return;let r=this.doneActions.slice();if(!1===this.hot.runHooks("beforeUndoStackChange",r,t))return;let n=e(),o=this.undoneActions.slice();null!==n&&this.doneActions.push(n),this.hot.runHooks("afterUndoStackChange",r,this.doneActions.slice()),this.hot.runHooks("beforeRedoStackChange",o),this.undoneActions.length=0,this.hot.runHooks("afterRedoStackChange",o,this.undoneActions.slice())}undo(){if(!this.isUndoAvailable())return;let e=this.doneActions.slice();this.hot.runHooks("beforeUndoStackChange",e);let t=this.doneActions.pop();this.hot.runHooks("afterUndoStackChange",e,this.doneActions.slice());let r=ta(t);if(!1===this.hot.runHooks("beforeUndo",r))return;this.ignoreNewActions=!0;let n=this.undoneActions.slice();this.hot.runHooks("beforeRedoStackChange",n),t.undo(this.hot,()=>{this.ignoreNewActions=!1,this.undoneActions.push(t)}),this.hot.runHooks("afterRedoStackChange",n,this.undoneActions.slice()),this.hot.runHooks("afterUndo",r)}redo(){if(!this.isRedoAvailable())return;let e=this.undoneActions.slice();this.hot.runHooks("beforeRedoStackChange",e);let t=this.undoneActions.pop();this.hot.runHooks("afterRedoStackChange",e,this.undoneActions.slice());let r=ta(t);if(!1===this.hot.runHooks("beforeRedo",r))return;this.ignoreNewActions=!0;let n=this.doneActions.slice();this.hot.runHooks("beforeUndoStackChange",n),t.redo(this.hot,e=>{this.ignoreNewActions=!1,e?.wasRedone===!1?this.undoneActions.push(t):this.doneActions.push(t)}),this.hot.runHooks("afterUndoStackChange",n,this.doneActions.slice()),this.hot.runHooks("afterRedo",r)}isUndoAvailable(){return this.doneActions.length>0}isRedoAvailable(){return this.undoneActions.length>0}clear(){this.doneActions.length=0,this.undoneActions.length=0}#of=(e,t)=>{"loadData"===t&&this.clear()};destroy(){this.clear(),this.doneActions=[],this.undoneActions=[],super.destroy()}}),oY(wU),oY(class e extends pa{static get PLUGIN_KEY(){return wz}static get PLUGIN_PRIORITY(){return 350}static get DEFAULT_SETTINGS(){return{icon:`<svg class="${ga}__icon-svg" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 16 16"><path stroke="currentColor" stroke-width="2" d="M15 8a7 7 0 1 1-3.5-6.062"></path></svg>`,title:void 0,description:""}}static get SETTINGS_VALIDATORS(){return{icon:e=>"string"==typeof e,title:e=>"string"==typeof e,description:e=>"string"==typeof e}}#mM=null;isEnabled(){return!!this.hot.getSettings()[wz]}enablePlugin(){this.enabled||(null===this.#mM&&(this.#mM=this.hot.getPlugin("dialog"),this.#mM?.isEnabled()||(this.hot.getSettings().dialog=!0),this.hot.addHook("afterDialogFocus",()=>this.#mI())),super.enablePlugin())}updatePlugin(){this.disablePlugin(),this.enablePlugin(),super.updatePlugin()}disablePlugin(){this.hide(),super.disablePlugin()}isVisible(){return this.#mM?.isVisible()??!1}show(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.isEnabled()&&this.#mM&&this.#mM?.isEnabled()&&(this.isVisible()?this.update(e):!1!==this.hot.runHooks("beforeLoadingShow")&&(this.update(e),this.#mM.show(),this.hot.runHooks("afterLoadingShow")))}hide(){this.#mM&&this.#mM?.isEnabled()&&this.isVisible()&&!1!==this.hot.runHooks("beforeLoadingHide")&&(this.#mM.hide(),this.hot.runHooks("afterLoadingHide"))}update(e){if(!this.isEnabled()||!this.#mM||!this.#mM?.isEnabled())return;this.updatePluginSettings(e);let t=this.hot.guid,r=this.getSetting("icon"),n=this.getSetting("title")??this.hot.getTranslatedPhrase(hf),o=this.getSetting("description"),i=function(e){let{id:t,icon:r,title:n,description:o}=e;return`
    <div class="${ga}__content">
      <i class="${ga}__icon">${r}</i>
      <div class="${ga}__text">
        <h2 id="${t}-${wz}-title" class="${ga}__title">${op(n)}</h2>
        ${o?`<p id="${t}-${wz}-description" class="${ga}__description">${op(o)}</p>`:""}
      </div>
    </div>
  `}({id:t,icon:r,title:n,description:o});this.#mM.update({content:i,customClassName:ga,background:0===this.hot.countSourceRows()?"solid":"semi-transparent",a11y:{role:"alertdialog",ariaLabelledby:`${t}-${wz}-title`,ariaDescribedby:o?`${t}-${wz}-description`:void 0}})}#mI(){this.#mM.focus()}destroy(){this.#mM=null,super.destroy()}}),oY(wQ),oY(class e extends pa{static get PLUGIN_KEY(){return w2}static get PLUGIN_PRIORITY(){return 370}static get DEFAULT_SETTINGS(){return{message:void 0}}static get SETTINGS_VALIDATORS(){return{message:e=>"string"==typeof e||"function"==typeof e||void 0===e||!!tc(e)&&(void 0===e.title||"string"==typeof e.title)&&(void 0===e.description||"string"==typeof e.description)&&(void 0===e.buttons||Array.isArray(e.buttons)&&e.buttons.every(e=>"object"==typeof e&&"string"==typeof e.text&&w_(e.type)&&"function"==typeof e.callback))}}#gc=!1;#gu=null;#mx=!1;#gg=null;#mN=!1;isEnabled(){return!!this.hot.getSettings()[w2]}enablePlugin(){this.enabled||(this.#gu||(this.#gu=new w1({gridContainer:this.hot.rootGridElement,rootDocument:this.hot.rootDocument}),this.#gp(),this.#os()),this.addHook("afterInit",this.#sf),this.addHook("afterRender",this.#r7),this.addHook("afterRowSequenceCacheUpdate",()=>{this.#mO()}),this.addHook("afterColumnSequenceCacheUpdate",()=>{this.#mO()}),this.addHook("beforeFilter",this.#ar),this.addHook("beforeDataProviderFetch",e=>{e.skipLoading||this.#mk()}),this.addHook("afterDataProviderFetch",()=>this.#mH()),this.addHook("afterDataProviderFetchError",()=>this.#mH()),super.enablePlugin(),this.#mO())}updatePlugin(){this.disablePlugin(),this.enablePlugin(),this.#m_(),this.isVisible()&&this.#gu?.show(),super.updatePlugin()}disablePlugin(){this.#mN=!1,this.#gf(),this.#gu?.destroy(),this.#gu=null,super.disablePlugin()}isVisible(){return this.#gc}#os(){this.eventManager.addEventListener(this.#gu.getElement(),"wheel",e=>{this.#mL(e)})}#mk(){this.#mN||(this.#mN=!0,this.#mO())}#mH(){this.#mN&&(this.#mN=!1,this.#mP(),this.#mO(),this.hot.render())}#gp(){this.hot.getFocusScopeManager().registerScope(w2,this.#gu.getElement(),{shortcutsContextName:w6,runOnlyIf:()=>this.isVisible(),onActivate:e=>{let t=this.#gu?.getFocusableElements()??[];t.length>0&&("tab_from_above"===e?t[0]?.focus():"tab_from_below"===e&&t[t.length-1]?.focus())}})}#gf(){this.hot.getFocusScopeManager().unregisterScope(w2)}#mD(e){let t,r=this.getSetting("message");if("string"==typeof(t="function"==typeof r?r(e):r)&&(t={title:t}),!t?.title&&!t?.description&&!t?.buttons){let t={};return e===w3.FILTERS?(t.title=this.hot.getTranslatedPhrase(hE),t.description=this.hot.getTranslatedPhrase(hT),t.buttons=[{text:this.hot.getTranslatedPhrase(hA),type:"secondary",callback:()=>{let e=this.hot.getPlugin("filters");e&&(e.clearConditions(),e.filter())}}]):e===w3.LOADING?(t.title=this.hot.getTranslatedPhrase(hM),t.description=this.hot.getTranslatedPhrase(hI)):(t.title=this.hot.getTranslatedPhrase(hv),t.description=this.hot.getTranslatedPhrase(hR)),t}return t}#mO(){if(this.hot.view){if(this.#mN)return void(this.#gc?this.#m_():this.#mF());0===this.hot.view.countRenderableColumns()||0===this.hot.view.countRenderableRows()?this.#mF():this.#mP()}}#mF(){this.#gc||(this.hot.runHooks("beforeEmptyDataStateShow"),this.#m_(),this.#gu?.show(),this.#gc=!0,this.#gg=this.hot.selection.exportSelection(),this.hot.getFocusScopeManager().activateScope(w2),this.hot.runHooks("afterEmptyDataStateShow"))}#m_(){this.#mN?this.#gu?.updateContent(this.#mD(w3.LOADING),!0):this.#mx?this.#gu?.updateContent(this.#mD(w3.FILTERS),!1):this.#gu?.updateContent(this.#mD(w3.UNKNOWN),!1)}#mP(){this.#gc&&(this.hot.runHooks("beforeEmptyDataStateHide"),this.#gu?.hide(),this.#gc=!1,this.hot.getFocusScopeManager().deactivateScope(w2),this.#gg&&this.#gg.ranges.length>0?(this.hot.selection.importSelection({...this.#gg,activeRange:this.#gg.activeRange}),this.hot.view.render(),this.#gg=null):this.hot.selectCell(0,0,void 0,void 0,!1),this.hot.runHooks("afterEmptyDataStateHide"))}#mL(e){let t=e.wheelDeltaX??0,r=Number.isNaN(e.deltaX)?-1*t:e.deltaX;0!==r&&this.hot.view.hasHorizontalScroll()&&!this.hot.view.isHorizontallyScrollableByWindow()&&(this.hot.view.setTableScrollPosition({left:this.hot.view.getTableScrollPosition().left+r}),e.preventDefault())}#sf=()=>{this.#mO(),this.hot.render()};#r7=()=>{this.#gu?.getElement()&&this.isVisible()&&this.hot.view&&(this.#gu.updateSize(this.hot.view,this.#mN),this.#gu.updateClassNames(this.hot.view))};#ar=e=>{this.#mx=e?.length>0,this.isVisible()&&this.#m_()};destroy(){this.#mN=!1,this.#gc=!1,this.#gu?.destroy(),this.#gu=null,this.#mx=!1,this.#gg=null,super.destroy()}}),(i="u">typeof window&&window.jQuery)&&(i.fn.handsontable=function(e){let t;for(var r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];let i=this.first(),s=i.data("handsontable");if("string"!=typeof e){let t=e||{};return s?s.updateSettings(t):(s=new cf.Core(i[0],t),i.data("handsontable",s),s.init()),i}return s&&(void 0!==s[e]?(t=s[e].call(s,...n),"destroy"===e&&i.removeData()):tr(`Handsontable do not provide action: ${e}`)),t}),cf.__GhostTable=pl,cf._getListenersCounter=function(){return n6},cf._getRegisteredMapsCounter=function(){return aO},cf.EventManager=n5;let w4=[s,u,y,S,l,d,g,a,C,h,b,p,f],w9=[c,m];cf.helper={},cf.dom={},J(w4,e=>{J(Object.getOwnPropertyNames(e),t=>{"_"!==t.charAt(0)&&(cf.helper[t]=e[t])})}),J(w9,e=>{J(Object.getOwnPropertyNames(e),t=>{"_"!==t.charAt(0)&&(cf.dom[t]=e[t])})}),cf.cellTypes=cf.cellTypes??{},J(dl(),e=>{cf.cellTypes[e]=dd(e)}),cf.cellTypes.registerCellType=du,cf.cellTypes.getCellType=dd,cf.editors=cf.editors??{},J(n$(),e=>{cf.editors[`${oa(e)}Editor`]=nQ(e)}),cf.editors.registerEditor=nZ,cf.editors.getEditor=nQ,cf.editors.editorFactory=e=>{var t;let r,n,o,i,{init:s,afterOpen:a,afterInit:l,afterClose:h,beforeOpen:d,getValue:u,setValue:c,onFocus:g,shortcuts:p,value:m,render:f,config:b,shortcutsGroup:C,position:y,...w}=e;return t={init(e){Object.assign(e,{value:m,config:b,render:f,position:y,...w}),e._opened=!1,e.container=e.hot.rootDocument.createElement("div"),e.container.style.display="none","portal"===y?e.hot.rootPortalElement.appendChild(e.container):e.hot.rootElement.appendChild(e.container),s(e),e.input||tr("Input is not assigned. Assign it in the init callback."),e.container.appendChild(e.input),"function"==typeof l&&l(e),e.preventCloseElement&&e.preventCloseElement instanceof HTMLElement&&(e.eventManager=new n5(e.hot),e.eventManager.addEventListener(e.preventCloseElement,"mousedown",e=>{e.stopPropagation()})),e.addHook("afterScrollHorizontally",()=>e.refreshDimensions?.()),e.addHook("afterScrollVertically",()=>e.refreshDimensions?.())},getValue:e=>"function"==typeof u?u(e):e.value,setValue(e,t){"function"==typeof c?c(e,t):e.value=t,"function"==typeof f&&f(e)},refreshDimensions(e){if(e.TD=e.getEditedCell(),!e.TD)return void e.close();if(!e._opened)return;let t=e.container.style;if(t.display="block",t.position="absolute","portal"===y){let r=e.TD.getBoundingClientRect();t.top=`${e.hot.rootWindow.pageYOffset+r.top}px`,t[e.hot.isRtl()?"right":"left"]=`${e.hot.rootWindow.pageXOffset+r[e.hot.isRtl()?"right":"left"]}px`}else{let r=e.getEditedCellRect();if(!r)return;t.top=`${r.top}px`,t[e.hot.isRtl()?"right":"left"]=`${r.start}px`,t.width=`${r.width}px`,t.height=`${r.height}px`}},open(e,t){let r;e.container.classList.add("ht_clone_master"),e._opened=!0,e.refreshDimensions?.(),e.hot.getShortcutManager().setActiveContextName("editor"),r=e.hot.getShortcutManager().getContext("editor"),p&&r.addShortcuts(p.map(t=>({...t,relativeToGroup:t.relativeToGroup??"editorManager.handlingEditor",position:t.position??"before",callback:r=>t.callback(e,r)})),{group:C??w5}),a&&a(e,t)},focus(e){if("function"==typeof g)g(e);else{let t=e.container?.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');t?.focus()}},close(e){e._opened=!1,e.container.style.display="none",e.container.classList.remove("ht_clone_master"),e.hot.getShortcutManager().getContext("editor").removeShortcutsByGroup(C??w5),"function"==typeof h&&h(e)},prepare(e,t,r,n,o,i,s){"function"==typeof d?d(e,{row:t,col:r,prop:n,td:o,originalValue:i,cellProperties:s}):e.setValue(i)}},r=n3.prototype.extend(),n=["close","focus","getValue","open","setValue"],o=Object.getOwnPropertyNames(n3.prototype),i=r.prototype,o.forEach(e=>{if(t[e]){let o=r.prototype[e];i[e]=function(){for(var r=arguments.length,i=Array(r),s=0;s<r;s++)i[s]=arguments[s];return n.includes(e)||o.apply(this,i),t[e](this,...i)}}}),Object.keys(t).forEach(e=>{o.includes(e)||(i[e]=function(){for(var r=arguments.length,n=Array(r),o=0;o<r;o++)n[o]=arguments[o];return t[e](this,...n)})}),r},cf.renderers=cf.renderers??{},J(oX(),e=>{let t=oZ(e);"base"===e&&(cf.renderers.cellDecorator=t),cf.renderers[`${oa(e)}Renderer`]=t}),cf.renderers.registerRenderer=oJ,cf.renderers.getRenderer=oZ,cf.renderers.rendererFactory=e=>(t,r,n,o,i,s,a)=>e({instance:t,td:r,row:n,column:o,prop:i,value:s,cellProperties:a}),cf.validators=cf.validators??{},J(o3(),e=>{cf.validators[`${oa(e)}Validator`]=o5(e)}),cf.validators.registerValidator=o4,cf.validators.getValidator=o5,cf.plugins=cf.plugins??{},J(oG(),e=>{cf.plugins[e]=o$(e)}),cf.plugins[`${oa(pa.PLUGIN_KEY)}Plugin`]=pa,cf.plugins.registerPlugin=oY,cf.plugins.getPlugin=o$,cf.themes=cf.themes??{},cf.themes.hasTheme=u2,cf.themes.getTheme=u3,cf.themes.getThemeNames=u6,cf.themes.getThemes=u5,cf.themes.registerTheme=u9,cf.themes.reinitTheme=u7;let w7=cf})(),n=n.default})());