UNPKG

@odoo/o-spreadsheet

Version:
1 lines 1.45 MB
!function(e,t){"use strict";function o(e){return e.map(i).sort(((e,t)=>e.sequence-t.sequence))}let s=1;function i(e){const t=e.name,o=e.children,n=e.description,r=e.icon,a=e.secondaryIcon,l=e.id||s++,c=e.isEnabled?e.isEnabled:()=>!0;return{id:l.toString(),name:"function"==typeof t?t:()=>t,isVisible:e.isVisible?e.isVisible:()=>!0,isEnabled:c,isActive:e.isActive,execute:e.execute?(t,o)=>{if(c(t))return e.execute(t,o)}:void 0,children:o?e=>o.map((t=>"function"==typeof t?t(e):t)).flat().map(i):()=>[],isReadonlyAllowed:e.isReadonlyAllowed||!1,separator:e.separator||!1,icon:"function"==typeof r?r:()=>r||"",iconColor:e.iconColor,secondaryIcon:"function"==typeof a?a:()=>a||"",description:"function"==typeof n?n:()=>n||"",textColor:e.textColor,sequence:e.sequence||0,onStartHover:e.onStartHover,onStopHover:e.onStopHover}}class n{content={};add(e,t){if(e in this.content)throw new Error(`${e} is already present in this registry!`);return this.replace(e,t)}replace(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]}}const r=.5,a="#017E84",l="#f5f5f5",c="#F8F9FA",h="#E8EAED",d="#595959",u="#666666",g="#c9ccd2",p="#3266ca",m="#FFFFFF",f="#CACACA",v=11982760,b=a,S="#188038",C="#E0E2E4",y="#4A4F59",w="#999",I="#E2E3E3",x="#BCBCBC",E="#9B359B",R="#00000000",T="#4EA7F2",A="#EA6175",D="#AAAAAA",_="#111827",O="#D8DADD",F="#E7E9ED",P="#F9FAFB",M="#374151",N=M+"C2",k="#111827",V="#714B67",L=F,H=O,U="#111827",B="#e6f2f3",z="#111827",$=a,G="#D44C591A",W="#C34A41",q="#98DBE2",Z="#E6F2F3",j=20,Y=10,X=15,K=16,J=12,Q="#F28C28",ee=["#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"],te=26,oe=48,se=96,ie=23,ne=15,re=4,ae=3,le=re,ce=21,he=2*ie,de={align:"left",verticalAlign:"bottom",wrapping:"overflow",bold:!1,italic:!1,strikethrough:!1,underline:!1,fontSize:10,fillColor:"",textColor:""},ue=de.verticalAlign,ge=de.wrapping,pe="400",me=de.fontSize,fe="'Roboto', arial",ve="thin",be="#000000",Se="START_REVISION",Ce=1,ye=20,we="??",Ie="difference",xe="#43C5B1",Ee="#EA6175",Re=.4,Te=3,Ae=2,De=["'","*","?","/","\\","[","]"],_e=/'|\*|\?|\/|\\|\[|\]/,Oe="|";var Fe;!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.IconPicker=25]="IconPicker",e[e.TopBarComposer=30]="TopBarComposer",e[e.Popover=35]="Popover",e[e.FigureAnchor=1e3]="FigureAnchor",e[e.FigureSnapLine=1001]="FigureSnapLine",e[e.FigureTooltip=1002]="FigureTooltip"}(Fe||(Fe={}));let Pe=0;function Me(){return Pe}const Ne="\n",ke=[6,7,8,9,10,11,12,14,18,24,36],Ve={hasFilters:!1,totalRow:!1,firstColumn:!0,lastColumn:!1,numberOfHeaders:1,bandedRows:!0,bandedColumns:!1,styleId:"TableStyleMedium5",automaticAutofill:!1},Le={symbol:"$",position:"before",decimalPlaces:2,code:"",name:"Dollar"},He=new RegExp(_e,"g");function Ue(e){return'"'===e[0]&&(e=e.slice(1)),'"'===e[e.length-1]&&"\\"!==e[e.length-2]?e.slice(0,e.length-1):e}function Be(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ze(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");const t=Array.isArray(e)?new Array(e.length):{};if(Array.isArray(e))for(let o=0,s=e.length;o<s;o++)o in e&&(t[o]=ze(e[o]));else for(const o in e)t[o]=ze(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 $e(e){return Ge(e,"'")}function Ge(e,t='"'){return e.startsWith(t)&&(e=e.slice(1)),e.endsWith(t)&&(e=e.slice(0,-1)),e}function We(e){return e.match(/\w/g)?.length!==e.length&&(e=`'${e}'`),e}function qe(e,t=" "){return e.replace(He,t)}function Ze(e,t,o){return e<t?t:e>o?o:e}function je(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)),i=Array(s);for(let t=0;t<s;t++)i[t]=e+t*o;return i}function Ye(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*Xe(e,t){t.next();for(const o of e){const e=t.next();yield{...o,next:e.done?void 0:e.value}}}function Ke(e){const t=e.toUpperCase();return"TRUE"===t||"FALSE"===t}const Je=/^\[(.+)\]\((.+)\)$/,Qe=/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$/;function et(e){return Je.test(e)}function tt(e){return Qe.test(e)}function ot(e,t){return`[${e}](${t})`}function st(e){const t=e.match(Je)||[],o=t[1],s=t[2];if(!o||!s)throw new Error(`Could not parse markdown link ${e}.`);return{label:o,url:s}}const it="o-spreadsheet://";function nt(e){return e.startsWith(it)}function rt(e){return`${it}${e}`}function at(e){if(e.startsWith(it))return e.slice(it.length);throw new Error(`${e} is not a valid sheet link`)}function lt(e){return void 0!==e}function ct(e){return void 0===e||Object.values(e).every((e=>"object"==typeof e?ct(e):!e))}function ht(e,t,o){let s;const i=function(){const i=this,n=Array.from(arguments);const r=o&&!s;clearTimeout(s),s=setTimeout((function(){s=void 0,o||e.apply(i,n)}),t),r&&e.apply(i,n)};return i.isDebouncePending=()=>void 0!==s,i.stopDebounce=()=>{clearTimeout(s)},i}function dt(e){let t="";for(let o=0,s=e.length;o<s;o++)t+=e[o];return t}function ut(e){let t,o=!1;const s=()=>(o||(t=e instanceof Function?e():e,o=!0),t);return s.map=e=>ut((()=>e(s()))),s}function gt(e,t){let o=e.slice(t).find((e=>e));return o||(o=e.slice(0,t).reverse().find((e=>e))),o||""}function pt(e,t){return"after"===e?t+1:t}function mt(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(!mt(e[o],t[o]))return!1}else if(e[o]!==t[o])return!1}return!0}function ft(e,t){if(e.length!==t.length)return!1;for(let o=0;o<e.length;o++)if(!mt(e[o],t[o]))return!1;return!0}function vt(e,t){if(e.length<t.length)return!1;const o=new Set(e);return t.every((e=>o.has(e)))}function bt(e){if(!e)return e;const t={...e};return Object.keys(t).forEach((e=>!t[e]&&delete t[e])),t}const St=["\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))],Ct=new RegExp(St.join("|"),"g"),yt=/(\r\n|\r)/g,wt=St.concat([" "]);function It(e){return e?e.replace(yt,Ne):""}function xt(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}function Et(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 Rt(e,t){return e.filter(((e,o)=>!t.includes(o)))}function Tt(e,t,o){const s=[...e];return s.splice(o,0,...t),s}function At(e,t,o){const s=[...e];return s[o]=t,s}function Dt(e){return e.split("\n").map((e=>e.replace(/\s+/g," ").trim())).join("\n")}function _t(e,t,o){return t>o?_t(e,o,t):e>=t&&e<=o}function Ot(e,t){let o=Be(e);const s=t.matchCase?"":"i";return t.exactMatch&&(o=`^${o}$`),RegExp(o,s)}function Ft(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 Pt(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}class Mt{text;currentIndex=0;current;constructor(e){this.text=e,this.current=e[0]}shift(){const 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 Nt(e,t=(e=>e)){const o=new Set;return e.filter((e=>{const s=t(e);return!o.has(s)&&(o.add(s),!0)}))}function kt(e){const t={};for(const o in e)for(const s in e[o])t[s]||(t[s]={}),t[s][o]=e[o][s];return t}function Vt(e,t,o={}){const s=o.compute??((e,t)=>`${e} (${t})`),i=o.computeFirstOne??!1;let n=o.start??1,r=i?s(e,n):e;for(;t.includes(r);)r=s(e,n++);return r}function Lt(e){return e.startsWith("=")||e.startsWith("+")}const Ht=/rgba?\(|\s+|\)/gi,Ut=/^#([A-F\d]{2}){3,4}$/,Bt=["#eb6d00","#0074d9","#ad8e00","#169ed4","#b10dc9","#00a82d","#00a3a3","#f012be","#3d9970","#111111","#62A300","#ff4136","#949494","#85144b","#001f3f"];function zt(e,t=1){const o=1!==t?Math.round(255*t).toString(16).padStart(2,"0"):"";return Gt(e.toString(16).padStart(6,"0"))+o}function $t(e){return"number"==typeof e?e:Number.parseInt(Gt(e).slice(1,7),16)}function Gt(e){let t=e;if(e.startsWith("rgb")?t=function(e){const t=e.replace(Ht,"").split(",");let o=255;if(3!==t.length&&4!==t.length)throw new Error("invalid color");if(4===t.length){const e=parseFloat(t.pop()||"1");if(isNaN(e))throw new Error("invalid alpha value");o=Math.round(255*e)}const s=t.map((e=>parseInt(e,10)));255!==o&&s.push(o);return"#"+dt(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}`),!Ut.test(t))throw new Error(`invalid color input: ${e}`);return t}function Wt(e){try{return Gt(e),!0}catch(e){return!1}}const qt=e=>e>=0&&e<=255;function Zt(e,t,o,s=1){if(!qt(e)||!qt(t)||!qt(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 jt(e){let{r:t,g:o,b:s}=Xt(e);t/=255,o/=255,s/=255;const i=e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4;return.2126*i(t)+.7152*i(o)+.0722*i(s)}function Yt(e){let t=e.r.toString(16),o=e.g.toString(16),s=e.b.toString(16),i=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===i.length&&(i="0"+i),"ff"===i&&(i=""),("#"+t+o+s+i).toUpperCase()}function Xt(e){let t,o,s,i;if(7===(e=Gt(e)).length)t=parseInt(e[1]+e[2],16),o=parseInt(e[3]+e[4],16),s=parseInt(e[5]+e[6],16),i=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),i=parseInt(e[7]+e[8],16)}return i=+(i/255).toFixed(3),{a:i,r:t,g:o,b:s}}function Kt(e){(e={...e}).s/=100,e.l/=100;const 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;let i=0,n=0,r=0;return 0<=e.h&&e.h<60?(i=t,n=o,r=0):60<=e.h&&e.h<120?(i=o,n=t,r=0):120<=e.h&&e.h<180?(i=0,n=t,r=o):180<=e.h&&e.h<240?(i=0,n=o,r=t):240<=e.h&&e.h<300?(i=o,n=0,r=t):300<=e.h&&e.h<360&&(i=t,n=0,r=o),i=Math.round(255*(i+s)),n=Math.round(255*(n+s)),r=Math.round(255*(r+s)),{a:e.a,r:i,g:n,b:r}}function Jt(e){const t=e.r/255,o=e.g/255,s=e.b/255,i=Math.min(t,o,s),n=Math.max(t,o,s),r=n-i;let a=0,l=0,c=0;return a=0===r?0:n===t?(o-s)/r%6:n===o?(s-t)/r+2:(t-o)/r+4,a=Math.round(60*a),a<0&&(a+=360),c=(n+i)/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 Qt(e){return Yt(Kt(e))}function eo(e){return Jt(Xt(e))}function to(e){return Xt("number"==typeof e?zt(e):e)}function oo(e,t){return 1===t?Gt(e).slice(0,7):Yt({...Xt(e),a:t})}function so(e,t){const o=eo(e);return 1===t?"#fff":(o.l=t*(100-o.l)+o.l,Qt(o))}function io(e,t){const o=eo(e);return 1===t?"#000":(o.s=Math.min(100,t*o.s+o.s),o.l=o.l-t*o.l,Qt(o))}function no(e){return jt(e)<.6?so(e,.9):io(e,.75)}const ro=["#4EA7F2","#EA6175","#43C5B1","#F4A261","#8481DD","#FFD86D"],ao=["#4EA7F2","#3188E6","#43C5B1","#00A78D","#EA6175","#CE4257","#F4A261","#F48935","#8481DD","#5752D1","#FFD86D","#FFBC2C"],lo=["#4EA7F2","#3188E6","#056BD9","#A76DBC","#7F4295","#6D2387","#EA6175","#CE4257","#982738","#43C5B1","#00A78D","#0E8270","#F4A261","#F48935","#BE5D10","#8481DD","#5752D1","#3A3580","#A4A8B6","#7E8290","#545B70","#FFD86D","#FFBC2C","#C08A16"],co=["#4EA7F2","#3188E6","#056BD9","#155193","#A76DBC","#7F4295","#6D2387","#4F1565","#EA6175","#CE4257","#982738","#791B29","#43C5B1","#00A78D","#0E8270","#105F53","#F4A261","#F48935","#BE5D10","#7D380D","#8481DD","#5752D1","#3A3580","#26235F","#A4A8B6","#7E8290","#545B70","#3F4250","#FFD86D","#FFBC2C","#C08A16","#936A12"],ho=["#4EA7F2","#43C5B1","#EA6175","#F4A261","#8481DD","#FFD86D","#3188E6","#00A78D","#CE4257","#F48935","#5752D1","#FFBC2C"],uo=["#4EA7F2","#A76DBC","#EA6175","#43C5B1","#F4A261","#8481DD","#A4A8B6","#FFD86D","#3188E6","#7F4295","#CE4257","#00A78D","#F48935","#5752D1","#7E8290","#FFBC2C","#056BD9","#6D2387","#982738","#0E8270","#BE5D10","#3A3580","#545B70","#C08A16"],go=["#4EA7F2","#A76DBC","#EA6175","#43C5B1","#F4A261","#8481DD","#A4A8B6","#FFD86D","#3188E6","#7F4295","#CE4257","#00A78D","#F48935","#5752D1","#7E8290","#FFBC2C","#056BD9","#6D2387","#982738","#0E8270","#BE5D10","#3A3580","#545B70","#C08A16","#155193","#4F1565","#791B29","#105F53","#7D380D","#26235F","#3F4250","#936A12"];function po(e,t){return t[e%t.length]}function mo(e){return e<=6?ro:e<=12?ao:e<=24?lo:co}class fo{preferredColors;currentColorIndex=0;palette;constructor(e,t=[]){this.preferredColors=t,this.palette=mo(e).filter((e=>!t.includes(e)))}next(){return this.preferredColors?.[this.currentColorIndex]?this.preferredColors[this.currentColorIndex++]:po(this.currentColorIndex++,this.palette)}}class vo extends fo{constructor(e,t=[]){var o;super(e,t),this.palette=(o=e,o<=6?ro:o<=12?ho:o<=24?uo:go).filter((e=>!t.includes(e)))}}class bo{availableColors;colors={};constructor(e=12){this.availableColors=new vo(e)}get(e){return this.colors[e]||(this.colors[e]=this.availableColors.next()),this.colors[e]}}function So(e){if(e.length<2)throw new Error("Color scale must have at least 2 points");const t=[...e.sort(((e,t)=>e.value-t.value))],o=[];for(let e=1;e<t.length;e++){const s=to(t[e-1].color).a,i=to(t[e].color).a,n=$t(t[e-1].color),r=$t(t[e].color);o.push({min:t[e-1].value,max:t[e].value,minColor:n,maxColor:r,minColorAlpha:s,maxColorAlpha:i,colorDiff:Co(t[e-1].value,t[e].value,n,r)})}return e=>{if(e<o[0].min)return zt(o[0].minColor,o[0].minColorAlpha);for(const t of o)if(e>=t.min&&e<=t.max)return zt(yo(e,t.min,t.minColor,t.colorDiff),t.maxColorAlpha);return zt(o[o.length-1].maxColor,o[o.length-1].maxColorAlpha)}}function Co(e,t,o,s){const i=t-e;return[((o>>16)%256-(s>>16)%256)/i,((o>>8)%256-(s>>8)%256)/i,(o%256-s%256)/i]}function yo(e,t,o,s){const[i,n,r]=s;return Math.round((o>>16)%256-i*(e-t))<<16|Math.round((o>>8)%256-n*(e-t))<<8|Math.round(o%256-r*(e-t))}function wo(e){if(e<0)throw new Error(`number must be positive. Got ${e}`);return e<26?String.fromCharCode(65+e):wo(Math.floor(e/26)-1)+wo(e%26)}function Io(e){let t=0;const o=e.length;for(let s=0;s<o;s++){t=26*t+xo(e[s])}return t-1}function xo(e){const t=e.charCodeAt(0);return t>=65&&t<=90?t-64:t-96}function Eo(e){return e>="A"&&e<="Z"||e>="a"&&e<="z"}function Ro(e){return e>="0"&&e<="9"}const To=Io("ZZZ"),Ao=9999998;function Do(e){for(;" "===e.current;)e.advanceBy(1)}function _o(e){if("$"===e.current&&e.advanceBy(1),!e.current||!Eo(e.current))return-1;let t=0;for(;e.current&&Eo(e.current);)t=26*t+xo(e.shift());return t}function Oo(e){if("$"===e.current&&e.advanceBy(1),!e.current||!Ro(e.current))return-1;let t=0;for(;e.current&&Ro(e.current);)t=10*t+Number(e.shift());return t}function Fo(e){const t=new Mt(e);Do(t);const o=_o(t);if(-1===o||!t.current)throw new Error(`Invalid cell description: ${e}`);const s=Oo(t);Do(t);const i=o-1,n=s-1;if(!t.isOver()||i>To||n>Ao)throw new Error(`Invalid cell description: ${e}`);return{col:i,row:n}}function Po(e,t,o={colFixed:!1,rowFixed:!1}){return(o.colFixed?"$":"")+wo(e)+(o.rowFixed?"$":"")+String(t+1)}const Mo=e=>e,No=()=>!1;let ko=Mo,Vo=No;function Lo(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 Ho=function(e,...t){return Vo()?Lo(ko(e),...t):new Uo(e,t)};class Uo extends String{values;constructor(e,t){super(e),this.values=t}valueOf(){const e=super.valueOf();return Vo()?Lo(ko(e),...this.values):Lo(e,...this.values)}toString(){return this.valueOf()}}function Bo(e){return/^https?:\/\//i.test(e)?e:`https://${e}`}const zo=new n;function $o(e,t){return{url:e=Bo(e),label:t||e,isExternal:!0,isUrlEditable:!0}}zo.add("sheet_URL",{match:e=>nt(e),createLink:(e,t)=>({label:t,url:e,isExternal:!1,isUrlEditable:!1}),urlRepresentation(e,t){const o=at(e);return t.tryGetSheetName(o)||Ho("Invalid sheet")},open(e,t){const o=at(e);t.model.dispatch("ACTIVATE_SHEET",{sheetIdFrom:t.model.getters.getActiveSheetId(),sheetIdTo:o}).isCancelledBecause("SheetIsHidden")&&t.notifyUser({type:"warning",sticky:!1,text:Ho("Cannot open the link because the linked sheet is hidden.")})},sequence:0});const Go={createLink:$o,match:e=>tt(e),open:e=>window.open(e,"_blank"),urlRepresentation:e=>e,sequence:0};function Wo(e){return zo.getAll().sort(((e,t)=>e.sequence-t.sequence)).find((t=>t.match(e)))||Go}function qo(e,t){return Wo(e.url).urlRepresentation(e.url,t)}function Zo(e,t,o){Wo(e.url).open(e.url,t,o)}function jo(e){if("string"==typeof e){if(et(e)){const{label:t,url:o}=st(e);return Wo(o).createLink(o,t)}return tt(e)?$o(e):void 0}}class Yo{jsDate;constructor(e,t,o,s=0,i=0,n=0){this.jsDate=new Date(Date.UTC(e,t,o,s,i,n,0))}static fromTimestamp(e){const t=new Date(e);return new Yo(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds())}static now(){const e=new Date;return new Yo(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()}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(){const e=new Date(this.jsDate.getTime()),t=e.getUTCDay()||7;e.setUTCDate(e.getUTCDate()+4-t);const o=new Date(Date.UTC(e.getUTCFullYear(),0,1));return Math.ceil(((e.getTime()-o.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)}}const Xo=new Yo(1899,11,30),Ko=864e5,Jo=2e3,Qo=Yo.now().getFullYear(),es=Yo.now().getMonth(),ts=Yo.fromTimestamp(0).getTime()-Xo.getTime(),os=/^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/,ss=/^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/,is=wt.join(""),ns=new RegExp(`/|-|${wt.join("|")}`),rs=new RegExp(`^(\\d{1,4})[/${is}-](\\d{1,4})([/${is}-](\\d{1,4}))?$`),as=/((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;function ls(e,t){switch(typeof e){case"number":return e;case"string":return cs(e,t)?ds(e,t)?.value:!e||isNaN(Number(e))?void 0:Number(e);default:return}}function cs(e,t){return null!==ds(e,t)}const hs=new Map;function ds(e,t){return hs.has(t)||hs.set(t,new Map),hs.get(t).has(e)||hs.get(t).set(e,function(e,t){e=e.trim();let o=null;const s=e.match(as);if(s){if(o=function(e){if(e=e.trim(),as.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(/:/),i=s.length>=2,n=3===s.length;let r=Number(s[0]),a=i?Number(s[1]):0,l=n?Number(s[2]):0,c=n?"hh:mm:ss":"hh:mm";if(t||o)c+=" a";else if(!i)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 Yo(1899,11,30,r,a,l)}}return null}(s[0]),null===o)return null;e=e.replace(s[0],"").trim()}let i=null;const n=function(e,t){const o=e.match(rs);if(!o)return null;const[,s,i,,n]=o;if(s.length>2&&n&&n.length>2)return null;if(s.length>2)return{year:s,month:i,day:n,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(!n)return i.length>2?{month:s,year:i,day:void 0,dateString:e,type:r}:"dmy"===r?{day:s,month:i,year:n,dateString:e,type:"dmy"}:{month:s,day:i,year:n,dateString:e,type:"mdy"};if(n.length>2)return"mdy"===r?{month:s,day:i,year:n,dateString:e,type:"mdy"}:{day:s,month:i,year:n,dateString:e,type:"dmy"};if("mdy"===r)return{month:s,day:i,year:n,dateString:e,type:"mdy"};if("ymd"===r)return{year:s,month:i,day:n,dateString:e,type:"ymd"};if("dmy"===r)return{day:s,month:i,year:n,dateString:e,type:"dmy"};return null}(e,t);if(n){const t=n.dateString.match(ns)[0];if(i=function(e,t){const{year:o,month:s,day:i}=e,n=function(e){if(!e)return es;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}(i),a=function(e){if(!e)return Qo;const t=Number(e);switch(e.length){case 1:return Jo+t;case 2:return Jo+(Jo+t>Qo+10?-100:0)+t;case 3:case 4:return t}return null}(o);if(null===a||null===n||null===r)return null;const l=2===s?.length&&n+1<10||2===i?.length&&r<10,c=2!==o?.length,h=new Yo(a,n,r);if(h.getMonth()!==n||h.getDate()!==r)return null;const d=h.getTime()-Xo.getTime(),u=function(e,t,o,s){const i=e.year?s?"yyyy":"yy":void 0,n=e.month?o?"mm":"m":void 0,r=e.day?o?"dd":"d":void 0;switch(e.type){case"mdy":return[n,r,i].filter(lt).join(t);case"ymd":return[i,n,r].filter(lt).join(t);case"dmy":return[r,n,i].filter(lt).join(t)}}(e,t,l,c);return{value:Math.round(d/Ko),format:u,jsDate:h}}(n,t),null===i)return null;e=e.replace(n.dateString,"").trim()}if(""!==e||!i&&!o)return null;if(i&&i.jsDate&&o&&o.jsDate)return{value:i.value+o.value,format:i.format+" "+("hhhh:mm:ss"===o.format?"hh:mm:ss":o.format),jsDate:new Yo(i.jsDate.getFullYear()+o.jsDate.getFullYear()-1899,i.jsDate.getMonth()+o.jsDate.getMonth()-11,i.jsDate.getDate()+o.jsDate.getDate()-30,i.jsDate.getHours()+o.jsDate.getHours(),i.jsDate.getMinutes()+o.jsDate.getMinutes(),i.jsDate.getSeconds()+o.jsDate.getSeconds())};return i||o}(e,t)),hs.get(t).get(e)}function us(e){const t=Math.trunc(e),o=Yo.fromTimestamp(t*Ko-ts);let s=e-t;s=s<0?1+s:s;const i=Math.round(24*s),n=Math.round(24*(s-i/24)*60),r=Math.round(24*(s-i/24-n/24/60)*60*60);return o.setHours(i),o.setMinutes(n),o.setSeconds(r),o}function gs(e){return Math.round(ps(e))}function ps(e){return(e.getTime()-Xo.getTime())/Ko}function ms(e){return new Yo(e.getFullYear(),e.getMonth()+1,0).getDate()}function fs(e){return ms(e)===e.getDate()}function vs(e,t,o){const s=e.getFullYear(),i=e.getMonth(),n=e.getDate(),r=new Yo(s,i+t,1);return o&&n===ms(e)||n>ms(r)?r.setDate(ms(r)):r.setDate(n),r}function bs(e){const t=Math.trunc(e);return t%4==0&&t%100!=0||t%400==0}function Ss(e,t,o){if(e===t)return 0;if(e>t){const o=t;t=e,e=o}const s=us(e),i=us(t);let n=s.getDate(),r=i.getDate();const a=s.getMonth(),l=i.getMonth(),c=s.getFullYear(),h=i.getFullYear();let d=0,u=0;switch(o){case 0:31===n&&(n=30),30===n&&31===r&&(r=30),1===a&&n===(bs(c)?29:28)&&(n=30,1===l&&r===(bs(h)?29:28)&&(r=30)),d=c+(30*a+n)/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&&n<r){let e=0,t=0;for(let o=c;o<=h;o++)e++,t+=bs(o)?366:365;o=t/e}else s?bs(c)&&(o=366):(bs(c)&&a<2&&(o=366),bs(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===n&&(n=30),31===r&&(r=30),d=c+(30*a+n)/360,u=h+(30*l+r)/360}return u-d}function Cs(e,t){const o=12*(t.getFullYear()-e.getFullYear())+t.getMonth()-e.getMonth();return e.getDate()>t.getDate()?o-1:o}function ys(e,t){const o=e.getTime(),s=t.getTime();return Math.floor((s-o)/Ko)}function ws(e,t){const o=t.getFullYear()-e.getFullYear(),s=e.getMonth(),i=t.getMonth(),n=e.getDate(),r=t.getDate();return i>s||i===s&&r>=n?o:o-1}function Is(e,t,o){return t>o?Is(e,o,t):(e=Math.trunc(e),t=Math.trunc(t),o=Math.trunc(o),e>=t&&e<=o)}const xs=Et((function(e){return e=Be(e),new RegExp(`(?:^-?\\d+(?:${e}?\\d*(?:e(\\+|-)?\\d+)?)?|^-?${e}\\d+)(?!\\w|!)`)})),Es=Et((function(e){const t=Be(e.decimalSeparator),o="(?:\\s*"+`(?:\\d+(?:${Be(e.thousandsSeparator||"")}\\d{3,})*(?:${t}\\d*)?)`+"|"+`(?:${t}\\d+)`+")(?:e(?:\\+|-)?\\d+)?(?:\\s*%)?",s="(?:\\s*-)?",i="(?:\\s*[\\$€])?",n="^(?:(?:"+[s+i+o,s+o+i,i+s+o].join(")|(?:")+"))$";return new RegExp(n,"i")}));function Rs(e,t){return!!e&&Es(t).test(e.trim())}const Ts=Et((function(e){return new RegExp(`[$€${Be(e.thousandsSeparator||"")}]`,"g")}));function As(e,t){e=e.replace(Ts(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 Ds(e,t,o){const s=[...e].sort(((e,t)=>e-t));let i=(s.length+(o?-1:1))*t;if(o||i--,Number.isInteger(i))return s[i];const n=Math.ceil(i),r=Math.floor(i);return s[n]*(i-r)+s[r]*(n-i)}var _s,Os;!function(e){e.boolean="boolean",e.number="number",e.text="text",e.empty="empty",e.error="error"}(_s||(_s={})),function(e){e.PlainText="text/plain",e.Html="text/html",e.Image="image"}(Os||(Os={}));const Fs=new Set(["RENAME_SHEET","DELETE_SHEET","CREATE_SHEET","DUPLICATE_SHEET","ADD_COLUMNS_ROWS","REMOVE_COLUMNS_ROWS","UNDO","REDO","ADD_MERGE","REMOVE_MERGE","DUPLICATE_SHEET","UPDATE_LOCALE","ADD_PIVOT","UPDATE_PIVOT","INSERT_PIVOT","RENAME_PIVOT","REMOVE_PIVOT","DUPLICATE_PIVOT"]),Ps=new Set(["EVALUATE_CELLS","EVALUATE_CHARTS","UPDATE_CELL","UNHIDE_COLUMNS_ROWS","HIDE_COLUMNS_ROWS","GROUP_HEADERS","UNGROUP_HEADERS","FOLD_ALL_HEADER_GROUPS","FOLD_HEADER_GROUP","FOLD_HEADER_GROUPS_IN_ZONE","UNFOLD_ALL_HEADER_GROUPS","UNFOLD_HEADER_GROUP","UNFOLD_HEADER_GROUPS_IN_ZONE","UPDATE_TABLE","UPDATE_FILTER","UNDO","REDO"]),Ms=new Set(["MOVE_RANGES"]),Ns=new Set(["EVALUATE_CELLS","ADD_CONDITIONAL_FORMAT","REMOVE_CONDITIONAL_FORMAT","CHANGE_CONDITIONAL_FORMAT_PRIORITY"]),ks=new Set(["AUTOFILL_CELL","SET_BORDER","SET_ZONE_BORDERS"]),Vs=new Set(["START","ACTIVATE_SHEET","COPY","RESIZE_SHEETVIEW","SET_VIEWPORT_OFFSET","EVALUATE_CELLS","EVALUATE_CHARTS","SET_FORMULA_VISIBILITY","UPDATE_FILTER","UPDATE_CHART"]),Ls=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","COLOR_SHEET","HIDE_SHEET","SHOW_SHEET","MOVE_RANGES","ADD_CONDITIONAL_FORMAT","REMOVE_CONDITIONAL_FORMAT","CHANGE_CONDITIONAL_FORMAT_PRIORITY","CREATE_FIGURE","DELETE_FIGURE","UPDATE_FIGURE","SET_FORMATTING","CLEAR_FORMATTING","SET_BORDER","SET_ZONE_BORDERS","SET_BORDERS_ON_TARGET","CREATE_CHART","UPDATE_CHART","CREATE_TABLE","REMOVE_TABLE","UPDATE_TABLE","CREATE_TABLE_STYLE","REMOVE_TABLE_STYLE","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","ADD_PIVOT","UPDATE_PIVOT","INSERT_PIVOT","RENAME_PIVOT","REMOVE_PIVOT","DUPLICATE_PIVOT"]);function Hs(e){return Ls.has(e.type)}class Us{reasons;constructor(e=[]){Array.isArray(e)||(e=[e]),e=[...new Set(e)],this.reasons=e.filter((e=>"Success"!==e))}static get Success(){return Bs}get isSuccessful(){return 0===this.reasons.length}isCancelledBecause(e){return this.reasons.includes(e)}}const Bs=new Us;var zs;e.CommandResult=void 0,(zs=e.CommandResult||(e.CommandResult={})).Success="Success",zs.CancelledForUnknownReason="CancelledForUnknownReason",zs.WillRemoveExistingMerge="WillRemoveExistingMerge",zs.MergeIsDestructive="MergeIsDestructive",zs.CellIsMerged="CellIsMerged",zs.InvalidTarget="InvalidTarget",zs.EmptyUndoStack="EmptyUndoStack",zs.EmptyRedoStack="EmptyRedoStack",zs.NotEnoughElements="NotEnoughElements",zs.NotEnoughSheets="NotEnoughSheets",zs.MissingSheetName="MissingSheetName",zs.UnchangedSheetName="UnchangedSheetName",zs.DuplicatedSheetName="DuplicatedSheetName",zs.DuplicatedSheetId="DuplicatedSheetId",zs.ForbiddenCharactersInSheetName="ForbiddenCharactersInSheetName",zs.WrongSheetMove="WrongSheetMove",zs.WrongSheetPosition="WrongSheetPosition",zs.InvalidAnchorZone="InvalidAnchorZone",zs.SelectionOutOfBound="SelectionOutOfBound",zs.TargetOutOfSheet="TargetOutOfSheet",zs.WrongCutSelection="WrongCutSelection",zs.WrongPasteSelection="WrongPasteSelection",zs.WrongPasteOption="WrongPasteOption",zs.WrongFigurePasteOption="WrongFigurePasteOption",zs.EmptyClipboard="EmptyClipboard",zs.EmptyRange="EmptyRange",zs.InvalidRange="InvalidRange",zs.InvalidZones="InvalidZones",zs.InvalidSheetId="InvalidSheetId",zs.InvalidCellId="InvalidCellId",zs.InvalidFigureId="InvalidFigureId",zs.InputAlreadyFocused="InputAlreadyFocused",zs.MaximumRangesReached="MaximumRangesReached",zs.MinimumRangesReached="MinimumRangesReached",zs.InvalidChartDefinition="InvalidChartDefinition",zs.InvalidDataSet="InvalidDataSet",zs.InvalidLabelRange="InvalidLabelRange",zs.InvalidScorecardKeyValue="InvalidScorecardKeyValue",zs.InvalidScorecardBaseline="InvalidScorecardBaseline",zs.InvalidGaugeDataRange="InvalidGaugeDataRange",zs.EmptyGaugeRangeMin="EmptyGaugeRangeMin",zs.GaugeRangeMinNaN="GaugeRangeMinNaN",zs.EmptyGaugeRangeMax="EmptyGaugeRangeMax",zs.GaugeRangeMaxNaN="GaugeRangeMaxNaN",zs.GaugeLowerInflectionPointNaN="GaugeLowerInflectionPointNaN",zs.GaugeUpperInflectionPointNaN="GaugeUpperInflectionPointNaN",zs.InvalidAutofillSelection="InvalidAutofillSelection",zs.MinBiggerThanMax="MinBiggerThanMax",zs.LowerBiggerThanUpper="LowerBiggerThanUpper",zs.MidBiggerThanMax="MidBiggerThanMax",zs.MinBiggerThanMid="MinBiggerThanMid",zs.FirstArgMissing="FirstArgMissing",zs.SecondArgMissing="SecondArgMissing",zs.MinNaN="MinNaN",zs.MidNaN="MidNaN",zs.MaxNaN="MaxNaN",zs.ValueUpperInflectionNaN="ValueUpperInflectionNaN",zs.ValueLowerInflectionNaN="ValueLowerInflectionNaN",zs.MinInvalidFormula="MinInvalidFormula",zs.MidInvalidFormula="MidInvalidFormula",zs.MaxInvalidFormula="MaxInvalidFormula",zs.ValueUpperInvalidFormula="ValueUpperInvalidFormula",zs.ValueLowerInvalidFormula="ValueLowerInvalidFormula",zs.InvalidSortAnchor="InvalidSortAnchor",zs.InvalidSortZone="InvalidSortZone",zs.SortZoneWithArrayFormulas="SortZoneWithArrayFormulas",zs.WaitingSessionConfirmation="WaitingSessionConfirmation",zs.MergeOverlap="MergeOverlap",zs.TooManyHiddenElements="TooManyHiddenElements",zs.Readonly="Readonly",zs.InvalidViewportSize="InvalidViewportSize",zs.InvalidScrollingDirection="InvalidScrollingDirection",zs.ViewportScrollLimitsReached="ViewportScrollLimitsReached",zs.FigureDoesNotExist="FigureDoesNotExist",zs.InvalidConditionalFormatId="InvalidConditionalFormatId",zs.InvalidCellPopover="InvalidCellPopover",zs.EmptyTarget="EmptyTarget",zs.InvalidFreezeQuantity="InvalidFreezeQuantity",zs.FrozenPaneOverlap="FrozenPaneOverlap",zs.ValuesNotChanged="ValuesNotChanged",zs.InvalidFilterZone="InvalidFilterZone",zs.TableNotFound="TableNotFound",zs.TableOverlap="TableOverlap",zs.InvalidTableConfig="InvalidTableConfig",zs.InvalidTableStyle="InvalidTableStyle",zs.FilterNotFound="FilterNotFound",zs.MergeInTable="MergeInTable",zs.NonContinuousTargets="NonContinuousTargets",zs.DuplicatedFigureId="DuplicatedFigureId",zs.InvalidSelectionStep="InvalidSelectionStep",zs.DuplicatedChartId="DuplicatedChartId",zs.ChartDoesNotExist="ChartDoesNotExist",zs.InvalidHeaderIndex="InvalidHeaderIndex",zs.InvalidQuantity="InvalidQuantity",zs.MoreThanOneColumnSelected="MoreThanOneColumnSelected",zs.EmptySplitSeparator="EmptySplitSeparator",zs.SplitWillOverwriteContent="SplitWillOverwriteContent",zs.NoSplitSeparatorInSelection="NoSplitSeparatorInSelection",zs.NoActiveSheet="NoActiveSheet",zs.InvalidLocale="InvalidLocale",zs.MoreThanOneRangeSelected="MoreThanOneRangeSelected",zs.NoColumnsProvided="NoColumnsProvided",zs.ColumnsNotIncludedInZone="ColumnsNotIncludedInZone",zs.DuplicatesColumnsSelected="DuplicatesColumnsSelected",zs.InvalidHeaderGroupStartEnd="InvalidHeaderGroupStartEnd",zs.HeaderGroupAlreadyExists="HeaderGroupAlreadyExists",zs.UnknownHeaderGroup="UnknownHeaderGroup",zs.UnknownDataValidationRule="UnknownDataValidationRule",zs.UnknownDataValidationCriterionType="UnknownDataValidationCriterionType",zs.InvalidDataValidationCriterionValue="InvalidDataValidationCriterionValue",zs.InvalidNumberOfCriterionValues="InvalidNumberOfCriterionValues",zs.InvalidCopyPasteSelection="InvalidCopyPasteSelection",zs.NoChanges="NoChanges",zs.InvalidInputId="InvalidInputId",zs.SheetIsHidden="SheetIsHidden",zs.InvalidTableResize="InvalidTableResize",zs.PivotIdNotFound="PivotIdNotFound",zs.PivotInError="PivotInError",zs.EmptyName="EmptyName",zs.ValueCellIsInvalidFormula="ValueCellIsInvalidFormula",zs.InvalidDefinition="InvalidDefinition",zs.InvalidColor="InvalidColor",zs.InvalidPivotDataSet="InvalidPivotDataSet";const $s=new Set(["containsText","notContainsText","isGreaterThan","isGreaterOrEqualTo","isLessThan","isLessOrEqualTo","isBetween","isNotBetween","beginsWithText","endsWithText","isNotEmpty","isEmpty","isNotEqual","isEqual"]),Gs=new Set(["containsText","notContainsText","isEqualText","isEmail","isLink","dateIs","dateIsBefore","dateIsOnOrBefore","dateIsAfter","dateIsOnOrAfter","dateIsBetween","dateIsNotBetween","dateIsValid","isEqual","isNotEqual","isGreaterThan","isGreaterOrEqualTo","isLessThan","isLessOrEqualTo","isBetween","isNotBetween","isBoolean","isValueInList","isValueInRange","customFormula"]),Ws=[{name:"English (US)",code:"en_US",thousandsSeparator:",",decimalSeparator:".",weekStart:7,dateFormat:"m/d/yyyy",timeFormat:"hh:mm:ss a",formulaArgSeparator:","},{name:"French",code:"fr_FR",thousandsSeparator:" ",decimalSeparator:",",weekStart:1,dateFormat:"dd/mm/yyyy",timeFormat:"hh:mm:ss",formulaArgSeparator:";"}],qs=Ws[0],Zs=["thin","medium","thick","dashed","dotted"];function js(e){return Array.isArray(e)&&Array.isArray(e[0])}var Ys;!function(e){e.UP="up",e.DOWN="down",e.LEFT="left",e.RIGHT="right"}(Ys||(Ys={}));const Xs={Background:0,Highlights:1,Clipboard:2,Chart:4,Autofill:5,Selection:6,Headers:100},Ks=Et((()=>Object.keys(Xs).sort(((e,t)=>Xs[e]-Xs[t]))));new Set(["containsText","notContainsText","isEqualText","dateIs","dateIsBefore","dateIsOnOrBefore","dateIsAfter","dateIsOnOrAfter","dateIsBetween","dateIsNotBetween","isEqual","isNotEqual","isGreaterThan","isGreaterOrEqualTo","isLessThan","isLessOrEqualTo","isBetween","isNotBetween","customFormula","beginsWithText","endsWithText","isNotEmpty","isEmpty"]);const Js=["containsText","notContainsText","isEqualText","isEmpty","isNotEmpty","beginsWithText","endsWithText"],Qs=["isEqual","isNotEqual","isGreaterThan","isGreaterOrEqualTo","isLessThan","isLessOrEqualTo","isBetween","isNotBetween","isEmpty","isNotEmpty"],ei=["dateIs","dateIsBefore","dateIsOnOrBefore","dateIsAfter","dateIsOnOrAfter","dateIsBetween","dateIsNotBetween","isEmpty","isNotEmpty"],ti={NotAvailable:"#N/A",InvalidReference:"#REF",BadExpression:"#BAD_EXPR",CircularDependency:"#CYCLE",UnknownFunction:"#NAME?",DivisionByZero:"#DIV/0!",SpilledBlocked:"#SPILL!",GenericError:"#ERROR",NullError:"#NULL!"},oi=new Set(Object.values(ti));class si{message;value;constructor(e=Ho("Error"),t=ti.GenericError){this.message=e,this.value=t,this.message=e.toString()}}class ii extends si{constructor(e=Ho("Invalid expression")){super(e,ti.BadExpression)}}class ni extends si{constructor(e=Ho("Circular reference")){super(e,ti.CircularDependency)}}class ri extends si{constructor(e=Ho("Invalid reference")){super(e,ti.InvalidReference)}}class ai extends si{constructor(e=Ho("Data not available")){super(e,ti.NotAvailable)}}class li extends si{constructor(e=Ho("Unknown function")){super(e,ti.UnknownFunction)}}class ci extends si{constructor(e=Ho("Spill range is not empty")){super(e,ti.SpilledBlocked)}}class hi extends si{constructor(e=Ho("Division by zero")){super(e,ti.DivisionByZero)}}const di=["number","string","boolean","undefined"];function ui(e){if(void 0!==e)return js(e)?e[0][0]?.format:e.format}function gi(e){return"string"==typeof e&&oi.has(e)}function pi(e){return{value:ti.NotAvailable,message:Ho("Did not find value '%s' in [[FUNCTION_NAME]] evaluation.",wi(e))}}const mi=e=>Ho("The function [[FUNCTION_NAME]] expects a number value, but '%s' is a string, and cannot be coerced to a number.",e);function fi(e,t){const o=Ti(e);switch(typeof o){case"number":return o;case"boolean":return o?1:0;case"string":if(Rs(o,t)||""===o)return As(o,t);const e=ds(o,t);if(e)return e.value;throw new si(mi(o));default:return 0}}function vi(e,t){try{return fi(e,t)}catch(e){return}}function bi(e,t){return ji(e).map((e=>e.map((e=>{if("number"!=typeof e.value)throw new si(Ho("Function [[FUNCTION_NAME]] expects number values for %s, but got a %s.",t,typeof e.value));return e.value}))))}function Si(e,t){const o=Ti(e);if(""===o)throw new si(mi(o));return fi(o,t)}function Ci(e,t){return Math.trunc(fi(e,t))}function yi(e,t){return Math.trunc(Si(e,t))}function wi(e){const t=Ti(e);switch(typeof t){case"string":return t;case"number":return t.toString();case"boolean":return t?"TRUE":"FALSE";default:return""}}const Ii=Et((function(e){return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"")})),xi=e=>Ho("The function [[FUNCTION_NAME]] expects a boolean value, but '%s' is a text, and cannot be coerced to a boolean.",e);function Ei(e){const t=Ti(e);switch(typeof t){case"boolean":return t;case"string":if(t){const e=t.toUpperCase();if("TRUE"===e)return!0;if("FALSE"===e)return!1;throw new si(xi(t))}return!1;case"number":return!!t;default:return!1}}function Ri(e,t){return us(fi(Ti(e),t))}function Ti(e){if("object"==typeof e&&null!==e&&"value"in e){if(gi(e.value))throw e;return e.value}if(gi(e))throw new si("",e);return e}function Ai(e,t,o){for(const s of e)if(js(s)){const e=s.length,o=s[0].length;for(let i=0;i<o;i++)for(let o=0;o<e;o++)t(s[o][i])}else o(s)}function Di(e,t){Ai(e,(e=>{if(gi(e.value))throw e;t(e)}),(e=>{if(gi(e?.value))throw e;t(e)}))}function _i(e,t,o){Ai(e,(e=>{if("number"==typeof e?.value&&t(e),gi(e?.value))throw e}),(e=>{t({value:Si(e,o),format:e?.format})}))}function Oi(e,t,o,s,i="rowFirst"){let n=s;for(const s of e)if(js(s)){const e=s.length,o=s[0].length;if("rowFirst"===i)for(let i=0;i<o;i++)for(let o=0;o<e;o++)n=t(n,s[o][i]);else for(let i=0;i<e;i++)for(let e=0;e<o;e++)n=t(n,s[i][e])}else n=o(n,s);return n}function Fi(e,t,o,s="rowFirst"){return Oi(e,t,t,o,s)}function Pi(e,t,o,s){return Oi(e,((e,o)=>{const s=o?.value;if("number"==typeof s)return t(e,s);if(gi(s))throw o;return e}),((e,o)=>t(e,Si(o,s))),o)}function Mi(e,t,o,s){return Oi(e,((e,o)=>{const i=o?.value;if(null!=i){if("number"==typeof i)return t(e,i);if("boolean"==typeof i)return t(e,fi(i,s));if(gi(i))throw o;return t(e,0)}return e}),((e,o)=>t(e,fi(o,s))),o)}function Ni(e,t,o){const s=Array(e);for(let i=0;i<e;i++){s[i]=Array(t);for(let e=0;e<t;e++)s[i][e]=o(i,e)}return s}function ki(e,t){return 0===e.length?[]:Ni(e.length,e[0].length,((o,s)=>t(e[o][s])))}function Vi(e){return e.length?Ni(e[0].length,e.length,((t,o)=>e[o][t])):[]}function Li(e,t,o=void 0){let s,i=1,n=1,r=1/0,a=1/0;for(let e=0;e<t.length;e++){const l=t[e];if(js(l)&&(void 0===o||o[e])){const o=l.length,c=l[0].length;1!==o||1!==c?(s??=new Array(t.length),1!==o&&1!==c?(s[e]="matrix",i=Math.max(i,o),n=Math.max(n,c),r=Math.min(r,o),a=Math.min(a,c)):1!==o?(s[e]="horizontal",i=Math.max(i,o),r=Math.min(r,o)):1!==c&&(s[e]="vertical",n=Math.max(n,c),a=Math.min(a,c))):t[e]=l[0][0]}}if(1===i&&1===n)return e(...t);return Ni(i,n,((o,i)=>{if(o>r-1||i>a-1)return new ai(Ho("Array arguments to [[FUNCTION_NAME]] are of different size."));const n=e(...(l=o,c=i,t.map(((e,t)=>{switch(s?.[t]){case"matrix":return e[l][c];case"horizontal":return e[l][0];case"vertical":return e[0][c];case void 0:return e}}))));var l,c;return js(n)?n[0][0]:n}))}function Hi(e,t){return function(e,t,o){for(const s of e)if(js(s)){const e=s.length,o=s[0].length;for(let i=0;i<o;i++)for(let o=0;o<e;o++)if(!t(s[o][i]??void 0))return}else if(!o(s))return}(e,(e=>{const o=e?.value;if("boolean"==typeof o)return t(o);if("number"==typeof o)return t(!!o);if(gi(o))throw e;return!0}),(e=>void 0===e||null===e.value||t(function(e){const t=Ti(e);if(""===t)throw new si(xi(t));return Ei(t)}(e))))}function Ui(e,t){let o,s,i=e.substring(0,2);return"<="===i||">="===i||"<>"===i?(o=i,s=e.substring(2)):(i=e.substring(0,1),"<"===i||">"===i||"="===i?(o=i,s=e.substring(1)):(o="=",s=e)),Rs(s,t)||cs(s,t)?s=fi(s,t):"TRUE"!==s&&"FALSE"!==s||(s=Ei(s)),{operator:o,operand:s}}const Bi=Et((function(e){if("*"===e)return/.+/;let t="",o="";for(const 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")}));function zi(e="",t,o){const{operator:s,operand:i}=t;if(void 0===i||null===e||null===i)return!1;if("number"==typeof i&&"="===s)return"string"==typeof e&&(Rs(e,o)||cs(e,o))?fi(e,o)===i:e===i;if("<>"===s||"="===s){let t;return t=typeof e==typeof i&&("string"==typeof e&&"string"==typeof i?Bi(i).test(e):e===i),"="===s?t:!t}if(typeof e==typeof i)switch(s){case"<":return e<i;case">":return e>i;case"<=":return e<=i;case">=":return e>=i}return!1}function $i(e,t,o,s=!1){const i=e.length;if(i%2==1)throw new si(Ho("Function [[FUNCTION_NAME]] expects criteria_range and criterion to be in pairs."));const n=ji(e[0]),r=n.length,a=n[0].length,l=[];for(let t=0;t<i-1;t+=2){const i=ji(e[t]);if(i.length!==r||i[0].length!==a)throw new si(Ho("Function [[FUNCTION_NAME]] expects criteria_range to have the same dimension"));const n=Ui(wi(e[t+1]),o);s&&"string"==typeof n.operand&&(n.operand+="*"),l.push(n)}for(let s=0;s<r;s++)for(let n=0;n<a;n++){let r=!0;for(let t=0;t<i-1;t+=2){if(r=zi(ji(e[t])[s][n].value??void 0,l[t/2],o),!r)break}r&&t(s,n)}}function Gi(e,t,o,s,i,n){if(void 0===t||null===t.value)return-1;if(gi(t.value))throw t;const r=qi(t.value),a=typeof r;let l,c,h,d,u,g,p=0,m=i-1;const f="desc"===s?t=>qi(n(e,i-t-1)):t=>qi(n(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?i-c-1:c}function Wi(e,t,o,s,i,n,r=!1){if(void 0===t||null===t.value)return-1;if(gi(t.value))throw t;const a=qi(t.value),l=r?(e,t)=>qi(i(e,s-t-1)):(e,t)=>qi(i(e,t)),c="wildcard"!==o||"string"!=typeof a||!(a.includes("*")||a.includes("?"));if(n&&c){const t=r?"reverseSearch":"forwardSearch";let i=n[t].get(e);if(void 0===i){i=new Map;for(let t=0;t<s;t++){const o=l(e,t)??null;i.has(o)||i.set(o,t)}n[t].set(e,i)}if(i.has(a)){const e=i.get(a);return r?s-e-1:e}if("strict"===o)return-1}const h=function(e,t,o,s,i){let n=o=>i(e,o)===t;if("wildcard"===o&&"string"==typeof t&&(t.includes("*")||t.includes("?"))){const o=Bi(t);n=t=>{const s=i(e,t);return"string"==typeof s&&o.test(s)}}let r,a=-1;"nextSmaller"===o&&(n=o=>{const s=i(e,o);return(!r&&Zi(t,s)>=0||Zi(t,s)>=0&&Zi(s,r)>0)&&(r=s,a=o),s===t});"nextGreater"===o&&(n=o=>{const s=i(e,o);return(!r&&Zi(t,s)<=0||Zi(t,s)<=0&&Zi(s,r)<0)&&(r=s,a=o),s===t});for(let e=0;e<s;e++)if(n(e))return e;return a}(e,a,o,s,l);return r&&-1!==h?s-h-1:h}function qi(e){return"string"==typeof e?Ii(e):e}function Zi(e,t){let o=di.indexOf(typeof e)-di.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 ji(e){return void 0===e?[[]]:js(e)?e:[[e]]}function Yi(e,t){return Fi(e,((e,o)=>(e.push(t(o)),e)),[],"rowFirst")}function Xi(e){if(void 0===e)return!1;const{value:t}=e;return null!==t&&""!==t}function Ki(e){let t;if('"'===e.current?(e.shift(),t='"'):e.currentStartsWith("[$")&&(e.advanceBy(2),t="]"),!t)return null;let o="";for(;e.current&&e.current!==t;)o+=e.shift();if(e.current!==t)throw new Error("Unterminated string in format");return e.shift(),{type:"STRING",value:o}}const Ji=new Set("$+-/():!^&~{}<>= ");function Qi(e){if("\\"===e.current){e.shift();const t=e.shift();if(!t)throw new Error("Unexpected end of format string");return{type:"CHAR",value:t}}return Ji.has(e.current)?{type:"CHAR",value:e.shift()}:null}function en(e){return","===e.current?(e.shift(),{type:"THOUSANDS_SEPARATOR",value:","}):null}function tn(e){return"@"===e.current?(e.shift(),{type:"TEXT_PLACEHOLDER",value:"@"}):null}function on(e){return"."===e.current?(e.shift(),{type:"DECIMAL_POINT",value:"."}):null}function sn(e){return"%"===e.current?(e.shift(),{type:"PERCENT",value:"%"}):null}function nn(e){if("0"===e.current||"#"===e.current){const t=e.current;return e.shift(),{type:"DIGIT",value:t}}return null}const rn=new Set("dmqyhsa");function an(e){if(!rn.has(e.current))return null;const t=e.current;let o="";for(;e.current===t;)o+=e.shift();return{type:"DATE_PART",value:o}}function ln(e){if("*"!==e.current)return null;e.shift();const t=e.shift();if(!t)throw new Error("Unexpected end of format string");return{type:"REPEATED_CHAR",value:t}}const cn=20,hn={};function dn(e){let t=hn[e];return void 0===t&&(t=function(e){const t=function(e){const t=new Mt(e),o=[];let s=[];for(o.push(s);!t.isOver();){if(";"===t.current){s=[],o.push(s),t.shift();continue}const e=nn(t)||Ki(t)||Qi(t)||en(t)||on(t)||sn(t)||an(t)||tn(t)||ln(t);if(!e)throw new Error("Unknown token at "+t.remaining());s.push(e)}return o}(e);for(const e of t){const t=e.filter((e=>"REPEATED_CHAR"===e.type));for(const e of t.slice(1))e.type="CHAR"}const o=gn(t[0])||un(t[0])||pn(t[0]);if(!o)throw new Error("Invalid first format part of: "+e);if(t.length>1&&"text"===o.type)throw new Error("The first format in a multi-part format must be a number format: "+e);const s=gn(t[1])||un(t[1]);if(t[1]?.length&&!s)throw new Error("Invalid second format part of: "+e);const i=gn(t[2])||un(t[2]);if(t[2]?.length&&!i)throw new Error("Invalid third format part of: "+e);const n=pn(t[3]);if(t[3]?.length&&!n)throw new Error("Invalid fourth format part of: "+e);return{positive:o,negative:s,zero:i,text:n}}(e),hn[e]=t),t}function un(e){if(!e||!function(e){return e.every((e=>"DIGIT"===e.type||"DECIMAL_POINT"===e.type||"THOUSANDS_SEPARATOR"===e.type||"PERCENT"===e.type||"STRING"===e.type||"CHAR"===e.type||"REPEATED_CHAR"===e.type))}(e))return;const t=[];let o,s=t,i=0,n=0,r=e.findLastIndex((e=>"DIGIT"===e.type)),a=!1,l=0;for(let c=0;c<e.length;c++){const h=e[c];switch(h.type){case"DIGIT":s===t?s.push(h):l<cn&&(s.push(h),l++);break;case"DECIMAL_POINT":if(s!==t)throw new Error("Multiple decimal points in a number format");o=[],s=o;break;case"REPEATED_CHAR":case"CHAR":case"STRING":s.push(h);break;case"PERCENT":i++,s.push(h);break;case"THOUSANDS_SEPARATOR":c-1===r?(n+=1,r++,s.push(h)):"DIGIT"===e[c+1]?.type&&"DIGIT"===e[c-1]?.type?(s===t&&(a=!0),s.push(h)):s.push({type:"CHAR",value:","})}}return{type:"number",integerPart:t,decimalPart:o,percentSymbols:i,thousandsSeparator:a,magnitude:n}}function gn(e){const t=e&&function(e){return e.every((e=>"DATE_PART"===e.type||"DECIMAL_POINT"===e.type||"THOUSANDS_SEPARATOR"===e.type||"STRING"===e.type||"CHAR"===e.type||"REPEATED_CHAR"===e.type))}(e)?{type:"date",tokens:e}:void 0;if(!t)return;if(t.tokens.length&&t.tokens.every((e=>"DATE_PART"===e.type&&"a"===e.value)))throw new Error("Invalid date format");const o=function(e){const t=e.filter((e=>"DATE_PART"===e.type));for(let e=0;e<t.length;e++)!t[e].value.startsWith("m")||t[e].value.length>2||(t[e-1]?.value.startsWith("h")||t[e+1]?.value.startsWith("s"))&&(t[e].value=t[e].value.replaceAll("m","M"));return e}(t.tokens.map((e=>"THOUSANDS_SEPARATOR"===e.type||"DECIMAL_POINT"===e.type?{type:"CHAR",value:e.value}:e)));return{type:"date",tokens:o}}function pn(e){return e&&function(e){return e.every((e=>"STRING"===e.type||"TEXT_PLACEHOLDER"===e.type||"CHAR"===e.type||"REPEATED_CHAR"===e.type))}(e)?{type:"text",tokens:e}:void 0}function mn(e){return[fn(e.positive),fn(e.negative),fn(e.zero),fn(e.text)].filter(lt).join(";")}function fn(e){if(!e)return;let t="";const o="number"!==e.type?e.tokens:function(e){const t=[...e.integerPart];