@odoo/o-spreadsheet
Version:
A spreadsheet component
9 lines (8 loc) • 1.67 MB
JavaScript
(function(e,t){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),l=(e,t)=>{let n={};for(var i in e)r(n,i,{get:e[i],enumerable:!0});return t||r(n,Symbol.toStringTag,{value:`Module`}),n},u=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=a(t),l=0,u=c.length,d;l<u;l++)d=c[l],!s.call(e,d)&&d!==n&&r(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(o=i(t,d))||o.enumerable});return e},d=(e,t,i)=>(i=e==null?{}:n(o(e)),u(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e));if(t=d(t,1),globalThis.OffscreenCanvas===void 0){class e{constructor(){return f(this)}save(){}restore(){}measureText(e){return{width:e.length}}}class t{constructor(e,t){return f(this)}getContext(t){return t===`2d`?new e:null}}function f(e){return new Proxy(e,{get:function(e,t,n){if(Reflect.has(e,t))return Reflect.get(e,t,n);throw Error(`OffscreenCanvas mock: "${String(t)}" is not implemented.\nAdd it to MockOffscreenCanvas or MockOffscreenCanvasRenderingContext2D if needed.`)}})}globalThis.OffscreenCanvas=t}if(globalThis.DOMParser===void 0&&(globalThis.DOMParser=class{parseFromString(){return{querySelector(){return null},querySelectorAll(){return[]},body:{}}}}),globalThis.document===void 0){let e=function(){};globalThis.document={implementation:{createDocument(){return{}}},addEventListener:e,removeEventListener:e,querySelectorAll(){return[]},querySelector(){return null},createElement(){return{setAttribute(){},getBoundingClientRect(){return{width:0,height:0}}}},createTextNode(){return{}},cookie:``,head:{querySelectorAll(){return[]}},body:{classList:{add:e,remove:e,contains:e},contains(){return!1},appendChild(){},removeChild(){}}}}let p=/Mac/i,m=!1;function h(){let e=document.createElement(`div`);e.setAttribute(`style`,`width:10px;height:1px;zoom:2;position:absolute;z-index:-10000`),document.body.appendChild(e),m=e.getBoundingClientRect().width!==20,document.body.removeChild(e)}(0,t.whenReady)(h);let g=[`Shift`,`Control`,`Alt`,`Meta`];function _(e,t){return e?!!t.target&&e.contains(t.target):!1}function v(e=1){let t=document.querySelector(`.o-grid-overlay`),n=t&&ee(t,e);if(!n)throw Error(`Can't find spreadsheet position`);return n}function ee(e,t){let n=e.closest(`.o-zoomable`),r,i=1;n?(r=n,i=m?t:1):r=e;let a=r.getBoundingClientRect();return{x:a.x*i,y:a.y*i,width:a.width*i,height:a.height*i}}function y(e){return e?b(e):{x:0,y:0,width:0,height:0}}function b(e){let t=e.getBoundingClientRect();return{x:t.x,y:t.y,width:t.width,height:t.height}}function*te(e){if(yield e,e.hasChildNodes())for(let t of e.childNodes)yield*te(t)}function ne(){return Array.from(document.querySelectorAll(`.o-spreadsheet .o-menu`))}function re(e){let{startElement:t,endElement:n,startSelectionOffset:r,endSelectionOffset:i}=ie(e);return{start:ae(e,t,r),end:ae(e,n,i)}}function ie(e){let t=document.getSelection();return{startElement:t.anchorNode||e,startSelectionOffset:t.anchorOffset,endElement:t.focusNode||e,endSelectionOffset:t.focusOffset}}function ae(e,t,n){let r=0,i=te(e),a=i.next(),o=!0;for(;!a.done&&a.value!==t;)a.value.hasChildNodes()||a.value.textContent&&(r+=a.value.textContent.length),(a.value.nodeName===`P`||a.value.nodeName===`DIV`&&a.value!==e)&&(o?o=!1:r++),a=i.next();if(a.value!==t)return 0;if(!a.value.hasChildNodes())r+=n;else{let e=[...a.value.childNodes].slice(0,n);r+=e.reduce((t,n,r)=>{if(n.textContent!==null){let i=n.textContent.length;return n.nodeName===`P`&&r!==e.length-1&&i++,t+i}else return t},0)}return t.nodeName===`P`&&!o&&t.textContent===``&&r++,r}let oe=/^[a-zA-Z]$/;function se(e,t=`key`){let n=``;g.includes(e.key)||(le(e)&&(n+=`Ctrl+`),e.altKey&&(n+=`Alt+`),e.shiftKey&&(n+=`Shift+`));let r=t===`key`?e.key:e.code;return n+=oe.test(r)?r.toUpperCase():r,n}function ce(){return!!p.test(navigator.userAgent)}function le(e){return ce()||me()?e.metaKey:e.ctrlKey}function ue(e){return e.button===1||le(e)&&e.button===0}function de(e,t){let n=document.createElement(`a`);n.href=e,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n)}function fe(){return navigator.maxTouchPoints||1}function pe(){return/Android/i.test(navigator.userAgent)}function me(){return/(iPad|iPhone|iPod)/i.test(navigator.userAgent)||navigator.platform===`MacIntel`&&fe()>1}function he(){return/(webOS|BlackBerry|Windows Phone)/i.test(navigator.userAgent)}function ge(){return pe()||me()||he()}function _e(e){return e.map(xe).sort((e,t)=>e.sequence-t.sequence)}function ve(e){return e&&ce()?e.replace(`Ctrl`,`⌘`).replace(`Alt`,`⌃`):e}function ye(e){return e&&ce()&&e.match(/\+?Alt\+?/)?``:e}let be=1;function xe(e){let t=e.name,n=e.children,r=e.description,i=ye(e.shortcut),a=e.icon,o=e.secondaryIcon,s=e.id||be++,c=e.isEnabled?e.isEnabled:()=>!0;return{id:s.toString(),name:typeof t==`function`?t:()=>t,isVisible:e.isVisible?e.isVisible:()=>!0,isEnabled:c,isActive:e.isActive,execute:e.execute?(t,n)=>{if(c(t))return e.execute(t,n)}:void 0,children:n?e=>n.map(t=>typeof t==`function`?t(e):t).flat().map(xe).sort((e,t)=>e.sequence-t.sequence):()=>[],isReadonlyAllowed:e.isReadonlyAllowed||!1,isEnabledOnLockedSheet:e.isEnabledOnLockedSheet||!1,separator:e.separator||!1,icon:typeof a==`function`?a:()=>a||``,iconColor:e.iconColor,secondaryIcon:typeof o==`function`?o:()=>o||``,description:typeof r==`function`?r:()=>r||``,shortcut:i||``,textColor:e.textColor,sequence:e.sequence||0,onStartHover:e.onStartHover,onStopHover:e.onStopHover}}function Se(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r];i.isVisible(e)&&(!Ce(i)||we(e,i))&&n.push(i),i.separator&&r!==t.length-1&&n[n.length-1]!==`separator`&&n.push(`separator`)}return n[n.length-1]===`separator`&&n.pop(),n.length===1&&n[0]===`separator`?[]:n}function Ce(e){return!e.execute}function we(e,t){return t.children(e).some(t=>t.isVisible(e))}function Te(e,t){let n=t.children?.(e);return n.length?n.some(t=>Te(e,t)):t.isEnabled(e)?e.model.getters.isReadonly()?t.isReadonlyAllowed:!0:!1}let Ee=.5,De=`#017E84`,Oe=`#3266ca`,ke=11982760,Ae=De,je=`#188038`,Me=`light-dark(#9B359B, #B972A6)`,Ne=`#00000000`,Pe=`#111827`,Fe=`#ced4da`,Ie=`#D8DADD`,Le=`#374151`,Re=De,ze={minColor:`#FFF5EB`,midColor:`#FD8D3C`,maxColor:`#7F2704`},Be=`#F28C28`,Ve=`#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`.split(`.`),He=[50,75,100,125,150,200],Ue={align:`default`,verticalAlign:`bottom`,wrapping:`overflow`,bold:!1,italic:!1,strikethrough:!1,underline:!1,fontSize:10,fillColor:``,textColor:``,rotation:0,hideGridLines:!1},We=.001;({...Ue});let Ge=Ue.verticalAlign,Ke=Ue.wrapping,qe=Ue.fontSize,Je=`'Roboto', arial, 'Liberation Sans'`,Ye={style:`thin`,color:`#000000`},Xe=`START_REVISION`,Ze=`difference`,Qe=`#43C5B1`,$e=`#EA6175`,et=.4,tt=[`'`,`*`,`?`,`/`,`\\`,`[`,`]`],nt=/'|\*|\?|\/|\\|\[|\]/,rt=0;function it(){return rt}function at(e){rt=e}let ot=[6,7,8,9,10,11,12,14,18,24,36],st={hasFilters:!1,totalRow:!1,firstColumn:!0,lastColumn:!1,numberOfHeaders:1,bandedRows:!0,bandedColumns:!1,styleId:`TableStyleMedium5`,automaticAutofill:!1},ct=`PivotTableStyleMedium12`,lt={symbol:`$`,position:`before`,decimalPlaces:2,code:``,name:`Dollar`},ut={fontSize:16,color:Le},dt=`light-dark(#000000, #ffffff)`,ft=`#3da4ab`,pt={OPERATOR:ft,NUMBER:`#02c39a`,STRING:`#00a82d`,FUNCTION:dt,DEBUGGER:ft,LEFT_PAREN:dt,RIGHT_PAREN:dt,ARG_SEPARATOR:dt,ORPHAN_RIGHT_PAREN:`#ff0000`},mt=[`thin`,`medium`,`thick`,`dashed`,`dotted`];function ht(e){return Array.isArray(e)&&Array.isArray(e[0])}let gt=[`all`,`hv`,`h`,`v`,`external`,`left`,`top`,`right`,`bottom`,`clear`],_t=function(e){return e.UP=`up`,e.DOWN=`down`,e.LEFT=`left`,e.RIGHT=`right`,e}({}),vt=[`inactive`,`cellFocus`,`contentFocus`],yt=new RegExp(nt,`g`);function bt(e){return`clone`in e&&e.clone instanceof Function}function xt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function x(e){switch(typeof e){case`object`:{if(e===null)return e;if(bt(e))return e.clone();if(!(St(e)||e instanceof Array))throw Error(`Unsupported type: only objects and arrays are supported`);let t=Array.isArray(e)?Array(e.length):{};if(Array.isArray(e))for(let n=0,r=e.length;n<r;n++)n in e&&(t[n]=x(e[n]));else for(let n in e)t[n]=x(e[n]);return t}case`number`:case`string`:case`boolean`:case`function`:case`undefined`:return e;default:throw Error(`Unsupported type: ${typeof e}`)}}function St(e){return typeof e==`object`&&!!e&&(e?.constructor===Object||e?.constructor===void 0)}function Ct(e){return wt(e,`'`)}function wt(e,t=`"`){return e.startsWith(t)&&(e=e.slice(1)),e.endsWith(t)&&(e=e.slice(0,-1)),e}function Tt(e){return e.match(/\w/g)?.length!==e.length&&(e=`'${e}'`),e}function Et(e,t=` `){return e.replace(yt,t)}function S(e,t,n){return e<t?t:e>n?n:e}function C(e,t,n=1){if(t<=e&&n>0)return[];if(n===0)throw Error(`range() step must not be zero`);let r=Math.ceil(Math.abs((t-e)/n)),i=Array(r);for(let t=0;t<r;t++)i[t]=e+t*n;return i}function Dt(e){return e.reduce((e,t,n,r)=>(Math.abs(t-r[n-1])===1?e[e.length-1].push(t):e.push([t]),e),[])}function*Ot(e,t){t.next();for(let n of e){let e=t.next();yield{...n,next:e.done?void 0:e.value}}}function kt(e){let t=e.toUpperCase();return t===`TRUE`||t===`FALSE`}let At=/^\[(.+)\]\((.+)\)$/,jt=/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$/;function Mt(e){return At.test(e)}function Nt(e){return jt.test(e)}function Pt(e,t){return`[${e}](${t})`}function Ft(e){let t=e.match(At)||[],n=t[1],r=t[2];if(!n||!r)throw Error(`Could not parse markdown link ${e}.`);return{label:n,url:r}}let It=`o-spreadsheet://`;function Lt(e){return e.startsWith(It)}function Rt(e){return`${It}${e}`}function zt(e){if(e.startsWith(It))return e.slice(16);throw Error(`${e} is not a valid sheet link`)}function w(e){return e!==void 0}function Bt(e){return e===void 0?!0:Object.values(e).every(e=>typeof e==`object`?Bt(e):e===void 0)}function Vt(e,t,n){let r,i=!1,a=function(){let a=this,o=Array.from(arguments);if(!i&&n)return i=!0,e.apply(a,o);function s(){r=void 0,i=!1,e.apply(a,o)}clearTimeout(r),r=setTimeout(s,t)};return a.isDebouncePending=()=>r!==void 0,a.stopDebounce=()=>{clearTimeout(r)},a}function Ht(e){let t=!1;return async(...n)=>{t||(t=!0,await Promise.resolve(),t=!1,e(...n))}}function Ut(e,t){let n=0;return function(...r){let i=Date.now();if(i-n>=t)return n=i,e(...r)}}function Wt(e){let t=``;for(let n=0,r=e.length;n<r;n++)t+=e[n];return t}function Gt(e){let t=!1,n,r=()=>(t||=(n=e instanceof Function?e():e,!0),n);return r.map=e=>Gt(()=>e(r())),r}function Kt(e,t){let n=e.slice(t).find(e=>e);return n||=e.slice(0,t).reverse().find(e=>e),n||``}function qt(e,t){return e===`after`?t+1:t}function T(...e){if(e.length<=1)return!0;for(let t=1;t<e.length;t++)if(!Jt(e[0],e[t]))return!1;return!0}function Jt(e,t){if(e===t)return!0;if(e&&!t||t&&!e||typeof e!=typeof t||typeof e!=`object`)return!1;for(let n in t)if(!(n in e)&&t[n]!==void 0)return!1;for(let n in e){if(typeof e[n]!=typeof t[n])return!1;if(typeof e[n]==`object`){if(!Jt(e[n],t[n]))return!1}else if(e[n]!==t[n])return!1}return!0}function Yt(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!T(e[n],t[n]))return!1;return!0}function Xt(e,t){if(e.length<t.length)return!1;let n=new Set(e);return t.every(e=>n.has(e))}function Zt(e){if(!e)return e;let t={...e};return Object.keys(t).forEach(e=>!t[e]&&delete t[e]),t}let Qt=[` `,`\f`,`\v`,`\xA0`,` `,` `,` `,`\u2028`,`\u2029`,` `,` `,` `,``],$t=new RegExp(Qt.join(`|`),`g`),en=/(\r\n|\r)/g,tn=Qt.concat([` `]);function nn(e){return e?e.replace(en,`
`):``}function rn(e){let 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}function an(e){let t=new Map,n=e.name?e.name+` (memoized)`:`memoized`;return{[n](...n){return t.has(n[0])||t.set(n[0],e(...n)),t.get(n[0])}}[n]}function on(e,t){let n=new Set(t),r=[];for(let t=0;t<e.length;t++)n.has(t)||r.push(e[t]);return r}function sn(e,t,n){return e.slice(0,n).concat(t).concat(e.slice(n))}function cn(e,t,n){let r=[...e];return r[n]=t,r}function ln(e){return e.split(`
`).map(e=>e.replace(/\s+/g,` `).trim()).join(`
`)}function un(e,t,n){return t>n?un(e,n,t):e>=t&&e<=n}function dn(e,t){let n=xt(e),r=t.matchCase?``:`i`;return t.exactMatch&&(n=`^${n}$`),RegExp(n,r)}function fn(e){let t=e.length;if(t<1e5)return Math.max(...e);let n=-1/0;for(;t--;)n=e[t]>n?e[t]:n;return n}function pn(e){let t=e.length;if(t<1e5)return Math.min(...e);let n=1/0;for(;t--;)n=e[t]<n?e[t]:n;return n}var mn=class{text;currentIndex=0;current;constructor(e){this.text=e,this.current=e[0]}shift(){let e=this.current,t=this.text[++this.currentIndex];return this.current=t,e}advanceBy(e){this.currentIndex+=e,this.current=this.text[this.currentIndex]}isOver(){return this.currentIndex>=this.text.length}remaining(){return this.text.substring(this.currentIndex)}currentStartsWith(e){if(this.current!==e[0])return!1;for(let t=1;t<e.length;t++)if(this.text[this.currentIndex+t]!==e[t])return!1;return!0}};function hn(e,t=e=>e){let n=new Set;return e.filter(e=>{let r=t(e);return n.has(r)?!1:(n.add(r),!0)})}function gn(e){let t={};for(let n in e)for(let r in e[n])t[r]||(t[r]={}),t[r][n]=e[n][r];return t}function _n(e,t,n={}){let r=n.compute??((e,t)=>`${e} (${t})`),i=n.computeFirstOne??!1,a=n.start??1,o=i?r(e,a):e;for(;t.includes(o);)o=r(e,a++);return o}function vn(e){return e.startsWith(`=`)||e.startsWith(`+`)}function yn(e){return{bold:e.bold,italic:e.italic,fontSize:e.fontSize,textColor:e.color,align:e.align}}function bn(e,t){return e.isFormula&&e.compiledFormula.usesSymbol(t)}function xn(e,t,n){let{sheetId:r,col:i,row:a}=t;if(!vn(n))return;let o=e.evaluateFormula(r,n,{sheetId:r,col:i,row:a});if(!ht(o))return;let s=e.getNumberRows(r),c=e.getNumberCols(r);return{missingRows:a+o[0].length-s,missingCols:i+o.length-c}}function Sn(e){let t={};return{state:t,get:n=>(n in t||(t[n]=x(e)),t[n]),set:(e,n)=>{t[e]=n}}}function Cn(e){if(e<0)throw Error(`number must be positive. Got ${e}`);return e<26?String.fromCharCode(65+e):Cn(Math.floor(e/26)-1)+Cn(e%26)}function wn(e){let t=0,n=e.length;for(let r=0;r<n;r++){let n=Tn(e[r]);t=t*26+n}return t-1}function Tn(e){let t=e.charCodeAt(0);return t>=65&&t<=90?t-64:t-96}function En(e){return e>=`A`&&e<=`Z`||e>=`a`&&e<=`z`}function Dn(e){return e>=`0`&&e<=`9`}let On=wn(`ZZZ`);function kn(e){for(;e.current===` `;)e.advanceBy(1)}function An(e){if(e.current===`$`&&e.advanceBy(1),!e.current||!En(e.current))return-1;let t=0;for(;e.current&&En(e.current);)t=t*26+Tn(e.shift());return t}function jn(e){if(e.current===`$`&&e.advanceBy(1),!e.current||!Dn(e.current))return-1;let t=0;for(;e.current&&Dn(e.current);)t=t*10+Number(e.shift());return t}function Mn(e){let t=new mn(e);kn(t);let n=An(t);if(n===-1||!t.current)throw Error(`Invalid cell description: ${e}`);let r=jn(t);kn(t);let i=n-1,a=r-1;if(!t.isOver()||i>On||a>9999998)throw Error(`Invalid cell description: ${e}`);return{col:i,row:a}}function E(e,t,n={colFixed:!1,rowFixed:!1}){return(n.colFixed?`$`:``)+Cn(e)+(n.rowFixed?`$`:``)+String(t+1)}function D(e,t=[]){if(e.length<=1&&t.length===0)return e;let n=[0],r=new Map([[0,[]]]);return Nn(n,r,e,!1),Nn(n,r,t,!0),Rn(n,r)}function Nn(e,t,n,r=!1){for(let i of n){let n=i.left,a=i.right===void 0?void 0:i.right+1,o=Fn(e,t,n,!0,0),s=Fn(e,t,a,!1,o);for(let n=o;n<=s;n++)In(t.get(e[n]),i,r);Ln(e,t,o,s)}}function Pn(e,t,n){let r=n.left,i=n.right,a=zn(e,r,0),o=i===void 0?e.length-1:zn(e,i,a),s=n.top,c=n.bottom===void 0?void 0:n.bottom+1;for(let n=a;n<=o;n++){let r=t.get(e[n]),i=zn(r,s,0);if(i===-1||i%2!=0)return!1;let a=c===void 0?r.length:Bn(r,c,0);if(i+1!==a)return!1}return!0}function Fn(e,t,n,r,i){if(n===void 0)return e.length-1;let a=zn(e,n,i);return n===e[a]?r?a:a-1:(e.splice(a+1,0,n),t.set(n,[...t.get(e[a])]),r?a+1:a)}function In(e,t,n=!1){let r=t.top,i=t.bottom===void 0?void 0:t.bottom+1,a=[],o=zn(e,r,0,!1);if((o%2!=0&&!n||o%2==0&&n)&&a.push(r),i===void 0){e.splice(o+1),e.push(...a);return}let s=Bn(e,i,0,!1);(s%2==0&&!n||s%2!=0&&n)&&a.push(i);let c=s-o-1,l=a.length,u=o+1;u===e.length-1&&c===1&&l===1?e[u]=a[0]??a[1]:e.splice(u,c,...a)}function Ln(e,t,n,r){let i=n-1==-1?0:n-1,a=r===e.length-1?r:r+1;for(let n=a;n>i;n--)Yt(t.get(e[n]),t.get(e[n-1]))&&(t.delete(e[n]),e.splice(n,1))}function Rn(e,t){let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=t.get(a);if(!o||o.length===0){n.push(...r),r=[];continue}let s=e[i+1];s!==void 0&&s--;let c=[];for(let e=0;e<o.length;e+=2){let t=o[e],n=o[e+1];n!==void 0&&n--;let i={top:t,left:a,bottom:n,right:s};(n===void 0&&t!==0||s===void 0&&a!==0)&&(i.hasHeader=!0);let l=!1;for(let e=r.length-1;e>=0;e--){let t=r[e];if(t.top===i.top&&t.bottom===i.bottom){t.right=i.right,r.splice(e,1),c.push(t),l=!0;break}}l||c.push(i)}n.push(...r),r=c}return n.push(...r),n}function zn(e,t,n=0,r=!0){let i=e.length-1,a=-1;for(;n<=i;){let o=n+(i-n>>1);if(e[o]===t&&r)return o;e[o]<t?(a=o,n=o+1):i=o-1}return a}function Bn(e,t,n=0,r=!0){let i=e.length-1,a=e.length;for(;n<=i;){let o=n+(i-n>>1);if(e[o]===t&&r)return o;e[o]>t?(a=o,i=o-1):n=o+1}return a}function Vn(e){let t=new mn(e);kn(t);let n=e.indexOf(`!`);n!==-1&&t.advanceBy(n+1);let r=An(t),i=jn(t),a,o,s,c,l=!1,u=!1,d=!1;if(i===-1?(s=c=r-1,a=o=0,l=!0):r===-1?(a=o=i-1,s=c=0,u=!0):(s=c=r-1,a=o=i-1,d=!0),kn(t),t.current===`:`){t.advanceBy(1),kn(t);let e=An(t),n=jn(t);n===-1?(c=e-1,l=!0):e===-1?(o=n-1,u=!0):(c=e-1,o=n-1,a=l?o:a,s=u?c:s,d=!0)}let f={top:a,left:s,bottom:l?void 0:o,right:u?void 0:c};return d&&=u||l,d&&(f.hasHeader=d),f}function Hn(e){let t=fr(Vn(e)),n=t.bottom,r=t.right;if(n!==void 0&&n>9999998||r!==void 0&&r>On)throw Error(`Range string out of bounds: ${e}`);if(n===void 0&&r===void 0)throw Error(`Wrong zone xc. The zone cannot be at the same time a full column and a full row`);return t}function Un(e){let t=Hn(e);if(t.bottom===void 0||t.right===void 0)throw Error(`This does not support unbounded ranges`);return t}function Wn(e){return Kn(Hn(e))}function Gn(e){try{return Wn(e)}catch{return!1}}function Kn(e){let{bottom:t,top:n,left:r,right:i}=e;return t!==void 0&&isNaN(t)||isNaN(n)||isNaN(r)||i!==void 0&&isNaN(i)?!1:qn(e)&&e.top>=0&&e.left>=0}function qn(e){return(e.bottom===void 0||e.bottom>=e.top&&e.bottom>=0)&&(e.right===void 0||e.right>=e.left&&e.right>=0)}function Jn(e){let{top:t,bottom:n,left:r,right:i}=e,a=`hasHeader`in e?e.hasHeader:!1,o=t===n&&r===i;if(n===void 0&&i!==void 0)return t===0&&!a?`${Cn(r)}:${Cn(i)}`:`${E(r,t)}:${Cn(i)}`;if(i===void 0&&n!==void 0)return r===0&&!a?`${t+1}:${n+1}`:`${E(r,t)}:${n+1}`;if(n!==void 0&&i!==void 0)return o?E(r,t):`${E(r,t)}:${E(i,n)}`;throw Error(`Bad zone format`)}function Yn(e,t,n,r,i){let a=t===`left`?`columns`:`rows`,o=r===`before`?n-1:n,s=e[t===`left`?`right`:`bottom`];return e[t]<=o&&s&&s>o?pr(e,a,`RESIZE`,i):o<e[t]?pr(e,a,`MOVE`,i):{...e}}function Xn(e,t,n,r,i){let a=t===`left`?`columns`:`rows`,o=r===`before`?n-1:n,s=t===`left`?`right`:`bottom`;return e[t]<=o&&e[s]>o?pr(e,a,`RESIZE`,i):o<e[t]?pr(e,a,`MOVE`,i):{...e}}function Zn(e,t,n){let r=t===`left`?`right`:`bottom`,i=e[t],a=e[r];for(let o of n.sort((e,t)=>t-e))e[t]>o&&(i--,a--),e[t]<o&&e[r]>=o&&a--;return{...e,[t]:i,[r]:a}}function Qn(e,t,n){let r=t===`left`?`right`:`bottom`,i=e[t],a=e[r],o=e[r];for(let r of n.sort((e,t)=>t-e))e[t]>r&&(i--,a!==void 0&&a--),o!==void 0&&a!==void 0&&e[t]<=r&&o>=r&&a--;if(!(a!==void 0&&i>a))return{...e,[t]:i,[r]:a}}function $n(...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 er(...e){return{top:Math.min(...e.map(e=>e.top)),left:Math.min(...e.map(e=>e.left)),bottom:e.some(e=>e.bottom===void 0)?void 0:Math.max(...e.map(e=>e.bottom)),right:e.some(e=>e.right===void 0)?void 0:Math.max(...e.map(e=>e.right))}}function tr(e,t){if(rr(e,t))return{top:Math.max(e.top,t.top),left:Math.max(e.left,t.left),bottom:Math.min(e.bottom??9999998,t.bottom),right:Math.min(e.right??On,t.right)}}function nr(e,t){return e.left===t.left&&e.right===t.right&&e.top===t.top&&e.bottom===t.bottom}function rr(e,t){return!(e.bottom===void 0||e.bottom<t.top||t.bottom<e.top||e.right===void 0||e.right<t.left||t.right<e.left)}function ir(e){for(let t=0;t<e.length-1;t++)for(let n=t+1;n<e.length;n++)if(rr(e[t],e[n]))return!0;return!1}function ar(e,t,n){let{left:r,right:i,top:a,bottom:o}=n;return e>=r&&e<=i&&t>=a&&t<=o}function or(e,t){return e.left>=t.left&&e.right<=t.right&&e.top>=t.top&&e.bottom<=t.bottom}function sr(e){return{numberOfRows:e.bottom-e.top+1,numberOfCols:e.right-e.left+1}}function cr(e){let{numberOfCols:t,numberOfRows:n}=sr(e);return t===1||n===1}function lr(e){let{top:t,left:n,bottom:r,right:i}=e;if(br(e)===1)return[];let a={top:t+1,bottom:r,left:n,right:n};if(i===n)return[a];let o={top:t,bottom:r,left:n+1,right:i};return t===r?[o]:[a,o]}function ur(e){let t=[],{left:n,right:r,top:i,bottom:a}=fr(e);for(let e of C(n,r+1))for(let n of C(i,a+1))t.push({col:e,row:n});return t}function dr(e,t){let n=[],{left:r,right:i,top:a,bottom:o}=fr(t);for(let t of C(r,i+1))for(let r of C(a,o+1))n.push({sheetId:e,col:t,row:r});return n}function fr(e){return e.right!==void 0&&e.left>e.right&&(e={...e,left:e.right,right:e.left}),e.bottom!==void 0&&e.top>e.bottom&&(e={...e,top:e.bottom,bottom:e.top}),e}function pr(e,t,n,r){let i=t===`both`?r[0]:t===`columns`?r:0,a=t===`both`?r[1]:t===`rows`?r:0,o=`hasHeader`in e?e.hasHeader:!1,s;s=yr(e)&&!o?t!==`rows`:vr(e)&&!o?t!==`columns`:!0;let c={...e};return s&&n===`MOVE`&&(c.left+=i,c.top+=a),c.right!==void 0&&(c.right+=i),c.bottom!==void 0&&(c.bottom+=a),c}function mr(e){return e.reverse().filter((e,t,n)=>t===n.findIndex(t=>t.top===e.top&&t.bottom===e.bottom&&t.left===e.left&&t.right===e.right)).reverse()}function hr(e){return e.reduce((e,t)=>{let n=e.length;for(let r=0;r<n;r++)if(rr(e[r],t))return e[r]=$n(e[r],t),e;return e[n]=t,e},[])}function gr(e,t){let n,r,{left:i,right:a,top:o,bottom:s}=e,{left:c,right:l,top:u,bottom:d}=t;return n=c===i?l===a?c:l:c,r=u===o?d===s?u:d:u,{col:n,row:r}}function O(e){return{left:e.col,right:e.col,top:e.row,bottom:e.row}}function _r(e){return{...e,right:e.left,bottom:e.top}}function vr(e){return e.right===void 0}function yr(e){return e.bottom===void 0}function br(e){return(e.bottom-e.top+1)*(e.right-e.left+1)}function xr(e,t,n){return e.left<t&&t<=e.right||e.top<n&&n<=e.bottom}function Sr(e,t,n){return e.some(e=>xr(e,t,n))}function Cr(e,t){let{left:n,top:r,bottom:i,right:a}=e;if(a!==void 0&&i!==void 0)return e;if(i===void 0&&a!==void 0)return{right:a,top:r,left:n,bottom:t.numberOfRows-1};if(a===void 0&&i!==void 0)return{bottom:i,left:n,top:r,right:t.numberOfCols-1};throw Error(`Bad zone format`)}function wr(e){return e.length<2?!0:D(e).length===1}function Tr(e){let t=new Set;for(let n of D(e))for(let e of C(n.left,n.right+1))t.add(e);return t}function Er(e){let t=new Map;for(let n of e)for(let e=n.left;e<=n.right;e++){let r=t.get(e);r?(r.top=Math.min(r.top,n.top),r.bottom=Math.max(r.bottom,n.bottom)):t.set(e,{left:e,right:e,top:n.top,bottom:n.bottom})}return Array.from(t.values())}function Dr(e){let t=new Set;for(let n of D(e))for(let e of C(n.top,n.bottom+1))t.add(e);return t}function Or(e,t){return e.right+1===t.left||e.left===t.right+1?e.top<=t.bottom&&e.top>=t.top||t.top<=e.bottom&&t.top>=e.top:e.bottom+1===t.top||e.top===t.bottom+1?e.left<=t.right&&e.left>=t.left||t.left<=e.right&&t.left>=e.left:!1}function kr(e){let t=[...e],n=!0;for(;n;){n=!1;for(let e=0;e<t.length;e++){let r=t[e],i=t.findIndex((t,n)=>e!==n&&(Or(t,r)||rr(t,r)));if(i!==-1){t[e]=$n(t[i],r),t.splice(i,1),n=!0;break}}}return t}function Ar(e,t){let n=[];return e.bottom<t.bottom&&n.push({...t,top:e.bottom+1}),e.right<t.right&&n.push({...t,left:e.right+1,top:e.top,bottom:e.bottom}),e.left>t.left&&n.push({...t,right:e.left-1,top:e.top,bottom:e.bottom}),e.top>t.top&&n.push({...t,bottom:e.top-1}),n}function jr(e,t){return t.type===`REMOVE_COLUMNS_ROWS`?Qn(e,t.dimension===`COL`?`left`:`top`,t.elements):t.type===`ADD_COLUMNS_ROWS`?Yn(e,t.dimension===`COL`?`left`:`top`,t.base,t.position,t.quantity):e}function Mr(e,t){let n=t.type===`DELETE_SHEET`&&t.sheetId;if(`sheetId`in t&&e._sheetId!==t.sheetId)return e;{let r=jr(e._zone,t);if(r&&n!==e._sheetId)return{...e,_zone:r}}}function Nr(e){class t{constructor(t){throw Error(`This is a abstract store for ${e}, it cannot be instantiated.
Did you forget to inject your store instance?
const stores = useStoreProvider();
stores.inject(MyMetaStore, storeInstance);
`)}}return t}var Pr=class{get;disposeCallbacks=[];constructor(e){this.get=e}onDispose(e){this.disposeCallbacks.push(e)}dispose(){this.disposeCallbacks.forEach(e=>e())}};let Fr=Nr(`Model`),Ir={Background:0,Highlights:1,Clipboard:2,Chart:4,Autofill:5,Selection:6,Headers:100},Lr=an(()=>Object.keys(Ir).sort((e,t)=>Ir[e]-Ir[t]));function Rr(e,t){if(Ir[e])throw Error(`Layer ${e} already exists`);Ir[e]=t}var zr=class{layers;mutators=[`register`,`unRegister`,`draw`,`startAnimation`,`stopAnimation`];renderers={};model;context=void 0;animationFrameId=null;registeredAnimations=new Set;constructor(e,t=Lr()){this.layers=t,this.model=e(Fr)}register(e){if(e.renderingLayers.length)for(let t of e.renderingLayers)this.renderers[t]||(this.renderers[t]=[]),this.renderers[t].push(e)}unRegister(e){for(let t of Object.keys(this.renderers))this.renderers[t]=this.renderers[t].filter(t=>t!==e)}drawLayer(e,t,n){let r=this.renderers[t];if(r)for(let i of r)e.ctx.save(),i.drawLayer(e,t,n),e.ctx.restore();return`noStateChange`}draw(e,t){if(e||=this.context,!e)throw Error(`Rendering context is not defined`);this.context=e;for(let n of this.layers)this.model.drawLayer(e,n),this.drawLayer(e,n,t);return`noStateChange`}startAnimation(e){if(this.registeredAnimations.add(e),!this.animationFrameId){let e=t=>{this.animationFrameId=requestAnimationFrame(e),this.draw(void 0,t)};this.animationFrameId=requestAnimationFrame(e)}return`noStateChange`}stopAnimation(e){return this.registeredAnimations.delete(e),this.registeredAnimations.size===0&&this.animationFrameId!==null&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null),`noStateChange`}dispose(){this.animationFrameId&&=(cancelAnimationFrame(this.animationFrameId),null)}},Br=class extends Pr{model=this.get(Fr);getters=this.model.getters;renderer=this.get(zr);constructor(e){super(e),this.model.on(`command-dispatched`,this,this.handle),this.model.on(`command-finalized`,this,this.finalize),this.renderer.register(this),this.onDispose(()=>{this.model.off(`command-dispatched`,this),this.model.off(`command-finalized`,this),this.renderer.unRegister(this)})}get renderingLayers(){return[]}handle(e){}finalize(){}drawLayer(e,t,n){}};let Vr={id:`void-composer`,get editionMode(){return`inactive`},startEdition:()=>{throw Error(`No composer is registered`)},stopEdition:()=>{throw Error(`No composer is registered`)},setCurrentContent:()=>{throw Error(`No composer is registered`)}};var Hr=class extends Br{mutators=[`focusComposer`,`focusActiveComposer`];activeComposer=Vr;_focusMode=`inactive`;get focusMode(){return this.activeComposer.editionMode===`inactive`?`inactive`:this._focusMode}focusComposer(e,t){if(this.activeComposer=e,this.getters.isReadonly())return`noStateChange`;this._focusMode=t.focusMode||`contentFocus`,this._focusMode!==`inactive`&&this.setComposerContent(t)}focusActiveComposer(e){if(this.getters.isReadonly())return`noStateChange`;if(!this.activeComposer)throw Error(`No composer is registered`);this._focusMode=e.focusMode||`contentFocus`,this._focusMode!==`inactive`&&this.setComposerContent(e)}setComposerContent({content:e,selection:t}){this.activeComposer.editionMode===`inactive`?this.activeComposer.startEdition(e,t):e&&this.activeComposer.setCurrentContent(e,t)}},k=class{content={};add(e,t){if(e in this.content)throw Error(`${e} is already present in this registry!`);return this.replace(e,t)}replace(e,t){return this.content[e]=t,this}get(e){let t=this.content[e];if(!t&&!(e in this.content))throw 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]}};let Ur=new k;function Wr(){return globalThis.Chart?!!globalThis.Chart.registry.plugins.get(`chartShowValuesPlugin`):!0}function Gr(){if(!(!globalThis.Chart||Wr()))for(let e of Ur.getAll())e.register(globalThis.Chart)}function Kr(){if(globalThis.Chart)for(let e of Ur.getAll())e.unregister(globalThis.Chart)}let{__ODOO_COMPATIBILITY_LAYER_ADDED__:qr,blockDom:Jr,config:Yr,onMounted:Xr,onPatched:Zr,onWillUnmount:Qr,App:$r,Component:ei,EnvPlugin:ti,useChildEnv:ni,useChildSubEnv:ri,useComponent:ii,useEnv:ai,useExternalListener:oi,useLayoutEffect:si,useSubEnv:ci,Plugin:li,plugin:ui,props:di,providePlugins:fi,useScope:pi,xml:mi}=t,hi=qr===!0;var gi=class extends ei{static template=``;env;constructor(e){super(e),this.env=Bi(),this.__owl__=e}setup(){}render(e=!1){this.__owl__.render(e===!0)}};function _i(){return pi().component}function vi(e,t,n,r){let i=pi(),a=n.bind(i.component);Xr(()=>e.addEventListener(t,a,r)),Qr(()=>e.removeEventListener(t,a,r))}function yi(e){let t=pi(),n=t.renderFn;t.renderFn=()=>(e.call(t.component),n())}function bi(e,t=()=>[NaN]){let n,r;Xr(()=>{r=t(),n=e(...r)}),yi(()=>{try{t()}catch{}}),Zr(()=>{let i=t();i.some((e,t)=>e!==r[t])&&(r=i,n&&n(),n=e(...r))}),Qr(()=>n&&n())}var xi=class extends li{static id=`__ENV__`;env=Yr(`env`)??{}};function Si(){return pi().component.env}function Ci(e){return fi([xi],{env:e}),e}function wi(e){let t=Bi(),n=Object.create(t);return Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)),Ci(n)}function Ti(e){let t=pi().component;t.env=wi(e)}function Ei(e){wi(e)}function Di(){return ui(xi).env}var Oi=class extends Jr.text(``).constructor{constructor(e,t){super(``),this.content=t,this.selector=e,this.target=null}mount(e,t){super.mount(e,t),this.target=document.querySelector(this.selector),this.target?this.content.mount(this.target,null):this.content.mount(e,t)}beforeRemove(){this.content.beforeRemove()}remove(){this.content&&=(super.remove(),this.content.remove(),null)}patch(e){super.patch(e),this.content?this.content.patch(e.content,!0):(this.content=e.content,this.content.mount(this.target,null))}},ki=class extends ei{static template=mi`<t t-call-slot="default"/>`;constructor(e){super(e),this.props=di(),this.__owl__=e}setup(){let e=this.__owl__,t=e.renderFn;e.renderFn=(...n)=>new Oi(e.props.selector,t(...n)),Xr(()=>{let t=e.bdom;if(!t.target){let n=document.querySelector(e.props.selector);if(n)t.content.moveBeforeDOMNode(n.firstChild,n);else throw Error(`invalid portal target`)}}),Qr(()=>{e.bdom.remove()})}};let Ai=0,ji={ref:(e,t)=>{let n=`"`+t.replaceAll(/\{\{(.+?)\}\}/g,`" + $1 + "`)+`"`;e.setAttribute(`t-ref`,`__globals__.createRefSignal(this, ${n}, ${++Ai})`)},model:(e,t,n)=>{let r=`t-model`;for(let e of n)r+=`.${e}`;let i=`() => ${t}`,a=`(nv) => {${t} = nv;}`;e.setAttribute(r,`__globals__.createModelSignal(${i}, ${a})`)},portal:(e,t)=>{if(e.nodeName.toLowerCase()!==`t`)throw Error(`t-custom-portal should be on a 't' element`);e.setAttribute(`t-component`,`__globals__.Portal`),e.setAttribute(`selector`,t)}},Mi={createRefSignal:(e,t,n)=>{let r=e.__owl__;r.__refs__||={},r.__refs__[t]||(r.__refs__[t]={lastSetId:null,values:{}});let i=r.__refs__[t];return{set(e){e&&(i.lastSetId=n),i.values[n]=e}}},createModelSignal:(e,t)=>Object.assign(e,{set:t}),Portal:ki};var Ni=class extends $r{constructor(e){super({...e,customDirectives:{...ji,...e?.customDirectives},globalValues:{...Mi,...e?.globalValues},config:e.config?Object.assign(Object.create(e.config),{env:e.env}):{env:e.env}}),this.pluginManager.startPlugins([xi]),this.env=e.env??{}}createRoot(e,t={}){return t.env&&(e={[e.name]:class extends e{constructor(e){Ci(t.env),super(e)}}}[e.name]),super.createRoot(e,t)}};let A=hi?ei:gi,Pi=hi?ii:_i,Fi=hi?oi:vi,Ii=hi?si:bi,Li=hi?ti:xi,Ri=hi?ai:Si,zi=hi?ci:Ti,Bi=hi?ni:Di,Vi=hi?ri:Ei,Hi=hi?$r:Ni;var Ui=class{subscriptions={};on(e,t,n){if(!n)throw Error(`Missing callback`);this.subscriptions[e]||(this.subscriptions[e]=[]),this.subscriptions[e].push({owner:t,callback:n})}trigger(e,t){let n=this.subscriptions[e]||[];for(let e=0,r=n.length;e<r;e++){let r=n[e];r.callback.call(r.owner,t)}}off(e,t){let n=this.subscriptions[e];n&&(this.subscriptions[e]=n.filter(e=>e.owner!==t))}clear(){this.subscriptions={}}},Wi=class extends Ui{dependencies=new Map;factory=new Gi(this.get.bind(this));inject(e,t){if(this.dependencies.has(e)&&this.dependencies.get(e)!==t)throw Error(`Store ${e.name} already has an instance`);this.dependencies.set(e,t)}get(e){return this.dependencies.has(e)||this.dependencies.set(e,this.instantiate(e)),this.dependencies.get(e)}instantiate(e,...t){return this.factory.build(e,...t)}resetStores(){this.dependencies.clear()}dispose(){for(let e of this.dependencies.values())`dispose`in e&&typeof e.dispose==`function`&&e.dispose()}},Gi=class{get;pendingBuilds=new Set;constructor(e){this.get=e}build(e,...t){if(this.pendingBuilds.has(e))throw Error(`Circular dependency detected: ${[...this.pendingBuilds,e].map(e=>e.name).join(` -> `)}`);this.pendingBuilds.add(e);let n=new e(this.get,...t);return this.pendingBuilds.delete(e),n}};function Ki(){let e=Ri();if(e.__spreadsheet_stores__ instanceof Wi)return e.__spreadsheet_stores__;let n=new Wi;return zi({__spreadsheet_stores__:n,getStore:e=>Yi(n.get(e),()=>n.trigger(`store-updated`))}),(0,t.onWillUnmount)(()=>n.dispose()),n}function j(e){let t=Xi(Ri());return Ji(t,t.get(e))}function qi(e,...n){let r=Xi(Ri()),i=r.instantiate(e,...n);return(0,t.onWillUnmount)(()=>i.dispose()),Ji(r,i)}function Ji(e,n){let r=Pi();return Yi(n,()=>{(0,t.status)(r)===`mounted`&&e.trigger(`store-updated`)})}function Yi(e,t){return new Proxy(e,{get(n,r,i){let a=n,o=Reflect.get(n,r,a);return e.mutators?.includes(r)?new Proxy(o,{apply(e,n,r){Reflect.apply(e,a,r)!==`noStateChange`&&t()}}):o}})}function Xi(e){let t=e.__spreadsheet_stores__;if(!(t instanceof Wi))throw Error(`No store provider found. Did you forget to call useStoreProvider()?`);return t}function Zi(){return t.types.number()}function Qi(){return t.types.string()}function M(){return t.types.object()}function $i(){return t.types.array()}function ea(){return t.types.record()}function ta(){return t.types.instanceOf(Set)}function na(){return t.types.object({x:t.types.number(),y:t.types.number(),width:t.types.number(),height:t.types.number()})}function ra(){return t.types.customValidator(Qi(),e=>gt.includes(e))}function ia(){return t.types.customValidator(Qi(),e=>mt.includes(e))}function aa(){return t.types.object({x:t.types.number(),y:t.types.number()})}function oa(){return t.types.object({width:t.types.number(),height:t.types.number()})}function sa(){return t.types.customValidator(Qi(),e=>[`asc`,`desc`].includes(e))}function ca(){return t.types.customValidator(Zi(),e=>[-1,0,1].includes(e))}function la(){return t.types.customValidator(Qi(),e=>vt.includes(e))}function ua(){return t.types.customValidator(Qi(),e=>[`COL`,`ROW`].includes(e))}function da(){return t.types.customValidator(Qi(),e=>[`ROW`,`COL`,`CELL`,`FILTER`,`GROUP_HEADERS`,`UNGROUP_HEADERS`].includes(e))}function fa(){return t.types.object()}function pa(){return t.types.function()}let N={...t.types,function:pa,ArrayOf:$i,RecordOf:ea,SetOf:ta,GenericCriterionType:Qi,UID:Qi,CriterionFilter:M,CSSProperties:M,ResizeDirection:ca,FigureUI:M,Token:M,CellPosition:M,AutoCompleteProviderDefinition:M,AutoCompleteProposal:M,FunctionDescription:M,Rect:na,Pixel:Zi,HeaderIndex:Zi,BorderPosition:ra,BorderStyle:ia,Color:Qi,ActionSpec:M,DOMCoordinates:aa,DOMDimension:oa,ComposerFocusType:la,SortDirection:sa,Store:fa,Position:M,PivotCoreDefinition:M,PivotField:M,PivotDimension:M,PivotMeasure:M,PivotCoreMeasure:M,PivotCustomGroupedField:M,PivotRuntimeDefinition:M,PivotFilter:M,DataFilterValue:M,SpreadsheetPivotCoreDefinition:M,ComposerSelection:M,Action:M,MenuItemOrSeparator:M,Model:M,DispatchResult:M,Zone:M,Range:M,HeaderGroup:M,GridClickModifiers:M,ZoomedMouseEvent:M,ConditionalFormat:M,ColorScaleThreshold:M,Table:M,CoreTable:M,TableConfig:M,TableStyle:M,TitleDesign:M,ChartDefinition:M,ChartDefinitionWithDataSource:M,ChartWithAxisDefinition:M,ChartStyle:M,ChartColorScale:M,ChartRangeDataSource:M,DataSetStyle:M,GeoChartDefinition:M,FunnelChartDefinition:M,TreeMapChartDefinition:M,TreeMapCategoryColorOptions:M,TreeMapColorScaleOptions:M,NamedRange:M,DataValidationRule:M,InformationNotification:M,NotificationStoreMethods:M,SidePanelContent:M,SidePanelComponentProps:M,DataValidationCriterionType:Qi,Dimension:ua,ContextMenuType:da};var ma=class extends Br{mutators=[`disableAnimationForChart`,`enableAnimationForChart`];animationPlayed={};disableAnimationForChart(e,t){return this.animationPlayed[e]=t,`noStateChange`}enableAnimationForChart(e){return this.animationPlayed[e]=void 0,`noStateChange`}};let ha={id:`background`,beforeDraw(e,t,n){let{ctx:r}=e;r.save(),r.globalCompositeOperation=`destination-over`,r.fillStyle=n.color||`#FFFFFF`,r.fillRect(0,0,e.width,e.height),r.restore()}};function ga(){if(!globalThis.Chart)throw Error(`Chart.js library is not loaded`);return class extends globalThis.Chart.BarController{static id=`calendar`;static defaults={...globalThis.Chart?.BarController.defaults,dataElementType:`bar`,animations:{numbers:{type:`number`,properties:[]}}};updateElements(e,t,n,r){super.updateElements(e,t,n,r);let i=this.chart.config.options?.plugins?.background?.color;for(let a=t;a<t+n;a++)r===`reset`&&this.updateElement(e[a],a,{options:{backgroundColor:i}},r)}}}var _a=class e{jsDate;constructor(e,t,n,r=0,i=0,a=0){this.jsDate=new Date(Date.UTC(e,t,n,r,i,a,0))}static fromTimestamp(t){let n=new Date(t);return new e(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate(),n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds())}static now(){let t=new Date;return new e(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.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()}getQuarter(){return Math.floor(this.getMonth()/3)+1}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()}getIsoWeek(){let e=new Date(this.jsDate.getTime()),t=e.getUTCDay()||7;e.setUTCDate(e.getUTCDate()+4-t);let n=new Date(Date.UTC(e.getUTCFullYear(),0,1));return Math.ceil(((e.getTime()-n.getTime())/864e5+1)/7)}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)}};let va=new _a(1899,11,30),ya=1440*60*1e3,ba=2e3,xa=_a.now().getFullYear(),Sa=_a.now().getMonth(),Ca=_a.fromTimestamp(0).getTime()-va.getTime(),wa=/^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/,Ta=/^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/,Ea=tn.join(``),Da=RegExp(`\/|-|${tn.join(`|`)}`),Oa=RegExp(`^(\\d{1,4})[\/${Ea}\-](\\d{1,4})([\/${Ea}\-](\\d{1,4}))?$`),ka=/((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;function Aa(e,t){switch(typeof e){case`number`:return e;case`string`:return ja(e,t)?Na(e,t)?.value:!e||isNaN(Number(e))?void 0:Number(e);default:return}}function ja(e,t){return Na(e,t)!==null}let Ma=new Map;function Na(e,t){return Ma.has(t)||Ma.set(t,new Map),Ma.get(t).has(e)||Ma.get(t).set(e,Pa(e,t)),Ma.get(t).get(e)}function Pa(e,t){e=e.trim();let n=null,r=e.match(ka);if(r){if(n=Ha(r[0]),n===null)return null;e=e.replace(r[0],``).trim()}let i=null,a=Fa(e,t);if(a){let t=a.dateString.match(Da)[0];if(i=La(a,t),i===null)return null;e=e.replace(a.dateString,``).trim()}return e!==``||!(i||n)?null:i&&i.jsDate&&n&&n.jsDate?{value:i.value+n.value,format:i.format+` `+(n.format===`hhhh:mm:ss`?`hh:mm:ss`:n.format),jsDate:new _a(i.jsDate.getFullYear()+n.jsDate.getFullYear()-1899,i.jsDate.getMonth()+n.jsDate.getMonth()-11,i.jsDate.getDate()+n.jsDate.getDate()-30,i.jsDate.getHours()+n.jsDate.getHours(),i.jsDate.getMinutes()+n.jsDate.getMinutes(),i.jsDate.getSeconds()+n.jsDate.getSeconds())}:i||n}function Fa(e,t){let n=e.match(Oa);if(!n)return null;let[,r,i,,a]=n;if(r.length>2&&a&&a.length>2)return null;if(r.length>2)return{year:r,month:i,day:a,dateString:e,type:`ymd`};let o=Ia(t);return a?a.length>2?o===`mdy`?{month:r,day:i,year:a,dateString:e,type:`mdy`}:{day:r,month:i,year:a,dateString:e,type:`dmy`}:o===`mdy`?{month:r,day:i,year:a,dateString:e,type:`mdy`}:o===`ymd`?{year:r,month:i,day:a,dateString:e,type:`ymd`}:o===`dmy`?{day:r,month:i,year:a,dateString:e,type:`dmy`}:null:i.length>2?{month:r,year:i,day:void 0,dateString:e,type:o}:o===`dmy`?{day:r,month:i,year:a,dateString:e,type:`dmy`}:{month:r,day:i,year:a,dateString:e,type:`mdy`}}function Ia(e){switch(e.dateFormat[0]){case`d`:return`dmy`;case`m`:return`mdy`;case`y`:return`ymd`}throw Error(`Invalid date format in locale`)}function La(e,t){let{year:n,month:r,day:i}=e,a=Ba(r),o=Va(i),s=za(n);if(s===null||a===null||o===null)return null;let c=r?.length===2&&a+1<10||i?.length===2&&o<10,l=n?.length!==2,u=new _a(s,a,o);if(u.getMonth()!==a||u.getDate()!==o)return null;let d=u.getTime()-va.getTime(),f=Ra(e,t,c,l);return{value:Math.round(d/ya),format:f,jsDate:u}}function Ra(e,t,n,r){let i=e.year?r?`yyyy`:`yy`:void 0,a=e.month?n?`mm`:`m`:void 0,o=e.day?n?`dd`:`d`:void 0;switch(e.type){case`mdy`:return[a,o,i].filter(w).join(t);case`ymd`:return[i,a,o].filter(w).join(t);case`dmy`:return[o,a,i].filter(w).join(t)}}function za(e){if(!e)return xa;let t=Number(e);switch(e.length){case 1:return ba+t;case 2:return ba+(ba+t>xa+10?-100:0)+t;case 3:case 4:return t}return null}function Ba(e){if(!e)return Sa;let t=Number(e);return t>=1&&t<=12?t-1:null}function Va(e){if(!e)return 1;let t=Number(e);return t>=0&&t<=31?t:null}function Ha(e){if(e=e.trim(),ka.test(e)){let t=/AM/i.test(e),n=/PM/i.test(e),r=(t||n?e.substring(0,e.length-2).trim():e).split(/:/),i=r.length>=2,a=r.length===3,o=Number(r[0]),s=i?Number(r[1]):0,c=a?Number(r[2]):0,l=a?`hh:mm:ss`:`hh:mm`;if(t||n)l+=` a`;else if(!i)return null;o>=12&&t?o-=12:o<12&&n&&(o+=12),s+=Math.floor(c/60),c%=60,o+=Math.floor(s/60),s%=60,o>=24&&(l=`hhhh:mm:ss`);let u=new _a(1899,11,30,o,s,c);return{value:o/24+s/1440+c/86400,format:l,jsDate:u}}return null}function Ua(e){let t=Math.trunc(e),n=_a.fromTimestamp(t*ya-Ca),r=e-t;r=r<0?1+r:r;let i=Math.round(r*24),a=Math.round((r-i/24)*24*60),o=Math.round((r-i/24-a/24/60)*24*60*60);return n.setHours(i),n.setMinutes(a),n.setSeconds(o),n}function Wa(e){return Math.round(Ga(e))}function Ga(e){return(e.getTime()-va.getTime())/ya}function Ka(e){return new _a(e.getFullYear(),e.getMonth()+1,0).getDate()}function qa(e){return Ka(e)===e.getDate()}function Ja(e,t,n){let r=e.getFullYear(),i=e.getMonth(),a=e.getDate(),o=new _a(r,i+t,1);return n&&a===Ka(e)||a>Ka(o)?o.setDate(Ka(o)):o.setDate(a),o}function Ya(e){let t=Math.trunc(e);return t%4==0&&t%100!=0||t%400==0}function Xa(e,t,n){if(e===t)return 0;if(e>t){let n=t;t=e,e=n}let r=Ua(e),i=Ua(t),a=r.getDate(),o=i.getDate(),s=r.getMonth(),c=i.getMonth(),l=r.getFullYear(),u=i.getFullYear(),d=0,f=0;switch(n){case 0:a===31&&(a=30),a===30&&o===31&&(o=30),s===1&&a===(Ya(l)?29:28)&&(a=30,c===1&&o===(Ya(u)?29:28)&&(o=30)),d=l+(s*30+a)/360,f=u+(c*30+o)/360;break;case 1:let n=365,r=l===u,i=l+1===u;if(!r&&!i||!r&&s<c||!r&&s===c&&a<o){let e=0,t=0;for(let n=l;n<=u;n++)e++,t+=Ya(n)?366:365;n=t/e}else r?Ya(l)&&(n=366):(Ya(l)&&s<2&&(n=366),Ya(u)&&(c>1||c===1&&o===29)&&(n=366));d=e/n,f=t/n;break;case 2:d=e/360,f=t/360;break;case 3:d=e/365,f=t/365;break;case 4:a===31&&(a=30),o===31&&(o=30),d=l+(s*30+a)/360,f=u+(c*30+o)/360;break}return f-d}function Za(e,t){let n=(t.getFullYear()-e.getFullYear())*12+t.getMonth()-e.getMonth();return e.getDate()>t.getDate()?n-1:n}function Qa(e,t){let n=e.getTime(),r=t.getTime();return Math.floor((r-n)/ya)}function $a(e,t){let n=t.getFullYear()-e.getFullYear(),r=e.getMonth(),i=t.getMonth(),a=e.getDate(),o=t.getDate();return i>r||i===r&&o>=a?n:n-1}function eo(e,t){return Xa(e,t,1)<1}function to(e,t){return Math.trunc(e)===Math.trunc(t)}function no(e,t,n){return t>n?no(e,n,t):(e=Math.trunc(e),t=Math.trunc(t),n=Math.trunc(n),e>=t&&e<=n)}function ro(e,t){return Math.trunc(e)<Math.trunc(t)}function io(e,t){return Math.trunc(e)<=Math.trunc(t)}function ao(e,t){return Math.trunc(e)>Math.trunc(t)}function oo(e,t){return Math.trunc(e)>=Math.trunc(t)}let so=an(function(e){return e=xt(e),RegExp(`(?:^-?\\d+(?:${e}?\\d*(?:(E|e)(\\+|-)?\\d+)?)?|^-?${e}\\d+)(?!\\w|!)`)}),co=an(function(e){let t=xt(e.decimalSeparator),n=`(?:\\d+(?:${xt(e.thousandsSeparator||``)}\\d{3,})*(?:${t}\\d*)?)`,r=`(?:${t}\\d+)`,i=`(?:\\s*`+n+`|`+r+`)(?:(e|E)(?:\\+|-)?(?:[0-9]|[0-9][0-9]|[12][0-9]{2}|30[0-7]))?(?:\\s*%)?`,a=`^(?:(?:`+[`(?:\\s*-)?(?:\\s*[\\$€])?`+i,`(?:\\s*-)?`+i+`(?:\\s*[\\$€])?`,`(?:\\s*[\\$€])?(?:\\s*-)?`+i].join(`)|(?:`)+`))$`;return new RegExp(a,`i`)});function lo(e,t){return e?co(t).test(e.trim()):!1}let uo=an(function(e){return RegExp(`[\$€${xt(e.thousandsSeparator||``)}]`,`g`)});function fo(e,t){e=e.replace(uo(t),``),t.decimalSeparator!==`.`&&(e=e.replace(t.decimalSeparator,`.`));let n=Number(e);return isNaN(n)&&e.includes(`%`)&&(n=Number(e.split(`%`)[0]),!isNaN(n))?n/100:n}function po(e,t,n){let r=[...e].sort((e,t)=>e-t),i=(r.length+(n?-1:1))*t;if(n||i--,Number.isInteger(i))return r[i];let a=Math.ceil(i),o=Math.floor(i);return r[a]*(i-o)+r[o]*(a-i)}let mo=e=>e,ho=()=>!1,go=mo,_o=ho;function vo(e,...t){if(t.length===1&&typeof t[0]==`object`&&!(t[0]instanceof String)){let n=t[0];e=e.replace(/\%\(([^\)]+)\)s/g,(e,t)=>n[t])}else t.length>0&&(e=e.replace(/\%s/g,()=>t.shift()));return e}function yo(e,t=()=>!0){go=e,_o=t}function bo(){go===mo&&_o===ho&&(_o=()=>!0)}let P=function(e,...t){return _o()?vo(go(e),...t):new xo(e,t)};var xo=class extends String{values;constructor(e,t){super(e),this.values=t}valueOf(){let e=super.valueOf();return _o()?vo(go(e),...this.values):vo(e,...this.values)}toString(){return this.valueOf()}};let F={NotAvailable:`#N/A`,InvalidReference:`#REF`,BadExpression:`#BAD_EXPR`,CircularDependency:`#CYCLE`,UnknownFunction:`#NAME?`,DivisionByZero:`#DIV/0!`,InvalidNumber:`#NUM!`,SpilledBlocked:`#SPILL!`,GenericError:`#ERROR`,NullError:`#NULL!`},So=new Set(Object.values(F));var I=class{message;value;constructor(e=P(`Error`),t=F.GenericError){this.message=e,this.value=t,this.message=e.toString()}},Co=class extends I{constructor(e=P(`Invalid expression`)){super(e,F.BadExpression)}},wo=class extends I{constructor(e=P(`Circular reference`)){super(e,F.CircularDependency)}},To=class extends I{constructor(e=P(`Invalid reference`)){super(e,F.InvalidReference)}},Eo=class extends I{constructor(e=P(`Data not available`)){super(e,F.NotAvailable)}},Do=class extends I{constructor(e=P(`Unknown function`)){super(e,F.UnknownFunction)}},Oo=class extends I{errorOriginPosition;constructor(e=P(`Spill range is not empty`),t){super(e,F.SpilledBlocked),this.errorOriginPosition=t}},ko=class extends I{constructor(e=P(`Division by zero`)){super(e,F.DivisionByZero)}},Ao=class extends I{constructor(e=P(`Number too large`)){super(e,F.InvalidNumber)}};let jo=[`number`,`string`,`boolean`,`undefined`];function Mo(e){if(e!==void 0)return ht(e)?e[0][0]?.format:e.format}function No(e){return typeof e==`string`&&So.has(e)}function Po(e){return{value:F.NotAvailable,message:P(`Did not find value '%s' in [[FUNCTION_NAME]] evaluation.`,R(e))}}let Fo=e=>P(`The function [[FUNCTION_NAME]] expects a number value, but '%s' is a string, and cannot be coerced to a number.`,e),Io=P(`The function [[FUNCTION_NAME]] expects a reference to a cell or range.`),Lo=(e,t,n)=>P(`The function [[FUNCTION_NAME]] expects a number value between %s and %s inclusive, but receives %s.`,e.toString(),t.toString(),n.toString()),Ro=(e,t)=>P(`The function [[FUNCTION_NAME]] has an argument with value '%s'. It should be one of: %s.`,t,e.map(e=>`'${e}'`).join(`, `));function L(e,t){let n=Jo(e);switch(typeof n){case`number`:return n;case`boolean`:return+!!n;case`string`:if(lo(n,t)||n===``)return fo(n,t);let e=Na(n,t);if(e)return e.value;throw new I(Fo(n));default:return 0}}function zo(e,t){try{return L(e,t)}catch{return}}function Bo(e,t){return B(e).map(e=>e.map(e=>{if(typeof e.value!=`number`){let n=``;throw typeof e==`object`?n=P(`Function [[FUNCTION_NAME]] expects number values for %s, but got an empty value.`,t):typeof e==`string`?n=P(`Function [[FUNCTION_NAME]] expects number values for %s, but got a string.`,t):typeof e==`boolean`&&(n=P(`Function [[FUNCTION_NAME]] expects number values for %s, but got a boolean.`,t)),new I(n)}return e.value}))}function Vo(e,t){let n=Jo(e);if(n===``)throw new I(Fo(n));return L(n,t)}function Ho(e,t){return Math.trunc(L(e,t))}function Uo(e,t){return Math.trunc(Vo(e,t))}function R(e){let t=Jo(e);switch(typeof t){case`string`:return t;case`number`:return t.toString();case`boolean`:return t?`TRUE`:`FALSE`;default:return``}}let Wo=an(function(e){return e.toLowerCase().normalize(`NFD`).replace(/[\u0300-\u036f]/g,``)}),Go=e=>P(`The function [[FUNCTION_NAME]] expects a boolean value, but '%s' is a text, and cannot be coerced to a boolean.`,e);funct