@odoo/o-spreadsheet 17.0.58 → 17.0.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/o-spreadsheet.cjs.js +13 -11
- package/dist/o-spreadsheet.esm.js +13 -11
- package/dist/o-spreadsheet.iife.js +13 -11
- package/dist/o-spreadsheet.iife.min.js +3 -3
- package/dist/o_spreadsheet.xml +3 -4
- package/package.json +1 -1
|
@@ -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.
|
|
6
|
-
* @date 2025-04-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.0.59
|
|
6
|
+
* @date 2025-04-25T08:04:05.375Z
|
|
7
|
+
* @hash eb92388
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
'use strict';
|
|
@@ -4857,7 +4857,7 @@ class ChartJsComponent extends owl.Component {
|
|
|
4857
4857
|
// Note: chartJS modify the runtime in place, so it's important to give it a copy
|
|
4858
4858
|
this.createChart(deepCopy(runtime.chartJsConfig));
|
|
4859
4859
|
});
|
|
4860
|
-
owl.useEffect(() => this.updateChartJs(deepCopy(this.chartRuntime)), () => [this.chartRuntime]);
|
|
4860
|
+
owl.useEffect(() => this.updateChartJs(deepCopy(this.chartRuntime)), () => [this.chartRuntime, window.devicePixelRatio]);
|
|
4861
4861
|
}
|
|
4862
4862
|
createChart(chartData) {
|
|
4863
4863
|
const canvas = this.canvas.el;
|
|
@@ -5395,8 +5395,10 @@ let ScorecardChart$1 = class ScorecardChart extends AbstractChart {
|
|
|
5395
5395
|
};
|
|
5396
5396
|
function drawScoreChart(structure, canvas) {
|
|
5397
5397
|
const ctx = canvas.getContext("2d");
|
|
5398
|
-
|
|
5399
|
-
canvas.
|
|
5398
|
+
const dpr = window.devicePixelRatio || 1;
|
|
5399
|
+
canvas.width = structure.canvas.width * dpr;
|
|
5400
|
+
canvas.height = structure.canvas.height * dpr;
|
|
5401
|
+
ctx.scale(dpr, dpr);
|
|
5400
5402
|
ctx.fillStyle = structure.canvas.backgroundColor;
|
|
5401
5403
|
ctx.fillRect(0, 0, structure.canvas.width, structure.canvas.height);
|
|
5402
5404
|
if (structure.title) {
|
|
@@ -5745,7 +5747,7 @@ class ScorecardChart extends owl.Component {
|
|
|
5745
5747
|
owl.useEffect(this.createChart.bind(this), () => {
|
|
5746
5748
|
const canvas = this.canvas.el;
|
|
5747
5749
|
const rect = canvas.getBoundingClientRect();
|
|
5748
|
-
return [rect.width, rect.height, this.runtime, this.canvas.el];
|
|
5750
|
+
return [rect.width, rect.height, this.runtime, this.canvas.el, window.devicePixelRatio];
|
|
5749
5751
|
});
|
|
5750
5752
|
}
|
|
5751
5753
|
createChart() {
|
|
@@ -22383,7 +22385,7 @@ class ColorPicker extends owl.Component {
|
|
|
22383
22385
|
}
|
|
22384
22386
|
setHexColor(ev) {
|
|
22385
22387
|
// only support HEX code input
|
|
22386
|
-
const val = ev.target.value.slice(0, 7);
|
|
22388
|
+
const val = ev.target.value.replace("##", "#").slice(0, 7);
|
|
22387
22389
|
this.state.customHexColor = val;
|
|
22388
22390
|
if (!isColorValid(val)) ;
|
|
22389
22391
|
else {
|
|
@@ -58254,6 +58256,6 @@ exports.setTranslationMethod = setTranslationMethod;
|
|
|
58254
58256
|
exports.tokenize = tokenize;
|
|
58255
58257
|
|
|
58256
58258
|
|
|
58257
|
-
__info__.version = "17.0.
|
|
58258
|
-
__info__.date = "2025-04-
|
|
58259
|
-
__info__.hash = "
|
|
58259
|
+
__info__.version = "17.0.59";
|
|
58260
|
+
__info__.date = "2025-04-25T08:04:05.375Z";
|
|
58261
|
+
__info__.hash = "eb92388";
|
|
@@ -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.
|
|
6
|
-
* @date 2025-04-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.0.59
|
|
6
|
+
* @date 2025-04-25T08:04:05.375Z
|
|
7
|
+
* @hash eb92388
|
|
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';
|
|
@@ -4855,7 +4855,7 @@ class ChartJsComponent extends Component {
|
|
|
4855
4855
|
// Note: chartJS modify the runtime in place, so it's important to give it a copy
|
|
4856
4856
|
this.createChart(deepCopy(runtime.chartJsConfig));
|
|
4857
4857
|
});
|
|
4858
|
-
useEffect(() => this.updateChartJs(deepCopy(this.chartRuntime)), () => [this.chartRuntime]);
|
|
4858
|
+
useEffect(() => this.updateChartJs(deepCopy(this.chartRuntime)), () => [this.chartRuntime, window.devicePixelRatio]);
|
|
4859
4859
|
}
|
|
4860
4860
|
createChart(chartData) {
|
|
4861
4861
|
const canvas = this.canvas.el;
|
|
@@ -5393,8 +5393,10 @@ let ScorecardChart$1 = class ScorecardChart extends AbstractChart {
|
|
|
5393
5393
|
};
|
|
5394
5394
|
function drawScoreChart(structure, canvas) {
|
|
5395
5395
|
const ctx = canvas.getContext("2d");
|
|
5396
|
-
|
|
5397
|
-
canvas.
|
|
5396
|
+
const dpr = window.devicePixelRatio || 1;
|
|
5397
|
+
canvas.width = structure.canvas.width * dpr;
|
|
5398
|
+
canvas.height = structure.canvas.height * dpr;
|
|
5399
|
+
ctx.scale(dpr, dpr);
|
|
5398
5400
|
ctx.fillStyle = structure.canvas.backgroundColor;
|
|
5399
5401
|
ctx.fillRect(0, 0, structure.canvas.width, structure.canvas.height);
|
|
5400
5402
|
if (structure.title) {
|
|
@@ -5743,7 +5745,7 @@ class ScorecardChart extends Component {
|
|
|
5743
5745
|
useEffect(this.createChart.bind(this), () => {
|
|
5744
5746
|
const canvas = this.canvas.el;
|
|
5745
5747
|
const rect = canvas.getBoundingClientRect();
|
|
5746
|
-
return [rect.width, rect.height, this.runtime, this.canvas.el];
|
|
5748
|
+
return [rect.width, rect.height, this.runtime, this.canvas.el, window.devicePixelRatio];
|
|
5747
5749
|
});
|
|
5748
5750
|
}
|
|
5749
5751
|
createChart() {
|
|
@@ -22381,7 +22383,7 @@ class ColorPicker extends Component {
|
|
|
22381
22383
|
}
|
|
22382
22384
|
setHexColor(ev) {
|
|
22383
22385
|
// only support HEX code input
|
|
22384
|
-
const val = ev.target.value.slice(0, 7);
|
|
22386
|
+
const val = ev.target.value.replace("##", "#").slice(0, 7);
|
|
22385
22387
|
this.state.customHexColor = val;
|
|
22386
22388
|
if (!isColorValid(val)) ;
|
|
22387
22389
|
else {
|
|
@@ -58217,6 +58219,6 @@ const constants = {
|
|
|
58217
58219
|
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 };
|
|
58218
58220
|
|
|
58219
58221
|
|
|
58220
|
-
__info__.version = "17.0.
|
|
58221
|
-
__info__.date = "2025-04-
|
|
58222
|
-
__info__.hash = "
|
|
58222
|
+
__info__.version = "17.0.59";
|
|
58223
|
+
__info__.date = "2025-04-25T08:04:05.375Z";
|
|
58224
|
+
__info__.hash = "eb92388";
|
|
@@ -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.
|
|
6
|
-
* @date 2025-04-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.0.59
|
|
6
|
+
* @date 2025-04-25T08:04:05.375Z
|
|
7
|
+
* @hash eb92388
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
(function (exports, owl) {
|
|
@@ -4856,7 +4856,7 @@
|
|
|
4856
4856
|
// Note: chartJS modify the runtime in place, so it's important to give it a copy
|
|
4857
4857
|
this.createChart(deepCopy(runtime.chartJsConfig));
|
|
4858
4858
|
});
|
|
4859
|
-
owl.useEffect(() => this.updateChartJs(deepCopy(this.chartRuntime)), () => [this.chartRuntime]);
|
|
4859
|
+
owl.useEffect(() => this.updateChartJs(deepCopy(this.chartRuntime)), () => [this.chartRuntime, window.devicePixelRatio]);
|
|
4860
4860
|
}
|
|
4861
4861
|
createChart(chartData) {
|
|
4862
4862
|
const canvas = this.canvas.el;
|
|
@@ -5394,8 +5394,10 @@
|
|
|
5394
5394
|
};
|
|
5395
5395
|
function drawScoreChart(structure, canvas) {
|
|
5396
5396
|
const ctx = canvas.getContext("2d");
|
|
5397
|
-
|
|
5398
|
-
canvas.
|
|
5397
|
+
const dpr = window.devicePixelRatio || 1;
|
|
5398
|
+
canvas.width = structure.canvas.width * dpr;
|
|
5399
|
+
canvas.height = structure.canvas.height * dpr;
|
|
5400
|
+
ctx.scale(dpr, dpr);
|
|
5399
5401
|
ctx.fillStyle = structure.canvas.backgroundColor;
|
|
5400
5402
|
ctx.fillRect(0, 0, structure.canvas.width, structure.canvas.height);
|
|
5401
5403
|
if (structure.title) {
|
|
@@ -5744,7 +5746,7 @@
|
|
|
5744
5746
|
owl.useEffect(this.createChart.bind(this), () => {
|
|
5745
5747
|
const canvas = this.canvas.el;
|
|
5746
5748
|
const rect = canvas.getBoundingClientRect();
|
|
5747
|
-
return [rect.width, rect.height, this.runtime, this.canvas.el];
|
|
5749
|
+
return [rect.width, rect.height, this.runtime, this.canvas.el, window.devicePixelRatio];
|
|
5748
5750
|
});
|
|
5749
5751
|
}
|
|
5750
5752
|
createChart() {
|
|
@@ -22382,7 +22384,7 @@
|
|
|
22382
22384
|
}
|
|
22383
22385
|
setHexColor(ev) {
|
|
22384
22386
|
// only support HEX code input
|
|
22385
|
-
const val = ev.target.value.slice(0, 7);
|
|
22387
|
+
const val = ev.target.value.replace("##", "#").slice(0, 7);
|
|
22386
22388
|
this.state.customHexColor = val;
|
|
22387
22389
|
if (!isColorValid(val)) ;
|
|
22388
22390
|
else {
|
|
@@ -58253,9 +58255,9 @@
|
|
|
58253
58255
|
exports.tokenize = tokenize;
|
|
58254
58256
|
|
|
58255
58257
|
|
|
58256
|
-
__info__.version = "17.0.
|
|
58257
|
-
__info__.date = "2025-04-
|
|
58258
|
-
__info__.hash = "
|
|
58258
|
+
__info__.version = "17.0.59";
|
|
58259
|
+
__info__.date = "2025-04-25T08:04:05.375Z";
|
|
58260
|
+
__info__.hash = "eb92388";
|
|
58259
58261
|
|
|
58260
58262
|
|
|
58261
58263
|
})(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",y="#666666",w="#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",V="#BCBCBC",k="#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=3,j=Z,X=21,K=17,Q=2*G,J=250,ee={align:"left",verticalAlign:"bottom",wrapping:"overflow",bold:!1,italic:!1,strikethrough:!1,underline:!1,fontSize:10,fillColor:"",textColor:""},te=ee.verticalAlign,oe=ee.wrapping,se="400",ne=ee.fontSize,ie="'Roboto', arial",re="thin",ae="#000000",le={style:"thin",color:_},ce=c.InvalidReference,he="START_REVISION",de=1,ue=20,ge="??",pe="difference",me="#00A04A",fe="#DC6965",be=["'","*","?","/","\\","[","]"],ve=/'|\*|\?|\/|\\|\[|\]/,Se="|",Ce=a("Invalid expression");var Ee;!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"}(Ee||(Ee={}));let ye=0;function we(){return ye}const xe="\n",Ie=[6,7,8,9,10,11,12,14,18,24,36];function Re(e){return'"'===e[0]&&(e=e.slice(1)),'"'===e[e.length-1]&&"\\"!==e[e.length-2]?e.slice(0,e.length-1):e}function Te(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ae(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]=Ae(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 Oe(e){return e.startsWith("'")&&(e=e.slice(1,-1).replace(/''/g,"'")),e}function _e(e){return e.match(/\w/g)?.length!==e.length&&(e=`'${e}'`),e}function Me(e,t,o){return e<t?t:e>o?o:e}function Ne(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 Fe(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*De(e,t){t.next();for(const o of e){const e=t.next();yield{...o,next:e.done?void 0:e.value}}}const Le=/^\[(.+)\]\((.+)\)$/,Pe=/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$/;function Ve(e){return Le.test(e)}function ke(e){return Pe.test(e)}function Ue(e,t){return`[${e}](${t})`}function Be(e){const t=e.match(Le)||[],o=t[1],s=t[2];if(!o||!s)throw new Error(`Could not parse markdown link ${e}.`);return{label:o,url:s}}const He="o-spreadsheet://";function ze(e){return e.startsWith(He)}function Ge(e){return`${He}${e}`}function $e(e){if(e.startsWith(He))return e.substr(He.length);throw new Error(`${e} is not a valid sheet link`)}function We(e){return void 0!==e}function qe(e){return null!==e}function Ze(e){return void 0===e||Object.values(e).every((e=>"object"==typeof e?Ze(e):!e))}function Ye(e,t){for(const o in t)if(Je(t[o],e))return parseInt(o,10);const o=Object.keys(t),s=0===o.length?0:ut(o.map((e=>parseInt(e,10))));return t[s+1]=e,s+1}function je(e){let t="";for(let o=0,s=e.length;o<s;o++)t+=e[o];return t}function Xe(e){let t,o=!1;const s=()=>(o||(t=e instanceof Function?e():e,o=!0),t);return s.map=e=>Xe((()=>e(s()))),s}function Ke(e,t){let o=e.slice(t).find((e=>e));return o||(o=e.slice(0,t).reverse().find((e=>e))),o||""}function Qe(e,t){return"after"===e?t+1:t}function Je(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(!Je(e[o],t[o]))return!1}else if(e[o]!==t[o])return!1}return!0}function et(e,t){if(e.length<t.length)return!1;const o=new Set(e);return t.every((e=>o.has(e)))}function tt(e){const t={...e};return Object.keys(t).forEach((e=>!t[e]&&delete t[e])),t}const ot=["\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))],st=new RegExp(ot.join("|"),"g"),nt=/(\r\n|\r)/g;function it(e){return e?e.replace(nt,xe):""}function rt(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 at 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 lt(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 ct(e,t){return e.filter(((e,o)=>!t.includes(o)))}function ht(e){return e.split("\n").map((e=>e.replace(/\s+/g," ").trim())).join("\n")}function dt(e,t,o){return t>o?dt(e,o,t):e>=t&&e<=o}function ut(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 gt(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 pt=/rgba?\(|\s+|\)/gi,mt=/^#([A-F\d]{2}){3,4}$/,ft=["#eb6d00","#0074d9","#ad8e00","#169ed4","#b10dc9","#00a82d","#00a3a3","#f012be","#3d9970","#111111","#62A300","#ff4136","#949494","#85144b","#001f3f"];function bt(e){return vt(e.toString(16).padStart(6,"0"))}function vt(e){let t=e;if(e.startsWith("rgb")?t=function(e){const t=e.replace(pt,"").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");if(isNaN(e))throw new Error("invalid alpha value");o=Math.round(255*e)}const s=t.map((e=>parseInt(e,10)));255!==o&&s.push(o);return"#"+je(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}`),!mt.test(t))throw new Error(`invalid color input: ${e}`);return t}function St(e){try{return vt(e),!0}catch(e){return!1}}const Ct=e=>e>=0&&e<=255;function Et(e,t,o,s=1){if(!Ct(e)||!Ct(t)||!Ct(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 yt(e){let{r:t,g:o,b:s}=xt(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 wt(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 xt(e){let t,o,s,n;if(7===(e=vt(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 It(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 Rt(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 Tt(e){return wt(It(e))}function At(e){return Rt(xt(e))}function Ot(e){if(e<0)throw new Error(`number must be positive. Got ${e}`);return e<26?String.fromCharCode(65+e):Ot(Math.floor(e/26)-1)+Ot(e%26)}const _t={};for(const QT of"ABCDEFGHIJKLMNOPQRSTUVWXYZ"){const JT=QT.charCodeAt(0)-64;_t[QT]=JT,_t[QT.toLowerCase()]=JT}function Mt(e){let t=-1;let o=1;for(let s=e.length-1;s>=0;s--){t+=_t[e[s]]*o,o*=26}return t}function Nt(e){return e>="A"&&e<="Z"||e>="a"&&e<="z"}function Ft(e){return e>="0"&&e<="9"}function Dt(e){let t;e=e.trim();for(let o=0;o<e.length;o++){const s=e[o];if(!t){if("$"===s&&0===o||Nt(s))continue;t=o}if(!Ft(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=Mt(o),i=Number(s)-1;if(isNaN(i))throw new Error(`Invalid cell description: ${e}`);return{col:n,row:i}}function Lt(e,t,o={colFixed:!1,rowFixed:!1}){return(o.colFixed?"$":"")+Ot(e)+(o.rowFixed?"$":"")+String(t+1)}class Pt{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 Pt(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds())}static now(){const e=new Date;return new Pt(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 Vt=new Pt(1899,11,30),kt=864e5,Ut=2e3,Bt=Pt.now().getFullYear(),Ht=Pt.now().getMonth(),zt=Pt.fromTimestamp(0).getTime()-Vt.getTime(),Gt=/^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/,$t=/^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/,Wt=/\/|-|\s/,qt=/^(\d{1,4})[\/-\s](\d{1,4})([\/-\s](\d{1,4}))?$/,Zt=/((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;function Yt(e,t){switch(typeof e){case"number":return e;case"string":return jt(e,t)?Kt(e,t)?.value:!e||isNaN(Number(e))?void 0:Number(e);default:return}}function jt(e,t){return null!==Kt(e,t)}const Xt=new Map;function Kt(e,t){return Xt.has(t)||Xt.set(t,new Map),Xt.get(t).has(e)||Xt.get(t).set(e,function(e,t){e=e.trim();let o=null;const s=e.match(Zt);if(s){if(o=function(e){if(e=e.trim(),Zt.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 Pt(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(qt);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(Wt)[0];if(n=function(e,t){let{year:o,month:s,day:n}=e;const i=function(e){if(!e)return Ht;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 Bt;const t=Number(e);switch(e.length){case 1:return Ut+t;case 2:return Ut+(Ut+t>Bt+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 Pt(a,i,r);if(h.getMonth()!==i||h.getDate()!==r)return null;const d=h.getTime()-Vt.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(We).join(t);case"ymd":return[n,i,r].filter(We).join(t);case"dmy":return[r,i,n].filter(We).join(t)}}(e,t,l,c);return{value:Math.round(d/kt),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 Pt(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)),Xt.get(t).get(e)}function Qt(e){const t=Math.trunc(e);let o=Pt.fromTimestamp(t*kt-zt),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 Jt(e){return Math.round(eo(e))}function eo(e){return(e.getTime()-Vt.getTime())/kt}function to(e){return new Pt(e.getFullYear(),e.getMonth()+1,0).getDate()}function oo(e){return to(e)===e.getDate()}function so(e,t,o){const s=e.getFullYear(),n=e.getMonth(),i=e.getDate(),r=new Pt(s,n+t,1);return o&&i===to(e)||i>to(r)?r.setDate(to(r)):r.setDate(i),r}function no(e){const t=Math.trunc(e);return t%4==0&&t%100!=0||t%400==0}function io(e,t,o){if(e===t)return 0;if(e>t){const o=t;t=e,e=o}const s=Qt(e),n=Qt(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===(no(c)?29:28)&&(i=30,1===l&&r===(no(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+=no(o)?366:365;o=t/e}else s?no(c)&&(o=366):(no(c)&&a<2&&(o=366),no(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 ro(e,t){const o=12*(t.getFullYear()-e.getFullYear())+t.getMonth()-e.getMonth();return e.getDate()>t.getDate()?o-1:o}function ao(e,t){const o=e.getTime(),s=t.getTime();return Math.floor((s-o)/kt)}function lo(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 co(e,t,o){return t>o?co(e,o,t):(e=Math.trunc(e),t=Math.trunc(t),o=Math.trunc(o),e>=t&&e<=o)}const ho=lt((function(e){return e=Te(e),new RegExp(`(^-?\\d+(${e}?\\d*(e\\d+)?)?|^-?${e}\\d+)(?!\\w|!)`)})),uo=lt((function(e){const t=Te(e.decimalSeparator),o="(\\s*"+`(\\d+(${Te(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 go(e,t){return!!e&&uo(t).test(e.trim())}const po=lt((function(e){return new RegExp(`[$€${Te(e.thousandsSeparator||"")}]`,"g")}));function mo(e,t){e=e.replace(po(t),""),"."!==t.decimalSeparator&&(e=e.replace(t.decimalSeparator,"."));let o=Number(e);return isNaN(o)&&e.includes("%")&&(o=Number(e.split("%")[0]),!isNaN(o))?o/100:o}function fo(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 bo,vo;!function(e){e.boolean="boolean",e.number="number",e.text="text",e.empty="empty",e.error="error"}(bo||(bo={})),function(e){e.PlainText="text/plain",e.Html="text/html"}(vo||(vo={}));const So=new Set(["RENAME_SHEET","DELETE_SHEET","CREATE_SHEET","ADD_COLUMNS_ROWS","REMOVE_COLUMNS_ROWS","UNDO","REDO","ADD_MERGE","DUPLICATE_SHEET","UPDATE_LOCALE"]),Co=new Set([...So,"MOVE_RANGES"]),Eo=new Set([...So,"EVALUATE_CELLS","ADD_CONDITIONAL_FORMAT","REMOVE_CONDITIONAL_FORMAT","CHANGE_CONDITIONAL_FORMAT_PRIORITY"]),yo=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"]),wo=new Set(["UPDATE_CELL","UPDATE_CELL_POSITION","CLEAR_CELL","CLEAR_CELLS","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","SET_BORDERS_ON_TARGET","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 xo(e){return wo.has(e.type)}class Io{reasons;constructor(e=[]){Array.isArray(e)||(e=[e]),e=[...new Set(e)],this.reasons=e.filter((e=>"Success"!==e))}static get Success(){return Ro}get isSuccessful(){return 0===this.reasons.length}isCancelledBecause(e){return this.reasons.includes(e)}}const Ro=new Io;var To;e.CommandResult=void 0,(To=e.CommandResult||(e.CommandResult={})).Success="Success",To.CancelledForUnknownReason="CancelledForUnknownReason",To.WillRemoveExistingMerge="WillRemoveExistingMerge",To.MergeIsDestructive="MergeIsDestructive",To.CellIsMerged="CellIsMerged",To.InvalidTarget="InvalidTarget",To.EmptyUndoStack="EmptyUndoStack",To.EmptyRedoStack="EmptyRedoStack",To.NotEnoughElements="NotEnoughElements",To.NotEnoughSheets="NotEnoughSheets",To.MissingSheetName="MissingSheetName",To.UnchangedSheetName="UnchangedSheetName",To.DuplicatedSheetName="DuplicatedSheetName",To.DuplicatedSheetId="DuplicatedSheetId",To.ForbiddenCharactersInSheetName="ForbiddenCharactersInSheetName",To.WrongSheetMove="WrongSheetMove",To.WrongSheetPosition="WrongSheetPosition",To.InvalidAnchorZone="InvalidAnchorZone",To.SelectionOutOfBound="SelectionOutOfBound",To.TargetOutOfSheet="TargetOutOfSheet",To.WrongCutSelection="WrongCutSelection",To.WrongPasteSelection="WrongPasteSelection",To.WrongPasteOption="WrongPasteOption",To.WrongFigurePasteOption="WrongFigurePasteOption",To.EmptyClipboard="EmptyClipboard",To.EmptyRange="EmptyRange",To.InvalidRange="InvalidRange",To.InvalidZones="InvalidZones",To.InvalidSheetId="InvalidSheetId",To.InvalidCellId="InvalidCellId",To.InvalidFigureId="InvalidFigureId",To.InputAlreadyFocused="InputAlreadyFocused",To.MaximumRangesReached="MaximumRangesReached",To.MinimumRangesReached="MinimumRangesReached",To.InvalidChartDefinition="InvalidChartDefinition",To.InvalidDataSet="InvalidDataSet",To.InvalidLabelRange="InvalidLabelRange",To.InvalidScorecardKeyValue="InvalidScorecardKeyValue",To.InvalidScorecardBaseline="InvalidScorecardBaseline",To.InvalidGaugeDataRange="InvalidGaugeDataRange",To.EmptyGaugeRangeMin="EmptyGaugeRangeMin",To.GaugeRangeMinNaN="GaugeRangeMinNaN",To.EmptyGaugeRangeMax="EmptyGaugeRangeMax",To.GaugeRangeMaxNaN="GaugeRangeMaxNaN",To.GaugeRangeMinBiggerThanRangeMax="GaugeRangeMinBiggerThanRangeMax",To.GaugeLowerInflectionPointNaN="GaugeLowerInflectionPointNaN",To.GaugeUpperInflectionPointNaN="GaugeUpperInflectionPointNaN",To.GaugeLowerBiggerThanUpper="GaugeLowerBiggerThanUpper",To.InvalidAutofillSelection="InvalidAutofillSelection",To.WrongComposerSelection="WrongComposerSelection",To.MinBiggerThanMax="MinBiggerThanMax",To.LowerBiggerThanUpper="LowerBiggerThanUpper",To.MidBiggerThanMax="MidBiggerThanMax",To.MinBiggerThanMid="MinBiggerThanMid",To.FirstArgMissing="FirstArgMissing",To.SecondArgMissing="SecondArgMissing",To.MinNaN="MinNaN",To.MidNaN="MidNaN",To.MaxNaN="MaxNaN",To.ValueUpperInflectionNaN="ValueUpperInflectionNaN",To.ValueLowerInflectionNaN="ValueLowerInflectionNaN",To.MinInvalidFormula="MinInvalidFormula",To.MidInvalidFormula="MidInvalidFormula",To.MaxInvalidFormula="MaxInvalidFormula",To.ValueUpperInvalidFormula="ValueUpperInvalidFormula",To.ValueLowerInvalidFormula="ValueLowerInvalidFormula",To.InvalidSortZone="InvalidSortZone",To.WaitingSessionConfirmation="WaitingSessionConfirmation",To.MergeOverlap="MergeOverlap",To.TooManyHiddenElements="TooManyHiddenElements",To.Readonly="Readonly",To.InvalidViewportSize="InvalidViewportSize",To.InvalidScrollingDirection="InvalidScrollingDirection",To.FigureDoesNotExist="FigureDoesNotExist",To.InvalidConditionalFormatId="InvalidConditionalFormatId",To.InvalidCellPopover="InvalidCellPopover",To.EmptyTarget="EmptyTarget",To.InvalidFreezeQuantity="InvalidFreezeQuantity",To.FrozenPaneOverlap="FrozenPaneOverlap",To.ValuesNotChanged="ValuesNotChanged",To.InvalidFilterZone="InvalidFilterZone",To.FilterOverlap="FilterOverlap",To.FilterNotFound="FilterNotFound",To.MergeInFilter="MergeInFilter",To.NonContinuousTargets="NonContinuousTargets",To.DuplicatedFigureId="DuplicatedFigureId",To.InvalidSelectionStep="InvalidSelectionStep",To.DuplicatedChartId="DuplicatedChartId",To.ChartDoesNotExist="ChartDoesNotExist",To.InvalidHeaderIndex="InvalidHeaderIndex",To.InvalidQuantity="InvalidQuantity",To.MoreThanOneColumnSelected="MoreThanOneColumnSelected",To.EmptySplitSeparator="EmptySplitSeparator",To.SplitWillOverwriteContent="SplitWillOverwriteContent",To.NoSplitSeparatorInSelection="NoSplitSeparatorInSelection",To.NoActiveSheet="NoActiveSheet",To.InvalidLocale="InvalidLocale",To.AlreadyInPaintingFormatMode="AlreadyInPaintingFormatMode",To.MoreThanOneRangeSelected="MoreThanOneRangeSelected",To.NoColumnsProvided="NoColumnsProvided",To.ColumnsNotIncludedInZone="ColumnsNotIncludedInZone",To.DuplicatesColumnsSelected="DuplicatesColumnsSelected",To.InvalidHeaderGroupStartEnd="InvalidHeaderGroupStartEnd",To.HeaderGroupAlreadyExists="HeaderGroupAlreadyExists",To.UnknownHeaderGroup="UnknownHeaderGroup",To.UnknownDataValidationRule="UnknownDataValidationRule",To.UnknownDataValidationCriterionType="UnknownDataValidationCriterionType",To.InvalidDataValidationCriterionValue="InvalidDataValidationCriterionValue",To.InvalidNumberOfCriterionValues="InvalidNumberOfCriterionValues",To.BlockingValidationRule="BlockingValidationRule",To.InvalidCopyPasteSelection="InvalidCopyPasteSelection",To.NoChanges="NoChanges",To.InvalidInputId="InvalidInputId";const Ao=[{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:";"}],Oo=Ao[0],_o=["thin","medium","thick","dashed","dotted"];function Mo(e){return Array.isArray(e)&&Array.isArray(e[0])}var No,Fo;!function(e){e.UP="up",e.DOWN="down",e.LEFT="left",e.RIGHT="right"}(No||(No={})),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"}(Fo||(Fo={}));const Do=["number","string","boolean","undefined"];function Lo(e,t){if(!e())throw new d(c.GenericError,t)}const Po=e=>a("The function [[FUNCTION_NAME]] expects a number value, but '%s' is a string, and cannot be coerced to a number.",e);function Vo(e,t){switch(typeof e){case"number":return e;case"boolean":return e?1:0;case"string":if(go(e,t)||""===e)return mo(e,t);const o=Kt(e,t);if(o)return o.value;throw new Error(Po(e));default:return 0}}function ko(e,t){try{return Vo(e,t)}catch(e){return}}function Uo(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 Bo(e,t){if(""===e)throw new Error(Po(e));return Vo(e,t)}function Ho(e,t){return Math.trunc(Vo(e,t))}function zo(e,t){return Math.trunc(Bo(e,t))}function Go(e){Lo((()=>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 $o(e){switch(typeof e){case"string":return e;case"number":return e.toString();case"boolean":return e?"TRUE":"FALSE";default:return""}}const Wo=lt((function(e){return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"")})),qo=e=>a("The function [[FUNCTION_NAME]] expects a boolean value, but '%s' is a text, and cannot be coerced to a number.",e);function Zo(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(qo(e))}return!1;case"number":return!!e;default:return!1}}function Yo(e,t){return Qt(Vo(e,t))}function jo(e,t,o){for(let s of e)if(Mo(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 Xo(e,t){jo(e,t,t)}function Ko(e,t,o){jo(e,(e=>{"number"==typeof e&&t(e)}),(e=>{t(Bo(e,o))}))}function Qo(e,t,o,s,n="rowFirst"){let i=s;for(let s of e)if(Mo(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 Jo(e,t,o,s="rowFirst"){return Qo(e,t,t,o,s)}function es(e,t,o,s){return Qo(e,((e,o)=>"number"==typeof o?t(e,o):e),((e,o)=>t(e,Bo(o,s))),o)}function ts(e,t,o,s){return Qo(e,((e,o)=>null!=o?t(e,"number"==typeof o?o:"boolean"==typeof o?Vo(o,s):0):e),((e,o)=>t(e,Vo(o,s))),o)}function os(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 ss(e,t){return 0===e.length?[]:os(e.length,e[0].length,((o,s)=>t(e[o][s])))}function ns(e){return e.length?os(e[0].length,e.length,((t,o)=>e[o][t])):[]}function is(e,t){return function(e,t,o){for(let s of e)if(Mo(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(qo(e));return Zo(e)}(e))))}function rs(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)),go(n,o)||jt(n,o)?n=Vo(n,o):"TRUE"!==n&&"FALSE"!==n||(n=Zo(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 as(e="",t,o){const{operator:s,operand:n}=t;if(void 0===n||null===e||null===n)return!1;if("number"==typeof n&&"="===s)return"string"==typeof e&&(go(e,o)||jt(e,o))?Vo(e,o)===n:e===n;if("<>"===s||"="===s){let o;return o=typeof e==typeof n&&("string"==typeof e&&t.regexp?t.regexp.test(e):e===n),"="===s?o:!o}if(typeof e==typeof n)switch(s){case"<":return e<n;case">":return e>n;case"<=":return e<=n;case">=":return e>=n}return!1}function ls(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(!Mo(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=$o(e[t+1]);l.push(rs(c,s,o))}for(let s=0;s<i;s++)for(let i=0;i<r;i++){let r=!0;for(let t=0;t<n-1;t+=2){if(r=as(e[t][s][i]??void 0,l[t/2],o),!r)break}r&&t(s,i)}}function cs(e,t,o,s,n,i){if(null==t)return-1;const r=ds(t),a=typeof r;let l,c,h,d,u,g,p=0,m=n-1;const f="desc"===s?t=>ds(i(e,n-t-1)):t=>ds(i(e,t));for(;m-p>=0;){for(h=Math.floor((p+m)/2),d=h,u=f(d),g=typeof u;p<d&&a!==g;)d--,u=f(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&&c<d)&&(l=u,c=d):"nextGreater"===o&&u>=r&&(void 0===l||l>u||l===u&&c<d)&&(l=u,c=d),u>r||"strict"===o&&u===r?m=d-1:p=h+1):p=h+1}return void 0===c?-1:"desc"===s?n-c-1:c}function hs(e,t,o,s,n,i=!1){if(null==t)return-1;const r=ds(t),a=i?(e,t)=>n(e,s-t-1):n;let l,c=-1;for(let t=0;t<s;t++){const n=ds(a(e,t));if(n===r)return i?s-t-1:t;"nextSmaller"===o?(!l&&us(r,n)>=0||us(r,n)>=0&&us(n,l)>0)&&(l=n,c=t):"nextGreater"===o&&(!l&&us(r,n)<=0||us(r,n)<=0&&us(n,l)<0)&&(l=n,c=t)}return i&&-1!==c?s-c-1:c}function ds(e){return"string"==typeof e?Wo(e):e}function us(e,t){let o=Do.indexOf(typeof e)-Do.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 gs(e){return void 0===e?[[]]:Mo(e)?e:[[e]]}function ps(e,t){return Jo(e,((e,o)=>(e.push(t(o)),e)),[],"rowFirst")}function ms(e){const t=Pt.now();switch(e){case"today":return eo(t);case"yesterday":return eo(Pt.fromTimestamp(t.setDate(t.getDate()-1)));case"tomorrow":return eo(Pt.fromTimestamp(t.setDate(t.getDate()+1)));case"lastWeek":return eo(Pt.fromTimestamp(t.setDate(t.getDate()-7)));case"lastMonth":return eo(Pt.fromTimestamp(t.setMonth(t.getMonth()-1)));case"lastYear":return eo(Pt.fromTimestamp(t.setFullYear(t.getFullYear()-1)))}}function fs(e,t){return"dateValue"in e&&"exactDate"!==e.dateValue?[ms(e.dateValue)]:e.values.map((e=>Yt(e,t)))}function bs(e,t){return e.values.map((e=>ko(e,t)))}function vs(e){return 20+120*Math.exp(-.035*(e-1))}const Ss=20,Cs=11,Es=/(\d+?)(?=(\d{3})+(?!\d)|$)/g,ys=/0/g,ws={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")},xs={0:a("Sunday"),1:a("Monday"),2:a("Tuesday"),3:a("Wednesday"),4:a("Thursday"),5:a("Friday"),6:a("Saturday")},Is={};function Rs(e){let t=Is[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);Ds(i)?o.push({type:"DATE",format:i}):o.push({type:"NUMBER",format:js(i)})}t=s}return o}(e),Is[e]=t),t}function Ts(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=Bs(e));return function(e,t,o){if("DATE"===t[0].type)return Ps(e,t[0].format);let s=e<0?"-":"";for(let n of t)switch(n.type){case"NUMBER":s+=As(Math.abs(e),n.format,o);break;case"STRING":s+=n.format}return s}(e,Rs(t),o);case"object":return"0"}}function As(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}=_s(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(ys)||[]).length;n="0".repeat(e)+n}o&&(n=n.match(Es)?.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(ys)||[]).length;o+="0".repeat(s)}return o}(i||"",t.decimalPart)),t.isPercent&&(r+="%"),r}const Os=[];function _s(e,t=Ss){const o=e.toString();if(o.includes("e"))return function(e,t=Ss){let o=Os[t];o||(o=new Intl.NumberFormat("en-US",{maximumFractionDigits:t,useGrouping:!1}),Os[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(Ns)?.[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:Ms(i||"")}}function Ms(e){let t=e.length-1;for(;t>=0&&"0"===e[t];)t--;return e.slice(0,t+1)||void 0}const Ns=/^0+/;function Fs(e,t){const{integerDigits:o,decimalDigits:s}=_s(e,20);return s?o+t+s:o}function Ds(e){if(!Ls.has(e[0]))return!1;try{return Ps(1,e),!0}catch(e){return!1}}const Ls=new Set(["h","m","y","d"]);function Ps(e,t){const o=Qt(e),s=t.indexOf("h");let n="",i="";return s>0?(n=Vs(o,t.substring(0,s-1)),i=ks(o,t.substring(s))):0===s?i=ks(o,t):s<0&&(n=Vs(o,t)),n+(n&&i?" ":"")+i}function Vs(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 xs[e.getDay()].slice(0,3);case"dddd":return xs[e.getDay()];case"m":return e.getMonth()+1;case"mm":return String(e.getMonth()+1).padStart(2,"0");case"mmm":return ws[e.getMonth()].slice(0,3);case"mmmm":return ws[e.getMonth()];case"mmmmm":return ws[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 ks(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()-Vt.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 Us=lt((function(e){return new RegExp(`[0-9]+${Te(e.decimalSeparator)}[0-9]`)}));function Bs(e){let{integerDigits:t,decimalDigits:o}=_s(e);if(!o)return"0";const s=t.replace("-","").length;if(s+2>Cs)return"0";const n=Cs-s-1;return({decimalDigits:o}=_s(e,Math.min(n,o.length))),o?"0."+"0".repeat(o.length):"0"}function Hs(e,t){if(!jt(e,t))return;return Kt(e,t).format}function zs(e){if(!go(e,Oo))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 Gs(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 $s(e){return Ks(Rs(e).map((e=>"NUMBER"===e.type?{type:e.type,format:{...e.format,decimalPart:void 0}}:e)))}function Ws(e,t,o,s){const n=Rs(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 Ks(i)}function qs(e,t,o){const s=Rs(e).map((e=>"NUMBER"===e.type?{...e,format:Zs(e.format,t)}:e)),n=Ks(s);return Is[n]=s,n}function Zs(e,t){const o={...e},s=Math.sign(t),n=o.decimalPart?.length||0,i=Math.min(Math.max(0,n+s),Ss);return o.decimalPart="0".repeat(i),""===o.decimalPart&&delete o.decimalPart,o}const Ys=/,*?$/;function js(e){if(function(e){return Boolean(e.replace(Xs,""))}(e=e.trim()))throw new Error(`Invalid number format: ${e}`);const t=e.includes("%"),o=e.match(Ys)?.[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 Xs=/[,#0.%]/g;function Ks(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 Qs=new RegExp(/\$?([A-Z]{1,3})\$?([0-9]{1,7})/,"i"),Js=new RegExp(/^\$?([A-Z]{1,3})\$?([0-9]{1,7})$/,"i"),en=new RegExp(/^\$?([A-Z]{1,3})+$/,"i"),tn=new RegExp(/^\$?([0-9]{1,7})+$/,"i"),on=new RegExp(/^\s*('.+'!|[^']+!)?\$?([A-Z]{1,3})$/,"i"),sn=new RegExp(/^\s*('.+'!|[^']+!)?\$?([0-9]{1,7})$/,"i"),nn=new RegExp(/^\s*('.+'!|[^']+!)?/.source+"("+[Qs.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 rn(e){return on.test(e)}function an(e){return sn.test(e)}function ln(e){return en.test(e)}function cn(e){return tn.test(e)}function hn(e){return Js.test(e)}function dn(e){const t=e.split("!"),o=t.pop();return{sheetName:Oe(t.join("!"))||void 0,xc:o}}function un(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(rn(r))n=i=Mt(r),o=s=0,a=!0;else if(an(r))o=s=parseInt(r,10)-1,n=i=0,l=!0;else{const e=Dt(r);n=i=e.col,o=s=e.row,c=!0}if(t)if(rn(t))i=Mt(t),a=!0;else if(an(t))s=parseInt(t,10)-1,l=!0;else{const e=Dt(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);return function(e){if(void 0!==e.right&&e.right<e.left){const t=e.left;e.left=e.right,e.right=t}if(void 0!==e.bottom&&e.bottom<e.top){const t=e.top;e.top=e.bottom,e.bottom=t}}(t),t}function gn(e){const t=un(e);if(void 0===t.bottom||void 0===t.right)throw new Error("This does not support unbounded ranges");return t}function pn(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))&&(mn(e)&&e.top>=0&&e.left>=0)}function mn(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 fn(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?`${Lt(s,t)}:${Ot(n)}`:`${Ot(s)}:${Ot(n)}`;if(void 0===n&&void 0!==o)return 0!==s||i?`${Lt(s,t)}:${o+1}`:`${t+1}:${o+1}`;if(void 0!==o&&void 0!==n)return r?Lt(s,t):`${Lt(s,t)}:${Lt(n,o)}`;throw new Error(a("Bad zone format"))}function bn(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?Nn(e,i,"RESIZE",n):r<e[t]?Nn(e,i,"MOVE",n):{...e}}function vn(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?Nn(e,i,"RESIZE",n):r<e[t]?Nn(e,i,"MOVE",n):{...e}}function Sn(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 Cn(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 En(...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 yn(e,t){if(xn(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 wn(e,t){return e.left===t.left&&e.right===t.right&&e.top===t.top&&e.bottom===t.bottom}function xn(e,t){return!(e.bottom<t.top||t.bottom<e.top)&&!(e.right<t.left||t.right<e.left)}function In(e,t,o){const{left:s,right:n,top:i,bottom:r}=o;return e>=s&&e<=n&&t>=i&&t<=r}function Rn(e,t){return wn(En(t,e),t)}function Tn(e,t){const o=e.map(un),s=t.map(un),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(Mn).flat(),a.map(Mn).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=Ln(t);for(const{col:e,row:t}of o)if(!In(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=Ln({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=An(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)?En(e,t):e),o.shift());t.push(e)}return An(t)}(c).map((e=>({...e,bottom:e.bottom===n+1?void 0:e.bottom,right:e.right===i+1?void 0:e.right}))).map(fn)}function An(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=>Rn(e,t)))||o.push(e)}return o.reverse()}function On(e){return{numberOfRows:e.bottom-e.top+1,numberOfCols:e.right-e.left+1}}function _n(e){const{numberOfCols:t,numberOfRows:o}=On(e);return 1===t||1===o}function Mn(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 Ne(o,s+1))for(const o of Ne(n,i+1))t.push({col:e,row:o});return t}function Nn(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?!(Pn(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 Fn(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 Dn(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 Ln(e){return{left:e.col,right:e.col,top:e.row,bottom:e.row}}function Pn(e){return void 0===e.right}function Vn(e){return(e.bottom-e.top+1)*(e.right-e.left+1)}function kn(...e){return e.length<2||1===Tn(e.map(fn),[]).length}class Un{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&&Vn(this.zone)>1?o.push({...e.parts[0]}):2===e.parts.length&&1===Vn(this.zone)&&o.pop(),this.parts=o}static fromRange(e,t){return e instanceof Un?e:new Un(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=an(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(mn(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 Un({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 Bn(e,t,o){const s=o.sheetId===e?t:o.sheetId;return o.clone({sheetId:s})}function Hn(e,t,o){if(!o)return;const s=e.getRangeFromSheetXC(t,o);return s.invalidSheetName||s.invalidXc?void 0:s}function zn(e){const t=[];for(const o of e)for(const e of Mn(o.zone))t.push({...e,sheetId:o.sheetId});return t}function Gn(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 $n(e){const t=[];for(let o=0;o<e;o++){const e={cells:{}};t.push(e)}return t}function Wn(e,t,o){return o.map((o=>o>=e?o+t:o))}function qn(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(We)}function Zn(e,t=1){return t*(e+Z)-Z}function Yn(e,t,o,s){const n=ti(e,t,o,"wrap"===o?.wrapping?s-2*Z:void 0).length;return Zn(Jn(o),n)+2*Y}const jn={};function Xn(e,t,o){const s=Qn(o);if(jn[s]||(jn[s]={}),void 0===jn[s][t]){e.save(),e.font=s;const o=e.measureText(t).width;e.restore(),jn[s][t]=o}return jn[s][t]}function Kn(e){return Math.round(96*e/72)}function Qn(e){return`${e.italic?"italic ":""}${e.bold?"bold":se} ${Jn(e)}px ${ie}`}function Jn(e){return Kn(e?.fontSize||ne)}function ei(e,t,o,s){if(Xn(e,t,s)<=o)return[t];const n=[];let i="";for(let r of t){Xn(e,i+r,s)>o?(n.push(i),i=r):i+=r}return n.push(i),n}function ti(e,t,o,s){o||(o={});const n=[],i=t.includes(xe)?t.split(xe):[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=ei(e,t,s,o),l=i.pop(),c=Xn(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=Xn(e,t,o);i<=a?(r+=t,a-=i):(n.push(r),r=l,a=s-c)}}""!==r&&n.push(r)}return n}function oi(e){return e?e.toLowerCase():""}const si=/([0-9\.]*)px/;function ni(e,t,o,s=!1,n=!1,i=function(e){return Number(e.match(si)?.[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 ii{isFastIdStrategy=!1;fastIdStart=0;setIsFastStrategy(e){this.isFastIdStrategy=e}smallUuid(){return this.isFastIdStrategy?(this.fastIdStart++,String(this.fastIdStart)):window.crypto?"10000000-1000".replace(/[01]/g,(e=>{const t=Number(e);return(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16)})):"xxxxxxxx-xxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))}uuidv4(){return this.isFastIdStrategy?(this.fastIdStart++,String(this.fastIdStart)):window.crypto?"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(e=>{const t=Number(e);return(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/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 ri(e){return e.map(li).sort(((e,t)=>e.sequence-t.sequence))}const ai=new ii;function li(e){const t=e.name,o=e.children,s=e.description,n=e.icon;return{id:e.id||ai.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(li):()=>[],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 ci(e,t){return"REMOVE_COLUMNS_ROWS"===t.type?Cn(e,"COL"===t.dimension?"left":"top",t.elements):"ADD_COLUMNS_ROWS"===t.type?bn(e,"COL"===t.dimension?"left":"top",t.base,t.position,t.quantity):e}function hi(e,t){const o="DELETE_SHEET"===t.type&&t.sheetId;if("sheetId"in t&&e._sheetId!==t.sheetId)return e;{const s=ci(e._zone,t);if(s&&o!==e._sheetId)return{...e,_zone:s}}}class di 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(Ae(e.chartJsConfig))})),t.useEffect((()=>this.updateChartJs(Ae(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()}}di.props={figure:Object};class ui{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 gi(e,t,o,s){let n=!1;const i=[];for(let s in o){let r=o[s];if(r.labelCell){const e=fi(r.labelCell,t);r.labelCell!==e&&(n=!0,r={...r,labelCell:e})}const a=fi(r.dataRange,t);void 0===a||e.getRangeString(a,a.sheetId)===ce?(n=!0,r=void 0):a!==r.dataRange&&(n=!0,r={...r,dataRange:a}),i[s]=r}let r=s;const a=fi(r,t);a!==r&&(n=!0,r=a);return{isStale:n,dataSets:i.filter(We),labelRange:r}}function pi(e,t,o){return o.map((o=>({dataRange:Bn(e,t,o.dataRange),labelCell:o.labelCell?Bn(e,t,o.labelCell):void 0})))}function mi(e,t,o){return o?Bn(e,t,o):void 0}function fi(e,t){if(!e)return;const o=t(e);switch(o.changeType){case"NONE":return e;case"REMOVE":return;default:return o.range}}function bi(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(vi(e,a,o,s?{top:o.top,bottom:o.top,left:o.left,right:o.left}:void 0))}}else n.push(vi(e,a,r,s?{top:r.top,bottom:r.top,left:r.left,right:r.left}:void 0))}return n}function vi(e,t,o,s){if(o.left!==o.right&&o.top!==o.bottom)throw new Error(`Zone should be a single column or row: ${fn(o)}`);if(s){const n=fn(o),i=fn(s);return{labelCell:e.getRangeFromSheetXC(t,i),dataRange:e.getRangeFromSheetXC(t,n)}}return{labelCell:void 0,dataRange:e.getRangeFromSheetXC(t,fn(o))}}function Si(e,t){const o=t.labelCell?.zone;let s=t.dataRange.zone;if(o){const{numberOfRows:e,numberOfCols:t}=On(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 Ci(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 Ei(e,t){let o;if(e.labelRange){const s=ci(un(e.labelRange),t);o=s?fn(s):void 0}const s=e.dataSets.map(un).map((e=>ci(e,t))).filter(We).map(fn);return{...e,labelRange:o,dataSets:s}}const yi=["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 wi{graphColorIndex=0;next(){return yi[this.graphColorIndex++%yi.length]}}function xi(e){return e&&yt(e)<.3?"#FFFFFF":"#000000"}function Ii(e){if(e.dataSets){const t=void 0!==e.dataSets.find((e=>!nn.test(e)));if(t)return"InvalidDataSet";if(e.dataSets.map(un).some((e=>e.top!==e.bottom&&Pn(e))))return"InvalidDataSet"}return"Success"}function Ri(e){if(e.labelRange){if(!nn.test(e.labelRange||""))return"InvalidLabelRange"}return"Success"}function Ti(e,t,o){if(!o)return!1;if(!e)return!1;if(!t)return!0;const s=Vn(t.dataRange.zone);return!(Vn(e.zone)<s)}function Ai(e,t,o,s){if(e){if("text"===o||t?.type!==bo.number||e.type!==bo.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 Ts(n,{format:e.format,locale:s});const i=Math.abs(parseFloat(n.toFixed(2))).toLocaleString();return"percentage"===o?i+"%":i}}return""}function Oi(e,t,o,s,n){if("text"===t||e?.type!==bo.number||o?.type!==bo.number)return;const i=o.value-e.value;return i>0?s:i<0?n:void 0}function _i(e,t,o){if("text"===o||e?.type!==bo.number||t?.type!==bo.number)return"neutral";const s=t.value-e.value;return s>0?"up":s<0?"down":"neutral"}function Mi(e){return e.keyValue&&!nn.test(e.keyValue)?"InvalidScorecardKeyValue":"Success"}function Ni(e){return e.baseline&&!nn.test(e.baseline)?"InvalidScorecardBaseline":"Success"}const Fi=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"),Di=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 Li=class e extends ui{keyValue;baseline;baselineMode;baselineDescr;background;baselineColorUp;baselineColorDown;fontColor;type="scorecard";constructor(e,t,o){super(e,t,o),this.keyValue=Hn(o,t,e.keyValue),this.baseline=Hn(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,Mi,Ni)}static getDefinitionFromContextCreation(e){return{background:e.background,type:"scorecard",keyValue:e.range?e.range[0]:void 0,title:e.title||"",baselineMode:pe,baselineColorUp:me,baselineColorDown:fe,baseline:e.auxiliaryRange||""}}static transformDefinition(e,t){let o,s;return e.baseline&&(o=ci(un(e.baseline),t)),e.keyValue&&(s=ci(un(e.keyValue),t)),{...e,baseline:o?fn(o):void 0,keyValue:s?fn(s):void 0}}copyForSheetId(t){const o=mi(this.sheetId,t,this.baseline),s=mi(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=fi(this.baseline,t),s=fi(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 Pi(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,ni(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(Fi);break;case"up":o.fill(Di)}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,ni(o,e.key.text,e.key.position,e.key.style.underline,e.key.style.strikethrough))}function Vi(e,t=!1,o=!1){return`${o?"italic":""} ${t?"bold":""} ${e}px ${ie}`}function ki({width:e,height:t},o){return new Ui({width:e,height:t},o).computeDesign()}class Ui{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 yt(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 zi(this.runtime.keyValueStyle).getElementMaxFontSize(this.getDrawableHeight(),this)*s,i=new Hi(this.runtime.baselineStyle).getElementMaxFontSize(this.getDrawableHeight(),this)*s;return{title:{font:Vi(18),color:this.secondaryFontColor},keyValue:{color:this.runtime.keyValueStyle?.textColor||this.runtime.fontColor,font:Vi(n,this.runtime.keyValueStyle?.bold,this.runtime.keyValueStyle?.italic),strikethrough:this.runtime.keyValueStyle?.strikethrough,underline:this.runtime.keyValueStyle?.underline},baselineValue:{font:Vi(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:Vi(.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 Hi(this.runtime.baselineStyle),t=new zi(this.runtime.keyValueStyle);return e.getElementWidth(.35,this.context,this)>t.getElementWidth(.65,this.context,this)?e:t}}class Bi{style;constructor(e={}){this.style=e}measureTextWidth(e,t,o){return e.font=Vi(o,this.style.bold,this.style.italic),e.measureText(t).width}}class Hi extends Bi{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 zi extends Bi{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 Gi 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;Pi(ki(e.getBoundingClientRect(),this.runtime),e)}}Gi.props={figure:Object};class $i{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 Wi(e){return/^https?:\/\//i.test(e)?e:`https://${e}`}const qi=new $i;function Zi(e,t){return{url:e=Wi(e),label:t||e,isExternal:!0,isUrlEditable:!0}}qi.add("sheet_URL",{match:e=>ze(e),createLink:(e,t)=>({label:t,url:e,isExternal:!1,isUrlEditable:!1}),urlRepresentation(e,t){const o=$e(e);return t.tryGetSheetName(o)||a("Invalid sheet")},open(e,t){const o=$e(e);t.model.dispatch("ACTIVATE_SHEET",{sheetIdFrom:t.model.getters.getActiveSheetId(),sheetIdTo:o})},sequence:0});const Yi={createLink:Zi,match:e=>ke(e),open:e=>window.open(e,"_blank"),urlRepresentation:e=>e,sequence:0};function ji(e){return qi.getAll().sort(((e,t)=>e.sequence-t.sequence)).find((t=>t.match(e)))||Yi}function Xi(e,t){return ji(e.url).urlRepresentation(e.url,t)}function Ki(e,t){ji(e.url).open(e.url,t)}function Qi(e){if("string"==typeof e){if(Ve(e)){const{label:t,url:o}=Be(e);return ji(o).createLink(o,t)}return ke(e)?Zi(e):void 0}}function Ji(e,t){return tr(er(e||"",t.locale),t)}function er(e,t){if(e.startsWith("="))throw new Error(`Cannot parse "${e}" because it's not a literal value. It's a formula`);return go(e,Oo)?Vo(e,Oo):jt(e,t)?Vo(e,t):function(e){const t=e.toUpperCase();return"TRUE"===t||"FALSE"===t}(e)?"TRUE"===e.toUpperCase():e}function tr(e,t){const o=Qi(e);return o?{...or(er(o.label,t.locale),{format:t.format||Hs(o.label,t.locale)||zs(o.label),locale:t.locale}),link:o}:or(e,t)}function or(e,t){try{for(const o of rr){const s=o(e,t);if(s)return s}return function(e,t){return{type:bo.text,value:e,format:t.format,isAutoSummable:!0,defaultAlign:"left",formattedValue:Ts(e,t)}}((e||"").toString(),t)}catch(e){return ir(new d(c.GenericError,e.message||Ce))}}function sr(e,t){return{type:bo.number,value:e||0,format:t.format,isAutoSummable:!0,defaultAlign:"right",formattedValue:Ts(e,t)}}const nr={type:bo.empty,value:"",format:void 0,isAutoSummable:!0,defaultAlign:"left",formattedValue:""};function ir(e){return{type:bo.error,value:e.errorType,error:e,isAutoSummable:!1,defaultAlign:"center",formattedValue:e.errorType}}const rr=[function(e,t){if(""===e)return function(e){return void 0===e.format?nr:{type:bo.empty,value:"",format:e.format,isAutoSummable:!0,defaultAlign:"left",formattedValue:""}}(t)},function(e,t){if(t.format&&"number"==typeof e&&Ds(t.format))return function(e,t){const o=Ts(e,t);return{type:bo.number,value:e,format:t.format,isAutoSummable:!1,defaultAlign:"right",formattedValue:o}}(e,t)},function(e,t){return"number"==typeof e?sr(e,t):null===e?sr(0,t):void 0},function(e,t){if("boolean"==typeof e)return function(e,t){const o=e?"TRUE":"FALSE";return{type:bo.boolean,value:e,format:t.format,isAutoSummable:!1,defaultAlign:"center",formattedValue:o}}(e,t)}],ar=new $i;ar.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=Ts(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:Ji(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 lr=new $i,cr=/(\d+)$/,hr=/^(.*\D+)/,dr=/^(.*\D+)(\d+)$/;function ur(e,t,o){let s=[],n=!1;for(let i of t){i===e&&(n=!0);const t=i?.isFormula?void 0:Ji(i?.content,{locale:Oo});if(t&&o(t))s.push(t);else{if(n)return s;s=[]}}return s}function gr(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}lr.add("simple_value_copy",{condition:(e,t)=>!(1!==t.length||e.isFormula||e.format&&Ds(e.format)),generateRule:()=>({type:"COPY_MODIFIER"}),sequence:10}).add("increment_alphanumeric_value",{condition:e=>!e.isFormula&&Ji(e.content,{locale:Oo}).type===bo.text&&dr.test(e.content),generateRule:(e,t,o)=>{const s=parseInt(e.content.match(cr)[0]),n=e.content.match(hr)[0],i=e.content.length-n.length,r=ur(e,t,(e=>e.type===bo.text&&dr.test(e.value))).filter((e=>n===e.value.toString().match(hr)[0])).map((e=>parseInt(e.value.toString().match(cr)[0])));let a=gr(r);return["up","left"].includes(o)&&1===r.length&&(a=-a),{type:"ALPHANUMERIC_INCREMENT_MODIFIER",prefix:n,current:s,increment:a,numberPostfixLength:i}},sequence:15}).add("copy_text",{condition:e=>!e.isFormula&&Ji(e.content,{locale:Oo}).type===bo.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&&Ji(e.content,{locale:Oo}).type===bo.number,generateRule:(e,t,o)=>{const s=ur(e,t,(e=>e.type===bo.number)).map((e=>Number(e.value)));let n=gr(s);["up","left"].includes(o)&&1===s.length&&(n=-n);const i=Ji(e.content,{locale:Oo});return{type:"INCREMENT_MODIFIER",increment:n,current:i.type===bo.number?i.value:0}},sequence:40});const pr={};let mr=0;function fr(e,...t){const o="__sheet__"+mr++;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),pr[e]=o}(o,String.raw(e,...t)),function(e){const t=pr[e];t.setAttribute("component",e),document.head.appendChild(t)}(o),o}function br({strikethrough:e,underline:t}){return e||t?`${e?"line-through":""} ${t?"underline":""}`:"none"}function vr(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 Sr(e){let t="";for(const o in e)e[o]&&(t+=`${o}:${e[o]}; `);return t}fr`
|
|
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",y="#666666",w="#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",V="#BCBCBC",k="#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=3,j=Z,X=21,K=17,Q=2*G,J=250,ee={align:"left",verticalAlign:"bottom",wrapping:"overflow",bold:!1,italic:!1,strikethrough:!1,underline:!1,fontSize:10,fillColor:"",textColor:""},te=ee.verticalAlign,oe=ee.wrapping,se="400",ne=ee.fontSize,ie="'Roboto', arial",re="thin",ae="#000000",le={style:"thin",color:_},ce=c.InvalidReference,he="START_REVISION",de=1,ue=20,ge="??",pe="difference",me="#00A04A",fe="#DC6965",be=["'","*","?","/","\\","[","]"],ve=/'|\*|\?|\/|\\|\[|\]/,Se="|",Ce=a("Invalid expression");var Ee;!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"}(Ee||(Ee={}));let ye=0;function we(){return ye}const xe="\n",Ie=[6,7,8,9,10,11,12,14,18,24,36];function Re(e){return'"'===e[0]&&(e=e.slice(1)),'"'===e[e.length-1]&&"\\"!==e[e.length-2]?e.slice(0,e.length-1):e}function Te(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ae(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]=Ae(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 Oe(e){return e.startsWith("'")&&(e=e.slice(1,-1).replace(/''/g,"'")),e}function _e(e){return e.match(/\w/g)?.length!==e.length&&(e=`'${e}'`),e}function Me(e,t,o){return e<t?t:e>o?o:e}function Ne(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 Fe(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*De(e,t){t.next();for(const o of e){const e=t.next();yield{...o,next:e.done?void 0:e.value}}}const Le=/^\[(.+)\]\((.+)\)$/,Pe=/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$/;function Ve(e){return Le.test(e)}function ke(e){return Pe.test(e)}function Ue(e,t){return`[${e}](${t})`}function Be(e){const t=e.match(Le)||[],o=t[1],s=t[2];if(!o||!s)throw new Error(`Could not parse markdown link ${e}.`);return{label:o,url:s}}const He="o-spreadsheet://";function ze(e){return e.startsWith(He)}function Ge(e){return`${He}${e}`}function $e(e){if(e.startsWith(He))return e.substr(He.length);throw new Error(`${e} is not a valid sheet link`)}function We(e){return void 0!==e}function qe(e){return null!==e}function Ze(e){return void 0===e||Object.values(e).every((e=>"object"==typeof e?Ze(e):!e))}function Ye(e,t){for(const o in t)if(Je(t[o],e))return parseInt(o,10);const o=Object.keys(t),s=0===o.length?0:ut(o.map((e=>parseInt(e,10))));return t[s+1]=e,s+1}function je(e){let t="";for(let o=0,s=e.length;o<s;o++)t+=e[o];return t}function Xe(e){let t,o=!1;const s=()=>(o||(t=e instanceof Function?e():e,o=!0),t);return s.map=e=>Xe((()=>e(s()))),s}function Ke(e,t){let o=e.slice(t).find((e=>e));return o||(o=e.slice(0,t).reverse().find((e=>e))),o||""}function Qe(e,t){return"after"===e?t+1:t}function Je(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(!Je(e[o],t[o]))return!1}else if(e[o]!==t[o])return!1}return!0}function et(e,t){if(e.length<t.length)return!1;const o=new Set(e);return t.every((e=>o.has(e)))}function tt(e){const t={...e};return Object.keys(t).forEach((e=>!t[e]&&delete t[e])),t}const ot=["\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))],st=new RegExp(ot.join("|"),"g"),nt=/(\r\n|\r)/g;function it(e){return e?e.replace(nt,xe):""}function rt(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 at 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 lt(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 ct(e,t){return e.filter(((e,o)=>!t.includes(o)))}function ht(e){return e.split("\n").map((e=>e.replace(/\s+/g," ").trim())).join("\n")}function dt(e,t,o){return t>o?dt(e,o,t):e>=t&&e<=o}function ut(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 gt(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 pt=/rgba?\(|\s+|\)/gi,mt=/^#([A-F\d]{2}){3,4}$/,ft=["#eb6d00","#0074d9","#ad8e00","#169ed4","#b10dc9","#00a82d","#00a3a3","#f012be","#3d9970","#111111","#62A300","#ff4136","#949494","#85144b","#001f3f"];function bt(e){return vt(e.toString(16).padStart(6,"0"))}function vt(e){let t=e;if(e.startsWith("rgb")?t=function(e){const t=e.replace(pt,"").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");if(isNaN(e))throw new Error("invalid alpha value");o=Math.round(255*e)}const s=t.map((e=>parseInt(e,10)));255!==o&&s.push(o);return"#"+je(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}`),!mt.test(t))throw new Error(`invalid color input: ${e}`);return t}function St(e){try{return vt(e),!0}catch(e){return!1}}const Ct=e=>e>=0&&e<=255;function Et(e,t,o,s=1){if(!Ct(e)||!Ct(t)||!Ct(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 yt(e){let{r:t,g:o,b:s}=xt(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 wt(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 xt(e){let t,o,s,n;if(7===(e=vt(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 It(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 Rt(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 Tt(e){return wt(It(e))}function At(e){return Rt(xt(e))}function Ot(e){if(e<0)throw new Error(`number must be positive. Got ${e}`);return e<26?String.fromCharCode(65+e):Ot(Math.floor(e/26)-1)+Ot(e%26)}const _t={};for(const QT of"ABCDEFGHIJKLMNOPQRSTUVWXYZ"){const JT=QT.charCodeAt(0)-64;_t[QT]=JT,_t[QT.toLowerCase()]=JT}function Mt(e){let t=-1;let o=1;for(let s=e.length-1;s>=0;s--){t+=_t[e[s]]*o,o*=26}return t}function Nt(e){return e>="A"&&e<="Z"||e>="a"&&e<="z"}function Ft(e){return e>="0"&&e<="9"}function Dt(e){let t;e=e.trim();for(let o=0;o<e.length;o++){const s=e[o];if(!t){if("$"===s&&0===o||Nt(s))continue;t=o}if(!Ft(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=Mt(o),i=Number(s)-1;if(isNaN(i))throw new Error(`Invalid cell description: ${e}`);return{col:n,row:i}}function Lt(e,t,o={colFixed:!1,rowFixed:!1}){return(o.colFixed?"$":"")+Ot(e)+(o.rowFixed?"$":"")+String(t+1)}class Pt{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 Pt(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds())}static now(){const e=new Date;return new Pt(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 Vt=new Pt(1899,11,30),kt=864e5,Ut=2e3,Bt=Pt.now().getFullYear(),Ht=Pt.now().getMonth(),zt=Pt.fromTimestamp(0).getTime()-Vt.getTime(),Gt=/^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/,$t=/^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/,Wt=/\/|-|\s/,qt=/^(\d{1,4})[\/-\s](\d{1,4})([\/-\s](\d{1,4}))?$/,Zt=/((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;function Yt(e,t){switch(typeof e){case"number":return e;case"string":return jt(e,t)?Kt(e,t)?.value:!e||isNaN(Number(e))?void 0:Number(e);default:return}}function jt(e,t){return null!==Kt(e,t)}const Xt=new Map;function Kt(e,t){return Xt.has(t)||Xt.set(t,new Map),Xt.get(t).has(e)||Xt.get(t).set(e,function(e,t){e=e.trim();let o=null;const s=e.match(Zt);if(s){if(o=function(e){if(e=e.trim(),Zt.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 Pt(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(qt);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(Wt)[0];if(n=function(e,t){let{year:o,month:s,day:n}=e;const i=function(e){if(!e)return Ht;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 Bt;const t=Number(e);switch(e.length){case 1:return Ut+t;case 2:return Ut+(Ut+t>Bt+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 Pt(a,i,r);if(h.getMonth()!==i||h.getDate()!==r)return null;const d=h.getTime()-Vt.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(We).join(t);case"ymd":return[n,i,r].filter(We).join(t);case"dmy":return[r,i,n].filter(We).join(t)}}(e,t,l,c);return{value:Math.round(d/kt),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 Pt(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)),Xt.get(t).get(e)}function Qt(e){const t=Math.trunc(e);let o=Pt.fromTimestamp(t*kt-zt),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 Jt(e){return Math.round(eo(e))}function eo(e){return(e.getTime()-Vt.getTime())/kt}function to(e){return new Pt(e.getFullYear(),e.getMonth()+1,0).getDate()}function oo(e){return to(e)===e.getDate()}function so(e,t,o){const s=e.getFullYear(),n=e.getMonth(),i=e.getDate(),r=new Pt(s,n+t,1);return o&&i===to(e)||i>to(r)?r.setDate(to(r)):r.setDate(i),r}function no(e){const t=Math.trunc(e);return t%4==0&&t%100!=0||t%400==0}function io(e,t,o){if(e===t)return 0;if(e>t){const o=t;t=e,e=o}const s=Qt(e),n=Qt(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===(no(c)?29:28)&&(i=30,1===l&&r===(no(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+=no(o)?366:365;o=t/e}else s?no(c)&&(o=366):(no(c)&&a<2&&(o=366),no(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 ro(e,t){const o=12*(t.getFullYear()-e.getFullYear())+t.getMonth()-e.getMonth();return e.getDate()>t.getDate()?o-1:o}function ao(e,t){const o=e.getTime(),s=t.getTime();return Math.floor((s-o)/kt)}function lo(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 co(e,t,o){return t>o?co(e,o,t):(e=Math.trunc(e),t=Math.trunc(t),o=Math.trunc(o),e>=t&&e<=o)}const ho=lt((function(e){return e=Te(e),new RegExp(`(^-?\\d+(${e}?\\d*(e\\d+)?)?|^-?${e}\\d+)(?!\\w|!)`)})),uo=lt((function(e){const t=Te(e.decimalSeparator),o="(\\s*"+`(\\d+(${Te(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 go(e,t){return!!e&&uo(t).test(e.trim())}const po=lt((function(e){return new RegExp(`[$€${Te(e.thousandsSeparator||"")}]`,"g")}));function mo(e,t){e=e.replace(po(t),""),"."!==t.decimalSeparator&&(e=e.replace(t.decimalSeparator,"."));let o=Number(e);return isNaN(o)&&e.includes("%")&&(o=Number(e.split("%")[0]),!isNaN(o))?o/100:o}function fo(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 bo,vo;!function(e){e.boolean="boolean",e.number="number",e.text="text",e.empty="empty",e.error="error"}(bo||(bo={})),function(e){e.PlainText="text/plain",e.Html="text/html"}(vo||(vo={}));const So=new Set(["RENAME_SHEET","DELETE_SHEET","CREATE_SHEET","ADD_COLUMNS_ROWS","REMOVE_COLUMNS_ROWS","UNDO","REDO","ADD_MERGE","DUPLICATE_SHEET","UPDATE_LOCALE"]),Co=new Set([...So,"MOVE_RANGES"]),Eo=new Set([...So,"EVALUATE_CELLS","ADD_CONDITIONAL_FORMAT","REMOVE_CONDITIONAL_FORMAT","CHANGE_CONDITIONAL_FORMAT_PRIORITY"]),yo=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"]),wo=new Set(["UPDATE_CELL","UPDATE_CELL_POSITION","CLEAR_CELL","CLEAR_CELLS","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","SET_BORDERS_ON_TARGET","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 xo(e){return wo.has(e.type)}class Io{reasons;constructor(e=[]){Array.isArray(e)||(e=[e]),e=[...new Set(e)],this.reasons=e.filter((e=>"Success"!==e))}static get Success(){return Ro}get isSuccessful(){return 0===this.reasons.length}isCancelledBecause(e){return this.reasons.includes(e)}}const Ro=new Io;var To;e.CommandResult=void 0,(To=e.CommandResult||(e.CommandResult={})).Success="Success",To.CancelledForUnknownReason="CancelledForUnknownReason",To.WillRemoveExistingMerge="WillRemoveExistingMerge",To.MergeIsDestructive="MergeIsDestructive",To.CellIsMerged="CellIsMerged",To.InvalidTarget="InvalidTarget",To.EmptyUndoStack="EmptyUndoStack",To.EmptyRedoStack="EmptyRedoStack",To.NotEnoughElements="NotEnoughElements",To.NotEnoughSheets="NotEnoughSheets",To.MissingSheetName="MissingSheetName",To.UnchangedSheetName="UnchangedSheetName",To.DuplicatedSheetName="DuplicatedSheetName",To.DuplicatedSheetId="DuplicatedSheetId",To.ForbiddenCharactersInSheetName="ForbiddenCharactersInSheetName",To.WrongSheetMove="WrongSheetMove",To.WrongSheetPosition="WrongSheetPosition",To.InvalidAnchorZone="InvalidAnchorZone",To.SelectionOutOfBound="SelectionOutOfBound",To.TargetOutOfSheet="TargetOutOfSheet",To.WrongCutSelection="WrongCutSelection",To.WrongPasteSelection="WrongPasteSelection",To.WrongPasteOption="WrongPasteOption",To.WrongFigurePasteOption="WrongFigurePasteOption",To.EmptyClipboard="EmptyClipboard",To.EmptyRange="EmptyRange",To.InvalidRange="InvalidRange",To.InvalidZones="InvalidZones",To.InvalidSheetId="InvalidSheetId",To.InvalidCellId="InvalidCellId",To.InvalidFigureId="InvalidFigureId",To.InputAlreadyFocused="InputAlreadyFocused",To.MaximumRangesReached="MaximumRangesReached",To.MinimumRangesReached="MinimumRangesReached",To.InvalidChartDefinition="InvalidChartDefinition",To.InvalidDataSet="InvalidDataSet",To.InvalidLabelRange="InvalidLabelRange",To.InvalidScorecardKeyValue="InvalidScorecardKeyValue",To.InvalidScorecardBaseline="InvalidScorecardBaseline",To.InvalidGaugeDataRange="InvalidGaugeDataRange",To.EmptyGaugeRangeMin="EmptyGaugeRangeMin",To.GaugeRangeMinNaN="GaugeRangeMinNaN",To.EmptyGaugeRangeMax="EmptyGaugeRangeMax",To.GaugeRangeMaxNaN="GaugeRangeMaxNaN",To.GaugeRangeMinBiggerThanRangeMax="GaugeRangeMinBiggerThanRangeMax",To.GaugeLowerInflectionPointNaN="GaugeLowerInflectionPointNaN",To.GaugeUpperInflectionPointNaN="GaugeUpperInflectionPointNaN",To.GaugeLowerBiggerThanUpper="GaugeLowerBiggerThanUpper",To.InvalidAutofillSelection="InvalidAutofillSelection",To.WrongComposerSelection="WrongComposerSelection",To.MinBiggerThanMax="MinBiggerThanMax",To.LowerBiggerThanUpper="LowerBiggerThanUpper",To.MidBiggerThanMax="MidBiggerThanMax",To.MinBiggerThanMid="MinBiggerThanMid",To.FirstArgMissing="FirstArgMissing",To.SecondArgMissing="SecondArgMissing",To.MinNaN="MinNaN",To.MidNaN="MidNaN",To.MaxNaN="MaxNaN",To.ValueUpperInflectionNaN="ValueUpperInflectionNaN",To.ValueLowerInflectionNaN="ValueLowerInflectionNaN",To.MinInvalidFormula="MinInvalidFormula",To.MidInvalidFormula="MidInvalidFormula",To.MaxInvalidFormula="MaxInvalidFormula",To.ValueUpperInvalidFormula="ValueUpperInvalidFormula",To.ValueLowerInvalidFormula="ValueLowerInvalidFormula",To.InvalidSortZone="InvalidSortZone",To.WaitingSessionConfirmation="WaitingSessionConfirmation",To.MergeOverlap="MergeOverlap",To.TooManyHiddenElements="TooManyHiddenElements",To.Readonly="Readonly",To.InvalidViewportSize="InvalidViewportSize",To.InvalidScrollingDirection="InvalidScrollingDirection",To.FigureDoesNotExist="FigureDoesNotExist",To.InvalidConditionalFormatId="InvalidConditionalFormatId",To.InvalidCellPopover="InvalidCellPopover",To.EmptyTarget="EmptyTarget",To.InvalidFreezeQuantity="InvalidFreezeQuantity",To.FrozenPaneOverlap="FrozenPaneOverlap",To.ValuesNotChanged="ValuesNotChanged",To.InvalidFilterZone="InvalidFilterZone",To.FilterOverlap="FilterOverlap",To.FilterNotFound="FilterNotFound",To.MergeInFilter="MergeInFilter",To.NonContinuousTargets="NonContinuousTargets",To.DuplicatedFigureId="DuplicatedFigureId",To.InvalidSelectionStep="InvalidSelectionStep",To.DuplicatedChartId="DuplicatedChartId",To.ChartDoesNotExist="ChartDoesNotExist",To.InvalidHeaderIndex="InvalidHeaderIndex",To.InvalidQuantity="InvalidQuantity",To.MoreThanOneColumnSelected="MoreThanOneColumnSelected",To.EmptySplitSeparator="EmptySplitSeparator",To.SplitWillOverwriteContent="SplitWillOverwriteContent",To.NoSplitSeparatorInSelection="NoSplitSeparatorInSelection",To.NoActiveSheet="NoActiveSheet",To.InvalidLocale="InvalidLocale",To.AlreadyInPaintingFormatMode="AlreadyInPaintingFormatMode",To.MoreThanOneRangeSelected="MoreThanOneRangeSelected",To.NoColumnsProvided="NoColumnsProvided",To.ColumnsNotIncludedInZone="ColumnsNotIncludedInZone",To.DuplicatesColumnsSelected="DuplicatesColumnsSelected",To.InvalidHeaderGroupStartEnd="InvalidHeaderGroupStartEnd",To.HeaderGroupAlreadyExists="HeaderGroupAlreadyExists",To.UnknownHeaderGroup="UnknownHeaderGroup",To.UnknownDataValidationRule="UnknownDataValidationRule",To.UnknownDataValidationCriterionType="UnknownDataValidationCriterionType",To.InvalidDataValidationCriterionValue="InvalidDataValidationCriterionValue",To.InvalidNumberOfCriterionValues="InvalidNumberOfCriterionValues",To.BlockingValidationRule="BlockingValidationRule",To.InvalidCopyPasteSelection="InvalidCopyPasteSelection",To.NoChanges="NoChanges",To.InvalidInputId="InvalidInputId";const Ao=[{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:";"}],Oo=Ao[0],_o=["thin","medium","thick","dashed","dotted"];function Mo(e){return Array.isArray(e)&&Array.isArray(e[0])}var No,Fo;!function(e){e.UP="up",e.DOWN="down",e.LEFT="left",e.RIGHT="right"}(No||(No={})),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"}(Fo||(Fo={}));const Do=["number","string","boolean","undefined"];function Lo(e,t){if(!e())throw new d(c.GenericError,t)}const Po=e=>a("The function [[FUNCTION_NAME]] expects a number value, but '%s' is a string, and cannot be coerced to a number.",e);function Vo(e,t){switch(typeof e){case"number":return e;case"boolean":return e?1:0;case"string":if(go(e,t)||""===e)return mo(e,t);const o=Kt(e,t);if(o)return o.value;throw new Error(Po(e));default:return 0}}function ko(e,t){try{return Vo(e,t)}catch(e){return}}function Uo(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 Bo(e,t){if(""===e)throw new Error(Po(e));return Vo(e,t)}function Ho(e,t){return Math.trunc(Vo(e,t))}function zo(e,t){return Math.trunc(Bo(e,t))}function Go(e){Lo((()=>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 $o(e){switch(typeof e){case"string":return e;case"number":return e.toString();case"boolean":return e?"TRUE":"FALSE";default:return""}}const Wo=lt((function(e){return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"")})),qo=e=>a("The function [[FUNCTION_NAME]] expects a boolean value, but '%s' is a text, and cannot be coerced to a number.",e);function Zo(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(qo(e))}return!1;case"number":return!!e;default:return!1}}function Yo(e,t){return Qt(Vo(e,t))}function jo(e,t,o){for(let s of e)if(Mo(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 Xo(e,t){jo(e,t,t)}function Ko(e,t,o){jo(e,(e=>{"number"==typeof e&&t(e)}),(e=>{t(Bo(e,o))}))}function Qo(e,t,o,s,n="rowFirst"){let i=s;for(let s of e)if(Mo(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 Jo(e,t,o,s="rowFirst"){return Qo(e,t,t,o,s)}function es(e,t,o,s){return Qo(e,((e,o)=>"number"==typeof o?t(e,o):e),((e,o)=>t(e,Bo(o,s))),o)}function ts(e,t,o,s){return Qo(e,((e,o)=>null!=o?t(e,"number"==typeof o?o:"boolean"==typeof o?Vo(o,s):0):e),((e,o)=>t(e,Vo(o,s))),o)}function os(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 ss(e,t){return 0===e.length?[]:os(e.length,e[0].length,((o,s)=>t(e[o][s])))}function ns(e){return e.length?os(e[0].length,e.length,((t,o)=>e[o][t])):[]}function is(e,t){return function(e,t,o){for(let s of e)if(Mo(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(qo(e));return Zo(e)}(e))))}function rs(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)),go(n,o)||jt(n,o)?n=Vo(n,o):"TRUE"!==n&&"FALSE"!==n||(n=Zo(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 as(e="",t,o){const{operator:s,operand:n}=t;if(void 0===n||null===e||null===n)return!1;if("number"==typeof n&&"="===s)return"string"==typeof e&&(go(e,o)||jt(e,o))?Vo(e,o)===n:e===n;if("<>"===s||"="===s){let o;return o=typeof e==typeof n&&("string"==typeof e&&t.regexp?t.regexp.test(e):e===n),"="===s?o:!o}if(typeof e==typeof n)switch(s){case"<":return e<n;case">":return e>n;case"<=":return e<=n;case">=":return e>=n}return!1}function ls(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(!Mo(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=$o(e[t+1]);l.push(rs(c,s,o))}for(let s=0;s<i;s++)for(let i=0;i<r;i++){let r=!0;for(let t=0;t<n-1;t+=2){if(r=as(e[t][s][i]??void 0,l[t/2],o),!r)break}r&&t(s,i)}}function cs(e,t,o,s,n,i){if(null==t)return-1;const r=ds(t),a=typeof r;let l,c,h,d,u,g,p=0,m=n-1;const f="desc"===s?t=>ds(i(e,n-t-1)):t=>ds(i(e,t));for(;m-p>=0;){for(h=Math.floor((p+m)/2),d=h,u=f(d),g=typeof u;p<d&&a!==g;)d--,u=f(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&&c<d)&&(l=u,c=d):"nextGreater"===o&&u>=r&&(void 0===l||l>u||l===u&&c<d)&&(l=u,c=d),u>r||"strict"===o&&u===r?m=d-1:p=h+1):p=h+1}return void 0===c?-1:"desc"===s?n-c-1:c}function hs(e,t,o,s,n,i=!1){if(null==t)return-1;const r=ds(t),a=i?(e,t)=>n(e,s-t-1):n;let l,c=-1;for(let t=0;t<s;t++){const n=ds(a(e,t));if(n===r)return i?s-t-1:t;"nextSmaller"===o?(!l&&us(r,n)>=0||us(r,n)>=0&&us(n,l)>0)&&(l=n,c=t):"nextGreater"===o&&(!l&&us(r,n)<=0||us(r,n)<=0&&us(n,l)<0)&&(l=n,c=t)}return i&&-1!==c?s-c-1:c}function ds(e){return"string"==typeof e?Wo(e):e}function us(e,t){let o=Do.indexOf(typeof e)-Do.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 gs(e){return void 0===e?[[]]:Mo(e)?e:[[e]]}function ps(e,t){return Jo(e,((e,o)=>(e.push(t(o)),e)),[],"rowFirst")}function ms(e){const t=Pt.now();switch(e){case"today":return eo(t);case"yesterday":return eo(Pt.fromTimestamp(t.setDate(t.getDate()-1)));case"tomorrow":return eo(Pt.fromTimestamp(t.setDate(t.getDate()+1)));case"lastWeek":return eo(Pt.fromTimestamp(t.setDate(t.getDate()-7)));case"lastMonth":return eo(Pt.fromTimestamp(t.setMonth(t.getMonth()-1)));case"lastYear":return eo(Pt.fromTimestamp(t.setFullYear(t.getFullYear()-1)))}}function fs(e,t){return"dateValue"in e&&"exactDate"!==e.dateValue?[ms(e.dateValue)]:e.values.map((e=>Yt(e,t)))}function bs(e,t){return e.values.map((e=>ko(e,t)))}function vs(e){return 20+120*Math.exp(-.035*(e-1))}const Ss=20,Cs=11,Es=/(\d+?)(?=(\d{3})+(?!\d)|$)/g,ys=/0/g,ws={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")},xs={0:a("Sunday"),1:a("Monday"),2:a("Tuesday"),3:a("Wednesday"),4:a("Thursday"),5:a("Friday"),6:a("Saturday")},Is={};function Rs(e){let t=Is[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);Ds(i)?o.push({type:"DATE",format:i}):o.push({type:"NUMBER",format:js(i)})}t=s}return o}(e),Is[e]=t),t}function Ts(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=Bs(e));return function(e,t,o){if("DATE"===t[0].type)return Ps(e,t[0].format);let s=e<0?"-":"";for(let n of t)switch(n.type){case"NUMBER":s+=As(Math.abs(e),n.format,o);break;case"STRING":s+=n.format}return s}(e,Rs(t),o);case"object":return"0"}}function As(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}=_s(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(ys)||[]).length;n="0".repeat(e)+n}o&&(n=n.match(Es)?.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(ys)||[]).length;o+="0".repeat(s)}return o}(i||"",t.decimalPart)),t.isPercent&&(r+="%"),r}const Os=[];function _s(e,t=Ss){const o=e.toString();if(o.includes("e"))return function(e,t=Ss){let o=Os[t];o||(o=new Intl.NumberFormat("en-US",{maximumFractionDigits:t,useGrouping:!1}),Os[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(Ns)?.[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:Ms(i||"")}}function Ms(e){let t=e.length-1;for(;t>=0&&"0"===e[t];)t--;return e.slice(0,t+1)||void 0}const Ns=/^0+/;function Fs(e,t){const{integerDigits:o,decimalDigits:s}=_s(e,20);return s?o+t+s:o}function Ds(e){if(!Ls.has(e[0]))return!1;try{return Ps(1,e),!0}catch(e){return!1}}const Ls=new Set(["h","m","y","d"]);function Ps(e,t){const o=Qt(e),s=t.indexOf("h");let n="",i="";return s>0?(n=Vs(o,t.substring(0,s-1)),i=ks(o,t.substring(s))):0===s?i=ks(o,t):s<0&&(n=Vs(o,t)),n+(n&&i?" ":"")+i}function Vs(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 xs[e.getDay()].slice(0,3);case"dddd":return xs[e.getDay()];case"m":return e.getMonth()+1;case"mm":return String(e.getMonth()+1).padStart(2,"0");case"mmm":return ws[e.getMonth()].slice(0,3);case"mmmm":return ws[e.getMonth()];case"mmmmm":return ws[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 ks(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()-Vt.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 Us=lt((function(e){return new RegExp(`[0-9]+${Te(e.decimalSeparator)}[0-9]`)}));function Bs(e){let{integerDigits:t,decimalDigits:o}=_s(e);if(!o)return"0";const s=t.replace("-","").length;if(s+2>Cs)return"0";const n=Cs-s-1;return({decimalDigits:o}=_s(e,Math.min(n,o.length))),o?"0."+"0".repeat(o.length):"0"}function Hs(e,t){if(!jt(e,t))return;return Kt(e,t).format}function zs(e){if(!go(e,Oo))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 Gs(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 $s(e){return Ks(Rs(e).map((e=>"NUMBER"===e.type?{type:e.type,format:{...e.format,decimalPart:void 0}}:e)))}function Ws(e,t,o,s){const n=Rs(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 Ks(i)}function qs(e,t,o){const s=Rs(e).map((e=>"NUMBER"===e.type?{...e,format:Zs(e.format,t)}:e)),n=Ks(s);return Is[n]=s,n}function Zs(e,t){const o={...e},s=Math.sign(t),n=o.decimalPart?.length||0,i=Math.min(Math.max(0,n+s),Ss);return o.decimalPart="0".repeat(i),""===o.decimalPart&&delete o.decimalPart,o}const Ys=/,*?$/;function js(e){if(function(e){return Boolean(e.replace(Xs,""))}(e=e.trim()))throw new Error(`Invalid number format: ${e}`);const t=e.includes("%"),o=e.match(Ys)?.[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 Xs=/[,#0.%]/g;function Ks(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 Qs=new RegExp(/\$?([A-Z]{1,3})\$?([0-9]{1,7})/,"i"),Js=new RegExp(/^\$?([A-Z]{1,3})\$?([0-9]{1,7})$/,"i"),en=new RegExp(/^\$?([A-Z]{1,3})+$/,"i"),tn=new RegExp(/^\$?([0-9]{1,7})+$/,"i"),on=new RegExp(/^\s*('.+'!|[^']+!)?\$?([A-Z]{1,3})$/,"i"),sn=new RegExp(/^\s*('.+'!|[^']+!)?\$?([0-9]{1,7})$/,"i"),nn=new RegExp(/^\s*('.+'!|[^']+!)?/.source+"("+[Qs.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 rn(e){return on.test(e)}function an(e){return sn.test(e)}function ln(e){return en.test(e)}function cn(e){return tn.test(e)}function hn(e){return Js.test(e)}function dn(e){const t=e.split("!"),o=t.pop();return{sheetName:Oe(t.join("!"))||void 0,xc:o}}function un(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(rn(r))n=i=Mt(r),o=s=0,a=!0;else if(an(r))o=s=parseInt(r,10)-1,n=i=0,l=!0;else{const e=Dt(r);n=i=e.col,o=s=e.row,c=!0}if(t)if(rn(t))i=Mt(t),a=!0;else if(an(t))s=parseInt(t,10)-1,l=!0;else{const e=Dt(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);return function(e){if(void 0!==e.right&&e.right<e.left){const t=e.left;e.left=e.right,e.right=t}if(void 0!==e.bottom&&e.bottom<e.top){const t=e.top;e.top=e.bottom,e.bottom=t}}(t),t}function gn(e){const t=un(e);if(void 0===t.bottom||void 0===t.right)throw new Error("This does not support unbounded ranges");return t}function pn(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))&&(mn(e)&&e.top>=0&&e.left>=0)}function mn(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 fn(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?`${Lt(s,t)}:${Ot(n)}`:`${Ot(s)}:${Ot(n)}`;if(void 0===n&&void 0!==o)return 0!==s||i?`${Lt(s,t)}:${o+1}`:`${t+1}:${o+1}`;if(void 0!==o&&void 0!==n)return r?Lt(s,t):`${Lt(s,t)}:${Lt(n,o)}`;throw new Error(a("Bad zone format"))}function bn(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?Nn(e,i,"RESIZE",n):r<e[t]?Nn(e,i,"MOVE",n):{...e}}function vn(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?Nn(e,i,"RESIZE",n):r<e[t]?Nn(e,i,"MOVE",n):{...e}}function Sn(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 Cn(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 En(...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 yn(e,t){if(xn(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 wn(e,t){return e.left===t.left&&e.right===t.right&&e.top===t.top&&e.bottom===t.bottom}function xn(e,t){return!(e.bottom<t.top||t.bottom<e.top)&&!(e.right<t.left||t.right<e.left)}function In(e,t,o){const{left:s,right:n,top:i,bottom:r}=o;return e>=s&&e<=n&&t>=i&&t<=r}function Rn(e,t){return wn(En(t,e),t)}function Tn(e,t){const o=e.map(un),s=t.map(un),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(Mn).flat(),a.map(Mn).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=Ln(t);for(const{col:e,row:t}of o)if(!In(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=Ln({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=An(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)?En(e,t):e),o.shift());t.push(e)}return An(t)}(c).map((e=>({...e,bottom:e.bottom===n+1?void 0:e.bottom,right:e.right===i+1?void 0:e.right}))).map(fn)}function An(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=>Rn(e,t)))||o.push(e)}return o.reverse()}function On(e){return{numberOfRows:e.bottom-e.top+1,numberOfCols:e.right-e.left+1}}function _n(e){const{numberOfCols:t,numberOfRows:o}=On(e);return 1===t||1===o}function Mn(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 Ne(o,s+1))for(const o of Ne(n,i+1))t.push({col:e,row:o});return t}function Nn(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?!(Pn(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 Fn(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 Dn(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 Ln(e){return{left:e.col,right:e.col,top:e.row,bottom:e.row}}function Pn(e){return void 0===e.right}function Vn(e){return(e.bottom-e.top+1)*(e.right-e.left+1)}function kn(...e){return e.length<2||1===Tn(e.map(fn),[]).length}class Un{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&&Vn(this.zone)>1?o.push({...e.parts[0]}):2===e.parts.length&&1===Vn(this.zone)&&o.pop(),this.parts=o}static fromRange(e,t){return e instanceof Un?e:new Un(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=an(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(mn(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 Un({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 Bn(e,t,o){const s=o.sheetId===e?t:o.sheetId;return o.clone({sheetId:s})}function Hn(e,t,o){if(!o)return;const s=e.getRangeFromSheetXC(t,o);return s.invalidSheetName||s.invalidXc?void 0:s}function zn(e){const t=[];for(const o of e)for(const e of Mn(o.zone))t.push({...e,sheetId:o.sheetId});return t}function Gn(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 $n(e){const t=[];for(let o=0;o<e;o++){const e={cells:{}};t.push(e)}return t}function Wn(e,t,o){return o.map((o=>o>=e?o+t:o))}function qn(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(We)}function Zn(e,t=1){return t*(e+Z)-Z}function Yn(e,t,o,s){const n=ti(e,t,o,"wrap"===o?.wrapping?s-2*Z:void 0).length;return Zn(Jn(o),n)+2*Y}const jn={};function Xn(e,t,o){const s=Qn(o);if(jn[s]||(jn[s]={}),void 0===jn[s][t]){e.save(),e.font=s;const o=e.measureText(t).width;e.restore(),jn[s][t]=o}return jn[s][t]}function Kn(e){return Math.round(96*e/72)}function Qn(e){return`${e.italic?"italic ":""}${e.bold?"bold":se} ${Jn(e)}px ${ie}`}function Jn(e){return Kn(e?.fontSize||ne)}function ei(e,t,o,s){if(Xn(e,t,s)<=o)return[t];const n=[];let i="";for(let r of t){Xn(e,i+r,s)>o?(n.push(i),i=r):i+=r}return n.push(i),n}function ti(e,t,o,s){o||(o={});const n=[],i=t.includes(xe)?t.split(xe):[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=ei(e,t,s,o),l=i.pop(),c=Xn(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=Xn(e,t,o);i<=a?(r+=t,a-=i):(n.push(r),r=l,a=s-c)}}""!==r&&n.push(r)}return n}function oi(e){return e?e.toLowerCase():""}const si=/([0-9\.]*)px/;function ni(e,t,o,s=!1,n=!1,i=function(e){return Number(e.match(si)?.[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 ii{isFastIdStrategy=!1;fastIdStart=0;setIsFastStrategy(e){this.isFastIdStrategy=e}smallUuid(){return this.isFastIdStrategy?(this.fastIdStart++,String(this.fastIdStart)):window.crypto?"10000000-1000".replace(/[01]/g,(e=>{const t=Number(e);return(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16)})):"xxxxxxxx-xxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))}uuidv4(){return this.isFastIdStrategy?(this.fastIdStart++,String(this.fastIdStart)):window.crypto?"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(e=>{const t=Number(e);return(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/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 ri(e){return e.map(li).sort(((e,t)=>e.sequence-t.sequence))}const ai=new ii;function li(e){const t=e.name,o=e.children,s=e.description,n=e.icon;return{id:e.id||ai.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(li):()=>[],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 ci(e,t){return"REMOVE_COLUMNS_ROWS"===t.type?Cn(e,"COL"===t.dimension?"left":"top",t.elements):"ADD_COLUMNS_ROWS"===t.type?bn(e,"COL"===t.dimension?"left":"top",t.base,t.position,t.quantity):e}function hi(e,t){const o="DELETE_SHEET"===t.type&&t.sheetId;if("sheetId"in t&&e._sheetId!==t.sheetId)return e;{const s=ci(e._zone,t);if(s&&o!==e._sheetId)return{...e,_zone:s}}}class di 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(Ae(e.chartJsConfig))})),t.useEffect((()=>this.updateChartJs(Ae(this.chartRuntime))),(()=>[this.chartRuntime,window.devicePixelRatio]))}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()}}di.props={figure:Object};class ui{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 gi(e,t,o,s){let n=!1;const i=[];for(let s in o){let r=o[s];if(r.labelCell){const e=fi(r.labelCell,t);r.labelCell!==e&&(n=!0,r={...r,labelCell:e})}const a=fi(r.dataRange,t);void 0===a||e.getRangeString(a,a.sheetId)===ce?(n=!0,r=void 0):a!==r.dataRange&&(n=!0,r={...r,dataRange:a}),i[s]=r}let r=s;const a=fi(r,t);a!==r&&(n=!0,r=a);return{isStale:n,dataSets:i.filter(We),labelRange:r}}function pi(e,t,o){return o.map((o=>({dataRange:Bn(e,t,o.dataRange),labelCell:o.labelCell?Bn(e,t,o.labelCell):void 0})))}function mi(e,t,o){return o?Bn(e,t,o):void 0}function fi(e,t){if(!e)return;const o=t(e);switch(o.changeType){case"NONE":return e;case"REMOVE":return;default:return o.range}}function bi(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(vi(e,a,o,s?{top:o.top,bottom:o.top,left:o.left,right:o.left}:void 0))}}else n.push(vi(e,a,r,s?{top:r.top,bottom:r.top,left:r.left,right:r.left}:void 0))}return n}function vi(e,t,o,s){if(o.left!==o.right&&o.top!==o.bottom)throw new Error(`Zone should be a single column or row: ${fn(o)}`);if(s){const n=fn(o),i=fn(s);return{labelCell:e.getRangeFromSheetXC(t,i),dataRange:e.getRangeFromSheetXC(t,n)}}return{labelCell:void 0,dataRange:e.getRangeFromSheetXC(t,fn(o))}}function Si(e,t){const o=t.labelCell?.zone;let s=t.dataRange.zone;if(o){const{numberOfRows:e,numberOfCols:t}=On(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 Ci(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 Ei(e,t){let o;if(e.labelRange){const s=ci(un(e.labelRange),t);o=s?fn(s):void 0}const s=e.dataSets.map(un).map((e=>ci(e,t))).filter(We).map(fn);return{...e,labelRange:o,dataSets:s}}const yi=["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 wi{graphColorIndex=0;next(){return yi[this.graphColorIndex++%yi.length]}}function xi(e){return e&&yt(e)<.3?"#FFFFFF":"#000000"}function Ii(e){if(e.dataSets){const t=void 0!==e.dataSets.find((e=>!nn.test(e)));if(t)return"InvalidDataSet";if(e.dataSets.map(un).some((e=>e.top!==e.bottom&&Pn(e))))return"InvalidDataSet"}return"Success"}function Ri(e){if(e.labelRange){if(!nn.test(e.labelRange||""))return"InvalidLabelRange"}return"Success"}function Ti(e,t,o){if(!o)return!1;if(!e)return!1;if(!t)return!0;const s=Vn(t.dataRange.zone);return!(Vn(e.zone)<s)}function Ai(e,t,o,s){if(e){if("text"===o||t?.type!==bo.number||e.type!==bo.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 Ts(n,{format:e.format,locale:s});const i=Math.abs(parseFloat(n.toFixed(2))).toLocaleString();return"percentage"===o?i+"%":i}}return""}function Oi(e,t,o,s,n){if("text"===t||e?.type!==bo.number||o?.type!==bo.number)return;const i=o.value-e.value;return i>0?s:i<0?n:void 0}function _i(e,t,o){if("text"===o||e?.type!==bo.number||t?.type!==bo.number)return"neutral";const s=t.value-e.value;return s>0?"up":s<0?"down":"neutral"}function Mi(e){return e.keyValue&&!nn.test(e.keyValue)?"InvalidScorecardKeyValue":"Success"}function Ni(e){return e.baseline&&!nn.test(e.baseline)?"InvalidScorecardBaseline":"Success"}const Fi=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"),Di=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 Li=class e extends ui{keyValue;baseline;baselineMode;baselineDescr;background;baselineColorUp;baselineColorDown;fontColor;type="scorecard";constructor(e,t,o){super(e,t,o),this.keyValue=Hn(o,t,e.keyValue),this.baseline=Hn(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,Mi,Ni)}static getDefinitionFromContextCreation(e){return{background:e.background,type:"scorecard",keyValue:e.range?e.range[0]:void 0,title:e.title||"",baselineMode:pe,baselineColorUp:me,baselineColorDown:fe,baseline:e.auxiliaryRange||""}}static transformDefinition(e,t){let o,s;return e.baseline&&(o=ci(un(e.baseline),t)),e.keyValue&&(s=ci(un(e.keyValue),t)),{...e,baseline:o?fn(o):void 0,keyValue:s?fn(s):void 0}}copyForSheetId(t){const o=mi(this.sheetId,t,this.baseline),s=mi(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=fi(this.baseline,t),s=fi(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 Pi(e,t){const o=t.getContext("2d"),s=window.devicePixelRatio||1;if(t.width=e.canvas.width*s,t.height=e.canvas.height*s,o.scale(s,s),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,ni(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(Fi);break;case"up":o.fill(Di)}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,ni(o,e.key.text,e.key.position,e.key.style.underline,e.key.style.strikethrough))}function Vi(e,t=!1,o=!1){return`${o?"italic":""} ${t?"bold":""} ${e}px ${ie}`}function ki({width:e,height:t},o){return new Ui({width:e,height:t},o).computeDesign()}class Ui{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 yt(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 zi(this.runtime.keyValueStyle).getElementMaxFontSize(this.getDrawableHeight(),this)*s,i=new Hi(this.runtime.baselineStyle).getElementMaxFontSize(this.getDrawableHeight(),this)*s;return{title:{font:Vi(18),color:this.secondaryFontColor},keyValue:{color:this.runtime.keyValueStyle?.textColor||this.runtime.fontColor,font:Vi(n,this.runtime.keyValueStyle?.bold,this.runtime.keyValueStyle?.italic),strikethrough:this.runtime.keyValueStyle?.strikethrough,underline:this.runtime.keyValueStyle?.underline},baselineValue:{font:Vi(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:Vi(.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 Hi(this.runtime.baselineStyle),t=new zi(this.runtime.keyValueStyle);return e.getElementWidth(.35,this.context,this)>t.getElementWidth(.65,this.context,this)?e:t}}class Bi{style;constructor(e={}){this.style=e}measureTextWidth(e,t,o){return e.font=Vi(o,this.style.bold,this.style.italic),e.measureText(t).width}}class Hi extends Bi{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 zi extends Bi{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 Gi 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,window.devicePixelRatio]}))}createChart(){const e=this.canvas.el;Pi(ki(e.getBoundingClientRect(),this.runtime),e)}}Gi.props={figure:Object};class $i{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 Wi(e){return/^https?:\/\//i.test(e)?e:`https://${e}`}const qi=new $i;function Zi(e,t){return{url:e=Wi(e),label:t||e,isExternal:!0,isUrlEditable:!0}}qi.add("sheet_URL",{match:e=>ze(e),createLink:(e,t)=>({label:t,url:e,isExternal:!1,isUrlEditable:!1}),urlRepresentation(e,t){const o=$e(e);return t.tryGetSheetName(o)||a("Invalid sheet")},open(e,t){const o=$e(e);t.model.dispatch("ACTIVATE_SHEET",{sheetIdFrom:t.model.getters.getActiveSheetId(),sheetIdTo:o})},sequence:0});const Yi={createLink:Zi,match:e=>ke(e),open:e=>window.open(e,"_blank"),urlRepresentation:e=>e,sequence:0};function ji(e){return qi.getAll().sort(((e,t)=>e.sequence-t.sequence)).find((t=>t.match(e)))||Yi}function Xi(e,t){return ji(e.url).urlRepresentation(e.url,t)}function Ki(e,t){ji(e.url).open(e.url,t)}function Qi(e){if("string"==typeof e){if(Ve(e)){const{label:t,url:o}=Be(e);return ji(o).createLink(o,t)}return ke(e)?Zi(e):void 0}}function Ji(e,t){return tr(er(e||"",t.locale),t)}function er(e,t){if(e.startsWith("="))throw new Error(`Cannot parse "${e}" because it's not a literal value. It's a formula`);return go(e,Oo)?Vo(e,Oo):jt(e,t)?Vo(e,t):function(e){const t=e.toUpperCase();return"TRUE"===t||"FALSE"===t}(e)?"TRUE"===e.toUpperCase():e}function tr(e,t){const o=Qi(e);return o?{...or(er(o.label,t.locale),{format:t.format||Hs(o.label,t.locale)||zs(o.label),locale:t.locale}),link:o}:or(e,t)}function or(e,t){try{for(const o of rr){const s=o(e,t);if(s)return s}return function(e,t){return{type:bo.text,value:e,format:t.format,isAutoSummable:!0,defaultAlign:"left",formattedValue:Ts(e,t)}}((e||"").toString(),t)}catch(e){return ir(new d(c.GenericError,e.message||Ce))}}function sr(e,t){return{type:bo.number,value:e||0,format:t.format,isAutoSummable:!0,defaultAlign:"right",formattedValue:Ts(e,t)}}const nr={type:bo.empty,value:"",format:void 0,isAutoSummable:!0,defaultAlign:"left",formattedValue:""};function ir(e){return{type:bo.error,value:e.errorType,error:e,isAutoSummable:!1,defaultAlign:"center",formattedValue:e.errorType}}const rr=[function(e,t){if(""===e)return function(e){return void 0===e.format?nr:{type:bo.empty,value:"",format:e.format,isAutoSummable:!0,defaultAlign:"left",formattedValue:""}}(t)},function(e,t){if(t.format&&"number"==typeof e&&Ds(t.format))return function(e,t){const o=Ts(e,t);return{type:bo.number,value:e,format:t.format,isAutoSummable:!1,defaultAlign:"right",formattedValue:o}}(e,t)},function(e,t){return"number"==typeof e?sr(e,t):null===e?sr(0,t):void 0},function(e,t){if("boolean"==typeof e)return function(e,t){const o=e?"TRUE":"FALSE";return{type:bo.boolean,value:e,format:t.format,isAutoSummable:!1,defaultAlign:"center",formattedValue:o}}(e,t)}],ar=new $i;ar.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=Ts(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:Ji(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 lr=new $i,cr=/(\d+)$/,hr=/^(.*\D+)/,dr=/^(.*\D+)(\d+)$/;function ur(e,t,o){let s=[],n=!1;for(let i of t){i===e&&(n=!0);const t=i?.isFormula?void 0:Ji(i?.content,{locale:Oo});if(t&&o(t))s.push(t);else{if(n)return s;s=[]}}return s}function gr(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}lr.add("simple_value_copy",{condition:(e,t)=>!(1!==t.length||e.isFormula||e.format&&Ds(e.format)),generateRule:()=>({type:"COPY_MODIFIER"}),sequence:10}).add("increment_alphanumeric_value",{condition:e=>!e.isFormula&&Ji(e.content,{locale:Oo}).type===bo.text&&dr.test(e.content),generateRule:(e,t,o)=>{const s=parseInt(e.content.match(cr)[0]),n=e.content.match(hr)[0],i=e.content.length-n.length,r=ur(e,t,(e=>e.type===bo.text&&dr.test(e.value))).filter((e=>n===e.value.toString().match(hr)[0])).map((e=>parseInt(e.value.toString().match(cr)[0])));let a=gr(r);return["up","left"].includes(o)&&1===r.length&&(a=-a),{type:"ALPHANUMERIC_INCREMENT_MODIFIER",prefix:n,current:s,increment:a,numberPostfixLength:i}},sequence:15}).add("copy_text",{condition:e=>!e.isFormula&&Ji(e.content,{locale:Oo}).type===bo.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&&Ji(e.content,{locale:Oo}).type===bo.number,generateRule:(e,t,o)=>{const s=ur(e,t,(e=>e.type===bo.number)).map((e=>Number(e.value)));let n=gr(s);["up","left"].includes(o)&&1===s.length&&(n=-n);const i=Ji(e.content,{locale:Oo});return{type:"INCREMENT_MODIFIER",increment:n,current:i.type===bo.number?i.value:0}},sequence:40});const pr={};let mr=0;function fr(e,...t){const o="__sheet__"+mr++;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),pr[e]=o}(o,String.raw(e,...t)),function(e){const t=pr[e];t.setAttribute("component",e),document.head.appendChild(t)}(o),o}function br({strikethrough:e,underline:t}){return e||t?`${e?"line-through":""} ${t?"underline":""}`:"none"}function vr(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 Sr(e){let t="";for(const o in e)e[o]&&(t+=`${o}:${e[o]}; `);return t}fr`
|
|
2
2
|
.o-error-tooltip {
|
|
3
3
|
font-size: 13px;
|
|
4
4
|
background-color: white;
|
|
@@ -515,7 +515,7 @@
|
|
|
515
515
|
}
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
|
-
`;class pS extends t.Component{static template="o-spreadsheet-ColorPicker";static defaultProps={currentColor:""};static components={Popover:Br};COLORS=U;state=t.useState({showGradient:!1,currentHslaColor:St(this.props.currentColor)?{...At(this.props.currentColor),a:1}:{h:0,s:100,l:100,a:1},customHexColor:St(this.props.currentColor)?vt(this.props.currentColor):""});get colorPickerStyle(){return void 0!==this.props.maxHeight&&this.props.maxHeight<=0?Sr({display:"none"}):""}get popoverProps(){return{anchorRect:this.props.anchorRect,maxHeight:this.props.maxHeight,positioning:"BottomLeft",verticalOffset:0}}get gradientHueStyle(){return Sr({background:`hsl(${this.state.currentHslaColor?.h||0} 100% 50%)`})}get sliderStyle(){const e=this.state.currentHslaColor?.h||0;return Sr({"margin-left":`${Me(Math.round(e/360*uS),1,uS)-9}px`})}get pointerStyle(){const{s:e,l:t}=this.state.currentHslaColor||{s:0,l:0};return Sr({left:`${-8+Math.round(uS*Me(e/100,0,1))}px`,top:`${-8+Math.round(gS*Me(1-2*t/(200-e),0,1))}px`,background:Tt(this.state.currentHslaColor)})}get colorPreviewStyle(){return Sr({"background-color":Tt(this.state.currentHslaColor)})}get checkmarkColor(){return xi(this.props.currentColor)}get isHexColorInputValid(){return!this.state.customHexColor||St(this.state.customHexColor)}setCustomGradient({x:e,y:t}){const o=Me(e,0,uS),s=Me(t,0,gS),n=o/uS,i=100*n,r=100*(1-s/gS)*(1-.5*n);this.updateColor({s:i,l:r})}setCustomHue(e){const t=Math.round(Me(360*e/uS,0,359));this.updateColor({h:t})}updateColor(e){this.state.currentHslaColor={...this.state.currentHslaColor,...e},this.state.customHexColor=Tt(this.state.currentHslaColor)}onColorClick(e){e&&this.props.onColorPicked(vt(e))}resetColor(){this.props.onColorPicked("")}toggleColorPicker(){this.state.showGradient=!this.state.showGradient}dragGradientPointer(e){const t={x:e.offsetX,y:e.offsetY};this.setCustomGradient(t);const o=e.clientX,s=e.clientY;hS((e=>{const n=e.clientX,i=e.clientY,r={x:t.x+(n-o),y:t.y+(i-s)};this.setCustomGradient(r)}),(()=>{}))}dragHuePointer(e){const t=e.offsetX,o=e.clientX;this.setCustomHue(t);hS((e=>{const s=e.clientX,n=t+(s-o);this.setCustomHue(n)}),(()=>{}))}setHexColor(e){const t=e.target.value.slice(0,7);this.state.customHexColor=t,St(t)&&(this.state.currentHslaColor={...At(t),a:1})}addCustomColor(e){(function(e){try{return Tt(e),!0}catch(e){return!1}})(this.state.currentHslaColor)&&St(this.state.customHexColor)&&this.props.onColorPicked(vt(this.state.customHexColor))}isSameColor(e,t){return function(e,t,o=0){if(!St(e)||!St(t))return!1;const s=xt(e),n=xt(t);return s.a===n.a&&Math.sqrt(((s.r-n.r)/255)**2+((s.g-n.g)/255)**2+((s.b-n.b)/255)**2)<=o}(e,t)}}pS.props={onColorPicked:Function,currentColor:{type:String,optional:!0},maxHeight:{type:Number,optional:!0},anchorRect:Object,disableNoColor:{type:Boolean,optional:!0}},fr`
|
|
518
|
+
`;class pS extends t.Component{static template="o-spreadsheet-ColorPicker";static defaultProps={currentColor:""};static components={Popover:Br};COLORS=U;state=t.useState({showGradient:!1,currentHslaColor:St(this.props.currentColor)?{...At(this.props.currentColor),a:1}:{h:0,s:100,l:100,a:1},customHexColor:St(this.props.currentColor)?vt(this.props.currentColor):""});get colorPickerStyle(){return void 0!==this.props.maxHeight&&this.props.maxHeight<=0?Sr({display:"none"}):""}get popoverProps(){return{anchorRect:this.props.anchorRect,maxHeight:this.props.maxHeight,positioning:"BottomLeft",verticalOffset:0}}get gradientHueStyle(){return Sr({background:`hsl(${this.state.currentHslaColor?.h||0} 100% 50%)`})}get sliderStyle(){const e=this.state.currentHslaColor?.h||0;return Sr({"margin-left":`${Me(Math.round(e/360*uS),1,uS)-9}px`})}get pointerStyle(){const{s:e,l:t}=this.state.currentHslaColor||{s:0,l:0};return Sr({left:`${-8+Math.round(uS*Me(e/100,0,1))}px`,top:`${-8+Math.round(gS*Me(1-2*t/(200-e),0,1))}px`,background:Tt(this.state.currentHslaColor)})}get colorPreviewStyle(){return Sr({"background-color":Tt(this.state.currentHslaColor)})}get checkmarkColor(){return xi(this.props.currentColor)}get isHexColorInputValid(){return!this.state.customHexColor||St(this.state.customHexColor)}setCustomGradient({x:e,y:t}){const o=Me(e,0,uS),s=Me(t,0,gS),n=o/uS,i=100*n,r=100*(1-s/gS)*(1-.5*n);this.updateColor({s:i,l:r})}setCustomHue(e){const t=Math.round(Me(360*e/uS,0,359));this.updateColor({h:t})}updateColor(e){this.state.currentHslaColor={...this.state.currentHslaColor,...e},this.state.customHexColor=Tt(this.state.currentHslaColor)}onColorClick(e){e&&this.props.onColorPicked(vt(e))}resetColor(){this.props.onColorPicked("")}toggleColorPicker(){this.state.showGradient=!this.state.showGradient}dragGradientPointer(e){const t={x:e.offsetX,y:e.offsetY};this.setCustomGradient(t);const o=e.clientX,s=e.clientY;hS((e=>{const n=e.clientX,i=e.clientY,r={x:t.x+(n-o),y:t.y+(i-s)};this.setCustomGradient(r)}),(()=>{}))}dragHuePointer(e){const t=e.offsetX,o=e.clientX;this.setCustomHue(t);hS((e=>{const s=e.clientX,n=t+(s-o);this.setCustomHue(n)}),(()=>{}))}setHexColor(e){const t=e.target.value.replace("##","#").slice(0,7);this.state.customHexColor=t,St(t)&&(this.state.currentHslaColor={...At(t),a:1})}addCustomColor(e){(function(e){try{return Tt(e),!0}catch(e){return!1}})(this.state.currentHslaColor)&&St(this.state.customHexColor)&&this.props.onColorPicked(vt(this.state.customHexColor))}isSameColor(e,t){return function(e,t,o=0){if(!St(e)||!St(t))return!1;const s=xt(e),n=xt(t);return s.a===n.a&&Math.sqrt(((s.r-n.r)/255)**2+((s.g-n.g)/255)**2+((s.b-n.b)/255)**2)<=o}(e,t)}}pS.props={onColorPicked:Function,currentColor:{type:String,optional:!0},maxHeight:{type:Number,optional:!0},anchorRect:Object,disableNoColor:{type:Boolean,optional:!0}},fr`
|
|
519
519
|
.o-color-picker-widget {
|
|
520
520
|
display: flex;
|
|
521
521
|
position: relative;
|
|
@@ -2658,4 +2658,4 @@
|
|
|
2658
2658
|
<tableParts count="${e.filterTables.length}">
|
|
2659
2659
|
${mw(a)}
|
|
2660
2660
|
</tableParts>
|
|
2661
|
-
`}var zT;!function(e){e[e.Ready=0]="Ready",e[e.Running=1]="Running",e[e.RunningCore=2]="RunningCore",e[e.Finalizing=3]="Finalizing"}(zT||(zT={}));function GT(e,t={}){const o=Ae(t);return o.type=e,o}const $T={},WT={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:$},qT={autofillModifiersRegistry:ar,autofillRulesRegistry:lr,cellMenuRegistry:gb,colMenuRegistry:Kv,linkMenuRegistry:Da,functionRegistry:Vf,featurePluginRegistry:dR,statefulUIPluginRegistry:uR,coreViewsPluginRegistry:gR,corePluginRegistry:hR,rowMenuRegistry:eS,sidePanelRegistry:dC,figureRegistry:Dl,chartSidePanelComponentRegistry:yS,chartComponentRegistry:Ol,chartRegistry:Al,topbarMenuRegistry:tS,topbarComponentRegistry:uC,clickableCellRegistry:pR,otRegistry:oS,inverseCommandRegistry:kl,urlRegistry:qi,cellPopoverRegistry:Va,numberFormatMenuRegistry:Qv,repeatLocalCommandTransformRegistry:XI,repeatCommandTransformRegistry:jI},ZT={arg:Tc,toBoolean:Zo,toJsDate:Yo,toNumber:Vo,toString:$o,toXC:Lt,toZone:gn,toUnboundedZone:un,toCartesian:Dt,numberToLetters:Ot,lettersToNumber:Mt,UuidGenerator:ii,formatValue:Ts,createCurrencyFormat:Gs,computeTextWidth:Xn,createEmptyWorkbookData:Yw,createEmptySheet:Zw,createEmptyExcelSheet:jw,getDefaultChartJsRuntime:tl,chartFontColor:xi,ChartColors:wi,EvaluationError:d,CellErrorLevel:h,getFillingMode:rl,rgbaToHex:wt,colorToRGBA:xt,positionToZone:Ln,isDefined:We,isMatrix:Mo,lazy:Xe,genericRepeat:KI,createAction:li,createActions:ri,transformRangeData:hi,deepEquals:Je,isNumber:go,isDateTime:jt},YT={isMarkdownLink:Ve,parseMarkdownLink:Be,markdownLink:Ue,openLink:Ki,urlRepresentation:Xi},jT={ChartPanel:wS,ChartFigure:Ml,ChartJsComponent:di,Grid:bE,GridOverlay:tE,ScorecardChart:Gi,LineConfigPanel:SS,LineBarPieDesignPanel:fS,BarConfigPanel:cS,LineBarPieConfigPanel:lS,GaugeChartConfigPanel:bS,GaugeChartDesignPanel:vS,ScorecardChartConfigPanel:CS,ScorecardChartDesignPanel:ES,FigureComponent:gC,Menu:$r,SelectionInput:rS},XT={useDragAndDropListItems:AS};const KT={DEFAULT_LOCALE:Oo};e.AbstractChart=ui,e.CorePlugin=Kw,e.DispatchResult=Io,e.EvaluationError=d,e.Model=class extends xI{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 ii,c=!0){super(),n===o&&i===s&&(i=()=>!0),a=$w(e,a);const h=zw(e,c);this.state=new JR,this.uuidGenerator=l,this.config=this.setupConfig(r),this.session=this.setupSession(h.revisionId),this.coreGetters={},this.range=new Wx(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 QR(this.getters),this.coreHandlers.push(this.range),this.handlers.push(this.range),this.corePluginConfig=this.setupCorePluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of hR.getAll())this.setupCorePlugin(e,h);Object.assign(this.getters,this.coreGetters),this.session.loadInitialMessages(a);for(let e of gR.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 uR.getAll()){const t=this.setupUiPlugin(e);this.statefulUIPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}for(let e of dR.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)}async leaveSession(){const e=this.getters.isReadonly()?void 0:Xe((()=>this.exportData()));await this.session.leave(e)}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 LI(jR({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.dispatchToHandlers(this.coreHandlers,{type:"UNDO",commands:[e]})}}),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.smallUuid(),name:a("Anonymous").toString()},o=e.transportService||new BR;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(Ao));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=xo(e)?this.checkDispatchAllowedCoreCommand(e):this.checkDispatchAllowedLocalCommand(e);return t.some((e=>"Success"!==e))?new Io(t.flat()):Io.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(GT(e,t));dispatch=(e,t)=>{const o=GT(e,t);let s=this.status;if(this.getters.isReadonly()&&(n=o,!yo.has(n.type)))return new Io("Readonly");var n;if(!this.session.canApplyOptimisticUpdate())return new Io("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((()=>{xo(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(xo(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(xo(o))throw new Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,o)}return Io.Success};dispatchFromCorePlugin=(e,t)=>{const o=GT(e,t),s=this.status;this.status=2;const n=this.isReplayingCommand?this.coreHandlers:this.handlers;return this.dispatchToHandlers(n,o),this.status=s,Io.Success};dispatchToHandlers(e,t){const o=xo(t);for(const s of e)!o&&s instanceof Kw||s.beforeHandle(t);for(const s of e)!o&&s instanceof Kw||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=Yw();for(let t of this.handlers)t instanceof Kw&&t.export(e);return e.revisionId=this.session.getRevisionId()||he,e=Ae(e),e}updateMode(e){"normal"!==e&&this.dispatch("CANCEL_EDITION"),this.config.mode=e,this.trigger("update")}exportXLSX(){this.dispatch("EVALUATE_CELLS");let e={...Yw(),sheets:[jw(Hw,"Sheet1")]};for(let t of this.handlers)t instanceof Xw&&t.exportForExcel(e);return e=Ae(e),BT(e)}garbageCollectExternalResources(){for(const e of this.corePlugins)e.garbageCollectExternalResources()}},e.Registry=$i,e.Revision=FI,e.SPREADSHEET_DIMENSIONS=WT,e.Spreadsheet=UR,e.UIPlugin=qx,e.__info__=$T,e.addFunction=function e(t,o){return Vf.add(t,o),{addFunction:(t,o)=>e(t,o)}},e.astToFormula=bx,e.compile=xx,e.compileTokens=Ix,e.components=jT,e.constants=KT,e.convertAstNodes=gx,e.coreTypes=wo,e.findCellInNewZone=Fn,e.functionCache=wx,e.helpers=ZT,e.hooks=XT,e.invalidateCFEvaluationCommands=Eo,e.invalidateDependenciesCommands=Co,e.invalidateEvaluationCommands=So,e.iterateAstNodes=px,e.links=YT,e.load=zw,e.parse=dx,e.parseTokens=ux,e.readonlyAllowedCommands=yo,e.registries=qT,e.setDefaultSheetViewSize=function(e){ye=e},e.setTranslationMethod=function(e,t=(()=>!0)){n=e,i=t},e.tokenize=jr,$T.version="17.0.58",$T.date="2025-04-18T16:20:26.099Z",$T.hash="88d92de"}(this.o_spreadsheet=this.o_spreadsheet||{},owl);
|
|
2661
|
+
`}var zT;!function(e){e[e.Ready=0]="Ready",e[e.Running=1]="Running",e[e.RunningCore=2]="RunningCore",e[e.Finalizing=3]="Finalizing"}(zT||(zT={}));function GT(e,t={}){const o=Ae(t);return o.type=e,o}const $T={},WT={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:$},qT={autofillModifiersRegistry:ar,autofillRulesRegistry:lr,cellMenuRegistry:gb,colMenuRegistry:Kv,linkMenuRegistry:Da,functionRegistry:Vf,featurePluginRegistry:dR,statefulUIPluginRegistry:uR,coreViewsPluginRegistry:gR,corePluginRegistry:hR,rowMenuRegistry:eS,sidePanelRegistry:dC,figureRegistry:Dl,chartSidePanelComponentRegistry:yS,chartComponentRegistry:Ol,chartRegistry:Al,topbarMenuRegistry:tS,topbarComponentRegistry:uC,clickableCellRegistry:pR,otRegistry:oS,inverseCommandRegistry:kl,urlRegistry:qi,cellPopoverRegistry:Va,numberFormatMenuRegistry:Qv,repeatLocalCommandTransformRegistry:XI,repeatCommandTransformRegistry:jI},ZT={arg:Tc,toBoolean:Zo,toJsDate:Yo,toNumber:Vo,toString:$o,toXC:Lt,toZone:gn,toUnboundedZone:un,toCartesian:Dt,numberToLetters:Ot,lettersToNumber:Mt,UuidGenerator:ii,formatValue:Ts,createCurrencyFormat:Gs,computeTextWidth:Xn,createEmptyWorkbookData:Yw,createEmptySheet:Zw,createEmptyExcelSheet:jw,getDefaultChartJsRuntime:tl,chartFontColor:xi,ChartColors:wi,EvaluationError:d,CellErrorLevel:h,getFillingMode:rl,rgbaToHex:wt,colorToRGBA:xt,positionToZone:Ln,isDefined:We,isMatrix:Mo,lazy:Xe,genericRepeat:KI,createAction:li,createActions:ri,transformRangeData:hi,deepEquals:Je,isNumber:go,isDateTime:jt},YT={isMarkdownLink:Ve,parseMarkdownLink:Be,markdownLink:Ue,openLink:Ki,urlRepresentation:Xi},jT={ChartPanel:wS,ChartFigure:Ml,ChartJsComponent:di,Grid:bE,GridOverlay:tE,ScorecardChart:Gi,LineConfigPanel:SS,LineBarPieDesignPanel:fS,BarConfigPanel:cS,LineBarPieConfigPanel:lS,GaugeChartConfigPanel:bS,GaugeChartDesignPanel:vS,ScorecardChartConfigPanel:CS,ScorecardChartDesignPanel:ES,FigureComponent:gC,Menu:$r,SelectionInput:rS},XT={useDragAndDropListItems:AS};const KT={DEFAULT_LOCALE:Oo};e.AbstractChart=ui,e.CorePlugin=Kw,e.DispatchResult=Io,e.EvaluationError=d,e.Model=class extends xI{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 ii,c=!0){super(),n===o&&i===s&&(i=()=>!0),a=$w(e,a);const h=zw(e,c);this.state=new JR,this.uuidGenerator=l,this.config=this.setupConfig(r),this.session=this.setupSession(h.revisionId),this.coreGetters={},this.range=new Wx(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 QR(this.getters),this.coreHandlers.push(this.range),this.handlers.push(this.range),this.corePluginConfig=this.setupCorePluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of hR.getAll())this.setupCorePlugin(e,h);Object.assign(this.getters,this.coreGetters),this.session.loadInitialMessages(a);for(let e of gR.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 uR.getAll()){const t=this.setupUiPlugin(e);this.statefulUIPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}for(let e of dR.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)}async leaveSession(){const e=this.getters.isReadonly()?void 0:Xe((()=>this.exportData()));await this.session.leave(e)}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 LI(jR({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.dispatchToHandlers(this.coreHandlers,{type:"UNDO",commands:[e]})}}),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.smallUuid(),name:a("Anonymous").toString()},o=e.transportService||new BR;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(Ao));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=xo(e)?this.checkDispatchAllowedCoreCommand(e):this.checkDispatchAllowedLocalCommand(e);return t.some((e=>"Success"!==e))?new Io(t.flat()):Io.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(GT(e,t));dispatch=(e,t)=>{const o=GT(e,t);let s=this.status;if(this.getters.isReadonly()&&(n=o,!yo.has(n.type)))return new Io("Readonly");var n;if(!this.session.canApplyOptimisticUpdate())return new Io("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((()=>{xo(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(xo(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(xo(o))throw new Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,o)}return Io.Success};dispatchFromCorePlugin=(e,t)=>{const o=GT(e,t),s=this.status;this.status=2;const n=this.isReplayingCommand?this.coreHandlers:this.handlers;return this.dispatchToHandlers(n,o),this.status=s,Io.Success};dispatchToHandlers(e,t){const o=xo(t);for(const s of e)!o&&s instanceof Kw||s.beforeHandle(t);for(const s of e)!o&&s instanceof Kw||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=Yw();for(let t of this.handlers)t instanceof Kw&&t.export(e);return e.revisionId=this.session.getRevisionId()||he,e=Ae(e),e}updateMode(e){"normal"!==e&&this.dispatch("CANCEL_EDITION"),this.config.mode=e,this.trigger("update")}exportXLSX(){this.dispatch("EVALUATE_CELLS");let e={...Yw(),sheets:[jw(Hw,"Sheet1")]};for(let t of this.handlers)t instanceof Xw&&t.exportForExcel(e);return e=Ae(e),BT(e)}garbageCollectExternalResources(){for(const e of this.corePlugins)e.garbageCollectExternalResources()}},e.Registry=$i,e.Revision=FI,e.SPREADSHEET_DIMENSIONS=WT,e.Spreadsheet=UR,e.UIPlugin=qx,e.__info__=$T,e.addFunction=function e(t,o){return Vf.add(t,o),{addFunction:(t,o)=>e(t,o)}},e.astToFormula=bx,e.compile=xx,e.compileTokens=Ix,e.components=jT,e.constants=KT,e.convertAstNodes=gx,e.coreTypes=wo,e.findCellInNewZone=Fn,e.functionCache=wx,e.helpers=ZT,e.hooks=XT,e.invalidateCFEvaluationCommands=Eo,e.invalidateDependenciesCommands=Co,e.invalidateEvaluationCommands=So,e.iterateAstNodes=px,e.links=YT,e.load=zw,e.parse=dx,e.parseTokens=ux,e.readonlyAllowedCommands=yo,e.registries=qT,e.setDefaultSheetViewSize=function(e){ye=e},e.setTranslationMethod=function(e,t=(()=>!0)){n=e,i=t},e.tokenize=jr,$T.version="17.0.59",$T.date="2025-04-25T08:04:05.375Z",$T.hash="eb92388"}(this.o_spreadsheet=this.o_spreadsheet||{},owl);
|
package/dist/o_spreadsheet.xml
CHANGED
|
@@ -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.
|
|
5
|
-
@date 2025-04-
|
|
6
|
-
@hash
|
|
4
|
+
@version 17.0.59
|
|
5
|
+
@date 2025-04-25T08:04:39.525Z
|
|
6
|
+
@hash eb92388
|
|
7
7
|
-->
|
|
8
8
|
<odoo>
|
|
9
9
|
<t t-name="o-spreadsheet-ActionButton">
|
|
@@ -376,7 +376,6 @@
|
|
|
376
376
|
t-on-click.stop=""
|
|
377
377
|
t-att-value="state.customHexColor"
|
|
378
378
|
t-on-input="setHexColor"
|
|
379
|
-
maxlength="7"
|
|
380
379
|
/>
|
|
381
380
|
<div class="o-color-preview" t-att-style="colorPreviewStyle"/>
|
|
382
381
|
</div>
|