@odoo/o-spreadsheet 17.0.48 → 17.0.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* This file is generated by o-spreadsheet build tools. Do not edit it.
|
|
4
4
|
* @see https://github.com/odoo/o-spreadsheet
|
|
5
|
-
* @version 17.0.
|
|
6
|
-
* @date 2025-02-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.0.49
|
|
6
|
+
* @date 2025-02-10T08:55:47.771Z
|
|
7
|
+
* @hash 1049319
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
'use strict';
|
|
@@ -688,9 +688,16 @@ function deepEquals(o1, o2) {
|
|
|
688
688
|
}
|
|
689
689
|
return true;
|
|
690
690
|
}
|
|
691
|
-
/**
|
|
691
|
+
/**
|
|
692
|
+
* Check if the given array contains all the values of the other array.
|
|
693
|
+
* It makes the assumption that both array do not contain duplicates.
|
|
694
|
+
*/
|
|
692
695
|
function includesAll(arr, values) {
|
|
693
|
-
|
|
696
|
+
if (arr.length < values.length) {
|
|
697
|
+
return false;
|
|
698
|
+
}
|
|
699
|
+
const set = new Set(arr);
|
|
700
|
+
return values.every((value) => set.has(value));
|
|
694
701
|
}
|
|
695
702
|
/**
|
|
696
703
|
* Return an object with all the keys in the object that have a falsy value removed.
|
|
@@ -57841,6 +57848,6 @@ exports.setTranslationMethod = setTranslationMethod;
|
|
|
57841
57848
|
exports.tokenize = tokenize;
|
|
57842
57849
|
|
|
57843
57850
|
|
|
57844
|
-
__info__.version = "17.0.
|
|
57845
|
-
__info__.date = "2025-02-
|
|
57846
|
-
__info__.hash = "
|
|
57851
|
+
__info__.version = "17.0.49";
|
|
57852
|
+
__info__.date = "2025-02-10T08:55:47.771Z";
|
|
57853
|
+
__info__.hash = "1049319";
|
|
@@ -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-02-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.0.49
|
|
6
|
+
* @date 2025-02-10T08:55:47.771Z
|
|
7
|
+
* @hash 1049319
|
|
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';
|
|
@@ -686,9 +686,16 @@ function deepEquals(o1, o2) {
|
|
|
686
686
|
}
|
|
687
687
|
return true;
|
|
688
688
|
}
|
|
689
|
-
/**
|
|
689
|
+
/**
|
|
690
|
+
* Check if the given array contains all the values of the other array.
|
|
691
|
+
* It makes the assumption that both array do not contain duplicates.
|
|
692
|
+
*/
|
|
690
693
|
function includesAll(arr, values) {
|
|
691
|
-
|
|
694
|
+
if (arr.length < values.length) {
|
|
695
|
+
return false;
|
|
696
|
+
}
|
|
697
|
+
const set = new Set(arr);
|
|
698
|
+
return values.every((value) => set.has(value));
|
|
692
699
|
}
|
|
693
700
|
/**
|
|
694
701
|
* Return an object with all the keys in the object that have a falsy value removed.
|
|
@@ -57804,6 +57811,6 @@ const constants = {
|
|
|
57804
57811
|
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 };
|
|
57805
57812
|
|
|
57806
57813
|
|
|
57807
|
-
__info__.version = "17.0.
|
|
57808
|
-
__info__.date = "2025-02-
|
|
57809
|
-
__info__.hash = "
|
|
57814
|
+
__info__.version = "17.0.49";
|
|
57815
|
+
__info__.date = "2025-02-10T08:55:47.771Z";
|
|
57816
|
+
__info__.hash = "1049319";
|
|
@@ -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-02-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.0.49
|
|
6
|
+
* @date 2025-02-10T08:55:47.771Z
|
|
7
|
+
* @hash 1049319
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
(function (exports, owl) {
|
|
@@ -687,9 +687,16 @@
|
|
|
687
687
|
}
|
|
688
688
|
return true;
|
|
689
689
|
}
|
|
690
|
-
/**
|
|
690
|
+
/**
|
|
691
|
+
* Check if the given array contains all the values of the other array.
|
|
692
|
+
* It makes the assumption that both array do not contain duplicates.
|
|
693
|
+
*/
|
|
691
694
|
function includesAll(arr, values) {
|
|
692
|
-
|
|
695
|
+
if (arr.length < values.length) {
|
|
696
|
+
return false;
|
|
697
|
+
}
|
|
698
|
+
const set = new Set(arr);
|
|
699
|
+
return values.every((value) => set.has(value));
|
|
693
700
|
}
|
|
694
701
|
/**
|
|
695
702
|
* Return an object with all the keys in the object that have a falsy value removed.
|
|
@@ -57840,9 +57847,9 @@
|
|
|
57840
57847
|
exports.tokenize = tokenize;
|
|
57841
57848
|
|
|
57842
57849
|
|
|
57843
|
-
__info__.version = "17.0.
|
|
57844
|
-
__info__.date = "2025-02-
|
|
57845
|
-
__info__.hash = "
|
|
57850
|
+
__info__.version = "17.0.49";
|
|
57851
|
+
__info__.date = "2025-02-10T08:55:47.771Z";
|
|
57852
|
+
__info__.hash = "1049319";
|
|
57846
57853
|
|
|
57847
57854
|
|
|
57848
57855
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(e,t){"use strict";const o=e=>e,s=()=>!1;let n=o,i=s;function r(e,...t){if(1!==t.length||"object"!=typeof t[0]||t[0]instanceof String)t.length>0&&(e=e.replace(/\%s/g,(()=>t.shift())));else{const o=t[0];e=e.replace(/\%\(([^\)]+)\)s/g,((e,t)=>o[t]))}return e}const a=function(e,...t){return i()?r(n(e),...t):new l(e,t)};class l extends String{values;constructor(e,t){super(e),this.values=t}valueOf(){const e=super.valueOf();return i()?r(n(e),...this.values):r(e,...this.values)}toString(){return this.valueOf()}}var c,h;!function(e){e.NotAvailable="#N/A",e.InvalidReference="#REF",e.BadExpression="#BAD_EXPR",e.CircularDependency="#CYCLE",e.UnknownFunction="#NAME?",e.GenericError="#ERROR"}(c||(c={})),function(e){e[e.silent=0]="silent",e[e.error=1]="error"}(h||(h={}));class d extends Error{errorType;logLevel;constructor(e,t,o=h.error){super(t),this.errorType=e,this.logLevel=o}get isVerbose(){return this.logLevel>h.silent}}class u extends d{constructor(e){super(c.BadExpression,e)}}class g extends d{constructor(){super(c.CircularDependency,a("Circular reference"))}}class p extends d{constructor(){super(c.InvalidReference,a("Invalid reference"))}}class m extends d{constructor(e=void 0){super(c.NotAvailable,e||a("Data not available"),e?h.error:h.silent)}}class f extends d{constructor(e){super(c.UnknownFunction,a('Unknown function: "%s"',e))}}const b=.5,v="#f5f5f5",S="#F8F9FA",C="#E8EAED",E="#595959",w="#666666",y="#c9ccd2",x="#3266ca",I="#FFFFFF",R="#EBEBEB",T="#CACACA",A=11982760,O="#01666b",_="#188038",M="#E6F4EA",N="#CEEAD6",F="#E0E2E4",D="#4A4F59",L="#999",P="#E2E3E3",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=Z,X=21,j=17,K=2*G,Q=250,J={align:"left",verticalAlign:"bottom",wrapping:"overflow",bold:!1,italic:!1,strikethrough:!1,underline:!1,fontSize:10,fillColor:"",textColor:""},ee=J.verticalAlign,te=J.wrapping,oe="400",se=J.fontSize,ne="'Roboto', arial",ie="thin",re="#000000",ae={style:"thin",color:_},le=c.InvalidReference,ce="START_REVISION",he=1,de=20,ue="??",ge="difference",pe="#00A04A",me="#DC6965",fe=["'","*","?","/","\\","[","]"],be=/'|\*|\?|\/|\\|\[|\]/,ve="|",Se=a("Invalid expression");var Ce;!function(e){e[e.Grid=0]="Grid",e[e.Highlight=5]="Highlight",e[e.HeaderGroupingButton=6]="HeaderGroupingButton",e[e.Figure=10]="Figure",e[e.ScrollBar=15]="ScrollBar",e[e.GridPopover=19]="GridPopover",e[e.GridComposer=20]="GridComposer",e[e.Dropdown=21]="Dropdown",e[e.IconPicker=25]="IconPicker",e[e.TopBarComposer=30]="TopBarComposer",e[e.Popover=35]="Popover",e[e.FigureAnchor=1e3]="FigureAnchor",e[e.FigureSnapLine=1001]="FigureSnapLine"}(Ce||(Ce={}));let Ee=0;function we(){return Ee}const ye="\n",xe=[6,7,8,9,10,11,12,14,18,24,36];function Ie(e){return'"'===e[0]&&(e=e.slice(1)),'"'===e[e.length-1]&&"\\"!==e[e.length-2]?e.slice(0,e.length-1):e}function Re(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Te(e){const t=Array.isArray(e)?[]:{};switch(typeof e){case"object":if(null===e)return e;if(function(e){return"clone"in e&&e.clone instanceof Function}(e))return e.clone();if(!(function(e){return"object"==typeof e&&null!==e&&(e?.constructor===Object||void 0===e?.constructor)}(e)||e instanceof Array))throw new Error("Unsupported type: only objects and arrays are supported");for(const o in e)t[o]=Te(e[o]);return t;case"number":case"string":case"boolean":case"function":case"undefined":return e;default:throw new Error("Unsupported type: "+typeof e)}}function Ae(e){return e.startsWith("'")&&(e=e.slice(1,-1).replace(/''/g,"'")),e}function Oe(e){return e.match(/\w/g)?.length!==e.length&&(e=`'${e}'`),e}function _e(e,t,o){return e<t?t:e>o?o:e}function Me(e,t,o=1){if(t<=e&&o>0)return[];if(0===o)throw new Error("range() step must not be zero");const s=Math.ceil(Math.abs((t-e)/o)),n=Array(s);for(let t=0;t<s;t++)n[t]=e+t*o;return n}function Ne(e){return e.reduce(((e,t,o,s)=>{if(1===Math.abs(t-s[o-1])){e[e.length-1].push(t)}else e.push([t]);return e}),[])}function*Fe(e,t){t.next();for(const o of e){const e=t.next();yield{...o,next:e.done?void 0:e.value}}}const De=/^\[(.+)\]\((.+)\)$/,Le=/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$/;function Pe(e){return De.test(e)}function Ve(e){return Le.test(e)}function ke(e,t){return`[${e}](${t})`}function Ue(e){const t=e.match(De)||[],o=t[1],s=t[2];if(!o||!s)throw new Error(`Could not parse markdown link ${e}.`);return{label:o,url:s}}const Be="o-spreadsheet://";function He(e){return e.startsWith(Be)}function ze(e){return`${Be}${e}`}function Ge(e){if(e.startsWith(Be))return e.substr(Be.length);throw new Error(`${e} is not a valid sheet link`)}function $e(e){return void 0!==e}function We(e){return null!==e}function qe(e){return void 0===e||Object.values(e).every((e=>"object"==typeof e?qe(e):!e))}function Ze(e,t){for(const o in t)if(Qe(t[o],e))return parseInt(o,10);const o=Object.keys(t),s=0===o.length?0:dt(o.map((e=>parseInt(e,10))));return t[s+1]=e,s+1}function Ye(e){let t="";for(let o=0,s=e.length;o<s;o++)t+=e[o];return t}function 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 je(e,t){let o=e.slice(t).find((e=>e));return o||(o=e.slice(0,t).reverse().find((e=>e))),o||""}function Ke(e,t){return"after"===e?t+1:t}function Qe(e,t){if(e===t)return!0;if(e&&!t||t&&!e)return!1;if(typeof e!=typeof t)return!1;if("object"!=typeof e)return!1;for(const o in t)if(!(o in e)&&void 0!==t[o])return!1;for(const o in e){if(typeof e[o]!=typeof t[o])return!1;if("object"==typeof e[o]){if(!Qe(e[o],t[o]))return!1}else if(e[o]!==t[o])return!1}return!0}function Je(e,t){return t.every((t=>e.includes(t)))}function et(e){const t={...e};return Object.keys(t).forEach((e=>!t[e]&&delete t[e])),t}const tt=[" ","\t","\f","\v",String.fromCharCode(parseInt("00a0",16)),String.fromCharCode(parseInt("1680",16)),String.fromCharCode(parseInt("2000",16)),String.fromCharCode(parseInt("200a",16)),String.fromCharCode(parseInt("2028",16)),String.fromCharCode(parseInt("2029",16)),String.fromCharCode(parseInt("202f",16)),String.fromCharCode(parseInt("205f",16)),String.fromCharCode(parseInt("3000",16)),String.fromCharCode(parseInt("feff",16))],ot=new RegExp(tt.join("|"),"g"),st=/(\r\n|\r)/g;function nt(e){return e?e.replace(st,ye):""}function it(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 rt 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 at(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 lt(e,t){return e.filter(((e,o)=>!t.includes(o)))}function ct(e){return e.split("\n").map((e=>e.replace(/\s+/g," ").trim())).join("\n")}function ht(e,t,o){return t>o?ht(e,o,t):e>=t&&e<=o}function dt(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 ut(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 gt=/rgba?\(|\s+|\)/gi,pt=/^#([A-F\d]{2}){3,4}$/,mt=["#eb6d00","#0074d9","#ad8e00","#169ed4","#b10dc9","#00a82d","#00a3a3","#f012be","#3d9970","#111111","#62A300","#ff4136","#949494","#85144b","#001f3f"];function ft(e){return bt(e.toString(16).padStart(6,"0"))}function bt(e){let t=e;if(e.startsWith("rgb")?t=function(e){const t=e.replace(gt,"").split(",");let o=255;if(3!==t.length&&4!==t.length)throw new Error("invalid color");if(4===t.length){const e=parseFloat(t.pop()||"1");o=Math.round(255*(e||1))}const s=t.map((e=>parseInt(e,10)));255!==o&&s.push(o);return"#"+Ye(s.map((e=>e.toString(16).padStart(2,"0")))).toUpperCase()}(e):(t=e.replace("#","").toUpperCase(),3!==t.length&&4!==t.length||(t=t.split("").reduce(((e,t)=>e+t+t),"")),t=`#${t}`),!pt.test(t))throw new Error(`invalid color input: ${e}`);return t}function vt(e){try{return bt(e),!0}catch(e){return!1}}const St=e=>e>=0&&e<=255;function Ct(e,t,o,s=1){if(!St(e)||!St(t)||!St(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 Et(e){let{r:t,g:o,b:s}=yt(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 yt(e){let t,o,s,n;if(7===(e=bt(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 xt(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 It(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 Rt(e){return wt(xt(e))}function Tt(e){return It(yt(e))}function At(e){if(e<0)throw new Error(`number must be positive. Got ${e}`);return e<26?String.fromCharCode(65+e):At(Math.floor(e/26)-1)+At(e%26)}const Ot={};for(const $T of"ABCDEFGHIJKLMNOPQRSTUVWXYZ"){const WT=$T.charCodeAt(0)-64;Ot[$T]=WT,Ot[$T.toLowerCase()]=WT}function _t(e){let t=-1;let o=1;for(let s=e.length-1;s>=0;s--){t+=Ot[e[s]]*o,o*=26}return t}function Mt(e){return e>="A"&&e<="Z"||e>="a"&&e<="z"}function Nt(e){return e>="0"&&e<="9"}function Ft(e){let t;e=e.trim();for(let o=0;o<e.length;o++){const s=e[o];if(!t){if("$"===s&&0===o||Mt(s))continue;t=o}if(!Nt(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=_t(o),i=Number(s)-1;if(isNaN(i))throw new Error(`Invalid cell description: ${e}`);return{col:n,row:i}}function Dt(e,t,o={colFixed:!1,rowFixed:!1}){return(o.colFixed?"$":"")+At(e)+(o.rowFixed?"$":"")+String(t+1)}class Lt{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 Lt(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds())}static now(){const e=new Date;return new Lt(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 Pt=new Lt(1899,11,30),Vt=864e5,kt=2e3,Ut=Lt.now().getFullYear(),Bt=Lt.now().getMonth(),Ht=Lt.fromTimestamp(0).getTime()-Pt.getTime(),zt=/^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/,Gt=/^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/,$t=/\/|-|\s/,Wt=/^(\d{1,4})[\/-\s](\d{1,4})([\/-\s](\d{1,4}))?$/,qt=/((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;function Zt(e,t){switch(typeof e){case"number":return e;case"string":return Yt(e,t)?jt(e,t)?.value:!e||isNaN(Number(e))?void 0:Number(e);default:return}}function Yt(e,t){return null!==jt(e,t)}const Xt=new Map;function jt(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(qt);if(s){if(o=function(e){if(e=e.trim(),qt.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 Lt(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(Wt);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($t)[0];if(n=function(e,t){let{year:o,month:s,day:n}=e;const i=function(e){if(!e)return Bt;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 Ut;const t=Number(e);switch(e.length){case 1:return kt+t;case 2:return kt+(kt+t>Ut+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 Lt(a,i,r);if(h.getMonth()!==i||h.getDate()!==r)return null;const d=h.getTime()-Pt.getTime(),u=function(e,t,o,s){const n=e.year?s?"yyyy":"yy":void 0,i=e.month?o?"mm":"m":void 0,r=e.day?o?"dd":"d":void 0;switch(e.type){case"mdy":return[i,r,n].filter($e).join(t);case"ymd":return[n,i,r].filter($e).join(t);case"dmy":return[r,i,n].filter($e).join(t)}}(e,t,l,c);return{value:Math.round(d/Vt),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 Lt(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 Kt(e){const t=Math.trunc(e);let o=Lt.fromTimestamp(t*Vt-Ht),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 Qt(e){return Math.round(Jt(e))}function Jt(e){return(e.getTime()-Pt.getTime())/Vt}function eo(e){return new Lt(e.getFullYear(),e.getMonth()+1,0).getDate()}function to(e){return eo(e)===e.getDate()}function oo(e,t,o){const s=e.getFullYear(),n=e.getMonth(),i=e.getDate(),r=new Lt(s,n+t,1);return o&&i===eo(e)||i>eo(r)?r.setDate(eo(r)):r.setDate(i),r}function so(e){const t=Math.trunc(e);return t%4==0&&t%100!=0||t%400==0}function no(e,t,o){if(e===t)return 0;if(e>t){const o=t;t=e,e=o}const s=Kt(e),n=Kt(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===(so(c)?29:28)&&(i=30,1===l&&r===(so(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+=so(o)?366:365;o=t/e}else s?so(c)&&(o=366):(so(c)&&a<2&&(o=366),so(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 io(e,t){const o=12*(t.getFullYear()-e.getFullYear())+t.getMonth()-e.getMonth();return e.getDate()>t.getDate()?o-1:o}function ro(e,t){const o=e.getTime(),s=t.getTime();return Math.floor((s-o)/Vt)}function ao(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 lo(e,t,o){return t>o?lo(e,o,t):(e=Math.trunc(e),t=Math.trunc(t),o=Math.trunc(o),e>=t&&e<=o)}const co=at((function(e){return e=Re(e),new RegExp(`(^-?\\d+(${e}?\\d*(e\\d+)?)?|^-?${e}\\d+)(?!\\w|!)`)})),ho=at((function(e){const t=Re(e.decimalSeparator),o="(\\s*"+`(\\d+(${Re(e.thousandsSeparator||"")}\\d{3,})*(${t}\\d*)?)`+"|"+`(${t}\\d+)`+")(e(\\+|-)?\\d+)?(\\s*%)?",s="(\\s*-)?",n="(\\s*[\\$€])?",i="^(("+[s+n+o,s+o+n,n+s+o].join(")|(")+"))$";return new RegExp(i,"i")}));function uo(e,t){return!!e&&ho(t).test(e.trim())}const go=at((function(e){return new RegExp(`[$€${Re(e.thousandsSeparator||"")}]`,"g")}));function po(e,t){e=e.replace(go(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 mo(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 fo,bo;!function(e){e.boolean="boolean",e.number="number",e.text="text",e.empty="empty",e.error="error"}(fo||(fo={})),function(e){e.PlainText="text/plain",e.Html="text/html"}(bo||(bo={}));const vo=new Set(["RENAME_SHEET","DELETE_SHEET","CREATE_SHEET","ADD_COLUMNS_ROWS","REMOVE_COLUMNS_ROWS","UNDO","REDO","ADD_MERGE","UPDATE_LOCALE"]),So=new Set([...vo,"MOVE_RANGES"]),Co=new Set([...vo,"DUPLICATE_SHEET","EVALUATE_CELLS","ADD_CONDITIONAL_FORMAT","REMOVE_CONDITIONAL_FORMAT","CHANGE_CONDITIONAL_FORMAT_PRIORITY"]),Eo=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","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 yo(e){return wo.has(e.type)}class xo{reasons;constructor(e=[]){Array.isArray(e)||(e=[e]),e=[...new Set(e)],this.reasons=e.filter((e=>"Success"!==e))}static get Success(){return Io}get isSuccessful(){return 0===this.reasons.length}isCancelledBecause(e){return this.reasons.includes(e)}}const Io=new xo;var Ro;e.CommandResult=void 0,(Ro=e.CommandResult||(e.CommandResult={})).Success="Success",Ro.CancelledForUnknownReason="CancelledForUnknownReason",Ro.WillRemoveExistingMerge="WillRemoveExistingMerge",Ro.MergeIsDestructive="MergeIsDestructive",Ro.CellIsMerged="CellIsMerged",Ro.InvalidTarget="InvalidTarget",Ro.EmptyUndoStack="EmptyUndoStack",Ro.EmptyRedoStack="EmptyRedoStack",Ro.NotEnoughElements="NotEnoughElements",Ro.NotEnoughSheets="NotEnoughSheets",Ro.MissingSheetName="MissingSheetName",Ro.UnchangedSheetName="UnchangedSheetName",Ro.DuplicatedSheetName="DuplicatedSheetName",Ro.DuplicatedSheetId="DuplicatedSheetId",Ro.ForbiddenCharactersInSheetName="ForbiddenCharactersInSheetName",Ro.WrongSheetMove="WrongSheetMove",Ro.WrongSheetPosition="WrongSheetPosition",Ro.InvalidAnchorZone="InvalidAnchorZone",Ro.SelectionOutOfBound="SelectionOutOfBound",Ro.TargetOutOfSheet="TargetOutOfSheet",Ro.WrongCutSelection="WrongCutSelection",Ro.WrongPasteSelection="WrongPasteSelection",Ro.WrongPasteOption="WrongPasteOption",Ro.WrongFigurePasteOption="WrongFigurePasteOption",Ro.EmptyClipboard="EmptyClipboard",Ro.EmptyRange="EmptyRange",Ro.InvalidRange="InvalidRange",Ro.InvalidZones="InvalidZones",Ro.InvalidSheetId="InvalidSheetId",Ro.InvalidFigureId="InvalidFigureId",Ro.InputAlreadyFocused="InputAlreadyFocused",Ro.MaximumRangesReached="MaximumRangesReached",Ro.MinimumRangesReached="MinimumRangesReached",Ro.InvalidChartDefinition="InvalidChartDefinition",Ro.InvalidDataSet="InvalidDataSet",Ro.InvalidLabelRange="InvalidLabelRange",Ro.InvalidScorecardKeyValue="InvalidScorecardKeyValue",Ro.InvalidScorecardBaseline="InvalidScorecardBaseline",Ro.InvalidGaugeDataRange="InvalidGaugeDataRange",Ro.EmptyGaugeRangeMin="EmptyGaugeRangeMin",Ro.GaugeRangeMinNaN="GaugeRangeMinNaN",Ro.EmptyGaugeRangeMax="EmptyGaugeRangeMax",Ro.GaugeRangeMaxNaN="GaugeRangeMaxNaN",Ro.GaugeRangeMinBiggerThanRangeMax="GaugeRangeMinBiggerThanRangeMax",Ro.GaugeLowerInflectionPointNaN="GaugeLowerInflectionPointNaN",Ro.GaugeUpperInflectionPointNaN="GaugeUpperInflectionPointNaN",Ro.GaugeLowerBiggerThanUpper="GaugeLowerBiggerThanUpper",Ro.InvalidAutofillSelection="InvalidAutofillSelection",Ro.WrongComposerSelection="WrongComposerSelection",Ro.MinBiggerThanMax="MinBiggerThanMax",Ro.LowerBiggerThanUpper="LowerBiggerThanUpper",Ro.MidBiggerThanMax="MidBiggerThanMax",Ro.MinBiggerThanMid="MinBiggerThanMid",Ro.FirstArgMissing="FirstArgMissing",Ro.SecondArgMissing="SecondArgMissing",Ro.MinNaN="MinNaN",Ro.MidNaN="MidNaN",Ro.MaxNaN="MaxNaN",Ro.ValueUpperInflectionNaN="ValueUpperInflectionNaN",Ro.ValueLowerInflectionNaN="ValueLowerInflectionNaN",Ro.MinInvalidFormula="MinInvalidFormula",Ro.MidInvalidFormula="MidInvalidFormula",Ro.MaxInvalidFormula="MaxInvalidFormula",Ro.ValueUpperInvalidFormula="ValueUpperInvalidFormula",Ro.ValueLowerInvalidFormula="ValueLowerInvalidFormula",Ro.InvalidSortZone="InvalidSortZone",Ro.WaitingSessionConfirmation="WaitingSessionConfirmation",Ro.MergeOverlap="MergeOverlap",Ro.TooManyHiddenElements="TooManyHiddenElements",Ro.Readonly="Readonly",Ro.InvalidViewportSize="InvalidViewportSize",Ro.InvalidScrollingDirection="InvalidScrollingDirection",Ro.FigureDoesNotExist="FigureDoesNotExist",Ro.InvalidConditionalFormatId="InvalidConditionalFormatId",Ro.InvalidCellPopover="InvalidCellPopover",Ro.EmptyTarget="EmptyTarget",Ro.InvalidFreezeQuantity="InvalidFreezeQuantity",Ro.FrozenPaneOverlap="FrozenPaneOverlap",Ro.ValuesNotChanged="ValuesNotChanged",Ro.InvalidFilterZone="InvalidFilterZone",Ro.FilterOverlap="FilterOverlap",Ro.FilterNotFound="FilterNotFound",Ro.MergeInFilter="MergeInFilter",Ro.NonContinuousTargets="NonContinuousTargets",Ro.DuplicatedFigureId="DuplicatedFigureId",Ro.InvalidSelectionStep="InvalidSelectionStep",Ro.DuplicatedChartId="DuplicatedChartId",Ro.ChartDoesNotExist="ChartDoesNotExist",Ro.InvalidHeaderIndex="InvalidHeaderIndex",Ro.InvalidQuantity="InvalidQuantity",Ro.MoreThanOneColumnSelected="MoreThanOneColumnSelected",Ro.EmptySplitSeparator="EmptySplitSeparator",Ro.SplitWillOverwriteContent="SplitWillOverwriteContent",Ro.NoSplitSeparatorInSelection="NoSplitSeparatorInSelection",Ro.NoActiveSheet="NoActiveSheet",Ro.InvalidLocale="InvalidLocale",Ro.AlreadyInPaintingFormatMode="AlreadyInPaintingFormatMode",Ro.MoreThanOneRangeSelected="MoreThanOneRangeSelected",Ro.NoColumnsProvided="NoColumnsProvided",Ro.ColumnsNotIncludedInZone="ColumnsNotIncludedInZone",Ro.DuplicatesColumnsSelected="DuplicatesColumnsSelected",Ro.InvalidHeaderGroupStartEnd="InvalidHeaderGroupStartEnd",Ro.HeaderGroupAlreadyExists="HeaderGroupAlreadyExists",Ro.UnknownHeaderGroup="UnknownHeaderGroup",Ro.UnknownDataValidationRule="UnknownDataValidationRule",Ro.UnknownDataValidationCriterionType="UnknownDataValidationCriterionType",Ro.InvalidDataValidationCriterionValue="InvalidDataValidationCriterionValue",Ro.InvalidNumberOfCriterionValues="InvalidNumberOfCriterionValues",Ro.BlockingValidationRule="BlockingValidationRule",Ro.InvalidCopyPasteSelection="InvalidCopyPasteSelection",Ro.NoChanges="NoChanges",Ro.InvalidInputId="InvalidInputId";const To=[{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:";"}],Ao=To[0],Oo=["thin","medium","thick","dashed","dotted"];function _o(e){return Array.isArray(e)&&Array.isArray(e[0])}var Mo,No;!function(e){e.UP="up",e.DOWN="down",e.LEFT="left",e.RIGHT="right"}(Mo||(Mo={})),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"}(No||(No={}));const Fo=["number","string","boolean","undefined"];function Do(e,t){if(!e())throw new d(c.GenericError,t)}const Lo=e=>a("The function [[FUNCTION_NAME]] expects a number value, but '%s' is a string, and cannot be coerced to a number.",e);function Po(e,t){switch(typeof e){case"number":return e;case"boolean":return e?1:0;case"string":if(uo(e,t)||""===e)return po(e,t);const o=jt(e,t);if(o)return o.value;throw new Error(Lo(e));default:return 0}}function Vo(e,t){try{return Po(e,t)}catch(e){return}}function ko(e,t){return e.forEach((e=>{e.forEach((e=>{if("number"!=typeof e)throw new Error(a("Function [[FUNCTION_NAME]] expects number values for %s, but got a %s.",typeof e,t))}))})),e}function Uo(e,t){if(""===e)throw new Error(Lo(e));return Po(e,t)}function Bo(e,t){return Math.trunc(Po(e,t))}function Ho(e,t){return Math.trunc(Uo(e,t))}function zo(e){Do((()=>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 Go(e){switch(typeof e){case"string":return e;case"number":return e.toString();case"boolean":return e?"TRUE":"FALSE";default:return""}}const $o=at((function(e){return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"")})),Wo=e=>a("The function [[FUNCTION_NAME]] expects a boolean value, but '%s' is a text, and cannot be coerced to a number.",e);function qo(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(Wo(e))}return!1;case"number":return!!e;default:return!1}}function Zo(e,t){return Kt(Po(e,t))}function Yo(e,t,o){for(let s of e)if(_o(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){Yo(e,t,t)}function jo(e,t,o){Yo(e,(e=>{"number"==typeof e&&t(e)}),(e=>{t(Uo(e,o))}))}function Ko(e,t,o,s,n="rowFirst"){let i=s;for(let s of e)if(_o(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 Qo(e,t,o,s="rowFirst"){return Ko(e,t,t,o,s)}function Jo(e,t,o,s){return Ko(e,((e,o)=>"number"==typeof o?t(e,o):e),((e,o)=>t(e,Uo(o,s))),o)}function es(e,t,o,s){return Ko(e,((e,o)=>null!=o?t(e,"number"==typeof o?o:"boolean"==typeof o?Po(o,s):0):e),((e,o)=>t(e,Po(o,s))),o)}function ts(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 os(e,t){return 0===e.length?[]:ts(e.length,e[0].length,((o,s)=>t(e[o][s])))}function ss(e){return e.length?ts(e[0].length,e.length,((t,o)=>e[o][t])):[]}function ns(e,t){return function(e,t,o){for(let s of e)if(_o(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(Wo(e));return qo(e)}(e))))}function is(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)),uo(n,o)||Yt(n,o)?n=Po(n,o):"TRUE"!==n&&"FALSE"!==n||(n=qo(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 rs(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&&(uo(e,o)||Yt(e,o))?Po(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 as(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(!_o(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=Go(e[t+1]);l.push(is(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=rs(e[t][s][i]??void 0,l[t/2],o),!r)break}r&&t(s,i)}}function ls(e,t,o,s,n,i){if(null==t)return-1;const r=hs(t),a=typeof r;let l,c,h,d,u,g,p=0,m=n-1;const f="desc"===s?t=>hs(i(e,n-t-1)):t=>hs(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 cs(e,t,o,s,n,i=!1){if(null==t)return-1;const r=hs(t),a=i?(e,t)=>n(e,s-t-1):n;let l,c=-1;for(let t=0;t<s;t++){const n=hs(a(e,t));if(n===r)return i?s-t-1:t;"nextSmaller"===o?(!l&&ds(r,n)>=0||ds(r,n)>=0&&ds(n,l)>0)&&(l=n,c=t):"nextGreater"===o&&(!l&&ds(r,n)<=0||ds(r,n)<=0&&ds(n,l)<0)&&(l=n,c=t)}return i&&-1!==c?s-c-1:c}function hs(e){return"string"==typeof e?$o(e):e}function ds(e,t){let o=Fo.indexOf(typeof e)-Fo.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 us(e){return void 0===e?[[]]:_o(e)?e:[[e]]}function gs(e,t){return Qo(e,((e,o)=>(e.push(t(o)),e)),[],"rowFirst")}function ps(e){const t=Lt.now();switch(e){case"today":return Jt(t);case"yesterday":return Jt(Lt.fromTimestamp(t.setDate(t.getDate()-1)));case"tomorrow":return Jt(Lt.fromTimestamp(t.setDate(t.getDate()+1)));case"lastWeek":return Jt(Lt.fromTimestamp(t.setDate(t.getDate()-7)));case"lastMonth":return Jt(Lt.fromTimestamp(t.setMonth(t.getMonth()-1)));case"lastYear":return Jt(Lt.fromTimestamp(t.setFullYear(t.getFullYear()-1)))}}function ms(e,t){return"dateValue"in e&&"exactDate"!==e.dateValue?[ps(e.dateValue)]:e.values.map((e=>Zt(e,t)))}function fs(e,t){return e.values.map((e=>Vo(e,t)))}function bs(e){return 20+120*Math.exp(-.035*(e-1))}const vs=20,Ss=11,Cs=/(\d+?)(?=(\d{3})+(?!\d)|$)/g,Es=/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")},ys={0:a("Sunday"),1:a("Monday"),2:a("Tuesday"),3:a("Wednesday"),4:a("Thursday"),5:a("Friday"),6:a("Saturday")},xs={};function Is(e){let t=xs[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);Fs(i)?o.push({type:"DATE",format:i}):o.push({type:"NUMBER",format:Ys(i)})}t=s}return o}(e),xs[e]=t),t}function Rs(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=Us(e));return function(e,t,o){if("DATE"===t[0].type)return Ls(e,t[0].format);let s=e<0?"-":"";for(let n of t)switch(n.type){case"NUMBER":s+=Ts(Math.abs(e),n.format,o);break;case"STRING":s+=n.format}return s}(e,Is(t),o);case"object":return"0"}}function Ts(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}=Os(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(Es)||[]).length;n="0".repeat(e)+n}o&&(n=n.match(Cs)?.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(Es)||[]).length;o+="0".repeat(s)}return o}(i||"",t.decimalPart)),t.isPercent&&(r+="%"),r}const As=[];function Os(e,t=vs){const o=e.toString();if(o.includes("e"))return function(e,t=vs){let o=As[t];o||(o=new Intl.NumberFormat("en-US",{maximumFractionDigits:t,useGrouping:!1}),As[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(Ms)?.[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:_s(i||"")}}function _s(e){let t=e.length-1;for(;t>=0&&"0"===e[t];)t--;return e.slice(0,t+1)||void 0}const Ms=/^0+/;function Ns(e,t){const{integerDigits:o,decimalDigits:s}=Os(e,20);return s?o+t+s:o}function Fs(e){if(!Ds.has(e[0]))return!1;try{return Ls(1,e),!0}catch(e){return!1}}const Ds=new Set(["h","m","y","d"]);function Ls(e,t){const o=Kt(e),s=t.indexOf("h");let n="",i="";return s>0?(n=Ps(o,t.substring(0,s-1)),i=Vs(o,t.substring(s))):0===s?i=Vs(o,t):s<0&&(n=Ps(o,t)),n+(n&&i?" ":"")+i}function Ps(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 ys[e.getDay()].slice(0,3);case"dddd":return ys[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 Vs(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()-Pt.getTime())/36e5).toString();case"hh":return i.toString().padStart(2,"0");case"mm":return e.getMinutes().toString().padStart(2,"0");case"ss":return e.getSeconds().toString().padStart(2,"0");default:throw new Error(`invalid format: ${t}`)}})).join(":")+r}const ks=at((function(e){return new RegExp(`[0-9]+${Re(e.decimalSeparator)}[0-9]`)}));function Us(e){let{integerDigits:t,decimalDigits:o}=Os(e);if(!o)return"0";const s=t.replace("-","").length;if(s+2>Ss)return"0";const n=Ss-s-1;return({decimalDigits:o}=Os(e,Math.min(n,o.length))),o?"0."+"0".repeat(o.length):"0"}function Bs(e,t){if(!Yt(e,t))return;return jt(e,t).format}function Hs(e){if(!uo(e,Ao))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 zs(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 Gs(e){return js(Is(e).map((e=>"NUMBER"===e.type?{type:e.type,format:{...e.format,decimalPart:void 0}}:e)))}function $s(e,t,o,s){const n=Is(e||"#,##0"),i=[];for(let e=0;e<n.length;e++){const s=n[e];if("NUMBER"!==s.type){i.push(s);continue}i.push({...s,format:{...s.format,magnitude:t,decimalPart:void 0}}),i.push({type:"STRING",format:o});const r=n[e+1];"STRING"===r?.type&&["k","m","b"].includes(r.format)&&e++}return js(i)}function Ws(e,t,o){const s=Is(e).map((e=>"NUMBER"===e.type?{...e,format:qs(e.format,t)}:e)),n=js(s);return xs[n]=s,n}function qs(e,t){const o={...e},s=Math.sign(t),n=o.decimalPart?.length||0,i=Math.min(Math.max(0,n+s),vs);return o.decimalPart="0".repeat(i),""===o.decimalPart&&delete o.decimalPart,o}const Zs=/,*?$/;function Ys(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(Zs)?.[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 js(e){let t="";for(let o of e){let e;switch(o.type){case"NUMBER":const t=o.format;e=t.integerPart,t.thousandsSeparator&&(e=e.slice(0,-3)+","+e.slice(-3)),void 0!==t.decimalPart&&(e+="."+t.decimalPart),t.isPercent&&(e+="%"),t.magnitude&&(e+=",".repeat(Math.log10(t.magnitude)/3));break;case"STRING":e=`[$${o.format}]`;break;case"DATE":e=o.format}t+=e}return t}const Ks=new RegExp(/\$?([A-Z]{1,3})\$?([0-9]{1,7})/,"i"),Qs=new RegExp(/^\$?([A-Z]{1,3})\$?([0-9]{1,7})$/,"i"),Js=new RegExp(/^\$?([A-Z]{1,3})+$/,"i"),en=new RegExp(/^\$?([0-9]{1,7})+$/,"i"),tn=new RegExp(/^\s*('.+'!|[^']+!)?\$?([A-Z]{1,3})$/,"i"),on=new RegExp(/^\s*('.+'!|[^']+!)?\$?([0-9]{1,7})$/,"i"),sn=new RegExp(/^\s*('.+'!|[^']+!)?/.source+"("+[Ks.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 nn(e){return tn.test(e)}function rn(e){return on.test(e)}function an(e){return Js.test(e)}function ln(e){return en.test(e)}function cn(e){return Qs.test(e)}function hn(e){const t=e.split("!"),o=t.pop();return{sheetName:Ae(t.join("!"))||void 0,xc:o}}function dn(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(nn(r))n=i=_t(r),o=s=0,a=!0;else if(rn(r))o=s=parseInt(r,10)-1,n=i=0,l=!0;else{const e=Ft(r);n=i=e.col,o=s=e.row,c=!0}if(t)if(nn(t))i=_t(t),a=!0;else if(rn(t))s=parseInt(t,10)-1,l=!0;else{const e=Ft(t);i=e.col,s=e.row,o=a?s:o,n=l?i:n,c=!0}if(a&&l)throw new Error("Wrong zone xc. The zone cannot be at the same time a full column and a full row");const h={top:o,left:n,bottom:a?void 0:s,right:l?void 0:i};return c=c&&(l||a),c&&(h.hasHeader=c),h}(e);if(void 0!==t.right&&t.right<t.left){const e=t.left;t.left=t.right,t.right=e}if(void 0!==t.bottom&&t.bottom<t.top){const e=t.top;t.top=t.bottom,t.bottom=e}return t}function un(e){const t=dn(e);if(void 0===t.bottom||void 0===t.right)throw new Error("This does not support unbounded ranges");return t}function gn(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))&&(pn(e)&&e.top>=0&&e.left>=0)}function pn(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 mn(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?`${Dt(s,t)}:${At(n)}`:`${At(s)}:${At(n)}`;if(void 0===n&&void 0!==o)return 0!==s||i?`${Dt(s,t)}:${o+1}`:`${t+1}:${o+1}`;if(void 0!==o&&void 0!==n)return r?Dt(s,t):`${Dt(s,t)}:${Dt(n,o)}`;throw new Error(a("Bad zone format"))}function fn(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?Mn(e,i,"RESIZE",n):r<e[t]?Mn(e,i,"MOVE",n):{...e}}function bn(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?Mn(e,i,"RESIZE",n):r<e[t]?Mn(e,i,"MOVE",n):{...e}}function vn(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 Sn(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 Cn(...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 En(e,t){if(yn(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 yn(e,t){return!(e.bottom<t.top||t.bottom<e.top)&&!(e.right<t.left||t.right<e.left)}function xn(e,t,o){const{left:s,right:n,top:i,bottom:r}=o;return e>=s&&e<=n&&t>=i&&t<=r}function In(e,t){return wn(Cn(t,e),t)}function Rn(e,t){const o=e.map(dn),s=t.map(dn),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(_n).flat(),a.map(_n).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=Dn(t);for(const{col:e,row:t}of o)if(!xn(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=Dn({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=Tn(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)?Cn(e,t):e),o.shift());t.push(e)}return Tn(t)}(c).map((e=>({...e,bottom:e.bottom===n+1?void 0:e.bottom,right:e.right===i+1?void 0:e.right}))).map(mn)}function Tn(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=>In(e,t)))||o.push(e)}return o.reverse()}function An(e){return{numberOfRows:e.bottom-e.top+1,numberOfCols:e.right-e.left+1}}function On(e){const{numberOfCols:t,numberOfRows:o}=An(e);return 1===t||1===o}function _n(e){const t=[],[o,s]=[e.right,e.left].sort(((e,t)=>e-t)),[n,i]=[e.top,e.bottom].sort(((e,t)=>e-t));for(const e of Me(o,s+1))for(const o of Me(n,i+1))t.push({col:e,row:o});return t}function Mn(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?!(Ln(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 Nn(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 Fn(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 Dn(e){return{left:e.col,right:e.col,top:e.row,bottom:e.row}}function Ln(e){return void 0===e.right}function Pn(e){return(e.bottom-e.top+1)*(e.right-e.left+1)}function Vn(...e){return e.length<2||1===Rn(e.map(mn),[]).length}class kn{getSheetSize;_zone;parts;invalidXc;prefixSheet=!1;sheetId;invalidSheetName;constructor(e,t){this.getSheetSize=t,this._zone=e.zone,this.prefixSheet=e.prefixSheet,this.invalidXc=e.invalidXc,this.sheetId=e.sheetId,this.invalidSheetName=e.invalidSheetName;let o=[...e.parts];1===e.parts.length&&Pn(this.zone)>1?o.push({...e.parts[0]}):2===e.parts.length&&1===Pn(this.zone)&&o.pop(),this.parts=o}static fromRange(e,t){return e instanceof kn?e:new kn(e,t.getSheetSize)}get unboundedZone(){return this._zone}get zone(){const{left:e,top:t,bottom:o,right:s}=this._zone;if(void 0!==s&&void 0!==o)return this._zone;if(void 0===o&&void 0!==s)return{right:s,top:t,left:e,bottom:this.getSheetSize(this.sheetId).numberOfRows-1};if(void 0===s&&void 0!==o)return{bottom:o,left:e,top:t,right:this.getSheetSize(this.sheetId).numberOfCols-1};throw new Error(a("Bad zone format"))}static getRangeParts(e,t){const o=e.split(":").map((e=>{const t=rn(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(pn(this._zone))return this;const e={...this._zone};let t=this.parts;if(void 0!==e.right&&e.right<e.left){let o=e.right;e.right=e.left,e.left=o,t=[{colFixed:t[1]?.colFixed||!1,rowFixed:t[0]?.rowFixed||!1},{colFixed:t[0]?.colFixed||!1,rowFixed:t[1]?.rowFixed||!1}]}if(void 0!==e.bottom&&e.bottom<e.top){let o=e.bottom;e.bottom=e.top,e.top=o,t=[{colFixed:t[0]?.colFixed||!1,rowFixed:t[1]?.rowFixed||!1},{colFixed:t[1]?.colFixed||!1,rowFixed:t[0]?.rowFixed||!1}]}return this.clone({zone:e,parts:t})}clone(e){return new kn({zone:e?.zone?e.zone:{...this._zone},sheetId:e?.sheetId?e.sheetId:this.sheetId,invalidSheetName:e&&"invalidSheetName"in e?e.invalidSheetName:this.invalidSheetName,invalidXc:e&&"invalidXc"in e?e.invalidXc:this.invalidXc,parts:e?.parts?e.parts:this.parts.map((e=>({rowFixed:e.rowFixed,colFixed:e.colFixed}))),prefixSheet:e?.prefixSheet?e.prefixSheet:this.prefixSheet},this.getSheetSize)}}function Un(e,t,o){const s=o.sheetId===e?t:o.sheetId;return o.clone({sheetId:s})}function Bn(e,t,o){if(!o)return;const s=e.getRangeFromSheetXC(t,o);return s.invalidSheetName||s.invalidXc?void 0:s}function Hn(e){const t=[];for(const o of e)for(const e of _n(o.zone))t.push({...e,sheetId:o.sheetId});return t}function zn(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 Gn(e){const t=[];for(let o=0;o<e;o++){const e={cells:{}};t.push(e)}return t}function $n(e,t,o){return o.map((o=>o>=e?o+t:o))}function Wn(e,t){return e=[...e].sort(((e,t)=>t-e)),t.map((t=>{for(const o of e)if(t>o)t--;else if(t===o)return;return t})).filter($e)}function qn(e,t=1){return t*(e+Z)-Z}const Zn={};function Yn(e,t,o){const s=jn(o);if(Zn[s]||(Zn[s]={}),void 0===Zn[s][t]){e.save(),e.font=s;const o=e.measureText(t).width;e.restore(),Zn[s][t]=o}return Zn[s][t]}function Xn(e){return Math.round(96*e/72)}function jn(e){return`${e.italic?"italic ":""}${e.bold?"bold":oe} ${Kn(e)}px ${ne}`}function Kn(e){return Xn(e?.fontSize||se)}function Qn(e,t,o,s){if(Yn(e,t,s)<=o)return[t];const n=[];let i="";for(let r of t){Yn(e,i+r,s)>o?(n.push(i),i=r):i+=r}return n.push(i),n}function Jn(e,t,o,s){o||(o={});const n=[],i=t.includes(ye)?t.split(ye):[t];for(const t of i){const i=t.includes(" ")?t.split(" "):[t];if(!s){n.push(t);continue}let r="",a=s;for(let t of i){const i=Qn(e,t,s,o),l=i.pop(),c=Yn(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=Yn(e,t,o);i<=a?(r+=t,a-=i):(n.push(r),r=l,a=s-c)}}""!==r&&n.push(r)}return n}function ei(e){return e?e.toLowerCase():""}const ti=/([0-9\.]*)px/;function oi(e,t,o,s=!1,n=!1,i=function(e){return Number(e.match(ti)?.[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 si{isFastIdStrategy=!1;fastIdStart=0;setIsFastStrategy(e){this.isFastIdStrategy=e}uuidv4(){return this.isFastIdStrategy?(this.fastIdStart++,String(this.fastIdStart)):window.crypto&&window.crypto.getRandomValues?([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16))):"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}}function ni(e){return e.map(ri).sort(((e,t)=>e.sequence-t.sequence))}const ii=new si;function ri(e){const t=e.name,o=e.children,s=e.description,n=e.icon;return{id:e.id||ii.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(ri):()=>[],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 ai(e,t){return"REMOVE_COLUMNS_ROWS"===t.type?Sn(e,"COL"===t.dimension?"left":"top",t.elements):"ADD_COLUMNS_ROWS"===t.type?fn(e,"COL"===t.dimension?"left":"top",t.base,t.position,t.quantity):{...e}}function li(e,t){const o="DELETE_SHEET"===t.type&&t.sheetId;if("sheetId"in t&&e._sheetId!==t.sheetId)return e;{const s=ai(e._zone,t);if(s&&o!==e._sheetId)return{...e,_zone:s}}}class ci extends t.Component{static template="o-spreadsheet-ChartJsComponent";canvas=t.useRef("graphContainer");chart;get background(){return this.chartRuntime.background}get canvasStyle(){return`background-color: ${this.background}`}get chartRuntime(){const e=this.env.model.getters.getChartRuntime(this.props.figure.id);if(!("chartJsConfig"in e))throw new Error("Unsupported chart runtime");return e}setup(){t.onMounted((()=>{const e=this.chartRuntime;this.createChart(Te(e.chartJsConfig))})),t.useEffect((()=>this.updateChartJs(Te(this.chartRuntime))),(()=>[this.chartRuntime]))}createChart(e){const t=this.canvas.el.getContext("2d");this.chart=new window.Chart(t,e)}updateChartJs(e){const t=e.chartJsConfig;t.data&&t.data.datasets?(this.chart.data=t.data,t.options?.plugins?.title&&(this.chart.config.options.plugins.title=t.options.plugins.title),t.options&&"valueLabel"in t.options&&t.options?.valueLabel&&(this.chart.config.options.valueLabel=t.options.valueLabel)):this.chart.data.datasets=[],this.chart.config.options.plugins.tooltip=t.options.plugins.tooltip,this.chart.config.options.plugins.legend=t.options.plugins.legend,this.chart.config.options.scales=t.options?.scales,this.chart.update()}}ci.props={figure:Object};class hi{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 di(e,t,o,s){let n=!1;const i=[];for(let s in o){let r=o[s];if(r.labelCell){const e=pi(r.labelCell,t);r.labelCell!==e&&(n=!0,r={...r,labelCell:e})}const a=pi(r.dataRange,t);void 0===a||e.getRangeString(a,a.sheetId)===le?(n=!0,r=void 0):a!==r.dataRange&&(n=!0,r={...r,dataRange:a}),i[s]=r}let r=s;const a=pi(r,t);a!==r&&(n=!0,r=a);return{isStale:n,dataSets:i.filter($e),labelRange:r}}function ui(e,t,o){return o.map((o=>({dataRange:Un(e,t,o.dataRange),labelCell:o.labelCell?Un(e,t,o.labelCell):void 0})))}function gi(e,t,o){return o?Un(e,t,o):void 0}function pi(e,t){if(!e)return;const o=t(e);switch(o.changeType){case"NONE":return e;case"REMOVE":return;default:return o.range}}function mi(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(fi(e,a,o,s?{top:o.top,bottom:o.top,left:o.left,right:o.left}:void 0))}}else n.push(fi(e,a,r,s?{top:r.top,bottom:r.top,left:r.left,right:r.left}:void 0))}return n}function fi(e,t,o,s){if(o.left!==o.right&&o.top!==o.bottom)throw new Error(`Zone should be a single column or row: ${mn(o)}`);if(s){const n=mn(o),i=mn(s);return{labelCell:e.getRangeFromSheetXC(t,i),dataRange:e.getRangeFromSheetXC(t,n)}}return{labelCell:void 0,dataRange:e.getRangeFromSheetXC(t,mn(o))}}function bi(e,t){const o=t.labelCell?.zone;let s=t.dataRange.zone;if(o){const{numberOfRows:e,numberOfCols:t}=An(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 vi(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 Si(e,t){let o;if(e.labelRange){const s=ai(dn(e.labelRange),t);o=s?mn(s):void 0}const s=e.dataSets.map(dn).map((e=>ai(e,t))).filter($e).map(mn);return{...e,labelRange:o,dataSets:s}}const Ci=["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 Ei{graphColorIndex=0;next(){return Ci[this.graphColorIndex++%Ci.length]}}function wi(e){return e&&Et(e)<.3?"#FFFFFF":"#000000"}function yi(e){if(e.dataSets){const t=void 0!==e.dataSets.find((e=>!sn.test(e)));if(t)return"InvalidDataSet";if(e.dataSets.map(dn).some((e=>e.top!==e.bottom&&Ln(e))))return"InvalidDataSet"}return"Success"}function xi(e){if(e.labelRange){if(!sn.test(e.labelRange||""))return"InvalidLabelRange"}return"Success"}function Ii(e,t,o){if(!o)return!1;if(!e)return!1;if(!t)return!0;const s=Pn(t.dataRange.zone);return!(Pn(e.zone)<s)}function Ri(e,t,o,s){if(e){if("text"===o||t?.type!==fo.number||e.type!==fo.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 Rs(n,{format:e.format,locale:s});const i=Math.abs(parseFloat(n.toFixed(2))).toLocaleString();return"percentage"===o?i+"%":i}}return""}function Ti(e,t,o,s,n){if("text"===t||e?.type!==fo.number||o?.type!==fo.number)return;const i=o.value-e.value;return i>0?s:i<0?n:void 0}function Ai(e,t,o){if("text"===o||e?.type!==fo.number||t?.type!==fo.number)return"neutral";const s=t.value-e.value;return s>0?"up":s<0?"down":"neutral"}function Oi(e){return e.keyValue&&!sn.test(e.keyValue)?"InvalidScorecardKeyValue":"Success"}function _i(e){return e.baseline&&!sn.test(e.baseline)?"InvalidScorecardBaseline":"Success"}const Mi=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"),Ni=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 Fi=class e extends hi{keyValue;baseline;baselineMode;baselineDescr;background;baselineColorUp;baselineColorDown;fontColor;type="scorecard";constructor(e,t,o){super(e,t,o),this.keyValue=Bn(o,t,e.keyValue),this.baseline=Bn(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,Oi,_i)}static getDefinitionFromContextCreation(e){return{background:e.background,type:"scorecard",keyValue:e.range?e.range[0]:void 0,title:e.title||"",baselineMode:ge,baselineColorUp:pe,baselineColorDown:me,baseline:e.auxiliaryRange||""}}static transformDefinition(e,t){let o,s;return e.baseline&&(o=ai(dn(e.baseline),t)),e.keyValue&&(s=ai(dn(e.keyValue),t)),{...e,baseline:o?mn(o):void 0,keyValue:s?mn(s):void 0}}copyForSheetId(t){const o=gi(this.sheetId,t,this.baseline),s=gi(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=pi(this.baseline,t),s=pi(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 Di(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,oi(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(Mi);break;case"up":o.fill(Ni)}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,oi(o,e.key.text,e.key.position,e.key.style.underline,e.key.style.strikethrough))}function Li(e,t=!1,o=!1){return`${o?"italic":""} ${t?"bold":""} ${e}px ${ne}`}function Pi({width:e,height:t},o){return new Vi({width:e,height:t},o).computeDesign()}class Vi{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 Et(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 Bi(this.runtime.keyValueStyle).getElementMaxFontSize(this.getDrawableHeight(),this)*s,i=new Ui(this.runtime.baselineStyle).getElementMaxFontSize(this.getDrawableHeight(),this)*s;return{title:{font:Li(18),color:this.secondaryFontColor},keyValue:{color:this.runtime.keyValueStyle?.textColor||this.runtime.fontColor,font:Li(n,this.runtime.keyValueStyle?.bold,this.runtime.keyValueStyle?.italic),strikethrough:this.runtime.keyValueStyle?.strikethrough,underline:this.runtime.keyValueStyle?.underline},baselineValue:{font:Li(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:Li(.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 Ui(this.runtime.baselineStyle),t=new Bi(this.runtime.keyValueStyle);return e.getElementWidth(.35,this.context,this)>t.getElementWidth(.65,this.context,this)?e:t}}class ki{style;constructor(e={}){this.style=e}measureTextWidth(e,t,o){return e.font=Li(o,this.style.bold,this.style.italic),e.measureText(t).width}}class Ui extends ki{getElementWidth(e,t,o){if(!o.runtime)return 0;const s=o.baseline,n="neutral"!==o.baselineArrow?"A "+s:s;let i=this.measureTextWidth(t,n,e);return i+=this.measureTextWidth(t,o.baselineDescr,.9*e),i}getElementMaxFontSize(e,t){if(!t.runtime)return 0;return(""!==t.baseline||t.baselineDescr?.35*e:0)/1.2}}class Bi extends ki{getElementWidth(e,t,o){if(!o.runtime)return 0;const s=o.keyValue||"";return this.measureTextWidth(t,s,e)}getElementMaxFontSize(e,t){if(!t.runtime)return 0;return(""!==t.baseline||t.baselineDescr?.65*e:e)/1.2}}class Hi 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;Di(Pi(e.getBoundingClientRect(),this.runtime),e)}}Hi.props={figure:Object};class zi{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 Gi(e){return/^https?:\/\//i.test(e)?e:`https://${e}`}const $i=new zi;function Wi(e,t){return{url:e=Gi(e),label:t||e,isExternal:!0,isUrlEditable:!0}}$i.add("sheet_URL",{match:e=>He(e),createLink:(e,t)=>({label:t,url:e,isExternal:!1,isUrlEditable:!1}),urlRepresentation(e,t){const o=Ge(e);return t.tryGetSheetName(o)||a("Invalid sheet")},open(e,t){const o=Ge(e);t.model.dispatch("ACTIVATE_SHEET",{sheetIdFrom:t.model.getters.getActiveSheetId(),sheetIdTo:o})},sequence:0});const qi={createLink:Wi,match:e=>Ve(e),open:e=>window.open(e,"_blank"),urlRepresentation:e=>e,sequence:0};function Zi(e){return $i.getAll().sort(((e,t)=>e.sequence-t.sequence)).find((t=>t.match(e)))||qi}function Yi(e,t){return Zi(e.url).urlRepresentation(e.url,t)}function Xi(e,t){Zi(e.url).open(e.url,t)}function ji(e){if("string"==typeof e){if(Pe(e)){const{label:t,url:o}=Ue(e);return Zi(o).createLink(o,t)}return Ve(e)?Wi(e):void 0}}function Ki(e,t){return Ji(Qi(e||"",t.locale),t)}function Qi(e,t){if(e.startsWith("="))throw new Error(`Cannot parse "${e}" because it's not a literal value. It's a formula`);return uo(e,Ao)?Po(e,Ao):Yt(e,t)?Po(e,t):function(e){const t=e.toUpperCase();return"TRUE"===t||"FALSE"===t}(e)?"TRUE"===e.toUpperCase():e}function Ji(e,t){const o=ji(e);return o?{...er(Qi(o.label,t.locale),{format:t.format||Bs(o.label,t.locale)||Hs(o.label),locale:t.locale}),link:o}:er(e,t)}function er(e,t){try{for(const o of nr){const s=o(e,t);if(s)return s}return function(e,t){return{type:fo.text,value:e,format:t.format,isAutoSummable:!0,defaultAlign:"left",formattedValue:Rs(e,t)}}((e||"").toString(),t)}catch(e){return sr(new d(c.GenericError,e.message||Se))}}function tr(e,t){return{type:fo.number,value:e||0,format:t.format,isAutoSummable:!0,defaultAlign:"right",formattedValue:Rs(e,t)}}const or={type:fo.empty,value:"",format:void 0,isAutoSummable:!0,defaultAlign:"left",formattedValue:""};function sr(e){return{type:fo.error,value:e.errorType,error:e,isAutoSummable:!1,defaultAlign:"center",formattedValue:e.errorType}}const nr=[function(e,t){if(""===e)return function(e){return void 0===e.format?or:{type:fo.empty,value:"",format:e.format,isAutoSummable:!0,defaultAlign:"left",formattedValue:""}}(t)},function(e,t){if(t.format&&"number"==typeof e&&Fs(t.format))return function(e,t){const o=Rs(e,t);return{type:fo.number,value:e,format:t.format,isAutoSummable:!1,defaultAlign:"right",formattedValue:o}}(e,t)},function(e,t){return"number"==typeof e?tr(e,t):null===e?tr(0,t):void 0},function(e,t){if("boolean"==typeof e)return function(e,t){const o=e?"TRUE":"FALSE";return{type:fo.boolean,value:e,format:t.format,isAutoSummable:!1,defaultAlign:"center",formattedValue:o}}(e,t)}],ir=new zi;ir.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=Rs(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:Ki(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 rr=new zi,ar=/(\d+)$/,lr=/^(.*\D+)/,cr=/^(.*\D+)(\d+)$/;function hr(e,t,o){let s=[],n=!1;for(let i of t){i===e&&(n=!0);const t=i?.isFormula?void 0:Ki(i?.content,{locale:Ao});if(t&&o(t))s.push(t);else{if(n)return s;s=[]}}return s}function dr(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}rr.add("simple_value_copy",{condition:(e,t)=>!(1!==t.length||e.isFormula||e.format&&Fs(e.format)),generateRule:()=>({type:"COPY_MODIFIER"}),sequence:10}).add("increment_alphanumeric_value",{condition:e=>!e.isFormula&&Ki(e.content,{locale:Ao}).type===fo.text&&cr.test(e.content),generateRule:(e,t)=>{const o=parseInt(e.content.match(ar)[0]),s=e.content.match(lr)[0],n=e.content.length-s.length,i=hr(e,t,(e=>e.type===fo.text&&cr.test(e.value))).filter((e=>s===e.value.toString().match(lr)[0])).map((e=>parseInt(e.value.toString().match(ar)[0]))),r=dr(i);return{type:"ALPHANUMERIC_INCREMENT_MODIFIER",prefix:s,current:o,increment:r,numberPostfixLength:n}},sequence:15}).add("copy_text",{condition:e=>!e.isFormula&&Ki(e.content,{locale:Ao}).type===fo.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&&Ki(e.content,{locale:Ao}).type===fo.number,generateRule:(e,t)=>{const o=dr(hr(e,t,(e=>e.type===fo.number)).map((e=>Number(e.value)))),s=Ki(e.content,{locale:Ao});return{type:"INCREMENT_MODIFIER",increment:o,current:s.type===fo.number?s.value:0}},sequence:40});const ur={};let gr=0;function pr(e,...t){const o="__sheet__"+gr++;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),ur[e]=o}(o,String.raw(e,...t)),function(e){const t=ur[e];t.setAttribute("component",e),document.head.appendChild(t)}(o),o}function mr({strikethrough:e,underline:t}){return e||t?`${e?"line-through":""} ${t?"underline":""}`:"none"}function fr(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 br(e){let t="";for(const o in e)e[o]&&(t+=`${o}:${e[o]}; `);return t}pr`
|
|
1
|
+
!function(e,t){"use strict";const o=e=>e,s=()=>!1;let n=o,i=s;function r(e,...t){if(1!==t.length||"object"!=typeof t[0]||t[0]instanceof String)t.length>0&&(e=e.replace(/\%s/g,(()=>t.shift())));else{const o=t[0];e=e.replace(/\%\(([^\)]+)\)s/g,((e,t)=>o[t]))}return e}const a=function(e,...t){return i()?r(n(e),...t):new l(e,t)};class l extends String{values;constructor(e,t){super(e),this.values=t}valueOf(){const e=super.valueOf();return i()?r(n(e),...this.values):r(e,...this.values)}toString(){return this.valueOf()}}var c,h;!function(e){e.NotAvailable="#N/A",e.InvalidReference="#REF",e.BadExpression="#BAD_EXPR",e.CircularDependency="#CYCLE",e.UnknownFunction="#NAME?",e.GenericError="#ERROR"}(c||(c={})),function(e){e[e.silent=0]="silent",e[e.error=1]="error"}(h||(h={}));class d extends Error{errorType;logLevel;constructor(e,t,o=h.error){super(t),this.errorType=e,this.logLevel=o}get isVerbose(){return this.logLevel>h.silent}}class u extends d{constructor(e){super(c.BadExpression,e)}}class g extends d{constructor(){super(c.CircularDependency,a("Circular reference"))}}class p extends d{constructor(){super(c.InvalidReference,a("Invalid reference"))}}class m extends d{constructor(e=void 0){super(c.NotAvailable,e||a("Data not available"),e?h.error:h.silent)}}class f extends d{constructor(e){super(c.UnknownFunction,a('Unknown function: "%s"',e))}}const b=.5,v="#f5f5f5",S="#F8F9FA",C="#E8EAED",E="#595959",w="#666666",y="#c9ccd2",x="#3266ca",I="#FFFFFF",R="#EBEBEB",T="#CACACA",A=11982760,O="#01666b",_="#188038",M="#E6F4EA",N="#CEEAD6",F="#E0E2E4",D="#4A4F59",L="#999",P="#E2E3E3",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=Z,X=21,j=17,K=2*G,Q=250,J={align:"left",verticalAlign:"bottom",wrapping:"overflow",bold:!1,italic:!1,strikethrough:!1,underline:!1,fontSize:10,fillColor:"",textColor:""},ee=J.verticalAlign,te=J.wrapping,oe="400",se=J.fontSize,ne="'Roboto', arial",ie="thin",re="#000000",ae={style:"thin",color:_},le=c.InvalidReference,ce="START_REVISION",he=1,de=20,ue="??",ge="difference",pe="#00A04A",me="#DC6965",fe=["'","*","?","/","\\","[","]"],be=/'|\*|\?|\/|\\|\[|\]/,ve="|",Se=a("Invalid expression");var Ce;!function(e){e[e.Grid=0]="Grid",e[e.Highlight=5]="Highlight",e[e.HeaderGroupingButton=6]="HeaderGroupingButton",e[e.Figure=10]="Figure",e[e.ScrollBar=15]="ScrollBar",e[e.GridPopover=19]="GridPopover",e[e.GridComposer=20]="GridComposer",e[e.Dropdown=21]="Dropdown",e[e.IconPicker=25]="IconPicker",e[e.TopBarComposer=30]="TopBarComposer",e[e.Popover=35]="Popover",e[e.FigureAnchor=1e3]="FigureAnchor",e[e.FigureSnapLine=1001]="FigureSnapLine"}(Ce||(Ce={}));let Ee=0;function we(){return Ee}const ye="\n",xe=[6,7,8,9,10,11,12,14,18,24,36];function Ie(e){return'"'===e[0]&&(e=e.slice(1)),'"'===e[e.length-1]&&"\\"!==e[e.length-2]?e.slice(0,e.length-1):e}function Re(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Te(e){const t=Array.isArray(e)?[]:{};switch(typeof e){case"object":if(null===e)return e;if(function(e){return"clone"in e&&e.clone instanceof Function}(e))return e.clone();if(!(function(e){return"object"==typeof e&&null!==e&&(e?.constructor===Object||void 0===e?.constructor)}(e)||e instanceof Array))throw new Error("Unsupported type: only objects and arrays are supported");for(const o in e)t[o]=Te(e[o]);return t;case"number":case"string":case"boolean":case"function":case"undefined":return e;default:throw new Error("Unsupported type: "+typeof e)}}function Ae(e){return e.startsWith("'")&&(e=e.slice(1,-1).replace(/''/g,"'")),e}function Oe(e){return e.match(/\w/g)?.length!==e.length&&(e=`'${e}'`),e}function _e(e,t,o){return e<t?t:e>o?o:e}function Me(e,t,o=1){if(t<=e&&o>0)return[];if(0===o)throw new Error("range() step must not be zero");const s=Math.ceil(Math.abs((t-e)/o)),n=Array(s);for(let t=0;t<s;t++)n[t]=e+t*o;return n}function Ne(e){return e.reduce(((e,t,o,s)=>{if(1===Math.abs(t-s[o-1])){e[e.length-1].push(t)}else e.push([t]);return e}),[])}function*Fe(e,t){t.next();for(const o of e){const e=t.next();yield{...o,next:e.done?void 0:e.value}}}const De=/^\[(.+)\]\((.+)\)$/,Le=/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$/;function Pe(e){return De.test(e)}function Ve(e){return Le.test(e)}function ke(e,t){return`[${e}](${t})`}function Ue(e){const t=e.match(De)||[],o=t[1],s=t[2];if(!o||!s)throw new Error(`Could not parse markdown link ${e}.`);return{label:o,url:s}}const Be="o-spreadsheet://";function He(e){return e.startsWith(Be)}function ze(e){return`${Be}${e}`}function Ge(e){if(e.startsWith(Be))return e.substr(Be.length);throw new Error(`${e} is not a valid sheet link`)}function $e(e){return void 0!==e}function We(e){return null!==e}function qe(e){return void 0===e||Object.values(e).every((e=>"object"==typeof e?qe(e):!e))}function Ze(e,t){for(const o in t)if(Qe(t[o],e))return parseInt(o,10);const o=Object.keys(t),s=0===o.length?0:dt(o.map((e=>parseInt(e,10))));return t[s+1]=e,s+1}function Ye(e){let t="";for(let o=0,s=e.length;o<s;o++)t+=e[o];return t}function 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 je(e,t){let o=e.slice(t).find((e=>e));return o||(o=e.slice(0,t).reverse().find((e=>e))),o||""}function Ke(e,t){return"after"===e?t+1:t}function Qe(e,t){if(e===t)return!0;if(e&&!t||t&&!e)return!1;if(typeof e!=typeof t)return!1;if("object"!=typeof e)return!1;for(const o in t)if(!(o in e)&&void 0!==t[o])return!1;for(const o in e){if(typeof e[o]!=typeof t[o])return!1;if("object"==typeof e[o]){if(!Qe(e[o],t[o]))return!1}else if(e[o]!==t[o])return!1}return!0}function Je(e,t){if(e.length<t.length)return!1;const o=new Set(e);return t.every((e=>o.has(e)))}function et(e){const t={...e};return Object.keys(t).forEach((e=>!t[e]&&delete t[e])),t}const tt=[" ","\t","\f","\v",String.fromCharCode(parseInt("00a0",16)),String.fromCharCode(parseInt("1680",16)),String.fromCharCode(parseInt("2000",16)),String.fromCharCode(parseInt("200a",16)),String.fromCharCode(parseInt("2028",16)),String.fromCharCode(parseInt("2029",16)),String.fromCharCode(parseInt("202f",16)),String.fromCharCode(parseInt("205f",16)),String.fromCharCode(parseInt("3000",16)),String.fromCharCode(parseInt("feff",16))],ot=new RegExp(tt.join("|"),"g"),st=/(\r\n|\r)/g;function nt(e){return e?e.replace(st,ye):""}function it(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 rt 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 at(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 lt(e,t){return e.filter(((e,o)=>!t.includes(o)))}function ct(e){return e.split("\n").map((e=>e.replace(/\s+/g," ").trim())).join("\n")}function ht(e,t,o){return t>o?ht(e,o,t):e>=t&&e<=o}function dt(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 ut(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 gt=/rgba?\(|\s+|\)/gi,pt=/^#([A-F\d]{2}){3,4}$/,mt=["#eb6d00","#0074d9","#ad8e00","#169ed4","#b10dc9","#00a82d","#00a3a3","#f012be","#3d9970","#111111","#62A300","#ff4136","#949494","#85144b","#001f3f"];function ft(e){return bt(e.toString(16).padStart(6,"0"))}function bt(e){let t=e;if(e.startsWith("rgb")?t=function(e){const t=e.replace(gt,"").split(",");let o=255;if(3!==t.length&&4!==t.length)throw new Error("invalid color");if(4===t.length){const e=parseFloat(t.pop()||"1");o=Math.round(255*(e||1))}const s=t.map((e=>parseInt(e,10)));255!==o&&s.push(o);return"#"+Ye(s.map((e=>e.toString(16).padStart(2,"0")))).toUpperCase()}(e):(t=e.replace("#","").toUpperCase(),3!==t.length&&4!==t.length||(t=t.split("").reduce(((e,t)=>e+t+t),"")),t=`#${t}`),!pt.test(t))throw new Error(`invalid color input: ${e}`);return t}function vt(e){try{return bt(e),!0}catch(e){return!1}}const St=e=>e>=0&&e<=255;function Ct(e,t,o,s=1){if(!St(e)||!St(t)||!St(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 Et(e){let{r:t,g:o,b:s}=yt(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 yt(e){let t,o,s,n;if(7===(e=bt(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 xt(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 It(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 Rt(e){return wt(xt(e))}function Tt(e){return It(yt(e))}function At(e){if(e<0)throw new Error(`number must be positive. Got ${e}`);return e<26?String.fromCharCode(65+e):At(Math.floor(e/26)-1)+At(e%26)}const Ot={};for(const $T of"ABCDEFGHIJKLMNOPQRSTUVWXYZ"){const WT=$T.charCodeAt(0)-64;Ot[$T]=WT,Ot[$T.toLowerCase()]=WT}function _t(e){let t=-1;let o=1;for(let s=e.length-1;s>=0;s--){t+=Ot[e[s]]*o,o*=26}return t}function Mt(e){return e>="A"&&e<="Z"||e>="a"&&e<="z"}function Nt(e){return e>="0"&&e<="9"}function Ft(e){let t;e=e.trim();for(let o=0;o<e.length;o++){const s=e[o];if(!t){if("$"===s&&0===o||Mt(s))continue;t=o}if(!Nt(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=_t(o),i=Number(s)-1;if(isNaN(i))throw new Error(`Invalid cell description: ${e}`);return{col:n,row:i}}function Dt(e,t,o={colFixed:!1,rowFixed:!1}){return(o.colFixed?"$":"")+At(e)+(o.rowFixed?"$":"")+String(t+1)}class Lt{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 Lt(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds())}static now(){const e=new Date;return new Lt(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 Pt=new Lt(1899,11,30),Vt=864e5,kt=2e3,Ut=Lt.now().getFullYear(),Bt=Lt.now().getMonth(),Ht=Lt.fromTimestamp(0).getTime()-Pt.getTime(),zt=/^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/,Gt=/^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/,$t=/\/|-|\s/,Wt=/^(\d{1,4})[\/-\s](\d{1,4})([\/-\s](\d{1,4}))?$/,qt=/((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;function Zt(e,t){switch(typeof e){case"number":return e;case"string":return Yt(e,t)?jt(e,t)?.value:!e||isNaN(Number(e))?void 0:Number(e);default:return}}function Yt(e,t){return null!==jt(e,t)}const Xt=new Map;function jt(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(qt);if(s){if(o=function(e){if(e=e.trim(),qt.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 Lt(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(Wt);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($t)[0];if(n=function(e,t){let{year:o,month:s,day:n}=e;const i=function(e){if(!e)return Bt;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 Ut;const t=Number(e);switch(e.length){case 1:return kt+t;case 2:return kt+(kt+t>Ut+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 Lt(a,i,r);if(h.getMonth()!==i||h.getDate()!==r)return null;const d=h.getTime()-Pt.getTime(),u=function(e,t,o,s){const n=e.year?s?"yyyy":"yy":void 0,i=e.month?o?"mm":"m":void 0,r=e.day?o?"dd":"d":void 0;switch(e.type){case"mdy":return[i,r,n].filter($e).join(t);case"ymd":return[n,i,r].filter($e).join(t);case"dmy":return[r,i,n].filter($e).join(t)}}(e,t,l,c);return{value:Math.round(d/Vt),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 Lt(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 Kt(e){const t=Math.trunc(e);let o=Lt.fromTimestamp(t*Vt-Ht),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 Qt(e){return Math.round(Jt(e))}function Jt(e){return(e.getTime()-Pt.getTime())/Vt}function eo(e){return new Lt(e.getFullYear(),e.getMonth()+1,0).getDate()}function to(e){return eo(e)===e.getDate()}function oo(e,t,o){const s=e.getFullYear(),n=e.getMonth(),i=e.getDate(),r=new Lt(s,n+t,1);return o&&i===eo(e)||i>eo(r)?r.setDate(eo(r)):r.setDate(i),r}function so(e){const t=Math.trunc(e);return t%4==0&&t%100!=0||t%400==0}function no(e,t,o){if(e===t)return 0;if(e>t){const o=t;t=e,e=o}const s=Kt(e),n=Kt(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===(so(c)?29:28)&&(i=30,1===l&&r===(so(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+=so(o)?366:365;o=t/e}else s?so(c)&&(o=366):(so(c)&&a<2&&(o=366),so(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 io(e,t){const o=12*(t.getFullYear()-e.getFullYear())+t.getMonth()-e.getMonth();return e.getDate()>t.getDate()?o-1:o}function ro(e,t){const o=e.getTime(),s=t.getTime();return Math.floor((s-o)/Vt)}function ao(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 lo(e,t,o){return t>o?lo(e,o,t):(e=Math.trunc(e),t=Math.trunc(t),o=Math.trunc(o),e>=t&&e<=o)}const co=at((function(e){return e=Re(e),new RegExp(`(^-?\\d+(${e}?\\d*(e\\d+)?)?|^-?${e}\\d+)(?!\\w|!)`)})),ho=at((function(e){const t=Re(e.decimalSeparator),o="(\\s*"+`(\\d+(${Re(e.thousandsSeparator||"")}\\d{3,})*(${t}\\d*)?)`+"|"+`(${t}\\d+)`+")(e(\\+|-)?\\d+)?(\\s*%)?",s="(\\s*-)?",n="(\\s*[\\$€])?",i="^(("+[s+n+o,s+o+n,n+s+o].join(")|(")+"))$";return new RegExp(i,"i")}));function uo(e,t){return!!e&&ho(t).test(e.trim())}const go=at((function(e){return new RegExp(`[$€${Re(e.thousandsSeparator||"")}]`,"g")}));function po(e,t){e=e.replace(go(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 mo(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 fo,bo;!function(e){e.boolean="boolean",e.number="number",e.text="text",e.empty="empty",e.error="error"}(fo||(fo={})),function(e){e.PlainText="text/plain",e.Html="text/html"}(bo||(bo={}));const vo=new Set(["RENAME_SHEET","DELETE_SHEET","CREATE_SHEET","ADD_COLUMNS_ROWS","REMOVE_COLUMNS_ROWS","UNDO","REDO","ADD_MERGE","UPDATE_LOCALE"]),So=new Set([...vo,"MOVE_RANGES"]),Co=new Set([...vo,"DUPLICATE_SHEET","EVALUATE_CELLS","ADD_CONDITIONAL_FORMAT","REMOVE_CONDITIONAL_FORMAT","CHANGE_CONDITIONAL_FORMAT_PRIORITY"]),Eo=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","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 yo(e){return wo.has(e.type)}class xo{reasons;constructor(e=[]){Array.isArray(e)||(e=[e]),e=[...new Set(e)],this.reasons=e.filter((e=>"Success"!==e))}static get Success(){return Io}get isSuccessful(){return 0===this.reasons.length}isCancelledBecause(e){return this.reasons.includes(e)}}const Io=new xo;var Ro;e.CommandResult=void 0,(Ro=e.CommandResult||(e.CommandResult={})).Success="Success",Ro.CancelledForUnknownReason="CancelledForUnknownReason",Ro.WillRemoveExistingMerge="WillRemoveExistingMerge",Ro.MergeIsDestructive="MergeIsDestructive",Ro.CellIsMerged="CellIsMerged",Ro.InvalidTarget="InvalidTarget",Ro.EmptyUndoStack="EmptyUndoStack",Ro.EmptyRedoStack="EmptyRedoStack",Ro.NotEnoughElements="NotEnoughElements",Ro.NotEnoughSheets="NotEnoughSheets",Ro.MissingSheetName="MissingSheetName",Ro.UnchangedSheetName="UnchangedSheetName",Ro.DuplicatedSheetName="DuplicatedSheetName",Ro.DuplicatedSheetId="DuplicatedSheetId",Ro.ForbiddenCharactersInSheetName="ForbiddenCharactersInSheetName",Ro.WrongSheetMove="WrongSheetMove",Ro.WrongSheetPosition="WrongSheetPosition",Ro.InvalidAnchorZone="InvalidAnchorZone",Ro.SelectionOutOfBound="SelectionOutOfBound",Ro.TargetOutOfSheet="TargetOutOfSheet",Ro.WrongCutSelection="WrongCutSelection",Ro.WrongPasteSelection="WrongPasteSelection",Ro.WrongPasteOption="WrongPasteOption",Ro.WrongFigurePasteOption="WrongFigurePasteOption",Ro.EmptyClipboard="EmptyClipboard",Ro.EmptyRange="EmptyRange",Ro.InvalidRange="InvalidRange",Ro.InvalidZones="InvalidZones",Ro.InvalidSheetId="InvalidSheetId",Ro.InvalidFigureId="InvalidFigureId",Ro.InputAlreadyFocused="InputAlreadyFocused",Ro.MaximumRangesReached="MaximumRangesReached",Ro.MinimumRangesReached="MinimumRangesReached",Ro.InvalidChartDefinition="InvalidChartDefinition",Ro.InvalidDataSet="InvalidDataSet",Ro.InvalidLabelRange="InvalidLabelRange",Ro.InvalidScorecardKeyValue="InvalidScorecardKeyValue",Ro.InvalidScorecardBaseline="InvalidScorecardBaseline",Ro.InvalidGaugeDataRange="InvalidGaugeDataRange",Ro.EmptyGaugeRangeMin="EmptyGaugeRangeMin",Ro.GaugeRangeMinNaN="GaugeRangeMinNaN",Ro.EmptyGaugeRangeMax="EmptyGaugeRangeMax",Ro.GaugeRangeMaxNaN="GaugeRangeMaxNaN",Ro.GaugeRangeMinBiggerThanRangeMax="GaugeRangeMinBiggerThanRangeMax",Ro.GaugeLowerInflectionPointNaN="GaugeLowerInflectionPointNaN",Ro.GaugeUpperInflectionPointNaN="GaugeUpperInflectionPointNaN",Ro.GaugeLowerBiggerThanUpper="GaugeLowerBiggerThanUpper",Ro.InvalidAutofillSelection="InvalidAutofillSelection",Ro.WrongComposerSelection="WrongComposerSelection",Ro.MinBiggerThanMax="MinBiggerThanMax",Ro.LowerBiggerThanUpper="LowerBiggerThanUpper",Ro.MidBiggerThanMax="MidBiggerThanMax",Ro.MinBiggerThanMid="MinBiggerThanMid",Ro.FirstArgMissing="FirstArgMissing",Ro.SecondArgMissing="SecondArgMissing",Ro.MinNaN="MinNaN",Ro.MidNaN="MidNaN",Ro.MaxNaN="MaxNaN",Ro.ValueUpperInflectionNaN="ValueUpperInflectionNaN",Ro.ValueLowerInflectionNaN="ValueLowerInflectionNaN",Ro.MinInvalidFormula="MinInvalidFormula",Ro.MidInvalidFormula="MidInvalidFormula",Ro.MaxInvalidFormula="MaxInvalidFormula",Ro.ValueUpperInvalidFormula="ValueUpperInvalidFormula",Ro.ValueLowerInvalidFormula="ValueLowerInvalidFormula",Ro.InvalidSortZone="InvalidSortZone",Ro.WaitingSessionConfirmation="WaitingSessionConfirmation",Ro.MergeOverlap="MergeOverlap",Ro.TooManyHiddenElements="TooManyHiddenElements",Ro.Readonly="Readonly",Ro.InvalidViewportSize="InvalidViewportSize",Ro.InvalidScrollingDirection="InvalidScrollingDirection",Ro.FigureDoesNotExist="FigureDoesNotExist",Ro.InvalidConditionalFormatId="InvalidConditionalFormatId",Ro.InvalidCellPopover="InvalidCellPopover",Ro.EmptyTarget="EmptyTarget",Ro.InvalidFreezeQuantity="InvalidFreezeQuantity",Ro.FrozenPaneOverlap="FrozenPaneOverlap",Ro.ValuesNotChanged="ValuesNotChanged",Ro.InvalidFilterZone="InvalidFilterZone",Ro.FilterOverlap="FilterOverlap",Ro.FilterNotFound="FilterNotFound",Ro.MergeInFilter="MergeInFilter",Ro.NonContinuousTargets="NonContinuousTargets",Ro.DuplicatedFigureId="DuplicatedFigureId",Ro.InvalidSelectionStep="InvalidSelectionStep",Ro.DuplicatedChartId="DuplicatedChartId",Ro.ChartDoesNotExist="ChartDoesNotExist",Ro.InvalidHeaderIndex="InvalidHeaderIndex",Ro.InvalidQuantity="InvalidQuantity",Ro.MoreThanOneColumnSelected="MoreThanOneColumnSelected",Ro.EmptySplitSeparator="EmptySplitSeparator",Ro.SplitWillOverwriteContent="SplitWillOverwriteContent",Ro.NoSplitSeparatorInSelection="NoSplitSeparatorInSelection",Ro.NoActiveSheet="NoActiveSheet",Ro.InvalidLocale="InvalidLocale",Ro.AlreadyInPaintingFormatMode="AlreadyInPaintingFormatMode",Ro.MoreThanOneRangeSelected="MoreThanOneRangeSelected",Ro.NoColumnsProvided="NoColumnsProvided",Ro.ColumnsNotIncludedInZone="ColumnsNotIncludedInZone",Ro.DuplicatesColumnsSelected="DuplicatesColumnsSelected",Ro.InvalidHeaderGroupStartEnd="InvalidHeaderGroupStartEnd",Ro.HeaderGroupAlreadyExists="HeaderGroupAlreadyExists",Ro.UnknownHeaderGroup="UnknownHeaderGroup",Ro.UnknownDataValidationRule="UnknownDataValidationRule",Ro.UnknownDataValidationCriterionType="UnknownDataValidationCriterionType",Ro.InvalidDataValidationCriterionValue="InvalidDataValidationCriterionValue",Ro.InvalidNumberOfCriterionValues="InvalidNumberOfCriterionValues",Ro.BlockingValidationRule="BlockingValidationRule",Ro.InvalidCopyPasteSelection="InvalidCopyPasteSelection",Ro.NoChanges="NoChanges",Ro.InvalidInputId="InvalidInputId";const To=[{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:";"}],Ao=To[0],Oo=["thin","medium","thick","dashed","dotted"];function _o(e){return Array.isArray(e)&&Array.isArray(e[0])}var Mo,No;!function(e){e.UP="up",e.DOWN="down",e.LEFT="left",e.RIGHT="right"}(Mo||(Mo={})),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"}(No||(No={}));const Fo=["number","string","boolean","undefined"];function Do(e,t){if(!e())throw new d(c.GenericError,t)}const Lo=e=>a("The function [[FUNCTION_NAME]] expects a number value, but '%s' is a string, and cannot be coerced to a number.",e);function Po(e,t){switch(typeof e){case"number":return e;case"boolean":return e?1:0;case"string":if(uo(e,t)||""===e)return po(e,t);const o=jt(e,t);if(o)return o.value;throw new Error(Lo(e));default:return 0}}function Vo(e,t){try{return Po(e,t)}catch(e){return}}function ko(e,t){return e.forEach((e=>{e.forEach((e=>{if("number"!=typeof e)throw new Error(a("Function [[FUNCTION_NAME]] expects number values for %s, but got a %s.",typeof e,t))}))})),e}function Uo(e,t){if(""===e)throw new Error(Lo(e));return Po(e,t)}function Bo(e,t){return Math.trunc(Po(e,t))}function Ho(e,t){return Math.trunc(Uo(e,t))}function zo(e){Do((()=>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 Go(e){switch(typeof e){case"string":return e;case"number":return e.toString();case"boolean":return e?"TRUE":"FALSE";default:return""}}const $o=at((function(e){return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"")})),Wo=e=>a("The function [[FUNCTION_NAME]] expects a boolean value, but '%s' is a text, and cannot be coerced to a number.",e);function qo(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(Wo(e))}return!1;case"number":return!!e;default:return!1}}function Zo(e,t){return Kt(Po(e,t))}function Yo(e,t,o){for(let s of e)if(_o(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){Yo(e,t,t)}function jo(e,t,o){Yo(e,(e=>{"number"==typeof e&&t(e)}),(e=>{t(Uo(e,o))}))}function Ko(e,t,o,s,n="rowFirst"){let i=s;for(let s of e)if(_o(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 Qo(e,t,o,s="rowFirst"){return Ko(e,t,t,o,s)}function Jo(e,t,o,s){return Ko(e,((e,o)=>"number"==typeof o?t(e,o):e),((e,o)=>t(e,Uo(o,s))),o)}function es(e,t,o,s){return Ko(e,((e,o)=>null!=o?t(e,"number"==typeof o?o:"boolean"==typeof o?Po(o,s):0):e),((e,o)=>t(e,Po(o,s))),o)}function ts(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 os(e,t){return 0===e.length?[]:ts(e.length,e[0].length,((o,s)=>t(e[o][s])))}function ss(e){return e.length?ts(e[0].length,e.length,((t,o)=>e[o][t])):[]}function ns(e,t){return function(e,t,o){for(let s of e)if(_o(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(Wo(e));return qo(e)}(e))))}function is(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)),uo(n,o)||Yt(n,o)?n=Po(n,o):"TRUE"!==n&&"FALSE"!==n||(n=qo(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 rs(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&&(uo(e,o)||Yt(e,o))?Po(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 as(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(!_o(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=Go(e[t+1]);l.push(is(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=rs(e[t][s][i]??void 0,l[t/2],o),!r)break}r&&t(s,i)}}function ls(e,t,o,s,n,i){if(null==t)return-1;const r=hs(t),a=typeof r;let l,c,h,d,u,g,p=0,m=n-1;const f="desc"===s?t=>hs(i(e,n-t-1)):t=>hs(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 cs(e,t,o,s,n,i=!1){if(null==t)return-1;const r=hs(t),a=i?(e,t)=>n(e,s-t-1):n;let l,c=-1;for(let t=0;t<s;t++){const n=hs(a(e,t));if(n===r)return i?s-t-1:t;"nextSmaller"===o?(!l&&ds(r,n)>=0||ds(r,n)>=0&&ds(n,l)>0)&&(l=n,c=t):"nextGreater"===o&&(!l&&ds(r,n)<=0||ds(r,n)<=0&&ds(n,l)<0)&&(l=n,c=t)}return i&&-1!==c?s-c-1:c}function hs(e){return"string"==typeof e?$o(e):e}function ds(e,t){let o=Fo.indexOf(typeof e)-Fo.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 us(e){return void 0===e?[[]]:_o(e)?e:[[e]]}function gs(e,t){return Qo(e,((e,o)=>(e.push(t(o)),e)),[],"rowFirst")}function ps(e){const t=Lt.now();switch(e){case"today":return Jt(t);case"yesterday":return Jt(Lt.fromTimestamp(t.setDate(t.getDate()-1)));case"tomorrow":return Jt(Lt.fromTimestamp(t.setDate(t.getDate()+1)));case"lastWeek":return Jt(Lt.fromTimestamp(t.setDate(t.getDate()-7)));case"lastMonth":return Jt(Lt.fromTimestamp(t.setMonth(t.getMonth()-1)));case"lastYear":return Jt(Lt.fromTimestamp(t.setFullYear(t.getFullYear()-1)))}}function ms(e,t){return"dateValue"in e&&"exactDate"!==e.dateValue?[ps(e.dateValue)]:e.values.map((e=>Zt(e,t)))}function fs(e,t){return e.values.map((e=>Vo(e,t)))}function bs(e){return 20+120*Math.exp(-.035*(e-1))}const vs=20,Ss=11,Cs=/(\d+?)(?=(\d{3})+(?!\d)|$)/g,Es=/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")},ys={0:a("Sunday"),1:a("Monday"),2:a("Tuesday"),3:a("Wednesday"),4:a("Thursday"),5:a("Friday"),6:a("Saturday")},xs={};function Is(e){let t=xs[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);Fs(i)?o.push({type:"DATE",format:i}):o.push({type:"NUMBER",format:Ys(i)})}t=s}return o}(e),xs[e]=t),t}function Rs(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=Us(e));return function(e,t,o){if("DATE"===t[0].type)return Ls(e,t[0].format);let s=e<0?"-":"";for(let n of t)switch(n.type){case"NUMBER":s+=Ts(Math.abs(e),n.format,o);break;case"STRING":s+=n.format}return s}(e,Is(t),o);case"object":return"0"}}function Ts(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}=Os(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(Es)||[]).length;n="0".repeat(e)+n}o&&(n=n.match(Cs)?.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(Es)||[]).length;o+="0".repeat(s)}return o}(i||"",t.decimalPart)),t.isPercent&&(r+="%"),r}const As=[];function Os(e,t=vs){const o=e.toString();if(o.includes("e"))return function(e,t=vs){let o=As[t];o||(o=new Intl.NumberFormat("en-US",{maximumFractionDigits:t,useGrouping:!1}),As[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(Ms)?.[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:_s(i||"")}}function _s(e){let t=e.length-1;for(;t>=0&&"0"===e[t];)t--;return e.slice(0,t+1)||void 0}const Ms=/^0+/;function Ns(e,t){const{integerDigits:o,decimalDigits:s}=Os(e,20);return s?o+t+s:o}function Fs(e){if(!Ds.has(e[0]))return!1;try{return Ls(1,e),!0}catch(e){return!1}}const Ds=new Set(["h","m","y","d"]);function Ls(e,t){const o=Kt(e),s=t.indexOf("h");let n="",i="";return s>0?(n=Ps(o,t.substring(0,s-1)),i=Vs(o,t.substring(s))):0===s?i=Vs(o,t):s<0&&(n=Ps(o,t)),n+(n&&i?" ":"")+i}function Ps(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 ys[e.getDay()].slice(0,3);case"dddd":return ys[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 Vs(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()-Pt.getTime())/36e5).toString();case"hh":return i.toString().padStart(2,"0");case"mm":return e.getMinutes().toString().padStart(2,"0");case"ss":return e.getSeconds().toString().padStart(2,"0");default:throw new Error(`invalid format: ${t}`)}})).join(":")+r}const ks=at((function(e){return new RegExp(`[0-9]+${Re(e.decimalSeparator)}[0-9]`)}));function Us(e){let{integerDigits:t,decimalDigits:o}=Os(e);if(!o)return"0";const s=t.replace("-","").length;if(s+2>Ss)return"0";const n=Ss-s-1;return({decimalDigits:o}=Os(e,Math.min(n,o.length))),o?"0."+"0".repeat(o.length):"0"}function Bs(e,t){if(!Yt(e,t))return;return jt(e,t).format}function Hs(e){if(!uo(e,Ao))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 zs(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 Gs(e){return js(Is(e).map((e=>"NUMBER"===e.type?{type:e.type,format:{...e.format,decimalPart:void 0}}:e)))}function $s(e,t,o,s){const n=Is(e||"#,##0"),i=[];for(let e=0;e<n.length;e++){const s=n[e];if("NUMBER"!==s.type){i.push(s);continue}i.push({...s,format:{...s.format,magnitude:t,decimalPart:void 0}}),i.push({type:"STRING",format:o});const r=n[e+1];"STRING"===r?.type&&["k","m","b"].includes(r.format)&&e++}return js(i)}function Ws(e,t,o){const s=Is(e).map((e=>"NUMBER"===e.type?{...e,format:qs(e.format,t)}:e)),n=js(s);return xs[n]=s,n}function qs(e,t){const o={...e},s=Math.sign(t),n=o.decimalPart?.length||0,i=Math.min(Math.max(0,n+s),vs);return o.decimalPart="0".repeat(i),""===o.decimalPart&&delete o.decimalPart,o}const Zs=/,*?$/;function Ys(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(Zs)?.[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 js(e){let t="";for(let o of e){let e;switch(o.type){case"NUMBER":const t=o.format;e=t.integerPart,t.thousandsSeparator&&(e=e.slice(0,-3)+","+e.slice(-3)),void 0!==t.decimalPart&&(e+="."+t.decimalPart),t.isPercent&&(e+="%"),t.magnitude&&(e+=",".repeat(Math.log10(t.magnitude)/3));break;case"STRING":e=`[$${o.format}]`;break;case"DATE":e=o.format}t+=e}return t}const Ks=new RegExp(/\$?([A-Z]{1,3})\$?([0-9]{1,7})/,"i"),Qs=new RegExp(/^\$?([A-Z]{1,3})\$?([0-9]{1,7})$/,"i"),Js=new RegExp(/^\$?([A-Z]{1,3})+$/,"i"),en=new RegExp(/^\$?([0-9]{1,7})+$/,"i"),tn=new RegExp(/^\s*('.+'!|[^']+!)?\$?([A-Z]{1,3})$/,"i"),on=new RegExp(/^\s*('.+'!|[^']+!)?\$?([0-9]{1,7})$/,"i"),sn=new RegExp(/^\s*('.+'!|[^']+!)?/.source+"("+[Ks.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 nn(e){return tn.test(e)}function rn(e){return on.test(e)}function an(e){return Js.test(e)}function ln(e){return en.test(e)}function cn(e){return Qs.test(e)}function hn(e){const t=e.split("!"),o=t.pop();return{sheetName:Ae(t.join("!"))||void 0,xc:o}}function dn(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(nn(r))n=i=_t(r),o=s=0,a=!0;else if(rn(r))o=s=parseInt(r,10)-1,n=i=0,l=!0;else{const e=Ft(r);n=i=e.col,o=s=e.row,c=!0}if(t)if(nn(t))i=_t(t),a=!0;else if(rn(t))s=parseInt(t,10)-1,l=!0;else{const e=Ft(t);i=e.col,s=e.row,o=a?s:o,n=l?i:n,c=!0}if(a&&l)throw new Error("Wrong zone xc. The zone cannot be at the same time a full column and a full row");const h={top:o,left:n,bottom:a?void 0:s,right:l?void 0:i};return c=c&&(l||a),c&&(h.hasHeader=c),h}(e);if(void 0!==t.right&&t.right<t.left){const e=t.left;t.left=t.right,t.right=e}if(void 0!==t.bottom&&t.bottom<t.top){const e=t.top;t.top=t.bottom,t.bottom=e}return t}function un(e){const t=dn(e);if(void 0===t.bottom||void 0===t.right)throw new Error("This does not support unbounded ranges");return t}function gn(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))&&(pn(e)&&e.top>=0&&e.left>=0)}function pn(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 mn(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?`${Dt(s,t)}:${At(n)}`:`${At(s)}:${At(n)}`;if(void 0===n&&void 0!==o)return 0!==s||i?`${Dt(s,t)}:${o+1}`:`${t+1}:${o+1}`;if(void 0!==o&&void 0!==n)return r?Dt(s,t):`${Dt(s,t)}:${Dt(n,o)}`;throw new Error(a("Bad zone format"))}function fn(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?Mn(e,i,"RESIZE",n):r<e[t]?Mn(e,i,"MOVE",n):{...e}}function bn(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?Mn(e,i,"RESIZE",n):r<e[t]?Mn(e,i,"MOVE",n):{...e}}function vn(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 Sn(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 Cn(...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 En(e,t){if(yn(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 yn(e,t){return!(e.bottom<t.top||t.bottom<e.top)&&!(e.right<t.left||t.right<e.left)}function xn(e,t,o){const{left:s,right:n,top:i,bottom:r}=o;return e>=s&&e<=n&&t>=i&&t<=r}function In(e,t){return wn(Cn(t,e),t)}function Rn(e,t){const o=e.map(dn),s=t.map(dn),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(_n).flat(),a.map(_n).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=Dn(t);for(const{col:e,row:t}of o)if(!xn(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=Dn({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=Tn(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)?Cn(e,t):e),o.shift());t.push(e)}return Tn(t)}(c).map((e=>({...e,bottom:e.bottom===n+1?void 0:e.bottom,right:e.right===i+1?void 0:e.right}))).map(mn)}function Tn(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=>In(e,t)))||o.push(e)}return o.reverse()}function An(e){return{numberOfRows:e.bottom-e.top+1,numberOfCols:e.right-e.left+1}}function On(e){const{numberOfCols:t,numberOfRows:o}=An(e);return 1===t||1===o}function _n(e){const t=[],[o,s]=[e.right,e.left].sort(((e,t)=>e-t)),[n,i]=[e.top,e.bottom].sort(((e,t)=>e-t));for(const e of Me(o,s+1))for(const o of Me(n,i+1))t.push({col:e,row:o});return t}function Mn(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?!(Ln(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 Nn(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 Fn(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 Dn(e){return{left:e.col,right:e.col,top:e.row,bottom:e.row}}function Ln(e){return void 0===e.right}function Pn(e){return(e.bottom-e.top+1)*(e.right-e.left+1)}function Vn(...e){return e.length<2||1===Rn(e.map(mn),[]).length}class kn{getSheetSize;_zone;parts;invalidXc;prefixSheet=!1;sheetId;invalidSheetName;constructor(e,t){this.getSheetSize=t,this._zone=e.zone,this.prefixSheet=e.prefixSheet,this.invalidXc=e.invalidXc,this.sheetId=e.sheetId,this.invalidSheetName=e.invalidSheetName;let o=[...e.parts];1===e.parts.length&&Pn(this.zone)>1?o.push({...e.parts[0]}):2===e.parts.length&&1===Pn(this.zone)&&o.pop(),this.parts=o}static fromRange(e,t){return e instanceof kn?e:new kn(e,t.getSheetSize)}get unboundedZone(){return this._zone}get zone(){const{left:e,top:t,bottom:o,right:s}=this._zone;if(void 0!==s&&void 0!==o)return this._zone;if(void 0===o&&void 0!==s)return{right:s,top:t,left:e,bottom:this.getSheetSize(this.sheetId).numberOfRows-1};if(void 0===s&&void 0!==o)return{bottom:o,left:e,top:t,right:this.getSheetSize(this.sheetId).numberOfCols-1};throw new Error(a("Bad zone format"))}static getRangeParts(e,t){const o=e.split(":").map((e=>{const t=rn(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(pn(this._zone))return this;const e={...this._zone};let t=this.parts;if(void 0!==e.right&&e.right<e.left){let o=e.right;e.right=e.left,e.left=o,t=[{colFixed:t[1]?.colFixed||!1,rowFixed:t[0]?.rowFixed||!1},{colFixed:t[0]?.colFixed||!1,rowFixed:t[1]?.rowFixed||!1}]}if(void 0!==e.bottom&&e.bottom<e.top){let o=e.bottom;e.bottom=e.top,e.top=o,t=[{colFixed:t[0]?.colFixed||!1,rowFixed:t[1]?.rowFixed||!1},{colFixed:t[1]?.colFixed||!1,rowFixed:t[0]?.rowFixed||!1}]}return this.clone({zone:e,parts:t})}clone(e){return new kn({zone:e?.zone?e.zone:{...this._zone},sheetId:e?.sheetId?e.sheetId:this.sheetId,invalidSheetName:e&&"invalidSheetName"in e?e.invalidSheetName:this.invalidSheetName,invalidXc:e&&"invalidXc"in e?e.invalidXc:this.invalidXc,parts:e?.parts?e.parts:this.parts.map((e=>({rowFixed:e.rowFixed,colFixed:e.colFixed}))),prefixSheet:e?.prefixSheet?e.prefixSheet:this.prefixSheet},this.getSheetSize)}}function Un(e,t,o){const s=o.sheetId===e?t:o.sheetId;return o.clone({sheetId:s})}function Bn(e,t,o){if(!o)return;const s=e.getRangeFromSheetXC(t,o);return s.invalidSheetName||s.invalidXc?void 0:s}function Hn(e){const t=[];for(const o of e)for(const e of _n(o.zone))t.push({...e,sheetId:o.sheetId});return t}function zn(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 Gn(e){const t=[];for(let o=0;o<e;o++){const e={cells:{}};t.push(e)}return t}function $n(e,t,o){return o.map((o=>o>=e?o+t:o))}function Wn(e,t){return e=[...e].sort(((e,t)=>t-e)),t.map((t=>{for(const o of e)if(t>o)t--;else if(t===o)return;return t})).filter($e)}function qn(e,t=1){return t*(e+Z)-Z}const Zn={};function Yn(e,t,o){const s=jn(o);if(Zn[s]||(Zn[s]={}),void 0===Zn[s][t]){e.save(),e.font=s;const o=e.measureText(t).width;e.restore(),Zn[s][t]=o}return Zn[s][t]}function Xn(e){return Math.round(96*e/72)}function jn(e){return`${e.italic?"italic ":""}${e.bold?"bold":oe} ${Kn(e)}px ${ne}`}function Kn(e){return Xn(e?.fontSize||se)}function Qn(e,t,o,s){if(Yn(e,t,s)<=o)return[t];const n=[];let i="";for(let r of t){Yn(e,i+r,s)>o?(n.push(i),i=r):i+=r}return n.push(i),n}function Jn(e,t,o,s){o||(o={});const n=[],i=t.includes(ye)?t.split(ye):[t];for(const t of i){const i=t.includes(" ")?t.split(" "):[t];if(!s){n.push(t);continue}let r="",a=s;for(let t of i){const i=Qn(e,t,s,o),l=i.pop(),c=Yn(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=Yn(e,t,o);i<=a?(r+=t,a-=i):(n.push(r),r=l,a=s-c)}}""!==r&&n.push(r)}return n}function ei(e){return e?e.toLowerCase():""}const ti=/([0-9\.]*)px/;function oi(e,t,o,s=!1,n=!1,i=function(e){return Number(e.match(ti)?.[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 si{isFastIdStrategy=!1;fastIdStart=0;setIsFastStrategy(e){this.isFastIdStrategy=e}uuidv4(){return this.isFastIdStrategy?(this.fastIdStart++,String(this.fastIdStart)):window.crypto&&window.crypto.getRandomValues?([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16))):"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}}function ni(e){return e.map(ri).sort(((e,t)=>e.sequence-t.sequence))}const ii=new si;function ri(e){const t=e.name,o=e.children,s=e.description,n=e.icon;return{id:e.id||ii.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(ri):()=>[],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 ai(e,t){return"REMOVE_COLUMNS_ROWS"===t.type?Sn(e,"COL"===t.dimension?"left":"top",t.elements):"ADD_COLUMNS_ROWS"===t.type?fn(e,"COL"===t.dimension?"left":"top",t.base,t.position,t.quantity):{...e}}function li(e,t){const o="DELETE_SHEET"===t.type&&t.sheetId;if("sheetId"in t&&e._sheetId!==t.sheetId)return e;{const s=ai(e._zone,t);if(s&&o!==e._sheetId)return{...e,_zone:s}}}class ci extends t.Component{static template="o-spreadsheet-ChartJsComponent";canvas=t.useRef("graphContainer");chart;get background(){return this.chartRuntime.background}get canvasStyle(){return`background-color: ${this.background}`}get chartRuntime(){const e=this.env.model.getters.getChartRuntime(this.props.figure.id);if(!("chartJsConfig"in e))throw new Error("Unsupported chart runtime");return e}setup(){t.onMounted((()=>{const e=this.chartRuntime;this.createChart(Te(e.chartJsConfig))})),t.useEffect((()=>this.updateChartJs(Te(this.chartRuntime))),(()=>[this.chartRuntime]))}createChart(e){const t=this.canvas.el.getContext("2d");this.chart=new window.Chart(t,e)}updateChartJs(e){const t=e.chartJsConfig;t.data&&t.data.datasets?(this.chart.data=t.data,t.options?.plugins?.title&&(this.chart.config.options.plugins.title=t.options.plugins.title),t.options&&"valueLabel"in t.options&&t.options?.valueLabel&&(this.chart.config.options.valueLabel=t.options.valueLabel)):this.chart.data.datasets=[],this.chart.config.options.plugins.tooltip=t.options.plugins.tooltip,this.chart.config.options.plugins.legend=t.options.plugins.legend,this.chart.config.options.scales=t.options?.scales,this.chart.update()}}ci.props={figure:Object};class hi{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 di(e,t,o,s){let n=!1;const i=[];for(let s in o){let r=o[s];if(r.labelCell){const e=pi(r.labelCell,t);r.labelCell!==e&&(n=!0,r={...r,labelCell:e})}const a=pi(r.dataRange,t);void 0===a||e.getRangeString(a,a.sheetId)===le?(n=!0,r=void 0):a!==r.dataRange&&(n=!0,r={...r,dataRange:a}),i[s]=r}let r=s;const a=pi(r,t);a!==r&&(n=!0,r=a);return{isStale:n,dataSets:i.filter($e),labelRange:r}}function ui(e,t,o){return o.map((o=>({dataRange:Un(e,t,o.dataRange),labelCell:o.labelCell?Un(e,t,o.labelCell):void 0})))}function gi(e,t,o){return o?Un(e,t,o):void 0}function pi(e,t){if(!e)return;const o=t(e);switch(o.changeType){case"NONE":return e;case"REMOVE":return;default:return o.range}}function mi(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(fi(e,a,o,s?{top:o.top,bottom:o.top,left:o.left,right:o.left}:void 0))}}else n.push(fi(e,a,r,s?{top:r.top,bottom:r.top,left:r.left,right:r.left}:void 0))}return n}function fi(e,t,o,s){if(o.left!==o.right&&o.top!==o.bottom)throw new Error(`Zone should be a single column or row: ${mn(o)}`);if(s){const n=mn(o),i=mn(s);return{labelCell:e.getRangeFromSheetXC(t,i),dataRange:e.getRangeFromSheetXC(t,n)}}return{labelCell:void 0,dataRange:e.getRangeFromSheetXC(t,mn(o))}}function bi(e,t){const o=t.labelCell?.zone;let s=t.dataRange.zone;if(o){const{numberOfRows:e,numberOfCols:t}=An(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 vi(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 Si(e,t){let o;if(e.labelRange){const s=ai(dn(e.labelRange),t);o=s?mn(s):void 0}const s=e.dataSets.map(dn).map((e=>ai(e,t))).filter($e).map(mn);return{...e,labelRange:o,dataSets:s}}const Ci=["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 Ei{graphColorIndex=0;next(){return Ci[this.graphColorIndex++%Ci.length]}}function wi(e){return e&&Et(e)<.3?"#FFFFFF":"#000000"}function yi(e){if(e.dataSets){const t=void 0!==e.dataSets.find((e=>!sn.test(e)));if(t)return"InvalidDataSet";if(e.dataSets.map(dn).some((e=>e.top!==e.bottom&&Ln(e))))return"InvalidDataSet"}return"Success"}function xi(e){if(e.labelRange){if(!sn.test(e.labelRange||""))return"InvalidLabelRange"}return"Success"}function Ii(e,t,o){if(!o)return!1;if(!e)return!1;if(!t)return!0;const s=Pn(t.dataRange.zone);return!(Pn(e.zone)<s)}function Ri(e,t,o,s){if(e){if("text"===o||t?.type!==fo.number||e.type!==fo.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 Rs(n,{format:e.format,locale:s});const i=Math.abs(parseFloat(n.toFixed(2))).toLocaleString();return"percentage"===o?i+"%":i}}return""}function Ti(e,t,o,s,n){if("text"===t||e?.type!==fo.number||o?.type!==fo.number)return;const i=o.value-e.value;return i>0?s:i<0?n:void 0}function Ai(e,t,o){if("text"===o||e?.type!==fo.number||t?.type!==fo.number)return"neutral";const s=t.value-e.value;return s>0?"up":s<0?"down":"neutral"}function Oi(e){return e.keyValue&&!sn.test(e.keyValue)?"InvalidScorecardKeyValue":"Success"}function _i(e){return e.baseline&&!sn.test(e.baseline)?"InvalidScorecardBaseline":"Success"}const Mi=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"),Ni=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 Fi=class e extends hi{keyValue;baseline;baselineMode;baselineDescr;background;baselineColorUp;baselineColorDown;fontColor;type="scorecard";constructor(e,t,o){super(e,t,o),this.keyValue=Bn(o,t,e.keyValue),this.baseline=Bn(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,Oi,_i)}static getDefinitionFromContextCreation(e){return{background:e.background,type:"scorecard",keyValue:e.range?e.range[0]:void 0,title:e.title||"",baselineMode:ge,baselineColorUp:pe,baselineColorDown:me,baseline:e.auxiliaryRange||""}}static transformDefinition(e,t){let o,s;return e.baseline&&(o=ai(dn(e.baseline),t)),e.keyValue&&(s=ai(dn(e.keyValue),t)),{...e,baseline:o?mn(o):void 0,keyValue:s?mn(s):void 0}}copyForSheetId(t){const o=gi(this.sheetId,t,this.baseline),s=gi(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=pi(this.baseline,t),s=pi(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 Di(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,oi(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(Mi);break;case"up":o.fill(Ni)}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,oi(o,e.key.text,e.key.position,e.key.style.underline,e.key.style.strikethrough))}function Li(e,t=!1,o=!1){return`${o?"italic":""} ${t?"bold":""} ${e}px ${ne}`}function Pi({width:e,height:t},o){return new Vi({width:e,height:t},o).computeDesign()}class Vi{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 Et(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 Bi(this.runtime.keyValueStyle).getElementMaxFontSize(this.getDrawableHeight(),this)*s,i=new Ui(this.runtime.baselineStyle).getElementMaxFontSize(this.getDrawableHeight(),this)*s;return{title:{font:Li(18),color:this.secondaryFontColor},keyValue:{color:this.runtime.keyValueStyle?.textColor||this.runtime.fontColor,font:Li(n,this.runtime.keyValueStyle?.bold,this.runtime.keyValueStyle?.italic),strikethrough:this.runtime.keyValueStyle?.strikethrough,underline:this.runtime.keyValueStyle?.underline},baselineValue:{font:Li(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:Li(.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 Ui(this.runtime.baselineStyle),t=new Bi(this.runtime.keyValueStyle);return e.getElementWidth(.35,this.context,this)>t.getElementWidth(.65,this.context,this)?e:t}}class ki{style;constructor(e={}){this.style=e}measureTextWidth(e,t,o){return e.font=Li(o,this.style.bold,this.style.italic),e.measureText(t).width}}class Ui extends ki{getElementWidth(e,t,o){if(!o.runtime)return 0;const s=o.baseline,n="neutral"!==o.baselineArrow?"A "+s:s;let i=this.measureTextWidth(t,n,e);return i+=this.measureTextWidth(t,o.baselineDescr,.9*e),i}getElementMaxFontSize(e,t){if(!t.runtime)return 0;return(""!==t.baseline||t.baselineDescr?.35*e:0)/1.2}}class Bi extends ki{getElementWidth(e,t,o){if(!o.runtime)return 0;const s=o.keyValue||"";return this.measureTextWidth(t,s,e)}getElementMaxFontSize(e,t){if(!t.runtime)return 0;return(""!==t.baseline||t.baselineDescr?.65*e:e)/1.2}}class Hi 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;Di(Pi(e.getBoundingClientRect(),this.runtime),e)}}Hi.props={figure:Object};class zi{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 Gi(e){return/^https?:\/\//i.test(e)?e:`https://${e}`}const $i=new zi;function Wi(e,t){return{url:e=Gi(e),label:t||e,isExternal:!0,isUrlEditable:!0}}$i.add("sheet_URL",{match:e=>He(e),createLink:(e,t)=>({label:t,url:e,isExternal:!1,isUrlEditable:!1}),urlRepresentation(e,t){const o=Ge(e);return t.tryGetSheetName(o)||a("Invalid sheet")},open(e,t){const o=Ge(e);t.model.dispatch("ACTIVATE_SHEET",{sheetIdFrom:t.model.getters.getActiveSheetId(),sheetIdTo:o})},sequence:0});const qi={createLink:Wi,match:e=>Ve(e),open:e=>window.open(e,"_blank"),urlRepresentation:e=>e,sequence:0};function Zi(e){return $i.getAll().sort(((e,t)=>e.sequence-t.sequence)).find((t=>t.match(e)))||qi}function Yi(e,t){return Zi(e.url).urlRepresentation(e.url,t)}function Xi(e,t){Zi(e.url).open(e.url,t)}function ji(e){if("string"==typeof e){if(Pe(e)){const{label:t,url:o}=Ue(e);return Zi(o).createLink(o,t)}return Ve(e)?Wi(e):void 0}}function Ki(e,t){return Ji(Qi(e||"",t.locale),t)}function Qi(e,t){if(e.startsWith("="))throw new Error(`Cannot parse "${e}" because it's not a literal value. It's a formula`);return uo(e,Ao)?Po(e,Ao):Yt(e,t)?Po(e,t):function(e){const t=e.toUpperCase();return"TRUE"===t||"FALSE"===t}(e)?"TRUE"===e.toUpperCase():e}function Ji(e,t){const o=ji(e);return o?{...er(Qi(o.label,t.locale),{format:t.format||Bs(o.label,t.locale)||Hs(o.label),locale:t.locale}),link:o}:er(e,t)}function er(e,t){try{for(const o of nr){const s=o(e,t);if(s)return s}return function(e,t){return{type:fo.text,value:e,format:t.format,isAutoSummable:!0,defaultAlign:"left",formattedValue:Rs(e,t)}}((e||"").toString(),t)}catch(e){return sr(new d(c.GenericError,e.message||Se))}}function tr(e,t){return{type:fo.number,value:e||0,format:t.format,isAutoSummable:!0,defaultAlign:"right",formattedValue:Rs(e,t)}}const or={type:fo.empty,value:"",format:void 0,isAutoSummable:!0,defaultAlign:"left",formattedValue:""};function sr(e){return{type:fo.error,value:e.errorType,error:e,isAutoSummable:!1,defaultAlign:"center",formattedValue:e.errorType}}const nr=[function(e,t){if(""===e)return function(e){return void 0===e.format?or:{type:fo.empty,value:"",format:e.format,isAutoSummable:!0,defaultAlign:"left",formattedValue:""}}(t)},function(e,t){if(t.format&&"number"==typeof e&&Fs(t.format))return function(e,t){const o=Rs(e,t);return{type:fo.number,value:e,format:t.format,isAutoSummable:!1,defaultAlign:"right",formattedValue:o}}(e,t)},function(e,t){return"number"==typeof e?tr(e,t):null===e?tr(0,t):void 0},function(e,t){if("boolean"==typeof e)return function(e,t){const o=e?"TRUE":"FALSE";return{type:fo.boolean,value:e,format:t.format,isAutoSummable:!1,defaultAlign:"center",formattedValue:o}}(e,t)}],ir=new zi;ir.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=Rs(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:Ki(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 rr=new zi,ar=/(\d+)$/,lr=/^(.*\D+)/,cr=/^(.*\D+)(\d+)$/;function hr(e,t,o){let s=[],n=!1;for(let i of t){i===e&&(n=!0);const t=i?.isFormula?void 0:Ki(i?.content,{locale:Ao});if(t&&o(t))s.push(t);else{if(n)return s;s=[]}}return s}function dr(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}rr.add("simple_value_copy",{condition:(e,t)=>!(1!==t.length||e.isFormula||e.format&&Fs(e.format)),generateRule:()=>({type:"COPY_MODIFIER"}),sequence:10}).add("increment_alphanumeric_value",{condition:e=>!e.isFormula&&Ki(e.content,{locale:Ao}).type===fo.text&&cr.test(e.content),generateRule:(e,t)=>{const o=parseInt(e.content.match(ar)[0]),s=e.content.match(lr)[0],n=e.content.length-s.length,i=hr(e,t,(e=>e.type===fo.text&&cr.test(e.value))).filter((e=>s===e.value.toString().match(lr)[0])).map((e=>parseInt(e.value.toString().match(ar)[0]))),r=dr(i);return{type:"ALPHANUMERIC_INCREMENT_MODIFIER",prefix:s,current:o,increment:r,numberPostfixLength:n}},sequence:15}).add("copy_text",{condition:e=>!e.isFormula&&Ki(e.content,{locale:Ao}).type===fo.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&&Ki(e.content,{locale:Ao}).type===fo.number,generateRule:(e,t)=>{const o=dr(hr(e,t,(e=>e.type===fo.number)).map((e=>Number(e.value)))),s=Ki(e.content,{locale:Ao});return{type:"INCREMENT_MODIFIER",increment:o,current:s.type===fo.number?s.value:0}},sequence:40});const ur={};let gr=0;function pr(e,...t){const o="__sheet__"+gr++;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),ur[e]=o}(o,String.raw(e,...t)),function(e){const t=ur[e];t.setAttribute("component",e),document.head.appendChild(t)}(o),o}function mr({strikethrough:e,underline:t}){return e||t?`${e?"line-through":""} ${t?"underline":""}`:"none"}function fr(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 br(e){let t="";for(const o in e)e[o]&&(t+=`${o}:${e[o]}; `);return t}pr`
|
|
2
2
|
.o-error-tooltip {
|
|
3
3
|
font-size: 13px;
|
|
4
4
|
background-color: white;
|
|
@@ -2638,4 +2638,4 @@
|
|
|
2638
2638
|
<tableParts count="${e.filterTables.length}">
|
|
2639
2639
|
${ay(a)}
|
|
2640
2640
|
</tableParts>
|
|
2641
|
-
`}var DT;!function(e){e[e.Ready=0]="Ready",e[e.Running=1]="Running",e[e.RunningCore=2]="RunningCore",e[e.Finalizing=3]="Finalizing"}(DT||(DT={}));function LT(e,t={}){const o=Te(t);return o.type=e,o}const PT={},VT={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:$},kT={autofillModifiersRegistry:ir,autofillRulesRegistry:rr,cellMenuRegistry:rb,colMenuRegistry:$v,linkMenuRegistry:Aa,functionRegistry:_f,featurePluginRegistry:nR,statefulUIPluginRegistry:iR,coreViewsPluginRegistry:rR,corePluginRegistry:sR,rowMenuRegistry:Zv,sidePanelRegistry:nC,figureRegistry:Al,chartSidePanelComponentRegistry:mS,chartComponentRegistry:yl,chartRegistry:wl,topbarMenuRegistry:Yv,topbarComponentRegistry:iC,clickableCellRegistry:aR,otRegistry:Xv,inverseCommandRegistry:Nl,urlRegistry:$i,cellPopoverRegistry:Ma,numberFormatMenuRegistry:Wv,repeatLocalCommandTransformRegistry:zI,repeatCommandTransformRegistry:HI},UT={arg:Ec,toBoolean:qo,toJsDate:Zo,toNumber:Po,toString:Go,toXC:Dt,toZone:un,toUnboundedZone:dn,toCartesian:Ft,numberToLetters:At,lettersToNumber:_t,UuidGenerator:si,formatValue:Rs,createCurrencyFormat:zs,computeTextWidth:Yn,createEmptyWorkbookData:By,createEmptySheet:Uy,createEmptyExcelSheet:Hy,getDefaultChartJsRuntime:Xa,chartFontColor:wi,ChartColors:Ei,EvaluationError:d,CellErrorLevel:h,getFillingMode:el,rgbaToHex:wt,colorToRGBA:yt,positionToZone:Dn,isDefined:$e,isMatrix:_o,lazy:Xe,genericRepeat:GI,createAction:ri,createActions:ni,transformRangeData:li,deepEquals:Qe,isNumber:uo,isDateTime:Yt},BT={isMarkdownLink:Pe,parseMarkdownLink:Ue,markdownLink:ke,openLink:Xi,urlRepresentation:Yi},HT={ChartPanel:fS,ChartFigure:Il,ChartJsComponent:ci,Grid:dE,GridOverlay:XC,ScorecardChart:Hi,LineConfigPanel:uS,LineBarPieDesignPanel:cS,BarConfigPanel:oS,LineBarPieConfigPanel:tS,GaugeChartConfigPanel:hS,GaugeChartDesignPanel:dS,ScorecardChartConfigPanel:gS,ScorecardChartDesignPanel:pS,FigureComponent:rC,Menu:zr,SelectionInput:Jv},zT={useDragAndDropListItems:ES};const GT={DEFAULT_LOCALE:Ao};e.AbstractChart=hi,e.CorePlugin=Gy,e.DispatchResult=xo,e.EvaluationError=d,e.Model=class extends fI{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 si,c=!0){super(),n===o&&i===s&&(i=()=>!0),a=Py(e,a);const h=Dy(e,c);this.state=new qR,this.uuidGenerator=l,this.config=this.setupConfig(r),this.session=this.setupSession(h.revisionId),this.coreGetters={},this.range=new _x(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 WR(this.getters),this.coreHandlers.push(this.range),this.handlers.push(this.range),this.corePluginConfig=this.setupCorePluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of sR.getAll())this.setupCorePlugin(e,h);Object.assign(this.getters,this.coreGetters),this.session.loadInitialMessages(a);for(let e of rR.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 iR.getAll()){const t=this.setupUiPlugin(e);this.statefulUIPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}for(let e of nR.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 TI(zR({initialRevisionId:e,recordChanges:this.state.recordChanges.bind(this.state),dispatch:e=>{this.checkDispatchAllowed(e).isSuccessful&&(this.isReplayingCommand=!0,this.dispatchToHandlers(this.coreHandlers,e),this.isReplayingCommand=!1)}}),this.config.transportService,e)}setupSessionEvents(){this.session.on("remote-revision-received",this,this.onRemoteRevisionReceived),this.session.on("revision-undone",this,(({commands:e})=>{this.dispatchFromCorePlugin("UNDO",{commands:e}),this.finalize()})),this.session.on("revision-redone",this,(({commands:e})=>{this.dispatchFromCorePlugin("REDO",{commands:e}),this.finalize()})),this.session.on("unexpected-revision-id",this,(()=>this.trigger("unexpected-revision-id"))),this.session.on("collaborative-event-received",this,(()=>{this.trigger("update")}))}setupConfig(e){const t=e.client||{id:this.uuidGenerator.uuidv4(),name:a("Anonymous").toString()},o=e.transportService||new FR;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(To));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=yo(e)?this.checkDispatchAllowedCoreCommand(e):this.checkDispatchAllowedLocalCommand(e);return t.some((e=>"Success"!==e))?new xo(t.flat()):xo.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(LT(e,t));dispatch=(e,t)=>{const o=LT(e,t);let s=this.status;if(this.getters.isReadonly()&&(n=o,!Eo.has(n.type)))return new xo("Readonly");var n;if(!this.session.canApplyOptimisticUpdate())return new xo("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((()=>{yo(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(yo(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(yo(o))throw new Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,o)}return xo.Success};dispatchFromCorePlugin=(e,t)=>{const o=LT(e,t),s=this.status;this.status=2;const n=this.isReplayingCommand?this.coreHandlers:this.handlers;return this.dispatchToHandlers(n,o),this.status=s,xo.Success};dispatchToHandlers(e,t){const o=yo(t);for(const s of e)!o&&s instanceof Gy||s.beforeHandle(t);for(const s of e)!o&&s instanceof Gy||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=By();for(let t of this.handlers)t instanceof Gy&&t.export(e);return e.revisionId=this.session.getRevisionId()||ce,e=Te(e),e}updateMode(e){"normal"!==e&&this.dispatch("CANCEL_EDITION"),this.config.mode=e,this.trigger("update")}exportXLSX(){this.dispatch("EVALUATE_CELLS");let e={...By(),sheets:[Hy(Fy,"Sheet1")]};for(let t of this.handlers)t instanceof zy&&t.exportForExcel(e);return e=Te(e),NT(e)}garbageCollectExternalResources(){for(const e of this.corePlugins)e.garbageCollectExternalResources()}},e.Registry=zi,e.Revision=II,e.SPREADSHEET_DIMENSIONS=VT,e.Spreadsheet=NR,e.UIPlugin=Mx,e.__info__=PT,e.addFunction=function e(t,o){return _f.add(t,o),{addFunction:(t,o)=>e(t,o)}},e.astToFormula=cx,e.compile=fx,e.compileTokens=bx,e.components=HT,e.constants=GT,e.convertAstNodes=ix,e.coreTypes=wo,e.findCellInNewZone=Nn,e.functionCache=mx,e.helpers=UT,e.hooks=zT,e.invalidateCFEvaluationCommands=Co,e.invalidateDependenciesCommands=So,e.invalidateEvaluationCommands=vo,e.iterateAstNodes=rx,e.links=BT,e.load=Dy,e.parse=sx,e.parseTokens=nx,e.readonlyAllowedCommands=Eo,e.registries=kT,e.setDefaultSheetViewSize=function(e){Ee=e},e.setTranslationMethod=function(e,t=(()=>!0)){n=e,i=t},e.tokenize=Zr,PT.version="17.0.48",PT.date="2025-02-05T07:18:39.331Z",PT.hash="aea9101"}(this.o_spreadsheet=this.o_spreadsheet||{},owl);
|
|
2641
|
+
`}var DT;!function(e){e[e.Ready=0]="Ready",e[e.Running=1]="Running",e[e.RunningCore=2]="RunningCore",e[e.Finalizing=3]="Finalizing"}(DT||(DT={}));function LT(e,t={}){const o=Te(t);return o.type=e,o}const PT={},VT={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:$},kT={autofillModifiersRegistry:ir,autofillRulesRegistry:rr,cellMenuRegistry:rb,colMenuRegistry:$v,linkMenuRegistry:Aa,functionRegistry:_f,featurePluginRegistry:nR,statefulUIPluginRegistry:iR,coreViewsPluginRegistry:rR,corePluginRegistry:sR,rowMenuRegistry:Zv,sidePanelRegistry:nC,figureRegistry:Al,chartSidePanelComponentRegistry:mS,chartComponentRegistry:yl,chartRegistry:wl,topbarMenuRegistry:Yv,topbarComponentRegistry:iC,clickableCellRegistry:aR,otRegistry:Xv,inverseCommandRegistry:Nl,urlRegistry:$i,cellPopoverRegistry:Ma,numberFormatMenuRegistry:Wv,repeatLocalCommandTransformRegistry:zI,repeatCommandTransformRegistry:HI},UT={arg:Ec,toBoolean:qo,toJsDate:Zo,toNumber:Po,toString:Go,toXC:Dt,toZone:un,toUnboundedZone:dn,toCartesian:Ft,numberToLetters:At,lettersToNumber:_t,UuidGenerator:si,formatValue:Rs,createCurrencyFormat:zs,computeTextWidth:Yn,createEmptyWorkbookData:By,createEmptySheet:Uy,createEmptyExcelSheet:Hy,getDefaultChartJsRuntime:Xa,chartFontColor:wi,ChartColors:Ei,EvaluationError:d,CellErrorLevel:h,getFillingMode:el,rgbaToHex:wt,colorToRGBA:yt,positionToZone:Dn,isDefined:$e,isMatrix:_o,lazy:Xe,genericRepeat:GI,createAction:ri,createActions:ni,transformRangeData:li,deepEquals:Qe,isNumber:uo,isDateTime:Yt},BT={isMarkdownLink:Pe,parseMarkdownLink:Ue,markdownLink:ke,openLink:Xi,urlRepresentation:Yi},HT={ChartPanel:fS,ChartFigure:Il,ChartJsComponent:ci,Grid:dE,GridOverlay:XC,ScorecardChart:Hi,LineConfigPanel:uS,LineBarPieDesignPanel:cS,BarConfigPanel:oS,LineBarPieConfigPanel:tS,GaugeChartConfigPanel:hS,GaugeChartDesignPanel:dS,ScorecardChartConfigPanel:gS,ScorecardChartDesignPanel:pS,FigureComponent:rC,Menu:zr,SelectionInput:Jv},zT={useDragAndDropListItems:ES};const GT={DEFAULT_LOCALE:Ao};e.AbstractChart=hi,e.CorePlugin=Gy,e.DispatchResult=xo,e.EvaluationError=d,e.Model=class extends fI{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 si,c=!0){super(),n===o&&i===s&&(i=()=>!0),a=Py(e,a);const h=Dy(e,c);this.state=new qR,this.uuidGenerator=l,this.config=this.setupConfig(r),this.session=this.setupSession(h.revisionId),this.coreGetters={},this.range=new _x(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 WR(this.getters),this.coreHandlers.push(this.range),this.handlers.push(this.range),this.corePluginConfig=this.setupCorePluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of sR.getAll())this.setupCorePlugin(e,h);Object.assign(this.getters,this.coreGetters),this.session.loadInitialMessages(a);for(let e of rR.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 iR.getAll()){const t=this.setupUiPlugin(e);this.statefulUIPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}for(let e of nR.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 TI(zR({initialRevisionId:e,recordChanges:this.state.recordChanges.bind(this.state),dispatch:e=>{this.checkDispatchAllowed(e).isSuccessful&&(this.isReplayingCommand=!0,this.dispatchToHandlers(this.coreHandlers,e),this.isReplayingCommand=!1)}}),this.config.transportService,e)}setupSessionEvents(){this.session.on("remote-revision-received",this,this.onRemoteRevisionReceived),this.session.on("revision-undone",this,(({commands:e})=>{this.dispatchFromCorePlugin("UNDO",{commands:e}),this.finalize()})),this.session.on("revision-redone",this,(({commands:e})=>{this.dispatchFromCorePlugin("REDO",{commands:e}),this.finalize()})),this.session.on("unexpected-revision-id",this,(()=>this.trigger("unexpected-revision-id"))),this.session.on("collaborative-event-received",this,(()=>{this.trigger("update")}))}setupConfig(e){const t=e.client||{id:this.uuidGenerator.uuidv4(),name:a("Anonymous").toString()},o=e.transportService||new FR;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(To));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=yo(e)?this.checkDispatchAllowedCoreCommand(e):this.checkDispatchAllowedLocalCommand(e);return t.some((e=>"Success"!==e))?new xo(t.flat()):xo.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(LT(e,t));dispatch=(e,t)=>{const o=LT(e,t);let s=this.status;if(this.getters.isReadonly()&&(n=o,!Eo.has(n.type)))return new xo("Readonly");var n;if(!this.session.canApplyOptimisticUpdate())return new xo("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((()=>{yo(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(yo(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(yo(o))throw new Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,o)}return xo.Success};dispatchFromCorePlugin=(e,t)=>{const o=LT(e,t),s=this.status;this.status=2;const n=this.isReplayingCommand?this.coreHandlers:this.handlers;return this.dispatchToHandlers(n,o),this.status=s,xo.Success};dispatchToHandlers(e,t){const o=yo(t);for(const s of e)!o&&s instanceof Gy||s.beforeHandle(t);for(const s of e)!o&&s instanceof Gy||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=By();for(let t of this.handlers)t instanceof Gy&&t.export(e);return e.revisionId=this.session.getRevisionId()||ce,e=Te(e),e}updateMode(e){"normal"!==e&&this.dispatch("CANCEL_EDITION"),this.config.mode=e,this.trigger("update")}exportXLSX(){this.dispatch("EVALUATE_CELLS");let e={...By(),sheets:[Hy(Fy,"Sheet1")]};for(let t of this.handlers)t instanceof zy&&t.exportForExcel(e);return e=Te(e),NT(e)}garbageCollectExternalResources(){for(const e of this.corePlugins)e.garbageCollectExternalResources()}},e.Registry=zi,e.Revision=II,e.SPREADSHEET_DIMENSIONS=VT,e.Spreadsheet=NR,e.UIPlugin=Mx,e.__info__=PT,e.addFunction=function e(t,o){return _f.add(t,o),{addFunction:(t,o)=>e(t,o)}},e.astToFormula=cx,e.compile=fx,e.compileTokens=bx,e.components=HT,e.constants=GT,e.convertAstNodes=ix,e.coreTypes=wo,e.findCellInNewZone=Nn,e.functionCache=mx,e.helpers=UT,e.hooks=zT,e.invalidateCFEvaluationCommands=Co,e.invalidateDependenciesCommands=So,e.invalidateEvaluationCommands=vo,e.iterateAstNodes=rx,e.links=BT,e.load=Dy,e.parse=sx,e.parseTokens=nx,e.readonlyAllowedCommands=Eo,e.registries=kT,e.setDefaultSheetViewSize=function(e){Ee=e},e.setTranslationMethod=function(e,t=(()=>!0)){n=e,i=t},e.tokenize=Zr,PT.version="17.0.49",PT.date="2025-02-10T08:55:47.771Z",PT.hash="1049319"}(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-02-
|
|
6
|
-
@hash
|
|
4
|
+
@version 17.0.49
|
|
5
|
+
@date 2025-02-10T08:56:20.813Z
|
|
6
|
+
@hash 1049319
|
|
7
7
|
-->
|
|
8
8
|
<odoo>
|
|
9
9
|
<t t-name="o-spreadsheet-ActionButton">
|