@odoo/o-spreadsheet 17.0.29 → 17.0.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,9 +2,9 @@
2
2
  /**
3
3
  * This file is generated by o-spreadsheet build tools. Do not edit it.
4
4
  * @see https://github.com/odoo/o-spreadsheet
5
- * @version 17.0.29
6
- * @date 2024-07-08T05:40:27.608Z
7
- * @hash 2d467e3
5
+ * @version 17.0.31
6
+ * @date 2024-07-18T14:22:00.324Z
7
+ * @hash c64db0d
8
8
  */
9
9
 
10
10
  'use strict';
@@ -2524,7 +2524,7 @@ function getPredicate(descr, isQuery, locale) {
2524
2524
  operand = descr;
2525
2525
  }
2526
2526
  }
2527
- if (isNumber(operand, locale)) {
2527
+ if (isNumber(operand, locale) || isDateTime(operand, locale)) {
2528
2528
  operand = toNumber(operand, locale);
2529
2529
  }
2530
2530
  else if (operand === "TRUE" || operand === "FALSE") {
@@ -8430,7 +8430,7 @@ function truncateLabel(label) {
8430
8430
  /**
8431
8431
  * Get a default chart js configuration
8432
8432
  */
8433
- function getDefaultChartJsRuntime(chart, labels, fontColor, { format, locale, truncateLabels }) {
8433
+ function getDefaultChartJsRuntime(chart, labels, fontColor, { format, locale, truncateLabels = true }) {
8434
8434
  const options = {
8435
8435
  // https://www.chartjs.org/docs/latest/general/responsive.html
8436
8436
  responsive: true,
@@ -57578,6 +57578,6 @@ exports.setTranslationMethod = setTranslationMethod;
57578
57578
  exports.tokenize = tokenize;
57579
57579
 
57580
57580
 
57581
- __info__.version = "17.0.29";
57582
- __info__.date = "2024-07-08T05:40:27.608Z";
57583
- __info__.hash = "2d467e3";
57581
+ __info__.version = "17.0.31";
57582
+ __info__.date = "2024-07-18T14:22:00.324Z";
57583
+ __info__.hash = "c64db0d";
@@ -2,9 +2,9 @@
2
2
  /**
3
3
  * This file is generated by o-spreadsheet build tools. Do not edit it.
4
4
  * @see https://github.com/odoo/o-spreadsheet
5
- * @version 17.0.29
6
- * @date 2024-07-08T05:40:27.608Z
7
- * @hash 2d467e3
5
+ * @version 17.0.31
6
+ * @date 2024-07-18T14:22:00.324Z
7
+ * @hash c64db0d
8
8
  */
9
9
 
10
10
  import { Component, useRef, onMounted, useEffect, onWillPatch, useState, onWillUpdateProps, onPatched, useComponent, useExternalListener, onWillUnmount, onWillStart, xml, useChildSubEnv, useSubEnv, markRaw } from '@odoo/owl';
@@ -2522,7 +2522,7 @@ function getPredicate(descr, isQuery, locale) {
2522
2522
  operand = descr;
2523
2523
  }
2524
2524
  }
2525
- if (isNumber(operand, locale)) {
2525
+ if (isNumber(operand, locale) || isDateTime(operand, locale)) {
2526
2526
  operand = toNumber(operand, locale);
2527
2527
  }
2528
2528
  else if (operand === "TRUE" || operand === "FALSE") {
@@ -8428,7 +8428,7 @@ function truncateLabel(label) {
8428
8428
  /**
8429
8429
  * Get a default chart js configuration
8430
8430
  */
8431
- function getDefaultChartJsRuntime(chart, labels, fontColor, { format, locale, truncateLabels }) {
8431
+ function getDefaultChartJsRuntime(chart, labels, fontColor, { format, locale, truncateLabels = true }) {
8432
8432
  const options = {
8433
8433
  // https://www.chartjs.org/docs/latest/general/responsive.html
8434
8434
  responsive: true,
@@ -57541,6 +57541,6 @@ const constants = {
57541
57541
  export { AbstractChart, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
57542
57542
 
57543
57543
 
57544
- __info__.version = "17.0.29";
57545
- __info__.date = "2024-07-08T05:40:27.608Z";
57546
- __info__.hash = "2d467e3";
57544
+ __info__.version = "17.0.31";
57545
+ __info__.date = "2024-07-18T14:22:00.324Z";
57546
+ __info__.hash = "c64db0d";
@@ -2,9 +2,9 @@
2
2
  /**
3
3
  * This file is generated by o-spreadsheet build tools. Do not edit it.
4
4
  * @see https://github.com/odoo/o-spreadsheet
5
- * @version 17.0.29
6
- * @date 2024-07-08T05:40:27.608Z
7
- * @hash 2d467e3
5
+ * @version 17.0.31
6
+ * @date 2024-07-18T14:22:00.324Z
7
+ * @hash c64db0d
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -2523,7 +2523,7 @@
2523
2523
  operand = descr;
2524
2524
  }
2525
2525
  }
2526
- if (isNumber(operand, locale)) {
2526
+ if (isNumber(operand, locale) || isDateTime(operand, locale)) {
2527
2527
  operand = toNumber(operand, locale);
2528
2528
  }
2529
2529
  else if (operand === "TRUE" || operand === "FALSE") {
@@ -8429,7 +8429,7 @@
8429
8429
  /**
8430
8430
  * Get a default chart js configuration
8431
8431
  */
8432
- function getDefaultChartJsRuntime(chart, labels, fontColor, { format, locale, truncateLabels }) {
8432
+ function getDefaultChartJsRuntime(chart, labels, fontColor, { format, locale, truncateLabels = true }) {
8433
8433
  const options = {
8434
8434
  // https://www.chartjs.org/docs/latest/general/responsive.html
8435
8435
  responsive: true,
@@ -57577,9 +57577,9 @@
57577
57577
  exports.tokenize = tokenize;
57578
57578
 
57579
57579
 
57580
- __info__.version = "17.0.29";
57581
- __info__.date = "2024-07-08T05:40:27.608Z";
57582
- __info__.hash = "2d467e3";
57580
+ __info__.version = "17.0.31";
57581
+ __info__.date = "2024-07-18T14:22:00.324Z";
57582
+ __info__.hash = "c64db0d";
57583
57583
 
57584
57584
 
57585
57585
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
@@ -1,4 +1,4 @@
1
- !function(e,t){"use strict";const o=e=>e,s=()=>!1;let n=o,i=s;function r(e,...t){if(1!==t.length||"object"!=typeof t[0]||t[0]instanceof String)t.length>0&&(e=e.replace(/\%s/g,(()=>t.shift())));else{const o=t[0];e=e.replace(/\%\(([^\)]+)\)s/g,((e,t)=>o[t]))}return e}const a=function(e,...t){return i()?r(n(e),...t):new l(e,t)};class l extends String{values;constructor(e,t){super(e),this.values=t}valueOf(){const e=super.valueOf();return i()?r(n(e),...this.values):r(e,...this.values)}toString(){return this.valueOf()}}var c,h;!function(e){e.NotAvailable="#N/A",e.InvalidReference="#REF",e.BadExpression="#BAD_EXPR",e.CircularDependency="#CYCLE",e.UnknownFunction="#NAME?",e.GenericError="#ERROR"}(c||(c={})),function(e){e[e.silent=0]="silent",e[e.error=1]="error"}(h||(h={}));class d extends Error{errorType;logLevel;constructor(e,t,o=h.error){super(t),this.errorType=e,this.logLevel=o}get isVerbose(){return this.logLevel>h.silent}}class u extends d{constructor(e){super(c.BadExpression,e)}}class g extends d{constructor(){super(c.CircularDependency,a("Circular reference"))}}class p extends d{constructor(){super(c.InvalidReference,a("Invalid reference"))}}class m extends d{constructor(e=void 0){super(c.NotAvailable,e||a("Data not available"),e?h.error:h.silent)}}class f extends d{constructor(e){super(c.UnknownFunction,a('Unknown function: "%s"',e))}}const b=.5,v="#f5f5f5",S="#F8F9FA",C="#E8EAED",E="#595959",w="#666666",y="#c9ccd2",x="#3266ca",I="#FFFFFF",R="#EBEBEB",T="#CACACA",A=11982760,O="#01666b",_="#188038",M="#E6F4EA",N="#CEEAD6",F="#E0E2E4",D="#4A4F59",L="#999",P="#E2E3E3",k="#BCBCBC",V="#9B359B",U=["#000000","#434343","#666666","#999999","#B7B7B7","#CCCCCC","#D9D9D9","#EFEFEF","#F3F3F3","#FFFFFF","#980000","#FF0000","#FF9900","#FFFF00","#00FF00","#00FFFF","#4A86E8","#0000FF","#9900FF","#FF00FF","#E6B8AF","#F4CCCC","#FCE5CD","#FFF2CC","#D9EAD3","#D0E0E3","#C9DAF8","#CFE2F3","#D9D2E9","#EAD1DC","#DD7E6B","#EA9999","#F9CB9C","#FFE599","#B6D7A8","#A2C4C9","#A4C2F4","#9FC5E8","#B4A7D6","#D5A6BD","#CC4125","#E06666","#F6B26B","#FFD966","#93C47D","#76A5AF","#6D9EEB","#6FA8DC","#8E7CC3","#C27BA0","#A61C00","#CC0000","#E69138","#F1C232","#6AA84F","#45818E","#3C78D8","#3D85C6","#674EA7","#A64D79","#85200C","#990000","#B45F06","#BF9000","#38761D","#134F5C","#1155CC","#0B5394","#351C75","#741B47","#5B0F00","#660000","#783F04","#7F6000","#274E13","#0C343D","#1C4587","#073763","#20124D","#4C1130"],B=26,H=48,z=96,G=23,$=15,W=18,q=14,Z=4,Y=Z,j=21,X=17,K=2*G,Q=250,J={align:"left",verticalAlign:"bottom",wrapping:"overflow",bold:!1,italic:!1,strikethrough:!1,underline:!1,fontSize:10,fillColor:"",textColor:"#000000"},ee=J.verticalAlign,te=J.wrapping,oe="400",se=J.fontSize,ne="'Roboto', arial",ie="thin",re="#000000",ae={style:"thin",color:_},le=c.InvalidReference,ce="START_REVISION",he=1,de=20,ue="??",ge="difference",pe="#00A04A",me="#DC6965",fe=["'","*","?","/","\\","[","]"],be=/'|\*|\?|\/|\\|\[|\]/,ve="|",Se=a("Invalid expression");var Ce;!function(e){e[e.Grid=0]="Grid",e[e.Highlight=5]="Highlight",e[e.HeaderGroupingButton=6]="HeaderGroupingButton",e[e.Figure=10]="Figure",e[e.ScrollBar=15]="ScrollBar",e[e.GridPopover=19]="GridPopover",e[e.GridComposer=20]="GridComposer",e[e.Dropdown=21]="Dropdown",e[e.IconPicker=25]="IconPicker",e[e.TopBarComposer=30]="TopBarComposer",e[e.Popover=35]="Popover",e[e.FigureAnchor=1e3]="FigureAnchor",e[e.FigureSnapLine=1001]="FigureSnapLine"}(Ce||(Ce={}));let Ee=0;function we(){return Ee}const ye="\n",xe=[6,7,8,9,10,11,12,14,18,24,36];function Ie(e){return'"'===e[0]&&(e=e.slice(1)),'"'===e[e.length-1]&&"\\"!==e[e.length-2]?e.slice(0,e.length-1):e}function Re(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Te(e){const t=Array.isArray(e)?[]:{};switch(typeof e){case"object":if(null===e)return e;if(function(e){return"clone"in e&&e.clone instanceof Function}(e))return e.clone();if(!(function(e){return"object"==typeof e&&null!==e&&(e?.constructor===Object||void 0===e?.constructor)}(e)||e instanceof Array))throw new Error("Unsupported type: only objects and arrays are supported");for(const o in e)t[o]=Te(e[o]);return t;case"number":case"string":case"boolean":case"function":case"undefined":return e;default:throw new Error("Unsupported type: "+typeof e)}}function Ae(e){return e.startsWith("'")&&(e=e.slice(1,-1).replace(/''/g,"'")),e}function Oe(e){return e.match(/\w/g)?.length!==e.length&&(e=`'${e}'`),e}function _e(e,t,o){return e<t?t:e>o?o:e}function Me(e,t,o=1){if(t<=e&&o>0)return[];if(0===o)throw new Error("range() step must not be zero");const s=Math.ceil(Math.abs((t-e)/o)),n=Array(s);for(let t=0;t<s;t++)n[t]=e+t*o;return n}function Ne(e){return e.reduce(((e,t,o,s)=>{if(1===Math.abs(t-s[o-1])){e[e.length-1].push(t)}else e.push([t]);return e}),[])}function*Fe(e,t){t.next();for(const o of e){const e=t.next();yield{...o,next:e.done?void 0:e.value}}}const De=/^\[(.+)\]\((.+)\)$/,Le=/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$/;function Pe(e){return De.test(e)}function ke(e){return Le.test(e)}function Ve(e,t){return`[${e}](${t})`}function Ue(e){const t=e.match(De)||[],o=t[1],s=t[2];if(!o||!s)throw new Error(`Could not parse markdown link ${e}.`);return{label:o,url:s}}const Be="o-spreadsheet://";function He(e){return e.startsWith(Be)}function ze(e){return`${Be}${e}`}function Ge(e){if(e.startsWith(Be))return e.substr(Be.length);throw new Error(`${e} is not a valid sheet link`)}function $e(e){return void 0!==e}function We(e){return null!==e}function qe(e){return void 0===e||Object.values(e).every((e=>"object"==typeof e?qe(e):!e))}function Ze(e,t){for(const o in t)if(Qe(t[o],e))return parseInt(o,10);const o=Object.keys(t),s=0===o.length?0:ht(o.map((e=>parseInt(e,10))));return t[s+1]=e,s+1}function Ye(e){let t="";for(let o=0,s=e.length;o<s;o++)t+=e[o];return t}function je(e){let t,o=!1;const s=()=>(o||(t=e instanceof Function?e():e,o=!0),t);return s.map=e=>je((()=>e(s()))),s}function Xe(e,t){let o=e.slice(t).find((e=>e));return o||(o=e.slice(0,t).reverse().find((e=>e))),o||""}function Ke(e,t){return"after"===e?t+1:t}function Qe(e,t){if(e===t)return!0;if(e&&!t||t&&!e)return!1;if(typeof e!=typeof t)return!1;if("object"!=typeof e)return!1;for(const o in t)if(!(o in e)&&void 0!==t[o])return!1;for(const o in e){if(typeof e[o]!=typeof t[o])return!1;if("object"==typeof e[o]){if(!Qe(e[o],t[o]))return!1}else if(e[o]!==t[o])return!1}return!0}function Je(e,t){return t.every((t=>e.includes(t)))}function et(e){const t={...e};return Object.keys(t).forEach((e=>!t[e]&&delete t[e])),t}const tt=["\t","\f","\v",String.fromCharCode(parseInt("00a0",16)),String.fromCharCode(parseInt("1680",16)),String.fromCharCode(parseInt("2000",16)),String.fromCharCode(parseInt("200a",16)),String.fromCharCode(parseInt("2028",16)),String.fromCharCode(parseInt("2029",16)),String.fromCharCode(parseInt("202f",16)),String.fromCharCode(parseInt("205f",16)),String.fromCharCode(parseInt("3000",16)),String.fromCharCode(parseInt("feff",16))],ot=new RegExp(tt.join("|")+"|(\r\n|\r|\n)","g");function st(e){return e?ot.test(e)?e.replace(ot,((e,t)=>t?ye:" ")):e:""}function nt(e){const t=Array.from(e).sort(((e,t)=>e-t));for(let e=1;e<t.length;e++)if(t[e]-t[e-1]!=1)return!1;return!0}class it extends Set{addMany(e){for(const t of e)super.add(t);return this}deleteMany(e){for(const t of e)super.delete(t)}}function rt(e){const t=new Map,o=e.name?e.name+" (memoized)":"memoized";return{[o]:(...o)=>(t.has(o[0])||t.set(o[0],e(...o)),t.get(o[0]))}[o]}function at(e,t){return e.filter(((e,o)=>!t.includes(o)))}function lt(e){return e.split("\n").map((e=>e.replace(/\s+/g," ").trim())).join("\n")}function ct(e,t,o){return t>o?ct(e,o,t):e>=t&&e<=o}function ht(e){let t=e.length;if(t<1e5)return Math.max(...e);let o=-1/0;for(;t--;)o=e[t]>o?e[t]:o;return o}function dt(e){let t=e.length;if(t<1e5)return Math.min(...e);let o=1/0;for(;t--;)o=e[t]<o?e[t]:o;return o}const ut=/rgba?\(|\s+|\)/gi,gt=/^#([A-F\d]{2}){3,4}$/,pt=["#eb6d00","#0074d9","#ad8e00","#169ed4","#b10dc9","#00a82d","#00a3a3","#f012be","#3d9970","#111111","#62A300","#ff4136","#949494","#85144b","#001f3f"];function mt(e){return ft(e.toString(16).padStart(6,"0"))}function ft(e){let t=e;if(e.startsWith("rgb")?t=function(e){const t=e.replace(ut,"").split(",");let o=255;if(3!==t.length&&4!==t.length)throw new Error("invalid color");if(4===t.length){const e=parseFloat(t.pop()||"1");o=Math.round(255*(e||1))}const s=t.map((e=>parseInt(e,10)));255!==o&&s.push(o);return"#"+Ye(s.map((e=>e.toString(16).padStart(2,"0")))).toUpperCase()}(e):(t=e.replace("#","").toUpperCase(),3!==t.length&&4!==t.length||(t=t.split("").reduce(((e,t)=>e+t+t),"")),t=`#${t}`),!gt.test(t))throw new Error(`invalid color input: ${e}`);return t}function bt(e){try{return ft(e),!0}catch(e){return!1}}const vt=e=>e>=0&&e<=255;function St(e,t,o,s=1){if(!vt(e)||!vt(t)||!vt(o)||s<0||s>1)throw new Error(`Invalid RGBA values ${[e,t,o,s]}`);return{a:s,b:o,g:t,r:e}}function Ct(e){let{r:t,g:o,b:s}=wt(e);t/=255,o/=255,s/=255;const n=e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4;return.2126*n(t)+.7152*n(o)+.0722*n(s)}function Et(e){let t=e.r.toString(16),o=e.g.toString(16),s=e.b.toString(16),n=Math.round(255*e.a).toString(16);return 1===t.length&&(t="0"+t),1===o.length&&(o="0"+o),1===s.length&&(s="0"+s),1===n.length&&(n="0"+n),"ff"===n&&(n=""),("#"+t+o+s+n).toUpperCase()}function wt(e){let t,o,s,n;if(7===(e=ft(e)).length)t=parseInt(e[1]+e[2],16),o=parseInt(e[3]+e[4],16),s=parseInt(e[5]+e[6],16),n=255;else{if(9!==e.length)throw new Error("Invalid color");t=parseInt(e[1]+e[2],16),o=parseInt(e[3]+e[4],16),s=parseInt(e[5]+e[6],16),n=parseInt(e[7]+e[8],16)}return n=+(n/255).toFixed(3),{a:n,r:t,g:o,b:s}}function yt(e){(e={...e}).s/=100,e.l/=100;let t=(1-Math.abs(2*e.l-1))*e.s,o=t*(1-Math.abs(e.h/60%2-1)),s=e.l-t/2,n=0,i=0,r=0;return 0<=e.h&&e.h<60?(n=t,i=o,r=0):60<=e.h&&e.h<120?(n=o,i=t,r=0):120<=e.h&&e.h<180?(n=0,i=t,r=o):180<=e.h&&e.h<240?(n=0,i=o,r=t):240<=e.h&&e.h<300?(n=o,i=0,r=t):300<=e.h&&e.h<360&&(n=t,i=0,r=o),n=Math.round(255*(n+s)),i=Math.round(255*(i+s)),r=Math.round(255*(r+s)),{a:e.a,r:n,g:i,b:r}}function xt(e){const t=e.r/255,o=e.g/255,s=e.b/255;let n=Math.min(t,o,s),i=Math.max(t,o,s),r=i-n,a=0,l=0,c=0;return a=0===r?0:i===t?(o-s)/r%6:i===o?(s-t)/r+2:(t-o)/r+4,a=Math.round(60*a),a<0&&(a+=360),c=(i+n)/2,l=0===r?0:r/(1-Math.abs(2*c-1)),l=+(100*l).toFixed(1),c=+(100*c).toFixed(1),{a:e.a,h:a,s:l,l:c}}function It(e){return Et(yt(e))}function Rt(e){return xt(wt(e))}function Tt(e){if(e<0)throw new Error(`number must be positive. Got ${e}`);return e<26?String.fromCharCode(65+e):Tt(Math.floor(e/26)-1)+Tt(e%26)}const At={};for(const BT of"ABCDEFGHIJKLMNOPQRSTUVWXYZ"){const HT=BT.charCodeAt(0)-64;At[BT]=HT,At[BT.toLowerCase()]=HT}function Ot(e){let t=-1;let o=1;for(let s=e.length-1;s>=0;s--){t+=At[e[s]]*o,o*=26}return t}function _t(e){return e>="A"&&e<="Z"||e>="a"&&e<="z"}function Mt(e){return e>="0"&&e<="9"}function Nt(e){let t;e=e.trim();for(let o=0;o<e.length;o++){const s=e[o];if(!t){if("$"===s&&0===o||_t(s))continue;t=o}if(!Mt(s)){if("$"===s&&o===t)continue;throw new Error(`Invalid cell description: ${e}`)}}if(!t||t===e.length)throw new Error(`Invalid cell description: ${e}`);const o="$"===e[0]?e.slice(1,t):e.slice(0,t),s="$"===e[t]?e.slice(t+1):e.slice(t);if(o.length<1||o.length>3||s.length<1||s.length>7)throw new Error(`Invalid cell description: ${e}`);const n=Ot(o),i=Number(s)-1;if(isNaN(i))throw new Error(`Invalid cell description: ${e}`);return{col:n,row:i}}function Ft(e,t,o={colFixed:!1,rowFixed:!1}){return(o.colFixed?"$":"")+Tt(e)+(o.rowFixed?"$":"")+String(t+1)}class Dt{jsDate;constructor(e,t,o,s=0,n=0,i=0){this.jsDate=new Date(Date.UTC(e,t,o,s,n,i,0))}static fromTimestamp(e){const t=new Date(e);return new Dt(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds())}static now(){const e=new Date;return new Dt(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds())}toString(){return this.jsDate.toString()}toLocaleDateString(){return this.jsDate.toLocaleDateString()}getTime(){return this.jsDate.getTime()}getFullYear(){return this.jsDate.getUTCFullYear()}getMonth(){return this.jsDate.getUTCMonth()}getDate(){return this.jsDate.getUTCDate()}getDay(){return this.jsDate.getUTCDay()}getHours(){return this.jsDate.getUTCHours()}getMinutes(){return this.jsDate.getUTCMinutes()}getSeconds(){return this.jsDate.getUTCSeconds()}setFullYear(e){return this.jsDate.setUTCFullYear(e)}setMonth(e){return this.jsDate.setUTCMonth(e)}setDate(e){return this.jsDate.setUTCDate(e)}setHours(e){return this.jsDate.setUTCHours(e)}setMinutes(e){return this.jsDate.setUTCMinutes(e)}setSeconds(e){return this.jsDate.setUTCSeconds(e)}}const Lt=new Dt(1899,11,30),Pt=864e5,kt=2e3,Vt=Dt.now().getFullYear(),Ut=Dt.now().getMonth(),Bt=Dt.fromTimestamp(0).getTime()-Lt.getTime(),Ht=/^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/,zt=/^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/,Gt=/\/|-|\s/,$t=/^(\d{1,4})[\/-\s](\d{1,4})([\/-\s](\d{1,4}))?$/,Wt=/((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;function qt(e,t){switch(typeof e){case"number":return e;case"string":return Zt(e,t)?jt(e,t)?.value:!e||isNaN(Number(e))?void 0:Number(e);default:return}}function Zt(e,t){return null!==jt(e,t)}const Yt=new Map;function jt(e,t){return Yt.has(t)||Yt.set(t,new Map),Yt.get(t).has(e)||Yt.get(t).set(e,function(e,t){e=e.trim();let o=null;const s=e.match(Wt);if(s){if(o=function(e){if(e=e.trim(),Wt.test(e)){const t=/AM/i.test(e),o=/PM/i.test(e),s=(t||o?e.substring(0,e.length-2).trim():e).split(/:/),n=s.length>=2,i=3===s.length;let r=Number(s[0]),a=n?Number(s[1]):0,l=i?Number(s[2]):0,c=i?"hh:mm:ss":"hh:mm";if(t||o)c+=" a";else if(!n)return null;r>=12&&t?r-=12:r<12&&o&&(r+=12),a+=Math.floor(l/60),l%=60,r+=Math.floor(a/60),a%=60,r>=24&&(c="hhhh:mm:ss");return{value:r/24+a/1440+l/86400,format:c,jsDate:new Dt(1899,11,30,r,a,l)}}return null}(s[0]),null===o)return null;e=e.replace(s[0],"").trim()}let n=null;const i=function(e,t){const o=e.match($t);if(!o)return null;const[,s,n,,i]=o;if(s.length>2&&i&&i.length>2)return null;if(s.length>2)return{year:s,month:n,day:i,dateString:e,type:"ymd"};const r=function(e){switch(e.dateFormat[0]){case"d":return"dmy";case"m":return"mdy";case"y":return"ymd"}throw new Error("Invalid date format in locale")}(t);if(!i)return n.length>2?{month:s,year:n,day:void 0,dateString:e,type:r}:"dmy"===r?{day:s,month:n,year:i,dateString:e,type:"dmy"}:{month:s,day:n,year:i,dateString:e,type:"mdy"};if(i.length>2)return"mdy"===r?{month:s,day:n,year:i,dateString:e,type:"mdy"}:{day:s,month:n,year:i,dateString:e,type:"dmy"};if("mdy"===r)return{month:s,day:n,year:i,dateString:e,type:"mdy"};if("ymd"===r)return{year:s,month:n,day:i,dateString:e,type:"ymd"};if("dmy"===r)return{day:s,month:n,year:i,dateString:e,type:"dmy"};return null}(e,t);if(i){const t=i.dateString.match(Gt)[0];if(n=function(e,t){let{year:o,month:s,day:n}=e;const i=function(e){if(!e)return Ut;const t=Number(e);if(t>=1&&t<=12)return t-1;return null}(s),r=function(e){if(!e)return 1;const t=Number(e);if(t>=0&&t<=31)return t;return null}(n),a=function(e){if(!e)return Vt;const t=Number(e);switch(e.length){case 1:return kt+t;case 2:return kt+(kt+t>Vt+10?-100:0)+t;case 3:case 4:return t}return null}(o);if(null===a||null===i||null===r)return null;const l=2===s?.length&&i+1<10||2===n?.length&&r<10,c=2!==o?.length,h=new Dt(a,i,r);if(h.getMonth()!==i||h.getDate()!==r)return null;const d=h.getTime()-Lt.getTime(),u=function(e,t,o,s){const n=e.year?s?"yyyy":"yy":void 0,i=e.month?o?"mm":"m":void 0,r=e.day?o?"dd":"d":void 0;switch(e.type){case"mdy":return[i,r,n].filter($e).join(t);case"ymd":return[n,i,r].filter($e).join(t);case"dmy":return[r,i,n].filter($e).join(t)}}(e,t,l,c);return{value:Math.round(d/Pt),format:u,jsDate:h}}(i,t),null===n)return null;e=e.replace(i.dateString,"").trim()}if(""!==e||!n&&!o)return null;if(n&&n.jsDate&&o&&o.jsDate)return{value:n.value+o.value,format:n.format+" "+("hhhh:mm:ss"===o.format?"hh:mm:ss":o.format),jsDate:new Dt(n.jsDate.getFullYear()+o.jsDate.getFullYear()-1899,n.jsDate.getMonth()+o.jsDate.getMonth()-11,n.jsDate.getDate()+o.jsDate.getDate()-30,n.jsDate.getHours()+o.jsDate.getHours(),n.jsDate.getMinutes()+o.jsDate.getMinutes(),n.jsDate.getSeconds()+o.jsDate.getSeconds())};return n||o}(e,t)),Yt.get(t).get(e)}function Xt(e){const t=Math.trunc(e);let o=Dt.fromTimestamp(t*Pt-Bt),s=e-t;s=s<0?1+s:s;const n=Math.round(24*s),i=Math.round(24*(s-n/24)*60),r=Math.round(24*(s-n/24-i/24/60)*60*60);return o.setHours(n),o.setMinutes(i),o.setSeconds(r),o}function Kt(e){return Math.round(Qt(e))}function Qt(e){return(e.getTime()-Lt.getTime())/Pt}function Jt(e){return new Dt(e.getFullYear(),e.getMonth()+1,0).getDate()}function eo(e){return Jt(e)===e.getDate()}function to(e,t,o){const s=e.getFullYear(),n=e.getMonth(),i=e.getDate(),r=new Dt(s,n+t,1);return o&&i===Jt(e)||i>Jt(r)?r.setDate(Jt(r)):r.setDate(i),r}function oo(e){const t=Math.trunc(e);return t%4==0&&t%100!=0||t%400==0}function so(e,t,o){if(e===t)return 0;if(e>t){const o=t;t=e,e=o}const s=Xt(e),n=Xt(t);let i=s.getDate(),r=n.getDate();const a=s.getMonth(),l=n.getMonth(),c=s.getFullYear(),h=n.getFullYear();let d=0,u=0;switch(o){case 0:31===i&&(i=30),30===i&&31===r&&(r=30),1===a&&i===(oo(c)?29:28)&&(i=30,1===l&&r===(oo(h)?29:28)&&(r=30)),d=c+(30*a+i)/360,u=h+(30*l+r)/360;break;case 1:let o=365;const s=c===h;if(!s&&!(c+1===h)||!s&&a<l||!s&&a===l&&i<r){let e=0,t=0;for(let o=c;o<=h;o++)e++,t+=oo(o)?366:365;o=t/e}else s?oo(c)&&(o=366):(oo(c)&&a<2&&(o=366),oo(h)&&(l>1||1===l&&29===r)&&(o=366));d=e/o,u=t/o;break;case 2:d=e/360,u=t/360;break;case 3:d=e/365,u=t/365;break;case 4:31===i&&(i=30),31===r&&(r=30),d=c+(30*a+i)/360,u=h+(30*l+r)/360}return u-d}function no(e,t){const o=12*(t.getFullYear()-e.getFullYear())+t.getMonth()-e.getMonth();return e.getDate()>t.getDate()?o-1:o}function io(e,t){const o=e.getTime(),s=t.getTime();return Math.floor((s-o)/Pt)}function ro(e,t){const o=t.getFullYear()-e.getFullYear(),s=e.getMonth(),n=t.getMonth(),i=e.getDate(),r=t.getDate();return n>s||n===s&&r>=i?o:o-1}function ao(e,t,o){return t>o?ao(e,o,t):(e=Math.trunc(e),t=Math.trunc(t),o=Math.trunc(o),e>=t&&e<=o)}const lo=rt((function(e){return e=Re(e),new RegExp(`(^-?\\d+(${e}?\\d*(e\\d+)?)?|^-?${e}\\d+)(?!\\w|!)`)})),co=rt((function(e){const t=Re(e.decimalSeparator),o="(\\s*"+`(\\d+(${Re(e.thousandsSeparator||"")}\\d{3,})*(${t}\\d*)?)`+"|"+`(${t}\\d+)`+")(e(\\+|-)?\\d+)?(\\s*%)?",s="(\\s*-)?",n="(\\s*[\\$€])?",i="^(("+[s+n+o,s+o+n,n+s+o].join(")|(")+"))$";return new RegExp(i,"i")}));function ho(e,t){return!!e&&co(t).test(e.trim())}const uo=rt((function(e){return new RegExp(`[$€${Re(e.thousandsSeparator||"")}]`,"g")}));function go(e,t){"."!==t.decimalSeparator&&(e=e.replace(t.decimalSeparator,".")),e=e.replace(uo(t),"");let o=Number(e);return isNaN(o)&&e.includes("%")&&(o=Number(e.split("%")[0]),!isNaN(o))?o/100:o}function po(e,t,o){const s=[...e].sort(((e,t)=>e-t));let n=(s.length+(o?-1:1))*t;if(o||n--,Number.isInteger(n))return s[n];const i=Math.ceil(n),r=Math.floor(n);return s[i]*(n-r)+s[r]*(i-n)}var mo,fo;!function(e){e.boolean="boolean",e.number="number",e.text="text",e.empty="empty",e.error="error"}(mo||(mo={})),function(e){e.PlainText="text/plain",e.Html="text/html"}(fo||(fo={}));const bo=new Set(["RENAME_SHEET","DELETE_SHEET","CREATE_SHEET","ADD_COLUMNS_ROWS","REMOVE_COLUMNS_ROWS","UNDO","REDO","ADD_MERGE","UPDATE_LOCALE"]),vo=new Set([...bo,"MOVE_RANGES"]),So=new Set([...bo,"DUPLICATE_SHEET","EVALUATE_CELLS","ADD_CONDITIONAL_FORMAT","REMOVE_CONDITIONAL_FORMAT","CHANGE_CONDITIONAL_FORMAT_PRIORITY"]),Co=new Set(["START","ACTIVATE_SHEET","COPY","RESIZE_SHEETVIEW","SET_VIEWPORT_OFFSET","SELECT_SEARCH_NEXT_MATCH","SELECT_SEARCH_PREVIOUS_MATCH","UPDATE_SEARCH","CLEAR_SEARCH","EVALUATE_CELLS","SET_CURRENT_CONTENT","SET_FORMULA_VISIBILITY","OPEN_CELL_POPOVER","CLOSE_CELL_POPOVER","UPDATE_FILTER"]),Eo=new Set(["UPDATE_CELL","UPDATE_CELL_POSITION","CLEAR_CELL","DELETE_CONTENT","ADD_COLUMNS_ROWS","REMOVE_COLUMNS_ROWS","RESIZE_COLUMNS_ROWS","HIDE_COLUMNS_ROWS","UNHIDE_COLUMNS_ROWS","SET_GRID_LINES_VISIBILITY","UNFREEZE_COLUMNS","UNFREEZE_ROWS","FREEZE_COLUMNS","FREEZE_ROWS","UNFREEZE_COLUMNS_ROWS","ADD_MERGE","REMOVE_MERGE","CREATE_SHEET","DELETE_SHEET","DUPLICATE_SHEET","MOVE_SHEET","RENAME_SHEET","HIDE_SHEET","SHOW_SHEET","MOVE_RANGES","ADD_CONDITIONAL_FORMAT","REMOVE_CONDITIONAL_FORMAT","CHANGE_CONDITIONAL_FORMAT_PRIORITY","CREATE_FIGURE","DELETE_FIGURE","UPDATE_FIGURE","SET_FORMATTING","CLEAR_FORMATTING","SET_BORDER","SET_ZONE_BORDERS","CREATE_CHART","UPDATE_CHART","CREATE_FILTER_TABLE","REMOVE_FILTER_TABLE","CREATE_IMAGE","GROUP_HEADERS","UNGROUP_HEADERS","UNFOLD_HEADER_GROUP","FOLD_HEADER_GROUP","FOLD_ALL_HEADER_GROUPS","UNFOLD_ALL_HEADER_GROUPS","UNFOLD_HEADER_GROUPS_IN_ZONE","FOLD_HEADER_GROUPS_IN_ZONE","ADD_DATA_VALIDATION_RULE","REMOVE_DATA_VALIDATION_RULE","UPDATE_LOCALE"]);function wo(e){return Eo.has(e.type)}class yo{reasons;constructor(e=[]){Array.isArray(e)||(e=[e]),e=[...new Set(e)],this.reasons=e.filter((e=>"Success"!==e))}static get Success(){return xo}get isSuccessful(){return 0===this.reasons.length}isCancelledBecause(e){return this.reasons.includes(e)}}const xo=new yo;var Io;e.CommandResult=void 0,(Io=e.CommandResult||(e.CommandResult={})).Success="Success",Io.CancelledForUnknownReason="CancelledForUnknownReason",Io.WillRemoveExistingMerge="WillRemoveExistingMerge",Io.MergeIsDestructive="MergeIsDestructive",Io.CellIsMerged="CellIsMerged",Io.InvalidTarget="InvalidTarget",Io.EmptyUndoStack="EmptyUndoStack",Io.EmptyRedoStack="EmptyRedoStack",Io.NotEnoughElements="NotEnoughElements",Io.NotEnoughSheets="NotEnoughSheets",Io.MissingSheetName="MissingSheetName",Io.UnchangedSheetName="UnchangedSheetName",Io.DuplicatedSheetName="DuplicatedSheetName",Io.DuplicatedSheetId="DuplicatedSheetId",Io.ForbiddenCharactersInSheetName="ForbiddenCharactersInSheetName",Io.WrongSheetMove="WrongSheetMove",Io.WrongSheetPosition="WrongSheetPosition",Io.InvalidAnchorZone="InvalidAnchorZone",Io.SelectionOutOfBound="SelectionOutOfBound",Io.TargetOutOfSheet="TargetOutOfSheet",Io.WrongCutSelection="WrongCutSelection",Io.WrongPasteSelection="WrongPasteSelection",Io.WrongPasteOption="WrongPasteOption",Io.WrongFigurePasteOption="WrongFigurePasteOption",Io.EmptyClipboard="EmptyClipboard",Io.EmptyRange="EmptyRange",Io.InvalidRange="InvalidRange",Io.InvalidZones="InvalidZones",Io.InvalidSheetId="InvalidSheetId",Io.InvalidFigureId="InvalidFigureId",Io.InputAlreadyFocused="InputAlreadyFocused",Io.MaximumRangesReached="MaximumRangesReached",Io.MinimumRangesReached="MinimumRangesReached",Io.InvalidChartDefinition="InvalidChartDefinition",Io.InvalidDataSet="InvalidDataSet",Io.InvalidLabelRange="InvalidLabelRange",Io.InvalidScorecardKeyValue="InvalidScorecardKeyValue",Io.InvalidScorecardBaseline="InvalidScorecardBaseline",Io.InvalidGaugeDataRange="InvalidGaugeDataRange",Io.EmptyGaugeRangeMin="EmptyGaugeRangeMin",Io.GaugeRangeMinNaN="GaugeRangeMinNaN",Io.EmptyGaugeRangeMax="EmptyGaugeRangeMax",Io.GaugeRangeMaxNaN="GaugeRangeMaxNaN",Io.GaugeRangeMinBiggerThanRangeMax="GaugeRangeMinBiggerThanRangeMax",Io.GaugeLowerInflectionPointNaN="GaugeLowerInflectionPointNaN",Io.GaugeUpperInflectionPointNaN="GaugeUpperInflectionPointNaN",Io.GaugeLowerBiggerThanUpper="GaugeLowerBiggerThanUpper",Io.InvalidAutofillSelection="InvalidAutofillSelection",Io.WrongComposerSelection="WrongComposerSelection",Io.MinBiggerThanMax="MinBiggerThanMax",Io.LowerBiggerThanUpper="LowerBiggerThanUpper",Io.MidBiggerThanMax="MidBiggerThanMax",Io.MinBiggerThanMid="MinBiggerThanMid",Io.FirstArgMissing="FirstArgMissing",Io.SecondArgMissing="SecondArgMissing",Io.MinNaN="MinNaN",Io.MidNaN="MidNaN",Io.MaxNaN="MaxNaN",Io.ValueUpperInflectionNaN="ValueUpperInflectionNaN",Io.ValueLowerInflectionNaN="ValueLowerInflectionNaN",Io.MinInvalidFormula="MinInvalidFormula",Io.MidInvalidFormula="MidInvalidFormula",Io.MaxInvalidFormula="MaxInvalidFormula",Io.ValueUpperInvalidFormula="ValueUpperInvalidFormula",Io.ValueLowerInvalidFormula="ValueLowerInvalidFormula",Io.InvalidSortZone="InvalidSortZone",Io.WaitingSessionConfirmation="WaitingSessionConfirmation",Io.MergeOverlap="MergeOverlap",Io.TooManyHiddenElements="TooManyHiddenElements",Io.Readonly="Readonly",Io.InvalidViewportSize="InvalidViewportSize",Io.InvalidScrollingDirection="InvalidScrollingDirection",Io.FigureDoesNotExist="FigureDoesNotExist",Io.InvalidConditionalFormatId="InvalidConditionalFormatId",Io.InvalidCellPopover="InvalidCellPopover",Io.EmptyTarget="EmptyTarget",Io.InvalidFreezeQuantity="InvalidFreezeQuantity",Io.FrozenPaneOverlap="FrozenPaneOverlap",Io.ValuesNotChanged="ValuesNotChanged",Io.InvalidFilterZone="InvalidFilterZone",Io.FilterOverlap="FilterOverlap",Io.FilterNotFound="FilterNotFound",Io.MergeInFilter="MergeInFilter",Io.NonContinuousTargets="NonContinuousTargets",Io.DuplicatedFigureId="DuplicatedFigureId",Io.InvalidSelectionStep="InvalidSelectionStep",Io.DuplicatedChartId="DuplicatedChartId",Io.ChartDoesNotExist="ChartDoesNotExist",Io.InvalidHeaderIndex="InvalidHeaderIndex",Io.InvalidQuantity="InvalidQuantity",Io.MoreThanOneColumnSelected="MoreThanOneColumnSelected",Io.EmptySplitSeparator="EmptySplitSeparator",Io.SplitWillOverwriteContent="SplitWillOverwriteContent",Io.NoSplitSeparatorInSelection="NoSplitSeparatorInSelection",Io.NoActiveSheet="NoActiveSheet",Io.InvalidLocale="InvalidLocale",Io.AlreadyInPaintingFormatMode="AlreadyInPaintingFormatMode",Io.MoreThanOneRangeSelected="MoreThanOneRangeSelected",Io.NoColumnsProvided="NoColumnsProvided",Io.ColumnsNotIncludedInZone="ColumnsNotIncludedInZone",Io.DuplicatesColumnsSelected="DuplicatesColumnsSelected",Io.InvalidHeaderGroupStartEnd="InvalidHeaderGroupStartEnd",Io.HeaderGroupAlreadyExists="HeaderGroupAlreadyExists",Io.UnknownHeaderGroup="UnknownHeaderGroup",Io.UnknownDataValidationRule="UnknownDataValidationRule",Io.UnknownDataValidationCriterionType="UnknownDataValidationCriterionType",Io.InvalidDataValidationCriterionValue="InvalidDataValidationCriterionValue",Io.InvalidNumberOfCriterionValues="InvalidNumberOfCriterionValues",Io.BlockingValidationRule="BlockingValidationRule",Io.InvalidCopyPasteSelection="InvalidCopyPasteSelection",Io.NoChanges="NoChanges",Io.InvalidInputId="InvalidInputId";const Ro=[{name:"English (US)",code:"en_US",thousandsSeparator:",",decimalSeparator:".",dateFormat:"m/d/yyyy",timeFormat:"hh:mm:ss a",formulaArgSeparator:","},{name:"French",code:"fr_FR",thousandsSeparator:" ",decimalSeparator:",",dateFormat:"dd/mm/yyyy",timeFormat:"hh:mm:ss",formulaArgSeparator:";"}],To=Ro[0],Ao=["thin","medium","thick","dashed","dotted"];function Oo(e){return Array.isArray(e)&&Array.isArray(e[0])}var _o,Mo;!function(e){e.UP="up",e.DOWN="down",e.LEFT="left",e.RIGHT="right"}(_o||(_o={})),function(e){e[e.Background=0]="Background",e[e.Highlights=1]="Highlights",e[e.Clipboard=2]="Clipboard",e[e.Search=3]="Search",e[e.Chart=4]="Chart",e[e.Autofill=5]="Autofill",e[e.Selection=6]="Selection",e[e.Headers=7]="Headers"}(Mo||(Mo={}));const No=["number","string","boolean","undefined"];function Fo(e,t){if(!e())throw new d(c.GenericError,t)}const Do=e=>a("The function [[FUNCTION_NAME]] expects a number value, but '%s' is a string, and cannot be coerced to a number.",e);function Lo(e,t){switch(typeof e){case"number":return e;case"boolean":return e?1:0;case"string":if(ho(e,t)||""===e)return go(e,t);const o=jt(e,t);if(o)return o.value;throw new Error(Do(e));default:return 0}}function Po(e,t){try{return Lo(e,t)}catch(e){return}}function ko(e,t){return e.forEach((e=>{e.forEach((e=>{if("number"!=typeof e)throw new Error(a("Function [[FUNCTION_NAME]] expects number values for %s, but got a %s.",typeof e,t))}))})),e}function Vo(e,t){if(""===e)throw new Error(Do(e));return Lo(e,t)}function Uo(e,t){return Math.trunc(Lo(e,t))}function Bo(e,t){return Math.trunc(Vo(e,t))}function Ho(e){Fo((()=>e>=1),a("The function [[FUNCTION_NAME]] expects a number value to be greater than or equal to 1, but receives %s.",e.toString()))}function zo(e){switch(typeof e){case"string":return e;case"number":return e.toString();case"boolean":return e?"TRUE":"FALSE";default:return""}}const Go=rt((function(e){return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"")})),$o=e=>a("The function [[FUNCTION_NAME]] expects a boolean value, but '%s' is a text, and cannot be coerced to a number.",e);function Wo(e){switch(typeof e){case"boolean":return e;case"string":if(e){let t=e.toUpperCase();if("TRUE"===t)return!0;if("FALSE"===t)return!1;throw new Error($o(e))}return!1;case"number":return!!e;default:return!1}}function qo(e,t){return Xt(Lo(e,t))}function Zo(e,t,o){for(let s of e)if(Oo(s)){const e=s.length,o=s[0].length;for(let n=0;n<o;n++)for(let o=0;o<e;o++)t(s[o][n])}else o(s)}function Yo(e,t){Zo(e,t,t)}function jo(e,t,o){Zo(e,(e=>{"number"==typeof e&&t(e)}),(e=>{t(Vo(e,o))}))}function Xo(e,t,o,s,n="rowFirst"){let i=s;for(let s of e)if(Oo(s)){const e=s.length,o=s[0].length;if("rowFirst"===n)for(let n=0;n<o;n++)for(let o=0;o<e;o++)i=t(i,s[o][n]);else for(let n=0;n<e;n++)for(let e=0;e<o;e++)i=t(i,s[n][e])}else i=o(i,s);return i}function Ko(e,t,o,s="rowFirst"){return Xo(e,t,t,o,s)}function Qo(e,t,o,s){return Xo(e,((e,o)=>"number"==typeof o?t(e,o):e),((e,o)=>t(e,Vo(o,s))),o)}function Jo(e,t,o,s){return Xo(e,((e,o)=>null!=o?t(e,"number"==typeof o?o:"boolean"==typeof o?Lo(o,s):0):e),((e,o)=>t(e,Lo(o,s))),o)}function es(e,t,o){const s=Array(e);for(let n=0;n<e;n++){s[n]=Array(t);for(let e=0;e<t;e++)s[n][e]=o(n,e)}return s}function ts(e,t){return 0===e.length?[]:es(e.length,e[0].length,((o,s)=>t(e[o][s])))}function os(e){return e.length?es(e[0].length,e.length,((t,o)=>e[o][t])):[]}function ss(e,t){return function(e,t,o){for(let s of e)if(Oo(s)){const e=s.length,o=s[0].length;for(let n=0;n<o;n++)for(let o=0;o<e;o++)if(!t(s[o][n]??void 0))return}else if(!o(s))return}(e,(e=>"boolean"==typeof e?t(e):"number"!=typeof e||t(!!e)),(e=>null==e||t(function(e){if(""===e)throw new Error($o(e));return Wo(e)}(e))))}function ns(e,t,o){let s,n,i=e.substring(0,2);"<="===i||">="===i||"<>"===i?(s=i,n=e.substring(2)):(i=e.substring(0,1),"<"===i||">"===i||"="===i?(s=i,n=e.substring(1)):(s="=",n=e)),ho(n,o)?n=Lo(n,o):"TRUE"!==n&&"FALSE"!==n||(n=Wo(n));const r={operator:s,operand:n};return"string"==typeof n&&(t&&(n+="*"),r.regexp=function(e){if("*"===e)return/.+/;let t="",o="";for(let s of e)"?"===s&&"~"!==o?t+=".":"*"===s&&"~"!==o?t+=".*":("*"!==s&&"?"!==s||(t=t.slice(0,-1)),["^",".","[","]","$","(",")","*","+","?","|","{","}","\\"].includes(s)&&(t+="\\"),t+=s),o=s;return new RegExp("^"+t+"$","i")}(n)),r}function is(e="",t){const{operator:o,operand:s}=t;if(void 0===s||null===e||null===s)return!1;if("number"==typeof s&&"="===o)return zo(e)===zo(s);if("<>"===o||"="===o){let n;return n=typeof e==typeof s&&("string"==typeof e&&t.regexp?t.regexp.test(e):e===s),"="===o?n:!n}if(typeof e==typeof s)switch(o){case"<":return e<s;case">":return e>s;case"<=":return e<=s;case">=":return e>=s}return!1}function rs(e,t,o,s=!1){const n=e.length;if(n%2==1)throw new Error(a("Function [[FUNCTION_NAME]] expects criteria_range and criterion to be in pairs."));const i=e[0].length,r=e[0][0].length;let l=[];for(let t=0;t<n-1;t+=2){const n=e[t];if(!Oo(n)||n.length!==i||n[0].length!==r)throw new Error(a("Function [[FUNCTION_NAME]] expects criteria_range to have the same dimension"));const c=zo(e[t+1]);l.push(ns(c,s,o))}for(let o=0;o<i;o++)for(let s=0;s<r;s++){let i=!0;for(let t=0;t<n-1;t+=2){if(i=is(e[t][o][s]??void 0,l[t/2]),!i)break}i&&t(o,s)}}function as(e,t,o,s,n,i){if(null==t)return-1;const r=cs(t),a=typeof r;let l,c,h,d,u,g,p=0,m=n-1;for(;m-p>=0;){for(h=Math.floor((p+m)/2),d=h,u=cs(i(e,d)),g=typeof u;p<d&&a!==g;)d--,u=cs(i(e,d)),g=typeof u;g===a&&null!=u?("strict"===o&&u===r?(l=u,c=d):"nextSmaller"===o&&u<=r?(null==l||l<u||l===u&&"asc"===s&&c<d||l===u&&"desc"===s&&c>d)&&(l=u,c=d):"nextGreater"===o&&u>=r&&(void 0===l||l>u||l===u&&"asc"===s&&c<d||l===u&&"desc"===s&&c>d)&&(l=u,c=d),"asc"===s&&u>r||"desc"===s&&u<=r?m=d-1:p=h+1):p=h+1}return void 0!==c?c:-1}function ls(e,t,o,s,n,i=!1){if(null==t)return-1;const r=cs(t),a=i?(e,t)=>n(e,s-t-1):n;let l,c=-1;for(let t=0;t<s;t++){const n=cs(a(e,t));if(n===r)return i?s-t-1:t;"nextSmaller"===o?(!l&&hs(r,n)>=0||hs(r,n)>=0&&hs(n,l)>0)&&(l=n,c=t):"nextGreater"===o&&(!l&&hs(r,n)<=0||hs(r,n)<=0&&hs(n,l)<0)&&(l=n,c=t)}return i?s-c-1:c}function cs(e){return"string"==typeof e?Go(e):e}function hs(e,t){let o=No.indexOf(typeof e)-No.indexOf(typeof t);return 0===o&&("string"==typeof e&&"string"==typeof t?o=e.localeCompare(t):"number"==typeof e&&"number"==typeof t?o=e-t:"boolean"==typeof e&&"boolean"==typeof t&&(o=Number(e)-Number(t))),o}function ds(e){return void 0===e?[[]]:Oo(e)?e:[[e]]}function us(e,t){return Ko(e,((e,o)=>(e.push(t(o)),e)),[],"rowFirst")}function gs(e){const t=Dt.now();switch(e){case"today":return Qt(t);case"yesterday":return Qt(Dt.fromTimestamp(t.setDate(t.getDate()-1)));case"tomorrow":return Qt(Dt.fromTimestamp(t.setDate(t.getDate()+1)));case"lastWeek":return Qt(Dt.fromTimestamp(t.setDate(t.getDate()-7)));case"lastMonth":return Qt(Dt.fromTimestamp(t.setMonth(t.getMonth()-1)));case"lastYear":return Qt(Dt.fromTimestamp(t.setFullYear(t.getFullYear()-1)))}}function ps(e,t){return"dateValue"in e&&"exactDate"!==e.dateValue?[gs(e.dateValue)]:e.values.map((e=>qt(e,t)))}function ms(e,t){return e.values.map((e=>Po(e,t)))}function fs(e){return 20+120*Math.exp(-.035*(e-1))}const bs=20,vs=11,Ss=/(\d+?)(?=(\d{3})+(?!\d)|$)/g,Cs=/0/g,Es={0:a("January"),1:a("February"),2:a("March"),3:a("April"),4:a("May"),5:a("June"),6:a("July"),7:a("August"),8:a("September"),9:a("October"),10:a("November"),11:a("December")},ws={0:a("Sunday"),1:a("Monday"),2:a("Tuesday"),3:a("Wednesday"),4:a("Thursday"),5:a("Friday"),6:a("Saturday")},ys={};function xs(e){let t=ys[e];return void 0===t&&(t=function(e){if(""===e)throw new Error("A format cannot be empty");let t=0,o=[];for(;t<e.length;){let s;if("["===e.charAt(t)){if("$"!==e.charAt(t+1))throw new Error(`Currency formats have to be prefixed by a $: ${e}`);if(s=e.substring(t+1).indexOf("]")+t+2,0===s)throw new Error(`Invalid currency brackets format: ${e}`);const n=e.substring(t+2,s-1);if(n.includes("["))throw new Error(`Invalid currency format: ${e}`);o.push({type:"STRING",format:n})}else{const n=e.substring(t).indexOf("[");s=n>-1?n+t:e.length;const i=e.substring(t,s);Ns(i)?o.push({type:"DATE",format:i}):o.push({type:"NUMBER",format:Zs(i)})}t=s}return o}(e),ys[e]=t),t}function Is(e,{format:t,locale:o}){switch(typeof e){case"string":return e.includes('\\"')?e.replace(/\\"/g,'"'):e;case"boolean":return e?"TRUE":"FALSE";case"number":t||(t=Vs(e));return function(e,t,o){if("DATE"===t[0].type)return Ds(e,t[0].format);let s=e<0?"-":"";for(let n of t)switch(n.type){case"NUMBER":s+=Rs(Math.abs(e),n.format,o);break;case"STRING":s+=n.format}return s}(e,xs(t),o);case"object":return"0"}}function Rs(e,t,o){t.isPercent&&(e*=100),e/=t.magnitude;let s=0;void 0!==t.decimalPart&&(s=t.decimalPart.length);const{integerDigits:n,decimalDigits:i}=As(e,s);let r=function(e,t,o){const s="0"===e?"":e;let n=s;const i=t.length-s.length;if(i>0){const e=(t.substring(0,i).match(Cs)||[]).length;n="0".repeat(e)+n}o&&(n=n.match(Ss)?.join(o)||n);return n}(n,t.integerPart,t.thousandsSeparator?o.thousandsSeparator:void 0);return void 0!==t.decimalPart&&(r+=o.decimalSeparator+function(e,t){let o=e;if(t.length-e.length>0){const s=(t.substring(e.length,t.length+1).match(Cs)||[]).length;o+="0".repeat(s)}return o}(i||"",t.decimalPart)),t.isPercent&&(r+="%"),r}const Ts=[];function As(e,t=bs){const o=e.toString();if(o.includes("e"))return function(e,t=bs){let o=Ts[t];o||(o=new Intl.NumberFormat("en-US",{maximumFractionDigits:t,useGrouping:!1}),Ts[t]=o);const[s,n]=o.format(e).split(".");return{integerDigits:s,decimalDigits:n}}(e,t);if(Number.isInteger(e))return{integerDigits:o,decimalDigits:void 0};const s=o.indexOf(".");let n=o.substring(0,s),i=o.substring(s+1);if(0===t)return Number(i[0])>=5&&(n=(Number(n)+1).toString()),{integerDigits:n,decimalDigits:void 0};if(i.length>t){const{integerDigits:e,decimalDigits:o}=function(e,t){let o="0",s=e,n=e.slice(0,t);const i=t;if(Number(e[i])<5)return{integerDigits:o,decimalDigits:n};const r=n.match(_s)?.[0]||"",a=(Number(n)+1).toString(),l=n.slice(r.length),c=a.length>l.length;c&&!r?(o="1",s=void 0):s=c?r.slice(0,-1)+a:r+a;return{integerDigits:o,decimalDigits:s}}(i,t);i=o,"0"!==e&&(n=(Number(n)+Number(e)).toString())}return{integerDigits:n,decimalDigits:Os(i||"")}}function Os(e){let t=e.length-1;for(;t>=0&&"0"===e[t];)t--;return e.slice(0,t+1)||void 0}const _s=/^0+/;function Ms(e,t){const{integerDigits:o,decimalDigits:s}=As(e,20);return s?o+t+s:o}function Ns(e){if(!Fs.has(e[0]))return!1;try{return Ds(1,e),!0}catch(e){return!1}}const Fs=new Set(["h","m","y","d"]);function Ds(e,t){const o=Xt(e),s=t.indexOf("h");let n="",i="";return s>0?(n=Ls(o,t.substring(0,s-1)),i=Ps(o,t.substring(s))):0===s?i=Ps(o,t):s<0&&(n=Ls(o,t)),n+(n&&i?" ":"")+i}function Ls(e,t){const o=t.match(/\/|-|\s/)?.[0];return(o?t.split(o):[t]).map((o=>{switch(o){case"d":return e.getDate();case"dd":return e.getDate().toString().padStart(2,"0");case"ddd":return ws[e.getDay()].slice(0,3);case"dddd":return ws[e.getDay()];case"m":return e.getMonth()+1;case"mm":return String(e.getMonth()+1).padStart(2,"0");case"mmm":return Es[e.getMonth()].slice(0,3);case"mmmm":return Es[e.getMonth()];case"mmmmm":return Es[e.getMonth()].slice(0,1);case"yy":const o=String(e.getFullYear()).replace("-","").padStart(2,"0");return o.slice(o.length-2);case"yyyy":return e.getFullYear();default:throw new Error(`invalid format: ${t}`)}})).join(o)}function Ps(e,t){let o=t.split(/:|\s/);const s=e.getHours(),n="a"===o[o.length-1];let i=s,r="";return n&&(i=0===i?12:i>12?i-12:i,r=s>=12?" PM":" AM",o.pop()),o.map((o=>{switch(o){case"hhhh":return Math.floor((e.getTime()-Lt.getTime())/36e5).toString();case"hh":return i.toString().padStart(2,"0");case"mm":return e.getMinutes().toString().padStart(2,"0");case"ss":return e.getSeconds().toString().padStart(2,"0");default:throw new Error(`invalid format: ${t}`)}})).join(":")+r}const ks=rt((function(e){return new RegExp(`[0-9]+${Re(e.decimalSeparator)}[0-9]`)}));function Vs(e){let{integerDigits:t,decimalDigits:o}=As(e);if(!o)return"0";const s=t.replace("-","").length;if(s+2>vs)return"0";const n=vs-s-1;return({decimalDigits:o}=As(e,Math.min(n,o.length))),o?"0."+"0".repeat(o.length):"0"}function Us(e,t){if(!Zt(e,t))return;return jt(e,t).format}function Bs(e){if(!ho(e,To))return;const t=e.includes(".")?"0.00":"0",o=e.match(/[\$€]/);if(o){const s=e.match(/[\d]/),n="[$"+o.values().next().value+"]";return s.index<o.index?"#,##"+t+n:n+"#,##"+t}return e.includes("%")?t+"%":void 0}function Hs(e){const t=e.decimalPlaces??2,o=e.position??"before",s=e.code??"",n=e.symbol??"",i="#,##0"+(t?"."+"0".repeat(t):"");let r=`${s} ${n}`.trim();return"after"===o&&s&&(r=" "+r),function(e,t,o){const s=`[$${e}]`;return"before"===t?s+o:o+s}(r,o,i)}function zs(e){return js(xs(e).map((e=>"NUMBER"===e.type?{type:e.type,format:{...e.format,decimalPart:void 0}}:e)))}function Gs(e,t,o,s){const n=xs(e||"#,##0"),i=[];for(let e=0;e<n.length;e++){const s=n[e];if("NUMBER"!==s.type){i.push(s);continue}i.push({...s,format:{...s.format,magnitude:t,decimalPart:void 0}}),i.push({type:"STRING",format:o});const r=n[e+1];"STRING"===r?.type&&["k","m","b"].includes(r.format)&&e++}return js(i)}function $s(e,t,o){const s=xs(e).map((e=>"NUMBER"===e.type?{...e,format:Ws(e.format,t)}:e)),n=js(s);return ys[n]=s,n}function Ws(e,t){const o={...e},s=Math.sign(t),n=o.decimalPart?.length||0,i=Math.min(Math.max(0,n+s),bs);return o.decimalPart="0".repeat(i),""===o.decimalPart&&delete o.decimalPart,o}const qs=/,*?$/;function Zs(e){if(function(e){return Boolean(e.replace(Ys,""))}(e=e.trim()))throw new Error(`Invalid number format: ${e}`);const t=e.includes("%"),o=e.match(qs)?.[0]||"",s=o?1e3**o.length:1;let n=e.slice(0,e.length-(o.length||0));const i=n.includes(",");if(/\..*,/.test(n))throw new Error("A format can't contain ',' symbol in the decimal part");n=n.replace("%","").replace(",","");const r=n.match(/[\%|,]/);if(r)throw new Error(`A format can only contain a single '${r[0]}' symbol`);const[a,l]=n.split(".");if(l&&l.length>20)throw new Error("A format can't contain more than 20 decimal places");return void 0!==l?{integerPart:a,isPercent:t,thousandsSeparator:i,decimalPart:l,magnitude:s}:{integerPart:a,isPercent:t,thousandsSeparator:i,magnitude:s}}const Ys=/[,#0.%]/g;function js(e){let t="";for(let o of e){let e;switch(o.type){case"NUMBER":const t=o.format;e=t.integerPart,t.thousandsSeparator&&(e=e.slice(0,-3)+","+e.slice(-3)),void 0!==t.decimalPart&&(e+="."+t.decimalPart),t.isPercent&&(e+="%"),t.magnitude&&(e+=",".repeat(Math.log10(t.magnitude)/3));break;case"STRING":e=`[$${o.format}]`;break;case"DATE":e=o.format}t+=e}return t}const Xs=new RegExp(/\$?([A-Z]{1,3})\$?([0-9]{1,7})/,"i"),Ks=new RegExp(/^\$?([A-Z]{1,3})\$?([0-9]{1,7})$/,"i"),Qs=new RegExp(/^\$?([A-Z]{1,3})+$/,"i"),Js=new RegExp(/^\$?([0-9]{1,7})+$/,"i"),en=new RegExp(/^\s*('.+'!|[^']+!)?\$?([A-Z]{1,3})$/,"i"),tn=new RegExp(/^\s*('.+'!|[^']+!)?\$?([0-9]{1,7})$/,"i"),on=new RegExp(/^\s*('.+'!|[^']+!)?/.source+"("+[Xs.source,/(\$?[A-Z]{1,3})?\$?[0-9]{1,7}\s*:\s*(\$?[A-Z]{1,3})?\$?[0-9]{1,7}\s*/i.source,/\$?[A-Z]{1,3}(\$?[0-9]{1,7})?\s*:\s*\$?[A-Z]{1,3}(\$?[0-9]{1,7})?\s*/i.source].join("|")+")"+/$/.source,"i");function sn(e){return en.test(e)}function nn(e){return tn.test(e)}function rn(e){return Qs.test(e)}function an(e){return Js.test(e)}function ln(e){return Ks.test(e)}function cn(e){const t=e.split("!"),o=t.pop();return{sheetName:Ae(t.join("!"))||void 0,xc:o}}function hn(e){const t=function(e){e.includes("!")&&(e=e.split("!").at(-1)),e.includes("$")&&(e=e.replaceAll("$",""));let t,o,s,n,i,r="";e.includes(":")?([r,t]=e.split(":"),r=r.trim(),t=t.trim()):r=e.trim();let a=!1,l=!1,c=!1;if(sn(r))n=i=Ot(r),o=s=0,a=!0;else if(nn(r))o=s=parseInt(r,10)-1,n=i=0,l=!0;else{const e=Nt(r);n=i=e.col,o=s=e.row,c=!0}if(t)if(sn(t))i=Ot(t),a=!0;else if(nn(t))s=parseInt(t,10)-1,l=!0;else{const e=Nt(t);i=e.col,s=e.row,o=a?s:o,n=l?i:n,c=!0}if(a&&l)throw new Error("Wrong zone xc. The zone cannot be at the same time a full column and a full row");const h={top:o,left:n,bottom:a?void 0:s,right:l?void 0:i};return c=c&&(l||a),c&&(h.hasHeader=c),h}(e);if(void 0!==t.right&&t.right<t.left){const e=t.left;t.left=t.right,t.right=e}if(void 0!==t.bottom&&t.bottom<t.top){const e=t.top;t.top=t.bottom,t.bottom=e}return t}function dn(e){const t=hn(e);if(void 0===t.bottom||void 0===t.right)throw new Error("This does not support unbounded ranges");return t}function un(e){const{bottom:t,top:o,left:s,right:n}=e;return!(void 0!==t&&isNaN(t)||isNaN(o)||isNaN(s)||void 0!==n&&isNaN(n))&&(gn(e)&&e.top>=0&&e.left>=0)}function gn(e){return(void 0===e.bottom||e.bottom>=e.top&&e.bottom>=0)&&(void 0===e.right||e.right>=e.left&&e.right>=0)}function pn(e){const{top:t,bottom:o,left:s,right:n}=e,i="hasHeader"in e&&e.hasHeader,r=t===o&&s===n;if(void 0===o&&void 0!==n)return 0!==t||i?`${Ft(s,t)}:${Tt(n)}`:`${Tt(s)}:${Tt(n)}`;if(void 0===n&&void 0!==o)return 0!==s||i?`${Ft(s,t)}:${o+1}`:`${t+1}:${o+1}`;if(void 0!==o&&void 0!==n)return r?Ft(s,t):`${Ft(s,t)}:${Ft(n,o)}`;throw new Error(a("Bad zone format"))}function mn(e,t,o,s,n){const i="left"===t?"columns":"rows",r="before"===s?o-1:o,a=e["left"===t?"right":"bottom"];return e[t]<=r&&a&&a>r?_n(e,i,"RESIZE",n):r<e[t]?_n(e,i,"MOVE",n):{...e}}function fn(e,t,o,s,n){const i="left"===t?"columns":"rows",r="before"===s?o-1:o,a="left"===t?"right":"bottom";return e[t]<=r&&e[a]>r?_n(e,i,"RESIZE",n):r<e[t]?_n(e,i,"MOVE",n):{...e}}function bn(e,t,o){const s="left"===t?"right":"bottom";let n=e[t],i=e[s];for(let r of o.sort(((e,t)=>t-e)))e[t]>r&&(n--,i--),e[t]<r&&e[s]>=r&&i--;return{...e,[t]:n,[s]:i}}function vn(e,t,o){const s="left"===t?"right":"bottom";let n=e[t],i=e[s];const r=e[s];for(let s of o.sort(((e,t)=>t-e)))e[t]>s&&(n--,void 0!==i&&i--),void 0!==r&&void 0!==i&&e[t]<=s&&r>=s&&i--;if(!(void 0!==i&&n>i))return{...e,[t]:n,[s]:i}}function Sn(...e){return{top:Math.min(...e.map((e=>e.top))),left:Math.min(...e.map((e=>e.left))),bottom:Math.max(...e.map((e=>e.bottom))),right:Math.max(...e.map((e=>e.right)))}}function Cn(e,t){if(wn(e,t))return{top:Math.max(e.top,t.top),left:Math.max(e.left,t.left),bottom:Math.min(e.bottom,t.bottom),right:Math.min(e.right,t.right)}}function En(e,t){return e.left===t.left&&e.right===t.right&&e.top===t.top&&e.bottom===t.bottom}function wn(e,t){return!(e.bottom<t.top||t.bottom<e.top)&&!(e.right<t.left||t.right<e.left)}function yn(e,t,o){const{left:s,right:n,top:i,bottom:r}=o;return e>=s&&e<=n&&t>=i&&t<=r}function xn(e,t){return En(Sn(t,e),t)}function In(e,t){const o=e.map(hn),s=t.map(hn),n=Math.max(...o.concat(s).map((e=>e.bottom||0))),i=Math.max(...o.concat(s).map((e=>e.right||0))),r=o.map((e=>({...e,bottom:void 0===e.bottom?n+1:e.bottom,right:void 0===e.right?i+1:e.right}))),a=s.map((e=>({...e,bottom:void 0===e.bottom?n+1:e.bottom,right:void 0===e.right?i+1:e.right}))),l=function(e,t){const o=new Set(t.map((({col:e,row:t})=>`${e}-${t}`)));return e.filter((({col:e,row:t})=>!o.has(`${e}-${t}`)))}(r.map(On).flat(),a.map(On).flat()),c=function(e){if(0===e.length)return[];const[t,...o]=[...e].sort(((e,t)=>e.row-t.row)).sort(((e,t)=>e.col-t.col)),s=[];let n=Fn(t);for(const{col:e,row:t}of o)if(!yn(e,t,n))if(e===n.left&&t===n.bottom+1){const e=n.bottom+1;n={...n,bottom:e}}else s.push(n),n=Fn({col:e,row:t});return[...s,n]}(l);return function(e){if(0===e.length)return[];if(e.some((e=>e.left!==e.right)))throw new Error("only columns can be merged");const t=[],o=Rn(e),s=(e,t)=>e.top===t.top&&e.bottom===t.bottom&&e.right+1===t.left;for(;o.length;){const e=o.reduce(((e,t)=>s(e,t)?Sn(e,t):e),o.shift());t.push(e)}return Rn(t)}(c).map((e=>({...e,bottom:e.bottom===n+1?void 0:e.bottom,right:e.right===i+1?void 0:e.right}))).map(pn)}function Rn(e){const t=[...e].sort(((e,t)=>t.right-e.right)).sort(((e,t)=>t.bottom-e.bottom)).sort(((e,t)=>e.top-t.top)).sort(((e,t)=>e.left-t.left)).reverse(),o=[];for(;0!==t.length;){const e=t.shift();t.some((t=>xn(e,t)))||o.push(e)}return o.reverse()}function Tn(e){return{numberOfRows:e.bottom-e.top+1,numberOfCols:e.right-e.left+1}}function An(e){const{numberOfCols:t,numberOfRows:o}=Tn(e);return 1===t||1===o}function On(e){const t=[],[o,s]=[e.right,e.left].sort(((e,t)=>e-t)),[n,i]=[e.top,e.bottom].sort(((e,t)=>e-t));for(const e of Me(o,s+1))for(const o of Me(n,i+1))t.push({col:e,row:o});return t}function _n(e,t,o,s){const n="both"===t?s[0]:"columns"===t?s:0,i="both"===t?s[1]:"rows"===t?s:0,r="hasHeader"in e&&e.hasHeader;let a;a=!function(e){return void 0===e.bottom}(e)||r?!(Dn(e)&&!r)||"columns"!==t:"rows"!==t;const l={...e};return a&&"MOVE"===o&&(l.left+=n,l.top+=i),void 0!==l.right&&(l.right+=n),void 0!==l.bottom&&(l.bottom+=i),l}function Mn(e,t){let o,s;const{left:n,right:i,top:r,bottom:a}=e,{left:l,right:c,top:h,bottom:d}=t;return o=l!=n?l:c!=i?c:l,s=h!=r?h:d!=a?d:h,{col:o,row:s}}function Nn(e){return{top:Math.min(e.top,e.bottom),bottom:Math.max(e.top,e.bottom),left:Math.min(e.left,e.right),right:Math.max(e.left,e.right)}}function Fn(e){return{left:e.col,right:e.col,top:e.row,bottom:e.row}}function Dn(e){return void 0===e.right}function Ln(e){return(e.bottom-e.top+1)*(e.right-e.left+1)}function Pn(...e){return e.length<2||1===In(e.map(pn),[]).length}class kn{getSheetSize;_zone;parts;invalidXc;prefixSheet=!1;sheetId;invalidSheetName;constructor(e,t){this.getSheetSize=t,this._zone=e.zone,this.prefixSheet=e.prefixSheet,this.invalidXc=e.invalidXc,this.sheetId=e.sheetId,this.invalidSheetName=e.invalidSheetName;let o=[...e.parts];1===e.parts.length&&Ln(this.zone)>1?o.push({...e.parts[0]}):2===e.parts.length&&1===Ln(this.zone)&&o.pop(),this.parts=o}static fromRange(e,t){return e instanceof kn?e:new kn(e,t.getSheetSize)}get unboundedZone(){return this._zone}get zone(){const{left:e,top:t,bottom:o,right:s}=this._zone;if(void 0!==s&&void 0!==o)return this._zone;if(void 0===o&&void 0!==s)return{right:s,top:t,left:e,bottom:this.getSheetSize(this.sheetId).numberOfRows-1};if(void 0===s&&void 0!==o)return{bottom:o,left:e,top:t,right:this.getSheetSize(this.sheetId).numberOfCols-1};throw new Error(a("Bad zone format"))}static getRangeParts(e,t){const o=e.split(":").map((e=>{const t=nn(e);return{colFixed:!t&&e.startsWith("$"),rowFixed:t?e.startsWith("$"):e.includes("$",1)}})),s=void 0===t.bottom,n=void 0===t.right;return s&&(o[0].rowFixed=o[0].rowFixed||o[1].rowFixed,o[1].rowFixed=o[0].rowFixed||o[1].rowFixed),n&&(o[0].colFixed=o[0].colFixed||o[1].colFixed,o[1].colFixed=o[0].colFixed||o[1].colFixed),o}get isFullCol(){return void 0===this._zone.bottom}get isFullRow(){return void 0===this._zone.right}get rangeData(){return{_zone:this._zone,_sheetId:this.sheetId}}orderZone(){if(gn(this._zone))return this;const e={...this._zone};let t=this.parts;if(void 0!==e.right&&e.right<e.left){let o=e.right;e.right=e.left,e.left=o,t=[{colFixed:t[1]?.colFixed||!1,rowFixed:t[0]?.rowFixed||!1},{colFixed:t[0]?.colFixed||!1,rowFixed:t[1]?.rowFixed||!1}]}if(void 0!==e.bottom&&e.bottom<e.top){let o=e.bottom;e.bottom=e.top,e.top=o,t=[{colFixed:t[0]?.colFixed||!1,rowFixed:t[1]?.rowFixed||!1},{colFixed:t[1]?.colFixed||!1,rowFixed:t[0]?.rowFixed||!1}]}return this.clone({zone:e,parts:t})}clone(e){return new kn({zone:e?.zone?e.zone:{...this._zone},sheetId:e?.sheetId?e.sheetId:this.sheetId,invalidSheetName:e&&"invalidSheetName"in e?e.invalidSheetName:this.invalidSheetName,invalidXc:e&&"invalidXc"in e?e.invalidXc:this.invalidXc,parts:e?.parts?e.parts:this.parts.map((e=>({rowFixed:e.rowFixed,colFixed:e.colFixed}))),prefixSheet:e?.prefixSheet?e.prefixSheet:this.prefixSheet},this.getSheetSize)}}function Vn(e,t,o){const s=o.sheetId===e?t:o.sheetId;return o.clone({sheetId:s})}function Un(e,t,o){if(!o)return;const s=e.getRangeFromSheetXC(t,o);return s.invalidSheetName||s.invalidXc?void 0:s}function Bn(e){const t=[];for(const o of e)for(const e of On(o.zone))t.push({...e,sheetId:o.sheetId});return t}function Hn(e,t,o){const s=[];return t.forEach((t=>{const n=function(e,t){e=e.toLocaleLowerCase();let o=0,s=0,n=(t=t.toLocaleLowerCase()).length,i=0;for(let r=0;r<n;r++)t[r]===e[i]?(i++,s+=100+s-r/200):s=0,o+=s;return i===e.length?o:0}(e,o(t));n>0&&s.push({score:n,elem:t})})),s.sort(((e,t)=>t.score-e.score)),s.map((e=>e.elem))}function zn(e){const t=[];for(let o=0;o<e;o++){const e={cells:{}};t.push(e)}return t}function Gn(e,t,o){return o.map((o=>o>=e?o+t:o))}function $n(e,t){return e=[...e].sort(((e,t)=>t-e)),t.map((t=>{for(const o of e)if(t>o)t--;else if(t===o)return;return t})).filter($e)}function Wn(e,t=1){return t*(e+Z)-Z}const qn={};function Zn(e,t,o){const s=jn(o);if(qn[s]||(qn[s]={}),void 0===qn[s][t]){e.save(),e.font=s;const o=e.measureText(t).width;e.restore(),qn[s][t]=o}return qn[s][t]}function Yn(e){return Math.round(96*e/72)}function jn(e){return`${e.italic?"italic ":""}${e.bold?"bold":oe} ${Xn(e)}px ${ne}`}function Xn(e){return Yn(e?.fontSize||se)}function Kn(e,t,o,s){if(Zn(e,t,s)<=o)return[t];const n=[];let i="";for(let r of t){Zn(e,i+r,s)>o?(n.push(i),i=r):i+=r}return n.push(i),n}function Qn(e,t,o,s){o||(o={});const n=[],i=t.includes(ye)?t.split(ye):[t];for(const t of i){const i=t.includes(" ")?t.split(" "):[t];if(!s){n.push(t);continue}let r="",a=s;for(let t of i){const i=Kn(e,t,s,o),l=i.pop(),c=Zn(e,l,o);if(i.length)""!==r&&(n.push(r),r="",a=s),i.forEach((e=>{n.push(e)})),r=l,a=s-c;else{const t=""===r?l:" "+l,i=Zn(e,t,o);i<=a?(r+=t,a-=i):(n.push(r),r=l,a=s-c)}}""!==r&&n.push(r)}return n}function Jn(e){return e?e.toLowerCase():""}const ei=/([0-9\.]*)px/;function ti(e,t,o,s=!1,n=!1,i=function(e){return Number(e.match(ei)?.[1])}(e.font)/10){if(e.fillText(t,o.x,o.y),!s&&!n)return;const r=e.measureText(t),a=r.width,l=r.actualBoundingBoxAscent+r.actualBoundingBoxDescent,c=r.fontBoundingBoxAscent+r.fontBoundingBoxDescent;let{x:h,y:d}=o,u=d,g=d;switch(e.textAlign){case"center":h-=a/2;break;case"right":h-=a}switch(e.textBaseline){case"top":g+=c-2*i,u+=c/2-i;break;case"middle":g+=c/2-i;break;case"alphabetic":g+=2*i,u-=3*i;break;case"bottom":g=d,u-=l/2-i/2}s&&(e.lineWidth=i,e.strokeStyle=e.fillStyle,e.beginPath(),e.moveTo(h,g),e.lineTo(h+a,g),e.stroke()),n&&(e.lineWidth=i,e.strokeStyle=e.fillStyle,e.beginPath(),e.moveTo(h,u),e.lineTo(h+a,u),e.stroke())}class oi{isFastIdStrategy=!1;fastIdStart=0;setIsFastStrategy(e){this.isFastIdStrategy=e}uuidv4(){return this.isFastIdStrategy?(this.fastIdStart++,String(this.fastIdStart)):window.crypto&&window.crypto.getRandomValues?([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16))):"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}}function si(e){return e.map(ii).sort(((e,t)=>e.sequence-t.sequence))}const ni=new oi;function ii(e){const t=e.name,o=e.children,s=e.description,n=e.icon;return{id:e.id||ni.uuidv4(),name:"function"==typeof t?t:()=>t,isVisible:e.isVisible?e.isVisible:()=>!0,isEnabled:e.isEnabled?e.isEnabled:()=>!0,isActive:e.isActive,execute:e.execute,children:o?e=>o.map((t=>"function"==typeof t?t(e):t)).flat().map(ii):()=>[],isReadonlyAllowed:e.isReadonlyAllowed||!1,separator:e.separator||!1,icon:"function"==typeof n?n:()=>n||"",description:"function"==typeof s?s:()=>s||"",textColor:e.textColor,sequence:e.sequence||0}}function ri(e,t){return"REMOVE_COLUMNS_ROWS"===t.type?vn(e,"COL"===t.dimension?"left":"top",t.elements):"ADD_COLUMNS_ROWS"===t.type?mn(e,"COL"===t.dimension?"left":"top",t.base,t.position,t.quantity):{...e}}function ai(e,t){const o="DELETE_SHEET"===t.type&&t.sheetId;if("sheetId"in t&&e._sheetId!==t.sheetId)return e;{const s=ri(e._zone,t);if(s&&o!==e._sheetId)return{...e,_zone:s}}}class li extends t.Component{static template="o-spreadsheet-ChartJsComponent";canvas=t.useRef("graphContainer");chart;get background(){return this.chartRuntime.background}get canvasStyle(){return`background-color: ${this.background}`}get chartRuntime(){const e=this.env.model.getters.getChartRuntime(this.props.figure.id);if(!("chartJsConfig"in e))throw new Error("Unsupported chart runtime");return e}setup(){t.onMounted((()=>{const e=this.chartRuntime;this.createChart(Te(e.chartJsConfig))})),t.useEffect((()=>this.updateChartJs(Te(this.chartRuntime))),(()=>[this.chartRuntime]))}createChart(e){const t=this.canvas.el.getContext("2d");this.chart=new window.Chart(t,e)}updateChartJs(e){const t=e.chartJsConfig;t.data&&t.data.datasets?(this.chart.data=t.data,t.options?.plugins?.title&&(this.chart.config.options.plugins.title=t.options.plugins.title),t.options&&"valueLabel"in t.options&&t.options?.valueLabel&&(this.chart.config.options.valueLabel=t.options.valueLabel)):this.chart.data.datasets=[],this.chart.config.options.plugins.tooltip=t.options.plugins.tooltip,this.chart.config.options.plugins.legend=t.options.plugins.legend,this.chart.config.options.scales=t.options?.scales,this.chart.update()}}li.props={figure:Object};class ci{sheetId;title;getters;constructor(e,t,o){this.title=e.title,this.sheetId=t,this.getters=o}static validateChartDefinition(e,t){throw new Error("This method should be implemented by sub class")}static transformDefinition(e,t){throw new Error("This method should be implemented by sub class")}static getDefinitionFromContextCreation(e){throw new Error("This method should be implemented by sub class")}}function hi(e,t,o,s){let n=!1;const i=[];for(let s in o){let r=o[s];if(r.labelCell){const e=gi(r.labelCell,t);r.labelCell!==e&&(n=!0,r={...r,labelCell:e})}const a=gi(r.dataRange,t);void 0===a||e.getRangeString(a,a.sheetId)===le?(n=!0,r=void 0):a!==r.dataRange&&(n=!0,r={...r,dataRange:a}),i[s]=r}let r=s;const a=gi(r,t);a!==r&&(n=!0,r=a);return{isStale:n,dataSets:i.filter($e),labelRange:r}}function di(e,t,o){return o.map((o=>({dataRange:Vn(e,t,o.dataRange),labelCell:o.labelCell?Vn(e,t,o.labelCell):void 0})))}function ui(e,t,o){return o?Vn(e,t,o):void 0}function gi(e,t){if(!e)return;const o=t(e);switch(o.changeType){case"NONE":return e;case"REMOVE":return;default:return o.range}}function pi(e,t,o,s){const n=[];for(const i of t){const t=e.getRangeFromSheetXC(o,i),{unboundedZone:r,sheetId:a,invalidSheetName:l,invalidXc:c}=t;if(!l&&!c)if(r.left!==r.right&&r.top!==r.bottom){if(void 0===r.right)continue;for(let t=r.left;t<=r.right;t++){const o={...r,left:t,right:t};n.push(mi(e,a,o,s?{top:o.top,bottom:o.top,left:o.left,right:o.left}:void 0))}}else n.push(mi(e,a,r,s?{top:r.top,bottom:r.top,left:r.left,right:r.left}:void 0))}return n}function mi(e,t,o,s){if(o.left!==o.right&&o.top!==o.bottom)throw new Error(`Zone should be a single column or row: ${pn(o)}`);if(s){const n=pn(o),i=pn(s);return{labelCell:e.getRangeFromSheetXC(t,i),dataRange:e.getRangeFromSheetXC(t,n)}}return{labelCell:void 0,dataRange:e.getRangeFromSheetXC(t,pn(o))}}function fi(e,t){const o=t.labelCell?.zone;let s=t.dataRange.zone;if(o){const{numberOfRows:e,numberOfCols:t}=Tn(s);1===e?s={...s,left:s.left+1}:1===t&&(s={...s,top:s.top+1})}const n=t.dataRange.clone({zone:s});return{label:t.labelCell?e.getRangeString(t.labelCell,"forceSheetReference",{useFixedReference:!0}):void 0,range:e.getRangeString(n,"forceSheetReference",{useFixedReference:!0})}}function bi(e,t,o){if(!t)return;let s={...t.zone};o&&t.zone.bottom>t.zone.top&&(s.top=s.top+1);const n=t.clone({zone:s});return e.getRangeString(n,"forceSheetReference",{useFixedReference:!0})}function vi(e,t){let o;if(e.labelRange){const s=ri(hn(e.labelRange),t);o=s?pn(s):void 0}const s=e.dataSets.map(hn).map((e=>ri(e,t))).filter($e).map(pn);return{...e,labelRange:o,dataSets:s}}const Si=["rgb(31,119,180)","rgb(255,127,14)","rgb(174,199,232)","rgb(255,187,120)","rgb(44,160,44)","rgb(152,223,138)","rgb(214,39,40)","rgb(255,152,150)","rgb(148,103,189)","rgb(197,176,213)","rgb(140,86,75)","rgb(196,156,148)","rgb(227,119,194)","rgb(247,182,210)","rgb(127,127,127)","rgb(199,199,199)","rgb(188,189,34)","rgb(219,219,141)","rgb(23,190,207)","rgb(158,218,229)"];class Ci{graphColorIndex=0;next(){return Si[this.graphColorIndex++%Si.length]}}function Ei(e){return e&&Ct(e)<.3?"#FFFFFF":"#000000"}function wi(e){if(e.dataSets){const t=void 0!==e.dataSets.find((e=>!on.test(e)));if(t)return"InvalidDataSet";if(e.dataSets.map(hn).some((e=>e.top!==e.bottom&&Dn(e))))return"InvalidDataSet"}return"Success"}function yi(e){if(e.labelRange){if(!on.test(e.labelRange||""))return"InvalidLabelRange"}return"Success"}function xi(e,t,o){if(!o)return!1;if(!e)return!1;if(!t)return!0;const s=Ln(t.dataRange.zone);return!(Ln(e.zone)<s)}function Ii(e,t,o,s){if(e){if("text"===o||t?.type!==mo.number||e.type!==mo.number)return e.formattedValue;{let n=t.value-e.value;if("percentage"===o&&0!==n&&(n=n/e.value*100),"percentage"!==o&&e.format)return Is(n,{format:e.format,locale:s});const i=Math.abs(parseFloat(n.toFixed(2))).toLocaleString();return"percentage"===o?i+"%":i}}return""}function Ri(e,t,o,s,n){if("text"===t||e?.type!==mo.number||o?.type!==mo.number)return;const i=o.value-e.value;return i>0?s:i<0?n:void 0}function Ti(e,t,o){if("text"===o||e?.type!==mo.number||t?.type!==mo.number)return"neutral";const s=t.value-e.value;return s>0?"up":s<0?"down":"neutral"}function Ai(e){return e.keyValue&&!on.test(e.keyValue)?"InvalidScorecardKeyValue":"Success"}function Oi(e){return e.baseline&&!on.test(e.baseline)?"InvalidScorecardBaseline":"Success"}const _i=new window.Path2D("M8.6 4.8a.5.5 0 0 1 0 .75l-3.9 3.9a.5 .5 0 0 1 -.75 0l-3.8 -3.9a.5 .5 0 0 1 0 -.75l.4-.4a.5.5 0 0 1 .75 0l2.3 2.4v-5.7c0-.25.25-.5.5-.5h.6c.25 0 .5.25.5.5v5.8l2.3 -2.4a.5.5 0 0 1 .75 0z"),Mi=new window.Path2D("M8.7 5.5a.5.5 0 0 0 0-.75l-3.8-4a.5.5 0 0 0-.75 0l-3.8 4a.5.5 0 0 0 0 .75l.4.4a.5.5 0 0 0 .75 0l2.3-2.4v5.8c0 .25.25.5.5.5h.6c.25 0 .5-.25.5-.5v-5.8l2.2 2.4a.5.5 0 0 0 .75 0z");let Ni=class e extends ci{keyValue;baseline;baselineMode;baselineDescr;background;baselineColorUp;baselineColorDown;fontColor;type="scorecard";constructor(e,t,o){super(e,t,o),this.keyValue=Un(o,t,e.keyValue),this.baseline=Un(o,t,e.baseline),this.baselineMode=e.baselineMode,this.baselineDescr=e.baselineDescr,this.background=e.background,this.baselineColorUp=e.baselineColorUp,this.baselineColorDown=e.baselineColorDown}static validateChartDefinition(e,t){return e.checkValidations(t,Ai,Oi)}static getDefinitionFromContextCreation(e){return{background:e.background,type:"scorecard",keyValue:e.range?e.range[0]:void 0,title:e.title||"",baselineMode:ge,baselineColorUp:pe,baselineColorDown:me,baseline:e.auxiliaryRange||""}}static transformDefinition(e,t){let o,s;return e.baseline&&(o=ri(hn(e.baseline),t)),e.keyValue&&(s=ri(hn(e.keyValue),t)),{...e,baseline:o?pn(o):void 0,keyValue:s?pn(s):void 0}}copyForSheetId(t){const o=ui(this.sheetId,t,this.baseline),s=ui(this.sheetId,t,this.keyValue),n=this.getDefinitionWithSpecificRanges(o,s,t);return new e(n,t,this.getters)}copyInSheetId(t){const o=this.getDefinitionWithSpecificRanges(this.baseline,this.keyValue,t);return new e(o,t,this.getters)}getDefinition(){return this.getDefinitionWithSpecificRanges(this.baseline,this.keyValue)}getContextCreation(){return{background:this.background,title:this.title,range:this.keyValue?[this.getters.getRangeString(this.keyValue,this.sheetId)]:void 0,auxiliaryRange:this.baseline?this.getters.getRangeString(this.baseline,this.sheetId):void 0}}getDefinitionWithSpecificRanges(e,t,o){return{baselineColorDown:this.baselineColorDown,baselineColorUp:this.baselineColorUp,baselineMode:this.baselineMode,title:this.title,type:"scorecard",background:this.background,baseline:e?this.getters.getRangeString(e,o||this.sheetId):void 0,baselineDescr:this.baselineDescr,keyValue:t?this.getters.getRangeString(t,o||this.sheetId):void 0}}getDefinitionForExcel(){}updateRanges(t){const o=gi(this.baseline,t),s=gi(this.keyValue,t);if(this.baseline===o&&this.keyValue===s)return this;const n=this.getDefinitionWithSpecificRanges(o,s);return new e(n,this.sheetId,this.getters)}};function Fi(e,t){const o=t.getContext("2d");if(t.width=e.canvas.width,t.height=e.canvas.height,o.fillStyle=e.canvas.backgroundColor,o.fillRect(0,0,e.canvas.width,e.canvas.height),e.title&&(o.font=e.title.style.font,o.fillStyle=e.title.style.color,o.fillText(e.title.text,e.title.position.x,e.title.position.y)),e.baseline&&(o.font=e.baseline.style.font,o.fillStyle=e.baseline.style.color,ti(o,e.baseline.text,e.baseline.position,e.baseline.style.underline,e.baseline.style.strikethrough)),e.baselineArrow&&e.baselineArrow.style.size>0){o.save(),o.fillStyle=e.baselineArrow.style.color,o.translate(e.baselineArrow.position.x,e.baselineArrow.position.y);const t=e.baselineArrow.style.size/10;switch(o.scale(t,t),e.baselineArrow.direction){case"down":o.fill(_i);break;case"up":o.fill(Mi)}o.restore()}e.baselineDescr&&(o.font=e.baselineDescr.style.font,o.fillStyle=e.baselineDescr.style.color,o.fillText(e.baselineDescr.text,e.baselineDescr.position.x,e.baselineDescr.position.y)),e.key&&(o.font=e.key.style.font,o.fillStyle=e.key.style.color,ti(o,e.key.text,e.key.position,e.key.style.underline,e.key.style.strikethrough))}function Di(e,t=!1,o=!1){return`${o?"italic":""} ${t?"bold":""} ${e}px ${ne}`}function Li({width:e,height:t},o){return new Pi({width:e,height:t},o).computeDesign()}class Pi{runtime;context;width;height;constructor({width:e,height:t},o){this.runtime=o;const s=document.createElement("canvas");this.width=s.width=e,this.height=s.height=t,this.context=s.getContext("2d")}computeDesign(){const e={canvas:{width:this.width,height:this.height,backgroundColor:this.backgroundColor}},t=this.getTextStyles(),{height:o}=this.getTextDimensions(this.title,t.title.font);this.title&&(e.title={text:this.title,style:t.title,position:{x:this.chartPadding,y:this.chartPadding+o}});const s=t.baselineArrow?.size??0,{height:n,width:i}=this.getTextDimensions(this.baseline,t.baselineValue.font),{width:r}=this.getTextDimensions(this.baselineDescr,t.baselineDescr.font);e.baseline={text:this.baseline,style:t.baselineValue,position:{x:(this.width-i-r+s)/2,y:this.keyValue?this.height-2*this.chartPadding:this.height-(this.height-o-n)/2-this.chartPadding}},t.baselineArrow&&(e.baselineArrow={direction:this.baselineArrow,style:t.baselineArrow,position:{x:e.baseline.position.x-s,y:e.baseline.position.y-(n+s)/2}}),this.baselineDescr&&(e.baselineDescr={text:this.baselineDescr,style:t.baselineDescr,position:{x:e.baseline.position.x+i,y:e.baseline.position.y}});const{height:a,width:l}=this.getTextDimensions(this.keyValue,t.keyValue.font);return this.keyValue&&(e.key={text:this.keyValue,style:t.keyValue,position:{x:(this.width-l)/2,y:(this.height-n+o+a)/2-this.chartPadding}}),e}get title(){return this.runtime.title}get keyValue(){return this.runtime.keyValue}get baseline(){return this.runtime.baselineDisplay}get baselineDescr(){return function(e,t){const o=e||"";return t&&o?" "+o:o}(this.runtime.baselineDescr,this.baseline)}get baselineArrow(){return this.runtime.baselineArrow}get backgroundColor(){return this.runtime.background}get secondaryFontColor(){return Ct(this.backgroundColor)>.3?"#525252":"#C8C8C8"}get chartPadding(){return.02*this.width}getTextDimensions(e,t){this.context.font=t;const o=this.context.measureText(e);return{width:o.width,height:o.actualBoundingBoxAscent+o.actualBoundingBoxDescent}}getTextStyles(){const e=.96*this.width,t=this.getWidestElement(),o=t.getElementMaxFontSize(this.getDrawableHeight(),this);let s=function(e,t,o,s=.25){let n=1;if(o(n)>e)return n;if(o(t)<e)return t;let i=(n+t)/2,r=o(i),a=0;for(;Math.abs(r-e)>s&&a<20;)r>=e?t=(n+t)/2:n=(n+t)/2,i=(n+t)/2,r=o(i),a++;return i}(e,o,(e=>t.getElementWidth(e,this.context,this)))/o;const n=new Ui(this.runtime.keyValueStyle).getElementMaxFontSize(this.getDrawableHeight(),this)*s,i=new Vi(this.runtime.baselineStyle).getElementMaxFontSize(this.getDrawableHeight(),this)*s;return{title:{font:Di(18),color:this.secondaryFontColor},keyValue:{color:this.runtime.keyValueStyle?.textColor||this.runtime.fontColor,font:Di(n,this.runtime.keyValueStyle?.bold,this.runtime.keyValueStyle?.italic),strikethrough:this.runtime.keyValueStyle?.strikethrough,underline:this.runtime.keyValueStyle?.underline},baselineValue:{font:Di(i,this.runtime.baselineStyle?.bold,this.runtime.baselineStyle?.italic),strikethrough:this.runtime.baselineStyle?.strikethrough,underline:this.runtime.baselineStyle?.underline,color:this.runtime.baselineStyle?.textColor||this.runtime.baselineColor||this.secondaryFontColor},baselineDescr:{font:Di(.9*i),color:this.secondaryFontColor},baselineArrow:"neutral"===this.baselineArrow?void 0:{size:this.keyValue?.8*i:0,color:this.runtime.baselineColor||this.secondaryFontColor}}}getDrawableHeight(){const e=2*this.chartPadding;let t=this.height-e;return t-=this.title?18*1.2:0,t}getWidestElement(){const e=new Vi(this.runtime.baselineStyle),t=new Ui(this.runtime.keyValueStyle);return e.getElementWidth(.35,this.context,this)>t.getElementWidth(.65,this.context,this)?e:t}}class ki{style;constructor(e={}){this.style=e}measureTextWidth(e,t,o){return e.font=Di(o,this.style.bold,this.style.italic),e.measureText(t).width}}class Vi extends ki{getElementWidth(e,t,o){if(!o.runtime)return 0;const s=o.baseline,n="neutral"!==o.baselineArrow?"A "+s:s;let i=this.measureTextWidth(t,n,e);return i+=this.measureTextWidth(t,o.baselineDescr,.9*e),i}getElementMaxFontSize(e,t){if(!t.runtime)return 0;return(""!==t.baseline||t.baselineDescr?.35*e:0)/1.2}}class Ui extends ki{getElementWidth(e,t,o){if(!o.runtime)return 0;const s=o.keyValue||"";return this.measureTextWidth(t,s,e)}getElementMaxFontSize(e,t){if(!t.runtime)return 0;return(""!==t.baseline||t.baselineDescr?.65*e:e)/1.2}}class Bi extends t.Component{static template="o-spreadsheet-ScorecardChart";canvas=t.useRef("chartContainer");get runtime(){return this.env.model.getters.getChartRuntime(this.props.figure.id)}setup(){t.useEffect(this.createChart.bind(this),(()=>{const e=this.canvas.el.getBoundingClientRect();return[e.width,e.height,this.runtime,this.canvas.el]}))}createChart(){const e=this.canvas.el;Fi(Li(e.getBoundingClientRect(),this.runtime),e)}}Bi.props={figure:Object};class Hi{content={};add(e,t){return this.content[e]=t,this}get(e){const t=this.content[e];if(!t&&!(e in this.content))throw new Error(`Cannot find ${e} in this registry!`);return t}contains(e){return e in this.content}getAll(){return Object.values(this.content)}getKeys(){return Object.keys(this.content)}remove(e){delete this.content[e]}}function zi(e){return/^https?:\/\//i.test(e)?e:`https://${e}`}const Gi=new Hi;function $i(e,t){return{url:e=zi(e),label:t||e,isExternal:!0,isUrlEditable:!0}}Gi.add("sheet_URL",{match:e=>He(e),createLink:(e,t)=>({label:t,url:e,isExternal:!1,isUrlEditable:!1}),urlRepresentation(e,t){const o=Ge(e);return t.tryGetSheetName(o)||a("Invalid sheet")},open(e,t){const o=Ge(e);t.model.dispatch("ACTIVATE_SHEET",{sheetIdFrom:t.model.getters.getActiveSheetId(),sheetIdTo:o})},sequence:0});const Wi={createLink:$i,match:e=>ke(e),open:e=>window.open(e,"_blank"),urlRepresentation:e=>e,sequence:0};function qi(e){return Gi.getAll().sort(((e,t)=>e.sequence-t.sequence)).find((t=>t.match(e)))||Wi}function Zi(e,t){return qi(e.url).urlRepresentation(e.url,t)}function Yi(e,t){qi(e.url).open(e.url,t)}function ji(e){if("string"==typeof e){if(Pe(e)){const{label:t,url:o}=Ue(e);return qi(o).createLink(o,t)}return ke(e)?$i(e):void 0}}function Xi(e,t){return Qi(Ki(e||"",t.locale),t)}function Ki(e,t){if(e.startsWith("="))throw new Error(`Cannot parse "${e}" because it's not a literal value. It's a formula`);return ho(e,To)?Lo(e,To):Zt(e,t)?Lo(e,t):function(e){const t=e.toUpperCase();return"TRUE"===t||"FALSE"===t}(e)?"TRUE"===e.toUpperCase():e}function Qi(e,t){const o=ji(e);return o?{...Ji(Ki(o.label,t.locale),{format:t.format||Us(o.label,t.locale)||Bs(o.label),locale:t.locale}),link:o}:Ji(e,t)}function Ji(e,t){try{for(const o of sr){const s=o(e,t);if(s)return s}return function(e,t){return{type:mo.text,value:e,format:t.format,isAutoSummable:!0,defaultAlign:"left",formattedValue:Is(e,t)}}((e||"").toString(),t)}catch(e){return or(new d(c.GenericError,e.message||Se))}}function er(e,t){return{type:mo.number,value:e||0,format:t.format,isAutoSummable:!0,defaultAlign:"right",formattedValue:Is(e,t)}}const tr={type:mo.empty,value:"",format:void 0,isAutoSummable:!0,defaultAlign:"left",formattedValue:""};function or(e){return{type:mo.error,value:e.errorType,error:e,isAutoSummable:!1,defaultAlign:"center",formattedValue:e.errorType}}const sr=[function(e,t){if(""===e)return function(e){return void 0===e.format?tr:{type:mo.empty,value:"",format:e.format,isAutoSummable:!0,defaultAlign:"left",formattedValue:""}}(t)},function(e,t){if(t.format&&"number"==typeof e&&Ns(t.format))return function(e,t){const o=Is(e,t);return{type:mo.number,value:e,format:t.format,isAutoSummable:!1,defaultAlign:"right",formattedValue:o}}(e,t)},function(e,t){return"number"==typeof e?er(e,t):null===e?er(0,t):void 0},function(e,t){if("boolean"==typeof e)return function(e,t){const o=e?"TRUE":"FALSE";return{type:mo.boolean,value:e,format:t.format,isAutoSummable:!1,defaultAlign:"center",formattedValue:o}}(e,t)}],nr=new Hi;nr.add("ALPHANUMERIC_INCREMENT_MODIFIER",{apply:(e,t)=>{e.current+=e.increment;const o=`${e.prefix}${e.current.toString().padStart(e.numberPostfixLength||0,"0")}`;return{cellData:{border:t.border,style:t.cell&&t.cell.style,format:t.cell&&t.cell.format,content:o},tooltip:{props:{content:o}}}}}).add("INCREMENT_MODIFIER",{apply:(e,t,o)=>{e.current+=e.increment;const s=e.current.toString(),n=o.getLocale(),i=Is(e.current,{format:t.cell?.format,locale:n});return{cellData:{border:t.border,style:t.cell&&t.cell.style,format:t.cell&&t.cell.format,content:s},tooltip:s?{props:{content:i}}:void 0}}}).add("COPY_MODIFIER",{apply:(e,t,o)=>{const s=t.cell?.content||"",n={locale:o.getLocale(),format:t.cell?.format};return{cellData:{border:t.border,style:t.cell&&t.cell.style,format:t.cell&&t.cell.format,content:s},tooltip:s?{props:{content:Xi(t.cell?.content,n).formattedValue}}:void 0}}}).add("FORMULA_MODIFIER",{apply:(e,t,o,s)=>{e.current+=e.increment;let n=0,i=0;switch(s){case"up":n=0,i=-e.current;break;case"down":n=0,i=e.current;break;case"left":n=-e.current,i=0;break;case"right":n=e.current,i=0}const r=t.cell;if(!r||!r.isFormula)return{cellData:{}};const a=t.sheetId,l=o.getTranslatedCellFormula(a,n,i,r.compiledFormula);return{cellData:{border:t.border,style:r.style,format:r.format,content:l},tooltip:l?{props:{content:l}}:void 0}}});const ir=new Hi,rr=/(\d+)$/,ar=/^(.*\D+)/,lr=/^(.*\D+)(\d+)$/;function cr(e,t,o){let s=[],n=!1;for(let i of t){i===e&&(n=!0);const t=i?.isFormula?void 0:Xi(i?.content,{locale:To});if(t&&o(t))s.push(t);else{if(n)return s;s=[]}}return s}function hr(e){let t=1;return e.length>=2&&(t=function(e){const t=[];let o=e[0];for(let s=1;s<e.length;s++){const n=e[s];t.push(n-o),o=n}return t.reduce(((e,t)=>e+t),0)/t.length}(e)*e.length),t}ir.add("simple_value_copy",{condition:(e,t)=>!(1!==t.length||e.isFormula||e.format&&Ns(e.format)),generateRule:()=>({type:"COPY_MODIFIER"}),sequence:10}).add("increment_alphanumeric_value",{condition:e=>!e.isFormula&&Xi(e.content,{locale:To}).type===mo.text&&lr.test(e.content),generateRule:(e,t)=>{const o=parseInt(e.content.match(rr)[0]),s=e.content.match(ar)[0],n=e.content.length-s.length,i=cr(e,t,(e=>e.type===mo.text&&lr.test(e.value))).filter((e=>s===e.value.toString().match(ar)[0])).map((e=>parseInt(e.value.toString().match(rr)[0]))),r=hr(i);return{type:"ALPHANUMERIC_INCREMENT_MODIFIER",prefix:s,current:o,increment:r,numberPostfixLength:n}},sequence:15}).add("copy_text",{condition:e=>!e.isFormula&&Xi(e.content,{locale:To}).type===mo.text,generateRule:()=>({type:"COPY_MODIFIER"}),sequence:20}).add("update_formula",{condition:e=>e.isFormula,generateRule:(e,t)=>({type:"FORMULA_MODIFIER",increment:t.length,current:0}),sequence:30}).add("increment_number",{condition:e=>!e.isFormula&&Xi(e.content,{locale:To}).type===mo.number,generateRule:(e,t)=>{const o=hr(cr(e,t,(e=>e.type===mo.number)).map((e=>Number(e.value)))),s=Xi(e.content,{locale:To});return{type:"INCREMENT_MODIFIER",increment:o,current:s.type===mo.number?s.value:0}},sequence:40});const dr={};let ur=0;function gr(e,...t){const o="__sheet__"+ur++;return function(e,t){const o=document.createElement("style");o.textContent=function(e){const t=e.split(/(\{|\}|;)/).map((e=>e.trim())),o=[],s=[];let n=[];function i(e,t){const s=[];for(const n of o[e]){let r=t&&t+" "+n||n;r.includes("&")&&(r=n.replace(/&/g,t||"")),e<o.length-1&&(r=i(e+1,r)),s.push(r)}return s.join(", ")}function r(){n.length&&(s.push(i(0)+" {"),s.push(...n),s.push("}"),n=[])}for(;t.length;){let e=t.shift();"}"===e?(r(),o.pop()):("{"===t[0]&&(r(),o.push(e.split(/\s*,\s*/)),t.shift()),";"===t[0]&&n.push(" "+e+";"))}return s.join("\n")}(t),dr[e]=o}(o,String.raw(e,...t)),function(e){const t=dr[e];t.setAttribute("component",e),document.head.appendChild(t)}(o),o}function pr({strikethrough:e,underline:t}){return e||t?`${e?"line-through":""} ${t?"underline":""}`:"none"}function mr(e){const t=function(e){const t={};if(!e)return t;e.bold&&(t["font-weight"]="bold");e.italic&&(t["font-style"]="italic");if(e.strikethrough||e.underline){let o=e.strikethrough?"line-through":"";o=e.underline?o+" underline":o,t["text-decoration"]=o}e.textColor&&(t.color=e.textColor);return t}(e);return e?(e.fillColor&&(t.background=e.fillColor),t):t}function fr(e){let t="";for(const o in e)e[o]&&(t+=`${o}:${e[o]}; `);return t}gr`
1
+ !function(e,t){"use strict";const o=e=>e,s=()=>!1;let n=o,i=s;function r(e,...t){if(1!==t.length||"object"!=typeof t[0]||t[0]instanceof String)t.length>0&&(e=e.replace(/\%s/g,(()=>t.shift())));else{const o=t[0];e=e.replace(/\%\(([^\)]+)\)s/g,((e,t)=>o[t]))}return e}const a=function(e,...t){return i()?r(n(e),...t):new l(e,t)};class l extends String{values;constructor(e,t){super(e),this.values=t}valueOf(){const e=super.valueOf();return i()?r(n(e),...this.values):r(e,...this.values)}toString(){return this.valueOf()}}var c,h;!function(e){e.NotAvailable="#N/A",e.InvalidReference="#REF",e.BadExpression="#BAD_EXPR",e.CircularDependency="#CYCLE",e.UnknownFunction="#NAME?",e.GenericError="#ERROR"}(c||(c={})),function(e){e[e.silent=0]="silent",e[e.error=1]="error"}(h||(h={}));class d extends Error{errorType;logLevel;constructor(e,t,o=h.error){super(t),this.errorType=e,this.logLevel=o}get isVerbose(){return this.logLevel>h.silent}}class u extends d{constructor(e){super(c.BadExpression,e)}}class g extends d{constructor(){super(c.CircularDependency,a("Circular reference"))}}class p extends d{constructor(){super(c.InvalidReference,a("Invalid reference"))}}class m extends d{constructor(e=void 0){super(c.NotAvailable,e||a("Data not available"),e?h.error:h.silent)}}class f extends d{constructor(e){super(c.UnknownFunction,a('Unknown function: "%s"',e))}}const b=.5,v="#f5f5f5",S="#F8F9FA",C="#E8EAED",E="#595959",w="#666666",y="#c9ccd2",x="#3266ca",I="#FFFFFF",R="#EBEBEB",T="#CACACA",A=11982760,O="#01666b",_="#188038",M="#E6F4EA",N="#CEEAD6",F="#E0E2E4",D="#4A4F59",L="#999",P="#E2E3E3",k="#BCBCBC",V="#9B359B",U=["#000000","#434343","#666666","#999999","#B7B7B7","#CCCCCC","#D9D9D9","#EFEFEF","#F3F3F3","#FFFFFF","#980000","#FF0000","#FF9900","#FFFF00","#00FF00","#00FFFF","#4A86E8","#0000FF","#9900FF","#FF00FF","#E6B8AF","#F4CCCC","#FCE5CD","#FFF2CC","#D9EAD3","#D0E0E3","#C9DAF8","#CFE2F3","#D9D2E9","#EAD1DC","#DD7E6B","#EA9999","#F9CB9C","#FFE599","#B6D7A8","#A2C4C9","#A4C2F4","#9FC5E8","#B4A7D6","#D5A6BD","#CC4125","#E06666","#F6B26B","#FFD966","#93C47D","#76A5AF","#6D9EEB","#6FA8DC","#8E7CC3","#C27BA0","#A61C00","#CC0000","#E69138","#F1C232","#6AA84F","#45818E","#3C78D8","#3D85C6","#674EA7","#A64D79","#85200C","#990000","#B45F06","#BF9000","#38761D","#134F5C","#1155CC","#0B5394","#351C75","#741B47","#5B0F00","#660000","#783F04","#7F6000","#274E13","#0C343D","#1C4587","#073763","#20124D","#4C1130"],B=26,H=48,z=96,G=23,$=15,W=18,q=14,Z=4,Y=Z,j=21,X=17,K=2*G,Q=250,J={align:"left",verticalAlign:"bottom",wrapping:"overflow",bold:!1,italic:!1,strikethrough:!1,underline:!1,fontSize:10,fillColor:"",textColor:"#000000"},ee=J.verticalAlign,te=J.wrapping,oe="400",se=J.fontSize,ne="'Roboto', arial",ie="thin",re="#000000",ae={style:"thin",color:_},le=c.InvalidReference,ce="START_REVISION",he=1,de=20,ue="??",ge="difference",pe="#00A04A",me="#DC6965",fe=["'","*","?","/","\\","[","]"],be=/'|\*|\?|\/|\\|\[|\]/,ve="|",Se=a("Invalid expression");var Ce;!function(e){e[e.Grid=0]="Grid",e[e.Highlight=5]="Highlight",e[e.HeaderGroupingButton=6]="HeaderGroupingButton",e[e.Figure=10]="Figure",e[e.ScrollBar=15]="ScrollBar",e[e.GridPopover=19]="GridPopover",e[e.GridComposer=20]="GridComposer",e[e.Dropdown=21]="Dropdown",e[e.IconPicker=25]="IconPicker",e[e.TopBarComposer=30]="TopBarComposer",e[e.Popover=35]="Popover",e[e.FigureAnchor=1e3]="FigureAnchor",e[e.FigureSnapLine=1001]="FigureSnapLine"}(Ce||(Ce={}));let Ee=0;function we(){return Ee}const ye="\n",xe=[6,7,8,9,10,11,12,14,18,24,36];function Ie(e){return'"'===e[0]&&(e=e.slice(1)),'"'===e[e.length-1]&&"\\"!==e[e.length-2]?e.slice(0,e.length-1):e}function Re(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Te(e){const t=Array.isArray(e)?[]:{};switch(typeof e){case"object":if(null===e)return e;if(function(e){return"clone"in e&&e.clone instanceof Function}(e))return e.clone();if(!(function(e){return"object"==typeof e&&null!==e&&(e?.constructor===Object||void 0===e?.constructor)}(e)||e instanceof Array))throw new Error("Unsupported type: only objects and arrays are supported");for(const o in e)t[o]=Te(e[o]);return t;case"number":case"string":case"boolean":case"function":case"undefined":return e;default:throw new Error("Unsupported type: "+typeof e)}}function Ae(e){return e.startsWith("'")&&(e=e.slice(1,-1).replace(/''/g,"'")),e}function Oe(e){return e.match(/\w/g)?.length!==e.length&&(e=`'${e}'`),e}function _e(e,t,o){return e<t?t:e>o?o:e}function Me(e,t,o=1){if(t<=e&&o>0)return[];if(0===o)throw new Error("range() step must not be zero");const s=Math.ceil(Math.abs((t-e)/o)),n=Array(s);for(let t=0;t<s;t++)n[t]=e+t*o;return n}function Ne(e){return e.reduce(((e,t,o,s)=>{if(1===Math.abs(t-s[o-1])){e[e.length-1].push(t)}else e.push([t]);return e}),[])}function*Fe(e,t){t.next();for(const o of e){const e=t.next();yield{...o,next:e.done?void 0:e.value}}}const De=/^\[(.+)\]\((.+)\)$/,Le=/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$/;function Pe(e){return De.test(e)}function ke(e){return Le.test(e)}function Ve(e,t){return`[${e}](${t})`}function Ue(e){const t=e.match(De)||[],o=t[1],s=t[2];if(!o||!s)throw new Error(`Could not parse markdown link ${e}.`);return{label:o,url:s}}const Be="o-spreadsheet://";function He(e){return e.startsWith(Be)}function ze(e){return`${Be}${e}`}function Ge(e){if(e.startsWith(Be))return e.substr(Be.length);throw new Error(`${e} is not a valid sheet link`)}function $e(e){return void 0!==e}function We(e){return null!==e}function qe(e){return void 0===e||Object.values(e).every((e=>"object"==typeof e?qe(e):!e))}function Ze(e,t){for(const o in t)if(Qe(t[o],e))return parseInt(o,10);const o=Object.keys(t),s=0===o.length?0:ht(o.map((e=>parseInt(e,10))));return t[s+1]=e,s+1}function Ye(e){let t="";for(let o=0,s=e.length;o<s;o++)t+=e[o];return t}function je(e){let t,o=!1;const s=()=>(o||(t=e instanceof Function?e():e,o=!0),t);return s.map=e=>je((()=>e(s()))),s}function Xe(e,t){let o=e.slice(t).find((e=>e));return o||(o=e.slice(0,t).reverse().find((e=>e))),o||""}function Ke(e,t){return"after"===e?t+1:t}function Qe(e,t){if(e===t)return!0;if(e&&!t||t&&!e)return!1;if(typeof e!=typeof t)return!1;if("object"!=typeof e)return!1;for(const o in t)if(!(o in e)&&void 0!==t[o])return!1;for(const o in e){if(typeof e[o]!=typeof t[o])return!1;if("object"==typeof e[o]){if(!Qe(e[o],t[o]))return!1}else if(e[o]!==t[o])return!1}return!0}function Je(e,t){return t.every((t=>e.includes(t)))}function et(e){const t={...e};return Object.keys(t).forEach((e=>!t[e]&&delete t[e])),t}const tt=["\t","\f","\v",String.fromCharCode(parseInt("00a0",16)),String.fromCharCode(parseInt("1680",16)),String.fromCharCode(parseInt("2000",16)),String.fromCharCode(parseInt("200a",16)),String.fromCharCode(parseInt("2028",16)),String.fromCharCode(parseInt("2029",16)),String.fromCharCode(parseInt("202f",16)),String.fromCharCode(parseInt("205f",16)),String.fromCharCode(parseInt("3000",16)),String.fromCharCode(parseInt("feff",16))],ot=new RegExp(tt.join("|")+"|(\r\n|\r|\n)","g");function st(e){return e?ot.test(e)?e.replace(ot,((e,t)=>t?ye:" ")):e:""}function nt(e){const t=Array.from(e).sort(((e,t)=>e-t));for(let e=1;e<t.length;e++)if(t[e]-t[e-1]!=1)return!1;return!0}class it extends Set{addMany(e){for(const t of e)super.add(t);return this}deleteMany(e){for(const t of e)super.delete(t)}}function rt(e){const t=new Map,o=e.name?e.name+" (memoized)":"memoized";return{[o]:(...o)=>(t.has(o[0])||t.set(o[0],e(...o)),t.get(o[0]))}[o]}function at(e,t){return e.filter(((e,o)=>!t.includes(o)))}function lt(e){return e.split("\n").map((e=>e.replace(/\s+/g," ").trim())).join("\n")}function ct(e,t,o){return t>o?ct(e,o,t):e>=t&&e<=o}function ht(e){let t=e.length;if(t<1e5)return Math.max(...e);let o=-1/0;for(;t--;)o=e[t]>o?e[t]:o;return o}function dt(e){let t=e.length;if(t<1e5)return Math.min(...e);let o=1/0;for(;t--;)o=e[t]<o?e[t]:o;return o}const ut=/rgba?\(|\s+|\)/gi,gt=/^#([A-F\d]{2}){3,4}$/,pt=["#eb6d00","#0074d9","#ad8e00","#169ed4","#b10dc9","#00a82d","#00a3a3","#f012be","#3d9970","#111111","#62A300","#ff4136","#949494","#85144b","#001f3f"];function mt(e){return ft(e.toString(16).padStart(6,"0"))}function ft(e){let t=e;if(e.startsWith("rgb")?t=function(e){const t=e.replace(ut,"").split(",");let o=255;if(3!==t.length&&4!==t.length)throw new Error("invalid color");if(4===t.length){const e=parseFloat(t.pop()||"1");o=Math.round(255*(e||1))}const s=t.map((e=>parseInt(e,10)));255!==o&&s.push(o);return"#"+Ye(s.map((e=>e.toString(16).padStart(2,"0")))).toUpperCase()}(e):(t=e.replace("#","").toUpperCase(),3!==t.length&&4!==t.length||(t=t.split("").reduce(((e,t)=>e+t+t),"")),t=`#${t}`),!gt.test(t))throw new Error(`invalid color input: ${e}`);return t}function bt(e){try{return ft(e),!0}catch(e){return!1}}const vt=e=>e>=0&&e<=255;function St(e,t,o,s=1){if(!vt(e)||!vt(t)||!vt(o)||s<0||s>1)throw new Error(`Invalid RGBA values ${[e,t,o,s]}`);return{a:s,b:o,g:t,r:e}}function Ct(e){let{r:t,g:o,b:s}=wt(e);t/=255,o/=255,s/=255;const n=e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4;return.2126*n(t)+.7152*n(o)+.0722*n(s)}function Et(e){let t=e.r.toString(16),o=e.g.toString(16),s=e.b.toString(16),n=Math.round(255*e.a).toString(16);return 1===t.length&&(t="0"+t),1===o.length&&(o="0"+o),1===s.length&&(s="0"+s),1===n.length&&(n="0"+n),"ff"===n&&(n=""),("#"+t+o+s+n).toUpperCase()}function wt(e){let t,o,s,n;if(7===(e=ft(e)).length)t=parseInt(e[1]+e[2],16),o=parseInt(e[3]+e[4],16),s=parseInt(e[5]+e[6],16),n=255;else{if(9!==e.length)throw new Error("Invalid color");t=parseInt(e[1]+e[2],16),o=parseInt(e[3]+e[4],16),s=parseInt(e[5]+e[6],16),n=parseInt(e[7]+e[8],16)}return n=+(n/255).toFixed(3),{a:n,r:t,g:o,b:s}}function yt(e){(e={...e}).s/=100,e.l/=100;let t=(1-Math.abs(2*e.l-1))*e.s,o=t*(1-Math.abs(e.h/60%2-1)),s=e.l-t/2,n=0,i=0,r=0;return 0<=e.h&&e.h<60?(n=t,i=o,r=0):60<=e.h&&e.h<120?(n=o,i=t,r=0):120<=e.h&&e.h<180?(n=0,i=t,r=o):180<=e.h&&e.h<240?(n=0,i=o,r=t):240<=e.h&&e.h<300?(n=o,i=0,r=t):300<=e.h&&e.h<360&&(n=t,i=0,r=o),n=Math.round(255*(n+s)),i=Math.round(255*(i+s)),r=Math.round(255*(r+s)),{a:e.a,r:n,g:i,b:r}}function xt(e){const t=e.r/255,o=e.g/255,s=e.b/255;let n=Math.min(t,o,s),i=Math.max(t,o,s),r=i-n,a=0,l=0,c=0;return a=0===r?0:i===t?(o-s)/r%6:i===o?(s-t)/r+2:(t-o)/r+4,a=Math.round(60*a),a<0&&(a+=360),c=(i+n)/2,l=0===r?0:r/(1-Math.abs(2*c-1)),l=+(100*l).toFixed(1),c=+(100*c).toFixed(1),{a:e.a,h:a,s:l,l:c}}function It(e){return Et(yt(e))}function Rt(e){return xt(wt(e))}function Tt(e){if(e<0)throw new Error(`number must be positive. Got ${e}`);return e<26?String.fromCharCode(65+e):Tt(Math.floor(e/26)-1)+Tt(e%26)}const At={};for(const BT of"ABCDEFGHIJKLMNOPQRSTUVWXYZ"){const HT=BT.charCodeAt(0)-64;At[BT]=HT,At[BT.toLowerCase()]=HT}function Ot(e){let t=-1;let o=1;for(let s=e.length-1;s>=0;s--){t+=At[e[s]]*o,o*=26}return t}function _t(e){return e>="A"&&e<="Z"||e>="a"&&e<="z"}function Mt(e){return e>="0"&&e<="9"}function Nt(e){let t;e=e.trim();for(let o=0;o<e.length;o++){const s=e[o];if(!t){if("$"===s&&0===o||_t(s))continue;t=o}if(!Mt(s)){if("$"===s&&o===t)continue;throw new Error(`Invalid cell description: ${e}`)}}if(!t||t===e.length)throw new Error(`Invalid cell description: ${e}`);const o="$"===e[0]?e.slice(1,t):e.slice(0,t),s="$"===e[t]?e.slice(t+1):e.slice(t);if(o.length<1||o.length>3||s.length<1||s.length>7)throw new Error(`Invalid cell description: ${e}`);const n=Ot(o),i=Number(s)-1;if(isNaN(i))throw new Error(`Invalid cell description: ${e}`);return{col:n,row:i}}function Ft(e,t,o={colFixed:!1,rowFixed:!1}){return(o.colFixed?"$":"")+Tt(e)+(o.rowFixed?"$":"")+String(t+1)}class Dt{jsDate;constructor(e,t,o,s=0,n=0,i=0){this.jsDate=new Date(Date.UTC(e,t,o,s,n,i,0))}static fromTimestamp(e){const t=new Date(e);return new Dt(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds())}static now(){const e=new Date;return new Dt(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds())}toString(){return this.jsDate.toString()}toLocaleDateString(){return this.jsDate.toLocaleDateString()}getTime(){return this.jsDate.getTime()}getFullYear(){return this.jsDate.getUTCFullYear()}getMonth(){return this.jsDate.getUTCMonth()}getDate(){return this.jsDate.getUTCDate()}getDay(){return this.jsDate.getUTCDay()}getHours(){return this.jsDate.getUTCHours()}getMinutes(){return this.jsDate.getUTCMinutes()}getSeconds(){return this.jsDate.getUTCSeconds()}setFullYear(e){return this.jsDate.setUTCFullYear(e)}setMonth(e){return this.jsDate.setUTCMonth(e)}setDate(e){return this.jsDate.setUTCDate(e)}setHours(e){return this.jsDate.setUTCHours(e)}setMinutes(e){return this.jsDate.setUTCMinutes(e)}setSeconds(e){return this.jsDate.setUTCSeconds(e)}}const Lt=new Dt(1899,11,30),Pt=864e5,kt=2e3,Vt=Dt.now().getFullYear(),Ut=Dt.now().getMonth(),Bt=Dt.fromTimestamp(0).getTime()-Lt.getTime(),Ht=/^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/,zt=/^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/,Gt=/\/|-|\s/,$t=/^(\d{1,4})[\/-\s](\d{1,4})([\/-\s](\d{1,4}))?$/,Wt=/((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;function qt(e,t){switch(typeof e){case"number":return e;case"string":return Zt(e,t)?jt(e,t)?.value:!e||isNaN(Number(e))?void 0:Number(e);default:return}}function Zt(e,t){return null!==jt(e,t)}const Yt=new Map;function jt(e,t){return Yt.has(t)||Yt.set(t,new Map),Yt.get(t).has(e)||Yt.get(t).set(e,function(e,t){e=e.trim();let o=null;const s=e.match(Wt);if(s){if(o=function(e){if(e=e.trim(),Wt.test(e)){const t=/AM/i.test(e),o=/PM/i.test(e),s=(t||o?e.substring(0,e.length-2).trim():e).split(/:/),n=s.length>=2,i=3===s.length;let r=Number(s[0]),a=n?Number(s[1]):0,l=i?Number(s[2]):0,c=i?"hh:mm:ss":"hh:mm";if(t||o)c+=" a";else if(!n)return null;r>=12&&t?r-=12:r<12&&o&&(r+=12),a+=Math.floor(l/60),l%=60,r+=Math.floor(a/60),a%=60,r>=24&&(c="hhhh:mm:ss");return{value:r/24+a/1440+l/86400,format:c,jsDate:new Dt(1899,11,30,r,a,l)}}return null}(s[0]),null===o)return null;e=e.replace(s[0],"").trim()}let n=null;const i=function(e,t){const o=e.match($t);if(!o)return null;const[,s,n,,i]=o;if(s.length>2&&i&&i.length>2)return null;if(s.length>2)return{year:s,month:n,day:i,dateString:e,type:"ymd"};const r=function(e){switch(e.dateFormat[0]){case"d":return"dmy";case"m":return"mdy";case"y":return"ymd"}throw new Error("Invalid date format in locale")}(t);if(!i)return n.length>2?{month:s,year:n,day:void 0,dateString:e,type:r}:"dmy"===r?{day:s,month:n,year:i,dateString:e,type:"dmy"}:{month:s,day:n,year:i,dateString:e,type:"mdy"};if(i.length>2)return"mdy"===r?{month:s,day:n,year:i,dateString:e,type:"mdy"}:{day:s,month:n,year:i,dateString:e,type:"dmy"};if("mdy"===r)return{month:s,day:n,year:i,dateString:e,type:"mdy"};if("ymd"===r)return{year:s,month:n,day:i,dateString:e,type:"ymd"};if("dmy"===r)return{day:s,month:n,year:i,dateString:e,type:"dmy"};return null}(e,t);if(i){const t=i.dateString.match(Gt)[0];if(n=function(e,t){let{year:o,month:s,day:n}=e;const i=function(e){if(!e)return Ut;const t=Number(e);if(t>=1&&t<=12)return t-1;return null}(s),r=function(e){if(!e)return 1;const t=Number(e);if(t>=0&&t<=31)return t;return null}(n),a=function(e){if(!e)return Vt;const t=Number(e);switch(e.length){case 1:return kt+t;case 2:return kt+(kt+t>Vt+10?-100:0)+t;case 3:case 4:return t}return null}(o);if(null===a||null===i||null===r)return null;const l=2===s?.length&&i+1<10||2===n?.length&&r<10,c=2!==o?.length,h=new Dt(a,i,r);if(h.getMonth()!==i||h.getDate()!==r)return null;const d=h.getTime()-Lt.getTime(),u=function(e,t,o,s){const n=e.year?s?"yyyy":"yy":void 0,i=e.month?o?"mm":"m":void 0,r=e.day?o?"dd":"d":void 0;switch(e.type){case"mdy":return[i,r,n].filter($e).join(t);case"ymd":return[n,i,r].filter($e).join(t);case"dmy":return[r,i,n].filter($e).join(t)}}(e,t,l,c);return{value:Math.round(d/Pt),format:u,jsDate:h}}(i,t),null===n)return null;e=e.replace(i.dateString,"").trim()}if(""!==e||!n&&!o)return null;if(n&&n.jsDate&&o&&o.jsDate)return{value:n.value+o.value,format:n.format+" "+("hhhh:mm:ss"===o.format?"hh:mm:ss":o.format),jsDate:new Dt(n.jsDate.getFullYear()+o.jsDate.getFullYear()-1899,n.jsDate.getMonth()+o.jsDate.getMonth()-11,n.jsDate.getDate()+o.jsDate.getDate()-30,n.jsDate.getHours()+o.jsDate.getHours(),n.jsDate.getMinutes()+o.jsDate.getMinutes(),n.jsDate.getSeconds()+o.jsDate.getSeconds())};return n||o}(e,t)),Yt.get(t).get(e)}function Xt(e){const t=Math.trunc(e);let o=Dt.fromTimestamp(t*Pt-Bt),s=e-t;s=s<0?1+s:s;const n=Math.round(24*s),i=Math.round(24*(s-n/24)*60),r=Math.round(24*(s-n/24-i/24/60)*60*60);return o.setHours(n),o.setMinutes(i),o.setSeconds(r),o}function Kt(e){return Math.round(Qt(e))}function Qt(e){return(e.getTime()-Lt.getTime())/Pt}function Jt(e){return new Dt(e.getFullYear(),e.getMonth()+1,0).getDate()}function eo(e){return Jt(e)===e.getDate()}function to(e,t,o){const s=e.getFullYear(),n=e.getMonth(),i=e.getDate(),r=new Dt(s,n+t,1);return o&&i===Jt(e)||i>Jt(r)?r.setDate(Jt(r)):r.setDate(i),r}function oo(e){const t=Math.trunc(e);return t%4==0&&t%100!=0||t%400==0}function so(e,t,o){if(e===t)return 0;if(e>t){const o=t;t=e,e=o}const s=Xt(e),n=Xt(t);let i=s.getDate(),r=n.getDate();const a=s.getMonth(),l=n.getMonth(),c=s.getFullYear(),h=n.getFullYear();let d=0,u=0;switch(o){case 0:31===i&&(i=30),30===i&&31===r&&(r=30),1===a&&i===(oo(c)?29:28)&&(i=30,1===l&&r===(oo(h)?29:28)&&(r=30)),d=c+(30*a+i)/360,u=h+(30*l+r)/360;break;case 1:let o=365;const s=c===h;if(!s&&!(c+1===h)||!s&&a<l||!s&&a===l&&i<r){let e=0,t=0;for(let o=c;o<=h;o++)e++,t+=oo(o)?366:365;o=t/e}else s?oo(c)&&(o=366):(oo(c)&&a<2&&(o=366),oo(h)&&(l>1||1===l&&29===r)&&(o=366));d=e/o,u=t/o;break;case 2:d=e/360,u=t/360;break;case 3:d=e/365,u=t/365;break;case 4:31===i&&(i=30),31===r&&(r=30),d=c+(30*a+i)/360,u=h+(30*l+r)/360}return u-d}function no(e,t){const o=12*(t.getFullYear()-e.getFullYear())+t.getMonth()-e.getMonth();return e.getDate()>t.getDate()?o-1:o}function io(e,t){const o=e.getTime(),s=t.getTime();return Math.floor((s-o)/Pt)}function ro(e,t){const o=t.getFullYear()-e.getFullYear(),s=e.getMonth(),n=t.getMonth(),i=e.getDate(),r=t.getDate();return n>s||n===s&&r>=i?o:o-1}function ao(e,t,o){return t>o?ao(e,o,t):(e=Math.trunc(e),t=Math.trunc(t),o=Math.trunc(o),e>=t&&e<=o)}const lo=rt((function(e){return e=Re(e),new RegExp(`(^-?\\d+(${e}?\\d*(e\\d+)?)?|^-?${e}\\d+)(?!\\w|!)`)})),co=rt((function(e){const t=Re(e.decimalSeparator),o="(\\s*"+`(\\d+(${Re(e.thousandsSeparator||"")}\\d{3,})*(${t}\\d*)?)`+"|"+`(${t}\\d+)`+")(e(\\+|-)?\\d+)?(\\s*%)?",s="(\\s*-)?",n="(\\s*[\\$€])?",i="^(("+[s+n+o,s+o+n,n+s+o].join(")|(")+"))$";return new RegExp(i,"i")}));function ho(e,t){return!!e&&co(t).test(e.trim())}const uo=rt((function(e){return new RegExp(`[$€${Re(e.thousandsSeparator||"")}]`,"g")}));function go(e,t){"."!==t.decimalSeparator&&(e=e.replace(t.decimalSeparator,".")),e=e.replace(uo(t),"");let o=Number(e);return isNaN(o)&&e.includes("%")&&(o=Number(e.split("%")[0]),!isNaN(o))?o/100:o}function po(e,t,o){const s=[...e].sort(((e,t)=>e-t));let n=(s.length+(o?-1:1))*t;if(o||n--,Number.isInteger(n))return s[n];const i=Math.ceil(n),r=Math.floor(n);return s[i]*(n-r)+s[r]*(i-n)}var mo,fo;!function(e){e.boolean="boolean",e.number="number",e.text="text",e.empty="empty",e.error="error"}(mo||(mo={})),function(e){e.PlainText="text/plain",e.Html="text/html"}(fo||(fo={}));const bo=new Set(["RENAME_SHEET","DELETE_SHEET","CREATE_SHEET","ADD_COLUMNS_ROWS","REMOVE_COLUMNS_ROWS","UNDO","REDO","ADD_MERGE","UPDATE_LOCALE"]),vo=new Set([...bo,"MOVE_RANGES"]),So=new Set([...bo,"DUPLICATE_SHEET","EVALUATE_CELLS","ADD_CONDITIONAL_FORMAT","REMOVE_CONDITIONAL_FORMAT","CHANGE_CONDITIONAL_FORMAT_PRIORITY"]),Co=new Set(["START","ACTIVATE_SHEET","COPY","RESIZE_SHEETVIEW","SET_VIEWPORT_OFFSET","SELECT_SEARCH_NEXT_MATCH","SELECT_SEARCH_PREVIOUS_MATCH","UPDATE_SEARCH","CLEAR_SEARCH","EVALUATE_CELLS","SET_CURRENT_CONTENT","SET_FORMULA_VISIBILITY","OPEN_CELL_POPOVER","CLOSE_CELL_POPOVER","UPDATE_FILTER"]),Eo=new Set(["UPDATE_CELL","UPDATE_CELL_POSITION","CLEAR_CELL","DELETE_CONTENT","ADD_COLUMNS_ROWS","REMOVE_COLUMNS_ROWS","RESIZE_COLUMNS_ROWS","HIDE_COLUMNS_ROWS","UNHIDE_COLUMNS_ROWS","SET_GRID_LINES_VISIBILITY","UNFREEZE_COLUMNS","UNFREEZE_ROWS","FREEZE_COLUMNS","FREEZE_ROWS","UNFREEZE_COLUMNS_ROWS","ADD_MERGE","REMOVE_MERGE","CREATE_SHEET","DELETE_SHEET","DUPLICATE_SHEET","MOVE_SHEET","RENAME_SHEET","HIDE_SHEET","SHOW_SHEET","MOVE_RANGES","ADD_CONDITIONAL_FORMAT","REMOVE_CONDITIONAL_FORMAT","CHANGE_CONDITIONAL_FORMAT_PRIORITY","CREATE_FIGURE","DELETE_FIGURE","UPDATE_FIGURE","SET_FORMATTING","CLEAR_FORMATTING","SET_BORDER","SET_ZONE_BORDERS","CREATE_CHART","UPDATE_CHART","CREATE_FILTER_TABLE","REMOVE_FILTER_TABLE","CREATE_IMAGE","GROUP_HEADERS","UNGROUP_HEADERS","UNFOLD_HEADER_GROUP","FOLD_HEADER_GROUP","FOLD_ALL_HEADER_GROUPS","UNFOLD_ALL_HEADER_GROUPS","UNFOLD_HEADER_GROUPS_IN_ZONE","FOLD_HEADER_GROUPS_IN_ZONE","ADD_DATA_VALIDATION_RULE","REMOVE_DATA_VALIDATION_RULE","UPDATE_LOCALE"]);function wo(e){return Eo.has(e.type)}class yo{reasons;constructor(e=[]){Array.isArray(e)||(e=[e]),e=[...new Set(e)],this.reasons=e.filter((e=>"Success"!==e))}static get Success(){return xo}get isSuccessful(){return 0===this.reasons.length}isCancelledBecause(e){return this.reasons.includes(e)}}const xo=new yo;var Io;e.CommandResult=void 0,(Io=e.CommandResult||(e.CommandResult={})).Success="Success",Io.CancelledForUnknownReason="CancelledForUnknownReason",Io.WillRemoveExistingMerge="WillRemoveExistingMerge",Io.MergeIsDestructive="MergeIsDestructive",Io.CellIsMerged="CellIsMerged",Io.InvalidTarget="InvalidTarget",Io.EmptyUndoStack="EmptyUndoStack",Io.EmptyRedoStack="EmptyRedoStack",Io.NotEnoughElements="NotEnoughElements",Io.NotEnoughSheets="NotEnoughSheets",Io.MissingSheetName="MissingSheetName",Io.UnchangedSheetName="UnchangedSheetName",Io.DuplicatedSheetName="DuplicatedSheetName",Io.DuplicatedSheetId="DuplicatedSheetId",Io.ForbiddenCharactersInSheetName="ForbiddenCharactersInSheetName",Io.WrongSheetMove="WrongSheetMove",Io.WrongSheetPosition="WrongSheetPosition",Io.InvalidAnchorZone="InvalidAnchorZone",Io.SelectionOutOfBound="SelectionOutOfBound",Io.TargetOutOfSheet="TargetOutOfSheet",Io.WrongCutSelection="WrongCutSelection",Io.WrongPasteSelection="WrongPasteSelection",Io.WrongPasteOption="WrongPasteOption",Io.WrongFigurePasteOption="WrongFigurePasteOption",Io.EmptyClipboard="EmptyClipboard",Io.EmptyRange="EmptyRange",Io.InvalidRange="InvalidRange",Io.InvalidZones="InvalidZones",Io.InvalidSheetId="InvalidSheetId",Io.InvalidFigureId="InvalidFigureId",Io.InputAlreadyFocused="InputAlreadyFocused",Io.MaximumRangesReached="MaximumRangesReached",Io.MinimumRangesReached="MinimumRangesReached",Io.InvalidChartDefinition="InvalidChartDefinition",Io.InvalidDataSet="InvalidDataSet",Io.InvalidLabelRange="InvalidLabelRange",Io.InvalidScorecardKeyValue="InvalidScorecardKeyValue",Io.InvalidScorecardBaseline="InvalidScorecardBaseline",Io.InvalidGaugeDataRange="InvalidGaugeDataRange",Io.EmptyGaugeRangeMin="EmptyGaugeRangeMin",Io.GaugeRangeMinNaN="GaugeRangeMinNaN",Io.EmptyGaugeRangeMax="EmptyGaugeRangeMax",Io.GaugeRangeMaxNaN="GaugeRangeMaxNaN",Io.GaugeRangeMinBiggerThanRangeMax="GaugeRangeMinBiggerThanRangeMax",Io.GaugeLowerInflectionPointNaN="GaugeLowerInflectionPointNaN",Io.GaugeUpperInflectionPointNaN="GaugeUpperInflectionPointNaN",Io.GaugeLowerBiggerThanUpper="GaugeLowerBiggerThanUpper",Io.InvalidAutofillSelection="InvalidAutofillSelection",Io.WrongComposerSelection="WrongComposerSelection",Io.MinBiggerThanMax="MinBiggerThanMax",Io.LowerBiggerThanUpper="LowerBiggerThanUpper",Io.MidBiggerThanMax="MidBiggerThanMax",Io.MinBiggerThanMid="MinBiggerThanMid",Io.FirstArgMissing="FirstArgMissing",Io.SecondArgMissing="SecondArgMissing",Io.MinNaN="MinNaN",Io.MidNaN="MidNaN",Io.MaxNaN="MaxNaN",Io.ValueUpperInflectionNaN="ValueUpperInflectionNaN",Io.ValueLowerInflectionNaN="ValueLowerInflectionNaN",Io.MinInvalidFormula="MinInvalidFormula",Io.MidInvalidFormula="MidInvalidFormula",Io.MaxInvalidFormula="MaxInvalidFormula",Io.ValueUpperInvalidFormula="ValueUpperInvalidFormula",Io.ValueLowerInvalidFormula="ValueLowerInvalidFormula",Io.InvalidSortZone="InvalidSortZone",Io.WaitingSessionConfirmation="WaitingSessionConfirmation",Io.MergeOverlap="MergeOverlap",Io.TooManyHiddenElements="TooManyHiddenElements",Io.Readonly="Readonly",Io.InvalidViewportSize="InvalidViewportSize",Io.InvalidScrollingDirection="InvalidScrollingDirection",Io.FigureDoesNotExist="FigureDoesNotExist",Io.InvalidConditionalFormatId="InvalidConditionalFormatId",Io.InvalidCellPopover="InvalidCellPopover",Io.EmptyTarget="EmptyTarget",Io.InvalidFreezeQuantity="InvalidFreezeQuantity",Io.FrozenPaneOverlap="FrozenPaneOverlap",Io.ValuesNotChanged="ValuesNotChanged",Io.InvalidFilterZone="InvalidFilterZone",Io.FilterOverlap="FilterOverlap",Io.FilterNotFound="FilterNotFound",Io.MergeInFilter="MergeInFilter",Io.NonContinuousTargets="NonContinuousTargets",Io.DuplicatedFigureId="DuplicatedFigureId",Io.InvalidSelectionStep="InvalidSelectionStep",Io.DuplicatedChartId="DuplicatedChartId",Io.ChartDoesNotExist="ChartDoesNotExist",Io.InvalidHeaderIndex="InvalidHeaderIndex",Io.InvalidQuantity="InvalidQuantity",Io.MoreThanOneColumnSelected="MoreThanOneColumnSelected",Io.EmptySplitSeparator="EmptySplitSeparator",Io.SplitWillOverwriteContent="SplitWillOverwriteContent",Io.NoSplitSeparatorInSelection="NoSplitSeparatorInSelection",Io.NoActiveSheet="NoActiveSheet",Io.InvalidLocale="InvalidLocale",Io.AlreadyInPaintingFormatMode="AlreadyInPaintingFormatMode",Io.MoreThanOneRangeSelected="MoreThanOneRangeSelected",Io.NoColumnsProvided="NoColumnsProvided",Io.ColumnsNotIncludedInZone="ColumnsNotIncludedInZone",Io.DuplicatesColumnsSelected="DuplicatesColumnsSelected",Io.InvalidHeaderGroupStartEnd="InvalidHeaderGroupStartEnd",Io.HeaderGroupAlreadyExists="HeaderGroupAlreadyExists",Io.UnknownHeaderGroup="UnknownHeaderGroup",Io.UnknownDataValidationRule="UnknownDataValidationRule",Io.UnknownDataValidationCriterionType="UnknownDataValidationCriterionType",Io.InvalidDataValidationCriterionValue="InvalidDataValidationCriterionValue",Io.InvalidNumberOfCriterionValues="InvalidNumberOfCriterionValues",Io.BlockingValidationRule="BlockingValidationRule",Io.InvalidCopyPasteSelection="InvalidCopyPasteSelection",Io.NoChanges="NoChanges",Io.InvalidInputId="InvalidInputId";const Ro=[{name:"English (US)",code:"en_US",thousandsSeparator:",",decimalSeparator:".",dateFormat:"m/d/yyyy",timeFormat:"hh:mm:ss a",formulaArgSeparator:","},{name:"French",code:"fr_FR",thousandsSeparator:" ",decimalSeparator:",",dateFormat:"dd/mm/yyyy",timeFormat:"hh:mm:ss",formulaArgSeparator:";"}],To=Ro[0],Ao=["thin","medium","thick","dashed","dotted"];function Oo(e){return Array.isArray(e)&&Array.isArray(e[0])}var _o,Mo;!function(e){e.UP="up",e.DOWN="down",e.LEFT="left",e.RIGHT="right"}(_o||(_o={})),function(e){e[e.Background=0]="Background",e[e.Highlights=1]="Highlights",e[e.Clipboard=2]="Clipboard",e[e.Search=3]="Search",e[e.Chart=4]="Chart",e[e.Autofill=5]="Autofill",e[e.Selection=6]="Selection",e[e.Headers=7]="Headers"}(Mo||(Mo={}));const No=["number","string","boolean","undefined"];function Fo(e,t){if(!e())throw new d(c.GenericError,t)}const Do=e=>a("The function [[FUNCTION_NAME]] expects a number value, but '%s' is a string, and cannot be coerced to a number.",e);function Lo(e,t){switch(typeof e){case"number":return e;case"boolean":return e?1:0;case"string":if(ho(e,t)||""===e)return go(e,t);const o=jt(e,t);if(o)return o.value;throw new Error(Do(e));default:return 0}}function Po(e,t){try{return Lo(e,t)}catch(e){return}}function ko(e,t){return e.forEach((e=>{e.forEach((e=>{if("number"!=typeof e)throw new Error(a("Function [[FUNCTION_NAME]] expects number values for %s, but got a %s.",typeof e,t))}))})),e}function Vo(e,t){if(""===e)throw new Error(Do(e));return Lo(e,t)}function Uo(e,t){return Math.trunc(Lo(e,t))}function Bo(e,t){return Math.trunc(Vo(e,t))}function Ho(e){Fo((()=>e>=1),a("The function [[FUNCTION_NAME]] expects a number value to be greater than or equal to 1, but receives %s.",e.toString()))}function zo(e){switch(typeof e){case"string":return e;case"number":return e.toString();case"boolean":return e?"TRUE":"FALSE";default:return""}}const Go=rt((function(e){return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"")})),$o=e=>a("The function [[FUNCTION_NAME]] expects a boolean value, but '%s' is a text, and cannot be coerced to a number.",e);function Wo(e){switch(typeof e){case"boolean":return e;case"string":if(e){let t=e.toUpperCase();if("TRUE"===t)return!0;if("FALSE"===t)return!1;throw new Error($o(e))}return!1;case"number":return!!e;default:return!1}}function qo(e,t){return Xt(Lo(e,t))}function Zo(e,t,o){for(let s of e)if(Oo(s)){const e=s.length,o=s[0].length;for(let n=0;n<o;n++)for(let o=0;o<e;o++)t(s[o][n])}else o(s)}function Yo(e,t){Zo(e,t,t)}function jo(e,t,o){Zo(e,(e=>{"number"==typeof e&&t(e)}),(e=>{t(Vo(e,o))}))}function Xo(e,t,o,s,n="rowFirst"){let i=s;for(let s of e)if(Oo(s)){const e=s.length,o=s[0].length;if("rowFirst"===n)for(let n=0;n<o;n++)for(let o=0;o<e;o++)i=t(i,s[o][n]);else for(let n=0;n<e;n++)for(let e=0;e<o;e++)i=t(i,s[n][e])}else i=o(i,s);return i}function Ko(e,t,o,s="rowFirst"){return Xo(e,t,t,o,s)}function Qo(e,t,o,s){return Xo(e,((e,o)=>"number"==typeof o?t(e,o):e),((e,o)=>t(e,Vo(o,s))),o)}function Jo(e,t,o,s){return Xo(e,((e,o)=>null!=o?t(e,"number"==typeof o?o:"boolean"==typeof o?Lo(o,s):0):e),((e,o)=>t(e,Lo(o,s))),o)}function es(e,t,o){const s=Array(e);for(let n=0;n<e;n++){s[n]=Array(t);for(let e=0;e<t;e++)s[n][e]=o(n,e)}return s}function ts(e,t){return 0===e.length?[]:es(e.length,e[0].length,((o,s)=>t(e[o][s])))}function os(e){return e.length?es(e[0].length,e.length,((t,o)=>e[o][t])):[]}function ss(e,t){return function(e,t,o){for(let s of e)if(Oo(s)){const e=s.length,o=s[0].length;for(let n=0;n<o;n++)for(let o=0;o<e;o++)if(!t(s[o][n]??void 0))return}else if(!o(s))return}(e,(e=>"boolean"==typeof e?t(e):"number"!=typeof e||t(!!e)),(e=>null==e||t(function(e){if(""===e)throw new Error($o(e));return Wo(e)}(e))))}function ns(e,t,o){let s,n,i=e.substring(0,2);"<="===i||">="===i||"<>"===i?(s=i,n=e.substring(2)):(i=e.substring(0,1),"<"===i||">"===i||"="===i?(s=i,n=e.substring(1)):(s="=",n=e)),ho(n,o)||Zt(n,o)?n=Lo(n,o):"TRUE"!==n&&"FALSE"!==n||(n=Wo(n));const r={operator:s,operand:n};return"string"==typeof n&&(t&&(n+="*"),r.regexp=function(e){if("*"===e)return/.+/;let t="",o="";for(let s of e)"?"===s&&"~"!==o?t+=".":"*"===s&&"~"!==o?t+=".*":("*"!==s&&"?"!==s||(t=t.slice(0,-1)),["^",".","[","]","$","(",")","*","+","?","|","{","}","\\"].includes(s)&&(t+="\\"),t+=s),o=s;return new RegExp("^"+t+"$","i")}(n)),r}function is(e="",t){const{operator:o,operand:s}=t;if(void 0===s||null===e||null===s)return!1;if("number"==typeof s&&"="===o)return zo(e)===zo(s);if("<>"===o||"="===o){let n;return n=typeof e==typeof s&&("string"==typeof e&&t.regexp?t.regexp.test(e):e===s),"="===o?n:!n}if(typeof e==typeof s)switch(o){case"<":return e<s;case">":return e>s;case"<=":return e<=s;case">=":return e>=s}return!1}function rs(e,t,o,s=!1){const n=e.length;if(n%2==1)throw new Error(a("Function [[FUNCTION_NAME]] expects criteria_range and criterion to be in pairs."));const i=e[0].length,r=e[0][0].length;let l=[];for(let t=0;t<n-1;t+=2){const n=e[t];if(!Oo(n)||n.length!==i||n[0].length!==r)throw new Error(a("Function [[FUNCTION_NAME]] expects criteria_range to have the same dimension"));const c=zo(e[t+1]);l.push(ns(c,s,o))}for(let o=0;o<i;o++)for(let s=0;s<r;s++){let i=!0;for(let t=0;t<n-1;t+=2){if(i=is(e[t][o][s]??void 0,l[t/2]),!i)break}i&&t(o,s)}}function as(e,t,o,s,n,i){if(null==t)return-1;const r=cs(t),a=typeof r;let l,c,h,d,u,g,p=0,m=n-1;for(;m-p>=0;){for(h=Math.floor((p+m)/2),d=h,u=cs(i(e,d)),g=typeof u;p<d&&a!==g;)d--,u=cs(i(e,d)),g=typeof u;g===a&&null!=u?("strict"===o&&u===r?(l=u,c=d):"nextSmaller"===o&&u<=r?(null==l||l<u||l===u&&"asc"===s&&c<d||l===u&&"desc"===s&&c>d)&&(l=u,c=d):"nextGreater"===o&&u>=r&&(void 0===l||l>u||l===u&&"asc"===s&&c<d||l===u&&"desc"===s&&c>d)&&(l=u,c=d),"asc"===s&&u>r||"desc"===s&&u<=r?m=d-1:p=h+1):p=h+1}return void 0!==c?c:-1}function ls(e,t,o,s,n,i=!1){if(null==t)return-1;const r=cs(t),a=i?(e,t)=>n(e,s-t-1):n;let l,c=-1;for(let t=0;t<s;t++){const n=cs(a(e,t));if(n===r)return i?s-t-1:t;"nextSmaller"===o?(!l&&hs(r,n)>=0||hs(r,n)>=0&&hs(n,l)>0)&&(l=n,c=t):"nextGreater"===o&&(!l&&hs(r,n)<=0||hs(r,n)<=0&&hs(n,l)<0)&&(l=n,c=t)}return i?s-c-1:c}function cs(e){return"string"==typeof e?Go(e):e}function hs(e,t){let o=No.indexOf(typeof e)-No.indexOf(typeof t);return 0===o&&("string"==typeof e&&"string"==typeof t?o=e.localeCompare(t):"number"==typeof e&&"number"==typeof t?o=e-t:"boolean"==typeof e&&"boolean"==typeof t&&(o=Number(e)-Number(t))),o}function ds(e){return void 0===e?[[]]:Oo(e)?e:[[e]]}function us(e,t){return Ko(e,((e,o)=>(e.push(t(o)),e)),[],"rowFirst")}function gs(e){const t=Dt.now();switch(e){case"today":return Qt(t);case"yesterday":return Qt(Dt.fromTimestamp(t.setDate(t.getDate()-1)));case"tomorrow":return Qt(Dt.fromTimestamp(t.setDate(t.getDate()+1)));case"lastWeek":return Qt(Dt.fromTimestamp(t.setDate(t.getDate()-7)));case"lastMonth":return Qt(Dt.fromTimestamp(t.setMonth(t.getMonth()-1)));case"lastYear":return Qt(Dt.fromTimestamp(t.setFullYear(t.getFullYear()-1)))}}function ps(e,t){return"dateValue"in e&&"exactDate"!==e.dateValue?[gs(e.dateValue)]:e.values.map((e=>qt(e,t)))}function ms(e,t){return e.values.map((e=>Po(e,t)))}function fs(e){return 20+120*Math.exp(-.035*(e-1))}const bs=20,vs=11,Ss=/(\d+?)(?=(\d{3})+(?!\d)|$)/g,Cs=/0/g,Es={0:a("January"),1:a("February"),2:a("March"),3:a("April"),4:a("May"),5:a("June"),6:a("July"),7:a("August"),8:a("September"),9:a("October"),10:a("November"),11:a("December")},ws={0:a("Sunday"),1:a("Monday"),2:a("Tuesday"),3:a("Wednesday"),4:a("Thursday"),5:a("Friday"),6:a("Saturday")},ys={};function xs(e){let t=ys[e];return void 0===t&&(t=function(e){if(""===e)throw new Error("A format cannot be empty");let t=0,o=[];for(;t<e.length;){let s;if("["===e.charAt(t)){if("$"!==e.charAt(t+1))throw new Error(`Currency formats have to be prefixed by a $: ${e}`);if(s=e.substring(t+1).indexOf("]")+t+2,0===s)throw new Error(`Invalid currency brackets format: ${e}`);const n=e.substring(t+2,s-1);if(n.includes("["))throw new Error(`Invalid currency format: ${e}`);o.push({type:"STRING",format:n})}else{const n=e.substring(t).indexOf("[");s=n>-1?n+t:e.length;const i=e.substring(t,s);Ns(i)?o.push({type:"DATE",format:i}):o.push({type:"NUMBER",format:Zs(i)})}t=s}return o}(e),ys[e]=t),t}function Is(e,{format:t,locale:o}){switch(typeof e){case"string":return e.includes('\\"')?e.replace(/\\"/g,'"'):e;case"boolean":return e?"TRUE":"FALSE";case"number":t||(t=Vs(e));return function(e,t,o){if("DATE"===t[0].type)return Ds(e,t[0].format);let s=e<0?"-":"";for(let n of t)switch(n.type){case"NUMBER":s+=Rs(Math.abs(e),n.format,o);break;case"STRING":s+=n.format}return s}(e,xs(t),o);case"object":return"0"}}function Rs(e,t,o){t.isPercent&&(e*=100),e/=t.magnitude;let s=0;void 0!==t.decimalPart&&(s=t.decimalPart.length);const{integerDigits:n,decimalDigits:i}=As(e,s);let r=function(e,t,o){const s="0"===e?"":e;let n=s;const i=t.length-s.length;if(i>0){const e=(t.substring(0,i).match(Cs)||[]).length;n="0".repeat(e)+n}o&&(n=n.match(Ss)?.join(o)||n);return n}(n,t.integerPart,t.thousandsSeparator?o.thousandsSeparator:void 0);return void 0!==t.decimalPart&&(r+=o.decimalSeparator+function(e,t){let o=e;if(t.length-e.length>0){const s=(t.substring(e.length,t.length+1).match(Cs)||[]).length;o+="0".repeat(s)}return o}(i||"",t.decimalPart)),t.isPercent&&(r+="%"),r}const Ts=[];function As(e,t=bs){const o=e.toString();if(o.includes("e"))return function(e,t=bs){let o=Ts[t];o||(o=new Intl.NumberFormat("en-US",{maximumFractionDigits:t,useGrouping:!1}),Ts[t]=o);const[s,n]=o.format(e).split(".");return{integerDigits:s,decimalDigits:n}}(e,t);if(Number.isInteger(e))return{integerDigits:o,decimalDigits:void 0};const s=o.indexOf(".");let n=o.substring(0,s),i=o.substring(s+1);if(0===t)return Number(i[0])>=5&&(n=(Number(n)+1).toString()),{integerDigits:n,decimalDigits:void 0};if(i.length>t){const{integerDigits:e,decimalDigits:o}=function(e,t){let o="0",s=e,n=e.slice(0,t);const i=t;if(Number(e[i])<5)return{integerDigits:o,decimalDigits:n};const r=n.match(_s)?.[0]||"",a=(Number(n)+1).toString(),l=n.slice(r.length),c=a.length>l.length;c&&!r?(o="1",s=void 0):s=c?r.slice(0,-1)+a:r+a;return{integerDigits:o,decimalDigits:s}}(i,t);i=o,"0"!==e&&(n=(Number(n)+Number(e)).toString())}return{integerDigits:n,decimalDigits:Os(i||"")}}function Os(e){let t=e.length-1;for(;t>=0&&"0"===e[t];)t--;return e.slice(0,t+1)||void 0}const _s=/^0+/;function Ms(e,t){const{integerDigits:o,decimalDigits:s}=As(e,20);return s?o+t+s:o}function Ns(e){if(!Fs.has(e[0]))return!1;try{return Ds(1,e),!0}catch(e){return!1}}const Fs=new Set(["h","m","y","d"]);function Ds(e,t){const o=Xt(e),s=t.indexOf("h");let n="",i="";return s>0?(n=Ls(o,t.substring(0,s-1)),i=Ps(o,t.substring(s))):0===s?i=Ps(o,t):s<0&&(n=Ls(o,t)),n+(n&&i?" ":"")+i}function Ls(e,t){const o=t.match(/\/|-|\s/)?.[0];return(o?t.split(o):[t]).map((o=>{switch(o){case"d":return e.getDate();case"dd":return e.getDate().toString().padStart(2,"0");case"ddd":return ws[e.getDay()].slice(0,3);case"dddd":return ws[e.getDay()];case"m":return e.getMonth()+1;case"mm":return String(e.getMonth()+1).padStart(2,"0");case"mmm":return Es[e.getMonth()].slice(0,3);case"mmmm":return Es[e.getMonth()];case"mmmmm":return Es[e.getMonth()].slice(0,1);case"yy":const o=String(e.getFullYear()).replace("-","").padStart(2,"0");return o.slice(o.length-2);case"yyyy":return e.getFullYear();default:throw new Error(`invalid format: ${t}`)}})).join(o)}function Ps(e,t){let o=t.split(/:|\s/);const s=e.getHours(),n="a"===o[o.length-1];let i=s,r="";return n&&(i=0===i?12:i>12?i-12:i,r=s>=12?" PM":" AM",o.pop()),o.map((o=>{switch(o){case"hhhh":return Math.floor((e.getTime()-Lt.getTime())/36e5).toString();case"hh":return i.toString().padStart(2,"0");case"mm":return e.getMinutes().toString().padStart(2,"0");case"ss":return e.getSeconds().toString().padStart(2,"0");default:throw new Error(`invalid format: ${t}`)}})).join(":")+r}const ks=rt((function(e){return new RegExp(`[0-9]+${Re(e.decimalSeparator)}[0-9]`)}));function Vs(e){let{integerDigits:t,decimalDigits:o}=As(e);if(!o)return"0";const s=t.replace("-","").length;if(s+2>vs)return"0";const n=vs-s-1;return({decimalDigits:o}=As(e,Math.min(n,o.length))),o?"0."+"0".repeat(o.length):"0"}function Us(e,t){if(!Zt(e,t))return;return jt(e,t).format}function Bs(e){if(!ho(e,To))return;const t=e.includes(".")?"0.00":"0",o=e.match(/[\$€]/);if(o){const s=e.match(/[\d]/),n="[$"+o.values().next().value+"]";return s.index<o.index?"#,##"+t+n:n+"#,##"+t}return e.includes("%")?t+"%":void 0}function Hs(e){const t=e.decimalPlaces??2,o=e.position??"before",s=e.code??"",n=e.symbol??"",i="#,##0"+(t?"."+"0".repeat(t):"");let r=`${s} ${n}`.trim();return"after"===o&&s&&(r=" "+r),function(e,t,o){const s=`[$${e}]`;return"before"===t?s+o:o+s}(r,o,i)}function zs(e){return js(xs(e).map((e=>"NUMBER"===e.type?{type:e.type,format:{...e.format,decimalPart:void 0}}:e)))}function Gs(e,t,o,s){const n=xs(e||"#,##0"),i=[];for(let e=0;e<n.length;e++){const s=n[e];if("NUMBER"!==s.type){i.push(s);continue}i.push({...s,format:{...s.format,magnitude:t,decimalPart:void 0}}),i.push({type:"STRING",format:o});const r=n[e+1];"STRING"===r?.type&&["k","m","b"].includes(r.format)&&e++}return js(i)}function $s(e,t,o){const s=xs(e).map((e=>"NUMBER"===e.type?{...e,format:Ws(e.format,t)}:e)),n=js(s);return ys[n]=s,n}function Ws(e,t){const o={...e},s=Math.sign(t),n=o.decimalPart?.length||0,i=Math.min(Math.max(0,n+s),bs);return o.decimalPart="0".repeat(i),""===o.decimalPart&&delete o.decimalPart,o}const qs=/,*?$/;function Zs(e){if(function(e){return Boolean(e.replace(Ys,""))}(e=e.trim()))throw new Error(`Invalid number format: ${e}`);const t=e.includes("%"),o=e.match(qs)?.[0]||"",s=o?1e3**o.length:1;let n=e.slice(0,e.length-(o.length||0));const i=n.includes(",");if(/\..*,/.test(n))throw new Error("A format can't contain ',' symbol in the decimal part");n=n.replace("%","").replace(",","");const r=n.match(/[\%|,]/);if(r)throw new Error(`A format can only contain a single '${r[0]}' symbol`);const[a,l]=n.split(".");if(l&&l.length>20)throw new Error("A format can't contain more than 20 decimal places");return void 0!==l?{integerPart:a,isPercent:t,thousandsSeparator:i,decimalPart:l,magnitude:s}:{integerPart:a,isPercent:t,thousandsSeparator:i,magnitude:s}}const Ys=/[,#0.%]/g;function js(e){let t="";for(let o of e){let e;switch(o.type){case"NUMBER":const t=o.format;e=t.integerPart,t.thousandsSeparator&&(e=e.slice(0,-3)+","+e.slice(-3)),void 0!==t.decimalPart&&(e+="."+t.decimalPart),t.isPercent&&(e+="%"),t.magnitude&&(e+=",".repeat(Math.log10(t.magnitude)/3));break;case"STRING":e=`[$${o.format}]`;break;case"DATE":e=o.format}t+=e}return t}const Xs=new RegExp(/\$?([A-Z]{1,3})\$?([0-9]{1,7})/,"i"),Ks=new RegExp(/^\$?([A-Z]{1,3})\$?([0-9]{1,7})$/,"i"),Qs=new RegExp(/^\$?([A-Z]{1,3})+$/,"i"),Js=new RegExp(/^\$?([0-9]{1,7})+$/,"i"),en=new RegExp(/^\s*('.+'!|[^']+!)?\$?([A-Z]{1,3})$/,"i"),tn=new RegExp(/^\s*('.+'!|[^']+!)?\$?([0-9]{1,7})$/,"i"),on=new RegExp(/^\s*('.+'!|[^']+!)?/.source+"("+[Xs.source,/(\$?[A-Z]{1,3})?\$?[0-9]{1,7}\s*:\s*(\$?[A-Z]{1,3})?\$?[0-9]{1,7}\s*/i.source,/\$?[A-Z]{1,3}(\$?[0-9]{1,7})?\s*:\s*\$?[A-Z]{1,3}(\$?[0-9]{1,7})?\s*/i.source].join("|")+")"+/$/.source,"i");function sn(e){return en.test(e)}function nn(e){return tn.test(e)}function rn(e){return Qs.test(e)}function an(e){return Js.test(e)}function ln(e){return Ks.test(e)}function cn(e){const t=e.split("!"),o=t.pop();return{sheetName:Ae(t.join("!"))||void 0,xc:o}}function hn(e){const t=function(e){e.includes("!")&&(e=e.split("!").at(-1)),e.includes("$")&&(e=e.replaceAll("$",""));let t,o,s,n,i,r="";e.includes(":")?([r,t]=e.split(":"),r=r.trim(),t=t.trim()):r=e.trim();let a=!1,l=!1,c=!1;if(sn(r))n=i=Ot(r),o=s=0,a=!0;else if(nn(r))o=s=parseInt(r,10)-1,n=i=0,l=!0;else{const e=Nt(r);n=i=e.col,o=s=e.row,c=!0}if(t)if(sn(t))i=Ot(t),a=!0;else if(nn(t))s=parseInt(t,10)-1,l=!0;else{const e=Nt(t);i=e.col,s=e.row,o=a?s:o,n=l?i:n,c=!0}if(a&&l)throw new Error("Wrong zone xc. The zone cannot be at the same time a full column and a full row");const h={top:o,left:n,bottom:a?void 0:s,right:l?void 0:i};return c=c&&(l||a),c&&(h.hasHeader=c),h}(e);if(void 0!==t.right&&t.right<t.left){const e=t.left;t.left=t.right,t.right=e}if(void 0!==t.bottom&&t.bottom<t.top){const e=t.top;t.top=t.bottom,t.bottom=e}return t}function dn(e){const t=hn(e);if(void 0===t.bottom||void 0===t.right)throw new Error("This does not support unbounded ranges");return t}function un(e){const{bottom:t,top:o,left:s,right:n}=e;return!(void 0!==t&&isNaN(t)||isNaN(o)||isNaN(s)||void 0!==n&&isNaN(n))&&(gn(e)&&e.top>=0&&e.left>=0)}function gn(e){return(void 0===e.bottom||e.bottom>=e.top&&e.bottom>=0)&&(void 0===e.right||e.right>=e.left&&e.right>=0)}function pn(e){const{top:t,bottom:o,left:s,right:n}=e,i="hasHeader"in e&&e.hasHeader,r=t===o&&s===n;if(void 0===o&&void 0!==n)return 0!==t||i?`${Ft(s,t)}:${Tt(n)}`:`${Tt(s)}:${Tt(n)}`;if(void 0===n&&void 0!==o)return 0!==s||i?`${Ft(s,t)}:${o+1}`:`${t+1}:${o+1}`;if(void 0!==o&&void 0!==n)return r?Ft(s,t):`${Ft(s,t)}:${Ft(n,o)}`;throw new Error(a("Bad zone format"))}function mn(e,t,o,s,n){const i="left"===t?"columns":"rows",r="before"===s?o-1:o,a=e["left"===t?"right":"bottom"];return e[t]<=r&&a&&a>r?_n(e,i,"RESIZE",n):r<e[t]?_n(e,i,"MOVE",n):{...e}}function fn(e,t,o,s,n){const i="left"===t?"columns":"rows",r="before"===s?o-1:o,a="left"===t?"right":"bottom";return e[t]<=r&&e[a]>r?_n(e,i,"RESIZE",n):r<e[t]?_n(e,i,"MOVE",n):{...e}}function bn(e,t,o){const s="left"===t?"right":"bottom";let n=e[t],i=e[s];for(let r of o.sort(((e,t)=>t-e)))e[t]>r&&(n--,i--),e[t]<r&&e[s]>=r&&i--;return{...e,[t]:n,[s]:i}}function vn(e,t,o){const s="left"===t?"right":"bottom";let n=e[t],i=e[s];const r=e[s];for(let s of o.sort(((e,t)=>t-e)))e[t]>s&&(n--,void 0!==i&&i--),void 0!==r&&void 0!==i&&e[t]<=s&&r>=s&&i--;if(!(void 0!==i&&n>i))return{...e,[t]:n,[s]:i}}function Sn(...e){return{top:Math.min(...e.map((e=>e.top))),left:Math.min(...e.map((e=>e.left))),bottom:Math.max(...e.map((e=>e.bottom))),right:Math.max(...e.map((e=>e.right)))}}function Cn(e,t){if(wn(e,t))return{top:Math.max(e.top,t.top),left:Math.max(e.left,t.left),bottom:Math.min(e.bottom,t.bottom),right:Math.min(e.right,t.right)}}function En(e,t){return e.left===t.left&&e.right===t.right&&e.top===t.top&&e.bottom===t.bottom}function wn(e,t){return!(e.bottom<t.top||t.bottom<e.top)&&!(e.right<t.left||t.right<e.left)}function yn(e,t,o){const{left:s,right:n,top:i,bottom:r}=o;return e>=s&&e<=n&&t>=i&&t<=r}function xn(e,t){return En(Sn(t,e),t)}function In(e,t){const o=e.map(hn),s=t.map(hn),n=Math.max(...o.concat(s).map((e=>e.bottom||0))),i=Math.max(...o.concat(s).map((e=>e.right||0))),r=o.map((e=>({...e,bottom:void 0===e.bottom?n+1:e.bottom,right:void 0===e.right?i+1:e.right}))),a=s.map((e=>({...e,bottom:void 0===e.bottom?n+1:e.bottom,right:void 0===e.right?i+1:e.right}))),l=function(e,t){const o=new Set(t.map((({col:e,row:t})=>`${e}-${t}`)));return e.filter((({col:e,row:t})=>!o.has(`${e}-${t}`)))}(r.map(On).flat(),a.map(On).flat()),c=function(e){if(0===e.length)return[];const[t,...o]=[...e].sort(((e,t)=>e.row-t.row)).sort(((e,t)=>e.col-t.col)),s=[];let n=Fn(t);for(const{col:e,row:t}of o)if(!yn(e,t,n))if(e===n.left&&t===n.bottom+1){const e=n.bottom+1;n={...n,bottom:e}}else s.push(n),n=Fn({col:e,row:t});return[...s,n]}(l);return function(e){if(0===e.length)return[];if(e.some((e=>e.left!==e.right)))throw new Error("only columns can be merged");const t=[],o=Rn(e),s=(e,t)=>e.top===t.top&&e.bottom===t.bottom&&e.right+1===t.left;for(;o.length;){const e=o.reduce(((e,t)=>s(e,t)?Sn(e,t):e),o.shift());t.push(e)}return Rn(t)}(c).map((e=>({...e,bottom:e.bottom===n+1?void 0:e.bottom,right:e.right===i+1?void 0:e.right}))).map(pn)}function Rn(e){const t=[...e].sort(((e,t)=>t.right-e.right)).sort(((e,t)=>t.bottom-e.bottom)).sort(((e,t)=>e.top-t.top)).sort(((e,t)=>e.left-t.left)).reverse(),o=[];for(;0!==t.length;){const e=t.shift();t.some((t=>xn(e,t)))||o.push(e)}return o.reverse()}function Tn(e){return{numberOfRows:e.bottom-e.top+1,numberOfCols:e.right-e.left+1}}function An(e){const{numberOfCols:t,numberOfRows:o}=Tn(e);return 1===t||1===o}function On(e){const t=[],[o,s]=[e.right,e.left].sort(((e,t)=>e-t)),[n,i]=[e.top,e.bottom].sort(((e,t)=>e-t));for(const e of Me(o,s+1))for(const o of Me(n,i+1))t.push({col:e,row:o});return t}function _n(e,t,o,s){const n="both"===t?s[0]:"columns"===t?s:0,i="both"===t?s[1]:"rows"===t?s:0,r="hasHeader"in e&&e.hasHeader;let a;a=!function(e){return void 0===e.bottom}(e)||r?!(Dn(e)&&!r)||"columns"!==t:"rows"!==t;const l={...e};return a&&"MOVE"===o&&(l.left+=n,l.top+=i),void 0!==l.right&&(l.right+=n),void 0!==l.bottom&&(l.bottom+=i),l}function Mn(e,t){let o,s;const{left:n,right:i,top:r,bottom:a}=e,{left:l,right:c,top:h,bottom:d}=t;return o=l!=n?l:c!=i?c:l,s=h!=r?h:d!=a?d:h,{col:o,row:s}}function Nn(e){return{top:Math.min(e.top,e.bottom),bottom:Math.max(e.top,e.bottom),left:Math.min(e.left,e.right),right:Math.max(e.left,e.right)}}function Fn(e){return{left:e.col,right:e.col,top:e.row,bottom:e.row}}function Dn(e){return void 0===e.right}function Ln(e){return(e.bottom-e.top+1)*(e.right-e.left+1)}function Pn(...e){return e.length<2||1===In(e.map(pn),[]).length}class kn{getSheetSize;_zone;parts;invalidXc;prefixSheet=!1;sheetId;invalidSheetName;constructor(e,t){this.getSheetSize=t,this._zone=e.zone,this.prefixSheet=e.prefixSheet,this.invalidXc=e.invalidXc,this.sheetId=e.sheetId,this.invalidSheetName=e.invalidSheetName;let o=[...e.parts];1===e.parts.length&&Ln(this.zone)>1?o.push({...e.parts[0]}):2===e.parts.length&&1===Ln(this.zone)&&o.pop(),this.parts=o}static fromRange(e,t){return e instanceof kn?e:new kn(e,t.getSheetSize)}get unboundedZone(){return this._zone}get zone(){const{left:e,top:t,bottom:o,right:s}=this._zone;if(void 0!==s&&void 0!==o)return this._zone;if(void 0===o&&void 0!==s)return{right:s,top:t,left:e,bottom:this.getSheetSize(this.sheetId).numberOfRows-1};if(void 0===s&&void 0!==o)return{bottom:o,left:e,top:t,right:this.getSheetSize(this.sheetId).numberOfCols-1};throw new Error(a("Bad zone format"))}static getRangeParts(e,t){const o=e.split(":").map((e=>{const t=nn(e);return{colFixed:!t&&e.startsWith("$"),rowFixed:t?e.startsWith("$"):e.includes("$",1)}})),s=void 0===t.bottom,n=void 0===t.right;return s&&(o[0].rowFixed=o[0].rowFixed||o[1].rowFixed,o[1].rowFixed=o[0].rowFixed||o[1].rowFixed),n&&(o[0].colFixed=o[0].colFixed||o[1].colFixed,o[1].colFixed=o[0].colFixed||o[1].colFixed),o}get isFullCol(){return void 0===this._zone.bottom}get isFullRow(){return void 0===this._zone.right}get rangeData(){return{_zone:this._zone,_sheetId:this.sheetId}}orderZone(){if(gn(this._zone))return this;const e={...this._zone};let t=this.parts;if(void 0!==e.right&&e.right<e.left){let o=e.right;e.right=e.left,e.left=o,t=[{colFixed:t[1]?.colFixed||!1,rowFixed:t[0]?.rowFixed||!1},{colFixed:t[0]?.colFixed||!1,rowFixed:t[1]?.rowFixed||!1}]}if(void 0!==e.bottom&&e.bottom<e.top){let o=e.bottom;e.bottom=e.top,e.top=o,t=[{colFixed:t[0]?.colFixed||!1,rowFixed:t[1]?.rowFixed||!1},{colFixed:t[1]?.colFixed||!1,rowFixed:t[0]?.rowFixed||!1}]}return this.clone({zone:e,parts:t})}clone(e){return new kn({zone:e?.zone?e.zone:{...this._zone},sheetId:e?.sheetId?e.sheetId:this.sheetId,invalidSheetName:e&&"invalidSheetName"in e?e.invalidSheetName:this.invalidSheetName,invalidXc:e&&"invalidXc"in e?e.invalidXc:this.invalidXc,parts:e?.parts?e.parts:this.parts.map((e=>({rowFixed:e.rowFixed,colFixed:e.colFixed}))),prefixSheet:e?.prefixSheet?e.prefixSheet:this.prefixSheet},this.getSheetSize)}}function Vn(e,t,o){const s=o.sheetId===e?t:o.sheetId;return o.clone({sheetId:s})}function Un(e,t,o){if(!o)return;const s=e.getRangeFromSheetXC(t,o);return s.invalidSheetName||s.invalidXc?void 0:s}function Bn(e){const t=[];for(const o of e)for(const e of On(o.zone))t.push({...e,sheetId:o.sheetId});return t}function Hn(e,t,o){const s=[];return t.forEach((t=>{const n=function(e,t){e=e.toLocaleLowerCase();let o=0,s=0,n=(t=t.toLocaleLowerCase()).length,i=0;for(let r=0;r<n;r++)t[r]===e[i]?(i++,s+=100+s-r/200):s=0,o+=s;return i===e.length?o:0}(e,o(t));n>0&&s.push({score:n,elem:t})})),s.sort(((e,t)=>t.score-e.score)),s.map((e=>e.elem))}function zn(e){const t=[];for(let o=0;o<e;o++){const e={cells:{}};t.push(e)}return t}function Gn(e,t,o){return o.map((o=>o>=e?o+t:o))}function $n(e,t){return e=[...e].sort(((e,t)=>t-e)),t.map((t=>{for(const o of e)if(t>o)t--;else if(t===o)return;return t})).filter($e)}function Wn(e,t=1){return t*(e+Z)-Z}const qn={};function Zn(e,t,o){const s=jn(o);if(qn[s]||(qn[s]={}),void 0===qn[s][t]){e.save(),e.font=s;const o=e.measureText(t).width;e.restore(),qn[s][t]=o}return qn[s][t]}function Yn(e){return Math.round(96*e/72)}function jn(e){return`${e.italic?"italic ":""}${e.bold?"bold":oe} ${Xn(e)}px ${ne}`}function Xn(e){return Yn(e?.fontSize||se)}function Kn(e,t,o,s){if(Zn(e,t,s)<=o)return[t];const n=[];let i="";for(let r of t){Zn(e,i+r,s)>o?(n.push(i),i=r):i+=r}return n.push(i),n}function Qn(e,t,o,s){o||(o={});const n=[],i=t.includes(ye)?t.split(ye):[t];for(const t of i){const i=t.includes(" ")?t.split(" "):[t];if(!s){n.push(t);continue}let r="",a=s;for(let t of i){const i=Kn(e,t,s,o),l=i.pop(),c=Zn(e,l,o);if(i.length)""!==r&&(n.push(r),r="",a=s),i.forEach((e=>{n.push(e)})),r=l,a=s-c;else{const t=""===r?l:" "+l,i=Zn(e,t,o);i<=a?(r+=t,a-=i):(n.push(r),r=l,a=s-c)}}""!==r&&n.push(r)}return n}function Jn(e){return e?e.toLowerCase():""}const ei=/([0-9\.]*)px/;function ti(e,t,o,s=!1,n=!1,i=function(e){return Number(e.match(ei)?.[1])}(e.font)/10){if(e.fillText(t,o.x,o.y),!s&&!n)return;const r=e.measureText(t),a=r.width,l=r.actualBoundingBoxAscent+r.actualBoundingBoxDescent,c=r.fontBoundingBoxAscent+r.fontBoundingBoxDescent;let{x:h,y:d}=o,u=d,g=d;switch(e.textAlign){case"center":h-=a/2;break;case"right":h-=a}switch(e.textBaseline){case"top":g+=c-2*i,u+=c/2-i;break;case"middle":g+=c/2-i;break;case"alphabetic":g+=2*i,u-=3*i;break;case"bottom":g=d,u-=l/2-i/2}s&&(e.lineWidth=i,e.strokeStyle=e.fillStyle,e.beginPath(),e.moveTo(h,g),e.lineTo(h+a,g),e.stroke()),n&&(e.lineWidth=i,e.strokeStyle=e.fillStyle,e.beginPath(),e.moveTo(h,u),e.lineTo(h+a,u),e.stroke())}class oi{isFastIdStrategy=!1;fastIdStart=0;setIsFastStrategy(e){this.isFastIdStrategy=e}uuidv4(){return this.isFastIdStrategy?(this.fastIdStart++,String(this.fastIdStart)):window.crypto&&window.crypto.getRandomValues?([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16))):"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}}function si(e){return e.map(ii).sort(((e,t)=>e.sequence-t.sequence))}const ni=new oi;function ii(e){const t=e.name,o=e.children,s=e.description,n=e.icon;return{id:e.id||ni.uuidv4(),name:"function"==typeof t?t:()=>t,isVisible:e.isVisible?e.isVisible:()=>!0,isEnabled:e.isEnabled?e.isEnabled:()=>!0,isActive:e.isActive,execute:e.execute,children:o?e=>o.map((t=>"function"==typeof t?t(e):t)).flat().map(ii):()=>[],isReadonlyAllowed:e.isReadonlyAllowed||!1,separator:e.separator||!1,icon:"function"==typeof n?n:()=>n||"",description:"function"==typeof s?s:()=>s||"",textColor:e.textColor,sequence:e.sequence||0}}function ri(e,t){return"REMOVE_COLUMNS_ROWS"===t.type?vn(e,"COL"===t.dimension?"left":"top",t.elements):"ADD_COLUMNS_ROWS"===t.type?mn(e,"COL"===t.dimension?"left":"top",t.base,t.position,t.quantity):{...e}}function ai(e,t){const o="DELETE_SHEET"===t.type&&t.sheetId;if("sheetId"in t&&e._sheetId!==t.sheetId)return e;{const s=ri(e._zone,t);if(s&&o!==e._sheetId)return{...e,_zone:s}}}class li extends t.Component{static template="o-spreadsheet-ChartJsComponent";canvas=t.useRef("graphContainer");chart;get background(){return this.chartRuntime.background}get canvasStyle(){return`background-color: ${this.background}`}get chartRuntime(){const e=this.env.model.getters.getChartRuntime(this.props.figure.id);if(!("chartJsConfig"in e))throw new Error("Unsupported chart runtime");return e}setup(){t.onMounted((()=>{const e=this.chartRuntime;this.createChart(Te(e.chartJsConfig))})),t.useEffect((()=>this.updateChartJs(Te(this.chartRuntime))),(()=>[this.chartRuntime]))}createChart(e){const t=this.canvas.el.getContext("2d");this.chart=new window.Chart(t,e)}updateChartJs(e){const t=e.chartJsConfig;t.data&&t.data.datasets?(this.chart.data=t.data,t.options?.plugins?.title&&(this.chart.config.options.plugins.title=t.options.plugins.title),t.options&&"valueLabel"in t.options&&t.options?.valueLabel&&(this.chart.config.options.valueLabel=t.options.valueLabel)):this.chart.data.datasets=[],this.chart.config.options.plugins.tooltip=t.options.plugins.tooltip,this.chart.config.options.plugins.legend=t.options.plugins.legend,this.chart.config.options.scales=t.options?.scales,this.chart.update()}}li.props={figure:Object};class ci{sheetId;title;getters;constructor(e,t,o){this.title=e.title,this.sheetId=t,this.getters=o}static validateChartDefinition(e,t){throw new Error("This method should be implemented by sub class")}static transformDefinition(e,t){throw new Error("This method should be implemented by sub class")}static getDefinitionFromContextCreation(e){throw new Error("This method should be implemented by sub class")}}function hi(e,t,o,s){let n=!1;const i=[];for(let s in o){let r=o[s];if(r.labelCell){const e=gi(r.labelCell,t);r.labelCell!==e&&(n=!0,r={...r,labelCell:e})}const a=gi(r.dataRange,t);void 0===a||e.getRangeString(a,a.sheetId)===le?(n=!0,r=void 0):a!==r.dataRange&&(n=!0,r={...r,dataRange:a}),i[s]=r}let r=s;const a=gi(r,t);a!==r&&(n=!0,r=a);return{isStale:n,dataSets:i.filter($e),labelRange:r}}function di(e,t,o){return o.map((o=>({dataRange:Vn(e,t,o.dataRange),labelCell:o.labelCell?Vn(e,t,o.labelCell):void 0})))}function ui(e,t,o){return o?Vn(e,t,o):void 0}function gi(e,t){if(!e)return;const o=t(e);switch(o.changeType){case"NONE":return e;case"REMOVE":return;default:return o.range}}function pi(e,t,o,s){const n=[];for(const i of t){const t=e.getRangeFromSheetXC(o,i),{unboundedZone:r,sheetId:a,invalidSheetName:l,invalidXc:c}=t;if(!l&&!c)if(r.left!==r.right&&r.top!==r.bottom){if(void 0===r.right)continue;for(let t=r.left;t<=r.right;t++){const o={...r,left:t,right:t};n.push(mi(e,a,o,s?{top:o.top,bottom:o.top,left:o.left,right:o.left}:void 0))}}else n.push(mi(e,a,r,s?{top:r.top,bottom:r.top,left:r.left,right:r.left}:void 0))}return n}function mi(e,t,o,s){if(o.left!==o.right&&o.top!==o.bottom)throw new Error(`Zone should be a single column or row: ${pn(o)}`);if(s){const n=pn(o),i=pn(s);return{labelCell:e.getRangeFromSheetXC(t,i),dataRange:e.getRangeFromSheetXC(t,n)}}return{labelCell:void 0,dataRange:e.getRangeFromSheetXC(t,pn(o))}}function fi(e,t){const o=t.labelCell?.zone;let s=t.dataRange.zone;if(o){const{numberOfRows:e,numberOfCols:t}=Tn(s);1===e?s={...s,left:s.left+1}:1===t&&(s={...s,top:s.top+1})}const n=t.dataRange.clone({zone:s});return{label:t.labelCell?e.getRangeString(t.labelCell,"forceSheetReference",{useFixedReference:!0}):void 0,range:e.getRangeString(n,"forceSheetReference",{useFixedReference:!0})}}function bi(e,t,o){if(!t)return;let s={...t.zone};o&&t.zone.bottom>t.zone.top&&(s.top=s.top+1);const n=t.clone({zone:s});return e.getRangeString(n,"forceSheetReference",{useFixedReference:!0})}function vi(e,t){let o;if(e.labelRange){const s=ri(hn(e.labelRange),t);o=s?pn(s):void 0}const s=e.dataSets.map(hn).map((e=>ri(e,t))).filter($e).map(pn);return{...e,labelRange:o,dataSets:s}}const Si=["rgb(31,119,180)","rgb(255,127,14)","rgb(174,199,232)","rgb(255,187,120)","rgb(44,160,44)","rgb(152,223,138)","rgb(214,39,40)","rgb(255,152,150)","rgb(148,103,189)","rgb(197,176,213)","rgb(140,86,75)","rgb(196,156,148)","rgb(227,119,194)","rgb(247,182,210)","rgb(127,127,127)","rgb(199,199,199)","rgb(188,189,34)","rgb(219,219,141)","rgb(23,190,207)","rgb(158,218,229)"];class Ci{graphColorIndex=0;next(){return Si[this.graphColorIndex++%Si.length]}}function Ei(e){return e&&Ct(e)<.3?"#FFFFFF":"#000000"}function wi(e){if(e.dataSets){const t=void 0!==e.dataSets.find((e=>!on.test(e)));if(t)return"InvalidDataSet";if(e.dataSets.map(hn).some((e=>e.top!==e.bottom&&Dn(e))))return"InvalidDataSet"}return"Success"}function yi(e){if(e.labelRange){if(!on.test(e.labelRange||""))return"InvalidLabelRange"}return"Success"}function xi(e,t,o){if(!o)return!1;if(!e)return!1;if(!t)return!0;const s=Ln(t.dataRange.zone);return!(Ln(e.zone)<s)}function Ii(e,t,o,s){if(e){if("text"===o||t?.type!==mo.number||e.type!==mo.number)return e.formattedValue;{let n=t.value-e.value;if("percentage"===o&&0!==n&&(n=n/e.value*100),"percentage"!==o&&e.format)return Is(n,{format:e.format,locale:s});const i=Math.abs(parseFloat(n.toFixed(2))).toLocaleString();return"percentage"===o?i+"%":i}}return""}function Ri(e,t,o,s,n){if("text"===t||e?.type!==mo.number||o?.type!==mo.number)return;const i=o.value-e.value;return i>0?s:i<0?n:void 0}function Ti(e,t,o){if("text"===o||e?.type!==mo.number||t?.type!==mo.number)return"neutral";const s=t.value-e.value;return s>0?"up":s<0?"down":"neutral"}function Ai(e){return e.keyValue&&!on.test(e.keyValue)?"InvalidScorecardKeyValue":"Success"}function Oi(e){return e.baseline&&!on.test(e.baseline)?"InvalidScorecardBaseline":"Success"}const _i=new window.Path2D("M8.6 4.8a.5.5 0 0 1 0 .75l-3.9 3.9a.5 .5 0 0 1 -.75 0l-3.8 -3.9a.5 .5 0 0 1 0 -.75l.4-.4a.5.5 0 0 1 .75 0l2.3 2.4v-5.7c0-.25.25-.5.5-.5h.6c.25 0 .5.25.5.5v5.8l2.3 -2.4a.5.5 0 0 1 .75 0z"),Mi=new window.Path2D("M8.7 5.5a.5.5 0 0 0 0-.75l-3.8-4a.5.5 0 0 0-.75 0l-3.8 4a.5.5 0 0 0 0 .75l.4.4a.5.5 0 0 0 .75 0l2.3-2.4v5.8c0 .25.25.5.5.5h.6c.25 0 .5-.25.5-.5v-5.8l2.2 2.4a.5.5 0 0 0 .75 0z");let Ni=class e extends ci{keyValue;baseline;baselineMode;baselineDescr;background;baselineColorUp;baselineColorDown;fontColor;type="scorecard";constructor(e,t,o){super(e,t,o),this.keyValue=Un(o,t,e.keyValue),this.baseline=Un(o,t,e.baseline),this.baselineMode=e.baselineMode,this.baselineDescr=e.baselineDescr,this.background=e.background,this.baselineColorUp=e.baselineColorUp,this.baselineColorDown=e.baselineColorDown}static validateChartDefinition(e,t){return e.checkValidations(t,Ai,Oi)}static getDefinitionFromContextCreation(e){return{background:e.background,type:"scorecard",keyValue:e.range?e.range[0]:void 0,title:e.title||"",baselineMode:ge,baselineColorUp:pe,baselineColorDown:me,baseline:e.auxiliaryRange||""}}static transformDefinition(e,t){let o,s;return e.baseline&&(o=ri(hn(e.baseline),t)),e.keyValue&&(s=ri(hn(e.keyValue),t)),{...e,baseline:o?pn(o):void 0,keyValue:s?pn(s):void 0}}copyForSheetId(t){const o=ui(this.sheetId,t,this.baseline),s=ui(this.sheetId,t,this.keyValue),n=this.getDefinitionWithSpecificRanges(o,s,t);return new e(n,t,this.getters)}copyInSheetId(t){const o=this.getDefinitionWithSpecificRanges(this.baseline,this.keyValue,t);return new e(o,t,this.getters)}getDefinition(){return this.getDefinitionWithSpecificRanges(this.baseline,this.keyValue)}getContextCreation(){return{background:this.background,title:this.title,range:this.keyValue?[this.getters.getRangeString(this.keyValue,this.sheetId)]:void 0,auxiliaryRange:this.baseline?this.getters.getRangeString(this.baseline,this.sheetId):void 0}}getDefinitionWithSpecificRanges(e,t,o){return{baselineColorDown:this.baselineColorDown,baselineColorUp:this.baselineColorUp,baselineMode:this.baselineMode,title:this.title,type:"scorecard",background:this.background,baseline:e?this.getters.getRangeString(e,o||this.sheetId):void 0,baselineDescr:this.baselineDescr,keyValue:t?this.getters.getRangeString(t,o||this.sheetId):void 0}}getDefinitionForExcel(){}updateRanges(t){const o=gi(this.baseline,t),s=gi(this.keyValue,t);if(this.baseline===o&&this.keyValue===s)return this;const n=this.getDefinitionWithSpecificRanges(o,s);return new e(n,this.sheetId,this.getters)}};function Fi(e,t){const o=t.getContext("2d");if(t.width=e.canvas.width,t.height=e.canvas.height,o.fillStyle=e.canvas.backgroundColor,o.fillRect(0,0,e.canvas.width,e.canvas.height),e.title&&(o.font=e.title.style.font,o.fillStyle=e.title.style.color,o.fillText(e.title.text,e.title.position.x,e.title.position.y)),e.baseline&&(o.font=e.baseline.style.font,o.fillStyle=e.baseline.style.color,ti(o,e.baseline.text,e.baseline.position,e.baseline.style.underline,e.baseline.style.strikethrough)),e.baselineArrow&&e.baselineArrow.style.size>0){o.save(),o.fillStyle=e.baselineArrow.style.color,o.translate(e.baselineArrow.position.x,e.baselineArrow.position.y);const t=e.baselineArrow.style.size/10;switch(o.scale(t,t),e.baselineArrow.direction){case"down":o.fill(_i);break;case"up":o.fill(Mi)}o.restore()}e.baselineDescr&&(o.font=e.baselineDescr.style.font,o.fillStyle=e.baselineDescr.style.color,o.fillText(e.baselineDescr.text,e.baselineDescr.position.x,e.baselineDescr.position.y)),e.key&&(o.font=e.key.style.font,o.fillStyle=e.key.style.color,ti(o,e.key.text,e.key.position,e.key.style.underline,e.key.style.strikethrough))}function Di(e,t=!1,o=!1){return`${o?"italic":""} ${t?"bold":""} ${e}px ${ne}`}function Li({width:e,height:t},o){return new Pi({width:e,height:t},o).computeDesign()}class Pi{runtime;context;width;height;constructor({width:e,height:t},o){this.runtime=o;const s=document.createElement("canvas");this.width=s.width=e,this.height=s.height=t,this.context=s.getContext("2d")}computeDesign(){const e={canvas:{width:this.width,height:this.height,backgroundColor:this.backgroundColor}},t=this.getTextStyles(),{height:o}=this.getTextDimensions(this.title,t.title.font);this.title&&(e.title={text:this.title,style:t.title,position:{x:this.chartPadding,y:this.chartPadding+o}});const s=t.baselineArrow?.size??0,{height:n,width:i}=this.getTextDimensions(this.baseline,t.baselineValue.font),{width:r}=this.getTextDimensions(this.baselineDescr,t.baselineDescr.font);e.baseline={text:this.baseline,style:t.baselineValue,position:{x:(this.width-i-r+s)/2,y:this.keyValue?this.height-2*this.chartPadding:this.height-(this.height-o-n)/2-this.chartPadding}},t.baselineArrow&&(e.baselineArrow={direction:this.baselineArrow,style:t.baselineArrow,position:{x:e.baseline.position.x-s,y:e.baseline.position.y-(n+s)/2}}),this.baselineDescr&&(e.baselineDescr={text:this.baselineDescr,style:t.baselineDescr,position:{x:e.baseline.position.x+i,y:e.baseline.position.y}});const{height:a,width:l}=this.getTextDimensions(this.keyValue,t.keyValue.font);return this.keyValue&&(e.key={text:this.keyValue,style:t.keyValue,position:{x:(this.width-l)/2,y:(this.height-n+o+a)/2-this.chartPadding}}),e}get title(){return this.runtime.title}get keyValue(){return this.runtime.keyValue}get baseline(){return this.runtime.baselineDisplay}get baselineDescr(){return function(e,t){const o=e||"";return t&&o?" "+o:o}(this.runtime.baselineDescr,this.baseline)}get baselineArrow(){return this.runtime.baselineArrow}get backgroundColor(){return this.runtime.background}get secondaryFontColor(){return Ct(this.backgroundColor)>.3?"#525252":"#C8C8C8"}get chartPadding(){return.02*this.width}getTextDimensions(e,t){this.context.font=t;const o=this.context.measureText(e);return{width:o.width,height:o.actualBoundingBoxAscent+o.actualBoundingBoxDescent}}getTextStyles(){const e=.96*this.width,t=this.getWidestElement(),o=t.getElementMaxFontSize(this.getDrawableHeight(),this);let s=function(e,t,o,s=.25){let n=1;if(o(n)>e)return n;if(o(t)<e)return t;let i=(n+t)/2,r=o(i),a=0;for(;Math.abs(r-e)>s&&a<20;)r>=e?t=(n+t)/2:n=(n+t)/2,i=(n+t)/2,r=o(i),a++;return i}(e,o,(e=>t.getElementWidth(e,this.context,this)))/o;const n=new Ui(this.runtime.keyValueStyle).getElementMaxFontSize(this.getDrawableHeight(),this)*s,i=new Vi(this.runtime.baselineStyle).getElementMaxFontSize(this.getDrawableHeight(),this)*s;return{title:{font:Di(18),color:this.secondaryFontColor},keyValue:{color:this.runtime.keyValueStyle?.textColor||this.runtime.fontColor,font:Di(n,this.runtime.keyValueStyle?.bold,this.runtime.keyValueStyle?.italic),strikethrough:this.runtime.keyValueStyle?.strikethrough,underline:this.runtime.keyValueStyle?.underline},baselineValue:{font:Di(i,this.runtime.baselineStyle?.bold,this.runtime.baselineStyle?.italic),strikethrough:this.runtime.baselineStyle?.strikethrough,underline:this.runtime.baselineStyle?.underline,color:this.runtime.baselineStyle?.textColor||this.runtime.baselineColor||this.secondaryFontColor},baselineDescr:{font:Di(.9*i),color:this.secondaryFontColor},baselineArrow:"neutral"===this.baselineArrow?void 0:{size:this.keyValue?.8*i:0,color:this.runtime.baselineColor||this.secondaryFontColor}}}getDrawableHeight(){const e=2*this.chartPadding;let t=this.height-e;return t-=this.title?18*1.2:0,t}getWidestElement(){const e=new Vi(this.runtime.baselineStyle),t=new Ui(this.runtime.keyValueStyle);return e.getElementWidth(.35,this.context,this)>t.getElementWidth(.65,this.context,this)?e:t}}class ki{style;constructor(e={}){this.style=e}measureTextWidth(e,t,o){return e.font=Di(o,this.style.bold,this.style.italic),e.measureText(t).width}}class Vi extends ki{getElementWidth(e,t,o){if(!o.runtime)return 0;const s=o.baseline,n="neutral"!==o.baselineArrow?"A "+s:s;let i=this.measureTextWidth(t,n,e);return i+=this.measureTextWidth(t,o.baselineDescr,.9*e),i}getElementMaxFontSize(e,t){if(!t.runtime)return 0;return(""!==t.baseline||t.baselineDescr?.35*e:0)/1.2}}class Ui extends ki{getElementWidth(e,t,o){if(!o.runtime)return 0;const s=o.keyValue||"";return this.measureTextWidth(t,s,e)}getElementMaxFontSize(e,t){if(!t.runtime)return 0;return(""!==t.baseline||t.baselineDescr?.65*e:e)/1.2}}class Bi extends t.Component{static template="o-spreadsheet-ScorecardChart";canvas=t.useRef("chartContainer");get runtime(){return this.env.model.getters.getChartRuntime(this.props.figure.id)}setup(){t.useEffect(this.createChart.bind(this),(()=>{const e=this.canvas.el.getBoundingClientRect();return[e.width,e.height,this.runtime,this.canvas.el]}))}createChart(){const e=this.canvas.el;Fi(Li(e.getBoundingClientRect(),this.runtime),e)}}Bi.props={figure:Object};class Hi{content={};add(e,t){return this.content[e]=t,this}get(e){const t=this.content[e];if(!t&&!(e in this.content))throw new Error(`Cannot find ${e} in this registry!`);return t}contains(e){return e in this.content}getAll(){return Object.values(this.content)}getKeys(){return Object.keys(this.content)}remove(e){delete this.content[e]}}function zi(e){return/^https?:\/\//i.test(e)?e:`https://${e}`}const Gi=new Hi;function $i(e,t){return{url:e=zi(e),label:t||e,isExternal:!0,isUrlEditable:!0}}Gi.add("sheet_URL",{match:e=>He(e),createLink:(e,t)=>({label:t,url:e,isExternal:!1,isUrlEditable:!1}),urlRepresentation(e,t){const o=Ge(e);return t.tryGetSheetName(o)||a("Invalid sheet")},open(e,t){const o=Ge(e);t.model.dispatch("ACTIVATE_SHEET",{sheetIdFrom:t.model.getters.getActiveSheetId(),sheetIdTo:o})},sequence:0});const Wi={createLink:$i,match:e=>ke(e),open:e=>window.open(e,"_blank"),urlRepresentation:e=>e,sequence:0};function qi(e){return Gi.getAll().sort(((e,t)=>e.sequence-t.sequence)).find((t=>t.match(e)))||Wi}function Zi(e,t){return qi(e.url).urlRepresentation(e.url,t)}function Yi(e,t){qi(e.url).open(e.url,t)}function ji(e){if("string"==typeof e){if(Pe(e)){const{label:t,url:o}=Ue(e);return qi(o).createLink(o,t)}return ke(e)?$i(e):void 0}}function Xi(e,t){return Qi(Ki(e||"",t.locale),t)}function Ki(e,t){if(e.startsWith("="))throw new Error(`Cannot parse "${e}" because it's not a literal value. It's a formula`);return ho(e,To)?Lo(e,To):Zt(e,t)?Lo(e,t):function(e){const t=e.toUpperCase();return"TRUE"===t||"FALSE"===t}(e)?"TRUE"===e.toUpperCase():e}function Qi(e,t){const o=ji(e);return o?{...Ji(Ki(o.label,t.locale),{format:t.format||Us(o.label,t.locale)||Bs(o.label),locale:t.locale}),link:o}:Ji(e,t)}function Ji(e,t){try{for(const o of sr){const s=o(e,t);if(s)return s}return function(e,t){return{type:mo.text,value:e,format:t.format,isAutoSummable:!0,defaultAlign:"left",formattedValue:Is(e,t)}}((e||"").toString(),t)}catch(e){return or(new d(c.GenericError,e.message||Se))}}function er(e,t){return{type:mo.number,value:e||0,format:t.format,isAutoSummable:!0,defaultAlign:"right",formattedValue:Is(e,t)}}const tr={type:mo.empty,value:"",format:void 0,isAutoSummable:!0,defaultAlign:"left",formattedValue:""};function or(e){return{type:mo.error,value:e.errorType,error:e,isAutoSummable:!1,defaultAlign:"center",formattedValue:e.errorType}}const sr=[function(e,t){if(""===e)return function(e){return void 0===e.format?tr:{type:mo.empty,value:"",format:e.format,isAutoSummable:!0,defaultAlign:"left",formattedValue:""}}(t)},function(e,t){if(t.format&&"number"==typeof e&&Ns(t.format))return function(e,t){const o=Is(e,t);return{type:mo.number,value:e,format:t.format,isAutoSummable:!1,defaultAlign:"right",formattedValue:o}}(e,t)},function(e,t){return"number"==typeof e?er(e,t):null===e?er(0,t):void 0},function(e,t){if("boolean"==typeof e)return function(e,t){const o=e?"TRUE":"FALSE";return{type:mo.boolean,value:e,format:t.format,isAutoSummable:!1,defaultAlign:"center",formattedValue:o}}(e,t)}],nr=new Hi;nr.add("ALPHANUMERIC_INCREMENT_MODIFIER",{apply:(e,t)=>{e.current+=e.increment;const o=`${e.prefix}${e.current.toString().padStart(e.numberPostfixLength||0,"0")}`;return{cellData:{border:t.border,style:t.cell&&t.cell.style,format:t.cell&&t.cell.format,content:o},tooltip:{props:{content:o}}}}}).add("INCREMENT_MODIFIER",{apply:(e,t,o)=>{e.current+=e.increment;const s=e.current.toString(),n=o.getLocale(),i=Is(e.current,{format:t.cell?.format,locale:n});return{cellData:{border:t.border,style:t.cell&&t.cell.style,format:t.cell&&t.cell.format,content:s},tooltip:s?{props:{content:i}}:void 0}}}).add("COPY_MODIFIER",{apply:(e,t,o)=>{const s=t.cell?.content||"",n={locale:o.getLocale(),format:t.cell?.format};return{cellData:{border:t.border,style:t.cell&&t.cell.style,format:t.cell&&t.cell.format,content:s},tooltip:s?{props:{content:Xi(t.cell?.content,n).formattedValue}}:void 0}}}).add("FORMULA_MODIFIER",{apply:(e,t,o,s)=>{e.current+=e.increment;let n=0,i=0;switch(s){case"up":n=0,i=-e.current;break;case"down":n=0,i=e.current;break;case"left":n=-e.current,i=0;break;case"right":n=e.current,i=0}const r=t.cell;if(!r||!r.isFormula)return{cellData:{}};const a=t.sheetId,l=o.getTranslatedCellFormula(a,n,i,r.compiledFormula);return{cellData:{border:t.border,style:r.style,format:r.format,content:l},tooltip:l?{props:{content:l}}:void 0}}});const ir=new Hi,rr=/(\d+)$/,ar=/^(.*\D+)/,lr=/^(.*\D+)(\d+)$/;function cr(e,t,o){let s=[],n=!1;for(let i of t){i===e&&(n=!0);const t=i?.isFormula?void 0:Xi(i?.content,{locale:To});if(t&&o(t))s.push(t);else{if(n)return s;s=[]}}return s}function hr(e){let t=1;return e.length>=2&&(t=function(e){const t=[];let o=e[0];for(let s=1;s<e.length;s++){const n=e[s];t.push(n-o),o=n}return t.reduce(((e,t)=>e+t),0)/t.length}(e)*e.length),t}ir.add("simple_value_copy",{condition:(e,t)=>!(1!==t.length||e.isFormula||e.format&&Ns(e.format)),generateRule:()=>({type:"COPY_MODIFIER"}),sequence:10}).add("increment_alphanumeric_value",{condition:e=>!e.isFormula&&Xi(e.content,{locale:To}).type===mo.text&&lr.test(e.content),generateRule:(e,t)=>{const o=parseInt(e.content.match(rr)[0]),s=e.content.match(ar)[0],n=e.content.length-s.length,i=cr(e,t,(e=>e.type===mo.text&&lr.test(e.value))).filter((e=>s===e.value.toString().match(ar)[0])).map((e=>parseInt(e.value.toString().match(rr)[0]))),r=hr(i);return{type:"ALPHANUMERIC_INCREMENT_MODIFIER",prefix:s,current:o,increment:r,numberPostfixLength:n}},sequence:15}).add("copy_text",{condition:e=>!e.isFormula&&Xi(e.content,{locale:To}).type===mo.text,generateRule:()=>({type:"COPY_MODIFIER"}),sequence:20}).add("update_formula",{condition:e=>e.isFormula,generateRule:(e,t)=>({type:"FORMULA_MODIFIER",increment:t.length,current:0}),sequence:30}).add("increment_number",{condition:e=>!e.isFormula&&Xi(e.content,{locale:To}).type===mo.number,generateRule:(e,t)=>{const o=hr(cr(e,t,(e=>e.type===mo.number)).map((e=>Number(e.value)))),s=Xi(e.content,{locale:To});return{type:"INCREMENT_MODIFIER",increment:o,current:s.type===mo.number?s.value:0}},sequence:40});const dr={};let ur=0;function gr(e,...t){const o="__sheet__"+ur++;return function(e,t){const o=document.createElement("style");o.textContent=function(e){const t=e.split(/(\{|\}|;)/).map((e=>e.trim())),o=[],s=[];let n=[];function i(e,t){const s=[];for(const n of o[e]){let r=t&&t+" "+n||n;r.includes("&")&&(r=n.replace(/&/g,t||"")),e<o.length-1&&(r=i(e+1,r)),s.push(r)}return s.join(", ")}function r(){n.length&&(s.push(i(0)+" {"),s.push(...n),s.push("}"),n=[])}for(;t.length;){let e=t.shift();"}"===e?(r(),o.pop()):("{"===t[0]&&(r(),o.push(e.split(/\s*,\s*/)),t.shift()),";"===t[0]&&n.push(" "+e+";"))}return s.join("\n")}(t),dr[e]=o}(o,String.raw(e,...t)),function(e){const t=dr[e];t.setAttribute("component",e),document.head.appendChild(t)}(o),o}function pr({strikethrough:e,underline:t}){return e||t?`${e?"line-through":""} ${t?"underline":""}`:"none"}function mr(e){const t=function(e){const t={};if(!e)return t;e.bold&&(t["font-weight"]="bold");e.italic&&(t["font-style"]="italic");if(e.strikethrough||e.underline){let o=e.strikethrough?"line-through":"";o=e.underline?o+" underline":o,t["text-decoration"]=o}e.textColor&&(t.color=e.textColor);return t}(e);return e?(e.fillColor&&(t.background=e.fillColor),t):t}function fr(e){let t="";for(const o in e)e[o]&&(t+=`${o}:${e[o]}; `);return t}gr`
2
2
  .o-error-tooltip {
3
3
  font-size: 13px;
4
4
  background-color: white;
@@ -280,7 +280,7 @@
280
280
  }
281
281
  }
282
282
  }
283
- `;class Aa extends t.Component{static template="o-spreadsheet-LinkEditor";static components={Menu:Hr};menuItems=Ta.getMenuItems();link=t.useState(this.defaultState);menu=t.useState({isOpen:!1});linkEditorRef=t.useRef("linkEditor");position=Fr(this.linkEditorRef);urlInput=t.useRef("urlInput");setup(){t.onMounted((()=>this.urlInput.el?.focus()))}get defaultState(){const{col:e,row:t}=this.props.cellPosition,o=this.env.model.getters.getActiveSheetId(),s=this.env.model.getters.getEvaluatedCell({sheetId:o,col:e,row:t});return s.link?{url:s.link.url,label:s.formattedValue,isUrlEditable:s.link.isUrlEditable}:{label:s.formattedValue,url:"",isUrlEditable:!0}}get menuPosition(){return{x:this.position.x+320-12-2,y:this.position.y+100}}onSpecialLink(e){const{detail:t}=e,o=ji(t);o&&(this.link.url=o.url,this.link.label=o.label,this.link.isUrlEditable=o.isUrlEditable)}getUrlRepresentation(e){return Zi(e,this.env.model.getters)}openMenu(){this.menu.isOpen=!0}removeLink(){this.link.url="",this.link.isUrlEditable=!0}save(){const{col:e,row:t}=this.props.cellPosition,o=this.env.model.getters.getLocale(),s=this.link.label?aa(this.link.label,o):this.link.url;this.env.model.dispatch("UPDATE_CELL",{col:e,row:t,sheetId:this.env.model.getters.getActiveSheetId(),content:Ve(s,this.link.url)}),this.props.onClosed?.()}cancel(){this.props.onClosed?.()}onKeyDown(e){switch(e.key){case"Enter":this.link.url&&this.save(),e.stopPropagation(),e.preventDefault();break;case"Escape":this.cancel(),e.stopPropagation()}}}const Oa={onOpen:(e,t)=>({isOpen:!0,props:{cellPosition:e},Component:Aa,cellCorner:"BottomLeft"})};Aa.props={cellPosition:Object,onClosed:{type:Function,optional:!0}};const _a=new Hi;function Ma(e){return 8===(e=ft(e).replace("#","")).length?e.slice(6)+e.slice(0,6):e}_a.add("ErrorToolTip",vr).add("LinkCell",Gr).add("LinkEditor",Oa).add("FilterMenu",wr);const Na={wrongPasteSelection:a("This operation is not allowed with multiple selections."),willRemoveExistingMerge:a("This operation is not possible due to a merge. Please remove the merges first than try again."),wrongFigurePasteOption:a("Cannot do a special paste of a figure."),frozenPaneOverlap:a("This operation is not allowed due to an overlapping frozen pane.")};function Fa(e,t){t.isSuccessful||(t.reasons.includes("WrongPasteSelection")?e.raiseError(Na.wrongPasteSelection):t.reasons.includes("WillRemoveExistingMerge")?e.raiseError(Na.willRemoveExistingMerge):t.reasons.includes("WrongFigurePasteOption")?e.raiseError(Na.wrongFigurePasteOption):t.reasons.includes("FrozenPaneOverlap")&&e.raiseError(Na.frozenPaneOverlap))}function Da(e,t,o){const s=e.model.dispatch("PASTE",{target:t,pasteOption:o});Fa(e,s)}function La(e,t,o,s){const n=e.model.dispatch("PASTE_FROM_OS_CLIPBOARD",{target:t,text:o,pasteOption:s});Fa(e,n)}const Pa={Errors:{InvalidRange:a("The range is invalid"),FirstArgMissing:a("The argument is missing. Please provide a value"),SecondArgMissing:a("The second argument is missing. Please provide a value"),MinNaN:a("The minpoint must be a number"),MidNaN:a("The midpoint must be a number"),MaxNaN:a("The maxpoint must be a number"),ValueUpperInflectionNaN:a("The first value must be a number"),ValueLowerInflectionNaN:a("The second value must be a number"),MinBiggerThanMax:a("Minimum must be smaller then Maximum"),MinBiggerThanMid:a("Minimum must be smaller then Midpoint"),MidBiggerThanMax:a("Midpoint must be smaller then Maximum"),LowerBiggerThanUpper:a("Lower inflection point must be smaller than upper inflection point"),MinInvalidFormula:a("Invalid Minpoint formula"),MaxInvalidFormula:a("Invalid Maxpoint formula"),MidInvalidFormula:a("Invalid Midpoint formula"),ValueUpperInvalidFormula:a("Invalid upper inflection point formula"),ValueLowerInvalidFormula:a("Invalid lower inflection point formula"),EmptyRange:a("A range needs to be defined"),Unexpected:a("The rule is invalid for an unknown reason")},ColorScale:a("Color scale"),IconSet:a("Icon set")},ka={IsEmpty:a("Is empty"),IsNotEmpty:a("Is not empty"),ContainsText:a("Contains"),NotContains:a("Does not contain"),BeginsWith:a("Starts with"),EndsWith:a("Ends with"),Equal:a("Is equal to"),NotEqual:a("Is not equal to"),GreaterThan:a("Is greater than"),GreaterThanOrEqual:a("Is greater than or equal to"),LessThan:a("Is less than"),LessThanOrEqual:a("Is less than or equal to"),Between:a("Is between"),NotBetween:a("Is not between")},Va={Series:a("Series"),Errors:{Unexpected:a("The chart definition is invalid for an unknown reason"),InvalidDataSet:a("The dataset is invalid"),InvalidLabelRange:a("Labels are invalid"),InvalidScorecardKeyValue:a("The key value is invalid"),InvalidScorecardBaseline:a("The baseline value is invalid"),InvalidGaugeDataRange:a("The data range is invalid"),EmptyGaugeRangeMin:a("A minimum range limit value is needed"),GaugeRangeMinNaN:a("The minimum range limit value must be a number"),EmptyGaugeRangeMax:a("A maximum range limit value is needed"),GaugeRangeMaxNaN:a("The maximum range limit value must be a number"),GaugeRangeMinBiggerThanRangeMax:a("Minimum range limit must be smaller than maximum range limit"),GaugeLowerInflectionPointNaN:a("The lower inflection point value must be a number"),GaugeUpperInflectionPointNaN:a("The upper inflection point value must be a number")}},Ua={Custom:a("Custom")},Ba=a("Merged cells are preventing this operation. Unmerge those cells and try again."),Ha={Errors:{Unexpected:a("Cannot split the selection for an unknown reason"),NoSplitSeparatorInSelection:a("There is no match for the selected separator in the selection"),MoreThanOneColumnSelected:a("Only a selection from a single column can be split"),SplitWillOverwriteContent:a("Splitting will overwrite existing content")}},za={Errors:{Unexpected:a("Cannot remove duplicates for an unknown reason"),MoreThanOneRangeSelected:a("Please select only one range of cells"),EmptyTarget:a("Please select a range of cells containing values."),NoColumnsProvided:a("Please select at latest one column to analyze."),WillRemoveExistingMerge:Na.willRemoveExistingMerge}},Ga={DateIs:{today:a("today"),yesterday:a("yesterday"),tomorrow:a("tomorrow"),lastWeek:a("in the past week"),lastMonth:a("in the past month"),lastYear:a("in the past year")},DateIsBefore:{today:a("today"),yesterday:a("yesterday"),tomorrow:a("tomorrow"),lastWeek:a("one week ago"),lastMonth:a("one month ago"),lastYear:a("one year ago")},CriterionError:{notEmptyValue:a("The value must not be empty"),numberValue:a("The value must be a number"),dateValue:a("The value must be a date"),validRange:a("The value must be a valid range")}};function $a(e,t){if(t.dataRange){const o=t.labelCell?[pn(t.labelCell.zone)]:[],s=In([pn(t.dataRange.zone)],o)[0];if(void 0===s)return[];const n=e.getRangeFromSheetXC(t.dataRange.sheetId,s);return e.getRangeValues(n).map((e=>""===e?void 0:e))}return[]}function Wa(e,t){const o=Me(0,Math.max(e.length,...t.map((e=>e.data?.length||0)))).filter((o=>{const s=e[o],n=t.map((e=>e.data?.[o]));return s||n.some((e=>0===e||Boolean(e)))}));return{labels:o.map((t=>e[t]||"")),dataSetsValues:t.map((e=>({...e,data:o.map((t=>e.data[t]))})))}}function qa(e,t){const o=new Set(e),s={};o.forEach((e=>{s[e]=new Array(t.length).fill(0)}));for(const o of Me(0,e.length)){const i=e[o];for(const e of Me(0,t.length))s[i][e]+="number"==typeof(n=t[e].data[o])?n:0}var n;return{labels:Array.from(o),dataSetsValues:t.map(((e,t)=>({...e,data:Array.from(o).map((e=>s[e][t]))})))}}function Za(e){return e?e.length>de?e.substring(0,de)+"…":e:""}function Ya(e,t,o,{format:s,locale:n,truncateLabels:i}){const r={responsive:!0,maintainAspectRatio:!1,layout:{padding:{left:20,right:20,top:e.title?10:25,bottom:10}},elements:{line:{fill:!1},point:{hitRadius:15}},animation:!1,plugins:{title:{display:!!e.title,text:a(e.title),color:o,font:{size:22,weight:"normal"}},legend:{onClick:()=>{}},tooltip:{callbacks:{label:function(e){const t=e.dataset?.label||e.label,o=e.parsed.y??e.parsed,i=Is(o,{format:!s&&Math.abs(o)>=1e3?"#,##":s,locale:n});return t?`${t}: ${i}`:i}}}}};return{type:e.type,options:r,data:{labels:i?t.map(Za):t,datasets:[]},plugins:[]}}function ja(e,t,o){let s={values:[],formattedValues:[]};if(o)o.invalidXc||o.invalidSheetName||(s={formattedValues:e.getRangeFormattedValues(o),values:e.getRangeValues(o).map((e=>String(e)))});else if(1===t.length)for(let o=0;o<$a(e,t[0]).length;o++)s.formattedValues.push(""),s.values.push("");else if(t[0]){s={formattedValues:Me(0,$a(e,t[0]).length).map((e=>e.toString())),values:s.formattedValues}}return s}function Xa(e,t){for(const o of t){const t=e.getRangeFormats(o.dataRange).find((e=>void 0!==e&&!Ns(e)));if(t)return t}}function Ka(e,t){const o=[];for(const[s,n]of Object.entries(t)){let t;if(n.labelCell){const o=n.labelCell,i=o?e.getEvaluatedCell({sheetId:o.sheetId,col:o.zone.left,row:o.zone.top}):void 0;t=i&&o?Za(i.formattedValue):t=`${Va.Series} ${parseInt(s)+1}`}else t=t=`${Va.Series} ${parseInt(s)+1}`;let i=n.dataRange?$a(e,n):[];o.push({data:i,label:t})}return o}function Qa(e){return 0===e?"origin":e-1}function Ja(e,t,o){const s=document.createElement("div");s.style.width=`${t.width}px`,s.style.height=`${t.height}px`;const n=document.createElement("canvas");if(s.append(n),n.setAttribute("width",t.width.toString()),n.setAttribute("height",t.height.toString()),document.body.append(s),"chartJsConfig"in e){e.chartJsConfig.plugins=[el];const t=new window.Chart(n,Te(e.chartJsConfig)),o=t.toBase64Image();return t.destroy(),s.remove(),o}if("scorecard"===o){Fi(Li(t,e),n);const o=n.toDataURL();return s.remove(),o}return""}const el={id:"customCanvasBackgroundColor",beforeDraw:e=>{const{ctx:t}=e;t.save(),t.globalCompositeOperation="destination-over",t.fillStyle="#ffffff",t.fillRect(0,0,e.width,e.height),t.restore()}};class tl extends ci{dataSets;labelRange;background;verticalAxisPosition;legendPosition;stacked;aggregated;type="bar";dataSetsHaveTitle;constructor(e,t,o){super(e,t,o),this.dataSets=pi(o,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=Un(o,t,e.labelRange),this.background=e.background,this.verticalAxisPosition=e.verticalAxisPosition,this.legendPosition=e.legendPosition,this.stacked=e.stacked,this.aggregated=e.aggregated,this.dataSetsHaveTitle=e.dataSetsHaveTitle}static transformDefinition(e,t){return vi(e,t)}static validateChartDefinition(e,t){return e.checkValidations(t,wi,yi)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range?e.range:[],dataSetsHaveTitle:!1,stacked:!1,aggregated:!1,legendPosition:"top",title:e.title||"",type:"bar",verticalAxisPosition:"left",labelRange:e.auxiliaryRange||void 0}}getContextCreation(){return{background:this.background,title:this.title,range:this.dataSets.map((e=>this.getters.getRangeString(e.dataRange,this.sheetId))),auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}copyForSheetId(e){const t=di(this.sheetId,e,this.dataSets),o=ui(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new tl(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new tl(t,e,this.getters)}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getDefinitionWithSpecificDataSets(e,t,o){return{type:"bar",dataSetsHaveTitle:!!e.length&&Boolean(e[0].labelCell),background:this.background,dataSets:e.map((e=>this.getters.getRangeString(e.dataRange,o||this.sheetId))),legendPosition:this.legendPosition,verticalAxisPosition:this.verticalAxisPosition,labelRange:t?this.getters.getRangeString(t,o||this.sheetId):void 0,title:this.title,stacked:this.stacked,aggregated:this.aggregated}}getDefinitionForExcel(){if(this.aggregated)return;const e=this.dataSets.map((e=>fi(this.getters,e))).filter((e=>""!==e.range&&e.range!==le)),t=bi(this.getters,this.labelRange,xi(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle));return{...this.getDefinition(),backgroundColor:Ma(this.background||I),fontColor:Ma(Ei(this.background)),dataSets:e,labelRange:t}}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=hi(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const n=this.getDefinitionWithSpecificDataSets(t,o);return new tl(n,this.sheetId,this.getters)}}function ol(e){return e.dataRange&&!on.test(e.dataRange)?"InvalidGaugeDataRange":"Success"}function sl(e,t){return t((t=>t.sectionRule?e(t.sectionRule.rangeMin,"rangeMin"):"Success"),(t=>t.sectionRule?e(t.sectionRule.rangeMax,"rangeMax"):"Success"))}function nl(e){return e.sectionRule&&Number(e.sectionRule.rangeMin)>=Number(e.sectionRule.rangeMax)?"GaugeRangeMinBiggerThanRangeMax":"Success"}function il(e,t){if(""===e)switch(t){case"rangeMin":return"EmptyGaugeRangeMin";case"rangeMax":return"EmptyGaugeRangeMax"}return"Success"}function rl(e,t){if(isNaN(e))switch(t){case"rangeMin":return"GaugeRangeMinNaN";case"rangeMax":return"GaugeRangeMaxNaN";case"lowerInflectionPointValue":return"GaugeLowerInflectionPointNaN";case"upperInflectionPointValue":return"GaugeUpperInflectionPointNaN"}return"Success"}class al extends ci{dataRange;sectionRule;background;type="gauge";constructor(e,t,o){super(e,t,o),this.dataRange=Un(this.getters,this.sheetId,e.dataRange),this.sectionRule=e.sectionRule,this.background=e.background}static validateChartDefinition(e,t){return e.checkValidations(t,ol,e.chainValidations(sl(il,e.batchValidations),sl(rl,e.batchValidations),nl),e.chainValidations((o=rl,(0,e.batchValidations)((e=>e.sectionRule?o(e.sectionRule.lowerInflectionPoint.value,"lowerInflectionPointValue"):"Success"),(e=>e.sectionRule?o(e.sectionRule.upperInflectionPoint.value,"upperInflectionPointValue"):"Success")))));var o}static transformDefinition(e,t){let o;return e.dataRange&&(o=ri(hn(e.dataRange),t)),{...e,dataRange:o?pn(o):void 0}}static getDefinitionFromContextCreation(e){return{background:e.background,title:e.title||"",type:"gauge",dataRange:e.range?e.range[0]:void 0,sectionRule:{colors:{lowerColor:"#cc0000",middleColor:"#f1c232",upperColor:"#6aa84f"},rangeMin:"0",rangeMax:"100",lowerInflectionPoint:{type:"percentage",value:"15"},upperInflectionPoint:{type:"percentage",value:"40"}}}}copyForSheetId(e){const t=ui(this.sheetId,e,this.dataRange),o=this.getDefinitionWithSpecificRanges(t,e);return new al(o,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificRanges(this.dataRange,e);return new al(t,e,this.getters)}getDefinition(){return this.getDefinitionWithSpecificRanges(this.dataRange)}getDefinitionWithSpecificRanges(e,t){return{background:this.background,sectionRule:this.sectionRule,title:this.title,type:"gauge",dataRange:e?this.getters.getRangeString(e,t||this.sheetId):void 0}}getDefinitionForExcel(){}getContextCreation(){return{background:this.background,title:this.title,range:this.dataRange?[this.getters.getRangeString(this.dataRange,this.sheetId)]:void 0}}updateRanges(e){const t=gi(this.dataRange,e);if(this.dataRange===t)return this;const o=this.getDefinitionWithSpecificRanges(t);return new al(o,this.sheetId,this.getters)}}const ll={second:1e3,minute:6e4,hour:36e5,day:864e5,month:2592e6,year:31536e6},cl={inSeconds:function(e){return Math.floor(e/ll.second)},inMinutes:function(e){return Math.floor(e/ll.minute)},inHours:function(e){return Math.floor(e/ll.hour)},inDays:function(e){return Math.floor(e/ll.day)},inMonths:function(e){return Math.floor(e/ll.month)},inYears:function(e){return Math.floor(e/ll.year)}},hl=/^((d|dd|m|mm|yyyy|yy|hh|h|ss|a)(-|:|\s|\/))*(d|dd|m|mm|yyyy|yy|hh|h|ss|a)$/i;function dl(e,t,o){const s=function(e){const t=e.indexOf("h");e=t>=0?e.slice(0,t).replace(/m/g,"M")+e.slice(t):e.replace(/m/g,"M");e.includes("a")||(e=e.replace(/h/g,"H"));return e}(t),n=function(e,t,o){const s=e.map((e=>jt(e,o)?.jsDate));if(s.some((e=>void 0===e))||e.length<2)return;const n=s.map((e=>e.getTime())),i=ht(n)-dt(n),r=function(e){if(e.includes("s"))return"second";if(e.includes("m"))return"minute";if(e.includes("h")||e.includes("H"))return"hour";if(e.includes("d"))return"day";if(e.includes("M"))return"month";return"year"}(t);if(ll.second>=ll[r]&&cl.inSeconds(i)<180)return"second";if(ll.minute>=ll[r]&&cl.inMinutes(i)<180)return"minute";if(ll.hour>=ll[r]&&cl.inHours(i)<96)return"hour";if(ll.day>=ll[r]&&cl.inDays(i)<90)return"day";if(ll.month>=ll[r]&&cl.inMonths(i)<36)return"month";return"year"}(e,s,o),i={};return n&&(i[n]=s),{parser:s,displayFormats:i,unit:n??!1}}class ul extends ci{dataSets;labelRange;background;verticalAxisPosition;legendPosition;labelsAsText;stacked;aggregated;type="line";dataSetsHaveTitle;cumulative;constructor(e,t,o){super(e,t,o),this.dataSets=pi(this.getters,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=Un(this.getters,t,e.labelRange),this.background=e.background,this.verticalAxisPosition=e.verticalAxisPosition,this.legendPosition=e.legendPosition,this.labelsAsText=e.labelsAsText,this.stacked=e.stacked,this.aggregated=e.aggregated,this.dataSetsHaveTitle=e.dataSetsHaveTitle,this.cumulative=e.cumulative}static validateChartDefinition(e,t){return e.checkValidations(t,wi,yi)}static transformDefinition(e,t){return vi(e,t)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range?e.range:[],dataSetsHaveTitle:!1,labelsAsText:!1,legendPosition:"top",title:e.title||"",type:"line",verticalAxisPosition:"left",labelRange:e.auxiliaryRange||void 0,stacked:!1,aggregated:!1,cumulative:!1}}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getDefinitionWithSpecificDataSets(e,t,o){return{type:"line",dataSetsHaveTitle:!!e.length&&Boolean(e[0].labelCell),background:this.background,dataSets:e.map((e=>this.getters.getRangeString(e.dataRange,o||this.sheetId))),legendPosition:this.legendPosition,verticalAxisPosition:this.verticalAxisPosition,labelRange:t?this.getters.getRangeString(t,o||this.sheetId):void 0,title:this.title,labelsAsText:this.labelsAsText,stacked:this.stacked,aggregated:this.aggregated,cumulative:this.cumulative}}getContextCreation(){return{background:this.background,title:this.title,range:this.dataSets.map((e=>this.getters.getRangeString(e.dataRange,this.sheetId))),auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=hi(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const n=this.getDefinitionWithSpecificDataSets(t,o);return new ul(n,this.sheetId,this.getters)}getDefinitionForExcel(){if(this.aggregated)return;const e=this.dataSets.map((e=>fi(this.getters,e))).filter((e=>""!==e.range&&e.range!==le)),t=bi(this.getters,this.labelRange,xi(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle));return{...this.getDefinition(),backgroundColor:Ma(this.background||I),fontColor:Ma(Ei(this.background)),dataSets:e,labelRange:t}}copyForSheetId(e){const t=di(this.sheetId,e,this.dataSets),o=ui(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new ul(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new ul(t,e,this.getters)}}function gl(e,t){return ml(e,t)||fl(e,t)}function pl(e,t){return function(e,t){return!e.labelsAsText&&ml(e.labelRange,t)}(e,t)&&function(){if(!window.Chart)return!1;const e="luxon"===new window.Chart._adapters._date({})._id;e||bl||(bl=!0,console.warn("'chartjs-adapter-luxon' time adapter is not installed. Time scale axes are disabled."));return e}()?"time":function(e,t){return!e.labelsAsText&&fl(e.labelRange,t)}(e,t)?"linear":"category"}function ml(e,t){if(!e||!fl(e,t))return!1;const o=t.getEvaluatedCell({sheetId:e.sheetId,col:e.zone.left,row:e.zone.top}).format;return Boolean(o&&hl.test(o))}function fl(e,t){if(!e)return!1;const o=t.getRangeValues(e);return!o.some((e=>isNaN(Number(e))&&e))&&!o.every((e=>!e))}let bl=!1;class vl extends ci{dataSets;labelRange;background;legendPosition;type="pie";aggregated;dataSetsHaveTitle;constructor(e,t,o){super(e,t,o),this.dataSets=pi(o,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=Un(o,t,e.labelRange),this.background=e.background,this.legendPosition=e.legendPosition,this.aggregated=e.aggregated,this.dataSetsHaveTitle=e.dataSetsHaveTitle}static transformDefinition(e,t){return vi(e,t)}static validateChartDefinition(e,t){return e.checkValidations(t,wi,yi)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range?e.range:[],dataSetsHaveTitle:!1,legendPosition:"top",title:e.title||"",type:"pie",labelRange:e.auxiliaryRange||void 0,aggregated:!1}}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getContextCreation(){return{background:this.background,title:this.title,range:this.dataSets.map((e=>this.getters.getRangeString(e.dataRange,this.sheetId))),auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}getDefinitionWithSpecificDataSets(e,t,o){return{type:"pie",dataSetsHaveTitle:!!e.length&&Boolean(e[0].labelCell),background:this.background,dataSets:e.map((e=>this.getters.getRangeString(e.dataRange,o||this.sheetId))),legendPosition:this.legendPosition,labelRange:t?this.getters.getRangeString(t,o||this.sheetId):void 0,title:this.title,aggregated:this.aggregated}}copyForSheetId(e){const t=di(this.sheetId,e,this.dataSets),o=ui(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new vl(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new vl(t,e,this.getters)}getDefinitionForExcel(){if(this.aggregated)return;const e=this.dataSets.map((e=>fi(this.getters,e))).filter((e=>""!==e.range&&e.range!==le)),t=bi(this.getters,this.labelRange,xi(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle));return{...this.getDefinition(),backgroundColor:Ma(this.background||I),fontColor:Ma(Ei(this.background)),verticalAxisPosition:"left",dataSets:e,labelRange:t}}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=hi(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const n=this.getDefinitionWithSpecificDataSets(t,o);return new vl(n,this.sheetId,this.getters)}}function Sl(e,t){const o=[],s=ht(t.map((e=>e.data.length)));for(let t=0;t<=s;t++)o.push(e.next());return o}const Cl=new Hi;Cl.add("bar",{match:e=>"bar"===e,createChart:(e,t,o)=>new tl(e,t,o),getChartRuntime:function(e,t){let o=ja(t,e.dataSets,e.labelRange).formattedValues,s=Ka(t,e.dataSets);e.dataSetsHaveTitle&&s[0]&&o.length>s[0].data.length&&o.shift(),({labels:o,dataSetsValues:s}=Wa(o,s)),e.aggregated&&({labels:o,dataSetsValues:s}=qa(o,s));const n=function(e,t,o){const s=Ei(e.background),n=Ya(e,t,s,o),i={labels:{color:s}};return!e.labelRange&&1===e.dataSets.length||"none"===e.legendPosition?i.display=!1:i.position=e.legendPosition,n.options.plugins.legend={...n.options.plugins?.legend,...i},n.options.layout={padding:{left:20,right:20,top:e.title?10:25,bottom:10}},n.options.scales={x:{ticks:{padding:5,color:s}},y:{position:e.verticalAxisPosition,beginAtZero:!0,ticks:{color:s,callback:e=>{if(e=Number(e),isNaN(e))return e;const{locale:t,format:s}=o;return Is(e,{locale:t,format:!s&&Math.abs(e)>=1e3?"#,##":s})}}}},e.stacked&&(n.options.scales.x.stacked=!0,n.options.scales.y.stacked=!0),n}(e,o,{format:Xa(t,e.dataSets),locale:t.getLocale()}),i=new Ci;for(let{label:e,data:t}of s){const o=i.next(),s={label:e,data:t,borderColor:o,backgroundColor:o};n.data.datasets.push(s)}return{chartJsConfig:n,background:e.background||I}},validateChartDefinition:(e,t)=>tl.validateChartDefinition(e,t),transformDefinition:(e,t)=>tl.transformDefinition(e,t),getChartDefinitionFromContextCreation:e=>tl.getDefinitionFromContextCreation(e),name:a("Bar"),sequence:10}),Cl.add("line",{match:e=>"line"===e,createChart:(e,t,o)=>new ul(e,t,o),getChartRuntime:function(e,t){const o=pl(e,t),s=ja(t,e.dataSets,e.labelRange);let n="linear"===o?s.values:s.formattedValues,i=Ka(t,e.dataSets);e.dataSetsHaveTitle&&i[0]&&n.length>i[0].data.length&&n.shift(),({labels:n,dataSetsValues:i}=Wa(n,i)),"time"===o&&({labels:n,dataSetsValues:i}=function(e,t){if(0===e.length||e.every((e=>!e)))return{labels:e,dataSetsValues:t};const o=[...e],s=Te(t);for(let e=0;e<o.length;e++)if(!o[e]){o[e]=Xe(o,e);for(let t of s)t.data[e]=void 0}return{labels:o,dataSetsValues:s}}(n,i)),e.aggregated&&({labels:n,dataSetsValues:i}=qa(n,i));const r=t.getLocale(),a="category"===o,l=Xa(t,e.dataSets),c=function(e,t,o){const s=Ei(e.background),n=Ya(e,t,s,o),i={labels:{color:s,generateLabels(e){const{data:t}=e,o=window.Chart.defaults.plugins.legend.labels.generateLabels(e);for(const[e,s]of o.entries())s.fillStyle=t.datasets[e].borderColor;return o}}};return!e.labelRange&&1===e.dataSets.length||"none"===e.legendPosition?i.display=!1:i.position=e.legendPosition,Object.assign(n.options.plugins.legend||{},i),n.options.layout={padding:{left:20,right:20,top:e.title?10:25,bottom:10}},n.options.scales={x:{ticks:{padding:5,color:s}},y:{position:e.verticalAxisPosition,beginAtZero:!0,ticks:{color:s,callback:e=>{if(e=Number(e),isNaN(e))return e;const{locale:t,format:s}=o;return Is(e,{locale:t,format:!s&&Math.abs(e)>=1e3?"#,##":s})}}}},e.stacked&&n.options?.scales?.y&&(n.options.scales.y.stacked=!0),n}(e,n,{format:l,locale:r,truncateLabels:a}),h=function(e,t){if(t)return e.getEvaluatedCell({sheetId:t.sheetId,col:t.zone.left,row:t.zone.top}).format}(t,e.labelRange);if("time"===o){const e={type:"time",time:dl(n,h,r)};Object.assign(c.options.scales.x,e),c.options.scales.x.ticks.maxTicksLimit=15}else"linear"===o&&(c.options.scales.x.type="linear",c.options.scales.x.ticks.callback=e=>Is(e,{format:h,locale:r}),c.options.plugins.tooltip.callbacks.title=e=>Is(e[0].parsed.x||e[0].label,{locale:r,format:h}));const d=new Ci;for(let[t,{label:s,data:r}]of i.entries()){if(e.cumulative){let e=0;r=r.map((t=>isNaN(t)?t:(e+=parseFloat(t),e)))}["linear","time"].includes(o)&&(r=r.map(((e,t)=>({x:n[t]||void 0,y:e}))));const i=d.next();let a=wt(i);e.stacked&&(a.a=.4);const l={label:s,data:r,tension:0,borderColor:i,backgroundColor:Et(a),pointBackgroundColor:i,fill:!!e.stacked&&Qa(t)};c.data.datasets.push(l)}return{chartJsConfig:c,background:e.background||I}},validateChartDefinition:(e,t)=>ul.validateChartDefinition(e,t),transformDefinition:(e,t)=>ul.transformDefinition(e,t),getChartDefinitionFromContextCreation:e=>ul.getDefinitionFromContextCreation(e),name:a("Line"),sequence:20}),Cl.add("pie",{match:e=>"pie"===e,createChart:(e,t,o)=>new vl(e,t,o),getChartRuntime:function(e,t){let o=ja(t,e.dataSets,e.labelRange).formattedValues,s=Ka(t,e.dataSets);e.dataSetsHaveTitle&&s[0]&&o.length>s[0].data.length&&o.shift(),({labels:o,dataSetsValues:s}=Wa(o,s)),e.aggregated&&({labels:o,dataSetsValues:s}=qa(o,s));const n=function(e,t,o){const s=Ei(e.background),n=Ya(e,t,s,o),i={labels:{color:s}};return!e.labelRange&&1===e.dataSets.length||"none"===e.legendPosition?i.display=!1:i.position=e.legendPosition,Object.assign(n.options.plugins.legend||{},i),n.options.layout={padding:{left:20,right:20,top:e.title?10:25,bottom:10}},n.options.plugins.tooltip.callbacks.title=function(e){return e[0].dataset.label},n.options.plugins.tooltip.callbacks.label=function(e){const{format:t,locale:s}=o,n=function(e,t){const o=e.filter((e=>"number"==typeof e)).reduce(((e,t)=>e+t),0);if(!o)return"";return(e[t]/o*100).toFixed(2)}(e.dataset.data,e.dataIndex),i=e.label||e.dataset.label,r=e.parsed.y??e.parsed,a=Is(r,{format:!t&&Math.abs(r)>=1e3?"#,##":t,locale:s});return i?`${i}: ${a} (${n}%)`:`${a} (${n}%)`},n}(e,o,{format:Xa(t,e.dataSets),locale:t.getLocale()}),i=new Ci;for(let{label:e,data:t}of s){const o={label:e,data:t,borderColor:"#FFFFFF",backgroundColor:Sl(i,s)};n.data.datasets.push(o)}return{chartJsConfig:n,background:e.background||I}},validateChartDefinition:(e,t)=>vl.validateChartDefinition(e,t),transformDefinition:(e,t)=>vl.transformDefinition(e,t),getChartDefinitionFromContextCreation:e=>vl.getDefinitionFromContextCreation(e),name:a("Pie"),sequence:30}),Cl.add("scorecard",{match:e=>"scorecard"===e,createChart:(e,t,o)=>new Ni(e,t,o),getChartRuntime:function(e,t){let o,s,n="",i="";if(e.keyValue){const s={sheetId:e.keyValue.sheetId,col:e.keyValue.zone.left,row:e.keyValue.zone.top};o=t.getEvaluatedCell(s),n=String(o.value),i=o.formattedValue}const r=e.baseline;if(r){const o={sheetId:e.baseline.sheetId,col:e.baseline.zone.left,row:e.baseline.zone.top};s=t.getEvaluatedCell(o)}const{background:l,fontColor:c}=t.getStyleOfSingleCellChart(e.background,e.keyValue),h=t.getLocale();return{title:a(e.title),keyValue:i||n,baselineDisplay:Ii(s,o,e.baselineMode,h),baselineArrow:Ti(s,o,e.baselineMode),baselineColor:Ri(s,e.baselineMode,o,e.baselineColorUp,e.baselineColorDown),baselineDescr:e.baselineDescr?a(e.baselineDescr):"",fontColor:c,background:l,baselineStyle:"percentage"!==e.baselineMode&&r?t.getCellStyle({sheetId:r.sheetId,col:r.zone.left,row:r.zone.top}):void 0,keyValueStyle:e.keyValue?t.getCellStyle({sheetId:e.keyValue.sheetId,col:e.keyValue.zone.left,row:e.keyValue.zone.top}):void 0}},validateChartDefinition:(e,t)=>Ni.validateChartDefinition(e,t),transformDefinition:(e,t)=>Ni.transformDefinition(e,t),getChartDefinitionFromContextCreation:e=>Ni.getDefinitionFromContextCreation(e),name:a("Scorecard"),sequence:40}),Cl.add("gauge",{match:e=>"gauge"===e,createChart:(e,t,o)=>new al(e,t,o),getChartRuntime:function(e,t){const o=function(e,t){const o=Ya(e,[],Ei(e.background),{locale:t});return o.options.hover=void 0,o.options.events=[],o.options.layout={padding:{left:30,right:30,top:e.title?10:25,bottom:25}},o.options.needle={width:10,borderColor:"#000000",backgroundColor:"#000000"},o.options.valueLabel={display:!1,font:{size:30,color:"#FFFFFF"},backgroundColor:"#000000",borderColor:"#000000",borderRadius:5,padding:{top:5,right:5,bottom:5,left:5}},o}(e,t.getLocale()),s=e.sectionRule.colors,n=e.sectionRule.lowerInflectionPoint,i=e.sectionRule.upperInflectionPoint,r=Number(n.value),a=Number(i.value),l=Number(e.sectionRule.rangeMin),c=Number(e.sectionRule.rangeMax),h=c-l,d=[];if(""!==n.value){const e="number"===n.type?r:l+h*r/100;d.push({value:_e(e,l,c),color:s.lowerColor})}if(""!==i.value){const e="number"===i.type?a:l+h*a/100;d.push({value:_e(e,l,c),color:s.middleColor})}const u=[],g=[];d.sort(((e,t)=>e.value-t.value)).map((e=>{u.push(e.value),g.push(e.color)})),u.push(c),g.push(s.upperColor);const p=e.dataRange,m=h/30;let f,b=l-m,v=!1;if(void 0!==p){const e=t.getEvaluatedCell({sheetId:p.sheetId,col:p.zone.left,row:p.zone.top});e.type===mo.number&&(b=_e(e.value,l-m,c+m),f=()=>t.getRangeFormattedValues(p)[0],v=!0)}return o.options.valueLabel.display=v,o.options.valueLabel.formatter=f,o.data.datasets.push({data:u,minValue:Number(e.sectionRule.rangeMin),value:b,backgroundColor:g}),{chartJsConfig:o,background:t.getStyleOfSingleCellChart(e.background,p).background}},validateChartDefinition:(e,t)=>al.validateChartDefinition(e,t),transformDefinition:(e,t)=>al.transformDefinition(e,t),getChartDefinitionFromContextCreation:e=>al.getDefinitionFromContextCreation(e),name:a("Gauge"),sequence:50});const El=new Hi;El.add("line",li),El.add("bar",li),El.add("pie",li),El.add("gauge",li),El.add("scorecard",Bi);const wl=new Hi;gr`
283
+ `;class Aa extends t.Component{static template="o-spreadsheet-LinkEditor";static components={Menu:Hr};menuItems=Ta.getMenuItems();link=t.useState(this.defaultState);menu=t.useState({isOpen:!1});linkEditorRef=t.useRef("linkEditor");position=Fr(this.linkEditorRef);urlInput=t.useRef("urlInput");setup(){t.onMounted((()=>this.urlInput.el?.focus()))}get defaultState(){const{col:e,row:t}=this.props.cellPosition,o=this.env.model.getters.getActiveSheetId(),s=this.env.model.getters.getEvaluatedCell({sheetId:o,col:e,row:t});return s.link?{url:s.link.url,label:s.formattedValue,isUrlEditable:s.link.isUrlEditable}:{label:s.formattedValue,url:"",isUrlEditable:!0}}get menuPosition(){return{x:this.position.x+320-12-2,y:this.position.y+100}}onSpecialLink(e){const{detail:t}=e,o=ji(t);o&&(this.link.url=o.url,this.link.label=o.label,this.link.isUrlEditable=o.isUrlEditable)}getUrlRepresentation(e){return Zi(e,this.env.model.getters)}openMenu(){this.menu.isOpen=!0}removeLink(){this.link.url="",this.link.isUrlEditable=!0}save(){const{col:e,row:t}=this.props.cellPosition,o=this.env.model.getters.getLocale(),s=this.link.label?aa(this.link.label,o):this.link.url;this.env.model.dispatch("UPDATE_CELL",{col:e,row:t,sheetId:this.env.model.getters.getActiveSheetId(),content:Ve(s,this.link.url)}),this.props.onClosed?.()}cancel(){this.props.onClosed?.()}onKeyDown(e){switch(e.key){case"Enter":this.link.url&&this.save(),e.stopPropagation(),e.preventDefault();break;case"Escape":this.cancel(),e.stopPropagation()}}}const Oa={onOpen:(e,t)=>({isOpen:!0,props:{cellPosition:e},Component:Aa,cellCorner:"BottomLeft"})};Aa.props={cellPosition:Object,onClosed:{type:Function,optional:!0}};const _a=new Hi;function Ma(e){return 8===(e=ft(e).replace("#","")).length?e.slice(6)+e.slice(0,6):e}_a.add("ErrorToolTip",vr).add("LinkCell",Gr).add("LinkEditor",Oa).add("FilterMenu",wr);const Na={wrongPasteSelection:a("This operation is not allowed with multiple selections."),willRemoveExistingMerge:a("This operation is not possible due to a merge. Please remove the merges first than try again."),wrongFigurePasteOption:a("Cannot do a special paste of a figure."),frozenPaneOverlap:a("This operation is not allowed due to an overlapping frozen pane.")};function Fa(e,t){t.isSuccessful||(t.reasons.includes("WrongPasteSelection")?e.raiseError(Na.wrongPasteSelection):t.reasons.includes("WillRemoveExistingMerge")?e.raiseError(Na.willRemoveExistingMerge):t.reasons.includes("WrongFigurePasteOption")?e.raiseError(Na.wrongFigurePasteOption):t.reasons.includes("FrozenPaneOverlap")&&e.raiseError(Na.frozenPaneOverlap))}function Da(e,t,o){const s=e.model.dispatch("PASTE",{target:t,pasteOption:o});Fa(e,s)}function La(e,t,o,s){const n=e.model.dispatch("PASTE_FROM_OS_CLIPBOARD",{target:t,text:o,pasteOption:s});Fa(e,n)}const Pa={Errors:{InvalidRange:a("The range is invalid"),FirstArgMissing:a("The argument is missing. Please provide a value"),SecondArgMissing:a("The second argument is missing. Please provide a value"),MinNaN:a("The minpoint must be a number"),MidNaN:a("The midpoint must be a number"),MaxNaN:a("The maxpoint must be a number"),ValueUpperInflectionNaN:a("The first value must be a number"),ValueLowerInflectionNaN:a("The second value must be a number"),MinBiggerThanMax:a("Minimum must be smaller then Maximum"),MinBiggerThanMid:a("Minimum must be smaller then Midpoint"),MidBiggerThanMax:a("Midpoint must be smaller then Maximum"),LowerBiggerThanUpper:a("Lower inflection point must be smaller than upper inflection point"),MinInvalidFormula:a("Invalid Minpoint formula"),MaxInvalidFormula:a("Invalid Maxpoint formula"),MidInvalidFormula:a("Invalid Midpoint formula"),ValueUpperInvalidFormula:a("Invalid upper inflection point formula"),ValueLowerInvalidFormula:a("Invalid lower inflection point formula"),EmptyRange:a("A range needs to be defined"),Unexpected:a("The rule is invalid for an unknown reason")},ColorScale:a("Color scale"),IconSet:a("Icon set")},ka={IsEmpty:a("Is empty"),IsNotEmpty:a("Is not empty"),ContainsText:a("Contains"),NotContains:a("Does not contain"),BeginsWith:a("Starts with"),EndsWith:a("Ends with"),Equal:a("Is equal to"),NotEqual:a("Is not equal to"),GreaterThan:a("Is greater than"),GreaterThanOrEqual:a("Is greater than or equal to"),LessThan:a("Is less than"),LessThanOrEqual:a("Is less than or equal to"),Between:a("Is between"),NotBetween:a("Is not between")},Va={Series:a("Series"),Errors:{Unexpected:a("The chart definition is invalid for an unknown reason"),InvalidDataSet:a("The dataset is invalid"),InvalidLabelRange:a("Labels are invalid"),InvalidScorecardKeyValue:a("The key value is invalid"),InvalidScorecardBaseline:a("The baseline value is invalid"),InvalidGaugeDataRange:a("The data range is invalid"),EmptyGaugeRangeMin:a("A minimum range limit value is needed"),GaugeRangeMinNaN:a("The minimum range limit value must be a number"),EmptyGaugeRangeMax:a("A maximum range limit value is needed"),GaugeRangeMaxNaN:a("The maximum range limit value must be a number"),GaugeRangeMinBiggerThanRangeMax:a("Minimum range limit must be smaller than maximum range limit"),GaugeLowerInflectionPointNaN:a("The lower inflection point value must be a number"),GaugeUpperInflectionPointNaN:a("The upper inflection point value must be a number")}},Ua={Custom:a("Custom")},Ba=a("Merged cells are preventing this operation. Unmerge those cells and try again."),Ha={Errors:{Unexpected:a("Cannot split the selection for an unknown reason"),NoSplitSeparatorInSelection:a("There is no match for the selected separator in the selection"),MoreThanOneColumnSelected:a("Only a selection from a single column can be split"),SplitWillOverwriteContent:a("Splitting will overwrite existing content")}},za={Errors:{Unexpected:a("Cannot remove duplicates for an unknown reason"),MoreThanOneRangeSelected:a("Please select only one range of cells"),EmptyTarget:a("Please select a range of cells containing values."),NoColumnsProvided:a("Please select at latest one column to analyze."),WillRemoveExistingMerge:Na.willRemoveExistingMerge}},Ga={DateIs:{today:a("today"),yesterday:a("yesterday"),tomorrow:a("tomorrow"),lastWeek:a("in the past week"),lastMonth:a("in the past month"),lastYear:a("in the past year")},DateIsBefore:{today:a("today"),yesterday:a("yesterday"),tomorrow:a("tomorrow"),lastWeek:a("one week ago"),lastMonth:a("one month ago"),lastYear:a("one year ago")},CriterionError:{notEmptyValue:a("The value must not be empty"),numberValue:a("The value must be a number"),dateValue:a("The value must be a date"),validRange:a("The value must be a valid range")}};function $a(e,t){if(t.dataRange){const o=t.labelCell?[pn(t.labelCell.zone)]:[],s=In([pn(t.dataRange.zone)],o)[0];if(void 0===s)return[];const n=e.getRangeFromSheetXC(t.dataRange.sheetId,s);return e.getRangeValues(n).map((e=>""===e?void 0:e))}return[]}function Wa(e,t){const o=Me(0,Math.max(e.length,...t.map((e=>e.data?.length||0)))).filter((o=>{const s=e[o],n=t.map((e=>e.data?.[o]));return s||n.some((e=>0===e||Boolean(e)))}));return{labels:o.map((t=>e[t]||"")),dataSetsValues:t.map((e=>({...e,data:o.map((t=>e.data[t]))})))}}function qa(e,t){const o=new Set(e),s={};o.forEach((e=>{s[e]=new Array(t.length).fill(0)}));for(const o of Me(0,e.length)){const i=e[o];for(const e of Me(0,t.length))s[i][e]+="number"==typeof(n=t[e].data[o])?n:0}var n;return{labels:Array.from(o),dataSetsValues:t.map(((e,t)=>({...e,data:Array.from(o).map((e=>s[e][t]))})))}}function Za(e){return e?e.length>de?e.substring(0,de)+"…":e:""}function Ya(e,t,o,{format:s,locale:n,truncateLabels:i=!0}){const r={responsive:!0,maintainAspectRatio:!1,layout:{padding:{left:20,right:20,top:e.title?10:25,bottom:10}},elements:{line:{fill:!1},point:{hitRadius:15}},animation:!1,plugins:{title:{display:!!e.title,text:a(e.title),color:o,font:{size:22,weight:"normal"}},legend:{onClick:()=>{}},tooltip:{callbacks:{label:function(e){const t=e.dataset?.label||e.label,o=e.parsed.y??e.parsed,i=Is(o,{format:!s&&Math.abs(o)>=1e3?"#,##":s,locale:n});return t?`${t}: ${i}`:i}}}}};return{type:e.type,options:r,data:{labels:i?t.map(Za):t,datasets:[]},plugins:[]}}function ja(e,t,o){let s={values:[],formattedValues:[]};if(o)o.invalidXc||o.invalidSheetName||(s={formattedValues:e.getRangeFormattedValues(o),values:e.getRangeValues(o).map((e=>String(e)))});else if(1===t.length)for(let o=0;o<$a(e,t[0]).length;o++)s.formattedValues.push(""),s.values.push("");else if(t[0]){s={formattedValues:Me(0,$a(e,t[0]).length).map((e=>e.toString())),values:s.formattedValues}}return s}function Xa(e,t){for(const o of t){const t=e.getRangeFormats(o.dataRange).find((e=>void 0!==e&&!Ns(e)));if(t)return t}}function Ka(e,t){const o=[];for(const[s,n]of Object.entries(t)){let t;if(n.labelCell){const o=n.labelCell,i=o?e.getEvaluatedCell({sheetId:o.sheetId,col:o.zone.left,row:o.zone.top}):void 0;t=i&&o?Za(i.formattedValue):t=`${Va.Series} ${parseInt(s)+1}`}else t=t=`${Va.Series} ${parseInt(s)+1}`;let i=n.dataRange?$a(e,n):[];o.push({data:i,label:t})}return o}function Qa(e){return 0===e?"origin":e-1}function Ja(e,t,o){const s=document.createElement("div");s.style.width=`${t.width}px`,s.style.height=`${t.height}px`;const n=document.createElement("canvas");if(s.append(n),n.setAttribute("width",t.width.toString()),n.setAttribute("height",t.height.toString()),document.body.append(s),"chartJsConfig"in e){e.chartJsConfig.plugins=[el];const t=new window.Chart(n,Te(e.chartJsConfig)),o=t.toBase64Image();return t.destroy(),s.remove(),o}if("scorecard"===o){Fi(Li(t,e),n);const o=n.toDataURL();return s.remove(),o}return""}const el={id:"customCanvasBackgroundColor",beforeDraw:e=>{const{ctx:t}=e;t.save(),t.globalCompositeOperation="destination-over",t.fillStyle="#ffffff",t.fillRect(0,0,e.width,e.height),t.restore()}};class tl extends ci{dataSets;labelRange;background;verticalAxisPosition;legendPosition;stacked;aggregated;type="bar";dataSetsHaveTitle;constructor(e,t,o){super(e,t,o),this.dataSets=pi(o,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=Un(o,t,e.labelRange),this.background=e.background,this.verticalAxisPosition=e.verticalAxisPosition,this.legendPosition=e.legendPosition,this.stacked=e.stacked,this.aggregated=e.aggregated,this.dataSetsHaveTitle=e.dataSetsHaveTitle}static transformDefinition(e,t){return vi(e,t)}static validateChartDefinition(e,t){return e.checkValidations(t,wi,yi)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range?e.range:[],dataSetsHaveTitle:!1,stacked:!1,aggregated:!1,legendPosition:"top",title:e.title||"",type:"bar",verticalAxisPosition:"left",labelRange:e.auxiliaryRange||void 0}}getContextCreation(){return{background:this.background,title:this.title,range:this.dataSets.map((e=>this.getters.getRangeString(e.dataRange,this.sheetId))),auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}copyForSheetId(e){const t=di(this.sheetId,e,this.dataSets),o=ui(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new tl(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new tl(t,e,this.getters)}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getDefinitionWithSpecificDataSets(e,t,o){return{type:"bar",dataSetsHaveTitle:!!e.length&&Boolean(e[0].labelCell),background:this.background,dataSets:e.map((e=>this.getters.getRangeString(e.dataRange,o||this.sheetId))),legendPosition:this.legendPosition,verticalAxisPosition:this.verticalAxisPosition,labelRange:t?this.getters.getRangeString(t,o||this.sheetId):void 0,title:this.title,stacked:this.stacked,aggregated:this.aggregated}}getDefinitionForExcel(){if(this.aggregated)return;const e=this.dataSets.map((e=>fi(this.getters,e))).filter((e=>""!==e.range&&e.range!==le)),t=bi(this.getters,this.labelRange,xi(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle));return{...this.getDefinition(),backgroundColor:Ma(this.background||I),fontColor:Ma(Ei(this.background)),dataSets:e,labelRange:t}}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=hi(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const n=this.getDefinitionWithSpecificDataSets(t,o);return new tl(n,this.sheetId,this.getters)}}function ol(e){return e.dataRange&&!on.test(e.dataRange)?"InvalidGaugeDataRange":"Success"}function sl(e,t){return t((t=>t.sectionRule?e(t.sectionRule.rangeMin,"rangeMin"):"Success"),(t=>t.sectionRule?e(t.sectionRule.rangeMax,"rangeMax"):"Success"))}function nl(e){return e.sectionRule&&Number(e.sectionRule.rangeMin)>=Number(e.sectionRule.rangeMax)?"GaugeRangeMinBiggerThanRangeMax":"Success"}function il(e,t){if(""===e)switch(t){case"rangeMin":return"EmptyGaugeRangeMin";case"rangeMax":return"EmptyGaugeRangeMax"}return"Success"}function rl(e,t){if(isNaN(e))switch(t){case"rangeMin":return"GaugeRangeMinNaN";case"rangeMax":return"GaugeRangeMaxNaN";case"lowerInflectionPointValue":return"GaugeLowerInflectionPointNaN";case"upperInflectionPointValue":return"GaugeUpperInflectionPointNaN"}return"Success"}class al extends ci{dataRange;sectionRule;background;type="gauge";constructor(e,t,o){super(e,t,o),this.dataRange=Un(this.getters,this.sheetId,e.dataRange),this.sectionRule=e.sectionRule,this.background=e.background}static validateChartDefinition(e,t){return e.checkValidations(t,ol,e.chainValidations(sl(il,e.batchValidations),sl(rl,e.batchValidations),nl),e.chainValidations((o=rl,(0,e.batchValidations)((e=>e.sectionRule?o(e.sectionRule.lowerInflectionPoint.value,"lowerInflectionPointValue"):"Success"),(e=>e.sectionRule?o(e.sectionRule.upperInflectionPoint.value,"upperInflectionPointValue"):"Success")))));var o}static transformDefinition(e,t){let o;return e.dataRange&&(o=ri(hn(e.dataRange),t)),{...e,dataRange:o?pn(o):void 0}}static getDefinitionFromContextCreation(e){return{background:e.background,title:e.title||"",type:"gauge",dataRange:e.range?e.range[0]:void 0,sectionRule:{colors:{lowerColor:"#cc0000",middleColor:"#f1c232",upperColor:"#6aa84f"},rangeMin:"0",rangeMax:"100",lowerInflectionPoint:{type:"percentage",value:"15"},upperInflectionPoint:{type:"percentage",value:"40"}}}}copyForSheetId(e){const t=ui(this.sheetId,e,this.dataRange),o=this.getDefinitionWithSpecificRanges(t,e);return new al(o,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificRanges(this.dataRange,e);return new al(t,e,this.getters)}getDefinition(){return this.getDefinitionWithSpecificRanges(this.dataRange)}getDefinitionWithSpecificRanges(e,t){return{background:this.background,sectionRule:this.sectionRule,title:this.title,type:"gauge",dataRange:e?this.getters.getRangeString(e,t||this.sheetId):void 0}}getDefinitionForExcel(){}getContextCreation(){return{background:this.background,title:this.title,range:this.dataRange?[this.getters.getRangeString(this.dataRange,this.sheetId)]:void 0}}updateRanges(e){const t=gi(this.dataRange,e);if(this.dataRange===t)return this;const o=this.getDefinitionWithSpecificRanges(t);return new al(o,this.sheetId,this.getters)}}const ll={second:1e3,minute:6e4,hour:36e5,day:864e5,month:2592e6,year:31536e6},cl={inSeconds:function(e){return Math.floor(e/ll.second)},inMinutes:function(e){return Math.floor(e/ll.minute)},inHours:function(e){return Math.floor(e/ll.hour)},inDays:function(e){return Math.floor(e/ll.day)},inMonths:function(e){return Math.floor(e/ll.month)},inYears:function(e){return Math.floor(e/ll.year)}},hl=/^((d|dd|m|mm|yyyy|yy|hh|h|ss|a)(-|:|\s|\/))*(d|dd|m|mm|yyyy|yy|hh|h|ss|a)$/i;function dl(e,t,o){const s=function(e){const t=e.indexOf("h");e=t>=0?e.slice(0,t).replace(/m/g,"M")+e.slice(t):e.replace(/m/g,"M");e.includes("a")||(e=e.replace(/h/g,"H"));return e}(t),n=function(e,t,o){const s=e.map((e=>jt(e,o)?.jsDate));if(s.some((e=>void 0===e))||e.length<2)return;const n=s.map((e=>e.getTime())),i=ht(n)-dt(n),r=function(e){if(e.includes("s"))return"second";if(e.includes("m"))return"minute";if(e.includes("h")||e.includes("H"))return"hour";if(e.includes("d"))return"day";if(e.includes("M"))return"month";return"year"}(t);if(ll.second>=ll[r]&&cl.inSeconds(i)<180)return"second";if(ll.minute>=ll[r]&&cl.inMinutes(i)<180)return"minute";if(ll.hour>=ll[r]&&cl.inHours(i)<96)return"hour";if(ll.day>=ll[r]&&cl.inDays(i)<90)return"day";if(ll.month>=ll[r]&&cl.inMonths(i)<36)return"month";return"year"}(e,s,o),i={};return n&&(i[n]=s),{parser:s,displayFormats:i,unit:n??!1}}class ul extends ci{dataSets;labelRange;background;verticalAxisPosition;legendPosition;labelsAsText;stacked;aggregated;type="line";dataSetsHaveTitle;cumulative;constructor(e,t,o){super(e,t,o),this.dataSets=pi(this.getters,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=Un(this.getters,t,e.labelRange),this.background=e.background,this.verticalAxisPosition=e.verticalAxisPosition,this.legendPosition=e.legendPosition,this.labelsAsText=e.labelsAsText,this.stacked=e.stacked,this.aggregated=e.aggregated,this.dataSetsHaveTitle=e.dataSetsHaveTitle,this.cumulative=e.cumulative}static validateChartDefinition(e,t){return e.checkValidations(t,wi,yi)}static transformDefinition(e,t){return vi(e,t)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range?e.range:[],dataSetsHaveTitle:!1,labelsAsText:!1,legendPosition:"top",title:e.title||"",type:"line",verticalAxisPosition:"left",labelRange:e.auxiliaryRange||void 0,stacked:!1,aggregated:!1,cumulative:!1}}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getDefinitionWithSpecificDataSets(e,t,o){return{type:"line",dataSetsHaveTitle:!!e.length&&Boolean(e[0].labelCell),background:this.background,dataSets:e.map((e=>this.getters.getRangeString(e.dataRange,o||this.sheetId))),legendPosition:this.legendPosition,verticalAxisPosition:this.verticalAxisPosition,labelRange:t?this.getters.getRangeString(t,o||this.sheetId):void 0,title:this.title,labelsAsText:this.labelsAsText,stacked:this.stacked,aggregated:this.aggregated,cumulative:this.cumulative}}getContextCreation(){return{background:this.background,title:this.title,range:this.dataSets.map((e=>this.getters.getRangeString(e.dataRange,this.sheetId))),auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=hi(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const n=this.getDefinitionWithSpecificDataSets(t,o);return new ul(n,this.sheetId,this.getters)}getDefinitionForExcel(){if(this.aggregated)return;const e=this.dataSets.map((e=>fi(this.getters,e))).filter((e=>""!==e.range&&e.range!==le)),t=bi(this.getters,this.labelRange,xi(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle));return{...this.getDefinition(),backgroundColor:Ma(this.background||I),fontColor:Ma(Ei(this.background)),dataSets:e,labelRange:t}}copyForSheetId(e){const t=di(this.sheetId,e,this.dataSets),o=ui(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new ul(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new ul(t,e,this.getters)}}function gl(e,t){return ml(e,t)||fl(e,t)}function pl(e,t){return function(e,t){return!e.labelsAsText&&ml(e.labelRange,t)}(e,t)&&function(){if(!window.Chart)return!1;const e="luxon"===new window.Chart._adapters._date({})._id;e||bl||(bl=!0,console.warn("'chartjs-adapter-luxon' time adapter is not installed. Time scale axes are disabled."));return e}()?"time":function(e,t){return!e.labelsAsText&&fl(e.labelRange,t)}(e,t)?"linear":"category"}function ml(e,t){if(!e||!fl(e,t))return!1;const o=t.getEvaluatedCell({sheetId:e.sheetId,col:e.zone.left,row:e.zone.top}).format;return Boolean(o&&hl.test(o))}function fl(e,t){if(!e)return!1;const o=t.getRangeValues(e);return!o.some((e=>isNaN(Number(e))&&e))&&!o.every((e=>!e))}let bl=!1;class vl extends ci{dataSets;labelRange;background;legendPosition;type="pie";aggregated;dataSetsHaveTitle;constructor(e,t,o){super(e,t,o),this.dataSets=pi(o,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=Un(o,t,e.labelRange),this.background=e.background,this.legendPosition=e.legendPosition,this.aggregated=e.aggregated,this.dataSetsHaveTitle=e.dataSetsHaveTitle}static transformDefinition(e,t){return vi(e,t)}static validateChartDefinition(e,t){return e.checkValidations(t,wi,yi)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range?e.range:[],dataSetsHaveTitle:!1,legendPosition:"top",title:e.title||"",type:"pie",labelRange:e.auxiliaryRange||void 0,aggregated:!1}}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getContextCreation(){return{background:this.background,title:this.title,range:this.dataSets.map((e=>this.getters.getRangeString(e.dataRange,this.sheetId))),auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}getDefinitionWithSpecificDataSets(e,t,o){return{type:"pie",dataSetsHaveTitle:!!e.length&&Boolean(e[0].labelCell),background:this.background,dataSets:e.map((e=>this.getters.getRangeString(e.dataRange,o||this.sheetId))),legendPosition:this.legendPosition,labelRange:t?this.getters.getRangeString(t,o||this.sheetId):void 0,title:this.title,aggregated:this.aggregated}}copyForSheetId(e){const t=di(this.sheetId,e,this.dataSets),o=ui(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new vl(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new vl(t,e,this.getters)}getDefinitionForExcel(){if(this.aggregated)return;const e=this.dataSets.map((e=>fi(this.getters,e))).filter((e=>""!==e.range&&e.range!==le)),t=bi(this.getters,this.labelRange,xi(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle));return{...this.getDefinition(),backgroundColor:Ma(this.background||I),fontColor:Ma(Ei(this.background)),verticalAxisPosition:"left",dataSets:e,labelRange:t}}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=hi(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const n=this.getDefinitionWithSpecificDataSets(t,o);return new vl(n,this.sheetId,this.getters)}}function Sl(e,t){const o=[],s=ht(t.map((e=>e.data.length)));for(let t=0;t<=s;t++)o.push(e.next());return o}const Cl=new Hi;Cl.add("bar",{match:e=>"bar"===e,createChart:(e,t,o)=>new tl(e,t,o),getChartRuntime:function(e,t){let o=ja(t,e.dataSets,e.labelRange).formattedValues,s=Ka(t,e.dataSets);e.dataSetsHaveTitle&&s[0]&&o.length>s[0].data.length&&o.shift(),({labels:o,dataSetsValues:s}=Wa(o,s)),e.aggregated&&({labels:o,dataSetsValues:s}=qa(o,s));const n=function(e,t,o){const s=Ei(e.background),n=Ya(e,t,s,o),i={labels:{color:s}};return!e.labelRange&&1===e.dataSets.length||"none"===e.legendPosition?i.display=!1:i.position=e.legendPosition,n.options.plugins.legend={...n.options.plugins?.legend,...i},n.options.layout={padding:{left:20,right:20,top:e.title?10:25,bottom:10}},n.options.scales={x:{ticks:{padding:5,color:s}},y:{position:e.verticalAxisPosition,beginAtZero:!0,ticks:{color:s,callback:e=>{if(e=Number(e),isNaN(e))return e;const{locale:t,format:s}=o;return Is(e,{locale:t,format:!s&&Math.abs(e)>=1e3?"#,##":s})}}}},e.stacked&&(n.options.scales.x.stacked=!0,n.options.scales.y.stacked=!0),n}(e,o,{format:Xa(t,e.dataSets),locale:t.getLocale()}),i=new Ci;for(let{label:e,data:t}of s){const o=i.next(),s={label:e,data:t,borderColor:o,backgroundColor:o};n.data.datasets.push(s)}return{chartJsConfig:n,background:e.background||I}},validateChartDefinition:(e,t)=>tl.validateChartDefinition(e,t),transformDefinition:(e,t)=>tl.transformDefinition(e,t),getChartDefinitionFromContextCreation:e=>tl.getDefinitionFromContextCreation(e),name:a("Bar"),sequence:10}),Cl.add("line",{match:e=>"line"===e,createChart:(e,t,o)=>new ul(e,t,o),getChartRuntime:function(e,t){const o=pl(e,t),s=ja(t,e.dataSets,e.labelRange);let n="linear"===o?s.values:s.formattedValues,i=Ka(t,e.dataSets);e.dataSetsHaveTitle&&i[0]&&n.length>i[0].data.length&&n.shift(),({labels:n,dataSetsValues:i}=Wa(n,i)),"time"===o&&({labels:n,dataSetsValues:i}=function(e,t){if(0===e.length||e.every((e=>!e)))return{labels:e,dataSetsValues:t};const o=[...e],s=Te(t);for(let e=0;e<o.length;e++)if(!o[e]){o[e]=Xe(o,e);for(let t of s)t.data[e]=void 0}return{labels:o,dataSetsValues:s}}(n,i)),e.aggregated&&({labels:n,dataSetsValues:i}=qa(n,i));const r=t.getLocale(),a="category"===o,l=Xa(t,e.dataSets),c=function(e,t,o){const s=Ei(e.background),n=Ya(e,t,s,o),i={labels:{color:s,generateLabels(e){const{data:t}=e,o=window.Chart.defaults.plugins.legend.labels.generateLabels(e);for(const[e,s]of o.entries())s.fillStyle=t.datasets[e].borderColor;return o}}};return!e.labelRange&&1===e.dataSets.length||"none"===e.legendPosition?i.display=!1:i.position=e.legendPosition,Object.assign(n.options.plugins.legend||{},i),n.options.layout={padding:{left:20,right:20,top:e.title?10:25,bottom:10}},n.options.scales={x:{ticks:{padding:5,color:s}},y:{position:e.verticalAxisPosition,beginAtZero:!0,ticks:{color:s,callback:e=>{if(e=Number(e),isNaN(e))return e;const{locale:t,format:s}=o;return Is(e,{locale:t,format:!s&&Math.abs(e)>=1e3?"#,##":s})}}}},e.stacked&&n.options?.scales?.y&&(n.options.scales.y.stacked=!0),n}(e,n,{format:l,locale:r,truncateLabels:a}),h=function(e,t){if(t)return e.getEvaluatedCell({sheetId:t.sheetId,col:t.zone.left,row:t.zone.top}).format}(t,e.labelRange);if("time"===o){const e={type:"time",time:dl(n,h,r)};Object.assign(c.options.scales.x,e),c.options.scales.x.ticks.maxTicksLimit=15}else"linear"===o&&(c.options.scales.x.type="linear",c.options.scales.x.ticks.callback=e=>Is(e,{format:h,locale:r}),c.options.plugins.tooltip.callbacks.title=e=>Is(e[0].parsed.x||e[0].label,{locale:r,format:h}));const d=new Ci;for(let[t,{label:s,data:r}]of i.entries()){if(e.cumulative){let e=0;r=r.map((t=>isNaN(t)?t:(e+=parseFloat(t),e)))}["linear","time"].includes(o)&&(r=r.map(((e,t)=>({x:n[t]||void 0,y:e}))));const i=d.next();let a=wt(i);e.stacked&&(a.a=.4);const l={label:s,data:r,tension:0,borderColor:i,backgroundColor:Et(a),pointBackgroundColor:i,fill:!!e.stacked&&Qa(t)};c.data.datasets.push(l)}return{chartJsConfig:c,background:e.background||I}},validateChartDefinition:(e,t)=>ul.validateChartDefinition(e,t),transformDefinition:(e,t)=>ul.transformDefinition(e,t),getChartDefinitionFromContextCreation:e=>ul.getDefinitionFromContextCreation(e),name:a("Line"),sequence:20}),Cl.add("pie",{match:e=>"pie"===e,createChart:(e,t,o)=>new vl(e,t,o),getChartRuntime:function(e,t){let o=ja(t,e.dataSets,e.labelRange).formattedValues,s=Ka(t,e.dataSets);e.dataSetsHaveTitle&&s[0]&&o.length>s[0].data.length&&o.shift(),({labels:o,dataSetsValues:s}=Wa(o,s)),e.aggregated&&({labels:o,dataSetsValues:s}=qa(o,s));const n=function(e,t,o){const s=Ei(e.background),n=Ya(e,t,s,o),i={labels:{color:s}};return!e.labelRange&&1===e.dataSets.length||"none"===e.legendPosition?i.display=!1:i.position=e.legendPosition,Object.assign(n.options.plugins.legend||{},i),n.options.layout={padding:{left:20,right:20,top:e.title?10:25,bottom:10}},n.options.plugins.tooltip.callbacks.title=function(e){return e[0].dataset.label},n.options.plugins.tooltip.callbacks.label=function(e){const{format:t,locale:s}=o,n=function(e,t){const o=e.filter((e=>"number"==typeof e)).reduce(((e,t)=>e+t),0);if(!o)return"";return(e[t]/o*100).toFixed(2)}(e.dataset.data,e.dataIndex),i=e.label||e.dataset.label,r=e.parsed.y??e.parsed,a=Is(r,{format:!t&&Math.abs(r)>=1e3?"#,##":t,locale:s});return i?`${i}: ${a} (${n}%)`:`${a} (${n}%)`},n}(e,o,{format:Xa(t,e.dataSets),locale:t.getLocale()}),i=new Ci;for(let{label:e,data:t}of s){const o={label:e,data:t,borderColor:"#FFFFFF",backgroundColor:Sl(i,s)};n.data.datasets.push(o)}return{chartJsConfig:n,background:e.background||I}},validateChartDefinition:(e,t)=>vl.validateChartDefinition(e,t),transformDefinition:(e,t)=>vl.transformDefinition(e,t),getChartDefinitionFromContextCreation:e=>vl.getDefinitionFromContextCreation(e),name:a("Pie"),sequence:30}),Cl.add("scorecard",{match:e=>"scorecard"===e,createChart:(e,t,o)=>new Ni(e,t,o),getChartRuntime:function(e,t){let o,s,n="",i="";if(e.keyValue){const s={sheetId:e.keyValue.sheetId,col:e.keyValue.zone.left,row:e.keyValue.zone.top};o=t.getEvaluatedCell(s),n=String(o.value),i=o.formattedValue}const r=e.baseline;if(r){const o={sheetId:e.baseline.sheetId,col:e.baseline.zone.left,row:e.baseline.zone.top};s=t.getEvaluatedCell(o)}const{background:l,fontColor:c}=t.getStyleOfSingleCellChart(e.background,e.keyValue),h=t.getLocale();return{title:a(e.title),keyValue:i||n,baselineDisplay:Ii(s,o,e.baselineMode,h),baselineArrow:Ti(s,o,e.baselineMode),baselineColor:Ri(s,e.baselineMode,o,e.baselineColorUp,e.baselineColorDown),baselineDescr:e.baselineDescr?a(e.baselineDescr):"",fontColor:c,background:l,baselineStyle:"percentage"!==e.baselineMode&&r?t.getCellStyle({sheetId:r.sheetId,col:r.zone.left,row:r.zone.top}):void 0,keyValueStyle:e.keyValue?t.getCellStyle({sheetId:e.keyValue.sheetId,col:e.keyValue.zone.left,row:e.keyValue.zone.top}):void 0}},validateChartDefinition:(e,t)=>Ni.validateChartDefinition(e,t),transformDefinition:(e,t)=>Ni.transformDefinition(e,t),getChartDefinitionFromContextCreation:e=>Ni.getDefinitionFromContextCreation(e),name:a("Scorecard"),sequence:40}),Cl.add("gauge",{match:e=>"gauge"===e,createChart:(e,t,o)=>new al(e,t,o),getChartRuntime:function(e,t){const o=function(e,t){const o=Ya(e,[],Ei(e.background),{locale:t});return o.options.hover=void 0,o.options.events=[],o.options.layout={padding:{left:30,right:30,top:e.title?10:25,bottom:25}},o.options.needle={width:10,borderColor:"#000000",backgroundColor:"#000000"},o.options.valueLabel={display:!1,font:{size:30,color:"#FFFFFF"},backgroundColor:"#000000",borderColor:"#000000",borderRadius:5,padding:{top:5,right:5,bottom:5,left:5}},o}(e,t.getLocale()),s=e.sectionRule.colors,n=e.sectionRule.lowerInflectionPoint,i=e.sectionRule.upperInflectionPoint,r=Number(n.value),a=Number(i.value),l=Number(e.sectionRule.rangeMin),c=Number(e.sectionRule.rangeMax),h=c-l,d=[];if(""!==n.value){const e="number"===n.type?r:l+h*r/100;d.push({value:_e(e,l,c),color:s.lowerColor})}if(""!==i.value){const e="number"===i.type?a:l+h*a/100;d.push({value:_e(e,l,c),color:s.middleColor})}const u=[],g=[];d.sort(((e,t)=>e.value-t.value)).map((e=>{u.push(e.value),g.push(e.color)})),u.push(c),g.push(s.upperColor);const p=e.dataRange,m=h/30;let f,b=l-m,v=!1;if(void 0!==p){const e=t.getEvaluatedCell({sheetId:p.sheetId,col:p.zone.left,row:p.zone.top});e.type===mo.number&&(b=_e(e.value,l-m,c+m),f=()=>t.getRangeFormattedValues(p)[0],v=!0)}return o.options.valueLabel.display=v,o.options.valueLabel.formatter=f,o.data.datasets.push({data:u,minValue:Number(e.sectionRule.rangeMin),value:b,backgroundColor:g}),{chartJsConfig:o,background:t.getStyleOfSingleCellChart(e.background,p).background}},validateChartDefinition:(e,t)=>al.validateChartDefinition(e,t),transformDefinition:(e,t)=>al.transformDefinition(e,t),getChartDefinitionFromContextCreation:e=>al.getDefinitionFromContextCreation(e),name:a("Gauge"),sequence:50});const El=new Hi;El.add("line",li),El.add("bar",li),El.add("pie",li),El.add("gauge",li),El.add("scorecard",Bi);const wl=new Hi;gr`
284
284
  .o-chart-container {
285
285
  width: 100%;
286
286
  height: 100%;
@@ -2628,4 +2628,4 @@
2628
2628
  <tableParts count="${e.filterTables.length}">
2629
2629
  ${sy(a)}
2630
2630
  </tableParts>
2631
- `}var _T;!function(e){e[e.Ready=0]="Ready",e[e.Running=1]="Running",e[e.RunningCore=2]="RunningCore",e[e.Finalizing=3]="Finalizing"}(_T||(_T={}));function MT(e,t={}){const o=Te(t);return o.type=e,o}const NT={},FT={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:B,HEADER_WIDTH:H,TOPBAR_HEIGHT:63,BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:z,DEFAULT_CELL_HEIGHT:G,SCROLLBAR_WIDTH:$},DT={autofillModifiersRegistry:nr,autofillRulesRegistry:ir,cellMenuRegistry:sb,colMenuRegistry:Hv,linkMenuRegistry:Ta,functionRegistry:Tf,featurePluginRegistry:eR,statefulUIPluginRegistry:tR,coreViewsPluginRegistry:oR,corePluginRegistry:JI,rowMenuRegistry:$v,sidePanelRegistry:tC,figureRegistry:Rl,chartSidePanelComponentRegistry:uS,chartComponentRegistry:El,chartRegistry:Cl,topbarMenuRegistry:Wv,topbarComponentRegistry:oC,clickableCellRegistry:sR,otRegistry:qv,inverseCommandRegistry:_l,urlRegistry:Gi,cellPopoverRegistry:_a,numberFormatMenuRegistry:zv,repeatLocalCommandTransformRegistry:VI,repeatCommandTransformRegistry:kI},LT={arg:Sc,toBoolean:Wo,toJsDate:qo,toNumber:Lo,toString:zo,toXC:Ft,toZone:dn,toUnboundedZone:hn,toCartesian:Nt,numberToLetters:Tt,lettersToNumber:Ot,UuidGenerator:oi,formatValue:Is,createCurrencyFormat:Hs,computeTextWidth:Zn,createEmptyWorkbookData:Py,createEmptySheet:Ly,createEmptyExcelSheet:ky,getDefaultChartJsRuntime:Ya,chartFontColor:Ei,ChartColors:Ci,EvaluationError:d,CellErrorLevel:h,getFillingMode:Qa,rgbaToHex:Et,colorToRGBA:wt,positionToZone:Fn,isDefined:$e,isMatrix:Oo,lazy:je,genericRepeat:UI,createAction:ii,createActions:si,transformRangeData:ai,deepEquals:Qe},PT={isMarkdownLink:Pe,parseMarkdownLink:Ue,markdownLink:Ve,openLink:Yi,urlRepresentation:Zi},kT={ChartPanel:gS,ChartFigure:yl,ChartJsComponent:li,Grid:aE,GridOverlay:WC,ScorecardChart:Bi,LineConfigPanel:cS,LineBarPieDesignPanel:rS,BarConfigPanel:Jv,LineBarPieConfigPanel:Qv,GaugeChartConfigPanel:aS,GaugeChartDesignPanel:lS,ScorecardChartConfigPanel:hS,ScorecardChartDesignPanel:dS,FigureComponent:sC,Menu:Hr,SelectionInput:Xv},VT={useDragAndDropListItems:vS};const UT={DEFAULT_LOCALE:To};e.AbstractChart=ci,e.CorePlugin=Uy,e.DispatchResult=yo,e.EvaluationError=d,e.Model=class extends uI{corePlugins=[];featurePlugins=[];statefulUIPlugins=[];coreViewsPlugins=[];range;session;isReplayingCommand=!1;renderers=[];status=0;config;corePluginConfig;uiPluginConfig;state;selection;getters;coreGetters;uuidGenerator;handlers=[];uiHandlers=[];coreHandlers=[];constructor(e={},r={},a=[],l=new oi,c=!0){super(),n===o&&i===s&&(i=()=>!0),a=Ny(e,a);const h=_y(e,c);this.state=new zR,this.uuidGenerator=l,this.config=this.setupConfig(r),this.session=this.setupSession(h.revisionId),this.coreGetters={},this.range=new Rx(this.coreGetters),this.coreGetters.getRangeString=this.range.getRangeString.bind(this.range),this.coreGetters.getRangeFromSheetXC=this.range.getRangeFromSheetXC.bind(this.range),this.coreGetters.createAdaptedRanges=this.range.createAdaptedRanges.bind(this.range),this.coreGetters.getRangeDataFromXc=this.range.getRangeDataFromXc.bind(this.range),this.coreGetters.getRangeDataFromZone=this.range.getRangeDataFromZone.bind(this.range),this.coreGetters.getRangeFromRangeData=this.range.getRangeFromRangeData.bind(this.range),this.coreGetters.getRangeFromZone=this.range.getRangeFromZone.bind(this.range),this.getters={isReadonly:()=>"readonly"===this.config.mode||"dashboard"===this.config.mode,isDashboard:()=>"dashboard"===this.config.mode},this.uuidGenerator.setIsFastStrategy(!0),this.selection=new HR(this.getters),this.coreHandlers.push(this.range),this.handlers.push(this.range),this.corePluginConfig=this.setupCorePluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of JI.getAll())this.setupCorePlugin(e,h);Object.assign(this.getters,this.coreGetters),this.session.loadInitialMessages(a);for(let e of oR.getAll()){const t=this.setupUiPlugin(e);this.coreViewsPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t),this.coreHandlers.push(t)}for(let e of tR.getAll()){const t=this.setupUiPlugin(e);this.statefulUIPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}for(let e of eR.getAll()){const t=this.setupUiPlugin(e);this.featurePlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}this.uuidGenerator.setIsFastStrategy(!1),this.dispatch("START"),this.selection.observe(this,{handleEvent:()=>this.trigger("update")}),this.setupSessionEvents(),this.joinSession(),r.snapshotRequested&&(this.session.snapshot(this.exportData()),this.garbageCollectExternalResources()),t.markRaw(this)}joinSession(){this.session.join(this.config.client)}leaveSession(){this.session.leave(this.exportData())}setupUiPlugin(e){const t=new e(this.uiPluginConfig);for(let o of e.getters){if(!(o in t))throw new Error(`Invalid getter name: ${o} for plugin ${t.constructor}`);if(o in this.getters)throw new Error(`Getter "${o}" is already defined.`);this.getters[o]=t[o].bind(t)}const o=e.layers.map((e=>[t,e]));return this.renderers.push(...o),this.renderers.sort(((e,t)=>e[1]-t[1])),t}setupCorePlugin(e,t){const o=new e(this.corePluginConfig);for(let t of e.getters){if(!(t in o))throw new Error(`Invalid getter name: ${t} for plugin ${o.constructor}`);if(t in this.coreGetters)throw new Error(`Getter "${t}" is already defined.`);this.coreGetters[t]=o[t].bind(o)}o.import(t),this.corePlugins.push(o),this.coreHandlers.push(o),this.handlers.push(o)}onRemoteRevisionReceived({commands:e}){for(let t of e){const e=this.status;this.status=2,this.dispatchToHandlers(this.statefulUIPlugins,t),this.status=e}this.finalize()}setupSession(e){return new yI(VR({initialRevisionId:e,recordChanges:this.state.recordChanges.bind(this.state),dispatch:e=>{this.checkDispatchAllowed(e).isSuccessful&&(this.isReplayingCommand=!0,this.dispatchToHandlers(this.coreHandlers,e),this.isReplayingCommand=!1)}}),this.config.transportService,e)}setupSessionEvents(){this.session.on("remote-revision-received",this,this.onRemoteRevisionReceived),this.session.on("revision-undone",this,(({commands:e})=>{this.dispatchFromCorePlugin("UNDO",{commands:e}),this.finalize()})),this.session.on("revision-redone",this,(({commands:e})=>{this.dispatchFromCorePlugin("REDO",{commands:e}),this.finalize()})),this.session.on("unexpected-revision-id",this,(()=>this.trigger("unexpected-revision-id"))),this.session.on("collaborative-event-received",this,(()=>{this.trigger("update")}))}setupConfig(e){const t=e.client||{id:this.uuidGenerator.uuidv4(),name:a("Anonymous").toString()},o=e.transportService||new OR;return{...e,mode:e.mode||"normal",custom:e.custom||{},external:this.setupExternalConfig(e.external||{}),transportService:o,client:t,moveClient:()=>{},snapshotRequested:!1,notifyUI:e=>this.trigger("notify-ui",e),raiseBlockingErrorUI:e=>this.trigger("raise-error-ui",{text:e})}}setupExternalConfig(e){const t=e.loadLocales||(()=>Promise.resolve(Ro));return{...e,loadLocales:t}}setupCorePluginConfig(){return{getters:this.coreGetters,stateObserver:this.state,range:this.range,dispatch:this.dispatchFromCorePlugin,uuidGenerator:this.uuidGenerator,custom:this.config.custom,external:this.config.external}}setupUiPluginConfig(){return{getters:this.getters,stateObserver:this.state,dispatch:this.dispatch,selection:this.selection,moveClient:this.session.move.bind(this.session),custom:this.config.custom,uiActions:this.config,session:this.session,defaultCurrencyFormat:this.config.defaultCurrencyFormat}}checkDispatchAllowed(e){const t=wo(e)?this.checkDispatchAllowedCoreCommand(e):this.checkDispatchAllowedLocalCommand(e);return t.some((e=>"Success"!==e))?new yo(t.flat()):yo.Success}checkDispatchAllowedCoreCommand(e){const t=this.corePlugins.map((t=>t.allowDispatch(e)));return t.push(this.range.allowDispatch(e)),t}checkDispatchAllowedLocalCommand(e){return this.uiHandlers.map((t=>t.allowDispatch(e)))}finalize(){this.status=3;for(const e of this.handlers)e.finalize();this.status=0}canDispatch=(e,t)=>this.checkDispatchAllowed(MT(e,t));dispatch=(e,t)=>{const o=MT(e,t);let s=this.status;if(this.getters.isReadonly()&&(n=o,!Co.has(n.type)))return new yo("Readonly");var n;if(!this.session.canApplyOptimisticUpdate())return new yo("WaitingSessionConfirmation");switch(s){case 0:const t=this.checkDispatchAllowed(o);if(!t.isSuccessful)return t;this.status=1;const{changes:s,commands:n}=this.state.recordChanges((()=>{wo(o)&&this.state.addCommand(o),this.dispatchToHandlers(this.handlers,o),this.finalize()}));this.session.save(o,n,s),this.status=0,this.trigger("update");break;case 1:if(wo(o)){const e=this.checkDispatchAllowed(o);if(!e.isSuccessful)return e;this.state.addCommand(o)}this.dispatchToHandlers(this.handlers,o);break;case 3:throw new Error("Cannot dispatch commands in the finalize state");case 2:if(wo(o))throw new Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,o)}return yo.Success};dispatchFromCorePlugin=(e,t)=>{const o=MT(e,t),s=this.status;this.status=2;const n=this.isReplayingCommand?this.coreHandlers:this.handlers;return this.dispatchToHandlers(n,o),this.status=s,yo.Success};dispatchToHandlers(e,t){const o=wo(t);for(const s of e)!o&&s instanceof Uy||s.beforeHandle(t);for(const s of e)!o&&s instanceof Uy||s.handle(t)}drawGrid(e){for(let[t,o]of this.renderers)e.ctx.save(),t.drawGrid(e,o),e.ctx.restore()}exportData(){let e=Py();for(let t of this.handlers)t instanceof Uy&&t.export(e);return e.revisionId=this.session.getRevisionId()||ce,e=Te(e),e}updateMode(e){"normal"!==e&&this.dispatch("CANCEL_EDITION"),this.config.mode=e,this.trigger("update")}exportXLSX(){this.dispatch("EVALUATE_CELLS");let e={...Py(),sheets:[ky(Oy,"Sheet1")]};for(let t of this.handlers)t instanceof Vy&&t.exportForExcel(e);return e=Te(e),AT(e)}garbageCollectExternalResources(){for(const e of this.corePlugins)e.garbageCollectExternalResources()}},e.Registry=Hi,e.Revision=EI,e.SPREADSHEET_DIMENSIONS=FT,e.Spreadsheet=AR,e.UIPlugin=Tx,e.__info__=NT,e.addFunction=function e(t,o){return Tf.add(t,o),{addFunction:(t,o)=>e(t,o)}},e.astToFormula=ix,e.compile=ux,e.compileTokens=gx,e.components=kT,e.constants=UT,e.convertAstNodes=tx,e.coreTypes=Eo,e.findCellInNewZone=Mn,e.functionCache=dx,e.helpers=LT,e.hooks=VT,e.invalidateCFEvaluationCommands=So,e.invalidateDependenciesCommands=vo,e.invalidateEvaluationCommands=bo,e.iterateAstNodes=ox,e.links=PT,e.load=_y,e.parse=Jy,e.parseTokens=ex,e.readonlyAllowedCommands=Co,e.registries=DT,e.setDefaultSheetViewSize=function(e){Ee=e},e.setTranslationMethod=function(e,t=(()=>!0)){n=e,i=t},e.tokenize=qr,NT.version="17.0.29",NT.date="2024-07-08T05:40:27.608Z",NT.hash="2d467e3"}(this.o_spreadsheet=this.o_spreadsheet||{},owl);
2631
+ `}var _T;!function(e){e[e.Ready=0]="Ready",e[e.Running=1]="Running",e[e.RunningCore=2]="RunningCore",e[e.Finalizing=3]="Finalizing"}(_T||(_T={}));function MT(e,t={}){const o=Te(t);return o.type=e,o}const NT={},FT={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:B,HEADER_WIDTH:H,TOPBAR_HEIGHT:63,BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:z,DEFAULT_CELL_HEIGHT:G,SCROLLBAR_WIDTH:$},DT={autofillModifiersRegistry:nr,autofillRulesRegistry:ir,cellMenuRegistry:sb,colMenuRegistry:Hv,linkMenuRegistry:Ta,functionRegistry:Tf,featurePluginRegistry:eR,statefulUIPluginRegistry:tR,coreViewsPluginRegistry:oR,corePluginRegistry:JI,rowMenuRegistry:$v,sidePanelRegistry:tC,figureRegistry:Rl,chartSidePanelComponentRegistry:uS,chartComponentRegistry:El,chartRegistry:Cl,topbarMenuRegistry:Wv,topbarComponentRegistry:oC,clickableCellRegistry:sR,otRegistry:qv,inverseCommandRegistry:_l,urlRegistry:Gi,cellPopoverRegistry:_a,numberFormatMenuRegistry:zv,repeatLocalCommandTransformRegistry:VI,repeatCommandTransformRegistry:kI},LT={arg:Sc,toBoolean:Wo,toJsDate:qo,toNumber:Lo,toString:zo,toXC:Ft,toZone:dn,toUnboundedZone:hn,toCartesian:Nt,numberToLetters:Tt,lettersToNumber:Ot,UuidGenerator:oi,formatValue:Is,createCurrencyFormat:Hs,computeTextWidth:Zn,createEmptyWorkbookData:Py,createEmptySheet:Ly,createEmptyExcelSheet:ky,getDefaultChartJsRuntime:Ya,chartFontColor:Ei,ChartColors:Ci,EvaluationError:d,CellErrorLevel:h,getFillingMode:Qa,rgbaToHex:Et,colorToRGBA:wt,positionToZone:Fn,isDefined:$e,isMatrix:Oo,lazy:je,genericRepeat:UI,createAction:ii,createActions:si,transformRangeData:ai,deepEquals:Qe},PT={isMarkdownLink:Pe,parseMarkdownLink:Ue,markdownLink:Ve,openLink:Yi,urlRepresentation:Zi},kT={ChartPanel:gS,ChartFigure:yl,ChartJsComponent:li,Grid:aE,GridOverlay:WC,ScorecardChart:Bi,LineConfigPanel:cS,LineBarPieDesignPanel:rS,BarConfigPanel:Jv,LineBarPieConfigPanel:Qv,GaugeChartConfigPanel:aS,GaugeChartDesignPanel:lS,ScorecardChartConfigPanel:hS,ScorecardChartDesignPanel:dS,FigureComponent:sC,Menu:Hr,SelectionInput:Xv},VT={useDragAndDropListItems:vS};const UT={DEFAULT_LOCALE:To};e.AbstractChart=ci,e.CorePlugin=Uy,e.DispatchResult=yo,e.EvaluationError=d,e.Model=class extends uI{corePlugins=[];featurePlugins=[];statefulUIPlugins=[];coreViewsPlugins=[];range;session;isReplayingCommand=!1;renderers=[];status=0;config;corePluginConfig;uiPluginConfig;state;selection;getters;coreGetters;uuidGenerator;handlers=[];uiHandlers=[];coreHandlers=[];constructor(e={},r={},a=[],l=new oi,c=!0){super(),n===o&&i===s&&(i=()=>!0),a=Ny(e,a);const h=_y(e,c);this.state=new zR,this.uuidGenerator=l,this.config=this.setupConfig(r),this.session=this.setupSession(h.revisionId),this.coreGetters={},this.range=new Rx(this.coreGetters),this.coreGetters.getRangeString=this.range.getRangeString.bind(this.range),this.coreGetters.getRangeFromSheetXC=this.range.getRangeFromSheetXC.bind(this.range),this.coreGetters.createAdaptedRanges=this.range.createAdaptedRanges.bind(this.range),this.coreGetters.getRangeDataFromXc=this.range.getRangeDataFromXc.bind(this.range),this.coreGetters.getRangeDataFromZone=this.range.getRangeDataFromZone.bind(this.range),this.coreGetters.getRangeFromRangeData=this.range.getRangeFromRangeData.bind(this.range),this.coreGetters.getRangeFromZone=this.range.getRangeFromZone.bind(this.range),this.getters={isReadonly:()=>"readonly"===this.config.mode||"dashboard"===this.config.mode,isDashboard:()=>"dashboard"===this.config.mode},this.uuidGenerator.setIsFastStrategy(!0),this.selection=new HR(this.getters),this.coreHandlers.push(this.range),this.handlers.push(this.range),this.corePluginConfig=this.setupCorePluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of JI.getAll())this.setupCorePlugin(e,h);Object.assign(this.getters,this.coreGetters),this.session.loadInitialMessages(a);for(let e of oR.getAll()){const t=this.setupUiPlugin(e);this.coreViewsPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t),this.coreHandlers.push(t)}for(let e of tR.getAll()){const t=this.setupUiPlugin(e);this.statefulUIPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}for(let e of eR.getAll()){const t=this.setupUiPlugin(e);this.featurePlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}this.uuidGenerator.setIsFastStrategy(!1),this.dispatch("START"),this.selection.observe(this,{handleEvent:()=>this.trigger("update")}),this.setupSessionEvents(),this.joinSession(),r.snapshotRequested&&(this.session.snapshot(this.exportData()),this.garbageCollectExternalResources()),t.markRaw(this)}joinSession(){this.session.join(this.config.client)}leaveSession(){this.session.leave(this.exportData())}setupUiPlugin(e){const t=new e(this.uiPluginConfig);for(let o of e.getters){if(!(o in t))throw new Error(`Invalid getter name: ${o} for plugin ${t.constructor}`);if(o in this.getters)throw new Error(`Getter "${o}" is already defined.`);this.getters[o]=t[o].bind(t)}const o=e.layers.map((e=>[t,e]));return this.renderers.push(...o),this.renderers.sort(((e,t)=>e[1]-t[1])),t}setupCorePlugin(e,t){const o=new e(this.corePluginConfig);for(let t of e.getters){if(!(t in o))throw new Error(`Invalid getter name: ${t} for plugin ${o.constructor}`);if(t in this.coreGetters)throw new Error(`Getter "${t}" is already defined.`);this.coreGetters[t]=o[t].bind(o)}o.import(t),this.corePlugins.push(o),this.coreHandlers.push(o),this.handlers.push(o)}onRemoteRevisionReceived({commands:e}){for(let t of e){const e=this.status;this.status=2,this.dispatchToHandlers(this.statefulUIPlugins,t),this.status=e}this.finalize()}setupSession(e){return new yI(VR({initialRevisionId:e,recordChanges:this.state.recordChanges.bind(this.state),dispatch:e=>{this.checkDispatchAllowed(e).isSuccessful&&(this.isReplayingCommand=!0,this.dispatchToHandlers(this.coreHandlers,e),this.isReplayingCommand=!1)}}),this.config.transportService,e)}setupSessionEvents(){this.session.on("remote-revision-received",this,this.onRemoteRevisionReceived),this.session.on("revision-undone",this,(({commands:e})=>{this.dispatchFromCorePlugin("UNDO",{commands:e}),this.finalize()})),this.session.on("revision-redone",this,(({commands:e})=>{this.dispatchFromCorePlugin("REDO",{commands:e}),this.finalize()})),this.session.on("unexpected-revision-id",this,(()=>this.trigger("unexpected-revision-id"))),this.session.on("collaborative-event-received",this,(()=>{this.trigger("update")}))}setupConfig(e){const t=e.client||{id:this.uuidGenerator.uuidv4(),name:a("Anonymous").toString()},o=e.transportService||new OR;return{...e,mode:e.mode||"normal",custom:e.custom||{},external:this.setupExternalConfig(e.external||{}),transportService:o,client:t,moveClient:()=>{},snapshotRequested:!1,notifyUI:e=>this.trigger("notify-ui",e),raiseBlockingErrorUI:e=>this.trigger("raise-error-ui",{text:e})}}setupExternalConfig(e){const t=e.loadLocales||(()=>Promise.resolve(Ro));return{...e,loadLocales:t}}setupCorePluginConfig(){return{getters:this.coreGetters,stateObserver:this.state,range:this.range,dispatch:this.dispatchFromCorePlugin,uuidGenerator:this.uuidGenerator,custom:this.config.custom,external:this.config.external}}setupUiPluginConfig(){return{getters:this.getters,stateObserver:this.state,dispatch:this.dispatch,selection:this.selection,moveClient:this.session.move.bind(this.session),custom:this.config.custom,uiActions:this.config,session:this.session,defaultCurrencyFormat:this.config.defaultCurrencyFormat}}checkDispatchAllowed(e){const t=wo(e)?this.checkDispatchAllowedCoreCommand(e):this.checkDispatchAllowedLocalCommand(e);return t.some((e=>"Success"!==e))?new yo(t.flat()):yo.Success}checkDispatchAllowedCoreCommand(e){const t=this.corePlugins.map((t=>t.allowDispatch(e)));return t.push(this.range.allowDispatch(e)),t}checkDispatchAllowedLocalCommand(e){return this.uiHandlers.map((t=>t.allowDispatch(e)))}finalize(){this.status=3;for(const e of this.handlers)e.finalize();this.status=0}canDispatch=(e,t)=>this.checkDispatchAllowed(MT(e,t));dispatch=(e,t)=>{const o=MT(e,t);let s=this.status;if(this.getters.isReadonly()&&(n=o,!Co.has(n.type)))return new yo("Readonly");var n;if(!this.session.canApplyOptimisticUpdate())return new yo("WaitingSessionConfirmation");switch(s){case 0:const t=this.checkDispatchAllowed(o);if(!t.isSuccessful)return t;this.status=1;const{changes:s,commands:n}=this.state.recordChanges((()=>{wo(o)&&this.state.addCommand(o),this.dispatchToHandlers(this.handlers,o),this.finalize()}));this.session.save(o,n,s),this.status=0,this.trigger("update");break;case 1:if(wo(o)){const e=this.checkDispatchAllowed(o);if(!e.isSuccessful)return e;this.state.addCommand(o)}this.dispatchToHandlers(this.handlers,o);break;case 3:throw new Error("Cannot dispatch commands in the finalize state");case 2:if(wo(o))throw new Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,o)}return yo.Success};dispatchFromCorePlugin=(e,t)=>{const o=MT(e,t),s=this.status;this.status=2;const n=this.isReplayingCommand?this.coreHandlers:this.handlers;return this.dispatchToHandlers(n,o),this.status=s,yo.Success};dispatchToHandlers(e,t){const o=wo(t);for(const s of e)!o&&s instanceof Uy||s.beforeHandle(t);for(const s of e)!o&&s instanceof Uy||s.handle(t)}drawGrid(e){for(let[t,o]of this.renderers)e.ctx.save(),t.drawGrid(e,o),e.ctx.restore()}exportData(){let e=Py();for(let t of this.handlers)t instanceof Uy&&t.export(e);return e.revisionId=this.session.getRevisionId()||ce,e=Te(e),e}updateMode(e){"normal"!==e&&this.dispatch("CANCEL_EDITION"),this.config.mode=e,this.trigger("update")}exportXLSX(){this.dispatch("EVALUATE_CELLS");let e={...Py(),sheets:[ky(Oy,"Sheet1")]};for(let t of this.handlers)t instanceof Vy&&t.exportForExcel(e);return e=Te(e),AT(e)}garbageCollectExternalResources(){for(const e of this.corePlugins)e.garbageCollectExternalResources()}},e.Registry=Hi,e.Revision=EI,e.SPREADSHEET_DIMENSIONS=FT,e.Spreadsheet=AR,e.UIPlugin=Tx,e.__info__=NT,e.addFunction=function e(t,o){return Tf.add(t,o),{addFunction:(t,o)=>e(t,o)}},e.astToFormula=ix,e.compile=ux,e.compileTokens=gx,e.components=kT,e.constants=UT,e.convertAstNodes=tx,e.coreTypes=Eo,e.findCellInNewZone=Mn,e.functionCache=dx,e.helpers=LT,e.hooks=VT,e.invalidateCFEvaluationCommands=So,e.invalidateDependenciesCommands=vo,e.invalidateEvaluationCommands=bo,e.iterateAstNodes=ox,e.links=PT,e.load=_y,e.parse=Jy,e.parseTokens=ex,e.readonlyAllowedCommands=Co,e.registries=DT,e.setDefaultSheetViewSize=function(e){Ee=e},e.setTranslationMethod=function(e,t=(()=>!0)){n=e,i=t},e.tokenize=qr,NT.version="17.0.31",NT.date="2024-07-18T14:22:00.324Z",NT.hash="c64db0d"}(this.o_spreadsheet=this.o_spreadsheet||{},owl);
@@ -1,9 +1,9 @@
1
1
  <!--
2
2
  This file is generated by o-spreadsheet build tools. Do not edit it.
3
3
  @see https://github.com/odoo/o-spreadsheet
4
- @version 17.0.29
5
- @date 2024-07-08T05:41:01.898Z
6
- @hash 2d467e3
4
+ @version 17.0.31
5
+ @date 2024-07-18T14:22:34.937Z
6
+ @hash c64db0d
7
7
  -->
8
8
  <odoo>
9
9
  <t t-name="o-spreadsheet-ActionButton">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odoo/o-spreadsheet",
3
- "version": "17.0.29",
3
+ "version": "17.0.31",
4
4
  "description": "A spreadsheet component",
5
5
  "type": "module",
6
6
  "main": "dist/o-spreadsheet.cjs.js",