UNPKG

@odoo/o-spreadsheet

Version:
1 lines 1.52 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]}}var r,a;!function(e){e.boolean="boolean",e.number="number",e.text="text",e.empty="empty",e.error="error"}(r||(r={})),function(e){e.PlainText="text/plain",e.Html="text/html",e.Image="image"}(a||(a={}));const l=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"]),c=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"]),h=new Set(["MOVE_RANGES"]),d=new Set(["EVALUATE_CELLS","ADD_CONDITIONAL_FORMAT","REMOVE_CONDITIONAL_FORMAT","CHANGE_CONDITIONAL_FORMAT_PRIORITY"]),u=new Set(["AUTOFILL_CELL","SET_BORDER","SET_ZONE_BORDERS","SET_BORDERS_ON_TARGET"]),g=new Set(["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"]),p=new Set(["START","ACTIVATE_SHEET","COPY","RESIZE_SHEETVIEW","SET_VIEWPORT_OFFSET","EVALUATE_CELLS","EVALUATE_CHARTS","SET_FORMULA_VISIBILITY","UPDATE_FILTER","UPDATE_CHART","UPDATE_CAROUSEL_ACTIVE_ITEM","UPDATE_PIVOT"]),m=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","CREATE_CAROUSEL","UPDATE_CAROUSEL","SET_FORMATTING","CLEAR_FORMATTING","SET_BORDER","SET_ZONE_BORDERS","SET_BORDERS_ON_TARGET","CREATE_CHART","UPDATE_CHART","DELETE_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 f(e){return m.has(e.type)}class v{reasons;constructor(e=[]){Array.isArray(e)||(e=[e]),e=[...new Set(e)],this.reasons=e.filter((e=>"Success"!==e))}static get Success(){return b}get isSuccessful(){return 0===this.reasons.length}isCancelledBecause(e){return this.reasons.includes(e)}}const b=new v;var S;e.CommandResult=void 0,(S=e.CommandResult||(e.CommandResult={})).Success="Success",S.CancelledForUnknownReason="CancelledForUnknownReason",S.WillRemoveExistingMerge="WillRemoveExistingMerge",S.CannotMoveTableHeader="CannotMoveTableHeader",S.MergeIsDestructive="MergeIsDestructive",S.CellIsMerged="CellIsMerged",S.InvalidTarget="InvalidTarget",S.EmptyUndoStack="EmptyUndoStack",S.EmptyRedoStack="EmptyRedoStack",S.NotEnoughElements="NotEnoughElements",S.NotEnoughSheets="NotEnoughSheets",S.MissingSheetName="MissingSheetName",S.UnchangedSheetName="UnchangedSheetName",S.DuplicatedSheetName="DuplicatedSheetName",S.DuplicatedSheetId="DuplicatedSheetId",S.ForbiddenCharactersInSheetName="ForbiddenCharactersInSheetName",S.WrongSheetMove="WrongSheetMove",S.WrongSheetPosition="WrongSheetPosition",S.InvalidAnchorZone="InvalidAnchorZone",S.SelectionOutOfBound="SelectionOutOfBound",S.TargetOutOfSheet="TargetOutOfSheet",S.WrongCutSelection="WrongCutSelection",S.WrongPasteSelection="WrongPasteSelection",S.WrongPasteOption="WrongPasteOption",S.WrongFigurePasteOption="WrongFigurePasteOption",S.EmptyClipboard="EmptyClipboard",S.EmptyRange="EmptyRange",S.InvalidRange="InvalidRange",S.InvalidZones="InvalidZones",S.InvalidSheetId="InvalidSheetId",S.InvalidCellId="InvalidCellId",S.InvalidFigureId="InvalidFigureId",S.InputAlreadyFocused="InputAlreadyFocused",S.MaximumRangesReached="MaximumRangesReached",S.MinimumRangesReached="MinimumRangesReached",S.InvalidChartDefinition="InvalidChartDefinition",S.InvalidDataSet="InvalidDataSet",S.InvalidLabelRange="InvalidLabelRange",S.InvalidScorecardKeyValue="InvalidScorecardKeyValue",S.InvalidScorecardBaseline="InvalidScorecardBaseline",S.InvalidGaugeDataRange="InvalidGaugeDataRange",S.EmptyGaugeRangeMin="EmptyGaugeRangeMin",S.GaugeRangeMinNaN="GaugeRangeMinNaN",S.EmptyGaugeRangeMax="EmptyGaugeRangeMax",S.GaugeRangeMaxNaN="GaugeRangeMaxNaN",S.GaugeLowerInflectionPointNaN="GaugeLowerInflectionPointNaN",S.GaugeUpperInflectionPointNaN="GaugeUpperInflectionPointNaN",S.InvalidAutofillSelection="InvalidAutofillSelection",S.MinBiggerThanMax="MinBiggerThanMax",S.LowerBiggerThanUpper="LowerBiggerThanUpper",S.MidBiggerThanMax="MidBiggerThanMax",S.MinBiggerThanMid="MinBiggerThanMid",S.FirstArgMissing="FirstArgMissing",S.SecondArgMissing="SecondArgMissing",S.MinNaN="MinNaN",S.MidNaN="MidNaN",S.MaxNaN="MaxNaN",S.ValueUpperInflectionNaN="ValueUpperInflectionNaN",S.ValueLowerInflectionNaN="ValueLowerInflectionNaN",S.MinInvalidFormula="MinInvalidFormula",S.MidInvalidFormula="MidInvalidFormula",S.MaxInvalidFormula="MaxInvalidFormula",S.ValueUpperInvalidFormula="ValueUpperInvalidFormula",S.ValueLowerInvalidFormula="ValueLowerInvalidFormula",S.InvalidSortAnchor="InvalidSortAnchor",S.InvalidSortZone="InvalidSortZone",S.SortZoneWithArrayFormulas="SortZoneWithArrayFormulas",S.WaitingSessionConfirmation="WaitingSessionConfirmation",S.MergeOverlap="MergeOverlap",S.TooManyHiddenElements="TooManyHiddenElements",S.Readonly="Readonly",S.InvalidViewportSize="InvalidViewportSize",S.InvalidScrollingDirection="InvalidScrollingDirection",S.ViewportScrollLimitsReached="ViewportScrollLimitsReached",S.FigureDoesNotExist="FigureDoesNotExist",S.InvalidConditionalFormatId="InvalidConditionalFormatId",S.InvalidCellPopover="InvalidCellPopover",S.EmptyTarget="EmptyTarget",S.InvalidFreezeQuantity="InvalidFreezeQuantity",S.FrozenPaneOverlap="FrozenPaneOverlap",S.ValuesNotChanged="ValuesNotChanged",S.InvalidFilterZone="InvalidFilterZone",S.TableNotFound="TableNotFound",S.TableOverlap="TableOverlap",S.InvalidTableConfig="InvalidTableConfig",S.InvalidTableStyle="InvalidTableStyle",S.FilterNotFound="FilterNotFound",S.MergeInTable="MergeInTable",S.NonContinuousTargets="NonContinuousTargets",S.DuplicatedFigureId="DuplicatedFigureId",S.InvalidSelectionStep="InvalidSelectionStep",S.DuplicatedChartId="DuplicatedChartId",S.ChartDoesNotExist="ChartDoesNotExist",S.InvalidHeaderIndex="InvalidHeaderIndex",S.InvalidQuantity="InvalidQuantity",S.MoreThanOneColumnSelected="MoreThanOneColumnSelected",S.EmptySplitSeparator="EmptySplitSeparator",S.SplitWillOverwriteContent="SplitWillOverwriteContent",S.NoSplitSeparatorInSelection="NoSplitSeparatorInSelection",S.NoActiveSheet="NoActiveSheet",S.InvalidLocale="InvalidLocale",S.MoreThanOneRangeSelected="MoreThanOneRangeSelected",S.NoColumnsProvided="NoColumnsProvided",S.ColumnsNotIncludedInZone="ColumnsNotIncludedInZone",S.DuplicatesColumnsSelected="DuplicatesColumnsSelected",S.InvalidHeaderGroupStartEnd="InvalidHeaderGroupStartEnd",S.HeaderGroupAlreadyExists="HeaderGroupAlreadyExists",S.UnknownHeaderGroup="UnknownHeaderGroup",S.UnknownDataValidationRule="UnknownDataValidationRule",S.UnknownDataValidationCriterionType="UnknownDataValidationCriterionType",S.InvalidDataValidationCriterionValue="InvalidDataValidationCriterionValue",S.InvalidNumberOfCriterionValues="InvalidNumberOfCriterionValues",S.InvalidCopyPasteSelection="InvalidCopyPasteSelection",S.NoChanges="NoChanges",S.InvalidInputId="InvalidInputId",S.SheetIsHidden="SheetIsHidden",S.InvalidTableResize="InvalidTableResize",S.PivotIdNotFound="PivotIdNotFound",S.PivotInError="PivotInError",S.EmptyName="EmptyName",S.ValueCellIsInvalidFormula="ValueCellIsInvalidFormula",S.InvalidDefinition="InvalidDefinition",S.InvalidColor="InvalidColor",S.InvalidPivotDataSet="InvalidPivotDataSet",S.InvalidPivotCustomField="InvalidPivotCustomField",S.MissingFigureArguments="MissingFigureArguments",S.InvalidCarouselItem="InvalidCarouselItem";const C=new Set(["containsText","notContainsText","isGreaterThan","isGreaterOrEqualTo","isLessThan","isLessOrEqualTo","isBetween","isNotBetween","beginsWithText","endsWithText","isNotEmpty","isEmpty","isNotEqual","isEqual","customFormula"]),y=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"]),w=[{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:";"}],I=w[0],x=["thin","medium","thick","dashed","dotted"];function E(e){return Array.isArray(e)&&Array.isArray(e[0])}var R;!function(e){e.UP="up",e.DOWN="down",e.LEFT="left",e.RIGHT="right"}(R||(R={}));const T=.5,A="#017E84",D="#f5f5f5",_="#F8F9FA",F="#E8EAED",O="#595959",P="#666666",M="#c9ccd2",N="#3266ca",k="#FFFFFF",L="#CACACA",V=11982760,U=A,H="#188038",z="#E0E2E4",B="#4A4F59",$="#999",G="#E2E3E3",W="#BCBCBC",q="#9B359B",Z="#00000000",j="#4EA7F2",Y="#EA6175",X="#AAAAAA",K="#111827",J="#D8DADD",Q="#E7E9ED",ee="#F9FAFB",te="#374151",oe=te+"C2",se="#111827",ie="#714B67",ne=Q,re=J,ae="#111827",le="#e6f2f3",ce="#111827",he=A,de="#D44C591A",ue="#C34A41",ge="#98DBE2",pe="#E6F2F3",me=20,fe=10,ve=15,be=16,Se=12,Ce="#F28C28",ye=["#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"],we=26,Ie=48,xe=96,Ee=23,Re=15,Te=4,Ae=3,De=Te,_e=21,Fe=2*Ee,Oe={align:"left",verticalAlign:"bottom",wrapping:"overflow",bold:!1,italic:!1,strikethrough:!1,underline:!1,fontSize:10,fillColor:"",textColor:""},Pe=Oe.verticalAlign,Me=Oe.wrapping,Ne="400",ke=Oe.fontSize,Le="'Roboto', arial",Ve="thin",Ue="#000000",He="START_REVISION",ze=1,Be=20,$e="??",Ge="difference",We="#43C5B1",qe="#EA6175",Ze=.4,je=3,Ye=2,Xe=["'","*","?","/","\\","[","]"],Ke=/'|\*|\?|\/|\\|\[|\]/,Je="|";var Qe;!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"}(Qe||(Qe={}));let et=0;function tt(){return et}const ot="\n",st=[6,7,8,9,10,11,12,14,18,24,36],it={hasFilters:!1,totalRow:!1,firstColumn:!0,lastColumn:!1,numberOfHeaders:1,bandedRows:!0,bandedColumns:!1,styleId:"TableStyleMedium5",automaticAutofill:!1},nt=1e5,rt={symbol:"$",position:"before",decimalPlaces:2,code:"",name:"Dollar"},at={fontSize:be,color:te},lt="#000000",ct="#3da4ab",ht={OPERATOR:ct,NUMBER:"#02c39a",STRING:"#00a82d",FUNCTION:lt,DEBUGGER:ct,LEFT_PAREN:lt,RIGHT_PAREN:lt,ARG_SEPARATOR:lt,ORPHAN_RIGHT_PAREN:"#ff0000"},dt=new RegExp(Ke,"g");function ut(e){return'"'===e[0]&&(e=e.slice(1)),'"'===e[e.length-1]&&"\\"!==e[e.length-2]?e.slice(0,e.length-1):e}function gt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function pt(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]=pt(e[o]));else for(const o in e)t[o]=pt(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 mt(e){return ft(e,"'")}function ft(e,t='"'){return e.startsWith(t)&&(e=e.slice(1)),e.endsWith(t)&&(e=e.slice(0,-1)),e}function vt(e){return e.match(/\w/g)?.length!==e.length&&(e=`'${e}'`),e}function bt(e,t=" "){return e.replace(dt,t)}function St(e,t,o){return e<t?t:e>o?o:e}function Ct(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 yt(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*wt(e,t){t.next();for(const o of e){const e=t.next();yield{...o,next:e.done?void 0:e.value}}}function It(e){const t=e.toUpperCase();return"TRUE"===t||"FALSE"===t}const xt=/^\[(.+)\]\((.+)\)$/,Et=/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$/;function Rt(e){return xt.test(e)}function Tt(e){return Et.test(e)}function At(e,t){return`[${e}](${t})`}function Dt(e){const t=e.match(xt)||[],o=t[1],s=t[2];if(!o||!s)throw new Error(`Could not parse markdown link ${e}.`);return{label:o,url:s}}const _t="o-spreadsheet://";function Ft(e){return e.startsWith(_t)}function Ot(e){return`${_t}${e}`}function Pt(e){if(e.startsWith(_t))return e.slice(_t.length);throw new Error(`${e} is not a valid sheet link`)}function Mt(e){return void 0!==e}function Nt(e){return void 0===e||Object.values(e).every((e=>"object"==typeof e?Nt(e):!e))}function kt(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 Lt(e){let t="";for(let o=0,s=e.length;o<s;o++)t+=e[o];return t}function Vt(e){let t,o=!1;const s=()=>(o||(t=e instanceof Function?e():e,o=!0),t);return s.map=e=>Vt((()=>e(s()))),s}function Ut(e,t){let o=e.slice(t).find((e=>e));return o||(o=e.slice(0,t).reverse().find((e=>e))),o||""}function Ht(e,t){return"after"===e?t+1:t}function zt(...e){if(e.length<=1)return!0;for(let t=1;t<e.length;t++)if(!Bt(e[0],e[t]))return!1;return!0}function Bt(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(!Bt(e[o],t[o]))return!1}else if(e[o]!==t[o])return!1}return!0}function $t(e,t){if(e.length!==t.length)return!1;for(let o=0;o<e.length;o++)if(!zt(e[o],t[o]))return!1;return!0}function Gt(e,t){if(e.length<t.length)return!1;const o=new Set(e);return t.every((e=>o.has(e)))}function Wt(e){if(!e)return e;const t={...e};return Object.keys(t).forEach((e=>!t[e]&&delete t[e])),t}const qt=["\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))],Zt=new RegExp(qt.join("|"),"g"),jt=/(\r\n|\r)/g,Yt=qt.concat([" "]);function Xt(e){return e?e.replace(jt,ot):""}function Kt(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 Jt(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 Qt(e,t){const o=new Set(t),s=[];for(let t=0;t<e.length;t++)o.has(t)||s.push(e[t]);return s}function eo(e,t,o){const s=[...e];return s.splice(o,0,...t),s}function to(e,t,o){const s=[...e];return s[o]=t,s}function oo(e){return e.split("\n").map((e=>e.replace(/\s+/g," ").trim())).join("\n")}function so(e,t,o){return t>o?so(e,o,t):e>=t&&e<=o}function io(e,t){let o=gt(e);const s=t.matchCase?"":"i";return t.exactMatch&&(o=`^${o}$`),RegExp(o,s)}function no(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 ro(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 ao{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 lo(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 co(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 ho(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 uo(e){return e.startsWith("=")||e.startsWith("+")}const go={Background:0,Highlights:1,Clipboard:2,Chart:4,Autofill:5,Selection:6,Headers:100},po=Jt((()=>Object.keys(go).sort(((e,t)=>go[e]-go[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 mo=["containsText","notContainsText","isEqualText","isEmpty","isNotEmpty","beginsWithText","endsWithText"],fo=["isEqual","isNotEqual","isGreaterThan","isGreaterOrEqualTo","isLessThan","isLessOrEqualTo","isBetween","isNotBetween","isEmpty","isNotEmpty"],vo=["dateIs","dateIsBefore","dateIsOnOrBefore","dateIsAfter","dateIsOnOrAfter","dateIsBetween","dateIsNotBetween","isEmpty","isNotEmpty"],bo=["image/avif","image/bmp","image/gif","image/vnd.microsoft.icon","image/jpeg","image/png","image/tiff","image/webp"];function So(e){if(e<0)throw new Error(`number must be positive. Got ${e}`);return e<26?String.fromCharCode(65+e):So(Math.floor(e/26)-1)+So(e%26)}function Co(e){let t=0;const o=e.length;for(let s=0;s<o;s++){t=26*t+yo(e[s])}return t-1}function yo(e){const t=e.charCodeAt(0);return t>=65&&t<=90?t-64:t-96}function wo(e){return e>="A"&&e<="Z"||e>="a"&&e<="z"}function Io(e){return e>="0"&&e<="9"}const xo=Co("ZZZ"),Eo=9999998;function Ro(e){for(;" "===e.current;)e.advanceBy(1)}function To(e){if("$"===e.current&&e.advanceBy(1),!e.current||!wo(e.current))return-1;let t=0;for(;e.current&&wo(e.current);)t=26*t+yo(e.shift());return t}function Ao(e){if("$"===e.current&&e.advanceBy(1),!e.current||!Io(e.current))return-1;let t=0;for(;e.current&&Io(e.current);)t=10*t+Number(e.shift());return t}function Do(e){const t=new ao(e);Ro(t);const o=To(t);if(-1===o||!t.current)throw new Error(`Invalid cell description: ${e}`);const s=Ao(t);Ro(t);const i=o-1,n=s-1;if(!t.isOver()||i>xo||n>Eo)throw new Error(`Invalid cell description: ${e}`);return{col:i,row:n}}function _o(e,t,o={colFixed:!1,rowFixed:!1}){return(o.colFixed?"$":"")+So(e)+(o.rowFixed?"$":"")+String(t+1)}function Fo(e,t=[]){if(e.length<=1&&0===t.length)return e;const o=[0],s=new Map([[0,[]]]);return Oo(o,s,e,!1),Oo(o,s,t,!0),function(e,t){const o=[];let s=[];for(let i=0;i<e.length;i++){const n=e[i],r=t.get(n);if(!r||0===r.length){o.push(...s),s=[];continue}let a=e[i+1];void 0!==a&&a--;const l=[];for(let e=0;e<r.length;e+=2){const t=r[e];let o=r[e+1];void 0!==o&&o--;const i={top:t,left:n,bottom:o,right:a,hasHeader:void 0===o&&0!==t||void 0===a&&0!==n};let c=!1;for(let e=s.length-1;e>=0;e--){const t=s[e];if(t.top===i.top&&t.bottom===i.bottom){t.right=i.right,s.splice(e,1),l.push(t),c=!0;break}}c||l.push(i)}o.push(...s),s=l}return o.push(...s),o}(o,s)}function Oo(e,t,o,s=!1){for(const i of o){const o=i.left,n=void 0===i.right?void 0:i.right+1,r=Po(e,t,o,!0,0),a=Po(e,t,n,!1,r);for(let o=r;o<=a;o++){Mo(t.get(e[o]),i,s)}No(e,t,r,a)}}function Po(e,t,o,s,i){if(void 0===o)return e.length-1;const n=ko(e,o,i);return o!==e[n]?(e.splice(n+1,0,o),t.set(o,[...t.get(e[n])]),s?n+1:n):s?n:n-1}function Mo(e,t,o=!1){const s=t.top,i=void 0===t.bottom?void 0:t.bottom+1,n=[],r=ko(e,s,0,!1);if((r%2!=0&&!o||r%2==0&&o)&&n.push(s),void 0===i)return e.splice(r+1),void e.push(...n);const a=function(e,t,o=0,s=!0){let i=e.length-1,n=e.length;for(;o<=i;){const r=Math.floor((o+i)/2);if(e[r]===t&&s)return r;e[r]>t?(n=r,i=r-1):o=r+1}return n}(e,i,0,!1);(a%2==0&&!o||a%2!=0&&o)&&n.push(i),e.splice(r+1,a-r-1,...n)}function No(e,t,o,s){const i=o-1==-1?0:o-1;for(let o=s===e.length-1?s:s+1;o>i;o--)$t(t.get(e[o]),t.get(e[o-1]))&&(t.delete(e[o]),e.splice(o,1))}function ko(e,t,o=0,s=!0){let i=e.length-1,n=-1;for(;o<=i;){const r=Math.floor((o+i)/2);if(e[r]===t&&s)return r;e[r]<t?(n=r,o=r+1):i=r-1}return n}function Lo(e){const t=function(e){const t=new ao(e);Ro(t);const o=e.indexOf("!");-1!==o&&t.advanceBy(o+1);const s=To(t),i=Ao(t);let n,r,a,l,c=!1,h=!1,d=!1;if(-1===i?(a=l=s-1,n=r=0,c=!0):-1===s?(n=r=i-1,a=l=0,h=!0):(a=l=s-1,n=r=i-1,d=!0),Ro(t),":"===t.current){t.advanceBy(1),Ro(t);const e=To(t),o=Ao(t);-1===o?(l=e-1,c=!0):-1===e?(r=o-1,h=!0):(l=e-1,r=o-1,n=c?r:n,a=h?l:a,d=!0)}const u={top:n,left:a,bottom:c?void 0:r,right:h?void 0:l};return d=d&&(h||c),d&&(u.hasHeader=d),u}(e),o=ns(t),s=o.bottom,i=o.right;if(void 0!==s&&s>Eo||void 0!==i&&i>xo)throw new Error(`Range string out of bounds: ${e}`);if(void 0===s&&void 0===i)throw new Error("Wrong zone xc. The zone cannot be at the same time a full column and a full row");return o}function Vo(e){const t=Lo(e);if(void 0===t.bottom||void 0===t.right)throw new Error("This does not support unbounded ranges");return t}function Uo(e){try{return function(e){return Ho(Lo(e))}(e)}catch(e){return!1}}function Ho(e){const{bottom:t,top:o,left:s,right:i}=e;return!(void 0!==t&&isNaN(t)||isNaN(o)||isNaN(s)||void 0!==i&&isNaN(i))&&(zo(e)&&e.top>=0&&e.left>=0)}function zo(e){return(void 0===e.bottom||e.bottom>=e.top&&e.bottom>=0)&&(void 0===e.right||e.right>=e.left&&e.right>=0)}function Bo(e){const{top:t,bottom:o,left:s,right:i}=e,n="hasHeader"in e&&e.hasHeader,r=t===o&&s===i;if(void 0===o&&void 0!==i)return 0!==t||n?`${_o(s,t)}:${So(i)}`:`${So(s)}:${So(i)}`;if(void 0===i&&void 0!==o)return 0!==s||n?`${_o(s,t)}:${o+1}`:`${t+1}:${o+1}`;if(void 0!==o&&void 0!==i)return r?_o(s,t):`${_o(s,t)}:${_o(i,o)}`;throw new Error("Bad zone format")}function $o(e,t,o,s,i){const n="left"===t?"columns":"rows",r="before"===s?o-1:o,a=e["left"===t?"right":"bottom"];return e[t]<=r&&a&&a>r?rs(e,n,"RESIZE",i):r<e[t]?rs(e,n,"MOVE",i):{...e}}function Go(e,t,o,s,i){const n="left"===t?"columns":"rows",r="before"===s?o-1:o,a="left"===t?"right":"bottom";return e[t]<=r&&e[a]>r?rs(e,n,"RESIZE",i):r<e[t]?rs(e,n,"MOVE",i):{...e}}function Wo(e,t,o){const s="left"===t?"right":"bottom";let i=e[t],n=e[s];for(const r of o.sort(((e,t)=>t-e)))e[t]>r&&(i--,n--),e[t]<r&&e[s]>=r&&n--;return{...e,[t]:i,[s]:n}}function qo(e,t,o){const s="left"===t?"right":"bottom";let i=e[t],n=e[s];const r=e[s];for(const s of o.sort(((e,t)=>t-e)))e[t]>s&&(i--,void 0!==n&&n--),void 0!==r&&void 0!==n&&e[t]<=s&&r>=s&&n--;if(!(void 0!==n&&i>n))return{...e,[t]:i,[s]:n}}function Zo(...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 jo(e,t){if(Ko(e,t))return{top:Math.max(e.top,t.top),left:Math.max(e.left,t.left),bottom:void 0!==e.bottom?Math.min(e.bottom,t.bottom):e.bottom??t.bottom,right:void 0!==e.right?Math.min(e.right,t.right):e.right??t.right}}function Yo(e,t){return e.left===t.left&&e.right===t.right&&e.top===t.top&&e.bottom===t.bottom&&e.hasHeader===t.hasHeader}function Xo(e,t){if(jo(e,t))return;let o;return e.left===t.right+1&&(o={position:"left",start:Math.max(e.top,t.top),stop:void 0!==e.bottom?Math.min(e.bottom,t.bottom):t.bottom}),void 0!==e.right&&e.right+1===t.left&&(o={position:"right",start:Math.max(e.top,t.top),stop:void 0!==e.bottom?Math.min(e.bottom,t.bottom):t.bottom}),e.top===t.bottom+1&&(o={position:"top",start:Math.max(e.left,t.left),stop:void 0!==e.right?Math.min(e.right,t.right):t.right}),void 0!==e.bottom&&e.bottom+1===t.top&&(o={position:"bottom",start:Math.max(e.left,t.left),stop:void 0!==e.right?Math.min(e.right,t.right):t.right}),o&&o.start<=o.stop?o:void 0}function Ko(e,t){return!(void 0!==e.bottom&&e.bottom<t.top||void 0!==t.bottom&&t.bottom<e.top)&&!(void 0!==e.right&&e.right<t.left||void 0!==t.right&&t.right<e.left)}function Jo(e,t,o){const{left:s,right:i,top:n,bottom:r}=o;return e>=s&&e<=i&&t>=n&&t<=r}function Qo(e,t){return Yo(Zo(t,e),t)}function es(e){return{numberOfRows:e.bottom-e.top+1,numberOfCols:e.right-e.left+1}}function ts(e){const{numberOfCols:t,numberOfRows:o}=es(e);return 1===t||1===o}function os(e){const t={};for(const o of e)t[o.sheetId]??=[],t[o.sheetId].push(ls(o));for(const e in t)t[e]=Fo(t[e]);return t}function ss(e){const t=[],{left:o,right:s,top:i,bottom:n}=ns(e);for(const e of Ct(o,s+1))for(const o of Ct(i,n+1))t.push({col:e,row:o});return t}function is(e,t){const o=[],{left:s,right:i,top:n,bottom:r}=ns(t);for(const t of Ct(s,i+1))for(const s of Ct(n,r+1))o.push({sheetId:e,col:t,row:s});return o}function ns(e){return void 0!==e.right&&e.left>e.right&&(e={...e,left:e.right,right:e.left}),void 0!==e.bottom&&e.top>e.bottom&&(e={...e,top:e.bottom,bottom:e.top}),e}function rs(e,t,o,s){const i="both"===t?s[0]:"columns"===t?s:0,n="both"===t?s[1]:"rows"===t?s:0,r="hasHeader"in e&&e.hasHeader;let a;a=ds(e)&&!r?"rows"!==t:!(hs(e)&&!r)||"columns"!==t;const l={...e};return a&&"MOVE"===o&&(l.left+=i,l.top+=n),void 0!==l.right&&(l.right+=i),void 0!==l.bottom&&(l.bottom+=n),l}function as(e,t){let o,s;const{left:i,right:n,top:r,bottom:a}=e,{left:l,right:c,top:h,bottom:d}=t;return o=l!==i?l:c!==n?c:l,s=h!==r?h:d!==a?d:h,{col:o,row:s}}function ls(e){return{left:e.col,right:e.col,top:e.row,bottom:e.row}}function cs(e){return{...e,right:e.left,bottom:e.top}}function hs(e){return void 0===e.right}function ds(e){return void 0===e.bottom}function us(e){return(e.bottom-e.top+1)*(e.right-e.left+1)}function gs(e,t,o){return e.some((e=>function(e,t,o){return e.left<t&&t<=e.right||e.top<o&&o<=e.bottom}(e,t,o)))}function ps(e){return e.length<2||1===Fo(e).length}function ms(e){const t=[...e];let o=!0;for(;o;){o=!1;for(let e=0;e<t.length;e++){const s=t[e],i=t.findIndex(((t,o)=>{return e!==o&&(n=s,((i=t).right+1===n.left||i.left===n.right+1?i.top<=n.bottom&&i.top>=n.top||n.top<=i.bottom&&n.top>=i.top:(i.bottom+1===n.top||i.top===n.bottom+1)&&(i.left<=n.right&&i.left>=n.left||n.left<=i.right&&n.left>=i.left))||Ko(t,s));var i,n}));if(-1!==i){t[e]=Zo(t[i],s),t.splice(i,1),o=!0;break}}}return t}function fs(e,t){const o=Xo(e,t);if(!o)return[e];const s=[];switch(o.position){case"bottom":case"top":return s.push({top:e.top,bottom:e.bottom,left:o.start,right:o.stop}),o.start>e.left&&s.push({top:e.top,bottom:e.bottom,left:e.left,right:o.start-1}),(void 0===e.right||o.stop<e.right)&&s.push({top:e.top,bottom:e.bottom,left:o.stop+1,right:e.right}),s;case"left":case"right":return s.push({top:o.start,bottom:o.stop,left:e.left,right:e.right}),o.start>e.top&&s.push({top:e.top,bottom:o.start-1,left:e.left,right:e.right}),(void 0===e.bottom||o.stop<e.bottom)&&s.push({top:o.stop+1,bottom:e.bottom,left:e.left,right:e.right}),s}}function vs(e,t){const o=new Set(t.map((e=>e.left))),s=new Set(t.map((e=>e.right))),i=new Set(t.map((e=>e.top))),n=new Set(t.map((e=>e.bottom))),r=1===i.size&&1===n.size||1===o.size&&1===s.size?function(e){return e.reduce(((e,t)=>{const o=e.length;for(let s=0;s<o;s++)if(Ko(e[s],t))return e[s]=Zo(e[s],t),e;return e[o]=t,e}),[])}(t):[t[t.length-1]],a=r.map((e=>ss(e))).flat();return{sheetId:e,zones:t,clippedZones:r,columnsIndexes:[...new Set(a.map((e=>e.col)))].sort(((e,t)=>e-t)),rowsIndexes:[...new Set(a.map((e=>e.row)))].sort(((e,t)=>e-t))}}function bs(e,t,o){const s=Math.max(e.right-t+1,e.left),i=Math.max(e.bottom-o+1,e.top),n=[];for(let r=e.left;r<=s;r+=t)for(let s=e.top;s<=i;s+=o)n.push({left:r,top:s,bottom:s+o-1,right:r+t-1});return n}function Ss(e,t){if(!t.length||!t[0].length)return e;const o=t[0].length,s=t.length;return e.map((e=>bs(e,o,s))).flat()}function Cs(e){let t;if(e[a.Html]){t=function(e){const t=[...e.documentElement.attributes];if(t.some((e=>e.value.includes("microsoft"))))return;const o=e.querySelector("div")?.getAttribute("data-osheet-clipboard");return o&&JSON.parse(o)}((new DOMParser).parseFromString(e[a.Html],"text/html"))}const o=e[a.PlainText]||"";let s;if(!o.trim())for(const t of bo)if(e[t]){s=e[t];break}return{text:o,data:t,imageBlob:s}}const ys=(e,t,o,s)=>{e.forEach((({handlerName:e,handler:i})=>{const n=t[e];n&&i.paste(o,n,s)}))};function ws(e,t,o,s,i){let n;const r=[],a={sheetId:e,zones:t};for(const{handlerName:l,handler:c}of s){const s=o[l];if(!s)continue;const h=c.getPasteTarget(e,t,s,i);h.figureId&&(a.figureId=h.figureId);for(const e of h.zones)r.push(e),n=void 0!==n?Zo(n,e):e}return{target:a,zone:n,selectedZones:r}}const Is=(e,t,o)=>{const s={col:t[0].left,row:t[0].top};e.getBackToDefault(),e.selectZone({cell:s,zone:Zo(...o)},{scrollIntoView:!1})},xs=/rgba?\(|\s+|\)/gi,Es=/^#([A-F\d]{2}){3,4}$/,Rs=["#eb6d00","#0074d9","#ad8e00","#169ed4","#b10dc9","#00a82d","#00a3a3","#f012be","#3d9970","#111111","#62A300","#ff4136","#949494","#85144b","#001f3f"];function Ts(e,t=1){const o=1!==t?Math.round(255*t).toString(16).padStart(2,"0"):"";return Ds(e.toString(16).padStart(6,"0"))+o}function As(e){return"number"==typeof e?e:Number.parseInt(Ds(e).slice(1,7),16)}function Ds(e){let t=e;if(e.startsWith("rgb")?t=function(e){const t=e.replace(xs,"").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"#"+Lt(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}`),!Es.test(t))throw new Error(`invalid color input: ${e}`);return t}function _s(e){try{return Ds(e),!0}catch(e){return!1}}const Fs=e=>e>=0&&e<=255;function Os(e,t,o,s=1){if(!Fs(e)||!Fs(t)||!Fs(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 Ps(e){let{r:t,g:o,b:s}=Ns(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 Ms(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 Ns(e){let t,o,s,i;if(7===(e=Ds(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 ks(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 Ls(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 Vs(e){return Ms(ks(e))}function Us(e){return Ls(Ns(e))}function Hs(e){return Ns("number"==typeof e?Ts(e):e)}function zs(e,t){return 1===t?Ds(e).slice(0,7):Ms({...Ns(e),a:t})}function Bs(e,t){const o=Us(e);return 1===t?"#fff":(o.l=t*(100-o.l)+o.l,Vs(o))}function $s(e,t){const o=Us(e);return 1===t?"#000":(o.s=Math.min(100,t*o.s+o.s),o.l=o.l-t*o.l,Vs(o))}function Gs(e){return Ps(e)<.6?Bs(e,.9):$s(e,.75)}const Ws=["#4EA7F2","#EA6175","#43C5B1","#F4A261","#8481DD","#FFD86D"],qs=["#4EA7F2","#3188E6","#43C5B1","#00A78D","#EA6175","#CE4257","#F4A261","#F48935","#8481DD","#5752D1","#FFD86D","#FFBC2C"],Zs=["#4EA7F2","#3188E6","#056BD9","#A76DBC","#7F4295","#6D2387","#EA6175","#CE4257","#982738","#43C5B1","#00A78D","#0E8270","#F4A261","#F48935","#BE5D10","#8481DD","#5752D1","#3A3580","#A4A8B6","#7E8290","#545B70","#FFD86D","#FFBC2C","#C08A16"],js=["#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"],Ys=["#4EA7F2","#43C5B1","#EA6175","#F4A261","#8481DD","#FFD86D","#3188E6","#00A78D","#CE4257","#F48935","#5752D1","#FFBC2C"],Xs=["#4EA7F2","#A76DBC","#EA6175","#43C5B1","#F4A261","#8481DD","#A4A8B6","#FFD86D","#3188E6","#7F4295","#CE4257","#00A78D","#F48935","#5752D1","#7E8290","#FFBC2C","#056BD9","#6D2387","#982738","#0E8270","#BE5D10","#3A3580","#545B70","#C08A16"],Ks=["#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 Js(e,t){return t[e%t.length]}function Qs(e){return e<=6?Ws:e<=12?qs:e<=24?Zs:js}class ei{preferredColors;currentColorIndex=0;palette;constructor(e,t=[]){this.preferredColors=t,this.palette=Qs(e).filter((e=>!t.includes(e)))}next(){return this.preferredColors?.[this.currentColorIndex]?this.preferredColors[this.currentColorIndex++]:Js(this.currentColorIndex++,this.palette)}}class ti extends ei{constructor(e,t=[]){var o;super(e,t),this.palette=(o=e,o<=6?Ws:o<=12?Ys:o<=24?Xs:Ks).filter((e=>!t.includes(e)))}}class oi{availableColors;colors={};constructor(e=12){this.availableColors=new ti(e)}get(e){return this.colors[e]||(this.colors[e]=this.availableColors.next()),this.colors[e]}}function si(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=Hs(t[e-1].color).a,i=Hs(t[e].color).a,n=As(t[e-1].color),r=As(t[e].color);o.push({min:t[e-1].value,max:t[e].value,minColor:n,maxColor:r,minColorAlpha:s,maxColorAlpha:i,colorDiff:ii(t[e-1].value,t[e].value,n,r)})}return e=>{if(e<o[0].min)return Ts(o[0].minColor,o[0].minColorAlpha);for(const t of o)if(e>=t.min&&e<=t.max)return Ts(ni(e,t.min,t.minColor,t.colorDiff),t.maxColorAlpha);return Ts(o[o.length-1].maxColor,o[o.length-1].maxColorAlpha)}}function ii(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 ni(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))}const ri=e=>e,ai=()=>!1;let li=ri,ci=ai;function hi(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 di=function(e,...t){return ci()?hi(li(e),...t):new ui(e,t)};class ui extends String{values;constructor(e,t){super(e),this.values=t}valueOf(){const e=super.valueOf();return ci()?hi(li(e),...this.values):hi(e,...this.values)}toString(){return this.valueOf()}}function gi(e){return/^https?:\/\//i.test(e)?e:`https://${e}`}const pi=new n;function mi(e,t){return{url:e=gi(e),label:t||e,isExternal:!0,isUrlEditable:!0}}pi.add("sheet_URL",{match:e=>Ft(e),createLink:(e,t)=>({label:t,url:e,isExternal:!1,isUrlEditable:!1}),urlRepresentation(e,t){const o=Pt(e);return t.tryGetSheetName(o)||di("Invalid sheet")},open(e,t){const o=Pt(e);t.model.dispatch("ACTIVATE_SHEET",{sheetIdFrom:t.model.getters.getActiveSheetId(),sheetIdTo:o}).isCancelledBecause("SheetIsHidden")&&t.notifyUser({type:"warning",sticky:!1,text:di("Cannot open the link because the linked sheet is hidden.")})},sequence:0});const fi={createLink:mi,match:e=>Tt(e),open:e=>window.open(e,"_blank"),urlRepresentation:e=>e,sequence:0};function vi(e){return pi.getAll().sort(((e,t)=>e.sequence-t.sequence)).find((t=>t.match(e)))||fi}function bi(e,t){return vi(e.url).urlRepresentation(e.url,t)}function Si(e,t,o){vi(e.url).open(e.url,t,o)}function Ci(e){if("string"==typeof e){if(Rt(e)){const{label:t,url:o}=Dt(e);return vi(o).createLink(o,t)}return Tt(e)?mi(e):void 0}}class yi{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 yi(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds())}static now(){const e=new Date;return new yi(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 wi=new yi(1899,11,30),Ii=864e5,xi=2e3,Ei=yi.now().getFullYear(),Ri=yi.now().getMonth(),Ti=yi.fromTimestamp(0).getTime()-wi.getTime(),Ai=/^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/,Di=/^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/,_i=Yt.join(""),Fi=new RegExp(`/|-|${Yt.join("|")}`),Oi=new RegExp(`^(\\d{1,4})[/${_i}-](\\d{1,4})([/${_i}-](\\d{1,4}))?$`),Pi=/((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;function Mi(e,t){switch(typeof e){case"number":return e;case"string":return Ni(e,t)?Li(e,t)?.value:!e||isNaN(Number(e))?void 0:Number(e);default:return}}function Ni(e,t){return null!==Li(e,t)}const ki=new Map;function Li(e,t){return ki.has(t)||ki.set(t,new Map),ki.get(t).has(e)||ki.get(t).set(e,function(e,t){e=e.trim();let o=null;const s=e.match(Pi);if(s){if(o=function(e){if(e=e.trim(),Pi.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 yi(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(Oi);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(Fi)[0];if(i=function(e,t){const{year:o,month:s,day:i}=e,n=function(e){if(!e)return Ri;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 Ei;const t=Number(e);switch(e.length){case 1:return xi+t;case 2:return xi+(xi+t>Ei+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 yi(a,n,r);if(h.getMonth()!==n||h.getDate()!==r)return null;const d=h.getTime()-wi.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(Mt).join(t);case"ymd":return[i,n,r].filter(Mt).join(t);case"dmy":return[r,n,i].filter(Mt).join(t)}}(e,t,l,c);return{value:Math.round(d/Ii),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 yi(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)),ki.get(t).get(e)}function Vi(e){const t=Math.trunc(e),o=yi.fromTimestamp(t*Ii-Ti);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 Ui(e){return Math.round(Hi(e))}function Hi(e){return(e.getTime()-wi.getTime())/Ii}function zi(e){return new yi(e.getFullYear(),e.getMonth()+1,0).getDate()}function Bi(e){return zi(e)===e.getDate()}function $i(e,t,o){const s=e.getFullYear(),i=e.getMonth(),n=e.getDate(),r=new yi(s,i+t,1);return o&&n===zi(e)||n>zi(r)?r.setDate(zi(r)):r.setDate(n),r}function Gi(e){const t=Math.trunc(e);return t%4==0&&t%100!=0||t%400==0}function Wi(e,t,o){if(e===t)return 0;if(e>t){const o=t;t=e,e=o}const s=Vi(e),i=Vi(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===(Gi(c)?29:28)&&(n=30,1===l&&r===(Gi(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+=Gi(o)?366:365;o=t/e}else s?Gi(c)&&(o=366):(Gi(c)&&a<2&&(o=366),Gi(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 qi(e,t){const o=12*(t.getFullYear()-e.getFullYear())+t.getMonth()-e.getMonth();return e.getDate()>t.getDate()?o-1:o}function Zi(e,t){const o=e.getTime(),s=t.getTime();return Math.floor((s-o)/Ii)}function ji(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 Yi(e,t,o){return t>o?Yi(e,o,t):(e=Math.trunc(e),t=Math.trunc(t),o=Math.trunc(o),e>=t&&e<=o)}const Xi=Jt((function(e){return e=gt(e),new RegExp(`(?:^-?\\d+(?:${e}?\\d*(?:e(\\+|-)?\\d+)?)?|^-?${e}\\d+)(?!\\w|!)`)})),Ki=Jt((function(e){const t=gt(e.decimalSeparator),o="(?:\\s*"+`(?:\\d+(?:${gt(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 Ji(e,t){return!!e&&Ki(t).test(e.trim())}const Qi=Jt((function(e){return new RegExp(`[$€${gt(e.thousandsSeparator||"")}]`,"g")}));function en(e,t){e=e.replace(Qi(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 tn(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)}const on={NotAvailable:"#N/A",InvalidReference:"#REF",BadExpression:"#BAD_EXPR",CircularDependency:"#CYCLE",UnknownFunction:"#NAME?",DivisionByZero:"#DIV/0!",SpilledBlocked:"#SPILL!",GenericError:"#ERROR",NullError:"#NULL!"},sn=new Set(Object.values(on));class nn{message;value;constructor(e=di("Error"),t=on.GenericError){this.message=e,this.value=t,this.message=e.toString()}}class rn extends nn{constructor(e=di("Invalid expression")){super(e,on.BadExpression)}}class an extends nn{constructor(e=di("Circular reference")){super(e,on.CircularDependency)}}class ln extends nn{constructor(e=di("Invalid reference")){super(e,on.InvalidReference)}}class cn extends nn{constructor(e=di("Data not available")){super(e,on.NotAvailable)}}class hn extends nn{constructor(e=di("Unknown function")){super(e,on.UnknownFunction)}}class dn extends nn{constructor(e=di("Spill range is not empty")){super(e,on.SpilledBlocked)}}class un extends nn{constructor(e=di("Division by zero")){super(e,on.DivisionByZero)}}const gn=["number","string","boolean","undefined"];function pn(e){if(void 0!==e)return E(e)?e[0][0]?.format:e.format}function mn(e){return"string"==typeof e&&sn.has(e)}function fn(e){return{value:on.NotAvailable,message:di("Did not find value '%s' in [[FUNCTION_NAME]] evaluation.",xn(e))}}const vn=e=>di("The function [[FUNCTION_NAME]] expects a number value, but '%s' is a string, and cannot be coerced to a number.",e);function bn(e,t){const o=Dn(e);switch(typeof o){case"number":return o;case"boolean":return o?1:0;case"string":if(Ji(o,t)||""===o)return en(o,t);const e=Li(o,t);if(e)return e.value;throw new nn(vn(o));default:return 0}}function Sn(e,t){try{return bn(e,t)}catch(e){return}}function Cn(e,t){return Xn(e).map((e=>e.map((e=>{if("number"!=typeof e.value)throw new nn(di("Function [[FUNCTION_NAME]] expects number values for %s, but got a %s.",t,typeof e.value));return e.value}))))}function yn(e,t){const o=Dn(e);if(""===o)throw new nn(vn(o));return bn(o,t)}function wn(e,t){return Math.trunc(bn(e,t))}function In(e,t){return Math.trunc(yn(e,t))}function xn(e){const t=Dn(e);switch(typeof t){case"string":return t;case"number":return t.toString();case"boolean":return t?"TRUE":"FALSE";default:return""}}const En=Jt((function(e){return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"")})),Rn=e=>di("The function [[FUNCTION_NAME]] expects a boolean value, b