@univerjs/core 0.6.10 → 0.7.0-beta.0

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 CHANGED
@@ -1,8 +1,8 @@
1
- "use strict";var Ju=Object.defineProperty;var Zu=(e,t,n)=>t in e?Ju(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var C=(e,t,n)=>Zu(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const we=require("rxjs"),br=require("rxjs/operators"),je=require("@wendellhu/redi");function Qu(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in e)){const i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}const gr=typeof global<"u"?global:typeof self<"u"?self:window;function ec(){const t=new Map;let n=0;typeof gr.requestIdleCallback!="function"&&(gr.requestIdleCallback=function(s){const i=Date.now(),o=++n,a=setTimeout(function(){t.delete(o);const u=Math.max(0,50-(Date.now()-i));s({didTimeout:u===0,timeRemaining(){return u}})},1);return t.set(o,a),o}),typeof gr.cancelIdleCallback!="function"&&(gr.cancelIdleCallback=function(s){const i=t.get(s);i!==void 0&&(clearTimeout(i),t.delete(s))})}function tc(){ec()}function tr(e,t){const n=e.indexOf(t);return n>-1?(e.splice(n,1),!0):!1}function nc(e){const t=new Set,n=[];for(const r of e)t.has(r)||(t.add(r),n.push(r));return n}function rc(e,t){const n=new Set,r=[];for(const s of e){const i=t(s);n.has(i)||(n.add(i),r.push(s))}return r}function sc(e,t){for(let n=e.length-1;n>-1;n--){const r=e[n];if(t(r,n))return r}return null}function ic(e,t){if(e.length===0)return e;const n=t%e.length;return e.slice(n).concat(e.slice(0,n))}function oc(e,t){const n=new Map;return e.forEach(r=>{const s=t(r);let i=n.get(s);n.has(s)||(i=[],n.set(s,i)),i.push(r)}),n}function ac(e){return Array.isArray(e)?e:[e]}function lc(e,t){t.forEach(n=>e.add(n))}function ko(e,t){t.forEach(([n])=>{e.has(n)&&e.get(n)})}class ws extends Error{constructor(t){super(t),this.name="CustomCommandExecutionError"}}class uc extends Error{constructor(){super("Canceled by facade"),this.name="CanceledError"}}async function Fo(e){for(const[t,n]of e.entries())try{if(!await n())return{index:t,result:!1}}catch(r){return{index:t,result:!1,error:r}}return{result:!0,index:-1}}function $o(e){for(const[t,n]of e.entries())try{if(!n())return{index:t,result:!1}}catch(r){return{index:t,result:!1,error:r}}return{result:!0,index:-1}}function cc(e){return e instanceof we.Subscription||e instanceof we.Subject||e&&"closed"in e&&typeof e.unsubscribe<"u"}function nt(e){let t=!1;return e?cc(e)?{dispose:()=>e.unsubscribe()}:typeof e=="function"?{dispose:()=>{t||(t=!0,e())}}:e:nt(()=>{})}function hc(e){return nt(()=>{e.unsubscribe()})}class Kr{constructor(){C(this,"_disposables",new Set)}add(t){const n=nt(t);return this._disposables.add(n),{dispose:(r=!1)=>{r||n.dispose(),this._disposables.delete(n)}}}dispose(){this._disposables.forEach(t=>{t.dispose()}),this._disposables.clear()}}class st{constructor(){C(this,"_disposed",!1);C(this,"_collection",new Kr)}disposeWithMe(t){return this._collection.add(t)}ensureNotDisposed(){if(this._disposed)throw new Error("[Disposable]: object is disposed!")}dispose(){this._disposed||(this._disposed=!0,this._collection.dispose())}}class dc extends st{constructor(){super(...arguments);C(this,"dispose$",new we.Subject)}dispose(){super.dispose(),this.dispose$.next(),this.dispose$.complete()}}class fc extends st{constructor(n){super();C(this,"_ref",0);this._rootDisposable=n}inc(){if(this._disposed)throw new Error("[RCDisposable]: should not ref to a disposed.");this._ref+=1}dec(){this._ref-=1,this._ref===0&&(this._rootDisposable.dispose(),this.dispose())}}const Nn=je.createIdentifier("univer.context-service");class Bo extends st{constructor(){super(...arguments);C(this,"_contextChanged$",new we.Subject);C(this,"contextChanged$",this._contextChanged$.asObservable());C(this,"_contextMap",new Map)}dispose(){super.dispose(),this._contextChanged$.complete()}getContextValue(n){var r;return(r=this._contextMap.get(n))!=null?r:!1}setContextValue(n,r){this._contextMap.set(n,r),this._contextChanged$.next({[n]:r})}subscribeContextValue$(n){return new we.Observable(r=>{const s=this._contextChanged$.pipe(we.filter(i=>typeof i[n]<"u")).subscribe(i=>r.next(i[n]));return this._contextMap.has(n)&&r.next(this._contextMap.get(n)),()=>s.unsubscribe()})}}var Ho=(e=>(e[e.SILENT=0]="SILENT",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.VERBOSE=4]="VERBOSE",e))(Ho||{});const wt=je.createIdentifier("univer.log");class jo extends st{constructor(){super(...arguments);C(this,"_logLevel",3);C(this,"_deduction",new Set)}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)}deprecate(...n){this._logLevel>=2&&this._logWithDeduplication(console.error,...n)}setLogLevel(n){this._logLevel=n}_log(n,...r){const s=r[0];/^\[(.*?)\]/g.test(s)?n(`\x1B[97;104m${s}\x1B[0m`,...r.slice(1)):n(...r)}_logWithDeduplication(n,...r){const s=gc(...r);this._deduction.has(s)||(this._deduction.add(s),this._log(n,...r))}}function gc(...e){return e.map(t=>JSON.stringify(t)).join("")}var mc=Object.getOwnPropertyDescriptor,_c=(e,t,n,r)=>{for(var s=r>1?void 0:r?mc(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},yi=(e,t)=>(n,r)=>t(n,r,e),nr=(e=>(e[e.COMMAND=0]="COMMAND",e[e.OPERATION=1]="OPERATION",e[e.MUTATION=2]="MUTATION",e))(nr||{});const rr=je.createIdentifier("univer.core.command-service");class pc{constructor(){C(this,"_commands",new Map);C(this,"_commandTypes",new Map)}registerCommand(t){if(this._commands.has(t.id))throw new Error(`[CommandRegistry]: command "${t.id}" has been registered before.`);return this._commands.set(t.id,t),this._commandTypes.set(t.id,t.type),nt(()=>{this.unregisterCommand(t.id)})}unregisterCommand(t){this._commands.delete(t),this._commandTypes.delete(t)}hasCommand(t){return this._commands.has(t)}getCommand(t){return this._commands.has(t)?[this._commands.get(t)]:null}getCommandType(t){return this._commandTypes.get(t)}}const Wo={id:"nil",type:0,handler:()=>!0};exports.CommandService=class extends st{constructor(n,r){super();C(this,"_commandRegistry");C(this,"_beforeCommandExecutionListeners",[]);C(this,"_commandExecutedListeners",[]);C(this,"_multiCommandDisposables",new Map);C(this,"_commandExecutingLevel",0);C(this,"_commandExecutionStack",[]);this._injector=n,this._logService=r,this._commandRegistry=new pc,this.registerCommand(Wo)}dispose(){super.dispose(),this._commandExecutedListeners.length=0,this._beforeCommandExecutionListeners.length=0}hasCommand(n){return this._commandRegistry.hasCommand(n)}registerCommand(n){return this._commandRegistry.registerCommand(n)}unregisterCommand(n){var r;this._commandRegistry.unregisterCommand(n),(r=this._multiCommandDisposables.get(n))==null||r.dispose()}registerMultipleCommand(n){return this._registerMultiCommand(n)}beforeCommandExecuted(n){if(this._beforeCommandExecutionListeners.indexOf(n)===-1)return this._beforeCommandExecutionListeners.push(n),nt(()=>{const r=this._beforeCommandExecutionListeners.indexOf(n);this._beforeCommandExecutionListeners.splice(r,1)});throw new Error("[CommandService]: could not add a listener twice.")}onCommandExecuted(n){if(this._commandExecutedListeners.indexOf(n)===-1)return this._commandExecutedListeners.push(n),nt(()=>{const r=this._commandExecutedListeners.indexOf(n);this._commandExecutedListeners.splice(r,1)});throw new Error("[CommandService]: could not add a listener twice.")}async executeCommand(n,r,s){try{const i=this._commandRegistry.getCommand(n);if(i){const[o]=i,a={id:o.id,type:o.type,params:r},l=this._pushCommandExecutionStack(a);this._beforeCommandExecutionListeners.forEach(c=>c(a,s));const u=await this._execute(o,r,s);return this._commandExecutedListeners.forEach(c=>c(a,s)),l.dispose(),u}throw new Error(`[CommandService]: command "${n}" is not registered.`)}catch(i){if(i instanceof ws)return!1;throw i}}syncExecuteCommand(n,r,s){var i;try{const o=this._commandRegistry.getCommand(n);if(o){const[a]=o,l={id:a.id,type:a.type,params:r};if(a.type===2){const h=sc(this._commandExecutionStack,d=>d.type===0);h&&(l.params=(i=l.params)!=null?i:{},l.params.trigger=h.id)}const u=this._pushCommandExecutionStack(l);this._beforeCommandExecutionListeners.forEach(h=>h(l,s));const c=this._syncExecute(a,r,s);return this._commandExecutedListeners.forEach(h=>h(l,s)),u.dispose(),c}throw new Error(`[CommandService]: command "${n}" is not registered.`)}catch(o){if(o instanceof ws)return!1;throw o}}_pushCommandExecutionStack(n){return this._commandExecutionStack.push(n),nt(()=>tr(this._commandExecutionStack,n))}_registerMultiCommand(n){const r=this._commandRegistry.getCommand(n.id);let s;if(r){if(r[0].multi!==!0)throw new Error("Command has registered as a single command.");s=r[0]}else{s=new Ec(n.id);const o=new Kr;o.add(this._commandRegistry.registerCommand(s)),o.add(nt(()=>{this._multiCommandDisposables.delete(n.id)})),this._multiCommandDisposables.set(n.id,o)}const i=s.registerImplementation(n);return nt(()=>{var o;i.dispose(),s.hasImplementations()||(o=this._multiCommandDisposables.get(n.id))==null||o.dispose()})}async _execute(n,r,s){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(this._commandExecutingLevel,0))}executing command "${n.id}"`),this._commandExecutingLevel++;let i;try{i=await this._injector.invoke(n.handler,r,s),this._commandExecutingLevel--}catch(o){throw i=!1,this._commandExecutingLevel=0,o}return i}_syncExecute(n,r,s){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(0,this._commandExecutingLevel))}executing command "${n.id}".`),this._commandExecutingLevel++;let i;try{if(i=this._injector.invoke(n.handler,r,s),i instanceof Promise)throw new TypeError("[CommandService]: Command handler should not return a promise.");this._commandExecutingLevel--}catch(o){throw i=!1,this._commandExecutingLevel=0,o}return i}};exports.CommandService=_c([yi(0,je.Inject(je.Injector)),yi(1,wt)],exports.CommandService);class Ec{constructor(t){C(this,"name");C(this,"multi",!0);C(this,"type",0);C(this,"priority",0);C(this,"_implementations",[]);C(this,"handler",async(t,n)=>{if(!this._implementations.length)return!1;const r=t.get(wt),s=t.get(Nn),i=t.get(je.Injector);for(const o of this._implementations){const a=o.command.preconditions;if((!a||a&&a(s))&&(r.debug("[MultiCommand]",`executing implementation "${o.command.name}".`),await i.invoke(o.command.handler,n)))return!0}return!1});this.id=t,this.name=t}registerImplementation(t){const n={command:t};return this._implementations.push(n),this._implementations.sort((r,s)=>s.command.priority-r.command.priority),nt(()=>{const r=this._implementations.indexOf(n);this._implementations.splice(r,1)})}hasImplementations(){return this._implementations.length>0}}function Xr(e,t,n){const r=e.map(s=>()=>t.syncExecuteCommand(s.id,s.params,n));return $o(r)}function Cc(e,t,n){const r=e.map(s=>()=>t.executeCommand(s.id,s.params,n));return Fo(r)}function Yo(e){return new we.Observable(t=>{const n=e((...r)=>t.next(r));return()=>n==null?void 0:n.dispose()})}function bs(e){return function(n){return new we.Observable(r=>(n.subscribe({next:s=>{r.next(s),e(s)&&r.complete()},complete:()=>r.complete(),error:s=>r.error(s)}),()=>r.unsubscribe()))}}function Rc(e=0){return t=>{let n=[];return t.pipe(we.tap(r=>n.push(r)),we.debounceTime(e),we.map(()=>n),we.tap(()=>n=[]))}}function Ic(e){const t=new we.ReplaySubject(1);return setTimeout(()=>t.next(),e),t.pipe(we.take(1))}function Sc(e,t){const n=new we.BehaviorSubject(t);return e.subscribe(n),n}const vc=e=>new Promise(t=>{we.merge(Yo(e.onCommandExecuted.bind(e)).pipe(br.filter(([n])=>n.type===nr.MUTATION)),we.timer(300)).pipe(br.debounceTime(16),br.first()).subscribe(()=>{t()})});function zo(e,t){let n=0,r=e.length-1;if(t<e[0])return 0;if(t>=e[e.length-1])return e.length-1;for(;n<=r;){if(e[n]===t){for(;n<e.length&&e[n]===t;)n++;return n}if(t>e[n]&&t<e[n+1])return n+1;if(e[r]===t){for(;r<e.length&&e[r]===t;)r++;return r}if(t>e[r-1]&&t<e[r])return r;n++,r--}return-1}function Oc(e,t){let n=0,r=e.length-1;for(;n<=r;){const s=Math.floor((r+n)/2);if(t<e[s]&&(s===0||t>=e[s-1]))return s;if(t>=e[s])n=s+1;else if(t<e[s])r=s-1;else return-1}return-1}function Go(e,t){let n=0,r=e.length;for(;n<r;){const s=Math.floor((n+r)/2);e[s]<=t?n=s+1:r=s}return n<e.length?n:e.length-1}function Fn(e,t,n=!1){let r=e.length-1;if(t<0||t<e[0])return 0;if(e.length<40||t<=e[20]||t>=e[r-20]?r=zo(e,t):r=Go(e,t),n){const s=e[r];return e.indexOf(s)}return r}function wc(e){const t=new Blob([e],{type:"text/javascript"});return window.URL.createObjectURL(t)}const $n=2,Vo=1;function bc(e,t){if(t==null||e==null)return!0;const{left:n=0,top:r=0,height:s=0,width:i=0,angle:o=0}=t,{left:a=0,top:l=0,height:u=0,width:c=0,angle:h=0}=e,d=c,f=u,p=i,R=s;return Math.abs(a-n)>$n||Math.abs(l-r)>$n||Math.abs(d-p)>$n||Math.abs(f-R)>$n||Math.abs(h-o)>Vo}var Ko=(e=>(e[e.DEFAULT_SERIES=0]="DEFAULT_SERIES",e[e.ALTERNATE_SERIES=1]="ALTERNATE_SERIES",e))(Ko||{}),Xe=(e=>(e[e.NONE=0]="NONE",e[e.THIN=1]="THIN",e[e.HAIR=2]="HAIR",e[e.DOTTED=3]="DOTTED",e[e.DASHED=4]="DASHED",e[e.DASH_DOT=5]="DASH_DOT",e[e.DASH_DOT_DOT=6]="DASH_DOT_DOT",e[e.DOUBLE=7]="DOUBLE",e[e.MEDIUM=8]="MEDIUM",e[e.MEDIUM_DASHED=9]="MEDIUM_DASHED",e[e.MEDIUM_DASH_DOT=10]="MEDIUM_DASH_DOT",e[e.MEDIUM_DASH_DOT_DOT=11]="MEDIUM_DASH_DOT_DOT",e[e.SLANT_DASH_DOT=12]="SLANT_DASH_DOT",e[e.THICK=13]="THICK",e))(Xe||{}),Xo=(e=>(e.TOP="top",e.BOTTOM="bottom",e.LEFT="left",e.RIGHT="right",e.NONE="none",e.ALL="all",e.OUTSIDE="outside",e.INSIDE="inside",e.HORIZONTAL="horizontal",e.VERTICAL="vertical",e.TLBR="tlbr",e.TLBC_TLMR="tlbc_tlmr",e.TLBR_TLBC_TLMR="tlbr_tlbc_tlmr",e.BLTR="bl_tr",e.MLTR_BCTR="mltr_bctr",e))(Xo||{}),Rt=(e=>(e[e.UNSUPPORTED=0]="UNSUPPORTED",e[e.RGB=1]="RGB",e[e.HEX=2]="HEX",e[e.THEME=3]="THEME",e))(Rt||{}),qo=(e=>(e[e.ON=0]="ON",e[e.OFF=1]="OFF",e))(qo||{}),Jo=(e=>(e[e.PASTE_NORMAL=0]="PASTE_NORMAL",e[e.PASTE_NO_BORDERS=1]="PASTE_NO_BORDERS",e[e.PASTE_FORMAT=2]="PASTE_FORMAT",e[e.PASTE_FORMULA=3]="PASTE_FORMULA",e[e.PASTE_DATA_VALIDATION=4]="PASTE_DATA_VALIDATION",e[e.PASTE_VALUES=5]="PASTE_VALUES",e[e.PASTE_CONDITIONAL_FORMATTING=6]="PASTE_CONDITIONAL_FORMATTING",e[e.PASTE_COLUMN_WIDTHS=7]="PASTE_COLUMN_WIDTHS",e))(Jo||{}),Zo=(e=>(e[e.LEFT=0]="LEFT",e[e.RIGHT=1]="RIGHT",e))(Zo||{}),Qo=(e=>(e[e.DOCUMENT=0]="DOCUMENT",e[e.PROJECT=1]="PROJECT",e))(Qo||{}),ea=(e=>(e[e.COLUMNS=0]="COLUMNS",e[e.ROWS=1]="ROWS",e))(ea||{}),ta=(e=>(e[e.UP=0]="UP",e[e.RIGHT=1]="RIGHT",e[e.DOWN=2]="DOWN",e[e.LEFT=3]="LEFT",e))(ta||{});function Ac(e){switch(e){case 3:return 1;case 1:return 3;case 0:return 2;case 2:return 0}}var na=(e=>(e[e.INTERPOLATION_POINT_TYPE_UNSPECIFIED=0]="INTERPOLATION_POINT_TYPE_UNSPECIFIED",e[e.MIN=1]="MIN",e[e.MAX=2]="MAX",e[e.NUMBER=3]="NUMBER",e[e.PERCENT=4]="PERCENT",e[e.PERCENTILE=5]="PERCENTILE",e))(na||{}),sr=(e=>(e.EN_US="enUS",e.FR_FR="frFR",e.ZH_CN="zhCN",e.RU_RU="ruRU",e.ZH_TW="zhTW",e.VI_VN="viVN",e.FA_IR="faIR",e))(sr||{}),Fr=(e=>(e[e.PERSON=0]="PERSON",e[e.FILE=1]="FILE",e[e.DATE=2]="DATE",e[e.LOCATION=3]="LOCATION",e[e.EVENT=4]="EVENT",e))(Fr||{}),ra=(e=>(e[e.RANGE=0]="RANGE",e[e.SHEET=1]="SHEET",e))(ra||{}),sa=(e=>(e.Line="line",e.LineInv="lineInv",e.Triangle="triangle",e.RtTriangle="rtTriangle",e.Rect="rect",e.Diamond="diamond",e.Parallelogram="parallelogram",e.Trapezoid="trapezoid",e.NonIsocelesTrapezoid="nonIsocelesTrapezoid",e.Pentagon="pentagon",e.Hexagon="hexagon",e.Heptagon="heptagon",e.Octagon="octagon",e.Decagon="decagon",e.Dodecagon="dodecagon",e.Star4="star4",e.Star5="star5",e.Star6="star6",e.Star7="star7",e.Star8="star8",e.Star10="star10",e.Star12="star12",e.Star16="star16",e.Star24="star24",e.Star32="star32",e.RoundRect="roundRect",e.Round1Rect="round1Rect",e.Round2SameRect="round2SameRect",e.Round2DiagRect="round2DiagRect",e.Ellipse="ellipse",e))(sa||{}),ia=(e=>(e.RightArrow="rightArrow",e.LeftArrow="leftArrow",e.UpArrow="upArrow",e.DownArrow="downArrow",e.LeftRightArrow="leftRightArrow",e.UpDownArrow="upDownArrow",e.QuadArrow="quadArrow",e.LeftRightUpArrow="leftRightUpArrow",e.BentArrow="bentArrow",e.UturnArrow="uturnArrow",e.CircularArrow="circularArrow",e.NotchedRightArrow="notchedRightArrow",e.HomePlate="homePlate",e.Chevron="chevron",e.LeftCircularArrow="leftCircularArrow",e.LeftRightCircularArrow="leftRightCircularArrow",e))(ia||{}),oa=(e=>(e.Plaque="plaque",e.Can="can",e.Cube="cube",e.Bevel="bevel",e.Donut="donut",e.NoSmoking="noSmoking",e.BlockArc="blockArc",e.FoldedCorner="foldedCorner",e))(oa||{}),aa=(e=>(e.SmileyFace="smileyFace",e.Heart="heart",e.LightningBolt="lightningBolt",e.Sun="sun",e.Moon="moon",e.Cloud="cloud",e.Arc="arc",e.Backpack="backpack",e.Frame="frame",e.HalfFrame="halfFrame",e.Corner="corner",e.Chord="chord",e.Pie="pie",e.Teardrop="teardrop",e.WedgeRectCallout="wedgeRectCallout",e.WedgeRRectCallout="wedgeRRectCallout",e.WedgeEllipseCallout="wedgeEllipseCallout",e.CloudCallout="cloudCallout",e.BorderCallout1="borderCallout1",e.BorderCallout2="borderCallout2",e.BorderCallout3="borderCallout3",e.AccentCallout1="accentCallout1",e.AccentCallout2="accentCallout2",e.AccentCallout3="accentCallout3",e.Callout1="callout1",e.Callout2="callout2",e.Callout3="callout3",e.ActionButtonBackPrevious="actionButtonBackPrevious",e.ActionButtonEnd="actionButtonEnd",e.ActionButtonForwardNext="actionButtonForwardNext",e.ActionButtonHelp="actionButtonHelp",e.ActionButtonHome="actionButtonHome",e.ActionButtonInformation="actionButtonInformation",e.ActionButtonMovie="actionButtonMovie",e.ActionButtonReturn="actionButtonReturn",e.ActionButtonSound="actionButtonSound",e))(aa||{}),la=(e=>(e[e.RELATIVE_DATE_UNSPECIFIED=0]="RELATIVE_DATE_UNSPECIFIED",e[e.PAST_YEAR=1]="PAST_YEAR",e[e.PAST_MONTH=2]="PAST_MONTH",e[e.PAST_WEEK=3]="PAST_WEEK",e[e.YESTERDAY=4]="YESTERDAY",e[e.TODAY=5]="TODAY",e[e.TOMORROW=6]="TOMORROW",e))(la||{}),ua=(e=>(e[e.GRID=0]="GRID",e[e.KANBAN=1]="KANBAN",e[e.GANTT=2]="GANTT",e))(ua||{}),Xn=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",e[e.RIGHT_TO_LEFT=2]="RIGHT_TO_LEFT",e))(Xn||{}),ca=(e=>(e[e.DASH=0]="DASH",e[e.DASH_DOT_DOT_HEAVY=1]="DASH_DOT_DOT_HEAVY",e[e.DASH_DOT_HEAVY=2]="DASH_DOT_HEAVY",e[e.DASHED_HEAVY=3]="DASHED_HEAVY",e[e.DASH_LONG=4]="DASH_LONG",e[e.DASH_LONG_HEAVY=5]="DASH_LONG_HEAVY",e[e.DOT_DASH=6]="DOT_DASH",e[e.DOT_DOT_DASH=7]="DOT_DOT_DASH",e[e.DOTTED=8]="DOTTED",e[e.DOTTED_HEAVY=9]="DOTTED_HEAVY",e[e.DOUBLE=10]="DOUBLE",e[e.NONE=11]="NONE",e[e.SINGLE=12]="SINGLE",e[e.THICK=13]="THICK",e[e.WAVE=14]="WAVE",e[e.WAVY_DOUBLE=15]="WAVY_DOUBLE",e[e.WAVY_HEAVY=16]="WAVY_HEAVY",e[e.WORDS=17]="WORDS",e))(ca||{}),bt=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LEFT=1]="LEFT",e[e.CENTER=2]="CENTER",e[e.RIGHT=3]="RIGHT",e[e.JUSTIFIED=4]="JUSTIFIED",e[e.BOTH=5]="BOTH",e[e.DISTRIBUTED=6]="DISTRIBUTED",e))(bt||{}),nn=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TOP=1]="TOP",e[e.MIDDLE=2]="MIDDLE",e[e.BOTTOM=3]="BOTTOM",e))(nn||{}),an=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.OVERFLOW=1]="OVERFLOW",e[e.CLIP=2]="CLIP",e[e.WRAP=3]="WRAP",e))(an||{}),$r=(e=>(e[e.NORMAL=0]="NORMAL",e[e.ITALIC=1]="ITALIC",e))($r||{}),Br=(e=>(e[e.NORMAL=0]="NORMAL",e[e.BOLD=1]="BOLD",e))(Br||{}),Pt=(e=>(e[e.NORMAL=1]="NORMAL",e[e.SUBSCRIPT=2]="SUBSCRIPT",e[e.SUPERSCRIPT=3]="SUPERSCRIPT",e))(Pt||{}),Ie=(e=>(e[e.FALSE=0]="FALSE",e[e.TRUE=1]="TRUE",e))(Ie||{}),Vt=(e=>(e[e.STRING=1]="STRING",e[e.NUMBER=2]="NUMBER",e[e.BOOLEAN=3]="BOOLEAN",e[e.FORCE_STRING=4]="FORCE_STRING",e))(Vt||{}),ft=(e=>(e[e.DARK1=0]="DARK1",e[e.LIGHT1=1]="LIGHT1",e[e.DARK2=2]="DARK2",e[e.LIGHT2=3]="LIGHT2",e[e.ACCENT1=4]="ACCENT1",e[e.ACCENT2=5]="ACCENT2",e[e.ACCENT3=6]="ACCENT3",e[e.ACCENT4=7]="ACCENT4",e[e.ACCENT5=8]="ACCENT5",e[e.ACCENT6=9]="ACCENT6",e[e.HYPERLINK=10]="HYPERLINK",e[e.FOLLOWED_HYPERLINK=11]="FOLLOWED_HYPERLINK",e))(ft||{}),qr=(e=>(e.OFFICE="Office",e.OFFICE_2007_2010="Office 2007-2010",e.GRAYSCALE="Grayscale",e.BLUE_WARM="Blue Warm",e.BLUE="Blue",e.BLUE_II="Blue II",e.BLUE_GREEN="Blue Green",e.GREEN="Green",e.GREEN_YELLOW="Green Yellow",e.YELLOW="Yellow",e.YELLOW_ORANGE="Yellow Orange",e.ORANGE="Orange",e.ORANGE_RED="Orange Red",e.RED_ORANGE="Red Orange",e.RED="Red",e.RED_VIOLET="Red Violet",e.VIOLET="Violet",e.VIOLET_II="Violet II",e.MEDIAN="Median",e.PAPER="Paper",e.MARQUEE="Marquee",e.SLIPSTREAM="Slipstream",e.Aspect="Aspect",e))(qr||{});const Tc="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let yc=e=>crypto.getRandomValues(new Uint8Array(e)),Nc=(e,t,n)=>{let r=(2<<Math.log2(e.length-1))-1,s=-~(1.6*r*t/e.length);return(i=t)=>{let o="";for(;;){let a=n(s),l=s|0;for(;l--;)if(o+=e[a[l]&r]||"",o.length>=i)return o}}},Mc=(e,t=21)=>Nc(e,t|0,yc),Dc=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=Tc[n[e]&63];return t};const ha=new Set(["ac","ad","ae","aero","af","ag","ai","al","am","ao","aq","ar","arpa","as","asia","at","au","aw","ax","az","ba","bb","bd","be","bf","bg","bh","bi","biz","bj","bm","bn","bo","br","bs","bt","bv","bw","by","bz","ca","cat","cc","cd","cf","cg","ch","ci","ck","cl","cm","cn","co","com","coop","cr","cu","cv","cw","cx","cy","cz","de","dj","dk","dm","do","dz","ec","edu","ee","eg","er","es","et","eu","fi","fj","fk","fm","fo","fr","ga","gb","gd","ge","gf","gg","gh","gi","gl","gm","gn","gov","gp","gq","gr","gs","gt","gu","gw","gy","hk","hm","hn","hr","ht","hu","id","ie","il","im","in","info","int","io","iq","ir","is","it","je","jm","jo","jobs","jp","ke","kg","kh","ki","km","kn","kp","kr","kw","ky","kz","la","lb","lc","li","lk","lr","ls","lt","lu","lv","ly","ma","mc","md","me","mg","mh","mil","mk","ml","mm","mn","mo","mobi","mp","mq","mr","ms","mt","mu","museum","mv","mw","mx","my","mz","na","name","nc","ne","net","nf","ng","ni","nl","no","np","nr","nu","nz","om","onion","org","pa","pe","pf","pg","ph","pk","pl","pm","pn","post","pr","pro","ps","pt","pw","py","qa","re","ro","rs","ru","rw","sa","sb","sc","sd","se","sg","sh","si","sj","sk","sl","sm","sn","so","sr","ss","st","su","sv","sx","sy","sz","tc","td","tel","tf","tg","th","tj","tk","tl","tm","tn","to","tr","tt","tv","tw","tz","ua","ug","uk","us","uy","uz","va","vc","ve","vg","vi","vn","vu","wf","ws","yt","za","zm","zw"]),Lc=new RegExp("^(?:(?:(?:https?|ftp):)?\\/\\/)?(?:\\S+(?::\\S*)?@)?(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z0-9\\u00a1-\\uffff][a-z0-9\\u00a1-\\uffff_-]{0,62})?[a-z0-9\\u00a1-\\uffff]\\.)+(?:[a-z\\u00a1-\\uffff]{2,}\\.?))(?::\\d{2,5})?(?:[/?#]\\S*)?$","i");function xc(e){if(!Number.isNaN(+e))return!1;if(e.startsWith("http://localhost:3002")||e.startsWith("localhost:3002"))return!0;if(Lc.test(e)){if(da(e))return!0;try{const r=new URL(fa(e)).hostname.split(".").pop();if(r&&ha.has(r))return!0}catch{return!1}}return!1}function da(e){return/^[a-zA-Z]+:\/\//.test(e)}function Uc(e){return/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(e)}function fa(e){return da(e)?e:Uc(e)?`mailto://${e}`:`https://${e}`}const Pc=/^-ms-/,kc=/-([a-z])/g,Wt=["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"];function Zs(e,t){const n=re.getValueType(e),r=re.getValueType(t);return n!==r?!1:re.isArray(e)?Fc(e,t):re.isObject(e)?$c(e,t):re.isDate(e)?e.getTime()===t.getTime():re.isRegExp(e)?e.toString()===t.toString():e===t}function Fc(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;n++){const s=e[n],i=t[n];if(!Zs(s,i))return!1}return!0}function $c(e,t){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const s of n){if(!r.includes(s))return!1;const i=e[s],o=t[s];if(!Zs(i,o))return!1}return!0}class re{static deleteNull(t){for(const n in t)(t[n]===null||t[n]===void 0)&&delete t[n];return t}static stringAt(t){let n="",r=t;for(;r>=Wt.length;)r/=Wt.length,r-=1,n+=Wt[r%Wt.length];const s=t%Wt.length;return n+=Wt[s],n}static indexAt(t){let n=0;for(let r=0;r<t.length-1;r+=1){const s=t.charCodeAt(r)-65,i=t.length-1-r;n+=Wt.length**i+Wt.length*s}return n+=t.charCodeAt(t.length-1)-65,n}static deleteBlank(t){return re.isString(t)?t.replace(/\s/g,""):t}static getSystemType(){const t=navigator.userAgent,n=navigator.platform==="Win32"||navigator.platform==="Windows",r=navigator.platform==="Mac68K"||navigator.platform==="MacPPC"||navigator.platform==="Macintosh"||navigator.platform==="MacIntel";if(r)return"Mac";if(navigator.platform==="X11"&&!n&&!r)return"Unix";if(String(navigator.platform).indexOf("Linux")>-1)return"Linux";if(n){if(t.indexOf("Windows NT 5.0")>-1||t.indexOf("Windows 2000")>-1)return"Windows 2000";if(t.indexOf("Windows NT 5.1")>-1||t.indexOf("Windows XP")>-1)return"Windows XP";if(t.indexOf("Windows NT 5.2")>-1||t.indexOf("Windows 2003")>-1)return"Windows 2003";if(t.indexOf("Windows NT 6.0")>-1||t.indexOf("Windows Vista")>-1)return"Windows Vista";if(t.indexOf("Windows NT 6.1")>-1||t.indexOf("Windows 7")>-1)return"Windows 7";if(t.indexOf("Windows NT 10")>-1||t.indexOf("Windows 10")>-1)return"Windows 10";if(t.indexOf("Windows NT 11")>-1||t.indexOf("Windows 11")>-1)return"Windows 11"}return"Unknown system"}static getBrowserType(){const t=navigator.userAgent,n=t.indexOf("Opera")>-1,r=t.indexOf("compatible")>-1&&t.indexOf("MSIE")>-1&&!n,s=t.indexOf("Trident")>-1&&t.indexOf("rv:11.0")>-1,i=t.indexOf("Edge")>-1,o=t.indexOf("Firefox")>-1,a=t.indexOf("Safari")>-1&&t.indexOf("Chrome")===-1,l=t.indexOf("Chrome")>-1&&t.indexOf("Safari")>-1;if(r){new RegExp("MSIE (\\d+\\.\\d+);").test(t);const c=Number.parseFloat(RegExp.$1);return c===7?"IE7":c===8?"IE8":c===9?"IE9":c===10?"IE10":"0"}return o?"FF":n?"Opera":a?"Safari":l?"Chrome":i?"Edge":s?"IE11":"Unknown browser"}static generateRandomId(t=21,n){return kt(t,n)}static getClassName(t){return t.constructor.name}static deepMerge(t,...n){n.forEach(o=>o&&i(o));function r(o,a){o.forEach((l,u)=>{var c,h;if(re.isArray(l)){const d=(c=a[u])!=null?c:[];a[u]=d,r(l,d);return}if(re.isObject(l)){const d=(h=a[u])!=null?h:{};a[u]=d,s(l,d);return}a[u]=l})}function s(o,a){Object.keys(o).forEach(l=>{var c,h;const u=o[l];if(re.isObject(u)){const d=(c=a[l])!=null?c:{};a[l]=d,s(u,d);return}if(re.isArray(u)){const d=(h=a[l])!=null?h:[];a[l]=d,r(u,d);return}a[l]=u})}function i(o){Object.keys(o).forEach(a=>{var u,c;const l=o[a];if(re.isArray(l)){const h=(u=t[a])!=null?u:[];t[a]=h,r(l,h);return}if(re.isObject(l)){const h=(c=t[a])!=null?c:{};t[a]=h,s(l,h);return}t[a]=l})}return t}static numberFixed(t,n){return Number(Number(t).toFixed(n))}static diffValue(t,n){return Zs(t,n)}static deepClone(t){if(!this.isDefine(t))return t;if(this.isRegExp(t))return new RegExp(t);if(this.isDate(t))return new Date(t);if(this.isArray(t)){const n=[];return t.forEach((r,s)=>{n[s]=re.deepClone(r)}),n}if(this.isObject(t)){const n={};return Object.keys(t).forEach(r=>{const s=t[r];n[r]=re.deepClone(s)}),Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n}return t}static getLanguage(){const t="en-US";return globalThis.navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||t}static getValueType(t){return Object.prototype.toString.apply(t)}static isDefine(t){return t!=null}static isBlank(t){return this.isDefine(t)?this.isString(t)?t.trim()==="":!1:!0}static isBoolean(t){return this.getValueType(t)==="[object Boolean]"}static isPlainObject(t){return this.isDefine(t)?Object.getPrototypeOf(t)===Object.getPrototypeOf({}):!1}static isFunction(t){return this.getValueType(t)==="[object Function]"}static isDate(t){return this.getValueType(t)==="[object Date]"}static isRegExp(t){return this.getValueType(t)==="[object RegExp]"}static isArray(t){return this.getValueType(t)==="[object Array]"}static isString(t){return this.getValueType(t)==="[object String]"}static isNumber(t){return this.getValueType(t)==="[object Number]"}static isStringNumber(t){return!isNaN(Number.parseFloat(t))&&isFinite(t)}static isObject(t){return this.getValueType(t)==="[object Object]"}static isEmptyObject(t){for(const n in t)return!1;return!0}static isMobile(){let t=0,n=0;return document.body.clientWidth&&(t=document.body.clientWidth),document.body.clientHeight&&(n=document.body.clientHeight),this.isAndroid()||this.isIPhone()||this.isTablet()||t<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 t=navigator.userAgent.toLowerCase();return String(t.match(/MicroMessenger/i))==="micromessenger"}static isAndroid(){const t=navigator.userAgent;return t.indexOf("Android")>-1||t.indexOf("Linux")>-1}static isIPhone(){return/iPhone/i.test(navigator.userAgent)}static isLegalUrl(t){return xc(t)}static normalizeUrl(t){return fa(t)}static topLevelDomainCombiningString(){return[...ha].join("|")}static itCount(t){return n=>{for(let r=0;r<t;r++)n&&n()}}static hasLength(t,n){return re.isDefine(t)?re.isDefine(n)?t.length===n:t.length>0:!1}static capitalize(t){return t.charAt(0).toUpperCase()+t.slice(1)}static fCamelCase(t,n){return n.toUpperCase()}static camelCase(t){return t.replace(Pc,"ms-").replace(kc,this.fCamelCase)}static removeNull(t){return this.isObject(t)&&Object.keys(t).forEach(n=>{const r=t[n];r==null?delete t[n]:re.removeNull(r)}),t}static fillTwoDimensionalArray(t,n,r){return new Array(t).fill(r).map(s=>new Array(n).fill(r))}static numToWord(t){let n="";for(;t>0;){let r=t%26;r=r===0?r=26:r,n=String.fromCharCode(96+r)+n,t=(t-r)/26}return n.toLocaleUpperCase()}static ABCatNum(t){if(t==null||t.length===0)return Number.NaN;const n=t.toLowerCase().split(""),r=n.length;let s=0,i=0;for(let o=0;o<r;o++)i=n[o].charCodeAt(0)-96,s+=i*26**(r-o-1);return s===0?Number.NaN:s-1}static chatAtABC(t){let i="";for(;t>=0;)i=String.fromCharCode(t%26+97)+i,t=Math.floor(t/26)-1;return i.toUpperCase()}static randSort(t){for(let n=0,r=t.length;n<r;n++){const s=Number.parseInt((Math.random()*r).toString()),i=t[s];t[s]=t[n],t[n]=i}return t}static commonExtend(t,n){const r={};for(const s in t)r[s]=t[s];for(const s in n)n[s]!=null&&(r[s]=n[s]);return r}static commonExtend1(t,n){for(const r in t)n[r]==null&&(n[r]=t[r]);return n}static arrayToObject(t){const n={};return t.forEach((r,s)=>{n[s]={},r.forEach((i,o)=>{n[s][o]=i})}),n}static hasIntersectionBetweenTwoRanges(t,n,r,s){return n>=r&&s>=t}static isStartValidPosition(t){return/^[A-Za-z_]/.test(t)}static isValidParameter(t){const n=/[~!@#$%^&*()+=\-{}\[\]\|:;"'<>,?\/ ]+/.test(t),r=t.length<=255;return!n&&r}static clamp(t,n,r){return Math.max(n,Math.min(r,t))}static now(){return performance&&performance.now?performance.now():Date.now()}}function kt(e=21,t){return t?Mc(t,e)():Dc(e)}function As(...e){const t={},n=e.length;for(let r=n-1;r>=0;r--){const s=e[r];if(s){const i=Object.keys(s);for(const o of i)t[o]===void 0&&(t[o]=s[o])}}return t}const Bc=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null;function Ar(e,t,n){const{dataStream:r,textRuns:s=[]}=e;let i=t;const o=[];for(const a of s){const{st:l,ed:u}=a;re.hasIntersectionBetweenTwoRanges(t,n,l,u)&&(l>i?(o.push(r.slice(i,l)),o.push(Ts(r,{...a,ed:Math.min(u,n)}))):o.push(Ts(r,{...a,st:i,ed:Math.min(u,n)}))),i=Math.max(t,Math.min(u,n))}return i!==n&&o.push(r.slice(i,n)),o.join("")}function Hc(e,t=!0){var n;if(t&&((n=e.paragraphs)!=null&&n.length)){const{dataStream:r,paragraphs:s=[]}=e;let i="",o=-1;for(const a of s){const{startIndex:l,paragraphStyle:u={}}=a,{spaceAbove:c,spaceBelow:h,lineSpacing:d}=u,f=[];c!=null&&(typeof c=="number"?f.push(`margin-top: ${c}px`):f.push(`margin-top: ${c.v}px`)),h!=null&&(typeof h=="number"?f.push(`margin-bottom: ${h}px`):f.push(`margin-bottom: ${h.v}px`)),d!=null&&f.push(`line-height: ${d}`),l>o+1?i+=`<p class="UniverNormal" ${f.length?`style="${f.join("; ")};"`:""}>${Ar(e,o+1,l)}</p>`:i+=`<p class="UniverNormal" ${f.length?`style="${f.join("; ")};"`:""}></p>`,o=l}return o!==r.length&&(i+=Ar(e,o,r.length)),i}else return Ar(e,0,e.dataStream.length)}function Ts(e,t){const{st:n,ed:r,ts:s={}}=t,{ff:i,fs:o,it:a,bl:l,ul:u,st:c,ol:h,bg:d,cl:f,va:p}=s;let R=e.slice(n,r);const w=[];return a===Ie.TRUE&&(R=`<i>${R}</i>`),p===Pt.SUPERSCRIPT?R=`<sup>${R}</sup>`:p===Pt.SUBSCRIPT&&(R=`<sub>${R}</sub>`),(u==null?void 0:u.s)===Ie.TRUE&&(R=`<u>${R}</u>`),(c==null?void 0:c.s)===Ie.TRUE&&(R=`<s>${R}</s>`),l===Ie.TRUE&&(R=`<strong>${R}</strong>`),i&&w.push(`font-family: ${i}`),f&&w.push(`color: ${f.rgb}`),o&&w.push(`font-size: ${o}pt`),h&&w.push("text-decoration: overline"),d&&w.push(`background: ${d.rgb}`),w.length?`<span style="${w.join("; ")};">${R}</span>`:R}const ga={[qr.OFFICE]:{[ft.ACCENT1]:"#4472C4",[ft.ACCENT2]:"#ED7D31",[ft.ACCENT3]:"#A5A5A5",[ft.ACCENT4]:"#70AD47",[ft.ACCENT5]:"#5B9BD5",[ft.ACCENT6]:"#70AD47",[ft.DARK1]:"#000000",[ft.DARK2]:"#44546A",[ft.LIGHT1]:"#FFFFFF",[ft.LIGHT2]:"#E7E6E6",[ft.HYPERLINK]:"#0563C1",[ft.FOLLOWED_HYPERLINK]:"#954F72"}};class Jr{constructor(){C(this,"_themeValue",ft.LIGHT1);C(this,"_themeColors");C(this,"_themeTint");C(this,"_rgbValue","");C(this,"_colorType");this._colorType=Rt.UNSUPPORTED,this._themeColors=qr.OFFICE,this._themeTint=0}asRgbColor(){return new Hr(this._rgbValue,this)}asThemeColor(){return new jr(this._themeValue,this._themeTint,this._themeColors,this)}build(){switch(this._colorType){case Rt.THEME:return this.asThemeColor();case Rt.RGB:return this.asRgbColor();case Rt.UNSUPPORTED:throw new Error("unsupported color type")}}setRgbColor(t){return this._colorType=Rt.RGB,this._rgbValue=t,this}setThemeColors(t){this._colorType=Rt.THEME,this._themeColors=t}setThemeTint(t){this._colorType=Rt.THEME,this._themeTint=t}setThemeColor(t){return this._colorType=Rt.THEME,this._themeValue=t,this}getColorType(){return this._colorType}}class ln{constructor(t){C(this,"_builder");this._builder=t}static rgbColorToHexValue(t){return`#${((1<<24)+(t.getRed()<<16)+(t.getGreen()<<8)+t.getBlue()).toString(16).slice(1)}`}static hexValueToRgbColor(t){t?t.indexOf("#")>-1&&(t=t.substring(1)):t="#000000";const n=+`0x${t[0]}${t[1]}`,r=+`0x${t[2]}${t[3]}`,s=+`0x${t[4]}${t[5]}`;return new Jr().setRgbColor(`rgb(${n},${r},${s})`).asRgbColor()}static hexToRgbString(t){const n=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;t=t.replace(n,(i,o,a,l)=>o+o+a+a+l+l);const r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);let s=null;if(r){const i=Number.parseInt(r[1],16),o=Number.parseInt(r[2],16),a=Number.parseInt(r[3],16);s=`rgba(${i},${o},${a})`}return s}asRgbColor(){return this._builder.asRgbColor()}asThemeColor(){return this._builder.asThemeColor()}getColorType(){return this._builder.getColorType()}clone(){return new ln(this._builder)}equals(t){return!1}}class ma{constructor(t){C(this,"_saturation",0);C(this,"_hue",0);C(this,"_lightness",0);C(this,"_alpha",0);const n=t.getRed()/255,r=t.getGreen()/255,s=t.getBlue()/255,i=t.getAlpha()/255,o=Math.min(n,Math.min(r,s)),a=Math.max(n,Math.max(r,s)),l=a-o;if(a===o){this._hue=0,this._saturation=0,this._lightness=a;return}this._lightness=(o+a)/2,this._lightness<.5?this._saturation=l/(a+o):this._saturation=l/(2-a-o),n===a&&(this._hue=(r-s)/l),r===a&&(this._hue=2+(s-n)/l),s===a&&(this._hue=4+(n-r)/l),this._hue*=60,this._hue<0&&(this._hue+=360),this._alpha=i}asRgbColor(){const t=new Jr;if(this._saturation===0)return t.setRgbColor(`rgba(${this._lightness*255},${this._lightness*255},${this._lightness*255},${this._alpha*255})`),t.asRgbColor();let n;this._lightness<.5?n=this._lightness*(1+this._saturation):n=this._lightness+this._saturation-this._lightness*this._saturation;const r=2*this._lightness-n,s=this._hue/360,i=s+1/3,o=this.setColor(n,r,i),a=this.setColor(n,r,s),l=s-1/3,u=this.setColor(n,r,l);return t.setRgbColor(`rgba(${Math.round(o*255)},${Math.round(a*255)},${Math.round(u*255)},${this._alpha*255})`),t.asRgbColor()}getLightness(){return this._lightness}getHue(){return this._hue}getSaturation(){return this._saturation}getAlpha(){return this._alpha}setColor(t,n,r){r<0&&(r+=1),r>1&&(r-=1);let s;return 6*r<1?s=n+(t-n)*6*r:2*r<1?s=t:3*r<2?s=n+(t-n)*(2/3-r)*6:s=n,s}setLightness(t){this._lightness=t}}const Ct=class Ct extends ln{constructor(n,r){super(r);C(this,"_cssString");C(this,"_red");C(this,"_green");C(this,"_blue");C(this,"_alpha");let s=n.match(Ct.RGBA_EXTRACT);if(s){const i=+s[1],o=+s[2],a=+s[3],l=+s[4];this._cssString=n,this._red=i,this._green=o,this._blue=a,this._alpha=l;return}if(s=n.match(Ct.RGB_EXTRACT),s){const i=+s[1],o=+s[2],a=+s[3];this._cssString=n,this._red=i,this._green=o,this._blue=a,this._alpha=1;return}throw new Error("Invalid rgba or rgb color")}asHexString(){return ln.rgbColorToHexValue(this)}getRed(){let n=this._red+Ct.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getGreen(){let n=this._green+Ct.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getBlue(){let n=this._blue+Ct.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getAlpha(){return this._alpha}getColorType(){return Rt.RGB}clone(){return new Ct(this._cssString,this._builder)}asThemeColor(){throw new Error("rgb color not support to themeColor")}equals(n){return n instanceof Ct?n._red===this._red&&n._blue===this._blue&&n._green===this._green&&n._alpha===this._alpha:!1}getCssString(){return this._cssString}};C(Ct,"RGB_COLOR_AMT",0),C(Ct,"RGBA_EXTRACT",new RegExp("\\s*rgba\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d.\\d|\\d\\s*)\\)\\s*")),C(Ct,"RGB_EXTRACT",new RegExp("\\s*rgb\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*)\\)\\s*"));let Hr=Ct;const Yt=class Yt extends ln{constructor(n,r,s,i){super(i);C(this,"_themeColorType");C(this,"_themeTint");C(this,"_themeColors");this._themeColorType=n,this._themeTint=r,this._themeColors=s}lumValue(n,r){if(n==null)return r;let s;return n<0?s=r*(1+n):s=r*(1-n)+(255-255*(1-n)),s}asRgbColor(){const n=ga[this._themeColors];if(n==null)throw new Error("not find themeColors type");const r=n[this._themeColorType];if(r==null)throw new Error("not find themeColors value");let s;if(Yt._cacheThemeColor.has(this._themeColors)){if(s=Yt._cacheThemeColor.get(this._themeColors),s.has(this._themeColorType))return s.get(this._themeColorType)}else s=new Map,Yt._cacheThemeColor.set(this._themeColors,s);const i=new ma(ln.hexValueToRgbColor(r));i.setLightness(this.lumValue(this._themeTint,i.getLightness()*255)/255);const o=i.asRgbColor();return s.set(this._themeColorType,o),o}clone(){return new Yt(this._themeColorType,this._themeTint,this._themeColors,this._builder)}equals(n){return n instanceof Yt?n._themeColorType===this._themeColorType:!1}getColorType(){return Rt.THEME}getThemeColorType(){return this._themeColorType}};C(Yt,"_cacheThemeColor",new Map);let jr=Yt;const jc="rgb(",Wc="rgba(",ys={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 Ot{constructor(t){C(this,"_color");C(this,"_rgbColor");C(this,"_isValid",!1);if(t==null){this._setNullColor();return}if(t instanceof Ot){this._color={...t._color},this._rgbColor={...t._rgbColor};return}const n=_a(t);if(n==null){this._setNullColor();return}this._color=n;const r=Kc(this._color);if(r==null){this._setNullColor();return}this._rgbColor=r,this._isValid=!0}static mix(t,n,r){var u,c;r=Math.min(1,Math.max(0,r));const s=new Ot(t).toRgb(),i=new Ot(n).toRgb(),o=(u=s.a)!=null?u:1,a=(c=i.a)!=null?c:1,l={r:(i.r-s.r)*r+s.r,g:(i.g-s.g)*r+s.g,b:(i.b-s.b)*r+s.b,a:(a-o)*r+o};return new Ot(l)}static getContrastRatio(t,n){const r=new Ot(t).getLuminance(),s=new Ot(n).getLuminance();return(Math.max(r,s)+.05)/(Math.min(r,s)+.05)}get isValid(){return this._isValid}toRgb(){return this._rgbColor}toRgbString(){const{r:t,g:n,b:r,a:s=1}=this.toRgb(),i=s<1;return`rgb${i?"a":""}(${t},${n},${r}${i?`,${s}`:""})`}toString(){return this.toRgbString()}toHexString(t){const{r:n,g:r,b:s,a:i=1}=this.toRgb(),o=i<1,a=[mr(Math.round(n).toString(16)),mr(Math.round(r).toString(16)),mr(Math.round(s).toString(16)),mr(Math.round(i*255).toString(16))];return t&&a[0][0]===a[0][1]&&a[1][0]===a[1][1]&&a[2][0]===a[2][1]&&a[3][0]===a[3][1]?o?`#${a[0][0]}${a[1][0]}${a[2][0]}${a[3][0]}`:`#${a[0][0]}${a[1][0]}${a[2][0]}`:o?`#${a[0]}${a[1]}${a[2]}${a[3]}`:`#${a[0]}${a[1]}${a[2]}`}toHsv(){return Zc(this.toRgb())}toHsl(){return Jc(this.toRgb())}lighten(t=10){const n=this.toHsl();return n.l+=t,n.l=Math.min(Math.max(n.l,0),100),new Ot(n)}darken(t=10){const n=this.toHsl();return n.l-=t,n.l=Math.min(Math.max(n.l,0),100),new Ot(n)}setAlpha(t){return new Ot({...this._rgbColor,a:t})}getLuminance(){let{r:t,g:n,b:r}=this.toRgb();return t=as(t),n=as(n),r=as(r),Number((.2126*t+.7152*n+.0722*r).toFixed(3))}getBrightness(){const{r:t,g:n,b:r}=this.toRgb();return(t*299+n*587+r*114)/1e3}getAlpha(){var t;return(t=this._color.a)!=null?t: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 mr=e=>e.length===1?`0${e}`:e,as=e=>(e/=255,e<=.03928?e/12.92:((e+.055)/1.055)**2.4),_a=e=>{if(eh(e)){if("r"in e){const r={r:Math.round(e.r),g:Math.round(e.g),b:Math.round(e.b)};return e.a!==void 0&&(r.a=e.a),r}if("l"in e){const r={h:Math.round(e.h),s:e.s,l:e.l};return e.a!==void 0&&(r.a=e.a),r}const n={h:Math.round(e.h),s:e.s,v:e.v};return e.a!==void 0&&(n.a=e.a),n}const t=e.trim();if(ys[t]){const n=ys[t],r={r:Math.round(n[0]),g:Math.round(n[1]),b:Math.round(n[2])};return r.a=n[3]||1,r}if(t.startsWith("#"))return Yc(t);if(t.startsWith("rgb"))return zc(t);if(t.startsWith("hsl"))return Gc(t);if(t.startsWith("hsv"))return Vc(t)},Yc=e=>{const t=e.substring(1),n=new RegExp(`.{1,${t.length>=6?2:1}}`,"g");let r=t.match(n);if(!r||r.length<3)throw new Error(`The color '${e}' is illegal hex color`);r[0].length===1&&(r=r.map(i=>i+i));const s={r:Number.parseInt(r[0],16),g:Number.parseInt(r[1],16),b:Number.parseInt(r[2],16)};return r.length>3&&(s.a=Number.parseInt(r[3],16)/255),s},zc=e=>{const t=e.indexOf("(");if(t===-1)throw new Error(`The color '${e}' is illegal rgb color`);const n=e.substring(t+1,e.length-1).split(",");if(n.length<3)throw new Error(`The color '${e}' is illegal rgb color`);const r={r:Number.parseInt(n[0],10),g:Number.parseInt(n[1],10),b:Number.parseInt(n[2],10)};return n.length>3&&(r.a=Number.parseFloat(n[3])),r},Gc=e=>{const t=e.indexOf("(");if(t===-1)throw new Error(`The color '${e}' is illegal hsl color`);const n=e.substring(t+1,e.length-1).split(",");if(n.length<3)throw new Error(`The color '${e}' is illegal hsl color`);const r={h:Number.parseInt(n[0],10),s:Number.parseFloat(n[1]),l:Number.parseFloat(n[2])};return n.length>3&&(r.a=Number.parseFloat(n[3])),r},Vc=e=>{const t=e.indexOf("(");if(t===-1)throw new Error(`The color '${e}' is illegal hsv color`);const n=e.substring(t+1,e.length-1).split(",");if(n.length<3)throw new Error(`The color '${e}' is illegal hsv color`);const r={h:Number.parseInt(n[0],10),s:Number.parseFloat(n[1]),v:Number.parseFloat(n[2])};return n.length>3&&(r.a=Number.parseFloat(n[3])),r},Kc=e=>{const t=_a(e);if(t!=null)return"r"in t?t:"l"in t?Xc(t):qc(t)},ls=(e,t,n)=>(n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e),Xc=e=>{let{h:t,s:n,l:r}=e;t/=360,n/=100,r/=100;let s=0,i=0,o=0;if(n===0)s=i=o=r;else{const l=r<.5?r*(1+n):r+n-r*n,u=2*r-l;s=ls(u,l,t+1/3),i=ls(u,l,t),o=ls(u,l,t-1/3)}const a={r:Math.round(s*255),g:Math.round(i*255),b:Math.round(o*255)};return e.a!==void 0&&(a.a=e.a),a},qc=e=>{let{h:t,s:n,v:r}=e;t=t/360*6,n/=100,r/=100;const s=Math.floor(t),i=t-s,o=r*(1-n),a=r*(1-i*n),l=r*(1-(1-i)*n),u=s%6,c=[r,a,o,o,l,r][u],h=[l,r,r,a,o,o][u],d=[o,o,l,r,r,a][u],f={r:c*255,g:h*255,b:d*255};return e.a!==void 0&&(f.a=e.a),f},Jc=e=>{let{r:t,g:n,b:r}=e;t/=255,n/=255,r/=255;const s=Math.max(t,n,r),i=Math.min(t,n,r),o=(s+i)/2;let a,l;if(s===i)a=l=0;else{const c=s-i;switch(l=o>.5?c/(2-s-i):c/(s+i),s){case t:a=(n-r)/c+(n<r?6:0);break;case n:a=(r-t)/c+2;break;default:a=(t-n)/c+4;break}a/=6}const u={h:Math.round(a*360),s:Math.round(l*100),l:Math.round(o*100)};return e.a!==void 0&&(u.a=e.a),u},Zc=e=>{let{r:t,g:n,b:r}=e;t/=255,n/=255,r/=255;const s=Math.max(t,n,r),i=Math.min(t,n,r);let o;const a=s,l=s-i,u=s===0?0:l/s;if(s===i)o=0;else{switch(s){case t:o=(n-r)/l+(n<r?6:0);break;case n:o=(r-t)/l+2;break;default:o=(t-n)/l+4;break}o/=6}const c={h:Math.round(o*360),s:Math.round(u*100),v:Math.round(a*100)};return e.a!==void 0&&(c.a=e.a),c},Qc=e=>e==null,eh=e=>!Qc(e)&&typeof e=="object";function th(e){const t=/^#(?:[0]{3}|[0]{6})\b/,n=/^rgb\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*\)$/,r=/^rgba\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*,\s*(1|1\.0*|0?\.\d+)\)$/,s=/^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!!(t.test(e)||n.test(e)||r.test(e)||s.test(e)||i.test(e))}function nh(e){const t=/^#(?:[Ff]{3}|[Ff]{6})\b/,n=/^rgb\s*\(\s*255\s*,\s*255\s*,\s*255\s*\)$/,r=/^rgba\s*\(\s*255\s*,\s*255\s*,\s*255\s*,\s*(1|1\.0*|0?\.\d+)\)$/,s=/^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!!(t.test(e)||n.test(e)||r.test(e)||s.test(e)||i.test(e))}var xe=(e=>(e[e.COVER=0]="COVER",e[e.REPLACE=1]="REPLACE",e))(xe||{});function rh(e){return e&&(e.s!==void 0||e.p!==void 0||e.v!==void 0||e.t!==void 0||e.f!==void 0||e.si!==void 0||e.custom!==void 0)}function sh(e){if(e.t!==void 0)return e.t;if(typeof e.v=="string")return Vt.STRING;if(typeof e.v=="number")return Vt.NUMBER;if(typeof e.v=="boolean")return Vt.BOOLEAN}function ih(e){if(e==null)return!0;const{v:t,f:n,si:r,p:s,custom:i}=e;return!(!(t==null||typeof t=="string"&&t.length===0)||n!=null&&n.length>0||r!=null&&r.length>0||s!=null||i!=null)}function oh(e){return e!=null&&(typeof e=="string"||typeof e=="number"||typeof e=="boolean")}var Le=(e=>(e[e.NORMAL=0]="NORMAL",e[e.ROW=1]="ROW",e[e.COLUMN=2]="COLUMN",e[e.ALL=3]="ALL",e))(Le||{}),tt=(e=>(e[e.NONE=0]="NONE",e[e.ROW=1]="ROW",e[e.COLUMN=2]="COLUMN",e[e.ALL=3]="ALL",e))(tt||{});function ah(e){return[e.startRow,e.startColumn,e.endRow,e.endColumn]}var pa=(e=>(e.NONE="none",e.BACKWARD="backward",e.FORWARD="forward",e))(pa||{}),Ea=(e=>(e.RECT="RECT",e.TEXT="TEXT",e))(Ea||{});function lh(e,t,n){let r=!1,s=!1,i=e,o=t,a=e,l=t;if(n==null)return{actualRow:e,actualColumn:t,isMergedMainCell:s,isMerged:r,endRow:i,endColumn:o,startRow:a,startColumn:l};for(let u=0;u<n.length;u++){const{startRow:c,endRow:h,startColumn:d,endColumn:f}=n[u];if(e===c&&t===d){i=h,o=f,a=c,l=d,s=!0;break}if(e>=c&&e<=h&&t>=d&&t<=f){i=h,o=f,a=c,l=d,r=!0;break}}return{actualRow:e,actualColumn:t,isMergedMainCell:s,isMerged:r,endRow:i,endColumn:o,startRow:a,startColumn:l}}var Rn=(e=>(e.Raw="raw",e.Intercepted="intercepted",e.Both="both",e))(Rn||{});function Ca(e){const{actualRow:t,actualColumn:n,isMerged:r,isMergedMainCell:s,mergeInfo:i}=e;let{startY:o,endY:a,startX:l,endX:u}=e,c=t,h=n,d=t,f=n;if(r&&i){const{startRow:p,startColumn:R,endRow:w,endColumn:N,startY:G,endY:W,startX:se,endX:y}=i;c=p,h=R,d=w,f=N,o=G,a=W,l=se,u=y}return s&&(o=i.startY,a=i.endY,l=i.startX,u=i.endX,d=i.endRow,f=i.endColumn),{startRow:c,startColumn:h,endRow:d,endColumn:f,startY:o,endY:a,startX:l,endX:u}}const uh=Ca;function ch(e){if(!e)return;const{actualRow:t,actualColumn:n,isMerged:r,isMergedMainCell:s,startRow:i,startColumn:o,endRow:a,endColumn:l}=e;let u=t,c=n,h=t,d=n;return(r||s)&&(u=i,c=o,h=a,d=l),{startRow:u,startColumn:c,endRow:h,endColumn:d}}function Ra(e){var n;return!e||(((n=e==null?void 0:e.v)==null?void 0:n.toString())||"").length===0&&!e.p}function Ns(e){return Ra(e)&&(e==null?void 0:e.coverable)!==!1}function Mt(e){if(e){if(e.rgb)return e.rgb;if(e.th)return new Jr().setThemeColor(e.th).asThemeColor().asRgbColor().getCssString()}return null}function hh(e){return re.isString(e)&&e.substring(0,1)==="="&&e.length>1}function dh(e){return re.isString(e)&&e.length>0}function fh(e,t=!1){var i;let n="";const r=new Map([["ff",()=>{e.ff&&(n+=`font-family: ${e.ff}; `)}],["fs",()=>{if(e.fs){let o=e.fs;e.va&&(o/=2),n+=`font-size: ${o}pt; `}}],["it",()=>{e.it&&(n+="font-style: italic; ")}],["bl",()=>{e.bl&&(n+="font-weight: bold; ")}],["ul",()=>{var o;(o=e.ul)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} underline`):n+="text-decoration: underline; ",e.ul.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${Mt(e.ul.cl)}; `),e.ul.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${e.ul.t} `))}],["st",()=>{var o;(o=e.st)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} line-through`):n+="text-decoration-line: line-through; ",e.st.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${Mt(e.st.cl)}; `),e.st.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${e.st.t} `))}],["ol",()=>{var o;(o=e.ol)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} overline`):n+="text-decoration-line: overline; ",e.ol.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${Mt(e.ol.cl)}; `),e.ol.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${e.ol.t} `))}],["bg",()=>{e.bg&&(n+=`background: ${Mt(e.bg)}; `)}],["bd",()=>{var o,a,l,u,c,h,d,f,p,R,w,N;(o=e.bd)!=null&&o.b&&(n+=`border-bottom: ${_r((a=e.bd)==null?void 0:a.b.s)} ${(l=Mt(e.bd.b.cl))!=null?l:""}; `),(u=e.bd)!=null&&u.t&&(n+=`border-top: ${_r((c=e.bd)==null?void 0:c.t.s)} ${(h=Mt(e.bd.t.cl))!=null?h:""}; `),(d=e.bd)!=null&&d.r&&(n+=`border-right: ${_r((f=e.bd)==null?void 0:f.r.s)} ${(p=Mt(e.bd.r.cl))!=null?p:""}; `),(R=e.bd)!=null&&R.l&&(n+=`border-left: ${_r((w=e.bd)==null?void 0:w.l.s)} ${(N=Mt(e.bd.l.cl))!=null?N:""}; `)}],["cl",()=>{e.cl&&(n+=`color: ${Mt(e.cl)}; `)}],["va",()=>{e.va===Pt.SUBSCRIPT?n+="vertical-align: sub; ":e.va===Pt.SUPERSCRIPT&&(n+="vertical-align: super; ")}],["td",()=>{e.td===Xn.LEFT_TO_RIGHT?n+="direction: ltr; ":e.td===Xn.RIGHT_TO_LEFT&&(n+="direction: rtl; ")}],["tr",()=>{var o,a,l;e.tr&&(n+=`--data-rotate: (${(o=e.tr)==null?void 0:o.a}deg${(a=e.tr)!=null&&a.v?` ,${(l=e.tr)==null?void 0:l.v}`:""});`)}],["ht",()=>{e.ht===bt.LEFT?n+="text-align: left; ":e.ht===bt.RIGHT?n+="text-align: right; ":e.ht===bt.CENTER?n+="text-align: center; ":e.ht===bt.JUSTIFIED&&(n+="text-align: justify; ")}],["vt",()=>{e.vt===nn.BOTTOM?n+="vertical-align: bottom; ":e.vt===nn.TOP?n+="vertical-align: top; ":e.vt===nn.MIDDLE&&(n+="vertical-align: middle; ")}],["tb",()=>{e.tb===an.CLIP?n+="white-space: nowrap; overflow-x: hidden; ":e.tb===an.WRAP&&(n+="white-space: normal;")}],["pd",()=>{var c,h,d,f,p,R,w,N;const o=`${(c=e.pd)==null?void 0:c.b}pt`,a=`${(h=e.pd)==null?void 0:h.t}pt`,l=`${(d=e.pd)==null?void 0:d.l}pt`,u=`${(f=e.pd)==null?void 0:f.r}pt`;(p=e.pd)!=null&&p.b&&(n+=`padding-bottom: ${o}; `),(R=e.pd)!=null&&R.t&&(n+=`padding-top: ${a}; `),(w=e.pd)!=null&&w.l&&(n+=`padding-left: ${l}; `),(N=e.pd)!=null&&N.r&&(n+=`padding-right: ${u}; `)}]]),s=["bd","tr","tb"];for(const o in e)t&&s.includes(o)||(i=r.get(o))==null||i();return n}function _r(e){let t="";return e===Xe.NONE?t="none":e===Xe.THIN?t="0.5pt solid":e===Xe.HAIR?t="0.5pt double":e===Xe.DOTTED?t="0.5pt dotted":e===Xe.DASHED||e===Xe.DASH_DOT?t="0.5pt dashed":e===Xe.DASH_DOT_DOT?t="0.5pt dotted":e===Xe.DOUBLE?t="0.5pt double":e===Xe.MEDIUM?t="1pt solid":e===Xe.MEDIUM_DASHED||e===Xe.MEDIUM_DASH_DOT?t="1pt dashed":e===Xe.MEDIUM_DASH_DOT_DOT?t="1pt dotted":e===Xe.SLANT_DASH_DOT?t="0.5pt dashed":e===Xe.THICK&&(t="1.5pt solid"),t}function gh(e){let t=0;if(e=e.trim(),e==="none")t=Xe.NONE;else if(e==="0.5pt solid")t=Xe.THIN;else if(e==="0.5pt double")t=Xe.HAIR;else if(e==="0.5pt dotted")t=Xe.DOTTED;else if(e==="0.5pt dashed")t=Xe.DASHED;else if(e==="1pt solid")t=Xe.MEDIUM;else if(e==="1pt dashed")t=Xe.MEDIUM_DASHED;else if(e==="1pt dotted")t=Xe.MEDIUM_DASH_DOT_DOT;else if(e==="1.5pt solid")t=Xe.THICK;else if(!e.includes("none"))t=Xe.THIN;else return Xe.NONE;return t}function mh(e,t){let n=e.body;if(t){const{headers:r,footers:s}=e;r!=null&&r[t]?n=r[t].body:s!=null&&s[t]&&(n=s[t].body)}return n}function _h(e,t){const{startRow:n,endRow:r,startColumn:s,endColumn:i,rangeType:o}=e;if(n<0||s<0||r<0||i<0||!(Number.isNaN(n)&&Number.isNaN(r))&&o===Le.COLUMN||!(Number.isNaN(s)&&Number.isNaN(i))&&o===Le.ROW||o!==Le.ROW&&o!==Le.COLUMN&&(Number.isNaN(s)||Number.isNaN(n)||Number.isNaN(i)||Number.isNaN(r)))return!1;if(t){const a=t.getRowCount(),l=t.getColumnCount();if(r>=a||i>=l)return!1}return!0}function ph(e,t){return{startRow:e,endRow:e,startColumn:t,endColumn:t}}function Qs(e,t){return Object.prototype.toString.call(e)===Object.prototype.toString.call(t)?Object.prototype.toString.call(e)==="[object Object]"||Object.prototype.toString.call(e)==="[object Array]"?Object.keys(e).length!==Object.keys(t).length?!1:Object.keys(e).every(n=>Qs(e[n],t[n])):e===t:!1}function Ia(e,t){const n=e.ts||{},r=t.ts||{};return e.sId!==t.sId?!1:Qs(n,r)}function Eh(e,t){return t.some(n=>e.indexOf(n)>-1)}function pt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Tr={exports:{}},Ch=Tr.exports,Ni;function Rh(){return Ni||(Ni=1,function(e,t){(function(n,r){e.exports=r()})(Ch,function(){var n=1e3,r=6e4,s=36e5,i="millisecond",o="second",a="minute",l="hour",u="day",c="week",h="month",d="quarter",f="year",p="date",R="Invalid Date",w=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,N=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,G={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(D){var b=["th","st","nd","rd"],O=D%100;return"["+D+(b[(O-20)%10]||b[O]||b[0])+"]"}},W=function(D,b,O){var k=String(D);return!k||k.length>=b?D:""+Array(b+1-k.length).join(O)+D},se={s:W,z:function(D){var b=-D.utcOffset(),O=Math.abs(b),k=Math.floor(O/60),$=O%60;return(b<=0?"+":"-")+W(k,2,"0")+":"+W($,2,"0")},m:function D(b,O){if(b.date()<O.date())return-D(O,b);var k=12*(O.year()-b.year())+(O.month()-b.month()),$=b.clone().add(k,h),V=O-$<0,ie=b.clone().add(k+(V?-1:1),h);return+(-(k+(O-$)/(V?$-ie:ie-$))||0)},a:function(D){return D<0?Math.ceil(D)||0:Math.floor(D)},p:function(D){return{M:h,y:f,w:c,d:u,D:p,h:l,m:a,s:o,ms:i,Q:d}[D]||String(D||"").toLowerCase().replace(/s$/,"")},u:function(D){return D===void 0}},y="en",A={};A[y]=G;var j="$isDayjsObject",Z=function(D){return D instanceof H||!(!D||!D[j])},fe=function D(b,O,k){var $;if(!b)return y;if(typeof b=="string"){var V=b.toLowerCase();A[V]&&($=V),O&&(A[V]=O,$=V);var ie=b.split("-");if(!$&&ie.length>1)return D(ie[0])}else{var de=b.name;A[de]=b,$=de}return!k&&$&&(y=$),$||!k&&y},le=function(D,b){if(Z(D))return D.clone();var O=typeof b=="object"?b:{};return O.date=D,O.args=arguments,new H(O)},_=se;_.l=fe,_.i=Z,_.w=function(D,b){return le(D,{locale:b.$L,utc:b.$u,x:b.$x,$offset:b.$offset})};var H=function(){function D(O){this.$L=fe(O.locale,null,!0),this.parse(O),this.$x=this.$x||O.x||{},this[j]=!0}var b=D.prototype;return b.parse=function(O){this.$d=function(k){var $=k.date,V=k.utc;if($===null)return new Date(NaN);if(_.u($))return new Date;if($ instanceof Date)return new Date($);if(typeof $=="string"&&!/Z$/i.test($)){var ie=$.match(w);if(ie){var de=ie[2]-1||0,ge=(ie[7]||"0").substring(0,3);return V?new Date(Date.UTC(ie[1],de,ie[3]||1,ie[4]||0,ie[5]||0,ie[6]||0,ge)):new Date(ie[1],de,ie[3]||1,ie[4]||0,ie[5]||0,ie[6]||0,ge)}}return new Date($)}(O),this.init()},b.init=function(){var O=this.$d;this.$y=O.getFullYear(),this.$M=O.getMonth(),this.$D=O.getDate(),this.$W=O.getDay(),this.$H=O.getHours(),this.$m=O.getMinutes(),this.$s=O.getSeconds(),this.$ms=O.getMilliseconds()},b.$utils=function(){return _},b.isValid=function(){return this.$d.toString()!==R},b.isSame=function(O,k){var $=le(O);return this.startOf(k)<=$&&$<=this.endOf(k)},b.isAfter=function(O,k){return le(O)<this.startOf(k)},b.isBefore=function(O,k){return this.endOf(k)<le(O)},b.$g=function(O,k,$){return _.u(O)?this[k]:this.set($,O)},b.unix=function(){return Math.floor(this.valueOf()/1e3)},b.valueOf=function(){return this.$d.getTime()},b.startOf=function(O,k){var $=this,V=!!_.u(k)||k,ie=_.p(O),de=function(z,Y){var ue=_.w($.$u?Date.UTC($.$y,Y,z):new Date($.$y,Y,z),$);return V?ue:ue.endOf(u)},ge=function(z,Y){return _.w($.toDate()[z].apply($.toDate("s"),(V?[0,0,0,0]:[23,59,59,999]).slice(Y)),$)},ye=this.$W,Ae=this.$M,S=this.$D,F="set"+(this.$u?"UTC":"");switch(ie){case f:return V?de(1,0):de(31,11);case h:return V?de(1,Ae):de(0,Ae+1);case c:var K=this.$locale().weekStart||0,q=(ye<K?ye+7:ye)-K;return de(V?S-q:S+(6-q),Ae);case u:case p:return ge(F+"Hours",0);case l:return ge(F+"Minutes",1);case a:return ge(F+"Seconds",2);case o:return ge(F+"Milliseconds",3);default:return this.clone()}},b.endOf=function(O){return this.startOf(O,!1)},b.$set=function(O,k){var $,V=_.p(O),ie="set"+(this.$u?"UTC":""),de=($={},$[u]=ie+"Date",$[p]=ie+"Date",$[h]=ie+"Month",$[f]=ie+"FullYear",$[l]=ie+"Hours",$[a]=ie+"Minutes",$[o]=ie+"Seconds",$[i]=ie+"Milliseconds",$)[V],ge=V===u?this.$D+(k-this.$W):k;if(V===h||V===f){var ye=this.clone().set(p,1);ye.$d[de](ge),ye.init(),this.$d=ye.set(p,Math.min(this.$D,ye.daysInMonth())).$d}else de&&this.$d[de](ge);return this.init(),this},b.set=function(O,k){return this.clone().$set(O,k)},b.get=function(O){return this[_.p(O)]()},b.add=function(O,k){var $,V=this;O=Number(O);var ie=_.p(k),de=function(Ae){var S=le(V);return _.w(S.date(S.date()+Math.round(Ae*O)),V)};if(ie===h)return this.set(h,this.$M+O);if(ie===f)return this.set(f,this.$y+O);if(ie===u)return de(1);if(ie===c)return de(7);var ge=($={},$[a]=r,$[l]=s,$[o]=n,$)[ie]||1,ye=this.$d.getTime()+O*ge;return _.w(ye,this)},b.subtract=function(O,k){return this.add(-1*O,k)},b.format=function(O){var k=this,$=this.$locale();if(!this.isValid())return $.invalidDate||R;var V=O||"YYYY-MM-DDTHH:mm:ssZ",ie=_.z(this),de=this.$H,ge=this.$m,ye=this.$M,Ae=$.weekdays,S=$.months,F=$.meridiem,K=function(Y,ue,ae,B){return Y&&(Y[ue]||Y(k,V))||ae[ue].slice(0,B)},q=function(Y){return _.s(de%12||12,Y,"0")},z=F||function(Y,ue,ae){var B=Y<12?"AM":"PM";return ae?B.toLowerCase():B};return V.replace(N,function(Y,ue){return ue||function(ae){switch(ae){case"YY":return String(k.$y).slice(-2);case"YYYY":return _.s(k.$y,4,"0");case"M":return ye+1;case"MM":return _.s(ye+1,2,"0");case"MMM":return K($.monthsShort,ye,S,3);case"MMMM":return K(S,ye);case"D":return k.$D;case"DD":return _.s(k.$D,2,"0");case"d":return String(k.$W);case"dd":return K($.weekdaysMin,k.$W,Ae,2);case"ddd":return K($.weekdaysShort,k.$W,Ae,3);case"dddd":return Ae[k.$W];case"H":return String(de);case"HH":return _.s(de,2,"0");case"h":return q(1);case"hh":return q(2);case"a":return z(de,ge,!0);case"A":return z(de,ge,!1);case"m":return String(ge);case"mm":return _.s(ge,2,"0");case"s":return String(k.$s);case"ss":return _.s(k.$s,2,"0");case"SSS":return _.s(k.$ms,3,"0");case"Z":return ie}return null}(Y)||ie.replace(":","")})},b.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},b.diff=function(O,k,$){var V,ie=this,de=_.p(k),ge=le(O),ye=(ge.utcOffset()-this.utcOffset())*r,Ae=this-ge,S=function(){return _.m(ie,ge)};switch(de){case f:V=S()/12;break;case h:V=S();break;case d:V=S()/3;break;case c:V=(Ae-ye)/6048e5;break;case u:V=(Ae-ye)/864e5;break;case l:V=Ae/s;break;case a:V=Ae/r;break;case o:V=Ae/n;break;default:V=Ae}return $?V:_.a(V)},b.daysInMonth=function(){return this.endOf(h).$D},b.$locale=function(){return A[this.$L]},b.locale=function(O,k){if(!O)return this.$L;var $=this.clone(),V=fe(O,k,!0);return V&&($.$L=V),$},b.clone=function(){return _.w(this.$d,this)},b.toDate=function(){return new Date(this.valueOf())},b.toJSON=function(){return this.isValid()?this.toISOString():null},b.toISOString=function(){return this.$d.toISOString()},b.toString=function(){return this.$d.toUTCString()},D}(),v=H.prototype;return le.prototype=v,[["$ms",i],["$s",o],["$m",a],["$H",l],["$W",u],["$M",h],["$y",f],["$D",p]].forEach(function(D){v[D[1]]=function(b){return this.$g(b,D[0],D[1])}}),le.extend=function(D,b){return D.$i||(D(b,H,le),D.$i=!0),le},le.locale=fe,le.isDayjs=Z,le.unix=function(D){return le(1e3*D)},le.en=A[y],le.Ls=A,le.p={},le})}(Tr)),Tr.exports}var Ih=Rh();const $t=pt(Ih);var yr={exports:{}},Sh=yr.exports,Mi;function vh(){return Mi||(Mi=1,function(e,t){(function(n,r){e.exports=r()})(Sh,function(){return function(n,r){var s=r.prototype,i=s.format;s.format=function(o){var a=this,l=this.$locale();if(!this.isValid())return i.bind(this)(o);var u=this.$utils(),c=(o||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,function(h){switch(h){case"Q":return Math.ceil((a.$M+1)/3);case"Do":return l.ordinal(a.$D);case"gggg":return a.weekYear();case"GGGG":return a.isoWeekYear();case"wo":return l.ordinal(a.week(),"W");case"w":case"ww":return u.s(a.week(),h==="w"?1:2,"0");case"W":case"WW":return u.s(a.isoWeek(),h==="W"?1:2,"0");case"k":case"kk":return u.s(String(a.$H===0?24:a.$H),h==="k"?1:2,"0");case"X":return Math.floor(a.$d.getTime()/1e3);case"x":return a.$d.getTime();case"z":return"["+a.offsetName()+"]";case"zzz":return"["+a.offsetName("long")+"]";default:return h}});return i.bind(this)(c)}}})}(yr)),yr.exports}var Oh=vh();const wh=pt(Oh);var Nr={exports:{}},bh=Nr.exports,Di;function Ah(){return Di||(Di=1,function(e,t){(function(n,r){e.exports=r()})(bh,function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},r=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,s=/\d/,i=/\d\d/,o=/\d\d?/,a=/\d*[^-_:/,()\s\d]+/,l={},u=function(w){return(w=+w)+(w>68?1900:2e3)},c=function(w){return function(N){this[w]=+N}},h=[/[+-]\d\d:?(\d\d)?|Z/,function(w){(this.zone||(this.zone={})).offset=function(N){if(!N||N==="Z")return 0;var G=N.match(/([+-]|\d\d)/g),W=60*G[1]+(+G[2]||0);return W===0?0:G[0]==="+"?-W:W}(w)}],d=function(w){var N=l[w];return N&&(N.indexOf?N:N.s.concat(N.f))},f=function(w,N){var G,W=l.meridiem;if(W){for(var se=1;se<=24;se+=1)if(w.indexOf(W(se,0,N))>-1){G=se>12;break}}else G=w===(N?"pm":"PM");return G},p={A:[a,function(w){this.afternoon=f(w,!1)}],a:[a,function(w){this.afternoon=f(w,!0)}],Q:[s,function(w){this.month=3*(w-1)+1}],S:[s,function(w){this.milliseconds=100*+w}],SS:[i,function(w){this.milliseconds=10*+w}],SSS:[/\d{3}/,function(w){this.milliseconds=+w}],s:[o,c("seconds")],ss:[o,c("seconds")],m:[o,c("minutes")],mm:[o,c("minutes")],H:[o,c("hours")],h:[o,c("hours")],HH:[o,c("hours")],hh:[o,c("hours")],D:[o,c("day")],DD:[i,c("day")],Do:[a,function(w){var N=l.ordinal,G=w.match(/\d+/);if(this.day=G[0],N)for(var W=1;W<=31;W+=1)N(W).replace(/\[|\]/g,"")===w&&(this.day=W)}],w:[o,c("week")],ww:[i,c("week")],M:[o,c("month")],MM:[i,c("month")],MMM:[a,function(w){var N=d("months"),G=(d("monthsShort")||N.map(function(W){return W.slice(0,3)})).indexOf(w)+1;if(G<1)throw new Error;this.month=G%12||G}],MMMM:[a,function(w){var N=d("months").indexOf(w)+1;if(N<1)throw new Error;this.month=N%12||N}],Y:[/[+-]?\d+/,c("year")],YY:[i,function(w){this.year=u(w)}],YYYY:[/\d{4}/,c("year")],Z:h,ZZ:h};function R(w){var N,G;N=w,G=l&&l.formats;for(var W=(w=N.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(le,_,H){var v=H&&H.toUpperCase();return _||G[H]||n[H]||G[v].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(D,b,O){return b||O.slice(1)})})).match(r),se=W.length,y=0;y<se;y+=1){var A=W[y],j=p[A],Z=j&&j[0],fe=j&&j[1];W[y]=fe?{regex:Z,parser:fe}:A.replace(/^\[|\]$/g,"")}return function(le){for(var _={},H=0,v=0;H<se;H+=1){var D=W[H];if(typeof D=="string")v+=D.length;else{var b=D.regex,O=D.parser,k=le.slice(v),$=b.exec(k)[0];O.call(_,$),le=le.replace($,"")}}return function(V){var ie=V.afternoon;if(ie!==void 0){var de=V.hours;ie?de<12&&(V.hours+=12):de===12&&(V.hours=0),delete V.afternoon}}(_),_}}return function(w,N,G){G.p.customParseFormat=!0,w&&w.parseTwoDigitYear&&(u=w.parseTwoDigitYear);var W=N.prototype,se=W.parse;W.parse=function(y){var A=y.date,j=y.utc,Z=y.args;this.$u=j;var fe=Z[1];if(typeof fe=="string"){var le=Z[2]===!0,_=Z[3]===!0,H=le||_,v=Z[2];_&&(v=Z[2]),l=this.$locale(),!le&&v&&(l=G.Ls[v]),this.$d=function(k,$,V,ie){try{if(["x","X"].indexOf($)>-1)return new Date(($==="X"?1e3:1)*k);var de=R($)(k),ge=de.year,ye=de.month,Ae=de.day,S=de.hours,F=de.minutes,K=de.seconds,q=de.milliseconds,z=de.zone,Y=de.week,ue=new Date,ae=Ae||(ge||ye?1:ue.getDate()),B=ge||ue.getFullYear(),te=0;ge&&!ye||(te=ye>0?ye-1:ue.getMonth());var oe,me=S||0,be=F||0,De=K||0,X=q||0;return z?new Date(Date.UTC(B,te,ae,me,be,De,X+60*z.offset*1e3)):V?new Date(Date.UTC(B,te,ae,me,be,De,X)):(oe=new Date(B,te,ae,me,be,De,X),Y&&(oe=ie(oe).week(Y).toDate()),oe)}catch{return new Date("")}}(A,fe,j,G),this.init(),v&&v!==!0&&(this.$L=this.locale(v).$L),H&&A!=this.format(fe)&&(this.$d=new Date("")),l={}}else if(fe instanceof Array)for(var D=fe.length,b=1;b<=D;b+=1){Z[1]=fe[b-1];var O=G.apply(this,Z);if(O.isValid()){this.$d=O.$d,this.$L=O.$L,this.init();break}b===D&&(this.$d=new Date(""))}else se.call(this,y)}}})}(Nr)),Nr.exports}var Th=Ah();const yh=pt(Th);var Mr={exports:{}},Nh=Mr.exports,Li;function Mh(){return Li||(Li=1,function(e,t){(function(n,r){e.exports=r()})(Nh,function(){return function(n,r,s){var i=r.prototype,o=function(h){return h&&(h.indexOf?h:h.s)},a=function(h,d,f,p,R){var w=h.name?h:h.$locale(),N=o(w[d]),G=o(w[f]),W=N||G.map(function(y){return y.slice(0,p)});if(!R)return W;var se=w.weekStart;return W.map(function(y,A){return W[(A+(se||0))%7]})},l=function(){return s.Ls[s.locale()]},u=function(h,d){return h.formats[d]||function(f){return f.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(p,R,w){return R||w.slice(1)})}(h.formats[d.toUpperCase()])},c=function(){var h=this;return{months:function(d){return d?d.format("MMMM"):a(h,"months")},monthsShort:function(d){return d?d.format("MMM"):a(h,"monthsShort","months",3)},firstDayOfWeek:function(){return h.$locale().weekStart||0},weekdays:function(d){return d?d.format("dddd"):a(h,"weekdays")},weekdaysMin:function(d){return d?d.format("dd"):a(h,"weekdaysMin","weekdays",2)},weekdaysShort:function(d){return d?d.format("ddd"):a(h,"weekdaysShort","weekdays",3)},longDateFormat:function(d){return u(h.$locale(),d)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};i.localeData=function(){return c.bind(this)()},s.localeData=function(){var h=l();return{firstDayOfWeek:function(){return h.weekStart||0},weekdays:function(){return s.weekdays()},weekdaysShort:function(){return s.weekdaysShort()},weekdaysMin:function(){return s.weekdaysMin()},months:function(){return s.months()},monthsShort:function(){return s.monthsShort()},longDateFormat:function(d){return u(h,d)},meridiem:h.meridiem,ordinal:h.ordinal}},s.months=function(){return a(l(),"months")},s.monthsShort=function(){return a(l(),"monthsShort","months",3)},s.weekdays=function(h){return a(l(),"weekdays",null,null,h)},s.weekdaysShort=function(h){return a(l(),"weekdaysShort","weekdays",3,h)},s.weekdaysMin=function(h){return a(l(),"weekdaysMin","weekdays",2,h)}}})}(Mr)),Mr.exports}var Dh=Mh();const Lh=pt(Dh);var Dr={exports:{}},xh=Dr.exports,xi;function Uh(){return xi||(xi=1,function(e,t){(function(n,r){e.exports=r()})(xh,function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(r,s,i){var o=s.prototype,a=o.format;i.en.formats=n,o.format=function(l){l===void 0&&(l="YYYY-MM-DDTHH:mm:ssZ");var u=this.$locale().formats,c=function(h,d){return h.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(f,p,R){var w=R&&R.toUpperCase();return p||d[R]||n[R]||d[w].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(N,G,W){return G||W.slice(1)})})}(l,u===void 0?{}:u);return a.call(this,c)}}})}(Dr)),Dr.exports}var Ph=Uh();const kh=pt(Ph);var Lr={exports:{}},Fh=Lr.exports,Ui;function $h(){return Ui||(Ui=1,function(e,t){(function(n,r){e.exports=r()})(Fh,function(){var n="minute",r=/[+-]\d\d(?::?\d\d)?/g,s=/([+-]|\d\d)/g;return function(i,o,a){var l=o.prototype;a.utc=function(R){var w={date:R,utc:!0,args:arguments};return new o(w)},l.utc=function(R){var w=a(this.toDate(),{locale:this.$L,utc:!0});return R?w.add(this.utcOffset(),n):w},l.local=function(){return a(this.toDate(),{locale:this.$L,utc:!1})};var u=l.parse;l.parse=function(R){R.utc&&(this.$u=!0),this.$utils().u(R.$offset)||(this.$offset=R.$offset),u.call(this,R)};var c=l.init;l.init=function(){if(this.$u){var R=this.$d;this.$y=R.getUTCFullYear(),this.$M=R.getUTCMonth(),this.$D=R.getUTCDate(),this.$W=R.getUTCDay(),this.$H=R.getUTCHours(),this.$m=R.getUTCMinutes(),this.$s=R.getUTCSeconds(),this.$ms=R.getUTCMilliseconds()}else c.call(this)};var h=l.utcOffset;l.utcOffset=function(R,w){var N=this.$utils().u;if(N(R))return this.$u?0:N(this.$offset)?h.call(this):this.$offset;if(typeof R=="string"&&(R=function(y){y===void 0&&(y="");var A=y.match(r);if(!A)return null;var j=(""+A[0]).match(s)||["-",0,0],Z=j[0],fe=60*+j[1]+ +j[2];return fe===0?0:Z==="+"?fe:-fe}(R),R===null))return this;var G=Math.abs(R)<=16?60*R:R,W=this;if(w)return W.$offset=G,W.$u=R===0,W;if(R!==0){var se=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(W=this.local().add(G+se,n)).$offset=G,W.$x.$localOffset=se}else W=this.utc();return W};var d=l.format;l.format=function(R){var w=R||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return d.call(this,w)},l.valueOf=function(){var R=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*R},l.isUTC=function(){return!!this.$u},l.toISOString=function(){return this.toDate().toISOString()},l.toString=function(){return this.toDate().toUTCString()};var f=l.toDate;l.toDate=function(R){return R==="s"&&this.$offset?a(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():f.call(this)};var p=l.diff;l.diff=function(R,w,N){if(R&&this.$u===R.$u)return p.call(this,R,w,N);var G=this.local(),W=a(R).local();return p.call(G,W,w,N)}}})}(Lr)),Lr.exports}var Bh=$h();const Hh=pt(Bh);var xr={exports:{}},jh=xr.exports,Pi;function Wh(){return Pi||(Pi=1,function(e,t){(function(n,r){e.exports=r()})(jh,function(){return function(n,r){r.prototype.weekday=function(s){var i=this.$locale().weekStart||0,o=this.$W,a=(o<i?o+7:o)-i;return this.$utils().u(s)?a:this.subtract(a,"day").add(s,"day")}}})}(xr)),xr.exports}var Yh=Wh();const zh=pt(Yh);var Ur={exports:{}},Gh=Ur.exports,ki;function Vh(){return ki||(ki=1,function(e,t){(function(n,r){e.exports=r()})(Gh,function(){var n="week",r="year";return function(s,i,o){var a=i.prototype;a.week=function(l){if(l===void 0&&(l=null),l!==null)return this.add(7*(l-this.week()),"day");var u=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var c=o(this).startOf(r).add(1,r).date(u),h=o(this).endOf(n);if(c.isBefore(h))return 1}var d=o(this).startOf(r).date(u).startOf(n).subtract(1,"millisecond"),f=this.diff(d,n,!0);return f<0?o(this).startOf("week").week():Math.ceil(f)},a.weeks=function(l){return l===void 0&&(l=null),this.week(l)}}})}(Ur)),Ur.exports}var Kh=Vh();const Xh=pt(Kh);var Pr={exports:{}},qh=Pr.exports,Fi;function Jh(){return Fi||(Fi=1,function(e,t){(function(n,r){e.exports=r()})(qh,function(){return function(n,r){r.prototype.weekYear=function(){var s=this.month(),i=this.week(),o=this.year();return i===1&&s===11?o+1:s===0&&i>=52?o-1:o}}})}(Pr)),Pr.exports}var Zh=Jh();const Qh=pt(Zh);$t.extend(yh);$t.extend(wh);$t.extend(zh);$t.extend(Lh);$t.extend(Xh);$t.extend(Qh);$t.extend(Hh);$t.extend(kh);function Zr(e,t,n,r){if(e>t)throw new Error("a1 should be less than a2");if(n>r)throw new Error("b1 should be less than b2");if(t<n||r<e)return[e,t];if(n<=e&&r>=t)return[];const s=r-n+1;return e<n&&t>r?[e,t-s]:n<=e&&r<t?[r+1-s,t-s]:n>e&&r>=t?[e,n-1]:[e,t]}function ed(e){if(e==null)return!1;const t=e.bullet;return(t==null?void 0:t.listId)!=null}function td(e){if(e==null)return!1;const t=e.paragraphStyle;return Sa(t)}function Sa(e){var t;return!(e==null||(e.indentStart==null||e.indentStart.v===0)&&e.hanging==null||((t=e.hanging)==null?void 0:t.v)===0)}function va(e,t,n){return e.slice(0,t)+n+e.slice(t)}function Oa(e,t,n){return t>n?e:e.slice(0,t)+e.slice(n)}function nd(e){if(e==null||typeof e=="boolean")return!1;if(typeof e=="number")return!isNaN(e);if(typeof e=="string"){const t=e.trim();return t===""?!1:!isNaN(Number(t))}return!1}function rd(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+(t<<6)+(t<<16)-t;return t>>>0}const Ke=Symbol("newer"),it=Symbol("older");class sd{constructor(t){C(this,"entry");this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[Ke],{done:!1,value:t.key}):{done:!0,value:void 0}}}class id{constructor(t){C(this,"entry");this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[Ke],{done:!1,value:t.value}):{done:!0,value:void 0}}}class od{constructor(t){C(this,"entry");this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[Ke],{done:!1,value:[t.key,t.value]}):{done:!0,value:void 0}}}var Uo,Po;Po=Ke,Uo=it;class $i{constructor(t,n){C(this,"key");C(this,"value");C(this,Po);C(this,Uo);this.key=t,this.value=n,this[Ke]=void 0,this[it]=void 0}toJSON(){return{key:this.key,value:this.value}}}class qn{constructor(...t){C(this,"_keymap");C(this,"size",0);C(this,"limit");C(this,"oldest");C(this,"newest");C(this,"_onShiftListeners",[]);if(Bn.hasLength(t,1)){if(Bn.isNumber(t[0])){const n=t[0];this._initialize(n,void 0);return}if(Bn.isIterable(t[0])){const n=t[0];this._initialize(0,n);return}return}if(Bn.hasLength(t,2)){const n=t[0],r=t[1];this._initialize(n,r)}}onShift(t){if(this._onShiftListeners.indexOf(t)===-1)return this._onShiftListeners.push(t),nt(()=>tr(this._onShiftListeners,t));throw new Error("[LRUMap]: the listener has been registered!")}_initialize(t,n){this.oldest=void 0,this.newest=void 0,this.size=0,this.limit=t,this._keymap=new Map,n&&(this.assign(n),t<1&&(this.limit=this.size))}_markEntryAsUsed(t){t!==this.newest&&(t[Ke]&&(t===this.oldest&&(this.oldest=t[Ke]),t[Ke][it]=t[it]),t[it]&&(t[it][Ke]=t[Ke]),t[Ke]=void 0,t[it]=this.newest,this.newest&&(this.newest[Ke]=t),this.newest=t)}assign(t){let n,r=this.limit||Number.MAX_VALUE;this._keymap.clear();const s=t[Symbol.iterator]();for(let i=s.next();!i.done;i=s.next()){const o=new $i(i.value[0],i.value[1]);if(this._keymap.set(o.key,o),n?(n[Ke]=o,o[it]=n):this.oldest=o,n=o,r--===0)throw new Error("overflow")}this.newest=n,this.size=this._keymap.size}set(t,n){let r=this._keymap.get(t);return r?(r.value=n,this._markEntryAsUsed(r),this):(this._keymap.set(t,r=new $i(t,n)),this.newest?(this.newest[Ke]=r,r[it]=this.newest):this.oldest=r,this.newest=r,++this.size,this.size>this.limit&&this.shift(),this)}shift(){const t=this.oldest;if(t)return this.oldest&&this.oldest[Ke]?(this.oldest=this.oldest[Ke],this.oldest[it]=void 0):(this.oldest=void 0,this.newest=void 0),t[Ke]=t[it]=void 0,this._keymap.delete(t.key),--this.size,this._onShiftListeners.forEach(n=>n(t)),[t.key,t.value]}get(t){const n=this._keymap.get(t);if(n)return this._markEntryAsUsed(n),n.value}has(t){return this._keymap.has(t)}find(t){const n=this._keymap.get(t);return n?n.value:void 0}delete(t){const n=this._keymap.get(t);if(n)return this._keymap.delete(n.key),n[Ke]&&n[it]?(n[it][Ke]=n[Ke],n[Ke][it]=n[it]):n[Ke]?(n[Ke][it]=void 0,this.oldest=n[Ke]):n[it]?(n[it][Ke]=void 0,this.newest=n[it]):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 sd(this.oldest)}values(){return new id(this.oldest)}entries(){return this[Symbol.iterator]()}[Symbol.iterator](){return new od(this.oldest)}forEach(t,n){typeof n!="object"&&(n=this);let r=this.oldest;for(;r;)t.call(n,r.value,r.key,this),r=r[Ke]}toJSON(){const t=new Array(this.size);let n=0,r=this.oldest;for(;r;)t[n++]={key:r.key,value:r.value},r=r[Ke];return t}toString(){let t="",n=this.oldest;for(;n;)t+=`${String(n.key)}:${n.value}`,n=n[Ke],n&&(t+=" < ");return t}}class Bn{static hasLength(t,n){return t.length===n}static getValueType(t){return Object.prototype.toString.apply(t)}static isObject(t){return this.getValueType(t)==="[object Object]"}static isIterable(t){return t[Symbol.iterator]!=null}static isNumber(t){return this.getValueType(t)==="[object Number]"}}var kr={exports:{}},ad=kr.exports,Bi;function ld(){return Bi||(Bi=1,function(e,t){(function(n,r){e.exports=r()})(typeof self<"u"?self:ad,function(){return function(){var n={d:function(E,g){for(var m in g)n.o(g,m)&&!n.o(E,m)&&Object.defineProperty(E,m,{enumerable:!0,get:g[m]})},o:function(E,g){return Object.prototype.hasOwnProperty.call(E,g)}},r={};n.d(r,{default:function(){return ht}});var s={1078:"af",1052:"sq",1118:"am",5121:"ar_DZ",15361:"ar_BH",3073:"ar_EG",2049:"ar_IQ",11265:"ar_JO",13313:"ar_KW",12289:"ar_LB",4097:"ar_LY",6145:"ar_MA",8193:"ar_OM",16385:"ar_QA",1025:"ar_SA",10241:"ar_SY",7169:"ar_TN",14337:"ar_AE",9217:"ar_YE",1067:"hy",1101:"as",2092:"az_AZ",1068:"az_AZ",1069:"eu",1059:"be",2117:"bn",1093:"bn_IN",5146:"bs",1026:"bg",1109:"my",1027:"ca",2052:"zh_CN",3076:"zh_HK",5124:"zh_MO",4100:"zh_SG",1028:"zh_TW",1050:"hr",1029:"cs",1030:"da",1125:"dv",2067:"nl_BE",1043:"nl_NL",1126:"bin",3081:"en_AU",10249:"en_BZ",4105:"en_CA",9225:"en_CB",2057:"en_GB",16393:"en_IN",6153:"en_IE",8201:"en_JM",5129:"en_NZ",13321:"en_PH",7177:"en_ZA",11273:"en_TT",1033:"en_US",12297:"en_ZW",1061:"et",1071:"mk",1080:"fo",1065:"fa",1124:"fil",1035:"fi",2060:"fr_BE",11276:"fr_CM",3084:"fr_CA",9228:"fr_CG",12300:"fr_CI",1036:"fr_FR",5132:"fr_LU",13324:"fr_ML",6156:"fr_MC",14348:"fr_MA",10252:"fr_SN",4108:"fr_CH",7180:"fr",1122:"fy_NL",2108:"gd_IE",1084:"gd",1110:"gl",1079:"ka",3079:"de_AT",1031:"de_DE",5127:"de_LI",4103:"de_LU",2055:"de_CH",1032:"el",1140:"gn",1095:"gu",1279:"en",1037:"he",1081:"hi",1038:"hu",1039:"is",1136:"ig_NG",1057:"id",1040:"it_IT",2064:"it_CH",1041:"ja",1099:"kn",1120:"ks",1087:"kk",1107:"km",1111:"kok",1042:"ko",1088:"ky",1108:"lo",1142:"la",1062:"lv",1063:"lt",2110:"ms_BN",1086:"ms_MY",1100:"ml",1082:"mt",1112:"mni",1153:"mi",1102:"mr",1104:"mn",2128:"mn",1121:"ne",1044:"no_NO",2068:"no_NO",1096:"or",1045:"pl",1046:"pt_BR",2070:"pt_PT",1094:"pa",1047:"rm",2072:"ro_MO",1048:"ro_RO",1049:"ru",2073:"ru_MO",1083:"se",1103:"sa",3098:"sr_SP",2074:"sr_SP",1072:"st",1074:"tn",1113:"sd",1115:"si",1051:"sk",1060:"sl",1143:"so",1070:"sb",11274:"es_AR",16394:"es_BO",13322:"es_CL",9226:"es_CO",5130:"es_CR",7178:"es_DO",12298:"es_EC",17418:"es_SV",4106:"es_GT",18442:"es_HN",2058:"es_MX",19466:"es_NI",6154:"es_PA",15370:"es_PY",10250:"es_PE",20490:"es_PR",1034:"es_ES",14346:"es_UY",8202:"es_VE",1089:"sw",2077:"sv_FI",1053:"sv_SE",1114:"syc",1064:"tg",1097:"ta",1092:"tt",1098:"te",1054:"th",1105:"bo",1073:"ts",1055:"tr",1090:"tk",1058:"uk",1056:"ur",2115:"uz_UZ",1091:"uz_UZ",1075:"ve",1066:"vi",1106:"cy",1076:"xh",1085:"yi",1077:"zu"};const i=/^([a-z\d]+)(?:[_-]([a-z\d]+))?(?:\.([a-z\d]+))?(?:@([a-z\d]+))?$/i,o={},a={group:" ",decimal:".",positive:"+",negative:"-",percent:"%",exponent:"E",nan:"NaN",infinity:"∞",ampm:["AM","PM"],mmmm6:["Muharram","Safar","Rabiʻ I","Rabiʻ II","Jumada I","Jumada II","Rajab","Shaʻban","Ramadan","Shawwal","Dhuʻl-Qiʻdah","Dhuʻl-Hijjah"],mmm6:["Muh.","Saf.","Rab. I","Rab. II","Jum. I","Jum. II","Raj.","Sha.","Ram.","Shaw.","Dhuʻl-Q.","Dhuʻl-H."],mmmm:["January","February","March","April","May","June","July","August","September","October","November","December"],mmm:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dddd:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ddd:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]};function l(E){const g=i.exec(E);if(!g)throw new SyntaxError("Malformed locale: ".concat(E));return{lang:g[1]+(g[2]?"_"+g[2]:""),language:g[1],territory:g[2]||"",codeset:g[3]||"",modifier:g[4]||""}}function u(E){if(typeof E=="number")return s[65535&E]||null;const g=parseInt(E,16);return isFinite(g)&&s[65535&g]?s[65535&g]||null:i.test(E)?E:null}function c(E){const g=u(E);let m=null;if(g){const T=l(g);m=o[T.lang]||o[T.language]||null}return m}function h(E){return Object.assign({},a,E)}function d(E,g){const m=typeof g=="object"?g:l(g);return o[m.lang]=h(E),m.language===m.lang||o[m.language]||(o[m.language]=h(E)),o[m.lang]}const f=h({group:","});function p(E,g){if(typeof E!="number")return E;if(E<0)return-p(-E,g);if(g){const m=10**(g||0)||1;return p(E*m,0)/m}return Math.round(E)}f.isDefault=!0,d({group:",",ampm:["上午","下午"],mmmm:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],mmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dddd:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],ddd:["周日","周一","周二","周三","周四","周五","周六"]},"zh_CN"),d({group:",",nan:"非數值",ampm:["上午","下午"],mmmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],mmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dddd:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],ddd:["週日","週一","週二","週三","週四","週五","週六"]},"zh_TW"),d({group:",",ampm:["午前","午後"],mmmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],mmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dddd:["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"],ddd:["日","月","火","水","木","金","土"]},"ja"),d({group:",",ampm:["오전","오후"],mmmm:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],mmm:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],dddd:["일요일","월요일","화요일","수요일","목요일","금요일","토요일"],ddd:["일","월","화","수","목","금","토"]},"ko"),d({group:",",ampm:["ก่อนเที่ยง","หลังเที่ยง"],mmmm:["มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม"],mmm:["ม.ค.","ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค."],dddd:["วันอาทิตย์","วันจันทร์","วันอังคาร","วันพุธ","วันพฤหัสบดี","วันศุกร์","วันเสาร์"],ddd:["อา.","จ.","อ.","พ.","พฤ.","ศ.","ส."]},"th"),d({decimal:",",ampm:["dop.","odp."],mmmm:["ledna","února","března","dubna","května","června","července","srpna","září","října","listopadu","prosince"],mmm:["led","úno","bře","dub","kvě","čvn","čvc","srp","zář","říj","lis","pro"],dddd:["neděle","pondělí","úterý","středa","čtvrtek","pátek","sobota"],ddd:["ne","po","út","st","čt","pá","so"]},"cs"),d({group:".",decimal:",",mmmm:["januar","februar","marts","april","maj","juni","juli","august","september","oktober","november","december"],mmm:["jan.","feb.","mar.","apr.","maj","jun.","jul.","aug.","sep.","okt.","nov.","dec."],dddd:["søndag","mandag","tirsdag","onsdag","torsdag","fredag","lørdag"],ddd:["søn.","man.","tir.","ons.","tor.","fre.","lør."]},"da"),d({group:".",decimal:",",ampm:["a.m.","p.m."],mmmm:["januari","februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december"],mmm:["jan.","feb.","mrt.","apr.","mei","jun.","jul.","aug.","sep.","okt.","nov.","dec."],dddd:["zondag","maandag","dinsdag","woensdag","donderdag","vrijdag","zaterdag"],ddd:["zo","ma","di","wo","do","vr","za"]},"nl"),d({group:","},"en"),d({decimal:",",nan:"epäluku",ampm:["ap.","ip."],mmmm:["tammikuuta","helmikuuta","maaliskuuta","huhtikuuta","toukokuuta","kesäkuuta","heinäkuuta","elokuuta","syyskuuta","lokakuuta","marraskuuta","joulukuuta"],mmm:["tammik.","helmik.","maalisk.","huhtik.","toukok.","kesäk.","heinäk.","elok.","syysk.","lokak.","marrask.","jouluk."],dddd:["sunnuntaina","maanantaina","tiistaina","keskiviikkona","torstaina","perjantaina","lauantaina"],ddd:["su","ma","ti","ke","to","pe","la"]},"fi"),d({group:" ",decimal:",",mmmm:["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"],mmm:["janv.","févr.","mars","avr.","mai","juin","juil.","août","sept.","oct.","nov.","déc."],dddd:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],ddd:["dim.","lun.","mar.","mer.","jeu.","ven.","sam."]},"fr"),d({group:".",decimal:",",mmmm:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],mmm:["Jan.","Feb.","März","Apr.","Mai","Juni","Juli","Aug.","Sept.","Okt.","Nov.","Dez."],dddd:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],ddd:["So.","Mo.","Di.","Mi.","Do.","Fr.","Sa."]},"de"),d({group:".",decimal:",",ampm:["π.μ.","μ.μ."],mmmm:["Ιανουαρίου","Φεβρουαρίου","Μαρτίου","Απριλίου","Μαΐου","Ιουνίου","Ιουλίου","Αυγούστου","Σεπτεμβρίου","Οκτωβρίου","Νοεμβρίου","Δεκεμβρίου"],mmm:["Ιαν","Φεβ","Μαρ","Απρ","Μαΐ","Ιουν","Ιουλ","Αυγ","Σεπ","Οκτ","Νοε","Δεκ"],dddd:["Κυριακή","Δευτέρα","Τρίτη","Τετάρτη","Πέμπτη","Παρασκευή","Σάββατο"],ddd:["Κυρ","Δευ","Τρί","Τετ","Πέμ","Παρ","Σάβ"]},"el"),d({decimal:",",ampm:["de.","du."],mmmm:["január","február","március","április","május","június","július","augusztus","szeptember","október","november","december"],mmm:["jan.","febr.","márc.","ápr.","máj.","jún.","júl.","aug.","szept.","okt.","nov.","dec."],dddd:["vasárnap","hétfő","kedd","szerda","csütörtök","péntek","szombat"],ddd:["V","H","K","Sze","Cs","P","Szo"]},"hu"),d({group:".",decimal:",",ampm:["f.h.","e.h."],mmmm:["janúar","febrúar","mars","apríl","maí","júní","júlí","ágúst","september","október","nóvember","desember"],mmm:["jan.","feb.","mar.","apr.","maí","jún.","júl.","ágú.","sep.","okt.","nóv.","des."],dddd:["sunnudagur","mánudagur","þriðjudagur","miðvikudagur","fimmtudagur","föstudagur","laugardagur"],ddd:["sun.","mán.","þri.","mið.","fim.","fös.","lau."]},"is"),d({group:".",decimal:",",mmmm:["Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember"],mmm:["Jan","Feb","Mar","Apr","Mei","Jun","Jul","Agu","Sep","Okt","Nov","Des"],dddd:["Minggu","Senin","Selasa","Rabu","Kamis","Jumat","Sabtu"],ddd:["Min","Sen","Sel","Rab","Kam","Jum","Sab"]},"id"),d({group:".",decimal:",",mmmm:["gennaio","febbraio","marzo","aprile","maggio","giugno","luglio","agosto","settembre","ottobre","novembre","dicembre"],mmm:["gen","feb","mar","apr","mag","giu","lug","ago","set","ott","nov","dic"],dddd:["domenica","lunedì","martedì","mercoledì","giovedì","venerdì","sabato"],ddd:["dom","lun","mar","mer","gio","ven","sab"]},"it"),d({decimal:",",ampm:["a.m.","p.m."],mmmm:["januar","februar","mars","april","mai","juni","juli","august","september","oktober","november","desember"],mmm:["jan.","feb.","mar.","apr.","mai","jun.","jul.","aug.","sep.","okt.","nov.","des."],dddd:["søndag","mandag","tirsdag","onsdag","torsdag","fredag","lørdag"],ddd:["søn.","man.","tir.","ons.","tor.","fre.","lør."]},"nb"),d({decimal:",",mmmm:["stycznia","lutego","marca","kwietnia","maja","czerwca","lipca","sierpnia","września","października","listopada","grudnia"],mmm:["sty","lut","mar","kwi","maj","cze","lip","sie","wrz","paź","lis","gru"],dddd:["niedziela","poniedziałek","wtorek","środa","czwartek","piątek","sobota"],ddd:["niedz.","pon.","wt.","śr.","czw.","pt.","sob."]},"pl"),d({group:".",decimal:",",mmmm:["janeiro","fevereiro","março","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro"],mmm:["jan.","fev.","mar.","abr.","mai.","jun.","jul.","ago.","set.","out.","nov.","dez."],dddd:["domingo","segunda-feira","terça-feira","quarta-feira","quinta-feira","sexta-feira","sábado"],ddd:["dom.","seg.","ter.","qua.","qui.","sex.","sáb."]},"pt"),d({decimal:",",nan:"не число",mmmm:["января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"],mmm:["янв.","февр.","мар.","апр.","мая","июн.","июл.","авг.","сент.","окт.","нояб.","дек."],dddd:["воскресенье","понедельник","вторник","среда","четверг","пятница","суббота"],ddd:["вс","пн","вт","ср","чт","пт","сб"]},"ru"),d({decimal:",",mmmm:["januára","februára","marca","apríla","mája","júna","júla","augusta","septembra","októbra","novembra","decembra"],mmm:["jan","feb","mar","apr","máj","jún","júl","aug","sep","okt","nov","dec"],dddd:["nedeľa","pondelok","utorok","streda","štvrtok","piatok","sobota"],ddd:["ne","po","ut","st","št","pi","so"]},"sk"),d({group:".",decimal:",",ampm:["a. m.","p. m."],mmmm:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"],mmm:["ene.","feb.","mar.","abr.","may.","jun.","jul.","ago.","sept.","oct.","nov.","dic."],dddd:["domingo","lunes","martes","miércoles","jueves","viernes","sábado"],ddd:["dom.","lun.","mar.","mié.","jue.","vie.","sáb."]},"es"),d({decimal:",",ampm:["fm","em"],mmmm:["januari","februari","mars","april","maj","juni","juli","augusti","september","oktober","november","december"],mmm:["jan.","feb.","mars","apr.","maj","juni","juli","aug.","sep.","okt.","nov.","dec."],dddd:["söndag","måndag","tisdag","onsdag","torsdag","fredag","lördag"],ddd:["sön","mån","tis","ons","tors","fre","lör"]},"sv"),d({group:".",decimal:",",ampm:["ÖÖ","ÖS"],mmmm:["Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eylül","Ekim","Kasım","Aralık"],mmm:["Oca","Şub","Mar","Nis","May","Haz","Tem","Ağu","Eyl","Eki","Kas","Ara"],dddd:["Pazar","Pazartesi","Salı","Çarşamba","Perşembe","Cuma","Cumartesi"],ddd:["Paz","Pzt","Sal","Çar","Per","Cum","Cmt"]},"tr");function R(E,g,m){const T=E<0?-1:1,M=10**(g||2),U=10**(m||2);let x,P,I=Math.abs(E),Q=0,pe=0,J=0,_e=1;if((E=I)%1==0)P=[E*T,1];else if(E<1e-19)P=[T,1e19];else if(E>1e19)P=[1e19*T,1];else{do if(I=1/(I-Math.floor(I)),x=_e,_e=_e*Math.floor(I)+Q,Q=x,pe=J,J=Math.floor(E*_e+.5),J>=M||_e>=U)return[T*pe,Q];while(Math.abs(E-J/_e)>=1e-10&&I!==Math.floor(I));P=[T*J,_e]}return P}const w={overflow:"######",dateErrorThrows:!1,dateErrorNumber:!0,dateSpanLarge:!0,leap1900:!0,nbsp:!0,throws:!0,invalid:"######",locale:"",ignoreTimezone:!1},N=Object.assign({},w);function G(E){if(E===null&&(E=w),E){for(const g in E)if(g in w){const m=E[g];N[g]=m==null?w[g]:m}}return{...N}}const W={"#":"",0:"0","?":" "},se={"@":"text","-":"minus","+":"plus"},y=["#000","#FFF","#F00","#0F0","#00F","#FF0","#F0F","#0FF","#000","#FFF","#F00","#0F0","#00F","#FF0","#F0F","#0FF","#800","#080","#008","#880","#808","#088","#CCC","#888","#99F","#936","#FFC","#CFF","#606","#F88","#06C","#CCF","#008","#F0F","#FF0","#0FF","#808","#800","#088","#00F","#0CF","#CFF","#CFC","#FF9","#9CF","#F9C","#C9F","#FC9","#36F","#3CC","#9C0","#FC0"],A=["¤","$","£","¥","֏","؋","৳","฿","៛","₡","₦","₩","₪","₫","€","₭","₮","₱","₲","₴","₸","₹","₺","₼","₽","₾","₿"],j=new RegExp("["+A.join("")+"]");function Z(E,g,m){return g[m+"_max"]=E.length,g[m+"_min"]=E.replace(/#/g,"").length,g}const fe={};function le(E){if(!(E in fe)){const g=[],m=E.replace(/^[#,]+/,"").replace(/[1-9]\d*/g,T=>"?".repeat(T.length));for(let T=0;T<m.length;T++){const M=m.charAt(T);g[T]=M in W?W[M]:M}fe[E]=g.join("")}return fe[E]}function _(E,g){typeof E=="string"&&(E={type:"string",value:E=E.replace(/ /g,W["?"])}),g.push(E)}function H(E){const g=[],m={scale:1,percent:!1,text:!1,date:0,date_eval:!1,date_system:1,sec_decimals:0,general:!1,clock:24,int_pattern:[],frac_pattern:[],man_pattern:[],den_pattern:[],num_pattern:[],tokens:g};let T=E+"",M="int",U=!1,x=null;const P=[];let I,Q,pe=!1;for(;T&&!U;){if(I=/^General/i.exec(T))m.general=!0,_({type:"general"},g);else if(M==="int"&&(I=/^[#?0]+(?:,[#?0]+)*/.exec(T))||M==="den"&&(I=/^[#?\d]+/.exec(T))||(I=/^[#?0]+/.exec(T)))m[M+"_pattern"].push(I[0]),x={type:M,num:I[0]},_(x,g);else if((I=/^\//.exec(T))&&m[M+"_pattern"].length){if(!x)throw new SyntaxError("Missing a numerator in pattern ".concat(E));m.fractions=!0,m.num_pattern.push(m[M+"_pattern"].pop()),x.type="num",M="den",_({type:"div"},g)}else if(I=/^,+/.exec(T)){const L=T.charAt(1)in W;Q.slice(-1)in W&&(I[0].length>1||!L)?m.scale=.001**I[0].length:m.dec_fractions||_(I[0],g)}else{if(I=/^;/.exec(T)){U=!0;break}if(I=/^[@+-]/.exec(T))I[0]==="@"&&(m.text=!0),_({type:se[I[0]]},g);else if(I=/^(?:\[(h+|m+|s+)\])/i.exec(T)){const L=I[1].toLowerCase(),ee=L[0],Ce={type:"",size:0,date:1,raw:I[0],pad:L.length};ee==="h"?(Ce.size=16,Ce.type="hour-elap"):ee==="m"?(Ce.size=32,Ce.type="min-elap"):(Ce.size=64,Ce.type="sec-elap"),m.date=m.date|Ce.size,P.push(Ce),_(Ce,g)}else if(I=/^(?:B2)/i.exec(T))pe||(m.date_system=6);else if(I=/^(?:B1)/i.exec(T))pe||(m.date_system=1);else if(I=/^(?:([hHmMsSyYbBdDegG])\1*)/.exec(T)){const L={type:"",size:0,date:1,raw:I[0]},ee=I[0].toLowerCase(),Ce=ee[0];if(ee==="y"||ee==="yy")L.size=2,L.type="year-short";else if(Ce==="y"||Ce==="e")L.size=2,L.type="year";else if(ee==="b"||ee==="bb")L.size=2,L.type="b-year-short";else if(Ce==="b")L.size=2,L.type="b-year";else if(ee==="d"||ee==="dd")L.size=8,L.type="day",L.pad=/dd/.test(ee);else if(ee==="ddd")L.size=8,L.type="weekday-short";else if(Ce==="d")L.size=8,L.type="weekday";else if(Ce==="h")L.size=16,L.type="hour",L.pad=/hh/i.test(ee);else if(Ce==="m"){ee.length===3?(L.size=4,L.type="monthname-short"):ee.length===5?(L.size=4,L.type="monthname-single"):ee.length>=4&&(L.size=4,L.type="monthname");const Te=P[P.length-1];!L.type&&Te&&!Te.used&&80&Te.size&&(Te.used=!0,L.size=32,L.type="min",L.pad=/mm/.test(ee)),L.type||(L.size=4,L.type="month",L.pad=/mm/.test(ee),L.indeterminate=!0)}else if(Ce==="s"){L.size=64,L.type="sec",L.pad=/ss/.test(ee);const Te=P[P.length-1];Te&&32&Te.size?L.used=!0:Te&&Te.indeterminate&&(delete Te.indeterminate,Te.size=32,Te.type="min",L.used=!0)}m.date=m.date|L.size,m.date_eval=!0,P.push(L),_(L,g)}else if(I=/^(?:AM\/PM|am\/pm|A\/P)/.exec(T))m.clock=12,m.date=16|m.date,m.date_eval=!0,_({type:"am",short:I[0]==="A/P"},g);else if(m.date&&(I=/^\.0{1,3}/i.exec(T))){const L=I[0].length-1,ee=[64,128,256,512][L];m.date=m.date|ee,m.date_eval=!0,m.sec_decimals=Math.max(m.sec_decimals,L),_({type:"subsec",size:ee,decimals:L,date:1,raw:I[0]},g)}else if((I=/^\\(.)/.exec(T))||(I=/^"([^"]*?)"/.exec(T)))_(I[1],g);else if(I=/^\[(<[=>]?|>=?|=)\s*(-?[.\d]+)\]/.exec(T))m.condition=[I[1],parseFloat(I[2],10)];else if(I=/^\[\$([^\]]+)\]/.exec(T)){const L=I[1].split("-"),ee=L.length<2?"":L[L.length-1],Ce=L[0];Ce&&_(Ce,g);const Te=u(ee);Te&&(m.locale=Te);const Pe=parseInt(ee,16);isFinite(Pe)&&16711680&Pe&&(Pe>>16&255)===6&&(m.date_system=6),pe=!0}else if(I=/^\[(black|blue|cyan|green|magenta|red|white|yellow|color\s*(\d+))\]/i.exec(T))m.color=I[2]?y[parseInt(I[2],10)]||"#000":I[1].toLowerCase();else if(!(I=/^\[(DBNum1|ENG|HIJ|JPN|TWN)\]/i.exec(T))){if(I=/^%/.exec(T))m.scale=100,m.percent=!0,_("%",g);else if(I=/^_(\\.|.)/.exec(T))_(" ",g);else if(I=/^\./.exec(T))_({type:"point",value:I[0]},g),m.dec_fractions=!0,M="frac";else if(I=/^[Ee]([+-]?|(?=[0#?]))/.exec(T))m.exponential=!0,m.exp_plus=I[1]==="+",M="man",_({type:"exp",plus:I[1]==="+"},g);else if(!(I=/^\*(\\.|.)/.exec(T))){if(I=/^[BENn[]/.exec(T))throw new SyntaxError("Unexpected char ".concat(T.charAt(0)," in pattern ").concat(E));T[0]==="("&&(m.parens=!0),I=[T[0]],_(I[0],g)}}}Q=I[0],T=T.slice(I?I[0].length:1)}if(m.pattern=E.slice(0,E.length-T.length),/^((?:\[[^\]]+\])+)(;|$)/.test(m.pattern)&&!/^\[(?:h+|m+|s+)\]/.test(m.pattern)&&_({type:"text"},g),m.fractions&&m.dec_fractions||m.fractions&&m.exponential)throw new SyntaxError("Invalid pattern: ".concat(m.pattern));const J=m.int_pattern.join("");if(m.grouping=J.indexOf(",")>=0,m.grouping){const L=J.split(","),ee=L.length;ee===2?(m.group_pri=L[1].length,m.group_sec=m.group_pri):ee>2&&(m.group_pri=L[ee-1].length,m.group_sec=L[ee-2].length)}else m.group_pri=0,m.group_sec=0;Z(J.replace(/[,]/g,""),m,"int"),Z(m.frac_pattern.join(""),m,"frac"),Z(m.man_pattern.join(""),m,"man");let _e=m.num_pattern.join(""),Oe=m.den_pattern.join("");const ce=/\?/.test(Oe)||/\?/.test(_e);return Oe=Oe.replace(/\d/g,ce?"?":"#"),ce&&(Oe=Oe.replace(/#$/g,"?")),Z(_e,m,"num"),Z(Oe,m,"den"),ce&&(_e=_e.replace(/#$/g,"?")),m.int_padding=le(m.int_pattern.join("")),m.man_padding=le(m.man_pattern.join("")),m.num_padding=le(_e),m.den_padding=le(Oe),m.den_pattern.length&&(m.denominator=parseInt(m.den_pattern.join("").replace(/\D/g,""),10)),m.integer=!!m.int_pattern.join("").length,m.fractions&&g.forEach((L,ee)=>{const Ce=g[ee+1];L.type==="string"&&Ce&&(Ce.type==="num"?L.rule="num+int":Ce.type==="div"?L.rule="num":Ce.type==="den"&&(L.rule="den"))}),m}const v=E=>{const g=E.condition;g&&g[1]<0&&(g[0]==="<"||g[0]==="<="||g[0]==="=")||E.tokens.unshift({type:"minus",volatile:!0})};function D(E){const g=[];let m,T=!1,M=null,U=E,x=0,P=!1,I=0,Q=0;do{if(P=H(U),(P.date||P.general)&&(P.int_pattern.length||P.frac_pattern.length||P.scale!==1||P.text))throw new Error("Illegal format");if(P.condition&&(Q++,T=!0),P.text){if(M)throw new Error("Unexpected partition");M=P}P.locale&&(m=u(P.locale)),g.push(P),x=U.charAt(P.pattern.length)===";"?1:0,U=U.slice(P.pattern.length+x),I++}while(x&&I<4&&Q<3);if(x)throw new Error("Unexpected partition");if(Q>2)throw new Error("Unexpected condition");const pe=g[3];if(pe&&(pe.int_pattern.length||pe.frac_pattern.length||pe.date))throw new Error("Unexpected partition");if(T){const J=g.length;if(J===1&&(g[1]=H("General"),g[1].generated=!0),J<3){const _e=g[0],Oe=g[1];if(v(_e),Oe.condition)v(Oe);else{const ce=_e.condition;(ce[0]==="="||ce[1]>=0&&(ce[0]===">"||ce[0]===">="))&&Oe.tokens.unshift({type:"minus",volatile:!0})}}else g.forEach(v)}else{if(g.length<4&&M)for(let J=0,_e=g.length;J<_e;J++)g[J]===M&&g.splice(J,1);if(g.length<1&&M&&(g[0]=H("General"),g[0].generated=!0),g.length<2){const J=H(g[0].pattern);J.tokens.unshift({type:"minus",volatile:!0}),J.generated=!0,g.push(J)}if(g.length<3){const J=H(g[0].pattern);J.generated=!0,g.push(J)}if(g.length<4)if(M)g.push(M);else{const J=H("@");J.generated=!0,g.push(J)}g[0].condition=[">",0],g[1].condition=["<",0],g[2].condition=null}return{pattern:E,partitions:g,locale:m}}const b=Math.floor;function O(E){if((!(arguments.length>1&&arguments[1]!==void 0)||arguments[1])&&E>=0){if(E===0)return[1900,1,0];if(E===60)return[1900,2,29];if(E<60)return[1900,E<32?1:2,(E-1)%31+1]}let m=E+68569+2415019;const T=b(4*m/146097);m-=b((146097*T+3)/4);const M=b(4e3*(m+1)/1461001);m=m-b(1461*M/4)+31;const U=b(80*m/2447),x=m-b(2447*U/80);m=b(U/11);const P=U+2-12*m;return[0|100*(T-49)+M+m,0|P,0|x]}function k(E){return O(E+1462)}function $(E){if(E===60)throw new Error("#VALUE!");if(E<=1)return[1317,8,29];if(E<60)return[1317,E<32?9:10,1+(E-2)%30];const g=10631/30,m=.1335;let T=E+466935;const M=b(T/10631);T-=10631*M;const U=b((T-m)/g);T-=b(U*g+m);const x=b((T+28.5001)/29.5);return x===13?[30*M+U,12,30]:[30*M+U,x,T-b(29.5001*x-29)]}function V(E){let g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,m=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2];const T=b(E);return g===6?$(T):g===-1?k(T):O(T,m)}const ie=Math.floor,de=86400;function ge(E,g){let m=null;if(Array.isArray(E)){const[T,M,U,x,P,I]=E;m=Date.UTC(T,M==null?0:M-1,U!=null?U:1,x||0,P||0,I||0)}else if(E instanceof Date&&(m=1*E,!g||!g.ignoreTimezone)){const T=new Date;T.setUTCFullYear(E.getFullYear(),E.getMonth(),E.getDate()),T.setUTCHours(E.getHours(),E.getMinutes(),E.getSeconds(),E.getMilliseconds()),m=1*T}if(m!=null&&isFinite(m)){const T=m/864e5;return T-(T<=-25509?-25568:-25569)}return E}function ye(E,g){let m=0|E;const T=de*(E-m);let M=ie(T);T-M>.9999&&(M+=1,M===de&&(M=0,m+=1));const U=M<0?de+M:M,[x,P,I]=V(E,0,g&&g.leap1900),Q=ie(U/60/60)%60,pe=ie(U/60)%60,J=ie(U)%60;if(g&&g.nativeDate){const _e=new Date(0);return _e.setUTCFullYear(x,P-1,I),_e.setUTCHours(Q,pe,J),_e}return[x,P,I,Q,pe,J]}function Ae(E){return!!(E[0]&&E[0].percent||E[1]&&E[1].percent||E[2]&&E[2].percent||E[3]&&E[3].percent)}function S(E){return!!(E[0]&&E[0].date||E[1]&&E[1].date||E[2]&&E[2].date||E[3]&&E[3].date)}function F(E){const[g,m,T,M]=E;return!(g&&!g.generated||m&&!m.generated||T&&!T.generated||!M||!M.text||M.generated)}const K={text:15,datetime:10.8,date:10.8,time:10.8,percent:10.6,currency:10.4,grouped:10.2,scientific:6,number:4,fraction:2,general:0,error:0},q=[["DMY",1],["DM",2],["MY",3],["MDY",4],["MD",5],["hmsa",6],["hma",7],["hms",8],["hm",9]],z={total:1,sign:0,period:0,int:1,frac:0},Y=(E,g)=>E.replace(/\./,g.decimal);function ue(E,g,m,T){const M=0|m;if(typeof m=="string")E.push(m);else if(m===M)E.push(Math.abs(M));else{const U=Math.abs(m);let x=U?Math.floor(Math.log10(U)):0,P=x<0?U*10**-x:U/10**x;P===10&&(P=1,x++);const I=function(pe){let J=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];const _e=Math.abs(pe);if(!_e)return z;const Oe=J&&pe<0?1:0,ce=Math.floor(_e),L=Math.floor(Math.log10(_e)+1);let ee=0,Ce=0;if(ce!==_e){ee=1;const Te=String(p(L<0?_e*10**-L:_e/10**L,15));let Pe=Te.length,ke=!0,We=0;for(;We<=Te.length;){if(Te[We]==="."){Pe--;break}Te[We]==="0"&&ke?Pe--:ke=!1,We++}Ce=Pe-L,Ce<0&&(Ce=0,ee=0)}return{total:Oe+Math.max(L,1)+ee+Ce,digits:Math.max(L,0)+Ce,sign:Oe,period:ee,int:Math.max(L,1),frac:Ce}}(U),Q=()=>{const pe=Math.abs(x);let J;J=P===1?P:p(P,5),E.push(Y(J+"",T),T.exponent,x<0?T.negative:T.positive,pe<10?"0":"",pe)};if(x>=-4&&x<=-1){const pe=U.toPrecision(10+x).replace(/\.?0+$/,"");E.push(Y(pe,T))}else if(x===10){const pe=U.toFixed(10).slice(0,12).replace(/\.$/,"");E.push(Y(pe,T))}else if(Math.abs(x)<=9)if(I.total<=11){const pe=p(U,9).toFixed(I.frac);E.push(Y(pe,T))}else x===9?E.push(Math.floor(U)):x>=0&&x<9?E.push(p(U,9-x)):Q();else I.total>=12?Q():Math.floor(U)===U?E.push(Math.floor(U)):E.push(Y(p(U,9).toFixed(I.frac),T))}return E}const ae=86400,B={int:"integer",frac:"fraction",man:"mantissa",num:"numerator",den:"denominator"},te=function(E){let g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;const m=Math.floor(Math.log10(E));return g>1?Math.floor(m/g)*g:m};function oe(E,g,m,T){let M="",U="",x="",P="",I="",Q=0,pe=0|E,J=0,_e=0,Oe=1,ce=0,L=0,ee=0,Ce=0,Te=0,Pe=0;const ke=T||f;if(!g.text&&isFinite(g.scale)&&g.scale!==1&&(E=function(Se){if(Se===0)return Se;const Me=Math.ceil(Math.log10(Se<0?-Se:Se)),ne=10**(16-Math.floor(Me));return Math.round(Se*ne)/ne}(E*g.scale)),g.exponential){let Se=Math.abs(E);if(Se){const Me=10**-te(Se,g.int_max),ne=p(Se*Me,g.frac_max)/Me;Q=te(ne,g.int_max)}Se/=10**Q,E=E<0?-Se:Se,M+=Math.abs(Q)}if(g.integer){const Se=Math.abs(p(E,g.fractions?1:g.frac_max));I+=Se<1?"":Math.floor(Se)}if(g.grouping){let Se="",Me=I.length;for(Me>g.group_pri&&(Me-=g.group_pri,Se=ke.group+I.slice(Me,Me+g.group_pri)+Se);Me>g.group_sec;)Me-=g.group_sec,Se=ke.group+I.slice(Me,Me+g.group_sec)+Se;I=Me?I.slice(0,Me)+Se:Se}g.dec_fractions&&(P=String(p(E,g.frac_max)).split(".")[1]||"");let We=!1;if(g.fractions){const Se=Math.abs(g.integer?E%1:E);if(Se)if(We=!0,isFinite(g.denominator))x+=g.denominator,U+=p(Se*g.denominator),U==="0"&&(U="",x="",We=!1,I||(I="0"));else{const Me=R(Se,g.integer?g.num_max:1/0,g.den_max);U+=Me[0],x+=Me[1],g.integer&&U==="0"&&(I||(I="0"),U="",x="",We=!1)}}if(g.date){pe=Math.trunc(E);const Se=ae*(E-pe);if(J=Math.floor(Se),Pe=Se-J,Math.abs(Pe)<1e-6?Pe=0:Pe>.9999&&(Pe=0,J+=1,J===ae&&(J=0,pe+=1)),Pe){const Me=512&g.date||256&g.date||128&g.date;(Me===512&&Pe>.9995||Me===256&&Pe>.995||Me===128&&Pe>.95||!Me&&Pe>=.5)&&(J++,Pe=0)}if(pe||g.date_system){const Me=V(E,g.date_system,m.leap1900);_e=Me[0],Oe=Me[1],ce=Me[2]}if(J){const Me=J<0?ae+J:J;Te=Math.floor(Me)%60,Ce=Math.floor(Me/60)%60,ee=Math.floor(Me/60/60)%60}if(L=(6+pe)%7,g.date_eval&&(dt=E,gt=pe+J/ae,m.dateSpanLarge?dt<-694324||gt>=35830291:dt<0||gt>=2958466)){if(m.dateErrorThrows)throw new Error("Date out of bounds");return m.dateErrorNumber?ue(E<0?[ke.negative]:[],0,E,ke).join(""):m.overflow}}var dt,gt;if(g.int_padding&&(I=g.int_padding.length===1?I||g.int_padding:g.int_padding.substring(0,g.int_padding.length-I.length)+I),g.num_padding&&(U=g.num_padding.length===1?U||g.num_padding:g.num_padding.substring(0,g.num_padding.length-U.length)+U),g.den_padding&&(x=g.den_padding.length===1?x||g.den_padding:x+g.den_padding.slice(x.length)),g.man_padding){const Se=g.exp_plus?"+":"";M=g.man_padding.length===1?(Q<0?"-":Se)+(M||g.man_padding):(Q<0?"-":Se)+g.man_padding.slice(0,g.man_padding.length-M.length)+M}const Ee=[];let Qe=0;const ve={int:0,frac:0,man:0,num:0,den:0};for(let Se=0,Me=g.tokens.length;Se<Me;Se++){const ne=g.tokens[Se],lt=ne.num?ne.num.length:0;if(ne.type==="string")ne.rule?ne.rule==="num"?We?Ee.push(ne.value):(g.num_min>0||g.den_min>0)&&Ee.push(ne.value.replace(/./g,W["?"])):ne.rule==="num+int"?We&&I?Ee.push(ne.value):g.den_min>0&&(I||g.num_min)&&Ee.push(ne.value.replace(/./g,W["?"])):ne.rule==="den"&&(We?Ee.push(ne.value):(g.den_min>0||g.den_min>0)&&Ee.push(ne.value.replace(/./g,W["?"]))):Ee.push(ne.value);else if(ne.type==="error")Ee.push(m.invalid);else if(ne.type==="point")Ee.push(g.date?ne.value:ke.decimal);else if(ne.type==="general")ue(Ee,0,E,ke);else if(ne.type==="exp")Ee.push(ke.exponent);else if(ne.type==="minus")ne.volatile&&g.date||ne.volatile&&(E>=0||typeof E!="number")||(ne.volatile&&!g.fractions&&(g.integer||g.dec_fractions)?(E<0&&I&&I!=="0"||P)&&Ee.push(ke.negative):Ee.push(ke.negative));else if(ne.type==="plus")Ee.push(ke.positive);else if(ne.type==="text")Ee.push(E);else if(ne.type==="div")We?Ee.push("/"):g.num_min>0||g.den_min>0?Ee.push(W["?"]):Ee.push(W["#"]);else if(ne.type==="int")if(g.int_pattern.length===1)Ee.push(I);else{const Be=Qe?g.int_pattern.join("").length-ve.int:1/0,Nt=Qe===g.int_pattern.length-1?0:g.int_pattern.join("").length-(ve.int+ne.num.length);Ee.push(I.substring(I.length-Be,I.length-Nt)),Qe++,ve.int+=ne.num.length}else if(ne.type==="frac"){const Be=ve.frac;for(let Nt=0;Nt<lt;Nt++)Ee.push(P[Nt+Be]||W[ne.num[Nt]]);ve.frac+=lt}else if(ne.type in B)g[ne.type+"_pattern"].length===1?(ne.type==="int"&&Ee.push(I),ne.type==="frac"&&Ee.push(P),ne.type==="man"&&Ee.push(M),ne.type==="num"&&Ee.push(U),ne.type==="den"&&Ee.push(x)):(Ee.push(B[ne.type].slice(ve[ne.type],ve[ne.type]+lt)),ve[ne.type]+=lt);else if(ne.type==="year")_e<0&&Ee.push(ke.negative),Ee.push(String(Math.abs(_e)).padStart(4,"0"));else if(ne.type==="year-short"){const Be=_e%100;Ee.push(Be<10?"0":"",Be)}else if(ne.type==="month")Ee.push(ne.pad&&Oe<10?"0":"",Oe);else if(ne.type==="monthname-single")g.date_system===6?Ee.push(ke.mmmm6[Oe-1].charAt(0)):Ee.push(ke.mmmm[Oe-1].charAt(0));else if(ne.type==="monthname-short")g.date_system===6?Ee.push(ke.mmm6[Oe-1]):Ee.push(ke.mmm[Oe-1]);else if(ne.type==="monthname")g.date_system===6?Ee.push(ke.mmmm6[Oe-1]):Ee.push(ke.mmmm[Oe-1]);else if(ne.type==="weekday-short")Ee.push(ke.ddd[L]);else if(ne.type==="weekday")Ee.push(ke.dddd[L]);else if(ne.type==="day")Ee.push(ne.pad&&ce<10?"0":"",ce);else if(ne.type==="hour"){const Be=ee%g.clock||(g.clock<24?g.clock:0);Ee.push(ne.pad&&Be<10?"0":"",Be)}else if(ne.type==="min")Ee.push(ne.pad&&Ce<10?"0":"",Ce);else if(ne.type==="sec")Ee.push(ne.pad&&Te<10?"0":"",Te);else if(ne.type==="subsec"){Ee.push(ke.decimal);const Be=Pe.toFixed(g.sec_decimals);Ee.push(Be.slice(2,2+ne.decimals))}else if(ne.type==="am"){const Be=ee<12?0:1;ne.short&&!T?Ee.push("AP"[Be]):Ee.push(ke.ampm[Be])}else if(ne.type==="hour-elap"){E<0&&Ee.push(ke.negative);const Be=24*pe+Math.floor(Math.abs(J)/3600);Ee.push(String(Math.abs(Be)).padStart(ne.pad,"0"))}else if(ne.type==="min-elap"){E<0&&Ee.push(ke.negative);const Be=1440*pe+Math.floor(Math.abs(J)/60);Ee.push(String(Math.abs(Be)).padStart(ne.pad,"0"))}else if(ne.type==="sec-elap"){E<0&&Ee.push(ke.negative);const Be=pe*ae+Math.abs(J);Ee.push(String(Math.abs(Be)).padStart(ne.pad,"0"))}else if(ne.type==="b-year")Ee.push(_e+543);else if(ne.type==="b-year-short"){const Be=(_e+543)%100;Ee.push(Be<10?"0":"",Be)}}return m.nbsp?Ee.join(""):Ee.join("").replace(/\u00a0/g," ")}function me(E,g){for(let m=0;m<3;m++){const T=g[m];if(T){let M;if(T.condition){const U=T.condition[0],x=T.condition[1];U==="="?M=E===x:U===">"?M=E>x:U==="<"?M=E<x:U===">="?M=E>=x:U==="<="?M=E<=x:U==="<>"&&(M=E!==x)}else M=!0;if(M)return T}}}const be=H("@"),De="black",X={};function Re(E,g){if(E){const m=E[0];g[m]=g[m]||{},Re(E.slice(1),g[m])}else g.$=!0}["d-F-y","d-F-Y","d-M-y","d-M-Y","F-d-y","F-d-Y","F-j-y","F-j-Y","j-F-y","j-F-Y","j-M-y","j-M-Y","M-d-y","M-d-Y","M-j-y","M-j-Y","m-d-y","m-d-Y","m-j-y","m-j-Y","n-d-y","n-d-Y","n-j-y","n-j-Y","y-F-d","y-F-j","y-M-d","y-M-j","Y-F-d","Y-F-j","Y-M-d","Y-m-d","Y-M-j","Y-m-j","Y-n-d","Y-n-j","j-F","j-M","d-F","d-M","n-d","n-j","n-Y","m-d","m-j","m-Y","M-Y","M-y","F-y","F-Y","Y-M","Y-n","Y-m","Y-F","Y-M"].forEach(E=>{Re(E,X),Re(E+" x",X),Re(E+" l",X),Re(E+" l x",X),Re("l "+E,X),Re("l "+E+" x",X),Re(E+" D",X),Re(E+" D x",X),Re("D "+E,X),Re("D "+E+" x",X)});const ze={jan:1,feb:2,mar:3,apr:4,may:5,jun:6,jul:7,aug:8,sep:9,oct:10,nov:11,dec:12},He={january:1,february:2,march:3,april:4,june:6,july:7,august:8,september:9,october:10,november:11,december:12},Ue={sunday:"l",monday:"l",tuesday:"l",wednesday:"l",thursday:"l",friday:"l",saturday:"l",sun:"D",mon:"D",tue:"D",wed:"D",thu:"D",fri:"D",sat:"D"},qe=new Date().getUTCFullYear();function Et(E){const g=new RegExp("^([\\s+%"+A.join("")+"(-]*)(((?:(?:\\d[\\d,]*)(?:\\.\\d*)?|(?:\\.\\d+)))([eE][+-]?\\d+)?)([\\s%"+A.join("")+")]*)$").exec(E);if(g){const[,m,T,M,U,x]=g;let P=1,I="",Q=!1,pe=!1,J=!1,_e=!1,Oe=!1,ce=null,L=!1,ee=parseFloat(T.replace(/,/g,""));if(!isFinite(ee))return null;for(let Te=0;Te<m.length;Te++){const Pe=m[Te];if(Pe==="-"){if(Q||pe)return null;Q=!0,P=-1}else if(j.test(Pe)){if(Oe)return null;Oe=!0,ce=Pe}else if(Pe==="("){if(pe||Q)return null;pe=!0,P=-1}else if(Pe==="%"){if(_e)return null;_e=!0}}for(let Te=0;Te<x.length;Te++){const Pe=x[Te];if(j.test(Pe)){if(Oe)return null;Oe=!0,ce=Pe,L=!0}else if(Pe===")"){if(J||!pe)return null;J=!0}else if(Pe==="%"){if(_e)return null;_e=!0}}if(U){if(_e||Oe)return null;I="0.00E+00"}else if(_e){if(Oe)return null;I=M.includes(".")?"0.00%":"0%",ee*=.01}else if(Oe){const Te=M.includes(".")?"#,##0.00":"#,##0";I=L?Te+ce:ce+Te}else M.includes(",")&&(I=M.includes(".")?"#,##0.00":"#,##0");const Ce={v:ee*P};return I&&(Ce.z=I),Ce}}const Ge=(E,g,m)=>{const T=m.path||"",M=Object.keys(g);for(let U=0;U<M.length;U++){let x;const P=M[U];if(g[P]){if(P==="$"||P==="€")E||(x=m);else if(P==="-"){const I=/^(\s*([./-]|,\s)\s*|\s+)/.exec(E);if(I){const Q=I[1]==="-"||I[1]==="/"||I[1]==="."?I[1]:" ";if(!m.sep||m.sep===Q){const pe=I[0].replace(/\s+/g," ");x=Ge(E.slice(I[0].length),g[P],{...m,sep:Q,path:T+pe})}}}else if(P===" "){const I=/^[,.]?\s+/.exec(E);if(I){const Q=I[0].replace(/\s+/g," ");x=Ge(E.slice(I[0].length),g[P],{...m,path:T+Q})}}else if(P==="j"||P==="d"){const I=/^(0?[1-9]|1\d|2\d|3[01])\b/.exec(E);I&&(x=Ge(E.slice(I[0].length),g[P],{...m,day:I[0],path:T+P}))}else if(P==="n"||P==="m"){const I=/^(0?[1-9]|1[012])\b/.exec(E);I&&(x=Ge(E.slice(I[0].length),g[P],{...m,month:+I[0],_mon:I[0],path:T+P}))}else if(P==="F"||P==="M"){const I=/^([a-z]{3,9})\b/i.exec(E),Q=I&&(P==="F"?He:ze)[I[0].toLowerCase()];Q&&(x=Ge(E.slice(I[0].length),g[P],{...m,month:Q,_mon:I[0],path:T+P}))}else if(P==="l"||P==="D"){const I=/^([a-z]{3,9})\b/i.exec(E);(I&&Ue[I[0].toLowerCase()])===P&&(x=Ge(E.slice(I[0].length),g[P],{...m,path:T+P}))}else if(P==="y"){const I=/^\d\d\b/.exec(E);if(I){const Q=+I[0]>=30?+I[0]+1900:+I[0]+2e3;x=Ge(E.slice(I[0].length),g[P],{...m,year:Q,path:T+P})}}else if(P==="Y"){const I=/^\d\d\d\d\b/.exec(E);I&&(x=Ge(E.slice(I[0].length),g[P],{...m,year:+I[0],path:T+P}))}else{if(P!=="x")throw new Error('Unknown date token "'.concat(P,'"'));{const I=Ve(E);I&&(x=Ge("",g[P],{...m,time:I.v,tf:I.z,path:T+P}))}}if(x)return x}}};function et(E,g){const m=Ge(E.trim(),X,{path:""});if(m){var T;if(m.sep==="."&&m.path.length===3)return null;const M=+((T=m.year)!==null&&T!==void 0?T:qe);if(m.day||(m.day=1),!function(P,I,Q){if(Q<1||I<1||I>12)return!1;if(I===2){if(Q>(P%4==0&&P%100!=0||P%400==0||P===1900?29:28))return!1}else if((I===4||I===6||I===9||I===11)&&Q>30||(I===1||I===3||I===5||I===7||I===8||I===10||I===12)&&Q>31)return!1;return!0}(M,m.month,m.day))return null;let U=-1/0;if(M<1900)return null;M<=1900&&m.month<=2?U=25568:M<1e4&&(U=25569);const x=Date.UTC(M,m.month-1,m.day)/864e5+U+(m.time||0);if(x>=0&&x<=2958465){const P=m._mon[0]==="0"||m.day[0]==="0"||m._mon.length===2&&m.day.length===2,I=m.path.replace(/[jdlDnmMFyYx-]/g,Q=>Q==="j"||Q==="d"?P?"dd":"d":Q==="D"?"ddd":Q==="l"?"dddd":Q==="n"||Q==="m"?P?"mm":"m":Q==="M"?"mmm":Q==="F"?"mmmm":Q==="y"?"yy":Q==="x"?m.tf||"":Q==="Y"?"yyyy":Q);return g&&g.nativeDate?{v:ye(x,g),z:I}:{v:x,z:I}}}return null}function Ve(E){const g=/^\s*([10]?\d|2[0-4])(?::([0-5]\d|\d))?(?::([0-5]\d|\d))?(\.\d{1,10})?(?:\s*([AP])M?)?\s*$/i.exec(E);if(g){const[,m,T,M,U,x]=g;if(U&&!M||!x&&!T&&!M)return null;let P=1*(m||0);if(x){if(P>=13)return null;x[0]!=="p"&&x[0]!=="P"||(P+=12)}return{v:(60*P*60+60*(1*(T||0))+1*(M||0)+1*(U||0))/86400,z:(m.length===2?"hh":"h")+":mm"+(M?":ss":"")+(x?" AM/PM":"")}}return null}function ct(E){return/^\s*true\s*$/i.test(E)?{v:!0}:/^\s*false\s*$/i.test(E)?{v:!1}:null}const at={};function xt(E,g){const{pattern:m,partitions:T,locale:M}=E,U=I=>{const Q=Object.assign({},G(),g,I);return M&&(Q.locale=M),Q},x=(I,Q)=>{const pe=U(Q);return function(J,_e,Oe){const ce=c(Oe.locale),L=_e[3]?_e[3]:be;if(typeof J=="boolean"&&(J=J?"TRUE":"FALSE"),J==null)return"";if(typeof J!="number")return oe(J,L,Oe,ce);if(!isFinite(J)){const Ce=ce||f;return isNaN(J)?Ce.nan:(J<0?Ce.negative:"")+Ce.infinity}const ee=me(J,_e);return ee?oe(J,ee,Oe,ce):Oe.overflow}(ge(I,pe),T,pe)};x.color=(I,Q)=>function(pe,J){if(typeof pe!="number"||!isFinite(pe))return(J[3]?J[3].color:be.color)||De;const _e=me(pe,J);return _e&&_e.color||De}(ge(I,U(Q)),T);const P=function(I){var Q;let pe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;const[J,_e]=I,Oe=J.frac_max,ce={type:"general",isDate:S(I),isText:F(I),isPercent:Ae(I),maxDecimals:J.general?9:Oe,scale:(Q=J.scale)!==null&&Q!==void 0?Q:1,color:0,parentheses:0,grouped:J.grouping?1:0,_partitions:I},L=!ce.isDate&&!ce.isText&&!J.error&&J.tokens.some(ke=>ke.type==="string"&&(pe?ke.value===pe:j.test(ke.value)));let ee="G",Ce=Oe>=0?Math.min(15,Oe):"",Te="",Pe="";if(_e&&_e.color&&(Pe="-",ce.color=1),J.parens&&(Te="()",ce.parentheses=1),L)ee="C",ce.type="currency";else if(J.error)ce.type="error",ce.maxDecimals=0;else if(ce.isDate){let ke=0,We=0,dt="";J.tokens.forEach(Ee=>{const Qe=Ee.type;/^(b-)?year/.test(Qe)?(dt+="Y",We++):Qe.startsWith("month")?(dt+="M",We++):/^(week)?day/.test(Qe)?(dt+="D",We++):Qe!=="hour"&&Qe!=="min"&&Qe!=="sec"&&Qe!=="am"||(dt+=Qe[0],ke++)}),ce.type="date",We&&ke?ce.type="datetime":!We&&ke&&(ce.type="time");const gt=q.find(Ee=>dt.startsWith(Ee[0]));ee=gt?"D":"G",Ce=gt?gt[1]:""}else ce.isText?(ee="G",ce.type="text",Ce="",ce.maxDecimals=0):J.general?(ee="G",ce.type="general",Ce=""):J.fractions?(ee="G",ce.type="fraction",Ce=""):J.exponential?(ee="S",ce.type="scientific"):ce.isPercent?(ee="P",ce.type="percent"):J.grouping?(ee=",",ce.type="grouped"):(J.int_max||Oe)&&(ee="F",ce.type="number");return ce.code=ee+Ce+Pe+Te,ce.level=K[ce.type],Object.freeze(ce)}(T,(g||{}).currency)||new SyntaxError;return x.info=P,x.dateInfo=function(I){const[Q]=I;return{year:!!(2&Q.date),month:!!(4&Q.date),day:!!(8&Q.date),hours:!!(16&Q.date),minutes:!!(32&Q.date),seconds:!!(64&Q.date),clockType:Q.clock===12?12:24}}(T),x.isPercent=()=>!!P.isPercent,x.isDate=()=>!!P.isDate,x.isText=()=>!!P.isText,x.pattern=m,E.error&&(x.error=E.error),x.options=U,x.locale=M||g&&g.locale||"",Object.freeze(x)}function Fe(E,g){E||(E="General");let m=null;return at[E]?m=at[E]:(m=Object.assign({},G(),g).throws?D(E):function(T){try{return D(T)}catch(M){const U={tokens:[{type:"error"}],error:M.message};return{pattern:T,partitions:[U,U,U,U],error:M.message,locale:null}}}(E),m.error||(at[E]=m)),xt(m,g)}Fe.isDate=E=>Fe(E,{throws:!1}).isDate(),Fe.isPercent=E=>Fe(E,{throws:!1}).isPercent(),Fe.isText=E=>Fe(E,{throws:!1}).isText(),Fe.getInfo=(E,g)=>Fe(E,{...g,throws:!1}).info,Fe.getDateInfo=(E,g)=>Fe(E,{...g,throws:!1}).dateInfo,Fe.dateToSerial=ge,Fe.dateFromSerial=ye,Fe.options=G,Fe.dec2frac=R,Fe.round=p,Fe.codeToLocale=s,Fe.parseLocale=l,Fe.getLocale=c,Fe.addLocale=(E,g)=>{const m=l(g);return delete at[m.lang],delete at[m.language],d(E,m)},Fe.format=function(E,g,m){let T=arguments.length>3&&arguments[3]!==void 0&&arguments[3];const M=m&&typeof m=="object"?m:{locale:m,throws:!T};return Fe(E,M)(ge(g,M),M)},Fe.is_date=Fe.isDate,Fe.parseNumber=Et,Fe.parseDate=et,Fe.parseTime=Ve,Fe.parseBool=ct,Fe.parseValue=function(E,g){var m,T,M;return(m=(T=(M=Et(E))!==null&&M!==void 0?M:et(E,g))!==null&&T!==void 0?T:Ve(E))!==null&&m!==void 0?m:ct(E)};var ht=Fe;return r=r.default}()})}(kr)),kr.exports}var us,Hi;function ud(){return Hi||(Hi=1,us=ld()),us}var cd=ud();const hd=pt(cd),dd=hd;function Kt(e){let t=0;const n=Object.keys(e);for(const r of n){const s=Number(r);t=Math.max(t,s)}return t+1}function Ms(e,t,n){const r=Kt(n),s=n;for(let i=r-1;i>=e;i--)s[i+1]=s[i];s[e]=t}function Ds(e,t,n){const r=Object.keys(n).reduce((s,i)=>Math.max(s,Number.parseInt(i)),0)+1;for(let s=e;s<r;s++)s<e+t?delete n[s]:n[s]!==void 0&&(n[s-t]=n[s],delete n[s])}function fd(e,t){const n=e,r=Object.keys(n),s=r.length,i=t,o=Object.keys(i),a=o.length,l={};let u=0;for(let c=0;c<s;c++,u++){const h=r[c];l[u]=n[h]}for(let c=0;c<a;c++,u++){const h=o[c];l[u]=i[h]}return l}function gd(e,t,n){const r=n;if(Kt(n)>0){const i={};let o=0;for(let a=e;a<=t;a++)r[a]&&(i[o]=r[a],o++);return i}return{}}function Ls(e,t,n,r){const s=e>n;if(!s&&e+t>n)throw new Error("Invalid move operation");s?md(e,t,n,r):_d(e,t,n,r)}function md(e,t,n,r){const s=r,i=[];for(let o=e;o<e+t;o++)i.push(s[o]);for(let o=e-1;o>=n;o--){const a=s[o];s[o+t]=a,a===void 0&&delete s[o+t]}i.forEach((o,a)=>{s[n+a]=o,o===void 0&&delete s[n+a]})}function _d(e,t,n,r){const s=r,i=[];for(let o=e;o<e+t;o++)i.push(s[o]);for(let o=e+t;o<n;o++){const a=s[o];s[o-t]=a,a===void 0&&delete s[o-t]}i.forEach((o,a)=>{s[n+a-t]=o,o===void 0&&delete s[n+a-t]})}class At{constructor(t={}){C(this,"_matrix");this._setOriginValue(t)}static MakeObjectMatrixSize(t){return new At({[t-1]:{}})}getMatrix(){return this._matrix}forEach(t){const n=this._matrix,r=Object.keys(n);for(const s of r){const i=Number(s),o=n[i];if(t(i,o)===!1)return this}return this}forRow(t){const n=this._matrix,r=Object.keys(n);for(const s of r){const i=Number(s),o=n[i];if(t(i,Object.keys(o).map(l=>Number(l)))===!1)return this}return this}forValue(t){const n=this._matrix;for(const r in n){const s=Number(r),i=n[s];if(i)for(const o in i){const a=Number(o),l=i[a];if(t(s,a,l)===!1)return this}}return this}swapRow(t,n){const r=this._matrix[t],s=this._matrix[n];this._matrix[t]=s,this._matrix[n]=r}getRow(t){return this._matrix[t]}getRowOrCreate(t){let n=this.getRow(t);return n==null&&(n={},this._matrix[t]=n),n}reset(){this._setOriginValue({})}hasValue(){const t=this._matrix,n=Object.keys(t);if(n.length===0)return!1;for(const r of n){const s=Number(r),i=t[s];if(Object.keys(i).length>0)return!0}return!1}getValue(t,n){var r,s;return(s=(r=this._matrix)==null?void 0:r[t])==null?void 0:s[n]}setValue(t,n,r){const s=this.getRowOrCreate(t);s[n]=r}deleteValue(t,n){var r,s;(s=(r=this._matrix)==null?void 0:r[t])==null||delete s[n]}realDeleteValue(t,n){var r,s,i;if((s=(r=this._matrix)==null?void 0:r[t])==null||delete s[n],this.getRow(t)){const o=this.getRow(t);if(o==null)return;Object.keys(o).length===0&&((i=this._matrix)==null||delete i[t])}}setRow(t,n){this._matrix[t]=n}moveRows(t,n,r){Ls(t,n,r,this._matrix)}moveColumns(t,n,r){this.forEach((s,i)=>{Ls(t,n,r,i)})}insertRows(t,n){for(let r=t;r<t+n;r++)Ms(r,{},this._matrix)}insertColumns(t,n){for(let r=t;r<t+n;r++)this.forEach((s,i)=>{i&&Ms(r,void 0,i)})}removeRows(t,n){Ds(t,n,this._matrix)}removeColumns(t,n){this.forEach((r,s)=>{s&&Ds(t,n,s)})}getFragment(t,n,r,s){const i=new At;let o=0;for(let a=t;a<=n;a++){const l={};let u=0;for(let c=r;c<=s;c++){const h=this.getValue(a,c);l[u]=h,u++}i.setRow(o,l),o++}return i}getSlice(t,n,r,s){const i=new At;for(let o=t;o<=n;o++)for(let a=r;a<=s;a++){const l=this.getValue(o,a);l&&i.setValue(o,a,re.deepClone(l))}return i}getSizeOf(){return Object.keys(this._matrix).length}getLength(){return Kt(this._matrix)}getRange(){const r=this.getLength()-1;let s=0;const i=this.getLength();for(let o=0;o<i;o++){const a=this.getRow(o);if(a){const l=Kt(a)-1;s=l>s?l:s}}return{startRow:0,startColumn:0,endRow:r,endColumn:s}}toNativeArray(){const t=new Array;return this.forValue((n,r,s)=>{t.push(s)}),t}toArray(){const t=[];return this.forRow((n,r)=>{t[n]==null&&(t[n]=[]),r.forEach(s=>{t[n][s]=this.getValue(n,s)})}),t}toFullArray(){const t=this.getRange(),{endColumn:n,endRow:r}=t,s=[];for(let i=0;i<=r;i++){const o=new Array(n+1).fill(void 0);s.push(o)}return this.forValue((i,o,a)=>{s[i][o]=a}),s}toJSON(){return this._matrix}clone(){const t=JSON.stringify(this._matrix);return JSON.parse(t)}getData(){const t=JSON.stringify(this._matrix);return JSON.parse(t)}getArrayData(){let t=0,n=0,r=!1,s=!1;const i=new At;return this.forEach((o,a)=>{r||(r=!0,t=o),Object.keys(a).forEach(l=>{const u=Number(l);s?u<n&&(n=u):(s=!0,n=u);const c=this.getValue(o,u);i.setValue(o-t,u-n,c)})}),i.getData()}getStartEndScope(){let t=1/0,n=-1/0,r=1/0,s=-1/0;const i=Object.keys(this._matrix);i.length>0&&(t=+i[0],n=+i[i.length-1]);for(const o of i){const a=Object.keys(this._matrix[o]);a.length>0&&(r=Math.min(r,+a[0]),s=Math.max(s,+a[a.length-1]))}return{startRow:t,endRow:n,startColumn:r,endColumn:s}}getDataRange(){let t=0,n=0,r=0,s=-1,i=!1,o=!1;return this.forEach((a,l)=>{if(i||(i=!0,t=a),l==null)return;const u=Kt(l)-1;u>r&&(r=u),Object.keys(l).forEach(c=>{const h=Number(c);o?h<n&&(n=h):(o=!0,n=h)}),a>s&&(s=a)}),{startRow:t,startColumn:n,endRow:s,endColumn:r}}getDiscreteRanges(){const t=[];return this.forEach((n,r)=>{Object.keys(r).forEach(s=>{const i=Number(s);let o=!1;for(const a of t)if(n>=a.startRow&&n<=a.endRow+1&&i>=a.startColumn&&i<=a.endColumn+1){a.endRow=Math.max(n,a.endRow),a.endColumn=Math.max(i,a.endColumn),o=!0;break}o||t.push({startRow:n,endRow:n,startColumn:i,endColumn:i})})}),t}_setOriginValue(t={}){this._matrix=t}}const ir="__INTERNAL_EDITOR__",ei=`${ir}DOCS_NORMAL`,ti=`${ir}DOCS_FORMULA_BAR`,wa=`${ir}ZEN_EDITOR`,ba=`\r
2
- `,Aa="isRowStylePrecedeColumnStyle",Ta=Symbol("AUTO_HEIGHT_FOR_MERGED_CELLS");function pd(e){return`${ir}${e}`}function ya(e){return e.startsWith(ir)}var Na=(e=>(e[e.character=0]="character",e[e.paragraph=1]="paragraph",e[e.table=2]="table",e[e.numbering=3]="numbering",e))(Na||{}),Ma=(e=>(e[e.TAB=0]="TAB",e[e.SPACE=1]="SPACE",e[e.NOTHING=2]="NOTHING",e))(Ma||{}),Ne=(e=>(e[e.BULLET=0]="BULLET",e[e.NONE=1]="NONE",e[e.DECIMAL=2]="DECIMAL",e[e.DECIMAL_ZERO=3]="DECIMAL_ZERO",e[e.UPPER_LETTER=4]="UPPER_LETTER",e[e.LOWER_LETTER=5]="LOWER_LETTER",e[e.UPPER_ROMAN=6]="UPPER_ROMAN",e[e.LOWER_ROMAN=7]="LOWER_ROMAN",e[e.ORDINAL=8]="ORDINAL",e[e.CARDINAL_TEXT=9]="CARDINAL_TEXT",e[e.ORDINAL_TEXT=10]="ORDINAL_TEXT",e[e.HEX=11]="HEX",e[e.CHICAGO=12]="CHICAGO",e[e.IDEOGRAPH_DIGITAL=13]="IDEOGRAPH_DIGITAL",e[e.JAPANESE_COUNTING=14]="JAPANESE_COUNTING",e[e.AIUEO=15]="AIUEO",e[e.IROHA=16]="IROHA",e[e.DECIMAL_FULL_WIDTH=17]="DECIMAL_FULL_WIDTH",e[e.DECIMAL_HALF_WIDTH=18]="DECIMAL_HALF_WIDTH",e[e.JAPANESE_LEGAL=19]="JAPANESE_LEGAL",e[e.JAPANESE_DIGITAL_TEN_THOUSAND=20]="JAPANESE_DIGITAL_TEN_THOUSAND",e[e.DECIMAL_ENCLOSED_CIRCLE=21]="DECIMAL_ENCLOSED_CIRCLE",e[e.DECIMAL_FULL_WIDTH2=22]="DECIMAL_FULL_WIDTH2",e[e.AIUEO_FULL_WIDTH=23]="AIUEO_FULL_WIDTH",e[e.IROHA_FULL_WIDTH=24]="IROHA_FULL_WIDTH",e[e.GANADA=25]="GANADA",e[e.CHOSUNG=26]="CHOSUNG",e[e.DECIMAL_ENCLOSED_FULLSTOP=27]="DECIMAL_ENCLOSED_FULLSTOP",e[e.DECIMAL_ENCLOSED_PAREN=28]="DECIMAL_ENCLOSED_PAREN",e[e.DECIMAL_ENCLOSED_CIRCLE_CHINESE=29]="DECIMAL_ENCLOSED_CIRCLE_CHINESE",e[e.IDEOGRAPH_ENCLOSED_CIRCLE=30]="IDEOGRAPH_ENCLOSED_CIRCLE",e[e.IDEOGRAPH_TRADITIONAL=31]="IDEOGRAPH_TRADITIONAL",e[e.IDEOGRAPH_ZODIAC=32]="IDEOGRAPH_ZODIAC",e[e.IDEOGRAPH_ZODIAC_TRADITIONAL=33]="IDEOGRAPH_ZODIAC_TRADITIONAL",e[e.TAIWANESE_COUNTING=34]="TAIWANESE_COUNTING",e[e.IDEOGRAPH_LEGAL_TRADITIONAL=35]="IDEOGRAPH_LEGAL_TRADITIONAL",e[e.TAIWANESE_COUNTING_THOUSAND=36]="TAIWANESE_COUNTING_THOUSAND",e[e.TAIWANESE_DIGITAL=37]="TAIWANESE_DIGITAL",e[e.CHINESE_COUNTING=38]="CHINESE_COUNTING",e[e.CHINESE_LEGAL_SIMPLIFIED=39]="CHINESE_LEGAL_SIMPLIFIED",e[e.CHINESE_COUNTING_THOUSAND=40]="CHINESE_COUNTING_THOUSAND",e[e.KOREAN_DIGITAL=41]="KOREAN_DIGITAL",e[e.KOREAN_COUNTING=42]="KOREAN_COUNTING",e[e.KOREAN_LEGAL=43]="KOREAN_LEGAL",e[e.KOREAN_DIGITAL2=44]="KOREAN_DIGITAL2",e[e.VIETNAMESE_COUNTING=45]="VIETNAMESE_COUNTING",e[e.RUSSIAN_LOWER=46]="RUSSIAN_LOWER",e[e.RUSSIAN_UPPER=47]="RUSSIAN_UPPER",e[e.NUMBER_IN_DASH=48]="NUMBER_IN_DASH",e[e.HEBREW1=49]="HEBREW1",e[e.HEBREW2=50]="HEBREW2",e[e.ARABIC_ALPHA=51]="ARABIC_ALPHA",e[e.ARABIC_ABJAD=52]="ARABIC_ABJAD",e[e.HINDI_VOWELS=53]="HINDI_VOWELS",e[e.HINDI_CONSONANTS=54]="HINDI_CONSONANTS",e[e.HINDI_NUMBERS=55]="HINDI_NUMBERS",e[e.HINDI_COUNTING=56]="HINDI_COUNTING",e[e.THAI_LETTERS=57]="THAI_LETTERS",e[e.THAI_NUMBERS=58]="THAI_NUMBERS",e[e.THAI_COUNTING=59]="THAI_COUNTING",e[e.CUSTOM=60]="CUSTOM",e))(Ne||{}),or=(e=>(e[e.BULLET_ALIGNMENT_UNSPECIFIED=0]="BULLET_ALIGNMENT_UNSPECIFIED",e[e.START=1]="START",e[e.CENTER=2]="CENTER",e[e.END=3]="END",e[e.BOTH=4]="BOTH",e))(or||{}),qt=(e=>(e[e.HYPERLINK=0]="HYPERLINK",e[e.FIELD=1]="FIELD",e[e.SDT=2]="SDT",e[e.BOOKMARK=3]="BOOKMARK",e[e.COMMENT=4]="COMMENT",e[e.CUSTOM=5]="CUSTOM",e[e.MENTION=6]="MENTION",e[e.UNI_FORMULA=7]="UNI_FORMULA",e[e.DELTED=9999]="DELTED",e))(qt||{}),rn=(e=>(e[e.COMMENT=0]="COMMENT",e[e.DELETED=9999]="DELETED",e))(rn||{}),Da=(e=>(e[e.DRAWING=0]="DRAWING",e[e.CUSTOM=1]="CUSTOM",e))(Da||{}),ni=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TRADITIONAL=1]="TRADITIONAL",e[e.MODERN=2]="MODERN",e))(ni||{}),La=(e=>(e[e.DEFAULT=0]="DEFAULT",e[e.LINES=1]="LINES",e[e.LINES_AND_CHARS=2]="LINES_AND_CHARS",e[e.SNAP_TO_CHARS=3]="SNAP_TO_CHARS",e))(La||{}),xa=(e=>(e[e.SECTION_TYPE_UNSPECIFIED=0]="SECTION_TYPE_UNSPECIFIED",e[e.CONTINUOUS=1]="CONTINUOUS",e[e.NEXT_PAGE=2]="NEXT_PAGE",e[e.EVEN_PAGE=3]="EVEN_PAGE",e[e.ODD_PAGE=4]="ODD_PAGE",e))(xa||{}),Ua=(e=>(e[e.COLUMN_SEPARATOR_STYLE_UNSPECIFIED=0]="COLUMN_SEPARATOR_STYLE_UNSPECIFIED",e[e.NONE=1]="NONE",e[e.BETWEEN_EACH_COLUMN=2]="BETWEEN_EACH_COLUMN",e))(Ua||{}),Pa=(e=>(e[e.NORMAL=0]="NORMAL",e[e.TBRL=1]="TBRL",e[e.LRTBV=2]="LRTBV",e))(Pa||{}),ka=(e=>(e[e.TEXT_RUN=0]="TEXT_RUN",e[e.AUTO_TEXT=1]="AUTO_TEXT",e[e.PAGE_BREAK=2]="PAGE_BREAK",e[e.COLUMN_BREAK=3]="COLUMN_BREAK",e[e.FOOT_NOTE_REFERENCE=4]="FOOT_NOTE_REFERENCE",e[e.HORIZONTAL_RULE=5]="HORIZONTAL_RULE",e[e.EQUATION=6]="EQUATION",e[e.DRAWING=7]="DRAWING",e[e.PERSON=8]="PERSON",e[e.RICH_LINK=9]="RICH_LINK",e))(ka||{}),Fa=(e=>(e[e.BOTH_SIDES=0]="BOTH_SIDES",e[e.LEFT=1]="LEFT",e[e.RIGHT=2]="RIGHT",e[e.LARGEST=3]="LARGEST",e))(Fa||{}),$a=(e=>(e[e.INLINE=0]="INLINE",e[e.WRAP_NONE=1]="WRAP_NONE",e[e.WRAP_POLYGON=2]="WRAP_POLYGON",e[e.WRAP_SQUARE=3]="WRAP_SQUARE",e[e.WRAP_THROUGH=4]="WRAP_THROUGH",e[e.WRAP_TIGHT=5]="WRAP_TIGHT",e[e.WRAP_TOP_AND_BOTTOM=6]="WRAP_TOP_AND_BOTTOM",e))($a||{}),rt=(e=>(e[e.NAMED_STYLE_TYPE_UNSPECIFIED=0]="NAMED_STYLE_TYPE_UNSPECIFIED",e[e.NORMAL_TEXT=1]="NORMAL_TEXT",e[e.TITLE=2]="TITLE",e[e.SUBTITLE=3]="SUBTITLE",e[e.HEADING_1=4]="HEADING_1",e[e.HEADING_2=5]="HEADING_2",e[e.HEADING_3=6]="HEADING_3",e[e.HEADING_4=7]="HEADING_4",e[e.HEADING_5=8]="HEADING_5",e))(rt||{}),Ba=(e=>(e[e.AUTO=0]="AUTO",e[e.AT_LEAST=1]="AT_LEAST",e[e.EXACT=2]="EXACT",e))(Ba||{}),Ha=(e=>(e[e.DASH_STYLE_UNSPECIFIED=0]="DASH_STYLE_UNSPECIFIED",e[e.SOLID=1]="SOLID",e[e.DOT=2]="DOT",e[e.DASH=3]="DASH",e))(Ha||{}),ja=(e=>(e[e.TAB_STOP_ALIGNMENT_UNSPECIFIED=0]="TAB_STOP_ALIGNMENT_UNSPECIFIED",e[e.START=1]="START",e[e.CENTER=2]="CENTER",e[e.END=3]="END",e))(ja||{}),Wa=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SPECIFIED=1]="SPECIFIED",e))(Wa||{}),Ya=(e=>(e[e.START=0]="START",e[e.CENTER=1]="CENTER",e[e.END=2]="END",e))(Ya||{}),za=(e=>(e[e.AUTO_FIT=0]="AUTO_FIT",e[e.FIXED=1]="FIXED",e))(za||{}),Ga=(e=>(e[e.NONE=0]="NONE",e[e.WRAP=1]="WRAP",e))(Ga||{}),Va=(e=>(e[e.AUTO=0]="AUTO",e[e.AT_LEAST=1]="AT_LEAST",e[e.EXACT=2]="EXACT",e))(Va||{}),Ka=(e=>(e[e.CONTENT_ALIGNMENT_UNSPECIFIED=0]="CONTENT_ALIGNMENT_UNSPECIFIED",e[e.BOTH=1]="BOTH",e[e.TOP=2]="TOP",e[e.CENTER=3]="CENTER",e[e.BOTTOM=4]="BOTTOM",e))(Ka||{}),In=(e=>(e.NORMAL="normal",e.BOLD="bold",e.ITALIC="italic",e))(In||{}),Xa=(e=>(e[e.PAGE=0]="PAGE",e[e.COLUMN=1]="COLUMN",e[e.CHARACTER=2]="CHARACTER",e[e.MARGIN=3]="MARGIN",e[e.INSIDE_MARGIN=4]="INSIDE_MARGIN",e[e.OUTSIDE_MARGIN=5]="OUTSIDE_MARGIN",e[e.LEFT_MARGIN=6]="LEFT_MARGIN",e[e.RIGHT_MARGIN=7]="RIGHT_MARGIN",e))(Xa||{}),qa=(e=>(e[e.PAGE=0]="PAGE",e[e.PARAGRAPH=1]="PARAGRAPH",e[e.LINE=2]="LINE",e[e.MARGIN=3]="MARGIN",e[e.TOP_MARGIN=4]="TOP_MARGIN",e[e.BOTTOM_MARGIN=5]="BOTTOM_MARGIN",e[e.INSIDE_MARGIN=6]="INSIDE_MARGIN",e[e.OUTSIDE_MARGIN=7]="OUTSIDE_MARGIN",e))(qa||{}),Ja=(e=>(e[e.POINT=0]="POINT",e[e.LINE=1]="LINE",e[e.CHARACTER=2]="CHARACTER",e[e.PIXEL=3]="PIXEL",e[e.PERCENT=4]="PERCENT",e))(Ja||{}),Za=(e=>(e[e.CENTER=0]="CENTER",e[e.INSIDE=1]="INSIDE",e[e.LEFT=2]="LEFT",e[e.OUTSIDE=3]="OUTSIDE",e[e.RIGHT=4]="RIGHT",e[e.BOTH=5]="BOTH",e[e.DISTRIBUTE=6]="DISTRIBUTE",e))(Za||{}),Qa=(e=>(e[e.BOTTOM=0]="BOTTOM",e[e.CENTER=1]="CENTER",e[e.INSIDE=2]="INSIDE",e[e.OUTSIDE=3]="OUTSIDE",e[e.TOP=4]="TOP",e))(Qa||{}),el=(e=>(e[e.compressPunctuation=0]="compressPunctuation",e[e.compressPunctuationAndJapaneseKana=1]="compressPunctuationAndJapaneseKana",e[e.doNotCompress=2]="doNotCompress",e))(el||{}),tl=(e=>(e[e.PORTRAIT=0]="PORTRAIT",e[e.LANDSCAPE=1]="LANDSCAPE",e))(tl||{}),nl=(e=>(e[e.forward=0]="forward",e[e.backward=1]="backward",e[e.front=2]="front",e[e.back=3]="back",e))(nl||{}),rl=(e=>(e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e[e.DRAWING_IMAGE=0]="DRAWING_IMAGE",e[e.DRAWING_SHAPE=1]="DRAWING_SHAPE",e[e.DRAWING_CHART=2]="DRAWING_CHART",e[e.DRAWING_TABLE=3]="DRAWING_TABLE",e[e.DRAWING_SMART_ART=4]="DRAWING_SMART_ART",e[e.DRAWING_VIDEO=5]="DRAWING_VIDEO",e[e.DRAWING_GROUP=6]="DRAWING_GROUP",e[e.DRAWING_UNIT=7]="DRAWING_UNIT",e[e.DRAWING_DOM=8]="DRAWING_DOM",e))(rl||{}),ri=(e=>(e[e.SLIDE=0]="SLIDE",e[e.MASTER=1]="MASTER",e[e.LAYOUT=2]="LAYOUT",e[e.HANDOUT_MASTER=3]="HANDOUT_MASTER",e[e.NOTES_MASTER=4]="NOTES_MASTER",e))(ri||{}),sl=(e=>(e[e.SHAPE=0]="SHAPE",e[e.IMAGE=1]="IMAGE",e[e.TEXT=2]="TEXT",e[e.SPREADSHEET=3]="SPREADSHEET",e[e.DOCUMENT=4]="DOCUMENT",e[e.SLIDE=5]="SLIDE",e))(sl||{}),il=(e=>(e[e.RELATIVE_SLIDE_LINK_UNSPECIFIED=0]="RELATIVE_SLIDE_LINK_UNSPECIFIED",e[e.NEXT_SLIDE=1]="NEXT_SLIDE",e[e.PREVIOUS_SLIDE=2]="PREVIOUS_SLIDE",e[e.FIRST_SLIDE=3]="FIRST_SLIDE",e[e.LAST_SLIDE=4]="LAST_SLIDE",e))(il||{});const Ed={sheetId:"",range:{startRow:-1,endRow:-1,startColumn:-1,endColumn:-1}},Cd={startRow:-1,startColumn:-1,endRow:-1,endColumn:-1},Rd={startRow:0,startColumn:0,endRow:0,endColumn:0},Id={row:0,column:0},ut={ff:"Arial",fs:11,it:Ie.FALSE,bl:Ie.FALSE,ul:{s:Ie.FALSE},st:{s:Ie.FALSE},ol:{s:Ie.FALSE},tr:{a:0,v:Ie.FALSE},td:Xn.UNSPECIFIED,cl:{rgb:"#000"},bg:{rgb:"#fff"},ht:bt.UNSPECIFIED,vt:nn.UNSPECIFIED,tb:an.UNSPECIFIED,pd:{t:0,r:0,b:0,l:0},n:null,bd:{b:null,l:null,r:null,t:null}},ol={id:"default_slide",title:"defaultSlide",pageSize:{width:300,height:300}},Sd=[ei,wa,ti],vd={[rt.HEADING_1]:{fs:20,bl:1},[rt.HEADING_2]:{fs:18,bl:1},[rt.HEADING_3]:{fs:16,bl:1},[rt.HEADING_4]:{fs:14,bl:1},[rt.HEADING_5]:{fs:12,bl:1},[rt.NORMAL_TEXT]:null,[rt.TITLE]:{fs:26,bl:1},[rt.SUBTITLE]:{fs:15,cl:{rgb:"#999999"}},[rt.NAMED_STYLE_TYPE_UNSPECIFIED]:null},fn=4,Od={[rt.HEADING_1]:{spaceAbove:{v:20},spaceBelow:{v:6+fn}},[rt.HEADING_2]:{spaceAbove:{v:18},spaceBelow:{v:6+fn}},[rt.HEADING_3]:{spaceAbove:{v:16},spaceBelow:{v:6+fn}},[rt.HEADING_4]:{spaceAbove:{v:14},spaceBelow:{v:4+fn}},[rt.HEADING_5]:{spaceAbove:{v:12},spaceBelow:{v:4+fn}},[rt.NORMAL_TEXT]:{spaceAbove:{v:0},spaceBelow:{v:0}},[rt.TITLE]:{spaceAbove:{v:0},spaceBelow:{v:3+fn}},[rt.SUBTITLE]:{spaceAbove:{v:0},spaceBelow:{v:16}},[rt.NAMED_STYLE_TYPE_UNSPECIFIED]:null},wd="univer-sheets-chart-print-chart";var al=(e=>(e.ARRAY_CONVERTOR="ARRAY_CONVERTOR",e.MATRIX_CONVERTOR="MATRIX_CONVERTOR",e))(al||{});function pr(e,t){const{textRuns:n=[]}=t;let r=0;for(const i of n){const{ts:o={},st:a,ed:l}=i;if(o[e]==null)return Ie.FALSE;switch(e){case"bl":case"it":{if(o[e]===Ie.FALSE)return Ie.FALSE;break}case"ul":case"st":{if(o[e].s===Ie.FALSE)return Ie.FALSE;break}default:throw new Error(`unknown style key: ${e} in IStyleBase`)}r+=l-a}return t.dataStream.indexOf(`\r
3
- `)===r?Ie.TRUE:Ie.FALSE}const Kn=class Kn{constructor(t,n,r){C(this,"_range");C(this,"_worksheet");this._deps=r,this._range=n,this._worksheet=t}static foreach(t,n){const{startRow:r,startColumn:s,endRow:i,endColumn:o}=t;for(let a=r;a<=i;a++)for(let l=s;l<=o;l++)n(a,l)}getRangeData(){return this._range}getValue(){return this.getValues()[0][0]}getValues(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range,i=[];for(let o=t;o<=n;o++){const a=[];for(let l=r;l<=s;l++)a.push(this.getMatrix().getValue(o,l)||null);i.push(a)}return i}getMatrix(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range,i=this._worksheet.getCellMatrix(),o=new At;for(let a=t;a<=n;a++)for(let l=r;l<=s;l++)o.setValue(a,l,i.getValue(a,l)||null);return o}getMatrixObject(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range,i=this._worksheet.getCellMatrix(),o=new At;for(let a=t;a<=n;a++)for(let l=r;l<=s;l++)o.setValue(a-t,l-r,i.getValue(a,l)||{});return o}getA1Notation(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range;let i,o;return r<s?(i=re.numToWord(r+1)+(t+1),o=re.numToWord(s+1)+(n+1)):(i=re.numToWord(s+1)+(n+1),o=re.numToWord(r+1)+(t+1)),i===o?`${i}`:`${i}:${o}`}getBackground(){return this.getBackgrounds()[0][0]}getBackgrounds(){const t=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>{var i;const s=t.getStyleByCell(r);return((i=s==null?void 0:s.bg)==null?void 0:i.rgb)||ut.bg.rgb}))}getCell(t,n){const{startRow:r,startColumn:s}=this._range,i={startRow:r+t,endRow:r+t,startColumn:s+n,endColumn:s+n};return new Kn(this._worksheet,i,this._deps)}getColumn(){return this._range.startColumn}getObjectValue(t={}){return this.getObjectValues(t)[0][0]}getObjectValues(t={}){var a;const{startRow:n,endRow:r,startColumn:s,endColumn:i}=this._range,o=this._worksheet.getCellMatrix().getFragment(n,r,s,i).getData();if(t.isIncludeStyle){const l=this._deps.getStyles();for(let u=0;u<=r-n;u++)for(let c=0;c<=i-s;c++){if(o==null||((a=o==null?void 0:o[u])==null?void 0:a[c])==null)continue;const h=o[u][c].s;h&&(o[u][c].s=l.get(h))}}return o}getFontColor(){return this.getFontColors()[0][0]}getFontColors(){const t=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>{var i;const s=t.getStyleByCell(r);return((i=s==null?void 0:s.cl)==null?void 0:i.rgb)||ut.cl.rgb}))}getFontFamilies(){return this._getStyles("ff")}getFontFamily(){return this.getFontFamilies()[0][0]}getUnderlines(){return this._getStyles("ul")}getUnderline(){var n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?pr("ul",t.body)===Ie.TRUE?{s:Ie.TRUE}:{s:Ie.FALSE}:this.getUnderlines()[0][0]}getOverlines(){return this._getStyles("ol")}getOverline(){return this.getOverlines()[0][0]}getStrikeThrough(){var n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?pr("st",t.body)===Ie.TRUE?{s:Ie.TRUE}:{s:Ie.FALSE}:this.getStrikeThroughs()[0][0]}getStrikeThroughs(){return this._getStyles("st")}getFontSize(){var n,r;const t=((n=this.getValue())==null?void 0:n.p)||{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?t.body.textRuns.some(s=>{var i;return((i=s==null?void 0:s.ts)==null?void 0:i.fs)!=null})?Math.max(...t.body.textRuns.map(s=>{var i;return((i=s==null?void 0:s.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,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?pr("it",t.body)===Ie.TRUE?$r.ITALIC:$r.NORMAL:this._getFontStyles()[0][0]}_getFontStyles(){return this._getStyles("it")}getFontWeight(){var n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?pr("bl",t.body)===Ie.TRUE?Br.BOLD:Br.NORMAL:this._getFontWeights()[0][0]}_getFontWeights(){return this._getStyles("bl")}getGridId(){return this._worksheet.getSheetId()}getHeight(){const{_range:t,_worksheet:n}=this,{startRow:r,endRow:s}=t;let i=0;for(let o=0;o<=s-r;o++){const a=n.getRowHeight(o);i+=a}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:t,endColumn:n}=this._range;return n-t+1}getNumRows(){const{startRow:t,endRow:n}=this._range;return n-t+1}getRichTextValue(){return this.getRichTextValues()[0][0]}getRichTextValues(){return this.getValues().map(t=>t.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 t=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>t.getStyleByCell(r)))}getVerticalAlignment(){return this.getVerticalAlignments()[0][0]}getVerticalAlignments(){return this._getStyles("vt")}getWidth(){const{_range:t,_worksheet:n}=this,{startColumn:r,endColumn:s}=t;let i=0;for(let o=0;o<=s-r;o++)i+=n.getColumnWidth(o);return i}getWrap(){return this.getWrapStrategy()===an.WRAP?Ie.TRUE:Ie.FALSE}getWrapStrategies(){return this._getStyles("tb")}getWrapStrategy(){return this.getWrapStrategies()[0][0]}forEach(t){Kn.foreach(this._range,t)}_getStyles(t){const n=this._deps.getStyles();return this.getValues().map(r=>r.map(s=>{const i=n&&n.getStyleByCell(s);return i&&i[t]||ut[t]}))}};C(Kn,"transformRange",(t,n)=>{const r=n.getMaxColumns()-1,s=n.getMaxRows()-1;return t.rangeType===Le.ALL?{startColumn:0,startRow:0,endColumn:r,endRow:s}:t.rangeType===Le.COLUMN?{startRow:0,endRow:s,startColumn:t.startColumn,endColumn:t.endColumn}:t.rangeType===Le.ROW?{startColumn:0,endColumn:r,startRow:t.startRow,endRow:t.endRow}:{startColumn:t.startColumn,endColumn:Math.min(t.endColumn,r),startRow:t.startRow,endRow:Math.min(t.endRow,s)}});let bn=Kn;function ll(e,t,n=0,r=e.length-1,s=bd){for(;r>n;){if(r-n>600){const l=r-n+1,u=t-n+1,c=Math.log(l),h=.5*Math.exp(2*c/3),d=.5*Math.sqrt(c*h*(l-h)/l)*(u-l/2<0?-1:1),f=Math.max(n,Math.floor(t-u*h/l+d)),p=Math.min(r,Math.floor(t+(l-u)*h/l+d));ll(e,t,f,p,s)}const i=e[t];let o=n,a=r;for(Ln(e,n,t),s(e[r],i)>0&&Ln(e,n,r);o<a;){for(Ln(e,o,a),o++,a--;s(e[o],i)<0;)o++;for(;s(e[a],i)>0;)a--}s(e[n],i)===0?Ln(e,n,a):(a++,Ln(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}}function Ln(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function bd(e,t){return e<t?-1:e>t?1:0}class Wr{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let n=this.data;const r=[];if(!Cr(t,n))return r;const s=this.toBBox,i=[];for(;n;){for(let o=0;o<n.children.length;o++){const a=n.children[o],l=n.leaf?s(a):a;Cr(t,l)&&(n.leaf?r.push(a):hs(t,l)?this._all(a,r):i.push(a))}n=i.pop()}return r}collides(t){let n=this.data;if(!Cr(t,n))return!1;const r=[];for(;n;){for(let s=0;s<n.children.length;s++){const i=n.children[s],o=n.leaf?this.toBBox(i):i;if(Cr(t,o)){if(n.leaf||hs(t,o))return!0;r.push(i)}}n=r.pop()}return!1}load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(let r=0;r<t.length;r++)this.insert(t[r]);return this}let n=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length)this.data=n;else if(this.data.height===n.height)this._splitRoot(this.data,n);else{if(this.data.height<n.height){const r=this.data;this.data=n,n=r}this._insert(n,this.data.height-n.height-1,!0)}return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=pn([]),this}remove(t,n){if(!t)return this;let r=this.data;const s=this.toBBox(t),i=[],o=[];let a,l,u;for(;r||i.length;){if(r||(r=i.pop(),l=i[i.length-1],a=o.pop(),u=!0),r.leaf){const c=Ad(t,r.children,n);if(c!==-1)return r.children.splice(c,1),i.push(r),this._condense(i),this}!u&&!r.leaf&&hs(r,s)?(i.push(r),o.push(a),a=0,l=r,r=r.children[0]):l?(a++,r=l.children[a],u=!1):r=null}return this}toBBox(t){return t}compareMinX(t,n){return t.minX-n.minX}compareMinY(t,n){return t.minY-n.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,n){const r=[];for(;t;)t.leaf?n.push(...t.children):r.push(...t.children),t=r.pop();return n}_build(t,n,r,s){const i=r-n+1;let o=this._maxEntries,a;if(i<=o)return a=pn(t.slice(n,r+1)),gn(a,this.toBBox),a;s||(s=Math.ceil(Math.log(i)/Math.log(o)),o=Math.ceil(i/Math.pow(o,s-1))),a=pn([]),a.leaf=!1,a.height=s;const l=Math.ceil(i/o),u=l*Math.ceil(Math.sqrt(o));ji(t,n,r,u,this.compareMinX);for(let c=n;c<=r;c+=u){const h=Math.min(c+u-1,r);ji(t,c,h,l,this.compareMinY);for(let d=c;d<=h;d+=l){const f=Math.min(d+l-1,h);a.children.push(this._build(t,d,f,s-1))}}return gn(a,this.toBBox),a}_chooseSubtree(t,n,r,s){for(;s.push(n),!(n.leaf||s.length-1===r);){let i=1/0,o=1/0,a;for(let l=0;l<n.children.length;l++){const u=n.children[l],c=cs(u),h=Nd(t,u)-c;h<o?(o=h,i=c<i?c:i,a=u):h===o&&c<i&&(i=c,a=u)}n=a||n.children[0]}return n}_insert(t,n,r){const s=r?t:this.toBBox(t),i=[],o=this._chooseSubtree(s,this.data,n,i);for(o.children.push(t),jn(o,s);n>=0&&i[n].children.length>this._maxEntries;)this._split(i,n),n--;this._adjustParentBBoxes(s,i,n)}_split(t,n){const r=t[n],s=r.children.length,i=this._minEntries;this._chooseSplitAxis(r,i,s);const o=this._chooseSplitIndex(r,i,s),a=pn(r.children.splice(o,r.children.length-o));a.height=r.height,a.leaf=r.leaf,gn(r,this.toBBox),gn(a,this.toBBox),n?t[n-1].children.push(a):this._splitRoot(r,a)}_splitRoot(t,n){this.data=pn([t,n]),this.data.height=t.height+1,this.data.leaf=!1,gn(this.data,this.toBBox)}_chooseSplitIndex(t,n,r){let s,i=1/0,o=1/0;for(let a=n;a<=r-n;a++){const l=Hn(t,0,a,this.toBBox),u=Hn(t,a,r,this.toBBox),c=Md(l,u),h=cs(l)+cs(u);c<i?(i=c,s=a,o=h<o?h:o):c===i&&h<o&&(o=h,s=a)}return s||r-n}_chooseSplitAxis(t,n,r){const s=t.leaf?this.compareMinX:Td,i=t.leaf?this.compareMinY:yd,o=this._allDistMargin(t,n,r,s),a=this._allDistMargin(t,n,r,i);o<a&&t.children.sort(s)}_allDistMargin(t,n,r,s){t.children.sort(s);const i=this.toBBox,o=Hn(t,0,n,i),a=Hn(t,r-n,r,i);let l=Er(o)+Er(a);for(let u=n;u<r-n;u++){const c=t.children[u];jn(o,t.leaf?i(c):c),l+=Er(o)}for(let u=r-n-1;u>=n;u--){const c=t.children[u];jn(a,t.leaf?i(c):c),l+=Er(a)}return l}_adjustParentBBoxes(t,n,r){for(let s=r;s>=0;s--)jn(n[s],t)}_condense(t){for(let n=t.length-1,r;n>=0;n--)t[n].children.length===0?n>0?(r=t[n-1].children,r.splice(r.indexOf(t[n]),1)):this.clear():gn(t[n],this.toBBox)}}function Ad(e,t,n){if(!n)return t.indexOf(e);for(let r=0;r<t.length;r++)if(n(e,t[r]))return r;return-1}function gn(e,t){Hn(e,0,e.children.length,t,e)}function Hn(e,t,n,r,s){s||(s=pn(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(let i=t;i<n;i++){const o=e.children[i];jn(s,e.leaf?r(o):o)}return s}function jn(e,t){return e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),e}function Td(e,t){return e.minX-t.minX}function yd(e,t){return e.minY-t.minY}function cs(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function Er(e){return e.maxX-e.minX+(e.maxY-e.minY)}function Nd(e,t){return(Math.max(t.maxX,e.maxX)-Math.min(t.minX,e.minX))*(Math.max(t.maxY,e.maxY)-Math.min(t.minY,e.minY))}function Md(e,t){const n=Math.max(e.minX,t.minX),r=Math.max(e.minY,t.minY),s=Math.min(e.maxX,t.maxX),i=Math.min(e.maxY,t.maxY);return Math.max(0,s-n)*Math.max(0,i-r)}function hs(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function Cr(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function pn(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function ji(e,t,n,r,s){const i=[t,n];for(;i.length;){if(n=i.pop(),t=i.pop(),n-t<=r)continue;const o=t+Math.ceil((n-t)/r/2)*r;ll(e,o,t,n,s),i.push(t,o,o,n)}}function Dd(e,t,n,r=!1){if(t===0&&n===0)return e;let s={...e};const i=s.startAbsoluteRefType||tt.NONE,o=s.endAbsoluteRefType||tt.NONE,a=s.rangeType||Le.NORMAL;if(!r&&i===tt.ALL&&o===tt.ALL)return s;const l=Wi(s.startRow,n,s.startColumn,t,a),u=Wi(s.endRow,n,s.endColumn,t,a);return r||i===tt.NONE&&o===tt.NONE?s={...s,startRow:l.row,startColumn:l.column,endRow:u.row,endColumn:u.column}:(i===tt.NONE?s={...s,startRow:l.row,startColumn:l.column}:i===tt.COLUMN?s={...s,startRow:l.row}:i===tt.ROW&&(s={...s,startColumn:l.column}),o===tt.NONE?s={...s,endRow:u.row,endColumn:u.column}:o===tt.COLUMN?s={...s,endRow:u.row}:o===tt.ROW&&(s={...s,endColumn:u.column}),s)}function Wi(e,t,n,r,s){return s===Le.NORMAL?{row:e+t,column:n+r}:s===Le.ROW?{row:e+t,column:n}:s===Le.COLUMN?{row:e,column:n+r}:{row:e,column:n}}function si(e){const t=new Set,n=new Set;for(const o of e)t.add(o.startColumn),t.add(o.endColumn+1),n.add(o.startRow),n.add(o.endRow+1);const r=Array.from(t).sort((o,a)=>o-a),s=Array.from(n).sort((o,a)=>o-a);e.sort((o,a)=>o.startRow-a.startRow||o.startColumn-a.startColumn);const i=[];for(let o=0;o<s.length-1;o++)for(let a=0;a<r.length-1;a++){const l=r[a],u=r[a+1]-1,c=s[o],h=s[o+1]-1;for(const d of e){if(d.startRow>h)break;if(d.startRow<=c&&d.endRow>=h&&d.startColumn<=l&&d.endColumn>=u){i.push({startColumn:l,endColumn:u,startRow:c,endRow:h});break}}}return i}function Ld(e){e.sort((r,s)=>r.startRow-s.startRow||r.startColumn-s.startColumn);const t={};for(const r of e)t[r.startRow]||(t[r.startRow]=[]),t[r.startRow].push(r);const n=[];for(const r in t){const s=t[+r];s.sort((o,a)=>o.startColumn-a.startColumn);let i=s[0];for(let o=1;o<s.length;o++){const a=s[o];a.startColumn<=i.endColumn+1&&a.startRow===i.startRow&&a.endRow===i.endRow?i.endColumn=Math.max(i.endColumn,a.endColumn):(n.push(i),i=a)}n.push(i)}return n}function xd(e){e.sort((r,s)=>r.startColumn-s.startColumn||r.startRow-s.startRow);const t={};for(const r of e)t[r.startColumn]||(t[r.startColumn]=[]),t[r.startColumn].push(r);const n=[];for(const r in t){const s=t[+r];s.sort((o,a)=>o.startRow-a.startRow);let i=s[0];for(let o=1;o<s.length;o++){const a=s[o];a.startRow<=i.endRow+1&&a.startColumn===i.startColumn&&a.endColumn===i.endColumn?i.endRow=Math.max(i.endRow,a.endRow):(n.push(i),i=a)}n.push(i)}return n}function Ud(e){const t=si(e),n=Ld(t);return xd(n)}function Pd(e,t){const n=[];return e.forEach(r=>{n.push(...Jt.subtract(r,t))}),Jt.mergeRanges(n)}function ul(e,t){const n=Yi(e.startRow,e.endRow,t.startRow,t.endRow),r=Yi(e.startColumn,e.endColumn,t.startColumn,t.endColumn);if(!n||!r)return null;const[s,i]=n,[o,a]=r,l=kd(e.rangeType,t.rangeType,s,i,o,a);return{startRow:s,endRow:i,startColumn:o,endColumn:a,rangeType:l}}function Yi(e,t,n,r){const s=isNaN(e)?-1/0:e,i=isNaN(t)?1/0:t,o=isNaN(n)?-1/0:n,a=isNaN(r)?1/0:r,l=Math.max(s,o),u=Math.min(i,a);if(l<=u){const c=l===-1/0?Number.NaN:l,h=u===1/0?Number.NaN:u;return[c,h]}else return null}function kd(e,t,n,r,s,i){const o=e!==void 0?e:zi(n,r,s,i),a=t!==void 0?t:zi(n,r,s,i);return o===Le.ALL||a===Le.ALL?o===a?o:o===Le.ALL?a:o:o===a?o:(o===Le.NORMAL||a===Le.NORMAL,Le.NORMAL)}function zi(e,t,n,r){const s=!isNaN(e)&&!isNaN(t),i=!isNaN(n)&&!isNaN(r);return s&&i?Le.NORMAL:s?Le.ROW:i?Le.COLUMN:Le.ALL}const Ut=class Ut{static clone(t){return t.rangeType!==void 0?{startRow:t.startRow,startColumn:t.startColumn,endRow:t.endRow,endColumn:t.endColumn,rangeType:t.rangeType}:{startRow:t.startRow,startColumn:t.startColumn,endRow:t.endRow,endColumn:t.endColumn}}static equals(t,n){return t==null||n==null?!1:t.endRow===n.endRow&&t.endColumn===n.endColumn&&t.startRow===n.startRow&&t.startColumn===n.startColumn&&(t.rangeType===n.rangeType||t.rangeType===void 0&&n.rangeType===Le.NORMAL||n.rangeType===void 0&&t.rangeType===Le.NORMAL)}static simpleRangesIntersect(t,n){const{startRow:r,endRow:s,startColumn:i,endColumn:o}=t,{startRow:a,endRow:l,startColumn:u,endColumn:c}=n,h=r<=l&&s>=a,d=i<=c&&o>=u;return h&&d}static intersects(t,n){if(t.rangeType===Le.ROW&&n.rangeType===Le.COLUMN||t.rangeType===Le.COLUMN&&n.rangeType===Le.ROW)return!0;if(t.rangeType===Le.ROW&&n.rangeType===Le.ROW)return t.startRow<=n.endRow&&t.endRow>=n.startRow;if(t.rangeType===Le.COLUMN&&n.rangeType===Le.COLUMN)return t.startColumn<=n.endColumn&&t.endColumn>=n.startColumn;const r=Math.floor(Number.MAX_SAFE_INTEGER/10),s=Number.isNaN(t.startRow)?0:t.startRow,i=Number.isNaN(t.endRow)?r:t.endRow,o=Number.isNaN(t.startColumn)?0:t.startColumn,a=Number.isNaN(t.endColumn)?r:t.endColumn,l=Number.isNaN(n.startRow)?0:n.startRow,u=Number.isNaN(n.endRow)?r:n.endRow,c=Number.isNaN(n.startColumn)?0:n.startColumn,h=Number.isNaN(n.endColumn)?r:n.endColumn,d=Math.abs(o+a-c-h),f=Math.abs(o-a)+Math.abs(c-h),p=Math.abs(s+i-l-u),R=Math.abs(s-i)+Math.abs(l-u);return d<=f&&p<=R}static doAnyRangesIntersect(t,n){const r=new Wr;return r.load(t.map(s=>({minX:s.startColumn,minY:s.startRow,maxX:s.endColumn,maxY:s.endRow}))),n.some(s=>r.search({minX:s.startColumn,minY:s.startRow,maxX:s.endColumn,maxY:s.endRow}).length>0)}static getIntersects(t,n){const r=t.startRow,s=t.endRow,i=t.startColumn,o=t.endColumn,a=n.startRow,l=n.endRow,u=n.startColumn,c=n.endColumn;let h,d,f,p;if(a<=s)a>=r?d=a:d=r;else return null;if(l>=r)l>=s?p=s:p=l;else return null;if(u<=o)u>i?h=u:h=i;else return null;if(c>=i)c>=o?f=o:f=c;else return null;return{startRow:d,endRow:p,startColumn:h,endColumn:f,rangeType:Le.NORMAL}}static contains(t,n){return t.startRow<=n.startRow&&t.endRow>=n.endRow&&t.startColumn<=n.startColumn&&t.endColumn>=n.endColumn}static realContain(t,n){return Ut.contains(t,n)&&(t.startRow<n.startRow||t.endRow>n.endRow||t.startColumn<n.startColumn||t.endColumn>n.endColumn)}static union(...t){return t.reduce((n,r)=>({startRow:Math.min(n.startRow,r.startRow),startColumn:Math.min(n.startColumn,r.startColumn),endRow:Math.max(n.endRow,r.endRow),endColumn:Math.max(n.endColumn,r.endColumn),rangeType:Le.NORMAL}),t[0])}static realUnion(...t){const n=t.some(i=>i.rangeType===Le.COLUMN),r=t.some(i=>i.rangeType===Le.ROW),s=Ut.union(...t);return{startColumn:r?Number.NaN:s.startColumn,endColumn:r?Number.NaN:s.endColumn,startRow:n?Number.NaN:s.startRow,endRow:n?Number.NaN:s.endRow,rangeType:r?Le.ROW:n?Le.COLUMN:Le.NORMAL}}static subtract(t,n){if(n.startRow>t.endRow||n.endRow<t.startRow||n.startColumn>t.endColumn||n.endColumn<t.startColumn)return[t];const r=[];n.startRow>=t.startRow&&r.push({startRow:t.startRow,startColumn:t.startColumn,endRow:n.startRow-1,endColumn:t.endColumn}),n.endRow<=t.endRow&&r.push({startRow:n.endRow+1,startColumn:t.startColumn,endRow:t.endRow,endColumn:t.endColumn});const s=Math.max(t.startRow,n.startRow),i=Math.min(t.endRow,n.endRow);return n.startColumn>=t.startColumn&&r.push({startRow:s,startColumn:t.startColumn,endRow:i,endColumn:n.startColumn-1}),n.endColumn<=t.endColumn&&r.push({startRow:s,startColumn:n.endColumn+1,endRow:i,endColumn:t.endColumn}),r.filter(a=>a.startRow<=a.endRow&&a.startColumn<=a.endColumn)}static mergeRanges(t){return Ud(t)}static splitIntoGrid(t){return si(t)}static subtractMulti(t,n){if(!n.length)return t;let r=t;return n.forEach(s=>{r=Pd(r,s)}),r}static hasIntersectionBetweenTwoRect(t,n){return!(t.left>n.right||t.right<n.left||t.top>n.bottom||t.bottom<n.top)}static getIntersectionBetweenTwoRect(t,n){const r=Math.max(t.left,n.left),s=Math.min(t.right,n.right),i=Math.max(t.top,n.top),o=Math.min(t.bottom,n.bottom);return s<=r||o<=i?null:{left:r,right:s,top:i,bottom:o,width:s-r,height:o-i}}static sort(t){return t.sort((n,r)=>n.startRow-r.startRow||n.startColumn-r.startColumn)}};C(Ut,"getRelativeRange",(t,n)=>({startRow:t.startRow-n.startRow,endRow:t.endRow-t.startRow,startColumn:t.startColumn-n.startColumn,endColumn:t.endColumn-t.startColumn})),C(Ut,"getPositionRange",(t,n,r)=>({...r||{},startRow:r&&[tt.ROW,tt.ALL].includes(r.startAbsoluteRefType||0)?r.startRow:t.startRow+n.startRow,endRow:r&&[tt.ROW,tt.ALL].includes(r.endAbsoluteRefType||0)?r.endRow:t.endRow+t.startRow+n.startRow,startColumn:r&&[tt.COLUMN,tt.ALL].includes(r.startAbsoluteRefType||0)?r.startColumn:t.startColumn+n.startColumn,endColumn:r&&[tt.COLUMN,tt.ALL].includes(r.endAbsoluteRefType||0)?r.endColumn:t.endColumn+t.startColumn+n.startColumn})),C(Ut,"moveHorizontal",(t,n=0,r=0)=>({...t,startColumn:t.startColumn+n,endColumn:t.endColumn+n+r})),C(Ut,"moveVertical",(t,n=0,r=0)=>({...t,startRow:t.startRow+n,endRow:t.endRow+n+r})),C(Ut,"moveOffset",(t,n,r)=>({...t,startRow:t.startRow+r,endRow:t.endRow+r,startColumn:t.startColumn+n,endColumn:t.endColumn+n}));let Jt=Ut;function Fd(e,t){if(e.length===0||e[0].length===0)return null;const n=new Array(e[0].length).fill(0);let r=0,s=null;for(let i=0;i<e.length;i++){for(let a=0;a<e[0].length;a++)n[a]=t(e[i][a])?n[a]+1:0;const o=$d(n);o.area>r&&(r=o.area,s={startColumn:o.start,startRow:i-o.height+1,endColumn:o.end,endRow:i})}return s}function $d(e){const t=[];let n=0,r={area:0,height:0,start:0,end:0},s=0;for(;s<e.length;)if(t.length===0||e[s]>=e[t[t.length-1]])t.push(s++);else{const i=e[t.pop()],o=t.length===0?s:s-t[t.length-1]-1;i*o>n&&(n=i*o,r={area:n,height:i,start:t.length===0?0:t[t.length-1]+1,end:s-1})}for(;t.length>0;){const i=e[t.pop()],o=t.length===0?s:s-t[t.length-1]-1;i*o>n&&(n=i*o,r={area:n,height:i,start:t.length===0?0:t[t.length-1]+1,end:s-1})}return r}function Bd(e,t){bn.foreach(t,(n,r)=>{e[n][r]=void 0})}function Hd(e,t){const n=e.toFullArray(),r=[];for(;;){const s=Fd(n,t);if(!s)break;r.push(s),Bd(n,s)}return r}class jd{constructor(t,n){C(this,"_values",[]);C(this,"_keys",[]);C(this,"_keyMaps",new Map);this._values=t,this._keys=n,t.forEach(r=>{this._initKeyMap(r)})}_initKeyMap(t){this._keys.forEach(n=>{const r=t[n],s=this._keyMaps.get(n)||new Map;s.set(r,t),this._keyMaps.set(n,s)})}getValue(t,n){const r=n||this._keys;for(let s=0;s<r.length;s++){const i=this._keyMaps.get(r[s]);if(i!=null&&i.has(t))return i.get(t)}return null}hasValue(t){for(let n=0;n<this._keys.length;n++){const r=this._keyMaps.get(this._keys[n]);if(r!=null&&r.has(t))return!0}return!1}addValue(t){this._values.push(t),this._initKeyMap(t)}setValue(t,n,r){const s=this.getValue(t);s&&Object.keys(s).includes(n)&&(s[n]=r)}deleteValue(t,n){const r=this.getValue(t,n);if(r){this._keys.forEach(i=>{const o=this._keyMaps.get(i),a=r[i];o==null||o.delete(a)});const s=this._values.findIndex(i=>i===r);this._values.splice(s,1)}}getValues(){return this._values}getKeyMap(t){var n;return[...((n=this._keyMaps.get(t))==null?void 0:n.keys())||[]]}clear(){this._values=[],this._keys=[],this._keyMaps.clear()}}function xs(e,t,n,r){return{forEach(s){for(let i=e;i<=t;i++)for(let o=n;o<=r;o++)s(i,o)}}}function Wd(e){if(e==null||e.length===0)return Number.NaN;const t=e.toLowerCase().split(""),n=t.length,r=o=>o.charCodeAt(0)-96;let s=0,i=0;for(let o=0;o<n;o++)i=r(t[o]),s+=i*26**(n-o-1);return s===0?Number.NaN:s-1}const Yr=65,cl=90,Yd=97;function zd(e){const t=cl-Yr+1;let n="";for(;e>=0;)n=String.fromCharCode(e%t+Yr)+n,e=Math.floor(e/t)-1;return n}function hl(e,t){let n="";for(;t>0;)n+=e,t--;return n}function Gd(e,t=!1){const n=cl-Yr+1;let r=Yd;t&&(r=Yr);const s=String.fromCharCode(e%n+r),i=Math.floor(e/n)+1;return hl(s,i)}function Vd(e,t){return e.zIndex>t.zIndex?1:e.zIndex===t.zIndex?0:-1}function Kd(e,t){return e.zIndex>t.zIndex?-1:e.zIndex===t.zIndex?0:1}function ar(e="index",t=1){return(n,r)=>n[e]>r[e]?t:n[e]===r[e]?0:-t}var dl=(e=>(e.PARAGRAPH="PARAGRAPH",e.SECTION_BREAK="SECTION_BREAK",e.TABLE="TABLE",e.TABLE_ROW="TABLE_ROW",e.TABLE_CELL="TABLE_CELL",e.CUSTOM_BLOCK="CUSTOM_BLOCK",e))(dl||{}),_t=(e=>(e.PARAGRAPH="\r",e.SECTION_BREAK=`
4
- `,e.TABLE_START="",e.TABLE_ROW_START="\x1B",e.TABLE_CELL_START="",e.TABLE_CELL_END="",e.TABLE_ROW_END="",e.TABLE_END="",e.CUSTOM_RANGE_START="",e.CUSTOM_RANGE_END="",e.COLUMN_BREAK="\v",e.PAGE_BREAK="\f",e.DOCS_END="\0",e.TAB=" ",e.CUSTOM_BLOCK="\b",e.LETTER="",e.SPACE=" ",e))(_t||{});function Xd(e){return`${e}`}const qd=[_t.TABLE_START,_t.TABLE_ROW_START,_t.TABLE_CELL_START,_t.TABLE_CELL_END,_t.TABLE_ROW_END,_t.TABLE_END],Qr=e=>{const t=e.endsWith(`\r
5
- `)?e.slice(0,-2):e;return qd.reduce((n,r)=>n.replaceAll(r,""),t)},Jd=e=>e?Qr(e).replaceAll("\r","")==="":!0,Zd=e=>{const t=e.replace(/\n/g,"\r"),n=[],r=[];let s=0,i="";const o=(l,u=!0)=>{const c=t.slice(s,l);if(re.isLegalUrl(c)){const h=kt(),d=`${c}`,f={startIndex:s,endIndex:s+d.length-1,rangeId:h,rangeType:qt.HYPERLINK,properties:{url:e}};r.push(f),i+=d,s=l+1,u&&(i+="\r",n.push({startIndex:l}))}else i+=t.slice(s,l+1),s=l+1,u&&n.push({startIndex:l})};let a=0;for(let l=0;l<t.length;l++)t[l]==="\r"&&(o(l),a=l);return(a!==t.length-1||t.length===1)&&o(t.length,!1),{dataStream:i,paragraphs:n,customRanges:r}};var fl=typeof global=="object"&&global&&global.Object===Object&&global,Qd=typeof self=="object"&&self&&self.Object===Object&&self,cn=fl||Qd||Function("return this")(),An=cn.Symbol,gl=Object.prototype,ef=gl.hasOwnProperty,tf=gl.toString,xn=An?An.toStringTag:void 0;function nf(e){var t=ef.call(e,xn),n=e[xn];try{e[xn]=void 0;var r=!0}catch{}var s=tf.call(e);return r&&(t?e[xn]=n:delete e[xn]),s}var rf=Object.prototype,sf=rf.toString;function of(e){return sf.call(e)}var af="[object Null]",lf="[object Undefined]",Gi=An?An.toStringTag:void 0;function lr(e){return e==null?e===void 0?lf:af:Gi&&Gi in Object(e)?nf(e):of(e)}function Mn(e){return e!=null&&typeof e=="object"}var uf="[object Symbol]";function es(e){return typeof e=="symbol"||Mn(e)&&lr(e)==uf}function cf(e,t){for(var n=-1,r=e==null?0:e.length,s=Array(r);++n<r;)s[n]=t(e[n],n,e);return s}var Tn=Array.isArray,Vi=An?An.prototype:void 0,Ki=Vi?Vi.toString:void 0;function ml(e){if(typeof e=="string")return e;if(Tn(e))return cf(e,ml)+"";if(es(e))return Ki?Ki.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var hf=/\s/;function df(e){for(var t=e.length;t--&&hf.test(e.charAt(t)););return t}var ff=/^\s+/;function gf(e){return e&&e.slice(0,df(e)+1).replace(ff,"")}function It(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Xi=NaN,mf=/^[-+]0x[0-9a-f]+$/i,_f=/^0b[01]+$/i,pf=/^0o[0-7]+$/i,Ef=parseInt;function qi(e){if(typeof e=="number")return e;if(es(e))return Xi;if(It(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=It(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=gf(e);var n=_f.test(e);return n||pf.test(e)?Ef(e.slice(2),n?2:8):mf.test(e)?Xi:+e}function _l(e){return e}var Cf="[object AsyncFunction]",Rf="[object Function]",If="[object GeneratorFunction]",Sf="[object Proxy]";function ii(e){if(!It(e))return!1;var t=lr(e);return t==Rf||t==If||t==Cf||t==Sf}var ds=cn["__core-js_shared__"],Ji=function(){var e=/[^.]+$/.exec(ds&&ds.keys&&ds.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function vf(e){return!!Ji&&Ji in e}var Of=Function.prototype,wf=Of.toString;function bf(e){if(e!=null){try{return wf.call(e)}catch{}try{return e+""}catch{}}return""}var Af=/[\\^$.*+?()[\]{}|]/g,Tf=/^\[object .+?Constructor\]$/,yf=Function.prototype,Nf=Object.prototype,Mf=yf.toString,Df=Nf.hasOwnProperty,Lf=RegExp("^"+Mf.call(Df).replace(Af,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function xf(e){if(!It(e)||vf(e))return!1;var t=ii(e)?Lf:Tf;return t.test(bf(e))}function Uf(e,t){return e==null?void 0:e[t]}function oi(e,t){var n=Uf(e,t);return xf(n)?n:void 0}var Zi=Object.create,Pf=function(){function e(){}return function(t){if(!It(t))return{};if(Zi)return Zi(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function kf(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Ff(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}var $f=800,Bf=16,Hf=Date.now;function jf(e){var t=0,n=0;return function(){var r=Hf(),s=Bf-(r-n);if(n=r,s>0){if(++t>=$f)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Wf(e){return function(){return e}}var zr=function(){try{var e=oi(Object,"defineProperty");return e({},"",{}),e}catch{}}(),Yf=zr?function(e,t){return zr(e,"toString",{configurable:!0,enumerable:!1,value:Wf(t),writable:!0})}:_l,zf=jf(Yf),Gf=9007199254740991,Vf=/^(?:0|[1-9]\d*)$/;function ai(e,t){var n=typeof e;return t=t==null?Gf:t,!!t&&(n=="number"||n!="symbol"&&Vf.test(e))&&e>-1&&e%1==0&&e<t}function li(e,t,n){t=="__proto__"&&zr?zr(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function ts(e,t){return e===t||e!==e&&t!==t}var Kf=Object.prototype,Xf=Kf.hasOwnProperty;function pl(e,t,n){var r=e[t];(!(Xf.call(e,t)&&ts(r,n))||n===void 0&&!(t in e))&&li(e,t,n)}function qf(e,t,n,r){var s=!n;n||(n={});for(var i=-1,o=t.length;++i<o;){var a=t[i],l=void 0;l===void 0&&(l=e[a]),s?li(n,a,l):pl(n,a,l)}return n}var Qi=Math.max;function Jf(e,t,n){return t=Qi(t===void 0?e.length-1:t,0),function(){for(var r=arguments,s=-1,i=Qi(r.length-t,0),o=Array(i);++s<i;)o[s]=r[t+s];s=-1;for(var a=Array(t+1);++s<t;)a[s]=r[s];return a[t]=n(o),kf(e,this,a)}}function Zf(e,t){return zf(Jf(e,t,_l),e+"")}var Qf=9007199254740991;function El(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Qf}function ui(e){return e!=null&&El(e.length)&&!ii(e)}function eg(e,t,n){if(!It(n))return!1;var r=typeof t;return(r=="number"?ui(n)&&ai(t,n.length):r=="string"&&t in n)?ts(n[t],e):!1}function Cl(e){return Zf(function(t,n){var r=-1,s=n.length,i=s>1?n[s-1]:void 0,o=s>2?n[2]:void 0;for(i=e.length>3&&typeof i=="function"?(s--,i):void 0,o&&eg(n[0],n[1],o)&&(i=s<3?void 0:i,s=1),t=Object(t);++r<s;){var a=n[r];a&&e(t,a,r,i)}return t})}var tg=Object.prototype;function Rl(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||tg;return e===n}function ng(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var rg="[object Arguments]";function eo(e){return Mn(e)&&lr(e)==rg}var Il=Object.prototype,sg=Il.hasOwnProperty,ig=Il.propertyIsEnumerable,Us=eo(function(){return arguments}())?eo:function(e){return Mn(e)&&sg.call(e,"callee")&&!ig.call(e,"callee")};function og(){return!1}var Sl=typeof exports=="object"&&exports&&!exports.nodeType&&exports,to=Sl&&typeof module=="object"&&module&&!module.nodeType&&module,ag=to&&to.exports===Sl,no=ag?cn.Buffer:void 0,lg=no?no.isBuffer:void 0,vl=lg||og,ug="[object Arguments]",cg="[object Array]",hg="[object Boolean]",dg="[object Date]",fg="[object Error]",gg="[object Function]",mg="[object Map]",_g="[object Number]",pg="[object Object]",Eg="[object RegExp]",Cg="[object Set]",Rg="[object String]",Ig="[object WeakMap]",Sg="[object ArrayBuffer]",vg="[object DataView]",Og="[object Float32Array]",wg="[object Float64Array]",bg="[object Int8Array]",Ag="[object Int16Array]",Tg="[object Int32Array]",yg="[object Uint8Array]",Ng="[object Uint8ClampedArray]",Mg="[object Uint16Array]",Dg="[object Uint32Array]",Ze={};Ze[Og]=Ze[wg]=Ze[bg]=Ze[Ag]=Ze[Tg]=Ze[yg]=Ze[Ng]=Ze[Mg]=Ze[Dg]=!0;Ze[ug]=Ze[cg]=Ze[Sg]=Ze[hg]=Ze[vg]=Ze[dg]=Ze[fg]=Ze[gg]=Ze[mg]=Ze[_g]=Ze[pg]=Ze[Eg]=Ze[Cg]=Ze[Rg]=Ze[Ig]=!1;function Lg(e){return Mn(e)&&El(e.length)&&!!Ze[lr(e)]}function xg(e){return function(t){return e(t)}}var Ol=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Vn=Ol&&typeof module=="object"&&module&&!module.nodeType&&module,Ug=Vn&&Vn.exports===Ol,fs=Ug&&fl.process,ro=function(){try{var e=Vn&&Vn.require&&Vn.require("util").types;return e||fs&&fs.binding&&fs.binding("util")}catch{}}(),so=ro&&ro.isTypedArray,wl=so?xg(so):Lg;function Pg(e,t){var n=Tn(e),r=!n&&Us(e),s=!n&&!r&&vl(e),i=!n&&!r&&!s&&wl(e),o=n||r||s||i,a=o?ng(e.length,String):[],l=a.length;for(var u in e)o&&(u=="length"||s&&(u=="offset"||u=="parent")||i&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||ai(u,l))||a.push(u);return a}function kg(e,t){return function(n){return e(t(n))}}function Fg(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var $g=Object.prototype,Bg=$g.hasOwnProperty;function Hg(e){if(!It(e))return Fg(e);var t=Rl(e),n=[];for(var r in e)r=="constructor"&&(t||!Bg.call(e,r))||n.push(r);return n}function bl(e){return ui(e)?Pg(e):Hg(e)}var jg=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Wg=/^\w*$/;function Yg(e,t){if(Tn(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||es(e)?!0:Wg.test(e)||!jg.test(e)||t!=null&&e in Object(t)}var Jn=oi(Object,"create");function zg(){this.__data__=Jn?Jn(null):{},this.size=0}function Gg(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Vg="__lodash_hash_undefined__",Kg=Object.prototype,Xg=Kg.hasOwnProperty;function qg(e){var t=this.__data__;if(Jn){var n=t[e];return n===Vg?void 0:n}return Xg.call(t,e)?t[e]:void 0}var Jg=Object.prototype,Zg=Jg.hasOwnProperty;function Qg(e){var t=this.__data__;return Jn?t[e]!==void 0:Zg.call(t,e)}var em="__lodash_hash_undefined__";function tm(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Jn&&t===void 0?em:t,this}function un(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}un.prototype.clear=zg;un.prototype.delete=Gg;un.prototype.get=qg;un.prototype.has=Qg;un.prototype.set=tm;function nm(){this.__data__=[],this.size=0}function ns(e,t){for(var n=e.length;n--;)if(ts(e[n][0],t))return n;return-1}var rm=Array.prototype,sm=rm.splice;function im(e){var t=this.__data__,n=ns(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():sm.call(t,n,1),--this.size,!0}function om(e){var t=this.__data__,n=ns(t,e);return n<0?void 0:t[n][1]}function am(e){return ns(this.__data__,e)>-1}function lm(e,t){var n=this.__data__,r=ns(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function Bt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Bt.prototype.clear=nm;Bt.prototype.delete=im;Bt.prototype.get=om;Bt.prototype.has=am;Bt.prototype.set=lm;var Al=oi(cn,"Map");function um(){this.size=0,this.__data__={hash:new un,map:new(Al||Bt),string:new un}}function cm(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function rs(e,t){var n=e.__data__;return cm(t)?n[typeof t=="string"?"string":"hash"]:n.map}function hm(e){var t=rs(this,e).delete(e);return this.size-=t?1:0,t}function dm(e){return rs(this,e).get(e)}function fm(e){return rs(this,e).has(e)}function gm(e,t){var n=rs(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function Zt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Zt.prototype.clear=um;Zt.prototype.delete=hm;Zt.prototype.get=dm;Zt.prototype.has=fm;Zt.prototype.set=gm;var mm="Expected a function";function ci(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(mm);var n=function(){var r=arguments,s=t?t.apply(this,r):r[0],i=n.cache;if(i.has(s))return i.get(s);var o=e.apply(this,r);return n.cache=i.set(s,o)||i,o};return n.cache=new(ci.Cache||Zt),n}ci.Cache=Zt;var _m=500;function pm(e){var t=ci(e,function(r){return n.size===_m&&n.clear(),r}),n=t.cache;return t}var Em=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Cm=/\\(\\)?/g,Rm=pm(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(Em,function(n,r,s,i){t.push(s?i.replace(Cm,"$1"):r||n)}),t});function Im(e){return e==null?"":ml(e)}function Tl(e,t){return Tn(e)?e:Yg(e,t)?[e]:Rm(Im(e))}function yl(e){if(typeof e=="string"||es(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function Sm(e,t){t=Tl(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[yl(t[n++])];return n&&n==r?e:void 0}function vm(e,t,n){var r=e==null?void 0:Sm(e,t);return r===void 0?n:r}var Nl=kg(Object.getPrototypeOf,Object),Om="[object Object]",wm=Function.prototype,bm=Object.prototype,Ml=wm.toString,Am=bm.hasOwnProperty,Tm=Ml.call(Object);function ym(e){if(!Mn(e)||lr(e)!=Om)return!1;var t=Nl(e);if(t===null)return!0;var n=Am.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&Ml.call(n)==Tm}function Nm(){this.__data__=new Bt,this.size=0}function Mm(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function Dm(e){return this.__data__.get(e)}function Lm(e){return this.__data__.has(e)}var xm=200;function Um(e,t){var n=this.__data__;if(n instanceof Bt){var r=n.__data__;if(!Al||r.length<xm-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Zt(r)}return n.set(e,t),this.size=n.size,this}function Dn(e){var t=this.__data__=new Bt(e);this.size=t.size}Dn.prototype.clear=Nm;Dn.prototype.delete=Mm;Dn.prototype.get=Dm;Dn.prototype.has=Lm;Dn.prototype.set=Um;var Dl=typeof exports=="object"&&exports&&!exports.nodeType&&exports,io=Dl&&typeof module=="object"&&module&&!module.nodeType&&module,Pm=io&&io.exports===Dl,oo=Pm?cn.Buffer:void 0;oo&&oo.allocUnsafe;function km(e,t){return e.slice()}var ao=cn.Uint8Array;function Fm(e){var t=new e.constructor(e.byteLength);return new ao(t).set(new ao(e)),t}function $m(e,t){var n=Fm(e.buffer);return new e.constructor(n,e.byteOffset,e.length)}function Bm(e){return typeof e.constructor=="function"&&!Rl(e)?Pf(Nl(e)):{}}function Hm(e){return function(t,n,r){for(var s=-1,i=Object(t),o=r(t),a=o.length;a--;){var l=o[++s];if(n(i[l],l,i)===!1)break}return t}}var jm=Hm(),gs=function(){return cn.Date.now()},Wm="Expected a function",Ym=Math.max,zm=Math.min;function Gm(e,t,n){var r,s,i,o,a,l,u=0,c=!1,h=!1,d=!0;if(typeof e!="function")throw new TypeError(Wm);t=qi(t)||0,It(n)&&(c=!!n.leading,h="maxWait"in n,i=h?Ym(qi(n.maxWait)||0,t):i,d="trailing"in n?!!n.trailing:d);function f(A){var j=r,Z=s;return r=s=void 0,u=A,o=e.apply(Z,j),o}function p(A){return u=A,a=setTimeout(N,t),c?f(A):o}function R(A){var j=A-l,Z=A-u,fe=t-j;return h?zm(fe,i-Z):fe}function w(A){var j=A-l,Z=A-u;return l===void 0||j>=t||j<0||h&&Z>=i}function N(){var A=gs();if(w(A))return G(A);a=setTimeout(N,R(A))}function G(A){return a=void 0,d&&r?f(A):(r=s=void 0,o)}function W(){a!==void 0&&clearTimeout(a),u=0,r=l=s=a=void 0}function se(){return a===void 0?o:G(gs())}function y(){var A=gs(),j=w(A);if(r=arguments,s=this,l=A,j){if(a===void 0)return p(l);if(h)return clearTimeout(a),a=setTimeout(N,t),f(l)}return a===void 0&&(a=setTimeout(N,t)),o}return y.cancel=W,y.flush=se,y}function Ps(e,t,n){(n!==void 0&&!ts(e[t],n)||n===void 0&&!(t in e))&&li(e,t,n)}function Vm(e){return Mn(e)&&ui(e)}function ks(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}function Km(e){return qf(e,bl(e))}function Xm(e,t,n,r,s,i,o){var a=ks(e,n),l=ks(t,n),u=o.get(l);if(u){Ps(e,n,u);return}var c=i?i(a,l,n+"",e,t,o):void 0,h=c===void 0;if(h){var d=Tn(l),f=!d&&vl(l),p=!d&&!f&&wl(l);c=l,d||f||p?Tn(a)?c=a:Vm(a)?c=Ff(a):f?(h=!1,c=km(l)):p?(h=!1,c=$m(l)):c=[]:ym(l)||Us(l)?(c=a,Us(a)?c=Km(a):(!It(a)||ii(a))&&(c=Bm(l))):h=!1}h&&(o.set(l,c),s(c,l,r,i,o),o.delete(l)),Ps(e,n,c)}function hi(e,t,n,r,s){e!==t&&jm(t,function(i,o){if(s||(s=new Dn),It(i))Xm(e,t,o,n,hi,r,s);else{var a=r?r(ks(e,o),i,o+"",e,t,s):void 0;a===void 0&&(a=i),Ps(e,o,a)}},bl)}var qm=Cl(function(e,t,n,r){hi(e,t,n,r)}),di=Cl(function(e,t,n){hi(e,t,n)});function Jm(e,t,n,r){if(!It(e))return e;t=Tl(t,e);for(var s=-1,i=t.length,o=i-1,a=e;a!=null&&++s<i;){var l=yl(t[s]),u=n;if(l==="__proto__"||l==="constructor"||l==="prototype")return e;if(s!=o){var c=a[l];u=void 0,u===void 0&&(u=It(c)?c:ai(t[s+1])?[]:{})}pl(a,l,u),a=a[l]}return e}function Zm(e,t,n){return e==null?e:Jm(e,t,n)}var ms,lo;function Qm(){if(lo)return ms;lo=1;var e=-1,t=1,n=0;function r(_,H,v,D,b){if(_===H)return _?[[n,_]]:[];if(v!=null){var O=fe(_,H,v);if(O)return O}var k=a(_,H),$=_.substring(0,k);_=_.substring(k),H=H.substring(k),k=u(_,H);var V=_.substring(_.length-k);_=_.substring(0,_.length-k),H=H.substring(0,H.length-k);var ie=s(_,H);return $&&ie.unshift([n,$]),V&&ie.push([n,V]),G(ie,b),D&&h(ie),ie}function s(_,H){var v;if(!_)return[[t,H]];if(!H)return[[e,_]];var D=_.length>H.length?_:H,b=_.length>H.length?H:_,O=D.indexOf(b);if(O!==-1)return v=[[t,D.substring(0,O)],[n,b],[t,D.substring(O+b.length)]],_.length>H.length&&(v[0][0]=v[2][0]=e),v;if(b.length===1)return[[e,_],[t,H]];var k=c(_,H);if(k){var $=k[0],V=k[1],ie=k[2],de=k[3],ge=k[4],ye=r($,ie),Ae=r(V,de);return ye.concat([[n,ge]],Ae)}return i(_,H)}function i(_,H){for(var v=_.length,D=H.length,b=Math.ceil((v+D)/2),O=b,k=2*b,$=new Array(k),V=new Array(k),ie=0;ie<k;ie++)$[ie]=-1,V[ie]=-1;$[O+1]=0,V[O+1]=0;for(var de=v-D,ge=de%2!==0,ye=0,Ae=0,S=0,F=0,K=0;K<b;K++){for(var q=-K+ye;q<=K-Ae;q+=2){var z=O+q,Y;q===-K||q!==K&&$[z-1]<$[z+1]?Y=$[z+1]:Y=$[z-1]+1;for(var ue=Y-q;Y<v&&ue<D&&_.charAt(Y)===H.charAt(ue);)Y++,ue++;if($[z]=Y,Y>v)Ae+=2;else if(ue>D)ye+=2;else if(ge){var ae=O+de-q;if(ae>=0&&ae<k&&V[ae]!==-1){var B=v-V[ae];if(Y>=B)return o(_,H,Y,ue)}}}for(var te=-K+S;te<=K-F;te+=2){var ae=O+te,B;te===-K||te!==K&&V[ae-1]<V[ae+1]?B=V[ae+1]:B=V[ae-1]+1;for(var oe=B-te;B<v&&oe<D&&_.charAt(v-B-1)===H.charAt(D-oe-1);)B++,oe++;if(V[ae]=B,B>v)F+=2;else if(oe>D)S+=2;else if(!ge){var z=O+de-te;if(z>=0&&z<k&&$[z]!==-1){var Y=$[z],ue=O+Y-z;if(B=v-B,Y>=B)return o(_,H,Y,ue)}}}}return[[e,_],[t,H]]}function o(_,H,v,D){var b=_.substring(0,v),O=H.substring(0,D),k=_.substring(v),$=H.substring(D),V=r(b,O),ie=r(k,$);return V.concat(ie)}function a(_,H){if(!_||!H||_.charAt(0)!==H.charAt(0))return 0;for(var v=0,D=Math.min(_.length,H.length),b=D,O=0;v<b;)_.substring(O,b)==H.substring(O,b)?(v=b,O=v):D=b,b=Math.floor((D-v)/2+v);return W(_.charCodeAt(b-1))&&b--,b}function l(_,H){var v=_.length,D=H.length;if(v==0||D==0)return 0;v>D?_=_.substring(v-D):v<D&&(H=H.substring(0,v));var b=Math.min(v,D);if(_==H)return b;for(var O=0,k=1;;){var $=_.substring(b-k),V=H.indexOf($);if(V==-1)return O;k+=V,(V==0||_.substring(b-k)==H.substring(0,k))&&(O=k,k++)}}function u(_,H){if(!_||!H||_.slice(-1)!==H.slice(-1))return 0;for(var v=0,D=Math.min(_.length,H.length),b=D,O=0;v<b;)_.substring(_.length-b,_.length-O)==H.substring(H.length-b,H.length-O)?(v=b,O=v):D=b,b=Math.floor((D-v)/2+v);return se(_.charCodeAt(_.length-b))&&b--,b}function c(_,H){var v=_.length>H.length?_:H,D=_.length>H.length?H:_;if(v.length<4||D.length*2<v.length)return null;function b(Ae,S,F){for(var K=Ae.substring(F,F+Math.floor(Ae.length/4)),q=-1,z="",Y,ue,ae,B;(q=S.indexOf(K,q+1))!==-1;){var te=a(Ae.substring(F),S.substring(q)),oe=u(Ae.substring(0,F),S.substring(0,q));z.length<oe+te&&(z=S.substring(q-oe,q)+S.substring(q,q+te),Y=Ae.substring(0,F-oe),ue=Ae.substring(F+te),ae=S.substring(0,q-oe),B=S.substring(q+te))}return z.length*2>=Ae.length?[Y,ue,ae,B,z]:null}var O=b(v,D,Math.ceil(v.length/4)),k=b(v,D,Math.ceil(v.length/2)),$;if(!O&&!k)return null;k?O?$=O[4].length>k[4].length?O:k:$=k:$=O;var V,ie,de,ge;_.length>H.length?(V=$[0],ie=$[1],de=$[2],ge=$[3]):(de=$[0],ge=$[1],V=$[2],ie=$[3]);var ye=$[4];return[V,ie,de,ge,ye]}function h(_){for(var H=!1,v=[],D=0,b=null,O=0,k=0,$=0,V=0,ie=0;O<_.length;)_[O][0]==n?(v[D++]=O,k=V,$=ie,V=0,ie=0,b=_[O][1]):(_[O][0]==t?V+=_[O][1].length:ie+=_[O][1].length,b&&b.length<=Math.max(k,$)&&b.length<=Math.max(V,ie)&&(_.splice(v[D-1],0,[e,b]),_[v[D-1]+1][0]=t,D--,D--,O=D>0?v[D-1]:-1,k=0,$=0,V=0,ie=0,b=null,H=!0)),O++;for(H&&G(_),N(_),O=1;O<_.length;){if(_[O-1][0]==e&&_[O][0]==t){var de=_[O-1][1],ge=_[O][1],ye=l(de,ge),Ae=l(ge,de);ye>=Ae?(ye>=de.length/2||ye>=ge.length/2)&&(_.splice(O,0,[n,ge.substring(0,ye)]),_[O-1][1]=de.substring(0,de.length-ye),_[O+1][1]=ge.substring(ye),O++):(Ae>=de.length/2||Ae>=ge.length/2)&&(_.splice(O,0,[n,de.substring(0,Ae)]),_[O-1][0]=t,_[O-1][1]=ge.substring(0,ge.length-Ae),_[O+1][0]=e,_[O+1][1]=de.substring(Ae),O++),O++}O++}}var d=/[^a-zA-Z0-9]/,f=/\s/,p=/[\r\n]/,R=/\n\r?\n$/,w=/^\r?\n\r?\n/;function N(_){function H(Ae,S){if(!Ae||!S)return 6;var F=Ae.charAt(Ae.length-1),K=S.charAt(0),q=F.match(d),z=K.match(d),Y=q&&F.match(f),ue=z&&K.match(f),ae=Y&&F.match(p),B=ue&&K.match(p),te=ae&&Ae.match(R),oe=B&&S.match(w);return te||oe?5:ae||B?4:q&&!Y&&ue?3:Y||ue?2:q||z?1:0}for(var v=1;v<_.length-1;){if(_[v-1][0]==n&&_[v+1][0]==n){var D=_[v-1][1],b=_[v][1],O=_[v+1][1],k=u(D,b);if(k){var $=b.substring(b.length-k);D=D.substring(0,D.length-k),b=$+b.substring(0,b.length-k),O=$+O}for(var V=D,ie=b,de=O,ge=H(D,b)+H(b,O);b.charAt(0)===O.charAt(0);){D+=b.charAt(0),b=b.substring(1)+O.charAt(0),O=O.substring(1);var ye=H(D,b)+H(b,O);ye>=ge&&(ge=ye,V=D,ie=b,de=O)}_[v-1][1]!=V&&(V?_[v-1][1]=V:(_.splice(v-1,1),v--),_[v][1]=ie,de?_[v+1][1]=de:(_.splice(v+1,1),v--))}v++}}function G(_,H){_.push([n,""]);for(var v=0,D=0,b=0,O="",k="",$;v<_.length;){if(v<_.length-1&&!_[v][1]){_.splice(v,1);continue}switch(_[v][0]){case t:b++,k+=_[v][1],v++;break;case e:D++,O+=_[v][1],v++;break;case n:var V=v-b-D-1;if(H){if(V>=0&&A(_[V][1])){var ie=_[V][1].slice(-1);if(_[V][1]=_[V][1].slice(0,-1),O=ie+O,k=ie+k,!_[V][1]){_.splice(V,1),v--;var de=V-1;_[de]&&_[de][0]===t&&(b++,k=_[de][1]+k,de--),_[de]&&_[de][0]===e&&(D++,O=_[de][1]+O,de--),V=de}}if(y(_[v][1])){var ie=_[v][1].charAt(0);_[v][1]=_[v][1].slice(1),O+=ie,k+=ie}}if(v<_.length-1&&!_[v][1]){_.splice(v,1);break}if(O.length>0||k.length>0){O.length>0&&k.length>0&&($=a(k,O),$!==0&&(V>=0?_[V][1]+=k.substring(0,$):(_.splice(0,0,[n,k.substring(0,$)]),v++),k=k.substring($),O=O.substring($)),$=u(k,O),$!==0&&(_[v][1]=k.substring(k.length-$)+_[v][1],k=k.substring(0,k.length-$),O=O.substring(0,O.length-$)));var ge=b+D;O.length===0&&k.length===0?(_.splice(v-ge,ge),v=v-ge):O.length===0?(_.splice(v-ge,ge,[t,k]),v=v-ge+1):k.length===0?(_.splice(v-ge,ge,[e,O]),v=v-ge+1):(_.splice(v-ge,ge,[e,O],[t,k]),v=v-ge+2)}v!==0&&_[v-1][0]===n?(_[v-1][1]+=_[v][1],_.splice(v,1)):v++,b=0,D=0,O="",k="";break}}_[_.length-1][1]===""&&_.pop();var ye=!1;for(v=1;v<_.length-1;)_[v-1][0]===n&&_[v+1][0]===n&&(_[v][1].substring(_[v][1].length-_[v-1][1].length)===_[v-1][1]?(_[v][1]=_[v-1][1]+_[v][1].substring(0,_[v][1].length-_[v-1][1].length),_[v+1][1]=_[v-1][1]+_[v+1][1],_.splice(v-1,1),ye=!0):_[v][1].substring(0,_[v+1][1].length)==_[v+1][1]&&(_[v-1][1]+=_[v+1][1],_[v][1]=_[v][1].substring(_[v+1][1].length)+_[v+1][1],_.splice(v+1,1),ye=!0)),v++;ye&&G(_,H)}function W(_){return _>=55296&&_<=56319}function se(_){return _>=56320&&_<=57343}function y(_){return se(_.charCodeAt(0))}function A(_){return W(_.charCodeAt(_.length-1))}function j(_){for(var H=[],v=0;v<_.length;v++)_[v][1].length>0&&H.push(_[v]);return H}function Z(_,H,v,D){return A(_)||y(D)?null:j([[n,_],[e,H],[t,v],[n,D]])}function fe(_,H,v){var D=typeof v=="number"?{index:v,length:0}:v.oldRange,b=typeof v=="number"?null:v.newRange,O=_.length,k=H.length;if(D.length===0&&(b===null||b.length===0)){var $=D.index,V=_.slice(0,$),ie=_.slice($),de=b?b.index:null;e:{var ge=$+k-O;if(de!==null&&de!==ge||ge<0||ge>k)break e;var ye=H.slice(0,ge),Ae=H.slice(ge);if(Ae!==ie)break e;var S=Math.min($,ge),F=V.slice(0,S),K=ye.slice(0,S);if(F!==K)break e;var q=V.slice(S),z=ye.slice(S);return Z(F,q,z,ie)}e:{if(de!==null&&de!==$)break e;var Y=$,ye=H.slice(0,Y),Ae=H.slice(Y);if(ye!==V)break e;var ue=Math.min(O-Y,k-Y),ae=ie.slice(ie.length-ue),B=Ae.slice(Ae.length-ue);if(ae!==B)break e;var q=ie.slice(0,ie.length-ue),z=Ae.slice(0,Ae.length-ue);return Z(V,q,z,ae)}}if(D.length>0&&b&&b.length===0)e:{var F=_.slice(0,D.index),ae=_.slice(D.index+D.length),S=F.length,ue=ae.length;if(k<S+ue)break e;var K=H.slice(0,S),B=H.slice(k-ue);if(F!==K||ae!==B)break e;var q=_.slice(S,O-ue),z=H.slice(S,k-ue);return Z(F,q,z,ae)}return null}function le(_,H,v,D){return r(_,H,v,D,!0)}return le.INSERT=t,le.DELETE=e,le.EQUAL=n,ms=le,ms}var e_=Qm();const fi=pt(e_),t_=new Set(["true","false"]);function n_(e){return t_.has(e.toLowerCase())}var _s,uo;function r_(){if(uo)return _s;uo=1;var e=function(t){if(t=t||{},this.Promise=t.Promise||Promise,this.queues=Object.create(null),this.domainReentrant=t.domainReentrant||!1,this.domainReentrant){if(typeof process>"u"||typeof process.domain>"u")throw new Error("Domain-reentrant locks require `process.domain` to exist. Please flip `opts.domainReentrant = false`, use a NodeJS version that still implements Domain, or install a browser polyfill.");this.domains=Object.create(null)}this.timeout=t.timeout||e.DEFAULT_TIMEOUT,this.maxOccupationTime=t.maxOccupationTime||e.DEFAULT_MAX_OCCUPATION_TIME,this.maxExecutionTime=t.maxExecutionTime||e.DEFAULT_MAX_EXECUTION_TIME,t.maxPending===1/0||Number.isInteger(t.maxPending)&&t.maxPending>=0?this.maxPending=t.maxPending:this.maxPending=e.DEFAULT_MAX_PENDING};return e.DEFAULT_TIMEOUT=0,e.DEFAULT_MAX_OCCUPATION_TIME=0,e.DEFAULT_MAX_EXECUTION_TIME=0,e.DEFAULT_MAX_PENDING=1e3,e.prototype.acquire=function(t,n,r,s){if(Array.isArray(t))return this._acquireBatch(t,n,r,s);if(typeof n!="function")throw new Error("You must pass a function to execute");var i=null,o=null,a=null;typeof r!="function"&&(s=r,r=null,a=new this.Promise(function(W,se){i=W,o=se})),s=s||{};var l=!1,u=null,c=null,h=null,d=this,f=function(W,se,y){c&&(clearTimeout(c),c=null),h&&(clearTimeout(h),h=null),W&&(d.queues[t]&&d.queues[t].length===0&&delete d.queues[t],d.domainReentrant&&delete d.domains[t]),l||(a?se?o(se):i(y):typeof r=="function"&&r(se,y),l=!0),W&&d.queues[t]&&d.queues[t].length>0&&d.queues[t].shift()()},p=function(W){if(l)return f(W);u&&(clearTimeout(u),u=null),d.domainReentrant&&W&&(d.domains[t]=process.domain);var se=s.maxExecutionTime||d.maxExecutionTime;if(se&&(h=setTimeout(function(){d.queues[t]&&f(W,new Error("Maximum execution time is exceeded "+t))},se)),n.length===1){var y=!1;try{n(function(A,j){y||(y=!0,f(W,A,j))})}catch(A){y||(y=!0,f(W,A))}}else d._promiseTry(function(){return n()}).then(function(A){f(W,void 0,A)},function(A){f(W,A)})};d.domainReentrant&&process.domain&&(p=process.domain.bind(p));var R=s.maxPending||d.maxPending;if(!d.queues[t])d.queues[t]=[],p(!0);else if(d.domainReentrant&&process.domain&&process.domain===d.domains[t])p(!1);else if(d.queues[t].length>=R)f(!1,new Error("Too many pending tasks in queue "+t));else{var w=function(){p(!0)};s.skipQueue?d.queues[t].unshift(w):d.queues[t].push(w);var N=s.timeout||d.timeout;N&&(u=setTimeout(function(){u=null,f(!1,new Error("async-lock timed out in queue "+t))},N))}var G=s.maxOccupationTime||d.maxOccupationTime;if(G&&(c=setTimeout(function(){d.queues[t]&&f(!1,new Error("Maximum occupation time is exceeded in queue "+t))},G)),a)return a},e.prototype._acquireBatch=function(t,n,r,s){typeof r!="function"&&(s=r,r=null);var i=this,o=function(l,u){return function(c){i.acquire(l,u,c,s)}},a=t.reduceRight(function(l,u){return o(u,l)},n);if(typeof r=="function")a(r);else return new this.Promise(function(l,u){a.length===1?a(function(c,h){c?u(c):l(h)}):l(a())})},e.prototype.isBusy=function(t){return t?!!this.queues[t]:Object.keys(this.queues).length>0},e.prototype._promiseTry=function(t){try{return this.Promise.resolve(t())}catch(n){return this.Promise.reject(n)}},_s=e,_s}var ps,co;function s_(){return co||(co=1,ps=r_()),ps}var i_=s_();const o_=pt(i_);function Ll(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;const s=Object.prototype.hasOwnProperty.bind(t);for(let i=0;i<n.length;i++){const o=n[i];if(!s(o))return!1;const a=e[o],l=t[o];if(a!==l)return!1}return!0}var $e=(e=>(e[e.UNIVER_UNKNOWN=0]="UNIVER_UNKNOWN",e[e.UNIVER_DOC=1]="UNIVER_DOC",e[e.UNIVER_SHEET=2]="UNIVER_SHEET",e[e.UNIVER_SLIDE=3]="UNIVER_SLIDE",e[e.UNIVER_PROJECT=4]="UNIVER_PROJECT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))($e||{}),Dt=(e=>(e[e.Reader=0]="Reader",e[e.Editor=1]="Editor",e[e.Owner=2]="Owner",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(Dt||{}),Fs=(e=>(e[e.SomeCollaborator=0]="SomeCollaborator",e[e.AllCollaborator=1]="AllCollaborator",e[e.OneSelf=2]="OneSelf",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(Fs||{});class ss extends st{}function a_(e=re.generateRandomId(6),t=sr.EN_US,n=""){return{id:e,locale:t,title:n,tableSource:{},drawings:{},drawingsOrder:[],headers:{},footers:{},body:{dataStream:`\r
6
- `,textRuns:[],customBlocks:[],tables:[],paragraphs:[{startIndex:0,paragraphStyle:{spaceAbove:{v:5},lineSpacing:1,spaceBelow:{v:0}}}],sectionBreaks:[{startIndex:1}]},documentStyle:{pageSize:{width:793.3333333333334,height:1122.6666666666667},documentFlavor:ni.TRADITIONAL,marginTop:50,marginBottom:50,marginRight:50,marginLeft:50,renderConfig:{zeroWidthParagraphBreak:Ie.FALSE,vertexAngle:0,centerAngle:0,background:{rgb:"#ccc"}},autoHyphenation:Ie.TRUE,doNotHyphenateCaps:Ie.FALSE,consecutiveHyphenLimit:2,defaultHeaderId:"",defaultFooterId:"",evenPageHeaderId:"",evenPageFooterId:"",firstPageHeaderId:"",firstPageFooterId:"",evenAndOddHeaders:Ie.FALSE,useFirstPageHeaderFooter:Ie.FALSE,marginHeader:30,marginFooter:30},settings:{}}}var en={},Un={},Rr={},ho;function l_(){if(ho)return Rr;ho=1,Object.defineProperty(Rr,"__esModule",{value:!0});function e(r,s){if(Array.isArray(s))return!1;for(let i in r)if(!n(r[i],s[i]))return!1;for(let i in s)if(r[i]===void 0)return!1;return!0}function t(r,s){if(!Array.isArray(s)||r.length!==s.length)return!1;for(let i=0;i<r.length;i++)if(!n(r[i],s[i]))return!1;return!0}function n(r,s){return r===s?!0:r===null||s===null||typeof r!="object"||typeof s!="object"?!1:Array.isArray(r)?t(r,s):e(r,s)}return Rr.default=n,Rr}var Ir={},fo;function u_(){if(fo)return Ir;fo=1,Object.defineProperty(Ir,"__esModule",{value:!0});function e(t){if(t===null)return null;if(Array.isArray(t))return t.map(e);if(typeof t=="object"){const n={};for(let r in t)n[r]=e(t[r]);return n}else return t}return Ir.default=e,Ir}var Es={},go;function xl(){return go||(go=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.eachChildOf=e.advancer=e.readCursor=e.writeCursor=e.WriteCursor=e.ReadCursor=e.isValidPathItem=void 0;function t(c,h){if(!c)throw new Error(h)}const n=c=>c!=null&&typeof c=="object"&&!Array.isArray(c),r=(c,h)=>typeof c==typeof h?c>h:typeof c=="string"&&typeof h=="number";function s(c,h){for(let d in c){const f=d;h.write(f,c[f])}}e.isValidPathItem=c=>typeof c=="number"||typeof c=="string"&&c!=="__proto__";class i{constructor(h=null){this.parents=[],this.indexes=[],this.lcIdx=-1,this.idx=-1,this.container=h}ascend(){t(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):(t(this.idx>0),this.idx--,n(this.container[this.idx])&&this.idx--)}getPath(){const h=[];let d=this.container,f=this.parents.length-1,p=this.idx;for(;p>=0;)h.unshift(d[p]),p===0?(p=this.indexes[f*2],d=this.parents[f--]):p-=n(d[p-1])?2:1;return h}}class o extends i{get(){return this.container?this.container.slice(this.idx+1):null}getKey(){return t(this.container!=null,"Invalid call to getKey before cursor descended"),this.container[this.idx]}getComponent(){let h;return this.container&&this.container.length>this.idx+1&&n(h=this.container[this.idx+1])?h:null}descendFirst(){let h=this.idx+1;if(!this.container||h>=this.container.length||n(this.container[h])&&h+1>=this.container.length)return!1;n(this.container[h])&&h++;const d=this.container[h];return Array.isArray(d)?(this.indexes.push(this.idx),this.parents.push(this.container),this.indexes.push(h),this.idx=0,this.container=d):this.idx=h,!0}nextSibling(){if(t(this.parents.length===this.indexes.length/2),this.idx>0||this.parents.length===0)return!1;const h=this.indexes[this.indexes.length-1]+1,d=this.parents[this.parents.length-1];return h>=d.length?!1:(t(!isNaN(h)),this.indexes[this.indexes.length-1]=h,this.container=d[h],!0)}_init(h,d,f,p){this.container=h,this.idx=d,this.parents=f.slice(),this.indexes=p.slice()}clone(){const h=new o;return h._init(this.container,this.idx,this.parents,this.indexes),h}*[Symbol.iterator](){if(this.descendFirst()){do yield this.getKey();while(this.nextSibling());this.ascend()}}traverse(h,d){const f=this.getComponent();f&&d(f,h);for(const p of this)h&&h.descend(p),this.traverse(h,d),h&&h.ascend()}eachPick(h,d){this.traverse(h,(f,p)=>{f.p!=null&&d(f.p,p)})}eachDrop(h,d){this.traverse(h,(f,p)=>{f.d!=null&&d(f.d,p)})}}e.ReadCursor=o;class a extends i{constructor(h=null){super(h),this.pendingDescent=[],this._op=h}flushDescent(){t(this.parents.length===this.indexes.length/2),this.container===null&&(this._op=this.container=[]);for(let h=0;h<this.pendingDescent.length;h++){const d=this.pendingDescent[h];let f=this.idx+1;if(f<this.container.length&&n(this.container[f])&&f++,t(f===this.container.length||!n(this.container[f])),f===this.container.length)this.container.push(d),this.idx=f;else if(this.container[f]===d)this.idx=f;else{if(!Array.isArray(this.container[f])){const p=this.container.splice(f,this.container.length-f);this.container.push(p),this.lcIdx>-1&&(this.lcIdx=f)}for(this.indexes.push(this.idx),this.parents.push(this.container),this.lcIdx!==-1&&(t(r(d,this.container[this.lcIdx][0])),f=this.lcIdx+1,this.lcIdx=-1);f<this.container.length&&r(d,this.container[f][0]);)f++;if(this.indexes.push(f),this.idx=0,f<this.container.length&&this.container[f][0]===d)this.container=this.container[f];else{const p=[d];this.container.splice(f,0,p),this.container=p}}}this.pendingDescent.length=0}reset(){this.lcIdx=-1}getComponent(){this.flushDescent();const h=this.idx+1;if(h<this.container.length&&n(this.container[h]))return this.container[h];{const d={};return this.container.splice(h,0,d),d}}write(h,d){const f=this.getComponent();t(f[h]==null||f[h]===d,"Internal consistency error: Overwritten component. File a bug"),f[h]=d}get(){return this._op}descend(h){if(!e.isValidPathItem(h))throw Error("Invalid JSON key");this.pendingDescent.push(h)}descendPath(h){return this.pendingDescent.push(...h),this}ascend(){this.pendingDescent.length?this.pendingDescent.pop():super.ascend()}mergeTree(h,d=s){if(h===null)return;if(t(Array.isArray(h)),h===this._op)throw Error("Cannot merge into my own tree");const f=this.lcIdx,p=this.parents.length;let R=0;for(let w=0;w<h.length;w++){const N=h[w];typeof N=="string"||typeof N=="number"?(R++,this.descend(N)):Array.isArray(N)?this.mergeTree(N,d):typeof N=="object"&&d(N,this)}for(;R--;)this.ascend();this.lcIdx=this.parents.length===p?f:-1}at(h,d){this.descendPath(h),d(this);for(let f=0;f<h.length;f++)this.ascend();return this}writeAtPath(h,d,f){return this.at(h,()=>this.write(d,f)),this.reset(),this}writeMove(h,d,f=0){return this.writeAtPath(h,"p",f).writeAtPath(d,"d",f)}getPath(){const h=super.getPath();return h.push(...this.pendingDescent),h}}e.WriteCursor=a,e.writeCursor=()=>new a,e.readCursor=c=>new o(c);function l(c,h,d){let f,p;p=f=c?c.descendFirst():!1;function R(w){let N;for(;p;){const G=N=c.getKey();if(w!=null){let W=!1;if(h&&typeof G=="number"&&(N=h(G,c.getComponent()),N<0&&(N=~N,W=!0)),r(N,w))return null;if(N===w&&!W)return c}d&&typeof N=="number"&&d(N,c.getComponent()),p=c.nextSibling()}return null}return R.end=()=>{f&&c.ascend()},R}e.advancer=l;function u(c,h,d){let f,p,R,w;for(f=p=c&&c.descendFirst(),R=w=h&&h.descendFirst();f||R;){let N=f?c.getKey():null,G=R?h.getKey():null;N!==null&&G!==null&&(r(G,N)?G=null:N!==G&&(N=null)),d(N==null?G:N,N!=null?c:null,G!=null?h:null),N!=null&&f&&(f=c.nextSibling()),G!=null&&R&&(R=h.nextSibling())}p&&c.ascend(),w&&h.ascend()}e.eachChildOf=u}(Es)),Es}var Cs={},mo;function Ul(){return mo||(mo=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ConflictType=void 0,function(t){t[t.RM_UNEXPECTED_CONTENT=1]="RM_UNEXPECTED_CONTENT",t[t.DROP_COLLISION=2]="DROP_COLLISION",t[t.BLACKHOLE=3]="BLACKHOLE"}(e.ConflictType||(e.ConflictType={}))}(Cs)),Cs}var vt={},tn={},_o;function gi(){return _o||(_o=1,Object.defineProperty(tn,"__esModule",{value:!0}),tn.uniToStrPos=tn.strPosToUni=void 0,tn.strPosToUni=(e,t=e.length)=>{let n=0,r=0;for(;r<t;r++){const s=e.charCodeAt(r);s>=55296&&s<=57343&&(n++,r++)}if(r!==t)throw Error("Invalid offset - splits unicode bytes");return r-n},tn.uniToStrPos=(e,t)=>{let n=0;for(;t>0;t--){const r=e.charCodeAt(n);n+=r>=55296&&r<=57343?2:1}return n}),tn}var Rs={},po;function $s(){return po||(po=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.uniSlice=e.dlen=e.eachOp=void 0;const t=gi(),n=y=>{if(!Array.isArray(y))throw Error("Op must be an array of components");let A=null;for(let j=0;j<y.length;j++){const Z=y[j];switch(typeof Z){case"object":if(typeof Z.d!="number"&&typeof Z.d!="string")throw Error("Delete must be number or string");if(e.dlen(Z.d)<=0)throw Error("Deletes must not be empty");break;case"string":if(!(Z.length>0))throw Error("Inserts cannot be empty");break;case"number":if(!(Z>0))throw Error("Skip components must be >0");if(typeof A=="number")throw Error("Adjacent skip components should be combined");break}A=Z}if(typeof A=="number")throw Error("Op has a trailing skip")};function r(y,A){let j=0,Z=0;for(let fe=0;fe<y.length;fe++){const le=y[fe];switch(A(le,j,Z),typeof le){case"object":j+=e.dlen(le.d);break;case"string":Z+=t.strPosToUni(le);break;case"number":j+=le,Z+=le;break}}}e.eachOp=r;function s(y,A){const j=[],Z=a(j);return r(y,(fe,le,_)=>{Z(A(fe,le,_))}),h(j)}const i=y=>y,o=y=>s(y,i);e.dlen=y=>typeof y=="number"?y:t.strPosToUni(y);const a=y=>A=>{if(!(!A||A.d===0||A.d===""))if(y.length===0)y.push(A);else if(typeof A==typeof y[y.length-1])if(typeof A=="object"){const j=y[y.length-1];j.d=typeof j.d=="string"&&typeof A.d=="string"?j.d+A.d:e.dlen(j.d)+e.dlen(A.d)}else y[y.length-1]+=A;else y.push(A)},l=y=>typeof y=="number"?y:typeof y=="string"?t.strPosToUni(y):typeof y.d=="number"?y.d:t.strPosToUni(y.d);e.uniSlice=(y,A,j)=>{const Z=t.uniToStrPos(y,A),fe=j==null?1/0:t.uniToStrPos(y,j);return y.slice(Z,fe)};const u=(y,A,j)=>typeof y=="number"?j==null?y-A:Math.min(y,j)-A:e.uniSlice(y,A,j),c=y=>{let A=0,j=0;return{take:(le,_)=>{if(A===y.length)return le===-1?null:le;const H=y[A];let v;if(typeof H=="number")return le===-1||H-j<=le?(v=H-j,++A,j=0,v):(j+=le,le);if(typeof H=="string"){if(le===-1||_==="i"||t.strPosToUni(H.slice(j))<=le)return v=H.slice(j),++A,j=0,v;{const D=j+t.uniToStrPos(H.slice(j),le);return v=H.slice(j,D),j=D,v}}else{if(le===-1||_==="d"||e.dlen(H.d)-j<=le)return v={d:u(H.d,j)},++A,j=0,v;{let D=u(H.d,j,j+le);return j+=le,{d:D}}}},peek:()=>y[A]}},h=y=>(y.length>0&&typeof y[y.length-1]=="number"&&y.pop(),y);function d(y,A,j){if(j!=="left"&&j!=="right")throw Error("side ("+j+") must be 'left' or 'right'");n(y),n(A);const Z=[],fe=a(Z),{take:le,peek:_}=c(y);for(let v=0;v<A.length;v++){const D=A[v];let b,O;switch(typeof D){case"number":for(b=D;b>0;)O=le(b,"i"),fe(O),typeof O!="string"&&(b-=l(O));break;case"string":j==="left"&&typeof _()=="string"&&fe(le(-1)),fe(t.strPosToUni(D));break;case"object":for(b=e.dlen(D.d);b>0;)switch(O=le(b,"i"),typeof O){case"number":b-=O;break;case"string":fe(O);break;case"object":b-=e.dlen(O.d)}break}}let H;for(;H=le(-1);)fe(H);return h(Z)}function f(y,A){n(y),n(A);const j=[],Z=a(j),{take:fe}=c(y);for(let _=0;_<A.length;_++){const H=A[_];let v,D;switch(typeof H){case"number":for(v=H;v>0;)D=fe(v,"d"),Z(D),typeof D!="object"&&(v-=l(D));break;case"string":Z(H);break;case"object":v=e.dlen(H.d);let b=0;for(;b<v;)switch(D=fe(v-b,"d"),typeof D){case"number":Z({d:u(H.d,b,b+D)}),b+=D;break;case"string":b+=t.strPosToUni(D);break;case"object":Z(D)}break}}let le;for(;le=fe(-1);)Z(le);return h(j)}const p=(y,A)=>{let j=0;for(let Z=0;Z<A.length&&y>j;Z++){const fe=A[Z];switch(typeof fe){case"number":{j+=fe;break}case"string":const le=t.strPosToUni(fe);j+=le,y+=le;break;case"object":y-=Math.min(e.dlen(fe.d),y-j);break}}return y},R=(y,A)=>typeof y=="number"?p(y,A):y.map(j=>p(j,A));function w(y,A,j){return s(y,(Z,fe)=>typeof Z=="object"&&typeof Z.d=="number"?{d:j.slice(A,fe,fe+Z.d)}:Z)}function N(y){return s(y,A=>{switch(typeof A){case"object":if(typeof A.d=="number")throw Error("Cannot invert text op: Deleted characters missing from operation. makeInvertible must be called first.");return A.d;case"string":return{d:A};case"number":return A}})}function G(y){return s(y,A=>typeof A=="object"&&typeof A.d=="string"?{d:t.strPosToUni(A.d)}:A)}function W(y){let A=!0;return r(y,j=>{typeof j=="object"&&typeof j.d=="number"&&(A=!1)}),A}function se(y){return{name:"text-unicode",uri:"http://sharejs.org/types/text-unicode",trim:h,normalize:o,checkOp:n,create(A=""){if(typeof A!="string")throw Error("Initial data must be a string");return y.create(A)},apply(A,j){n(j);const Z=y.builder(A);for(let fe=0;fe<j.length;fe++){const le=j[fe];switch(typeof le){case"number":Z.skip(le);break;case"string":Z.append(le);break;case"object":Z.del(e.dlen(le.d));break}}return Z.build()},transform:d,compose:f,transformPosition:p,transformSelection:R,isInvertible:W,makeInvertible(A,j){return w(A,j,y)},stripInvertible:G,invert:N,invertWithDoc(A,j){return N(w(A,j,y))},isNoop:A=>A.length===0}}e.default=se}(Rs)),Rs}var Sr={},Eo;function c_(){if(Eo)return Sr;Eo=1,Object.defineProperty(Sr,"__esModule",{value:!0});const e=$s(),t=gi();function n(r,s){return{get:r,getLength(){return r().length},insert(i,o,a){const l=t.strPosToUni(r(),i);return s([l,o],a)},remove(i,o,a){const l=t.strPosToUni(r(),i);return s([l,{d:o}],a)},_onOp(i){e.eachOp(i,(o,a,l)=>{switch(typeof o){case"string":this.onInsert&&this.onInsert(l,o);break;case"object":const u=e.dlen(o.d);this.onRemove&&this.onRemove(l,u)}})},onInsert:null,onRemove:null}}return Sr.default=n,n.provides={text:!0},Sr}var Co;function h_(){return Co||(Co=1,function(e){var t=vt&&vt.__createBinding||(Object.create?function(d,f,p,R){R===void 0&&(R=p),Object.defineProperty(d,R,{enumerable:!0,get:function(){return f[p]}})}:function(d,f,p,R){R===void 0&&(R=p),d[R]=f[p]}),n=vt&&vt.__setModuleDefault||(Object.create?function(d,f){Object.defineProperty(d,"default",{enumerable:!0,value:f})}:function(d,f){d.default=f}),r=vt&&vt.__importStar||function(d){if(d&&d.__esModule)return d;var f={};if(d!=null)for(var p in d)Object.hasOwnProperty.call(d,p)&&t(f,d,p);return n(f,d),f},s=vt&&vt.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(e,"__esModule",{value:!0}),e.type=e.remove=e.insert=void 0;const i=gi(),o=r($s()),a=s(c_()),l={create(d){return d},toString(d){return d},builder(d){if(typeof d!="string")throw Error("Invalid document snapshot: "+d);const f=[];return{skip(p){let R=i.uniToStrPos(d,p);if(R>d.length)throw Error("The op is too long for this document");f.push(d.slice(0,R)),d=d.slice(R)},append(p){f.push(p)},del(p){d=d.slice(i.uniToStrPos(d,p))},build(){return f.join("")+d}}},slice:o.uniSlice},u=o.default(l),c=Object.assign(Object.assign({},u),{api:a.default});e.type=c,e.insert=(d,f)=>f.length===0?[]:d===0?[f]:[d,f],e.remove=(d,f)=>o.dlen(f)===0?[]:d===0?[{d:f}]:[d,{d:f}];var h=$s();Object.defineProperty(e,"makeType",{enumerable:!0,get:function(){return h.default}})}(vt)),vt}var Ro;function d_(){return Ro||(Ro=1,function(e){var t=Un&&Un.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(e,"__esModule",{value:!0}),e.editOp=e.replaceOp=e.insertOp=e.moveOp=e.removeOp=e.type=void 0;const n=t(l_()),r=t(u_()),s=xl(),i=Ul();function o(S,F){if(!S)throw new Error(F)}e.type={name:"json1",uri:"http://sharejs.org/types/JSONv1",readCursor:s.readCursor,writeCursor:s.writeCursor,create:S=>S,isNoop:S=>S==null,setDebug(S){},registerSubtype:N,checkValidOp:fe,normalize:le,apply:_,transformPosition:H,compose:v,tryTransform:V,transform:de,makeInvertible:O,invert:D,invertWithDoc:k,RM_UNEXPECTED_CONTENT:i.ConflictType.RM_UNEXPECTED_CONTENT,DROP_COLLISION:i.ConflictType.DROP_COLLISION,BLACKHOLE:i.ConflictType.BLACKHOLE,transformNoConflict:(S,F,K)=>Ae(()=>!0,S,F,K),typeAllowingConflictsPred:S=>Object.assign(Object.assign({},e.type),{transform:(F,K,q)=>Ae(S,F,K,q)})};const a=S=>S?S.getComponent():null;function l(S){return S&&typeof S=="object"&&!Array.isArray(S)}const u=S=>Array.isArray(S)?S.slice():S!==null&&typeof S=="object"?Object.assign({},S):S,c=S=>S&&(S.p!=null||S.r!==void 0),h=S=>S&&(S.d!=null||S.i!==void 0);function d(S,F){return o(S!=null),typeof F=="number"?(o(Array.isArray(S),"Invalid key - child is not an array"),(S=S.slice()).splice(F,1)):(o(l(S),"Invalid key - child is not an object"),delete(S=Object.assign({},S))[F]),S}function f(S,F,K){return typeof F=="number"?(o(S!=null,"Container is missing for key"),o(Array.isArray(S),"Cannot use numerical key for object container"),o(S.length>=F,"Cannot insert into out of bounds index"),S.splice(F,0,K)):(o(l(S),"Cannot insert into missing item"),o(S[F]===void 0,"Trying to overwrite value at key. Your op needs to remove it first"),S[F]=K),K}e.removeOp=(S,F=!0)=>s.writeCursor().writeAtPath(S,"r",F).get(),e.moveOp=(S,F)=>s.writeCursor().writeMove(S,F).get(),e.insertOp=(S,F)=>s.writeCursor().writeAtPath(S,"i",F).get(),e.replaceOp=(S,F,K)=>s.writeCursor().at(S,q=>{q.write("r",F),q.write("i",K)}).get(),e.editOp=(S,F,K,q=!1)=>s.writeCursor().at(S,z=>A(z,F,K,q)).get();const p=(S,F)=>S!=null&&(typeof F=="number"?Array.isArray(S):typeof S=="object"),R=(S,F)=>p(S,F)?S[F]:void 0,w={};function N(S){let F=S.type?S.type:S;F.name&&(w[F.name]=F),F.uri&&(w[F.uri]=F)}const G=S=>{const F=w[S];if(F)return F;throw Error("Missing type: "+S)};N(h_());const W=(S,F)=>S+F;N({name:"number",apply:W,compose:W,invert:S=>-S,transform:S=>S});const se=S=>S==null?null:S.et?G(S.et):S.es?w["text-unicode"]:S.ena!=null?w.number:null,y=S=>S.es?S.es:S.ena!=null?S.ena:S.e,A=(S,F,K,q=!1)=>{const[z,Y]=typeof F=="string"?[G(F),F]:[F,F.name];!q&&z.isNoop&&z.isNoop(K)||(Y==="number"?S.write("ena",K):Y==="text-unicode"?S.write("es",K):(S.write("et",Y),S.write("e",K)))};function j(S){o(typeof S=="number"),o(S>=0),o(S===(0|S))}function Z(S){typeof S=="number"?j(S):o(typeof S=="string")}function fe(S){if(S===null)return;const F=new Set,K=new Set,q=Y=>{let ue=!0,ae=!1;for(let B in Y){const te=Y[B];if(ue=!1,o(B==="p"||B==="r"||B==="d"||B==="i"||B==="e"||B==="es"||B==="ena"||B==="et","Invalid component item '"+B+"'"),B==="p")j(te),o(!F.has(te)),F.add(te),o(Y.r===void 0);else if(B==="d")j(te),o(!K.has(te)),K.add(te),o(Y.i===void 0);else if(B==="e"||B==="es"||B==="ena"){o(!ae),ae=!0;const oe=se(Y);o(oe,"Missing type in edit"),oe.checkValidOp&&oe.checkValidOp(y(Y))}}o(!ue)},z=(Y,ue,ae)=>{if(!Array.isArray(Y))throw Error("Op must be null or a list");if(Y.length===0)throw Error("Empty descent");ue||Z(Y[0]);let B=1,te=0,oe=0;for(let me=0;me<Y.length;me++){const be=Y[me];if(o(be!=null),Array.isArray(be)){const De=z(be,!1);if(te){const X=typeof oe,Re=typeof De;X===Re?o(oe<De,"descent keys are not in order"):o(X==="number"&&Re==="string")}oe=De,te++,B=3}else typeof be=="object"?(o(B===1,`Prev not scalar - instead ${B}`),q(be),B=2):(o(B!==3),Z(be),o(s.isValidPathItem(be),"Invalid path key"),B=1)}return o(te!==1,"Operation makes multiple descents. Remove some []"),o(B===2||B===3),Y[0]};z(S,!0),o(F.size===K.size,"Mismatched picks and drops in op");for(let Y=0;Y<F.size;Y++)o(F.has(Y)),o(K.has(Y))}function le(S){let F=0,K=[];const q=s.writeCursor();return q.mergeTree(S,(z,Y)=>{const ue=se(z);if(ue){const B=y(z);A(Y,ue,ue.normalize?ue.normalize(B):B)}for(const B of["r","p","i","d"])if(z[B]!==void 0){const te=B==="p"||B==="d"?(ae=z[B],K[ae]==null&&(K[ae]=F++),K[ae]):z[B];Y.write(B,te)}var ae}),q.get()}function _(S,F){if(fe(F),F===null)return S;const K=[];return function q(z,Y){let ue=z,ae=0,B={root:z},te=0,oe=B,me="root";function be(){for(;te<ae;te++){let De=Y[te];typeof De!="object"&&(o(p(oe,me)),oe=oe[me]=u(oe[me]),me=De)}}for(;ae<Y.length;ae++){const De=Y[ae];if(Array.isArray(De)){const X=q(ue,De);X!==ue&&X!==void 0&&(be(),ue=oe[me]=X)}else if(typeof De=="object"){De.d!=null?(be(),ue=f(oe,me,K[De.d])):De.i!==void 0&&(be(),ue=f(oe,me,De.i));const X=se(De);if(X)be(),ue=oe[me]=X.apply(ue,y(De));else if(De.e!==void 0)throw Error("Subtype "+De.et+" undefined")}else ue=R(ue,De)}return B.root}(S=function q(z,Y){const ue=[];let ae=0;for(;ae<Y.length;ae++){const me=Y[ae];if(Array.isArray(me))break;typeof me!="object"&&(ue.push(z),z=R(z,me))}for(let me=Y.length-1;me>=ae;me--)z=q(z,Y[me]);for(--ae;ae>=0;ae--){const me=Y[ae];if(typeof me!="object"){const be=ue.pop();z=z===R(be,me)?be:z===void 0?d(be,me):(te=me,oe=z,(B=u(B=be))[te]=oe,B)}else c(me)&&(o(z!==void 0,"Cannot pick up or remove undefined"),me.p!=null&&(K[me.p]=z),z=void 0)}var B,te,oe;return z}(S,F),F)}function H(S,F){S=S.slice(),fe(F);const K=s.readCursor(F);let q,z,Y=!1;const ue=[];for(let B=0;;B++){const te=S[B],oe=K.getComponent();if(oe&&(oe.r!==void 0?Y=!0:oe.p!=null&&(Y=!1,q=oe.p,z=B)),B>=S.length)break;let me=0;const be=s.advancer(K,void 0,(X,Re)=>{c(Re)&&me++});ue.unshift(be);const De=be(te);if(typeof te=="number"&&(S[B]-=me),!De)break}if(ue.forEach(B=>B.end()),Y)return null;const ae=()=>{let B=0;if(q!=null){const te=K.getPath();B=te.length,S=te.concat(S.slice(z))}for(;B<S.length;B++){const te=S[B],oe=a(K),me=se(oe);if(me){const X=y(oe);me.transformPosition&&(S[B]=me.transformPosition(S[B],X));break}let be=0;const De=s.advancer(K,(X,Re)=>h(Re)?~(X-be):X-be,(X,Re)=>{h(Re)&&be++})(te);if(typeof te=="number"&&(S[B]+=be),!De)break}};return q!=null?K.eachDrop(null,B=>{B===q&&ae()}):ae(),S}function v(S,F){if(fe(S),fe(F),S==null)return F;if(F==null)return S;let K=0;const q=s.readCursor(S),z=s.readCursor(F),Y=s.writeCursor(),ue=[],ae=[],B=[],te=[],oe=[],me=[],be=new Set;q.traverse(null,X=>{X.p!=null&&(B[X.p]=q.clone())}),z.traverse(null,X=>{X.d!=null&&(te[X.d]=z.clone())});const De=s.writeCursor();return function X(Re,ze,He,Ue,qe,Et,Ge,et){o(ze||He);const Ve=a(ze),ct=a(He),at=!!ct&&ct.r!==void 0,xt=!!Ve&&Ve.i!==void 0,Fe=Ve?Ve.d:null,ht=ct?ct.p:null,E=(Et||at)&&ht==null;if(ht!=null)Ue=te[ht],Ge=ae[ht]=new s.WriteCursor;else if(ct&&ct.r!==void 0)Ue=null;else{const L=a(Ue);L&&L.d!=null&&(Ue=null)}const g=a(Ue);if(Fe!=null)if(Re=B[Fe],et=ue[Fe]=new s.WriteCursor,E)Et&&!at&&et.write("r",!0);else{const L=oe[Fe]=K++;Ge.write("d",L)}else if(Ve&&Ve.i!==void 0)Re=null;else{const L=a(Re);L&&L.p!=null&&(Re=null)}let m;xt?(o(qe===void 0),m=Ve.i):m=qe;const T=(ht==null?!xt||Et||at:m===void 0)?null:Ge.getComponent();if(ht!=null){if(!(qe!==void 0||xt)){const L=Fe!=null?oe[Fe]:K++;me[ht]=L,et.write("p",L)}}else at&&(xt||qe!==void 0||(ct.r,et.write("r",ct.r)));const M=E?null:se(Ve),U=se(g);if((M||U)&&(M&&M.name,U&&U.name),M&&U){o(M===U);const L=y(Ve),ee=y(g),Ce=M.compose(L,ee);A(Ge,M,Ce),be.add(g)}else M?A(Ge,M,y(Ve)):U&&(A(Ge,U,y(g)),be.add(g));const x=typeof m=="object"&&m!=null;let P=!1,I=0,Q=0,pe=0,J=0,_e=0;const Oe=s.advancer(Ue,(L,ee)=>h(ee)?J-L-1:L-J,(L,ee)=>{h(ee)&&J++}),ce=s.advancer(Re,(L,ee)=>c(ee)?I-L-1:L-I,(L,ee)=>{c(ee)&&I++});if(s.eachChildOf(ze,He,(L,ee,Ce)=>{let Te,Pe,ke=L,We=L,dt=L;if(typeof L=="number"){let Me=L+pe;Pe=Oe(Me),We=Me+J;let ne=L+Q;Te=ce(ne),h(a(Pe))&&(Te=null),ke=ne+I,dt=L+_e,o(ke>=0,"p1PickKey is negative"),o(We>=0,"p2DropKey is negative");const lt=h(a(ee)),Be=c(a(Ce));(lt||Be&&!E)&&_e--,lt&&Q--,Be&&pe--}else Te=ce(L),Pe=Oe(L);et.descend(ke),Ge.descend(We);const gt=x&&!h(a(ee))?m[dt]:void 0,Ee=X(Te,ee,Ce,Pe,gt,E,Ge,et);var Qe,ve,Se;x&&!E?gt!==Ee&&(P||(m=Array.isArray(m)?m.slice():Object.assign({},m),P=!0),Qe=m,Se=Ee,typeof(ve=dt)=="number"?(o(Array.isArray(Qe)),o(ve<Qe.length)):(o(!Array.isArray(Qe)),o(Qe[ve]!==void 0)),Se===void 0?typeof ve=="number"?Qe.splice(ve,1):delete Qe[ve]:Qe[ve]=Se):o(Ee===void 0),Ge.ascend(),et.ascend()}),ce.end(),Oe.end(),T!=null)T.i=m;else if(!Et&&!at&&ht==null)return m}(q,q.clone(),z,z.clone(),void 0,!1,Y,De),Y.reset(),Y.mergeTree(De.get()),Y.reset(),Y.get(),ue.map(X=>X.get()),ae.map(X=>X.get()),q.traverse(Y,(X,Re)=>{const ze=X.p;if(ze!=null){const He=oe[ze];He!=null&&Re.write("p",He);const Ue=ue[ze];Ue&&Ue.get(),Ue&&Re.mergeTree(Ue.get())}else X.r!==void 0&&Re.write("r",X.r)}),Y.reset(),Y.get(),z.traverse(Y,(X,Re)=>{const ze=X.d;if(ze!=null){const Ue=me[ze];Ue!=null&&Re.write("d",Ue);const qe=ae[ze];qe&&Re.mergeTree(qe.get())}else X.i!==void 0&&Re.write("i",X.i);const He=se(X);He&&!be.has(X)&&A(Re,He,y(X))}),Y.get()}function D(S){if(S==null)return null;const F=new s.ReadCursor(S),K=new s.WriteCursor;let q;const z=[],Y=[];return function ue(ae,B,te){const oe=ae.getComponent();let me,be=!1;if(oe){oe.p!=null&&(B.write("d",oe.p),z[oe.p]=ae.clone()),oe.r!==void 0&&B.write("i",oe.r),oe.d!=null&&(B.write("p",oe.d),te=void 0),oe.i!==void 0&&(te=me=oe.i);const X=se(oe);X&&(te===void 0?(q||(q=new Set),q.add(oe)):(y(oe),te=X.apply(te,y(oe)),be=!0))}let De=0;for(const X of ae){B.descend(X);const Re=typeof X=="number"?X-De:X,ze=R(te,Re);h(ae.getComponent())&&De++;const He=ue(ae,B,ze);if(te!==void 0&&He!==void 0){if(be||(be=!0,te=u(te)),!p(te,Re))throw Error("Cannot modify child - invalid operation");te[Re]=He}B.ascend()}if(me===void 0)return be?te:void 0;B.write("r",te)}(F,K,void 0),q&&(K.reset(),function ue(ae,B,te){const oe=B.getComponent();if(oe){const X=oe.d;if(X!=null&&(ae=z[X],te=Y[X]=s.writeCursor()),q.has(oe)){const Re=se(oe);if(!Re.invert)throw Error(`Cannot invert subtype ${Re.name}`);A(te,Re,Re.invert(y(oe)))}}let me=0,be=0;const De=s.advancer(ae,(X,Re)=>c(Re)?me-X-1:X-me,(X,Re)=>{c(Re)&&me++});for(const X of B)if(typeof X=="number"){const Re=X-be,ze=De(Re),He=Re+me;te.descend(He),ue(ze,B,te),h(B.getComponent())&&be++,te.ascend()}else te.descend(X),ue(De(X),B,te),te.ascend();De.end()}(F.clone(),F,K),Y.length&&(K.reset(),F.traverse(K,(ue,ae)=>{const B=ue.p;if(B!=null){const te=Y[B];te&&te.get(),te&&ae.mergeTree(te.get())}}))),K.get()}const b=(S,F)=>S.some(K=>typeof K=="object"&&(Array.isArray(K)?b(K,F):F(K)));function O(S,F){if(S==null||!b(S,B=>{var te;return B.r!==void 0||((te=se(B))===null||te===void 0?void 0:te.makeInvertible)!=null}))return S;const K=new s.ReadCursor(S),q=new s.WriteCursor;let z=!1;const Y=[],ue=[],ae=(B,te,oe)=>{const me=B.getComponent();let be=!1;if(me){me.d!=null&&te.write("d",me.d),me.i!==void 0&&te.write("i",me.i);const X=me.p;if(X!=null&&(Y[X]=B.clone(),o(oe!==void 0,"Operation picks up at an invalid key"),ue[X]=oe,te.write("p",me.p)),me.r!==void 0&&oe===void 0)throw Error("Invalid doc / op in makeInvertible: removed item missing from doc");const Re=se(me);Re&&(Re.makeInvertible?z=!0:A(te,Re,y(me),!0))}let De=0;for(const X of B){te.descend(X);const Re=typeof X=="number"?X-De:X,ze=R(oe,Re),He=ae(B,te,ze);ze!==He&&(be||(be=!0,oe=u(oe)),He===void 0?(oe=d(oe,Re),typeof X=="number"&&De++):oe[Re]=He),te.ascend()}return me&&(me.r!==void 0?(te.write("r",r.default(oe)),oe=void 0):me.p!=null&&(oe=void 0)),oe};return ae(K,q,F),q.get(),z&&(q.reset(),function B(te,oe,me,be,De){const X=oe.getComponent();if(X){X.i!==void 0?(be=X.i,De=!0):X.d!=null&&(be=ue[X.d],te=Y[X.d],De=!1,X.d);let Ue=se(X);if(Ue&&Ue.makeInvertible){const qe=y(X);A(me,Ue,Ue.makeInvertible(qe,be),!0)}}let Re=0,ze=0;const He=s.advancer(te,(Ue,qe)=>c(qe)?Re-Ue-1:Ue-Re,(Ue,qe)=>{c(qe)&&Re++});for(const Ue of oe)if(typeof Ue=="number"){const qe=Ue-ze,Et=He(qe),Ge=qe+Re,et=R(be,De?qe:Ge);me.descend(Ue),B(Et,oe,me,et,De),h(oe.getComponent())&&ze++,me.ascend()}else{const qe=R(be,Ue);me.descend(Ue),B(He(Ue),oe,me,qe,De),me.ascend()}He.end()}(K.clone(),K,q,F,!1)),q.get()}function k(S,F){return D(O(S,F))}const $=S=>{if(S==null)return null;const F=S.slice();for(let K=0;K<S.length;K++){const q=F[K];Array.isArray(q)&&(F[K]=$(q))}return F};function V(S,F,K){o(K==="left"||K==="right","Direction must be left or right");const q=K==="left"?0:1;if(F==null)return{ok:!0,result:S};fe(S),fe(F);let z=null;const Y=[],ue=[],ae=[],B=[],te=[],oe=[],me=[],be=[],De=[],X=[],Re=[],ze=[],He=[],Ue=[],qe=[];let Et=0;const Ge=s.readCursor(S),et=s.readCursor(F),Ve=s.writeCursor();if(function g(m,T=null,M){const U=a(T);U&&(U.r!==void 0?M=T.clone():U.p!=null&&(M=null,oe[U.p]=m.clone()));const x=m.getComponent();let P;x&&(P=x.p)!=null&&(te[P]=T?T.clone():null,ae[P]=m.clone(),M&&(X[P]=!0,De[P]=M),U&&U.p!=null&&(Ue[P]=U.p));const I=s.advancer(T);for(const Q of m)g(m,I(Q),M);I.end()}(et,Ge,null),function g(m,T,M,U,x){const P=M.getComponent();let I,Q=!1;P&&((I=P.d)!=null?(B[I]=M.clone(),U!=null&&(qe[U]==null&&(qe[U]=[]),qe[U].push(I)),X[I],m=te[I]||null,T=ae[I]||null,X[I]?(x&&(Re[I]=!0),x=De[I]||null):!x||q!==1&&Ue[I]!=null||z==null&&(z={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(x.getPath()),op2:e.moveOp(T.getPath(),M.getPath())}),Q=!0):P.i!==void 0&&(m=T=null,Q=!0,x&&z==null&&(z={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(x.getPath()),op2:e.insertOp(M.getPath(),P.i)})));const pe=a(m);pe&&(pe.r!==void 0?x=m.clone():pe.p!=null&&(pe.p,U=pe.p,x=null));const J=se(P);J&&x&&z==null&&(z={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(x.getPath()),op2:e.editOp(M.getPath(),J,y(P),!0)});let _e=0,Oe=0;const ce=s.advancer(T,(ee,Ce)=>c(Ce)?_e-ee-1:ee-_e,(ee,Ce)=>{c(Ce)&&_e++}),L=s.advancer(m);for(const ee of M)if(typeof ee=="number"){const Ce=ee-Oe,Te=ce(Ce);Oe+=+g(L(Ce+_e),Te,M,U,x)}else{const Ce=ce(ee);g(L(ee),Ce,M,U,x)}return ce.end(),L.end(),Q}(Ge,et,et.clone(),null,null),B.map(g=>g&&g.get()),z)return{ok:!1,conflict:z};Re.map(g=>!!g);const ct=[];let at=null;(function g(m,T,M,U,x){let P=!1;const I=a(T);if(c(I)){const ce=I.p;ce!=null?(M=B[ce],U=ze[ce]=s.writeCursor(),P=!0,x=null):(M=null,x=T.clone())}else h(a(M))&&(M=null);const Q=m.getComponent();if(Q){const ce=Q.p;ce!=null?(x&&(be[ce]=x),ct[ce]=x||q===1&&P?null:U.getComponent(),Y[ce]=m.clone(),M&&(me[ce]=M.clone())):Q.r!==void 0&&(x||U.write("r",!0),(x||P)&&(at==null&&(at=new Set),at.add(Q)))}let pe=0,J=0;const _e=s.advancer(T,void 0,(ce,L)=>{c(L)&&pe++}),Oe=s.advancer(M,(ce,L)=>h(L)?~(ce-J):ce-J,(ce,L)=>{h(L)&&J++});if(m)for(const ce of m)if(typeof ce=="string"){const L=_e(ce),ee=Oe(ce);U.descend(ce),g(m,L,ee,U,x),U.ascend()}else{const L=_e(ce),ee=ce-pe,Ce=c(a(L))?null:Oe(ee),Te=ee+J;o(Te>=0),U.descend(Te),g(m,L,Ce,U,x),U.ascend()}_e.end(),Oe.end()})(Ge,et,et.clone(),Ve,null),Ve.reset();let xt=[];if(function g(m,T,M,U,x,P){o(T);const I=T.getComponent();let Q=a(U),pe=!1;const J=(ve,Se,Me)=>ve?e.moveOp(ve.getPath(),Se.getPath()):e.insertOp(Se.getPath(),Me.i);if(h(I)){const ve=I.d;ve!=null&&(ue[ve]=T.clone());const Se=ve!=null?ct[ve]:null;let Me=!1;if(I.i!==void 0||ve!=null&&Se){let ne;Q&&(Q.i!==void 0||(ne=Q.d)!=null&&!X[ne])&&(Me=ne!=null?ve!=null&&ve===Ue[ne]:n.default(Q.i,I.i),Me||ne!=null&&q!==1&&Ue[ne]!=null||z==null&&(z={type:i.ConflictType.DROP_COLLISION,op1:J(ve!=null?Y[ve]:null,T,I),op2:J(ne!=null?ae[ne]:null,U,Q)})),Me||(P?z==null&&(z={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:J(ve!=null?Y[ve]:null,T,I),op2:e.removeOp(P.getPath())}):(ve!=null?(xt[Et]=ve,x.write("d",Se.p=Et++)):x.write("i",r.default(I.i)),pe=!0))}else if(ve!=null&&!Se){const ne=be[ve];ne&&(P=ne.clone())}ve!=null?(m=Y[ve],M=oe[ve],U=me[ve]):I.i!==void 0&&(m=M=null,Me||(U=null))}else c(a(m))&&(m=M=U=null);const _e=a(m),Oe=a(M);if(c(Oe)){const ve=Oe.p;Oe.r!==void 0&&(!_e||_e.r===void 0)||X[ve]?(U=null,P=M.clone()):ve!=null&&(U=B[ve],q!==1&&Ue[ve]!=null||((x=He[ve])||(x=He[ve]=s.writeCursor()),x.reset(),P=null))}else!h(I)&&h(Q)&&(U=null);Q=U!=null?U.getComponent():null;const ce=se(I);if(ce){const ve=y(I);if(P)z==null&&(z={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.editOp(T.getPath(),ce,ve,!0),op2:e.removeOp(P.getPath())});else{const Se=se(Q);let Me;if(Se){if(ce!==Se)throw Error("Transforming incompatible types");const ne=y(Q);Me=ce.transform(ve,ne,K)}else Me=r.default(ve);A(x,ce,Me)}}let L=0,ee=0,Ce=0,Te=0,Pe=0,ke=0,We=m!=null&&m.descendFirst(),dt=We;const gt=s.advancer(M,void 0,(ve,Se)=>{c(Se)&&Ce++});let Ee=U!=null&&U.descendFirst(),Qe=Ee;for(const ve of T)if(typeof ve=="number"){let Se;const Me=h(T.getComponent()),ne=ve-ee;{let Ht;for(;We&&typeof(Ht=m.getKey())=="number";){Ht+=L;const St=m.getComponent(),dn=c(St);if(Ht>ne||Ht===ne&&(!dn||q===0&&Me))break;if(dn){L--;const Qt=St.p;Ue.includes(Qt),St.d,a(He[St.d]),c(a(He[St.d])),(St.r===void 0||at&&at.has(St))&&(Qt==null||!ct[Qt]||q!==1&&Ue.includes(Qt))||Pe--}We=m.nextSibling()}Se=We&&Ht===ne?m:null}const lt=ne-L;let Be=gt(lt);const Nt=lt-Ce;let fr=null;{let Ht,St;for(;Ee&&typeof(Ht=U.getKey())=="number";){St=Ht-Te;const dn=U.getComponent(),Qt=h(dn);if(St>Nt)break;if(St===Nt){if(!Qt){fr=U;break}{if(q===0&&Me){fr=U;break}const jt=Be&&c(Be.getComponent());if(q===0&&jt)break}}if(Qt){const jt=dn.d;X[jt],Ue[jt],dn.i===void 0&&(X[jt]||Ue[jt]!=null&&q!==1)?(X[jt]||Ue[jt]!=null&&q===0)&&(Te++,ke--):Te++}Ee=U.nextSibling()}}const Ti=Nt+Te+Pe+ke;o(Ti>=0,"trying to descend to a negative index"),x.descend(Ti),Me&&(Se=Be=fr=null,ee++),g(Se,T,Be,fr,x,P)&&ke++,x.ascend()}else{let Se;for(;We&&(Se=m.getKey(),typeof Se!="string"||!(Se>ve||Se===ve));)We=m.nextSibling();const Me=We&&Se===ve?m:null,ne=gt(ve);let lt;for(;Ee&&(lt=U.getKey(),typeof lt!="string"||!(lt>ve||lt===ve));)Ee=U.nextSibling();const Be=Ee&&lt===ve?U:null;x.descend(ve),g(Me,T,ne,Be,x,P),x.ascend()}return gt.end(),dt&&m.ascend(),Qe&&U.ascend(),pe}(Ge,Ge.clone(),et,et.clone(),Ve,null),z)return{ok:!1,conflict:z};Ve.reset();const Fe=(g,m,T)=>g.traverse(m,(M,U)=>{M.d!=null&&T(M.d,g,U)});(X.length||ze.length)&&(Fe(et,Ve,(g,m,T)=>{X[g]&&!Re[g]&&T.write("r",!0),ze[g]&&T.mergeTree(ze[g].get())}),Ve.reset());const ht=[],E=[];if((He.length||X.length)&&!z){const g=s.readCursor($(Ve.get()));if(Fe(g,null,(m,T)=>{ht[m]=T.clone()}),He.forEach(m=>{m&&Fe(s.readCursor(m.get()),null,(T,M)=>{ht[T]=M.clone()})}),function m(T,M,U,x,P,I){const Q=a(M);if(Q&&c(Q))if(Q.p!=null){const L=Q.p;ht[L].getPath(),U=ht[L],x=E[L]=s.writeCursor()}else Q.r!==void 0&&(U=null);else h(a(U))&&(U=null);const pe=T.getComponent();if(pe){let L;if((L=pe.d)!=null){const ee=He[L];ee&&(ee.get(),x.mergeTree(ee.get()),U=s.readCursor(ee.get()))}}let J=0,_e=0;const Oe=s.advancer(M,void 0,(L,ee)=>{c(ee)&&J--}),ce=s.advancer(U,(L,ee)=>h(ee)?-(L-_e)-1:L-_e,(L,ee)=>{h(ee)&&_e++});for(const L of T)if(typeof L=="number"){const ee=Oe(L),Ce=L+J,Te=ce(Ce),Pe=Ce+_e;x.descend(Pe),m(T,ee,Te,x),x.ascend()}else x.descend(L),m(T,Oe(L),ce(L),x),x.ascend();Oe.end(),ce.end()}(et,g,g.clone(),Ve),Ve.reset(),z)return{ok:!1,conflict:z};if(Ve.get(),E.length){const m=E.map(M=>M?M.get():null),T=s.readCursor($(Ve.get()));if(Fe(T,Ve,(M,U,x)=>{const P=m[M];P&&(x.mergeTree(P),m[M]=null)}),m.find(M=>M)){const M=s.writeCursor(),U=s.writeCursor();let x=0,P=0;m.forEach(I=>{I!=null&&Fe(s.readCursor(I),null,Q=>{const pe=xt[Q];M.writeMove(Y[pe].getPath(),ue[pe].getPath(),x++);const J=qe[pe];J&&J.forEach(_e=>{X[_e]||q!==1&&Ue[_e]!=null||U.writeMove(ae[_e].getPath(),B[_e].getPath(),P++)})})}),z={type:i.ConflictType.BLACKHOLE,op1:M.get(),op2:U.get()}}}}return z?{ok:!1,conflict:z}:{ok:!0,result:Ve.get()}}const ie=S=>{const F=new Error("Transform detected write conflict");throw F.conflict=S,F.type=F.name="writeConflict",F};function de(S,F,K){const q=V(S,F,K);if(q.ok)return q.result;ie(q.conflict)}const ge=S=>{const F=s.writeCursor();return s.readCursor(S).traverse(F,(K,q)=>{(h(K)||se(K))&&q.write("r",!0)}),F.get()},ye=(S,F)=>{const{type:K,op1:q,op2:z}=S;switch(K){case i.ConflictType.DROP_COLLISION:return F==="left"?[null,ge(z)]:[ge(q),null];case i.ConflictType.RM_UNEXPECTED_CONTENT:let Y=!1;return s.readCursor(q).traverse(null,ue=>{ue.r!==void 0&&(Y=!0)}),Y?[null,ge(z)]:[ge(q),null];case i.ConflictType.BLACKHOLE:return[ge(q),ge(z)];default:throw Error("Unrecognised conflict: "+K)}};function Ae(S,F,K,q){let z=null;for(;;){const Y=V(F,K,q);if(Y.ok)return v(z,Y.result);{const{conflict:ue}=Y;S(ue)||ie(ue);const[ae,B]=ye(ue,q);F=v(le(F),ae),K=v(le(K),B),z=v(z,B)}}}}(Un)),Un}var Io;function f_(){return Io||(Io=1,function(e){var t=en&&en.__createBinding||(Object.create?function(i,o,a,l){l===void 0&&(l=a),Object.defineProperty(i,l,{enumerable:!0,get:function(){return o[a]}})}:function(i,o,a,l){l===void 0&&(l=a),i[l]=o[a]}),n=en&&en.__exportStar||function(i,o){for(var a in i)a!=="default"&&!o.hasOwnProperty(a)&&t(o,i,a)};Object.defineProperty(e,"__esModule",{value:!0}),n(d_(),e);var r=xl();Object.defineProperty(e,"ReadCursor",{enumerable:!0,get:function(){return r.ReadCursor}}),Object.defineProperty(e,"WriteCursor",{enumerable:!0,get:function(){return r.WriteCursor}});var s=Ul();Object.defineProperty(e,"ConflictType",{enumerable:!0,get:function(){return s.ConflictType}})}(en)),en}var mt=f_();const g_=pt(mt),m_=Qu({__proto__:null,default:g_},[mt]);var he=(e=>(e.RETAIN="r",e.INSERT="i",e.DELETE="d",e))(he||{});function ur(e,t=!1){const n=[];for(const r of e){const{st:s,ed:i,ts:o}=r;if(r.sId===void 0&&delete r.sId,s===i||!t&&re.isEmptyObject(o)&&r.sId==null)continue;if(n.length===0){n.push(r);continue}const a=n.pop();Ia(r,a)&&re.hasIntersectionBetweenTwoRanges(a.st,a.ed,r.st,r.ed)?n.push({...r,st:a.st,ed:i}):n.push(a,r)}return n}function Pl(e,t,n,r){var u;const{textRuns:s}=e;if(s==null)return;const i=[],o=s.length;let a=!1;const l=(u=t.textRuns)!=null?u:[];if(l.length)for(const c of l)c.st+=r,c.ed+=r;for(let c=0;c<o;c++){const h=s[c],{st:d,ed:f}=h;if(f<=r)i.push(h);else if(r>d&&r<f){a=!0;const p={...h,ed:r};i.push(p),l.length&&i.push(...l);const R={...h,st:r+n,ed:f+n};i.push(R)}else h.st+=n,h.ed+=n,a||(a=!0,i.push(...l)),i.push(h)}a||(a=!0,i.push(...l)),e.textRuns=ur(i)}function kl(e,t,n,r){const{paragraphs:s}=e;if(s==null)return;const{paragraphs:i}=t,o=[];for(let l=0,u=s.length;l<u;l++){const c=s[l],{startIndex:h}=c;h>=r&&(c.startIndex+=n),o.push(c.startIndex)}let a=-1;if(i){for(let l=0,u=i.length;l<u;l++){const c=i[l];c.startIndex+=r;const h=c.startIndex;a=o.indexOf(h)}a!==-1&&s.splice(a,1),s.push(...i),s.sort(ar("startIndex"))}}function Fl(e,t,n,r){const{sectionBreaks:s}=e;if(s==null)return;for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:u}=l;u>=r&&(l.startIndex+=n)}const i=t.sectionBreaks;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=r}s.push(...i),s.sort(ar("startIndex"))}}function $l(e,t,n,r){const{customBlocks:s=[]}=e;for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:u}=l;u>=r&&(l.startIndex+=n)}const i=t.customBlocks;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=r}s.push(...i),s.sort(ar("startIndex"))}s.length&&!e.customBlocks&&(e.customBlocks=s)}function Bl(e,t,n,r){const{tables:s}=e;if(s==null)return;for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:u,endIndex:c}=l;u>r?(l.startIndex+=n,l.endIndex+=n):c>r&&(l.endIndex+=n)}const i=t.tables;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=r,l.endIndex+=r}s.push(...i),s.sort(ar("startIndex"))}}const Hl="$",So=e=>e.split(Hl)[0];function mi(e){if(e.length<=1)return e;e.sort((s,i)=>s.startIndex-i.startIndex);const t=[];let n={...e[0]};n.rangeId=So(n.rangeId);for(let s=1;s<e.length;s++){const i=e[s];i.rangeId=So(i.rangeId),i.rangeId===n.rangeId&&Ll(n.properties,i.properties)&&n.endIndex+1>=i.startIndex?n.endIndex=i.endIndex:(t.push(n),n={...i})}t.push(n);const r=Object.create(null);for(let s=0,i=t.length;s<i;s++){const o=t[s],a=o.rangeId;r[a]?(o.rangeId=`${a}${Hl}${r[a]}`,r[a]=r[a]+1):r[a]=1}return t}function Bs(e,t){const n=e.findIndex(s=>s.startIndex<t&&s.endIndex>=t),r=e[n];r&&e.splice(n,1,{rangeId:r.rangeId,rangeType:r.rangeType,startIndex:r.startIndex,endIndex:t-1,properties:{...r.properties}},{rangeId:r.rangeId,rangeType:r.rangeType,startIndex:t,endIndex:r.endIndex,properties:{...r.properties}})}function jl(e){if(e.length<=1)return e;e.sort((r,s)=>r.startIndex-s.startIndex);const t=[];let n={...e[0]};for(let r=1;r<e.length;r++){const s=e[r];s.id===n.id&&n.endIndex+1>=s.startIndex?n.endIndex=s.endIndex:(t.push(n),n={...s})}return t.push(n),t}function Hs(e,t){e.filter(r=>r.startIndex<t&&r.endIndex>=t).forEach(r=>{const s=e.indexOf(r);e.splice(s,1,{id:r.id,type:r.type,startIndex:r.startIndex,endIndex:t-1},{id:r.id,type:r.type,startIndex:t,endIndex:r.endIndex})})}function __(e,t,n,r){e.customRanges||(e.customRanges=[]);const{customRanges:s}=e;Bs(s,r);for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:u}=l;u>=r&&(l.startIndex+=n,l.endIndex+=n)}const i=[];if(t.customRanges){for(let o=0,a=t.customRanges.length;o<a;o++){const l=t.customRanges[o];l.startIndex+=r,l.endIndex+=r,i.push(l)}s.push(...i)}e.customRanges=mi(s)}function p_(e,t,n,r){e.customDecorations||(e.customDecorations=[]);const{customDecorations:s}=e;Hs(s,r);for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:u}=l;u>=r&&(l.startIndex+=n,l.endIndex+=n)}const i=[];if(t.customDecorations){for(let o=0,a=t.customDecorations.length;o<a;o++){const l=t.customDecorations[o];l.startIndex+=r,l.endIndex+=r,i.push(l)}s.push(...i)}e.customDecorations=jl(s)}function Wl(e,t,n){const{textRuns:r}=e,s=n,i=n+t,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{st:h,ed:d}=c;if(s<=h&&i>=d){o.push({...c,st:h-s,ed:d-s});continue}else h<=s&&d>=i?(o.push({...c,st:s-s,ed:i-s}),c.ed-=t):s>=h&&s<d?(o.push({...c,st:s-s,ed:d-s}),c.ed=s):i>h&&i<=d?(o.push({...c,st:h-s,ed:i-s}),c.st=i-t,c.ed-=t):h>=i&&(c.st-=t,c.ed-=t);a.push(c)}e.textRuns=a}return o.length===0&&o.push({st:0,ed:t,ts:{}}),o}function Yl(e,t,n){const{paragraphs:r}=e,s=n,i=n+t,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{startIndex:h}=c;if(h>=s&&h<i){o.push({...c,startIndex:h-n});continue}else h>=i&&(c.startIndex-=t);a.push(c)}e.paragraphs=a}return o}function zl(e,t,n){const{sectionBreaks:r}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{startIndex:h}=c;if(h>=s&&h<=i){o.push({...c,startIndex:h-n});continue}else h>i&&(c.startIndex-=t);a.push(c)}e.sectionBreaks=a}return o}function Gl(e,t,n){const{customBlocks:r=[]}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{startIndex:h}=c;if(h>=s&&h<=i){o.push({...c,startIndex:h-n});continue}else h>i&&(c.startIndex-=t);a.push(c)}e.customBlocks=a}return r.length&&!e.customBlocks&&(e.customBlocks=r),o}function Vl(e,t,n){const{tables:r}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{startIndex:h,endIndex:d}=c;if(s<=h&&i>=d){o.push({...c,startIndex:h-n,endIndex:d-n});continue}else if(h<=s&&d>=i){const f=Zr(h,d,s,i);if(f.length===0||(c.startIndex=f[0],c.endIndex=f[1],c.startIndex===c.endIndex))continue}else i<h&&(c.startIndex-=t,c.endIndex-=t);a.push(c)}e.tables=a}return o}function E_(e,t,n){const{customRanges:r}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{startIndex:h,endIndex:d}=c;if(h>=s&&d<=i){o.push(c);continue}else if(Math.max(s,h)<=Math.min(i,d)){const f=Zr(h,d,s,i);if(f.length===0)continue;c.startIndex=f[0],c.endIndex=f[1]}else i<h&&(c.startIndex-=t,c.endIndex-=t);a.push(c)}e.customRanges=mi(a)}return o}function C_(e,t,n,r=!0){const{customDecorations:s}=e,i=n,o=n+t-1,a=[];if(s){const l=[];for(let u=0,c=s.length;u<c;u++){const h=s[u],{startIndex:d,endIndex:f}=h;if(d>=i&&f<=o){a.push(h);continue}else if(Math.max(i,d)<=Math.min(o,f)){const p=Zr(d,f,i,o);if(p.length===0)continue;h.startIndex=p[0],h.endIndex=p[1]}else o<d&&r&&(h.startIndex-=t,h.endIndex-=t);l.push(h)}e.customDecorations=l}return a}var Kl=(e=>(e.ORDER_LIST_QUICK_1="1.",e.ORDER_LIST_QUICK_2="a)",e.ORDER_LIST_QUICK_3="a.",e.ORDER_LIST_QUICK_4="i.",e.ORDER_LIST_QUICK_5="A.",e.ORDER_LIST_QUICK_6="I.",e.ORDER_LIST_QUICK_7="01.",e.BULLET_LIST="*",e))(Kl||{}),Lt=(e=>(e.BULLET_LIST="BULLET_LIST",e.BULLET_LIST_1="BULLET_LIST_1",e.BULLET_LIST_2="BULLET_LIST_2",e.BULLET_LIST_3="BULLET_LIST_3",e.BULLET_LIST_4="BULLET_LIST_4",e.BULLET_LIST_5="BULLET_LIST_5",e.ORDER_LIST="ORDER_LIST",e.ORDER_LIST_1="ORDER_LIST_1",e.ORDER_LIST_2="ORDER_LIST_2",e.ORDER_LIST_3="ORDER_LIST_3",e.ORDER_LIST_4="ORDER_LIST_4",e.ORDER_LIST_5="ORDER_LIST_5",e.ORDER_LIST_QUICK_2="ORDER_LIST_QUICK_2",e.ORDER_LIST_QUICK_3="ORDER_LIST_QUICK_3",e.ORDER_LIST_QUICK_4="ORDER_LIST_QUICK_4",e.ORDER_LIST_QUICK_5="ORDER_LIST_QUICK_5",e.ORDER_LIST_QUICK_6="ORDER_LIST_QUICK_6",e.CHECK_LIST="CHECK_LIST",e.CHECK_LIST_CHECKED="CHECK_LIST_CHECKED",e))(Lt||{});const vr={"a)":{glyphFormat:"%1)",glyphType:Ne.DECIMAL},"1.":{glyphType:Ne.DECIMAL},"a.":{glyphFormat:"%1.",glyphType:Ne.LOWER_LETTER},"A.":{glyphType:Ne.UPPER_LETTER},"i.":{glyphFormat:"%1.",glyphType:Ne.LOWER_ROMAN},"I.":{glyphFormat:"%1.",glyphType:Ne.UPPER_LETTER}},mn=e=>[...e,...e,...e].map((t,n)=>({glyphFormat:` %${n+1}`,glyphSymbol:t,bulletAlignment:or.START,textStyle:{fs:12},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*n}}})),_n=e=>e.map((t,n)=>({...t,bulletAlignment:or.START,textStyle:{fs:12},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*n}}})),vo=(e,t)=>new Array(9).fill(0).map((n,r)=>({glyphFormat:` %${r+1}`,glyphSymbol:e,bulletAlignment:or.START,textStyle:{fs:16},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*r},textStyle:t}})),cr={BULLET_LIST:{listType:"BULLET_LIST",nestingLevel:mn(["●","○","■"])},BULLET_LIST_1:{listType:"BULLET_LIST",nestingLevel:mn(["❖","➢","■"])},BULLET_LIST_2:{listType:"BULLET_LIST",nestingLevel:mn(["✔","●","◆"])},BULLET_LIST_3:{listType:"BULLET_LIST",nestingLevel:mn(["■","◆","○"])},BULLET_LIST_4:{listType:"BULLET_LIST",nestingLevel:mn(["✧","○","■"])},BULLET_LIST_5:{listType:"BULLET_LIST",nestingLevel:mn(["➢","○","◆"])},ORDER_LIST:{listType:"ORDER_LIST",nestingLevel:_n([{glyphFormat:"%1.",glyphType:Ne.DECIMAL},{glyphFormat:"%2.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%3.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:Ne.DECIMAL},{glyphFormat:"%5.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%6.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:Ne.DECIMAL},{glyphFormat:"%8.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%9.",glyphType:Ne.LOWER_ROMAN}])},ORDER_LIST_1:{listType:"ORDER_LIST",nestingLevel:_n([{glyphFormat:"%1)",glyphType:Ne.DECIMAL},{glyphFormat:"%2)",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%3)",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%4)",glyphType:Ne.DECIMAL},{glyphFormat:"%5)",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%6)",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%7)",glyphType:Ne.DECIMAL},{glyphFormat:"%8)",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%9)",glyphType:Ne.LOWER_ROMAN}])},ORDER_LIST_2:{listType:"ORDER_LIST",nestingLevel:_n(["%1.","%1.%2.","%1.%2.%3.","%1.%2.%3.%4.","%1.%2.%3.%4.%5.","%1.%2.%3.%4.%5.%6.","%1.%2.%3.%4.%5.%6.%7."].map(e=>({glyphFormat:e,glyphType:Ne.DECIMAL})))},ORDER_LIST_3:{listType:"ORDER_LIST",nestingLevel:_n([{glyphFormat:"%1.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%2.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%3.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%5.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%6.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%8.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%9.",glyphType:Ne.LOWER_ROMAN}])},ORDER_LIST_4:{listType:"ORDER_LIST",nestingLevel:_n([{glyphFormat:"%1.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%2.",glyphType:Ne.DECIMAL},{glyphFormat:"%3.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%5.",glyphType:Ne.DECIMAL},{glyphFormat:"%6.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%8.",glyphType:Ne.DECIMAL},{glyphFormat:"%9.",glyphType:Ne.LOWER_ROMAN}])},ORDER_LIST_5:{listType:"ORDER_LIST",nestingLevel:_n([{glyphFormat:"%1.",glyphType:Ne.DECIMAL_ZERO},{glyphFormat:"%2.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%3.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:Ne.DECIMAL_ZERO},{glyphFormat:"%5.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%6.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:Ne.DECIMAL_ZERO},{glyphFormat:"%8.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%9.",glyphType:Ne.LOWER_ROMAN}])},CHECK_LIST:{listType:"CHECK_LIST",nestingLevel:vo("☐")},CHECK_LIST_CHECKED:{listType:"CHECK_LIST_CHECKED",nestingLevel:vo("☑",{st:{s:Ie.TRUE}})}},Or=e=>{const{glyphFormat:t,glyphType:n}=e,r=re.deepClone(cr.ORDER_LIST);return r.nestingLevel[0].glyphFormat=t,r.nestingLevel[0].glyphType=n,r},R_={ORDER_LIST_QUICK_2:Or(vr["a)"]),ORDER_LIST_QUICK_3:Or(vr["a."]),ORDER_LIST_QUICK_4:Or(vr["i."]),ORDER_LIST_QUICK_6:Or(vr["I."])};Object.assign(cr,R_);const I_={"1.":"ORDER_LIST","a)":"ORDER_LIST_QUICK_2","a.":"ORDER_LIST_QUICK_3","i.":"ORDER_LIST_QUICK_4","A.":"ORDER_LIST_3","I.":"ORDER_LIST_QUICK_6","01.":"ORDER_LIST_5","*":"BULLET_LIST"};function S_(e,t,n,r,s){const i=v_(e,t,n,r,s),o=O_(e,t,n,r,s),a=w_(e,t,n,r,s),l=b_(e,t,n,r,s),u=A_(e,t,n,r,s),c=T_(e,t,n,r),h=y_(e,t,n,r,s);return{dataStream:"",textRuns:i,paragraphs:o,sectionBreaks:a,customBlocks:l,tables:u,customRanges:c,customDecorations:h}}function v_(e,t,n,r,s){const{textRuns:i}=e,{textRuns:o}=t;if(i==null||o==null)return;const a=Wl(e,n,r);if(s!==xe.REPLACE){const l=Xl(o,a,s);t.textRuns=l}return Pl(e,t,n,r),a}function Xl(e,t,n){if(t.length===0)return e;e=re.deepClone(e),t=re.deepClone(t);const r=[],s=e.length,i=t.length;let o=0,a=0,l=null;function u(){return l?(r.push(l),l=null,!0):!1}for(;o<s&&a<i;){const{st:f,ed:p,ts:R}=e[o],{st:w,ed:N,ts:G,sId:W}=t[a];let se;if(n===xe.COVER?se={...G,...R}:se={...R},p<w)u()||r.push(e[o]),o++;else if(N<f)u()||r.push(t[a]),a++;else{const y={st:Math.min(f,w),ed:Math.max(f,w),ts:f<w?{...R}:{...G},sId:f<w?void 0:W};y.ed>y.st&&r.push(y),r.push({st:Math.max(f,w),ed:Math.min(p,N),ts:se,sId:W}),p<N?(o++,t[a].st=p,t[a].st===t[a].ed&&a++):(a++,e[o].st=N,e[o].st===e[o].ed&&o++);const A={st:Math.min(p,N),ed:Math.max(p,N),ts:p<N?{...G}:{...R},sId:p<N?W:void 0};l=A.ed>A.st?A:null}}u();const c=r[r.length-1],h=e[s-1],d=t[i-1];return c&&c.ed!==Math.max(h.ed,d.ed)&&(h.ed>d.ed?r.push(h):r.push(d)),ur(r)}function O_(e,t,n,r,s){const{paragraphs:i}=e,{paragraphs:o}=t;if(i==null||o==null)return;const a=Yl(e,n,r);if(s!==xe.REPLACE){const l=[];for(const u of o){const{startIndex:c,paragraphStyle:h,bullet:d}=u;let f=[];for(const p of a){const{startIndex:R,paragraphStyle:w,bullet:N}=p;let G,W;if(s===xe.COVER?(G={...w,...h},W={listId:"",listType:Lt.BULLET_LIST,nestingLevel:0,textStyle:{},...N,...d}):(G={...h,...w},W={listId:"",listType:Lt.BULLET_LIST,nestingLevel:0,textStyle:{},...d,...N}),c===R){f.push({startIndex:c,paragraphStyle:G,bullet:W});break}}l.push(...f),f=[]}t.paragraphs=l}return kl(e,t,n,r),a}function w_(e,t,n,r,s){const{sectionBreaks:i}=e,{sectionBreaks:o}=t;if(i==null||o==null)return;const a=zl(e,n,r);if(s!==xe.REPLACE){const l=[];for(const u of o){const{startIndex:c}=u;let h=[];for(const d of a){const{startIndex:f}=d;if(c===f){s===xe.COVER?h.push({...d,...u}):h.push({...u,...d});break}}l.push(...h),h=[]}t.sectionBreaks=l}return Fl(e,t,n,r),a}function b_(e,t,n,r,s){const{customBlocks:i=[]}=e,{customBlocks:o}=t;if(i==null||o==null)return;const a=Gl(e,n,r);if(s!==xe.REPLACE){const l=[];for(const u of o){const{startIndex:c}=u;let h=[];for(const d of a){const{startIndex:f}=d;if(c===f){s===xe.COVER?h.push({...d,...u}):h.push({...u,...d});break}}l.push(...h),h=[]}t.customBlocks=l}return $l(e,t,n,r),i.length&&!e.customBlocks&&(e.customBlocks=i),a}function A_(e,t,n,r,s){const{tables:i}=e,{tables:o}=t;if(i==null||o==null)return;const a=Vl(e,n,r);if(s!==xe.REPLACE){const l=[];for(const u of o){const{startIndex:c,endIndex:h}=u;let d=[];for(const f of a){const{startIndex:p,endIndex:R}=f;if(p>=c&&R<=h){s===xe.COVER?d.push({...f,...u}):d.push({...u,...f});break}}l.push(...d),d=[]}t.tables=l}return Bl(e,t,n,r),a}function T_(e,t,n,r,s){e.customRanges||(e.customRanges=[]),Bs(e.customRanges,r),Bs(e.customRanges,r+n);const i=r,o=r+n-1,{customRanges:a}=t,l=[],u=new Map;e.customRanges.forEach(h=>{const{startIndex:d,endIndex:f}=h;d>=i&&f<=o?u.set(h.rangeId,h):l.push(h)});const c=[];return a?(a.forEach(h=>{const{startIndex:d,endIndex:f}=h;l.push({...h,startIndex:d+r,endIndex:f+r})}),e.customRanges=mi(l),c):[]}function y_(e,t,n,r,s){e.customDecorations||(e.customDecorations=[]),Hs(e.customDecorations,r),Hs(e.customDecorations,r+n);const i=[],{customDecorations:o}=e,{customDecorations:a=[]}=t;if(s===xe.REPLACE){for(let l=0;l<o.length;l++){const u=o[l],{startIndex:c,endIndex:h}=u;c>=r&&h<=r+n-1&&i.push(u)}a.forEach(l=>{const{startIndex:u,endIndex:c}=l;o.push({...l,startIndex:u+r,endIndex:c+r})})}else for(const l of a){const{id:u}=l;if(l.type===rn.DELETED){const c=o.filter(h=>h.id===u);c.length&&i.push(...c)}else o.push({...l,startIndex:l.startIndex+r,endIndex:l.endIndex+r})}for(const l of i){const{id:u}=l,c=o.findIndex(h=>h.id===u);c!==-1&&o.splice(c,1)}return e.customDecorations=jl(o),i}var _i=(e=>(e[e.copy=0]="copy",e[e.cut=1]="cut",e))(_i||{});function Gr(e,t,n,r=!0){const{textRuns:s}=e;if(s){const i=[];for(const o of s){const a=re.deepClone(o),{st:l,ed:u}=a;re.hasIntersectionBetweenTwoRanges(l,u,t,n)&&(t>=l&&t<=u?i.push({...a,st:t,ed:Math.min(n,u)}):n>=l&&n<=u?i.push({...a,st:Math.max(t,l),ed:n}):i.push(a))}return ur(i.map(o=>{const{st:a,ed:l}=o;return{...o,st:a-t,ed:l-t}}))}else if(r)return[{st:0,ed:n-t,ts:{}}]}function ql(e,t,n){const{tables:r=[]}=e,s=[];for(const i of r){const o=re.deepClone(i),{startIndex:a,endIndex:l}=o;a>=t&&l<=n&&s.push({...o,startIndex:a-t,endIndex:l-t})}return s}function Jl(e,t,n){const{paragraphs:r=[]}=e,s=[];for(const i of r){const{startIndex:o}=i;if(o>=t&&o<n){const a=re.deepClone(i);s.push(a)}}if(s.length)return s.map(i=>({...i,startIndex:i.startIndex-t}))}function N_(e,t,n){const{sectionBreaks:r=[]}=e,s=[];for(const i of r){const{startIndex:o}=i;o>=t&&o<=n&&s.push(re.deepClone(i))}if(s.length)return s.map(i=>({...i,startIndex:i.startIndex-t}))}function Zl(e,t,n){const{customBlocks:r=[]}=e,s=[];for(const i of r){const{startIndex:o}=i;o>=t&&o<n&&s.push(re.deepClone(i))}if(s.length)return s.map(i=>({...i,startIndex:i.startIndex-t}))}function Tt(e,t,n,r=!0,s=1){const{dataStream:i}=e,o={dataStream:i.slice(t,n)};o.textRuns=Gr(e,t,n,r);const a=ql(e,t,n);if(a.length&&(o.tables=a),o.paragraphs=Jl(e,t,n),s===1){const u=eu(e,t,n);u?o.customDecorations=u:r&&(o.customDecorations=[])}const{customRanges:l}=Ql(e,t,n);return l?o.customRanges=l:r&&(o.customRanges=[]),o.customBlocks=Zl(e,t,n),o}function M_(e){const{dataStream:t,textRuns:n,paragraphs:r,customRanges:s,customDecorations:i,tables:o}=e;let a=0,l=0;s==null||s.forEach(c=>{c.startIndex<0&&(a=Math.max(a,-c.startIndex)),c.endIndex>t.length-1&&(l=Math.max(l,c.endIndex-t.length+1))});const u=`${t}`;return n&&(n[0]&&(n[0].st=n[0].st-a),n[n.length-1]&&(n[n.length-1].ed=n[n.length-1].ed+l)),n==null||n.forEach(c=>{c.st+=a,c.ed+=a}),r==null||r.forEach(c=>{c.startIndex+=a}),s==null||s.forEach(c=>{c.startIndex+=a,c.endIndex+=a}),i==null||i.forEach(c=>{c.startIndex+=a,c.endIndex+=l}),o==null||o.forEach(c=>{c.startIndex+=a,c.endIndex+=l}),{...e,dataStream:u,textRuns:n,paragraphs:r,customRanges:s,customDecorations:i,tables:o}}function Ql(e,t,n){if(e.customRanges==null)return{};const{customRanges:r}=e;return{customRanges:r.filter(a=>Math.max(a.startIndex,t)<=Math.min(a.endIndex,n-1)).map(a=>({...a,startIndex:Math.max(a.startIndex,t),endIndex:Math.min(a.endIndex,n-1)})).map(a=>({...a,startIndex:a.startIndex-t,endIndex:a.endIndex-t})),leftOffset:0,rightOffset:0}}function eu(e,t,n){if(e.customDecorations==null)return;const{customDecorations:r=[]}=e,s=[];return r.forEach(i=>{if(Math.max(i.startIndex,t)<=Math.min(i.endIndex,n-1)){const o=re.deepClone(i);s.push({...o,startIndex:Math.max(o.startIndex-t,0),endIndex:Math.min(o.endIndex,n-1)-t})}}),s}function D_(e,t,n){return e==null||t==null?e!=null?e:t:Xl(e,t,n)}function L_(e,t,n){if(e==null||t==null)return e!=null?e:t;if(t.length===0||e.length===0)return e;if(t.length>1||e.length>1)throw new Error("Cannot cover multiple customRanges");return n===xe.REPLACE?[{...e[0]}]:[{...t[0],...e[0]}]}function x_(e,t,n){return t.length===0||e.length===0||n===xe.REPLACE?e:[...e,...t.filter(r=>!e.some(s=>r.id===s.id))]}function js(e,t,n=xe.COVER){if(t.dataStream!=="")throw new Error("Cannot compose other body with non-empty dataStream");const r={dataStream:e.dataStream},{textRuns:s,paragraphs:i=[],customRanges:o,customDecorations:a=[]}=e,{textRuns:l,paragraphs:u=[],customRanges:c,customDecorations:h=[]}=t;r.textRuns=D_(l,s,n),r.customRanges=L_(c,o,n);const d=x_(h,a,n);d.length&&(r.customDecorations=d);const f=[];let p=0,R=0;for(;p<i.length&&R<u.length;){const w=i[p],N=u[R],{startIndex:G}=w,{startIndex:W}=N;G===W?(f.push(re.deepMerge(w,N)),p++,R++):G<W?(f.push(re.deepClone(w)),p++):(f.push(re.deepClone(N)),R++)}return p<i.length&&f.push(...i.slice(p)),R<u.length&&f.push(...u.slice(R)),f.length&&(r.paragraphs=f),r}function U_(e){const{body:t}=e;if(t==null)return!0;const{textRuns:n,paragraphs:r,customRanges:s,customBlocks:i,customDecorations:o,tables:a}=t;return n==null&&r==null&&s==null&&i==null&&o==null&&a==null}class En{constructor(t){C(this,"_index",0);C(this,"_offset",0);this._actions=t}hasNext(){return this.peekLength()<Number.POSITIVE_INFINITY}next(t){t||(t=Number.POSITIVE_INFINITY);const n=this._actions[this._index];if(n){const r=this._offset,s=n.len;return t>=s-r?(t=s-r,this._index+=1,this._offset=0):this._offset+=t,n.t===he.DELETE||n.t===he.RETAIN&&n.body==null?re.deepClone({...n,len:t}):re.deepClone({...n,len:t,body:Tt(n.body,r,r+t,!1)})}else return{t:he.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 t=this._actions[this._index];return t?t.t:he.RETAIN}rest(){if(this.hasNext()){if(this._offset===0)return this._actions.slice(this._index);{const t=this._offset,n=this._index,r=this.next(),s=this._actions.slice(this._index);return this._offset=t,this._index=n,[r].concat(s)}}else return[]}}class hn{constructor(){C(this,"cursor",0)}reset(){return this.cursor=0,this}moveCursor(t){this.cursor+=t}moveCursorTo(t){this.cursor=t}}function tu(e,t,n){const{dataStream:r}=e,s=n,i=n+t,o=Wl(e,t,n),a=Yl(e,t,n),l=zl(e,t,n),u=Gl(e,t,n),c=Vl(e,t,n),h=E_(e,t,n),d=C_(e,t,n);let f="";return r&&(e.dataStream=Oa(r,s,i),f=r.slice(s,i)),{dataStream:f,textRuns:o,paragraphs:a,sectionBreaks:l,customBlocks:u,tables:c,customRanges:h,customDecorations:d}}function nu(e,t,n,r){e.dataStream=va(e.dataStream,r,t.dataStream),Pl(e,t,n,r),kl(e,t,n,r),Fl(e,t,n,r),$l(e,t,n,r),Bl(e,t,n,r),__(e,t,n,r),p_(e,t,n,r)}function P_(e,t,n,r,s=xe.COVER){return S_(e,t,n,r,s)}function k_(e,t,n){return t<=0?{dataStream:""}:tu(e,t,n)}function F_(e,t,n,r){n!==0&&nu(e,t,n,r)}function $_(e,t){const n=new hn;return n.reset(),t.forEach(r=>{const s=re.deepClone(r);switch(s.t){case he.RETAIN:{const{coverType:i,body:o,len:a}=s;o!=null&&P_(e,o,a,n.cursor,i),n.moveCursor(a);break}case he.INSERT:{const{body:i,len:o}=s;F_(e,i,o,n.cursor),n.moveCursor(o);break}case he.DELETE:{const{len:i}=s;k_(e,i,n.cursor);break}default:throw new Error(`Unknown action type for action: ${s}.`)}}),e}function B_(e,t,n,r,s){if(e==null||t==null)return t;if(e.length===0||t.length===0)return[];t=re.deepClone(t),e=re.deepClone(e);const i=[],o=t.length,a=e.length;let l=0,u=0,c=null;function h(){return c?(i.push(c),c=null,!0):!1}for(;l<o&&u<a;){const{st:R,ed:w,ts:N}=t[l],{st:G,ed:W,ts:se,sId:y}=e[u];let A={};if(s===0)A={...N},n===xe.COVER&&r===xe.REPLACE&&se&&(A=Object.assign({},se,A));else if(A={...N},n===xe.REPLACE){if(r===xe.REPLACE)A={...se};else if(N&&se){const j=Object.keys(N);for(const Z of j)se[Z]&&delete A[Z]}}else if(r===xe.REPLACE){if(se){const j=Object.keys(se);for(const Z of j)se[Z]!==void 0&&(A[Z]=se[Z])}}else if(se){const j=Object.keys(se);for(const Z of j)A[Z]!==void 0&&delete A[Z]}if(w<G)h()||i.push(t[l]),l++;else if(W<R)h()||i.push(e[u]),u++;else{const j={st:Math.min(R,G),ed:Math.max(R,G),ts:R<G?{...N}:{...se}};j.ed>j.st&&i.push(),i.push({st:Math.max(R,G),ed:Math.min(w,W),ts:A,sId:y}),w<W?(l++,e[u].st=w,e[u].st===e[u].ed&&u++):(u++,t[l].st=W,t[l].st===t[l].ed&&l++);const Z={st:Math.min(w,W),ed:Math.max(w,W),ts:w<W?{...se}:{...N},sId:w<W?y:void 0};c=Z.ed>Z.st?Z:null}}h();const d=i[i.length-1],f=t[o-1],p=e[a-1];return d.ed!==Math.max(f.ed,p.ed)&&(f.ed>p.ed?i.push(f):i.push(p)),ur(i,!0)}function H_(e,t,n,r,s){if(e==null||t==null)return t;if(e.length===0||t.length===0)return[];if(e.length>1||t.length>1)throw new Error("CustomRanges is only supported transform for length one now.");const i=e[0],o=t[0];if(n===xe.REPLACE)return s===1?[re.deepClone(i)]:[re.deepClone(o)];if(r===xe.REPLACE){const a=re.deepClone(o);return s===1&&Object.assign(a,re.deepClone(i)),[a]}else{const a=re.deepClone(o);return s===1&&Object.assign(a,re.deepClone(i)),[a]}}function Oo(e,t,n,r,s){const i={startIndex:t.startIndex};if(t.paragraphStyle&&(i.paragraphStyle=re.deepClone(t.paragraphStyle),e.paragraphStyle)){if(n===xe.REPLACE)if(r===xe.REPLACE)s===1&&(i.paragraphStyle={...e.paragraphStyle});else if(s===1){const o=Object.keys(e.paragraphStyle);for(const a of o)e.paragraphStyle[a]!==void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else{const o=Object.keys(e.paragraphStyle);for(const a of o)i.paragraphStyle[a]===void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else if(r===xe.REPLACE)if(s===1){const o=Object.keys(e.paragraphStyle);for(const a of o)e.paragraphStyle[a]!==void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else{const o=Object.keys(e.paragraphStyle);for(const a of o)i.paragraphStyle[a]===void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else if(s===1){const o=Object.keys(e.paragraphStyle);for(const a of o)i.paragraphStyle[a]&&delete i.paragraphStyle[a]}}return n===xe.REPLACE&&r===xe.REPLACE?i.bullet=s===1?re.deepClone(e.bullet):re.deepClone(t.bullet):e.bullet===void 0?i.bullet=re.deepClone(t.bullet):n===xe.REPLACE||r===xe.REPLACE?i.bullet=s===0&&t.bullet?re.deepClone(t.bullet):re.deepClone(e.bullet):s===0&&t.bullet!==void 0&&(i.bullet=re.deepClone(t.bullet)),i}function j_(e,t){if(e==null||t==null)return t;if(e.length===0||t.length===0)return re.deepClone(t);const n=[];for(const r of t){const{id:s,type:i}=r;let o=!1;for(const a of e)if(a.id===s){(a.type===rn.DELETED||i===rn.DELETED)&&(o=!0,n.push({...r,type:rn.DELETED}));break}o||n.push(r)}return n}function W_(e,t,n=!1){const{body:r,coverType:s=xe.COVER}=e,{body:i,coverType:o=xe.COVER}=t;if(r==null||r.dataStream!==""||i==null||i.dataStream!=="")throw new Error("Data stream is not supported in retain transform.");const a={dataStream:""},l=o,{textRuns:u,paragraphs:c=[],customRanges:h,customDecorations:d}=r,{textRuns:f,paragraphs:p=[],customRanges:R,customDecorations:w}=i,N=B_(u,f,s,o,n?1:0);N&&(a.textRuns=N);const G=H_(h,R,s,o,n?1:0);G&&(a.customRanges=G);const W=j_(d,w);W&&(a.customDecorations=W);const se=[];let y=0,A=0;for(;y<c.length&&A<p.length;){const j=c[y],Z=p[A],{startIndex:fe}=j,{startIndex:le}=Z;if(fe===le){let _={startIndex:fe};n?_=Oo(j,Z,s,o,1):_=Oo(j,Z,s,o,0),se.push(_),y++,A++}else fe<le?y++:(se.push(re.deepClone(Z)),A++)}return A<p.length&&se.push(...p.slice(A)),se.length&&(a.paragraphs=se),{coverType:l,body:a}}function wo(e){return Object.keys(e).length===1}const On=class On{constructor(){C(this,"_actions",[])}static apply(t,n){return $_(t,n)}static compose(t,n){const r=new En(t),s=new En(n),i=new On;for(;r.hasNext()||s.hasNext();)if(s.peekType()===he.INSERT)i.push(s.next());else if(r.peekType()===he.DELETE)i.push(r.next());else{const o=Math.min(r.peekLength(),s.peekLength()),a=r.next(o),l=s.next(o);if(a.t===he.INSERT&&l.t===he.RETAIN)l.body==null?i.push(a):i.push({...a,body:js(a.body,l.body,l.coverType)});else if(a.t===he.RETAIN&&l.t===he.RETAIN)if(a.body==null&&l.body==null)i.push(a.len!==Number.POSITIVE_INFINITY?a:l);else if(a.body&&l.body){const u=a.coverType===xe.REPLACE||l.coverType===xe.REPLACE?xe.REPLACE:xe.COVER;i.push({...a,t:he.RETAIN,coverType:u,body:js(a.body,l.body,l.coverType)})}else i.push(a.body?a:l);else a.t===he.RETAIN&&l.t===he.DELETE?i.push(l):a.t===he.INSERT&&(l.t,he.DELETE)}return i.trimEndUselessRetainAction(),i.serialize()}static transform(t,n,r="right"){return this._transform(n,t,r==="left"?"right":"left")}static _transform(t,n,r="right"){const s=new En(t),i=new En(n),o=new On;for(;s.hasNext()||i.hasNext();)if(s.peekType()===he.INSERT&&(r==="left"||i.peekType()!==he.INSERT)){const a=s.next();o.retain(a.len)}else if(i.peekType()===he.INSERT)o.push(i.next());else{const a=Math.min(s.peekLength(),i.peekLength()),l=s.next(a),u=i.next(a);if(l.t===he.DELETE)continue;if(u.t===he.DELETE){o.push(u);continue}if(l.body==null||u.body==null)o.push(u);else{const{coverType:c,body:h}=W_(l,u,r==="left");o.push({...u,t:he.RETAIN,coverType:c,body:h})}}return o.trimEndUselessRetainAction(),o.serialize()}static transformPosition(t,n,r=!1){const s=new En(t);let i=0;for(;s.hasNext()&&i<=n;){const o=s.peekLength(),a=s.peekType();if(s.next(),a===he.DELETE){n-=Math.min(o,n-i);continue}else a===he.INSERT&&(i<n||!r)&&(n+=o);i+=o}return n}static isNoop(t){return t.length===0}static invert(t){const n=[];for(const r of t)if(r.t===he.INSERT)n.push({t:he.DELETE,len:r.len,body:r.body});else if(r.t===he.DELETE){if(r.body==null)throw new Error("Can not invert DELETE action without body property, makeInvertible must be called first.");n.push({t:he.INSERT,body:r.body,len:r.len})}else if(r.body!=null){if(r.oldBody==null)throw new Error("Can not invert RETAIN action without oldBody property, makeInvertible must be called first.");n.push({t:he.RETAIN,body:r.oldBody,oldBody:r.body,len:r.len,coverType:xe.REPLACE})}else n.push(r);return n}static makeInvertible(t,n){const r=[];let s=0;for(const i of t){if(i.t===he.DELETE&&(i.body==null||i.body&&i.body.dataStream.length!==i.len)){const o=Tt(n,s,s+i.len,!1);i.len=o.dataStream.length,i.body=o}if(i.t===he.RETAIN&&i.body!=null){const o=Tt(n,s,s+i.len,!0);i.oldBody={...o,dataStream:""},i.len=o.dataStream.length}r.push(i),i.t!==he.INSERT&&(s+=i.len)}return r}insert(t,n){const r={t:he.INSERT,body:n,len:t};return this.push(r),this}retain(t,n,r){const s={t:he.RETAIN,len:t};return n!=null&&(s.body=n),r!=null&&(s.coverType=r),this.push(s),this}delete(t){const n={t:he.DELETE,len:t};return this.push(n),this}empty(){return this._actions=[],this}serialize(){return this._actions}push(...t){if(t.length>1){for(const i of t)this.push(i);return this}let n=this._actions.length,r=this._actions[n-1];const s=re.deepClone(t[0]);if(s.t===he.RETAIN&&s.len===0&&s.body==null)return this;if(typeof r=="object"){if(r.t===he.DELETE&&s.t===he.DELETE)return r.len+=s.len,this;if(r.t===he.DELETE&&s.t===he.INSERT&&(n-=1,r=this._actions[n-1],r==null))return this._actions.unshift(s),this;if(r.t===he.RETAIN&&s.t===he.RETAIN&&r.body==null&&s.body==null)return r.len+=s.len,this;if(r.t===he.INSERT&&wo(r.body)&&s.t===he.INSERT&&wo(s.body))return r.len+=s.len,r.body.dataStream+=s.body.dataStream,this}return n===this._actions.length?this._actions.push(s):this._actions.splice(n,0,s),this}trimEndUselessRetainAction(){let t=this._actions[this._actions.length-1];for(;t&&t.t===he.RETAIN&&U_(t);)this._actions.pop(),t=this._actions[this._actions.length-1];return this}};C(On,"id","text-x"),C(On,"uri","https://github.com/dream-num/univer#text-x");let Ye=On;Object.defineProperty(Ye,"name",{value:"text-x"});const wn=class wn{static registerSubtype(t){var n;t==null||this._subTypes.has(t.name)&&((n=this._subTypes.get(t.name))==null?void 0:n.id)!==Ye.id||(this._subTypes.set(t.name,t),mt.type.registerSubtype(t))}static apply(t,n){if(!mt.type.isNoop(n))return mt.type.apply(t,n)}static compose(t,n){return mt.type.compose(t,n)}static transform(t,n,r){return mt.type.transform(t,n,r)}static transformPosition(t,n,r="right"){return t&&t.length===2&&t[0]==="body"&&t[1].et===Ye.name?Ye.transformPosition(t[1].e,n,r==="left"):n}static invertWithDoc(t,n){return mt.type.invertWithDoc(t,n)}static isNoop(t){return mt.type.isNoop(t)}static getInstance(){return this._instance==null&&(this._instance=new wn),this._instance}removeOp(t,n){return mt.removeOp(t,n)}moveOp(t,n){return mt.moveOp(t,n)}insertOp(t,n){return mt.insertOp(t,n)}replaceOp(t,n,r){return mt.replaceOp(t,n,r)}editOp(t,n=["body"]){return mt.editOp(n,Ye.name,t)}};C(wn,"uri","https://github.com/dream-num/univer#json-x"),C(wn,"_subTypes",new Map),C(wn,"_instance",null);let Ft=wn;Ft.registerSubtype(Ye);const pi={id:"default_doc",documentStyle:{}};class Y_ extends ss{constructor(n){var r;super();C(this,"type",$e.UNIVER_DOC);C(this,"_name$",new we.BehaviorSubject(""));C(this,"name$",this._name$.asObservable());C(this,"snapshot");this.snapshot={...pi,...n},this._name$.next((r=this.snapshot.title)!=null?r:"No Title")}getUnitId(){throw new Error("Method not implemented.")}getRev(){var n;return(n=this.snapshot.rev)!=null?n:1}incrementRev(){this.snapshot.rev=this.getRev()+1}setRev(n){this.snapshot.rev=n}setName(n){this.snapshot.title=n,this._name$.next(n)}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,r){this.snapshot.drawings=n,this.snapshot.drawingsOrder=r}getBody(){return this.snapshot.body}getSnapshot(){return this.snapshot}getBulletPresetList(){var s;const n=(s=this.snapshot.lists)!=null?s:{};return{...cr,...n}}updateDocumentId(n){this.snapshot.id=n}updateDocumentRenderConfig(n){const{documentStyle:r}=this.snapshot;r.renderConfig==null?r.renderConfig=n:r.renderConfig={...r.renderConfig,...n}}updateDocumentStyle(n){this.snapshot.documentStyle==null?this.snapshot.documentStyle=n:this.snapshot.documentStyle={...this.snapshot.documentStyle,...n}}updateDocumentDataMargin(n){const{t:r,l:s,b:i,r:o}=n,{documentStyle:a}=this.snapshot;r!=null&&(a.marginTop=r),s!=null&&(a.marginLeft=s),i!=null&&(a.marginBottom=i),o!=null&&(a.marginRight=o)}updateDocumentDataPageSize(n,r){const{documentStyle:s}=this.snapshot;if(!s.pageSize){n=n!=null?n:Number.POSITIVE_INFINITY,r=r!=null?r:Number.POSITIVE_INFINITY,s.pageSize={width:n,height:r};return}n!==void 0&&(s.pageSize.width=n),r!==void 0&&(s.pageSize.height=r)}updateDrawing(n,r){const{drawings:s}=this,{width:i,height:o,left:a,top:l}=r,u=s==null?void 0:s[n];if(!u)return;const c=u.docTransform;c.size.width=i,c.size.height=o,c.positionH.posOffset=a,c.positionV.posOffset=l}setZoomRatio(n=1){this.snapshot.settings==null?this.snapshot.settings={zoomRatio:n}:this.snapshot.settings.zoomRatio=1}setDisabled(n){this.snapshot.disabled=n}getDisabled(){return this.snapshot.disabled}getTitle(){return this.snapshot.title}}class yt extends Y_{constructor(n){var s,i;super(re.isEmptyObject(n)?a_():n);C(this,"_unitId");C(this,"headerModelMap",new Map);C(this,"footerModelMap",new Map);C(this,"change$",new we.BehaviorSubject(0));const r=6;this._unitId=(s=this.snapshot.id)!=null?s:re.generateRandomId(r),this._initializeHeaderFooterModel(),this._name$.next((i=this.snapshot.title)!=null?i:"")}dispose(){super.dispose(),this.headerModelMap.forEach(n=>{n.dispose()}),this.footerModelMap.forEach(n=>{n.dispose()}),this._name$.complete()}getDrawings(){return this.snapshot.drawings}getDrawingsOrder(){return this.snapshot.drawingsOrder}getCustomRanges(){var n;return(n=this.snapshot.body)==null?void 0:n.customRanges}getCustomDecorations(){var n;return(n=this.snapshot.body)==null?void 0:n.customDecorations}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={...pi,...n},this._initializeHeaderFooterModel(),this.change$.next(this.change$.value+1)}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(!Ft.isNoop(n))return this.snapshot=Ft.apply(this.snapshot,n),n!=null&&n.some(r=>Array.isArray(r)&&((r==null?void 0:r[0])==="headers"||(r==null?void 0:r[0])==="footers"))&&(this.headerModelMap.clear(),this.footerModelMap.clear(),this._initializeHeaderFooterModel()),this.change$.next(this.change$.value+1),this.snapshot}sliceBody(n,r,s=_i.copy){const i=this.getBody();if(i!=null)return Tt(i,n,r,!1,s)}_initializeHeaderFooterModel(){const{headers:n,footers:r}=this.getSnapshot();if(n)for(const s in n){const i=n[s];this.headerModelMap.set(s,new yt(i)),this.headerModelMap.get(s).updateDocumentId(this.getUnitId())}if(r)for(const s in r){const i=r[s];this.footerModelMap.set(s,new yt(i)),this.footerModelMap.get(s).updateDocumentId(this.getUnitId())}}updateDocumentId(n){super.updateDocumentId(n),this._unitId=n}getPlainText(){var n,r;return Qr((r=(n=this.getBody())==null?void 0:n.dataStream)!=null?r:"")}}function z_(e){const{ranges:t,id:n,type:r}=e,s=new Ye;let i=0;for(let o=0;o<t.length;o++){const a=t[o],{startOffset:l,endOffset:u}=a;l>0&&s.push({t:he.RETAIN,len:l-i}),s.push({t:he.RETAIN,body:{dataStream:"",customDecorations:[{id:n,type:r,startIndex:0,endIndex:u-l-1}]},len:u-l}),i=u}return s}function G_(e){var c,h,d;const{id:t,segmentId:n,documentDataModel:r}=e,s=r==null?void 0:r.getBody();if(!r||!s)return!1;const i=(d=(h=(c=r.getSelfOrHeaderFooterModel(n))==null?void 0:c.getBody())==null?void 0:h.customDecorations)==null?void 0:d.find(f=>f.id===t);if(!i)return!1;const o=new Ye,{startIndex:a,endIndex:l}=i,u=l-a+1;return o.push({t:he.RETAIN,len:a}),o.push({t:he.RETAIN,len:u,body:{dataStream:"",customDecorations:[{startIndex:0,endIndex:u-1,id:t,type:rn.DELETED}]}}),o}function ru(e,t,n,r){return e<=n&&t>=n||e>=n&&e<=r}function V_(e,t){const n=[];for(let r=0,s=t.length;r<s;r++){const i=t[r];e.collapsed?i.startIndex<e.startOffset&&e.startOffset<=i.endIndex&&n.push(i):ru(e.startOffset,e.endOffset-1,i.startIndex,i.endIndex)&&n.push(i)}return n}function K_(e){return{...re.deepClone(e),rangeId:kt()}}function X_(e,t){const n=[];let r=e[0];for(const s of t)s<e[0]||s>e[1]||(r<s&&n.push([r,s-1]),r=s+1);return r<=e[1]&&n.push([r,e[1]]),n}function su(e,t,n,r){const s=[];for(let i=0,o=n.length;i<o;i++){const a=n[i];if((r===void 0||a.rangeType===r)&&Math.max(a.startIndex,e)<=Math.min(a.endIndex,t)&&s.push({...a}),a.startIndex>t)break}return s}function q_(e,t){var i,o,a,l,u;const n=su(e.startOffset,e.collapsed?e.startOffset:e.endOffset-1,(i=t.customRanges)!=null?i:[]),r=Math.min(e.startOffset,(a=(o=n[0])==null?void 0:o.startIndex)!=null?a:1/0),s=Math.max(e.endOffset,((u=(l=n[n.length-1])==null?void 0:l.endIndex)!=null?u:-1/0)+1);return{startOffset:r,endOffset:s,collapsed:r===s}}function J_(e){var h,d,f;const{rangeId:t,segmentId:n,documentDataModel:r,insert:s}=e,i=(d=(h=r.getSelfOrHeaderFooterModel(n).getBody())==null?void 0:h.customRanges)==null?void 0:d.find(p=>p.rangeId===t);if(!i)return!1;const{startIndex:o,endIndex:a}=i,l=new Ye,u=a-o+1;l.push({t:he.RETAIN,len:o}),l.push({t:he.RETAIN,len:u,body:{dataStream:"",customRanges:[]}}),s&&l.push({t:he.INSERT,body:s,len:s.dataStream.length});const c=a+1+((f=s==null?void 0:s.dataStream.length)!=null?f:0);return l.selections=[{startOffset:c,endOffset:c,collapsed:!0}],l}function Z_(e){const{ranges:t,rangeId:n,rangeType:r,wholeEntity:s,properties:i,body:o}=e;let a=0;const l=new Ye;let u=!1;return t.forEach(c=>{var W,se,y;const h=q_(c,o);if(!h||!o)return!1;const{startOffset:d,endOffset:f}=h,p=(W=o.customRanges)!=null?W:[],R=(A,j,Z)=>{var v,D,b,O;const fe=su(A,j,p,r),le=Math.min((D=(v=fe[0])==null?void 0:v.startIndex)!=null?D:1/0,A),_=Math.max((O=(b=fe[fe.length-1])==null?void 0:b.endIndex)!=null?O:-1/0,j),H={rangeId:Z?`${n}$${Z}`:n,rangeType:r,startIndex:0,endIndex:_-le,wholeEntity:s,properties:{...i}};l.push({t:he.RETAIN,len:le-a}),l.push({t:he.RETAIN,len:_-le+1,body:{dataStream:"",customRanges:[H]},coverType:xe.COVER}),a=_+1},w=((se=o.paragraphs)!=null?se:[]).filter(A=>A.startIndex<f&&A.startIndex>d),N=((y=o.customBlocks)!=null?y:[]).filter(A=>A.startIndex<f&&A.startIndex>d);X_([d,f-1],[...w.map(A=>A.startIndex),...N.map(A=>A.startIndex)]).forEach(([A,j],Z)=>R(A,j,Z)),u=!0,l.selections=[{startOffset:h.endOffset,endOffset:h.endOffset,collapsed:!0}]}),u?l:!1}function iu(e,t,n=0,r=null,s=!0){e.sort((u,c)=>u.startOffset-c.startOffset);const i=[],{paragraphs:o=[]}=t,a=o==null?void 0:o.find(u=>u.startIndex>=e[0].startOffset&&u.startIndex<e[0].endOffset);let l=n;if(e.forEach(u=>{const{startOffset:c,endOffset:h}=u;c>l&&(i.push({t:he.RETAIN,len:c-l}),l=c),l<h&&(i.push({t:he.DELETE,len:h-l}),l=h)}),r&&i.push({t:he.INSERT,body:r,len:r.dataStream.length}),a&&s){const u=o.find(c=>c.startIndex-n>=e[e.length-1].endOffset-1);u&&(u.startIndex>l&&(i.push({t:he.RETAIN,len:u.startIndex-l}),l=u.startIndex),i.push({t:he.RETAIN,len:1,body:{dataStream:"",paragraphs:[{...u,startIndex:0,bullet:a==null?void 0:a.bullet}]},coverType:xe.REPLACE}))}return i}function Q_(e,t,n=0){const r=[];let s=n;return e.forEach(i=>{const{startOffset:o,endOffset:a}=i;o>s&&(r.push({t:he.RETAIN,len:o-s}),s=o),a>s&&(r.push({t:he.RETAIN,len:a-s,body:{...re.deepClone(t),dataStream:""}}),s=a)}),r}const ep=e=>{var h;const{selection:t,body:n,doc:r}=e,s=t.segmentId,i=(h=r.getSelfOrHeaderFooterModel(s))==null?void 0:h.getBody();if(!i)return!1;const o=t.collapsed?null:Tt(i,t.startOffset,t.endOffset),a=fi(o?o.dataStream:"",n.dataStream);let l=0;const u=a.map(([d,f])=>{switch(d){case 0:{const p={t:he.RETAIN,body:{...Tt(n,l,l+f.length,!1),dataStream:""},len:f.length};return l+=f.length,p}case 1:{const p={t:he.INSERT,body:Tt(n,l,l+f.length),len:f.length};return l+=f.length,p}default:return{t:he.DELETE,len:f.length}}}),c=new Ye;return c.push({t:he.RETAIN,len:t.startOffset}),c.push(...u),c};function tp(e,t){return!!((e==null?void 0:e.length)===(t==null?void 0:t.length)&&(e!=null&&e.every((n,r)=>JSON.stringify(n)===JSON.stringify(t==null?void 0:t[r]))))}const np=e=>{var h;const{selection:t,body:n,doc:r}=e,s=t.segmentId,i=(h=r.getSelfOrHeaderFooterModel(s))==null?void 0:h.getBody();if(!i)return!1;const o=t.collapsed?null:Tt(i,t.startOffset,t.endOffset),a=fi(o?o.dataStream:"",n.dataStream);let l=0;const u=a.map(([d,f])=>{switch(d){case 0:{const p=Gr(n,l,l+f.length,!1),R=Gr(o,l,l+f.length,!1),w={t:he.RETAIN,body:tp(p,R)?void 0:{textRuns:p,dataStream:""},len:f.length};return l+=f.length,w}case 1:{const p={t:he.INSERT,body:Tt(n,l,l+f.length),len:f.length};return l+=f.length,p}default:return{t:he.DELETE,len:f.length}}});if(u.every(d=>d.t===he.RETAIN&&!d.body))return!1;const c=new Ye;return c.push({t:he.RETAIN,len:t.startOffset}),c.push(...u),c};function rp(e,t){const n=[],{customBlocks:r=[]}=e;for(const s of t){const{startOffset:i,endOffset:o}=s;if(!(i==null||o==null))for(const a of r){const{startIndex:l}=a;l>=i&&l<o&&n.push(a.blockId)}}return n}function sp(e,t=""){if(!t)return["body"];const{headers:n,footers:r}=e.getSnapshot();if(n==null&&r==null)throw new Error("Document data model must have headers or footers when update by segment id");if((n==null?void 0:n[t])!=null)return["headers",t,"body"];if((r==null?void 0:r[t])!=null)return["footers",t,"body"];throw new Error("Segment id not found in headers or footers")}const ip=e=>{var R,w,N,G;const{selection:t,documentDataModel:n,drawings:r}=e,{collapsed:s,startOffset:i,segmentId:o}=t,a=new Ye,l=Ft.getInstance(),u=[],c=n.getSelfOrHeaderFooterModel(o).getBody();if(!c)return!1;const h=(w=(R=n.getSnapshot().drawingsOrder)==null?void 0:R.length)!=null?w:0;let d=0;if(s)i>0&&a.push({t:he.RETAIN,len:i});else{const W=iu([t],c,0,null,!1);a.push(...W);const se=rp(c,[t]),y=(N=n.getDrawings())!=null?N:{},A=(G=n.getDrawingsOrder())!=null?G:[],j=se.sort((Z,fe)=>A.indexOf(Z)>A.indexOf(fe)?-1:A.indexOf(Z)<A.indexOf(fe)?1:0);if(j.length>0)for(const Z of j){const fe=y[Z],le=A.indexOf(Z);if(fe==null||le<0)continue;const _=l.removeOp(["drawings",Z],fe),H=l.removeOp(["drawingsOrder",le],Z);u.push(_),u.push(H),d++}}a.push({t:he.INSERT,body:{dataStream:"\b".repeat(r.length),customBlocks:r.map((W,se)=>({startIndex:se,blockId:W.drawingId}))},len:r.length});const f=sp(n,o),p=l.editOp(a.serialize(),f);u.push(p);for(const W of r){const{drawingId:se}=W,y=l.insertOp(["drawings",se],W),A=l.insertOp(["drawingsOrder",h-d],se);u.push(y),u.push(A)}return u.reduce((W,se)=>Ft.compose(W,se),null)};function op(e,t){if(typeof t>"u")return{startOffset:e,endOffset:e,collapsed:!0};if(t<e)throw new Error(`Cannot make a doc selection when endOffset ${t} is less than startOffset ${e}.`);return{startOffset:e,endOffset:t,collapsed:e===t}}function ap(e){const{startOffset:t,endOffset:n,collapsed:r}=e,s=Math.min(t,n),i=Math.max(t,n);return{startOffset:s,endOffset:i,collapsed:r}}function lp(e,t,n,r){return Math.max(e,n)<=Math.min(t,r)}function Ws(e,t,n,r){const{startOffset:s,endOffset:i}=e,o=r!=null?r:Ei(t,n),a=[];let l=-1;for(let u=0;u<o.length;u++){const c=o[u],{startIndex:h}=c;(s>l&&s<=h||i>l&&i<=h||h>=s&&h<=i)&&a.push(c),l=h}return a}function Ys(e,t,n){const r=[],s=Ei(t,n);for(const i of e){const o=Ws(i,t,n,s);r.push(...o)}return r}const up=[_t.PARAGRAPH,_t.TABLE_START,_t.TABLE_END,_t.TABLE_ROW_START,_t.TABLE_CELL_START,_t.TABLE_CELL_END];function Ei(e,t){const n=[];for(let r=0;r<e.length;r++){const s=e[r],{startIndex:i}=s;let o=i-1;for(;!up.includes(t[o])&&o>=0;)o--;n.push({...s,paragraphStart:o+1,paragraphEnd:s.startIndex})}return n}const cp=e=>{var h,d,f;const{paragraphs:t,segmentId:n,document:r}=e;let s=e.listType;const i=(d=(h=r.getSelfOrHeaderFooterModel(n).getBody())==null?void 0:h.paragraphs)!=null?d:[],o=t.every(p=>{var R;return((R=p.bullet)==null?void 0:R.listType.indexOf(s))===0});let l=re.generateRandomId(6);if(t.length===1){const p=i.indexOf(t[0]),R=i[p-1],w=i[p+1];R&&R.bullet&&R.bullet.listType.indexOf(s)===0?(l=R.bullet.listId,s!==Lt.CHECK_LIST&&(s=R.bullet.listType)):w&&w.bullet&&w.bullet.listType.indexOf(s)===0&&(l=w.bullet.listId,s!==Lt.CHECK_LIST&&(s=w.bullet.listType))}const u=new hn;u.reset();const c=new Ye;for(const p of t){const{startIndex:R,paragraphStyle:w={},bullet:N}=p;c.push({t:he.RETAIN,len:R-u.cursor}),c.push({t:he.RETAIN,len:1,body:{dataStream:"",paragraphs:[o?{paragraphStyle:w,startIndex:0}:{startIndex:0,paragraphStyle:{...w},bullet:{nestingLevel:(f=N==null?void 0:N.nestingLevel)!=null?f:0,textStyle:{fs:20},listType:s,listId:l}}]},coverType:xe.REPLACE}),u.moveCursorTo(R+1)}return c},hp=e=>{var h;const{paragraphIndex:t,segmentId:n,document:r}=e,s=(h=r.getSelfOrHeaderFooterModel(n).getBody())==null?void 0:h.paragraphs;if(s==null)return!1;const i=s.find(d=>d.startIndex===t);if(!(i!=null&&i.bullet)||i.bullet.listType.indexOf(Lt.CHECK_LIST)===-1)return!1;const o=new hn;o.reset();const a=new Ye,{startIndex:l,paragraphStyle:u={}}=i,c=i.bullet.listType===Lt.CHECK_LIST?Lt.CHECK_LIST_CHECKED:Lt.CHECK_LIST;return a.push({t:he.RETAIN,len:l-o.cursor}),a.push({t:he.RETAIN,len:1,body:{dataStream:"",paragraphs:[{...i,paragraphStyle:u,startIndex:0,bullet:{...i.bullet,listType:c}}]},coverType:xe.REPLACE}),o.moveCursorTo(l+1),a},dp=e=>{var c,h;const{paragraphs:t,listType:n,segmentId:r,document:s}=e;if(((c=s.getSelfOrHeaderFooterModel(r).getBody())==null?void 0:c.paragraphs)==null)return!1;const a=re.generateRandomId(6),l=new hn;l.reset();const u=new Ye;for(const d of t){const{startIndex:f,paragraphStyle:p={},bullet:R}=d;u.push({t:he.RETAIN,len:f-l.cursor}),u.push({t:he.RETAIN,len:1,body:{dataStream:"",paragraphs:[{startIndex:0,paragraphStyle:p,bullet:{nestingLevel:(h=R==null?void 0:R.nestingLevel)!=null?h:0,textStyle:(R==null?void 0:R.listType)===n?R.textStyle:{fs:20},listType:n,listId:a}}]},coverType:xe.REPLACE}),l.moveCursorTo(f+1)}return u};function fp(e,t){return t.some(n=>e.startIndex>n.startIndex&&e.startIndex<n.endIndex)}const gp=e=>{var u,c,h;const{paragraphs:t,document:n,type:r}=e,s=new hn;s.reset();const i=new Ye,o=(u=n.getSnapshot().lists)!=null?u:{},a=(h=(c=n.getBody())==null?void 0:c.tables)!=null?h:[],l={...cr,...o};for(const d of t){const{startIndex:f,paragraphStyle:p={},bullet:R}=d,w=fp(d,a);if(i.push({t:he.RETAIN,len:f-s.cursor}),R){const N=R.listType;let G=l[N].nestingLevel.length-1;w&&(G=Math.min(G,2)),i.push({t:he.RETAIN,len:1,body:{dataStream:"",paragraphs:[{startIndex:0,paragraphStyle:{...p},bullet:{...R,nestingLevel:Math.max(Math.min(R.nestingLevel+r,G),0)}}]},coverType:xe.REPLACE})}else i.push({t:he.RETAIN,len:1});s.moveCursorTo(f+1)}return i},mp=e=>{var w,N,G,W;const{textRanges:t,segmentId:n,document:r,style:s,paragraphTextRun:i,cursor:o,deleteLen:a,textX:l}=e,u=r.getSelfOrHeaderFooterModel(n),c=(N=(w=u.getBody())==null?void 0:w.paragraphs)!=null?N:[],h=(W=(G=u.getBody())==null?void 0:G.dataStream)!=null?W:"",d=Ys(t,c,h),f=new hn;o&&f.moveCursorTo(o);const p=l!=null?l:new Ye;d.sort((se,y)=>se.startIndex-y.startIndex);const R=Math.max(0,d[0].paragraphStart-1);R>f.cursor&&(p.push({t:he.RETAIN,len:R-f.cursor}),f.moveCursorTo(R)),a&&p.push({t:he.DELETE,len:a});for(const se of d){const{startIndex:y,paragraphStyle:A={}}=se,j=y-f.cursor;p.push({t:he.RETAIN,len:j,...i?{body:{dataStream:"",textRuns:[{ts:i,st:0,ed:j}]},coverType:xe.REPLACE}:null}),p.push({t:he.RETAIN,len:1,body:{dataStream:"",paragraphs:[{startIndex:0,paragraphStyle:{...A,...s}}]},coverType:xe.REPLACE}),f.moveCursorTo(y+1)}return p};class ot{}C(ot,"customRange",{add:Z_,delete:J_,copyCustomRange:K_,getCustomRangesInterestsWithSelection:V_,isIntersecting:ru}),C(ot,"customDecoration",{add:z_,delete:G_}),C(ot,"selection",{replace:ep,makeSelection:op,normalizeSelection:ap,delete:iu,replaceTextRuns:np,retain:Q_}),C(ot,"range",{isIntersects:lp,getParagraphsInRange:Ws,getParagraphsInRanges:Ys}),C(ot,"transform",{getPlainText:Qr,fromPlainText:Zd,isEmptyDocument:Jd}),C(ot,"paragraph",{bullet:{set:dp,switch:cp,toggleChecklist:hp,changeNestLevel:gp},style:{set:mp},util:{transform:Ei,getParagraphsInRange:Ws,getParagraphsInRanges:Ys}}),C(ot,"drawing",{add:ip});function _p(e){if(e.customRanges||(e.customRanges=[]),!e.paragraphs){e.paragraphs=[];for(let t=0;t<e.dataStream.length;t++)e.dataStream[t]==="\r"&&e.paragraphs.push({startIndex:t})}return e.customBlocks||(e.customBlocks=[]),e.textRuns||(e.textRuns=[]),e.customDecorations||(e.customDecorations=[]),e.sectionBreaks||(e.sectionBreaks=[]),e.tables||(e.tables=[]),e}function ou(e){var t;return e.body=_p((t=e.body)!=null?t:{dataStream:""}),e.drawingsOrder||(e.drawingsOrder=[]),e.drawings||(e.drawings={}),e.documentStyle||(e.documentStyle={}),e}class hr{constructor(t={}){C(this,"_style");this._style=t}static create(t={}){return new hr(t)}get fontFamily(){return this._style.ff}get fontSize(){return this._style.fs}get italic(){return this._style.it===Ie.TRUE}get bold(){return this._style.bl===Ie.TRUE}get underline(){return this._style.ul&&zt.create(this._style.ul)}get bottomBorderLine(){return this._style.bbl&&zt.create(this._style.bbl)}get strikethrough(){return this._style.st&&zt.create(this._style.st)}get overline(){return this._style.ol&&zt.create(this._style.ol)}get background(){return this._style.bg}get border(){return this._style.bd}get color(){return this._style.cl}get verticalAlign(){return this._style.va}get numberFormat(){return this._style.n}copy(){return Xt.create(re.deepClone(this._style))}getValue(){return{...this._style}}}class Xt extends hr{static create(t={}){return new Xt(t)}constructor(t={}){super(t)}setFontFamily(t){return this._style.ff=t,this}setFontSize(t){return this._style.fs=t,this}setItalic(t){return this._style.it=t?1:0,this}setBold(t){return this._style.bl=t?1:0,this}setUnderline(t){return this._style.ul=t.build(),this}setBottomBorderLine(t){return this._style.bbl=t.build(),this}setStrikethrough(t){return this._style.st=t.build(),this}setOverline(t){return this._style.ol=t.build(),this}setBackground(t){return this._style.bg=t,this}setBorder(t){return this._style.bd=t,this}setColor(t){return this._style.cl=t,this}setVerticalAlign(t){return this._style.va=t,this}copy(){return Xt.create(re.deepClone(this._style))}build(){return this.getValue()}}class zt{constructor(t={s:1}){C(this,"_decoration");this._decoration=t}static create(t={s:1}){return new zt(t)}get show(){return this._decoration.s===Ie.TRUE}get followFontColor(){return this._decoration.c===Ie.TRUE}get color(){return this._decoration.cl}get type(){return this._decoration.t}setShow(t){return this._decoration.s=t?1:0,this}setFollowFontColor(t){return this._decoration.c=t?1:0,this}setColor(t){return this._decoration.cl=t,this}setLineType(t){return this._decoration.t=t,this}copy(){return zt.create(re.deepClone(this._decoration))}build(){return{...this._decoration}}}class dr{constructor(t={}){C(this,"_style");this._style=t}static create(t={}){return new dr(t)}get indentFirstLine(){return this._style.indentFirstLine}get hanging(){return this._style.hanging}get indentStart(){return this._style.indentStart}get tabStops(){return this._style.tabStops}get indentEnd(){return this._style.indentEnd}get textStyle(){return this._style.textStyle}get headingId(){return this._style.headingId}get namedStyleType(){return this._style.namedStyleType}get horizontalAlign(){return this._style.horizontalAlign}get lineSpacing(){return this._style.lineSpacing}get direction(){return this._style.direction}get spacingRule(){return this._style.spacingRule}get snapToGrid(){return this._style.snapToGrid}get spaceAbove(){return this._style.spaceAbove}get spaceBelow(){return this._style.spaceBelow}get borderBetween(){return this._style.borderBetween}get borderTop(){return this._style.borderTop}get borderBottom(){return this._style.borderBottom}get borderLeft(){return this._style.borderLeft}get borderRight(){return this._style.borderRight}get keepLines(){return this._style.keepLines===Ie.TRUE}get keepNext(){return this._style.keepNext===Ie.TRUE}get wordWrap(){return this._style.wordWrap===Ie.TRUE}get widowControl(){return this._style.widowControl===Ie.TRUE}get shading(){return this._style.shading}get suppressHyphenation(){return this._style.suppressHyphenation===Ie.TRUE}copy(){return Zn.create(re.deepClone(this._style))}getValue(){return this._style}}class Zn extends dr{static create(t={}){return new Zn(t)}constructor(t={}){super(t)}setIndentFirstLine(t){return this._style.indentFirstLine=t,this}setHanging(t){return this._style.hanging=t,this}setIndentStart(t){return this._style.indentStart=t,this}setTabStops(t){return this._style.tabStops=t,this}setIndentEnd(t){return this._style.indentEnd=t,this}setTextStyle(t){return this._style.textStyle=t,this}setHeadingId(t){return this._style.headingId=t,this}setNamedStyleType(t){return this._style.namedStyleType=t,this}setHorizontalAlign(t){return this._style.horizontalAlign=t,this}setLineSpacing(t){return this._style.lineSpacing=t,this}setDirection(t){return this._style.direction=t,this}setSpacingRule(t){return this._style.spacingRule=t,this}setSnapToGrid(t){return this._style.snapToGrid=t?1:0,this}setSpaceAbove(t){return this._style.spaceAbove=t,this}setSpaceBelow(t){return this._style.spaceBelow=t,this}setBorderBetween(t){return this._style.borderBetween=t,this}setBorderTop(t){return this._style.borderTop=t,this}setBorderBottom(t){return this._style.borderBottom=t,this}setBorderLeft(t){return this._style.borderLeft=t,this}setBorderRight(t){return this._style.borderRight=t,this}setKeepLines(t){return this._style.keepLines=t?1:0,this}setKeepNext(t){return this._style.keepNext=t?1:0,this}setWordWrap(t){return this._style.wordWrap=t?1:0,this}setWidowControl(t){return this._style.widowControl=t?1:0,this}setShading(t){return this._style.shading=t,this}setSuppressHyphenation(t){return this._style.suppressHyphenation=t?1:0,this}copy(){return Zn.create(re.deepClone(this._style))}build(){return this.getValue()}}class Gt{constructor(t){C(this,"_data");if(!t.body)throw new Error("Invalid document data, body is required");this._data=ou(t)}static create(t){return new Gt(t)}static createByBody(t){return new Gt({body:t,id:"d",documentStyle:{}})}copy(){return sn.create(re.deepClone(this._data))}slice(t,n){const{body:r,...s}=this._data;return sn.create({...re.deepClone(s),body:Tt(r,t,n)})}toPlainText(){var t,n;return ot.transform.getPlainText((n=(t=this._data.body)==null?void 0:t.dataStream)!=null?n:"").replaceAll("\r",`
7
- `)}getParagraphStyle(){var t,n;return dr.create((n=(t=this._data.body)==null?void 0:t.paragraphs)==null?void 0:n[0].paragraphStyle)}getParagraphBullet(){var t,n;return(n=(t=this._data.body)==null?void 0:t.paragraphs)==null?void 0:n[0].bullet}getParagraphs(){var r,s;const t=(s=(r=this._data.body)==null?void 0:r.paragraphs)!=null?s:[];let n=0;return t.map(i=>{const o=this.slice(n,i.startIndex);return n=i.startIndex,o})}getTextRuns(){var t,n;return((n=(t=this._data.body)==null?void 0:t.textRuns)!=null?n:[]).map(r=>({...r,ts:r.ts?hr.create(r.ts):null}))}getLinks(){var t,n,r;return(r=(n=(t=this._data.body)==null?void 0:t.customRanges)==null?void 0:n.filter(s=>s.rangeType===qt.HYPERLINK))!=null?r:[]}getData(){return this._data}}class sn extends Gt{constructor(n){super(n);C(this,"_doc");this._doc=new yt(n)}static newEmptyData(){return ou({id:"d",documentStyle:{},drawings:{},drawingsOrder:[],body:{dataStream:`\r
8
- `,customBlocks:[],customRanges:[],paragraphs:[{startIndex:0}],textRuns:[],tables:[],sectionBreaks:[]}})}static create(n){return new sn(n!=null?n:sn.newEmptyData())}insertText(n,r,s){var c,h;let i=((h=(c=this._data.body)==null?void 0:c.dataStream.length)!=null?h:2)-2,o,a;if(typeof n=="string"?o=n:(i=Math.min(n,i),o=r),typeof r=="object"?a=r instanceof Xt?r.build():r:a=s instanceof Xt?s.build():s,!o)return this;const l={dataStream:o,textRuns:a?[{ts:a,st:i,ed:i+o.length}]:[]},u=ot.selection.replace({doc:this._doc,selection:{startOffset:i,endOffset:i,collapsed:!0},body:l});if(!u)throw new Error("Insert text failed, please check.");return Ye.apply(this._doc.getBody(),u.serialize()),this}insertRichText(n,r){var a,l;let s=((l=(a=this._data.body)==null?void 0:a.dataStream.length)!=null?l:2)-2,i;typeof n=="object"?i=n instanceof Gt?n.getData():n:(s=Math.min(n,s),i=r instanceof Gt?r.getData():r);const o=ot.selection.replace({doc:this._doc,selection:{startOffset:s,endOffset:s,collapsed:!0},body:i.body});if(!o)throw new Error("Insert text failed, please check.");return Ye.apply(this._doc.getBody(),o.serialize()),this}delete(n,r){if(r!==void 0){if(!r)return this;const s=ot.selection.delete([{startOffset:n,endOffset:n+r,collapsed:!0}],this._data.body);Ye.apply(this._doc.getBody(),s)}return this}setStyle(n,r,s){const i={dataStream:"",textRuns:[{ts:s instanceof Xt?s.build():s,st:0,ed:r-n}]},o=ot.selection.retain([{startOffset:n,endOffset:r,collapsed:!0}],i);return Ye.apply(this._doc.getBody(),o),this}setLink(n,r,s){const i=ot.customRange.add({rangeType:qt.HYPERLINK,rangeId:kt(),properties:{url:s},ranges:[{startOffset:n,endOffset:r,collapsed:!1}],body:this._data.body});if(!i)throw new Error("Insert text failed, please check.");return Ye.apply(this._doc.getBody(),i.serialize()),this}cancelLink(n,r){if(typeof n=="string"){const s=ot.customRange.delete({rangeId:n,documentDataModel:this._doc});if(!s)throw new Error("Insert text failed, please check.");Ye.apply(this._doc.getBody(),s.serialize())}else this.slice(n,r).getLinks().forEach(i=>{const o=ot.customRange.delete({rangeId:i.rangeId,documentDataModel:this._doc});if(!o)throw new Error("Insert text failed, please check.");Ye.apply(this._doc.getBody(),o.serialize())});return this}updateLink(n,r){var i,o;const s=(o=(i=this._data.body)==null?void 0:i.customRanges)==null?void 0:o.find(a=>a.rangeId===n);if(!s)throw new Error("Link not found");return s.properties.url=r,this}insertParagraph(n,r){var o,a;let s,i;return typeof n=="object"?(s={dataStream:"\r",paragraphs:[{startIndex:0,paragraphStyle:n.build()}]},i=((a=(o=this._data.body)==null?void 0:o.dataStream.length)!=null?a:2)-2):(i=n,s={dataStream:"\r",paragraphs:[{startIndex:0,paragraphStyle:r==null?void 0:r.build()}]}),this.insertRichText(i,Gt.create({body:s,id:"d",documentStyle:{}})),this}insertLink(n,r,s){let i="",o="";typeof n=="string"?(i=n,o=r):(i=r,o=s);const a=sn.createByBody({dataStream:i,customRanges:[{rangeType:qt.HYPERLINK,rangeId:kt(),properties:{url:o},startIndex:0,endIndex:i.length-1}]});return typeof n=="number"?this.insertRichText(n,a):this.insertRichText(a)}}function pp(e,t=16){let n=0,r=null;return function(...i){const o=Date.now();o-n<t?(r&&clearTimeout(r),r=setTimeout(()=>{n=o,e.apply(this,i)},t)):(n=o,e.apply(this,i))}}var Sn=(e=>(e[e.Style=1]="Style",e[e.Value=2]="Value",e))(Sn||{});function Ep(e){return`sheet_interceptor_${e}`}const au=e=>function(t,n){let r=-1,s=t;for(let i=0;i<=e.length;i++){if(i<=r)throw new Error("[SheetInterceptorService]: next() called multiple times!");if(r=i,i===e.length)return s;const o=e[i];let a=!1;if(s=o.handler(s,n,l=>(a=!0,l)),!a)break}return s};class Cp{constructor(t){C(this,"_interceptorsByName",new Map);C(this,"_interceptorPoints");this._interceptorPoints=t}fetchThroughInterceptors(t,n){const r=t;let s=this._interceptorsByName.get(r);return n&&(s=s.filter(n)),au(s||[])}intercept(t,n){const r=t;this._interceptorsByName.has(r)||this._interceptorsByName.set(r,[]);const s=this._interceptorsByName.get(r);return s.push(n),this._interceptorsByName.set(r,s.sort((i,o)=>{var a,l;return((a=o.priority)!=null?a:0)-((l=i.priority)!=null?l:0)})),()=>tr(this._interceptorsByName.get(r),n)}getInterceptPoints(){return this._interceptorPoints}dispose(){this._interceptorsByName.clear()}}function Rp(e){return`sheet_async_interceptor_${e}`}const Ip=e=>async function(t,n){let r=-1,s=t;for(let i=0;i<=e.length;i++){if(i<=r)throw new Error("[SheetInterceptorService]: next() called multiple times!");if(r=i,i===e.length)return s;const o=e[i];let a=!1;if(s=await o.handler(s,n,async l=>(a=!0,l)),!a)break}return s};class Sp{constructor(t){C(this,"_asyncInterceptorsByName",new Map);C(this,"_asyncInterceptorPoints");this._asyncInterceptorPoints=t}fetchThroughAsyncInterceptors(t,n){const r=t;let s=this._asyncInterceptorsByName.get(r);return n&&(s=s.filter(n)),Ip(s||[])}async interceptAsync(t,n){const r=t;this._asyncInterceptorsByName.has(r)||this._asyncInterceptorsByName.set(r,[]);const s=this._asyncInterceptorsByName.get(r);return s.push(n),this._asyncInterceptorsByName.set(r,s.sort((i,o)=>{var a,l;return((a=o.priority)!=null?a:0)-((l=i.priority)!=null?l:0)})),()=>tr(this._asyncInterceptorsByName.get(r),n)}getInterceptPoints(){return this._asyncInterceptorPoints}dispose(){this._asyncInterceptorsByName.clear()}}function vp(e,t){for(const n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}function lu(e){return/^-?\d+(\.\d+)?$/.test(e)}function Op(e){return lu(e)?Number(e)<=Number.MAX_SAFE_INTEGER:!1}class Ci{constructor(){C(this,"_data",[])}static create(){return new Ci}add(t){this._data.indexOf(t)>-1||this._data.push(t)}delete(t){const n=this._data.indexOf(t);this._data.splice(n,1)}getData(){return this._data}}class Ri{constructor(){C(this,"_data",new Map)}static create(){return new Ri}add(t,n){this._data.has(t)||this._data.set(t,n)}delete(t){this._data.delete(t)}getData(){return this._data}}function wp(e){const t=new MessageChannel;let n=!1;const r=()=>{n||e()};return t.port1.onmessage=r,t.port2.postMessage(null),()=>{n=!0,t.port1.onmessage=null,t.port1.close(),t.port2.close()}}function bp(e,t){return t.forEach(n=>e.add(n)),e}function Ap(e,t,n,r){var u;if(t==="")return e;const s={id:"mock-id",body:e,documentStyle:{}},i=new yt(s),o=t.length;let a;for(;(a=(r?i.getBody().dataStream:i.getBody().dataStream.toLowerCase()).indexOf(t))>=0;){const c=new Ye,h=Ft.getInstance();if(a>0&&c.retain(a),n.length>0){const d=i.sliceBody(a,a+o),f={dataStream:n};if(Array.isArray(d==null?void 0:d.textRuns)&&d.textRuns.length&&(f.textRuns=[{...d.textRuns[0],st:0,ed:n.length}]),(u=d==null?void 0:d.customRanges)!=null&&u.length){const p=d.customRanges[0];f.customRanges=[{...p,startIndex:0,endIndex:n.length-1}]}c.insert(n.length,f)}c.delete(o),i.apply(h.editOp(c.serialize()))}const l=i.getBody();return i.dispose(),l}const Tp="__default_document_sub_component_id20231101__";class uu{constructor(){C(this,"skipNextObservers",!1);C(this,"lastReturnValue");C(this,"isStopPropagation",!1)}stopPropagation(){this.isStopPropagation=!0}}class yp extends we.Subject{constructor(){super(...arguments);C(this,"_sortedObservers",[])}subscribe(){throw new Error("[EventSubject]: please use `subscribeEvent` instead of `subscribe` method for `EventSubject`.")}next(){throw new Error("[EventSubject]: please use `emitEvent` instead of `next` method for `EventSubject`.")}unsubscribe(){super.unsubscribe(),this._sortedObservers.length=0}complete(){super.complete(),this._sortedObservers.length=0}subscribeEvent(n){let r;typeof n=="function"?r={next:([i,o])=>n(i,o)}:r=n;const s=super.subscribe(r);return this._sortedObservers.push(r),this._sortedObservers.sort((i,o)=>{var a,l;return((a=i.priority)!=null?a:0)-((l=o.priority)!=null?l:0)}),s.add(()=>this._sortedObservers=this._sortedObservers.filter(i=>i!==r)),s}clearObservers(){this._sortedObservers.forEach(n=>{var r;return(r=n.complete)==null?void 0:r.call(n)}),this._sortedObservers.length=0}emitEvent(n){var r;if(!this.closed){const s=new uu;s.lastReturnValue=n;for(const i of this._sortedObservers){const o=(r=i.next)==null?void 0:r.call(i,[n,s]);if(s.lastReturnValue=o,s.skipNextObservers)return{handled:!0,lastReturnValue:s.lastReturnValue,stopPropagation:s.isStopPropagation}}return{handled:this._sortedObservers.length>0,lastReturnValue:s.lastReturnValue,stopPropagation:s.isStopPropagation}}throw new Error("[EventSubject]: cannot emit event on a closed subject.")}}function Np(e){return new we.Observable(t=>{const n=e.subscribeEvent(r=>{t.next(r)});return()=>n.unsubscribe()})}const is=je.createIdentifier("core.resource-manager.service"),zs={[Dt.Editor]:"Editor",[Dt.Owner]:"Owner",[Dt.Reader]:"Reader",[Dt.UNRECOGNIZED]:"UNRECOGNIZED"},Vr=e=>e?{userID:`${zs[e]}_${re.generateRandomId(8)}`,name:zs[e],avatar:""}:{userID:"",name:"",avatar:"",anonymous:!0,canBindAnonymous:!1},Mp=(e,t)=>e.startsWith(zs[t]);class Qn{constructor(){C(this,"_model",new Map);C(this,"_userChange$",new we.Subject);C(this,"userChange$",this._userChange$.asObservable());C(this,"_currentUser$",new we.BehaviorSubject(Vr()));C(this,"currentUser$",this._currentUser$.asObservable())}getCurrentUser(){return this._currentUser$.getValue()}setCurrentUser(t){this.addUser(t),this._currentUser$.next(t)}addUser(t){this._model.set(t.userID,t),this._userChange$.next({type:"add",user:t})}getUser(t,n){const r=this._model.get(t);if(r)return r;n&&n()}delete(t){const n=this.getUser(t);this._model.delete(t),n&&this._userChange$.next({type:"delete",user:n})}clear(){this._model.clear(),this._userChange$.next({type:"clear"})}list(){return Array.from(this._model.values())}}var Dp=Object.getOwnPropertyDescriptor,Lp=(e,t,n,r)=>{for(var s=r>1?void 0:r?Dp(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},bo=(e,t)=>(n,r)=>t(n,r,e);exports.AuthzIoLocalService=class{constructor(t,n){C(this,"_permissionMap",new Map([]));this._resourceManagerService=t,this._userManagerService=n,this._initSnapshot(),this._initDefaultUser()}_initDefaultUser(){const t=this._userManagerService.getCurrentUser();t&&t.userID||this._userManagerService.setCurrentUser(Vr(Dt.Owner))}_getRole(t){const n=this._userManagerService.getCurrentUser();return n?Mp(n.userID,t):!1}_initSnapshot(){this._resourceManagerService.registerPluginResource({toJson:t=>{const n=[...this._permissionMap.keys()].reduce((r,s)=>{const i=this._permissionMap.get(s);return r[s]=i,r},{});return JSON.stringify(n)},parseJson:t=>JSON.parse(t),pluginName:"SHEET_AuthzIoMockService_PLUGIN",businesses:[$e.UNIVER_SHEET,$e.UNIVER_DOC,$e.UNIVER_SLIDE],onLoad:(t,n)=>{for(const r in n)this._permissionMap.set(r,n[r])},onUnLoad:()=>{this._permissionMap.clear()}})}async create(t){return kt(8)}async allowed(t){return Promise.resolve([])}async batchAllowed(t){return Promise.resolve([])}async list(t){const n=[];return t.objectIDs.forEach(r=>{const s=this._permissionMap.get(r);if(s){const i={objectID:r,unitID:t.unitID,objectType:s.objectType,name:s.name,shareOn:!1,shareRole:Dt.Owner,shareScope:-1,scope:{read:Fs.AllCollaborator,edit:Fs.AllCollaborator},creator:Vr(Dt.Owner),strategies:[{action:6,role:1},{action:16,role:1},{action:17,role:1},{action:18,role:1},{action:19,role:1},{action:33,role:1},{action:34,role:1},{action:35,role:1},{action:36,role:1},{action:37,role:1},{action:38,role:1},{action:39,role:1},{action:40,role:1}],actions:t.actions.map(o=>({action:o,allowed:this._getRole(Dt.Owner)||this._getRole(Dt.Editor)}))};n.push(i)}}),n}async listCollaborators(){return[]}async listRoles(){return{roles:[],actions:[]}}async deleteCollaborator(){}async update(t){}async updateCollaborator(){}async createCollaborator(){}async putCollaborators(t){}};exports.AuthzIoLocalService=Lp([bo(0,is),bo(1,je.Inject(Qn))],exports.AuthzIoLocalService);const cu=je.createIdentifier("IAuthzIoIoService");var xp=Object.getOwnPropertyDescriptor,Up=(e,t,n,r)=>{for(var s=r>1?void 0:r?xp(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Pp=(e,t)=>(n,r)=>t(n,r,e);exports.MentionIOLocalService=class{constructor(t){this._userManagerService=t}async list(t){return{list:[{type:Fr.PERSON,mentions:[{objectType:Fr.PERSON,objectId:this._userManagerService.getCurrentUser().userID,label:this._userManagerService.getCurrentUser().name,metadata:{icon:this._userManagerService.getCurrentUser().avatar}}],metadata:{},title:"PEOPLE"}],page:t.page,size:t.size,total:1}}};exports.MentionIOLocalService=Up([Pp(0,je.Inject(Qn))],exports.MentionIOLocalService);const hu=je.createIdentifier("univer.service.mention-io"),Ii=je.createIdentifier("univer.config-service");class du{constructor(){C(this,"_configChanged$",new we.Subject);C(this,"configChanged$",this._configChanged$.asObservable());C(this,"_config",new Map)}dispose(){this._configChanged$.complete()}getConfig(t){return this._config.get(t)}setConfig(t,n,r){var o;const{merge:s=!1}=r||{};let i=(o=this._config.get(t))!=null?o:{};s?i=di(i,n):i=n,this._config.set(t,i),this._configChanged$.next({[t]:i})}deleteConfig(t){return this._config.delete(t)}subscribeConfigValue$(t){return new we.Observable(n=>{Object.prototype.hasOwnProperty.call(this._config,t)&&n.next(this._config.get(t));const r=this.configChanged$.pipe(we.filter(s=>Object.prototype.hasOwnProperty.call(s,t))).subscribe(s=>n.next(s[t]));return()=>r.unsubscribe()})}}const Wn="FOCUSING_UNIT",vn="FOCUSING_SHEET",Yn="FOCUSING_DOC",zn="FOCUSING_SLIDE",kp="FOCUSING_EDITOR_BUT_HIDDEN",fu="EDITOR_ACTIVATED",Fp="FOCUSING_EDITOR_INPUT_FORMULA",gu="FOCUSING_FX_BAR_EDITOR",$p="FOCUSING_UNIVER_EDITOR",Bp="FOCUSING_EDITOR_INPUT_FORMULA",Hp="FOCUSING_PANEL_EDITOR",jp="FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE",Wp="FOCUSING_COMMON_DRAWINGS",Yp="FORMULA_EDITOR_ACTIVATED";class mu extends st{constructor(){super(...arguments);C(this,"_error$",new we.Subject);C(this,"error$",this._error$.asObservable())}dispose(){this._error$.complete()}emit(n){this._error$.next({errorKey:n})}}const zp="0.6.10",Gp={version:zp};function Vp(e="",t=sr.ZH_CN,n=""){return{id:e,sheetOrder:[],name:n,appVersion:Gp.version,locale:t,styles:{},sheets:{},resources:[]}}class _u{constructor(t={}){C(this,"_styles");C(this,"_cacheMap",new qn(1e5));this._styles=t,this._generateCacheMap()}each(t){return Object.entries(this._styles).forEach(t),this}search(t,n){if(this._cacheMap.has(n))return this._cacheMap.get(n);const r=this._getExistingStyleId(t);return r||"-1"}get(t){return typeof t!="string"?t:(t=String(t),this._styles[t])}add(t,n){const r=re.generateRandomId(6);return this._styles[r]=t,this._cacheMap.set(n,r),r}setValue(t){if(t==null)return;const n=JSON.stringify(t),r=this.search(t,n);return r!=="-1"?r:this.add(t,n)}toJSON(){return this._styles}getStyleByCell(t){let n;t&&re.isObject(t.s)?n=t.s:n=(t==null?void 0:t.s)&&this.get(t.s);const r=t==null?void 0:t.interceptorStyle;return r?{...n,...r}:n}_generateCacheMap(){const{_styles:t,_cacheMap:n}=this;for(const r in t){const s=JSON.stringify(t[r]);n.set(s,r)}}_getExistingStyleId(t){const{_styles:n}=this;for(const r in n)if(re.diffValue(n[r],t))return r;return null}}const Kp=(e,t)=>t.length===e.length&&!e.some(n=>t.some(r=>!Jt.equals(r,n))),Xp=(e,t)=>t.length===e.length&&e.every((n,r)=>{const s=t[r];return s.unitId===n.unitId&&s.sheetId===n.sheetId&&Jt.equals(n.range,s.range)}),Gs={t:0,b:2,l:2,r:2},qp=e=>({sbr:.6,sbo:e,spr:.6,spo:e}),Ao=90;function Gn(e,t,n={}){const r=e.length,{textRotation:s,paddingData:i,horizontalAlign:o=bt.UNSPECIFIED,verticalAlign:a=nn.UNSPECIFIED,wrapStrategy:l=an.UNSPECIFIED,cellValueType:u}=n,{t:c,r:h,b:d,l:f}=i||Gs,{vertexAngle:p,centerAngle:R}=Cu(s),w={id:"d",body:{dataStream:`${e}${ba}`,textRuns:[{ts:t,st:0,ed:r}],paragraphs:[{startIndex:r,paragraphStyle:{horizontalAlign:o}}],sectionBreaks:[{startIndex:r+1}]},documentStyle:{pageSize:{width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY},marginTop:c,marginBottom:d,marginRight:h,marginLeft:f,renderConfig:{horizontalAlign:o,verticalAlign:a,centerAngle:R,vertexAngle:p,wrapStrategy:l,cellValueType:u,zeroWidthParagraphBreak:1}},drawings:{},drawingsOrder:[]};return new yt(w)}function Jp(e){if(!e)return{};const{tr:t,td:n,ht:r,vt:s,tb:i,pd:o}=e;return{textRotation:t,textDirection:n,horizontalAlign:r,verticalAlign:s,wrapStrategy:i,paddingData:o}}function To(e){if(!e)return{};const{ff:t,fs:n,it:r,bl:s,ul:i,st:o,ol:a,cl:l}=e,u={};return t&&(u.ff=t),n&&(u.fs=n),r&&(u.it=r),s&&(u.bl=s),i&&(u.ul=i),o&&(u.st=o),a&&(u.ol=a),l&&(u.cl=l),u}function pu(e,t,n){var i;const r=e.getBody();if((i=r.customRanges)!=null&&i.some(o=>o.rangeType===qt.HYPERLINK))return;const s=ot.customRange.add({ranges:[{startOffset:0,endOffset:r.dataStream.length-1,collapsed:!1}],rangeId:n,rangeType:qt.HYPERLINK,body:r,properties:{url:t,refId:n}});s&&Ye.apply(r,s.serialize())}function Eu(e){return e!=null}const Zp='"Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif';function yo(e){const t=ut.ff,n=ut.fs;if(!e){const h=`${n}pt ${t}`;return{fontCache:h,fontString:h,fontSize:n,originFontSize:n,fontFamily:t}}let r=In.ITALIC;(e.it===0||e.it===void 0)&&(r=In.NORMAL);let s=In.BOLD;(e.bl===0||e.bl===void 0)&&(s=In.NORMAL);let i=n;e.fs&&(i=Math.ceil(e.fs));let o=t;if(e.ff){let h=e.ff;h=h.replace(/"/g,"").replace(/'/g,""),h.indexOf(" ")>-1&&(h=`"${h}"`),h==null&&(h=t),o=h}const{va:a}=e;let l=i;if(a===Pt.SUBSCRIPT||a===Pt.SUPERSCRIPT){const h=Qp(o,l),{sbr:d,spr:f}=h;l*=a===Pt.SUBSCRIPT?d:f}const u=`${r} ${s} ${l}pt ${o}`,c=`${u}, ${Zp} `;return{fontCache:u,fontString:c,fontSize:l,originFontSize:i,fontFamily:o}}function Qp(e,t){return qp(t)}function Cu(e){const{a:t=0,v:n=Ie.FALSE}=e||{a:0,v:Ie.FALSE};let r=0,s=t;return n===Ie.TRUE&&(r=Ao,s=Ao),{centerAngle:r,vertexAngle:s}}class eE{constructor(t,n){C(this,"_columnData",{});this._config=t,this._columnData=n}getColumnData(){return this._columnData}getColVisible(t){const{_columnData:n}=this,r=n[t];return r?r.hd!==Ie.TRUE:!0}getColumnStyle(t){var n;return(n=this._columnData[t])==null?void 0:n.s}setColumnStyle(t,n){const r=this.getColumnOrCreate(t);r.s=n}getHiddenCols(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getColVisible(o);s&&a?(s=!1,r.push({rangeType:Le.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!s&&!a&&(s=!0,i=o)}return s&&r.push({startRow:0,endRow:0,startColumn:i,endColumn:n,rangeType:Le.COLUMN}),r}getVisibleCols(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getColVisible(o);s&&!a?(s=!1,r.push({rangeType:Le.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!s&&a&&(s=!0,i=o)}return s&&r.push({startRow:0,endRow:0,startColumn:i,endColumn:n,rangeType:Le.COLUMN}),r}getColumnDatas(t,n){const r={};let s=0;for(let i=t;i<t+n;i++){const o=this.getColumnOrCreate(i);r[s]=o,s++}return r}getSize(){return Kt(this._columnData)}getColumnWidth(t){const{_columnData:n}=this,r=this._config;let s=0;return s=(n[t]||{hd:Ie.FALSE,w:r.defaultColumnWidth}).w||r.defaultColumnWidth,s}getColumn(t){const n=this._columnData[t];if(n)return n}removeColumn(t){delete this._columnData[t]}getColumnOrCreate(t){const{_columnData:n}=this,r=n[t];if(r)return r;const s={};return this._columnData[t]=s,s}setCustomMetadata(t,n){const r=this.getColumn(t);r&&(r.custom=n)}getCustomMetadata(t){var n;return(n=this.getColumn(t))==null?void 0:n.custom}}class tE{constructor(t,n,r){C(this,"_rowData");this._config=t,this._viewModel=n,this._rowData=r}getRowData(){return this._rowData}getRowStyle(t){var n;return(n=this._rowData[t])==null?void 0:n.s}setRowStyle(t,n){const r=this.getRowOrCreate(t);r.s=n}getRowDatas(t,n){const r={};let s=0;for(let i=t;i<t+n;i++){const o=this.getRowOrCreate(i);r[s]=o,s++}return r}getRowHeight(t,n=1){const{_rowData:r}=this,s=this._config;let i=0;for(let o=0;o<n;o++){const a=r[o+t]||{hd:Ie.FALSE,h:s.defaultRowHeight},{ia:l,ah:u,h:c=s.defaultRowHeight}=a;i+=(l==null||l===Ie.TRUE)&&typeof u=="number"?u:c}return i}getRow(t){return this._rowData[t]}removeRow(t){delete this._rowData[t]}getRowOrCreate(t){const{_rowData:n}=this,r=n[t];if(r)return r;const s={};return n[t]=s,s}getHiddenRows(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getRowRawVisible(o);s&&a?(s=!1,r.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:Le.ROW})):!s&&!a&&(s=!0,i=o)}return s&&r.push({startRow:i,endRow:n,startColumn:0,endColumn:0,rangeType:Le.ROW}),r}getVisibleRows(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getRowRawVisible(o);s&&!a?(s=!1,r.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:Le.ROW})):!s&&a&&(s=!0,i=o)}return s&&r.push({startRow:i,endRow:n,startColumn:0,endColumn:0,rangeType:Le.ROW}),r}getRowRawVisible(t){const n=this.getRow(t);return n?n.hd!==Ie.TRUE:!0}getSize(){return Kt(this._rowData)}setCustomMetadata(t,n){const r=this.getRow(t);r&&(r.custom=n)}getCustomMetadata(t){var n;return(n=this.getRow(t))==null?void 0:n.custom}}const nE="DEFAULT_WORKSHEET_ROW_COUNT",Ru=1e3,rE="DEFAULT_WORKSHEET_COLUMN_COUNT",Iu=20,sE="DEFAULT_WORKSHEET_ROW_HEIGHT",Su=24,iE="DEFAULT_WORKSHEET_COLUMN_WIDTH",vu=88,oE="DEFAULT_WORKSHEET_ROW_TITLE_WIDTH",Ou=46,aE="DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT",wu=20;function bu(e){const t={name:"Sheet1",id:"sheet-01",tabColor:"",hidden:Ie.FALSE,rowCount:Ru,columnCount:Iu,zoomRatio:1,freeze:{xSplit:0,ySplit:0,startRow:-1,startColumn:-1},scrollTop:0,scrollLeft:0,defaultColumnWidth:vu,defaultRowHeight:Su,mergeData:[],cellData:{},rowData:{},columnData:{},showGridlines:Ie.TRUE,rowHeader:{width:Ou,hidden:Ie.FALSE},columnHeader:{height:wu,hidden:Ie.FALSE},rightToLeft:Ie.FALSE};return Object.keys(t).forEach(n=>{const r=n;typeof e[r]>"u"&&(e[r]=t[r])}),e}class lE extends st{constructor(n){super();C(this,"_cellCache",new Map);C(this,"_rowCache",new Map);C(this,"_columnCache",new Map);C(this,"_hasRow",!1);C(this,"_hasColumn",!1);C(this,"_hasAll",!1);C(this,"_allIndex",-1);C(this,"_mergeData");C(this,"_rangeMap",new qn(5e4));C(this,"_skeletonCache",new qn(5e4));this._init(n.concat())}_init(n){this._mergeData=n,this._createCache(n)}_clearCache(){this._cellCache.clear(),this._rowCache.clear(),this._columnCache.clear(),this._hasAll=!1,this._allIndex=-1,this._rangeMap.clear(),this._skeletonCache.clear(),this._hasColumn=!1,this._hasRow=!1}_createCache(n){let r=0;for(const s of n){const{rangeType:i}=s;i===Le.ROW?this._createRowCache(s,r):i===Le.COLUMN?this._createColumnCache(s,r):i===Le.ALL?this._createCellAllCache(r):this._createCellCache(s,r),r++}}rebuild(n){this._clearCache(),this._init(n.concat())}_createRowCache(n,r){const{startRow:s,endRow:i}=n;for(let o=s;o<=i;o++)this._rowCache.set(o,r),this._hasRow=!0}_createColumnCache(n,r){const{startColumn:s,endColumn:i}=n;for(let o=s;o<=i;o++)this._columnCache.set(o,r),this._hasColumn=!0}_createCellAllCache(n){this._hasAll=!0,this._allIndex=n}_createCellCache(n,r){for(let s=n.startRow;s<=n.endRow;s++){let i=this._cellCache.get(s);i==null&&(i=new Map,this._cellCache.set(s,i));for(let o=n.startColumn;o<=n.endColumn;o++)i.set(o,r)}}add(n){this._mergeData.push(n),this._clearCache(),this._createCache(this._mergeData)}remove(n,r){const s=this._getMergeDataIndex(n,r);s!==-1&&(this._mergeData.splice(s,1),this._clearCache(),this._createCache(this._mergeData))}getMergedCell(n,r){const s=this._getMergeDataIndex(n,r);return s!==-1?this._mergeData[s]:null}getMergeDataIndex(n,r){return this._getMergeDataIndex(n,r)}isRowContainsMergedCell(n){return this._hasAll||!re.isEmptyObject(this._columnCache)?!0:this._mergeData.some(r=>r.startRow<=n&&n<=r.endRow)}isColumnContainsMergedCell(n){return this._hasAll||!re.isEmptyObject(this._rowCache)?!0:this._mergeData.some(r=>r.startColumn<=n&&n<=r.endColumn)}getMergedCellRange(n,r,s,i){const o=[],a=`${n}-${r}-${s}-${i}`;if(this._rangeMap.has(a))return this._getRangeFromCache(a);let l=0;const u=[];for(const c of this._mergeData||[])Jt.intersects(c,{startRow:n,endRow:s,startColumn:r,endColumn:i})&&(o.push({...c}),u.push(l)),l++;return this._rangeMap.set(a,u),o}getMergedCellRangeForSkeleton(n,r,s,i){const o=[],a=this._mergeData,l=`${n}-${r}-${s}-${i}`;if(this._skeletonCache.has(l))return this._getSkeletonRangeFromCache(l);const u=[];for(let c=0;c<a.length;c++){const{startRow:h,endRow:d,startColumn:f,endColumn:p}=a[c];for(let R=n;R<=s;R++){let w=!1;for(let N=r;N<=i;N++)if(R>=h&&R<=d&&N>=f&&N<=p){o.push({startRow:h,endRow:d,startColumn:f,endColumn:p}),u.push(c),w=!0;break}if(w)break}}return this._skeletonCache.set(l,u),o}_getRangeFromCache(n){const r=this._rangeMap.get(n)||[],s=[];for(const i of r)s.push({...this._mergeData[i]});return s}_getSkeletonRangeFromCache(n){const r=this._skeletonCache.get(n)||[],s=[];for(const i of r)s.push({...this._mergeData[i]});return s}_getMergeDataIndex(n,r){var i;if(this._hasAll)return this._allIndex;if(this._hasRow){const o=this._rowCache.get(n);if(o!==void 0)return o}if(this._hasColumn){const o=this._columnCache.get(r);if(o!==void 0)return o}const s=(i=this._cellCache.get(n))==null?void 0:i.get(r);return s!==void 0?s:-1}getMergeDataSnapshot(){return this._mergeData}dispose(){this._clearCache(),this._mergeData=[]}}class Au extends st{constructor(n){super();C(this,"_cellContentInterceptor",null);C(this,"_rowFilteredInterceptor",null);this.getRawCell=n}dispose(){super.dispose(),this._cellContentInterceptor=null,this._rowFilteredInterceptor=null}getCell(n,r,s,i){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,r,Sn.Value|Sn.Style,s,i):this.getRawCell(n,r)}getCellValueOnly(n,r){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,r,Sn.Value):this.getRawCell(n,r)}getCellStyleOnly(n,r){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,r,Sn.Style):this.getRawCell(n,r)}getRowFiltered(n){var r,s;return(s=(r=this._rowFilteredInterceptor)==null?void 0:r.getRowFiltered(n))!=null?s:!1}registerCellContentInterceptor(n){if(this._cellContentInterceptor)throw new Error("[SheetViewModel]: Interceptor already registered.");return this._cellContentInterceptor=n,nt(()=>this._cellContentInterceptor=null)}registerRowFilteredInterceptor(n){if(this._rowFilteredInterceptor)throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowFilteredInterceptor=n,nt(()=>this._rowFilteredInterceptor=null)}}const No={isDeepClone:!1,displayRawFormula:!1,ignoreTextRotation:!1};class er{constructor(t,n,r){C(this,"_sheetId");C(this,"_snapshot");C(this,"_cellData");C(this,"_rowManager");C(this,"_columnManager");C(this,"_viewModel");C(this,"_spanModel");var a;this.unitId=t,this._styles=r,this._snapshot=bu(n);const{columnData:s,rowData:i,cellData:o}=this._snapshot;this._sheetId=(a=this._snapshot.id)!=null?a:re.generateRandomId(6),this._cellData=new At(o),this._viewModel=new Au((l,u)=>this.getCellRaw(l,u)),this._rowManager=new tE(this._snapshot,this._viewModel,i),this._columnManager=new eE(this._snapshot,s),this._spanModel=new lE(this._snapshot.mergeData)}__interceptViewModel(t){t(this._viewModel)}getSnapshot(){return this._snapshot}setMergeData(t){this._snapshot.mergeData=t,this.getSpanModel().rebuild(t)}getSpanModel(){return this._spanModel}getStyleDataByHash(t){return{...this._styles.get(t)}}setStyleData(t){return this._styles.setValue(t)}getColumnStyle(t,n=!1){return n?this._columnManager.getColumnStyle(t):this._styles.get(this._columnManager.getColumnStyle(t))}setColumnStyle(t,n){this._columnManager.setColumnStyle(t,n)}getRowStyle(t,n=!1){return n?this._rowManager.getRowStyle(t):this._styles.get(this._rowManager.getRowStyle(t))}setRowStyle(t,n){this._rowManager.setRowStyle(t,n)}getDefaultCellStyle(){return this._snapshot.defaultStyle}getDefaultCellStyleInternal(){const t=this._snapshot.defaultStyle;return this._styles.get(t)}setDefaultCellStyle(t){this._snapshot.defaultStyle=t}getCellStyle(t,n){const r=this.getCell(t,n);if(r){const s=r.s;return typeof s=="string"?this._styles.get(s):s}return null}getComposedCellStyle(t,n,r=!0){const s=this.getCellStyle(t,n),i=this.getDefaultCellStyleInternal(),o=this.getRowStyle(t),a=this.getColumnStyle(n);return r?As(i,o,a,s):As(i,a,o,s)}getCellMatrix(){return this._cellData}getCellMatrixPrintRange(){const t=this.getCellMatrix(),n=this.getMergeData();let r=-1,s=-1,i=-1,o=-1,a=!1,l=!1;return t.forEach((u,c)=>{Object.keys(c).forEach(h=>{const d=+h,f=t.getValue(u,d),p=f!=null&&f.s?this._styles.get(f.s):null,R=(p==null?void 0:p.bd)&&(p.bd.b||p.bd.l||p.bd.r||p.bd.t||p.bd.bc_tr||p.bd.bl_tr||p.bd.ml_tr||p.bd.tl_bc||p.bd.tl_br||p.bd.tl_mr);(f&&(f.v||f.p)||p!=null&&p.bg||R)&&(a?r=Math.min(r,u):(r=u,a=!0),s=Math.max(s,u),l?i=Math.min(i,d):(l=!0,i=d),o=Math.max(o,d))})}),n.forEach(u=>{a?r=Math.min(r,u.startRow):(r=u.startRow,a=!0),s=Math.max(s,u.endRow),l?i=Math.min(i,u.startColumn):(i=u.startColumn,a=!0),o=Math.max(o,u.endColumn)}),!a||!l?null:{startColumn:i,startRow:r,endColumn:o,endRow:s}}getRowManager(){return this._rowManager}getUnitId(){return this.unitId}getSheetId(){return this._sheetId}getColumnManager(){return this._columnManager}getName(){return this._snapshot.name}clone(){const{_snapshot:t}=this,n=re.deepClone(t);return new er(this.unitId,n,this._styles)}getMergeData(){return this._spanModel.getMergeDataSnapshot()}getMergedCell(t,n){return this._spanModel.getMergedCell(t,n)}getMergedCellRange(t,n,r,s){return this._spanModel.getMergedCellRange(t,n,r,s)}isRowContainsMergedCell(t){return this._spanModel.isRowContainsMergedCell(t)}isColumnContainsMergedCell(t){return this._spanModel.isColumnContainsMergedCell(t)}getCellInfoInMergeData(t,n){const r=this.getMergedCell(t,n);let s=!1,i=!1,o=t,a=n,l=t,u=n;if(r){const{startRow:c,endRow:h,startColumn:d,endColumn:f}=r;t===c&&n===d?(o=h,a=f,l=c,u=d,i=!0):t>=c&&t<=h&&n>=d&&n<=f&&(o=h,a=f,l=c,u=d,s=!0)}return{actualRow:t,actualColumn:n,isMergedMainCell:i,isMerged:s,endRow:o,endColumn:a,startRow:l,startColumn:u}}getCell(t,n){return t<0||n<0?null:this._viewModel.getCell(t,n)}getCellValueOnly(t,n){return t<0||n<0?null:this._viewModel.getCellValueOnly(t,n)}getCellStyleOnly(t,n){return t<0||n<0?null:this._viewModel.getCellStyleOnly(t,n)}getCellRaw(t,n){return this.getCellMatrix().getValue(t,n)}getCellWithFilteredInterceptors(t,n,r,s){return this._viewModel.getCell(t,n,r,s)}getRowFiltered(t){return this._viewModel.getRowFiltered(t)}getMatrixWithMergedCells(t,n,r,s,i=Rn.Raw){const o=this.getCellMatrix(),a=this._spanModel.getMergedCellRange(t,n,r,s),l=new At;return xs(t,r,n,s).forEach((u,c)=>{var d;let h;if(i===Rn.Raw)h=this.getCellRaw(u,c);else if(i===Rn.Intercepted)h=this.getCell(u,c);else if(i===Rn.Both){const f=this.getCellRaw(u,c);if(f){h={...f};const p=(d=this.getCell(u,c))==null?void 0:d.v;Eu(p)&&h&&(h.displayV=String(p))}}h&&l.setValue(u,c,h)}),a.forEach(u=>{const{startColumn:c,startRow:h,endColumn:d,endRow:f}=u;xs(h,f,c,d).forEach((p,R)=>{p===h&&R===c&&l.setValue(p,R,{...o.getValue(p,R),rowSpan:f-h+1,colSpan:d-c+1}),(p!==h||R!==c)&&l.realDeleteValue(p,R)})}),l}getRange(t,n,r,s){return typeof t=="object"?new bn(this,t,{getStyles:()=>this._styles}):new bn(this,{startRow:t,startColumn:n,endColumn:s||n,endRow:r||t},{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:t}=this,{columnCount:n}=t;return n}getMaxRows(){const{_snapshot:t}=this,{rowCount:n}=t;return n}getRowCount(){return this._snapshot.rowCount}setRowCount(t){this._snapshot.rowCount=t}getColumnCount(){return this._snapshot.columnCount}setColumnCount(t){this._snapshot.columnCount=t}isSheetHidden(){return this._snapshot.hidden}hasHiddenGridlines(){const{_snapshot:t}=this,{showGridlines:n}=t;return n===0}getGridlinesColor(){return this.getConfig().gridlinesColor}getTabColor(){const{_snapshot:t}=this,{tabColor:n}=t;return n}getColumnWidth(t){return this.getColumnManager().getColumnWidth(t)}getRowHeight(t){return this._viewModel.getRowFiltered(t)?0:this.getRowManager().getRowHeight(t)}isRowFiltered(t){return this._viewModel.getRowFiltered(t)}getRowVisible(t){return!this.isRowFiltered(t)&&this.getRowRawVisible(t)}getRowRawVisible(t){return this.getRowManager().getRowRawVisible(t)}getHiddenRows(t,n){const r=this.getMaxColumns()-1,s=this._rowManager.getHiddenRows(t,n);return s.forEach(i=>i.endColumn=r),s}getColVisible(t){return this._columnManager.getColVisible(t)}getHiddenCols(t,n){const r=this.getMaxRows()-1,s=this._columnManager.getHiddenCols(t,n);return s.forEach(i=>i.endRow=r),s}getVisibleRows(){const t=this.getRowCount();return this._rowManager.getVisibleRows(0,t-1)}getVisibleCols(){const t=this.getColumnCount();return this._columnManager.getVisibleCols(0,t-1)}isRightToLeft(){const{_snapshot:t}=this,{rightToLeft:n}=t;return n}getLastRowWithContent(){return this._cellData.getLength()-1}getLastColumnWithContent(){return this._cellData.getRange().endColumn}getDataRangeScope(){return this._cellData.getStartEndScope()}cellHasValue(t){return t&&(t.v!==void 0||t.f!==void 0||t.p!==void 0)}iterateByRow(t,n=!0){const{startRow:r,startColumn:s,endRow:i,endColumn:o}=t,a=this;return{[Symbol.iterator]:()=>{let l=r,u=s;return{next(){for(;;){if(u>o&&(l+=1,u=s),l>i)return{done:!0,value:void 0};const c=a.getCell(l,u),h=!c,d=a.getMergedCell(l,u);if(d){if(l!==d.startRow||u!==d.startColumn){u=d.endColumn+1;continue}if(h&&n){u=d.endColumn+1;continue}const p={row:l,col:u,value:c};return p.colSpan=d.endColumn-d.startColumn+1,p.rowSpan=d.endRow-d.startRow+1,u=d.endColumn+1,{done:!1,value:p}}if(h&&n)u+=1;else{const f={row:l,col:u,value:c};return u+=1,{done:!1,value:f}}}}}}}}iterateByColumn(t,n=!0,r=!0){const{startRow:s,startColumn:i,endRow:o,endColumn:a}=t,l=this;return{[Symbol.iterator]:()=>{let u=s,c=i;return{next(){for(;;){if(u>o&&(c+=1,u=s),c>a)return{done:!0,value:void 0};const h=l.getMergedCell(u,c);if(h){const p=u!==h.startRow,R=p||c!==h.startColumn;if(r&&R||!r&&p){u=h.endRow+1;continue}const w=l.getCell(h.startRow,h.startColumn);if(!w&&n){u=h.endRow+1;continue}const G={row:u,col:h.startColumn,value:w};return G.colSpan=h.endColumn-h.startColumn+1,G.rowSpan=h.endRow-h.startRow+1,u=h.endRow+1,{done:!1,value:G}}const d=l.getCell(u,c);if(!d&&n)u+=1;else{const p={row:u,col:c,value:d};return u+=1,{done:!1,value:p}}}}}}}}_getCellDocumentModel(t,n=No){var R;const{isDeepClone:r,displayRawFormula:s,ignoreTextRotation:i}={...No,...n},o=this._styles.getStyleByCell(t);if(!t)return;let a,l="document";const u=Jp(o),c=i?ut.tr:u.textRotation||ut.tr;let h=u.horizontalAlign||ut.ht;const d=u.verticalAlign||ut.vt,f=u.wrapStrategy||ut.tb,p=u.paddingData||Gs;if(t.f&&s)a=Gn(t.f.toString(),{},{verticalAlign:d}),h=ut.ht;else if(t.p){const{centerAngle:w,vertexAngle:N}=Cu(c);a=this._updateConfigAndGetDocumentModel(r?re.deepClone(t.p):t.p,h,p,{horizontalAlign:h,verticalAlign:d,centerAngle:w,vertexAngle:N,wrapStrategy:f,zeroWidthParagraphBreak:1})}else if(t.v!=null){const w=To(o);l=yo(w).fontCache;let N=Tu(t);t.t===Vt.FORCE_STRING&&s&&(N=`'${N}`),a=Gn(N,w,{...u,textRotation:c,cellValueType:t.t})}return a&&t.linkUrl&&t.linkId&&pu(a,t.linkUrl,t.linkId),{documentModel:a,fontString:l,textRotation:c,wrapStrategy:f,verticalAlign:d,horizontalAlign:h,paddingData:p,fill:(R=o==null?void 0:o.bg)==null?void 0:R.rgb}}_updateConfigAndGetDocumentModel(t,n,r,s){var o,a,l,u,c;if(!s||!((o=t.body)!=null&&o.dataStream))return;t.documentStyle||(t.documentStyle={}),t.documentStyle.marginTop=(a=r.t)!=null?a:0,t.documentStyle.marginBottom=(l=r.b)!=null?l:2,t.documentStyle.marginLeft=(u=r.l)!=null?u:2,t.documentStyle.marginRight=(c=r.r)!=null?c:2,t.documentStyle.pageSize={width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY},t.documentStyle.renderConfig={...t.documentStyle.renderConfig,...s};const i=t.body.paragraphs||[];for(const h of i)h.paragraphStyle||(h.paragraphStyle={}),h.paragraphStyle.horizontalAlign=n;return new yt(t)}getBlankCellDocumentModel(t){const n=this._getCellDocumentModel(t,{ignoreTextRotation:!0}),r=this._styles.getStyleByCell(t),s=To(r);if(n!=null)return n.documentModel==null&&(n.documentModel=Gn("",s)),n;const i="";let o="document";const a=ut.tr,l=ut.ht,u=ut.vt,c=ut.tb,h=Gs;return o=yo({}).fontCache,{documentModel:Gn(i,s),fontString:o,textRotation:a,wrapStrategy:c,verticalAlign:u,horizontalAlign:l,paddingData:h}}getCellDocumentModelWithFormula(t){return this._getCellDocumentModel(t,{isDeepClone:!0,displayRawFormula:!0,ignoreTextRotation:!0})}getCustomMetadata(){return this._snapshot.custom}setCustomMetadata(t){this._snapshot.custom=t}}function Tu(e){var r,s;if(!e)return"";const t=(s=(r=e.p)==null?void 0:r.body)==null?void 0:s.dataStream;if(t)return ot.transform.getPlainText(t);const n=e.v;return typeof n=="string"?e.t===Vt.BOOLEAN?n.toUpperCase():n.replace(/[\r\n]/g,""):typeof n=="number"?e.t===Vt.BOOLEAN?n?"TRUE":"FALSE":n.toString():typeof n=="boolean"?n?"TRUE":"FALSE":""}function uE(e){if(e===null)return"";if(e!=null&&e.p){const t=e==null?void 0:e.p.body;if(t==null)return"";const n=t.dataStream;return ot.transform.getPlainText(n)}return e==null?void 0:e.v}var cE=Object.getOwnPropertyDescriptor,hE=(e,t,n,r)=>{for(var s=r>1?void 0:r?cE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},dE=(e,t)=>(n,r)=>t(n,r,e);function fE(e,t){return`${e.getUnitId()}|${t.getSheetId()}`}exports.Workbook=class extends ss{constructor(n={},r){super();C(this,"type",$e.UNIVER_SHEET);C(this,"_sheetCreated$",new we.Subject);C(this,"sheetCreated$",this._sheetCreated$.asObservable());C(this,"_sheetDisposed$",new we.Subject);C(this,"sheetDisposed$",this._sheetDisposed$.asObservable());C(this,"_activeSheet$",new we.BehaviorSubject(null));C(this,"activeSheet$",this._activeSheet$.asObservable());C(this,"_worksheets");C(this,"_styles");C(this,"_snapshot");C(this,"_unitId");C(this,"_count");C(this,"_name$");C(this,"name$");this._logService=r;const s=Vp();re.isEmptyObject(n)?this._snapshot=s:this._snapshot=re.commonExtend(s,n);const{styles:i}=this._snapshot;(this._snapshot.id==null||this._snapshot.id.length===0)&&(this._snapshot.id=re.generateRandomId(6)),this._unitId=this._snapshot.id,this._styles=new _u(i),this._count=1,this._worksheets=new Map,this._name$=new we.BehaviorSubject(n.name||""),this.name$=this._name$.asObservable(),this._parseWorksheetSnapshots()}get _activeSheet(){return this._activeSheet$.getValue()}get name(){return this._name$.getValue()}static isIRangeType(n){return typeof n=="string"||"startRow"in n||"row"in n}dispose(){super.dispose(),this._sheetCreated$.complete(),this._sheetDisposed$.complete(),this._activeSheet$.complete(),this._name$.complete()}save(){return re.deepClone(this._snapshot)}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}setRev(n){this._snapshot.rev=n}addWorksheet(n,r,s){const{sheets:i,sheetOrder:o}=this._snapshot;if(i[n])return!1;i[n]=s,o.splice(r,0,n);const a=new er(this._unitId,s,this._styles);return this._worksheets.set(n,a),this._sheetCreated$.next(a),!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:r}=this._snapshot;return r.findIndex(s=>s===n)}getActiveSheet(n){if(!this._activeSheet&&typeof n>"u")throw new Error(`[Workbook]: no active Worksheet on Workbook ${this._unitId}!`);return this._activeSheet}ensureActiveSheet(){const n=this._activeSheet;if(n)return n;const r=this._snapshot.sheetOrder;for(let i=0,o=r.length;i<o;i++){const a=this._worksheets.get(r[i]);if(a&&a.isSheetHidden()!==Ie.TRUE)return this.setActiveSheet(a),a}const s=this._worksheets.get(r[0]);return this.setActiveSheet(s),s}setActiveSheet(n){this._activeSheet$.next(n)}removeSheet(n){const r=this._worksheets.get(n);return r?(this._worksheets.delete(n),this._snapshot.sheetOrder.splice(this._snapshot.sheetOrder.indexOf(n),1),delete this._snapshot.sheets[n],this._sheetDisposed$.next(r),!0):!1}getActiveSheetIndex(){const{sheetOrder:n}=this._snapshot;return n.findIndex(r=>this._worksheets.get(r)===this._activeSheet)}getSheetSize(){return this._snapshot.sheetOrder.length}getSheets(){const{sheetOrder:n}=this._snapshot;return n.map(r=>this._worksheets.get(r))}getSheetsName(){const{sheetOrder:n}=this._snapshot,r=[];return n.forEach(s=>{const i=this._worksheets.get(s);i&&r.push(i.getName())}),r}getSheetIndex(n){const{sheetOrder:r}=this._snapshot;return r.findIndex(s=>n.getSheetId()===s)}getSheetBySheetName(n){const{sheetOrder:r}=this._snapshot,s=r.find(i=>this._worksheets.get(i).getName()===n);return this._worksheets.get(s)}getSheetBySheetId(n){return this._worksheets.get(n)}getSheetByIndex(n){const{sheetOrder:r}=this._snapshot;return this._worksheets.get(r[n])}getHiddenWorksheets(){return this.getSheets().filter(n=>n.getConfig().hidden===Ie.TRUE).map(n=>n.getConfig().id)}getUnhiddenWorksheets(){return this.getSheets().filter(n=>n.getConfig().hidden!==Ie.TRUE).map(n=>n.getConfig().id)}load(n){this._snapshot=n}checkSheetName(n){return this.getSheetsName().includes(n)}uniqueSheetName(n="Sheet1"){let r=n;for(;this.checkSheetName(r);)r=n+this._count,this._count++;return r}generateNewSheetName(n){let r=n+this._count;for(;this.checkSheetName(r);)r=n+this._count,this._count++;return r}_parseWorksheetSnapshots(){const{_snapshot:n,_worksheets:r}=this,{sheets:s,sheetOrder:i}=n;if(re.isEmptyObject(s)){const o=re.generateRandomId();s[o]={id:o}}for(const o in s){const a=s[o],{name:l}=a;a.name=this.uniqueSheetName(l),a.name!==l&&this._logService.debug("[Workbook]",`The worksheet name ${l} is duplicated, we changed it to ${a.name}. Please fix the problem in your snapshot.`);const u=new er(this._unitId,a,this._styles);r.set(o,u),i.includes(o)||i.push(o)}this.ensureActiveSheet()}getCustomMetadata(){return this._snapshot.custom}setCustomMetadata(n){this._snapshot.custom=n}};exports.Workbook=hE([dE(1,wt)],exports.Workbook);class Si extends ss{constructor(n){var r;super();C(this,"type",$e.UNIVER_SLIDE);C(this,"_activePage$",new we.BehaviorSubject(null));C(this,"activePage$",this._activePage$.asObservable());C(this,"_name$");C(this,"name$");C(this,"_snapshot");C(this,"_unitId");this._snapshot={...ol,...n},this._unitId=(r=this._snapshot.id)!=null?r:re.generateRandomId(6),this._name$=new we.BehaviorSubject(this._snapshot.title),this.name$=this._name$.asObservable()}get _activePage(){var r,s;const n=this._activePage$.getValue();if(!n){const i=(r=this.getPageOrder())==null?void 0:r[0];return i?(s=this.getPages())==null?void 0:s[i]:null}return n}setName(n){var r;this._snapshot.title=n,this._name$.next(n),this._unitId=(r=this._snapshot.id)!=null?r:kt(6)}getRev(){return 0}incrementRev(){}setRev(n){}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 r=this.getPages();return r==null?void 0:r[n]}getElementsByPage(n){var r;return(r=this.getPage(n))==null?void 0:r.pageElements}getElement(n,r){var s;return(s=this.getElementsByPage(n))==null?void 0:s[r]}getPageSize(){return this._snapshot.pageSize}getBlankPage(){const n=kt(6);return{id:n,pageType:ri.SLIDE,zIndex:10,title:n,description:"",pageBackgroundFill:{rgb:"rgb(255,255,255)"},pageElements:{}}}setActivePage(n){this._activePage$.next(n)}getActivePage(){return this._activePage}updatePage(n,r){this._snapshot.body&&(this._snapshot.body.pages[n]=r)}appendPage(n){var i;if(!this._snapshot.body)return;this._snapshot.body.pages[n.id]=n;const r=this._activePage,s=this._snapshot.body.pageOrder.indexOf((i=r==null?void 0:r.id)!=null?i:"");this._snapshot.body.pageOrder.splice(s+1,0,n.id)}}var gE=Object.getOwnPropertyDescriptor,mE=(e,t,n,r)=>{for(var s=r>1?void 0:r?gE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Mo=(e,t)=>(n,r)=>t(n,r,e);const yn=je.createIdentifier("univer.current");exports.UniverInstanceService=class extends st{constructor(n,r){super();C(this,"_unitsByType",new Map);C(this,"_createHandler");C(this,"_ctorByType",new Map);C(this,"_currentUnits",new Map);C(this,"_currentUnits$",new we.BehaviorSubject(this._currentUnits));C(this,"currentUnits$",this._currentUnits$.asObservable());C(this,"_unitAdded$",new we.Subject);C(this,"unitAdded$",this._unitAdded$.asObservable());C(this,"_unitDisposed$",new we.Subject);C(this,"unitDisposed$",this._unitDisposed$.asObservable());C(this,"_focused$",new we.BehaviorSubject(null));C(this,"focused$",this._focused$.asObservable());this._injector=n,this._contextService=r}dispose(){super.dispose(),this._focused$.complete()}__setCreateHandler(n){this._createHandler=n}createUnit(n,r,s){return this._createHandler(n,r,this._ctorByType.get(n),s)}registerCtorForType(n,r){return this._ctorByType.set(n,r),{dispose:()=>{this._ctorByType.delete(n)}}}getCurrentTypeOfUnit$(n){return this.currentUnits$.pipe(we.map(r=>{var s;return(s=r.get(n))!=null?s:null}),we.distinctUntilChanged())}getCurrentUnitForType(n){return this._currentUnits.get(n)}getCurrentUnitOfType(n){return this.getCurrentUnitForType(n)}setCurrentUnitForType(n){const r=this._getUnitById(n);if(!r)throw new Error(`[UniverInstanceService]: no document with unitId ${n}!`);this._currentUnits.set(r[1],r[0]),this._currentUnits$.next(this._currentUnits)}getTypeOfUnitAdded$(n){return this._unitAdded$.pipe(we.filter(r=>r.type===n))}__addUnit(n,r){var a;const s=n.type;this._unitsByType.has(s)||this._unitsByType.set(s,[]);const i=this._unitsByType.get(s),o=n.getUnitId();if(i.findIndex(l=>l.getUnitId()===o)!==-1)throw new Error(`[UniverInstanceService]: cannot create a unit with the same unit id: ${o}.`);i.push(n),this._unitAdded$.next(n),((a=r==null?void 0:r.makeCurrent)==null||a)&&this.setCurrentUnitForType(n.getUnitId())}getTypeOfUnitDisposed$(n){return this.unitDisposed$.pipe(we.filter(r=>r.type===n))}getUnit(n,r){var i;const s=(i=this._getUnitById(n))==null?void 0:i[0];return r&&(s==null?void 0:s.type)!==r?null:s}getCurrentUniverDocInstance(){return this.getCurrentUnitForType($e.UNIVER_DOC)}getUniverDocInstance(n){return this.getUnit(n,$e.UNIVER_DOC)}getUniverSheetInstance(n){return this.getUnit(n,$e.UNIVER_SHEET)}getAllUnitsForType(n){var r;return(r=this._unitsByType.get(n))!=null?r:[]}changeDoc(n,r){const s=this.getAllUnitsForType($e.UNIVER_DOC),i=s.find(o=>o.getUnitId()===n);if(i!=null){const o=s.indexOf(i);s.splice(o,1)}this.__addUnit(r)}get focused(){var r;const n=this._focused$.getValue();return n?(r=this._getUnitById(n))==null?void 0:r[0]:null}focusUnit(n){this._focused$.next(n),this.focused instanceof exports.Workbook?(this._contextService.setContextValue(Wn,!0),this._contextService.setContextValue(Yn,!1),this._contextService.setContextValue(vn,!0),this._contextService.setContextValue(zn,!1),this.setCurrentUnitForType(n)):this.focused instanceof yt?(this._contextService.setContextValue(Wn,!0),this._contextService.setContextValue(Yn,!0),this._contextService.setContextValue(vn,!1),this._contextService.setContextValue(zn,!1),this.setCurrentUnitForType(n)):this.focused instanceof Si?(this._contextService.setContextValue(Wn,!0),this._contextService.setContextValue(Yn,!1),this._contextService.setContextValue(vn,!1),this._contextService.setContextValue(zn,!0),this.setCurrentUnitForType(n)):(this._contextService.setContextValue(Wn,!1),this._contextService.setContextValue(Yn,!1),this._contextService.setContextValue(vn,!1),this._contextService.setContextValue(zn,!1))}getFocusedUnit(){return this.focused}getUnitType(n){const r=this._getUnitById(n);return r?r[1]:$e.UNRECOGNIZED}disposeUnit(n){const r=this._getUnitById(n);if(!r)return!1;const[s,i]=r,o=this._unitsByType.get(i),a=o.indexOf(s);return o.splice(a,1),this._tryResetCurrentOnRemoval(n,i),this._tryResetFocusOnRemoval(n),this._unitDisposed$.next(s),!0}_tryResetCurrentOnRemoval(n,r){const s=this.getCurrentUnitForType(r);(s==null?void 0:s.getUnitId())===n&&(this._currentUnits.set(r,null),this._currentUnits$.next(this._currentUnits))}_tryResetFocusOnRemoval(n){var r;((r=this.focused)==null?void 0:r.getUnitId())===n&&this._focused$.next(null)}_getUnitById(n){for(const[r,s]of this._unitsByType){const i=s.find(o=>o.getUnitId()===n);if(i)return[i,r]}}};exports.UniverInstanceService=mE([Mo(0,je.Inject(je.Injector)),Mo(1,Nn)],exports.UniverInstanceService);var Je=(e=>(e[e.Starting=0]="Starting",e[e.Ready=1]="Ready",e[e.Rendered=2]="Rendered",e[e.Steady=3]="Steady",e))(Je||{});const _E={0:"Starting",1:"Ready",2:"Rendered",3:"Steady"};var pE=Object.getOwnPropertyDescriptor,EE=(e,t,n,r)=>{for(var s=r>1?void 0:r?pE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},CE=(e,t)=>(n,r)=>t(n,r,e);exports.LifecycleService=class extends st{constructor(n){super();C(this,"_lifecycle$",new we.BehaviorSubject(Je.Starting));C(this,"lifecycle$",this._lifecycle$.asObservable());C(this,"_lock",!1);this._logService=n,this._reportProgress(Je.Starting)}get stage(){return this._lifecycle$.getValue()}set stage(n){if(this._lock)throw new Error("[LifecycleService]: cannot set new stage when related logic is all handled!");if(n<this.stage)throw new Error("[LifecycleService]: lifecycle stage cannot go backward!");n!==this.stage&&(this._lock=!0,this._reportProgress(n),this._lifecycle$.next(n),this._lock=!1)}dispose(){this._lifecycle$.complete(),super.dispose()}onStage(n){return we.firstValueFrom(this.lifecycle$.pipe(we.filter(r=>r>=n),bs(r=>r===n),we.map(()=>{})))}subscribeWithPrevious(){return we.merge(yu(this.stage),this._lifecycle$.pipe(we.skip(1))).pipe(bs(n=>n===Je.Steady))}_reportProgress(n){this._logService.debug("[LifecycleService]",`lifecycle progressed to "${_E[n]}".`)}};exports.LifecycleService=EE([CE(0,wt)],exports.LifecycleService);function yu(e){switch(e){case Je.Starting:return we.of(Je.Starting);case Je.Ready:return we.of(Je.Starting,Je.Ready);case Je.Rendered:return we.of(Je.Starting,Je.Ready,Je.Rendered);default:return we.of(Je.Starting,Je.Ready,Je.Rendered,Je.Steady)}}const RE=je.createIdentifier("ILocalStorageService");class on extends st{constructor(){super();C(this,"_currentLocale$",new we.BehaviorSubject(sr.ZH_CN));C(this,"currentLocale$",this._currentLocale$.asObservable());C(this,"_locales",null);C(this,"localeChanged$",new we.Subject);C(this,"t",(n,...r)=>{if(!this._locales)throw new Error("[LocaleService]: Locale not initialized");const s=n.split("."),i=this.resolveKeyPath(this._locales[this._currentLocale],s);if(typeof i=="string"){let o=i;return r.forEach((a,l)=>{o=o.replace(`{${l}}`,a)}),o}else return n});this.disposeWithMe(nt(()=>this.localeChanged$.complete()))}get _currentLocale(){return this._currentLocale$.value}load(n){var r;this._locales=di((r=this._locales)!=null?r:{},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,r){const s=r.shift();if(s&&n&&s in n){const i=n[s];return r.length>0&&(typeof i=="object"||Array.isArray(i))?this.resolveKeyPath(i,r):i}return null}}var vi=(e=>(e.INIT="init",e.FETCHING="fetching",e.DONE="done",e))(vi||{});const Nu=je.createIdentifier("univer.permission-service");class Mu extends st{constructor(){super(...arguments);C(this,"_permissionPointMap",new Map);C(this,"_permissionPointUpdate$",new we.Subject);C(this,"permissionPointUpdate$",this._permissionPointUpdate$.asObservable());C(this,"_showComponents",!0)}setShowComponents(n){this._showComponents=n}getShowComponents(){return this._showComponents}deletePermissionPoint(n){const r=this._permissionPointMap.get(n);r&&(r.complete(),this._permissionPointMap.delete(n))}addPermissionPoint(n){const r=n instanceof we.BehaviorSubject,s=r?n.getValue():n;if(!s.id)return!1;if(this._permissionPointMap.get(s.id))throw new Error(`${s.id} PermissionPoint already exists`);return this._permissionPointMap.set(s.id,r?n:new we.BehaviorSubject(s)),this._permissionPointUpdate$.next(s),!0}updatePermissionPoint(n,r){const s=this._permissionPointMap.get(n);if(!s)return;const i=s.getValue();i.value=r,i.status=vi.DONE,s.next(i),this._permissionPointUpdate$.next(i)}clearPermissionMap(){this._permissionPointMap.clear()}getPermissionPoint(n){const r=this._permissionPointMap.get(n);if(r)return r.getValue()}getPermissionPoint$(n){const r=this._permissionPointMap.get(n);if(r)return r}composePermission$(n){const r=n.map(s=>{var o;const i=(o=this._permissionPointMap)==null?void 0:o.get(s);if(!i)throw new Error(`[PermissionService]: ${s} permissionPoint does not exist!`);return i.asObservable()});return we.combineLatest(r).pipe(br.map(s=>s))}composePermission(n){return n.map(s=>{var o;const i=(o=this._permissionPointMap)==null?void 0:o.get(s);if(!i)throw new Error(`[PermissionService]: ${s} permissionPoint does not exist!`);return i.getValue()})}getAllPermissionPoint(){const n=new Map;return this._permissionPointMap.forEach((r,s)=>{n.set(s,r)}),n}}var IE=Object.getOwnPropertyDescriptor,SE=(e,t,n,r)=>{for(var s=r>1?void 0:r?IE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Is=(e,t)=>(n,r)=>t(n,r,e);const vE=4,Du=Symbol("DependentOn");class Vs extends st{onStarting(){}onReady(){}onRendered(){}onSteady(){}getUnitType(){return this.constructor.type}getPluginName(){return this.constructor.pluginName}}C(Vs,"pluginName"),C(Vs,"type",$e.UNIVER_UNKNOWN);class OE{constructor(){C(this,"_plugins",[])}addPlugin(t){this._plugins.push(t)}removePlugins(){const t=this._plugins.slice();return this._plugins.length=0,t}forEachPlugin(t){this._plugins.forEach(t)}}function wE(...e){return function(t){t[Du]=e}}exports.PluginService=class{constructor(t,n,r){C(this,"_pluginRegistry",new Map);C(this,"_pluginStore",new OE);C(this,"_seenPlugins",new Set);C(this,"_loadedPlugins",new Set);C(this,"_loadedPluginTypes",new Set([$e.UNIVER_UNKNOWN]));C(this,"_flushTimerByType",new Map);this._injector=t,this._lifecycleService=n,this._logService=r}dispose(){this._pluginStore.removePlugins().forEach(t=>t.dispose()),this._flushTimerByType.forEach(t=>clearTimeout(t))}registerPlugin(t,n){this._assertPluginValid(t);const r={plugin:t,options:n};this._pluginRegistry.set(t.pluginName,r),this._logService.debug("[PluginService]",`Plugin "${t.pluginName}" registered.`);const{type:s}=t;this._loadedPluginTypes.has(s)&&(s===$e.UNIVER_UNKNOWN?this._loadFromPlugins([r]):this._flushType(s))}startPluginsForType(t){this._loadedPluginTypes.has(t)||this._loadPluginsForType(t)}_loadPluginsForType(t){const n=Array.from(this._pluginRegistry.keys()),r=[];n.forEach(s=>{const i=this._pluginRegistry.get(s);i.plugin.type===t&&r.push(i)}),this._loadFromPlugins(r),this._loadedPluginTypes.add(t)}_assertPluginValid(t){const{type:n,pluginName:r}=t;if(n===$e.UNRECOGNIZED)throw new Error(`[PluginService]: invalid plugin type for ${t.name}. Please assign a "type" to your plugin.`);if(!r)throw new Error(`[PluginService]: no plugin name for ${t.name}. Please assign a "pluginName" to your plugin.`);if(this._seenPlugins.has(r))throw new Error(`[PluginService]: duplicated plugin name for "${r}". Maybe a plugin that dependents on "${r} has already registered it. In that case please register "${r}" before the that plugin.`);this._seenPlugins.add(t.pluginName)}_flushType(t){this._flushTimerByType.get(t)===void 0&&this._flushTimerByType.set(t,setTimeout(()=>{this._loadPluginsForType(t),this._flushTimerByType.delete(t)},vE))}_loadFromPlugins(t){const n=[],r=new Set,s=o=>{const{plugin:a}=o,{pluginName:l}=a;if(this._loadedPlugins.has(l)||r.has(l))return;r.add(l),this._pluginRegistry.delete(l);const u=a[Du];u&&u.forEach(c=>{const h=this._pluginRegistry.get(c.pluginName);if(h)s(h);else if(!this._seenPlugins.has(c.pluginName)&&!r.has(c.pluginName)){if(a.type===$e.UNIVER_UNKNOWN&&c.type!==$e.UNIVER_UNKNOWN)throw new Error(`[PluginService]: cannot register a plugin with Univer type that depends on a plugin with other type. The dependent is ${a.pluginName} and the dependency is ${c.pluginName}.`);a.type!==c.type&&c.type!==$e.UNIVER_UNKNOWN&&this._logService.debug("[PluginService]",`Plugin "${l}" depends on "${c.pluginName}" which has different type.`),this._logService.debug("[PluginService]",`Plugin "${l}" depends on "${c.pluginName}" which is not registered. Univer will automatically register it with default configuration.`),this._assertPluginValid(c),s({plugin:c,options:void 0})}}),n.push(o)};t.forEach(o=>s(o));const i=n.map(o=>this._initPlugin(o.plugin,o.options));this._pluginsRunLifecycle(i)}_pluginsRunLifecycle(t){const n=this._lifecycleService.stage;if(yu(n).subscribe(r=>this._runStage(t,r)),n!==Je.Steady){const r=this._lifecycleService.lifecycle$.pipe(we.skip(1)).subscribe(s=>{this._runStage(t,s),s===Je.Steady&&r.unsubscribe()})}}_runStage(t,n){t.forEach(r=>{switch(n){case Je.Starting:r.onStarting();break;case Je.Ready:r.onReady();break;case Je.Rendered:r.onRendered();break;case Je.Steady:r.onSteady();break}})}_initPlugin(t,n){const r=this._injector.createInstance(t,n);return this._pluginStore.addPlugin(r),this._loadedPlugins.add(t.pluginName),this._logService.debug("[PluginService]",`Plugin "${r.getPluginName()}" loaded.`),r}};exports.PluginService=SE([Is(0,je.Inject(je.Injector)),Is(1,je.Inject(exports.LifecycleService)),Is(2,wt)],exports.PluginService);function Lu(e,t){if(!t)return e;const n=[];for(const r of e){const s=t.find(([i])=>i===r[0]);if(s){if(s[1]===null)continue;n.push([r[0],s[1]])}else n.push(r)}return n}const Ks=je.createIdentifier("resource-loader-service");class xu extends st{constructor(){super(...arguments);C(this,"_resourceMap",new Map);C(this,"_register$",new we.Subject);C(this,"register$",this._register$.asObservable())}getAllResourceHooks(){return[...this._resourceMap.values()]}getResources(n,r){return r?this.getResourcesByType(n,r):this.getAllResourceHooks().map(o=>{const a=o.toJson(n);return{name:o.pluginName,data:a}})}getResourcesByType(n,r){return this.getAllResourceHooks().filter(o=>o.businesses.includes(r)).map(o=>{const a=o.toJson(n);return{name:o.pluginName,data:a}})}registerPluginResource(n){const r=n.pluginName;if(this._resourceMap.has(r))throw new Error(`the pluginName is registered {${r}}`);return this._resourceMap.set(r,n),this._register$.next(n),nt(()=>this._resourceMap.delete(r))}disposePluginResource(n){this._resourceMap.delete(n)}loadResources(n,r){this.getAllResourceHooks().forEach(s=>{var o;const i=(o=r==null?void 0:r.find(a=>a.name===s.pluginName))==null?void 0:o.data;if(i)try{const a=s.parseJson(i);s.onLoad(n,a)}catch{console.error("LoadResources Error!")}})}unloadResources(n){this.getAllResourceHooks().forEach(r=>{r.onUnLoad(n)})}dispose(){this._register$.complete(),this._resourceMap.clear()}}class Oi extends st{constructor(){super();C(this,"_currentTheme");C(this,"_currentTheme$",new we.BehaviorSubject({}));C(this,"currentTheme$",this._currentTheme$.asObservable());this.disposeWithMe(nt(()=>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)}}var bE=Object.getOwnPropertyDescriptor,AE=(e,t,n,r)=>{for(var s=r>1?void 0:r?bE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Ss=(e,t)=>(n,r)=>t(n,r,e);const os=je.createIdentifier("univer.undo-redo.service"),TE=20;class Uu{dispose(){}async dispatchToHandlers(){return!1}}const Pu="univer.command.redo",ku="univer.command.undo",Fu=new class extends Uu{constructor(){super(...arguments);C(this,"type",nr.COMMAND);C(this,"id",ku)}handler(t){const n=t.get(os),r=n.pitchTopUndoElement();if(!r)return!1;const s=t.get(rr);return Xr(r.undoMutations,s)?(n.popUndoToRedo(),!0):!1}},$u=new class extends Uu{constructor(){super(...arguments);C(this,"type",nr.COMMAND);C(this,"id",Pu)}handler(t){const n=t.get(os),r=n.pitchTopRedoElement();if(!r)return!1;const s=t.get(rr);return Xr(r.redoMutations,s)?(n.popRedoToUndo(),!0):!1}};exports.LocalUndoRedoService=class extends st{constructor(n,r,s){super();C(this,"undoRedoStatus$");C(this,"_undoRedoStatus$",new we.BehaviorSubject({undos:0,redos:0}));C(this,"_undoStacks",new Map);C(this,"_redoStacks",new Map);C(this,"_batchingStatus",new Map);this._univerInstanceService=n,this._commandService=r,this._contextService=s,this.undoRedoStatus$=this._undoRedoStatus$.asObservable(),this.disposeWithMe(this._commandService.registerCommand(Fu)),this.disposeWithMe(this._commandService.registerCommand($u)),this.disposeWithMe(nt(()=>this._undoRedoStatus$.complete())),this.disposeWithMe(nt(this._univerInstanceService.focused$.subscribe(()=>this._updateStatus())))}pushUndoRedo(n){const{unitID:r}=n,s=this._getRedoStack(r,!0),i=this._getUndoStack(r,!0);if(s.length=0,this._batchingStatus.has(n.unitID)){const a=this._batchingStatus.get(n.unitID),l=this._pitchUndoElement(n.unitID);a===0||!l?(o(n),this._batchingStatus.set(n.unitID,1)):this._tryBatchingElements(l,n)}else o(n);function o(a){i.push(a),i.length>TE&&i.splice(0,1)}this._updateStatus()}clearUndoRedo(n){const r=this._getRedoStack(n);r&&(r.length=0);const s=this._getUndoStack(n);s&&(s.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 r=this._getUndoStack(n);return r!=null&&r.length?r[r.length-1]:null}_pitchRedoElement(n){const r=this._getRedoStack(n);return r!=null&&r.length?r[r.length-1]:null}popUndoToRedo(){const r=this._getUndoStackForFocused().pop();r&&(this._getRedoStackForFocused().push(r),this._updateStatus())}popRedoToUndo(){const r=this._getRedoStackForFocused().pop();r&&(this._getUndoStackForFocused().push(r),this._updateStatus())}rollback(n,r){const s=r||this._getFocusedUnitId(),i=this._getUndoStack(s),o=i==null?void 0:i[(i==null?void 0:i.length)-1];o&&o.id===n&&(i.pop(),Xr(o.undoMutations,this._commandService))}__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),nt(()=>this._batchingStatus.delete(n))}_updateStatus(){var i,o;const n=this._getFocusedUnitId(),r=n&&((i=this._undoStacks.get(n))==null?void 0:i.length)||0,s=n&&((o=this._redoStacks.get(n))==null?void 0:o.length)||0;this._undoRedoStatus$.next({undos:r,redos:s})}_getUndoStack(n,r=!1){let s=this._undoStacks.get(n);return!s&&r&&(s=[],this._undoStacks.set(n,s)),s||null}_getRedoStack(n,r=!1){let s=this._redoStacks.get(n);return!s&&r&&(s=[],this._redoStacks.set(n,s)),s||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,r){n.redoMutations.push(...r.redoMutations),n.undoMutations.push(...r.undoMutations)}_getFocusedUnitId(){var o,a,l,u;let n="";const r=this._contextService.getContextValue(vn),s=this._contextService.getContextValue(gu),i=this._contextService.getContextValue(fu);return r?s?n=ti:i?n=ei:n=(a=(o=this._univerInstanceService.getFocusedUnit())==null?void 0:o.getUnitId())!=null?a:"":n=(u=(l=this._univerInstanceService.getFocusedUnit())==null?void 0:l.getUnitId())!=null?u:"",n}};exports.LocalUndoRedoService=AE([Ss(0,yn),Ss(1,rr),Ss(2,Nn)],exports.LocalUndoRedoService);function yE(e){return!(e.length===0||e.length>31||e.startsWith("'")||e.endsWith("'")||/[:\\\/\?\*\[\]]/.test(e))}function NE(e){return new Promise(t=>setTimeout(t,e))}function ME(e=1){return new Promise(t=>{let n=0;const r=()=>{n++,n>=e?t():requestAnimationFrame(r)};requestAnimationFrame(r)})}var wi=(e=>(e.URL="URL",e.UUID="UUID",e.BASE64="BASE64",e))(wi||{}),Bu=(e=>(e.SUCCUSS="0",e.ERROR_EXCEED_SIZE="1",e.ERROR_IMAGE_TYPE="2",e.ERROR_UPLOAD_COUNT_LIMIT="3",e.ERROR_IMAGE="4",e))(Bu||{});const Xs=je.createIdentifier("core.image-io.service");class Hu{constructor(t,n=100){C(this,"_imageCacheMap");this._injector=t,this._imageCacheMap=new qn(n)}_getImageCacheKey(t,n){return`${t}-${n}`}getImage(t,n,r,s){const i=this._getImageCacheKey(t,n);let o=this._imageCacheMap.get(i);return o||((async()=>{o=new Image;const a=this._injector.has(Xs)?this._injector.get(Xs):null;if(t===wi.UUID)try{o.src=await(a==null?void 0:a.getImage(n))||""}catch(l){console.error(l)}else o.src=n;o.onload=()=>{r==null||r()},o.onerror=()=>{s==null||s()},this._imageCacheMap.set(i,o)})(),null)}}const DE=["script","style","meta","comment","link"];var ju=(e=>(e[e.INFO=0]="INFO",e[e.STOP=1]="STOP",e[e.WARNING=2]="WARNING",e))(ju||{}),Wu=(e=>(e[e.DISABLED=0]="DISABLED",e[e.FULL_ALPHA=1]="FULL_ALPHA",e[e.FULL_HANGUL=2]="FULL_HANGUL",e[e.FULL_KATAKANA=3]="FULL_KATAKANA",e[e.HALF_ALPHA=4]="HALF_ALPHA",e[e.HALF_HANGUL=5]="HALF_HANGUL",e[e.HALF_KATAKANA=6]="HALF_KATAKANA",e[e.HIRAGANA=7]="HIRAGANA",e[e.NO_CONTROL=8]="NO_CONTROL",e[e.OFF=9]="OFF",e[e.ON=10]="ON",e))(Wu||{}),Yu=(e=>(e.BETWEEN="between",e.EQUAL="equal",e.GREATER_THAN="greaterThan",e.GREATER_THAN_OR_EQUAL="greaterThanOrEqual",e.LESS_THAN="lessThan",e.LESS_THAN_OR_EQUAL="lessThanOrEqual",e.NOT_BETWEEN="notBetween",e.NOT_EQUAL="notEqual",e))(Yu||{}),zu=(e=>(e[e.TEXT=0]="TEXT",e[e.ARROW=1]="ARROW",e[e.CUSTOM=2]="CUSTOM",e))(zu||{}),Gu=(e=>(e.VALID="valid",e.INVALID="invalid",e.VALIDATING="validating",e))(Gu||{}),Vu=(e=>(e.CUSTOM="custom",e.LIST="list",e.LIST_MULTIPLE="listMultiple",e.NONE="none",e.TEXT_LENGTH="textLength",e.DATE="date",e.TIME="time",e.WHOLE="whole",e.DECIMAL="decimal",e.CHECKBOX="checkbox",e.ANY="any",e))(Vu||{}),LE=Object.getOwnPropertyDescriptor,xE=(e,t,n,r)=>{for(var s=r>1?void 0:r?LE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},UE=(e,t)=>(n,r)=>t(n,r,e);exports.Skeleton=class extends st{constructor(n){super();C(this,"_fontLocale");C(this,"_dirty",!0);this._localeService=n,this._localeInitial()}get dirty(){return this._dirty}getFontLocale(){return this._fontLocale}makeDirty(n){this._dirty=n}dispose(){super.dispose(),this._fontLocale=null}_localeInitial(){}};exports.Skeleton=xE([UE(0,je.Inject(on))],exports.Skeleton);var PE=Object.getOwnPropertyDescriptor,kE=(e,t,n,r)=>{for(var s=r>1?void 0:r?PE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},wr=(e,t)=>(n,r)=>t(n,r,e);exports.SheetSkeleton=class extends exports.Skeleton{constructor(n,r,s,i,o,a){super(s);C(this,"_worksheetData");C(this,"_renderRawFormula",!1);C(this,"_cellData");C(this,"_imageCacheMap");C(this,"_isRowStylePrecedeColumnStyle",!1);C(this,"_skipAutoHeightForMergedCells",!0);C(this,"_rowTotalHeight",0);C(this,"_columnTotalWidth",0);C(this,"_rowHeaderWidth",0);C(this,"_columnHeaderHeight",0);C(this,"_rowHeightAccumulation",[]);C(this,"_columnWidthAccumulation",[]);C(this,"_marginTop",0);C(this,"_marginLeft",0);C(this,"_scaleX");C(this,"_scaleY");C(this,"_scrollX");C(this,"_scrollY");this.worksheet=n,this._styles=r,this._contextService=i,this._configService=o,this._injector=a,this._worksheetData=this.worksheet.getConfig(),this._cellData=this.worksheet.getCellMatrix(),this._imageCacheMap=new Hu(this._injector),this.initConfig()}initConfig(){var n,r;this._skipAutoHeightForMergedCells=!((n=this._configService.getConfig(Ta))!=null&&n),this._isRowStylePrecedeColumnStyle=(r=this._configService.getConfig(Aa))!=null?r:!1}resetCache(){}getWorksheetConfig(){return this._worksheetData}getLocation(){return[this.worksheet.getUnitId(),this.worksheet.getSheetId()]}set columnHeaderHeight(n){this._columnHeaderHeight=n,this._worksheetData.columnHeader.height=n}set rowHeaderWidth(n){this._rowHeaderWidth=n,this._worksheetData.rowHeader.width=n}get rowHeightAccumulation(){return this._rowHeightAccumulation}get rowTotalHeight(){return this._rowTotalHeight}get columnWidthAccumulation(){return this._columnWidthAccumulation}get columnTotalWidth(){return this._columnTotalWidth}get rowHeaderWidth(){return this._rowHeaderWidth}get columnHeaderHeight(){return this._columnHeaderHeight}setMarginLeft(n){this._marginLeft=n}setMarginTop(n){this._marginTop=n}setScale(n,r){this._updateLayout(),this._scaleX=n,this._scaleY=r||n,this._updateLayout()}setScroll(n,r){re.isDefine(n)&&(this._scrollX=n),re.isDefine(r)&&(this._scrollY=r)}get scrollX(){return this._scrollX}get scrollY(){return this._scrollY}get scaleX(){return this._scaleX}get scaleY(){return this._scaleY}get rowHeaderWidthAndMarginLeft(){return this.rowHeaderWidth+this._marginLeft}get columnHeaderHeightAndMarginTop(){return this.columnHeaderHeight+this._marginTop}get imageCacheMap(){return this._imageCacheMap}_generateRowMatrixCache(n,r,s){let i=0;const o=[],a=r;for(let l=0;l<n;l++){let u=s;if(this.worksheet.getRowFiltered(l))u=0;else if(a[l]!=null){const c=a[l];if(!c)continue;const{h=s,ah:d,ia:f}=c;(f==null||f===Ie.TRUE)&&typeof d=="number"?u=d:u=h,c.hd===Ie.TRUE&&(u=0)}i+=u,o.push(i)}return{rowTotalHeight:i,rowHeightAccumulation:o}}_generateColumnMatrixCache(n,r,s){let i=0;const o=[],a=r;for(let l=0;l<n;l++){let u=s;if(a[l]!=null){const c=a[l];if(!c)continue;c.w!=null&&(u=c.w),c.hd===Ie.TRUE&&(u=0)}i+=u,o.push(i)}return{columnTotalWidth:i,columnWidthAccumulation:o}}intersectMergeRange(n,r){return!!this.worksheet.getMergedCell(n,r)}_getOverflowBound(n,r,s,i,o=bt.LEFT){let a=0;if(r>s){const l=this._columnWidthAccumulation.length-1;for(let u=r;u>=s;u--){const c=u,h=this.worksheet.getCell(n,c);if(!Ns(h)&&c!==r||this.intersectMergeRange(n,c))return c===r?c:c+1>l?l:c+1;const{startX:d,endX:f}=Cn(n,c,this.rowHeightAccumulation,this.columnWidthAccumulation);if(o===bt.CENTER&&c===r?a+=(f-d)/2:a+=f-d,i<a)return c}return r}for(let l=r;l<=s;l++){const u=l,c=this.worksheet.getCell(n,u);if(!Ns(c)&&u!==r||this.intersectMergeRange(n,u))return u===r?u:u-1<0?0:u-1;const{startX:h,endX:d}=Cn(n,u,this.rowHeightAccumulation,this.columnWidthAccumulation);if(o===bt.CENTER&&u===r?a+=(d-h)/2:a+=d-h,i<a)return u}return s}_updateLayout(){if(!this.dirty)return;const{rowData:n,columnData:r,defaultRowHeight:s,defaultColumnWidth:i,rowCount:o,columnCount:a,rowHeader:l,columnHeader:u}=this._worksheetData,{rowTotalHeight:c,rowHeightAccumulation:h}=this._generateRowMatrixCache(o,n,s),{columnTotalWidth:d,columnWidthAccumulation:f}=this._generateColumnMatrixCache(a,r,i);this._rowHeaderWidth=l.hidden!==Ie.TRUE?this._dynamicallyUpdateRowHeaderWidth(l):0,this._columnHeaderHeight=u.hidden!==Ie.TRUE?u.height:0,this._rowTotalHeight=c,this._rowHeightAccumulation=h,this._columnTotalWidth=d,this._columnWidthAccumulation=f,this.makeDirty(!1)}calculate(){return this.resetCache(),this._updateLayout(),this}resetRangeCache(n){}_dynamicallyUpdateRowHeaderWidth(n){const s=`${this.worksheet.getRowCount()}`.length*8;return Math.max(n.width,s)}_hasUnMergedCellInRow(n,r,s){if(!this.worksheet.getMergeData())return!1;for(let o=r;o<=s;o++){const{isMerged:a,isMergedMainCell:l}=this.worksheet.getCellInfoInMergeData(n,o);if(!a&&!l)return!0}return!1}expandRangeByMerge(n){let{startRow:r,startColumn:s,endRow:i,endColumn:o}=n;const a=this._worksheetData.mergeData;if(!a)return{startRow:r,startColumn:s,endRow:i,endColumn:o};let l=!0;const u=new At;for(;l;){l=!1;for(let c=0;c<a.length;c++){const{startRow:h,startColumn:d,endRow:f,endColumn:p}=a[c];if(u.getValue(h,d))continue;ul({startColumn:s,startRow:r,endColumn:o,endRow:i},{startColumn:d,startRow:h,endColumn:p,endRow:f})&&(r=Math.min(r,h),s=Math.min(s,d),i=Math.max(i,f),o=Math.max(o,p),u.setValue(h,d,!0),l=!0)}}return{startRow:r,startColumn:s,endRow:i,endColumn:o}}getColumnCount(){return this._columnWidthAccumulation.length}getRowCount(){return this._rowHeightAccumulation.length}_getCellMergeInfo(n,r){return this.worksheet.getCellInfoInMergeData(n,r)}getNoMergeCellPositionByIndex(n,r,s=!0){return this.getNoMergeCellWithCoordByIndex(n,r,s)}getNoMergeCellWithCoordByIndex(n,r,s=!0){const{rowHeightAccumulation:i,columnWidthAccumulation:o,rowHeaderWidthAndMarginLeft:a,columnHeaderHeightAndMarginTop:l}=this;let{startY:u,endY:c,startX:h,endX:d}=Cn(n,r,i,o);return s&&(u+=l,c+=l,h+=a,d+=a),{startY:u,endY:c,startX:h,endX:d}}getNoMergeCellPositionByIndexWithNoHeader(n,r){const{rowHeightAccumulation:s,columnWidthAccumulation:i}=this,{startY:o,endY:a,startX:l,endX:u}=Cn(n,r,s,i);return{startY:o,endY:a,startX:l,endX:u}}getRowIndexByOffsetY(n,r,s,i){var l;const{rowHeightAccumulation:o}=this;n=Xu(n,r,s,this.columnHeaderHeightAndMarginTop);let a=Fn(o,n,i==null?void 0:i.firstMatch);return i!=null&&i.closeFirst&&Math.abs(o[a]-n)<Math.abs(n-((l=o[a-1])!=null?l:0))&&(a=a+1),a}getColumnIndexByOffsetX(n,r,s,i){var u;const o=Ku(n,r,s,this.rowHeaderWidthAndMarginLeft),{columnWidthAccumulation:a}=this;let l=Fn(a,o,i==null?void 0:i.firstMatch);return i!=null&&i.closeFirst&&Math.abs(a[l]-o)<Math.abs(o-((u=a[l-1])!=null?u:0))&&(l=l+1),l}getCellIndexByOffset(n,r,s,i,o,a){const l=this.getRowIndexByOffsetY(r,i,o,a),u=this.getColumnIndexByOffsetX(n,s,o,a);return{row:l,column:u}}getCellByOffset(n,r,s,i,o){const a=this==null?void 0:this.getCellIndexByOffset(n,r,s,i,o,{firstMatch:!0});return a?this.worksheet.getCellInfoInMergeData(a.row,a.column):null}getCellWithCoordByIndex(n,r,s=!0){const{rowHeightAccumulation:i,columnWidthAccumulation:o,rowHeaderWidthAndMarginLeft:a,columnHeaderHeightAndMarginTop:l}=this,u=Cn(n,r,i,o,this.worksheet.getCellInfoInMergeData(n,r)),{isMerged:c,isMergedMainCell:h}=u;let{startY:d,endY:f,startX:p,endX:R,mergeInfo:w}=u,N=a,G=l;return s===!1&&(N=0,G=0),d+=G,f+=G,p+=N,R+=N,w.startY+=G,w.endY+=G,w.startX+=N,w.endX+=N,{actualRow:n,actualColumn:r,startX:p,startY:d,endX:R,endY:f,isMerged:c,isMergedMainCell:h,mergeInfo:w}}getCellWithCoordByOffset(n,r,s,i,o,a){const{row:l,column:u}=this.getCellIndexByOffset(n,r,s,i,o,a);return this.getCellWithCoordByIndex(l,u)}getOffsetByColumn(n){const{columnWidthAccumulation:r,rowHeaderWidthAndMarginLeft:s}=this,i=r.length-1,o=r[n];return o!=null?o+s:n<0?s:r[i]+s}getOffsetByRow(n){const{rowHeightAccumulation:r,columnHeaderHeightAndMarginTop:s}=this,i=r.length-1,o=r[n];return o!=null?o+s:n<0?s:r[i]+s}getOffsetRelativeToRowCol(n,r){const s=Fn(this.columnWidthAccumulation,n);let i=0;s===0?i=n:i=n-this._columnWidthAccumulation[s-1];const o=Fn(this.rowHeightAccumulation,r);let a=0;return o===0?a=r:a=r-this._rowHeightAccumulation[o-1],{row:o,column:s,columnOffset:i,rowOffset:a}}_updateConfigAndGetDocumentModel(n,r,s,i){var a,l,u,c,h;if(!i||!((a=n.body)!=null&&a.dataStream))return;n.documentStyle||(n.documentStyle={}),n.documentStyle.marginTop=(l=s.t)!=null?l:0,n.documentStyle.marginBottom=(u=s.b)!=null?u:2,n.documentStyle.marginLeft=(c=s.l)!=null?c:2,n.documentStyle.marginRight=(h=s.r)!=null?h:2,n.documentStyle.pageSize={width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY},n.documentStyle.renderConfig={...n.documentStyle.renderConfig,...i};const o=n.body.paragraphs||[];for(const d of o)d.paragraphStyle||(d.paragraphStyle={}),d.paragraphStyle.horizontalAlign=r;return new yt(n)}dispose(){super.dispose(),this._rowHeightAccumulation=[],this._columnWidthAccumulation=[],this._rowTotalHeight=0,this._columnTotalWidth=0,this._rowHeaderWidth=0,this._columnHeaderHeight=0,this._worksheetData=null,this._cellData=null,this._styles=null}};exports.SheetSkeleton=kE([wr(2,je.Inject(on)),wr(3,Nn),wr(4,Ii),wr(5,je.Inject(je.Injector))],exports.SheetSkeleton);function bi(e,t,n,r){const s=e-1,i=t-1,o=n[s]||0;let a=n[e];a==null&&(a=n[n.length-1]);const l=r[i]||0;let u=r[t];return u==null&&(u=r[r.length-1]),{startY:o,endY:a,startX:l,endX:u}}function FE(e,t,n,r){return bi(e,t,n,r)}function Cn(e,t,n,r,s){e=re.clamp(e,0,n.length-1),t=re.clamp(t,0,r.length-1);let{startY:i,endY:o,startX:a,endX:l}=bi(e,t,n,r);if(!s)return{startY:i,endY:o,startX:a,endX:l,isMerged:!1,isMergedMainCell:!1,actualRow:e,actualColumn:t,mergeInfo:{startY:i,endY:o,startX:a,endX:l,startRow:e,startColumn:t,endRow:e,endColumn:t}};const{isMerged:u,isMergedMainCell:c,startRow:h,startColumn:d,endRow:f,endColumn:p}=s;let R={startRow:h,startColumn:d,endRow:f,endColumn:p,startY:i,endY:o,startX:a,endX:l};const w=n.length-1,N=r.length-1;if(u&&h!==-1&&d!==-1){const G=n[h-1]||0,W=n[f]||n[w],se=r[d-1]||0,y=r[p]||r[N];R={...R,startY:G,endY:W,startX:se,endX:y}}else if(!u&&f!==-1&&p!==-1){const G=n[f]||n[w],W=r[p]||r[N];R={...R,startY:i,endY:G,startX:a,endX:W}}return{isMerged:u,isMergedMainCell:c,actualRow:e,actualColumn:t,startY:i,endY:o,startX:a,endX:l,mergeInfo:R}}function Ku(e,t,n,r){const{x:s}=n;return e/t+s-r}function Xu(e,t,n,r){const{y:s}=n;return e=e/t+s-r,e}const Do=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],vs=1,Pn=8;class Ai{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[n,r]=new Uint8Array(t,0,2);if(n!==219)throw new Error("Data does not appear to be in a KDBush format.");const s=r>>4;if(s!==vs)throw new Error(`Got v${s} data when expected v${vs}.`);const i=Do[r&15];if(!i)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(t,2,1),[a]=new Uint32Array(t,4,1);return new Ai(a,o,i,t)}constructor(t,n=64,r=Float64Array,s){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+n,2),65535),this.ArrayType=r,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const i=Do.indexOf(this.ArrayType),o=t*2*this.ArrayType.BYTES_PER_ELEMENT,a=t*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-a%8)%8;if(i<0)throw new Error(`Unexpected typed array class: ${r}.`);s&&s instanceof ArrayBuffer?(this.data=s,this.ids=new this.IndexArrayType(this.data,Pn,t),this.coords=new this.ArrayType(this.data,Pn+a+l,t*2),this._pos=t*2,this._finished=!0):(this.data=new ArrayBuffer(Pn+o+a+l),this.ids=new this.IndexArrayType(this.data,Pn,t),this.coords=new this.ArrayType(this.data,Pn+a+l,t*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(vs<<4)+i]),new Uint16Array(this.data,2,1)[0]=n,new Uint32Array(this.data,4,1)[0]=t)}add(t,n){const r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=t,this.coords[this._pos++]=n,r}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return qs(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,n,r,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:i,coords:o,nodeSize:a}=this,l=[0,i.length-1,0],u=[];for(;l.length;){const c=l.pop()||0,h=l.pop()||0,d=l.pop()||0;if(h-d<=a){for(let w=d;w<=h;w++){const N=o[2*w],G=o[2*w+1];N>=t&&N<=r&&G>=n&&G<=s&&u.push(i[w])}continue}const f=d+h>>1,p=o[2*f],R=o[2*f+1];p>=t&&p<=r&&R>=n&&R<=s&&u.push(i[f]),(c===0?t<=p:n<=R)&&(l.push(d),l.push(f-1),l.push(1-c)),(c===0?r>=p:s>=R)&&(l.push(f+1),l.push(h),l.push(1-c))}return u}within(t,n,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:s,coords:i,nodeSize:o}=this,a=[0,s.length-1,0],l=[],u=r*r;for(;a.length;){const c=a.pop()||0,h=a.pop()||0,d=a.pop()||0;if(h-d<=o){for(let w=d;w<=h;w++)Lo(i[2*w],i[2*w+1],t,n)<=u&&l.push(s[w]);continue}const f=d+h>>1,p=i[2*f],R=i[2*f+1];Lo(p,R,t,n)<=u&&l.push(s[f]),(c===0?t-r<=p:n-r<=R)&&(a.push(d),a.push(f-1),a.push(1-c)),(c===0?t+r>=p:n+r>=R)&&(a.push(f+1),a.push(h),a.push(1-c))}return l}}function qs(e,t,n,r,s,i){if(s-r<=n)return;const o=r+s>>1;qu(e,t,o,r,s,i),qs(e,t,n,r,o-1,1-i),qs(e,t,n,o+1,s,1-i)}function qu(e,t,n,r,s,i){for(;s>r;){if(s-r>600){const u=s-r+1,c=n-r+1,h=Math.log(u),d=.5*Math.exp(2*h/3),f=.5*Math.sqrt(h*d*(u-d)/u)*(c-u/2<0?-1:1),p=Math.max(r,Math.floor(n-c*d/u+f)),R=Math.min(s,Math.floor(n+(u-c)*d/u+f));qu(e,t,n,p,R,i)}const o=t[2*n+i];let a=r,l=s;for(kn(e,t,r,n),t[2*s+i]>o&&kn(e,t,r,s);a<l;){for(kn(e,t,a,l),a++,l--;t[2*a+i]<o;)a++;for(;t[2*l+i]>o;)l--}t[2*r+i]===o?kn(e,t,r,l):(l++,kn(e,t,l,s)),l<=n&&(r=l+1),n<=l&&(s=l-1)}}function kn(e,t,n,r){Os(e,n,r),Os(t,2*n,2*r),Os(t,2*n+1,2*r+1)}function Os(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function Lo(e,t,n,r){const s=e-n,i=t-r;return s*s+i*i}class $E{constructor(t=!1){C(this,"_tree",new Map);C(this,"_oneCellCache",new Map);C(this,"_kdTree",new Map);this._enableOneCellCache=t}dispose(){this.clear()}getTree(t,n){return this._tree.has(t)||this._tree.set(t,new Map),this._tree.get(t).has(n)||this._tree.get(t).set(n,new Wr),this._tree.get(t).get(n)}_getOneCellCache(t,n,r,s){return this._oneCellCache.has(t)||this._oneCellCache.set(t,new Map),this._oneCellCache.get(t).has(n)||this._oneCellCache.get(t).set(n,new Map),this._oneCellCache.get(t).get(n).has(r)||this._oneCellCache.get(t).get(n).set(r,new Map),this._oneCellCache.get(t).get(n).get(r).has(s)||this._oneCellCache.get(t).get(n).get(r).set(s,new Set),this._oneCellCache.get(t).get(n).get(r).get(s)}_removeOneCellCache(t,n,r,s,i){const o=this._oneCellCache.get(t);if(!o)return;const a=o.get(n);if(!a)return;const l=a.get(r);if(!l)return;const u=l.get(s);u&&u.delete(i)}_removeCellCacheByRange(t){const{unitId:n,sheetId:r,range:s,id:i}=t,o=this._oneCellCache.get(n);if(!o)return;const a=o.get(r);if(!a)return;const{startRow:l,startColumn:u,endRow:c,endColumn:h}=s;for(let d=l;d<=c;d++){const f=a.get(d);if(f)for(let p=u;p<=h;p++){const R=f.get(p);R&&R.delete(i)}}}_insertOneCellCache(t,n,r,s,i){this._getOneCellCache(t,n,r,s).add(i)}_getRdTreeItems(t){const n=[];for(const[r,s]of t)for(const[i,o]of s)n.push({x:i,y:r,ids:o});return n}_searchByOneCellCache(t){var p;const{unitId:n,sheetId:r,range:s}=t,{startRow:i,startColumn:o,endRow:a,endColumn:l}=s,u=(p=this._kdTree.get(n))==null?void 0:p.get(r);if(!u)return[];const{tree:c,items:h}=u,d=c.range(o,i,l,a),f=[];for(const R of d){const w=h[R];f.push(...Array.from(w.ids))}return f}openKdTree(){var t;for(const[n,r]of this._oneCellCache){this._kdTree.has(n)||this._kdTree.set(n,new Map);for(const[s,i]of r){const o=this._getRdTreeItems(i),a=new Ai(o.length);(t=this._kdTree.get(n))==null||t.set(s,{tree:a,items:o});for(const l of o)a.add(l.x,l.y);a.finish()}}}closeKdTree(){var t;for(const[n,r]of this._oneCellCache)for(const[s,i]of r)(t=this._kdTree.get(n))==null||t.set(s,void 0)}insert(t){const{unitId:n,sheetId:r,range:s,id:i}=t;if(!n||n.length===0)return;let{startRow:o,endRow:a,startColumn:l,endColumn:u}=s;if(this._enableOneCellCache&&o===a&&l===u){this._insertOneCellCache(n,r,o,l,i);return}const c=this.getTree(n,r);Number.isNaN(o)&&(o=0),Number.isNaN(l)&&(l=0),Number.isNaN(a)&&(a=Number.POSITIVE_INFINITY),Number.isNaN(u)&&(u=Number.POSITIVE_INFINITY),c.insert({minX:l,minY:o,maxX:u,maxY:a,id:i})}bulkInsert(t){for(const n of t)this.insert(n)}*searchGenerator(t){var a;const{unitId:n,sheetId:r,range:s}=t;if(this._enableOneCellCache){const l=this._searchByOneCellCache(t);for(const u of l)yield u}const i=(a=this._tree.get(n))==null?void 0:a.get(r);if(!i)return;const o=i.search({minX:s.startColumn,minY:s.startRow,maxX:s.endColumn,maxY:s.endRow});for(const l of o)yield l.id}bulkSearch(t,n){const r=new Set;for(const s of t)for(const i of this.searchGenerator(s))(n==null?void 0:n.has(i))!==!0&&r.add(i);return r}removeById(t,n){var r,s;n?((r=this._tree.get(t))==null||r.delete(n),(s=this._oneCellCache.get(t))==null||s.delete(n)):(this._tree.delete(t),this._oneCellCache.delete(t))}_removeRTreeItem(t){const{unitId:n,sheetId:r,range:s,id:i}=t,o=this.getTree(n,r),a=o.search({minX:s.startColumn,minY:s.startRow,maxX:s.endColumn,maxY:s.endRow});for(let l=0;l<a.length;l++)a[l].id===i&&o.remove(a[l])}remove(t){const{unitId:n,sheetId:r,range:s,id:i}=t,{startRow:o,startColumn:a,endRow:l,endColumn:u}=s;this._enableOneCellCache?o===l&&a===u?this._removeOneCellCache(n,r,s.startRow,s.startColumn,i):(this._removeCellCacheByRange(t),this._removeRTreeItem(t)):this._removeRTreeItem(t)}bulkRemove(t){for(const n of t)this.remove(n)}clear(){this._tree.clear(),this._oneCellCache.clear()}toJSON(){const t={};return this._tree.forEach((n,r)=>{t[r]={},n.forEach((s,i)=>{t[r][i]=s.toJSON()})}),t}fromJSON(t){this._tree.clear();for(const n in t){this._tree.set(n,new Map);for(const r in t[n]){const s=new Wr;s.fromJSON(t[n][r]),this._tree.get(n).set(r,s)}}}}var BE=Object.getOwnPropertyDescriptor,HE=(e,t,n,r)=>{for(var s=r>1?void 0:r?BE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},xo=(e,t)=>(n,r)=>t(n,r,e);let Js=class extends st{constructor(e,t){super(),this._resourceManagerService=e,this._univerInstanceService=t,this._init()}_init(){const e=n=>{n.businesses.forEach(r=>{switch(r){case $e.UNRECOGNIZED:case $e.UNIVER_UNKNOWN:case $e.UNIVER_SLIDE:case $e.UNIVER_DOC:{this._univerInstanceService.getAllUnitsForType($e.UNIVER_DOC).forEach(s=>{const o=(s.getSnapshot().resources||[]).find(a=>a.name===n.pluginName);if(o)try{const a=n.parseJson(o.data);n.onLoad(s.getUnitId(),a)}catch{console.error(`Load Document{${s.getUnitId()}} Resources{${n.pluginName}} Data Error.`)}});break}case $e.UNIVER_SHEET:this._univerInstanceService.getAllUnitsForType($e.UNIVER_SHEET).forEach(s=>{const o=(s.getSnapshot().resources||[]).find(a=>a.name===n.pluginName);if(o)try{const a=n.parseJson(o.data);n.onLoad(s.getUnitId(),a)}catch{console.error(`Load Workbook{${s.getUnitId()}} Resources{${n.pluginName}} Data Error.`)}})}})};this._resourceManagerService.getAllResourceHooks().forEach(n=>e(n)),this.disposeWithMe(this._resourceManagerService.register$.subscribe(n=>e(n))),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$($e.UNIVER_SHEET).subscribe(n=>{this._resourceManagerService.loadResources(n.getUnitId(),n.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$($e.UNIVER_DOC).subscribe(n=>{const r=n.getUnitId();ya(r)||this._resourceManagerService.loadResources(n.getUnitId(),n.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$($e.UNIVER_SHEET).subscribe(n=>{this._resourceManagerService.unloadResources(n.getUnitId())})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$($e.UNIVER_DOC).subscribe(n=>{this._resourceManagerService.unloadResources(n.getUnitId())}))}saveUnit(e){const t=this._univerInstanceService.getUnit(e);if(!t)return null;const n=this._resourceManagerService.getResources(e,t.type),r=re.deepClone(t.getSnapshot());return r.resources=n,r}};Js=HE([xo(0,je.Inject(is)),xo(1,je.Inject(yn))],Js);class jE{constructor(t={},n){C(this,"_startedTypes",new Set);C(this,"_injector");C(this,"_disposingCallbacks",new Kr);const r=this._injector=WE(n,t==null?void 0:t.override),{theme:s,locale:i,locales:o,logLevel:a}=t;s&&this._injector.get(Oi).setTheme(s),o&&this._injector.get(on).load(o),i&&this._injector.get(on).setLocale(i),a&&this._injector.get(wt).setLogLevel(a),this._init(r)}get _univerInstanceService(){return this._injector.get(yn)}get _pluginService(){return this._injector.get(exports.PluginService)}__getInjector(){return this._injector}onDispose(t){const n=this._disposingCallbacks.add(nt(t));return nt(()=>n.dispose(!0))}dispose(){this._disposingCallbacks.dispose(),this._injector.dispose()}setLocale(t){this._injector.get(on).setLocale(t)}createUnit(t,n){return this._univerInstanceService.createUnit(t,n)}createUniverSheet(t){return this._injector.get(wt).warn("[Univer]","Univer.createUniverSheet is deprecated, use createUnit instead"),this._univerInstanceService.createUnit($e.UNIVER_SHEET,t)}createUniverDoc(t){return this._injector.get(wt).warn("[Univer]","Univer.createUniverDoc is deprecated, use createUnit instead"),this._univerInstanceService.createUnit($e.UNIVER_DOC,t)}createUniverSlide(t){return this._injector.get(wt).warn("[Univer]","Univer.createUniverSlide is deprecated, use createUnit instead"),this._univerInstanceService.createUnit($e.UNIVER_SLIDE,t)}_init(t){this._univerInstanceService.registerCtorForType($e.UNIVER_SHEET,exports.Workbook),this._univerInstanceService.registerCtorForType($e.UNIVER_DOC,yt),this._univerInstanceService.registerCtorForType($e.UNIVER_SLIDE,Si);const n=t.get(yn);n.__setCreateHandler((r,s,i,o)=>{if(!this._startedTypes.has(r)){this._pluginService.startPluginsForType(r),this._startedTypes.add(r);const l=t.createInstance(i,s);return n.__addUnit(l,o),this._tryProgressToReady(),l}const a=t.createInstance(i,s);return n.__addUnit(a,o),a})}_tryProgressToReady(){this._injector.get(exports.LifecycleService).stage<Je.Ready&&(this._injector.get(exports.LifecycleService).stage=Je.Ready)}registerPlugin(t,n){this._pluginService.registerPlugin(t,n)}}function WE(e,t){const n=Lu([[mu],[on],[Oi],[exports.LifecycleService],[exports.PluginService],[Qn],[yn,{useClass:exports.UniverInstanceService}],[Nu,{useClass:Mu}],[wt,{useClass:jo,lazy:!0}],[rr,{useClass:exports.CommandService}],[os,{useClass:exports.LocalUndoRedoService,lazy:!0}],[Ii,{useClass:du}],[Nn,{useClass:Bo}],[is,{useClass:xu,lazy:!0}],[Ks,{useClass:Js,lazy:!0}],[cu,{useClass:exports.AuthzIoLocalService}],[hu,{useClass:exports.MentionIOLocalService,lazy:!0}]],t),r=e?e.createChild(n):new je.Injector(n);return ko(r,[[Qn],[Ks]]),r}tc();exports.ABCToNumber=Wd;exports.AUTO_HEIGHT_FOR_MERGED_CELLS=Ta;exports.AbsoluteRefType=tt;exports.ActionIterator=En;exports.AlignTypeH=Za;exports.AlignTypeV=Qa;exports.ArrangeTypeEnum=nl;exports.ArrowsAndMarkersShapes=ia;exports.AsyncInterceptorManager=Sp;exports.AsyncLock=o_;exports.AutoFillSeries=Ko;exports.BaselineOffset=Pt;exports.BasicShapes=sa;exports.BlockType=Da;exports.BooleanNumber=Ie;exports.BorderStyleTypes=Xe;exports.BorderType=Xo;exports.BuildTextUtils=ot;exports.BulletAlignment=or;exports.COLORS=ys;exports.CanceledError=uc;exports.CellModeEnum=Rn;exports.CellValueType=Vt;exports.Color=ln;exports.ColorBuilder=Jr;exports.ColorKit=Ot;exports.ColorType=Rt;exports.ColumnSeparatorType=Ua;exports.CommandType=nr;exports.CommonHideTypes=qo;exports.ConfigService=du;exports.ContextService=Bo;exports.CopyPasteType=Jo;exports.CustomCommandExecutionError=ws;exports.CustomDecorationType=rn;exports.CustomRangeType=qt;exports.DEFAULT_CELL=Id;exports.DEFAULT_DOC=pi;exports.DEFAULT_DOCUMENT_SUB_COMPONENT_ID=Tp;exports.DEFAULT_EMPTY_DOCUMENT_VALUE=ba;exports.DEFAULT_RANGE=Cd;exports.DEFAULT_RANGE_ARRAY=Ed;exports.DEFAULT_SELECTION=Rd;exports.DEFAULT_SLIDE=ol;exports.DEFAULT_STYLES=ut;exports.DEFAULT_WORKSHEET_COLUMN_COUNT=Iu;exports.DEFAULT_WORKSHEET_COLUMN_COUNT_KEY=rE;exports.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT=wu;exports.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY=aE;exports.DEFAULT_WORKSHEET_COLUMN_WIDTH=vu;exports.DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY=iE;exports.DEFAULT_WORKSHEET_ROW_COUNT=Ru;exports.DEFAULT_WORKSHEET_ROW_COUNT_KEY=nE;exports.DEFAULT_WORKSHEET_ROW_HEIGHT=Su;exports.DEFAULT_WORKSHEET_ROW_HEIGHT_KEY=sE;exports.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH=Ou;exports.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY=oE;exports.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY=ti;exports.DOCS_NORMAL_EDITOR_UNIT_ID_KEY=ei;exports.DOCS_ZEN_EDITOR_UNIT_ID_KEY=wa;exports.DOC_RANGE_TYPE=Ea;exports.DashStyleType=Ha;exports.DataStreamTreeNodeType=dl;exports.DataStreamTreeTokenType=_t;exports.DataValidationErrorStyle=ju;exports.DataValidationImeMode=Wu;exports.DataValidationOperator=Yu;exports.DataValidationRenderMode=zu;exports.DataValidationStatus=Gu;exports.DataValidationType=Vu;exports.DeleteDirection=Zo;exports.DependentOn=wE;exports.DesktopLogService=jo;exports.DeveloperMetadataVisibility=Qo;exports.Dimension=ea;exports.Direction=ta;exports.Disposable=st;exports.DisposableCollection=Kr;exports.DocStyleType=Na;exports.DocumentDataModel=yt;exports.DocumentFlavor=ni;exports.DrawingTypeEnum=rl;exports.EDITOR_ACTIVATED=fu;exports.EXTENSION_NAMES=al;exports.ErrorService=mu;exports.EventState=uu;exports.EventSubject=yp;exports.FOCUSING_COMMON_DRAWINGS=Wp;exports.FOCUSING_DOC=Yn;exports.FOCUSING_EDITOR_BUT_HIDDEN=kp;exports.FOCUSING_EDITOR_INPUT_FORMULA=Fp;exports.FOCUSING_EDITOR_STANDALONE=Bp;exports.FOCUSING_FX_BAR_EDITOR=gu;exports.FOCUSING_PANEL_EDITOR=Hp;exports.FOCUSING_SHEET=vn;exports.FOCUSING_SLIDE=zn;exports.FOCUSING_UNIT=Wn;exports.FOCUSING_UNIVER_EDITOR=$p;exports.FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE=jp;exports.FORMULA_EDITOR_ACTIVATED=Yp;exports.FollowNumberWithType=Ma;exports.FontItalic=$r;exports.FontStyleType=In;exports.FontWeight=Br;exports.GridType=La;exports.HLSColor=ma;exports.HorizontalAlign=bt;exports.IAuthzIoService=cu;exports.ICommandService=rr;exports.IConfigService=Ii;exports.IContextService=Nn;exports.IImageIoService=Xs;exports.ILocalStorageService=RE;exports.ILogService=wt;exports.IMentionIOService=hu;exports.IPermissionService=Nu;exports.IResourceLoaderService=Ks;exports.IResourceManagerService=is;exports.IS_ROW_STYLE_PRECEDE_COLUMN_STYLE=Aa;exports.IUndoRedoService=os;exports.IUniverInstanceService=yn;exports.ImageCacheMap=Hu;exports.ImageSourceType=wi;exports.ImageUploadStatusType=Bu;exports.InterceptorEffectEnum=Sn;exports.InterceptorManager=Cp;exports.InterpolationPointType=na;exports.JSON1=m_;exports.JSONX=Ft;exports.LRUHelper=Bn;exports.LRUMap=qn;exports.LifecycleStages=Je;exports.ListGlyphType=Ne;exports.LocaleService=on;exports.LocaleType=sr;exports.LogLevel=Ho;exports.MOVE_BUFFER_VALUE=$n;exports.MemoryCursor=hn;exports.MentionType=Fr;exports.NAMED_STYLE_MAP=vd;exports.NAMED_STYLE_SPACE_MAP=Od;exports.NamedStyleType=rt;exports.NilCommand=Wo;exports.NumberUnitType=Ja;exports.ObjectMatrix=At;exports.ObjectRelativeFromH=Xa;exports.ObjectRelativeFromV=qa;exports.OtherShapes=oa;exports.PRESET_LIST_TYPE=cr;exports.PRINT_CHART_COMPONENT_KEY=wd;exports.PageElementType=sl;exports.PageOrientType=tl;exports.PageType=ri;exports.ParagraphElementType=ka;exports.ParagraphStyleBuilder=Zn;exports.ParagraphStyleValue=dr;exports.PermissionService=Mu;exports.PermissionStatus=vi;exports.Plugin=Vs;exports.PositionedObjectLayoutType=$a;exports.PresetListType=Lt;exports.ProtectionType=ra;exports.QuickListType=Kl;exports.QuickListTypeMap=I_;exports.RANGE_DIRECTION=pa;exports.RANGE_TYPE=Le;exports.RBush=Wr;exports.RCDisposable=fc;exports.RGBA_PAREN=Wc;exports.RGB_PAREN=jc;exports.ROTATE_BUFFER_VALUE=Vo;exports.RTree=$E;exports.Range=bn;exports.Rectangle=Jt;exports.RedoCommand=$u;exports.RedoCommandId=Pu;exports.RefAlias=jd;exports.Registry=Ci;exports.RegistryAsMap=Ri;exports.RelativeDate=la;exports.RelativeSlideLink=il;exports.ResourceManagerService=xu;exports.RgbColor=Hr;exports.RichTextBuilder=sn;exports.RichTextValue=Gt;exports.RxDisposable=dc;exports.SHEET_EDITOR_UNITS=Sd;exports.SectionType=xa;exports.SheetTypes=ua;exports.SheetViewModel=Au;exports.SliceBodyType=_i;exports.SlideDataModel=Si;exports.SpacingRule=Ba;exports.SpecialShapes=aa;exports.Styles=_u;exports.THEME_COLORS=ga;exports.TabStopAlignment=ja;exports.TableAlignmentType=Ya;exports.TableLayoutType=za;exports.TableRowHeightRule=Va;exports.TableSizeType=Wa;exports.TableTextWrapType=Ga;exports.TextDecoration=ca;exports.TextDecorationBuilder=zt;exports.TextDirection=Xn;exports.TextDirectionType=Pa;exports.TextStyleBuilder=Xt;exports.TextStyleValue=hr;exports.TextX=Ye;exports.TextXActionType=he;exports.ThemeColor=jr;exports.ThemeColorType=ft;exports.ThemeColors=qr;exports.ThemeService=Oi;exports.Tools=re;exports.UndoCommand=Fu;exports.UndoCommandId=ku;exports.UnitModel=ss;exports.Univer=jE;exports.UniverInstanceType=$e;exports.UpdateDocsAttributeType=xe;exports.UserManagerService=Qn;exports.VerticalAlign=nn;exports.VerticalAlignmentType=Ka;exports.Worksheet=er;exports.WrapStrategy=an;exports.WrapTextType=Fa;exports.addLinkToDocumentModel=pu;exports.afterInitApply=vc;exports.afterTime=Ic;exports.awaitTime=NE;exports.binSearchFirstGreaterThanTarget=Go;exports.binarySearchArray=Oc;exports.bufferDebounceTime=Rc;exports.cellToRange=ph;exports.characterSpacingControlType=el;exports.checkForSubstrings=Eh;exports.checkIfMove=bc;exports.checkParagraphHasBullet=ed;exports.checkParagraphHasIndent=td;exports.checkParagraphHasIndentByStyle=Sa;exports.codeToBlob=wc;exports.composeBody=js;exports.composeInterceptors=au;exports.composeStyles=As;exports.concatMatrixArray=fd;exports.convertBodyToHtml=Hc;exports.convertCellToRange=Ca;exports.convertObservableToBehaviorSubject=Sc;exports.covertTextRunToHtml=Ts;exports.createAsyncInterceptorKey=Rp;exports.createDefaultUser=Vr;exports.createDocumentModelWithStyle=Gn;exports.createInterceptorKey=Ep;exports.createInternalEditorID=pd;exports.createRowColIter=xs;exports.dayjs=$t;exports.debounce=Gm;exports.dedupe=nc;exports.dedupeBy=rc;exports.deepCompare=Qs;exports.delayAnimationFrame=ME;exports.deleteContent=Oa;exports.extractPureTextFromCell=Tu;exports.fromCallback=Yo;exports.fromEventSubject=Np;exports.fromObservable=hc;exports.generateRandomId=kt;exports.get=vm;exports.getArrayLength=Kt;exports.getBodySlice=Tt;exports.getBodySliceHtml=Ar;exports.getBorderStyleType=gh;exports.getCellCoordByIndexSimple=bi;exports.getCellInfoInMergeData=lh;exports.getCellPositionByIndexSimple=FE;exports.getCellValueType=sh;exports.getCellWithCoordByIndexCore=Cn;exports.getColorStyle=Mt;exports.getCustomBlockSlice=Zl;exports.getCustomDecorationSlice=eu;exports.getCustomRangeSlice=Ql;exports.getDocsUpdateBody=mh;exports.getIntersectRange=ul;exports.getOriginCellValue=uE;exports.getParagraphsSlice=Jl;exports.getPlainText=Qr;exports.getReverseDirection=Ac;exports.getSectionBreakSlice=N_;exports.getTableSlice=ql;exports.getTextRunSlice=Gr;exports.getTransformOffsetX=Ku;exports.getTransformOffsetY=Xu;exports.getWorksheetUID=fE;exports.groupBy=oc;exports.handleStyleToString=fh;exports.hashAlgorithm=rd;exports.horizontalLineSegmentsSubtraction=Zr;exports.insertMatrixArray=Ms;exports.insertTextToContent=va;exports.isBlackColor=th;exports.isBooleanString=n_;exports.isCellCoverable=Ns;exports.isCellV=oh;exports.isEmptyCell=Ra;exports.isFormulaId=dh;exports.isFormulaString=hh;exports.isICellData=rh;exports.isInternalEditorID=ya;exports.isNodeEnv=Bc;exports.isNotNullOrUndefined=Eu;exports.isNullCell=ih;exports.isNumeric=lu;exports.isRangesEqual=Kp;exports.isRealNum=nd;exports.isSafeNumeric=Op;exports.isSameStyleTextRun=Ia;exports.isUnitRangesEqual=Xp;exports.isValidRange=_h;exports.isWhiteColor=nh;exports.makeArray=ac;exports.makeCellRangeToRangeData=ch;exports.makeCellToSelection=uh;exports.makeCustomRangeStream=Xd;exports.merge=di;exports.mergeOverrideWithDependencies=Lu;exports.mergeSets=bp;exports.mergeWith=qm;exports.mergeWorksheetSnapshotWithDefault=bu;exports.mixinClass=vp;exports.moveMatrixArray=Ls;exports.moveRangeByOffset=Dd;exports.nameCharacterCheck=yE;exports.normalizeBody=M_;exports.normalizeTextRuns=ur;exports.numberToABC=zd;exports.numberToListABC=Gd;exports.numfmt=dd;exports.queryObjectMatrix=Hd;exports.registerDependencies=lc;exports.remove=tr;exports.repeatStringNumTimes=hl;exports.replaceInDocumentBody=Ap;exports.requestImmediateMacroTask=wp;exports.rotate=ic;exports.searchArray=Fn;exports.searchInOrderedArray=zo;exports.selectionToArray=ah;exports.sequence=$o;exports.sequenceAsync=Fo;exports.sequenceExecute=Xr;exports.sequenceExecuteAsync=Cc;exports.set=Zm;exports.shallowEqual=Ll;exports.skipParseTagNames=DE;exports.sliceMatrixArray=gd;exports.sortRules=Vd;exports.sortRulesByDesc=Kd;exports.sortRulesFactory=ar;exports.spliceArray=Ds;exports.splitIntoGrid=si;exports.takeAfter=bs;exports.textDiff=fi;exports.throttle=pp;exports.toDisposable=nt;exports.touchDependencies=ko;exports.updateAttributeByDelete=tu;exports.updateAttributeByInsert=nu;Object.keys(je).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>je[e]})});
1
+ "use strict";var Zu=Object.defineProperty;var Qu=(e,t,n)=>t in e?Zu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var C=(e,t,n)=>Qu(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Oe=require("rxjs"),Ar=require("rxjs/operators"),je=require("@wendellhu/redi");function ec(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in e)){const i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}const mr=typeof global<"u"?global:typeof self<"u"?self:window;function tc(){const t=new Map;let n=0;typeof mr.requestIdleCallback!="function"&&(mr.requestIdleCallback=function(s){const i=Date.now(),o=++n,a=setTimeout(function(){t.delete(o);const u=Math.max(0,50-(Date.now()-i));s({didTimeout:u===0,timeRemaining(){return u}})},1);return t.set(o,a),o}),typeof mr.cancelIdleCallback!="function"&&(mr.cancelIdleCallback=function(s){const i=t.get(s);i!==void 0&&(clearTimeout(i),t.delete(s))})}function nc(){tc()}function nr(e,t){const n=e.indexOf(t);return n>-1?(e.splice(n,1),!0):!1}function rc(e){const t=new Set,n=[];for(const r of e)t.has(r)||(t.add(r),n.push(r));return n}function sc(e,t){const n=new Set,r=[];for(const s of e){const i=t(s);n.has(i)||(n.add(i),r.push(s))}return r}function ic(e,t){for(let n=e.length-1;n>-1;n--){const r=e[n];if(t(r,n))return r}return null}function oc(e,t){if(e.length===0)return e;const n=t%e.length;return e.slice(n).concat(e.slice(0,n))}function ac(e,t){const n=new Map;return e.forEach(r=>{const s=t(r);let i=n.get(s);n.has(s)||(i=[],n.set(s,i)),i.push(r)}),n}function lc(e){return Array.isArray(e)?e:[e]}function uc(e,t){t.forEach(n=>e.add(n))}function Fo(e,t){t.forEach(([n])=>{e.has(n)&&e.get(n)})}class bs extends Error{constructor(t){super(t),this.name="CustomCommandExecutionError"}}class cc extends Error{constructor(){super("Canceled by facade"),this.name="CanceledError"}}async function Bo(e){for(const[t,n]of e.entries())try{if(!await n())return{index:t,result:!1}}catch(r){return{index:t,result:!1,error:r}}return{result:!0,index:-1}}function $o(e){for(const[t,n]of e.entries())try{if(!n())return{index:t,result:!1}}catch(r){return{index:t,result:!1,error:r}}return{result:!0,index:-1}}function hc(e){return e instanceof Oe.Subscription||e instanceof Oe.Subject||e&&"closed"in e&&typeof e.unsubscribe<"u"}function nt(e){let t=!1;return e?hc(e)?{dispose:()=>e.unsubscribe()}:typeof e=="function"?{dispose:()=>{t||(t=!0,e())}}:e:nt(()=>{})}function dc(e){return nt(()=>{e.unsubscribe()})}class Xr{constructor(){C(this,"_disposables",new Set)}add(t){const n=nt(t);return this._disposables.add(n),{dispose:(r=!1)=>{r||n.dispose(),this._disposables.delete(n)}}}dispose(){this._disposables.forEach(t=>{t.dispose()}),this._disposables.clear()}}class st{constructor(){C(this,"_disposed",!1);C(this,"_collection",new Xr)}disposeWithMe(t){return this._collection.add(t)}ensureNotDisposed(){if(this._disposed)throw new Error("[Disposable]: object is disposed!")}dispose(){this._disposed||(this._disposed=!0,this._collection.dispose())}}class fc extends st{constructor(){super(...arguments);C(this,"dispose$",new Oe.Subject)}dispose(){super.dispose(),this.dispose$.next(),this.dispose$.complete()}}class gc extends st{constructor(n){super();C(this,"_ref",0);this._rootDisposable=n}inc(){if(this._disposed)throw new Error("[RCDisposable]: should not ref to a disposed.");this._ref+=1}dec(){this._ref-=1,this._ref===0&&(this._rootDisposable.dispose(),this.dispose())}}const Mn=je.createIdentifier("univer.context-service");class Ho extends st{constructor(){super(...arguments);C(this,"_contextChanged$",new Oe.Subject);C(this,"contextChanged$",this._contextChanged$.asObservable());C(this,"_contextMap",new Map)}dispose(){super.dispose(),this._contextChanged$.complete()}getContextValue(n){var r;return(r=this._contextMap.get(n))!=null?r:!1}setContextValue(n,r){this._contextMap.set(n,r),this._contextChanged$.next({[n]:r})}subscribeContextValue$(n){return new Oe.Observable(r=>{const s=this._contextChanged$.pipe(Oe.filter(i=>typeof i[n]<"u")).subscribe(i=>r.next(i[n]));return this._contextMap.has(n)&&r.next(this._contextMap.get(n)),()=>s.unsubscribe()})}}var jo=(e=>(e[e.SILENT=0]="SILENT",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.VERBOSE=4]="VERBOSE",e))(jo||{});const bt=je.createIdentifier("univer.log");class Wo extends st{constructor(){super(...arguments);C(this,"_logLevel",3);C(this,"_deduction",new Set)}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)}deprecate(...n){this._logLevel>=2&&this._logWithDeduplication(console.error,...n)}setLogLevel(n){this._logLevel=n}_log(n,...r){const s=r[0];/^\[(.*?)\]/g.test(s)?n(`\x1B[97;104m${s}\x1B[0m`,...r.slice(1)):n(...r)}_logWithDeduplication(n,...r){const s=mc(...r);this._deduction.has(s)||(this._deduction.add(s),this._log(n,...r))}}function mc(...e){return e.map(t=>JSON.stringify(t)).join("")}var _c=Object.getOwnPropertyDescriptor,pc=(e,t,n,r)=>{for(var s=r>1?void 0:r?_c(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Ni=(e,t)=>(n,r)=>t(n,r,e),rr=(e=>(e[e.COMMAND=0]="COMMAND",e[e.OPERATION=1]="OPERATION",e[e.MUTATION=2]="MUTATION",e))(rr||{});const sr=je.createIdentifier("univer.core.command-service");class Ec{constructor(){C(this,"_commands",new Map);C(this,"_commandTypes",new Map)}registerCommand(t){if(this._commands.has(t.id))throw new Error(`[CommandRegistry]: command "${t.id}" has been registered before.`);return this._commands.set(t.id,t),this._commandTypes.set(t.id,t.type),nt(()=>{this.unregisterCommand(t.id)})}unregisterCommand(t){this._commands.delete(t),this._commandTypes.delete(t)}hasCommand(t){return this._commands.has(t)}getCommand(t){return this._commands.has(t)?[this._commands.get(t)]:null}getCommandType(t){return this._commandTypes.get(t)}}const Yo={id:"nil",type:0,handler:()=>!0};exports.CommandService=class extends st{constructor(n,r){super();C(this,"_commandRegistry");C(this,"_beforeCommandExecutionListeners",[]);C(this,"_commandExecutedListeners",[]);C(this,"_multiCommandDisposables",new Map);C(this,"_commandExecutingLevel",0);C(this,"_commandExecutionStack",[]);this._injector=n,this._logService=r,this._commandRegistry=new Ec,this.registerCommand(Yo)}dispose(){super.dispose(),this._commandExecutedListeners.length=0,this._beforeCommandExecutionListeners.length=0}hasCommand(n){return this._commandRegistry.hasCommand(n)}registerCommand(n){return this._commandRegistry.registerCommand(n)}unregisterCommand(n){var r;this._commandRegistry.unregisterCommand(n),(r=this._multiCommandDisposables.get(n))==null||r.dispose()}registerMultipleCommand(n){return this._registerMultiCommand(n)}beforeCommandExecuted(n){if(this._beforeCommandExecutionListeners.indexOf(n)===-1)return this._beforeCommandExecutionListeners.push(n),nt(()=>{const r=this._beforeCommandExecutionListeners.indexOf(n);this._beforeCommandExecutionListeners.splice(r,1)});throw new Error("[CommandService]: could not add a listener twice.")}onCommandExecuted(n){if(this._commandExecutedListeners.indexOf(n)===-1)return this._commandExecutedListeners.push(n),nt(()=>{const r=this._commandExecutedListeners.indexOf(n);this._commandExecutedListeners.splice(r,1)});throw new Error("[CommandService]: could not add a listener twice.")}async executeCommand(n,r,s){try{const i=this._commandRegistry.getCommand(n);if(i){const[o]=i,a={id:o.id,type:o.type,params:r},l=this._pushCommandExecutionStack(a);this._beforeCommandExecutionListeners.forEach(c=>c(a,s));const u=await this._execute(o,r,s);return this._commandExecutedListeners.forEach(c=>c(a,s)),l.dispose(),u}throw new Error(`[CommandService]: command "${n}" is not registered.`)}catch(i){if(i instanceof bs)return!1;throw i}}syncExecuteCommand(n,r,s){var i;try{const o=this._commandRegistry.getCommand(n);if(o){const[a]=o,l={id:a.id,type:a.type,params:r};if(a.type===2){const h=ic(this._commandExecutionStack,d=>d.type===0);h&&(l.params=(i=l.params)!=null?i:{},l.params.trigger=h.id)}const u=this._pushCommandExecutionStack(l);this._beforeCommandExecutionListeners.forEach(h=>h(l,s));const c=this._syncExecute(a,r,s);return this._commandExecutedListeners.forEach(h=>h(l,s)),u.dispose(),c}throw new Error(`[CommandService]: command "${n}" is not registered.`)}catch(o){if(o instanceof bs)return!1;throw o}}_pushCommandExecutionStack(n){return this._commandExecutionStack.push(n),nt(()=>nr(this._commandExecutionStack,n))}_registerMultiCommand(n){const r=this._commandRegistry.getCommand(n.id);let s;if(r){if(r[0].multi!==!0)throw new Error("Command has registered as a single command.");s=r[0]}else{s=new Cc(n.id);const o=new Xr;o.add(this._commandRegistry.registerCommand(s)),o.add(nt(()=>{this._multiCommandDisposables.delete(n.id)})),this._multiCommandDisposables.set(n.id,o)}const i=s.registerImplementation(n);return nt(()=>{var o;i.dispose(),s.hasImplementations()||(o=this._multiCommandDisposables.get(n.id))==null||o.dispose()})}async _execute(n,r,s){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(this._commandExecutingLevel,0))}executing command "${n.id}"`),this._commandExecutingLevel++;let i;try{i=await this._injector.invoke(n.handler,r,s),this._commandExecutingLevel--}catch(o){throw i=!1,this._commandExecutingLevel=0,o}return i}_syncExecute(n,r,s){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(0,this._commandExecutingLevel))}executing command "${n.id}".`),this._commandExecutingLevel++;let i;try{if(i=this._injector.invoke(n.handler,r,s),i instanceof Promise)throw new TypeError("[CommandService]: Command handler should not return a promise.");this._commandExecutingLevel--}catch(o){throw i=!1,this._commandExecutingLevel=0,o}return i}};exports.CommandService=pc([Ni(0,je.Inject(je.Injector)),Ni(1,bt)],exports.CommandService);class Cc{constructor(t){C(this,"name");C(this,"multi",!0);C(this,"type",0);C(this,"priority",0);C(this,"_implementations",[]);C(this,"handler",async(t,n)=>{if(!this._implementations.length)return!1;const r=t.get(bt),s=t.get(Mn),i=t.get(je.Injector);for(const o of this._implementations){const a=o.command.preconditions;if((!a||a&&a(s))&&(r.debug("[MultiCommand]",`executing implementation "${o.command.name}".`),await i.invoke(o.command.handler,n)))return!0}return!1});this.id=t,this.name=t}registerImplementation(t){const n={command:t};return this._implementations.push(n),this._implementations.sort((r,s)=>s.command.priority-r.command.priority),nt(()=>{const r=this._implementations.indexOf(n);this._implementations.splice(r,1)})}hasImplementations(){return this._implementations.length>0}}function qr(e,t,n){const r=e.map(s=>()=>t.syncExecuteCommand(s.id,s.params,n));return $o(r)}function Rc(e,t,n){const r=e.map(s=>()=>t.executeCommand(s.id,s.params,n));return Bo(r)}function Go(e){return new Oe.Observable(t=>{const n=e((...r)=>t.next(r));return()=>n==null?void 0:n.dispose()})}function As(e){return function(n){return new Oe.Observable(r=>(n.subscribe({next:s=>{r.next(s),e(s)&&r.complete()},complete:()=>r.complete(),error:s=>r.error(s)}),()=>r.unsubscribe()))}}function Ic(e=0){return t=>{let n=[];return t.pipe(Oe.tap(r=>n.push(r)),Oe.debounceTime(e),Oe.map(()=>n),Oe.tap(()=>n=[]))}}function Sc(e){const t=new Oe.ReplaySubject(1);return setTimeout(()=>t.next(),e),t.pipe(Oe.take(1))}function vc(e,t){const n=new Oe.BehaviorSubject(t);return e.subscribe(n),n}const Oc=e=>new Promise(t=>{Oe.merge(Go(e.onCommandExecuted.bind(e)).pipe(Ar.filter(([n])=>n.type===rr.MUTATION)),Oe.timer(300)).pipe(Ar.debounceTime(16),Ar.first()).subscribe(()=>{t()})});function zo(e,t){let n=0,r=e.length-1;if(t<e[0])return 0;if(t>=e[e.length-1])return e.length-1;for(;n<=r;){if(e[n]===t){for(;n<e.length&&e[n]===t;)n++;return n}if(t>e[n]&&t<e[n+1])return n+1;if(e[r]===t){for(;r<e.length&&e[r]===t;)r++;return r}if(t>e[r-1]&&t<e[r])return r;n++,r--}return-1}function wc(e,t){let n=0,r=e.length-1;for(;n<=r;){const s=Math.floor((r+n)/2);if(t<e[s]&&(s===0||t>=e[s-1]))return s;if(t>=e[s])n=s+1;else if(t<e[s])r=s-1;else return-1}return-1}function Vo(e,t){let n=0,r=e.length;for(;n<r;){const s=Math.floor((n+r)/2);e[s]<=t?n=s+1:r=s}return n<e.length?n:e.length-1}function Bn(e,t,n=!1){let r=e.length-1;if(t<0||t<e[0])return 0;if(e.length<40||t<=e[20]||t>=e[r-20]?r=zo(e,t):r=Vo(e,t),n){const s=e[r];return e.indexOf(s)}return r}function bc(e){const t=new Blob([e],{type:"text/javascript"});return window.URL.createObjectURL(t)}const $n=2,Ko=1;function Ac(e,t){if(t==null||e==null)return!0;const{left:n=0,top:r=0,height:s=0,width:i=0,angle:o=0}=t,{left:a=0,top:l=0,height:u=0,width:c=0,angle:h=0}=e,d=c,f=u,p=i,R=s;return Math.abs(a-n)>$n||Math.abs(l-r)>$n||Math.abs(d-p)>$n||Math.abs(f-R)>$n||Math.abs(h-o)>Ko}var Xo=(e=>(e[e.DEFAULT_SERIES=0]="DEFAULT_SERIES",e[e.ALTERNATE_SERIES=1]="ALTERNATE_SERIES",e))(Xo||{}),Xe=(e=>(e[e.NONE=0]="NONE",e[e.THIN=1]="THIN",e[e.HAIR=2]="HAIR",e[e.DOTTED=3]="DOTTED",e[e.DASHED=4]="DASHED",e[e.DASH_DOT=5]="DASH_DOT",e[e.DASH_DOT_DOT=6]="DASH_DOT_DOT",e[e.DOUBLE=7]="DOUBLE",e[e.MEDIUM=8]="MEDIUM",e[e.MEDIUM_DASHED=9]="MEDIUM_DASHED",e[e.MEDIUM_DASH_DOT=10]="MEDIUM_DASH_DOT",e[e.MEDIUM_DASH_DOT_DOT=11]="MEDIUM_DASH_DOT_DOT",e[e.SLANT_DASH_DOT=12]="SLANT_DASH_DOT",e[e.THICK=13]="THICK",e))(Xe||{}),qo=(e=>(e.TOP="top",e.BOTTOM="bottom",e.LEFT="left",e.RIGHT="right",e.NONE="none",e.ALL="all",e.OUTSIDE="outside",e.INSIDE="inside",e.HORIZONTAL="horizontal",e.VERTICAL="vertical",e.TLBR="tlbr",e.TLBC_TLMR="tlbc_tlmr",e.TLBR_TLBC_TLMR="tlbr_tlbc_tlmr",e.BLTR="bl_tr",e.MLTR_BCTR="mltr_bctr",e))(qo||{}),It=(e=>(e[e.UNSUPPORTED=0]="UNSUPPORTED",e[e.RGB=1]="RGB",e[e.HEX=2]="HEX",e[e.THEME=3]="THEME",e))(It||{}),Jo=(e=>(e[e.ON=0]="ON",e[e.OFF=1]="OFF",e))(Jo||{}),Zo=(e=>(e[e.PASTE_NORMAL=0]="PASTE_NORMAL",e[e.PASTE_NO_BORDERS=1]="PASTE_NO_BORDERS",e[e.PASTE_FORMAT=2]="PASTE_FORMAT",e[e.PASTE_FORMULA=3]="PASTE_FORMULA",e[e.PASTE_DATA_VALIDATION=4]="PASTE_DATA_VALIDATION",e[e.PASTE_VALUES=5]="PASTE_VALUES",e[e.PASTE_CONDITIONAL_FORMATTING=6]="PASTE_CONDITIONAL_FORMATTING",e[e.PASTE_COLUMN_WIDTHS=7]="PASTE_COLUMN_WIDTHS",e))(Zo||{}),Qo=(e=>(e[e.LEFT=0]="LEFT",e[e.RIGHT=1]="RIGHT",e))(Qo||{}),ea=(e=>(e[e.DOCUMENT=0]="DOCUMENT",e[e.PROJECT=1]="PROJECT",e))(ea||{}),ta=(e=>(e[e.COLUMNS=0]="COLUMNS",e[e.ROWS=1]="ROWS",e))(ta||{}),na=(e=>(e[e.UP=0]="UP",e[e.RIGHT=1]="RIGHT",e[e.DOWN=2]="DOWN",e[e.LEFT=3]="LEFT",e))(na||{});function Tc(e){switch(e){case 3:return 1;case 1:return 3;case 0:return 2;case 2:return 0}}var ra=(e=>(e[e.INTERPOLATION_POINT_TYPE_UNSPECIFIED=0]="INTERPOLATION_POINT_TYPE_UNSPECIFIED",e[e.MIN=1]="MIN",e[e.MAX=2]="MAX",e[e.NUMBER=3]="NUMBER",e[e.PERCENT=4]="PERCENT",e[e.PERCENTILE=5]="PERCENTILE",e))(ra||{}),ir=(e=>(e.EN_US="enUS",e.FR_FR="frFR",e.ZH_CN="zhCN",e.RU_RU="ruRU",e.ZH_TW="zhTW",e.VI_VN="viVN",e.FA_IR="faIR",e))(ir||{}),Br=(e=>(e[e.PERSON=0]="PERSON",e[e.FILE=1]="FILE",e[e.DATE=2]="DATE",e[e.LOCATION=3]="LOCATION",e[e.EVENT=4]="EVENT",e))(Br||{}),sa=(e=>(e[e.RANGE=0]="RANGE",e[e.SHEET=1]="SHEET",e))(sa||{}),ia=(e=>(e.Line="line",e.LineInv="lineInv",e.Triangle="triangle",e.RtTriangle="rtTriangle",e.Rect="rect",e.Diamond="diamond",e.Parallelogram="parallelogram",e.Trapezoid="trapezoid",e.NonIsocelesTrapezoid="nonIsocelesTrapezoid",e.Pentagon="pentagon",e.Hexagon="hexagon",e.Heptagon="heptagon",e.Octagon="octagon",e.Decagon="decagon",e.Dodecagon="dodecagon",e.Star4="star4",e.Star5="star5",e.Star6="star6",e.Star7="star7",e.Star8="star8",e.Star10="star10",e.Star12="star12",e.Star16="star16",e.Star24="star24",e.Star32="star32",e.RoundRect="roundRect",e.Round1Rect="round1Rect",e.Round2SameRect="round2SameRect",e.Round2DiagRect="round2DiagRect",e.Ellipse="ellipse",e))(ia||{}),oa=(e=>(e.RightArrow="rightArrow",e.LeftArrow="leftArrow",e.UpArrow="upArrow",e.DownArrow="downArrow",e.LeftRightArrow="leftRightArrow",e.UpDownArrow="upDownArrow",e.QuadArrow="quadArrow",e.LeftRightUpArrow="leftRightUpArrow",e.BentArrow="bentArrow",e.UturnArrow="uturnArrow",e.CircularArrow="circularArrow",e.NotchedRightArrow="notchedRightArrow",e.HomePlate="homePlate",e.Chevron="chevron",e.LeftCircularArrow="leftCircularArrow",e.LeftRightCircularArrow="leftRightCircularArrow",e))(oa||{}),aa=(e=>(e.Plaque="plaque",e.Can="can",e.Cube="cube",e.Bevel="bevel",e.Donut="donut",e.NoSmoking="noSmoking",e.BlockArc="blockArc",e.FoldedCorner="foldedCorner",e))(aa||{}),la=(e=>(e.SmileyFace="smileyFace",e.Heart="heart",e.LightningBolt="lightningBolt",e.Sun="sun",e.Moon="moon",e.Cloud="cloud",e.Arc="arc",e.Backpack="backpack",e.Frame="frame",e.HalfFrame="halfFrame",e.Corner="corner",e.Chord="chord",e.Pie="pie",e.Teardrop="teardrop",e.WedgeRectCallout="wedgeRectCallout",e.WedgeRRectCallout="wedgeRRectCallout",e.WedgeEllipseCallout="wedgeEllipseCallout",e.CloudCallout="cloudCallout",e.BorderCallout1="borderCallout1",e.BorderCallout2="borderCallout2",e.BorderCallout3="borderCallout3",e.AccentCallout1="accentCallout1",e.AccentCallout2="accentCallout2",e.AccentCallout3="accentCallout3",e.Callout1="callout1",e.Callout2="callout2",e.Callout3="callout3",e.ActionButtonBackPrevious="actionButtonBackPrevious",e.ActionButtonEnd="actionButtonEnd",e.ActionButtonForwardNext="actionButtonForwardNext",e.ActionButtonHelp="actionButtonHelp",e.ActionButtonHome="actionButtonHome",e.ActionButtonInformation="actionButtonInformation",e.ActionButtonMovie="actionButtonMovie",e.ActionButtonReturn="actionButtonReturn",e.ActionButtonSound="actionButtonSound",e))(la||{}),ua=(e=>(e[e.RELATIVE_DATE_UNSPECIFIED=0]="RELATIVE_DATE_UNSPECIFIED",e[e.PAST_YEAR=1]="PAST_YEAR",e[e.PAST_MONTH=2]="PAST_MONTH",e[e.PAST_WEEK=3]="PAST_WEEK",e[e.YESTERDAY=4]="YESTERDAY",e[e.TODAY=5]="TODAY",e[e.TOMORROW=6]="TOMORROW",e))(ua||{}),ca=(e=>(e[e.GRID=0]="GRID",e[e.KANBAN=1]="KANBAN",e[e.GANTT=2]="GANTT",e))(ca||{}),qn=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",e[e.RIGHT_TO_LEFT=2]="RIGHT_TO_LEFT",e))(qn||{}),ha=(e=>(e[e.DASH=0]="DASH",e[e.DASH_DOT_DOT_HEAVY=1]="DASH_DOT_DOT_HEAVY",e[e.DASH_DOT_HEAVY=2]="DASH_DOT_HEAVY",e[e.DASHED_HEAVY=3]="DASHED_HEAVY",e[e.DASH_LONG=4]="DASH_LONG",e[e.DASH_LONG_HEAVY=5]="DASH_LONG_HEAVY",e[e.DOT_DASH=6]="DOT_DASH",e[e.DOT_DOT_DASH=7]="DOT_DOT_DASH",e[e.DOTTED=8]="DOTTED",e[e.DOTTED_HEAVY=9]="DOTTED_HEAVY",e[e.DOUBLE=10]="DOUBLE",e[e.NONE=11]="NONE",e[e.SINGLE=12]="SINGLE",e[e.THICK=13]="THICK",e[e.WAVE=14]="WAVE",e[e.WAVY_DOUBLE=15]="WAVY_DOUBLE",e[e.WAVY_HEAVY=16]="WAVY_HEAVY",e[e.WORDS=17]="WORDS",e))(ha||{}),At=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LEFT=1]="LEFT",e[e.CENTER=2]="CENTER",e[e.RIGHT=3]="RIGHT",e[e.JUSTIFIED=4]="JUSTIFIED",e[e.BOTH=5]="BOTH",e[e.DISTRIBUTED=6]="DISTRIBUTED",e))(At||{}),rn=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TOP=1]="TOP",e[e.MIDDLE=2]="MIDDLE",e[e.BOTTOM=3]="BOTTOM",e))(rn||{}),ln=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.OVERFLOW=1]="OVERFLOW",e[e.CLIP=2]="CLIP",e[e.WRAP=3]="WRAP",e))(ln||{}),$r=(e=>(e[e.NORMAL=0]="NORMAL",e[e.ITALIC=1]="ITALIC",e))($r||{}),Hr=(e=>(e[e.NORMAL=0]="NORMAL",e[e.BOLD=1]="BOLD",e))(Hr||{}),kt=(e=>(e[e.NORMAL=1]="NORMAL",e[e.SUBSCRIPT=2]="SUBSCRIPT",e[e.SUPERSCRIPT=3]="SUPERSCRIPT",e))(kt||{}),Ie=(e=>(e[e.FALSE=0]="FALSE",e[e.TRUE=1]="TRUE",e))(Ie||{}),Kt=(e=>(e[e.STRING=1]="STRING",e[e.NUMBER=2]="NUMBER",e[e.BOOLEAN=3]="BOOLEAN",e[e.FORCE_STRING=4]="FORCE_STRING",e))(Kt||{}),ft=(e=>(e[e.DARK1=0]="DARK1",e[e.LIGHT1=1]="LIGHT1",e[e.DARK2=2]="DARK2",e[e.LIGHT2=3]="LIGHT2",e[e.ACCENT1=4]="ACCENT1",e[e.ACCENT2=5]="ACCENT2",e[e.ACCENT3=6]="ACCENT3",e[e.ACCENT4=7]="ACCENT4",e[e.ACCENT5=8]="ACCENT5",e[e.ACCENT6=9]="ACCENT6",e[e.HYPERLINK=10]="HYPERLINK",e[e.FOLLOWED_HYPERLINK=11]="FOLLOWED_HYPERLINK",e))(ft||{}),Jr=(e=>(e.OFFICE="Office",e.OFFICE_2007_2010="Office 2007-2010",e.GRAYSCALE="Grayscale",e.BLUE_WARM="Blue Warm",e.BLUE="Blue",e.BLUE_II="Blue II",e.BLUE_GREEN="Blue Green",e.GREEN="Green",e.GREEN_YELLOW="Green Yellow",e.YELLOW="Yellow",e.YELLOW_ORANGE="Yellow Orange",e.ORANGE="Orange",e.ORANGE_RED="Orange Red",e.RED_ORANGE="Red Orange",e.RED="Red",e.RED_VIOLET="Red Violet",e.VIOLET="Violet",e.VIOLET_II="Violet II",e.MEDIAN="Median",e.PAPER="Paper",e.MARQUEE="Marquee",e.SLIPSTREAM="Slipstream",e.Aspect="Aspect",e))(Jr||{});const yc="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Nc=e=>crypto.getRandomValues(new Uint8Array(e)),Mc=(e,t,n)=>{let r=(2<<Math.log2(e.length-1))-1,s=-~(1.6*r*t/e.length);return(i=t)=>{let o="";for(;;){let a=n(s),l=s|0;for(;l--;)if(o+=e[a[l]&r]||"",o.length>=i)return o}}},Dc=(e,t=21)=>Mc(e,t|0,Nc),Lc=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=yc[n[e]&63];return t};const da=new Set(["ac","ad","ae","aero","af","ag","ai","al","am","ao","aq","ar","arpa","as","asia","at","au","aw","ax","az","ba","bb","bd","be","bf","bg","bh","bi","biz","bj","bm","bn","bo","br","bs","bt","bv","bw","by","bz","ca","cat","cc","cd","cf","cg","ch","ci","ck","cl","cm","cn","co","com","coop","cr","cu","cv","cw","cx","cy","cz","de","dj","dk","dm","do","dz","ec","edu","ee","eg","er","es","et","eu","fi","fj","fk","fm","fo","fr","ga","gb","gd","ge","gf","gg","gh","gi","gl","gm","gn","gov","gp","gq","gr","gs","gt","gu","gw","gy","hk","hm","hn","hr","ht","hu","id","ie","il","im","in","info","int","io","iq","ir","is","it","je","jm","jo","jobs","jp","ke","kg","kh","ki","km","kn","kp","kr","kw","ky","kz","la","lb","lc","li","lk","lr","ls","lt","lu","lv","ly","ma","mc","md","me","mg","mh","mil","mk","ml","mm","mn","mo","mobi","mp","mq","mr","ms","mt","mu","museum","mv","mw","mx","my","mz","na","name","nc","ne","net","nf","ng","ni","nl","no","np","nr","nu","nz","om","onion","org","pa","pe","pf","pg","ph","pk","pl","pm","pn","post","pr","pro","ps","pt","pw","py","qa","re","ro","rs","ru","rw","sa","sb","sc","sd","se","sg","sh","si","sj","sk","sl","sm","sn","so","sr","ss","st","su","sv","sx","sy","sz","tc","td","tel","tf","tg","th","tj","tk","tl","tm","tn","to","tr","tt","tv","tw","tz","ua","ug","uk","us","uy","uz","va","vc","ve","vg","vi","vn","vu","wf","ws","yt","za","zm","zw"]),xc=new RegExp("^(?:(?:(?:https?|ftp):)?\\/\\/)?(?:\\S+(?::\\S*)?@)?(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z0-9\\u00a1-\\uffff][a-z0-9\\u00a1-\\uffff_-]{0,62})?[a-z0-9\\u00a1-\\uffff]\\.)+(?:[a-z\\u00a1-\\uffff]{2,}\\.?))(?::\\d{2,5})?(?:[/?#]\\S*)?$","i");function Uc(e){if(!Number.isNaN(+e))return!1;if(e.startsWith("http://localhost:3002")||e.startsWith("localhost:3002"))return!0;if(xc.test(e)){if(fa(e))return!0;try{const r=new URL(ga(e)).hostname.split(".").pop();if(r&&da.has(r))return!0}catch{return!1}}return!1}function fa(e){return/^[a-zA-Z]+:\/\//.test(e)}function Pc(e){return/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(e)}function ga(e){return fa(e)?e:Pc(e)?`mailto://${e}`:`https://${e}`}const kc=/^-ms-/,Fc=/-([a-z])/g,Yt=["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"];function Qs(e,t){const n=re.getValueType(e),r=re.getValueType(t);return n!==r?!1:re.isArray(e)?Bc(e,t):re.isObject(e)?$c(e,t):re.isDate(e)?e.getTime()===t.getTime():re.isRegExp(e)?e.toString()===t.toString():e===t}function Bc(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;n++){const s=e[n],i=t[n];if(!Qs(s,i))return!1}return!0}function $c(e,t){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const s of n){if(!r.includes(s))return!1;const i=e[s],o=t[s];if(!Qs(i,o))return!1}return!0}class re{static deleteNull(t){for(const n in t)(t[n]===null||t[n]===void 0)&&delete t[n];return t}static stringAt(t){let n="",r=t;for(;r>=Yt.length;)r/=Yt.length,r-=1,n+=Yt[r%Yt.length];const s=t%Yt.length;return n+=Yt[s],n}static indexAt(t){let n=0;for(let r=0;r<t.length-1;r+=1){const s=t.charCodeAt(r)-65,i=t.length-1-r;n+=Yt.length**i+Yt.length*s}return n+=t.charCodeAt(t.length-1)-65,n}static deleteBlank(t){return re.isString(t)?t.replace(/\s/g,""):t}static getSystemType(){const t=navigator.userAgent,n=navigator.platform==="Win32"||navigator.platform==="Windows",r=navigator.platform==="Mac68K"||navigator.platform==="MacPPC"||navigator.platform==="Macintosh"||navigator.platform==="MacIntel";if(r)return"Mac";if(navigator.platform==="X11"&&!n&&!r)return"Unix";if(String(navigator.platform).indexOf("Linux")>-1)return"Linux";if(n){if(t.indexOf("Windows NT 5.0")>-1||t.indexOf("Windows 2000")>-1)return"Windows 2000";if(t.indexOf("Windows NT 5.1")>-1||t.indexOf("Windows XP")>-1)return"Windows XP";if(t.indexOf("Windows NT 5.2")>-1||t.indexOf("Windows 2003")>-1)return"Windows 2003";if(t.indexOf("Windows NT 6.0")>-1||t.indexOf("Windows Vista")>-1)return"Windows Vista";if(t.indexOf("Windows NT 6.1")>-1||t.indexOf("Windows 7")>-1)return"Windows 7";if(t.indexOf("Windows NT 10")>-1||t.indexOf("Windows 10")>-1)return"Windows 10";if(t.indexOf("Windows NT 11")>-1||t.indexOf("Windows 11")>-1)return"Windows 11"}return"Unknown system"}static getBrowserType(){const t=navigator.userAgent,n=t.indexOf("Opera")>-1,r=t.indexOf("compatible")>-1&&t.indexOf("MSIE")>-1&&!n,s=t.indexOf("Trident")>-1&&t.indexOf("rv:11.0")>-1,i=t.indexOf("Edge")>-1,o=t.indexOf("Firefox")>-1,a=t.indexOf("Safari")>-1&&t.indexOf("Chrome")===-1,l=t.indexOf("Chrome")>-1&&t.indexOf("Safari")>-1;if(r){new RegExp("MSIE (\\d+\\.\\d+);").test(t);const c=Number.parseFloat(RegExp.$1);return c===7?"IE7":c===8?"IE8":c===9?"IE9":c===10?"IE10":"0"}return o?"FF":n?"Opera":a?"Safari":l?"Chrome":i?"Edge":s?"IE11":"Unknown browser"}static generateRandomId(t=21,n){return Ft(t,n)}static getClassName(t){return t.constructor.name}static deepMerge(t,...n){n.forEach(o=>o&&i(o));function r(o,a){o.forEach((l,u)=>{var c,h;if(re.isArray(l)){const d=(c=a[u])!=null?c:[];a[u]=d,r(l,d);return}if(re.isObject(l)){const d=(h=a[u])!=null?h:{};a[u]=d,s(l,d);return}a[u]=l})}function s(o,a){Object.keys(o).forEach(l=>{var c,h;const u=o[l];if(re.isObject(u)){const d=(c=a[l])!=null?c:{};a[l]=d,s(u,d);return}if(re.isArray(u)){const d=(h=a[l])!=null?h:[];a[l]=d,r(u,d);return}a[l]=u})}function i(o){Object.keys(o).forEach(a=>{var u,c;const l=o[a];if(re.isArray(l)){const h=(u=t[a])!=null?u:[];t[a]=h,r(l,h);return}if(re.isObject(l)){const h=(c=t[a])!=null?c:{};t[a]=h,s(l,h);return}t[a]=l})}return t}static numberFixed(t,n){return Number(Number(t).toFixed(n))}static diffValue(t,n){return Qs(t,n)}static deepClone(t){if(!this.isDefine(t))return t;if(this.isRegExp(t))return new RegExp(t);if(this.isDate(t))return new Date(t);if(this.isArray(t)){const n=[];return t.forEach((r,s)=>{n[s]=re.deepClone(r)}),n}if(this.isObject(t)){const n={};return Object.keys(t).forEach(r=>{const s=t[r];n[r]=re.deepClone(s)}),Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n}return t}static getLanguage(){const t="en-US";return globalThis.navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||t}static getValueType(t){return Object.prototype.toString.apply(t)}static isDefine(t){return t!=null}static isBlank(t){return this.isDefine(t)?this.isString(t)?t.trim()==="":!1:!0}static isBoolean(t){return this.getValueType(t)==="[object Boolean]"}static isPlainObject(t){return this.isDefine(t)?Object.getPrototypeOf(t)===Object.getPrototypeOf({}):!1}static isFunction(t){return this.getValueType(t)==="[object Function]"}static isDate(t){return this.getValueType(t)==="[object Date]"}static isRegExp(t){return this.getValueType(t)==="[object RegExp]"}static isArray(t){return this.getValueType(t)==="[object Array]"}static isString(t){return this.getValueType(t)==="[object String]"}static isNumber(t){return this.getValueType(t)==="[object Number]"}static isStringNumber(t){return!isNaN(Number.parseFloat(t))&&isFinite(t)}static isObject(t){return this.getValueType(t)==="[object Object]"}static isEmptyObject(t){for(const n in t)return!1;return!0}static isMobile(){let t=0,n=0;return document.body.clientWidth&&(t=document.body.clientWidth),document.body.clientHeight&&(n=document.body.clientHeight),this.isAndroid()||this.isIPhone()||this.isTablet()||t<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 t=navigator.userAgent.toLowerCase();return String(t.match(/MicroMessenger/i))==="micromessenger"}static isAndroid(){const t=navigator.userAgent;return t.indexOf("Android")>-1||t.indexOf("Linux")>-1}static isIPhone(){return/iPhone/i.test(navigator.userAgent)}static isLegalUrl(t){return Uc(t)}static normalizeUrl(t){return ga(t)}static topLevelDomainCombiningString(){return[...da].join("|")}static itCount(t){return n=>{for(let r=0;r<t;r++)n&&n()}}static hasLength(t,n){return re.isDefine(t)?re.isDefine(n)?t.length===n:t.length>0:!1}static capitalize(t){return t.charAt(0).toUpperCase()+t.slice(1)}static fCamelCase(t,n){return n.toUpperCase()}static camelCase(t){return t.replace(kc,"ms-").replace(Fc,this.fCamelCase)}static removeNull(t){return this.isObject(t)&&Object.keys(t).forEach(n=>{const r=t[n];r==null?delete t[n]:re.removeNull(r)}),t}static fillTwoDimensionalArray(t,n,r){return new Array(t).fill(r).map(s=>new Array(n).fill(r))}static numToWord(t){let n="";for(;t>0;){let r=t%26;r=r===0?r=26:r,n=String.fromCharCode(96+r)+n,t=(t-r)/26}return n.toLocaleUpperCase()}static ABCatNum(t){if(t==null||t.length===0)return Number.NaN;const n=t.toLowerCase().split(""),r=n.length;let s=0,i=0;for(let o=0;o<r;o++)i=n[o].charCodeAt(0)-96,s+=i*26**(r-o-1);return s===0?Number.NaN:s-1}static chatAtABC(t){let i="";for(;t>=0;)i=String.fromCharCode(t%26+97)+i,t=Math.floor(t/26)-1;return i.toUpperCase()}static randSort(t){for(let n=0,r=t.length;n<r;n++){const s=Number.parseInt((Math.random()*r).toString()),i=t[s];t[s]=t[n],t[n]=i}return t}static commonExtend(t,n){const r={};for(const s in t)r[s]=t[s];for(const s in n)n[s]!=null&&(r[s]=n[s]);return r}static commonExtend1(t,n){for(const r in t)n[r]==null&&(n[r]=t[r]);return n}static arrayToObject(t){const n={};return t.forEach((r,s)=>{n[s]={},r.forEach((i,o)=>{n[s][o]=i})}),n}static hasIntersectionBetweenTwoRanges(t,n,r,s){return n>=r&&s>=t}static isStartValidPosition(t){return/^[A-Za-z_]/.test(t)}static isValidParameter(t){const n=/[~!@#$%^&*()+=\-{}\[\]\|:;"'<>,?\/ ]+/.test(t),r=t.length<=255;return!n&&r}static clamp(t,n,r){return Math.max(n,Math.min(r,t))}static now(){return performance&&performance.now?performance.now():Date.now()}}function Ft(e=21,t){return t?Dc(t,e)():Lc(e)}function Ts(...e){const t={},n=e.length;for(let r=n-1;r>=0;r--){const s=e[r];if(s){const i=Object.keys(s);for(const o of i)t[o]===void 0&&(t[o]=s[o])}}return t}const Hc=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null;function Tr(e,t,n){const{dataStream:r,textRuns:s=[]}=e;let i=t;const o=[];for(const a of s){const{st:l,ed:u}=a;re.hasIntersectionBetweenTwoRanges(t,n,l,u)&&(l>i?(o.push(r.slice(i,l)),o.push(ys(r,{...a,ed:Math.min(u,n)}))):o.push(ys(r,{...a,st:i,ed:Math.min(u,n)}))),i=Math.max(t,Math.min(u,n))}return i!==n&&o.push(r.slice(i,n)),o.join("")}function jc(e,t=!0){var n;if(t&&((n=e.paragraphs)!=null&&n.length)){const{dataStream:r,paragraphs:s=[]}=e;let i="",o=-1;for(const a of s){const{startIndex:l,paragraphStyle:u={}}=a,{spaceAbove:c,spaceBelow:h,lineSpacing:d}=u,f=[];c!=null&&(typeof c=="number"?f.push(`margin-top: ${c}px`):f.push(`margin-top: ${c.v}px`)),h!=null&&(typeof h=="number"?f.push(`margin-bottom: ${h}px`):f.push(`margin-bottom: ${h.v}px`)),d!=null&&f.push(`line-height: ${d}`),l>o+1?i+=`<p class="UniverNormal" ${f.length?`style="${f.join("; ")};"`:""}>${Tr(e,o+1,l)}</p>`:i+=`<p class="UniverNormal" ${f.length?`style="${f.join("; ")};"`:""}></p>`,o=l}return o!==r.length&&(i+=Tr(e,o,r.length)),i}else return Tr(e,0,e.dataStream.length)}function ys(e,t){const{st:n,ed:r,ts:s={}}=t,{ff:i,fs:o,it:a,bl:l,ul:u,st:c,ol:h,bg:d,cl:f,va:p}=s;let R=e.slice(n,r);const w=[];return a===Ie.TRUE&&(R=`<i>${R}</i>`),p===kt.SUPERSCRIPT?R=`<sup>${R}</sup>`:p===kt.SUBSCRIPT&&(R=`<sub>${R}</sub>`),(u==null?void 0:u.s)===Ie.TRUE&&(R=`<u>${R}</u>`),(c==null?void 0:c.s)===Ie.TRUE&&(R=`<s>${R}</s>`),l===Ie.TRUE&&(R=`<strong>${R}</strong>`),i&&w.push(`font-family: ${i}`),f&&w.push(`color: ${f.rgb}`),o&&w.push(`font-size: ${o}pt`),h&&w.push("text-decoration: overline"),d&&w.push(`background: ${d.rgb}`),w.length?`<span style="${w.join("; ")};">${R}</span>`:R}const ma={[Jr.OFFICE]:{[ft.ACCENT1]:"#4472C4",[ft.ACCENT2]:"#ED7D31",[ft.ACCENT3]:"#A5A5A5",[ft.ACCENT4]:"#70AD47",[ft.ACCENT5]:"#5B9BD5",[ft.ACCENT6]:"#70AD47",[ft.DARK1]:"#000000",[ft.DARK2]:"#44546A",[ft.LIGHT1]:"#FFFFFF",[ft.LIGHT2]:"#E7E6E6",[ft.HYPERLINK]:"#0563C1",[ft.FOLLOWED_HYPERLINK]:"#954F72"}};class Zr{constructor(){C(this,"_themeValue",ft.LIGHT1);C(this,"_themeColors");C(this,"_themeTint");C(this,"_rgbValue","");C(this,"_colorType");this._colorType=It.UNSUPPORTED,this._themeColors=Jr.OFFICE,this._themeTint=0}asRgbColor(){return new jr(this._rgbValue,this)}asThemeColor(){return new Wr(this._themeValue,this._themeTint,this._themeColors,this)}build(){switch(this._colorType){case It.THEME:return this.asThemeColor();case It.RGB:return this.asRgbColor();case It.UNSUPPORTED:throw new Error("unsupported color type")}}setRgbColor(t){return this._colorType=It.RGB,this._rgbValue=t,this}setThemeColors(t){this._colorType=It.THEME,this._themeColors=t}setThemeTint(t){this._colorType=It.THEME,this._themeTint=t}setThemeColor(t){return this._colorType=It.THEME,this._themeValue=t,this}getColorType(){return this._colorType}}class un{constructor(t){C(this,"_builder");this._builder=t}static rgbColorToHexValue(t){return`#${((1<<24)+(t.getRed()<<16)+(t.getGreen()<<8)+t.getBlue()).toString(16).slice(1)}`}static hexValueToRgbColor(t){t?t.indexOf("#")>-1&&(t=t.substring(1)):t="#000000";const n=+`0x${t[0]}${t[1]}`,r=+`0x${t[2]}${t[3]}`,s=+`0x${t[4]}${t[5]}`;return new Zr().setRgbColor(`rgb(${n},${r},${s})`).asRgbColor()}static hexToRgbString(t){const n=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;t=t.replace(n,(i,o,a,l)=>o+o+a+a+l+l);const r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);let s=null;if(r){const i=Number.parseInt(r[1],16),o=Number.parseInt(r[2],16),a=Number.parseInt(r[3],16);s=`rgba(${i},${o},${a})`}return s}asRgbColor(){return this._builder.asRgbColor()}asThemeColor(){return this._builder.asThemeColor()}getColorType(){return this._builder.getColorType()}clone(){return new un(this._builder)}equals(t){return!1}}class _a{constructor(t){C(this,"_saturation",0);C(this,"_hue",0);C(this,"_lightness",0);C(this,"_alpha",0);const n=t.getRed()/255,r=t.getGreen()/255,s=t.getBlue()/255,i=t.getAlpha()/255,o=Math.min(n,Math.min(r,s)),a=Math.max(n,Math.max(r,s)),l=a-o;if(a===o){this._hue=0,this._saturation=0,this._lightness=a;return}this._lightness=(o+a)/2,this._lightness<.5?this._saturation=l/(a+o):this._saturation=l/(2-a-o),n===a&&(this._hue=(r-s)/l),r===a&&(this._hue=2+(s-n)/l),s===a&&(this._hue=4+(n-r)/l),this._hue*=60,this._hue<0&&(this._hue+=360),this._alpha=i}asRgbColor(){const t=new Zr;if(this._saturation===0)return t.setRgbColor(`rgba(${this._lightness*255},${this._lightness*255},${this._lightness*255},${this._alpha*255})`),t.asRgbColor();let n;this._lightness<.5?n=this._lightness*(1+this._saturation):n=this._lightness+this._saturation-this._lightness*this._saturation;const r=2*this._lightness-n,s=this._hue/360,i=s+1/3,o=this.setColor(n,r,i),a=this.setColor(n,r,s),l=s-1/3,u=this.setColor(n,r,l);return t.setRgbColor(`rgba(${Math.round(o*255)},${Math.round(a*255)},${Math.round(u*255)},${this._alpha*255})`),t.asRgbColor()}getLightness(){return this._lightness}getHue(){return this._hue}getSaturation(){return this._saturation}getAlpha(){return this._alpha}setColor(t,n,r){r<0&&(r+=1),r>1&&(r-=1);let s;return 6*r<1?s=n+(t-n)*6*r:2*r<1?s=t:3*r<2?s=n+(t-n)*(2/3-r)*6:s=n,s}setLightness(t){this._lightness=t}}const Rt=class Rt extends un{constructor(n,r){super(r);C(this,"_cssString");C(this,"_red");C(this,"_green");C(this,"_blue");C(this,"_alpha");let s=n.match(Rt.RGBA_EXTRACT);if(s){const i=+s[1],o=+s[2],a=+s[3],l=+s[4];this._cssString=n,this._red=i,this._green=o,this._blue=a,this._alpha=l;return}if(s=n.match(Rt.RGB_EXTRACT),s){const i=+s[1],o=+s[2],a=+s[3];this._cssString=n,this._red=i,this._green=o,this._blue=a,this._alpha=1;return}throw new Error("Invalid rgba or rgb color")}asHexString(){return un.rgbColorToHexValue(this)}getRed(){let n=this._red+Rt.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getGreen(){let n=this._green+Rt.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getBlue(){let n=this._blue+Rt.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getAlpha(){return this._alpha}getColorType(){return It.RGB}clone(){return new Rt(this._cssString,this._builder)}asThemeColor(){throw new Error("rgb color not support to themeColor")}equals(n){return n instanceof Rt?n._red===this._red&&n._blue===this._blue&&n._green===this._green&&n._alpha===this._alpha:!1}getCssString(){return this._cssString}};C(Rt,"RGB_COLOR_AMT",0),C(Rt,"RGBA_EXTRACT",new RegExp("\\s*rgba\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d.\\d|\\d\\s*)\\)\\s*")),C(Rt,"RGB_EXTRACT",new RegExp("\\s*rgb\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*)\\)\\s*"));let jr=Rt;const Gt=class Gt extends un{constructor(n,r,s,i){super(i);C(this,"_themeColorType");C(this,"_themeTint");C(this,"_themeColors");this._themeColorType=n,this._themeTint=r,this._themeColors=s}lumValue(n,r){if(n==null)return r;let s;return n<0?s=r*(1+n):s=r*(1-n)+(255-255*(1-n)),s}asRgbColor(){const n=ma[this._themeColors];if(n==null)throw new Error("not find themeColors type");const r=n[this._themeColorType];if(r==null)throw new Error("not find themeColors value");let s;if(Gt._cacheThemeColor.has(this._themeColors)){if(s=Gt._cacheThemeColor.get(this._themeColors),s.has(this._themeColorType))return s.get(this._themeColorType)}else s=new Map,Gt._cacheThemeColor.set(this._themeColors,s);const i=new _a(un.hexValueToRgbColor(r));i.setLightness(this.lumValue(this._themeTint,i.getLightness()*255)/255);const o=i.asRgbColor();return s.set(this._themeColorType,o),o}clone(){return new Gt(this._themeColorType,this._themeTint,this._themeColors,this._builder)}equals(n){return n instanceof Gt?n._themeColorType===this._themeColorType:!1}getColorType(){return It.THEME}getThemeColorType(){return this._themeColorType}};C(Gt,"_cacheThemeColor",new Map);let Wr=Gt;const Wc="rgb(",Yc="rgba(",Ns={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 wt{constructor(t){C(this,"_color");C(this,"_rgbColor");C(this,"_isValid",!1);if(t==null){this._setNullColor();return}if(t instanceof wt){this._color={...t._color},this._rgbColor={...t._rgbColor};return}const n=pa(t);if(n==null){this._setNullColor();return}this._color=n;const r=Xc(this._color);if(r==null){this._setNullColor();return}this._rgbColor=r,this._isValid=!0}static mix(t,n,r){var u,c;r=Math.min(1,Math.max(0,r));const s=new wt(t).toRgb(),i=new wt(n).toRgb(),o=(u=s.a)!=null?u:1,a=(c=i.a)!=null?c:1,l={r:(i.r-s.r)*r+s.r,g:(i.g-s.g)*r+s.g,b:(i.b-s.b)*r+s.b,a:(a-o)*r+o};return new wt(l)}static getContrastRatio(t,n){const r=new wt(t).getLuminance(),s=new wt(n).getLuminance();return(Math.max(r,s)+.05)/(Math.min(r,s)+.05)}get isValid(){return this._isValid}toRgb(){return this._rgbColor}toRgbString(){const{r:t,g:n,b:r,a:s=1}=this.toRgb(),i=s<1;return`rgb${i?"a":""}(${t},${n},${r}${i?`,${s}`:""})`}toString(){return this.toRgbString()}toHexString(t){const{r:n,g:r,b:s,a:i=1}=this.toRgb(),o=i<1,a=[_r(Math.round(n).toString(16)),_r(Math.round(r).toString(16)),_r(Math.round(s).toString(16)),_r(Math.round(i*255).toString(16))];return t&&a[0][0]===a[0][1]&&a[1][0]===a[1][1]&&a[2][0]===a[2][1]&&a[3][0]===a[3][1]?o?`#${a[0][0]}${a[1][0]}${a[2][0]}${a[3][0]}`:`#${a[0][0]}${a[1][0]}${a[2][0]}`:o?`#${a[0]}${a[1]}${a[2]}${a[3]}`:`#${a[0]}${a[1]}${a[2]}`}toHsv(){return Qc(this.toRgb())}toHsl(){return Zc(this.toRgb())}lighten(t=10){const n=this.toHsl();return n.l+=t,n.l=Math.min(Math.max(n.l,0),100),new wt(n)}darken(t=10){const n=this.toHsl();return n.l-=t,n.l=Math.min(Math.max(n.l,0),100),new wt(n)}setAlpha(t){return new wt({...this._rgbColor,a:t})}getLuminance(){let{r:t,g:n,b:r}=this.toRgb();return t=ls(t),n=ls(n),r=ls(r),Number((.2126*t+.7152*n+.0722*r).toFixed(3))}getBrightness(){const{r:t,g:n,b:r}=this.toRgb();return(t*299+n*587+r*114)/1e3}getAlpha(){var t;return(t=this._color.a)!=null?t: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 _r=e=>e.length===1?`0${e}`:e,ls=e=>(e/=255,e<=.03928?e/12.92:((e+.055)/1.055)**2.4),pa=e=>{if(th(e)){if("r"in e){const r={r:Math.round(e.r),g:Math.round(e.g),b:Math.round(e.b)};return e.a!==void 0&&(r.a=e.a),r}if("l"in e){const r={h:Math.round(e.h),s:e.s,l:e.l};return e.a!==void 0&&(r.a=e.a),r}const n={h:Math.round(e.h),s:e.s,v:e.v};return e.a!==void 0&&(n.a=e.a),n}const t=e.trim();if(Ns[t]){const n=Ns[t],r={r:Math.round(n[0]),g:Math.round(n[1]),b:Math.round(n[2])};return r.a=n[3]||1,r}if(t.startsWith("#"))return Gc(t);if(t.startsWith("rgb"))return zc(t);if(t.startsWith("hsl"))return Vc(t);if(t.startsWith("hsv"))return Kc(t)},Gc=e=>{const t=e.substring(1),n=new RegExp(`.{1,${t.length>=6?2:1}}`,"g");let r=t.match(n);if(!r||r.length<3)throw new Error(`The color '${e}' is illegal hex color`);r[0].length===1&&(r=r.map(i=>i+i));const s={r:Number.parseInt(r[0],16),g:Number.parseInt(r[1],16),b:Number.parseInt(r[2],16)};return r.length>3&&(s.a=Number.parseInt(r[3],16)/255),s},zc=e=>{const t=e.indexOf("(");if(t===-1)throw new Error(`The color '${e}' is illegal rgb color`);const n=e.substring(t+1,e.length-1).split(",");if(n.length<3)throw new Error(`The color '${e}' is illegal rgb color`);const r={r:Number.parseInt(n[0],10),g:Number.parseInt(n[1],10),b:Number.parseInt(n[2],10)};return n.length>3&&(r.a=Number.parseFloat(n[3])),r},Vc=e=>{const t=e.indexOf("(");if(t===-1)throw new Error(`The color '${e}' is illegal hsl color`);const n=e.substring(t+1,e.length-1).split(",");if(n.length<3)throw new Error(`The color '${e}' is illegal hsl color`);const r={h:Number.parseInt(n[0],10),s:Number.parseFloat(n[1]),l:Number.parseFloat(n[2])};return n.length>3&&(r.a=Number.parseFloat(n[3])),r},Kc=e=>{const t=e.indexOf("(");if(t===-1)throw new Error(`The color '${e}' is illegal hsv color`);const n=e.substring(t+1,e.length-1).split(",");if(n.length<3)throw new Error(`The color '${e}' is illegal hsv color`);const r={h:Number.parseInt(n[0],10),s:Number.parseFloat(n[1]),v:Number.parseFloat(n[2])};return n.length>3&&(r.a=Number.parseFloat(n[3])),r},Xc=e=>{const t=pa(e);if(t!=null)return"r"in t?t:"l"in t?qc(t):Jc(t)},us=(e,t,n)=>(n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e),qc=e=>{let{h:t,s:n,l:r}=e;t/=360,n/=100,r/=100;let s=0,i=0,o=0;if(n===0)s=i=o=r;else{const l=r<.5?r*(1+n):r+n-r*n,u=2*r-l;s=us(u,l,t+1/3),i=us(u,l,t),o=us(u,l,t-1/3)}const a={r:Math.round(s*255),g:Math.round(i*255),b:Math.round(o*255)};return e.a!==void 0&&(a.a=e.a),a},Jc=e=>{let{h:t,s:n,v:r}=e;t=t/360*6,n/=100,r/=100;const s=Math.floor(t),i=t-s,o=r*(1-n),a=r*(1-i*n),l=r*(1-(1-i)*n),u=s%6,c=[r,a,o,o,l,r][u],h=[l,r,r,a,o,o][u],d=[o,o,l,r,r,a][u],f={r:c*255,g:h*255,b:d*255};return e.a!==void 0&&(f.a=e.a),f},Zc=e=>{let{r:t,g:n,b:r}=e;t/=255,n/=255,r/=255;const s=Math.max(t,n,r),i=Math.min(t,n,r),o=(s+i)/2;let a,l;if(s===i)a=l=0;else{const c=s-i;switch(l=o>.5?c/(2-s-i):c/(s+i),s){case t:a=(n-r)/c+(n<r?6:0);break;case n:a=(r-t)/c+2;break;default:a=(t-n)/c+4;break}a/=6}const u={h:Math.round(a*360),s:Math.round(l*100),l:Math.round(o*100)};return e.a!==void 0&&(u.a=e.a),u},Qc=e=>{let{r:t,g:n,b:r}=e;t/=255,n/=255,r/=255;const s=Math.max(t,n,r),i=Math.min(t,n,r);let o;const a=s,l=s-i,u=s===0?0:l/s;if(s===i)o=0;else{switch(s){case t:o=(n-r)/l+(n<r?6:0);break;case n:o=(r-t)/l+2;break;default:o=(t-n)/l+4;break}o/=6}const c={h:Math.round(o*360),s:Math.round(u*100),v:Math.round(a*100)};return e.a!==void 0&&(c.a=e.a),c},eh=e=>e==null,th=e=>!eh(e)&&typeof e=="object";function nh(e){const t=/^#(?:[0]{3}|[0]{6})\b/,n=/^rgb\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*\)$/,r=/^rgba\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*,\s*(1|1\.0*|0?\.\d+)\)$/,s=/^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!!(t.test(e)||n.test(e)||r.test(e)||s.test(e)||i.test(e))}function rh(e){const t=/^#(?:[Ff]{3}|[Ff]{6})\b/,n=/^rgb\s*\(\s*255\s*,\s*255\s*,\s*255\s*\)$/,r=/^rgba\s*\(\s*255\s*,\s*255\s*,\s*255\s*,\s*(1|1\.0*|0?\.\d+)\)$/,s=/^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!!(t.test(e)||n.test(e)||r.test(e)||s.test(e)||i.test(e))}var xe=(e=>(e[e.COVER=0]="COVER",e[e.REPLACE=1]="REPLACE",e))(xe||{});function sh(e){return e&&(e.s!==void 0||e.p!==void 0||e.v!==void 0||e.t!==void 0||e.f!==void 0||e.si!==void 0||e.custom!==void 0)}function ih(e){if(e.t!==void 0)return e.t;if(typeof e.v=="string")return Kt.STRING;if(typeof e.v=="number")return Kt.NUMBER;if(typeof e.v=="boolean")return Kt.BOOLEAN}function oh(e){if(e==null)return!0;const{v:t,f:n,si:r,p:s,custom:i}=e;return!(!(t==null||typeof t=="string"&&t.length===0)||n!=null&&n.length>0||r!=null&&r.length>0||s!=null||i!=null)}function ah(e){return e!=null&&(typeof e=="string"||typeof e=="number"||typeof e=="boolean")}var Le=(e=>(e[e.NORMAL=0]="NORMAL",e[e.ROW=1]="ROW",e[e.COLUMN=2]="COLUMN",e[e.ALL=3]="ALL",e))(Le||{}),tt=(e=>(e[e.NONE=0]="NONE",e[e.ROW=1]="ROW",e[e.COLUMN=2]="COLUMN",e[e.ALL=3]="ALL",e))(tt||{});function lh(e){return[e.startRow,e.startColumn,e.endRow,e.endColumn]}var Ea=(e=>(e.NONE="none",e.BACKWARD="backward",e.FORWARD="forward",e))(Ea||{}),Ca=(e=>(e.RECT="RECT",e.TEXT="TEXT",e))(Ca||{});function uh(e,t,n){let r=!1,s=!1,i=e,o=t,a=e,l=t;if(n==null)return{actualRow:e,actualColumn:t,isMergedMainCell:s,isMerged:r,endRow:i,endColumn:o,startRow:a,startColumn:l};for(let u=0;u<n.length;u++){const{startRow:c,endRow:h,startColumn:d,endColumn:f}=n[u];if(e===c&&t===d){i=h,o=f,a=c,l=d,s=!0;break}if(e>=c&&e<=h&&t>=d&&t<=f){i=h,o=f,a=c,l=d,r=!0;break}}return{actualRow:e,actualColumn:t,isMergedMainCell:s,isMerged:r,endRow:i,endColumn:o,startRow:a,startColumn:l}}var In=(e=>(e.Raw="raw",e.Intercepted="intercepted",e.Both="both",e))(In||{});function Ra(e){const{actualRow:t,actualColumn:n,isMerged:r,isMergedMainCell:s,mergeInfo:i}=e;let{startY:o,endY:a,startX:l,endX:u}=e,c=t,h=n,d=t,f=n;if(r&&i){const{startRow:p,startColumn:R,endRow:w,endColumn:N,startY:z,endY:W,startX:se,endX:y}=i;c=p,h=R,d=w,f=N,o=z,a=W,l=se,u=y}return s&&(o=i.startY,a=i.endY,l=i.startX,u=i.endX,d=i.endRow,f=i.endColumn),{startRow:c,startColumn:h,endRow:d,endColumn:f,startY:o,endY:a,startX:l,endX:u}}const ch=Ra;function hh(e){if(!e)return;const{actualRow:t,actualColumn:n,isMerged:r,isMergedMainCell:s,startRow:i,startColumn:o,endRow:a,endColumn:l}=e;let u=t,c=n,h=t,d=n;return(r||s)&&(u=i,c=o,h=a,d=l),{startRow:u,startColumn:c,endRow:h,endColumn:d}}function Ia(e){var n;return!e||(((n=e==null?void 0:e.v)==null?void 0:n.toString())||"").length===0&&!e.p}function Ms(e){return Ia(e)&&(e==null?void 0:e.coverable)!==!1}function Dt(e){if(e){if(e.rgb)return e.rgb;if(e.th)return new Zr().setThemeColor(e.th).asThemeColor().asRgbColor().getCssString()}return null}function dh(e){return re.isString(e)&&e.substring(0,1)==="="&&e.length>1}function fh(e){return re.isString(e)&&e.length>0}function gh(e,t=!1){var i;let n="";const r=new Map([["ff",()=>{e.ff&&(n+=`font-family: ${e.ff}; `)}],["fs",()=>{if(e.fs){let o=e.fs;e.va&&(o/=2),n+=`font-size: ${o}pt; `}}],["it",()=>{e.it&&(n+="font-style: italic; ")}],["bl",()=>{e.bl&&(n+="font-weight: bold; ")}],["ul",()=>{var o;(o=e.ul)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} underline`):n+="text-decoration: underline; ",e.ul.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${Dt(e.ul.cl)}; `),e.ul.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${e.ul.t} `))}],["st",()=>{var o;(o=e.st)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} line-through`):n+="text-decoration-line: line-through; ",e.st.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${Dt(e.st.cl)}; `),e.st.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${e.st.t} `))}],["ol",()=>{var o;(o=e.ol)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} overline`):n+="text-decoration-line: overline; ",e.ol.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${Dt(e.ol.cl)}; `),e.ol.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${e.ol.t} `))}],["bg",()=>{e.bg&&(n+=`background: ${Dt(e.bg)}; `)}],["bd",()=>{var o,a,l,u,c,h,d,f,p,R,w,N;(o=e.bd)!=null&&o.b&&(n+=`border-bottom: ${pr((a=e.bd)==null?void 0:a.b.s)} ${(l=Dt(e.bd.b.cl))!=null?l:""}; `),(u=e.bd)!=null&&u.t&&(n+=`border-top: ${pr((c=e.bd)==null?void 0:c.t.s)} ${(h=Dt(e.bd.t.cl))!=null?h:""}; `),(d=e.bd)!=null&&d.r&&(n+=`border-right: ${pr((f=e.bd)==null?void 0:f.r.s)} ${(p=Dt(e.bd.r.cl))!=null?p:""}; `),(R=e.bd)!=null&&R.l&&(n+=`border-left: ${pr((w=e.bd)==null?void 0:w.l.s)} ${(N=Dt(e.bd.l.cl))!=null?N:""}; `)}],["cl",()=>{e.cl&&(n+=`color: ${Dt(e.cl)}; `)}],["va",()=>{e.va===kt.SUBSCRIPT?n+="vertical-align: sub; ":e.va===kt.SUPERSCRIPT&&(n+="vertical-align: super; ")}],["td",()=>{e.td===qn.LEFT_TO_RIGHT?n+="direction: ltr; ":e.td===qn.RIGHT_TO_LEFT&&(n+="direction: rtl; ")}],["tr",()=>{var o,a,l;e.tr&&(n+=`--data-rotate: (${(o=e.tr)==null?void 0:o.a}deg${(a=e.tr)!=null&&a.v?` ,${(l=e.tr)==null?void 0:l.v}`:""});`)}],["ht",()=>{e.ht===At.LEFT?n+="text-align: left; ":e.ht===At.RIGHT?n+="text-align: right; ":e.ht===At.CENTER?n+="text-align: center; ":e.ht===At.JUSTIFIED&&(n+="text-align: justify; ")}],["vt",()=>{e.vt===rn.BOTTOM?n+="vertical-align: bottom; ":e.vt===rn.TOP?n+="vertical-align: top; ":e.vt===rn.MIDDLE&&(n+="vertical-align: middle; ")}],["tb",()=>{e.tb===ln.CLIP?n+="white-space: nowrap; overflow-x: hidden; ":e.tb===ln.WRAP&&(n+="white-space: normal;")}],["pd",()=>{var c,h,d,f,p,R,w,N;const o=`${(c=e.pd)==null?void 0:c.b}pt`,a=`${(h=e.pd)==null?void 0:h.t}pt`,l=`${(d=e.pd)==null?void 0:d.l}pt`,u=`${(f=e.pd)==null?void 0:f.r}pt`;(p=e.pd)!=null&&p.b&&(n+=`padding-bottom: ${o}; `),(R=e.pd)!=null&&R.t&&(n+=`padding-top: ${a}; `),(w=e.pd)!=null&&w.l&&(n+=`padding-left: ${l}; `),(N=e.pd)!=null&&N.r&&(n+=`padding-right: ${u}; `)}]]),s=["bd","tr","tb"];for(const o in e)t&&s.includes(o)||(i=r.get(o))==null||i();return n}function pr(e){let t="";return e===Xe.NONE?t="none":e===Xe.THIN?t="0.5pt solid":e===Xe.HAIR?t="0.5pt double":e===Xe.DOTTED?t="0.5pt dotted":e===Xe.DASHED||e===Xe.DASH_DOT?t="0.5pt dashed":e===Xe.DASH_DOT_DOT?t="0.5pt dotted":e===Xe.DOUBLE?t="0.5pt double":e===Xe.MEDIUM?t="1pt solid":e===Xe.MEDIUM_DASHED||e===Xe.MEDIUM_DASH_DOT?t="1pt dashed":e===Xe.MEDIUM_DASH_DOT_DOT?t="1pt dotted":e===Xe.SLANT_DASH_DOT?t="0.5pt dashed":e===Xe.THICK&&(t="1.5pt solid"),t}function mh(e){let t=0;if(e=e.trim(),e==="none")t=Xe.NONE;else if(e==="0.5pt solid")t=Xe.THIN;else if(e==="0.5pt double")t=Xe.HAIR;else if(e==="0.5pt dotted")t=Xe.DOTTED;else if(e==="0.5pt dashed")t=Xe.DASHED;else if(e==="1pt solid")t=Xe.MEDIUM;else if(e==="1pt dashed")t=Xe.MEDIUM_DASHED;else if(e==="1pt dotted")t=Xe.MEDIUM_DASH_DOT_DOT;else if(e==="1.5pt solid")t=Xe.THICK;else if(!e.includes("none"))t=Xe.THIN;else return Xe.NONE;return t}function _h(e,t){let n=e.body;if(t){const{headers:r,footers:s}=e;r!=null&&r[t]?n=r[t].body:s!=null&&s[t]&&(n=s[t].body)}return n}function ph(e,t){const{startRow:n,endRow:r,startColumn:s,endColumn:i,rangeType:o}=e;if(n<0||s<0||r<0||i<0||!(Number.isNaN(n)&&Number.isNaN(r))&&o===Le.COLUMN||!(Number.isNaN(s)&&Number.isNaN(i))&&o===Le.ROW||o!==Le.ROW&&o!==Le.COLUMN&&(Number.isNaN(s)||Number.isNaN(n)||Number.isNaN(i)||Number.isNaN(r)))return!1;if(t){const a=t.getRowCount(),l=t.getColumnCount();if(r>=a||i>=l)return!1}return!0}function Eh(e,t){return{startRow:e,endRow:e,startColumn:t,endColumn:t}}function ei(e,t){return Object.prototype.toString.call(e)===Object.prototype.toString.call(t)?Object.prototype.toString.call(e)==="[object Object]"||Object.prototype.toString.call(e)==="[object Array]"?Object.keys(e).length!==Object.keys(t).length?!1:Object.keys(e).every(n=>ei(e[n],t[n])):e===t:!1}function Sa(e,t){const n=e.ts||{},r=t.ts||{};return e.sId!==t.sId?!1:ei(n,r)}function Ch(e,t){return t.some(n=>e.indexOf(n)>-1)}function Et(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var yr={exports:{}},Rh=yr.exports,Mi;function Ih(){return Mi||(Mi=1,function(e,t){(function(n,r){e.exports=r()})(Rh,function(){var n=1e3,r=6e4,s=36e5,i="millisecond",o="second",a="minute",l="hour",u="day",c="week",h="month",d="quarter",f="year",p="date",R="Invalid Date",w=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,N=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,z={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(D){var b=["th","st","nd","rd"],O=D%100;return"["+D+(b[(O-20)%10]||b[O]||b[0])+"]"}},W=function(D,b,O){var k=String(D);return!k||k.length>=b?D:""+Array(b+1-k.length).join(O)+D},se={s:W,z:function(D){var b=-D.utcOffset(),O=Math.abs(b),k=Math.floor(O/60),B=O%60;return(b<=0?"+":"-")+W(k,2,"0")+":"+W(B,2,"0")},m:function D(b,O){if(b.date()<O.date())return-D(O,b);var k=12*(O.year()-b.year())+(O.month()-b.month()),B=b.clone().add(k,h),V=O-B<0,ie=b.clone().add(k+(V?-1:1),h);return+(-(k+(O-B)/(V?B-ie:ie-B))||0)},a:function(D){return D<0?Math.ceil(D)||0:Math.floor(D)},p:function(D){return{M:h,y:f,w:c,d:u,D:p,h:l,m:a,s:o,ms:i,Q:d}[D]||String(D||"").toLowerCase().replace(/s$/,"")},u:function(D){return D===void 0}},y="en",A={};A[y]=z;var j="$isDayjsObject",Z=function(D){return D instanceof H||!(!D||!D[j])},fe=function D(b,O,k){var B;if(!b)return y;if(typeof b=="string"){var V=b.toLowerCase();A[V]&&(B=V),O&&(A[V]=O,B=V);var ie=b.split("-");if(!B&&ie.length>1)return D(ie[0])}else{var de=b.name;A[de]=b,B=de}return!k&&B&&(y=B),B||!k&&y},le=function(D,b){if(Z(D))return D.clone();var O=typeof b=="object"?b:{};return O.date=D,O.args=arguments,new H(O)},_=se;_.l=fe,_.i=Z,_.w=function(D,b){return le(D,{locale:b.$L,utc:b.$u,x:b.$x,$offset:b.$offset})};var H=function(){function D(O){this.$L=fe(O.locale,null,!0),this.parse(O),this.$x=this.$x||O.x||{},this[j]=!0}var b=D.prototype;return b.parse=function(O){this.$d=function(k){var B=k.date,V=k.utc;if(B===null)return new Date(NaN);if(_.u(B))return new Date;if(B instanceof Date)return new Date(B);if(typeof B=="string"&&!/Z$/i.test(B)){var ie=B.match(w);if(ie){var de=ie[2]-1||0,ge=(ie[7]||"0").substring(0,3);return V?new Date(Date.UTC(ie[1],de,ie[3]||1,ie[4]||0,ie[5]||0,ie[6]||0,ge)):new Date(ie[1],de,ie[3]||1,ie[4]||0,ie[5]||0,ie[6]||0,ge)}}return new Date(B)}(O),this.init()},b.init=function(){var O=this.$d;this.$y=O.getFullYear(),this.$M=O.getMonth(),this.$D=O.getDate(),this.$W=O.getDay(),this.$H=O.getHours(),this.$m=O.getMinutes(),this.$s=O.getSeconds(),this.$ms=O.getMilliseconds()},b.$utils=function(){return _},b.isValid=function(){return this.$d.toString()!==R},b.isSame=function(O,k){var B=le(O);return this.startOf(k)<=B&&B<=this.endOf(k)},b.isAfter=function(O,k){return le(O)<this.startOf(k)},b.isBefore=function(O,k){return this.endOf(k)<le(O)},b.$g=function(O,k,B){return _.u(O)?this[k]:this.set(B,O)},b.unix=function(){return Math.floor(this.valueOf()/1e3)},b.valueOf=function(){return this.$d.getTime()},b.startOf=function(O,k){var B=this,V=!!_.u(k)||k,ie=_.p(O),de=function(G,Y){var ue=_.w(B.$u?Date.UTC(B.$y,Y,G):new Date(B.$y,Y,G),B);return V?ue:ue.endOf(u)},ge=function(G,Y){return _.w(B.toDate()[G].apply(B.toDate("s"),(V?[0,0,0,0]:[23,59,59,999]).slice(Y)),B)},ye=this.$W,Ae=this.$M,S=this.$D,F="set"+(this.$u?"UTC":"");switch(ie){case f:return V?de(1,0):de(31,11);case h:return V?de(1,Ae):de(0,Ae+1);case c:var K=this.$locale().weekStart||0,q=(ye<K?ye+7:ye)-K;return de(V?S-q:S+(6-q),Ae);case u:case p:return ge(F+"Hours",0);case l:return ge(F+"Minutes",1);case a:return ge(F+"Seconds",2);case o:return ge(F+"Milliseconds",3);default:return this.clone()}},b.endOf=function(O){return this.startOf(O,!1)},b.$set=function(O,k){var B,V=_.p(O),ie="set"+(this.$u?"UTC":""),de=(B={},B[u]=ie+"Date",B[p]=ie+"Date",B[h]=ie+"Month",B[f]=ie+"FullYear",B[l]=ie+"Hours",B[a]=ie+"Minutes",B[o]=ie+"Seconds",B[i]=ie+"Milliseconds",B)[V],ge=V===u?this.$D+(k-this.$W):k;if(V===h||V===f){var ye=this.clone().set(p,1);ye.$d[de](ge),ye.init(),this.$d=ye.set(p,Math.min(this.$D,ye.daysInMonth())).$d}else de&&this.$d[de](ge);return this.init(),this},b.set=function(O,k){return this.clone().$set(O,k)},b.get=function(O){return this[_.p(O)]()},b.add=function(O,k){var B,V=this;O=Number(O);var ie=_.p(k),de=function(Ae){var S=le(V);return _.w(S.date(S.date()+Math.round(Ae*O)),V)};if(ie===h)return this.set(h,this.$M+O);if(ie===f)return this.set(f,this.$y+O);if(ie===u)return de(1);if(ie===c)return de(7);var ge=(B={},B[a]=r,B[l]=s,B[o]=n,B)[ie]||1,ye=this.$d.getTime()+O*ge;return _.w(ye,this)},b.subtract=function(O,k){return this.add(-1*O,k)},b.format=function(O){var k=this,B=this.$locale();if(!this.isValid())return B.invalidDate||R;var V=O||"YYYY-MM-DDTHH:mm:ssZ",ie=_.z(this),de=this.$H,ge=this.$m,ye=this.$M,Ae=B.weekdays,S=B.months,F=B.meridiem,K=function(Y,ue,ae,$){return Y&&(Y[ue]||Y(k,V))||ae[ue].slice(0,$)},q=function(Y){return _.s(de%12||12,Y,"0")},G=F||function(Y,ue,ae){var $=Y<12?"AM":"PM";return ae?$.toLowerCase():$};return V.replace(N,function(Y,ue){return ue||function(ae){switch(ae){case"YY":return String(k.$y).slice(-2);case"YYYY":return _.s(k.$y,4,"0");case"M":return ye+1;case"MM":return _.s(ye+1,2,"0");case"MMM":return K(B.monthsShort,ye,S,3);case"MMMM":return K(S,ye);case"D":return k.$D;case"DD":return _.s(k.$D,2,"0");case"d":return String(k.$W);case"dd":return K(B.weekdaysMin,k.$W,Ae,2);case"ddd":return K(B.weekdaysShort,k.$W,Ae,3);case"dddd":return Ae[k.$W];case"H":return String(de);case"HH":return _.s(de,2,"0");case"h":return q(1);case"hh":return q(2);case"a":return G(de,ge,!0);case"A":return G(de,ge,!1);case"m":return String(ge);case"mm":return _.s(ge,2,"0");case"s":return String(k.$s);case"ss":return _.s(k.$s,2,"0");case"SSS":return _.s(k.$ms,3,"0");case"Z":return ie}return null}(Y)||ie.replace(":","")})},b.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},b.diff=function(O,k,B){var V,ie=this,de=_.p(k),ge=le(O),ye=(ge.utcOffset()-this.utcOffset())*r,Ae=this-ge,S=function(){return _.m(ie,ge)};switch(de){case f:V=S()/12;break;case h:V=S();break;case d:V=S()/3;break;case c:V=(Ae-ye)/6048e5;break;case u:V=(Ae-ye)/864e5;break;case l:V=Ae/s;break;case a:V=Ae/r;break;case o:V=Ae/n;break;default:V=Ae}return B?V:_.a(V)},b.daysInMonth=function(){return this.endOf(h).$D},b.$locale=function(){return A[this.$L]},b.locale=function(O,k){if(!O)return this.$L;var B=this.clone(),V=fe(O,k,!0);return V&&(B.$L=V),B},b.clone=function(){return _.w(this.$d,this)},b.toDate=function(){return new Date(this.valueOf())},b.toJSON=function(){return this.isValid()?this.toISOString():null},b.toISOString=function(){return this.$d.toISOString()},b.toString=function(){return this.$d.toUTCString()},D}(),v=H.prototype;return le.prototype=v,[["$ms",i],["$s",o],["$m",a],["$H",l],["$W",u],["$M",h],["$y",f],["$D",p]].forEach(function(D){v[D[1]]=function(b){return this.$g(b,D[0],D[1])}}),le.extend=function(D,b){return D.$i||(D(b,H,le),D.$i=!0),le},le.locale=fe,le.isDayjs=Z,le.unix=function(D){return le(1e3*D)},le.en=A[y],le.Ls=A,le.p={},le})}(yr)),yr.exports}var Sh=Ih();const $t=Et(Sh);var Nr={exports:{}},vh=Nr.exports,Di;function Oh(){return Di||(Di=1,function(e,t){(function(n,r){e.exports=r()})(vh,function(){return function(n,r){var s=r.prototype,i=s.format;s.format=function(o){var a=this,l=this.$locale();if(!this.isValid())return i.bind(this)(o);var u=this.$utils(),c=(o||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,function(h){switch(h){case"Q":return Math.ceil((a.$M+1)/3);case"Do":return l.ordinal(a.$D);case"gggg":return a.weekYear();case"GGGG":return a.isoWeekYear();case"wo":return l.ordinal(a.week(),"W");case"w":case"ww":return u.s(a.week(),h==="w"?1:2,"0");case"W":case"WW":return u.s(a.isoWeek(),h==="W"?1:2,"0");case"k":case"kk":return u.s(String(a.$H===0?24:a.$H),h==="k"?1:2,"0");case"X":return Math.floor(a.$d.getTime()/1e3);case"x":return a.$d.getTime();case"z":return"["+a.offsetName()+"]";case"zzz":return"["+a.offsetName("long")+"]";default:return h}});return i.bind(this)(c)}}})}(Nr)),Nr.exports}var wh=Oh();const bh=Et(wh);var Mr={exports:{}},Ah=Mr.exports,Li;function Th(){return Li||(Li=1,function(e,t){(function(n,r){e.exports=r()})(Ah,function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},r=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,s=/\d/,i=/\d\d/,o=/\d\d?/,a=/\d*[^-_:/,()\s\d]+/,l={},u=function(w){return(w=+w)+(w>68?1900:2e3)},c=function(w){return function(N){this[w]=+N}},h=[/[+-]\d\d:?(\d\d)?|Z/,function(w){(this.zone||(this.zone={})).offset=function(N){if(!N||N==="Z")return 0;var z=N.match(/([+-]|\d\d)/g),W=60*z[1]+(+z[2]||0);return W===0?0:z[0]==="+"?-W:W}(w)}],d=function(w){var N=l[w];return N&&(N.indexOf?N:N.s.concat(N.f))},f=function(w,N){var z,W=l.meridiem;if(W){for(var se=1;se<=24;se+=1)if(w.indexOf(W(se,0,N))>-1){z=se>12;break}}else z=w===(N?"pm":"PM");return z},p={A:[a,function(w){this.afternoon=f(w,!1)}],a:[a,function(w){this.afternoon=f(w,!0)}],Q:[s,function(w){this.month=3*(w-1)+1}],S:[s,function(w){this.milliseconds=100*+w}],SS:[i,function(w){this.milliseconds=10*+w}],SSS:[/\d{3}/,function(w){this.milliseconds=+w}],s:[o,c("seconds")],ss:[o,c("seconds")],m:[o,c("minutes")],mm:[o,c("minutes")],H:[o,c("hours")],h:[o,c("hours")],HH:[o,c("hours")],hh:[o,c("hours")],D:[o,c("day")],DD:[i,c("day")],Do:[a,function(w){var N=l.ordinal,z=w.match(/\d+/);if(this.day=z[0],N)for(var W=1;W<=31;W+=1)N(W).replace(/\[|\]/g,"")===w&&(this.day=W)}],w:[o,c("week")],ww:[i,c("week")],M:[o,c("month")],MM:[i,c("month")],MMM:[a,function(w){var N=d("months"),z=(d("monthsShort")||N.map(function(W){return W.slice(0,3)})).indexOf(w)+1;if(z<1)throw new Error;this.month=z%12||z}],MMMM:[a,function(w){var N=d("months").indexOf(w)+1;if(N<1)throw new Error;this.month=N%12||N}],Y:[/[+-]?\d+/,c("year")],YY:[i,function(w){this.year=u(w)}],YYYY:[/\d{4}/,c("year")],Z:h,ZZ:h};function R(w){var N,z;N=w,z=l&&l.formats;for(var W=(w=N.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(le,_,H){var v=H&&H.toUpperCase();return _||z[H]||n[H]||z[v].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(D,b,O){return b||O.slice(1)})})).match(r),se=W.length,y=0;y<se;y+=1){var A=W[y],j=p[A],Z=j&&j[0],fe=j&&j[1];W[y]=fe?{regex:Z,parser:fe}:A.replace(/^\[|\]$/g,"")}return function(le){for(var _={},H=0,v=0;H<se;H+=1){var D=W[H];if(typeof D=="string")v+=D.length;else{var b=D.regex,O=D.parser,k=le.slice(v),B=b.exec(k)[0];O.call(_,B),le=le.replace(B,"")}}return function(V){var ie=V.afternoon;if(ie!==void 0){var de=V.hours;ie?de<12&&(V.hours+=12):de===12&&(V.hours=0),delete V.afternoon}}(_),_}}return function(w,N,z){z.p.customParseFormat=!0,w&&w.parseTwoDigitYear&&(u=w.parseTwoDigitYear);var W=N.prototype,se=W.parse;W.parse=function(y){var A=y.date,j=y.utc,Z=y.args;this.$u=j;var fe=Z[1];if(typeof fe=="string"){var le=Z[2]===!0,_=Z[3]===!0,H=le||_,v=Z[2];_&&(v=Z[2]),l=this.$locale(),!le&&v&&(l=z.Ls[v]),this.$d=function(k,B,V,ie){try{if(["x","X"].indexOf(B)>-1)return new Date((B==="X"?1e3:1)*k);var de=R(B)(k),ge=de.year,ye=de.month,Ae=de.day,S=de.hours,F=de.minutes,K=de.seconds,q=de.milliseconds,G=de.zone,Y=de.week,ue=new Date,ae=Ae||(ge||ye?1:ue.getDate()),$=ge||ue.getFullYear(),te=0;ge&&!ye||(te=ye>0?ye-1:ue.getMonth());var oe,me=S||0,be=F||0,De=K||0,X=q||0;return G?new Date(Date.UTC($,te,ae,me,be,De,X+60*G.offset*1e3)):V?new Date(Date.UTC($,te,ae,me,be,De,X)):(oe=new Date($,te,ae,me,be,De,X),Y&&(oe=ie(oe).week(Y).toDate()),oe)}catch{return new Date("")}}(A,fe,j,z),this.init(),v&&v!==!0&&(this.$L=this.locale(v).$L),H&&A!=this.format(fe)&&(this.$d=new Date("")),l={}}else if(fe instanceof Array)for(var D=fe.length,b=1;b<=D;b+=1){Z[1]=fe[b-1];var O=z.apply(this,Z);if(O.isValid()){this.$d=O.$d,this.$L=O.$L,this.init();break}b===D&&(this.$d=new Date(""))}else se.call(this,y)}}})}(Mr)),Mr.exports}var yh=Th();const Nh=Et(yh);var Dr={exports:{}},Mh=Dr.exports,xi;function Dh(){return xi||(xi=1,function(e,t){(function(n,r){e.exports=r()})(Mh,function(){return function(n,r,s){var i=r.prototype,o=function(h){return h&&(h.indexOf?h:h.s)},a=function(h,d,f,p,R){var w=h.name?h:h.$locale(),N=o(w[d]),z=o(w[f]),W=N||z.map(function(y){return y.slice(0,p)});if(!R)return W;var se=w.weekStart;return W.map(function(y,A){return W[(A+(se||0))%7]})},l=function(){return s.Ls[s.locale()]},u=function(h,d){return h.formats[d]||function(f){return f.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(p,R,w){return R||w.slice(1)})}(h.formats[d.toUpperCase()])},c=function(){var h=this;return{months:function(d){return d?d.format("MMMM"):a(h,"months")},monthsShort:function(d){return d?d.format("MMM"):a(h,"monthsShort","months",3)},firstDayOfWeek:function(){return h.$locale().weekStart||0},weekdays:function(d){return d?d.format("dddd"):a(h,"weekdays")},weekdaysMin:function(d){return d?d.format("dd"):a(h,"weekdaysMin","weekdays",2)},weekdaysShort:function(d){return d?d.format("ddd"):a(h,"weekdaysShort","weekdays",3)},longDateFormat:function(d){return u(h.$locale(),d)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};i.localeData=function(){return c.bind(this)()},s.localeData=function(){var h=l();return{firstDayOfWeek:function(){return h.weekStart||0},weekdays:function(){return s.weekdays()},weekdaysShort:function(){return s.weekdaysShort()},weekdaysMin:function(){return s.weekdaysMin()},months:function(){return s.months()},monthsShort:function(){return s.monthsShort()},longDateFormat:function(d){return u(h,d)},meridiem:h.meridiem,ordinal:h.ordinal}},s.months=function(){return a(l(),"months")},s.monthsShort=function(){return a(l(),"monthsShort","months",3)},s.weekdays=function(h){return a(l(),"weekdays",null,null,h)},s.weekdaysShort=function(h){return a(l(),"weekdaysShort","weekdays",3,h)},s.weekdaysMin=function(h){return a(l(),"weekdaysMin","weekdays",2,h)}}})}(Dr)),Dr.exports}var Lh=Dh();const xh=Et(Lh);var Lr={exports:{}},Uh=Lr.exports,Ui;function Ph(){return Ui||(Ui=1,function(e,t){(function(n,r){e.exports=r()})(Uh,function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(r,s,i){var o=s.prototype,a=o.format;i.en.formats=n,o.format=function(l){l===void 0&&(l="YYYY-MM-DDTHH:mm:ssZ");var u=this.$locale().formats,c=function(h,d){return h.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(f,p,R){var w=R&&R.toUpperCase();return p||d[R]||n[R]||d[w].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(N,z,W){return z||W.slice(1)})})}(l,u===void 0?{}:u);return a.call(this,c)}}})}(Lr)),Lr.exports}var kh=Ph();const Fh=Et(kh);var xr={exports:{}},Bh=xr.exports,Pi;function $h(){return Pi||(Pi=1,function(e,t){(function(n,r){e.exports=r()})(Bh,function(){var n="minute",r=/[+-]\d\d(?::?\d\d)?/g,s=/([+-]|\d\d)/g;return function(i,o,a){var l=o.prototype;a.utc=function(R){var w={date:R,utc:!0,args:arguments};return new o(w)},l.utc=function(R){var w=a(this.toDate(),{locale:this.$L,utc:!0});return R?w.add(this.utcOffset(),n):w},l.local=function(){return a(this.toDate(),{locale:this.$L,utc:!1})};var u=l.parse;l.parse=function(R){R.utc&&(this.$u=!0),this.$utils().u(R.$offset)||(this.$offset=R.$offset),u.call(this,R)};var c=l.init;l.init=function(){if(this.$u){var R=this.$d;this.$y=R.getUTCFullYear(),this.$M=R.getUTCMonth(),this.$D=R.getUTCDate(),this.$W=R.getUTCDay(),this.$H=R.getUTCHours(),this.$m=R.getUTCMinutes(),this.$s=R.getUTCSeconds(),this.$ms=R.getUTCMilliseconds()}else c.call(this)};var h=l.utcOffset;l.utcOffset=function(R,w){var N=this.$utils().u;if(N(R))return this.$u?0:N(this.$offset)?h.call(this):this.$offset;if(typeof R=="string"&&(R=function(y){y===void 0&&(y="");var A=y.match(r);if(!A)return null;var j=(""+A[0]).match(s)||["-",0,0],Z=j[0],fe=60*+j[1]+ +j[2];return fe===0?0:Z==="+"?fe:-fe}(R),R===null))return this;var z=Math.abs(R)<=16?60*R:R,W=this;if(w)return W.$offset=z,W.$u=R===0,W;if(R!==0){var se=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(W=this.local().add(z+se,n)).$offset=z,W.$x.$localOffset=se}else W=this.utc();return W};var d=l.format;l.format=function(R){var w=R||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return d.call(this,w)},l.valueOf=function(){var R=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*R},l.isUTC=function(){return!!this.$u},l.toISOString=function(){return this.toDate().toISOString()},l.toString=function(){return this.toDate().toUTCString()};var f=l.toDate;l.toDate=function(R){return R==="s"&&this.$offset?a(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():f.call(this)};var p=l.diff;l.diff=function(R,w,N){if(R&&this.$u===R.$u)return p.call(this,R,w,N);var z=this.local(),W=a(R).local();return p.call(z,W,w,N)}}})}(xr)),xr.exports}var Hh=$h();const jh=Et(Hh);var Ur={exports:{}},Wh=Ur.exports,ki;function Yh(){return ki||(ki=1,function(e,t){(function(n,r){e.exports=r()})(Wh,function(){return function(n,r){r.prototype.weekday=function(s){var i=this.$locale().weekStart||0,o=this.$W,a=(o<i?o+7:o)-i;return this.$utils().u(s)?a:this.subtract(a,"day").add(s,"day")}}})}(Ur)),Ur.exports}var Gh=Yh();const zh=Et(Gh);var Pr={exports:{}},Vh=Pr.exports,Fi;function Kh(){return Fi||(Fi=1,function(e,t){(function(n,r){e.exports=r()})(Vh,function(){var n="week",r="year";return function(s,i,o){var a=i.prototype;a.week=function(l){if(l===void 0&&(l=null),l!==null)return this.add(7*(l-this.week()),"day");var u=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var c=o(this).startOf(r).add(1,r).date(u),h=o(this).endOf(n);if(c.isBefore(h))return 1}var d=o(this).startOf(r).date(u).startOf(n).subtract(1,"millisecond"),f=this.diff(d,n,!0);return f<0?o(this).startOf("week").week():Math.ceil(f)},a.weeks=function(l){return l===void 0&&(l=null),this.week(l)}}})}(Pr)),Pr.exports}var Xh=Kh();const qh=Et(Xh);var kr={exports:{}},Jh=kr.exports,Bi;function Zh(){return Bi||(Bi=1,function(e,t){(function(n,r){e.exports=r()})(Jh,function(){return function(n,r){r.prototype.weekYear=function(){var s=this.month(),i=this.week(),o=this.year();return i===1&&s===11?o+1:s===0&&i>=52?o-1:o}}})}(kr)),kr.exports}var Qh=Zh();const ed=Et(Qh);$t.extend(Nh);$t.extend(bh);$t.extend(zh);$t.extend(xh);$t.extend(qh);$t.extend(ed);$t.extend(jh);$t.extend(Fh);function Qr(e,t,n,r){if(e>t)throw new Error("a1 should be less than a2");if(n>r)throw new Error("b1 should be less than b2");if(t<n||r<e)return[e,t];if(n<=e&&r>=t)return[];const s=r-n+1;return e<n&&t>r?[e,t-s]:n<=e&&r<t?[r+1-s,t-s]:n>e&&r>=t?[e,n-1]:[e,t]}function td(e){if(e==null)return!1;const t=e.bullet;return(t==null?void 0:t.listId)!=null}function nd(e){if(e==null)return!1;const t=e.paragraphStyle;return va(t)}function va(e){var t;return!(e==null||(e.indentStart==null||e.indentStart.v===0)&&e.hanging==null||((t=e.hanging)==null?void 0:t.v)===0)}function Oa(e,t,n){return e.slice(0,t)+n+e.slice(t)}function wa(e,t,n){return t>n?e:e.slice(0,t)+e.slice(n)}function rd(e){if(e==null||typeof e=="boolean")return!1;if(typeof e=="number")return!isNaN(e);if(typeof e=="string"){const t=e.trim();return t===""?!1:!isNaN(Number(t))}return!1}function sd(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+(t<<6)+(t<<16)-t;return t>>>0}const Ke=Symbol("newer"),it=Symbol("older");class id{constructor(t){C(this,"entry");this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[Ke],{done:!1,value:t.key}):{done:!0,value:void 0}}}class od{constructor(t){C(this,"entry");this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[Ke],{done:!1,value:t.value}):{done:!0,value:void 0}}}class ad{constructor(t){C(this,"entry");this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[Ke],{done:!1,value:[t.key,t.value]}):{done:!0,value:void 0}}}var Po,ko;ko=Ke,Po=it;class $i{constructor(t,n){C(this,"key");C(this,"value");C(this,ko);C(this,Po);this.key=t,this.value=n,this[Ke]=void 0,this[it]=void 0}toJSON(){return{key:this.key,value:this.value}}}class Jn{constructor(...t){C(this,"_keymap");C(this,"size",0);C(this,"limit");C(this,"oldest");C(this,"newest");C(this,"_onShiftListeners",[]);if(Hn.hasLength(t,1)){if(Hn.isNumber(t[0])){const n=t[0];this._initialize(n,void 0);return}if(Hn.isIterable(t[0])){const n=t[0];this._initialize(0,n);return}return}if(Hn.hasLength(t,2)){const n=t[0],r=t[1];this._initialize(n,r)}}onShift(t){if(this._onShiftListeners.indexOf(t)===-1)return this._onShiftListeners.push(t),nt(()=>nr(this._onShiftListeners,t));throw new Error("[LRUMap]: the listener has been registered!")}_initialize(t,n){this.oldest=void 0,this.newest=void 0,this.size=0,this.limit=t,this._keymap=new Map,n&&(this.assign(n),t<1&&(this.limit=this.size))}_markEntryAsUsed(t){t!==this.newest&&(t[Ke]&&(t===this.oldest&&(this.oldest=t[Ke]),t[Ke][it]=t[it]),t[it]&&(t[it][Ke]=t[Ke]),t[Ke]=void 0,t[it]=this.newest,this.newest&&(this.newest[Ke]=t),this.newest=t)}assign(t){let n,r=this.limit||Number.MAX_VALUE;this._keymap.clear();const s=t[Symbol.iterator]();for(let i=s.next();!i.done;i=s.next()){const o=new $i(i.value[0],i.value[1]);if(this._keymap.set(o.key,o),n?(n[Ke]=o,o[it]=n):this.oldest=o,n=o,r--===0)throw new Error("overflow")}this.newest=n,this.size=this._keymap.size}set(t,n){let r=this._keymap.get(t);return r?(r.value=n,this._markEntryAsUsed(r),this):(this._keymap.set(t,r=new $i(t,n)),this.newest?(this.newest[Ke]=r,r[it]=this.newest):this.oldest=r,this.newest=r,++this.size,this.size>this.limit&&this.shift(),this)}shift(){const t=this.oldest;if(t)return this.oldest&&this.oldest[Ke]?(this.oldest=this.oldest[Ke],this.oldest[it]=void 0):(this.oldest=void 0,this.newest=void 0),t[Ke]=t[it]=void 0,this._keymap.delete(t.key),--this.size,this._onShiftListeners.forEach(n=>n(t)),[t.key,t.value]}get(t){const n=this._keymap.get(t);if(n)return this._markEntryAsUsed(n),n.value}has(t){return this._keymap.has(t)}find(t){const n=this._keymap.get(t);return n?n.value:void 0}delete(t){const n=this._keymap.get(t);if(n)return this._keymap.delete(n.key),n[Ke]&&n[it]?(n[it][Ke]=n[Ke],n[Ke][it]=n[it]):n[Ke]?(n[Ke][it]=void 0,this.oldest=n[Ke]):n[it]?(n[it][Ke]=void 0,this.newest=n[it]):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 id(this.oldest)}values(){return new od(this.oldest)}entries(){return this[Symbol.iterator]()}[Symbol.iterator](){return new ad(this.oldest)}forEach(t,n){typeof n!="object"&&(n=this);let r=this.oldest;for(;r;)t.call(n,r.value,r.key,this),r=r[Ke]}toJSON(){const t=new Array(this.size);let n=0,r=this.oldest;for(;r;)t[n++]={key:r.key,value:r.value},r=r[Ke];return t}toString(){let t="",n=this.oldest;for(;n;)t+=`${String(n.key)}:${n.value}`,n=n[Ke],n&&(t+=" < ");return t}}class Hn{static hasLength(t,n){return t.length===n}static getValueType(t){return Object.prototype.toString.apply(t)}static isObject(t){return this.getValueType(t)==="[object Object]"}static isIterable(t){return t[Symbol.iterator]!=null}static isNumber(t){return this.getValueType(t)==="[object Number]"}}var Fr={exports:{}},ld=Fr.exports,Hi;function ud(){return Hi||(Hi=1,function(e,t){(function(n,r){e.exports=r()})(typeof self<"u"?self:ld,function(){return function(){var n={d:function(E,g){for(var m in g)n.o(g,m)&&!n.o(E,m)&&Object.defineProperty(E,m,{enumerable:!0,get:g[m]})},o:function(E,g){return Object.prototype.hasOwnProperty.call(E,g)}},r={};n.d(r,{default:function(){return ht}});var s={1078:"af",1052:"sq",1118:"am",5121:"ar_DZ",15361:"ar_BH",3073:"ar_EG",2049:"ar_IQ",11265:"ar_JO",13313:"ar_KW",12289:"ar_LB",4097:"ar_LY",6145:"ar_MA",8193:"ar_OM",16385:"ar_QA",1025:"ar_SA",10241:"ar_SY",7169:"ar_TN",14337:"ar_AE",9217:"ar_YE",1067:"hy",1101:"as",2092:"az_AZ",1068:"az_AZ",1069:"eu",1059:"be",2117:"bn",1093:"bn_IN",5146:"bs",1026:"bg",1109:"my",1027:"ca",2052:"zh_CN",3076:"zh_HK",5124:"zh_MO",4100:"zh_SG",1028:"zh_TW",1050:"hr",1029:"cs",1030:"da",1125:"dv",2067:"nl_BE",1043:"nl_NL",1126:"bin",3081:"en_AU",10249:"en_BZ",4105:"en_CA",9225:"en_CB",2057:"en_GB",16393:"en_IN",6153:"en_IE",8201:"en_JM",5129:"en_NZ",13321:"en_PH",7177:"en_ZA",11273:"en_TT",1033:"en_US",12297:"en_ZW",1061:"et",1071:"mk",1080:"fo",1065:"fa",1124:"fil",1035:"fi",2060:"fr_BE",11276:"fr_CM",3084:"fr_CA",9228:"fr_CG",12300:"fr_CI",1036:"fr_FR",5132:"fr_LU",13324:"fr_ML",6156:"fr_MC",14348:"fr_MA",10252:"fr_SN",4108:"fr_CH",7180:"fr",1122:"fy_NL",2108:"gd_IE",1084:"gd",1110:"gl",1079:"ka",3079:"de_AT",1031:"de_DE",5127:"de_LI",4103:"de_LU",2055:"de_CH",1032:"el",1140:"gn",1095:"gu",1279:"en",1037:"he",1081:"hi",1038:"hu",1039:"is",1136:"ig_NG",1057:"id",1040:"it_IT",2064:"it_CH",1041:"ja",1099:"kn",1120:"ks",1087:"kk",1107:"km",1111:"kok",1042:"ko",1088:"ky",1108:"lo",1142:"la",1062:"lv",1063:"lt",2110:"ms_BN",1086:"ms_MY",1100:"ml",1082:"mt",1112:"mni",1153:"mi",1102:"mr",1104:"mn",2128:"mn",1121:"ne",1044:"no_NO",2068:"no_NO",1096:"or",1045:"pl",1046:"pt_BR",2070:"pt_PT",1094:"pa",1047:"rm",2072:"ro_MO",1048:"ro_RO",1049:"ru",2073:"ru_MO",1083:"se",1103:"sa",3098:"sr_SP",2074:"sr_SP",1072:"st",1074:"tn",1113:"sd",1115:"si",1051:"sk",1060:"sl",1143:"so",1070:"sb",11274:"es_AR",16394:"es_BO",13322:"es_CL",9226:"es_CO",5130:"es_CR",7178:"es_DO",12298:"es_EC",17418:"es_SV",4106:"es_GT",18442:"es_HN",2058:"es_MX",19466:"es_NI",6154:"es_PA",15370:"es_PY",10250:"es_PE",20490:"es_PR",1034:"es_ES",14346:"es_UY",8202:"es_VE",1089:"sw",2077:"sv_FI",1053:"sv_SE",1114:"syc",1064:"tg",1097:"ta",1092:"tt",1098:"te",1054:"th",1105:"bo",1073:"ts",1055:"tr",1090:"tk",1058:"uk",1056:"ur",2115:"uz_UZ",1091:"uz_UZ",1075:"ve",1066:"vi",1106:"cy",1076:"xh",1085:"yi",1077:"zu"};const i=/^([a-z\d]+)(?:[_-]([a-z\d]+))?(?:\.([a-z\d]+))?(?:@([a-z\d]+))?$/i,o={},a={group:" ",decimal:".",positive:"+",negative:"-",percent:"%",exponent:"E",nan:"NaN",infinity:"∞",ampm:["AM","PM"],mmmm6:["Muharram","Safar","Rabiʻ I","Rabiʻ II","Jumada I","Jumada II","Rajab","Shaʻban","Ramadan","Shawwal","Dhuʻl-Qiʻdah","Dhuʻl-Hijjah"],mmm6:["Muh.","Saf.","Rab. I","Rab. II","Jum. I","Jum. II","Raj.","Sha.","Ram.","Shaw.","Dhuʻl-Q.","Dhuʻl-H."],mmmm:["January","February","March","April","May","June","July","August","September","October","November","December"],mmm:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dddd:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ddd:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]};function l(E){const g=i.exec(E);if(!g)throw new SyntaxError("Malformed locale: ".concat(E));return{lang:g[1]+(g[2]?"_"+g[2]:""),language:g[1],territory:g[2]||"",codeset:g[3]||"",modifier:g[4]||""}}function u(E){if(typeof E=="number")return s[65535&E]||null;const g=parseInt(E,16);return isFinite(g)&&s[65535&g]?s[65535&g]||null:i.test(E)?E:null}function c(E){const g=u(E);let m=null;if(g){const T=l(g);m=o[T.lang]||o[T.language]||null}return m}function h(E){return Object.assign({},a,E)}function d(E,g){const m=typeof g=="object"?g:l(g);return o[m.lang]=h(E),m.language===m.lang||o[m.language]||(o[m.language]=h(E)),o[m.lang]}const f=h({group:","});function p(E,g){if(typeof E!="number")return E;if(E<0)return-p(-E,g);if(g){const m=10**(g||0)||1;return p(E*m,0)/m}return Math.round(E)}f.isDefault=!0,d({group:",",ampm:["上午","下午"],mmmm:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],mmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dddd:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],ddd:["周日","周一","周二","周三","周四","周五","周六"]},"zh_CN"),d({group:",",nan:"非數值",ampm:["上午","下午"],mmmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],mmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dddd:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],ddd:["週日","週一","週二","週三","週四","週五","週六"]},"zh_TW"),d({group:",",ampm:["午前","午後"],mmmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],mmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dddd:["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"],ddd:["日","月","火","水","木","金","土"]},"ja"),d({group:",",ampm:["오전","오후"],mmmm:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],mmm:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],dddd:["일요일","월요일","화요일","수요일","목요일","금요일","토요일"],ddd:["일","월","화","수","목","금","토"]},"ko"),d({group:",",ampm:["ก่อนเที่ยง","หลังเที่ยง"],mmmm:["มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม"],mmm:["ม.ค.","ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค."],dddd:["วันอาทิตย์","วันจันทร์","วันอังคาร","วันพุธ","วันพฤหัสบดี","วันศุกร์","วันเสาร์"],ddd:["อา.","จ.","อ.","พ.","พฤ.","ศ.","ส."]},"th"),d({decimal:",",ampm:["dop.","odp."],mmmm:["ledna","února","března","dubna","května","června","července","srpna","září","října","listopadu","prosince"],mmm:["led","úno","bře","dub","kvě","čvn","čvc","srp","zář","říj","lis","pro"],dddd:["neděle","pondělí","úterý","středa","čtvrtek","pátek","sobota"],ddd:["ne","po","út","st","čt","pá","so"]},"cs"),d({group:".",decimal:",",mmmm:["januar","februar","marts","april","maj","juni","juli","august","september","oktober","november","december"],mmm:["jan.","feb.","mar.","apr.","maj","jun.","jul.","aug.","sep.","okt.","nov.","dec."],dddd:["søndag","mandag","tirsdag","onsdag","torsdag","fredag","lørdag"],ddd:["søn.","man.","tir.","ons.","tor.","fre.","lør."]},"da"),d({group:".",decimal:",",ampm:["a.m.","p.m."],mmmm:["januari","februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december"],mmm:["jan.","feb.","mrt.","apr.","mei","jun.","jul.","aug.","sep.","okt.","nov.","dec."],dddd:["zondag","maandag","dinsdag","woensdag","donderdag","vrijdag","zaterdag"],ddd:["zo","ma","di","wo","do","vr","za"]},"nl"),d({group:","},"en"),d({decimal:",",nan:"epäluku",ampm:["ap.","ip."],mmmm:["tammikuuta","helmikuuta","maaliskuuta","huhtikuuta","toukokuuta","kesäkuuta","heinäkuuta","elokuuta","syyskuuta","lokakuuta","marraskuuta","joulukuuta"],mmm:["tammik.","helmik.","maalisk.","huhtik.","toukok.","kesäk.","heinäk.","elok.","syysk.","lokak.","marrask.","jouluk."],dddd:["sunnuntaina","maanantaina","tiistaina","keskiviikkona","torstaina","perjantaina","lauantaina"],ddd:["su","ma","ti","ke","to","pe","la"]},"fi"),d({group:" ",decimal:",",mmmm:["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"],mmm:["janv.","févr.","mars","avr.","mai","juin","juil.","août","sept.","oct.","nov.","déc."],dddd:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],ddd:["dim.","lun.","mar.","mer.","jeu.","ven.","sam."]},"fr"),d({group:".",decimal:",",mmmm:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],mmm:["Jan.","Feb.","März","Apr.","Mai","Juni","Juli","Aug.","Sept.","Okt.","Nov.","Dez."],dddd:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],ddd:["So.","Mo.","Di.","Mi.","Do.","Fr.","Sa."]},"de"),d({group:".",decimal:",",ampm:["π.μ.","μ.μ."],mmmm:["Ιανουαρίου","Φεβρουαρίου","Μαρτίου","Απριλίου","Μαΐου","Ιουνίου","Ιουλίου","Αυγούστου","Σεπτεμβρίου","Οκτωβρίου","Νοεμβρίου","Δεκεμβρίου"],mmm:["Ιαν","Φεβ","Μαρ","Απρ","Μαΐ","Ιουν","Ιουλ","Αυγ","Σεπ","Οκτ","Νοε","Δεκ"],dddd:["Κυριακή","Δευτέρα","Τρίτη","Τετάρτη","Πέμπτη","Παρασκευή","Σάββατο"],ddd:["Κυρ","Δευ","Τρί","Τετ","Πέμ","Παρ","Σάβ"]},"el"),d({decimal:",",ampm:["de.","du."],mmmm:["január","február","március","április","május","június","július","augusztus","szeptember","október","november","december"],mmm:["jan.","febr.","márc.","ápr.","máj.","jún.","júl.","aug.","szept.","okt.","nov.","dec."],dddd:["vasárnap","hétfő","kedd","szerda","csütörtök","péntek","szombat"],ddd:["V","H","K","Sze","Cs","P","Szo"]},"hu"),d({group:".",decimal:",",ampm:["f.h.","e.h."],mmmm:["janúar","febrúar","mars","apríl","maí","júní","júlí","ágúst","september","október","nóvember","desember"],mmm:["jan.","feb.","mar.","apr.","maí","jún.","júl.","ágú.","sep.","okt.","nóv.","des."],dddd:["sunnudagur","mánudagur","þriðjudagur","miðvikudagur","fimmtudagur","föstudagur","laugardagur"],ddd:["sun.","mán.","þri.","mið.","fim.","fös.","lau."]},"is"),d({group:".",decimal:",",mmmm:["Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember"],mmm:["Jan","Feb","Mar","Apr","Mei","Jun","Jul","Agu","Sep","Okt","Nov","Des"],dddd:["Minggu","Senin","Selasa","Rabu","Kamis","Jumat","Sabtu"],ddd:["Min","Sen","Sel","Rab","Kam","Jum","Sab"]},"id"),d({group:".",decimal:",",mmmm:["gennaio","febbraio","marzo","aprile","maggio","giugno","luglio","agosto","settembre","ottobre","novembre","dicembre"],mmm:["gen","feb","mar","apr","mag","giu","lug","ago","set","ott","nov","dic"],dddd:["domenica","lunedì","martedì","mercoledì","giovedì","venerdì","sabato"],ddd:["dom","lun","mar","mer","gio","ven","sab"]},"it"),d({decimal:",",ampm:["a.m.","p.m."],mmmm:["januar","februar","mars","april","mai","juni","juli","august","september","oktober","november","desember"],mmm:["jan.","feb.","mar.","apr.","mai","jun.","jul.","aug.","sep.","okt.","nov.","des."],dddd:["søndag","mandag","tirsdag","onsdag","torsdag","fredag","lørdag"],ddd:["søn.","man.","tir.","ons.","tor.","fre.","lør."]},"nb"),d({decimal:",",mmmm:["stycznia","lutego","marca","kwietnia","maja","czerwca","lipca","sierpnia","września","października","listopada","grudnia"],mmm:["sty","lut","mar","kwi","maj","cze","lip","sie","wrz","paź","lis","gru"],dddd:["niedziela","poniedziałek","wtorek","środa","czwartek","piątek","sobota"],ddd:["niedz.","pon.","wt.","śr.","czw.","pt.","sob."]},"pl"),d({group:".",decimal:",",mmmm:["janeiro","fevereiro","março","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro"],mmm:["jan.","fev.","mar.","abr.","mai.","jun.","jul.","ago.","set.","out.","nov.","dez."],dddd:["domingo","segunda-feira","terça-feira","quarta-feira","quinta-feira","sexta-feira","sábado"],ddd:["dom.","seg.","ter.","qua.","qui.","sex.","sáb."]},"pt"),d({decimal:",",nan:"не число",mmmm:["января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"],mmm:["янв.","февр.","мар.","апр.","мая","июн.","июл.","авг.","сент.","окт.","нояб.","дек."],dddd:["воскресенье","понедельник","вторник","среда","четверг","пятница","суббота"],ddd:["вс","пн","вт","ср","чт","пт","сб"]},"ru"),d({decimal:",",mmmm:["januára","februára","marca","apríla","mája","júna","júla","augusta","septembra","októbra","novembra","decembra"],mmm:["jan","feb","mar","apr","máj","jún","júl","aug","sep","okt","nov","dec"],dddd:["nedeľa","pondelok","utorok","streda","štvrtok","piatok","sobota"],ddd:["ne","po","ut","st","št","pi","so"]},"sk"),d({group:".",decimal:",",ampm:["a. m.","p. m."],mmmm:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"],mmm:["ene.","feb.","mar.","abr.","may.","jun.","jul.","ago.","sept.","oct.","nov.","dic."],dddd:["domingo","lunes","martes","miércoles","jueves","viernes","sábado"],ddd:["dom.","lun.","mar.","mié.","jue.","vie.","sáb."]},"es"),d({decimal:",",ampm:["fm","em"],mmmm:["januari","februari","mars","april","maj","juni","juli","augusti","september","oktober","november","december"],mmm:["jan.","feb.","mars","apr.","maj","juni","juli","aug.","sep.","okt.","nov.","dec."],dddd:["söndag","måndag","tisdag","onsdag","torsdag","fredag","lördag"],ddd:["sön","mån","tis","ons","tors","fre","lör"]},"sv"),d({group:".",decimal:",",ampm:["ÖÖ","ÖS"],mmmm:["Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eylül","Ekim","Kasım","Aralık"],mmm:["Oca","Şub","Mar","Nis","May","Haz","Tem","Ağu","Eyl","Eki","Kas","Ara"],dddd:["Pazar","Pazartesi","Salı","Çarşamba","Perşembe","Cuma","Cumartesi"],ddd:["Paz","Pzt","Sal","Çar","Per","Cum","Cmt"]},"tr");function R(E,g,m){const T=E<0?-1:1,M=10**(g||2),U=10**(m||2);let x,P,I=Math.abs(E),Q=0,pe=0,J=0,_e=1;if((E=I)%1==0)P=[E*T,1];else if(E<1e-19)P=[T,1e19];else if(E>1e19)P=[1e19*T,1];else{do if(I=1/(I-Math.floor(I)),x=_e,_e=_e*Math.floor(I)+Q,Q=x,pe=J,J=Math.floor(E*_e+.5),J>=M||_e>=U)return[T*pe,Q];while(Math.abs(E-J/_e)>=1e-10&&I!==Math.floor(I));P=[T*J,_e]}return P}const w={overflow:"######",dateErrorThrows:!1,dateErrorNumber:!0,dateSpanLarge:!0,leap1900:!0,nbsp:!0,throws:!0,invalid:"######",locale:"",ignoreTimezone:!1},N=Object.assign({},w);function z(E){if(E===null&&(E=w),E){for(const g in E)if(g in w){const m=E[g];N[g]=m==null?w[g]:m}}return{...N}}const W={"#":"",0:"0","?":" "},se={"@":"text","-":"minus","+":"plus"},y=["#000","#FFF","#F00","#0F0","#00F","#FF0","#F0F","#0FF","#000","#FFF","#F00","#0F0","#00F","#FF0","#F0F","#0FF","#800","#080","#008","#880","#808","#088","#CCC","#888","#99F","#936","#FFC","#CFF","#606","#F88","#06C","#CCF","#008","#F0F","#FF0","#0FF","#808","#800","#088","#00F","#0CF","#CFF","#CFC","#FF9","#9CF","#F9C","#C9F","#FC9","#36F","#3CC","#9C0","#FC0"],A=["¤","$","£","¥","֏","؋","৳","฿","៛","₡","₦","₩","₪","₫","€","₭","₮","₱","₲","₴","₸","₹","₺","₼","₽","₾","₿"],j=new RegExp("["+A.join("")+"]");function Z(E,g,m){return g[m+"_max"]=E.length,g[m+"_min"]=E.replace(/#/g,"").length,g}const fe={};function le(E){if(!(E in fe)){const g=[],m=E.replace(/^[#,]+/,"").replace(/[1-9]\d*/g,T=>"?".repeat(T.length));for(let T=0;T<m.length;T++){const M=m.charAt(T);g[T]=M in W?W[M]:M}fe[E]=g.join("")}return fe[E]}function _(E,g){typeof E=="string"&&(E={type:"string",value:E=E.replace(/ /g,W["?"])}),g.push(E)}function H(E){const g=[],m={scale:1,percent:!1,text:!1,date:0,date_eval:!1,date_system:1,sec_decimals:0,general:!1,clock:24,int_pattern:[],frac_pattern:[],man_pattern:[],den_pattern:[],num_pattern:[],tokens:g};let T=E+"",M="int",U=!1,x=null;const P=[];let I,Q,pe=!1;for(;T&&!U;){if(I=/^General/i.exec(T))m.general=!0,_({type:"general"},g);else if(M==="int"&&(I=/^[#?0]+(?:,[#?0]+)*/.exec(T))||M==="den"&&(I=/^[#?\d]+/.exec(T))||(I=/^[#?0]+/.exec(T)))m[M+"_pattern"].push(I[0]),x={type:M,num:I[0]},_(x,g);else if((I=/^\//.exec(T))&&m[M+"_pattern"].length){if(!x)throw new SyntaxError("Missing a numerator in pattern ".concat(E));m.fractions=!0,m.num_pattern.push(m[M+"_pattern"].pop()),x.type="num",M="den",_({type:"div"},g)}else if(I=/^,+/.exec(T)){const L=T.charAt(1)in W;Q.slice(-1)in W&&(I[0].length>1||!L)?m.scale=.001**I[0].length:m.dec_fractions||_(I[0],g)}else{if(I=/^;/.exec(T)){U=!0;break}if(I=/^[@+-]/.exec(T))I[0]==="@"&&(m.text=!0),_({type:se[I[0]]},g);else if(I=/^(?:\[(h+|m+|s+)\])/i.exec(T)){const L=I[1].toLowerCase(),ee=L[0],Ce={type:"",size:0,date:1,raw:I[0],pad:L.length};ee==="h"?(Ce.size=16,Ce.type="hour-elap"):ee==="m"?(Ce.size=32,Ce.type="min-elap"):(Ce.size=64,Ce.type="sec-elap"),m.date=m.date|Ce.size,P.push(Ce),_(Ce,g)}else if(I=/^(?:B2)/i.exec(T))pe||(m.date_system=6);else if(I=/^(?:B1)/i.exec(T))pe||(m.date_system=1);else if(I=/^(?:([hHmMsSyYbBdDegG])\1*)/.exec(T)){const L={type:"",size:0,date:1,raw:I[0]},ee=I[0].toLowerCase(),Ce=ee[0];if(ee==="y"||ee==="yy")L.size=2,L.type="year-short";else if(Ce==="y"||Ce==="e")L.size=2,L.type="year";else if(ee==="b"||ee==="bb")L.size=2,L.type="b-year-short";else if(Ce==="b")L.size=2,L.type="b-year";else if(ee==="d"||ee==="dd")L.size=8,L.type="day",L.pad=/dd/.test(ee);else if(ee==="ddd")L.size=8,L.type="weekday-short";else if(Ce==="d")L.size=8,L.type="weekday";else if(Ce==="h")L.size=16,L.type="hour",L.pad=/hh/i.test(ee);else if(Ce==="m"){ee.length===3?(L.size=4,L.type="monthname-short"):ee.length===5?(L.size=4,L.type="monthname-single"):ee.length>=4&&(L.size=4,L.type="monthname");const Te=P[P.length-1];!L.type&&Te&&!Te.used&&80&Te.size&&(Te.used=!0,L.size=32,L.type="min",L.pad=/mm/.test(ee)),L.type||(L.size=4,L.type="month",L.pad=/mm/.test(ee),L.indeterminate=!0)}else if(Ce==="s"){L.size=64,L.type="sec",L.pad=/ss/.test(ee);const Te=P[P.length-1];Te&&32&Te.size?L.used=!0:Te&&Te.indeterminate&&(delete Te.indeterminate,Te.size=32,Te.type="min",L.used=!0)}m.date=m.date|L.size,m.date_eval=!0,P.push(L),_(L,g)}else if(I=/^(?:AM\/PM|am\/pm|A\/P)/.exec(T))m.clock=12,m.date=16|m.date,m.date_eval=!0,_({type:"am",short:I[0]==="A/P"},g);else if(m.date&&(I=/^\.0{1,3}/i.exec(T))){const L=I[0].length-1,ee=[64,128,256,512][L];m.date=m.date|ee,m.date_eval=!0,m.sec_decimals=Math.max(m.sec_decimals,L),_({type:"subsec",size:ee,decimals:L,date:1,raw:I[0]},g)}else if((I=/^\\(.)/.exec(T))||(I=/^"([^"]*?)"/.exec(T)))_(I[1],g);else if(I=/^\[(<[=>]?|>=?|=)\s*(-?[.\d]+)\]/.exec(T))m.condition=[I[1],parseFloat(I[2],10)];else if(I=/^\[\$([^\]]+)\]/.exec(T)){const L=I[1].split("-"),ee=L.length<2?"":L[L.length-1],Ce=L[0];Ce&&_(Ce,g);const Te=u(ee);Te&&(m.locale=Te);const Pe=parseInt(ee,16);isFinite(Pe)&&16711680&Pe&&(Pe>>16&255)===6&&(m.date_system=6),pe=!0}else if(I=/^\[(black|blue|cyan|green|magenta|red|white|yellow|color\s*(\d+))\]/i.exec(T))m.color=I[2]?y[parseInt(I[2],10)]||"#000":I[1].toLowerCase();else if(!(I=/^\[(DBNum1|ENG|HIJ|JPN|TWN)\]/i.exec(T))){if(I=/^%/.exec(T))m.scale=100,m.percent=!0,_("%",g);else if(I=/^_(\\.|.)/.exec(T))_(" ",g);else if(I=/^\./.exec(T))_({type:"point",value:I[0]},g),m.dec_fractions=!0,M="frac";else if(I=/^[Ee]([+-]?|(?=[0#?]))/.exec(T))m.exponential=!0,m.exp_plus=I[1]==="+",M="man",_({type:"exp",plus:I[1]==="+"},g);else if(!(I=/^\*(\\.|.)/.exec(T))){if(I=/^[BENn[]/.exec(T))throw new SyntaxError("Unexpected char ".concat(T.charAt(0)," in pattern ").concat(E));T[0]==="("&&(m.parens=!0),I=[T[0]],_(I[0],g)}}}Q=I[0],T=T.slice(I?I[0].length:1)}if(m.pattern=E.slice(0,E.length-T.length),/^((?:\[[^\]]+\])+)(;|$)/.test(m.pattern)&&!/^\[(?:h+|m+|s+)\]/.test(m.pattern)&&_({type:"text"},g),m.fractions&&m.dec_fractions||m.fractions&&m.exponential)throw new SyntaxError("Invalid pattern: ".concat(m.pattern));const J=m.int_pattern.join("");if(m.grouping=J.indexOf(",")>=0,m.grouping){const L=J.split(","),ee=L.length;ee===2?(m.group_pri=L[1].length,m.group_sec=m.group_pri):ee>2&&(m.group_pri=L[ee-1].length,m.group_sec=L[ee-2].length)}else m.group_pri=0,m.group_sec=0;Z(J.replace(/[,]/g,""),m,"int"),Z(m.frac_pattern.join(""),m,"frac"),Z(m.man_pattern.join(""),m,"man");let _e=m.num_pattern.join(""),we=m.den_pattern.join("");const ce=/\?/.test(we)||/\?/.test(_e);return we=we.replace(/\d/g,ce?"?":"#"),ce&&(we=we.replace(/#$/g,"?")),Z(_e,m,"num"),Z(we,m,"den"),ce&&(_e=_e.replace(/#$/g,"?")),m.int_padding=le(m.int_pattern.join("")),m.man_padding=le(m.man_pattern.join("")),m.num_padding=le(_e),m.den_padding=le(we),m.den_pattern.length&&(m.denominator=parseInt(m.den_pattern.join("").replace(/\D/g,""),10)),m.integer=!!m.int_pattern.join("").length,m.fractions&&g.forEach((L,ee)=>{const Ce=g[ee+1];L.type==="string"&&Ce&&(Ce.type==="num"?L.rule="num+int":Ce.type==="div"?L.rule="num":Ce.type==="den"&&(L.rule="den"))}),m}const v=E=>{const g=E.condition;g&&g[1]<0&&(g[0]==="<"||g[0]==="<="||g[0]==="=")||E.tokens.unshift({type:"minus",volatile:!0})};function D(E){const g=[];let m,T=!1,M=null,U=E,x=0,P=!1,I=0,Q=0;do{if(P=H(U),(P.date||P.general)&&(P.int_pattern.length||P.frac_pattern.length||P.scale!==1||P.text))throw new Error("Illegal format");if(P.condition&&(Q++,T=!0),P.text){if(M)throw new Error("Unexpected partition");M=P}P.locale&&(m=u(P.locale)),g.push(P),x=U.charAt(P.pattern.length)===";"?1:0,U=U.slice(P.pattern.length+x),I++}while(x&&I<4&&Q<3);if(x)throw new Error("Unexpected partition");if(Q>2)throw new Error("Unexpected condition");const pe=g[3];if(pe&&(pe.int_pattern.length||pe.frac_pattern.length||pe.date))throw new Error("Unexpected partition");if(T){const J=g.length;if(J===1&&(g[1]=H("General"),g[1].generated=!0),J<3){const _e=g[0],we=g[1];if(v(_e),we.condition)v(we);else{const ce=_e.condition;(ce[0]==="="||ce[1]>=0&&(ce[0]===">"||ce[0]===">="))&&we.tokens.unshift({type:"minus",volatile:!0})}}else g.forEach(v)}else{if(g.length<4&&M)for(let J=0,_e=g.length;J<_e;J++)g[J]===M&&g.splice(J,1);if(g.length<1&&M&&(g[0]=H("General"),g[0].generated=!0),g.length<2){const J=H(g[0].pattern);J.tokens.unshift({type:"minus",volatile:!0}),J.generated=!0,g.push(J)}if(g.length<3){const J=H(g[0].pattern);J.generated=!0,g.push(J)}if(g.length<4)if(M)g.push(M);else{const J=H("@");J.generated=!0,g.push(J)}g[0].condition=[">",0],g[1].condition=["<",0],g[2].condition=null}return{pattern:E,partitions:g,locale:m}}const b=Math.floor;function O(E){if((!(arguments.length>1&&arguments[1]!==void 0)||arguments[1])&&E>=0){if(E===0)return[1900,1,0];if(E===60)return[1900,2,29];if(E<60)return[1900,E<32?1:2,(E-1)%31+1]}let m=E+68569+2415019;const T=b(4*m/146097);m-=b((146097*T+3)/4);const M=b(4e3*(m+1)/1461001);m=m-b(1461*M/4)+31;const U=b(80*m/2447),x=m-b(2447*U/80);m=b(U/11);const P=U+2-12*m;return[0|100*(T-49)+M+m,0|P,0|x]}function k(E){return O(E+1462)}function B(E){if(E===60)throw new Error("#VALUE!");if(E<=1)return[1317,8,29];if(E<60)return[1317,E<32?9:10,1+(E-2)%30];const g=10631/30,m=.1335;let T=E+466935;const M=b(T/10631);T-=10631*M;const U=b((T-m)/g);T-=b(U*g+m);const x=b((T+28.5001)/29.5);return x===13?[30*M+U,12,30]:[30*M+U,x,T-b(29.5001*x-29)]}function V(E){let g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,m=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2];const T=b(E);return g===6?B(T):g===-1?k(T):O(T,m)}const ie=Math.floor,de=86400;function ge(E,g){let m=null;if(Array.isArray(E)){const[T,M,U,x,P,I]=E;m=Date.UTC(T,M==null?0:M-1,U!=null?U:1,x||0,P||0,I||0)}else if(E instanceof Date&&(m=1*E,!g||!g.ignoreTimezone)){const T=new Date;T.setUTCFullYear(E.getFullYear(),E.getMonth(),E.getDate()),T.setUTCHours(E.getHours(),E.getMinutes(),E.getSeconds(),E.getMilliseconds()),m=1*T}if(m!=null&&isFinite(m)){const T=m/864e5;return T-(T<=-25509?-25568:-25569)}return E}function ye(E,g){let m=0|E;const T=de*(E-m);let M=ie(T);T-M>.9999&&(M+=1,M===de&&(M=0,m+=1));const U=M<0?de+M:M,[x,P,I]=V(E,0,g&&g.leap1900),Q=ie(U/60/60)%60,pe=ie(U/60)%60,J=ie(U)%60;if(g&&g.nativeDate){const _e=new Date(0);return _e.setUTCFullYear(x,P-1,I),_e.setUTCHours(Q,pe,J),_e}return[x,P,I,Q,pe,J]}function Ae(E){return!!(E[0]&&E[0].percent||E[1]&&E[1].percent||E[2]&&E[2].percent||E[3]&&E[3].percent)}function S(E){return!!(E[0]&&E[0].date||E[1]&&E[1].date||E[2]&&E[2].date||E[3]&&E[3].date)}function F(E){const[g,m,T,M]=E;return!(g&&!g.generated||m&&!m.generated||T&&!T.generated||!M||!M.text||M.generated)}const K={text:15,datetime:10.8,date:10.8,time:10.8,percent:10.6,currency:10.4,grouped:10.2,scientific:6,number:4,fraction:2,general:0,error:0},q=[["DMY",1],["DM",2],["MY",3],["MDY",4],["MD",5],["hmsa",6],["hma",7],["hms",8],["hm",9]],G={total:1,sign:0,period:0,int:1,frac:0},Y=(E,g)=>E.replace(/\./,g.decimal);function ue(E,g,m,T){const M=0|m;if(typeof m=="string")E.push(m);else if(m===M)E.push(Math.abs(M));else{const U=Math.abs(m);let x=U?Math.floor(Math.log10(U)):0,P=x<0?U*10**-x:U/10**x;P===10&&(P=1,x++);const I=function(pe){let J=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];const _e=Math.abs(pe);if(!_e)return G;const we=J&&pe<0?1:0,ce=Math.floor(_e),L=Math.floor(Math.log10(_e)+1);let ee=0,Ce=0;if(ce!==_e){ee=1;const Te=String(p(L<0?_e*10**-L:_e/10**L,15));let Pe=Te.length,ke=!0,We=0;for(;We<=Te.length;){if(Te[We]==="."){Pe--;break}Te[We]==="0"&&ke?Pe--:ke=!1,We++}Ce=Pe-L,Ce<0&&(Ce=0,ee=0)}return{total:we+Math.max(L,1)+ee+Ce,digits:Math.max(L,0)+Ce,sign:we,period:ee,int:Math.max(L,1),frac:Ce}}(U),Q=()=>{const pe=Math.abs(x);let J;J=P===1?P:p(P,5),E.push(Y(J+"",T),T.exponent,x<0?T.negative:T.positive,pe<10?"0":"",pe)};if(x>=-4&&x<=-1){const pe=U.toPrecision(10+x).replace(/\.?0+$/,"");E.push(Y(pe,T))}else if(x===10){const pe=U.toFixed(10).slice(0,12).replace(/\.$/,"");E.push(Y(pe,T))}else if(Math.abs(x)<=9)if(I.total<=11){const pe=p(U,9).toFixed(I.frac);E.push(Y(pe,T))}else x===9?E.push(Math.floor(U)):x>=0&&x<9?E.push(p(U,9-x)):Q();else I.total>=12?Q():Math.floor(U)===U?E.push(Math.floor(U)):E.push(Y(p(U,9).toFixed(I.frac),T))}return E}const ae=86400,$={int:"integer",frac:"fraction",man:"mantissa",num:"numerator",den:"denominator"},te=function(E){let g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;const m=Math.floor(Math.log10(E));return g>1?Math.floor(m/g)*g:m};function oe(E,g,m,T){let M="",U="",x="",P="",I="",Q=0,pe=0|E,J=0,_e=0,we=1,ce=0,L=0,ee=0,Ce=0,Te=0,Pe=0;const ke=T||f;if(!g.text&&isFinite(g.scale)&&g.scale!==1&&(E=function(Se){if(Se===0)return Se;const Me=Math.ceil(Math.log10(Se<0?-Se:Se)),ne=10**(16-Math.floor(Me));return Math.round(Se*ne)/ne}(E*g.scale)),g.exponential){let Se=Math.abs(E);if(Se){const Me=10**-te(Se,g.int_max),ne=p(Se*Me,g.frac_max)/Me;Q=te(ne,g.int_max)}Se/=10**Q,E=E<0?-Se:Se,M+=Math.abs(Q)}if(g.integer){const Se=Math.abs(p(E,g.fractions?1:g.frac_max));I+=Se<1?"":Math.floor(Se)}if(g.grouping){let Se="",Me=I.length;for(Me>g.group_pri&&(Me-=g.group_pri,Se=ke.group+I.slice(Me,Me+g.group_pri)+Se);Me>g.group_sec;)Me-=g.group_sec,Se=ke.group+I.slice(Me,Me+g.group_sec)+Se;I=Me?I.slice(0,Me)+Se:Se}g.dec_fractions&&(P=String(p(E,g.frac_max)).split(".")[1]||"");let We=!1;if(g.fractions){const Se=Math.abs(g.integer?E%1:E);if(Se)if(We=!0,isFinite(g.denominator))x+=g.denominator,U+=p(Se*g.denominator),U==="0"&&(U="",x="",We=!1,I||(I="0"));else{const Me=R(Se,g.integer?g.num_max:1/0,g.den_max);U+=Me[0],x+=Me[1],g.integer&&U==="0"&&(I||(I="0"),U="",x="",We=!1)}}if(g.date){pe=Math.trunc(E);const Se=ae*(E-pe);if(J=Math.floor(Se),Pe=Se-J,Math.abs(Pe)<1e-6?Pe=0:Pe>.9999&&(Pe=0,J+=1,J===ae&&(J=0,pe+=1)),Pe){const Me=512&g.date||256&g.date||128&g.date;(Me===512&&Pe>.9995||Me===256&&Pe>.995||Me===128&&Pe>.95||!Me&&Pe>=.5)&&(J++,Pe=0)}if(pe||g.date_system){const Me=V(E,g.date_system,m.leap1900);_e=Me[0],we=Me[1],ce=Me[2]}if(J){const Me=J<0?ae+J:J;Te=Math.floor(Me)%60,Ce=Math.floor(Me/60)%60,ee=Math.floor(Me/60/60)%60}if(L=(6+pe)%7,g.date_eval&&(dt=E,gt=pe+J/ae,m.dateSpanLarge?dt<-694324||gt>=35830291:dt<0||gt>=2958466)){if(m.dateErrorThrows)throw new Error("Date out of bounds");return m.dateErrorNumber?ue(E<0?[ke.negative]:[],0,E,ke).join(""):m.overflow}}var dt,gt;if(g.int_padding&&(I=g.int_padding.length===1?I||g.int_padding:g.int_padding.substring(0,g.int_padding.length-I.length)+I),g.num_padding&&(U=g.num_padding.length===1?U||g.num_padding:g.num_padding.substring(0,g.num_padding.length-U.length)+U),g.den_padding&&(x=g.den_padding.length===1?x||g.den_padding:x+g.den_padding.slice(x.length)),g.man_padding){const Se=g.exp_plus?"+":"";M=g.man_padding.length===1?(Q<0?"-":Se)+(M||g.man_padding):(Q<0?"-":Se)+g.man_padding.slice(0,g.man_padding.length-M.length)+M}const Ee=[];let Qe=0;const ve={int:0,frac:0,man:0,num:0,den:0};for(let Se=0,Me=g.tokens.length;Se<Me;Se++){const ne=g.tokens[Se],lt=ne.num?ne.num.length:0;if(ne.type==="string")ne.rule?ne.rule==="num"?We?Ee.push(ne.value):(g.num_min>0||g.den_min>0)&&Ee.push(ne.value.replace(/./g,W["?"])):ne.rule==="num+int"?We&&I?Ee.push(ne.value):g.den_min>0&&(I||g.num_min)&&Ee.push(ne.value.replace(/./g,W["?"])):ne.rule==="den"&&(We?Ee.push(ne.value):(g.den_min>0||g.den_min>0)&&Ee.push(ne.value.replace(/./g,W["?"]))):Ee.push(ne.value);else if(ne.type==="error")Ee.push(m.invalid);else if(ne.type==="point")Ee.push(g.date?ne.value:ke.decimal);else if(ne.type==="general")ue(Ee,0,E,ke);else if(ne.type==="exp")Ee.push(ke.exponent);else if(ne.type==="minus")ne.volatile&&g.date||ne.volatile&&(E>=0||typeof E!="number")||(ne.volatile&&!g.fractions&&(g.integer||g.dec_fractions)?(E<0&&I&&I!=="0"||P)&&Ee.push(ke.negative):Ee.push(ke.negative));else if(ne.type==="plus")Ee.push(ke.positive);else if(ne.type==="text")Ee.push(E);else if(ne.type==="div")We?Ee.push("/"):g.num_min>0||g.den_min>0?Ee.push(W["?"]):Ee.push(W["#"]);else if(ne.type==="int")if(g.int_pattern.length===1)Ee.push(I);else{const $e=Qe?g.int_pattern.join("").length-ve.int:1/0,Mt=Qe===g.int_pattern.length-1?0:g.int_pattern.join("").length-(ve.int+ne.num.length);Ee.push(I.substring(I.length-$e,I.length-Mt)),Qe++,ve.int+=ne.num.length}else if(ne.type==="frac"){const $e=ve.frac;for(let Mt=0;Mt<lt;Mt++)Ee.push(P[Mt+$e]||W[ne.num[Mt]]);ve.frac+=lt}else if(ne.type in $)g[ne.type+"_pattern"].length===1?(ne.type==="int"&&Ee.push(I),ne.type==="frac"&&Ee.push(P),ne.type==="man"&&Ee.push(M),ne.type==="num"&&Ee.push(U),ne.type==="den"&&Ee.push(x)):(Ee.push($[ne.type].slice(ve[ne.type],ve[ne.type]+lt)),ve[ne.type]+=lt);else if(ne.type==="year")_e<0&&Ee.push(ke.negative),Ee.push(String(Math.abs(_e)).padStart(4,"0"));else if(ne.type==="year-short"){const $e=_e%100;Ee.push($e<10?"0":"",$e)}else if(ne.type==="month")Ee.push(ne.pad&&we<10?"0":"",we);else if(ne.type==="monthname-single")g.date_system===6?Ee.push(ke.mmmm6[we-1].charAt(0)):Ee.push(ke.mmmm[we-1].charAt(0));else if(ne.type==="monthname-short")g.date_system===6?Ee.push(ke.mmm6[we-1]):Ee.push(ke.mmm[we-1]);else if(ne.type==="monthname")g.date_system===6?Ee.push(ke.mmmm6[we-1]):Ee.push(ke.mmmm[we-1]);else if(ne.type==="weekday-short")Ee.push(ke.ddd[L]);else if(ne.type==="weekday")Ee.push(ke.dddd[L]);else if(ne.type==="day")Ee.push(ne.pad&&ce<10?"0":"",ce);else if(ne.type==="hour"){const $e=ee%g.clock||(g.clock<24?g.clock:0);Ee.push(ne.pad&&$e<10?"0":"",$e)}else if(ne.type==="min")Ee.push(ne.pad&&Ce<10?"0":"",Ce);else if(ne.type==="sec")Ee.push(ne.pad&&Te<10?"0":"",Te);else if(ne.type==="subsec"){Ee.push(ke.decimal);const $e=Pe.toFixed(g.sec_decimals);Ee.push($e.slice(2,2+ne.decimals))}else if(ne.type==="am"){const $e=ee<12?0:1;ne.short&&!T?Ee.push("AP"[$e]):Ee.push(ke.ampm[$e])}else if(ne.type==="hour-elap"){E<0&&Ee.push(ke.negative);const $e=24*pe+Math.floor(Math.abs(J)/3600);Ee.push(String(Math.abs($e)).padStart(ne.pad,"0"))}else if(ne.type==="min-elap"){E<0&&Ee.push(ke.negative);const $e=1440*pe+Math.floor(Math.abs(J)/60);Ee.push(String(Math.abs($e)).padStart(ne.pad,"0"))}else if(ne.type==="sec-elap"){E<0&&Ee.push(ke.negative);const $e=pe*ae+Math.abs(J);Ee.push(String(Math.abs($e)).padStart(ne.pad,"0"))}else if(ne.type==="b-year")Ee.push(_e+543);else if(ne.type==="b-year-short"){const $e=(_e+543)%100;Ee.push($e<10?"0":"",$e)}}return m.nbsp?Ee.join(""):Ee.join("").replace(/\u00a0/g," ")}function me(E,g){for(let m=0;m<3;m++){const T=g[m];if(T){let M;if(T.condition){const U=T.condition[0],x=T.condition[1];U==="="?M=E===x:U===">"?M=E>x:U==="<"?M=E<x:U===">="?M=E>=x:U==="<="?M=E<=x:U==="<>"&&(M=E!==x)}else M=!0;if(M)return T}}}const be=H("@"),De="black",X={};function Re(E,g){if(E){const m=E[0];g[m]=g[m]||{},Re(E.slice(1),g[m])}else g.$=!0}["d-F-y","d-F-Y","d-M-y","d-M-Y","F-d-y","F-d-Y","F-j-y","F-j-Y","j-F-y","j-F-Y","j-M-y","j-M-Y","M-d-y","M-d-Y","M-j-y","M-j-Y","m-d-y","m-d-Y","m-j-y","m-j-Y","n-d-y","n-d-Y","n-j-y","n-j-Y","y-F-d","y-F-j","y-M-d","y-M-j","Y-F-d","Y-F-j","Y-M-d","Y-m-d","Y-M-j","Y-m-j","Y-n-d","Y-n-j","j-F","j-M","d-F","d-M","n-d","n-j","n-Y","m-d","m-j","m-Y","M-Y","M-y","F-y","F-Y","Y-M","Y-n","Y-m","Y-F","Y-M"].forEach(E=>{Re(E,X),Re(E+" x",X),Re(E+" l",X),Re(E+" l x",X),Re("l "+E,X),Re("l "+E+" x",X),Re(E+" D",X),Re(E+" D x",X),Re("D "+E,X),Re("D "+E+" x",X)});const Ge={jan:1,feb:2,mar:3,apr:4,may:5,jun:6,jul:7,aug:8,sep:9,oct:10,nov:11,dec:12},He={january:1,february:2,march:3,april:4,june:6,july:7,august:8,september:9,october:10,november:11,december:12},Ue={sunday:"l",monday:"l",tuesday:"l",wednesday:"l",thursday:"l",friday:"l",saturday:"l",sun:"D",mon:"D",tue:"D",wed:"D",thu:"D",fri:"D",sat:"D"},qe=new Date().getUTCFullYear();function Ct(E){const g=new RegExp("^([\\s+%"+A.join("")+"(-]*)(((?:(?:\\d[\\d,]*)(?:\\.\\d*)?|(?:\\.\\d+)))([eE][+-]?\\d+)?)([\\s%"+A.join("")+")]*)$").exec(E);if(g){const[,m,T,M,U,x]=g;let P=1,I="",Q=!1,pe=!1,J=!1,_e=!1,we=!1,ce=null,L=!1,ee=parseFloat(T.replace(/,/g,""));if(!isFinite(ee))return null;for(let Te=0;Te<m.length;Te++){const Pe=m[Te];if(Pe==="-"){if(Q||pe)return null;Q=!0,P=-1}else if(j.test(Pe)){if(we)return null;we=!0,ce=Pe}else if(Pe==="("){if(pe||Q)return null;pe=!0,P=-1}else if(Pe==="%"){if(_e)return null;_e=!0}}for(let Te=0;Te<x.length;Te++){const Pe=x[Te];if(j.test(Pe)){if(we)return null;we=!0,ce=Pe,L=!0}else if(Pe===")"){if(J||!pe)return null;J=!0}else if(Pe==="%"){if(_e)return null;_e=!0}}if(U){if(_e||we)return null;I="0.00E+00"}else if(_e){if(we)return null;I=M.includes(".")?"0.00%":"0%",ee*=.01}else if(we){const Te=M.includes(".")?"#,##0.00":"#,##0";I=L?Te+ce:ce+Te}else M.includes(",")&&(I=M.includes(".")?"#,##0.00":"#,##0");const Ce={v:ee*P};return I&&(Ce.z=I),Ce}}const ze=(E,g,m)=>{const T=m.path||"",M=Object.keys(g);for(let U=0;U<M.length;U++){let x;const P=M[U];if(g[P]){if(P==="$"||P==="€")E||(x=m);else if(P==="-"){const I=/^(\s*([./-]|,\s)\s*|\s+)/.exec(E);if(I){const Q=I[1]==="-"||I[1]==="/"||I[1]==="."?I[1]:" ";if(!m.sep||m.sep===Q){const pe=I[0].replace(/\s+/g," ");x=ze(E.slice(I[0].length),g[P],{...m,sep:Q,path:T+pe})}}}else if(P===" "){const I=/^[,.]?\s+/.exec(E);if(I){const Q=I[0].replace(/\s+/g," ");x=ze(E.slice(I[0].length),g[P],{...m,path:T+Q})}}else if(P==="j"||P==="d"){const I=/^(0?[1-9]|1\d|2\d|3[01])\b/.exec(E);I&&(x=ze(E.slice(I[0].length),g[P],{...m,day:I[0],path:T+P}))}else if(P==="n"||P==="m"){const I=/^(0?[1-9]|1[012])\b/.exec(E);I&&(x=ze(E.slice(I[0].length),g[P],{...m,month:+I[0],_mon:I[0],path:T+P}))}else if(P==="F"||P==="M"){const I=/^([a-z]{3,9})\b/i.exec(E),Q=I&&(P==="F"?He:Ge)[I[0].toLowerCase()];Q&&(x=ze(E.slice(I[0].length),g[P],{...m,month:Q,_mon:I[0],path:T+P}))}else if(P==="l"||P==="D"){const I=/^([a-z]{3,9})\b/i.exec(E);(I&&Ue[I[0].toLowerCase()])===P&&(x=ze(E.slice(I[0].length),g[P],{...m,path:T+P}))}else if(P==="y"){const I=/^\d\d\b/.exec(E);if(I){const Q=+I[0]>=30?+I[0]+1900:+I[0]+2e3;x=ze(E.slice(I[0].length),g[P],{...m,year:Q,path:T+P})}}else if(P==="Y"){const I=/^\d\d\d\d\b/.exec(E);I&&(x=ze(E.slice(I[0].length),g[P],{...m,year:+I[0],path:T+P}))}else{if(P!=="x")throw new Error('Unknown date token "'.concat(P,'"'));{const I=Ve(E);I&&(x=ze("",g[P],{...m,time:I.v,tf:I.z,path:T+P}))}}if(x)return x}}};function et(E,g){const m=ze(E.trim(),X,{path:""});if(m){var T;if(m.sep==="."&&m.path.length===3)return null;const M=+((T=m.year)!==null&&T!==void 0?T:qe);if(m.day||(m.day=1),!function(P,I,Q){if(Q<1||I<1||I>12)return!1;if(I===2){if(Q>(P%4==0&&P%100!=0||P%400==0||P===1900?29:28))return!1}else if((I===4||I===6||I===9||I===11)&&Q>30||(I===1||I===3||I===5||I===7||I===8||I===10||I===12)&&Q>31)return!1;return!0}(M,m.month,m.day))return null;let U=-1/0;if(M<1900)return null;M<=1900&&m.month<=2?U=25568:M<1e4&&(U=25569);const x=Date.UTC(M,m.month-1,m.day)/864e5+U+(m.time||0);if(x>=0&&x<=2958465){const P=m._mon[0]==="0"||m.day[0]==="0"||m._mon.length===2&&m.day.length===2,I=m.path.replace(/[jdlDnmMFyYx-]/g,Q=>Q==="j"||Q==="d"?P?"dd":"d":Q==="D"?"ddd":Q==="l"?"dddd":Q==="n"||Q==="m"?P?"mm":"m":Q==="M"?"mmm":Q==="F"?"mmmm":Q==="y"?"yy":Q==="x"?m.tf||"":Q==="Y"?"yyyy":Q);return g&&g.nativeDate?{v:ye(x,g),z:I}:{v:x,z:I}}}return null}function Ve(E){const g=/^\s*([10]?\d|2[0-4])(?::([0-5]\d|\d))?(?::([0-5]\d|\d))?(\.\d{1,10})?(?:\s*([AP])M?)?\s*$/i.exec(E);if(g){const[,m,T,M,U,x]=g;if(U&&!M||!x&&!T&&!M)return null;let P=1*(m||0);if(x){if(P>=13)return null;x[0]!=="p"&&x[0]!=="P"||(P+=12)}return{v:(60*P*60+60*(1*(T||0))+1*(M||0)+1*(U||0))/86400,z:(m.length===2?"hh":"h")+":mm"+(M?":ss":"")+(x?" AM/PM":"")}}return null}function ct(E){return/^\s*true\s*$/i.test(E)?{v:!0}:/^\s*false\s*$/i.test(E)?{v:!1}:null}const at={};function Ut(E,g){const{pattern:m,partitions:T,locale:M}=E,U=I=>{const Q=Object.assign({},z(),g,I);return M&&(Q.locale=M),Q},x=(I,Q)=>{const pe=U(Q);return function(J,_e,we){const ce=c(we.locale),L=_e[3]?_e[3]:be;if(typeof J=="boolean"&&(J=J?"TRUE":"FALSE"),J==null)return"";if(typeof J!="number")return oe(J,L,we,ce);if(!isFinite(J)){const Ce=ce||f;return isNaN(J)?Ce.nan:(J<0?Ce.negative:"")+Ce.infinity}const ee=me(J,_e);return ee?oe(J,ee,we,ce):we.overflow}(ge(I,pe),T,pe)};x.color=(I,Q)=>function(pe,J){if(typeof pe!="number"||!isFinite(pe))return(J[3]?J[3].color:be.color)||De;const _e=me(pe,J);return _e&&_e.color||De}(ge(I,U(Q)),T);const P=function(I){var Q;let pe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;const[J,_e]=I,we=J.frac_max,ce={type:"general",isDate:S(I),isText:F(I),isPercent:Ae(I),maxDecimals:J.general?9:we,scale:(Q=J.scale)!==null&&Q!==void 0?Q:1,color:0,parentheses:0,grouped:J.grouping?1:0,_partitions:I},L=!ce.isDate&&!ce.isText&&!J.error&&J.tokens.some(ke=>ke.type==="string"&&(pe?ke.value===pe:j.test(ke.value)));let ee="G",Ce=we>=0?Math.min(15,we):"",Te="",Pe="";if(_e&&_e.color&&(Pe="-",ce.color=1),J.parens&&(Te="()",ce.parentheses=1),L)ee="C",ce.type="currency";else if(J.error)ce.type="error",ce.maxDecimals=0;else if(ce.isDate){let ke=0,We=0,dt="";J.tokens.forEach(Ee=>{const Qe=Ee.type;/^(b-)?year/.test(Qe)?(dt+="Y",We++):Qe.startsWith("month")?(dt+="M",We++):/^(week)?day/.test(Qe)?(dt+="D",We++):Qe!=="hour"&&Qe!=="min"&&Qe!=="sec"&&Qe!=="am"||(dt+=Qe[0],ke++)}),ce.type="date",We&&ke?ce.type="datetime":!We&&ke&&(ce.type="time");const gt=q.find(Ee=>dt.startsWith(Ee[0]));ee=gt?"D":"G",Ce=gt?gt[1]:""}else ce.isText?(ee="G",ce.type="text",Ce="",ce.maxDecimals=0):J.general?(ee="G",ce.type="general",Ce=""):J.fractions?(ee="G",ce.type="fraction",Ce=""):J.exponential?(ee="S",ce.type="scientific"):ce.isPercent?(ee="P",ce.type="percent"):J.grouping?(ee=",",ce.type="grouped"):(J.int_max||we)&&(ee="F",ce.type="number");return ce.code=ee+Ce+Pe+Te,ce.level=K[ce.type],Object.freeze(ce)}(T,(g||{}).currency)||new SyntaxError;return x.info=P,x.dateInfo=function(I){const[Q]=I;return{year:!!(2&Q.date),month:!!(4&Q.date),day:!!(8&Q.date),hours:!!(16&Q.date),minutes:!!(32&Q.date),seconds:!!(64&Q.date),clockType:Q.clock===12?12:24}}(T),x.isPercent=()=>!!P.isPercent,x.isDate=()=>!!P.isDate,x.isText=()=>!!P.isText,x.pattern=m,E.error&&(x.error=E.error),x.options=U,x.locale=M||g&&g.locale||"",Object.freeze(x)}function Fe(E,g){E||(E="General");let m=null;return at[E]?m=at[E]:(m=Object.assign({},z(),g).throws?D(E):function(T){try{return D(T)}catch(M){const U={tokens:[{type:"error"}],error:M.message};return{pattern:T,partitions:[U,U,U,U],error:M.message,locale:null}}}(E),m.error||(at[E]=m)),Ut(m,g)}Fe.isDate=E=>Fe(E,{throws:!1}).isDate(),Fe.isPercent=E=>Fe(E,{throws:!1}).isPercent(),Fe.isText=E=>Fe(E,{throws:!1}).isText(),Fe.getInfo=(E,g)=>Fe(E,{...g,throws:!1}).info,Fe.getDateInfo=(E,g)=>Fe(E,{...g,throws:!1}).dateInfo,Fe.dateToSerial=ge,Fe.dateFromSerial=ye,Fe.options=z,Fe.dec2frac=R,Fe.round=p,Fe.codeToLocale=s,Fe.parseLocale=l,Fe.getLocale=c,Fe.addLocale=(E,g)=>{const m=l(g);return delete at[m.lang],delete at[m.language],d(E,m)},Fe.format=function(E,g,m){let T=arguments.length>3&&arguments[3]!==void 0&&arguments[3];const M=m&&typeof m=="object"?m:{locale:m,throws:!T};return Fe(E,M)(ge(g,M),M)},Fe.is_date=Fe.isDate,Fe.parseNumber=Ct,Fe.parseDate=et,Fe.parseTime=Ve,Fe.parseBool=ct,Fe.parseValue=function(E,g){var m,T,M;return(m=(T=(M=Ct(E))!==null&&M!==void 0?M:et(E,g))!==null&&T!==void 0?T:Ve(E))!==null&&m!==void 0?m:ct(E)};var ht=Fe;return r=r.default}()})}(Fr)),Fr.exports}var cs,ji;function cd(){return ji||(ji=1,cs=ud()),cs}var hd=cd();const dd=Et(hd),fd=dd;function Xt(e){let t=0;const n=Object.keys(e);for(const r of n){const s=Number(r);t=Math.max(t,s)}return t+1}function Ds(e,t,n){const r=Xt(n),s=n;for(let i=r-1;i>=e;i--)s[i+1]=s[i];s[e]=t}function Ls(e,t,n){const r=Object.keys(n).reduce((s,i)=>Math.max(s,Number.parseInt(i)),0)+1;for(let s=e;s<r;s++)s<e+t?delete n[s]:n[s]!==void 0&&(n[s-t]=n[s],delete n[s])}function gd(e,t){const n=e,r=Object.keys(n),s=r.length,i=t,o=Object.keys(i),a=o.length,l={};let u=0;for(let c=0;c<s;c++,u++){const h=r[c];l[u]=n[h]}for(let c=0;c<a;c++,u++){const h=o[c];l[u]=i[h]}return l}function md(e,t,n){const r=n;if(Xt(n)>0){const i={};let o=0;for(let a=e;a<=t;a++)r[a]&&(i[o]=r[a],o++);return i}return{}}function xs(e,t,n,r){const s=e>n;if(!s&&e+t>n)throw new Error("Invalid move operation");s?_d(e,t,n,r):pd(e,t,n,r)}function _d(e,t,n,r){const s=r,i=[];for(let o=e;o<e+t;o++)i.push(s[o]);for(let o=e-1;o>=n;o--){const a=s[o];s[o+t]=a,a===void 0&&delete s[o+t]}i.forEach((o,a)=>{s[n+a]=o,o===void 0&&delete s[n+a]})}function pd(e,t,n,r){const s=r,i=[];for(let o=e;o<e+t;o++)i.push(s[o]);for(let o=e+t;o<n;o++){const a=s[o];s[o-t]=a,a===void 0&&delete s[o-t]}i.forEach((o,a)=>{s[n+a-t]=o,o===void 0&&delete s[n+a-t]})}class Tt{constructor(t={}){C(this,"_matrix");this._setOriginValue(t)}static MakeObjectMatrixSize(t){return new Tt({[t-1]:{}})}getMatrix(){return this._matrix}forEach(t){const n=this._matrix,r=Object.keys(n);for(const s of r){const i=Number(s),o=n[i];if(t(i,o)===!1)return this}return this}forRow(t){const n=this._matrix,r=Object.keys(n);for(const s of r){const i=Number(s),o=n[i];if(t(i,Object.keys(o).map(l=>Number(l)))===!1)return this}return this}forValue(t){const n=this._matrix;for(const r in n){const s=Number(r),i=n[s];if(i)for(const o in i){const a=Number(o),l=i[a];if(t(s,a,l)===!1)return this}}return this}swapRow(t,n){const r=this._matrix[t],s=this._matrix[n];this._matrix[t]=s,this._matrix[n]=r}getRow(t){return this._matrix[t]}getRowOrCreate(t){let n=this.getRow(t);return n==null&&(n={},this._matrix[t]=n),n}reset(){this._setOriginValue({})}hasValue(){const t=this._matrix,n=Object.keys(t);if(n.length===0)return!1;for(const r of n){const s=Number(r),i=t[s];if(Object.keys(i).length>0)return!0}return!1}getValue(t,n){var r,s;return(s=(r=this._matrix)==null?void 0:r[t])==null?void 0:s[n]}setValue(t,n,r){const s=this.getRowOrCreate(t);s[n]=r}deleteValue(t,n){var r,s;(s=(r=this._matrix)==null?void 0:r[t])==null||delete s[n]}realDeleteValue(t,n){var r,s,i;if((s=(r=this._matrix)==null?void 0:r[t])==null||delete s[n],this.getRow(t)){const o=this.getRow(t);if(o==null)return;Object.keys(o).length===0&&((i=this._matrix)==null||delete i[t])}}setRow(t,n){this._matrix[t]=n}moveRows(t,n,r){xs(t,n,r,this._matrix)}moveColumns(t,n,r){this.forEach((s,i)=>{xs(t,n,r,i)})}insertRows(t,n){for(let r=t;r<t+n;r++)Ds(r,{},this._matrix)}insertColumns(t,n){for(let r=t;r<t+n;r++)this.forEach((s,i)=>{i&&Ds(r,void 0,i)})}removeRows(t,n){Ls(t,n,this._matrix)}removeColumns(t,n){this.forEach((r,s)=>{s&&Ls(t,n,s)})}getFragment(t,n,r,s){const i=new Tt;let o=0;for(let a=t;a<=n;a++){const l={};let u=0;for(let c=r;c<=s;c++){const h=this.getValue(a,c);l[u]=h,u++}i.setRow(o,l),o++}return i}getSlice(t,n,r,s){const i=new Tt;for(let o=t;o<=n;o++)for(let a=r;a<=s;a++){const l=this.getValue(o,a);l&&i.setValue(o,a,re.deepClone(l))}return i}getSizeOf(){return Object.keys(this._matrix).length}getLength(){return Xt(this._matrix)}getRange(){const r=this.getLength()-1;let s=0;const i=this.getLength();for(let o=0;o<i;o++){const a=this.getRow(o);if(a){const l=Xt(a)-1;s=l>s?l:s}}return{startRow:0,startColumn:0,endRow:r,endColumn:s}}toNativeArray(){const t=new Array;return this.forValue((n,r,s)=>{t.push(s)}),t}toArray(){const t=[];return this.forRow((n,r)=>{t[n]==null&&(t[n]=[]),r.forEach(s=>{t[n][s]=this.getValue(n,s)})}),t}toFullArray(){const t=this.getRange(),{endColumn:n,endRow:r}=t,s=[];for(let i=0;i<=r;i++){const o=new Array(n+1).fill(void 0);s.push(o)}return this.forValue((i,o,a)=>{s[i][o]=a}),s}toJSON(){return this._matrix}clone(){const t=JSON.stringify(this._matrix);return JSON.parse(t)}getData(){const t=JSON.stringify(this._matrix);return JSON.parse(t)}getArrayData(){let t=0,n=0,r=!1,s=!1;const i=new Tt;return this.forEach((o,a)=>{r||(r=!0,t=o),Object.keys(a).forEach(l=>{const u=Number(l);s?u<n&&(n=u):(s=!0,n=u);const c=this.getValue(o,u);i.setValue(o-t,u-n,c)})}),i.getData()}getStartEndScope(){let t=1/0,n=-1/0,r=1/0,s=-1/0;const i=Object.keys(this._matrix);i.length>0&&(t=+i[0],n=+i[i.length-1]);for(const o of i){const a=Object.keys(this._matrix[o]);a.length>0&&(r=Math.min(r,+a[0]),s=Math.max(s,+a[a.length-1]))}return{startRow:t,endRow:n,startColumn:r,endColumn:s}}getDataRange(){let t=0,n=0,r=0,s=-1,i=!1,o=!1;return this.forEach((a,l)=>{if(i||(i=!0,t=a),l==null)return;const u=Xt(l)-1;u>r&&(r=u),Object.keys(l).forEach(c=>{const h=Number(c);o?h<n&&(n=h):(o=!0,n=h)}),a>s&&(s=a)}),{startRow:t,startColumn:n,endRow:s,endColumn:r}}getDiscreteRanges(){const t=[];return this.forEach((n,r)=>{Object.keys(r).forEach(s=>{const i=Number(s);let o=!1;for(const a of t)if(n>=a.startRow&&n<=a.endRow+1&&i>=a.startColumn&&i<=a.endColumn+1){a.endRow=Math.max(n,a.endRow),a.endColumn=Math.max(i,a.endColumn),o=!0;break}o||t.push({startRow:n,endRow:n,startColumn:i,endColumn:i})})}),t}_setOriginValue(t={}){this._matrix=t}}const or="__INTERNAL_EDITOR__",ti=`${or}DOCS_NORMAL`,ni=`${or}DOCS_FORMULA_BAR`,ba=`${or}ZEN_EDITOR`,Aa=`\r
2
+ `,Ta="isRowStylePrecedeColumnStyle",ya=Symbol("AUTO_HEIGHT_FOR_MERGED_CELLS");function Ed(e){return`${or}${e}`}function Na(e){return e.startsWith(or)}var Ma=(e=>(e[e.character=0]="character",e[e.paragraph=1]="paragraph",e[e.table=2]="table",e[e.numbering=3]="numbering",e))(Ma||{}),Da=(e=>(e[e.TAB=0]="TAB",e[e.SPACE=1]="SPACE",e[e.NOTHING=2]="NOTHING",e))(Da||{}),Ne=(e=>(e[e.BULLET=0]="BULLET",e[e.NONE=1]="NONE",e[e.DECIMAL=2]="DECIMAL",e[e.DECIMAL_ZERO=3]="DECIMAL_ZERO",e[e.UPPER_LETTER=4]="UPPER_LETTER",e[e.LOWER_LETTER=5]="LOWER_LETTER",e[e.UPPER_ROMAN=6]="UPPER_ROMAN",e[e.LOWER_ROMAN=7]="LOWER_ROMAN",e[e.ORDINAL=8]="ORDINAL",e[e.CARDINAL_TEXT=9]="CARDINAL_TEXT",e[e.ORDINAL_TEXT=10]="ORDINAL_TEXT",e[e.HEX=11]="HEX",e[e.CHICAGO=12]="CHICAGO",e[e.IDEOGRAPH_DIGITAL=13]="IDEOGRAPH_DIGITAL",e[e.JAPANESE_COUNTING=14]="JAPANESE_COUNTING",e[e.AIUEO=15]="AIUEO",e[e.IROHA=16]="IROHA",e[e.DECIMAL_FULL_WIDTH=17]="DECIMAL_FULL_WIDTH",e[e.DECIMAL_HALF_WIDTH=18]="DECIMAL_HALF_WIDTH",e[e.JAPANESE_LEGAL=19]="JAPANESE_LEGAL",e[e.JAPANESE_DIGITAL_TEN_THOUSAND=20]="JAPANESE_DIGITAL_TEN_THOUSAND",e[e.DECIMAL_ENCLOSED_CIRCLE=21]="DECIMAL_ENCLOSED_CIRCLE",e[e.DECIMAL_FULL_WIDTH2=22]="DECIMAL_FULL_WIDTH2",e[e.AIUEO_FULL_WIDTH=23]="AIUEO_FULL_WIDTH",e[e.IROHA_FULL_WIDTH=24]="IROHA_FULL_WIDTH",e[e.GANADA=25]="GANADA",e[e.CHOSUNG=26]="CHOSUNG",e[e.DECIMAL_ENCLOSED_FULLSTOP=27]="DECIMAL_ENCLOSED_FULLSTOP",e[e.DECIMAL_ENCLOSED_PAREN=28]="DECIMAL_ENCLOSED_PAREN",e[e.DECIMAL_ENCLOSED_CIRCLE_CHINESE=29]="DECIMAL_ENCLOSED_CIRCLE_CHINESE",e[e.IDEOGRAPH_ENCLOSED_CIRCLE=30]="IDEOGRAPH_ENCLOSED_CIRCLE",e[e.IDEOGRAPH_TRADITIONAL=31]="IDEOGRAPH_TRADITIONAL",e[e.IDEOGRAPH_ZODIAC=32]="IDEOGRAPH_ZODIAC",e[e.IDEOGRAPH_ZODIAC_TRADITIONAL=33]="IDEOGRAPH_ZODIAC_TRADITIONAL",e[e.TAIWANESE_COUNTING=34]="TAIWANESE_COUNTING",e[e.IDEOGRAPH_LEGAL_TRADITIONAL=35]="IDEOGRAPH_LEGAL_TRADITIONAL",e[e.TAIWANESE_COUNTING_THOUSAND=36]="TAIWANESE_COUNTING_THOUSAND",e[e.TAIWANESE_DIGITAL=37]="TAIWANESE_DIGITAL",e[e.CHINESE_COUNTING=38]="CHINESE_COUNTING",e[e.CHINESE_LEGAL_SIMPLIFIED=39]="CHINESE_LEGAL_SIMPLIFIED",e[e.CHINESE_COUNTING_THOUSAND=40]="CHINESE_COUNTING_THOUSAND",e[e.KOREAN_DIGITAL=41]="KOREAN_DIGITAL",e[e.KOREAN_COUNTING=42]="KOREAN_COUNTING",e[e.KOREAN_LEGAL=43]="KOREAN_LEGAL",e[e.KOREAN_DIGITAL2=44]="KOREAN_DIGITAL2",e[e.VIETNAMESE_COUNTING=45]="VIETNAMESE_COUNTING",e[e.RUSSIAN_LOWER=46]="RUSSIAN_LOWER",e[e.RUSSIAN_UPPER=47]="RUSSIAN_UPPER",e[e.NUMBER_IN_DASH=48]="NUMBER_IN_DASH",e[e.HEBREW1=49]="HEBREW1",e[e.HEBREW2=50]="HEBREW2",e[e.ARABIC_ALPHA=51]="ARABIC_ALPHA",e[e.ARABIC_ABJAD=52]="ARABIC_ABJAD",e[e.HINDI_VOWELS=53]="HINDI_VOWELS",e[e.HINDI_CONSONANTS=54]="HINDI_CONSONANTS",e[e.HINDI_NUMBERS=55]="HINDI_NUMBERS",e[e.HINDI_COUNTING=56]="HINDI_COUNTING",e[e.THAI_LETTERS=57]="THAI_LETTERS",e[e.THAI_NUMBERS=58]="THAI_NUMBERS",e[e.THAI_COUNTING=59]="THAI_COUNTING",e[e.CUSTOM=60]="CUSTOM",e))(Ne||{}),ar=(e=>(e[e.BULLET_ALIGNMENT_UNSPECIFIED=0]="BULLET_ALIGNMENT_UNSPECIFIED",e[e.START=1]="START",e[e.CENTER=2]="CENTER",e[e.END=3]="END",e[e.BOTH=4]="BOTH",e))(ar||{}),Jt=(e=>(e[e.HYPERLINK=0]="HYPERLINK",e[e.FIELD=1]="FIELD",e[e.SDT=2]="SDT",e[e.BOOKMARK=3]="BOOKMARK",e[e.COMMENT=4]="COMMENT",e[e.CUSTOM=5]="CUSTOM",e[e.MENTION=6]="MENTION",e[e.UNI_FORMULA=7]="UNI_FORMULA",e[e.DELTED=9999]="DELTED",e))(Jt||{}),sn=(e=>(e[e.COMMENT=0]="COMMENT",e[e.DELETED=9999]="DELETED",e))(sn||{}),La=(e=>(e[e.DRAWING=0]="DRAWING",e[e.CUSTOM=1]="CUSTOM",e))(La||{}),ri=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TRADITIONAL=1]="TRADITIONAL",e[e.MODERN=2]="MODERN",e))(ri||{}),xa=(e=>(e[e.DEFAULT=0]="DEFAULT",e[e.LINES=1]="LINES",e[e.LINES_AND_CHARS=2]="LINES_AND_CHARS",e[e.SNAP_TO_CHARS=3]="SNAP_TO_CHARS",e))(xa||{}),Ua=(e=>(e[e.SECTION_TYPE_UNSPECIFIED=0]="SECTION_TYPE_UNSPECIFIED",e[e.CONTINUOUS=1]="CONTINUOUS",e[e.NEXT_PAGE=2]="NEXT_PAGE",e[e.EVEN_PAGE=3]="EVEN_PAGE",e[e.ODD_PAGE=4]="ODD_PAGE",e))(Ua||{}),Pa=(e=>(e[e.COLUMN_SEPARATOR_STYLE_UNSPECIFIED=0]="COLUMN_SEPARATOR_STYLE_UNSPECIFIED",e[e.NONE=1]="NONE",e[e.BETWEEN_EACH_COLUMN=2]="BETWEEN_EACH_COLUMN",e))(Pa||{}),ka=(e=>(e[e.NORMAL=0]="NORMAL",e[e.TBRL=1]="TBRL",e[e.LRTBV=2]="LRTBV",e))(ka||{}),Fa=(e=>(e[e.TEXT_RUN=0]="TEXT_RUN",e[e.AUTO_TEXT=1]="AUTO_TEXT",e[e.PAGE_BREAK=2]="PAGE_BREAK",e[e.COLUMN_BREAK=3]="COLUMN_BREAK",e[e.FOOT_NOTE_REFERENCE=4]="FOOT_NOTE_REFERENCE",e[e.HORIZONTAL_RULE=5]="HORIZONTAL_RULE",e[e.EQUATION=6]="EQUATION",e[e.DRAWING=7]="DRAWING",e[e.PERSON=8]="PERSON",e[e.RICH_LINK=9]="RICH_LINK",e))(Fa||{}),Ba=(e=>(e[e.BOTH_SIDES=0]="BOTH_SIDES",e[e.LEFT=1]="LEFT",e[e.RIGHT=2]="RIGHT",e[e.LARGEST=3]="LARGEST",e))(Ba||{}),$a=(e=>(e[e.INLINE=0]="INLINE",e[e.WRAP_NONE=1]="WRAP_NONE",e[e.WRAP_POLYGON=2]="WRAP_POLYGON",e[e.WRAP_SQUARE=3]="WRAP_SQUARE",e[e.WRAP_THROUGH=4]="WRAP_THROUGH",e[e.WRAP_TIGHT=5]="WRAP_TIGHT",e[e.WRAP_TOP_AND_BOTTOM=6]="WRAP_TOP_AND_BOTTOM",e))($a||{}),rt=(e=>(e[e.NAMED_STYLE_TYPE_UNSPECIFIED=0]="NAMED_STYLE_TYPE_UNSPECIFIED",e[e.NORMAL_TEXT=1]="NORMAL_TEXT",e[e.TITLE=2]="TITLE",e[e.SUBTITLE=3]="SUBTITLE",e[e.HEADING_1=4]="HEADING_1",e[e.HEADING_2=5]="HEADING_2",e[e.HEADING_3=6]="HEADING_3",e[e.HEADING_4=7]="HEADING_4",e[e.HEADING_5=8]="HEADING_5",e))(rt||{}),Ha=(e=>(e[e.AUTO=0]="AUTO",e[e.AT_LEAST=1]="AT_LEAST",e[e.EXACT=2]="EXACT",e))(Ha||{}),ja=(e=>(e[e.DASH_STYLE_UNSPECIFIED=0]="DASH_STYLE_UNSPECIFIED",e[e.SOLID=1]="SOLID",e[e.DOT=2]="DOT",e[e.DASH=3]="DASH",e))(ja||{}),Wa=(e=>(e[e.TAB_STOP_ALIGNMENT_UNSPECIFIED=0]="TAB_STOP_ALIGNMENT_UNSPECIFIED",e[e.START=1]="START",e[e.CENTER=2]="CENTER",e[e.END=3]="END",e))(Wa||{}),Ya=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SPECIFIED=1]="SPECIFIED",e))(Ya||{}),Ga=(e=>(e[e.START=0]="START",e[e.CENTER=1]="CENTER",e[e.END=2]="END",e))(Ga||{}),za=(e=>(e[e.AUTO_FIT=0]="AUTO_FIT",e[e.FIXED=1]="FIXED",e))(za||{}),Va=(e=>(e[e.NONE=0]="NONE",e[e.WRAP=1]="WRAP",e))(Va||{}),Ka=(e=>(e[e.AUTO=0]="AUTO",e[e.AT_LEAST=1]="AT_LEAST",e[e.EXACT=2]="EXACT",e))(Ka||{}),Xa=(e=>(e[e.CONTENT_ALIGNMENT_UNSPECIFIED=0]="CONTENT_ALIGNMENT_UNSPECIFIED",e[e.BOTH=1]="BOTH",e[e.TOP=2]="TOP",e[e.CENTER=3]="CENTER",e[e.BOTTOM=4]="BOTTOM",e))(Xa||{}),Sn=(e=>(e.NORMAL="normal",e.BOLD="bold",e.ITALIC="italic",e))(Sn||{}),qa=(e=>(e[e.PAGE=0]="PAGE",e[e.COLUMN=1]="COLUMN",e[e.CHARACTER=2]="CHARACTER",e[e.MARGIN=3]="MARGIN",e[e.INSIDE_MARGIN=4]="INSIDE_MARGIN",e[e.OUTSIDE_MARGIN=5]="OUTSIDE_MARGIN",e[e.LEFT_MARGIN=6]="LEFT_MARGIN",e[e.RIGHT_MARGIN=7]="RIGHT_MARGIN",e))(qa||{}),Ja=(e=>(e[e.PAGE=0]="PAGE",e[e.PARAGRAPH=1]="PARAGRAPH",e[e.LINE=2]="LINE",e[e.MARGIN=3]="MARGIN",e[e.TOP_MARGIN=4]="TOP_MARGIN",e[e.BOTTOM_MARGIN=5]="BOTTOM_MARGIN",e[e.INSIDE_MARGIN=6]="INSIDE_MARGIN",e[e.OUTSIDE_MARGIN=7]="OUTSIDE_MARGIN",e))(Ja||{}),Za=(e=>(e[e.POINT=0]="POINT",e[e.LINE=1]="LINE",e[e.CHARACTER=2]="CHARACTER",e[e.PIXEL=3]="PIXEL",e[e.PERCENT=4]="PERCENT",e))(Za||{}),Qa=(e=>(e[e.CENTER=0]="CENTER",e[e.INSIDE=1]="INSIDE",e[e.LEFT=2]="LEFT",e[e.OUTSIDE=3]="OUTSIDE",e[e.RIGHT=4]="RIGHT",e[e.BOTH=5]="BOTH",e[e.DISTRIBUTE=6]="DISTRIBUTE",e))(Qa||{}),el=(e=>(e[e.BOTTOM=0]="BOTTOM",e[e.CENTER=1]="CENTER",e[e.INSIDE=2]="INSIDE",e[e.OUTSIDE=3]="OUTSIDE",e[e.TOP=4]="TOP",e))(el||{}),tl=(e=>(e[e.compressPunctuation=0]="compressPunctuation",e[e.compressPunctuationAndJapaneseKana=1]="compressPunctuationAndJapaneseKana",e[e.doNotCompress=2]="doNotCompress",e))(tl||{}),nl=(e=>(e[e.PORTRAIT=0]="PORTRAIT",e[e.LANDSCAPE=1]="LANDSCAPE",e))(nl||{}),pt=(e=>(e.Letter="Letter",e.Tabloid="Tabloid",e.Legal="Legal",e.Statement="Statement",e.Executive="Executive",e.Folio="Folio",e.A3="A3",e.A4="A4",e.A5="A5",e.B4="B4",e.B5="B5",e))(pt||{});const Cd=["A3","A4","A5","B4","B5","Letter","Tabloid","Legal","Statement","Executive","Folio"];var rl=(e=>(e[e.forward=0]="forward",e[e.backward=1]="backward",e[e.front=2]="front",e[e.back=3]="back",e))(rl||{}),sl=(e=>(e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e[e.DRAWING_IMAGE=0]="DRAWING_IMAGE",e[e.DRAWING_SHAPE=1]="DRAWING_SHAPE",e[e.DRAWING_CHART=2]="DRAWING_CHART",e[e.DRAWING_TABLE=3]="DRAWING_TABLE",e[e.DRAWING_SMART_ART=4]="DRAWING_SMART_ART",e[e.DRAWING_VIDEO=5]="DRAWING_VIDEO",e[e.DRAWING_GROUP=6]="DRAWING_GROUP",e[e.DRAWING_UNIT=7]="DRAWING_UNIT",e[e.DRAWING_DOM=8]="DRAWING_DOM",e))(sl||{}),si=(e=>(e[e.SLIDE=0]="SLIDE",e[e.MASTER=1]="MASTER",e[e.LAYOUT=2]="LAYOUT",e[e.HANDOUT_MASTER=3]="HANDOUT_MASTER",e[e.NOTES_MASTER=4]="NOTES_MASTER",e))(si||{}),il=(e=>(e[e.SHAPE=0]="SHAPE",e[e.IMAGE=1]="IMAGE",e[e.TEXT=2]="TEXT",e[e.SPREADSHEET=3]="SPREADSHEET",e[e.DOCUMENT=4]="DOCUMENT",e[e.SLIDE=5]="SLIDE",e))(il||{}),ol=(e=>(e[e.RELATIVE_SLIDE_LINK_UNSPECIFIED=0]="RELATIVE_SLIDE_LINK_UNSPECIFIED",e[e.NEXT_SLIDE=1]="NEXT_SLIDE",e[e.PREVIOUS_SLIDE=2]="PREVIOUS_SLIDE",e[e.FIRST_SLIDE=3]="FIRST_SLIDE",e[e.LAST_SLIDE=4]="LAST_SLIDE",e))(ol||{});const Rd={sheetId:"",range:{startRow:-1,endRow:-1,startColumn:-1,endColumn:-1}},Id={startRow:-1,startColumn:-1,endRow:-1,endColumn:-1},Sd={startRow:0,startColumn:0,endRow:0,endColumn:0},vd={row:0,column:0},ut={ff:"Arial",fs:11,it:Ie.FALSE,bl:Ie.FALSE,ul:{s:Ie.FALSE},st:{s:Ie.FALSE},ol:{s:Ie.FALSE},tr:{a:0,v:Ie.FALSE},td:qn.UNSPECIFIED,cl:{rgb:"#000"},bg:{rgb:"#fff"},ht:At.UNSPECIFIED,vt:rn.UNSPECIFIED,tb:ln.UNSPECIFIED,pd:{t:0,r:0,b:0,l:0},n:null,bd:{b:null,l:null,r:null,t:null}},al={id:"default_slide",title:"defaultSlide",pageSize:{width:300,height:300}},Od=[ti,ba,ni],wd={[rt.HEADING_1]:{fs:20,bl:1},[rt.HEADING_2]:{fs:18,bl:1},[rt.HEADING_3]:{fs:16,bl:1},[rt.HEADING_4]:{fs:14,bl:1},[rt.HEADING_5]:{fs:12,bl:1},[rt.NORMAL_TEXT]:null,[rt.TITLE]:{fs:26,bl:1},[rt.SUBTITLE]:{fs:15,cl:{rgb:"#999999"}},[rt.NAMED_STYLE_TYPE_UNSPECIFIED]:null},gn=4,bd={[rt.HEADING_1]:{spaceAbove:{v:20},spaceBelow:{v:6+gn}},[rt.HEADING_2]:{spaceAbove:{v:18},spaceBelow:{v:6+gn}},[rt.HEADING_3]:{spaceAbove:{v:16},spaceBelow:{v:6+gn}},[rt.HEADING_4]:{spaceAbove:{v:14},spaceBelow:{v:4+gn}},[rt.HEADING_5]:{spaceAbove:{v:12},spaceBelow:{v:4+gn}},[rt.NORMAL_TEXT]:{spaceAbove:{v:0},spaceBelow:{v:0}},[rt.TITLE]:{spaceAbove:{v:0},spaceBelow:{v:3+gn}},[rt.SUBTITLE]:{spaceAbove:{v:0},spaceBelow:{v:16}},[rt.NAMED_STYLE_TYPE_UNSPECIFIED]:null},Ad="univer-sheets-chart-print-chart",Td="univer-docs-drawing-printing";var ll=(e=>(e.ARRAY_CONVERTOR="ARRAY_CONVERTOR",e.MATRIX_CONVERTOR="MATRIX_CONVERTOR",e))(ll||{});const yd={[pt.A3]:{width:1123,height:1587},[pt.A4]:{width:794,height:1124},[pt.A5]:{width:559,height:794},[pt.B4]:{width:944,height:1344},[pt.B5]:{width:665,height:944},[pt.Executive]:{width:696,height:1008},[pt.Folio]:{width:816,height:1248},[pt.Legal]:{width:816,height:1344},[pt.Letter]:{width:816,height:1056},[pt.Statement]:{width:528,height:816},[pt.Tabloid]:{width:1056,height:1632}};function Er(e,t){const{textRuns:n=[]}=t;let r=0;for(const i of n){const{ts:o={},st:a,ed:l}=i;if(o[e]==null)return Ie.FALSE;switch(e){case"bl":case"it":{if(o[e]===Ie.FALSE)return Ie.FALSE;break}case"ul":case"st":{if(o[e].s===Ie.FALSE)return Ie.FALSE;break}default:throw new Error(`unknown style key: ${e} in IStyleBase`)}r+=l-a}return t.dataStream.indexOf(`\r
3
+ `)===r?Ie.TRUE:Ie.FALSE}const Xn=class Xn{constructor(t,n,r){C(this,"_range");C(this,"_worksheet");this._deps=r,this._range=n,this._worksheet=t}static foreach(t,n){const{startRow:r,startColumn:s,endRow:i,endColumn:o}=t;for(let a=r;a<=i;a++)for(let l=s;l<=o;l++)n(a,l)}getRangeData(){return this._range}getValue(){return this.getValues()[0][0]}getValues(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range,i=[];for(let o=t;o<=n;o++){const a=[];for(let l=r;l<=s;l++)a.push(this.getMatrix().getValue(o,l)||null);i.push(a)}return i}getMatrix(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range,i=this._worksheet.getCellMatrix(),o=new Tt;for(let a=t;a<=n;a++)for(let l=r;l<=s;l++)o.setValue(a,l,i.getValue(a,l)||null);return o}getMatrixObject(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range,i=this._worksheet.getCellMatrix(),o=new Tt;for(let a=t;a<=n;a++)for(let l=r;l<=s;l++)o.setValue(a-t,l-r,i.getValue(a,l)||{});return o}getA1Notation(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range;let i,o;return r<s?(i=re.numToWord(r+1)+(t+1),o=re.numToWord(s+1)+(n+1)):(i=re.numToWord(s+1)+(n+1),o=re.numToWord(r+1)+(t+1)),i===o?`${i}`:`${i}:${o}`}getBackground(){return this.getBackgrounds()[0][0]}getBackgrounds(){const t=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>{var i;const s=t.getStyleByCell(r);return((i=s==null?void 0:s.bg)==null?void 0:i.rgb)||ut.bg.rgb}))}getCell(t,n){const{startRow:r,startColumn:s}=this._range,i={startRow:r+t,endRow:r+t,startColumn:s+n,endColumn:s+n};return new Xn(this._worksheet,i,this._deps)}getColumn(){return this._range.startColumn}getObjectValue(t={}){return this.getObjectValues(t)[0][0]}getObjectValues(t={}){var a;const{startRow:n,endRow:r,startColumn:s,endColumn:i}=this._range,o=this._worksheet.getCellMatrix().getFragment(n,r,s,i).getData();if(t.isIncludeStyle){const l=this._deps.getStyles();for(let u=0;u<=r-n;u++)for(let c=0;c<=i-s;c++){if(o==null||((a=o==null?void 0:o[u])==null?void 0:a[c])==null)continue;const h=o[u][c].s;h&&(o[u][c].s=l.get(h))}}return o}getFontColor(){return this.getFontColors()[0][0]}getFontColors(){const t=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>{var i;const s=t.getStyleByCell(r);return((i=s==null?void 0:s.cl)==null?void 0:i.rgb)||ut.cl.rgb}))}getFontFamilies(){return this._getStyles("ff")}getFontFamily(){return this.getFontFamilies()[0][0]}getUnderlines(){return this._getStyles("ul")}getUnderline(){var n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?Er("ul",t.body)===Ie.TRUE?{s:Ie.TRUE}:{s:Ie.FALSE}:this.getUnderlines()[0][0]}getOverlines(){return this._getStyles("ol")}getOverline(){return this.getOverlines()[0][0]}getStrikeThrough(){var n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?Er("st",t.body)===Ie.TRUE?{s:Ie.TRUE}:{s:Ie.FALSE}:this.getStrikeThroughs()[0][0]}getStrikeThroughs(){return this._getStyles("st")}getFontSize(){var n,r;const t=((n=this.getValue())==null?void 0:n.p)||{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?t.body.textRuns.some(s=>{var i;return((i=s==null?void 0:s.ts)==null?void 0:i.fs)!=null})?Math.max(...t.body.textRuns.map(s=>{var i;return((i=s==null?void 0:s.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,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?Er("it",t.body)===Ie.TRUE?$r.ITALIC:$r.NORMAL:this._getFontStyles()[0][0]}_getFontStyles(){return this._getStyles("it")}getFontWeight(){var n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?Er("bl",t.body)===Ie.TRUE?Hr.BOLD:Hr.NORMAL:this._getFontWeights()[0][0]}_getFontWeights(){return this._getStyles("bl")}getGridId(){return this._worksheet.getSheetId()}getHeight(){const{_range:t,_worksheet:n}=this,{startRow:r,endRow:s}=t;let i=0;for(let o=0;o<=s-r;o++){const a=n.getRowHeight(o);i+=a}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:t,endColumn:n}=this._range;return n-t+1}getNumRows(){const{startRow:t,endRow:n}=this._range;return n-t+1}getRichTextValue(){return this.getRichTextValues()[0][0]}getRichTextValues(){return this.getValues().map(t=>t.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 t=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>t.getStyleByCell(r)))}getVerticalAlignment(){return this.getVerticalAlignments()[0][0]}getVerticalAlignments(){return this._getStyles("vt")}getWidth(){const{_range:t,_worksheet:n}=this,{startColumn:r,endColumn:s}=t;let i=0;for(let o=0;o<=s-r;o++)i+=n.getColumnWidth(o);return i}getWrap(){return this.getWrapStrategy()===ln.WRAP?Ie.TRUE:Ie.FALSE}getWrapStrategies(){return this._getStyles("tb")}getWrapStrategy(){return this.getWrapStrategies()[0][0]}forEach(t){Xn.foreach(this._range,t)}_getStyles(t){const n=this._deps.getStyles();return this.getValues().map(r=>r.map(s=>{const i=n&&n.getStyleByCell(s);return i&&i[t]||ut[t]}))}};C(Xn,"transformRange",(t,n)=>{const r=n.getMaxColumns()-1,s=n.getMaxRows()-1;return t.rangeType===Le.ALL?{startColumn:0,startRow:0,endColumn:r,endRow:s}:t.rangeType===Le.COLUMN?{startRow:0,endRow:s,startColumn:t.startColumn,endColumn:t.endColumn}:t.rangeType===Le.ROW?{startColumn:0,endColumn:r,startRow:t.startRow,endRow:t.endRow}:{startColumn:t.startColumn,endColumn:Math.min(t.endColumn,r),startRow:t.startRow,endRow:Math.min(t.endRow,s)}});let An=Xn;function ul(e,t,n=0,r=e.length-1,s=Nd){for(;r>n;){if(r-n>600){const l=r-n+1,u=t-n+1,c=Math.log(l),h=.5*Math.exp(2*c/3),d=.5*Math.sqrt(c*h*(l-h)/l)*(u-l/2<0?-1:1),f=Math.max(n,Math.floor(t-u*h/l+d)),p=Math.min(r,Math.floor(t+(l-u)*h/l+d));ul(e,t,f,p,s)}const i=e[t];let o=n,a=r;for(xn(e,n,t),s(e[r],i)>0&&xn(e,n,r);o<a;){for(xn(e,o,a),o++,a--;s(e[o],i)<0;)o++;for(;s(e[a],i)>0;)a--}s(e[n],i)===0?xn(e,n,a):(a++,xn(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}}function xn(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function Nd(e,t){return e<t?-1:e>t?1:0}class Yr{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let n=this.data;const r=[];if(!Rr(t,n))return r;const s=this.toBBox,i=[];for(;n;){for(let o=0;o<n.children.length;o++){const a=n.children[o],l=n.leaf?s(a):a;Rr(t,l)&&(n.leaf?r.push(a):ds(t,l)?this._all(a,r):i.push(a))}n=i.pop()}return r}collides(t){let n=this.data;if(!Rr(t,n))return!1;const r=[];for(;n;){for(let s=0;s<n.children.length;s++){const i=n.children[s],o=n.leaf?this.toBBox(i):i;if(Rr(t,o)){if(n.leaf||ds(t,o))return!0;r.push(i)}}n=r.pop()}return!1}load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(let r=0;r<t.length;r++)this.insert(t[r]);return this}let n=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length)this.data=n;else if(this.data.height===n.height)this._splitRoot(this.data,n);else{if(this.data.height<n.height){const r=this.data;this.data=n,n=r}this._insert(n,this.data.height-n.height-1,!0)}return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=En([]),this}remove(t,n){if(!t)return this;let r=this.data;const s=this.toBBox(t),i=[],o=[];let a,l,u;for(;r||i.length;){if(r||(r=i.pop(),l=i[i.length-1],a=o.pop(),u=!0),r.leaf){const c=Md(t,r.children,n);if(c!==-1)return r.children.splice(c,1),i.push(r),this._condense(i),this}!u&&!r.leaf&&ds(r,s)?(i.push(r),o.push(a),a=0,l=r,r=r.children[0]):l?(a++,r=l.children[a],u=!1):r=null}return this}toBBox(t){return t}compareMinX(t,n){return t.minX-n.minX}compareMinY(t,n){return t.minY-n.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,n){const r=[];for(;t;)t.leaf?n.push(...t.children):r.push(...t.children),t=r.pop();return n}_build(t,n,r,s){const i=r-n+1;let o=this._maxEntries,a;if(i<=o)return a=En(t.slice(n,r+1)),mn(a,this.toBBox),a;s||(s=Math.ceil(Math.log(i)/Math.log(o)),o=Math.ceil(i/Math.pow(o,s-1))),a=En([]),a.leaf=!1,a.height=s;const l=Math.ceil(i/o),u=l*Math.ceil(Math.sqrt(o));Wi(t,n,r,u,this.compareMinX);for(let c=n;c<=r;c+=u){const h=Math.min(c+u-1,r);Wi(t,c,h,l,this.compareMinY);for(let d=c;d<=h;d+=l){const f=Math.min(d+l-1,h);a.children.push(this._build(t,d,f,s-1))}}return mn(a,this.toBBox),a}_chooseSubtree(t,n,r,s){for(;s.push(n),!(n.leaf||s.length-1===r);){let i=1/0,o=1/0,a;for(let l=0;l<n.children.length;l++){const u=n.children[l],c=hs(u),h=xd(t,u)-c;h<o?(o=h,i=c<i?c:i,a=u):h===o&&c<i&&(i=c,a=u)}n=a||n.children[0]}return n}_insert(t,n,r){const s=r?t:this.toBBox(t),i=[],o=this._chooseSubtree(s,this.data,n,i);for(o.children.push(t),Wn(o,s);n>=0&&i[n].children.length>this._maxEntries;)this._split(i,n),n--;this._adjustParentBBoxes(s,i,n)}_split(t,n){const r=t[n],s=r.children.length,i=this._minEntries;this._chooseSplitAxis(r,i,s);const o=this._chooseSplitIndex(r,i,s),a=En(r.children.splice(o,r.children.length-o));a.height=r.height,a.leaf=r.leaf,mn(r,this.toBBox),mn(a,this.toBBox),n?t[n-1].children.push(a):this._splitRoot(r,a)}_splitRoot(t,n){this.data=En([t,n]),this.data.height=t.height+1,this.data.leaf=!1,mn(this.data,this.toBBox)}_chooseSplitIndex(t,n,r){let s,i=1/0,o=1/0;for(let a=n;a<=r-n;a++){const l=jn(t,0,a,this.toBBox),u=jn(t,a,r,this.toBBox),c=Ud(l,u),h=hs(l)+hs(u);c<i?(i=c,s=a,o=h<o?h:o):c===i&&h<o&&(o=h,s=a)}return s||r-n}_chooseSplitAxis(t,n,r){const s=t.leaf?this.compareMinX:Dd,i=t.leaf?this.compareMinY:Ld,o=this._allDistMargin(t,n,r,s),a=this._allDistMargin(t,n,r,i);o<a&&t.children.sort(s)}_allDistMargin(t,n,r,s){t.children.sort(s);const i=this.toBBox,o=jn(t,0,n,i),a=jn(t,r-n,r,i);let l=Cr(o)+Cr(a);for(let u=n;u<r-n;u++){const c=t.children[u];Wn(o,t.leaf?i(c):c),l+=Cr(o)}for(let u=r-n-1;u>=n;u--){const c=t.children[u];Wn(a,t.leaf?i(c):c),l+=Cr(a)}return l}_adjustParentBBoxes(t,n,r){for(let s=r;s>=0;s--)Wn(n[s],t)}_condense(t){for(let n=t.length-1,r;n>=0;n--)t[n].children.length===0?n>0?(r=t[n-1].children,r.splice(r.indexOf(t[n]),1)):this.clear():mn(t[n],this.toBBox)}}function Md(e,t,n){if(!n)return t.indexOf(e);for(let r=0;r<t.length;r++)if(n(e,t[r]))return r;return-1}function mn(e,t){jn(e,0,e.children.length,t,e)}function jn(e,t,n,r,s){s||(s=En(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(let i=t;i<n;i++){const o=e.children[i];Wn(s,e.leaf?r(o):o)}return s}function Wn(e,t){return e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),e}function Dd(e,t){return e.minX-t.minX}function Ld(e,t){return e.minY-t.minY}function hs(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function Cr(e){return e.maxX-e.minX+(e.maxY-e.minY)}function xd(e,t){return(Math.max(t.maxX,e.maxX)-Math.min(t.minX,e.minX))*(Math.max(t.maxY,e.maxY)-Math.min(t.minY,e.minY))}function Ud(e,t){const n=Math.max(e.minX,t.minX),r=Math.max(e.minY,t.minY),s=Math.min(e.maxX,t.maxX),i=Math.min(e.maxY,t.maxY);return Math.max(0,s-n)*Math.max(0,i-r)}function ds(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function Rr(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function En(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Wi(e,t,n,r,s){const i=[t,n];for(;i.length;){if(n=i.pop(),t=i.pop(),n-t<=r)continue;const o=t+Math.ceil((n-t)/r/2)*r;ul(e,o,t,n,s),i.push(t,o,o,n)}}function Pd(e,t,n,r=!1){if(t===0&&n===0)return e;let s={...e};const i=s.startAbsoluteRefType||tt.NONE,o=s.endAbsoluteRefType||tt.NONE,a=s.rangeType||Le.NORMAL;if(!r&&i===tt.ALL&&o===tt.ALL)return s;const l=Yi(s.startRow,n,s.startColumn,t,a),u=Yi(s.endRow,n,s.endColumn,t,a);return r||i===tt.NONE&&o===tt.NONE?s={...s,startRow:l.row,startColumn:l.column,endRow:u.row,endColumn:u.column}:(i===tt.NONE?s={...s,startRow:l.row,startColumn:l.column}:i===tt.COLUMN?s={...s,startRow:l.row}:i===tt.ROW&&(s={...s,startColumn:l.column}),o===tt.NONE?s={...s,endRow:u.row,endColumn:u.column}:o===tt.COLUMN?s={...s,endRow:u.row}:o===tt.ROW&&(s={...s,endColumn:u.column}),s)}function Yi(e,t,n,r,s){return s===Le.NORMAL?{row:e+t,column:n+r}:s===Le.ROW?{row:e+t,column:n}:s===Le.COLUMN?{row:e,column:n+r}:{row:e,column:n}}function ii(e){const t=new Set,n=new Set;for(const o of e)t.add(o.startColumn),t.add(o.endColumn+1),n.add(o.startRow),n.add(o.endRow+1);const r=Array.from(t).sort((o,a)=>o-a),s=Array.from(n).sort((o,a)=>o-a);e.sort((o,a)=>o.startRow-a.startRow||o.startColumn-a.startColumn);const i=[];for(let o=0;o<s.length-1;o++)for(let a=0;a<r.length-1;a++){const l=r[a],u=r[a+1]-1,c=s[o],h=s[o+1]-1;for(const d of e){if(d.startRow>h)break;if(d.startRow<=c&&d.endRow>=h&&d.startColumn<=l&&d.endColumn>=u){i.push({startColumn:l,endColumn:u,startRow:c,endRow:h});break}}}return i}function kd(e){e.sort((r,s)=>r.startRow-s.startRow||r.startColumn-s.startColumn);const t={};for(const r of e)t[r.startRow]||(t[r.startRow]=[]),t[r.startRow].push(r);const n=[];for(const r in t){const s=t[+r];s.sort((o,a)=>o.startColumn-a.startColumn);let i=s[0];for(let o=1;o<s.length;o++){const a=s[o];a.startColumn<=i.endColumn+1&&a.startRow===i.startRow&&a.endRow===i.endRow?i.endColumn=Math.max(i.endColumn,a.endColumn):(n.push(i),i=a)}n.push(i)}return n}function Fd(e){e.sort((r,s)=>r.startColumn-s.startColumn||r.startRow-s.startRow);const t={};for(const r of e)t[r.startColumn]||(t[r.startColumn]=[]),t[r.startColumn].push(r);const n=[];for(const r in t){const s=t[+r];s.sort((o,a)=>o.startRow-a.startRow);let i=s[0];for(let o=1;o<s.length;o++){const a=s[o];a.startRow<=i.endRow+1&&a.startColumn===i.startColumn&&a.endColumn===i.endColumn?i.endRow=Math.max(i.endRow,a.endRow):(n.push(i),i=a)}n.push(i)}return n}function Bd(e){const t=ii(e),n=kd(t);return Fd(n)}function $d(e,t){const n=[];return e.forEach(r=>{n.push(...Zt.subtract(r,t))}),Zt.mergeRanges(n)}function cl(e,t){const n=Gi(e.startRow,e.endRow,t.startRow,t.endRow),r=Gi(e.startColumn,e.endColumn,t.startColumn,t.endColumn);if(!n||!r)return null;const[s,i]=n,[o,a]=r,l=Hd(e.rangeType,t.rangeType,s,i,o,a);return{startRow:s,endRow:i,startColumn:o,endColumn:a,rangeType:l}}function Gi(e,t,n,r){const s=isNaN(e)?-1/0:e,i=isNaN(t)?1/0:t,o=isNaN(n)?-1/0:n,a=isNaN(r)?1/0:r,l=Math.max(s,o),u=Math.min(i,a);if(l<=u){const c=l===-1/0?Number.NaN:l,h=u===1/0?Number.NaN:u;return[c,h]}else return null}function Hd(e,t,n,r,s,i){const o=e!==void 0?e:zi(n,r,s,i),a=t!==void 0?t:zi(n,r,s,i);return o===Le.ALL||a===Le.ALL?o===a?o:o===Le.ALL?a:o:o===a?o:(o===Le.NORMAL||a===Le.NORMAL,Le.NORMAL)}function zi(e,t,n,r){const s=!isNaN(e)&&!isNaN(t),i=!isNaN(n)&&!isNaN(r);return s&&i?Le.NORMAL:s?Le.ROW:i?Le.COLUMN:Le.ALL}const Pt=class Pt{static clone(t){return t.rangeType!==void 0?{startRow:t.startRow,startColumn:t.startColumn,endRow:t.endRow,endColumn:t.endColumn,rangeType:t.rangeType}:{startRow:t.startRow,startColumn:t.startColumn,endRow:t.endRow,endColumn:t.endColumn}}static equals(t,n){return t==null||n==null?!1:t.endRow===n.endRow&&t.endColumn===n.endColumn&&t.startRow===n.startRow&&t.startColumn===n.startColumn&&(t.rangeType===n.rangeType||t.rangeType===void 0&&n.rangeType===Le.NORMAL||n.rangeType===void 0&&t.rangeType===Le.NORMAL)}static simpleRangesIntersect(t,n){const{startRow:r,endRow:s,startColumn:i,endColumn:o}=t,{startRow:a,endRow:l,startColumn:u,endColumn:c}=n,h=r<=l&&s>=a,d=i<=c&&o>=u;return h&&d}static intersects(t,n){if(t.rangeType===Le.ROW&&n.rangeType===Le.COLUMN||t.rangeType===Le.COLUMN&&n.rangeType===Le.ROW)return!0;if(t.rangeType===Le.ROW&&n.rangeType===Le.ROW)return t.startRow<=n.endRow&&t.endRow>=n.startRow;if(t.rangeType===Le.COLUMN&&n.rangeType===Le.COLUMN)return t.startColumn<=n.endColumn&&t.endColumn>=n.startColumn;const r=Math.floor(Number.MAX_SAFE_INTEGER/10),s=Number.isNaN(t.startRow)?0:t.startRow,i=Number.isNaN(t.endRow)?r:t.endRow,o=Number.isNaN(t.startColumn)?0:t.startColumn,a=Number.isNaN(t.endColumn)?r:t.endColumn,l=Number.isNaN(n.startRow)?0:n.startRow,u=Number.isNaN(n.endRow)?r:n.endRow,c=Number.isNaN(n.startColumn)?0:n.startColumn,h=Number.isNaN(n.endColumn)?r:n.endColumn,d=Math.abs(o+a-c-h),f=Math.abs(o-a)+Math.abs(c-h),p=Math.abs(s+i-l-u),R=Math.abs(s-i)+Math.abs(l-u);return d<=f&&p<=R}static doAnyRangesIntersect(t,n){const r=new Yr;return r.load(t.map(s=>({minX:s.startColumn,minY:s.startRow,maxX:s.endColumn,maxY:s.endRow}))),n.some(s=>r.search({minX:s.startColumn,minY:s.startRow,maxX:s.endColumn,maxY:s.endRow}).length>0)}static getIntersects(t,n){const r=t.startRow,s=t.endRow,i=t.startColumn,o=t.endColumn,a=n.startRow,l=n.endRow,u=n.startColumn,c=n.endColumn;let h,d,f,p;if(a<=s)a>=r?d=a:d=r;else return null;if(l>=r)l>=s?p=s:p=l;else return null;if(u<=o)u>i?h=u:h=i;else return null;if(c>=i)c>=o?f=o:f=c;else return null;return{startRow:d,endRow:p,startColumn:h,endColumn:f,rangeType:Le.NORMAL}}static contains(t,n){return t.startRow<=n.startRow&&t.endRow>=n.endRow&&t.startColumn<=n.startColumn&&t.endColumn>=n.endColumn}static realContain(t,n){return Pt.contains(t,n)&&(t.startRow<n.startRow||t.endRow>n.endRow||t.startColumn<n.startColumn||t.endColumn>n.endColumn)}static union(...t){return t.reduce((n,r)=>({startRow:Math.min(n.startRow,r.startRow),startColumn:Math.min(n.startColumn,r.startColumn),endRow:Math.max(n.endRow,r.endRow),endColumn:Math.max(n.endColumn,r.endColumn),rangeType:Le.NORMAL}),t[0])}static realUnion(...t){const n=t.some(i=>i.rangeType===Le.COLUMN),r=t.some(i=>i.rangeType===Le.ROW),s=Pt.union(...t);return{startColumn:r?Number.NaN:s.startColumn,endColumn:r?Number.NaN:s.endColumn,startRow:n?Number.NaN:s.startRow,endRow:n?Number.NaN:s.endRow,rangeType:r?Le.ROW:n?Le.COLUMN:Le.NORMAL}}static subtract(t,n){if(n.startRow>t.endRow||n.endRow<t.startRow||n.startColumn>t.endColumn||n.endColumn<t.startColumn)return[t];const r=[];n.startRow>=t.startRow&&r.push({startRow:t.startRow,startColumn:t.startColumn,endRow:n.startRow-1,endColumn:t.endColumn}),n.endRow<=t.endRow&&r.push({startRow:n.endRow+1,startColumn:t.startColumn,endRow:t.endRow,endColumn:t.endColumn});const s=Math.max(t.startRow,n.startRow),i=Math.min(t.endRow,n.endRow);return n.startColumn>=t.startColumn&&r.push({startRow:s,startColumn:t.startColumn,endRow:i,endColumn:n.startColumn-1}),n.endColumn<=t.endColumn&&r.push({startRow:s,startColumn:n.endColumn+1,endRow:i,endColumn:t.endColumn}),r.filter(a=>a.startRow<=a.endRow&&a.startColumn<=a.endColumn)}static mergeRanges(t){return Bd(t)}static splitIntoGrid(t){return ii(t)}static subtractMulti(t,n){if(!n.length)return t;let r=t;return n.forEach(s=>{r=$d(r,s)}),r}static hasIntersectionBetweenTwoRect(t,n){return!(t.left>n.right||t.right<n.left||t.top>n.bottom||t.bottom<n.top)}static getIntersectionBetweenTwoRect(t,n){const r=Math.max(t.left,n.left),s=Math.min(t.right,n.right),i=Math.max(t.top,n.top),o=Math.min(t.bottom,n.bottom);return s<=r||o<=i?null:{left:r,right:s,top:i,bottom:o,width:s-r,height:o-i}}static sort(t){return t.sort((n,r)=>n.startRow-r.startRow||n.startColumn-r.startColumn)}};C(Pt,"getRelativeRange",(t,n)=>({startRow:t.startRow-n.startRow,endRow:t.endRow-t.startRow,startColumn:t.startColumn-n.startColumn,endColumn:t.endColumn-t.startColumn})),C(Pt,"getPositionRange",(t,n,r)=>({...r||{},startRow:r&&[tt.ROW,tt.ALL].includes(r.startAbsoluteRefType||0)?r.startRow:t.startRow+n.startRow,endRow:r&&[tt.ROW,tt.ALL].includes(r.endAbsoluteRefType||0)?r.endRow:t.endRow+t.startRow+n.startRow,startColumn:r&&[tt.COLUMN,tt.ALL].includes(r.startAbsoluteRefType||0)?r.startColumn:t.startColumn+n.startColumn,endColumn:r&&[tt.COLUMN,tt.ALL].includes(r.endAbsoluteRefType||0)?r.endColumn:t.endColumn+t.startColumn+n.startColumn})),C(Pt,"moveHorizontal",(t,n=0,r=0)=>({...t,startColumn:t.startColumn+n,endColumn:t.endColumn+n+r})),C(Pt,"moveVertical",(t,n=0,r=0)=>({...t,startRow:t.startRow+n,endRow:t.endRow+n+r})),C(Pt,"moveOffset",(t,n,r)=>({...t,startRow:t.startRow+r,endRow:t.endRow+r,startColumn:t.startColumn+n,endColumn:t.endColumn+n}));let Zt=Pt;function jd(e,t){if(e.length===0||e[0].length===0)return null;const n=new Array(e[0].length).fill(0);let r=0,s=null;for(let i=0;i<e.length;i++){for(let a=0;a<e[0].length;a++)n[a]=t(e[i][a])?n[a]+1:0;const o=Wd(n);o.area>r&&(r=o.area,s={startColumn:o.start,startRow:i-o.height+1,endColumn:o.end,endRow:i})}return s}function Wd(e){const t=[];let n=0,r={area:0,height:0,start:0,end:0},s=0;for(;s<e.length;)if(t.length===0||e[s]>=e[t[t.length-1]])t.push(s++);else{const i=e[t.pop()],o=t.length===0?s:s-t[t.length-1]-1;i*o>n&&(n=i*o,r={area:n,height:i,start:t.length===0?0:t[t.length-1]+1,end:s-1})}for(;t.length>0;){const i=e[t.pop()],o=t.length===0?s:s-t[t.length-1]-1;i*o>n&&(n=i*o,r={area:n,height:i,start:t.length===0?0:t[t.length-1]+1,end:s-1})}return r}function Yd(e,t){An.foreach(t,(n,r)=>{e[n][r]=void 0})}function Gd(e,t){const n=e.toFullArray(),r=[];for(;;){const s=jd(n,t);if(!s)break;r.push(s),Yd(n,s)}return r}class zd{constructor(t,n){C(this,"_values",[]);C(this,"_keys",[]);C(this,"_keyMaps",new Map);this._values=t,this._keys=n,t.forEach(r=>{this._initKeyMap(r)})}_initKeyMap(t){this._keys.forEach(n=>{const r=t[n],s=this._keyMaps.get(n)||new Map;s.set(r,t),this._keyMaps.set(n,s)})}getValue(t,n){const r=n||this._keys;for(let s=0;s<r.length;s++){const i=this._keyMaps.get(r[s]);if(i!=null&&i.has(t))return i.get(t)}return null}hasValue(t){for(let n=0;n<this._keys.length;n++){const r=this._keyMaps.get(this._keys[n]);if(r!=null&&r.has(t))return!0}return!1}addValue(t){this._values.push(t),this._initKeyMap(t)}setValue(t,n,r){const s=this.getValue(t);s&&Object.keys(s).includes(n)&&(s[n]=r)}deleteValue(t,n){const r=this.getValue(t,n);if(r){this._keys.forEach(i=>{const o=this._keyMaps.get(i),a=r[i];o==null||o.delete(a)});const s=this._values.findIndex(i=>i===r);this._values.splice(s,1)}}getValues(){return this._values}getKeyMap(t){var n;return[...((n=this._keyMaps.get(t))==null?void 0:n.keys())||[]]}clear(){this._values=[],this._keys=[],this._keyMaps.clear()}}function Us(e,t,n,r){return{forEach(s){for(let i=e;i<=t;i++)for(let o=n;o<=r;o++)s(i,o)}}}function Vd(e){if(e==null||e.length===0)return Number.NaN;const t=e.toLowerCase().split(""),n=t.length,r=o=>o.charCodeAt(0)-96;let s=0,i=0;for(let o=0;o<n;o++)i=r(t[o]),s+=i*26**(n-o-1);return s===0?Number.NaN:s-1}const Gr=65,hl=90,Kd=97;function Xd(e){const t=hl-Gr+1;let n="";for(;e>=0;)n=String.fromCharCode(e%t+Gr)+n,e=Math.floor(e/t)-1;return n}function dl(e,t){let n="";for(;t>0;)n+=e,t--;return n}function qd(e,t=!1){const n=hl-Gr+1;let r=Kd;t&&(r=Gr);const s=String.fromCharCode(e%n+r),i=Math.floor(e/n)+1;return dl(s,i)}function Jd(e,t){return e.zIndex>t.zIndex?1:e.zIndex===t.zIndex?0:-1}function Zd(e,t){return e.zIndex>t.zIndex?-1:e.zIndex===t.zIndex?0:1}function lr(e="index",t=1){return(n,r)=>n[e]>r[e]?t:n[e]===r[e]?0:-t}var fl=(e=>(e.PARAGRAPH="PARAGRAPH",e.SECTION_BREAK="SECTION_BREAK",e.TABLE="TABLE",e.TABLE_ROW="TABLE_ROW",e.TABLE_CELL="TABLE_CELL",e.CUSTOM_BLOCK="CUSTOM_BLOCK",e))(fl||{}),_t=(e=>(e.PARAGRAPH="\r",e.SECTION_BREAK=`
4
+ `,e.TABLE_START="",e.TABLE_ROW_START="\x1B",e.TABLE_CELL_START="",e.TABLE_CELL_END="",e.TABLE_ROW_END="",e.TABLE_END="",e.CUSTOM_RANGE_START="",e.CUSTOM_RANGE_END="",e.COLUMN_BREAK="\v",e.PAGE_BREAK="\f",e.DOCS_END="\0",e.TAB=" ",e.CUSTOM_BLOCK="\b",e.LETTER="",e.SPACE=" ",e))(_t||{});function Qd(e){return`${e}`}const ef=[_t.TABLE_START,_t.TABLE_ROW_START,_t.TABLE_CELL_START,_t.TABLE_CELL_END,_t.TABLE_ROW_END,_t.TABLE_END],es=e=>{const t=e.endsWith(`\r
5
+ `)?e.slice(0,-2):e;return ef.reduce((n,r)=>n.replaceAll(r,""),t)},tf=e=>e?es(e).replaceAll("\r","")==="":!0,nf=e=>{const t=e.replace(/\n/g,"\r"),n=[],r=[];let s=0,i="";const o=(l,u=!0)=>{const c=t.slice(s,l);if(re.isLegalUrl(c)){const h=Ft(),d=`${c}`,f={startIndex:s,endIndex:s+d.length-1,rangeId:h,rangeType:Jt.HYPERLINK,properties:{url:e}};r.push(f),i+=d,s=l+1,u&&(i+="\r",n.push({startIndex:l}))}else i+=t.slice(s,l+1),s=l+1,u&&n.push({startIndex:l})};let a=0;for(let l=0;l<t.length;l++)t[l]==="\r"&&(o(l),a=l);return(a!==t.length-1||t.length===1)&&o(t.length,!1),{dataStream:i,paragraphs:n,customRanges:r}};var gl=typeof global=="object"&&global&&global.Object===Object&&global,rf=typeof self=="object"&&self&&self.Object===Object&&self,hn=gl||rf||Function("return this")(),Tn=hn.Symbol,ml=Object.prototype,sf=ml.hasOwnProperty,of=ml.toString,Un=Tn?Tn.toStringTag:void 0;function af(e){var t=sf.call(e,Un),n=e[Un];try{e[Un]=void 0;var r=!0}catch{}var s=of.call(e);return r&&(t?e[Un]=n:delete e[Un]),s}var lf=Object.prototype,uf=lf.toString;function cf(e){return uf.call(e)}var hf="[object Null]",df="[object Undefined]",Vi=Tn?Tn.toStringTag:void 0;function ur(e){return e==null?e===void 0?df:hf:Vi&&Vi in Object(e)?af(e):cf(e)}function Dn(e){return e!=null&&typeof e=="object"}var ff="[object Symbol]";function ts(e){return typeof e=="symbol"||Dn(e)&&ur(e)==ff}function gf(e,t){for(var n=-1,r=e==null?0:e.length,s=Array(r);++n<r;)s[n]=t(e[n],n,e);return s}var yn=Array.isArray,Ki=Tn?Tn.prototype:void 0,Xi=Ki?Ki.toString:void 0;function _l(e){if(typeof e=="string")return e;if(yn(e))return gf(e,_l)+"";if(ts(e))return Xi?Xi.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var mf=/\s/;function _f(e){for(var t=e.length;t--&&mf.test(e.charAt(t)););return t}var pf=/^\s+/;function Ef(e){return e&&e.slice(0,_f(e)+1).replace(pf,"")}function St(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var qi=NaN,Cf=/^[-+]0x[0-9a-f]+$/i,Rf=/^0b[01]+$/i,If=/^0o[0-7]+$/i,Sf=parseInt;function Ji(e){if(typeof e=="number")return e;if(ts(e))return qi;if(St(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=St(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Ef(e);var n=Rf.test(e);return n||If.test(e)?Sf(e.slice(2),n?2:8):Cf.test(e)?qi:+e}function pl(e){return e}var vf="[object AsyncFunction]",Of="[object Function]",wf="[object GeneratorFunction]",bf="[object Proxy]";function oi(e){if(!St(e))return!1;var t=ur(e);return t==Of||t==wf||t==vf||t==bf}var fs=hn["__core-js_shared__"],Zi=function(){var e=/[^.]+$/.exec(fs&&fs.keys&&fs.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Af(e){return!!Zi&&Zi in e}var Tf=Function.prototype,yf=Tf.toString;function Nf(e){if(e!=null){try{return yf.call(e)}catch{}try{return e+""}catch{}}return""}var Mf=/[\\^$.*+?()[\]{}|]/g,Df=/^\[object .+?Constructor\]$/,Lf=Function.prototype,xf=Object.prototype,Uf=Lf.toString,Pf=xf.hasOwnProperty,kf=RegExp("^"+Uf.call(Pf).replace(Mf,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ff(e){if(!St(e)||Af(e))return!1;var t=oi(e)?kf:Df;return t.test(Nf(e))}function Bf(e,t){return e==null?void 0:e[t]}function ai(e,t){var n=Bf(e,t);return Ff(n)?n:void 0}var Qi=Object.create,$f=function(){function e(){}return function(t){if(!St(t))return{};if(Qi)return Qi(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function Hf(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function jf(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}var Wf=800,Yf=16,Gf=Date.now;function zf(e){var t=0,n=0;return function(){var r=Gf(),s=Yf-(r-n);if(n=r,s>0){if(++t>=Wf)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Vf(e){return function(){return e}}var zr=function(){try{var e=ai(Object,"defineProperty");return e({},"",{}),e}catch{}}(),Kf=zr?function(e,t){return zr(e,"toString",{configurable:!0,enumerable:!1,value:Vf(t),writable:!0})}:pl,Xf=zf(Kf),qf=9007199254740991,Jf=/^(?:0|[1-9]\d*)$/;function li(e,t){var n=typeof e;return t=t==null?qf:t,!!t&&(n=="number"||n!="symbol"&&Jf.test(e))&&e>-1&&e%1==0&&e<t}function ui(e,t,n){t=="__proto__"&&zr?zr(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function ns(e,t){return e===t||e!==e&&t!==t}var Zf=Object.prototype,Qf=Zf.hasOwnProperty;function El(e,t,n){var r=e[t];(!(Qf.call(e,t)&&ns(r,n))||n===void 0&&!(t in e))&&ui(e,t,n)}function eg(e,t,n,r){var s=!n;n||(n={});for(var i=-1,o=t.length;++i<o;){var a=t[i],l=void 0;l===void 0&&(l=e[a]),s?ui(n,a,l):El(n,a,l)}return n}var eo=Math.max;function tg(e,t,n){return t=eo(t===void 0?e.length-1:t,0),function(){for(var r=arguments,s=-1,i=eo(r.length-t,0),o=Array(i);++s<i;)o[s]=r[t+s];s=-1;for(var a=Array(t+1);++s<t;)a[s]=r[s];return a[t]=n(o),Hf(e,this,a)}}function ng(e,t){return Xf(tg(e,t,pl),e+"")}var rg=9007199254740991;function Cl(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=rg}function ci(e){return e!=null&&Cl(e.length)&&!oi(e)}function sg(e,t,n){if(!St(n))return!1;var r=typeof t;return(r=="number"?ci(n)&&li(t,n.length):r=="string"&&t in n)?ns(n[t],e):!1}function Rl(e){return ng(function(t,n){var r=-1,s=n.length,i=s>1?n[s-1]:void 0,o=s>2?n[2]:void 0;for(i=e.length>3&&typeof i=="function"?(s--,i):void 0,o&&sg(n[0],n[1],o)&&(i=s<3?void 0:i,s=1),t=Object(t);++r<s;){var a=n[r];a&&e(t,a,r,i)}return t})}var ig=Object.prototype;function Il(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||ig;return e===n}function og(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var ag="[object Arguments]";function to(e){return Dn(e)&&ur(e)==ag}var Sl=Object.prototype,lg=Sl.hasOwnProperty,ug=Sl.propertyIsEnumerable,Ps=to(function(){return arguments}())?to:function(e){return Dn(e)&&lg.call(e,"callee")&&!ug.call(e,"callee")};function cg(){return!1}var vl=typeof exports=="object"&&exports&&!exports.nodeType&&exports,no=vl&&typeof module=="object"&&module&&!module.nodeType&&module,hg=no&&no.exports===vl,ro=hg?hn.Buffer:void 0,dg=ro?ro.isBuffer:void 0,Ol=dg||cg,fg="[object Arguments]",gg="[object Array]",mg="[object Boolean]",_g="[object Date]",pg="[object Error]",Eg="[object Function]",Cg="[object Map]",Rg="[object Number]",Ig="[object Object]",Sg="[object RegExp]",vg="[object Set]",Og="[object String]",wg="[object WeakMap]",bg="[object ArrayBuffer]",Ag="[object DataView]",Tg="[object Float32Array]",yg="[object Float64Array]",Ng="[object Int8Array]",Mg="[object Int16Array]",Dg="[object Int32Array]",Lg="[object Uint8Array]",xg="[object Uint8ClampedArray]",Ug="[object Uint16Array]",Pg="[object Uint32Array]",Ze={};Ze[Tg]=Ze[yg]=Ze[Ng]=Ze[Mg]=Ze[Dg]=Ze[Lg]=Ze[xg]=Ze[Ug]=Ze[Pg]=!0;Ze[fg]=Ze[gg]=Ze[bg]=Ze[mg]=Ze[Ag]=Ze[_g]=Ze[pg]=Ze[Eg]=Ze[Cg]=Ze[Rg]=Ze[Ig]=Ze[Sg]=Ze[vg]=Ze[Og]=Ze[wg]=!1;function kg(e){return Dn(e)&&Cl(e.length)&&!!Ze[ur(e)]}function Fg(e){return function(t){return e(t)}}var wl=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Kn=wl&&typeof module=="object"&&module&&!module.nodeType&&module,Bg=Kn&&Kn.exports===wl,gs=Bg&&gl.process,so=function(){try{var e=Kn&&Kn.require&&Kn.require("util").types;return e||gs&&gs.binding&&gs.binding("util")}catch{}}(),io=so&&so.isTypedArray,bl=io?Fg(io):kg;function $g(e,t){var n=yn(e),r=!n&&Ps(e),s=!n&&!r&&Ol(e),i=!n&&!r&&!s&&bl(e),o=n||r||s||i,a=o?og(e.length,String):[],l=a.length;for(var u in e)o&&(u=="length"||s&&(u=="offset"||u=="parent")||i&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||li(u,l))||a.push(u);return a}function Hg(e,t){return function(n){return e(t(n))}}function jg(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var Wg=Object.prototype,Yg=Wg.hasOwnProperty;function Gg(e){if(!St(e))return jg(e);var t=Il(e),n=[];for(var r in e)r=="constructor"&&(t||!Yg.call(e,r))||n.push(r);return n}function Al(e){return ci(e)?$g(e):Gg(e)}var zg=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Vg=/^\w*$/;function Kg(e,t){if(yn(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||ts(e)?!0:Vg.test(e)||!zg.test(e)||t!=null&&e in Object(t)}var Zn=ai(Object,"create");function Xg(){this.__data__=Zn?Zn(null):{},this.size=0}function qg(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Jg="__lodash_hash_undefined__",Zg=Object.prototype,Qg=Zg.hasOwnProperty;function em(e){var t=this.__data__;if(Zn){var n=t[e];return n===Jg?void 0:n}return Qg.call(t,e)?t[e]:void 0}var tm=Object.prototype,nm=tm.hasOwnProperty;function rm(e){var t=this.__data__;return Zn?t[e]!==void 0:nm.call(t,e)}var sm="__lodash_hash_undefined__";function im(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Zn&&t===void 0?sm:t,this}function cn(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}cn.prototype.clear=Xg;cn.prototype.delete=qg;cn.prototype.get=em;cn.prototype.has=rm;cn.prototype.set=im;function om(){this.__data__=[],this.size=0}function rs(e,t){for(var n=e.length;n--;)if(ns(e[n][0],t))return n;return-1}var am=Array.prototype,lm=am.splice;function um(e){var t=this.__data__,n=rs(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():lm.call(t,n,1),--this.size,!0}function cm(e){var t=this.__data__,n=rs(t,e);return n<0?void 0:t[n][1]}function hm(e){return rs(this.__data__,e)>-1}function dm(e,t){var n=this.__data__,r=rs(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function Ht(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Ht.prototype.clear=om;Ht.prototype.delete=um;Ht.prototype.get=cm;Ht.prototype.has=hm;Ht.prototype.set=dm;var Tl=ai(hn,"Map");function fm(){this.size=0,this.__data__={hash:new cn,map:new(Tl||Ht),string:new cn}}function gm(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function ss(e,t){var n=e.__data__;return gm(t)?n[typeof t=="string"?"string":"hash"]:n.map}function mm(e){var t=ss(this,e).delete(e);return this.size-=t?1:0,t}function _m(e){return ss(this,e).get(e)}function pm(e){return ss(this,e).has(e)}function Em(e,t){var n=ss(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function Qt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Qt.prototype.clear=fm;Qt.prototype.delete=mm;Qt.prototype.get=_m;Qt.prototype.has=pm;Qt.prototype.set=Em;var Cm="Expected a function";function hi(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(Cm);var n=function(){var r=arguments,s=t?t.apply(this,r):r[0],i=n.cache;if(i.has(s))return i.get(s);var o=e.apply(this,r);return n.cache=i.set(s,o)||i,o};return n.cache=new(hi.Cache||Qt),n}hi.Cache=Qt;var Rm=500;function Im(e){var t=hi(e,function(r){return n.size===Rm&&n.clear(),r}),n=t.cache;return t}var Sm=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,vm=/\\(\\)?/g,Om=Im(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(Sm,function(n,r,s,i){t.push(s?i.replace(vm,"$1"):r||n)}),t});function wm(e){return e==null?"":_l(e)}function yl(e,t){return yn(e)?e:Kg(e,t)?[e]:Om(wm(e))}function Nl(e){if(typeof e=="string"||ts(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function bm(e,t){t=yl(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[Nl(t[n++])];return n&&n==r?e:void 0}function Am(e,t,n){var r=e==null?void 0:bm(e,t);return r===void 0?n:r}var Ml=Hg(Object.getPrototypeOf,Object),Tm="[object Object]",ym=Function.prototype,Nm=Object.prototype,Dl=ym.toString,Mm=Nm.hasOwnProperty,Dm=Dl.call(Object);function Lm(e){if(!Dn(e)||ur(e)!=Tm)return!1;var t=Ml(e);if(t===null)return!0;var n=Mm.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&Dl.call(n)==Dm}function xm(){this.__data__=new Ht,this.size=0}function Um(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function Pm(e){return this.__data__.get(e)}function km(e){return this.__data__.has(e)}var Fm=200;function Bm(e,t){var n=this.__data__;if(n instanceof Ht){var r=n.__data__;if(!Tl||r.length<Fm-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Qt(r)}return n.set(e,t),this.size=n.size,this}function Ln(e){var t=this.__data__=new Ht(e);this.size=t.size}Ln.prototype.clear=xm;Ln.prototype.delete=Um;Ln.prototype.get=Pm;Ln.prototype.has=km;Ln.prototype.set=Bm;var Ll=typeof exports=="object"&&exports&&!exports.nodeType&&exports,oo=Ll&&typeof module=="object"&&module&&!module.nodeType&&module,$m=oo&&oo.exports===Ll,ao=$m?hn.Buffer:void 0;ao&&ao.allocUnsafe;function Hm(e,t){return e.slice()}var lo=hn.Uint8Array;function jm(e){var t=new e.constructor(e.byteLength);return new lo(t).set(new lo(e)),t}function Wm(e,t){var n=jm(e.buffer);return new e.constructor(n,e.byteOffset,e.length)}function Ym(e){return typeof e.constructor=="function"&&!Il(e)?$f(Ml(e)):{}}function Gm(e){return function(t,n,r){for(var s=-1,i=Object(t),o=r(t),a=o.length;a--;){var l=o[++s];if(n(i[l],l,i)===!1)break}return t}}var zm=Gm(),ms=function(){return hn.Date.now()},Vm="Expected a function",Km=Math.max,Xm=Math.min;function qm(e,t,n){var r,s,i,o,a,l,u=0,c=!1,h=!1,d=!0;if(typeof e!="function")throw new TypeError(Vm);t=Ji(t)||0,St(n)&&(c=!!n.leading,h="maxWait"in n,i=h?Km(Ji(n.maxWait)||0,t):i,d="trailing"in n?!!n.trailing:d);function f(A){var j=r,Z=s;return r=s=void 0,u=A,o=e.apply(Z,j),o}function p(A){return u=A,a=setTimeout(N,t),c?f(A):o}function R(A){var j=A-l,Z=A-u,fe=t-j;return h?Xm(fe,i-Z):fe}function w(A){var j=A-l,Z=A-u;return l===void 0||j>=t||j<0||h&&Z>=i}function N(){var A=ms();if(w(A))return z(A);a=setTimeout(N,R(A))}function z(A){return a=void 0,d&&r?f(A):(r=s=void 0,o)}function W(){a!==void 0&&clearTimeout(a),u=0,r=l=s=a=void 0}function se(){return a===void 0?o:z(ms())}function y(){var A=ms(),j=w(A);if(r=arguments,s=this,l=A,j){if(a===void 0)return p(l);if(h)return clearTimeout(a),a=setTimeout(N,t),f(l)}return a===void 0&&(a=setTimeout(N,t)),o}return y.cancel=W,y.flush=se,y}function ks(e,t,n){(n!==void 0&&!ns(e[t],n)||n===void 0&&!(t in e))&&ui(e,t,n)}function Jm(e){return Dn(e)&&ci(e)}function Fs(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}function Zm(e){return eg(e,Al(e))}function Qm(e,t,n,r,s,i,o){var a=Fs(e,n),l=Fs(t,n),u=o.get(l);if(u){ks(e,n,u);return}var c=i?i(a,l,n+"",e,t,o):void 0,h=c===void 0;if(h){var d=yn(l),f=!d&&Ol(l),p=!d&&!f&&bl(l);c=l,d||f||p?yn(a)?c=a:Jm(a)?c=jf(a):f?(h=!1,c=Hm(l)):p?(h=!1,c=Wm(l)):c=[]:Lm(l)||Ps(l)?(c=a,Ps(a)?c=Zm(a):(!St(a)||oi(a))&&(c=Ym(l))):h=!1}h&&(o.set(l,c),s(c,l,r,i,o),o.delete(l)),ks(e,n,c)}function di(e,t,n,r,s){e!==t&&zm(t,function(i,o){if(s||(s=new Ln),St(i))Qm(e,t,o,n,di,r,s);else{var a=r?r(Fs(e,o),i,o+"",e,t,s):void 0;a===void 0&&(a=i),ks(e,o,a)}},Al)}var e_=Rl(function(e,t,n,r){di(e,t,n,r)}),fi=Rl(function(e,t,n){di(e,t,n)});function t_(e,t,n,r){if(!St(e))return e;t=yl(t,e);for(var s=-1,i=t.length,o=i-1,a=e;a!=null&&++s<i;){var l=Nl(t[s]),u=n;if(l==="__proto__"||l==="constructor"||l==="prototype")return e;if(s!=o){var c=a[l];u=void 0,u===void 0&&(u=St(c)?c:li(t[s+1])?[]:{})}El(a,l,u),a=a[l]}return e}function n_(e,t,n){return e==null?e:t_(e,t,n)}var _s,uo;function r_(){if(uo)return _s;uo=1;var e=-1,t=1,n=0;function r(_,H,v,D,b){if(_===H)return _?[[n,_]]:[];if(v!=null){var O=fe(_,H,v);if(O)return O}var k=a(_,H),B=_.substring(0,k);_=_.substring(k),H=H.substring(k),k=u(_,H);var V=_.substring(_.length-k);_=_.substring(0,_.length-k),H=H.substring(0,H.length-k);var ie=s(_,H);return B&&ie.unshift([n,B]),V&&ie.push([n,V]),z(ie,b),D&&h(ie),ie}function s(_,H){var v;if(!_)return[[t,H]];if(!H)return[[e,_]];var D=_.length>H.length?_:H,b=_.length>H.length?H:_,O=D.indexOf(b);if(O!==-1)return v=[[t,D.substring(0,O)],[n,b],[t,D.substring(O+b.length)]],_.length>H.length&&(v[0][0]=v[2][0]=e),v;if(b.length===1)return[[e,_],[t,H]];var k=c(_,H);if(k){var B=k[0],V=k[1],ie=k[2],de=k[3],ge=k[4],ye=r(B,ie),Ae=r(V,de);return ye.concat([[n,ge]],Ae)}return i(_,H)}function i(_,H){for(var v=_.length,D=H.length,b=Math.ceil((v+D)/2),O=b,k=2*b,B=new Array(k),V=new Array(k),ie=0;ie<k;ie++)B[ie]=-1,V[ie]=-1;B[O+1]=0,V[O+1]=0;for(var de=v-D,ge=de%2!==0,ye=0,Ae=0,S=0,F=0,K=0;K<b;K++){for(var q=-K+ye;q<=K-Ae;q+=2){var G=O+q,Y;q===-K||q!==K&&B[G-1]<B[G+1]?Y=B[G+1]:Y=B[G-1]+1;for(var ue=Y-q;Y<v&&ue<D&&_.charAt(Y)===H.charAt(ue);)Y++,ue++;if(B[G]=Y,Y>v)Ae+=2;else if(ue>D)ye+=2;else if(ge){var ae=O+de-q;if(ae>=0&&ae<k&&V[ae]!==-1){var $=v-V[ae];if(Y>=$)return o(_,H,Y,ue)}}}for(var te=-K+S;te<=K-F;te+=2){var ae=O+te,$;te===-K||te!==K&&V[ae-1]<V[ae+1]?$=V[ae+1]:$=V[ae-1]+1;for(var oe=$-te;$<v&&oe<D&&_.charAt(v-$-1)===H.charAt(D-oe-1);)$++,oe++;if(V[ae]=$,$>v)F+=2;else if(oe>D)S+=2;else if(!ge){var G=O+de-te;if(G>=0&&G<k&&B[G]!==-1){var Y=B[G],ue=O+Y-G;if($=v-$,Y>=$)return o(_,H,Y,ue)}}}}return[[e,_],[t,H]]}function o(_,H,v,D){var b=_.substring(0,v),O=H.substring(0,D),k=_.substring(v),B=H.substring(D),V=r(b,O),ie=r(k,B);return V.concat(ie)}function a(_,H){if(!_||!H||_.charAt(0)!==H.charAt(0))return 0;for(var v=0,D=Math.min(_.length,H.length),b=D,O=0;v<b;)_.substring(O,b)==H.substring(O,b)?(v=b,O=v):D=b,b=Math.floor((D-v)/2+v);return W(_.charCodeAt(b-1))&&b--,b}function l(_,H){var v=_.length,D=H.length;if(v==0||D==0)return 0;v>D?_=_.substring(v-D):v<D&&(H=H.substring(0,v));var b=Math.min(v,D);if(_==H)return b;for(var O=0,k=1;;){var B=_.substring(b-k),V=H.indexOf(B);if(V==-1)return O;k+=V,(V==0||_.substring(b-k)==H.substring(0,k))&&(O=k,k++)}}function u(_,H){if(!_||!H||_.slice(-1)!==H.slice(-1))return 0;for(var v=0,D=Math.min(_.length,H.length),b=D,O=0;v<b;)_.substring(_.length-b,_.length-O)==H.substring(H.length-b,H.length-O)?(v=b,O=v):D=b,b=Math.floor((D-v)/2+v);return se(_.charCodeAt(_.length-b))&&b--,b}function c(_,H){var v=_.length>H.length?_:H,D=_.length>H.length?H:_;if(v.length<4||D.length*2<v.length)return null;function b(Ae,S,F){for(var K=Ae.substring(F,F+Math.floor(Ae.length/4)),q=-1,G="",Y,ue,ae,$;(q=S.indexOf(K,q+1))!==-1;){var te=a(Ae.substring(F),S.substring(q)),oe=u(Ae.substring(0,F),S.substring(0,q));G.length<oe+te&&(G=S.substring(q-oe,q)+S.substring(q,q+te),Y=Ae.substring(0,F-oe),ue=Ae.substring(F+te),ae=S.substring(0,q-oe),$=S.substring(q+te))}return G.length*2>=Ae.length?[Y,ue,ae,$,G]:null}var O=b(v,D,Math.ceil(v.length/4)),k=b(v,D,Math.ceil(v.length/2)),B;if(!O&&!k)return null;k?O?B=O[4].length>k[4].length?O:k:B=k:B=O;var V,ie,de,ge;_.length>H.length?(V=B[0],ie=B[1],de=B[2],ge=B[3]):(de=B[0],ge=B[1],V=B[2],ie=B[3]);var ye=B[4];return[V,ie,de,ge,ye]}function h(_){for(var H=!1,v=[],D=0,b=null,O=0,k=0,B=0,V=0,ie=0;O<_.length;)_[O][0]==n?(v[D++]=O,k=V,B=ie,V=0,ie=0,b=_[O][1]):(_[O][0]==t?V+=_[O][1].length:ie+=_[O][1].length,b&&b.length<=Math.max(k,B)&&b.length<=Math.max(V,ie)&&(_.splice(v[D-1],0,[e,b]),_[v[D-1]+1][0]=t,D--,D--,O=D>0?v[D-1]:-1,k=0,B=0,V=0,ie=0,b=null,H=!0)),O++;for(H&&z(_),N(_),O=1;O<_.length;){if(_[O-1][0]==e&&_[O][0]==t){var de=_[O-1][1],ge=_[O][1],ye=l(de,ge),Ae=l(ge,de);ye>=Ae?(ye>=de.length/2||ye>=ge.length/2)&&(_.splice(O,0,[n,ge.substring(0,ye)]),_[O-1][1]=de.substring(0,de.length-ye),_[O+1][1]=ge.substring(ye),O++):(Ae>=de.length/2||Ae>=ge.length/2)&&(_.splice(O,0,[n,de.substring(0,Ae)]),_[O-1][0]=t,_[O-1][1]=ge.substring(0,ge.length-Ae),_[O+1][0]=e,_[O+1][1]=de.substring(Ae),O++),O++}O++}}var d=/[^a-zA-Z0-9]/,f=/\s/,p=/[\r\n]/,R=/\n\r?\n$/,w=/^\r?\n\r?\n/;function N(_){function H(Ae,S){if(!Ae||!S)return 6;var F=Ae.charAt(Ae.length-1),K=S.charAt(0),q=F.match(d),G=K.match(d),Y=q&&F.match(f),ue=G&&K.match(f),ae=Y&&F.match(p),$=ue&&K.match(p),te=ae&&Ae.match(R),oe=$&&S.match(w);return te||oe?5:ae||$?4:q&&!Y&&ue?3:Y||ue?2:q||G?1:0}for(var v=1;v<_.length-1;){if(_[v-1][0]==n&&_[v+1][0]==n){var D=_[v-1][1],b=_[v][1],O=_[v+1][1],k=u(D,b);if(k){var B=b.substring(b.length-k);D=D.substring(0,D.length-k),b=B+b.substring(0,b.length-k),O=B+O}for(var V=D,ie=b,de=O,ge=H(D,b)+H(b,O);b.charAt(0)===O.charAt(0);){D+=b.charAt(0),b=b.substring(1)+O.charAt(0),O=O.substring(1);var ye=H(D,b)+H(b,O);ye>=ge&&(ge=ye,V=D,ie=b,de=O)}_[v-1][1]!=V&&(V?_[v-1][1]=V:(_.splice(v-1,1),v--),_[v][1]=ie,de?_[v+1][1]=de:(_.splice(v+1,1),v--))}v++}}function z(_,H){_.push([n,""]);for(var v=0,D=0,b=0,O="",k="",B;v<_.length;){if(v<_.length-1&&!_[v][1]){_.splice(v,1);continue}switch(_[v][0]){case t:b++,k+=_[v][1],v++;break;case e:D++,O+=_[v][1],v++;break;case n:var V=v-b-D-1;if(H){if(V>=0&&A(_[V][1])){var ie=_[V][1].slice(-1);if(_[V][1]=_[V][1].slice(0,-1),O=ie+O,k=ie+k,!_[V][1]){_.splice(V,1),v--;var de=V-1;_[de]&&_[de][0]===t&&(b++,k=_[de][1]+k,de--),_[de]&&_[de][0]===e&&(D++,O=_[de][1]+O,de--),V=de}}if(y(_[v][1])){var ie=_[v][1].charAt(0);_[v][1]=_[v][1].slice(1),O+=ie,k+=ie}}if(v<_.length-1&&!_[v][1]){_.splice(v,1);break}if(O.length>0||k.length>0){O.length>0&&k.length>0&&(B=a(k,O),B!==0&&(V>=0?_[V][1]+=k.substring(0,B):(_.splice(0,0,[n,k.substring(0,B)]),v++),k=k.substring(B),O=O.substring(B)),B=u(k,O),B!==0&&(_[v][1]=k.substring(k.length-B)+_[v][1],k=k.substring(0,k.length-B),O=O.substring(0,O.length-B)));var ge=b+D;O.length===0&&k.length===0?(_.splice(v-ge,ge),v=v-ge):O.length===0?(_.splice(v-ge,ge,[t,k]),v=v-ge+1):k.length===0?(_.splice(v-ge,ge,[e,O]),v=v-ge+1):(_.splice(v-ge,ge,[e,O],[t,k]),v=v-ge+2)}v!==0&&_[v-1][0]===n?(_[v-1][1]+=_[v][1],_.splice(v,1)):v++,b=0,D=0,O="",k="";break}}_[_.length-1][1]===""&&_.pop();var ye=!1;for(v=1;v<_.length-1;)_[v-1][0]===n&&_[v+1][0]===n&&(_[v][1].substring(_[v][1].length-_[v-1][1].length)===_[v-1][1]?(_[v][1]=_[v-1][1]+_[v][1].substring(0,_[v][1].length-_[v-1][1].length),_[v+1][1]=_[v-1][1]+_[v+1][1],_.splice(v-1,1),ye=!0):_[v][1].substring(0,_[v+1][1].length)==_[v+1][1]&&(_[v-1][1]+=_[v+1][1],_[v][1]=_[v][1].substring(_[v+1][1].length)+_[v+1][1],_.splice(v+1,1),ye=!0)),v++;ye&&z(_,H)}function W(_){return _>=55296&&_<=56319}function se(_){return _>=56320&&_<=57343}function y(_){return se(_.charCodeAt(0))}function A(_){return W(_.charCodeAt(_.length-1))}function j(_){for(var H=[],v=0;v<_.length;v++)_[v][1].length>0&&H.push(_[v]);return H}function Z(_,H,v,D){return A(_)||y(D)?null:j([[n,_],[e,H],[t,v],[n,D]])}function fe(_,H,v){var D=typeof v=="number"?{index:v,length:0}:v.oldRange,b=typeof v=="number"?null:v.newRange,O=_.length,k=H.length;if(D.length===0&&(b===null||b.length===0)){var B=D.index,V=_.slice(0,B),ie=_.slice(B),de=b?b.index:null;e:{var ge=B+k-O;if(de!==null&&de!==ge||ge<0||ge>k)break e;var ye=H.slice(0,ge),Ae=H.slice(ge);if(Ae!==ie)break e;var S=Math.min(B,ge),F=V.slice(0,S),K=ye.slice(0,S);if(F!==K)break e;var q=V.slice(S),G=ye.slice(S);return Z(F,q,G,ie)}e:{if(de!==null&&de!==B)break e;var Y=B,ye=H.slice(0,Y),Ae=H.slice(Y);if(ye!==V)break e;var ue=Math.min(O-Y,k-Y),ae=ie.slice(ie.length-ue),$=Ae.slice(Ae.length-ue);if(ae!==$)break e;var q=ie.slice(0,ie.length-ue),G=Ae.slice(0,Ae.length-ue);return Z(V,q,G,ae)}}if(D.length>0&&b&&b.length===0)e:{var F=_.slice(0,D.index),ae=_.slice(D.index+D.length),S=F.length,ue=ae.length;if(k<S+ue)break e;var K=H.slice(0,S),$=H.slice(k-ue);if(F!==K||ae!==$)break e;var q=_.slice(S,O-ue),G=H.slice(S,k-ue);return Z(F,q,G,ae)}return null}function le(_,H,v,D){return r(_,H,v,D,!0)}return le.INSERT=t,le.DELETE=e,le.EQUAL=n,_s=le,_s}var s_=r_();const gi=Et(s_),i_=new Set(["true","false"]);function o_(e){return i_.has(e.toLowerCase())}var ps,co;function a_(){if(co)return ps;co=1;var e=function(t){if(t=t||{},this.Promise=t.Promise||Promise,this.queues=Object.create(null),this.domainReentrant=t.domainReentrant||!1,this.domainReentrant){if(typeof process>"u"||typeof process.domain>"u")throw new Error("Domain-reentrant locks require `process.domain` to exist. Please flip `opts.domainReentrant = false`, use a NodeJS version that still implements Domain, or install a browser polyfill.");this.domains=Object.create(null)}this.timeout=t.timeout||e.DEFAULT_TIMEOUT,this.maxOccupationTime=t.maxOccupationTime||e.DEFAULT_MAX_OCCUPATION_TIME,this.maxExecutionTime=t.maxExecutionTime||e.DEFAULT_MAX_EXECUTION_TIME,t.maxPending===1/0||Number.isInteger(t.maxPending)&&t.maxPending>=0?this.maxPending=t.maxPending:this.maxPending=e.DEFAULT_MAX_PENDING};return e.DEFAULT_TIMEOUT=0,e.DEFAULT_MAX_OCCUPATION_TIME=0,e.DEFAULT_MAX_EXECUTION_TIME=0,e.DEFAULT_MAX_PENDING=1e3,e.prototype.acquire=function(t,n,r,s){if(Array.isArray(t))return this._acquireBatch(t,n,r,s);if(typeof n!="function")throw new Error("You must pass a function to execute");var i=null,o=null,a=null;typeof r!="function"&&(s=r,r=null,a=new this.Promise(function(W,se){i=W,o=se})),s=s||{};var l=!1,u=null,c=null,h=null,d=this,f=function(W,se,y){c&&(clearTimeout(c),c=null),h&&(clearTimeout(h),h=null),W&&(d.queues[t]&&d.queues[t].length===0&&delete d.queues[t],d.domainReentrant&&delete d.domains[t]),l||(a?se?o(se):i(y):typeof r=="function"&&r(se,y),l=!0),W&&d.queues[t]&&d.queues[t].length>0&&d.queues[t].shift()()},p=function(W){if(l)return f(W);u&&(clearTimeout(u),u=null),d.domainReentrant&&W&&(d.domains[t]=process.domain);var se=s.maxExecutionTime||d.maxExecutionTime;if(se&&(h=setTimeout(function(){d.queues[t]&&f(W,new Error("Maximum execution time is exceeded "+t))},se)),n.length===1){var y=!1;try{n(function(A,j){y||(y=!0,f(W,A,j))})}catch(A){y||(y=!0,f(W,A))}}else d._promiseTry(function(){return n()}).then(function(A){f(W,void 0,A)},function(A){f(W,A)})};d.domainReentrant&&process.domain&&(p=process.domain.bind(p));var R=s.maxPending||d.maxPending;if(!d.queues[t])d.queues[t]=[],p(!0);else if(d.domainReentrant&&process.domain&&process.domain===d.domains[t])p(!1);else if(d.queues[t].length>=R)f(!1,new Error("Too many pending tasks in queue "+t));else{var w=function(){p(!0)};s.skipQueue?d.queues[t].unshift(w):d.queues[t].push(w);var N=s.timeout||d.timeout;N&&(u=setTimeout(function(){u=null,f(!1,new Error("async-lock timed out in queue "+t))},N))}var z=s.maxOccupationTime||d.maxOccupationTime;if(z&&(c=setTimeout(function(){d.queues[t]&&f(!1,new Error("Maximum occupation time is exceeded in queue "+t))},z)),a)return a},e.prototype._acquireBatch=function(t,n,r,s){typeof r!="function"&&(s=r,r=null);var i=this,o=function(l,u){return function(c){i.acquire(l,u,c,s)}},a=t.reduceRight(function(l,u){return o(u,l)},n);if(typeof r=="function")a(r);else return new this.Promise(function(l,u){a.length===1?a(function(c,h){c?u(c):l(h)}):l(a())})},e.prototype.isBusy=function(t){return t?!!this.queues[t]:Object.keys(this.queues).length>0},e.prototype._promiseTry=function(t){try{return this.Promise.resolve(t())}catch(n){return this.Promise.reject(n)}},ps=e,ps}var Es,ho;function l_(){return ho||(ho=1,Es=a_()),Es}var u_=l_();const c_=Et(u_);function xl(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;const s=Object.prototype.hasOwnProperty.bind(t);for(let i=0;i<n.length;i++){const o=n[i];if(!s(o))return!1;const a=e[o],l=t[o];if(a!==l)return!1}return!0}var Be=(e=>(e[e.UNIVER_UNKNOWN=0]="UNIVER_UNKNOWN",e[e.UNIVER_DOC=1]="UNIVER_DOC",e[e.UNIVER_SHEET=2]="UNIVER_SHEET",e[e.UNIVER_SLIDE=3]="UNIVER_SLIDE",e[e.UNIVER_PROJECT=4]="UNIVER_PROJECT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(Be||{}),Lt=(e=>(e[e.Reader=0]="Reader",e[e.Editor=1]="Editor",e[e.Owner=2]="Owner",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(Lt||{}),Bs=(e=>(e[e.SomeCollaborator=0]="SomeCollaborator",e[e.AllCollaborator=1]="AllCollaborator",e[e.OneSelf=2]="OneSelf",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(Bs||{});class is extends st{}function h_(e=re.generateRandomId(6),t=ir.EN_US,n=""){return{id:e,locale:t,title:n,tableSource:{},drawings:{},drawingsOrder:[],headers:{},footers:{},body:{dataStream:`\r
6
+ `,textRuns:[],customBlocks:[],tables:[],paragraphs:[{startIndex:0,paragraphStyle:{spaceAbove:{v:5},lineSpacing:1,spaceBelow:{v:0}}}],sectionBreaks:[{startIndex:1}]},documentStyle:{pageSize:{width:793.3333333333334,height:1122.6666666666667},documentFlavor:ri.TRADITIONAL,marginTop:50,marginBottom:50,marginRight:50,marginLeft:50,renderConfig:{zeroWidthParagraphBreak:Ie.FALSE,vertexAngle:0,centerAngle:0,background:{rgb:"#ccc"}},autoHyphenation:Ie.TRUE,doNotHyphenateCaps:Ie.FALSE,consecutiveHyphenLimit:2,defaultHeaderId:"",defaultFooterId:"",evenPageHeaderId:"",evenPageFooterId:"",firstPageHeaderId:"",firstPageFooterId:"",evenAndOddHeaders:Ie.FALSE,useFirstPageHeaderFooter:Ie.FALSE,marginHeader:30,marginFooter:30},settings:{}}}var tn={},Pn={},Ir={},fo;function d_(){if(fo)return Ir;fo=1,Object.defineProperty(Ir,"__esModule",{value:!0});function e(r,s){if(Array.isArray(s))return!1;for(let i in r)if(!n(r[i],s[i]))return!1;for(let i in s)if(r[i]===void 0)return!1;return!0}function t(r,s){if(!Array.isArray(s)||r.length!==s.length)return!1;for(let i=0;i<r.length;i++)if(!n(r[i],s[i]))return!1;return!0}function n(r,s){return r===s?!0:r===null||s===null||typeof r!="object"||typeof s!="object"?!1:Array.isArray(r)?t(r,s):e(r,s)}return Ir.default=n,Ir}var Sr={},go;function f_(){if(go)return Sr;go=1,Object.defineProperty(Sr,"__esModule",{value:!0});function e(t){if(t===null)return null;if(Array.isArray(t))return t.map(e);if(typeof t=="object"){const n={};for(let r in t)n[r]=e(t[r]);return n}else return t}return Sr.default=e,Sr}var Cs={},mo;function Ul(){return mo||(mo=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.eachChildOf=e.advancer=e.readCursor=e.writeCursor=e.WriteCursor=e.ReadCursor=e.isValidPathItem=void 0;function t(c,h){if(!c)throw new Error(h)}const n=c=>c!=null&&typeof c=="object"&&!Array.isArray(c),r=(c,h)=>typeof c==typeof h?c>h:typeof c=="string"&&typeof h=="number";function s(c,h){for(let d in c){const f=d;h.write(f,c[f])}}e.isValidPathItem=c=>typeof c=="number"||typeof c=="string"&&c!=="__proto__";class i{constructor(h=null){this.parents=[],this.indexes=[],this.lcIdx=-1,this.idx=-1,this.container=h}ascend(){t(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):(t(this.idx>0),this.idx--,n(this.container[this.idx])&&this.idx--)}getPath(){const h=[];let d=this.container,f=this.parents.length-1,p=this.idx;for(;p>=0;)h.unshift(d[p]),p===0?(p=this.indexes[f*2],d=this.parents[f--]):p-=n(d[p-1])?2:1;return h}}class o extends i{get(){return this.container?this.container.slice(this.idx+1):null}getKey(){return t(this.container!=null,"Invalid call to getKey before cursor descended"),this.container[this.idx]}getComponent(){let h;return this.container&&this.container.length>this.idx+1&&n(h=this.container[this.idx+1])?h:null}descendFirst(){let h=this.idx+1;if(!this.container||h>=this.container.length||n(this.container[h])&&h+1>=this.container.length)return!1;n(this.container[h])&&h++;const d=this.container[h];return Array.isArray(d)?(this.indexes.push(this.idx),this.parents.push(this.container),this.indexes.push(h),this.idx=0,this.container=d):this.idx=h,!0}nextSibling(){if(t(this.parents.length===this.indexes.length/2),this.idx>0||this.parents.length===0)return!1;const h=this.indexes[this.indexes.length-1]+1,d=this.parents[this.parents.length-1];return h>=d.length?!1:(t(!isNaN(h)),this.indexes[this.indexes.length-1]=h,this.container=d[h],!0)}_init(h,d,f,p){this.container=h,this.idx=d,this.parents=f.slice(),this.indexes=p.slice()}clone(){const h=new o;return h._init(this.container,this.idx,this.parents,this.indexes),h}*[Symbol.iterator](){if(this.descendFirst()){do yield this.getKey();while(this.nextSibling());this.ascend()}}traverse(h,d){const f=this.getComponent();f&&d(f,h);for(const p of this)h&&h.descend(p),this.traverse(h,d),h&&h.ascend()}eachPick(h,d){this.traverse(h,(f,p)=>{f.p!=null&&d(f.p,p)})}eachDrop(h,d){this.traverse(h,(f,p)=>{f.d!=null&&d(f.d,p)})}}e.ReadCursor=o;class a extends i{constructor(h=null){super(h),this.pendingDescent=[],this._op=h}flushDescent(){t(this.parents.length===this.indexes.length/2),this.container===null&&(this._op=this.container=[]);for(let h=0;h<this.pendingDescent.length;h++){const d=this.pendingDescent[h];let f=this.idx+1;if(f<this.container.length&&n(this.container[f])&&f++,t(f===this.container.length||!n(this.container[f])),f===this.container.length)this.container.push(d),this.idx=f;else if(this.container[f]===d)this.idx=f;else{if(!Array.isArray(this.container[f])){const p=this.container.splice(f,this.container.length-f);this.container.push(p),this.lcIdx>-1&&(this.lcIdx=f)}for(this.indexes.push(this.idx),this.parents.push(this.container),this.lcIdx!==-1&&(t(r(d,this.container[this.lcIdx][0])),f=this.lcIdx+1,this.lcIdx=-1);f<this.container.length&&r(d,this.container[f][0]);)f++;if(this.indexes.push(f),this.idx=0,f<this.container.length&&this.container[f][0]===d)this.container=this.container[f];else{const p=[d];this.container.splice(f,0,p),this.container=p}}}this.pendingDescent.length=0}reset(){this.lcIdx=-1}getComponent(){this.flushDescent();const h=this.idx+1;if(h<this.container.length&&n(this.container[h]))return this.container[h];{const d={};return this.container.splice(h,0,d),d}}write(h,d){const f=this.getComponent();t(f[h]==null||f[h]===d,"Internal consistency error: Overwritten component. File a bug"),f[h]=d}get(){return this._op}descend(h){if(!e.isValidPathItem(h))throw Error("Invalid JSON key");this.pendingDescent.push(h)}descendPath(h){return this.pendingDescent.push(...h),this}ascend(){this.pendingDescent.length?this.pendingDescent.pop():super.ascend()}mergeTree(h,d=s){if(h===null)return;if(t(Array.isArray(h)),h===this._op)throw Error("Cannot merge into my own tree");const f=this.lcIdx,p=this.parents.length;let R=0;for(let w=0;w<h.length;w++){const N=h[w];typeof N=="string"||typeof N=="number"?(R++,this.descend(N)):Array.isArray(N)?this.mergeTree(N,d):typeof N=="object"&&d(N,this)}for(;R--;)this.ascend();this.lcIdx=this.parents.length===p?f:-1}at(h,d){this.descendPath(h),d(this);for(let f=0;f<h.length;f++)this.ascend();return this}writeAtPath(h,d,f){return this.at(h,()=>this.write(d,f)),this.reset(),this}writeMove(h,d,f=0){return this.writeAtPath(h,"p",f).writeAtPath(d,"d",f)}getPath(){const h=super.getPath();return h.push(...this.pendingDescent),h}}e.WriteCursor=a,e.writeCursor=()=>new a,e.readCursor=c=>new o(c);function l(c,h,d){let f,p;p=f=c?c.descendFirst():!1;function R(w){let N;for(;p;){const z=N=c.getKey();if(w!=null){let W=!1;if(h&&typeof z=="number"&&(N=h(z,c.getComponent()),N<0&&(N=~N,W=!0)),r(N,w))return null;if(N===w&&!W)return c}d&&typeof N=="number"&&d(N,c.getComponent()),p=c.nextSibling()}return null}return R.end=()=>{f&&c.ascend()},R}e.advancer=l;function u(c,h,d){let f,p,R,w;for(f=p=c&&c.descendFirst(),R=w=h&&h.descendFirst();f||R;){let N=f?c.getKey():null,z=R?h.getKey():null;N!==null&&z!==null&&(r(z,N)?z=null:N!==z&&(N=null)),d(N==null?z:N,N!=null?c:null,z!=null?h:null),N!=null&&f&&(f=c.nextSibling()),z!=null&&R&&(R=h.nextSibling())}p&&c.ascend(),w&&h.ascend()}e.eachChildOf=u}(Cs)),Cs}var Rs={},_o;function Pl(){return _o||(_o=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ConflictType=void 0,function(t){t[t.RM_UNEXPECTED_CONTENT=1]="RM_UNEXPECTED_CONTENT",t[t.DROP_COLLISION=2]="DROP_COLLISION",t[t.BLACKHOLE=3]="BLACKHOLE"}(e.ConflictType||(e.ConflictType={}))}(Rs)),Rs}var Ot={},nn={},po;function mi(){return po||(po=1,Object.defineProperty(nn,"__esModule",{value:!0}),nn.uniToStrPos=nn.strPosToUni=void 0,nn.strPosToUni=(e,t=e.length)=>{let n=0,r=0;for(;r<t;r++){const s=e.charCodeAt(r);s>=55296&&s<=57343&&(n++,r++)}if(r!==t)throw Error("Invalid offset - splits unicode bytes");return r-n},nn.uniToStrPos=(e,t)=>{let n=0;for(;t>0;t--){const r=e.charCodeAt(n);n+=r>=55296&&r<=57343?2:1}return n}),nn}var Is={},Eo;function $s(){return Eo||(Eo=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.uniSlice=e.dlen=e.eachOp=void 0;const t=mi(),n=y=>{if(!Array.isArray(y))throw Error("Op must be an array of components");let A=null;for(let j=0;j<y.length;j++){const Z=y[j];switch(typeof Z){case"object":if(typeof Z.d!="number"&&typeof Z.d!="string")throw Error("Delete must be number or string");if(e.dlen(Z.d)<=0)throw Error("Deletes must not be empty");break;case"string":if(!(Z.length>0))throw Error("Inserts cannot be empty");break;case"number":if(!(Z>0))throw Error("Skip components must be >0");if(typeof A=="number")throw Error("Adjacent skip components should be combined");break}A=Z}if(typeof A=="number")throw Error("Op has a trailing skip")};function r(y,A){let j=0,Z=0;for(let fe=0;fe<y.length;fe++){const le=y[fe];switch(A(le,j,Z),typeof le){case"object":j+=e.dlen(le.d);break;case"string":Z+=t.strPosToUni(le);break;case"number":j+=le,Z+=le;break}}}e.eachOp=r;function s(y,A){const j=[],Z=a(j);return r(y,(fe,le,_)=>{Z(A(fe,le,_))}),h(j)}const i=y=>y,o=y=>s(y,i);e.dlen=y=>typeof y=="number"?y:t.strPosToUni(y);const a=y=>A=>{if(!(!A||A.d===0||A.d===""))if(y.length===0)y.push(A);else if(typeof A==typeof y[y.length-1])if(typeof A=="object"){const j=y[y.length-1];j.d=typeof j.d=="string"&&typeof A.d=="string"?j.d+A.d:e.dlen(j.d)+e.dlen(A.d)}else y[y.length-1]+=A;else y.push(A)},l=y=>typeof y=="number"?y:typeof y=="string"?t.strPosToUni(y):typeof y.d=="number"?y.d:t.strPosToUni(y.d);e.uniSlice=(y,A,j)=>{const Z=t.uniToStrPos(y,A),fe=j==null?1/0:t.uniToStrPos(y,j);return y.slice(Z,fe)};const u=(y,A,j)=>typeof y=="number"?j==null?y-A:Math.min(y,j)-A:e.uniSlice(y,A,j),c=y=>{let A=0,j=0;return{take:(le,_)=>{if(A===y.length)return le===-1?null:le;const H=y[A];let v;if(typeof H=="number")return le===-1||H-j<=le?(v=H-j,++A,j=0,v):(j+=le,le);if(typeof H=="string"){if(le===-1||_==="i"||t.strPosToUni(H.slice(j))<=le)return v=H.slice(j),++A,j=0,v;{const D=j+t.uniToStrPos(H.slice(j),le);return v=H.slice(j,D),j=D,v}}else{if(le===-1||_==="d"||e.dlen(H.d)-j<=le)return v={d:u(H.d,j)},++A,j=0,v;{let D=u(H.d,j,j+le);return j+=le,{d:D}}}},peek:()=>y[A]}},h=y=>(y.length>0&&typeof y[y.length-1]=="number"&&y.pop(),y);function d(y,A,j){if(j!=="left"&&j!=="right")throw Error("side ("+j+") must be 'left' or 'right'");n(y),n(A);const Z=[],fe=a(Z),{take:le,peek:_}=c(y);for(let v=0;v<A.length;v++){const D=A[v];let b,O;switch(typeof D){case"number":for(b=D;b>0;)O=le(b,"i"),fe(O),typeof O!="string"&&(b-=l(O));break;case"string":j==="left"&&typeof _()=="string"&&fe(le(-1)),fe(t.strPosToUni(D));break;case"object":for(b=e.dlen(D.d);b>0;)switch(O=le(b,"i"),typeof O){case"number":b-=O;break;case"string":fe(O);break;case"object":b-=e.dlen(O.d)}break}}let H;for(;H=le(-1);)fe(H);return h(Z)}function f(y,A){n(y),n(A);const j=[],Z=a(j),{take:fe}=c(y);for(let _=0;_<A.length;_++){const H=A[_];let v,D;switch(typeof H){case"number":for(v=H;v>0;)D=fe(v,"d"),Z(D),typeof D!="object"&&(v-=l(D));break;case"string":Z(H);break;case"object":v=e.dlen(H.d);let b=0;for(;b<v;)switch(D=fe(v-b,"d"),typeof D){case"number":Z({d:u(H.d,b,b+D)}),b+=D;break;case"string":b+=t.strPosToUni(D);break;case"object":Z(D)}break}}let le;for(;le=fe(-1);)Z(le);return h(j)}const p=(y,A)=>{let j=0;for(let Z=0;Z<A.length&&y>j;Z++){const fe=A[Z];switch(typeof fe){case"number":{j+=fe;break}case"string":const le=t.strPosToUni(fe);j+=le,y+=le;break;case"object":y-=Math.min(e.dlen(fe.d),y-j);break}}return y},R=(y,A)=>typeof y=="number"?p(y,A):y.map(j=>p(j,A));function w(y,A,j){return s(y,(Z,fe)=>typeof Z=="object"&&typeof Z.d=="number"?{d:j.slice(A,fe,fe+Z.d)}:Z)}function N(y){return s(y,A=>{switch(typeof A){case"object":if(typeof A.d=="number")throw Error("Cannot invert text op: Deleted characters missing from operation. makeInvertible must be called first.");return A.d;case"string":return{d:A};case"number":return A}})}function z(y){return s(y,A=>typeof A=="object"&&typeof A.d=="string"?{d:t.strPosToUni(A.d)}:A)}function W(y){let A=!0;return r(y,j=>{typeof j=="object"&&typeof j.d=="number"&&(A=!1)}),A}function se(y){return{name:"text-unicode",uri:"http://sharejs.org/types/text-unicode",trim:h,normalize:o,checkOp:n,create(A=""){if(typeof A!="string")throw Error("Initial data must be a string");return y.create(A)},apply(A,j){n(j);const Z=y.builder(A);for(let fe=0;fe<j.length;fe++){const le=j[fe];switch(typeof le){case"number":Z.skip(le);break;case"string":Z.append(le);break;case"object":Z.del(e.dlen(le.d));break}}return Z.build()},transform:d,compose:f,transformPosition:p,transformSelection:R,isInvertible:W,makeInvertible(A,j){return w(A,j,y)},stripInvertible:z,invert:N,invertWithDoc(A,j){return N(w(A,j,y))},isNoop:A=>A.length===0}}e.default=se}(Is)),Is}var vr={},Co;function g_(){if(Co)return vr;Co=1,Object.defineProperty(vr,"__esModule",{value:!0});const e=$s(),t=mi();function n(r,s){return{get:r,getLength(){return r().length},insert(i,o,a){const l=t.strPosToUni(r(),i);return s([l,o],a)},remove(i,o,a){const l=t.strPosToUni(r(),i);return s([l,{d:o}],a)},_onOp(i){e.eachOp(i,(o,a,l)=>{switch(typeof o){case"string":this.onInsert&&this.onInsert(l,o);break;case"object":const u=e.dlen(o.d);this.onRemove&&this.onRemove(l,u)}})},onInsert:null,onRemove:null}}return vr.default=n,n.provides={text:!0},vr}var Ro;function m_(){return Ro||(Ro=1,function(e){var t=Ot&&Ot.__createBinding||(Object.create?function(d,f,p,R){R===void 0&&(R=p),Object.defineProperty(d,R,{enumerable:!0,get:function(){return f[p]}})}:function(d,f,p,R){R===void 0&&(R=p),d[R]=f[p]}),n=Ot&&Ot.__setModuleDefault||(Object.create?function(d,f){Object.defineProperty(d,"default",{enumerable:!0,value:f})}:function(d,f){d.default=f}),r=Ot&&Ot.__importStar||function(d){if(d&&d.__esModule)return d;var f={};if(d!=null)for(var p in d)Object.hasOwnProperty.call(d,p)&&t(f,d,p);return n(f,d),f},s=Ot&&Ot.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(e,"__esModule",{value:!0}),e.type=e.remove=e.insert=void 0;const i=mi(),o=r($s()),a=s(g_()),l={create(d){return d},toString(d){return d},builder(d){if(typeof d!="string")throw Error("Invalid document snapshot: "+d);const f=[];return{skip(p){let R=i.uniToStrPos(d,p);if(R>d.length)throw Error("The op is too long for this document");f.push(d.slice(0,R)),d=d.slice(R)},append(p){f.push(p)},del(p){d=d.slice(i.uniToStrPos(d,p))},build(){return f.join("")+d}}},slice:o.uniSlice},u=o.default(l),c=Object.assign(Object.assign({},u),{api:a.default});e.type=c,e.insert=(d,f)=>f.length===0?[]:d===0?[f]:[d,f],e.remove=(d,f)=>o.dlen(f)===0?[]:d===0?[{d:f}]:[d,{d:f}];var h=$s();Object.defineProperty(e,"makeType",{enumerable:!0,get:function(){return h.default}})}(Ot)),Ot}var Io;function __(){return Io||(Io=1,function(e){var t=Pn&&Pn.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(e,"__esModule",{value:!0}),e.editOp=e.replaceOp=e.insertOp=e.moveOp=e.removeOp=e.type=void 0;const n=t(d_()),r=t(f_()),s=Ul(),i=Pl();function o(S,F){if(!S)throw new Error(F)}e.type={name:"json1",uri:"http://sharejs.org/types/JSONv1",readCursor:s.readCursor,writeCursor:s.writeCursor,create:S=>S,isNoop:S=>S==null,setDebug(S){},registerSubtype:N,checkValidOp:fe,normalize:le,apply:_,transformPosition:H,compose:v,tryTransform:V,transform:de,makeInvertible:O,invert:D,invertWithDoc:k,RM_UNEXPECTED_CONTENT:i.ConflictType.RM_UNEXPECTED_CONTENT,DROP_COLLISION:i.ConflictType.DROP_COLLISION,BLACKHOLE:i.ConflictType.BLACKHOLE,transformNoConflict:(S,F,K)=>Ae(()=>!0,S,F,K),typeAllowingConflictsPred:S=>Object.assign(Object.assign({},e.type),{transform:(F,K,q)=>Ae(S,F,K,q)})};const a=S=>S?S.getComponent():null;function l(S){return S&&typeof S=="object"&&!Array.isArray(S)}const u=S=>Array.isArray(S)?S.slice():S!==null&&typeof S=="object"?Object.assign({},S):S,c=S=>S&&(S.p!=null||S.r!==void 0),h=S=>S&&(S.d!=null||S.i!==void 0);function d(S,F){return o(S!=null),typeof F=="number"?(o(Array.isArray(S),"Invalid key - child is not an array"),(S=S.slice()).splice(F,1)):(o(l(S),"Invalid key - child is not an object"),delete(S=Object.assign({},S))[F]),S}function f(S,F,K){return typeof F=="number"?(o(S!=null,"Container is missing for key"),o(Array.isArray(S),"Cannot use numerical key for object container"),o(S.length>=F,"Cannot insert into out of bounds index"),S.splice(F,0,K)):(o(l(S),"Cannot insert into missing item"),o(S[F]===void 0,"Trying to overwrite value at key. Your op needs to remove it first"),S[F]=K),K}e.removeOp=(S,F=!0)=>s.writeCursor().writeAtPath(S,"r",F).get(),e.moveOp=(S,F)=>s.writeCursor().writeMove(S,F).get(),e.insertOp=(S,F)=>s.writeCursor().writeAtPath(S,"i",F).get(),e.replaceOp=(S,F,K)=>s.writeCursor().at(S,q=>{q.write("r",F),q.write("i",K)}).get(),e.editOp=(S,F,K,q=!1)=>s.writeCursor().at(S,G=>A(G,F,K,q)).get();const p=(S,F)=>S!=null&&(typeof F=="number"?Array.isArray(S):typeof S=="object"),R=(S,F)=>p(S,F)?S[F]:void 0,w={};function N(S){let F=S.type?S.type:S;F.name&&(w[F.name]=F),F.uri&&(w[F.uri]=F)}const z=S=>{const F=w[S];if(F)return F;throw Error("Missing type: "+S)};N(m_());const W=(S,F)=>S+F;N({name:"number",apply:W,compose:W,invert:S=>-S,transform:S=>S});const se=S=>S==null?null:S.et?z(S.et):S.es?w["text-unicode"]:S.ena!=null?w.number:null,y=S=>S.es?S.es:S.ena!=null?S.ena:S.e,A=(S,F,K,q=!1)=>{const[G,Y]=typeof F=="string"?[z(F),F]:[F,F.name];!q&&G.isNoop&&G.isNoop(K)||(Y==="number"?S.write("ena",K):Y==="text-unicode"?S.write("es",K):(S.write("et",Y),S.write("e",K)))};function j(S){o(typeof S=="number"),o(S>=0),o(S===(0|S))}function Z(S){typeof S=="number"?j(S):o(typeof S=="string")}function fe(S){if(S===null)return;const F=new Set,K=new Set,q=Y=>{let ue=!0,ae=!1;for(let $ in Y){const te=Y[$];if(ue=!1,o($==="p"||$==="r"||$==="d"||$==="i"||$==="e"||$==="es"||$==="ena"||$==="et","Invalid component item '"+$+"'"),$==="p")j(te),o(!F.has(te)),F.add(te),o(Y.r===void 0);else if($==="d")j(te),o(!K.has(te)),K.add(te),o(Y.i===void 0);else if($==="e"||$==="es"||$==="ena"){o(!ae),ae=!0;const oe=se(Y);o(oe,"Missing type in edit"),oe.checkValidOp&&oe.checkValidOp(y(Y))}}o(!ue)},G=(Y,ue,ae)=>{if(!Array.isArray(Y))throw Error("Op must be null or a list");if(Y.length===0)throw Error("Empty descent");ue||Z(Y[0]);let $=1,te=0,oe=0;for(let me=0;me<Y.length;me++){const be=Y[me];if(o(be!=null),Array.isArray(be)){const De=G(be,!1);if(te){const X=typeof oe,Re=typeof De;X===Re?o(oe<De,"descent keys are not in order"):o(X==="number"&&Re==="string")}oe=De,te++,$=3}else typeof be=="object"?(o($===1,`Prev not scalar - instead ${$}`),q(be),$=2):(o($!==3),Z(be),o(s.isValidPathItem(be),"Invalid path key"),$=1)}return o(te!==1,"Operation makes multiple descents. Remove some []"),o($===2||$===3),Y[0]};G(S,!0),o(F.size===K.size,"Mismatched picks and drops in op");for(let Y=0;Y<F.size;Y++)o(F.has(Y)),o(K.has(Y))}function le(S){let F=0,K=[];const q=s.writeCursor();return q.mergeTree(S,(G,Y)=>{const ue=se(G);if(ue){const $=y(G);A(Y,ue,ue.normalize?ue.normalize($):$)}for(const $ of["r","p","i","d"])if(G[$]!==void 0){const te=$==="p"||$==="d"?(ae=G[$],K[ae]==null&&(K[ae]=F++),K[ae]):G[$];Y.write($,te)}var ae}),q.get()}function _(S,F){if(fe(F),F===null)return S;const K=[];return function q(G,Y){let ue=G,ae=0,$={root:G},te=0,oe=$,me="root";function be(){for(;te<ae;te++){let De=Y[te];typeof De!="object"&&(o(p(oe,me)),oe=oe[me]=u(oe[me]),me=De)}}for(;ae<Y.length;ae++){const De=Y[ae];if(Array.isArray(De)){const X=q(ue,De);X!==ue&&X!==void 0&&(be(),ue=oe[me]=X)}else if(typeof De=="object"){De.d!=null?(be(),ue=f(oe,me,K[De.d])):De.i!==void 0&&(be(),ue=f(oe,me,De.i));const X=se(De);if(X)be(),ue=oe[me]=X.apply(ue,y(De));else if(De.e!==void 0)throw Error("Subtype "+De.et+" undefined")}else ue=R(ue,De)}return $.root}(S=function q(G,Y){const ue=[];let ae=0;for(;ae<Y.length;ae++){const me=Y[ae];if(Array.isArray(me))break;typeof me!="object"&&(ue.push(G),G=R(G,me))}for(let me=Y.length-1;me>=ae;me--)G=q(G,Y[me]);for(--ae;ae>=0;ae--){const me=Y[ae];if(typeof me!="object"){const be=ue.pop();G=G===R(be,me)?be:G===void 0?d(be,me):(te=me,oe=G,($=u($=be))[te]=oe,$)}else c(me)&&(o(G!==void 0,"Cannot pick up or remove undefined"),me.p!=null&&(K[me.p]=G),G=void 0)}var $,te,oe;return G}(S,F),F)}function H(S,F){S=S.slice(),fe(F);const K=s.readCursor(F);let q,G,Y=!1;const ue=[];for(let $=0;;$++){const te=S[$],oe=K.getComponent();if(oe&&(oe.r!==void 0?Y=!0:oe.p!=null&&(Y=!1,q=oe.p,G=$)),$>=S.length)break;let me=0;const be=s.advancer(K,void 0,(X,Re)=>{c(Re)&&me++});ue.unshift(be);const De=be(te);if(typeof te=="number"&&(S[$]-=me),!De)break}if(ue.forEach($=>$.end()),Y)return null;const ae=()=>{let $=0;if(q!=null){const te=K.getPath();$=te.length,S=te.concat(S.slice(G))}for(;$<S.length;$++){const te=S[$],oe=a(K),me=se(oe);if(me){const X=y(oe);me.transformPosition&&(S[$]=me.transformPosition(S[$],X));break}let be=0;const De=s.advancer(K,(X,Re)=>h(Re)?~(X-be):X-be,(X,Re)=>{h(Re)&&be++})(te);if(typeof te=="number"&&(S[$]+=be),!De)break}};return q!=null?K.eachDrop(null,$=>{$===q&&ae()}):ae(),S}function v(S,F){if(fe(S),fe(F),S==null)return F;if(F==null)return S;let K=0;const q=s.readCursor(S),G=s.readCursor(F),Y=s.writeCursor(),ue=[],ae=[],$=[],te=[],oe=[],me=[],be=new Set;q.traverse(null,X=>{X.p!=null&&($[X.p]=q.clone())}),G.traverse(null,X=>{X.d!=null&&(te[X.d]=G.clone())});const De=s.writeCursor();return function X(Re,Ge,He,Ue,qe,Ct,ze,et){o(Ge||He);const Ve=a(Ge),ct=a(He),at=!!ct&&ct.r!==void 0,Ut=!!Ve&&Ve.i!==void 0,Fe=Ve?Ve.d:null,ht=ct?ct.p:null,E=(Ct||at)&&ht==null;if(ht!=null)Ue=te[ht],ze=ae[ht]=new s.WriteCursor;else if(ct&&ct.r!==void 0)Ue=null;else{const L=a(Ue);L&&L.d!=null&&(Ue=null)}const g=a(Ue);if(Fe!=null)if(Re=$[Fe],et=ue[Fe]=new s.WriteCursor,E)Ct&&!at&&et.write("r",!0);else{const L=oe[Fe]=K++;ze.write("d",L)}else if(Ve&&Ve.i!==void 0)Re=null;else{const L=a(Re);L&&L.p!=null&&(Re=null)}let m;Ut?(o(qe===void 0),m=Ve.i):m=qe;const T=(ht==null?!Ut||Ct||at:m===void 0)?null:ze.getComponent();if(ht!=null){if(!(qe!==void 0||Ut)){const L=Fe!=null?oe[Fe]:K++;me[ht]=L,et.write("p",L)}}else at&&(Ut||qe!==void 0||(ct.r,et.write("r",ct.r)));const M=E?null:se(Ve),U=se(g);if((M||U)&&(M&&M.name,U&&U.name),M&&U){o(M===U);const L=y(Ve),ee=y(g),Ce=M.compose(L,ee);A(ze,M,Ce),be.add(g)}else M?A(ze,M,y(Ve)):U&&(A(ze,U,y(g)),be.add(g));const x=typeof m=="object"&&m!=null;let P=!1,I=0,Q=0,pe=0,J=0,_e=0;const we=s.advancer(Ue,(L,ee)=>h(ee)?J-L-1:L-J,(L,ee)=>{h(ee)&&J++}),ce=s.advancer(Re,(L,ee)=>c(ee)?I-L-1:L-I,(L,ee)=>{c(ee)&&I++});if(s.eachChildOf(Ge,He,(L,ee,Ce)=>{let Te,Pe,ke=L,We=L,dt=L;if(typeof L=="number"){let Me=L+pe;Pe=we(Me),We=Me+J;let ne=L+Q;Te=ce(ne),h(a(Pe))&&(Te=null),ke=ne+I,dt=L+_e,o(ke>=0,"p1PickKey is negative"),o(We>=0,"p2DropKey is negative");const lt=h(a(ee)),$e=c(a(Ce));(lt||$e&&!E)&&_e--,lt&&Q--,$e&&pe--}else Te=ce(L),Pe=we(L);et.descend(ke),ze.descend(We);const gt=x&&!h(a(ee))?m[dt]:void 0,Ee=X(Te,ee,Ce,Pe,gt,E,ze,et);var Qe,ve,Se;x&&!E?gt!==Ee&&(P||(m=Array.isArray(m)?m.slice():Object.assign({},m),P=!0),Qe=m,Se=Ee,typeof(ve=dt)=="number"?(o(Array.isArray(Qe)),o(ve<Qe.length)):(o(!Array.isArray(Qe)),o(Qe[ve]!==void 0)),Se===void 0?typeof ve=="number"?Qe.splice(ve,1):delete Qe[ve]:Qe[ve]=Se):o(Ee===void 0),ze.ascend(),et.ascend()}),ce.end(),we.end(),T!=null)T.i=m;else if(!Ct&&!at&&ht==null)return m}(q,q.clone(),G,G.clone(),void 0,!1,Y,De),Y.reset(),Y.mergeTree(De.get()),Y.reset(),Y.get(),ue.map(X=>X.get()),ae.map(X=>X.get()),q.traverse(Y,(X,Re)=>{const Ge=X.p;if(Ge!=null){const He=oe[Ge];He!=null&&Re.write("p",He);const Ue=ue[Ge];Ue&&Ue.get(),Ue&&Re.mergeTree(Ue.get())}else X.r!==void 0&&Re.write("r",X.r)}),Y.reset(),Y.get(),G.traverse(Y,(X,Re)=>{const Ge=X.d;if(Ge!=null){const Ue=me[Ge];Ue!=null&&Re.write("d",Ue);const qe=ae[Ge];qe&&Re.mergeTree(qe.get())}else X.i!==void 0&&Re.write("i",X.i);const He=se(X);He&&!be.has(X)&&A(Re,He,y(X))}),Y.get()}function D(S){if(S==null)return null;const F=new s.ReadCursor(S),K=new s.WriteCursor;let q;const G=[],Y=[];return function ue(ae,$,te){const oe=ae.getComponent();let me,be=!1;if(oe){oe.p!=null&&($.write("d",oe.p),G[oe.p]=ae.clone()),oe.r!==void 0&&$.write("i",oe.r),oe.d!=null&&($.write("p",oe.d),te=void 0),oe.i!==void 0&&(te=me=oe.i);const X=se(oe);X&&(te===void 0?(q||(q=new Set),q.add(oe)):(y(oe),te=X.apply(te,y(oe)),be=!0))}let De=0;for(const X of ae){$.descend(X);const Re=typeof X=="number"?X-De:X,Ge=R(te,Re);h(ae.getComponent())&&De++;const He=ue(ae,$,Ge);if(te!==void 0&&He!==void 0){if(be||(be=!0,te=u(te)),!p(te,Re))throw Error("Cannot modify child - invalid operation");te[Re]=He}$.ascend()}if(me===void 0)return be?te:void 0;$.write("r",te)}(F,K,void 0),q&&(K.reset(),function ue(ae,$,te){const oe=$.getComponent();if(oe){const X=oe.d;if(X!=null&&(ae=G[X],te=Y[X]=s.writeCursor()),q.has(oe)){const Re=se(oe);if(!Re.invert)throw Error(`Cannot invert subtype ${Re.name}`);A(te,Re,Re.invert(y(oe)))}}let me=0,be=0;const De=s.advancer(ae,(X,Re)=>c(Re)?me-X-1:X-me,(X,Re)=>{c(Re)&&me++});for(const X of $)if(typeof X=="number"){const Re=X-be,Ge=De(Re),He=Re+me;te.descend(He),ue(Ge,$,te),h($.getComponent())&&be++,te.ascend()}else te.descend(X),ue(De(X),$,te),te.ascend();De.end()}(F.clone(),F,K),Y.length&&(K.reset(),F.traverse(K,(ue,ae)=>{const $=ue.p;if($!=null){const te=Y[$];te&&te.get(),te&&ae.mergeTree(te.get())}}))),K.get()}const b=(S,F)=>S.some(K=>typeof K=="object"&&(Array.isArray(K)?b(K,F):F(K)));function O(S,F){if(S==null||!b(S,$=>{var te;return $.r!==void 0||((te=se($))===null||te===void 0?void 0:te.makeInvertible)!=null}))return S;const K=new s.ReadCursor(S),q=new s.WriteCursor;let G=!1;const Y=[],ue=[],ae=($,te,oe)=>{const me=$.getComponent();let be=!1;if(me){me.d!=null&&te.write("d",me.d),me.i!==void 0&&te.write("i",me.i);const X=me.p;if(X!=null&&(Y[X]=$.clone(),o(oe!==void 0,"Operation picks up at an invalid key"),ue[X]=oe,te.write("p",me.p)),me.r!==void 0&&oe===void 0)throw Error("Invalid doc / op in makeInvertible: removed item missing from doc");const Re=se(me);Re&&(Re.makeInvertible?G=!0:A(te,Re,y(me),!0))}let De=0;for(const X of $){te.descend(X);const Re=typeof X=="number"?X-De:X,Ge=R(oe,Re),He=ae($,te,Ge);Ge!==He&&(be||(be=!0,oe=u(oe)),He===void 0?(oe=d(oe,Re),typeof X=="number"&&De++):oe[Re]=He),te.ascend()}return me&&(me.r!==void 0?(te.write("r",r.default(oe)),oe=void 0):me.p!=null&&(oe=void 0)),oe};return ae(K,q,F),q.get(),G&&(q.reset(),function $(te,oe,me,be,De){const X=oe.getComponent();if(X){X.i!==void 0?(be=X.i,De=!0):X.d!=null&&(be=ue[X.d],te=Y[X.d],De=!1,X.d);let Ue=se(X);if(Ue&&Ue.makeInvertible){const qe=y(X);A(me,Ue,Ue.makeInvertible(qe,be),!0)}}let Re=0,Ge=0;const He=s.advancer(te,(Ue,qe)=>c(qe)?Re-Ue-1:Ue-Re,(Ue,qe)=>{c(qe)&&Re++});for(const Ue of oe)if(typeof Ue=="number"){const qe=Ue-Ge,Ct=He(qe),ze=qe+Re,et=R(be,De?qe:ze);me.descend(Ue),$(Ct,oe,me,et,De),h(oe.getComponent())&&Ge++,me.ascend()}else{const qe=R(be,Ue);me.descend(Ue),$(He(Ue),oe,me,qe,De),me.ascend()}He.end()}(K.clone(),K,q,F,!1)),q.get()}function k(S,F){return D(O(S,F))}const B=S=>{if(S==null)return null;const F=S.slice();for(let K=0;K<S.length;K++){const q=F[K];Array.isArray(q)&&(F[K]=B(q))}return F};function V(S,F,K){o(K==="left"||K==="right","Direction must be left or right");const q=K==="left"?0:1;if(F==null)return{ok:!0,result:S};fe(S),fe(F);let G=null;const Y=[],ue=[],ae=[],$=[],te=[],oe=[],me=[],be=[],De=[],X=[],Re=[],Ge=[],He=[],Ue=[],qe=[];let Ct=0;const ze=s.readCursor(S),et=s.readCursor(F),Ve=s.writeCursor();if(function g(m,T=null,M){const U=a(T);U&&(U.r!==void 0?M=T.clone():U.p!=null&&(M=null,oe[U.p]=m.clone()));const x=m.getComponent();let P;x&&(P=x.p)!=null&&(te[P]=T?T.clone():null,ae[P]=m.clone(),M&&(X[P]=!0,De[P]=M),U&&U.p!=null&&(Ue[P]=U.p));const I=s.advancer(T);for(const Q of m)g(m,I(Q),M);I.end()}(et,ze,null),function g(m,T,M,U,x){const P=M.getComponent();let I,Q=!1;P&&((I=P.d)!=null?($[I]=M.clone(),U!=null&&(qe[U]==null&&(qe[U]=[]),qe[U].push(I)),X[I],m=te[I]||null,T=ae[I]||null,X[I]?(x&&(Re[I]=!0),x=De[I]||null):!x||q!==1&&Ue[I]!=null||G==null&&(G={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(x.getPath()),op2:e.moveOp(T.getPath(),M.getPath())}),Q=!0):P.i!==void 0&&(m=T=null,Q=!0,x&&G==null&&(G={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(x.getPath()),op2:e.insertOp(M.getPath(),P.i)})));const pe=a(m);pe&&(pe.r!==void 0?x=m.clone():pe.p!=null&&(pe.p,U=pe.p,x=null));const J=se(P);J&&x&&G==null&&(G={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(x.getPath()),op2:e.editOp(M.getPath(),J,y(P),!0)});let _e=0,we=0;const ce=s.advancer(T,(ee,Ce)=>c(Ce)?_e-ee-1:ee-_e,(ee,Ce)=>{c(Ce)&&_e++}),L=s.advancer(m);for(const ee of M)if(typeof ee=="number"){const Ce=ee-we,Te=ce(Ce);we+=+g(L(Ce+_e),Te,M,U,x)}else{const Ce=ce(ee);g(L(ee),Ce,M,U,x)}return ce.end(),L.end(),Q}(ze,et,et.clone(),null,null),$.map(g=>g&&g.get()),G)return{ok:!1,conflict:G};Re.map(g=>!!g);const ct=[];let at=null;(function g(m,T,M,U,x){let P=!1;const I=a(T);if(c(I)){const ce=I.p;ce!=null?(M=$[ce],U=Ge[ce]=s.writeCursor(),P=!0,x=null):(M=null,x=T.clone())}else h(a(M))&&(M=null);const Q=m.getComponent();if(Q){const ce=Q.p;ce!=null?(x&&(be[ce]=x),ct[ce]=x||q===1&&P?null:U.getComponent(),Y[ce]=m.clone(),M&&(me[ce]=M.clone())):Q.r!==void 0&&(x||U.write("r",!0),(x||P)&&(at==null&&(at=new Set),at.add(Q)))}let pe=0,J=0;const _e=s.advancer(T,void 0,(ce,L)=>{c(L)&&pe++}),we=s.advancer(M,(ce,L)=>h(L)?~(ce-J):ce-J,(ce,L)=>{h(L)&&J++});if(m)for(const ce of m)if(typeof ce=="string"){const L=_e(ce),ee=we(ce);U.descend(ce),g(m,L,ee,U,x),U.ascend()}else{const L=_e(ce),ee=ce-pe,Ce=c(a(L))?null:we(ee),Te=ee+J;o(Te>=0),U.descend(Te),g(m,L,Ce,U,x),U.ascend()}_e.end(),we.end()})(ze,et,et.clone(),Ve,null),Ve.reset();let Ut=[];if(function g(m,T,M,U,x,P){o(T);const I=T.getComponent();let Q=a(U),pe=!1;const J=(ve,Se,Me)=>ve?e.moveOp(ve.getPath(),Se.getPath()):e.insertOp(Se.getPath(),Me.i);if(h(I)){const ve=I.d;ve!=null&&(ue[ve]=T.clone());const Se=ve!=null?ct[ve]:null;let Me=!1;if(I.i!==void 0||ve!=null&&Se){let ne;Q&&(Q.i!==void 0||(ne=Q.d)!=null&&!X[ne])&&(Me=ne!=null?ve!=null&&ve===Ue[ne]:n.default(Q.i,I.i),Me||ne!=null&&q!==1&&Ue[ne]!=null||G==null&&(G={type:i.ConflictType.DROP_COLLISION,op1:J(ve!=null?Y[ve]:null,T,I),op2:J(ne!=null?ae[ne]:null,U,Q)})),Me||(P?G==null&&(G={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:J(ve!=null?Y[ve]:null,T,I),op2:e.removeOp(P.getPath())}):(ve!=null?(Ut[Ct]=ve,x.write("d",Se.p=Ct++)):x.write("i",r.default(I.i)),pe=!0))}else if(ve!=null&&!Se){const ne=be[ve];ne&&(P=ne.clone())}ve!=null?(m=Y[ve],M=oe[ve],U=me[ve]):I.i!==void 0&&(m=M=null,Me||(U=null))}else c(a(m))&&(m=M=U=null);const _e=a(m),we=a(M);if(c(we)){const ve=we.p;we.r!==void 0&&(!_e||_e.r===void 0)||X[ve]?(U=null,P=M.clone()):ve!=null&&(U=$[ve],q!==1&&Ue[ve]!=null||((x=He[ve])||(x=He[ve]=s.writeCursor()),x.reset(),P=null))}else!h(I)&&h(Q)&&(U=null);Q=U!=null?U.getComponent():null;const ce=se(I);if(ce){const ve=y(I);if(P)G==null&&(G={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.editOp(T.getPath(),ce,ve,!0),op2:e.removeOp(P.getPath())});else{const Se=se(Q);let Me;if(Se){if(ce!==Se)throw Error("Transforming incompatible types");const ne=y(Q);Me=ce.transform(ve,ne,K)}else Me=r.default(ve);A(x,ce,Me)}}let L=0,ee=0,Ce=0,Te=0,Pe=0,ke=0,We=m!=null&&m.descendFirst(),dt=We;const gt=s.advancer(M,void 0,(ve,Se)=>{c(Se)&&Ce++});let Ee=U!=null&&U.descendFirst(),Qe=Ee;for(const ve of T)if(typeof ve=="number"){let Se;const Me=h(T.getComponent()),ne=ve-ee;{let jt;for(;We&&typeof(jt=m.getKey())=="number";){jt+=L;const vt=m.getComponent(),fn=c(vt);if(jt>ne||jt===ne&&(!fn||q===0&&Me))break;if(fn){L--;const en=vt.p;Ue.includes(en),vt.d,a(He[vt.d]),c(a(He[vt.d])),(vt.r===void 0||at&&at.has(vt))&&(en==null||!ct[en]||q!==1&&Ue.includes(en))||Pe--}We=m.nextSibling()}Se=We&&jt===ne?m:null}const lt=ne-L;let $e=gt(lt);const Mt=lt-Ce;let gr=null;{let jt,vt;for(;Ee&&typeof(jt=U.getKey())=="number";){vt=jt-Te;const fn=U.getComponent(),en=h(fn);if(vt>Mt)break;if(vt===Mt){if(!en){gr=U;break}{if(q===0&&Me){gr=U;break}const Wt=$e&&c($e.getComponent());if(q===0&&Wt)break}}if(en){const Wt=fn.d;X[Wt],Ue[Wt],fn.i===void 0&&(X[Wt]||Ue[Wt]!=null&&q!==1)?(X[Wt]||Ue[Wt]!=null&&q===0)&&(Te++,ke--):Te++}Ee=U.nextSibling()}}const yi=Mt+Te+Pe+ke;o(yi>=0,"trying to descend to a negative index"),x.descend(yi),Me&&(Se=$e=gr=null,ee++),g(Se,T,$e,gr,x,P)&&ke++,x.ascend()}else{let Se;for(;We&&(Se=m.getKey(),typeof Se!="string"||!(Se>ve||Se===ve));)We=m.nextSibling();const Me=We&&Se===ve?m:null,ne=gt(ve);let lt;for(;Ee&&(lt=U.getKey(),typeof lt!="string"||!(lt>ve||lt===ve));)Ee=U.nextSibling();const $e=Ee&&lt===ve?U:null;x.descend(ve),g(Me,T,ne,$e,x,P),x.ascend()}return gt.end(),dt&&m.ascend(),Qe&&U.ascend(),pe}(ze,ze.clone(),et,et.clone(),Ve,null),G)return{ok:!1,conflict:G};Ve.reset();const Fe=(g,m,T)=>g.traverse(m,(M,U)=>{M.d!=null&&T(M.d,g,U)});(X.length||Ge.length)&&(Fe(et,Ve,(g,m,T)=>{X[g]&&!Re[g]&&T.write("r",!0),Ge[g]&&T.mergeTree(Ge[g].get())}),Ve.reset());const ht=[],E=[];if((He.length||X.length)&&!G){const g=s.readCursor(B(Ve.get()));if(Fe(g,null,(m,T)=>{ht[m]=T.clone()}),He.forEach(m=>{m&&Fe(s.readCursor(m.get()),null,(T,M)=>{ht[T]=M.clone()})}),function m(T,M,U,x,P,I){const Q=a(M);if(Q&&c(Q))if(Q.p!=null){const L=Q.p;ht[L].getPath(),U=ht[L],x=E[L]=s.writeCursor()}else Q.r!==void 0&&(U=null);else h(a(U))&&(U=null);const pe=T.getComponent();if(pe){let L;if((L=pe.d)!=null){const ee=He[L];ee&&(ee.get(),x.mergeTree(ee.get()),U=s.readCursor(ee.get()))}}let J=0,_e=0;const we=s.advancer(M,void 0,(L,ee)=>{c(ee)&&J--}),ce=s.advancer(U,(L,ee)=>h(ee)?-(L-_e)-1:L-_e,(L,ee)=>{h(ee)&&_e++});for(const L of T)if(typeof L=="number"){const ee=we(L),Ce=L+J,Te=ce(Ce),Pe=Ce+_e;x.descend(Pe),m(T,ee,Te,x),x.ascend()}else x.descend(L),m(T,we(L),ce(L),x),x.ascend();we.end(),ce.end()}(et,g,g.clone(),Ve),Ve.reset(),G)return{ok:!1,conflict:G};if(Ve.get(),E.length){const m=E.map(M=>M?M.get():null),T=s.readCursor(B(Ve.get()));if(Fe(T,Ve,(M,U,x)=>{const P=m[M];P&&(x.mergeTree(P),m[M]=null)}),m.find(M=>M)){const M=s.writeCursor(),U=s.writeCursor();let x=0,P=0;m.forEach(I=>{I!=null&&Fe(s.readCursor(I),null,Q=>{const pe=Ut[Q];M.writeMove(Y[pe].getPath(),ue[pe].getPath(),x++);const J=qe[pe];J&&J.forEach(_e=>{X[_e]||q!==1&&Ue[_e]!=null||U.writeMove(ae[_e].getPath(),$[_e].getPath(),P++)})})}),G={type:i.ConflictType.BLACKHOLE,op1:M.get(),op2:U.get()}}}}return G?{ok:!1,conflict:G}:{ok:!0,result:Ve.get()}}const ie=S=>{const F=new Error("Transform detected write conflict");throw F.conflict=S,F.type=F.name="writeConflict",F};function de(S,F,K){const q=V(S,F,K);if(q.ok)return q.result;ie(q.conflict)}const ge=S=>{const F=s.writeCursor();return s.readCursor(S).traverse(F,(K,q)=>{(h(K)||se(K))&&q.write("r",!0)}),F.get()},ye=(S,F)=>{const{type:K,op1:q,op2:G}=S;switch(K){case i.ConflictType.DROP_COLLISION:return F==="left"?[null,ge(G)]:[ge(q),null];case i.ConflictType.RM_UNEXPECTED_CONTENT:let Y=!1;return s.readCursor(q).traverse(null,ue=>{ue.r!==void 0&&(Y=!0)}),Y?[null,ge(G)]:[ge(q),null];case i.ConflictType.BLACKHOLE:return[ge(q),ge(G)];default:throw Error("Unrecognised conflict: "+K)}};function Ae(S,F,K,q){let G=null;for(;;){const Y=V(F,K,q);if(Y.ok)return v(G,Y.result);{const{conflict:ue}=Y;S(ue)||ie(ue);const[ae,$]=ye(ue,q);F=v(le(F),ae),K=v(le(K),$),G=v(G,$)}}}}(Pn)),Pn}var So;function p_(){return So||(So=1,function(e){var t=tn&&tn.__createBinding||(Object.create?function(i,o,a,l){l===void 0&&(l=a),Object.defineProperty(i,l,{enumerable:!0,get:function(){return o[a]}})}:function(i,o,a,l){l===void 0&&(l=a),i[l]=o[a]}),n=tn&&tn.__exportStar||function(i,o){for(var a in i)a!=="default"&&!o.hasOwnProperty(a)&&t(o,i,a)};Object.defineProperty(e,"__esModule",{value:!0}),n(__(),e);var r=Ul();Object.defineProperty(e,"ReadCursor",{enumerable:!0,get:function(){return r.ReadCursor}}),Object.defineProperty(e,"WriteCursor",{enumerable:!0,get:function(){return r.WriteCursor}});var s=Pl();Object.defineProperty(e,"ConflictType",{enumerable:!0,get:function(){return s.ConflictType}})}(tn)),tn}var mt=p_();const E_=Et(mt),C_=ec({__proto__:null,default:E_},[mt]);var he=(e=>(e.RETAIN="r",e.INSERT="i",e.DELETE="d",e))(he||{});function cr(e,t=!1){const n=[];for(const r of e){const{st:s,ed:i,ts:o}=r;if(r.sId===void 0&&delete r.sId,s===i||!t&&re.isEmptyObject(o)&&r.sId==null)continue;if(n.length===0){n.push(r);continue}const a=n.pop();Sa(r,a)&&re.hasIntersectionBetweenTwoRanges(a.st,a.ed,r.st,r.ed)?n.push({...r,st:a.st,ed:i}):n.push(a,r)}return n}function kl(e,t,n,r){var u;const{textRuns:s}=e;if(s==null)return;const i=[],o=s.length;let a=!1;const l=(u=t.textRuns)!=null?u:[];if(l.length)for(const c of l)c.st+=r,c.ed+=r;for(let c=0;c<o;c++){const h=s[c],{st:d,ed:f}=h;if(f<=r)i.push(h);else if(r>d&&r<f){a=!0;const p={...h,ed:r};i.push(p),l.length&&i.push(...l);const R={...h,st:r+n,ed:f+n};i.push(R)}else h.st+=n,h.ed+=n,a||(a=!0,i.push(...l)),i.push(h)}a||(a=!0,i.push(...l)),e.textRuns=cr(i)}function Fl(e,t,n,r){const{paragraphs:s}=e;if(s==null)return;const{paragraphs:i}=t,o=[];for(let l=0,u=s.length;l<u;l++){const c=s[l],{startIndex:h}=c;h>=r&&(c.startIndex+=n),o.push(c.startIndex)}let a=-1;if(i){for(let l=0,u=i.length;l<u;l++){const c=i[l];c.startIndex+=r;const h=c.startIndex;a=o.indexOf(h)}a!==-1&&s.splice(a,1),s.push(...i),s.sort(lr("startIndex"))}}function Bl(e,t,n,r){const{sectionBreaks:s}=e;if(s==null)return;for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:u}=l;u>=r&&(l.startIndex+=n)}const i=t.sectionBreaks;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=r}s.push(...i),s.sort(lr("startIndex"))}}function $l(e,t,n,r){const{customBlocks:s=[]}=e;for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:u}=l;u>=r&&(l.startIndex+=n)}const i=t.customBlocks;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=r}s.push(...i),s.sort(lr("startIndex"))}s.length&&!e.customBlocks&&(e.customBlocks=s)}function Hl(e,t,n,r){const{tables:s}=e;if(s==null)return;for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:u,endIndex:c}=l;u>r?(l.startIndex+=n,l.endIndex+=n):c>r&&(l.endIndex+=n)}const i=t.tables;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=r,l.endIndex+=r}s.push(...i),s.sort(lr("startIndex"))}}const jl="$",vo=e=>e.split(jl)[0];function _i(e){if(e.length<=1)return e;e.sort((s,i)=>s.startIndex-i.startIndex);const t=[];let n={...e[0]};n.rangeId=vo(n.rangeId);for(let s=1;s<e.length;s++){const i=e[s];i.rangeId=vo(i.rangeId),i.rangeId===n.rangeId&&xl(n.properties,i.properties)&&n.endIndex+1>=i.startIndex?n.endIndex=i.endIndex:(t.push(n),n={...i})}t.push(n);const r=Object.create(null);for(let s=0,i=t.length;s<i;s++){const o=t[s],a=o.rangeId;r[a]?(o.rangeId=`${a}${jl}${r[a]}`,r[a]=r[a]+1):r[a]=1}return t}function Hs(e,t){const n=e.findIndex(s=>s.startIndex<t&&s.endIndex>=t),r=e[n];r&&e.splice(n,1,{rangeId:r.rangeId,rangeType:r.rangeType,startIndex:r.startIndex,endIndex:t-1,properties:{...r.properties}},{rangeId:r.rangeId,rangeType:r.rangeType,startIndex:t,endIndex:r.endIndex,properties:{...r.properties}})}function Wl(e){if(e.length<=1)return e;e.sort((r,s)=>r.startIndex-s.startIndex);const t=[];let n={...e[0]};for(let r=1;r<e.length;r++){const s=e[r];s.id===n.id&&n.endIndex+1>=s.startIndex?n.endIndex=s.endIndex:(t.push(n),n={...s})}return t.push(n),t}function js(e,t){e.filter(r=>r.startIndex<t&&r.endIndex>=t).forEach(r=>{const s=e.indexOf(r);e.splice(s,1,{id:r.id,type:r.type,startIndex:r.startIndex,endIndex:t-1},{id:r.id,type:r.type,startIndex:t,endIndex:r.endIndex})})}function R_(e,t,n,r){e.customRanges||(e.customRanges=[]);const{customRanges:s}=e;Hs(s,r);for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:u}=l;u>=r&&(l.startIndex+=n,l.endIndex+=n)}const i=[];if(t.customRanges){for(let o=0,a=t.customRanges.length;o<a;o++){const l=t.customRanges[o];l.startIndex+=r,l.endIndex+=r,i.push(l)}s.push(...i)}e.customRanges=_i(s)}function I_(e,t,n,r){e.customDecorations||(e.customDecorations=[]);const{customDecorations:s}=e;js(s,r);for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:u}=l;u>=r&&(l.startIndex+=n,l.endIndex+=n)}const i=[];if(t.customDecorations){for(let o=0,a=t.customDecorations.length;o<a;o++){const l=t.customDecorations[o];l.startIndex+=r,l.endIndex+=r,i.push(l)}s.push(...i)}e.customDecorations=Wl(s)}function Yl(e,t,n){const{textRuns:r}=e,s=n,i=n+t,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{st:h,ed:d}=c;if(s<=h&&i>=d){o.push({...c,st:h-s,ed:d-s});continue}else h<=s&&d>=i?(o.push({...c,st:s-s,ed:i-s}),c.ed-=t):s>=h&&s<d?(o.push({...c,st:s-s,ed:d-s}),c.ed=s):i>h&&i<=d?(o.push({...c,st:h-s,ed:i-s}),c.st=i-t,c.ed-=t):h>=i&&(c.st-=t,c.ed-=t);a.push(c)}e.textRuns=a}return o.length===0&&o.push({st:0,ed:t,ts:{}}),o}function Gl(e,t,n){const{paragraphs:r}=e,s=n,i=n+t,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{startIndex:h}=c;if(h>=s&&h<i){o.push({...c,startIndex:h-n});continue}else h>=i&&(c.startIndex-=t);a.push(c)}e.paragraphs=a}return o}function zl(e,t,n){const{sectionBreaks:r}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{startIndex:h}=c;if(h>=s&&h<=i){o.push({...c,startIndex:h-n});continue}else h>i&&(c.startIndex-=t);a.push(c)}e.sectionBreaks=a}return o}function Vl(e,t,n){const{customBlocks:r=[]}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{startIndex:h}=c;if(h>=s&&h<=i){o.push({...c,startIndex:h-n});continue}else h>i&&(c.startIndex-=t);a.push(c)}e.customBlocks=a}return r.length&&!e.customBlocks&&(e.customBlocks=r),o}function Kl(e,t,n){const{tables:r}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{startIndex:h,endIndex:d}=c;if(s<=h&&i>=d){o.push({...c,startIndex:h-n,endIndex:d-n});continue}else if(h<=s&&d>=i){const f=Qr(h,d,s,i);if(f.length===0||(c.startIndex=f[0],c.endIndex=f[1],c.startIndex===c.endIndex))continue}else i<h&&(c.startIndex-=t,c.endIndex-=t);a.push(c)}e.tables=a}return o}function S_(e,t,n){const{customRanges:r}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{startIndex:h,endIndex:d}=c;if(h>=s&&d<=i){o.push(c);continue}else if(Math.max(s,h)<=Math.min(i,d)){const f=Qr(h,d,s,i);if(f.length===0)continue;c.startIndex=f[0],c.endIndex=f[1]}else i<h&&(c.startIndex-=t,c.endIndex-=t);a.push(c)}e.customRanges=_i(a)}return o}function v_(e,t,n,r=!0){const{customDecorations:s}=e,i=n,o=n+t-1,a=[];if(s){const l=[];for(let u=0,c=s.length;u<c;u++){const h=s[u],{startIndex:d,endIndex:f}=h;if(d>=i&&f<=o){a.push(h);continue}else if(Math.max(i,d)<=Math.min(o,f)){const p=Qr(d,f,i,o);if(p.length===0)continue;h.startIndex=p[0],h.endIndex=p[1]}else o<d&&r&&(h.startIndex-=t,h.endIndex-=t);l.push(h)}e.customDecorations=l}return a}var Xl=(e=>(e.ORDER_LIST_QUICK_1="1.",e.ORDER_LIST_QUICK_2="a)",e.ORDER_LIST_QUICK_3="a.",e.ORDER_LIST_QUICK_4="i.",e.ORDER_LIST_QUICK_5="A.",e.ORDER_LIST_QUICK_6="I.",e.ORDER_LIST_QUICK_7="01.",e.BULLET_LIST="*",e))(Xl||{}),xt=(e=>(e.BULLET_LIST="BULLET_LIST",e.BULLET_LIST_1="BULLET_LIST_1",e.BULLET_LIST_2="BULLET_LIST_2",e.BULLET_LIST_3="BULLET_LIST_3",e.BULLET_LIST_4="BULLET_LIST_4",e.BULLET_LIST_5="BULLET_LIST_5",e.ORDER_LIST="ORDER_LIST",e.ORDER_LIST_1="ORDER_LIST_1",e.ORDER_LIST_2="ORDER_LIST_2",e.ORDER_LIST_3="ORDER_LIST_3",e.ORDER_LIST_4="ORDER_LIST_4",e.ORDER_LIST_5="ORDER_LIST_5",e.ORDER_LIST_QUICK_2="ORDER_LIST_QUICK_2",e.ORDER_LIST_QUICK_3="ORDER_LIST_QUICK_3",e.ORDER_LIST_QUICK_4="ORDER_LIST_QUICK_4",e.ORDER_LIST_QUICK_5="ORDER_LIST_QUICK_5",e.ORDER_LIST_QUICK_6="ORDER_LIST_QUICK_6",e.CHECK_LIST="CHECK_LIST",e.CHECK_LIST_CHECKED="CHECK_LIST_CHECKED",e))(xt||{});const Or={"a)":{glyphFormat:"%1)",glyphType:Ne.DECIMAL},"1.":{glyphType:Ne.DECIMAL},"a.":{glyphFormat:"%1.",glyphType:Ne.LOWER_LETTER},"A.":{glyphType:Ne.UPPER_LETTER},"i.":{glyphFormat:"%1.",glyphType:Ne.LOWER_ROMAN},"I.":{glyphFormat:"%1.",glyphType:Ne.UPPER_LETTER}},_n=e=>[...e,...e,...e].map((t,n)=>({glyphFormat:` %${n+1}`,glyphSymbol:t,bulletAlignment:ar.START,textStyle:{fs:12},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*n}}})),pn=e=>e.map((t,n)=>({...t,bulletAlignment:ar.START,textStyle:{fs:12},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*n}}})),Oo=(e,t)=>new Array(9).fill(0).map((n,r)=>({glyphFormat:` %${r+1}`,glyphSymbol:e,bulletAlignment:ar.START,textStyle:{fs:16},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*r},textStyle:t}})),hr={BULLET_LIST:{listType:"BULLET_LIST",nestingLevel:_n(["●","○","■"])},BULLET_LIST_1:{listType:"BULLET_LIST",nestingLevel:_n(["❖","➢","■"])},BULLET_LIST_2:{listType:"BULLET_LIST",nestingLevel:_n(["✔","●","◆"])},BULLET_LIST_3:{listType:"BULLET_LIST",nestingLevel:_n(["■","◆","○"])},BULLET_LIST_4:{listType:"BULLET_LIST",nestingLevel:_n(["✧","○","■"])},BULLET_LIST_5:{listType:"BULLET_LIST",nestingLevel:_n(["➢","○","◆"])},ORDER_LIST:{listType:"ORDER_LIST",nestingLevel:pn([{glyphFormat:"%1.",glyphType:Ne.DECIMAL},{glyphFormat:"%2.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%3.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:Ne.DECIMAL},{glyphFormat:"%5.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%6.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:Ne.DECIMAL},{glyphFormat:"%8.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%9.",glyphType:Ne.LOWER_ROMAN}])},ORDER_LIST_1:{listType:"ORDER_LIST",nestingLevel:pn([{glyphFormat:"%1)",glyphType:Ne.DECIMAL},{glyphFormat:"%2)",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%3)",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%4)",glyphType:Ne.DECIMAL},{glyphFormat:"%5)",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%6)",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%7)",glyphType:Ne.DECIMAL},{glyphFormat:"%8)",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%9)",glyphType:Ne.LOWER_ROMAN}])},ORDER_LIST_2:{listType:"ORDER_LIST",nestingLevel:pn(["%1.","%1.%2.","%1.%2.%3.","%1.%2.%3.%4.","%1.%2.%3.%4.%5.","%1.%2.%3.%4.%5.%6.","%1.%2.%3.%4.%5.%6.%7."].map(e=>({glyphFormat:e,glyphType:Ne.DECIMAL})))},ORDER_LIST_3:{listType:"ORDER_LIST",nestingLevel:pn([{glyphFormat:"%1.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%2.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%3.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%5.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%6.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%8.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%9.",glyphType:Ne.LOWER_ROMAN}])},ORDER_LIST_4:{listType:"ORDER_LIST",nestingLevel:pn([{glyphFormat:"%1.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%2.",glyphType:Ne.DECIMAL},{glyphFormat:"%3.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%5.",glyphType:Ne.DECIMAL},{glyphFormat:"%6.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%8.",glyphType:Ne.DECIMAL},{glyphFormat:"%9.",glyphType:Ne.LOWER_ROMAN}])},ORDER_LIST_5:{listType:"ORDER_LIST",nestingLevel:pn([{glyphFormat:"%1.",glyphType:Ne.DECIMAL_ZERO},{glyphFormat:"%2.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%3.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:Ne.DECIMAL_ZERO},{glyphFormat:"%5.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%6.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:Ne.DECIMAL_ZERO},{glyphFormat:"%8.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%9.",glyphType:Ne.LOWER_ROMAN}])},CHECK_LIST:{listType:"CHECK_LIST",nestingLevel:Oo("☐")},CHECK_LIST_CHECKED:{listType:"CHECK_LIST_CHECKED",nestingLevel:Oo("☑",{st:{s:Ie.TRUE}})}},wr=e=>{const{glyphFormat:t,glyphType:n}=e,r=re.deepClone(hr.ORDER_LIST);return r.nestingLevel[0].glyphFormat=t,r.nestingLevel[0].glyphType=n,r},O_={ORDER_LIST_QUICK_2:wr(Or["a)"]),ORDER_LIST_QUICK_3:wr(Or["a."]),ORDER_LIST_QUICK_4:wr(Or["i."]),ORDER_LIST_QUICK_6:wr(Or["I."])};Object.assign(hr,O_);const w_={"1.":"ORDER_LIST","a)":"ORDER_LIST_QUICK_2","a.":"ORDER_LIST_QUICK_3","i.":"ORDER_LIST_QUICK_4","A.":"ORDER_LIST_3","I.":"ORDER_LIST_QUICK_6","01.":"ORDER_LIST_5","*":"BULLET_LIST"};function b_(e,t,n,r,s){const i=A_(e,t,n,r,s),o=T_(e,t,n,r,s),a=y_(e,t,n,r,s),l=N_(e,t,n,r,s),u=M_(e,t,n,r,s),c=D_(e,t,n,r),h=L_(e,t,n,r,s);return{dataStream:"",textRuns:i,paragraphs:o,sectionBreaks:a,customBlocks:l,tables:u,customRanges:c,customDecorations:h}}function A_(e,t,n,r,s){const{textRuns:i}=e,{textRuns:o}=t;if(i==null||o==null)return;const a=Yl(e,n,r);if(s!==xe.REPLACE){const l=ql(o,a,s);t.textRuns=l}return kl(e,t,n,r),a}function ql(e,t,n){if(t.length===0)return e;e=re.deepClone(e),t=re.deepClone(t);const r=[],s=e.length,i=t.length;let o=0,a=0,l=null;function u(){return l?(r.push(l),l=null,!0):!1}for(;o<s&&a<i;){const{st:f,ed:p,ts:R}=e[o],{st:w,ed:N,ts:z,sId:W}=t[a];let se;if(n===xe.COVER?se={...z,...R}:se={...R},p<w)u()||r.push(e[o]),o++;else if(N<f)u()||r.push(t[a]),a++;else{const y={st:Math.min(f,w),ed:Math.max(f,w),ts:f<w?{...R}:{...z},sId:f<w?void 0:W};y.ed>y.st&&r.push(y),r.push({st:Math.max(f,w),ed:Math.min(p,N),ts:se,sId:W}),p<N?(o++,t[a].st=p,t[a].st===t[a].ed&&a++):(a++,e[o].st=N,e[o].st===e[o].ed&&o++);const A={st:Math.min(p,N),ed:Math.max(p,N),ts:p<N?{...z}:{...R},sId:p<N?W:void 0};l=A.ed>A.st?A:null}}u();const c=r[r.length-1],h=e[s-1],d=t[i-1];return c&&c.ed!==Math.max(h.ed,d.ed)&&(h.ed>d.ed?r.push(h):r.push(d)),cr(r)}function T_(e,t,n,r,s){const{paragraphs:i}=e,{paragraphs:o}=t;if(i==null||o==null)return;const a=Gl(e,n,r);if(s!==xe.REPLACE){const l=[];for(const u of o){const{startIndex:c,paragraphStyle:h,bullet:d}=u;let f=[];for(const p of a){const{startIndex:R,paragraphStyle:w,bullet:N}=p;let z,W;if(s===xe.COVER?(z={...w,...h},W={listId:"",listType:xt.BULLET_LIST,nestingLevel:0,textStyle:{},...N,...d}):(z={...h,...w},W={listId:"",listType:xt.BULLET_LIST,nestingLevel:0,textStyle:{},...d,...N}),c===R){f.push({startIndex:c,paragraphStyle:z,bullet:W});break}}l.push(...f),f=[]}t.paragraphs=l}return Fl(e,t,n,r),a}function y_(e,t,n,r,s){const{sectionBreaks:i}=e,{sectionBreaks:o}=t;if(i==null||o==null)return;const a=zl(e,n,r);if(s!==xe.REPLACE){const l=[];for(const u of o){const{startIndex:c}=u;let h=[];for(const d of a){const{startIndex:f}=d;if(c===f){s===xe.COVER?h.push({...d,...u}):h.push({...u,...d});break}}l.push(...h),h=[]}t.sectionBreaks=l}return Bl(e,t,n,r),a}function N_(e,t,n,r,s){const{customBlocks:i=[]}=e,{customBlocks:o}=t;if(i==null||o==null)return;const a=Vl(e,n,r);if(s!==xe.REPLACE){const l=[];for(const u of o){const{startIndex:c}=u;let h=[];for(const d of a){const{startIndex:f}=d;if(c===f){s===xe.COVER?h.push({...d,...u}):h.push({...u,...d});break}}l.push(...h),h=[]}t.customBlocks=l}return $l(e,t,n,r),i.length&&!e.customBlocks&&(e.customBlocks=i),a}function M_(e,t,n,r,s){const{tables:i}=e,{tables:o}=t;if(i==null||o==null)return;const a=Kl(e,n,r);if(s!==xe.REPLACE){const l=[];for(const u of o){const{startIndex:c,endIndex:h}=u;let d=[];for(const f of a){const{startIndex:p,endIndex:R}=f;if(p>=c&&R<=h){s===xe.COVER?d.push({...f,...u}):d.push({...u,...f});break}}l.push(...d),d=[]}t.tables=l}return Hl(e,t,n,r),a}function D_(e,t,n,r,s){e.customRanges||(e.customRanges=[]),Hs(e.customRanges,r),Hs(e.customRanges,r+n);const i=r,o=r+n-1,{customRanges:a}=t,l=[],u=new Map;e.customRanges.forEach(h=>{const{startIndex:d,endIndex:f}=h;d>=i&&f<=o?u.set(h.rangeId,h):l.push(h)});const c=[];return a?(a.forEach(h=>{const{startIndex:d,endIndex:f}=h;l.push({...h,startIndex:d+r,endIndex:f+r})}),e.customRanges=_i(l),c):[]}function L_(e,t,n,r,s){e.customDecorations||(e.customDecorations=[]),js(e.customDecorations,r),js(e.customDecorations,r+n);const i=[],{customDecorations:o}=e,{customDecorations:a=[]}=t;if(s===xe.REPLACE){for(let l=0;l<o.length;l++){const u=o[l],{startIndex:c,endIndex:h}=u;c>=r&&h<=r+n-1&&i.push(u)}a.forEach(l=>{const{startIndex:u,endIndex:c}=l;o.push({...l,startIndex:u+r,endIndex:c+r})})}else for(const l of a){const{id:u}=l;if(l.type===sn.DELETED){const c=o.filter(h=>h.id===u);c.length&&i.push(...c)}else o.push({...l,startIndex:l.startIndex+r,endIndex:l.endIndex+r})}for(const l of i){const{id:u}=l,c=o.findIndex(h=>h.id===u);c!==-1&&o.splice(c,1)}return e.customDecorations=Wl(o),i}var pi=(e=>(e[e.copy=0]="copy",e[e.cut=1]="cut",e))(pi||{});function Vr(e,t,n,r=!0){const{textRuns:s}=e;if(s){const i=[];for(const o of s){const a=re.deepClone(o),{st:l,ed:u}=a;re.hasIntersectionBetweenTwoRanges(l,u,t,n)&&(t>=l&&t<=u?i.push({...a,st:t,ed:Math.min(n,u)}):n>=l&&n<=u?i.push({...a,st:Math.max(t,l),ed:n}):i.push(a))}return cr(i.map(o=>{const{st:a,ed:l}=o;return{...o,st:a-t,ed:l-t}}))}else if(r)return[{st:0,ed:n-t,ts:{}}]}function Jl(e,t,n){const{tables:r=[]}=e,s=[];for(const i of r){const o=re.deepClone(i),{startIndex:a,endIndex:l}=o;a>=t&&l<=n&&s.push({...o,startIndex:a-t,endIndex:l-t})}return s}function Zl(e,t,n){const{paragraphs:r=[]}=e,s=[];for(const i of r){const{startIndex:o}=i;if(o>=t&&o<n){const a=re.deepClone(i);s.push(a)}}if(s.length)return s.map(i=>({...i,startIndex:i.startIndex-t}))}function x_(e,t,n){const{sectionBreaks:r=[]}=e,s=[];for(const i of r){const{startIndex:o}=i;o>=t&&o<=n&&s.push(re.deepClone(i))}if(s.length)return s.map(i=>({...i,startIndex:i.startIndex-t}))}function Ql(e,t,n){const{customBlocks:r=[]}=e,s=[];for(const i of r){const{startIndex:o}=i;o>=t&&o<n&&s.push(re.deepClone(i))}if(s.length)return s.map(i=>({...i,startIndex:i.startIndex-t}))}function yt(e,t,n,r=!0,s=1){const{dataStream:i}=e,o={dataStream:i.slice(t,n)};o.textRuns=Vr(e,t,n,r);const a=Jl(e,t,n);if(a.length&&(o.tables=a),o.paragraphs=Zl(e,t,n),s===1){const u=tu(e,t,n);u?o.customDecorations=u:r&&(o.customDecorations=[])}const{customRanges:l}=eu(e,t,n);return l?o.customRanges=l:r&&(o.customRanges=[]),o.customBlocks=Ql(e,t,n),o}function U_(e){const{dataStream:t,textRuns:n,paragraphs:r,customRanges:s,customDecorations:i,tables:o}=e;let a=0,l=0;s==null||s.forEach(c=>{c.startIndex<0&&(a=Math.max(a,-c.startIndex)),c.endIndex>t.length-1&&(l=Math.max(l,c.endIndex-t.length+1))});const u=`${t}`;return n&&(n[0]&&(n[0].st=n[0].st-a),n[n.length-1]&&(n[n.length-1].ed=n[n.length-1].ed+l)),n==null||n.forEach(c=>{c.st+=a,c.ed+=a}),r==null||r.forEach(c=>{c.startIndex+=a}),s==null||s.forEach(c=>{c.startIndex+=a,c.endIndex+=a}),i==null||i.forEach(c=>{c.startIndex+=a,c.endIndex+=l}),o==null||o.forEach(c=>{c.startIndex+=a,c.endIndex+=l}),{...e,dataStream:u,textRuns:n,paragraphs:r,customRanges:s,customDecorations:i,tables:o}}function eu(e,t,n){if(e.customRanges==null)return{};const{customRanges:r}=e;return{customRanges:r.filter(a=>Math.max(a.startIndex,t)<=Math.min(a.endIndex,n-1)).map(a=>({...a,startIndex:Math.max(a.startIndex,t),endIndex:Math.min(a.endIndex,n-1)})).map(a=>({...a,startIndex:a.startIndex-t,endIndex:a.endIndex-t})),leftOffset:0,rightOffset:0}}function tu(e,t,n){if(e.customDecorations==null)return;const{customDecorations:r=[]}=e,s=[];return r.forEach(i=>{if(Math.max(i.startIndex,t)<=Math.min(i.endIndex,n-1)){const o=re.deepClone(i);s.push({...o,startIndex:Math.max(o.startIndex-t,0),endIndex:Math.min(o.endIndex,n-1)-t})}}),s}function P_(e,t,n){return e==null||t==null?e!=null?e:t:ql(e,t,n)}function k_(e,t,n){if(e==null||t==null)return e!=null?e:t;if(t.length===0||e.length===0)return e;if(t.length>1||e.length>1)throw new Error("Cannot cover multiple customRanges");return n===xe.REPLACE?[{...e[0]}]:[{...t[0],...e[0]}]}function F_(e,t,n){return t.length===0||e.length===0||n===xe.REPLACE?e:[...e,...t.filter(r=>!e.some(s=>r.id===s.id))]}function Ws(e,t,n=xe.COVER){if(t.dataStream!=="")throw new Error("Cannot compose other body with non-empty dataStream");const r={dataStream:e.dataStream},{textRuns:s,paragraphs:i=[],customRanges:o,customDecorations:a=[]}=e,{textRuns:l,paragraphs:u=[],customRanges:c,customDecorations:h=[]}=t;r.textRuns=P_(l,s,n),r.customRanges=k_(c,o,n);const d=F_(h,a,n);d.length&&(r.customDecorations=d);const f=[];let p=0,R=0;for(;p<i.length&&R<u.length;){const w=i[p],N=u[R],{startIndex:z}=w,{startIndex:W}=N;z===W?(f.push(re.deepMerge(w,N)),p++,R++):z<W?(f.push(re.deepClone(w)),p++):(f.push(re.deepClone(N)),R++)}return p<i.length&&f.push(...i.slice(p)),R<u.length&&f.push(...u.slice(R)),f.length&&(r.paragraphs=f),r}function B_(e){const{body:t}=e;if(t==null)return!0;const{textRuns:n,paragraphs:r,customRanges:s,customBlocks:i,customDecorations:o,tables:a}=t;return n==null&&r==null&&s==null&&i==null&&o==null&&a==null}class Cn{constructor(t){C(this,"_index",0);C(this,"_offset",0);this._actions=t}hasNext(){return this.peekLength()<Number.POSITIVE_INFINITY}next(t){t||(t=Number.POSITIVE_INFINITY);const n=this._actions[this._index];if(n){const r=this._offset,s=n.len;return t>=s-r?(t=s-r,this._index+=1,this._offset=0):this._offset+=t,n.t===he.DELETE||n.t===he.RETAIN&&n.body==null?re.deepClone({...n,len:t}):re.deepClone({...n,len:t,body:yt(n.body,r,r+t,!1)})}else return{t:he.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 t=this._actions[this._index];return t?t.t:he.RETAIN}rest(){if(this.hasNext()){if(this._offset===0)return this._actions.slice(this._index);{const t=this._offset,n=this._index,r=this.next(),s=this._actions.slice(this._index);return this._offset=t,this._index=n,[r].concat(s)}}else return[]}}class dn{constructor(){C(this,"cursor",0)}reset(){return this.cursor=0,this}moveCursor(t){this.cursor+=t}moveCursorTo(t){this.cursor=t}}function nu(e,t,n){const{dataStream:r}=e,s=n,i=n+t,o=Yl(e,t,n),a=Gl(e,t,n),l=zl(e,t,n),u=Vl(e,t,n),c=Kl(e,t,n),h=S_(e,t,n),d=v_(e,t,n);let f="";return r&&(e.dataStream=wa(r,s,i),f=r.slice(s,i)),{dataStream:f,textRuns:o,paragraphs:a,sectionBreaks:l,customBlocks:u,tables:c,customRanges:h,customDecorations:d}}function ru(e,t,n,r){e.dataStream=Oa(e.dataStream,r,t.dataStream),kl(e,t,n,r),Fl(e,t,n,r),Bl(e,t,n,r),$l(e,t,n,r),Hl(e,t,n,r),R_(e,t,n,r),I_(e,t,n,r)}function $_(e,t,n,r,s=xe.COVER){return b_(e,t,n,r,s)}function H_(e,t,n){return t<=0?{dataStream:""}:nu(e,t,n)}function j_(e,t,n,r){n!==0&&ru(e,t,n,r)}function W_(e,t){const n=new dn;return n.reset(),t.forEach(r=>{const s=re.deepClone(r);switch(s.t){case he.RETAIN:{const{coverType:i,body:o,len:a}=s;o!=null&&$_(e,o,a,n.cursor,i),n.moveCursor(a);break}case he.INSERT:{const{body:i,len:o}=s;j_(e,i,o,n.cursor),n.moveCursor(o);break}case he.DELETE:{const{len:i}=s;H_(e,i,n.cursor);break}default:throw new Error(`Unknown action type for action: ${s}.`)}}),e}function Y_(e,t,n,r,s){if(e==null||t==null)return t;if(e.length===0||t.length===0)return[];t=re.deepClone(t),e=re.deepClone(e);const i=[],o=t.length,a=e.length;let l=0,u=0,c=null;function h(){return c?(i.push(c),c=null,!0):!1}for(;l<o&&u<a;){const{st:R,ed:w,ts:N}=t[l],{st:z,ed:W,ts:se,sId:y}=e[u];let A={};if(s===0)A={...N},n===xe.COVER&&r===xe.REPLACE&&se&&(A=Object.assign({},se,A));else if(A={...N},n===xe.REPLACE){if(r===xe.REPLACE)A={...se};else if(N&&se){const j=Object.keys(N);for(const Z of j)se[Z]&&delete A[Z]}}else if(r===xe.REPLACE){if(se){const j=Object.keys(se);for(const Z of j)se[Z]!==void 0&&(A[Z]=se[Z])}}else if(se){const j=Object.keys(se);for(const Z of j)A[Z]!==void 0&&delete A[Z]}if(w<z)h()||i.push(t[l]),l++;else if(W<R)h()||i.push(e[u]),u++;else{const j={st:Math.min(R,z),ed:Math.max(R,z),ts:R<z?{...N}:{...se}};j.ed>j.st&&i.push(),i.push({st:Math.max(R,z),ed:Math.min(w,W),ts:A,sId:y}),w<W?(l++,e[u].st=w,e[u].st===e[u].ed&&u++):(u++,t[l].st=W,t[l].st===t[l].ed&&l++);const Z={st:Math.min(w,W),ed:Math.max(w,W),ts:w<W?{...se}:{...N},sId:w<W?y:void 0};c=Z.ed>Z.st?Z:null}}h();const d=i[i.length-1],f=t[o-1],p=e[a-1];return d.ed!==Math.max(f.ed,p.ed)&&(f.ed>p.ed?i.push(f):i.push(p)),cr(i,!0)}function G_(e,t,n,r,s){if(e==null||t==null)return t;if(e.length===0||t.length===0)return[];if(e.length>1||t.length>1)throw new Error("CustomRanges is only supported transform for length one now.");const i=e[0],o=t[0];if(n===xe.REPLACE)return s===1?[re.deepClone(i)]:[re.deepClone(o)];if(r===xe.REPLACE){const a=re.deepClone(o);return s===1&&Object.assign(a,re.deepClone(i)),[a]}else{const a=re.deepClone(o);return s===1&&Object.assign(a,re.deepClone(i)),[a]}}function wo(e,t,n,r,s){const i={startIndex:t.startIndex};if(t.paragraphStyle&&(i.paragraphStyle=re.deepClone(t.paragraphStyle),e.paragraphStyle)){if(n===xe.REPLACE)if(r===xe.REPLACE)s===1&&(i.paragraphStyle={...e.paragraphStyle});else if(s===1){const o=Object.keys(e.paragraphStyle);for(const a of o)e.paragraphStyle[a]!==void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else{const o=Object.keys(e.paragraphStyle);for(const a of o)i.paragraphStyle[a]===void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else if(r===xe.REPLACE)if(s===1){const o=Object.keys(e.paragraphStyle);for(const a of o)e.paragraphStyle[a]!==void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else{const o=Object.keys(e.paragraphStyle);for(const a of o)i.paragraphStyle[a]===void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else if(s===1){const o=Object.keys(e.paragraphStyle);for(const a of o)i.paragraphStyle[a]&&delete i.paragraphStyle[a]}}return n===xe.REPLACE&&r===xe.REPLACE?i.bullet=s===1?re.deepClone(e.bullet):re.deepClone(t.bullet):e.bullet===void 0?i.bullet=re.deepClone(t.bullet):n===xe.REPLACE||r===xe.REPLACE?i.bullet=s===0&&t.bullet?re.deepClone(t.bullet):re.deepClone(e.bullet):s===0&&t.bullet!==void 0&&(i.bullet=re.deepClone(t.bullet)),i}function z_(e,t){if(e==null||t==null)return t;if(e.length===0||t.length===0)return re.deepClone(t);const n=[];for(const r of t){const{id:s,type:i}=r;let o=!1;for(const a of e)if(a.id===s){(a.type===sn.DELETED||i===sn.DELETED)&&(o=!0,n.push({...r,type:sn.DELETED}));break}o||n.push(r)}return n}function V_(e,t,n=!1){const{body:r,coverType:s=xe.COVER}=e,{body:i,coverType:o=xe.COVER}=t;if(r==null||r.dataStream!==""||i==null||i.dataStream!=="")throw new Error("Data stream is not supported in retain transform.");const a={dataStream:""},l=o,{textRuns:u,paragraphs:c=[],customRanges:h,customDecorations:d}=r,{textRuns:f,paragraphs:p=[],customRanges:R,customDecorations:w}=i,N=Y_(u,f,s,o,n?1:0);N&&(a.textRuns=N);const z=G_(h,R,s,o,n?1:0);z&&(a.customRanges=z);const W=z_(d,w);W&&(a.customDecorations=W);const se=[];let y=0,A=0;for(;y<c.length&&A<p.length;){const j=c[y],Z=p[A],{startIndex:fe}=j,{startIndex:le}=Z;if(fe===le){let _={startIndex:fe};n?_=wo(j,Z,s,o,1):_=wo(j,Z,s,o,0),se.push(_),y++,A++}else fe<le?y++:(se.push(re.deepClone(Z)),A++)}return A<p.length&&se.push(...p.slice(A)),se.length&&(a.paragraphs=se),{coverType:l,body:a}}function bo(e){return Object.keys(e).length===1}const wn=class wn{constructor(){C(this,"_actions",[])}static apply(t,n){return W_(t,n)}static compose(t,n){const r=new Cn(t),s=new Cn(n),i=new wn;for(;r.hasNext()||s.hasNext();)if(s.peekType()===he.INSERT)i.push(s.next());else if(r.peekType()===he.DELETE)i.push(r.next());else{const o=Math.min(r.peekLength(),s.peekLength()),a=r.next(o),l=s.next(o);if(a.t===he.INSERT&&l.t===he.RETAIN)l.body==null?i.push(a):i.push({...a,body:Ws(a.body,l.body,l.coverType)});else if(a.t===he.RETAIN&&l.t===he.RETAIN)if(a.body==null&&l.body==null)i.push(a.len!==Number.POSITIVE_INFINITY?a:l);else if(a.body&&l.body){const u=a.coverType===xe.REPLACE||l.coverType===xe.REPLACE?xe.REPLACE:xe.COVER;i.push({...a,t:he.RETAIN,coverType:u,body:Ws(a.body,l.body,l.coverType)})}else i.push(a.body?a:l);else a.t===he.RETAIN&&l.t===he.DELETE?i.push(l):a.t===he.INSERT&&(l.t,he.DELETE)}return i.trimEndUselessRetainAction(),i.serialize()}static transform(t,n,r="right"){return this._transform(n,t,r==="left"?"right":"left")}static _transform(t,n,r="right"){const s=new Cn(t),i=new Cn(n),o=new wn;for(;s.hasNext()||i.hasNext();)if(s.peekType()===he.INSERT&&(r==="left"||i.peekType()!==he.INSERT)){const a=s.next();o.retain(a.len)}else if(i.peekType()===he.INSERT)o.push(i.next());else{const a=Math.min(s.peekLength(),i.peekLength()),l=s.next(a),u=i.next(a);if(l.t===he.DELETE)continue;if(u.t===he.DELETE){o.push(u);continue}if(l.body==null||u.body==null)o.push(u);else{const{coverType:c,body:h}=V_(l,u,r==="left");o.push({...u,t:he.RETAIN,coverType:c,body:h})}}return o.trimEndUselessRetainAction(),o.serialize()}static transformPosition(t,n,r=!1){const s=new Cn(t);let i=0;for(;s.hasNext()&&i<=n;){const o=s.peekLength(),a=s.peekType();if(s.next(),a===he.DELETE){n-=Math.min(o,n-i);continue}else a===he.INSERT&&(i<n||!r)&&(n+=o);i+=o}return n}static isNoop(t){return t.length===0}static invert(t){const n=[];for(const r of t)if(r.t===he.INSERT)n.push({t:he.DELETE,len:r.len,body:r.body});else if(r.t===he.DELETE){if(r.body==null)throw new Error("Can not invert DELETE action without body property, makeInvertible must be called first.");n.push({t:he.INSERT,body:r.body,len:r.len})}else if(r.body!=null){if(r.oldBody==null)throw new Error("Can not invert RETAIN action without oldBody property, makeInvertible must be called first.");n.push({t:he.RETAIN,body:r.oldBody,oldBody:r.body,len:r.len,coverType:xe.REPLACE})}else n.push(r);return n}static makeInvertible(t,n){const r=[];let s=0;for(const i of t){if(i.t===he.DELETE&&(i.body==null||i.body&&i.body.dataStream.length!==i.len)){const o=yt(n,s,s+i.len,!1);i.len=o.dataStream.length,i.body=o}if(i.t===he.RETAIN&&i.body!=null){const o=yt(n,s,s+i.len,!0);i.oldBody={...o,dataStream:""},i.len=o.dataStream.length}r.push(i),i.t!==he.INSERT&&(s+=i.len)}return r}insert(t,n){const r={t:he.INSERT,body:n,len:t};return this.push(r),this}retain(t,n,r){const s={t:he.RETAIN,len:t};return n!=null&&(s.body=n),r!=null&&(s.coverType=r),this.push(s),this}delete(t){const n={t:he.DELETE,len:t};return this.push(n),this}empty(){return this._actions=[],this}serialize(){return this._actions}push(...t){if(t.length>1){for(const i of t)this.push(i);return this}let n=this._actions.length,r=this._actions[n-1];const s=re.deepClone(t[0]);if(s.t===he.RETAIN&&s.len===0&&s.body==null)return this;if(typeof r=="object"){if(r.t===he.DELETE&&s.t===he.DELETE)return r.len+=s.len,this;if(r.t===he.DELETE&&s.t===he.INSERT&&(n-=1,r=this._actions[n-1],r==null))return this._actions.unshift(s),this;if(r.t===he.RETAIN&&s.t===he.RETAIN&&r.body==null&&s.body==null)return r.len+=s.len,this;if(r.t===he.INSERT&&bo(r.body)&&s.t===he.INSERT&&bo(s.body))return r.len+=s.len,r.body.dataStream+=s.body.dataStream,this}return n===this._actions.length?this._actions.push(s):this._actions.splice(n,0,s),this}trimEndUselessRetainAction(){let t=this._actions[this._actions.length-1];for(;t&&t.t===he.RETAIN&&B_(t);)this._actions.pop(),t=this._actions[this._actions.length-1];return this}};C(wn,"id","text-x"),C(wn,"uri","https://github.com/dream-num/univer#text-x");let Ye=wn;Object.defineProperty(Ye,"name",{value:"text-x"});const bn=class bn{static registerSubtype(t){var n;t==null||this._subTypes.has(t.name)&&((n=this._subTypes.get(t.name))==null?void 0:n.id)!==Ye.id||(this._subTypes.set(t.name,t),mt.type.registerSubtype(t))}static apply(t,n){if(!mt.type.isNoop(n))return mt.type.apply(t,n)}static compose(t,n){return mt.type.compose(t,n)}static transform(t,n,r){return mt.type.transform(t,n,r)}static transformPosition(t,n,r="right"){return t&&t.length===2&&t[0]==="body"&&t[1].et===Ye.name?Ye.transformPosition(t[1].e,n,r==="left"):n}static invertWithDoc(t,n){return mt.type.invertWithDoc(t,n)}static isNoop(t){return mt.type.isNoop(t)}static getInstance(){return this._instance==null&&(this._instance=new bn),this._instance}removeOp(t,n){return mt.removeOp(t,n)}moveOp(t,n){return mt.moveOp(t,n)}insertOp(t,n){return mt.insertOp(t,n)}replaceOp(t,n,r){return mt.replaceOp(t,n,r)}editOp(t,n=["body"]){return mt.editOp(n,Ye.name,t)}};C(bn,"uri","https://github.com/dream-num/univer#json-x"),C(bn,"_subTypes",new Map),C(bn,"_instance",null);let Bt=bn;Bt.registerSubtype(Ye);const Ei={id:"default_doc",documentStyle:{}};class K_ extends is{constructor(n){var r;super();C(this,"type",Be.UNIVER_DOC);C(this,"_name$",new Oe.BehaviorSubject(""));C(this,"name$",this._name$.asObservable());C(this,"snapshot");this.snapshot={...Ei,...n},this._name$.next((r=this.snapshot.title)!=null?r:"No Title")}getUnitId(){throw new Error("Method not implemented.")}getRev(){var n;return(n=this.snapshot.rev)!=null?n:1}incrementRev(){this.snapshot.rev=this.getRev()+1}setRev(n){this.snapshot.rev=n}setName(n){this.snapshot.title=n,this._name$.next(n)}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,r){this.snapshot.drawings=n,this.snapshot.drawingsOrder=r}getBody(){return this.snapshot.body}getSnapshot(){return this.snapshot}getBulletPresetList(){var s;const n=(s=this.snapshot.lists)!=null?s:{};return{...hr,...n}}updateDocumentId(n){this.snapshot.id=n}updateDocumentRenderConfig(n){const{documentStyle:r}=this.snapshot;r.renderConfig==null?r.renderConfig=n:r.renderConfig={...r.renderConfig,...n}}getDocumentStyle(){return this.snapshot.documentStyle}updateDocumentStyle(n){this.snapshot.documentStyle==null?this.snapshot.documentStyle=n:this.snapshot.documentStyle={...this.snapshot.documentStyle,...n}}updateDocumentDataMargin(n){const{t:r,l:s,b:i,r:o}=n,{documentStyle:a}=this.snapshot;r!=null&&(a.marginTop=r),s!=null&&(a.marginLeft=s),i!=null&&(a.marginBottom=i),o!=null&&(a.marginRight=o)}updateDocumentDataPageSize(n,r){const{documentStyle:s}=this.snapshot;if(!s.pageSize){n=n!=null?n:Number.POSITIVE_INFINITY,r=r!=null?r:Number.POSITIVE_INFINITY,s.pageSize={width:n,height:r};return}n!==void 0&&(s.pageSize.width=n),r!==void 0&&(s.pageSize.height=r)}updateDrawing(n,r){const{drawings:s}=this,{width:i,height:o,left:a,top:l}=r,u=s==null?void 0:s[n];if(!u)return;const c=u.docTransform;c.size.width=i,c.size.height=o,c.positionH.posOffset=a,c.positionV.posOffset=l}setZoomRatio(n=1){this.snapshot.settings==null?this.snapshot.settings={zoomRatio:n}:this.snapshot.settings.zoomRatio=1}setDisabled(n){this.snapshot.disabled=n}getDisabled(){return this.snapshot.disabled}getTitle(){return this.snapshot.title}}class Nt extends K_{constructor(n){var s,i;super(re.isEmptyObject(n)?h_():n);C(this,"_unitId");C(this,"headerModelMap",new Map);C(this,"footerModelMap",new Map);C(this,"change$",new Oe.BehaviorSubject(0));const r=6;this._unitId=(s=this.snapshot.id)!=null?s:re.generateRandomId(r),this._initializeHeaderFooterModel(),this._name$.next((i=this.snapshot.title)!=null?i:"")}dispose(){super.dispose(),this.headerModelMap.forEach(n=>{n.dispose()}),this.footerModelMap.forEach(n=>{n.dispose()}),this._name$.complete()}getDrawings(){return this.snapshot.drawings}getDrawingsOrder(){return this.snapshot.drawingsOrder}getCustomRanges(){var n;return(n=this.snapshot.body)==null?void 0:n.customRanges}getCustomDecorations(){var n;return(n=this.snapshot.body)==null?void 0:n.customDecorations}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={...Ei,...n},this._initializeHeaderFooterModel(),this.change$.next(this.change$.value+1)}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(!Bt.isNoop(n))return this.snapshot=Bt.apply(this.snapshot,n),n!=null&&n.some(r=>Array.isArray(r)&&((r==null?void 0:r[0])==="headers"||(r==null?void 0:r[0])==="footers"))&&(this.headerModelMap.clear(),this.footerModelMap.clear(),this._initializeHeaderFooterModel()),this.change$.next(this.change$.value+1),this.snapshot}sliceBody(n,r,s=pi.copy){const i=this.getBody();if(i!=null)return yt(i,n,r,!1,s)}_initializeHeaderFooterModel(){const{headers:n,footers:r}=this.getSnapshot();if(n)for(const s in n){const i=n[s];this.headerModelMap.set(s,new Nt(i)),this.headerModelMap.get(s).updateDocumentId(this.getUnitId())}if(r)for(const s in r){const i=r[s];this.footerModelMap.set(s,new Nt(i)),this.footerModelMap.get(s).updateDocumentId(this.getUnitId())}}updateDocumentId(n){super.updateDocumentId(n),this._unitId=n}getPlainText(){var n,r;return es((r=(n=this.getBody())==null?void 0:n.dataStream)!=null?r:"")}}function X_(e){const{ranges:t,id:n,type:r}=e,s=new Ye;let i=0;for(let o=0;o<t.length;o++){const a=t[o],{startOffset:l,endOffset:u}=a;l>0&&s.push({t:he.RETAIN,len:l-i}),s.push({t:he.RETAIN,body:{dataStream:"",customDecorations:[{id:n,type:r,startIndex:0,endIndex:u-l-1}]},len:u-l}),i=u}return s}function q_(e){var c,h,d;const{id:t,segmentId:n,documentDataModel:r}=e,s=r==null?void 0:r.getBody();if(!r||!s)return!1;const i=(d=(h=(c=r.getSelfOrHeaderFooterModel(n))==null?void 0:c.getBody())==null?void 0:h.customDecorations)==null?void 0:d.find(f=>f.id===t);if(!i)return!1;const o=new Ye,{startIndex:a,endIndex:l}=i,u=l-a+1;return o.push({t:he.RETAIN,len:a}),o.push({t:he.RETAIN,len:u,body:{dataStream:"",customDecorations:[{startIndex:0,endIndex:u-1,id:t,type:sn.DELETED}]}}),o}function su(e,t,n,r){return e<=n&&t>=n||e>=n&&e<=r}function J_(e,t){const n=[];for(let r=0,s=t.length;r<s;r++){const i=t[r];e.collapsed?i.startIndex<e.startOffset&&e.startOffset<=i.endIndex&&n.push(i):su(e.startOffset,e.endOffset-1,i.startIndex,i.endIndex)&&n.push(i)}return n}function Z_(e){return{...re.deepClone(e),rangeId:Ft()}}function Q_(e,t){const n=[];let r=e[0];for(const s of t)s<e[0]||s>e[1]||(r<s&&n.push([r,s-1]),r=s+1);return r<=e[1]&&n.push([r,e[1]]),n}function iu(e,t,n,r){const s=[];for(let i=0,o=n.length;i<o;i++){const a=n[i];if((r===void 0||a.rangeType===r)&&Math.max(a.startIndex,e)<=Math.min(a.endIndex,t)&&s.push({...a}),a.startIndex>t)break}return s}function ep(e,t){var i,o,a,l,u;const n=iu(e.startOffset,e.collapsed?e.startOffset:e.endOffset-1,(i=t.customRanges)!=null?i:[]),r=Math.min(e.startOffset,(a=(o=n[0])==null?void 0:o.startIndex)!=null?a:1/0),s=Math.max(e.endOffset,((u=(l=n[n.length-1])==null?void 0:l.endIndex)!=null?u:-1/0)+1);return{startOffset:r,endOffset:s,collapsed:r===s}}function tp(e){var h,d,f;const{rangeId:t,segmentId:n,documentDataModel:r,insert:s}=e,i=(d=(h=r.getSelfOrHeaderFooterModel(n).getBody())==null?void 0:h.customRanges)==null?void 0:d.find(p=>p.rangeId===t);if(!i)return!1;const{startIndex:o,endIndex:a}=i,l=new Ye,u=a-o+1;l.push({t:he.RETAIN,len:o}),l.push({t:he.RETAIN,len:u,body:{dataStream:"",customRanges:[]}}),s&&l.push({t:he.INSERT,body:s,len:s.dataStream.length});const c=a+1+((f=s==null?void 0:s.dataStream.length)!=null?f:0);return l.selections=[{startOffset:c,endOffset:c,collapsed:!0}],l}function np(e){const{ranges:t,rangeId:n,rangeType:r,wholeEntity:s,properties:i,body:o}=e;let a=0;const l=new Ye;let u=!1;return t.forEach(c=>{var W,se,y;const h=ep(c,o);if(!h||!o)return!1;const{startOffset:d,endOffset:f}=h,p=(W=o.customRanges)!=null?W:[],R=(A,j,Z)=>{var v,D,b,O;const fe=iu(A,j,p,r),le=Math.min((D=(v=fe[0])==null?void 0:v.startIndex)!=null?D:1/0,A),_=Math.max((O=(b=fe[fe.length-1])==null?void 0:b.endIndex)!=null?O:-1/0,j),H={rangeId:Z?`${n}$${Z}`:n,rangeType:r,startIndex:0,endIndex:_-le,wholeEntity:s,properties:{...i}};l.push({t:he.RETAIN,len:le-a}),l.push({t:he.RETAIN,len:_-le+1,body:{dataStream:"",customRanges:[H]},coverType:xe.COVER}),a=_+1},w=((se=o.paragraphs)!=null?se:[]).filter(A=>A.startIndex<f&&A.startIndex>d),N=((y=o.customBlocks)!=null?y:[]).filter(A=>A.startIndex<f&&A.startIndex>d);Q_([d,f-1],[...w.map(A=>A.startIndex),...N.map(A=>A.startIndex)]).forEach(([A,j],Z)=>R(A,j,Z)),u=!0,l.selections=[{startOffset:h.endOffset,endOffset:h.endOffset,collapsed:!0}]}),u?l:!1}function ou(e,t,n=0,r=null,s=!0){e.sort((u,c)=>u.startOffset-c.startOffset);const i=[],{paragraphs:o=[]}=t,a=o==null?void 0:o.find(u=>u.startIndex>=e[0].startOffset&&u.startIndex<e[0].endOffset);let l=n;if(e.forEach(u=>{const{startOffset:c,endOffset:h}=u;c>l&&(i.push({t:he.RETAIN,len:c-l}),l=c),l<h&&(i.push({t:he.DELETE,len:h-l}),l=h)}),r&&i.push({t:he.INSERT,body:r,len:r.dataStream.length}),a&&s){const u=o.find(c=>c.startIndex-n>=e[e.length-1].endOffset-1);u&&(u.startIndex>l&&(i.push({t:he.RETAIN,len:u.startIndex-l}),l=u.startIndex),i.push({t:he.RETAIN,len:1,body:{dataStream:"",paragraphs:[{...u,startIndex:0,bullet:a==null?void 0:a.bullet}]},coverType:xe.REPLACE}))}return i}function rp(e,t,n=0){const r=[];let s=n;return e.forEach(i=>{const{startOffset:o,endOffset:a}=i;o>s&&(r.push({t:he.RETAIN,len:o-s}),s=o),a>s&&(r.push({t:he.RETAIN,len:a-s,body:{...re.deepClone(t),dataStream:""}}),s=a)}),r}const sp=e=>{var h;const{selection:t,body:n,doc:r}=e,s=t.segmentId,i=(h=r.getSelfOrHeaderFooterModel(s))==null?void 0:h.getBody();if(!i)return!1;const o=t.collapsed?null:yt(i,t.startOffset,t.endOffset),a=gi(o?o.dataStream:"",n.dataStream);let l=0;const u=a.map(([d,f])=>{switch(d){case 0:{const p={t:he.RETAIN,body:{...yt(n,l,l+f.length,!1),dataStream:""},len:f.length};return l+=f.length,p}case 1:{const p={t:he.INSERT,body:yt(n,l,l+f.length),len:f.length};return l+=f.length,p}default:return{t:he.DELETE,len:f.length}}}),c=new Ye;return c.push({t:he.RETAIN,len:t.startOffset}),c.push(...u),c};function ip(e,t){return!!((e==null?void 0:e.length)===(t==null?void 0:t.length)&&(e!=null&&e.every((n,r)=>JSON.stringify(n)===JSON.stringify(t==null?void 0:t[r]))))}const op=e=>{var h;const{selection:t,body:n,doc:r}=e,s=t.segmentId,i=(h=r.getSelfOrHeaderFooterModel(s))==null?void 0:h.getBody();if(!i)return!1;const o=t.collapsed?null:yt(i,t.startOffset,t.endOffset),a=gi(o?o.dataStream:"",n.dataStream);let l=0;const u=a.map(([d,f])=>{switch(d){case 0:{const p=Vr(n,l,l+f.length,!1),R=Vr(o,l,l+f.length,!1),w={t:he.RETAIN,body:ip(p,R)?void 0:{textRuns:p,dataStream:""},len:f.length};return l+=f.length,w}case 1:{const p={t:he.INSERT,body:yt(n,l,l+f.length),len:f.length};return l+=f.length,p}default:return{t:he.DELETE,len:f.length}}});if(u.every(d=>d.t===he.RETAIN&&!d.body))return!1;const c=new Ye;return c.push({t:he.RETAIN,len:t.startOffset}),c.push(...u),c};function ap(e,t){const n=[],{customBlocks:r=[]}=e;for(const s of t){const{startOffset:i,endOffset:o}=s;if(!(i==null||o==null))for(const a of r){const{startIndex:l}=a;l>=i&&l<o&&n.push(a.blockId)}}return n}function lp(e,t=""){if(!t)return["body"];const{headers:n,footers:r}=e.getSnapshot();if(n==null&&r==null)throw new Error("Document data model must have headers or footers when update by segment id");if((n==null?void 0:n[t])!=null)return["headers",t,"body"];if((r==null?void 0:r[t])!=null)return["footers",t,"body"];throw new Error("Segment id not found in headers or footers")}const up=e=>{var R,w,N,z;const{selection:t,documentDataModel:n,drawings:r}=e,{collapsed:s,startOffset:i,segmentId:o}=t,a=new Ye,l=Bt.getInstance(),u=[],c=n.getSelfOrHeaderFooterModel(o).getBody();if(!c)return!1;const h=(w=(R=n.getSnapshot().drawingsOrder)==null?void 0:R.length)!=null?w:0;let d=0;if(s)i>0&&a.push({t:he.RETAIN,len:i});else{const W=ou([t],c,0,null,!1);a.push(...W);const se=ap(c,[t]),y=(N=n.getDrawings())!=null?N:{},A=(z=n.getDrawingsOrder())!=null?z:[],j=se.sort((Z,fe)=>A.indexOf(Z)>A.indexOf(fe)?-1:A.indexOf(Z)<A.indexOf(fe)?1:0);if(j.length>0)for(const Z of j){const fe=y[Z],le=A.indexOf(Z);if(fe==null||le<0)continue;const _=l.removeOp(["drawings",Z],fe),H=l.removeOp(["drawingsOrder",le],Z);u.push(_),u.push(H),d++}}a.push({t:he.INSERT,body:{dataStream:"\b".repeat(r.length),customBlocks:r.map((W,se)=>({startIndex:se,blockId:W.drawingId}))},len:r.length});const f=lp(n,o),p=l.editOp(a.serialize(),f);u.push(p);for(const W of r){const{drawingId:se}=W,y=l.insertOp(["drawings",se],W),A=l.insertOp(["drawingsOrder",h-d],se);u.push(y),u.push(A)}return u.reduce((W,se)=>Bt.compose(W,se),null)};function cp(e,t){if(typeof t>"u")return{startOffset:e,endOffset:e,collapsed:!0};if(t<e)throw new Error(`Cannot make a doc selection when endOffset ${t} is less than startOffset ${e}.`);return{startOffset:e,endOffset:t,collapsed:e===t}}function hp(e){const{startOffset:t,endOffset:n,collapsed:r}=e,s=Math.min(t,n),i=Math.max(t,n);return{startOffset:s,endOffset:i,collapsed:r}}function dp(e,t,n,r){return Math.max(e,n)<=Math.min(t,r)}function Ys(e,t,n,r){const{startOffset:s,endOffset:i}=e,o=r!=null?r:Ci(t,n),a=[];let l=-1;for(let u=0;u<o.length;u++){const c=o[u],{startIndex:h}=c;(s>l&&s<=h||i>l&&i<=h||h>=s&&h<=i)&&a.push(c),l=h}return a}function Gs(e,t,n){const r=[],s=Ci(t,n);for(const i of e){const o=Ys(i,t,n,s);r.push(...o)}return r}const fp=[_t.PARAGRAPH,_t.TABLE_START,_t.TABLE_END,_t.TABLE_ROW_START,_t.TABLE_CELL_START,_t.TABLE_CELL_END];function Ci(e,t){const n=[];for(let r=0;r<e.length;r++){const s=e[r],{startIndex:i}=s;let o=i-1;for(;!fp.includes(t[o])&&o>=0;)o--;n.push({...s,paragraphStart:o+1,paragraphEnd:s.startIndex})}return n}const gp=e=>{var h,d,f;const{paragraphs:t,segmentId:n,document:r}=e;let s=e.listType;const i=(d=(h=r.getSelfOrHeaderFooterModel(n).getBody())==null?void 0:h.paragraphs)!=null?d:[],o=t.every(p=>{var R;return((R=p.bullet)==null?void 0:R.listType.indexOf(s))===0});let l=re.generateRandomId(6);if(t.length===1){const p=i.indexOf(t[0]),R=i[p-1],w=i[p+1];R&&R.bullet&&R.bullet.listType.indexOf(s)===0?(l=R.bullet.listId,s!==xt.CHECK_LIST&&(s=R.bullet.listType)):w&&w.bullet&&w.bullet.listType.indexOf(s)===0&&(l=w.bullet.listId,s!==xt.CHECK_LIST&&(s=w.bullet.listType))}const u=new dn;u.reset();const c=new Ye;for(const p of t){const{startIndex:R,paragraphStyle:w={},bullet:N}=p;c.push({t:he.RETAIN,len:R-u.cursor}),c.push({t:he.RETAIN,len:1,body:{dataStream:"",paragraphs:[o?{paragraphStyle:w,startIndex:0}:{startIndex:0,paragraphStyle:{...w},bullet:{nestingLevel:(f=N==null?void 0:N.nestingLevel)!=null?f:0,textStyle:{fs:20},listType:s,listId:l}}]},coverType:xe.REPLACE}),u.moveCursorTo(R+1)}return c},mp=e=>{var h;const{paragraphIndex:t,segmentId:n,document:r}=e,s=(h=r.getSelfOrHeaderFooterModel(n).getBody())==null?void 0:h.paragraphs;if(s==null)return!1;const i=s.find(d=>d.startIndex===t);if(!(i!=null&&i.bullet)||i.bullet.listType.indexOf(xt.CHECK_LIST)===-1)return!1;const o=new dn;o.reset();const a=new Ye,{startIndex:l,paragraphStyle:u={}}=i,c=i.bullet.listType===xt.CHECK_LIST?xt.CHECK_LIST_CHECKED:xt.CHECK_LIST;return a.push({t:he.RETAIN,len:l-o.cursor}),a.push({t:he.RETAIN,len:1,body:{dataStream:"",paragraphs:[{...i,paragraphStyle:u,startIndex:0,bullet:{...i.bullet,listType:c}}]},coverType:xe.REPLACE}),o.moveCursorTo(l+1),a},_p=e=>{var c,h;const{paragraphs:t,listType:n,segmentId:r,document:s}=e;if(((c=s.getSelfOrHeaderFooterModel(r).getBody())==null?void 0:c.paragraphs)==null)return!1;const a=re.generateRandomId(6),l=new dn;l.reset();const u=new Ye;for(const d of t){const{startIndex:f,paragraphStyle:p={},bullet:R}=d;u.push({t:he.RETAIN,len:f-l.cursor}),u.push({t:he.RETAIN,len:1,body:{dataStream:"",paragraphs:[{startIndex:0,paragraphStyle:p,bullet:{nestingLevel:(h=R==null?void 0:R.nestingLevel)!=null?h:0,textStyle:(R==null?void 0:R.listType)===n?R.textStyle:{fs:20},listType:n,listId:a}}]},coverType:xe.REPLACE}),l.moveCursorTo(f+1)}return u};function pp(e,t){return t.some(n=>e.startIndex>n.startIndex&&e.startIndex<n.endIndex)}const Ep=e=>{var u,c,h;const{paragraphs:t,document:n,type:r}=e,s=new dn;s.reset();const i=new Ye,o=(u=n.getSnapshot().lists)!=null?u:{},a=(h=(c=n.getBody())==null?void 0:c.tables)!=null?h:[],l={...hr,...o};for(const d of t){const{startIndex:f,paragraphStyle:p={},bullet:R}=d,w=pp(d,a);if(i.push({t:he.RETAIN,len:f-s.cursor}),R){const N=R.listType;let z=l[N].nestingLevel.length-1;w&&(z=Math.min(z,2)),i.push({t:he.RETAIN,len:1,body:{dataStream:"",paragraphs:[{startIndex:0,paragraphStyle:{...p},bullet:{...R,nestingLevel:Math.max(Math.min(R.nestingLevel+r,z),0)}}]},coverType:xe.REPLACE})}else i.push({t:he.RETAIN,len:1});s.moveCursorTo(f+1)}return i},Cp=e=>{var w,N,z,W;const{textRanges:t,segmentId:n,document:r,style:s,paragraphTextRun:i,cursor:o,deleteLen:a,textX:l}=e,u=r.getSelfOrHeaderFooterModel(n),c=(N=(w=u.getBody())==null?void 0:w.paragraphs)!=null?N:[],h=(W=(z=u.getBody())==null?void 0:z.dataStream)!=null?W:"",d=Gs(t,c,h),f=new dn;o&&f.moveCursorTo(o);const p=l!=null?l:new Ye;d.sort((se,y)=>se.startIndex-y.startIndex);const R=Math.max(0,d[0].paragraphStart-1);R>f.cursor&&(p.push({t:he.RETAIN,len:R-f.cursor}),f.moveCursorTo(R)),a&&p.push({t:he.DELETE,len:a});for(const se of d){const{startIndex:y,paragraphStyle:A={}}=se,j=y-f.cursor;p.push({t:he.RETAIN,len:j,...i?{body:{dataStream:"",textRuns:[{ts:i,st:0,ed:j}]},coverType:xe.REPLACE}:null}),p.push({t:he.RETAIN,len:1,body:{dataStream:"",paragraphs:[{startIndex:0,paragraphStyle:{...A,...s}}]},coverType:xe.REPLACE}),f.moveCursorTo(y+1)}return p};class ot{}C(ot,"customRange",{add:np,delete:tp,copyCustomRange:Z_,getCustomRangesInterestsWithSelection:J_,isIntersecting:su}),C(ot,"customDecoration",{add:X_,delete:q_}),C(ot,"selection",{replace:sp,makeSelection:cp,normalizeSelection:hp,delete:ou,replaceTextRuns:op,retain:rp}),C(ot,"range",{isIntersects:dp,getParagraphsInRange:Ys,getParagraphsInRanges:Gs}),C(ot,"transform",{getPlainText:es,fromPlainText:nf,isEmptyDocument:tf}),C(ot,"paragraph",{bullet:{set:_p,switch:gp,toggleChecklist:mp,changeNestLevel:Ep},style:{set:Cp},util:{transform:Ci,getParagraphsInRange:Ys,getParagraphsInRanges:Gs}}),C(ot,"drawing",{add:up});function Rp(e){if(e.customRanges||(e.customRanges=[]),!e.paragraphs){e.paragraphs=[];for(let t=0;t<e.dataStream.length;t++)e.dataStream[t]==="\r"&&e.paragraphs.push({startIndex:t})}return e.customBlocks||(e.customBlocks=[]),e.textRuns||(e.textRuns=[]),e.customDecorations||(e.customDecorations=[]),e.sectionBreaks||(e.sectionBreaks=[]),e.tables||(e.tables=[]),e}function au(e){var t;return e.body=Rp((t=e.body)!=null?t:{dataStream:""}),e.drawingsOrder||(e.drawingsOrder=[]),e.drawings||(e.drawings={}),e.documentStyle||(e.documentStyle={}),e}class dr{constructor(t={}){C(this,"_style");this._style=t}static create(t={}){return new dr(t)}get fontFamily(){return this._style.ff}get fontSize(){return this._style.fs}get italic(){return this._style.it===Ie.TRUE}get bold(){return this._style.bl===Ie.TRUE}get underline(){return this._style.ul&&zt.create(this._style.ul)}get bottomBorderLine(){return this._style.bbl&&zt.create(this._style.bbl)}get strikethrough(){return this._style.st&&zt.create(this._style.st)}get overline(){return this._style.ol&&zt.create(this._style.ol)}get background(){return this._style.bg}get border(){return this._style.bd}get color(){return this._style.cl}get verticalAlign(){return this._style.va}get numberFormat(){return this._style.n}copy(){return qt.create(re.deepClone(this._style))}getValue(){return{...this._style}}}class qt extends dr{static create(t={}){return new qt(t)}constructor(t={}){super(t)}setFontFamily(t){return this._style.ff=t,this}setFontSize(t){return this._style.fs=t,this}setItalic(t){return this._style.it=t?1:0,this}setBold(t){return this._style.bl=t?1:0,this}setUnderline(t){return this._style.ul=t.build(),this}setBottomBorderLine(t){return this._style.bbl=t.build(),this}setStrikethrough(t){return this._style.st=t.build(),this}setOverline(t){return this._style.ol=t.build(),this}setBackground(t){return this._style.bg=t,this}setBorder(t){return this._style.bd=t,this}setColor(t){return this._style.cl=t,this}setVerticalAlign(t){return this._style.va=t,this}copy(){return qt.create(re.deepClone(this._style))}build(){return this.getValue()}}class zt{constructor(t={s:1}){C(this,"_decoration");this._decoration=t}static create(t={s:1}){return new zt(t)}get show(){return this._decoration.s===Ie.TRUE}get followFontColor(){return this._decoration.c===Ie.TRUE}get color(){return this._decoration.cl}get type(){return this._decoration.t}setShow(t){return this._decoration.s=t?1:0,this}setFollowFontColor(t){return this._decoration.c=t?1:0,this}setColor(t){return this._decoration.cl=t,this}setLineType(t){return this._decoration.t=t,this}copy(){return zt.create(re.deepClone(this._decoration))}build(){return{...this._decoration}}}class fr{constructor(t={}){C(this,"_style");this._style=t}static create(t={}){return new fr(t)}get indentFirstLine(){return this._style.indentFirstLine}get hanging(){return this._style.hanging}get indentStart(){return this._style.indentStart}get tabStops(){return this._style.tabStops}get indentEnd(){return this._style.indentEnd}get textStyle(){return this._style.textStyle}get headingId(){return this._style.headingId}get namedStyleType(){return this._style.namedStyleType}get horizontalAlign(){return this._style.horizontalAlign}get lineSpacing(){return this._style.lineSpacing}get direction(){return this._style.direction}get spacingRule(){return this._style.spacingRule}get snapToGrid(){return this._style.snapToGrid}get spaceAbove(){return this._style.spaceAbove}get spaceBelow(){return this._style.spaceBelow}get borderBetween(){return this._style.borderBetween}get borderTop(){return this._style.borderTop}get borderBottom(){return this._style.borderBottom}get borderLeft(){return this._style.borderLeft}get borderRight(){return this._style.borderRight}get keepLines(){return this._style.keepLines===Ie.TRUE}get keepNext(){return this._style.keepNext===Ie.TRUE}get wordWrap(){return this._style.wordWrap===Ie.TRUE}get widowControl(){return this._style.widowControl===Ie.TRUE}get shading(){return this._style.shading}get suppressHyphenation(){return this._style.suppressHyphenation===Ie.TRUE}copy(){return Qn.create(re.deepClone(this._style))}getValue(){return this._style}}class Qn extends fr{static create(t={}){return new Qn(t)}constructor(t={}){super(t)}setIndentFirstLine(t){return this._style.indentFirstLine=t,this}setHanging(t){return this._style.hanging=t,this}setIndentStart(t){return this._style.indentStart=t,this}setTabStops(t){return this._style.tabStops=t,this}setIndentEnd(t){return this._style.indentEnd=t,this}setTextStyle(t){return this._style.textStyle=t,this}setHeadingId(t){return this._style.headingId=t,this}setNamedStyleType(t){return this._style.namedStyleType=t,this}setHorizontalAlign(t){return this._style.horizontalAlign=t,this}setLineSpacing(t){return this._style.lineSpacing=t,this}setDirection(t){return this._style.direction=t,this}setSpacingRule(t){return this._style.spacingRule=t,this}setSnapToGrid(t){return this._style.snapToGrid=t?1:0,this}setSpaceAbove(t){return this._style.spaceAbove=t,this}setSpaceBelow(t){return this._style.spaceBelow=t,this}setBorderBetween(t){return this._style.borderBetween=t,this}setBorderTop(t){return this._style.borderTop=t,this}setBorderBottom(t){return this._style.borderBottom=t,this}setBorderLeft(t){return this._style.borderLeft=t,this}setBorderRight(t){return this._style.borderRight=t,this}setKeepLines(t){return this._style.keepLines=t?1:0,this}setKeepNext(t){return this._style.keepNext=t?1:0,this}setWordWrap(t){return this._style.wordWrap=t?1:0,this}setWidowControl(t){return this._style.widowControl=t?1:0,this}setShading(t){return this._style.shading=t,this}setSuppressHyphenation(t){return this._style.suppressHyphenation=t?1:0,this}copy(){return Qn.create(re.deepClone(this._style))}build(){return this.getValue()}}class Vt{constructor(t){C(this,"_data");if(!t.body)throw new Error("Invalid document data, body is required");this._data=au(t)}static create(t){return new Vt(t)}static createByBody(t){return new Vt({body:t,id:"d",documentStyle:{}})}copy(){return on.create(re.deepClone(this._data))}slice(t,n){const{body:r,...s}=this._data;return on.create({...re.deepClone(s),body:yt(r,t,n)})}toPlainText(){var t,n;return ot.transform.getPlainText((n=(t=this._data.body)==null?void 0:t.dataStream)!=null?n:"").replaceAll("\r",`
7
+ `)}getParagraphStyle(){var t,n;return fr.create((n=(t=this._data.body)==null?void 0:t.paragraphs)==null?void 0:n[0].paragraphStyle)}getParagraphBullet(){var t,n;return(n=(t=this._data.body)==null?void 0:t.paragraphs)==null?void 0:n[0].bullet}getParagraphs(){var r,s;const t=(s=(r=this._data.body)==null?void 0:r.paragraphs)!=null?s:[];let n=0;return t.map(i=>{const o=this.slice(n,i.startIndex);return n=i.startIndex,o})}getTextRuns(){var t,n;return((n=(t=this._data.body)==null?void 0:t.textRuns)!=null?n:[]).map(r=>({...r,ts:r.ts?dr.create(r.ts):null}))}getLinks(){var t,n,r;return(r=(n=(t=this._data.body)==null?void 0:t.customRanges)==null?void 0:n.filter(s=>s.rangeType===Jt.HYPERLINK))!=null?r:[]}getData(){return this._data}}class on extends Vt{constructor(n){super(n);C(this,"_doc");this._doc=new Nt(n)}static newEmptyData(){return au({id:"d",documentStyle:{},drawings:{},drawingsOrder:[],body:{dataStream:`\r
8
+ `,customBlocks:[],customRanges:[],paragraphs:[{startIndex:0}],textRuns:[],tables:[],sectionBreaks:[]}})}static create(n){return new on(n!=null?n:on.newEmptyData())}insertText(n,r,s){var c,h;let i=((h=(c=this._data.body)==null?void 0:c.dataStream.length)!=null?h:2)-2,o,a;if(typeof n=="string"?o=n:(i=Math.min(n,i),o=r),typeof r=="object"?a=r instanceof qt?r.build():r:a=s instanceof qt?s.build():s,!o)return this;const l={dataStream:o,textRuns:a?[{ts:a,st:i,ed:i+o.length}]:[]},u=ot.selection.replace({doc:this._doc,selection:{startOffset:i,endOffset:i,collapsed:!0},body:l});if(!u)throw new Error("Insert text failed, please check.");return Ye.apply(this._doc.getBody(),u.serialize()),this}insertRichText(n,r){var a,l;let s=((l=(a=this._data.body)==null?void 0:a.dataStream.length)!=null?l:2)-2,i;typeof n=="object"?i=n instanceof Vt?n.getData():n:(s=Math.min(n,s),i=r instanceof Vt?r.getData():r);const o=ot.selection.replace({doc:this._doc,selection:{startOffset:s,endOffset:s,collapsed:!0},body:i.body});if(!o)throw new Error("Insert text failed, please check.");return Ye.apply(this._doc.getBody(),o.serialize()),this}delete(n,r){if(r!==void 0){if(!r)return this;const s=ot.selection.delete([{startOffset:n,endOffset:n+r,collapsed:!0}],this._data.body);Ye.apply(this._doc.getBody(),s)}return this}setStyle(n,r,s){const i={dataStream:"",textRuns:[{ts:s instanceof qt?s.build():s,st:0,ed:r-n}]},o=ot.selection.retain([{startOffset:n,endOffset:r,collapsed:!0}],i);return Ye.apply(this._doc.getBody(),o),this}setLink(n,r,s){const i=ot.customRange.add({rangeType:Jt.HYPERLINK,rangeId:Ft(),properties:{url:s},ranges:[{startOffset:n,endOffset:r,collapsed:!1}],body:this._data.body});if(!i)throw new Error("Insert text failed, please check.");return Ye.apply(this._doc.getBody(),i.serialize()),this}cancelLink(n,r){if(typeof n=="string"){const s=ot.customRange.delete({rangeId:n,documentDataModel:this._doc});if(!s)throw new Error("Insert text failed, please check.");Ye.apply(this._doc.getBody(),s.serialize())}else this.slice(n,r).getLinks().forEach(i=>{const o=ot.customRange.delete({rangeId:i.rangeId,documentDataModel:this._doc});if(!o)throw new Error("Insert text failed, please check.");Ye.apply(this._doc.getBody(),o.serialize())});return this}updateLink(n,r){var i,o;const s=(o=(i=this._data.body)==null?void 0:i.customRanges)==null?void 0:o.find(a=>a.rangeId===n);if(!s)throw new Error("Link not found");return s.properties.url=r,this}insertParagraph(n,r){var o,a;let s,i;return typeof n=="object"?(s={dataStream:"\r",paragraphs:[{startIndex:0,paragraphStyle:n.build()}]},i=((a=(o=this._data.body)==null?void 0:o.dataStream.length)!=null?a:2)-2):(i=n,s={dataStream:"\r",paragraphs:[{startIndex:0,paragraphStyle:r==null?void 0:r.build()}]}),this.insertRichText(i,Vt.create({body:s,id:"d",documentStyle:{}})),this}insertLink(n,r,s){let i="",o="";typeof n=="string"?(i=n,o=r):(i=r,o=s);const a=on.createByBody({dataStream:i,customRanges:[{rangeType:Jt.HYPERLINK,rangeId:Ft(),properties:{url:o},startIndex:0,endIndex:i.length-1}]});return typeof n=="number"?this.insertRichText(n,a):this.insertRichText(a)}}function Ip(e,t=16){let n=0,r=null;return function(...i){const o=Date.now();o-n<t?(r&&clearTimeout(r),r=setTimeout(()=>{n=o,e.apply(this,i)},t)):(n=o,e.apply(this,i))}}var vn=(e=>(e[e.Style=1]="Style",e[e.Value=2]="Value",e))(vn||{});function Sp(e){return`sheet_interceptor_${e}`}const lu=e=>function(t,n){let r=-1,s=t;for(let i=0;i<=e.length;i++){if(i<=r)throw new Error("[SheetInterceptorService]: next() called multiple times!");if(r=i,i===e.length)return s;const o=e[i];let a=!1;if(s=o.handler(s,n,l=>(a=!0,l)),!a)break}return s};class vp{constructor(t){C(this,"_interceptorsByName",new Map);C(this,"_interceptorPoints");this._interceptorPoints=t}fetchThroughInterceptors(t,n){const r=t;let s=this._interceptorsByName.get(r);return n&&(s=s.filter(n)),lu(s||[])}intercept(t,n){const r=t;this._interceptorsByName.has(r)||this._interceptorsByName.set(r,[]);const s=this._interceptorsByName.get(r);return s.push(n),this._interceptorsByName.set(r,s.sort((i,o)=>{var a,l;return((a=o.priority)!=null?a:0)-((l=i.priority)!=null?l:0)})),()=>nr(this._interceptorsByName.get(r),n)}getInterceptPoints(){return this._interceptorPoints}dispose(){this._interceptorsByName.clear()}}function Op(e){return`sheet_async_interceptor_${e}`}const wp=e=>async function(t,n){let r=-1,s=t;for(let i=0;i<=e.length;i++){if(i<=r)throw new Error("[SheetInterceptorService]: next() called multiple times!");if(r=i,i===e.length)return s;const o=e[i];let a=!1;if(s=await o.handler(s,n,async l=>(a=!0,l)),!a)break}return s};class bp{constructor(t){C(this,"_asyncInterceptorsByName",new Map);C(this,"_asyncInterceptorPoints");this._asyncInterceptorPoints=t}fetchThroughAsyncInterceptors(t,n){const r=t;let s=this._asyncInterceptorsByName.get(r);return n&&(s=s.filter(n)),wp(s||[])}async interceptAsync(t,n){const r=t;this._asyncInterceptorsByName.has(r)||this._asyncInterceptorsByName.set(r,[]);const s=this._asyncInterceptorsByName.get(r);return s.push(n),this._asyncInterceptorsByName.set(r,s.sort((i,o)=>{var a,l;return((a=o.priority)!=null?a:0)-((l=i.priority)!=null?l:0)})),()=>nr(this._asyncInterceptorsByName.get(r),n)}getInterceptPoints(){return this._asyncInterceptorPoints}dispose(){this._asyncInterceptorsByName.clear()}}function Ap(e,t){for(const n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}function uu(e){return/^-?\d+(\.\d+)?$/.test(e)}function Tp(e){return uu(e)?Number(e)<=Number.MAX_SAFE_INTEGER:!1}class Ri{constructor(){C(this,"_data",[])}static create(){return new Ri}add(t){this._data.indexOf(t)>-1||this._data.push(t)}delete(t){const n=this._data.indexOf(t);this._data.splice(n,1)}getData(){return this._data}}class Ii{constructor(){C(this,"_data",new Map)}static create(){return new Ii}add(t,n){this._data.has(t)||this._data.set(t,n)}delete(t){this._data.delete(t)}getData(){return this._data}}function yp(e){const t=new MessageChannel;let n=!1;const r=()=>{n||e()};return t.port1.onmessage=r,t.port2.postMessage(null),()=>{n=!0,t.port1.onmessage=null,t.port1.close(),t.port2.close()}}function Np(e,t){return t.forEach(n=>e.add(n)),e}function Mp(e,t,n,r){var u;if(t==="")return e;const s={id:"mock-id",body:e,documentStyle:{}},i=new Nt(s),o=t.length;let a;for(;(a=(r?i.getBody().dataStream:i.getBody().dataStream.toLowerCase()).indexOf(t))>=0;){const c=new Ye,h=Bt.getInstance();if(a>0&&c.retain(a),n.length>0){const d=i.sliceBody(a,a+o),f={dataStream:n};if(Array.isArray(d==null?void 0:d.textRuns)&&d.textRuns.length&&(f.textRuns=[{...d.textRuns[0],st:0,ed:n.length}]),(u=d==null?void 0:d.customRanges)!=null&&u.length){const p=d.customRanges[0];f.customRanges=[{...p,startIndex:0,endIndex:n.length-1}]}c.insert(n.length,f)}c.delete(o),i.apply(h.editOp(c.serialize()))}const l=i.getBody();return i.dispose(),l}const Dp="__default_document_sub_component_id20231101__";class cu{constructor(){C(this,"skipNextObservers",!1);C(this,"lastReturnValue");C(this,"isStopPropagation",!1)}stopPropagation(){this.isStopPropagation=!0}}class Lp extends Oe.Subject{constructor(){super(...arguments);C(this,"_sortedObservers",[])}subscribe(){throw new Error("[EventSubject]: please use `subscribeEvent` instead of `subscribe` method for `EventSubject`.")}next(){throw new Error("[EventSubject]: please use `emitEvent` instead of `next` method for `EventSubject`.")}unsubscribe(){super.unsubscribe(),this._sortedObservers.length=0}complete(){super.complete(),this._sortedObservers.length=0}subscribeEvent(n){let r;typeof n=="function"?r={next:([i,o])=>n(i,o)}:r=n;const s=super.subscribe(r);return this._sortedObservers.push(r),this._sortedObservers.sort((i,o)=>{var a,l;return((a=i.priority)!=null?a:0)-((l=o.priority)!=null?l:0)}),s.add(()=>this._sortedObservers=this._sortedObservers.filter(i=>i!==r)),s}clearObservers(){this._sortedObservers.forEach(n=>{var r;return(r=n.complete)==null?void 0:r.call(n)}),this._sortedObservers.length=0}emitEvent(n){var r;if(!this.closed){const s=new cu;s.lastReturnValue=n;for(const i of this._sortedObservers){const o=(r=i.next)==null?void 0:r.call(i,[n,s]);if(s.lastReturnValue=o,s.skipNextObservers)return{handled:!0,lastReturnValue:s.lastReturnValue,stopPropagation:s.isStopPropagation}}return{handled:this._sortedObservers.length>0,lastReturnValue:s.lastReturnValue,stopPropagation:s.isStopPropagation}}throw new Error("[EventSubject]: cannot emit event on a closed subject.")}}function xp(e){return new Oe.Observable(t=>{const n=e.subscribeEvent(r=>{t.next(r)});return()=>n.unsubscribe()})}const os=je.createIdentifier("core.resource-manager.service"),zs={[Lt.Editor]:"Editor",[Lt.Owner]:"Owner",[Lt.Reader]:"Reader",[Lt.UNRECOGNIZED]:"UNRECOGNIZED"},Kr=e=>e?{userID:`${zs[e]}_${re.generateRandomId(8)}`,name:zs[e],avatar:""}:{userID:"",name:"",avatar:"",anonymous:!0,canBindAnonymous:!1},Up=(e,t)=>e.startsWith(zs[t]);class er{constructor(){C(this,"_model",new Map);C(this,"_userChange$",new Oe.Subject);C(this,"userChange$",this._userChange$.asObservable());C(this,"_currentUser$",new Oe.BehaviorSubject(Kr()));C(this,"currentUser$",this._currentUser$.asObservable())}getCurrentUser(){return this._currentUser$.getValue()}setCurrentUser(t){this.addUser(t),this._currentUser$.next(t)}addUser(t){this._model.set(t.userID,t),this._userChange$.next({type:"add",user:t})}getUser(t,n){const r=this._model.get(t);if(r)return r;n&&n()}delete(t){const n=this.getUser(t);this._model.delete(t),n&&this._userChange$.next({type:"delete",user:n})}clear(){this._model.clear(),this._userChange$.next({type:"clear"})}list(){return Array.from(this._model.values())}}var Pp=Object.getOwnPropertyDescriptor,kp=(e,t,n,r)=>{for(var s=r>1?void 0:r?Pp(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Ao=(e,t)=>(n,r)=>t(n,r,e);exports.AuthzIoLocalService=class{constructor(t,n){C(this,"_permissionMap",new Map([]));this._resourceManagerService=t,this._userManagerService=n,this._initSnapshot(),this._initDefaultUser()}_initDefaultUser(){const t=this._userManagerService.getCurrentUser();t&&t.userID||this._userManagerService.setCurrentUser(Kr(Lt.Owner))}_getRole(t){const n=this._userManagerService.getCurrentUser();return n?Up(n.userID,t):!1}_initSnapshot(){this._resourceManagerService.registerPluginResource({toJson:t=>{const n=[...this._permissionMap.keys()].reduce((r,s)=>{const i=this._permissionMap.get(s);return r[s]=i,r},{});return JSON.stringify(n)},parseJson:t=>JSON.parse(t),pluginName:"SHEET_AuthzIoMockService_PLUGIN",businesses:[Be.UNIVER_SHEET,Be.UNIVER_DOC,Be.UNIVER_SLIDE],onLoad:(t,n)=>{for(const r in n)this._permissionMap.set(r,n[r])},onUnLoad:()=>{this._permissionMap.clear()}})}async create(t){return Ft(8)}async allowed(t){return Promise.resolve([])}async batchAllowed(t){return Promise.resolve([])}async list(t){const n=[];return t.objectIDs.forEach(r=>{const s=this._permissionMap.get(r);if(s){const i={objectID:r,unitID:t.unitID,objectType:s.objectType,name:s.name,shareOn:!1,shareRole:Lt.Owner,shareScope:-1,scope:{read:Bs.AllCollaborator,edit:Bs.AllCollaborator},creator:Kr(Lt.Owner),strategies:[{action:6,role:1},{action:16,role:1},{action:17,role:1},{action:18,role:1},{action:19,role:1},{action:33,role:1},{action:34,role:1},{action:35,role:1},{action:36,role:1},{action:37,role:1},{action:38,role:1},{action:39,role:1},{action:40,role:1}],actions:t.actions.map(o=>({action:o,allowed:this._getRole(Lt.Owner)||this._getRole(Lt.Editor)}))};n.push(i)}}),n}async listCollaborators(){return[]}async listRoles(){return{roles:[],actions:[]}}async deleteCollaborator(){}async update(t){}async updateCollaborator(){}async createCollaborator(){}async putCollaborators(t){}};exports.AuthzIoLocalService=kp([Ao(0,os),Ao(1,je.Inject(er))],exports.AuthzIoLocalService);const hu=je.createIdentifier("IAuthzIoIoService");var Fp=Object.getOwnPropertyDescriptor,Bp=(e,t,n,r)=>{for(var s=r>1?void 0:r?Fp(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},$p=(e,t)=>(n,r)=>t(n,r,e);exports.MentionIOLocalService=class{constructor(t){this._userManagerService=t}async list(t){return{list:[{type:Br.PERSON,mentions:[{objectType:Br.PERSON,objectId:this._userManagerService.getCurrentUser().userID,label:this._userManagerService.getCurrentUser().name,metadata:{icon:this._userManagerService.getCurrentUser().avatar}}],metadata:{},title:"PEOPLE"}],page:t.page,size:t.size,total:1}}};exports.MentionIOLocalService=Bp([$p(0,je.Inject(er))],exports.MentionIOLocalService);const du=je.createIdentifier("univer.service.mention-io"),Si=je.createIdentifier("univer.config-service");class fu{constructor(){C(this,"_configChanged$",new Oe.Subject);C(this,"configChanged$",this._configChanged$.asObservable());C(this,"_config",new Map)}dispose(){this._configChanged$.complete()}getConfig(t){return this._config.get(t)}setConfig(t,n,r){var o;const{merge:s=!1}=r||{};let i=(o=this._config.get(t))!=null?o:{};s?i=fi(i,n):i=n,this._config.set(t,i),this._configChanged$.next({[t]:i})}deleteConfig(t){return this._config.delete(t)}subscribeConfigValue$(t){return new Oe.Observable(n=>{Object.prototype.hasOwnProperty.call(this._config,t)&&n.next(this._config.get(t));const r=this.configChanged$.pipe(Oe.filter(s=>Object.prototype.hasOwnProperty.call(s,t))).subscribe(s=>n.next(s[t]));return()=>r.unsubscribe()})}}const Yn="FOCUSING_UNIT",On="FOCUSING_SHEET",Gn="FOCUSING_DOC",zn="FOCUSING_SLIDE",Hp="FOCUSING_EDITOR_BUT_HIDDEN",gu="EDITOR_ACTIVATED",jp="FOCUSING_EDITOR_INPUT_FORMULA",mu="FOCUSING_FX_BAR_EDITOR",Wp="FOCUSING_UNIVER_EDITOR",Yp="FOCUSING_EDITOR_INPUT_FORMULA",Gp="FOCUSING_PANEL_EDITOR",zp="FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE",Vp="FOCUSING_COMMON_DRAWINGS",Kp="FORMULA_EDITOR_ACTIVATED";class _u extends st{constructor(){super(...arguments);C(this,"_error$",new Oe.Subject);C(this,"error$",this._error$.asObservable())}dispose(){this._error$.complete()}emit(n){this._error$.next({errorKey:n})}}const Xp="0.7.0-beta.0",qp={version:Xp};function Jp(e="",t=ir.ZH_CN,n=""){return{id:e,sheetOrder:[],name:n,appVersion:qp.version,locale:t,styles:{},sheets:{},resources:[]}}class pu{constructor(t={}){C(this,"_styles");C(this,"_cacheMap",new Jn(1e5));this._styles=t,this._generateCacheMap()}each(t){return Object.entries(this._styles).forEach(t),this}search(t,n){if(this._cacheMap.has(n))return this._cacheMap.get(n);const r=this._getExistingStyleId(t);return r||"-1"}get(t){return typeof t!="string"?t:(t=String(t),this._styles[t])}add(t,n){const r=re.generateRandomId(6);return this._styles[r]=t,this._cacheMap.set(n,r),r}setValue(t){if(t==null)return;const n=JSON.stringify(t),r=this.search(t,n);return r!=="-1"?r:this.add(t,n)}toJSON(){return this._styles}getStyleByCell(t){let n;t&&re.isObject(t.s)?n=t.s:n=(t==null?void 0:t.s)&&this.get(t.s);const r=t==null?void 0:t.interceptorStyle;return r?{...n,...r}:n}_generateCacheMap(){const{_styles:t,_cacheMap:n}=this;for(const r in t){const s=JSON.stringify(t[r]);n.set(s,r)}}_getExistingStyleId(t){const{_styles:n}=this;for(const r in n)if(re.diffValue(n[r],t))return r;return null}}const Zp=(e,t)=>t.length===e.length&&!e.some(n=>t.some(r=>!Zt.equals(r,n))),Qp=(e,t)=>t.length===e.length&&e.every((n,r)=>{const s=t[r];return s.unitId===n.unitId&&s.sheetId===n.sheetId&&Zt.equals(n.range,s.range)}),Vs={t:0,b:2,l:2,r:2},eE=e=>({sbr:.6,sbo:e,spr:.6,spo:e}),To=90;function Vn(e,t,n={}){const r=e.length,{textRotation:s,paddingData:i,horizontalAlign:o=At.UNSPECIFIED,verticalAlign:a=rn.UNSPECIFIED,wrapStrategy:l=ln.UNSPECIFIED,cellValueType:u}=n,{t:c,r:h,b:d,l:f}=i||Vs,{vertexAngle:p,centerAngle:R}=Ru(s),w={id:"d",body:{dataStream:`${e}${Aa}`,textRuns:[{ts:t,st:0,ed:r}],paragraphs:[{startIndex:r,paragraphStyle:{horizontalAlign:o}}],sectionBreaks:[{startIndex:r+1}]},documentStyle:{pageSize:{width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY},marginTop:c,marginBottom:d,marginRight:h,marginLeft:f,renderConfig:{horizontalAlign:o,verticalAlign:a,centerAngle:R,vertexAngle:p,wrapStrategy:l,cellValueType:u,zeroWidthParagraphBreak:1}},drawings:{},drawingsOrder:[]};return new Nt(w)}function tE(e){if(!e)return{};const{tr:t,td:n,ht:r,vt:s,tb:i,pd:o}=e;return{textRotation:t,textDirection:n,horizontalAlign:r,verticalAlign:s,wrapStrategy:i,paddingData:o}}function yo(e){if(!e)return{};const{ff:t,fs:n,it:r,bl:s,ul:i,st:o,ol:a,cl:l}=e,u={};return t&&(u.ff=t),n&&(u.fs=n),r&&(u.it=r),s&&(u.bl=s),i&&(u.ul=i),o&&(u.st=o),a&&(u.ol=a),l&&(u.cl=l),u}function Eu(e,t,n){var i;const r=e.getBody();if((i=r.customRanges)!=null&&i.some(o=>o.rangeType===Jt.HYPERLINK))return;const s=ot.customRange.add({ranges:[{startOffset:0,endOffset:r.dataStream.length-1,collapsed:!1}],rangeId:n,rangeType:Jt.HYPERLINK,body:r,properties:{url:t,refId:n}});s&&Ye.apply(r,s.serialize())}function Cu(e){return e!=null}const nE='"Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif';function No(e){const t=ut.ff,n=ut.fs;if(!e){const h=`${n}pt ${t}`;return{fontCache:h,fontString:h,fontSize:n,originFontSize:n,fontFamily:t}}let r=Sn.ITALIC;(e.it===0||e.it===void 0)&&(r=Sn.NORMAL);let s=Sn.BOLD;(e.bl===0||e.bl===void 0)&&(s=Sn.NORMAL);let i=n;e.fs&&(i=Math.ceil(e.fs));let o=t;if(e.ff){let h=e.ff;h=h.replace(/"/g,"").replace(/'/g,""),h.indexOf(" ")>-1&&(h=`"${h}"`),h==null&&(h=t),o=h}const{va:a}=e;let l=i;if(a===kt.SUBSCRIPT||a===kt.SUPERSCRIPT){const h=rE(o,l),{sbr:d,spr:f}=h;l*=a===kt.SUBSCRIPT?d:f}const u=`${r} ${s} ${l}pt ${o}`,c=`${u}, ${nE} `;return{fontCache:u,fontString:c,fontSize:l,originFontSize:i,fontFamily:o}}function rE(e,t){return eE(t)}function Ru(e){const{a:t=0,v:n=Ie.FALSE}=e||{a:0,v:Ie.FALSE};let r=0,s=t;return n===Ie.TRUE&&(r=To,s=To),{centerAngle:r,vertexAngle:s}}class sE{constructor(t,n){C(this,"_columnData",{});this._config=t,this._columnData=n}getColumnData(){return this._columnData}getColVisible(t){const{_columnData:n}=this,r=n[t];return r?r.hd!==Ie.TRUE:!0}getColumnStyle(t){var n;return(n=this._columnData[t])==null?void 0:n.s}setColumnStyle(t,n){const r=this.getColumnOrCreate(t);r.s=n}getHiddenCols(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getColVisible(o);s&&a?(s=!1,r.push({rangeType:Le.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!s&&!a&&(s=!0,i=o)}return s&&r.push({startRow:0,endRow:0,startColumn:i,endColumn:n,rangeType:Le.COLUMN}),r}getVisibleCols(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getColVisible(o);s&&!a?(s=!1,r.push({rangeType:Le.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!s&&a&&(s=!0,i=o)}return s&&r.push({startRow:0,endRow:0,startColumn:i,endColumn:n,rangeType:Le.COLUMN}),r}getColumnDatas(t,n){const r={};let s=0;for(let i=t;i<t+n;i++){const o=this.getColumnOrCreate(i);r[s]=o,s++}return r}getSize(){return Xt(this._columnData)}getColumnWidth(t){const{_columnData:n}=this,r=this._config;let s=0;return s=(n[t]||{hd:Ie.FALSE,w:r.defaultColumnWidth}).w||r.defaultColumnWidth,s}getColumn(t){const n=this._columnData[t];if(n)return n}removeColumn(t){delete this._columnData[t]}getColumnOrCreate(t){const{_columnData:n}=this,r=n[t];if(r)return r;const s={};return this._columnData[t]=s,s}setCustomMetadata(t,n){const r=this.getColumn(t);r&&(r.custom=n)}getCustomMetadata(t){var n;return(n=this.getColumn(t))==null?void 0:n.custom}}class iE{constructor(t,n,r){C(this,"_rowData");this._config=t,this._viewModel=n,this._rowData=r}getRowData(){return this._rowData}getRowStyle(t){var n;return(n=this._rowData[t])==null?void 0:n.s}setRowStyle(t,n){const r=this.getRowOrCreate(t);r.s=n}getRowDatas(t,n){const r={};let s=0;for(let i=t;i<t+n;i++){const o=this.getRowOrCreate(i);r[s]=o,s++}return r}getRowHeight(t,n=1){const{_rowData:r}=this,s=this._config;let i=0;for(let o=0;o<n;o++){const a=r[o+t]||{hd:Ie.FALSE,h:s.defaultRowHeight},{ia:l,ah:u,h:c=s.defaultRowHeight}=a;i+=(l==null||l===Ie.TRUE)&&typeof u=="number"?u:c}return i}getRow(t){return this._rowData[t]}removeRow(t){delete this._rowData[t]}getRowOrCreate(t){const{_rowData:n}=this,r=n[t];if(r)return r;const s={};return n[t]=s,s}getHiddenRows(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getRowRawVisible(o);s&&a?(s=!1,r.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:Le.ROW})):!s&&!a&&(s=!0,i=o)}return s&&r.push({startRow:i,endRow:n,startColumn:0,endColumn:0,rangeType:Le.ROW}),r}getVisibleRows(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getRowRawVisible(o);s&&!a?(s=!1,r.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:Le.ROW})):!s&&a&&(s=!0,i=o)}return s&&r.push({startRow:i,endRow:n,startColumn:0,endColumn:0,rangeType:Le.ROW}),r}getRowRawVisible(t){const n=this.getRow(t);return n?n.hd!==Ie.TRUE:!0}getSize(){return Xt(this._rowData)}setCustomMetadata(t,n){const r=this.getRow(t);r&&(r.custom=n)}getCustomMetadata(t){var n;return(n=this.getRow(t))==null?void 0:n.custom}}const oE="DEFAULT_WORKSHEET_ROW_COUNT",Iu=1e3,aE="DEFAULT_WORKSHEET_COLUMN_COUNT",Su=20,lE="DEFAULT_WORKSHEET_ROW_HEIGHT",vu=24,uE="DEFAULT_WORKSHEET_COLUMN_WIDTH",Ou=88,cE="DEFAULT_WORKSHEET_ROW_TITLE_WIDTH",wu=46,hE="DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT",bu=20;function Au(e){const t={name:"Sheet1",id:"sheet-01",tabColor:"",hidden:Ie.FALSE,rowCount:Iu,columnCount:Su,zoomRatio:1,freeze:{xSplit:0,ySplit:0,startRow:-1,startColumn:-1},scrollTop:0,scrollLeft:0,defaultColumnWidth:Ou,defaultRowHeight:vu,mergeData:[],cellData:{},rowData:{},columnData:{},showGridlines:Ie.TRUE,rowHeader:{width:wu,hidden:Ie.FALSE},columnHeader:{height:bu,hidden:Ie.FALSE},rightToLeft:Ie.FALSE};return Object.keys(t).forEach(n=>{const r=n;typeof e[r]>"u"&&(e[r]=t[r])}),e}class dE extends st{constructor(n){super();C(this,"_cellCache",new Map);C(this,"_rowCache",new Map);C(this,"_columnCache",new Map);C(this,"_hasRow",!1);C(this,"_hasColumn",!1);C(this,"_hasAll",!1);C(this,"_allIndex",-1);C(this,"_mergeData");C(this,"_rangeMap",new Jn(5e4));C(this,"_skeletonCache",new Jn(5e4));this._init(n.concat())}_init(n){this._mergeData=n,this._createCache(n)}_clearCache(){this._cellCache.clear(),this._rowCache.clear(),this._columnCache.clear(),this._hasAll=!1,this._allIndex=-1,this._rangeMap.clear(),this._skeletonCache.clear(),this._hasColumn=!1,this._hasRow=!1}_createCache(n){let r=0;for(const s of n){const{rangeType:i}=s;i===Le.ROW?this._createRowCache(s,r):i===Le.COLUMN?this._createColumnCache(s,r):i===Le.ALL?this._createCellAllCache(r):this._createCellCache(s,r),r++}}rebuild(n){this._clearCache(),this._init(n.concat())}_createRowCache(n,r){const{startRow:s,endRow:i}=n;for(let o=s;o<=i;o++)this._rowCache.set(o,r),this._hasRow=!0}_createColumnCache(n,r){const{startColumn:s,endColumn:i}=n;for(let o=s;o<=i;o++)this._columnCache.set(o,r),this._hasColumn=!0}_createCellAllCache(n){this._hasAll=!0,this._allIndex=n}_createCellCache(n,r){for(let s=n.startRow;s<=n.endRow;s++){let i=this._cellCache.get(s);i==null&&(i=new Map,this._cellCache.set(s,i));for(let o=n.startColumn;o<=n.endColumn;o++)i.set(o,r)}}add(n){this._mergeData.push(n),this._clearCache(),this._createCache(this._mergeData)}remove(n,r){const s=this._getMergeDataIndex(n,r);s!==-1&&(this._mergeData.splice(s,1),this._clearCache(),this._createCache(this._mergeData))}getMergedCell(n,r){const s=this._getMergeDataIndex(n,r);return s!==-1?this._mergeData[s]:null}getMergeDataIndex(n,r){return this._getMergeDataIndex(n,r)}isRowContainsMergedCell(n){return this._hasAll||!re.isEmptyObject(this._columnCache)?!0:this._mergeData.some(r=>r.startRow<=n&&n<=r.endRow)}isColumnContainsMergedCell(n){return this._hasAll||!re.isEmptyObject(this._rowCache)?!0:this._mergeData.some(r=>r.startColumn<=n&&n<=r.endColumn)}getMergedCellRange(n,r,s,i){const o=[],a=`${n}-${r}-${s}-${i}`;if(this._rangeMap.has(a))return this._getRangeFromCache(a);let l=0;const u=[];for(const c of this._mergeData||[])Zt.intersects(c,{startRow:n,endRow:s,startColumn:r,endColumn:i})&&(o.push({...c}),u.push(l)),l++;return this._rangeMap.set(a,u),o}getMergedCellRangeForSkeleton(n,r,s,i){const o=[],a=this._mergeData,l=`${n}-${r}-${s}-${i}`;if(this._skeletonCache.has(l))return this._getSkeletonRangeFromCache(l);const u=[];for(let c=0;c<a.length;c++){const{startRow:h,endRow:d,startColumn:f,endColumn:p}=a[c];for(let R=n;R<=s;R++){let w=!1;for(let N=r;N<=i;N++)if(R>=h&&R<=d&&N>=f&&N<=p){o.push({startRow:h,endRow:d,startColumn:f,endColumn:p}),u.push(c),w=!0;break}if(w)break}}return this._skeletonCache.set(l,u),o}_getRangeFromCache(n){const r=this._rangeMap.get(n)||[],s=[];for(const i of r)s.push({...this._mergeData[i]});return s}_getSkeletonRangeFromCache(n){const r=this._skeletonCache.get(n)||[],s=[];for(const i of r)s.push({...this._mergeData[i]});return s}_getMergeDataIndex(n,r){var i;if(this._hasAll)return this._allIndex;if(this._hasRow){const o=this._rowCache.get(n);if(o!==void 0)return o}if(this._hasColumn){const o=this._columnCache.get(r);if(o!==void 0)return o}const s=(i=this._cellCache.get(n))==null?void 0:i.get(r);return s!==void 0?s:-1}getMergeDataSnapshot(){return this._mergeData}dispose(){this._clearCache(),this._mergeData=[]}}class Tu extends st{constructor(n){super();C(this,"_cellContentInterceptor",null);C(this,"_rowFilteredInterceptor",null);this.getRawCell=n}dispose(){super.dispose(),this._cellContentInterceptor=null,this._rowFilteredInterceptor=null}getCell(n,r,s,i){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,r,vn.Value|vn.Style,s,i):this.getRawCell(n,r)}getCellValueOnly(n,r){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,r,vn.Value):this.getRawCell(n,r)}getCellStyleOnly(n,r){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,r,vn.Style):this.getRawCell(n,r)}getRowFiltered(n){var r,s;return(s=(r=this._rowFilteredInterceptor)==null?void 0:r.getRowFiltered(n))!=null?s:!1}registerCellContentInterceptor(n){if(this._cellContentInterceptor)throw new Error("[SheetViewModel]: Interceptor already registered.");return this._cellContentInterceptor=n,nt(()=>this._cellContentInterceptor=null)}registerRowFilteredInterceptor(n){if(this._rowFilteredInterceptor)throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowFilteredInterceptor=n,nt(()=>this._rowFilteredInterceptor=null)}}const Mo={isDeepClone:!1,displayRawFormula:!1,ignoreTextRotation:!1};class tr{constructor(t,n,r){C(this,"_sheetId");C(this,"_snapshot");C(this,"_cellData");C(this,"_rowManager");C(this,"_columnManager");C(this,"_viewModel");C(this,"_spanModel");var a;this.unitId=t,this._styles=r,this._snapshot=Au(n);const{columnData:s,rowData:i,cellData:o}=this._snapshot;this._sheetId=(a=this._snapshot.id)!=null?a:re.generateRandomId(6),this._cellData=new Tt(o),this._viewModel=new Tu((l,u)=>this.getCellRaw(l,u)),this._rowManager=new iE(this._snapshot,this._viewModel,i),this._columnManager=new sE(this._snapshot,s),this._spanModel=new dE(this._snapshot.mergeData)}__interceptViewModel(t){t(this._viewModel)}getSnapshot(){return this._snapshot}setMergeData(t){this._snapshot.mergeData=t,this.getSpanModel().rebuild(t)}getSpanModel(){return this._spanModel}getStyleDataByHash(t){return{...this._styles.get(t)}}setStyleData(t){return this._styles.setValue(t)}getColumnStyle(t,n=!1){return n?this._columnManager.getColumnStyle(t):this._styles.get(this._columnManager.getColumnStyle(t))}setColumnStyle(t,n){this._columnManager.setColumnStyle(t,n)}getRowStyle(t,n=!1){return n?this._rowManager.getRowStyle(t):this._styles.get(this._rowManager.getRowStyle(t))}setRowStyle(t,n){this._rowManager.setRowStyle(t,n)}getDefaultCellStyle(){return this._snapshot.defaultStyle}getDefaultCellStyleInternal(){const t=this._snapshot.defaultStyle;return this._styles.get(t)}setDefaultCellStyle(t){this._snapshot.defaultStyle=t}getCellStyle(t,n){const r=this.getCell(t,n);if(r){const s=r.s;return typeof s=="string"?this._styles.get(s):s}return null}getComposedCellStyle(t,n,r=!0){const s=this.getCellStyle(t,n),i=this.getDefaultCellStyleInternal(),o=this.getRowStyle(t),a=this.getColumnStyle(n);return r?Ts(i,o,a,s):Ts(i,a,o,s)}getCellMatrix(){return this._cellData}getCellMatrixPrintRange(){const t=this.getCellMatrix(),n=this.getMergeData();let r=-1,s=-1,i=-1,o=-1,a=!1,l=!1;return t.forEach((u,c)=>{Object.keys(c).forEach(h=>{const d=+h,f=t.getValue(u,d),p=f!=null&&f.s?this._styles.get(f.s):null,R=(p==null?void 0:p.bd)&&(p.bd.b||p.bd.l||p.bd.r||p.bd.t||p.bd.bc_tr||p.bd.bl_tr||p.bd.ml_tr||p.bd.tl_bc||p.bd.tl_br||p.bd.tl_mr);(f&&(f.v||f.p)||p!=null&&p.bg||R)&&(a?r=Math.min(r,u):(r=u,a=!0),s=Math.max(s,u),l?i=Math.min(i,d):(l=!0,i=d),o=Math.max(o,d))})}),n.forEach(u=>{a?r=Math.min(r,u.startRow):(r=u.startRow,a=!0),s=Math.max(s,u.endRow),l?i=Math.min(i,u.startColumn):(i=u.startColumn,a=!0),o=Math.max(o,u.endColumn)}),!a||!l?null:{startColumn:i,startRow:r,endColumn:o,endRow:s}}getRowManager(){return this._rowManager}getUnitId(){return this.unitId}getSheetId(){return this._sheetId}getColumnManager(){return this._columnManager}getName(){return this._snapshot.name}clone(){const{_snapshot:t}=this,n=re.deepClone(t);return new tr(this.unitId,n,this._styles)}getMergeData(){return this._spanModel.getMergeDataSnapshot()}getMergedCell(t,n){return this._spanModel.getMergedCell(t,n)}getMergedCellRange(t,n,r,s){return this._spanModel.getMergedCellRange(t,n,r,s)}isRowContainsMergedCell(t){return this._spanModel.isRowContainsMergedCell(t)}isColumnContainsMergedCell(t){return this._spanModel.isColumnContainsMergedCell(t)}getCellInfoInMergeData(t,n){const r=this.getMergedCell(t,n);let s=!1,i=!1,o=t,a=n,l=t,u=n;if(r){const{startRow:c,endRow:h,startColumn:d,endColumn:f}=r;t===c&&n===d?(o=h,a=f,l=c,u=d,i=!0):t>=c&&t<=h&&n>=d&&n<=f&&(o=h,a=f,l=c,u=d,s=!0)}return{actualRow:t,actualColumn:n,isMergedMainCell:i,isMerged:s,endRow:o,endColumn:a,startRow:l,startColumn:u}}getCell(t,n){return t<0||n<0?null:this._viewModel.getCell(t,n)}getCellValueOnly(t,n){return t<0||n<0?null:this._viewModel.getCellValueOnly(t,n)}getCellStyleOnly(t,n){return t<0||n<0?null:this._viewModel.getCellStyleOnly(t,n)}getCellRaw(t,n){return this.getCellMatrix().getValue(t,n)}getCellWithFilteredInterceptors(t,n,r,s){return this._viewModel.getCell(t,n,r,s)}getRowFiltered(t){return this._viewModel.getRowFiltered(t)}getMatrixWithMergedCells(t,n,r,s,i=In.Raw){const o=this.getCellMatrix(),a=this._spanModel.getMergedCellRange(t,n,r,s),l=new Tt;return Us(t,r,n,s).forEach((u,c)=>{var d;let h;if(i===In.Raw)h=this.getCellRaw(u,c);else if(i===In.Intercepted)h=this.getCell(u,c);else if(i===In.Both){const f=this.getCellRaw(u,c);if(f){h={...f};const p=(d=this.getCell(u,c))==null?void 0:d.v;Cu(p)&&h&&(h.displayV=String(p))}}h&&l.setValue(u,c,h)}),a.forEach(u=>{const{startColumn:c,startRow:h,endColumn:d,endRow:f}=u;Us(h,f,c,d).forEach((p,R)=>{p===h&&R===c&&l.setValue(p,R,{...o.getValue(p,R),rowSpan:f-h+1,colSpan:d-c+1}),(p!==h||R!==c)&&l.realDeleteValue(p,R)})}),l}getRange(t,n,r,s){return typeof t=="object"?new An(this,t,{getStyles:()=>this._styles}):new An(this,{startRow:t,startColumn:n,endColumn:s||n,endRow:r||t},{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:t}=this,{columnCount:n}=t;return n}getMaxRows(){const{_snapshot:t}=this,{rowCount:n}=t;return n}getRowCount(){return this._snapshot.rowCount}setRowCount(t){this._snapshot.rowCount=t}getColumnCount(){return this._snapshot.columnCount}setColumnCount(t){this._snapshot.columnCount=t}isSheetHidden(){return this._snapshot.hidden}hasHiddenGridlines(){const{_snapshot:t}=this,{showGridlines:n}=t;return n===0}getGridlinesColor(){return this.getConfig().gridlinesColor}getTabColor(){const{_snapshot:t}=this,{tabColor:n}=t;return n}getColumnWidth(t){return this.getColumnManager().getColumnWidth(t)}getRowHeight(t){return this._viewModel.getRowFiltered(t)?0:this.getRowManager().getRowHeight(t)}isRowFiltered(t){return this._viewModel.getRowFiltered(t)}getRowVisible(t){return!this.isRowFiltered(t)&&this.getRowRawVisible(t)}getRowRawVisible(t){return this.getRowManager().getRowRawVisible(t)}getHiddenRows(t,n){const r=this.getMaxColumns()-1,s=this._rowManager.getHiddenRows(t,n);return s.forEach(i=>i.endColumn=r),s}getColVisible(t){return this._columnManager.getColVisible(t)}getHiddenCols(t,n){const r=this.getMaxRows()-1,s=this._columnManager.getHiddenCols(t,n);return s.forEach(i=>i.endRow=r),s}getVisibleRows(){const t=this.getRowCount();return this._rowManager.getVisibleRows(0,t-1)}getVisibleCols(){const t=this.getColumnCount();return this._columnManager.getVisibleCols(0,t-1)}isRightToLeft(){const{_snapshot:t}=this,{rightToLeft:n}=t;return n}getLastRowWithContent(){return this._cellData.getLength()-1}getLastColumnWithContent(){return this._cellData.getRange().endColumn}getDataRangeScope(){return this._cellData.getStartEndScope()}cellHasValue(t){return t&&(t.v!==void 0||t.f!==void 0||t.p!==void 0)}iterateByRow(t,n=!0){const{startRow:r,startColumn:s,endRow:i,endColumn:o}=t,a=this;return{[Symbol.iterator]:()=>{let l=r,u=s;return{next(){for(;;){if(u>o&&(l+=1,u=s),l>i)return{done:!0,value:void 0};const c=a.getCell(l,u),h=!c,d=a.getMergedCell(l,u);if(d){if(l!==d.startRow||u!==d.startColumn){u=d.endColumn+1;continue}if(h&&n){u=d.endColumn+1;continue}const p={row:l,col:u,value:c};return p.colSpan=d.endColumn-d.startColumn+1,p.rowSpan=d.endRow-d.startRow+1,u=d.endColumn+1,{done:!1,value:p}}if(h&&n)u+=1;else{const f={row:l,col:u,value:c};return u+=1,{done:!1,value:f}}}}}}}}iterateByColumn(t,n=!0,r=!0){const{startRow:s,startColumn:i,endRow:o,endColumn:a}=t,l=this;return{[Symbol.iterator]:()=>{let u=s,c=i;return{next(){for(;;){if(u>o&&(c+=1,u=s),c>a)return{done:!0,value:void 0};const h=l.getMergedCell(u,c);if(h){const p=u!==h.startRow,R=p||c!==h.startColumn;if(r&&R||!r&&p){u=h.endRow+1;continue}const w=l.getCell(h.startRow,h.startColumn);if(!w&&n){u=h.endRow+1;continue}const z={row:u,col:h.startColumn,value:w};return z.colSpan=h.endColumn-h.startColumn+1,z.rowSpan=h.endRow-h.startRow+1,u=h.endRow+1,{done:!1,value:z}}const d=l.getCell(u,c);if(!d&&n)u+=1;else{const p={row:u,col:c,value:d};return u+=1,{done:!1,value:p}}}}}}}}_getCellDocumentModel(t,n=Mo){var R;const{isDeepClone:r,displayRawFormula:s,ignoreTextRotation:i}={...Mo,...n},o=this._styles.getStyleByCell(t);if(!t)return;let a,l="document";const u=tE(o),c=i?ut.tr:u.textRotation||ut.tr;let h=u.horizontalAlign||ut.ht;const d=u.verticalAlign||ut.vt,f=u.wrapStrategy||ut.tb,p=u.paddingData||Vs;if(t.f&&s)a=Vn(t.f.toString(),{},{verticalAlign:d}),h=ut.ht;else if(t.p){const{centerAngle:w,vertexAngle:N}=Ru(c);a=this._updateConfigAndGetDocumentModel(r?re.deepClone(t.p):t.p,h,p,{horizontalAlign:h,verticalAlign:d,centerAngle:w,vertexAngle:N,wrapStrategy:f,zeroWidthParagraphBreak:1})}else if(t.v!=null){const w=yo(o);l=No(w).fontCache;let N=yu(t);t.t===Kt.FORCE_STRING&&s&&(N=`'${N}`),a=Vn(N,w,{...u,textRotation:c,cellValueType:t.t})}return a&&t.linkUrl&&t.linkId&&Eu(a,t.linkUrl,t.linkId),{documentModel:a,fontString:l,textRotation:c,wrapStrategy:f,verticalAlign:d,horizontalAlign:h,paddingData:p,fill:(R=o==null?void 0:o.bg)==null?void 0:R.rgb}}_updateConfigAndGetDocumentModel(t,n,r,s){var o,a,l,u,c;if(!s||!((o=t.body)!=null&&o.dataStream))return;t.documentStyle||(t.documentStyle={}),t.documentStyle.marginTop=(a=r.t)!=null?a:0,t.documentStyle.marginBottom=(l=r.b)!=null?l:2,t.documentStyle.marginLeft=(u=r.l)!=null?u:2,t.documentStyle.marginRight=(c=r.r)!=null?c:2,t.documentStyle.pageSize={width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY},t.documentStyle.renderConfig={...t.documentStyle.renderConfig,...s};const i=t.body.paragraphs||[];for(const h of i)h.paragraphStyle||(h.paragraphStyle={}),h.paragraphStyle.horizontalAlign=n;return new Nt(t)}getBlankCellDocumentModel(t){const n=this._getCellDocumentModel(t,{ignoreTextRotation:!0}),r=this._styles.getStyleByCell(t),s=yo(r);if(n!=null)return n.documentModel==null&&(n.documentModel=Vn("",s)),n;const i="";let o="document";const a=ut.tr,l=ut.ht,u=ut.vt,c=ut.tb,h=Vs;return o=No({}).fontCache,{documentModel:Vn(i,s),fontString:o,textRotation:a,wrapStrategy:c,verticalAlign:u,horizontalAlign:l,paddingData:h}}getCellDocumentModelWithFormula(t){return this._getCellDocumentModel(t,{isDeepClone:!0,displayRawFormula:!0,ignoreTextRotation:!0})}getCustomMetadata(){return this._snapshot.custom}setCustomMetadata(t){this._snapshot.custom=t}}function yu(e){var r,s;if(!e)return"";const t=(s=(r=e.p)==null?void 0:r.body)==null?void 0:s.dataStream;if(t)return ot.transform.getPlainText(t);const n=e.v;return typeof n=="string"?e.t===Kt.BOOLEAN?n.toUpperCase():n.replace(/[\r\n]/g,""):typeof n=="number"?e.t===Kt.BOOLEAN?n?"TRUE":"FALSE":n.toString():typeof n=="boolean"?n?"TRUE":"FALSE":""}function fE(e){if(e===null)return"";if(e!=null&&e.p){const t=e==null?void 0:e.p.body;if(t==null)return"";const n=t.dataStream;return ot.transform.getPlainText(n)}return e==null?void 0:e.v}var gE=Object.getOwnPropertyDescriptor,mE=(e,t,n,r)=>{for(var s=r>1?void 0:r?gE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},_E=(e,t)=>(n,r)=>t(n,r,e);function pE(e,t){return`${e.getUnitId()}|${t.getSheetId()}`}exports.Workbook=class extends is{constructor(n={},r){super();C(this,"type",Be.UNIVER_SHEET);C(this,"_sheetCreated$",new Oe.Subject);C(this,"sheetCreated$",this._sheetCreated$.asObservable());C(this,"_sheetDisposed$",new Oe.Subject);C(this,"sheetDisposed$",this._sheetDisposed$.asObservable());C(this,"_activeSheet$",new Oe.BehaviorSubject(null));C(this,"activeSheet$",this._activeSheet$.asObservable());C(this,"_worksheets");C(this,"_styles");C(this,"_snapshot");C(this,"_unitId");C(this,"_count");C(this,"_name$");C(this,"name$");this._logService=r;const s=Jp();re.isEmptyObject(n)?this._snapshot=s:this._snapshot=re.commonExtend(s,n);const{styles:i}=this._snapshot;(this._snapshot.id==null||this._snapshot.id.length===0)&&(this._snapshot.id=re.generateRandomId(6)),this._unitId=this._snapshot.id,this._styles=new pu(i),this._count=1,this._worksheets=new Map,this._name$=new Oe.BehaviorSubject(n.name||""),this.name$=this._name$.asObservable(),this._parseWorksheetSnapshots()}get _activeSheet(){return this._activeSheet$.getValue()}get name(){return this._name$.getValue()}static isIRangeType(n){return typeof n=="string"||"startRow"in n||"row"in n}dispose(){super.dispose(),this._sheetCreated$.complete(),this._sheetDisposed$.complete(),this._activeSheet$.complete(),this._name$.complete()}save(){return re.deepClone(this._snapshot)}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}setRev(n){this._snapshot.rev=n}addWorksheet(n,r,s){const{sheets:i,sheetOrder:o}=this._snapshot;if(i[n])return!1;i[n]=s,o.splice(r,0,n);const a=new tr(this._unitId,s,this._styles);return this._worksheets.set(n,a),this._sheetCreated$.next(a),!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:r}=this._snapshot;return r.findIndex(s=>s===n)}getActiveSheet(n){if(!this._activeSheet&&typeof n>"u")throw new Error(`[Workbook]: no active Worksheet on Workbook ${this._unitId}!`);return this._activeSheet}ensureActiveSheet(){const n=this._activeSheet;if(n)return n;const r=this._snapshot.sheetOrder;for(let i=0,o=r.length;i<o;i++){const a=this._worksheets.get(r[i]);if(a&&a.isSheetHidden()!==Ie.TRUE)return this.setActiveSheet(a),a}const s=this._worksheets.get(r[0]);return this.setActiveSheet(s),s}setActiveSheet(n){this._activeSheet$.next(n)}removeSheet(n){const r=this._worksheets.get(n);return r?(this._worksheets.delete(n),this._snapshot.sheetOrder.splice(this._snapshot.sheetOrder.indexOf(n),1),delete this._snapshot.sheets[n],this._sheetDisposed$.next(r),!0):!1}getActiveSheetIndex(){const{sheetOrder:n}=this._snapshot;return n.findIndex(r=>this._worksheets.get(r)===this._activeSheet)}getSheetSize(){return this._snapshot.sheetOrder.length}getSheets(){const{sheetOrder:n}=this._snapshot;return n.map(r=>this._worksheets.get(r))}getSheetsName(){const{sheetOrder:n}=this._snapshot,r=[];return n.forEach(s=>{const i=this._worksheets.get(s);i&&r.push(i.getName())}),r}getSheetIndex(n){const{sheetOrder:r}=this._snapshot;return r.findIndex(s=>n.getSheetId()===s)}getSheetBySheetName(n){const{sheetOrder:r}=this._snapshot,s=r.find(i=>this._worksheets.get(i).getName()===n);return this._worksheets.get(s)}getSheetBySheetId(n){return this._worksheets.get(n)}getSheetByIndex(n){const{sheetOrder:r}=this._snapshot;return this._worksheets.get(r[n])}getHiddenWorksheets(){return this.getSheets().filter(n=>n.getConfig().hidden===Ie.TRUE).map(n=>n.getConfig().id)}getUnhiddenWorksheets(){return this.getSheets().filter(n=>n.getConfig().hidden!==Ie.TRUE).map(n=>n.getConfig().id)}load(n){this._snapshot=n}checkSheetName(n){return this.getSheetsName().includes(n)}uniqueSheetName(n="Sheet1"){let r=n;for(;this.checkSheetName(r);)r=n+this._count,this._count++;return r}generateNewSheetName(n){let r=n+this._count;for(;this.checkSheetName(r);)r=n+this._count,this._count++;return r}_parseWorksheetSnapshots(){const{_snapshot:n,_worksheets:r}=this,{sheets:s,sheetOrder:i}=n;if(re.isEmptyObject(s)){const o=re.generateRandomId();s[o]={id:o}}for(const o in s){const a=s[o],{name:l}=a;a.name=this.uniqueSheetName(l),a.name!==l&&this._logService.debug("[Workbook]",`The worksheet name ${l} is duplicated, we changed it to ${a.name}. Please fix the problem in your snapshot.`);const u=new tr(this._unitId,a,this._styles);r.set(o,u),i.includes(o)||i.push(o)}this.ensureActiveSheet()}getCustomMetadata(){return this._snapshot.custom}setCustomMetadata(n){this._snapshot.custom=n}};exports.Workbook=mE([_E(1,bt)],exports.Workbook);class vi extends is{constructor(n){var r;super();C(this,"type",Be.UNIVER_SLIDE);C(this,"_activePage$",new Oe.BehaviorSubject(null));C(this,"activePage$",this._activePage$.asObservable());C(this,"_name$");C(this,"name$");C(this,"_snapshot");C(this,"_unitId");this._snapshot={...al,...n},this._unitId=(r=this._snapshot.id)!=null?r:re.generateRandomId(6),this._name$=new Oe.BehaviorSubject(this._snapshot.title),this.name$=this._name$.asObservable()}get _activePage(){var r,s;const n=this._activePage$.getValue();if(!n){const i=(r=this.getPageOrder())==null?void 0:r[0];return i?(s=this.getPages())==null?void 0:s[i]:null}return n}setName(n){var r;this._snapshot.title=n,this._name$.next(n),this._unitId=(r=this._snapshot.id)!=null?r:Ft(6)}getRev(){return 0}incrementRev(){}setRev(n){}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 r=this.getPages();return r==null?void 0:r[n]}getElementsByPage(n){var r;return(r=this.getPage(n))==null?void 0:r.pageElements}getElement(n,r){var s;return(s=this.getElementsByPage(n))==null?void 0:s[r]}getPageSize(){return this._snapshot.pageSize}getBlankPage(){const n=Ft(6);return{id:n,pageType:si.SLIDE,zIndex:10,title:n,description:"",pageBackgroundFill:{rgb:"rgb(255,255,255)"},pageElements:{}}}setActivePage(n){this._activePage$.next(n)}getActivePage(){return this._activePage}updatePage(n,r){this._snapshot.body&&(this._snapshot.body.pages[n]=r)}appendPage(n){var i;if(!this._snapshot.body)return;this._snapshot.body.pages[n.id]=n;const r=this._activePage,s=this._snapshot.body.pageOrder.indexOf((i=r==null?void 0:r.id)!=null?i:"");this._snapshot.body.pageOrder.splice(s+1,0,n.id)}}var EE=Object.getOwnPropertyDescriptor,CE=(e,t,n,r)=>{for(var s=r>1?void 0:r?EE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Do=(e,t)=>(n,r)=>t(n,r,e);const Nn=je.createIdentifier("univer.current");exports.UniverInstanceService=class extends st{constructor(n,r){super();C(this,"_unitsByType",new Map);C(this,"_createHandler");C(this,"_ctorByType",new Map);C(this,"_currentUnits",new Map);C(this,"_currentUnits$",new Oe.BehaviorSubject(this._currentUnits));C(this,"currentUnits$",this._currentUnits$.asObservable());C(this,"_unitAdded$",new Oe.Subject);C(this,"unitAdded$",this._unitAdded$.asObservable());C(this,"_unitDisposed$",new Oe.Subject);C(this,"unitDisposed$",this._unitDisposed$.asObservable());C(this,"_focused$",new Oe.BehaviorSubject(null));C(this,"focused$",this._focused$.asObservable());this._injector=n,this._contextService=r}dispose(){super.dispose(),this._focused$.complete()}__setCreateHandler(n){this._createHandler=n}createUnit(n,r,s){return this._createHandler(n,r,this._ctorByType.get(n),s)}registerCtorForType(n,r){return this._ctorByType.set(n,r),{dispose:()=>{this._ctorByType.delete(n)}}}getCurrentTypeOfUnit$(n){return this.currentUnits$.pipe(Oe.map(r=>{var s;return(s=r.get(n))!=null?s:null}),Oe.distinctUntilChanged())}getCurrentUnitForType(n){return this._currentUnits.get(n)}getCurrentUnitOfType(n){return this.getCurrentUnitForType(n)}setCurrentUnitForType(n){const r=this._getUnitById(n);if(!r)throw new Error(`[UniverInstanceService]: no document with unitId ${n}!`);this._currentUnits.set(r[1],r[0]),this._currentUnits$.next(this._currentUnits)}getTypeOfUnitAdded$(n){return this._unitAdded$.pipe(Oe.filter(r=>r.type===n))}__addUnit(n,r){var a;const s=n.type;this._unitsByType.has(s)||this._unitsByType.set(s,[]);const i=this._unitsByType.get(s),o=n.getUnitId();if(i.findIndex(l=>l.getUnitId()===o)!==-1)throw new Error(`[UniverInstanceService]: cannot create a unit with the same unit id: ${o}.`);i.push(n),this._unitAdded$.next(n),((a=r==null?void 0:r.makeCurrent)==null||a)&&this.setCurrentUnitForType(n.getUnitId())}getTypeOfUnitDisposed$(n){return this.unitDisposed$.pipe(Oe.filter(r=>r.type===n))}getUnit(n,r){var i;const s=(i=this._getUnitById(n))==null?void 0:i[0];return r&&(s==null?void 0:s.type)!==r?null:s}getCurrentUniverDocInstance(){return this.getCurrentUnitForType(Be.UNIVER_DOC)}getUniverDocInstance(n){return this.getUnit(n,Be.UNIVER_DOC)}getUniverSheetInstance(n){return this.getUnit(n,Be.UNIVER_SHEET)}getAllUnitsForType(n){var r;return(r=this._unitsByType.get(n))!=null?r:[]}changeDoc(n,r){const s=this.getAllUnitsForType(Be.UNIVER_DOC),i=s.find(o=>o.getUnitId()===n);if(i!=null){const o=s.indexOf(i);s.splice(o,1)}this.__addUnit(r)}get focused(){var r;const n=this._focused$.getValue();return n?(r=this._getUnitById(n))==null?void 0:r[0]:null}focusUnit(n){this._focused$.next(n),this.focused instanceof exports.Workbook?(this._contextService.setContextValue(Yn,!0),this._contextService.setContextValue(Gn,!1),this._contextService.setContextValue(On,!0),this._contextService.setContextValue(zn,!1),this.setCurrentUnitForType(n)):this.focused instanceof Nt?(this._contextService.setContextValue(Yn,!0),this._contextService.setContextValue(Gn,!0),this._contextService.setContextValue(On,!1),this._contextService.setContextValue(zn,!1),this.setCurrentUnitForType(n)):this.focused instanceof vi?(this._contextService.setContextValue(Yn,!0),this._contextService.setContextValue(Gn,!1),this._contextService.setContextValue(On,!1),this._contextService.setContextValue(zn,!0),this.setCurrentUnitForType(n)):(this._contextService.setContextValue(Yn,!1),this._contextService.setContextValue(Gn,!1),this._contextService.setContextValue(On,!1),this._contextService.setContextValue(zn,!1))}getFocusedUnit(){return this.focused}getUnitType(n){const r=this._getUnitById(n);return r?r[1]:Be.UNRECOGNIZED}disposeUnit(n){const r=this._getUnitById(n);if(!r)return!1;const[s,i]=r,o=this._unitsByType.get(i),a=o.indexOf(s);return o.splice(a,1),this._tryResetCurrentOnRemoval(n,i),this._tryResetFocusOnRemoval(n),this._unitDisposed$.next(s),!0}_tryResetCurrentOnRemoval(n,r){const s=this.getCurrentUnitForType(r);(s==null?void 0:s.getUnitId())===n&&(this._currentUnits.set(r,null),this._currentUnits$.next(this._currentUnits))}_tryResetFocusOnRemoval(n){var r;((r=this.focused)==null?void 0:r.getUnitId())===n&&this._focused$.next(null)}_getUnitById(n){for(const[r,s]of this._unitsByType){const i=s.find(o=>o.getUnitId()===n);if(i)return[i,r]}}};exports.UniverInstanceService=CE([Do(0,je.Inject(je.Injector)),Do(1,Mn)],exports.UniverInstanceService);var Je=(e=>(e[e.Starting=0]="Starting",e[e.Ready=1]="Ready",e[e.Rendered=2]="Rendered",e[e.Steady=3]="Steady",e))(Je||{});const RE={0:"Starting",1:"Ready",2:"Rendered",3:"Steady"};var IE=Object.getOwnPropertyDescriptor,SE=(e,t,n,r)=>{for(var s=r>1?void 0:r?IE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},vE=(e,t)=>(n,r)=>t(n,r,e);exports.LifecycleService=class extends st{constructor(n){super();C(this,"_lifecycle$",new Oe.BehaviorSubject(Je.Starting));C(this,"lifecycle$",this._lifecycle$.asObservable());C(this,"_lock",!1);this._logService=n,this._reportProgress(Je.Starting)}get stage(){return this._lifecycle$.getValue()}set stage(n){if(this._lock)throw new Error("[LifecycleService]: cannot set new stage when related logic is all handled!");if(n<this.stage)throw new Error("[LifecycleService]: lifecycle stage cannot go backward!");n!==this.stage&&(this._lock=!0,this._reportProgress(n),this._lifecycle$.next(n),this._lock=!1)}dispose(){this._lifecycle$.complete(),super.dispose()}onStage(n){return Oe.firstValueFrom(this.lifecycle$.pipe(Oe.filter(r=>r>=n),As(r=>r===n),Oe.map(()=>{})))}subscribeWithPrevious(){return Oe.merge(Nu(this.stage),this._lifecycle$.pipe(Oe.skip(1))).pipe(As(n=>n===Je.Steady))}_reportProgress(n){this._logService.debug("[LifecycleService]",`lifecycle progressed to "${RE[n]}".`)}};exports.LifecycleService=SE([vE(0,bt)],exports.LifecycleService);function Nu(e){switch(e){case Je.Starting:return Oe.of(Je.Starting);case Je.Ready:return Oe.of(Je.Starting,Je.Ready);case Je.Rendered:return Oe.of(Je.Starting,Je.Ready,Je.Rendered);default:return Oe.of(Je.Starting,Je.Ready,Je.Rendered,Je.Steady)}}const OE=je.createIdentifier("ILocalStorageService");class an extends st{constructor(){super();C(this,"_currentLocale$",new Oe.BehaviorSubject(ir.ZH_CN));C(this,"currentLocale$",this._currentLocale$.asObservable());C(this,"_locales",null);C(this,"localeChanged$",new Oe.Subject);C(this,"t",(n,...r)=>{if(!this._locales)throw new Error("[LocaleService]: Locale not initialized");const s=n.split("."),i=this.resolveKeyPath(this._locales[this._currentLocale],s);if(typeof i=="string"){let o=i;return r.forEach((a,l)=>{o=o.replace(`{${l}}`,a)}),o}else return n});this.disposeWithMe(nt(()=>this.localeChanged$.complete()))}get _currentLocale(){return this._currentLocale$.value}load(n){var r;this._locales=fi((r=this._locales)!=null?r:{},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,r){const s=r.shift();if(s&&n&&s in n){const i=n[s];return r.length>0&&(typeof i=="object"||Array.isArray(i))?this.resolveKeyPath(i,r):i}return null}}var Oi=(e=>(e.INIT="init",e.FETCHING="fetching",e.DONE="done",e))(Oi||{});const Mu=je.createIdentifier("univer.permission-service");class Du extends st{constructor(){super(...arguments);C(this,"_permissionPointMap",new Map);C(this,"_permissionPointUpdate$",new Oe.Subject);C(this,"permissionPointUpdate$",this._permissionPointUpdate$.asObservable());C(this,"_showComponents",!0)}setShowComponents(n){this._showComponents=n}getShowComponents(){return this._showComponents}deletePermissionPoint(n){const r=this._permissionPointMap.get(n);r&&(r.complete(),this._permissionPointMap.delete(n))}addPermissionPoint(n){const r=n instanceof Oe.BehaviorSubject,s=r?n.getValue():n;if(!s.id)return!1;if(this._permissionPointMap.get(s.id))throw new Error(`${s.id} PermissionPoint already exists`);return this._permissionPointMap.set(s.id,r?n:new Oe.BehaviorSubject(s)),this._permissionPointUpdate$.next(s),!0}updatePermissionPoint(n,r){const s=this._permissionPointMap.get(n);if(!s)return;const i=s.getValue();i.value=r,i.status=Oi.DONE,s.next(i),this._permissionPointUpdate$.next(i)}clearPermissionMap(){this._permissionPointMap.clear()}getPermissionPoint(n){const r=this._permissionPointMap.get(n);if(r)return r.getValue()}getPermissionPoint$(n){const r=this._permissionPointMap.get(n);if(r)return r}composePermission$(n){const r=n.map(s=>{var o;const i=(o=this._permissionPointMap)==null?void 0:o.get(s);if(!i)throw new Error(`[PermissionService]: ${s} permissionPoint does not exist!`);return i.asObservable()});return Oe.combineLatest(r).pipe(Ar.map(s=>s))}composePermission(n){return n.map(s=>{var o;const i=(o=this._permissionPointMap)==null?void 0:o.get(s);if(!i)throw new Error(`[PermissionService]: ${s} permissionPoint does not exist!`);return i.getValue()})}getAllPermissionPoint(){const n=new Map;return this._permissionPointMap.forEach((r,s)=>{n.set(s,r)}),n}}var wE=Object.getOwnPropertyDescriptor,bE=(e,t,n,r)=>{for(var s=r>1?void 0:r?wE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Ss=(e,t)=>(n,r)=>t(n,r,e);const AE=4,Lu=Symbol("DependentOn");class Ks extends st{onStarting(){}onReady(){}onRendered(){}onSteady(){}getUnitType(){return this.constructor.type}getPluginName(){return this.constructor.pluginName}}C(Ks,"pluginName"),C(Ks,"type",Be.UNIVER_UNKNOWN);class TE{constructor(){C(this,"_plugins",[])}addPlugin(t){this._plugins.push(t)}removePlugins(){const t=this._plugins.slice();return this._plugins.length=0,t}forEachPlugin(t){this._plugins.forEach(t)}}function yE(...e){return function(t){t[Lu]=e}}exports.PluginService=class{constructor(t,n,r){C(this,"_pluginRegistry",new Map);C(this,"_pluginStore",new TE);C(this,"_seenPlugins",new Set);C(this,"_loadedPlugins",new Set);C(this,"_loadedPluginTypes",new Set([Be.UNIVER_UNKNOWN]));C(this,"_flushTimerByType",new Map);this._injector=t,this._lifecycleService=n,this._logService=r}dispose(){this._pluginStore.removePlugins().forEach(t=>t.dispose()),this._flushTimerByType.forEach(t=>clearTimeout(t))}registerPlugin(t,n){this._assertPluginValid(t);const r={plugin:t,options:n};this._pluginRegistry.set(t.pluginName,r),this._logService.debug("[PluginService]",`Plugin "${t.pluginName}" registered.`);const{type:s}=t;this._loadedPluginTypes.has(s)&&(s===Be.UNIVER_UNKNOWN?this._loadFromPlugins([r]):this._flushType(s))}startPluginsForType(t){this._loadedPluginTypes.has(t)||this._loadPluginsForType(t)}_loadPluginsForType(t){const n=Array.from(this._pluginRegistry.keys()),r=[];n.forEach(s=>{const i=this._pluginRegistry.get(s);i.plugin.type===t&&r.push(i)}),this._loadFromPlugins(r),this._loadedPluginTypes.add(t)}_assertPluginValid(t){const{type:n,pluginName:r}=t;if(n===Be.UNRECOGNIZED)throw new Error(`[PluginService]: invalid plugin type for ${t.name}. Please assign a "type" to your plugin.`);if(!r)throw new Error(`[PluginService]: no plugin name for ${t.name}. Please assign a "pluginName" to your plugin.`);if(this._seenPlugins.has(r))throw new Error(`[PluginService]: duplicated plugin name for "${r}". Maybe a plugin that dependents on "${r} has already registered it. In that case please register "${r}" before the that plugin.`);this._seenPlugins.add(t.pluginName)}_flushType(t){this._flushTimerByType.get(t)===void 0&&this._flushTimerByType.set(t,setTimeout(()=>{this._loadPluginsForType(t),this._flushTimerByType.delete(t)},AE))}_loadFromPlugins(t){const n=[],r=new Set,s=o=>{const{plugin:a}=o,{pluginName:l}=a;if(this._loadedPlugins.has(l)||r.has(l))return;r.add(l),this._pluginRegistry.delete(l);const u=a[Lu];u&&u.forEach(c=>{const h=this._pluginRegistry.get(c.pluginName);if(h)s(h);else if(!this._seenPlugins.has(c.pluginName)&&!r.has(c.pluginName)){if(a.type===Be.UNIVER_UNKNOWN&&c.type!==Be.UNIVER_UNKNOWN)throw new Error(`[PluginService]: cannot register a plugin with Univer type that depends on a plugin with other type. The dependent is ${a.pluginName} and the dependency is ${c.pluginName}.`);a.type!==c.type&&c.type!==Be.UNIVER_UNKNOWN&&this._logService.debug("[PluginService]",`Plugin "${l}" depends on "${c.pluginName}" which has different type.`),this._logService.debug("[PluginService]",`Plugin "${l}" depends on "${c.pluginName}" which is not registered. Univer will automatically register it with default configuration.`),this._assertPluginValid(c),s({plugin:c,options:void 0})}}),n.push(o)};t.forEach(o=>s(o));const i=n.map(o=>this._initPlugin(o.plugin,o.options));this._pluginsRunLifecycle(i)}_pluginsRunLifecycle(t){const n=this._lifecycleService.stage;if(Nu(n).subscribe(r=>this._runStage(t,r)),n!==Je.Steady){const r=this._lifecycleService.lifecycle$.pipe(Oe.skip(1)).subscribe(s=>{this._runStage(t,s),s===Je.Steady&&r.unsubscribe()})}}_runStage(t,n){t.forEach(r=>{switch(n){case Je.Starting:r.onStarting();break;case Je.Ready:r.onReady();break;case Je.Rendered:r.onRendered();break;case Je.Steady:r.onSteady();break}})}_initPlugin(t,n){const r=this._injector.createInstance(t,n);return this._pluginStore.addPlugin(r),this._loadedPlugins.add(t.pluginName),this._logService.debug("[PluginService]",`Plugin "${r.getPluginName()}" loaded.`),r}};exports.PluginService=bE([Ss(0,je.Inject(je.Injector)),Ss(1,je.Inject(exports.LifecycleService)),Ss(2,bt)],exports.PluginService);function xu(e,t){if(!t)return e;const n=[];for(const r of e){const s=t.find(([i])=>i===r[0]);if(s){if(s[1]===null)continue;n.push([r[0],s[1]])}else n.push(r)}return n}const Xs=je.createIdentifier("resource-loader-service");class Uu extends st{constructor(){super(...arguments);C(this,"_resourceMap",new Map);C(this,"_register$",new Oe.Subject);C(this,"register$",this._register$.asObservable())}getAllResourceHooks(){return[...this._resourceMap.values()]}getResources(n,r){return r?this.getResourcesByType(n,r):this.getAllResourceHooks().map(o=>{const a=o.toJson(n);return{name:o.pluginName,data:a}})}getResourcesByType(n,r){return this.getAllResourceHooks().filter(o=>o.businesses.includes(r)).map(o=>{const a=o.toJson(n);return{name:o.pluginName,data:a}})}registerPluginResource(n){const r=n.pluginName;if(this._resourceMap.has(r))throw new Error(`the pluginName is registered {${r}}`);return this._resourceMap.set(r,n),this._register$.next(n),nt(()=>this._resourceMap.delete(r))}disposePluginResource(n){this._resourceMap.delete(n)}loadResources(n,r){this.getAllResourceHooks().forEach(s=>{var o;const i=(o=r==null?void 0:r.find(a=>a.name===s.pluginName))==null?void 0:o.data;if(i)try{const a=s.parseJson(i);s.onLoad(n,a)}catch{console.error("LoadResources Error!")}})}unloadResources(n){this.getAllResourceHooks().forEach(r=>{r.onUnLoad(n)})}dispose(){this._register$.complete(),this._resourceMap.clear()}}class wi extends st{constructor(){super();C(this,"_darkMode");C(this,"_darkMode$",new Oe.BehaviorSubject(!1));C(this,"darkMode$",this._darkMode$.asObservable());C(this,"_currentTheme");C(this,"_currentTheme$",new Oe.BehaviorSubject({}));C(this,"currentTheme$",this._currentTheme$.asObservable());this.disposeWithMe(nt(()=>{this._currentTheme$.complete(),this._darkMode$.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)}setDarkMode(n){this._darkMode=n,this._darkMode$.next(n)}}var NE=Object.getOwnPropertyDescriptor,ME=(e,t,n,r)=>{for(var s=r>1?void 0:r?NE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},vs=(e,t)=>(n,r)=>t(n,r,e);const as=je.createIdentifier("univer.undo-redo.service"),DE=20;class Pu{dispose(){}async dispatchToHandlers(){return!1}}const ku="univer.command.redo",Fu="univer.command.undo",Bu=new class extends Pu{constructor(){super(...arguments);C(this,"type",rr.COMMAND);C(this,"id",Fu)}handler(t){const n=t.get(as),r=n.pitchTopUndoElement();if(!r)return!1;const s=t.get(sr);return qr(r.undoMutations,s)?(n.popUndoToRedo(),!0):!1}},$u=new class extends Pu{constructor(){super(...arguments);C(this,"type",rr.COMMAND);C(this,"id",ku)}handler(t){const n=t.get(as),r=n.pitchTopRedoElement();if(!r)return!1;const s=t.get(sr);return qr(r.redoMutations,s)?(n.popRedoToUndo(),!0):!1}};exports.LocalUndoRedoService=class extends st{constructor(n,r,s){super();C(this,"undoRedoStatus$");C(this,"_undoRedoStatus$",new Oe.BehaviorSubject({undos:0,redos:0}));C(this,"_undoStacks",new Map);C(this,"_redoStacks",new Map);C(this,"_batchingStatus",new Map);this._univerInstanceService=n,this._commandService=r,this._contextService=s,this.undoRedoStatus$=this._undoRedoStatus$.asObservable(),this.disposeWithMe(this._commandService.registerCommand(Bu)),this.disposeWithMe(this._commandService.registerCommand($u)),this.disposeWithMe(nt(()=>this._undoRedoStatus$.complete())),this.disposeWithMe(nt(this._univerInstanceService.focused$.subscribe(()=>this._updateStatus())))}pushUndoRedo(n){const{unitID:r}=n,s=this._getRedoStack(r,!0),i=this._getUndoStack(r,!0);if(s.length=0,this._batchingStatus.has(n.unitID)){const a=this._batchingStatus.get(n.unitID),l=this._pitchUndoElement(n.unitID);a===0||!l?(o(n),this._batchingStatus.set(n.unitID,1)):this._tryBatchingElements(l,n)}else o(n);function o(a){i.push(a),i.length>DE&&i.splice(0,1)}this._updateStatus()}clearUndoRedo(n){const r=this._getRedoStack(n);r&&(r.length=0);const s=this._getUndoStack(n);s&&(s.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 r=this._getUndoStack(n);return r!=null&&r.length?r[r.length-1]:null}_pitchRedoElement(n){const r=this._getRedoStack(n);return r!=null&&r.length?r[r.length-1]:null}popUndoToRedo(){const r=this._getUndoStackForFocused().pop();r&&(this._getRedoStackForFocused().push(r),this._updateStatus())}popRedoToUndo(){const r=this._getRedoStackForFocused().pop();r&&(this._getUndoStackForFocused().push(r),this._updateStatus())}rollback(n,r){const s=r||this._getFocusedUnitId(),i=this._getUndoStack(s),o=i==null?void 0:i[(i==null?void 0:i.length)-1];o&&o.id===n&&(i.pop(),qr(o.undoMutations,this._commandService))}__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),nt(()=>this._batchingStatus.delete(n))}_updateStatus(){var i,o;const n=this._getFocusedUnitId(),r=n&&((i=this._undoStacks.get(n))==null?void 0:i.length)||0,s=n&&((o=this._redoStacks.get(n))==null?void 0:o.length)||0;this._undoRedoStatus$.next({undos:r,redos:s})}_getUndoStack(n,r=!1){let s=this._undoStacks.get(n);return!s&&r&&(s=[],this._undoStacks.set(n,s)),s||null}_getRedoStack(n,r=!1){let s=this._redoStacks.get(n);return!s&&r&&(s=[],this._redoStacks.set(n,s)),s||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,r){n.redoMutations.push(...r.redoMutations),n.undoMutations.push(...r.undoMutations)}_getFocusedUnitId(){var o,a,l,u;let n="";const r=this._contextService.getContextValue(On),s=this._contextService.getContextValue(mu),i=this._contextService.getContextValue(gu);return r?s?n=ni:i?n=ti:n=(a=(o=this._univerInstanceService.getFocusedUnit())==null?void 0:o.getUnitId())!=null?a:"":n=(u=(l=this._univerInstanceService.getFocusedUnit())==null?void 0:l.getUnitId())!=null?u:"",n}};exports.LocalUndoRedoService=ME([vs(0,Nn),vs(1,sr),vs(2,Mn)],exports.LocalUndoRedoService);function LE(e){return!(e.length===0||e.length>31||e.startsWith("'")||e.endsWith("'")||/[:\\\/\?\*\[\]]/.test(e))}function xE(e){return new Promise(t=>setTimeout(t,e))}function UE(e=1){return new Promise(t=>{let n=0;const r=()=>{n++,n>=e?t():requestAnimationFrame(r)};requestAnimationFrame(r)})}var bi=(e=>(e.URL="URL",e.UUID="UUID",e.BASE64="BASE64",e))(bi||{}),Hu=(e=>(e.SUCCUSS="0",e.ERROR_EXCEED_SIZE="1",e.ERROR_IMAGE_TYPE="2",e.ERROR_UPLOAD_COUNT_LIMIT="3",e.ERROR_IMAGE="4",e))(Hu||{});const qs=je.createIdentifier("core.image-io.service");class ju{constructor(t,n=100){C(this,"_imageCacheMap");this._injector=t,this._imageCacheMap=new Jn(n)}_getImageCacheKey(t,n){return`${t}-${n}`}getImage(t,n,r,s){const i=this._getImageCacheKey(t,n);let o=this._imageCacheMap.get(i);return o||((async()=>{o=new Image;const a=this._injector.has(qs)?this._injector.get(qs):null;if(t===bi.UUID)try{o.src=await(a==null?void 0:a.getImage(n))||""}catch(l){console.error(l)}else o.src=n;o.onload=()=>{r==null||r()},o.onerror=()=>{s==null||s()},this._imageCacheMap.set(i,o)})(),null)}}const PE=["script","style","meta","comment","link"];var Wu=(e=>(e[e.INFO=0]="INFO",e[e.STOP=1]="STOP",e[e.WARNING=2]="WARNING",e))(Wu||{}),Yu=(e=>(e[e.DISABLED=0]="DISABLED",e[e.FULL_ALPHA=1]="FULL_ALPHA",e[e.FULL_HANGUL=2]="FULL_HANGUL",e[e.FULL_KATAKANA=3]="FULL_KATAKANA",e[e.HALF_ALPHA=4]="HALF_ALPHA",e[e.HALF_HANGUL=5]="HALF_HANGUL",e[e.HALF_KATAKANA=6]="HALF_KATAKANA",e[e.HIRAGANA=7]="HIRAGANA",e[e.NO_CONTROL=8]="NO_CONTROL",e[e.OFF=9]="OFF",e[e.ON=10]="ON",e))(Yu||{}),Gu=(e=>(e.BETWEEN="between",e.EQUAL="equal",e.GREATER_THAN="greaterThan",e.GREATER_THAN_OR_EQUAL="greaterThanOrEqual",e.LESS_THAN="lessThan",e.LESS_THAN_OR_EQUAL="lessThanOrEqual",e.NOT_BETWEEN="notBetween",e.NOT_EQUAL="notEqual",e))(Gu||{}),zu=(e=>(e[e.TEXT=0]="TEXT",e[e.ARROW=1]="ARROW",e[e.CUSTOM=2]="CUSTOM",e))(zu||{}),Vu=(e=>(e.VALID="valid",e.INVALID="invalid",e.VALIDATING="validating",e))(Vu||{}),Ku=(e=>(e.CUSTOM="custom",e.LIST="list",e.LIST_MULTIPLE="listMultiple",e.NONE="none",e.TEXT_LENGTH="textLength",e.DATE="date",e.TIME="time",e.WHOLE="whole",e.DECIMAL="decimal",e.CHECKBOX="checkbox",e.ANY="any",e))(Ku||{}),kE=Object.getOwnPropertyDescriptor,FE=(e,t,n,r)=>{for(var s=r>1?void 0:r?kE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},BE=(e,t)=>(n,r)=>t(n,r,e);exports.Skeleton=class extends st{constructor(n){super();C(this,"_fontLocale");C(this,"_dirty",!0);this._localeService=n,this._localeInitial()}get dirty(){return this._dirty}getFontLocale(){return this._fontLocale}makeDirty(n){this._dirty=n}dispose(){super.dispose(),this._fontLocale=null}_localeInitial(){}};exports.Skeleton=FE([BE(0,je.Inject(an))],exports.Skeleton);var $E=Object.getOwnPropertyDescriptor,HE=(e,t,n,r)=>{for(var s=r>1?void 0:r?$E(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},br=(e,t)=>(n,r)=>t(n,r,e);exports.SheetSkeleton=class extends exports.Skeleton{constructor(n,r,s,i,o,a){super(s);C(this,"_worksheetData");C(this,"_renderRawFormula",!1);C(this,"_cellData");C(this,"_imageCacheMap");C(this,"_isRowStylePrecedeColumnStyle",!1);C(this,"_skipAutoHeightForMergedCells",!0);C(this,"_rowTotalHeight",0);C(this,"_columnTotalWidth",0);C(this,"_rowHeaderWidth",0);C(this,"_columnHeaderHeight",0);C(this,"_rowHeightAccumulation",[]);C(this,"_columnWidthAccumulation",[]);C(this,"_marginTop",0);C(this,"_marginLeft",0);C(this,"_scaleX");C(this,"_scaleY");C(this,"_scrollX");C(this,"_scrollY");this.worksheet=n,this._styles=r,this._contextService=i,this._configService=o,this._injector=a,this._worksheetData=this.worksheet.getConfig(),this._cellData=this.worksheet.getCellMatrix(),this._imageCacheMap=new ju(this._injector),this.initConfig()}initConfig(){var n,r;this._skipAutoHeightForMergedCells=!((n=this._configService.getConfig(ya))!=null&&n),this._isRowStylePrecedeColumnStyle=(r=this._configService.getConfig(Ta))!=null?r:!1}resetCache(){}getWorksheetConfig(){return this._worksheetData}getLocation(){return[this.worksheet.getUnitId(),this.worksheet.getSheetId()]}set columnHeaderHeight(n){this._columnHeaderHeight=n,this._worksheetData.columnHeader.height=n}set rowHeaderWidth(n){this._rowHeaderWidth=n,this._worksheetData.rowHeader.width=n}get rowHeightAccumulation(){return this._rowHeightAccumulation}get rowTotalHeight(){return this._rowTotalHeight}get columnWidthAccumulation(){return this._columnWidthAccumulation}get columnTotalWidth(){return this._columnTotalWidth}get rowHeaderWidth(){return this._rowHeaderWidth}get columnHeaderHeight(){return this._columnHeaderHeight}setMarginLeft(n){this._marginLeft=n}setMarginTop(n){this._marginTop=n}setScale(n,r){this._updateLayout(),this._scaleX=n,this._scaleY=r||n,this._updateLayout()}setScroll(n,r){re.isDefine(n)&&(this._scrollX=n),re.isDefine(r)&&(this._scrollY=r)}get scrollX(){return this._scrollX}get scrollY(){return this._scrollY}get scaleX(){return this._scaleX}get scaleY(){return this._scaleY}get rowHeaderWidthAndMarginLeft(){return this.rowHeaderWidth+this._marginLeft}get columnHeaderHeightAndMarginTop(){return this.columnHeaderHeight+this._marginTop}get imageCacheMap(){return this._imageCacheMap}_generateRowMatrixCache(n,r,s){let i=0;const o=[],a=r;for(let l=0;l<n;l++){let u=s;if(this.worksheet.getRowFiltered(l))u=0;else if(a[l]!=null){const c=a[l];if(!c)continue;const{h=s,ah:d,ia:f}=c;(f==null||f===Ie.TRUE)&&typeof d=="number"?u=d:u=h,c.hd===Ie.TRUE&&(u=0)}i+=u,o.push(i)}return{rowTotalHeight:i,rowHeightAccumulation:o}}_generateColumnMatrixCache(n,r,s){let i=0;const o=[],a=r;for(let l=0;l<n;l++){let u=s;if(a[l]!=null){const c=a[l];if(!c)continue;c.w!=null&&(u=c.w),c.hd===Ie.TRUE&&(u=0)}i+=u,o.push(i)}return{columnTotalWidth:i,columnWidthAccumulation:o}}intersectMergeRange(n,r){return!!this.worksheet.getMergedCell(n,r)}_getOverflowBound(n,r,s,i,o=At.LEFT){let a=0;if(r>s){const l=this._columnWidthAccumulation.length-1;for(let u=r;u>=s;u--){const c=u,h=this.worksheet.getCell(n,c);if(!Ms(h)&&c!==r||this.intersectMergeRange(n,c))return c===r?c:c+1>l?l:c+1;const{startX:d,endX:f}=Rn(n,c,this.rowHeightAccumulation,this.columnWidthAccumulation);if(o===At.CENTER&&c===r?a+=(f-d)/2:a+=f-d,i<a)return c}return r}for(let l=r;l<=s;l++){const u=l,c=this.worksheet.getCell(n,u);if(!Ms(c)&&u!==r||this.intersectMergeRange(n,u))return u===r?u:u-1<0?0:u-1;const{startX:h,endX:d}=Rn(n,u,this.rowHeightAccumulation,this.columnWidthAccumulation);if(o===At.CENTER&&u===r?a+=(d-h)/2:a+=d-h,i<a)return u}return s}_updateLayout(){if(!this.dirty)return;const{rowData:n,columnData:r,defaultRowHeight:s,defaultColumnWidth:i,rowCount:o,columnCount:a,rowHeader:l,columnHeader:u}=this._worksheetData,{rowTotalHeight:c,rowHeightAccumulation:h}=this._generateRowMatrixCache(o,n,s),{columnTotalWidth:d,columnWidthAccumulation:f}=this._generateColumnMatrixCache(a,r,i);this._rowHeaderWidth=l.hidden!==Ie.TRUE?this._dynamicallyUpdateRowHeaderWidth(l):0,this._columnHeaderHeight=u.hidden!==Ie.TRUE?u.height:0,this._rowTotalHeight=c,this._rowHeightAccumulation=h,this._columnTotalWidth=d,this._columnWidthAccumulation=f,this.makeDirty(!1)}calculate(){return this.resetCache(),this._updateLayout(),this}resetRangeCache(n){}_dynamicallyUpdateRowHeaderWidth(n){const s=`${this.worksheet.getRowCount()}`.length*8;return Math.max(n.width,s)}_hasUnMergedCellInRow(n,r,s){if(!this.worksheet.getMergeData())return!1;for(let o=r;o<=s;o++){const{isMerged:a,isMergedMainCell:l}=this.worksheet.getCellInfoInMergeData(n,o);if(!a&&!l)return!0}return!1}expandRangeByMerge(n){let{startRow:r,startColumn:s,endRow:i,endColumn:o}=n;const a=this._worksheetData.mergeData;if(!a)return{startRow:r,startColumn:s,endRow:i,endColumn:o};let l=!0;const u=new Tt;for(;l;){l=!1;for(let c=0;c<a.length;c++){const{startRow:h,startColumn:d,endRow:f,endColumn:p}=a[c];if(u.getValue(h,d))continue;cl({startColumn:s,startRow:r,endColumn:o,endRow:i},{startColumn:d,startRow:h,endColumn:p,endRow:f})&&(r=Math.min(r,h),s=Math.min(s,d),i=Math.max(i,f),o=Math.max(o,p),u.setValue(h,d,!0),l=!0)}}return{startRow:r,startColumn:s,endRow:i,endColumn:o}}getColumnCount(){return this._columnWidthAccumulation.length}getRowCount(){return this._rowHeightAccumulation.length}_getCellMergeInfo(n,r){return this.worksheet.getCellInfoInMergeData(n,r)}getNoMergeCellPositionByIndex(n,r,s=!0){return this.getNoMergeCellWithCoordByIndex(n,r,s)}getNoMergeCellWithCoordByIndex(n,r,s=!0){const{rowHeightAccumulation:i,columnWidthAccumulation:o,rowHeaderWidthAndMarginLeft:a,columnHeaderHeightAndMarginTop:l}=this;let{startY:u,endY:c,startX:h,endX:d}=Rn(n,r,i,o);return s&&(u+=l,c+=l,h+=a,d+=a),{startY:u,endY:c,startX:h,endX:d}}getNoMergeCellPositionByIndexWithNoHeader(n,r){const{rowHeightAccumulation:s,columnWidthAccumulation:i}=this,{startY:o,endY:a,startX:l,endX:u}=Rn(n,r,s,i);return{startY:o,endY:a,startX:l,endX:u}}getRowIndexByOffsetY(n,r,s,i){var l;const{rowHeightAccumulation:o}=this;n=qu(n,r,s,this.columnHeaderHeightAndMarginTop);let a=Bn(o,n,i==null?void 0:i.firstMatch);return i!=null&&i.closeFirst&&Math.abs(o[a]-n)<Math.abs(n-((l=o[a-1])!=null?l:0))&&(a=a+1),a}getColumnIndexByOffsetX(n,r,s,i){var u;const o=Xu(n,r,s,this.rowHeaderWidthAndMarginLeft),{columnWidthAccumulation:a}=this;let l=Bn(a,o,i==null?void 0:i.firstMatch);return i!=null&&i.closeFirst&&Math.abs(a[l]-o)<Math.abs(o-((u=a[l-1])!=null?u:0))&&(l=l+1),l}getCellIndexByOffset(n,r,s,i,o,a){const l=this.getRowIndexByOffsetY(r,i,o,a),u=this.getColumnIndexByOffsetX(n,s,o,a);return{row:l,column:u}}getCellByOffset(n,r,s,i,o){const a=this==null?void 0:this.getCellIndexByOffset(n,r,s,i,o,{firstMatch:!0});return a?this.worksheet.getCellInfoInMergeData(a.row,a.column):null}getCellWithCoordByIndex(n,r,s=!0){const{rowHeightAccumulation:i,columnWidthAccumulation:o,rowHeaderWidthAndMarginLeft:a,columnHeaderHeightAndMarginTop:l}=this,u=Rn(n,r,i,o,this.worksheet.getCellInfoInMergeData(n,r)),{isMerged:c,isMergedMainCell:h}=u;let{startY:d,endY:f,startX:p,endX:R,mergeInfo:w}=u,N=a,z=l;return s===!1&&(N=0,z=0),d+=z,f+=z,p+=N,R+=N,w.startY+=z,w.endY+=z,w.startX+=N,w.endX+=N,{actualRow:n,actualColumn:r,startX:p,startY:d,endX:R,endY:f,isMerged:c,isMergedMainCell:h,mergeInfo:w}}getCellWithCoordByOffset(n,r,s,i,o,a){const{row:l,column:u}=this.getCellIndexByOffset(n,r,s,i,o,a);return this.getCellWithCoordByIndex(l,u)}getOffsetByColumn(n){const{columnWidthAccumulation:r,rowHeaderWidthAndMarginLeft:s}=this,i=r.length-1,o=r[n];return o!=null?o+s:n<0?s:r[i]+s}getOffsetByRow(n){const{rowHeightAccumulation:r,columnHeaderHeightAndMarginTop:s}=this,i=r.length-1,o=r[n];return o!=null?o+s:n<0?s:r[i]+s}getOffsetRelativeToRowCol(n,r){const s=Bn(this.columnWidthAccumulation,n);let i=0;s===0?i=n:i=n-this._columnWidthAccumulation[s-1];const o=Bn(this.rowHeightAccumulation,r);let a=0;return o===0?a=r:a=r-this._rowHeightAccumulation[o-1],{row:o,column:s,columnOffset:i,rowOffset:a}}_updateConfigAndGetDocumentModel(n,r,s,i){var a,l,u,c,h;if(!i||!((a=n.body)!=null&&a.dataStream))return;n.documentStyle||(n.documentStyle={}),n.documentStyle.marginTop=(l=s.t)!=null?l:0,n.documentStyle.marginBottom=(u=s.b)!=null?u:2,n.documentStyle.marginLeft=(c=s.l)!=null?c:2,n.documentStyle.marginRight=(h=s.r)!=null?h:2,n.documentStyle.pageSize={width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY},n.documentStyle.renderConfig={...n.documentStyle.renderConfig,...i};const o=n.body.paragraphs||[];for(const d of o)d.paragraphStyle||(d.paragraphStyle={}),d.paragraphStyle.horizontalAlign=r;return new Nt(n)}dispose(){super.dispose(),this._rowHeightAccumulation=[],this._columnWidthAccumulation=[],this._rowTotalHeight=0,this._columnTotalWidth=0,this._rowHeaderWidth=0,this._columnHeaderHeight=0,this._worksheetData=null,this._cellData=null,this._styles=null}};exports.SheetSkeleton=HE([br(2,je.Inject(an)),br(3,Mn),br(4,Si),br(5,je.Inject(je.Injector))],exports.SheetSkeleton);function Ai(e,t,n,r){const s=e-1,i=t-1,o=n[s]||0;let a=n[e];a==null&&(a=n[n.length-1]);const l=r[i]||0;let u=r[t];return u==null&&(u=r[r.length-1]),{startY:o,endY:a,startX:l,endX:u}}function jE(e,t,n,r){return Ai(e,t,n,r)}function Rn(e,t,n,r,s){e=re.clamp(e,0,n.length-1),t=re.clamp(t,0,r.length-1);let{startY:i,endY:o,startX:a,endX:l}=Ai(e,t,n,r);if(!s)return{startY:i,endY:o,startX:a,endX:l,isMerged:!1,isMergedMainCell:!1,actualRow:e,actualColumn:t,mergeInfo:{startY:i,endY:o,startX:a,endX:l,startRow:e,startColumn:t,endRow:e,endColumn:t}};const{isMerged:u,isMergedMainCell:c,startRow:h,startColumn:d,endRow:f,endColumn:p}=s;let R={startRow:h,startColumn:d,endRow:f,endColumn:p,startY:i,endY:o,startX:a,endX:l};const w=n.length-1,N=r.length-1;if(u&&h!==-1&&d!==-1){const z=n[h-1]||0,W=n[f]||n[w],se=r[d-1]||0,y=r[p]||r[N];R={...R,startY:z,endY:W,startX:se,endX:y}}else if(!u&&f!==-1&&p!==-1){const z=n[f]||n[w],W=r[p]||r[N];R={...R,startY:i,endY:z,startX:a,endX:W}}return{isMerged:u,isMergedMainCell:c,actualRow:e,actualColumn:t,startY:i,endY:o,startX:a,endX:l,mergeInfo:R}}function Xu(e,t,n,r){const{x:s}=n;return e/t+s-r}function qu(e,t,n,r){const{y:s}=n;return e=e/t+s-r,e}const Lo=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],Os=1,kn=8;class Ti{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[n,r]=new Uint8Array(t,0,2);if(n!==219)throw new Error("Data does not appear to be in a KDBush format.");const s=r>>4;if(s!==Os)throw new Error(`Got v${s} data when expected v${Os}.`);const i=Lo[r&15];if(!i)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(t,2,1),[a]=new Uint32Array(t,4,1);return new Ti(a,o,i,t)}constructor(t,n=64,r=Float64Array,s){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+n,2),65535),this.ArrayType=r,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const i=Lo.indexOf(this.ArrayType),o=t*2*this.ArrayType.BYTES_PER_ELEMENT,a=t*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-a%8)%8;if(i<0)throw new Error(`Unexpected typed array class: ${r}.`);s&&s instanceof ArrayBuffer?(this.data=s,this.ids=new this.IndexArrayType(this.data,kn,t),this.coords=new this.ArrayType(this.data,kn+a+l,t*2),this._pos=t*2,this._finished=!0):(this.data=new ArrayBuffer(kn+o+a+l),this.ids=new this.IndexArrayType(this.data,kn,t),this.coords=new this.ArrayType(this.data,kn+a+l,t*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(Os<<4)+i]),new Uint16Array(this.data,2,1)[0]=n,new Uint32Array(this.data,4,1)[0]=t)}add(t,n){const r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=t,this.coords[this._pos++]=n,r}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return Js(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,n,r,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:i,coords:o,nodeSize:a}=this,l=[0,i.length-1,0],u=[];for(;l.length;){const c=l.pop()||0,h=l.pop()||0,d=l.pop()||0;if(h-d<=a){for(let w=d;w<=h;w++){const N=o[2*w],z=o[2*w+1];N>=t&&N<=r&&z>=n&&z<=s&&u.push(i[w])}continue}const f=d+h>>1,p=o[2*f],R=o[2*f+1];p>=t&&p<=r&&R>=n&&R<=s&&u.push(i[f]),(c===0?t<=p:n<=R)&&(l.push(d),l.push(f-1),l.push(1-c)),(c===0?r>=p:s>=R)&&(l.push(f+1),l.push(h),l.push(1-c))}return u}within(t,n,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:s,coords:i,nodeSize:o}=this,a=[0,s.length-1,0],l=[],u=r*r;for(;a.length;){const c=a.pop()||0,h=a.pop()||0,d=a.pop()||0;if(h-d<=o){for(let w=d;w<=h;w++)xo(i[2*w],i[2*w+1],t,n)<=u&&l.push(s[w]);continue}const f=d+h>>1,p=i[2*f],R=i[2*f+1];xo(p,R,t,n)<=u&&l.push(s[f]),(c===0?t-r<=p:n-r<=R)&&(a.push(d),a.push(f-1),a.push(1-c)),(c===0?t+r>=p:n+r>=R)&&(a.push(f+1),a.push(h),a.push(1-c))}return l}}function Js(e,t,n,r,s,i){if(s-r<=n)return;const o=r+s>>1;Ju(e,t,o,r,s,i),Js(e,t,n,r,o-1,1-i),Js(e,t,n,o+1,s,1-i)}function Ju(e,t,n,r,s,i){for(;s>r;){if(s-r>600){const u=s-r+1,c=n-r+1,h=Math.log(u),d=.5*Math.exp(2*h/3),f=.5*Math.sqrt(h*d*(u-d)/u)*(c-u/2<0?-1:1),p=Math.max(r,Math.floor(n-c*d/u+f)),R=Math.min(s,Math.floor(n+(u-c)*d/u+f));Ju(e,t,n,p,R,i)}const o=t[2*n+i];let a=r,l=s;for(Fn(e,t,r,n),t[2*s+i]>o&&Fn(e,t,r,s);a<l;){for(Fn(e,t,a,l),a++,l--;t[2*a+i]<o;)a++;for(;t[2*l+i]>o;)l--}t[2*r+i]===o?Fn(e,t,r,l):(l++,Fn(e,t,l,s)),l<=n&&(r=l+1),n<=l&&(s=l-1)}}function Fn(e,t,n,r){ws(e,n,r),ws(t,2*n,2*r),ws(t,2*n+1,2*r+1)}function ws(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function xo(e,t,n,r){const s=e-n,i=t-r;return s*s+i*i}class WE{constructor(t=!1){C(this,"_tree",new Map);C(this,"_oneCellCache",new Map);C(this,"_kdTree",new Map);this._enableOneCellCache=t}dispose(){this.clear()}getTree(t,n){return this._tree.has(t)||this._tree.set(t,new Map),this._tree.get(t).has(n)||this._tree.get(t).set(n,new Yr),this._tree.get(t).get(n)}_getOneCellCache(t,n,r,s){return this._oneCellCache.has(t)||this._oneCellCache.set(t,new Map),this._oneCellCache.get(t).has(n)||this._oneCellCache.get(t).set(n,new Map),this._oneCellCache.get(t).get(n).has(r)||this._oneCellCache.get(t).get(n).set(r,new Map),this._oneCellCache.get(t).get(n).get(r).has(s)||this._oneCellCache.get(t).get(n).get(r).set(s,new Set),this._oneCellCache.get(t).get(n).get(r).get(s)}_removeOneCellCache(t,n,r,s,i){const o=this._oneCellCache.get(t);if(!o)return;const a=o.get(n);if(!a)return;const l=a.get(r);if(!l)return;const u=l.get(s);u&&u.delete(i)}_removeCellCacheByRange(t){const{unitId:n,sheetId:r,range:s,id:i}=t,o=this._oneCellCache.get(n);if(!o)return;const a=o.get(r);if(!a)return;const{startRow:l,startColumn:u,endRow:c,endColumn:h}=s;for(let d=l;d<=c;d++){const f=a.get(d);if(f)for(let p=u;p<=h;p++){const R=f.get(p);R&&R.delete(i)}}}_insertOneCellCache(t,n,r,s,i){this._getOneCellCache(t,n,r,s).add(i)}_getRdTreeItems(t){const n=[];for(const[r,s]of t)for(const[i,o]of s)n.push({x:i,y:r,ids:o});return n}_searchByOneCellCache(t){var p;const{unitId:n,sheetId:r,range:s}=t,{startRow:i,startColumn:o,endRow:a,endColumn:l}=s,u=(p=this._kdTree.get(n))==null?void 0:p.get(r);if(!u)return[];const{tree:c,items:h}=u,d=c.range(o,i,l,a),f=[];for(const R of d){const w=h[R];f.push(...Array.from(w.ids))}return f}openKdTree(){var t;for(const[n,r]of this._oneCellCache){this._kdTree.has(n)||this._kdTree.set(n,new Map);for(const[s,i]of r){const o=this._getRdTreeItems(i),a=new Ti(o.length);(t=this._kdTree.get(n))==null||t.set(s,{tree:a,items:o});for(const l of o)a.add(l.x,l.y);a.finish()}}}closeKdTree(){var t;for(const[n,r]of this._oneCellCache)for(const[s,i]of r)(t=this._kdTree.get(n))==null||t.set(s,void 0)}insert(t){const{unitId:n,sheetId:r,range:s,id:i}=t;if(!n||n.length===0)return;let{startRow:o,endRow:a,startColumn:l,endColumn:u}=s;if(this._enableOneCellCache&&o===a&&l===u){this._insertOneCellCache(n,r,o,l,i);return}const c=this.getTree(n,r);Number.isNaN(o)&&(o=0),Number.isNaN(l)&&(l=0),Number.isNaN(a)&&(a=Number.POSITIVE_INFINITY),Number.isNaN(u)&&(u=Number.POSITIVE_INFINITY),c.insert({minX:l,minY:o,maxX:u,maxY:a,id:i})}bulkInsert(t){for(const n of t)this.insert(n)}*searchGenerator(t){var a;const{unitId:n,sheetId:r,range:s}=t;if(this._enableOneCellCache){const l=this._searchByOneCellCache(t);for(const u of l)yield u}const i=(a=this._tree.get(n))==null?void 0:a.get(r);if(!i)return;const o=i.search({minX:s.startColumn,minY:s.startRow,maxX:s.endColumn,maxY:s.endRow});for(const l of o)yield l.id}bulkSearch(t,n){const r=new Set;for(const s of t)for(const i of this.searchGenerator(s))(n==null?void 0:n.has(i))!==!0&&r.add(i);return r}removeById(t,n){var r,s;n?((r=this._tree.get(t))==null||r.delete(n),(s=this._oneCellCache.get(t))==null||s.delete(n)):(this._tree.delete(t),this._oneCellCache.delete(t))}_removeRTreeItem(t){const{unitId:n,sheetId:r,range:s,id:i}=t,o=this.getTree(n,r),a=o.search({minX:s.startColumn,minY:s.startRow,maxX:s.endColumn,maxY:s.endRow});for(let l=0;l<a.length;l++)a[l].id===i&&o.remove(a[l])}remove(t){const{unitId:n,sheetId:r,range:s,id:i}=t,{startRow:o,startColumn:a,endRow:l,endColumn:u}=s;this._enableOneCellCache?o===l&&a===u?this._removeOneCellCache(n,r,s.startRow,s.startColumn,i):(this._removeCellCacheByRange(t),this._removeRTreeItem(t)):this._removeRTreeItem(t)}bulkRemove(t){for(const n of t)this.remove(n)}clear(){this._tree.clear(),this._oneCellCache.clear()}toJSON(){const t={};return this._tree.forEach((n,r)=>{t[r]={},n.forEach((s,i)=>{t[r][i]=s.toJSON()})}),t}fromJSON(t){this._tree.clear();for(const n in t){this._tree.set(n,new Map);for(const r in t[n]){const s=new Yr;s.fromJSON(t[n][r]),this._tree.get(n).set(r,s)}}}}var YE=Object.getOwnPropertyDescriptor,GE=(e,t,n,r)=>{for(var s=r>1?void 0:r?YE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Uo=(e,t)=>(n,r)=>t(n,r,e);let Zs=class extends st{constructor(e,t){super(),this._resourceManagerService=e,this._univerInstanceService=t,this._init()}_init(){const e=n=>{n.businesses.forEach(r=>{switch(r){case Be.UNRECOGNIZED:case Be.UNIVER_UNKNOWN:case Be.UNIVER_SLIDE:case Be.UNIVER_DOC:{this._univerInstanceService.getAllUnitsForType(Be.UNIVER_DOC).forEach(s=>{const o=(s.getSnapshot().resources||[]).find(a=>a.name===n.pluginName);if(o)try{const a=n.parseJson(o.data);n.onLoad(s.getUnitId(),a)}catch{console.error(`Load Document{${s.getUnitId()}} Resources{${n.pluginName}} Data Error.`)}});break}case Be.UNIVER_SHEET:this._univerInstanceService.getAllUnitsForType(Be.UNIVER_SHEET).forEach(s=>{const o=(s.getSnapshot().resources||[]).find(a=>a.name===n.pluginName);if(o)try{const a=n.parseJson(o.data);n.onLoad(s.getUnitId(),a)}catch{console.error(`Load Workbook{${s.getUnitId()}} Resources{${n.pluginName}} Data Error.`)}})}})};this._resourceManagerService.getAllResourceHooks().forEach(n=>e(n)),this.disposeWithMe(this._resourceManagerService.register$.subscribe(n=>e(n))),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(Be.UNIVER_SHEET).subscribe(n=>{this._resourceManagerService.loadResources(n.getUnitId(),n.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(Be.UNIVER_DOC).subscribe(n=>{const r=n.getUnitId();Na(r)||this._resourceManagerService.loadResources(n.getUnitId(),n.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(Be.UNIVER_SHEET).subscribe(n=>{this._resourceManagerService.unloadResources(n.getUnitId())})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(Be.UNIVER_DOC).subscribe(n=>{this._resourceManagerService.unloadResources(n.getUnitId())}))}saveUnit(e){const t=this._univerInstanceService.getUnit(e);if(!t)return null;const n=this._resourceManagerService.getResources(e,t.type),r=re.deepClone(t.getSnapshot());return r.resources=n,r}};Zs=GE([Uo(0,je.Inject(os)),Uo(1,je.Inject(Nn))],Zs);class zE{constructor(t={},n){C(this,"_startedTypes",new Set);C(this,"_injector");C(this,"_disposingCallbacks",new Xr);const r=this._injector=VE(n,t==null?void 0:t.override),{theme:s,locale:i,locales:o,logLevel:a}=t;s&&this._injector.get(wi).setTheme(s),o&&this._injector.get(an).load(o),i&&this._injector.get(an).setLocale(i),a&&this._injector.get(bt).setLogLevel(a),this._init(r)}get _univerInstanceService(){return this._injector.get(Nn)}get _pluginService(){return this._injector.get(exports.PluginService)}__getInjector(){return this._injector}onDispose(t){const n=this._disposingCallbacks.add(nt(t));return nt(()=>n.dispose(!0))}dispose(){this._disposingCallbacks.dispose(),this._injector.dispose()}setLocale(t){this._injector.get(an).setLocale(t)}createUnit(t,n){return this._univerInstanceService.createUnit(t,n)}createUniverSheet(t){return this._injector.get(bt).warn("[Univer]","Univer.createUniverSheet is deprecated, use createUnit instead"),this._univerInstanceService.createUnit(Be.UNIVER_SHEET,t)}createUniverDoc(t){return this._injector.get(bt).warn("[Univer]","Univer.createUniverDoc is deprecated, use createUnit instead"),this._univerInstanceService.createUnit(Be.UNIVER_DOC,t)}createUniverSlide(t){return this._injector.get(bt).warn("[Univer]","Univer.createUniverSlide is deprecated, use createUnit instead"),this._univerInstanceService.createUnit(Be.UNIVER_SLIDE,t)}_init(t){this._univerInstanceService.registerCtorForType(Be.UNIVER_SHEET,exports.Workbook),this._univerInstanceService.registerCtorForType(Be.UNIVER_DOC,Nt),this._univerInstanceService.registerCtorForType(Be.UNIVER_SLIDE,vi);const n=t.get(Nn);n.__setCreateHandler((r,s,i,o)=>{if(!this._startedTypes.has(r)){this._pluginService.startPluginsForType(r),this._startedTypes.add(r);const l=t.createInstance(i,s);return n.__addUnit(l,o),this._tryProgressToReady(),l}const a=t.createInstance(i,s);return n.__addUnit(a,o),a})}_tryProgressToReady(){this._injector.get(exports.LifecycleService).stage<Je.Ready&&(this._injector.get(exports.LifecycleService).stage=Je.Ready)}registerPlugin(t,n){this._pluginService.registerPlugin(t,n)}}function VE(e,t){const n=xu([[_u],[an],[wi],[exports.LifecycleService],[exports.PluginService],[er],[Nn,{useClass:exports.UniverInstanceService}],[Mu,{useClass:Du}],[bt,{useClass:Wo,lazy:!0}],[sr,{useClass:exports.CommandService}],[as,{useClass:exports.LocalUndoRedoService,lazy:!0}],[Si,{useClass:fu}],[Mn,{useClass:Ho}],[os,{useClass:Uu,lazy:!0}],[Xs,{useClass:Zs,lazy:!0}],[hu,{useClass:exports.AuthzIoLocalService}],[du,{useClass:exports.MentionIOLocalService,lazy:!0}]],t),r=e?e.createChild(n):new je.Injector(n);return Fo(r,[[er],[Xs]]),r}nc();exports.ABCToNumber=Vd;exports.AUTO_HEIGHT_FOR_MERGED_CELLS=ya;exports.AbsoluteRefType=tt;exports.ActionIterator=Cn;exports.AlignTypeH=Qa;exports.AlignTypeV=el;exports.ArrangeTypeEnum=rl;exports.ArrowsAndMarkersShapes=oa;exports.AsyncInterceptorManager=bp;exports.AsyncLock=c_;exports.AutoFillSeries=Xo;exports.BaselineOffset=kt;exports.BasicShapes=ia;exports.BlockType=La;exports.BooleanNumber=Ie;exports.BorderStyleTypes=Xe;exports.BorderType=qo;exports.BuildTextUtils=ot;exports.BulletAlignment=ar;exports.COLORS=Ns;exports.CanceledError=cc;exports.CellModeEnum=In;exports.CellValueType=Kt;exports.Color=un;exports.ColorBuilder=Zr;exports.ColorKit=wt;exports.ColorType=It;exports.ColumnSeparatorType=Pa;exports.CommandType=rr;exports.CommonHideTypes=Jo;exports.ConfigService=fu;exports.ContextService=Ho;exports.CopyPasteType=Zo;exports.CustomCommandExecutionError=bs;exports.CustomDecorationType=sn;exports.CustomRangeType=Jt;exports.DEFAULT_CELL=vd;exports.DEFAULT_DOC=Ei;exports.DEFAULT_DOCUMENT_SUB_COMPONENT_ID=Dp;exports.DEFAULT_EMPTY_DOCUMENT_VALUE=Aa;exports.DEFAULT_RANGE=Id;exports.DEFAULT_RANGE_ARRAY=Rd;exports.DEFAULT_SELECTION=Sd;exports.DEFAULT_SLIDE=al;exports.DEFAULT_STYLES=ut;exports.DEFAULT_WORKSHEET_COLUMN_COUNT=Su;exports.DEFAULT_WORKSHEET_COLUMN_COUNT_KEY=aE;exports.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT=bu;exports.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY=hE;exports.DEFAULT_WORKSHEET_COLUMN_WIDTH=Ou;exports.DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY=uE;exports.DEFAULT_WORKSHEET_ROW_COUNT=Iu;exports.DEFAULT_WORKSHEET_ROW_COUNT_KEY=oE;exports.DEFAULT_WORKSHEET_ROW_HEIGHT=vu;exports.DEFAULT_WORKSHEET_ROW_HEIGHT_KEY=lE;exports.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH=wu;exports.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY=cE;exports.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY=ni;exports.DOCS_NORMAL_EDITOR_UNIT_ID_KEY=ti;exports.DOCS_ZEN_EDITOR_UNIT_ID_KEY=ba;exports.DOC_DRAWING_PRINTING_COMPONENT_KEY=Td;exports.DOC_RANGE_TYPE=Ca;exports.DashStyleType=ja;exports.DataStreamTreeNodeType=fl;exports.DataStreamTreeTokenType=_t;exports.DataValidationErrorStyle=Wu;exports.DataValidationImeMode=Yu;exports.DataValidationOperator=Gu;exports.DataValidationRenderMode=zu;exports.DataValidationStatus=Vu;exports.DataValidationType=Ku;exports.DeleteDirection=Qo;exports.DependentOn=yE;exports.DesktopLogService=Wo;exports.DeveloperMetadataVisibility=ea;exports.Dimension=ta;exports.Direction=na;exports.Disposable=st;exports.DisposableCollection=Xr;exports.DocStyleType=Ma;exports.DocumentDataModel=Nt;exports.DocumentFlavor=ri;exports.DrawingTypeEnum=sl;exports.EDITOR_ACTIVATED=gu;exports.EXTENSION_NAMES=ll;exports.ErrorService=_u;exports.EventState=cu;exports.EventSubject=Lp;exports.FOCUSING_COMMON_DRAWINGS=Vp;exports.FOCUSING_DOC=Gn;exports.FOCUSING_EDITOR_BUT_HIDDEN=Hp;exports.FOCUSING_EDITOR_INPUT_FORMULA=jp;exports.FOCUSING_EDITOR_STANDALONE=Yp;exports.FOCUSING_FX_BAR_EDITOR=mu;exports.FOCUSING_PANEL_EDITOR=Gp;exports.FOCUSING_SHEET=On;exports.FOCUSING_SLIDE=zn;exports.FOCUSING_UNIT=Yn;exports.FOCUSING_UNIVER_EDITOR=Wp;exports.FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE=zp;exports.FORMULA_EDITOR_ACTIVATED=Kp;exports.FollowNumberWithType=Da;exports.FontItalic=$r;exports.FontStyleType=Sn;exports.FontWeight=Hr;exports.GridType=xa;exports.HLSColor=_a;exports.HorizontalAlign=At;exports.IAuthzIoService=hu;exports.ICommandService=sr;exports.IConfigService=Si;exports.IContextService=Mn;exports.IImageIoService=qs;exports.ILocalStorageService=OE;exports.ILogService=bt;exports.IMentionIOService=du;exports.IPermissionService=Mu;exports.IResourceLoaderService=Xs;exports.IResourceManagerService=os;exports.IS_ROW_STYLE_PRECEDE_COLUMN_STYLE=Ta;exports.IUndoRedoService=as;exports.IUniverInstanceService=Nn;exports.ImageCacheMap=ju;exports.ImageSourceType=bi;exports.ImageUploadStatusType=Hu;exports.InterceptorEffectEnum=vn;exports.InterceptorManager=vp;exports.InterpolationPointType=ra;exports.JSON1=C_;exports.JSONX=Bt;exports.LRUHelper=Hn;exports.LRUMap=Jn;exports.LifecycleStages=Je;exports.ListGlyphType=Ne;exports.LocaleService=an;exports.LocaleType=ir;exports.LogLevel=jo;exports.MOVE_BUFFER_VALUE=$n;exports.MemoryCursor=dn;exports.MentionType=Br;exports.NAMED_STYLE_MAP=wd;exports.NAMED_STYLE_SPACE_MAP=bd;exports.NamedStyleType=rt;exports.NilCommand=Yo;exports.NumberUnitType=Za;exports.ObjectMatrix=Tt;exports.ObjectRelativeFromH=qa;exports.ObjectRelativeFromV=Ja;exports.OtherShapes=aa;exports.PAGE_SIZE=yd;exports.PAPER_TYPES=Cd;exports.PRESET_LIST_TYPE=hr;exports.PRINT_CHART_COMPONENT_KEY=Ad;exports.PageElementType=il;exports.PageOrientType=nl;exports.PageType=si;exports.PaperType=pt;exports.ParagraphElementType=Fa;exports.ParagraphStyleBuilder=Qn;exports.ParagraphStyleValue=fr;exports.PermissionService=Du;exports.PermissionStatus=Oi;exports.Plugin=Ks;exports.PositionedObjectLayoutType=$a;exports.PresetListType=xt;exports.ProtectionType=sa;exports.QuickListType=Xl;exports.QuickListTypeMap=w_;exports.RANGE_DIRECTION=Ea;exports.RANGE_TYPE=Le;exports.RBush=Yr;exports.RCDisposable=gc;exports.RGBA_PAREN=Yc;exports.RGB_PAREN=Wc;exports.ROTATE_BUFFER_VALUE=Ko;exports.RTree=WE;exports.Range=An;exports.Rectangle=Zt;exports.RedoCommand=$u;exports.RedoCommandId=ku;exports.RefAlias=zd;exports.Registry=Ri;exports.RegistryAsMap=Ii;exports.RelativeDate=ua;exports.RelativeSlideLink=ol;exports.ResourceManagerService=Uu;exports.RgbColor=jr;exports.RichTextBuilder=on;exports.RichTextValue=Vt;exports.RxDisposable=fc;exports.SHEET_EDITOR_UNITS=Od;exports.SectionType=Ua;exports.SheetTypes=ca;exports.SheetViewModel=Tu;exports.SliceBodyType=pi;exports.SlideDataModel=vi;exports.SpacingRule=Ha;exports.SpecialShapes=la;exports.Styles=pu;exports.THEME_COLORS=ma;exports.TabStopAlignment=Wa;exports.TableAlignmentType=Ga;exports.TableLayoutType=za;exports.TableRowHeightRule=Ka;exports.TableSizeType=Ya;exports.TableTextWrapType=Va;exports.TextDecoration=ha;exports.TextDecorationBuilder=zt;exports.TextDirection=qn;exports.TextDirectionType=ka;exports.TextStyleBuilder=qt;exports.TextStyleValue=dr;exports.TextX=Ye;exports.TextXActionType=he;exports.ThemeColor=Wr;exports.ThemeColorType=ft;exports.ThemeColors=Jr;exports.ThemeService=wi;exports.Tools=re;exports.UndoCommand=Bu;exports.UndoCommandId=Fu;exports.UnitModel=is;exports.Univer=zE;exports.UniverInstanceType=Be;exports.UpdateDocsAttributeType=xe;exports.UserManagerService=er;exports.VerticalAlign=rn;exports.VerticalAlignmentType=Xa;exports.Worksheet=tr;exports.WrapStrategy=ln;exports.WrapTextType=Ba;exports.addLinkToDocumentModel=Eu;exports.afterInitApply=Oc;exports.afterTime=Sc;exports.awaitTime=xE;exports.binSearchFirstGreaterThanTarget=Vo;exports.binarySearchArray=wc;exports.bufferDebounceTime=Ic;exports.cellToRange=Eh;exports.characterSpacingControlType=tl;exports.checkForSubstrings=Ch;exports.checkIfMove=Ac;exports.checkParagraphHasBullet=td;exports.checkParagraphHasIndent=nd;exports.checkParagraphHasIndentByStyle=va;exports.codeToBlob=bc;exports.composeBody=Ws;exports.composeInterceptors=lu;exports.composeStyles=Ts;exports.concatMatrixArray=gd;exports.convertBodyToHtml=jc;exports.convertCellToRange=Ra;exports.convertObservableToBehaviorSubject=vc;exports.covertTextRunToHtml=ys;exports.createAsyncInterceptorKey=Op;exports.createDefaultUser=Kr;exports.createDocumentModelWithStyle=Vn;exports.createInterceptorKey=Sp;exports.createInternalEditorID=Ed;exports.createRowColIter=Us;exports.dayjs=$t;exports.debounce=qm;exports.dedupe=rc;exports.dedupeBy=sc;exports.deepCompare=ei;exports.delayAnimationFrame=UE;exports.deleteContent=wa;exports.extractPureTextFromCell=yu;exports.fromCallback=Go;exports.fromEventSubject=xp;exports.fromObservable=dc;exports.generateRandomId=Ft;exports.get=Am;exports.getArrayLength=Xt;exports.getBodySlice=yt;exports.getBodySliceHtml=Tr;exports.getBorderStyleType=mh;exports.getCellCoordByIndexSimple=Ai;exports.getCellInfoInMergeData=uh;exports.getCellPositionByIndexSimple=jE;exports.getCellValueType=ih;exports.getCellWithCoordByIndexCore=Rn;exports.getColorStyle=Dt;exports.getCustomBlockSlice=Ql;exports.getCustomDecorationSlice=tu;exports.getCustomRangeSlice=eu;exports.getDocsUpdateBody=_h;exports.getIntersectRange=cl;exports.getOriginCellValue=fE;exports.getParagraphsSlice=Zl;exports.getPlainText=es;exports.getReverseDirection=Tc;exports.getSectionBreakSlice=x_;exports.getTableSlice=Jl;exports.getTextRunSlice=Vr;exports.getTransformOffsetX=Xu;exports.getTransformOffsetY=qu;exports.getWorksheetUID=pE;exports.groupBy=ac;exports.handleStyleToString=gh;exports.hashAlgorithm=sd;exports.horizontalLineSegmentsSubtraction=Qr;exports.insertMatrixArray=Ds;exports.insertTextToContent=Oa;exports.isBlackColor=nh;exports.isBooleanString=o_;exports.isCellCoverable=Ms;exports.isCellV=ah;exports.isEmptyCell=Ia;exports.isFormulaId=fh;exports.isFormulaString=dh;exports.isICellData=sh;exports.isInternalEditorID=Na;exports.isNodeEnv=Hc;exports.isNotNullOrUndefined=Cu;exports.isNullCell=oh;exports.isNumeric=uu;exports.isRangesEqual=Zp;exports.isRealNum=rd;exports.isSafeNumeric=Tp;exports.isSameStyleTextRun=Sa;exports.isUnitRangesEqual=Qp;exports.isValidRange=ph;exports.isWhiteColor=rh;exports.makeArray=lc;exports.makeCellRangeToRangeData=hh;exports.makeCellToSelection=ch;exports.makeCustomRangeStream=Qd;exports.merge=fi;exports.mergeOverrideWithDependencies=xu;exports.mergeSets=Np;exports.mergeWith=e_;exports.mergeWorksheetSnapshotWithDefault=Au;exports.mixinClass=Ap;exports.moveMatrixArray=xs;exports.moveRangeByOffset=Pd;exports.nameCharacterCheck=LE;exports.normalizeBody=U_;exports.normalizeTextRuns=cr;exports.numberToABC=Xd;exports.numberToListABC=qd;exports.numfmt=fd;exports.queryObjectMatrix=Gd;exports.registerDependencies=uc;exports.remove=nr;exports.repeatStringNumTimes=dl;exports.replaceInDocumentBody=Mp;exports.requestImmediateMacroTask=yp;exports.rotate=oc;exports.searchArray=Bn;exports.searchInOrderedArray=zo;exports.selectionToArray=lh;exports.sequence=$o;exports.sequenceAsync=Bo;exports.sequenceExecute=qr;exports.sequenceExecuteAsync=Rc;exports.set=n_;exports.shallowEqual=xl;exports.skipParseTagNames=PE;exports.sliceMatrixArray=md;exports.sortRules=Jd;exports.sortRulesByDesc=Zd;exports.sortRulesFactory=lr;exports.spliceArray=Ls;exports.splitIntoGrid=ii;exports.takeAfter=As;exports.textDiff=gi;exports.throttle=Ip;exports.toDisposable=nt;exports.touchDependencies=Fo;exports.updateAttributeByDelete=nu;exports.updateAttributeByInsert=ru;Object.keys(je).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>je[e]})});