@univerjs/core 0.1.15 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +8 -8
- package/lib/es/index.js +1877 -2049
- package/lib/types/services/instance/instance.service.d.ts +11 -4
- package/lib/types/services/permission/permission.service.d.ts +5 -4
- package/lib/types/services/permission/type.d.ts +3 -2
- package/lib/types/shared/common.d.ts +2 -1
- package/lib/types/shared/rectangle.d.ts +3 -12
- package/lib/types/sheets/workbook.d.ts +6 -52
- package/lib/types/types/interfaces/i-cell-data.d.ts +4 -0
- package/lib/types/types/interfaces/i-range.d.ts +8 -0
- package/lib/umd/index.js +8 -8
- package/package.json +4 -4
package/lib/cjs/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";var Eo=Object.defineProperty;var Ro=(t,e,n)=>e in t?Eo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var _=(t,e,n)=>(Ro(t,typeof e!="symbol"?e+"":e,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ot=require("rxjs"),cn=require("rxjs/operators"),ut=require("@wendellhu/redi");function Co(t,e){for(var n=0;n<e.length;n++){const s=e[n];if(typeof s!="string"&&!Array.isArray(s)){for(const r in s)if(r!=="default"&&!(r in t)){const i=Object.getOwnPropertyDescriptor(s,r);i&&Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:()=>s[r]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}function Io(){Oo()}const rn=typeof global<"u"?global:typeof self<"u"?self:window;function Oo(){typeof rn.requestIdleCallback!="function"&&(rn.requestIdleCallback=function(n){const s=Date.now();return setTimeout(function(){const i=Math.max(0,50-(Date.now()-s));n({didTimeout:i===0,timeRemaining(){return i}})},1)}),typeof rn.cancelIdleCallback!="function"&&(rn.cancelIdleCallback=function(n){clearTimeout(n)})}const So="__default_document_sub_component_id20231101__",Fe=2,qs=1;function No(t,e){if(e==null||t==null)return!0;const{left:n=0,top:s=0,height:r=0,width:i=0,angle:o=0}=e,{left:l=0,top:a=0,height:h=0,width:c=0,angle:u=0}=t,d=c,f=h,m=i,p=r;return Math.abs(l-n)>Fe||Math.abs(a-s)>Fe||Math.abs(d-m)>Fe||Math.abs(f-p)>Fe||Math.abs(u-o)>qs}function Js(t,e){let n=0,s=t.length-1;for(;n<=s;){const r=Math.floor((s+n)/2);if(e<t[r]&&(r===0||e>=t[r-1]))return r;if(e>=t[r])n=r+1;else if(e<t[r])s=r-1;else return-1}return-1}function Zs(t,e){let n=0,s=0,r=0,i=-1,o=t.length-1;for(;n<t.length&&o>=0&&o>=n;){if(s=t[o],o===0?r=0:r=t[o-1],e>=r&&e<=s){i=o;break}if(s=t[n],n===0?r=0:r=t[n-1],e>=r&&e<s){i=n;break}n++,o--}return i}function bo(t,e){let n=t.length-1;return e<0?-1:e<t[0]?0:e>t[t.length-1]?Number.POSITIVE_INFINITY:(t.length<40||e<=t[20]||e>=t[n-20]?n=Zs(t,e):n=Js(t,e),n)}function vo(t){const e=new Blob([t],{type:"text/javascript"});return window.URL.createObjectURL(e)}var Qs=(t=>(t[t.DEFAULT_SERIES=0]="DEFAULT_SERIES",t[t.ALTERNATE_SERIES=1]="ALTERNATE_SERIES",t))(Qs||{}),dt=(t=>(t[t.NONE=0]="NONE",t[t.THIN=1]="THIN",t[t.HAIR=2]="HAIR",t[t.DOTTED=3]="DOTTED",t[t.DASHED=4]="DASHED",t[t.DASH_DOT=5]="DASH_DOT",t[t.DASH_DOT_DOT=6]="DASH_DOT_DOT",t[t.DOUBLE=7]="DOUBLE",t[t.MEDIUM=8]="MEDIUM",t[t.MEDIUM_DASHED=9]="MEDIUM_DASHED",t[t.MEDIUM_DASH_DOT=10]="MEDIUM_DASH_DOT",t[t.MEDIUM_DASH_DOT_DOT=11]="MEDIUM_DASH_DOT_DOT",t[t.SLANT_DASH_DOT=12]="SLANT_DASH_DOT",t[t.THICK=13]="THICK",t))(dt||{}),tr=(t=>(t.TOP="top",t.BOTTOM="bottom",t.LEFT="left",t.RIGHT="right",t.NONE="none",t.ALL="all",t.OUTSIDE="outside",t.INSIDE="inside",t.HORIZONTAL="horizontal",t.VERTICAL="vertical",t.TLBR="tlbr",t.TLBC_TLMR="tlbc_tlmr",t.TLBR_TLBC_TLMR="tlbr_tlbc_tlmr",t.BLTR="bl_tr",t.MLTR_BCTR="mltr_bctr",t))(tr||{}),zt=(t=>(t[t.UNSUPPORTED=0]="UNSUPPORTED",t[t.RGB=1]="RGB",t[t.HEX=2]="HEX",t[t.THEME=3]="THEME",t))(zt||{}),er=(t=>(t[t.ON=0]="ON",t[t.OFF=1]="OFF",t))(er||{}),nr=(t=>(t[t.PASTE_NORMAL=0]="PASTE_NORMAL",t[t.PASTE_NO_BORDERS=1]="PASTE_NO_BORDERS",t[t.PASTE_FORMAT=2]="PASTE_FORMAT",t[t.PASTE_FORMULA=3]="PASTE_FORMULA",t[t.PASTE_DATA_VALIDATION=4]="PASTE_DATA_VALIDATION",t[t.PASTE_VALUES=5]="PASTE_VALUES",t[t.PASTE_CONDITIONAL_FORMATTING=6]="PASTE_CONDITIONAL_FORMATTING",t[t.PASTE_COLUMN_WIDTHS=7]="PASTE_COLUMN_WIDTHS",t))(nr||{}),sr=(t=>(t[t.DOCUMENT=0]="DOCUMENT",t[t.PROJECT=1]="PROJECT",t))(sr||{}),rr=(t=>(t[t.COLUMNS=0]="COLUMNS",t[t.ROWS=1]="ROWS",t))(rr||{}),ir=(t=>(t[t.UP=0]="UP",t[t.RIGHT=1]="RIGHT",t[t.DOWN=2]="DOWN",t[t.LEFT=3]="LEFT",t))(ir||{});function Ao(t){switch(t){case 3:return 1;case 1:return 3;case 0:return 2;case 2:return 0}}var or=(t=>(t[t.NUMBER_FORMAT_TYPE_UNSPECIFIED=0]="NUMBER_FORMAT_TYPE_UNSPECIFIED",t[t.TEXT=1]="TEXT",t[t.NUMBER=2]="NUMBER",t[t.PERCENT=3]="PERCENT",t[t.CURRENCY=4]="CURRENCY",t[t.DATE=5]="DATE",t[t.TIME=6]="TIME",t[t.DATE_TIME=7]="DATE_TIME",t[t.SCIENTIFIC=8]="SCIENTIFIC",t))(or||{}),lr=(t=>(t[t.INTERPOLATION_POINT_TYPE_UNSPECIFIED=0]="INTERPOLATION_POINT_TYPE_UNSPECIFIED",t[t.MIN=1]="MIN",t[t.MAX=2]="MAX",t[t.NUMBER=3]="NUMBER",t[t.PERCENT=4]="PERCENT",t[t.PERCENTILE=5]="PERCENTILE",t))(lr||{}),we=(t=>(t.EN_US="enUS",t.ZH_CN="zhCN",t.RU_RU="ruRU",t))(we||{}),ar=(t=>(t[t.RANGE=0]="RANGE",t[t.SHEET=1]="SHEET",t))(ar||{}),ur=(t=>(t[t.RELATIVE_DATE_UNSPECIFIED=0]="RELATIVE_DATE_UNSPECIFIED",t[t.PAST_YEAR=1]="PAST_YEAR",t[t.PAST_MONTH=2]="PAST_MONTH",t[t.PAST_WEEK=3]="PAST_WEEK",t[t.YESTERDAY=4]="YESTERDAY",t[t.TODAY=5]="TODAY",t[t.TOMORROW=6]="TOMORROW",t))(ur||{}),bn=(t=>(t[t.GRID=0]="GRID",t[t.KANBAN=1]="KANBAN",t[t.GANTT=2]="GANTT",t))(bn||{}),Xe=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=2]="RIGHT_TO_LEFT",t))(Xe||{}),cr=(t=>(t[t.DASH=0]="DASH",t[t.DASH_DOT_DOT_HEAVY=1]="DASH_DOT_DOT_HEAVY",t[t.DASH_DOT_HEAVY=2]="DASH_DOT_HEAVY",t[t.DASHED_HEAVY=3]="DASHED_HEAVY",t[t.DASH_LONG=4]="DASH_LONG",t[t.DASH_LONG_HEAVY=5]="DASH_LONG_HEAVY",t[t.DOT_DASH=6]="DOT_DASH",t[t.DOT_DOT_DASH=7]="DOT_DOT_DASH",t[t.DOTTED=8]="DOTTED",t[t.DOTTED_HEAVY=9]="DOTTED_HEAVY",t[t.DOUBLE=10]="DOUBLE",t[t.NONE=11]="NONE",t[t.SINGLE=12]="SINGLE",t[t.THICK=13]="THICK",t[t.WAVE=14]="WAVE",t[t.WAVY_DOUBLE=15]="WAVY_DOUBLE",t[t.WAVY_HEAVY=16]="WAVY_HEAVY",t[t.WORDS=17]="WORDS",t))(cr||{}),Se=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.LEFT=1]="LEFT",t[t.CENTER=2]="CENTER",t[t.RIGHT=3]="RIGHT",t[t.JUSTIFIED=4]="JUSTIFIED",t))(Se||{}),De=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TOP=1]="TOP",t[t.MIDDLE=2]="MIDDLE",t[t.BOTTOM=3]="BOTTOM",t))(De||{}),qe=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.OVERFLOW=1]="OVERFLOW",t[t.CLIP=2]="CLIP",t[t.WRAP=3]="WRAP",t))(qe||{}),pn=(t=>(t[t.NORMAL=0]="NORMAL",t[t.ITALIC=1]="ITALIC",t))(pn||{}),En=(t=>(t[t.NORMAL=0]="NORMAL",t[t.BOLD=1]="BOLD",t))(En||{}),ye=(t=>(t[t.NORMAL=1]="NORMAL",t[t.SUBSCRIPT=2]="SUBSCRIPT",t[t.SUPERSCRIPT=3]="SUPERSCRIPT",t))(ye||{}),q=(t=>(t[t.FALSE=0]="FALSE",t[t.TRUE=1]="TRUE",t))(q||{}),Ne=(t=>(t[t.STRING=1]="STRING",t[t.NUMBER=2]="NUMBER",t[t.BOOLEAN=3]="BOOLEAN",t[t.FORCE_STRING=4]="FORCE_STRING",t))(Ne||{}),Ht=(t=>(t[t.DARK1=0]="DARK1",t[t.LIGHT1=1]="LIGHT1",t[t.DARK2=2]="DARK2",t[t.LIGHT2=3]="LIGHT2",t[t.ACCENT1=4]="ACCENT1",t[t.ACCENT2=5]="ACCENT2",t[t.ACCENT3=6]="ACCENT3",t[t.ACCENT4=7]="ACCENT4",t[t.ACCENT5=8]="ACCENT5",t[t.ACCENT6=9]="ACCENT6",t[t.HYPERLINK=10]="HYPERLINK",t[t.FOLLOWED_HYPERLINK=11]="FOLLOWED_HYPERLINK",t))(Ht||{}),vn=(t=>(t.OFFICE="Office",t.OFFICE_2007_2010="Office 2007-2010",t.GRAYSCALE="Grayscale",t.BLUE_WARM="Blue Warm",t.BLUE="Blue",t.BLUE_II="Blue II",t.BLUE_GREEN="Blue Green",t.GREEN="Green",t.GREEN_YELLOW="Green Yellow",t.YELLOW="Yellow",t.YELLOW_ORANGE="Yellow Orange",t.ORANGE="Orange",t.ORANGE_RED="Orange Red",t.RED_ORANGE="Red Orange",t.RED="Red",t.RED_VIOLET="Red Violet",t.VIOLET="Violet",t.VIOLET_II="Violet II",t.MEDIAN="Median",t.PAPER="Paper",t.MARQUEE="Marquee",t.SLIPSTREAM="Slipstream",t.Aspect="Aspect",t))(vn||{}),hr=(t=>(t.Line="line",t.LineInv="lineInv",t.Triangle="triangle",t.RtTriangle="rtTriangle",t.Rect="rect",t.Diamond="diamond",t.Parallelogram="parallelogram",t.Trapezoid="trapezoid",t.NonIsocelesTrapezoid="nonIsocelesTrapezoid",t.Pentagon="pentagon",t.Hexagon="hexagon",t.Heptagon="heptagon",t.Octagon="octagon",t.Decagon="decagon",t.Dodecagon="dodecagon",t.Star4="star4",t.Star5="star5",t.Star6="star6",t.Star7="star7",t.Star8="star8",t.Star10="star10",t.Star12="star12",t.Star16="star16",t.Star24="star24",t.Star32="star32",t.RoundRect="roundRect",t.Round1Rect="round1Rect",t.Round2SameRect="round2SameRect",t.Round2DiagRect="round2DiagRect",t.Ellipse="ellipse",t))(hr||{}),dr=(t=>(t.RightArrow="rightArrow",t.LeftArrow="leftArrow",t.UpArrow="upArrow",t.DownArrow="downArrow",t.LeftRightArrow="leftRightArrow",t.UpDownArrow="upDownArrow",t.QuadArrow="quadArrow",t.LeftRightUpArrow="leftRightUpArrow",t.BentArrow="bentArrow",t.UturnArrow="uturnArrow",t.CircularArrow="circularArrow",t.NotchedRightArrow="notchedRightArrow",t.HomePlate="homePlate",t.Chevron="chevron",t.LeftCircularArrow="leftCircularArrow",t.LeftRightCircularArrow="leftRightCircularArrow",t))(dr||{}),fr=(t=>(t.Plaque="plaque",t.Can="can",t.Cube="cube",t.Bevel="bevel",t.Donut="donut",t.NoSmoking="noSmoking",t.BlockArc="blockArc",t.FoldedCorner="foldedCorner",t))(fr||{}),_r=(t=>(t.SmileyFace="smileyFace",t.Heart="heart",t.LightningBolt="lightningBolt",t.Sun="sun",t.Moon="moon",t.Cloud="cloud",t.Arc="arc",t.Backpack="backpack",t.Frame="frame",t.HalfFrame="halfFrame",t.Corner="corner",t.Chord="chord",t.Pie="pie",t.Teardrop="teardrop",t.WedgeRectCallout="wedgeRectCallout",t.WedgeRRectCallout="wedgeRRectCallout",t.WedgeEllipseCallout="wedgeEllipseCallout",t.CloudCallout="cloudCallout",t.BorderCallout1="borderCallout1",t.BorderCallout2="borderCallout2",t.BorderCallout3="borderCallout3",t.AccentCallout1="accentCallout1",t.AccentCallout2="accentCallout2",t.AccentCallout3="accentCallout3",t.Callout1="callout1",t.Callout2="callout2",t.Callout3="callout3",t.ActionButtonBackPrevious="actionButtonBackPrevious",t.ActionButtonEnd="actionButtonEnd",t.ActionButtonForwardNext="actionButtonForwardNext",t.ActionButtonHelp="actionButtonHelp",t.ActionButtonHome="actionButtonHome",t.ActionButtonInformation="actionButtonInformation",t.ActionButtonMovie="actionButtonMovie",t.ActionButtonReturn="actionButtonReturn",t.ActionButtonSound="actionButtonSound",t))(_r||{});const gr={[vn.OFFICE]:{[Ht.ACCENT1]:"#4472C4",[Ht.ACCENT2]:"#ED7D31",[Ht.ACCENT3]:"#A5A5A5",[Ht.ACCENT4]:"#70AD47",[Ht.ACCENT5]:"#5B9BD5",[Ht.ACCENT6]:"#70AD47",[Ht.DARK1]:"#000000",[Ht.DARK2]:"#44546A",[Ht.LIGHT1]:"#FFFFFF",[Ht.LIGHT2]:"#E7E6E6",[Ht.HYPERLINK]:"#0563C1",[Ht.FOLLOWED_HYPERLINK]:"#954F72"}};class An{constructor(){_(this,"_themeValue",Ht.LIGHT1);_(this,"_themeColors");_(this,"_themeTint");_(this,"_rgbValue","");_(this,"_colorType");this._colorType=zt.UNSUPPORTED,this._themeColors=vn.OFFICE,this._themeTint=0}asRgbColor(){return new Rn(this._rgbValue,this)}asThemeColor(){return new Cn(this._themeValue,this._themeTint,this._themeColors,this)}build(){switch(this._colorType){case zt.THEME:return this.asThemeColor();case zt.RGB:return this.asRgbColor();case zt.UNSUPPORTED:throw new Error("unsupported color type")}}setRgbColor(e){return this._colorType=zt.RGB,this._rgbValue=e,this}setThemeColors(e){this._colorType=zt.THEME,this._themeColors=e}setThemeTint(e){this._colorType=zt.THEME,this._themeTint=e}setThemeColor(e){return this._colorType=zt.THEME,this._themeValue=e,this}getColorType(){return this._colorType}}class be{constructor(e){_(this,"_builder");this._builder=e}static rgbColorToHexValue(e){return`#${((1<<24)+(e.getRed()<<16)+(e.getGreen()<<8)+e.getBlue()).toString(16).slice(1)}`}static hexValueToRgbColor(e){e?e.indexOf("#")>-1&&(e=e.substring(1)):e="#000000";const n=+`0x${e[0]}${e[1]}`,s=+`0x${e[2]}${e[3]}`,r=+`0x${e[4]}${e[5]}`;return new An().setRgbColor(`rgb(${n},${s},${r})`).asRgbColor()}static hexToRgbString(e){const n=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;e=e.replace(n,(i,o,l,a)=>o+o+l+l+a+a);const s=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);let r=null;if(s){const i=Number.parseInt(s[1],16),o=Number.parseInt(s[2],16),l=Number.parseInt(s[3],16);r=`rgba(${i},${o},${l})`}return r}asRgbColor(){return this._builder.asRgbColor()}asThemeColor(){return this._builder.asThemeColor()}getColorType(){return this._builder.getColorType()}clone(){return new be(this._builder)}equals(e){return!1}}class mr{constructor(e){_(this,"_saturation",0);_(this,"_hue",0);_(this,"_lightness",0);_(this,"_alpha",0);const n=e.getRed()/255,s=e.getGreen()/255,r=e.getBlue()/255,i=e.getAlpha()/255,o=Math.min(n,Math.min(s,r)),l=Math.max(n,Math.max(s,r)),a=l-o;if(l===o){this._hue=0,this._saturation=0,this._lightness=l;return}this._lightness=(o+l)/2,this._lightness<.5?this._saturation=a/(l+o):this._saturation=a/(2-l-o),n===l&&(this._hue=(s-r)/a),s===l&&(this._hue=2+(r-n)/a),r===l&&(this._hue=4+(n-s)/a),this._hue*=60,this._hue<0&&(this._hue+=360),this._alpha=i}asRgbColor(){const e=new An;if(this._saturation===0)return e.setRgbColor(`rgba(${this._lightness*255},${this._lightness*255},${this._lightness*255},${this._alpha*255})`),e.asRgbColor();let n;this._lightness<.5?n=this._lightness*(1+this._saturation):n=this._lightness+this._saturation-this._lightness*this._saturation;const s=2*this._lightness-n,r=this._hue/360,i=r+1/3,o=this.setColor(n,s,i),l=this.setColor(n,s,r),a=r-1/3,h=this.setColor(n,s,a);return e.setRgbColor(`rgba(${Math.round(o*255)},${Math.round(l*255)},${Math.round(h*255)},${this._alpha*255})`),e.asRgbColor()}getLightness(){return this._lightness}getHue(){return this._hue}getSaturation(){return this._saturation}getAlpha(){return this._alpha}setColor(e,n,s){s<0&&(s+=1),s>1&&(s-=1);let r;return 6*s<1?r=n+(e-n)*6*s:2*s<1?r=e:3*s<2?r=n+(e-n)*(2/3-s)*6:r=n,r}setLightness(e){this._lightness=e}}const Yt=class Yt extends be{constructor(n,s){super(s);_(this,"_cssString");_(this,"_red");_(this,"_green");_(this,"_blue");_(this,"_alpha");let r=n.match(Yt.RGBA_EXTRACT);if(r){const i=+r[1],o=+r[2],l=+r[3],a=+r[4];this._cssString=n,this._red=i,this._green=o,this._blue=l,this._alpha=a;return}if(r=n.match(Yt.RGB_EXTRACT),r){const i=+r[1],o=+r[2],l=+r[3];this._cssString=n,this._red=i,this._green=o,this._blue=l,this._alpha=1;return}throw new Error("Invalid rgba or rgb color")}asHexString(){return be.rgbColorToHexValue(this)}getRed(){let n=this._red+Yt.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getGreen(){let n=this._green+Yt.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getBlue(){let n=this._blue+Yt.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getAlpha(){return this._alpha}getColorType(){return zt.RGB}clone(){return new Yt(this._cssString,this._builder)}asThemeColor(){throw new Error("rgb color not support to themeColor")}equals(n){return n instanceof Yt?n._red===this._red&&n._blue===this._blue&&n._green===this._green&&n._alpha===this._alpha:!1}getCssString(){return this._cssString}};_(Yt,"RGB_COLOR_AMT",0),_(Yt,"RGBA_EXTRACT",new RegExp("\\s*rgba\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d.\\d|\\d\\s*)\\)\\s*")),_(Yt,"RGB_EXTRACT",new RegExp("\\s*rgb\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*)\\)\\s*"));let Rn=Yt;const fe=class fe extends be{constructor(n,s,r,i){super(i);_(this,"_themeColorType");_(this,"_themeTint");_(this,"_themeColors");this._themeColorType=n,this._themeTint=s,this._themeColors=r}lumValue(n,s){if(n==null)return s;let r;return n<0?r=s*(1+n):r=s*(1-n)+(255-255*(1-n)),r}asRgbColor(){const n=gr[this._themeColors];if(n==null)throw new Error("not find themeColors type");const s=n[this._themeColorType];if(s==null)throw new Error("not find themeColors value");let r;if(fe._cacheThemeColor.has(this._themeColors)){if(r=fe._cacheThemeColor.get(this._themeColors),r.has(this._themeColorType))return r.get(this._themeColorType)}else r=new Map,fe._cacheThemeColor.set(this._themeColors,r);const i=new mr(be.hexValueToRgbColor(s));i.setLightness(this.lumValue(this._themeTint,i.getLightness()*255)/255);const o=i.asRgbColor();return r.set(this._themeColorType,o),o}clone(){return new fe(this._themeColorType,this._themeTint,this._themeColors,this._builder)}equals(n){return n instanceof fe?n._themeColorType===this._themeColorType:!1}getColorType(){return zt.THEME}getThemeColorType(){return this._themeColorType}};_(fe,"_cacheThemeColor",new Map);let Cn=fe;const wo="rgb(",To="rgba(",Yn={aliceBlue:[240,248,255],antiqueWhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blancheAlmond:[255,235,205],blue:[0,0,255],blueViolet:[138,43,226],brown:[165,42,42],burlyWood:[222,184,135],cadetBlue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornFlowerBlue:[100,149,237],cornSilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkCyan:[0,139,139],darkGoldenrod:[184,132,11],darkGray:[169,169,169],darkGreen:[0,100,0],darkGrey:[169,169,169],darkKhaki:[189,183,107],darkMagenta:[139,0,139],darkOliveGreen:[85,107,47],darkOrange:[255,140,0],darkOrchid:[153,50,204],darkRed:[139,0,0],darkSalmon:[233,150,122],darkSeaGreen:[143,188,143],darkSlateBlue:[72,61,139],darkSlateGray:[47,79,79],darkSlateGrey:[47,79,79],darkTurquoise:[0,206,209],darkViolet:[148,0,211],deepPink:[255,20,147],deepSkyBlue:[0,191,255],dimGray:[105,105,105],dimGrey:[105,105,105],dodgerBlue:[30,144,255],firebrick:[178,34,34],floralWhite:[255,255,240],forestGreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostWhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenYellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotPink:[255,105,180],indianRed:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderBlush:[255,240,245],lawnGreen:[124,252,0],lemonChiffon:[255,250,205],lightblue:[173,216,230],lightCoral:[240,128,128],lightCyan:[224,255,255],lightGoldenrodYellow:[250,250,210],lightGray:[211,211,211],lightGreen:[144,238,144],lightGrey:[211,211,211],lightPink:[255,182,193],lightSalmon:[255,160,122],lightSeaGreen:[32,178,170],lightSkyBlue:[135,206,250],lightSlateGray:[119,136,153],lightSlateGrey:[119,136,153],lightSteelBlue:[176,196,222],lightYellow:[255,255,224],lime:[0,255,0],limeGreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumAquamarine:[102,205,170],mediumBlue:[0,0,205],mediumOrchid:[186,85,211],mediumPurple:[147,112,219],mediumSeaGreen:[60,179,113],mediumSlateBlue:[123,104,238],mediumSpringGreen:[0,250,154],mediumTurquoise:[72,209,204],mediumVioletRed:[199,21,133],midBightBlue:[25,25,112],mintCream:[245,255,250],mistyRose:[255,228,225],moccasin:[255,228,181],navajoWhite:[255,222,173],navy:[0,0,128],oldLace:[253,245,230],olive:[128,128,0],oliveDrab:[107,142,35],orange:[255,165,0],orangeRed:[255,69,0],orchid:[218,112,214],paleGoldenrod:[238,232,170],paleGreen:[152,251,152],paleTurquoise:[175,238,238],paleVioletRed:[219,112,147],papayaWhip:[255,239,213],peachPuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderBlue:[176,224,230],purple:[128,0,128],rebeccaPurple:[102,51,153],red:[255,0,0],rosyBrown:[188,143,143],royalBlue:[65,105,225],saddleBrown:[139,69,19],salmon:[250,128,114],sandyBrown:[244,164,96],seaGreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyBlue:[135,206,235],slateBlue:[106,90,205],slateGray:[119,128,144],slateGrey:[119,128,144],snow:[255,255,250],springGreen:[0,255,127],steelBlue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whiteSmoke:[245,245,245],yellow:[255,255,0],yellowGreen:[154,205,5]};class te{constructor(e){_(this,"_color");_(this,"_rgbColor");_(this,"_isValid",!1);if(e==null){this._setNullColor();return}if(e instanceof te){this._color={...e._color},this._rgbColor={...e._rgbColor};return}const n=pr(e);if(n==null){this._setNullColor();return}this._color=n;const s=yo(this._color);if(s==null){this._setNullColor();return}this._rgbColor=s,this._isValid=!0}static mix(e,n,s){var h,c;s=Math.min(1,Math.max(0,s));const r=new te(e).toRgb(),i=new te(n).toRgb(),o=(h=r.a)!=null?h:1,l=(c=i.a)!=null?c:1,a={r:(i.r-r.r)*s+r.r,g:(i.g-r.g)*s+r.g,b:(i.b-r.b)*s+r.b,a:(l-o)*s+o};return new te(a)}static getContrastRatio(e,n){const s=new te(e).getLuminance(),r=new te(n).getLuminance();return(Math.max(s,r)+.05)/(Math.min(s,r)+.05)}get isValid(){return this._isValid}toRgb(){return this._rgbColor}toRgbString(){const{r:e,g:n,b:s,a:r=1}=this.toRgb(),i=r<1;return`rgb${i?"a":""}(${e},${n},${s}${i?`,${r}`:""})`}toString(){return this.toRgbString()}toHexString(e){const{r:n,g:s,b:r,a:i=1}=this.toRgb(),o=i<1,l=[on(Math.round(n).toString(16)),on(Math.round(s).toString(16)),on(Math.round(r).toString(16)),on(Math.round(i*255).toString(16))];return e&&l[0][0]===l[0][1]&&l[1][0]===l[1][1]&&l[2][0]===l[2][1]&&l[3][0]===l[3][1]?o?`#${l[0][0]}${l[1][0]}${l[2][0]}${l[3][0]}`:`#${l[0][0]}${l[1][0]}${l[2][0]}`:o?`#${l[0]}${l[1]}${l[2]}${l[3]}`:`#${l[0]}${l[1]}${l[2]}`}toHsv(){return Ho(this.toRgb())}toHsl(){return ko(this.toRgb())}lighten(e=10){const n=this.toHsl();return n.l+=e,n.l=Math.min(Math.max(n.l,0),100),new te(n)}darken(e=10){const n=this.toHsl();return n.l-=e,n.l=Math.min(Math.max(n.l,0),100),new te(n)}setAlpha(e){return new te({...this._rgbColor,a:e})}getLuminance(){let{r:e,g:n,b:s}=this.toRgb();return e=Fn(e),n=Fn(n),s=Fn(s),Number((.2126*e+.7152*n+.0722*s).toFixed(3))}getBrightness(){const{r:e,g:n,b:s}=this.toRgb();return(e*299+n*587+s*114)/1e3}getAlpha(){var e;return(e=this._color.a)!=null?e:1}isDark(){return this.getBrightness()<128}isLight(){return!this.isDark()}_setNullColor(){this._isValid=!1,this._color={r:0,g:0,b:0,a:0},this._rgbColor={r:0,g:0,b:0,a:0}}}const on=t=>t.length===1?`0${t}`:t,Fn=t=>(t/=255,t<=.03928?t/12.92:((t+.055)/1.055)**2.4),pr=t=>{if(Bo(t)){if("r"in t){const s={r:Math.round(t.r),g:Math.round(t.g),b:Math.round(t.b)};return t.a!==void 0&&(s.a=t.a),s}if("l"in t){const s={h:Math.round(t.h),s:t.s,l:t.l};return t.a!==void 0&&(s.a=t.a),s}const n={h:Math.round(t.h),s:t.s,v:t.v};return t.a!==void 0&&(n.a=t.a),n}const e=t.trim();if(Yn[e]){const n=Yn[e],s={r:Math.round(n[0]),g:Math.round(n[1]),b:Math.round(n[2])};return s.a=n[3]||1,s}if(e.startsWith("#"))return Lo(e);if(e.startsWith("rgb"))return Mo(e);if(e.startsWith("hsl"))return Uo(e);if(e.startsWith("hsv"))return Do(e)},Lo=t=>{const e=t.substring(1),n=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let s=e.match(n);if(!s||s.length<3)throw new Error(`The color '${t}' is illegal hex color`);s[0].length===1&&(s=s.map(i=>i+i));const r={r:Number.parseInt(s[0],16),g:Number.parseInt(s[1],16),b:Number.parseInt(s[2],16)};return s.length>3&&(r.a=Number.parseInt(s[3],16)/255),r},Mo=t=>{const e=t.indexOf("(");if(e===-1)throw new Error(`The color '${t}' is illegal rgb color`);const n=t.substring(e+1,t.length-1).split(",");if(n.length<3)throw new Error(`The color '${t}' is illegal rgb color`);const s={r:Number.parseInt(n[0],10),g:Number.parseInt(n[1],10),b:Number.parseInt(n[2],10)};return n.length>3&&(s.a=Number.parseFloat(n[3])),s},Uo=t=>{const e=t.indexOf("(");if(e===-1)throw new Error(`The color '${t}' is illegal hsl color`);const n=t.substring(e+1,t.length-1).split(",");if(n.length<3)throw new Error(`The color '${t}' is illegal hsl color`);const s={h:Number.parseInt(n[0],10),s:Number.parseFloat(n[1]),l:Number.parseFloat(n[2])};return n.length>3&&(s.a=Number.parseFloat(n[3])),s},Do=t=>{const e=t.indexOf("(");if(e===-1)throw new Error(`The color '${t}' is illegal hsv color`);const n=t.substring(e+1,t.length-1).split(",");if(n.length<3)throw new Error(`The color '${t}' is illegal hsv color`);const s={h:Number.parseInt(n[0],10),s:Number.parseFloat(n[1]),v:Number.parseFloat(n[2])};return n.length>3&&(s.a=Number.parseFloat(n[3])),s},yo=t=>{const e=pr(t);if(e!=null)return"r"in e?e:"l"in e?Po(e):xo(e)},Bn=(t,e,n)=>(n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t),Po=t=>{let{h:e,s:n,l:s}=t;e/=360,n/=100,s/=100;let r=0,i=0,o=0;if(n===0)r=i=o=s;else{const a=s<.5?s*(1+n):s+n-s*n,h=2*s-a;r=Bn(h,a,e+1/3),i=Bn(h,a,e),o=Bn(h,a,e-1/3)}const l={r:Math.round(r*255),g:Math.round(i*255),b:Math.round(o*255)};return t.a!==void 0&&(l.a=t.a),l},xo=t=>{let{h:e,s:n,v:s}=t;e=e/360*6,n/=100,s/=100;const r=Math.floor(e),i=e-r,o=s*(1-n),l=s*(1-i*n),a=s*(1-(1-i)*n),h=r%6,c=[s,l,o,o,a,s][h],u=[a,s,s,l,o,o][h],d=[o,o,a,s,s,l][h],f={r:c*255,g:u*255,b:d*255};return t.a!==void 0&&(f.a=t.a),f},ko=t=>{let{r:e,g:n,b:s}=t;e/=255,n/=255,s/=255;const r=Math.max(e,n,s),i=Math.min(e,n,s),o=(r+i)/2;let l,a;if(r===i)l=a=0;else{const c=r-i;switch(a=o>.5?c/(2-r-i):c/(r+i),r){case e:l=(n-s)/c+(n<s?6:0);break;case n:l=(s-e)/c+2;break;default:l=(e-n)/c+4;break}l/=6}const h={h:Math.round(l*360),s:Math.round(a*100),l:Math.round(o*100)};return t.a!==void 0&&(h.a=t.a),h},Ho=t=>{let{r:e,g:n,b:s}=t;e/=255,n/=255,s/=255;const r=Math.max(e,n,s),i=Math.min(e,n,s);let o;const l=r,a=r-i,h=r===0?0:a/r;if(r===i)o=0;else{switch(r){case e:o=(n-s)/a+(n<s?6:0);break;case n:o=(s-e)/a+2;break;default:o=(e-n)/a+4;break}o/=6}const c={h:Math.round(o*360),s:Math.round(h*100),v:Math.round(l*100)};return t.a!==void 0&&(c.a=t.a),c},Fo=t=>t==null,Bo=t=>!Fo(t)&&typeof t=="object";function $o(t){const e=/^#(?:[0]{3}|[0]{6})\b/,n=/^rgb\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*\)$/,s=/^rgba\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*,\s*(1|1\.0*|0?\.\d+)\)$/,r=/^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*\)$/,i=/^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/;return!!(e.test(t)||n.test(t)||s.test(t)||r.test(t)||i.test(t))}function Wo(t){const e=/^#(?:[Ff]{3}|[Ff]{6})\b/,n=/^rgb\s*\(\s*255\s*,\s*255\s*,\s*255\s*\)$/,s=/^rgba\s*\(\s*255\s*,\s*255\s*,\s*255\s*,\s*(1|1\.0*|0?\.\d+)\)$/,r=/^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*\)$/,i=/^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/;return!!(e.test(t)||n.test(t)||s.test(t)||r.test(t)||i.test(t))}var xt=(t=>(t[t.COVER=0]="COVER",t[t.REPLACE=1]="REPLACE",t[t.INTERSECTION=2]="INTERSECTION",t))(xt||{});function Go(t){return t&&(t.s!==void 0||t.p!==void 0||t.v!==void 0||t.t!==void 0||t.f!==void 0||t.si!==void 0)}function jo(t){if(t.t!==void 0)return t.t;if(typeof t.v=="string")return Ne.STRING;if(typeof t.v=="number")return Ne.NUMBER;if(typeof t.v=="boolean")return Ne.BOOLEAN}function Vo(t){if(t==null)return!0;const{v:e,f:n,si:s,p:r,s:i,custom:o}=t;return!(!(e==null||typeof e=="string"&&e.length===0)||n!=null&&n.length>0||s!=null&&s.length>0||r!=null||o!=null)}function Ko(t){return t!=null&&(typeof t=="string"||typeof t=="number"||typeof t=="boolean")}var Er=(t=>(t[t.character=0]="character",t[t.paragraph=1]="paragraph",t[t.table=2]="table",t[t.numbering=3]="numbering",t))(Er||{}),Rr=(t=>(t[t.TAB=0]="TAB",t[t.SPACE=1]="SPACE",t[t.NOTHING=2]="NOTHING",t))(Rr||{}),Ge=(t=>(t[t.GLYPH_TYPE_UNSPECIFIED=0]="GLYPH_TYPE_UNSPECIFIED",t[t.NONE=1]="NONE",t[t.DECIMAL=2]="DECIMAL",t[t.ZERO_DECIMAL=3]="ZERO_DECIMAL",t[t.UPPER_ALPHA=4]="UPPER_ALPHA",t[t.ALPHA=5]="ALPHA",t[t.UPPER_ROMAN=6]="UPPER_ROMAN",t[t.ROMAN=7]="ROMAN",t))(Ge||{}),de=(t=>(t[t.BULLET_ALIGNMENT_UNSPECIFIED=0]="BULLET_ALIGNMENT_UNSPECIFIED",t[t.START=1]="START",t[t.CENTER=2]="CENTER",t[t.END=3]="END",t))(de||{}),Cr=(t=>(t[t.HYPERLINK=0]="HYPERLINK",t[t.FIELD=1]="FIELD",t[t.SDT=2]="SDT",t[t.BOOKMARK=3]="BOOKMARK",t[t.COMMENT=4]="COMMENT",t[t.CUSTOM=5]="CUSTOM",t[t.MENTION=6]="MENTION",t))(Cr||{}),Ir=(t=>(t[t.DRAWING=0]="DRAWING",t[t.CUSTOM=1]="CUSTOM",t))(Ir||{}),Or=(t=>(t[t.DEFAULT=0]="DEFAULT",t[t.LINES=1]="LINES",t[t.LINES_AND_CHARS=2]="LINES_AND_CHARS",t[t.SNAP_TO_CHARS=3]="SNAP_TO_CHARS",t))(Or||{}),Sr=(t=>(t[t.SECTION_TYPE_UNSPECIFIED=0]="SECTION_TYPE_UNSPECIFIED",t[t.CONTINUOUS=1]="CONTINUOUS",t[t.NEXT_PAGE=2]="NEXT_PAGE",t[t.EVEN_PAGE=3]="EVEN_PAGE",t[t.ODD_PAGE=4]="ODD_PAGE",t))(Sr||{}),Nr=(t=>(t[t.COLUMN_SEPARATOR_STYLE_UNSPECIFIED=0]="COLUMN_SEPARATOR_STYLE_UNSPECIFIED",t[t.NONE=1]="NONE",t[t.BETWEEN_EACH_COLUMN=2]="BETWEEN_EACH_COLUMN",t))(Nr||{}),br=(t=>(t[t.NORMAL=0]="NORMAL",t[t.TBRL=1]="TBRL",t[t.LRTBV=2]="LRTBV",t))(br||{}),vr=(t=>(t[t.TEXT_RUN=0]="TEXT_RUN",t[t.AUTO_TEXT=1]="AUTO_TEXT",t[t.PAGE_BREAK=2]="PAGE_BREAK",t[t.COLUMN_BREAK=3]="COLUMN_BREAK",t[t.FOOT_NOTE_REFERENCE=4]="FOOT_NOTE_REFERENCE",t[t.HORIZONTAL_RULE=5]="HORIZONTAL_RULE",t[t.EQUATION=6]="EQUATION",t[t.DRAWING=7]="DRAWING",t[t.PERSON=8]="PERSON",t[t.RICH_LINK=9]="RICH_LINK",t))(vr||{}),Ar=(t=>(t[t.BOTH_SIDES=0]="BOTH_SIDES",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT",t[t.LARGEST=3]="LARGEST",t))(Ar||{}),wr=(t=>(t[t.INLINE=0]="INLINE",t[t.WRAP_NONE=1]="WRAP_NONE",t[t.WRAP_POLYGON=2]="WRAP_POLYGON",t[t.WRAP_SQUARE=3]="WRAP_SQUARE",t[t.WRAP_THROUGH=4]="WRAP_THROUGH",t[t.WRAP_TIGHT=5]="WRAP_TIGHT",t[t.WRAP_TOP_AND_BOTTOM=6]="WRAP_TOP_AND_BOTTOM",t))(wr||{}),Tr=(t=>(t[t.NAMED_STYLE_TYPE_UNSPECIFIED=0]="NAMED_STYLE_TYPE_UNSPECIFIED",t[t.NORMAL_TEXT=1]="NORMAL_TEXT",t[t.TITLE=2]="TITLE",t[t.SUBTITLE=3]="SUBTITLE",t[t.HEADING_1=4]="HEADING_1",t[t.HEADING_2=5]="HEADING_2",t[t.HEADING_3=6]="HEADING_3",t[t.HEADING_4=7]="HEADING_4",t[t.HEADING_5=8]="HEADING_5",t[t.HEADING_6=9]="HEADING_6",t))(Tr||{}),Lr=(t=>(t[t.AUTO=0]="AUTO",t[t.AT_LEAST=1]="AT_LEAST",t[t.EXACT=2]="EXACT",t))(Lr||{}),Mr=(t=>(t[t.DASH_STYLE_UNSPECIFIED=0]="DASH_STYLE_UNSPECIFIED",t[t.SOLID=1]="SOLID",t[t.DOT=2]="DOT",t[t.DASH=3]="DASH",t))(Mr||{}),Ur=(t=>(t[t.TAB_STOP_ALIGNMENT_UNSPECIFIED=0]="TAB_STOP_ALIGNMENT_UNSPECIFIED",t[t.START=1]="START",t[t.CENTER=2]="CENTER",t[t.END=3]="END",t))(Ur||{}),Dr=(t=>(t.EVENLY_DISTRIBUTED="0",t.FIXED_WIDTH="1",t))(Dr||{}),yr=(t=>(t[t.CONTENT_ALIGNMENT_UNSPECIFIED=0]="CONTENT_ALIGNMENT_UNSPECIFIED",t[t.CONTENT_ALIGNMENT_UNSUPPORTED=1]="CONTENT_ALIGNMENT_UNSUPPORTED",t[t.TOP=2]="TOP",t[t.MIDDLE=3]="MIDDLE",t[t.BOTTOM=4]="BOTTOM",t))(yr||{}),Pr=(t=>(t.NORMAL="normal",t.BOLD="bold",t.ITALIC="italic",t))(Pr||{}),xr=(t=>(t[t.PAGE=0]="PAGE",t[t.COLUMN=1]="COLUMN",t[t.CHARACTER=2]="CHARACTER",t[t.MARGIN=3]="MARGIN",t[t.INSIDE_MARGIN=4]="INSIDE_MARGIN",t[t.OUTSIDE_MARGIN=5]="OUTSIDE_MARGIN",t[t.LEFT_MARGIN=6]="LEFT_MARGIN",t[t.RIGHT_MARGIN=7]="RIGHT_MARGIN",t))(xr||{}),kr=(t=>(t[t.PAGE=0]="PAGE",t[t.PARAGRAPH=1]="PARAGRAPH",t[t.LINE=2]="LINE",t[t.MARGIN=3]="MARGIN",t[t.TOP_MARGIN=4]="TOP_MARGIN",t[t.BOTTOM_MARGIN=5]="BOTTOM_MARGIN",t[t.INSIDE_MARGIN=6]="INSIDE_MARGIN",t[t.OUTSIDE_MARGIN=7]="OUTSIDE_MARGIN",t))(kr||{}),Hr=(t=>(t[t.POINT=0]="POINT",t[t.LINE=1]="LINE",t[t.CHARACTER=2]="CHARACTER",t))(Hr||{}),Fr=(t=>(t[t.CENTER=0]="CENTER",t[t.INSIDE=1]="INSIDE",t[t.LEFT=2]="LEFT",t[t.OUTSIDE=3]="OUTSIDE",t[t.RIGHT=4]="RIGHT",t))(Fr||{}),Br=(t=>(t[t.BOTTOM=0]="BOTTOM",t[t.CENTER=1]="CENTER",t[t.INSIDE=2]="INSIDE",t[t.OUTSIDE=3]="OUTSIDE",t[t.TOP=4]="TOP",t))(Br||{}),$r=(t=>(t[t.compressPunctuation=0]="compressPunctuation",t[t.compressPunctuationAndJapaneseKana=1]="compressPunctuationAndJapaneseKana",t[t.doNotCompress=2]="doNotCompress",t))($r||{}),Wr=(t=>(t[t.PORTRAIT=0]="PORTRAIT",t[t.LANDSCAPE=1]="LANDSCAPE",t))(Wr||{}),Gr=(t=>(t[t.forward=0]="forward",t[t.backward=1]="backward",t[t.front=2]="front",t[t.back=3]="back",t))(Gr||{}),jr=(t=>(t[t.UNRECOGNIZED=-1]="UNRECOGNIZED",t[t.DRAWING_IMAGE=0]="DRAWING_IMAGE",t[t.DRAWING_SHAPE=1]="DRAWING_SHAPE",t[t.DRAWING_CHART=2]="DRAWING_CHART",t[t.DRAWING_TABLE=3]="DRAWING_TABLE",t[t.DRAWING_SMART_ART=4]="DRAWING_SMART_ART",t[t.DRAWING_VIDEO=5]="DRAWING_VIDEO",t[t.DRAWING_GROUP=6]="DRAWING_GROUP",t[t.DRAWING_UNIT=7]="DRAWING_UNIT",t[t.DRAWING_DOM=8]="DRAWING_DOM",t))(jr||{}),rt=(t=>(t[t.NORMAL=0]="NORMAL",t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN",t[t.ALL=3]="ALL",t))(rt||{}),bt=(t=>(t[t.NONE=0]="NONE",t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN",t[t.ALL=3]="ALL",t))(bt||{});function Yo(t){return[t.startRow,t.startColumn,t.endRow,t.endColumn]}function zo(t,e,n){let s=!1,r=!1,i=t,o=e,l=t,a=e;if(n==null)return{actualRow:t,actualColumn:e,isMergedMainCell:r,isMerged:s,endRow:i,endColumn:o,startRow:l,startColumn:a};for(let h=0;h<n.length;h++){const{startRow:c,endRow:u,startColumn:d,endColumn:f}=n[h];if(t===c&&e===d){i=u,o=f,l=c,a=d,r=!0;break}if(t>=c&&t<=u&&e>=d&&e<=f){i=u,o=f,l=c,a=d,s=!0;break}}return{actualRow:t,actualColumn:e,isMergedMainCell:r,isMerged:s,endRow:i,endColumn:o,startRow:l,startColumn:a}}var as=(t=>(t[t.SLIDE=0]="SLIDE",t[t.MASTER=1]="MASTER",t[t.LAYOUT=2]="LAYOUT",t[t.HANDOUT_MASTER=3]="HANDOUT_MASTER",t[t.NOTES_MASTER=4]="NOTES_MASTER",t))(as||{}),Vr=(t=>(t[t.SHAPE=0]="SHAPE",t[t.IMAGE=1]="IMAGE",t[t.TEXT=2]="TEXT",t[t.SPREADSHEET=3]="SPREADSHEET",t[t.DOCUMENT=4]="DOCUMENT",t[t.SLIDE=5]="SLIDE",t))(Vr||{}),Kr=(t=>(t[t.RELATIVE_SLIDE_LINK_UNSPECIFIED=0]="RELATIVE_SLIDE_LINK_UNSPECIFIED",t[t.NEXT_SLIDE=1]="NEXT_SLIDE",t[t.PREVIOUS_SLIDE=2]="PREVIOUS_SLIDE",t[t.FIRST_SLIDE=3]="FIRST_SLIDE",t[t.LAST_SLIDE=4]="LAST_SLIDE",t))(Kr||{});const Xo="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let qo=t=>crypto.getRandomValues(new Uint8Array(t)),Jo=(t,e,n)=>{let s=(2<<Math.log(t.length-1)/Math.LN2)-1,r=-~(1.6*s*e/t.length);return(i=e)=>{let o="";for(;;){let l=n(r),a=r;for(;a--;)if(o+=t[l[a]&s]||"",o.length===i)return o}}},Zo=(t,e=21)=>Jo(t,e,qo),Qo=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=Xo[n[t]&63];return e};const tl=/^-ms-/,el=/-([a-z])/g,he=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];class D{static stringAt(e){let n="",s=e;for(;s>=he.length;)s/=he.length,s-=1,n+=he[s%he.length];const r=e%he.length;return n+=he[r],n}static indexAt(e){let n=0;for(let s=0;s<e.length-1;s+=1){const r=e.charCodeAt(s)-65,i=e.length-1-s;n+=he.length**i+he.length*r}return n+=e.charCodeAt(e.length-1)-65,n}static deleteBlank(e){return D.isString(e)?e.replace(/\s/g,""):e}static getSystemType(){const e=navigator.userAgent,n=navigator.platform==="Win32"||navigator.platform==="Windows",s=navigator.platform==="Mac68K"||navigator.platform==="MacPPC"||navigator.platform==="Macintosh"||navigator.platform==="MacIntel";if(s)return"Mac";if(navigator.platform==="X11"&&!n&&!s)return"Unix";if(String(navigator.platform).indexOf("Linux")>-1)return"Linux";if(n){if(e.indexOf("Windows NT 5.0")>-1||e.indexOf("Windows 2000")>-1)return"Windows 2000";if(e.indexOf("Windows NT 5.1")>-1||e.indexOf("Windows XP")>-1)return"Windows XP";if(e.indexOf("Windows NT 5.2")>-1||e.indexOf("Windows 2003")>-1)return"Windows 2003";if(e.indexOf("Windows NT 6.0")>-1||e.indexOf("Windows Vista")>-1)return"Windows Vista";if(e.indexOf("Windows NT 6.1")>-1||e.indexOf("Windows 7")>-1)return"Windows 7";if(e.indexOf("Windows NT 10")>-1||e.indexOf("Windows 10")>-1)return"Windows 10";if(e.indexOf("Windows NT 11")>-1||e.indexOf("Windows 11")>-1)return"Windows 11"}return"Unknown system"}static getBrowserType(){const e=navigator.userAgent,n=e.indexOf("Opera")>-1,s=e.indexOf("compatible")>-1&&e.indexOf("MSIE")>-1&&!n,r=e.indexOf("Trident")>-1&&e.indexOf("rv:11.0")>-1,i=e.indexOf("Edge")>-1,o=e.indexOf("Firefox")>-1,l=e.indexOf("Safari")>-1&&e.indexOf("Chrome")===-1,a=e.indexOf("Chrome")>-1&&e.indexOf("Safari")>-1;if(s){new RegExp("MSIE (\\d+\\.\\d+);").test(e);const c=Number.parseFloat(RegExp.$1);return c===7?"IE7":c===8?"IE8":c===9?"IE9":c===10?"IE10":"0"}return o?"FF":n?"Opera":l?"Safari":a?"Chrome":i?"Edge":r?"IE11":"Unknown browser"}static generateRandomId(e=21,n){return n?Zo(n,e)():Qo(e)}static getClassName(e){return e.constructor.name}static deepMerge(e,...n){n.forEach(o=>o&&i(o));function s(o,l){o.forEach((a,h)=>{var c,u;if(D.isArray(a)){const d=(c=l[h])!=null?c:[];l[h]=d,s(a,d);return}if(D.isObject(a)){const d=(u=l[h])!=null?u:{};l[h]=d,r(a,d);return}l[h]=a})}function r(o,l){Object.keys(o).forEach(a=>{var c,u;const h=o[a];if(D.isObject(h)){const d=(c=l[a])!=null?c:{};l[a]=d,r(h,d);return}if(D.isArray(h)){const d=(u=l[a])!=null?u:[];l[a]=d,s(h,d);return}l[a]=h})}function i(o){Object.keys(o).forEach(l=>{var h,c;const a=o[l];if(D.isArray(a)){const u=(h=e[l])!=null?h:[];e[l]=u,s(a,u);return}if(D.isObject(a)){const u=(c=e[l])!=null?c:{};e[l]=u,r(a,u);return}e[l]=a})}return e}static numberFixed(e,n){return Number(Number(e).toFixed(n))}static diffValue(e,n){function s(o,l){const a=D.getValueType(o),h=D.getValueType(l);return a!==h?!1:D.isArray(o)?r(o,l):D.isObject(o)?i(o,l):D.isDate(o)?o.getTime()===l.getTime():D.isRegExp(o)?o.toString()===l.toString():o===l}function r(o,l){if(e.length!==n.length)return!1;for(let a=0,h=o.length;a<h;a++){const c=o[a],u=l[a];if(!s(c,u))return!1}return!0}function i(o,l){const a=Object.keys(o),h=Object.keys(l);if(a.length!==h.length)return!1;for(const c of a){if(!h.includes(c))return!1;const u=o[c],d=l[c];if(!s(u,d))return!1}return!0}return s(e,n)}static deepClone(e){if(!this.isDefine(e))return e;if(this.isRegExp(e))return new RegExp(e);if(this.isDate(e))return new Date(e);if(this.isArray(e)){const n=[];return e.forEach((s,r)=>{n[r]=D.deepClone(s)}),n}if(this.isObject(e)){const n={};return Object.keys(e).forEach(s=>{const r=e[s];n[s]=D.deepClone(r)}),Object.setPrototypeOf(n,Object.getPrototypeOf(e)),n}return e}static getLanguage(){const e="en-US";return globalThis.navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||e}static getValueType(e){return Object.prototype.toString.apply(e)}static isDefine(e){return e!=null}static isBlank(e){return this.isDefine(e)?this.isString(e)?e.trim()==="":!1:!0}static isAssignableFrom(e,n){return e instanceof n}static isBoolean(e){return this.getValueType(e)==="[object Boolean]"}static isPlainObject(e){return this.isDefine(e)?Object.getPrototypeOf(e)===Object.getPrototypeOf({}):!1}static isFunction(e){return this.getValueType(e)==="[object Function]"}static isDate(e){return this.getValueType(e)==="[object Date]"}static isRegExp(e){return this.getValueType(e)==="[object RegExp]"}static isArray(e){return this.getValueType(e)==="[object Array]"}static isString(e){return this.getValueType(e)==="[object String]"}static isNumber(e){return this.getValueType(e)==="[object Number]"}static isStringNumber(e){return!isNaN(Number.parseFloat(e))&&isFinite(e)}static isObject(e){return this.getValueType(e)==="[object Object]"}static isEmptyObject(e){for(const n in e)return!1;return!0}static isMobile(){let e=0,n=0;return document.body.clientWidth&&(e=document.body.clientWidth),document.body.clientHeight&&(n=document.body.clientHeight),this.isAndroid()||this.isIPhone()||this.isTablet()||e<350&&n<500}static isTablet(){return/ipad|android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent.toLowerCase())}static isWeChat(){const e=navigator.userAgent.toLowerCase();return String(e.match(/MicroMessenger/i))==="micromessenger"}static isAndroid(){const e=navigator.userAgent;return e.indexOf("Android")>-1||e.indexOf("Linux")>-1}static isIPhone(){return/iPhone/i.test(navigator.userAgent)}static itCount(e){return n=>{for(let s=0;s<e;s++)n&&n()}}static hasLength(e,n){return D.isDefine(e)?D.isDefine(n)?e.length===n:e.length>0:!1}static capitalize(e){return e.charAt(0).toUpperCase()+e.slice(1)}static fCamelCase(e,n){return n.toUpperCase()}static camelCase(e){return e.replace(tl,"ms-").replace(el,this.fCamelCase)}static removeNull(e){return this.isObject(e)&&Object.keys(e).forEach(n=>{const s=e[n];s==null?delete e[n]:D.removeNull(s)}),e}static fillTwoDimensionalArray(e,n,s){return new Array(e).fill(s).map(r=>new Array(n).fill(s))}static numToWord(e){let n="";for(;e>0;){let s=e%26;s=s===0?s=26:s,n=String.fromCharCode(96+s)+n,e=(e-s)/26}return n.toLocaleUpperCase()}static ABCatNum(e){if(e==null||e.length===0)return Number.NaN;const n=e.toLowerCase().split(""),s=n.length;let r=0,i=0;for(let o=0;o<s;o++)i=n[o].charCodeAt(0)-96,r+=i*26**(s-o-1);return r===0?Number.NaN:r-1}static chatAtABC(e){let i="";for(;e>=0;)i=String.fromCharCode(e%26+97)+i,e=Math.floor(e/26)-1;return i.toUpperCase()}static randSort(e){for(let n=0,s=e.length;n<s;n++){const r=Number.parseInt((Math.random()*s).toString()),i=e[r];e[r]=e[n],e[n]=i}return e}static commonExtend(e,n){const s={};for(const r in e)s[r]=e[r];for(const r in n)n[r]!=null&&(s[r]=n[r]);return s}static commonExtend1(e,n){for(const s in e)n[s]==null&&(n[s]=e[s]);return n}static arrayToObject(e){const n={};return e.forEach((s,r)=>{n[r]={},s.forEach((i,o)=>{n[r][o]=i})}),n}static hasIntersectionBetweenTwoRanges(e,n,s,r){return n>=s&&r>=e}static isStartValidPosition(e){return/^[A-Za-z_]/.test(e)}static isValidParameter(e){const n=/[~!@#$%^&*()+=\-{}\[\]\|:;"'<>,?\/ ]+/.test(e),s=e.length<=255;return!n&&s}static set(e,n,s){const r=n.split("."),i=r.pop();r.forEach(o=>{e[o]||(e[o]={}),e=e[o]}),i&&(e[i]=s)}}function nl(t){if(!t)return;const{actualRow:e,actualColumn:n,isMerged:s,isMergedMainCell:r,mergeInfo:i}=t;let{startY:o,endY:l,startX:a,endX:h}=t,c=e,u=n,d=e,f=n;if(s&&i){const{startRow:m,startColumn:p,endRow:y,endColumn:P,startY:Z,endY:gt,startX:ht,endX:E}=i;c=m,u=p,d=y,f=P,o=Z,l=gt,a=ht,h=E}return r&&(o=i.startY,l=i.endY,a=i.startX,h=i.endX,d=i.endRow,f=i.endColumn),{startRow:c,startColumn:u,endRow:d,endColumn:f,startY:o,endY:l,startX:a,endX:h}}function sl(t){if(!t)return;const{actualRow:e,actualColumn:n,isMerged:s,isMergedMainCell:r,startRow:i,startColumn:o,endRow:l,endColumn:a}=t;let h=e,c=n,u=e,d=n;return(s||r)&&(h=i,c=o,u=l,d=a),{startRow:h,startColumn:c,endRow:u,endColumn:d}}function rl(t){var n;return!t||(((n=t==null?void 0:t.v)==null?void 0:n.toString())||"").length===0&&!t.p}function re(t){if(t){if(t.rgb)return t.rgb;if(t.th)return new An().setThemeColor(t.th).asThemeColor().asRgbColor().getCssString()}return null}function il(t){return D.isString(t)&&t.substring(0,1)==="="&&t.length>1}function ol(t){return D.isString(t)&&t.length>0}function ll(t){return""}function al(t,e=!1){var i;let n="";const s=new Map([["ff",()=>{t.ff&&(n+=`font-family: ${t.ff}; `)}],["fs",()=>{if(t.fs){let o=t.fs;t.va&&(o/=2),n+=`font-size: ${o}pt; `}}],["it",()=>{t.it&&(n+="font-style: italic; ")}],["bl",()=>{t.bl&&(n+="font-weight: bold; ")}],["ul",()=>{var o;(o=t.ul)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(l,a)=>`${a} underline`):n+="text-decoration-line: underline; ",t.ul.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${re(t.ul.cl)}; `),t.ul.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${t.ul.t} `))}],["st",()=>{var o;(o=t.st)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(l,a)=>`${a} line-through`):n+="text-decoration-line: line-through; ",t.st.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${re(t.st.cl)}; `),t.st.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${t.st.t} `))}],["ol",()=>{var o;(o=t.ol)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(l,a)=>`${a} overline`):n+="text-decoration-line: overline; ",t.ol.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${re(t.ol.cl)}; `),t.ol.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${t.ol.t} `))}],["bg",()=>{t.bg&&(n+=`background: ${re(t.bg)}; `)}],["bd",()=>{var o,l,a,h,c,u,d,f,m,p,y,P;(o=t.bd)!=null&&o.b&&(n+=`border-bottom: ${ln((l=t.bd)==null?void 0:l.b.s)} ${(a=re(t.bd.b.cl))!=null?a:""}; `),(h=t.bd)!=null&&h.t&&(n+=`border-top: ${ln((c=t.bd)==null?void 0:c.t.s)} ${(u=re(t.bd.t.cl))!=null?u:""}; `),(d=t.bd)!=null&&d.r&&(n+=`border-right: ${ln((f=t.bd)==null?void 0:f.r.s)} ${(m=re(t.bd.r.cl))!=null?m:""}; `),(p=t.bd)!=null&&p.l&&(n+=`border-left: ${ln((y=t.bd)==null?void 0:y.l.s)} ${(P=re(t.bd.l.cl))!=null?P:""}; `)}],["cl",()=>{t.cl&&(n+=`color: ${re(t.cl)}; `)}],["va",()=>{t.va===ye.SUBSCRIPT?n+="vertical-align: sub; ":t.va===ye.SUPERSCRIPT&&(n+="vertical-align: super; ")}],["td",()=>{t.td===Xe.LEFT_TO_RIGHT?n+="direction: ltr; ":t.td===Xe.RIGHT_TO_LEFT&&(n+="direction: rtl; ")}],["tr",()=>{var o,l,a;t.tr&&(n+=`data-rotate: (${(o=t.tr)==null?void 0:o.a}deg${(l=t.tr)!=null&&l.v?` ,${(a=t.tr)==null?void 0:a.v}`:""});`)}],["ht",()=>{t.ht===Se.LEFT?n+="text-align: left; ":t.ht===Se.RIGHT?n+="text-align: right; ":t.ht===Se.CENTER?n+="text-align: center; ":t.ht===Se.JUSTIFIED&&(n+="text-align: justify; ")}],["vt",()=>{t.vt===De.BOTTOM?n+="vertical-align: bottom; ":t.vt===De.TOP?n+="vertical-align: top; ":t.vt===De.MIDDLE&&(n+="vertical-align: middle; ")}],["tb",()=>{t.tb===qe.CLIP?n+="white-space: clip; ":t.tb===qe.WRAP&&(n+="white-space: normal;")}],["pd",()=>{var c,u,d,f,m,p,y,P;const o=`${(c=t.pd)==null?void 0:c.b}pt`,l=`${(u=t.pd)==null?void 0:u.t}pt`,a=`${(d=t.pd)==null?void 0:d.l}pt`,h=`${(f=t.pd)==null?void 0:f.r}pt`;(m=t.pd)!=null&&m.b&&(n+=`padding-bottom: ${o}; `),(p=t.pd)!=null&&p.t&&(n+=`padding-top: ${l}; `),(y=t.pd)!=null&&y.l&&(n+=`padding-left: ${a}; `),(P=t.pd)!=null&&P.r&&(n+=`padding-right: ${h}; `)}]]),r=["bd","tr","tb"];for(const o in t)e&&r.includes(o)||(i=s.get(o))==null||i();return n}function ln(t){let e="";return t===dt.NONE?e="none":t===dt.THIN?e="0.5pt solid":t===dt.HAIR?e="0.5pt double":t===dt.DOTTED?e="0.5pt dotted":t===dt.DASHED||t===dt.DASH_DOT?e="0.5pt dashed":t===dt.DASH_DOT_DOT?e="0.5pt dotted":t===dt.DOUBLE?e="0.5pt double":t===dt.MEDIUM?e="1pt solid":t===dt.MEDIUM_DASHED||t===dt.MEDIUM_DASH_DOT?e="1pt dashed":t===dt.MEDIUM_DASH_DOT_DOT?e="1pt dotted":t===dt.SLANT_DASH_DOT?e="0.5pt dashed":t===dt.THICK&&(e="1.5pt solid"),e}function ul(t){let e=0;if(t=t.trim(),t==="none")e=dt.NONE;else if(t==="0.5pt solid")e=dt.THIN;else if(t==="0.5pt double")e=dt.HAIR;else if(t==="0.5pt dotted")e=dt.DOTTED;else if(t==="0.5pt dashed")e=dt.DASHED;else if(t==="1pt solid")e=dt.MEDIUM;else if(t==="1pt dashed")e=dt.MEDIUM_DASHED;else if(t==="1pt dotted")e=dt.MEDIUM_DASH_DOT_DOT;else if(t==="1.5pt solid")e=dt.THICK;else if(!t.includes("none"))e=dt.THIN;else return dt.NONE;return e}function cl(t,e){let n=t.body;if(e){const{headers:s,footers:r}=t;s!=null&&s[e]?n=s[e].body:r!=null&&r[e]&&(n=r[e].body)}return n}function hl(t){const{startRow:e,endRow:n,startColumn:s,endColumn:r,rangeType:i}=t;return!(e<0||s<0||n<0||r<0||!(Number.isNaN(e)&&Number.isNaN(n))&&i===rt.COLUMN||!(Number.isNaN(s)&&Number.isNaN(r))&&i===rt.ROW||i!==rt.ROW&&i!==rt.COLUMN&&(Number.isNaN(s)||Number.isNaN(e)||Number.isNaN(r)||Number.isNaN(n)))}function dl(t,e){return{startRow:t,endRow:t,startColumn:e,endColumn:e}}function us(t,e){return Object.prototype.toString.call(t)===Object.prototype.toString.call(e)?Object.prototype.toString.call(t)==="[object Object]"||Object.prototype.toString.call(t)==="[object Array]"?Object.keys(t).length!==Object.keys(e).length?!1:Object.keys(t).every(n=>us(t[n],e[n])):t===e:!1}function Yr(t,e){const n=t.ts||{},s=e.ts||{};return t.sId!==e.sId?!1:us(n,s)}function fl(t,e){return e.some(n=>t.indexOf(n)>-1)}function cs(t,e,n,s){if(t>e&&([t,e]=[e,t]),n>s&&([n,s]=[s,n]),e<n||s<t)return[t,e];n<t&&(n=t),s>e&&(s=e);const r=s-n+1;let i=[];return t===n?i=[s+1-r,e-r]:e===s?i=[t,n-1]:i=[t,e-r],i}function _l(t){if(t==null)return!1;const e=t.bullet;return(e==null?void 0:e.listId)!=null}function gl(t){if(t==null)return!1;const e=t.paragraphStyle;return zr(e)}function zr(t){return!(t==null||(t.indentStart==null||t.indentStart===0)&&t.hanging==null||t.hanging===0)}function Xr(t,e,n){return t.slice(0,e)+n+t.slice(e)}function qr(t,e,n){return e>n?t:t.slice(0,e)+t.slice(n)}function ml(t){return t===null||t.toString().replace(/\s/g,"")===""||typeof t=="boolean"?!1:!isNaN(t)}function pl(t){let e=0;for(let n=0;n<t.length;n++)e=t.charCodeAt(n)+(e<<6)+(e<<16)-e;return e>>>0}function Ps(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],s=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&s>=t.length&&(t=void 0),{value:t&&t[s++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function xs(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var s=n.call(t),r,i=[],o;try{for(;(e===void 0||e-- >0)&&!(r=s.next()).done;)i.push(r.value)}catch(l){o={error:l}}finally{try{r&&!r.done&&(n=s.return)&&n.call(s)}finally{if(o)throw o.error}}return i}function ks(t,e,n){if(n||arguments.length===2)for(var s=0,r=e.length,i;s<r;s++)(i||!(s in e))&&(i||(i=Array.prototype.slice.call(e,0,s)),i[s]=e[s]);return t.concat(i||Array.prototype.slice.call(e))}function je(t){return typeof t=="function"}function El(t){var e=function(s){Error.call(s),s.stack=new Error().stack},n=t(e);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var $n=El(function(t){return function(n){t(this),this.message=n?n.length+` errors occurred during unsubscription:
|
|
1
|
+
"use strict";var Co=Object.defineProperty;var Io=(t,e,n)=>e in t?Co(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var _=(t,e,n)=>Io(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const it=require("rxjs"),un=require("rxjs/operators"),ut=require("@wendellhu/redi");function Oo(t,e){for(var n=0;n<e.length;n++){const s=e[n];if(typeof s!="string"&&!Array.isArray(s)){for(const r in s)if(r!=="default"&&!(r in t)){const i=Object.getOwnPropertyDescriptor(s,r);i&&Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:()=>s[r]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}function So(){No()}const sn=typeof global<"u"?global:typeof self<"u"?self:window;function No(){typeof sn.requestIdleCallback!="function"&&(sn.requestIdleCallback=function(n){const s=Date.now();return setTimeout(function(){const i=Math.max(0,50-(Date.now()-s));n({didTimeout:i===0,timeRemaining(){return i}})},1)}),typeof sn.cancelIdleCallback!="function"&&(sn.cancelIdleCallback=function(n){clearTimeout(n)})}const bo="__default_document_sub_component_id20231101__",Fe=2,Js=1;function vo(t,e){if(e==null||t==null)return!0;const{left:n=0,top:s=0,height:r=0,width:i=0,angle:o=0}=e,{left:l=0,top:a=0,height:h=0,width:c=0,angle:u=0}=t,d=c,f=h,m=i,p=r;return Math.abs(l-n)>Fe||Math.abs(a-s)>Fe||Math.abs(d-m)>Fe||Math.abs(f-p)>Fe||Math.abs(u-o)>Js}function Zs(t,e){let n=0,s=t.length-1;for(;n<=s;){const r=Math.floor((s+n)/2);if(e<t[r]&&(r===0||e>=t[r-1]))return r;if(e>=t[r])n=r+1;else if(e<t[r])s=r-1;else return-1}return-1}function Qs(t,e){let n=0,s=0,r=0,i=-1,o=t.length-1;for(;n<t.length&&o>=0&&o>=n;){if(s=t[o],o===0?r=0:r=t[o-1],e>=r&&e<=s){i=o;break}if(s=t[n],n===0?r=0:r=t[n-1],e>=r&&e<s){i=n;break}n++,o--}return i}function Ao(t,e){let n=t.length-1;return e<0?-1:e<t[0]?0:e>t[t.length-1]?Number.POSITIVE_INFINITY:(t.length<40||e<=t[20]||e>=t[n-20]?n=Qs(t,e):n=Zs(t,e),n)}function wo(t){const e=new Blob([t],{type:"text/javascript"});return window.URL.createObjectURL(e)}var tr=(t=>(t[t.DEFAULT_SERIES=0]="DEFAULT_SERIES",t[t.ALTERNATE_SERIES=1]="ALTERNATE_SERIES",t))(tr||{}),dt=(t=>(t[t.NONE=0]="NONE",t[t.THIN=1]="THIN",t[t.HAIR=2]="HAIR",t[t.DOTTED=3]="DOTTED",t[t.DASHED=4]="DASHED",t[t.DASH_DOT=5]="DASH_DOT",t[t.DASH_DOT_DOT=6]="DASH_DOT_DOT",t[t.DOUBLE=7]="DOUBLE",t[t.MEDIUM=8]="MEDIUM",t[t.MEDIUM_DASHED=9]="MEDIUM_DASHED",t[t.MEDIUM_DASH_DOT=10]="MEDIUM_DASH_DOT",t[t.MEDIUM_DASH_DOT_DOT=11]="MEDIUM_DASH_DOT_DOT",t[t.SLANT_DASH_DOT=12]="SLANT_DASH_DOT",t[t.THICK=13]="THICK",t))(dt||{}),er=(t=>(t.TOP="top",t.BOTTOM="bottom",t.LEFT="left",t.RIGHT="right",t.NONE="none",t.ALL="all",t.OUTSIDE="outside",t.INSIDE="inside",t.HORIZONTAL="horizontal",t.VERTICAL="vertical",t.TLBR="tlbr",t.TLBC_TLMR="tlbc_tlmr",t.TLBR_TLBC_TLMR="tlbr_tlbc_tlmr",t.BLTR="bl_tr",t.MLTR_BCTR="mltr_bctr",t))(er||{}),zt=(t=>(t[t.UNSUPPORTED=0]="UNSUPPORTED",t[t.RGB=1]="RGB",t[t.HEX=2]="HEX",t[t.THEME=3]="THEME",t))(zt||{}),nr=(t=>(t[t.ON=0]="ON",t[t.OFF=1]="OFF",t))(nr||{}),sr=(t=>(t[t.PASTE_NORMAL=0]="PASTE_NORMAL",t[t.PASTE_NO_BORDERS=1]="PASTE_NO_BORDERS",t[t.PASTE_FORMAT=2]="PASTE_FORMAT",t[t.PASTE_FORMULA=3]="PASTE_FORMULA",t[t.PASTE_DATA_VALIDATION=4]="PASTE_DATA_VALIDATION",t[t.PASTE_VALUES=5]="PASTE_VALUES",t[t.PASTE_CONDITIONAL_FORMATTING=6]="PASTE_CONDITIONAL_FORMATTING",t[t.PASTE_COLUMN_WIDTHS=7]="PASTE_COLUMN_WIDTHS",t))(sr||{}),rr=(t=>(t[t.DOCUMENT=0]="DOCUMENT",t[t.PROJECT=1]="PROJECT",t))(rr||{}),ir=(t=>(t[t.COLUMNS=0]="COLUMNS",t[t.ROWS=1]="ROWS",t))(ir||{}),or=(t=>(t[t.UP=0]="UP",t[t.RIGHT=1]="RIGHT",t[t.DOWN=2]="DOWN",t[t.LEFT=3]="LEFT",t))(or||{});function To(t){switch(t){case 3:return 1;case 1:return 3;case 0:return 2;case 2:return 0}}var lr=(t=>(t[t.NUMBER_FORMAT_TYPE_UNSPECIFIED=0]="NUMBER_FORMAT_TYPE_UNSPECIFIED",t[t.TEXT=1]="TEXT",t[t.NUMBER=2]="NUMBER",t[t.PERCENT=3]="PERCENT",t[t.CURRENCY=4]="CURRENCY",t[t.DATE=5]="DATE",t[t.TIME=6]="TIME",t[t.DATE_TIME=7]="DATE_TIME",t[t.SCIENTIFIC=8]="SCIENTIFIC",t))(lr||{}),ar=(t=>(t[t.INTERPOLATION_POINT_TYPE_UNSPECIFIED=0]="INTERPOLATION_POINT_TYPE_UNSPECIFIED",t[t.MIN=1]="MIN",t[t.MAX=2]="MAX",t[t.NUMBER=3]="NUMBER",t[t.PERCENT=4]="PERCENT",t[t.PERCENTILE=5]="PERCENTILE",t))(ar||{}),we=(t=>(t.EN_US="enUS",t.ZH_CN="zhCN",t.RU_RU="ruRU",t))(we||{}),ur=(t=>(t[t.RANGE=0]="RANGE",t[t.SHEET=1]="SHEET",t))(ur||{}),cr=(t=>(t[t.RELATIVE_DATE_UNSPECIFIED=0]="RELATIVE_DATE_UNSPECIFIED",t[t.PAST_YEAR=1]="PAST_YEAR",t[t.PAST_MONTH=2]="PAST_MONTH",t[t.PAST_WEEK=3]="PAST_WEEK",t[t.YESTERDAY=4]="YESTERDAY",t[t.TODAY=5]="TODAY",t[t.TOMORROW=6]="TOMORROW",t))(cr||{}),Nn=(t=>(t[t.GRID=0]="GRID",t[t.KANBAN=1]="KANBAN",t[t.GANTT=2]="GANTT",t))(Nn||{}),ze=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=2]="RIGHT_TO_LEFT",t))(ze||{}),hr=(t=>(t[t.DASH=0]="DASH",t[t.DASH_DOT_DOT_HEAVY=1]="DASH_DOT_DOT_HEAVY",t[t.DASH_DOT_HEAVY=2]="DASH_DOT_HEAVY",t[t.DASHED_HEAVY=3]="DASHED_HEAVY",t[t.DASH_LONG=4]="DASH_LONG",t[t.DASH_LONG_HEAVY=5]="DASH_LONG_HEAVY",t[t.DOT_DASH=6]="DOT_DASH",t[t.DOT_DOT_DASH=7]="DOT_DOT_DASH",t[t.DOTTED=8]="DOTTED",t[t.DOTTED_HEAVY=9]="DOTTED_HEAVY",t[t.DOUBLE=10]="DOUBLE",t[t.NONE=11]="NONE",t[t.SINGLE=12]="SINGLE",t[t.THICK=13]="THICK",t[t.WAVE=14]="WAVE",t[t.WAVY_DOUBLE=15]="WAVY_DOUBLE",t[t.WAVY_HEAVY=16]="WAVY_HEAVY",t[t.WORDS=17]="WORDS",t))(hr||{}),Se=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.LEFT=1]="LEFT",t[t.CENTER=2]="CENTER",t[t.RIGHT=3]="RIGHT",t[t.JUSTIFIED=4]="JUSTIFIED",t))(Se||{}),De=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TOP=1]="TOP",t[t.MIDDLE=2]="MIDDLE",t[t.BOTTOM=3]="BOTTOM",t))(De||{}),Xe=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.OVERFLOW=1]="OVERFLOW",t[t.CLIP=2]="CLIP",t[t.WRAP=3]="WRAP",t))(Xe||{}),mn=(t=>(t[t.NORMAL=0]="NORMAL",t[t.ITALIC=1]="ITALIC",t))(mn||{}),pn=(t=>(t[t.NORMAL=0]="NORMAL",t[t.BOLD=1]="BOLD",t))(pn||{}),ye=(t=>(t[t.NORMAL=1]="NORMAL",t[t.SUBSCRIPT=2]="SUBSCRIPT",t[t.SUPERSCRIPT=3]="SUPERSCRIPT",t))(ye||{}),q=(t=>(t[t.FALSE=0]="FALSE",t[t.TRUE=1]="TRUE",t))(q||{}),Ne=(t=>(t[t.STRING=1]="STRING",t[t.NUMBER=2]="NUMBER",t[t.BOOLEAN=3]="BOOLEAN",t[t.FORCE_STRING=4]="FORCE_STRING",t))(Ne||{}),Ht=(t=>(t[t.DARK1=0]="DARK1",t[t.LIGHT1=1]="LIGHT1",t[t.DARK2=2]="DARK2",t[t.LIGHT2=3]="LIGHT2",t[t.ACCENT1=4]="ACCENT1",t[t.ACCENT2=5]="ACCENT2",t[t.ACCENT3=6]="ACCENT3",t[t.ACCENT4=7]="ACCENT4",t[t.ACCENT5=8]="ACCENT5",t[t.ACCENT6=9]="ACCENT6",t[t.HYPERLINK=10]="HYPERLINK",t[t.FOLLOWED_HYPERLINK=11]="FOLLOWED_HYPERLINK",t))(Ht||{}),bn=(t=>(t.OFFICE="Office",t.OFFICE_2007_2010="Office 2007-2010",t.GRAYSCALE="Grayscale",t.BLUE_WARM="Blue Warm",t.BLUE="Blue",t.BLUE_II="Blue II",t.BLUE_GREEN="Blue Green",t.GREEN="Green",t.GREEN_YELLOW="Green Yellow",t.YELLOW="Yellow",t.YELLOW_ORANGE="Yellow Orange",t.ORANGE="Orange",t.ORANGE_RED="Orange Red",t.RED_ORANGE="Red Orange",t.RED="Red",t.RED_VIOLET="Red Violet",t.VIOLET="Violet",t.VIOLET_II="Violet II",t.MEDIAN="Median",t.PAPER="Paper",t.MARQUEE="Marquee",t.SLIPSTREAM="Slipstream",t.Aspect="Aspect",t))(bn||{}),dr=(t=>(t.Line="line",t.LineInv="lineInv",t.Triangle="triangle",t.RtTriangle="rtTriangle",t.Rect="rect",t.Diamond="diamond",t.Parallelogram="parallelogram",t.Trapezoid="trapezoid",t.NonIsocelesTrapezoid="nonIsocelesTrapezoid",t.Pentagon="pentagon",t.Hexagon="hexagon",t.Heptagon="heptagon",t.Octagon="octagon",t.Decagon="decagon",t.Dodecagon="dodecagon",t.Star4="star4",t.Star5="star5",t.Star6="star6",t.Star7="star7",t.Star8="star8",t.Star10="star10",t.Star12="star12",t.Star16="star16",t.Star24="star24",t.Star32="star32",t.RoundRect="roundRect",t.Round1Rect="round1Rect",t.Round2SameRect="round2SameRect",t.Round2DiagRect="round2DiagRect",t.Ellipse="ellipse",t))(dr||{}),fr=(t=>(t.RightArrow="rightArrow",t.LeftArrow="leftArrow",t.UpArrow="upArrow",t.DownArrow="downArrow",t.LeftRightArrow="leftRightArrow",t.UpDownArrow="upDownArrow",t.QuadArrow="quadArrow",t.LeftRightUpArrow="leftRightUpArrow",t.BentArrow="bentArrow",t.UturnArrow="uturnArrow",t.CircularArrow="circularArrow",t.NotchedRightArrow="notchedRightArrow",t.HomePlate="homePlate",t.Chevron="chevron",t.LeftCircularArrow="leftCircularArrow",t.LeftRightCircularArrow="leftRightCircularArrow",t))(fr||{}),_r=(t=>(t.Plaque="plaque",t.Can="can",t.Cube="cube",t.Bevel="bevel",t.Donut="donut",t.NoSmoking="noSmoking",t.BlockArc="blockArc",t.FoldedCorner="foldedCorner",t))(_r||{}),gr=(t=>(t.SmileyFace="smileyFace",t.Heart="heart",t.LightningBolt="lightningBolt",t.Sun="sun",t.Moon="moon",t.Cloud="cloud",t.Arc="arc",t.Backpack="backpack",t.Frame="frame",t.HalfFrame="halfFrame",t.Corner="corner",t.Chord="chord",t.Pie="pie",t.Teardrop="teardrop",t.WedgeRectCallout="wedgeRectCallout",t.WedgeRRectCallout="wedgeRRectCallout",t.WedgeEllipseCallout="wedgeEllipseCallout",t.CloudCallout="cloudCallout",t.BorderCallout1="borderCallout1",t.BorderCallout2="borderCallout2",t.BorderCallout3="borderCallout3",t.AccentCallout1="accentCallout1",t.AccentCallout2="accentCallout2",t.AccentCallout3="accentCallout3",t.Callout1="callout1",t.Callout2="callout2",t.Callout3="callout3",t.ActionButtonBackPrevious="actionButtonBackPrevious",t.ActionButtonEnd="actionButtonEnd",t.ActionButtonForwardNext="actionButtonForwardNext",t.ActionButtonHelp="actionButtonHelp",t.ActionButtonHome="actionButtonHome",t.ActionButtonInformation="actionButtonInformation",t.ActionButtonMovie="actionButtonMovie",t.ActionButtonReturn="actionButtonReturn",t.ActionButtonSound="actionButtonSound",t))(gr||{});const mr={[bn.OFFICE]:{[Ht.ACCENT1]:"#4472C4",[Ht.ACCENT2]:"#ED7D31",[Ht.ACCENT3]:"#A5A5A5",[Ht.ACCENT4]:"#70AD47",[Ht.ACCENT5]:"#5B9BD5",[Ht.ACCENT6]:"#70AD47",[Ht.DARK1]:"#000000",[Ht.DARK2]:"#44546A",[Ht.LIGHT1]:"#FFFFFF",[Ht.LIGHT2]:"#E7E6E6",[Ht.HYPERLINK]:"#0563C1",[Ht.FOLLOWED_HYPERLINK]:"#954F72"}};class vn{constructor(){_(this,"_themeValue",Ht.LIGHT1);_(this,"_themeColors");_(this,"_themeTint");_(this,"_rgbValue","");_(this,"_colorType");this._colorType=zt.UNSUPPORTED,this._themeColors=bn.OFFICE,this._themeTint=0}asRgbColor(){return new En(this._rgbValue,this)}asThemeColor(){return new Rn(this._themeValue,this._themeTint,this._themeColors,this)}build(){switch(this._colorType){case zt.THEME:return this.asThemeColor();case zt.RGB:return this.asRgbColor();case zt.UNSUPPORTED:throw new Error("unsupported color type")}}setRgbColor(e){return this._colorType=zt.RGB,this._rgbValue=e,this}setThemeColors(e){this._colorType=zt.THEME,this._themeColors=e}setThemeTint(e){this._colorType=zt.THEME,this._themeTint=e}setThemeColor(e){return this._colorType=zt.THEME,this._themeValue=e,this}getColorType(){return this._colorType}}class be{constructor(e){_(this,"_builder");this._builder=e}static rgbColorToHexValue(e){return`#${((1<<24)+(e.getRed()<<16)+(e.getGreen()<<8)+e.getBlue()).toString(16).slice(1)}`}static hexValueToRgbColor(e){e?e.indexOf("#")>-1&&(e=e.substring(1)):e="#000000";const n=+`0x${e[0]}${e[1]}`,s=+`0x${e[2]}${e[3]}`,r=+`0x${e[4]}${e[5]}`;return new vn().setRgbColor(`rgb(${n},${s},${r})`).asRgbColor()}static hexToRgbString(e){const n=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;e=e.replace(n,(i,o,l,a)=>o+o+l+l+a+a);const s=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);let r=null;if(s){const i=Number.parseInt(s[1],16),o=Number.parseInt(s[2],16),l=Number.parseInt(s[3],16);r=`rgba(${i},${o},${l})`}return r}asRgbColor(){return this._builder.asRgbColor()}asThemeColor(){return this._builder.asThemeColor()}getColorType(){return this._builder.getColorType()}clone(){return new be(this._builder)}equals(e){return!1}}class pr{constructor(e){_(this,"_saturation",0);_(this,"_hue",0);_(this,"_lightness",0);_(this,"_alpha",0);const n=e.getRed()/255,s=e.getGreen()/255,r=e.getBlue()/255,i=e.getAlpha()/255,o=Math.min(n,Math.min(s,r)),l=Math.max(n,Math.max(s,r)),a=l-o;if(l===o){this._hue=0,this._saturation=0,this._lightness=l;return}this._lightness=(o+l)/2,this._lightness<.5?this._saturation=a/(l+o):this._saturation=a/(2-l-o),n===l&&(this._hue=(s-r)/a),s===l&&(this._hue=2+(r-n)/a),r===l&&(this._hue=4+(n-s)/a),this._hue*=60,this._hue<0&&(this._hue+=360),this._alpha=i}asRgbColor(){const e=new vn;if(this._saturation===0)return e.setRgbColor(`rgba(${this._lightness*255},${this._lightness*255},${this._lightness*255},${this._alpha*255})`),e.asRgbColor();let n;this._lightness<.5?n=this._lightness*(1+this._saturation):n=this._lightness+this._saturation-this._lightness*this._saturation;const s=2*this._lightness-n,r=this._hue/360,i=r+1/3,o=this.setColor(n,s,i),l=this.setColor(n,s,r),a=r-1/3,h=this.setColor(n,s,a);return e.setRgbColor(`rgba(${Math.round(o*255)},${Math.round(l*255)},${Math.round(h*255)},${this._alpha*255})`),e.asRgbColor()}getLightness(){return this._lightness}getHue(){return this._hue}getSaturation(){return this._saturation}getAlpha(){return this._alpha}setColor(e,n,s){s<0&&(s+=1),s>1&&(s-=1);let r;return 6*s<1?r=n+(e-n)*6*s:2*s<1?r=e:3*s<2?r=n+(e-n)*(2/3-s)*6:r=n,r}setLightness(e){this._lightness=e}}const Yt=class Yt extends be{constructor(n,s){super(s);_(this,"_cssString");_(this,"_red");_(this,"_green");_(this,"_blue");_(this,"_alpha");let r=n.match(Yt.RGBA_EXTRACT);if(r){const i=+r[1],o=+r[2],l=+r[3],a=+r[4];this._cssString=n,this._red=i,this._green=o,this._blue=l,this._alpha=a;return}if(r=n.match(Yt.RGB_EXTRACT),r){const i=+r[1],o=+r[2],l=+r[3];this._cssString=n,this._red=i,this._green=o,this._blue=l,this._alpha=1;return}throw new Error("Invalid rgba or rgb color")}asHexString(){return be.rgbColorToHexValue(this)}getRed(){let n=this._red+Yt.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getGreen(){let n=this._green+Yt.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getBlue(){let n=this._blue+Yt.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getAlpha(){return this._alpha}getColorType(){return zt.RGB}clone(){return new Yt(this._cssString,this._builder)}asThemeColor(){throw new Error("rgb color not support to themeColor")}equals(n){return n instanceof Yt?n._red===this._red&&n._blue===this._blue&&n._green===this._green&&n._alpha===this._alpha:!1}getCssString(){return this._cssString}};_(Yt,"RGB_COLOR_AMT",0),_(Yt,"RGBA_EXTRACT",new RegExp("\\s*rgba\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d.\\d|\\d\\s*)\\)\\s*")),_(Yt,"RGB_EXTRACT",new RegExp("\\s*rgb\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*)\\)\\s*"));let En=Yt;const fe=class fe extends be{constructor(n,s,r,i){super(i);_(this,"_themeColorType");_(this,"_themeTint");_(this,"_themeColors");this._themeColorType=n,this._themeTint=s,this._themeColors=r}lumValue(n,s){if(n==null)return s;let r;return n<0?r=s*(1+n):r=s*(1-n)+(255-255*(1-n)),r}asRgbColor(){const n=mr[this._themeColors];if(n==null)throw new Error("not find themeColors type");const s=n[this._themeColorType];if(s==null)throw new Error("not find themeColors value");let r;if(fe._cacheThemeColor.has(this._themeColors)){if(r=fe._cacheThemeColor.get(this._themeColors),r.has(this._themeColorType))return r.get(this._themeColorType)}else r=new Map,fe._cacheThemeColor.set(this._themeColors,r);const i=new pr(be.hexValueToRgbColor(s));i.setLightness(this.lumValue(this._themeTint,i.getLightness()*255)/255);const o=i.asRgbColor();return r.set(this._themeColorType,o),o}clone(){return new fe(this._themeColorType,this._themeTint,this._themeColors,this._builder)}equals(n){return n instanceof fe?n._themeColorType===this._themeColorType:!1}getColorType(){return zt.THEME}getThemeColorType(){return this._themeColorType}};_(fe,"_cacheThemeColor",new Map);let Rn=fe;const Mo="rgb(",Uo="rgba(",Kn={aliceBlue:[240,248,255],antiqueWhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blancheAlmond:[255,235,205],blue:[0,0,255],blueViolet:[138,43,226],brown:[165,42,42],burlyWood:[222,184,135],cadetBlue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornFlowerBlue:[100,149,237],cornSilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkCyan:[0,139,139],darkGoldenrod:[184,132,11],darkGray:[169,169,169],darkGreen:[0,100,0],darkGrey:[169,169,169],darkKhaki:[189,183,107],darkMagenta:[139,0,139],darkOliveGreen:[85,107,47],darkOrange:[255,140,0],darkOrchid:[153,50,204],darkRed:[139,0,0],darkSalmon:[233,150,122],darkSeaGreen:[143,188,143],darkSlateBlue:[72,61,139],darkSlateGray:[47,79,79],darkSlateGrey:[47,79,79],darkTurquoise:[0,206,209],darkViolet:[148,0,211],deepPink:[255,20,147],deepSkyBlue:[0,191,255],dimGray:[105,105,105],dimGrey:[105,105,105],dodgerBlue:[30,144,255],firebrick:[178,34,34],floralWhite:[255,255,240],forestGreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostWhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenYellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotPink:[255,105,180],indianRed:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderBlush:[255,240,245],lawnGreen:[124,252,0],lemonChiffon:[255,250,205],lightblue:[173,216,230],lightCoral:[240,128,128],lightCyan:[224,255,255],lightGoldenrodYellow:[250,250,210],lightGray:[211,211,211],lightGreen:[144,238,144],lightGrey:[211,211,211],lightPink:[255,182,193],lightSalmon:[255,160,122],lightSeaGreen:[32,178,170],lightSkyBlue:[135,206,250],lightSlateGray:[119,136,153],lightSlateGrey:[119,136,153],lightSteelBlue:[176,196,222],lightYellow:[255,255,224],lime:[0,255,0],limeGreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumAquamarine:[102,205,170],mediumBlue:[0,0,205],mediumOrchid:[186,85,211],mediumPurple:[147,112,219],mediumSeaGreen:[60,179,113],mediumSlateBlue:[123,104,238],mediumSpringGreen:[0,250,154],mediumTurquoise:[72,209,204],mediumVioletRed:[199,21,133],midBightBlue:[25,25,112],mintCream:[245,255,250],mistyRose:[255,228,225],moccasin:[255,228,181],navajoWhite:[255,222,173],navy:[0,0,128],oldLace:[253,245,230],olive:[128,128,0],oliveDrab:[107,142,35],orange:[255,165,0],orangeRed:[255,69,0],orchid:[218,112,214],paleGoldenrod:[238,232,170],paleGreen:[152,251,152],paleTurquoise:[175,238,238],paleVioletRed:[219,112,147],papayaWhip:[255,239,213],peachPuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderBlue:[176,224,230],purple:[128,0,128],rebeccaPurple:[102,51,153],red:[255,0,0],rosyBrown:[188,143,143],royalBlue:[65,105,225],saddleBrown:[139,69,19],salmon:[250,128,114],sandyBrown:[244,164,96],seaGreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyBlue:[135,206,235],slateBlue:[106,90,205],slateGray:[119,128,144],slateGrey:[119,128,144],snow:[255,255,250],springGreen:[0,255,127],steelBlue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whiteSmoke:[245,245,245],yellow:[255,255,0],yellowGreen:[154,205,5]};class te{constructor(e){_(this,"_color");_(this,"_rgbColor");_(this,"_isValid",!1);if(e==null){this._setNullColor();return}if(e instanceof te){this._color={...e._color},this._rgbColor={...e._rgbColor};return}const n=Er(e);if(n==null){this._setNullColor();return}this._color=n;const s=xo(this._color);if(s==null){this._setNullColor();return}this._rgbColor=s,this._isValid=!0}static mix(e,n,s){var h,c;s=Math.min(1,Math.max(0,s));const r=new te(e).toRgb(),i=new te(n).toRgb(),o=(h=r.a)!=null?h:1,l=(c=i.a)!=null?c:1,a={r:(i.r-r.r)*s+r.r,g:(i.g-r.g)*s+r.g,b:(i.b-r.b)*s+r.b,a:(l-o)*s+o};return new te(a)}static getContrastRatio(e,n){const s=new te(e).getLuminance(),r=new te(n).getLuminance();return(Math.max(s,r)+.05)/(Math.min(s,r)+.05)}get isValid(){return this._isValid}toRgb(){return this._rgbColor}toRgbString(){const{r:e,g:n,b:s,a:r=1}=this.toRgb(),i=r<1;return`rgb${i?"a":""}(${e},${n},${s}${i?`,${r}`:""})`}toString(){return this.toRgbString()}toHexString(e){const{r:n,g:s,b:r,a:i=1}=this.toRgb(),o=i<1,l=[rn(Math.round(n).toString(16)),rn(Math.round(s).toString(16)),rn(Math.round(r).toString(16)),rn(Math.round(i*255).toString(16))];return e&&l[0][0]===l[0][1]&&l[1][0]===l[1][1]&&l[2][0]===l[2][1]&&l[3][0]===l[3][1]?o?`#${l[0][0]}${l[1][0]}${l[2][0]}${l[3][0]}`:`#${l[0][0]}${l[1][0]}${l[2][0]}`:o?`#${l[0]}${l[1]}${l[2]}${l[3]}`:`#${l[0]}${l[1]}${l[2]}`}toHsv(){return Bo(this.toRgb())}toHsl(){return Fo(this.toRgb())}lighten(e=10){const n=this.toHsl();return n.l+=e,n.l=Math.min(Math.max(n.l,0),100),new te(n)}darken(e=10){const n=this.toHsl();return n.l-=e,n.l=Math.min(Math.max(n.l,0),100),new te(n)}setAlpha(e){return new te({...this._rgbColor,a:e})}getLuminance(){let{r:e,g:n,b:s}=this.toRgb();return e=Hn(e),n=Hn(n),s=Hn(s),Number((.2126*e+.7152*n+.0722*s).toFixed(3))}getBrightness(){const{r:e,g:n,b:s}=this.toRgb();return(e*299+n*587+s*114)/1e3}getAlpha(){var e;return(e=this._color.a)!=null?e:1}isDark(){return this.getBrightness()<128}isLight(){return!this.isDark()}_setNullColor(){this._isValid=!1,this._color={r:0,g:0,b:0,a:0},this._rgbColor={r:0,g:0,b:0,a:0}}}const rn=t=>t.length===1?`0${t}`:t,Hn=t=>(t/=255,t<=.03928?t/12.92:((t+.055)/1.055)**2.4),Er=t=>{if($o(t)){if("r"in t){const s={r:Math.round(t.r),g:Math.round(t.g),b:Math.round(t.b)};return t.a!==void 0&&(s.a=t.a),s}if("l"in t){const s={h:Math.round(t.h),s:t.s,l:t.l};return t.a!==void 0&&(s.a=t.a),s}const n={h:Math.round(t.h),s:t.s,v:t.v};return t.a!==void 0&&(n.a=t.a),n}const e=t.trim();if(Kn[e]){const n=Kn[e],s={r:Math.round(n[0]),g:Math.round(n[1]),b:Math.round(n[2])};return s.a=n[3]||1,s}if(e.startsWith("#"))return Lo(e);if(e.startsWith("rgb"))return Do(e);if(e.startsWith("hsl"))return yo(e);if(e.startsWith("hsv"))return Po(e)},Lo=t=>{const e=t.substring(1),n=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let s=e.match(n);if(!s||s.length<3)throw new Error(`The color '${t}' is illegal hex color`);s[0].length===1&&(s=s.map(i=>i+i));const r={r:Number.parseInt(s[0],16),g:Number.parseInt(s[1],16),b:Number.parseInt(s[2],16)};return s.length>3&&(r.a=Number.parseInt(s[3],16)/255),r},Do=t=>{const e=t.indexOf("(");if(e===-1)throw new Error(`The color '${t}' is illegal rgb color`);const n=t.substring(e+1,t.length-1).split(",");if(n.length<3)throw new Error(`The color '${t}' is illegal rgb color`);const s={r:Number.parseInt(n[0],10),g:Number.parseInt(n[1],10),b:Number.parseInt(n[2],10)};return n.length>3&&(s.a=Number.parseFloat(n[3])),s},yo=t=>{const e=t.indexOf("(");if(e===-1)throw new Error(`The color '${t}' is illegal hsl color`);const n=t.substring(e+1,t.length-1).split(",");if(n.length<3)throw new Error(`The color '${t}' is illegal hsl color`);const s={h:Number.parseInt(n[0],10),s:Number.parseFloat(n[1]),l:Number.parseFloat(n[2])};return n.length>3&&(s.a=Number.parseFloat(n[3])),s},Po=t=>{const e=t.indexOf("(");if(e===-1)throw new Error(`The color '${t}' is illegal hsv color`);const n=t.substring(e+1,t.length-1).split(",");if(n.length<3)throw new Error(`The color '${t}' is illegal hsv color`);const s={h:Number.parseInt(n[0],10),s:Number.parseFloat(n[1]),v:Number.parseFloat(n[2])};return n.length>3&&(s.a=Number.parseFloat(n[3])),s},xo=t=>{const e=Er(t);if(e!=null)return"r"in e?e:"l"in e?ko(e):Ho(e)},Fn=(t,e,n)=>(n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t),ko=t=>{let{h:e,s:n,l:s}=t;e/=360,n/=100,s/=100;let r=0,i=0,o=0;if(n===0)r=i=o=s;else{const a=s<.5?s*(1+n):s+n-s*n,h=2*s-a;r=Fn(h,a,e+1/3),i=Fn(h,a,e),o=Fn(h,a,e-1/3)}const l={r:Math.round(r*255),g:Math.round(i*255),b:Math.round(o*255)};return t.a!==void 0&&(l.a=t.a),l},Ho=t=>{let{h:e,s:n,v:s}=t;e=e/360*6,n/=100,s/=100;const r=Math.floor(e),i=e-r,o=s*(1-n),l=s*(1-i*n),a=s*(1-(1-i)*n),h=r%6,c=[s,l,o,o,a,s][h],u=[a,s,s,l,o,o][h],d=[o,o,a,s,s,l][h],f={r:c*255,g:u*255,b:d*255};return t.a!==void 0&&(f.a=t.a),f},Fo=t=>{let{r:e,g:n,b:s}=t;e/=255,n/=255,s/=255;const r=Math.max(e,n,s),i=Math.min(e,n,s),o=(r+i)/2;let l,a;if(r===i)l=a=0;else{const c=r-i;switch(a=o>.5?c/(2-r-i):c/(r+i),r){case e:l=(n-s)/c+(n<s?6:0);break;case n:l=(s-e)/c+2;break;default:l=(e-n)/c+4;break}l/=6}const h={h:Math.round(l*360),s:Math.round(a*100),l:Math.round(o*100)};return t.a!==void 0&&(h.a=t.a),h},Bo=t=>{let{r:e,g:n,b:s}=t;e/=255,n/=255,s/=255;const r=Math.max(e,n,s),i=Math.min(e,n,s);let o;const l=r,a=r-i,h=r===0?0:a/r;if(r===i)o=0;else{switch(r){case e:o=(n-s)/a+(n<s?6:0);break;case n:o=(s-e)/a+2;break;default:o=(e-n)/a+4;break}o/=6}const c={h:Math.round(o*360),s:Math.round(h*100),v:Math.round(l*100)};return t.a!==void 0&&(c.a=t.a),c},Wo=t=>t==null,$o=t=>!Wo(t)&&typeof t=="object";function Go(t){const e=/^#(?:[0]{3}|[0]{6})\b/,n=/^rgb\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*\)$/,s=/^rgba\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*,\s*(1|1\.0*|0?\.\d+)\)$/,r=/^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*\)$/,i=/^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/;return!!(e.test(t)||n.test(t)||s.test(t)||r.test(t)||i.test(t))}function jo(t){const e=/^#(?:[Ff]{3}|[Ff]{6})\b/,n=/^rgb\s*\(\s*255\s*,\s*255\s*,\s*255\s*\)$/,s=/^rgba\s*\(\s*255\s*,\s*255\s*,\s*255\s*,\s*(1|1\.0*|0?\.\d+)\)$/,r=/^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*\)$/,i=/^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/;return!!(e.test(t)||n.test(t)||s.test(t)||r.test(t)||i.test(t))}var xt=(t=>(t[t.COVER=0]="COVER",t[t.REPLACE=1]="REPLACE",t[t.INTERSECTION=2]="INTERSECTION",t))(xt||{});function Vo(t){return t&&(t.s!==void 0||t.p!==void 0||t.v!==void 0||t.t!==void 0||t.f!==void 0||t.si!==void 0)}function Ko(t){if(t.t!==void 0)return t.t;if(typeof t.v=="string")return Ne.STRING;if(typeof t.v=="number")return Ne.NUMBER;if(typeof t.v=="boolean")return Ne.BOOLEAN}function Yo(t){if(t==null)return!0;const{v:e,f:n,si:s,p:r,s:i,custom:o}=t;return!(!(e==null||typeof e=="string"&&e.length===0)||n!=null&&n.length>0||s!=null&&s.length>0||r!=null||o!=null)}function zo(t){return t!=null&&(typeof t=="string"||typeof t=="number"||typeof t=="boolean")}var Rr=(t=>(t[t.character=0]="character",t[t.paragraph=1]="paragraph",t[t.table=2]="table",t[t.numbering=3]="numbering",t))(Rr||{}),Cr=(t=>(t[t.TAB=0]="TAB",t[t.SPACE=1]="SPACE",t[t.NOTHING=2]="NOTHING",t))(Cr||{}),$e=(t=>(t[t.GLYPH_TYPE_UNSPECIFIED=0]="GLYPH_TYPE_UNSPECIFIED",t[t.NONE=1]="NONE",t[t.DECIMAL=2]="DECIMAL",t[t.ZERO_DECIMAL=3]="ZERO_DECIMAL",t[t.UPPER_ALPHA=4]="UPPER_ALPHA",t[t.ALPHA=5]="ALPHA",t[t.UPPER_ROMAN=6]="UPPER_ROMAN",t[t.ROMAN=7]="ROMAN",t))($e||{}),de=(t=>(t[t.BULLET_ALIGNMENT_UNSPECIFIED=0]="BULLET_ALIGNMENT_UNSPECIFIED",t[t.START=1]="START",t[t.CENTER=2]="CENTER",t[t.END=3]="END",t))(de||{}),Ir=(t=>(t[t.HYPERLINK=0]="HYPERLINK",t[t.FIELD=1]="FIELD",t[t.SDT=2]="SDT",t[t.BOOKMARK=3]="BOOKMARK",t[t.COMMENT=4]="COMMENT",t[t.CUSTOM=5]="CUSTOM",t[t.MENTION=6]="MENTION",t))(Ir||{}),Or=(t=>(t[t.DRAWING=0]="DRAWING",t[t.CUSTOM=1]="CUSTOM",t))(Or||{}),Sr=(t=>(t[t.DEFAULT=0]="DEFAULT",t[t.LINES=1]="LINES",t[t.LINES_AND_CHARS=2]="LINES_AND_CHARS",t[t.SNAP_TO_CHARS=3]="SNAP_TO_CHARS",t))(Sr||{}),Nr=(t=>(t[t.SECTION_TYPE_UNSPECIFIED=0]="SECTION_TYPE_UNSPECIFIED",t[t.CONTINUOUS=1]="CONTINUOUS",t[t.NEXT_PAGE=2]="NEXT_PAGE",t[t.EVEN_PAGE=3]="EVEN_PAGE",t[t.ODD_PAGE=4]="ODD_PAGE",t))(Nr||{}),br=(t=>(t[t.COLUMN_SEPARATOR_STYLE_UNSPECIFIED=0]="COLUMN_SEPARATOR_STYLE_UNSPECIFIED",t[t.NONE=1]="NONE",t[t.BETWEEN_EACH_COLUMN=2]="BETWEEN_EACH_COLUMN",t))(br||{}),vr=(t=>(t[t.NORMAL=0]="NORMAL",t[t.TBRL=1]="TBRL",t[t.LRTBV=2]="LRTBV",t))(vr||{}),Ar=(t=>(t[t.TEXT_RUN=0]="TEXT_RUN",t[t.AUTO_TEXT=1]="AUTO_TEXT",t[t.PAGE_BREAK=2]="PAGE_BREAK",t[t.COLUMN_BREAK=3]="COLUMN_BREAK",t[t.FOOT_NOTE_REFERENCE=4]="FOOT_NOTE_REFERENCE",t[t.HORIZONTAL_RULE=5]="HORIZONTAL_RULE",t[t.EQUATION=6]="EQUATION",t[t.DRAWING=7]="DRAWING",t[t.PERSON=8]="PERSON",t[t.RICH_LINK=9]="RICH_LINK",t))(Ar||{}),wr=(t=>(t[t.BOTH_SIDES=0]="BOTH_SIDES",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT",t[t.LARGEST=3]="LARGEST",t))(wr||{}),Tr=(t=>(t[t.INLINE=0]="INLINE",t[t.WRAP_NONE=1]="WRAP_NONE",t[t.WRAP_POLYGON=2]="WRAP_POLYGON",t[t.WRAP_SQUARE=3]="WRAP_SQUARE",t[t.WRAP_THROUGH=4]="WRAP_THROUGH",t[t.WRAP_TIGHT=5]="WRAP_TIGHT",t[t.WRAP_TOP_AND_BOTTOM=6]="WRAP_TOP_AND_BOTTOM",t))(Tr||{}),Mr=(t=>(t[t.NAMED_STYLE_TYPE_UNSPECIFIED=0]="NAMED_STYLE_TYPE_UNSPECIFIED",t[t.NORMAL_TEXT=1]="NORMAL_TEXT",t[t.TITLE=2]="TITLE",t[t.SUBTITLE=3]="SUBTITLE",t[t.HEADING_1=4]="HEADING_1",t[t.HEADING_2=5]="HEADING_2",t[t.HEADING_3=6]="HEADING_3",t[t.HEADING_4=7]="HEADING_4",t[t.HEADING_5=8]="HEADING_5",t[t.HEADING_6=9]="HEADING_6",t))(Mr||{}),Ur=(t=>(t[t.AUTO=0]="AUTO",t[t.AT_LEAST=1]="AT_LEAST",t[t.EXACT=2]="EXACT",t))(Ur||{}),Lr=(t=>(t[t.DASH_STYLE_UNSPECIFIED=0]="DASH_STYLE_UNSPECIFIED",t[t.SOLID=1]="SOLID",t[t.DOT=2]="DOT",t[t.DASH=3]="DASH",t))(Lr||{}),Dr=(t=>(t[t.TAB_STOP_ALIGNMENT_UNSPECIFIED=0]="TAB_STOP_ALIGNMENT_UNSPECIFIED",t[t.START=1]="START",t[t.CENTER=2]="CENTER",t[t.END=3]="END",t))(Dr||{}),yr=(t=>(t.EVENLY_DISTRIBUTED="0",t.FIXED_WIDTH="1",t))(yr||{}),Pr=(t=>(t[t.CONTENT_ALIGNMENT_UNSPECIFIED=0]="CONTENT_ALIGNMENT_UNSPECIFIED",t[t.CONTENT_ALIGNMENT_UNSUPPORTED=1]="CONTENT_ALIGNMENT_UNSUPPORTED",t[t.TOP=2]="TOP",t[t.MIDDLE=3]="MIDDLE",t[t.BOTTOM=4]="BOTTOM",t))(Pr||{}),xr=(t=>(t.NORMAL="normal",t.BOLD="bold",t.ITALIC="italic",t))(xr||{}),kr=(t=>(t[t.PAGE=0]="PAGE",t[t.COLUMN=1]="COLUMN",t[t.CHARACTER=2]="CHARACTER",t[t.MARGIN=3]="MARGIN",t[t.INSIDE_MARGIN=4]="INSIDE_MARGIN",t[t.OUTSIDE_MARGIN=5]="OUTSIDE_MARGIN",t[t.LEFT_MARGIN=6]="LEFT_MARGIN",t[t.RIGHT_MARGIN=7]="RIGHT_MARGIN",t))(kr||{}),Hr=(t=>(t[t.PAGE=0]="PAGE",t[t.PARAGRAPH=1]="PARAGRAPH",t[t.LINE=2]="LINE",t[t.MARGIN=3]="MARGIN",t[t.TOP_MARGIN=4]="TOP_MARGIN",t[t.BOTTOM_MARGIN=5]="BOTTOM_MARGIN",t[t.INSIDE_MARGIN=6]="INSIDE_MARGIN",t[t.OUTSIDE_MARGIN=7]="OUTSIDE_MARGIN",t))(Hr||{}),Fr=(t=>(t[t.POINT=0]="POINT",t[t.LINE=1]="LINE",t[t.CHARACTER=2]="CHARACTER",t))(Fr||{}),Br=(t=>(t[t.CENTER=0]="CENTER",t[t.INSIDE=1]="INSIDE",t[t.LEFT=2]="LEFT",t[t.OUTSIDE=3]="OUTSIDE",t[t.RIGHT=4]="RIGHT",t))(Br||{}),Wr=(t=>(t[t.BOTTOM=0]="BOTTOM",t[t.CENTER=1]="CENTER",t[t.INSIDE=2]="INSIDE",t[t.OUTSIDE=3]="OUTSIDE",t[t.TOP=4]="TOP",t))(Wr||{}),$r=(t=>(t[t.compressPunctuation=0]="compressPunctuation",t[t.compressPunctuationAndJapaneseKana=1]="compressPunctuationAndJapaneseKana",t[t.doNotCompress=2]="doNotCompress",t))($r||{}),Gr=(t=>(t[t.PORTRAIT=0]="PORTRAIT",t[t.LANDSCAPE=1]="LANDSCAPE",t))(Gr||{}),jr=(t=>(t[t.forward=0]="forward",t[t.backward=1]="backward",t[t.front=2]="front",t[t.back=3]="back",t))(jr||{}),Vr=(t=>(t[t.UNRECOGNIZED=-1]="UNRECOGNIZED",t[t.DRAWING_IMAGE=0]="DRAWING_IMAGE",t[t.DRAWING_SHAPE=1]="DRAWING_SHAPE",t[t.DRAWING_CHART=2]="DRAWING_CHART",t[t.DRAWING_TABLE=3]="DRAWING_TABLE",t[t.DRAWING_SMART_ART=4]="DRAWING_SMART_ART",t[t.DRAWING_VIDEO=5]="DRAWING_VIDEO",t[t.DRAWING_GROUP=6]="DRAWING_GROUP",t[t.DRAWING_UNIT=7]="DRAWING_UNIT",t[t.DRAWING_DOM=8]="DRAWING_DOM",t))(Vr||{}),rt=(t=>(t[t.NORMAL=0]="NORMAL",t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN",t[t.ALL=3]="ALL",t))(rt||{}),bt=(t=>(t[t.NONE=0]="NONE",t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN",t[t.ALL=3]="ALL",t))(bt||{});function Xo(t){return[t.startRow,t.startColumn,t.endRow,t.endColumn]}function qo(t,e,n){let s=!1,r=!1,i=t,o=e,l=t,a=e;if(n==null)return{actualRow:t,actualColumn:e,isMergedMainCell:r,isMerged:s,endRow:i,endColumn:o,startRow:l,startColumn:a};for(let h=0;h<n.length;h++){const{startRow:c,endRow:u,startColumn:d,endColumn:f}=n[h];if(t===c&&e===d){i=u,o=f,l=c,a=d,r=!0;break}if(t>=c&&t<=u&&e>=d&&e<=f){i=u,o=f,l=c,a=d,s=!0;break}}return{actualRow:t,actualColumn:e,isMergedMainCell:r,isMerged:s,endRow:i,endColumn:o,startRow:l,startColumn:a}}var ls=(t=>(t[t.SLIDE=0]="SLIDE",t[t.MASTER=1]="MASTER",t[t.LAYOUT=2]="LAYOUT",t[t.HANDOUT_MASTER=3]="HANDOUT_MASTER",t[t.NOTES_MASTER=4]="NOTES_MASTER",t))(ls||{}),Kr=(t=>(t[t.SHAPE=0]="SHAPE",t[t.IMAGE=1]="IMAGE",t[t.TEXT=2]="TEXT",t[t.SPREADSHEET=3]="SPREADSHEET",t[t.DOCUMENT=4]="DOCUMENT",t[t.SLIDE=5]="SLIDE",t))(Kr||{}),Yr=(t=>(t[t.RELATIVE_SLIDE_LINK_UNSPECIFIED=0]="RELATIVE_SLIDE_LINK_UNSPECIFIED",t[t.NEXT_SLIDE=1]="NEXT_SLIDE",t[t.PREVIOUS_SLIDE=2]="PREVIOUS_SLIDE",t[t.FIRST_SLIDE=3]="FIRST_SLIDE",t[t.LAST_SLIDE=4]="LAST_SLIDE",t))(Yr||{});const Jo="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Zo=t=>crypto.getRandomValues(new Uint8Array(t)),Qo=(t,e,n)=>{let s=(2<<Math.log(t.length-1)/Math.LN2)-1,r=-~(1.6*s*e/t.length);return(i=e)=>{let o="";for(;;){let l=n(r),a=r;for(;a--;)if(o+=t[l[a]&s]||"",o.length===i)return o}}},tl=(t,e=21)=>Qo(t,e,Zo),el=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=Jo[n[t]&63];return e};const nl=/^-ms-/,sl=/-([a-z])/g,he=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];class y{static stringAt(e){let n="",s=e;for(;s>=he.length;)s/=he.length,s-=1,n+=he[s%he.length];const r=e%he.length;return n+=he[r],n}static indexAt(e){let n=0;for(let s=0;s<e.length-1;s+=1){const r=e.charCodeAt(s)-65,i=e.length-1-s;n+=he.length**i+he.length*r}return n+=e.charCodeAt(e.length-1)-65,n}static deleteBlank(e){return y.isString(e)?e.replace(/\s/g,""):e}static getSystemType(){const e=navigator.userAgent,n=navigator.platform==="Win32"||navigator.platform==="Windows",s=navigator.platform==="Mac68K"||navigator.platform==="MacPPC"||navigator.platform==="Macintosh"||navigator.platform==="MacIntel";if(s)return"Mac";if(navigator.platform==="X11"&&!n&&!s)return"Unix";if(String(navigator.platform).indexOf("Linux")>-1)return"Linux";if(n){if(e.indexOf("Windows NT 5.0")>-1||e.indexOf("Windows 2000")>-1)return"Windows 2000";if(e.indexOf("Windows NT 5.1")>-1||e.indexOf("Windows XP")>-1)return"Windows XP";if(e.indexOf("Windows NT 5.2")>-1||e.indexOf("Windows 2003")>-1)return"Windows 2003";if(e.indexOf("Windows NT 6.0")>-1||e.indexOf("Windows Vista")>-1)return"Windows Vista";if(e.indexOf("Windows NT 6.1")>-1||e.indexOf("Windows 7")>-1)return"Windows 7";if(e.indexOf("Windows NT 10")>-1||e.indexOf("Windows 10")>-1)return"Windows 10";if(e.indexOf("Windows NT 11")>-1||e.indexOf("Windows 11")>-1)return"Windows 11"}return"Unknown system"}static getBrowserType(){const e=navigator.userAgent,n=e.indexOf("Opera")>-1,s=e.indexOf("compatible")>-1&&e.indexOf("MSIE")>-1&&!n,r=e.indexOf("Trident")>-1&&e.indexOf("rv:11.0")>-1,i=e.indexOf("Edge")>-1,o=e.indexOf("Firefox")>-1,l=e.indexOf("Safari")>-1&&e.indexOf("Chrome")===-1,a=e.indexOf("Chrome")>-1&&e.indexOf("Safari")>-1;if(s){new RegExp("MSIE (\\d+\\.\\d+);").test(e);const c=Number.parseFloat(RegExp.$1);return c===7?"IE7":c===8?"IE8":c===9?"IE9":c===10?"IE10":"0"}return o?"FF":n?"Opera":l?"Safari":a?"Chrome":i?"Edge":r?"IE11":"Unknown browser"}static generateRandomId(e=21,n){return n?tl(n,e)():el(e)}static getClassName(e){return e.constructor.name}static deepMerge(e,...n){n.forEach(o=>o&&i(o));function s(o,l){o.forEach((a,h)=>{var c,u;if(y.isArray(a)){const d=(c=l[h])!=null?c:[];l[h]=d,s(a,d);return}if(y.isObject(a)){const d=(u=l[h])!=null?u:{};l[h]=d,r(a,d);return}l[h]=a})}function r(o,l){Object.keys(o).forEach(a=>{var c,u;const h=o[a];if(y.isObject(h)){const d=(c=l[a])!=null?c:{};l[a]=d,r(h,d);return}if(y.isArray(h)){const d=(u=l[a])!=null?u:[];l[a]=d,s(h,d);return}l[a]=h})}function i(o){Object.keys(o).forEach(l=>{var h,c;const a=o[l];if(y.isArray(a)){const u=(h=e[l])!=null?h:[];e[l]=u,s(a,u);return}if(y.isObject(a)){const u=(c=e[l])!=null?c:{};e[l]=u,r(a,u);return}e[l]=a})}return e}static numberFixed(e,n){return Number(Number(e).toFixed(n))}static diffValue(e,n){function s(o,l){const a=y.getValueType(o),h=y.getValueType(l);return a!==h?!1:y.isArray(o)?r(o,l):y.isObject(o)?i(o,l):y.isDate(o)?o.getTime()===l.getTime():y.isRegExp(o)?o.toString()===l.toString():o===l}function r(o,l){if(e.length!==n.length)return!1;for(let a=0,h=o.length;a<h;a++){const c=o[a],u=l[a];if(!s(c,u))return!1}return!0}function i(o,l){const a=Object.keys(o),h=Object.keys(l);if(a.length!==h.length)return!1;for(const c of a){if(!h.includes(c))return!1;const u=o[c],d=l[c];if(!s(u,d))return!1}return!0}return s(e,n)}static deepClone(e){if(!this.isDefine(e))return e;if(this.isRegExp(e))return new RegExp(e);if(this.isDate(e))return new Date(e);if(this.isArray(e)){const n=[];return e.forEach((s,r)=>{n[r]=y.deepClone(s)}),n}if(this.isObject(e)){const n={};return Object.keys(e).forEach(s=>{const r=e[s];n[s]=y.deepClone(r)}),Object.setPrototypeOf(n,Object.getPrototypeOf(e)),n}return e}static getLanguage(){const e="en-US";return globalThis.navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||e}static getValueType(e){return Object.prototype.toString.apply(e)}static isDefine(e){return e!=null}static isBlank(e){return this.isDefine(e)?this.isString(e)?e.trim()==="":!1:!0}static isAssignableFrom(e,n){return e instanceof n}static isBoolean(e){return this.getValueType(e)==="[object Boolean]"}static isPlainObject(e){return this.isDefine(e)?Object.getPrototypeOf(e)===Object.getPrototypeOf({}):!1}static isFunction(e){return this.getValueType(e)==="[object Function]"}static isDate(e){return this.getValueType(e)==="[object Date]"}static isRegExp(e){return this.getValueType(e)==="[object RegExp]"}static isArray(e){return this.getValueType(e)==="[object Array]"}static isString(e){return this.getValueType(e)==="[object String]"}static isNumber(e){return this.getValueType(e)==="[object Number]"}static isStringNumber(e){return!isNaN(Number.parseFloat(e))&&isFinite(e)}static isObject(e){return this.getValueType(e)==="[object Object]"}static isEmptyObject(e){for(const n in e)return!1;return!0}static isMobile(){let e=0,n=0;return document.body.clientWidth&&(e=document.body.clientWidth),document.body.clientHeight&&(n=document.body.clientHeight),this.isAndroid()||this.isIPhone()||this.isTablet()||e<350&&n<500}static isTablet(){return/ipad|android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent.toLowerCase())}static isWeChat(){const e=navigator.userAgent.toLowerCase();return String(e.match(/MicroMessenger/i))==="micromessenger"}static isAndroid(){const e=navigator.userAgent;return e.indexOf("Android")>-1||e.indexOf("Linux")>-1}static isIPhone(){return/iPhone/i.test(navigator.userAgent)}static itCount(e){return n=>{for(let s=0;s<e;s++)n&&n()}}static hasLength(e,n){return y.isDefine(e)?y.isDefine(n)?e.length===n:e.length>0:!1}static capitalize(e){return e.charAt(0).toUpperCase()+e.slice(1)}static fCamelCase(e,n){return n.toUpperCase()}static camelCase(e){return e.replace(nl,"ms-").replace(sl,this.fCamelCase)}static removeNull(e){return this.isObject(e)&&Object.keys(e).forEach(n=>{const s=e[n];s==null?delete e[n]:y.removeNull(s)}),e}static fillTwoDimensionalArray(e,n,s){return new Array(e).fill(s).map(r=>new Array(n).fill(s))}static numToWord(e){let n="";for(;e>0;){let s=e%26;s=s===0?s=26:s,n=String.fromCharCode(96+s)+n,e=(e-s)/26}return n.toLocaleUpperCase()}static ABCatNum(e){if(e==null||e.length===0)return Number.NaN;const n=e.toLowerCase().split(""),s=n.length;let r=0,i=0;for(let o=0;o<s;o++)i=n[o].charCodeAt(0)-96,r+=i*26**(s-o-1);return r===0?Number.NaN:r-1}static chatAtABC(e){let i="";for(;e>=0;)i=String.fromCharCode(e%26+97)+i,e=Math.floor(e/26)-1;return i.toUpperCase()}static randSort(e){for(let n=0,s=e.length;n<s;n++){const r=Number.parseInt((Math.random()*s).toString()),i=e[r];e[r]=e[n],e[n]=i}return e}static commonExtend(e,n){const s={};for(const r in e)s[r]=e[r];for(const r in n)n[r]!=null&&(s[r]=n[r]);return s}static commonExtend1(e,n){for(const s in e)n[s]==null&&(n[s]=e[s]);return n}static arrayToObject(e){const n={};return e.forEach((s,r)=>{n[r]={},s.forEach((i,o)=>{n[r][o]=i})}),n}static hasIntersectionBetweenTwoRanges(e,n,s,r){return n>=s&&r>=e}static isStartValidPosition(e){return/^[A-Za-z_]/.test(e)}static isValidParameter(e){const n=/[~!@#$%^&*()+=\-{}\[\]\|:;"'<>,?\/ ]+/.test(e),s=e.length<=255;return!n&&s}static set(e,n,s){const r=n.split("."),i=r.pop();r.forEach(o=>{e[o]||(e[o]={}),e=e[o]}),i&&(e[i]=s)}}function rl(t){if(!t)return;const{actualRow:e,actualColumn:n,isMerged:s,isMergedMainCell:r,mergeInfo:i}=t;let{startY:o,endY:l,startX:a,endX:h}=t,c=e,u=n,d=e,f=n;if(s&&i){const{startRow:m,startColumn:p,endRow:x,endColumn:P,startY:Z,endY:gt,startX:ht,endX:E}=i;c=m,u=p,d=x,f=P,o=Z,l=gt,a=ht,h=E}return r&&(o=i.startY,l=i.endY,a=i.startX,h=i.endX,d=i.endRow,f=i.endColumn),{startRow:c,startColumn:u,endRow:d,endColumn:f,startY:o,endY:l,startX:a,endX:h}}function il(t){if(!t)return;const{actualRow:e,actualColumn:n,isMerged:s,isMergedMainCell:r,startRow:i,startColumn:o,endRow:l,endColumn:a}=t;let h=e,c=n,u=e,d=n;return(s||r)&&(h=i,c=o,u=l,d=a),{startRow:h,startColumn:c,endRow:u,endColumn:d}}function zr(t){var n;return!t||(((n=t==null?void 0:t.v)==null?void 0:n.toString())||"").length===0&&!t.p}function ol(t){return zr(t)&&(t==null?void 0:t.coverable)!==!1}function re(t){if(t){if(t.rgb)return t.rgb;if(t.th)return new vn().setThemeColor(t.th).asThemeColor().asRgbColor().getCssString()}return null}function ll(t){return y.isString(t)&&t.substring(0,1)==="="&&t.length>1}function al(t){return y.isString(t)&&t.length>0}function ul(t){return""}function cl(t,e=!1){var i;let n="";const s=new Map([["ff",()=>{t.ff&&(n+=`font-family: ${t.ff}; `)}],["fs",()=>{if(t.fs){let o=t.fs;t.va&&(o/=2),n+=`font-size: ${o}pt; `}}],["it",()=>{t.it&&(n+="font-style: italic; ")}],["bl",()=>{t.bl&&(n+="font-weight: bold; ")}],["ul",()=>{var o;(o=t.ul)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(l,a)=>`${a} underline`):n+="text-decoration-line: underline; ",t.ul.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${re(t.ul.cl)}; `),t.ul.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${t.ul.t} `))}],["st",()=>{var o;(o=t.st)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(l,a)=>`${a} line-through`):n+="text-decoration-line: line-through; ",t.st.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${re(t.st.cl)}; `),t.st.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${t.st.t} `))}],["ol",()=>{var o;(o=t.ol)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(l,a)=>`${a} overline`):n+="text-decoration-line: overline; ",t.ol.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${re(t.ol.cl)}; `),t.ol.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${t.ol.t} `))}],["bg",()=>{t.bg&&(n+=`background: ${re(t.bg)}; `)}],["bd",()=>{var o,l,a,h,c,u,d,f,m,p,x,P;(o=t.bd)!=null&&o.b&&(n+=`border-bottom: ${on((l=t.bd)==null?void 0:l.b.s)} ${(a=re(t.bd.b.cl))!=null?a:""}; `),(h=t.bd)!=null&&h.t&&(n+=`border-top: ${on((c=t.bd)==null?void 0:c.t.s)} ${(u=re(t.bd.t.cl))!=null?u:""}; `),(d=t.bd)!=null&&d.r&&(n+=`border-right: ${on((f=t.bd)==null?void 0:f.r.s)} ${(m=re(t.bd.r.cl))!=null?m:""}; `),(p=t.bd)!=null&&p.l&&(n+=`border-left: ${on((x=t.bd)==null?void 0:x.l.s)} ${(P=re(t.bd.l.cl))!=null?P:""}; `)}],["cl",()=>{t.cl&&(n+=`color: ${re(t.cl)}; `)}],["va",()=>{t.va===ye.SUBSCRIPT?n+="vertical-align: sub; ":t.va===ye.SUPERSCRIPT&&(n+="vertical-align: super; ")}],["td",()=>{t.td===ze.LEFT_TO_RIGHT?n+="direction: ltr; ":t.td===ze.RIGHT_TO_LEFT&&(n+="direction: rtl; ")}],["tr",()=>{var o,l,a;t.tr&&(n+=`data-rotate: (${(o=t.tr)==null?void 0:o.a}deg${(l=t.tr)!=null&&l.v?` ,${(a=t.tr)==null?void 0:a.v}`:""});`)}],["ht",()=>{t.ht===Se.LEFT?n+="text-align: left; ":t.ht===Se.RIGHT?n+="text-align: right; ":t.ht===Se.CENTER?n+="text-align: center; ":t.ht===Se.JUSTIFIED&&(n+="text-align: justify; ")}],["vt",()=>{t.vt===De.BOTTOM?n+="vertical-align: bottom; ":t.vt===De.TOP?n+="vertical-align: top; ":t.vt===De.MIDDLE&&(n+="vertical-align: middle; ")}],["tb",()=>{t.tb===Xe.CLIP?n+="white-space: clip; ":t.tb===Xe.WRAP&&(n+="white-space: normal;")}],["pd",()=>{var c,u,d,f,m,p,x,P;const o=`${(c=t.pd)==null?void 0:c.b}pt`,l=`${(u=t.pd)==null?void 0:u.t}pt`,a=`${(d=t.pd)==null?void 0:d.l}pt`,h=`${(f=t.pd)==null?void 0:f.r}pt`;(m=t.pd)!=null&&m.b&&(n+=`padding-bottom: ${o}; `),(p=t.pd)!=null&&p.t&&(n+=`padding-top: ${l}; `),(x=t.pd)!=null&&x.l&&(n+=`padding-left: ${a}; `),(P=t.pd)!=null&&P.r&&(n+=`padding-right: ${h}; `)}]]),r=["bd","tr","tb"];for(const o in t)e&&r.includes(o)||(i=s.get(o))==null||i();return n}function on(t){let e="";return t===dt.NONE?e="none":t===dt.THIN?e="0.5pt solid":t===dt.HAIR?e="0.5pt double":t===dt.DOTTED?e="0.5pt dotted":t===dt.DASHED||t===dt.DASH_DOT?e="0.5pt dashed":t===dt.DASH_DOT_DOT?e="0.5pt dotted":t===dt.DOUBLE?e="0.5pt double":t===dt.MEDIUM?e="1pt solid":t===dt.MEDIUM_DASHED||t===dt.MEDIUM_DASH_DOT?e="1pt dashed":t===dt.MEDIUM_DASH_DOT_DOT?e="1pt dotted":t===dt.SLANT_DASH_DOT?e="0.5pt dashed":t===dt.THICK&&(e="1.5pt solid"),e}function hl(t){let e=0;if(t=t.trim(),t==="none")e=dt.NONE;else if(t==="0.5pt solid")e=dt.THIN;else if(t==="0.5pt double")e=dt.HAIR;else if(t==="0.5pt dotted")e=dt.DOTTED;else if(t==="0.5pt dashed")e=dt.DASHED;else if(t==="1pt solid")e=dt.MEDIUM;else if(t==="1pt dashed")e=dt.MEDIUM_DASHED;else if(t==="1pt dotted")e=dt.MEDIUM_DASH_DOT_DOT;else if(t==="1.5pt solid")e=dt.THICK;else if(!t.includes("none"))e=dt.THIN;else return dt.NONE;return e}function dl(t,e){let n=t.body;if(e){const{headers:s,footers:r}=t;s!=null&&s[e]?n=s[e].body:r!=null&&r[e]&&(n=r[e].body)}return n}function fl(t){const{startRow:e,endRow:n,startColumn:s,endColumn:r,rangeType:i}=t;return!(e<0||s<0||n<0||r<0||!(Number.isNaN(e)&&Number.isNaN(n))&&i===rt.COLUMN||!(Number.isNaN(s)&&Number.isNaN(r))&&i===rt.ROW||i!==rt.ROW&&i!==rt.COLUMN&&(Number.isNaN(s)||Number.isNaN(e)||Number.isNaN(r)||Number.isNaN(n)))}function _l(t,e){return{startRow:t,endRow:t,startColumn:e,endColumn:e}}function as(t,e){return Object.prototype.toString.call(t)===Object.prototype.toString.call(e)?Object.prototype.toString.call(t)==="[object Object]"||Object.prototype.toString.call(t)==="[object Array]"?Object.keys(t).length!==Object.keys(e).length?!1:Object.keys(t).every(n=>as(t[n],e[n])):t===e:!1}function Xr(t,e){const n=t.ts||{},s=e.ts||{};return t.sId!==e.sId?!1:as(n,s)}function gl(t,e){return e.some(n=>t.indexOf(n)>-1)}function us(t,e,n,s){if(t>e&&([t,e]=[e,t]),n>s&&([n,s]=[s,n]),e<n||s<t)return[t,e];n<t&&(n=t),s>e&&(s=e);const r=s-n+1;let i=[];return t===n?i=[s+1-r,e-r]:e===s?i=[t,n-1]:i=[t,e-r],i}function ml(t){if(t==null)return!1;const e=t.bullet;return(e==null?void 0:e.listId)!=null}function pl(t){if(t==null)return!1;const e=t.paragraphStyle;return qr(e)}function qr(t){return!(t==null||(t.indentStart==null||t.indentStart===0)&&t.hanging==null||t.hanging===0)}function Jr(t,e,n){return t.slice(0,e)+n+t.slice(e)}function Zr(t,e,n){return e>n?t:t.slice(0,e)+t.slice(n)}function El(t){return t===null||t.toString().replace(/\s/g,"")===""||typeof t=="boolean"?!1:!isNaN(t)}function Rl(t){let e=0;for(let n=0;n<t.length;n++)e=t.charCodeAt(n)+(e<<6)+(e<<16)-e;return e>>>0}function ys(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],s=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&s>=t.length&&(t=void 0),{value:t&&t[s++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ps(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var s=n.call(t),r,i=[],o;try{for(;(e===void 0||e-- >0)&&!(r=s.next()).done;)i.push(r.value)}catch(l){o={error:l}}finally{try{r&&!r.done&&(n=s.return)&&n.call(s)}finally{if(o)throw o.error}}return i}function xs(t,e,n){if(n||arguments.length===2)for(var s=0,r=e.length,i;s<r;s++)(i||!(s in e))&&(i||(i=Array.prototype.slice.call(e,0,s)),i[s]=e[s]);return t.concat(i||Array.prototype.slice.call(e))}function Ge(t){return typeof t=="function"}function Cl(t){var e=function(s){Error.call(s),s.stack=new Error().stack},n=t(e);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var Bn=Cl(function(t){return function(n){t(this),this.message=n?n.length+` errors occurred during unsubscription:
|
|
2
2
|
`+n.map(function(s,r){return r+1+") "+s.toString()}).join(`
|
|
3
|
-
`):"",this.name="UnsubscriptionError",this.errors=n}});function Hs(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var Jr=function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,n,s,r,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var l=Ps(o),a=l.next();!a.done;a=l.next()){var h=a.value;h.remove(this)}}catch(p){e={error:p}}finally{try{a&&!a.done&&(n=l.return)&&n.call(l)}finally{if(e)throw e.error}}else o.remove(this);var c=this.initialTeardown;if(je(c))try{c()}catch(p){i=p instanceof $n?p.errors:[p]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var d=Ps(u),f=d.next();!f.done;f=d.next()){var m=f.value;try{Fs(m)}catch(p){i=i!=null?i:[],p instanceof $n?i=ks(ks([],xs(i)),xs(p.errors)):i.push(p)}}}catch(p){s={error:p}}finally{try{f&&!f.done&&(r=d.return)&&r.call(d)}finally{if(s)throw s.error}}}if(i)throw new $n(i)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)Fs(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(e)}},t.prototype._hasParent=function(e){var n=this._parentage;return n===e||Array.isArray(n)&&n.includes(e)},t.prototype._addParent=function(e){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(e),n):n?[n,e]:e},t.prototype._removeParent=function(e){var n=this._parentage;n===e?this._parentage=null:Array.isArray(n)&&Hs(n,e)},t.prototype.remove=function(e){var n=this._finalizers;n&&Hs(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}();Jr.EMPTY;function Rl(t){return t instanceof Jr||t&&"closed"in t&&je(t.remove)&&je(t.add)&&je(t.unsubscribe)}function Fs(t){je(t)?t():t.unsubscribe()}class Zr{constructor(e=!1){_(this,"skipNextObservers");_(this,"lastReturnValue");_(this,"isStopPropagation",!1);this.initialize(e)}initialize(e=!1){return this.skipNextObservers=e,this}stopPropagation(){this.isStopPropagation=!0}}function Qr(t){return t instanceof wn}class wn{constructor(e,n){this.callback=e,this.observable=n}dispose(){this.observable.remove(this)}}class Tn{constructor(e){_(this,"_observers",new Array);_(this,"_eventState");_(this,"_onObserverAdded");this._eventState=new Zr,e&&(this._onObserverAdded=e)}get observers(){return this._observers}add(e,n=!1){if(!e)return null;const s=new wn(e,this);return n?this._observers.unshift(s):this._observers.push(s),this._onObserverAdded&&this._onObserverAdded(s),s}remove(e){return e&&this._observers.indexOf(e)!==-1?(this._remove(e),!0):!1}makeObserverTopPriority(e){this._remove(e),this._observers.unshift(e)}makeObserverBottomPriority(e){this._remove(e),this._observers.push(e)}notifyObservers(e){if(!this._observers.length)return null;const n=this._eventState;n.skipNextObservers=!1,n.lastReturnValue=e,n.isStopPropagation=!1;let s=!1;for(let r=0;r<this._observers.length;r++){const i=this._observers[r];if(n.lastReturnValue=i.callback(e,n),n.isStopPropagation&&(s=!0),n.skipNextObservers)return{lastReturnValue:n.lastReturnValue,stopPropagation:s}}return{lastReturnValue:n.lastReturnValue,stopPropagation:s}}notifyObserversWithPromise(e){let n=Promise.resolve(e);if(!this._observers.length)return n;const s=this._eventState;s.skipNextObservers=!1;for(let r=0;r<this._observers.length;r++){const i=this._observers[r];s.skipNextObservers||(n=n.then(()=>i.callback(e,s)))}return n.then(()=>e)}notifyObserver(e,n){const s=this._eventState;return s.skipNextObservers=!1,e.callback(n,s),{lastReturnValue:s.lastReturnValue,stopPropagation:s.isStopPropagation}}hasObservers(){return this._observers.length>0}clear(){this._observers.forEach(e=>{e.dispose()}),this._observers=new Array,this._onObserverAdded=null}clone(){const e=new Tn;return e._observers=this._observers.slice(0),e}_remove(e){if(!e)return!1;const n=this._observers.indexOf(e);return n!==-1?(this._observers.splice(n,1),!0):!1}}function vt(t){let e=!1;return t?Rl(t)?{dispose:()=>t.unsubscribe()}:Qr(t)?{dispose:()=>{e||(e=!0,t.dispose())}}:typeof t=="function"?{dispose:()=>{e||(e=!0,t())}}:t:vt(()=>{})}function Cl(t){return vt(()=>{t.unsubscribe()})}class hs{constructor(){_(this,"_disposables",new Set)}add(e){const n=vt(e);return this._disposables.add(n),{dispose:()=>{n.dispose(),this._disposables.delete(n)}}}dispose(){this._disposables.forEach(e=>{e.dispose()}),this._disposables.clear()}}class yt{constructor(){_(this,"_disposed",!1);_(this,"_collection",new hs)}disposeWithMe(e){return this._collection.add(e)}ensureNotDisposed(){if(this._disposed)throw new Error("[Disposable]: object is disposed!")}dispose(){this._disposed||(this._disposed=!0,this._collection.dispose())}}class Il extends yt{constructor(){super(...arguments);_(this,"dispose$",new ot.Subject)}dispose(){super.dispose(),this.dispose$.next(),this.dispose$.complete()}}class Be{static hasLength(e,n){return e.length===n}static getValueType(e){return Object.prototype.toString.apply(e)}static isObject(e){return this.getValueType(e)==="[object Object]"}static isIterable(e){return e[Symbol.iterator]!=null}static isNumber(e){return this.getValueType(e)==="[object Number]"}}function Ln(t,e){const n=t.indexOf(e);return n>-1?(t.splice(n,1),!0):!1}function Ol(t){const e=new Set,n=[];for(const s of t)e.has(s)||(e.add(s),n.push(s));return n}function Sl(t,e){for(let n=t.length-1;n>-1;n--){const s=t[n];if(e(s,n))return s}return null}function Nl(t,e){if(t.length===0)return t;const n=e%t.length;return t.slice(n).concat(t.slice(0,n))}function bl(t,e){const n=new Map;return t.forEach(s=>{const r=e(s);let i=n.get(r);n.has(r)||(i=[],n.set(r,i)),i.push(s)}),n}const ct=Symbol("newer"),Ut=Symbol("older");class ti{constructor(e){_(this,"entry");this.entry=e}[Symbol.iterator](){return this}next(){const e=this.entry;return e?(this.entry=e[ct],{done:!1,value:e.key}):{done:!0,value:void 0}}}class ei{constructor(e){_(this,"entry");this.entry=e}[Symbol.iterator](){return this}next(){const e=this.entry;return e?(this.entry=e[ct],{done:!1,value:e.value}):{done:!0,value:void 0}}}class ni{constructor(e){_(this,"entry");this.entry=e}[Symbol.iterator](){return this}next(){const e=this.entry;return e?(this.entry=e[ct],{done:!1,value:[e.key,e.value]}):{done:!0,value:void 0}}}var qu,Ju;class zn{constructor(e,n){_(this,"key");_(this,"value");_(this,qu);_(this,Ju);this.key=e,this.value=n,this[ct]=void 0,this[Ut]=void 0}toJSON(){return{key:this.key,value:this.value}}}qu=ct,Ju=Ut;class si{constructor(...e){_(this,"_keymap");_(this,"size",0);_(this,"limit");_(this,"oldest");_(this,"newest");_(this,"_onShiftListeners",[]);if(Be.hasLength(e,1)){if(Be.isNumber(e[0])){const n=e[0];this._initialize(n,void 0);return}if(Be.isIterable(e[0])){const n=e[0];this._initialize(0,n);return}return}if(Be.hasLength(e,2)){const n=e[0],s=e[1];this._initialize(n,s)}}onShift(e){if(this._onShiftListeners.indexOf(e)===-1)return this._onShiftListeners.push(e),vt(()=>Ln(this._onShiftListeners,e));throw new Error("[LRUMap]: the listener has been registered!")}_initialize(e,n){this.oldest=void 0,this.newest=void 0,this.size=0,this.limit=e,this._keymap=new Map,n&&(this.assign(n),e<1&&(this.limit=this.size))}_markEntryAsUsed(e){e!==this.newest&&(e[ct]&&(e===this.oldest&&(this.oldest=e[ct]),e[ct][Ut]=e[Ut]),e[Ut]&&(e[Ut][ct]=e[ct]),e[ct]=void 0,e[Ut]=this.newest,this.newest&&(this.newest[ct]=e),this.newest=e)}assign(e){let n,s=this.limit||Number.MAX_VALUE;this._keymap.clear();const r=e[Symbol.iterator]();for(let i=r.next();!i.done;i=r.next()){const o=new zn(i.value[0],i.value[1]);if(this._keymap.set(o.key,o),n?(n[ct]=o,o[Ut]=n):this.oldest=o,n=o,s--===0)throw new Error("overflow")}this.newest=n,this.size=this._keymap.size}set(e,n){let s=this._keymap.get(e);return s?(s.value=n,this._markEntryAsUsed(s),this):(this._keymap.set(e,s=new zn(e,n)),this.newest?(this.newest[ct]=s,s[Ut]=this.newest):this.oldest=s,this.newest=s,++this.size,this.size>this.limit&&this.shift(),this)}shift(){const e=this.oldest;if(e)return this.oldest&&this.oldest[ct]?(this.oldest=this.oldest[ct],this.oldest[Ut]=void 0):(this.oldest=void 0,this.newest=void 0),e[ct]=e[Ut]=void 0,this._keymap.delete(e.key),--this.size,this._onShiftListeners.forEach(n=>n(e)),[e.key,e.value]}get(e){const n=this._keymap.get(e);if(n)return this._markEntryAsUsed(n),n.value}has(e){return this._keymap.has(e)}find(e){const n=this._keymap.get(e);return n?n.value:void 0}delete(e){const n=this._keymap.get(e);if(n)return this._keymap.delete(n.key),n[ct]&&n[Ut]?(n[Ut][ct]=n[ct],n[ct][Ut]=n[Ut]):n[ct]?(n[ct][Ut]=void 0,this.oldest=n[ct]):n[Ut]?(n[Ut][ct]=void 0,this.newest=n[Ut]):this.oldest=this.newest=void 0,this.size--,n.value}clear(){this.oldest=void 0,this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new ti(this.oldest)}values(){return new ei(this.oldest)}entries(){return this[Symbol.iterator]()}[Symbol.iterator](){return new ni(this.oldest)}forEach(e,n){typeof n!="object"&&(n=this);let s=this.oldest;for(;s;)e.call(n,s.value,s.key,this),s=s[ct]}toJSON(){const e=new Array(this.size);let n=0,s=this.oldest;for(;s;)e[n++]={key:s.key,value:s.value},s=s[ct];return e}toString(){let e="",n=this.oldest;for(;n;)e+=`${String(n.key)}:${n.value}`,n=n[ct],n&&(e+=" < ");return e}}function _e(t){let e=0;const n=Object.keys(t);for(const s of n){const r=Number(s);e=Math.max(e,r)}return e+1}function Xn(t,e,n){const s=_e(n),r=n;for(let i=s-1;i>=t;i--)r[i+1]=r[i];r[t]=e}function qn(t,e,n){const s=Object.keys(n).reduce((r,i)=>Math.max(r,Number.parseInt(i)),0)+1;for(let r=t;r<s;r++)r<t+e?delete n[r]:n[r]!==void 0&&(n[r-e]=n[r],delete n[r])}function vl(t,e){const n=t,s=Object.keys(n),r=s.length,i=e,o=Object.keys(i),l=o.length,a={};let h=0;for(let c=0;c<r;c++,h++){const u=s[c];a[h]=n[u]}for(let c=0;c<l;c++,h++){const u=o[c];a[h]=i[u]}return a}function Al(t,e,n){const s=n;if(_e(n)>0){const i={};let o=0;for(let l=t;l<=e;l++)s[l]&&(i[o]=s[l],o++);return i}return{}}function Jn(t,e,n,s){const r=t>n;if(!r&&t+e>n)throw new Error("Invalid move operation");r?wl(t,e,n,s):Tl(t,e,n,s)}function wl(t,e,n,s){const r=s,i=[];for(let o=t;o<t+e;o++)i.push(r[o]);for(let o=t-1;o>=n;o--){const l=r[o];r[o+e]=l,l===void 0&&delete r[o+e]}i.forEach((o,l)=>{r[n+l]=o,o===void 0&&delete r[n+l]})}function Tl(t,e,n,s){const r=s,i=[];for(let o=t;o<t+e;o++)i.push(r[o]);for(let o=t+e;o<n;o++){const l=r[o];r[o-e]=l,l===void 0&&delete r[o-e]}i.forEach((o,l)=>{r[n+l-e]=o,o===void 0&&delete r[n+l-e]})}class ee{constructor(e={}){_(this,"_matrix");this._setOriginValue(e)}static MakeObjectMatrixSize(e){return new ee({[e-1]:{}})}getMatrix(){return this._matrix}forEach(e){const n=this._matrix,s=Object.keys(n);for(const r of s){const i=Number(r),o=n[i];if(e(i,o)===!1)return this}return this}forRow(e){const n=this._matrix,s=Object.keys(n);for(const r of s){const i=Number(r),o=n[i];if(e(i,Object.keys(o).map(a=>Number(a)))===!1)return this}return this}forValue(e){const n=this._matrix,s=Object.keys(n);for(const r of s){const i=Number(r),o=n[i];if(!o)continue;const l=Object.keys(o);for(const a of l){const h=Number(a),c=o[Number(a)];if(e(i,h,c)===!1)return this}}return this}swapRow(e,n){const s=this._matrix[e],r=this._matrix[n];this._matrix[e]=r,this._matrix[n]=s}getRow(e){return this._matrix[e]}getRowOrCreate(e){let n=this.getRow(e);return n==null&&(n={},this._matrix[e]=n),n}reset(){this._setOriginValue({})}hasValue(){const e=this._matrix,n=Object.keys(e);if(n.length===0)return!1;for(const s of n){const r=Number(s),i=e[r];if(Object.keys(i).length>0)return!0}return!1}getValue(e,n){var s,r;return(r=(s=this._matrix)==null?void 0:s[e])==null?void 0:r[n]}setValue(e,n,s){const r=this.getRowOrCreate(e);r[n]=s}deleteValue(e,n){var s,r;(r=(s=this._matrix)==null?void 0:s[e])==null||delete r[n]}realDeleteValue(e,n){var s,r,i;if((r=(s=this._matrix)==null?void 0:s[e])==null||delete r[n],this.getRow(e)){const o=this.getRow(e);if(o==null)return;Object.keys(o).length===0&&((i=this._matrix)==null||delete i[e])}}setRow(e,n){this._matrix[e]=n}moveRows(e,n,s){Jn(e,n,s,this._matrix)}moveColumns(e,n,s){this.forEach((r,i)=>{Jn(e,n,s,i)})}insertRows(e,n){for(let s=e;s<e+n;s++)Xn(s,{},this._matrix)}insertColumns(e,n){for(let s=e;s<e+n;s++)this.forEach((r,i)=>{Xn(s,void 0,i)})}removeRows(e,n){qn(e,n,this._matrix)}removeColumns(e,n){this.forEach((s,r)=>{qn(e,n,r)})}getFragment(e,n,s,r){const i=new ee;let o=0;for(let l=e;l<=n;l++){const a={};let h=0;for(let c=s;c<=r;c++){const u=this.getValue(l,c);a[h]=u,h++}i.setRow(o,a),o++}return i}getSlice(e,n,s,r){const i=new ee;for(let o=e;o<=n;o++)for(let l=s;l<=r;l++){const a=this.getValue(o,l);a&&i.setValue(o,l,D.deepClone(a))}return i}getSizeOf(){return Object.keys(this._matrix).length}getLength(){return _e(this._matrix)}getRange(){const s=this.getLength()-1;let r=0;const i=this.getLength();for(let o=0;o<i;o++){const l=this.getRow(o);if(l){const a=_e(l)-1;r=a>r?a:r}}return{startRow:0,startColumn:0,endRow:s,endColumn:r}}toNativeArray(){const e=new Array;return this.forValue((n,s,r)=>{e.push(r)}),e}toArray(){const e=[];return this.forRow((n,s)=>{e[n]==null&&(e[n]=[]),s.forEach(r=>{e[n][r]=this.getValue(n,r)})}),e}toFullArray(){const e=this.getRange(),{endColumn:n,endRow:s}=e,r=[];for(let i=0;i<=s;i++){const o=Array(n+1).fill(void 0);r.push(o)}return this.forValue((i,o,l)=>{r[i][o]=l}),r}toJSON(){return this._matrix}clone(){const e=JSON.stringify(this._matrix);return JSON.parse(e)}getData(){const e=JSON.stringify(this._matrix);return JSON.parse(e)}getArrayData(){let e=0,n=0,s=!1,r=!1;const i=new ee;return this.forEach((o,l)=>{s||(s=!0,e=o),Object.keys(l).forEach(a=>{const h=Number(a);r?h<n&&(n=h):(r=!0,n=h);const c=this.getValue(o,h);i.setValue(o-e,h-n,c)})}),i.getData()}getDataRange(){let e=0,n=0,s=0,r=-1,i=!1,o=!1;return this.forEach((l,a)=>{if(i||(i=!0,e=l),a==null)return;const h=_e(a)-1;h>s&&(s=h),Object.keys(a).forEach(c=>{const u=Number(c);o?u<n&&(n=u):(o=!0,n=u)}),l>r&&(r=l)}),{startRow:e,startColumn:n,endRow:r,endColumn:s}}getDiscreteRanges(){const e=[];return this.forEach((n,s)=>{Object.keys(s).forEach(r=>{const i=Number(r);let o=!1;for(const l of e)if(n>=l.startRow&&n<=l.endRow+1&&i>=l.startColumn&&i<=l.endColumn+1){l.endRow=Math.max(n,l.endRow),l.endColumn=Math.max(i,l.endColumn),o=!0;break}o||e.push({startRow:n,endRow:n,startColumn:i,endColumn:i})})}),e}merge(e){this.forValue((n,s)=>{const r=e.getValue(n,s);r!=null&&this.setValue(n,s,r)})}_setOriginValue(e={}){this._matrix=e}}const ue=class ue{static clone(e){return e.rangeType!==void 0?{startRow:e.startRow,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn,rangeType:e.rangeType}:{startRow:e.startRow,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn}}static equals(e,n){return e==null||n==null?!1:e.endRow===n.endRow&&e.endColumn===n.endColumn&&e.startRow===n.startRow&&e.startColumn===n.startColumn&&(e.rangeType===n.rangeType||e.rangeType===void 0&&n.rangeType===rt.NORMAL||n.rangeType===void 0&&e.rangeType===rt.NORMAL)}static intersects(e,n){if(e.rangeType===rt.ROW&&n.rangeType===rt.COLUMN||e.rangeType===rt.COLUMN&&n.rangeType===rt.ROW)return!0;if(e.rangeType===rt.ROW&&n.rangeType===rt.ROW)return e.startRow<=n.endRow&&e.endRow>=n.startRow;if(e.rangeType===rt.COLUMN&&n.rangeType===rt.COLUMN)return e.startColumn<=n.endColumn&&e.endColumn>=n.startColumn;const s=Math.floor(Number.MAX_SAFE_INTEGER/10),r=Number.isNaN(e.startRow)?0:e.startRow,i=Number.isNaN(e.endRow)?s:e.endRow,o=Number.isNaN(e.startColumn)?0:e.startColumn,l=Number.isNaN(e.endColumn)?s:e.endColumn,a=Number.isNaN(n.startRow)?0:n.startRow,h=Number.isNaN(n.endRow)?s:n.endRow,c=Number.isNaN(n.startColumn)?0:n.startColumn,u=Number.isNaN(n.endColumn)?s:n.endColumn,d=Math.abs(o+l-c-u),f=Math.abs(o-l)+Math.abs(c-u),m=Math.abs(r+i-a-h),p=Math.abs(r-i)+Math.abs(a-h);return d<=f&&m<=p}static getIntersects(e,n){const s=e.startRow,r=e.endRow,i=e.startColumn,o=e.endColumn,l=n.startRow,a=n.endRow,h=n.startColumn,c=n.endColumn;let u,d,f,m;if(l<=r)l>=s?d=l:d=s;else return null;if(a>=s)a>=r?m=r:m=a;else return null;if(h<=o)h>i?u=h:u=i;else return null;if(c>=i)c>=o?f=o:f=c;else return null;return{startRow:d,endRow:m,startColumn:u,endColumn:f,rangeType:rt.NORMAL}}static contains(e,n){return e.startRow<=n.startRow&&e.endRow>=n.endRow&&e.startColumn<=n.startColumn&&e.endColumn>=n.endColumn}static realContain(e,n){return ue.contains(e,n)&&(e.startRow<n.startRow||e.endRow>n.endRow||e.startColumn<n.startColumn||e.endColumn>n.endColumn)}static union(...e){return e.reduce((n,s)=>({startRow:Math.min(n.startRow,s.startRow),startColumn:Math.min(n.startColumn,s.startColumn),endRow:Math.max(n.endRow,s.endRow),endColumn:Math.max(n.endColumn,s.endColumn),rangeType:rt.NORMAL}),e[0])}static realUnion(...e){const n=e.some(i=>i.rangeType===rt.COLUMN),s=e.some(i=>i.rangeType===rt.ROW),r=ue.union(...e);return{startColumn:s?Number.NaN:r.startColumn,endColumn:s?Number.NaN:r.endColumn,startRow:n?Number.NaN:r.startRow,endRow:n?Number.NaN:r.endRow,rangeType:s?rt.ROW:n?rt.COLUMN:rt.NORMAL}}static subtract(e,n){if(n.startRow>e.endRow||n.endRow<e.startRow||n.startColumn>e.endColumn||n.endColumn<e.startColumn)return[e];const s=[];n.startRow>=e.startRow&&s.push({startRow:e.startRow,startColumn:e.startColumn,endRow:n.startRow-1,endColumn:e.endColumn}),n.endRow<=e.endRow&&s.push({startRow:n.endRow+1,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn});const r=Math.max(e.startRow,n.startRow),i=Math.min(e.endRow,n.endRow);return n.startColumn>=e.startColumn&&s.push({startRow:r,startColumn:e.startColumn,endRow:i,endColumn:n.startColumn-1}),n.endColumn<=e.endColumn&&s.push({startRow:r,startColumn:n.endColumn+1,endRow:i,endColumn:e.endColumn}),s.filter(l=>l.startRow<=l.endRow&&l.startColumn<=l.endColumn)}static hasIntersectionBetweenTwoBounds(e,n){return!(e.left>n.right||e.right<n.left||e.top>n.bottom||e.bottom<n.top)}};_(ue,"getRelativeRange",(e,n)=>({startRow:e.startRow-n.startRow,endRow:e.endRow-e.startRow,startColumn:e.startColumn-n.startColumn,endColumn:e.endColumn-e.startColumn})),_(ue,"getPositionRange",(e,n,s)=>({...s||{},startRow:s&&[bt.ROW,bt.ALL].includes(s.startAbsoluteRefType||0)?s.startRow:e.startRow+n.startRow,endRow:s&&[bt.ROW,bt.ALL].includes(s.endAbsoluteRefType||0)?s.endRow:e.endRow+e.startRow+n.startRow,startColumn:s&&[bt.COLUMN,bt.ALL].includes(s.startAbsoluteRefType||0)?s.startColumn:e.startColumn+n.startColumn,endColumn:s&&[bt.COLUMN,bt.ALL].includes(s.endAbsoluteRefType||0)?s.endColumn:e.endColumn+e.startColumn+n.startColumn})),_(ue,"moveHorizontal",(e,n=0,s=0)=>({...e,startColumn:e.startColumn+n,endColumn:e.endColumn+n+s})),_(ue,"moveVertical",(e,n=0,s=0)=>({...e,startRow:e.startRow+n,endRow:e.endRow+n+s})),_(ue,"moveOffset",(e,n,s)=>({...e,startRow:e.startRow+s,endRow:e.endRow+s,startColumn:e.startColumn+n,endColumn:e.endColumn+n}));let ge=ue;class Ll{constructor(e,n){_(this,"_values",[]);_(this,"_keys",[]);_(this,"_keyMaps",new Map);this._values=e,this._keys=n,e.forEach(s=>{this._initKeyMap(s)})}_initKeyMap(e){this._keys.forEach(n=>{const s=e[n],r=this._keyMaps.get(n)||new Map;r.set(s,e),this._keyMaps.set(n,r)})}getValue(e,n){const s=n||this._keys;for(let r=0;r<s.length;r++){const i=this._keyMaps.get(s[r]);if(i!=null&&i.has(e))return i.get(e)}return null}hasValue(e){for(let n=0;n<this._keys.length;n++){const s=this._keyMaps.get(this._keys[n]);if(s!=null&&s.has(e))return!0}return!1}addValue(e){this._values.push(e),this._initKeyMap(e)}setValue(e,n,s){const r=this.getValue(e);r&&Object.keys(r).includes(n)&&(r[n]=s)}deleteValue(e){const n=this.getValue(e);if(n){this._keys.forEach(r=>{const i=this._keyMaps.get(r),o=n[r];i==null||i.delete(o)});const s=this._values.findIndex(r=>r===n);this._values.splice(s,1)}}getValues(){return this._values}getKeyMap(e){var n;return[...((n=this._keyMaps.get(e))==null?void 0:n.keys())||[]]}clear(){this._values=[],this._keys=[],this._keyMaps.clear()}}function Zn(t,e,n,s){return{forEach(r){for(let i=t;i<=e;i++)for(let o=n;o<=s;o++)r(i,o)}}}function Ml(t){if(t==null||t.length===0)return Number.NaN;const e=t.toLowerCase().split(""),n=e.length,s=o=>o.charCodeAt(0)-96;let r=0,i=0;for(let o=0;o<n;o++)i=s(e[o]),r+=i*26**(n-o-1);return r===0?Number.NaN:r-1}const In=65,ri=90,Ul=97;function Dl(t){const e=ri-In+1;let n="";for(;t>=0;)n=String.fromCharCode(t%e+In)+n,t=Math.floor(t/e)-1;return n}function ii(t,e){let n="";for(;e>0;)n+=t,e--;return n}function yl(t,e=!1){const n=ri-In+1;let s=Ul;e&&(s=In);const r=String.fromCharCode(t%n+s),i=Math.floor(t/n)+1;return ii(r,i)}function Pl(t,e){return t.zIndex>e.zIndex?1:t.zIndex===e.zIndex?0:-1}function xl(t,e){return t.zIndex>e.zIndex?-1:t.zIndex===e.zIndex?0:1}function ke(t="index",e=1){return(n,s)=>n[t]>s[t]?e:n[t]===s[t]?0:-e}function kl(t,e){let n;function s(...r){const i=this,o=function(){n=null,t.apply(i,r)};clearTimeout(n),n=setTimeout(o,e)}return Object.defineProperty(s,"cancel",{value:()=>{clearTimeout(n)},enumerable:!1,writable:!1}),s}function hn(t,e,n){const{dataStream:s,textRuns:r=[]}=t;let i=e;const o=[];for(const l of r){const{st:a,ed:h}=l;D.hasIntersectionBetweenTwoRanges(e,n,a,h)&&(a>i?(o.push(s.slice(i,a)),o.push(Qn(s,{...l,ed:Math.min(h,n)}))):o.push(Qn(s,{...l,st:i,ed:Math.min(h,n)}))),i=Math.max(e,Math.min(h,n))}return i!==n&&o.push(s.slice(i,n)),o.join("")}function Hl(t,e=!0){var n;if(e&&((n=t.paragraphs)!=null&&n.length)){const{dataStream:s,paragraphs:r=[]}=t;let i="",o=-1;for(const l of r){const{startIndex:a,paragraphStyle:h={}}=l,{spaceAbove:c,spaceBelow:u,lineSpacing:d}=h,f=[];c!=null&&(typeof c=="number"?f.push(`margin-top: ${c}px`):f.push(`margin-top: ${c.v}px`)),u!=null&&(typeof u=="number"?f.push(`margin-bottom: ${u}px`):f.push(`margin-bottom: ${u.v}px`)),d!=null&&f.push(`line-height: ${d}`),a>o+1?i+=`<p class="UniverNormal" ${f.length?`style="${f.join("; ")};"`:""}>${hn(t,o+1,a)}</p>`:i+=`<p class="UniverNormal" ${f.length?`style="${f.join("; ")};"`:""}></p>`,o=a}return o!==s.length&&(i+=hn(t,o,s.length)),i}else return hn(t,0,t.dataStream.length)}function Qn(t,e){const{st:n,ed:s,ts:r={}}=e,{ff:i,fs:o,it:l,bl:a,ul:h,st:c,ol:u,bg:d,cl:f,va:m}=r;let p=t.slice(n,s);const y=[];return l===q.TRUE&&(p=`<i>${p}</i>`),m===ye.SUPERSCRIPT?p=`<sup>${p}</sup>`:m===ye.SUBSCRIPT&&(p=`<sub>${p}</sub>`),(h==null?void 0:h.s)===q.TRUE&&(p=`<u>${p}</u>`),(c==null?void 0:c.s)===q.TRUE&&(p=`<s>${p}</s>`),a===q.TRUE&&(p=`<strong>${p}</strong>`),i&&y.push(`font-family: ${i}`),f&&y.push(`color: ${f.rgb}`),o&&y.push(`font-size: ${o}pt`),u&&y.push("text-decoration: overline"),d&&y.push(`background: ${d.rgb}`),y.length?`<span style="${y.join("; ")};">${p}</span>`:p}const $e={sheetId:"",range:{startRow:-1,endRow:-1,startColumn:-1,endColumn:-1}},Fl={startRow:-1,startColumn:-1,endRow:-1,endColumn:-1},Bl={startRow:0,startColumn:0,endRow:0,endColumn:0},$l={row:0,column:0},dn={ff:"Arial",fs:11,it:q.FALSE,bl:q.FALSE,ul:{s:q.FALSE},st:{s:q.FALSE},ol:{s:q.FALSE},tr:{a:0,v:q.FALSE},td:Xe.UNSPECIFIED,cl:{rgb:"#000"},bg:{rgb:"#fff"},ht:Se.UNSPECIFIED,vt:De.UNSPECIFIED,tb:qe.UNSPECIFIED,pd:{t:0,r:0,b:0,l:0}},oi={id:"default_slide",title:"defaultSlide",pageSize:{width:300,height:300}};var li=(t=>(t.ARRAY_CONVERTOR="ARRAY_CONVERTOR",t.MATRIX_CONVERTOR="MATRIX_CONVERTOR",t))(li||{});function an(t,e){const{textRuns:n=[]}=e;let s=0;for(const i of n){const{ts:o={},st:l,ed:a}=i;if(o[t]==null)return q.FALSE;switch(t){case"bl":case"it":{if(o[t]===q.FALSE)return q.FALSE;break}case"ul":case"st":{if(o[t].s===q.FALSE)return q.FALSE;break}default:throw new Error(`unknown style key: ${t} in IStyleBase`)}s+=a-l}return e.dataStream.indexOf(`\r
|
|
4
|
-
`)===s?q.TRUE:q.FALSE}const Ye=class Ye{constructor(e,n,s){_(this,"_range");_(this,"_worksheet");this._deps=s,this._range=n,this._worksheet=e}static foreach(e,n){const{startRow:s,startColumn:r,endRow:i,endColumn:o}=e;for(let l=s;l<=i;l++)for(let a=r;a<=o;a++)n(l,a)}getRangeData(){return this._range}getValue(){return this.getValues()[0][0]}getValues(){const{startRow:e,endRow:n,startColumn:s,endColumn:r}=this._range,i=[];for(let o=e;o<=n;o++){const l=[];for(let a=s;a<=r;a++)l.push(this.getMatrix().getValue(o,a)||null);i.push(l)}return i}getMatrix(){const{startRow:e,endRow:n,startColumn:s,endColumn:r}=this._range,i=this._worksheet.getCellMatrix(),o=new ee;for(let l=e;l<=n;l++)for(let a=s;a<=r;a++)o.setValue(l,a,i.getValue(l,a)||null);return o}getMatrixObject(){const{startRow:e,endRow:n,startColumn:s,endColumn:r}=this._range,i=this._worksheet.getCellMatrix(),o=new ee;for(let l=e;l<=n;l++)for(let a=s;a<=r;a++)o.setValue(l-e,a-s,i.getValue(l,a)||{});return o}getA1Notation(){const{startRow:e,endRow:n,startColumn:s,endColumn:r}=this._range;let i,o;return s<r?(i=D.numToWord(s+1)+(e+1),o=D.numToWord(r+1)+(n+1)):(i=D.numToWord(r+1)+(n+1),o=D.numToWord(s+1)+(e+1)),i===o?`${i}`:`${i}:${o}`}getBackground(){return this.getBackgrounds()[0][0]}getBackgrounds(){const e=this._deps.getStyles();return this.getValues().map(n=>n.map(s=>{var i;const r=e.getStyleByCell(s);return((i=r==null?void 0:r.bg)==null?void 0:i.rgb)||dn.bg.rgb}))}getCell(e,n){const{startRow:s,endRow:r,startColumn:i,endColumn:o}=this._range,l={startRow:s+e,endRow:s+e,startColumn:i+n,endColumn:i+n};return new Ye(this._worksheet,l,this._deps)}getColumn(){return this._range.startColumn}getObjectValue(e={}){return this.getObjectValues(e)[0][0]}getObjectValues(e={}){var l;const{startRow:n,endRow:s,startColumn:r,endColumn:i}=this._range,o=this._worksheet.getCellMatrix().getFragment(n,s,r,i).getData();if(e.isIncludeStyle){const a=this._deps.getStyles();for(let h=0;h<=s-n;h++)for(let c=0;c<=i-r;c++){if(o==null||((l=o==null?void 0:o[h])==null?void 0:l[c])==null)continue;const u=o[h][c].s;u&&(o[h][c].s=a.get(u))}}return o}getFontColor(){return this.getFontColors()[0][0]}getFontColors(){const e=this._deps.getStyles();return this.getValues().map(n=>n.map(s=>{var i;const r=e.getStyleByCell(s);return((i=r==null?void 0:r.cl)==null?void 0:i.rgb)||dn.cl.rgb}))}getFontFamilies(){return this._getStyles("ff")}getFontFamily(){return this.getFontFamilies()[0][0]}getUnderlines(){return this._getStyles("ul")}getUnderline(){var n,s;const{p:e}=(n=this.getValue())!=null?n:{};return e&&Array.isArray((s=e.body)==null?void 0:s.textRuns)&&e.body.textRuns.length>0?an("ul",e.body)===q.TRUE?{s:q.TRUE}:{s:q.FALSE}:this.getUnderlines()[0][0]}getOverlines(){return this._getStyles("ol")}getOverline(){return this.getOverlines()[0][0]}getStrikeThrough(){var n,s;const{p:e}=(n=this.getValue())!=null?n:{};return e&&Array.isArray((s=e.body)==null?void 0:s.textRuns)&&e.body.textRuns.length>0?an("st",e.body)===q.TRUE?{s:q.TRUE}:{s:q.FALSE}:this.getStrikeThroughs()[0][0]}getStrikeThroughs(){return this._getStyles("st")}getFontSize(){var n,s;const e=((n=this.getValue())==null?void 0:n.p)||{};return e&&Array.isArray((s=e.body)==null?void 0:s.textRuns)&&e.body.textRuns.length>0?e.body.textRuns.some(r=>{var i;return((i=r==null?void 0:r.ts)==null?void 0:i.fs)!=null})?Math.max(...e.body.textRuns.map(r=>{var i;return((i=r==null?void 0:r.ts)==null?void 0:i.fs)||0})):this.getFontSizes()[0][0]:this.getFontSizes()[0][0]}getFontSizes(){return this._getStyles("fs")}getBorder(){return this.getBorders()[0][0]}getBorders(){return this._getStyles("bd")}getFontStyle(){var n,s;const{p:e}=(n=this.getValue())!=null?n:{};return e&&Array.isArray((s=e.body)==null?void 0:s.textRuns)&&e.body.textRuns.length>0?an("it",e.body)===q.TRUE?pn.ITALIC:pn.NORMAL:this._getFontStyles()[0][0]}_getFontStyles(){return this._getStyles("it")}getFontWeight(){var n,s;const{p:e}=(n=this.getValue())!=null?n:{};return e&&Array.isArray((s=e.body)==null?void 0:s.textRuns)&&e.body.textRuns.length>0?an("bl",e.body)===q.TRUE?En.BOLD:En.NORMAL:this._getFontWeights()[0][0]}_getFontWeights(){return this._getStyles("bl")}getGridId(){return this._worksheet.getSheetId()}getHeight(){const{_range:e,_worksheet:n}=this,{startRow:s,endRow:r}=e;let i=0;for(let o=0;o<=r-s;o++){const l=n.getRowHeight(o);i+=l}return i}getHorizontalAlignment(){return this.getHorizontalAlignments()[0][0]}getHorizontalAlignments(){return this._getStyles("ht")}getLastColumn(){return this._range.endColumn}getLastRow(){return this._range.endRow}getNumColumns(){const{startColumn:e,endColumn:n}=this._range;return n-e+1}getNumRows(){const{startRow:e,endRow:n}=this._range;return n-e+1}getRichTextValue(){return this.getRichTextValues()[0][0]}getRichTextValues(){return this.getValues().map(e=>e.map(n=>(n==null?void 0:n.p)||""))}getRowIndex(){return this._range.startRow}getSheet(){return this._worksheet}getTextDirection(){return this.getTextDirections()[0][0]}getTextDirections(){return this._getStyles("td")}getTextRotation(){return this.getTextRotations()[0][0]}getTextRotations(){return this._getStyles("tr")}getTextStyle(){return this.getTextStyles()[0][0]}getTextStyles(){const e=this._deps.getStyles();return this.getValues().map(n=>n.map(s=>e.getStyleByCell(s)))}getVerticalAlignment(){return this.getVerticalAlignments()[0][0]}getVerticalAlignments(){return this._getStyles("vt")}getWidth(){const{_range:e,_worksheet:n}=this,{startColumn:s,endColumn:r}=e;let i=0;for(let o=0;o<=r-s;o++)i+=n.getColumnWidth(o);return i}getWrap(){return this.getWraps()[0][0]}getWraps(){return this._getStyles("tb")}getWrapStrategies(){return this._getStyles("tb")}getWrapStrategy(){return this.getWrapStrategies()[0][0]}forEach(e){Ye.foreach(this._range,e)}_getStyles(e){const n=this._deps.getStyles();return this.getValues().map(s=>s.map(r=>{const i=n&&n.getStyleByCell(r);return i&&i[e]||dn[e]}))}};_(Ye,"transformRange",(e,n)=>e.rangeType===rt.ALL?{startColumn:0,startRow:0,endColumn:n.getMaxColumns()-1,endRow:n.getMaxRows()-1}:e.rangeType===rt.COLUMN?{startRow:0,endRow:n.getMaxRows()-1,startColumn:e.startColumn,endColumn:e.endColumn}:e.rangeType===rt.ROW?{startColumn:0,endColumn:n.getMaxColumns()-1,startRow:e.startRow,endRow:e.endRow}:e);let Pe=Ye;function Wl(t,e){if(t.length===0||t[0].length===0)return null;const n=new Array(t[0].length).fill(0);let s=0,r=null;for(let i=0;i<t.length;i++){for(let l=0;l<t[0].length;l++)n[l]=e(t[i][l])?n[l]+1:0;const o=Gl(n);o.area>s&&(s=o.area,r={startColumn:o.start,startRow:i-o.height+1,endColumn:o.end,endRow:i})}return r}function Gl(t){const e=[];let n=0,s={area:0,height:0,start:0,end:0},r=0;for(;r<t.length;)if(e.length===0||t[r]>=t[e[e.length-1]])e.push(r++);else{const i=t[e.pop()],o=e.length===0?r:r-e[e.length-1]-1;i*o>n&&(n=i*o,s={area:n,height:i,start:e.length===0?0:e[e.length-1]+1,end:r-1})}for(;e.length>0;){const i=t[e.pop()],o=e.length===0?r:r-e[e.length-1]-1;i*o>n&&(n=i*o,s={area:n,height:i,start:e.length===0?0:e[e.length-1]+1,end:r-1})}return s}function jl(t,e){Pe.foreach(e,(n,s)=>{t[n][s]=void 0})}function Vl(t,e){const n=t.toFullArray(),s=[];for(;;){const r=Wl(n,e);if(!r)break;s.push(r),jl(n,r)}return s}function Kl(t,e,n,s=!1){let r={...t};const i=r.startAbsoluteRefType||bt.NONE,o=r.endAbsoluteRefType||bt.NONE;return!s&&i===bt.ALL&&o===bt.ALL?r:s||i===bt.NONE&&o===bt.NONE?ge.moveOffset(r,e,n):(i===bt.NONE?r={...r,startRow:r.startRow+n,startColumn:r.startColumn+e}:i===bt.COLUMN?r={...r,startRow:r.startRow+n}:i===bt.ROW&&(r={...r,startColumn:r.startColumn+e}),o===bt.NONE?r={...r,endRow:r.endRow+n,endColumn:r.endColumn+e}:o===bt.COLUMN?r={...r,endRow:r.endRow+n}:o===bt.ROW&&(r={...r,endColumn:r.endColumn+e}),r)}async function ai(t){for(const[e,n]of t.entries())try{if(!await n())return{index:e,result:!1}}catch(s){return{index:e,result:!1,error:s}}return{result:!0,index:-1}}function ui(t){for(const[e,n]of t.entries())try{if(!n())return{index:e,result:!1}}catch(s){return{index:e,result:!1,error:s}}return{result:!0,index:-1}}const Qe=ut.createIdentifier("univer.context-service");class ci extends yt{constructor(){super(...arguments);_(this,"_contextChanged$",new ot.Subject);_(this,"contextChanged$",this._contextChanged$.asObservable());_(this,"_contextMap",new Map)}dispose(){super.dispose(),this._contextChanged$.complete()}getContextValue(n){var s;return(s=this._contextMap.get(n))!=null?s:!1}setContextValue(n,s){this._contextMap.set(n,s),this._contextChanged$.next({[n]:s})}subscribeContextValue$(n){return new ot.Observable(s=>{const r=this._contextChanged$.pipe(ot.filter(i=>typeof i[n]<"u")).subscribe(i=>s.next(i[n]));return this._contextMap.has(n)&&s.next(this._contextMap.get(n)),()=>r.unsubscribe()})}}var hi=(t=>(t[t.SILENT=0]="SILENT",t[t.ERROR=1]="ERROR",t[t.WARN=2]="WARN",t[t.INFO=3]="INFO",t[t.VERBOSE=4]="VERBOSE",t))(hi||{});const pe=ut.createIdentifier("univer.log");class di extends yt{constructor(){super(...arguments);_(this,"_logLevel",3)}debug(...n){this._logLevel>=4&&this._log(console.debug,...n)}log(...n){this._logLevel>=3&&this._log(console.log,...n)}warn(...n){this._logLevel>=2&&this._log(console.warn,...n)}error(...n){this._logLevel>=1&&this._log(console.error,...n)}setLogLevel(n){this._logLevel=n}_log(n,...s){const r=s[0];/^\[(.*?)\]/g.test(r)?n(`\x1B[97;104m${r}\x1B[0m`,...s.slice(1)):n(...s)}}var Yl=Object.defineProperty,zl=Object.getOwnPropertyDescriptor,Xl=(t,e,n,s)=>{for(var r=s>1?void 0:s?zl(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(s?o(e,n,r):o(r))||r);return s&&r&&Yl(e,n,r),r},Bs=(t,e)=>(n,s)=>e(n,s,t),tn=(t=>(t[t.COMMAND=0]="COMMAND",t[t.OPERATION=1]="OPERATION",t[t.MUTATION=2]="MUTATION",t))(tn||{});const en=ut.createIdentifier("anywhere.command-service");class ql{constructor(){_(this,"_commands",new Map);_(this,"_commandTypes",new Map)}registerCommand(e){if(this._commands.has(e.id))throw new Error(`[CommandRegistry]: command "${e.id}" has been registered before.`);return this._commands.set(e.id,e),this._commandTypes.set(e.id,e.type),vt(()=>{var n;this._commands.delete(e.id),this._commandTypes.delete(e.id),(n=e.onDispose)==null||n.call(e)})}hasCommand(e){return this._commands.has(e)}getCommand(e){return this._commands.has(e)?[this._commands.get(e)]:null}getCommandType(e){return this._commandTypes.get(e)}}const fi={id:"nil",type:0,handler:()=>!0};exports.CommandService=class{constructor(e,n){_(this,"_commandRegistry");_(this,"_beforeCommandExecutionListeners",[]);_(this,"_commandExecutedListeners",[]);_(this,"_multiCommandDisposables",new Map);_(this,"_commandExecutingLevel",0);_(this,"_commandExecutionStack",[]);this._injector=e,this._logService=n,this._commandRegistry=new ql,this._registerCommand(fi)}hasCommand(e){return this._commandRegistry.hasCommand(e)}registerCommand(e){return this._registerCommand(e)}registerMultipleCommand(e){return this._registerMultiCommand(e)}beforeCommandExecuted(e){if(this._beforeCommandExecutionListeners.indexOf(e)===-1)return this._beforeCommandExecutionListeners.push(e),vt(()=>{const n=this._beforeCommandExecutionListeners.indexOf(e);this._beforeCommandExecutionListeners.splice(n,1)});throw new Error("[CommandService]: could not add a listener twice.")}onCommandExecuted(e){if(this._commandExecutedListeners.indexOf(e)===-1)return this._commandExecutedListeners.push(e),vt(()=>{const n=this._commandExecutedListeners.indexOf(e);this._commandExecutedListeners.splice(n,1)});throw new Error("[CommandService]: could not add a listener twice.")}async executeCommand(e,n,s){const r=this._commandRegistry.getCommand(e);if(r){const[i]=r,o={id:i.id,type:i.type,params:n},l=this._pushCommandExecutionStack(o);this._beforeCommandExecutionListeners.forEach(h=>h(o,s));const a=await this._execute(i,n,s);return this._commandExecutedListeners.forEach(h=>h(o,s)),l.dispose(),a}throw new Error(`[CommandService]: command "${e}" is not registered.`)}syncExecuteCommand(e,n,s){var i;const r=this._commandRegistry.getCommand(e);if(r){const[o]=r,l={id:o.id,type:o.type,params:n};if(o.type===2){const c=Sl(this._commandExecutionStack,u=>u.type===0);c&&(l.params=(i=l.params)!=null?i:{},l.params.trigger=c.id)}const a=this._pushCommandExecutionStack(l);this._beforeCommandExecutionListeners.forEach(c=>c(l,s));const h=this._syncExecute(o,n,s);return this._commandExecutedListeners.forEach(c=>c(l,s)),a.dispose(),h}throw new Error(`[CommandService]: command "${e}" is not registered.`)}_pushCommandExecutionStack(e){return this._commandExecutionStack.push(e),vt(()=>Ln(this._commandExecutionStack,e))}_registerCommand(e){return this._commandRegistry.registerCommand(e)}_registerMultiCommand(e){const n=this._commandRegistry.getCommand(e.id);let s;if(n){if(n[0].multi!==!0)throw new Error("Command has registered as a single command.");s=n[0]}else{const i=new hs;s=new Jl(e.id),i.add(this._commandRegistry.registerCommand(s)),i.add(vt(()=>{this._multiCommandDisposables.delete(e.id)})),this._multiCommandDisposables.set(e.id,i)}const r=s.registerImplementation(e);return vt(()=>{var i;r.dispose(),s.hasImplementations()||(i=this._multiCommandDisposables.get(e.id))==null||i.dispose()})}async _execute(e,n,s){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(this._commandExecutingLevel,0))}executing command "${e.id}"`),this._commandExecutingLevel++;let r;try{r=await this._injector.invoke(e.handler,n,s),this._commandExecutingLevel--}catch(i){throw r=!1,this._commandExecutingLevel=0,i}return r}_syncExecute(e,n,s){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(0,this._commandExecutingLevel))}executing command "${e.id}".`),this._commandExecutingLevel++;let r;try{if(r=this._injector.invoke(e.handler,n,s),r instanceof Promise)throw new TypeError("[CommandService]: Command handler should not return a promise.");this._commandExecutingLevel--}catch(i){throw r=!1,this._commandExecutingLevel=0,i}return r}};exports.CommandService=Xl([Bs(0,ut.Inject(ut.Injector)),Bs(1,pe)],exports.CommandService);class Jl{constructor(e){_(this,"name");_(this,"multi",!0);_(this,"type",0);_(this,"priority",0);_(this,"_implementations",[]);_(this,"handler",async(e,n)=>{if(!this._implementations.length)return!1;const s=e.get(pe),r=e.get(Qe),i=e.get(ut.Injector);for(const o of this._implementations){const l=o.command.preconditions;if((!l||l&&l(r))&&(s.debug("[MultiCommand]",`executing implementation "${o.command.name}".`),await i.invoke(o.command.handler,n)))return!0}return!1});this.id=e,this.name=e}registerImplementation(e){const n={command:e};return this._implementations.push(n),this._implementations.sort((s,r)=>r.command.priority-s.command.priority),vt(()=>{var r;const s=this._implementations.indexOf(n);this._implementations.splice(s,1),(r=e.onDispose)==null||r.call(e)})}hasImplementations(){return this._implementations.length>0}}function ds(t,e,n){const s=t.map(r=>()=>e.syncExecuteCommand(r.id,r.params,n));return ui(s)}function Zl(t,e,n){const s=t.map(r=>()=>e.executeCommand(r.id,r.params,n));return ai(s)}function _i(t){return new ot.Observable(e=>{const n=t((...s)=>e.next(s));return()=>n==null?void 0:n.dispose()})}const Ql=t=>new Promise(e=>{ot.merge(_i(t.onCommandExecuted).pipe(cn.filter(([n])=>n.type===tn.MUTATION)),ot.timer(300)).pipe(cn.debounceTime(16),cn.first()).subscribe(()=>{e()})});var Xt=(t=>(t[t.UNDEFINED=0]="UNDEFINED",t[t.OK=1]="OK",t[t.INTERNAL_ERROR=2]="INTERNAL_ERROR",t[t.PERMISSION_DENIED=3]="PERMISSION_DENIED",t[t.NOT_FOUND=4]="NOT_FOUND",t[t.UNAUTHENTICATED=5]="UNAUTHENTICATED",t[t.ALREADY_EXISTS=6]="ALREADY_EXISTS",t[t.INVALID_ARGUMENT=7]="INVALID_ARGUMENT",t[t.TOO_MANY_REQUESTS=8]="TOO_MANY_REQUESTS",t[t.COMPLETION_FINISHED=9]="COMPLETION_FINISHED",t[t.CHANGESET_REVISION_CONFILICT=5001]="CHANGESET_REVISION_CONFILICT",t[t.SNAPSHOT_INVALID_SNAPSHOT=6001]="SNAPSHOT_INVALID_SNAPSHOT",t[t.APPLY_REJECT=7001]="APPLY_REJECT",t[t.APPLY_NON_SEQUENTIAL_REVISION=7002]="APPLY_NON_SEQUENTIAL_REVISION",t[t.APPLY_REVISION_CONFILICT=7003]="APPLY_REVISION_CONFILICT",t[t.APPLY_PERMISSION_DENIED=7004]="APPLY_PERMISSION_DENIED",t[t.CONNECTOR_DATA_TOO_LARGE=8001]="CONNECTOR_DATA_TOO_LARGE",t[t.LICENSE_MAX_UNITS_EXCEEDED=9001]="LICENSE_MAX_UNITS_EXCEEDED",t[t.LICENSE_MAX_MEMBERS_PER_UNIT_EXCEEDED=9002]="LICENSE_MAX_MEMBERS_PER_UNIT_EXCEEDED",t[t.LICENSE_IMPORT_SIZE_EXCEEDED=9003]="LICENSE_IMPORT_SIZE_EXCEEDED",t[t.LICENSE_EXPORT_SIZE_EXCEEDED=9004]="LICENSE_EXPORT_SIZE_EXCEEDED",t[t.LICENSE_DISTRO_REJECTED=9005]="LICENSE_DISTRO_REJECTED",t[t.YUUMI_UNABLE_LOAD_URL=10001]="YUUMI_UNABLE_LOAD_URL",t[t.YUUMI_URL_COL_OUT_OF_RANGE=10002]="YUUMI_URL_COL_OUT_OF_RANGE",t[t.UNRECOGNIZED=-1]="UNRECOGNIZED",t))(Xt||{});function gi(t){return!!(t&&t.code&&t.code!==Xt.OK&&t.code!=="OK")}var et=(t=>(t[t.UNIVER_UNKNOWN=0]="UNIVER_UNKNOWN",t[t.UNIVER_DOC=1]="UNIVER_DOC",t[t.UNIVER_SHEET=2]="UNIVER_SHEET",t[t.UNIVER_SLIDE=3]="UNIVER_SLIDE",t[t.UNRECOGNIZED=-1]="UNRECOGNIZED",t))(et||{}),Ft=(t=>(t[t.Reader=0]="Reader",t[t.Editor=1]="Editor",t[t.Owner=2]="Owner",t[t.UNRECOGNIZED=-1]="UNRECOGNIZED",t))(Ft||{}),fn=(t=>(t[t.Unkonwn=0]="Unkonwn",t[t.Workbook=1]="Workbook",t[t.Worksheet=2]="Worksheet",t[t.SelectRange=3]="SelectRange",t[t.Document=4]="Document",t[t.Slide=5]="Slide",t[t.UNRECOGNIZED=-1]="UNRECOGNIZED",t))(fn||{});class Mn extends yt{}class fs{constructor(){_(this,"_data",[])}static create(){return new fs}add(e){this._data.indexOf(e)>-1||this._data.push(e)}delete(e){const n=this._data.indexOf(e);this._data.splice(n,1)}getData(){return this._data}}class _s{constructor(){_(this,"_data",new Map)}static create(){return new _s}add(e,n){this._data.has(e)||this._data.set(e,n)}delete(e){this._data.delete(e)}getData(){return this._data}}var On=(t=>(t.BULLET_LIST="BULLET_LIST",t.ORDER_LIST="ORDER_LIST",t))(On||{});const ta={BULLET_LIST:{listType:"BULLET_LIST",nestingLevel:[{bulletAlignment:de.START,glyphFormat:" %0",textStyle:{fs:12},startNumber:0,glyphSymbol:"●",hanging:21,indentStart:21},{bulletAlignment:de.START,glyphFormat:" %1",textStyle:{fs:12},startNumber:0,glyphSymbol:"■",hanging:21,indentStart:42},{bulletAlignment:de.START,glyphFormat:" %1",textStyle:{fs:12},startNumber:0,glyphSymbol:"◆",hanging:21,indentStart:63}]},ORDER_LIST:{listType:"ORDER_LIST",nestingLevel:[{bulletAlignment:de.START,glyphFormat:" %1.",textStyle:{fs:12},startNumber:0,glyphType:Ge.DECIMAL,hanging:21,indentStart:21},{bulletAlignment:de.START,glyphFormat:" %1.%2)",textStyle:{fs:12},startNumber:0,glyphType:Ge.DECIMAL,hanging:21,indentStart:42},{bulletAlignment:de.START,glyphFormat:" %1.%2.%3.",textStyle:{fs:12},startNumber:0,glyphType:Ge.DECIMAL,hanging:21,indentStart:63}]}};var mi=(t=>(t[t.PARAGRAPH=0]="PARAGRAPH",t[t.SECTION_BREAK=1]="SECTION_BREAK",t[t.TABLE=2]="TABLE",t[t.TABLE_ROW=3]="TABLE_ROW",t[t.TABLE_CELL=4]="TABLE_CELL",t[t.CUSTOM_BLOCK=5]="CUSTOM_BLOCK",t))(mi||{}),gs=(t=>(t.PARAGRAPH="\r",t.SECTION_BREAK=`
|
|
5
|
-
`,t.TABLE_START="",t.TABLE_ROW_START="\x1B",t.TABLE_CELL_START="",t.TABLE_CELL_END="",t.TABLE_ROW_END="",t.TABLE_END="",t.CUSTOM_RANGE_START="",t.CUSTOM_RANGE_END="",t.COLUMN_BREAK="\v",t.PAGE_BREAK="\f",t.DOCS_END="\0",t.TAB=" ",t.CUSTOM_BLOCK="\b",t.LETTER="",t.SPACE=" ",t))(
|
|
6
|
-
`,textRuns:[],paragraphs:[{startIndex:0,paragraphStyle:{spaceAbove:5,lineSpacing:1,spaceBelow:0}}],sectionBreaks:[{startIndex:1}]},documentStyle:{pageSize:{width:793.3333333333334,height:1122.6666666666667},marginTop:50,marginBottom:50,marginRight:40,marginLeft:40,renderConfig:{vertexAngle:0,centerAngle:0}},settings:{}}}var $t=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function da(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Bt={},vi={},Rs={};Object.defineProperty(Rs,"__esModule",{value:!0});function fa(t,e){if(Array.isArray(e))return!1;for(let n in t)if(!Cs(t[n],e[n]))return!1;for(let n in e)if(t[n]===void 0)return!1;return!0}function _a(t,e){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!Cs(t[n],e[n]))return!1;return!0}function Cs(t,e){return t===e?!0:t===null||e===null||typeof t!="object"||typeof e!="object"?!1:Array.isArray(t)?_a(t,e):fa(t,e)}Rs.default=Cs;var Is={};Object.defineProperty(Is,"__esModule",{value:!0});function es(t){if(t===null)return null;if(Array.isArray(t))return t.map(es);if(typeof t=="object"){const e={};for(let n in t)e[n]=es(t[n]);return e}else return t}Is.default=es;var Os={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.eachChildOf=t.advancer=t.readCursor=t.writeCursor=t.WriteCursor=t.ReadCursor=t.isValidPathItem=void 0;function e(c,u){if(!c)throw new Error(u)}const n=c=>c!=null&&typeof c=="object"&&!Array.isArray(c),s=(c,u)=>typeof c==typeof u?c>u:typeof c=="string"&&typeof u=="number";function r(c,u){for(let d in c){const f=d;u.write(f,c[f])}}t.isValidPathItem=c=>typeof c=="number"||typeof c=="string"&&c!=="__proto__";class i{constructor(u=null){this.parents=[],this.indexes=[],this.lcIdx=-1,this.idx=-1,this.container=u}ascend(){e(this.parents.length===this.indexes.length/2),this.idx===0?this.parents.length?(this.lcIdx=this.indexes.pop(),this.container=this.parents.pop(),this.idx=this.indexes.pop()):(this.lcIdx=0,this.idx=-1):(e(this.idx>0),this.idx--,n(this.container[this.idx])&&this.idx--)}getPath(){const u=[];let d=this.container,f=this.parents.length-1,m=this.idx;for(;m>=0;)u.unshift(d[m]),m===0?(m=this.indexes[f*2],d=this.parents[f--]):m-=n(d[m-1])?2:1;return u}}class o extends i{get(){return this.container?this.container.slice(this.idx+1):null}getKey(){return e(this.container!=null,"Invalid call to getKey before cursor descended"),this.container[this.idx]}getComponent(){let u;return this.container&&this.container.length>this.idx+1&&n(u=this.container[this.idx+1])?u:null}descendFirst(){let u=this.idx+1;if(!this.container||u>=this.container.length||n(this.container[u])&&u+1>=this.container.length)return!1;n(this.container[u])&&u++;const d=this.container[u];return Array.isArray(d)?(this.indexes.push(this.idx),this.parents.push(this.container),this.indexes.push(u),this.idx=0,this.container=d):this.idx=u,!0}nextSibling(){if(e(this.parents.length===this.indexes.length/2),this.idx>0||this.parents.length===0)return!1;const u=this.indexes[this.indexes.length-1]+1,d=this.parents[this.parents.length-1];return u>=d.length?!1:(e(!isNaN(u)),this.indexes[this.indexes.length-1]=u,this.container=d[u],!0)}_init(u,d,f,m){this.container=u,this.idx=d,this.parents=f.slice(),this.indexes=m.slice()}clone(){const u=new o;return u._init(this.container,this.idx,this.parents,this.indexes),u}*[Symbol.iterator](){if(this.descendFirst()){do yield this.getKey();while(this.nextSibling());this.ascend()}}traverse(u,d){const f=this.getComponent();f&&d(f,u);for(const m of this)u&&u.descend(m),this.traverse(u,d),u&&u.ascend()}eachPick(u,d){this.traverse(u,(f,m)=>{f.p!=null&&d(f.p,m)})}eachDrop(u,d){this.traverse(u,(f,m)=>{f.d!=null&&d(f.d,m)})}}t.ReadCursor=o;class l extends i{constructor(u=null){super(u),this.pendingDescent=[],this._op=u}flushDescent(){e(this.parents.length===this.indexes.length/2),this.container===null&&(this._op=this.container=[]);for(let u=0;u<this.pendingDescent.length;u++){const d=this.pendingDescent[u];let f=this.idx+1;if(f<this.container.length&&n(this.container[f])&&f++,e(f===this.container.length||!n(this.container[f])),f===this.container.length)this.container.push(d),this.idx=f;else if(this.container[f]===d)this.idx=f;else{if(!Array.isArray(this.container[f])){const m=this.container.splice(f,this.container.length-f);this.container.push(m),this.lcIdx>-1&&(this.lcIdx=f)}for(this.indexes.push(this.idx),this.parents.push(this.container),this.lcIdx!==-1&&(e(s(d,this.container[this.lcIdx][0])),f=this.lcIdx+1,this.lcIdx=-1);f<this.container.length&&s(d,this.container[f][0]);)f++;if(this.indexes.push(f),this.idx=0,f<this.container.length&&this.container[f][0]===d)this.container=this.container[f];else{const m=[d];this.container.splice(f,0,m),this.container=m}}}this.pendingDescent.length=0}reset(){this.lcIdx=-1}getComponent(){this.flushDescent();const u=this.idx+1;if(u<this.container.length&&n(this.container[u]))return this.container[u];{const d={};return this.container.splice(u,0,d),d}}write(u,d){const f=this.getComponent();e(f[u]==null||f[u]===d,"Internal consistency error: Overwritten component. File a bug"),f[u]=d}get(){return this._op}descend(u){if(!t.isValidPathItem(u))throw Error("Invalid JSON key");this.pendingDescent.push(u)}descendPath(u){return this.pendingDescent.push(...u),this}ascend(){this.pendingDescent.length?this.pendingDescent.pop():super.ascend()}mergeTree(u,d=r){if(u===null)return;if(e(Array.isArray(u)),u===this._op)throw Error("Cannot merge into my own tree");const f=this.lcIdx,m=this.parents.length;let p=0;for(let y=0;y<u.length;y++){const P=u[y];typeof P=="string"||typeof P=="number"?(p++,this.descend(P)):Array.isArray(P)?this.mergeTree(P,d):typeof P=="object"&&d(P,this)}for(;p--;)this.ascend();this.lcIdx=this.parents.length===m?f:-1}at(u,d){this.descendPath(u),d(this);for(let f=0;f<u.length;f++)this.ascend();return this}writeAtPath(u,d,f){return this.at(u,()=>this.write(d,f)),this.reset(),this}writeMove(u,d,f=0){return this.writeAtPath(u,"p",f).writeAtPath(d,"d",f)}getPath(){const u=super.getPath();return u.push(...this.pendingDescent),u}}t.WriteCursor=l,t.writeCursor=()=>new l,t.readCursor=c=>new o(c);function a(c,u,d){let f,m;m=f=c?c.descendFirst():!1;function p(y){let P;for(;m;){const Z=P=c.getKey();if(y!=null){let gt=!1;if(u&&typeof Z=="number"&&(P=u(Z,c.getComponent()),P<0&&(P=~P,gt=!0)),s(P,y))return null;if(P===y&&!gt)return c}d&&typeof P=="number"&&d(P,c.getComponent()),m=c.nextSibling()}return null}return p.end=()=>{f&&c.ascend()},p}t.advancer=a;function h(c,u,d){let f,m,p,y;for(f=m=c&&c.descendFirst(),p=y=u&&u.descendFirst();f||p;){let P=f?c.getKey():null,Z=p?u.getKey():null;P!==null&&Z!==null&&(s(Z,P)?Z=null:P!==Z&&(P=null)),d(P==null?Z:P,P!=null?c:null,Z!=null?u:null),P!=null&&f&&(f=c.nextSibling()),Z!=null&&p&&(p=u.nextSibling())}m&&c.ascend(),y&&u.ascend()}t.eachChildOf=h})(Os);var Ss={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ConflictType=void 0,function(e){e[e.RM_UNEXPECTED_CONTENT=1]="RM_UNEXPECTED_CONTENT",e[e.DROP_COLLISION=2]="DROP_COLLISION",e[e.BLACKHOLE=3]="BLACKHOLE"}(t.ConflictType||(t.ConflictType={}))})(Ss);var Wn={},Oe={},$s;function Ns(){return $s||($s=1,Object.defineProperty(Oe,"__esModule",{value:!0}),Oe.uniToStrPos=Oe.strPosToUni=void 0,Oe.strPosToUni=(t,e=t.length)=>{let n=0,s=0;for(;s<e;s++){const r=t.charCodeAt(s);r>=55296&&r<=57343&&(n++,s++)}if(s!==e)throw Error("Invalid offset - splits unicode bytes");return s-n},Oe.uniToStrPos=(t,e)=>{let n=0;for(;e>0;e--){const s=t.charCodeAt(n);n+=s>=55296&&s<=57343?2:1}return n}),Oe}var Gn={},Ws;function ns(){return Ws||(Ws=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.uniSlice=t.dlen=t.eachOp=void 0;const e=Ns(),n=E=>{if(!Array.isArray(E))throw Error("Op must be an array of components");let O=null;for(let A=0;A<E.length;A++){const Y=E[A];switch(typeof Y){case"object":if(typeof Y.d!="number"&&typeof Y.d!="string")throw Error("Delete must be number or string");if(t.dlen(Y.d)<=0)throw Error("Deletes must not be empty");break;case"string":if(!(Y.length>0))throw Error("Inserts cannot be empty");break;case"number":if(!(Y>0))throw Error("Skip components must be >0");if(typeof O=="number")throw Error("Adjacent skip components should be combined");break}O=Y}if(typeof O=="number")throw Error("Op has a trailing skip")};function s(E,O){let A=0,Y=0;for(let tt=0;tt<E.length;tt++){const z=E[tt];switch(O(z,A,Y),typeof z){case"object":A+=t.dlen(z.d);break;case"string":Y+=e.strPosToUni(z);break;case"number":A+=z,Y+=z;break}}}t.eachOp=s;function r(E,O){const A=[],Y=l(A);return s(E,(tt,z,Gt)=>{Y(O(tt,z,Gt))}),u(A)}const i=E=>E,o=E=>r(E,i);t.dlen=E=>typeof E=="number"?E:e.strPosToUni(E);const l=E=>O=>{if(!(!O||O.d===0||O.d===""))if(E.length===0)E.push(O);else if(typeof O==typeof E[E.length-1])if(typeof O=="object"){const A=E[E.length-1];A.d=typeof A.d=="string"&&typeof O.d=="string"?A.d+O.d:t.dlen(A.d)+t.dlen(O.d)}else E[E.length-1]+=O;else E.push(O)},a=E=>typeof E=="number"?E:typeof E=="string"?e.strPosToUni(E):typeof E.d=="number"?E.d:e.strPosToUni(E.d);t.uniSlice=(E,O,A)=>{const Y=e.uniToStrPos(E,O),tt=A==null?1/0:e.uniToStrPos(E,A);return E.slice(Y,tt)};const h=(E,O,A)=>typeof E=="number"?A==null?E-O:Math.min(E,A)-O:t.uniSlice(E,O,A),c=E=>{let O=0,A=0;return{take:(z,Gt)=>{if(O===E.length)return z===-1?null:z;const St=E[O];let ft;if(typeof St=="number")return z===-1||St-A<=z?(ft=St-A,++O,A=0,ft):(A+=z,z);if(typeof St=="string"){if(z===-1||Gt==="i"||e.strPosToUni(St.slice(A))<=z)return ft=St.slice(A),++O,A=0,ft;{const Ct=A+e.uniToStrPos(St.slice(A),z);return ft=St.slice(A,Ct),A=Ct,ft}}else{if(z===-1||Gt==="d"||t.dlen(St.d)-A<=z)return ft={d:h(St.d,A)},++O,A=0,ft;{let Ct=h(St.d,A,A+z);return A+=z,{d:Ct}}}},peek:()=>E[O]}},u=E=>(E.length>0&&typeof E[E.length-1]=="number"&&E.pop(),E);function d(E,O,A){if(A!=="left"&&A!=="right")throw Error("side ("+A+") must be 'left' or 'right'");n(E),n(O);const Y=[],tt=l(Y),{take:z,peek:Gt}=c(E);for(let ft=0;ft<O.length;ft++){const Ct=O[ft];let Tt,jt;switch(typeof Ct){case"number":for(Tt=Ct;Tt>0;)jt=z(Tt,"i"),tt(jt),typeof jt!="string"&&(Tt-=a(jt));break;case"string":A==="left"&&typeof Gt()=="string"&&tt(z(-1)),tt(e.strPosToUni(Ct));break;case"object":for(Tt=t.dlen(Ct.d);Tt>0;)switch(jt=z(Tt,"i"),typeof jt){case"number":Tt-=jt;break;case"string":tt(jt);break;case"object":Tt-=t.dlen(jt.d)}break}}let St;for(;St=z(-1);)tt(St);return u(Y)}function f(E,O){n(E),n(O);const A=[],Y=l(A),{take:tt}=c(E);for(let Gt=0;Gt<O.length;Gt++){const St=O[Gt];let ft,Ct;switch(typeof St){case"number":for(ft=St;ft>0;)Ct=tt(ft,"d"),Y(Ct),typeof Ct!="object"&&(ft-=a(Ct));break;case"string":Y(St);break;case"object":ft=t.dlen(St.d);let Tt=0;for(;Tt<ft;)switch(Ct=tt(ft-Tt,"d"),typeof Ct){case"number":Y({d:h(St.d,Tt,Tt+Ct)}),Tt+=Ct;break;case"string":Tt+=e.strPosToUni(Ct);break;case"object":Y(Ct)}break}}let z;for(;z=tt(-1);)Y(z);return u(A)}const m=(E,O)=>{let A=0;for(let Y=0;Y<O.length&&E>A;Y++){const tt=O[Y];switch(typeof tt){case"number":{A+=tt;break}case"string":const z=e.strPosToUni(tt);A+=z,E+=z;break;case"object":E-=Math.min(t.dlen(tt.d),E-A);break}}return E},p=(E,O)=>typeof E=="number"?m(E,O):E.map(A=>m(A,O));function y(E,O,A){return r(E,(Y,tt)=>typeof Y=="object"&&typeof Y.d=="number"?{d:A.slice(O,tt,tt+Y.d)}:Y)}function P(E){return r(E,O=>{switch(typeof O){case"object":if(typeof O.d=="number")throw Error("Cannot invert text op: Deleted characters missing from operation. makeInvertible must be called first.");return O.d;case"string":return{d:O};case"number":return O}})}function Z(E){return r(E,O=>typeof O=="object"&&typeof O.d=="string"?{d:e.strPosToUni(O.d)}:O)}function gt(E){let O=!0;return s(E,A=>{typeof A=="object"&&typeof A.d=="number"&&(O=!1)}),O}function ht(E){return{name:"text-unicode",uri:"http://sharejs.org/types/text-unicode",trim:u,normalize:o,checkOp:n,create(O=""){if(typeof O!="string")throw Error("Initial data must be a string");return E.create(O)},apply(O,A){n(A);const Y=E.builder(O);for(let tt=0;tt<A.length;tt++){const z=A[tt];switch(typeof z){case"number":Y.skip(z);break;case"string":Y.append(z);break;case"object":Y.del(t.dlen(z.d));break}}return Y.build()},transform:d,compose:f,transformPosition:m,transformSelection:p,isInvertible:gt,makeInvertible(O,A){return y(O,A,E)},stripInvertible:Z,invert:P,invertWithDoc(O,A){return P(y(O,A,E))},isNoop:O=>O.length===0}}t.default=ht}(Gn)),Gn}var un={},Gs;function ga(){if(Gs)return un;Gs=1,Object.defineProperty(un,"__esModule",{value:!0});const t=ns(),e=Ns();function n(s,r){return{get:s,getLength(){return s().length},insert(i,o,l){const a=e.strPosToUni(s(),i);return r([a,o],l)},remove(i,o,l){const a=e.strPosToUni(s(),i);return r([a,{d:o}],l)},_onOp(i){t.eachOp(i,(o,l,a)=>{switch(typeof o){case"string":this.onInsert&&this.onInsert(a,o);break;case"object":const h=t.dlen(o.d);this.onRemove&&this.onRemove(a,h)}})},onInsert:null,onRemove:null}}return un.default=n,n.provides={text:!0},un}var js;function ma(){return js||(js=1,function(t){var e=$t&&$t.__createBinding||(Object.create?function(d,f,m,p){p===void 0&&(p=m),Object.defineProperty(d,p,{enumerable:!0,get:function(){return f[m]}})}:function(d,f,m,p){p===void 0&&(p=m),d[p]=f[m]}),n=$t&&$t.__setModuleDefault||(Object.create?function(d,f){Object.defineProperty(d,"default",{enumerable:!0,value:f})}:function(d,f){d.default=f}),s=$t&&$t.__importStar||function(d){if(d&&d.__esModule)return d;var f={};if(d!=null)for(var m in d)Object.hasOwnProperty.call(d,m)&&e(f,d,m);return n(f,d),f},r=$t&&$t.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(t,"__esModule",{value:!0}),t.type=t.remove=t.insert=void 0;const i=Ns(),o=s(ns()),l=r(ga()),a={create(d){return d},toString(d){return d},builder(d){if(typeof d!="string")throw Error("Invalid document snapshot: "+d);const f=[];return{skip(m){let p=i.uniToStrPos(d,m);if(p>d.length)throw Error("The op is too long for this document");f.push(d.slice(0,p)),d=d.slice(p)},append(m){f.push(m)},del(m){d=d.slice(i.uniToStrPos(d,m))},build(){return f.join("")+d}}},slice:o.uniSlice},h=o.default(a),c=Object.assign(Object.assign({},h),{api:l.default});t.type=c,t.insert=(d,f)=>f.length===0?[]:d===0?[f]:[d,f],t.remove=(d,f)=>o.dlen(f)===0?[]:d===0?[{d:f}]:[d,{d:f}];var u=ns();Object.defineProperty(t,"makeType",{enumerable:!0,get:function(){return u.default}})}(Wn)),Wn}(function(t){var e=$t&&$t.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(t,"__esModule",{value:!0}),t.editOp=t.replaceOp=t.insertOp=t.moveOp=t.removeOp=t.type=void 0;const n=e(Rs),s=e(Is),r=Os,i=Ss;function o(g,R){if(!g)throw new Error(R)}t.type={name:"json1",uri:"http://sharejs.org/types/JSONv1",readCursor:r.readCursor,writeCursor:r.writeCursor,create:g=>g,isNoop:g=>g==null,setDebug(g){},registerSubtype:P,checkValidOp:tt,normalize:z,apply:Gt,transformPosition:St,compose:ft,tryTransform:kn,transform:mo,makeInvertible:jt,invert:Ct,invertWithDoc:go,RM_UNEXPECTED_CONTENT:i.ConflictType.RM_UNEXPECTED_CONTENT,DROP_COLLISION:i.ConflictType.DROP_COLLISION,BLACKHOLE:i.ConflictType.BLACKHOLE,transformNoConflict:(g,R,N)=>Ds(()=>!0,g,R,N),typeAllowingConflictsPred:g=>Object.assign(Object.assign({},t.type),{transform:(R,N,L)=>Ds(g,R,N,L)})};const l=g=>g?g.getComponent():null;function a(g){return g&&typeof g=="object"&&!Array.isArray(g)}const h=g=>Array.isArray(g)?g.slice():g!==null&&typeof g=="object"?Object.assign({},g):g,c=g=>g&&(g.p!=null||g.r!==void 0),u=g=>g&&(g.d!=null||g.i!==void 0);function d(g,R){return o(g!=null),typeof R=="number"?(o(Array.isArray(g),"Invalid key - child is not an array"),(g=g.slice()).splice(R,1)):(o(a(g),"Invalid key - child is not an object"),delete(g=Object.assign({},g))[R]),g}function f(g,R,N){return typeof R=="number"?(o(g!=null,"Container is missing for key"),o(Array.isArray(g),"Cannot use numerical key for object container"),o(g.length>=R,"Cannot insert into out of bounds index"),g.splice(R,0,N)):(o(a(g),"Cannot insert into missing item"),o(g[R]===void 0,"Trying to overwrite value at key. Your op needs to remove it first"),g[R]=N),N}t.removeOp=(g,R=!0)=>r.writeCursor().writeAtPath(g,"r",R).get(),t.moveOp=(g,R)=>r.writeCursor().writeMove(g,R).get(),t.insertOp=(g,R)=>r.writeCursor().writeAtPath(g,"i",R).get(),t.replaceOp=(g,R,N)=>r.writeCursor().at(g,L=>{L.write("r",R),L.write("i",N)}).get(),t.editOp=(g,R,N,L=!1)=>r.writeCursor().at(g,b=>O(b,R,N,L)).get();const m=(g,R)=>g!=null&&(typeof R=="number"?Array.isArray(g):typeof g=="object"),p=(g,R)=>m(g,R)?g[R]:void 0,y={};function P(g){let R=g.type?g.type:g;R.name&&(y[R.name]=R),R.uri&&(y[R.uri]=R)}const Z=g=>{const R=y[g];if(R)return R;throw Error("Missing type: "+g)};P(ma());const gt=(g,R)=>g+R;P({name:"number",apply:gt,compose:gt,invert:g=>-g,transform:g=>g});const ht=g=>g==null?null:g.et?Z(g.et):g.es?y["text-unicode"]:g.ena!=null?y.number:null,E=g=>g.es?g.es:g.ena!=null?g.ena:g.e,O=(g,R,N,L=!1)=>{const[b,T]=typeof R=="string"?[Z(R),R]:[R,R.name];!L&&b.isNoop&&b.isNoop(N)||(T==="number"?g.write("ena",N):T==="text-unicode"?g.write("es",N):(g.write("et",T),g.write("e",N)))};function A(g){o(typeof g=="number"),o(g>=0),o(g===(0|g))}function Y(g){typeof g=="number"?A(g):o(typeof g=="string")}function tt(g){if(g===null)return;const R=new Set,N=new Set,L=T=>{let G=!0,$=!1;for(let C in T){const S=T[C];if(G=!1,o(C==="p"||C==="r"||C==="d"||C==="i"||C==="e"||C==="es"||C==="ena"||C==="et","Invalid component item '"+C+"'"),C==="p")A(S),o(!R.has(S)),R.add(S),o(T.r===void 0);else if(C==="d")A(S),o(!N.has(S)),N.add(S),o(T.i===void 0);else if(C==="e"||C==="es"||C==="ena"){o(!$),$=!0;const v=ht(T);o(v,"Missing type in edit"),v.checkValidOp&&v.checkValidOp(E(T))}}o(!G)},b=(T,G,$)=>{if(!Array.isArray(T))throw Error("Op must be null or a list");if(T.length===0)throw Error("Empty descent");G||Y(T[0]);let C=1,S=0,v=0;for(let w=0;w<T.length;w++){const W=T[w];if(o(W!=null),Array.isArray(W)){const j=b(W,!1);if(S){const I=typeof v,H=typeof j;I===H?o(v<j,"descent keys are not in order"):o(I==="number"&&H==="string")}v=j,S++,C=3}else typeof W=="object"?(o(C===1,`Prev not scalar - instead ${C}`),L(W),C=2):(o(C!==3),Y(W),o(r.isValidPathItem(W),"Invalid path key"),C=1)}return o(S!==1,"Operation makes multiple descents. Remove some []"),o(C===2||C===3),T[0]};b(g,!0),o(R.size===N.size,"Mismatched picks and drops in op");for(let T=0;T<R.size;T++)o(R.has(T)),o(N.has(T))}function z(g){let R=0,N=[];const L=r.writeCursor();return L.mergeTree(g,(b,T)=>{const G=ht(b);if(G){const C=E(b);O(T,G,G.normalize?G.normalize(C):C)}for(const C of["r","p","i","d"])if(b[C]!==void 0){const S=C==="p"||C==="d"?($=b[C],N[$]==null&&(N[$]=R++),N[$]):b[C];T.write(C,S)}var $}),L.get()}function Gt(g,R){if(tt(R),R===null)return g;const N=[];return function L(b,T){let G=b,$=0,C={root:b},S=0,v=C,w="root";function W(){for(;S<$;S++){let j=T[S];typeof j!="object"&&(o(m(v,w)),v=v[w]=h(v[w]),w=j)}}for(;$<T.length;$++){const j=T[$];if(Array.isArray(j)){const I=L(G,j);I!==G&&I!==void 0&&(W(),G=v[w]=I)}else if(typeof j=="object"){j.d!=null?(W(),G=f(v,w,N[j.d])):j.i!==void 0&&(W(),G=f(v,w,j.i));const I=ht(j);if(I)W(),G=v[w]=I.apply(G,E(j));else if(j.e!==void 0)throw Error("Subtype "+j.et+" undefined")}else G=p(G,j)}return C.root}(g=function L(b,T){const G=[];let $=0;for(;$<T.length;$++){const w=T[$];if(Array.isArray(w))break;typeof w!="object"&&(G.push(b),b=p(b,w))}for(let w=T.length-1;w>=$;w--)b=L(b,T[w]);for(--$;$>=0;$--){const w=T[$];if(typeof w!="object"){const W=G.pop();b=b===p(W,w)?W:b===void 0?d(W,w):(S=w,v=b,(C=h(C=W))[S]=v,C)}else c(w)&&(o(b!==void 0,"Cannot pick up or remove undefined"),w.p!=null&&(N[w.p]=b),b=void 0)}var C,S,v;return b}(g,R),R)}function St(g,R){g=g.slice(),tt(R);const N=r.readCursor(R);let L,b,T=!1;const G=[];for(let C=0;;C++){const S=g[C],v=N.getComponent();if(v&&(v.r!==void 0?T=!0:v.p!=null&&(T=!1,L=v.p,b=C)),C>=g.length)break;let w=0;const W=r.advancer(N,void 0,(I,H)=>{c(H)&&w++});G.unshift(W);const j=W(S);if(typeof S=="number"&&(g[C]-=w),!j)break}if(G.forEach(C=>C.end()),T)return null;const $=()=>{let C=0;if(L!=null){const S=N.getPath();C=S.length,g=S.concat(g.slice(b))}for(;C<g.length;C++){const S=g[C],v=l(N),w=ht(v);if(w){const I=E(v);w.transformPosition&&(g[C]=w.transformPosition(g[C],I));break}let W=0;const j=r.advancer(N,(I,H)=>u(H)?~(I-W):I-W,(I,H)=>{u(H)&&W++})(S);if(typeof S=="number"&&(g[C]+=W),!j)break}};return L!=null?N.eachDrop(null,C=>{C===L&&$()}):$(),g}function ft(g,R){if(tt(g),tt(R),g==null)return R;if(R==null)return g;let N=0;const L=r.readCursor(g),b=r.readCursor(R),T=r.writeCursor(),G=[],$=[],C=[],S=[],v=[],w=[],W=new Set;L.traverse(null,I=>{I.p!=null&&(C[I.p]=L.clone())}),b.traverse(null,I=>{I.d!=null&&(S[I.d]=b.clone())});const j=r.writeCursor();return function I(H,_t,at,X,pt,ie,Pt,Lt){o(_t||at);const Et=l(_t),Vt=l(at),qt=!!Vt&&Vt.r!==void 0,Ee=!!Et&&Et.i!==void 0,Kt=Et?Et.d:null,Wt=Vt?Vt.p:null,oe=(ie||qt)&&Wt==null;if(Wt!=null)X=S[Wt],Pt=$[Wt]=new r.WriteCursor;else if(Vt&&Vt.r!==void 0)X=null;else{const U=l(X);U&&U.d!=null&&(X=null)}const it=l(X);if(Kt!=null)if(H=C[Kt],Lt=G[Kt]=new r.WriteCursor,oe)ie&&!qt&&Lt.write("r",!0);else{const U=v[Kt]=N++;Pt.write("d",U)}else if(Et&&Et.i!==void 0)H=null;else{const U=l(H);U&&U.p!=null&&(H=null)}let x;Ee?(o(pt===void 0),x=Et.i):x=pt;const V=(Wt==null?!Ee||ie||qt:x===void 0)?null:Pt.getComponent();if(Wt!=null){if(!(pt!==void 0||Ee)){const U=Kt!=null?v[Kt]:N++;w[Wt]=U,Lt.write("p",U)}}else qt&&(Ee||pt!==void 0||(Vt.r,Lt.write("r",Vt.r)));const k=oe?null:ht(Et),M=ht(it);if((k||M)&&(k&&k.name,M&&M.name),k&&M){o(k===M);const U=E(Et),K=E(it),wt=k.compose(U,K);O(Pt,k,wt),W.add(it)}else k?O(Pt,k,E(Et)):M&&(O(Pt,M,E(it)),W.add(it));const F=typeof x=="object"&&x!=null;let nt=!1,st=0,lt=0,At=0,Nt=0,Rt=0;const Dt=r.advancer(X,(U,K)=>u(K)?Nt-U-1:U-Nt,(U,K)=>{u(K)&&Nt++}),Q=r.advancer(H,(U,K)=>c(K)?st-U-1:U-st,(U,K)=>{c(K)&&st++});if(r.eachChildOf(_t,at,(U,K,wt)=>{let kt,le,Re=U,Jt=U,He=U;if(typeof U=="number"){let Mt=U+At;le=Dt(Mt),Jt=Mt+Nt;let It=U+lt;kt=Q(It),u(l(le))&&(kt=null),Re=It+st,He=U+Rt,o(Re>=0,"p1PickKey is negative"),o(Jt>=0,"p2DropKey is negative");const Zt=u(l(K)),ae=c(l(wt));(Zt||ae&&!oe)&&Rt--,Zt&<--,ae&&At--}else kt=Q(U),le=Dt(U);Lt.descend(Re),Pt.descend(Jt);const Le=F&&!u(l(K))?x[He]:void 0,ne=I(kt,K,wt,le,Le,oe,Pt,Lt);var se,B,mt;F&&!oe?Le!==ne&&(nt||(x=Array.isArray(x)?x.slice():Object.assign({},x),nt=!0),se=x,mt=ne,typeof(B=He)=="number"?(o(Array.isArray(se)),o(B<se.length)):(o(!Array.isArray(se)),o(se[B]!==void 0)),mt===void 0?typeof B=="number"?se.splice(B,1):delete se[B]:se[B]=mt):o(ne===void 0),Pt.ascend(),Lt.ascend()}),Q.end(),Dt.end(),V!=null)V.i=x;else if(!ie&&!qt&&Wt==null)return x}(L,L.clone(),b,b.clone(),void 0,!1,T,j),T.reset(),T.mergeTree(j.get()),T.reset(),T.get(),G.map(I=>I.get()),$.map(I=>I.get()),L.traverse(T,(I,H)=>{const _t=I.p;if(_t!=null){const at=v[_t];at!=null&&H.write("p",at);const X=G[_t];X&&X.get(),X&&H.mergeTree(X.get())}else I.r!==void 0&&H.write("r",I.r)}),T.reset(),T.get(),b.traverse(T,(I,H)=>{const _t=I.d;if(_t!=null){const X=w[_t];X!=null&&H.write("d",X);const pt=$[_t];pt&&H.mergeTree(pt.get())}else I.i!==void 0&&H.write("i",I.i);const at=ht(I);at&&!W.has(I)&&O(H,at,E(I))}),T.get()}function Ct(g){if(g==null)return null;const R=new r.ReadCursor(g),N=new r.WriteCursor;let L;const b=[],T=[];return function G($,C,S){const v=$.getComponent();let w,W=!1;if(v){v.p!=null&&(C.write("d",v.p),b[v.p]=$.clone()),v.r!==void 0&&C.write("i",v.r),v.d!=null&&(C.write("p",v.d),S=void 0),v.i!==void 0&&(S=w=v.i);const I=ht(v);I&&(S===void 0?(L||(L=new Set),L.add(v)):(E(v),S=I.apply(S,E(v)),W=!0))}let j=0;for(const I of $){C.descend(I);const H=typeof I=="number"?I-j:I,_t=p(S,H);u($.getComponent())&&j++;const at=G($,C,_t);if(S!==void 0&&at!==void 0){if(W||(W=!0,S=h(S)),!m(S,H))throw Error("Cannot modify child - invalid operation");S[H]=at}C.ascend()}if(w===void 0)return W?S:void 0;C.write("r",S)}(R,N,void 0),L&&(N.reset(),function G($,C,S){const v=C.getComponent();if(v){const I=v.d;if(I!=null&&($=b[I],S=T[I]=r.writeCursor()),L.has(v)){const H=ht(v);if(!H.invert)throw Error(`Cannot invert subtype ${H.name}`);O(S,H,H.invert(E(v)))}}let w=0,W=0;const j=r.advancer($,(I,H)=>c(H)?w-I-1:I-w,(I,H)=>{c(H)&&w++});for(const I of C)if(typeof I=="number"){const H=I-W,_t=j(H),at=H+w;S.descend(at),G(_t,C,S),u(C.getComponent())&&W++,S.ascend()}else S.descend(I),G(j(I),C,S),S.ascend();j.end()}(R.clone(),R,N),T.length&&(N.reset(),R.traverse(N,(G,$)=>{const C=G.p;if(C!=null){const S=T[C];S&&S.get(),S&&$.mergeTree(S.get())}}))),N.get()}const Tt=(g,R)=>g.some(N=>typeof N=="object"&&(Array.isArray(N)?Tt(N,R):R(N)));function jt(g,R){if(g==null||!Tt(g,C=>{var S;return C.r!==void 0||((S=ht(C))===null||S===void 0?void 0:S.makeInvertible)!=null}))return g;const N=new r.ReadCursor(g),L=new r.WriteCursor;let b=!1;const T=[],G=[],$=(C,S,v)=>{const w=C.getComponent();let W=!1;if(w){w.d!=null&&S.write("d",w.d),w.i!==void 0&&S.write("i",w.i);const I=w.p;if(I!=null&&(T[I]=C.clone(),o(v!==void 0,"Operation picks up at an invalid key"),G[I]=v,S.write("p",w.p)),w.r!==void 0&&v===void 0)throw Error("Invalid doc / op in makeInvertible: removed item missing from doc");const H=ht(w);H&&(H.makeInvertible?b=!0:O(S,H,E(w),!0))}let j=0;for(const I of C){S.descend(I);const H=typeof I=="number"?I-j:I,_t=p(v,H),at=$(C,S,_t);_t!==at&&(W||(W=!0,v=h(v)),at===void 0?(v=d(v,H),typeof I=="number"&&j++):v[H]=at),S.ascend()}return w&&(w.r!==void 0?(S.write("r",s.default(v)),v=void 0):w.p!=null&&(v=void 0)),v};return $(N,L,R),L.get(),b&&(L.reset(),function C(S,v,w,W,j){const I=v.getComponent();if(I){I.i!==void 0?(W=I.i,j=!0):I.d!=null&&(W=G[I.d],S=T[I.d],j=!1,I.d);let X=ht(I);if(X&&X.makeInvertible){const pt=E(I);O(w,X,X.makeInvertible(pt,W),!0)}}let H=0,_t=0;const at=r.advancer(S,(X,pt)=>c(pt)?H-X-1:X-H,(X,pt)=>{c(pt)&&H++});for(const X of v)if(typeof X=="number"){const pt=X-_t,ie=at(pt),Pt=pt+H,Lt=p(W,j?pt:Pt);w.descend(X),C(ie,v,w,Lt,j),u(v.getComponent())&&_t++,w.ascend()}else{const pt=p(W,X);w.descend(X),C(at(X),v,w,pt,j),w.ascend()}at.end()}(N.clone(),N,L,R,!1)),L.get()}function go(g,R){return Ct(jt(g,R))}const xn=g=>{if(g==null)return null;const R=g.slice();for(let N=0;N<g.length;N++){const L=R[N];Array.isArray(L)&&(R[N]=xn(L))}return R};function kn(g,R,N){o(N==="left"||N==="right","Direction must be left or right");const L=N==="left"?0:1;if(R==null)return{ok:!0,result:g};tt(g),tt(R);let b=null;const T=[],G=[],$=[],C=[],S=[],v=[],w=[],W=[],j=[],I=[],H=[],_t=[],at=[],X=[],pt=[];let ie=0;const Pt=r.readCursor(g),Lt=r.readCursor(R),Et=r.writeCursor();if(function it(x,V=null,k){const M=l(V);M&&(M.r!==void 0?k=V.clone():M.p!=null&&(k=null,v[M.p]=x.clone()));const F=x.getComponent();let nt;F&&(nt=F.p)!=null&&(S[nt]=V?V.clone():null,$[nt]=x.clone(),k&&(I[nt]=!0,j[nt]=k),M&&M.p!=null&&(X[nt]=M.p));const st=r.advancer(V);for(const lt of x)it(x,st(lt),k);st.end()}(Lt,Pt,null),function it(x,V,k,M,F){const nt=k.getComponent();let st,lt=!1;nt&&((st=nt.d)!=null?(C[st]=k.clone(),M!=null&&(pt[M]==null&&(pt[M]=[]),pt[M].push(st)),x=S[st]||null,V=$[st]||null,I[st]?(F&&(H[st]=!0),F=j[st]||null):!F||L!==1&&X[st]!=null||b==null&&(b={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:t.removeOp(F.getPath()),op2:t.moveOp(V.getPath(),k.getPath())}),lt=!0):nt.i!==void 0&&(x=V=null,lt=!0,F&&b==null&&(b={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:t.removeOp(F.getPath()),op2:t.insertOp(k.getPath(),nt.i)})));const At=l(x);At&&(At.r!==void 0?F=x.clone():At.p!=null&&(At.p,M=At.p,F=null));const Nt=ht(nt);Nt&&F&&b==null&&(b={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:t.removeOp(F.getPath()),op2:t.editOp(k.getPath(),Nt,E(nt),!0)});let Rt=0,Dt=0;const Q=r.advancer(V,(K,wt)=>c(wt)?Rt-K-1:K-Rt,(K,wt)=>{c(wt)&&Rt++}),U=r.advancer(x);for(const K of k)if(typeof K=="number"){const wt=K-Dt,kt=Q(wt);Dt+=+it(U(wt+Rt),kt,k,M,F)}else{const wt=Q(K);it(U(K),wt,k,M,F)}return Q.end(),U.end(),lt}(Pt,Lt,Lt.clone(),null,null),C.map(it=>it&&it.get()),b)return{ok:!1,conflict:b};H.map(it=>!!it);const Vt=[];let qt=null;(function it(x,V,k,M,F){let nt=!1;const st=l(V);if(c(st)){const Q=st.p;Q!=null?(k=C[Q],M=_t[Q]=r.writeCursor(),nt=!0,F=null):(k=null,F=V.clone())}else u(l(k))&&(k=null);const lt=x.getComponent();if(lt){const Q=lt.p;Q!=null?(F&&(W[Q]=F),Vt[Q]=F||L===1&&nt?null:M.getComponent(),T[Q]=x.clone(),k&&(w[Q]=k.clone())):lt.r!==void 0&&(F||M.write("r",!0),(F||nt)&&(qt==null&&(qt=new Set),qt.add(lt)))}let At=0,Nt=0;const Rt=r.advancer(V,void 0,(Q,U)=>{c(U)&&At++}),Dt=r.advancer(k,(Q,U)=>u(U)?~(Q-Nt):Q-Nt,(Q,U)=>{u(U)&&Nt++});if(x)for(const Q of x)if(typeof Q=="string"){const U=Rt(Q),K=Dt(Q);M.descend(Q),it(x,U,K,M,F),M.ascend()}else{const U=Rt(Q),K=Q-At,wt=c(l(U))?null:Dt(K),kt=K+Nt;o(kt>=0),M.descend(kt),it(x,U,wt,M,F),M.ascend()}Rt.end(),Dt.end()})(Pt,Lt,Lt.clone(),Et,null),Et.reset();let Ee=[];if(function it(x,V,k,M,F,nt){o(V);const st=V.getComponent();let lt=l(M),At=!1;const Nt=(B,mt,Mt)=>B?t.moveOp(B.getPath(),mt.getPath()):t.insertOp(mt.getPath(),Mt.i);if(u(st)){const B=st.d;B!=null&&(G[B]=V.clone());const mt=B!=null?Vt[B]:null;let Mt=!1;if(st.i!==void 0||B!=null&&mt){let It;lt&&(lt.i!==void 0||(It=lt.d)!=null&&!I[It])&&(Mt=It!=null?B!=null&&B===X[It]:n.default(lt.i,st.i),Mt||It!=null&&L!==1&&X[It]!=null||b==null&&(b={type:i.ConflictType.DROP_COLLISION,op1:Nt(B!=null?T[B]:null,V,st),op2:Nt(It!=null?$[It]:null,M,lt)})),Mt||(nt?b==null&&(b={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:Nt(B!=null?T[B]:null,V,st),op2:t.removeOp(nt.getPath())}):(B!=null?(Ee[ie]=B,F.write("d",mt.p=ie++)):F.write("i",s.default(st.i)),At=!0))}else if(B!=null&&!mt){const It=W[B];It&&(nt=It.clone())}B!=null?(x=T[B],k=v[B],M=w[B]):st.i!==void 0&&(x=k=null,Mt||(M=null))}else c(l(x))&&(x=k=M=null);const Rt=l(x),Dt=l(k);if(c(Dt)){const B=Dt.p;Dt.r!==void 0&&(!Rt||Rt.r===void 0)||I[B]?(M=null,nt=k.clone()):B!=null&&(M=C[B],L!==1&&X[B]!=null||((F=at[B])||(F=at[B]=r.writeCursor()),F.reset(),nt=null))}else!u(st)&&u(lt)&&(M=null);lt=M!=null?M.getComponent():null;const Q=ht(st);if(Q){const B=E(st);if(nt)b==null&&(b={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:t.editOp(V.getPath(),Q,B,!0),op2:t.removeOp(nt.getPath())});else{const mt=ht(lt);let Mt;if(mt){if(Q!==mt)throw Error("Transforming incompatible types");const It=E(lt);Mt=Q.transform(B,It,N)}else Mt=s.default(B);O(F,Q,Mt)}}let U=0,K=0,wt=0,kt=0,le=0,Re=0,Jt=x!=null&&x.descendFirst(),He=Jt;const Le=r.advancer(k,void 0,(B,mt)=>{c(mt)&&wt++});let ne=M!=null&&M.descendFirst(),se=ne;for(const B of V)if(typeof B=="number"){let mt;const Mt=u(V.getComponent()),It=B-K;{let ce;for(;Jt&&typeof(ce=x.getKey())=="number";){ce+=U;const Qt=x.getComponent(),Me=c(Qt);if(ce>It||ce===It&&(!Me||L===0&&Mt))break;if(Me){U--;const Ce=Qt.p;X.includes(Ce),Qt.d,l(at[Qt.d]),c(l(at[Qt.d])),(Qt.r===void 0||qt&&qt.has(Qt))&&(Ce==null||!Vt[Ce]||L!==1&&X.includes(Ce))||le--}Jt=x.nextSibling()}mt=Jt&&ce===It?x:null}const Zt=It-U;let ae=Le(Zt);const Hn=Zt-wt;let sn=null;{let ce,Qt;for(;ne&&typeof(ce=M.getKey())=="number";){Qt=ce-kt;const Me=M.getComponent(),Ce=u(Me);if(Qt>Hn)break;if(Qt===Hn){if(!Ce){sn=M;break}{if(L===0&&Mt){sn=M;break}const Ie=ae&&c(ae.getComponent());if(L===0&&Ie)break}}if(Ce){const Ie=Me.d;X[Ie],Me.i===void 0&&(I[Ie]||X[Ie]!=null&&L!==1)?(I[Ie]||X[Ie]!=null&&L===0)&&(kt++,Re--):kt++}ne=M.nextSibling()}}const ys=Hn+kt+le+Re;o(ys>=0,"trying to descend to a negative index"),F.descend(ys),Mt&&(mt=ae=sn=null,K++),it(mt,V,ae,sn,F,nt)&&Re++,F.ascend()}else{let mt;for(;Jt&&(mt=x.getKey(),typeof mt!="string"||!(mt>B||mt===B));)Jt=x.nextSibling();const Mt=Jt&&mt===B?x:null,It=Le(B);let Zt;for(;ne&&(Zt=M.getKey(),typeof Zt!="string"||!(Zt>B||Zt===B));)ne=M.nextSibling();const ae=ne&&Zt===B?M:null;F.descend(B),it(Mt,V,It,ae,F,nt),F.ascend()}return Le.end(),He&&x.ascend(),se&&M.ascend(),At}(Pt,Pt.clone(),Lt,Lt.clone(),Et,null),b)return{ok:!1,conflict:b};Et.reset();const Kt=(it,x,V)=>it.traverse(x,(k,M)=>{k.d!=null&&V(k.d,it,M)});(I.length||_t.length)&&(Kt(Lt,Et,(it,x,V)=>{I[it]&&!H[it]&&V.write("r",!0),_t[it]&&V.mergeTree(_t[it].get())}),Et.reset());const Wt=[],oe=[];if((at.length||I.length)&&!b){const it=r.readCursor(xn(Et.get()));if(Kt(it,null,(x,V)=>{Wt[x]=V.clone()}),at.forEach(x=>{x&&Kt(r.readCursor(x.get()),null,(V,k)=>{Wt[V]=k.clone()})}),function x(V,k,M,F,nt,st){const lt=l(k);if(lt&&c(lt))if(lt.p!=null){const U=lt.p;Wt[U].getPath(),M=Wt[U],F=oe[U]=r.writeCursor()}else lt.r!==void 0&&(M=null);else u(l(M))&&(M=null);const At=V.getComponent();if(At){let U;if((U=At.d)!=null){const K=at[U];K&&(K.get(),F.mergeTree(K.get()),M=r.readCursor(K.get()))}}let Nt=0,Rt=0;const Dt=r.advancer(k,void 0,(U,K)=>{c(K)&&Nt--}),Q=r.advancer(M,(U,K)=>u(K)?-(U-Rt)-1:U-Rt,(U,K)=>{u(K)&&Rt++});for(const U of V)if(typeof U=="number"){const K=Dt(U),wt=U+Nt,kt=Q(wt),le=wt+Rt;F.descend(le),x(V,K,kt,F),F.ascend()}else F.descend(U),x(V,Dt(U),Q(U),F),F.ascend();Dt.end(),Q.end()}(Lt,it,it.clone(),Et),Et.reset(),b)return{ok:!1,conflict:b};if(Et.get(),oe.length){const x=oe.map(k=>k?k.get():null),V=r.readCursor(xn(Et.get()));if(Kt(V,Et,(k,M,F)=>{const nt=x[k];nt&&(F.mergeTree(nt),x[k]=null)}),x.find(k=>k)){const k=r.writeCursor(),M=r.writeCursor();let F=0,nt=0;x.forEach(st=>{st!=null&&Kt(r.readCursor(st),null,lt=>{const At=Ee[lt];k.writeMove(T[At].getPath(),G[At].getPath(),F++);const Nt=pt[At];Nt&&Nt.forEach(Rt=>{I[Rt]||L!==1&&X[Rt]!=null||M.writeMove($[Rt].getPath(),C[Rt].getPath(),nt++)})})}),b={type:i.ConflictType.BLACKHOLE,op1:k.get(),op2:M.get()}}}}return b?{ok:!1,conflict:b}:{ok:!0,result:Et.get()}}const Us=g=>{const R=new Error("Transform detected write conflict");throw R.conflict=g,R.type=R.name="writeConflict",R};function mo(g,R,N){const L=kn(g,R,N);if(L.ok)return L.result;Us(L.conflict)}const Te=g=>{const R=r.writeCursor();return r.readCursor(g).traverse(R,(N,L)=>{(u(N)||ht(N))&&L.write("r",!0)}),R.get()},po=(g,R)=>{const{type:N,op1:L,op2:b}=g;switch(N){case i.ConflictType.DROP_COLLISION:return R==="left"?[null,Te(b)]:[Te(L),null];case i.ConflictType.RM_UNEXPECTED_CONTENT:let T=!1;return r.readCursor(L).traverse(null,G=>{G.r!==void 0&&(T=!0)}),T?[null,Te(b)]:[Te(L),null];case i.ConflictType.BLACKHOLE:return[Te(L),Te(b)];default:throw Error("Unrecognised conflict: "+N)}};function Ds(g,R,N,L){let b=null;for(;;){const T=kn(R,N,L);if(T.ok)return ft(b,T.result);{const{conflict:G}=T;g(G)||Us(G);const[$,C]=po(G,L);R=ft(z(R),$),N=ft(z(N),C),b=ft(b,C)}}}})(vi);(function(t){var e=$t&&$t.__createBinding||(Object.create?function(i,o,l,a){a===void 0&&(a=l),Object.defineProperty(i,a,{enumerable:!0,get:function(){return o[l]}})}:function(i,o,l,a){a===void 0&&(a=l),i[a]=o[l]}),n=$t&&$t.__exportStar||function(i,o){for(var l in i)l!=="default"&&!o.hasOwnProperty(l)&&e(o,i,l)};Object.defineProperty(t,"__esModule",{value:!0}),n(vi,t);var s=Os;Object.defineProperty(t,"ReadCursor",{enumerable:!0,get:function(){return s.ReadCursor}}),Object.defineProperty(t,"WriteCursor",{enumerable:!0,get:function(){return s.WriteCursor}});var r=Ss;Object.defineProperty(t,"ConflictType",{enumerable:!0,get:function(){return r.ConflictType}})})(Bt);const pa=da(Bt),Ea=Co({__proto__:null,default:pa},[Bt]);var J=(t=>(t.RETAIN="r",t.INSERT="i",t.DELETE="d",t))(J||{});class ss{constructor(e){_(this,"_index",0);_(this,"_offset",0);this._actions=e}hasNext(){return this.peekLength()<Number.POSITIVE_INFINITY}next(e){e||(e=Number.POSITIVE_INFINITY);const n=this._actions[this._index];if(n){const s=this._offset,r=n.len;return e>=r-s?(e=r-s,this._index+=1,this._offset=0):this._offset+=e,n.t===J.DELETE||n.t===J.RETAIN&&n.body==null?D.deepClone({...n,len:e}):D.deepClone({...n,len:e,body:Je(n.body,s,s+e)})}else return{t:J.RETAIN,len:Number.POSITIVE_INFINITY}}peek(){return this._actions[this._index]}peekLength(){return this._actions[this._index]?this._actions[this._index].len-this._offset:Number.POSITIVE_INFINITY}peekType(){const e=this._actions[this._index];return e?e.t:J.RETAIN}rest(){if(this.hasNext()){if(this._offset===0)return this._actions.slice(this._index);{const e=this._offset,n=this._index,s=this.next(),r=this._actions.slice(this._index);return this._offset=e,this._index=n,[s].concat(r)}}else return[]}}class Ai{constructor(){_(this,"cursor",0)}reset(){return this.cursor=0,this}moveCursor(e){this.cursor+=e}moveCursorTo(e){this.cursor=e}}function Ra(t,e,n){const{dataStream:s}=t,r=n,i=n+e,o=Ri(t,e,n),l=Ci(t,e,n),a=Ii(t,e,n),h=Oi(t,e,n),c=Si(t,e,n),u=Ni(t,e,n);let d="";return s&&(t.dataStream=qr(s,r,i),d=s.slice(r,i)),{dataStream:d,textRuns:o,paragraphs:l,sectionBreaks:a,customBlocks:h,tables:c,customRanges:u}}function Ca(t,e,n,s){t.dataStream=Xr(t.dataStream,s,e.dataStream),pi(t,e,n,s),ps(t,e,n,s),ea(t,e,n,s),Ei(t,e,n,s),Es(t,e,n,s),na(t,e,n,s)}function Ia(t,e,n,s,r=xt.COVER){return sa(t,e,n,s,r)}function Oa(t,e,n){return e<=0?{dataStream:""}:Ra(t,e,n)}function Sa(t,e,n,s){n!==0&&Ca(t,e,n,s)}function Na(t,e){const n=new Ai;return n.reset(),e.forEach(s=>{switch(s=D.deepClone(s),s.t){case J.RETAIN:{const{coverType:r,body:i,len:o}=s;i!=null&&Ia(t,i,o,n.cursor,r),n.moveCursor(o);break}case J.INSERT:{const{body:r,len:i}=s;Sa(t,r,i,n.cursor),n.moveCursor(i);break}case J.DELETE:{const{len:r}=s;Oa(t,r,n.cursor);break}default:throw new Error(`Unknown action type for action: ${s}.`)}}),t}function Vs(t){return Object.keys(t).length===1}const ze=class ze{constructor(){_(this,"_actions",[])}static apply(e,n){return Na(e,n)}static compose(e,n){const s=new ss(e),r=new ss(n),i=new ze;for(;s.hasNext()||r.hasNext();)if(r.peekType()===J.INSERT)i.push(r.next());else if(s.peekType()===J.DELETE)i.push(s.next());else{const o=Math.min(s.peekLength(),r.peekLength()),l=s.next(o),a=r.next(o);l.t===J.INSERT&&a.t===J.RETAIN?a.body==null?i.push(l):i.push({...l,body:ts(l.body,a.body,a.coverType)}):l.t===J.RETAIN&&a.t===J.RETAIN?l.body==null&&a.body==null?i.push(l.len!==Number.POSITIVE_INFINITY?l:a):l.body&&a.body?i.push({...l,body:ts(l.body,a.body,a.coverType)}):i.push(l.body?l:a):l.t===J.RETAIN&&a.t===J.DELETE?i.push(a):l.t===J.INSERT&&(a.t,J.DELETE)}return i.trimEndUselessRetainAction(),i.serialize()}static transform(e,n,s){throw new Error("transform is not implemented in TextX")}static isNoop(e){return e.length===0}static invert(e){const n=[];for(const s of e)if(s.t===J.INSERT)n.push({t:J.DELETE,len:s.len,line:0,body:s.body,segmentId:s.segmentId});else if(s.t===J.DELETE){if(s.body==null)throw new Error("Can not invert DELETE action without body property, makeInvertible must be called first.");n.push({t:J.INSERT,body:s.body,len:s.len,line:0,segmentId:s.segmentId})}else if(s.body!=null){if(s.oldBody==null)throw new Error("Can not invert RETAIN action without oldBody property, makeInvertible must be called first.");n.push({t:J.RETAIN,body:s.oldBody,oldBody:s.body,len:s.len,coverType:xt.REPLACE,segmentId:s.segmentId})}else n.push(s);return n}static makeInvertible(e,n){const s=[];let r=0;for(const i of e){if(i.t===J.DELETE&&i.body==null){const o=Je(n,r,r+i.len,!1);i.body=o}if(i.t===J.RETAIN&&i.body!=null){const{textRuns:o}=Je(n,r,r+i.len,!0);i.oldBody={dataStream:"",textRuns:o}}s.push(i),i.t!==J.INSERT&&(r+=i.len)}return s}insert(e,n,s=""){const r={t:J.INSERT,body:n,len:e,line:0,segmentId:s};return this.push(r),this}retain(e,n="",s,r){const i={t:J.RETAIN,len:e,segmentId:n};return s!=null&&(i.body=s),r!=null&&(i.coverType=r),this.push(i),this}delete(e,n=""){const s={t:J.DELETE,len:e,line:0,segmentId:n};return this.push(s),this}serialize(){return this._actions}push(...e){if(e.length>1){for(const i of e)this.push(i);return this}let n=this._actions.length,s=this._actions[n-1];const r=D.deepClone(e[0]);if(r.t===J.RETAIN&&r.len===0&&r.body==null)return this;if(typeof s=="object"){if(s.t===J.DELETE&&r.t===J.DELETE)return s.len+=r.len,this;if(s.t===J.DELETE&&r.t===J.INSERT&&(n-=1,s=this._actions[n-1],s==null))return this._actions.unshift(r),this;if(s.t===J.RETAIN&&r.t===J.RETAIN&&s.body==null&&r.body==null)return s.len+=r.len,this;if(s.t===J.INSERT&&Vs(s.body)&&r.t===J.INSERT&&Vs(r.body))return s.len+=r.len,s.body.dataStream+=r.body.dataStream,this}return n===this._actions.length?this._actions.push(r):this._actions.splice(n,0,r),this}trimEndUselessRetainAction(){let e=this._actions[this._actions.length-1];for(;e&&e.t===J.RETAIN&&ca(e);)this._actions.pop(),e=this._actions[this._actions.length-1];return this}};_(ze,"id","text-x"),_(ze,"uri","https://github.com/dream-num/univer#text-x");let me=ze;Object.defineProperty(me,"name",{value:"text-x"});const Ue=class Ue{static registerSubtype(e){var n;this._subTypes.has(e.name)&&((n=this._subTypes.get(e.name))==null?void 0:n.id)!==me.id||(this._subTypes.set(e.name,e),Bt.type.registerSubtype(e))}static apply(e,n){if(!Bt.type.isNoop(n))return Bt.type.apply(e,n)}static compose(e,n){return Bt.type.compose(e,n)}static transform(e,n,s){throw new Error("transform is not implemented in JsonX")}static invertWithDoc(e,n){return Bt.type.invertWithDoc(e,n)}static isNoop(e){return Bt.type.isNoop(e)}static getInstance(){return this._instance==null&&(this._instance=new Ue),this._instance}removeOp(e,n){return Bt.removeOp(e,n)}moveOp(e,n){return Bt.moveOp(e,n)}insertOp(e,n){return Bt.insertOp(e,n)}replaceOp(e,n,s){return Bt.replaceOp(e,n,s)}editOp(e){return Bt.editOp(["body"],me.name,e)}};_(Ue,"uri","https://github.com/dream-num/univer#json-x"),_(Ue,"_subTypes",new Map),_(Ue,"_instance",null);let ve=Ue;ve.registerSubtype(me);const bs={id:"default_doc",documentStyle:{}};class ba extends Mn{constructor(n){super();_(this,"type",et.UNIVER_DOC);_(this,"snapshot");this.snapshot={...bs,...n}}getUnitId(){throw new Error("Method not implemented.")}get drawings(){return this.snapshot.drawings}get documentStyle(){return this.snapshot.documentStyle}get lists(){return this.snapshot.lists}get zoomRatio(){var n;return((n=this.snapshot.settings)==null?void 0:n.zoomRatio)||1}resetDrawing(n,s){this.snapshot.drawings=n,this.snapshot.drawingsOrder=s}getBody(){return this.snapshot.body}getShouldRenderLoopImmediately(){return this.snapshot.shouldStartRenderingImmediately!==!1}getContainer(){return this.snapshot.container}getSnapshot(){return this.snapshot}updateDocumentId(n){this.snapshot.id=n}updateDocumentRenderConfig(n){const{documentStyle:s}=this.snapshot;s.renderConfig==null?s.renderConfig=n:s.renderConfig={...s.renderConfig,...n}}updateDocumentStyle(n){this.snapshot.documentStyle==null?this.snapshot.documentStyle=n:this.snapshot.documentStyle={...this.snapshot.documentStyle,...n}}updateDocumentDataMargin(n){const{t:s,l:r,b:i,r:o}=n,{documentStyle:l}=this.snapshot;s!=null&&(l.marginTop=s),r!=null&&(l.marginLeft=r),i!=null&&(l.marginBottom=i),o!=null&&(l.marginRight=o)}updateDocumentDataPageSize(n,s){const{documentStyle:r}=this.snapshot;if(!r.pageSize){n=n!=null?n:Number.POSITIVE_INFINITY,s=s!=null?s:Number.POSITIVE_INFINITY,r.pageSize={width:n,height:s};return}n!==void 0&&(r.pageSize.width=n),s!==void 0&&(r.pageSize.height=s)}updateDrawing(n,s){const{drawings:r}=this,{width:i,height:o,left:l,top:a}=s,h=r==null?void 0:r[n];if(!h)return;const c=h.docTransform;c.size.width=i,c.size.height=o,c.positionH.posOffset=l,c.positionV.posOffset=a}setZoomRatio(n=1){this.snapshot.settings==null?this.snapshot.settings={zoomRatio:n}:this.snapshot.settings.zoomRatio=1}}class Ae extends ba{constructor(n){var r;super(D.isEmptyObject(n)?ha():n);_(this,"_unitId");_(this,"headerModelMap",new Map);_(this,"footerModelMap",new Map);const s=6;this._unitId=(r=this.snapshot.id)!=null?r:D.generateRandomId(s),this._initializeHeaderFooterModel()}dispose(){this.headerModelMap.forEach(n=>{n.dispose()}),this.footerModelMap.forEach(n=>{n.dispose()})}getDrawings(){return this.snapshot.drawings}getDrawingsOrder(){return this.snapshot.drawingsOrder}getRev(){var n;return(n=this.snapshot.rev)!=null?n:1}incrementRev(){this.snapshot.rev=this.getRev()+1}getSettings(){return this.snapshot.settings}reset(n){if(n.id&&n.id!==this._unitId)throw new Error("Cannot reset a document model with a different unit id!");this.snapshot={...bs,...n},this._initializeHeaderFooterModel()}getSelfOrHeaderFooterModel(n){if(n!=null){if(this.headerModelMap.has(n))return this.headerModelMap.get(n);if(this.footerModelMap.has(n))return this.footerModelMap.get(n)}return this}getUnitId(){return this._unitId}apply(n){if(!ve.isNoop(n))return ve.apply(this.snapshot,n)}sliceBody(n,s){const r=this.getBody();if(r!=null)return Je(r,n,s)}_initializeHeaderFooterModel(){const{headers:n,footers:s}=this.getSnapshot();if(n)for(const r in n){const i=n[r];this.headerModelMap.set(r,new Ae(i))}if(s)for(const r in s){const i=s[r];this.footerModelMap.set(r,new Ae(i))}}updateDocumentId(n){super.updateDocumentId(n),this._unitId=n}}const wi=ut.createIdentifier("univer.config-service");class Ti{constructor(){_(this,"_config",new Map)}getConfig(e){return this._config.get(e)}setConfig(e,n){this._config.set(e,n)}deleteConfig(e){this._config.delete(e)}}class Li extends yt{constructor(){super(...arguments);_(this,"_error$",new ot.Subject);_(this,"error$",this._error$.asObservable())}dispose(){this._error$.complete()}emit(n){this._error$.next({errorKey:n})}}class Mi{constructor(e={}){_(this,"_styles");_(this,"_cacheMap",new si(1e5));this._styles=e,this._generateCacheMap()}each(e){return Object.entries(this._styles).forEach(e),this}search(e,n){if(this._cacheMap.has(n))return this._cacheMap.get(n);const s=this._getExistingStyleId(e);return s||"-1"}get(e){return typeof e!="string"?e:(e=String(e),this._styles[e])}add(e,n){const s=D.generateRandomId(6);return this._styles[s]=e,this._cacheMap.set(n,s),s}setValue(e){if(e==null)return;const n=JSON.stringify(e),s=this.search(e,n);return s!=="-1"?s:this.add(e,n)}toJSON(){return this._styles}getStyleByCell(e){let n;e&&D.isObject(e.s)?n=e.s:n=(e==null?void 0:e.s)&&this.get(e.s);const s=e==null?void 0:e.interceptorStyle;return s?{...n,...s}:n}_generateCacheMap(){const{_styles:e,_cacheMap:n}=this;for(const s in e){const r=JSON.stringify(e[s]);n.set(r,s)}}_getExistingStyleId(e){const{_styles:n}=this;for(const s in n)if(D.diffValue(n[s],e))return s;return null}}class va{constructor(e,n){_(this,"_columnData",{});this._config=e,this._columnData=n}getColumnData(){return this._columnData}getColVisible(e){const{_columnData:n}=this,s=n[e];return s?s.hd!==q.TRUE:!0}getHiddenCols(e=0,n=this.getSize()-1){const s=[];let r=!1,i=-1;for(let o=e;o<=n;o++){const l=this.getColVisible(o);r&&l?(r=!1,s.push({rangeType:rt.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!r&&!l&&(r=!0,i=o)}return r&&s.push({startRow:0,endRow:0,startColumn:i,endColumn:n,rangeType:rt.COLUMN}),s}getVisibleCols(e=0,n=this.getSize()-1){const s=[];let r=!1,i=-1;for(let o=e;o<=n;o++){const l=this.getColVisible(o);r&&!l?(r=!1,s.push({rangeType:rt.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!r&&l&&(r=!0,i=o)}return r&&s.push({startRow:0,endRow:0,startColumn:i,endColumn:n,rangeType:rt.COLUMN}),s}getColumnDatas(e,n){const s={};let r=0;for(let i=e;i<e+n;i++){const o=this.getColumnOrCreate(i);s[r]=o,r++}return s}getSize(){return _e(this._columnData)}getColumnWidth(e){const{_columnData:n}=this,s=this._config;let r=0;return r=(n[e]||{hd:q.FALSE,w:s.defaultColumnWidth}).w||s.defaultColumnWidth,r}getColumn(e){const n=this._columnData[e];if(n)return n}getColumnOrCreate(e){const{_columnData:n}=this,s=this._config,r=n[e];if(r)return r;const i={w:s.defaultColumnWidth,hd:q.FALSE};return this._columnData[e]=i,i}}class Aa{constructor(e,n,s){_(this,"_rowData");this._config=e,this._viewModel=n,this._rowData=s}getRowData(){return this._rowData}getRowDatas(e,n){const s={};let r=0;for(let i=e;i<e+n;i++){const o=this.getRowOrCreate(i);s[r]=o,r++}return s}getRowHeight(e,n=1){const{_rowData:s}=this,r=this._config;let i=0;for(let o=0;o<n;o++){const l=s[o+e]||{hd:q.FALSE,h:r.defaultRowHeight},{ia:a,ah:h,h:c=r.defaultRowHeight}=l;i+=(a==null||a===q.TRUE)&&typeof h=="number"?h:c}return i}getRow(e){return this._rowData[e]}getRowOrCreate(e){const{_rowData:n}=this,s=n[e];if(s)return s;const r=this._config,i={hd:q.FALSE,h:r.defaultRowHeight};return n[e]=i,i}getHiddenRows(e=0,n=this.getSize()-1){const s=[];let r=!1,i=-1;for(let o=e;o<=n;o++){const l=this.getRowRawVisible(o);r&&l?(r=!1,s.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:rt.ROW})):!r&&!l&&(r=!0,i=o)}return r&&s.push({startRow:i,endRow:n,startColumn:0,endColumn:0,rangeType:rt.ROW}),s}getVisibleRows(e=0,n=this.getSize()-1){const s=[];let r=!1,i=-1;for(let o=e;o<=n;o++){const l=this.getRowRawVisible(o);r&&!l?(r=!1,s.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:rt.ROW})):!r&&l&&(r=!0,i=o)}return r&&s.push({startRow:i,endRow:n,startColumn:0,endColumn:0,rangeType:rt.ROW}),s}getRowRawVisible(e){const n=this.getRow(e);return n?n.hd!==q.TRUE:!0}getSize(){return _e(this._rowData)}}const wa="DEFAULT_WORKSHEET_ROW_COUNT",Ui=1e3,Ta="DEFAULT_WORKSHEET_COLUMN_COUNT",Di=20,La="DEFAULT_WORKSHEET_ROW_HEIGHT",yi=24,Ma="DEFAULT_WORKSHEET_COLUMN_WIDTH",Pi=88,Ua="DEFAULT_WORKSHEET_ROW_TITLE_WIDTH",xi=46,Da="DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT",ki=20;function Hi(t){const e={name:"Sheet1",id:"sheet-01",tabColor:"",hidden:q.FALSE,rowCount:Ui,columnCount:Di,zoomRatio:1,freeze:{xSplit:0,ySplit:0,startRow:-1,startColumn:-1},scrollTop:0,scrollLeft:0,defaultColumnWidth:Pi,defaultRowHeight:yi,mergeData:[],cellData:{},rowData:{},columnData:{},showGridlines:q.TRUE,rowHeader:{width:xi,hidden:q.FALSE},columnHeader:{height:ki,hidden:q.FALSE},selections:["A1"],rightToLeft:q.FALSE};return Object.keys(e).forEach(n=>{const s=n;typeof t[s]>"u"&&(t[s]=e[s])}),t}class Fi extends yt{constructor(n){super();_(this,"_cellContentInterceptor",null);_(this,"_rowFilteredInterceptor",null);this.getRawCell=n}dispose(){super.dispose(),this._cellContentInterceptor=null,this._rowFilteredInterceptor=null}getCell(n,s){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,s):this.getRawCell(n,s)}getRowFiltered(n){var s,r;return(r=(s=this._rowFilteredInterceptor)==null?void 0:s.getRowFiltered(n))!=null?r:!1}registerCellContentInterceptor(n){if(this._cellContentInterceptor)throw new Error("[SheetViewModel]: Interceptor already registered.");return this._cellContentInterceptor=n,vt(()=>this._cellContentInterceptor=null)}registerRowFilteredInterceptor(n){if(this._rowFilteredInterceptor)throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowFilteredInterceptor=n,vt(()=>this._rowFilteredInterceptor=null)}}class Ze{constructor(e,n,s){_(this,"_sheetId");_(this,"_snapshot");_(this,"_cellData");_(this,"_rowManager");_(this,"_columnManager");_(this,"_viewModel");var l;this.unitId=e,this._styles=s,this._snapshot=Hi(n);const{columnData:r,rowData:i,cellData:o}=this._snapshot;this._sheetId=(l=this._snapshot.id)!=null?l:D.generateRandomId(6),this._cellData=new ee(o),this._viewModel=new Fi((a,h)=>this.getCellRaw(a,h)),this._rowManager=new Aa(this._snapshot,this._viewModel,i),this._columnManager=new va(this._snapshot,r)}__interceptViewModel(e){e(this._viewModel)}getSnapshot(){return this._snapshot}getCellMatrix(){return this._cellData}getCellMatrixPrintRange(){const e=this.getCellMatrix(),n=this.getMergeData();let s=-1,r=-1,i=-1,o=-1,l=!1,a=!1;return e.forEach((h,c)=>{Object.keys(c).forEach(u=>{const d=+u,f=e.getValue(h,d),m=f!=null&&f.s?this._styles.get(f.s):null,p=(m==null?void 0:m.bd)&&(m.bd.b||m.bd.l||m.bd.r||m.bd.t||m.bd.bc_tr||m.bd.bl_tr||m.bd.ml_tr||m.bd.tl_bc||m.bd.tl_br||m.bd.tl_mr);(f&&(f.v||f.p)||m!=null&&m.bg||p)&&(l?s=Math.min(s,h):(s=h,l=!0),r=Math.max(r,h),a?i=Math.min(i,d):(a=!0,i=d),o=Math.max(o,d))})}),n.forEach(h=>{l?s=Math.min(s,h.startRow):(s=h.startRow,l=!0),r=Math.max(r,h.endRow),a?i=Math.min(i,h.startColumn):(i=h.startColumn,l=!0),o=Math.max(o,h.endColumn)}),!l||!a?null:{startColumn:i,startRow:s,endColumn:o,endRow:r}}getRowManager(){return this._rowManager}getUnitId(){return this.unitId}getSheetId(){return this._sheetId}getColumnManager(){return this._columnManager}getName(){return this._snapshot.name}clone(){const{_snapshot:e}=this,n=D.deepClone(e);return new Ze(this.unitId,n,this._styles)}getMergeData(){return this._snapshot.mergeData}getMergedCell(e,n){const s=this._snapshot.mergeData;for(let r=0;r<s.length;r++){const i=s[r];if(ge.intersects({startRow:e,startColumn:n,endRow:e,endColumn:n},i))return i}return null}getCell(e,n){return e<0||n<0?null:this._viewModel.getCell(e,n)}getCellRaw(e,n){return this.getCellMatrix().getValue(e,n)}getRowFiltered(e){return this._viewModel.getRowFiltered(e)}getMatrixWithMergedCells(e,n,s,r,i=!1){const o=this.getCellMatrix(),l=this._snapshot.mergeData.filter(h=>ge.intersects({startRow:e,startColumn:n,endRow:s,endColumn:r},h)),a=new ee;return Zn(e,s,n,r).forEach((h,c)=>{const u=i?this.getCellRaw(h,c):this.getCell(h,c);u&&a.setValue(h,c,u)}),l.forEach(h=>{const{startColumn:c,startRow:u,endColumn:d,endRow:f}=h;Zn(u,f,c,d).forEach((m,p)=>{m===u&&p===c&&a.setValue(m,p,{...o.getValue(m,p),rowSpan:f-u+1,colSpan:d-c+1}),(m!==u||p!==c)&&a.realDeleteValue(m,p)})}),a}getRange(e,n,s,r){return typeof e=="object"?new Pe(this,e,{getStyles:()=>this._styles}):new Pe(this,{startRow:e,startColumn:n,endColumn:r||n,endRow:s||e},{getStyles:()=>this._styles})}getScrollLeftTopFromSnapshot(){return{scrollLeft:this._snapshot.scrollLeft,scrollTop:this._snapshot.scrollTop}}getZoomRatio(){return this._snapshot.zoomRatio||1}getConfig(){return this._snapshot}getFreeze(){return this._snapshot.freeze}getMaxColumns(){const{_snapshot:e}=this,{columnCount:n}=e;return n}getMaxRows(){const{_snapshot:e}=this,{rowCount:n}=e;return n}getRowCount(){return this._snapshot.rowCount}setRowCount(e){this._snapshot.rowCount=e}getColumnCount(){return this._snapshot.columnCount}setColumnCount(e){this._snapshot.columnCount=e}isSheetHidden(){return this._snapshot.hidden}hasHiddenGridlines(){const{_snapshot:e}=this,{showGridlines:n}=e;return n===0}getTabColor(){const{_snapshot:e}=this,{tabColor:n}=e;return n}getColumnWidth(e){return this.getColumnManager().getColumnWidth(e)}getRowHeight(e){return this._viewModel.getRowFiltered(e)?0:this.getRowManager().getRowHeight(e)}getRowVisible(e){return this._viewModel.getRowFiltered(e)?!1:this.getRowRawVisible(e)}getRowRawVisible(e){return this.getRowManager().getRowRawVisible(e)}getHiddenRows(e,n){const s=this.getMaxColumns()-1,r=this._rowManager.getHiddenRows(e,n);return r.forEach(i=>i.endColumn=s),r}getColVisible(e){return this._columnManager.getColVisible(e)}getHiddenCols(e,n){const s=this.getMaxRows()-1,r=this._columnManager.getHiddenCols(e,n);return r.forEach(i=>i.endRow=s),r}getVisibleRows(){const e=this.getRowCount();return this._rowManager.getVisibleRows(0,e-1)}getVisibleCols(){const e=this.getColumnCount();return this._columnManager.getVisibleCols(0,e-1)}isRightToLeft(){const{_snapshot:e}=this,{rightToLeft:n}=e;return n}getLastRowWithContent(){return this._cellData.getLength()-1}getLastColumnWithContent(){return this._cellData.getRange().endColumn}cellHasValue(e){return e&&(e.v!==void 0||e.f!==void 0||e.p!==void 0)}iterateByRow(e,n=!0){const{startRow:s,startColumn:r,endRow:i,endColumn:o}=e,l=this;return{[Symbol.iterator]:()=>{let a=s,h=r;return{next(){for(;;){if(h>o&&(a+=1,h=r),a>i)return{done:!0,value:void 0};const c=l.getCell(a,h),u=!c,d=l.getMergedCell(a,h);if(d){if(a!==d.startRow||h!==d.startColumn){h=d.endColumn+1;continue}if(u&&n){h=d.endColumn+1;continue}const m={row:a,col:h,value:c};return m.colSpan=d.endColumn-d.startColumn+1,m.rowSpan=d.endRow-d.startRow+1,h=d.endColumn+1,{done:!1,value:m}}if(u&&n)h+=1;else{const f={row:a,col:h,value:c};return h+=1,{done:!1,value:f}}}}}}}}iterateByColumn(e,n=!0,s=!0){const{startRow:r,startColumn:i,endRow:o,endColumn:l}=e,a=this;return{[Symbol.iterator]:()=>{let h=r,c=i;return{next(){for(;;){if(h>o&&(c+=1,h=r),c>l)return{done:!0,value:void 0};const u=a.getMergedCell(h,c);if(u){const m=h!==u.startRow,p=m||c!==u.startColumn;if(s&&p||!s&&m){h=u.endRow+1;continue}const y=a.getCell(u.startRow,u.startColumn);if(!y&&n){h=u.endRow+1;continue}const Z={row:h,col:u.startColumn,value:y};return Z.colSpan=u.endColumn-u.startColumn+1,Z.rowSpan=u.endRow-u.startRow+1,h=u.endRow+1,{done:!1,value:Z}}const d=a.getCell(h,c);if(!d&&n)h+=1;else{const m={row:h,col:c,value:d};return h+=1,{done:!1,value:m}}}}}}}}}function ya(t){var s,r;if(!t)return"";const e=(r=(s=t.p)==null?void 0:s.body)==null?void 0:r.dataStream;if(e)return e;const n=t.v;return typeof n=="string"?t.t===Ne.BOOLEAN?n.toUpperCase():n.replace(/[\r\n]/g,""):typeof n=="number"?t.t===Ne.BOOLEAN?n?"TRUE":"FALSE":n.toString():typeof n=="boolean"?n?"TRUE":"FALSE":""}const Pa="0.1.15";function xa(t="",e=we.ZH_CN,n=""){return{id:t,sheetOrder:[],name:n,appVersion:Pa,locale:e,styles:{},sheets:{},resources:[]}}var ka=Object.defineProperty,Ha=Object.getOwnPropertyDescriptor,Fa=(t,e,n,s)=>{for(var r=s>1?void 0:s?Ha(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(s?o(e,n,r):o(r))||r);return s&&r&&ka(e,n,r),r},Ba=(t,e)=>(n,s)=>e(n,s,t);function $a(t,e){return`${t.getUnitId()}|${e.getSheetId()}`}exports.Workbook=class extends Mn{constructor(n={},s){super();_(this,"type",et.UNIVER_SHEET);_(this,"_sheetCreated$",new ot.Subject);_(this,"sheetCreated$",this._sheetCreated$.asObservable());_(this,"_sheetDisposed$",new ot.Subject);_(this,"sheetDisposed$",this._sheetDisposed$.asObservable());_(this,"_activeSheet$",new ot.BehaviorSubject(null));_(this,"activeSheet$",this._activeSheet$.asObservable());_(this,"_worksheets");_(this,"_styles");_(this,"_snapshot");_(this,"_unitId");_(this,"_count");_(this,"_name$");_(this,"name$");this._logService=s;const r=xa();D.isEmptyObject(n)?this._snapshot=r:this._snapshot=D.commonExtend(r,n);const{styles:i}=this._snapshot;(this._snapshot.id==null||this._snapshot.id.length===0)&&(this._snapshot.id=D.generateRandomId(6)),this._unitId=this._snapshot.id,this._styles=new Mi(i),this._count=1,this._worksheets=new Map,this._name$=new ot.BehaviorSubject(n.name||""),this.name$=this._name$.asObservable(),this._passWorksheetSnapshots()}get _activeSheet(){return this._activeSheet$.getValue()}get name(){return this._name$.getValue()}dispose(){super.dispose(),this._sheetCreated$.complete(),this._sheetDisposed$.complete(),this._activeSheet$.complete(),this._name$.complete()}save(){return D.deepClone(this._snapshot)}static isIRangeType(n){return typeof n=="string"||"startRow"in n||"row"in n}getSnapshot(){return this._snapshot}getName(){return this._snapshot.name}setName(n){this._name$.next(n),this._snapshot.name=n}getUnitId(){return this._unitId}getRev(){var n;return(n=this._snapshot.rev)!=null?n:1}incrementRev(){this._snapshot.rev=this.getRev()+1}getShouldRenderLoopImmediately(){return this._snapshot.shouldStartRenderingImmediately!==!1}getContainer(){return this._snapshot.container}addWorksheet(n,s,r){const{sheets:i,sheetOrder:o}=this._snapshot;if(i[n])return!1;i[n]=r,o.splice(s,0,n);const l=new Ze(this._unitId,r,this._styles);return this._worksheets.set(n,l),this._sheetCreated$.next(l),!0}getSheetOrders(){return this._snapshot.sheetOrder}getWorksheets(){return this._worksheets}getActiveSpreadsheet(){return this}getStyles(){return this._styles}getConfig(){return this._snapshot}getIndexBySheetId(n){const{sheetOrder:s}=this._snapshot;return s.findIndex(r=>r===n)}getRawActiveSheet(){return this._activeSheet}getActiveSheet(){const n=this.getRawActiveSheet();if(n)return n;const s=this._snapshot.sheetOrder;for(let i=0,o=s.length;i<o;i++){const l=this._worksheets.get(s[i]);if(l&&l.isSheetHidden()!==q.TRUE)return this.setActiveSheet(l),l}const r=this._worksheets.get(s[0]);return this.setActiveSheet(r),r}setActiveSheet(n){this._activeSheet$.next(n)}removeSheet(n){var r;const s=this._worksheets.get(n);return s?(((r=this._activeSheet)==null?void 0:r.getSheetId())===n&&this.setActiveSheet(null),this._worksheets.delete(n),this._snapshot.sheetOrder.splice(this._snapshot.sheetOrder.indexOf(n),1),delete this._snapshot.sheets[n],this._sheetDisposed$.next(s),!0):!1}getActiveSheetIndex(){const{sheetOrder:n}=this._snapshot;return n.findIndex(s=>this._worksheets.get(s)===this._activeSheet)}getSheetSize(){return this._snapshot.sheetOrder.length}getSheets(){const{sheetOrder:n}=this._snapshot;return n.map(s=>this._worksheets.get(s))}getSheetsName(){const{sheetOrder:n}=this._snapshot,s=[];return n.forEach(r=>{const i=this._worksheets.get(r);i&&s.push(i.getName())}),s}getSheetIndex(n){const{sheetOrder:s}=this._snapshot;return s.findIndex(r=>n.getSheetId()===r)}getSheetBySheetName(n){const{sheetOrder:s}=this._snapshot,r=s.find(i=>this._worksheets.get(i).getName()===n);return this._worksheets.get(r)}getSheetBySheetId(n){return this._worksheets.get(n)}getSheetByIndex(n){const{sheetOrder:s}=this._snapshot;return this._worksheets.get(s[n])}getHiddenWorksheets(){return this.getSheets().filter(n=>n.getConfig().hidden===q.TRUE).map(n=>n.getConfig().id)}transformRangeType(n){if(typeof n=="string")return this._getCellRange(n);if(typeof n!="string"&&"row"in n){const s=n;return{sheetId:"",range:{startRow:s.row[0],startColumn:s.column[0],endRow:s.row[1],endColumn:s.column[1]}}}return typeof n!="string"&&"startRow"in n?{sheetId:"",range:n}:$e}load(n){this._snapshot=n}checkSheetName(n){return this.getSheetsName().includes(n)}uniqueSheetName(n="Sheet1"){let s=n;for(;this.checkSheetName(s);)s=n+this._count,this._count++;return s}generateNewSheetName(n){let s=n+this._count;for(;this.checkSheetName(s);)s=n+this._count,this._count++;return s}_getCellRange(n){var c,u,d,f,m;let s="",r="";if(n.indexOf("!")>-1){const p=n.split("!");s=p[0],r=p[1],s=s.replace(/\\'/g,"'").replace(/''/g,"'"),s.substring(0,1)==="'"&&s.substring(s.length-1,1)==="'"&&(s=s.substring(1,s.length-1))}else r=n;if(r.indexOf(":")===-1){const p=Number.parseInt(r.replace(/[^0-9]/g,""),10)-1,y=D.ABCatNum(r.replace(/[^A-Za-z]/g,""));return!Number.isNaN(p)&&!Number.isNaN(y)?{sheetId:s,range:{startRow:p,endRow:p,startColumn:y,endColumn:y}}:$e}r=r.split(":");const i=[0,0],o=[0,0],l=((c=this.getSheetBySheetName(s))==null?void 0:c.getMaxRows())||((u=this.getActiveSheet())==null?void 0:u.getMaxRows()),a=((d=this.getSheetBySheetName(s))==null?void 0:d.getMaxColumns())||((f=this.getActiveSheet())==null?void 0:f.getMaxColumns());return i[0]=Number.parseInt(r[0].replace(/[^0-9]/g,""),10)-1,i[1]=Number.parseInt(r[1].replace(/[^0-9]/g,""),10)-1,Number.isNaN(i[0])&&(i[0]=0),Number.isNaN(i[1])&&(i[1]=l),i[0]>i[1]||(o[0]=D.ABCatNum(r[0].replace(/[^A-Za-z]/g,"")),o[1]=D.ABCatNum(r[1].replace(/[^A-Za-z]/g,"")),Number.isNaN(o[0])&&(o[0]=0),Number.isNaN(o[1])&&(o[1]=a),o[0]>o[1])?$e:{sheetId:((m=this.getSheetBySheetName(s))==null?void 0:m.getSheetId())||"",range:{startRow:i[0],endRow:i[1],startColumn:o[0],endColumn:o[1]}}}_passWorksheetSnapshots(){const{_snapshot:n,_worksheets:s}=this,{sheets:r,sheetOrder:i}=n;if(D.isEmptyObject(r)){const o=D.generateRandomId();r[o]={id:o}}for(const o in r){const l=r[o],{name:a}=l;l.name=this.uniqueSheetName(a),l.name!==a&&this._logService.debug("[Workbook]",`The worksheet name ${a} is duplicated, we changed it to ${l.name}. Please fix the problem in your snapshot.`);const h=new Ze(this._unitId,l,this._styles);s.set(o,h),i.includes(o)||i.push(o)}}};exports.Workbook=Fa([Ba(1,pe)],exports.Workbook);class vs extends Mn{constructor(n){var s;super();_(this,"type",et.UNIVER_SLIDE);_(this,"_snapshot");_(this,"_unitId");this._snapshot={...oi,...n},this._unitId=(s=this._snapshot.id)!=null?s:D.generateRandomId(6)}getContainer(){return this._snapshot.container}getSnapshot(){return this._snapshot}getUnitId(){return this._unitId}getPages(){var n;return(n=this._snapshot.body)==null?void 0:n.pages}getPageOrder(){var n;return(n=this._snapshot.body)==null?void 0:n.pageOrder}getPage(n){const s=this.getPages();return s==null?void 0:s[n]}getElementsByPage(n){var s;return(s=this.getPage(n))==null?void 0:s.pageElements}getElement(n,s){var r;return(r=this.getElementsByPage(n))==null?void 0:r[s]}getPageSize(){return this._snapshot.pageSize}addPage(){return{id:"cover_1",pageType:as.SLIDE,zIndex:1,title:"cover",description:"this is first page, cover",pageBackgroundFill:{rgb:"rgb(255,255,255)"},pageElements:{}}}}const Ve="FOCUSING_SHEET",_n="FOCUSING_DOC",gn="FOCUSING_SLIDE",Wa="FOCUSING_EDITOR_BUT_HIDDEN",Bi="EDITOR_ACTIVATED",Ga="FOCUSING_EDITOR_INPUT_FORMULA",$i="FOCUSING_FORMULA_EDITOR",ja="FOCUSING_UNIVER_EDITOR",Va="FOCUSING_EDITOR_INPUT_FORMULA",Ka="FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE",Ya="FOCUSING_COMMON_DRAWINGS";var za=Object.defineProperty,Xa=Object.getOwnPropertyDescriptor,qa=(t,e,n,s)=>{for(var r=s>1?void 0:s?Xa(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(s?o(e,n,r):o(r))||r);return s&&r&&za(e,n,r),r},Ks=(t,e)=>(n,s)=>e(n,s,t);const xe=ut.createIdentifier("univer.current");exports.UniverInstanceService=class extends yt{constructor(n,s){super();_(this,"_unitsByType",new Map);_(this,"_createHandler");_(this,"_ctorByType",new Map);_(this,"_currentUnits$",new ot.BehaviorSubject({}));_(this,"currentUnits$",this._currentUnits$.asObservable());_(this,"_unitAdded$",new ot.Subject);_(this,"unitAdded$",this._unitAdded$.asObservable());_(this,"_unitDisposed$",new ot.Subject);_(this,"unitDisposed$",this._unitDisposed$.asObservable());_(this,"_focused$",new ot.BehaviorSubject(null));_(this,"focused$",this._focused$.asObservable());this._injector=n,this._contextService=s}dispose(){super.dispose(),this._focused$.complete()}__setCreateHandler(n){this._createHandler=n}createUnit(n,s){return this._createHandler(n,s,this._ctorByType.get(n))}registerCtorForType(n,s){return this._ctorByType.set(n,s),{dispose:()=>{this._ctorByType.delete(n)}}}getCurrentTypeOfUnit$(n){return this.currentUnits$.pipe(ot.map(s=>{var r;return(r=s[n])!=null?r:null}),ot.distinctUntilChanged())}getCurrentUnitForType(n){return this._currentUnits$.getValue()[n]}setCurrentUnitForType(n){const s=this._getUnitById(n);if(!s)throw new Error(`[UniverInstanceService]: no document with unitId ${n}!`);this._currentUnits$.next({...this._currentUnits$.getValue(),[s[1]]:s[0]})}getTypeOfUnitAdded$(n){return this._unitAdded$.pipe(ot.filter(s=>s.type===n))}__addUnit(n){const s=n.type;this._unitsByType.has(s)||this._unitsByType.set(s,[]),this._unitsByType.get(s).push(n),this._currentUnits$.next({...this._currentUnits$.getValue(),[s]:n}),this._unitAdded$.next(n)}getTypeOfUnitDisposed$(n){return this.unitDisposed$.pipe(ot.filter(s=>s.type===n))}getUnit(n,s){var i;const r=(i=this._getUnitById(n))==null?void 0:i[0];return s&&(r==null?void 0:r.type)!==s?null:r}getCurrentUniverDocInstance(){return this.getCurrentUnitForType(et.UNIVER_DOC)}getUniverDocInstance(n){return this.getUnit(n,et.UNIVER_DOC)}getUniverSheetInstance(n){return this.getUnit(n,et.UNIVER_SHEET)}getAllUnitsForType(n){var s;return(s=this._unitsByType.get(n))!=null?s:[]}changeDoc(n,s){const r=this.getAllUnitsForType(et.UNIVER_DOC),i=r.find(o=>o.getUnitId()===n);if(i!=null){const o=r.indexOf(i);r.splice(o,1)}this.__addUnit(s)}get focused(){var s;const n=this._focused$.getValue();return n?(s=this._getUnitById(n))==null?void 0:s[0]:null}focusUnit(n){this._focused$.next(n),this.focused instanceof exports.Workbook?(this._contextService.setContextValue(_n,!1),this._contextService.setContextValue(Ve,!0),this._contextService.setContextValue(gn,!1)):this.focused instanceof Ae?(this._contextService.setContextValue(_n,!0),this._contextService.setContextValue(Ve,!1),this._contextService.setContextValue(gn,!1)):this.focused instanceof vs&&(this._contextService.setContextValue(_n,!1),this._contextService.setContextValue(Ve,!1),this._contextService.setContextValue(gn,!0))}getFocusedUnit(){return this.focused}getUnitType(n){const s=this._getUnitById(n);if(!s)throw new Error(`[UniverInstanceService]: No document with unitId ${n}`);return s[1]}disposeUnit(n){const s=this._getUnitById(n);if(!s)return!1;const[r,i]=s,o=this._unitsByType.get(i),l=o.indexOf(r);return o.splice(l,1),this._unitDisposed$.next(r),this._currentUnits$.next({...this._currentUnits$.getValue(),[i]:null}),this._focused$.next(null),!0}_getUnitById(n){for(const[s,r]of this._unitsByType){const i=r.find(o=>o.getUnitId()===n);if(i)return[i,s]}}};exports.UniverInstanceService=qa([Ks(0,ut.Inject(ut.Injector)),Ks(1,Qe)],exports.UniverInstanceService);var Ot=(t=>(t[t.Starting=0]="Starting",t[t.Ready=1]="Ready",t[t.Rendered=2]="Rendered",t[t.Steady=3]="Steady",t))(Ot||{});const Ja={0:"Starting",1:"Ready",2:"Rendered",3:"Steady"},mn=new Map;function Wi(t,e){return function(r){Un(t,e)}}function Un(t,e){mn.has(t)||mn.set(t,[]),mn.get(t).push(e)}var Za=Object.defineProperty,Qa=Object.getOwnPropertyDescriptor,Gi=(t,e,n,s)=>{for(var r=s>1?void 0:s?Qa(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(s?o(e,n,r):o(r))||r);return s&&r&&Za(e,n,r),r},rs=(t,e)=>(n,s)=>e(n,s,t);exports.LifecycleService=class extends yt{constructor(n){super();_(this,"_lifecycle$",new ot.BehaviorSubject(Ot.Starting));_(this,"lifecycle$",this._lifecycle$.asObservable());_(this,"_lock",!1);this._logService=n,this._reportProgress(Ot.Starting)}get stage(){return this._lifecycle$.getValue()}set stage(n){if(n<this.stage)throw new Error("[LifecycleService]: lifecycle stage cannot go backward!");if(n!==this.stage){if(this._lock)throw new Error("[LifecycleService]: cannot set new stage when related logic is all handled!");this._lock=!0,this._reportProgress(n),this._lifecycle$.next(n),this._lock=!1}}dispose(){this._lifecycle$.complete(),super.dispose()}subscribeWithPrevious(){return new ot.Observable(n=>{this.stage===Ot.Starting||(this.stage===Ot.Ready?n.next(Ot.Starting):this.stage===Ot.Rendered?(n.next(Ot.Starting),n.next(Ot.Ready)):(n.next(Ot.Starting),n.next(Ot.Ready),n.next(Ot.Rendered))),this._lifecycle$.subscribe(s=>{n.next(s),s===Ot.Steady&&n.complete()})})}_reportProgress(n){this._logService.debug("[LifecycleService]",`lifecycle progressed to "${Ja[n]}".`)}};exports.LifecycleService=Gi([rs(0,pe)],exports.LifecycleService);exports.LifecycleInitializerService=class extends yt{constructor(n,s){super();_(this,"_seenTokens",new Set);this._lifecycleService=n,this._injector=s}initModulesOnStage(n){var s;(s=mn.get(n))==null||s.forEach(r=>{this._injector.has(r)&&!this._seenTokens.has(r)&&(this._injector.get(r),this._seenTokens.add(r))})}};exports.LifecycleInitializerService=Gi([rs(0,ut.Inject(exports.LifecycleService)),rs(1,ut.Inject(ut.Injector))],exports.LifecycleInitializerService);class Ke extends yt{constructor(){super();_(this,"_currentLocale$",new ot.BehaviorSubject(we.ZH_CN));_(this,"currentLocale$",this._currentLocale$.asObservable());_(this,"_locales",null);_(this,"localeChanged$",new ot.Subject);_(this,"t",(n,...s)=>{if(!this._locales)throw new Error("Locale not initialized");const r=n.split("."),i=this.resolveKeyPath(this._locales[this._currentLocale],r);if(typeof i=="string"){let o=i;return s.forEach((l,a)=>{o=o.replace(`{${a}}`,l)}),o}else return n});this.disposeWithMe(vt(()=>this.localeChanged$.complete()))}get _currentLocale(){return this._currentLocale$.value}load(n){var s;this._locales=D.deepMerge((s=this._locales)!=null?s:{},n)}setLocale(n){this._currentLocale$.next(n),this.localeChanged$.next()}getLocales(){var n;return(n=this._locales)==null?void 0:n[this._currentLocale]}getCurrentLocale(){return this._currentLocale}resolveKeyPath(n,s){const r=s.shift();if(r&&n&&r in n){const i=n[r];return s.length>0&&(typeof i=="object"||Array.isArray(i))?this.resolveKeyPath(i,s):i}return null}}var As=(t=>(t.INIT="init",t.FETCHING="fetching",t.DONE="done",t))(As||{});const ws=ut.createIdentifier("univer.permission-service");Un(Ot.Starting,ws);class ji extends yt{constructor(){super(...arguments);_(this,"_permissionPointMap",new Map);_(this,"_permissionPointUpdate$",new ot.Subject);_(this,"permissionPointUpdate$",this._permissionPointUpdate$.asObservable())}deletePermissionPoint(n){const s=this._permissionPointMap.get(n);s&&(s.complete(),this._permissionPointMap.delete(n))}addPermissionPoint(n){if(!n.id)return!1;if(this._permissionPointMap.get(n.id))throw new Error("PermissionPoint already exists");return this._permissionPointMap.set(n.id,new ot.BehaviorSubject(n)),this._permissionPointUpdate$.next(n),!0}updatePermissionPoint(n,s){const r=this._permissionPointMap.get(n);if(!r)return;const i=r.getValue();i.value=s,i.status=As.DONE,r.next({...i}),this._permissionPointUpdate$.next(i)}clearPermissionMap(){this._permissionPointMap.clear()}getPermissionPoint(n){const s=this._permissionPointMap.get(n);if(s)return s.getValue()}getPermissionPoint$(n){const s=this._permissionPointMap.get(n);if(s)return s}composePermission$(n){const s=n.map(r=>{var o;const i=(o=this._permissionPointMap)==null?void 0:o.get(r);if(!i)throw new Error(`[PermissionService]: ${r} permissionPoint does not exist!`);return i.asObservable()});return ot.combineLatest(s).pipe(cn.map(r=>r))}composePermission(n){return n.map(r=>{var o;const i=(o=this._permissionPointMap)==null?void 0:o.get(r);if(!i)throw new Error(`[PermissionService]: ${r} permissionPoint does not exist!`);return i.getValue()})}}class Vi extends yt{constructor(){super(...arguments);_(this,"_resourceMap",new Map);_(this,"_register$",new ot.Subject);_(this,"register$",this._register$.asObservable())}getAllResourceHooks(){return[...this._resourceMap.values()]}getResources(n){return this.getAllResourceHooks().map(i=>{const o=i.toJson(n);return{name:i.pluginName,data:o}})}registerPluginResource(n){const s=n.pluginName;if(this._resourceMap.has(s))throw new Error(`the pluginName is registered {${s}}`);return this._resourceMap.set(s,n),this._register$.next(n),vt(()=>this._resourceMap.delete(s))}disposePluginResource(n){this._resourceMap.delete(n)}loadResources(n,s){this.getAllResourceHooks().forEach(r=>{var o;const i=(o=s==null?void 0:s.find(l=>l.name===r.pluginName))==null?void 0:o.data;if(i)try{const l=r.parseJson(i);r.onLoad(n,l)}catch{console.error("LoadResources Error!")}})}unloadResources(n){this.getAllResourceHooks().forEach(s=>{s.onUnLoad(n)})}dispose(){this._register$.complete(),this._resourceMap.clear()}}const Dn=ut.createIdentifier("resource-manager-service");var tu=Object.defineProperty,eu=Object.getOwnPropertyDescriptor,nu=(t,e,n,s)=>{for(var r=s>1?void 0:s?eu(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(s?o(e,n,r):o(r))||r);return s&&r&&tu(e,n,r),r},Ys=(t,e)=>(n,s)=>e(n,s,t);let is=class extends yt{constructor(e,n){super();_(this,"saveWorkbook",e=>{const n=e.getUnitId(),s=this._resourceManagerService.getResources(n)||[],r=e.getSnapshot();return r.resources=s,r});this._resourceManagerService=e,this._univerInstanceService=n,this._init()}_init(){const e=s=>{s.businesses.forEach(r=>{switch(r){case et.UNRECOGNIZED:case et.UNIVER_UNKNOWN:case et.UNIVER_SLIDE:case et.UNIVER_DOC:break;case et.UNIVER_SHEET:this._univerInstanceService.getAllUnitsForType(et.UNIVER_SHEET).forEach(i=>{const l=(i.getSnapshot().resources||[]).find(a=>a.name===s.pluginName);if(l)try{const a=s.parseJson(l.data);s.onLoad(i.getUnitId(),a)}catch{console.error(`Load Workbook{${i.getUnitId()}} Resources{${s.pluginName}} Data Error.`)}})}})};this._resourceManagerService.getAllResourceHooks().forEach(s=>{e(s)}),this.disposeWithMe(this._resourceManagerService.register$.subscribe(s=>{e(s)})),this.disposeWithMe(vt(this._univerInstanceService.getTypeOfUnitAdded$(et.UNIVER_SHEET).subscribe(s=>{this._resourceManagerService.loadResources(s.getUnitId(),s.getSnapshot().resources)}))),this.disposeWithMe(vt(this._univerInstanceService.getTypeOfUnitDisposed$(et.UNIVER_SHEET).subscribe(s=>{this._resourceManagerService.unloadResources(s.getUnitId())})))}};is=nu([Ys(0,ut.Inject(Dn)),Ys(1,ut.Inject(xe))],is);const Ts=ut.createIdentifier("resource-loader-service");Un(Ot.Ready,Ts);class Ls extends yt{constructor(){super();_(this,"_currentTheme");_(this,"_currentTheme$",new ot.BehaviorSubject({}));_(this,"currentTheme$",this._currentTheme$.asObservable());this.disposeWithMe(vt(()=>this._currentTheme$.complete()))}getCurrentTheme(){if(!this._currentTheme)throw new Error("[ThemeService]: current theme is not set!");return this._currentTheme}setTheme(n){this._currentTheme=n,this._currentTheme$.next(n)}}const Ki="__defaultDocumentNormalEditorSpecialUnitId_20231006__",Yi="__defaultDocumentFormulaBarEditorSpecialUnitId_20231012__",su=`\r
|
|
7
|
-
`;function ru(t){return`__internalEditorId__${t}`}function iu(t){return t.startsWith("__")}var ou=Object.defineProperty,lu=Object.getOwnPropertyDescriptor,au=(t,e,n,s)=>{for(var r=s>1?void 0:s?lu(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(s?o(e,n,r):o(r))||r);return s&&r&&ou(e,n,r),r},jn=(t,e)=>(n,s)=>e(n,s,t);const yn=ut.createIdentifier("univer.undo-redo.service"),uu=20;class zi{dispose(){}async dispatchToHandlers(){return!1}}const Xi="univer.command.redo",qi="univer.command.undo",Ji=new class extends zi{constructor(){super(...arguments);_(this,"type",tn.COMMAND);_(this,"id",qi)}async handler(e){const n=e.get(yn),s=n.pitchTopUndoElement();if(!s)return!1;const r=e.get(en);return ds(s.undoMutations,r)?(n.popUndoToRedo(),!0):!1}},Zi=new class extends zi{constructor(){super(...arguments);_(this,"type",tn.COMMAND);_(this,"id",Xi)}async handler(e){const n=e.get(yn),s=n.pitchTopRedoElement();if(!s)return!1;const r=e.get(en);return ds(s.redoMutations,r)?(n.popRedoToUndo(),!0):!1}};exports.LocalUndoRedoService=class extends yt{constructor(n,s,r){super();_(this,"undoRedoStatus$");_(this,"_undoRedoStatus$",new ot.BehaviorSubject({undos:0,redos:0}));_(this,"_undoStacks",new Map);_(this,"_redoStacks",new Map);_(this,"_batchingStatus",new Map);this._univerInstanceService=n,this._commandService=s,this._contextService=r,this.undoRedoStatus$=this._undoRedoStatus$.asObservable(),this.disposeWithMe(this._commandService.registerCommand(Ji)),this.disposeWithMe(this._commandService.registerCommand(Zi)),this.disposeWithMe(vt(()=>this._undoRedoStatus$.complete())),this.disposeWithMe(vt(this._univerInstanceService.focused$.subscribe(()=>this._updateStatus())))}pushUndoRedo(n){const{unitID:s}=n,r=this._getRedoStack(s,!0),i=this._getUndoStack(s,!0);if(r.length=0,this._batchingStatus.has(n.unitID)){const l=this._batchingStatus.get(n.unitID),a=this._pitchUndoElement(n.unitID);l===0||!a?(o(n),this._batchingStatus.set(n.unitID,1)):this._tryBatchingElements(a,n)}else o(n);function o(l){i.push(l),i.length>uu&&i.splice(0,1)}this._updateStatus()}clearUndoRedo(n){const s=this._getRedoStack(n);s&&(s.length=0);const r=this._getUndoStack(n);r&&(r.length=0),this._updateStatus()}pitchTopUndoElement(){const n=this._getFocusedUnitId();return this._pitchUndoElement(n)}pitchTopRedoElement(){const n=this._getFocusedUnitId();return this._pitchRedoElement(n)}_pitchUndoElement(n){const s=this._getUndoStack(n);return s!=null&&s.length?s[s.length-1]:null}_pitchRedoElement(n){const s=this._getRedoStack(n);return s!=null&&s.length?s[s.length-1]:null}popUndoToRedo(){const s=this._getUndoStackForFocused().pop();s&&(this._getRedoStackForFocused().push(s),this._updateStatus())}popRedoToUndo(){const s=this._getRedoStackForFocused().pop();s&&(this._getUndoStackForFocused().push(s),this._updateStatus())}__tempBatchingUndoRedo(n){if(this._batchingStatus.has(n))throw new Error("[LocalUndoRedoService]: cannot batching undo redo twice at the same time!");return this._batchingStatus.set(n,0),vt(()=>this._batchingStatus.delete(n))}_updateStatus(){var i,o;const n=this._getFocusedUnitId(),s=n&&((i=this._undoStacks.get(n))==null?void 0:i.length)||0,r=n&&((o=this._redoStacks.get(n))==null?void 0:o.length)||0;this._undoRedoStatus$.next({undos:s,redos:r})}_getUndoStack(n,s=!1){let r=this._undoStacks.get(n);return!r&&s&&(r=[],this._undoStacks.set(n,r)),r||null}_getRedoStack(n,s=!1){let r=this._redoStacks.get(n);return!r&&s&&(r=[],this._redoStacks.set(n,r)),r||null}_getUndoStackForFocused(){const n=this._getFocusedUnitId();if(!n)throw new Error("No focused univer instance!");return this._getUndoStack(n,!0)}_getRedoStackForFocused(){const n=this._getFocusedUnitId();if(!n)throw new Error("No focused univer instance!");return this._getRedoStack(n,!0)}_tryBatchingElements(n,s){n.redoMutations.push(...s.redoMutations),n.undoMutations.push(...s.undoMutations)}_getFocusedUnitId(){var o,l,a,h;let n="";const s=this._contextService.getContextValue(Ve),r=this._contextService.getContextValue($i),i=this._contextService.getContextValue(Bi);return s?r?n=Yi:i?n=Ki:n=(l=(o=this._univerInstanceService.getFocusedUnit())==null?void 0:o.getUnitId())!=null?l:"":n=(h=(a=this._univerInstanceService.getFocusedUnit())==null?void 0:a.getUnitId())!=null?h:"",n}};exports.LocalUndoRedoService=au([jn(0,xe),jn(1,en),jn(2,Qe)],exports.LocalUndoRedoService);const Qi=Symbol("DependentOn");class os extends yt{onStarting(e){}onReady(){}onRendered(){}onSteady(){}getUniverInstanceType(){return this.constructor.type}getPluginName(){return this.constructor.pluginName}}_(os,"pluginName"),_(os,"type",et.UNIVER_UNKNOWN);class cu{constructor(){_(this,"_plugins",[])}addPlugin(e){this._plugins.push(e)}removePlugins(){const e=this._plugins.slice();return this._plugins.length=0,e}forEachPlugin(e){this._plugins.forEach(e)}}class hu{constructor(){_(this,"_pluginsRegistered",[])}registerPlugin(e,n){this._pluginsRegistered.push({plugin:e,options:n})}getRegisterPlugins(){return this._pluginsRegistered.slice()}removePlugins(){this._pluginsRegistered=[]}}var du=Object.defineProperty,fu=Object.getOwnPropertyDescriptor,to=(t,e,n,s)=>{for(var r=s>1?void 0:s?fu(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(s?o(e,n,r):o(r))||r);return s&&r&&du(e,n,r),r},We=(t,e)=>(n,s)=>e(n,s,t);const _u=4;function gu(...t){return function(e){e[Qi]=t}}exports.PluginService=class{constructor(e){_(this,"_pluginHolderForUniver");_(this,"_pluginHoldersForTypes",new Map);_(this,"_seenPlugins",new Set);_(this,"_flushTimer");this._injector=e,this._pluginHolderForUniver=this._injector.createInstance(Sn,this._checkPluginSeen.bind(this),this._immediateInitPlugin.bind(this)),this._pluginHolderForUniver.start()}dispose(){this._clearFlushTimer();for(const e of this._pluginHoldersForTypes.values())e.dispose();this._pluginHolderForUniver.dispose()}registerPlugin(e,n){this._assertPluginValid(e),this._scheduleInitPlugin();const{type:s}=e;s===et.UNIVER_UNKNOWN?(this._pluginHolderForUniver.register(e,n),this._pluginHolderForUniver.flush()):this._ensurePluginHolderForType(s).register(e,n)}startPluginForType(e){this._ensurePluginHolderForType(e).start()}_ensurePluginHolderForType(e){if(!this._pluginHoldersForTypes.has(e)){const n=this._injector.createInstance(Sn,this._checkPluginSeen.bind(this),this._immediateInitPlugin.bind(this));return this._pluginHoldersForTypes.set(e,n),n}return this._pluginHoldersForTypes.get(e)}_immediateInitPlugin(e){this._seenPlugins.add(e.pluginName),this._ensurePluginHolderForType(e.type).immediateInitPlugin(e)}_checkPluginSeen(e){return this._seenPlugins.has(e.pluginName)}_assertPluginValid(e){const{type:n,pluginName:s}=e;if(n===et.UNRECOGNIZED)throw new Error(`[PluginService]: invalid plugin type for ${e}. Please assign a "type" to your plugin.`);if(s==="")throw new Error(`[PluginService]: no plugin name for ${e}. Please assign a "pluginName" to your plugin.`);if(this._seenPlugins.has(s))throw new Error(`[PluginService]: duplicated plugin name for "${s}". Maybe a plugin that dependents on "${s} has already registered it. In that case please register "${s}" before the that plugin.`);this._seenPlugins.add(e.pluginName)}_scheduleInitPlugin(){this._flushTimer===void 0&&(this._flushTimer=setTimeout(()=>{this._pluginHolderForUniver.started||this._pluginHolderForUniver.start(),this._flushPlugins(),this._clearFlushTimer()},_u))}_clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}_flushPlugins(){this._pluginHolderForUniver.flush();for(const[e,n]of this._pluginHoldersForTypes)n.started&&n.flush()}};exports.PluginService=to([We(0,ut.Inject(ut.Injector))],exports.PluginService);let Sn=class extends yt{constructor(e,n,s,r,i,o){super();_(this,"_started",!1);_(this,"_pluginRegistry",new hu);_(this,"_pluginStore",new cu);this._checkPluginRegistered=e,this._registerPlugin=n,this._logService=s,this._injector=r,this._lifecycleService=i,this._lifecycleInitializerService=o}get started(){return this._started}dispose(){super.dispose(),this._pluginStore.forEachPlugin(e=>e.dispose()),this._pluginStore.removePlugins(),this._pluginRegistry.removePlugins()}register(e,n){this._pluginRegistry.registerPlugin(e,n)}immediateInitPlugin(e){const n=this._initPlugin(e,void 0);this._pluginsRunLifecycle([n])}start(){this._started||(this._started=!0,this.flush())}flush(){if(!this._started)return;const e=this._pluginRegistry.getRegisterPlugins().map(({plugin:n,options:s})=>this._initPlugin(n,s));this._pluginsRunLifecycle(e),this._pluginRegistry.removePlugins()}_initPlugin(e,n){const s=e[Qi];if(s){const i=()=>{const o=s.find(l=>!this._checkPluginRegistered(l));return o?(this._logService.warn("[PluginService]",`plugin "${e.pluginName}" depends on "${o.pluginName}" which is not registered. Univer will automatically register it with default configuration.`),this._registerPlugin(o,void 0),!0):!1};for(;i(););}const r=this._injector.createInstance(e,n);return this._pluginStore.addPlugin(r),r}_pluginsRunLifecycle(e){const n=r=>{e.forEach(i=>{switch(r){case Ot.Starting:i.onStarting(this._injector);break;case Ot.Ready:i.onReady();break;case Ot.Rendered:i.onRendered();break;case Ot.Steady:i.onSteady();break}this._lifecycleInitializerService.initModulesOnStage(r)})},s=this.disposeWithMe(this._lifecycleService.subscribeWithPrevious().pipe(ot.finalize(()=>{Promise.resolve().then(()=>s.dispose())})).subscribe(r=>{n(r)}))}};Sn=to([We(2,pe),We(3,ut.Inject(ut.Injector)),We(4,ut.Inject(exports.LifecycleService)),We(5,ut.Inject(exports.LifecycleInitializerService))],Sn);function eo(t,e){if(!e)return t;const n=[];for(const s of t){const r=e.find(([i])=>i===s[0]);if(r){if(r[1]===null)continue;n.push([s[0],r[1]])}else n.push(s)}return n}const ls={[Ft.Editor]:"Editor",[Ft.Owner]:"Owner",[Ft.Reader]:"Reader",[Ft.UNRECOGNIZED]:"UNRECOGNIZED"},Nn=t=>t?{userID:`${ls[t]}_${D.generateRandomId(8)}`,name:ls[t],avatar:""}:{userID:"",name:"",avatar:"",anonymous:!0,canBindAnonymous:!1},Vn=(t,e)=>t.startsWith(ls[e]);var mu=Object.defineProperty,pu=Object.getOwnPropertyDescriptor,Eu=(t,e,n,s)=>{for(var r=s>1?void 0:s?pu(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(s?o(e,n,r):o(r))||r);return s&&r&&mu(e,n,r),r};exports.UserManagerService=class{constructor(){_(this,"_model",new Map);_(this,"_userChange$",new ot.Subject);_(this,"userChange$",this._userChange$.asObservable());_(this,"_currentUser$",new ot.BehaviorSubject(Nn()));_(this,"currentUser$",this._currentUser$.asObservable())}getCurrentUser(){return this._currentUser$.getValue()}setCurrentUser(e){this.addUser(e),this._currentUser$.next(e)}addUser(e){this._model.set(e.userID,e),this._userChange$.next({type:"add",user:e})}getUser(e,n){const s=this._model.get(e);if(s)return s;n&&n()}delete(e){const n=this.getUser(e);this._model.delete(e),n&&this._userChange$.next({type:"delete",user:n})}clear(){this._model.clear(),this._userChange$.next({type:"clear"})}};exports.UserManagerService=Eu([Wi(Ot.Starting,exports.UserManagerService)],exports.UserManagerService);var Ru=Object.defineProperty,Cu=Object.getOwnPropertyDescriptor,Iu=(t,e,n,s)=>{for(var r=s>1?void 0:s?Cu(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(s?o(e,n,r):o(r))||r);return s&&r&&Ru(e,n,r),r},zs=(t,e)=>(n,s)=>e(n,s,t);exports.AuthzIoLocalService=class{constructor(e,n){_(this,"_permissionMap",new Map([]));this._resourceManagerService=e,this._userManagerService=n,this._initSnapshot(),n.setCurrentUser(Nn(Ft.Owner))}_getRole(e){const n=this._userManagerService.getCurrentUser();return n?Vn(n.userID,e):!1}_initSnapshot(){this._resourceManagerService.registerPluginResource({toJson:e=>{const n=[...this._permissionMap.keys()].reduce((s,r)=>{const i=this._permissionMap.get(r);return s[r]=i,s},{});return JSON.stringify(n)},parseJson:e=>JSON.parse(e),pluginName:"SHEET_AuthzIoMockService_PLUGIN",businesses:[et.UNIVER_SHEET,et.UNIVER_DOC,et.UNIVER_SLIDE],onLoad:(e,n)=>{for(const s in n)this._permissionMap.set(s,n[s])},onUnLoad:()=>{this._permissionMap.clear()}})}async create(e){const n=D.generateRandomId(8);switch(e.objectType){case fn.SelectRange:{const s=e.selectRangeObject;this._permissionMap.set(n,{...s,objectType:e.objectType});break}case fn.Worksheet:{const s=e.worksheetObject;this._permissionMap.set(n,{...s,objectType:e.objectType})}}return n}async allowed(e){var n;if(this._permissionMap.has(e.objectID)){const s=this._permissionMap.get(e.objectID);if(s&&s.objectType===fn.Worksheet)return(n=s==null?void 0:s.strategies)==null?void 0:n.map(r=>({action:r.action,allowed:r.role===Ft.Editor}))}return e.actions.map(s=>({action:s,allowed:this._getRole(Ft.Owner)||this._getRole(Ft.Editor)}))}async batchAllowed(e){const n=this._userManagerService.getCurrentUser(),s=e.map(r=>({unitID:r.unitID,objectID:r.objectID,actions:r.actions.map(i=>({action:i,allowed:!1}))}));return n&&(Vn(n.userID,Ft.Owner)||Vn(n.userID,Ft.Editor))?e.map(r=>({unitID:r.unitID,objectID:r.objectID,actions:r.actions.map(i=>({action:i,allowed:!0}))})):s}async list(e){const n=[];return e.objectIDs.forEach(s=>{const r=this._permissionMap.get(s);if(r){const i={objectID:s,unitID:e.unitID,objectType:r.objectType,name:r.name,shareOn:!1,shareRole:Ft.Owner,shareScope:-1,creator:Nn(Ft.Owner),strategies:[],actions:e.actions.map(o=>({action:o,allowed:this._getRole(Ft.Owner)||this._getRole(Ft.Editor)}))};n.push(i)}}),n}async listCollaborators(){return[]}async listRoles(){return{roles:[],actions:[]}}async deleteCollaborator(){}async update(e){}async updateCollaborator(){}async createCollaborator(){}async putCollaborators(e){}};exports.AuthzIoLocalService=Iu([zs(0,Dn),zs(1,ut.Inject(exports.UserManagerService))],exports.AuthzIoLocalService);const no=ut.createIdentifier("IAuthzIoIoService");class Ou{constructor(e={},n){_(this,"_startedTypes",new Set);_(this,"_injector");const s=this._injector=Su(n,e==null?void 0:e.override),{theme:r,locale:i,locales:o,logLevel:l}=e;r&&this._injector.get(Ls).setTheme(r),o&&this._injector.get(Ke).load(o),i&&this._injector.get(Ke).setLocale(i),l&&this._injector.get(pe).setLogLevel(l),this._init(s),this._pluginService}get _univerInstanceService(){return this._injector.get(xe)}get _pluginService(){return this._injector.get(exports.PluginService)}__getInjector(){return this._injector}dispose(){this._injector.dispose()}setLocale(e){this._injector.get(Ke).setLocale(e)}createUnit(e,n){return this._univerInstanceService.createUnit(e,n)}createUniverSheet(e){return this._univerInstanceService.createUnit(et.UNIVER_SHEET,e)}createUniverDoc(e){return this._univerInstanceService.createUnit(et.UNIVER_DOC,e)}createUniverSlide(e){return this._univerInstanceService.createUnit(et.UNIVER_SLIDE,e)}_init(e){this._univerInstanceService.registerCtorForType(et.UNIVER_SHEET,exports.Workbook),this._univerInstanceService.registerCtorForType(et.UNIVER_DOC,Ae),this._univerInstanceService.registerCtorForType(et.UNIVER_SLIDE,vs);const n=e.get(xe);n.__setCreateHandler((s,r,i)=>{if(!this._startedTypes.has(s)){this._pluginService.startPluginForType(s),this._startedTypes.add(s);const l=e.createInstance(i,r);return n.__addUnit(l),this._tryProgressToReady(),l}const o=e.createInstance(i,r);return n.__addUnit(o),o})}_tryProgressToReady(){this._injector.get(exports.LifecycleService).stage<Ot.Ready&&(this._injector.get(exports.LifecycleService).stage=Ot.Ready)}registerPlugin(e,n){this._pluginService.registerPlugin(e,n)}}function Su(t,e){const n=eo([[Li],[Ke],[Ls],[exports.LifecycleService],[exports.LifecycleInitializerService],[exports.PluginService],[exports.UserManagerService],[xe,{useClass:exports.UniverInstanceService}],[ws,{useClass:ji}],[pe,{useClass:di,lazy:!0}],[en,{useClass:exports.CommandService,lazy:!0}],[yn,{useClass:exports.LocalUndoRedoService,lazy:!0}],[wi,{useClass:Ti}],[Qe,{useClass:ci}],[Dn,{useClass:Vi,lazy:!0}],[Ts,{useClass:is,lazy:!0}],[no,{useClass:exports.AuthzIoLocalService,lazy:!0}]],e);return t?t.createChild(n):new ut.Injector(n)}const Nu=(t,e)=>e.length===t.length&&!t.some(n=>e.some(s=>!ge.equals(s,n))),bu=(t,e)=>e.length===t.length&&t.every((n,s)=>{const r=e[s];return r.unitId===n.unitId&&r.sheetId===n.sheetId&&ge.equals(n.range,r.range)});function vu(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||!t||typeof e!="object"||!e)return!1;const n=Object.keys(t),s=Object.keys(e);if(n.length!==s.length)return!1;const r=Object.prototype.hasOwnProperty.bind(e);for(let i=0;i<n.length;i++){const o=n[i];if(!r(o))return!1;const l=t[o],a=e[o];if(l!==a)return!1}return!0}function so(t){return/^-?\d+(\.\d+)?$/.test(t)}function Au(t){return so(t)?Number(t)<=Number.MAX_SAFE_INTEGER:!1}function wu(t){return["true","false"].includes(t.toLowerCase())}function Tu(t,e){return e.forEach(n=>t.add(n)),t}function Lu(t,e=16){let n=0,s=null;return function(...i){const o=Date.now();o-n<e?(s&&clearTimeout(s),s=setTimeout(()=>{n=o,t.apply(this,i)},e)):(n=o,t.apply(this,i))}}function Mu(t){const e=new MessageChannel;let n=!1;return e.port1.onmessage=()=>{n||t()},e.port2.postMessage(null),()=>{n=!0,e.port1.onmessage=null,e.port1.close(),e.port2.close()}}var ro=(t=>(t[t.TEXT=0]="TEXT",t[t.ARROW=1]="ARROW",t[t.CUSTOM=2]="CUSTOM",t))(ro||{});function Uu(t,e,n){if(e==="")return t;const s={id:"mock-id",body:t,documentStyle:{}},r=new Ae(s),i=e.length;let o;for(;(o=r.getBody().dataStream.indexOf(e))>=0;){const a=new me,h=ve.getInstance();if(o>0&&a.retain(o),n.length>0){const u=r.sliceBody(o,o+i),d={dataStream:n};Array.isArray(u==null?void 0:u.textRuns)&&u.textRuns.length&&(d.textRuns=[{...u.textRuns[0],st:0,ed:n.length}]),a.insert(n.length,d)}a.delete(i);const c=a.serialize();r.apply(h.editOp(c))}const l=r.getBody();return r.dispose(),l}class Du extends Tn{add(e){if(!e)return null;const n=new wn(e,this);return this._observers=[n],this._onObserverAdded&&this._onObserverAdded(n),n}makeObserverTopPriority(){}makeObserverBottomPriority(){}}const yu=ut.createIdentifier("ILocalStorageService");function Pu(t){return`sheet_interceptor_${t}`}const io=t=>function(e,n){let s=-1;function r(i,o){if(i<=s)throw new Error("[SheetInterceptorService]: next() called multiple times!");return s=i,i===t.length?o:t[i].handler(o,n,r.bind(null,i+1))}return r(0,e)};class xu{constructor(e){_(this,"_interceptorsByName",new Map);_(this,"_interceptorPoints");this._interceptorPoints=e}fetchThroughInterceptors(e){const n=e,s=this._interceptorsByName.get(n);return io(s||[])}intercept(e,n){const s=e;this._interceptorsByName.has(s)||this._interceptorsByName.set(s,[]);const r=this._interceptorsByName.get(s);return r.push(n),this._interceptorsByName.set(s,r.sort((i,o)=>{var l,a;return((l=o.priority)!=null?l:0)-((a=i.priority)!=null?a:0)})),()=>Ln(this._interceptorsByName.get(s),n)}getInterceptPoints(){return this._interceptorPoints}}const ku=ut.createIdentifier("univer.snapshot-server-service");class Hu{constructor(){_(this,"_sheetBlockCache",new Map)}getUnitOnRev(e,n){return Promise.resolve({snapshot:{unitID:"",type:et.UNIVER_SHEET,rev:0,workbook:void 0,doc:void 0},changesets:[],error:{code:Xt.OK,message:""}})}getSheetBlock(e,n){const s=this._sheetBlockCache.get(n.blockID);return Promise.resolve({block:s,error:{code:Xt.OK,message:""}})}fetchMissingChangesets(e,n){return Promise.resolve({changesets:[],error:{code:Xt.OK,message:""}})}getResourcesRequest(e,n){return Promise.resolve({resources:{},error:{code:Xt.OK,message:""}})}saveSnapshot(e,n){return Promise.resolve({error:{code:Xt.OK,message:""}})}saveSheetBlock(e,n){const{block:s}=n;return s?(this._sheetBlockCache.set(s.id,s),Promise.resolve({error:{code:Xt.OK,message:""},blockID:s.id})):Promise.resolve({error:{code:Xt.UNDEFINED,message:"block is required"},blockID:""})}saveChangeset(e,n){return Promise.resolve({error:{code:Xt.OK,message:""},concurrent:[]})}}function Fu(t){return btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(e,n)=>String.fromCharCode(Number.parseInt(n,16))))}function Ms(t){return decodeURIComponent(Array.prototype.map.call(atob(t),e=>`%${`00${e.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""))}const nn=new TextEncoder,Pn=new TextDecoder;function oo(t){const e=D.deepClone(t);return delete e.id,delete e.name,delete e.rowCount,delete e.columnCount,delete e.cellData,nn.encode(JSON.stringify(e))}function lo(t){const e=D.deepClone(t);return delete e.id,delete e.rev,delete e.name,delete e.sheetOrder,delete e.sheets,nn.encode(JSON.stringify(e))}function Bu(t){const e=D.deepClone(t);return delete e.id,delete e.rev,delete e.title,delete e.resources,nn.encode(JSON.stringify(e))}function Xs(t){return JSON.parse(Pn.decode(t))}function $u(t){return JSON.parse(typeof t=="string"?Ms(t):Pn.decode(t))}function Wu(t){return JSON.parse(typeof t=="string"?Ms(t):Pn.decode(t))}const Kn=256;function ao(t,e){const n=new ee(t),s=n.getLength(),r=[];let i=0;for(;i<s;){const o=Math.min(i+Kn,s-1),l=n.getSlice(i,Math.min(i+Kn,s-1),0,e),a=Gu(l);r.push({id:D.generateRandomId(19,"0123456789"),startRow:i,endRow:o,data:a}),i+=Kn}return r}function Gu(t){const e=t.getData();return nn.encode(JSON.stringify(e))}async function ju(t,e,n,s,r){const i={},o={};if(!await Promise.all(Object.entries(e.sheets).map(async([u,d])=>{const f={id:d.id,type:bn.GRID,name:d.name,rowCount:d.rowCount,columnCount:d.columnCount,originalMeta:oo(d)};if(o[u]=f,d.cellData){const m=ao(d.cellData,d.rowCount),p=await Promise.all(m.map(y=>r.saveSheetBlock(t,{unitID:n,type:et.UNIVER_SHEET,block:y})));if(p.some(y=>{var P;return((P=y.error)==null?void 0:P.code)!==Xt.OK}))return!1;i[u]={sheetID:u,blocks:p.map(y=>y.blockID)}}return!0})))throw new Error("[transformWorkbookDataToSnapshot()]: Failed to save sheet blocks.");const a=lo(e),h={unitID:e.id,rev:s,creator:"",name:e.name,sheetOrder:e.sheetOrder,sheets:o,blockMeta:i,resources:e.resources||[],originalMeta:a};return{snapshotRes:{unitID:n,rev:h.rev,type:et.UNIVER_SHEET,workbook:h,doc:void 0}}}async function Vu(t,e,n,s,r){var d,f;const i={},o={};if(!await Promise.all(Object.entries(e.sheets).map(async([m,p])=>{const y={id:p.id,type:bn.GRID,name:p.name,rowCount:p.rowCount,columnCount:p.columnCount,originalMeta:oo(p)};if(o[m]=y,p.cellData){const P=ao(p.cellData,p.rowCount),Z=await Promise.all(P.map(gt=>r.saveSheetBlock(t,{unitID:n,type:et.UNIVER_SHEET,block:gt})));if(Z.some(gt=>{var ht;return((ht=gt.error)==null?void 0:ht.code)!==Xt.OK}))return!1;i[m]={sheetID:m,blocks:Z.map(gt=>gt.blockID)}}return!0})))throw new Error("[transformWorkbookDataToSnapshot()]: Failed to save sheet blocks.");const a=lo(e),h={unitID:e.id,rev:s,creator:"",name:e.name,sheetOrder:e.sheetOrder,sheets:o,blockMeta:i,resources:e.resources||[],originalMeta:a},c={unitID:n,rev:h.rev,type:et.UNIVER_SHEET,workbook:h,doc:void 0},u=await r.saveSnapshot(t,{unitID:n,type:et.UNIVER_SHEET,snapshot:c});if(gi(u.error))throw new Error(`transformWorkbookDataToSnapshot(): Failed to save snapshot.
|
|
8
|
-
ErrorCode: ${(d=u.error)==null?void 0:d.code}:${(f=u.error)==null?void 0:f.message}`);return{snapshot:c}}function
|
|
9
|
-
ErrorCode: ${(h=l.error)==null?void 0:h.code}:${(c=l.error)==null?void 0:c.message}`);return{snapshot:o}}async function
|
|
3
|
+
`):"",this.name="UnsubscriptionError",this.errors=n}});function ks(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var Qr=function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,n,s,r,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var l=ys(o),a=l.next();!a.done;a=l.next()){var h=a.value;h.remove(this)}}catch(p){e={error:p}}finally{try{a&&!a.done&&(n=l.return)&&n.call(l)}finally{if(e)throw e.error}}else o.remove(this);var c=this.initialTeardown;if(Ge(c))try{c()}catch(p){i=p instanceof Bn?p.errors:[p]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var d=ys(u),f=d.next();!f.done;f=d.next()){var m=f.value;try{Hs(m)}catch(p){i=i!=null?i:[],p instanceof Bn?i=xs(xs([],Ps(i)),Ps(p.errors)):i.push(p)}}}catch(p){s={error:p}}finally{try{f&&!f.done&&(r=d.return)&&r.call(d)}finally{if(s)throw s.error}}}if(i)throw new Bn(i)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)Hs(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(e)}},t.prototype._hasParent=function(e){var n=this._parentage;return n===e||Array.isArray(n)&&n.includes(e)},t.prototype._addParent=function(e){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(e),n):n?[n,e]:e},t.prototype._removeParent=function(e){var n=this._parentage;n===e?this._parentage=null:Array.isArray(n)&&ks(n,e)},t.prototype.remove=function(e){var n=this._finalizers;n&&ks(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}();Qr.EMPTY;function Il(t){return t instanceof Qr||t&&"closed"in t&&Ge(t.remove)&&Ge(t.add)&&Ge(t.unsubscribe)}function Hs(t){Ge(t)?t():t.unsubscribe()}class ti{constructor(e=!1){_(this,"skipNextObservers");_(this,"lastReturnValue");_(this,"isStopPropagation",!1);this.initialize(e)}initialize(e=!1){return this.skipNextObservers=e,this}stopPropagation(){this.isStopPropagation=!0}}function ei(t){return t instanceof An}class An{constructor(e,n){this.callback=e,this.observable=n}dispose(){this.observable.remove(this)}}class wn{constructor(e){_(this,"_observers",new Array);_(this,"_eventState");_(this,"_onObserverAdded");this._eventState=new ti,e&&(this._onObserverAdded=e)}get observers(){return this._observers}add(e,n=!1){if(!e)return null;const s=new An(e,this);return n?this._observers.unshift(s):this._observers.push(s),this._onObserverAdded&&this._onObserverAdded(s),s}remove(e){return e&&this._observers.indexOf(e)!==-1?(this._remove(e),!0):!1}makeObserverTopPriority(e){this._remove(e),this._observers.unshift(e)}makeObserverBottomPriority(e){this._remove(e),this._observers.push(e)}notifyObservers(e){if(!this._observers.length)return null;const n=this._eventState;n.skipNextObservers=!1,n.lastReturnValue=e,n.isStopPropagation=!1;let s=!1;for(let r=0;r<this._observers.length;r++){const i=this._observers[r];if(n.lastReturnValue=i.callback(e,n),n.isStopPropagation&&(s=!0),n.skipNextObservers)return{lastReturnValue:n.lastReturnValue,stopPropagation:s}}return{lastReturnValue:n.lastReturnValue,stopPropagation:s}}notifyObserversWithPromise(e){let n=Promise.resolve(e);if(!this._observers.length)return n;const s=this._eventState;s.skipNextObservers=!1;for(let r=0;r<this._observers.length;r++){const i=this._observers[r];s.skipNextObservers||(n=n.then(()=>i.callback(e,s)))}return n.then(()=>e)}notifyObserver(e,n){const s=this._eventState;return s.skipNextObservers=!1,e.callback(n,s),{lastReturnValue:s.lastReturnValue,stopPropagation:s.isStopPropagation}}hasObservers(){return this._observers.length>0}clear(){this._observers.forEach(e=>{e.dispose()}),this._observers=new Array,this._onObserverAdded=null}clone(){const e=new wn;return e._observers=this._observers.slice(0),e}_remove(e){if(!e)return!1;const n=this._observers.indexOf(e);return n!==-1?(this._observers.splice(n,1),!0):!1}}function vt(t){let e=!1;return t?Il(t)?{dispose:()=>t.unsubscribe()}:ei(t)?{dispose:()=>{e||(e=!0,t.dispose())}}:typeof t=="function"?{dispose:()=>{e||(e=!0,t())}}:t:vt(()=>{})}function Ol(t){return vt(()=>{t.unsubscribe()})}class cs{constructor(){_(this,"_disposables",new Set)}add(e){const n=vt(e);return this._disposables.add(n),{dispose:()=>{n.dispose(),this._disposables.delete(n)}}}dispose(){this._disposables.forEach(e=>{e.dispose()}),this._disposables.clear()}}class yt{constructor(){_(this,"_disposed",!1);_(this,"_collection",new cs)}disposeWithMe(e){return this._collection.add(e)}ensureNotDisposed(){if(this._disposed)throw new Error("[Disposable]: object is disposed!")}dispose(){this._disposed||(this._disposed=!0,this._collection.dispose())}}class Sl extends yt{constructor(){super(...arguments);_(this,"dispose$",new it.Subject)}dispose(){super.dispose(),this.dispose$.next(),this.dispose$.complete()}}class Be{static hasLength(e,n){return e.length===n}static getValueType(e){return Object.prototype.toString.apply(e)}static isObject(e){return this.getValueType(e)==="[object Object]"}static isIterable(e){return e[Symbol.iterator]!=null}static isNumber(e){return this.getValueType(e)==="[object Number]"}}function Tn(t,e){const n=t.indexOf(e);return n>-1?(t.splice(n,1),!0):!1}function Nl(t){const e=new Set,n=[];for(const s of t)e.has(s)||(e.add(s),n.push(s));return n}function bl(t,e){for(let n=t.length-1;n>-1;n--){const s=t[n];if(e(s,n))return s}return null}function vl(t,e){if(t.length===0)return t;const n=e%t.length;return t.slice(n).concat(t.slice(0,n))}function Al(t,e){const n=new Map;return t.forEach(s=>{const r=e(s);let i=n.get(r);n.has(r)||(i=[],n.set(r,i)),i.push(s)}),n}const ct=Symbol("newer"),Lt=Symbol("older");class ni{constructor(e){_(this,"entry");this.entry=e}[Symbol.iterator](){return this}next(){const e=this.entry;return e?(this.entry=e[ct],{done:!1,value:e.key}):{done:!0,value:void 0}}}class si{constructor(e){_(this,"entry");this.entry=e}[Symbol.iterator](){return this}next(){const e=this.entry;return e?(this.entry=e[ct],{done:!1,value:e.value}):{done:!0,value:void 0}}}class ri{constructor(e){_(this,"entry");this.entry=e}[Symbol.iterator](){return this}next(){const e=this.entry;return e?(this.entry=e[ct],{done:!1,value:[e.key,e.value]}):{done:!0,value:void 0}}}var Xs,qs;qs=ct,Xs=Lt;class Yn{constructor(e,n){_(this,"key");_(this,"value");_(this,qs);_(this,Xs);this.key=e,this.value=n,this[ct]=void 0,this[Lt]=void 0}toJSON(){return{key:this.key,value:this.value}}}class ii{constructor(...e){_(this,"_keymap");_(this,"size",0);_(this,"limit");_(this,"oldest");_(this,"newest");_(this,"_onShiftListeners",[]);if(Be.hasLength(e,1)){if(Be.isNumber(e[0])){const n=e[0];this._initialize(n,void 0);return}if(Be.isIterable(e[0])){const n=e[0];this._initialize(0,n);return}return}if(Be.hasLength(e,2)){const n=e[0],s=e[1];this._initialize(n,s)}}onShift(e){if(this._onShiftListeners.indexOf(e)===-1)return this._onShiftListeners.push(e),vt(()=>Tn(this._onShiftListeners,e));throw new Error("[LRUMap]: the listener has been registered!")}_initialize(e,n){this.oldest=void 0,this.newest=void 0,this.size=0,this.limit=e,this._keymap=new Map,n&&(this.assign(n),e<1&&(this.limit=this.size))}_markEntryAsUsed(e){e!==this.newest&&(e[ct]&&(e===this.oldest&&(this.oldest=e[ct]),e[ct][Lt]=e[Lt]),e[Lt]&&(e[Lt][ct]=e[ct]),e[ct]=void 0,e[Lt]=this.newest,this.newest&&(this.newest[ct]=e),this.newest=e)}assign(e){let n,s=this.limit||Number.MAX_VALUE;this._keymap.clear();const r=e[Symbol.iterator]();for(let i=r.next();!i.done;i=r.next()){const o=new Yn(i.value[0],i.value[1]);if(this._keymap.set(o.key,o),n?(n[ct]=o,o[Lt]=n):this.oldest=o,n=o,s--===0)throw new Error("overflow")}this.newest=n,this.size=this._keymap.size}set(e,n){let s=this._keymap.get(e);return s?(s.value=n,this._markEntryAsUsed(s),this):(this._keymap.set(e,s=new Yn(e,n)),this.newest?(this.newest[ct]=s,s[Lt]=this.newest):this.oldest=s,this.newest=s,++this.size,this.size>this.limit&&this.shift(),this)}shift(){const e=this.oldest;if(e)return this.oldest&&this.oldest[ct]?(this.oldest=this.oldest[ct],this.oldest[Lt]=void 0):(this.oldest=void 0,this.newest=void 0),e[ct]=e[Lt]=void 0,this._keymap.delete(e.key),--this.size,this._onShiftListeners.forEach(n=>n(e)),[e.key,e.value]}get(e){const n=this._keymap.get(e);if(n)return this._markEntryAsUsed(n),n.value}has(e){return this._keymap.has(e)}find(e){const n=this._keymap.get(e);return n?n.value:void 0}delete(e){const n=this._keymap.get(e);if(n)return this._keymap.delete(n.key),n[ct]&&n[Lt]?(n[Lt][ct]=n[ct],n[ct][Lt]=n[Lt]):n[ct]?(n[ct][Lt]=void 0,this.oldest=n[ct]):n[Lt]?(n[Lt][ct]=void 0,this.newest=n[Lt]):this.oldest=this.newest=void 0,this.size--,n.value}clear(){this.oldest=void 0,this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new ni(this.oldest)}values(){return new si(this.oldest)}entries(){return this[Symbol.iterator]()}[Symbol.iterator](){return new ri(this.oldest)}forEach(e,n){typeof n!="object"&&(n=this);let s=this.oldest;for(;s;)e.call(n,s.value,s.key,this),s=s[ct]}toJSON(){const e=new Array(this.size);let n=0,s=this.oldest;for(;s;)e[n++]={key:s.key,value:s.value},s=s[ct];return e}toString(){let e="",n=this.oldest;for(;n;)e+=`${String(n.key)}:${n.value}`,n=n[ct],n&&(e+=" < ");return e}}function _e(t){let e=0;const n=Object.keys(t);for(const s of n){const r=Number(s);e=Math.max(e,r)}return e+1}function zn(t,e,n){const s=_e(n),r=n;for(let i=s-1;i>=t;i--)r[i+1]=r[i];r[t]=e}function Xn(t,e,n){const s=Object.keys(n).reduce((r,i)=>Math.max(r,Number.parseInt(i)),0)+1;for(let r=t;r<s;r++)r<t+e?delete n[r]:n[r]!==void 0&&(n[r-e]=n[r],delete n[r])}function wl(t,e){const n=t,s=Object.keys(n),r=s.length,i=e,o=Object.keys(i),l=o.length,a={};let h=0;for(let c=0;c<r;c++,h++){const u=s[c];a[h]=n[u]}for(let c=0;c<l;c++,h++){const u=o[c];a[h]=i[u]}return a}function Tl(t,e,n){const s=n;if(_e(n)>0){const i={};let o=0;for(let l=t;l<=e;l++)s[l]&&(i[o]=s[l],o++);return i}return{}}function qn(t,e,n,s){const r=t>n;if(!r&&t+e>n)throw new Error("Invalid move operation");r?Ml(t,e,n,s):Ul(t,e,n,s)}function Ml(t,e,n,s){const r=s,i=[];for(let o=t;o<t+e;o++)i.push(r[o]);for(let o=t-1;o>=n;o--){const l=r[o];r[o+e]=l,l===void 0&&delete r[o+e]}i.forEach((o,l)=>{r[n+l]=o,o===void 0&&delete r[n+l]})}function Ul(t,e,n,s){const r=s,i=[];for(let o=t;o<t+e;o++)i.push(r[o]);for(let o=t+e;o<n;o++){const l=r[o];r[o-e]=l,l===void 0&&delete r[o-e]}i.forEach((o,l)=>{r[n+l-e]=o,o===void 0&&delete r[n+l-e]})}class ee{constructor(e={}){_(this,"_matrix");this._setOriginValue(e)}static MakeObjectMatrixSize(e){return new ee({[e-1]:{}})}getMatrix(){return this._matrix}forEach(e){const n=this._matrix,s=Object.keys(n);for(const r of s){const i=Number(r),o=n[i];if(e(i,o)===!1)return this}return this}forRow(e){const n=this._matrix,s=Object.keys(n);for(const r of s){const i=Number(r),o=n[i];if(e(i,Object.keys(o).map(a=>Number(a)))===!1)return this}return this}forValue(e){const n=this._matrix,s=Object.keys(n);for(const r of s){const i=Number(r),o=n[i];if(!o)continue;const l=Object.keys(o);for(const a of l){const h=Number(a),c=o[Number(a)];if(e(i,h,c)===!1)return this}}return this}swapRow(e,n){const s=this._matrix[e],r=this._matrix[n];this._matrix[e]=r,this._matrix[n]=s}getRow(e){return this._matrix[e]}getRowOrCreate(e){let n=this.getRow(e);return n==null&&(n={},this._matrix[e]=n),n}reset(){this._setOriginValue({})}hasValue(){const e=this._matrix,n=Object.keys(e);if(n.length===0)return!1;for(const s of n){const r=Number(s),i=e[r];if(Object.keys(i).length>0)return!0}return!1}getValue(e,n){var s,r;return(r=(s=this._matrix)==null?void 0:s[e])==null?void 0:r[n]}setValue(e,n,s){const r=this.getRowOrCreate(e);r[n]=s}deleteValue(e,n){var s,r;(r=(s=this._matrix)==null?void 0:s[e])==null||delete r[n]}realDeleteValue(e,n){var s,r,i;if((r=(s=this._matrix)==null?void 0:s[e])==null||delete r[n],this.getRow(e)){const o=this.getRow(e);if(o==null)return;Object.keys(o).length===0&&((i=this._matrix)==null||delete i[e])}}setRow(e,n){this._matrix[e]=n}moveRows(e,n,s){qn(e,n,s,this._matrix)}moveColumns(e,n,s){this.forEach((r,i)=>{qn(e,n,s,i)})}insertRows(e,n){for(let s=e;s<e+n;s++)zn(s,{},this._matrix)}insertColumns(e,n){for(let s=e;s<e+n;s++)this.forEach((r,i)=>{zn(s,void 0,i)})}removeRows(e,n){Xn(e,n,this._matrix)}removeColumns(e,n){this.forEach((s,r)=>{Xn(e,n,r)})}getFragment(e,n,s,r){const i=new ee;let o=0;for(let l=e;l<=n;l++){const a={};let h=0;for(let c=s;c<=r;c++){const u=this.getValue(l,c);a[h]=u,h++}i.setRow(o,a),o++}return i}getSlice(e,n,s,r){const i=new ee;for(let o=e;o<=n;o++)for(let l=s;l<=r;l++){const a=this.getValue(o,l);a&&i.setValue(o,l,y.deepClone(a))}return i}getSizeOf(){return Object.keys(this._matrix).length}getLength(){return _e(this._matrix)}getRange(){const s=this.getLength()-1;let r=0;const i=this.getLength();for(let o=0;o<i;o++){const l=this.getRow(o);if(l){const a=_e(l)-1;r=a>r?a:r}}return{startRow:0,startColumn:0,endRow:s,endColumn:r}}toNativeArray(){const e=new Array;return this.forValue((n,s,r)=>{e.push(r)}),e}toArray(){const e=[];return this.forRow((n,s)=>{e[n]==null&&(e[n]=[]),s.forEach(r=>{e[n][r]=this.getValue(n,r)})}),e}toFullArray(){const e=this.getRange(),{endColumn:n,endRow:s}=e,r=[];for(let i=0;i<=s;i++){const o=Array(n+1).fill(void 0);r.push(o)}return this.forValue((i,o,l)=>{r[i][o]=l}),r}toJSON(){return this._matrix}clone(){const e=JSON.stringify(this._matrix);return JSON.parse(e)}getData(){const e=JSON.stringify(this._matrix);return JSON.parse(e)}getArrayData(){let e=0,n=0,s=!1,r=!1;const i=new ee;return this.forEach((o,l)=>{s||(s=!0,e=o),Object.keys(l).forEach(a=>{const h=Number(a);r?h<n&&(n=h):(r=!0,n=h);const c=this.getValue(o,h);i.setValue(o-e,h-n,c)})}),i.getData()}getDataRange(){let e=0,n=0,s=0,r=-1,i=!1,o=!1;return this.forEach((l,a)=>{if(i||(i=!0,e=l),a==null)return;const h=_e(a)-1;h>s&&(s=h),Object.keys(a).forEach(c=>{const u=Number(c);o?u<n&&(n=u):(o=!0,n=u)}),l>r&&(r=l)}),{startRow:e,startColumn:n,endRow:r,endColumn:s}}getDiscreteRanges(){const e=[];return this.forEach((n,s)=>{Object.keys(s).forEach(r=>{const i=Number(r);let o=!1;for(const l of e)if(n>=l.startRow&&n<=l.endRow+1&&i>=l.startColumn&&i<=l.endColumn+1){l.endRow=Math.max(n,l.endRow),l.endColumn=Math.max(i,l.endColumn),o=!0;break}o||e.push({startRow:n,endRow:n,startColumn:i,endColumn:i})})}),e}merge(e){this.forValue((n,s)=>{const r=e.getValue(n,s);r!=null&&this.setValue(n,s,r)})}_setOriginValue(e={}){this._matrix=e}}const ue=class ue{static clone(e){return e.rangeType!==void 0?{startRow:e.startRow,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn,rangeType:e.rangeType}:{startRow:e.startRow,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn}}static equals(e,n){return e==null||n==null?!1:e.endRow===n.endRow&&e.endColumn===n.endColumn&&e.startRow===n.startRow&&e.startColumn===n.startColumn&&(e.rangeType===n.rangeType||e.rangeType===void 0&&n.rangeType===rt.NORMAL||n.rangeType===void 0&&e.rangeType===rt.NORMAL)}static intersects(e,n){if(e.rangeType===rt.ROW&&n.rangeType===rt.COLUMN||e.rangeType===rt.COLUMN&&n.rangeType===rt.ROW)return!0;if(e.rangeType===rt.ROW&&n.rangeType===rt.ROW)return e.startRow<=n.endRow&&e.endRow>=n.startRow;if(e.rangeType===rt.COLUMN&&n.rangeType===rt.COLUMN)return e.startColumn<=n.endColumn&&e.endColumn>=n.startColumn;const s=Math.floor(Number.MAX_SAFE_INTEGER/10),r=Number.isNaN(e.startRow)?0:e.startRow,i=Number.isNaN(e.endRow)?s:e.endRow,o=Number.isNaN(e.startColumn)?0:e.startColumn,l=Number.isNaN(e.endColumn)?s:e.endColumn,a=Number.isNaN(n.startRow)?0:n.startRow,h=Number.isNaN(n.endRow)?s:n.endRow,c=Number.isNaN(n.startColumn)?0:n.startColumn,u=Number.isNaN(n.endColumn)?s:n.endColumn,d=Math.abs(o+l-c-u),f=Math.abs(o-l)+Math.abs(c-u),m=Math.abs(r+i-a-h),p=Math.abs(r-i)+Math.abs(a-h);return d<=f&&m<=p}static getIntersects(e,n){const s=e.startRow,r=e.endRow,i=e.startColumn,o=e.endColumn,l=n.startRow,a=n.endRow,h=n.startColumn,c=n.endColumn;let u,d,f,m;if(l<=r)l>=s?d=l:d=s;else return null;if(a>=s)a>=r?m=r:m=a;else return null;if(h<=o)h>i?u=h:u=i;else return null;if(c>=i)c>=o?f=o:f=c;else return null;return{startRow:d,endRow:m,startColumn:u,endColumn:f,rangeType:rt.NORMAL}}static contains(e,n){return e.startRow<=n.startRow&&e.endRow>=n.endRow&&e.startColumn<=n.startColumn&&e.endColumn>=n.endColumn}static realContain(e,n){return ue.contains(e,n)&&(e.startRow<n.startRow||e.endRow>n.endRow||e.startColumn<n.startColumn||e.endColumn>n.endColumn)}static union(...e){return e.reduce((n,s)=>({startRow:Math.min(n.startRow,s.startRow),startColumn:Math.min(n.startColumn,s.startColumn),endRow:Math.max(n.endRow,s.endRow),endColumn:Math.max(n.endColumn,s.endColumn),rangeType:rt.NORMAL}),e[0])}static realUnion(...e){const n=e.some(i=>i.rangeType===rt.COLUMN),s=e.some(i=>i.rangeType===rt.ROW),r=ue.union(...e);return{startColumn:s?Number.NaN:r.startColumn,endColumn:s?Number.NaN:r.endColumn,startRow:n?Number.NaN:r.startRow,endRow:n?Number.NaN:r.endRow,rangeType:s?rt.ROW:n?rt.COLUMN:rt.NORMAL}}static subtract(e,n){if(n.startRow>e.endRow||n.endRow<e.startRow||n.startColumn>e.endColumn||n.endColumn<e.startColumn)return[e];const s=[];n.startRow>=e.startRow&&s.push({startRow:e.startRow,startColumn:e.startColumn,endRow:n.startRow-1,endColumn:e.endColumn}),n.endRow<=e.endRow&&s.push({startRow:n.endRow+1,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn});const r=Math.max(e.startRow,n.startRow),i=Math.min(e.endRow,n.endRow);return n.startColumn>=e.startColumn&&s.push({startRow:r,startColumn:e.startColumn,endRow:i,endColumn:n.startColumn-1}),n.endColumn<=e.endColumn&&s.push({startRow:r,startColumn:n.endColumn+1,endRow:i,endColumn:e.endColumn}),s.filter(l=>l.startRow<=l.endRow&&l.startColumn<=l.endColumn)}static hasIntersectionBetweenTwoRect(e,n){return!(e.left>n.right||e.right<n.left||e.top>n.bottom||e.bottom<n.top)}static getIntersectionBetweenTwoRect(e,n){const s=Math.max(e.left,n.left),r=Math.min(e.right,n.right),i=Math.max(e.top,n.top),o=Math.min(e.bottom,n.bottom);return r<=s||o<=i?null:{left:s,right:r,top:i,bottom:o,width:r-s,height:o-i}}};_(ue,"getRelativeRange",(e,n)=>({startRow:e.startRow-n.startRow,endRow:e.endRow-e.startRow,startColumn:e.startColumn-n.startColumn,endColumn:e.endColumn-e.startColumn})),_(ue,"getPositionRange",(e,n,s)=>({...s||{},startRow:s&&[bt.ROW,bt.ALL].includes(s.startAbsoluteRefType||0)?s.startRow:e.startRow+n.startRow,endRow:s&&[bt.ROW,bt.ALL].includes(s.endAbsoluteRefType||0)?s.endRow:e.endRow+e.startRow+n.startRow,startColumn:s&&[bt.COLUMN,bt.ALL].includes(s.startAbsoluteRefType||0)?s.startColumn:e.startColumn+n.startColumn,endColumn:s&&[bt.COLUMN,bt.ALL].includes(s.endAbsoluteRefType||0)?s.endColumn:e.endColumn+e.startColumn+n.startColumn})),_(ue,"moveHorizontal",(e,n=0,s=0)=>({...e,startColumn:e.startColumn+n,endColumn:e.endColumn+n+s})),_(ue,"moveVertical",(e,n=0,s=0)=>({...e,startRow:e.startRow+n,endRow:e.endRow+n+s})),_(ue,"moveOffset",(e,n,s)=>({...e,startRow:e.startRow+s,endRow:e.endRow+s,startColumn:e.startColumn+n,endColumn:e.endColumn+n}));let ge=ue;class Ll{constructor(e,n){_(this,"_values",[]);_(this,"_keys",[]);_(this,"_keyMaps",new Map);this._values=e,this._keys=n,e.forEach(s=>{this._initKeyMap(s)})}_initKeyMap(e){this._keys.forEach(n=>{const s=e[n],r=this._keyMaps.get(n)||new Map;r.set(s,e),this._keyMaps.set(n,r)})}getValue(e,n){const s=n||this._keys;for(let r=0;r<s.length;r++){const i=this._keyMaps.get(s[r]);if(i!=null&&i.has(e))return i.get(e)}return null}hasValue(e){for(let n=0;n<this._keys.length;n++){const s=this._keyMaps.get(this._keys[n]);if(s!=null&&s.has(e))return!0}return!1}addValue(e){this._values.push(e),this._initKeyMap(e)}setValue(e,n,s){const r=this.getValue(e);r&&Object.keys(r).includes(n)&&(r[n]=s)}deleteValue(e){const n=this.getValue(e);if(n){this._keys.forEach(r=>{const i=this._keyMaps.get(r),o=n[r];i==null||i.delete(o)});const s=this._values.findIndex(r=>r===n);this._values.splice(s,1)}}getValues(){return this._values}getKeyMap(e){var n;return[...((n=this._keyMaps.get(e))==null?void 0:n.keys())||[]]}clear(){this._values=[],this._keys=[],this._keyMaps.clear()}}function Jn(t,e,n,s){return{forEach(r){for(let i=t;i<=e;i++)for(let o=n;o<=s;o++)r(i,o)}}}function Dl(t){if(t==null||t.length===0)return Number.NaN;const e=t.toLowerCase().split(""),n=e.length,s=o=>o.charCodeAt(0)-96;let r=0,i=0;for(let o=0;o<n;o++)i=s(e[o]),r+=i*26**(n-o-1);return r===0?Number.NaN:r-1}const Cn=65,oi=90,yl=97;function Pl(t){const e=oi-Cn+1;let n="";for(;t>=0;)n=String.fromCharCode(t%e+Cn)+n,t=Math.floor(t/e)-1;return n}function li(t,e){let n="";for(;e>0;)n+=t,e--;return n}function xl(t,e=!1){const n=oi-Cn+1;let s=yl;e&&(s=Cn);const r=String.fromCharCode(t%n+s),i=Math.floor(t/n)+1;return li(r,i)}function kl(t,e){return t.zIndex>e.zIndex?1:t.zIndex===e.zIndex?0:-1}function Hl(t,e){return t.zIndex>e.zIndex?-1:t.zIndex===e.zIndex?0:1}function ke(t="index",e=1){return(n,s)=>n[t]>s[t]?e:n[t]===s[t]?0:-e}function Fl(t,e){let n;function s(...r){const i=this,o=function(){n=null,t.apply(i,r)};clearTimeout(n),n=setTimeout(o,e)}return Object.defineProperty(s,"cancel",{value:()=>{clearTimeout(n)},enumerable:!1,writable:!1}),s}function cn(t,e,n){const{dataStream:s,textRuns:r=[]}=t;let i=e;const o=[];for(const l of r){const{st:a,ed:h}=l;y.hasIntersectionBetweenTwoRanges(e,n,a,h)&&(a>i?(o.push(s.slice(i,a)),o.push(Zn(s,{...l,ed:Math.min(h,n)}))):o.push(Zn(s,{...l,st:i,ed:Math.min(h,n)}))),i=Math.max(e,Math.min(h,n))}return i!==n&&o.push(s.slice(i,n)),o.join("")}function Bl(t,e=!0){var n;if(e&&((n=t.paragraphs)!=null&&n.length)){const{dataStream:s,paragraphs:r=[]}=t;let i="",o=-1;for(const l of r){const{startIndex:a,paragraphStyle:h={}}=l,{spaceAbove:c,spaceBelow:u,lineSpacing:d}=h,f=[];c!=null&&(typeof c=="number"?f.push(`margin-top: ${c}px`):f.push(`margin-top: ${c.v}px`)),u!=null&&(typeof u=="number"?f.push(`margin-bottom: ${u}px`):f.push(`margin-bottom: ${u.v}px`)),d!=null&&f.push(`line-height: ${d}`),a>o+1?i+=`<p class="UniverNormal" ${f.length?`style="${f.join("; ")};"`:""}>${cn(t,o+1,a)}</p>`:i+=`<p class="UniverNormal" ${f.length?`style="${f.join("; ")};"`:""}></p>`,o=a}return o!==s.length&&(i+=cn(t,o,s.length)),i}else return cn(t,0,t.dataStream.length)}function Zn(t,e){const{st:n,ed:s,ts:r={}}=e,{ff:i,fs:o,it:l,bl:a,ul:h,st:c,ol:u,bg:d,cl:f,va:m}=r;let p=t.slice(n,s);const x=[];return l===q.TRUE&&(p=`<i>${p}</i>`),m===ye.SUPERSCRIPT?p=`<sup>${p}</sup>`:m===ye.SUBSCRIPT&&(p=`<sub>${p}</sub>`),(h==null?void 0:h.s)===q.TRUE&&(p=`<u>${p}</u>`),(c==null?void 0:c.s)===q.TRUE&&(p=`<s>${p}</s>`),a===q.TRUE&&(p=`<strong>${p}</strong>`),i&&x.push(`font-family: ${i}`),f&&x.push(`color: ${f.rgb}`),o&&x.push(`font-size: ${o}pt`),u&&x.push("text-decoration: overline"),d&&x.push(`background: ${d.rgb}`),x.length?`<span style="${x.join("; ")};">${p}</span>`:p}const Wl={sheetId:"",range:{startRow:-1,endRow:-1,startColumn:-1,endColumn:-1}},$l={startRow:-1,startColumn:-1,endRow:-1,endColumn:-1},Gl={startRow:0,startColumn:0,endRow:0,endColumn:0},jl={row:0,column:0},hn={ff:"Arial",fs:11,it:q.FALSE,bl:q.FALSE,ul:{s:q.FALSE},st:{s:q.FALSE},ol:{s:q.FALSE},tr:{a:0,v:q.FALSE},td:ze.UNSPECIFIED,cl:{rgb:"#000"},bg:{rgb:"#fff"},ht:Se.UNSPECIFIED,vt:De.UNSPECIFIED,tb:Xe.UNSPECIFIED,pd:{t:0,r:0,b:0,l:0}},ai={id:"default_slide",title:"defaultSlide",pageSize:{width:300,height:300}};var ui=(t=>(t.ARRAY_CONVERTOR="ARRAY_CONVERTOR",t.MATRIX_CONVERTOR="MATRIX_CONVERTOR",t))(ui||{});function ln(t,e){const{textRuns:n=[]}=e;let s=0;for(const i of n){const{ts:o={},st:l,ed:a}=i;if(o[t]==null)return q.FALSE;switch(t){case"bl":case"it":{if(o[t]===q.FALSE)return q.FALSE;break}case"ul":case"st":{if(o[t].s===q.FALSE)return q.FALSE;break}default:throw new Error(`unknown style key: ${t} in IStyleBase`)}s+=a-l}return e.dataStream.indexOf(`\r
|
|
4
|
+
`)===s?q.TRUE:q.FALSE}const Ke=class Ke{constructor(e,n,s){_(this,"_range");_(this,"_worksheet");this._deps=s,this._range=n,this._worksheet=e}static foreach(e,n){const{startRow:s,startColumn:r,endRow:i,endColumn:o}=e;for(let l=s;l<=i;l++)for(let a=r;a<=o;a++)n(l,a)}getRangeData(){return this._range}getValue(){return this.getValues()[0][0]}getValues(){const{startRow:e,endRow:n,startColumn:s,endColumn:r}=this._range,i=[];for(let o=e;o<=n;o++){const l=[];for(let a=s;a<=r;a++)l.push(this.getMatrix().getValue(o,a)||null);i.push(l)}return i}getMatrix(){const{startRow:e,endRow:n,startColumn:s,endColumn:r}=this._range,i=this._worksheet.getCellMatrix(),o=new ee;for(let l=e;l<=n;l++)for(let a=s;a<=r;a++)o.setValue(l,a,i.getValue(l,a)||null);return o}getMatrixObject(){const{startRow:e,endRow:n,startColumn:s,endColumn:r}=this._range,i=this._worksheet.getCellMatrix(),o=new ee;for(let l=e;l<=n;l++)for(let a=s;a<=r;a++)o.setValue(l-e,a-s,i.getValue(l,a)||{});return o}getA1Notation(){const{startRow:e,endRow:n,startColumn:s,endColumn:r}=this._range;let i,o;return s<r?(i=y.numToWord(s+1)+(e+1),o=y.numToWord(r+1)+(n+1)):(i=y.numToWord(r+1)+(n+1),o=y.numToWord(s+1)+(e+1)),i===o?`${i}`:`${i}:${o}`}getBackground(){return this.getBackgrounds()[0][0]}getBackgrounds(){const e=this._deps.getStyles();return this.getValues().map(n=>n.map(s=>{var i;const r=e.getStyleByCell(s);return((i=r==null?void 0:r.bg)==null?void 0:i.rgb)||hn.bg.rgb}))}getCell(e,n){const{startRow:s,endRow:r,startColumn:i,endColumn:o}=this._range,l={startRow:s+e,endRow:s+e,startColumn:i+n,endColumn:i+n};return new Ke(this._worksheet,l,this._deps)}getColumn(){return this._range.startColumn}getObjectValue(e={}){return this.getObjectValues(e)[0][0]}getObjectValues(e={}){var l;const{startRow:n,endRow:s,startColumn:r,endColumn:i}=this._range,o=this._worksheet.getCellMatrix().getFragment(n,s,r,i).getData();if(e.isIncludeStyle){const a=this._deps.getStyles();for(let h=0;h<=s-n;h++)for(let c=0;c<=i-r;c++){if(o==null||((l=o==null?void 0:o[h])==null?void 0:l[c])==null)continue;const u=o[h][c].s;u&&(o[h][c].s=a.get(u))}}return o}getFontColor(){return this.getFontColors()[0][0]}getFontColors(){const e=this._deps.getStyles();return this.getValues().map(n=>n.map(s=>{var i;const r=e.getStyleByCell(s);return((i=r==null?void 0:r.cl)==null?void 0:i.rgb)||hn.cl.rgb}))}getFontFamilies(){return this._getStyles("ff")}getFontFamily(){return this.getFontFamilies()[0][0]}getUnderlines(){return this._getStyles("ul")}getUnderline(){var n,s;const{p:e}=(n=this.getValue())!=null?n:{};return e&&Array.isArray((s=e.body)==null?void 0:s.textRuns)&&e.body.textRuns.length>0?ln("ul",e.body)===q.TRUE?{s:q.TRUE}:{s:q.FALSE}:this.getUnderlines()[0][0]}getOverlines(){return this._getStyles("ol")}getOverline(){return this.getOverlines()[0][0]}getStrikeThrough(){var n,s;const{p:e}=(n=this.getValue())!=null?n:{};return e&&Array.isArray((s=e.body)==null?void 0:s.textRuns)&&e.body.textRuns.length>0?ln("st",e.body)===q.TRUE?{s:q.TRUE}:{s:q.FALSE}:this.getStrikeThroughs()[0][0]}getStrikeThroughs(){return this._getStyles("st")}getFontSize(){var n,s;const e=((n=this.getValue())==null?void 0:n.p)||{};return e&&Array.isArray((s=e.body)==null?void 0:s.textRuns)&&e.body.textRuns.length>0?e.body.textRuns.some(r=>{var i;return((i=r==null?void 0:r.ts)==null?void 0:i.fs)!=null})?Math.max(...e.body.textRuns.map(r=>{var i;return((i=r==null?void 0:r.ts)==null?void 0:i.fs)||0})):this.getFontSizes()[0][0]:this.getFontSizes()[0][0]}getFontSizes(){return this._getStyles("fs")}getBorder(){return this.getBorders()[0][0]}getBorders(){return this._getStyles("bd")}getFontStyle(){var n,s;const{p:e}=(n=this.getValue())!=null?n:{};return e&&Array.isArray((s=e.body)==null?void 0:s.textRuns)&&e.body.textRuns.length>0?ln("it",e.body)===q.TRUE?mn.ITALIC:mn.NORMAL:this._getFontStyles()[0][0]}_getFontStyles(){return this._getStyles("it")}getFontWeight(){var n,s;const{p:e}=(n=this.getValue())!=null?n:{};return e&&Array.isArray((s=e.body)==null?void 0:s.textRuns)&&e.body.textRuns.length>0?ln("bl",e.body)===q.TRUE?pn.BOLD:pn.NORMAL:this._getFontWeights()[0][0]}_getFontWeights(){return this._getStyles("bl")}getGridId(){return this._worksheet.getSheetId()}getHeight(){const{_range:e,_worksheet:n}=this,{startRow:s,endRow:r}=e;let i=0;for(let o=0;o<=r-s;o++){const l=n.getRowHeight(o);i+=l}return i}getHorizontalAlignment(){return this.getHorizontalAlignments()[0][0]}getHorizontalAlignments(){return this._getStyles("ht")}getLastColumn(){return this._range.endColumn}getLastRow(){return this._range.endRow}getNumColumns(){const{startColumn:e,endColumn:n}=this._range;return n-e+1}getNumRows(){const{startRow:e,endRow:n}=this._range;return n-e+1}getRichTextValue(){return this.getRichTextValues()[0][0]}getRichTextValues(){return this.getValues().map(e=>e.map(n=>(n==null?void 0:n.p)||""))}getRowIndex(){return this._range.startRow}getSheet(){return this._worksheet}getTextDirection(){return this.getTextDirections()[0][0]}getTextDirections(){return this._getStyles("td")}getTextRotation(){return this.getTextRotations()[0][0]}getTextRotations(){return this._getStyles("tr")}getTextStyle(){return this.getTextStyles()[0][0]}getTextStyles(){const e=this._deps.getStyles();return this.getValues().map(n=>n.map(s=>e.getStyleByCell(s)))}getVerticalAlignment(){return this.getVerticalAlignments()[0][0]}getVerticalAlignments(){return this._getStyles("vt")}getWidth(){const{_range:e,_worksheet:n}=this,{startColumn:s,endColumn:r}=e;let i=0;for(let o=0;o<=r-s;o++)i+=n.getColumnWidth(o);return i}getWrap(){return this.getWraps()[0][0]}getWraps(){return this._getStyles("tb")}getWrapStrategies(){return this._getStyles("tb")}getWrapStrategy(){return this.getWrapStrategies()[0][0]}forEach(e){Ke.foreach(this._range,e)}_getStyles(e){const n=this._deps.getStyles();return this.getValues().map(s=>s.map(r=>{const i=n&&n.getStyleByCell(r);return i&&i[e]||hn[e]}))}};_(Ke,"transformRange",(e,n)=>e.rangeType===rt.ALL?{startColumn:0,startRow:0,endColumn:n.getMaxColumns()-1,endRow:n.getMaxRows()-1}:e.rangeType===rt.COLUMN?{startRow:0,endRow:n.getMaxRows()-1,startColumn:e.startColumn,endColumn:e.endColumn}:e.rangeType===rt.ROW?{startColumn:0,endColumn:n.getMaxColumns()-1,startRow:e.startRow,endRow:e.endRow}:e);let Pe=Ke;function Vl(t,e){if(t.length===0||t[0].length===0)return null;const n=new Array(t[0].length).fill(0);let s=0,r=null;for(let i=0;i<t.length;i++){for(let l=0;l<t[0].length;l++)n[l]=e(t[i][l])?n[l]+1:0;const o=Kl(n);o.area>s&&(s=o.area,r={startColumn:o.start,startRow:i-o.height+1,endColumn:o.end,endRow:i})}return r}function Kl(t){const e=[];let n=0,s={area:0,height:0,start:0,end:0},r=0;for(;r<t.length;)if(e.length===0||t[r]>=t[e[e.length-1]])e.push(r++);else{const i=t[e.pop()],o=e.length===0?r:r-e[e.length-1]-1;i*o>n&&(n=i*o,s={area:n,height:i,start:e.length===0?0:e[e.length-1]+1,end:r-1})}for(;e.length>0;){const i=t[e.pop()],o=e.length===0?r:r-e[e.length-1]-1;i*o>n&&(n=i*o,s={area:n,height:i,start:e.length===0?0:e[e.length-1]+1,end:r-1})}return s}function Yl(t,e){Pe.foreach(e,(n,s)=>{t[n][s]=void 0})}function zl(t,e){const n=t.toFullArray(),s=[];for(;;){const r=Vl(n,e);if(!r)break;s.push(r),Yl(n,r)}return s}function Xl(t,e,n,s=!1){let r={...t};const i=r.startAbsoluteRefType||bt.NONE,o=r.endAbsoluteRefType||bt.NONE;return!s&&i===bt.ALL&&o===bt.ALL?r:s||i===bt.NONE&&o===bt.NONE?ge.moveOffset(r,e,n):(i===bt.NONE?r={...r,startRow:r.startRow+n,startColumn:r.startColumn+e}:i===bt.COLUMN?r={...r,startRow:r.startRow+n}:i===bt.ROW&&(r={...r,startColumn:r.startColumn+e}),o===bt.NONE?r={...r,endRow:r.endRow+n,endColumn:r.endColumn+e}:o===bt.COLUMN?r={...r,endRow:r.endRow+n}:o===bt.ROW&&(r={...r,endColumn:r.endColumn+e}),r)}async function ci(t){for(const[e,n]of t.entries())try{if(!await n())return{index:e,result:!1}}catch(s){return{index:e,result:!1,error:s}}return{result:!0,index:-1}}function hi(t){for(const[e,n]of t.entries())try{if(!n())return{index:e,result:!1}}catch(s){return{index:e,result:!1,error:s}}return{result:!0,index:-1}}const Ze=ut.createIdentifier("univer.context-service");class di extends yt{constructor(){super(...arguments);_(this,"_contextChanged$",new it.Subject);_(this,"contextChanged$",this._contextChanged$.asObservable());_(this,"_contextMap",new Map)}dispose(){super.dispose(),this._contextChanged$.complete()}getContextValue(n){var s;return(s=this._contextMap.get(n))!=null?s:!1}setContextValue(n,s){this._contextMap.set(n,s),this._contextChanged$.next({[n]:s})}subscribeContextValue$(n){return new it.Observable(s=>{const r=this._contextChanged$.pipe(it.filter(i=>typeof i[n]<"u")).subscribe(i=>s.next(i[n]));return this._contextMap.has(n)&&s.next(this._contextMap.get(n)),()=>r.unsubscribe()})}}var fi=(t=>(t[t.SILENT=0]="SILENT",t[t.ERROR=1]="ERROR",t[t.WARN=2]="WARN",t[t.INFO=3]="INFO",t[t.VERBOSE=4]="VERBOSE",t))(fi||{});const pe=ut.createIdentifier("univer.log");class _i extends yt{constructor(){super(...arguments);_(this,"_logLevel",3)}debug(...n){this._logLevel>=4&&this._log(console.debug,...n)}log(...n){this._logLevel>=3&&this._log(console.log,...n)}warn(...n){this._logLevel>=2&&this._log(console.warn,...n)}error(...n){this._logLevel>=1&&this._log(console.error,...n)}setLogLevel(n){this._logLevel=n}_log(n,...s){const r=s[0];/^\[(.*?)\]/g.test(r)?n(`\x1B[97;104m${r}\x1B[0m`,...s.slice(1)):n(...s)}}var ql=Object.defineProperty,Jl=Object.getOwnPropertyDescriptor,Zl=(t,e,n,s)=>{for(var r=s>1?void 0:s?Jl(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(s?o(e,n,r):o(r))||r);return s&&r&&ql(e,n,r),r},Fs=(t,e)=>(n,s)=>e(n,s,t),Qe=(t=>(t[t.COMMAND=0]="COMMAND",t[t.OPERATION=1]="OPERATION",t[t.MUTATION=2]="MUTATION",t))(Qe||{});const tn=ut.createIdentifier("anywhere.command-service");class Ql{constructor(){_(this,"_commands",new Map);_(this,"_commandTypes",new Map)}registerCommand(e){if(this._commands.has(e.id))throw new Error(`[CommandRegistry]: command "${e.id}" has been registered before.`);return this._commands.set(e.id,e),this._commandTypes.set(e.id,e.type),vt(()=>{var n;this._commands.delete(e.id),this._commandTypes.delete(e.id),(n=e.onDispose)==null||n.call(e)})}hasCommand(e){return this._commands.has(e)}getCommand(e){return this._commands.has(e)?[this._commands.get(e)]:null}getCommandType(e){return this._commandTypes.get(e)}}const gi={id:"nil",type:0,handler:()=>!0};exports.CommandService=class{constructor(e,n){_(this,"_commandRegistry");_(this,"_beforeCommandExecutionListeners",[]);_(this,"_commandExecutedListeners",[]);_(this,"_multiCommandDisposables",new Map);_(this,"_commandExecutingLevel",0);_(this,"_commandExecutionStack",[]);this._injector=e,this._logService=n,this._commandRegistry=new Ql,this._registerCommand(gi)}hasCommand(e){return this._commandRegistry.hasCommand(e)}registerCommand(e){return this._registerCommand(e)}registerMultipleCommand(e){return this._registerMultiCommand(e)}beforeCommandExecuted(e){if(this._beforeCommandExecutionListeners.indexOf(e)===-1)return this._beforeCommandExecutionListeners.push(e),vt(()=>{const n=this._beforeCommandExecutionListeners.indexOf(e);this._beforeCommandExecutionListeners.splice(n,1)});throw new Error("[CommandService]: could not add a listener twice.")}onCommandExecuted(e){if(this._commandExecutedListeners.indexOf(e)===-1)return this._commandExecutedListeners.push(e),vt(()=>{const n=this._commandExecutedListeners.indexOf(e);this._commandExecutedListeners.splice(n,1)});throw new Error("[CommandService]: could not add a listener twice.")}async executeCommand(e,n,s){const r=this._commandRegistry.getCommand(e);if(r){const[i]=r,o={id:i.id,type:i.type,params:n},l=this._pushCommandExecutionStack(o);this._beforeCommandExecutionListeners.forEach(h=>h(o,s));const a=await this._execute(i,n,s);return this._commandExecutedListeners.forEach(h=>h(o,s)),l.dispose(),a}throw new Error(`[CommandService]: command "${e}" is not registered.`)}syncExecuteCommand(e,n,s){var i;const r=this._commandRegistry.getCommand(e);if(r){const[o]=r,l={id:o.id,type:o.type,params:n};if(o.type===2){const c=bl(this._commandExecutionStack,u=>u.type===0);c&&(l.params=(i=l.params)!=null?i:{},l.params.trigger=c.id)}const a=this._pushCommandExecutionStack(l);this._beforeCommandExecutionListeners.forEach(c=>c(l,s));const h=this._syncExecute(o,n,s);return this._commandExecutedListeners.forEach(c=>c(l,s)),a.dispose(),h}throw new Error(`[CommandService]: command "${e}" is not registered.`)}_pushCommandExecutionStack(e){return this._commandExecutionStack.push(e),vt(()=>Tn(this._commandExecutionStack,e))}_registerCommand(e){return this._commandRegistry.registerCommand(e)}_registerMultiCommand(e){const n=this._commandRegistry.getCommand(e.id);let s;if(n){if(n[0].multi!==!0)throw new Error("Command has registered as a single command.");s=n[0]}else{const i=new cs;s=new ta(e.id),i.add(this._commandRegistry.registerCommand(s)),i.add(vt(()=>{this._multiCommandDisposables.delete(e.id)})),this._multiCommandDisposables.set(e.id,i)}const r=s.registerImplementation(e);return vt(()=>{var i;r.dispose(),s.hasImplementations()||(i=this._multiCommandDisposables.get(e.id))==null||i.dispose()})}async _execute(e,n,s){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(this._commandExecutingLevel,0))}executing command "${e.id}"`),this._commandExecutingLevel++;let r;try{r=await this._injector.invoke(e.handler,n,s),this._commandExecutingLevel--}catch(i){throw r=!1,this._commandExecutingLevel=0,i}return r}_syncExecute(e,n,s){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(0,this._commandExecutingLevel))}executing command "${e.id}".`),this._commandExecutingLevel++;let r;try{if(r=this._injector.invoke(e.handler,n,s),r instanceof Promise)throw new TypeError("[CommandService]: Command handler should not return a promise.");this._commandExecutingLevel--}catch(i){throw r=!1,this._commandExecutingLevel=0,i}return r}};exports.CommandService=Zl([Fs(0,ut.Inject(ut.Injector)),Fs(1,pe)],exports.CommandService);class ta{constructor(e){_(this,"name");_(this,"multi",!0);_(this,"type",0);_(this,"priority",0);_(this,"_implementations",[]);_(this,"handler",async(e,n)=>{if(!this._implementations.length)return!1;const s=e.get(pe),r=e.get(Ze),i=e.get(ut.Injector);for(const o of this._implementations){const l=o.command.preconditions;if((!l||l&&l(r))&&(s.debug("[MultiCommand]",`executing implementation "${o.command.name}".`),await i.invoke(o.command.handler,n)))return!0}return!1});this.id=e,this.name=e}registerImplementation(e){const n={command:e};return this._implementations.push(n),this._implementations.sort((s,r)=>r.command.priority-s.command.priority),vt(()=>{var r;const s=this._implementations.indexOf(n);this._implementations.splice(s,1),(r=e.onDispose)==null||r.call(e)})}hasImplementations(){return this._implementations.length>0}}function hs(t,e,n){const s=t.map(r=>()=>e.syncExecuteCommand(r.id,r.params,n));return hi(s)}function ea(t,e,n){const s=t.map(r=>()=>e.executeCommand(r.id,r.params,n));return ci(s)}function mi(t){return new it.Observable(e=>{const n=t((...s)=>e.next(s));return()=>n==null?void 0:n.dispose()})}const na=t=>new Promise(e=>{it.merge(mi(t.onCommandExecuted).pipe(un.filter(([n])=>n.type===Qe.MUTATION)),it.timer(300)).pipe(un.debounceTime(16),un.first()).subscribe(()=>{e()})});var Xt=(t=>(t[t.UNDEFINED=0]="UNDEFINED",t[t.OK=1]="OK",t[t.INTERNAL_ERROR=2]="INTERNAL_ERROR",t[t.PERMISSION_DENIED=3]="PERMISSION_DENIED",t[t.NOT_FOUND=4]="NOT_FOUND",t[t.UNAUTHENTICATED=5]="UNAUTHENTICATED",t[t.ALREADY_EXISTS=6]="ALREADY_EXISTS",t[t.INVALID_ARGUMENT=7]="INVALID_ARGUMENT",t[t.TOO_MANY_REQUESTS=8]="TOO_MANY_REQUESTS",t[t.COMPLETION_FINISHED=9]="COMPLETION_FINISHED",t[t.CHANGESET_REVISION_CONFILICT=5001]="CHANGESET_REVISION_CONFILICT",t[t.SNAPSHOT_INVALID_SNAPSHOT=6001]="SNAPSHOT_INVALID_SNAPSHOT",t[t.SNAPSHOT_HAS_BEEN_REMOVED=6002]="SNAPSHOT_HAS_BEEN_REMOVED",t[t.APPLY_REJECT=7001]="APPLY_REJECT",t[t.APPLY_NON_SEQUENTIAL_REVISION=7002]="APPLY_NON_SEQUENTIAL_REVISION",t[t.APPLY_REVISION_CONFILICT=7003]="APPLY_REVISION_CONFILICT",t[t.APPLY_PERMISSION_DENIED=7004]="APPLY_PERMISSION_DENIED",t[t.CONNECTOR_DATA_TOO_LARGE=8001]="CONNECTOR_DATA_TOO_LARGE",t[t.LICENSE_MAX_UNITS_EXCEEDED=9001]="LICENSE_MAX_UNITS_EXCEEDED",t[t.LICENSE_MAX_MEMBERS_PER_UNIT_EXCEEDED=9002]="LICENSE_MAX_MEMBERS_PER_UNIT_EXCEEDED",t[t.LICENSE_IMPORT_SIZE_EXCEEDED=9003]="LICENSE_IMPORT_SIZE_EXCEEDED",t[t.LICENSE_EXPORT_SIZE_EXCEEDED=9004]="LICENSE_EXPORT_SIZE_EXCEEDED",t[t.LICENSE_DISTRO_REJECTED=9005]="LICENSE_DISTRO_REJECTED",t[t.YUUMI_UNABLE_LOAD_URL=10001]="YUUMI_UNABLE_LOAD_URL",t[t.YUUMI_URL_COL_OUT_OF_RANGE=10002]="YUUMI_URL_COL_OUT_OF_RANGE",t[t.UNRECOGNIZED=-1]="UNRECOGNIZED",t))(Xt||{});function pi(t){return!!(t&&t.code&&t.code!==Xt.OK&&t.code!=="OK")}var et=(t=>(t[t.UNIVER_UNKNOWN=0]="UNIVER_UNKNOWN",t[t.UNIVER_DOC=1]="UNIVER_DOC",t[t.UNIVER_SHEET=2]="UNIVER_SHEET",t[t.UNIVER_SLIDE=3]="UNIVER_SLIDE",t[t.UNRECOGNIZED=-1]="UNRECOGNIZED",t))(et||{}),Ft=(t=>(t[t.Reader=0]="Reader",t[t.Editor=1]="Editor",t[t.Owner=2]="Owner",t[t.UNRECOGNIZED=-1]="UNRECOGNIZED",t))(Ft||{}),dn=(t=>(t[t.Unkonwn=0]="Unkonwn",t[t.Workbook=1]="Workbook",t[t.Worksheet=2]="Worksheet",t[t.SelectRange=3]="SelectRange",t[t.Document=4]="Document",t[t.Slide=5]="Slide",t[t.UNRECOGNIZED=-1]="UNRECOGNIZED",t))(dn||{});class Mn extends yt{}class ds{constructor(){_(this,"_data",[])}static create(){return new ds}add(e){this._data.indexOf(e)>-1||this._data.push(e)}delete(e){const n=this._data.indexOf(e);this._data.splice(n,1)}getData(){return this._data}}class fs{constructor(){_(this,"_data",new Map)}static create(){return new fs}add(e,n){this._data.has(e)||this._data.set(e,n)}delete(e){this._data.delete(e)}getData(){return this._data}}var In=(t=>(t.BULLET_LIST="BULLET_LIST",t.ORDER_LIST="ORDER_LIST",t))(In||{});const sa={BULLET_LIST:{listType:"BULLET_LIST",nestingLevel:[{bulletAlignment:de.START,glyphFormat:" %0",textStyle:{fs:12},startNumber:0,glyphSymbol:"●",hanging:21,indentStart:21},{bulletAlignment:de.START,glyphFormat:" %1",textStyle:{fs:12},startNumber:0,glyphSymbol:"■",hanging:21,indentStart:42},{bulletAlignment:de.START,glyphFormat:" %1",textStyle:{fs:12},startNumber:0,glyphSymbol:"◆",hanging:21,indentStart:63}]},ORDER_LIST:{listType:"ORDER_LIST",nestingLevel:[{bulletAlignment:de.START,glyphFormat:" %1.",textStyle:{fs:12},startNumber:0,glyphType:$e.DECIMAL,hanging:21,indentStart:21},{bulletAlignment:de.START,glyphFormat:" %1.%2)",textStyle:{fs:12},startNumber:0,glyphType:$e.DECIMAL,hanging:21,indentStart:42},{bulletAlignment:de.START,glyphFormat:" %1.%2.%3.",textStyle:{fs:12},startNumber:0,glyphType:$e.DECIMAL,hanging:21,indentStart:63}]}};var Ei=(t=>(t[t.PARAGRAPH=0]="PARAGRAPH",t[t.SECTION_BREAK=1]="SECTION_BREAK",t[t.TABLE=2]="TABLE",t[t.TABLE_ROW=3]="TABLE_ROW",t[t.TABLE_CELL=4]="TABLE_CELL",t[t.CUSTOM_BLOCK=5]="CUSTOM_BLOCK",t))(Ei||{}),_s=(t=>(t.PARAGRAPH="\r",t.SECTION_BREAK=`
|
|
5
|
+
`,t.TABLE_START="",t.TABLE_ROW_START="\x1B",t.TABLE_CELL_START="",t.TABLE_CELL_END="",t.TABLE_ROW_END="",t.TABLE_END="",t.CUSTOM_RANGE_START="",t.CUSTOM_RANGE_END="",t.COLUMN_BREAK="\v",t.PAGE_BREAK="\f",t.DOCS_END="\0",t.TAB=" ",t.CUSTOM_BLOCK="\b",t.LETTER="",t.SPACE=" ",t))(_s||{});function gs(t){const e=[];for(const n of t){const{ed:s,ts:r}=n;if(n.sId===void 0&&delete n.sId,y.isEmptyObject(r)&&n.sId==null)continue;if(e.length===0){e.push(n);continue}const i=e.pop();Xr(n,i)&&y.hasIntersectionBetweenTwoRanges(i.st,i.ed,n.st,n.ed)?e.push({...n,st:i.st,ed:s}):e.push(i,n)}return e}function Ri(t,e,n,s){var h;const{textRuns:r}=t;if(r==null)return;const i=[],o=r.length;let l=!1;const a=(h=e.textRuns)!=null?h:[];if(a.length)for(const c of a)c.st+=s,c.ed+=s;for(let c=0;c<o;c++){const u=r[c],d=r[c+1],{st:f,ed:m}=u;if(m<s)i.push(u);else if(s>=f&&s<=m){if(d&&d.st===d.ed&&s===d.st){i.push(u);continue}if(l)u.st+=n,u.ed+=n,i.push(u);else{l=!0,u.ed+=n;const p=[];if(a.length){const x={...u,st:f,ed:a[0].st};x.ed>x.st&&p.push(x),p.push(...a);const P=a[a.length-1],Z={...u,st:P.ed,ed:m+n};Z.ed>Z.st&&p.push(Z)}else p.push(u);i.push(...p)}}else u.st+=n,u.ed+=n,l||(l=!0,i.push(...a)),i.push(u)}l||(l=!0,i.push(...a)),t.textRuns=gs(i)}function ms(t,e,n,s){const{paragraphs:r}=t;if(r==null)return;const{paragraphs:i,dataStream:o}=e,l=[];let a=-1;for(let c=0,u=r.length;c<u;c++){const d=r[c],{startIndex:f}=d;f>=s&&(d.startIndex+=n),a===-1&&f>=s&&(a=c),l.push(d.startIndex)}let h=-1;if(i){for(let c=0,u=i.length;c<u;c++){const d=i[c];d.startIndex+=s;const f=d.startIndex;h=l.indexOf(f)}if(o===_s.PARAGRAPH&&i.length===1){const c=r[a],u=i[0],d=c.paragraphStyle,f=c.bullet;c.paragraphStyle=u.paragraphStyle,c.bullet=u.bullet,u.paragraphStyle=d,u.bullet=f}h!==-1&&r.splice(h,1),r.push(...i),r.sort(ke("startIndex"))}}function ra(t,e,n,s){const{sectionBreaks:r}=t;if(r==null)return;for(let o=0,l=r.length;o<l;o++){const a=r[o],{startIndex:h}=a;h>=s&&(a.startIndex+=n)}const i=e.sectionBreaks;if(i){for(let o=0,l=i.length;o<l;o++){const a=i[o];a.startIndex+=s}r.push(...i),r.sort(ke("startIndex"))}}function Ci(t,e,n,s){const{customBlocks:r}=t;if(r==null)return;for(let o=0,l=r.length;o<l;o++){const a=r[o],{startIndex:h}=a;h>=s&&(a.startIndex+=n)}const i=e.customBlocks;if(i){for(let o=0,l=i.length;o<l;o++){const a=i[o];a.startIndex+=s}r.push(...i),r.sort(ke("startIndex"))}}function ps(t,e,n,s){const{tables:r}=t;if(r==null)return;for(let o=0,l=r.length;o<l;o++){const a=r[o],{startIndex:h,endIndex:c}=a;h>s?(a.startIndex+=n,a.endIndex+=n):c>=s-1&&(a.endIndex+=n)}const i=e.tables;if(i){for(let o=0,l=i.length;o<l;o++){const a=i[o];a.startIndex+=s,a.endIndex+=s}r.push(...i),r.sort(ke("startIndex"))}}function ia(t,e,n,s){const{customRanges:r}=t;if(r==null)return;for(let o=0,l=r.length;o<l;o++){const a=r[o],{startIndex:h,endIndex:c}=a;h>s?(a.startIndex+=n,a.endIndex+=n):c>=s-1&&(a.endIndex+=n)}const i=e.customRanges;if(i){for(let o=0,l=i.length;o<l;o++){const a=i[o];a.startIndex+=s,a.endIndex+=s}r.push(...i),r.sort(ke("startIndex"))}}function Ii(t,e,n){var l;const{textRuns:s}=t,r=n,i=n+e,o=[];if(r===i&&(s!=null&&s.find(a=>a.st===n&&a.ed===n))){const a=s.find(h=>h.st===n&&h.ed===n);return o.push({...a,st:a.st-n,ed:a.ed-n}),t.textRuns=(l=t.textRuns)==null?void 0:l.filter(h=>h!==a),o}if(s){const a=[];for(let h=0,c=s.length;h<c;h++){const u=s[h],{st:d,ed:f}=u;if(r<=d&&i>=f){o.push({...u,st:d-r,ed:f-r});continue}else d<=r&&f>=i?(o.push({...u,st:r-r,ed:i-r}),u.ed-=e):r>=d&&r<f?(o.push({...u,st:r-r,ed:f-r}),u.ed=r):i>d&&i<=f?(o.push({...u,st:d-r,ed:i-r}),u.st=i-e,u.ed-=e):d>=i&&(u.st-=e,u.ed-=e);a.push(u)}t.textRuns=a}return o.length===0&&o.push({st:0,ed:e,ts:{}}),o}function Oi(t,e,n){const{paragraphs:s}=t,r=n,i=n+e,o=[];if(s){const l=[];for(let a=0,h=s.length;a<h;a++){const c=s[a],{startIndex:u}=c;if(u>=r&&u<i){o.push({...c,startIndex:u-n});continue}else u>=i&&(c.startIndex-=e);l.push(c)}t.paragraphs=l}return o}function Si(t,e,n){const{sectionBreaks:s}=t,r=n,i=n+e-1,o=[];if(s){const l=[];for(let a=0,h=s.length;a<h;a++){const c=s[a],{startIndex:u}=c;if(u>=r&&u<=i){o.push({...c,startIndex:u-n});continue}else u>i&&(c.startIndex-=e);l.push(c)}t.sectionBreaks=l}return o}function Ni(t,e,n){const{customBlocks:s}=t,r=n,i=n+e-1,o=[];if(s){const l=[];for(let a=0,h=s.length;a<h;a++){const c=s[a],{startIndex:u}=c;if(u>=r&&u<=i){o.push({...c,startIndex:u-n});continue}else u>i&&(c.startIndex-=e);l.push(c)}t.customBlocks=l}return o}function bi(t,e,n){const{tables:s}=t,r=n,i=n+e-1,o=[];if(s){const l=[];for(let a=0,h=s.length;a<h;a++){const c=s[a],{startIndex:u,endIndex:d}=c;if(r<=u&&i>=d){o.push({...c,startIndex:u-n,endIndex:d-n});continue}else if(u<=r&&d>=i){const f=us(u,d,r,i);c.startIndex=f[0],c.endIndex=f[1]}else i<u&&(c.startIndex-=e,c.endIndex-=e);l.push(c)}t.tables=l}return o}function vi(t,e,n){const{customRanges:s}=t,r=n,i=n+e-1,o=[];if(s){const l=[];for(let a=0,h=s.length;a<h;a++){const c=s[a],{startIndex:u,endIndex:d}=c;if(r<=u&&i>=d){o.push({...c,startIndex:u-n,endIndex:d-n});continue}else if(u<=r&&d>=i){const f=us(u,d,r,i);c.startIndex=f[0],c.endIndex=f[1]}else i<u&&(c.startIndex-=e,c.endIndex-=e);l.push(c)}t.customRanges=l}return o}function oa(t,e,n,s,r){const i=la(t,e,n,s,r),o=aa(t,e,n,s,r),l=ua(t,e,n,s,r),a=ca(t,e,n,s,r),h=ha(t,e,n,s,r),c=da(t,e,n,s,r);return{dataStream:"",textRuns:i,paragraphs:o,sectionBreaks:l,customBlocks:a,tables:h,customRanges:c}}function la(t,e,n,s,r){const{textRuns:i}=t,{textRuns:o}=e;if(i==null||o==null)return;const l=Ii(t,n,s);if(r!==xt.REPLACE){const a=Ai(o,l,r);e.textRuns=a}return Ri(t,e,n,s),l}function Ai(t,e,n){if(e.length===0)return t;t=y.deepClone(t),e=y.deepClone(e);const s=[],r=t.length,i=e.length;let o=0,l=0,a=null;function h(){return a?(s.push(a),a=null,!0):!1}for(;o<r&&l<i;){const{st:f,ed:m,ts:p}=t[o],{st:x,ed:P,ts:Z,sId:gt}=e[l];let ht;if(n===xt.COVER?ht={...Z,...p}:ht={...p,...Z},m<x)h()||s.push(t[o]),o++;else if(P<f)h()||s.push(e[l]),l++;else{const E={st:Math.min(f,x),ed:Math.max(f,x),ts:f<x?{...p}:{...Z},sId:f<x?void 0:gt};E.ed>E.st&&s.push(E),s.push({st:Math.max(f,x),ed:Math.min(m,P),ts:ht,sId:gt}),m<P?(o++,e[l].st=m,e[l].st===e[l].ed&&l++):(l++,t[o].st=P,t[o].st===t[o].ed&&o++);const O={st:Math.min(m,P),ed:Math.max(m,P),ts:m<P?{...Z}:{...p},sId:m<P?gt:void 0};a=O.ed>O.st?O:null}}h();const c=s[s.length-1],u=t[r-1],d=e[i-1];return c.ed!==Math.max(u.ed,d.ed)&&(u.ed>d.ed?s.push(u):s.push(d)),gs(s)}function aa(t,e,n,s,r){const{paragraphs:i}=t,{paragraphs:o}=e;if(i==null||o==null)return;const l=Oi(t,n,s);if(r!==xt.REPLACE){const a=[];for(const h of o){const{startIndex:c,paragraphStyle:u,bullet:d}=h;let f=[];for(const m of l){const{startIndex:p,paragraphStyle:x,bullet:P}=m;let Z,gt;if(r===xt.COVER?(Z={...x,...u},gt={listId:"",listType:In.BULLET_LIST,nestingLevel:0,textStyle:{},...P,...d}):(Z={...u,...x},gt={listId:"",listType:In.BULLET_LIST,nestingLevel:0,textStyle:{},...d,...P}),c===p){f.push({startIndex:c,paragraphStyle:Z,bullet:gt});break}}a.push(...f),f=[]}e.paragraphs=a}return ms(t,e,n,s),l}function ua(t,e,n,s,r){const{sectionBreaks:i}=t,{sectionBreaks:o}=e;if(i==null||o==null)return;const l=Si(t,n,s);if(r!==xt.REPLACE){const a=[];for(const h of o){const{startIndex:c}=h;let u=[];for(const d of l){const{startIndex:f}=d;if(c===f){r===xt.COVER?u.push({...d,...h}):u.push({...h,...d});break}}a.push(...u),u=[]}e.sectionBreaks=a}return ms(t,e,n,s),l}function ca(t,e,n,s,r){const{customBlocks:i}=t,{customBlocks:o}=e;if(i==null||o==null)return;const l=Ni(t,n,s);if(r!==xt.REPLACE){const a=[];for(const h of o){const{startIndex:c}=h;let u=[];for(const d of l){const{startIndex:f}=d;if(c===f){r===xt.COVER?u.push({...d,...h}):u.push({...h,...d});break}}a.push(...u),u=[]}e.customBlocks=a}return Ci(t,e,n,s),l}function ha(t,e,n,s,r){const{tables:i}=t,{tables:o}=e;if(i==null||o==null)return;const l=bi(t,n,s);if(r!==xt.REPLACE){const a=[];for(const h of o){const{startIndex:c,endIndex:u}=h;let d=[];for(const f of l){const{startIndex:m,endIndex:p}=f;if(m>=c&&p<=u){r===xt.COVER?d.push({...f,...h}):d.push({...h,...f});break}}a.push(...d),d=[]}e.tables=a}return ps(t,e,n,s),l}function da(t,e,n,s,r){const{customRanges:i}=t,{tables:o}=e;if(i==null||o==null)return;const l=vi(t,n,s);if(r!==xt.REPLACE){const a=[];for(const h of o){const{startIndex:c,endIndex:u}=h;let d=[];for(const f of l){const{startIndex:m,endIndex:p}=f;if(m>=c&&p<=u){r===xt.COVER?d.push({...f,...h}):d.push({...h,...f});break}}a.push(...d),d=[]}e.customRanges=a}return ps(t,e,n,s),l}function qe(t,e,n,s=!1){const{dataStream:r,textRuns:i=[],paragraphs:o=[]}=t,l={dataStream:r.slice(e,n)},a=[];for(const c of i){const u=y.deepClone(c),{st:d,ed:f}=u;y.hasIntersectionBetweenTwoRanges(d,f,e,n)&&(e>=d&&e<=f?a.push({...u,st:e,ed:Math.min(n,f)}):n>=d&&n<=f?a.push({...u,st:Math.max(e,d),ed:n}):a.push(u))}a.length?l.textRuns=a.map(c=>{const{st:u,ed:d}=c;return{...c,st:u-e,ed:d-e}}):s&&(l.textRuns=[{st:0,ed:n-e,ts:{}}]);const h=[];for(const c of o){const{startIndex:u}=c;u>=e&&u<=n&&h.push(y.deepClone(c))}return h.length&&(l.paragraphs=h.map(c=>({...c,startIndex:c.startIndex-e}))),l}function Qn(t,e,n=xt.COVER){if(e.dataStream!=="")throw new Error("Cannot compose other body with non-empty dataStream");const s={dataStream:t.dataStream},{textRuns:r=[],paragraphs:i=[]}=t,{textRuns:o=[],paragraphs:l=[]}=e,a=Ai(o,r,n);a.length&&(s.textRuns=a);const h=[];let c=0,u=0;for(;c<i.length&&u<l.length;){const d=i[c],f=l[u],{startIndex:m}=d,{startIndex:p}=f;m===p?(h.push(y.deepMerge(d,f)),c++,u++):m<p?(h.push(y.deepClone(d)),c++):(h.push(y.deepClone(f)),u++)}return c<i.length&&h.push(...i.slice(c)),u<l.length&&h.push(...l.slice(u)),h.length&&(s.paragraphs=h),s}function fa(t){const{body:e}=t;if(e==null)return!0;const{textRuns:n=[],paragraphs:s=[]}=e;return n.length===0&&s.length===0}function _a(t=y.generateRandomId(6),e=we.EN_US,n=""){return{id:t,locale:e,title:n,body:{dataStream:`\r
|
|
6
|
+
`,textRuns:[],paragraphs:[{startIndex:0,paragraphStyle:{spaceAbove:5,lineSpacing:1,spaceBelow:0}}],sectionBreaks:[{startIndex:1}]},documentStyle:{pageSize:{width:793.3333333333334,height:1122.6666666666667},marginTop:50,marginBottom:50,marginRight:40,marginLeft:40,renderConfig:{vertexAngle:0,centerAngle:0}},settings:{}}}var Wt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ga(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Bt={},wi={},Es={};Object.defineProperty(Es,"__esModule",{value:!0});function ma(t,e){if(Array.isArray(e))return!1;for(let n in t)if(!Rs(t[n],e[n]))return!1;for(let n in e)if(t[n]===void 0)return!1;return!0}function pa(t,e){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!Rs(t[n],e[n]))return!1;return!0}function Rs(t,e){return t===e?!0:t===null||e===null||typeof t!="object"||typeof e!="object"?!1:Array.isArray(t)?pa(t,e):ma(t,e)}Es.default=Rs;var Cs={};Object.defineProperty(Cs,"__esModule",{value:!0});function ts(t){if(t===null)return null;if(Array.isArray(t))return t.map(ts);if(typeof t=="object"){const e={};for(let n in t)e[n]=ts(t[n]);return e}else return t}Cs.default=ts;var Is={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.eachChildOf=t.advancer=t.readCursor=t.writeCursor=t.WriteCursor=t.ReadCursor=t.isValidPathItem=void 0;function e(c,u){if(!c)throw new Error(u)}const n=c=>c!=null&&typeof c=="object"&&!Array.isArray(c),s=(c,u)=>typeof c==typeof u?c>u:typeof c=="string"&&typeof u=="number";function r(c,u){for(let d in c){const f=d;u.write(f,c[f])}}t.isValidPathItem=c=>typeof c=="number"||typeof c=="string"&&c!=="__proto__";class i{constructor(u=null){this.parents=[],this.indexes=[],this.lcIdx=-1,this.idx=-1,this.container=u}ascend(){e(this.parents.length===this.indexes.length/2),this.idx===0?this.parents.length?(this.lcIdx=this.indexes.pop(),this.container=this.parents.pop(),this.idx=this.indexes.pop()):(this.lcIdx=0,this.idx=-1):(e(this.idx>0),this.idx--,n(this.container[this.idx])&&this.idx--)}getPath(){const u=[];let d=this.container,f=this.parents.length-1,m=this.idx;for(;m>=0;)u.unshift(d[m]),m===0?(m=this.indexes[f*2],d=this.parents[f--]):m-=n(d[m-1])?2:1;return u}}class o extends i{get(){return this.container?this.container.slice(this.idx+1):null}getKey(){return e(this.container!=null,"Invalid call to getKey before cursor descended"),this.container[this.idx]}getComponent(){let u;return this.container&&this.container.length>this.idx+1&&n(u=this.container[this.idx+1])?u:null}descendFirst(){let u=this.idx+1;if(!this.container||u>=this.container.length||n(this.container[u])&&u+1>=this.container.length)return!1;n(this.container[u])&&u++;const d=this.container[u];return Array.isArray(d)?(this.indexes.push(this.idx),this.parents.push(this.container),this.indexes.push(u),this.idx=0,this.container=d):this.idx=u,!0}nextSibling(){if(e(this.parents.length===this.indexes.length/2),this.idx>0||this.parents.length===0)return!1;const u=this.indexes[this.indexes.length-1]+1,d=this.parents[this.parents.length-1];return u>=d.length?!1:(e(!isNaN(u)),this.indexes[this.indexes.length-1]=u,this.container=d[u],!0)}_init(u,d,f,m){this.container=u,this.idx=d,this.parents=f.slice(),this.indexes=m.slice()}clone(){const u=new o;return u._init(this.container,this.idx,this.parents,this.indexes),u}*[Symbol.iterator](){if(this.descendFirst()){do yield this.getKey();while(this.nextSibling());this.ascend()}}traverse(u,d){const f=this.getComponent();f&&d(f,u);for(const m of this)u&&u.descend(m),this.traverse(u,d),u&&u.ascend()}eachPick(u,d){this.traverse(u,(f,m)=>{f.p!=null&&d(f.p,m)})}eachDrop(u,d){this.traverse(u,(f,m)=>{f.d!=null&&d(f.d,m)})}}t.ReadCursor=o;class l extends i{constructor(u=null){super(u),this.pendingDescent=[],this._op=u}flushDescent(){e(this.parents.length===this.indexes.length/2),this.container===null&&(this._op=this.container=[]);for(let u=0;u<this.pendingDescent.length;u++){const d=this.pendingDescent[u];let f=this.idx+1;if(f<this.container.length&&n(this.container[f])&&f++,e(f===this.container.length||!n(this.container[f])),f===this.container.length)this.container.push(d),this.idx=f;else if(this.container[f]===d)this.idx=f;else{if(!Array.isArray(this.container[f])){const m=this.container.splice(f,this.container.length-f);this.container.push(m),this.lcIdx>-1&&(this.lcIdx=f)}for(this.indexes.push(this.idx),this.parents.push(this.container),this.lcIdx!==-1&&(e(s(d,this.container[this.lcIdx][0])),f=this.lcIdx+1,this.lcIdx=-1);f<this.container.length&&s(d,this.container[f][0]);)f++;if(this.indexes.push(f),this.idx=0,f<this.container.length&&this.container[f][0]===d)this.container=this.container[f];else{const m=[d];this.container.splice(f,0,m),this.container=m}}}this.pendingDescent.length=0}reset(){this.lcIdx=-1}getComponent(){this.flushDescent();const u=this.idx+1;if(u<this.container.length&&n(this.container[u]))return this.container[u];{const d={};return this.container.splice(u,0,d),d}}write(u,d){const f=this.getComponent();e(f[u]==null||f[u]===d,"Internal consistency error: Overwritten component. File a bug"),f[u]=d}get(){return this._op}descend(u){if(!t.isValidPathItem(u))throw Error("Invalid JSON key");this.pendingDescent.push(u)}descendPath(u){return this.pendingDescent.push(...u),this}ascend(){this.pendingDescent.length?this.pendingDescent.pop():super.ascend()}mergeTree(u,d=r){if(u===null)return;if(e(Array.isArray(u)),u===this._op)throw Error("Cannot merge into my own tree");const f=this.lcIdx,m=this.parents.length;let p=0;for(let x=0;x<u.length;x++){const P=u[x];typeof P=="string"||typeof P=="number"?(p++,this.descend(P)):Array.isArray(P)?this.mergeTree(P,d):typeof P=="object"&&d(P,this)}for(;p--;)this.ascend();this.lcIdx=this.parents.length===m?f:-1}at(u,d){this.descendPath(u),d(this);for(let f=0;f<u.length;f++)this.ascend();return this}writeAtPath(u,d,f){return this.at(u,()=>this.write(d,f)),this.reset(),this}writeMove(u,d,f=0){return this.writeAtPath(u,"p",f).writeAtPath(d,"d",f)}getPath(){const u=super.getPath();return u.push(...this.pendingDescent),u}}t.WriteCursor=l,t.writeCursor=()=>new l,t.readCursor=c=>new o(c);function a(c,u,d){let f,m;m=f=c?c.descendFirst():!1;function p(x){let P;for(;m;){const Z=P=c.getKey();if(x!=null){let gt=!1;if(u&&typeof Z=="number"&&(P=u(Z,c.getComponent()),P<0&&(P=~P,gt=!0)),s(P,x))return null;if(P===x&&!gt)return c}d&&typeof P=="number"&&d(P,c.getComponent()),m=c.nextSibling()}return null}return p.end=()=>{f&&c.ascend()},p}t.advancer=a;function h(c,u,d){let f,m,p,x;for(f=m=c&&c.descendFirst(),p=x=u&&u.descendFirst();f||p;){let P=f?c.getKey():null,Z=p?u.getKey():null;P!==null&&Z!==null&&(s(Z,P)?Z=null:P!==Z&&(P=null)),d(P==null?Z:P,P!=null?c:null,Z!=null?u:null),P!=null&&f&&(f=c.nextSibling()),Z!=null&&p&&(p=u.nextSibling())}m&&c.ascend(),x&&u.ascend()}t.eachChildOf=h})(Is);var Os={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ConflictType=void 0,function(e){e[e.RM_UNEXPECTED_CONTENT=1]="RM_UNEXPECTED_CONTENT",e[e.DROP_COLLISION=2]="DROP_COLLISION",e[e.BLACKHOLE=3]="BLACKHOLE"}(t.ConflictType||(t.ConflictType={}))})(Os);var Wn={},Oe={},Bs;function Ss(){return Bs||(Bs=1,Object.defineProperty(Oe,"__esModule",{value:!0}),Oe.uniToStrPos=Oe.strPosToUni=void 0,Oe.strPosToUni=(t,e=t.length)=>{let n=0,s=0;for(;s<e;s++){const r=t.charCodeAt(s);r>=55296&&r<=57343&&(n++,s++)}if(s!==e)throw Error("Invalid offset - splits unicode bytes");return s-n},Oe.uniToStrPos=(t,e)=>{let n=0;for(;e>0;e--){const s=t.charCodeAt(n);n+=s>=55296&&s<=57343?2:1}return n}),Oe}var $n={},Ws;function es(){return Ws||(Ws=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.uniSlice=t.dlen=t.eachOp=void 0;const e=Ss(),n=E=>{if(!Array.isArray(E))throw Error("Op must be an array of components");let O=null;for(let A=0;A<E.length;A++){const Y=E[A];switch(typeof Y){case"object":if(typeof Y.d!="number"&&typeof Y.d!="string")throw Error("Delete must be number or string");if(t.dlen(Y.d)<=0)throw Error("Deletes must not be empty");break;case"string":if(!(Y.length>0))throw Error("Inserts cannot be empty");break;case"number":if(!(Y>0))throw Error("Skip components must be >0");if(typeof O=="number")throw Error("Adjacent skip components should be combined");break}O=Y}if(typeof O=="number")throw Error("Op has a trailing skip")};function s(E,O){let A=0,Y=0;for(let tt=0;tt<E.length;tt++){const z=E[tt];switch(O(z,A,Y),typeof z){case"object":A+=t.dlen(z.d);break;case"string":Y+=e.strPosToUni(z);break;case"number":A+=z,Y+=z;break}}}t.eachOp=s;function r(E,O){const A=[],Y=l(A);return s(E,(tt,z,Gt)=>{Y(O(tt,z,Gt))}),u(A)}const i=E=>E,o=E=>r(E,i);t.dlen=E=>typeof E=="number"?E:e.strPosToUni(E);const l=E=>O=>{if(!(!O||O.d===0||O.d===""))if(E.length===0)E.push(O);else if(typeof O==typeof E[E.length-1])if(typeof O=="object"){const A=E[E.length-1];A.d=typeof A.d=="string"&&typeof O.d=="string"?A.d+O.d:t.dlen(A.d)+t.dlen(O.d)}else E[E.length-1]+=O;else E.push(O)},a=E=>typeof E=="number"?E:typeof E=="string"?e.strPosToUni(E):typeof E.d=="number"?E.d:e.strPosToUni(E.d);t.uniSlice=(E,O,A)=>{const Y=e.uniToStrPos(E,O),tt=A==null?1/0:e.uniToStrPos(E,A);return E.slice(Y,tt)};const h=(E,O,A)=>typeof E=="number"?A==null?E-O:Math.min(E,A)-O:t.uniSlice(E,O,A),c=E=>{let O=0,A=0;return{take:(z,Gt)=>{if(O===E.length)return z===-1?null:z;const St=E[O];let ft;if(typeof St=="number")return z===-1||St-A<=z?(ft=St-A,++O,A=0,ft):(A+=z,z);if(typeof St=="string"){if(z===-1||Gt==="i"||e.strPosToUni(St.slice(A))<=z)return ft=St.slice(A),++O,A=0,ft;{const Ct=A+e.uniToStrPos(St.slice(A),z);return ft=St.slice(A,Ct),A=Ct,ft}}else{if(z===-1||Gt==="d"||t.dlen(St.d)-A<=z)return ft={d:h(St.d,A)},++O,A=0,ft;{let Ct=h(St.d,A,A+z);return A+=z,{d:Ct}}}},peek:()=>E[O]}},u=E=>(E.length>0&&typeof E[E.length-1]=="number"&&E.pop(),E);function d(E,O,A){if(A!=="left"&&A!=="right")throw Error("side ("+A+") must be 'left' or 'right'");n(E),n(O);const Y=[],tt=l(Y),{take:z,peek:Gt}=c(E);for(let ft=0;ft<O.length;ft++){const Ct=O[ft];let Tt,jt;switch(typeof Ct){case"number":for(Tt=Ct;Tt>0;)jt=z(Tt,"i"),tt(jt),typeof jt!="string"&&(Tt-=a(jt));break;case"string":A==="left"&&typeof Gt()=="string"&&tt(z(-1)),tt(e.strPosToUni(Ct));break;case"object":for(Tt=t.dlen(Ct.d);Tt>0;)switch(jt=z(Tt,"i"),typeof jt){case"number":Tt-=jt;break;case"string":tt(jt);break;case"object":Tt-=t.dlen(jt.d)}break}}let St;for(;St=z(-1);)tt(St);return u(Y)}function f(E,O){n(E),n(O);const A=[],Y=l(A),{take:tt}=c(E);for(let Gt=0;Gt<O.length;Gt++){const St=O[Gt];let ft,Ct;switch(typeof St){case"number":for(ft=St;ft>0;)Ct=tt(ft,"d"),Y(Ct),typeof Ct!="object"&&(ft-=a(Ct));break;case"string":Y(St);break;case"object":ft=t.dlen(St.d);let Tt=0;for(;Tt<ft;)switch(Ct=tt(ft-Tt,"d"),typeof Ct){case"number":Y({d:h(St.d,Tt,Tt+Ct)}),Tt+=Ct;break;case"string":Tt+=e.strPosToUni(Ct);break;case"object":Y(Ct)}break}}let z;for(;z=tt(-1);)Y(z);return u(A)}const m=(E,O)=>{let A=0;for(let Y=0;Y<O.length&&E>A;Y++){const tt=O[Y];switch(typeof tt){case"number":{A+=tt;break}case"string":const z=e.strPosToUni(tt);A+=z,E+=z;break;case"object":E-=Math.min(t.dlen(tt.d),E-A);break}}return E},p=(E,O)=>typeof E=="number"?m(E,O):E.map(A=>m(A,O));function x(E,O,A){return r(E,(Y,tt)=>typeof Y=="object"&&typeof Y.d=="number"?{d:A.slice(O,tt,tt+Y.d)}:Y)}function P(E){return r(E,O=>{switch(typeof O){case"object":if(typeof O.d=="number")throw Error("Cannot invert text op: Deleted characters missing from operation. makeInvertible must be called first.");return O.d;case"string":return{d:O};case"number":return O}})}function Z(E){return r(E,O=>typeof O=="object"&&typeof O.d=="string"?{d:e.strPosToUni(O.d)}:O)}function gt(E){let O=!0;return s(E,A=>{typeof A=="object"&&typeof A.d=="number"&&(O=!1)}),O}function ht(E){return{name:"text-unicode",uri:"http://sharejs.org/types/text-unicode",trim:u,normalize:o,checkOp:n,create(O=""){if(typeof O!="string")throw Error("Initial data must be a string");return E.create(O)},apply(O,A){n(A);const Y=E.builder(O);for(let tt=0;tt<A.length;tt++){const z=A[tt];switch(typeof z){case"number":Y.skip(z);break;case"string":Y.append(z);break;case"object":Y.del(t.dlen(z.d));break}}return Y.build()},transform:d,compose:f,transformPosition:m,transformSelection:p,isInvertible:gt,makeInvertible(O,A){return x(O,A,E)},stripInvertible:Z,invert:P,invertWithDoc(O,A){return P(x(O,A,E))},isNoop:O=>O.length===0}}t.default=ht}($n)),$n}var an={},$s;function Ea(){if($s)return an;$s=1,Object.defineProperty(an,"__esModule",{value:!0});const t=es(),e=Ss();function n(s,r){return{get:s,getLength(){return s().length},insert(i,o,l){const a=e.strPosToUni(s(),i);return r([a,o],l)},remove(i,o,l){const a=e.strPosToUni(s(),i);return r([a,{d:o}],l)},_onOp(i){t.eachOp(i,(o,l,a)=>{switch(typeof o){case"string":this.onInsert&&this.onInsert(a,o);break;case"object":const h=t.dlen(o.d);this.onRemove&&this.onRemove(a,h)}})},onInsert:null,onRemove:null}}return an.default=n,n.provides={text:!0},an}var Gs;function Ra(){return Gs||(Gs=1,function(t){var e=Wt&&Wt.__createBinding||(Object.create?function(d,f,m,p){p===void 0&&(p=m),Object.defineProperty(d,p,{enumerable:!0,get:function(){return f[m]}})}:function(d,f,m,p){p===void 0&&(p=m),d[p]=f[m]}),n=Wt&&Wt.__setModuleDefault||(Object.create?function(d,f){Object.defineProperty(d,"default",{enumerable:!0,value:f})}:function(d,f){d.default=f}),s=Wt&&Wt.__importStar||function(d){if(d&&d.__esModule)return d;var f={};if(d!=null)for(var m in d)Object.hasOwnProperty.call(d,m)&&e(f,d,m);return n(f,d),f},r=Wt&&Wt.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(t,"__esModule",{value:!0}),t.type=t.remove=t.insert=void 0;const i=Ss(),o=s(es()),l=r(Ea()),a={create(d){return d},toString(d){return d},builder(d){if(typeof d!="string")throw Error("Invalid document snapshot: "+d);const f=[];return{skip(m){let p=i.uniToStrPos(d,m);if(p>d.length)throw Error("The op is too long for this document");f.push(d.slice(0,p)),d=d.slice(p)},append(m){f.push(m)},del(m){d=d.slice(i.uniToStrPos(d,m))},build(){return f.join("")+d}}},slice:o.uniSlice},h=o.default(a),c=Object.assign(Object.assign({},h),{api:l.default});t.type=c,t.insert=(d,f)=>f.length===0?[]:d===0?[f]:[d,f],t.remove=(d,f)=>o.dlen(f)===0?[]:d===0?[{d:f}]:[d,{d:f}];var u=es();Object.defineProperty(t,"makeType",{enumerable:!0,get:function(){return u.default}})}(Wn)),Wn}(function(t){var e=Wt&&Wt.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(t,"__esModule",{value:!0}),t.editOp=t.replaceOp=t.insertOp=t.moveOp=t.removeOp=t.type=void 0;const n=e(Es),s=e(Cs),r=Is,i=Os;function o(g,R){if(!g)throw new Error(R)}t.type={name:"json1",uri:"http://sharejs.org/types/JSONv1",readCursor:r.readCursor,writeCursor:r.writeCursor,create:g=>g,isNoop:g=>g==null,setDebug(g){},registerSubtype:P,checkValidOp:tt,normalize:z,apply:Gt,transformPosition:St,compose:ft,tryTransform:xn,transform:Eo,makeInvertible:jt,invert:Ct,invertWithDoc:po,RM_UNEXPECTED_CONTENT:i.ConflictType.RM_UNEXPECTED_CONTENT,DROP_COLLISION:i.ConflictType.DROP_COLLISION,BLACKHOLE:i.ConflictType.BLACKHOLE,transformNoConflict:(g,R,N)=>Ls(()=>!0,g,R,N),typeAllowingConflictsPred:g=>Object.assign(Object.assign({},t.type),{transform:(R,N,M)=>Ls(g,R,N,M)})};const l=g=>g?g.getComponent():null;function a(g){return g&&typeof g=="object"&&!Array.isArray(g)}const h=g=>Array.isArray(g)?g.slice():g!==null&&typeof g=="object"?Object.assign({},g):g,c=g=>g&&(g.p!=null||g.r!==void 0),u=g=>g&&(g.d!=null||g.i!==void 0);function d(g,R){return o(g!=null),typeof R=="number"?(o(Array.isArray(g),"Invalid key - child is not an array"),(g=g.slice()).splice(R,1)):(o(a(g),"Invalid key - child is not an object"),delete(g=Object.assign({},g))[R]),g}function f(g,R,N){return typeof R=="number"?(o(g!=null,"Container is missing for key"),o(Array.isArray(g),"Cannot use numerical key for object container"),o(g.length>=R,"Cannot insert into out of bounds index"),g.splice(R,0,N)):(o(a(g),"Cannot insert into missing item"),o(g[R]===void 0,"Trying to overwrite value at key. Your op needs to remove it first"),g[R]=N),N}t.removeOp=(g,R=!0)=>r.writeCursor().writeAtPath(g,"r",R).get(),t.moveOp=(g,R)=>r.writeCursor().writeMove(g,R).get(),t.insertOp=(g,R)=>r.writeCursor().writeAtPath(g,"i",R).get(),t.replaceOp=(g,R,N)=>r.writeCursor().at(g,M=>{M.write("r",R),M.write("i",N)}).get(),t.editOp=(g,R,N,M=!1)=>r.writeCursor().at(g,b=>O(b,R,N,M)).get();const m=(g,R)=>g!=null&&(typeof R=="number"?Array.isArray(g):typeof g=="object"),p=(g,R)=>m(g,R)?g[R]:void 0,x={};function P(g){let R=g.type?g.type:g;R.name&&(x[R.name]=R),R.uri&&(x[R.uri]=R)}const Z=g=>{const R=x[g];if(R)return R;throw Error("Missing type: "+g)};P(Ra());const gt=(g,R)=>g+R;P({name:"number",apply:gt,compose:gt,invert:g=>-g,transform:g=>g});const ht=g=>g==null?null:g.et?Z(g.et):g.es?x["text-unicode"]:g.ena!=null?x.number:null,E=g=>g.es?g.es:g.ena!=null?g.ena:g.e,O=(g,R,N,M=!1)=>{const[b,T]=typeof R=="string"?[Z(R),R]:[R,R.name];!M&&b.isNoop&&b.isNoop(N)||(T==="number"?g.write("ena",N):T==="text-unicode"?g.write("es",N):(g.write("et",T),g.write("e",N)))};function A(g){o(typeof g=="number"),o(g>=0),o(g===(0|g))}function Y(g){typeof g=="number"?A(g):o(typeof g=="string")}function tt(g){if(g===null)return;const R=new Set,N=new Set,M=T=>{let G=!0,W=!1;for(let C in T){const S=T[C];if(G=!1,o(C==="p"||C==="r"||C==="d"||C==="i"||C==="e"||C==="es"||C==="ena"||C==="et","Invalid component item '"+C+"'"),C==="p")A(S),o(!R.has(S)),R.add(S),o(T.r===void 0);else if(C==="d")A(S),o(!N.has(S)),N.add(S),o(T.i===void 0);else if(C==="e"||C==="es"||C==="ena"){o(!W),W=!0;const v=ht(T);o(v,"Missing type in edit"),v.checkValidOp&&v.checkValidOp(E(T))}}o(!G)},b=(T,G,W)=>{if(!Array.isArray(T))throw Error("Op must be null or a list");if(T.length===0)throw Error("Empty descent");G||Y(T[0]);let C=1,S=0,v=0;for(let w=0;w<T.length;w++){const $=T[w];if(o($!=null),Array.isArray($)){const j=b($,!1);if(S){const I=typeof v,H=typeof j;I===H?o(v<j,"descent keys are not in order"):o(I==="number"&&H==="string")}v=j,S++,C=3}else typeof $=="object"?(o(C===1,`Prev not scalar - instead ${C}`),M($),C=2):(o(C!==3),Y($),o(r.isValidPathItem($),"Invalid path key"),C=1)}return o(S!==1,"Operation makes multiple descents. Remove some []"),o(C===2||C===3),T[0]};b(g,!0),o(R.size===N.size,"Mismatched picks and drops in op");for(let T=0;T<R.size;T++)o(R.has(T)),o(N.has(T))}function z(g){let R=0,N=[];const M=r.writeCursor();return M.mergeTree(g,(b,T)=>{const G=ht(b);if(G){const C=E(b);O(T,G,G.normalize?G.normalize(C):C)}for(const C of["r","p","i","d"])if(b[C]!==void 0){const S=C==="p"||C==="d"?(W=b[C],N[W]==null&&(N[W]=R++),N[W]):b[C];T.write(C,S)}var W}),M.get()}function Gt(g,R){if(tt(R),R===null)return g;const N=[];return function M(b,T){let G=b,W=0,C={root:b},S=0,v=C,w="root";function $(){for(;S<W;S++){let j=T[S];typeof j!="object"&&(o(m(v,w)),v=v[w]=h(v[w]),w=j)}}for(;W<T.length;W++){const j=T[W];if(Array.isArray(j)){const I=M(G,j);I!==G&&I!==void 0&&($(),G=v[w]=I)}else if(typeof j=="object"){j.d!=null?($(),G=f(v,w,N[j.d])):j.i!==void 0&&($(),G=f(v,w,j.i));const I=ht(j);if(I)$(),G=v[w]=I.apply(G,E(j));else if(j.e!==void 0)throw Error("Subtype "+j.et+" undefined")}else G=p(G,j)}return C.root}(g=function M(b,T){const G=[];let W=0;for(;W<T.length;W++){const w=T[W];if(Array.isArray(w))break;typeof w!="object"&&(G.push(b),b=p(b,w))}for(let w=T.length-1;w>=W;w--)b=M(b,T[w]);for(--W;W>=0;W--){const w=T[W];if(typeof w!="object"){const $=G.pop();b=b===p($,w)?$:b===void 0?d($,w):(S=w,v=b,(C=h(C=$))[S]=v,C)}else c(w)&&(o(b!==void 0,"Cannot pick up or remove undefined"),w.p!=null&&(N[w.p]=b),b=void 0)}var C,S,v;return b}(g,R),R)}function St(g,R){g=g.slice(),tt(R);const N=r.readCursor(R);let M,b,T=!1;const G=[];for(let C=0;;C++){const S=g[C],v=N.getComponent();if(v&&(v.r!==void 0?T=!0:v.p!=null&&(T=!1,M=v.p,b=C)),C>=g.length)break;let w=0;const $=r.advancer(N,void 0,(I,H)=>{c(H)&&w++});G.unshift($);const j=$(S);if(typeof S=="number"&&(g[C]-=w),!j)break}if(G.forEach(C=>C.end()),T)return null;const W=()=>{let C=0;if(M!=null){const S=N.getPath();C=S.length,g=S.concat(g.slice(b))}for(;C<g.length;C++){const S=g[C],v=l(N),w=ht(v);if(w){const I=E(v);w.transformPosition&&(g[C]=w.transformPosition(g[C],I));break}let $=0;const j=r.advancer(N,(I,H)=>u(H)?~(I-$):I-$,(I,H)=>{u(H)&&$++})(S);if(typeof S=="number"&&(g[C]+=$),!j)break}};return M!=null?N.eachDrop(null,C=>{C===M&&W()}):W(),g}function ft(g,R){if(tt(g),tt(R),g==null)return R;if(R==null)return g;let N=0;const M=r.readCursor(g),b=r.readCursor(R),T=r.writeCursor(),G=[],W=[],C=[],S=[],v=[],w=[],$=new Set;M.traverse(null,I=>{I.p!=null&&(C[I.p]=M.clone())}),b.traverse(null,I=>{I.d!=null&&(S[I.d]=b.clone())});const j=r.writeCursor();return function I(H,_t,at,X,pt,ie,Pt,Mt){o(_t||at);const Et=l(_t),Vt=l(at),qt=!!Vt&&Vt.r!==void 0,Ee=!!Et&&Et.i!==void 0,Kt=Et?Et.d:null,$t=Vt?Vt.p:null,oe=(ie||qt)&&$t==null;if($t!=null)X=S[$t],Pt=W[$t]=new r.WriteCursor;else if(Vt&&Vt.r!==void 0)X=null;else{const L=l(X);L&&L.d!=null&&(X=null)}const ot=l(X);if(Kt!=null)if(H=C[Kt],Mt=G[Kt]=new r.WriteCursor,oe)ie&&!qt&&Mt.write("r",!0);else{const L=v[Kt]=N++;Pt.write("d",L)}else if(Et&&Et.i!==void 0)H=null;else{const L=l(H);L&&L.p!=null&&(H=null)}let D;Ee?(o(pt===void 0),D=Et.i):D=pt;const V=($t==null?!Ee||ie||qt:D===void 0)?null:Pt.getComponent();if($t!=null){if(!(pt!==void 0||Ee)){const L=Kt!=null?v[Kt]:N++;w[$t]=L,Mt.write("p",L)}}else qt&&(Ee||pt!==void 0||(Vt.r,Mt.write("r",Vt.r)));const k=oe?null:ht(Et),U=ht(ot);if((k||U)&&(k&&k.name,U&&U.name),k&&U){o(k===U);const L=E(Et),K=E(ot),wt=k.compose(L,K);O(Pt,k,wt),$.add(ot)}else k?O(Pt,k,E(Et)):U&&(O(Pt,U,E(ot)),$.add(ot));const F=typeof D=="object"&&D!=null;let nt=!1,st=0,lt=0,At=0,Nt=0,Rt=0;const Dt=r.advancer(X,(L,K)=>u(K)?Nt-L-1:L-Nt,(L,K)=>{u(K)&&Nt++}),Q=r.advancer(H,(L,K)=>c(K)?st-L-1:L-st,(L,K)=>{c(K)&&st++});if(r.eachChildOf(_t,at,(L,K,wt)=>{let kt,le,Re=L,Jt=L,He=L;if(typeof L=="number"){let Ut=L+At;le=Dt(Ut),Jt=Ut+Nt;let It=L+lt;kt=Q(It),u(l(le))&&(kt=null),Re=It+st,He=L+Rt,o(Re>=0,"p1PickKey is negative"),o(Jt>=0,"p2DropKey is negative");const Zt=u(l(K)),ae=c(l(wt));(Zt||ae&&!oe)&&Rt--,Zt&<--,ae&&At--}else kt=Q(L),le=Dt(L);Mt.descend(Re),Pt.descend(Jt);const Me=F&&!u(l(K))?D[He]:void 0,ne=I(kt,K,wt,le,Me,oe,Pt,Mt);var se,B,mt;F&&!oe?Me!==ne&&(nt||(D=Array.isArray(D)?D.slice():Object.assign({},D),nt=!0),se=D,mt=ne,typeof(B=He)=="number"?(o(Array.isArray(se)),o(B<se.length)):(o(!Array.isArray(se)),o(se[B]!==void 0)),mt===void 0?typeof B=="number"?se.splice(B,1):delete se[B]:se[B]=mt):o(ne===void 0),Pt.ascend(),Mt.ascend()}),Q.end(),Dt.end(),V!=null)V.i=D;else if(!ie&&!qt&&$t==null)return D}(M,M.clone(),b,b.clone(),void 0,!1,T,j),T.reset(),T.mergeTree(j.get()),T.reset(),T.get(),G.map(I=>I.get()),W.map(I=>I.get()),M.traverse(T,(I,H)=>{const _t=I.p;if(_t!=null){const at=v[_t];at!=null&&H.write("p",at);const X=G[_t];X&&X.get(),X&&H.mergeTree(X.get())}else I.r!==void 0&&H.write("r",I.r)}),T.reset(),T.get(),b.traverse(T,(I,H)=>{const _t=I.d;if(_t!=null){const X=w[_t];X!=null&&H.write("d",X);const pt=W[_t];pt&&H.mergeTree(pt.get())}else I.i!==void 0&&H.write("i",I.i);const at=ht(I);at&&!$.has(I)&&O(H,at,E(I))}),T.get()}function Ct(g){if(g==null)return null;const R=new r.ReadCursor(g),N=new r.WriteCursor;let M;const b=[],T=[];return function G(W,C,S){const v=W.getComponent();let w,$=!1;if(v){v.p!=null&&(C.write("d",v.p),b[v.p]=W.clone()),v.r!==void 0&&C.write("i",v.r),v.d!=null&&(C.write("p",v.d),S=void 0),v.i!==void 0&&(S=w=v.i);const I=ht(v);I&&(S===void 0?(M||(M=new Set),M.add(v)):(E(v),S=I.apply(S,E(v)),$=!0))}let j=0;for(const I of W){C.descend(I);const H=typeof I=="number"?I-j:I,_t=p(S,H);u(W.getComponent())&&j++;const at=G(W,C,_t);if(S!==void 0&&at!==void 0){if($||($=!0,S=h(S)),!m(S,H))throw Error("Cannot modify child - invalid operation");S[H]=at}C.ascend()}if(w===void 0)return $?S:void 0;C.write("r",S)}(R,N,void 0),M&&(N.reset(),function G(W,C,S){const v=C.getComponent();if(v){const I=v.d;if(I!=null&&(W=b[I],S=T[I]=r.writeCursor()),M.has(v)){const H=ht(v);if(!H.invert)throw Error(`Cannot invert subtype ${H.name}`);O(S,H,H.invert(E(v)))}}let w=0,$=0;const j=r.advancer(W,(I,H)=>c(H)?w-I-1:I-w,(I,H)=>{c(H)&&w++});for(const I of C)if(typeof I=="number"){const H=I-$,_t=j(H),at=H+w;S.descend(at),G(_t,C,S),u(C.getComponent())&&$++,S.ascend()}else S.descend(I),G(j(I),C,S),S.ascend();j.end()}(R.clone(),R,N),T.length&&(N.reset(),R.traverse(N,(G,W)=>{const C=G.p;if(C!=null){const S=T[C];S&&S.get(),S&&W.mergeTree(S.get())}}))),N.get()}const Tt=(g,R)=>g.some(N=>typeof N=="object"&&(Array.isArray(N)?Tt(N,R):R(N)));function jt(g,R){if(g==null||!Tt(g,C=>{var S;return C.r!==void 0||((S=ht(C))===null||S===void 0?void 0:S.makeInvertible)!=null}))return g;const N=new r.ReadCursor(g),M=new r.WriteCursor;let b=!1;const T=[],G=[],W=(C,S,v)=>{const w=C.getComponent();let $=!1;if(w){w.d!=null&&S.write("d",w.d),w.i!==void 0&&S.write("i",w.i);const I=w.p;if(I!=null&&(T[I]=C.clone(),o(v!==void 0,"Operation picks up at an invalid key"),G[I]=v,S.write("p",w.p)),w.r!==void 0&&v===void 0)throw Error("Invalid doc / op in makeInvertible: removed item missing from doc");const H=ht(w);H&&(H.makeInvertible?b=!0:O(S,H,E(w),!0))}let j=0;for(const I of C){S.descend(I);const H=typeof I=="number"?I-j:I,_t=p(v,H),at=W(C,S,_t);_t!==at&&($||($=!0,v=h(v)),at===void 0?(v=d(v,H),typeof I=="number"&&j++):v[H]=at),S.ascend()}return w&&(w.r!==void 0?(S.write("r",s.default(v)),v=void 0):w.p!=null&&(v=void 0)),v};return W(N,M,R),M.get(),b&&(M.reset(),function C(S,v,w,$,j){const I=v.getComponent();if(I){I.i!==void 0?($=I.i,j=!0):I.d!=null&&($=G[I.d],S=T[I.d],j=!1,I.d);let X=ht(I);if(X&&X.makeInvertible){const pt=E(I);O(w,X,X.makeInvertible(pt,$),!0)}}let H=0,_t=0;const at=r.advancer(S,(X,pt)=>c(pt)?H-X-1:X-H,(X,pt)=>{c(pt)&&H++});for(const X of v)if(typeof X=="number"){const pt=X-_t,ie=at(pt),Pt=pt+H,Mt=p($,j?pt:Pt);w.descend(X),C(ie,v,w,Mt,j),u(v.getComponent())&&_t++,w.ascend()}else{const pt=p($,X);w.descend(X),C(at(X),v,w,pt,j),w.ascend()}at.end()}(N.clone(),N,M,R,!1)),M.get()}function po(g,R){return Ct(jt(g,R))}const Pn=g=>{if(g==null)return null;const R=g.slice();for(let N=0;N<g.length;N++){const M=R[N];Array.isArray(M)&&(R[N]=Pn(M))}return R};function xn(g,R,N){o(N==="left"||N==="right","Direction must be left or right");const M=N==="left"?0:1;if(R==null)return{ok:!0,result:g};tt(g),tt(R);let b=null;const T=[],G=[],W=[],C=[],S=[],v=[],w=[],$=[],j=[],I=[],H=[],_t=[],at=[],X=[],pt=[];let ie=0;const Pt=r.readCursor(g),Mt=r.readCursor(R),Et=r.writeCursor();if(function ot(D,V=null,k){const U=l(V);U&&(U.r!==void 0?k=V.clone():U.p!=null&&(k=null,v[U.p]=D.clone()));const F=D.getComponent();let nt;F&&(nt=F.p)!=null&&(S[nt]=V?V.clone():null,W[nt]=D.clone(),k&&(I[nt]=!0,j[nt]=k),U&&U.p!=null&&(X[nt]=U.p));const st=r.advancer(V);for(const lt of D)ot(D,st(lt),k);st.end()}(Mt,Pt,null),function ot(D,V,k,U,F){const nt=k.getComponent();let st,lt=!1;nt&&((st=nt.d)!=null?(C[st]=k.clone(),U!=null&&(pt[U]==null&&(pt[U]=[]),pt[U].push(st)),D=S[st]||null,V=W[st]||null,I[st]?(F&&(H[st]=!0),F=j[st]||null):!F||M!==1&&X[st]!=null||b==null&&(b={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:t.removeOp(F.getPath()),op2:t.moveOp(V.getPath(),k.getPath())}),lt=!0):nt.i!==void 0&&(D=V=null,lt=!0,F&&b==null&&(b={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:t.removeOp(F.getPath()),op2:t.insertOp(k.getPath(),nt.i)})));const At=l(D);At&&(At.r!==void 0?F=D.clone():At.p!=null&&(At.p,U=At.p,F=null));const Nt=ht(nt);Nt&&F&&b==null&&(b={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:t.removeOp(F.getPath()),op2:t.editOp(k.getPath(),Nt,E(nt),!0)});let Rt=0,Dt=0;const Q=r.advancer(V,(K,wt)=>c(wt)?Rt-K-1:K-Rt,(K,wt)=>{c(wt)&&Rt++}),L=r.advancer(D);for(const K of k)if(typeof K=="number"){const wt=K-Dt,kt=Q(wt);Dt+=+ot(L(wt+Rt),kt,k,U,F)}else{const wt=Q(K);ot(L(K),wt,k,U,F)}return Q.end(),L.end(),lt}(Pt,Mt,Mt.clone(),null,null),C.map(ot=>ot&&ot.get()),b)return{ok:!1,conflict:b};H.map(ot=>!!ot);const Vt=[];let qt=null;(function ot(D,V,k,U,F){let nt=!1;const st=l(V);if(c(st)){const Q=st.p;Q!=null?(k=C[Q],U=_t[Q]=r.writeCursor(),nt=!0,F=null):(k=null,F=V.clone())}else u(l(k))&&(k=null);const lt=D.getComponent();if(lt){const Q=lt.p;Q!=null?(F&&($[Q]=F),Vt[Q]=F||M===1&&nt?null:U.getComponent(),T[Q]=D.clone(),k&&(w[Q]=k.clone())):lt.r!==void 0&&(F||U.write("r",!0),(F||nt)&&(qt==null&&(qt=new Set),qt.add(lt)))}let At=0,Nt=0;const Rt=r.advancer(V,void 0,(Q,L)=>{c(L)&&At++}),Dt=r.advancer(k,(Q,L)=>u(L)?~(Q-Nt):Q-Nt,(Q,L)=>{u(L)&&Nt++});if(D)for(const Q of D)if(typeof Q=="string"){const L=Rt(Q),K=Dt(Q);U.descend(Q),ot(D,L,K,U,F),U.ascend()}else{const L=Rt(Q),K=Q-At,wt=c(l(L))?null:Dt(K),kt=K+Nt;o(kt>=0),U.descend(kt),ot(D,L,wt,U,F),U.ascend()}Rt.end(),Dt.end()})(Pt,Mt,Mt.clone(),Et,null),Et.reset();let Ee=[];if(function ot(D,V,k,U,F,nt){o(V);const st=V.getComponent();let lt=l(U),At=!1;const Nt=(B,mt,Ut)=>B?t.moveOp(B.getPath(),mt.getPath()):t.insertOp(mt.getPath(),Ut.i);if(u(st)){const B=st.d;B!=null&&(G[B]=V.clone());const mt=B!=null?Vt[B]:null;let Ut=!1;if(st.i!==void 0||B!=null&&mt){let It;lt&&(lt.i!==void 0||(It=lt.d)!=null&&!I[It])&&(Ut=It!=null?B!=null&&B===X[It]:n.default(lt.i,st.i),Ut||It!=null&&M!==1&&X[It]!=null||b==null&&(b={type:i.ConflictType.DROP_COLLISION,op1:Nt(B!=null?T[B]:null,V,st),op2:Nt(It!=null?W[It]:null,U,lt)})),Ut||(nt?b==null&&(b={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:Nt(B!=null?T[B]:null,V,st),op2:t.removeOp(nt.getPath())}):(B!=null?(Ee[ie]=B,F.write("d",mt.p=ie++)):F.write("i",s.default(st.i)),At=!0))}else if(B!=null&&!mt){const It=$[B];It&&(nt=It.clone())}B!=null?(D=T[B],k=v[B],U=w[B]):st.i!==void 0&&(D=k=null,Ut||(U=null))}else c(l(D))&&(D=k=U=null);const Rt=l(D),Dt=l(k);if(c(Dt)){const B=Dt.p;Dt.r!==void 0&&(!Rt||Rt.r===void 0)||I[B]?(U=null,nt=k.clone()):B!=null&&(U=C[B],M!==1&&X[B]!=null||((F=at[B])||(F=at[B]=r.writeCursor()),F.reset(),nt=null))}else!u(st)&&u(lt)&&(U=null);lt=U!=null?U.getComponent():null;const Q=ht(st);if(Q){const B=E(st);if(nt)b==null&&(b={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:t.editOp(V.getPath(),Q,B,!0),op2:t.removeOp(nt.getPath())});else{const mt=ht(lt);let Ut;if(mt){if(Q!==mt)throw Error("Transforming incompatible types");const It=E(lt);Ut=Q.transform(B,It,N)}else Ut=s.default(B);O(F,Q,Ut)}}let L=0,K=0,wt=0,kt=0,le=0,Re=0,Jt=D!=null&&D.descendFirst(),He=Jt;const Me=r.advancer(k,void 0,(B,mt)=>{c(mt)&&wt++});let ne=U!=null&&U.descendFirst(),se=ne;for(const B of V)if(typeof B=="number"){let mt;const Ut=u(V.getComponent()),It=B-K;{let ce;for(;Jt&&typeof(ce=D.getKey())=="number";){ce+=L;const Qt=D.getComponent(),Ue=c(Qt);if(ce>It||ce===It&&(!Ue||M===0&&Ut))break;if(Ue){L--;const Ce=Qt.p;X.includes(Ce),Qt.d,l(at[Qt.d]),c(l(at[Qt.d])),(Qt.r===void 0||qt&&qt.has(Qt))&&(Ce==null||!Vt[Ce]||M!==1&&X.includes(Ce))||le--}Jt=D.nextSibling()}mt=Jt&&ce===It?D:null}const Zt=It-L;let ae=Me(Zt);const kn=Zt-wt;let nn=null;{let ce,Qt;for(;ne&&typeof(ce=U.getKey())=="number";){Qt=ce-kt;const Ue=U.getComponent(),Ce=u(Ue);if(Qt>kn)break;if(Qt===kn){if(!Ce){nn=U;break}{if(M===0&&Ut){nn=U;break}const Ie=ae&&c(ae.getComponent());if(M===0&&Ie)break}}if(Ce){const Ie=Ue.d;X[Ie],Ue.i===void 0&&(I[Ie]||X[Ie]!=null&&M!==1)?(I[Ie]||X[Ie]!=null&&M===0)&&(kt++,Re--):kt++}ne=U.nextSibling()}}const Ds=kn+kt+le+Re;o(Ds>=0,"trying to descend to a negative index"),F.descend(Ds),Ut&&(mt=ae=nn=null,K++),ot(mt,V,ae,nn,F,nt)&&Re++,F.ascend()}else{let mt;for(;Jt&&(mt=D.getKey(),typeof mt!="string"||!(mt>B||mt===B));)Jt=D.nextSibling();const Ut=Jt&&mt===B?D:null,It=Me(B);let Zt;for(;ne&&(Zt=U.getKey(),typeof Zt!="string"||!(Zt>B||Zt===B));)ne=U.nextSibling();const ae=ne&&Zt===B?U:null;F.descend(B),ot(Ut,V,It,ae,F,nt),F.ascend()}return Me.end(),He&&D.ascend(),se&&U.ascend(),At}(Pt,Pt.clone(),Mt,Mt.clone(),Et,null),b)return{ok:!1,conflict:b};Et.reset();const Kt=(ot,D,V)=>ot.traverse(D,(k,U)=>{k.d!=null&&V(k.d,ot,U)});(I.length||_t.length)&&(Kt(Mt,Et,(ot,D,V)=>{I[ot]&&!H[ot]&&V.write("r",!0),_t[ot]&&V.mergeTree(_t[ot].get())}),Et.reset());const $t=[],oe=[];if((at.length||I.length)&&!b){const ot=r.readCursor(Pn(Et.get()));if(Kt(ot,null,(D,V)=>{$t[D]=V.clone()}),at.forEach(D=>{D&&Kt(r.readCursor(D.get()),null,(V,k)=>{$t[V]=k.clone()})}),function D(V,k,U,F,nt,st){const lt=l(k);if(lt&&c(lt))if(lt.p!=null){const L=lt.p;$t[L].getPath(),U=$t[L],F=oe[L]=r.writeCursor()}else lt.r!==void 0&&(U=null);else u(l(U))&&(U=null);const At=V.getComponent();if(At){let L;if((L=At.d)!=null){const K=at[L];K&&(K.get(),F.mergeTree(K.get()),U=r.readCursor(K.get()))}}let Nt=0,Rt=0;const Dt=r.advancer(k,void 0,(L,K)=>{c(K)&&Nt--}),Q=r.advancer(U,(L,K)=>u(K)?-(L-Rt)-1:L-Rt,(L,K)=>{u(K)&&Rt++});for(const L of V)if(typeof L=="number"){const K=Dt(L),wt=L+Nt,kt=Q(wt),le=wt+Rt;F.descend(le),D(V,K,kt,F),F.ascend()}else F.descend(L),D(V,Dt(L),Q(L),F),F.ascend();Dt.end(),Q.end()}(Mt,ot,ot.clone(),Et),Et.reset(),b)return{ok:!1,conflict:b};if(Et.get(),oe.length){const D=oe.map(k=>k?k.get():null),V=r.readCursor(Pn(Et.get()));if(Kt(V,Et,(k,U,F)=>{const nt=D[k];nt&&(F.mergeTree(nt),D[k]=null)}),D.find(k=>k)){const k=r.writeCursor(),U=r.writeCursor();let F=0,nt=0;D.forEach(st=>{st!=null&&Kt(r.readCursor(st),null,lt=>{const At=Ee[lt];k.writeMove(T[At].getPath(),G[At].getPath(),F++);const Nt=pt[At];Nt&&Nt.forEach(Rt=>{I[Rt]||M!==1&&X[Rt]!=null||U.writeMove(W[Rt].getPath(),C[Rt].getPath(),nt++)})})}),b={type:i.ConflictType.BLACKHOLE,op1:k.get(),op2:U.get()}}}}return b?{ok:!1,conflict:b}:{ok:!0,result:Et.get()}}const Us=g=>{const R=new Error("Transform detected write conflict");throw R.conflict=g,R.type=R.name="writeConflict",R};function Eo(g,R,N){const M=xn(g,R,N);if(M.ok)return M.result;Us(M.conflict)}const Te=g=>{const R=r.writeCursor();return r.readCursor(g).traverse(R,(N,M)=>{(u(N)||ht(N))&&M.write("r",!0)}),R.get()},Ro=(g,R)=>{const{type:N,op1:M,op2:b}=g;switch(N){case i.ConflictType.DROP_COLLISION:return R==="left"?[null,Te(b)]:[Te(M),null];case i.ConflictType.RM_UNEXPECTED_CONTENT:let T=!1;return r.readCursor(M).traverse(null,G=>{G.r!==void 0&&(T=!0)}),T?[null,Te(b)]:[Te(M),null];case i.ConflictType.BLACKHOLE:return[Te(M),Te(b)];default:throw Error("Unrecognised conflict: "+N)}};function Ls(g,R,N,M){let b=null;for(;;){const T=xn(R,N,M);if(T.ok)return ft(b,T.result);{const{conflict:G}=T;g(G)||Us(G);const[W,C]=Ro(G,M);R=ft(z(R),W),N=ft(z(N),C),b=ft(b,C)}}}})(wi);(function(t){var e=Wt&&Wt.__createBinding||(Object.create?function(i,o,l,a){a===void 0&&(a=l),Object.defineProperty(i,a,{enumerable:!0,get:function(){return o[l]}})}:function(i,o,l,a){a===void 0&&(a=l),i[a]=o[l]}),n=Wt&&Wt.__exportStar||function(i,o){for(var l in i)l!=="default"&&!o.hasOwnProperty(l)&&e(o,i,l)};Object.defineProperty(t,"__esModule",{value:!0}),n(wi,t);var s=Is;Object.defineProperty(t,"ReadCursor",{enumerable:!0,get:function(){return s.ReadCursor}}),Object.defineProperty(t,"WriteCursor",{enumerable:!0,get:function(){return s.WriteCursor}});var r=Os;Object.defineProperty(t,"ConflictType",{enumerable:!0,get:function(){return r.ConflictType}})})(Bt);const Ca=ga(Bt),Ia=Oo({__proto__:null,default:Ca},[Bt]);var J=(t=>(t.RETAIN="r",t.INSERT="i",t.DELETE="d",t))(J||{});class ns{constructor(e){_(this,"_index",0);_(this,"_offset",0);this._actions=e}hasNext(){return this.peekLength()<Number.POSITIVE_INFINITY}next(e){e||(e=Number.POSITIVE_INFINITY);const n=this._actions[this._index];if(n){const s=this._offset,r=n.len;return e>=r-s?(e=r-s,this._index+=1,this._offset=0):this._offset+=e,n.t===J.DELETE||n.t===J.RETAIN&&n.body==null?y.deepClone({...n,len:e}):y.deepClone({...n,len:e,body:qe(n.body,s,s+e)})}else return{t:J.RETAIN,len:Number.POSITIVE_INFINITY}}peek(){return this._actions[this._index]}peekLength(){return this._actions[this._index]?this._actions[this._index].len-this._offset:Number.POSITIVE_INFINITY}peekType(){const e=this._actions[this._index];return e?e.t:J.RETAIN}rest(){if(this.hasNext()){if(this._offset===0)return this._actions.slice(this._index);{const e=this._offset,n=this._index,s=this.next(),r=this._actions.slice(this._index);return this._offset=e,this._index=n,[s].concat(r)}}else return[]}}class Ti{constructor(){_(this,"cursor",0)}reset(){return this.cursor=0,this}moveCursor(e){this.cursor+=e}moveCursorTo(e){this.cursor=e}}function Oa(t,e,n){const{dataStream:s}=t,r=n,i=n+e,o=Ii(t,e,n),l=Oi(t,e,n),a=Si(t,e,n),h=Ni(t,e,n),c=bi(t,e,n),u=vi(t,e,n);let d="";return s&&(t.dataStream=Zr(s,r,i),d=s.slice(r,i)),{dataStream:d,textRuns:o,paragraphs:l,sectionBreaks:a,customBlocks:h,tables:c,customRanges:u}}function Sa(t,e,n,s){t.dataStream=Jr(t.dataStream,s,e.dataStream),Ri(t,e,n,s),ms(t,e,n,s),ra(t,e,n,s),Ci(t,e,n,s),ps(t,e,n,s),ia(t,e,n,s)}function Na(t,e,n,s,r=xt.COVER){return oa(t,e,n,s,r)}function ba(t,e,n){return e<=0?{dataStream:""}:Oa(t,e,n)}function va(t,e,n,s){n!==0&&Sa(t,e,n,s)}function Aa(t,e){const n=new Ti;return n.reset(),e.forEach(s=>{switch(s=y.deepClone(s),s.t){case J.RETAIN:{const{coverType:r,body:i,len:o}=s;i!=null&&Na(t,i,o,n.cursor,r),n.moveCursor(o);break}case J.INSERT:{const{body:r,len:i}=s;va(t,r,i,n.cursor),n.moveCursor(i);break}case J.DELETE:{const{len:r}=s;ba(t,r,n.cursor);break}default:throw new Error(`Unknown action type for action: ${s}.`)}}),t}function js(t){return Object.keys(t).length===1}const Ye=class Ye{constructor(){_(this,"_actions",[])}static apply(e,n){return Aa(e,n)}static compose(e,n){const s=new ns(e),r=new ns(n),i=new Ye;for(;s.hasNext()||r.hasNext();)if(r.peekType()===J.INSERT)i.push(r.next());else if(s.peekType()===J.DELETE)i.push(s.next());else{const o=Math.min(s.peekLength(),r.peekLength()),l=s.next(o),a=r.next(o);l.t===J.INSERT&&a.t===J.RETAIN?a.body==null?i.push(l):i.push({...l,body:Qn(l.body,a.body,a.coverType)}):l.t===J.RETAIN&&a.t===J.RETAIN?l.body==null&&a.body==null?i.push(l.len!==Number.POSITIVE_INFINITY?l:a):l.body&&a.body?i.push({...l,body:Qn(l.body,a.body,a.coverType)}):i.push(l.body?l:a):l.t===J.RETAIN&&a.t===J.DELETE?i.push(a):l.t===J.INSERT&&(a.t,J.DELETE)}return i.trimEndUselessRetainAction(),i.serialize()}static transform(e,n,s){throw new Error("transform is not implemented in TextX")}static isNoop(e){return e.length===0}static invert(e){const n=[];for(const s of e)if(s.t===J.INSERT)n.push({t:J.DELETE,len:s.len,line:0,body:s.body,segmentId:s.segmentId});else if(s.t===J.DELETE){if(s.body==null)throw new Error("Can not invert DELETE action without body property, makeInvertible must be called first.");n.push({t:J.INSERT,body:s.body,len:s.len,line:0,segmentId:s.segmentId})}else if(s.body!=null){if(s.oldBody==null)throw new Error("Can not invert RETAIN action without oldBody property, makeInvertible must be called first.");n.push({t:J.RETAIN,body:s.oldBody,oldBody:s.body,len:s.len,coverType:xt.REPLACE,segmentId:s.segmentId})}else n.push(s);return n}static makeInvertible(e,n){const s=[];let r=0;for(const i of e){if(i.t===J.DELETE&&i.body==null){const o=qe(n,r,r+i.len,!1);i.body=o}if(i.t===J.RETAIN&&i.body!=null){const{textRuns:o}=qe(n,r,r+i.len,!0);i.oldBody={dataStream:"",textRuns:o}}s.push(i),i.t!==J.INSERT&&(r+=i.len)}return s}insert(e,n,s=""){const r={t:J.INSERT,body:n,len:e,line:0,segmentId:s};return this.push(r),this}retain(e,n="",s,r){const i={t:J.RETAIN,len:e,segmentId:n};return s!=null&&(i.body=s),r!=null&&(i.coverType=r),this.push(i),this}delete(e,n=""){const s={t:J.DELETE,len:e,line:0,segmentId:n};return this.push(s),this}serialize(){return this._actions}push(...e){if(e.length>1){for(const i of e)this.push(i);return this}let n=this._actions.length,s=this._actions[n-1];const r=y.deepClone(e[0]);if(r.t===J.RETAIN&&r.len===0&&r.body==null)return this;if(typeof s=="object"){if(s.t===J.DELETE&&r.t===J.DELETE)return s.len+=r.len,this;if(s.t===J.DELETE&&r.t===J.INSERT&&(n-=1,s=this._actions[n-1],s==null))return this._actions.unshift(r),this;if(s.t===J.RETAIN&&r.t===J.RETAIN&&s.body==null&&r.body==null)return s.len+=r.len,this;if(s.t===J.INSERT&&js(s.body)&&r.t===J.INSERT&&js(r.body))return s.len+=r.len,s.body.dataStream+=r.body.dataStream,this}return n===this._actions.length?this._actions.push(r):this._actions.splice(n,0,r),this}trimEndUselessRetainAction(){let e=this._actions[this._actions.length-1];for(;e&&e.t===J.RETAIN&&fa(e);)this._actions.pop(),e=this._actions[this._actions.length-1];return this}};_(Ye,"id","text-x"),_(Ye,"uri","https://github.com/dream-num/univer#text-x");let me=Ye;Object.defineProperty(me,"name",{value:"text-x"});const Le=class Le{static registerSubtype(e){var n;this._subTypes.has(e.name)&&((n=this._subTypes.get(e.name))==null?void 0:n.id)!==me.id||(this._subTypes.set(e.name,e),Bt.type.registerSubtype(e))}static apply(e,n){if(!Bt.type.isNoop(n))return Bt.type.apply(e,n)}static compose(e,n){return Bt.type.compose(e,n)}static transform(e,n,s){throw new Error("transform is not implemented in JsonX")}static invertWithDoc(e,n){return Bt.type.invertWithDoc(e,n)}static isNoop(e){return Bt.type.isNoop(e)}static getInstance(){return this._instance==null&&(this._instance=new Le),this._instance}removeOp(e,n){return Bt.removeOp(e,n)}moveOp(e,n){return Bt.moveOp(e,n)}insertOp(e,n){return Bt.insertOp(e,n)}replaceOp(e,n,s){return Bt.replaceOp(e,n,s)}editOp(e){return Bt.editOp(["body"],me.name,e)}};_(Le,"uri","https://github.com/dream-num/univer#json-x"),_(Le,"_subTypes",new Map),_(Le,"_instance",null);let ve=Le;ve.registerSubtype(me);const Ns={id:"default_doc",documentStyle:{}};class wa extends Mn{constructor(n){super();_(this,"type",et.UNIVER_DOC);_(this,"snapshot");this.snapshot={...Ns,...n}}getUnitId(){throw new Error("Method not implemented.")}get drawings(){return this.snapshot.drawings}get documentStyle(){return this.snapshot.documentStyle}get lists(){return this.snapshot.lists}get zoomRatio(){var n;return((n=this.snapshot.settings)==null?void 0:n.zoomRatio)||1}resetDrawing(n,s){this.snapshot.drawings=n,this.snapshot.drawingsOrder=s}getBody(){return this.snapshot.body}getShouldRenderLoopImmediately(){return this.snapshot.shouldStartRenderingImmediately!==!1}getContainer(){return this.snapshot.container}getSnapshot(){return this.snapshot}updateDocumentId(n){this.snapshot.id=n}updateDocumentRenderConfig(n){const{documentStyle:s}=this.snapshot;s.renderConfig==null?s.renderConfig=n:s.renderConfig={...s.renderConfig,...n}}updateDocumentStyle(n){this.snapshot.documentStyle==null?this.snapshot.documentStyle=n:this.snapshot.documentStyle={...this.snapshot.documentStyle,...n}}updateDocumentDataMargin(n){const{t:s,l:r,b:i,r:o}=n,{documentStyle:l}=this.snapshot;s!=null&&(l.marginTop=s),r!=null&&(l.marginLeft=r),i!=null&&(l.marginBottom=i),o!=null&&(l.marginRight=o)}updateDocumentDataPageSize(n,s){const{documentStyle:r}=this.snapshot;if(!r.pageSize){n=n!=null?n:Number.POSITIVE_INFINITY,s=s!=null?s:Number.POSITIVE_INFINITY,r.pageSize={width:n,height:s};return}n!==void 0&&(r.pageSize.width=n),s!==void 0&&(r.pageSize.height=s)}updateDrawing(n,s){const{drawings:r}=this,{width:i,height:o,left:l,top:a}=s,h=r==null?void 0:r[n];if(!h)return;const c=h.docTransform;c.size.width=i,c.size.height=o,c.positionH.posOffset=l,c.positionV.posOffset=a}setZoomRatio(n=1){this.snapshot.settings==null?this.snapshot.settings={zoomRatio:n}:this.snapshot.settings.zoomRatio=1}}class Ae extends wa{constructor(n){var r;super(y.isEmptyObject(n)?_a():n);_(this,"_unitId");_(this,"headerModelMap",new Map);_(this,"footerModelMap",new Map);const s=6;this._unitId=(r=this.snapshot.id)!=null?r:y.generateRandomId(s),this._initializeHeaderFooterModel()}dispose(){this.headerModelMap.forEach(n=>{n.dispose()}),this.footerModelMap.forEach(n=>{n.dispose()})}getDrawings(){return this.snapshot.drawings}getDrawingsOrder(){return this.snapshot.drawingsOrder}getRev(){var n;return(n=this.snapshot.rev)!=null?n:1}incrementRev(){this.snapshot.rev=this.getRev()+1}getSettings(){return this.snapshot.settings}reset(n){if(n.id&&n.id!==this._unitId)throw new Error("Cannot reset a document model with a different unit id!");this.snapshot={...Ns,...n},this._initializeHeaderFooterModel()}getSelfOrHeaderFooterModel(n){if(n!=null){if(this.headerModelMap.has(n))return this.headerModelMap.get(n);if(this.footerModelMap.has(n))return this.footerModelMap.get(n)}return this}getUnitId(){return this._unitId}apply(n){if(!ve.isNoop(n))return ve.apply(this.snapshot,n)}sliceBody(n,s){const r=this.getBody();if(r!=null)return qe(r,n,s)}_initializeHeaderFooterModel(){const{headers:n,footers:s}=this.getSnapshot();if(n)for(const r in n){const i=n[r];this.headerModelMap.set(r,new Ae(i))}if(s)for(const r in s){const i=s[r];this.footerModelMap.set(r,new Ae(i))}}updateDocumentId(n){super.updateDocumentId(n),this._unitId=n}}const Mi=ut.createIdentifier("univer.config-service");class Ui{constructor(){_(this,"_config",new Map)}getConfig(e){return this._config.get(e)}setConfig(e,n){this._config.set(e,n)}deleteConfig(e){this._config.delete(e)}}class Li extends yt{constructor(){super(...arguments);_(this,"_error$",new it.Subject);_(this,"error$",this._error$.asObservable())}dispose(){this._error$.complete()}emit(n){this._error$.next({errorKey:n})}}class Di{constructor(e={}){_(this,"_styles");_(this,"_cacheMap",new ii(1e5));this._styles=e,this._generateCacheMap()}each(e){return Object.entries(this._styles).forEach(e),this}search(e,n){if(this._cacheMap.has(n))return this._cacheMap.get(n);const s=this._getExistingStyleId(e);return s||"-1"}get(e){return typeof e!="string"?e:(e=String(e),this._styles[e])}add(e,n){const s=y.generateRandomId(6);return this._styles[s]=e,this._cacheMap.set(n,s),s}setValue(e){if(e==null)return;const n=JSON.stringify(e),s=this.search(e,n);return s!=="-1"?s:this.add(e,n)}toJSON(){return this._styles}getStyleByCell(e){let n;e&&y.isObject(e.s)?n=e.s:n=(e==null?void 0:e.s)&&this.get(e.s);const s=e==null?void 0:e.interceptorStyle;return s?{...n,...s}:n}_generateCacheMap(){const{_styles:e,_cacheMap:n}=this;for(const s in e){const r=JSON.stringify(e[s]);n.set(r,s)}}_getExistingStyleId(e){const{_styles:n}=this;for(const s in n)if(y.diffValue(n[s],e))return s;return null}}class Ta{constructor(e,n){_(this,"_columnData",{});this._config=e,this._columnData=n}getColumnData(){return this._columnData}getColVisible(e){const{_columnData:n}=this,s=n[e];return s?s.hd!==q.TRUE:!0}getHiddenCols(e=0,n=this.getSize()-1){const s=[];let r=!1,i=-1;for(let o=e;o<=n;o++){const l=this.getColVisible(o);r&&l?(r=!1,s.push({rangeType:rt.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!r&&!l&&(r=!0,i=o)}return r&&s.push({startRow:0,endRow:0,startColumn:i,endColumn:n,rangeType:rt.COLUMN}),s}getVisibleCols(e=0,n=this.getSize()-1){const s=[];let r=!1,i=-1;for(let o=e;o<=n;o++){const l=this.getColVisible(o);r&&!l?(r=!1,s.push({rangeType:rt.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!r&&l&&(r=!0,i=o)}return r&&s.push({startRow:0,endRow:0,startColumn:i,endColumn:n,rangeType:rt.COLUMN}),s}getColumnDatas(e,n){const s={};let r=0;for(let i=e;i<e+n;i++){const o=this.getColumnOrCreate(i);s[r]=o,r++}return s}getSize(){return _e(this._columnData)}getColumnWidth(e){const{_columnData:n}=this,s=this._config;let r=0;return r=(n[e]||{hd:q.FALSE,w:s.defaultColumnWidth}).w||s.defaultColumnWidth,r}getColumn(e){const n=this._columnData[e];if(n)return n}getColumnOrCreate(e){const{_columnData:n}=this,s=this._config,r=n[e];if(r)return r;const i={w:s.defaultColumnWidth,hd:q.FALSE};return this._columnData[e]=i,i}}class Ma{constructor(e,n,s){_(this,"_rowData");this._config=e,this._viewModel=n,this._rowData=s}getRowData(){return this._rowData}getRowDatas(e,n){const s={};let r=0;for(let i=e;i<e+n;i++){const o=this.getRowOrCreate(i);s[r]=o,r++}return s}getRowHeight(e,n=1){const{_rowData:s}=this,r=this._config;let i=0;for(let o=0;o<n;o++){const l=s[o+e]||{hd:q.FALSE,h:r.defaultRowHeight},{ia:a,ah:h,h:c=r.defaultRowHeight}=l;i+=(a==null||a===q.TRUE)&&typeof h=="number"?h:c}return i}getRow(e){return this._rowData[e]}getRowOrCreate(e){const{_rowData:n}=this,s=n[e];if(s)return s;const r=this._config,i={hd:q.FALSE,h:r.defaultRowHeight};return n[e]=i,i}getHiddenRows(e=0,n=this.getSize()-1){const s=[];let r=!1,i=-1;for(let o=e;o<=n;o++){const l=this.getRowRawVisible(o);r&&l?(r=!1,s.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:rt.ROW})):!r&&!l&&(r=!0,i=o)}return r&&s.push({startRow:i,endRow:n,startColumn:0,endColumn:0,rangeType:rt.ROW}),s}getVisibleRows(e=0,n=this.getSize()-1){const s=[];let r=!1,i=-1;for(let o=e;o<=n;o++){const l=this.getRowRawVisible(o);r&&!l?(r=!1,s.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:rt.ROW})):!r&&l&&(r=!0,i=o)}return r&&s.push({startRow:i,endRow:n,startColumn:0,endColumn:0,rangeType:rt.ROW}),s}getRowRawVisible(e){const n=this.getRow(e);return n?n.hd!==q.TRUE:!0}getSize(){return _e(this._rowData)}}const Ua="DEFAULT_WORKSHEET_ROW_COUNT",yi=1e3,La="DEFAULT_WORKSHEET_COLUMN_COUNT",Pi=20,Da="DEFAULT_WORKSHEET_ROW_HEIGHT",xi=24,ya="DEFAULT_WORKSHEET_COLUMN_WIDTH",ki=88,Pa="DEFAULT_WORKSHEET_ROW_TITLE_WIDTH",Hi=46,xa="DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT",Fi=20;function Bi(t){const e={name:"Sheet1",id:"sheet-01",tabColor:"",hidden:q.FALSE,rowCount:yi,columnCount:Pi,zoomRatio:1,freeze:{xSplit:0,ySplit:0,startRow:-1,startColumn:-1},scrollTop:0,scrollLeft:0,defaultColumnWidth:ki,defaultRowHeight:xi,mergeData:[],cellData:{},rowData:{},columnData:{},showGridlines:q.TRUE,rowHeader:{width:Hi,hidden:q.FALSE},columnHeader:{height:Fi,hidden:q.FALSE},selections:["A1"],rightToLeft:q.FALSE};return Object.keys(e).forEach(n=>{const s=n;typeof t[s]>"u"&&(t[s]=e[s])}),t}class Wi extends yt{constructor(n){super();_(this,"_cellContentInterceptor",null);_(this,"_rowFilteredInterceptor",null);this.getRawCell=n}dispose(){super.dispose(),this._cellContentInterceptor=null,this._rowFilteredInterceptor=null}getCell(n,s){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,s):this.getRawCell(n,s)}getRowFiltered(n){var s,r;return(r=(s=this._rowFilteredInterceptor)==null?void 0:s.getRowFiltered(n))!=null?r:!1}registerCellContentInterceptor(n){if(this._cellContentInterceptor)throw new Error("[SheetViewModel]: Interceptor already registered.");return this._cellContentInterceptor=n,vt(()=>this._cellContentInterceptor=null)}registerRowFilteredInterceptor(n){if(this._rowFilteredInterceptor)throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowFilteredInterceptor=n,vt(()=>this._rowFilteredInterceptor=null)}}class Je{constructor(e,n,s){_(this,"_sheetId");_(this,"_snapshot");_(this,"_cellData");_(this,"_rowManager");_(this,"_columnManager");_(this,"_viewModel");var l;this.unitId=e,this._styles=s,this._snapshot=Bi(n);const{columnData:r,rowData:i,cellData:o}=this._snapshot;this._sheetId=(l=this._snapshot.id)!=null?l:y.generateRandomId(6),this._cellData=new ee(o),this._viewModel=new Wi((a,h)=>this.getCellRaw(a,h)),this._rowManager=new Ma(this._snapshot,this._viewModel,i),this._columnManager=new Ta(this._snapshot,r)}__interceptViewModel(e){e(this._viewModel)}getSnapshot(){return this._snapshot}getCellMatrix(){return this._cellData}getCellMatrixPrintRange(){const e=this.getCellMatrix(),n=this.getMergeData();let s=-1,r=-1,i=-1,o=-1,l=!1,a=!1;return e.forEach((h,c)=>{Object.keys(c).forEach(u=>{const d=+u,f=e.getValue(h,d),m=f!=null&&f.s?this._styles.get(f.s):null,p=(m==null?void 0:m.bd)&&(m.bd.b||m.bd.l||m.bd.r||m.bd.t||m.bd.bc_tr||m.bd.bl_tr||m.bd.ml_tr||m.bd.tl_bc||m.bd.tl_br||m.bd.tl_mr);(f&&(f.v||f.p)||m!=null&&m.bg||p)&&(l?s=Math.min(s,h):(s=h,l=!0),r=Math.max(r,h),a?i=Math.min(i,d):(a=!0,i=d),o=Math.max(o,d))})}),n.forEach(h=>{l?s=Math.min(s,h.startRow):(s=h.startRow,l=!0),r=Math.max(r,h.endRow),a?i=Math.min(i,h.startColumn):(i=h.startColumn,l=!0),o=Math.max(o,h.endColumn)}),!l||!a?null:{startColumn:i,startRow:s,endColumn:o,endRow:r}}getRowManager(){return this._rowManager}getUnitId(){return this.unitId}getSheetId(){return this._sheetId}getColumnManager(){return this._columnManager}getName(){return this._snapshot.name}clone(){const{_snapshot:e}=this,n=y.deepClone(e);return new Je(this.unitId,n,this._styles)}getMergeData(){return this._snapshot.mergeData}getMergedCell(e,n){const s=this._snapshot.mergeData;for(let r=0;r<s.length;r++){const i=s[r];if(ge.intersects({startRow:e,startColumn:n,endRow:e,endColumn:n},i))return i}return null}getCell(e,n){return e<0||n<0?null:this._viewModel.getCell(e,n)}getCellRaw(e,n){return this.getCellMatrix().getValue(e,n)}getRowFiltered(e){return this._viewModel.getRowFiltered(e)}getMatrixWithMergedCells(e,n,s,r,i=!1){const o=this.getCellMatrix(),l=this._snapshot.mergeData.filter(h=>ge.intersects({startRow:e,startColumn:n,endRow:s,endColumn:r},h)),a=new ee;return Jn(e,s,n,r).forEach((h,c)=>{const u=i?this.getCellRaw(h,c):this.getCell(h,c);u&&a.setValue(h,c,u)}),l.forEach(h=>{const{startColumn:c,startRow:u,endColumn:d,endRow:f}=h;Jn(u,f,c,d).forEach((m,p)=>{m===u&&p===c&&a.setValue(m,p,{...o.getValue(m,p),rowSpan:f-u+1,colSpan:d-c+1}),(m!==u||p!==c)&&a.realDeleteValue(m,p)})}),a}getRange(e,n,s,r){return typeof e=="object"?new Pe(this,e,{getStyles:()=>this._styles}):new Pe(this,{startRow:e,startColumn:n,endColumn:r||n,endRow:s||e},{getStyles:()=>this._styles})}getScrollLeftTopFromSnapshot(){return{scrollLeft:this._snapshot.scrollLeft,scrollTop:this._snapshot.scrollTop}}getZoomRatio(){return this._snapshot.zoomRatio||1}getConfig(){return this._snapshot}getFreeze(){return this._snapshot.freeze}getMaxColumns(){const{_snapshot:e}=this,{columnCount:n}=e;return n}getMaxRows(){const{_snapshot:e}=this,{rowCount:n}=e;return n}getRowCount(){return this._snapshot.rowCount}setRowCount(e){this._snapshot.rowCount=e}getColumnCount(){return this._snapshot.columnCount}setColumnCount(e){this._snapshot.columnCount=e}isSheetHidden(){return this._snapshot.hidden}hasHiddenGridlines(){const{_snapshot:e}=this,{showGridlines:n}=e;return n===0}getTabColor(){const{_snapshot:e}=this,{tabColor:n}=e;return n}getColumnWidth(e){return this.getColumnManager().getColumnWidth(e)}getRowHeight(e){return this._viewModel.getRowFiltered(e)?0:this.getRowManager().getRowHeight(e)}getRowVisible(e){return this._viewModel.getRowFiltered(e)?!1:this.getRowRawVisible(e)}getRowRawVisible(e){return this.getRowManager().getRowRawVisible(e)}getHiddenRows(e,n){const s=this.getMaxColumns()-1,r=this._rowManager.getHiddenRows(e,n);return r.forEach(i=>i.endColumn=s),r}getColVisible(e){return this._columnManager.getColVisible(e)}getHiddenCols(e,n){const s=this.getMaxRows()-1,r=this._columnManager.getHiddenCols(e,n);return r.forEach(i=>i.endRow=s),r}getVisibleRows(){const e=this.getRowCount();return this._rowManager.getVisibleRows(0,e-1)}getVisibleCols(){const e=this.getColumnCount();return this._columnManager.getVisibleCols(0,e-1)}isRightToLeft(){const{_snapshot:e}=this,{rightToLeft:n}=e;return n}getLastRowWithContent(){return this._cellData.getLength()-1}getLastColumnWithContent(){return this._cellData.getRange().endColumn}cellHasValue(e){return e&&(e.v!==void 0||e.f!==void 0||e.p!==void 0)}iterateByRow(e,n=!0){const{startRow:s,startColumn:r,endRow:i,endColumn:o}=e,l=this;return{[Symbol.iterator]:()=>{let a=s,h=r;return{next(){for(;;){if(h>o&&(a+=1,h=r),a>i)return{done:!0,value:void 0};const c=l.getCell(a,h),u=!c,d=l.getMergedCell(a,h);if(d){if(a!==d.startRow||h!==d.startColumn){h=d.endColumn+1;continue}if(u&&n){h=d.endColumn+1;continue}const m={row:a,col:h,value:c};return m.colSpan=d.endColumn-d.startColumn+1,m.rowSpan=d.endRow-d.startRow+1,h=d.endColumn+1,{done:!1,value:m}}if(u&&n)h+=1;else{const f={row:a,col:h,value:c};return h+=1,{done:!1,value:f}}}}}}}}iterateByColumn(e,n=!0,s=!0){const{startRow:r,startColumn:i,endRow:o,endColumn:l}=e,a=this;return{[Symbol.iterator]:()=>{let h=r,c=i;return{next(){for(;;){if(h>o&&(c+=1,h=r),c>l)return{done:!0,value:void 0};const u=a.getMergedCell(h,c);if(u){const m=h!==u.startRow,p=m||c!==u.startColumn;if(s&&p||!s&&m){h=u.endRow+1;continue}const x=a.getCell(u.startRow,u.startColumn);if(!x&&n){h=u.endRow+1;continue}const Z={row:h,col:u.startColumn,value:x};return Z.colSpan=u.endColumn-u.startColumn+1,Z.rowSpan=u.endRow-u.startRow+1,h=u.endRow+1,{done:!1,value:Z}}const d=a.getCell(h,c);if(!d&&n)h+=1;else{const m={row:h,col:c,value:d};return h+=1,{done:!1,value:m}}}}}}}}}function ka(t){var s,r;if(!t)return"";const e=(r=(s=t.p)==null?void 0:s.body)==null?void 0:r.dataStream;if(e)return e;const n=t.v;return typeof n=="string"?t.t===Ne.BOOLEAN?n.toUpperCase():n.replace(/[\r\n]/g,""):typeof n=="number"?t.t===Ne.BOOLEAN?n?"TRUE":"FALSE":n.toString():typeof n=="boolean"?n?"TRUE":"FALSE":""}const Ha="0.1.16";function Fa(t="",e=we.ZH_CN,n=""){return{id:t,sheetOrder:[],name:n,appVersion:Ha,locale:e,styles:{},sheets:{},resources:[]}}var Ba=Object.defineProperty,Wa=Object.getOwnPropertyDescriptor,$a=(t,e,n,s)=>{for(var r=s>1?void 0:s?Wa(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(s?o(e,n,r):o(r))||r);return s&&r&&Ba(e,n,r),r},Ga=(t,e)=>(n,s)=>e(n,s,t);function ja(t,e){return`${t.getUnitId()}|${e.getSheetId()}`}exports.Workbook=class extends Mn{constructor(n={},s){super();_(this,"type",et.UNIVER_SHEET);_(this,"_sheetCreated$",new it.Subject);_(this,"sheetCreated$",this._sheetCreated$.asObservable());_(this,"_sheetDisposed$",new it.Subject);_(this,"sheetDisposed$",this._sheetDisposed$.asObservable());_(this,"_activeSheet$",new it.BehaviorSubject(null));_(this,"activeSheet$",this._activeSheet$.asObservable());_(this,"_worksheets");_(this,"_styles");_(this,"_snapshot");_(this,"_unitId");_(this,"_count");_(this,"_name$");_(this,"name$");this._logService=s;const r=Fa();y.isEmptyObject(n)?this._snapshot=r:this._snapshot=y.commonExtend(r,n);const{styles:i}=this._snapshot;(this._snapshot.id==null||this._snapshot.id.length===0)&&(this._snapshot.id=y.generateRandomId(6)),this._unitId=this._snapshot.id,this._styles=new Di(i),this._count=1,this._worksheets=new Map,this._name$=new it.BehaviorSubject(n.name||""),this.name$=this._name$.asObservable(),this._passWorksheetSnapshots()}get _activeSheet(){return this._activeSheet$.getValue()}get name(){return this._name$.getValue()}dispose(){super.dispose(),this._sheetCreated$.complete(),this._sheetDisposed$.complete(),this._activeSheet$.complete(),this._name$.complete()}save(){return y.deepClone(this._snapshot)}static isIRangeType(n){return typeof n=="string"||"startRow"in n||"row"in n}getSnapshot(){return this._snapshot}getName(){return this._snapshot.name}setName(n){this._name$.next(n),this._snapshot.name=n}getUnitId(){return this._unitId}getRev(){var n;return(n=this._snapshot.rev)!=null?n:1}incrementRev(){this._snapshot.rev=this.getRev()+1}getShouldRenderLoopImmediately(){return this._snapshot.shouldStartRenderingImmediately!==!1}getContainer(){return this._snapshot.container}addWorksheet(n,s,r){const{sheets:i,sheetOrder:o}=this._snapshot;if(i[n])return!1;i[n]=r,o.splice(s,0,n);const l=new Je(this._unitId,r,this._styles);return this._worksheets.set(n,l),this._sheetCreated$.next(l),!0}getSheetOrders(){return this._snapshot.sheetOrder}getWorksheets(){return this._worksheets}getActiveSpreadsheet(){return this}getStyles(){return this._styles}getConfig(){return this._snapshot}getIndexBySheetId(n){const{sheetOrder:s}=this._snapshot;return s.findIndex(r=>r===n)}getActiveSheet(){return this._activeSheet}ensureActiveSheet(){const n=this.getActiveSheet();if(n)return n;const s=this._snapshot.sheetOrder;for(let i=0,o=s.length;i<o;i++){const l=this._worksheets.get(s[i]);if(l&&l.isSheetHidden()!==q.TRUE)return this.setActiveSheet(l),l}const r=this._worksheets.get(s[0]);return this.setActiveSheet(r),r}setActiveSheet(n){this._activeSheet$.next(n)}removeSheet(n){var r;const s=this._worksheets.get(n);return s?(((r=this._activeSheet)==null?void 0:r.getSheetId())===n&&this.setActiveSheet(null),this._worksheets.delete(n),this._snapshot.sheetOrder.splice(this._snapshot.sheetOrder.indexOf(n),1),delete this._snapshot.sheets[n],this._sheetDisposed$.next(s),!0):!1}getActiveSheetIndex(){const{sheetOrder:n}=this._snapshot;return n.findIndex(s=>this._worksheets.get(s)===this._activeSheet)}getSheetSize(){return this._snapshot.sheetOrder.length}getSheets(){const{sheetOrder:n}=this._snapshot;return n.map(s=>this._worksheets.get(s))}getSheetsName(){const{sheetOrder:n}=this._snapshot,s=[];return n.forEach(r=>{const i=this._worksheets.get(r);i&&s.push(i.getName())}),s}getSheetIndex(n){const{sheetOrder:s}=this._snapshot;return s.findIndex(r=>n.getSheetId()===r)}getSheetBySheetName(n){const{sheetOrder:s}=this._snapshot,r=s.find(i=>this._worksheets.get(i).getName()===n);return this._worksheets.get(r)}getSheetBySheetId(n){return this._worksheets.get(n)}getSheetByIndex(n){const{sheetOrder:s}=this._snapshot;return this._worksheets.get(s[n])}getHiddenWorksheets(){return this.getSheets().filter(n=>n.getConfig().hidden===q.TRUE).map(n=>n.getConfig().id)}load(n){this._snapshot=n}checkSheetName(n){return this.getSheetsName().includes(n)}uniqueSheetName(n="Sheet1"){let s=n;for(;this.checkSheetName(s);)s=n+this._count,this._count++;return s}generateNewSheetName(n){let s=n+this._count;for(;this.checkSheetName(s);)s=n+this._count,this._count++;return s}_passWorksheetSnapshots(){const{_snapshot:n,_worksheets:s}=this,{sheets:r,sheetOrder:i}=n;if(y.isEmptyObject(r)){const o=y.generateRandomId();r[o]={id:o}}for(const o in r){const l=r[o],{name:a}=l;l.name=this.uniqueSheetName(a),l.name!==a&&this._logService.debug("[Workbook]",`The worksheet name ${a} is duplicated, we changed it to ${l.name}. Please fix the problem in your snapshot.`);const h=new Je(this._unitId,l,this._styles);s.set(o,h),i.includes(o)||i.push(o)}this.ensureActiveSheet()}};exports.Workbook=$a([Ga(1,pe)],exports.Workbook);class bs extends Mn{constructor(n){var s;super();_(this,"type",et.UNIVER_SLIDE);_(this,"_snapshot");_(this,"_unitId");this._snapshot={...ai,...n},this._unitId=(s=this._snapshot.id)!=null?s:y.generateRandomId(6)}getContainer(){return this._snapshot.container}getSnapshot(){return this._snapshot}getUnitId(){return this._unitId}getPages(){var n;return(n=this._snapshot.body)==null?void 0:n.pages}getPageOrder(){var n;return(n=this._snapshot.body)==null?void 0:n.pageOrder}getPage(n){const s=this.getPages();return s==null?void 0:s[n]}getElementsByPage(n){var s;return(s=this.getPage(n))==null?void 0:s.pageElements}getElement(n,s){var r;return(r=this.getElementsByPage(n))==null?void 0:r[s]}getPageSize(){return this._snapshot.pageSize}addPage(){return{id:"cover_1",pageType:ls.SLIDE,zIndex:1,title:"cover",description:"this is first page, cover",pageBackgroundFill:{rgb:"rgb(255,255,255)"},pageElements:{}}}}const je="FOCUSING_SHEET",fn="FOCUSING_DOC",_n="FOCUSING_SLIDE",Va="FOCUSING_EDITOR_BUT_HIDDEN",$i="EDITOR_ACTIVATED",Ka="FOCUSING_EDITOR_INPUT_FORMULA",Gi="FOCUSING_FORMULA_EDITOR",Ya="FOCUSING_UNIVER_EDITOR",za="FOCUSING_EDITOR_INPUT_FORMULA",Xa="FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE",qa="FOCUSING_COMMON_DRAWINGS";var Ja=Object.defineProperty,Za=Object.getOwnPropertyDescriptor,Qa=(t,e,n,s)=>{for(var r=s>1?void 0:s?Za(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(s?o(e,n,r):o(r))||r);return s&&r&&Ja(e,n,r),r},Vs=(t,e)=>(n,s)=>e(n,s,t);const xe=ut.createIdentifier("univer.current");exports.UniverInstanceService=class extends yt{constructor(n,s){super();_(this,"_unitsByType",new Map);_(this,"_createHandler");_(this,"_ctorByType",new Map);_(this,"_currentUnits",new Map);_(this,"_currentUnits$",new it.BehaviorSubject(this._currentUnits));_(this,"currentUnits$",this._currentUnits$.asObservable());_(this,"_unitAdded$",new it.Subject);_(this,"unitAdded$",this._unitAdded$.asObservable());_(this,"_unitDisposed$",new it.Subject);_(this,"unitDisposed$",this._unitDisposed$.asObservable());_(this,"_focused$",new it.BehaviorSubject(null));_(this,"focused$",this._focused$.asObservable());this._injector=n,this._contextService=s}dispose(){super.dispose(),this._focused$.complete()}__setCreateHandler(n){this._createHandler=n}createUnit(n,s){return this._createHandler(n,s,this._ctorByType.get(n))}registerCtorForType(n,s){return this._ctorByType.set(n,s),{dispose:()=>{this._ctorByType.delete(n)}}}getCurrentTypeOfUnit$(n){return this.currentUnits$.pipe(it.map(s=>{var r;return(r=s.get(n))!=null?r:null}),it.distinctUntilChanged())}getCurrentUnitForType(n){return this._currentUnits.get(n)}setCurrentUnitForType(n){const s=this._getUnitById(n);if(!s)throw new Error(`[UniverInstanceService]: no document with unitId ${n}!`);this._currentUnits.set(s[1],s[0]),this._currentUnits$.next(this._currentUnits)}_removeCurrentUnitForType(n){this._currentUnits.set(n,null),this._currentUnits$.next(this._currentUnits)}getTypeOfUnitAdded$(n){return this._unitAdded$.pipe(it.filter(s=>s.type===n))}__addUnit(n){const s=n.type;this._unitsByType.has(s)||this._unitsByType.set(s,[]),this._unitsByType.get(s).push(n),this._unitAdded$.next(n),this.setCurrentUnitForType(n.getUnitId())}getTypeOfUnitDisposed$(n){return this.unitDisposed$.pipe(it.filter(s=>s.type===n))}getUnit(n,s){var i;const r=(i=this._getUnitById(n))==null?void 0:i[0];return s&&(r==null?void 0:r.type)!==s?null:r}getCurrentUniverDocInstance(){return this.getCurrentUnitForType(et.UNIVER_DOC)}getUniverDocInstance(n){return this.getUnit(n,et.UNIVER_DOC)}getUniverSheetInstance(n){return this.getUnit(n,et.UNIVER_SHEET)}getAllUnitsForType(n){var s;return(s=this._unitsByType.get(n))!=null?s:[]}changeDoc(n,s){const r=this.getAllUnitsForType(et.UNIVER_DOC),i=r.find(o=>o.getUnitId()===n);if(i!=null){const o=r.indexOf(i);r.splice(o,1)}this.__addUnit(s)}get focused(){var s;const n=this._focused$.getValue();return n?(s=this._getUnitById(n))==null?void 0:s[0]:null}focusUnit(n){this._focused$.next(n),this.focused instanceof exports.Workbook?(this._contextService.setContextValue(fn,!1),this._contextService.setContextValue(je,!0),this._contextService.setContextValue(_n,!1)):this.focused instanceof Ae?(this._contextService.setContextValue(fn,!0),this._contextService.setContextValue(je,!1),this._contextService.setContextValue(_n,!1)):this.focused instanceof bs&&(this._contextService.setContextValue(fn,!1),this._contextService.setContextValue(je,!1),this._contextService.setContextValue(_n,!0))}getFocusedUnit(){return this.focused}getUnitType(n){const s=this._getUnitById(n);if(!s)throw new Error(`[UniverInstanceService]: No document with unitId ${n}`);return s[1]}disposeUnit(n){const s=this._getUnitById(n);if(!s)return!1;const[r,i]=s,o=this._unitsByType.get(i),l=o.indexOf(r);return o.splice(l,1),this._removeCurrentUnitForType(i),this._focused$.next(null),this._unitDisposed$.next(r),!0}_getUnitById(n){for(const[s,r]of this._unitsByType){const i=r.find(o=>o.getUnitId()===n);if(i)return[i,s]}}};exports.UniverInstanceService=Qa([Vs(0,ut.Inject(ut.Injector)),Vs(1,Ze)],exports.UniverInstanceService);var Ot=(t=>(t[t.Starting=0]="Starting",t[t.Ready=1]="Ready",t[t.Rendered=2]="Rendered",t[t.Steady=3]="Steady",t))(Ot||{});const tu={0:"Starting",1:"Ready",2:"Rendered",3:"Steady"},gn=new Map;function ji(t,e){return function(r){Un(t,e)}}function Un(t,e){gn.has(t)||gn.set(t,[]),gn.get(t).push(e)}var eu=Object.defineProperty,nu=Object.getOwnPropertyDescriptor,Vi=(t,e,n,s)=>{for(var r=s>1?void 0:s?nu(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(s?o(e,n,r):o(r))||r);return s&&r&&eu(e,n,r),r},ss=(t,e)=>(n,s)=>e(n,s,t);exports.LifecycleService=class extends yt{constructor(n){super();_(this,"_lifecycle$",new it.BehaviorSubject(Ot.Starting));_(this,"lifecycle$",this._lifecycle$.asObservable());_(this,"_lock",!1);this._logService=n,this._reportProgress(Ot.Starting)}get stage(){return this._lifecycle$.getValue()}set stage(n){if(n<this.stage)throw new Error("[LifecycleService]: lifecycle stage cannot go backward!");if(n!==this.stage){if(this._lock)throw new Error("[LifecycleService]: cannot set new stage when related logic is all handled!");this._lock=!0,this._reportProgress(n),this._lifecycle$.next(n),this._lock=!1}}dispose(){this._lifecycle$.complete(),super.dispose()}subscribeWithPrevious(){return new it.Observable(n=>{this.stage===Ot.Starting||(this.stage===Ot.Ready?n.next(Ot.Starting):this.stage===Ot.Rendered?(n.next(Ot.Starting),n.next(Ot.Ready)):(n.next(Ot.Starting),n.next(Ot.Ready),n.next(Ot.Rendered))),this._lifecycle$.subscribe(s=>{n.next(s),s===Ot.Steady&&n.complete()})})}_reportProgress(n){this._logService.debug("[LifecycleService]",`lifecycle progressed to "${tu[n]}".`)}};exports.LifecycleService=Vi([ss(0,pe)],exports.LifecycleService);exports.LifecycleInitializerService=class extends yt{constructor(n,s){super();_(this,"_seenTokens",new Set);this._lifecycleService=n,this._injector=s}initModulesOnStage(n){var s;(s=gn.get(n))==null||s.forEach(r=>{this._injector.has(r)&&!this._seenTokens.has(r)&&(this._injector.get(r),this._seenTokens.add(r))})}};exports.LifecycleInitializerService=Vi([ss(0,ut.Inject(exports.LifecycleService)),ss(1,ut.Inject(ut.Injector))],exports.LifecycleInitializerService);class Ve extends yt{constructor(){super();_(this,"_currentLocale$",new it.BehaviorSubject(we.ZH_CN));_(this,"currentLocale$",this._currentLocale$.asObservable());_(this,"_locales",null);_(this,"localeChanged$",new it.Subject);_(this,"t",(n,...s)=>{if(!this._locales)throw new Error("Locale not initialized");const r=n.split("."),i=this.resolveKeyPath(this._locales[this._currentLocale],r);if(typeof i=="string"){let o=i;return s.forEach((l,a)=>{o=o.replace(`{${a}}`,l)}),o}else return n});this.disposeWithMe(vt(()=>this.localeChanged$.complete()))}get _currentLocale(){return this._currentLocale$.value}load(n){var s;this._locales=y.deepMerge((s=this._locales)!=null?s:{},n)}setLocale(n){this._currentLocale$.next(n),this.localeChanged$.next()}getLocales(){var n;return(n=this._locales)==null?void 0:n[this._currentLocale]}getCurrentLocale(){return this._currentLocale}resolveKeyPath(n,s){const r=s.shift();if(r&&n&&r in n){const i=n[r];return s.length>0&&(typeof i=="object"||Array.isArray(i))?this.resolveKeyPath(i,s):i}return null}}var vs=(t=>(t.INIT="init",t.FETCHING="fetching",t.DONE="done",t))(vs||{});const As=ut.createIdentifier("univer.permission-service");Un(Ot.Starting,As);class Ki extends yt{constructor(){super(...arguments);_(this,"_permissionPointMap",new Map);_(this,"_permissionPointUpdate$",new it.Subject);_(this,"permissionPointUpdate$",this._permissionPointUpdate$.asObservable())}deletePermissionPoint(n){const s=this._permissionPointMap.get(n);s&&(s.complete(),this._permissionPointMap.delete(n))}addPermissionPoint(n){const s=n instanceof it.BehaviorSubject,r=s?n.getValue():n;if(!r.id)return!1;if(this._permissionPointMap.get(r.id))throw new Error(`${r.id} PermissionPoint already exists`);return this._permissionPointMap.set(r.id,s?n:new it.BehaviorSubject(r)),this._permissionPointUpdate$.next(r),!0}updatePermissionPoint(n,s){const r=this._permissionPointMap.get(n);if(!r)return;const i=r.getValue();i.value=s,i.status=vs.DONE,r.next({...i}),this._permissionPointUpdate$.next(i)}clearPermissionMap(){this._permissionPointMap.clear()}getPermissionPoint(n){const s=this._permissionPointMap.get(n);if(s)return s.getValue()}getPermissionPoint$(n){const s=this._permissionPointMap.get(n);if(s)return s}composePermission$(n){const s=n.map(r=>{var o;const i=(o=this._permissionPointMap)==null?void 0:o.get(r);if(!i)throw new Error(`[PermissionService]: ${r} permissionPoint does not exist!`);return i.asObservable()});return it.combineLatest(s).pipe(un.map(r=>r))}composePermission(n){return n.map(r=>{var o;const i=(o=this._permissionPointMap)==null?void 0:o.get(r);if(!i)throw new Error(`[PermissionService]: ${r} permissionPoint does not exist!`);return i.getValue()})}getAllPermissionPoint(){const n=new Map;return this._permissionPointMap.forEach((s,r)=>{n.set(r,s)}),n}}class Yi extends yt{constructor(){super(...arguments);_(this,"_resourceMap",new Map);_(this,"_register$",new it.Subject);_(this,"register$",this._register$.asObservable())}getAllResourceHooks(){return[...this._resourceMap.values()]}getResources(n){return this.getAllResourceHooks().map(i=>{const o=i.toJson(n);return{name:i.pluginName,data:o}})}registerPluginResource(n){const s=n.pluginName;if(this._resourceMap.has(s))throw new Error(`the pluginName is registered {${s}}`);return this._resourceMap.set(s,n),this._register$.next(n),vt(()=>this._resourceMap.delete(s))}disposePluginResource(n){this._resourceMap.delete(n)}loadResources(n,s){this.getAllResourceHooks().forEach(r=>{var o;const i=(o=s==null?void 0:s.find(l=>l.name===r.pluginName))==null?void 0:o.data;if(i)try{const l=r.parseJson(i);r.onLoad(n,l)}catch{console.error("LoadResources Error!")}})}unloadResources(n){this.getAllResourceHooks().forEach(s=>{s.onUnLoad(n)})}dispose(){this._register$.complete(),this._resourceMap.clear()}}const Ln=ut.createIdentifier("resource-manager-service");var su=Object.defineProperty,ru=Object.getOwnPropertyDescriptor,iu=(t,e,n,s)=>{for(var r=s>1?void 0:s?ru(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(s?o(e,n,r):o(r))||r);return s&&r&&su(e,n,r),r},Ks=(t,e)=>(n,s)=>e(n,s,t);let rs=class extends yt{constructor(e,n){super();_(this,"saveWorkbook",e=>{const n=e.getUnitId(),s=this._resourceManagerService.getResources(n)||[],r=e.getSnapshot();return r.resources=s,r});this._resourceManagerService=e,this._univerInstanceService=n,this._init()}_init(){const e=s=>{s.businesses.forEach(r=>{switch(r){case et.UNRECOGNIZED:case et.UNIVER_UNKNOWN:case et.UNIVER_SLIDE:case et.UNIVER_DOC:break;case et.UNIVER_SHEET:this._univerInstanceService.getAllUnitsForType(et.UNIVER_SHEET).forEach(i=>{const l=(i.getSnapshot().resources||[]).find(a=>a.name===s.pluginName);if(l)try{const a=s.parseJson(l.data);s.onLoad(i.getUnitId(),a)}catch{console.error(`Load Workbook{${i.getUnitId()}} Resources{${s.pluginName}} Data Error.`)}})}})};this._resourceManagerService.getAllResourceHooks().forEach(s=>{e(s)}),this.disposeWithMe(this._resourceManagerService.register$.subscribe(s=>{e(s)})),this.disposeWithMe(vt(this._univerInstanceService.getTypeOfUnitAdded$(et.UNIVER_SHEET).subscribe(s=>{this._resourceManagerService.loadResources(s.getUnitId(),s.getSnapshot().resources)}))),this.disposeWithMe(vt(this._univerInstanceService.getTypeOfUnitDisposed$(et.UNIVER_SHEET).subscribe(s=>{this._resourceManagerService.unloadResources(s.getUnitId())})))}};rs=iu([Ks(0,ut.Inject(Ln)),Ks(1,ut.Inject(xe))],rs);const ws=ut.createIdentifier("resource-loader-service");Un(Ot.Ready,ws);class Ts extends yt{constructor(){super();_(this,"_currentTheme");_(this,"_currentTheme$",new it.BehaviorSubject({}));_(this,"currentTheme$",this._currentTheme$.asObservable());this.disposeWithMe(vt(()=>this._currentTheme$.complete()))}getCurrentTheme(){if(!this._currentTheme)throw new Error("[ThemeService]: current theme is not set!");return this._currentTheme}setTheme(n){this._currentTheme=n,this._currentTheme$.next(n)}}const zi="__defaultDocumentNormalEditorSpecialUnitId_20231006__",Xi="__defaultDocumentFormulaBarEditorSpecialUnitId_20231012__",ou=`\r
|
|
7
|
+
`;function lu(t){return`__internalEditorId__${t}`}function au(t){return t.startsWith("__")}var uu=Object.defineProperty,cu=Object.getOwnPropertyDescriptor,hu=(t,e,n,s)=>{for(var r=s>1?void 0:s?cu(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(s?o(e,n,r):o(r))||r);return s&&r&&uu(e,n,r),r},Gn=(t,e)=>(n,s)=>e(n,s,t);const Dn=ut.createIdentifier("univer.undo-redo.service"),du=20;class qi{dispose(){}async dispatchToHandlers(){return!1}}const Ji="univer.command.redo",Zi="univer.command.undo",Qi=new class extends qi{constructor(){super(...arguments);_(this,"type",Qe.COMMAND);_(this,"id",Zi)}async handler(e){const n=e.get(Dn),s=n.pitchTopUndoElement();if(!s)return!1;const r=e.get(tn);return hs(s.undoMutations,r)?(n.popUndoToRedo(),!0):!1}},to=new class extends qi{constructor(){super(...arguments);_(this,"type",Qe.COMMAND);_(this,"id",Ji)}async handler(e){const n=e.get(Dn),s=n.pitchTopRedoElement();if(!s)return!1;const r=e.get(tn);return hs(s.redoMutations,r)?(n.popRedoToUndo(),!0):!1}};exports.LocalUndoRedoService=class extends yt{constructor(n,s,r){super();_(this,"undoRedoStatus$");_(this,"_undoRedoStatus$",new it.BehaviorSubject({undos:0,redos:0}));_(this,"_undoStacks",new Map);_(this,"_redoStacks",new Map);_(this,"_batchingStatus",new Map);this._univerInstanceService=n,this._commandService=s,this._contextService=r,this.undoRedoStatus$=this._undoRedoStatus$.asObservable(),this.disposeWithMe(this._commandService.registerCommand(Qi)),this.disposeWithMe(this._commandService.registerCommand(to)),this.disposeWithMe(vt(()=>this._undoRedoStatus$.complete())),this.disposeWithMe(vt(this._univerInstanceService.focused$.subscribe(()=>this._updateStatus())))}pushUndoRedo(n){const{unitID:s}=n,r=this._getRedoStack(s,!0),i=this._getUndoStack(s,!0);if(r.length=0,this._batchingStatus.has(n.unitID)){const l=this._batchingStatus.get(n.unitID),a=this._pitchUndoElement(n.unitID);l===0||!a?(o(n),this._batchingStatus.set(n.unitID,1)):this._tryBatchingElements(a,n)}else o(n);function o(l){i.push(l),i.length>du&&i.splice(0,1)}this._updateStatus()}clearUndoRedo(n){const s=this._getRedoStack(n);s&&(s.length=0);const r=this._getUndoStack(n);r&&(r.length=0),this._updateStatus()}pitchTopUndoElement(){const n=this._getFocusedUnitId();return this._pitchUndoElement(n)}pitchTopRedoElement(){const n=this._getFocusedUnitId();return this._pitchRedoElement(n)}_pitchUndoElement(n){const s=this._getUndoStack(n);return s!=null&&s.length?s[s.length-1]:null}_pitchRedoElement(n){const s=this._getRedoStack(n);return s!=null&&s.length?s[s.length-1]:null}popUndoToRedo(){const s=this._getUndoStackForFocused().pop();s&&(this._getRedoStackForFocused().push(s),this._updateStatus())}popRedoToUndo(){const s=this._getRedoStackForFocused().pop();s&&(this._getUndoStackForFocused().push(s),this._updateStatus())}__tempBatchingUndoRedo(n){if(this._batchingStatus.has(n))throw new Error("[LocalUndoRedoService]: cannot batching undo redo twice at the same time!");return this._batchingStatus.set(n,0),vt(()=>this._batchingStatus.delete(n))}_updateStatus(){var i,o;const n=this._getFocusedUnitId(),s=n&&((i=this._undoStacks.get(n))==null?void 0:i.length)||0,r=n&&((o=this._redoStacks.get(n))==null?void 0:o.length)||0;this._undoRedoStatus$.next({undos:s,redos:r})}_getUndoStack(n,s=!1){let r=this._undoStacks.get(n);return!r&&s&&(r=[],this._undoStacks.set(n,r)),r||null}_getRedoStack(n,s=!1){let r=this._redoStacks.get(n);return!r&&s&&(r=[],this._redoStacks.set(n,r)),r||null}_getUndoStackForFocused(){const n=this._getFocusedUnitId();if(!n)throw new Error("No focused univer instance!");return this._getUndoStack(n,!0)}_getRedoStackForFocused(){const n=this._getFocusedUnitId();if(!n)throw new Error("No focused univer instance!");return this._getRedoStack(n,!0)}_tryBatchingElements(n,s){n.redoMutations.push(...s.redoMutations),n.undoMutations.push(...s.undoMutations)}_getFocusedUnitId(){var o,l,a,h;let n="";const s=this._contextService.getContextValue(je),r=this._contextService.getContextValue(Gi),i=this._contextService.getContextValue($i);return s?r?n=Xi:i?n=zi:n=(l=(o=this._univerInstanceService.getFocusedUnit())==null?void 0:o.getUnitId())!=null?l:"":n=(h=(a=this._univerInstanceService.getFocusedUnit())==null?void 0:a.getUnitId())!=null?h:"",n}};exports.LocalUndoRedoService=hu([Gn(0,xe),Gn(1,tn),Gn(2,Ze)],exports.LocalUndoRedoService);const eo=Symbol("DependentOn");class is extends yt{onStarting(e){}onReady(){}onRendered(){}onSteady(){}getUniverInstanceType(){return this.constructor.type}getPluginName(){return this.constructor.pluginName}}_(is,"pluginName"),_(is,"type",et.UNIVER_UNKNOWN);class fu{constructor(){_(this,"_plugins",[])}addPlugin(e){this._plugins.push(e)}removePlugins(){const e=this._plugins.slice();return this._plugins.length=0,e}forEachPlugin(e){this._plugins.forEach(e)}}class _u{constructor(){_(this,"_pluginsRegistered",[])}registerPlugin(e,n){this._pluginsRegistered.push({plugin:e,options:n})}getRegisterPlugins(){return this._pluginsRegistered.slice()}removePlugins(){this._pluginsRegistered=[]}}var gu=Object.defineProperty,mu=Object.getOwnPropertyDescriptor,no=(t,e,n,s)=>{for(var r=s>1?void 0:s?mu(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(s?o(e,n,r):o(r))||r);return s&&r&&gu(e,n,r),r},We=(t,e)=>(n,s)=>e(n,s,t);const pu=4;function Eu(...t){return function(e){e[eo]=t}}exports.PluginService=class{constructor(e){_(this,"_pluginHolderForUniver");_(this,"_pluginHoldersForTypes",new Map);_(this,"_seenPlugins",new Set);_(this,"_flushTimer");this._injector=e,this._pluginHolderForUniver=this._injector.createInstance(On,this._checkPluginSeen.bind(this),this._immediateInitPlugin.bind(this)),this._pluginHolderForUniver.start()}dispose(){this._clearFlushTimer();for(const e of this._pluginHoldersForTypes.values())e.dispose();this._pluginHolderForUniver.dispose()}registerPlugin(e,n){this._assertPluginValid(e),this._scheduleInitPlugin();const{type:s}=e;s===et.UNIVER_UNKNOWN?(this._pluginHolderForUniver.register(e,n),this._pluginHolderForUniver.flush()):this._ensurePluginHolderForType(s).register(e,n)}startPluginForType(e){this._ensurePluginHolderForType(e).start()}_ensurePluginHolderForType(e){if(!this._pluginHoldersForTypes.has(e)){const n=this._injector.createInstance(On,this._checkPluginSeen.bind(this),this._immediateInitPlugin.bind(this));return this._pluginHoldersForTypes.set(e,n),n}return this._pluginHoldersForTypes.get(e)}_immediateInitPlugin(e){this._seenPlugins.add(e.pluginName),this._ensurePluginHolderForType(e.type).immediateInitPlugin(e)}_checkPluginSeen(e){return this._seenPlugins.has(e.pluginName)}_assertPluginValid(e){const{type:n,pluginName:s}=e;if(n===et.UNRECOGNIZED)throw new Error(`[PluginService]: invalid plugin type for ${e}. Please assign a "type" to your plugin.`);if(s==="")throw new Error(`[PluginService]: no plugin name for ${e}. Please assign a "pluginName" to your plugin.`);if(this._seenPlugins.has(s))throw new Error(`[PluginService]: duplicated plugin name for "${s}". Maybe a plugin that dependents on "${s} has already registered it. In that case please register "${s}" before the that plugin.`);this._seenPlugins.add(e.pluginName)}_scheduleInitPlugin(){this._flushTimer===void 0&&(this._flushTimer=setTimeout(()=>{this._pluginHolderForUniver.started||this._pluginHolderForUniver.start(),this._flushPlugins(),this._clearFlushTimer()},pu))}_clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}_flushPlugins(){this._pluginHolderForUniver.flush();for(const[e,n]of this._pluginHoldersForTypes)n.started&&n.flush()}};exports.PluginService=no([We(0,ut.Inject(ut.Injector))],exports.PluginService);let On=class extends yt{constructor(e,n,s,r,i,o){super();_(this,"_started",!1);_(this,"_pluginRegistry",new _u);_(this,"_pluginStore",new fu);this._checkPluginRegistered=e,this._registerPlugin=n,this._logService=s,this._injector=r,this._lifecycleService=i,this._lifecycleInitializerService=o}get started(){return this._started}dispose(){super.dispose(),this._pluginStore.forEachPlugin(e=>e.dispose()),this._pluginStore.removePlugins(),this._pluginRegistry.removePlugins()}register(e,n){this._pluginRegistry.registerPlugin(e,n)}immediateInitPlugin(e){const n=this._initPlugin(e,void 0);this._pluginsRunLifecycle([n])}start(){this._started||(this._started=!0,this.flush())}flush(){if(!this._started)return;const e=this._pluginRegistry.getRegisterPlugins().map(({plugin:n,options:s})=>this._initPlugin(n,s));this._pluginsRunLifecycle(e),this._pluginRegistry.removePlugins()}_initPlugin(e,n){const s=e[eo];if(s){const i=()=>{const o=s.find(l=>!this._checkPluginRegistered(l));return o?(this._logService.warn("[PluginService]",`plugin "${e.pluginName}" depends on "${o.pluginName}" which is not registered. Univer will automatically register it with default configuration.`),this._registerPlugin(o,void 0),!0):!1};for(;i(););}const r=this._injector.createInstance(e,n);return this._pluginStore.addPlugin(r),r}_pluginsRunLifecycle(e){const n=r=>{e.forEach(i=>{switch(r){case Ot.Starting:i.onStarting(this._injector);break;case Ot.Ready:i.onReady();break;case Ot.Rendered:i.onRendered();break;case Ot.Steady:i.onSteady();break}this._lifecycleInitializerService.initModulesOnStage(r)})},s=this.disposeWithMe(this._lifecycleService.subscribeWithPrevious().pipe(it.finalize(()=>{Promise.resolve().then(()=>s.dispose())})).subscribe(r=>{n(r)}))}};On=no([We(2,pe),We(3,ut.Inject(ut.Injector)),We(4,ut.Inject(exports.LifecycleService)),We(5,ut.Inject(exports.LifecycleInitializerService))],On);function so(t,e){if(!e)return t;const n=[];for(const s of t){const r=e.find(([i])=>i===s[0]);if(r){if(r[1]===null)continue;n.push([s[0],r[1]])}else n.push(s)}return n}const os={[Ft.Editor]:"Editor",[Ft.Owner]:"Owner",[Ft.Reader]:"Reader",[Ft.UNRECOGNIZED]:"UNRECOGNIZED"},Sn=t=>t?{userID:`${os[t]}_${y.generateRandomId(8)}`,name:os[t],avatar:""}:{userID:"",name:"",avatar:"",anonymous:!0,canBindAnonymous:!1},jn=(t,e)=>t.startsWith(os[e]);var Ru=Object.defineProperty,Cu=Object.getOwnPropertyDescriptor,Iu=(t,e,n,s)=>{for(var r=s>1?void 0:s?Cu(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(s?o(e,n,r):o(r))||r);return s&&r&&Ru(e,n,r),r};exports.UserManagerService=class{constructor(){_(this,"_model",new Map);_(this,"_userChange$",new it.Subject);_(this,"userChange$",this._userChange$.asObservable());_(this,"_currentUser$",new it.BehaviorSubject(Sn()));_(this,"currentUser$",this._currentUser$.asObservable())}getCurrentUser(){return this._currentUser$.getValue()}setCurrentUser(e){this.addUser(e),this._currentUser$.next(e)}addUser(e){this._model.set(e.userID,e),this._userChange$.next({type:"add",user:e})}getUser(e,n){const s=this._model.get(e);if(s)return s;n&&n()}delete(e){const n=this.getUser(e);this._model.delete(e),n&&this._userChange$.next({type:"delete",user:n})}clear(){this._model.clear(),this._userChange$.next({type:"clear"})}};exports.UserManagerService=Iu([ji(Ot.Starting,exports.UserManagerService)],exports.UserManagerService);var Ou=Object.defineProperty,Su=Object.getOwnPropertyDescriptor,Nu=(t,e,n,s)=>{for(var r=s>1?void 0:s?Su(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(s?o(e,n,r):o(r))||r);return s&&r&&Ou(e,n,r),r},Ys=(t,e)=>(n,s)=>e(n,s,t);exports.AuthzIoLocalService=class{constructor(e,n){_(this,"_permissionMap",new Map([]));this._resourceManagerService=e,this._userManagerService=n,this._initSnapshot(),n.setCurrentUser(Sn(Ft.Owner))}_getRole(e){const n=this._userManagerService.getCurrentUser();return n?jn(n.userID,e):!1}_initSnapshot(){this._resourceManagerService.registerPluginResource({toJson:e=>{const n=[...this._permissionMap.keys()].reduce((s,r)=>{const i=this._permissionMap.get(r);return s[r]=i,s},{});return JSON.stringify(n)},parseJson:e=>JSON.parse(e),pluginName:"SHEET_AuthzIoMockService_PLUGIN",businesses:[et.UNIVER_SHEET,et.UNIVER_DOC,et.UNIVER_SLIDE],onLoad:(e,n)=>{for(const s in n)this._permissionMap.set(s,n[s])},onUnLoad:()=>{this._permissionMap.clear()}})}async create(e){const n=y.generateRandomId(8);switch(e.objectType){case dn.SelectRange:{const s=e.selectRangeObject;this._permissionMap.set(n,{...s,objectType:e.objectType});break}case dn.Worksheet:{const s=e.worksheetObject;this._permissionMap.set(n,{...s,objectType:e.objectType})}}return n}async allowed(e){var n;if(this._permissionMap.has(e.objectID)){const s=this._permissionMap.get(e.objectID);if(s&&s.objectType===dn.Worksheet)return(n=s==null?void 0:s.strategies)==null?void 0:n.map(r=>({action:r.action,allowed:r.role===Ft.Editor}))}return e.actions.map(s=>({action:s,allowed:this._getRole(Ft.Owner)||this._getRole(Ft.Editor)}))}async batchAllowed(e){const n=this._userManagerService.getCurrentUser(),s=e.map(r=>({unitID:r.unitID,objectID:r.objectID,actions:r.actions.map(i=>({action:i,allowed:!1}))}));return n&&(jn(n.userID,Ft.Owner)||jn(n.userID,Ft.Editor))?e.map(r=>({unitID:r.unitID,objectID:r.objectID,actions:r.actions.map(i=>({action:i,allowed:!0}))})):s}async list(e){const n=[];return e.objectIDs.forEach(s=>{const r=this._permissionMap.get(s);if(r){const i={objectID:s,unitID:e.unitID,objectType:r.objectType,name:r.name,shareOn:!1,shareRole:Ft.Owner,shareScope:-1,creator:Sn(Ft.Owner),strategies:[],actions:e.actions.map(o=>({action:o,allowed:this._getRole(Ft.Owner)||this._getRole(Ft.Editor)}))};n.push(i)}}),n}async listCollaborators(){return[]}async listRoles(){return{roles:[],actions:[]}}async deleteCollaborator(){}async update(e){}async updateCollaborator(){}async createCollaborator(){}async putCollaborators(e){}};exports.AuthzIoLocalService=Nu([Ys(0,Ln),Ys(1,ut.Inject(exports.UserManagerService))],exports.AuthzIoLocalService);const ro=ut.createIdentifier("IAuthzIoIoService");class bu{constructor(e={},n){_(this,"_startedTypes",new Set);_(this,"_injector");const s=this._injector=vu(n,e==null?void 0:e.override),{theme:r,locale:i,locales:o,logLevel:l}=e;r&&this._injector.get(Ts).setTheme(r),o&&this._injector.get(Ve).load(o),i&&this._injector.get(Ve).setLocale(i),l&&this._injector.get(pe).setLogLevel(l),this._init(s),this._pluginService}get _univerInstanceService(){return this._injector.get(xe)}get _pluginService(){return this._injector.get(exports.PluginService)}__getInjector(){return this._injector}dispose(){this._injector.dispose()}setLocale(e){this._injector.get(Ve).setLocale(e)}createUnit(e,n){return this._univerInstanceService.createUnit(e,n)}createUniverSheet(e){return this._univerInstanceService.createUnit(et.UNIVER_SHEET,e)}createUniverDoc(e){return this._univerInstanceService.createUnit(et.UNIVER_DOC,e)}createUniverSlide(e){return this._univerInstanceService.createUnit(et.UNIVER_SLIDE,e)}_init(e){this._univerInstanceService.registerCtorForType(et.UNIVER_SHEET,exports.Workbook),this._univerInstanceService.registerCtorForType(et.UNIVER_DOC,Ae),this._univerInstanceService.registerCtorForType(et.UNIVER_SLIDE,bs);const n=e.get(xe);n.__setCreateHandler((s,r,i)=>{if(!this._startedTypes.has(s)){this._pluginService.startPluginForType(s),this._startedTypes.add(s);const l=e.createInstance(i,r);return n.__addUnit(l),this._tryProgressToReady(),l}const o=e.createInstance(i,r);return n.__addUnit(o),o})}_tryProgressToReady(){this._injector.get(exports.LifecycleService).stage<Ot.Ready&&(this._injector.get(exports.LifecycleService).stage=Ot.Ready)}registerPlugin(e,n){this._pluginService.registerPlugin(e,n)}}function vu(t,e){const n=so([[Li],[Ve],[Ts],[exports.LifecycleService],[exports.LifecycleInitializerService],[exports.PluginService],[exports.UserManagerService],[xe,{useClass:exports.UniverInstanceService}],[As,{useClass:Ki}],[pe,{useClass:_i,lazy:!0}],[tn,{useClass:exports.CommandService,lazy:!0}],[Dn,{useClass:exports.LocalUndoRedoService,lazy:!0}],[Mi,{useClass:Ui}],[Ze,{useClass:di}],[Ln,{useClass:Yi,lazy:!0}],[ws,{useClass:rs,lazy:!0}],[ro,{useClass:exports.AuthzIoLocalService,lazy:!0}]],e);return t?t.createChild(n):new ut.Injector(n)}const Au=(t,e)=>e.length===t.length&&!t.some(n=>e.some(s=>!ge.equals(s,n))),wu=(t,e)=>e.length===t.length&&t.every((n,s)=>{const r=e[s];return r.unitId===n.unitId&&r.sheetId===n.sheetId&&ge.equals(n.range,r.range)});function Tu(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||!t||typeof e!="object"||!e)return!1;const n=Object.keys(t),s=Object.keys(e);if(n.length!==s.length)return!1;const r=Object.prototype.hasOwnProperty.bind(e);for(let i=0;i<n.length;i++){const o=n[i];if(!r(o))return!1;const l=t[o],a=e[o];if(l!==a)return!1}return!0}function io(t){return/^-?\d+(\.\d+)?$/.test(t)}function Mu(t){return io(t)?Number(t)<=Number.MAX_SAFE_INTEGER:!1}function Uu(t){return["true","false"].includes(t.toLowerCase())}function Lu(t,e){return e.forEach(n=>t.add(n)),t}function Du(t,e=16){let n=0,s=null;return function(...i){const o=Date.now();o-n<e?(s&&clearTimeout(s),s=setTimeout(()=>{n=o,t.apply(this,i)},e)):(n=o,t.apply(this,i))}}function yu(t){const e=new MessageChannel;let n=!1;return e.port1.onmessage=()=>{n||t()},e.port2.postMessage(null),()=>{n=!0,e.port1.onmessage=null,e.port1.close(),e.port2.close()}}var oo=(t=>(t[t.TEXT=0]="TEXT",t[t.ARROW=1]="ARROW",t[t.CUSTOM=2]="CUSTOM",t))(oo||{});function Pu(t,e,n){if(e==="")return t;const s={id:"mock-id",body:t,documentStyle:{}},r=new Ae(s),i=e.length;let o;for(;(o=r.getBody().dataStream.indexOf(e))>=0;){const a=new me,h=ve.getInstance();if(o>0&&a.retain(o),n.length>0){const u=r.sliceBody(o,o+i),d={dataStream:n};Array.isArray(u==null?void 0:u.textRuns)&&u.textRuns.length&&(d.textRuns=[{...u.textRuns[0],st:0,ed:n.length}]),a.insert(n.length,d)}a.delete(i);const c=a.serialize();r.apply(h.editOp(c))}const l=r.getBody();return r.dispose(),l}class xu extends wn{add(e){if(!e)return null;const n=new An(e,this);return this._observers=[n],this._onObserverAdded&&this._onObserverAdded(n),n}makeObserverTopPriority(){}makeObserverBottomPriority(){}}const ku=ut.createIdentifier("ILocalStorageService");function Hu(t){return`sheet_interceptor_${t}`}const lo=t=>function(e,n){let s=-1;function r(i,o){if(i<=s)throw new Error("[SheetInterceptorService]: next() called multiple times!");return s=i,i===t.length?o:t[i].handler(o,n,r.bind(null,i+1))}return r(0,e)};class Fu{constructor(e){_(this,"_interceptorsByName",new Map);_(this,"_interceptorPoints");this._interceptorPoints=e}fetchThroughInterceptors(e){const n=e,s=this._interceptorsByName.get(n);return lo(s||[])}intercept(e,n){const s=e;this._interceptorsByName.has(s)||this._interceptorsByName.set(s,[]);const r=this._interceptorsByName.get(s);return r.push(n),this._interceptorsByName.set(s,r.sort((i,o)=>{var l,a;return((l=o.priority)!=null?l:0)-((a=i.priority)!=null?a:0)})),()=>Tn(this._interceptorsByName.get(s),n)}getInterceptPoints(){return this._interceptorPoints}}const Bu=ut.createIdentifier("univer.snapshot-server-service");class Wu{constructor(){_(this,"_sheetBlockCache",new Map)}getUnitOnRev(e,n){return Promise.resolve({snapshot:{unitID:"",type:et.UNIVER_SHEET,rev:0,workbook:void 0,doc:void 0},changesets:[],error:{code:Xt.OK,message:""}})}getSheetBlock(e,n){const s=this._sheetBlockCache.get(n.blockID);return Promise.resolve({block:s,error:{code:Xt.OK,message:""}})}fetchMissingChangesets(e,n){return Promise.resolve({changesets:[],error:{code:Xt.OK,message:""}})}getResourcesRequest(e,n){return Promise.resolve({resources:{},error:{code:Xt.OK,message:""}})}saveSnapshot(e,n){return Promise.resolve({error:{code:Xt.OK,message:""}})}saveSheetBlock(e,n){const{block:s}=n;return s?(this._sheetBlockCache.set(s.id,s),Promise.resolve({error:{code:Xt.OK,message:""},blockID:s.id})):Promise.resolve({error:{code:Xt.UNDEFINED,message:"block is required"},blockID:""})}saveChangeset(e,n){return Promise.resolve({error:{code:Xt.OK,message:""},concurrent:[]})}}function $u(t){return btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(e,n)=>String.fromCharCode(Number.parseInt(n,16))))}function Ms(t){return decodeURIComponent(Array.prototype.map.call(atob(t),e=>`%${`00${e.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""))}const en=new TextEncoder,yn=new TextDecoder;function ao(t){const e=y.deepClone(t);return delete e.id,delete e.name,delete e.rowCount,delete e.columnCount,delete e.cellData,en.encode(JSON.stringify(e))}function uo(t){const e=y.deepClone(t);return delete e.id,delete e.rev,delete e.name,delete e.sheetOrder,delete e.sheets,en.encode(JSON.stringify(e))}function Gu(t){const e=y.deepClone(t);return delete e.id,delete e.rev,delete e.title,delete e.resources,en.encode(JSON.stringify(e))}function zs(t){return JSON.parse(yn.decode(t))}function ju(t){return JSON.parse(typeof t=="string"?Ms(t):yn.decode(t))}function Vu(t){return JSON.parse(typeof t=="string"?Ms(t):yn.decode(t))}const Vn=256;function co(t,e){const n=new ee(t),s=n.getLength(),r=[];let i=0;for(;i<s;){const o=Math.min(i+Vn,s-1),l=n.getSlice(i,Math.min(i+Vn,s-1),0,e),a=Ku(l);r.push({id:y.generateRandomId(19,"0123456789"),startRow:i,endRow:o,data:a}),i+=Vn}return r}function Ku(t){const e=t.getData();return en.encode(JSON.stringify(e))}async function Yu(t,e,n,s,r){const i={},o={};if(!await Promise.all(Object.entries(e.sheets).map(async([u,d])=>{const f={id:d.id,type:Nn.GRID,name:d.name,rowCount:d.rowCount,columnCount:d.columnCount,originalMeta:ao(d)};if(o[u]=f,d.cellData){const m=co(d.cellData,d.rowCount),p=await Promise.all(m.map(x=>r.saveSheetBlock(t,{unitID:n,type:et.UNIVER_SHEET,block:x})));if(p.some(x=>{var P;return((P=x.error)==null?void 0:P.code)!==Xt.OK}))return!1;i[u]={sheetID:u,blocks:p.map(x=>x.blockID)}}return!0})))throw new Error("[transformWorkbookDataToSnapshot()]: Failed to save sheet blocks.");const a=uo(e),h={unitID:e.id,rev:s,creator:"",name:e.name,sheetOrder:e.sheetOrder,sheets:o,blockMeta:i,resources:e.resources||[],originalMeta:a};return{snapshotRes:{unitID:n,rev:h.rev,type:et.UNIVER_SHEET,workbook:h,doc:void 0}}}async function zu(t,e,n,s,r){var d,f;const i={},o={};if(!await Promise.all(Object.entries(e.sheets).map(async([m,p])=>{const x={id:p.id,type:Nn.GRID,name:p.name,rowCount:p.rowCount,columnCount:p.columnCount,originalMeta:ao(p)};if(o[m]=x,p.cellData){const P=co(p.cellData,p.rowCount),Z=await Promise.all(P.map(gt=>r.saveSheetBlock(t,{unitID:n,type:et.UNIVER_SHEET,block:gt})));if(Z.some(gt=>{var ht;return((ht=gt.error)==null?void 0:ht.code)!==Xt.OK}))return!1;i[m]={sheetID:m,blocks:Z.map(gt=>gt.blockID)}}return!0})))throw new Error("[transformWorkbookDataToSnapshot()]: Failed to save sheet blocks.");const a=uo(e),h={unitID:e.id,rev:s,creator:"",name:e.name,sheetOrder:e.sheetOrder,sheets:o,blockMeta:i,resources:e.resources||[],originalMeta:a},c={unitID:n,rev:h.rev,type:et.UNIVER_SHEET,workbook:h,doc:void 0},u=await r.saveSnapshot(t,{unitID:n,type:et.UNIVER_SHEET,snapshot:c});if(pi(u.error))throw new Error(`transformWorkbookDataToSnapshot(): Failed to save snapshot.
|
|
8
|
+
ErrorCode: ${(d=u.error)==null?void 0:d.code}:${(f=u.error)==null?void 0:f.message}`);return{snapshot:c}}function Xu(t,e,n){const s=t.workbook;if(!s)throw new Error("");const r={};Object.entries(s.sheets).forEach(([a,h])=>{const c=zs(h.originalMeta);r[a]={id:h.id,name:h.name,rowCount:h.rowCount,columnCount:h.columnCount,...c}});const i=new Map;e.forEach(a=>{i.set(a.id,a)}),s.blockMeta&&Object.entries(s.blockMeta).forEach(([a,h])=>{var d;const c=r[a];c.cellData={};const u=[];(d=h.blocks)==null||d.forEach(f=>{const m=i.get(f);if(m)u.push(m);else throw new Error("")}),u.forEach(f=>{const m=ju(f.data);Object.entries(m).forEach(([p,x])=>{const P=c.cellData[+p]={};Object.entries(x).forEach(([Z,gt])=>{P[+Z]=gt})})})});const o=zs(s.originalMeta);return{id:t.unitID,rev:s.rev,name:s.name,sheetOrder:s.sheetOrder,appVersion:"",locale:we.EN_US,sheets:r,styles:{},resources:s.resources||[],...o}}function qu(t){const e=t.doc;if(e==null)throw new Error("transformSnapshotToDocumentData(): snapshot.doc is undefined.");const{unitID:n,rev:s,name:r,originalMeta:i}=e,{body:o,documentStyle:l={},settings:a={}}=Vu(i);return{id:n,rev:s,locale:we.EN_US,title:r,body:o,documentStyle:l,settings:a}}async function Ju(t,e,n,s,r){var a,h,c;const i={unitID:e.id,rev:s,creator:"",name:(a=e.title)!=null?a:"",resources:e.resources||[],originalMeta:Gu(e)},o={unitID:n,rev:i.rev,type:et.UNIVER_DOC,workbook:void 0,doc:i},l=await r.saveSnapshot(t,{unitID:n,type:et.UNIVER_DOC,snapshot:o});if(pi(l.error))throw new Error(`transformDocumentDataToSnapshot(): Failed to save snapshot.
|
|
9
|
+
ErrorCode: ${(h=l.error)==null?void 0:h.code}:${(c=l.error)==null?void 0:c.message}`);return{snapshot:o}}async function Zu(t,e){const n=t.workbook;if(!n)throw new Error("Workbook metadata is not available");const s=[],r=[];return Object.entries(n.blockMeta).forEach(([i,o])=>{const l=o.blocks.map(async a=>{const h={unitID:n.unitID,type:et.UNIVER_SHEET,blockID:a},{block:c}=await e.getSheetBlock({},h);if(c)s.push(c);else throw new Error("Block not found")});r.push(...l)}),await Promise.all(r),s}var ho=(t=>(t[t.INFO=0]="INFO",t[t.STOP=1]="STOP",t[t.WARNING=2]="WARNING",t))(ho||{}),fo=(t=>(t[t.DISABLED=0]="DISABLED",t[t.FULL_ALPHA=1]="FULL_ALPHA",t[t.FULL_HANGUL=2]="FULL_HANGUL",t[t.FULL_KATAKANA=3]="FULL_KATAKANA",t[t.HALF_ALPHA=4]="HALF_ALPHA",t[t.HALF_HANGUL=5]="HALF_HANGUL",t[t.HALF_KATAKANA=6]="HALF_KATAKANA",t[t.HIRAGANA=7]="HIRAGANA",t[t.NO_CONTROL=8]="NO_CONTROL",t[t.OFF=9]="OFF",t[t.ON=10]="ON",t))(fo||{}),_o=(t=>(t.BETWEEN="between",t.EQUAL="equal",t.GREATER_THAN="greaterThan",t.GREATER_THAN_OR_EQUAL="greaterThanOrEqual",t.LESS_THAN="lessThan",t.LESS_THAN_OR_EQUAL="lessThanOrEqual",t.NOT_BETWEEN="notBetween",t.NOT_EQUAL="notEqual",t))(_o||{}),go=(t=>(t.CUSTOM="custom",t.LIST="list",t.LIST_MULTIPLE="listMultiple",t.NONE="none",t.TEXT_LENGTH="textLength",t.DATE="date",t.TIME="time",t.WHOLE="whole",t.DECIMAL="decimal",t.CHECKBOX="checkbox",t))(go||{}),mo=(t=>(t.VALID="valid",t.INVALID="invalid",t.VALIDATING="validating",t))(mo||{});So();exports.ABCToNumber=Dl;exports.AbsoluteRefType=bt;exports.ActionIterator=ns;exports.AlignTypeH=Br;exports.AlignTypeV=Wr;exports.ArrangeTypeEnum=jr;exports.ArrowsAndMarkersShapes=fr;exports.AutoFillSeries=tr;exports.BaselineOffset=ye;exports.BasicShapes=dr;exports.BlockType=Or;exports.BooleanNumber=q;exports.BorderStyleTypes=dt;exports.BorderType=er;exports.BulletAlignment=de;exports.COLORS=Kn;exports.CellValueType=Ne;exports.ClientSnapshotServerService=Wu;exports.Color=be;exports.ColorBuilder=vn;exports.ColorKit=te;exports.ColorType=zt;exports.ColumnSeparatorType=br;exports.CommandType=Qe;exports.CommonHideTypes=nr;exports.ConfigService=Ui;exports.ContentAlignment=Pr;exports.ContextService=di;exports.CopyPasteType=sr;exports.CustomRangeType=Ir;exports.DEFAULT_CELL=jl;exports.DEFAULT_DOC=Ns;exports.DEFAULT_DOCUMENT_SUB_COMPONENT_ID=bo;exports.DEFAULT_EMPTY_DOCUMENT_VALUE=ou;exports.DEFAULT_RANGE=$l;exports.DEFAULT_RANGE_ARRAY=Wl;exports.DEFAULT_SELECTION=Gl;exports.DEFAULT_SLIDE=ai;exports.DEFAULT_STYLES=hn;exports.DEFAULT_WORKSHEET_COLUMN_COUNT=Pi;exports.DEFAULT_WORKSHEET_COLUMN_COUNT_KEY=La;exports.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT=Fi;exports.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY=xa;exports.DEFAULT_WORKSHEET_COLUMN_WIDTH=ki;exports.DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY=ya;exports.DEFAULT_WORKSHEET_ROW_COUNT=yi;exports.DEFAULT_WORKSHEET_ROW_COUNT_KEY=Ua;exports.DEFAULT_WORKSHEET_ROW_HEIGHT=xi;exports.DEFAULT_WORKSHEET_ROW_HEIGHT_KEY=Da;exports.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH=Hi;exports.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY=Pa;exports.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY=Xi;exports.DOCS_NORMAL_EDITOR_UNIT_ID_KEY=zi;exports.DashStyleType=Lr;exports.DataStreamTreeNodeType=Ei;exports.DataStreamTreeTokenType=_s;exports.DataValidationErrorStyle=ho;exports.DataValidationImeMode=fo;exports.DataValidationOperator=_o;exports.DataValidationRenderMode=oo;exports.DataValidationStatus=mo;exports.DataValidationType=go;exports.DependentOn=Eu;exports.DesktopLogService=_i;exports.DeveloperMetadataVisibility=rr;exports.Dimension=ir;exports.Direction=or;exports.Disposable=yt;exports.DisposableCollection=cs;exports.DocStyleType=Rr;exports.DocumentDataModel=Ae;exports.DrawingTypeEnum=Vr;exports.EDITOR_ACTIVATED=$i;exports.EXTENSION_NAMES=ui;exports.Entry=Yn;exports.EntryIterator=ri;exports.ErrorService=Li;exports.EventState=ti;exports.FOCUSING_COMMON_DRAWINGS=qa;exports.FOCUSING_DOC=fn;exports.FOCUSING_EDITOR_BUT_HIDDEN=Va;exports.FOCUSING_EDITOR_INPUT_FORMULA=Ka;exports.FOCUSING_EDITOR_STANDALONE=za;exports.FOCUSING_FORMULA_EDITOR=Gi;exports.FOCUSING_SHEET=je;exports.FOCUSING_SLIDE=_n;exports.FOCUSING_UNIVER_EDITOR=Ya;exports.FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE=Xa;exports.FollowNumberWithType=Cr;exports.FontItalic=mn;exports.FontStyleType=xr;exports.FontWeight=pn;exports.FormatType=lr;exports.GlyphType=$e;exports.GridType=Sr;exports.HLSColor=pr;exports.HorizontalAlign=Se;exports.IAuthzIoService=ro;exports.ICommandService=tn;exports.IConfigService=Mi;exports.IContextService=Ze;exports.ILocalStorageService=ku;exports.ILogService=pe;exports.IPermissionService=As;exports.IResourceLoaderService=ws;exports.IResourceManagerService=Ln;exports.ISnapshotServerService=Bu;exports.IUndoRedoService=Dn;exports.IUniverInstanceService=xe;exports.InterceptorManager=Fu;exports.InterpolationPointType=ar;exports.JSON1=Ia;exports.JSONX=ve;exports.KeyIterator=ni;exports.LRUHelper=Be;exports.LRUMap=ii;exports.LifecycleStages=Ot;exports.LocaleService=Ve;exports.LocaleType=we;exports.LogLevel=fi;exports.MOVE_BUFFER_VALUE=Fe;exports.MemoryCursor=Ti;exports.NamedStyleType=Mr;exports.NilCommand=gi;exports.NumberUnitType=Fr;exports.ObjectMatrix=ee;exports.ObjectRelativeFromH=kr;exports.ObjectRelativeFromV=Hr;exports.Observable=wn;exports.ObservableHooks=xu;exports.Observer=An;exports.OnLifecycle=ji;exports.OtherShapes=_r;exports.PRESET_LIST_TYPE=sa;exports.PageElementType=Kr;exports.PageOrientType=Gr;exports.PageType=ls;exports.ParagraphElementType=Ar;exports.PermissionService=Ki;exports.PermissionStatus=vs;exports.Plugin=is;exports.PositionedObjectLayoutType=Tr;exports.PresetListType=In;exports.ProtectionType=ur;exports.RANGE_TYPE=rt;exports.RGBA_PAREN=Uo;exports.RGB_PAREN=Mo;exports.ROTATE_BUFFER_VALUE=Js;exports.Range=Pe;exports.Rectangle=ge;exports.RedoCommand=to;exports.RedoCommandId=Ji;exports.RefAlias=Ll;exports.Registry=ds;exports.RegistryAsMap=fs;exports.RelativeDate=cr;exports.RelativeSlideLink=Yr;exports.ResourceManagerService=Yi;exports.RgbColor=En;exports.RxDisposable=Sl;exports.SectionType=Nr;exports.SheetTypes=Nn;exports.SheetViewModel=Wi;exports.SlideDataModel=bs;exports.SpacingRule=Ur;exports.SpecialShapes=gr;exports.Styles=Di;exports.THEME_COLORS=mr;exports.TabStopAlignment=Dr;exports.TextDecoration=hr;exports.TextDirection=ze;exports.TextDirectionType=vr;exports.TextX=me;exports.TextXActionType=J;exports.ThemeColor=Rn;exports.ThemeColorType=Ht;exports.ThemeColors=bn;exports.ThemeService=Ts;exports.Tools=y;exports.UndoCommand=Qi;exports.UndoCommandId=Zi;exports.UnitModel=Mn;exports.Univer=bu;exports.UniverInstanceType=et;exports.UpdateDocsAttributeType=xt;exports.ValueIterator=si;exports.VerticalAlign=De;exports.WidthType=yr;exports.Worksheet=Je;exports.WrapStrategy=Xe;exports.WrapTextType=wr;exports.afterInitApply=na;exports.b64DecodeUnicode=Ms;exports.b64EncodeUnicode=$u;exports.binarySearchArray=Zs;exports.cellToRange=_l;exports.characterSpacingControlType=$r;exports.checkForSubstrings=gl;exports.checkIfMove=vo;exports.checkParagraphHasBullet=ml;exports.checkParagraphHasIndent=pl;exports.checkParagraphHasIndentByStyle=qr;exports.codeToBlob=wo;exports.composeBody=Qn;exports.composeInterceptors=lo;exports.concatMatrixArray=wl;exports.convertBodyToHtml=Bl;exports.covertTextRunToHtml=Zn;exports.createDefaultUser=Sn;exports.createInterceptorKey=Hu;exports.createInternalEditorID=lu;exports.createRowColIter=Jn;exports.debounce=Fl;exports.dedupe=Nl;exports.deepCompare=as;exports.deleteContent=Zr;exports.extractPureTextFromCell=ka;exports.fromCallback=mi;exports.fromObservable=Ol;exports.generateTemporarySnap=Yu;exports.getArrayLength=_e;exports.getBodySlice=qe;exports.getBodySliceHtml=cn;exports.getBorderStyleType=hl;exports.getCellInfoInMergeData=qo;exports.getCellValueType=Ko;exports.getColorStyle=re;exports.getDocsUpdateBody=dl;exports.getReverseDirection=To;exports.getSheetBlocksFromSnapshot=Zu;exports.getWorksheetUID=ja;exports.groupBy=Al;exports.handleJsonToDom=ul;exports.handleStyleToString=cl;exports.hashAlgorithm=Rl;exports.horizontalLineSegmentsSubtraction=us;exports.insertMatrixArray=zn;exports.insertTextToContent=Jr;exports.isBlackColor=Go;exports.isBooleanString=Uu;exports.isCellCoverable=ol;exports.isCellV=zo;exports.isEmptyCell=zr;exports.isFormulaId=al;exports.isFormulaString=ll;exports.isICellData=Vo;exports.isInternalEditorID=au;exports.isNullCell=Yo;exports.isNumeric=io;exports.isObserver=ei;exports.isRangesEqual=Au;exports.isRealNum=El;exports.isSafeNumeric=Mu;exports.isSameStyleTextRun=Xr;exports.isUnitRangesEqual=wu;exports.isValidRange=fl;exports.isWhiteColor=jo;exports.makeCellRangeToRangeData=il;exports.makeCellToSelection=rl;exports.mergeOverrideWithDependencies=so;exports.mergeSets=Lu;exports.mergeWorksheetSnapshotWithDefault=Bi;exports.moveMatrixArray=qn;exports.moveRangeByOffset=Xl;exports.normalizeTextRuns=gs;exports.numberToABC=Pl;exports.numberToListABC=xl;exports.orderSearchArray=Qs;exports.queryObjectMatrix=zl;exports.remove=Tn;exports.repeatStringNumTimes=li;exports.replaceInDocumentBody=Pu;exports.requestImmediateMacroTask=yu;exports.rotate=vl;exports.runOnLifecycle=Un;exports.searchArray=Ao;exports.selectionToArray=Xo;exports.sequence=hi;exports.sequenceAsync=ci;exports.sequenceExecute=hs;exports.sequenceExecuteAsync=ea;exports.shallowEqual=Tu;exports.sliceMatrixArray=Tl;exports.sortRules=kl;exports.sortRulesByDesc=Hl;exports.sortRulesFactory=ke;exports.spliceArray=Xn;exports.textDecoder=yn;exports.textEncoder=en;exports.throttle=Du;exports.toDisposable=vt;exports.transformDocumentDataToSnapshot=Ju;exports.transformSnapshotToDocumentData=qu;exports.transformSnapshotToWorkbookData=Xu;exports.transformWorkbookDataToSnapshot=zu;
|