@univerjs/core 0.1.14 → 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 +2006 -2102
- package/lib/types/index.d.ts +2 -1
- 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/services/user-manager/const.d.ts +1 -1
- package/lib/types/services/user-manager/user-manager.service.d.ts +24 -6
- package/lib/types/shared/common.d.ts +2 -1
- package/lib/types/shared/rectangle.d.ts +3 -12
- package/lib/types/sheets/range.d.ts +1 -0
- package/lib/types/sheets/workbook.d.ts +6 -52
- package/lib/types/sheets/worksheet.d.ts +4 -0
- package/lib/types/types/interfaces/i-cell-custom-render.d.ts +4 -0
- 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/types/types/interfaces/i-row-data.d.ts +4 -0
- package/lib/types/types/interfaces/i-selection-data.d.ts +4 -0
- package/lib/umd/index.js +8 -8
- package/package.json +8 -7
- package/lib/types/services/user-manager/index.d.ts +0 -16
package/lib/umd/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
(function(u,x){typeof exports=="object"&&typeof module<"u"?x(exports,require("rxjs"),require("rxjs/operators"),require("@wendellhu/redi")):typeof define=="function"&&define.amd?define(["exports","rxjs","rxjs/operators","@wendellhu/redi"],x):(u=typeof globalThis<"u"?globalThis:u||self,x(u.UniverCore={},u.rxjs,u.rxjs.operators,u["@wendellhu/redi"]))})(this,function(u,x,se,at){"use strict";var zu=Object.defineProperty;var Xu=(u,x,se)=>x in u?zu(u,x,{enumerable:!0,configurable:!0,writable:!0,value:se}):u[x]=se;var g=(u,x,se)=>(Xu(u,typeof x!="symbol"?x+"":x,se),se);var Vu,ju;function _o(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 go(){mo()}const rn=typeof global<"u"?global:typeof self<"u"?self:window;function mo(){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 Eo="__default_document_sub_component_id20231101__",$e=2,Us=1;function Ro(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:d=0,width:h=0,angle:c=0}=t,f=h,_=d,E=i,R=r;return Math.abs(l-n)>$e||Math.abs(a-s)>$e||Math.abs(f-E)>$e||Math.abs(_-R)>$e||Math.abs(c-o)>Us}function Ds(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 ys(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 Co(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=ys(t,e):n=Ds(t,e),n)}function po(t){const e=new Blob([t],{type:"text/javascript"});return window.URL.createObjectURL(e)}var Ps=(t=>(t[t.DEFAULT_SERIES=0]="DEFAULT_SERIES",t[t.ALTERNATE_SERIES=1]="ALTERNATE_SERIES",t))(Ps||{}),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||{}),ks=(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))(ks||{}),jt=(t=>(t[t.UNSUPPORTED=0]="UNSUPPORTED",t[t.RGB=1]="RGB",t[t.HEX=2]="HEX",t[t.THEME=3]="THEME",t))(jt||{}),Hs=(t=>(t[t.ON=0]="ON",t[t.OFF=1]="OFF",t))(Hs||{}),Fs=(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))(Fs||{}),Bs=(t=>(t[t.DOCUMENT=0]="DOCUMENT",t[t.PROJECT=1]="PROJECT",t))(Bs||{}),$s=(t=>(t[t.COLUMNS=0]="COLUMNS",t[t.ROWS=1]="ROWS",t))($s||{}),Ws=(t=>(t[t.UP=0]="UP",t[t.RIGHT=1]="RIGHT",t[t.DOWN=2]="DOWN",t[t.LEFT=3]="LEFT",t))(Ws||{});function Io(t){switch(t){case 3:return 1;case 1:return 3;case 0:return 2;case 2:return 0}}var Gs=(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))(Gs||{}),Vs=(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))(Vs||{}),pe=(t=>(t.EN_US="enUS",t.ZH_CN="zhCN",t.RU_RU="ruRU",t))(pe||{}),js=(t=>(t[t.RANGE=0]="RANGE",t[t.SHEET=1]="SHEET",t))(js||{}),xs=(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))(xs||{}),on=(t=>(t[t.GRID=0]="GRID",t[t.KANBAN=1]="KANBAN",t[t.GANTT=2]="GANTT",t))(on||{}),We=(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))(We||{}),Ks=(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))(Ks||{}),Ie=(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))(Ie||{}),Ue=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TOP=1]="TOP",t[t.MIDDLE=2]="MIDDLE",t[t.BOTTOM=3]="BOTTOM",t))(Ue||{}),Ge=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.OVERFLOW=1]="OVERFLOW",t[t.CLIP=2]="CLIP",t[t.WRAP=3]="WRAP",t))(Ge||{}),ln=(t=>(t[t.NORMAL=0]="NORMAL",t[t.ITALIC=1]="ITALIC",t))(ln||{}),an=(t=>(t[t.NORMAL=0]="NORMAL",t[t.BOLD=1]="BOLD",t))(an||{}),De=(t=>(t[t.NORMAL=1]="NORMAL",t[t.SUBSCRIPT=2]="SUBSCRIPT",t[t.SUPERSCRIPT=3]="SUPERSCRIPT",t))(De||{}),Z=(t=>(t[t.FALSE=0]="FALSE",t[t.TRUE=1]="TRUE",t))(Z||{}),Oe=(t=>(t[t.STRING=1]="STRING",t[t.NUMBER=2]="NUMBER",t[t.BOOLEAN=3]="BOOLEAN",t[t.FORCE_STRING=4]="FORCE_STRING",t))(Oe||{}),Bt=(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))(Bt||{}),un=(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))(un||{}),Ys=(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))(Ys||{}),zs=(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))(zs||{}),Xs=(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))(Xs||{}),qs=(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))(qs||{});const Js={[un.OFFICE]:{[Bt.ACCENT1]:"#4472C4",[Bt.ACCENT2]:"#ED7D31",[Bt.ACCENT3]:"#A5A5A5",[Bt.ACCENT4]:"#70AD47",[Bt.ACCENT5]:"#5B9BD5",[Bt.ACCENT6]:"#70AD47",[Bt.DARK1]:"#000000",[Bt.DARK2]:"#44546A",[Bt.LIGHT1]:"#FFFFFF",[Bt.LIGHT2]:"#E7E6E6",[Bt.HYPERLINK]:"#0563C1",[Bt.FOLLOWED_HYPERLINK]:"#954F72"}};class cn{constructor(){g(this,"_themeValue",Bt.LIGHT1);g(this,"_themeColors");g(this,"_themeTint");g(this,"_rgbValue","");g(this,"_colorType");this._colorType=jt.UNSUPPORTED,this._themeColors=un.OFFICE,this._themeTint=0}asRgbColor(){return new hn(this._rgbValue,this)}asThemeColor(){return new dn(this._themeValue,this._themeTint,this._themeColors,this)}build(){switch(this._colorType){case jt.THEME:return this.asThemeColor();case jt.RGB:return this.asRgbColor();case jt.UNSUPPORTED:throw new Error("unsupported color type")}}setRgbColor(e){return this._colorType=jt.RGB,this._rgbValue=e,this}setThemeColors(e){this._colorType=jt.THEME,this._themeColors=e}setThemeTint(e){this._colorType=jt.THEME,this._themeTint=e}setThemeColor(e){return this._colorType=jt.THEME,this._themeValue=e,this}getColorType(){return this._colorType}}class Se{constructor(e){g(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 cn().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 Se(this._builder)}equals(e){return!1}}class Zs{constructor(e){g(this,"_saturation",0);g(this,"_hue",0);g(this,"_lightness",0);g(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 cn;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,d=this.setColor(n,s,a);return e.setRgbColor(`rgba(${Math.round(o*255)},${Math.round(l*255)},${Math.round(d*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 Kt=class Kt extends Se{constructor(n,s){super(s);g(this,"_cssString");g(this,"_red");g(this,"_green");g(this,"_blue");g(this,"_alpha");let r=n.match(Kt.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(Kt.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 Se.rgbColorToHexValue(this)}getRed(){let n=this._red+Kt.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getGreen(){let n=this._green+Kt.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getBlue(){let n=this._blue+Kt.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getAlpha(){return this._alpha}getColorType(){return jt.RGB}clone(){return new Kt(this._cssString,this._builder)}asThemeColor(){throw new Error("rgb color not support to themeColor")}equals(n){return n instanceof Kt?n._red===this._red&&n._blue===this._blue&&n._green===this._green&&n._alpha===this._alpha:!1}getCssString(){return this._cssString}};g(Kt,"RGB_COLOR_AMT",0),g(Kt,"RGBA_EXTRACT",new RegExp("\\s*rgba\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d.\\d|\\d\\s*)\\)\\s*")),g(Kt,"RGB_EXTRACT",new RegExp("\\s*rgb\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*)\\)\\s*"));let hn=Kt;const Re=class Re extends Se{constructor(n,s,r,i){super(i);g(this,"_themeColorType");g(this,"_themeTint");g(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=Js[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(Re._cacheThemeColor.has(this._themeColors)){if(r=Re._cacheThemeColor.get(this._themeColors),r.has(this._themeColorType))return r.get(this._themeColorType)}else r=new Map,Re._cacheThemeColor.set(this._themeColors,r);const i=new Zs(Se.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 Re(this._themeColorType,this._themeTint,this._themeColors,this._builder)}equals(n){return n instanceof Re?n._themeColorType===this._themeColorType:!1}getColorType(){return jt.THEME}getThemeColorType(){return this._themeColorType}};g(Re,"_cacheThemeColor",new Map);let dn=Re;const Oo="rgb(",So="rgba(",Pn={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 Jt{constructor(e){g(this,"_color");g(this,"_rgbColor");g(this,"_isValid",!1);if(e==null){this._setNullColor();return}if(e instanceof Jt){this._color={...e._color},this._rgbColor={...e._rgbColor};return}const n=Qs(e);if(n==null){this._setNullColor();return}this._color=n;const s=wo(this._color);if(s==null){this._setNullColor();return}this._rgbColor=s,this._isValid=!0}static mix(e,n,s){var d,h;s=Math.min(1,Math.max(0,s));const r=new Jt(e).toRgb(),i=new Jt(n).toRgb(),o=(d=r.a)!=null?d:1,l=(h=i.a)!=null?h: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 Jt(a)}static getContrastRatio(e,n){const s=new Jt(e).getLuminance(),r=new Jt(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=[fn(Math.round(n).toString(16)),fn(Math.round(s).toString(16)),fn(Math.round(r).toString(16)),fn(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 Uo(this.toRgb())}toHsl(){return Mo(this.toRgb())}lighten(e=10){const n=this.toHsl();return n.l+=e,n.l=Math.min(Math.max(n.l,0),100),new Jt(n)}darken(e=10){const n=this.toHsl();return n.l-=e,n.l=Math.min(Math.max(n.l,0),100),new Jt(n)}setAlpha(e){return new Jt({...this._rgbColor,a:e})}getLuminance(){let{r:e,g:n,b:s}=this.toRgb();return e=kn(e),n=kn(n),s=kn(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 fn=t=>t.length===1?`0${t}`:t,kn=t=>(t/=255,t<=.03928?t/12.92:((t+.055)/1.055)**2.4),Qs=t=>{if(yo(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(Pn[e]){const n=Pn[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 No(e);if(e.startsWith("rgb"))return bo(e);if(e.startsWith("hsl"))return vo(e);if(e.startsWith("hsv"))return Ao(e)},No=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},bo=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},vo=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},Ao=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},wo=t=>{const e=Qs(t);if(e!=null)return"r"in e?e:"l"in e?To(e):Lo(e)},Hn=(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),To=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,d=2*s-a;r=Hn(d,a,e+1/3),i=Hn(d,a,e),o=Hn(d,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},Lo=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),d=r%6,h=[s,l,o,o,a,s][d],c=[a,s,s,l,o,o][d],f=[o,o,a,s,s,l][d],_={r:h*255,g:c*255,b:f*255};return t.a!==void 0&&(_.a=t.a),_},Mo=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 h=r-i;switch(a=o>.5?h/(2-r-i):h/(r+i),r){case e:l=(n-s)/h+(n<s?6:0);break;case n:l=(s-e)/h+2;break;default:l=(e-n)/h+4;break}l/=6}const d={h:Math.round(l*360),s:Math.round(a*100),l:Math.round(o*100)};return t.a!==void 0&&(d.a=t.a),d},Uo=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,d=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 h={h:Math.round(o*360),s:Math.round(d*100),v:Math.round(l*100)};return t.a!==void 0&&(h.a=t.a),h},Do=t=>t==null,yo=t=>!Do(t)&&typeof t=="object";function Po(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 ko(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 kt=(t=>(t[t.COVER=0]="COVER",t[t.REPLACE=1]="REPLACE",t[t.INTERSECTION=2]="INTERSECTION",t))(kt||{});function Ho(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 Fo(t){if(t.t!==void 0)return t.t;if(typeof t.v=="string")return Oe.STRING;if(typeof t.v=="number")return Oe.NUMBER;if(typeof t.v=="boolean")return Oe.BOOLEAN}function Bo(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 $o(t){return t!=null&&(typeof t=="string"||typeof t=="number"||typeof t=="boolean")}var tr=(t=>(t[t.character=0]="character",t[t.paragraph=1]="paragraph",t[t.table=2]="table",t[t.numbering=3]="numbering",t))(tr||{}),er=(t=>(t[t.TAB=0]="TAB",t[t.SPACE=1]="SPACE",t[t.NOTHING=2]="NOTHING",t))(er||{}),Ve=(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))(Ve||{}),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||{}),nr=(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))(nr||{}),sr=(t=>(t[t.DRAWING=0]="DRAWING",t[t.CUSTOM=1]="CUSTOM",t))(sr||{}),rr=(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))(rr||{}),ir=(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))(ir||{}),or=(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))(or||{}),lr=(t=>(t[t.NORMAL=0]="NORMAL",t[t.TBRL=1]="TBRL",t[t.LRTBV=2]="LRTBV",t))(lr||{}),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||{}),ur=(t=>(t[t.BOTH_SIDES=0]="BOTH_SIDES",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT",t[t.LARGEST=3]="LARGEST",t))(ur||{}),cr=(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))(cr||{}),hr=(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))(hr||{}),dr=(t=>(t[t.AUTO=0]="AUTO",t[t.AT_LEAST=1]="AT_LEAST",t[t.EXACT=2]="EXACT",t))(dr||{}),fr=(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))(fr||{}),_r=(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))(_r||{}),gr=(t=>(t.EVENLY_DISTRIBUTED="0",t.FIXED_WIDTH="1",t))(gr||{}),mr=(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))(mr||{}),Er=(t=>(t.NORMAL="normal",t.BOLD="bold",t.ITALIC="italic",t))(Er||{}),Rr=(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))(Rr||{}),Cr=(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))(Cr||{}),pr=(t=>(t[t.POINT=0]="POINT",t[t.LINE=1]="LINE",t[t.CHARACTER=2]="CHARACTER",t))(pr||{}),Ir=(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))(Ir||{}),Or=(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))(Or||{}),Sr=(t=>(t[t.compressPunctuation=0]="compressPunctuation",t[t.compressPunctuationAndJapaneseKana=1]="compressPunctuationAndJapaneseKana",t[t.doNotCompress=2]="doNotCompress",t))(Sr||{}),Nr=(t=>(t[t.PORTRAIT=0]="PORTRAIT",t[t.LANDSCAPE=1]="LANDSCAPE",t))(Nr||{}),br=(t=>(t[t.forward=0]="forward",t[t.backward=1]="backward",t[t.front=2]="front",t[t.back=3]="back",t))(br||{}),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||{}),ct=(t=>(t[t.NORMAL=0]="NORMAL",t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN",t[t.ALL=3]="ALL",t))(ct||{}),Nt=(t=>(t[t.NONE=0]="NONE",t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN",t[t.ALL=3]="ALL",t))(Nt||{});function Wo(t){return[t.startRow,t.startColumn,t.endRow,t.endColumn]}var Fn=(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))(Fn||{}),Ar=(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))(Ar||{}),wr=(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))(wr||{});const Go="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Vo=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}}},xo=(t,e=21)=>jo(t,e,Vo),Ko=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=Go[n[t]&63];return e};const Yo=/^-ms-/,zo=/-([a-z])/g,fe=["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>=fe.length;)s/=fe.length,s-=1,n+=fe[s%fe.length];const r=e%fe.length;return n+=fe[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+=fe.length**i+fe.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 h=Number.parseFloat(RegExp.$1);return h===7?"IE7":h===8?"IE8":h===9?"IE9":h===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?xo(n,e)():Ko(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,d)=>{var h,c;if(y.isArray(a)){const f=(h=l[d])!=null?h:[];l[d]=f,s(a,f);return}if(y.isObject(a)){const f=(c=l[d])!=null?c:{};l[d]=f,r(a,f);return}l[d]=a})}function r(o,l){Object.keys(o).forEach(a=>{var h,c;const d=o[a];if(y.isObject(d)){const f=(h=l[a])!=null?h:{};l[a]=f,r(d,f);return}if(y.isArray(d)){const f=(c=l[a])!=null?c:[];l[a]=f,s(d,f);return}l[a]=d})}function i(o){Object.keys(o).forEach(l=>{var d,h;const a=o[l];if(y.isArray(a)){const c=(d=e[l])!=null?d:[];e[l]=c,s(a,c);return}if(y.isObject(a)){const c=(h=e[l])!=null?h:{};e[l]=c,r(a,c);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),d=y.getValueType(l);return a!==d?!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,d=o.length;a<d;a++){const h=o[a],c=l[a];if(!s(h,c))return!1}return!0}function i(o,l){const a=Object.keys(o),d=Object.keys(l);if(a.length!==d.length)return!1;for(const h of a){if(!d.includes(h))return!1;const c=o[h],f=l[h];if(!s(c,f))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(Yo,"ms-").replace(zo,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 Xo(t){if(!t)return;const{actualRow:e,actualColumn:n,isMerged:s,isMergedMainCell:r,mergeInfo:i}=t;let{startY:o,endY:l,startX:a,endX:d}=t,h=e,c=n,f=e,_=n;if(s&&i){const{startRow:E,startColumn:R,endRow:P,endColumn:k,startY:tt,endY:mt,startX:ft,endX:C}=i;h=E,c=R,f=P,_=k,o=tt,l=mt,a=ft,d=C}return r&&(o=i.startY,l=i.endY,a=i.startX,d=i.endX,f=i.endRow,_=i.endColumn),{startRow:h,startColumn:c,endRow:f,endColumn:_,startY:o,endY:l,startX:a,endX:d}}function qo(t){if(!t)return;const{actualRow:e,actualColumn:n,isMerged:s,isMergedMainCell:r,startRow:i,startColumn:o,endRow:l,endColumn:a}=t;let d=e,h=n,c=e,f=n;return(s||r)&&(d=i,h=o,c=l,f=a),{startRow:d,startColumn:h,endRow:c,endColumn:f}}function Jo(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 cn().setThemeColor(t.th).asThemeColor().asRgbColor().getCssString()}return null}function Zo(t){return y.isString(t)&&t.substring(0,1)==="="&&t.length>1}function Qo(t){return y.isString(t)&&t.length>0}function tl(t){return""}function el(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,d,h,c,f,_,E,R,P,k;(o=t.bd)!=null&&o.b&&(n+=`border-bottom: ${_n((l=t.bd)==null?void 0:l.b.s)} ${(a=re(t.bd.b.cl))!=null?a:""}; `),(d=t.bd)!=null&&d.t&&(n+=`border-top: ${_n((h=t.bd)==null?void 0:h.t.s)} ${(c=re(t.bd.t.cl))!=null?c:""}; `),(f=t.bd)!=null&&f.r&&(n+=`border-right: ${_n((_=t.bd)==null?void 0:_.r.s)} ${(E=re(t.bd.r.cl))!=null?E:""}; `),(R=t.bd)!=null&&R.l&&(n+=`border-left: ${_n((P=t.bd)==null?void 0:P.l.s)} ${(k=re(t.bd.l.cl))!=null?k:""}; `)}],["cl",()=>{t.cl&&(n+=`color: ${re(t.cl)}; `)}],["va",()=>{t.va===De.SUBSCRIPT?n+="vertical-align: sub; ":t.va===De.SUPERSCRIPT&&(n+="vertical-align: super; ")}],["td",()=>{t.td===We.LEFT_TO_RIGHT?n+="direction: ltr; ":t.td===We.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===Ie.LEFT?n+="text-align: left; ":t.ht===Ie.RIGHT?n+="text-align: right; ":t.ht===Ie.CENTER?n+="text-align: center; ":t.ht===Ie.JUSTIFIED&&(n+="text-align: justify; ")}],["vt",()=>{t.vt===Ue.BOTTOM?n+="vertical-align: bottom; ":t.vt===Ue.TOP?n+="vertical-align: top; ":t.vt===Ue.MIDDLE&&(n+="vertical-align: middle; ")}],["tb",()=>{t.tb===Ge.CLIP?n+="white-space: clip; ":t.tb===Ge.WRAP&&(n+="white-space: normal;")}],["pd",()=>{var h,c,f,_,E,R,P,k;const o=`${(h=t.pd)==null?void 0:h.b}pt`,l=`${(c=t.pd)==null?void 0:c.t}pt`,a=`${(f=t.pd)==null?void 0:f.l}pt`,d=`${(_=t.pd)==null?void 0:_.r}pt`;(E=t.pd)!=null&&E.b&&(n+=`padding-bottom: ${o}; `),(R=t.pd)!=null&&R.t&&(n+=`padding-top: ${l}; `),(P=t.pd)!=null&&P.l&&(n+=`padding-left: ${a}; `),(k=t.pd)!=null&&k.r&&(n+=`padding-right: ${d}; `)}]]),r=["bd","tr","tb"];for(const o in t)e&&r.includes(o)||(i=s.get(o))==null||i();return n}function _n(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 nl(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 sl(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 rl(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===ct.COLUMN||!(Number.isNaN(s)&&Number.isNaN(r))&&i===ct.ROW)}function il(t,e){return{startRow:t,endRow:t,startColumn:e,endColumn:e}}function Bn(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=>Bn(t[n],e[n])):t===e:!1}function Tr(t,e){const n=t.ts||{},s=e.ts||{};return t.sId!==e.sId?!1:Bn(n,s)}function ol(t,e){return e.some(n=>t.indexOf(n)>-1)}function $n(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 ll(t){if(t==null)return!1;const e=t.bullet;return(e==null?void 0:e.listId)!=null}function al(t){if(t==null)return!1;const e=t.paragraphStyle;return Lr(e)}function Lr(t){return!(t==null||(t.indentStart==null||t.indentStart===0)&&t.hanging==null||t.hanging===0)}function Mr(t,e,n){return t.slice(0,e)+n+t.slice(e)}function Ur(t,e,n){return e>n?t:t.slice(0,e)+t.slice(n)}function ul(t){return t===null||t.toString().replace(/\s/g,"")===""||typeof t=="boolean"?!1:!isNaN(t)}function cl(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 Dr(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 yr(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 Pr(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))}typeof SuppressedError=="function"&&SuppressedError;function je(t){return typeof t=="function"}function hl(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 Wn=hl(function(t){return function(n){t(this),this.message=n?n.length+` errors occurred during unsubscription:
|
|
1
|
+
(function(u,x){typeof exports=="object"&&typeof module<"u"?x(exports,require("rxjs"),require("rxjs/operators"),require("@wendellhu/redi")):typeof define=="function"&&define.amd?define(["exports","rxjs","rxjs/operators","@wendellhu/redi"],x):(u=typeof globalThis<"u"?globalThis:u||self,x(u.UniverCore={},u.rxjs,u.rxjs.operators,u["@wendellhu/redi"]))})(this,function(u,x,oe,ut){"use strict";var Ju=Object.defineProperty;var Zu=(u,x,oe)=>x in u?Ju(u,x,{enumerable:!0,configurable:!0,writable:!0,value:oe}):u[x]=oe;var g=(u,x,oe)=>Zu(u,typeof x!="symbol"?x+"":x,oe);var fo,_o;function Ro(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 Co(){po()}const rn=typeof global<"u"?global:typeof self<"u"?self:window;function po(){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 Io="__default_document_sub_component_id20231101__",We=2,Ls=1;function Oo(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:d=0,width:h=0,angle:c=0}=t,f=h,_=d,E=i,R=r;return Math.abs(l-n)>We||Math.abs(a-s)>We||Math.abs(f-E)>We||Math.abs(_-R)>We||Math.abs(c-o)>Ls}function Ds(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 ys(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 So(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=ys(t,e):n=Ds(t,e),n)}function No(t){const e=new Blob([t],{type:"text/javascript"});return window.URL.createObjectURL(e)}var Ps=(t=>(t[t.DEFAULT_SERIES=0]="DEFAULT_SERIES",t[t.ALTERNATE_SERIES=1]="ALTERNATE_SERIES",t))(Ps||{}),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||{}),ks=(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))(ks||{}),jt=(t=>(t[t.UNSUPPORTED=0]="UNSUPPORTED",t[t.RGB=1]="RGB",t[t.HEX=2]="HEX",t[t.THEME=3]="THEME",t))(jt||{}),Hs=(t=>(t[t.ON=0]="ON",t[t.OFF=1]="OFF",t))(Hs||{}),Fs=(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))(Fs||{}),Bs=(t=>(t[t.DOCUMENT=0]="DOCUMENT",t[t.PROJECT=1]="PROJECT",t))(Bs||{}),Ws=(t=>(t[t.COLUMNS=0]="COLUMNS",t[t.ROWS=1]="ROWS",t))(Ws||{}),$s=(t=>(t[t.UP=0]="UP",t[t.RIGHT=1]="RIGHT",t[t.DOWN=2]="DOWN",t[t.LEFT=3]="LEFT",t))($s||{});function bo(t){switch(t){case 3:return 1;case 1:return 3;case 0:return 2;case 2:return 0}}var Gs=(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))(Gs||{}),Vs=(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))(Vs||{}),pe=(t=>(t.EN_US="enUS",t.ZH_CN="zhCN",t.RU_RU="ruRU",t))(pe||{}),js=(t=>(t[t.RANGE=0]="RANGE",t[t.SHEET=1]="SHEET",t))(js||{}),xs=(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))(xs||{}),on=(t=>(t[t.GRID=0]="GRID",t[t.KANBAN=1]="KANBAN",t[t.GANTT=2]="GANTT",t))(on||{}),$e=(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))($e||{}),Ks=(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))(Ks||{}),Ie=(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))(Ie||{}),Ue=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TOP=1]="TOP",t[t.MIDDLE=2]="MIDDLE",t[t.BOTTOM=3]="BOTTOM",t))(Ue||{}),Ge=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.OVERFLOW=1]="OVERFLOW",t[t.CLIP=2]="CLIP",t[t.WRAP=3]="WRAP",t))(Ge||{}),ln=(t=>(t[t.NORMAL=0]="NORMAL",t[t.ITALIC=1]="ITALIC",t))(ln||{}),an=(t=>(t[t.NORMAL=0]="NORMAL",t[t.BOLD=1]="BOLD",t))(an||{}),Le=(t=>(t[t.NORMAL=1]="NORMAL",t[t.SUBSCRIPT=2]="SUBSCRIPT",t[t.SUPERSCRIPT=3]="SUPERSCRIPT",t))(Le||{}),Z=(t=>(t[t.FALSE=0]="FALSE",t[t.TRUE=1]="TRUE",t))(Z||{}),Oe=(t=>(t[t.STRING=1]="STRING",t[t.NUMBER=2]="NUMBER",t[t.BOOLEAN=3]="BOOLEAN",t[t.FORCE_STRING=4]="FORCE_STRING",t))(Oe||{}),Bt=(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))(Bt||{}),un=(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))(un||{}),Ys=(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))(Ys||{}),zs=(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))(zs||{}),Xs=(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))(Xs||{}),qs=(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))(qs||{});const Js={[un.OFFICE]:{[Bt.ACCENT1]:"#4472C4",[Bt.ACCENT2]:"#ED7D31",[Bt.ACCENT3]:"#A5A5A5",[Bt.ACCENT4]:"#70AD47",[Bt.ACCENT5]:"#5B9BD5",[Bt.ACCENT6]:"#70AD47",[Bt.DARK1]:"#000000",[Bt.DARK2]:"#44546A",[Bt.LIGHT1]:"#FFFFFF",[Bt.LIGHT2]:"#E7E6E6",[Bt.HYPERLINK]:"#0563C1",[Bt.FOLLOWED_HYPERLINK]:"#954F72"}};class cn{constructor(){g(this,"_themeValue",Bt.LIGHT1);g(this,"_themeColors");g(this,"_themeTint");g(this,"_rgbValue","");g(this,"_colorType");this._colorType=jt.UNSUPPORTED,this._themeColors=un.OFFICE,this._themeTint=0}asRgbColor(){return new hn(this._rgbValue,this)}asThemeColor(){return new dn(this._themeValue,this._themeTint,this._themeColors,this)}build(){switch(this._colorType){case jt.THEME:return this.asThemeColor();case jt.RGB:return this.asRgbColor();case jt.UNSUPPORTED:throw new Error("unsupported color type")}}setRgbColor(e){return this._colorType=jt.RGB,this._rgbValue=e,this}setThemeColors(e){this._colorType=jt.THEME,this._themeColors=e}setThemeTint(e){this._colorType=jt.THEME,this._themeTint=e}setThemeColor(e){return this._colorType=jt.THEME,this._themeValue=e,this}getColorType(){return this._colorType}}class Se{constructor(e){g(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 cn().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 Se(this._builder)}equals(e){return!1}}class Zs{constructor(e){g(this,"_saturation",0);g(this,"_hue",0);g(this,"_lightness",0);g(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 cn;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,d=this.setColor(n,s,a);return e.setRgbColor(`rgba(${Math.round(o*255)},${Math.round(l*255)},${Math.round(d*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 Kt=class Kt extends Se{constructor(n,s){super(s);g(this,"_cssString");g(this,"_red");g(this,"_green");g(this,"_blue");g(this,"_alpha");let r=n.match(Kt.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(Kt.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 Se.rgbColorToHexValue(this)}getRed(){let n=this._red+Kt.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getGreen(){let n=this._green+Kt.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getBlue(){let n=this._blue+Kt.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getAlpha(){return this._alpha}getColorType(){return jt.RGB}clone(){return new Kt(this._cssString,this._builder)}asThemeColor(){throw new Error("rgb color not support to themeColor")}equals(n){return n instanceof Kt?n._red===this._red&&n._blue===this._blue&&n._green===this._green&&n._alpha===this._alpha:!1}getCssString(){return this._cssString}};g(Kt,"RGB_COLOR_AMT",0),g(Kt,"RGBA_EXTRACT",new RegExp("\\s*rgba\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d.\\d|\\d\\s*)\\)\\s*")),g(Kt,"RGB_EXTRACT",new RegExp("\\s*rgb\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*)\\)\\s*"));let hn=Kt;const Re=class Re extends Se{constructor(n,s,r,i){super(i);g(this,"_themeColorType");g(this,"_themeTint");g(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=Js[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(Re._cacheThemeColor.has(this._themeColors)){if(r=Re._cacheThemeColor.get(this._themeColors),r.has(this._themeColorType))return r.get(this._themeColorType)}else r=new Map,Re._cacheThemeColor.set(this._themeColors,r);const i=new Zs(Se.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 Re(this._themeColorType,this._themeTint,this._themeColors,this._builder)}equals(n){return n instanceof Re?n._themeColorType===this._themeColorType:!1}getColorType(){return jt.THEME}getThemeColorType(){return this._themeColorType}};g(Re,"_cacheThemeColor",new Map);let dn=Re;const vo="rgb(",Ao="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 Jt{constructor(e){g(this,"_color");g(this,"_rgbColor");g(this,"_isValid",!1);if(e==null){this._setNullColor();return}if(e instanceof Jt){this._color={...e._color},this._rgbColor={...e._rgbColor};return}const n=Qs(e);if(n==null){this._setNullColor();return}this._color=n;const s=Lo(this._color);if(s==null){this._setNullColor();return}this._rgbColor=s,this._isValid=!0}static mix(e,n,s){var d,h;s=Math.min(1,Math.max(0,s));const r=new Jt(e).toRgb(),i=new Jt(n).toRgb(),o=(d=r.a)!=null?d:1,l=(h=i.a)!=null?h: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 Jt(a)}static getContrastRatio(e,n){const s=new Jt(e).getLuminance(),r=new Jt(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=[fn(Math.round(n).toString(16)),fn(Math.round(s).toString(16)),fn(Math.round(r).toString(16)),fn(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 ko(this.toRgb())}toHsl(){return Po(this.toRgb())}lighten(e=10){const n=this.toHsl();return n.l+=e,n.l=Math.min(Math.max(n.l,0),100),new Jt(n)}darken(e=10){const n=this.toHsl();return n.l-=e,n.l=Math.min(Math.max(n.l,0),100),new Jt(n)}setAlpha(e){return new Jt({...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 fn=t=>t.length===1?`0${t}`:t,Hn=t=>(t/=255,t<=.03928?t/12.92:((t+.055)/1.055)**2.4),Qs=t=>{if(Fo(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 wo(e);if(e.startsWith("rgb"))return To(e);if(e.startsWith("hsl"))return Mo(e);if(e.startsWith("hsv"))return Uo(e)},wo=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},To=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},Mo=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},Uo=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},Lo=t=>{const e=Qs(t);if(e!=null)return"r"in e?e:"l"in e?Do(e):yo(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),Do=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,d=2*s-a;r=Fn(d,a,e+1/3),i=Fn(d,a,e),o=Fn(d,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},yo=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),d=r%6,h=[s,l,o,o,a,s][d],c=[a,s,s,l,o,o][d],f=[o,o,a,s,s,l][d],_={r:h*255,g:c*255,b:f*255};return t.a!==void 0&&(_.a=t.a),_},Po=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 h=r-i;switch(a=o>.5?h/(2-r-i):h/(r+i),r){case e:l=(n-s)/h+(n<s?6:0);break;case n:l=(s-e)/h+2;break;default:l=(e-n)/h+4;break}l/=6}const d={h:Math.round(l*360),s:Math.round(a*100),l:Math.round(o*100)};return t.a!==void 0&&(d.a=t.a),d},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);let o;const l=r,a=r-i,d=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 h={h:Math.round(o*360),s:Math.round(d*100),v:Math.round(l*100)};return t.a!==void 0&&(h.a=t.a),h},Ho=t=>t==null,Fo=t=>!Ho(t)&&typeof t=="object";function Bo(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 kt=(t=>(t[t.COVER=0]="COVER",t[t.REPLACE=1]="REPLACE",t[t.INTERSECTION=2]="INTERSECTION",t))(kt||{});function $o(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 Go(t){if(t.t!==void 0)return t.t;if(typeof t.v=="string")return Oe.STRING;if(typeof t.v=="number")return Oe.NUMBER;if(typeof t.v=="boolean")return Oe.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 jo(t){return t!=null&&(typeof t=="string"||typeof t=="number"||typeof t=="boolean")}var tr=(t=>(t[t.character=0]="character",t[t.paragraph=1]="paragraph",t[t.table=2]="table",t[t.numbering=3]="numbering",t))(tr||{}),er=(t=>(t[t.TAB=0]="TAB",t[t.SPACE=1]="SPACE",t[t.NOTHING=2]="NOTHING",t))(er||{}),Ve=(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))(Ve||{}),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||{}),nr=(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))(nr||{}),sr=(t=>(t[t.DRAWING=0]="DRAWING",t[t.CUSTOM=1]="CUSTOM",t))(sr||{}),rr=(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))(rr||{}),ir=(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))(ir||{}),or=(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))(or||{}),lr=(t=>(t[t.NORMAL=0]="NORMAL",t[t.TBRL=1]="TBRL",t[t.LRTBV=2]="LRTBV",t))(lr||{}),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||{}),ur=(t=>(t[t.BOTH_SIDES=0]="BOTH_SIDES",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT",t[t.LARGEST=3]="LARGEST",t))(ur||{}),cr=(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))(cr||{}),hr=(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))(hr||{}),dr=(t=>(t[t.AUTO=0]="AUTO",t[t.AT_LEAST=1]="AT_LEAST",t[t.EXACT=2]="EXACT",t))(dr||{}),fr=(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))(fr||{}),_r=(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))(_r||{}),gr=(t=>(t.EVENLY_DISTRIBUTED="0",t.FIXED_WIDTH="1",t))(gr||{}),mr=(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))(mr||{}),Er=(t=>(t.NORMAL="normal",t.BOLD="bold",t.ITALIC="italic",t))(Er||{}),Rr=(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))(Rr||{}),Cr=(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))(Cr||{}),pr=(t=>(t[t.POINT=0]="POINT",t[t.LINE=1]="LINE",t[t.CHARACTER=2]="CHARACTER",t))(pr||{}),Ir=(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))(Ir||{}),Or=(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))(Or||{}),Sr=(t=>(t[t.compressPunctuation=0]="compressPunctuation",t[t.compressPunctuationAndJapaneseKana=1]="compressPunctuationAndJapaneseKana",t[t.doNotCompress=2]="doNotCompress",t))(Sr||{}),Nr=(t=>(t[t.PORTRAIT=0]="PORTRAIT",t[t.LANDSCAPE=1]="LANDSCAPE",t))(Nr||{}),br=(t=>(t[t.forward=0]="forward",t[t.backward=1]="backward",t[t.front=2]="front",t[t.back=3]="back",t))(br||{}),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||{}),ot=(t=>(t[t.NORMAL=0]="NORMAL",t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN",t[t.ALL=3]="ALL",t))(ot||{}),Nt=(t=>(t[t.NONE=0]="NONE",t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN",t[t.ALL=3]="ALL",t))(Nt||{});function xo(t){return[t.startRow,t.startColumn,t.endRow,t.endColumn]}function Ko(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 d=0;d<n.length;d++){const{startRow:h,endRow:c,startColumn:f,endColumn:_}=n[d];if(t===h&&e===f){i=c,o=_,l=h,a=f,r=!0;break}if(t>=h&&t<=c&&e>=f&&e<=_){i=c,o=_,l=h,a=f,s=!0;break}}return{actualRow:t,actualColumn:e,isMergedMainCell:r,isMerged:s,endRow:i,endColumn:o,startRow:l,startColumn:a}}var Bn=(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))(Bn||{}),Ar=(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))(Ar||{}),wr=(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))(wr||{});const Yo="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let zo=t=>crypto.getRandomValues(new Uint8Array(t)),Xo=(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}}},qo=(t,e=21)=>Xo(t,e,zo),Jo=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=Yo[n[t]&63];return e};const Zo=/^-ms-/,Qo=/-([a-z])/g,fe=["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>=fe.length;)s/=fe.length,s-=1,n+=fe[s%fe.length];const r=e%fe.length;return n+=fe[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+=fe.length**i+fe.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 h=Number.parseFloat(RegExp.$1);return h===7?"IE7":h===8?"IE8":h===9?"IE9":h===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?qo(n,e)():Jo(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,d)=>{var h,c;if(y.isArray(a)){const f=(h=l[d])!=null?h:[];l[d]=f,s(a,f);return}if(y.isObject(a)){const f=(c=l[d])!=null?c:{};l[d]=f,r(a,f);return}l[d]=a})}function r(o,l){Object.keys(o).forEach(a=>{var h,c;const d=o[a];if(y.isObject(d)){const f=(h=l[a])!=null?h:{};l[a]=f,r(d,f);return}if(y.isArray(d)){const f=(c=l[a])!=null?c:[];l[a]=f,s(d,f);return}l[a]=d})}function i(o){Object.keys(o).forEach(l=>{var d,h;const a=o[l];if(y.isArray(a)){const c=(d=e[l])!=null?d:[];e[l]=c,s(a,c);return}if(y.isObject(a)){const c=(h=e[l])!=null?h:{};e[l]=c,r(a,c);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),d=y.getValueType(l);return a!==d?!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,d=o.length;a<d;a++){const h=o[a],c=l[a];if(!s(h,c))return!1}return!0}function i(o,l){const a=Object.keys(o),d=Object.keys(l);if(a.length!==d.length)return!1;for(const h of a){if(!d.includes(h))return!1;const c=o[h],f=l[h];if(!s(c,f))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(Zo,"ms-").replace(Qo,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 tl(t){if(!t)return;const{actualRow:e,actualColumn:n,isMerged:s,isMergedMainCell:r,mergeInfo:i}=t;let{startY:o,endY:l,startX:a,endX:d}=t,h=e,c=n,f=e,_=n;if(s&&i){const{startRow:E,startColumn:R,endRow:H,endColumn:k,startY:tt,endY:mt,startX:ft,endX:C}=i;h=E,c=R,f=H,_=k,o=tt,l=mt,a=ft,d=C}return r&&(o=i.startY,l=i.endY,a=i.startX,d=i.endX,f=i.endRow,_=i.endColumn),{startRow:h,startColumn:c,endRow:f,endColumn:_,startY:o,endY:l,startX:a,endX:d}}function el(t){if(!t)return;const{actualRow:e,actualColumn:n,isMerged:s,isMergedMainCell:r,startRow:i,startColumn:o,endRow:l,endColumn:a}=t;let d=e,h=n,c=e,f=n;return(s||r)&&(d=i,h=o,c=l,f=a),{startRow:d,startColumn:h,endRow:c,endColumn:f}}function Tr(t){var n;return!t||(((n=t==null?void 0:t.v)==null?void 0:n.toString())||"").length===0&&!t.p}function nl(t){return Tr(t)&&(t==null?void 0:t.coverable)!==!1}function se(t){if(t){if(t.rgb)return t.rgb;if(t.th)return new cn().setThemeColor(t.th).asThemeColor().asRgbColor().getCssString()}return null}function sl(t){return y.isString(t)&&t.substring(0,1)==="="&&t.length>1}function rl(t){return y.isString(t)&&t.length>0}function il(t){return""}function ol(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: ${se(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: ${se(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: ${se(t.ol.cl)}; `),t.ol.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${t.ol.t} `))}],["bg",()=>{t.bg&&(n+=`background: ${se(t.bg)}; `)}],["bd",()=>{var o,l,a,d,h,c,f,_,E,R,H,k;(o=t.bd)!=null&&o.b&&(n+=`border-bottom: ${_n((l=t.bd)==null?void 0:l.b.s)} ${(a=se(t.bd.b.cl))!=null?a:""}; `),(d=t.bd)!=null&&d.t&&(n+=`border-top: ${_n((h=t.bd)==null?void 0:h.t.s)} ${(c=se(t.bd.t.cl))!=null?c:""}; `),(f=t.bd)!=null&&f.r&&(n+=`border-right: ${_n((_=t.bd)==null?void 0:_.r.s)} ${(E=se(t.bd.r.cl))!=null?E:""}; `),(R=t.bd)!=null&&R.l&&(n+=`border-left: ${_n((H=t.bd)==null?void 0:H.l.s)} ${(k=se(t.bd.l.cl))!=null?k:""}; `)}],["cl",()=>{t.cl&&(n+=`color: ${se(t.cl)}; `)}],["va",()=>{t.va===Le.SUBSCRIPT?n+="vertical-align: sub; ":t.va===Le.SUPERSCRIPT&&(n+="vertical-align: super; ")}],["td",()=>{t.td===$e.LEFT_TO_RIGHT?n+="direction: ltr; ":t.td===$e.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===Ie.LEFT?n+="text-align: left; ":t.ht===Ie.RIGHT?n+="text-align: right; ":t.ht===Ie.CENTER?n+="text-align: center; ":t.ht===Ie.JUSTIFIED&&(n+="text-align: justify; ")}],["vt",()=>{t.vt===Ue.BOTTOM?n+="vertical-align: bottom; ":t.vt===Ue.TOP?n+="vertical-align: top; ":t.vt===Ue.MIDDLE&&(n+="vertical-align: middle; ")}],["tb",()=>{t.tb===Ge.CLIP?n+="white-space: clip; ":t.tb===Ge.WRAP&&(n+="white-space: normal;")}],["pd",()=>{var h,c,f,_,E,R,H,k;const o=`${(h=t.pd)==null?void 0:h.b}pt`,l=`${(c=t.pd)==null?void 0:c.t}pt`,a=`${(f=t.pd)==null?void 0:f.l}pt`,d=`${(_=t.pd)==null?void 0:_.r}pt`;(E=t.pd)!=null&&E.b&&(n+=`padding-bottom: ${o}; `),(R=t.pd)!=null&&R.t&&(n+=`padding-top: ${l}; `),(H=t.pd)!=null&&H.l&&(n+=`padding-left: ${a}; `),(k=t.pd)!=null&&k.r&&(n+=`padding-right: ${d}; `)}]]),r=["bd","tr","tb"];for(const o in t)e&&r.includes(o)||(i=s.get(o))==null||i();return n}function _n(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 ll(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 al(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 ul(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===ot.COLUMN||!(Number.isNaN(s)&&Number.isNaN(r))&&i===ot.ROW||i!==ot.ROW&&i!==ot.COLUMN&&(Number.isNaN(s)||Number.isNaN(e)||Number.isNaN(r)||Number.isNaN(n)))}function cl(t,e){return{startRow:t,endRow:t,startColumn:e,endColumn:e}}function Wn(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=>Wn(t[n],e[n])):t===e:!1}function Mr(t,e){const n=t.ts||{},s=e.ts||{};return t.sId!==e.sId?!1:Wn(n,s)}function hl(t,e){return e.some(n=>t.indexOf(n)>-1)}function $n(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 dl(t){if(t==null)return!1;const e=t.bullet;return(e==null?void 0:e.listId)!=null}function fl(t){if(t==null)return!1;const e=t.paragraphStyle;return Ur(e)}function Ur(t){return!(t==null||(t.indentStart==null||t.indentStart===0)&&t.hanging==null||t.hanging===0)}function Lr(t,e,n){return t.slice(0,e)+n+t.slice(e)}function Dr(t,e,n){return e>n?t:t.slice(0,e)+t.slice(n)}function _l(t){return t===null||t.toString().replace(/\s/g,"")===""||typeof t=="boolean"?!1:!isNaN(t)}function gl(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 yr(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 Pr(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 kr(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))}typeof SuppressedError=="function"&&SuppressedError;function je(t){return typeof t=="function"}function ml(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 Gn=ml(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 kr(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var Hr=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=Dr(o),a=l.next();!a.done;a=l.next()){var d=a.value;d.remove(this)}}catch(R){e={error:R}}finally{try{a&&!a.done&&(n=l.return)&&n.call(l)}finally{if(e)throw e.error}}else o.remove(this);var h=this.initialTeardown;if(je(h))try{h()}catch(R){i=R instanceof Wn?R.errors:[R]}var c=this._finalizers;if(c){this._finalizers=null;try{for(var f=Dr(c),_=f.next();!_.done;_=f.next()){var E=_.value;try{Fr(E)}catch(R){i=i!=null?i:[],R instanceof Wn?i=Pr(Pr([],yr(i)),yr(R.errors)):i.push(R)}}}catch(R){s={error:R}}finally{try{_&&!_.done&&(r=f.return)&&r.call(f)}finally{if(s)throw s.error}}}if(i)throw new Wn(i)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)Fr(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)&&kr(n,e)},t.prototype.remove=function(e){var n=this._finalizers;n&&kr(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}();Hr.EMPTY;function dl(t){return t instanceof Hr||t&&"closed"in t&&je(t.remove)&&je(t.add)&&je(t.unsubscribe)}function Fr(t){je(t)?t():t.unsubscribe()}class Br{constructor(e=!1){g(this,"skipNextObservers");g(this,"lastReturnValue");g(this,"isStopPropagation",!1);this.initialize(e)}initialize(e=!1){return this.skipNextObservers=e,this}stopPropagation(){this.isStopPropagation=!0}}function $r(t){return t instanceof gn}class gn{constructor(e,n){this.callback=e,this.observable=n}dispose(){this.observable.remove(this)}}class mn{constructor(e){g(this,"_observers",new Array);g(this,"_eventState");g(this,"_onObserverAdded");this._eventState=new Br,e&&(this._onObserverAdded=e)}get observers(){return this._observers}add(e,n=!1){if(!e)return null;const s=new gn(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 mn;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 bt(t){let e=!1;return t?dl(t)?{dispose:()=>t.unsubscribe()}:$r(t)?{dispose:()=>{e||(e=!0,t.dispose())}}:typeof t=="function"?{dispose:()=>{e||(e=!0,t())}}:t:bt(()=>{})}function fl(t){return bt(()=>{t.unsubscribe()})}class Gn{constructor(){g(this,"_disposables",new Set)}add(e){const n=bt(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(){g(this,"_disposed",!1);g(this,"_collection",new Gn)}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 _l extends yt{constructor(){super(...arguments);g(this,"dispose$",new x.Subject)}dispose(){super.dispose(),this.dispose$.next(),this.dispose$.complete()}}class xe{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 En(t,e){const n=t.indexOf(e);return n>-1?(t.splice(n,1),!0):!1}function gl(t){const e=new Set,n=[];for(const s of t)e.has(s)||(e.add(s),n.push(s));return n}function ml(t,e){for(let n=t.length-1;n>-1;n--){const s=t[n];if(e(s,n))return s}return null}function El(t,e){if(t.length===0)return t;const n=e%t.length;return t.slice(n).concat(t.slice(0,n))}function Rl(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 ht=Symbol("newer"),Lt=Symbol("older");class Wr{constructor(e){g(this,"entry");this.entry=e}[Symbol.iterator](){return this}next(){const e=this.entry;return e?(this.entry=e[ht],{done:!1,value:e.key}):{done:!0,value:void 0}}}class Gr{constructor(e){g(this,"entry");this.entry=e}[Symbol.iterator](){return this}next(){const e=this.entry;return e?(this.entry=e[ht],{done:!1,value:e.value}):{done:!0,value:void 0}}}class Vr{constructor(e){g(this,"entry");this.entry=e}[Symbol.iterator](){return this}next(){const e=this.entry;return e?(this.entry=e[ht],{done:!1,value:[e.key,e.value]}):{done:!0,value:void 0}}}class Vn{constructor(e,n){g(this,"key");g(this,"value");g(this,Vu);g(this,ju);this.key=e,this.value=n,this[ht]=void 0,this[Lt]=void 0}toJSON(){return{key:this.key,value:this.value}}}Vu=ht,ju=Lt;class jr{constructor(...e){g(this,"_keymap");g(this,"size",0);g(this,"limit");g(this,"oldest");g(this,"newest");g(this,"_onShiftListeners",[]);if(xe.hasLength(e,1)){if(xe.isNumber(e[0])){const n=e[0];this._initialize(n,void 0);return}if(xe.isIterable(e[0])){const n=e[0];this._initialize(0,n);return}return}if(xe.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),bt(()=>En(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[ht]&&(e===this.oldest&&(this.oldest=e[ht]),e[ht][Lt]=e[Lt]),e[Lt]&&(e[Lt][ht]=e[ht]),e[ht]=void 0,e[Lt]=this.newest,this.newest&&(this.newest[ht]=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 Vn(i.value[0],i.value[1]);if(this._keymap.set(o.key,o),n?(n[ht]=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 Vn(e,n)),this.newest?(this.newest[ht]=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[ht]?(this.oldest=this.oldest[ht],this.oldest[Lt]=void 0):(this.oldest=void 0,this.newest=void 0),e[ht]=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[ht]&&n[Lt]?(n[Lt][ht]=n[ht],n[ht][Lt]=n[Lt]):n[ht]?(n[ht][Lt]=void 0,this.oldest=n[ht]):n[Lt]?(n[Lt][ht]=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 Wr(this.oldest)}values(){return new Gr(this.oldest)}entries(){return this[Symbol.iterator]()}[Symbol.iterator](){return new Vr(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[ht]}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[ht];return e}toString(){let e="",n=this.oldest;for(;n;)e+=`${String(n.key)}:${n.value}`,n=n[ht],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 jn(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 Cl(t,e){const n=t,s=Object.keys(n),r=s.length,i=e,o=Object.keys(i),l=o.length,a={};let d=0;for(let h=0;h<r;h++,d++){const c=s[h];a[d]=n[c]}for(let h=0;h<l;h++,d++){const c=o[h];a[d]=i[c]}return a}function pl(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 Kn(t,e,n,s){const r=t>n;if(!r&&t+e>n)throw new Error("Invalid move operation");r?Il(t,e,n,s):Ol(t,e,n,s)}function Il(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 Ol(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 Zt{constructor(e={}){g(this,"_matrix");this._setOriginValue(e)}static MakeObjectMatrixSize(e){return new Zt({[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 d=Number(a),h=o[Number(a)];if(e(i,d,h)===!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){Kn(e,n,s,this._matrix)}moveColumns(e,n,s){this.forEach((r,i)=>{Kn(e,n,s,i)})}insertRows(e,n){for(let s=e;s<e+n;s++)jn(s,{},this._matrix)}insertColumns(e,n){for(let s=e;s<e+n;s++)this.forEach((r,i)=>{jn(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 Zt;let o=0;for(let l=e;l<=n;l++){const a={};let d=0;for(let h=s;h<=r;h++){const c=this.getValue(l,h);a[d]=c,d++}i.setRow(o,a),o++}return i}getSlice(e,n,s,r){const i=new Zt;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 Zt;return this.forEach((o,l)=>{s||(s=!0,e=o),Object.keys(l).forEach(a=>{const d=Number(a);r?d<n&&(n=d):(r=!0,n=d);const h=this.getValue(o,d);i.setValue(o-e,d-n,h)})}),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 d=_e(a)-1;d>s&&(s=d),Object.keys(a).forEach(h=>{const c=Number(h);o?c<n&&(n=c):(o=!0,n=c)}),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 le=class le{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===ct.NORMAL||n.rangeType===void 0&&e.rangeType===ct.NORMAL)}static intersects(e,n){if(e.rangeType===ct.ROW&&n.rangeType===ct.COLUMN||e.rangeType===ct.COLUMN&&n.rangeType===ct.ROW)return!0;if(e.rangeType===ct.ROW&&n.rangeType===ct.ROW)return e.startRow<=n.endRow&&e.endRow>=n.startRow;if(e.rangeType===ct.COLUMN&&n.rangeType===ct.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,d=Number.isNaN(n.endRow)?s:n.endRow,h=Number.isNaN(n.startColumn)?0:n.startColumn,c=Number.isNaN(n.endColumn)?s:n.endColumn,f=Math.abs(o+l-h-c),_=Math.abs(o-l)+Math.abs(h-c),E=Math.abs(r+i-a-d),R=Math.abs(r-i)+Math.abs(a-d);return f<=_&&E<=R}static getIntersects(e,n){const s=e.startRow,r=e.endRow,i=e.startColumn,o=e.endColumn,l=n.startRow,a=n.endRow,d=n.startColumn,h=n.endColumn;let c,f,_,E;if(l<=r)l>=s?f=l:f=s;else return null;if(a>=s)a>=r?E=r:E=a;else return null;if(d<=o)d>i?c=d:c=i;else return null;if(h>=i)h>=o?_=o:_=h;else return null;return{startRow:f,endRow:E,startColumn:c,endColumn:_,rangeType:ct.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 le.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:ct.NORMAL}),e[0])}static realUnion(...e){const n=e.some(i=>i.rangeType===ct.COLUMN),s=e.some(i=>i.rangeType===ct.ROW),r=le.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?ct.ROW:n?ct.COLUMN:ct.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)}};g(le,"getRelativeRange",(e,n)=>({startRow:e.startRow-n.startRow,endRow:e.endRow-e.startRow,startColumn:e.startColumn-n.startColumn,endColumn:e.endColumn-e.startColumn})),g(le,"getPositionRange",(e,n,s)=>({...s||{},startRow:s&&[Nt.ROW,Nt.ALL].includes(s.startAbsoluteRefType||0)?s.startRow:e.startRow+n.startRow,endRow:s&&[Nt.ROW,Nt.ALL].includes(s.endAbsoluteRefType||0)?s.endRow:e.endRow+e.startRow+n.startRow,startColumn:s&&[Nt.COLUMN,Nt.ALL].includes(s.startAbsoluteRefType||0)?s.startColumn:e.startColumn+n.startColumn,endColumn:s&&[Nt.COLUMN,Nt.ALL].includes(s.endAbsoluteRefType||0)?s.endColumn:e.endColumn+e.startColumn+n.startColumn})),g(le,"moveHorizontal",(e,n=0,s=0)=>({...e,startColumn:e.startColumn+n,endColumn:e.endColumn+n+s})),g(le,"moveVertical",(e,n=0,s=0)=>({...e,startRow:e.startRow+n,endRow:e.endRow+n+s})),g(le,"moveOffset",(e,n,s)=>({...e,startRow:e.startRow+s,endRow:e.endRow+s,startColumn:e.startColumn+n,endColumn:e.endColumn+n}));let ge=le;class Sl{constructor(e,n){g(this,"_values",[]);g(this,"_keys",[]);g(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 Yn(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 Nl(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 Rn=65,xr=90,bl=97;function vl(t){const e=xr-Rn+1;let n="";for(;t>=0;)n=String.fromCharCode(t%e+Rn)+n,t=Math.floor(t/e)-1;return n}function Kr(t,e){let n="";for(;e>0;)n+=t,e--;return n}function Al(t,e=!1){const n=xr-Rn+1;let s=bl;e&&(s=Rn);const r=String.fromCharCode(t%n+s),i=Math.floor(t/n)+1;return Kr(r,i)}function wl(t,e){return t.zIndex>e.zIndex?1:t.zIndex===e.zIndex?0:-1}function Tl(t,e){return t.zIndex>e.zIndex?-1:t.zIndex===e.zIndex?0:1}function ye(t="index",e=1){return(n,s)=>n[t]>s[t]?e:n[t]===s[t]?0:-e}function Ll(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:d}=l;y.hasIntersectionBetweenTwoRanges(e,n,a,d)&&(a>i?(o.push(s.slice(i,a)),o.push(zn(s,{...l,ed:Math.min(d,n)}))):o.push(zn(s,{...l,st:i,ed:Math.min(d,n)}))),i=Math.max(e,Math.min(d,n))}return i!==n&&o.push(s.slice(i,n)),o.join("")}function Ml(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:d={}}=l,{spaceAbove:h,spaceBelow:c,lineSpacing:f}=d,_=[];h!=null&&(typeof h=="number"?_.push(`margin-top: ${h}px`):_.push(`margin-top: ${h.v}px`)),c!=null&&(typeof c=="number"?_.push(`margin-bottom: ${c}px`):_.push(`margin-bottom: ${c.v}px`)),f!=null&&_.push(`line-height: ${f}`),a>o+1?i+=`<p class="UniverNormal" ${_.length?`style="${_.join("; ")};"`:""}>${Cn(t,o+1,a)}</p>`:i+=`<p class="UniverNormal" ${_.length?`style="${_.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:d,st:h,ol:c,bg:f,cl:_,va:E}=r;let R=t.slice(n,s);const P=[];return l===Z.TRUE&&(R=`<i>${R}</i>`),E===De.SUPERSCRIPT?R=`<sup>${R}</sup>`:E===De.SUBSCRIPT&&(R=`<sub>${R}</sub>`),(d==null?void 0:d.s)===Z.TRUE&&(R=`<u>${R}</u>`),(h==null?void 0:h.s)===Z.TRUE&&(R=`<s>${R}</s>`),a===Z.TRUE&&(R=`<strong>${R}</strong>`),i&&P.push(`font-family: ${i}`),_&&P.push(`color: ${_.rgb}`),o&&P.push(`font-size: ${o}pt`),c&&P.push("text-decoration: overline"),f&&P.push(`background: ${f.rgb}`),P.length?`<span style="${P.join("; ")};">${R}</span>`:R}const Ke={sheetId:"",range:{startRow:-1,endRow:-1,startColumn:-1,endColumn:-1}},Ul={startRow:-1,startColumn:-1,endRow:-1,endColumn:-1},Dl={startRow:0,startColumn:0,endRow:0,endColumn:0},yl={row:0,column:0},pn={ff:"Arial",fs:11,it:Z.FALSE,bl:Z.FALSE,ul:{s:Z.FALSE},st:{s:Z.FALSE},ol:{s:Z.FALSE},tr:{a:0,v:Z.FALSE},td:We.UNSPECIFIED,cl:{rgb:"#000"},bg:{rgb:"#fff"},ht:Ie.UNSPECIFIED,vt:Ue.UNSPECIFIED,tb:Ge.UNSPECIFIED,pd:{t:0,r:0,b:0,l:0}},Yr={id:"default_slide",title:"defaultSlide",pageSize:{width:300,height:300}};var zr=(t=>(t.ARRAY_CONVERTOR="ARRAY_CONVERTOR",t.MATRIX_CONVERTOR="MATRIX_CONVERTOR",t))(zr||{});function In(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 Z.FALSE;switch(t){case"bl":case"it":{if(o[t]===Z.FALSE)return Z.FALSE;break}case"ul":case"st":{if(o[t].s===Z.FALSE)return Z.FALSE;break}default:throw new Error(`unknown style key: ${t} in IStyleBase`)}s+=a-l}return e.dataStream.indexOf(`\r
|
|
4
|
-
`)===s?Z.TRUE:Z.FALSE}class Ne{constructor(e,n,s){g(this,"_range");g(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 Zt;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 Zt;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)||pn.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 Ne(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 d=0;d<=s-n;d++)for(let h=0;h<=i-r;h++){if(o==null||((l=o==null?void 0:o[d])==null?void 0:l[h])==null)continue;const c=o[d][h].s;c&&(o[d][h].s=a.get(c))}}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)||pn.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?In("ul",e.body)===Z.TRUE?{s:Z.TRUE}:{s:Z.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?In("st",e.body)===Z.TRUE?{s:Z.TRUE}:{s:Z.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?In("it",e.body)===Z.TRUE?ln.ITALIC:ln.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?In("bl",e.body)===Z.TRUE?an.BOLD:an.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){Ne.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]||pn[e]}))}}function Pl(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 Hl(t,e){Ne.foreach(e,(n,s)=>{t[n][s]=void 0})}function Fl(t,e){const n=t.toFullArray(),s=[];for(;;){const r=Pl(n,e);if(!r)break;s.push(r),Hl(n,r)}return s}function Bl(t,e,n,s=!1){let r={...t};const i=r.startAbsoluteRefType||Nt.NONE,o=r.endAbsoluteRefType||Nt.NONE;return!s&&i===Nt.ALL&&o===Nt.ALL?r:s||i===Nt.NONE&&o===Nt.NONE?ge.moveOffset(r,e,n):(i===Nt.NONE?r={...r,startRow:r.startRow+n,startColumn:r.startColumn+e}:i===Nt.COLUMN?r={...r,startRow:r.startRow+n}:i===Nt.ROW&&(r={...r,startColumn:r.startColumn+e}),o===Nt.NONE?r={...r,endRow:r.endRow+n,endColumn:r.endColumn+e}:o===Nt.COLUMN?r={...r,endRow:r.endRow+n}:o===Nt.ROW&&(r={...r,endColumn:r.endColumn+e}),r)}async function Xr(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 qr(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 Ye=at.createIdentifier("univer.context-service");class Jr extends yt{constructor(){super(...arguments);g(this,"_contextChanged$",new x.Subject);g(this,"contextChanged$",this._contextChanged$.asObservable());g(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 x.Observable(s=>{const r=this._contextChanged$.pipe(x.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 Zr=(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))(Zr||{});const me=at.createIdentifier("univer.log");class Qr extends yt{constructor(){super(...arguments);g(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 $l=Object.defineProperty,Wl=Object.getOwnPropertyDescriptor,Gl=(t,e,n,s)=>{for(var r=s>1?void 0:s?Wl(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&&$l(e,n,r),r},ti=(t,e)=>(n,s)=>e(n,s,t),ze=(t=>(t[t.COMMAND=0]="COMMAND",t[t.OPERATION=1]="OPERATION",t[t.MUTATION=2]="MUTATION",t))(ze||{});const Xe=at.createIdentifier("anywhere.command-service");class Vl{constructor(){g(this,"_commands",new Map);g(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),bt(()=>{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 ei={id:"nil",type:0,handler:()=>!0};u.CommandService=class{constructor(e,n){g(this,"_commandRegistry");g(this,"_beforeCommandExecutionListeners",[]);g(this,"_commandExecutedListeners",[]);g(this,"_multiCommandDisposables",new Map);g(this,"_commandExecutingLevel",0);g(this,"_commandExecutionStack",[]);this._injector=e,this._logService=n,this._commandRegistry=new Vl,this._registerCommand(ei)}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),bt(()=>{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),bt(()=>{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(d=>d(o,s));const a=await this._execute(i,n,s);return this._commandExecutedListeners.forEach(d=>d(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 h=ml(this._commandExecutionStack,c=>c.type===0);h&&(l.params=(i=l.params)!=null?i:{},l.params.trigger=h.id)}const a=this._pushCommandExecutionStack(l);this._beforeCommandExecutionListeners.forEach(h=>h(l,s));const d=this._syncExecute(o,n,s);return this._commandExecutedListeners.forEach(h=>h(l,s)),a.dispose(),d}throw new Error(`[CommandService]: command "${e}" is not registered.`)}_pushCommandExecutionStack(e){return this._commandExecutionStack.push(e),bt(()=>En(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 Gn;s=new jl(e.id),i.add(this._commandRegistry.registerCommand(s)),i.add(bt(()=>{this._multiCommandDisposables.delete(e.id)})),this._multiCommandDisposables.set(e.id,i)}const r=s.registerImplementation(e);return bt(()=>{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}},u.CommandService=Gl([ti(0,at.Inject(at.Injector)),ti(1,me)],u.CommandService);class jl{constructor(e){g(this,"name");g(this,"multi",!0);g(this,"type",0);g(this,"priority",0);g(this,"_implementations",[]);g(this,"handler",async(e,n)=>{if(!this._implementations.length)return!1;const s=e.get(me),r=e.get(Ye),i=e.get(at.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),bt(()=>{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 Xn(t,e,n){const s=t.map(r=>()=>e.syncExecuteCommand(r.id,r.params,n));return qr(s)}function xl(t,e,n){const s=t.map(r=>()=>e.executeCommand(r.id,r.params,n));return Xr(s)}function ni(t){return new x.Observable(e=>{const n=t((...s)=>e.next(s));return()=>n==null?void 0:n.dispose()})}const Kl=t=>new Promise(e=>{x.merge(ni(t.onCommandExecuted).pipe(se.filter(([n])=>n.type===ze.MUTATION)),x.timer(300)).pipe(se.debounceTime(16),se.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.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.UNRECOGNIZED=-1]="UNRECOGNIZED",t))(xt||{});function si(t){return!!(t&&t.code&&t.code!==xt.OK&&t.code!=="OK")}var nt=(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))(nt||{}),$t=(t=>(t[t.Reader=0]="Reader",t[t.Editor=1]="Editor",t[t.Owner=2]="Owner",t[t.UNRECOGNIZED=-1]="UNRECOGNIZED",t))($t||{}),On=(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))(On||{});class Sn extends yt{}class qn{constructor(){g(this,"_data",[])}static create(){return new qn}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 Jn{constructor(){g(this,"_data",new Map)}static create(){return new Jn}add(e,n){this._data.has(e)||this._data.set(e,n)}delete(e){this._data.delete(e)}getData(){return this._data}}var Nn=(t=>(t.BULLET_LIST="BULLET_LIST",t.ORDER_LIST="ORDER_LIST",t))(Nn||{});const Yl={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:Ve.DECIMAL,hanging:21,indentStart:21},{bulletAlignment:de.START,glyphFormat:" %1.%2)",textStyle:{fs:12},startNumber:0,glyphType:Ve.DECIMAL,hanging:21,indentStart:42},{bulletAlignment:de.START,glyphFormat:" %1.%2.%3.",textStyle:{fs:12},startNumber:0,glyphType:Ve.DECIMAL,hanging:21,indentStart:63}]}};var ri=(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))(ri||{}),Zn=(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 Wt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ia(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Gt={},_i={},ss={};Object.defineProperty(ss,"__esModule",{value:!0});function oa(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 la(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)?la(t,e):oa(t,e)}ss.default=rs;var is={};Object.defineProperty(is,"__esModule",{value:!0});function os(t){if(t===null)return null;if(Array.isArray(t))return t.map(os);if(typeof t=="object"){const e={};for(let n in t)e[n]=os(t[n]);return e}else return t}is.default=os;var ls={};(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(h,c){if(!h)throw new Error(c)}const n=h=>h!=null&&typeof h=="object"&&!Array.isArray(h),s=(h,c)=>typeof h==typeof c?h>c:typeof h=="string"&&typeof c=="number";function r(h,c){for(let f in h){const _=f;c.write(_,h[_])}}t.isValidPathItem=h=>typeof h=="number"||typeof h=="string"&&h!=="__proto__";class i{constructor(c=null){this.parents=[],this.indexes=[],this.lcIdx=-1,this.idx=-1,this.container=c}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 c=[];let f=this.container,_=this.parents.length-1,E=this.idx;for(;E>=0;)c.unshift(f[E]),E===0?(E=this.indexes[_*2],f=this.parents[_--]):E-=n(f[E-1])?2:1;return c}}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 c;return this.container&&this.container.length>this.idx+1&&n(c=this.container[this.idx+1])?c:null}descendFirst(){let c=this.idx+1;if(!this.container||c>=this.container.length||n(this.container[c])&&c+1>=this.container.length)return!1;n(this.container[c])&&c++;const f=this.container[c];return Array.isArray(f)?(this.indexes.push(this.idx),this.parents.push(this.container),this.indexes.push(c),this.idx=0,this.container=f):this.idx=c,!0}nextSibling(){if(e(this.parents.length===this.indexes.length/2),this.idx>0||this.parents.length===0)return!1;const c=this.indexes[this.indexes.length-1]+1,f=this.parents[this.parents.length-1];return c>=f.length?!1:(e(!isNaN(c)),this.indexes[this.indexes.length-1]=c,this.container=f[c],!0)}_init(c,f,_,E){this.container=c,this.idx=f,this.parents=_.slice(),this.indexes=E.slice()}clone(){const c=new o;return c._init(this.container,this.idx,this.parents,this.indexes),c}*[Symbol.iterator](){if(this.descendFirst()){do yield this.getKey();while(this.nextSibling());this.ascend()}}traverse(c,f){const _=this.getComponent();_&&f(_,c);for(const E of this)c&&c.descend(E),this.traverse(c,f),c&&c.ascend()}eachPick(c,f){this.traverse(c,(_,E)=>{_.p!=null&&f(_.p,E)})}eachDrop(c,f){this.traverse(c,(_,E)=>{_.d!=null&&f(_.d,E)})}}t.ReadCursor=o;class l extends i{constructor(c=null){super(c),this.pendingDescent=[],this._op=c}flushDescent(){e(this.parents.length===this.indexes.length/2),this.container===null&&(this._op=this.container=[]);for(let c=0;c<this.pendingDescent.length;c++){const f=this.pendingDescent[c];let _=this.idx+1;if(_<this.container.length&&n(this.container[_])&&_++,e(_===this.container.length||!n(this.container[_])),_===this.container.length)this.container.push(f),this.idx=_;else if(this.container[_]===f)this.idx=_;else{if(!Array.isArray(this.container[_])){const E=this.container.splice(_,this.container.length-_);this.container.push(E),this.lcIdx>-1&&(this.lcIdx=_)}for(this.indexes.push(this.idx),this.parents.push(this.container),this.lcIdx!==-1&&(e(s(f,this.container[this.lcIdx][0])),_=this.lcIdx+1,this.lcIdx=-1);_<this.container.length&&s(f,this.container[_][0]);)_++;if(this.indexes.push(_),this.idx=0,_<this.container.length&&this.container[_][0]===f)this.container=this.container[_];else{const E=[f];this.container.splice(_,0,E),this.container=E}}}this.pendingDescent.length=0}reset(){this.lcIdx=-1}getComponent(){this.flushDescent();const c=this.idx+1;if(c<this.container.length&&n(this.container[c]))return this.container[c];{const f={};return this.container.splice(c,0,f),f}}write(c,f){const _=this.getComponent();e(_[c]==null||_[c]===f,"Internal consistency error: Overwritten component. File a bug"),_[c]=f}get(){return this._op}descend(c){if(!t.isValidPathItem(c))throw Error("Invalid JSON key");this.pendingDescent.push(c)}descendPath(c){return this.pendingDescent.push(...c),this}ascend(){this.pendingDescent.length?this.pendingDescent.pop():super.ascend()}mergeTree(c,f=r){if(c===null)return;if(e(Array.isArray(c)),c===this._op)throw Error("Cannot merge into my own tree");const _=this.lcIdx,E=this.parents.length;let R=0;for(let P=0;P<c.length;P++){const k=c[P];typeof k=="string"||typeof k=="number"?(R++,this.descend(k)):Array.isArray(k)?this.mergeTree(k,f):typeof k=="object"&&f(k,this)}for(;R--;)this.ascend();this.lcIdx=this.parents.length===E?_:-1}at(c,f){this.descendPath(c),f(this);for(let _=0;_<c.length;_++)this.ascend();return this}writeAtPath(c,f,_){return this.at(c,()=>this.write(f,_)),this.reset(),this}writeMove(c,f,_=0){return this.writeAtPath(c,"p",_).writeAtPath(f,"d",_)}getPath(){const c=super.getPath();return c.push(...this.pendingDescent),c}}t.WriteCursor=l,t.writeCursor=()=>new l,t.readCursor=h=>new o(h);function a(h,c,f){let _,E;E=_=h?h.descendFirst():!1;function R(P){let k;for(;E;){const tt=k=h.getKey();if(P!=null){let mt=!1;if(c&&typeof tt=="number"&&(k=c(tt,h.getComponent()),k<0&&(k=~k,mt=!0)),s(k,P))return null;if(k===P&&!mt)return h}f&&typeof k=="number"&&f(k,h.getComponent()),E=h.nextSibling()}return null}return R.end=()=>{_&&h.ascend()},R}t.advancer=a;function d(h,c,f){let _,E,R,P;for(_=E=h&&h.descendFirst(),R=P=c&&c.descendFirst();_||R;){let k=_?h.getKey():null,tt=R?c.getKey():null;k!==null&&tt!==null&&(s(tt,k)?tt=null:k!==tt&&(k=null)),f(k==null?tt:k,k!=null?h:null,tt!=null?c:null),k!=null&&_&&(_=h.nextSibling()),tt!=null&&R&&(R=c.nextSibling())}E&&h.ascend(),P&&c.ascend()}t.eachChildOf=d})(ls);var as={};(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={}))})(as);var us={},be={},gi;function cs(){return gi||(gi=1,Object.defineProperty(be,"__esModule",{value:!0}),be.uniToStrPos=be.strPosToUni=void 0,be.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},be.uniToStrPos=(t,e)=>{let n=0;for(;e>0;e--){const s=t.charCodeAt(n);n+=s>=55296&&s<=57343?2:1}return n}),be}var hs={},mi;function ds(){return mi||(mi=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.uniSlice=t.dlen=t.eachOp=void 0;const e=cs(),n=C=>{if(!Array.isArray(C))throw Error("Op must be an array of components");let S=null;for(let w=0;w<C.length;w++){const X=C[w];switch(typeof X){case"object":if(typeof X.d!="number"&&typeof X.d!="string")throw Error("Delete must be number or string");if(t.dlen(X.d)<=0)throw Error("Deletes must not be empty");break;case"string":if(!(X.length>0))throw Error("Inserts cannot be empty");break;case"number":if(!(X>0))throw Error("Skip components must be >0");if(typeof S=="number")throw Error("Adjacent skip components should be combined");break}S=X}if(typeof S=="number")throw Error("Op has a trailing skip")};function s(C,S){let w=0,X=0;for(let st=0;st<C.length;st++){const q=C[st];switch(S(q,w,X),typeof q){case"object":w+=t.dlen(q.d);break;case"string":X+=e.strPosToUni(q);break;case"number":w+=q,X+=q;break}}}t.eachOp=s;function r(C,S){const w=[],X=l(w);return s(C,(st,q,Yt)=>{X(S(st,q,Yt))}),c(w)}const i=C=>C,o=C=>r(C,i);t.dlen=C=>typeof C=="number"?C:e.strPosToUni(C);const l=C=>S=>{if(!(!S||S.d===0||S.d===""))if(C.length===0)C.push(S);else if(typeof S==typeof C[C.length-1])if(typeof S=="object"){const w=C[C.length-1];w.d=typeof w.d=="string"&&typeof S.d=="string"?w.d+S.d:t.dlen(w.d)+t.dlen(S.d)}else C[C.length-1]+=S;else C.push(S)},a=C=>typeof C=="number"?C:typeof C=="string"?e.strPosToUni(C):typeof C.d=="number"?C.d:e.strPosToUni(C.d);t.uniSlice=(C,S,w)=>{const X=e.uniToStrPos(C,S),st=w==null?1/0:e.uniToStrPos(C,w);return C.slice(X,st)};const d=(C,S,w)=>typeof C=="number"?w==null?C-S:Math.min(C,w)-S:t.uniSlice(C,S,w),h=C=>{let S=0,w=0;return{take:(q,Yt)=>{if(S===C.length)return q===-1?null:q;const vt=C[S];let _t;if(typeof vt=="number")return q===-1||vt-w<=q?(_t=vt-w,++S,w=0,_t):(w+=q,q);if(typeof vt=="string"){if(q===-1||Yt==="i"||e.strPosToUni(vt.slice(w))<=q)return _t=vt.slice(w),++S,w=0,_t;{const Ot=w+e.uniToStrPos(vt.slice(w),q);return _t=vt.slice(w,Ot),w=Ot,_t}}else{if(q===-1||Yt==="d"||t.dlen(vt.d)-w<=q)return _t={d:d(vt.d,w)},++S,w=0,_t;{let Ot=d(vt.d,w,w+q);return w+=q,{d:Ot}}}},peek:()=>C[S]}},c=C=>(C.length>0&&typeof C[C.length-1]=="number"&&C.pop(),C);function f(C,S,w){if(w!=="left"&&w!=="right")throw Error("side ("+w+") must be 'left' or 'right'");n(C),n(S);const X=[],st=l(X),{take:q,peek:Yt}=h(C);for(let _t=0;_t<S.length;_t++){const Ot=S[_t];let Mt,zt;switch(typeof Ot){case"number":for(Mt=Ot;Mt>0;)zt=q(Mt,"i"),st(zt),typeof zt!="string"&&(Mt-=a(zt));break;case"string":w==="left"&&typeof Yt()=="string"&&st(q(-1)),st(e.strPosToUni(Ot));break;case"object":for(Mt=t.dlen(Ot.d);Mt>0;)switch(zt=q(Mt,"i"),typeof zt){case"number":Mt-=zt;break;case"string":st(zt);break;case"object":Mt-=t.dlen(zt.d)}break}}let vt;for(;vt=q(-1);)st(vt);return c(X)}function _(C,S){n(C),n(S);const w=[],X=l(w),{take:st}=h(C);for(let Yt=0;Yt<S.length;Yt++){const vt=S[Yt];let _t,Ot;switch(typeof vt){case"number":for(_t=vt;_t>0;)Ot=st(_t,"d"),X(Ot),typeof Ot!="object"&&(_t-=a(Ot));break;case"string":X(vt);break;case"object":_t=t.dlen(vt.d);let Mt=0;for(;Mt<_t;)switch(Ot=st(_t-Mt,"d"),typeof Ot){case"number":X({d:d(vt.d,Mt,Mt+Ot)}),Mt+=Ot;break;case"string":Mt+=e.strPosToUni(Ot);break;case"object":X(Ot)}break}}let q;for(;q=st(-1);)X(q);return c(w)}const E=(C,S)=>{let w=0;for(let X=0;X<S.length&&C>w;X++){const st=S[X];switch(typeof st){case"number":{w+=st;break}case"string":const q=e.strPosToUni(st);w+=q,C+=q;break;case"object":C-=Math.min(t.dlen(st.d),C-w);break}}return C},R=(C,S)=>typeof C=="number"?E(C,S):C.map(w=>E(w,S));function P(C,S,w){return r(C,(X,st)=>typeof X=="object"&&typeof X.d=="number"?{d:w.slice(S,st,st+X.d)}:X)}function k(C){return r(C,S=>{switch(typeof S){case"object":if(typeof S.d=="number")throw Error("Cannot invert text op: Deleted characters missing from operation. makeInvertible must be called first.");return S.d;case"string":return{d:S};case"number":return S}})}function tt(C){return r(C,S=>typeof S=="object"&&typeof S.d=="string"?{d:e.strPosToUni(S.d)}:S)}function mt(C){let S=!0;return s(C,w=>{typeof w=="object"&&typeof w.d=="number"&&(S=!1)}),S}function ft(C){return{name:"text-unicode",uri:"http://sharejs.org/types/text-unicode",trim:c,normalize:o,checkOp:n,create(S=""){if(typeof S!="string")throw Error("Initial data must be a string");return C.create(S)},apply(S,w){n(w);const X=C.builder(S);for(let st=0;st<w.length;st++){const q=w[st];switch(typeof q){case"number":X.skip(q);break;case"string":X.append(q);break;case"object":X.del(t.dlen(q.d));break}}return X.build()},transform:f,compose:_,transformPosition:E,transformSelection:R,isInvertible:mt,makeInvertible(S,w){return P(S,w,C)},stripInvertible:tt,invert:k,invertWithDoc(S,w){return k(P(S,w,C))},isNoop:S=>S.length===0}}t.default=ft}(hs)),hs}var bn={},Ei;function aa(){if(Ei)return bn;Ei=1,Object.defineProperty(bn,"__esModule",{value:!0});const t=ds(),e=cs();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 d=t.dlen(o.d);this.onRemove&&this.onRemove(a,d)}})},onInsert:null,onRemove:null}}return bn.default=n,n.provides={text:!0},bn}var Ri;function ua(){return Ri||(Ri=1,function(t){var e=Wt&&Wt.__createBinding||(Object.create?function(f,_,E,R){R===void 0&&(R=E),Object.defineProperty(f,R,{enumerable:!0,get:function(){return _[E]}})}:function(f,_,E,R){R===void 0&&(R=E),f[R]=_[E]}),n=Wt&&Wt.__setModuleDefault||(Object.create?function(f,_){Object.defineProperty(f,"default",{enumerable:!0,value:_})}:function(f,_){f.default=_}),s=Wt&&Wt.__importStar||function(f){if(f&&f.__esModule)return f;var _={};if(f!=null)for(var E in f)Object.hasOwnProperty.call(f,E)&&e(_,f,E);return n(_,f),_},r=Wt&&Wt.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};Object.defineProperty(t,"__esModule",{value:!0}),t.type=t.remove=t.insert=void 0;const i=cs(),o=s(ds()),l=r(aa()),a={create(f){return f},toString(f){return f},builder(f){if(typeof f!="string")throw Error("Invalid document snapshot: "+f);const _=[];return{skip(E){let R=i.uniToStrPos(f,E);if(R>f.length)throw Error("The op is too long for this document");_.push(f.slice(0,R)),f=f.slice(R)},append(E){_.push(E)},del(E){f=f.slice(i.uniToStrPos(f,E))},build(){return _.join("")+f}}},slice:o.uniSlice},d=o.default(a),h=Object.assign(Object.assign({},d),{api:l.default});t.type=h,t.insert=(f,_)=>_.length===0?[]:f===0?[_]:[f,_],t.remove=(f,_)=>o.dlen(_)===0?[]:f===0?[{d:_}]:[f,{d:_}];var c=ds();Object.defineProperty(t,"makeType",{enumerable:!0,get:function(){return c.default}})}(us)),us}(function(t){var e=Wt&&Wt.__importDefault||function(m){return m&&m.__esModule?m:{default:m}};Object.defineProperty(t,"__esModule",{value:!0}),t.editOp=t.replaceOp=t.insertOp=t.moveOp=t.removeOp=t.type=void 0;const n=e(ss),s=e(is),r=ls,i=as;function o(m,p){if(!m)throw new Error(p)}t.type={name:"json1",uri:"http://sharejs.org/types/JSONv1",readCursor:r.readCursor,writeCursor:r.writeCursor,create:m=>m,isNoop:m=>m==null,setDebug(m){},registerSubtype:k,checkValidOp:st,normalize:q,apply:Yt,transformPosition:vt,compose:_t,tryTransform:Ls,transform:Ku,makeInvertible:zt,invert:Ot,invertWithDoc:xu,RM_UNEXPECTED_CONTENT:i.ConflictType.RM_UNEXPECTED_CONTENT,DROP_COLLISION:i.ConflictType.DROP_COLLISION,BLACKHOLE:i.ConflictType.BLACKHOLE,transformNoConflict:(m,p,b)=>ho(()=>!0,m,p,b),typeAllowingConflictsPred:m=>Object.assign(Object.assign({},t.type),{transform:(p,b,M)=>ho(m,p,b,M)})};const l=m=>m?m.getComponent():null;function a(m){return m&&typeof m=="object"&&!Array.isArray(m)}const d=m=>Array.isArray(m)?m.slice():m!==null&&typeof m=="object"?Object.assign({},m):m,h=m=>m&&(m.p!=null||m.r!==void 0),c=m=>m&&(m.d!=null||m.i!==void 0);function f(m,p){return o(m!=null),typeof p=="number"?(o(Array.isArray(m),"Invalid key - child is not an array"),(m=m.slice()).splice(p,1)):(o(a(m),"Invalid key - child is not an object"),delete(m=Object.assign({},m))[p]),m}function _(m,p,b){return typeof p=="number"?(o(m!=null,"Container is missing for key"),o(Array.isArray(m),"Cannot use numerical key for object container"),o(m.length>=p,"Cannot insert into out of bounds index"),m.splice(p,0,b)):(o(a(m),"Cannot insert into missing item"),o(m[p]===void 0,"Trying to overwrite value at key. Your op needs to remove it first"),m[p]=b),b}t.removeOp=(m,p=!0)=>r.writeCursor().writeAtPath(m,"r",p).get(),t.moveOp=(m,p)=>r.writeCursor().writeMove(m,p).get(),t.insertOp=(m,p)=>r.writeCursor().writeAtPath(m,"i",p).get(),t.replaceOp=(m,p,b)=>r.writeCursor().at(m,M=>{M.write("r",p),M.write("i",b)}).get(),t.editOp=(m,p,b,M=!1)=>r.writeCursor().at(m,v=>S(v,p,b,M)).get();const E=(m,p)=>m!=null&&(typeof p=="number"?Array.isArray(m):typeof m=="object"),R=(m,p)=>E(m,p)?m[p]:void 0,P={};function k(m){let p=m.type?m.type:m;p.name&&(P[p.name]=p),p.uri&&(P[p.uri]=p)}const tt=m=>{const p=P[m];if(p)return p;throw Error("Missing type: "+m)};k(ua());const mt=(m,p)=>m+p;k({name:"number",apply:mt,compose:mt,invert:m=>-m,transform:m=>m});const ft=m=>m==null?null:m.et?tt(m.et):m.es?P["text-unicode"]:m.ena!=null?P.number:null,C=m=>m.es?m.es:m.ena!=null?m.ena:m.e,S=(m,p,b,M=!1)=>{const[v,L]=typeof p=="string"?[tt(p),p]:[p,p.name];!M&&v.isNoop&&v.isNoop(b)||(L==="number"?m.write("ena",b):L==="text-unicode"?m.write("es",b):(m.write("et",L),m.write("e",b)))};function w(m){o(typeof m=="number"),o(m>=0),o(m===(0|m))}function X(m){typeof m=="number"?w(m):o(typeof m=="string")}function st(m){if(m===null)return;const p=new Set,b=new Set,M=L=>{let j=!0,G=!1;for(let I in L){const N=L[I];if(j=!1,o(I==="p"||I==="r"||I==="d"||I==="i"||I==="e"||I==="es"||I==="ena"||I==="et","Invalid component item '"+I+"'"),I==="p")w(N),o(!p.has(N)),p.add(N),o(L.r===void 0);else if(I==="d")w(N),o(!b.has(N)),b.add(N),o(L.i===void 0);else if(I==="e"||I==="es"||I==="ena"){o(!G),G=!0;const A=ft(L);o(A,"Missing type in edit"),A.checkValidOp&&A.checkValidOp(C(L))}}o(!j)},v=(L,j,G)=>{if(!Array.isArray(L))throw Error("Op must be null or a list");if(L.length===0)throw Error("Empty descent");j||X(L[0]);let I=1,N=0,A=0;for(let T=0;T<L.length;T++){const V=L[T];if(o(V!=null),Array.isArray(V)){const K=v(V,!1);if(N){const O=typeof A,B=typeof K;O===B?o(A<K,"descent keys are not in order"):o(O==="number"&&B==="string")}A=K,N++,I=3}else typeof V=="object"?(o(I===1,`Prev not scalar - instead ${I}`),M(V),I=2):(o(I!==3),X(V),o(r.isValidPathItem(V),"Invalid path key"),I=1)}return o(N!==1,"Operation makes multiple descents. Remove some []"),o(I===2||I===3),L[0]};v(m,!0),o(p.size===b.size,"Mismatched picks and drops in op");for(let L=0;L<p.size;L++)o(p.has(L)),o(b.has(L))}function q(m){let p=0,b=[];const M=r.writeCursor();return M.mergeTree(m,(v,L)=>{const j=ft(v);if(j){const I=C(v);S(L,j,j.normalize?j.normalize(I):I)}for(const I of["r","p","i","d"])if(v[I]!==void 0){const N=I==="p"||I==="d"?(G=v[I],b[G]==null&&(b[G]=p++),b[G]):v[I];L.write(I,N)}var G}),M.get()}function Yt(m,p){if(st(p),p===null)return m;const b=[];return function M(v,L){let j=v,G=0,I={root:v},N=0,A=I,T="root";function V(){for(;N<G;N++){let K=L[N];typeof K!="object"&&(o(E(A,T)),A=A[T]=d(A[T]),T=K)}}for(;G<L.length;G++){const K=L[G];if(Array.isArray(K)){const O=M(j,K);O!==j&&O!==void 0&&(V(),j=A[T]=O)}else if(typeof K=="object"){K.d!=null?(V(),j=_(A,T,b[K.d])):K.i!==void 0&&(V(),j=_(A,T,K.i));const O=ft(K);if(O)V(),j=A[T]=O.apply(j,C(K));else if(K.e!==void 0)throw Error("Subtype "+K.et+" undefined")}else j=R(j,K)}return I.root}(m=function M(v,L){const j=[];let G=0;for(;G<L.length;G++){const T=L[G];if(Array.isArray(T))break;typeof T!="object"&&(j.push(v),v=R(v,T))}for(let T=L.length-1;T>=G;T--)v=M(v,L[T]);for(--G;G>=0;G--){const T=L[G];if(typeof T!="object"){const V=j.pop();v=v===R(V,T)?V:v===void 0?f(V,T):(N=T,A=v,(I=d(I=V))[N]=A,I)}else h(T)&&(o(v!==void 0,"Cannot pick up or remove undefined"),T.p!=null&&(b[T.p]=v),v=void 0)}var I,N,A;return v}(m,p),p)}function vt(m,p){m=m.slice(),st(p);const b=r.readCursor(p);let M,v,L=!1;const j=[];for(let I=0;;I++){const N=m[I],A=b.getComponent();if(A&&(A.r!==void 0?L=!0:A.p!=null&&(L=!1,M=A.p,v=I)),I>=m.length)break;let T=0;const V=r.advancer(b,void 0,(O,B)=>{h(B)&&T++});j.unshift(V);const K=V(N);if(typeof N=="number"&&(m[I]-=T),!K)break}if(j.forEach(I=>I.end()),L)return null;const G=()=>{let I=0;if(M!=null){const N=b.getPath();I=N.length,m=N.concat(m.slice(v))}for(;I<m.length;I++){const N=m[I],A=l(b),T=ft(A);if(T){const O=C(A);T.transformPosition&&(m[I]=T.transformPosition(m[I],O));break}let V=0;const K=r.advancer(b,(O,B)=>c(B)?~(O-V):O-V,(O,B)=>{c(B)&&V++})(N);if(typeof N=="number"&&(m[I]+=V),!K)break}};return M!=null?b.eachDrop(null,I=>{I===M&&G()}):G(),m}function _t(m,p){if(st(m),st(p),m==null)return p;if(p==null)return m;let b=0;const M=r.readCursor(m),v=r.readCursor(p),L=r.writeCursor(),j=[],G=[],I=[],N=[],A=[],T=[],V=new Set;M.traverse(null,O=>{O.p!=null&&(I[O.p]=M.clone())}),v.traverse(null,O=>{O.d!=null&&(N[O.d]=v.clone())});const K=r.writeCursor();return function O(B,gt,ut,J,Rt,ae,Ht,Ut){o(gt||ut);const Ct=l(gt),Xt=l(ut),Qt=!!Xt&&Xt.r!==void 0,we=!!Ct&&Ct.i!==void 0,qt=Ct?Ct.d:null,Vt=Xt?Xt.p:null,ue=(ae||Qt)&&Vt==null;if(Vt!=null)J=N[Vt],Ht=G[Vt]=new r.WriteCursor;else if(Xt&&Xt.r!==void 0)J=null;else{const D=l(J);D&&D.d!=null&&(J=null)}const ot=l(J);if(qt!=null)if(B=I[qt],Ut=j[qt]=new r.WriteCursor,ue)ae&&!Qt&&Ut.write("r",!0);else{const D=A[qt]=b++;Ht.write("d",D)}else if(Ct&&Ct.i!==void 0)B=null;else{const D=l(B);D&&D.p!=null&&(B=null)}let H;we?(o(Rt===void 0),H=Ct.i):H=Rt;const Y=(Vt==null?!we||ae||Qt:H===void 0)?null:Ht.getComponent();if(Vt!=null){if(!(Rt!==void 0||we)){const D=qt!=null?A[qt]:b++;T[Vt]=D,Ut.write("p",D)}}else Qt&&(we||Rt!==void 0||(Xt.r,Ut.write("r",Xt.r)));const F=ue?null:ft(Ct),U=ft(ot);if((F||U)&&(F&&F.name,U&&U.name),F&&U){o(F===U);const D=C(Ct),z=C(ot),Tt=F.compose(D,z);S(Ht,F,Tt),V.add(ot)}else F?S(Ht,F,C(Ct)):U&&(S(Ht,U,C(ot)),V.add(ot));const $=typeof H=="object"&&H!=null;let rt=!1,it=0,lt=0,wt=0,At=0,pt=0;const Pt=r.advancer(J,(D,z)=>c(z)?At-D-1:D-At,(D,z)=>{c(z)&&At++}),et=r.advancer(B,(D,z)=>h(z)?it-D-1:D-it,(D,z)=>{h(z)&&it++});if(r.eachChildOf(gt,ut,(D,z,Tt)=>{let Ft,ce,Te=D,te=D,sn=D;if(typeof D=="number"){let Dt=D+wt;ce=Pt(Dt),te=Dt+At;let St=D+lt;Ft=et(St),c(l(ce))&&(Ft=null),Te=St+it,sn=D+pt,o(Te>=0,"p1PickKey is negative"),o(te>=0,"p2DropKey is negative");const ee=c(l(z)),he=h(l(Tt));(ee||he&&!ue)&&pt--,ee&<--,he&&wt--}else Ft=et(D),ce=Pt(D);Ut.descend(Te),Ht.descend(te);const Fe=$&&!c(l(z))?H[sn]:void 0,ie=O(Ft,z,Tt,ce,Fe,ue,Ht,Ut);var oe,W,Et;$&&!ue?Fe!==ie&&(rt||(H=Array.isArray(H)?H.slice():Object.assign({},H),rt=!0),oe=H,Et=ie,typeof(W=sn)=="number"?(o(Array.isArray(oe)),o(W<oe.length)):(o(!Array.isArray(oe)),o(oe[W]!==void 0)),Et===void 0?typeof W=="number"?oe.splice(W,1):delete oe[W]:oe[W]=Et):o(ie===void 0),Ht.ascend(),Ut.ascend()}),et.end(),Pt.end(),Y!=null)Y.i=H;else if(!ae&&!Qt&&Vt==null)return H}(M,M.clone(),v,v.clone(),void 0,!1,L,K),L.reset(),L.mergeTree(K.get()),L.reset(),L.get(),j.map(O=>O.get()),G.map(O=>O.get()),M.traverse(L,(O,B)=>{const gt=O.p;if(gt!=null){const ut=A[gt];ut!=null&&B.write("p",ut);const J=j[gt];J&&J.get(),J&&B.mergeTree(J.get())}else O.r!==void 0&&B.write("r",O.r)}),L.reset(),L.get(),v.traverse(L,(O,B)=>{const gt=O.d;if(gt!=null){const J=T[gt];J!=null&&B.write("d",J);const Rt=G[gt];Rt&&B.mergeTree(Rt.get())}else O.i!==void 0&&B.write("i",O.i);const ut=ft(O);ut&&!V.has(O)&&S(B,ut,C(O))}),L.get()}function Ot(m){if(m==null)return null;const p=new r.ReadCursor(m),b=new r.WriteCursor;let M;const v=[],L=[];return function j(G,I,N){const A=G.getComponent();let T,V=!1;if(A){A.p!=null&&(I.write("d",A.p),v[A.p]=G.clone()),A.r!==void 0&&I.write("i",A.r),A.d!=null&&(I.write("p",A.d),N=void 0),A.i!==void 0&&(N=T=A.i);const O=ft(A);O&&(N===void 0?(M||(M=new Set),M.add(A)):(C(A),N=O.apply(N,C(A)),V=!0))}let K=0;for(const O of G){I.descend(O);const B=typeof O=="number"?O-K:O,gt=R(N,B);c(G.getComponent())&&K++;const ut=j(G,I,gt);if(N!==void 0&&ut!==void 0){if(V||(V=!0,N=d(N)),!E(N,B))throw Error("Cannot modify child - invalid operation");N[B]=ut}I.ascend()}if(T===void 0)return V?N:void 0;I.write("r",N)}(p,b,void 0),M&&(b.reset(),function j(G,I,N){const A=I.getComponent();if(A){const O=A.d;if(O!=null&&(G=v[O],N=L[O]=r.writeCursor()),M.has(A)){const B=ft(A);if(!B.invert)throw Error(`Cannot invert subtype ${B.name}`);S(N,B,B.invert(C(A)))}}let T=0,V=0;const K=r.advancer(G,(O,B)=>h(B)?T-O-1:O-T,(O,B)=>{h(B)&&T++});for(const O of I)if(typeof O=="number"){const B=O-V,gt=K(B),ut=B+T;N.descend(ut),j(gt,I,N),c(I.getComponent())&&V++,N.ascend()}else N.descend(O),j(K(O),I,N),N.ascend();K.end()}(p.clone(),p,b),L.length&&(b.reset(),p.traverse(b,(j,G)=>{const I=j.p;if(I!=null){const N=L[I];N&&N.get(),N&&G.mergeTree(N.get())}}))),b.get()}const Mt=(m,p)=>m.some(b=>typeof b=="object"&&(Array.isArray(b)?Mt(b,p):p(b)));function zt(m,p){if(m==null||!Mt(m,I=>{var N;return I.r!==void 0||((N=ft(I))===null||N===void 0?void 0:N.makeInvertible)!=null}))return m;const b=new r.ReadCursor(m),M=new r.WriteCursor;let v=!1;const L=[],j=[],G=(I,N,A)=>{const T=I.getComponent();let V=!1;if(T){T.d!=null&&N.write("d",T.d),T.i!==void 0&&N.write("i",T.i);const O=T.p;if(O!=null&&(L[O]=I.clone(),o(A!==void 0,"Operation picks up at an invalid key"),j[O]=A,N.write("p",T.p)),T.r!==void 0&&A===void 0)throw Error("Invalid doc / op in makeInvertible: removed item missing from doc");const B=ft(T);B&&(B.makeInvertible?v=!0:S(N,B,C(T),!0))}let K=0;for(const O of I){N.descend(O);const B=typeof O=="number"?O-K:O,gt=R(A,B),ut=G(I,N,gt);gt!==ut&&(V||(V=!0,A=d(A)),ut===void 0?(A=f(A,B),typeof O=="number"&&K++):A[B]=ut),N.ascend()}return T&&(T.r!==void 0?(N.write("r",s.default(A)),A=void 0):T.p!=null&&(A=void 0)),A};return G(b,M,p),M.get(),v&&(M.reset(),function I(N,A,T,V,K){const O=A.getComponent();if(O){O.i!==void 0?(V=O.i,K=!0):O.d!=null&&(V=j[O.d],N=L[O.d],K=!1,O.d);let J=ft(O);if(J&&J.makeInvertible){const Rt=C(O);S(T,J,J.makeInvertible(Rt,V),!0)}}let B=0,gt=0;const ut=r.advancer(N,(J,Rt)=>h(Rt)?B-J-1:J-B,(J,Rt)=>{h(Rt)&&B++});for(const J of A)if(typeof J=="number"){const Rt=J-gt,ae=ut(Rt),Ht=Rt+B,Ut=R(V,K?Rt:Ht);T.descend(J),I(ae,A,T,Ut,K),c(A.getComponent())&>++,T.ascend()}else{const Rt=R(V,J);T.descend(J),I(ut(J),A,T,Rt,K),T.ascend()}ut.end()}(b.clone(),b,M,p,!1)),M.get()}function xu(m,p){return Ot(zt(m,p))}const Ts=m=>{if(m==null)return null;const p=m.slice();for(let b=0;b<m.length;b++){const M=p[b];Array.isArray(M)&&(p[b]=Ts(M))}return p};function Ls(m,p,b){o(b==="left"||b==="right","Direction must be left or right");const M=b==="left"?0:1;if(p==null)return{ok:!0,result:m};st(m),st(p);let v=null;const L=[],j=[],G=[],I=[],N=[],A=[],T=[],V=[],K=[],O=[],B=[],gt=[],ut=[],J=[],Rt=[];let ae=0;const Ht=r.readCursor(m),Ut=r.readCursor(p),Ct=r.writeCursor();if(function ot(H,Y=null,F){const U=l(Y);U&&(U.r!==void 0?F=Y.clone():U.p!=null&&(F=null,A[U.p]=H.clone()));const $=H.getComponent();let rt;$&&(rt=$.p)!=null&&(N[rt]=Y?Y.clone():null,G[rt]=H.clone(),F&&(O[rt]=!0,K[rt]=F),U&&U.p!=null&&(J[rt]=U.p));const it=r.advancer(Y);for(const lt of H)ot(H,it(lt),F);it.end()}(Ut,Ht,null),function ot(H,Y,F,U,$){const rt=F.getComponent();let it,lt=!1;rt&&((it=rt.d)!=null?(I[it]=F.clone(),U!=null&&(Rt[U]==null&&(Rt[U]=[]),Rt[U].push(it)),H=N[it]||null,Y=G[it]||null,O[it]?($&&(B[it]=!0),$=K[it]||null):!$||M!==1&&J[it]!=null||v==null&&(v={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:t.removeOp($.getPath()),op2:t.moveOp(Y.getPath(),F.getPath())}),lt=!0):rt.i!==void 0&&(H=Y=null,lt=!0,$&&v==null&&(v={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:t.removeOp($.getPath()),op2:t.insertOp(F.getPath(),rt.i)})));const wt=l(H);wt&&(wt.r!==void 0?$=H.clone():wt.p!=null&&(wt.p,U=wt.p,$=null));const At=ft(rt);At&&$&&v==null&&(v={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:t.removeOp($.getPath()),op2:t.editOp(F.getPath(),At,C(rt),!0)});let pt=0,Pt=0;const et=r.advancer(Y,(z,Tt)=>h(Tt)?pt-z-1:z-pt,(z,Tt)=>{h(Tt)&&pt++}),D=r.advancer(H);for(const z of F)if(typeof z=="number"){const Tt=z-Pt,Ft=et(Tt);Pt+=+ot(D(Tt+pt),Ft,F,U,$)}else{const Tt=et(z);ot(D(z),Tt,F,U,$)}return et.end(),D.end(),lt}(Ht,Ut,Ut.clone(),null,null),I.map(ot=>ot&&ot.get()),v)return{ok:!1,conflict:v};B.map(ot=>!!ot);const Xt=[];let Qt=null;(function ot(H,Y,F,U,$){let rt=!1;const it=l(Y);if(h(it)){const et=it.p;et!=null?(F=I[et],U=gt[et]=r.writeCursor(),rt=!0,$=null):(F=null,$=Y.clone())}else c(l(F))&&(F=null);const lt=H.getComponent();if(lt){const et=lt.p;et!=null?($&&(V[et]=$),Xt[et]=$||M===1&&rt?null:U.getComponent(),L[et]=H.clone(),F&&(T[et]=F.clone())):lt.r!==void 0&&($||U.write("r",!0),($||rt)&&(Qt==null&&(Qt=new Set),Qt.add(lt)))}let wt=0,At=0;const pt=r.advancer(Y,void 0,(et,D)=>{h(D)&&wt++}),Pt=r.advancer(F,(et,D)=>c(D)?~(et-At):et-At,(et,D)=>{c(D)&&At++});if(H)for(const et of H)if(typeof et=="string"){const D=pt(et),z=Pt(et);U.descend(et),ot(H,D,z,U,$),U.ascend()}else{const D=pt(et),z=et-wt,Tt=h(l(D))?null:Pt(z),Ft=z+At;o(Ft>=0),U.descend(Ft),ot(H,D,Tt,U,$),U.ascend()}pt.end(),Pt.end()})(Ht,Ut,Ut.clone(),Ct,null),Ct.reset();let we=[];if(function ot(H,Y,F,U,$,rt){o(Y);const it=Y.getComponent();let lt=l(U),wt=!1;const At=(W,Et,Dt)=>W?t.moveOp(W.getPath(),Et.getPath()):t.insertOp(Et.getPath(),Dt.i);if(c(it)){const W=it.d;W!=null&&(j[W]=Y.clone());const Et=W!=null?Xt[W]:null;let Dt=!1;if(it.i!==void 0||W!=null&&Et){let St;lt&&(lt.i!==void 0||(St=lt.d)!=null&&!O[St])&&(Dt=St!=null?W!=null&&W===J[St]:n.default(lt.i,it.i),Dt||St!=null&&M!==1&&J[St]!=null||v==null&&(v={type:i.ConflictType.DROP_COLLISION,op1:At(W!=null?L[W]:null,Y,it),op2:At(St!=null?G[St]:null,U,lt)})),Dt||(rt?v==null&&(v={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:At(W!=null?L[W]:null,Y,it),op2:t.removeOp(rt.getPath())}):(W!=null?(we[ae]=W,$.write("d",Et.p=ae++)):$.write("i",s.default(it.i)),wt=!0))}else if(W!=null&&!Et){const St=V[W];St&&(rt=St.clone())}W!=null?(H=L[W],F=A[W],U=T[W]):it.i!==void 0&&(H=F=null,Dt||(U=null))}else h(l(H))&&(H=F=U=null);const pt=l(H),Pt=l(F);if(h(Pt)){const W=Pt.p;Pt.r!==void 0&&(!pt||pt.r===void 0)||O[W]?(U=null,rt=F.clone()):W!=null&&(U=I[W],M!==1&&J[W]!=null||(($=ut[W])||($=ut[W]=r.writeCursor()),$.reset(),rt=null))}else!c(it)&&c(lt)&&(U=null);lt=U!=null?U.getComponent():null;const et=ft(it);if(et){const W=C(it);if(rt)v==null&&(v={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:t.editOp(Y.getPath(),et,W,!0),op2:t.removeOp(rt.getPath())});else{const Et=ft(lt);let Dt;if(Et){if(et!==Et)throw Error("Transforming incompatible types");const St=C(lt);Dt=et.transform(W,St,b)}else Dt=s.default(W);S($,et,Dt)}}let D=0,z=0,Tt=0,Ft=0,ce=0,Te=0,te=H!=null&&H.descendFirst(),sn=te;const Fe=r.advancer(F,void 0,(W,Et)=>{h(Et)&&Tt++});let ie=U!=null&&U.descendFirst(),oe=ie;for(const W of Y)if(typeof W=="number"){let Et;const Dt=c(Y.getComponent()),St=W-z;{let Ce;for(;te&&typeof(Ce=H.getKey())=="number";){Ce+=D;const ne=H.getComponent(),Be=h(ne);if(Ce>St||Ce===St&&(!Be||M===0&&Dt))break;if(Be){D--;const Le=ne.p;J.includes(Le),ne.d,l(ut[ne.d]),h(l(ut[ne.d])),(ne.r===void 0||Qt&&Qt.has(ne))&&(Le==null||!Xt[Le]||M!==1&&J.includes(Le))||ce--}te=H.nextSibling()}Et=te&&Ce===St?H:null}const ee=St-D;let he=Fe(ee);const Ms=ee-Tt;let yn=null;{let Ce,ne;for(;ie&&typeof(Ce=U.getKey())=="number";){ne=Ce-Ft;const Be=U.getComponent(),Le=c(Be);if(ne>Ms)break;if(ne===Ms){if(!Le){yn=U;break}{if(M===0&&Dt){yn=U;break}const Me=he&&h(he.getComponent());if(M===0&&Me)break}}if(Le){const Me=Be.d;J[Me],Be.i===void 0&&(O[Me]||J[Me]!=null&&M!==1)?(O[Me]||J[Me]!=null&&M===0)&&(Ft++,Te--):Ft++}ie=U.nextSibling()}}const fo=Ms+Ft+ce+Te;o(fo>=0,"trying to descend to a negative index"),$.descend(fo),Dt&&(Et=he=yn=null,z++),ot(Et,Y,he,yn,$,rt)&&Te++,$.ascend()}else{let Et;for(;te&&(Et=H.getKey(),typeof Et!="string"||!(Et>W||Et===W));)te=H.nextSibling();const Dt=te&&Et===W?H:null,St=Fe(W);let ee;for(;ie&&(ee=U.getKey(),typeof ee!="string"||!(ee>W||ee===W));)ie=U.nextSibling();const he=ie&&ee===W?U:null;$.descend(W),ot(Dt,Y,St,he,$,rt),$.ascend()}return Fe.end(),sn&&H.ascend(),oe&&U.ascend(),wt}(Ht,Ht.clone(),Ut,Ut.clone(),Ct,null),v)return{ok:!1,conflict:v};Ct.reset();const qt=(ot,H,Y)=>ot.traverse(H,(F,U)=>{F.d!=null&&Y(F.d,ot,U)});(O.length||gt.length)&&(qt(Ut,Ct,(ot,H,Y)=>{O[ot]&&!B[ot]&&Y.write("r",!0),gt[ot]&&Y.mergeTree(gt[ot].get())}),Ct.reset());const Vt=[],ue=[];if((ut.length||O.length)&&!v){const ot=r.readCursor(Ts(Ct.get()));if(qt(ot,null,(H,Y)=>{Vt[H]=Y.clone()}),ut.forEach(H=>{H&&qt(r.readCursor(H.get()),null,(Y,F)=>{Vt[Y]=F.clone()})}),function H(Y,F,U,$,rt,it){const lt=l(F);if(lt&&h(lt))if(lt.p!=null){const D=lt.p;Vt[D].getPath(),U=Vt[D],$=ue[D]=r.writeCursor()}else lt.r!==void 0&&(U=null);else c(l(U))&&(U=null);const wt=Y.getComponent();if(wt){let D;if((D=wt.d)!=null){const z=ut[D];z&&(z.get(),$.mergeTree(z.get()),U=r.readCursor(z.get()))}}let At=0,pt=0;const Pt=r.advancer(F,void 0,(D,z)=>{h(z)&&At--}),et=r.advancer(U,(D,z)=>c(z)?-(D-pt)-1:D-pt,(D,z)=>{c(z)&&pt++});for(const D of Y)if(typeof D=="number"){const z=Pt(D),Tt=D+At,Ft=et(Tt),ce=Tt+pt;$.descend(ce),H(Y,z,Ft,$),$.ascend()}else $.descend(D),H(Y,Pt(D),et(D),$),$.ascend();Pt.end(),et.end()}(Ut,ot,ot.clone(),Ct),Ct.reset(),v)return{ok:!1,conflict:v};if(Ct.get(),ue.length){const H=ue.map(F=>F?F.get():null),Y=r.readCursor(Ts(Ct.get()));if(qt(Y,Ct,(F,U,$)=>{const rt=H[F];rt&&($.mergeTree(rt),H[F]=null)}),H.find(F=>F)){const F=r.writeCursor(),U=r.writeCursor();let $=0,rt=0;H.forEach(it=>{it!=null&&qt(r.readCursor(it),null,lt=>{const wt=we[lt];F.writeMove(L[wt].getPath(),j[wt].getPath(),$++);const At=Rt[wt];At&&At.forEach(pt=>{O[pt]||M!==1&&J[pt]!=null||U.writeMove(G[pt].getPath(),I[pt].getPath(),rt++)})})}),v={type:i.ConflictType.BLACKHOLE,op1:F.get(),op2:U.get()}}}}return v?{ok:!1,conflict:v}:{ok:!0,result:Ct.get()}}const co=m=>{const p=new Error("Transform detected write conflict");throw p.conflict=m,p.type=p.name="writeConflict",p};function Ku(m,p,b){const M=Ls(m,p,b);if(M.ok)return M.result;co(M.conflict)}const He=m=>{const p=r.writeCursor();return r.readCursor(m).traverse(p,(b,M)=>{(c(b)||ft(b))&&M.write("r",!0)}),p.get()},Yu=(m,p)=>{const{type:b,op1:M,op2:v}=m;switch(b){case i.ConflictType.DROP_COLLISION:return p==="left"?[null,He(v)]:[He(M),null];case i.ConflictType.RM_UNEXPECTED_CONTENT:let L=!1;return r.readCursor(M).traverse(null,j=>{j.r!==void 0&&(L=!0)}),L?[null,He(v)]:[He(M),null];case i.ConflictType.BLACKHOLE:return[He(M),He(v)];default:throw Error("Unrecognised conflict: "+b)}};function ho(m,p,b,M){let v=null;for(;;){const L=Ls(p,b,M);if(L.ok)return _t(v,L.result);{const{conflict:j}=L;m(j)||co(j);const[G,I]=Yu(j,M);p=_t(q(p),G),b=_t(q(b),I),v=_t(v,I)}}}})(_i),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(_i,t);var s=ls;Object.defineProperty(t,"ReadCursor",{enumerable:!0,get:function(){return s.ReadCursor}}),Object.defineProperty(t,"WriteCursor",{enumerable:!0,get:function(){return s.WriteCursor}});var r=as;Object.defineProperty(t,"ConflictType",{enumerable:!0,get:function(){return r.ConflictType}})}(Gt);const ca=_o({__proto__:null,default:ia(Gt)},[Gt]);var Q=(t=>(t.RETAIN="r",t.INSERT="i",t.DELETE="d",t))(Q||{});class fs{constructor(e){g(this,"_index",0);g(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===Q.DELETE||n.t===Q.RETAIN&&n.body==null?y.deepClone({...n,len:e}):y.deepClone({...n,len:e,body:qe(n.body,s,s+e)})}else return{t:Q.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:Q.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 Ci{constructor(){g(this,"cursor",0)}reset(){return this.cursor=0,this}moveCursor(e){this.cursor+=e}moveCursorTo(e){this.cursor=e}}function ha(t,e,n){const{dataStream:s}=t,r=n,i=n+e,o=li(t,e,n),l=ai(t,e,n),a=ui(t,e,n),d=ci(t,e,n),h=hi(t,e,n),c=di(t,e,n);let f="";return s&&(t.dataStream=Ur(s,r,i),f=s.slice(r,i)),{dataStream:f,textRuns:o,paragraphs:l,sectionBreaks:a,customBlocks:d,tables:h,customRanges:c}}function da(t,e,n,s){t.dataStream=Mr(t.dataStream,s,e.dataStream),ii(t,e,n,s),ts(t,e,n,s),zl(t,e,n,s),oi(t,e,n,s),es(t,e,n,s),Xl(t,e,n,s)}function fa(t,e,n,s,r=kt.COVER){return ql(t,e,n,s,r)}function _a(t,e,n){return e<=0?{dataStream:""}:ha(t,e,n)}function ga(t,e,n,s){n!==0&&da(t,e,n,s)}function ma(t,e){const n=new Ci;return n.reset(),e.forEach(s=>{switch(s=y.deepClone(s),s.t){case Q.RETAIN:{const{coverType:r,body:i,len:o}=s;i!=null&&fa(t,i,o,n.cursor,r),n.moveCursor(o);break}case Q.INSERT:{const{body:r,len:i}=s;ga(t,r,i,n.cursor),n.moveCursor(i);break}case Q.DELETE:{const{len:r}=s;_a(t,r,n.cursor);break}default:throw new Error(`Unknown action type for action: ${s}.`)}}),t}function pi(t){return Object.keys(t).length===1}const nn=class nn{constructor(){g(this,"_actions",[])}static apply(e,n){return ma(e,n)}static compose(e,n){const s=new fs(e),r=new fs(n),i=new nn;for(;s.hasNext()||r.hasNext();)if(r.peekType()===Q.INSERT)i.push(r.next());else if(s.peekType()===Q.DELETE)i.push(s.next());else{const o=Math.min(s.peekLength(),r.peekLength()),l=s.next(o),a=r.next(o);l.t===Q.INSERT&&a.t===Q.RETAIN?a.body==null?i.push(l):i.push({...l,body:ns(l.body,a.body,a.coverType)}):l.t===Q.RETAIN&&a.t===Q.RETAIN?l.body==null&&a.body==null?i.push(l.len!==Number.POSITIVE_INFINITY?l:a):l.body&&a.body?i.push({...l,body:ns(l.body,a.body,a.coverType)}):i.push(l.body?l:a):l.t===Q.RETAIN&&a.t===Q.DELETE?i.push(a):l.t===Q.INSERT&&(a.t,Q.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===Q.INSERT)n.push({t:Q.DELETE,len:s.len,line:0,body:s.body,segmentId:s.segmentId});else if(s.t===Q.DELETE){if(s.body==null)throw new Error("Can not invert DELETE action without body property, makeInvertible must be called first.");n.push({t:Q.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:Q.RETAIN,body:s.oldBody,oldBody:s.body,len:s.len,coverType:kt.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===Q.DELETE&&i.body==null){const o=qe(n,r,r+i.len,!1);i.body=o}if(i.t===Q.RETAIN&&i.body!=null){const{textRuns:o}=qe(n,r,r+i.len,!0);i.oldBody={dataStream:"",textRuns:o}}s.push(i),i.t!==Q.INSERT&&(r+=i.len)}return s}insert(e,n,s=""){const r={t:Q.INSERT,body:n,len:e,line:0,segmentId:s};return this.push(r),this}retain(e,n="",s,r){const i={t:Q.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:Q.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===Q.RETAIN&&r.len===0&&r.body==null)return this;if(typeof s=="object"){if(s.t===Q.DELETE&&r.t===Q.DELETE)return s.len+=r.len,this;if(s.t===Q.DELETE&&r.t===Q.INSERT&&(n-=1,s=this._actions[n-1],s==null))return this._actions.unshift(r),this;if(s.t===Q.RETAIN&&r.t===Q.RETAIN&&s.body==null&&r.body==null)return s.len+=r.len,this;if(s.t===Q.INSERT&&pi(s.body)&&r.t===Q.INSERT&&pi(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===Q.RETAIN&&sa(e);)this._actions.pop(),e=this._actions[this._actions.length-1];return this}};g(nn,"id","text-x"),g(nn,"uri","https://github.com/dream-num/univer#text-x");let Ee=nn;Object.defineProperty(Ee,"name",{value:"text-x"});const ke=class ke{static registerSubtype(e){var n;this._subTypes.has(e.name)&&((n=this._subTypes.get(e.name))==null?void 0:n.id)!==Ee.id||(this._subTypes.set(e.name,e),Gt.type.registerSubtype(e))}static apply(e,n){if(!Gt.type.isNoop(n))return Gt.type.apply(e,n)}static compose(e,n){return Gt.type.compose(e,n)}static transform(e,n,s){throw new Error("transform is not implemented in JsonX")}static invertWithDoc(e,n){return Gt.type.invertWithDoc(e,n)}static isNoop(e){return Gt.type.isNoop(e)}static getInstance(){return this._instance==null&&(this._instance=new ke),this._instance}removeOp(e,n){return Gt.removeOp(e,n)}moveOp(e,n){return Gt.moveOp(e,n)}insertOp(e,n){return Gt.insertOp(e,n)}replaceOp(e,n,s){return Gt.replaceOp(e,n,s)}editOp(e){return Gt.editOp(["body"],Ee.name,e)}};g(ke,"uri","https://github.com/dream-num/univer#json-x"),g(ke,"_subTypes",new Map),g(ke,"_instance",null);let ve=ke;ve.registerSubtype(Ee);const _s={id:"default_doc",documentStyle:{}};class Ea extends Sn{constructor(n){super();g(this,"type",nt.UNIVER_DOC);g(this,"snapshot");this.snapshot={..._s,...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,d=r==null?void 0:r[n];if(!d)return;const h=d.docTransform;h.size.width=i,h.size.height=o,h.positionH.posOffset=l,h.positionV.posOffset=a}setZoomRatio(n=1){this.snapshot.settings==null?this.snapshot.settings={zoomRatio:n}:this.snapshot.settings.zoomRatio=1}}class Ae extends Ea{constructor(n){var r;super(y.isEmptyObject(n)?ra():n);g(this,"_unitId");g(this,"headerModelMap",new Map);g(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={..._s,...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 Ii=at.createIdentifier("univer.config-service");class Oi{constructor(){g(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 Si extends yt{constructor(){super(...arguments);g(this,"_error$",new x.Subject);g(this,"error$",this._error$.asObservable())}dispose(){this._error$.complete()}emit(n){this._error$.next({errorKey:n})}}class Ni{constructor(e={}){g(this,"_styles");g(this,"_cacheMap",new jr(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 Ra{constructor(e,n){g(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!==Z.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:ct.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:ct.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:ct.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:ct.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:Z.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:Z.FALSE};return this._columnData[e]=i,i}}class Ca{constructor(e,n,s){g(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:Z.FALSE,h:r.defaultRowHeight},{ia:a,ah:d,h=r.defaultRowHeight}=l;i+=(a==null||a===Z.TRUE)&&typeof d=="number"?d:h}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:Z.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:ct.ROW})):!r&&!l&&(r=!0,i=o)}return r&&s.push({startRow:i,endRow:n,startColumn:0,endColumn:0,rangeType:ct.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:ct.ROW})):!r&&l&&(r=!0,i=o)}return r&&s.push({startRow:i,endRow:n,startColumn:0,endColumn:0,rangeType:ct.ROW}),s}getRowRawVisible(e){const n=this.getRow(e);return n?n.hd!==Z.TRUE:!0}getSize(){return _e(this._rowData)}}const pa="DEFAULT_WORKSHEET_ROW_COUNT",bi=1e3,Ia="DEFAULT_WORKSHEET_COLUMN_COUNT",vi=20,Oa="DEFAULT_WORKSHEET_ROW_HEIGHT",Ai=24,Sa="DEFAULT_WORKSHEET_COLUMN_WIDTH",wi=88,Na="DEFAULT_WORKSHEET_ROW_TITLE_WIDTH",Ti=46,ba="DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT",Li=20;function Mi(t){const e={name:"Sheet1",id:"sheet-01",tabColor:"",hidden:Z.FALSE,rowCount:bi,columnCount:vi,zoomRatio:1,freeze:{xSplit:0,ySplit:0,startRow:-1,startColumn:-1},scrollTop:0,scrollLeft:0,defaultColumnWidth:wi,defaultRowHeight:Ai,mergeData:[],cellData:{},rowData:{},columnData:{},showGridlines:Z.TRUE,rowHeader:{width:Ti,hidden:Z.FALSE},columnHeader:{height:Li,hidden:Z.FALSE},selections:["A1"],rightToLeft:Z.FALSE};return Object.keys(e).forEach(n=>{const s=n;typeof t[s]>"u"&&(t[s]=e[s])}),t}class Ui extends yt{constructor(n){super();g(this,"_cellContentInterceptor",null);g(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,bt(()=>this._cellContentInterceptor=null)}registerRowFilteredInterceptor(n){if(this._rowFilteredInterceptor)throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowFilteredInterceptor=n,bt(()=>this._rowFilteredInterceptor=null)}}class Je{constructor(e,n,s){g(this,"_sheetId");g(this,"_snapshot");g(this,"_cellData");g(this,"_rowManager");g(this,"_columnManager");g(this,"_viewModel");var l;this.unitId=e,this._styles=s,this._snapshot=Mi(n);const{columnData:r,rowData:i,cellData:o}=this._snapshot;this._sheetId=(l=this._snapshot.id)!=null?l:y.generateRandomId(6),this._cellData=new Zt(o),this._viewModel=new Ui((a,d)=>this.getCellRaw(a,d)),this._rowManager=new Ca(this._snapshot,this._viewModel,i),this._columnManager=new Ra(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((d,h)=>{Object.keys(h).forEach(c=>{const f=+c,_=e.getValue(d,f),E=_!=null&&_.s?this._styles.get(_.s):null,R=(E==null?void 0:E.bd)&&(E.bd.b||E.bd.l||E.bd.r||E.bd.t||E.bd.bc_tr||E.bd.bl_tr||E.bd.ml_tr||E.bd.tl_bc||E.bd.tl_br||E.bd.tl_mr);(_&&(_.v||_.p)||E!=null&&E.bg||R)&&(l?s=Math.min(s,d):(s=d,l=!0),r=Math.max(r,d),a?i=Math.min(i,f):(a=!0,i=f),o=Math.max(o,f))})}),n.forEach(d=>{l?s=Math.min(s,d.startRow):(s=d.startRow,l=!0),r=Math.max(r,d.endRow),a?i=Math.min(i,d.startColumn):(i=d.startColumn,l=!0),o=Math.max(o,d.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(d=>ge.intersects({startRow:e,startColumn:n,endRow:s,endColumn:r},d)),a=new Zt;return Yn(e,s,n,r).forEach((d,h)=>{const c=i?this.getCellRaw(d,h):this.getCell(d,h);c&&a.setValue(d,h,c)}),l.forEach(d=>{const{startColumn:h,startRow:c,endColumn:f,endRow:_}=d;Yn(c,_,h,f).forEach((E,R)=>{E===c&&R===h&&a.setValue(E,R,{...o.getValue(E,R),rowSpan:_-c+1,colSpan:f-h+1}),(E!==c||R!==h)&&a.realDeleteValue(E,R)})}),a}getRange(e,n,s,r){return typeof e=="object"?new Ne(this,e,{getStyles:()=>this._styles}):new Ne(this,{startRow:e,startColumn:n,endColumn:r||n,endRow:s||e},{getStyles:()=>this._styles})}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,d=r;return{next(){for(;;){if(d>o&&(a+=1,d=r),a>i)return{done:!0,value:void 0};const h=l.getCell(a,d),c=!h,f=l.getMergedCell(a,d);if(f){if(a!==f.startRow||d!==f.startColumn){d=f.endColumn+1;continue}if(c&&n){d=f.endColumn+1;continue}const E={row:a,col:d,value:h};return E.colSpan=f.endColumn-f.startColumn+1,E.rowSpan=f.endRow-f.startRow+1,d=f.endColumn+1,{done:!1,value:E}}if(c&&n)d+=1;else{const _={row:a,col:d,value:h};return d+=1,{done:!1,value:_}}}}}}}}iterateByColumn(e,n=!0,s=!0){const{startRow:r,startColumn:i,endRow:o,endColumn:l}=e,a=this;return{[Symbol.iterator]:()=>{let d=r,h=i;return{next(){for(;;){if(d>o&&(h+=1,d=r),h>l)return{done:!0,value:void 0};const c=a.getMergedCell(d,h);if(c){const E=d!==c.startRow,R=E||h!==c.startColumn;if(s&&R||!s&&E){d=c.endRow+1;continue}const P=a.getCell(c.startRow,c.startColumn);if(!P&&n){d=c.endRow+1;continue}const tt={row:d,col:c.startColumn,value:P};return tt.colSpan=c.endColumn-c.startColumn+1,tt.rowSpan=c.endRow-c.startRow+1,d=c.endRow+1,{done:!1,value:tt}}const f=a.getCell(d,h);if(!f&&n)d+=1;else{const E={row:d,col:h,value:f};return d+=1,{done:!1,value:E}}}}}}}}}function va(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===Oe.BOOLEAN?n.toUpperCase():n.replace(/[\r\n]/g,""):typeof n=="number"?t.t===Oe.BOOLEAN?n?"TRUE":"FALSE":n.toString():typeof n=="boolean"?n?"TRUE":"FALSE":""}const Aa="0.1.14";function wa(t="",e=pe.ZH_CN,n=""){return{id:t,sheetOrder:[],name:n,appVersion:Aa,locale:e,styles:{},sheets:{},resources:[]}}var Ta=Object.defineProperty,La=Object.getOwnPropertyDescriptor,Ma=(t,e,n,s)=>{for(var r=s>1?void 0:s?La(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&&Ta(e,n,r),r},Ua=(t,e)=>(n,s)=>e(n,s,t);function Da(t,e){return`${t.getUnitId()}|${e.getSheetId()}`}u.Workbook=class extends Sn{constructor(n={},s){super();g(this,"type",nt.UNIVER_SHEET);g(this,"_sheetCreated$",new x.Subject);g(this,"sheetCreated$",this._sheetCreated$.asObservable());g(this,"_sheetDisposed$",new x.Subject);g(this,"sheetDisposed$",this._sheetDisposed$.asObservable());g(this,"_activeSheet$",new x.BehaviorSubject(null));g(this,"activeSheet$",this._activeSheet$.asObservable());g(this,"_worksheets");g(this,"_styles");g(this,"_snapshot");g(this,"_unitId");g(this,"_count");g(this,"_name$");g(this,"name$");this._logService=s;const r=wa();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 Ni(i),this._count=1,this._worksheets=new Map,this._name$=new x.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)}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()!==Z.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;return this._worksheets.get(n)?(((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],!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===Z.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}:Ke}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 h,c,f,_,E;let s="",r="";if(n.indexOf("!")>-1){const R=n.split("!");s=R[0],r=R[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 R=Number.parseInt(r.replace(/[^0-9]/g,""),10)-1,P=y.ABCatNum(r.replace(/[^A-Za-z]/g,""));return!Number.isNaN(R)&&!Number.isNaN(P)?{sheetId:s,range:{startRow:R,endRow:R,startColumn:P,endColumn:P}}:Ke}r=r.split(":");const i=[0,0],o=[0,0],l=((h=this.getSheetBySheetName(s))==null?void 0:h.getMaxRows())||((c=this.getActiveSheet())==null?void 0:c.getMaxRows()),a=((f=this.getSheetBySheetName(s))==null?void 0:f.getMaxColumns())||((_=this.getActiveSheet())==null?void 0:_.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]=y.ABCatNum(r[0].replace(/[^A-Za-z]/g,"")),o[1]=y.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])?Ke:{sheetId:((E=this.getSheetBySheetName(s))==null?void 0:E.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(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 d=new Je(this._unitId,l,this._styles);s.set(o,d),i.includes(o)||i.push(o)}}},u.Workbook=Ma([Ua(1,me)],u.Workbook);class gs extends Sn{constructor(n){var s;super();g(this,"type",nt.UNIVER_SLIDE);g(this,"_snapshot");g(this,"_unitId");this._snapshot={...Yr,...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:Fn.SLIDE,zIndex:1,title:"cover",description:"this is first page, cover",pageBackgroundFill:{rgb:"rgb(255,255,255)"},pageElements:{}}}}const Ze="FOCUSING_SHEET",vn="FOCUSING_DOC",An="FOCUSING_SLIDE",ya="FOCUSING_EDITOR_BUT_HIDDEN",Di="EDITOR_ACTIVATED",Pa="FOCUSING_EDITOR_INPUT_FORMULA",yi="FOCUSING_FORMULA_EDITOR",ka="FOCUSING_UNIVER_EDITOR",Ha="FOCUSING_EDITOR_INPUT_FORMULA",Fa="FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE",Ba="FOCUSING_COMMON_DRAWINGS";var $a=Object.defineProperty,Wa=Object.getOwnPropertyDescriptor,Ga=(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&&$a(e,n,r),r},Pi=(t,e)=>(n,s)=>e(n,s,t);const Pe=at.createIdentifier("univer.current");u.UniverInstanceService=class extends yt{constructor(n,s){super();g(this,"_unitsByType",new Map);g(this,"_createHandler");g(this,"_ctorByType",new Map);g(this,"_currentUnits$",new x.BehaviorSubject({}));g(this,"currentUnits$",this._currentUnits$.asObservable());g(this,"_unitAdded$",new x.Subject);g(this,"unitAdded$",this._unitAdded$.asObservable());g(this,"_unitDisposed$",new x.Subject);g(this,"unitDisposed$",this._unitDisposed$.asObservable());g(this,"_focused$",new x.BehaviorSubject(null));g(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(x.map(s=>{var r;return(r=s[n])!=null?r:null}),x.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(x.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(x.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(nt.UNIVER_DOC)}getUniverDocInstance(n){return this.getUnit(n,nt.UNIVER_DOC)}getUniverSheetInstance(n){return this.getUnit(n,nt.UNIVER_SHEET)}getAllUnitsForType(n){var s;return(s=this._unitsByType.get(n))!=null?s:[]}changeDoc(n,s){const r=this.getAllUnitsForType(nt.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 u.Workbook?(this._contextService.setContextValue(vn,!1),this._contextService.setContextValue(Ze,!0),this._contextService.setContextValue(An,!1)):this.focused instanceof Ae?(this._contextService.setContextValue(vn,!0),this._contextService.setContextValue(Ze,!1),this._contextService.setContextValue(An,!1)):this.focused instanceof gs&&(this._contextService.setContextValue(vn,!1),this._contextService.setContextValue(Ze,!1),this._contextService.setContextValue(An,!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]}}},u.UniverInstanceService=Ga([Pi(0,at.Inject(at.Injector)),Pi(1,Ye)],u.UniverInstanceService);var It=(t=>(t[t.Starting=0]="Starting",t[t.Ready=1]="Ready",t[t.Rendered=2]="Rendered",t[t.Steady=3]="Steady",t))(It||{});const Va={0:"Starting",1:"Ready",2:"Rendered",3:"Steady"},wn=new Map;function ki(t,e){return function(r){Tn(t,e)}}function Tn(t,e){wn.has(t)||wn.set(t,[]),wn.get(t).push(e)}var ja=Object.defineProperty,xa=Object.getOwnPropertyDescriptor,Hi=(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&&ja(e,n,r),r},ms=(t,e)=>(n,s)=>e(n,s,t);u.LifecycleService=class extends yt{constructor(n){super();g(this,"_lifecycle$",new x.BehaviorSubject(It.Starting));g(this,"lifecycle$",this._lifecycle$.asObservable());g(this,"_lock",!1);this._logService=n,this._reportProgress(It.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 x.Observable(n=>{this.stage===It.Starting||(this.stage===It.Ready?n.next(It.Starting):this.stage===It.Rendered?(n.next(It.Starting),n.next(It.Ready)):(n.next(It.Starting),n.next(It.Ready),n.next(It.Rendered))),this._lifecycle$.subscribe(s=>{n.next(s),s===It.Steady&&n.complete()})})}_reportProgress(n){this._logService.debug("[LifecycleService]",`lifecycle progressed to "${Va[n]}".`)}},u.LifecycleService=Hi([ms(0,me)],u.LifecycleService),u.LifecycleInitializerService=class extends yt{constructor(n,s){super();g(this,"_seenTokens",new Set);this._lifecycleService=n,this._injector=s}initModulesOnStage(n){var s;(s=wn.get(n))==null||s.forEach(r=>{this._injector.has(r)&&!this._seenTokens.has(r)&&(this._injector.get(r),this._seenTokens.add(r))})}},u.LifecycleInitializerService=Hi([ms(0,at.Inject(u.LifecycleService)),ms(1,at.Inject(at.Injector))],u.LifecycleInitializerService);class Qe extends yt{constructor(){super();g(this,"_currentLocale$",new x.BehaviorSubject(pe.ZH_CN));g(this,"currentLocale$",this._currentLocale$.asObservable());g(this,"_locales",null);g(this,"localeChanged$",new x.Subject);g(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(bt(()=>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 Es=(t=>(t.INIT="init",t.FETCHING="fetching",t.DONE="done",t))(Es||{});const Rs=at.createIdentifier("univer.permission-service");Tn(It.Starting,Rs);class Ka extends yt{constructor(){super(...arguments);g(this,"_permissionPointMap",new Map);g(this,"_permissionPointUpdate$",new x.Subject);g(this,"permissionPointUpdate$",this._permissionPointUpdate$.asObservable())}deletePermissionPoint(n){const s=this._permissionPointMap.get(n);s&&(s.complete(),this._permissionPointMap.delete(n))}addPermissionPoint(n){return n.id?(this._permissionPointMap.set(n.id,new x.BehaviorSubject(n)),this._permissionPointUpdate$.next(n),!0):!1}updatePermissionPoint(n,s){const r=this._permissionPointMap.get(n);if(!r)return;const i=r.getValue();i.value=s,i.status=Es.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(`${r} permissionPoint is not exist`);return i.asObservable()});return x.combineLatest(s).pipe(se.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(`${r} permissionPoint is not exist`);return i.getValue()})}}class Fi extends yt{constructor(){super(...arguments);g(this,"_resourceMap",new Map);g(this,"_register$",new x.Subject);g(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),bt(()=>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=at.createIdentifier("resource-manager-service");var Ya=Object.defineProperty,za=Object.getOwnPropertyDescriptor,Xa=(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&&Ya(e,n,r),r},Bi=(t,e)=>(n,s)=>e(n,s,t);let Cs=class extends yt{constructor(e,n){super();g(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 nt.UNRECOGNIZED:case nt.UNIVER_UNKNOWN:case nt.UNIVER_SLIDE:case nt.UNIVER_DOC:break;case nt.UNIVER_SHEET:this._univerInstanceService.getAllUnitsForType(nt.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(bt(this._univerInstanceService.getTypeOfUnitAdded$(nt.UNIVER_SHEET).subscribe(s=>{this._resourceManagerService.loadResources(s.getUnitId(),s.getSnapshot().resources)}))),this.disposeWithMe(bt(this._univerInstanceService.getTypeOfUnitDisposed$(nt.UNIVER_SHEET).subscribe(s=>{this._resourceManagerService.unloadResources(s.getUnitId())})))}};Cs=Xa([Bi(0,at.Inject(Ln)),Bi(1,at.Inject(Pe))],Cs);const ps=at.createIdentifier("resource-loader-service");Tn(It.Ready,ps);class Is extends yt{constructor(){super();g(this,"_currentTheme");g(this,"_currentTheme$",new x.BehaviorSubject({}));g(this,"currentTheme$",this._currentTheme$.asObservable());this.disposeWithMe(bt(()=>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 $i="__defaultDocumentNormalEditorSpecialUnitId_20231006__",Wi="__defaultDocumentFormulaBarEditorSpecialUnitId_20231012__",qa=`\r
|
|
7
|
-
`;function Ja(t){return`__internalEditorId__${t}`}function Za(t){return t.startsWith("__")}var Qa=Object.defineProperty,tu=Object.getOwnPropertyDescriptor,eu=(t,e,n,s)=>{for(var r=s>1?void 0:s?tu(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&&Qa(e,n,r),r},Os=(t,e)=>(n,s)=>e(n,s,t);const Mn=at.createIdentifier("univer.undo-redo.service"),nu=20;class Gi{dispose(){}async dispatchToHandlers(){return!1}}const Vi="univer.command.redo",ji="univer.command.undo",xi=new class extends Gi{constructor(){super(...arguments);g(this,"type",ze.COMMAND);g(this,"id",ji)}async handler(e){const n=e.get(Mn),s=n.pitchTopUndoElement();if(!s)return!1;const r=e.get(Xe);return Xn(s.undoMutations,r)?(n.popUndoToRedo(),!0):!1}},Ki=new class extends Gi{constructor(){super(...arguments);g(this,"type",ze.COMMAND);g(this,"id",Vi)}async handler(e){const n=e.get(Mn),s=n.pitchTopRedoElement();if(!s)return!1;const r=e.get(Xe);return Xn(s.redoMutations,r)?(n.popRedoToUndo(),!0):!1}};u.LocalUndoRedoService=class extends yt{constructor(n,s,r){super();g(this,"undoRedoStatus$");g(this,"_undoRedoStatus$",new x.BehaviorSubject({undos:0,redos:0}));g(this,"_undoStacks",new Map);g(this,"_redoStacks",new Map);g(this,"_batchingStatus",new Map);this._univerInstanceService=n,this._commandService=s,this._contextService=r,this.undoRedoStatus$=this._undoRedoStatus$.asObservable(),this.disposeWithMe(this._commandService.registerCommand(xi)),this.disposeWithMe(this._commandService.registerCommand(Ki)),this.disposeWithMe(bt(()=>this._undoRedoStatus$.complete())),this.disposeWithMe(bt(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>nu&&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),bt(()=>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,d;let n="";const s=this._contextService.getContextValue(Ze),r=this._contextService.getContextValue(yi),i=this._contextService.getContextValue(Di);return s?r?n=Wi:i?n=$i:n=(l=(o=this._univerInstanceService.getFocusedUnit())==null?void 0:o.getUnitId())!=null?l:"":n=(d=(a=this._univerInstanceService.getFocusedUnit())==null?void 0:a.getUnitId())!=null?d:"",n}},u.LocalUndoRedoService=eu([Os(0,Pe),Os(1,Xe),Os(2,Ye)],u.LocalUndoRedoService);const Yi=Symbol("DependentOn");class Ss extends yt{onStarting(e){}onReady(){}onRendered(){}onSteady(){}getUniverInstanceType(){return this.constructor.type}getPluginName(){return this.constructor.pluginName}}g(Ss,"pluginName"),g(Ss,"type",nt.UNIVER_UNKNOWN);class su{constructor(){g(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 ru{constructor(){g(this,"_pluginsRegistered",[])}registerPlugin(e,n){this._pluginsRegistered.push({plugin:e,options:n})}getRegisterPlugins(){return this._pluginsRegistered.slice()}removePlugins(){this._pluginsRegistered=[]}}var iu=Object.defineProperty,ou=Object.getOwnPropertyDescriptor,zi=(t,e,n,s)=>{for(var r=s>1?void 0:s?ou(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&&iu(e,n,r),r},tn=(t,e)=>(n,s)=>e(n,s,t);const lu=4;function au(...t){return function(e){e[Yi]=t}}u.PluginService=class{constructor(e){g(this,"_pluginHolderForUniver");g(this,"_pluginHoldersForTypes",new Map);g(this,"_seenPlugins",new Set);g(this,"_flushTimer");this._injector=e,this._pluginHolderForUniver=this._injector.createInstance(Un,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===nt.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(Un,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===nt.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()},lu))}_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()}},u.PluginService=zi([tn(0,at.Inject(at.Injector))],u.PluginService);let Un=class extends yt{constructor(e,n,s,r,i,o){super();g(this,"_started",!1);g(this,"_pluginRegistry",new ru);g(this,"_pluginStore",new su);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[Yi];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 It.Starting:i.onStarting(this._injector);break;case It.Ready:i.onReady();break;case It.Rendered:i.onRendered();break;case It.Steady:i.onSteady();break}this._lifecycleInitializerService.initModulesOnStage(r)})},s=this.disposeWithMe(this._lifecycleService.subscribeWithPrevious().pipe(x.finalize(()=>{Promise.resolve().then(()=>s.dispose())})).subscribe(r=>{n(r)}))}};Un=zi([tn(2,me),tn(3,at.Inject(at.Injector)),tn(4,at.Inject(u.LifecycleService)),tn(5,at.Inject(u.LifecycleInitializerService))],Un);function Xi(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 Ns={[$t.Editor]:"Editor",[$t.Owner]:"Owner",[$t.Reader]:"Reader",[$t.UNRECOGNIZED]:"UNRECOGNIZED"},bs=t=>({userID:`${Ns[t]}_${y.generateRandomId(8)}`,name:Ns[t],avatar:""}),vs=(t,e)=>t.startsWith(Ns[e]);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};u.UserManagerService=class{constructor(){g(this,"_model",new Map);g(this,"_userChange$",new x.Subject);g(this,"userChange$",this._userChange$.asObservable());g(this,"_currentUser$",new x.BehaviorSubject(bs($t.Owner)));g(this,"currentUser$",this._currentUser$.asObservable())}get currentUser(){return this._currentUser$.getValue()}set currentUser(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"})}},u.UserManagerService=hu([ki(It.Starting,u.UserManagerService)],u.UserManagerService);var du=Object.defineProperty,fu=Object.getOwnPropertyDescriptor,_u=(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},qi=(t,e)=>(n,s)=>e(n,s,t);u.AuthzIoLocalService=class{constructor(e,n){g(this,"_permissionMap",new Map([]));this._resourceManagerService=e,this._userManagerService=n,this._initSnapshot()}_getRole(e){const n=this._userManagerService.currentUser;return n?vs(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:[nt.UNIVER_SHEET,nt.UNIVER_DOC,nt.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 On.SelectRange:{const s=e.selectRangeObject;this._permissionMap.set(n,{...s,objectType:e.objectType});break}case On.Worksheet:{const s=e.worksheetObject;this._userManagerService.currentUser,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===On.Worksheet)return(n=s==null?void 0:s.strategies)==null?void 0:n.map(r=>({action:r.action,allowed:r.role===$t.Editor}))}return e.actions.map(s=>({action:s,allowed:this._getRole($t.Owner)||this._getRole($t.Editor)}))}async batchAllowed(e){const n=this._userManagerService.currentUser,s=e.map(r=>({unitID:r.unitID,objectID:r.objectID,actions:r.actions.map(i=>({action:i,allowed:!1}))}));return n&&(vs(n.userID,$t.Owner)||vs(n.userID,$t.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:$t.Owner,shareScope:-1,creator:bs($t.Owner),strategies:[],actions:e.actions.map(o=>({action:o,allowed:this._getRole($t.Owner)||this._getRole($t.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){}},u.AuthzIoLocalService=_u([qi(0,Ln),qi(1,at.Inject(u.UserManagerService))],u.AuthzIoLocalService);const Ji=at.createIdentifier("IAuthzIoIoService");class gu{constructor(e={},n){g(this,"_startedTypes",new Set);g(this,"_injector");const s=this._injector=mu(n,e==null?void 0:e.override),{theme:r,locale:i,locales:o,logLevel:l}=e;r&&this._injector.get(Is).setTheme(r),o&&this._injector.get(Qe).load(o),i&&this._injector.get(Qe).setLocale(i),l&&this._injector.get(me).setLogLevel(l),this._init(s),this._pluginService}get _univerInstanceService(){return this._injector.get(Pe)}get _pluginService(){return this._injector.get(u.PluginService)}__getInjector(){return this._injector}dispose(){this._injector.dispose()}setLocale(e){this._injector.get(Qe).setLocale(e)}createUnit(e,n){return this._univerInstanceService.createUnit(e,n)}createUniverSheet(e){return this._univerInstanceService.createUnit(nt.UNIVER_SHEET,e)}createUniverDoc(e){return this._univerInstanceService.createUnit(nt.UNIVER_DOC,e)}createUniverSlide(e){return this._univerInstanceService.createUnit(nt.UNIVER_SLIDE,e)}_init(e){this._univerInstanceService.registerCtorForType(nt.UNIVER_SHEET,u.Workbook),this._univerInstanceService.registerCtorForType(nt.UNIVER_DOC,Ae),this._univerInstanceService.registerCtorForType(nt.UNIVER_SLIDE,gs);const n=e.get(Pe);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(u.LifecycleService).stage<It.Ready&&(this._injector.get(u.LifecycleService).stage=It.Ready)}registerPlugin(e,n){this._pluginService.registerPlugin(e,n)}}function mu(t,e){const n=Xi([[Si],[Qe],[Is],[u.LifecycleService],[u.LifecycleInitializerService],[u.PluginService],[u.UserManagerService],[Pe,{useClass:u.UniverInstanceService}],[Rs,{useClass:Ka}],[me,{useClass:Qr,lazy:!0}],[Xe,{useClass:u.CommandService,lazy:!0}],[Mn,{useClass:u.LocalUndoRedoService,lazy:!0}],[Ii,{useClass:Oi}],[Ye,{useClass:Jr}],[Ln,{useClass:Fi,lazy:!0}],[ps,{useClass:Cs,lazy:!0}],[Ji,{useClass:u.AuthzIoLocalService,lazy:!0}]],e);return t?t.createChild(n):new at.Injector(n)}const Eu=(t,e)=>e.length===t.length&&!t.some(n=>e.some(s=>!ge.equals(s,n))),Ru=(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 Cu(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 Zi(t){return/^-?\d+(\.\d+)?$/.test(t)}function pu(t){return Zi(t)?Number(t)<=Number.MAX_SAFE_INTEGER:!1}function Iu(t){return["true","false"].includes(t.toLowerCase())}function Ou(t,e){return e.forEach(n=>t.add(n)),t}function Su(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 Nu(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 Qi=(t=>(t[t.TEXT=0]="TEXT",t[t.ARROW=1]="ARROW",t[t.CUSTOM=2]="CUSTOM",t))(Qi||{});function bu(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 Ee,d=ve.getInstance();if(o>0&&a.retain(o),n.length>0){const c=r.sliceBody(o,o+i),f={dataStream:n};Array.isArray(c==null?void 0:c.textRuns)&&c.textRuns.length&&(f.textRuns=[{...c.textRuns[0],st:0,ed:n.length}]),a.insert(n.length,f)}a.delete(i);const h=a.serialize();r.apply(d.editOp(h))}const l=r.getBody();return r.dispose(),l}class vu extends mn{add(e){if(!e)return null;const n=new gn(e,this);return this._observers=[n],this._onObserverAdded&&this._onObserverAdded(n),n}makeObserverTopPriority(){}makeObserverBottomPriority(){}}const Au=at.createIdentifier("ILocalStorageService");function wu(t){return`sheet_interceptor_${t}`}const to=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 Tu{constructor(e){g(this,"_interceptorsByName",new Map);g(this,"_interceptorPoints");this._interceptorPoints=e}fetchThroughInterceptors(e){const n=e,s=this._interceptorsByName.get(n);return to(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)})),()=>En(this._interceptorsByName.get(s),n)}getInterceptPoints(){return this._interceptorPoints}}const Lu=at.createIdentifier("univer.snapshot-server-service");class Mu{constructor(){g(this,"_sheetBlockCache",new Map)}getUnitOnRev(e,n){return Promise.resolve({snapshot:{unitID:"",type:nt.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 Uu(t){return btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(e,n)=>String.fromCharCode(Number.parseInt(n,16))))}function As(t){return decodeURIComponent(Array.prototype.map.call(atob(t),e=>`%${`00${e.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""))}const en=new TextEncoder,Dn=new TextDecoder;function eo(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 no(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 Du(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 so(t){return JSON.parse(Dn.decode(t))}function yu(t){return JSON.parse(typeof t=="string"?As(t):Dn.decode(t))}function Pu(t){return JSON.parse(typeof t=="string"?As(t):Dn.decode(t))}const ws=256;function ro(t,e){const n=new Zt(t),s=n.getLength(),r=[];let i=0;for(;i<s;){const o=Math.min(i+ws,s-1),l=n.getSlice(i,Math.min(i+ws,s-1),0,e),a=ku(l);r.push({id:y.generateRandomId(19,"0123456789"),startRow:i,endRow:o,data:a}),i+=ws}return r}function ku(t){const e=t.getData();return en.encode(JSON.stringify(e))}async function Hu(t,e,n,s,r){const i={},o={};if(!await Promise.all(Object.entries(e.sheets).map(async([c,f])=>{const _={id:f.id,type:on.GRID,name:f.name,rowCount:f.rowCount,columnCount:f.columnCount,originalMeta:eo(f)};if(o[c]=_,f.cellData){const E=ro(f.cellData,f.rowCount),R=await Promise.all(E.map(P=>r.saveSheetBlock(t,{unitID:n,type:nt.UNIVER_SHEET,block:P})));if(R.some(P=>{var k;return((k=P.error)==null?void 0:k.code)!==xt.OK}))return!1;i[c]={sheetID:c,blocks:R.map(P=>P.blockID)}}return!0})))throw new Error("[transformWorkbookDataToSnapshot()]: Failed to save sheet blocks.");const a=no(e),d={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:d.rev,type:nt.UNIVER_SHEET,workbook:d,doc:void 0}}}async function Fu(t,e,n,s,r){var f,_;const i={},o={};if(!await Promise.all(Object.entries(e.sheets).map(async([E,R])=>{const P={id:R.id,type:on.GRID,name:R.name,rowCount:R.rowCount,columnCount:R.columnCount,originalMeta:eo(R)};if(o[E]=P,R.cellData){const k=ro(R.cellData,R.rowCount),tt=await Promise.all(k.map(mt=>r.saveSheetBlock(t,{unitID:n,type:nt.UNIVER_SHEET,block:mt})));if(tt.some(mt=>{var ft;return((ft=mt.error)==null?void 0:ft.code)!==xt.OK}))return!1;i[E]={sheetID:E,blocks:tt.map(mt=>mt.blockID)}}return!0})))throw new Error("[transformWorkbookDataToSnapshot()]: Failed to save sheet blocks.");const a=no(e),d={unitID:e.id,rev:s,creator:"",name:e.name,sheetOrder:e.sheetOrder,sheets:o,blockMeta:i,resources:e.resources||[],originalMeta:a},h={unitID:n,rev:d.rev,type:nt.UNIVER_SHEET,workbook:d,doc:void 0},c=await r.saveSnapshot(t,{unitID:n,type:nt.UNIVER_SHEET,snapshot:h});if(si(c.error))throw new Error(`transformWorkbookDataToSnapshot(): Failed to save snapshot.
|
|
8
|
-
ErrorCode: ${(f=c.error)==null?void 0:f.code}:${(_=c.error)==null?void 0:_.message}`);return{snapshot:h}}function
|
|
9
|
-
ErrorCode: ${(d=l.error)==null?void 0:d.code}:${(h=l.error)==null?void 0:h.message}`);return{snapshot:o}}async function
|
|
3
|
+
`):"",this.name="UnsubscriptionError",this.errors=n}});function Hr(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var Fr=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=yr(o),a=l.next();!a.done;a=l.next()){var d=a.value;d.remove(this)}}catch(R){e={error:R}}finally{try{a&&!a.done&&(n=l.return)&&n.call(l)}finally{if(e)throw e.error}}else o.remove(this);var h=this.initialTeardown;if(je(h))try{h()}catch(R){i=R instanceof Gn?R.errors:[R]}var c=this._finalizers;if(c){this._finalizers=null;try{for(var f=yr(c),_=f.next();!_.done;_=f.next()){var E=_.value;try{Br(E)}catch(R){i=i!=null?i:[],R instanceof Gn?i=kr(kr([],Pr(i)),Pr(R.errors)):i.push(R)}}}catch(R){s={error:R}}finally{try{_&&!_.done&&(r=f.return)&&r.call(f)}finally{if(s)throw s.error}}}if(i)throw new Gn(i)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)Br(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)&&Hr(n,e)},t.prototype.remove=function(e){var n=this._finalizers;n&&Hr(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}();Fr.EMPTY;function El(t){return t instanceof Fr||t&&"closed"in t&&je(t.remove)&&je(t.add)&&je(t.unsubscribe)}function Br(t){je(t)?t():t.unsubscribe()}class Wr{constructor(e=!1){g(this,"skipNextObservers");g(this,"lastReturnValue");g(this,"isStopPropagation",!1);this.initialize(e)}initialize(e=!1){return this.skipNextObservers=e,this}stopPropagation(){this.isStopPropagation=!0}}function $r(t){return t instanceof gn}class gn{constructor(e,n){this.callback=e,this.observable=n}dispose(){this.observable.remove(this)}}class mn{constructor(e){g(this,"_observers",new Array);g(this,"_eventState");g(this,"_onObserverAdded");this._eventState=new Wr,e&&(this._onObserverAdded=e)}get observers(){return this._observers}add(e,n=!1){if(!e)return null;const s=new gn(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 mn;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 bt(t){let e=!1;return t?El(t)?{dispose:()=>t.unsubscribe()}:$r(t)?{dispose:()=>{e||(e=!0,t.dispose())}}:typeof t=="function"?{dispose:()=>{e||(e=!0,t())}}:t:bt(()=>{})}function Rl(t){return bt(()=>{t.unsubscribe()})}class Vn{constructor(){g(this,"_disposables",new Set)}add(e){const n=bt(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(){g(this,"_disposed",!1);g(this,"_collection",new Vn)}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 Cl extends yt{constructor(){super(...arguments);g(this,"dispose$",new x.Subject)}dispose(){super.dispose(),this.dispose$.next(),this.dispose$.complete()}}class xe{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 En(t,e){const n=t.indexOf(e);return n>-1?(t.splice(n,1),!0):!1}function pl(t){const e=new Set,n=[];for(const s of t)e.has(s)||(e.add(s),n.push(s));return n}function Il(t,e){for(let n=t.length-1;n>-1;n--){const s=t[n];if(e(s,n))return s}return null}function Ol(t,e){if(t.length===0)return t;const n=e%t.length;return t.slice(n).concat(t.slice(0,n))}function Sl(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 ht=Symbol("newer"),Mt=Symbol("older");class Gr{constructor(e){g(this,"entry");this.entry=e}[Symbol.iterator](){return this}next(){const e=this.entry;return e?(this.entry=e[ht],{done:!1,value:e.key}):{done:!0,value:void 0}}}class Vr{constructor(e){g(this,"entry");this.entry=e}[Symbol.iterator](){return this}next(){const e=this.entry;return e?(this.entry=e[ht],{done:!1,value:e.value}):{done:!0,value:void 0}}}class jr{constructor(e){g(this,"entry");this.entry=e}[Symbol.iterator](){return this}next(){const e=this.entry;return e?(this.entry=e[ht],{done:!1,value:[e.key,e.value]}):{done:!0,value:void 0}}}_o=ht,fo=Mt;class jn{constructor(e,n){g(this,"key");g(this,"value");g(this,_o);g(this,fo);this.key=e,this.value=n,this[ht]=void 0,this[Mt]=void 0}toJSON(){return{key:this.key,value:this.value}}}class xr{constructor(...e){g(this,"_keymap");g(this,"size",0);g(this,"limit");g(this,"oldest");g(this,"newest");g(this,"_onShiftListeners",[]);if(xe.hasLength(e,1)){if(xe.isNumber(e[0])){const n=e[0];this._initialize(n,void 0);return}if(xe.isIterable(e[0])){const n=e[0];this._initialize(0,n);return}return}if(xe.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),bt(()=>En(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[ht]&&(e===this.oldest&&(this.oldest=e[ht]),e[ht][Mt]=e[Mt]),e[Mt]&&(e[Mt][ht]=e[ht]),e[ht]=void 0,e[Mt]=this.newest,this.newest&&(this.newest[ht]=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 jn(i.value[0],i.value[1]);if(this._keymap.set(o.key,o),n?(n[ht]=o,o[Mt]=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 jn(e,n)),this.newest?(this.newest[ht]=s,s[Mt]=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[ht]?(this.oldest=this.oldest[ht],this.oldest[Mt]=void 0):(this.oldest=void 0,this.newest=void 0),e[ht]=e[Mt]=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[ht]&&n[Mt]?(n[Mt][ht]=n[ht],n[ht][Mt]=n[Mt]):n[ht]?(n[ht][Mt]=void 0,this.oldest=n[ht]):n[Mt]?(n[Mt][ht]=void 0,this.newest=n[Mt]):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 Gr(this.oldest)}values(){return new Vr(this.oldest)}entries(){return this[Symbol.iterator]()}[Symbol.iterator](){return new jr(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[ht]}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[ht];return e}toString(){let e="",n=this.oldest;for(;n;)e+=`${String(n.key)}:${n.value}`,n=n[ht],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 Kn(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 Nl(t,e){const n=t,s=Object.keys(n),r=s.length,i=e,o=Object.keys(i),l=o.length,a={};let d=0;for(let h=0;h<r;h++,d++){const c=s[h];a[d]=n[c]}for(let h=0;h<l;h++,d++){const c=o[h];a[d]=i[c]}return a}function bl(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 Yn(t,e,n,s){const r=t>n;if(!r&&t+e>n)throw new Error("Invalid move operation");r?vl(t,e,n,s):Al(t,e,n,s)}function vl(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 Al(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 Zt{constructor(e={}){g(this,"_matrix");this._setOriginValue(e)}static MakeObjectMatrixSize(e){return new Zt({[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 d=Number(a),h=o[Number(a)];if(e(i,d,h)===!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){Yn(e,n,s,this._matrix)}moveColumns(e,n,s){this.forEach((r,i)=>{Yn(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){Kn(e,n,this._matrix)}removeColumns(e,n){this.forEach((s,r)=>{Kn(e,n,r)})}getFragment(e,n,s,r){const i=new Zt;let o=0;for(let l=e;l<=n;l++){const a={};let d=0;for(let h=s;h<=r;h++){const c=this.getValue(l,h);a[d]=c,d++}i.setRow(o,a),o++}return i}getSlice(e,n,s,r){const i=new Zt;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 Zt;return this.forEach((o,l)=>{s||(s=!0,e=o),Object.keys(l).forEach(a=>{const d=Number(a);r?d<n&&(n=d):(r=!0,n=d);const h=this.getValue(o,d);i.setValue(o-e,d-n,h)})}),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 d=_e(a)-1;d>s&&(s=d),Object.keys(a).forEach(h=>{const c=Number(h);o?c<n&&(n=c):(o=!0,n=c)}),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 le=class le{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===ot.NORMAL||n.rangeType===void 0&&e.rangeType===ot.NORMAL)}static intersects(e,n){if(e.rangeType===ot.ROW&&n.rangeType===ot.COLUMN||e.rangeType===ot.COLUMN&&n.rangeType===ot.ROW)return!0;if(e.rangeType===ot.ROW&&n.rangeType===ot.ROW)return e.startRow<=n.endRow&&e.endRow>=n.startRow;if(e.rangeType===ot.COLUMN&&n.rangeType===ot.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,d=Number.isNaN(n.endRow)?s:n.endRow,h=Number.isNaN(n.startColumn)?0:n.startColumn,c=Number.isNaN(n.endColumn)?s:n.endColumn,f=Math.abs(o+l-h-c),_=Math.abs(o-l)+Math.abs(h-c),E=Math.abs(r+i-a-d),R=Math.abs(r-i)+Math.abs(a-d);return f<=_&&E<=R}static getIntersects(e,n){const s=e.startRow,r=e.endRow,i=e.startColumn,o=e.endColumn,l=n.startRow,a=n.endRow,d=n.startColumn,h=n.endColumn;let c,f,_,E;if(l<=r)l>=s?f=l:f=s;else return null;if(a>=s)a>=r?E=r:E=a;else return null;if(d<=o)d>i?c=d:c=i;else return null;if(h>=i)h>=o?_=o:_=h;else return null;return{startRow:f,endRow:E,startColumn:c,endColumn:_,rangeType:ot.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 le.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:ot.NORMAL}),e[0])}static realUnion(...e){const n=e.some(i=>i.rangeType===ot.COLUMN),s=e.some(i=>i.rangeType===ot.ROW),r=le.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?ot.ROW:n?ot.COLUMN:ot.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}}};g(le,"getRelativeRange",(e,n)=>({startRow:e.startRow-n.startRow,endRow:e.endRow-e.startRow,startColumn:e.startColumn-n.startColumn,endColumn:e.endColumn-e.startColumn})),g(le,"getPositionRange",(e,n,s)=>({...s||{},startRow:s&&[Nt.ROW,Nt.ALL].includes(s.startAbsoluteRefType||0)?s.startRow:e.startRow+n.startRow,endRow:s&&[Nt.ROW,Nt.ALL].includes(s.endAbsoluteRefType||0)?s.endRow:e.endRow+e.startRow+n.startRow,startColumn:s&&[Nt.COLUMN,Nt.ALL].includes(s.startAbsoluteRefType||0)?s.startColumn:e.startColumn+n.startColumn,endColumn:s&&[Nt.COLUMN,Nt.ALL].includes(s.endAbsoluteRefType||0)?s.endColumn:e.endColumn+e.startColumn+n.startColumn})),g(le,"moveHorizontal",(e,n=0,s=0)=>({...e,startColumn:e.startColumn+n,endColumn:e.endColumn+n+s})),g(le,"moveVertical",(e,n=0,s=0)=>({...e,startRow:e.startRow+n,endRow:e.endRow+n+s})),g(le,"moveOffset",(e,n,s)=>({...e,startRow:e.startRow+s,endRow:e.endRow+s,startColumn:e.startColumn+n,endColumn:e.endColumn+n}));let ge=le;class wl{constructor(e,n){g(this,"_values",[]);g(this,"_keys",[]);g(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 Tl(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 Rn=65,Kr=90,Ml=97;function Ul(t){const e=Kr-Rn+1;let n="";for(;t>=0;)n=String.fromCharCode(t%e+Rn)+n,t=Math.floor(t/e)-1;return n}function Yr(t,e){let n="";for(;e>0;)n+=t,e--;return n}function Ll(t,e=!1){const n=Kr-Rn+1;let s=Ml;e&&(s=Rn);const r=String.fromCharCode(t%n+s),i=Math.floor(t/n)+1;return Yr(r,i)}function Dl(t,e){return t.zIndex>e.zIndex?1:t.zIndex===e.zIndex?0:-1}function yl(t,e){return t.zIndex>e.zIndex?-1:t.zIndex===e.zIndex?0:1}function De(t="index",e=1){return(n,s)=>n[t]>s[t]?e:n[t]===s[t]?0:-e}function Pl(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:d}=l;y.hasIntersectionBetweenTwoRanges(e,n,a,d)&&(a>i?(o.push(s.slice(i,a)),o.push(Xn(s,{...l,ed:Math.min(d,n)}))):o.push(Xn(s,{...l,st:i,ed:Math.min(d,n)}))),i=Math.max(e,Math.min(d,n))}return i!==n&&o.push(s.slice(i,n)),o.join("")}function kl(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:d={}}=l,{spaceAbove:h,spaceBelow:c,lineSpacing:f}=d,_=[];h!=null&&(typeof h=="number"?_.push(`margin-top: ${h}px`):_.push(`margin-top: ${h.v}px`)),c!=null&&(typeof c=="number"?_.push(`margin-bottom: ${c}px`):_.push(`margin-bottom: ${c.v}px`)),f!=null&&_.push(`line-height: ${f}`),a>o+1?i+=`<p class="UniverNormal" ${_.length?`style="${_.join("; ")};"`:""}>${Cn(t,o+1,a)}</p>`:i+=`<p class="UniverNormal" ${_.length?`style="${_.join("; ")};"`:""}></p>`,o=a}return o!==s.length&&(i+=Cn(t,o,s.length)),i}else return Cn(t,0,t.dataStream.length)}function Xn(t,e){const{st:n,ed:s,ts:r={}}=e,{ff:i,fs:o,it:l,bl:a,ul:d,st:h,ol:c,bg:f,cl:_,va:E}=r;let R=t.slice(n,s);const H=[];return l===Z.TRUE&&(R=`<i>${R}</i>`),E===Le.SUPERSCRIPT?R=`<sup>${R}</sup>`:E===Le.SUBSCRIPT&&(R=`<sub>${R}</sub>`),(d==null?void 0:d.s)===Z.TRUE&&(R=`<u>${R}</u>`),(h==null?void 0:h.s)===Z.TRUE&&(R=`<s>${R}</s>`),a===Z.TRUE&&(R=`<strong>${R}</strong>`),i&&H.push(`font-family: ${i}`),_&&H.push(`color: ${_.rgb}`),o&&H.push(`font-size: ${o}pt`),c&&H.push("text-decoration: overline"),f&&H.push(`background: ${f.rgb}`),H.length?`<span style="${H.join("; ")};">${R}</span>`:R}const Hl={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},Wl={row:0,column:0},pn={ff:"Arial",fs:11,it:Z.FALSE,bl:Z.FALSE,ul:{s:Z.FALSE},st:{s:Z.FALSE},ol:{s:Z.FALSE},tr:{a:0,v:Z.FALSE},td:$e.UNSPECIFIED,cl:{rgb:"#000"},bg:{rgb:"#fff"},ht:Ie.UNSPECIFIED,vt:Ue.UNSPECIFIED,tb:Ge.UNSPECIFIED,pd:{t:0,r:0,b:0,l:0}},zr={id:"default_slide",title:"defaultSlide",pageSize:{width:300,height:300}};var Xr=(t=>(t.ARRAY_CONVERTOR="ARRAY_CONVERTOR",t.MATRIX_CONVERTOR="MATRIX_CONVERTOR",t))(Xr||{});function In(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 Z.FALSE;switch(t){case"bl":case"it":{if(o[t]===Z.FALSE)return Z.FALSE;break}case"ul":case"st":{if(o[t].s===Z.FALSE)return Z.FALSE;break}default:throw new Error(`unknown style key: ${t} in IStyleBase`)}s+=a-l}return e.dataStream.indexOf(`\r
|
|
4
|
+
`)===s?Z.TRUE:Z.FALSE}const en=class en{constructor(e,n,s){g(this,"_range");g(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 Zt;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 Zt;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)||pn.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 en(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 d=0;d<=s-n;d++)for(let h=0;h<=i-r;h++){if(o==null||((l=o==null?void 0:o[d])==null?void 0:l[h])==null)continue;const c=o[d][h].s;c&&(o[d][h].s=a.get(c))}}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)||pn.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?In("ul",e.body)===Z.TRUE?{s:Z.TRUE}:{s:Z.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?In("st",e.body)===Z.TRUE?{s:Z.TRUE}:{s:Z.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?In("it",e.body)===Z.TRUE?ln.ITALIC:ln.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?In("bl",e.body)===Z.TRUE?an.BOLD:an.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){en.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]||pn[e]}))}};g(en,"transformRange",(e,n)=>e.rangeType===ot.ALL?{startColumn:0,startRow:0,endColumn:n.getMaxColumns()-1,endRow:n.getMaxRows()-1}:e.rangeType===ot.COLUMN?{startRow:0,endRow:n.getMaxRows()-1,startColumn:e.startColumn,endColumn:e.endColumn}:e.rangeType===ot.ROW?{startColumn:0,endColumn:n.getMaxColumns()-1,startRow:e.startRow,endRow:e.endRow}:e);let ye=en;function $l(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 Vl(t,e){ye.foreach(e,(n,s)=>{t[n][s]=void 0})}function jl(t,e){const n=t.toFullArray(),s=[];for(;;){const r=$l(n,e);if(!r)break;s.push(r),Vl(n,r)}return s}function xl(t,e,n,s=!1){let r={...t};const i=r.startAbsoluteRefType||Nt.NONE,o=r.endAbsoluteRefType||Nt.NONE;return!s&&i===Nt.ALL&&o===Nt.ALL?r:s||i===Nt.NONE&&o===Nt.NONE?ge.moveOffset(r,e,n):(i===Nt.NONE?r={...r,startRow:r.startRow+n,startColumn:r.startColumn+e}:i===Nt.COLUMN?r={...r,startRow:r.startRow+n}:i===Nt.ROW&&(r={...r,startColumn:r.startColumn+e}),o===Nt.NONE?r={...r,endRow:r.endRow+n,endColumn:r.endColumn+e}:o===Nt.COLUMN?r={...r,endRow:r.endRow+n}:o===Nt.ROW&&(r={...r,endColumn:r.endColumn+e}),r)}async function qr(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 Jr(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 Ke=ut.createIdentifier("univer.context-service");class Zr extends yt{constructor(){super(...arguments);g(this,"_contextChanged$",new x.Subject);g(this,"contextChanged$",this._contextChanged$.asObservable());g(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 x.Observable(s=>{const r=this._contextChanged$.pipe(x.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 Qr=(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))(Qr||{});const me=ut.createIdentifier("univer.log");class ti extends yt{constructor(){super(...arguments);g(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 Kl=Object.defineProperty,Yl=Object.getOwnPropertyDescriptor,zl=(t,e,n,s)=>{for(var r=s>1?void 0:s?Yl(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&&Kl(e,n,r),r},ei=(t,e)=>(n,s)=>e(n,s,t),Ye=(t=>(t[t.COMMAND=0]="COMMAND",t[t.OPERATION=1]="OPERATION",t[t.MUTATION=2]="MUTATION",t))(Ye||{});const ze=ut.createIdentifier("anywhere.command-service");class Xl{constructor(){g(this,"_commands",new Map);g(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),bt(()=>{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 ni={id:"nil",type:0,handler:()=>!0};u.CommandService=class{constructor(e,n){g(this,"_commandRegistry");g(this,"_beforeCommandExecutionListeners",[]);g(this,"_commandExecutedListeners",[]);g(this,"_multiCommandDisposables",new Map);g(this,"_commandExecutingLevel",0);g(this,"_commandExecutionStack",[]);this._injector=e,this._logService=n,this._commandRegistry=new Xl,this._registerCommand(ni)}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),bt(()=>{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),bt(()=>{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(d=>d(o,s));const a=await this._execute(i,n,s);return this._commandExecutedListeners.forEach(d=>d(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 h=Il(this._commandExecutionStack,c=>c.type===0);h&&(l.params=(i=l.params)!=null?i:{},l.params.trigger=h.id)}const a=this._pushCommandExecutionStack(l);this._beforeCommandExecutionListeners.forEach(h=>h(l,s));const d=this._syncExecute(o,n,s);return this._commandExecutedListeners.forEach(h=>h(l,s)),a.dispose(),d}throw new Error(`[CommandService]: command "${e}" is not registered.`)}_pushCommandExecutionStack(e){return this._commandExecutionStack.push(e),bt(()=>En(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 Vn;s=new ql(e.id),i.add(this._commandRegistry.registerCommand(s)),i.add(bt(()=>{this._multiCommandDisposables.delete(e.id)})),this._multiCommandDisposables.set(e.id,i)}const r=s.registerImplementation(e);return bt(()=>{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}},u.CommandService=zl([ei(0,ut.Inject(ut.Injector)),ei(1,me)],u.CommandService);class ql{constructor(e){g(this,"name");g(this,"multi",!0);g(this,"type",0);g(this,"priority",0);g(this,"_implementations",[]);g(this,"handler",async(e,n)=>{if(!this._implementations.length)return!1;const s=e.get(me),r=e.get(Ke),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),bt(()=>{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 qn(t,e,n){const s=t.map(r=>()=>e.syncExecuteCommand(r.id,r.params,n));return Jr(s)}function Jl(t,e,n){const s=t.map(r=>()=>e.executeCommand(r.id,r.params,n));return qr(s)}function si(t){return new x.Observable(e=>{const n=t((...s)=>e.next(s));return()=>n==null?void 0:n.dispose()})}const Zl=t=>new Promise(e=>{x.merge(si(t.onCommandExecuted).pipe(oe.filter(([n])=>n.type===Ye.MUTATION)),x.timer(300)).pipe(oe.debounceTime(16),oe.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 ri(t){return!!(t&&t.code&&t.code!==xt.OK&&t.code!=="OK")}var nt=(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))(nt||{}),Wt=(t=>(t[t.Reader=0]="Reader",t[t.Editor=1]="Editor",t[t.Owner=2]="Owner",t[t.UNRECOGNIZED=-1]="UNRECOGNIZED",t))(Wt||{}),On=(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))(On||{});class Sn extends yt{}class Jn{constructor(){g(this,"_data",[])}static create(){return new Jn}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 Zn{constructor(){g(this,"_data",new Map)}static create(){return new Zn}add(e,n){this._data.has(e)||this._data.set(e,n)}delete(e){this._data.delete(e)}getData(){return this._data}}var Nn=(t=>(t.BULLET_LIST="BULLET_LIST",t.ORDER_LIST="ORDER_LIST",t))(Nn||{});const Ql={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:Ve.DECIMAL,hanging:21,indentStart:21},{bulletAlignment:de.START,glyphFormat:" %1.%2)",textStyle:{fs:12},startNumber:0,glyphType:Ve.DECIMAL,hanging:21,indentStart:42},{bulletAlignment:de.START,glyphFormat:" %1.%2.%3.",textStyle:{fs:12},startNumber:0,glyphType:Ve.DECIMAL,hanging:21,indentStart:63}]}};var ii=(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))(ii||{}),Qn=(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))(Qn||{});function ts(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();Mr(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 oi(t,e,n,s){var d;const{textRuns:r}=t;if(r==null)return;const i=[],o=r.length;let l=!1;const a=(d=e.textRuns)!=null?d:[];if(a.length)for(const h of a)h.st+=s,h.ed+=s;for(let h=0;h<o;h++){const c=r[h],f=r[h+1],{st:_,ed:E}=c;if(E<s)i.push(c);else if(s>=_&&s<=E){if(f&&f.st===f.ed&&s===f.st){i.push(c);continue}if(l)c.st+=n,c.ed+=n,i.push(c);else{l=!0,c.ed+=n;const R=[];if(a.length){const H={...c,st:_,ed:a[0].st};H.ed>H.st&&R.push(H),R.push(...a);const k=a[a.length-1],tt={...c,st:k.ed,ed:E+n};tt.ed>tt.st&&R.push(tt)}else R.push(c);i.push(...R)}}else c.st+=n,c.ed+=n,l||(l=!0,i.push(...a)),i.push(c)}l||(l=!0,i.push(...a)),t.textRuns=ts(i)}function es(t,e,n,s){const{paragraphs:r}=t;if(r==null)return;const{paragraphs:i,dataStream:o}=e,l=[];let a=-1;for(let h=0,c=r.length;h<c;h++){const f=r[h],{startIndex:_}=f;_>=s&&(f.startIndex+=n),a===-1&&_>=s&&(a=h),l.push(f.startIndex)}let d=-1;if(i){for(let h=0,c=i.length;h<c;h++){const f=i[h];f.startIndex+=s;const _=f.startIndex;d=l.indexOf(_)}if(o===Qn.PARAGRAPH&&i.length===1){const h=r[a],c=i[0],f=h.paragraphStyle,_=h.bullet;h.paragraphStyle=c.paragraphStyle,h.bullet=c.bullet,c.paragraphStyle=f,c.bullet=_}d!==-1&&r.splice(d,1),r.push(...i),r.sort(De("startIndex"))}}function ta(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:d}=a;d>=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(De("startIndex"))}}function li(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:d}=a;d>=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(De("startIndex"))}}function ns(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:d,endIndex:h}=a;d>s?(a.startIndex+=n,a.endIndex+=n):h>=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(De("startIndex"))}}function ea(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:d,endIndex:h}=a;d>s?(a.startIndex+=n,a.endIndex+=n):h>=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(De("startIndex"))}}function ai(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(d=>d.st===n&&d.ed===n);return o.push({...a,st:a.st-n,ed:a.ed-n}),t.textRuns=(l=t.textRuns)==null?void 0:l.filter(d=>d!==a),o}if(s){const a=[];for(let d=0,h=s.length;d<h;d++){const c=s[d],{st:f,ed:_}=c;if(r<=f&&i>=_){o.push({...c,st:f-r,ed:_-r});continue}else f<=r&&_>=i?(o.push({...c,st:r-r,ed:i-r}),c.ed-=e):r>=f&&r<_?(o.push({...c,st:r-r,ed:_-r}),c.ed=r):i>f&&i<=_?(o.push({...c,st:f-r,ed:i-r}),c.st=i-e,c.ed-=e):f>=i&&(c.st-=e,c.ed-=e);a.push(c)}t.textRuns=a}return o.length===0&&o.push({st:0,ed:e,ts:{}}),o}function ui(t,e,n){const{paragraphs:s}=t,r=n,i=n+e,o=[];if(s){const l=[];for(let a=0,d=s.length;a<d;a++){const h=s[a],{startIndex:c}=h;if(c>=r&&c<i){o.push({...h,startIndex:c-n});continue}else c>=i&&(h.startIndex-=e);l.push(h)}t.paragraphs=l}return o}function ci(t,e,n){const{sectionBreaks:s}=t,r=n,i=n+e-1,o=[];if(s){const l=[];for(let a=0,d=s.length;a<d;a++){const h=s[a],{startIndex:c}=h;if(c>=r&&c<=i){o.push({...h,startIndex:c-n});continue}else c>i&&(h.startIndex-=e);l.push(h)}t.sectionBreaks=l}return o}function hi(t,e,n){const{customBlocks:s}=t,r=n,i=n+e-1,o=[];if(s){const l=[];for(let a=0,d=s.length;a<d;a++){const h=s[a],{startIndex:c}=h;if(c>=r&&c<=i){o.push({...h,startIndex:c-n});continue}else c>i&&(h.startIndex-=e);l.push(h)}t.customBlocks=l}return o}function di(t,e,n){const{tables:s}=t,r=n,i=n+e-1,o=[];if(s){const l=[];for(let a=0,d=s.length;a<d;a++){const h=s[a],{startIndex:c,endIndex:f}=h;if(r<=c&&i>=f){o.push({...h,startIndex:c-n,endIndex:f-n});continue}else if(c<=r&&f>=i){const _=$n(c,f,r,i);h.startIndex=_[0],h.endIndex=_[1]}else i<c&&(h.startIndex-=e,h.endIndex-=e);l.push(h)}t.tables=l}return o}function fi(t,e,n){const{customRanges:s}=t,r=n,i=n+e-1,o=[];if(s){const l=[];for(let a=0,d=s.length;a<d;a++){const h=s[a],{startIndex:c,endIndex:f}=h;if(r<=c&&i>=f){o.push({...h,startIndex:c-n,endIndex:f-n});continue}else if(c<=r&&f>=i){const _=$n(c,f,r,i);h.startIndex=_[0],h.endIndex=_[1]}else i<c&&(h.startIndex-=e,h.endIndex-=e);l.push(h)}t.customRanges=l}return o}function na(t,e,n,s,r){const i=sa(t,e,n,s,r),o=ra(t,e,n,s,r),l=ia(t,e,n,s,r),a=oa(t,e,n,s,r),d=la(t,e,n,s,r),h=aa(t,e,n,s,r);return{dataStream:"",textRuns:i,paragraphs:o,sectionBreaks:l,customBlocks:a,tables:d,customRanges:h}}function sa(t,e,n,s,r){const{textRuns:i}=t,{textRuns:o}=e;if(i==null||o==null)return;const l=ai(t,n,s);if(r!==kt.REPLACE){const a=_i(o,l,r);e.textRuns=a}return oi(t,e,n,s),l}function _i(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 d(){return a?(s.push(a),a=null,!0):!1}for(;o<r&&l<i;){const{st:_,ed:E,ts:R}=t[o],{st:H,ed:k,ts:tt,sId:mt}=e[l];let ft;if(n===kt.COVER?ft={...tt,...R}:ft={...R,...tt},E<H)d()||s.push(t[o]),o++;else if(k<_)d()||s.push(e[l]),l++;else{const C={st:Math.min(_,H),ed:Math.max(_,H),ts:_<H?{...R}:{...tt},sId:_<H?void 0:mt};C.ed>C.st&&s.push(C),s.push({st:Math.max(_,H),ed:Math.min(E,k),ts:ft,sId:mt}),E<k?(o++,e[l].st=E,e[l].st===e[l].ed&&l++):(l++,t[o].st=k,t[o].st===t[o].ed&&o++);const S={st:Math.min(E,k),ed:Math.max(E,k),ts:E<k?{...tt}:{...R},sId:E<k?mt:void 0};a=S.ed>S.st?S:null}}d();const h=s[s.length-1],c=t[r-1],f=e[i-1];return h.ed!==Math.max(c.ed,f.ed)&&(c.ed>f.ed?s.push(c):s.push(f)),ts(s)}function ra(t,e,n,s,r){const{paragraphs:i}=t,{paragraphs:o}=e;if(i==null||o==null)return;const l=ui(t,n,s);if(r!==kt.REPLACE){const a=[];for(const d of o){const{startIndex:h,paragraphStyle:c,bullet:f}=d;let _=[];for(const E of l){const{startIndex:R,paragraphStyle:H,bullet:k}=E;let tt,mt;if(r===kt.COVER?(tt={...H,...c},mt={listId:"",listType:Nn.BULLET_LIST,nestingLevel:0,textStyle:{},...k,...f}):(tt={...c,...H},mt={listId:"",listType:Nn.BULLET_LIST,nestingLevel:0,textStyle:{},...f,...k}),h===R){_.push({startIndex:h,paragraphStyle:tt,bullet:mt});break}}a.push(..._),_=[]}e.paragraphs=a}return es(t,e,n,s),l}function ia(t,e,n,s,r){const{sectionBreaks:i}=t,{sectionBreaks:o}=e;if(i==null||o==null)return;const l=ci(t,n,s);if(r!==kt.REPLACE){const a=[];for(const d of o){const{startIndex:h}=d;let c=[];for(const f of l){const{startIndex:_}=f;if(h===_){r===kt.COVER?c.push({...f,...d}):c.push({...d,...f});break}}a.push(...c),c=[]}e.sectionBreaks=a}return es(t,e,n,s),l}function oa(t,e,n,s,r){const{customBlocks:i}=t,{customBlocks:o}=e;if(i==null||o==null)return;const l=hi(t,n,s);if(r!==kt.REPLACE){const a=[];for(const d of o){const{startIndex:h}=d;let c=[];for(const f of l){const{startIndex:_}=f;if(h===_){r===kt.COVER?c.push({...f,...d}):c.push({...d,...f});break}}a.push(...c),c=[]}e.customBlocks=a}return li(t,e,n,s),l}function la(t,e,n,s,r){const{tables:i}=t,{tables:o}=e;if(i==null||o==null)return;const l=di(t,n,s);if(r!==kt.REPLACE){const a=[];for(const d of o){const{startIndex:h,endIndex:c}=d;let f=[];for(const _ of l){const{startIndex:E,endIndex:R}=_;if(E>=h&&R<=c){r===kt.COVER?f.push({..._,...d}):f.push({...d,..._});break}}a.push(...f),f=[]}e.tables=a}return ns(t,e,n,s),l}function aa(t,e,n,s,r){const{customRanges:i}=t,{tables:o}=e;if(i==null||o==null)return;const l=fi(t,n,s);if(r!==kt.REPLACE){const a=[];for(const d of o){const{startIndex:h,endIndex:c}=d;let f=[];for(const _ of l){const{startIndex:E,endIndex:R}=_;if(E>=h&&R<=c){r===kt.COVER?f.push({..._,...d}):f.push({...d,..._});break}}a.push(...f),f=[]}e.customRanges=a}return ns(t,e,n,s),l}function Xe(t,e,n,s=!1){const{dataStream:r,textRuns:i=[],paragraphs:o=[]}=t,l={dataStream:r.slice(e,n)},a=[];for(const h of i){const c=y.deepClone(h),{st:f,ed:_}=c;y.hasIntersectionBetweenTwoRanges(f,_,e,n)&&(e>=f&&e<=_?a.push({...c,st:e,ed:Math.min(n,_)}):n>=f&&n<=_?a.push({...c,st:Math.max(e,f),ed:n}):a.push(c))}a.length?l.textRuns=a.map(h=>{const{st:c,ed:f}=h;return{...h,st:c-e,ed:f-e}}):s&&(l.textRuns=[{st:0,ed:n-e,ts:{}}]);const d=[];for(const h of o){const{startIndex:c}=h;c>=e&&c<=n&&d.push(y.deepClone(h))}return d.length&&(l.paragraphs=d.map(h=>({...h,startIndex:h.startIndex-e}))),l}function ss(t,e,n=kt.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=_i(o,r,n);a.length&&(s.textRuns=a);const d=[];let h=0,c=0;for(;h<i.length&&c<l.length;){const f=i[h],_=l[c],{startIndex:E}=f,{startIndex:R}=_;E===R?(d.push(y.deepMerge(f,_)),h++,c++):E<R?(d.push(y.deepClone(f)),h++):(d.push(y.deepClone(_)),c++)}return h<i.length&&d.push(...i.slice(h)),c<l.length&&d.push(...l.slice(c)),d.length&&(s.paragraphs=d),s}function ua(t){const{body:e}=t;if(e==null)return!0;const{textRuns:n=[],paragraphs:s=[]}=e;return n.length===0&&s.length===0}function ca(t=y.generateRandomId(6),e=pe.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 $t=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ha(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Gt={},gi={},rs={};Object.defineProperty(rs,"__esModule",{value:!0});function da(t,e){if(Array.isArray(e))return!1;for(let n in t)if(!is(t[n],e[n]))return!1;for(let n in e)if(t[n]===void 0)return!1;return!0}function fa(t,e){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!is(t[n],e[n]))return!1;return!0}function is(t,e){return t===e?!0:t===null||e===null||typeof t!="object"||typeof e!="object"?!1:Array.isArray(t)?fa(t,e):da(t,e)}rs.default=is;var os={};Object.defineProperty(os,"__esModule",{value:!0});function ls(t){if(t===null)return null;if(Array.isArray(t))return t.map(ls);if(typeof t=="object"){const e={};for(let n in t)e[n]=ls(t[n]);return e}else return t}os.default=ls;var as={};(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(h,c){if(!h)throw new Error(c)}const n=h=>h!=null&&typeof h=="object"&&!Array.isArray(h),s=(h,c)=>typeof h==typeof c?h>c:typeof h=="string"&&typeof c=="number";function r(h,c){for(let f in h){const _=f;c.write(_,h[_])}}t.isValidPathItem=h=>typeof h=="number"||typeof h=="string"&&h!=="__proto__";class i{constructor(c=null){this.parents=[],this.indexes=[],this.lcIdx=-1,this.idx=-1,this.container=c}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 c=[];let f=this.container,_=this.parents.length-1,E=this.idx;for(;E>=0;)c.unshift(f[E]),E===0?(E=this.indexes[_*2],f=this.parents[_--]):E-=n(f[E-1])?2:1;return c}}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 c;return this.container&&this.container.length>this.idx+1&&n(c=this.container[this.idx+1])?c:null}descendFirst(){let c=this.idx+1;if(!this.container||c>=this.container.length||n(this.container[c])&&c+1>=this.container.length)return!1;n(this.container[c])&&c++;const f=this.container[c];return Array.isArray(f)?(this.indexes.push(this.idx),this.parents.push(this.container),this.indexes.push(c),this.idx=0,this.container=f):this.idx=c,!0}nextSibling(){if(e(this.parents.length===this.indexes.length/2),this.idx>0||this.parents.length===0)return!1;const c=this.indexes[this.indexes.length-1]+1,f=this.parents[this.parents.length-1];return c>=f.length?!1:(e(!isNaN(c)),this.indexes[this.indexes.length-1]=c,this.container=f[c],!0)}_init(c,f,_,E){this.container=c,this.idx=f,this.parents=_.slice(),this.indexes=E.slice()}clone(){const c=new o;return c._init(this.container,this.idx,this.parents,this.indexes),c}*[Symbol.iterator](){if(this.descendFirst()){do yield this.getKey();while(this.nextSibling());this.ascend()}}traverse(c,f){const _=this.getComponent();_&&f(_,c);for(const E of this)c&&c.descend(E),this.traverse(c,f),c&&c.ascend()}eachPick(c,f){this.traverse(c,(_,E)=>{_.p!=null&&f(_.p,E)})}eachDrop(c,f){this.traverse(c,(_,E)=>{_.d!=null&&f(_.d,E)})}}t.ReadCursor=o;class l extends i{constructor(c=null){super(c),this.pendingDescent=[],this._op=c}flushDescent(){e(this.parents.length===this.indexes.length/2),this.container===null&&(this._op=this.container=[]);for(let c=0;c<this.pendingDescent.length;c++){const f=this.pendingDescent[c];let _=this.idx+1;if(_<this.container.length&&n(this.container[_])&&_++,e(_===this.container.length||!n(this.container[_])),_===this.container.length)this.container.push(f),this.idx=_;else if(this.container[_]===f)this.idx=_;else{if(!Array.isArray(this.container[_])){const E=this.container.splice(_,this.container.length-_);this.container.push(E),this.lcIdx>-1&&(this.lcIdx=_)}for(this.indexes.push(this.idx),this.parents.push(this.container),this.lcIdx!==-1&&(e(s(f,this.container[this.lcIdx][0])),_=this.lcIdx+1,this.lcIdx=-1);_<this.container.length&&s(f,this.container[_][0]);)_++;if(this.indexes.push(_),this.idx=0,_<this.container.length&&this.container[_][0]===f)this.container=this.container[_];else{const E=[f];this.container.splice(_,0,E),this.container=E}}}this.pendingDescent.length=0}reset(){this.lcIdx=-1}getComponent(){this.flushDescent();const c=this.idx+1;if(c<this.container.length&&n(this.container[c]))return this.container[c];{const f={};return this.container.splice(c,0,f),f}}write(c,f){const _=this.getComponent();e(_[c]==null||_[c]===f,"Internal consistency error: Overwritten component. File a bug"),_[c]=f}get(){return this._op}descend(c){if(!t.isValidPathItem(c))throw Error("Invalid JSON key");this.pendingDescent.push(c)}descendPath(c){return this.pendingDescent.push(...c),this}ascend(){this.pendingDescent.length?this.pendingDescent.pop():super.ascend()}mergeTree(c,f=r){if(c===null)return;if(e(Array.isArray(c)),c===this._op)throw Error("Cannot merge into my own tree");const _=this.lcIdx,E=this.parents.length;let R=0;for(let H=0;H<c.length;H++){const k=c[H];typeof k=="string"||typeof k=="number"?(R++,this.descend(k)):Array.isArray(k)?this.mergeTree(k,f):typeof k=="object"&&f(k,this)}for(;R--;)this.ascend();this.lcIdx=this.parents.length===E?_:-1}at(c,f){this.descendPath(c),f(this);for(let _=0;_<c.length;_++)this.ascend();return this}writeAtPath(c,f,_){return this.at(c,()=>this.write(f,_)),this.reset(),this}writeMove(c,f,_=0){return this.writeAtPath(c,"p",_).writeAtPath(f,"d",_)}getPath(){const c=super.getPath();return c.push(...this.pendingDescent),c}}t.WriteCursor=l,t.writeCursor=()=>new l,t.readCursor=h=>new o(h);function a(h,c,f){let _,E;E=_=h?h.descendFirst():!1;function R(H){let k;for(;E;){const tt=k=h.getKey();if(H!=null){let mt=!1;if(c&&typeof tt=="number"&&(k=c(tt,h.getComponent()),k<0&&(k=~k,mt=!0)),s(k,H))return null;if(k===H&&!mt)return h}f&&typeof k=="number"&&f(k,h.getComponent()),E=h.nextSibling()}return null}return R.end=()=>{_&&h.ascend()},R}t.advancer=a;function d(h,c,f){let _,E,R,H;for(_=E=h&&h.descendFirst(),R=H=c&&c.descendFirst();_||R;){let k=_?h.getKey():null,tt=R?c.getKey():null;k!==null&&tt!==null&&(s(tt,k)?tt=null:k!==tt&&(k=null)),f(k==null?tt:k,k!=null?h:null,tt!=null?c:null),k!=null&&_&&(_=h.nextSibling()),tt!=null&&R&&(R=c.nextSibling())}E&&h.ascend(),H&&c.ascend()}t.eachChildOf=d})(as);var us={};(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={}))})(us);var cs={},Ne={},mi;function hs(){return mi||(mi=1,Object.defineProperty(Ne,"__esModule",{value:!0}),Ne.uniToStrPos=Ne.strPosToUni=void 0,Ne.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},Ne.uniToStrPos=(t,e)=>{let n=0;for(;e>0;e--){const s=t.charCodeAt(n);n+=s>=55296&&s<=57343?2:1}return n}),Ne}var ds={},Ei;function fs(){return Ei||(Ei=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.uniSlice=t.dlen=t.eachOp=void 0;const e=hs(),n=C=>{if(!Array.isArray(C))throw Error("Op must be an array of components");let S=null;for(let w=0;w<C.length;w++){const X=C[w];switch(typeof X){case"object":if(typeof X.d!="number"&&typeof X.d!="string")throw Error("Delete must be number or string");if(t.dlen(X.d)<=0)throw Error("Deletes must not be empty");break;case"string":if(!(X.length>0))throw Error("Inserts cannot be empty");break;case"number":if(!(X>0))throw Error("Skip components must be >0");if(typeof S=="number")throw Error("Adjacent skip components should be combined");break}S=X}if(typeof S=="number")throw Error("Op has a trailing skip")};function s(C,S){let w=0,X=0;for(let st=0;st<C.length;st++){const q=C[st];switch(S(q,w,X),typeof q){case"object":w+=t.dlen(q.d);break;case"string":X+=e.strPosToUni(q);break;case"number":w+=q,X+=q;break}}}t.eachOp=s;function r(C,S){const w=[],X=l(w);return s(C,(st,q,Yt)=>{X(S(st,q,Yt))}),c(w)}const i=C=>C,o=C=>r(C,i);t.dlen=C=>typeof C=="number"?C:e.strPosToUni(C);const l=C=>S=>{if(!(!S||S.d===0||S.d===""))if(C.length===0)C.push(S);else if(typeof S==typeof C[C.length-1])if(typeof S=="object"){const w=C[C.length-1];w.d=typeof w.d=="string"&&typeof S.d=="string"?w.d+S.d:t.dlen(w.d)+t.dlen(S.d)}else C[C.length-1]+=S;else C.push(S)},a=C=>typeof C=="number"?C:typeof C=="string"?e.strPosToUni(C):typeof C.d=="number"?C.d:e.strPosToUni(C.d);t.uniSlice=(C,S,w)=>{const X=e.uniToStrPos(C,S),st=w==null?1/0:e.uniToStrPos(C,w);return C.slice(X,st)};const d=(C,S,w)=>typeof C=="number"?w==null?C-S:Math.min(C,w)-S:t.uniSlice(C,S,w),h=C=>{let S=0,w=0;return{take:(q,Yt)=>{if(S===C.length)return q===-1?null:q;const vt=C[S];let _t;if(typeof vt=="number")return q===-1||vt-w<=q?(_t=vt-w,++S,w=0,_t):(w+=q,q);if(typeof vt=="string"){if(q===-1||Yt==="i"||e.strPosToUni(vt.slice(w))<=q)return _t=vt.slice(w),++S,w=0,_t;{const Ot=w+e.uniToStrPos(vt.slice(w),q);return _t=vt.slice(w,Ot),w=Ot,_t}}else{if(q===-1||Yt==="d"||t.dlen(vt.d)-w<=q)return _t={d:d(vt.d,w)},++S,w=0,_t;{let Ot=d(vt.d,w,w+q);return w+=q,{d:Ot}}}},peek:()=>C[S]}},c=C=>(C.length>0&&typeof C[C.length-1]=="number"&&C.pop(),C);function f(C,S,w){if(w!=="left"&&w!=="right")throw Error("side ("+w+") must be 'left' or 'right'");n(C),n(S);const X=[],st=l(X),{take:q,peek:Yt}=h(C);for(let _t=0;_t<S.length;_t++){const Ot=S[_t];let Ut,zt;switch(typeof Ot){case"number":for(Ut=Ot;Ut>0;)zt=q(Ut,"i"),st(zt),typeof zt!="string"&&(Ut-=a(zt));break;case"string":w==="left"&&typeof Yt()=="string"&&st(q(-1)),st(e.strPosToUni(Ot));break;case"object":for(Ut=t.dlen(Ot.d);Ut>0;)switch(zt=q(Ut,"i"),typeof zt){case"number":Ut-=zt;break;case"string":st(zt);break;case"object":Ut-=t.dlen(zt.d)}break}}let vt;for(;vt=q(-1);)st(vt);return c(X)}function _(C,S){n(C),n(S);const w=[],X=l(w),{take:st}=h(C);for(let Yt=0;Yt<S.length;Yt++){const vt=S[Yt];let _t,Ot;switch(typeof vt){case"number":for(_t=vt;_t>0;)Ot=st(_t,"d"),X(Ot),typeof Ot!="object"&&(_t-=a(Ot));break;case"string":X(vt);break;case"object":_t=t.dlen(vt.d);let Ut=0;for(;Ut<_t;)switch(Ot=st(_t-Ut,"d"),typeof Ot){case"number":X({d:d(vt.d,Ut,Ut+Ot)}),Ut+=Ot;break;case"string":Ut+=e.strPosToUni(Ot);break;case"object":X(Ot)}break}}let q;for(;q=st(-1);)X(q);return c(w)}const E=(C,S)=>{let w=0;for(let X=0;X<S.length&&C>w;X++){const st=S[X];switch(typeof st){case"number":{w+=st;break}case"string":const q=e.strPosToUni(st);w+=q,C+=q;break;case"object":C-=Math.min(t.dlen(st.d),C-w);break}}return C},R=(C,S)=>typeof C=="number"?E(C,S):C.map(w=>E(w,S));function H(C,S,w){return r(C,(X,st)=>typeof X=="object"&&typeof X.d=="number"?{d:w.slice(S,st,st+X.d)}:X)}function k(C){return r(C,S=>{switch(typeof S){case"object":if(typeof S.d=="number")throw Error("Cannot invert text op: Deleted characters missing from operation. makeInvertible must be called first.");return S.d;case"string":return{d:S};case"number":return S}})}function tt(C){return r(C,S=>typeof S=="object"&&typeof S.d=="string"?{d:e.strPosToUni(S.d)}:S)}function mt(C){let S=!0;return s(C,w=>{typeof w=="object"&&typeof w.d=="number"&&(S=!1)}),S}function ft(C){return{name:"text-unicode",uri:"http://sharejs.org/types/text-unicode",trim:c,normalize:o,checkOp:n,create(S=""){if(typeof S!="string")throw Error("Initial data must be a string");return C.create(S)},apply(S,w){n(w);const X=C.builder(S);for(let st=0;st<w.length;st++){const q=w[st];switch(typeof q){case"number":X.skip(q);break;case"string":X.append(q);break;case"object":X.del(t.dlen(q.d));break}}return X.build()},transform:f,compose:_,transformPosition:E,transformSelection:R,isInvertible:mt,makeInvertible(S,w){return H(S,w,C)},stripInvertible:tt,invert:k,invertWithDoc(S,w){return k(H(S,w,C))},isNoop:S=>S.length===0}}t.default=ft}(ds)),ds}var bn={},Ri;function _a(){if(Ri)return bn;Ri=1,Object.defineProperty(bn,"__esModule",{value:!0});const t=fs(),e=hs();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 d=t.dlen(o.d);this.onRemove&&this.onRemove(a,d)}})},onInsert:null,onRemove:null}}return bn.default=n,n.provides={text:!0},bn}var Ci;function ga(){return Ci||(Ci=1,function(t){var e=$t&&$t.__createBinding||(Object.create?function(f,_,E,R){R===void 0&&(R=E),Object.defineProperty(f,R,{enumerable:!0,get:function(){return _[E]}})}:function(f,_,E,R){R===void 0&&(R=E),f[R]=_[E]}),n=$t&&$t.__setModuleDefault||(Object.create?function(f,_){Object.defineProperty(f,"default",{enumerable:!0,value:_})}:function(f,_){f.default=_}),s=$t&&$t.__importStar||function(f){if(f&&f.__esModule)return f;var _={};if(f!=null)for(var E in f)Object.hasOwnProperty.call(f,E)&&e(_,f,E);return n(_,f),_},r=$t&&$t.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};Object.defineProperty(t,"__esModule",{value:!0}),t.type=t.remove=t.insert=void 0;const i=hs(),o=s(fs()),l=r(_a()),a={create(f){return f},toString(f){return f},builder(f){if(typeof f!="string")throw Error("Invalid document snapshot: "+f);const _=[];return{skip(E){let R=i.uniToStrPos(f,E);if(R>f.length)throw Error("The op is too long for this document");_.push(f.slice(0,R)),f=f.slice(R)},append(E){_.push(E)},del(E){f=f.slice(i.uniToStrPos(f,E))},build(){return _.join("")+f}}},slice:o.uniSlice},d=o.default(a),h=Object.assign(Object.assign({},d),{api:l.default});t.type=h,t.insert=(f,_)=>_.length===0?[]:f===0?[_]:[f,_],t.remove=(f,_)=>o.dlen(_)===0?[]:f===0?[{d:_}]:[f,{d:_}];var c=fs();Object.defineProperty(t,"makeType",{enumerable:!0,get:function(){return c.default}})}(cs)),cs}(function(t){var e=$t&&$t.__importDefault||function(m){return m&&m.__esModule?m:{default:m}};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(os),r=as,i=us;function o(m,p){if(!m)throw new Error(p)}t.type={name:"json1",uri:"http://sharejs.org/types/JSONv1",readCursor:r.readCursor,writeCursor:r.writeCursor,create:m=>m,isNoop:m=>m==null,setDebug(m){},registerSubtype:k,checkValidOp:st,normalize:q,apply:Yt,transformPosition:vt,compose:_t,tryTransform:Ms,transform:Xu,makeInvertible:zt,invert:Ot,invertWithDoc:zu,RM_UNEXPECTED_CONTENT:i.ConflictType.RM_UNEXPECTED_CONTENT,DROP_COLLISION:i.ConflictType.DROP_COLLISION,BLACKHOLE:i.ConflictType.BLACKHOLE,transformNoConflict:(m,p,b)=>mo(()=>!0,m,p,b),typeAllowingConflictsPred:m=>Object.assign(Object.assign({},t.type),{transform:(p,b,U)=>mo(m,p,b,U)})};const l=m=>m?m.getComponent():null;function a(m){return m&&typeof m=="object"&&!Array.isArray(m)}const d=m=>Array.isArray(m)?m.slice():m!==null&&typeof m=="object"?Object.assign({},m):m,h=m=>m&&(m.p!=null||m.r!==void 0),c=m=>m&&(m.d!=null||m.i!==void 0);function f(m,p){return o(m!=null),typeof p=="number"?(o(Array.isArray(m),"Invalid key - child is not an array"),(m=m.slice()).splice(p,1)):(o(a(m),"Invalid key - child is not an object"),delete(m=Object.assign({},m))[p]),m}function _(m,p,b){return typeof p=="number"?(o(m!=null,"Container is missing for key"),o(Array.isArray(m),"Cannot use numerical key for object container"),o(m.length>=p,"Cannot insert into out of bounds index"),m.splice(p,0,b)):(o(a(m),"Cannot insert into missing item"),o(m[p]===void 0,"Trying to overwrite value at key. Your op needs to remove it first"),m[p]=b),b}t.removeOp=(m,p=!0)=>r.writeCursor().writeAtPath(m,"r",p).get(),t.moveOp=(m,p)=>r.writeCursor().writeMove(m,p).get(),t.insertOp=(m,p)=>r.writeCursor().writeAtPath(m,"i",p).get(),t.replaceOp=(m,p,b)=>r.writeCursor().at(m,U=>{U.write("r",p),U.write("i",b)}).get(),t.editOp=(m,p,b,U=!1)=>r.writeCursor().at(m,v=>S(v,p,b,U)).get();const E=(m,p)=>m!=null&&(typeof p=="number"?Array.isArray(m):typeof m=="object"),R=(m,p)=>E(m,p)?m[p]:void 0,H={};function k(m){let p=m.type?m.type:m;p.name&&(H[p.name]=p),p.uri&&(H[p.uri]=p)}const tt=m=>{const p=H[m];if(p)return p;throw Error("Missing type: "+m)};k(ga());const mt=(m,p)=>m+p;k({name:"number",apply:mt,compose:mt,invert:m=>-m,transform:m=>m});const ft=m=>m==null?null:m.et?tt(m.et):m.es?H["text-unicode"]:m.ena!=null?H.number:null,C=m=>m.es?m.es:m.ena!=null?m.ena:m.e,S=(m,p,b,U=!1)=>{const[v,M]=typeof p=="string"?[tt(p),p]:[p,p.name];!U&&v.isNoop&&v.isNoop(b)||(M==="number"?m.write("ena",b):M==="text-unicode"?m.write("es",b):(m.write("et",M),m.write("e",b)))};function w(m){o(typeof m=="number"),o(m>=0),o(m===(0|m))}function X(m){typeof m=="number"?w(m):o(typeof m=="string")}function st(m){if(m===null)return;const p=new Set,b=new Set,U=M=>{let j=!0,G=!1;for(let I in M){const N=M[I];if(j=!1,o(I==="p"||I==="r"||I==="d"||I==="i"||I==="e"||I==="es"||I==="ena"||I==="et","Invalid component item '"+I+"'"),I==="p")w(N),o(!p.has(N)),p.add(N),o(M.r===void 0);else if(I==="d")w(N),o(!b.has(N)),b.add(N),o(M.i===void 0);else if(I==="e"||I==="es"||I==="ena"){o(!G),G=!0;const A=ft(M);o(A,"Missing type in edit"),A.checkValidOp&&A.checkValidOp(C(M))}}o(!j)},v=(M,j,G)=>{if(!Array.isArray(M))throw Error("Op must be null or a list");if(M.length===0)throw Error("Empty descent");j||X(M[0]);let I=1,N=0,A=0;for(let T=0;T<M.length;T++){const V=M[T];if(o(V!=null),Array.isArray(V)){const K=v(V,!1);if(N){const O=typeof A,B=typeof K;O===B?o(A<K,"descent keys are not in order"):o(O==="number"&&B==="string")}A=K,N++,I=3}else typeof V=="object"?(o(I===1,`Prev not scalar - instead ${I}`),U(V),I=2):(o(I!==3),X(V),o(r.isValidPathItem(V),"Invalid path key"),I=1)}return o(N!==1,"Operation makes multiple descents. Remove some []"),o(I===2||I===3),M[0]};v(m,!0),o(p.size===b.size,"Mismatched picks and drops in op");for(let M=0;M<p.size;M++)o(p.has(M)),o(b.has(M))}function q(m){let p=0,b=[];const U=r.writeCursor();return U.mergeTree(m,(v,M)=>{const j=ft(v);if(j){const I=C(v);S(M,j,j.normalize?j.normalize(I):I)}for(const I of["r","p","i","d"])if(v[I]!==void 0){const N=I==="p"||I==="d"?(G=v[I],b[G]==null&&(b[G]=p++),b[G]):v[I];M.write(I,N)}var G}),U.get()}function Yt(m,p){if(st(p),p===null)return m;const b=[];return function U(v,M){let j=v,G=0,I={root:v},N=0,A=I,T="root";function V(){for(;N<G;N++){let K=M[N];typeof K!="object"&&(o(E(A,T)),A=A[T]=d(A[T]),T=K)}}for(;G<M.length;G++){const K=M[G];if(Array.isArray(K)){const O=U(j,K);O!==j&&O!==void 0&&(V(),j=A[T]=O)}else if(typeof K=="object"){K.d!=null?(V(),j=_(A,T,b[K.d])):K.i!==void 0&&(V(),j=_(A,T,K.i));const O=ft(K);if(O)V(),j=A[T]=O.apply(j,C(K));else if(K.e!==void 0)throw Error("Subtype "+K.et+" undefined")}else j=R(j,K)}return I.root}(m=function U(v,M){const j=[];let G=0;for(;G<M.length;G++){const T=M[G];if(Array.isArray(T))break;typeof T!="object"&&(j.push(v),v=R(v,T))}for(let T=M.length-1;T>=G;T--)v=U(v,M[T]);for(--G;G>=0;G--){const T=M[G];if(typeof T!="object"){const V=j.pop();v=v===R(V,T)?V:v===void 0?f(V,T):(N=T,A=v,(I=d(I=V))[N]=A,I)}else h(T)&&(o(v!==void 0,"Cannot pick up or remove undefined"),T.p!=null&&(b[T.p]=v),v=void 0)}var I,N,A;return v}(m,p),p)}function vt(m,p){m=m.slice(),st(p);const b=r.readCursor(p);let U,v,M=!1;const j=[];for(let I=0;;I++){const N=m[I],A=b.getComponent();if(A&&(A.r!==void 0?M=!0:A.p!=null&&(M=!1,U=A.p,v=I)),I>=m.length)break;let T=0;const V=r.advancer(b,void 0,(O,B)=>{h(B)&&T++});j.unshift(V);const K=V(N);if(typeof N=="number"&&(m[I]-=T),!K)break}if(j.forEach(I=>I.end()),M)return null;const G=()=>{let I=0;if(U!=null){const N=b.getPath();I=N.length,m=N.concat(m.slice(v))}for(;I<m.length;I++){const N=m[I],A=l(b),T=ft(A);if(T){const O=C(A);T.transformPosition&&(m[I]=T.transformPosition(m[I],O));break}let V=0;const K=r.advancer(b,(O,B)=>c(B)?~(O-V):O-V,(O,B)=>{c(B)&&V++})(N);if(typeof N=="number"&&(m[I]+=V),!K)break}};return U!=null?b.eachDrop(null,I=>{I===U&&G()}):G(),m}function _t(m,p){if(st(m),st(p),m==null)return p;if(p==null)return m;let b=0;const U=r.readCursor(m),v=r.readCursor(p),M=r.writeCursor(),j=[],G=[],I=[],N=[],A=[],T=[],V=new Set;U.traverse(null,O=>{O.p!=null&&(I[O.p]=U.clone())}),v.traverse(null,O=>{O.d!=null&&(N[O.d]=v.clone())});const K=r.writeCursor();return function O(B,gt,ct,J,Rt,ae,Ht,Lt){o(gt||ct);const Ct=l(gt),Xt=l(ct),Qt=!!Xt&&Xt.r!==void 0,Ae=!!Ct&&Ct.i!==void 0,qt=Ct?Ct.d:null,Vt=Xt?Xt.p:null,ue=(ae||Qt)&&Vt==null;if(Vt!=null)J=N[Vt],Ht=G[Vt]=new r.WriteCursor;else if(Xt&&Xt.r!==void 0)J=null;else{const D=l(J);D&&D.d!=null&&(J=null)}const lt=l(J);if(qt!=null)if(B=I[qt],Lt=j[qt]=new r.WriteCursor,ue)ae&&!Qt&&Lt.write("r",!0);else{const D=A[qt]=b++;Ht.write("d",D)}else if(Ct&&Ct.i!==void 0)B=null;else{const D=l(B);D&&D.p!=null&&(B=null)}let P;Ae?(o(Rt===void 0),P=Ct.i):P=Rt;const Y=(Vt==null?!Ae||ae||Qt:P===void 0)?null:Ht.getComponent();if(Vt!=null){if(!(Rt!==void 0||Ae)){const D=qt!=null?A[qt]:b++;T[Vt]=D,Lt.write("p",D)}}else Qt&&(Ae||Rt!==void 0||(Xt.r,Lt.write("r",Xt.r)));const F=ue?null:ft(Ct),L=ft(lt);if((F||L)&&(F&&F.name,L&&L.name),F&&L){o(F===L);const D=C(Ct),z=C(lt),Tt=F.compose(D,z);S(Ht,F,Tt),V.add(lt)}else F?S(Ht,F,C(Ct)):L&&(S(Ht,L,C(lt)),V.add(lt));const W=typeof P=="object"&&P!=null;let rt=!1,it=0,at=0,wt=0,At=0,pt=0;const Pt=r.advancer(J,(D,z)=>c(z)?At-D-1:D-At,(D,z)=>{c(z)&&At++}),et=r.advancer(B,(D,z)=>h(z)?it-D-1:D-it,(D,z)=>{h(z)&&it++});if(r.eachChildOf(gt,ct,(D,z,Tt)=>{let Ft,ce,we=D,te=D,sn=D;if(typeof D=="number"){let Dt=D+wt;ce=Pt(Dt),te=Dt+At;let St=D+at;Ft=et(St),c(l(ce))&&(Ft=null),we=St+it,sn=D+pt,o(we>=0,"p1PickKey is negative"),o(te>=0,"p2DropKey is negative");const ee=c(l(z)),he=h(l(Tt));(ee||he&&!ue)&&pt--,ee&&at--,he&&wt--}else Ft=et(D),ce=Pt(D);Lt.descend(we),Ht.descend(te);const Fe=W&&!c(l(z))?P[sn]:void 0,re=O(Ft,z,Tt,ce,Fe,ue,Ht,Lt);var ie,$,Et;W&&!ue?Fe!==re&&(rt||(P=Array.isArray(P)?P.slice():Object.assign({},P),rt=!0),ie=P,Et=re,typeof($=sn)=="number"?(o(Array.isArray(ie)),o($<ie.length)):(o(!Array.isArray(ie)),o(ie[$]!==void 0)),Et===void 0?typeof $=="number"?ie.splice($,1):delete ie[$]:ie[$]=Et):o(re===void 0),Ht.ascend(),Lt.ascend()}),et.end(),Pt.end(),Y!=null)Y.i=P;else if(!ae&&!Qt&&Vt==null)return P}(U,U.clone(),v,v.clone(),void 0,!1,M,K),M.reset(),M.mergeTree(K.get()),M.reset(),M.get(),j.map(O=>O.get()),G.map(O=>O.get()),U.traverse(M,(O,B)=>{const gt=O.p;if(gt!=null){const ct=A[gt];ct!=null&&B.write("p",ct);const J=j[gt];J&&J.get(),J&&B.mergeTree(J.get())}else O.r!==void 0&&B.write("r",O.r)}),M.reset(),M.get(),v.traverse(M,(O,B)=>{const gt=O.d;if(gt!=null){const J=T[gt];J!=null&&B.write("d",J);const Rt=G[gt];Rt&&B.mergeTree(Rt.get())}else O.i!==void 0&&B.write("i",O.i);const ct=ft(O);ct&&!V.has(O)&&S(B,ct,C(O))}),M.get()}function Ot(m){if(m==null)return null;const p=new r.ReadCursor(m),b=new r.WriteCursor;let U;const v=[],M=[];return function j(G,I,N){const A=G.getComponent();let T,V=!1;if(A){A.p!=null&&(I.write("d",A.p),v[A.p]=G.clone()),A.r!==void 0&&I.write("i",A.r),A.d!=null&&(I.write("p",A.d),N=void 0),A.i!==void 0&&(N=T=A.i);const O=ft(A);O&&(N===void 0?(U||(U=new Set),U.add(A)):(C(A),N=O.apply(N,C(A)),V=!0))}let K=0;for(const O of G){I.descend(O);const B=typeof O=="number"?O-K:O,gt=R(N,B);c(G.getComponent())&&K++;const ct=j(G,I,gt);if(N!==void 0&&ct!==void 0){if(V||(V=!0,N=d(N)),!E(N,B))throw Error("Cannot modify child - invalid operation");N[B]=ct}I.ascend()}if(T===void 0)return V?N:void 0;I.write("r",N)}(p,b,void 0),U&&(b.reset(),function j(G,I,N){const A=I.getComponent();if(A){const O=A.d;if(O!=null&&(G=v[O],N=M[O]=r.writeCursor()),U.has(A)){const B=ft(A);if(!B.invert)throw Error(`Cannot invert subtype ${B.name}`);S(N,B,B.invert(C(A)))}}let T=0,V=0;const K=r.advancer(G,(O,B)=>h(B)?T-O-1:O-T,(O,B)=>{h(B)&&T++});for(const O of I)if(typeof O=="number"){const B=O-V,gt=K(B),ct=B+T;N.descend(ct),j(gt,I,N),c(I.getComponent())&&V++,N.ascend()}else N.descend(O),j(K(O),I,N),N.ascend();K.end()}(p.clone(),p,b),M.length&&(b.reset(),p.traverse(b,(j,G)=>{const I=j.p;if(I!=null){const N=M[I];N&&N.get(),N&&G.mergeTree(N.get())}}))),b.get()}const Ut=(m,p)=>m.some(b=>typeof b=="object"&&(Array.isArray(b)?Ut(b,p):p(b)));function zt(m,p){if(m==null||!Ut(m,I=>{var N;return I.r!==void 0||((N=ft(I))===null||N===void 0?void 0:N.makeInvertible)!=null}))return m;const b=new r.ReadCursor(m),U=new r.WriteCursor;let v=!1;const M=[],j=[],G=(I,N,A)=>{const T=I.getComponent();let V=!1;if(T){T.d!=null&&N.write("d",T.d),T.i!==void 0&&N.write("i",T.i);const O=T.p;if(O!=null&&(M[O]=I.clone(),o(A!==void 0,"Operation picks up at an invalid key"),j[O]=A,N.write("p",T.p)),T.r!==void 0&&A===void 0)throw Error("Invalid doc / op in makeInvertible: removed item missing from doc");const B=ft(T);B&&(B.makeInvertible?v=!0:S(N,B,C(T),!0))}let K=0;for(const O of I){N.descend(O);const B=typeof O=="number"?O-K:O,gt=R(A,B),ct=G(I,N,gt);gt!==ct&&(V||(V=!0,A=d(A)),ct===void 0?(A=f(A,B),typeof O=="number"&&K++):A[B]=ct),N.ascend()}return T&&(T.r!==void 0?(N.write("r",s.default(A)),A=void 0):T.p!=null&&(A=void 0)),A};return G(b,U,p),U.get(),v&&(U.reset(),function I(N,A,T,V,K){const O=A.getComponent();if(O){O.i!==void 0?(V=O.i,K=!0):O.d!=null&&(V=j[O.d],N=M[O.d],K=!1,O.d);let J=ft(O);if(J&&J.makeInvertible){const Rt=C(O);S(T,J,J.makeInvertible(Rt,V),!0)}}let B=0,gt=0;const ct=r.advancer(N,(J,Rt)=>h(Rt)?B-J-1:J-B,(J,Rt)=>{h(Rt)&&B++});for(const J of A)if(typeof J=="number"){const Rt=J-gt,ae=ct(Rt),Ht=Rt+B,Lt=R(V,K?Rt:Ht);T.descend(J),I(ae,A,T,Lt,K),c(A.getComponent())&>++,T.ascend()}else{const Rt=R(V,J);T.descend(J),I(ct(J),A,T,Rt,K),T.ascend()}ct.end()}(b.clone(),b,U,p,!1)),U.get()}function zu(m,p){return Ot(zt(m,p))}const Ts=m=>{if(m==null)return null;const p=m.slice();for(let b=0;b<m.length;b++){const U=p[b];Array.isArray(U)&&(p[b]=Ts(U))}return p};function Ms(m,p,b){o(b==="left"||b==="right","Direction must be left or right");const U=b==="left"?0:1;if(p==null)return{ok:!0,result:m};st(m),st(p);let v=null;const M=[],j=[],G=[],I=[],N=[],A=[],T=[],V=[],K=[],O=[],B=[],gt=[],ct=[],J=[],Rt=[];let ae=0;const Ht=r.readCursor(m),Lt=r.readCursor(p),Ct=r.writeCursor();if(function lt(P,Y=null,F){const L=l(Y);L&&(L.r!==void 0?F=Y.clone():L.p!=null&&(F=null,A[L.p]=P.clone()));const W=P.getComponent();let rt;W&&(rt=W.p)!=null&&(N[rt]=Y?Y.clone():null,G[rt]=P.clone(),F&&(O[rt]=!0,K[rt]=F),L&&L.p!=null&&(J[rt]=L.p));const it=r.advancer(Y);for(const at of P)lt(P,it(at),F);it.end()}(Lt,Ht,null),function lt(P,Y,F,L,W){const rt=F.getComponent();let it,at=!1;rt&&((it=rt.d)!=null?(I[it]=F.clone(),L!=null&&(Rt[L]==null&&(Rt[L]=[]),Rt[L].push(it)),P=N[it]||null,Y=G[it]||null,O[it]?(W&&(B[it]=!0),W=K[it]||null):!W||U!==1&&J[it]!=null||v==null&&(v={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:t.removeOp(W.getPath()),op2:t.moveOp(Y.getPath(),F.getPath())}),at=!0):rt.i!==void 0&&(P=Y=null,at=!0,W&&v==null&&(v={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:t.removeOp(W.getPath()),op2:t.insertOp(F.getPath(),rt.i)})));const wt=l(P);wt&&(wt.r!==void 0?W=P.clone():wt.p!=null&&(wt.p,L=wt.p,W=null));const At=ft(rt);At&&W&&v==null&&(v={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:t.removeOp(W.getPath()),op2:t.editOp(F.getPath(),At,C(rt),!0)});let pt=0,Pt=0;const et=r.advancer(Y,(z,Tt)=>h(Tt)?pt-z-1:z-pt,(z,Tt)=>{h(Tt)&&pt++}),D=r.advancer(P);for(const z of F)if(typeof z=="number"){const Tt=z-Pt,Ft=et(Tt);Pt+=+lt(D(Tt+pt),Ft,F,L,W)}else{const Tt=et(z);lt(D(z),Tt,F,L,W)}return et.end(),D.end(),at}(Ht,Lt,Lt.clone(),null,null),I.map(lt=>lt&<.get()),v)return{ok:!1,conflict:v};B.map(lt=>!!lt);const Xt=[];let Qt=null;(function lt(P,Y,F,L,W){let rt=!1;const it=l(Y);if(h(it)){const et=it.p;et!=null?(F=I[et],L=gt[et]=r.writeCursor(),rt=!0,W=null):(F=null,W=Y.clone())}else c(l(F))&&(F=null);const at=P.getComponent();if(at){const et=at.p;et!=null?(W&&(V[et]=W),Xt[et]=W||U===1&&rt?null:L.getComponent(),M[et]=P.clone(),F&&(T[et]=F.clone())):at.r!==void 0&&(W||L.write("r",!0),(W||rt)&&(Qt==null&&(Qt=new Set),Qt.add(at)))}let wt=0,At=0;const pt=r.advancer(Y,void 0,(et,D)=>{h(D)&&wt++}),Pt=r.advancer(F,(et,D)=>c(D)?~(et-At):et-At,(et,D)=>{c(D)&&At++});if(P)for(const et of P)if(typeof et=="string"){const D=pt(et),z=Pt(et);L.descend(et),lt(P,D,z,L,W),L.ascend()}else{const D=pt(et),z=et-wt,Tt=h(l(D))?null:Pt(z),Ft=z+At;o(Ft>=0),L.descend(Ft),lt(P,D,Tt,L,W),L.ascend()}pt.end(),Pt.end()})(Ht,Lt,Lt.clone(),Ct,null),Ct.reset();let Ae=[];if(function lt(P,Y,F,L,W,rt){o(Y);const it=Y.getComponent();let at=l(L),wt=!1;const At=($,Et,Dt)=>$?t.moveOp($.getPath(),Et.getPath()):t.insertOp(Et.getPath(),Dt.i);if(c(it)){const $=it.d;$!=null&&(j[$]=Y.clone());const Et=$!=null?Xt[$]:null;let Dt=!1;if(it.i!==void 0||$!=null&&Et){let St;at&&(at.i!==void 0||(St=at.d)!=null&&!O[St])&&(Dt=St!=null?$!=null&&$===J[St]:n.default(at.i,it.i),Dt||St!=null&&U!==1&&J[St]!=null||v==null&&(v={type:i.ConflictType.DROP_COLLISION,op1:At($!=null?M[$]:null,Y,it),op2:At(St!=null?G[St]:null,L,at)})),Dt||(rt?v==null&&(v={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:At($!=null?M[$]:null,Y,it),op2:t.removeOp(rt.getPath())}):($!=null?(Ae[ae]=$,W.write("d",Et.p=ae++)):W.write("i",s.default(it.i)),wt=!0))}else if($!=null&&!Et){const St=V[$];St&&(rt=St.clone())}$!=null?(P=M[$],F=A[$],L=T[$]):it.i!==void 0&&(P=F=null,Dt||(L=null))}else h(l(P))&&(P=F=L=null);const pt=l(P),Pt=l(F);if(h(Pt)){const $=Pt.p;Pt.r!==void 0&&(!pt||pt.r===void 0)||O[$]?(L=null,rt=F.clone()):$!=null&&(L=I[$],U!==1&&J[$]!=null||((W=ct[$])||(W=ct[$]=r.writeCursor()),W.reset(),rt=null))}else!c(it)&&c(at)&&(L=null);at=L!=null?L.getComponent():null;const et=ft(it);if(et){const $=C(it);if(rt)v==null&&(v={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:t.editOp(Y.getPath(),et,$,!0),op2:t.removeOp(rt.getPath())});else{const Et=ft(at);let Dt;if(Et){if(et!==Et)throw Error("Transforming incompatible types");const St=C(at);Dt=et.transform($,St,b)}else Dt=s.default($);S(W,et,Dt)}}let D=0,z=0,Tt=0,Ft=0,ce=0,we=0,te=P!=null&&P.descendFirst(),sn=te;const Fe=r.advancer(F,void 0,($,Et)=>{h(Et)&&Tt++});let re=L!=null&&L.descendFirst(),ie=re;for(const $ of Y)if(typeof $=="number"){let Et;const Dt=c(Y.getComponent()),St=$-z;{let Ce;for(;te&&typeof(Ce=P.getKey())=="number";){Ce+=D;const ne=P.getComponent(),Be=h(ne);if(Ce>St||Ce===St&&(!Be||U===0&&Dt))break;if(Be){D--;const Te=ne.p;J.includes(Te),ne.d,l(ct[ne.d]),h(l(ct[ne.d])),(ne.r===void 0||Qt&&Qt.has(ne))&&(Te==null||!Xt[Te]||U!==1&&J.includes(Te))||ce--}te=P.nextSibling()}Et=te&&Ce===St?P:null}const ee=St-D;let he=Fe(ee);const Us=ee-Tt;let Pn=null;{let Ce,ne;for(;re&&typeof(Ce=L.getKey())=="number";){ne=Ce-Ft;const Be=L.getComponent(),Te=c(Be);if(ne>Us)break;if(ne===Us){if(!Te){Pn=L;break}{if(U===0&&Dt){Pn=L;break}const Me=he&&h(he.getComponent());if(U===0&&Me)break}}if(Te){const Me=Be.d;J[Me],Be.i===void 0&&(O[Me]||J[Me]!=null&&U!==1)?(O[Me]||J[Me]!=null&&U===0)&&(Ft++,we--):Ft++}re=L.nextSibling()}}const Eo=Us+Ft+ce+we;o(Eo>=0,"trying to descend to a negative index"),W.descend(Eo),Dt&&(Et=he=Pn=null,z++),lt(Et,Y,he,Pn,W,rt)&&we++,W.ascend()}else{let Et;for(;te&&(Et=P.getKey(),typeof Et!="string"||!(Et>$||Et===$));)te=P.nextSibling();const Dt=te&&Et===$?P:null,St=Fe($);let ee;for(;re&&(ee=L.getKey(),typeof ee!="string"||!(ee>$||ee===$));)re=L.nextSibling();const he=re&&ee===$?L:null;W.descend($),lt(Dt,Y,St,he,W,rt),W.ascend()}return Fe.end(),sn&&P.ascend(),ie&&L.ascend(),wt}(Ht,Ht.clone(),Lt,Lt.clone(),Ct,null),v)return{ok:!1,conflict:v};Ct.reset();const qt=(lt,P,Y)=>lt.traverse(P,(F,L)=>{F.d!=null&&Y(F.d,lt,L)});(O.length||gt.length)&&(qt(Lt,Ct,(lt,P,Y)=>{O[lt]&&!B[lt]&&Y.write("r",!0),gt[lt]&&Y.mergeTree(gt[lt].get())}),Ct.reset());const Vt=[],ue=[];if((ct.length||O.length)&&!v){const lt=r.readCursor(Ts(Ct.get()));if(qt(lt,null,(P,Y)=>{Vt[P]=Y.clone()}),ct.forEach(P=>{P&&qt(r.readCursor(P.get()),null,(Y,F)=>{Vt[Y]=F.clone()})}),function P(Y,F,L,W,rt,it){const at=l(F);if(at&&h(at))if(at.p!=null){const D=at.p;Vt[D].getPath(),L=Vt[D],W=ue[D]=r.writeCursor()}else at.r!==void 0&&(L=null);else c(l(L))&&(L=null);const wt=Y.getComponent();if(wt){let D;if((D=wt.d)!=null){const z=ct[D];z&&(z.get(),W.mergeTree(z.get()),L=r.readCursor(z.get()))}}let At=0,pt=0;const Pt=r.advancer(F,void 0,(D,z)=>{h(z)&&At--}),et=r.advancer(L,(D,z)=>c(z)?-(D-pt)-1:D-pt,(D,z)=>{c(z)&&pt++});for(const D of Y)if(typeof D=="number"){const z=Pt(D),Tt=D+At,Ft=et(Tt),ce=Tt+pt;W.descend(ce),P(Y,z,Ft,W),W.ascend()}else W.descend(D),P(Y,Pt(D),et(D),W),W.ascend();Pt.end(),et.end()}(Lt,lt,lt.clone(),Ct),Ct.reset(),v)return{ok:!1,conflict:v};if(Ct.get(),ue.length){const P=ue.map(F=>F?F.get():null),Y=r.readCursor(Ts(Ct.get()));if(qt(Y,Ct,(F,L,W)=>{const rt=P[F];rt&&(W.mergeTree(rt),P[F]=null)}),P.find(F=>F)){const F=r.writeCursor(),L=r.writeCursor();let W=0,rt=0;P.forEach(it=>{it!=null&&qt(r.readCursor(it),null,at=>{const wt=Ae[at];F.writeMove(M[wt].getPath(),j[wt].getPath(),W++);const At=Rt[wt];At&&At.forEach(pt=>{O[pt]||U!==1&&J[pt]!=null||L.writeMove(G[pt].getPath(),I[pt].getPath(),rt++)})})}),v={type:i.ConflictType.BLACKHOLE,op1:F.get(),op2:L.get()}}}}return v?{ok:!1,conflict:v}:{ok:!0,result:Ct.get()}}const go=m=>{const p=new Error("Transform detected write conflict");throw p.conflict=m,p.type=p.name="writeConflict",p};function Xu(m,p,b){const U=Ms(m,p,b);if(U.ok)return U.result;go(U.conflict)}const He=m=>{const p=r.writeCursor();return r.readCursor(m).traverse(p,(b,U)=>{(c(b)||ft(b))&&U.write("r",!0)}),p.get()},qu=(m,p)=>{const{type:b,op1:U,op2:v}=m;switch(b){case i.ConflictType.DROP_COLLISION:return p==="left"?[null,He(v)]:[He(U),null];case i.ConflictType.RM_UNEXPECTED_CONTENT:let M=!1;return r.readCursor(U).traverse(null,j=>{j.r!==void 0&&(M=!0)}),M?[null,He(v)]:[He(U),null];case i.ConflictType.BLACKHOLE:return[He(U),He(v)];default:throw Error("Unrecognised conflict: "+b)}};function mo(m,p,b,U){let v=null;for(;;){const M=Ms(p,b,U);if(M.ok)return _t(v,M.result);{const{conflict:j}=M;m(j)||go(j);const[G,I]=qu(j,U);p=_t(q(p),G),b=_t(q(b),I),v=_t(v,I)}}}})(gi),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(gi,t);var s=as;Object.defineProperty(t,"ReadCursor",{enumerable:!0,get:function(){return s.ReadCursor}}),Object.defineProperty(t,"WriteCursor",{enumerable:!0,get:function(){return s.WriteCursor}});var r=us;Object.defineProperty(t,"ConflictType",{enumerable:!0,get:function(){return r.ConflictType}})}(Gt);const ma=Ro({__proto__:null,default:ha(Gt)},[Gt]);var Q=(t=>(t.RETAIN="r",t.INSERT="i",t.DELETE="d",t))(Q||{});class _s{constructor(e){g(this,"_index",0);g(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===Q.DELETE||n.t===Q.RETAIN&&n.body==null?y.deepClone({...n,len:e}):y.deepClone({...n,len:e,body:Xe(n.body,s,s+e)})}else return{t:Q.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:Q.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 pi{constructor(){g(this,"cursor",0)}reset(){return this.cursor=0,this}moveCursor(e){this.cursor+=e}moveCursorTo(e){this.cursor=e}}function Ea(t,e,n){const{dataStream:s}=t,r=n,i=n+e,o=ai(t,e,n),l=ui(t,e,n),a=ci(t,e,n),d=hi(t,e,n),h=di(t,e,n),c=fi(t,e,n);let f="";return s&&(t.dataStream=Dr(s,r,i),f=s.slice(r,i)),{dataStream:f,textRuns:o,paragraphs:l,sectionBreaks:a,customBlocks:d,tables:h,customRanges:c}}function Ra(t,e,n,s){t.dataStream=Lr(t.dataStream,s,e.dataStream),oi(t,e,n,s),es(t,e,n,s),ta(t,e,n,s),li(t,e,n,s),ns(t,e,n,s),ea(t,e,n,s)}function Ca(t,e,n,s,r=kt.COVER){return na(t,e,n,s,r)}function pa(t,e,n){return e<=0?{dataStream:""}:Ea(t,e,n)}function Ia(t,e,n,s){n!==0&&Ra(t,e,n,s)}function Oa(t,e){const n=new pi;return n.reset(),e.forEach(s=>{switch(s=y.deepClone(s),s.t){case Q.RETAIN:{const{coverType:r,body:i,len:o}=s;i!=null&&Ca(t,i,o,n.cursor,r),n.moveCursor(o);break}case Q.INSERT:{const{body:r,len:i}=s;Ia(t,r,i,n.cursor),n.moveCursor(i);break}case Q.DELETE:{const{len:r}=s;pa(t,r,n.cursor);break}default:throw new Error(`Unknown action type for action: ${s}.`)}}),t}function Ii(t){return Object.keys(t).length===1}const nn=class nn{constructor(){g(this,"_actions",[])}static apply(e,n){return Oa(e,n)}static compose(e,n){const s=new _s(e),r=new _s(n),i=new nn;for(;s.hasNext()||r.hasNext();)if(r.peekType()===Q.INSERT)i.push(r.next());else if(s.peekType()===Q.DELETE)i.push(s.next());else{const o=Math.min(s.peekLength(),r.peekLength()),l=s.next(o),a=r.next(o);l.t===Q.INSERT&&a.t===Q.RETAIN?a.body==null?i.push(l):i.push({...l,body:ss(l.body,a.body,a.coverType)}):l.t===Q.RETAIN&&a.t===Q.RETAIN?l.body==null&&a.body==null?i.push(l.len!==Number.POSITIVE_INFINITY?l:a):l.body&&a.body?i.push({...l,body:ss(l.body,a.body,a.coverType)}):i.push(l.body?l:a):l.t===Q.RETAIN&&a.t===Q.DELETE?i.push(a):l.t===Q.INSERT&&(a.t,Q.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===Q.INSERT)n.push({t:Q.DELETE,len:s.len,line:0,body:s.body,segmentId:s.segmentId});else if(s.t===Q.DELETE){if(s.body==null)throw new Error("Can not invert DELETE action without body property, makeInvertible must be called first.");n.push({t:Q.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:Q.RETAIN,body:s.oldBody,oldBody:s.body,len:s.len,coverType:kt.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===Q.DELETE&&i.body==null){const o=Xe(n,r,r+i.len,!1);i.body=o}if(i.t===Q.RETAIN&&i.body!=null){const{textRuns:o}=Xe(n,r,r+i.len,!0);i.oldBody={dataStream:"",textRuns:o}}s.push(i),i.t!==Q.INSERT&&(r+=i.len)}return s}insert(e,n,s=""){const r={t:Q.INSERT,body:n,len:e,line:0,segmentId:s};return this.push(r),this}retain(e,n="",s,r){const i={t:Q.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:Q.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===Q.RETAIN&&r.len===0&&r.body==null)return this;if(typeof s=="object"){if(s.t===Q.DELETE&&r.t===Q.DELETE)return s.len+=r.len,this;if(s.t===Q.DELETE&&r.t===Q.INSERT&&(n-=1,s=this._actions[n-1],s==null))return this._actions.unshift(r),this;if(s.t===Q.RETAIN&&r.t===Q.RETAIN&&s.body==null&&r.body==null)return s.len+=r.len,this;if(s.t===Q.INSERT&&Ii(s.body)&&r.t===Q.INSERT&&Ii(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===Q.RETAIN&&ua(e);)this._actions.pop(),e=this._actions[this._actions.length-1];return this}};g(nn,"id","text-x"),g(nn,"uri","https://github.com/dream-num/univer#text-x");let Ee=nn;Object.defineProperty(Ee,"name",{value:"text-x"});const ke=class ke{static registerSubtype(e){var n;this._subTypes.has(e.name)&&((n=this._subTypes.get(e.name))==null?void 0:n.id)!==Ee.id||(this._subTypes.set(e.name,e),Gt.type.registerSubtype(e))}static apply(e,n){if(!Gt.type.isNoop(n))return Gt.type.apply(e,n)}static compose(e,n){return Gt.type.compose(e,n)}static transform(e,n,s){throw new Error("transform is not implemented in JsonX")}static invertWithDoc(e,n){return Gt.type.invertWithDoc(e,n)}static isNoop(e){return Gt.type.isNoop(e)}static getInstance(){return this._instance==null&&(this._instance=new ke),this._instance}removeOp(e,n){return Gt.removeOp(e,n)}moveOp(e,n){return Gt.moveOp(e,n)}insertOp(e,n){return Gt.insertOp(e,n)}replaceOp(e,n,s){return Gt.replaceOp(e,n,s)}editOp(e){return Gt.editOp(["body"],Ee.name,e)}};g(ke,"uri","https://github.com/dream-num/univer#json-x"),g(ke,"_subTypes",new Map),g(ke,"_instance",null);let be=ke;be.registerSubtype(Ee);const gs={id:"default_doc",documentStyle:{}};class Sa extends Sn{constructor(n){super();g(this,"type",nt.UNIVER_DOC);g(this,"snapshot");this.snapshot={...gs,...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,d=r==null?void 0:r[n];if(!d)return;const h=d.docTransform;h.size.width=i,h.size.height=o,h.positionH.posOffset=l,h.positionV.posOffset=a}setZoomRatio(n=1){this.snapshot.settings==null?this.snapshot.settings={zoomRatio:n}:this.snapshot.settings.zoomRatio=1}}class ve extends Sa{constructor(n){var r;super(y.isEmptyObject(n)?ca():n);g(this,"_unitId");g(this,"headerModelMap",new Map);g(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={...gs,...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(!be.isNoop(n))return be.apply(this.snapshot,n)}sliceBody(n,s){const r=this.getBody();if(r!=null)return Xe(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 ve(i))}if(s)for(const r in s){const i=s[r];this.footerModelMap.set(r,new ve(i))}}updateDocumentId(n){super.updateDocumentId(n),this._unitId=n}}const Oi=ut.createIdentifier("univer.config-service");class Si{constructor(){g(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 Ni extends yt{constructor(){super(...arguments);g(this,"_error$",new x.Subject);g(this,"error$",this._error$.asObservable())}dispose(){this._error$.complete()}emit(n){this._error$.next({errorKey:n})}}class bi{constructor(e={}){g(this,"_styles");g(this,"_cacheMap",new xr(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 Na{constructor(e,n){g(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!==Z.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:ot.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:ot.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:ot.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:ot.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:Z.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:Z.FALSE};return this._columnData[e]=i,i}}class ba{constructor(e,n,s){g(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:Z.FALSE,h:r.defaultRowHeight},{ia:a,ah:d,h=r.defaultRowHeight}=l;i+=(a==null||a===Z.TRUE)&&typeof d=="number"?d:h}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:Z.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:ot.ROW})):!r&&!l&&(r=!0,i=o)}return r&&s.push({startRow:i,endRow:n,startColumn:0,endColumn:0,rangeType:ot.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:ot.ROW})):!r&&l&&(r=!0,i=o)}return r&&s.push({startRow:i,endRow:n,startColumn:0,endColumn:0,rangeType:ot.ROW}),s}getRowRawVisible(e){const n=this.getRow(e);return n?n.hd!==Z.TRUE:!0}getSize(){return _e(this._rowData)}}const va="DEFAULT_WORKSHEET_ROW_COUNT",vi=1e3,Aa="DEFAULT_WORKSHEET_COLUMN_COUNT",Ai=20,wa="DEFAULT_WORKSHEET_ROW_HEIGHT",wi=24,Ta="DEFAULT_WORKSHEET_COLUMN_WIDTH",Ti=88,Ma="DEFAULT_WORKSHEET_ROW_TITLE_WIDTH",Mi=46,Ua="DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT",Ui=20;function Li(t){const e={name:"Sheet1",id:"sheet-01",tabColor:"",hidden:Z.FALSE,rowCount:vi,columnCount:Ai,zoomRatio:1,freeze:{xSplit:0,ySplit:0,startRow:-1,startColumn:-1},scrollTop:0,scrollLeft:0,defaultColumnWidth:Ti,defaultRowHeight:wi,mergeData:[],cellData:{},rowData:{},columnData:{},showGridlines:Z.TRUE,rowHeader:{width:Mi,hidden:Z.FALSE},columnHeader:{height:Ui,hidden:Z.FALSE},selections:["A1"],rightToLeft:Z.FALSE};return Object.keys(e).forEach(n=>{const s=n;typeof t[s]>"u"&&(t[s]=e[s])}),t}class Di extends yt{constructor(n){super();g(this,"_cellContentInterceptor",null);g(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,bt(()=>this._cellContentInterceptor=null)}registerRowFilteredInterceptor(n){if(this._rowFilteredInterceptor)throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowFilteredInterceptor=n,bt(()=>this._rowFilteredInterceptor=null)}}class qe{constructor(e,n,s){g(this,"_sheetId");g(this,"_snapshot");g(this,"_cellData");g(this,"_rowManager");g(this,"_columnManager");g(this,"_viewModel");var l;this.unitId=e,this._styles=s,this._snapshot=Li(n);const{columnData:r,rowData:i,cellData:o}=this._snapshot;this._sheetId=(l=this._snapshot.id)!=null?l:y.generateRandomId(6),this._cellData=new Zt(o),this._viewModel=new Di((a,d)=>this.getCellRaw(a,d)),this._rowManager=new ba(this._snapshot,this._viewModel,i),this._columnManager=new Na(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((d,h)=>{Object.keys(h).forEach(c=>{const f=+c,_=e.getValue(d,f),E=_!=null&&_.s?this._styles.get(_.s):null,R=(E==null?void 0:E.bd)&&(E.bd.b||E.bd.l||E.bd.r||E.bd.t||E.bd.bc_tr||E.bd.bl_tr||E.bd.ml_tr||E.bd.tl_bc||E.bd.tl_br||E.bd.tl_mr);(_&&(_.v||_.p)||E!=null&&E.bg||R)&&(l?s=Math.min(s,d):(s=d,l=!0),r=Math.max(r,d),a?i=Math.min(i,f):(a=!0,i=f),o=Math.max(o,f))})}),n.forEach(d=>{l?s=Math.min(s,d.startRow):(s=d.startRow,l=!0),r=Math.max(r,d.endRow),a?i=Math.min(i,d.startColumn):(i=d.startColumn,l=!0),o=Math.max(o,d.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 qe(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(d=>ge.intersects({startRow:e,startColumn:n,endRow:s,endColumn:r},d)),a=new Zt;return zn(e,s,n,r).forEach((d,h)=>{const c=i?this.getCellRaw(d,h):this.getCell(d,h);c&&a.setValue(d,h,c)}),l.forEach(d=>{const{startColumn:h,startRow:c,endColumn:f,endRow:_}=d;zn(c,_,h,f).forEach((E,R)=>{E===c&&R===h&&a.setValue(E,R,{...o.getValue(E,R),rowSpan:_-c+1,colSpan:f-h+1}),(E!==c||R!==h)&&a.realDeleteValue(E,R)})}),a}getRange(e,n,s,r){return typeof e=="object"?new ye(this,e,{getStyles:()=>this._styles}):new ye(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,d=r;return{next(){for(;;){if(d>o&&(a+=1,d=r),a>i)return{done:!0,value:void 0};const h=l.getCell(a,d),c=!h,f=l.getMergedCell(a,d);if(f){if(a!==f.startRow||d!==f.startColumn){d=f.endColumn+1;continue}if(c&&n){d=f.endColumn+1;continue}const E={row:a,col:d,value:h};return E.colSpan=f.endColumn-f.startColumn+1,E.rowSpan=f.endRow-f.startRow+1,d=f.endColumn+1,{done:!1,value:E}}if(c&&n)d+=1;else{const _={row:a,col:d,value:h};return d+=1,{done:!1,value:_}}}}}}}}iterateByColumn(e,n=!0,s=!0){const{startRow:r,startColumn:i,endRow:o,endColumn:l}=e,a=this;return{[Symbol.iterator]:()=>{let d=r,h=i;return{next(){for(;;){if(d>o&&(h+=1,d=r),h>l)return{done:!0,value:void 0};const c=a.getMergedCell(d,h);if(c){const E=d!==c.startRow,R=E||h!==c.startColumn;if(s&&R||!s&&E){d=c.endRow+1;continue}const H=a.getCell(c.startRow,c.startColumn);if(!H&&n){d=c.endRow+1;continue}const tt={row:d,col:c.startColumn,value:H};return tt.colSpan=c.endColumn-c.startColumn+1,tt.rowSpan=c.endRow-c.startRow+1,d=c.endRow+1,{done:!1,value:tt}}const f=a.getCell(d,h);if(!f&&n)d+=1;else{const E={row:d,col:h,value:f};return d+=1,{done:!1,value:E}}}}}}}}}function La(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===Oe.BOOLEAN?n.toUpperCase():n.replace(/[\r\n]/g,""):typeof n=="number"?t.t===Oe.BOOLEAN?n?"TRUE":"FALSE":n.toString():typeof n=="boolean"?n?"TRUE":"FALSE":""}const Da="0.1.16";function ya(t="",e=pe.ZH_CN,n=""){return{id:t,sheetOrder:[],name:n,appVersion:Da,locale:e,styles:{},sheets:{},resources:[]}}var Pa=Object.defineProperty,ka=Object.getOwnPropertyDescriptor,Ha=(t,e,n,s)=>{for(var r=s>1?void 0:s?ka(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&&Pa(e,n,r),r},Fa=(t,e)=>(n,s)=>e(n,s,t);function Ba(t,e){return`${t.getUnitId()}|${e.getSheetId()}`}u.Workbook=class extends Sn{constructor(n={},s){super();g(this,"type",nt.UNIVER_SHEET);g(this,"_sheetCreated$",new x.Subject);g(this,"sheetCreated$",this._sheetCreated$.asObservable());g(this,"_sheetDisposed$",new x.Subject);g(this,"sheetDisposed$",this._sheetDisposed$.asObservable());g(this,"_activeSheet$",new x.BehaviorSubject(null));g(this,"activeSheet$",this._activeSheet$.asObservable());g(this,"_worksheets");g(this,"_styles");g(this,"_snapshot");g(this,"_unitId");g(this,"_count");g(this,"_name$");g(this,"name$");this._logService=s;const r=ya();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 bi(i),this._count=1,this._worksheets=new Map,this._name$=new x.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 qe(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()!==Z.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===Z.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 d=new qe(this._unitId,l,this._styles);s.set(o,d),i.includes(o)||i.push(o)}this.ensureActiveSheet()}},u.Workbook=Ha([Fa(1,me)],u.Workbook);class ms extends Sn{constructor(n){var s;super();g(this,"type",nt.UNIVER_SLIDE);g(this,"_snapshot");g(this,"_unitId");this._snapshot={...zr,...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:Bn.SLIDE,zIndex:1,title:"cover",description:"this is first page, cover",pageBackgroundFill:{rgb:"rgb(255,255,255)"},pageElements:{}}}}const Je="FOCUSING_SHEET",vn="FOCUSING_DOC",An="FOCUSING_SLIDE",Wa="FOCUSING_EDITOR_BUT_HIDDEN",yi="EDITOR_ACTIVATED",$a="FOCUSING_EDITOR_INPUT_FORMULA",Pi="FOCUSING_FORMULA_EDITOR",Ga="FOCUSING_UNIVER_EDITOR",Va="FOCUSING_EDITOR_INPUT_FORMULA",ja="FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE",xa="FOCUSING_COMMON_DRAWINGS";var Ka=Object.defineProperty,Ya=Object.getOwnPropertyDescriptor,za=(t,e,n,s)=>{for(var r=s>1?void 0:s?Ya(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},ki=(t,e)=>(n,s)=>e(n,s,t);const Pe=ut.createIdentifier("univer.current");u.UniverInstanceService=class extends yt{constructor(n,s){super();g(this,"_unitsByType",new Map);g(this,"_createHandler");g(this,"_ctorByType",new Map);g(this,"_currentUnits",new Map);g(this,"_currentUnits$",new x.BehaviorSubject(this._currentUnits));g(this,"currentUnits$",this._currentUnits$.asObservable());g(this,"_unitAdded$",new x.Subject);g(this,"unitAdded$",this._unitAdded$.asObservable());g(this,"_unitDisposed$",new x.Subject);g(this,"unitDisposed$",this._unitDisposed$.asObservable());g(this,"_focused$",new x.BehaviorSubject(null));g(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(x.map(s=>{var r;return(r=s.get(n))!=null?r:null}),x.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(x.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(x.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(nt.UNIVER_DOC)}getUniverDocInstance(n){return this.getUnit(n,nt.UNIVER_DOC)}getUniverSheetInstance(n){return this.getUnit(n,nt.UNIVER_SHEET)}getAllUnitsForType(n){var s;return(s=this._unitsByType.get(n))!=null?s:[]}changeDoc(n,s){const r=this.getAllUnitsForType(nt.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 u.Workbook?(this._contextService.setContextValue(vn,!1),this._contextService.setContextValue(Je,!0),this._contextService.setContextValue(An,!1)):this.focused instanceof ve?(this._contextService.setContextValue(vn,!0),this._contextService.setContextValue(Je,!1),this._contextService.setContextValue(An,!1)):this.focused instanceof ms&&(this._contextService.setContextValue(vn,!1),this._contextService.setContextValue(Je,!1),this._contextService.setContextValue(An,!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]}}},u.UniverInstanceService=za([ki(0,ut.Inject(ut.Injector)),ki(1,Ke)],u.UniverInstanceService);var It=(t=>(t[t.Starting=0]="Starting",t[t.Ready=1]="Ready",t[t.Rendered=2]="Rendered",t[t.Steady=3]="Steady",t))(It||{});const Xa={0:"Starting",1:"Ready",2:"Rendered",3:"Steady"},wn=new Map;function Hi(t,e){return function(r){Tn(t,e)}}function Tn(t,e){wn.has(t)||wn.set(t,[]),wn.get(t).push(e)}var qa=Object.defineProperty,Ja=Object.getOwnPropertyDescriptor,Fi=(t,e,n,s)=>{for(var r=s>1?void 0:s?Ja(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&&qa(e,n,r),r},Es=(t,e)=>(n,s)=>e(n,s,t);u.LifecycleService=class extends yt{constructor(n){super();g(this,"_lifecycle$",new x.BehaviorSubject(It.Starting));g(this,"lifecycle$",this._lifecycle$.asObservable());g(this,"_lock",!1);this._logService=n,this._reportProgress(It.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 x.Observable(n=>{this.stage===It.Starting||(this.stage===It.Ready?n.next(It.Starting):this.stage===It.Rendered?(n.next(It.Starting),n.next(It.Ready)):(n.next(It.Starting),n.next(It.Ready),n.next(It.Rendered))),this._lifecycle$.subscribe(s=>{n.next(s),s===It.Steady&&n.complete()})})}_reportProgress(n){this._logService.debug("[LifecycleService]",`lifecycle progressed to "${Xa[n]}".`)}},u.LifecycleService=Fi([Es(0,me)],u.LifecycleService),u.LifecycleInitializerService=class extends yt{constructor(n,s){super();g(this,"_seenTokens",new Set);this._lifecycleService=n,this._injector=s}initModulesOnStage(n){var s;(s=wn.get(n))==null||s.forEach(r=>{this._injector.has(r)&&!this._seenTokens.has(r)&&(this._injector.get(r),this._seenTokens.add(r))})}},u.LifecycleInitializerService=Fi([Es(0,ut.Inject(u.LifecycleService)),Es(1,ut.Inject(ut.Injector))],u.LifecycleInitializerService);class Ze extends yt{constructor(){super();g(this,"_currentLocale$",new x.BehaviorSubject(pe.ZH_CN));g(this,"currentLocale$",this._currentLocale$.asObservable());g(this,"_locales",null);g(this,"localeChanged$",new x.Subject);g(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(bt(()=>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 Rs=(t=>(t.INIT="init",t.FETCHING="fetching",t.DONE="done",t))(Rs||{});const Cs=ut.createIdentifier("univer.permission-service");Tn(It.Starting,Cs);class Bi extends yt{constructor(){super(...arguments);g(this,"_permissionPointMap",new Map);g(this,"_permissionPointUpdate$",new x.Subject);g(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 x.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 x.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=Rs.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 x.combineLatest(s).pipe(oe.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 Wi extends yt{constructor(){super(...arguments);g(this,"_resourceMap",new Map);g(this,"_register$",new x.Subject);g(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),bt(()=>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 Mn=ut.createIdentifier("resource-manager-service");var Za=Object.defineProperty,Qa=Object.getOwnPropertyDescriptor,tu=(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},$i=(t,e)=>(n,s)=>e(n,s,t);let ps=class extends yt{constructor(e,n){super();g(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 nt.UNRECOGNIZED:case nt.UNIVER_UNKNOWN:case nt.UNIVER_SLIDE:case nt.UNIVER_DOC:break;case nt.UNIVER_SHEET:this._univerInstanceService.getAllUnitsForType(nt.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(bt(this._univerInstanceService.getTypeOfUnitAdded$(nt.UNIVER_SHEET).subscribe(s=>{this._resourceManagerService.loadResources(s.getUnitId(),s.getSnapshot().resources)}))),this.disposeWithMe(bt(this._univerInstanceService.getTypeOfUnitDisposed$(nt.UNIVER_SHEET).subscribe(s=>{this._resourceManagerService.unloadResources(s.getUnitId())})))}};ps=tu([$i(0,ut.Inject(Mn)),$i(1,ut.Inject(Pe))],ps);const Is=ut.createIdentifier("resource-loader-service");Tn(It.Ready,Is);class Os extends yt{constructor(){super();g(this,"_currentTheme");g(this,"_currentTheme$",new x.BehaviorSubject({}));g(this,"currentTheme$",this._currentTheme$.asObservable());this.disposeWithMe(bt(()=>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 Gi="__defaultDocumentNormalEditorSpecialUnitId_20231006__",Vi="__defaultDocumentFormulaBarEditorSpecialUnitId_20231012__",eu=`\r
|
|
7
|
+
`;function nu(t){return`__internalEditorId__${t}`}function su(t){return t.startsWith("__")}var ru=Object.defineProperty,iu=Object.getOwnPropertyDescriptor,ou=(t,e,n,s)=>{for(var r=s>1?void 0:s?iu(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},Ss=(t,e)=>(n,s)=>e(n,s,t);const Un=ut.createIdentifier("univer.undo-redo.service"),lu=20;class ji{dispose(){}async dispatchToHandlers(){return!1}}const xi="univer.command.redo",Ki="univer.command.undo",Yi=new class extends ji{constructor(){super(...arguments);g(this,"type",Ye.COMMAND);g(this,"id",Ki)}async handler(e){const n=e.get(Un),s=n.pitchTopUndoElement();if(!s)return!1;const r=e.get(ze);return qn(s.undoMutations,r)?(n.popUndoToRedo(),!0):!1}},zi=new class extends ji{constructor(){super(...arguments);g(this,"type",Ye.COMMAND);g(this,"id",xi)}async handler(e){const n=e.get(Un),s=n.pitchTopRedoElement();if(!s)return!1;const r=e.get(ze);return qn(s.redoMutations,r)?(n.popRedoToUndo(),!0):!1}};u.LocalUndoRedoService=class extends yt{constructor(n,s,r){super();g(this,"undoRedoStatus$");g(this,"_undoRedoStatus$",new x.BehaviorSubject({undos:0,redos:0}));g(this,"_undoStacks",new Map);g(this,"_redoStacks",new Map);g(this,"_batchingStatus",new Map);this._univerInstanceService=n,this._commandService=s,this._contextService=r,this.undoRedoStatus$=this._undoRedoStatus$.asObservable(),this.disposeWithMe(this._commandService.registerCommand(Yi)),this.disposeWithMe(this._commandService.registerCommand(zi)),this.disposeWithMe(bt(()=>this._undoRedoStatus$.complete())),this.disposeWithMe(bt(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>lu&&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),bt(()=>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,d;let n="";const s=this._contextService.getContextValue(Je),r=this._contextService.getContextValue(Pi),i=this._contextService.getContextValue(yi);return s?r?n=Vi:i?n=Gi:n=(l=(o=this._univerInstanceService.getFocusedUnit())==null?void 0:o.getUnitId())!=null?l:"":n=(d=(a=this._univerInstanceService.getFocusedUnit())==null?void 0:a.getUnitId())!=null?d:"",n}},u.LocalUndoRedoService=ou([Ss(0,Pe),Ss(1,ze),Ss(2,Ke)],u.LocalUndoRedoService);const Xi=Symbol("DependentOn");class Ns extends yt{onStarting(e){}onReady(){}onRendered(){}onSteady(){}getUniverInstanceType(){return this.constructor.type}getPluginName(){return this.constructor.pluginName}}g(Ns,"pluginName"),g(Ns,"type",nt.UNIVER_UNKNOWN);class au{constructor(){g(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 uu{constructor(){g(this,"_pluginsRegistered",[])}registerPlugin(e,n){this._pluginsRegistered.push({plugin:e,options:n})}getRegisterPlugins(){return this._pluginsRegistered.slice()}removePlugins(){this._pluginsRegistered=[]}}var cu=Object.defineProperty,hu=Object.getOwnPropertyDescriptor,qi=(t,e,n,s)=>{for(var r=s>1?void 0:s?hu(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&&cu(e,n,r),r},Qe=(t,e)=>(n,s)=>e(n,s,t);const du=4;function fu(...t){return function(e){e[Xi]=t}}u.PluginService=class{constructor(e){g(this,"_pluginHolderForUniver");g(this,"_pluginHoldersForTypes",new Map);g(this,"_seenPlugins",new Set);g(this,"_flushTimer");this._injector=e,this._pluginHolderForUniver=this._injector.createInstance(Ln,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===nt.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(Ln,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===nt.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()},du))}_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()}},u.PluginService=qi([Qe(0,ut.Inject(ut.Injector))],u.PluginService);let Ln=class extends yt{constructor(e,n,s,r,i,o){super();g(this,"_started",!1);g(this,"_pluginRegistry",new uu);g(this,"_pluginStore",new au);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[Xi];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 It.Starting:i.onStarting(this._injector);break;case It.Ready:i.onReady();break;case It.Rendered:i.onRendered();break;case It.Steady:i.onSteady();break}this._lifecycleInitializerService.initModulesOnStage(r)})},s=this.disposeWithMe(this._lifecycleService.subscribeWithPrevious().pipe(x.finalize(()=>{Promise.resolve().then(()=>s.dispose())})).subscribe(r=>{n(r)}))}};Ln=qi([Qe(2,me),Qe(3,ut.Inject(ut.Injector)),Qe(4,ut.Inject(u.LifecycleService)),Qe(5,ut.Inject(u.LifecycleInitializerService))],Ln);function Ji(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 bs={[Wt.Editor]:"Editor",[Wt.Owner]:"Owner",[Wt.Reader]:"Reader",[Wt.UNRECOGNIZED]:"UNRECOGNIZED"},Dn=t=>t?{userID:`${bs[t]}_${y.generateRandomId(8)}`,name:bs[t],avatar:""}:{userID:"",name:"",avatar:"",anonymous:!0,canBindAnonymous:!1},vs=(t,e)=>t.startsWith(bs[e]);var _u=Object.defineProperty,gu=Object.getOwnPropertyDescriptor,mu=(t,e,n,s)=>{for(var r=s>1?void 0:s?gu(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&&_u(e,n,r),r};u.UserManagerService=class{constructor(){g(this,"_model",new Map);g(this,"_userChange$",new x.Subject);g(this,"userChange$",this._userChange$.asObservable());g(this,"_currentUser$",new x.BehaviorSubject(Dn()));g(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"})}},u.UserManagerService=mu([Hi(It.Starting,u.UserManagerService)],u.UserManagerService);var Eu=Object.defineProperty,Ru=Object.getOwnPropertyDescriptor,Cu=(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&&Eu(e,n,r),r},Zi=(t,e)=>(n,s)=>e(n,s,t);u.AuthzIoLocalService=class{constructor(e,n){g(this,"_permissionMap",new Map([]));this._resourceManagerService=e,this._userManagerService=n,this._initSnapshot(),n.setCurrentUser(Dn(Wt.Owner))}_getRole(e){const n=this._userManagerService.getCurrentUser();return n?vs(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:[nt.UNIVER_SHEET,nt.UNIVER_DOC,nt.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 On.SelectRange:{const s=e.selectRangeObject;this._permissionMap.set(n,{...s,objectType:e.objectType});break}case On.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===On.Worksheet)return(n=s==null?void 0:s.strategies)==null?void 0:n.map(r=>({action:r.action,allowed:r.role===Wt.Editor}))}return e.actions.map(s=>({action:s,allowed:this._getRole(Wt.Owner)||this._getRole(Wt.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&&(vs(n.userID,Wt.Owner)||vs(n.userID,Wt.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:Wt.Owner,shareScope:-1,creator:Dn(Wt.Owner),strategies:[],actions:e.actions.map(o=>({action:o,allowed:this._getRole(Wt.Owner)||this._getRole(Wt.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){}},u.AuthzIoLocalService=Cu([Zi(0,Mn),Zi(1,ut.Inject(u.UserManagerService))],u.AuthzIoLocalService);const Qi=ut.createIdentifier("IAuthzIoIoService");class pu{constructor(e={},n){g(this,"_startedTypes",new Set);g(this,"_injector");const s=this._injector=Iu(n,e==null?void 0:e.override),{theme:r,locale:i,locales:o,logLevel:l}=e;r&&this._injector.get(Os).setTheme(r),o&&this._injector.get(Ze).load(o),i&&this._injector.get(Ze).setLocale(i),l&&this._injector.get(me).setLogLevel(l),this._init(s),this._pluginService}get _univerInstanceService(){return this._injector.get(Pe)}get _pluginService(){return this._injector.get(u.PluginService)}__getInjector(){return this._injector}dispose(){this._injector.dispose()}setLocale(e){this._injector.get(Ze).setLocale(e)}createUnit(e,n){return this._univerInstanceService.createUnit(e,n)}createUniverSheet(e){return this._univerInstanceService.createUnit(nt.UNIVER_SHEET,e)}createUniverDoc(e){return this._univerInstanceService.createUnit(nt.UNIVER_DOC,e)}createUniverSlide(e){return this._univerInstanceService.createUnit(nt.UNIVER_SLIDE,e)}_init(e){this._univerInstanceService.registerCtorForType(nt.UNIVER_SHEET,u.Workbook),this._univerInstanceService.registerCtorForType(nt.UNIVER_DOC,ve),this._univerInstanceService.registerCtorForType(nt.UNIVER_SLIDE,ms);const n=e.get(Pe);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(u.LifecycleService).stage<It.Ready&&(this._injector.get(u.LifecycleService).stage=It.Ready)}registerPlugin(e,n){this._pluginService.registerPlugin(e,n)}}function Iu(t,e){const n=Ji([[Ni],[Ze],[Os],[u.LifecycleService],[u.LifecycleInitializerService],[u.PluginService],[u.UserManagerService],[Pe,{useClass:u.UniverInstanceService}],[Cs,{useClass:Bi}],[me,{useClass:ti,lazy:!0}],[ze,{useClass:u.CommandService,lazy:!0}],[Un,{useClass:u.LocalUndoRedoService,lazy:!0}],[Oi,{useClass:Si}],[Ke,{useClass:Zr}],[Mn,{useClass:Wi,lazy:!0}],[Is,{useClass:ps,lazy:!0}],[Qi,{useClass:u.AuthzIoLocalService,lazy:!0}]],e);return t?t.createChild(n):new ut.Injector(n)}const Ou=(t,e)=>e.length===t.length&&!t.some(n=>e.some(s=>!ge.equals(s,n))),Su=(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 Nu(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 to(t){return/^-?\d+(\.\d+)?$/.test(t)}function bu(t){return to(t)?Number(t)<=Number.MAX_SAFE_INTEGER:!1}function vu(t){return["true","false"].includes(t.toLowerCase())}function Au(t,e){return e.forEach(n=>t.add(n)),t}function wu(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 Tu(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 eo=(t=>(t[t.TEXT=0]="TEXT",t[t.ARROW=1]="ARROW",t[t.CUSTOM=2]="CUSTOM",t))(eo||{});function Mu(t,e,n){if(e==="")return t;const s={id:"mock-id",body:t,documentStyle:{}},r=new ve(s),i=e.length;let o;for(;(o=r.getBody().dataStream.indexOf(e))>=0;){const a=new Ee,d=be.getInstance();if(o>0&&a.retain(o),n.length>0){const c=r.sliceBody(o,o+i),f={dataStream:n};Array.isArray(c==null?void 0:c.textRuns)&&c.textRuns.length&&(f.textRuns=[{...c.textRuns[0],st:0,ed:n.length}]),a.insert(n.length,f)}a.delete(i);const h=a.serialize();r.apply(d.editOp(h))}const l=r.getBody();return r.dispose(),l}class Uu extends mn{add(e){if(!e)return null;const n=new gn(e,this);return this._observers=[n],this._onObserverAdded&&this._onObserverAdded(n),n}makeObserverTopPriority(){}makeObserverBottomPriority(){}}const Lu=ut.createIdentifier("ILocalStorageService");function Du(t){return`sheet_interceptor_${t}`}const no=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 yu{constructor(e){g(this,"_interceptorsByName",new Map);g(this,"_interceptorPoints");this._interceptorPoints=e}fetchThroughInterceptors(e){const n=e,s=this._interceptorsByName.get(n);return no(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)})),()=>En(this._interceptorsByName.get(s),n)}getInterceptPoints(){return this._interceptorPoints}}const Pu=ut.createIdentifier("univer.snapshot-server-service");class ku{constructor(){g(this,"_sheetBlockCache",new Map)}getUnitOnRev(e,n){return Promise.resolve({snapshot:{unitID:"",type:nt.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 Hu(t){return btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(e,n)=>String.fromCharCode(Number.parseInt(n,16))))}function As(t){return decodeURIComponent(Array.prototype.map.call(atob(t),e=>`%${`00${e.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""))}const tn=new TextEncoder,yn=new TextDecoder;function so(t){const e=y.deepClone(t);return delete e.id,delete e.name,delete e.rowCount,delete e.columnCount,delete e.cellData,tn.encode(JSON.stringify(e))}function ro(t){const e=y.deepClone(t);return delete e.id,delete e.rev,delete e.name,delete e.sheetOrder,delete e.sheets,tn.encode(JSON.stringify(e))}function Fu(t){const e=y.deepClone(t);return delete e.id,delete e.rev,delete e.title,delete e.resources,tn.encode(JSON.stringify(e))}function io(t){return JSON.parse(yn.decode(t))}function Bu(t){return JSON.parse(typeof t=="string"?As(t):yn.decode(t))}function Wu(t){return JSON.parse(typeof t=="string"?As(t):yn.decode(t))}const ws=256;function oo(t,e){const n=new Zt(t),s=n.getLength(),r=[];let i=0;for(;i<s;){const o=Math.min(i+ws,s-1),l=n.getSlice(i,Math.min(i+ws,s-1),0,e),a=$u(l);r.push({id:y.generateRandomId(19,"0123456789"),startRow:i,endRow:o,data:a}),i+=ws}return r}function $u(t){const e=t.getData();return tn.encode(JSON.stringify(e))}async function Gu(t,e,n,s,r){const i={},o={};if(!await Promise.all(Object.entries(e.sheets).map(async([c,f])=>{const _={id:f.id,type:on.GRID,name:f.name,rowCount:f.rowCount,columnCount:f.columnCount,originalMeta:so(f)};if(o[c]=_,f.cellData){const E=oo(f.cellData,f.rowCount),R=await Promise.all(E.map(H=>r.saveSheetBlock(t,{unitID:n,type:nt.UNIVER_SHEET,block:H})));if(R.some(H=>{var k;return((k=H.error)==null?void 0:k.code)!==xt.OK}))return!1;i[c]={sheetID:c,blocks:R.map(H=>H.blockID)}}return!0})))throw new Error("[transformWorkbookDataToSnapshot()]: Failed to save sheet blocks.");const a=ro(e),d={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:d.rev,type:nt.UNIVER_SHEET,workbook:d,doc:void 0}}}async function Vu(t,e,n,s,r){var f,_;const i={},o={};if(!await Promise.all(Object.entries(e.sheets).map(async([E,R])=>{const H={id:R.id,type:on.GRID,name:R.name,rowCount:R.rowCount,columnCount:R.columnCount,originalMeta:so(R)};if(o[E]=H,R.cellData){const k=oo(R.cellData,R.rowCount),tt=await Promise.all(k.map(mt=>r.saveSheetBlock(t,{unitID:n,type:nt.UNIVER_SHEET,block:mt})));if(tt.some(mt=>{var ft;return((ft=mt.error)==null?void 0:ft.code)!==xt.OK}))return!1;i[E]={sheetID:E,blocks:tt.map(mt=>mt.blockID)}}return!0})))throw new Error("[transformWorkbookDataToSnapshot()]: Failed to save sheet blocks.");const a=ro(e),d={unitID:e.id,rev:s,creator:"",name:e.name,sheetOrder:e.sheetOrder,sheets:o,blockMeta:i,resources:e.resources||[],originalMeta:a},h={unitID:n,rev:d.rev,type:nt.UNIVER_SHEET,workbook:d,doc:void 0},c=await r.saveSnapshot(t,{unitID:n,type:nt.UNIVER_SHEET,snapshot:h});if(ri(c.error))throw new Error(`transformWorkbookDataToSnapshot(): Failed to save snapshot.
|
|
8
|
+
ErrorCode: ${(f=c.error)==null?void 0:f.code}:${(_=c.error)==null?void 0:_.message}`);return{snapshot:h}}function ju(t,e,n){const s=t.workbook;if(!s)throw new Error("");const r={};Object.entries(s.sheets).forEach(([a,d])=>{const h=io(d.originalMeta);r[a]={id:d.id,name:d.name,rowCount:d.rowCount,columnCount:d.columnCount,...h}});const i=new Map;e.forEach(a=>{i.set(a.id,a)}),s.blockMeta&&Object.entries(s.blockMeta).forEach(([a,d])=>{var f;const h=r[a];h.cellData={};const c=[];(f=d.blocks)==null||f.forEach(_=>{const E=i.get(_);if(E)c.push(E);else throw new Error("")}),c.forEach(_=>{const E=Bu(_.data);Object.entries(E).forEach(([R,H])=>{const k=h.cellData[+R]={};Object.entries(H).forEach(([tt,mt])=>{k[+tt]=mt})})})});const o=io(s.originalMeta);return{id:t.unitID,rev:s.rev,name:s.name,sheetOrder:s.sheetOrder,appVersion:"",locale:pe.EN_US,sheets:r,styles:{},resources:s.resources||[],...o}}function xu(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={}}=Wu(i);return{id:n,rev:s,locale:pe.EN_US,title:r,body:o,documentStyle:l,settings:a}}async function Ku(t,e,n,s,r){var a,d,h;const i={unitID:e.id,rev:s,creator:"",name:(a=e.title)!=null?a:"",resources:e.resources||[],originalMeta:Fu(e)},o={unitID:n,rev:i.rev,type:nt.UNIVER_DOC,workbook:void 0,doc:i},l=await r.saveSnapshot(t,{unitID:n,type:nt.UNIVER_DOC,snapshot:o});if(ri(l.error))throw new Error(`transformDocumentDataToSnapshot(): Failed to save snapshot.
|
|
9
|
+
ErrorCode: ${(d=l.error)==null?void 0:d.code}:${(h=l.error)==null?void 0:h.message}`);return{snapshot:o}}async function Yu(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 d={unitID:n.unitID,type:nt.UNIVER_SHEET,blockID:a},{block:h}=await e.getSheetBlock({},d);if(h)s.push(h);else throw new Error("Block not found")});r.push(...l)}),await Promise.all(r),s}var lo=(t=>(t[t.INFO=0]="INFO",t[t.STOP=1]="STOP",t[t.WARNING=2]="WARNING",t))(lo||{}),ao=(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))(ao||{}),uo=(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))(uo||{}),co=(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))(co||{}),ho=(t=>(t.VALID="valid",t.INVALID="invalid",t.VALIDATING="validating",t))(ho||{});Co(),u.ABCToNumber=Tl,u.AbsoluteRefType=Nt,u.ActionIterator=_s,u.AlignTypeH=Ir,u.AlignTypeV=Or,u.ArrangeTypeEnum=br,u.ArrowsAndMarkersShapes=zs,u.AutoFillSeries=Ps,u.BaselineOffset=Le,u.BasicShapes=Ys,u.BlockType=sr,u.BooleanNumber=Z,u.BorderStyleTypes=dt,u.BorderType=ks,u.BulletAlignment=de,u.COLORS=kn,u.CellValueType=Oe,u.ClientSnapshotServerService=ku,u.Color=Se,u.ColorBuilder=cn,u.ColorKit=Jt,u.ColorType=jt,u.ColumnSeparatorType=or,u.CommandType=Ye,u.CommonHideTypes=Hs,u.ConfigService=Si,u.ContentAlignment=mr,u.ContextService=Zr,u.CopyPasteType=Fs,u.CustomRangeType=nr,u.DEFAULT_CELL=Wl,u.DEFAULT_DOC=gs,u.DEFAULT_DOCUMENT_SUB_COMPONENT_ID=Io,u.DEFAULT_EMPTY_DOCUMENT_VALUE=eu,u.DEFAULT_RANGE=Fl,u.DEFAULT_RANGE_ARRAY=Hl,u.DEFAULT_SELECTION=Bl,u.DEFAULT_SLIDE=zr,u.DEFAULT_STYLES=pn,u.DEFAULT_WORKSHEET_COLUMN_COUNT=Ai,u.DEFAULT_WORKSHEET_COLUMN_COUNT_KEY=Aa,u.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT=Ui,u.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY=Ua,u.DEFAULT_WORKSHEET_COLUMN_WIDTH=Ti,u.DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY=Ta,u.DEFAULT_WORKSHEET_ROW_COUNT=vi,u.DEFAULT_WORKSHEET_ROW_COUNT_KEY=va,u.DEFAULT_WORKSHEET_ROW_HEIGHT=wi,u.DEFAULT_WORKSHEET_ROW_HEIGHT_KEY=wa,u.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH=Mi,u.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY=Ma,u.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY=Vi,u.DOCS_NORMAL_EDITOR_UNIT_ID_KEY=Gi,u.DashStyleType=fr,u.DataStreamTreeNodeType=ii,u.DataStreamTreeTokenType=Qn,u.DataValidationErrorStyle=lo,u.DataValidationImeMode=ao,u.DataValidationOperator=uo,u.DataValidationRenderMode=eo,u.DataValidationStatus=ho,u.DataValidationType=co,u.DependentOn=fu,u.DesktopLogService=ti,u.DeveloperMetadataVisibility=Bs,u.Dimension=Ws,u.Direction=$s,u.Disposable=yt,u.DisposableCollection=Vn,u.DocStyleType=tr,u.DocumentDataModel=ve,u.DrawingTypeEnum=vr,u.EDITOR_ACTIVATED=yi,u.EXTENSION_NAMES=Xr,u.Entry=jn,u.EntryIterator=jr,u.ErrorService=Ni,u.EventState=Wr,u.FOCUSING_COMMON_DRAWINGS=xa,u.FOCUSING_DOC=vn,u.FOCUSING_EDITOR_BUT_HIDDEN=Wa,u.FOCUSING_EDITOR_INPUT_FORMULA=$a,u.FOCUSING_EDITOR_STANDALONE=Va,u.FOCUSING_FORMULA_EDITOR=Pi,u.FOCUSING_SHEET=Je,u.FOCUSING_SLIDE=An,u.FOCUSING_UNIVER_EDITOR=Ga,u.FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE=ja,u.FollowNumberWithType=er,u.FontItalic=ln,u.FontStyleType=Er,u.FontWeight=an,u.FormatType=Gs,u.GlyphType=Ve,u.GridType=rr,u.HLSColor=Zs,u.HorizontalAlign=Ie,u.IAuthzIoService=Qi,u.ICommandService=ze,u.IConfigService=Oi,u.IContextService=Ke,u.ILocalStorageService=Lu,u.ILogService=me,u.IPermissionService=Cs,u.IResourceLoaderService=Is,u.IResourceManagerService=Mn,u.ISnapshotServerService=Pu,u.IUndoRedoService=Un,u.IUniverInstanceService=Pe,u.InterceptorManager=yu,u.InterpolationPointType=Vs,u.JSON1=ma,u.JSONX=be,u.KeyIterator=Gr,u.LRUHelper=xe,u.LRUMap=xr,u.LifecycleStages=It,u.LocaleService=Ze,u.LocaleType=pe,u.LogLevel=Qr,u.MOVE_BUFFER_VALUE=We,u.MemoryCursor=pi,u.NamedStyleType=hr,u.NilCommand=ni,u.NumberUnitType=pr,u.ObjectMatrix=Zt,u.ObjectRelativeFromH=Rr,u.ObjectRelativeFromV=Cr,u.Observable=mn,u.ObservableHooks=Uu,u.Observer=gn,u.OnLifecycle=Hi,u.OtherShapes=Xs,u.PRESET_LIST_TYPE=Ql,u.PageElementType=Ar,u.PageOrientType=Nr,u.PageType=Bn,u.ParagraphElementType=ar,u.PermissionService=Bi,u.PermissionStatus=Rs,u.Plugin=Ns,u.PositionedObjectLayoutType=cr,u.PresetListType=Nn,u.ProtectionType=js,u.RANGE_TYPE=ot,u.RGBA_PAREN=Ao,u.RGB_PAREN=vo,u.ROTATE_BUFFER_VALUE=Ls,u.Range=ye,u.Rectangle=ge,u.RedoCommand=zi,u.RedoCommandId=xi,u.RefAlias=wl,u.Registry=Jn,u.RegistryAsMap=Zn,u.RelativeDate=xs,u.RelativeSlideLink=wr,u.ResourceManagerService=Wi,u.RgbColor=hn,u.RxDisposable=Cl,u.SectionType=ir,u.SheetTypes=on,u.SheetViewModel=Di,u.SlideDataModel=ms,u.SpacingRule=dr,u.SpecialShapes=qs,u.Styles=bi,u.THEME_COLORS=Js,u.TabStopAlignment=_r,u.TextDecoration=Ks,u.TextDirection=$e,u.TextDirectionType=lr,u.TextX=Ee,u.TextXActionType=Q,u.ThemeColor=dn,u.ThemeColorType=Bt,u.ThemeColors=un,u.ThemeService=Os,u.Tools=y,u.UndoCommand=Yi,u.UndoCommandId=Ki,u.UnitModel=Sn,u.Univer=pu,u.UniverInstanceType=nt,u.UpdateDocsAttributeType=kt,u.ValueIterator=Vr,u.VerticalAlign=Ue,u.WidthType=gr,u.Worksheet=qe,u.WrapStrategy=Ge,u.WrapTextType=ur,u.afterInitApply=Zl,u.b64DecodeUnicode=As,u.b64EncodeUnicode=Hu,u.binarySearchArray=Ds,u.cellToRange=cl,u.characterSpacingControlType=Sr,u.checkForSubstrings=hl,u.checkIfMove=Oo,u.checkParagraphHasBullet=dl,u.checkParagraphHasIndent=fl,u.checkParagraphHasIndentByStyle=Ur,u.codeToBlob=No,u.composeBody=ss,u.composeInterceptors=no,u.concatMatrixArray=Nl,u.convertBodyToHtml=kl,u.covertTextRunToHtml=Xn,u.createDefaultUser=Dn,u.createInterceptorKey=Du,u.createInternalEditorID=nu,u.createRowColIter=zn,u.debounce=Pl,u.dedupe=pl,u.deepCompare=Wn,u.deleteContent=Dr,u.extractPureTextFromCell=La,u.fromCallback=si,u.fromObservable=Rl,u.generateTemporarySnap=Gu,u.getArrayLength=_e,u.getBodySlice=Xe,u.getBodySliceHtml=Cn,u.getBorderStyleType=ll,u.getCellInfoInMergeData=Ko,u.getCellValueType=Go,u.getColorStyle=se,u.getDocsUpdateBody=al,u.getReverseDirection=bo,u.getSheetBlocksFromSnapshot=Yu,u.getWorksheetUID=Ba,u.groupBy=Sl,u.handleJsonToDom=il,u.handleStyleToString=ol,u.hashAlgorithm=gl,u.horizontalLineSegmentsSubtraction=$n,u.insertMatrixArray=xn,u.insertTextToContent=Lr,u.isBlackColor=Bo,u.isBooleanString=vu,u.isCellCoverable=nl,u.isCellV=jo,u.isEmptyCell=Tr,u.isFormulaId=rl,u.isFormulaString=sl,u.isICellData=$o,u.isInternalEditorID=su,u.isNullCell=Vo,u.isNumeric=to,u.isObserver=$r,u.isRangesEqual=Ou,u.isRealNum=_l,u.isSafeNumeric=bu,u.isSameStyleTextRun=Mr,u.isUnitRangesEqual=Su,u.isValidRange=ul,u.isWhiteColor=Wo,u.makeCellRangeToRangeData=el,u.makeCellToSelection=tl,u.mergeOverrideWithDependencies=Ji,u.mergeSets=Au,u.mergeWorksheetSnapshotWithDefault=Li,u.moveMatrixArray=Yn,u.moveRangeByOffset=xl,u.normalizeTextRuns=ts,u.numberToABC=Ul,u.numberToListABC=Ll,u.orderSearchArray=ys,u.queryObjectMatrix=jl,u.remove=En,u.repeatStringNumTimes=Yr,u.replaceInDocumentBody=Mu,u.requestImmediateMacroTask=Tu,u.rotate=Ol,u.runOnLifecycle=Tn,u.searchArray=So,u.selectionToArray=xo,u.sequence=Jr,u.sequenceAsync=qr,u.sequenceExecute=qn,u.sequenceExecuteAsync=Jl,u.shallowEqual=Nu,u.sliceMatrixArray=bl,u.sortRules=Dl,u.sortRulesByDesc=yl,u.sortRulesFactory=De,u.spliceArray=Kn,u.textDecoder=yn,u.textEncoder=tn,u.throttle=wu,u.toDisposable=bt,u.transformDocumentDataToSnapshot=Ku,u.transformSnapshotToDocumentData=xu,u.transformSnapshotToWorkbookData=ju,u.transformWorkbookDataToSnapshot=Vu,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
|