@univerjs/core 0.8.0-beta.0 → 0.8.0-beta.1

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 uc=Object.defineProperty;var cc=(e,t,n)=>t in e?uc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var C=(e,t,n)=>cc(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Oe=require("rxjs"),Tr=require("rxjs/operators"),je=require("@wendellhu/redi"),hc=require("@univerjs/themes");function dc(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 _r=typeof global<"u"?global:typeof self<"u"?self:window;function fc(){const t=new Map;let n=0;typeof _r.requestIdleCallback!="function"&&(_r.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 _r.cancelIdleCallback!="function"&&(_r.cancelIdleCallback=function(s){const i=t.get(s);i!==void 0&&(clearTimeout(i),t.delete(s))})}function gc(){fc()}function rr(e,t){const n=e.indexOf(t);return n>-1?(e.splice(n,1),!0):!1}function mc(e){const t=new Set,n=[];for(const r of e)t.has(r)||(t.add(r),n.push(r));return n}function _c(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 pc(e,t){for(let n=e.length-1;n>-1;n--){const r=e[n];if(t(r,n))return r}return null}function Ec(e,t){if(e.length===0)return e;const n=t%e.length;return e.slice(n).concat(e.slice(0,n))}function Cc(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 Rc(e){return Array.isArray(e)?e:[e]}function Ic(e,t){t.forEach(n=>e.add(n))}function Yo(e,t){t.forEach(([n])=>{e.has(n)&&e.get(n)})}class Ms extends Error{constructor(t){super(t),this.name="CustomCommandExecutionError"}}class Sc extends Error{constructor(){super("Canceled by facade"),this.name="CanceledError"}}async function zo(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 Go(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 vc(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?vc(e)?{dispose:()=>e.unsubscribe()}:typeof e=="function"?{dispose:()=>{t||(t=!0,e())}}:e:nt(()=>{})}function Oc(e){return nt(()=>{e.unsubscribe()})}class Zr{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 Zr)}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 wc extends st{constructor(){super(...arguments);C(this,"dispose$",new Oe.Subject)}dispose(){super.dispose(),this.dispose$.next(),this.dispose$.complete()}}class bc 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 Dn=je.createIdentifier("univer.context-service");class Vo 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 Ko=(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))(Ko||{});const Ot=je.createIdentifier("univer.log");class Xo 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=Ac(...r);this._deduction.has(s)||(this._deduction.add(s),this._log(n,...r))}}function Ac(...e){return e.map(t=>JSON.stringify(t)).join("")}var Tc=Object.getOwnPropertyDescriptor,yc=(e,t,n,r)=>{for(var s=r>1?void 0:r?Tc(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Ui=(e,t)=>(n,r)=>t(n,r,e),sr=(e=>(e[e.COMMAND=0]="COMMAND",e[e.OPERATION=1]="OPERATION",e[e.MUTATION=2]="MUTATION",e))(sr||{});const ir=je.createIdentifier("univer.core.command-service");class Nc{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 qo={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 Nc,this.registerCommand(qo)}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 Ms)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=pc(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 Ms)return!1;throw o}}_pushCommandExecutionStack(n){return this._commandExecutionStack.push(n),nt(()=>rr(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 Mc(n.id);const o=new Zr;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=yc([Ui(0,je.Inject(je.Injector)),Ui(1,Ot)],exports.CommandService);class Mc{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(Ot),s=t.get(Dn),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 Go(r)}function Dc(e,t,n){const r=e.map(s=>()=>t.executeCommand(s.id,s.params,n));return zo(r)}function Jo(e){return new Oe.Observable(t=>{const n=e((...r)=>t.next(r));return()=>n==null?void 0:n.dispose()})}function Ds(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 Lc(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 xc(e){const t=new Oe.ReplaySubject(1);return setTimeout(()=>t.next(),e),t.pipe(Oe.take(1))}function Uc(e,t){const n=new Oe.BehaviorSubject(t);return e.subscribe(n),n}const Pc=e=>new Promise(t=>{Oe.merge(Jo(e.onCommandExecuted.bind(e)).pipe(Tr.filter(([n])=>n.type===sr.MUTATION)),Oe.timer(300)).pipe(Tr.debounceTime(16),Tr.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 kc(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 Qo(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 $n(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=Qo(e,t),n){const s=e[r];return e.indexOf(s)}return r}function Fc(e){const t=new Blob([e],{type:"text/javascript"});return window.URL.createObjectURL(t)}const Hn=2,ea=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)>Hn||Math.abs(l-r)>Hn||Math.abs(d-p)>Hn||Math.abs(f-R)>Hn||Math.abs(h-o)>ea}var ta=(e=>(e[e.DEFAULT_SERIES=0]="DEFAULT_SERIES",e[e.ALTERNATE_SERIES=1]="ALTERNATE_SERIES",e))(ta||{}),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||{}),na=(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))(na||{}),vt=(e=>(e[e.UNSUPPORTED=0]="UNSUPPORTED",e[e.RGB=1]="RGB",e[e.HEX=2]="HEX",e[e.THEME=3]="THEME",e))(vt||{}),ra=(e=>(e[e.ON=0]="ON",e[e.OFF=1]="OFF",e))(ra||{}),sa=(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))(sa||{}),ia=(e=>(e[e.LEFT=0]="LEFT",e[e.RIGHT=1]="RIGHT",e))(ia||{}),oa=(e=>(e[e.DOCUMENT=0]="DOCUMENT",e[e.PROJECT=1]="PROJECT",e))(oa||{}),aa=(e=>(e[e.COLUMNS=0]="COLUMNS",e[e.ROWS=1]="ROWS",e))(aa||{}),la=(e=>(e[e.UP=0]="UP",e[e.RIGHT=1]="RIGHT",e[e.DOWN=2]="DOWN",e[e.LEFT=3]="LEFT",e))(la||{});function $c(e){switch(e){case 3:return 1;case 1:return 3;case 0:return 2;case 2:return 0}}var ua=(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))(ua||{}),or=(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))(or||{}),$r=(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))($r||{}),ca=(e=>(e[e.RANGE=0]="RANGE",e[e.SHEET=1]="SHEET",e))(ca||{}),ha=(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))(ha||{}),da=(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))(da||{}),fa=(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))(fa||{}),ga=(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))(ga||{}),ma=(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))(ma||{}),_a=(e=>(e[e.GRID=0]="GRID",e[e.KANBAN=1]="KANBAN",e[e.GANTT=2]="GANTT",e))(_a||{}),Jn=(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))(Jn||{}),pa=(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))(pa||{}),yt=(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))(yt||{}),sn=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TOP=1]="TOP",e[e.MIDDLE=2]="MIDDLE",e[e.BOTTOM=3]="BOTTOM",e))(sn||{}),un=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.OVERFLOW=1]="OVERFLOW",e[e.CLIP=2]="CLIP",e[e.WRAP=3]="WRAP",e))(un||{}),Hr=(e=>(e[e.NORMAL=0]="NORMAL",e[e.ITALIC=1]="ITALIC",e))(Hr||{}),jr=(e=>(e[e.NORMAL=0]="NORMAL",e[e.BOLD=1]="BOLD",e))(jr||{}),Ft=(e=>(e[e.NORMAL=1]="NORMAL",e[e.SUBSCRIPT=2]="SUBSCRIPT",e[e.SUPERSCRIPT=3]="SUPERSCRIPT",e))(Ft||{}),Ie=(e=>(e[e.FALSE=0]="FALSE",e[e.TRUE=1]="TRUE",e))(Ie||{}),Xt=(e=>(e[e.STRING=1]="STRING",e[e.NUMBER=2]="NUMBER",e[e.BOOLEAN=3]="BOOLEAN",e[e.FORCE_STRING=4]="FORCE_STRING",e))(Xt||{}),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||{}),es=(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))(es||{});const Hc="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let jc=e=>crypto.getRandomValues(new Uint8Array(e)),Wc=(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}}},Yc=(e,t=21)=>Wc(e,t|0,jc),zc=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=Hc[n[e]&63];return t};const Ea=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"]),Gc=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 Vc(e){if(!Number.isNaN(+e))return!1;if(e.startsWith("http://localhost:3002")||e.startsWith("localhost:3002"))return!0;if(Gc.test(e)){if(Ca(e))return!0;try{const r=new URL(Ra(e)).hostname.split(".").pop();if(r&&Ea.has(r))return!0}catch{return!1}}return!1}function Ca(e){return/^[a-zA-Z]+:\/\//.test(e)}function Kc(e){return/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(e)}function Ra(e){return Ca(e)?e:Kc(e)?`mailto://${e}`:`https://${e}`}const Xc=/^-ms-/,qc=/-([a-z])/g,zt=["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 ii(e,t){const n=ne.getValueType(e),r=ne.getValueType(t);return n!==r?!1:ne.isArray(e)?Jc(e,t):ne.isObject(e)?Zc(e,t):ne.isDate(e)?e.getTime()===t.getTime():ne.isRegExp(e)?e.toString()===t.toString():e===t}function Jc(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(!ii(s,i))return!1}return!0}function Zc(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(!ii(i,o))return!1}return!0}class ne{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>=zt.length;)r/=zt.length,r-=1,n+=zt[r%zt.length];const s=t%zt.length;return n+=zt[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+=zt.length**i+zt.length*s}return n+=t.charCodeAt(t.length-1)-65,n}static deleteBlank(t){return ne.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 Bt(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(ne.isArray(l)){const d=(c=a[u])!=null?c:[];a[u]=d,r(l,d);return}if(ne.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(ne.isObject(u)){const d=(c=a[l])!=null?c:{};a[l]=d,s(u,d);return}if(ne.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(ne.isArray(l)){const h=(u=t[a])!=null?u:[];t[a]=h,r(l,h);return}if(ne.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 ii(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]=ne.deepClone(r)}),n}if(this.isObject(t)){const n={};return Object.keys(t).forEach(r=>{const s=t[r];n[r]=ne.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 Vc(t)}static normalizeUrl(t){return Ra(t)}static topLevelDomainCombiningString(){return[...Ea].join("|")}static itCount(t){return n=>{for(let r=0;r<t;r++)n&&n()}}static hasLength(t,n){return ne.isDefine(t)?ne.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(Xc,"ms-").replace(qc,this.fCamelCase)}static removeNull(t){return this.isObject(t)&&Object.keys(t).forEach(n=>{const r=t[n];r==null?delete t[n]:ne.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 Bt(e=21,t){return t?Yc(t,e)():zc(e)}function Ls(...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 Qc=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null;function yr(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;ne.hasIntersectionBetweenTwoRanges(t,n,l,u)&&(l>i?(o.push(r.slice(i,l)),o.push(xs(r,{...a,ed:Math.min(u,n)}))):o.push(xs(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 eh(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("; ")};"`:""}>${yr(e,o+1,l)}</p>`:i+=`<p class="UniverNormal" ${f.length?`style="${f.join("; ")};"`:""}></p>`,o=l}return o!==r.length&&(i+=yr(e,o,r.length)),i}else return yr(e,0,e.dataStream.length)}function xs(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===Ft.SUPERSCRIPT?R=`<sup>${R}</sup>`:p===Ft.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 Ia={[es.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 ts{constructor(){C(this,"_themeValue",ft.LIGHT1);C(this,"_themeColors");C(this,"_themeTint");C(this,"_rgbValue","");C(this,"_colorType");this._colorType=vt.UNSUPPORTED,this._themeColors=es.OFFICE,this._themeTint=0}asRgbColor(){return new Wr(this._rgbValue,this)}asThemeColor(){return new Yr(this._themeValue,this._themeTint,this._themeColors,this)}build(){switch(this._colorType){case vt.THEME:return this.asThemeColor();case vt.RGB:return this.asRgbColor();case vt.UNSUPPORTED:throw new Error("unsupported color type")}}setRgbColor(t){return this._colorType=vt.RGB,this._rgbValue=t,this}setThemeColors(t){this._colorType=vt.THEME,this._themeColors=t}setThemeTint(t){this._colorType=vt.THEME,this._themeTint=t}setThemeColor(t){return this._colorType=vt.THEME,this._themeValue=t,this}getColorType(){return this._colorType}}class cn{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 ts().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 cn(this._builder)}equals(t){return!1}}class Sa{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 ts;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 St=class St extends cn{constructor(n,r){super(r);C(this,"_cssString");C(this,"_red");C(this,"_green");C(this,"_blue");C(this,"_alpha");let s=n.match(St.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(St.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 cn.rgbColorToHexValue(this)}getRed(){let n=this._red+St.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getGreen(){let n=this._green+St.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getBlue(){let n=this._blue+St.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getAlpha(){return this._alpha}getColorType(){return vt.RGB}clone(){return new St(this._cssString,this._builder)}asThemeColor(){throw new Error("rgb color not support to themeColor")}equals(n){return n instanceof St?n._red===this._red&&n._blue===this._blue&&n._green===this._green&&n._alpha===this._alpha:!1}getCssString(){return this._cssString}};C(St,"RGB_COLOR_AMT",0),C(St,"RGBA_EXTRACT",new RegExp("\\s*rgba\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d.\\d|\\d\\s*)\\)\\s*")),C(St,"RGB_EXTRACT",new RegExp("\\s*rgb\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*)\\)\\s*"));let Wr=St;const Gt=class Gt extends cn{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=Ia[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 Sa(cn.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 vt.THEME}getThemeColorType(){return this._themeColorType}};C(Gt,"_cacheThemeColor",new Map);let Yr=Gt;const th="rgb(",nh="rgba(",Us={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 Tt{constructor(t){C(this,"_color");C(this,"_rgbColor");C(this,"_isValid",!1);if(t==null){this._setNullColor();return}if(t instanceof Tt){this._color={...t._color},this._rgbColor={...t._rgbColor};return}const n=va(t);if(n==null){this._setNullColor();return}this._color=n;const r=ah(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 Tt(t).toRgb(),i=new Tt(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 Tt(l)}static getContrastRatio(t,n){const r=new Tt(t).getLuminance(),s=new Tt(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=[pr(Math.round(n).toString(16)),pr(Math.round(r).toString(16)),pr(Math.round(s).toString(16)),pr(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 hh(this.toRgb())}toHsl(){return ch(this.toRgb())}lighten(t=10){const n=this.toHsl();return n.l+=t,n.l=Math.min(Math.max(n.l,0),100),new Tt(n)}darken(t=10){const n=this.toHsl();return n.l-=t,n.l=Math.min(Math.max(n.l,0),100),new Tt(n)}setAlpha(t){return new Tt({...this._rgbColor,a:t})}getLuminance(){let{r:t,g:n,b:r}=this.toRgb();return t=hs(t),n=hs(n),r=hs(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 pr=e=>e.length===1?`0${e}`:e,hs=e=>(e/=255,e<=.03928?e/12.92:((e+.055)/1.055)**2.4),va=e=>{if(fh(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(Us[t]){const n=Us[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 rh(t);if(t.startsWith("rgb"))return sh(t);if(t.startsWith("hsl"))return ih(t);if(t.startsWith("hsv"))return oh(t)},rh=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},sh=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},ih=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},oh=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},ah=e=>{const t=va(e);if(t!=null)return"r"in t?t:"l"in t?lh(t):uh(t)},ds=(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),lh=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=ds(u,l,t+1/3),i=ds(u,l,t),o=ds(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},uh=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},ch=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},hh=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},dh=e=>e==null,fh=e=>!dh(e)&&typeof e=="object";function gh(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 mh(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 Oa(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 _h(e){if(e.t!==void 0)return e.t;if(typeof e.v=="string")return Xt.STRING;if(typeof e.v=="number")return Xt.NUMBER;if(typeof e.v=="boolean")return Xt.BOOLEAN}function ph(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 wa(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 Eh(e){return[e.startRow,e.startColumn,e.endRow,e.endColumn]}var ba=(e=>(e.NONE="none",e.BACKWARD="backward",e.FORWARD="forward",e))(ba||{}),Aa=(e=>(e.RECT="RECT",e.TEXT="TEXT",e))(Aa||{});function Ch(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 Sn=(e=>(e.Raw="raw",e.Intercepted="intercepted",e.Both="both",e))(Sn||{});function qt(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 Ps(e,t,n){const r=qt(n),s=n;for(let i=r-1;i>=e;i--)s[i+1]=s[i];s[e]=t}function ks(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 Rh(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 Ih(e,t,n){const r=n;if(qt(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 Fs(e,t,n,r){const s=e>n;if(!s&&e+t>n)throw new Error("Invalid move operation");s?Sh(e,t,n,r):vh(e,t,n,r)}function Sh(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 vh(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 Et{constructor(t={}){C(this,"_matrix");this._setOriginValue(t)}static MakeObjectMatrixSize(t){return new Et({[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){Fs(t,n,r,this._matrix)}moveColumns(t,n,r){this.forEach((s,i)=>{Fs(t,n,r,i)})}insertRows(t,n){for(let r=t;r<t+n;r++)Ps(r,{},this._matrix)}insertColumns(t,n){for(let r=t;r<t+n;r++)this.forEach((s,i)=>{i&&Ps(r,void 0,i)})}removeRows(t,n){ks(t,n,this._matrix)}removeColumns(t,n){this.forEach((r,s)=>{s&&ks(t,n,s)})}getFragment(t,n,r,s){const i=new Et;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 Et;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,ne.deepClone(l))}return i}getSizeOf(){return Object.keys(this._matrix).length}getLength(){return qt(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=qt(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 Et;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=qt(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}}function Ta(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 Oh=Ta;function wh(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 ya(e){var n;return!e||(((n=e==null?void 0:e.v)==null?void 0:n.toString())||"").length===0&&!e.p}function Bs(e){return ya(e)&&(e==null?void 0:e.coverable)!==!1}function Lt(e){if(e){if(e.rgb)return e.rgb;if(e.th)return new ts().setThemeColor(e.th).asThemeColor().asRgbColor().getCssString()}return null}function Na(e){return ne.isString(e)&&e.substring(0,1)==="="&&e.length>1}function bh(e){return ne.isString(e)&&e.length>0}function Ah(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: ${Lt(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: ${Lt(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: ${Lt(e.ol.cl)}; `),e.ol.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${e.ol.t} `))}],["bg",()=>{e.bg&&(n+=`background: ${Lt(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: ${Er((a=e.bd)==null?void 0:a.b.s)} ${(l=Lt(e.bd.b.cl))!=null?l:""}; `),(u=e.bd)!=null&&u.t&&(n+=`border-top: ${Er((c=e.bd)==null?void 0:c.t.s)} ${(h=Lt(e.bd.t.cl))!=null?h:""}; `),(d=e.bd)!=null&&d.r&&(n+=`border-right: ${Er((f=e.bd)==null?void 0:f.r.s)} ${(p=Lt(e.bd.r.cl))!=null?p:""}; `),(R=e.bd)!=null&&R.l&&(n+=`border-left: ${Er((w=e.bd)==null?void 0:w.l.s)} ${(N=Lt(e.bd.l.cl))!=null?N:""}; `)}],["cl",()=>{e.cl&&(n+=`color: ${Lt(e.cl)}; `)}],["va",()=>{e.va===Ft.SUBSCRIPT?n+="vertical-align: sub; ":e.va===Ft.SUPERSCRIPT&&(n+="vertical-align: super; ")}],["td",()=>{e.td===Jn.LEFT_TO_RIGHT?n+="direction: ltr; ":e.td===Jn.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===yt.LEFT?n+="text-align: left; ":e.ht===yt.RIGHT?n+="text-align: right; ":e.ht===yt.CENTER?n+="text-align: center; ":e.ht===yt.JUSTIFIED&&(n+="text-align: justify; ")}],["vt",()=>{e.vt===sn.BOTTOM?n+="vertical-align: bottom; ":e.vt===sn.TOP?n+="vertical-align: top; ":e.vt===sn.MIDDLE&&(n+="vertical-align: middle; ")}],["tb",()=>{e.tb===un.CLIP?n+="white-space: nowrap; overflow-x: hidden; ":e.tb===un.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 Er(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 Th(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 yh(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 Nh(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 Mh(e,t){return{startRow:e,endRow:e,startColumn:t,endColumn:t}}function $s(e){return Na(e)?{f:e,v:null,p:null}:wa(e)?{v:e,p:null,f:null}:(Oa(e),e)}function Dh(e,t){const n=new Et,{startRow:r,startColumn:s,endRow:i,endColumn:o}=t;if(ne.isArray(e))for(let a=0;a<=i-r;a++)for(let l=0;l<=o-s;l++)n.setValue(a+r,l+s,$s(e[a][l]));else new Et(e).forValue((l,u,c)=>{n.setValue(l,u,$s(c))});return n.getMatrix()}function oi(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=>oi(e[n],t[n])):e===t:!1}function Ma(e,t){const n=e.ts||{},r=t.ts||{};return e.sId!==t.sId?!1:oi(n,r)}function Lh(e,t){return t.some(n=>e.indexOf(n)>-1)}function Ct(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Nr={exports:{}},xh=Nr.exports,Pi;function Uh(){return Pi||(Pi=1,function(e,t){(function(n,r){e.exports=r()})(xh,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),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]=G;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(z,Y){var ue=_.w(B.$u?Date.UTC(B.$y,Y,z):new Date(B.$y,Y,z),B);return V?ue:ue.endOf(u)},ge=function(z,Y){return _.w(B.toDate()[z].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")},z=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 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,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})}(Nr)),Nr.exports}var Ph=Uh();const Ht=Ct(Ph);var Mr={exports:{}},kh=Mr.exports,ki;function Fh(){return ki||(ki=1,function(e,t){(function(n,r){e.exports=r()})(kh,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)}}})}(Mr)),Mr.exports}var Bh=Fh();const $h=Ct(Bh);var Dr={exports:{}},Hh=Dr.exports,Fi;function jh(){return Fi||(Fi=1,function(e,t){(function(n,r){e.exports=r()})(Hh,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=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,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,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,z=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 z?new Date(Date.UTC($,te,ae,me,be,De,X+60*z.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,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)}}})}(Dr)),Dr.exports}var Wh=jh();const Yh=Ct(Wh);var Lr={exports:{}},zh=Lr.exports,Bi;function Gh(){return Bi||(Bi=1,function(e,t){(function(n,r){e.exports=r()})(zh,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)}}})}(Lr)),Lr.exports}var Vh=Gh();const Kh=Ct(Vh);var xr={exports:{}},Xh=xr.exports,$i;function qh(){return $i||($i=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)}}})}(xr)),xr.exports}var Jh=qh();const Zh=Ct(Jh);var Ur={exports:{}},Qh=Ur.exports,Hi;function ed(){return Hi||(Hi=1,function(e,t){(function(n,r){e.exports=r()})(Qh,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)}}})}(Ur)),Ur.exports}var td=ed();const nd=Ct(td);var Pr={exports:{}},rd=Pr.exports,ji;function sd(){return ji||(ji=1,function(e,t){(function(n,r){e.exports=r()})(rd,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")}}})}(Pr)),Pr.exports}var id=sd();const od=Ct(id);var kr={exports:{}},ad=kr.exports,Wi;function ld(){return Wi||(Wi=1,function(e,t){(function(n,r){e.exports=r()})(ad,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)}}})}(kr)),kr.exports}var ud=ld();const cd=Ct(ud);var Fr={exports:{}},hd=Fr.exports,Yi;function dd(){return Yi||(Yi=1,function(e,t){(function(n,r){e.exports=r()})(hd,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}}})}(Fr)),Fr.exports}var fd=dd();const gd=Ct(fd);Ht.extend(Yh);Ht.extend($h);Ht.extend(od);Ht.extend(Kh);Ht.extend(cd);Ht.extend(gd);Ht.extend(nd);Ht.extend(Zh);function ns(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 md(e){if(e==null)return!1;const t=e.bullet;return(t==null?void 0:t.listId)!=null}function _d(e){if(e==null)return!1;const t=e.paragraphStyle;return Da(t)}function Da(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 La(e,t,n){return e.slice(0,t)+n+e.slice(t)}function xa(e,t,n){return t>n?e:e.slice(0,t)+e.slice(n)}function pd(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 Ed(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 Cd{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 Rd{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 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,t.value]}):{done:!0,value:void 0}}}var jo,Wo;Wo=Ke,jo=it;class zi{constructor(t,n){C(this,"key");C(this,"value");C(this,Wo);C(this,jo);this.key=t,this.value=n,this[Ke]=void 0,this[it]=void 0}toJSON(){return{key:this.key,value:this.value}}}class Zn{constructor(...t){C(this,"_keymap");C(this,"size",0);C(this,"limit");C(this,"oldest");C(this,"newest");C(this,"_onShiftListeners",[]);if(jn.hasLength(t,1)){if(jn.isNumber(t[0])){const n=t[0];this._initialize(n,void 0);return}if(jn.isIterable(t[0])){const n=t[0];this._initialize(0,n);return}return}if(jn.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(()=>rr(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 zi(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 zi(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 Cd(this.oldest)}values(){return new Rd(this.oldest)}entries(){return this[Symbol.iterator]()}[Symbol.iterator](){return new Id(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 jn{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 Br={exports:{}},Sd=Br.exports,Gi;function vd(){return Gi||(Gi=1,function(e,t){(function(n,r){e.exports=r()})(typeof self<"u"?self:Sd,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(""),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]],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 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)),re=10**(16-Math.floor(Me));return Math.round(Se*re)/re}(E*g.scale)),g.exponential){let Se=Math.abs(E);if(Se){const Me=10**-te(Se,g.int_max),re=p(Se*Me,g.frac_max)/Me;Q=te(re,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 re=g.tokens[Se],lt=re.num?re.num.length:0;if(re.type==="string")re.rule?re.rule==="num"?We?Ee.push(re.value):(g.num_min>0||g.den_min>0)&&Ee.push(re.value.replace(/./g,W["?"])):re.rule==="num+int"?We&&I?Ee.push(re.value):g.den_min>0&&(I||g.num_min)&&Ee.push(re.value.replace(/./g,W["?"])):re.rule==="den"&&(We?Ee.push(re.value):(g.den_min>0||g.den_min>0)&&Ee.push(re.value.replace(/./g,W["?"]))):Ee.push(re.value);else if(re.type==="error")Ee.push(m.invalid);else if(re.type==="point")Ee.push(g.date?re.value:ke.decimal);else if(re.type==="general")ue(Ee,0,E,ke);else if(re.type==="exp")Ee.push(ke.exponent);else if(re.type==="minus")re.volatile&&g.date||re.volatile&&(E>=0||typeof E!="number")||(re.volatile&&!g.fractions&&(g.integer||g.dec_fractions)?(E<0&&I&&I!=="0"||P)&&Ee.push(ke.negative):Ee.push(ke.negative));else if(re.type==="plus")Ee.push(ke.positive);else if(re.type==="text")Ee.push(E);else if(re.type==="div")We?Ee.push("/"):g.num_min>0||g.den_min>0?Ee.push(W["?"]):Ee.push(W["#"]);else if(re.type==="int")if(g.int_pattern.length===1)Ee.push(I);else{const $e=Qe?g.int_pattern.join("").length-ve.int:1/0,Dt=Qe===g.int_pattern.length-1?0:g.int_pattern.join("").length-(ve.int+re.num.length);Ee.push(I.substring(I.length-$e,I.length-Dt)),Qe++,ve.int+=re.num.length}else if(re.type==="frac"){const $e=ve.frac;for(let Dt=0;Dt<lt;Dt++)Ee.push(P[Dt+$e]||W[re.num[Dt]]);ve.frac+=lt}else if(re.type in $)g[re.type+"_pattern"].length===1?(re.type==="int"&&Ee.push(I),re.type==="frac"&&Ee.push(P),re.type==="man"&&Ee.push(M),re.type==="num"&&Ee.push(U),re.type==="den"&&Ee.push(x)):(Ee.push($[re.type].slice(ve[re.type],ve[re.type]+lt)),ve[re.type]+=lt);else if(re.type==="year")_e<0&&Ee.push(ke.negative),Ee.push(String(Math.abs(_e)).padStart(4,"0"));else if(re.type==="year-short"){const $e=_e%100;Ee.push($e<10?"0":"",$e)}else if(re.type==="month")Ee.push(re.pad&&we<10?"0":"",we);else if(re.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(re.type==="monthname-short")g.date_system===6?Ee.push(ke.mmm6[we-1]):Ee.push(ke.mmm[we-1]);else if(re.type==="monthname")g.date_system===6?Ee.push(ke.mmmm6[we-1]):Ee.push(ke.mmmm[we-1]);else if(re.type==="weekday-short")Ee.push(ke.ddd[L]);else if(re.type==="weekday")Ee.push(ke.dddd[L]);else if(re.type==="day")Ee.push(re.pad&&ce<10?"0":"",ce);else if(re.type==="hour"){const $e=ee%g.clock||(g.clock<24?g.clock:0);Ee.push(re.pad&&$e<10?"0":"",$e)}else if(re.type==="min")Ee.push(re.pad&&Ce<10?"0":"",Ce);else if(re.type==="sec")Ee.push(re.pad&&Te<10?"0":"",Te);else if(re.type==="subsec"){Ee.push(ke.decimal);const $e=Pe.toFixed(g.sec_decimals);Ee.push($e.slice(2,2+re.decimals))}else if(re.type==="am"){const $e=ee<12?0:1;re.short&&!T?Ee.push("AP"[$e]):Ee.push(ke.ampm[$e])}else if(re.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(re.pad,"0"))}else if(re.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(re.pad,"0"))}else if(re.type==="sec-elap"){E<0&&Ee.push(ke.negative);const $e=pe*ae+Math.abs(J);Ee.push(String(Math.abs($e)).padStart(re.pad,"0"))}else if(re.type==="b-year")Ee.push(_e+543);else if(re.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 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 Rt(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 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 Pt(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,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({},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)),Pt(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=Rt,Fe.parseDate=et,Fe.parseTime=Ve,Fe.parseBool=ct,Fe.parseValue=function(E,g){var m,T,M;return(m=(T=(M=Rt(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}()})}(Br)),Br.exports}var fs,Vi;function Od(){return Vi||(Vi=1,fs=vd()),fs}var wd=Od();const bd=Ct(wd),Ad=bd,ar="__INTERNAL_EDITOR__",ai=`${ar}DOCS_NORMAL`,li=`${ar}DOCS_FORMULA_BAR`,Ua=`${ar}ZEN_EDITOR`,Pa=`\r
2
- `,ka="isRowStylePrecedeColumnStyle",Fa=Symbol("AUTO_HEIGHT_FOR_MERGED_CELLS");function Td(e){return`${ar}${e}`}function Ba(e){return e.startsWith(ar)}var $a=(e=>(e[e.character=0]="character",e[e.paragraph=1]="paragraph",e[e.table=2]="table",e[e.numbering=3]="numbering",e))($a||{}),Ha=(e=>(e[e.TAB=0]="TAB",e[e.SPACE=1]="SPACE",e[e.NOTHING=2]="NOTHING",e))(Ha||{}),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||{}),lr=(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))(lr||{}),Zt=(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))(Zt||{}),on=(e=>(e[e.COMMENT=0]="COMMENT",e[e.DELETED=9999]="DELETED",e))(on||{}),ja=(e=>(e[e.DRAWING=0]="DRAWING",e[e.CUSTOM=1]="CUSTOM",e))(ja||{}),ui=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TRADITIONAL=1]="TRADITIONAL",e[e.MODERN=2]="MODERN",e))(ui||{}),Wa=(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))(Wa||{}),Ya=(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))(Ya||{}),za=(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))(za||{}),Ga=(e=>(e[e.NORMAL=0]="NORMAL",e[e.TBRL=1]="TBRL",e[e.LRTBV=2]="LRTBV",e))(Ga||{}),Va=(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))(Va||{}),Ka=(e=>(e[e.BOTH_SIDES=0]="BOTH_SIDES",e[e.LEFT=1]="LEFT",e[e.RIGHT=2]="RIGHT",e[e.LARGEST=3]="LARGEST",e))(Ka||{}),Xa=(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))(Xa||{}),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||{}),qa=(e=>(e[e.AUTO=0]="AUTO",e[e.AT_LEAST=1]="AT_LEAST",e[e.EXACT=2]="EXACT",e))(qa||{}),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||{}),Za=(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))(Za||{}),Qa=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SPECIFIED=1]="SPECIFIED",e))(Qa||{}),el=(e=>(e[e.START=0]="START",e[e.CENTER=1]="CENTER",e[e.END=2]="END",e))(el||{}),tl=(e=>(e[e.AUTO_FIT=0]="AUTO_FIT",e[e.FIXED=1]="FIXED",e))(tl||{}),nl=(e=>(e[e.NONE=0]="NONE",e[e.WRAP=1]="WRAP",e))(nl||{}),rl=(e=>(e[e.AUTO=0]="AUTO",e[e.AT_LEAST=1]="AT_LEAST",e[e.EXACT=2]="EXACT",e))(rl||{}),sl=(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))(sl||{}),vn=(e=>(e.NORMAL="normal",e.BOLD="bold",e.ITALIC="italic",e))(vn||{}),il=(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))(il||{}),ol=(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))(ol||{}),al=(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))(al||{}),ll=(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))(ll||{}),ul=(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))(ul||{}),cl=(e=>(e[e.compressPunctuation=0]="compressPunctuation",e[e.compressPunctuationAndJapaneseKana=1]="compressPunctuationAndJapaneseKana",e[e.doNotCompress=2]="doNotCompress",e))(cl||{}),hl=(e=>(e[e.PORTRAIT=0]="PORTRAIT",e[e.LANDSCAPE=1]="LANDSCAPE",e))(hl||{}),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 yd=["A3","A4","A5","B4","B5","Letter","Tabloid","Legal","Statement","Executive","Folio"];var dl=(e=>(e[e.forward=0]="forward",e[e.backward=1]="backward",e[e.front=2]="front",e[e.back=3]="back",e))(dl||{}),fl=(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))(fl||{}),ci=(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))(ci||{}),gl=(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))(gl||{}),ml=(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))(ml||{});const Nd={sheetId:"",range:{startRow:-1,endRow:-1,startColumn:-1,endColumn:-1}},Md={startRow:-1,startColumn:-1,endRow:-1,endColumn:-1},Dd={startRow:0,startColumn:0,endRow:0,endColumn:0},Ld={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:Jn.UNSPECIFIED,cl:{rgb:"#000"},bg:{rgb:"#fff"},ht:yt.UNSPECIFIED,vt:sn.UNSPECIFIED,tb:un.UNSPECIFIED,pd:{t:0,r:0,b:0,l:0},n:null,bd:{b:null,l:null,r:null,t:null}},_l={id:"default_slide",title:"defaultSlide",pageSize:{width:300,height:300}},xd=[ai,Ua,li],Ud={[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},mn=4,Pd={[rt.HEADING_1]:{spaceAbove:{v:20},spaceBelow:{v:6+mn}},[rt.HEADING_2]:{spaceAbove:{v:18},spaceBelow:{v:6+mn}},[rt.HEADING_3]:{spaceAbove:{v:16},spaceBelow:{v:6+mn}},[rt.HEADING_4]:{spaceAbove:{v:14},spaceBelow:{v:4+mn}},[rt.HEADING_5]:{spaceAbove:{v:12},spaceBelow:{v:4+mn}},[rt.NORMAL_TEXT]:{spaceAbove:{v:0},spaceBelow:{v:0}},[rt.TITLE]:{spaceAbove:{v:0},spaceBelow:{v:3+mn}},[rt.SUBTITLE]:{spaceAbove:{v:0},spaceBelow:{v:16}},[rt.NAMED_STYLE_TYPE_UNSPECIFIED]:null},kd="univer-sheets-chart-print-chart",Fd="univer-docs-drawing-printing";var pl=(e=>(e.ARRAY_CONVERTOR="ARRAY_CONVERTOR",e.MATRIX_CONVERTOR="MATRIX_CONVERTOR",e))(pl||{});const Bd={[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 Cr(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 qn=class qn{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 Et;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 Et;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=ne.numToWord(r+1)+(t+1),o=ne.numToWord(s+1)+(n+1)):(i=ne.numToWord(s+1)+(n+1),o=ne.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 qn(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?Cr("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?Cr("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?Cr("it",t.body)===Ie.TRUE?Hr.ITALIC:Hr.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?Cr("bl",t.body)===Ie.TRUE?jr.BOLD:jr.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()===un.WRAP?Ie.TRUE:Ie.FALSE}getWrapStrategies(){return this._getStyles("tb")}getWrapStrategy(){return this.getWrapStrategies()[0][0]}forEach(t){qn.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(qn,"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 Tn=qn;function El(e,t,n=0,r=e.length-1,s=$d){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));El(e,t,f,p,s)}const i=e[t];let o=n,a=r;for(Un(e,n,t),s(e[r],i)>0&&Un(e,n,r);o<a;){for(Un(e,o,a),o++,a--;s(e[o],i)<0;)o++;for(;s(e[a],i)>0;)a--}s(e[n],i)===0?Un(e,n,a):(a++,Un(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}}function Un(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function $d(e,t){return e<t?-1:e>t?1:0}class zr{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(!Ir(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;Ir(t,l)&&(n.leaf?r.push(a):ms(t,l)?this._all(a,r):i.push(a))}n=i.pop()}return r}collides(t){let n=this.data;if(!Ir(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(Ir(t,o)){if(n.leaf||ms(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=Cn([]),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=Hd(t,r.children,n);if(c!==-1)return r.children.splice(c,1),i.push(r),this._condense(i),this}!u&&!r.leaf&&ms(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=Cn(t.slice(n,r+1)),_n(a,this.toBBox),a;s||(s=Math.ceil(Math.log(i)/Math.log(o)),o=Math.ceil(i/Math.pow(o,s-1))),a=Cn([]),a.leaf=!1,a.height=s;const l=Math.ceil(i/o),u=l*Math.ceil(Math.sqrt(o));Ki(t,n,r,u,this.compareMinX);for(let c=n;c<=r;c+=u){const h=Math.min(c+u-1,r);Ki(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 _n(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=gs(u),h=Yd(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),Yn(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=Cn(r.children.splice(o,r.children.length-o));a.height=r.height,a.leaf=r.leaf,_n(r,this.toBBox),_n(a,this.toBBox),n?t[n-1].children.push(a):this._splitRoot(r,a)}_splitRoot(t,n){this.data=Cn([t,n]),this.data.height=t.height+1,this.data.leaf=!1,_n(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=Wn(t,0,a,this.toBBox),u=Wn(t,a,r,this.toBBox),c=zd(l,u),h=gs(l)+gs(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:jd,i=t.leaf?this.compareMinY:Wd,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=Wn(t,0,n,i),a=Wn(t,r-n,r,i);let l=Rr(o)+Rr(a);for(let u=n;u<r-n;u++){const c=t.children[u];Yn(o,t.leaf?i(c):c),l+=Rr(o)}for(let u=r-n-1;u>=n;u--){const c=t.children[u];Yn(a,t.leaf?i(c):c),l+=Rr(a)}return l}_adjustParentBBoxes(t,n,r){for(let s=r;s>=0;s--)Yn(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():_n(t[n],this.toBBox)}}function Hd(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 _n(e,t){Wn(e,0,e.children.length,t,e)}function Wn(e,t,n,r,s){s||(s=Cn(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];Yn(s,e.leaf?r(o):o)}return s}function Yn(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 jd(e,t){return e.minX-t.minX}function Wd(e,t){return e.minY-t.minY}function gs(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function Rr(e){return e.maxX-e.minX+(e.maxY-e.minY)}function Yd(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 zd(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 ms(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function Ir(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function Cn(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Ki(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;El(e,o,t,n,s),i.push(t,o,o,n)}}function Gd(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=Xi(s.startRow,n,s.startColumn,t,a),u=Xi(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 Xi(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 hi(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 Vd(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 Kd(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 Xd(e){const t=hi(e),n=Vd(t);return Kd(n)}function qd(e,t){const n=[];return e.forEach(r=>{n.push(...Qt.subtract(r,t))}),Qt.mergeRanges(n)}function Cl(e,t){const n=qi(e.startRow,e.endRow,t.startRow,t.endRow),r=qi(e.startColumn,e.endColumn,t.startColumn,t.endColumn);if(!n||!r)return null;const[s,i]=n,[o,a]=r,l=Jd(e.rangeType,t.rangeType,s,i,o,a);return{startRow:s,endRow:i,startColumn:o,endColumn:a,rangeType:l}}function qi(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 Jd(e,t,n,r,s,i){const o=e!==void 0?e:Ji(n,r,s,i),a=t!==void 0?t:Ji(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 Ji(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 kt=class kt{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 zr;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 kt.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=kt.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 Xd(t)}static splitIntoGrid(t){return hi(t)}static subtractMulti(t,n){if(!n.length)return t;let r=t;return n.forEach(s=>{r=qd(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(kt,"getRelativeRange",(t,n)=>({startRow:t.startRow-n.startRow,endRow:t.endRow-t.startRow,startColumn:t.startColumn-n.startColumn,endColumn:t.endColumn-t.startColumn})),C(kt,"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(kt,"moveHorizontal",(t,n=0,r=0)=>({...t,startColumn:t.startColumn+n,endColumn:t.endColumn+n+r})),C(kt,"moveVertical",(t,n=0,r=0)=>({...t,startRow:t.startRow+n,endRow:t.endRow+n+r})),C(kt,"moveOffset",(t,n,r)=>({...t,startRow:t.startRow+r,endRow:t.endRow+r,startColumn:t.startColumn+n,endColumn:t.endColumn+n}));let Qt=kt;function Zd(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=Qd(n);o.area>r&&(r=o.area,s={startColumn:o.start,startRow:i-o.height+1,endColumn:o.end,endRow:i})}return s}function Qd(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 ef(e,t){Tn.foreach(t,(n,r)=>{e[n][r]=void 0})}function tf(e,t){const n=e.toFullArray(),r=[];for(;;){const s=Zd(n,t);if(!s)break;r.push(s),ef(n,s)}return r}class nf{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 Hs(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 rf(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,Rl=90,sf=97;function of(e){const t=Rl-Gr+1;let n="";for(;e>=0;)n=String.fromCharCode(e%t+Gr)+n,e=Math.floor(e/t)-1;return n}function Il(e,t){let n="";for(;t>0;)n+=e,t--;return n}function af(e,t=!1){const n=Rl-Gr+1;let r=sf;t&&(r=Gr);const s=String.fromCharCode(e%n+r),i=Math.floor(e/n)+1;return Il(s,i)}function lf(e,t){return e.zIndex>t.zIndex?1:e.zIndex===t.zIndex?0:-1}function uf(e,t){return e.zIndex>t.zIndex?-1:e.zIndex===t.zIndex?0:1}function ur(e="index",t=1){return(n,r)=>n[e]>r[e]?t:n[e]===r[e]?0:-t}var Sl=(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))(Sl||{}),_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 cf(e){return`${e}`}const hf=[_t.TABLE_START,_t.TABLE_ROW_START,_t.TABLE_CELL_START,_t.TABLE_CELL_END,_t.TABLE_ROW_END,_t.TABLE_END],rs=e=>{const t=e.endsWith(`\r
5
- `)?e.slice(0,-2):e;return hf.reduce((n,r)=>n.replaceAll(r,""),t)},df=e=>e?rs(e).replaceAll("\r","")==="":!0,ff=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(ne.isLegalUrl(c)){const h=Bt(),d=`${c}`,f={startIndex:s,endIndex:s+d.length-1,rangeId:h,rangeType:Zt.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 vl=typeof global=="object"&&global&&global.Object===Object&&global,gf=typeof self=="object"&&self&&self.Object===Object&&self,dn=vl||gf||Function("return this")(),yn=dn.Symbol,Ol=Object.prototype,mf=Ol.hasOwnProperty,_f=Ol.toString,Pn=yn?yn.toStringTag:void 0;function pf(e){var t=mf.call(e,Pn),n=e[Pn];try{e[Pn]=void 0;var r=!0}catch{}var s=_f.call(e);return r&&(t?e[Pn]=n:delete e[Pn]),s}var Ef=Object.prototype,Cf=Ef.toString;function Rf(e){return Cf.call(e)}var If="[object Null]",Sf="[object Undefined]",Zi=yn?yn.toStringTag:void 0;function cr(e){return e==null?e===void 0?Sf:If:Zi&&Zi in Object(e)?pf(e):Rf(e)}function Ln(e){return e!=null&&typeof e=="object"}var vf="[object Symbol]";function ss(e){return typeof e=="symbol"||Ln(e)&&cr(e)==vf}function Of(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 Nn=Array.isArray,Qi=yn?yn.prototype:void 0,eo=Qi?Qi.toString:void 0;function wl(e){if(typeof e=="string")return e;if(Nn(e))return Of(e,wl)+"";if(ss(e))return eo?eo.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var wf=/\s/;function bf(e){for(var t=e.length;t--&&wf.test(e.charAt(t)););return t}var Af=/^\s+/;function Tf(e){return e&&e.slice(0,bf(e)+1).replace(Af,"")}function wt(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var to=NaN,yf=/^[-+]0x[0-9a-f]+$/i,Nf=/^0b[01]+$/i,Mf=/^0o[0-7]+$/i,Df=parseInt;function no(e){if(typeof e=="number")return e;if(ss(e))return to;if(wt(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=wt(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Tf(e);var n=Nf.test(e);return n||Mf.test(e)?Df(e.slice(2),n?2:8):yf.test(e)?to:+e}function bl(e){return e}var Lf="[object AsyncFunction]",xf="[object Function]",Uf="[object GeneratorFunction]",Pf="[object Proxy]";function di(e){if(!wt(e))return!1;var t=cr(e);return t==xf||t==Uf||t==Lf||t==Pf}var _s=dn["__core-js_shared__"],ro=function(){var e=/[^.]+$/.exec(_s&&_s.keys&&_s.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function kf(e){return!!ro&&ro in e}var Ff=Function.prototype,Bf=Ff.toString;function $f(e){if(e!=null){try{return Bf.call(e)}catch{}try{return e+""}catch{}}return""}var Hf=/[\\^$.*+?()[\]{}|]/g,jf=/^\[object .+?Constructor\]$/,Wf=Function.prototype,Yf=Object.prototype,zf=Wf.toString,Gf=Yf.hasOwnProperty,Vf=RegExp("^"+zf.call(Gf).replace(Hf,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Kf(e){if(!wt(e)||kf(e))return!1;var t=di(e)?Vf:jf;return t.test($f(e))}function Xf(e,t){return e==null?void 0:e[t]}function fi(e,t){var n=Xf(e,t);return Kf(n)?n:void 0}var so=Object.create,qf=function(){function e(){}return function(t){if(!wt(t))return{};if(so)return so(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function Jf(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 Zf(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}var Qf=800,eg=16,tg=Date.now;function ng(e){var t=0,n=0;return function(){var r=tg(),s=eg-(r-n);if(n=r,s>0){if(++t>=Qf)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function rg(e){return function(){return e}}var Vr=function(){try{var e=fi(Object,"defineProperty");return e({},"",{}),e}catch{}}(),sg=Vr?function(e,t){return Vr(e,"toString",{configurable:!0,enumerable:!1,value:rg(t),writable:!0})}:bl,ig=ng(sg),og=9007199254740991,ag=/^(?:0|[1-9]\d*)$/;function gi(e,t){var n=typeof e;return t=t==null?og:t,!!t&&(n=="number"||n!="symbol"&&ag.test(e))&&e>-1&&e%1==0&&e<t}function mi(e,t,n){t=="__proto__"&&Vr?Vr(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function is(e,t){return e===t||e!==e&&t!==t}var lg=Object.prototype,ug=lg.hasOwnProperty;function Al(e,t,n){var r=e[t];(!(ug.call(e,t)&&is(r,n))||n===void 0&&!(t in e))&&mi(e,t,n)}function cg(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?mi(n,a,l):Al(n,a,l)}return n}var io=Math.max;function hg(e,t,n){return t=io(t===void 0?e.length-1:t,0),function(){for(var r=arguments,s=-1,i=io(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),Jf(e,this,a)}}function dg(e,t){return ig(hg(e,t,bl),e+"")}var fg=9007199254740991;function Tl(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=fg}function _i(e){return e!=null&&Tl(e.length)&&!di(e)}function gg(e,t,n){if(!wt(n))return!1;var r=typeof t;return(r=="number"?_i(n)&&gi(t,n.length):r=="string"&&t in n)?is(n[t],e):!1}function yl(e){return dg(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&&gg(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 mg=Object.prototype;function Nl(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||mg;return e===n}function _g(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var pg="[object Arguments]";function oo(e){return Ln(e)&&cr(e)==pg}var Ml=Object.prototype,Eg=Ml.hasOwnProperty,Cg=Ml.propertyIsEnumerable,js=oo(function(){return arguments}())?oo:function(e){return Ln(e)&&Eg.call(e,"callee")&&!Cg.call(e,"callee")};function Rg(){return!1}var Dl=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ao=Dl&&typeof module=="object"&&module&&!module.nodeType&&module,Ig=ao&&ao.exports===Dl,lo=Ig?dn.Buffer:void 0,Sg=lo?lo.isBuffer:void 0,Ll=Sg||Rg,vg="[object Arguments]",Og="[object Array]",wg="[object Boolean]",bg="[object Date]",Ag="[object Error]",Tg="[object Function]",yg="[object Map]",Ng="[object Number]",Mg="[object Object]",Dg="[object RegExp]",Lg="[object Set]",xg="[object String]",Ug="[object WeakMap]",Pg="[object ArrayBuffer]",kg="[object DataView]",Fg="[object Float32Array]",Bg="[object Float64Array]",$g="[object Int8Array]",Hg="[object Int16Array]",jg="[object Int32Array]",Wg="[object Uint8Array]",Yg="[object Uint8ClampedArray]",zg="[object Uint16Array]",Gg="[object Uint32Array]",Ze={};Ze[Fg]=Ze[Bg]=Ze[$g]=Ze[Hg]=Ze[jg]=Ze[Wg]=Ze[Yg]=Ze[zg]=Ze[Gg]=!0;Ze[vg]=Ze[Og]=Ze[Pg]=Ze[wg]=Ze[kg]=Ze[bg]=Ze[Ag]=Ze[Tg]=Ze[yg]=Ze[Ng]=Ze[Mg]=Ze[Dg]=Ze[Lg]=Ze[xg]=Ze[Ug]=!1;function Vg(e){return Ln(e)&&Tl(e.length)&&!!Ze[cr(e)]}function Kg(e){return function(t){return e(t)}}var xl=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Xn=xl&&typeof module=="object"&&module&&!module.nodeType&&module,Xg=Xn&&Xn.exports===xl,ps=Xg&&vl.process,uo=function(){try{var e=Xn&&Xn.require&&Xn.require("util").types;return e||ps&&ps.binding&&ps.binding("util")}catch{}}(),co=uo&&uo.isTypedArray,Ul=co?Kg(co):Vg;function qg(e,t){var n=Nn(e),r=!n&&js(e),s=!n&&!r&&Ll(e),i=!n&&!r&&!s&&Ul(e),o=n||r||s||i,a=o?_g(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")||gi(u,l))||a.push(u);return a}function Jg(e,t){return function(n){return e(t(n))}}function Zg(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var Qg=Object.prototype,em=Qg.hasOwnProperty;function tm(e){if(!wt(e))return Zg(e);var t=Nl(e),n=[];for(var r in e)r=="constructor"&&(t||!em.call(e,r))||n.push(r);return n}function Pl(e){return _i(e)?qg(e):tm(e)}var nm=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,rm=/^\w*$/;function sm(e,t){if(Nn(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||ss(e)?!0:rm.test(e)||!nm.test(e)||t!=null&&e in Object(t)}var Qn=fi(Object,"create");function im(){this.__data__=Qn?Qn(null):{},this.size=0}function om(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var am="__lodash_hash_undefined__",lm=Object.prototype,um=lm.hasOwnProperty;function cm(e){var t=this.__data__;if(Qn){var n=t[e];return n===am?void 0:n}return um.call(t,e)?t[e]:void 0}var hm=Object.prototype,dm=hm.hasOwnProperty;function fm(e){var t=this.__data__;return Qn?t[e]!==void 0:dm.call(t,e)}var gm="__lodash_hash_undefined__";function mm(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Qn&&t===void 0?gm:t,this}function hn(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])}}hn.prototype.clear=im;hn.prototype.delete=om;hn.prototype.get=cm;hn.prototype.has=fm;hn.prototype.set=mm;function _m(){this.__data__=[],this.size=0}function os(e,t){for(var n=e.length;n--;)if(is(e[n][0],t))return n;return-1}var pm=Array.prototype,Em=pm.splice;function Cm(e){var t=this.__data__,n=os(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():Em.call(t,n,1),--this.size,!0}function Rm(e){var t=this.__data__,n=os(t,e);return n<0?void 0:t[n][1]}function Im(e){return os(this.__data__,e)>-1}function Sm(e,t){var n=this.__data__,r=os(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function jt(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])}}jt.prototype.clear=_m;jt.prototype.delete=Cm;jt.prototype.get=Rm;jt.prototype.has=Im;jt.prototype.set=Sm;var kl=fi(dn,"Map");function vm(){this.size=0,this.__data__={hash:new hn,map:new(kl||jt),string:new hn}}function Om(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function as(e,t){var n=e.__data__;return Om(t)?n[typeof t=="string"?"string":"hash"]:n.map}function wm(e){var t=as(this,e).delete(e);return this.size-=t?1:0,t}function bm(e){return as(this,e).get(e)}function Am(e){return as(this,e).has(e)}function Tm(e,t){var n=as(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function en(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])}}en.prototype.clear=vm;en.prototype.delete=wm;en.prototype.get=bm;en.prototype.has=Am;en.prototype.set=Tm;var ym="Expected a function";function pi(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(ym);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(pi.Cache||en),n}pi.Cache=en;var Nm=500;function Mm(e){var t=pi(e,function(r){return n.size===Nm&&n.clear(),r}),n=t.cache;return t}var Dm=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Lm=/\\(\\)?/g,xm=Mm(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(Dm,function(n,r,s,i){t.push(s?i.replace(Lm,"$1"):r||n)}),t});function Um(e){return e==null?"":wl(e)}function Fl(e,t){return Nn(e)?e:sm(e,t)?[e]:xm(Um(e))}function Bl(e){if(typeof e=="string"||ss(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function Pm(e,t){t=Fl(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[Bl(t[n++])];return n&&n==r?e:void 0}function $l(e,t,n){var r=e==null?void 0:Pm(e,t);return r===void 0?n:r}var Hl=Jg(Object.getPrototypeOf,Object),km="[object Object]",Fm=Function.prototype,Bm=Object.prototype,jl=Fm.toString,$m=Bm.hasOwnProperty,Hm=jl.call(Object);function jm(e){if(!Ln(e)||cr(e)!=km)return!1;var t=Hl(e);if(t===null)return!0;var n=$m.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&jl.call(n)==Hm}function Wm(){this.__data__=new jt,this.size=0}function Ym(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function zm(e){return this.__data__.get(e)}function Gm(e){return this.__data__.has(e)}var Vm=200;function Km(e,t){var n=this.__data__;if(n instanceof jt){var r=n.__data__;if(!kl||r.length<Vm-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new en(r)}return n.set(e,t),this.size=n.size,this}function xn(e){var t=this.__data__=new jt(e);this.size=t.size}xn.prototype.clear=Wm;xn.prototype.delete=Ym;xn.prototype.get=zm;xn.prototype.has=Gm;xn.prototype.set=Km;var Wl=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ho=Wl&&typeof module=="object"&&module&&!module.nodeType&&module,Xm=ho&&ho.exports===Wl,fo=Xm?dn.Buffer:void 0;fo&&fo.allocUnsafe;function qm(e,t){return e.slice()}var go=dn.Uint8Array;function Jm(e){var t=new e.constructor(e.byteLength);return new go(t).set(new go(e)),t}function Zm(e,t){var n=Jm(e.buffer);return new e.constructor(n,e.byteOffset,e.length)}function Qm(e){return typeof e.constructor=="function"&&!Nl(e)?qf(Hl(e)):{}}function e_(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 t_=e_(),Es=function(){return dn.Date.now()},n_="Expected a function",r_=Math.max,s_=Math.min;function i_(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(n_);t=no(t)||0,wt(n)&&(c=!!n.leading,h="maxWait"in n,i=h?r_(no(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?s_(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=Es();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(Es())}function y(){var A=Es(),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 Ws(e,t,n){(n!==void 0&&!is(e[t],n)||n===void 0&&!(t in e))&&mi(e,t,n)}function o_(e){return Ln(e)&&_i(e)}function Ys(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}function a_(e){return cg(e,Pl(e))}function l_(e,t,n,r,s,i,o){var a=Ys(e,n),l=Ys(t,n),u=o.get(l);if(u){Ws(e,n,u);return}var c=i?i(a,l,n+"",e,t,o):void 0,h=c===void 0;if(h){var d=Nn(l),f=!d&&Ll(l),p=!d&&!f&&Ul(l);c=l,d||f||p?Nn(a)?c=a:o_(a)?c=Zf(a):f?(h=!1,c=qm(l)):p?(h=!1,c=Zm(l)):c=[]:jm(l)||js(l)?(c=a,js(a)?c=a_(a):(!wt(a)||di(a))&&(c=Qm(l))):h=!1}h&&(o.set(l,c),s(c,l,r,i,o),o.delete(l)),Ws(e,n,c)}function Ei(e,t,n,r,s){e!==t&&t_(t,function(i,o){if(s||(s=new xn),wt(i))l_(e,t,o,n,Ei,r,s);else{var a=r?r(Ys(e,o),i,o+"",e,t,s):void 0;a===void 0&&(a=i),Ws(e,o,a)}},Pl)}var u_=yl(function(e,t,n,r){Ei(e,t,n,r)}),Ci=yl(function(e,t,n){Ei(e,t,n)});function c_(e,t,n,r){if(!wt(e))return e;t=Fl(t,e);for(var s=-1,i=t.length,o=i-1,a=e;a!=null&&++s<i;){var l=Bl(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=wt(c)?c:gi(t[s+1])?[]:{})}Al(a,l,u),a=a[l]}return e}function h_(e,t,n){return e==null?e:c_(e,t,n)}var Cs,mo;function d_(){if(mo)return Cs;mo=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]),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 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 z=O+q,Y;q===-K||q!==K&&B[z-1]<B[z+1]?Y=B[z+1]:Y=B[z-1]+1;for(var ue=Y-q;Y<v&&ue<D&&_.charAt(Y)===H.charAt(ue);)Y++,ue++;if(B[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 $=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 z=O+de-te;if(z>=0&&z<k&&B[z]!==-1){var Y=B[z],ue=O+Y-z;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,z="",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));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),$=S.substring(q+te))}return z.length*2>=Ae.length?[Y,ue,ae,$,z]: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&&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),$=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||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=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 G(_,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&&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 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),z=ye.slice(S);return Z(F,q,z,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),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),$=H.slice(k-ue);if(F!==K||ae!==$)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,Cs=le,Cs}var f_=d_();const Ri=Ct(f_),g_=new Set(["true","false"]);function m_(e){return g_.has(e.toLowerCase())}var Rs,_o;function __(){if(_o)return Rs;_o=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)}},Rs=e,Rs}var Is,po;function p_(){return po||(po=1,Is=__()),Is}var E_=p_();const C_=Ct(E_);function Yl(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||{}),xt=(e=>(e[e.Reader=0]="Reader",e[e.Editor=1]="Editor",e[e.Owner=2]="Owner",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(xt||{}),zs=(e=>(e[e.SomeCollaborator=0]="SomeCollaborator",e[e.AllCollaborator=1]="AllCollaborator",e[e.OneSelf=2]="OneSelf",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(zs||{});class ls extends st{}function R_(e=ne.generateRandomId(6),t=or.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:ui.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 nn={},kn={},Sr={},Eo;function I_(){if(Eo)return Sr;Eo=1,Object.defineProperty(Sr,"__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 Sr.default=n,Sr}var vr={},Co;function S_(){if(Co)return vr;Co=1,Object.defineProperty(vr,"__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 vr.default=e,vr}var Ss={},Ro;function zl(){return Ro||(Ro=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}(Ss)),Ss}var vs={},Io;function Gl(){return Io||(Io=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={}))}(vs)),vs}var At={},rn={},So;function Ii(){return So||(So=1,Object.defineProperty(rn,"__esModule",{value:!0}),rn.uniToStrPos=rn.strPosToUni=void 0,rn.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},rn.uniToStrPos=(e,t)=>{let n=0;for(;t>0;t--){const r=e.charCodeAt(n);n+=r>=55296&&r<=57343?2:1}return n}),rn}var Os={},vo;function Gs(){return vo||(vo=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.uniSlice=e.dlen=e.eachOp=void 0;const t=Ii(),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}(Os)),Os}var Or={},Oo;function v_(){if(Oo)return Or;Oo=1,Object.defineProperty(Or,"__esModule",{value:!0});const e=Gs(),t=Ii();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 Or.default=n,n.provides={text:!0},Or}var wo;function O_(){return wo||(wo=1,function(e){var t=At&&At.__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=At&&At.__setModuleDefault||(Object.create?function(d,f){Object.defineProperty(d,"default",{enumerable:!0,value:f})}:function(d,f){d.default=f}),r=At&&At.__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=At&&At.__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=Ii(),o=r(Gs()),a=s(v_()),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=Gs();Object.defineProperty(e,"makeType",{enumerable:!0,get:function(){return h.default}})}(At)),At}var bo;function w_(){return bo||(bo=1,function(e){var t=kn&&kn.__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(I_()),r=t(S_()),s=zl(),i=Gl();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(O_());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 $ 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)},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 $=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++,$=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]};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 $=y(z);A(Y,ue,ue.normalize?ue.normalize($):$)}for(const $ of["r","p","i","d"])if(z[$]!==void 0){const te=$==="p"||$==="d"?(ae=z[$],K[ae]==null&&(K[ae]=F++),K[ae]):z[$];Y.write($,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,$={root:z},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(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,($=u($=be))[te]=oe,$)}else c(me)&&(o(z!==void 0,"Cannot pick up or remove undefined"),me.p!=null&&(K[me.p]=z),z=void 0)}var $,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 $=0;;$++){const te=S[$],oe=K.getComponent();if(oe&&(oe.r!==void 0?Y=!0:oe.p!=null&&(Y=!1,q=oe.p,z=$)),$>=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(z))}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),z=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())}),z.traverse(null,X=>{X.d!=null&&(te[X.d]=z.clone())});const De=s.writeCursor();return function X(Re,ze,He,Ue,qe,Rt,Ge,et){o(ze||He);const Ve=a(ze),ct=a(He),at=!!ct&&ct.r!==void 0,Pt=!!Ve&&Ve.i!==void 0,Fe=Ve?Ve.d:null,ht=ct?ct.p:null,E=(Rt||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=$[Fe],et=ue[Fe]=new s.WriteCursor,E)Rt&&!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;Pt?(o(qe===void 0),m=Ve.i):m=qe;const T=(ht==null?!Pt||Rt||at:m===void 0)?null:Ge.getComponent();if(ht!=null){if(!(qe!==void 0||Pt)){const L=Fe!=null?oe[Fe]:K++;me[ht]=L,et.write("p",L)}}else at&&(Pt||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 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(ze,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 re=L+Q;Te=ce(re),h(a(Pe))&&(Te=null),ke=re+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),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(),we.end(),T!=null)T.i=m;else if(!Rt&&!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,$,te){const oe=ae.getComponent();let me,be=!1;if(oe){oe.p!=null&&($.write("d",oe.p),z[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,ze=R(te,Re);h(ae.getComponent())&&De++;const He=ue(ae,$,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}$.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=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 $)if(typeof X=="number"){const Re=X-be,ze=De(Re),He=Re+me;te.descend(He),ue(ze,$,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 z=!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?z=!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,ze=R(oe,Re),He=ae($,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 $(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,Rt=He(qe),Ge=qe+Re,et=R(be,De?qe:Ge);me.descend(Ue),$(Rt,oe,me,et,De),h(oe.getComponent())&&ze++,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 z=null;const Y=[],ue=[],ae=[],$=[],te=[],oe=[],me=[],be=[],De=[],X=[],Re=[],ze=[],He=[],Ue=[],qe=[];let Rt=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?($[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,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}(Ge,et,et.clone(),null,null),$.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=$[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++}),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()})(Ge,et,et.clone(),Ve,null),Ve.reset();let Pt=[];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 re;Q&&(Q.i!==void 0||(re=Q.d)!=null&&!X[re])&&(Me=re!=null?ve!=null&&ve===Ue[re]:n.default(Q.i,I.i),Me||re!=null&&q!==1&&Ue[re]!=null||z==null&&(z={type:i.ConflictType.DROP_COLLISION,op1:J(ve!=null?Y[ve]:null,T,I),op2:J(re!=null?ae[re]: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?(Pt[Rt]=ve,x.write("d",Se.p=Rt++)):x.write("i",r.default(I.i)),pe=!0))}else if(ve!=null&&!Se){const re=be[ve];re&&(P=re.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)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 re=y(Q);Me=ce.transform(ve,re,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()),re=ve-ee;{let Wt;for(;We&&typeof(Wt=m.getKey())=="number";){Wt+=L;const bt=m.getComponent(),gn=c(bt);if(Wt>re||Wt===re&&(!gn||q===0&&Me))break;if(gn){L--;const tn=bt.p;Ue.includes(tn),bt.d,a(He[bt.d]),c(a(He[bt.d])),(bt.r===void 0||at&&at.has(bt))&&(tn==null||!ct[tn]||q!==1&&Ue.includes(tn))||Pe--}We=m.nextSibling()}Se=We&&Wt===re?m:null}const lt=re-L;let $e=gt(lt);const Dt=lt-Ce;let mr=null;{let Wt,bt;for(;Ee&&typeof(Wt=U.getKey())=="number";){bt=Wt-Te;const gn=U.getComponent(),tn=h(gn);if(bt>Dt)break;if(bt===Dt){if(!tn){mr=U;break}{if(q===0&&Me){mr=U;break}const Yt=$e&&c($e.getComponent());if(q===0&&Yt)break}}if(tn){const Yt=gn.d;X[Yt],Ue[Yt],gn.i===void 0&&(X[Yt]||Ue[Yt]!=null&&q!==1)?(X[Yt]||Ue[Yt]!=null&&q===0)&&(Te++,ke--):Te++}Ee=U.nextSibling()}}const xi=Dt+Te+Pe+ke;o(xi>=0,"trying to descend to a negative index"),x.descend(xi),Me&&(Se=$e=mr=null,ee++),g(Se,T,$e,mr,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,re=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,re,$e,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(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(),z)return{ok:!1,conflict:z};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=Pt[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++)})})}),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,$]=ye(ue,q);F=v(le(F),ae),K=v(le(K),$),z=v(z,$)}}}}(kn)),kn}var Ao;function b_(){return Ao||(Ao=1,function(e){var t=nn&&nn.__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=nn&&nn.__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(w_(),e);var r=zl();Object.defineProperty(e,"ReadCursor",{enumerable:!0,get:function(){return r.ReadCursor}}),Object.defineProperty(e,"WriteCursor",{enumerable:!0,get:function(){return r.WriteCursor}});var s=Gl();Object.defineProperty(e,"ConflictType",{enumerable:!0,get:function(){return s.ConflictType}})}(nn)),nn}var mt=b_();const A_=Ct(mt),T_=dc({__proto__:null,default:A_},[mt]);var he=(e=>(e.RETAIN="r",e.INSERT="i",e.DELETE="d",e))(he||{});function hr(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&&ne.isEmptyObject(o)&&r.sId==null)continue;if(n.length===0){n.push(r);continue}const a=n.pop();Ma(r,a)&&ne.hasIntersectionBetweenTwoRanges(a.st,a.ed,r.st,r.ed)?n.push({...r,st:a.st,ed:i}):n.push(a,r)}return n}function Vl(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=hr(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(ur("startIndex"))}}function Xl(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(ur("startIndex"))}}function ql(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(ur("startIndex"))}s.length&&!e.customBlocks&&(e.customBlocks=s)}function Jl(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(ur("startIndex"))}}const Zl="$",To=e=>e.split(Zl)[0];function Si(e){if(e.length<=1)return e;e.sort((s,i)=>s.startIndex-i.startIndex);const t=[];let n={...e[0]};n.rangeId=To(n.rangeId);for(let s=1;s<e.length;s++){const i=e[s];i.rangeId=To(i.rangeId),i.rangeId===n.rangeId&&Yl(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}${Zl}${r[a]}`,r[a]=r[a]+1):r[a]=1}return t}function Vs(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 Ql(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 Ks(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 y_(e,t,n,r){e.customRanges||(e.customRanges=[]);const{customRanges:s}=e;Vs(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=Si(s)}function N_(e,t,n,r){e.customDecorations||(e.customDecorations=[]);const{customDecorations:s}=e;Ks(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=Ql(s)}function eu(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 tu(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 nu(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 ru(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 su(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=ns(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 M_(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=ns(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=Si(a)}return o}function D_(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=ns(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 iu=(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))(iu||{}),Ut=(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))(Ut||{});const wr={"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}},pn=e=>[...e,...e,...e].map((t,n)=>({glyphFormat:` %${n+1}`,glyphSymbol:t,bulletAlignment:lr.START,textStyle:{fs:12},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*n}}})),En=e=>e.map((t,n)=>({...t,bulletAlignment:lr.START,textStyle:{fs:12},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*n}}})),yo=(e,t)=>new Array(9).fill(0).map((n,r)=>({glyphFormat:` %${r+1}`,glyphSymbol:e,bulletAlignment:lr.START,textStyle:{fs:16},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*r},textStyle:t}})),dr={BULLET_LIST:{listType:"BULLET_LIST",nestingLevel:pn(["●","○","■"])},BULLET_LIST_1:{listType:"BULLET_LIST",nestingLevel:pn(["❖","➢","■"])},BULLET_LIST_2:{listType:"BULLET_LIST",nestingLevel:pn(["✔","●","◆"])},BULLET_LIST_3:{listType:"BULLET_LIST",nestingLevel:pn(["■","◆","○"])},BULLET_LIST_4:{listType:"BULLET_LIST",nestingLevel:pn(["✧","○","■"])},BULLET_LIST_5:{listType:"BULLET_LIST",nestingLevel:pn(["➢","○","◆"])},ORDER_LIST:{listType:"ORDER_LIST",nestingLevel:En([{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:En([{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:En(["%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:En([{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:En([{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:En([{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:yo("☐")},CHECK_LIST_CHECKED:{listType:"CHECK_LIST_CHECKED",nestingLevel:yo("☑",{st:{s:Ie.TRUE}})}},br=e=>{const{glyphFormat:t,glyphType:n}=e,r=ne.deepClone(dr.ORDER_LIST);return r.nestingLevel[0].glyphFormat=t,r.nestingLevel[0].glyphType=n,r},L_={ORDER_LIST_QUICK_2:br(wr["a)"]),ORDER_LIST_QUICK_3:br(wr["a."]),ORDER_LIST_QUICK_4:br(wr["i."]),ORDER_LIST_QUICK_6:br(wr["I."])};Object.assign(dr,L_);const x_={"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 U_(e,t,n,r,s){const i=P_(e,t,n,r,s),o=k_(e,t,n,r,s),a=F_(e,t,n,r,s),l=B_(e,t,n,r,s),u=$_(e,t,n,r,s),c=H_(e,t,n,r),h=j_(e,t,n,r,s);return{dataStream:"",textRuns:i,paragraphs:o,sectionBreaks:a,customBlocks:l,tables:u,customRanges:c,customDecorations:h}}function P_(e,t,n,r,s){const{textRuns:i}=e,{textRuns:o}=t;if(i==null||o==null)return;const a=eu(e,n,r);if(s!==xe.REPLACE){const l=ou(o,a,s);t.textRuns=l}return Vl(e,t,n,r),a}function ou(e,t,n){if(t.length===0)return e;e=ne.deepClone(e),t=ne.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)),hr(r)}function k_(e,t,n,r,s){const{paragraphs:i}=e,{paragraphs:o}=t;if(i==null||o==null)return;const a=tu(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:Ut.BULLET_LIST,nestingLevel:0,textStyle:{},...N,...d}):(G={...h,...w},W={listId:"",listType:Ut.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 F_(e,t,n,r,s){const{sectionBreaks:i}=e,{sectionBreaks:o}=t;if(i==null||o==null)return;const a=nu(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 Xl(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=ru(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 ql(e,t,n,r),i.length&&!e.customBlocks&&(e.customBlocks=i),a}function $_(e,t,n,r,s){const{tables:i}=e,{tables:o}=t;if(i==null||o==null)return;const a=su(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 Jl(e,t,n,r),a}function H_(e,t,n,r,s){e.customRanges||(e.customRanges=[]),Vs(e.customRanges,r),Vs(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=Si(l),c):[]}function j_(e,t,n,r,s){e.customDecorations||(e.customDecorations=[]),Ks(e.customDecorations,r),Ks(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===on.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=Ql(o),i}var vi=(e=>(e[e.copy=0]="copy",e[e.cut=1]="cut",e))(vi||{});function Kr(e,t,n,r=!0){const{textRuns:s}=e;if(s){const i=[];for(const o of s){const a=ne.deepClone(o),{st:l,ed:u}=a;ne.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 hr(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 au(e,t,n){const{tables:r=[]}=e,s=[];for(const i of r){const o=ne.deepClone(i),{startIndex:a,endIndex:l}=o;a>=t&&l<=n&&s.push({...o,startIndex:a-t,endIndex:l-t})}return s}function lu(e,t,n){const{paragraphs:r=[]}=e,s=[];for(const i of r){const{startIndex:o}=i;if(o>=t&&o<n){const a=ne.deepClone(i);s.push(a)}}if(s.length)return s.map(i=>({...i,startIndex:i.startIndex-t}))}function W_(e,t,n){const{sectionBreaks:r=[]}=e,s=[];for(const i of r){const{startIndex:o}=i;o>=t&&o<=n&&s.push(ne.deepClone(i))}if(s.length)return s.map(i=>({...i,startIndex:i.startIndex-t}))}function uu(e,t,n){const{customBlocks:r=[]}=e,s=[];for(const i of r){const{startIndex:o}=i;o>=t&&o<n&&s.push(ne.deepClone(i))}if(s.length)return s.map(i=>({...i,startIndex:i.startIndex-t}))}function Nt(e,t,n,r=!0,s=1){const{dataStream:i}=e,o={dataStream:i.slice(t,n)};o.textRuns=Kr(e,t,n,r);const a=au(e,t,n);if(a.length&&(o.tables=a),o.paragraphs=lu(e,t,n),s===1){const u=hu(e,t,n);u?o.customDecorations=u:r&&(o.customDecorations=[])}const{customRanges:l}=cu(e,t,n);return l?o.customRanges=l:r&&(o.customRanges=[]),o.customBlocks=uu(e,t,n),o}function Y_(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 cu(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 hu(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=ne.deepClone(i);s.push({...o,startIndex:Math.max(o.startIndex-t,0),endIndex:Math.min(o.endIndex,n-1)-t})}}),s}function z_(e,t,n){return e==null||t==null?e!=null?e:t:ou(e,t,n)}function G_(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 V_(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 Xs(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=z_(l,s,n),r.customRanges=G_(c,o,n);const d=V_(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(ne.deepMerge(w,N)),p++,R++):G<W?(f.push(ne.deepClone(w)),p++):(f.push(ne.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 K_(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 Rn{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?ne.deepClone({...n,len:t}):ne.deepClone({...n,len:t,body:Nt(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 fn{constructor(){C(this,"cursor",0)}reset(){return this.cursor=0,this}moveCursor(t){this.cursor+=t}moveCursorTo(t){this.cursor=t}}function du(e,t,n){const{dataStream:r}=e,s=n,i=n+t,o=eu(e,t,n),a=tu(e,t,n),l=nu(e,t,n),u=ru(e,t,n),c=su(e,t,n),h=M_(e,t,n),d=D_(e,t,n);let f="";return r&&(e.dataStream=xa(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 fu(e,t,n,r){e.dataStream=La(e.dataStream,r,t.dataStream),Vl(e,t,n,r),Kl(e,t,n,r),Xl(e,t,n,r),ql(e,t,n,r),Jl(e,t,n,r),y_(e,t,n,r),N_(e,t,n,r)}function X_(e,t,n,r,s=xe.COVER){return U_(e,t,n,r,s)}function q_(e,t,n){return t<=0?{dataStream:""}:du(e,t,n)}function J_(e,t,n,r){n!==0&&fu(e,t,n,r)}function Z_(e,t){const n=new fn;return n.reset(),t.forEach(r=>{const s=ne.deepClone(r);switch(s.t){case he.RETAIN:{const{coverType:i,body:o,len:a}=s;o!=null&&X_(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;q_(e,i,n.cursor);break}default:throw new Error(`Unknown action type for action: ${s}.`)}}),e}function Q_(e,t,n,r,s){if(e==null||t==null)return t;if(e.length===0||t.length===0)return[];t=ne.deepClone(t),e=ne.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)),hr(i,!0)}function ep(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?[ne.deepClone(i)]:[ne.deepClone(o)];if(r===xe.REPLACE){const a=ne.deepClone(o);return s===1&&Object.assign(a,ne.deepClone(i)),[a]}else{const a=ne.deepClone(o);return s===1&&Object.assign(a,ne.deepClone(i)),[a]}}function No(e,t,n,r,s){const i={startIndex:t.startIndex};if(t.paragraphStyle&&(i.paragraphStyle=ne.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?ne.deepClone(e.bullet):ne.deepClone(t.bullet):e.bullet===void 0?i.bullet=ne.deepClone(t.bullet):n===xe.REPLACE||r===xe.REPLACE?i.bullet=s===0&&t.bullet?ne.deepClone(t.bullet):ne.deepClone(e.bullet):s===0&&t.bullet!==void 0&&(i.bullet=ne.deepClone(t.bullet)),i}function tp(e,t){if(e==null||t==null)return t;if(e.length===0||t.length===0)return ne.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===on.DELETED||i===on.DELETED)&&(o=!0,n.push({...r,type:on.DELETED}));break}o||n.push(r)}return n}function np(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=Q_(u,f,s,o,n?1:0);N&&(a.textRuns=N);const G=ep(h,R,s,o,n?1:0);G&&(a.customRanges=G);const W=tp(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?_=No(j,Z,s,o,1):_=No(j,Z,s,o,0),se.push(_),y++,A++}else fe<le?y++:(se.push(ne.deepClone(Z)),A++)}return A<p.length&&se.push(...p.slice(A)),se.length&&(a.paragraphs=se),{coverType:l,body:a}}function Mo(e){return Object.keys(e).length===1}const bn=class bn{constructor(){C(this,"_actions",[])}static apply(t,n){return Z_(t,n)}static compose(t,n){const r=new Rn(t),s=new Rn(n),i=new bn;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:Xs(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:Xs(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 Rn(t),i=new Rn(n),o=new bn;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}=np(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 Rn(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=Nt(n,s,s+i.len,!1);i.len=o.dataStream.length,i.body=o}if(i.t===he.RETAIN&&i.body!=null){const o=Nt(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=ne.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&&Mo(r.body)&&s.t===he.INSERT&&Mo(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&&K_(t);)this._actions.pop(),t=this._actions[this._actions.length-1];return this}};C(bn,"id","text-x"),C(bn,"uri","https://github.com/dream-num/univer#text-x");let Ye=bn;Object.defineProperty(Ye,"name",{value:"text-x"});const An=class An{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 An),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(An,"uri","https://github.com/dream-num/univer#json-x"),C(An,"_subTypes",new Map),C(An,"_instance",null);let $t=An;$t.registerSubtype(Ye);const Oi={id:"default_doc",documentStyle:{}};class rp extends ls{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={...Oi,...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{...dr,...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 Mt extends rp{constructor(n){var s,i;super(ne.isEmptyObject(n)?R_():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:ne.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={...Oi,...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(!$t.isNoop(n))return this.snapshot=$t.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=vi.copy){const i=this.getBody();if(i!=null)return Nt(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 Mt(i)),this.headerModelMap.get(s).updateDocumentId(this.getUnitId())}if(r)for(const s in r){const i=r[s];this.footerModelMap.set(s,new Mt(i)),this.footerModelMap.get(s).updateDocumentId(this.getUnitId())}}updateDocumentId(n){super.updateDocumentId(n),this._unitId=n}getPlainText(){var n,r;return rs((r=(n=this.getBody())==null?void 0:n.dataStream)!=null?r:"")}}function sp(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 ip(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:on.DELETED}]}}),o}function gu(e,t,n,r){return e<=n&&t>=n||e>=n&&e<=r}function op(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):gu(e.startOffset,e.endOffset-1,i.startIndex,i.endIndex)&&n.push(i)}return n}function ap(e){return{...ne.deepClone(e),rangeId:Bt()}}function lp(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 mu(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 up(e,t){var i,o,a,l,u;const n=mu(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 cp(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 hp(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=up(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=mu(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);lp([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 _u(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 dp(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:{...ne.deepClone(t),dataStream:""}}),s=a)}),r}const fp=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:Nt(i,t.startOffset,t.endOffset),a=Ri(o?o.dataStream:"",n.dataStream);let l=0;const u=a.map(([d,f])=>{switch(d){case 0:{const p={t:he.RETAIN,body:{...Nt(n,l,l+f.length,!1),dataStream:""},len:f.length};return l+=f.length,p}case 1:{const p={t:he.INSERT,body:Nt(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 gp(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 mp=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:Nt(i,t.startOffset,t.endOffset),a=Ri(o?o.dataStream:"",n.dataStream);let l=0;const u=a.map(([d,f])=>{switch(d){case 0:{const p=Kr(n,l,l+f.length,!1),R=Kr(o,l,l+f.length,!1),w={t:he.RETAIN,body:gp(p,R)?void 0:{textRuns:p,dataStream:""},len:f.length};return l+=f.length,w}case 1:{const p={t:he.INSERT,body:Nt(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 _p(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 pp(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 Ep=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=$t.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=_u([t],c,0,null,!1);a.push(...W);const se=_p(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=pp(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)=>$t.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 Rp(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 Ip(e,t,n,r){return Math.max(e,n)<=Math.min(t,r)}function qs(e,t,n,r){const{startOffset:s,endOffset:i}=e,o=r!=null?r:wi(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 Js(e,t,n){const r=[],s=wi(t,n);for(const i of e){const o=qs(i,t,n,s);r.push(...o)}return r}const Sp=[_t.PARAGRAPH,_t.TABLE_START,_t.TABLE_END,_t.TABLE_ROW_START,_t.TABLE_CELL_START,_t.TABLE_CELL_END];function wi(e,t){const n=[];for(let r=0;r<e.length;r++){const s=e[r],{startIndex:i}=s;let o=i-1;for(;!Sp.includes(t[o])&&o>=0;)o--;n.push({...s,paragraphStart:o+1,paragraphEnd:s.startIndex})}return n}const vp=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=ne.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!==Ut.CHECK_LIST&&(s=R.bullet.listType)):w&&w.bullet&&w.bullet.listType.indexOf(s)===0&&(l=w.bullet.listId,s!==Ut.CHECK_LIST&&(s=w.bullet.listType))}const u=new fn;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},Op=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(Ut.CHECK_LIST)===-1)return!1;const o=new fn;o.reset();const a=new Ye,{startIndex:l,paragraphStyle:u={}}=i,c=i.bullet.listType===Ut.CHECK_LIST?Ut.CHECK_LIST_CHECKED:Ut.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},wp=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=ne.generateRandomId(6),l=new fn;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 bp(e,t){return t.some(n=>e.startIndex>n.startIndex&&e.startIndex<n.endIndex)}const Ap=e=>{var u,c,h;const{paragraphs:t,document:n,type:r}=e,s=new fn;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={...dr,...o};for(const d of t){const{startIndex:f,paragraphStyle:p={},bullet:R}=d,w=bp(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},Tp=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=Js(t,c,h),f=new fn;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:hp,delete:cp,copyCustomRange:ap,getCustomRangesInterestsWithSelection:op,isIntersecting:gu}),C(ot,"customDecoration",{add:sp,delete:ip}),C(ot,"selection",{replace:fp,makeSelection:Cp,normalizeSelection:Rp,delete:_u,replaceTextRuns:mp,retain:dp}),C(ot,"range",{isIntersects:Ip,getParagraphsInRange:qs,getParagraphsInRanges:Js}),C(ot,"transform",{getPlainText:rs,fromPlainText:ff,isEmptyDocument:df}),C(ot,"paragraph",{bullet:{set:wp,switch:vp,toggleChecklist:Op,changeNestLevel:Ap},style:{set:Tp},util:{transform:wi,getParagraphsInRange:qs,getParagraphsInRanges:Js}}),C(ot,"drawing",{add:Ep});function yp(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 pu(e){var t;return e.body=yp((t=e.body)!=null?t:{dataStream:""}),e.drawingsOrder||(e.drawingsOrder=[]),e.drawings||(e.drawings={}),e.documentStyle||(e.documentStyle={}),e}class fr{constructor(t={}){C(this,"_style");this._style=t}static create(t={}){return new fr(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&&Vt.create(this._style.ul)}get bottomBorderLine(){return this._style.bbl&&Vt.create(this._style.bbl)}get strikethrough(){return this._style.st&&Vt.create(this._style.st)}get overline(){return this._style.ol&&Vt.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 Jt.create(ne.deepClone(this._style))}getValue(){return{...this._style}}}class Jt extends fr{static create(t={}){return new Jt(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 Jt.create(ne.deepClone(this._style))}build(){return this.getValue()}}class Vt{constructor(t={s:1}){C(this,"_decoration");this._decoration=t}static create(t={s:1}){return new Vt(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 Vt.create(ne.deepClone(this._decoration))}build(){return{...this._decoration}}}class gr{constructor(t={}){C(this,"_style");this._style=t}static create(t={}){return new gr(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 er.create(ne.deepClone(this._style))}getValue(){return this._style}}class er extends gr{static create(t={}){return new er(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 er.create(ne.deepClone(this._style))}build(){return this.getValue()}}class Kt{constructor(t){C(this,"_data");if(!t.body)throw new Error("Invalid document data, body is required");this._data=pu(t)}static create(t){return new Kt(t)}static createByBody(t){return new Kt({body:t,id:"d",documentStyle:{}})}copy(){return an.create(ne.deepClone(this._data))}slice(t,n){const{body:r,...s}=this._data;return an.create({...ne.deepClone(s),body:Nt(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 gr.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?fr.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===Zt.HYPERLINK))!=null?r:[]}getData(){return this._data}}class an extends Kt{constructor(n){super(n);C(this,"_doc");this._doc=new Mt(n)}static newEmptyData(){return pu({id:"d",documentStyle:{},drawings:{},drawingsOrder:[],body:{dataStream:`\r
8
- `,customBlocks:[],customRanges:[],paragraphs:[{startIndex:0}],textRuns:[],tables:[],sectionBreaks:[]}})}static create(n){return new an(n!=null?n:an.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 Jt?r.build():r:a=s instanceof Jt?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 Kt?n.getData():n:(s=Math.min(n,s),i=r instanceof Kt?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 Jt?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:Zt.HYPERLINK,rangeId:Bt(),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,Kt.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=an.createByBody({dataStream:i,customRanges:[{rangeType:Zt.HYPERLINK,rangeId:Bt(),properties:{url:o},startIndex:0,endIndex:i.length-1}]});return typeof n=="number"?this.insertRichText(n,a):this.insertRichText(a)}}function Np(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 On=(e=>(e[e.Style=1]="Style",e[e.Value=2]="Value",e))(On||{});function Mp(e){return`sheet_interceptor_${e}`}const Eu=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 Dp{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)),Eu(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)})),()=>rr(this._interceptorsByName.get(r),n)}getInterceptPoints(){return this._interceptorPoints}dispose(){this._interceptorsByName.clear()}}function Lp(e){return`sheet_async_interceptor_${e}`}const xp=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 Up{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)),xp(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)})),()=>rr(this._asyncInterceptorsByName.get(r),n)}getInterceptPoints(){return this._asyncInterceptorPoints}dispose(){this._asyncInterceptorsByName.clear()}}function Pp(e,t){for(const n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}function Cu(e){return/^-?\d+(\.\d+)?$/.test(e)}function kp(e){return Cu(e)?Number(e)<=Number.MAX_SAFE_INTEGER:!1}function Fp(e){return Number(e)>Number.MAX_SAFE_INTEGER||e.length>=18}class bi{constructor(){C(this,"_data",[])}static create(){return new bi}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 Ai{constructor(){C(this,"_data",new Map)}static create(){return new Ai}add(t,n){this._data.has(t)||this._data.set(t,n)}delete(t){this._data.delete(t)}getData(){return this._data}}function Bp(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 $p(e,t){return t.forEach(n=>e.add(n)),e}function Hp(e,t,n,r){var u;if(t==="")return e;const s={id:"mock-id",body:e,documentStyle:{}},i=new Mt(s),o=t.length;let a;for(;(a=(r?i.getBody().dataStream:i.getBody().dataStream.toLowerCase()).indexOf(t))>=0;){const c=new Ye,h=$t.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 jp="__default_document_sub_component_id20231101__";class Ru{constructor(){C(this,"skipNextObservers",!1);C(this,"lastReturnValue");C(this,"isStopPropagation",!1)}stopPropagation(){this.isStopPropagation=!0}}class Wp 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 Ru;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 Yp(e){return new Oe.Observable(t=>{const n=e.subscribeEvent(r=>{t.next(r)});return()=>n.unsubscribe()})}const us=je.createIdentifier("core.resource-manager.service"),Zs={[xt.Editor]:"Editor",[xt.Owner]:"Owner",[xt.Reader]:"Reader",[xt.UNRECOGNIZED]:"UNRECOGNIZED"},Xr=e=>e?{userID:`${Zs[e]}_${ne.generateRandomId(8)}`,name:Zs[e],avatar:""}:{userID:"",name:"",avatar:"",anonymous:!0,canBindAnonymous:!1},zp=(e,t)=>e.startsWith(Zs[t]);class tr{constructor(){C(this,"_model",new Map);C(this,"_userChange$",new Oe.Subject);C(this,"userChange$",this._userChange$.asObservable());C(this,"_currentUser$",new Oe.BehaviorSubject(Xr()));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 Gp=Object.getOwnPropertyDescriptor,Vp=(e,t,n,r)=>{for(var s=r>1?void 0:r?Gp(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);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(Xr(xt.Owner))}_getRole(t){const n=this._userManagerService.getCurrentUser();return n?zp(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 Bt(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:xt.Owner,shareScope:-1,scope:{read:zs.AllCollaborator,edit:zs.AllCollaborator},creator:Xr(xt.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(xt.Owner)||this._getRole(xt.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=Vp([Do(0,us),Do(1,je.Inject(tr))],exports.AuthzIoLocalService);const Iu=je.createIdentifier("IAuthzIoIoService");var Kp=Object.getOwnPropertyDescriptor,Xp=(e,t,n,r)=>{for(var s=r>1?void 0:r?Kp(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},qp=(e,t)=>(n,r)=>t(n,r,e);exports.MentionIOLocalService=class{constructor(t){this._userManagerService=t}async list(t){return{list:[{type:$r.PERSON,mentions:[{objectType:$r.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=Xp([qp(0,je.Inject(tr))],exports.MentionIOLocalService);const Su=je.createIdentifier("univer.service.mention-io"),Ti=je.createIdentifier("univer.config-service");class vu{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=Ci(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 zn="FOCUSING_UNIT",wn="FOCUSING_SHEET",Gn="FOCUSING_DOC",Vn="FOCUSING_SLIDE",Jp="FOCUSING_EDITOR_BUT_HIDDEN",Ou="EDITOR_ACTIVATED",Zp="FOCUSING_EDITOR_INPUT_FORMULA",wu="FOCUSING_FX_BAR_EDITOR",Qp="FOCUSING_UNIVER_EDITOR",eE="FOCUSING_EDITOR_INPUT_FORMULA",tE="FOCUSING_PANEL_EDITOR",nE="FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE",rE="FOCUSING_COMMON_DRAWINGS",sE="FORMULA_EDITOR_ACTIVATED";class bu 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 iE="0.8.0-beta.0",oE={version:iE};function aE(e="",t=or.ZH_CN,n=""){return{id:e,sheetOrder:[],name:n,appVersion:oE.version,locale:t,styles:{},sheets:{},resources:[]}}class Au{constructor(t={}){C(this,"_styles");C(this,"_cacheMap",new Zn(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=ne.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&&ne.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(ne.diffValue(n[r],t))return r;return null}}const lE=(e,t)=>t.length===e.length&&!e.some(n=>t.some(r=>!Qt.equals(r,n))),uE=(e,t)=>t.length===e.length&&e.every((n,r)=>{const s=t[r];return s.unitId===n.unitId&&s.sheetId===n.sheetId&&Qt.equals(n.range,s.range)}),Qs={t:0,b:2,l:2,r:2},cE=e=>({sbr:.6,sbo:e,spr:.6,spo:e}),Lo=90;function Kn(e,t,n={}){const r=e.length,{textRotation:s,paddingData:i,horizontalAlign:o=yt.UNSPECIFIED,verticalAlign:a=sn.UNSPECIFIED,wrapStrategy:l=un.UNSPECIFIED,cellValueType:u}=n,{t:c,r:h,b:d,l:f}=i||Qs,{vertexAngle:p,centerAngle:R}=Nu(s),w={id:"d",body:{dataStream:`${e}${Pa}`,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 Mt(w)}function hE(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 xo(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 Tu(e,t,n){var i;const r=e.getBody();if((i=r.customRanges)!=null&&i.some(o=>o.rangeType===Zt.HYPERLINK))return;const s=ot.customRange.add({ranges:[{startOffset:0,endOffset:r.dataStream.length-1,collapsed:!1}],rangeId:n,rangeType:Zt.HYPERLINK,body:r,properties:{url:t,refId:n}});s&&Ye.apply(r,s.serialize())}function yu(e){return e!=null}const dE='"Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif';function Uo(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=vn.ITALIC;(e.it===0||e.it===void 0)&&(r=vn.NORMAL);let s=vn.BOLD;(e.bl===0||e.bl===void 0)&&(s=vn.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===Ft.SUBSCRIPT||a===Ft.SUPERSCRIPT){const h=fE(o,l),{sbr:d,spr:f}=h;l*=a===Ft.SUBSCRIPT?d:f}const u=`${r} ${s} ${l}pt ${o}`,c=`${u}, ${dE} `;return{fontCache:u,fontString:c,fontSize:l,originFontSize:i,fontFamily:o}}function fE(e,t){return cE(t)}function Nu(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=Lo,s=Lo),{centerAngle:r,vertexAngle:s}}class gE{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 qt(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 mE{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 qt(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 _E="DEFAULT_WORKSHEET_ROW_COUNT",Mu=1e3,pE="DEFAULT_WORKSHEET_COLUMN_COUNT",Du=20,EE="DEFAULT_WORKSHEET_ROW_HEIGHT",Lu=24,CE="DEFAULT_WORKSHEET_COLUMN_WIDTH",xu=88,RE="DEFAULT_WORKSHEET_ROW_TITLE_WIDTH",Uu=46,IE="DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT",Pu=20;function ku(e){const t={name:"Sheet1",id:"sheet-01",tabColor:"",hidden:Ie.FALSE,rowCount:Mu,columnCount:Du,zoomRatio:1,freeze:{xSplit:0,ySplit:0,startRow:-1,startColumn:-1},scrollTop:0,scrollLeft:0,defaultColumnWidth:xu,defaultRowHeight:Lu,mergeData:[],cellData:{},rowData:{},columnData:{},showGridlines:Ie.TRUE,rowHeader:{width:Uu,hidden:Ie.FALSE},columnHeader:{height:Pu,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 SE 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 Zn(5e4));C(this,"_skeletonCache",new Zn(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||!ne.isEmptyObject(this._columnCache)?!0:this._mergeData.some(r=>r.startRow<=n&&n<=r.endRow)}isColumnContainsMergedCell(n){return this._hasAll||!ne.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||[])Qt.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 Fu 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,On.Value|On.Style,s,i):this.getRawCell(n,r)}getCellValueOnly(n,r){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,r,On.Value):this.getRawCell(n,r)}getCellStyleOnly(n,r){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,r,On.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 Po={isDeepClone:!1,displayRawFormula:!1,ignoreTextRotation:!1};class nr{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=ku(n);const{columnData:s,rowData:i,cellData:o}=this._snapshot;this._sheetId=(a=this._snapshot.id)!=null?a:ne.generateRandomId(6),this._cellData=new Et(o),this._viewModel=new Fu((l,u)=>this.getCellRaw(l,u)),this._rowManager=new mE(this._snapshot,this._viewModel,i),this._columnManager=new gE(this._snapshot,s),this._spanModel=new SE(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?Ls(i,o,a,s):Ls(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=ne.deepClone(t);return new nr(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=Sn.Raw){const o=this.getCellMatrix(),a=this._spanModel.getMergedCellRange(t,n,r,s),l=new Et;return Hs(t,r,n,s).forEach((u,c)=>{var d;let h;if(i===Sn.Raw)h=this.getCellRaw(u,c);else if(i===Sn.Intercepted)h=this.getCell(u,c);else if(i===Sn.Both){const f=this.getCellRaw(u,c);if(f){h={...f};const p=(d=this.getCell(u,c))==null?void 0:d.v;yu(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;Hs(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 Tn(this,t,{getStyles:()=>this._styles}):new Tn(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=Po){var R;const{isDeepClone:r,displayRawFormula:s,ignoreTextRotation:i}={...Po,...n},o=this._styles.getStyleByCell(t);if(!t)return;let a,l="document";const u=hE(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||Qs;if(t.f&&s)a=Kn(t.f.toString(),{},{verticalAlign:d}),h=ut.ht;else if(t.p){const{centerAngle:w,vertexAngle:N}=Nu(c);a=this._updateConfigAndGetDocumentModel(r?ne.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=xo(o);l=Uo(w).fontCache;let N=Bu(t);t.t===Xt.FORCE_STRING&&s&&(N=`'${N}`),a=Kn(N,w,{...u,textRotation:c,cellValueType:t.t})}return a&&t.linkUrl&&t.linkId&&Tu(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 Mt(t)}getBlankCellDocumentModel(t){const n=this._getCellDocumentModel(t,{ignoreTextRotation:!0}),r=this._styles.getStyleByCell(t),s=xo(r);if(n!=null)return n.documentModel==null&&(n.documentModel=Kn("",s)),n;const i="";let o="document";const a=ut.tr,l=ut.ht,u=ut.vt,c=ut.tb,h=Qs;return o=Uo({}).fontCache,{documentModel:Kn(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 Bu(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===Xt.BOOLEAN?n.toUpperCase():n.replace(/[\r\n]/g,""):typeof n=="number"?e.t===Xt.BOOLEAN?n?"TRUE":"FALSE":n.toString():typeof n=="boolean"?n?"TRUE":"FALSE":""}function vE(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 OE=Object.getOwnPropertyDescriptor,wE=(e,t,n,r)=>{for(var s=r>1?void 0:r?OE(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);function AE(e,t){return`${e.getUnitId()}|${t.getSheetId()}`}exports.Workbook=class extends ls{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=aE();ne.isEmptyObject(n)?this._snapshot=s:this._snapshot=ne.commonExtend(s,n);const{styles:i}=this._snapshot;(this._snapshot.id==null||this._snapshot.id.length===0)&&(this._snapshot.id=ne.generateRandomId(6)),this._unitId=this._snapshot.id,this._styles=new Au(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 ne.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 nr(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(ne.isEmptyObject(s)){const o=ne.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 nr(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=wE([bE(1,Ot)],exports.Workbook);class yi extends ls{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={..._l,...n},this._unitId=(r=this._snapshot.id)!=null?r:ne.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:Bt(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=Bt(6);return{id:n,pageType:ci.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 TE=Object.getOwnPropertyDescriptor,yE=(e,t,n,r)=>{for(var s=r>1?void 0:r?TE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},ko=(e,t)=>(n,r)=>t(n,r,e);const Mn=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(zn,!0),this._contextService.setContextValue(Gn,!1),this._contextService.setContextValue(wn,!0),this._contextService.setContextValue(Vn,!1),this.setCurrentUnitForType(n)):this.focused instanceof Mt?(this._contextService.setContextValue(zn,!0),this._contextService.setContextValue(Gn,!0),this._contextService.setContextValue(wn,!1),this._contextService.setContextValue(Vn,!1),this.setCurrentUnitForType(n)):this.focused instanceof yi?(this._contextService.setContextValue(zn,!0),this._contextService.setContextValue(Gn,!1),this._contextService.setContextValue(wn,!1),this._contextService.setContextValue(Vn,!0),this.setCurrentUnitForType(n)):(this._contextService.setContextValue(zn,!1),this._contextService.setContextValue(Gn,!1),this._contextService.setContextValue(wn,!1),this._contextService.setContextValue(Vn,!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=yE([ko(0,je.Inject(je.Injector)),ko(1,Dn)],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 NE={0:"Starting",1:"Ready",2:"Rendered",3:"Steady"};var ME=Object.getOwnPropertyDescriptor,DE=(e,t,n,r)=>{for(var s=r>1?void 0:r?ME(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},LE=(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),Ds(r=>r===n),Oe.map(()=>{})))}subscribeWithPrevious(){return Oe.merge($u(this.stage),this._lifecycle$.pipe(Oe.skip(1))).pipe(Ds(n=>n===Je.Steady))}_reportProgress(n){this._logService.debug("[LifecycleService]",`lifecycle progressed to "${NE[n]}".`)}};exports.LifecycleService=DE([LE(0,Ot)],exports.LifecycleService);function $u(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 xE=je.createIdentifier("ILocalStorageService");class ln extends st{constructor(){super();C(this,"_currentLocale$",new Oe.BehaviorSubject(or.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=Ci((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 Ni=(e=>(e.INIT="init",e.FETCHING="fetching",e.DONE="done",e))(Ni||{});const Hu=je.createIdentifier("univer.permission-service");class ju 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=Ni.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(Tr.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 UE=Object.getOwnPropertyDescriptor,PE=(e,t,n,r)=>{for(var s=r>1?void 0:r?UE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},ws=(e,t)=>(n,r)=>t(n,r,e);const kE=4,Wu=Symbol("DependentOn");class ei extends st{onStarting(){}onReady(){}onRendered(){}onSteady(){}getUnitType(){return this.constructor.type}getPluginName(){return this.constructor.pluginName}}C(ei,"pluginName"),C(ei,"type",Be.UNIVER_UNKNOWN);class FE{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 BE(...e){return function(t){t[Wu]=e}}exports.PluginService=class{constructor(t,n,r){C(this,"_pluginRegistry",new Map);C(this,"_pluginStore",new FE);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)},kE))}_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[Wu];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($u(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=PE([ws(0,je.Inject(je.Injector)),ws(1,je.Inject(exports.LifecycleService)),ws(2,Ot)],exports.PluginService);function Yu(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 ti=je.createIdentifier("resource-loader-service");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},jE=(e,t)=>(n,r)=>t(n,r,e);exports.ResourceManagerService=class extends st{constructor(n){super();C(this,"_resourceMap",new Map);C(this,"_register$",new Oe.Subject);C(this,"register$",this._register$.asObservable());this._logService=n}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(a){this._logService.error("[ResourceManagerService]","loadResources error",a)}})}unloadResources(n){this.getAllResourceHooks().forEach(r=>{r.onUnLoad(n)})}dispose(){this._register$.complete(),this._resourceMap.clear()}};exports.ResourceManagerService=HE([jE(0,Ot)],exports.ResourceManagerService);class qr extends st{constructor(){super();C(this,"_darkMode$",new Oe.BehaviorSubject(!1));C(this,"darkMode$",this._darkMode$.asObservable());C(this,"_currentTheme",hc.defaultTheme);C(this,"_currentTheme$",new Oe.BehaviorSubject(this._currentTheme));C(this,"currentTheme$",this._currentTheme$.asObservable());this.disposeWithMe(nt(()=>{this._currentTheme$.complete(),this._darkMode$.complete()}))}get darkMode(){return this._darkMode$.getValue()}getCurrentTheme(){return this._currentTheme}setTheme(n){this._currentTheme=n,this._currentTheme$.next(n)}setDarkMode(n){this._darkMode$.next(n)}getColorFromTheme(n){return $l(this._currentTheme,n)}}var WE=Object.getOwnPropertyDescriptor,YE=(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},bs=(e,t)=>(n,r)=>t(n,r,e);const cs=je.createIdentifier("univer.undo-redo.service"),zE=20;class zu{dispose(){}async dispatchToHandlers(){return!1}}const Gu="univer.command.redo",Vu="univer.command.undo",Ku=new class extends zu{constructor(){super(...arguments);C(this,"type",sr.COMMAND);C(this,"id",Vu)}handler(t){const n=t.get(cs),r=n.pitchTopUndoElement();if(!r)return!1;const s=t.get(ir);return Qr(r.undoMutations,s)?(n.popUndoToRedo(),!0):!1}},Xu=new class extends zu{constructor(){super(...arguments);C(this,"type",sr.COMMAND);C(this,"id",Gu)}handler(t){const n=t.get(cs),r=n.pitchTopRedoElement();if(!r)return!1;const s=t.get(ir);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(Ku)),this.disposeWithMe(this._commandService.registerCommand(Xu)),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>zE&&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(wn),s=this._contextService.getContextValue(wu),i=this._contextService.getContextValue(Ou);return r?s?n=li:i?n=ai: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=YE([bs(0,Mn),bs(1,ir),bs(2,Dn)],exports.LocalUndoRedoService);function GE(e){return!(e.length===0||e.length>31||e.startsWith("'")||e.endsWith("'")||/[:\\\/\?\*\[\]]/.test(e))}function VE(e){return new Promise(t=>setTimeout(t,e))}function KE(e=1){return new Promise(t=>{let n=0;const r=()=>{n++,n>=e?t():requestAnimationFrame(r)};requestAnimationFrame(r)})}var Mi=(e=>(e.URL="URL",e.UUID="UUID",e.BASE64="BASE64",e))(Mi||{}),qu=(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))(qu||{});const ni=je.createIdentifier("core.image-io.service");class Ju{constructor(t,n=100){C(this,"_imageCacheMap");this._injector=t,this._imageCacheMap=new Zn(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(ni)?this._injector.get(ni):null;if(t===Mi.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 XE=["script","style","meta","comment","link"];var Zu=(e=>(e[e.INFO=0]="INFO",e[e.STOP=1]="STOP",e[e.WARNING=2]="WARNING",e))(Zu||{}),Qu=(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))(Qu||{}),ec=(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))(ec||{}),tc=(e=>(e[e.TEXT=0]="TEXT",e[e.ARROW=1]="ARROW",e[e.CUSTOM=2]="CUSTOM",e))(tc||{}),nc=(e=>(e.VALID="valid",e.INVALID="invalid",e.VALIDATING="validating",e))(nc||{}),rc=(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))(rc||{}),qE=Object.getOwnPropertyDescriptor,JE=(e,t,n,r)=>{for(var s=r>1?void 0:r?qE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},ZE=(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=JE([ZE(0,je.Inject(ln))],exports.Skeleton);var QE=Object.getOwnPropertyDescriptor,e0=(e,t,n,r)=>{for(var s=r>1?void 0:r?QE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Ar=(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(Fa))!=null&&n),this._isRowStylePrecedeColumnStyle=(r=this._configService.getConfig(ka))!=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){ne.isDefine(n)&&(this._scrollX=n),ne.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=yt.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(!Bs(h)&&c!==r||this.intersectMergeRange(n,c))return c===r?c:c+1>l?l:c+1;const{startX:d,endX:f}=In(n,c,this.rowHeightAccumulation,this.columnWidthAccumulation);if(o===yt.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(!Bs(c)&&u!==r||this.intersectMergeRange(n,u))return u===r?u:u-1<0?0:u-1;const{startX:h,endX:d}=In(n,u,this.rowHeightAccumulation,this.columnWidthAccumulation);if(o===yt.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 Et;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}=In(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}=In(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=ic(n,r,s,this.columnHeaderHeightAndMarginTop);let a=$n(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=sc(n,r,s,this.rowHeaderWidthAndMarginLeft),{columnWidthAccumulation:a}=this;let l=$n(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=In(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=$n(this.columnWidthAccumulation,n);let i=0;s===0?i=n:i=n-this._columnWidthAccumulation[s-1];const o=$n(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 Mt(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=e0([Ar(2,je.Inject(ln)),Ar(3,Dn),Ar(4,Ti),Ar(5,je.Inject(je.Injector))],exports.SheetSkeleton);function Di(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 t0(e,t,n,r){return Di(e,t,n,r)}function In(e,t,n,r,s){e=ne.clamp(e,0,n.length-1),t=ne.clamp(t,0,r.length-1);let{startY:i,endY:o,startX:a,endX:l}=Di(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 sc(e,t,n,r){const{x:s}=n;return e/t+s-r}function ic(e,t,n,r){const{y:s}=n;return e=e/t+s-r,e}const Fo=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],As=1,Fn=8;class Li{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!==As)throw new Error(`Got v${s} data when expected v${As}.`);const i=Fo[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 Li(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=Fo.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,Fn,t),this.coords=new this.ArrayType(this.data,Fn+a+l,t*2),this._pos=t*2,this._finished=!0):(this.data=new ArrayBuffer(Fn+o+a+l),this.ids=new this.IndexArrayType(this.data,Fn,t),this.coords=new this.ArrayType(this.data,Fn+a+l,t*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(As<<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 ri(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++)Bo(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];Bo(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 ri(e,t,n,r,s,i){if(s-r<=n)return;const o=r+s>>1;oc(e,t,o,r,s,i),ri(e,t,n,r,o-1,1-i),ri(e,t,n,o+1,s,1-i)}function oc(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));oc(e,t,n,p,R,i)}const o=t[2*n+i];let a=r,l=s;for(Bn(e,t,r,n),t[2*s+i]>o&&Bn(e,t,r,s);a<l;){for(Bn(e,t,a,l),a++,l--;t[2*a+i]<o;)a++;for(;t[2*l+i]>o;)l--}t[2*r+i]===o?Bn(e,t,r,l):(l++,Bn(e,t,l,s)),l<=n&&(r=l+1),n<=l&&(s=l-1)}}function Bn(e,t,n,r){Ts(e,n,r),Ts(t,2*n,2*r),Ts(t,2*n+1,2*r+1)}function Ts(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function Bo(e,t,n,r){const s=e-n,i=t-r;return s*s+i*i}class n0{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 zr),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 Li(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 zr;s.fromJSON(t[n][r]),this._tree.get(n).set(r,s)}}}}var r0=Object.getOwnPropertyDescriptor,s0=(e,t,n,r)=>{for(var s=r>1?void 0:r?r0(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},$o=(e,t)=>(n,r)=>t(n,r,e);let si=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();Ba(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=ne.deepClone(t.getSnapshot());return r.resources=n,r}};si=s0([$o(0,je.Inject(us)),$o(1,je.Inject(Mn))],si);class i0{constructor(t={},n){C(this,"_startedTypes",new Set);C(this,"_injector");C(this,"_disposingCallbacks",new Zr);const r=this._injector=o0(n,t==null?void 0:t.override),{theme:s,darkMode:i,locale:o,locales:a,logLevel:l}=t;s&&this._injector.get(qr).setTheme(s),i&&this._injector.get(qr).setDarkMode(i),a&&this._injector.get(ln).load(a),o&&this._injector.get(ln).setLocale(o),l&&this._injector.get(Ot).setLogLevel(l),this._init(r)}get _univerInstanceService(){return this._injector.get(Mn)}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(ln).setLocale(t)}createUnit(t,n){return this._univerInstanceService.createUnit(t,n)}createUniverSheet(t){return this._injector.get(Ot).warn("[Univer]","Univer.createUniverSheet is deprecated, use createUnit instead"),this._univerInstanceService.createUnit(Be.UNIVER_SHEET,t)}createUniverDoc(t){return this._injector.get(Ot).warn("[Univer]","Univer.createUniverDoc is deprecated, use createUnit instead"),this._univerInstanceService.createUnit(Be.UNIVER_DOC,t)}createUniverSlide(t){return this._injector.get(Ot).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,Mt),this._univerInstanceService.registerCtorForType(Be.UNIVER_SLIDE,yi);const n=t.get(Mn);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 o0(e,t){const n=Yu([[bu],[ln],[qr],[exports.LifecycleService],[exports.PluginService],[tr],[Mn,{useClass:exports.UniverInstanceService}],[Hu,{useClass:ju}],[Ot,{useClass:Xo,lazy:!0}],[ir,{useClass:exports.CommandService}],[cs,{useClass:exports.LocalUndoRedoService,lazy:!0}],[Ti,{useClass:vu}],[Dn,{useClass:Vo}],[us,{useClass:exports.ResourceManagerService,lazy:!0}],[ti,{useClass:si,lazy:!0}],[Iu,{useClass:exports.AuthzIoLocalService}],[Su,{useClass:exports.MentionIOLocalService,lazy:!0}]],t),r=e?e.createChild(n):new je.Injector(n);return Yo(r,[[tr],[ti]]),r}function ac(e){return e.map(t=>t/255)}function lc(e){return e.map(t=>Math.round(t*255))}const It=[[.333,-.667,-.667,0,1],[-.667,.333,-.667,0,1],[-.667,-.667,.333,0,1],[0,0,0,1,0]];function a0(e){const t=e[0],n=e[1],r=e[2];let s=[It[0][0]*t+It[0][1]*n+It[0][2]*r+It[0][4],It[1][0]*t+It[1][1]*n+It[1][2]*r+It[1][4],It[2][0]*t+It[2][1]*n+It[2][2]*r+It[2][4]];return s=s.map(i=>i>1?1:i<0?0:i),s}function l0(e){return lc(a0(ac(e)))}function u0([e,t,n]){const r=Math.max(e,t,n),s=Math.min(e,t,n),i=(r+s)/2;let o=0,a=0;if(r!==s){const l=r-s;switch(a=i>.5?l/(2-r-s):l/(r+s),r){case e:o=(t-n)/l+(t<n?6:0);break;case t:o=(n-e)/l+2;break;case n:o=(e-t)/l+4;break}o/=6}return[o,a,i]}function Jr(e,t,n){const r=[e,t,n].map(s=>s<=.03928?s/12.92:((s+.055)/1.055)**2.4);return .2126*r[0]+.7152*r[1]+.0722*r[2]}function Ho(e,t){return(Math.max(e,t)+.05)/(Math.min(e,t)+.05)}function c0(e,t,n){let r,s,i;if(t===0)r=s=i=n;else{const o=(u,c,h)=>{let d=h;return d<0&&(d+=1),d>1&&(d-=1),d<.16666666666666666?u+(c-u)*6*d:d<.5?c:d<.6666666666666666?u+(c-u)*(.6666666666666666-d)*6:u},a=n<.5?n*(1+t):n+t-n*t,l=2*n-a;r=o(l,a,e+1/3),s=o(l,a,e),i=o(l,a,e-1/3)}return[r,s,i]}const ys={r:1,g:1,b:1},Ns={r:0,g:0,b:0},h0=Jr(ys.r,ys.g,ys.b),d0=Jr(Ns.r,Ns.g,Ns.b);function f0(e){const t=Jr(e[0],e[1],e[2]),n=Ho(h0,t),r=u0(e);let s=1-r[2],i,o,a;do i=c0(r[0],r[1],s),o=Jr(i[0],i[1],i[2]),a=Ho(o,d0),s+=.01;while(s<=1&&s>=0&&Math.abs(a-n)<.01);return i}function g0(e){return lc(f0(ac(e)))}gc();exports.ABCToNumber=rf;exports.AUTO_HEIGHT_FOR_MERGED_CELLS=Fa;exports.AbsoluteRefType=tt;exports.ActionIterator=Rn;exports.AlignTypeH=ll;exports.AlignTypeV=ul;exports.ArrangeTypeEnum=dl;exports.ArrowsAndMarkersShapes=da;exports.AsyncInterceptorManager=Up;exports.AsyncLock=C_;exports.AutoFillSeries=ta;exports.BaselineOffset=Ft;exports.BasicShapes=ha;exports.BlockType=ja;exports.BooleanNumber=Ie;exports.BorderStyleTypes=Xe;exports.BorderType=na;exports.BuildTextUtils=ot;exports.BulletAlignment=lr;exports.COLORS=Us;exports.CanceledError=Sc;exports.CellModeEnum=Sn;exports.CellValueType=Xt;exports.Color=cn;exports.ColorBuilder=ts;exports.ColorKit=Tt;exports.ColorType=vt;exports.ColumnSeparatorType=za;exports.CommandType=sr;exports.CommonHideTypes=ra;exports.ConfigService=vu;exports.ContextService=Vo;exports.CopyPasteType=sa;exports.CustomCommandExecutionError=Ms;exports.CustomDecorationType=on;exports.CustomRangeType=Zt;exports.DEFAULT_CELL=Ld;exports.DEFAULT_DOC=Oi;exports.DEFAULT_DOCUMENT_SUB_COMPONENT_ID=jp;exports.DEFAULT_EMPTY_DOCUMENT_VALUE=Pa;exports.DEFAULT_RANGE=Md;exports.DEFAULT_RANGE_ARRAY=Nd;exports.DEFAULT_SELECTION=Dd;exports.DEFAULT_SLIDE=_l;exports.DEFAULT_STYLES=ut;exports.DEFAULT_WORKSHEET_COLUMN_COUNT=Du;exports.DEFAULT_WORKSHEET_COLUMN_COUNT_KEY=pE;exports.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT=Pu;exports.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY=IE;exports.DEFAULT_WORKSHEET_COLUMN_WIDTH=xu;exports.DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY=CE;exports.DEFAULT_WORKSHEET_ROW_COUNT=Mu;exports.DEFAULT_WORKSHEET_ROW_COUNT_KEY=_E;exports.DEFAULT_WORKSHEET_ROW_HEIGHT=Lu;exports.DEFAULT_WORKSHEET_ROW_HEIGHT_KEY=EE;exports.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH=Uu;exports.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY=RE;exports.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY=li;exports.DOCS_NORMAL_EDITOR_UNIT_ID_KEY=ai;exports.DOCS_ZEN_EDITOR_UNIT_ID_KEY=Ua;exports.DOC_DRAWING_PRINTING_COMPONENT_KEY=Fd;exports.DOC_RANGE_TYPE=Aa;exports.DashStyleType=Ja;exports.DataStreamTreeNodeType=Sl;exports.DataStreamTreeTokenType=_t;exports.DataValidationErrorStyle=Zu;exports.DataValidationImeMode=Qu;exports.DataValidationOperator=ec;exports.DataValidationRenderMode=tc;exports.DataValidationStatus=nc;exports.DataValidationType=rc;exports.DeleteDirection=ia;exports.DependentOn=BE;exports.DesktopLogService=Xo;exports.DeveloperMetadataVisibility=oa;exports.Dimension=aa;exports.Direction=la;exports.Disposable=st;exports.DisposableCollection=Zr;exports.DocStyleType=$a;exports.DocumentDataModel=Mt;exports.DocumentFlavor=ui;exports.DrawingTypeEnum=fl;exports.EDITOR_ACTIVATED=Ou;exports.EXTENSION_NAMES=pl;exports.ErrorService=bu;exports.EventState=Ru;exports.EventSubject=Wp;exports.FOCUSING_COMMON_DRAWINGS=rE;exports.FOCUSING_DOC=Gn;exports.FOCUSING_EDITOR_BUT_HIDDEN=Jp;exports.FOCUSING_EDITOR_INPUT_FORMULA=Zp;exports.FOCUSING_EDITOR_STANDALONE=eE;exports.FOCUSING_FX_BAR_EDITOR=wu;exports.FOCUSING_PANEL_EDITOR=tE;exports.FOCUSING_SHEET=wn;exports.FOCUSING_SLIDE=Vn;exports.FOCUSING_UNIT=zn;exports.FOCUSING_UNIVER_EDITOR=Qp;exports.FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE=nE;exports.FORMULA_EDITOR_ACTIVATED=sE;exports.FollowNumberWithType=Ha;exports.FontItalic=Hr;exports.FontStyleType=vn;exports.FontWeight=jr;exports.GridType=Wa;exports.HLSColor=Sa;exports.HorizontalAlign=yt;exports.IAuthzIoService=Iu;exports.ICommandService=ir;exports.IConfigService=Ti;exports.IContextService=Dn;exports.IImageIoService=ni;exports.ILocalStorageService=xE;exports.ILogService=Ot;exports.IMentionIOService=Su;exports.IPermissionService=Hu;exports.IResourceLoaderService=ti;exports.IResourceManagerService=us;exports.IS_ROW_STYLE_PRECEDE_COLUMN_STYLE=ka;exports.IUndoRedoService=cs;exports.IUniverInstanceService=Mn;exports.ImageCacheMap=Ju;exports.ImageSourceType=Mi;exports.ImageUploadStatusType=qu;exports.InterceptorEffectEnum=On;exports.InterceptorManager=Dp;exports.InterpolationPointType=ua;exports.JSON1=T_;exports.JSONX=$t;exports.LRUHelper=jn;exports.LRUMap=Zn;exports.LifecycleStages=Je;exports.ListGlyphType=Ne;exports.LocaleService=ln;exports.LocaleType=or;exports.LogLevel=Ko;exports.MOVE_BUFFER_VALUE=Hn;exports.MemoryCursor=fn;exports.MentionType=$r;exports.NAMED_STYLE_MAP=Ud;exports.NAMED_STYLE_SPACE_MAP=Pd;exports.NamedStyleType=rt;exports.NilCommand=qo;exports.NumberUnitType=al;exports.ObjectMatrix=Et;exports.ObjectRelativeFromH=il;exports.ObjectRelativeFromV=ol;exports.OtherShapes=fa;exports.PAGE_SIZE=Bd;exports.PAPER_TYPES=yd;exports.PRESET_LIST_TYPE=dr;exports.PRINT_CHART_COMPONENT_KEY=kd;exports.PageElementType=gl;exports.PageOrientType=hl;exports.PageType=ci;exports.PaperType=pt;exports.ParagraphElementType=Va;exports.ParagraphStyleBuilder=er;exports.ParagraphStyleValue=gr;exports.PermissionService=ju;exports.PermissionStatus=Ni;exports.Plugin=ei;exports.PositionedObjectLayoutType=Xa;exports.PresetListType=Ut;exports.ProtectionType=ca;exports.QuickListType=iu;exports.QuickListTypeMap=x_;exports.RANGE_DIRECTION=ba;exports.RANGE_TYPE=Le;exports.RBush=zr;exports.RCDisposable=bc;exports.RGBA_PAREN=nh;exports.RGB_PAREN=th;exports.ROTATE_BUFFER_VALUE=ea;exports.RTree=n0;exports.Range=Tn;exports.Rectangle=Qt;exports.RedoCommand=Xu;exports.RedoCommandId=Gu;exports.RefAlias=nf;exports.Registry=bi;exports.RegistryAsMap=Ai;exports.RelativeDate=ma;exports.RelativeSlideLink=ml;exports.RgbColor=Wr;exports.RichTextBuilder=an;exports.RichTextValue=Kt;exports.RxDisposable=wc;exports.SHEET_EDITOR_UNITS=xd;exports.SectionType=Ya;exports.SheetTypes=_a;exports.SheetViewModel=Fu;exports.SliceBodyType=vi;exports.SlideDataModel=yi;exports.SpacingRule=qa;exports.SpecialShapes=ga;exports.Styles=Au;exports.THEME_COLORS=Ia;exports.TabStopAlignment=Za;exports.TableAlignmentType=el;exports.TableLayoutType=tl;exports.TableRowHeightRule=rl;exports.TableSizeType=Qa;exports.TableTextWrapType=nl;exports.TextDecoration=pa;exports.TextDecorationBuilder=Vt;exports.TextDirection=Jn;exports.TextDirectionType=Ga;exports.TextStyleBuilder=Jt;exports.TextStyleValue=fr;exports.TextX=Ye;exports.TextXActionType=he;exports.ThemeColor=Yr;exports.ThemeColorType=ft;exports.ThemeColors=es;exports.ThemeService=qr;exports.Tools=ne;exports.UndoCommand=Ku;exports.UndoCommandId=Vu;exports.UnitModel=ls;exports.Univer=i0;exports.UniverInstanceType=Be;exports.UpdateDocsAttributeType=xe;exports.UserManagerService=tr;exports.VerticalAlign=sn;exports.VerticalAlignmentType=sl;exports.Worksheet=nr;exports.WrapStrategy=un;exports.WrapTextType=Ka;exports.addLinkToDocumentModel=Tu;exports.afterInitApply=Pc;exports.afterTime=xc;exports.awaitTime=VE;exports.binSearchFirstGreaterThanTarget=Qo;exports.binarySearchArray=kc;exports.bufferDebounceTime=Lc;exports.cellToRange=Mh;exports.characterSpacingControlType=cl;exports.checkForSubstrings=Lh;exports.checkIfMove=Bc;exports.checkParagraphHasBullet=md;exports.checkParagraphHasIndent=_d;exports.checkParagraphHasIndentByStyle=Da;exports.codeToBlob=Fc;exports.composeBody=Xs;exports.composeInterceptors=Eu;exports.composeStyles=Ls;exports.concatMatrixArray=Rh;exports.convertBodyToHtml=eh;exports.convertCellToRange=Ta;exports.convertObservableToBehaviorSubject=Uc;exports.covertCellValue=$s;exports.covertCellValues=Dh;exports.covertTextRunToHtml=xs;exports.createAsyncInterceptorKey=Lp;exports.createDefaultUser=Xr;exports.createDocumentModelWithStyle=Kn;exports.createInterceptorKey=Mp;exports.createInternalEditorID=Td;exports.createRowColIter=Hs;exports.dayjs=Ht;exports.debounce=i_;exports.dedupe=mc;exports.dedupeBy=_c;exports.deepCompare=oi;exports.delayAnimationFrame=KE;exports.deleteContent=xa;exports.extractPureTextFromCell=Bu;exports.fromCallback=Jo;exports.fromEventSubject=Yp;exports.fromObservable=Oc;exports.generateRandomId=Bt;exports.get=$l;exports.getArrayLength=qt;exports.getBodySlice=Nt;exports.getBodySliceHtml=yr;exports.getBorderStyleType=Th;exports.getCellCoordByIndexSimple=Di;exports.getCellInfoInMergeData=Ch;exports.getCellPositionByIndexSimple=t0;exports.getCellValueType=_h;exports.getCellWithCoordByIndexCore=In;exports.getColorStyle=Lt;exports.getCustomBlockSlice=uu;exports.getCustomDecorationSlice=hu;exports.getCustomRangeSlice=cu;exports.getDocsUpdateBody=yh;exports.getIntersectRange=Cl;exports.getOriginCellValue=vE;exports.getParagraphsSlice=lu;exports.getPlainText=rs;exports.getReverseDirection=$c;exports.getSectionBreakSlice=W_;exports.getTableSlice=au;exports.getTextRunSlice=Kr;exports.getTransformOffsetX=sc;exports.getTransformOffsetY=ic;exports.getWorksheetUID=AE;exports.groupBy=Cc;exports.handleStyleToString=Ah;exports.hashAlgorithm=Ed;exports.horizontalLineSegmentsSubtraction=ns;exports.insertMatrixArray=Ps;exports.insertTextToContent=La;exports.invertColorByHSL=g0;exports.invertColorByMatrix=l0;exports.isBlackColor=gh;exports.isBooleanString=m_;exports.isCellCoverable=Bs;exports.isCellV=wa;exports.isEmptyCell=ya;exports.isFormulaId=bh;exports.isFormulaString=Na;exports.isICellData=Oa;exports.isInternalEditorID=Ba;exports.isNodeEnv=Qc;exports.isNotNullOrUndefined=yu;exports.isNullCell=ph;exports.isNumeric=Cu;exports.isRangesEqual=lE;exports.isRealNum=pd;exports.isSafeNumeric=kp;exports.isSameStyleTextRun=Ma;exports.isUnitRangesEqual=uE;exports.isValidRange=Nh;exports.isWhiteColor=mh;exports.makeArray=Rc;exports.makeCellRangeToRangeData=wh;exports.makeCellToSelection=Oh;exports.makeCustomRangeStream=cf;exports.merge=Ci;exports.mergeOverrideWithDependencies=Yu;exports.mergeSets=$p;exports.mergeWith=u_;exports.mergeWorksheetSnapshotWithDefault=ku;exports.mixinClass=Pp;exports.moveMatrixArray=Fs;exports.moveRangeByOffset=Gd;exports.nameCharacterCheck=GE;exports.normalizeBody=Y_;exports.normalizeTextRuns=hr;exports.numberToABC=of;exports.numberToListABC=af;exports.numfmt=Ad;exports.queryObjectMatrix=tf;exports.registerDependencies=Ic;exports.remove=rr;exports.repeatStringNumTimes=Il;exports.replaceInDocumentBody=Hp;exports.requestImmediateMacroTask=Bp;exports.rotate=Ec;exports.searchArray=$n;exports.searchInOrderedArray=Zo;exports.selectionToArray=Eh;exports.sequence=Go;exports.sequenceAsync=zo;exports.sequenceExecute=Qr;exports.sequenceExecuteAsync=Dc;exports.set=h_;exports.shallowEqual=Yl;exports.skipParseTagNames=XE;exports.sliceMatrixArray=Ih;exports.sortRules=lf;exports.sortRulesByDesc=uf;exports.sortRulesFactory=ur;exports.spliceArray=ks;exports.splitIntoGrid=hi;exports.takeAfter=Ds;exports.textDiff=Ri;exports.throttle=Np;exports.toDisposable=nt;exports.touchDependencies=Yo;exports.updateAttributeByDelete=du;exports.updateAttributeByInsert=fu;exports.willLoseNumericPrecision=Fp;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 gd=Object.defineProperty;var _d=(e,t,n)=>t in e?gd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var E=(e,t,n)=>_d(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ce=require("rxjs"),os=require("rxjs/operators"),Ae=require("@wendellhu/redi"),da=require("@univerjs/themes");function pd(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 Vr=typeof global<"u"?global:typeof self<"u"?self:window;function Ed(){const t=new Map;let n=0;typeof Vr.requestIdleCallback!="function"&&(Vr.requestIdleCallback=function(s){const i=Date.now(),o=++n,a=setTimeout(function(){t.delete(o);const c=Math.max(0,50-(Date.now()-i));s({didTimeout:c===0,timeRemaining(){return c}})},1);return t.set(o,a),o}),typeof Vr.cancelIdleCallback!="function"&&(Vr.cancelIdleCallback=function(s){const i=t.get(s);i!==void 0&&(clearTimeout(i),t.delete(s))})}function Cd(){Ed()}function Lr(e,t){const n=e.indexOf(t);return n>-1?(e.splice(n,1),!0):!1}function Rd(e){const t=new Set,n=[];for(const r of e)t.has(r)||(t.add(r),n.push(r));return n}function Id(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 Sd(e,t){for(let n=e.length-1;n>-1;n--){const r=e[n];if(t(r,n))return r}return null}function Od(e,t){if(e.length===0)return e;const n=t%e.length;return e.slice(n).concat(e.slice(0,n))}function vd(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 wd(e){return Array.isArray(e)?e:[e]}function bd(e,t){t.forEach(n=>e.add(n))}function Nl(e,t){t.forEach(([n])=>{e.has(n)&&e.get(n)})}class Oi extends Error{constructor(t){super(t),this.name="CustomCommandExecutionError"}}class Ad extends Error{constructor(){super("Canceled by facade"),this.name="CanceledError"}}async function Ml(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 Dl(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 Td(e){return e instanceof ce.Subscription||e instanceof ce.Subject||e&&"closed"in e&&typeof e.unsubscribe<"u"}function je(e){let t=!1;return e?Td(e)?{dispose:()=>e.unsubscribe()}:typeof e=="function"?{dispose:()=>{t||(t=!0,e())}}:e:je(()=>{})}function yd(e){return je(()=>{e.unsubscribe()})}class xs{constructor(){E(this,"_disposables",new Set)}add(t){const n=je(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 Ke{constructor(){E(this,"_disposed",!1);E(this,"_collection",new xs)}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 Nd extends Ke{constructor(){super(...arguments);E(this,"dispose$",new ce.Subject)}dispose(){super.dispose(),this.dispose$.next(),this.dispose$.complete()}}class Md extends Ke{constructor(n){super();E(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 Xn=Ae.createIdentifier("univer.context-service");class Ll extends Ke{constructor(){super(...arguments);E(this,"_contextChanged$",new ce.Subject);E(this,"contextChanged$",this._contextChanged$.asObservable());E(this,"_contextMap",new Map)}dispose(){super.dispose(),this._contextChanged$.complete(),this._contextMap.clear()}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 ce.Observable(r=>{const s=this._contextChanged$.pipe(ce.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 xl=(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))(xl||{});const pt=Ae.createIdentifier("univer.log");class Ul extends Ke{constructor(){super(...arguments);E(this,"_logLevel",3);E(this,"_deduction",new Set)}dispose(){super.dispose(),this._logLevel=3,this._deduction.clear()}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=Dd(...r);this._deduction.has(s)||(this._deduction.add(s),this._log(n,...r))}}function Dd(...e){return e.map(t=>JSON.stringify(t)).join("")}var Ld=Object.getOwnPropertyDescriptor,xd=(e,t,n,r)=>{for(var s=r>1?void 0:r?Ld(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},fa=(e,t)=>(n,r)=>t(n,r,e),xr=(e=>(e[e.COMMAND=0]="COMMAND",e[e.OPERATION=1]="OPERATION",e[e.MUTATION=2]="MUTATION",e))(xr||{});const Ur=Ae.createIdentifier("univer.core.command-service");class Ud{constructor(){E(this,"_commands",new Map);E(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),je(()=>{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 Pl={id:"nil",type:0,handler:()=>!0};exports.CommandService=class extends Ke{constructor(n,r){super();E(this,"_commandRegistry");E(this,"_beforeCommandExecutionListeners",[]);E(this,"_commandExecutedListeners",[]);E(this,"_multiCommandDisposables",new Map);E(this,"_commandExecutingLevel",0);E(this,"_commandExecutionStack",[]);this._injector=n,this._logService=r,this._commandRegistry=new Ud,this.registerCommand(Pl)}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),je(()=>{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),je(()=>{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(u=>u(a,s));const c=await this._execute(o,r,s);return this._commandExecutedListeners.forEach(u=>u(a,s)),l.dispose(),c}throw new Error(`[CommandService]: command "${n}" is not registered.`)}catch(i){if(i instanceof Oi)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=Sd(this._commandExecutionStack,d=>d.type===0);h&&(l.params=(i=l.params)!=null?i:{},l.params.trigger=h.id)}const c=this._pushCommandExecutionStack(l);this._beforeCommandExecutionListeners.forEach(h=>h(l,s));const u=this._syncExecute(a,r,s);return this._commandExecutedListeners.forEach(h=>h(l,s)),c.dispose(),u}throw new Error(`[CommandService]: command "${n}" is not registered.`)}catch(o){if(o instanceof Oi)return!1;throw o}}_pushCommandExecutionStack(n){return this._commandExecutionStack.push(n),je(()=>Lr(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 Pd(n.id);const o=new xs;o.add(this._commandRegistry.registerCommand(s)),o.add(je(()=>{this._multiCommandDisposables.delete(n.id)})),this._multiCommandDisposables.set(n.id,o)}const i=s.registerImplementation(n);return je(()=>{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=xd([fa(0,Ae.Inject(Ae.Injector)),fa(1,pt)],exports.CommandService);class Pd{constructor(t){E(this,"name");E(this,"multi",!0);E(this,"type",0);E(this,"priority",0);E(this,"_implementations",[]);E(this,"handler",async(t,n)=>{if(!this._implementations.length)return!1;const r=t.get(pt),s=t.get(Xn),i=t.get(Ae.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),je(()=>{const r=this._implementations.indexOf(n);this._implementations.splice(r,1)})}hasImplementations(){return this._implementations.length>0}}function Us(e,t,n){const r=e.map(s=>()=>t.syncExecuteCommand(s.id,s.params,n));return Dl(r)}function kd(e,t,n){const r=e.map(s=>()=>t.executeCommand(s.id,s.params,n));return Ml(r)}function kl(e){return new ce.Observable(t=>{const n=e((...r)=>t.next(r));return()=>n==null?void 0:n.dispose()})}function vi(e){return function(n){return new ce.Observable(r=>(n.subscribe({next:s=>{r.next(s),e(s)&&r.complete()},complete:()=>r.complete(),error:s=>r.error(s)}),()=>r.unsubscribe()))}}function Fd(e=0){return t=>{let n=[];return t.pipe(ce.tap(r=>n.push(r)),ce.debounceTime(e),ce.map(()=>n),ce.tap(()=>n=[]))}}function Bd(e){const t=new ce.ReplaySubject(1);return setTimeout(()=>t.next(),e),t.pipe(ce.take(1))}function $d(e,t){const n=new ce.BehaviorSubject(t);return e.subscribe(n),n}const Hd=e=>new Promise(t=>{ce.merge(kl(e.onCommandExecuted.bind(e)).pipe(os.filter(([n])=>n.type===xr.MUTATION)),ce.timer(300)).pipe(os.debounceTime(16),os.first()).subscribe(()=>{t()})});function Fl(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 jd(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 Bl(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 or(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=Fl(e,t):r=Bl(e,t),n){const s=e[r];return e.indexOf(s)}return r}function Wd(e){const t=new Blob([e],{type:"text/javascript"});return window.URL.createObjectURL(t)}const ar=2,$l=1;function Yd(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:c=0,width:u=0,angle:h=0}=e,d=u,f=c,g=i,p=s;return Math.abs(a-n)>ar||Math.abs(l-r)>ar||Math.abs(d-g)>ar||Math.abs(f-p)>ar||Math.abs(h-o)>$l}var Hl=(e=>(e[e.DEFAULT_SERIES=0]="DEFAULT_SERIES",e[e.ALTERNATE_SERIES=1]="ALTERNATE_SERIES",e))(Hl||{}),De=(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))(De||{}),jl=(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))(jl||{}),_t=(e=>(e[e.UNSUPPORTED=0]="UNSUPPORTED",e[e.RGB=1]="RGB",e[e.HEX=2]="HEX",e[e.THEME=3]="THEME",e))(_t||{}),Wl=(e=>(e[e.ON=0]="ON",e[e.OFF=1]="OFF",e))(Wl||{}),Yl=(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))(Yl||{}),Gl=(e=>(e[e.LEFT=0]="LEFT",e[e.RIGHT=1]="RIGHT",e))(Gl||{}),Vl=(e=>(e[e.DOCUMENT=0]="DOCUMENT",e[e.PROJECT=1]="PROJECT",e))(Vl||{}),zl=(e=>(e[e.COLUMNS=0]="COLUMNS",e[e.ROWS=1]="ROWS",e))(zl||{}),Kl=(e=>(e[e.UP=0]="UP",e[e.RIGHT=1]="RIGHT",e[e.DOWN=2]="DOWN",e[e.LEFT=3]="LEFT",e))(Kl||{});function Gd(e){switch(e){case 3:return 1;case 1:return 3;case 0:return 2;case 2:return 0}}var Xl=(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))(Xl||{}),Pr=(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))(Pr||{}),Rs=(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))(Rs||{}),ql=(e=>(e[e.RANGE=0]="RANGE",e[e.SHEET=1]="SHEET",e))(ql||{}),Zl=(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))(Zl||{}),Jl=(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))(Jl||{}),Ql=(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))(Ql||{}),ec=(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))(ec||{}),tc=(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))(tc||{}),nc=(e=>(e[e.GRID=0]="GRID",e[e.KANBAN=1]="KANBAN",e[e.GANTT=2]="GANTT",e))(nc||{}),wr=(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))(wr||{}),rc=(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))(rc||{}),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||{}),gn=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TOP=1]="TOP",e[e.MIDDLE=2]="MIDDLE",e[e.BOTTOM=3]="BOTTOM",e))(gn||{}),Cn=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.OVERFLOW=1]="OVERFLOW",e[e.CLIP=2]="CLIP",e[e.WRAP=3]="WRAP",e))(Cn||{}),Is=(e=>(e[e.NORMAL=0]="NORMAL",e[e.ITALIC=1]="ITALIC",e))(Is||{}),Ss=(e=>(e[e.NORMAL=0]="NORMAL",e[e.BOLD=1]="BOLD",e))(Ss||{}),jt=(e=>(e[e.NORMAL=1]="NORMAL",e[e.SUBSCRIPT=2]="SUBSCRIPT",e[e.SUPERSCRIPT=3]="SUPERSCRIPT",e))(jt||{}),ie=(e=>(e[e.FALSE=0]="FALSE",e[e.TRUE=1]="TRUE",e))(ie||{}),Qt=(e=>(e[e.STRING=1]="STRING",e[e.NUMBER=2]="NUMBER",e[e.BOOLEAN=3]="BOOLEAN",e[e.FORCE_STRING=4]="FORCE_STRING",e))(Qt||{}),st=(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))(st||{}),Ps=(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))(Ps||{});const Vd="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let zd=e=>crypto.getRandomValues(new Uint8Array(e)),Kd=(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}}},Xd=(e,t=21)=>Kd(e,t|0,zd),qd=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=Vd[n[e]&63];return t};const sc=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"]),Zd=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 Jd(e){if(!Number.isNaN(+e))return!1;if(e.startsWith("http://localhost:3002")||e.startsWith("localhost:3002"))return!0;if(Zd.test(e)){if(ic(e))return!0;try{const r=new URL(oc(e)).hostname.split(".").pop();if(r&&sc.has(r))return!0}catch{return!1}}return!1}function ic(e){return/^[a-zA-Z]+:\/\//.test(e)}function Qd(e){return/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(e)}function oc(e){return ic(e)?e:Qd(e)?`mailto://${e}`:`https://${e}`}const ef=/^-ms-/,tf=/-([a-z])/g,Xt=["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 ro(e,t){const n=z.getValueType(e),r=z.getValueType(t);return n!==r?!1:z.isArray(e)?nf(e,t):z.isObject(e)?rf(e,t):z.isDate(e)?e.getTime()===t.getTime():z.isRegExp(e)?e.toString()===t.toString():e===t}function nf(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(!ro(s,i))return!1}return!0}function rf(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(!ro(i,o))return!1}return!0}class z{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>=Xt.length;)r/=Xt.length,r-=1,n+=Xt[r%Xt.length];const s=t%Xt.length;return n+=Xt[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+=Xt.length**i+Xt.length*s}return n+=t.charCodeAt(t.length-1)-65,n}static deleteBlank(t){return z.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 u=Number.parseFloat(RegExp.$1);return u===7?"IE7":u===8?"IE8":u===9?"IE9":u===10?"IE10":"0"}return o?"FF":n?"Opera":a?"Safari":l?"Chrome":i?"Edge":s?"IE11":"Unknown browser"}static generateRandomId(t=21,n){return Wt(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,c)=>{var u,h;if(z.isArray(l)){const d=(u=a[c])!=null?u:[];a[c]=d,r(l,d);return}if(z.isObject(l)){const d=(h=a[c])!=null?h:{};a[c]=d,s(l,d);return}a[c]=l})}function s(o,a){Object.keys(o).forEach(l=>{var u,h;const c=o[l];if(z.isObject(c)){const d=(u=a[l])!=null?u:{};a[l]=d,s(c,d);return}if(z.isArray(c)){const d=(h=a[l])!=null?h:[];a[l]=d,r(c,d);return}a[l]=c})}function i(o){Object.keys(o).forEach(a=>{var c,u;const l=o[a];if(z.isArray(l)){const h=(c=t[a])!=null?c:[];t[a]=h,r(l,h);return}if(z.isObject(l)){const h=(u=t[a])!=null?u:{};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 ro(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]=z.deepClone(r)}),n}if(this.isObject(t)){const n={};return Object.keys(t).forEach(r=>{const s=t[r];n[r]=z.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 Jd(t)}static normalizeUrl(t){return oc(t)}static topLevelDomainCombiningString(){return[...sc].join("|")}static itCount(t){return n=>{for(let r=0;r<t;r++)n&&n()}}static hasLength(t,n){return z.isDefine(t)?z.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(ef,"ms-").replace(tf,this.fCamelCase)}static removeNull(t){return this.isObject(t)&&Object.keys(t).forEach(n=>{const r=t[n];r==null?delete t[n]:z.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 Wt(e=21,t){return t?Xd(t,e)():qd(e)}function wi(...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 sf=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null;function as(e,t,n){const{dataStream:r,textRuns:s=[]}=e;let i=t;const o=[];for(const a of s){const{st:l,ed:c}=a;z.hasIntersectionBetweenTwoRanges(t,n,l,c)&&(l>i?(o.push(r.slice(i,l)),o.push(bi(r,{...a,ed:Math.min(c,n)}))):o.push(bi(r,{...a,st:i,ed:Math.min(c,n)}))),i=Math.max(t,Math.min(c,n))}return i!==n&&o.push(r.slice(i,n)),o.join("")}function of(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:c={}}=a,{spaceAbove:u,spaceBelow:h,lineSpacing:d}=c,f=[];u!=null&&(typeof u=="number"?f.push(`margin-top: ${u}px`):f.push(`margin-top: ${u.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("; ")};"`:""}>${as(e,o+1,l)}</p>`:i+=`<p class="UniverNormal" ${f.length?`style="${f.join("; ")};"`:""}></p>`,o=l}return o!==r.length&&(i+=as(e,o,r.length)),i}else return as(e,0,e.dataStream.length)}function bi(e,t){const{st:n,ed:r,ts:s={}}=t,{ff:i,fs:o,it:a,bl:l,ul:c,st:u,ol:h,bg:d,cl:f,va:g}=s;let p=e.slice(n,r);const R=[];return a===ie.TRUE&&(p=`<i>${p}</i>`),g===jt.SUPERSCRIPT?p=`<sup>${p}</sup>`:g===jt.SUBSCRIPT&&(p=`<sub>${p}</sub>`),(c==null?void 0:c.s)===ie.TRUE&&(p=`<u>${p}</u>`),(u==null?void 0:u.s)===ie.TRUE&&(p=`<s>${p}</s>`),l===ie.TRUE&&(p=`<strong>${p}</strong>`),i&&R.push(`font-family: ${i}`),f&&R.push(`color: ${f.rgb}`),o&&R.push(`font-size: ${o}pt`),h&&R.push("text-decoration: overline"),d&&R.push(`background: ${d.rgb}`),R.length?`<span style="${R.join("; ")};">${p}</span>`:p}const ac={[Ps.OFFICE]:{[st.ACCENT1]:"#4472C4",[st.ACCENT2]:"#ED7D31",[st.ACCENT3]:"#A5A5A5",[st.ACCENT4]:"#70AD47",[st.ACCENT5]:"#5B9BD5",[st.ACCENT6]:"#70AD47",[st.DARK1]:"#000000",[st.DARK2]:"#44546A",[st.LIGHT1]:"#FFFFFF",[st.LIGHT2]:"#E7E6E6",[st.HYPERLINK]:"#0563C1",[st.FOLLOWED_HYPERLINK]:"#954F72"}};class ks{constructor(){E(this,"_themeValue",st.LIGHT1);E(this,"_themeColors");E(this,"_themeTint");E(this,"_rgbValue","");E(this,"_colorType");this._colorType=_t.UNSUPPORTED,this._themeColors=Ps.OFFICE,this._themeTint=0}asRgbColor(){return new Os(this._rgbValue,this)}asThemeColor(){return new vs(this._themeValue,this._themeTint,this._themeColors,this)}build(){switch(this._colorType){case _t.THEME:return this.asThemeColor();case _t.RGB:return this.asRgbColor();case _t.UNSUPPORTED:throw new Error("unsupported color type")}}setRgbColor(t){return this._colorType=_t.RGB,this._rgbValue=t,this}setThemeColors(t){this._colorType=_t.THEME,this._themeColors=t}setThemeTint(t){this._colorType=_t.THEME,this._themeTint=t}setThemeColor(t){return this._colorType=_t.THEME,this._themeValue=t,this}getColorType(){return this._colorType}}class Rn{constructor(t){E(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 ks().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 Rn(this._builder)}equals(t){return!1}}class lc{constructor(t){E(this,"_saturation",0);E(this,"_hue",0);E(this,"_lightness",0);E(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 ks;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,c=this.setColor(n,r,l);return t.setRgbColor(`rgba(${Math.round(o*255)},${Math.round(a*255)},${Math.round(c*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 gt=class gt extends Rn{constructor(n,r){super(r);E(this,"_cssString");E(this,"_red");E(this,"_green");E(this,"_blue");E(this,"_alpha");let s=n.match(gt.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(gt.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 Rn.rgbColorToHexValue(this)}getRed(){let n=this._red+gt.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getGreen(){let n=this._green+gt.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getBlue(){let n=this._blue+gt.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getAlpha(){return this._alpha}getColorType(){return _t.RGB}clone(){return new gt(this._cssString,this._builder)}asThemeColor(){throw new Error("rgb color not support to themeColor")}equals(n){return n instanceof gt?n._red===this._red&&n._blue===this._blue&&n._green===this._green&&n._alpha===this._alpha:!1}getCssString(){return this._cssString}};E(gt,"RGB_COLOR_AMT",0),E(gt,"RGBA_EXTRACT",new RegExp("\\s*rgba\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d.\\d|\\d\\s*)\\)\\s*")),E(gt,"RGB_EXTRACT",new RegExp("\\s*rgb\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*)\\)\\s*"));let Os=gt;const qt=class qt extends Rn{constructor(n,r,s,i){super(i);E(this,"_themeColorType");E(this,"_themeTint");E(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=ac[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(qt._cacheThemeColor.has(this._themeColors)){if(s=qt._cacheThemeColor.get(this._themeColors),s.has(this._themeColorType))return s.get(this._themeColorType)}else s=new Map,qt._cacheThemeColor.set(this._themeColors,s);const i=new lc(Rn.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 qt(this._themeColorType,this._themeTint,this._themeColors,this._builder)}equals(n){return n instanceof qt?n._themeColorType===this._themeColorType:!1}getColorType(){return _t.THEME}getThemeColorType(){return this._themeColorType}};E(qt,"_cacheThemeColor",new Map);let vs=qt;const af="rgb(",lf="rgba(",Ai={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 bt{constructor(t){E(this,"_color");E(this,"_rgbColor");E(this,"_isValid",!1);if(t==null){this._setNullColor();return}if(t instanceof bt){this._color={...t._color},this._rgbColor={...t._rgbColor};return}const n=cc(t);if(n==null){this._setNullColor();return}this._color=n;const r=ff(this._color);if(r==null){this._setNullColor();return}this._rgbColor=r,this._isValid=!0}static mix(t,n,r){var c,u;r=Math.min(1,Math.max(0,r));const s=new bt(t).toRgb(),i=new bt(n).toRgb(),o=(c=s.a)!=null?c:1,a=(u=i.a)!=null?u: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 bt(l)}static getContrastRatio(t,n){const r=new bt(t).getLuminance(),s=new bt(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=[zr(Math.round(n).toString(16)),zr(Math.round(r).toString(16)),zr(Math.round(s).toString(16)),zr(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 pf(this.toRgb())}toHsl(){return _f(this.toRgb())}lighten(t=10){const n=this.toHsl();return n.l+=t,n.l=Math.min(Math.max(n.l,0),100),new bt(n)}darken(t=10){const n=this.toHsl();return n.l-=t,n.l=Math.min(Math.max(n.l,0),100),new bt(n)}setAlpha(t){return new bt({...this._rgbColor,a:t})}getLuminance(){let{r:t,g:n,b:r}=this.toRgb();return t=Zs(t),n=Zs(n),r=Zs(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 zr=e=>e.length===1?`0${e}`:e,Zs=e=>(e/=255,e<=.03928?e/12.92:((e+.055)/1.055)**2.4),cc=e=>{if(Cf(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(Ai[t]){const n=Ai[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 cf(t);if(t.startsWith("rgb"))return uf(t);if(t.startsWith("hsl"))return hf(t);if(t.startsWith("hsv"))return df(t)},cf=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},uf=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},hf=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},df=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},ff=e=>{const t=cc(e);if(t!=null)return"r"in t?t:"l"in t?mf(t):gf(t)},Js=(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),mf=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,c=2*r-l;s=Js(c,l,t+1/3),i=Js(c,l,t),o=Js(c,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},gf=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),c=s%6,u=[r,a,o,o,l,r][c],h=[l,r,r,a,o,o][c],d=[o,o,l,r,r,a][c],f={r:u*255,g:h*255,b:d*255};return e.a!==void 0&&(f.a=e.a),f},_f=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 u=s-i;switch(l=o>.5?u/(2-s-i):u/(s+i),s){case t:a=(n-r)/u+(n<r?6:0);break;case n:a=(r-t)/u+2;break;default:a=(t-n)/u+4;break}a/=6}const c={h:Math.round(a*360),s:Math.round(l*100),l:Math.round(o*100)};return e.a!==void 0&&(c.a=e.a),c},pf=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,c=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 u={h:Math.round(o*360),s:Math.round(c*100),v:Math.round(a*100)};return e.a!==void 0&&(u.a=e.a),u},Ef=e=>e==null,Cf=e=>!Ef(e)&&typeof e=="object";function Rf(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 If(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 Ee=(e=>(e[e.COVER=0]="COVER",e[e.REPLACE=1]="REPLACE",e))(Ee||{});function uc(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 Sf(e){if(e.t!==void 0)return e.t;if(typeof e.v=="string")return Qt.STRING;if(typeof e.v=="number")return Qt.NUMBER;if(typeof e.v=="boolean")return Qt.BOOLEAN}function Of(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 hc(e){return e!=null&&(typeof e=="string"||typeof e=="number"||typeof e=="boolean")}var _e=(e=>(e[e.NORMAL=0]="NORMAL",e[e.ROW=1]="ROW",e[e.COLUMN=2]="COLUMN",e[e.ALL=3]="ALL",e))(_e||{}),Ge=(e=>(e[e.NONE=0]="NONE",e[e.ROW=1]="ROW",e[e.COLUMN=2]="COLUMN",e[e.ALL=3]="ALL",e))(Ge||{});function vf(e){return[e.startRow,e.startColumn,e.endRow,e.endColumn]}var dc=(e=>(e.NONE="none",e.BACKWARD="backward",e.FORWARD="forward",e))(dc||{}),fc=(e=>(e.RECT="RECT",e.TEXT="TEXT",e))(fc||{});function wf(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 c=0;c<n.length;c++){const{startRow:u,endRow:h,startColumn:d,endColumn:f}=n[c];if(e===u&&t===d){i=h,o=f,a=u,l=d,s=!0;break}if(e>=u&&e<=h&&t>=d&&t<=f){i=h,o=f,a=u,l=d,r=!0;break}}return{actualRow:e,actualColumn:t,isMergedMainCell:s,isMerged:r,endRow:i,endColumn:o,startRow:a,startColumn:l}}var Un=(e=>(e.Raw="raw",e.Intercepted="intercepted",e.Both="both",e))(Un||{});function bf(e,t){const n={};for(const r in e){const s=Number(r),i=e[s];for(const o in i){const a=Number(o),l=i[a],c=t(s,a,l);c!==void 0&&(n[s]?n[s][a]=c:n[s]={[a]:c})}}return n}function en(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 Ti(e,t,n){const r=en(n),s=n;for(let i=r-1;i>=e;i--)s[i+1]=s[i];s[e]=t}function yi(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 Af(e,t){const n=e,r=Object.keys(n),s=r.length,i=t,o=Object.keys(i),a=o.length,l={};let c=0;for(let u=0;u<s;u++,c++){const h=r[u];l[c]=n[h]}for(let u=0;u<a;u++,c++){const h=o[u];l[c]=i[h]}return l}function Tf(e,t,n){const r=n;if(en(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 Ni(e,t,n,r){const s=e>n;if(!s&&e+t>n)throw new Error("Invalid move operation");s?yf(e,t,n,r):Nf(e,t,n,r)}function yf(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 Nf(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 ht{constructor(t={}){E(this,"_matrix");this._setOriginValue(t)}static MakeObjectMatrixSize(t){return new ht({[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){Ni(t,n,r,this._matrix)}moveColumns(t,n,r){this.forEach((s,i)=>{Ni(t,n,r,i)})}insertRows(t,n){for(let r=t;r<t+n;r++)Ti(r,{},this._matrix)}insertColumns(t,n){for(let r=t;r<t+n;r++)this.forEach((s,i)=>{i&&Ti(r,void 0,i)})}removeRows(t,n){yi(t,n,this._matrix)}removeColumns(t,n){this.forEach((r,s)=>{s&&yi(t,n,s)})}getFragment(t,n,r,s){const i=new ht;let o=0;for(let a=t;a<=n;a++){const l={};let c=0;for(let u=r;u<=s;u++){const h=this.getValue(a,u);l[c]=h,c++}i.setRow(o,l),o++}return i}getSlice(t,n,r,s){const i=new ht;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,z.deepClone(l))}return i}getSizeOf(){return Object.keys(this._matrix).length}getLength(){return en(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=en(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 ht;return this.forEach((o,a)=>{r||(r=!0,t=o),Object.keys(a).forEach(l=>{const c=Number(l);s?c<n&&(n=c):(s=!0,n=c);const u=this.getValue(o,c);i.setValue(o-t,c-n,u)})}),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 c=en(l)-1;c>r&&(r=c),Object.keys(l).forEach(u=>{const h=Number(u);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}merge(t){this.forValue((n,r)=>{const s=t.getValue(n,r);s!=null&&this.setValue(n,r,s)})}_setOriginValue(t={}){this._matrix=t}}function mc(e){const{actualRow:t,actualColumn:n,isMerged:r,isMergedMainCell:s,mergeInfo:i}=e;let{startY:o,endY:a,startX:l,endX:c}=e,u=t,h=n,d=t,f=n;if(r&&i){const{startRow:g,startColumn:p,endRow:R,endColumn:b,startY:$,endY:k,startX:W,endX:O}=i;u=g,h=p,d=R,f=b,o=$,a=k,l=W,c=O}return s&&(o=i.startY,a=i.endY,l=i.startX,c=i.endX,d=i.endRow,f=i.endColumn),{startRow:u,startColumn:h,endRow:d,endColumn:f,startY:o,endY:a,startX:l,endX:c}}const Mf=mc;function Df(e){if(!e)return;const{actualRow:t,actualColumn:n,isMerged:r,isMergedMainCell:s,startRow:i,startColumn:o,endRow:a,endColumn:l}=e;let c=t,u=n,h=t,d=n;return(r||s)&&(c=i,u=o,h=a,d=l),{startRow:c,startColumn:u,endRow:h,endColumn:d}}function gc(e){var n;return!e||(((n=e==null?void 0:e.v)==null?void 0:n.toString())||"").length===0&&!e.p}function Mi(e){return gc(e)&&(e==null?void 0:e.coverable)!==!1}function Dt(e){if(e){if(e.rgb)return e.rgb;if(e.th)return new ks().setThemeColor(e.th).asThemeColor().asRgbColor().getCssString()}return null}function _c(e){return z.isString(e)&&e.substring(0,1)==="="&&e.length>1}function Lf(e){return z.isString(e)&&e.length>0}function xf(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,c,u,h,d,f,g,p,R,b;(o=e.bd)!=null&&o.b&&(n+=`border-bottom: ${Kr((a=e.bd)==null?void 0:a.b.s)} ${(l=Dt(e.bd.b.cl))!=null?l:""}; `),(c=e.bd)!=null&&c.t&&(n+=`border-top: ${Kr((u=e.bd)==null?void 0:u.t.s)} ${(h=Dt(e.bd.t.cl))!=null?h:""}; `),(d=e.bd)!=null&&d.r&&(n+=`border-right: ${Kr((f=e.bd)==null?void 0:f.r.s)} ${(g=Dt(e.bd.r.cl))!=null?g:""}; `),(p=e.bd)!=null&&p.l&&(n+=`border-left: ${Kr((R=e.bd)==null?void 0:R.l.s)} ${(b=Dt(e.bd.l.cl))!=null?b:""}; `)}],["cl",()=>{e.cl&&(n+=`color: ${Dt(e.cl)}; `)}],["va",()=>{e.va===jt.SUBSCRIPT?n+="vertical-align: sub; ":e.va===jt.SUPERSCRIPT&&(n+="vertical-align: super; ")}],["td",()=>{e.td===wr.LEFT_TO_RIGHT?n+="direction: ltr; ":e.td===wr.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===gn.BOTTOM?n+="vertical-align: bottom; ":e.vt===gn.TOP?n+="vertical-align: top; ":e.vt===gn.MIDDLE&&(n+="vertical-align: middle; ")}],["tb",()=>{e.tb===Cn.CLIP?n+="white-space: nowrap; overflow-x: hidden; ":e.tb===Cn.WRAP&&(n+="white-space: normal;")}],["pd",()=>{var u,h,d,f,g,p,R,b;const o=`${(u=e.pd)==null?void 0:u.b}pt`,a=`${(h=e.pd)==null?void 0:h.t}pt`,l=`${(d=e.pd)==null?void 0:d.l}pt`,c=`${(f=e.pd)==null?void 0:f.r}pt`;(g=e.pd)!=null&&g.b&&(n+=`padding-bottom: ${o}; `),(p=e.pd)!=null&&p.t&&(n+=`padding-top: ${a}; `),(R=e.pd)!=null&&R.l&&(n+=`padding-left: ${l}; `),(b=e.pd)!=null&&b.r&&(n+=`padding-right: ${c}; `)}]]),s=["bd","tr","tb"];for(const o in e)t&&s.includes(o)||(i=r.get(o))==null||i();return n}function Kr(e){let t="";return e===De.NONE?t="none":e===De.THIN?t="0.5pt solid":e===De.HAIR?t="0.5pt double":e===De.DOTTED?t="0.5pt dotted":e===De.DASHED||e===De.DASH_DOT?t="0.5pt dashed":e===De.DASH_DOT_DOT?t="0.5pt dotted":e===De.DOUBLE?t="0.5pt double":e===De.MEDIUM?t="1pt solid":e===De.MEDIUM_DASHED||e===De.MEDIUM_DASH_DOT?t="1pt dashed":e===De.MEDIUM_DASH_DOT_DOT?t="1pt dotted":e===De.SLANT_DASH_DOT?t="0.5pt dashed":e===De.THICK&&(t="1.5pt solid"),t}function Uf(e){let t=0;if(e=e.trim(),e==="none")t=De.NONE;else if(e==="0.5pt solid")t=De.THIN;else if(e==="0.5pt double")t=De.HAIR;else if(e==="0.5pt dotted")t=De.DOTTED;else if(e==="0.5pt dashed")t=De.DASHED;else if(e==="1pt solid")t=De.MEDIUM;else if(e==="1pt dashed")t=De.MEDIUM_DASHED;else if(e==="1pt dotted")t=De.MEDIUM_DASH_DOT_DOT;else if(e==="1.5pt solid")t=De.THICK;else if(!e.includes("none"))t=De.THIN;else return De.NONE;return t}function Pf(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 kf(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===_e.COLUMN||!(Number.isNaN(s)&&Number.isNaN(i))&&o===_e.ROW||o!==_e.ROW&&o!==_e.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 Ff(e,t){return{startRow:e,endRow:e,startColumn:t,endColumn:t}}function Di(e){return _c(e)?{f:e,v:null,p:null}:hc(e)?{v:e,p:null,f:null}:(uc(e),e)}function Bf(e,t){const n=new ht,{startRow:r,startColumn:s,endRow:i,endColumn:o}=t;if(z.isArray(e))for(let a=0;a<=i-r;a++)for(let l=0;l<=o-s;l++)n.setValue(a+r,l+s,Di(e[a][l]));else new ht(e).forValue((l,c,u)=>{n.setValue(l,c,Di(u))});return n.getMatrix()}function so(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=>so(e[n],t[n])):e===t:!1}function pc(e,t){const n=e.ts||{},r=t.ts||{};return e.sId!==t.sId?!1:so(n,r)}function $f(e,t){return t.some(n=>e.indexOf(n)>-1)}function Rt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ls={exports:{}},Hf=ls.exports,ma;function jf(){return ma||(ma=1,function(e,t){(function(n,r){e.exports=r()})(Hf,function(){var n=1e3,r=6e4,s=36e5,i="millisecond",o="second",a="minute",l="hour",c="day",u="week",h="month",d="quarter",f="year",g="date",p="Invalid Date",R=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,b=/\[([^\]]+)]|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,$={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(N){var A=["th","st","nd","rd"],v=N%100;return"["+N+(A[(v-20)%10]||A[v]||A[0])+"]"}},k=function(N,A,v){var y=String(N);return!y||y.length>=A?N:""+Array(A+1-y.length).join(v)+N},W={s:k,z:function(N){var A=-N.utcOffset(),v=Math.abs(A),y=Math.floor(v/60),M=v%60;return(A<=0?"+":"-")+k(y,2,"0")+":"+k(M,2,"0")},m:function N(A,v){if(A.date()<v.date())return-N(v,A);var y=12*(v.year()-A.year())+(v.month()-A.month()),M=A.clone().add(y,h),D=v-M<0,P=A.clone().add(y+(D?-1:1),h);return+(-(y+(v-M)/(D?M-P:P-M))||0)},a:function(N){return N<0?Math.ceil(N)||0:Math.floor(N)},p:function(N){return{M:h,y:f,w:u,d:c,D:g,h:l,m:a,s:o,ms:i,Q:d}[N]||String(N||"").toLowerCase().replace(/s$/,"")},u:function(N){return N===void 0}},O="en",C={};C[O]=$;var w="$isDayjsObject",T=function(N){return N instanceof x||!(!N||!N[w])},F=function N(A,v,y){var M;if(!A)return O;if(typeof A=="string"){var D=A.toLowerCase();C[D]&&(M=D),v&&(C[D]=v,M=D);var P=A.split("-");if(!M&&P.length>1)return N(P[0])}else{var J=A.name;C[J]=A,M=J}return!y&&M&&(O=M),M||!y&&O},B=function(N,A){if(T(N))return N.clone();var v=typeof A=="object"?A:{};return v.date=N,v.args=arguments,new x(v)},m=W;m.l=F,m.i=T,m.w=function(N,A){return B(N,{locale:A.$L,utc:A.$u,x:A.$x,$offset:A.$offset})};var x=function(){function N(v){this.$L=F(v.locale,null,!0),this.parse(v),this.$x=this.$x||v.x||{},this[w]=!0}var A=N.prototype;return A.parse=function(v){this.$d=function(y){var M=y.date,D=y.utc;if(M===null)return new Date(NaN);if(m.u(M))return new Date;if(M instanceof Date)return new Date(M);if(typeof M=="string"&&!/Z$/i.test(M)){var P=M.match(R);if(P){var J=P[2]-1||0,V=(P[7]||"0").substring(0,3);return D?new Date(Date.UTC(P[1],J,P[3]||1,P[4]||0,P[5]||0,P[6]||0,V)):new Date(P[1],J,P[3]||1,P[4]||0,P[5]||0,P[6]||0,V)}}return new Date(M)}(v),this.init()},A.init=function(){var v=this.$d;this.$y=v.getFullYear(),this.$M=v.getMonth(),this.$D=v.getDate(),this.$W=v.getDay(),this.$H=v.getHours(),this.$m=v.getMinutes(),this.$s=v.getSeconds(),this.$ms=v.getMilliseconds()},A.$utils=function(){return m},A.isValid=function(){return this.$d.toString()!==p},A.isSame=function(v,y){var M=B(v);return this.startOf(y)<=M&&M<=this.endOf(y)},A.isAfter=function(v,y){return B(v)<this.startOf(y)},A.isBefore=function(v,y){return this.endOf(y)<B(v)},A.$g=function(v,y,M){return m.u(v)?this[y]:this.set(M,v)},A.unix=function(){return Math.floor(this.valueOf()/1e3)},A.valueOf=function(){return this.$d.getTime()},A.startOf=function(v,y){var M=this,D=!!m.u(y)||y,P=m.p(v),J=function(H,j){var Q=m.w(M.$u?Date.UTC(M.$y,j,H):new Date(M.$y,j,H),M);return D?Q:Q.endOf(c)},V=function(H,j){return m.w(M.toDate()[H].apply(M.toDate("s"),(D?[0,0,0,0]:[23,59,59,999]).slice(j)),M)},oe=this.$W,le=this.$M,I=this.$D,L="set"+(this.$u?"UTC":"");switch(P){case f:return D?J(1,0):J(31,11);case h:return D?J(1,le):J(0,le+1);case u:var Y=this.$locale().weekStart||0,G=(oe<Y?oe+7:oe)-Y;return J(D?I-G:I+(6-G),le);case c:case g:return V(L+"Hours",0);case l:return V(L+"Minutes",1);case a:return V(L+"Seconds",2);case o:return V(L+"Milliseconds",3);default:return this.clone()}},A.endOf=function(v){return this.startOf(v,!1)},A.$set=function(v,y){var M,D=m.p(v),P="set"+(this.$u?"UTC":""),J=(M={},M[c]=P+"Date",M[g]=P+"Date",M[h]=P+"Month",M[f]=P+"FullYear",M[l]=P+"Hours",M[a]=P+"Minutes",M[o]=P+"Seconds",M[i]=P+"Milliseconds",M)[D],V=D===c?this.$D+(y-this.$W):y;if(D===h||D===f){var oe=this.clone().set(g,1);oe.$d[J](V),oe.init(),this.$d=oe.set(g,Math.min(this.$D,oe.daysInMonth())).$d}else J&&this.$d[J](V);return this.init(),this},A.set=function(v,y){return this.clone().$set(v,y)},A.get=function(v){return this[m.p(v)]()},A.add=function(v,y){var M,D=this;v=Number(v);var P=m.p(y),J=function(le){var I=B(D);return m.w(I.date(I.date()+Math.round(le*v)),D)};if(P===h)return this.set(h,this.$M+v);if(P===f)return this.set(f,this.$y+v);if(P===c)return J(1);if(P===u)return J(7);var V=(M={},M[a]=r,M[l]=s,M[o]=n,M)[P]||1,oe=this.$d.getTime()+v*V;return m.w(oe,this)},A.subtract=function(v,y){return this.add(-1*v,y)},A.format=function(v){var y=this,M=this.$locale();if(!this.isValid())return M.invalidDate||p;var D=v||"YYYY-MM-DDTHH:mm:ssZ",P=m.z(this),J=this.$H,V=this.$m,oe=this.$M,le=M.weekdays,I=M.months,L=M.meridiem,Y=function(j,Q,ee,U){return j&&(j[Q]||j(y,D))||ee[Q].slice(0,U)},G=function(j){return m.s(J%12||12,j,"0")},H=L||function(j,Q,ee){var U=j<12?"AM":"PM";return ee?U.toLowerCase():U};return D.replace(b,function(j,Q){return Q||function(ee){switch(ee){case"YY":return String(y.$y).slice(-2);case"YYYY":return m.s(y.$y,4,"0");case"M":return oe+1;case"MM":return m.s(oe+1,2,"0");case"MMM":return Y(M.monthsShort,oe,I,3);case"MMMM":return Y(I,oe);case"D":return y.$D;case"DD":return m.s(y.$D,2,"0");case"d":return String(y.$W);case"dd":return Y(M.weekdaysMin,y.$W,le,2);case"ddd":return Y(M.weekdaysShort,y.$W,le,3);case"dddd":return le[y.$W];case"H":return String(J);case"HH":return m.s(J,2,"0");case"h":return G(1);case"hh":return G(2);case"a":return H(J,V,!0);case"A":return H(J,V,!1);case"m":return String(V);case"mm":return m.s(V,2,"0");case"s":return String(y.$s);case"ss":return m.s(y.$s,2,"0");case"SSS":return m.s(y.$ms,3,"0");case"Z":return P}return null}(j)||P.replace(":","")})},A.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},A.diff=function(v,y,M){var D,P=this,J=m.p(y),V=B(v),oe=(V.utcOffset()-this.utcOffset())*r,le=this-V,I=function(){return m.m(P,V)};switch(J){case f:D=I()/12;break;case h:D=I();break;case d:D=I()/3;break;case u:D=(le-oe)/6048e5;break;case c:D=(le-oe)/864e5;break;case l:D=le/s;break;case a:D=le/r;break;case o:D=le/n;break;default:D=le}return M?D:m.a(D)},A.daysInMonth=function(){return this.endOf(h).$D},A.$locale=function(){return C[this.$L]},A.locale=function(v,y){if(!v)return this.$L;var M=this.clone(),D=F(v,y,!0);return D&&(M.$L=D),M},A.clone=function(){return m.w(this.$d,this)},A.toDate=function(){return new Date(this.valueOf())},A.toJSON=function(){return this.isValid()?this.toISOString():null},A.toISOString=function(){return this.$d.toISOString()},A.toString=function(){return this.$d.toUTCString()},N}(),S=x.prototype;return B.prototype=S,[["$ms",i],["$s",o],["$m",a],["$H",l],["$W",c],["$M",h],["$y",f],["$D",g]].forEach(function(N){S[N[1]]=function(A){return this.$g(A,N[0],N[1])}}),B.extend=function(N,A){return N.$i||(N(A,x,B),N.$i=!0),B},B.locale=F,B.isDayjs=T,B.unix=function(N){return B(1e3*N)},B.en=C[O],B.Ls=C,B.p={},B})}(ls)),ls.exports}var Wf=jf();const Gt=Rt(Wf);var cs={exports:{}},Yf=cs.exports,ga;function Gf(){return ga||(ga=1,function(e,t){(function(n,r){e.exports=r()})(Yf,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 c=this.$utils(),u=(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 c.s(a.week(),h==="w"?1:2,"0");case"W":case"WW":return c.s(a.isoWeek(),h==="W"?1:2,"0");case"k":case"kk":return c.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)(u)}}})}(cs)),cs.exports}var Vf=Gf();const zf=Rt(Vf);var us={exports:{}},Kf=us.exports,_a;function Xf(){return _a||(_a=1,function(e,t){(function(n,r){e.exports=r()})(Kf,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={},c=function(R){return(R=+R)+(R>68?1900:2e3)},u=function(R){return function(b){this[R]=+b}},h=[/[+-]\d\d:?(\d\d)?|Z/,function(R){(this.zone||(this.zone={})).offset=function(b){if(!b||b==="Z")return 0;var $=b.match(/([+-]|\d\d)/g),k=60*$[1]+(+$[2]||0);return k===0?0:$[0]==="+"?-k:k}(R)}],d=function(R){var b=l[R];return b&&(b.indexOf?b:b.s.concat(b.f))},f=function(R,b){var $,k=l.meridiem;if(k){for(var W=1;W<=24;W+=1)if(R.indexOf(k(W,0,b))>-1){$=W>12;break}}else $=R===(b?"pm":"PM");return $},g={A:[a,function(R){this.afternoon=f(R,!1)}],a:[a,function(R){this.afternoon=f(R,!0)}],Q:[s,function(R){this.month=3*(R-1)+1}],S:[s,function(R){this.milliseconds=100*+R}],SS:[i,function(R){this.milliseconds=10*+R}],SSS:[/\d{3}/,function(R){this.milliseconds=+R}],s:[o,u("seconds")],ss:[o,u("seconds")],m:[o,u("minutes")],mm:[o,u("minutes")],H:[o,u("hours")],h:[o,u("hours")],HH:[o,u("hours")],hh:[o,u("hours")],D:[o,u("day")],DD:[i,u("day")],Do:[a,function(R){var b=l.ordinal,$=R.match(/\d+/);if(this.day=$[0],b)for(var k=1;k<=31;k+=1)b(k).replace(/\[|\]/g,"")===R&&(this.day=k)}],w:[o,u("week")],ww:[i,u("week")],M:[o,u("month")],MM:[i,u("month")],MMM:[a,function(R){var b=d("months"),$=(d("monthsShort")||b.map(function(k){return k.slice(0,3)})).indexOf(R)+1;if($<1)throw new Error;this.month=$%12||$}],MMMM:[a,function(R){var b=d("months").indexOf(R)+1;if(b<1)throw new Error;this.month=b%12||b}],Y:[/[+-]?\d+/,u("year")],YY:[i,function(R){this.year=c(R)}],YYYY:[/\d{4}/,u("year")],Z:h,ZZ:h};function p(R){var b,$;b=R,$=l&&l.formats;for(var k=(R=b.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(B,m,x){var S=x&&x.toUpperCase();return m||$[x]||n[x]||$[S].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(N,A,v){return A||v.slice(1)})})).match(r),W=k.length,O=0;O<W;O+=1){var C=k[O],w=g[C],T=w&&w[0],F=w&&w[1];k[O]=F?{regex:T,parser:F}:C.replace(/^\[|\]$/g,"")}return function(B){for(var m={},x=0,S=0;x<W;x+=1){var N=k[x];if(typeof N=="string")S+=N.length;else{var A=N.regex,v=N.parser,y=B.slice(S),M=A.exec(y)[0];v.call(m,M),B=B.replace(M,"")}}return function(D){var P=D.afternoon;if(P!==void 0){var J=D.hours;P?J<12&&(D.hours+=12):J===12&&(D.hours=0),delete D.afternoon}}(m),m}}return function(R,b,$){$.p.customParseFormat=!0,R&&R.parseTwoDigitYear&&(c=R.parseTwoDigitYear);var k=b.prototype,W=k.parse;k.parse=function(O){var C=O.date,w=O.utc,T=O.args;this.$u=w;var F=T[1];if(typeof F=="string"){var B=T[2]===!0,m=T[3]===!0,x=B||m,S=T[2];m&&(S=T[2]),l=this.$locale(),!B&&S&&(l=$.Ls[S]),this.$d=function(y,M,D,P){try{if(["x","X"].indexOf(M)>-1)return new Date((M==="X"?1e3:1)*y);var J=p(M)(y),V=J.year,oe=J.month,le=J.day,I=J.hours,L=J.minutes,Y=J.seconds,G=J.milliseconds,H=J.zone,j=J.week,Q=new Date,ee=le||(V||oe?1:Q.getDate()),U=V||Q.getFullYear(),K=0;V&&!oe||(K=oe>0?oe-1:Q.getMonth());var q,ne=I||0,me=L||0,pe=Y||0,X=G||0;return H?new Date(Date.UTC(U,K,ee,ne,me,pe,X+60*H.offset*1e3)):D?new Date(Date.UTC(U,K,ee,ne,me,pe,X)):(q=new Date(U,K,ee,ne,me,pe,X),j&&(q=P(q).week(j).toDate()),q)}catch{return new Date("")}}(C,F,w,$),this.init(),S&&S!==!0&&(this.$L=this.locale(S).$L),x&&C!=this.format(F)&&(this.$d=new Date("")),l={}}else if(F instanceof Array)for(var N=F.length,A=1;A<=N;A+=1){T[1]=F[A-1];var v=$.apply(this,T);if(v.isValid()){this.$d=v.$d,this.$L=v.$L,this.init();break}A===N&&(this.$d=new Date(""))}else W.call(this,O)}}})}(us)),us.exports}var qf=Xf();const Zf=Rt(qf);var hs={exports:{}},Jf=hs.exports,pa;function Qf(){return pa||(pa=1,function(e,t){(function(n,r){e.exports=r()})(Jf,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,g,p){var R=h.name?h:h.$locale(),b=o(R[d]),$=o(R[f]),k=b||$.map(function(O){return O.slice(0,g)});if(!p)return k;var W=R.weekStart;return k.map(function(O,C){return k[(C+(W||0))%7]})},l=function(){return s.Ls[s.locale()]},c=function(h,d){return h.formats[d]||function(f){return f.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(g,p,R){return p||R.slice(1)})}(h.formats[d.toUpperCase()])},u=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 c(h.$locale(),d)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};i.localeData=function(){return u.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 c(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)}}})}(hs)),hs.exports}var em=Qf();const tm=Rt(em);var ds={exports:{}},nm=ds.exports,Ea;function rm(){return Ea||(Ea=1,function(e,t){(function(n,r){e.exports=r()})(nm,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 c=this.$locale().formats,u=function(h,d){return h.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(f,g,p){var R=p&&p.toUpperCase();return g||d[p]||n[p]||d[R].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(b,$,k){return $||k.slice(1)})})}(l,c===void 0?{}:c);return a.call(this,u)}}})}(ds)),ds.exports}var sm=rm();const im=Rt(sm);var fs={exports:{}},om=fs.exports,Ca;function am(){return Ca||(Ca=1,function(e,t){(function(n,r){e.exports=r()})(om,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(p){var R={date:p,utc:!0,args:arguments};return new o(R)},l.utc=function(p){var R=a(this.toDate(),{locale:this.$L,utc:!0});return p?R.add(this.utcOffset(),n):R},l.local=function(){return a(this.toDate(),{locale:this.$L,utc:!1})};var c=l.parse;l.parse=function(p){p.utc&&(this.$u=!0),this.$utils().u(p.$offset)||(this.$offset=p.$offset),c.call(this,p)};var u=l.init;l.init=function(){if(this.$u){var p=this.$d;this.$y=p.getUTCFullYear(),this.$M=p.getUTCMonth(),this.$D=p.getUTCDate(),this.$W=p.getUTCDay(),this.$H=p.getUTCHours(),this.$m=p.getUTCMinutes(),this.$s=p.getUTCSeconds(),this.$ms=p.getUTCMilliseconds()}else u.call(this)};var h=l.utcOffset;l.utcOffset=function(p,R){var b=this.$utils().u;if(b(p))return this.$u?0:b(this.$offset)?h.call(this):this.$offset;if(typeof p=="string"&&(p=function(O){O===void 0&&(O="");var C=O.match(r);if(!C)return null;var w=(""+C[0]).match(s)||["-",0,0],T=w[0],F=60*+w[1]+ +w[2];return F===0?0:T==="+"?F:-F}(p),p===null))return this;var $=Math.abs(p)<=16?60*p:p,k=this;if(R)return k.$offset=$,k.$u=p===0,k;if(p!==0){var W=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(k=this.local().add($+W,n)).$offset=$,k.$x.$localOffset=W}else k=this.utc();return k};var d=l.format;l.format=function(p){var R=p||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return d.call(this,R)},l.valueOf=function(){var p=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*p},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(p){return p==="s"&&this.$offset?a(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():f.call(this)};var g=l.diff;l.diff=function(p,R,b){if(p&&this.$u===p.$u)return g.call(this,p,R,b);var $=this.local(),k=a(p).local();return g.call($,k,R,b)}}})}(fs)),fs.exports}var lm=am();const cm=Rt(lm);var ms={exports:{}},um=ms.exports,Ra;function hm(){return Ra||(Ra=1,function(e,t){(function(n,r){e.exports=r()})(um,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")}}})}(ms)),ms.exports}var dm=hm();const fm=Rt(dm);var gs={exports:{}},mm=gs.exports,Ia;function gm(){return Ia||(Ia=1,function(e,t){(function(n,r){e.exports=r()})(mm,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 c=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var u=o(this).startOf(r).add(1,r).date(c),h=o(this).endOf(n);if(u.isBefore(h))return 1}var d=o(this).startOf(r).date(c).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)}}})}(gs)),gs.exports}var _m=gm();const pm=Rt(_m);var _s={exports:{}},Em=_s.exports,Sa;function Cm(){return Sa||(Sa=1,function(e,t){(function(n,r){e.exports=r()})(Em,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}}})}(_s)),_s.exports}var Rm=Cm();const Im=Rt(Rm);Gt.extend(Zf);Gt.extend(zf);Gt.extend(fm);Gt.extend(tm);Gt.extend(pm);Gt.extend(Im);Gt.extend(cm);Gt.extend(im);function Fs(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 Sm(e){if(e==null)return!1;const t=e.bullet;return(t==null?void 0:t.listId)!=null}function Om(e){if(e==null)return!1;const t=e.paragraphStyle;return Ec(t)}function Ec(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 Cc(e,t,n){return e.slice(0,t)+n+e.slice(t)}function Rc(e,t,n){return t>n?e:e.slice(0,t)+e.slice(n)}function vm(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 wm(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 Me=Symbol("newer"),Je=Symbol("older");class bm{constructor(t){E(this,"entry");this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[Me],{done:!1,value:t.key}):{done:!0,value:void 0}}}class Am{constructor(t){E(this,"entry");this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[Me],{done:!1,value:t.value}):{done:!0,value:void 0}}}class Tm{constructor(t){E(this,"entry");this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[Me],{done:!1,value:[t.key,t.value]}):{done:!0,value:void 0}}}var Tl,yl;yl=Me,Tl=Je;class Oa{constructor(t,n){E(this,"key");E(this,"value");E(this,yl);E(this,Tl);this.key=t,this.value=n,this[Me]=void 0,this[Je]=void 0}toJSON(){return{key:this.key,value:this.value}}}class br{constructor(...t){E(this,"_keymap");E(this,"size",0);E(this,"limit");E(this,"oldest");E(this,"newest");E(this,"_onShiftListeners",[]);if(lr.hasLength(t,1)){if(lr.isNumber(t[0])){const n=t[0];this._initialize(n,void 0);return}if(lr.isIterable(t[0])){const n=t[0];this._initialize(0,n);return}return}if(lr.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),je(()=>Lr(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[Me]&&(t===this.oldest&&(this.oldest=t[Me]),t[Me][Je]=t[Je]),t[Je]&&(t[Je][Me]=t[Me]),t[Me]=void 0,t[Je]=this.newest,this.newest&&(this.newest[Me]=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 Oa(i.value[0],i.value[1]);if(this._keymap.set(o.key,o),n?(n[Me]=o,o[Je]=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 Oa(t,n)),this.newest?(this.newest[Me]=r,r[Je]=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[Me]?(this.oldest=this.oldest[Me],this.oldest[Je]=void 0):(this.oldest=void 0,this.newest=void 0),t[Me]=t[Je]=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[Me]&&n[Je]?(n[Je][Me]=n[Me],n[Me][Je]=n[Je]):n[Me]?(n[Me][Je]=void 0,this.oldest=n[Me]):n[Je]?(n[Je][Me]=void 0,this.newest=n[Je]):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 bm(this.oldest)}values(){return new Am(this.oldest)}entries(){return this[Symbol.iterator]()}[Symbol.iterator](){return new Tm(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[Me]}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[Me];return t}toString(){let t="",n=this.oldest;for(;n;)t+=`${String(n.key)}:${n.value}`,n=n[Me],n&&(t+=" < ");return t}}class lr{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]"}}const cr=2,ur=2**2,ps=2**3,hr=2**4,dr=2**5,fr=2**6,Li=2**7,xi=2**8,Ui=2**9,ym=0,Nm=2958466,Mm=-694324,Dm=35830291,Lm=-1,va=1,Wn=6,io="general",oo="hash",Yn="zero",ao="qmark",lo="slash",Ar="group",ws="scale",co="comma",uo="break",Bs="text",ho="plus",fo="minus",bs="point",mo="space",go="percent",$s="digit",_o="calendar",Tr="error",po="datetime",Eo="duration",Co="condition",Ro="dbnum",Io="natnum",So="locale",Oo="color",Ic="modifier",vo="ampm",wo="escaped",bo="string",Ao="skip",To="exp",yo="fill",No="paren",Hs="char",xm=["#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"],Pi=["¤","$","£","¥","֏","؋","৳","฿","៛","₡","₦","₩","₪","₫","€","₭","₮","₱","₲","₴","₸","₹","₺","₼","₽","₾","₿"],ki=new RegExp("["+Pi.join("")+"]"),Qs=Object.freeze({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"}),Sc=/^([a-z\d]+)(?:[_-]([a-z\d]+))?(?:\.([a-z\d]+))?(?:@([a-z\d]+))?$/i,Pn={},_=(e,t="")=>e.replace(/~/g,t).split(";"),Ue=(e,t=0,n=0)=>(e.mmm||(e.mmm=t<1?e.mmmm.concat():e.mmmm.map(r=>{const s=r.slice(0,t%10);return s+(t<10||r===s?"":".")})),e.ddd||(e.ddd=n<1?e.dddd.concat():e.dddd.map(r=>{const s=r.slice(0,n%10);return s+(n<10||r===s?"":".")})),!e.mmm6&&e.mmmm6&&(e.mmm6=e.mmmm6),e),Um={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"),bool:_("TRUE;FALSE"),preferMDY:!1};function Mo(e){const t=Sc.exec(e);if(!t)throw new SyntaxError(`Malformed locale: ${e}`);return{lang:t[1]+(t[2]?"_"+t[2]:""),language:t[1],territory:t[2]||""}}function Do(e){if(typeof e=="number")return Qs[e&65535]||null;const t=parseInt(e,16);return isFinite(t)&&Qs[t&65535]?Qs[t&65535]||null:Sc.test(e)?e:null}function qn(e){const t=Do(e);let n=null;if(t){const r=Mo(t);n=Pn[r.lang]||Pn[r.language]||null}return n}function Fi(e){return Object.assign({},Um,e)}function te(e,t){const n=typeof t=="object"?t:Mo(t);return Pn[n.lang]=Fi(e),n.language!==n.lang&&!Pn[n.language]&&(Pn[n.language]=Fi(e)),Pn[n.lang]}const nn=Fi({group:",",preferMDY:!0});nn.isDefault=!0;te({group:",",ampm:_("上午;下午"),mmmm:_("一月;二月;三月;四月;五月;六月;七月;八月;九月;十月;十一月;十二月"),mmm:_("1月;2月;3月;4月;5月;6月;7月;8月;9月;10月;11月;12月"),dddd:_("~日;~一;~二;~三;~四;~五;~六","星期"),ddd:_("周日;周一;周二;周三;周四;周五;周六")},"zh_CN");const Lo={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:_("周日;周一;周二;周三;周四;周五;周六")};te({...Lo,nan:"非數值",dddd:_("~日;~一;~二;~三;~四;~五;~六","星期")},"zh_TW");te({...Lo,dddd:_("~日;~一;~二;~三;~四;~五;~六","星期")},"zh_HK");te({...Lo,ampm:_("午前;午後"),dddd:_("日~;月~;火~;水~;木~;金~;土~","曜日"),ddd:_("日;月;火;水;木;金;土")},"ja");te({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");te({group:",",ampm:_("ก่อนเที่ยง;หลังเที่ยง"),mmmm:_("มกร~;กุมภาพันธ์;มีน~;เมษายน;พฤษภ~;มิถุนายน;กรกฎ~;สิงห~;กันยายน;ตุล~;พฤศจิกายน;ธันว~","าคม"),mmm:_("ม.ค.;ก.พ.;มี.ค.;เม.ย.;พ.ค.;มิ.ย.;ก.ค.;ส.ค.;ก.ย.;ต.ค.;พ.ย.;ธ.ค."),dddd:_("วันอาทิตย์;วันจันทร์;วันอังคาร;วันพุธ;วันพฤหัสบดี;วันศุกร์;วันเสาร์"),ddd:_("อา.;จ.;อ.;พ.;พฤ.;ศ.;ส.")},"th");te(Ue({decimal:",",ampm:_("dop.;odp."),mmmm:_("ledna;února;března;dubna;května;června;července;srpna;září;října;listopadu;prosince"),mmm:_("I;II;III;IV;V;VI;VII;VIII;IX;X;XI;XII"),dddd:_("neděle;pondělí;úterý;středa;čtvrtek;pátek;sobota"),bool:_("PRAVDA;NEPRAVDA")},-1,2),"cs");te(Ue({group:".",decimal:",",mmmm:_("januar;februar;marts;april;maj;juni;juli;august;september;oktober;november;december"),dddd:_("søn~;man~;tirs~;ons~;tors~;fre~;lør~","dag"),bool:_("SAND;FALSK")},13,13),"da");te(Ue({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"),bool:_("WAAR;ONWAAR")},-1,2),"nl");te({group:",",preferMDY:!0},"en");te({group:",",preferMDY:!0},"en_US");te({group:","},"en_AU");te({group:","},"en_CA");te({group:","},"en_GB");te({group:",",mmm:_("Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sept;Oct;Nov;Dec")},"en_IE");te(Ue({decimal:",",nan:"epäluku",ampm:_("ap.;ip."),mmmm:_("tammi~;helmi~;maalis~;huhti~;touko~;kesä~;heinä~;elo~;syys~;loka~;marras~;joulu~","kuuta"),mmm:_("tammik.;helmik.;maalisk.;huhtik.;toukok.;kesäk.;heinäk.;elok.;syysk.;lokak.;marrask.;jouluk."),dddd:_("sunnun~;maanan~;tiis~;keskiviikkona;tors~;perjan~;lauan~","taina"),bool:_("TOSI;EPÄTOSI")},-1,2),"fi");const xo=Ue({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:_("~manche;lun~;mar~;mercre~;jeu~;vendre~;same~","di"),bool:_("VRAI;FAUX")},-1,13);te({...xo},"fr");te({...xo,mmm:_("janv.;févr.;mars;avr.;mai;juin;juill.;août;sept.;oct.;nov.;déc.")},"fr_CA");te({group:"'",decimal:".",...xo},"fr_CH");const Oc=Ue({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:_("Sonn~;Mon~;Diens~;Mittwoch;Donners~;Frei~;Sams~","tag"),bool:_("WAHR;FALSCH")},-1,12);te({group:".",decimal:",",...Oc},"de");te({group:"'",decimal:".",...Oc},"de_CH");te(Ue({group:".",decimal:",",ampm:_("π.μ.;μ.μ."),mmmm:_("Ιανουαρ~;Φεβρουαρ~;Μαρτ~;Απριλ~;Μαΐου;Ιουν~;Ιουλ~;Αυγούστου;Σεπτεμβρ~;Οκτωβρ~;Νοεμβρ~;Δεκεμβρ~","ίου"),mmm:_("Ιαν;Φεβ;Μαρ;Απρ;Μαΐ;Ιουν;Ιουλ;Αυγ;Σεπ;Οκτ;Νοε;Δεκ"),dddd:_("Κυριακή;Δευτέρα;Τρίτη;Τετάρτη;Πέμπτη;Παρασκευή;Σάββατο")},-1,3),"el");te({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"),bool:_("IGAZ;HAMIS")},"hu");te(Ue({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"),dddd:_("sunnu~;mánu~;þriðju~;miðviku~;fimmtu~;föstu~;laugar~","dagur")},13,13),"is");te(Ue({group:".",decimal:",",mmmm:_("Januari;Februari;Maret;April;Mei;Juni;Juli;Agustus;September;Oktober;November;Desember"),dddd:_("Minggu;Senin;Selasa;Rabu;Kamis;Jumat;Sabtu")},3,3),"id");const vc=Ue({mmmm:_("gennaio;febbraio;marzo;aprile;maggio;giugno;luglio;agosto;settembre;ottobre;novembre;dicembre"),dddd:_("domenica;lunedì;martedì;mercoledì;giovedì;venerdì;sabato"),bool:_("VERO;FALSO")},3,3);te({group:".",decimal:",",...vc},"it");te({group:"'",decimal:".",...vc},"it_CH");const wc={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øn~;man~;tirs~;ons~;tors~;fre~;lør~","dag"),bool:_("SANN;USANN")};te(Ue({...wc},-1,13),"nb");te(Ue({...wc},-1,13),"no");te(Ue({decimal:",",mmmm:_("stycznia;lutego;marca;kwietnia;maja;czerwca;lipca;sierpnia;września;października;listopada;grudnia"),dddd:_("niedziela;poniedziałek;wtorek;środa;czwartek;piątek;sobota"),ddd:_("niedz.;pon.;wt.;śr.;czw.;pt.;sob."),bool:_("PRAWDA;FAŁSZ")},3,-1),"pl");const bc={group:".",decimal:",",mmmm:_("janeiro;fevereiro;março;abril;maio;junho;julho;agosto;setembro;outubro;novembro;dezembro"),dddd:_("domingo;segunda-feira;terça-feira;quarta-feira;quinta-feira;sexta-feira;sábado"),bool:_("VERDADEIRO;FALSO")};te(Ue(bc,13,13),"pt");te(Ue(bc,13,13),"pt_BR");te({decimal:",",nan:"не число",mmmm:_("января;февраля;марта;апреля;мая;июня;июля;августа;сентября;октября;ноября;декабря"),mmm:_("янв.;февр.;мар.;апр.;мая;июн.;июл.;авг.;сент.;окт.;нояб.;дек."),dddd:_("воскресенье;понедельник;вторник;среда;четверг;пятница;суббота"),ddd:_("вс;пн;вт;ср;чт;пт;сб"),mmmm6:_("рамадан;шавваль;зуль-каада;зуль-хиджжа;мухаррам;раби-уль-авваль;раби-уль-ахир;джумад-уль-авваль;джумад-уль-ахир;раджаб;шаабан;рамадан"),mmm6:_("рам.;шав.;зуль-к.;зуль-х.;мух.;раб. I;раб. II;джум. I;джум. II;радж.;шааб.;рам."),bool:_("ИСТИНА;ЛОЖЬ")},"ru");te(Ue({decimal:",",mmmm:_("januára;februára;marca;apríla;mája;júna;júla;augusta;septembra;októbra;novembra;decembra"),dddd:_("nedeľa;pondelok;utorok;streda;štvrtok;piatok;sobota")},3,2),"sk");const Pt={group:".",decimal:",",ampm:_("a. m.;p. m."),mmmm:_("enero;febrero;marzo;abril;mayo;junio;julio;agosto;septiem~;octu~;noviem~;diciem~","bre"),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"),bool:_("VERDADERO;FALSO")},Pm=_("ene;feb;mar;abr;may;jun;jul;ago;sep;oct;nov;dic"),Uo=_("ene.;feb.;mar.;abr.;may.;jun.;jul.;ago.;sept.;oct.;nov.;dic.");te({...Pt},"es");te({...Pt},"es_AR");te({...Pt},"es_BO");te({...Pt},"es_CL");te({...Pt},"es_CO");te({...Pt},"es_EC");te({...Pt,mmm:Pm,ampm:_("a.m.;p.m.")},"es_MX");te({...Pt,mmm:Uo},"es_PY");te({...Pt,mmm:Uo},"es_UY");te({...Pt,mmm:Uo,mmmm:_("enero;febrero;marzo;abril;mayo;junio;julio;agosto;setiembre;octubre;noviembre;diciembre")},"es_VE");te({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ön~;mån~;tis~;ons~;tors~;fre~;lör~","dag"),ddd:_("sön;mån;tis;ons;tors;fre;lör")},"sv");te(Ue({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"),bool:_("DOĞRU;YANLIŞ")},3,-1),"tr");te({group:",",ampm:_("yb;yh"),mmmm:_("Ionawr;Chwefror;Mawrth;Ebrill;Mai;Mehefin;Gorffennaf;Awst;Medi;Hydref;Tachwedd;Rhagfyr"),mmm:_("Ion;Chwef;Maw;Ebr;Mai;Meh;Gorff;Awst;Medi;Hyd;Tach;Rhag"),dddd:_("Dydd Sul;Dydd Llun;Dydd Mawrth;Dydd Mercher;Dydd Iau;Dydd Gwener;Dydd Sadwrn"),ddd:_("Sul;Llun;Maw;Mer;Iau;Gwen;Sad")},"cy");te({group:".",decimal:",",mmmm:_("yanvar;fevral;mart;aprel;may;iyun;iyul;avqust;sentyabr;oktyabr;noyabr;dekabr"),mmm:_("yan;fev;mar;apr;may;iyn;iyl;avq;sen;okt;noy;dek"),dddd:_("bazar;bazar ertəsi;çərşənbə axşamı;çərşənbə;cümə axşamı;cümə;şənbə"),ddd:_("B.;B.e.;Ç.a.;Ç.;C.a.;C.;Ş.")},"az");te(Ue({decimal:",",mmmm:_("студзеня;лютага;сакавіка;красавіка;мая;чэрвеня;ліпеня;жніўня;верасня;кастрычніка;лістапада;снежня"),dddd:_("нядзеля;панядзелак;аўторак;серада;чацвер;пятніца;субота"),ddd:_("нд;пн;аў;ср;чц;пт;сб")},3,-1),"be");te({decimal:",",ampm:_("пр.об.;сл.об."),mmmm:_("януари;февруари;март;април;май;юни;юли;август;септември;октомври;ноември;декември"),mmm:_("яну;фев;март;апр;май;юни;юли;авг;сеп;окт;ное;дек"),dddd:_("неделя;понеделник;вторник;сряда;четвъртък;петък;събота"),ddd:_("нд;пн;вт;ср;чт;пт;сб"),bool:_("ИСТИНА;ЛОЖЬ")},"bg");te({group:".",decimal:",",mmmm:_("de gener;de febrer;de març;d’abril;de maig;de juny;de juliol;d’agost;de setembre;d’octubre;de novembre;de desembre"),mmm:_("de gen.;de febr.;de març;d’abr.;de maig;de juny;de jul.;d’ag.;de set.;d’oct.;de nov.;de des."),dddd:_("diumenge;dilluns;dimarts;dimecres;dijous;divendres;dissabte"),ddd:_("dg.;dl.;dt.;dc.;dj.;dv.;ds."),ampm:_("a. m.;p. m.")},"ca");te(Ue({group:",",decimal:".",mmmm:_("Enero;Pebrero;Marso;Abril;Mayo;Hunyo;Hulyo;Agosto;Setyembre;Oktubre;Nobyembre;Disyembre"),dddd:_("Linggo;Lunes;Martes;Miyerkules;Huwebes;Biyernes;Sabado")},3,3),"fil");te({group:",",decimal:".",mmmm:_("જાન્યુઆરી;ફેબ્રુઆરી;માર્ચ;એપ્રિલ;મે;જૂન;જુલાઈ;ઑગસ્ટ;સપ્ટેમ્બર;ઑક્ટોબર;નવેમ્બર;ડિસેમ્બર"),mmm:_("જાન્યુ;ફેબ્રુ;માર્ચ;એપ્રિલ;મે;જૂન;જુલાઈ;ઑગસ્ટ;સપ્ટે;ઑક્ટો;નવે;ડિસે"),dddd:_("રવિ~;સોમ~;મંગળ~;બુધ~;ગુરુ~;શુક્ર~;શનિ~","વાર"),ddd:_("રવિ;સોમ;મંગળ;બુધ;ગુરુ;શુક્ર;શનિ")},"gu");te({group:",",decimal:".",ampm:_("לפנה״צ;אחה״צ"),dddd:_("~ראשון;~שני;~שלישי;~רביעי;~חמישי;~שישי;~שבת","יום "),ddd:_("~א׳;~ב׳;~ג׳;~ד׳;~ה׳;~ו׳;שבת","יום "),mmmm:_("ינואר;פברואר;מרץ;אפריל;מאי;יוני;יולי;אוגוסט;ספטמבר;אוקטובר;נובמבר;דצמבר"),mmm:_("ינו׳;פבר׳;מרץ;אפר׳;מאי;יוני;יולי;אוג׳;ספט׳;אוק׳;נוב׳;דצמ׳"),mmmm6:_("רמדאן;שוואל;ד׳ו אל־קעדה;ד׳ו אל־חיג׳ה;מוחרם;רביע אל־אוול;רביע א־ת׳אני;ג׳ומאדא אל־אולא;ג׳ומאדא א־ת׳אניה;רג׳ב;שעבאן;רמדאן"),mmm6:_("רמדאן;שוואל;ד׳ו אל־קעדה;ד׳ו אל־חיג׳ה;מוחרם;רביע א׳;רביע ב׳;ג׳ומאדא א׳;ג׳ומאדא ב׳;רג׳ב;שעבאן;רמדאן")},"he");te(Ue({group:".",decimal:",",mmmm:_("siječnja;veljače;ožujka;travnja;svibnja;lipnja;srpnja;kolovoza;rujna;listopada;studenoga;prosinca"),mmm:_("sij;velj;ožu;tra;svi;lip;srp;kol;ruj;lis;stu;pro"),dddd:_("nedjelja;ponedjeljak;utorak;srijeda;četvrtak;petak;subota")},-1,3),"hr");te({decimal:",",mmmm:_("հունվարի;փետրվարի;մարտի;ապրիլի;մայիսի;հունիսի;հուլիսի;օգոստոսի;սեպտեմբերի;հոկտեմբերի;նոյեմբերի;դեկտեմբերի"),mmm:_("հնվ;փտվ;մրտ;ապր;մյս;հնս;հլս;օգս;սեպ;հոկ;նոյ;դեկ"),dddd:_("կիրակի;երկուշաբթի;երեքշաբթի;չորեքշաբթի;հինգշաբթի;ուրբաթ;շաբաթ"),ddd:_("կիր;երկ;երք;չրք;հնգ;ուր;շբթ")},"hy");te(Ue({decimal:",",mmmm:_("იანვარი;თებერვალი;მარტი;აპრილი;მაისი;ივნისი;ივლისი;აგვისტო;სექტემბერი;ოქტომბერი;ნოემბერი;დეკემბერი"),dddd:_("კვირა;ორშაბათი;სამშაბათი;ოთხშაბათი;ხუთშაბათი;პარასკევი;შაბათი")},3,3),"ka");te(Ue({decimal:",",mmmm:_("қаңтар;ақпан;наурыз;сәуір;мамыр;маусым;шілде;тамыз;қыркүйек;қазан;қараша;желтоқсан"),dddd:_("жексенбі;дүйсенбі;сейсенбі;сәрсенбі;бейсенбі;жұма;сенбі"),ddd:_("жс;дс;сс;ср;бс;жм;сб")},13,-1),"kk");te({group:",",mmmm:_("ಜನವರಿ;ಫೆಬ್ರವರಿ;ಮಾರ್ಚ್;ಏಪ್ರಿಲ್;ಮೇ;ಜೂನ್;ಜುಲೈ;ಆಗಸ್ಟ್;ಸೆಪ್ಟೆಂಬರ್;ಅಕ್ಟೋಬರ್;ನವೆಂಬರ್;ಡಿಸೆಂಬರ್"),mmm:_("ಜನವರಿ;ಫೆಬ್ರವರಿ;ಮಾರ್ಚ್;ಏಪ್ರಿ;ಮೇ;ಜೂನ್;ಜುಲೈ;ಆಗಸ್ಟ್;ಸೆಪ್ಟೆಂ;ಅಕ್ಟೋ;ನವೆಂ;ಡಿಸೆಂ"),dddd:_("ಭಾನು~;ಸೋಮ~;ಮಂಗಳ~;ಬುಧ~;ಗುರು~;ಶುಕ್ರ~;ಶನಿ~","ವಾರ"),ddd:_("ಭಾನು;ಸೋಮ;ಮಂಗಳ;ಬುಧ;ಗುರು;ಶುಕ್ರ;ಶನಿ"),ampm:_("ಪೂರ್ವಾಹ್ನ;ಅಪರಾಹ್ನ")},"kn");te({decimal:",",mmmm:_("sausio;vasario;kovo;balandžio;gegužės;birželio;liepos;rugpjūčio;rugsėjo;spalio;lapkričio;gruodžio"),mmm:_("saus.;vas.;kov.;bal.;geg.;birž.;liep.;rugp.;rugs.;spal.;lapkr.;gruod."),dddd:_("sekmadienis;pirmadienis;antradienis;trečiadienis;ketvirtadienis;penktadienis;šeštadienis"),ddd:_("sk;pr;an;tr;kt;pn;št"),ampm:_("priešpiet;popiet")},"lt");te({decimal:",",mmmm:_("janvāris;februāris;marts;aprīlis;maijs;jūnijs;jūlijs;augusts;septembris;oktobris;novembris;decembris"),mmm:_("janv.;febr.;marts;apr.;maijs;jūn.;jūl.;aug.;sept.;okt.;nov.;dec."),dddd:_("svētdiena;pirmdiena;otrdiena;trešdiena;ceturtdiena;piektdiena;sestdiena"),ddd:_("svētd.;pirmd.;otrd.;trešd.;ceturtd.;piektd.;sestd."),ampm:_("priekšpusdienā;pēcpusdienā")},"lv");te({group:",",decimal:".",mmmm:_("ജനുവരി;ഫെബ്രുവരി;മാർച്ച്;ഏപ്രിൽ;മേയ്;ജൂൺ;ജൂലൈ;ഓഗസ്റ്റ്;സെപ്റ്റംബർ;ഒക്‌ടോബർ;നവംബർ;ഡിസംബർ"),mmm:_("ജനു;ഫെബ്രു;മാർ;ഏപ്രി;മേയ്;ജൂൺ;ജൂലൈ;ഓഗ;സെപ്റ്റം;ഒക്ടോ;നവം;ഡിസം"),dddd:_("ഞായറാഴ്‌ച;തിങ്കളാഴ്‌ച;ചൊവ്വാഴ്ച;ബുധനാഴ്‌ച;വ്യാഴാഴ്‌ച;വെള്ളിയാഴ്‌ച;ശനിയാഴ്‌ച"),ddd:_("ഞായർ;തിങ്കൾ;ചൊവ്വ;ബുധൻ;വ്യാഴം;വെള്ളി;ശനി")},"ml");te({group:",",decimal:".",mmmm:_("нэгдүгээ~;хоёрдугаа~;гуравдугаа~;дөрөвдүгээ~;тавдугаа~;зургаадугаа~;долоодугаа~;наймдугаа~;есдүгээ~;аравдугаа~;арван нэгдүгээ~;арван хоёрдугаа~","р сар"),mmm:_("1~;2~;3~;4~;5~;6~;7~;8~;9~;10~;11~;12~","-р сар"),dddd:_("ням;даваа;мягмар;лхагва;пүрэв;баасан;бямба"),ddd:_("Ня;Да;Мя;Лх;Пү;Ба;Бя"),ampm:_("ү.ө.;ү.х.")},"mn");te({group:",",decimal:".",mmmm:_("जानेवारी;फेब्रुवारी;मार्च;एप्रिल;मे;जून;जुलै;ऑगस्ट;सप्टेंबर;ऑक्टोबर;नोव्हेंबर;डिसेंबर"),mmm:_("जाने;फेब्रु;मार्च;एप्रि;मे;जून;जुलै;ऑग;सप्टें;ऑक्टो;नोव्हें;डिसें"),dddd:_("रविवार;सोमवार;मंगळवार;बुधवार;गुरुवार;शुक्रवार;शनिवार"),ddd:_("रवि;सोम;मंगळ;बुध;गुरु;शुक्र;शनि")},"mr");te(Ue({group:",",decimal:".",mmmm:_("ဇန်နဝါရီ;ဖေဖော်ဝါရီ;မတ်;ဧပြီ;မေ;ဇွန်;ဇူလိုင်;ဩဂုတ်;စက်တင်ဘာ;အောက်တိုဘာ;နိုဝင်ဘာ;ဒီဇင်ဘာ"),mmm:_("ဇန်;ဖေ;မတ်;ဧ;မေ;ဇွန်;ဇူ;ဩ;စက်;အောက်;နို;ဒီ"),dddd:_("တနင်္ဂနွေ;တနင်္လာ;အင်္ဂါ;ဗုဒ္ဓဟူး;ကြာသပတေး;သောကြာ;စနေ"),ampm:_("နံနက်;ညနေ")},-1,0),"my");te({group:",",decimal:".",mmmm:_("ਜਨਵਰੀ;ਫ਼ਰਵਰੀ;ਮਾਰਚ;ਅਪ੍ਰੈਲ;ਮਈ;ਜੂਨ;ਜੁਲਾਈ;ਅਗਸਤ;ਸਤੰਬਰ;ਅਕਤੂਬਰ;ਨਵੰਬਰ;ਦਸੰਬਰ"),mmm:_("ਜਨ;ਫ਼ਰ;ਮਾਰਚ;ਅਪ੍ਰੈ;ਮਈ;ਜੂਨ;ਜੁਲਾ;ਅਗ;ਸਤੰ;ਅਕਤੂ;ਨਵੰ;ਦਸੰ"),dddd:_("ਐਤਵਾਰ;ਸੋਮਵਾਰ;ਮੰਗਲਵਾਰ;ਬੁੱਧਵਾਰ;ਵੀਰਵਾਰ;ਸ਼ੁੱਕਰਵਾਰ;ਸ਼ਨਿੱਚਰਵਾਰ"),ddd:_("ਐਤ;ਸੋਮ;ਮੰਗਲ;ਬੁੱਧ;ਵੀਰ;ਸ਼ੁੱਕਰ;ਸ਼ਨਿੱਚਰ"),ampm:_("ਪੂ.ਦੁ.;ਬਾ.ਦੁ.")},"pa");te({group:".",decimal:",",mmmm:_("ianuarie;februarie;martie;aprilie;mai;iunie;iulie;august;septem~;octom~;noiem~;decem~","brie"),mmm:_("ian.;feb.;mar.;apr.;mai;iun.;iul.;aug.;sept.;oct.;nov.;dec."),dddd:_("duminică;luni;marți;miercuri;joi;vineri;sâmbătă"),ddd:_("dum.;lun.;mar.;mie.;joi;vin.;sâm."),ampm:_("a.m.;p.m.")},"ro");te(Ue({group:".",decimal:",",mmmm:_("januar;februar;marec;april;maj;junij;julij;avgust;september;oktober;november;december"),mmm:_("jan.;feb.;mar.;apr.;maj;jun.;jul.;avg.;sep.;okt.;nov.;dec."),dddd:_("nedelja;ponedeljek;torek;sreda;četrtek;petek;sobota"),ampm:_("dop.;pop.")},-1,13),"sl");te(Ue({group:".",decimal:",",mmmm:_("јануар;фебруар;март;април;мај;јун;јул;август;септембар;октобар;новембар;децембар"),dddd:_("недеља;понедељак;уторак;среда;четвртак;петак;субота")},3,3),"sr");te({group:",",decimal:".",mmmm:_("ஜனவரி;பிப்ரவரி;மார்ச்;ஏப்ரல்;மே;ஜூன்;ஜூலை;ஆகஸ்ட்;செப்டம்பர்;அக்டோபர்;நவம்பர்;டிசம்பர்"),mmm:_("ஜன.;பிப்.;மார்.;ஏப்.;மே;ஜூன்;ஜூலை;ஆக.;செப்.;அக்.;நவ.;டிச."),dddd:_("ஞாயிறு;திங்கள்;செவ்வாய்;புதன்;வியாழன்;வெள்ளி;சனி"),ddd:_("ஞாயி.;திங்.;செவ்.;புத.;வியா.;வெள்.;சனி")},"ta");te({group:",",decimal:".",mmmm:_("జనవరి;ఫిబ్రవరి;మార్చి;ఏప్రిల్;మే;జూన్;జులై;ఆగస్టు;సెప్టెంబర్;అక్టోబర్;నవంబర్;డిసెంబర్"),mmm:_("జన;ఫిబ్ర;మార్చి;ఏప్రి;మే;జూన్;జులై;ఆగ;సెప్టెం;అక్టో;నవం;డిసెం"),dddd:_("ఆదివారం;సోమవారం;మంగళవారం;బుధవారం;గురువారం;శుక్రవారం;శనివారం"),ddd:_("ఆది;సోమ;మంగళ;బుధ;గురు;శుక్ర;శని")},"te");te({decimal:",",mmmm:_("січня;лютого;березня;квітня;травня;червня;липня;серпня;вересня;жовтня;листопада;грудня"),mmm:_("січ.;лют.;бер.;квіт.;трав.;черв.;лип.;серп.;вер.;жовт.;лист.;груд."),dddd:_("неділю;понеділок;вівторок;середу;четвер;пʼятницю;суботу"),ddd:_("нд;пн;вт;ср;чт;пт;сб"),ampm:_("дп;пп")},"uk");te({group:".",decimal:",",mmmm:_("~1;~2;~3;~4;~5;~6;~7;~8;~9;~10;~11;~12","tháng "),mmm:_("~1;~2;~3;~4;~5;~6;~7;~8;~9;~10;~11;~12","thg "),dddd:_("Chủ Nhật;Thứ Hai;Thứ Ba;Thứ Tư;Thứ Năm;Thứ Sáu;Thứ Bảy"),ddd:_("CN;Th 2;Th 3;Th 4;Th 5;Th 6;Th 7"),ampm:_("SA;CH")},"vi");te(Ue({group:"٬",decimal:"٫",ampm:_("ص;م"),mmmm:_("يناير;فبراير;مارس;أبريل;مايو;يونيو;يوليو;أغسطس;سبتمبر;أكتوبر;نوفمبر;ديسمبر"),dddd:_("الأحد;الاثنين;الثلاثاء;الأربعاء;الخميس;الجمعة;السبت"),mmmm6:_("رمضان;شوال;ذو القعدة;ذو الحجة;محرم;ربيع الأول;ربيع الآخرة;جمادى الأولى;جمادى الآخرة;رجب;شعبان;رمضان")},0,0),"ar");te({group:",",decimal:".",mmmm:_("জানুয়ারী;ফেব্রুয়ারী;মার্চ;এপ্রিল;মে;জুন;জুলাই;আগস্ট;সেপ্টেম্বর;অক্টোবর;নভেম্বর;ডিসেম্বর"),mmm:_("জানু;ফেব;মার্চ;এপ্রি;মে;জুন;জুল;আগ;সেপ্টেঃ;অক্টোঃ;নভেঃ;ডিসেঃ"),dddd:_("রবিবার;সোমবার;মঙ্গলবার;বুধবার;বৃহস্পতিবার;শুক্রবার;শনিবার"),ddd:_("রবি;সোম;মঙ্গল;বুধ;বৃহস্পতি;শুক্র;শনি")},"bn");te({group:",",decimal:".",mmmm:_("जनवरी;फ़रवरी;मार्च;अप्रैल;मई;जून;जुलाई;अगस्त;सितंबर;अक्तूबर;नवंबर;दिसंबर"),mmm:_("जन॰;फ़र॰;मार्च;अप्रैल;मई;जून;जुल॰;अग॰;सित॰;अक्तू॰;नव॰;दिस॰"),dddd:_("रविवार;सोमवार;मंगलवार;बुधवार;गुरुवार;शुक्रवार;शनिवार"),ddd:_("रवि;सोम;मंगल;बुध;गुरु;शुक्र;शनि"),ampm:_("am;pm")},"hi");const Ac={overflow:"######",dateErrorThrows:!1,dateErrorNumber:!0,bigintErrorNumber:!1,dateSpanLarge:!0,leap1900:!0,nbsp:!1,throws:!0,invalid:"######",locale:"",ignoreTimezone:!1,grouping:[3,3],indexColors:!0,skipChar:"",repeatChar:""};function Et(e,t=0){if(typeof e!="number")return e;if(e<0)return-Et(-e,t);if(t){const n=10**t||1;return Et(e*n,0)/n}return Math.round(e)}const km=1e-13;function Tc(e,t=2,n=2){const r=e<0?-1:1,s=10**(t||2),i=10**(n||2);let o=Math.abs(e),a=0,l=0,c=0,u=1,h,d;if(e=o,e%1===0)d=[e*r,1];else if(e<1e-19)d=[r,1e19];else if(e>1e19)d=[1e19*r,1];else{do if(o=1/(o-Math.floor(o)),h=u,u=u*Math.floor(o)+a,a=h,l=c,c=Math.floor(e*u+.5),c>=s||u>=i)return[r*l,a];while(Math.abs(e-c/u)>=km&&o!==Math.floor(o));d=[r*c,u]}return d}const ut=Math.floor;function yc(e,t=!0){if(t&&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 n=e+68569+2415019;const r=ut(4*n/146097);n=n-ut((146097*r+3)/4);const s=ut(4e3*(n+1)/1461001);n=n-ut(1461*s/4)+31;const i=ut(80*n/2447),o=n-ut(2447*i/80);n=ut(i/11);const a=i+2-12*n;return[100*(r-49)+s+n|0,a|0,o|0]}function Fm(e){return yc(e+1462)}function Bm(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 t=10631/30,n=8.01/60;let r=e+466935;const s=ut(r/10631);r=r-10631*s;const i=ut((r-n)/t);r=r-ut(i*t+n);const o=ut((r+28.5001)/29.5);return o===13?[30*s+i,12,30]:[30*s+i,o,r-ut(29.5001*o-29)]}function Nc(e,t=0,n=!0){const r=ut(e);return t===Wn?Bm(r):t===Lm?Fm(r):yc(r,n)}const Xr=Math.floor,ei=86400;function Po(e,t){let n=null;if(Array.isArray(e)){const[r,s,i,o,a,l]=e;n=Date.UTC(r,s==null?0:s-1,i!=null?i:1,o||0,a||0,l||0)}else if(e instanceof Date&&(n=e*1,!t||!t.ignoreTimezone)){const r=new Date;r.setUTCFullYear(e.getFullYear(),e.getMonth(),e.getDate()),r.setUTCHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),n=r*1}if(n!=null&&isFinite(n)){const r=n/864e5;return r-(r<=-25509?-25568:-25569)}return null}function $m(e,t){let n=e|0;const r=ei*(e-n);let s=Xr(r);r-s>.9999&&(s+=1,s===ei&&(s=0,n+=1));const i=s<0?ei+s:s,[o,a,l]=Nc(e,0,t&&t.leap1900),c=Xr(i/60/60)%60,u=Xr(i/60)%60,h=Xr(i)%60;return[o,a,l,c,u,h]}const Hm=["!d-m-y","!d-m-Y","!j-m-y","!j-m-Y","!d-n-y","!d-n-Y","!j-n-y","!j-n-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","d-M-y","d-M-Y","j-M-y","j-M-Y","M-d-y","M-d-Y","M-j-y","M-j-Y","d-F-y","d-F-Y","F-d-y","F-d-Y","F-j-y","F-j-Y","j-F-y","j-F-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"],jm={j:"d",d:"d",D:"ddd",l:"dddd",n:"m",m:"m",M:"mmm",F:"mmmm",y:"yy",Y:"yyyy"},Wm={j:"dd",d:"dd",D:"ddd",l:"dddd",n:"mm",m:"mm",M:"mmm",F:"mmmm",y:"yy",Y:"yyyy"},Mc={},Dc={};function ct(e,t,n=1){if(e){const r=e[0],s=e.slice(1);r==="!"?ct(s,t,4):r==="?"?ct(s,t,2):(t[r]=t[r]||{},ct(s,t[r],n))}else t.$=n}function wa(e,t){ct(e,t),ct(e+" x",t),ct(e+" l",t),ct(e+" l x",t),ct("l "+e,t),ct("l "+e+" x",t),ct(e+" D",t),ct(e+" D x",t),ct("D "+e,t),ct("D "+e+" x",t)}Hm.forEach(e=>{e[0]!=="?"&&wa(e,Mc),e[0]!=="!"&&wa(e,Dc)});const Ym=new Date().getUTCFullYear(),ba=".",Gm=",",ti=" ",Ir=" ",Sr=" ",Es="'",Cs="٬",Vm={".":[Gm,Ir,Sr,Es,Cs],",":[ba,Ir,Sr,Es,Cs],"٫":[ba,Ir,Sr,Es,Cs]},ni=e=>e&&e.length===1&&e>="0"&&e<="9";function Lc(e,t={}){const n=qn(t.locale||"")||nn,r=n.decimal,s=[...Vm[r]||[Es,Cs]];!s.includes(n.group)&&n.group!==ti&&n.group!==r&&s.push(n.group);let i="",o="",a=1,l="",c=!1,u=!1,h=!1,d=!1,f=!1,g=null,p=!1,R=0;const b=[ti,Ir,Sr,"+","%","(","-"].concat(Pi);for(;b.includes(e[R]);){const w=e[R];if(w==="-"){if(c||u)return null;c=!0,a=-1}else if(ki.test(w)){if(f)return null;f=!0,g=w}else if(w==="("){if(u||c)return null;u=!0,a=-1}else if(w==="%"){if(d)return null;d=!0}R++}let $=!1,k;if(e[R]===r||ni(e[R]))for(;R<e.length;){const w=e[R];if(!k&&s.includes(w))k=w;else if(!(k&&k===w))if(w===r){if($)break;i+=".",$=!0}else if(ni(w))i+=w;else break;R++}if(e[R]==="e"||e[R]==="E"){o+=e[R],R++,(e[R]==="+"||e[R]==="-")&&(o+=e[R],R++);const w=R;for(;ni(e[R]);)o+=e[R],R++;if(w===R)return null}const W=[ti,Ir,Sr,"%","$",")"].concat(Pi);for(;W.includes(e[R]);){const w=e[R];if(ki.test(w)){if(f)return null;f=!0,g=w,p=!0}else if(w===")"){if(h||!u)return null;h=!0}else if(w==="%"){if(d)return null;d=!0}R++}if(R!==e.length)return null;let O=parseFloat(i+o);if(!isFinite(O))return null;if(o){if(d||f)return null;l="0.00E+00"}else if(d){if(f)return null;l=i.includes(".")?"0.00%":"0%",O*=.01}else if(f){const w=i.includes(".")?"#,##0.00":"#,##0";p?l=w+g:l=g+w}else k&&(l=i.includes(".")?"#,##0.00":"#,##0");const C={v:O*a};return l&&(C.z=l),C}function zm(e,t,n){if(n<1||t<1||t>12)return!1;if(t===2){const s=e%4===0&&e%100!==0||e%400===0||e===1900?29:28;if(n>s)return!1}else if((t===4||t===6||t===9||t===11)&&n>30||(t===1||t===3||t===5||t===7||t===8||t===10||t===12)&&n>31)return!1;return!0}const Aa=(e,t,n=!1)=>{for(const r of t)if(e.startsWith(r[0])){let s=r[0].length;return n&&(r[2]==="D"||r[2]==="M")&&e[s]==="."&&s++,[e.slice(0,s),r]}return["",null]},Lt=(e,t,n,r)=>{const s=n.path||"",i=Object.keys(t);for(let o=0;o<i.length;o++){let a;const l=i[o];if(t[l]){if(l==="$"||l==="€")e||(a=n);else if(l==="-"){const c=/^(\s*([./-]|,\s)\s*|\s+)/.exec(e);if(c){const u=c[1]==="-"||c[1]==="/"||c[1]==="."?c[1]:" ";if(!n.sep||n.sep===u){const h=c[0].replace(/\s+/g," ");a=Lt(e.slice(c[0].length),t[l],{...n,sep:u,path:s+h},r)}}}else if(l===" "){const c=/^[,.]?\s+/.exec(e);if(c){const u=c[0].replace(/\s+/g," ");a=Lt(e.slice(c[0].length),t[l],{...n,path:s+u},r)}}else if(l==="j"||l==="d"){const c=/^(0?[1-9]|1\d|2\d|3[01])\b/.exec(e);c&&(a=Lt(e.slice(c[0].length),t[l],{...n,day:c[0],path:s+l},r))}else if(l==="n"||l==="m"){const c=/^(0?[1-9]|1[012])\b/.exec(e);c&&(a=Lt(e.slice(c[0].length),t[l],{...n,month:+c[0],_mon:c[0],path:s+l},r))}else if(l==="F"||l==="M"){const[c,u]=Aa(e,r.mon,r.mp);u&&u[2]===l&&(a=Lt(e.slice(c.length),t[l],{...n,month:u[1],_mon:c,path:s+l},r))}else if(l==="l"||l==="D"){const[c,u]=Aa(e,r.day,r.dp);u&&u[2]===l&&(a=Lt(e.slice(c.length),t[l],{...n,path:s+l},r))}else if(l==="y"){const c=/^\d\d\b/.exec(e);if(c){const u=+c[0]>=30?+c[0]+1900:+c[0]+2e3;a=Lt(e.slice(c[0].length),t[l],{...n,year:u,path:s+l},r)}}else if(l==="Y"){const c=/^\d\d\d\d\b/.exec(e);c&&(a=Lt(e.slice(c[0].length),t[l],{...n,year:+c[0],path:s+l},r))}else if(l==="x"){const c=ko(e,{locale:r.locale});c&&(a=Lt("",t[l],{...n,time:c.v,tf:c.z,path:s+l},r))}else throw new Error(`Unknown date token "${l}"`);if(a&&zm(n.year||1916,n.month||1,n.day?+n.day:1))return a}}},xc=e=>e.replace(/\s+/g," ").trim().replace(/’/,"'").replace(/\.$/,"").toLowerCase(),qr=(e,t)=>{const n=e.map((r,s)=>[xc(r),s+1,t]);return n.sort((r,s)=>s[0].length-r[0].length),n};function Uc(e,t={}){var i;const n=qn(t.locale||"")||nn,r={mon:qr(n.mmmm,"F").concat(qr(n.mmm,"M")),mp:n.mmm[0].at(-1)===".",day:qr(n.dddd,"l").concat(qr(n.ddd,"D")),dp:n.ddd[0].at(-1)===".",locale:t.locale},s=Lt(xc(e),n.preferMDY?Dc:Mc,{path:""},r);if(s){if(s.sep==="."&&s.path.length===3)return null;const o=+((i=s.year)!=null?i:Ym);s.day||(s.day=1);let a=-1/0;if(o<1900)return null;o<=1900&&s.month<=2?a=25568:o<1e4&&(a=25569);const l=Date.UTC(o,s.month-1,s.day)/864e5+a+(s.time||0);if(l>=0&&l<=2958465){const c=s._mon[0]==="0"||s.day[0]==="0"||s._mon.length===2&&s.day.length===2,u=s.path.replace(/[jdlDnmMFyYx]/g,h=>h==="x"?s.tf||"":(c?Wm[h]:jm[h])||h);return{v:l,z:u}}}return null}const ri=e=>e.replace(/\s+/g,"").trim().replace(/\./g,"").toLowerCase();function ko(e,t={}){const n=qn(t.locale||"")||nn,r=/^\s*([10]?\d|2[0-4])(?::([0-5]\d|\d))?(?::([0-5]\d|\d))?(\.\d{1,10})?(?=\s*[^\s\d]|$)/.exec(e);let s="";if(r){const i=ri(e.slice(r[0].length));if(i===ri(n.ampm[0])||i==="a"||i==="am")s="a";else if(i===ri(n.ampm[1])||i==="p"||i==="pm")s="p";else if(i)return null}if(r){const[,i,o,a,l]=r;if(l&&!a||!s&&!o&&!a)return null;let c=+(i||0)*1;if(s){if(c>=13)return null;s==="p"&&(c+=12)}const u=+(o||0)*1,h=+(a||0)*1,d=+(l||0)*1;return{v:(c*60*60+u*60+h+d)/(60*60*24),z:(i.length===2?"hh":"h")+":mm"+(a?":ss":"")+(s?" AM/PM":"")}}return null}function Pc(e,t={}){const n=qn(t.locale||"")||nn,r=e.trim().toLowerCase(),s=n.bool[0].toLowerCase();if(r==="true"||r===s)return{v:!0};const i=n.bool[1].toLowerCase();return r==="false"||r===i?{v:!1}:null}function Km(e,t){var n,r,s;return(s=(r=(n=Lc(e,t))!=null?n:Uc(e,t))!=null?r:ko(e,t))!=null?s:Pc(e,t)}function hn(e,t,n){return t[n+"_max"]=e.length,t[n+"_min"]=e.replace(/#/g,"").length,t}function Ye(e,t){typeof e=="string"?t.push({type:"string",value:e}):t.push(e)}function Ta(e,t){const n=e&&e.type;return n===oo||n===Yn||n===ao||n===$s&&t==="den"}function mr(e){var k,W,O;const t=[],n={scale:1,percent:!1,text:!1,date:0,date_eval:!1,date_system:va,sec_decimals:0,general:!1,clock:24,int_pattern:[],frac_pattern:[],man_pattern:[],den_pattern:[],num_pattern:[],tokens:t};let r="int",s=null;const i=[];let o,a=!1,l=-1,c=!1,u="",h=!1;for(;++l<e.length&&!c;){const C=e[l],w=C.type||Tr;if(u+=C.raw,w===io)n.general=!0,Ye(C,t);else if(Ta(C,r)){const T=n[r+"_pattern"];Ta(o,r)||(o==null?void 0:o.type)===Ar?(T.push((T.pop()||"")+C.value),s.num+=C.value):(T.push(C.value),s={type:r,num:C.value},Ye(s,t))}else if(w===No)C.value==="("&&(n.parens=!0),Ye(C.value,t);else if(w===$s)Ye(C.value,t);else if(w===lo)if(h=!0,n[r+"_pattern"].length){if(!s)throw new SyntaxError("Format pattern is missing a numerator");n.fractions=!0,n.num_pattern.push(n[r+"_pattern"].pop()),s.type="num",r="den",Ye({type:"div"},t)}else Ye(C.value,t);else if(w===co)Ye(",",t);else if(w===ws)n.scale=.001**C.raw.length;else if(w===Ar){if(r==="int"&&(n.grouping=!0),r==="den")throw new SyntaxError("Cannot group denominator digits")}else if(w===mo)Ye(C,t);else if(w===uo){c=!0;break}else if(w===Bs)n.text=!0,Ye(C,t);else if(w===ho||w===fo)Ye(C,t);else if(w===Eo){const T=C.value.toLowerCase(),F=T[0],B={type:"",size:0,date:1,pad:T.length};F==="h"?(B.size=hr,B.type="hour-elap"):F==="m"?(B.size=dr,B.type="min-elap"):(B.size=fr,B.type="sec-elap"),n.date=n.date|B.size,i.push(B),Ye(B,t)}else if(n.date&&w===bs&&((k=e[l+1])==null?void 0:k.type)===Yn){let T=1;l++;let F="0";((W=e[l+1])==null?void 0:W.type)===Yn&&(F+="0",T=2,l++),((O=e[l+1])==null?void 0:O.type)===Yn&&(F+="0",T=3,l++),u+=F;const B=[fr,Li,xi,Ui][T];n.date=n.date|B,n.date_eval=!0,n.sec_decimals=Math.max(n.sec_decimals,T),Ye({type:"subsec",size:B,decimals:T,date:1},t)}else if(w===_o)a||(C.value==="B2"||C.value==="b2"?n.date_system=Wn:n.date_system=va);else if(w===po){const T={type:"",size:0,date:1},F=C.value.toLowerCase(),B=F[0];if(F==="y"||F==="yy")T.size=cr,T.type="year-short";else if(B==="y"||B==="e")T.size=cr,T.type="year";else if(F==="b"||F==="bb")T.size=cr,T.type="b-year-short";else if(B==="b")T.size=cr,T.type="b-year";else if(F==="d"||F==="dd")T.size=ps,T.type="day",T.pad=/dd/.test(F);else if(F==="ddd"||F==="aaa")T.size=ps,T.type="weekday-short";else if(B==="d"||B==="a")T.size=ps,T.type="weekday";else if(B==="h")T.size=hr,T.type="hour",T.pad=/hh/i.test(F);else if(B==="m"){F.length===3?(T.size=ur,T.type="monthname-short"):F.length===5?(T.size=ur,T.type="monthname-single"):F.length>=4&&(T.size=ur,T.type="monthname");const m=i[i.length-1];!T.type&&m&&!m.used&&m.size&(hr|fr)&&(m.used=!0,T.size=dr,T.type="min",T.pad=/mm/.test(F)),T.type||(T.size=ur,T.type="month",T.pad=/mm/.test(F),T.indeterminate=!0)}else if(B==="s"){T.size=fr,T.type="sec",T.pad=/ss/.test(F);const m=i[i.length-1];m&&m.size&dr?T.used=!0:m&&m.indeterminate&&(delete m.indeterminate,m.size=dr,m.type="min",T.used=!0)}n.date=n.date|T.size,n.date_eval=!0,i.push(T),Ye(T,t)}else if(w===vo)n.clock=12,n.date=n.date|hr,n.date_eval=!0,C.short=C.value==="A/P",Ye(C,t);else if(w===bo||w===wo||w===Hs)Ye(C.value,t);else if(w===Co)n.condition=[C.value[0],parseFloat(C.value[1])];else if(w===So){const T=C.value.split("-"),F=T.length<2?"":T.slice(1).join("-"),B=T[0];B&&Ye(B,t);const m=Do(F);m&&(n.locale=m);const x=parseInt(F,16);isFinite(x)&&x&16711680&&(x>>16&255)===6&&(n.date_system=Wn),a=!0}else if(w===Oo){let T,F=C.value.toLowerCase();(T=/^color\s*(\d+)$/i.exec(F))&&(F=parseInt(T[1],10)),n.color=F}else if(w===go)n.scale=100,n.percent=!0,Ye("%",t);else if(w===bs)Ye(C,t),n.date||(n.dec_fractions=!0,r="frac");else if(w===To)n.exponential=!0,n.exp_plus=C.value.includes("+"),r="man",Ye({type:"exp",plus:n.exp_plus},t);else if(w===Ao)Ye(C,t);else if(w===yo)Ye(C,t);else if(!(w===Ro||w===Io))throw w===Tr?new SyntaxError(`Illegal character: ${u}`):new SyntaxError(`Unknown token ${w} in ${u}`);o=C}if(n.tokensUsed=l,n.pattern=u,/^((?:\[[^\]]+\])+)(;|$)/.test(n.pattern)&&!/^\[(?:h+|m+|s+)\]/.test(n.pattern)&&Ye({type:"text"},t),n.fractions&&n.dec_fractions||n.grouping&&!n.int_pattern.length||n.fractions&&n.exponential||n.fractions&&n.den_pattern.length*n.num_pattern.length===0||h&&!n.fractions&&!n.date||n.exponential&&(n.int_pattern.length||n.frac_pattern.length)*n.man_pattern.length===0)throw new SyntaxError(`Invalid pattern: ${u}`);const d=n.int_pattern.join(""),f=n.man_pattern.join(""),g=n.frac_pattern.join("");hn(d,n,"int");let p=0;for(let C=0;C<d.length;C++){const w=d[d.length-1-C];/^[0-9?]/.test(w)&&(p=C+1)}n.int_min=p,hn(g,n,"frac"),hn(f,n,"man");let R=n.num_pattern.join(""),b=n.den_pattern[0]||"";if(b.includes("?")||R.includes("?")?(b=b.replace(/\d/g,"?"),b=b.replace(/#$/g,"?"),hn(R,n,"num"),hn(b,n,"den"),R=R.replace(/#$/g,"?")):(hn(R,n,"num"),hn(b,n,"den")),n.int_p=d,n.man_p=f,n.num_p=R,n.den_p=b,n.den_pattern.length&&(n.denominator=parseInt(n.den_pattern.join("").replace(/\D/g,""),10)),n.integer=!!d.length,!n.integer&&!n.exponential&&g.length){const C=n.tokens.findIndex(w=>w.type==="point");n.tokens.splice(C,0,{type:"int",value:"#"}),n.integer=!0,n.int_pattern=["#"],n.int_p="#"}if(n.fractions)for(let C=0;C<t.length-1;C++){const w=t[C];if(w.type!=="string"&&w.type!=="space")continue;const T=t[C+1].type;T==="num"?w.rule="num+int":T==="div"?w.rule="num":T==="den"&&(w.rule="den")}return n.grouping&&n.int_pattern.length>1&&(n.grouping=!1),n}function Xm(e){if(e===0)return e;const t=Math.ceil(Math.log10(e<0?-e:e)),n=10**(16-Math.floor(t));return isFinite(n)?Math.round(e*n)/n:0}const qm={total:1,sign:0,period:0,int:1,frac:0};function Zm(e,t=!0){const n=Math.abs(e);if(!n)return qm;const r=t&&e<0?1:0,s=Math.floor(n),i=Math.floor(Math.log10(n)+1);let o=0,a=0;if(s!==n){o=1;const l=String(Et(n*10**-i,15));let c=l.length,u=!0,h=0;for(;h<=l.length;){if(l[h]==="."){c--;break}else l[h]==="0"&&u?c--:u=!1;h++}a=c-i,a<0&&(a=0,o=0)}return{total:r+Math.max(i,1)+o+a,digits:Math.max(i,0)+a,sign:r,period:o,int:Math.max(i,1),frac:a}}const Nn=(e,t)=>e.replace(/\./,t.decimal),ya=(e,t,n)=>{const r=Math.abs(t);let s;return e===1?s=e:s=Et(e,5),[Nn(s+"",n),n.exponent,t<0?n.negative:n.positive,r<10?"0":"",r]};function Na(e,t,n,r){const s=n|0;if(typeof n=="string")e.push(n);else if(n===s)e.push(Math.abs(s));else{const i=Math.abs(n);let o=i?Math.floor(Math.log10(i)):0,a=i*10**-o;a===10&&(a=1,o++);const l=Zm(i);if(o>=-4&&o<=-1){const c=i.toPrecision(10+o).replace(/\.?0+$/,"");e.push(Nn(c,r))}else if(o===10){const c=i.toFixed(10).slice(0,12).replace(/\.$/,"");e.push(Nn(c,r))}else if(Math.abs(o)<=9)if(l.total<=11){const c=Et(i,9).toFixed(l.frac);e.push(Nn(c,r))}else o===9?e.push(Math.floor(i)):o>=0&&o<9?e.push(Nn(String(Et(i,9-o)),r)):e.push(...ya(a,o,r));else l.total>=12?e.push(...ya(a,o,r)):e.push(Nn(Et(i,9).toFixed(l.frac),r))}return e}function dn(e,t=!1){return e==="0"?"0":e==="?"?t?" ":" ":""}const er=86400,Ma=(e,t=0)=>{const n=Math.floor(Math.log10(e));return t>1?Math.floor(n/t)*t:n},Jm=(e,t,n)=>n?e<Mm||t>=Dm:e<ym||t>=Nm;function Da(e,t,n,r){var A,v;let s="",i="",o="",a="",l="",c="",u=0,h=0;if(typeof e=="bigint"){if(e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER)e=Number(e);else return n.bigintErrorNumber?String(e):n.overflow;h=e}else h=Math.trunc(e);let d=0,f=0,g=1,p=0,R=0,b=0,$=0,k=0,W=0;const O=r||nn;if(!t.text&&isFinite(t.scale)&&t.scale!==1&&(e=Xm(e*t.scale)),t.exponential){let y=Math.abs(e);if(y){const M=10**-Ma(y,t.int_max),D=Et(y*M,t.frac_max)/M;u=Ma(D,t.int_max)}e&&!t.integer&&u++,y=y*10**-u,e=e<0?-y:y,s+=Math.abs(u)}if(t.integer){const y=Math.abs(Et(e,t.fractions?1:t.frac_max));c+=y<1?"":Math.floor(y)}const C=(A=n.grouping[0])!=null?A:3,w=(v=n.grouping[1])!=null?v:C;t.dec_fractions&&(l=String(Et(e,t.frac_max)).split(".")[1]||"");const T=!t.error&&(t.num_p.includes("0")||t.den_p.includes("0"));let F=T;if(t.fractions){F=T||!!(e%1);const y=Math.abs(t.integer?e%1:e);if(y)if(F=!0,t.denominator&&isFinite(t.denominator))a+=t.denominator,o+=Et(y*t.denominator),o==="0"&&(o="",a="",F=T);else{const M=Tc(y,1/0,t.den_max);o+=M[0],a+=M[1],t.integer&&o==="0"&&(o="",a="",F=T)}else!e&&!t.integer&&(F=!0,o="0",a="1");t.integer&&!F&&!Math.trunc(e)&&(c="0")}if(t.date){h=Math.trunc(e);const y=er*(e-h);if(d=Math.floor(y),W=y-d,Math.abs(W)<1e-6?W=0:W>.9999&&(W=0,d+=1,d===er&&(d=0,h+=1)),W){const M=t.date&Ui||t.date&xi||t.date&Li;(M===Ui&&W>.9995||M===xi&&W>.995||M===Li&&W>.95||!M&&W>=.5)&&(d++,W=0)}if(h||t.date_system){const M=Nc(e,t.date_system,n.leap1900);f=M[0],g=M[1],p=M[2]}if(d){const M=d<0?er+d:d;k=Math.floor(M)%60,$=Math.floor(M/60)%60,b=Math.floor(M/60/60)%60}if(R=(6+h)%7,t.date_eval&&Jm(e,h+d/er,n.dateSpanLarge)){if(n.dateErrorThrows)throw new Error("Date out of bounds");if(n.dateErrorNumber){const M=e<0?[O.negative]:[];return Na(M,{},e,O).join("")}return n.overflow}}const B=dn("?",n.nbsp);u<0?i="-":t.exp_plus&&(i="+");const m=[],x=(y,M,D,P)=>{const J=!P&&y.length>M.length?D.length+y.length-M.length:D.length;y.length<M.length&&(P+=y.length-M.length);for(let V=0;V<J;V++)m.push(y[V+P]||dn(D[V],n.nbsp));return J};let S=!1;const N={int:0,frac:0,man:0,num:0,den:0};for(let y=0,M=t.tokens.length;y<M;y++){const D=t.tokens[y],P=D.type,J=D.num?D.num.length:0;if(P==="string")D.rule?D.rule==="num"?F?m.push(D.value.replace(/ /g,B)):(t.num_min>0||t.den_min>0)&&m.push(D.value.replace(/./g,B)):D.rule==="num+int"?F&&c?m.push(D.value.replace(/ /g,B)):t.den_min>0&&(c||t.num_min)&&m.push(D.value.replace(/./g,B)):D.rule==="den"&&(F?m.push(D.value.replace(/ /g,B)):(t.den_min>0||t.den_min>0)&&m.push(D.value.replace(/./g,B))):m.push(D.value.replace(/ /g,B));else if(P==="space")D.rule==="num+int"?(F||t.num_min||t.den_min)&&(c||t.num_min)&&m.push(B):m.push(B);else if(P==="error")m.push(n.invalid);else if(P==="point")m.push(t.date?D.value:O.decimal);else if(P==="general")Na(m,t,e,O);else if(P==="exp")m.push(O.exponent);else if(P==="minus")D.volatile&&t.date||D.volatile&&(e>=0||typeof e!="number")||(D.volatile&&!t.fractions&&(t.integer||t.dec_fractions)?(e<0&&c&&c!=="0"||l)&&m.push(O.negative):m.push(O.negative));else if(P==="plus")m.push(O.positive);else if(P==="text")m.push(e);else if(P==="fill")n.fillChar&&m.push(n.fillChar,D.value);else if(P==="skip")n.skipChar?m.push(n.skipChar,D.value):m.push(n.nbsp?" ":" ");else if(P==="div")F?m.push("/"):t.num_min>0||t.den_min>0?m.push(B):m.push(dn("#",n.nbsp));else if(P==="int")if(t.int_pattern.length===1){const V=t.int_p,oe=Math.max(t.int_min,c.length);let le="";for(let I=oe;I>0;I--){const L=c.charAt(c.length-I),Y=L?"":V.charAt(V.length-I)||V[0];let G="";if(t.grouping){const H=I-1-C;H>=0&&!(H%w)&&(G=L||Y==="0"?O.group:dn("?",n.nbsp))}le+=(L||dn(Y,n.nbsp))+G}m.push(le)}else N.int+=x(c,t.int_p,D.num,N.int);else if(P==="frac"){const V=N.frac;for(let oe=0;oe<J;oe++)m.push(l[oe+V]||dn(D.num[oe],n.nbsp));N.frac+=J}else if(P==="man")!N[P]&&!N.man&&m.push(i),N.man+=x(s,t.man_p,D.num,N.man);else if(P==="num")N.num+=x(o,t.num_p,D.num,N.num);else if(P==="den"){const V=N.den;for(let oe=0;oe<J;oe++){let le=a[oe+V];if(!le){const I=D.num[oe];"123456789".includes(I)||S&&I==="0"?(S=!0,le=n.nbsp?" ":" "):!S&&oe===J-1&&I==="0"&&!a?le="1":le=dn(I,n.nbsp)}m.push(le)}N.den+=J}else if(P==="year")f<0&&m.push(O.negative),m.push(String(Math.abs(f)).padStart(4,"0"));else if(P==="year-short"){const V=f%100;m.push(V<10?"0":"",V)}else if(P==="month")m.push(D.pad&&g<10?"0":"",g);else if(P==="monthname-single")t.date_system===Wn?m.push(O.mmmm6[g-1].charAt(0)):m.push(O.mmmm[g-1].charAt(0));else if(P==="monthname-short")t.date_system===Wn?m.push(O.mmm6[g-1]):m.push(O.mmm[g-1]);else if(P==="monthname")t.date_system===Wn?m.push(O.mmmm6[g-1]):m.push(O.mmmm[g-1]);else if(D.type==="weekday-short")m.push(O.ddd[R]);else if(P==="weekday")m.push(O.dddd[R]);else if(P==="day")m.push(D.pad&&p<10?"0":"",p);else if(P==="hour"){const V=b%t.clock||(t.clock<24?t.clock:0);m.push(D.pad&&V<10?"0":"",V)}else if(P==="min")m.push(D.pad&&$<10?"0":"",$);else if(P==="sec")m.push(D.pad&&k<10?"0":"",k);else if(P==="subsec"){m.push(O.decimal);const V=W.toFixed(t.sec_decimals);m.push(V.slice(2,2+D.decimals))}else if(P==="ampm"){const V=b<12?0:1;D.short&&!r?m.push("AP"[V]):m.push(O.ampm[V])}else if(P==="hour-elap"){e<0&&m.push(O.negative);const V=h*24+Math.floor(Math.abs(d)/(60*60));m.push(String(Math.abs(V)).padStart(D.pad,"0"))}else if(P==="min-elap"){e<0&&m.push(O.negative);const V=h*1440+Math.floor(Math.abs(d)/60);m.push(String(Math.abs(V)).padStart(D.pad,"0"))}else if(P==="sec-elap"){e<0&&m.push(O.negative);const V=h*er+Math.abs(d);m.push(String(Math.abs(V)).padStart(D.pad,"0"))}else if(P==="b-year")m.push(f+543);else if(P==="b-year-short"){const V=(f+543)%100;m.push(V<10?"0":"",V)}}return m.join("")}const Qm=mr([{type:Bs,value:"@",raw:"@"}]);function kc(e,t){for(let n=0;n<3;n++){const r=t[n];if(r){let s;if(r.condition){const i=r.condition[0],o=r.condition[1];i==="="?s=e===o:i===">"?s=e>o:i==="<"?s=e<o:i===">="?s=e>=o:i==="<="?s=e<=o:i==="<>"&&(s=e!==o)}else s=!0;if(s)return r}}}function eg(e,t,n){const r=t.partitions;let s=r[3],i=null;return(typeof e=="number"||typeof e=="bigint")&&isFinite(e)&&(s=kc(e,r)),s&&s.color&&(i=s.color),i&&typeof i=="number"&&n.indexColors&&(i=xm[i-1]||"#000"),i}function tg(e,t,n){const r=t.partitions,s=qn(t.locale||n.locale),i=r[3]?r[3]:Qm;if(typeof e=="boolean"&&(e=(s||nn).bool[e?0:1]),e==null)return"";const o=typeof e=="bigint";if(typeof e!="number"&&!o)return Da(e,i,n,s);if(!o&&!isFinite(e)){const l=s||nn;return isNaN(e)?l.nan:(e<0?l.negative:"")+l.infinity}const a=kc(e,r);return a?Da(e,a,n,s):n.overflow}function Fc(e){return!!(e[0]&&e[0].percent||e[1]&&e[1].percent||e[2]&&e[2].percent||e[3]&&e[3].percent)}function Bc(e){return!!(e[0]&&e[0].date||e[1]&&e[1].date||e[2]&&e[2].date||e[3]&&e[3].date)}function $c(e){const[t,n,r,s]=e;return!!((!t||t.generated)&&(!n||n.generated)&&(!r||r.generated)&&s&&s.text&&!s.generated)}const ng={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},rg=[["DMY",1],["DM",2],["MY",3],["MDY",4],["MD",5],["hmsa",6],["hma",7],["hms",8],["hm",9]];function sg(e,t=null){var h;const[n,r]=e,s=n.frac_max,i={type:"general",isDate:Bc(e),isText:$c(e),isPercent:Fc(e),maxDecimals:n.general?9:s,scale:(h=n.scale)!=null?h:1,color:0,parentheses:0,grouped:n.grouping?1:0},o=!i.isDate&&!i.isText&&!n.error&&n.tokens.some(d=>d.type==="string"&&(t?d.value===t:ki.test(d.value)));let a="G",l=s>=0?Math.min(15,s):"",c="",u="";if(r&&r.color&&(u="-",i.color=1),n.parens&&(c="()",i.parentheses=1),o)a="C",i.type="currency";else if(n.error)i.type="error",i.maxDecimals=0;else if(i.isDate){let d=0,f=0,g="";n.tokens.forEach(R=>{const b=R.type;/^(b-)?year/.test(b)?(g+="Y",f++):b.startsWith("month")?(g+="M",f++):/^(week)?day/.test(b)?(g+="D",f++):(b==="hour"||b==="min"||b==="sec"||b==="ampm")&&(g+=b[0],d++)}),i.type="date",f&&d?i.type="datetime":!f&&d&&(i.type="time");const p=rg.find(R=>g.startsWith(R[0]));a=p?"D":"G",l=p?p[1]:""}else i.isText?(a="G",i.type="text",l="",i.maxDecimals=0):n.general?(a="G",i.type="general",l=""):n.fractions?(a="G",i.type="fraction",l=""):n.exponential?(a="S",i.type="scientific"):i.isPercent?(a="P",i.type="percent"):n.grouping?(a=",",i.type="grouped"):(n.int_max||s)&&(a="F",i.type="number");return i.code=a+l+u+c,i.level=ng[i.type],Object.freeze(i)}function ig(e){const[t]=e;return{year:!!(t.date&cr),month:!!(t.date&ur),day:!!(t.date&ps),hours:!!(t.date&hr),minutes:!!(t.date&dr),seconds:!!(t.date&fr),clockType:t.clock===12?12:24}}const og=[[io,/^General/i,0],[oo,/^#/,0],[Yn,/^0/,0],[ao,/^\?/,0],[lo,/^\//,0],[uo,/^;/,0],[Bs,/^@/,0],[ho,/^\+/,0],[fo,/^-/,0],[bs,/^\./,0],[mo,/^ /,0],[go,/^%/,0],[$s,/^[1-9]/,0],[_o,/^(?:B[12])/i,0],[Tr,/^B$/,0],[po,/^(?:[hH]+|[mM]+|[sS]+|[yY]+|[bB]+|[dD]+|[gG]+|[aA]{3,}|e+)/,0],[Eo,/^(?:\[(h+|m+|s+)\])/i,1],[Co,/^\[(<[=>]?|>=?|=)\s*(-?[.\d]+)\]/,[1,2]],[Ro,/^\[(DBNum[0-4]?\d)\]/i,1],[Io,/^\[(NatNum[0-4]?\d)\]/i,1],[So,/^\[\$([^\]]+)\]/,1],[Oo,/^\[(black|blue|cyan|green|magenta|red|white|yellow|color\s*\d+)\]/i,1],[Ic,/^\[([^\]]+)\]/,1],[vo,/^(?:AM\/PM|am\/pm|A\/P)/,0],[wo,/^\\(.)/,1],[bo,/^"([^"]*?)"/,1],[Ao,/^_(\\.|.)/,1],[To,/^[Ee]([+-])/,1],[yo,/^\*(\\.|.)/,1],[No,/^[()]/,0],[Tr,/^[EÈÉÊËèéêëĒēĔĕĖėĘęĚěȄȅȆȇȨȩNnÑñŃńŅņŇňǸǹ["*/\\_]/,0],[Hs,/^./,0]],ag=63,lg=35,cg=48,ug=57,si=e=>{const t=(e||"\0").charCodeAt(0);return t===ag||t===lg||t>=cg&&t<=ug};function kn(e){let t=0;const n=[],r=[];for(;t<e.length;){const s=e.slice(t);let i=0;const o=/^(,+)(.)?/.exec(s);if(o){const a=o[1];i=a.length;const l=e[t-1]||"";let c=!1,u=!1;si(l)?(c=!0,u=!0):l==="."&&(u=!0);const h=o[2]||"";if(c&&(!h||h===";")&&(c=!1),u&&si(h)&&(u=!1),c&&!u)n.push({type:Ar,value:",",raw:a});else if(!c&&u)n.push({type:ws,value:",",raw:a});else if(c&&u){const d={type:ws,value:",",raw:a};n.push(d),r.push(d)}else n.push({type:co,value:",",raw:a})}else{let a;for(const[l,c,u]of og){const h=c.exec(s);if(h){const d=Array.isArray(u)?u.map(f=>h[f]):h[u||0];a={type:l,value:d,raw:h[0]},n.push(a),i=h[0].length;break}}r.length&&a.raw===";"&&(r.length=0),r.length&&si(a.raw)&&(r.forEach(l=>l.type=Ar),r.length=0)}if(!i){const a=s[0];i=1,n.push({type:Hs,value:a,raw:a})}t+=i}return n}const ii=e=>{const t=e.condition;t&&t[1]<0&&(t[0]==="<"||t[0]==="<="||t[0]==="=")||e.tokens.unshift({type:"minus",volatile:!0})},La=(e,t=null)=>{const n={};for(const r in e)Array.isArray(e[r])?n[r]=[...e[r]]:n[r]=e[r];return t&&n.tokens.unshift(t),n.generated=!0,n};function hg(e){var h;const t=[];let n=!1,r,s=null,i=0,o=!1,a=0,l=0,c=kn(e);do{if(o=mr(c),(o.date||o.general)&&(o.int_pattern.length||o.frac_pattern.length||o.scale!==1||o.text))throw new Error("Illegal format");if(o.condition&&(l++,n=!0),o.text){if(s)throw new Error("Unexpected partition");s=o}o.locale&&(r=Do(o.locale)),t.push(o),i=((h=c[o.tokensUsed])==null?void 0:h.type)==="break"?1:0,c=c.slice(o.tokensUsed+i),a++}while(i&&a<4&&l<3);if(i)throw new Error("Unexpected partition");if(l>2)throw new Error("Unexpected condition");const u=t[3];if(u&&(u.int_pattern.length||u.frac_pattern.length||u.date))throw new Error("Unexpected partition");if(n){const d=t.length;if(d===1&&(t[1]=mr(kn("General")),t[1].generated=!0),d<3){const f=t[0],g=t[1];if(ii(f),g.condition)ii(g);else{const p=f.condition;(p[0]==="="||p[1]>=0&&(p[0]===">"||p[0]===">="))&&g.tokens.unshift({type:"minus",volatile:!0})}}else t.forEach(ii)}else{if(t.length<4&&s)for(let d=0,f=t.length;d<f;d++)t[d]===s&&t.splice(d,1);if(t.length<1&&s&&(t[0]=mr(kn("General")),t[0].generated=!0),t.length<2){const d={type:"minus",volatile:!0};t.push(La(t[0],d))}if(t.length<3&&t.push(La(t[0])),t.length<4)if(s)t.push(s);else{const d=mr(kn("@"));d.generated=!0,t.push(d)}t[0].condition=[">",0],t[1].condition=["<",0],t[2].condition=null}return{pattern:e,partitions:t,locale:r}}const xa=Object.create({});function on(e,t=!1){e||(e="General");let n=xa[e];if(!n)try{n=hg(e),xa[e]=n}catch(r){if(t)throw r;const s={tokens:[{type:"error"}],error:r.message};n={pattern:e,partitions:[s,s,s,s],error:r.message,locale:null}}return n}function dg(e,t,n={}){var o;const r=Object.assign({},Ac,n),s=on(e,r.throws),i=(o=Po(t,r))!=null?o:t;return tg(i,s,r)}function fg(e,t,n){var o;const r=Object.assign({},Ac,n),s=on(e,r.throws),i=(o=Po(t,r))!=null?o:t;return eg(i,s,r)}function mg(e){const t=on(e,!1);return Bc(t.partitions)}function gg(e){const t=on(e,!1);return Fc(t.partitions)}function _g(e){const t=on(e,!1);return $c(t.partitions)}function pg(e){try{return on(e,!0),!0}catch{return!1}}function Eg(e,t={}){const n=on(e,!1);return n.info||(n.info=sg(n.partitions,t==null?void 0:t.currency)),n.info}function Cg(e){const t=on(e,!1);return t.dateInfo||(t.dateInfo=ig(t.partitions)),t.dateInfo}const Mn=Object.freeze({AMPM:vo,BREAK:uo,CALENDAR:_o,CHAR:Hs,COLOR:Oo,COMMA:co,CONDITION:Co,DATETIME:po,DBNUM:Ro,DIGIT:$s,DURATION:Eo,ERROR:Tr,ESCAPED:wo,EXP:To,FILL:yo,GENERAL:io,GROUP:Ar,HASH:oo,LOCALE:So,MINUS:fo,MODIFIER:Ic,NATNUM:Io,PAREN:No,PERCENT:go,PLUS:ho,POINT:bs,QMARK:ao,SCALE:ws,SKIP:Ao,SLASH:lo,SPACE:mo,STRING:bo,TEXT:Bs,ZERO:Yn}),Rg=Object.freeze(Object.defineProperty({__proto__:null,addLocale:te,dateFromSerial:$m,dateToSerial:Po,dec2frac:Tc,format:dg,formatColor:fg,getFormatDateInfo:Cg,getFormatInfo:Eg,getLocale:qn,isDateFormat:mg,isPercentFormat:gg,isTextFormat:_g,isValidFormat:pg,parseBool:Pc,parseDate:Uc,parseLocale:Mo,parseNumber:Lc,parseTime:ko,parseValue:Km,round:Et,tokenTypes:Mn,tokenize:kn},Symbol.toStringTag,{value:"Module"})),Ig=(e,t)=>{if(e&&!t||!e&&t)return!1;const n=i=>{const o=kn(i);let a="",l=!1,c=!1;for(const u of o){if(u.type===Mn.POINT){l=!0;continue}if(!(c&&u.type===Mn.MINUS)&&u.type!==Mn.SKIP){if(u.type===Mn.COLOR){c=!0;continue}else c=!1;l&&u.type===Mn.ZERO||(l=!1,l||(a+=u.value||""))}}return a},r=n(e),s=n(t);return r===s},kr="__INTERNAL_EDITOR__",Fo=`${kr}DOCS_NORMAL`,Bo=`${kr}DOCS_FORMULA_BAR`,Hc=`${kr}ZEN_EDITOR`,jc=`\r
2
+ `,Wc="isRowStylePrecedeColumnStyle",Yc=Symbol("AUTO_HEIGHT_FOR_MERGED_CELLS");function Sg(e){return`${kr}${e}`}function Gc(e){return e.startsWith(kr)}var Vc=(e=>(e[e.character=0]="character",e[e.paragraph=1]="paragraph",e[e.table=2]="table",e[e.numbering=3]="numbering",e))(Vc||{}),zc=(e=>(e[e.TAB=0]="TAB",e[e.SPACE=1]="SPACE",e[e.NOTHING=2]="NOTHING",e))(zc||{}),fe=(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))(fe||{}),Fr=(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))(Fr||{}),rn=(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))(rn||{}),_n=(e=>(e[e.COMMENT=0]="COMMENT",e[e.DELETED=9999]="DELETED",e))(_n||{}),Kc=(e=>(e[e.DRAWING=0]="DRAWING",e[e.CUSTOM=1]="CUSTOM",e))(Kc||{}),$o=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TRADITIONAL=1]="TRADITIONAL",e[e.MODERN=2]="MODERN",e))($o||{}),Xc=(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))(Xc||{}),qc=(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))(qc||{}),Zc=(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))(Zc||{}),Jc=(e=>(e[e.NORMAL=0]="NORMAL",e[e.TBRL=1]="TBRL",e[e.LRTBV=2]="LRTBV",e))(Jc||{}),Qc=(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))(Qc||{}),eu=(e=>(e[e.BOTH_SIDES=0]="BOTH_SIDES",e[e.LEFT=1]="LEFT",e[e.RIGHT=2]="RIGHT",e[e.LARGEST=3]="LARGEST",e))(eu||{}),tu=(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))(tu||{}),Xe=(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))(Xe||{}),nu=(e=>(e[e.AUTO=0]="AUTO",e[e.AT_LEAST=1]="AT_LEAST",e[e.EXACT=2]="EXACT",e))(nu||{}),ru=(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))(ru||{}),su=(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))(su||{}),iu=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SPECIFIED=1]="SPECIFIED",e))(iu||{}),ou=(e=>(e[e.START=0]="START",e[e.CENTER=1]="CENTER",e[e.END=2]="END",e))(ou||{}),au=(e=>(e[e.AUTO_FIT=0]="AUTO_FIT",e[e.FIXED=1]="FIXED",e))(au||{}),lu=(e=>(e[e.NONE=0]="NONE",e[e.WRAP=1]="WRAP",e))(lu||{}),cu=(e=>(e[e.AUTO=0]="AUTO",e[e.AT_LEAST=1]="AT_LEAST",e[e.EXACT=2]="EXACT",e))(cu||{}),uu=(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))(uu||{}),Fn=(e=>(e.NORMAL="normal",e.BOLD="bold",e.ITALIC="italic",e))(Fn||{}),hu=(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))(hu||{}),du=(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))(du||{}),fu=(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))(fu||{}),mu=(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))(mu||{}),gu=(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))(gu||{}),_u=(e=>(e[e.compressPunctuation=0]="compressPunctuation",e[e.compressPunctuationAndJapaneseKana=1]="compressPunctuationAndJapaneseKana",e[e.doNotCompress=2]="doNotCompress",e))(_u||{}),pu=(e=>(e[e.PORTRAIT=0]="PORTRAIT",e[e.LANDSCAPE=1]="LANDSCAPE",e))(pu||{}),lt=(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))(lt||{});const Og=["A3","A4","A5","B4","B5","Letter","Tabloid","Legal","Statement","Executive","Folio"];var Eu=(e=>(e[e.forward=0]="forward",e[e.backward=1]="backward",e[e.front=2]="front",e[e.back=3]="back",e))(Eu||{}),Cu=(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))(Cu||{}),Ho=(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))(Ho||{}),Ru=(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))(Ru||{}),Iu=(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))(Iu||{});const vg={sheetId:"",range:{startRow:-1,endRow:-1,startColumn:-1,endColumn:-1}},wg={startRow:-1,startColumn:-1,endRow:-1,endColumn:-1},bg={startRow:0,startColumn:0,endRow:0,endColumn:0},Ag={row:0,column:0},rt={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:wr.UNSPECIFIED,cl:{rgb:"#000"},bg:{rgb:"#fff"},ht:At.UNSPECIFIED,vt:gn.UNSPECIFIED,tb:Cn.UNSPECIFIED,pd:{t:0,r:0,b:0,l:0},n:null,bd:{b:null,l:null,r:null,t:null}},Su={id:"default_slide",title:"defaultSlide",pageSize:{width:300,height:300}},Tg=[Fo,Hc,Bo],yg={[Xe.HEADING_1]:{fs:20,bl:1},[Xe.HEADING_2]:{fs:18,bl:1},[Xe.HEADING_3]:{fs:16,bl:1},[Xe.HEADING_4]:{fs:14,bl:1},[Xe.HEADING_5]:{fs:12,bl:1},[Xe.NORMAL_TEXT]:null,[Xe.TITLE]:{fs:26,bl:1},[Xe.SUBTITLE]:{fs:15,cl:{rgb:"#999999"}},[Xe.NAMED_STYLE_TYPE_UNSPECIFIED]:null},bn=4,Ng={[Xe.HEADING_1]:{spaceAbove:{v:20},spaceBelow:{v:6+bn}},[Xe.HEADING_2]:{spaceAbove:{v:18},spaceBelow:{v:6+bn}},[Xe.HEADING_3]:{spaceAbove:{v:16},spaceBelow:{v:6+bn}},[Xe.HEADING_4]:{spaceAbove:{v:14},spaceBelow:{v:4+bn}},[Xe.HEADING_5]:{spaceAbove:{v:12},spaceBelow:{v:4+bn}},[Xe.NORMAL_TEXT]:{spaceAbove:{v:0},spaceBelow:{v:0}},[Xe.TITLE]:{spaceAbove:{v:0},spaceBelow:{v:3+bn}},[Xe.SUBTITLE]:{spaceAbove:{v:0},spaceBelow:{v:16}},[Xe.NAMED_STYLE_TYPE_UNSPECIFIED]:null},Mg="univer-sheets-chart-print-chart",Dg="univer-docs-drawing-printing";var Ou=(e=>(e.ARRAY_CONVERTOR="ARRAY_CONVERTOR",e.MATRIX_CONVERTOR="MATRIX_CONVERTOR",e))(Ou||{});const Lg={[lt.A3]:{width:1123,height:1587},[lt.A4]:{width:794,height:1124},[lt.A5]:{width:559,height:794},[lt.B4]:{width:944,height:1344},[lt.B5]:{width:665,height:944},[lt.Executive]:{width:696,height:1008},[lt.Folio]:{width:816,height:1248},[lt.Legal]:{width:816,height:1344},[lt.Letter]:{width:816,height:1056},[lt.Statement]:{width:528,height:816},[lt.Tabloid]:{width:1056,height:1632}};function Zr(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 vr=class vr{constructor(t,n,r){E(this,"_range");E(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 ht;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 ht;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=z.numToWord(r+1)+(t+1),o=z.numToWord(s+1)+(n+1)):(i=z.numToWord(s+1)+(n+1),o=z.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)||rt.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 vr(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 c=0;c<=r-n;c++)for(let u=0;u<=i-s;u++){if(o==null||((a=o==null?void 0:o[c])==null?void 0:a[u])==null)continue;const h=o[c][u].s;h&&(o[c][u].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)||rt.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?Zr("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?Zr("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?Zr("it",t.body)===ie.TRUE?Is.ITALIC:Is.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?Zr("bl",t.body)===ie.TRUE?Ss.BOLD:Ss.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()===Cn.WRAP?ie.TRUE:ie.FALSE}getWrapStrategies(){return this._getStyles("tb")}getWrapStrategy(){return this.getWrapStrategies()[0][0]}forEach(t){vr.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]||rt[t]}))}};E(vr,"transformRange",(t,n)=>{const r=n.getMaxColumns()-1,s=n.getMaxRows()-1;return t.rangeType===_e.ALL?{startColumn:0,startRow:0,endColumn:r,endRow:s}:t.rangeType===_e.COLUMN?{startRow:0,endRow:s,startColumn:t.startColumn,endColumn:t.endColumn}:t.rangeType===_e.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 Gn=vr;function vu(e,t,n=0,r=e.length-1,s=xg){for(;r>n;){if(r-n>600){const l=r-n+1,c=t-n+1,u=Math.log(l),h=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*h*(l-h)/l)*(c-l/2<0?-1:1),f=Math.max(n,Math.floor(t-c*h/l+d)),g=Math.min(r,Math.floor(t+(l-c)*h/l+d));vu(e,t,f,g,s)}const i=e[t];let o=n,a=r;for(tr(e,n,t),s(e[r],i)>0&&tr(e,n,r);o<a;){for(tr(e,o,a),o++,a--;s(e[o],i)<0;)o++;for(;s(e[a],i)>0;)a--}s(e[n],i)===0?tr(e,n,a):(a++,tr(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}}function tr(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function xg(e,t){return e<t?-1:e>t?1:0}class As{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(!Qr(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;Qr(t,l)&&(n.leaf?r.push(a):ai(t,l)?this._all(a,r):i.push(a))}n=i.pop()}return r}collides(t){let n=this.data;if(!Qr(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(Qr(t,o)){if(n.leaf||ai(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=Dn([]),this}remove(t,n){if(!t)return this;let r=this.data;const s=this.toBBox(t),i=[],o=[];let a,l,c;for(;r||i.length;){if(r||(r=i.pop(),l=i[i.length-1],a=o.pop(),c=!0),r.leaf){const u=Ug(t,r.children,n);if(u!==-1)return r.children.splice(u,1),i.push(r),this._condense(i),this}!c&&!r.leaf&&ai(r,s)?(i.push(r),o.push(a),a=0,l=r,r=r.children[0]):l?(a++,r=l.children[a],c=!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=Dn(t.slice(n,r+1)),An(a,this.toBBox),a;s||(s=Math.ceil(Math.log(i)/Math.log(o)),o=Math.ceil(i/Math.pow(o,s-1))),a=Dn([]),a.leaf=!1,a.height=s;const l=Math.ceil(i/o),c=l*Math.ceil(Math.sqrt(o));Ua(t,n,r,c,this.compareMinX);for(let u=n;u<=r;u+=c){const h=Math.min(u+c-1,r);Ua(t,u,h,l,this.compareMinY);for(let d=u;d<=h;d+=l){const f=Math.min(d+l-1,h);a.children.push(this._build(t,d,f,s-1))}}return An(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 c=n.children[l],u=oi(c),h=Fg(t,c)-u;h<o?(o=h,i=u<i?u:i,a=c):h===o&&u<i&&(i=u,a=c)}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),_r(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=Dn(r.children.splice(o,r.children.length-o));a.height=r.height,a.leaf=r.leaf,An(r,this.toBBox),An(a,this.toBBox),n?t[n-1].children.push(a):this._splitRoot(r,a)}_splitRoot(t,n){this.data=Dn([t,n]),this.data.height=t.height+1,this.data.leaf=!1,An(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=gr(t,0,a,this.toBBox),c=gr(t,a,r,this.toBBox),u=Bg(l,c),h=oi(l)+oi(c);u<i?(i=u,s=a,o=h<o?h:o):u===i&&h<o&&(o=h,s=a)}return s||r-n}_chooseSplitAxis(t,n,r){const s=t.leaf?this.compareMinX:Pg,i=t.leaf?this.compareMinY:kg,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=gr(t,0,n,i),a=gr(t,r-n,r,i);let l=Jr(o)+Jr(a);for(let c=n;c<r-n;c++){const u=t.children[c];_r(o,t.leaf?i(u):u),l+=Jr(o)}for(let c=r-n-1;c>=n;c--){const u=t.children[c];_r(a,t.leaf?i(u):u),l+=Jr(a)}return l}_adjustParentBBoxes(t,n,r){for(let s=r;s>=0;s--)_r(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():An(t[n],this.toBBox)}}function Ug(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 An(e,t){gr(e,0,e.children.length,t,e)}function gr(e,t,n,r,s){s||(s=Dn(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];_r(s,e.leaf?r(o):o)}return s}function _r(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 Pg(e,t){return e.minX-t.minX}function kg(e,t){return e.minY-t.minY}function oi(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function Jr(e){return e.maxX-e.minX+(e.maxY-e.minY)}function Fg(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 Bg(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 ai(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function Qr(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function Dn(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Ua(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;vu(e,o,t,n,s),i.push(t,o,o,n)}}function $g(e,t,n,r=!1){if(t===0&&n===0)return e;let s={...e};const i=s.startAbsoluteRefType||Ge.NONE,o=s.endAbsoluteRefType||Ge.NONE,a=s.rangeType||_e.NORMAL;if(!r&&i===Ge.ALL&&o===Ge.ALL)return s;const l=Pa(s.startRow,n,s.startColumn,t,a),c=Pa(s.endRow,n,s.endColumn,t,a);return r||i===Ge.NONE&&o===Ge.NONE?s={...s,startRow:l.row,startColumn:l.column,endRow:c.row,endColumn:c.column}:(i===Ge.NONE?s={...s,startRow:l.row,startColumn:l.column}:i===Ge.COLUMN?s={...s,startRow:l.row}:i===Ge.ROW&&(s={...s,startColumn:l.column}),o===Ge.NONE?s={...s,endRow:c.row,endColumn:c.column}:o===Ge.COLUMN?s={...s,endRow:c.row}:o===Ge.ROW&&(s={...s,endColumn:c.column}),s)}function Pa(e,t,n,r,s){return s===_e.NORMAL?{row:e+t,column:n+r}:s===_e.ROW?{row:e+t,column:n}:s===_e.COLUMN?{row:e,column:n+r}:{row:e,column:n}}function jo(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],c=r[a+1]-1,u=s[o],h=s[o+1]-1;for(const d of e){if(d.startRow>h)break;if(d.startRow<=u&&d.endRow>=h&&d.startColumn<=l&&d.endColumn>=c){i.push({startColumn:l,endColumn:c,startRow:u,endRow:h});break}}}return i}function Hg(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 jg(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 Wg(e){const t=jo(e),n=Hg(t);return jg(n)}function Yg(e,t){const n=[];return e.forEach(r=>{n.push(...sn.subtract(r,t))}),sn.mergeRanges(n)}function wu(e,t){const n=ka(e.startRow,e.endRow,t.startRow,t.endRow),r=ka(e.startColumn,e.endColumn,t.startColumn,t.endColumn);if(!n||!r)return null;const[s,i]=n,[o,a]=r,l=Gg(e.rangeType,t.rangeType,s,i,o,a);return{startRow:s,endRow:i,startColumn:o,endColumn:a,rangeType:l}}function ka(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),c=Math.min(i,a);if(l<=c){const u=l===-1/0?Number.NaN:l,h=c===1/0?Number.NaN:c;return[u,h]}else return null}function Gg(e,t,n,r,s,i){const o=e!==void 0?e:Fa(n,r,s,i),a=t!==void 0?t:Fa(n,r,s,i);return o===_e.ALL||a===_e.ALL?o===a?o:o===_e.ALL?a:o:o===a?o:(o===_e.NORMAL||a===_e.NORMAL,_e.NORMAL)}function Fa(e,t,n,r){const s=!isNaN(e)&&!isNaN(t),i=!isNaN(n)&&!isNaN(r);return s&&i?_e.NORMAL:s?_e.ROW:i?_e.COLUMN:_e.ALL}const Ht=class Ht{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===_e.NORMAL||n.rangeType===void 0&&t.rangeType===_e.NORMAL)}static simpleRangesIntersect(t,n){const{startRow:r,endRow:s,startColumn:i,endColumn:o}=t,{startRow:a,endRow:l,startColumn:c,endColumn:u}=n,h=r<=l&&s>=a,d=i<=u&&o>=c;return h&&d}static intersects(t,n){if(t.rangeType===_e.ROW&&n.rangeType===_e.COLUMN||t.rangeType===_e.COLUMN&&n.rangeType===_e.ROW)return!0;if(t.rangeType===_e.ROW&&n.rangeType===_e.ROW)return t.startRow<=n.endRow&&t.endRow>=n.startRow;if(t.rangeType===_e.COLUMN&&n.rangeType===_e.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,c=Number.isNaN(n.endRow)?r:n.endRow,u=Number.isNaN(n.startColumn)?0:n.startColumn,h=Number.isNaN(n.endColumn)?r:n.endColumn,d=Math.abs(o+a-u-h),f=Math.abs(o-a)+Math.abs(u-h),g=Math.abs(s+i-l-c),p=Math.abs(s-i)+Math.abs(l-c);return d<=f&&g<=p}static doAnyRangesIntersect(t,n){const r=new As;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,c=n.startColumn,u=n.endColumn;let h,d,f,g;if(a<=s)a>=r?d=a:d=r;else return null;if(l>=r)l>=s?g=s:g=l;else return null;if(c<=o)c>i?h=c:h=i;else return null;if(u>=i)u>=o?f=o:f=u;else return null;return{startRow:d,endRow:g,startColumn:h,endColumn:f,rangeType:_e.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 Ht.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:_e.NORMAL}),t[0])}static realUnion(...t){const n=t.some(i=>i.rangeType===_e.COLUMN),r=t.some(i=>i.rangeType===_e.ROW),s=Ht.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?_e.ROW:n?_e.COLUMN:_e.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 Wg(t)}static splitIntoGrid(t){return jo(t)}static subtractMulti(t,n){if(!n.length)return t;let r=t;return n.forEach(s=>{r=Yg(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)}};E(Ht,"getRelativeRange",(t,n)=>({startRow:t.startRow-n.startRow,endRow:t.endRow-t.startRow,startColumn:t.startColumn-n.startColumn,endColumn:t.endColumn-t.startColumn})),E(Ht,"getPositionRange",(t,n,r)=>({...r||{},startRow:r&&[Ge.ROW,Ge.ALL].includes(r.startAbsoluteRefType||0)?r.startRow:t.startRow+n.startRow,endRow:r&&[Ge.ROW,Ge.ALL].includes(r.endAbsoluteRefType||0)?r.endRow:t.endRow+t.startRow+n.startRow,startColumn:r&&[Ge.COLUMN,Ge.ALL].includes(r.startAbsoluteRefType||0)?r.startColumn:t.startColumn+n.startColumn,endColumn:r&&[Ge.COLUMN,Ge.ALL].includes(r.endAbsoluteRefType||0)?r.endColumn:t.endColumn+t.startColumn+n.startColumn})),E(Ht,"moveHorizontal",(t,n=0,r=0)=>({...t,startColumn:t.startColumn+n,endColumn:t.endColumn+n+r})),E(Ht,"moveVertical",(t,n=0,r=0)=>({...t,startRow:t.startRow+n,endRow:t.endRow+n+r})),E(Ht,"moveOffset",(t,n,r)=>({...t,startRow:t.startRow+r,endRow:t.endRow+r,startColumn:t.startColumn+n,endColumn:t.endColumn+n}));let sn=Ht;function Vg(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=zg(n);o.area>r&&(r=o.area,s={startColumn:o.start,startRow:i-o.height+1,endColumn:o.end,endRow:i})}return s}function zg(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 Kg(e,t){Gn.foreach(t,(n,r)=>{e[n][r]=void 0})}function Xg(e,t){const n=e.toFullArray(),r=[];for(;;){const s=Vg(n,t);if(!s)break;r.push(s),Kg(n,s)}return r}class qg{constructor(t,n){E(this,"_values",[]);E(this,"_keys",[]);E(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 Bi(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 Zg(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 Ts=65,bu=90,Jg=97;function Qg(e){const t=bu-Ts+1;let n="";for(;e>=0;)n=String.fromCharCode(e%t+Ts)+n,e=Math.floor(e/t)-1;return n}function Au(e,t){let n="";for(;t>0;)n+=e,t--;return n}function e_(e,t=!1){const n=bu-Ts+1;let r=Jg;t&&(r=Ts);const s=String.fromCharCode(e%n+r),i=Math.floor(e/n)+1;return Au(s,i)}function t_(e,t){return e.zIndex>t.zIndex?1:e.zIndex===t.zIndex?0:-1}function n_(e,t){return e.zIndex>t.zIndex?-1:e.zIndex===t.zIndex?0:1}function Br(e="index",t=1){return(n,r)=>n[e]>r[e]?t:n[e]===r[e]?0:-t}var Tu=(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))(Tu||{}),ot=(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))(ot||{});function r_(e){return`${e}`}const s_=[ot.TABLE_START,ot.TABLE_ROW_START,ot.TABLE_CELL_START,ot.TABLE_CELL_END,ot.TABLE_ROW_END,ot.TABLE_END],js=e=>{const t=e.endsWith(`\r
5
+ `)?e.slice(0,-2):e;return s_.reduce((n,r)=>n.replaceAll(r,""),t)},i_=e=>e?js(e).replaceAll("\r","")==="":!0,o_=e=>{const t=e.replace(/\n/g,"\r"),n=[],r=[];let s=0,i="";const o=(l,c=!0)=>{const u=t.slice(s,l);if(z.isLegalUrl(u)){const h=Wt(),d=`${u}`,f={startIndex:s,endIndex:s+d.length-1,rangeId:h,rangeType:rn.HYPERLINK,properties:{url:e}};r.push(f),i+=d,s=l+1,c&&(i+="\r",n.push({startIndex:l}))}else i+=t.slice(s,l+1),s=l+1,c&&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 yu=typeof global=="object"&&global&&global.Object===Object&&global,a_=typeof self=="object"&&self&&self.Object===Object&&self,Sn=yu||a_||Function("return this")(),Vn=Sn.Symbol,Nu=Object.prototype,l_=Nu.hasOwnProperty,c_=Nu.toString,nr=Vn?Vn.toStringTag:void 0;function u_(e){var t=l_.call(e,nr),n=e[nr];try{e[nr]=void 0;var r=!0}catch{}var s=c_.call(e);return r&&(t?e[nr]=n:delete e[nr]),s}var h_=Object.prototype,d_=h_.toString;function f_(e){return d_.call(e)}var m_="[object Null]",g_="[object Undefined]",Ba=Vn?Vn.toStringTag:void 0;function $r(e){return e==null?e===void 0?g_:m_:Ba&&Ba in Object(e)?u_(e):f_(e)}function Zn(e){return e!=null&&typeof e=="object"}var __="[object Symbol]";function Ws(e){return typeof e=="symbol"||Zn(e)&&$r(e)==__}function p_(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 zn=Array.isArray,$a=Vn?Vn.prototype:void 0,Ha=$a?$a.toString:void 0;function Mu(e){if(typeof e=="string")return e;if(zn(e))return p_(e,Mu)+"";if(Ws(e))return Ha?Ha.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var E_=/\s/;function C_(e){for(var t=e.length;t--&&E_.test(e.charAt(t)););return t}var R_=/^\s+/;function I_(e){return e&&e.slice(0,C_(e)+1).replace(R_,"")}function Ct(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var ja=NaN,S_=/^[-+]0x[0-9a-f]+$/i,O_=/^0b[01]+$/i,v_=/^0o[0-7]+$/i,w_=parseInt;function Wa(e){if(typeof e=="number")return e;if(Ws(e))return ja;if(Ct(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Ct(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=I_(e);var n=O_.test(e);return n||v_.test(e)?w_(e.slice(2),n?2:8):S_.test(e)?ja:+e}function Du(e){return e}var b_="[object AsyncFunction]",A_="[object Function]",T_="[object GeneratorFunction]",y_="[object Proxy]";function Wo(e){if(!Ct(e))return!1;var t=$r(e);return t==A_||t==T_||t==b_||t==y_}var li=Sn["__core-js_shared__"],Ya=function(){var e=/[^.]+$/.exec(li&&li.keys&&li.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function N_(e){return!!Ya&&Ya in e}var M_=Function.prototype,D_=M_.toString;function L_(e){if(e!=null){try{return D_.call(e)}catch{}try{return e+""}catch{}}return""}var x_=/[\\^$.*+?()[\]{}|]/g,U_=/^\[object .+?Constructor\]$/,P_=Function.prototype,k_=Object.prototype,F_=P_.toString,B_=k_.hasOwnProperty,$_=RegExp("^"+F_.call(B_).replace(x_,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function H_(e){if(!Ct(e)||N_(e))return!1;var t=Wo(e)?$_:U_;return t.test(L_(e))}function j_(e,t){return e==null?void 0:e[t]}function Yo(e,t){var n=j_(e,t);return H_(n)?n:void 0}var Ga=Object.create,W_=function(){function e(){}return function(t){if(!Ct(t))return{};if(Ga)return Ga(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function Y_(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 G_(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}var V_=800,z_=16,K_=Date.now;function X_(e){var t=0,n=0;return function(){var r=K_(),s=z_-(r-n);if(n=r,s>0){if(++t>=V_)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function q_(e){return function(){return e}}var ys=function(){try{var e=Yo(Object,"defineProperty");return e({},"",{}),e}catch{}}(),Z_=ys?function(e,t){return ys(e,"toString",{configurable:!0,enumerable:!1,value:q_(t),writable:!0})}:Du,J_=X_(Z_),Q_=9007199254740991,ep=/^(?:0|[1-9]\d*)$/;function Go(e,t){var n=typeof e;return t=t==null?Q_:t,!!t&&(n=="number"||n!="symbol"&&ep.test(e))&&e>-1&&e%1==0&&e<t}function Vo(e,t,n){t=="__proto__"&&ys?ys(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Ys(e,t){return e===t||e!==e&&t!==t}var tp=Object.prototype,np=tp.hasOwnProperty;function Lu(e,t,n){var r=e[t];(!(np.call(e,t)&&Ys(r,n))||n===void 0&&!(t in e))&&Vo(e,t,n)}function rp(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?Vo(n,a,l):Lu(n,a,l)}return n}var Va=Math.max;function sp(e,t,n){return t=Va(t===void 0?e.length-1:t,0),function(){for(var r=arguments,s=-1,i=Va(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),Y_(e,this,a)}}function ip(e,t){return J_(sp(e,t,Du),e+"")}var op=9007199254740991;function xu(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=op}function zo(e){return e!=null&&xu(e.length)&&!Wo(e)}function ap(e,t,n){if(!Ct(n))return!1;var r=typeof t;return(r=="number"?zo(n)&&Go(t,n.length):r=="string"&&t in n)?Ys(n[t],e):!1}function Uu(e){return ip(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&&ap(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 lp=Object.prototype;function Pu(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||lp;return e===n}function cp(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var up="[object Arguments]";function za(e){return Zn(e)&&$r(e)==up}var ku=Object.prototype,hp=ku.hasOwnProperty,dp=ku.propertyIsEnumerable,$i=za(function(){return arguments}())?za:function(e){return Zn(e)&&hp.call(e,"callee")&&!dp.call(e,"callee")};function fp(){return!1}var Fu=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ka=Fu&&typeof module=="object"&&module&&!module.nodeType&&module,mp=Ka&&Ka.exports===Fu,Xa=mp?Sn.Buffer:void 0,gp=Xa?Xa.isBuffer:void 0,Bu=gp||fp,_p="[object Arguments]",pp="[object Array]",Ep="[object Boolean]",Cp="[object Date]",Rp="[object Error]",Ip="[object Function]",Sp="[object Map]",Op="[object Number]",vp="[object Object]",wp="[object RegExp]",bp="[object Set]",Ap="[object String]",Tp="[object WeakMap]",yp="[object ArrayBuffer]",Np="[object DataView]",Mp="[object Float32Array]",Dp="[object Float64Array]",Lp="[object Int8Array]",xp="[object Int16Array]",Up="[object Int32Array]",Pp="[object Uint8Array]",kp="[object Uint8ClampedArray]",Fp="[object Uint16Array]",Bp="[object Uint32Array]",ke={};ke[Mp]=ke[Dp]=ke[Lp]=ke[xp]=ke[Up]=ke[Pp]=ke[kp]=ke[Fp]=ke[Bp]=!0;ke[_p]=ke[pp]=ke[yp]=ke[Ep]=ke[Np]=ke[Cp]=ke[Rp]=ke[Ip]=ke[Sp]=ke[Op]=ke[vp]=ke[wp]=ke[bp]=ke[Ap]=ke[Tp]=!1;function $p(e){return Zn(e)&&xu(e.length)&&!!ke[$r(e)]}function Hp(e){return function(t){return e(t)}}var $u=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Or=$u&&typeof module=="object"&&module&&!module.nodeType&&module,jp=Or&&Or.exports===$u,ci=jp&&yu.process,qa=function(){try{var e=Or&&Or.require&&Or.require("util").types;return e||ci&&ci.binding&&ci.binding("util")}catch{}}(),Za=qa&&qa.isTypedArray,Hu=Za?Hp(Za):$p;function Wp(e,t){var n=zn(e),r=!n&&$i(e),s=!n&&!r&&Bu(e),i=!n&&!r&&!s&&Hu(e),o=n||r||s||i,a=o?cp(e.length,String):[],l=a.length;for(var c in e)o&&(c=="length"||s&&(c=="offset"||c=="parent")||i&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||Go(c,l))||a.push(c);return a}function Yp(e,t){return function(n){return e(t(n))}}function Gp(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var Vp=Object.prototype,zp=Vp.hasOwnProperty;function Kp(e){if(!Ct(e))return Gp(e);var t=Pu(e),n=[];for(var r in e)r=="constructor"&&(t||!zp.call(e,r))||n.push(r);return n}function ju(e){return zo(e)?Wp(e):Kp(e)}var Xp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,qp=/^\w*$/;function Zp(e,t){if(zn(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Ws(e)?!0:qp.test(e)||!Xp.test(e)||t!=null&&e in Object(t)}var yr=Yo(Object,"create");function Jp(){this.__data__=yr?yr(null):{},this.size=0}function Qp(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var eE="__lodash_hash_undefined__",tE=Object.prototype,nE=tE.hasOwnProperty;function rE(e){var t=this.__data__;if(yr){var n=t[e];return n===eE?void 0:n}return nE.call(t,e)?t[e]:void 0}var sE=Object.prototype,iE=sE.hasOwnProperty;function oE(e){var t=this.__data__;return yr?t[e]!==void 0:iE.call(t,e)}var aE="__lodash_hash_undefined__";function lE(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=yr&&t===void 0?aE:t,this}function In(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])}}In.prototype.clear=Jp;In.prototype.delete=Qp;In.prototype.get=rE;In.prototype.has=oE;In.prototype.set=lE;function cE(){this.__data__=[],this.size=0}function Gs(e,t){for(var n=e.length;n--;)if(Ys(e[n][0],t))return n;return-1}var uE=Array.prototype,hE=uE.splice;function dE(e){var t=this.__data__,n=Gs(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():hE.call(t,n,1),--this.size,!0}function fE(e){var t=this.__data__,n=Gs(t,e);return n<0?void 0:t[n][1]}function mE(e){return Gs(this.__data__,e)>-1}function gE(e,t){var n=this.__data__,r=Gs(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function Vt(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])}}Vt.prototype.clear=cE;Vt.prototype.delete=dE;Vt.prototype.get=fE;Vt.prototype.has=mE;Vt.prototype.set=gE;var Wu=Yo(Sn,"Map");function _E(){this.size=0,this.__data__={hash:new In,map:new(Wu||Vt),string:new In}}function pE(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Vs(e,t){var n=e.__data__;return pE(t)?n[typeof t=="string"?"string":"hash"]:n.map}function EE(e){var t=Vs(this,e).delete(e);return this.size-=t?1:0,t}function CE(e){return Vs(this,e).get(e)}function RE(e){return Vs(this,e).has(e)}function IE(e,t){var n=Vs(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function an(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])}}an.prototype.clear=_E;an.prototype.delete=EE;an.prototype.get=CE;an.prototype.has=RE;an.prototype.set=IE;var SE="Expected a function";function Ko(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(SE);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(Ko.Cache||an),n}Ko.Cache=an;var OE=500;function vE(e){var t=Ko(e,function(r){return n.size===OE&&n.clear(),r}),n=t.cache;return t}var wE=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,bE=/\\(\\)?/g,AE=vE(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(wE,function(n,r,s,i){t.push(s?i.replace(bE,"$1"):r||n)}),t});function TE(e){return e==null?"":Mu(e)}function Yu(e,t){return zn(e)?e:Zp(e,t)?[e]:AE(TE(e))}function Gu(e){if(typeof e=="string"||Ws(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function yE(e,t){t=Yu(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[Gu(t[n++])];return n&&n==r?e:void 0}function Vu(e,t,n){var r=e==null?void 0:yE(e,t);return r===void 0?n:r}var zu=Yp(Object.getPrototypeOf,Object),NE="[object Object]",ME=Function.prototype,DE=Object.prototype,Ku=ME.toString,LE=DE.hasOwnProperty,xE=Ku.call(Object);function UE(e){if(!Zn(e)||$r(e)!=NE)return!1;var t=zu(e);if(t===null)return!0;var n=LE.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&Ku.call(n)==xE}function PE(){this.__data__=new Vt,this.size=0}function kE(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function FE(e){return this.__data__.get(e)}function BE(e){return this.__data__.has(e)}var $E=200;function HE(e,t){var n=this.__data__;if(n instanceof Vt){var r=n.__data__;if(!Wu||r.length<$E-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new an(r)}return n.set(e,t),this.size=n.size,this}function Jn(e){var t=this.__data__=new Vt(e);this.size=t.size}Jn.prototype.clear=PE;Jn.prototype.delete=kE;Jn.prototype.get=FE;Jn.prototype.has=BE;Jn.prototype.set=HE;var Xu=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ja=Xu&&typeof module=="object"&&module&&!module.nodeType&&module,jE=Ja&&Ja.exports===Xu,Qa=jE?Sn.Buffer:void 0;Qa&&Qa.allocUnsafe;function WE(e,t){return e.slice()}var el=Sn.Uint8Array;function YE(e){var t=new e.constructor(e.byteLength);return new el(t).set(new el(e)),t}function GE(e,t){var n=YE(e.buffer);return new e.constructor(n,e.byteOffset,e.length)}function VE(e){return typeof e.constructor=="function"&&!Pu(e)?W_(zu(e)):{}}function zE(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 KE=zE(),ui=function(){return Sn.Date.now()},XE="Expected a function",qE=Math.max,ZE=Math.min;function JE(e,t,n){var r,s,i,o,a,l,c=0,u=!1,h=!1,d=!0;if(typeof e!="function")throw new TypeError(XE);t=Wa(t)||0,Ct(n)&&(u=!!n.leading,h="maxWait"in n,i=h?qE(Wa(n.maxWait)||0,t):i,d="trailing"in n?!!n.trailing:d);function f(C){var w=r,T=s;return r=s=void 0,c=C,o=e.apply(T,w),o}function g(C){return c=C,a=setTimeout(b,t),u?f(C):o}function p(C){var w=C-l,T=C-c,F=t-w;return h?ZE(F,i-T):F}function R(C){var w=C-l,T=C-c;return l===void 0||w>=t||w<0||h&&T>=i}function b(){var C=ui();if(R(C))return $(C);a=setTimeout(b,p(C))}function $(C){return a=void 0,d&&r?f(C):(r=s=void 0,o)}function k(){a!==void 0&&clearTimeout(a),c=0,r=l=s=a=void 0}function W(){return a===void 0?o:$(ui())}function O(){var C=ui(),w=R(C);if(r=arguments,s=this,l=C,w){if(a===void 0)return g(l);if(h)return clearTimeout(a),a=setTimeout(b,t),f(l)}return a===void 0&&(a=setTimeout(b,t)),o}return O.cancel=k,O.flush=W,O}function Hi(e,t,n){(n!==void 0&&!Ys(e[t],n)||n===void 0&&!(t in e))&&Vo(e,t,n)}function QE(e){return Zn(e)&&zo(e)}function ji(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}function e0(e){return rp(e,ju(e))}function t0(e,t,n,r,s,i,o){var a=ji(e,n),l=ji(t,n),c=o.get(l);if(c){Hi(e,n,c);return}var u=i?i(a,l,n+"",e,t,o):void 0,h=u===void 0;if(h){var d=zn(l),f=!d&&Bu(l),g=!d&&!f&&Hu(l);u=l,d||f||g?zn(a)?u=a:QE(a)?u=G_(a):f?(h=!1,u=WE(l)):g?(h=!1,u=GE(l)):u=[]:UE(l)||$i(l)?(u=a,$i(a)?u=e0(a):(!Ct(a)||Wo(a))&&(u=VE(l))):h=!1}h&&(o.set(l,u),s(u,l,r,i,o),o.delete(l)),Hi(e,n,u)}function Xo(e,t,n,r,s){e!==t&&KE(t,function(i,o){if(s||(s=new Jn),Ct(i))t0(e,t,o,n,Xo,r,s);else{var a=r?r(ji(e,o),i,o+"",e,t,s):void 0;a===void 0&&(a=i),Hi(e,o,a)}},ju)}var n0=Uu(function(e,t,n,r){Xo(e,t,n,r)}),qo=Uu(function(e,t,n){Xo(e,t,n)});function r0(e,t,n,r){if(!Ct(e))return e;t=Yu(t,e);for(var s=-1,i=t.length,o=i-1,a=e;a!=null&&++s<i;){var l=Gu(t[s]),c=n;if(l==="__proto__"||l==="constructor"||l==="prototype")return e;if(s!=o){var u=a[l];c=void 0,c===void 0&&(c=Ct(u)?u:Go(t[s+1])?[]:{})}Lu(a,l,c),a=a[l]}return e}function s0(e,t,n){return e==null?e:r0(e,t,n)}var hi,tl;function i0(){if(tl)return hi;tl=1;var e=-1,t=1,n=0;function r(m,x,S,N,A){if(m===x)return m?[[n,m]]:[];if(S!=null){var v=F(m,x,S);if(v)return v}var y=a(m,x),M=m.substring(0,y);m=m.substring(y),x=x.substring(y),y=c(m,x);var D=m.substring(m.length-y);m=m.substring(0,m.length-y),x=x.substring(0,x.length-y);var P=s(m,x);return M&&P.unshift([n,M]),D&&P.push([n,D]),$(P,A),N&&h(P),P}function s(m,x){var S;if(!m)return[[t,x]];if(!x)return[[e,m]];var N=m.length>x.length?m:x,A=m.length>x.length?x:m,v=N.indexOf(A);if(v!==-1)return S=[[t,N.substring(0,v)],[n,A],[t,N.substring(v+A.length)]],m.length>x.length&&(S[0][0]=S[2][0]=e),S;if(A.length===1)return[[e,m],[t,x]];var y=u(m,x);if(y){var M=y[0],D=y[1],P=y[2],J=y[3],V=y[4],oe=r(M,P),le=r(D,J);return oe.concat([[n,V]],le)}return i(m,x)}function i(m,x){for(var S=m.length,N=x.length,A=Math.ceil((S+N)/2),v=A,y=2*A,M=new Array(y),D=new Array(y),P=0;P<y;P++)M[P]=-1,D[P]=-1;M[v+1]=0,D[v+1]=0;for(var J=S-N,V=J%2!==0,oe=0,le=0,I=0,L=0,Y=0;Y<A;Y++){for(var G=-Y+oe;G<=Y-le;G+=2){var H=v+G,j;G===-Y||G!==Y&&M[H-1]<M[H+1]?j=M[H+1]:j=M[H-1]+1;for(var Q=j-G;j<S&&Q<N&&m.charAt(j)===x.charAt(Q);)j++,Q++;if(M[H]=j,j>S)le+=2;else if(Q>N)oe+=2;else if(V){var ee=v+J-G;if(ee>=0&&ee<y&&D[ee]!==-1){var U=S-D[ee];if(j>=U)return o(m,x,j,Q)}}}for(var K=-Y+I;K<=Y-L;K+=2){var ee=v+K,U;K===-Y||K!==Y&&D[ee-1]<D[ee+1]?U=D[ee+1]:U=D[ee-1]+1;for(var q=U-K;U<S&&q<N&&m.charAt(S-U-1)===x.charAt(N-q-1);)U++,q++;if(D[ee]=U,U>S)L+=2;else if(q>N)I+=2;else if(!V){var H=v+J-K;if(H>=0&&H<y&&M[H]!==-1){var j=M[H],Q=v+j-H;if(U=S-U,j>=U)return o(m,x,j,Q)}}}}return[[e,m],[t,x]]}function o(m,x,S,N){var A=m.substring(0,S),v=x.substring(0,N),y=m.substring(S),M=x.substring(N),D=r(A,v),P=r(y,M);return D.concat(P)}function a(m,x){if(!m||!x||m.charAt(0)!==x.charAt(0))return 0;for(var S=0,N=Math.min(m.length,x.length),A=N,v=0;S<A;)m.substring(v,A)==x.substring(v,A)?(S=A,v=S):N=A,A=Math.floor((N-S)/2+S);return k(m.charCodeAt(A-1))&&A--,A}function l(m,x){var S=m.length,N=x.length;if(S==0||N==0)return 0;S>N?m=m.substring(S-N):S<N&&(x=x.substring(0,S));var A=Math.min(S,N);if(m==x)return A;for(var v=0,y=1;;){var M=m.substring(A-y),D=x.indexOf(M);if(D==-1)return v;y+=D,(D==0||m.substring(A-y)==x.substring(0,y))&&(v=y,y++)}}function c(m,x){if(!m||!x||m.slice(-1)!==x.slice(-1))return 0;for(var S=0,N=Math.min(m.length,x.length),A=N,v=0;S<A;)m.substring(m.length-A,m.length-v)==x.substring(x.length-A,x.length-v)?(S=A,v=S):N=A,A=Math.floor((N-S)/2+S);return W(m.charCodeAt(m.length-A))&&A--,A}function u(m,x){var S=m.length>x.length?m:x,N=m.length>x.length?x:m;if(S.length<4||N.length*2<S.length)return null;function A(le,I,L){for(var Y=le.substring(L,L+Math.floor(le.length/4)),G=-1,H="",j,Q,ee,U;(G=I.indexOf(Y,G+1))!==-1;){var K=a(le.substring(L),I.substring(G)),q=c(le.substring(0,L),I.substring(0,G));H.length<q+K&&(H=I.substring(G-q,G)+I.substring(G,G+K),j=le.substring(0,L-q),Q=le.substring(L+K),ee=I.substring(0,G-q),U=I.substring(G+K))}return H.length*2>=le.length?[j,Q,ee,U,H]:null}var v=A(S,N,Math.ceil(S.length/4)),y=A(S,N,Math.ceil(S.length/2)),M;if(!v&&!y)return null;y?v?M=v[4].length>y[4].length?v:y:M=y:M=v;var D,P,J,V;m.length>x.length?(D=M[0],P=M[1],J=M[2],V=M[3]):(J=M[0],V=M[1],D=M[2],P=M[3]);var oe=M[4];return[D,P,J,V,oe]}function h(m){for(var x=!1,S=[],N=0,A=null,v=0,y=0,M=0,D=0,P=0;v<m.length;)m[v][0]==n?(S[N++]=v,y=D,M=P,D=0,P=0,A=m[v][1]):(m[v][0]==t?D+=m[v][1].length:P+=m[v][1].length,A&&A.length<=Math.max(y,M)&&A.length<=Math.max(D,P)&&(m.splice(S[N-1],0,[e,A]),m[S[N-1]+1][0]=t,N--,N--,v=N>0?S[N-1]:-1,y=0,M=0,D=0,P=0,A=null,x=!0)),v++;for(x&&$(m),b(m),v=1;v<m.length;){if(m[v-1][0]==e&&m[v][0]==t){var J=m[v-1][1],V=m[v][1],oe=l(J,V),le=l(V,J);oe>=le?(oe>=J.length/2||oe>=V.length/2)&&(m.splice(v,0,[n,V.substring(0,oe)]),m[v-1][1]=J.substring(0,J.length-oe),m[v+1][1]=V.substring(oe),v++):(le>=J.length/2||le>=V.length/2)&&(m.splice(v,0,[n,J.substring(0,le)]),m[v-1][0]=t,m[v-1][1]=V.substring(0,V.length-le),m[v+1][0]=e,m[v+1][1]=J.substring(le),v++),v++}v++}}var d=/[^a-zA-Z0-9]/,f=/\s/,g=/[\r\n]/,p=/\n\r?\n$/,R=/^\r?\n\r?\n/;function b(m){function x(le,I){if(!le||!I)return 6;var L=le.charAt(le.length-1),Y=I.charAt(0),G=L.match(d),H=Y.match(d),j=G&&L.match(f),Q=H&&Y.match(f),ee=j&&L.match(g),U=Q&&Y.match(g),K=ee&&le.match(p),q=U&&I.match(R);return K||q?5:ee||U?4:G&&!j&&Q?3:j||Q?2:G||H?1:0}for(var S=1;S<m.length-1;){if(m[S-1][0]==n&&m[S+1][0]==n){var N=m[S-1][1],A=m[S][1],v=m[S+1][1],y=c(N,A);if(y){var M=A.substring(A.length-y);N=N.substring(0,N.length-y),A=M+A.substring(0,A.length-y),v=M+v}for(var D=N,P=A,J=v,V=x(N,A)+x(A,v);A.charAt(0)===v.charAt(0);){N+=A.charAt(0),A=A.substring(1)+v.charAt(0),v=v.substring(1);var oe=x(N,A)+x(A,v);oe>=V&&(V=oe,D=N,P=A,J=v)}m[S-1][1]!=D&&(D?m[S-1][1]=D:(m.splice(S-1,1),S--),m[S][1]=P,J?m[S+1][1]=J:(m.splice(S+1,1),S--))}S++}}function $(m,x){m.push([n,""]);for(var S=0,N=0,A=0,v="",y="",M;S<m.length;){if(S<m.length-1&&!m[S][1]){m.splice(S,1);continue}switch(m[S][0]){case t:A++,y+=m[S][1],S++;break;case e:N++,v+=m[S][1],S++;break;case n:var D=S-A-N-1;if(x){if(D>=0&&C(m[D][1])){var P=m[D][1].slice(-1);if(m[D][1]=m[D][1].slice(0,-1),v=P+v,y=P+y,!m[D][1]){m.splice(D,1),S--;var J=D-1;m[J]&&m[J][0]===t&&(A++,y=m[J][1]+y,J--),m[J]&&m[J][0]===e&&(N++,v=m[J][1]+v,J--),D=J}}if(O(m[S][1])){var P=m[S][1].charAt(0);m[S][1]=m[S][1].slice(1),v+=P,y+=P}}if(S<m.length-1&&!m[S][1]){m.splice(S,1);break}if(v.length>0||y.length>0){v.length>0&&y.length>0&&(M=a(y,v),M!==0&&(D>=0?m[D][1]+=y.substring(0,M):(m.splice(0,0,[n,y.substring(0,M)]),S++),y=y.substring(M),v=v.substring(M)),M=c(y,v),M!==0&&(m[S][1]=y.substring(y.length-M)+m[S][1],y=y.substring(0,y.length-M),v=v.substring(0,v.length-M)));var V=A+N;v.length===0&&y.length===0?(m.splice(S-V,V),S=S-V):v.length===0?(m.splice(S-V,V,[t,y]),S=S-V+1):y.length===0?(m.splice(S-V,V,[e,v]),S=S-V+1):(m.splice(S-V,V,[e,v],[t,y]),S=S-V+2)}S!==0&&m[S-1][0]===n?(m[S-1][1]+=m[S][1],m.splice(S,1)):S++,A=0,N=0,v="",y="";break}}m[m.length-1][1]===""&&m.pop();var oe=!1;for(S=1;S<m.length-1;)m[S-1][0]===n&&m[S+1][0]===n&&(m[S][1].substring(m[S][1].length-m[S-1][1].length)===m[S-1][1]?(m[S][1]=m[S-1][1]+m[S][1].substring(0,m[S][1].length-m[S-1][1].length),m[S+1][1]=m[S-1][1]+m[S+1][1],m.splice(S-1,1),oe=!0):m[S][1].substring(0,m[S+1][1].length)==m[S+1][1]&&(m[S-1][1]+=m[S+1][1],m[S][1]=m[S][1].substring(m[S+1][1].length)+m[S+1][1],m.splice(S+1,1),oe=!0)),S++;oe&&$(m,x)}function k(m){return m>=55296&&m<=56319}function W(m){return m>=56320&&m<=57343}function O(m){return W(m.charCodeAt(0))}function C(m){return k(m.charCodeAt(m.length-1))}function w(m){for(var x=[],S=0;S<m.length;S++)m[S][1].length>0&&x.push(m[S]);return x}function T(m,x,S,N){return C(m)||O(N)?null:w([[n,m],[e,x],[t,S],[n,N]])}function F(m,x,S){var N=typeof S=="number"?{index:S,length:0}:S.oldRange,A=typeof S=="number"?null:S.newRange,v=m.length,y=x.length;if(N.length===0&&(A===null||A.length===0)){var M=N.index,D=m.slice(0,M),P=m.slice(M),J=A?A.index:null;e:{var V=M+y-v;if(J!==null&&J!==V||V<0||V>y)break e;var oe=x.slice(0,V),le=x.slice(V);if(le!==P)break e;var I=Math.min(M,V),L=D.slice(0,I),Y=oe.slice(0,I);if(L!==Y)break e;var G=D.slice(I),H=oe.slice(I);return T(L,G,H,P)}e:{if(J!==null&&J!==M)break e;var j=M,oe=x.slice(0,j),le=x.slice(j);if(oe!==D)break e;var Q=Math.min(v-j,y-j),ee=P.slice(P.length-Q),U=le.slice(le.length-Q);if(ee!==U)break e;var G=P.slice(0,P.length-Q),H=le.slice(0,le.length-Q);return T(D,G,H,ee)}}if(N.length>0&&A&&A.length===0)e:{var L=m.slice(0,N.index),ee=m.slice(N.index+N.length),I=L.length,Q=ee.length;if(y<I+Q)break e;var Y=x.slice(0,I),U=x.slice(y-Q);if(L!==Y||ee!==U)break e;var G=m.slice(I,v-Q),H=x.slice(I,y-Q);return T(L,G,H,ee)}return null}function B(m,x,S,N){return r(m,x,S,N,!0)}return B.INSERT=t,B.DELETE=e,B.EQUAL=n,hi=B,hi}var o0=i0();const Zo=Rt(o0),a0=new Set(["true","false"]);function l0(e){return a0.has(e.toLowerCase())}var di,nl;function c0(){if(nl)return di;nl=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(k,W){i=k,o=W})),s=s||{};var l=!1,c=null,u=null,h=null,d=this,f=function(k,W,O){u&&(clearTimeout(u),u=null),h&&(clearTimeout(h),h=null),k&&(d.queues[t]&&d.queues[t].length===0&&delete d.queues[t],d.domainReentrant&&delete d.domains[t]),l||(a?W?o(W):i(O):typeof r=="function"&&r(W,O),l=!0),k&&d.queues[t]&&d.queues[t].length>0&&d.queues[t].shift()()},g=function(k){if(l)return f(k);c&&(clearTimeout(c),c=null),d.domainReentrant&&k&&(d.domains[t]=process.domain);var W=s.maxExecutionTime||d.maxExecutionTime;if(W&&(h=setTimeout(function(){d.queues[t]&&f(k,new Error("Maximum execution time is exceeded "+t))},W)),n.length===1){var O=!1;try{n(function(C,w){O||(O=!0,f(k,C,w))})}catch(C){O||(O=!0,f(k,C))}}else d._promiseTry(function(){return n()}).then(function(C){f(k,void 0,C)},function(C){f(k,C)})};d.domainReentrant&&process.domain&&(g=process.domain.bind(g));var p=s.maxPending||d.maxPending;if(!d.queues[t])d.queues[t]=[],g(!0);else if(d.domainReentrant&&process.domain&&process.domain===d.domains[t])g(!1);else if(d.queues[t].length>=p)f(!1,new Error("Too many pending tasks in queue "+t));else{var R=function(){g(!0)};s.skipQueue?d.queues[t].unshift(R):d.queues[t].push(R);var b=s.timeout||d.timeout;b&&(c=setTimeout(function(){c=null,f(!1,new Error("async-lock timed out in queue "+t))},b))}var $=s.maxOccupationTime||d.maxOccupationTime;if($&&(u=setTimeout(function(){d.queues[t]&&f(!1,new Error("Maximum occupation time is exceeded in queue "+t))},$)),a)return a},e.prototype._acquireBatch=function(t,n,r,s){typeof r!="function"&&(s=r,r=null);var i=this,o=function(l,c){return function(u){i.acquire(l,c,u,s)}},a=t.reduceRight(function(l,c){return o(c,l)},n);if(typeof r=="function")a(r);else return new this.Promise(function(l,c){a.length===1?a(function(u,h){u?c(u):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)}},di=e,di}var fi,rl;function u0(){return rl||(rl=1,fi=c0()),fi}var h0=u0();const d0=Rt(h0);function qu(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 ve=(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))(ve||{}),xt=(e=>(e[e.Reader=0]="Reader",e[e.Editor=1]="Editor",e[e.Owner=2]="Owner",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(xt||{}),Wi=(e=>(e[e.SomeCollaborator=0]="SomeCollaborator",e[e.AllCollaborator=1]="AllCollaborator",e[e.OneSelf=2]="OneSelf",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(Wi||{});class zs extends Ke{}function f0(e=z.generateRandomId(6),t=Pr.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:$o.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 fn={},rr={},es={},sl;function m0(){if(sl)return es;sl=1,Object.defineProperty(es,"__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 es.default=n,es}var ts={},il;function g0(){if(il)return ts;il=1,Object.defineProperty(ts,"__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 ts.default=e,ts}var mi={},ol;function Zu(){return ol||(ol=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(u,h){if(!u)throw new Error(h)}const n=u=>u!=null&&typeof u=="object"&&!Array.isArray(u),r=(u,h)=>typeof u==typeof h?u>h:typeof u=="string"&&typeof h=="number";function s(u,h){for(let d in u){const f=d;h.write(f,u[f])}}e.isValidPathItem=u=>typeof u=="number"||typeof u=="string"&&u!=="__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,g=this.idx;for(;g>=0;)h.unshift(d[g]),g===0?(g=this.indexes[f*2],d=this.parents[f--]):g-=n(d[g-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,g){this.container=h,this.idx=d,this.parents=f.slice(),this.indexes=g.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 g of this)h&&h.descend(g),this.traverse(h,d),h&&h.ascend()}eachPick(h,d){this.traverse(h,(f,g)=>{f.p!=null&&d(f.p,g)})}eachDrop(h,d){this.traverse(h,(f,g)=>{f.d!=null&&d(f.d,g)})}}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 g=this.container.splice(f,this.container.length-f);this.container.push(g),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 g=[d];this.container.splice(f,0,g),this.container=g}}}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,g=this.parents.length;let p=0;for(let R=0;R<h.length;R++){const b=h[R];typeof b=="string"||typeof b=="number"?(p++,this.descend(b)):Array.isArray(b)?this.mergeTree(b,d):typeof b=="object"&&d(b,this)}for(;p--;)this.ascend();this.lcIdx=this.parents.length===g?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=u=>new o(u);function l(u,h,d){let f,g;g=f=u?u.descendFirst():!1;function p(R){let b;for(;g;){const $=b=u.getKey();if(R!=null){let k=!1;if(h&&typeof $=="number"&&(b=h($,u.getComponent()),b<0&&(b=~b,k=!0)),r(b,R))return null;if(b===R&&!k)return u}d&&typeof b=="number"&&d(b,u.getComponent()),g=u.nextSibling()}return null}return p.end=()=>{f&&u.ascend()},p}e.advancer=l;function c(u,h,d){let f,g,p,R;for(f=g=u&&u.descendFirst(),p=R=h&&h.descendFirst();f||p;){let b=f?u.getKey():null,$=p?h.getKey():null;b!==null&&$!==null&&(r($,b)?$=null:b!==$&&(b=null)),d(b==null?$:b,b!=null?u:null,$!=null?h:null),b!=null&&f&&(f=u.nextSibling()),$!=null&&p&&(p=h.nextSibling())}g&&u.ascend(),R&&h.ascend()}e.eachChildOf=c}(mi)),mi}var gi={},al;function Ju(){return al||(al=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={}))}(gi)),gi}var wt={},mn={},ll;function Jo(){return ll||(ll=1,Object.defineProperty(mn,"__esModule",{value:!0}),mn.uniToStrPos=mn.strPosToUni=void 0,mn.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},mn.uniToStrPos=(e,t)=>{let n=0;for(;t>0;t--){const r=e.charCodeAt(n);n+=r>=55296&&r<=57343?2:1}return n}),mn}var _i={},cl;function Yi(){return cl||(cl=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.uniSlice=e.dlen=e.eachOp=void 0;const t=Jo(),n=O=>{if(!Array.isArray(O))throw Error("Op must be an array of components");let C=null;for(let w=0;w<O.length;w++){const T=O[w];switch(typeof T){case"object":if(typeof T.d!="number"&&typeof T.d!="string")throw Error("Delete must be number or string");if(e.dlen(T.d)<=0)throw Error("Deletes must not be empty");break;case"string":if(!(T.length>0))throw Error("Inserts cannot be empty");break;case"number":if(!(T>0))throw Error("Skip components must be >0");if(typeof C=="number")throw Error("Adjacent skip components should be combined");break}C=T}if(typeof C=="number")throw Error("Op has a trailing skip")};function r(O,C){let w=0,T=0;for(let F=0;F<O.length;F++){const B=O[F];switch(C(B,w,T),typeof B){case"object":w+=e.dlen(B.d);break;case"string":T+=t.strPosToUni(B);break;case"number":w+=B,T+=B;break}}}e.eachOp=r;function s(O,C){const w=[],T=a(w);return r(O,(F,B,m)=>{T(C(F,B,m))}),h(w)}const i=O=>O,o=O=>s(O,i);e.dlen=O=>typeof O=="number"?O:t.strPosToUni(O);const a=O=>C=>{if(!(!C||C.d===0||C.d===""))if(O.length===0)O.push(C);else if(typeof C==typeof O[O.length-1])if(typeof C=="object"){const w=O[O.length-1];w.d=typeof w.d=="string"&&typeof C.d=="string"?w.d+C.d:e.dlen(w.d)+e.dlen(C.d)}else O[O.length-1]+=C;else O.push(C)},l=O=>typeof O=="number"?O:typeof O=="string"?t.strPosToUni(O):typeof O.d=="number"?O.d:t.strPosToUni(O.d);e.uniSlice=(O,C,w)=>{const T=t.uniToStrPos(O,C),F=w==null?1/0:t.uniToStrPos(O,w);return O.slice(T,F)};const c=(O,C,w)=>typeof O=="number"?w==null?O-C:Math.min(O,w)-C:e.uniSlice(O,C,w),u=O=>{let C=0,w=0;return{take:(B,m)=>{if(C===O.length)return B===-1?null:B;const x=O[C];let S;if(typeof x=="number")return B===-1||x-w<=B?(S=x-w,++C,w=0,S):(w+=B,B);if(typeof x=="string"){if(B===-1||m==="i"||t.strPosToUni(x.slice(w))<=B)return S=x.slice(w),++C,w=0,S;{const N=w+t.uniToStrPos(x.slice(w),B);return S=x.slice(w,N),w=N,S}}else{if(B===-1||m==="d"||e.dlen(x.d)-w<=B)return S={d:c(x.d,w)},++C,w=0,S;{let N=c(x.d,w,w+B);return w+=B,{d:N}}}},peek:()=>O[C]}},h=O=>(O.length>0&&typeof O[O.length-1]=="number"&&O.pop(),O);function d(O,C,w){if(w!=="left"&&w!=="right")throw Error("side ("+w+") must be 'left' or 'right'");n(O),n(C);const T=[],F=a(T),{take:B,peek:m}=u(O);for(let S=0;S<C.length;S++){const N=C[S];let A,v;switch(typeof N){case"number":for(A=N;A>0;)v=B(A,"i"),F(v),typeof v!="string"&&(A-=l(v));break;case"string":w==="left"&&typeof m()=="string"&&F(B(-1)),F(t.strPosToUni(N));break;case"object":for(A=e.dlen(N.d);A>0;)switch(v=B(A,"i"),typeof v){case"number":A-=v;break;case"string":F(v);break;case"object":A-=e.dlen(v.d)}break}}let x;for(;x=B(-1);)F(x);return h(T)}function f(O,C){n(O),n(C);const w=[],T=a(w),{take:F}=u(O);for(let m=0;m<C.length;m++){const x=C[m];let S,N;switch(typeof x){case"number":for(S=x;S>0;)N=F(S,"d"),T(N),typeof N!="object"&&(S-=l(N));break;case"string":T(x);break;case"object":S=e.dlen(x.d);let A=0;for(;A<S;)switch(N=F(S-A,"d"),typeof N){case"number":T({d:c(x.d,A,A+N)}),A+=N;break;case"string":A+=t.strPosToUni(N);break;case"object":T(N)}break}}let B;for(;B=F(-1);)T(B);return h(w)}const g=(O,C)=>{let w=0;for(let T=0;T<C.length&&O>w;T++){const F=C[T];switch(typeof F){case"number":{w+=F;break}case"string":const B=t.strPosToUni(F);w+=B,O+=B;break;case"object":O-=Math.min(e.dlen(F.d),O-w);break}}return O},p=(O,C)=>typeof O=="number"?g(O,C):O.map(w=>g(w,C));function R(O,C,w){return s(O,(T,F)=>typeof T=="object"&&typeof T.d=="number"?{d:w.slice(C,F,F+T.d)}:T)}function b(O){return s(O,C=>{switch(typeof C){case"object":if(typeof C.d=="number")throw Error("Cannot invert text op: Deleted characters missing from operation. makeInvertible must be called first.");return C.d;case"string":return{d:C};case"number":return C}})}function $(O){return s(O,C=>typeof C=="object"&&typeof C.d=="string"?{d:t.strPosToUni(C.d)}:C)}function k(O){let C=!0;return r(O,w=>{typeof w=="object"&&typeof w.d=="number"&&(C=!1)}),C}function W(O){return{name:"text-unicode",uri:"http://sharejs.org/types/text-unicode",trim:h,normalize:o,checkOp:n,create(C=""){if(typeof C!="string")throw Error("Initial data must be a string");return O.create(C)},apply(C,w){n(w);const T=O.builder(C);for(let F=0;F<w.length;F++){const B=w[F];switch(typeof B){case"number":T.skip(B);break;case"string":T.append(B);break;case"object":T.del(e.dlen(B.d));break}}return T.build()},transform:d,compose:f,transformPosition:g,transformSelection:p,isInvertible:k,makeInvertible(C,w){return R(C,w,O)},stripInvertible:$,invert:b,invertWithDoc(C,w){return b(R(C,w,O))},isNoop:C=>C.length===0}}e.default=W}(_i)),_i}var ns={},ul;function _0(){if(ul)return ns;ul=1,Object.defineProperty(ns,"__esModule",{value:!0});const e=Yi(),t=Jo();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 c=e.dlen(o.d);this.onRemove&&this.onRemove(l,c)}})},onInsert:null,onRemove:null}}return ns.default=n,n.provides={text:!0},ns}var hl;function p0(){return hl||(hl=1,function(e){var t=wt&&wt.__createBinding||(Object.create?function(d,f,g,p){p===void 0&&(p=g),Object.defineProperty(d,p,{enumerable:!0,get:function(){return f[g]}})}:function(d,f,g,p){p===void 0&&(p=g),d[p]=f[g]}),n=wt&&wt.__setModuleDefault||(Object.create?function(d,f){Object.defineProperty(d,"default",{enumerable:!0,value:f})}:function(d,f){d.default=f}),r=wt&&wt.__importStar||function(d){if(d&&d.__esModule)return d;var f={};if(d!=null)for(var g in d)Object.hasOwnProperty.call(d,g)&&t(f,d,g);return n(f,d),f},s=wt&&wt.__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=Jo(),o=r(Yi()),a=s(_0()),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(g){let p=i.uniToStrPos(d,g);if(p>d.length)throw Error("The op is too long for this document");f.push(d.slice(0,p)),d=d.slice(p)},append(g){f.push(g)},del(g){d=d.slice(i.uniToStrPos(d,g))},build(){return f.join("")+d}}},slice:o.uniSlice},c=o.default(l),u=Object.assign(Object.assign({},c),{api:a.default});e.type=u,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=Yi();Object.defineProperty(e,"makeType",{enumerable:!0,get:function(){return h.default}})}(wt)),wt}var dl;function E0(){return dl||(dl=1,function(e){var t=rr&&rr.__importDefault||function(I){return I&&I.__esModule?I:{default:I}};Object.defineProperty(e,"__esModule",{value:!0}),e.editOp=e.replaceOp=e.insertOp=e.moveOp=e.removeOp=e.type=void 0;const n=t(m0()),r=t(g0()),s=Zu(),i=Ju();function o(I,L){if(!I)throw new Error(L)}e.type={name:"json1",uri:"http://sharejs.org/types/JSONv1",readCursor:s.readCursor,writeCursor:s.writeCursor,create:I=>I,isNoop:I=>I==null,setDebug(I){},registerSubtype:b,checkValidOp:F,normalize:B,apply:m,transformPosition:x,compose:S,tryTransform:D,transform:J,makeInvertible:v,invert:N,invertWithDoc:y,RM_UNEXPECTED_CONTENT:i.ConflictType.RM_UNEXPECTED_CONTENT,DROP_COLLISION:i.ConflictType.DROP_COLLISION,BLACKHOLE:i.ConflictType.BLACKHOLE,transformNoConflict:(I,L,Y)=>le(()=>!0,I,L,Y),typeAllowingConflictsPred:I=>Object.assign(Object.assign({},e.type),{transform:(L,Y,G)=>le(I,L,Y,G)})};const a=I=>I?I.getComponent():null;function l(I){return I&&typeof I=="object"&&!Array.isArray(I)}const c=I=>Array.isArray(I)?I.slice():I!==null&&typeof I=="object"?Object.assign({},I):I,u=I=>I&&(I.p!=null||I.r!==void 0),h=I=>I&&(I.d!=null||I.i!==void 0);function d(I,L){return o(I!=null),typeof L=="number"?(o(Array.isArray(I),"Invalid key - child is not an array"),(I=I.slice()).splice(L,1)):(o(l(I),"Invalid key - child is not an object"),delete(I=Object.assign({},I))[L]),I}function f(I,L,Y){return typeof L=="number"?(o(I!=null,"Container is missing for key"),o(Array.isArray(I),"Cannot use numerical key for object container"),o(I.length>=L,"Cannot insert into out of bounds index"),I.splice(L,0,Y)):(o(l(I),"Cannot insert into missing item"),o(I[L]===void 0,"Trying to overwrite value at key. Your op needs to remove it first"),I[L]=Y),Y}e.removeOp=(I,L=!0)=>s.writeCursor().writeAtPath(I,"r",L).get(),e.moveOp=(I,L)=>s.writeCursor().writeMove(I,L).get(),e.insertOp=(I,L)=>s.writeCursor().writeAtPath(I,"i",L).get(),e.replaceOp=(I,L,Y)=>s.writeCursor().at(I,G=>{G.write("r",L),G.write("i",Y)}).get(),e.editOp=(I,L,Y,G=!1)=>s.writeCursor().at(I,H=>C(H,L,Y,G)).get();const g=(I,L)=>I!=null&&(typeof L=="number"?Array.isArray(I):typeof I=="object"),p=(I,L)=>g(I,L)?I[L]:void 0,R={};function b(I){let L=I.type?I.type:I;L.name&&(R[L.name]=L),L.uri&&(R[L.uri]=L)}const $=I=>{const L=R[I];if(L)return L;throw Error("Missing type: "+I)};b(p0());const k=(I,L)=>I+L;b({name:"number",apply:k,compose:k,invert:I=>-I,transform:I=>I});const W=I=>I==null?null:I.et?$(I.et):I.es?R["text-unicode"]:I.ena!=null?R.number:null,O=I=>I.es?I.es:I.ena!=null?I.ena:I.e,C=(I,L,Y,G=!1)=>{const[H,j]=typeof L=="string"?[$(L),L]:[L,L.name];!G&&H.isNoop&&H.isNoop(Y)||(j==="number"?I.write("ena",Y):j==="text-unicode"?I.write("es",Y):(I.write("et",j),I.write("e",Y)))};function w(I){o(typeof I=="number"),o(I>=0),o(I===(0|I))}function T(I){typeof I=="number"?w(I):o(typeof I=="string")}function F(I){if(I===null)return;const L=new Set,Y=new Set,G=j=>{let Q=!0,ee=!1;for(let U in j){const K=j[U];if(Q=!1,o(U==="p"||U==="r"||U==="d"||U==="i"||U==="e"||U==="es"||U==="ena"||U==="et","Invalid component item '"+U+"'"),U==="p")w(K),o(!L.has(K)),L.add(K),o(j.r===void 0);else if(U==="d")w(K),o(!Y.has(K)),Y.add(K),o(j.i===void 0);else if(U==="e"||U==="es"||U==="ena"){o(!ee),ee=!0;const q=W(j);o(q,"Missing type in edit"),q.checkValidOp&&q.checkValidOp(O(j))}}o(!Q)},H=(j,Q,ee)=>{if(!Array.isArray(j))throw Error("Op must be null or a list");if(j.length===0)throw Error("Empty descent");Q||T(j[0]);let U=1,K=0,q=0;for(let ne=0;ne<j.length;ne++){const me=j[ne];if(o(me!=null),Array.isArray(me)){const pe=H(me,!1);if(K){const X=typeof q,he=typeof pe;X===he?o(q<pe,"descent keys are not in order"):o(X==="number"&&he==="string")}q=pe,K++,U=3}else typeof me=="object"?(o(U===1,`Prev not scalar - instead ${U}`),G(me),U=2):(o(U!==3),T(me),o(s.isValidPathItem(me),"Invalid path key"),U=1)}return o(K!==1,"Operation makes multiple descents. Remove some []"),o(U===2||U===3),j[0]};H(I,!0),o(L.size===Y.size,"Mismatched picks and drops in op");for(let j=0;j<L.size;j++)o(L.has(j)),o(Y.has(j))}function B(I){let L=0,Y=[];const G=s.writeCursor();return G.mergeTree(I,(H,j)=>{const Q=W(H);if(Q){const U=O(H);C(j,Q,Q.normalize?Q.normalize(U):U)}for(const U of["r","p","i","d"])if(H[U]!==void 0){const K=U==="p"||U==="d"?(ee=H[U],Y[ee]==null&&(Y[ee]=L++),Y[ee]):H[U];j.write(U,K)}var ee}),G.get()}function m(I,L){if(F(L),L===null)return I;const Y=[];return function G(H,j){let Q=H,ee=0,U={root:H},K=0,q=U,ne="root";function me(){for(;K<ee;K++){let pe=j[K];typeof pe!="object"&&(o(g(q,ne)),q=q[ne]=c(q[ne]),ne=pe)}}for(;ee<j.length;ee++){const pe=j[ee];if(Array.isArray(pe)){const X=G(Q,pe);X!==Q&&X!==void 0&&(me(),Q=q[ne]=X)}else if(typeof pe=="object"){pe.d!=null?(me(),Q=f(q,ne,Y[pe.d])):pe.i!==void 0&&(me(),Q=f(q,ne,pe.i));const X=W(pe);if(X)me(),Q=q[ne]=X.apply(Q,O(pe));else if(pe.e!==void 0)throw Error("Subtype "+pe.et+" undefined")}else Q=p(Q,pe)}return U.root}(I=function G(H,j){const Q=[];let ee=0;for(;ee<j.length;ee++){const ne=j[ee];if(Array.isArray(ne))break;typeof ne!="object"&&(Q.push(H),H=p(H,ne))}for(let ne=j.length-1;ne>=ee;ne--)H=G(H,j[ne]);for(--ee;ee>=0;ee--){const ne=j[ee];if(typeof ne!="object"){const me=Q.pop();H=H===p(me,ne)?me:H===void 0?d(me,ne):(K=ne,q=H,(U=c(U=me))[K]=q,U)}else u(ne)&&(o(H!==void 0,"Cannot pick up or remove undefined"),ne.p!=null&&(Y[ne.p]=H),H=void 0)}var U,K,q;return H}(I,L),L)}function x(I,L){I=I.slice(),F(L);const Y=s.readCursor(L);let G,H,j=!1;const Q=[];for(let U=0;;U++){const K=I[U],q=Y.getComponent();if(q&&(q.r!==void 0?j=!0:q.p!=null&&(j=!1,G=q.p,H=U)),U>=I.length)break;let ne=0;const me=s.advancer(Y,void 0,(X,he)=>{u(he)&&ne++});Q.unshift(me);const pe=me(K);if(typeof K=="number"&&(I[U]-=ne),!pe)break}if(Q.forEach(U=>U.end()),j)return null;const ee=()=>{let U=0;if(G!=null){const K=Y.getPath();U=K.length,I=K.concat(I.slice(H))}for(;U<I.length;U++){const K=I[U],q=a(Y),ne=W(q);if(ne){const X=O(q);ne.transformPosition&&(I[U]=ne.transformPosition(I[U],X));break}let me=0;const pe=s.advancer(Y,(X,he)=>h(he)?~(X-me):X-me,(X,he)=>{h(he)&&me++})(K);if(typeof K=="number"&&(I[U]+=me),!pe)break}};return G!=null?Y.eachDrop(null,U=>{U===G&&ee()}):ee(),I}function S(I,L){if(F(I),F(L),I==null)return L;if(L==null)return I;let Y=0;const G=s.readCursor(I),H=s.readCursor(L),j=s.writeCursor(),Q=[],ee=[],U=[],K=[],q=[],ne=[],me=new Set;G.traverse(null,X=>{X.p!=null&&(U[X.p]=G.clone())}),H.traverse(null,X=>{X.d!=null&&(K[X.d]=H.clone())});const pe=s.writeCursor();return function X(he,Le,ye,Ie,Fe,kt,tt,qe){o(Le||ye);const Be=a(Le),dt=a(ye),It=!!dt&&dt.r!==void 0,ln=!!Be&&Be.i!==void 0,ft=Be?Be.d:null,at=dt?dt.p:null,Ft=(kt||It)&&at==null;if(at!=null)Ie=K[at],tt=ee[at]=new s.WriteCursor;else if(dt&&dt.r!==void 0)Ie=null;else{const se=a(Ie);se&&se.d!=null&&(Ie=null)}const be=a(Ie);if(ft!=null)if(he=U[ft],qe=Q[ft]=new s.WriteCursor,Ft)kt&&!It&&qe.write("r",!0);else{const se=q[ft]=Y++;tt.write("d",se)}else if(Be&&Be.i!==void 0)he=null;else{const se=a(he);se&&se.p!=null&&(he=null)}let ae;ln?(o(Fe===void 0),ae=Be.i):ae=Fe;const Ce=(at==null?!ln||kt||It:ae===void 0)?null:tt.getComponent();if(at!=null){if(!(Fe!==void 0||ln)){const se=ft!=null?q[ft]:Y++;ne[at]=se,qe.write("p",se)}}else It&&(ln||Fe!==void 0||(dt.r,qe.write("r",dt.r)));const ue=Ft?null:W(Be),re=W(be);if((ue||re)&&(ue&&ue.name,re&&re.name),ue&&re){o(ue===re);const se=O(Be),Re=O(be),ze=ue.compose(se,Re);C(tt,ue,ze),me.add(be)}else ue?C(tt,ue,O(Be)):re&&(C(tt,re,O(be)),me.add(be));const de=typeof ae=="object"&&ae!=null;let we=!1,Oe=0,Te=0,Ve=0,We=0,$e=0;const et=s.advancer(Ie,(se,Re)=>h(Re)?We-se-1:se-We,(se,Re)=>{h(Re)&&We++}),Se=s.advancer(he,(se,Re)=>u(Re)?Oe-se-1:se-Oe,(se,Re)=>{u(Re)&&Oe++});if(s.eachChildOf(Le,ye,(se,Re,ze)=>{let nt,Bt,cn=se,St=se,Qn=se;if(typeof se=="number"){let Ze=se+Ve;Bt=et(Ze),St=Ze+We;let He=se+Te;nt=Se(He),h(a(Bt))&&(nt=null),cn=He+Oe,Qn=se+$e,o(cn>=0,"p1PickKey is negative"),o(St>=0,"p2DropKey is negative");const Ot=h(a(Re)),$t=u(a(ze));(Ot||$t&&!Ft)&&$e--,Ot&&Te--,$t&&Ve--}else nt=Se(se),Bt=et(se);qe.descend(cn),tt.descend(St);const vn=de&&!h(a(Re))?ae[Qn]:void 0,Nt=X(nt,Re,ze,Bt,vn,Ft,tt,qe);var Mt,ge,Pe;de&&!Ft?vn!==Nt&&(we||(ae=Array.isArray(ae)?ae.slice():Object.assign({},ae),we=!0),Mt=ae,Pe=Nt,typeof(ge=Qn)=="number"?(o(Array.isArray(Mt)),o(ge<Mt.length)):(o(!Array.isArray(Mt)),o(Mt[ge]!==void 0)),Pe===void 0?typeof ge=="number"?Mt.splice(ge,1):delete Mt[ge]:Mt[ge]=Pe):o(Nt===void 0),tt.ascend(),qe.ascend()}),Se.end(),et.end(),Ce!=null)Ce.i=ae;else if(!kt&&!It&&at==null)return ae}(G,G.clone(),H,H.clone(),void 0,!1,j,pe),j.reset(),j.mergeTree(pe.get()),j.reset(),j.get(),Q.map(X=>X.get()),ee.map(X=>X.get()),G.traverse(j,(X,he)=>{const Le=X.p;if(Le!=null){const ye=q[Le];ye!=null&&he.write("p",ye);const Ie=Q[Le];Ie&&Ie.get(),Ie&&he.mergeTree(Ie.get())}else X.r!==void 0&&he.write("r",X.r)}),j.reset(),j.get(),H.traverse(j,(X,he)=>{const Le=X.d;if(Le!=null){const Ie=ne[Le];Ie!=null&&he.write("d",Ie);const Fe=ee[Le];Fe&&he.mergeTree(Fe.get())}else X.i!==void 0&&he.write("i",X.i);const ye=W(X);ye&&!me.has(X)&&C(he,ye,O(X))}),j.get()}function N(I){if(I==null)return null;const L=new s.ReadCursor(I),Y=new s.WriteCursor;let G;const H=[],j=[];return function Q(ee,U,K){const q=ee.getComponent();let ne,me=!1;if(q){q.p!=null&&(U.write("d",q.p),H[q.p]=ee.clone()),q.r!==void 0&&U.write("i",q.r),q.d!=null&&(U.write("p",q.d),K=void 0),q.i!==void 0&&(K=ne=q.i);const X=W(q);X&&(K===void 0?(G||(G=new Set),G.add(q)):(O(q),K=X.apply(K,O(q)),me=!0))}let pe=0;for(const X of ee){U.descend(X);const he=typeof X=="number"?X-pe:X,Le=p(K,he);h(ee.getComponent())&&pe++;const ye=Q(ee,U,Le);if(K!==void 0&&ye!==void 0){if(me||(me=!0,K=c(K)),!g(K,he))throw Error("Cannot modify child - invalid operation");K[he]=ye}U.ascend()}if(ne===void 0)return me?K:void 0;U.write("r",K)}(L,Y,void 0),G&&(Y.reset(),function Q(ee,U,K){const q=U.getComponent();if(q){const X=q.d;if(X!=null&&(ee=H[X],K=j[X]=s.writeCursor()),G.has(q)){const he=W(q);if(!he.invert)throw Error(`Cannot invert subtype ${he.name}`);C(K,he,he.invert(O(q)))}}let ne=0,me=0;const pe=s.advancer(ee,(X,he)=>u(he)?ne-X-1:X-ne,(X,he)=>{u(he)&&ne++});for(const X of U)if(typeof X=="number"){const he=X-me,Le=pe(he),ye=he+ne;K.descend(ye),Q(Le,U,K),h(U.getComponent())&&me++,K.ascend()}else K.descend(X),Q(pe(X),U,K),K.ascend();pe.end()}(L.clone(),L,Y),j.length&&(Y.reset(),L.traverse(Y,(Q,ee)=>{const U=Q.p;if(U!=null){const K=j[U];K&&K.get(),K&&ee.mergeTree(K.get())}}))),Y.get()}const A=(I,L)=>I.some(Y=>typeof Y=="object"&&(Array.isArray(Y)?A(Y,L):L(Y)));function v(I,L){if(I==null||!A(I,U=>{var K;return U.r!==void 0||((K=W(U))===null||K===void 0?void 0:K.makeInvertible)!=null}))return I;const Y=new s.ReadCursor(I),G=new s.WriteCursor;let H=!1;const j=[],Q=[],ee=(U,K,q)=>{const ne=U.getComponent();let me=!1;if(ne){ne.d!=null&&K.write("d",ne.d),ne.i!==void 0&&K.write("i",ne.i);const X=ne.p;if(X!=null&&(j[X]=U.clone(),o(q!==void 0,"Operation picks up at an invalid key"),Q[X]=q,K.write("p",ne.p)),ne.r!==void 0&&q===void 0)throw Error("Invalid doc / op in makeInvertible: removed item missing from doc");const he=W(ne);he&&(he.makeInvertible?H=!0:C(K,he,O(ne),!0))}let pe=0;for(const X of U){K.descend(X);const he=typeof X=="number"?X-pe:X,Le=p(q,he),ye=ee(U,K,Le);Le!==ye&&(me||(me=!0,q=c(q)),ye===void 0?(q=d(q,he),typeof X=="number"&&pe++):q[he]=ye),K.ascend()}return ne&&(ne.r!==void 0?(K.write("r",r.default(q)),q=void 0):ne.p!=null&&(q=void 0)),q};return ee(Y,G,L),G.get(),H&&(G.reset(),function U(K,q,ne,me,pe){const X=q.getComponent();if(X){X.i!==void 0?(me=X.i,pe=!0):X.d!=null&&(me=Q[X.d],K=j[X.d],pe=!1,X.d);let Ie=W(X);if(Ie&&Ie.makeInvertible){const Fe=O(X);C(ne,Ie,Ie.makeInvertible(Fe,me),!0)}}let he=0,Le=0;const ye=s.advancer(K,(Ie,Fe)=>u(Fe)?he-Ie-1:Ie-he,(Ie,Fe)=>{u(Fe)&&he++});for(const Ie of q)if(typeof Ie=="number"){const Fe=Ie-Le,kt=ye(Fe),tt=Fe+he,qe=p(me,pe?Fe:tt);ne.descend(Ie),U(kt,q,ne,qe,pe),h(q.getComponent())&&Le++,ne.ascend()}else{const Fe=p(me,Ie);ne.descend(Ie),U(ye(Ie),q,ne,Fe,pe),ne.ascend()}ye.end()}(Y.clone(),Y,G,L,!1)),G.get()}function y(I,L){return N(v(I,L))}const M=I=>{if(I==null)return null;const L=I.slice();for(let Y=0;Y<I.length;Y++){const G=L[Y];Array.isArray(G)&&(L[Y]=M(G))}return L};function D(I,L,Y){o(Y==="left"||Y==="right","Direction must be left or right");const G=Y==="left"?0:1;if(L==null)return{ok:!0,result:I};F(I),F(L);let H=null;const j=[],Q=[],ee=[],U=[],K=[],q=[],ne=[],me=[],pe=[],X=[],he=[],Le=[],ye=[],Ie=[],Fe=[];let kt=0;const tt=s.readCursor(I),qe=s.readCursor(L),Be=s.writeCursor();if(function be(ae,Ce=null,ue){const re=a(Ce);re&&(re.r!==void 0?ue=Ce.clone():re.p!=null&&(ue=null,q[re.p]=ae.clone()));const de=ae.getComponent();let we;de&&(we=de.p)!=null&&(K[we]=Ce?Ce.clone():null,ee[we]=ae.clone(),ue&&(X[we]=!0,pe[we]=ue),re&&re.p!=null&&(Ie[we]=re.p));const Oe=s.advancer(Ce);for(const Te of ae)be(ae,Oe(Te),ue);Oe.end()}(qe,tt,null),function be(ae,Ce,ue,re,de){const we=ue.getComponent();let Oe,Te=!1;we&&((Oe=we.d)!=null?(U[Oe]=ue.clone(),re!=null&&(Fe[re]==null&&(Fe[re]=[]),Fe[re].push(Oe)),X[Oe],ae=K[Oe]||null,Ce=ee[Oe]||null,X[Oe]?(de&&(he[Oe]=!0),de=pe[Oe]||null):!de||G!==1&&Ie[Oe]!=null||H==null&&(H={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(de.getPath()),op2:e.moveOp(Ce.getPath(),ue.getPath())}),Te=!0):we.i!==void 0&&(ae=Ce=null,Te=!0,de&&H==null&&(H={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(de.getPath()),op2:e.insertOp(ue.getPath(),we.i)})));const Ve=a(ae);Ve&&(Ve.r!==void 0?de=ae.clone():Ve.p!=null&&(Ve.p,re=Ve.p,de=null));const We=W(we);We&&de&&H==null&&(H={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(de.getPath()),op2:e.editOp(ue.getPath(),We,O(we),!0)});let $e=0,et=0;const Se=s.advancer(Ce,(Re,ze)=>u(ze)?$e-Re-1:Re-$e,(Re,ze)=>{u(ze)&&$e++}),se=s.advancer(ae);for(const Re of ue)if(typeof Re=="number"){const ze=Re-et,nt=Se(ze);et+=+be(se(ze+$e),nt,ue,re,de)}else{const ze=Se(Re);be(se(Re),ze,ue,re,de)}return Se.end(),se.end(),Te}(tt,qe,qe.clone(),null,null),U.map(be=>be&&be.get()),H)return{ok:!1,conflict:H};he.map(be=>!!be);const dt=[];let It=null;(function be(ae,Ce,ue,re,de){let we=!1;const Oe=a(Ce);if(u(Oe)){const Se=Oe.p;Se!=null?(ue=U[Se],re=Le[Se]=s.writeCursor(),we=!0,de=null):(ue=null,de=Ce.clone())}else h(a(ue))&&(ue=null);const Te=ae.getComponent();if(Te){const Se=Te.p;Se!=null?(de&&(me[Se]=de),dt[Se]=de||G===1&&we?null:re.getComponent(),j[Se]=ae.clone(),ue&&(ne[Se]=ue.clone())):Te.r!==void 0&&(de||re.write("r",!0),(de||we)&&(It==null&&(It=new Set),It.add(Te)))}let Ve=0,We=0;const $e=s.advancer(Ce,void 0,(Se,se)=>{u(se)&&Ve++}),et=s.advancer(ue,(Se,se)=>h(se)?~(Se-We):Se-We,(Se,se)=>{h(se)&&We++});if(ae)for(const Se of ae)if(typeof Se=="string"){const se=$e(Se),Re=et(Se);re.descend(Se),be(ae,se,Re,re,de),re.ascend()}else{const se=$e(Se),Re=Se-Ve,ze=u(a(se))?null:et(Re),nt=Re+We;o(nt>=0),re.descend(nt),be(ae,se,ze,re,de),re.ascend()}$e.end(),et.end()})(tt,qe,qe.clone(),Be,null),Be.reset();let ln=[];if(function be(ae,Ce,ue,re,de,we){o(Ce);const Oe=Ce.getComponent();let Te=a(re),Ve=!1;const We=(ge,Pe,Ze)=>ge?e.moveOp(ge.getPath(),Pe.getPath()):e.insertOp(Pe.getPath(),Ze.i);if(h(Oe)){const ge=Oe.d;ge!=null&&(Q[ge]=Ce.clone());const Pe=ge!=null?dt[ge]:null;let Ze=!1;if(Oe.i!==void 0||ge!=null&&Pe){let He;Te&&(Te.i!==void 0||(He=Te.d)!=null&&!X[He])&&(Ze=He!=null?ge!=null&&ge===Ie[He]:n.default(Te.i,Oe.i),Ze||He!=null&&G!==1&&Ie[He]!=null||H==null&&(H={type:i.ConflictType.DROP_COLLISION,op1:We(ge!=null?j[ge]:null,Ce,Oe),op2:We(He!=null?ee[He]:null,re,Te)})),Ze||(we?H==null&&(H={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:We(ge!=null?j[ge]:null,Ce,Oe),op2:e.removeOp(we.getPath())}):(ge!=null?(ln[kt]=ge,de.write("d",Pe.p=kt++)):de.write("i",r.default(Oe.i)),Ve=!0))}else if(ge!=null&&!Pe){const He=me[ge];He&&(we=He.clone())}ge!=null?(ae=j[ge],ue=q[ge],re=ne[ge]):Oe.i!==void 0&&(ae=ue=null,Ze||(re=null))}else u(a(ae))&&(ae=ue=re=null);const $e=a(ae),et=a(ue);if(u(et)){const ge=et.p;et.r!==void 0&&(!$e||$e.r===void 0)||X[ge]?(re=null,we=ue.clone()):ge!=null&&(re=U[ge],G!==1&&Ie[ge]!=null||((de=ye[ge])||(de=ye[ge]=s.writeCursor()),de.reset(),we=null))}else!h(Oe)&&h(Te)&&(re=null);Te=re!=null?re.getComponent():null;const Se=W(Oe);if(Se){const ge=O(Oe);if(we)H==null&&(H={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.editOp(Ce.getPath(),Se,ge,!0),op2:e.removeOp(we.getPath())});else{const Pe=W(Te);let Ze;if(Pe){if(Se!==Pe)throw Error("Transforming incompatible types");const He=O(Te);Ze=Se.transform(ge,He,Y)}else Ze=r.default(ge);C(de,Se,Ze)}}let se=0,Re=0,ze=0,nt=0,Bt=0,cn=0,St=ae!=null&&ae.descendFirst(),Qn=St;const vn=s.advancer(ue,void 0,(ge,Pe)=>{u(Pe)&&ze++});let Nt=re!=null&&re.descendFirst(),Mt=Nt;for(const ge of Ce)if(typeof ge=="number"){let Pe;const Ze=h(Ce.getComponent()),He=ge-Re;{let zt;for(;St&&typeof(zt=ae.getKey())=="number";){zt+=se;const vt=ae.getComponent(),wn=u(vt);if(zt>He||zt===He&&(!wn||G===0&&Ze))break;if(wn){se--;const un=vt.p;Ie.includes(un),vt.d,a(ye[vt.d]),u(a(ye[vt.d])),(vt.r===void 0||It&&It.has(vt))&&(un==null||!dt[un]||G!==1&&Ie.includes(un))||Bt--}St=ae.nextSibling()}Pe=St&&zt===He?ae:null}const Ot=He-se;let $t=vn(Ot);const qs=Ot-ze;let Gr=null;{let zt,vt;for(;Nt&&typeof(zt=re.getKey())=="number";){vt=zt-nt;const wn=re.getComponent(),un=h(wn);if(vt>qs)break;if(vt===qs){if(!un){Gr=re;break}{if(G===0&&Ze){Gr=re;break}const Kt=$t&&u($t.getComponent());if(G===0&&Kt)break}}if(un){const Kt=wn.d;X[Kt],Ie[Kt],wn.i===void 0&&(X[Kt]||Ie[Kt]!=null&&G!==1)?(X[Kt]||Ie[Kt]!=null&&G===0)&&(nt++,cn--):nt++}Nt=re.nextSibling()}}const ha=qs+nt+Bt+cn;o(ha>=0,"trying to descend to a negative index"),de.descend(ha),Ze&&(Pe=$t=Gr=null,Re++),be(Pe,Ce,$t,Gr,de,we)&&cn++,de.ascend()}else{let Pe;for(;St&&(Pe=ae.getKey(),typeof Pe!="string"||!(Pe>ge||Pe===ge));)St=ae.nextSibling();const Ze=St&&Pe===ge?ae:null,He=vn(ge);let Ot;for(;Nt&&(Ot=re.getKey(),typeof Ot!="string"||!(Ot>ge||Ot===ge));)Nt=re.nextSibling();const $t=Nt&&Ot===ge?re:null;de.descend(ge),be(Ze,Ce,He,$t,de,we),de.ascend()}return vn.end(),Qn&&ae.ascend(),Mt&&re.ascend(),Ve}(tt,tt.clone(),qe,qe.clone(),Be,null),H)return{ok:!1,conflict:H};Be.reset();const ft=(be,ae,Ce)=>be.traverse(ae,(ue,re)=>{ue.d!=null&&Ce(ue.d,be,re)});(X.length||Le.length)&&(ft(qe,Be,(be,ae,Ce)=>{X[be]&&!he[be]&&Ce.write("r",!0),Le[be]&&Ce.mergeTree(Le[be].get())}),Be.reset());const at=[],Ft=[];if((ye.length||X.length)&&!H){const be=s.readCursor(M(Be.get()));if(ft(be,null,(ae,Ce)=>{at[ae]=Ce.clone()}),ye.forEach(ae=>{ae&&ft(s.readCursor(ae.get()),null,(Ce,ue)=>{at[Ce]=ue.clone()})}),function ae(Ce,ue,re,de,we,Oe){const Te=a(ue);if(Te&&u(Te))if(Te.p!=null){const se=Te.p;at[se].getPath(),re=at[se],de=Ft[se]=s.writeCursor()}else Te.r!==void 0&&(re=null);else h(a(re))&&(re=null);const Ve=Ce.getComponent();if(Ve){let se;if((se=Ve.d)!=null){const Re=ye[se];Re&&(Re.get(),de.mergeTree(Re.get()),re=s.readCursor(Re.get()))}}let We=0,$e=0;const et=s.advancer(ue,void 0,(se,Re)=>{u(Re)&&We--}),Se=s.advancer(re,(se,Re)=>h(Re)?-(se-$e)-1:se-$e,(se,Re)=>{h(Re)&&$e++});for(const se of Ce)if(typeof se=="number"){const Re=et(se),ze=se+We,nt=Se(ze),Bt=ze+$e;de.descend(Bt),ae(Ce,Re,nt,de),de.ascend()}else de.descend(se),ae(Ce,et(se),Se(se),de),de.ascend();et.end(),Se.end()}(qe,be,be.clone(),Be),Be.reset(),H)return{ok:!1,conflict:H};if(Be.get(),Ft.length){const ae=Ft.map(ue=>ue?ue.get():null),Ce=s.readCursor(M(Be.get()));if(ft(Ce,Be,(ue,re,de)=>{const we=ae[ue];we&&(de.mergeTree(we),ae[ue]=null)}),ae.find(ue=>ue)){const ue=s.writeCursor(),re=s.writeCursor();let de=0,we=0;ae.forEach(Oe=>{Oe!=null&&ft(s.readCursor(Oe),null,Te=>{const Ve=ln[Te];ue.writeMove(j[Ve].getPath(),Q[Ve].getPath(),de++);const We=Fe[Ve];We&&We.forEach($e=>{X[$e]||G!==1&&Ie[$e]!=null||re.writeMove(ee[$e].getPath(),U[$e].getPath(),we++)})})}),H={type:i.ConflictType.BLACKHOLE,op1:ue.get(),op2:re.get()}}}}return H?{ok:!1,conflict:H}:{ok:!0,result:Be.get()}}const P=I=>{const L=new Error("Transform detected write conflict");throw L.conflict=I,L.type=L.name="writeConflict",L};function J(I,L,Y){const G=D(I,L,Y);if(G.ok)return G.result;P(G.conflict)}const V=I=>{const L=s.writeCursor();return s.readCursor(I).traverse(L,(Y,G)=>{(h(Y)||W(Y))&&G.write("r",!0)}),L.get()},oe=(I,L)=>{const{type:Y,op1:G,op2:H}=I;switch(Y){case i.ConflictType.DROP_COLLISION:return L==="left"?[null,V(H)]:[V(G),null];case i.ConflictType.RM_UNEXPECTED_CONTENT:let j=!1;return s.readCursor(G).traverse(null,Q=>{Q.r!==void 0&&(j=!0)}),j?[null,V(H)]:[V(G),null];case i.ConflictType.BLACKHOLE:return[V(G),V(H)];default:throw Error("Unrecognised conflict: "+Y)}};function le(I,L,Y,G){let H=null;for(;;){const j=D(L,Y,G);if(j.ok)return S(H,j.result);{const{conflict:Q}=j;I(Q)||P(Q);const[ee,U]=oe(Q,G);L=S(B(L),ee),Y=S(B(Y),U),H=S(H,U)}}}}(rr)),rr}var fl;function C0(){return fl||(fl=1,function(e){var t=fn&&fn.__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=fn&&fn.__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(E0(),e);var r=Zu();Object.defineProperty(e,"ReadCursor",{enumerable:!0,get:function(){return r.ReadCursor}}),Object.defineProperty(e,"WriteCursor",{enumerable:!0,get:function(){return r.WriteCursor}});var s=Ju();Object.defineProperty(e,"ConflictType",{enumerable:!0,get:function(){return s.ConflictType}})}(fn)),fn}var it=C0();const R0=Rt(it),I0=pd({__proto__:null,default:R0},[it]);var Z=(e=>(e.RETAIN="r",e.INSERT="i",e.DELETE="d",e))(Z||{});function Hr(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&&z.isEmptyObject(o)&&r.sId==null)continue;if(n.length===0){n.push(r);continue}const a=n.pop();pc(r,a)&&z.hasIntersectionBetweenTwoRanges(a.st,a.ed,r.st,r.ed)?n.push({...r,st:a.st,ed:i}):n.push(a,r)}return n}function Qu(e,t,n,r){var c;const{textRuns:s}=e;if(s==null)return;const i=[],o=s.length;let a=!1;const l=(c=t.textRuns)!=null?c:[];if(l.length)for(const u of l)u.st+=r,u.ed+=r;for(let u=0;u<o;u++){const h=s[u],{st:d,ed:f}=h;if(f<=r)i.push(h);else if(r>d&&r<f){a=!0;const g={...h,ed:r};i.push(g),l.length&&i.push(...l);const p={...h,st:r+n,ed:f+n};i.push(p)}else h.st+=n,h.ed+=n,a||(a=!0,i.push(...l)),i.push(h)}a||(a=!0,i.push(...l)),e.textRuns=Hr(i)}function eh(e,t,n,r){const{paragraphs:s}=e;if(s==null)return;const{paragraphs:i}=t,o=[];for(let l=0,c=s.length;l<c;l++){const u=s[l],{startIndex:h}=u;h>=r&&(u.startIndex+=n),o.push(u.startIndex)}let a=-1;if(i){for(let l=0,c=i.length;l<c;l++){const u=i[l];u.startIndex+=r;const h=u.startIndex;a=o.indexOf(h)}a!==-1&&s.splice(a,1),s.push(...i),s.sort(Br("startIndex"))}}function th(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:c}=l;c>=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(Br("startIndex"))}}function nh(e,t,n,r){const{customBlocks:s=[]}=e;for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:c}=l;c>=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(Br("startIndex"))}s.length&&!e.customBlocks&&(e.customBlocks=s)}function rh(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:c,endIndex:u}=l;c>r?(l.startIndex+=n,l.endIndex+=n):u>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(Br("startIndex"))}}const sh="$",ml=e=>e.split(sh)[0];function Qo(e){if(e.length<=1)return e;e.sort((s,i)=>s.startIndex-i.startIndex);const t=[];let n={...e[0]};n.rangeId=ml(n.rangeId);for(let s=1;s<e.length;s++){const i=e[s];i.rangeId=ml(i.rangeId),i.rangeId===n.rangeId&&qu(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}${sh}${r[a]}`,r[a]=r[a]+1):r[a]=1}return t}function Gi(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 ih(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 Vi(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 S0(e,t,n,r){e.customRanges||(e.customRanges=[]);const{customRanges:s}=e;Gi(s,r);for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:c}=l;c>=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=Qo(s)}function O0(e,t,n,r){e.customDecorations||(e.customDecorations=[]);const{customDecorations:s}=e;Vi(s,r);for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:c}=l;c>=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=ih(s)}function oh(e,t,n){const{textRuns:r}=e,s=n,i=n+t,o=[];if(r){const a=[];for(let l=0,c=r.length;l<c;l++){const u=r[l],{st:h,ed:d}=u;if(s<=h&&i>=d){o.push({...u,st:h-s,ed:d-s});continue}else h<=s&&d>=i?(o.push({...u,st:s-s,ed:i-s}),u.ed-=t):s>=h&&s<d?(o.push({...u,st:s-s,ed:d-s}),u.ed=s):i>h&&i<=d?(o.push({...u,st:h-s,ed:i-s}),u.st=i-t,u.ed-=t):h>=i&&(u.st-=t,u.ed-=t);a.push(u)}e.textRuns=a}return o.length===0&&o.push({st:0,ed:t,ts:{}}),o}function ah(e,t,n){const{paragraphs:r}=e,s=n,i=n+t,o=[];if(r){const a=[];for(let l=0,c=r.length;l<c;l++){const u=r[l],{startIndex:h}=u;if(h>=s&&h<i){o.push({...u,startIndex:h-n});continue}else h>=i&&(u.startIndex-=t);a.push(u)}e.paragraphs=a}return o}function lh(e,t,n){const{sectionBreaks:r}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,c=r.length;l<c;l++){const u=r[l],{startIndex:h}=u;if(h>=s&&h<=i){o.push({...u,startIndex:h-n});continue}else h>i&&(u.startIndex-=t);a.push(u)}e.sectionBreaks=a}return o}function ch(e,t,n){const{customBlocks:r=[]}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,c=r.length;l<c;l++){const u=r[l],{startIndex:h}=u;if(h>=s&&h<=i){o.push({...u,startIndex:h-n});continue}else h>i&&(u.startIndex-=t);a.push(u)}e.customBlocks=a}return r.length&&!e.customBlocks&&(e.customBlocks=r),o}function uh(e,t,n){const{tables:r}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,c=r.length;l<c;l++){const u=r[l],{startIndex:h,endIndex:d}=u;if(s<=h&&i>=d){o.push({...u,startIndex:h-n,endIndex:d-n});continue}else if(h<=s&&d>=i){const f=Fs(h,d,s,i);if(f.length===0||(u.startIndex=f[0],u.endIndex=f[1],u.startIndex===u.endIndex))continue}else i<h&&(u.startIndex-=t,u.endIndex-=t);a.push(u)}e.tables=a}return o}function v0(e,t,n){const{customRanges:r}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,c=r.length;l<c;l++){const u=r[l],{startIndex:h,endIndex:d}=u;if(h>=s&&d<=i){o.push(u);continue}else if(Math.max(s,h)<=Math.min(i,d)){const f=Fs(h,d,s,i);if(f.length===0)continue;u.startIndex=f[0],u.endIndex=f[1]}else i<h&&(u.startIndex-=t,u.endIndex-=t);a.push(u)}e.customRanges=Qo(a)}return o}function w0(e,t,n,r=!0){const{customDecorations:s}=e,i=n,o=n+t-1,a=[];if(s){const l=[];for(let c=0,u=s.length;c<u;c++){const h=s[c],{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 g=Fs(d,f,i,o);if(g.length===0)continue;h.startIndex=g[0],h.endIndex=g[1]}else o<d&&r&&(h.startIndex-=t,h.endIndex-=t);l.push(h)}e.customDecorations=l}return a}var hh=(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))(hh||{}),Ut=(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))(Ut||{});const rs={"a)":{glyphFormat:"%1)",glyphType:fe.DECIMAL},"1.":{glyphType:fe.DECIMAL},"a.":{glyphFormat:"%1.",glyphType:fe.LOWER_LETTER},"A.":{glyphType:fe.UPPER_LETTER},"i.":{glyphFormat:"%1.",glyphType:fe.LOWER_ROMAN},"I.":{glyphFormat:"%1.",glyphType:fe.UPPER_LETTER}},Tn=e=>[...e,...e,...e].map((t,n)=>({glyphFormat:` %${n+1}`,glyphSymbol:t,bulletAlignment:Fr.START,textStyle:{fs:12},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*n}}})),yn=e=>e.map((t,n)=>({...t,bulletAlignment:Fr.START,textStyle:{fs:12},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*n}}})),gl=(e,t)=>new Array(9).fill(0).map((n,r)=>({glyphFormat:` %${r+1}`,glyphSymbol:e,bulletAlignment:Fr.START,textStyle:{fs:16},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*r},textStyle:t}})),jr={BULLET_LIST:{listType:"BULLET_LIST",nestingLevel:Tn(["●","○","■"])},BULLET_LIST_1:{listType:"BULLET_LIST",nestingLevel:Tn(["❖","➢","■"])},BULLET_LIST_2:{listType:"BULLET_LIST",nestingLevel:Tn(["✔","●","◆"])},BULLET_LIST_3:{listType:"BULLET_LIST",nestingLevel:Tn(["■","◆","○"])},BULLET_LIST_4:{listType:"BULLET_LIST",nestingLevel:Tn(["✧","○","■"])},BULLET_LIST_5:{listType:"BULLET_LIST",nestingLevel:Tn(["➢","○","◆"])},ORDER_LIST:{listType:"ORDER_LIST",nestingLevel:yn([{glyphFormat:"%1.",glyphType:fe.DECIMAL},{glyphFormat:"%2.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%3.",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:fe.DECIMAL},{glyphFormat:"%5.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%6.",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:fe.DECIMAL},{glyphFormat:"%8.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%9.",glyphType:fe.LOWER_ROMAN}])},ORDER_LIST_1:{listType:"ORDER_LIST",nestingLevel:yn([{glyphFormat:"%1)",glyphType:fe.DECIMAL},{glyphFormat:"%2)",glyphType:fe.LOWER_LETTER},{glyphFormat:"%3)",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%4)",glyphType:fe.DECIMAL},{glyphFormat:"%5)",glyphType:fe.LOWER_LETTER},{glyphFormat:"%6)",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%7)",glyphType:fe.DECIMAL},{glyphFormat:"%8)",glyphType:fe.LOWER_LETTER},{glyphFormat:"%9)",glyphType:fe.LOWER_ROMAN}])},ORDER_LIST_2:{listType:"ORDER_LIST",nestingLevel:yn(["%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:fe.DECIMAL})))},ORDER_LIST_3:{listType:"ORDER_LIST",nestingLevel:yn([{glyphFormat:"%1.",glyphType:fe.UPPER_LETTER},{glyphFormat:"%2.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%3.",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:fe.UPPER_LETTER},{glyphFormat:"%5.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%6.",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:fe.UPPER_LETTER},{glyphFormat:"%8.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%9.",glyphType:fe.LOWER_ROMAN}])},ORDER_LIST_4:{listType:"ORDER_LIST",nestingLevel:yn([{glyphFormat:"%1.",glyphType:fe.UPPER_LETTER},{glyphFormat:"%2.",glyphType:fe.DECIMAL},{glyphFormat:"%3.",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:fe.UPPER_LETTER},{glyphFormat:"%5.",glyphType:fe.DECIMAL},{glyphFormat:"%6.",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:fe.UPPER_LETTER},{glyphFormat:"%8.",glyphType:fe.DECIMAL},{glyphFormat:"%9.",glyphType:fe.LOWER_ROMAN}])},ORDER_LIST_5:{listType:"ORDER_LIST",nestingLevel:yn([{glyphFormat:"%1.",glyphType:fe.DECIMAL_ZERO},{glyphFormat:"%2.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%3.",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:fe.DECIMAL_ZERO},{glyphFormat:"%5.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%6.",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:fe.DECIMAL_ZERO},{glyphFormat:"%8.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%9.",glyphType:fe.LOWER_ROMAN}])},CHECK_LIST:{listType:"CHECK_LIST",nestingLevel:gl("☐")},CHECK_LIST_CHECKED:{listType:"CHECK_LIST_CHECKED",nestingLevel:gl("☑",{st:{s:ie.TRUE}})}},ss=e=>{const{glyphFormat:t,glyphType:n}=e,r=z.deepClone(jr.ORDER_LIST);return r.nestingLevel[0].glyphFormat=t,r.nestingLevel[0].glyphType=n,r},b0={ORDER_LIST_QUICK_2:ss(rs["a)"]),ORDER_LIST_QUICK_3:ss(rs["a."]),ORDER_LIST_QUICK_4:ss(rs["i."]),ORDER_LIST_QUICK_6:ss(rs["I."])};Object.assign(jr,b0);const A0={"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 T0(e,t,n,r,s){const i=y0(e,t,n,r,s),o=N0(e,t,n,r,s),a=M0(e,t,n,r,s),l=D0(e,t,n,r,s),c=L0(e,t,n,r,s),u=x0(e,t,n,r),h=U0(e,t,n,r,s);return{dataStream:"",textRuns:i,paragraphs:o,sectionBreaks:a,customBlocks:l,tables:c,customRanges:u,customDecorations:h}}function y0(e,t,n,r,s){const{textRuns:i}=e,{textRuns:o}=t;if(i==null||o==null)return;const a=oh(e,n,r);if(s!==Ee.REPLACE){const l=dh(o,a,s);t.textRuns=l}return Qu(e,t,n,r),a}function dh(e,t,n){if(t.length===0)return e;e=z.deepClone(e),t=z.deepClone(t);const r=[],s=e.length,i=t.length;let o=0,a=0,l=null;function c(){return l?(r.push(l),l=null,!0):!1}for(;o<s&&a<i;){const{st:f,ed:g,ts:p}=e[o],{st:R,ed:b,ts:$,sId:k}=t[a];let W;if(n===Ee.COVER?W={...$,...p}:W={...p},g<R)c()||r.push(e[o]),o++;else if(b<f)c()||r.push(t[a]),a++;else{const O={st:Math.min(f,R),ed:Math.max(f,R),ts:f<R?{...p}:{...$},sId:f<R?void 0:k};O.ed>O.st&&r.push(O),r.push({st:Math.max(f,R),ed:Math.min(g,b),ts:W,sId:k}),g<b?(o++,t[a].st=g,t[a].st===t[a].ed&&a++):(a++,e[o].st=b,e[o].st===e[o].ed&&o++);const C={st:Math.min(g,b),ed:Math.max(g,b),ts:g<b?{...$}:{...p},sId:g<b?k:void 0};l=C.ed>C.st?C:null}}c();const u=r[r.length-1],h=e[s-1],d=t[i-1];return u&&u.ed!==Math.max(h.ed,d.ed)&&(h.ed>d.ed?r.push(h):r.push(d)),Hr(r)}function N0(e,t,n,r,s){const{paragraphs:i}=e,{paragraphs:o}=t;if(i==null||o==null)return;const a=ah(e,n,r);if(s!==Ee.REPLACE){const l=[];for(const c of o){const{startIndex:u,paragraphStyle:h,bullet:d}=c;let f=[];for(const g of a){const{startIndex:p,paragraphStyle:R,bullet:b}=g;let $,k;if(s===Ee.COVER?($={...R,...h},k={listId:"",listType:Ut.BULLET_LIST,nestingLevel:0,textStyle:{},...b,...d}):($={...h,...R},k={listId:"",listType:Ut.BULLET_LIST,nestingLevel:0,textStyle:{},...d,...b}),u===p){f.push({startIndex:u,paragraphStyle:$,bullet:k});break}}l.push(...f),f=[]}t.paragraphs=l}return eh(e,t,n,r),a}function M0(e,t,n,r,s){const{sectionBreaks:i}=e,{sectionBreaks:o}=t;if(i==null||o==null)return;const a=lh(e,n,r);if(s!==Ee.REPLACE){const l=[];for(const c of o){const{startIndex:u}=c;let h=[];for(const d of a){const{startIndex:f}=d;if(u===f){s===Ee.COVER?h.push({...d,...c}):h.push({...c,...d});break}}l.push(...h),h=[]}t.sectionBreaks=l}return th(e,t,n,r),a}function D0(e,t,n,r,s){const{customBlocks:i=[]}=e,{customBlocks:o}=t;if(i==null||o==null)return;const a=ch(e,n,r);if(s!==Ee.REPLACE){const l=[];for(const c of o){const{startIndex:u}=c;let h=[];for(const d of a){const{startIndex:f}=d;if(u===f){s===Ee.COVER?h.push({...d,...c}):h.push({...c,...d});break}}l.push(...h),h=[]}t.customBlocks=l}return nh(e,t,n,r),i.length&&!e.customBlocks&&(e.customBlocks=i),a}function L0(e,t,n,r,s){const{tables:i}=e,{tables:o}=t;if(i==null||o==null)return;const a=uh(e,n,r);if(s!==Ee.REPLACE){const l=[];for(const c of o){const{startIndex:u,endIndex:h}=c;let d=[];for(const f of a){const{startIndex:g,endIndex:p}=f;if(g>=u&&p<=h){s===Ee.COVER?d.push({...f,...c}):d.push({...c,...f});break}}l.push(...d),d=[]}t.tables=l}return rh(e,t,n,r),a}function x0(e,t,n,r,s){e.customRanges||(e.customRanges=[]),Gi(e.customRanges,r),Gi(e.customRanges,r+n);const i=r,o=r+n-1,{customRanges:a}=t,l=[],c=new Map;e.customRanges.forEach(h=>{const{startIndex:d,endIndex:f}=h;d>=i&&f<=o?c.set(h.rangeId,h):l.push(h)});const u=[];return a?(a.forEach(h=>{const{startIndex:d,endIndex:f}=h;l.push({...h,startIndex:d+r,endIndex:f+r})}),e.customRanges=Qo(l),u):[]}function U0(e,t,n,r,s){e.customDecorations||(e.customDecorations=[]),Vi(e.customDecorations,r),Vi(e.customDecorations,r+n);const i=[],{customDecorations:o}=e,{customDecorations:a=[]}=t;if(s===Ee.REPLACE){for(let l=0;l<o.length;l++){const c=o[l],{startIndex:u,endIndex:h}=c;u>=r&&h<=r+n-1&&i.push(c)}a.forEach(l=>{const{startIndex:c,endIndex:u}=l;o.push({...l,startIndex:c+r,endIndex:u+r})})}else for(const l of a){const{id:c}=l;if(l.type===_n.DELETED){const u=o.filter(h=>h.id===c);u.length&&i.push(...u)}else o.push({...l,startIndex:l.startIndex+r,endIndex:l.endIndex+r})}for(const l of i){const{id:c}=l,u=o.findIndex(h=>h.id===c);u!==-1&&o.splice(u,1)}return e.customDecorations=ih(o),i}var ea=(e=>(e[e.copy=0]="copy",e[e.cut=1]="cut",e))(ea||{});function Ns(e,t,n,r=!0){const{textRuns:s}=e;if(s){const i=[];for(const o of s){const a=z.deepClone(o),{st:l,ed:c}=a;z.hasIntersectionBetweenTwoRanges(l,c,t,n)&&(t>=l&&t<=c?i.push({...a,st:t,ed:Math.min(n,c)}):n>=l&&n<=c?i.push({...a,st:Math.max(t,l),ed:n}):i.push(a))}return Hr(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 fh(e,t,n){const{tables:r=[]}=e,s=[];for(const i of r){const o=z.deepClone(i),{startIndex:a,endIndex:l}=o;a>=t&&l<=n&&s.push({...o,startIndex:a-t,endIndex:l-t})}return s}function mh(e,t,n){const{paragraphs:r=[]}=e,s=[];for(const i of r){const{startIndex:o}=i;if(o>=t&&o<n){const a=z.deepClone(i);s.push(a)}}if(s.length)return s.map(i=>({...i,startIndex:i.startIndex-t}))}function P0(e,t,n){const{sectionBreaks:r=[]}=e,s=[];for(const i of r){const{startIndex:o}=i;o>=t&&o<=n&&s.push(z.deepClone(i))}if(s.length)return s.map(i=>({...i,startIndex:i.startIndex-t}))}function gh(e,t,n){const{customBlocks:r=[]}=e,s=[];for(const i of r){const{startIndex:o}=i;o>=t&&o<n&&s.push(z.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=Ns(e,t,n,r);const a=fh(e,t,n);if(a.length&&(o.tables=a),o.paragraphs=mh(e,t,n),s===1){const c=ph(e,t,n);c?o.customDecorations=c:r&&(o.customDecorations=[])}const{customRanges:l}=_h(e,t,n);return l?o.customRanges=l:r&&(o.customRanges=[]),o.customBlocks=gh(e,t,n),o}function k0(e){const{dataStream:t,textRuns:n,paragraphs:r,customRanges:s,customDecorations:i,tables:o}=e;let a=0,l=0;s==null||s.forEach(u=>{u.startIndex<0&&(a=Math.max(a,-u.startIndex)),u.endIndex>t.length-1&&(l=Math.max(l,u.endIndex-t.length+1))});const c=`${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(u=>{u.st+=a,u.ed+=a}),r==null||r.forEach(u=>{u.startIndex+=a}),s==null||s.forEach(u=>{u.startIndex+=a,u.endIndex+=a}),i==null||i.forEach(u=>{u.startIndex+=a,u.endIndex+=l}),o==null||o.forEach(u=>{u.startIndex+=a,u.endIndex+=l}),{...e,dataStream:c,textRuns:n,paragraphs:r,customRanges:s,customDecorations:i,tables:o}}function _h(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 ph(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=z.deepClone(i);s.push({...o,startIndex:Math.max(o.startIndex-t,0),endIndex:Math.min(o.endIndex,n-1)-t})}}),s}function F0(e,t,n){return e==null||t==null?e!=null?e:t:dh(e,t,n)}function B0(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===Ee.REPLACE?[{...e[0]}]:[{...t[0],...e[0]}]}function $0(e,t,n){return t.length===0||e.length===0||n===Ee.REPLACE?e:[...e,...t.filter(r=>!e.some(s=>r.id===s.id))]}function zi(e,t,n=Ee.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:c=[],customRanges:u,customDecorations:h=[]}=t;r.textRuns=F0(l,s,n),r.customRanges=B0(u,o,n);const d=$0(h,a,n);d.length&&(r.customDecorations=d);const f=[];let g=0,p=0;for(;g<i.length&&p<c.length;){const R=i[g],b=c[p],{startIndex:$}=R,{startIndex:k}=b;$===k?(f.push(z.deepMerge(R,b)),g++,p++):$<k?(f.push(z.deepClone(R)),g++):(f.push(z.deepClone(b)),p++)}return g<i.length&&f.push(...i.slice(g)),p<c.length&&f.push(...c.slice(p)),f.length&&(r.paragraphs=f),r}function H0(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 Ln{constructor(t){E(this,"_index",0);E(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===Z.DELETE||n.t===Z.RETAIN&&n.body==null?z.deepClone({...n,len:t}):z.deepClone({...n,len:t,body:Tt(n.body,r,r+t,!1)})}else return{t:Z.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:Z.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 On{constructor(){E(this,"cursor",0)}reset(){return this.cursor=0,this}moveCursor(t){this.cursor+=t}moveCursorTo(t){this.cursor=t}}function Eh(e,t,n){const{dataStream:r}=e,s=n,i=n+t,o=oh(e,t,n),a=ah(e,t,n),l=lh(e,t,n),c=ch(e,t,n),u=uh(e,t,n),h=v0(e,t,n),d=w0(e,t,n);let f="";return r&&(e.dataStream=Rc(r,s,i),f=r.slice(s,i)),{dataStream:f,textRuns:o,paragraphs:a,sectionBreaks:l,customBlocks:c,tables:u,customRanges:h,customDecorations:d}}function Ch(e,t,n,r){e.dataStream=Cc(e.dataStream,r,t.dataStream),Qu(e,t,n,r),eh(e,t,n,r),th(e,t,n,r),nh(e,t,n,r),rh(e,t,n,r),S0(e,t,n,r),O0(e,t,n,r)}function j0(e,t,n,r,s=Ee.COVER){return T0(e,t,n,r,s)}function W0(e,t,n){return t<=0?{dataStream:""}:Eh(e,t,n)}function Y0(e,t,n,r){n!==0&&Ch(e,t,n,r)}function G0(e,t){const n=new On;return n.reset(),t.forEach(r=>{const s=z.deepClone(r);switch(s.t){case Z.RETAIN:{const{coverType:i,body:o,len:a}=s;o!=null&&j0(e,o,a,n.cursor,i),n.moveCursor(a);break}case Z.INSERT:{const{body:i,len:o}=s;Y0(e,i,o,n.cursor),n.moveCursor(o);break}case Z.DELETE:{const{len:i}=s;W0(e,i,n.cursor);break}default:throw new Error(`Unknown action type for action: ${s}.`)}}),e}function V0(e,t,n,r,s){if(e==null||t==null)return t;if(e.length===0||t.length===0)return[];t=z.deepClone(t),e=z.deepClone(e);const i=[],o=t.length,a=e.length;let l=0,c=0,u=null;function h(){return u?(i.push(u),u=null,!0):!1}for(;l<o&&c<a;){const{st:p,ed:R,ts:b}=t[l],{st:$,ed:k,ts:W,sId:O}=e[c];let C={};if(s===0)C={...b},n===Ee.COVER&&r===Ee.REPLACE&&W&&(C=Object.assign({},W,C));else if(C={...b},n===Ee.REPLACE){if(r===Ee.REPLACE)C={...W};else if(b&&W){const w=Object.keys(b);for(const T of w)W[T]&&delete C[T]}}else if(r===Ee.REPLACE){if(W){const w=Object.keys(W);for(const T of w)W[T]!==void 0&&(C[T]=W[T])}}else if(W){const w=Object.keys(W);for(const T of w)C[T]!==void 0&&delete C[T]}if(R<$)h()||i.push(t[l]),l++;else if(k<p)h()||i.push(e[c]),c++;else{const w={st:Math.min(p,$),ed:Math.max(p,$),ts:p<$?{...b}:{...W}};w.ed>w.st&&i.push(),i.push({st:Math.max(p,$),ed:Math.min(R,k),ts:C,sId:O}),R<k?(l++,e[c].st=R,e[c].st===e[c].ed&&c++):(c++,t[l].st=k,t[l].st===t[l].ed&&l++);const T={st:Math.min(R,k),ed:Math.max(R,k),ts:R<k?{...W}:{...b},sId:R<k?O:void 0};u=T.ed>T.st?T:null}}h();const d=i[i.length-1],f=t[o-1],g=e[a-1];return d.ed!==Math.max(f.ed,g.ed)&&(f.ed>g.ed?i.push(f):i.push(g)),Hr(i,!0)}function z0(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===Ee.REPLACE)return s===1?[z.deepClone(i)]:[z.deepClone(o)];if(r===Ee.REPLACE){const a=z.deepClone(o);return s===1&&Object.assign(a,z.deepClone(i)),[a]}else{const a=z.deepClone(o);return s===1&&Object.assign(a,z.deepClone(i)),[a]}}function _l(e,t,n,r,s){const i={startIndex:t.startIndex};if(t.paragraphStyle&&(i.paragraphStyle=z.deepClone(t.paragraphStyle),e.paragraphStyle)){if(n===Ee.REPLACE)if(r===Ee.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===Ee.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===Ee.REPLACE&&r===Ee.REPLACE?i.bullet=s===1?z.deepClone(e.bullet):z.deepClone(t.bullet):e.bullet===void 0?i.bullet=z.deepClone(t.bullet):n===Ee.REPLACE||r===Ee.REPLACE?i.bullet=s===0&&t.bullet?z.deepClone(t.bullet):z.deepClone(e.bullet):s===0&&t.bullet!==void 0&&(i.bullet=z.deepClone(t.bullet)),i}function K0(e,t){if(e==null||t==null)return t;if(e.length===0||t.length===0)return z.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===_n.DELETED||i===_n.DELETED)&&(o=!0,n.push({...r,type:_n.DELETED}));break}o||n.push(r)}return n}function X0(e,t,n=!1){const{body:r,coverType:s=Ee.COVER}=e,{body:i,coverType:o=Ee.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:c,paragraphs:u=[],customRanges:h,customDecorations:d}=r,{textRuns:f,paragraphs:g=[],customRanges:p,customDecorations:R}=i,b=V0(c,f,s,o,n?1:0);b&&(a.textRuns=b);const $=z0(h,p,s,o,n?1:0);$&&(a.customRanges=$);const k=K0(d,R);k&&(a.customDecorations=k);const W=[];let O=0,C=0;for(;O<u.length&&C<g.length;){const w=u[O],T=g[C],{startIndex:F}=w,{startIndex:B}=T;if(F===B){let m={startIndex:F};n?m=_l(w,T,s,o,1):m=_l(w,T,s,o,0),W.push(m),O++,C++}else F<B?O++:(W.push(z.deepClone(T)),C++)}return C<g.length&&W.push(...g.slice(C)),W.length&&(a.paragraphs=W),{coverType:l,body:a}}function pl(e){return Object.keys(e).length===1}const Hn=class Hn{constructor(){E(this,"_actions",[])}static apply(t,n){return G0(t,n)}static compose(t,n){const r=new Ln(t),s=new Ln(n),i=new Hn;for(;r.hasNext()||s.hasNext();)if(s.peekType()===Z.INSERT)i.push(s.next());else if(r.peekType()===Z.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===Z.INSERT&&l.t===Z.RETAIN)l.body==null?i.push(a):i.push({...a,body:zi(a.body,l.body,l.coverType)});else if(a.t===Z.RETAIN&&l.t===Z.RETAIN)if(a.body==null&&l.body==null)i.push(a.len!==Number.POSITIVE_INFINITY?a:l);else if(a.body&&l.body){const c=a.coverType===Ee.REPLACE||l.coverType===Ee.REPLACE?Ee.REPLACE:Ee.COVER;i.push({...a,t:Z.RETAIN,coverType:c,body:zi(a.body,l.body,l.coverType)})}else i.push(a.body?a:l);else a.t===Z.RETAIN&&l.t===Z.DELETE?i.push(l):a.t===Z.INSERT&&(l.t,Z.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 Ln(t),i=new Ln(n),o=new Hn;for(;s.hasNext()||i.hasNext();)if(s.peekType()===Z.INSERT&&(r==="left"||i.peekType()!==Z.INSERT)){const a=s.next();o.retain(a.len)}else if(i.peekType()===Z.INSERT)o.push(i.next());else{const a=Math.min(s.peekLength(),i.peekLength()),l=s.next(a),c=i.next(a);if(l.t===Z.DELETE)continue;if(c.t===Z.DELETE){o.push(c);continue}if(l.body==null||c.body==null)o.push(c);else{const{coverType:u,body:h}=X0(l,c,r==="left");o.push({...c,t:Z.RETAIN,coverType:u,body:h})}}return o.trimEndUselessRetainAction(),o.serialize()}static transformPosition(t,n,r=!1){const s=new Ln(t);let i=0;for(;s.hasNext()&&i<=n;){const o=s.peekLength(),a=s.peekType();if(s.next(),a===Z.DELETE){n-=Math.min(o,n-i);continue}else a===Z.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===Z.INSERT)n.push({t:Z.DELETE,len:r.len,body:r.body});else if(r.t===Z.DELETE){if(r.body==null)throw new Error("Can not invert DELETE action without body property, makeInvertible must be called first.");n.push({t:Z.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:Z.RETAIN,body:r.oldBody,oldBody:r.body,len:r.len,coverType:Ee.REPLACE})}else n.push(r);return n}static makeInvertible(t,n){const r=[];let s=0;for(const i of t){if(i.t===Z.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===Z.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!==Z.INSERT&&(s+=i.len)}return r}insert(t,n){const r={t:Z.INSERT,body:n,len:t};return this.push(r),this}retain(t,n,r){const s={t:Z.RETAIN,len:t};return n!=null&&(s.body=n),r!=null&&(s.coverType=r),this.push(s),this}delete(t){const n={t:Z.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=z.deepClone(t[0]);if(s.t===Z.RETAIN&&s.len===0&&s.body==null)return this;if(typeof r=="object"){if(r.t===Z.DELETE&&s.t===Z.DELETE)return r.len+=s.len,this;if(r.t===Z.DELETE&&s.t===Z.INSERT&&(n-=1,r=this._actions[n-1],r==null))return this._actions.unshift(s),this;if(r.t===Z.RETAIN&&s.t===Z.RETAIN&&r.body==null&&s.body==null)return r.len+=s.len,this;if(r.t===Z.INSERT&&pl(r.body)&&s.t===Z.INSERT&&pl(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===Z.RETAIN&&H0(t);)this._actions.pop(),t=this._actions[this._actions.length-1];return this}};E(Hn,"id","text-x"),E(Hn,"uri","https://github.com/dream-num/univer#text-x");let Ne=Hn;Object.defineProperty(Ne,"name",{value:"text-x"});const jn=class jn{static registerSubtype(t){var n;t==null||this._subTypes.has(t.name)&&((n=this._subTypes.get(t.name))==null?void 0:n.id)!==Ne.id||(this._subTypes.set(t.name,t),it.type.registerSubtype(t))}static apply(t,n){if(!it.type.isNoop(n))return it.type.apply(t,n)}static compose(t,n){return it.type.compose(t,n)}static transform(t,n,r){return it.type.transform(t,n,r)}static transformPosition(t,n,r="right"){return t&&t.length===2&&t[0]==="body"&&t[1].et===Ne.name?Ne.transformPosition(t[1].e,n,r==="left"):n}static invertWithDoc(t,n){return it.type.invertWithDoc(t,n)}static isNoop(t){return it.type.isNoop(t)}static getInstance(){return this._instance==null&&(this._instance=new jn),this._instance}removeOp(t,n){return it.removeOp(t,n)}moveOp(t,n){return it.moveOp(t,n)}insertOp(t,n){return it.insertOp(t,n)}replaceOp(t,n,r){return it.replaceOp(t,n,r)}editOp(t,n=["body"]){return it.editOp(n,Ne.name,t)}};E(jn,"uri","https://github.com/dream-num/univer#json-x"),E(jn,"_subTypes",new Map),E(jn,"_instance",null);let Yt=jn;Yt.registerSubtype(Ne);const ta={id:"default_doc",documentStyle:{}};class q0 extends zs{constructor(n){var r;super();E(this,"type",ve.UNIVER_DOC);E(this,"_name$",new ce.BehaviorSubject(""));E(this,"name$",this._name$.asObservable());E(this,"snapshot");this.snapshot={...ta,...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{...jr,...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,c=s==null?void 0:s[n];if(!c)return;const u=c.docTransform;u.size.width=i,u.size.height=o,u.positionH.posOffset=a,u.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 q0{constructor(n){var s,i;super(z.isEmptyObject(n)?f0():n);E(this,"_unitId");E(this,"headerModelMap",new Map);E(this,"footerModelMap",new Map);E(this,"change$",new ce.BehaviorSubject(0));const r=6;this._unitId=(s=this.snapshot.id)!=null?s:z.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={...ta,...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(!Yt.isNoop(n))return this.snapshot=Yt.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=ea.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 js((r=(n=this.getBody())==null?void 0:n.dataStream)!=null?r:"")}}function Z0(e){const{ranges:t,id:n,type:r}=e,s=new Ne;let i=0;for(let o=0;o<t.length;o++){const a=t[o],{startOffset:l,endOffset:c}=a;l>0&&s.push({t:Z.RETAIN,len:l-i}),s.push({t:Z.RETAIN,body:{dataStream:"",customDecorations:[{id:n,type:r,startIndex:0,endIndex:c-l-1}]},len:c-l}),i=c}return s}function J0(e){var u,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=(u=r.getSelfOrHeaderFooterModel(n))==null?void 0:u.getBody())==null?void 0:h.customDecorations)==null?void 0:d.find(f=>f.id===t);if(!i)return!1;const o=new Ne,{startIndex:a,endIndex:l}=i,c=l-a+1;return o.push({t:Z.RETAIN,len:a}),o.push({t:Z.RETAIN,len:c,body:{dataStream:"",customDecorations:[{startIndex:0,endIndex:c-1,id:t,type:_n.DELETED}]}}),o}function Rh(e,t,n,r){return e<=n&&t>=n||e>=n&&e<=r}function Q0(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):Rh(e.startOffset,e.endOffset-1,i.startIndex,i.endIndex)&&n.push(i)}return n}function eC(e){return{...z.deepClone(e),rangeId:Wt()}}function tC(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 Ih(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 nC(e,t){var i,o,a,l,c;const n=Ih(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,((c=(l=n[n.length-1])==null?void 0:l.endIndex)!=null?c:-1/0)+1);return{startOffset:r,endOffset:s,collapsed:r===s}}function rC(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(g=>g.rangeId===t);if(!i)return!1;const{startIndex:o,endIndex:a}=i,l=new Ne,c=a-o+1;l.push({t:Z.RETAIN,len:o}),l.push({t:Z.RETAIN,len:c,body:{dataStream:"",customRanges:[]}}),s&&l.push({t:Z.INSERT,body:s,len:s.dataStream.length});const u=a+1+((f=s==null?void 0:s.dataStream.length)!=null?f:0);return l.selections=[{startOffset:u,endOffset:u,collapsed:!0}],l}function sC(e){const{ranges:t,rangeId:n,rangeType:r,wholeEntity:s,properties:i,body:o}=e;let a=0;const l=new Ne;let c=!1;return t.forEach(u=>{var k,W,O;const h=nC(u,o);if(!h||!o)return!1;const{startOffset:d,endOffset:f}=h,g=(k=o.customRanges)!=null?k:[],p=(C,w,T)=>{var S,N,A,v;const F=Ih(C,w,g,r),B=Math.min((N=(S=F[0])==null?void 0:S.startIndex)!=null?N:1/0,C),m=Math.max((v=(A=F[F.length-1])==null?void 0:A.endIndex)!=null?v:-1/0,w),x={rangeId:T?`${n}$${T}`:n,rangeType:r,startIndex:0,endIndex:m-B,wholeEntity:s,properties:{...i}};l.push({t:Z.RETAIN,len:B-a}),l.push({t:Z.RETAIN,len:m-B+1,body:{dataStream:"",customRanges:[x]},coverType:Ee.COVER}),a=m+1},R=((W=o.paragraphs)!=null?W:[]).filter(C=>C.startIndex<f&&C.startIndex>d),b=((O=o.customBlocks)!=null?O:[]).filter(C=>C.startIndex<f&&C.startIndex>d);tC([d,f-1],[...R.map(C=>C.startIndex),...b.map(C=>C.startIndex)]).forEach(([C,w],T)=>p(C,w,T)),c=!0,l.selections=[{startOffset:h.endOffset,endOffset:h.endOffset,collapsed:!0}]}),c?l:!1}function Sh(e,t,n=0,r=null,s=!0){e.sort((c,u)=>c.startOffset-u.startOffset);const i=[],{paragraphs:o=[]}=t,a=o==null?void 0:o.find(c=>c.startIndex>=e[0].startOffset&&c.startIndex<e[0].endOffset);let l=n;if(e.forEach(c=>{const{startOffset:u,endOffset:h}=c;u>l&&(i.push({t:Z.RETAIN,len:u-l}),l=u),l<h&&(i.push({t:Z.DELETE,len:h-l}),l=h)}),r&&i.push({t:Z.INSERT,body:r,len:r.dataStream.length}),a&&s){const c=o.find(u=>u.startIndex-n>=e[e.length-1].endOffset-1);c&&(c.startIndex>l&&(i.push({t:Z.RETAIN,len:c.startIndex-l}),l=c.startIndex),i.push({t:Z.RETAIN,len:1,body:{dataStream:"",paragraphs:[{...c,startIndex:0,bullet:a==null?void 0:a.bullet}]},coverType:Ee.REPLACE}))}return i}function iC(e,t,n=0){const r=[];let s=n;return e.forEach(i=>{const{startOffset:o,endOffset:a}=i;o>s&&(r.push({t:Z.RETAIN,len:o-s}),s=o),a>s&&(r.push({t:Z.RETAIN,len:a-s,body:{...z.deepClone(t),dataStream:""}}),s=a)}),r}const oC=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=Zo(o?o.dataStream:"",n.dataStream);let l=0;const c=a.map(([d,f])=>{switch(d){case 0:{const g={t:Z.RETAIN,body:{...Tt(n,l,l+f.length,!1),dataStream:""},len:f.length};return l+=f.length,g}case 1:{const g={t:Z.INSERT,body:Tt(n,l,l+f.length),len:f.length};return l+=f.length,g}default:return{t:Z.DELETE,len:f.length}}}),u=new Ne;return u.push({t:Z.RETAIN,len:t.startOffset}),u.push(...c),u};function aC(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 lC=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=Zo(o?o.dataStream:"",n.dataStream);let l=0;const c=a.map(([d,f])=>{switch(d){case 0:{const g=Ns(n,l,l+f.length,!1),p=Ns(o,l,l+f.length,!1),R={t:Z.RETAIN,body:aC(g,p)?void 0:{textRuns:g,dataStream:""},len:f.length};return l+=f.length,R}case 1:{const g={t:Z.INSERT,body:Tt(n,l,l+f.length),len:f.length};return l+=f.length,g}default:return{t:Z.DELETE,len:f.length}}});if(c.every(d=>d.t===Z.RETAIN&&!d.body))return!1;const u=new Ne;return u.push({t:Z.RETAIN,len:t.startOffset}),u.push(...c),u};function cC(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 uC(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 hC=e=>{var p,R,b,$;const{selection:t,documentDataModel:n,drawings:r}=e,{collapsed:s,startOffset:i,segmentId:o}=t,a=new Ne,l=Yt.getInstance(),c=[],u=n.getSelfOrHeaderFooterModel(o).getBody();if(!u)return!1;const h=(R=(p=n.getSnapshot().drawingsOrder)==null?void 0:p.length)!=null?R:0;let d=0;if(s)i>0&&a.push({t:Z.RETAIN,len:i});else{const k=Sh([t],u,0,null,!1);a.push(...k);const W=cC(u,[t]),O=(b=n.getDrawings())!=null?b:{},C=($=n.getDrawingsOrder())!=null?$:[],w=W.sort((T,F)=>C.indexOf(T)>C.indexOf(F)?-1:C.indexOf(T)<C.indexOf(F)?1:0);if(w.length>0)for(const T of w){const F=O[T],B=C.indexOf(T);if(F==null||B<0)continue;const m=l.removeOp(["drawings",T],F),x=l.removeOp(["drawingsOrder",B],T);c.push(m),c.push(x),d++}}a.push({t:Z.INSERT,body:{dataStream:"\b".repeat(r.length),customBlocks:r.map((k,W)=>({startIndex:W,blockId:k.drawingId}))},len:r.length});const f=uC(n,o),g=l.editOp(a.serialize(),f);c.push(g);for(const k of r){const{drawingId:W}=k,O=l.insertOp(["drawings",W],k),C=l.insertOp(["drawingsOrder",h-d],W);c.push(O),c.push(C)}return c.reduce((k,W)=>Yt.compose(k,W),null)};function dC(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 fC(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 mC(e,t,n,r){return Math.max(e,n)<=Math.min(t,r)}function Ki(e,t,n,r){const{startOffset:s,endOffset:i}=e,o=r!=null?r:na(t,n),a=[];let l=-1;for(let c=0;c<o.length;c++){const u=o[c],{startIndex:h}=u;(s>l&&s<=h||i>l&&i<=h||h>=s&&h<=i)&&a.push(u),l=h}return a}function Xi(e,t,n){const r=[],s=na(t,n);for(const i of e){const o=Ki(i,t,n,s);r.push(...o)}return r}const gC=[ot.PARAGRAPH,ot.TABLE_START,ot.TABLE_END,ot.TABLE_ROW_START,ot.TABLE_CELL_START,ot.TABLE_CELL_END];function na(e,t){const n=[];for(let r=0;r<e.length;r++){const s=e[r],{startIndex:i}=s;let o=i-1;for(;!gC.includes(t[o])&&o>=0;)o--;n.push({...s,paragraphStart:o+1,paragraphEnd:s.startIndex})}return n}const _C=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(g=>{var p;return((p=g.bullet)==null?void 0:p.listType.indexOf(s))===0});let l=z.generateRandomId(6);if(t.length===1){const g=i.indexOf(t[0]),p=i[g-1],R=i[g+1];p&&p.bullet&&p.bullet.listType.indexOf(s)===0?(l=p.bullet.listId,s!==Ut.CHECK_LIST&&(s=p.bullet.listType)):R&&R.bullet&&R.bullet.listType.indexOf(s)===0&&(l=R.bullet.listId,s!==Ut.CHECK_LIST&&(s=R.bullet.listType))}const c=new On;c.reset();const u=new Ne;for(const g of t){const{startIndex:p,paragraphStyle:R={},bullet:b}=g;u.push({t:Z.RETAIN,len:p-c.cursor}),u.push({t:Z.RETAIN,len:1,body:{dataStream:"",paragraphs:[o?{paragraphStyle:R,startIndex:0}:{startIndex:0,paragraphStyle:{...R},bullet:{nestingLevel:(f=b==null?void 0:b.nestingLevel)!=null?f:0,textStyle:{fs:20},listType:s,listId:l}}]},coverType:Ee.REPLACE}),c.moveCursorTo(p+1)}return u},pC=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(Ut.CHECK_LIST)===-1)return!1;const o=new On;o.reset();const a=new Ne,{startIndex:l,paragraphStyle:c={}}=i,u=i.bullet.listType===Ut.CHECK_LIST?Ut.CHECK_LIST_CHECKED:Ut.CHECK_LIST;return a.push({t:Z.RETAIN,len:l-o.cursor}),a.push({t:Z.RETAIN,len:1,body:{dataStream:"",paragraphs:[{...i,paragraphStyle:c,startIndex:0,bullet:{...i.bullet,listType:u}}]},coverType:Ee.REPLACE}),o.moveCursorTo(l+1),a},EC=e=>{var u,h;const{paragraphs:t,listType:n,segmentId:r,document:s}=e;if(((u=s.getSelfOrHeaderFooterModel(r).getBody())==null?void 0:u.paragraphs)==null)return!1;const a=z.generateRandomId(6),l=new On;l.reset();const c=new Ne;for(const d of t){const{startIndex:f,paragraphStyle:g={},bullet:p}=d;c.push({t:Z.RETAIN,len:f-l.cursor}),c.push({t:Z.RETAIN,len:1,body:{dataStream:"",paragraphs:[{startIndex:0,paragraphStyle:g,bullet:{nestingLevel:(h=p==null?void 0:p.nestingLevel)!=null?h:0,textStyle:(p==null?void 0:p.listType)===n?p.textStyle:{fs:20},listType:n,listId:a}}]},coverType:Ee.REPLACE}),l.moveCursorTo(f+1)}return c};function CC(e,t){return t.some(n=>e.startIndex>n.startIndex&&e.startIndex<n.endIndex)}const RC=e=>{var c,u,h;const{paragraphs:t,document:n,type:r}=e,s=new On;s.reset();const i=new Ne,o=(c=n.getSnapshot().lists)!=null?c:{},a=(h=(u=n.getBody())==null?void 0:u.tables)!=null?h:[],l={...jr,...o};for(const d of t){const{startIndex:f,paragraphStyle:g={},bullet:p}=d,R=CC(d,a);if(i.push({t:Z.RETAIN,len:f-s.cursor}),p){const b=p.listType;let $=l[b].nestingLevel.length-1;R&&($=Math.min($,2)),i.push({t:Z.RETAIN,len:1,body:{dataStream:"",paragraphs:[{startIndex:0,paragraphStyle:{...g},bullet:{...p,nestingLevel:Math.max(Math.min(p.nestingLevel+r,$),0)}}]},coverType:Ee.REPLACE})}else i.push({t:Z.RETAIN,len:1});s.moveCursorTo(f+1)}return i},IC=e=>{var R,b,$,k;const{textRanges:t,segmentId:n,document:r,style:s,paragraphTextRun:i,cursor:o,deleteLen:a,textX:l}=e,c=r.getSelfOrHeaderFooterModel(n),u=(b=(R=c.getBody())==null?void 0:R.paragraphs)!=null?b:[],h=(k=($=c.getBody())==null?void 0:$.dataStream)!=null?k:"",d=Xi(t,u,h),f=new On;o&&f.moveCursorTo(o);const g=l!=null?l:new Ne;d.sort((W,O)=>W.startIndex-O.startIndex);const p=Math.max(0,d[0].paragraphStart-1);p>f.cursor&&(g.push({t:Z.RETAIN,len:p-f.cursor}),f.moveCursorTo(p)),a&&g.push({t:Z.DELETE,len:a});for(const W of d){const{startIndex:O,paragraphStyle:C={}}=W,w=O-f.cursor;g.push({t:Z.RETAIN,len:w,...i?{body:{dataStream:"",textRuns:[{ts:i,st:0,ed:w}]},coverType:Ee.REPLACE}:null}),g.push({t:Z.RETAIN,len:1,body:{dataStream:"",paragraphs:[{startIndex:0,paragraphStyle:{...C,...s}}]},coverType:Ee.REPLACE}),f.moveCursorTo(O+1)}return g};class Qe{}E(Qe,"customRange",{add:sC,delete:rC,copyCustomRange:eC,getCustomRangesInterestsWithSelection:Q0,isIntersecting:Rh}),E(Qe,"customDecoration",{add:Z0,delete:J0}),E(Qe,"selection",{replace:oC,makeSelection:dC,normalizeSelection:fC,delete:Sh,replaceTextRuns:lC,retain:iC}),E(Qe,"range",{isIntersects:mC,getParagraphsInRange:Ki,getParagraphsInRanges:Xi}),E(Qe,"transform",{getPlainText:js,fromPlainText:o_,isEmptyDocument:i_}),E(Qe,"paragraph",{bullet:{set:EC,switch:_C,toggleChecklist:pC,changeNestLevel:RC},style:{set:IC},util:{transform:na,getParagraphsInRange:Ki,getParagraphsInRanges:Xi}}),E(Qe,"drawing",{add:hC});function SC(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 Oh(e){var t;return e.body=SC((t=e.body)!=null?t:{dataStream:""}),e.drawingsOrder||(e.drawingsOrder=[]),e.drawings||(e.drawings={}),e.documentStyle||(e.documentStyle={}),e}class Wr{constructor(t={}){E(this,"_style");this._style=t}static create(t={}){return new Wr(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 tn.create(z.deepClone(this._style))}getValue(){return{...this._style}}}class tn extends Wr{static create(t={}){return new tn(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 tn.create(z.deepClone(this._style))}build(){return this.getValue()}}class Zt{constructor(t={s:1}){E(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(z.deepClone(this._decoration))}build(){return{...this._decoration}}}class Yr{constructor(t={}){E(this,"_style");this._style=t}static create(t={}){return new Yr(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 Nr.create(z.deepClone(this._style))}getValue(){return this._style}}class Nr extends Yr{static create(t={}){return new Nr(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 Nr.create(z.deepClone(this._style))}build(){return this.getValue()}}class Jt{constructor(t){E(this,"_data");if(!t.body)throw new Error("Invalid document data, body is required");this._data=Oh(t)}static create(t){return new Jt(t)}static createByBody(t){return new Jt({body:t,id:"d",documentStyle:{}})}copy(){return pn.create(z.deepClone(this._data))}slice(t,n){const{body:r,...s}=this._data;return pn.create({...z.deepClone(s),body:Tt(r,t,n)})}toPlainText(){var t,n;return Qe.transform.getPlainText((n=(t=this._data.body)==null?void 0:t.dataStream)!=null?n:"").replaceAll("\r",`
7
+ `)}getParagraphStyle(){var t,n;return Yr.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?Wr.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===rn.HYPERLINK))!=null?r:[]}getData(){return this._data}}class pn extends Jt{constructor(n){super(n);E(this,"_doc");this._doc=new yt(n)}static newEmptyData(){return Oh({id:"d",documentStyle:{},drawings:{},drawingsOrder:[],body:{dataStream:`\r
8
+ `,customBlocks:[],customRanges:[],paragraphs:[{startIndex:0}],textRuns:[],tables:[],sectionBreaks:[]}})}static create(n){return new pn(n!=null?n:pn.newEmptyData())}insertText(n,r,s){var u,h;let i=((h=(u=this._data.body)==null?void 0:u.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 tn?r.build():r:a=s instanceof tn?s.build():s,!o)return this;const l={dataStream:o,textRuns:a?[{ts:a,st:i,ed:i+o.length}]:[]},c=Qe.selection.replace({doc:this._doc,selection:{startOffset:i,endOffset:i,collapsed:!0},body:l});if(!c)throw new Error("Insert text failed, please check.");return Ne.apply(this._doc.getBody(),c.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 Jt?n.getData():n:(s=Math.min(n,s),i=r instanceof Jt?r.getData():r);const o=Qe.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 Ne.apply(this._doc.getBody(),o.serialize()),this}delete(n,r){if(r!==void 0){if(!r)return this;const s=Qe.selection.delete([{startOffset:n,endOffset:n+r,collapsed:!0}],this._data.body);Ne.apply(this._doc.getBody(),s)}return this}setStyle(n,r,s){const i={dataStream:"",textRuns:[{ts:s instanceof tn?s.build():s,st:0,ed:r-n}]},o=Qe.selection.retain([{startOffset:n,endOffset:r,collapsed:!0}],i);return Ne.apply(this._doc.getBody(),o),this}setLink(n,r,s){const i=Qe.customRange.add({rangeType:rn.HYPERLINK,rangeId:Wt(),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 Ne.apply(this._doc.getBody(),i.serialize()),this}cancelLink(n,r){if(typeof n=="string"){const s=Qe.customRange.delete({rangeId:n,documentDataModel:this._doc});if(!s)throw new Error("Insert text failed, please check.");Ne.apply(this._doc.getBody(),s.serialize())}else this.slice(n,r).getLinks().forEach(i=>{const o=Qe.customRange.delete({rangeId:i.rangeId,documentDataModel:this._doc});if(!o)throw new Error("Insert text failed, please check.");Ne.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,Jt.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=pn.createByBody({dataStream:i,customRanges:[{rangeType:rn.HYPERLINK,rangeId:Wt(),properties:{url:o},startIndex:0,endIndex:i.length-1}]});return typeof n=="number"?this.insertRichText(n,a):this.insertRichText(a)}}function OC(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 Bn=(e=>(e[e.Style=1]="Style",e[e.Value=2]="Value",e))(Bn||{});function vC(e){return`sheet_interceptor_${e}`}const vh=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 wC{constructor(t){E(this,"_interceptorsByName",new Map);E(this,"_interceptorPoints");this._interceptorPoints=t}fetchThroughInterceptors(t,n){const r=t;let s=this._interceptorsByName.get(r);return n&&(s=s.filter(n)),vh(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)})),()=>Lr(this._interceptorsByName.get(r),n)}getInterceptPoints(){return this._interceptorPoints}dispose(){this._interceptorsByName.clear()}}function bC(e){return`sheet_async_interceptor_${e}`}const AC=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 TC{constructor(t){E(this,"_asyncInterceptorsByName",new Map);E(this,"_asyncInterceptorPoints");this._asyncInterceptorPoints=t}fetchThroughAsyncInterceptors(t,n){const r=t;let s=this._asyncInterceptorsByName.get(r);return n&&(s=s.filter(n)),AC(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)})),()=>Lr(this._asyncInterceptorsByName.get(r),n)}getInterceptPoints(){return this._asyncInterceptorPoints}dispose(){this._asyncInterceptorsByName.clear()}}function yC(e,t){for(const n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}function wh(e){return/^-?\d+(\.\d+)?$/.test(e)}function NC(e){return wh(e)?Number(e)<=Number.MAX_SAFE_INTEGER:!1}function MC(e){return Number(e)>Number.MAX_SAFE_INTEGER||e.length>=18}class ra{constructor(){E(this,"_data",[])}static create(){return new ra}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 sa{constructor(){E(this,"_data",new Map)}static create(){return new sa}add(t,n){this._data.has(t)||this._data.set(t,n)}delete(t){this._data.delete(t)}getData(){return this._data}}function DC(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 LC(e,t){return t.forEach(n=>e.add(n)),e}function xC(e,t,n,r){var c;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 u=new Ne,h=Yt.getInstance();if(a>0&&u.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}]),(c=d==null?void 0:d.customRanges)!=null&&c.length){const g=d.customRanges[0];f.customRanges=[{...g,startIndex:0,endIndex:n.length-1}]}u.insert(n.length,f)}u.delete(o),i.apply(h.editOp(u.serialize()))}const l=i.getBody();return i.dispose(),l}const UC="__default_document_sub_component_id20231101__";class bh{constructor(){E(this,"skipNextObservers",!1);E(this,"lastReturnValue");E(this,"isStopPropagation",!1)}stopPropagation(){this.isStopPropagation=!0}}class PC extends ce.Subject{constructor(){super(...arguments);E(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 bh;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 kC(e){return new ce.Observable(t=>{const n=e.subscribeEvent(r=>{t.next(r)});return()=>n.unsubscribe()})}const Ks=Ae.createIdentifier("core.resource-manager.service"),qi={[xt.Editor]:"Editor",[xt.Owner]:"Owner",[xt.Reader]:"Reader",[xt.UNRECOGNIZED]:"UNRECOGNIZED"},Ms=e=>e?{userID:`${qi[e]}_${z.generateRandomId(8)}`,name:qi[e],avatar:""}:{userID:"",name:"",avatar:"",anonymous:!0,canBindAnonymous:!1},FC=(e,t)=>e.startsWith(qi[t]);class Mr extends Ke{constructor(){super(...arguments);E(this,"_model",new Map);E(this,"_userChange$",new ce.Subject);E(this,"userChange$",this._userChange$.asObservable());E(this,"_currentUser$",new ce.BehaviorSubject(Ms()));E(this,"currentUser$",this._currentUser$.asObservable())}dispose(){super.dispose(),this._model.clear(),this._userChange$.complete(),this._currentUser$.complete()}getCurrentUser(){return this._currentUser$.getValue()}setCurrentUser(n){this.addUser(n),this._currentUser$.next(n)}addUser(n){this._model.set(n.userID,n),this._userChange$.next({type:"add",user:n})}getUser(n,r){const s=this._model.get(n);if(s)return s;r&&r()}delete(n){const r=this.getUser(n);this._model.delete(n),r&&this._userChange$.next({type:"delete",user:r})}clear(){this._model.clear(),this._userChange$.next({type:"clear"})}list(){return Array.from(this._model.values())}}var BC=Object.getOwnPropertyDescriptor,$C=(e,t,n,r)=>{for(var s=r>1?void 0:r?BC(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},El=(e,t)=>(n,r)=>t(n,r,e);exports.AuthzIoLocalService=class{constructor(t,n){E(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(Ms(xt.Owner))}_getRole(t){const n=this._userManagerService.getCurrentUser();return n?FC(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:[ve.UNIVER_SHEET,ve.UNIVER_DOC,ve.UNIVER_SLIDE],onLoad:(t,n)=>{for(const r in n)this._permissionMap.set(r,n[r])},onUnLoad:()=>{this._permissionMap.clear()}})}async create(t){return Wt(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:xt.Owner,shareScope:-1,scope:{read:Wi.AllCollaborator,edit:Wi.AllCollaborator},creator:Ms(xt.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(xt.Owner)||this._getRole(xt.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=$C([El(0,Ks),El(1,Ae.Inject(Mr))],exports.AuthzIoLocalService);const Ah=Ae.createIdentifier("IAuthzIoIoService");var HC=Object.getOwnPropertyDescriptor,jC=(e,t,n,r)=>{for(var s=r>1?void 0:r?HC(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},WC=(e,t)=>(n,r)=>t(n,r,e);exports.MentionIOLocalService=class{constructor(t){this._userManagerService=t}async list(t){return{list:[{type:Rs.PERSON,mentions:[{objectType:Rs.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=jC([WC(0,Ae.Inject(Mr))],exports.MentionIOLocalService);const Th=Ae.createIdentifier("univer.service.mention-io"),ia=Ae.createIdentifier("univer.config-service");class yh{constructor(){E(this,"_configChanged$",new ce.Subject);E(this,"configChanged$",this._configChanged$.asObservable());E(this,"_config",new Map)}dispose(){this._config.clear(),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=qo(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 ce.Observable(n=>{Object.prototype.hasOwnProperty.call(this._config,t)&&n.next(this._config.get(t));const r=this.configChanged$.pipe(ce.filter(s=>Object.prototype.hasOwnProperty.call(s,t))).subscribe(s=>n.next(s[t]));return()=>r.unsubscribe()})}}const pr="FOCUSING_UNIT",$n="FOCUSING_SHEET",Er="FOCUSING_DOC",Cr="FOCUSING_SLIDE",YC="FOCUSING_EDITOR_BUT_HIDDEN",Nh="EDITOR_ACTIVATED",GC="FOCUSING_EDITOR_INPUT_FORMULA",Mh="FOCUSING_FX_BAR_EDITOR",VC="FOCUSING_UNIVER_EDITOR",zC="FOCUSING_EDITOR_INPUT_FORMULA",KC="FOCUSING_PANEL_EDITOR",XC="FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE",qC="FOCUSING_COMMON_DRAWINGS",ZC="FORMULA_EDITOR_ACTIVATED";class Dh extends Ke{constructor(){super(...arguments);E(this,"_error$",new ce.Subject);E(this,"error$",this._error$.asObservable())}dispose(){this._error$.complete()}emit(n){this._error$.next({errorKey:n})}}const JC="0.8.0-beta.1",QC={version:JC};function eR(e="",t=Pr.ZH_CN,n=""){return{id:e,sheetOrder:[],name:n,appVersion:QC.version,locale:t,styles:{},sheets:{},resources:[]}}class Lh{constructor(t={}){E(this,"_styles");E(this,"_cacheMap",new br(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=z.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&&z.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(z.diffValue(n[r],t))return r;return null}}const tR=(e,t)=>t.length===e.length&&!e.some(n=>t.some(r=>!sn.equals(r,n))),nR=(e,t)=>t.length===e.length&&e.every((n,r)=>{const s=t[r];return s.unitId===n.unitId&&s.sheetId===n.sheetId&&sn.equals(n.range,s.range)}),Zi={t:0,b:2,l:2,r:2},rR=e=>({sbr:.6,sbo:e,spr:.6,spo:e}),Cl=90;function Rr(e,t,n={}){const r=e.length,{textRotation:s,paddingData:i,horizontalAlign:o=At.UNSPECIFIED,verticalAlign:a=gn.UNSPECIFIED,wrapStrategy:l=Cn.UNSPECIFIED,cellValueType:c}=n,{t:u,r:h,b:d,l:f}=i||Zi,{vertexAngle:g,centerAngle:p}=Ph(s),R={id:"d",body:{dataStream:`${e}${jc}`,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:u,marginBottom:d,marginRight:h,marginLeft:f,renderConfig:{horizontalAlign:o,verticalAlign:a,centerAngle:p,vertexAngle:g,wrapStrategy:l,cellValueType:c,zeroWidthParagraphBreak:1}},drawings:{},drawingsOrder:[]};return new yt(R)}function sR(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 Rl(e){if(!e)return{};const{ff:t,fs:n,it:r,bl:s,ul:i,st:o,ol:a,cl:l}=e,c={};return t&&(c.ff=t),n&&(c.fs=n),r&&(c.it=r),s&&(c.bl=s),i&&(c.ul=i),o&&(c.st=o),a&&(c.ol=a),l&&(c.cl=l),c}function xh(e,t,n){var i;const r=e.getBody();if((i=r.customRanges)!=null&&i.some(o=>o.rangeType===rn.HYPERLINK))return;const s=Qe.customRange.add({ranges:[{startOffset:0,endOffset:r.dataStream.length-1,collapsed:!1}],rangeId:n,rangeType:rn.HYPERLINK,body:r,properties:{url:t,refId:n}});s&&Ne.apply(r,s.serialize())}function Uh(e){return e!=null}const iR='"Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif';function Il(e){const t=rt.ff,n=rt.fs;if(!e){const h=`${n}pt ${t}`;return{fontCache:h,fontString:h,fontSize:n,originFontSize:n,fontFamily:t}}let r=Fn.ITALIC;(e.it===0||e.it===void 0)&&(r=Fn.NORMAL);let s=Fn.BOLD;(e.bl===0||e.bl===void 0)&&(s=Fn.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===jt.SUBSCRIPT||a===jt.SUPERSCRIPT){const h=oR(o,l),{sbr:d,spr:f}=h;l*=a===jt.SUBSCRIPT?d:f}const c=`${r} ${s} ${l}pt ${o}`,u=`${c}, ${iR} `;return{fontCache:c,fontString:u,fontSize:l,originFontSize:i,fontFamily:o}}function oR(e,t){return rR(t)}function Ph(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=Cl,s=Cl),{centerAngle:r,vertexAngle:s}}class aR{constructor(t,n){E(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:_e.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:_e.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:_e.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:_e.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 en(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 lR{constructor(t,n,r){E(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:c,h:u=s.defaultRowHeight}=a;i+=(l==null||l===ie.TRUE)&&typeof c=="number"?c:u}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:_e.ROW})):!s&&!a&&(s=!0,i=o)}return s&&r.push({startRow:i,endRow:n,startColumn:0,endColumn:0,rangeType:_e.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:_e.ROW})):!s&&a&&(s=!0,i=o)}return s&&r.push({startRow:i,endRow:n,startColumn:0,endColumn:0,rangeType:_e.ROW}),r}getRowRawVisible(t){const n=this.getRow(t);return n?n.hd!==ie.TRUE:!0}getSize(){return en(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 cR="DEFAULT_WORKSHEET_ROW_COUNT",kh=1e3,uR="DEFAULT_WORKSHEET_COLUMN_COUNT",Fh=20,hR="DEFAULT_WORKSHEET_ROW_HEIGHT",Bh=24,dR="DEFAULT_WORKSHEET_COLUMN_WIDTH",$h=88,fR="DEFAULT_WORKSHEET_ROW_TITLE_WIDTH",Hh=46,mR="DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT",jh=20;function Wh(e){const t={name:"Sheet1",id:"sheet-01",tabColor:"",hidden:ie.FALSE,rowCount:kh,columnCount:Fh,zoomRatio:1,freeze:{xSplit:0,ySplit:0,startRow:-1,startColumn:-1},scrollTop:0,scrollLeft:0,defaultColumnWidth:$h,defaultRowHeight:Bh,mergeData:[],cellData:{},rowData:{},columnData:{},showGridlines:ie.TRUE,rowHeader:{width:Hh,hidden:ie.FALSE},columnHeader:{height:jh,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 gR extends Ke{constructor(n){super();E(this,"_cellCache",new Map);E(this,"_rowCache",new Map);E(this,"_columnCache",new Map);E(this,"_hasRow",!1);E(this,"_hasColumn",!1);E(this,"_hasAll",!1);E(this,"_allIndex",-1);E(this,"_mergeData");E(this,"_rangeMap",new br(5e4));E(this,"_skeletonCache",new br(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===_e.ROW?this._createRowCache(s,r):i===_e.COLUMN?this._createColumnCache(s,r):i===_e.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||!z.isEmptyObject(this._columnCache)?!0:this._mergeData.some(r=>r.startRow<=n&&n<=r.endRow)}isColumnContainsMergedCell(n){return this._hasAll||!z.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 c=[];for(const u of this._mergeData||[])sn.intersects(u,{startRow:n,endRow:s,startColumn:r,endColumn:i})&&(o.push({...u}),c.push(l)),l++;return this._rangeMap.set(a,c),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 c=[];for(let u=0;u<a.length;u++){const{startRow:h,endRow:d,startColumn:f,endColumn:g}=a[u];for(let p=n;p<=s;p++){let R=!1;for(let b=r;b<=i;b++)if(p>=h&&p<=d&&b>=f&&b<=g){o.push({startRow:h,endRow:d,startColumn:f,endColumn:g}),c.push(u),R=!0;break}if(R)break}}return this._skeletonCache.set(l,c),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 Yh extends Ke{constructor(n){super();E(this,"_cellContentInterceptor",null);E(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,Bn.Value|Bn.Style,s,i):this.getRawCell(n,r)}getCellValueOnly(n,r){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,r,Bn.Value):this.getRawCell(n,r)}getCellStyleOnly(n,r){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,r,Bn.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,je(()=>this._cellContentInterceptor=null)}registerRowFilteredInterceptor(n){if(this._rowFilteredInterceptor)throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowFilteredInterceptor=n,je(()=>this._rowFilteredInterceptor=null)}}const Sl={isDeepClone:!1,displayRawFormula:!1,ignoreTextRotation:!1};class Dr{constructor(t,n,r){E(this,"_sheetId");E(this,"_snapshot");E(this,"_cellData");E(this,"_rowManager");E(this,"_columnManager");E(this,"_viewModel");E(this,"_spanModel");E(this,"_isRowStylePrecedeColumnStyle",!0);E(this,"_getCellHeight");var a;this.unitId=t,this._styles=r,this._snapshot=Wh(n);const{columnData:s,rowData:i,cellData:o}=this._snapshot;this._sheetId=(a=this._snapshot.id)!=null?a:z.generateRandomId(6),this._cellData=new ht(o),this._viewModel=new Yh((l,c)=>this.getCellRaw(l,c)),this._rowManager=new lR(this._snapshot,this._viewModel,i),this._columnManager=new aR(this._snapshot,s),this._spanModel=new gR(this._snapshot.mergeData)}__interceptViewModel(t){t(this._viewModel)}__registerGetCellHeight(t){return this._getCellHeight=t,je(()=>{this._getCellHeight=null})}getSnapshot(){return this._snapshot}getCellHeight(t,n){return this._getCellHeight?this._getCellHeight(t,n):this._snapshot.defaultRowHeight}setMergeData(t){this._snapshot.mergeData=t,this.getSpanModel().rebuild(t)}getSpanModel(){return this._spanModel}setIsRowStylePrecedeColumnStyle(t){this._isRowStylePrecedeColumnStyle=t}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){const s=this.getDefaultCellStyleInternal(),i=this.getRowStyle(t),o=this.getColumnStyle(n),a=this.getCell(t,n),l=this._styles.getStyleByCell(a);return(r!=null?r:this._isRowStylePrecedeColumnStyle)?wi(s,o,i,a==null?void 0:a.themeStyle,l):wi(s,i,o,a==null?void 0:a.themeStyle,l)}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((c,u)=>{Object.keys(u).forEach(h=>{const d=+h,f=t.getValue(c,d),g=f!=null&&f.s?this._styles.get(f.s):null,p=(g==null?void 0:g.bd)&&(g.bd.b||g.bd.l||g.bd.r||g.bd.t||g.bd.bc_tr||g.bd.bl_tr||g.bd.ml_tr||g.bd.tl_bc||g.bd.tl_br||g.bd.tl_mr);(f&&(f.v||f.p)||g!=null&&g.bg||p)&&(a?r=Math.min(r,c):(r=c,a=!0),s=Math.max(s,c),l?i=Math.min(i,d):(l=!0,i=d),o=Math.max(o,d))})}),n.forEach(c=>{a?r=Math.min(r,c.startRow):(r=c.startRow,a=!0),s=Math.max(s,c.endRow),l?i=Math.min(i,c.startColumn):(i=c.startColumn,a=!0),o=Math.max(o,c.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=z.deepClone(t);return new Dr(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,c=n;if(r){const{startRow:u,endRow:h,startColumn:d,endColumn:f}=r;t===u&&n===d?(o=h,a=f,l=u,c=d,i=!0):t>=u&&t<=h&&n>=d&&n<=f&&(o=h,a=f,l=u,c=d,s=!0)}return{actualRow:t,actualColumn:n,isMergedMainCell:i,isMerged:s,endRow:o,endColumn:a,startRow:l,startColumn:c}}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=Un.Raw){const o=this.getCellMatrix(),a=this._spanModel.getMergedCellRange(t,n,r,s),l=new ht;return Bi(t,r,n,s).forEach((c,u)=>{var d;let h;if(i===Un.Raw)h=this.getCellRaw(c,u);else if(i===Un.Intercepted)h=this.getCell(c,u);else if(i===Un.Both){const f=this.getCellRaw(c,u);if(f){h={...f};const g=(d=this.getCell(c,u))==null?void 0:d.v;Uh(g)&&h&&(h.displayV=String(g))}}h&&l.setValue(c,u,h)}),a.forEach(c=>{const{startColumn:u,startRow:h,endColumn:d,endRow:f}=c;Bi(h,f,u,d).forEach((g,p)=>{g===h&&p===u&&l.setValue(g,p,{...o.getValue(g,p),rowSpan:f-h+1,colSpan:d-u+1}),(g!==h||p!==u)&&l.realDeleteValue(g,p)})}),l}getRange(t,n,r,s){return typeof t=="object"?new Gn(this,t,{getStyles:()=>this._styles}):new Gn(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,c=s;return{next(){for(;;){if(c>o&&(l+=1,c=s),l>i)return{done:!0,value:void 0};const u=a.getCell(l,c),h=!u,d=a.getMergedCell(l,c);if(d){if(l!==d.startRow||c!==d.startColumn){c=d.endColumn+1;continue}if(h&&n){c=d.endColumn+1;continue}const g={row:l,col:c,value:u};return g.colSpan=d.endColumn-d.startColumn+1,g.rowSpan=d.endRow-d.startRow+1,c=d.endColumn+1,{done:!1,value:g}}if(h&&n)c+=1;else{const f={row:l,col:c,value:u};return c+=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 c=s,u=i;return{next(){for(;;){if(c>o&&(u+=1,c=s),u>a)return{done:!0,value:void 0};const h=l.getMergedCell(c,u);if(h){const g=c!==h.startRow,p=g||u!==h.startColumn;if(r&&p||!r&&g){c=h.endRow+1;continue}const R=l.getCell(h.startRow,h.startColumn);if(!R&&n){c=h.endRow+1;continue}const $={row:c,col:h.startColumn,value:R};return $.colSpan=h.endColumn-h.startColumn+1,$.rowSpan=h.endRow-h.startRow+1,c=h.endRow+1,{done:!1,value:$}}const d=l.getCell(c,u);if(!d&&n)c+=1;else{const g={row:c,col:u,value:d};return c+=1,{done:!1,value:g}}}}}}}}getCellDocumentModel(t,n,r=Sl){var p;if(!t)return;const{isDeepClone:s,displayRawFormula:i,ignoreTextRotation:o}={...Sl,...r};let a,l="document";const c=sR(n),u=o?rt.tr:c.textRotation||rt.tr;let h=c.horizontalAlign||rt.ht;const d=c.verticalAlign||rt.vt,f=c.wrapStrategy||rt.tb,g=c.paddingData||Zi;if(t.f&&i)a=Rr(t.f.toString(),{},{verticalAlign:d}),h=rt.ht;else if(t.p){const{centerAngle:R,vertexAngle:b}=Ph(u);a=this._updateConfigAndGetDocumentModel(s?z.deepClone(t.p):t.p,h,g,{horizontalAlign:h,verticalAlign:d,centerAngle:R,vertexAngle:b,wrapStrategy:f,zeroWidthParagraphBreak:1})}else if(t.v!=null){const R=Rl(n);l=Il(R).fontCache;let b=Gh(t);t.t===Qt.FORCE_STRING&&i&&(b=`'${b}`),a=Rr(b,R,{...c,textRotation:u,cellValueType:t.t})}return a&&t.linkUrl&&t.linkId&&xh(a,t.linkUrl,t.linkId),{documentModel:a,fontString:l,textRotation:u,wrapStrategy:f,verticalAlign:d,horizontalAlign:h,paddingData:g,fill:(p=n==null?void 0:n.bg)==null?void 0:p.rgb}}_updateConfigAndGetDocumentModel(t,n,r,s){var o,a,l,c,u;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=(c=r.l)!=null?c:2,t.documentStyle.marginRight=(u=r.r)!=null?u: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,n,r){const s=this.getComposedCellStyle(n,r),i=Rl(s),o=this.getCellDocumentModel(t,s,{ignoreTextRotation:!0});if(o!=null)return o.documentModel==null&&(o.documentModel=Rr("",i)),o;const a="";let l="document";const c=rt.tr,u=rt.ht,h=rt.vt,d=rt.tb,f=Zi;return l=Il({}).fontCache,{documentModel:Rr(a,i),fontString:l,textRotation:c,wrapStrategy:d,verticalAlign:h,horizontalAlign:u,paddingData:f}}getCellDocumentModelWithFormula(t,n,r){const s=this.getComposedCellStyle(n,r);return this.getCellDocumentModel(t,s,{isDeepClone:!0,displayRawFormula:!0,ignoreTextRotation:!0})}getCustomMetadata(){return this._snapshot.custom}setCustomMetadata(t){this._snapshot.custom=t}}function Gh(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 Qe.transform.getPlainText(t);const n=e.v;return typeof n=="string"?e.t===Qt.BOOLEAN?n.toUpperCase():n.replace(/[\r\n]/g,""):typeof n=="number"?e.t===Qt.BOOLEAN?n?"TRUE":"FALSE":n.toString():typeof n=="boolean"?n?"TRUE":"FALSE":""}function _R(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 Qe.transform.getPlainText(n)}return e==null?void 0:e.v}var pR=Object.getOwnPropertyDescriptor,ER=(e,t,n,r)=>{for(var s=r>1?void 0:r?pR(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},CR=(e,t)=>(n,r)=>t(n,r,e);function RR(e,t){return`${e.getUnitId()}|${t.getSheetId()}`}exports.Workbook=class extends zs{constructor(n={},r){super();E(this,"type",ve.UNIVER_SHEET);E(this,"_sheetCreated$",new ce.Subject);E(this,"sheetCreated$",this._sheetCreated$.asObservable());E(this,"_sheetDisposed$",new ce.Subject);E(this,"sheetDisposed$",this._sheetDisposed$.asObservable());E(this,"_activeSheet$",new ce.BehaviorSubject(null));E(this,"activeSheet$",this._activeSheet$.asObservable());E(this,"_worksheets");E(this,"_styles");E(this,"_snapshot");E(this,"_unitId");E(this,"_count");E(this,"_name$");E(this,"name$");this._logService=r;const s=eR();z.isEmptyObject(n)?this._snapshot=s:this._snapshot=z.commonExtend(s,n);const{styles:i}=this._snapshot;(this._snapshot.id==null||this._snapshot.id.length===0)&&(this._snapshot.id=z.generateRandomId(6)),this._unitId=this._snapshot.id,this._styles=new Lh(i),this._count=1,this._worksheets=new Map,this._name$=new ce.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 z.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 Dr(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(z.isEmptyObject(s)){const o=z.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 c=new Dr(this._unitId,a,this._styles);r.set(o,c),i.includes(o)||i.push(o)}this.ensureActiveSheet()}getCustomMetadata(){return this._snapshot.custom}setCustomMetadata(n){this._snapshot.custom=n}};exports.Workbook=ER([CR(1,pt)],exports.Workbook);class oa extends zs{constructor(n){var r;super();E(this,"type",ve.UNIVER_SLIDE);E(this,"_activePage$",new ce.BehaviorSubject(null));E(this,"activePage$",this._activePage$.asObservable());E(this,"_name$");E(this,"name$");E(this,"_snapshot");E(this,"_unitId");this._snapshot={...Su,...n},this._unitId=(r=this._snapshot.id)!=null?r:z.generateRandomId(6),this._name$=new ce.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:Wt(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=Wt(6);return{id:n,pageType:Ho.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 IR=Object.getOwnPropertyDescriptor,SR=(e,t,n,r)=>{for(var s=r>1?void 0:r?IR(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Ol=(e,t)=>(n,r)=>t(n,r,e);const Kn=Ae.createIdentifier("univer.current");exports.UniverInstanceService=class extends Ke{constructor(n,r){super();E(this,"_unitsByType",new Map);E(this,"_createHandler");E(this,"_ctorByType",new Map);E(this,"_currentUnits",new Map);E(this,"_currentUnits$",new ce.BehaviorSubject(this._currentUnits));E(this,"currentUnits$",this._currentUnits$.asObservable());E(this,"_unitAdded$",new ce.Subject);E(this,"unitAdded$",this._unitAdded$.asObservable());E(this,"_unitDisposed$",new ce.Subject);E(this,"unitDisposed$",this._unitDisposed$.asObservable());E(this,"_focused$",new ce.BehaviorSubject(null));E(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(ce.map(r=>{var s;return(s=r.get(n))!=null?s:null}),ce.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(ce.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(ce.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(ve.UNIVER_DOC)}getUniverDocInstance(n){return this.getUnit(n,ve.UNIVER_DOC)}getUniverSheetInstance(n){return this.getUnit(n,ve.UNIVER_SHEET)}getAllUnitsForType(n){var r;return(r=this._unitsByType.get(n))!=null?r:[]}changeDoc(n,r){const s=this.getAllUnitsForType(ve.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(pr,!0),this._contextService.setContextValue(Er,!1),this._contextService.setContextValue($n,!0),this._contextService.setContextValue(Cr,!1),this.setCurrentUnitForType(n)):this.focused instanceof yt?(this._contextService.setContextValue(pr,!0),this._contextService.setContextValue(Er,!0),this._contextService.setContextValue($n,!1),this._contextService.setContextValue(Cr,!1),this.setCurrentUnitForType(n)):this.focused instanceof oa?(this._contextService.setContextValue(pr,!0),this._contextService.setContextValue(Er,!1),this._contextService.setContextValue($n,!1),this._contextService.setContextValue(Cr,!0),this.setCurrentUnitForType(n)):(this._contextService.setContextValue(pr,!1),this._contextService.setContextValue(Er,!1),this._contextService.setContextValue($n,!1),this._contextService.setContextValue(Cr,!1))}getFocusedUnit(){return this.focused}getUnitType(n){const r=this._getUnitById(n);return r?r[1]:ve.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=SR([Ol(0,Ae.Inject(Ae.Injector)),Ol(1,Xn)],exports.UniverInstanceService);var xe=(e=>(e[e.Starting=0]="Starting",e[e.Ready=1]="Ready",e[e.Rendered=2]="Rendered",e[e.Steady=3]="Steady",e))(xe||{});const OR={0:"Starting",1:"Ready",2:"Rendered",3:"Steady"};var vR=Object.getOwnPropertyDescriptor,wR=(e,t,n,r)=>{for(var s=r>1?void 0:r?vR(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.LifecycleService=class extends Ke{constructor(n){super();E(this,"_lifecycle$",new ce.BehaviorSubject(xe.Starting));E(this,"lifecycle$",this._lifecycle$.asObservable());E(this,"_lock",!1);this._logService=n,this._reportProgress(xe.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 ce.firstValueFrom(this.lifecycle$.pipe(ce.filter(r=>r>=n),vi(r=>r===n),ce.map(()=>{})))}subscribeWithPrevious(){return ce.merge(Vh(this.stage),this._lifecycle$.pipe(ce.skip(1))).pipe(vi(n=>n===xe.Steady))}_reportProgress(n){this._logService.debug("[LifecycleService]",`lifecycle progressed to "${OR[n]}".`)}};exports.LifecycleService=wR([bR(0,pt)],exports.LifecycleService);function Vh(e){switch(e){case xe.Starting:return ce.of(xe.Starting);case xe.Ready:return ce.of(xe.Starting,xe.Ready);case xe.Rendered:return ce.of(xe.Starting,xe.Ready,xe.Rendered);default:return ce.of(xe.Starting,xe.Ready,xe.Rendered,xe.Steady)}}const AR=Ae.createIdentifier("ILocalStorageService");class En extends Ke{constructor(){super();E(this,"_currentLocale$",new ce.BehaviorSubject(Pr.ZH_CN));E(this,"currentLocale$",this._currentLocale$.asObservable());E(this,"_locales",null);E(this,"localeChanged$",new ce.Subject);E(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(je(()=>{this._locales=null,this._currentLocale$.complete(),this.localeChanged$.complete()}))}get _currentLocale(){return this._currentLocale$.value}load(n){var r;this._locales=qo((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 aa=(e=>(e.INIT="init",e.FETCHING="fetching",e.DONE="done",e))(aa||{});const zh=Ae.createIdentifier("univer.permission-service");class Kh extends Ke{constructor(){super(...arguments);E(this,"_permissionPointMap",new Map);E(this,"_permissionPointUpdate$",new ce.Subject);E(this,"permissionPointUpdate$",this._permissionPointUpdate$.asObservable());E(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 ce.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 ce.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=aa.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 ce.combineLatest(r).pipe(os.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 TR=Object.getOwnPropertyDescriptor,yR=(e,t,n,r)=>{for(var s=r>1?void 0:r?TR(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},pi=(e,t)=>(n,r)=>t(n,r,e);const NR=4,Xh=Symbol("DependentOn");class Ji extends Ke{onStarting(){}onReady(){}onRendered(){}onSteady(){}getUnitType(){return this.constructor.type}getPluginName(){return this.constructor.pluginName}}E(Ji,"pluginName"),E(Ji,"type",ve.UNIVER_UNKNOWN);class MR{constructor(){E(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 DR(...e){return function(t){t[Xh]=e}}exports.PluginService=class{constructor(t,n,r){E(this,"_pluginRegistry",new Map);E(this,"_pluginStore",new MR);E(this,"_seenPlugins",new Set);E(this,"_loadedPlugins",new Set);E(this,"_loadedPluginTypes",new Set([ve.UNIVER_UNKNOWN]));E(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===ve.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===ve.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)},NR))}_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 c=a[Xh];c&&c.forEach(u=>{const h=this._pluginRegistry.get(u.pluginName);if(h)s(h);else if(!this._seenPlugins.has(u.pluginName)&&!r.has(u.pluginName)){if(a.type===ve.UNIVER_UNKNOWN&&u.type!==ve.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 ${u.pluginName}.`);a.type!==u.type&&u.type!==ve.UNIVER_UNKNOWN&&this._logService.debug("[PluginService]",`Plugin "${l}" depends on "${u.pluginName}" which has different type.`),this._logService.debug("[PluginService]",`Plugin "${l}" depends on "${u.pluginName}" which is not registered. Univer will automatically register it with default configuration.`),this._assertPluginValid(u),s({plugin:u,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(Vh(n).subscribe(r=>this._runStage(t,r)),n!==xe.Steady){const r=this._lifecycleService.lifecycle$.pipe(ce.skip(1)).subscribe(s=>{this._runStage(t,s),s===xe.Steady&&r.unsubscribe()})}}_runStage(t,n){t.forEach(r=>{switch(n){case xe.Starting:r.onStarting();break;case xe.Ready:r.onReady();break;case xe.Rendered:r.onRendered();break;case xe.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=yR([pi(0,Ae.Inject(Ae.Injector)),pi(1,Ae.Inject(exports.LifecycleService)),pi(2,pt)],exports.PluginService);function qh(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 Qi=Ae.createIdentifier("resource-loader-service");var LR=Object.getOwnPropertyDescriptor,xR=(e,t,n,r)=>{for(var s=r>1?void 0:r?LR(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},UR=(e,t)=>(n,r)=>t(n,r,e);exports.ResourceManagerService=class extends Ke{constructor(n){super();E(this,"_resourceMap",new Map);E(this,"_register$",new ce.Subject);E(this,"register$",this._register$.asObservable());this._logService=n}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),je(()=>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(a){this._logService.error("[ResourceManagerService]","loadResources error",a)}})}unloadResources(n){this.getAllResourceHooks().forEach(r=>{r.onUnLoad(n)})}dispose(){this._register$.complete(),this._resourceMap.clear()}};exports.ResourceManagerService=xR([UR(0,pt)],exports.ResourceManagerService);class Ds extends Ke{constructor(){super();E(this,"_darkMode$",new ce.BehaviorSubject(!1));E(this,"darkMode$",this._darkMode$.asObservable());E(this,"_currentTheme",da.defaultTheme);E(this,"_currentTheme$",new ce.BehaviorSubject(this._currentTheme));E(this,"currentTheme$",this._currentTheme$.asObservable());this.disposeWithMe(je(()=>{this._currentTheme=da.defaultTheme,this._currentTheme$.complete(),this._darkMode$.complete()}))}get darkMode(){return this._darkMode$.getValue()}getCurrentTheme(){return this._currentTheme}setTheme(n){this._currentTheme=n,this._currentTheme$.next(n)}setDarkMode(n){this._darkMode$.next(n)}getColorFromTheme(n){return Vu(this._currentTheme,n)}}var PR=Object.getOwnPropertyDescriptor,kR=(e,t,n,r)=>{for(var s=r>1?void 0:r?PR(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Ei=(e,t)=>(n,r)=>t(n,r,e);const Xs=Ae.createIdentifier("univer.undo-redo.service"),FR=20;class Zh{dispose(){}async dispatchToHandlers(){return!1}}const Jh="univer.command.redo",Qh="univer.command.undo",ed=new class extends Zh{constructor(){super(...arguments);E(this,"type",xr.COMMAND);E(this,"id",Qh)}handler(t){const n=t.get(Xs),r=n.pitchTopUndoElement();if(!r)return!1;const s=t.get(Ur);return Us(r.undoMutations,s)?(n.popUndoToRedo(),!0):!1}},td=new class extends Zh{constructor(){super(...arguments);E(this,"type",xr.COMMAND);E(this,"id",Jh)}handler(t){const n=t.get(Xs),r=n.pitchTopRedoElement();if(!r)return!1;const s=t.get(Ur);return Us(r.redoMutations,s)?(n.popRedoToUndo(),!0):!1}};exports.LocalUndoRedoService=class extends Ke{constructor(n,r,s){super();E(this,"undoRedoStatus$");E(this,"_undoRedoStatus$",new ce.BehaviorSubject({undos:0,redos:0}));E(this,"_undoStacks",new Map);E(this,"_redoStacks",new Map);E(this,"_batchingStatus",new Map);this._univerInstanceService=n,this._commandService=r,this._contextService=s,this.undoRedoStatus$=this._undoRedoStatus$.asObservable(),this.disposeWithMe(this._commandService.registerCommand(ed)),this.disposeWithMe(this._commandService.registerCommand(td)),this.disposeWithMe(je(()=>this._undoRedoStatus$.complete())),this.disposeWithMe(je(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>FR&&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(),Us(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),je(()=>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,c;let n="";const r=this._contextService.getContextValue($n),s=this._contextService.getContextValue(Mh),i=this._contextService.getContextValue(Nh);return r?s?n=Bo:i?n=Fo:n=(a=(o=this._univerInstanceService.getFocusedUnit())==null?void 0:o.getUnitId())!=null?a:"":n=(c=(l=this._univerInstanceService.getFocusedUnit())==null?void 0:l.getUnitId())!=null?c:"",n}};exports.LocalUndoRedoService=kR([Ei(0,Kn),Ei(1,Ur),Ei(2,Xn)],exports.LocalUndoRedoService);function BR(e){return!(e.length===0||e.length>31||e.startsWith("'")||e.endsWith("'")||/[:\\\/\?\*\[\]]/.test(e))}function $R(e){return new Promise(t=>setTimeout(t,e))}function HR(e=1){return new Promise(t=>{let n=0;const r=()=>{n++,n>=e?t():requestAnimationFrame(r)};requestAnimationFrame(r)})}var la=(e=>(e.URL="URL",e.UUID="UUID",e.BASE64="BASE64",e))(la||{}),nd=(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))(nd||{});const eo=Ae.createIdentifier("core.image-io.service");class rd{constructor(t,n=100){E(this,"_imageCacheMap");this._injector=t,this._imageCacheMap=new br(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(eo)?this._injector.get(eo):null;if(t===la.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 jR=["script","style","meta","comment","link"];var sd=(e=>(e[e.INFO=0]="INFO",e[e.STOP=1]="STOP",e[e.WARNING=2]="WARNING",e))(sd||{}),id=(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))(id||{}),od=(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))(od||{}),ad=(e=>(e[e.TEXT=0]="TEXT",e[e.ARROW=1]="ARROW",e[e.CUSTOM=2]="CUSTOM",e))(ad||{}),ld=(e=>(e.VALID="valid",e.INVALID="invalid",e.VALIDATING="validating",e))(ld||{}),cd=(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))(cd||{}),WR=Object.getOwnPropertyDescriptor,YR=(e,t,n,r)=>{for(var s=r>1?void 0:r?WR(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},GR=(e,t)=>(n,r)=>t(n,r,e);exports.Skeleton=class extends Ke{constructor(n){super();E(this,"_fontLocale");E(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=YR([GR(0,Ae.Inject(En))],exports.Skeleton);var VR=Object.getOwnPropertyDescriptor,zR=(e,t,n,r)=>{for(var s=r>1?void 0:r?VR(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);exports.SheetSkeleton=class extends exports.Skeleton{constructor(n,r,s,i,o,a){super(s);E(this,"_worksheetData");E(this,"_renderRawFormula",!1);E(this,"_cellData");E(this,"_imageCacheMap");E(this,"_skipAutoHeightForMergedCells",!0);E(this,"_rowTotalHeight",0);E(this,"_columnTotalWidth",0);E(this,"_rowHeaderWidth",0);E(this,"_columnHeaderHeight",0);E(this,"_rowHeightAccumulation",[]);E(this,"_columnWidthAccumulation",[]);E(this,"_marginTop",0);E(this,"_marginLeft",0);E(this,"_scaleX");E(this,"_scaleY");E(this,"_scrollX");E(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 rd(this._injector),this.initConfig()}initConfig(){var n,r;this._skipAutoHeightForMergedCells=!((n=this._configService.getConfig(Yc))!=null&&n),this.worksheet.setIsRowStylePrecedeColumnStyle((r=this._configService.getConfig(Wc))!=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){z.isDefine(n)&&(this._scrollX=n),z.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 c=s;if(this.worksheet.getRowFiltered(l))c=0;else if(a[l]!=null){const u=a[l];if(!u)continue;const{h=s,ah:d,ia:f}=u;(f==null||f===ie.TRUE)&&typeof d=="number"?c=d:c=h,u.hd===ie.TRUE&&(c=0)}i+=c,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 c=s;if(a[l]!=null){const u=a[l];if(!u)continue;u.w!=null&&(c=u.w),u.hd===ie.TRUE&&(c=0)}i+=c,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 c=r;c>=s;c--){const u=c,h=this.worksheet.getCell(n,u);if(!Mi(h)&&u!==r||this.intersectMergeRange(n,u))return u===r?u:u+1>l?l:u+1;const{startX:d,endX:f}=xn(n,u,this.rowHeightAccumulation,this.columnWidthAccumulation);if(o===At.CENTER&&u===r?a+=(f-d)/2:a+=f-d,i<a)return u}return r}for(let l=r;l<=s;l++){const c=l,u=this.worksheet.getCell(n,c);if(!Mi(u)&&c!==r||this.intersectMergeRange(n,c))return c===r?c:c-1<0?0:c-1;const{startX:h,endX:d}=xn(n,c,this.rowHeightAccumulation,this.columnWidthAccumulation);if(o===At.CENTER&&c===r?a+=(d-h)/2:a+=d-h,i<a)return c}return s}_updateLayout(){if(!this.dirty)return;const{rowData:n,columnData:r,defaultRowHeight:s,defaultColumnWidth:i,rowCount:o,columnCount:a,rowHeader:l,columnHeader:c}=this._worksheetData,{rowTotalHeight:u,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=c.hidden!==ie.TRUE?c.height:0,this._rowTotalHeight=u,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 c=new ht;for(;l;){l=!1;for(let u=0;u<a.length;u++){const{startRow:h,startColumn:d,endRow:f,endColumn:g}=a[u];if(c.getValue(h,d))continue;wu({startColumn:s,startRow:r,endColumn:o,endRow:i},{startColumn:d,startRow:h,endColumn:g,endRow:f})&&(r=Math.min(r,h),s=Math.min(s,d),i=Math.max(i,f),o=Math.max(o,g),c.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:c,endY:u,startX:h,endX:d}=xn(n,r,i,o);return s&&(c+=l,u+=l,h+=a,d+=a),{startY:c,endY:u,startX:h,endX:d}}getNoMergeCellPositionByIndexWithNoHeader(n,r){const{rowHeightAccumulation:s,columnWidthAccumulation:i}=this,{startY:o,endY:a,startX:l,endX:c}=xn(n,r,s,i);return{startY:o,endY:a,startX:l,endX:c}}getRowIndexByOffsetY(n,r,s,i){var l;const{rowHeightAccumulation:o}=this;n=hd(n,r,s,this.columnHeaderHeightAndMarginTop);let a=or(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 c;const o=ud(n,r,s,this.rowHeaderWidthAndMarginLeft),{columnWidthAccumulation:a}=this;let l=or(a,o,i==null?void 0:i.firstMatch);return i!=null&&i.closeFirst&&Math.abs(a[l]-o)<Math.abs(o-((c=a[l-1])!=null?c:0))&&(l=l+1),l}getCellIndexByOffset(n,r,s,i,o,a){const l=this.getRowIndexByOffsetY(r,i,o,a),c=this.getColumnIndexByOffsetX(n,s,o,a);return{row:l,column:c}}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,c=xn(n,r,i,o,this.worksheet.getCellInfoInMergeData(n,r)),{isMerged:u,isMergedMainCell:h}=c;let{startY:d,endY:f,startX:g,endX:p,mergeInfo:R}=c,b=a,$=l;return s===!1&&(b=0,$=0),d+=$,f+=$,g+=b,p+=b,R.startY+=$,R.endY+=$,R.startX+=b,R.endX+=b,{actualRow:n,actualColumn:r,startX:g,startY:d,endX:p,endY:f,isMerged:u,isMergedMainCell:h,mergeInfo:R}}getCellWithCoordByOffset(n,r,s,i,o,a){const{row:l,column:c}=this.getCellIndexByOffset(n,r,s,i,o,a);return this.getCellWithCoordByIndex(l,c)}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=or(this.columnWidthAccumulation,n);let i=0;s===0?i=n:i=n-this._columnWidthAccumulation[s-1];const o=or(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,c,u,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=(c=s.b)!=null?c:2,n.documentStyle.marginLeft=(u=s.l)!=null?u: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=zR([is(2,Ae.Inject(En)),is(3,Xn),is(4,ia),is(5,Ae.Inject(Ae.Injector))],exports.SheetSkeleton);function ca(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 c=r[t];return c==null&&(c=r[r.length-1]),{startY:o,endY:a,startX:l,endX:c}}function KR(e,t,n,r){return ca(e,t,n,r)}function xn(e,t,n,r,s){e=z.clamp(e,0,n.length-1),t=z.clamp(t,0,r.length-1);let{startY:i,endY:o,startX:a,endX:l}=ca(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:c,isMergedMainCell:u,startRow:h,startColumn:d,endRow:f,endColumn:g}=s;let p={startRow:h,startColumn:d,endRow:f,endColumn:g,startY:i,endY:o,startX:a,endX:l};const R=n.length-1,b=r.length-1;if(c&&h!==-1&&d!==-1){const $=n[h-1]||0,k=n[f]||n[R],W=r[d-1]||0,O=r[g]||r[b];p={...p,startY:$,endY:k,startX:W,endX:O}}else if(!c&&f!==-1&&g!==-1){const $=n[f]||n[R],k=r[g]||r[b];p={...p,startY:i,endY:$,startX:a,endX:k}}return{isMerged:c,isMergedMainCell:u,actualRow:e,actualColumn:t,startY:i,endY:o,startX:a,endX:l,mergeInfo:p}}function ud(e,t,n,r){const{x:s}=n;return e/t+s-r}function hd(e,t,n,r){const{y:s}=n;return e=e/t+s-r,e}const vl=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],Ci=1,sr=8;class ua{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!==Ci)throw new Error(`Got v${s} data when expected v${Ci}.`);const i=vl[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 ua(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=vl.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,sr,t),this.coords=new this.ArrayType(this.data,sr+a+l,t*2),this._pos=t*2,this._finished=!0):(this.data=new ArrayBuffer(sr+o+a+l),this.ids=new this.IndexArrayType(this.data,sr,t),this.coords=new this.ArrayType(this.data,sr+a+l,t*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(Ci<<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 to(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],c=[];for(;l.length;){const u=l.pop()||0,h=l.pop()||0,d=l.pop()||0;if(h-d<=a){for(let R=d;R<=h;R++){const b=o[2*R],$=o[2*R+1];b>=t&&b<=r&&$>=n&&$<=s&&c.push(i[R])}continue}const f=d+h>>1,g=o[2*f],p=o[2*f+1];g>=t&&g<=r&&p>=n&&p<=s&&c.push(i[f]),(u===0?t<=g:n<=p)&&(l.push(d),l.push(f-1),l.push(1-u)),(u===0?r>=g:s>=p)&&(l.push(f+1),l.push(h),l.push(1-u))}return c}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=[],c=r*r;for(;a.length;){const u=a.pop()||0,h=a.pop()||0,d=a.pop()||0;if(h-d<=o){for(let R=d;R<=h;R++)wl(i[2*R],i[2*R+1],t,n)<=c&&l.push(s[R]);continue}const f=d+h>>1,g=i[2*f],p=i[2*f+1];wl(g,p,t,n)<=c&&l.push(s[f]),(u===0?t-r<=g:n-r<=p)&&(a.push(d),a.push(f-1),a.push(1-u)),(u===0?t+r>=g:n+r>=p)&&(a.push(f+1),a.push(h),a.push(1-u))}return l}}function to(e,t,n,r,s,i){if(s-r<=n)return;const o=r+s>>1;dd(e,t,o,r,s,i),to(e,t,n,r,o-1,1-i),to(e,t,n,o+1,s,1-i)}function dd(e,t,n,r,s,i){for(;s>r;){if(s-r>600){const c=s-r+1,u=n-r+1,h=Math.log(c),d=.5*Math.exp(2*h/3),f=.5*Math.sqrt(h*d*(c-d)/c)*(u-c/2<0?-1:1),g=Math.max(r,Math.floor(n-u*d/c+f)),p=Math.min(s,Math.floor(n+(c-u)*d/c+f));dd(e,t,n,g,p,i)}const o=t[2*n+i];let a=r,l=s;for(ir(e,t,r,n),t[2*s+i]>o&&ir(e,t,r,s);a<l;){for(ir(e,t,a,l),a++,l--;t[2*a+i]<o;)a++;for(;t[2*l+i]>o;)l--}t[2*r+i]===o?ir(e,t,r,l):(l++,ir(e,t,l,s)),l<=n&&(r=l+1),n<=l&&(s=l-1)}}function ir(e,t,n,r){Ri(e,n,r),Ri(t,2*n,2*r),Ri(t,2*n+1,2*r+1)}function Ri(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function wl(e,t,n,r){const s=e-n,i=t-r;return s*s+i*i}class XR{constructor(t=!1){E(this,"_tree",new Map);E(this,"_oneCellCache",new Map);E(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 As),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 c=l.get(s);c&&c.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:c,endRow:u,endColumn:h}=s;for(let d=l;d<=u;d++){const f=a.get(d);if(f)for(let g=c;g<=h;g++){const p=f.get(g);p&&p.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 g;const{unitId:n,sheetId:r,range:s}=t,{startRow:i,startColumn:o,endRow:a,endColumn:l}=s,c=(g=this._kdTree.get(n))==null?void 0:g.get(r);if(!c)return[];const{tree:u,items:h}=c,d=u.range(o,i,l,a),f=[];for(const p of d){const R=h[p];f.push(...Array.from(R.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 ua(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:c}=s;if(this._enableOneCellCache&&o===a&&l===c){this._insertOneCellCache(n,r,o,l,i);return}const u=this.getTree(n,r);Number.isNaN(o)&&(o=0),Number.isNaN(l)&&(l=0),Number.isNaN(a)&&(a=Number.POSITIVE_INFINITY),Number.isNaN(c)&&(c=Number.POSITIVE_INFINITY),u.insert({minX:l,minY:o,maxX:c,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 c of l)yield c}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:c}=s;this._enableOneCellCache?o===l&&a===c?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 As;s.fromJSON(t[n][r]),this._tree.get(n).set(r,s)}}}}var qR=Object.getOwnPropertyDescriptor,ZR=(e,t,n,r)=>{for(var s=r>1?void 0:r?qR(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},bl=(e,t)=>(n,r)=>t(n,r,e);let no=class extends Ke{constructor(e,t){super(),this._resourceManagerService=e,this._univerInstanceService=t,this._init()}_init(){const e=n=>{n.businesses.forEach(r=>{switch(r){case ve.UNRECOGNIZED:case ve.UNIVER_UNKNOWN:case ve.UNIVER_SLIDE:case ve.UNIVER_DOC:{this._univerInstanceService.getAllUnitsForType(ve.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 ve.UNIVER_SHEET:this._univerInstanceService.getAllUnitsForType(ve.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$(ve.UNIVER_SHEET).subscribe(n=>{this._resourceManagerService.loadResources(n.getUnitId(),n.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(ve.UNIVER_DOC).subscribe(n=>{const r=n.getUnitId();Gc(r)||this._resourceManagerService.loadResources(n.getUnitId(),n.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(ve.UNIVER_SHEET).subscribe(n=>{this._resourceManagerService.unloadResources(n.getUnitId())})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(ve.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=z.deepClone(t.getSnapshot());return r.resources=n,r}};no=ZR([bl(0,Ae.Inject(Ks)),bl(1,Ae.Inject(Kn))],no);class JR{constructor(t={},n){E(this,"_startedTypes",new Set);E(this,"_injector");E(this,"_disposingCallbacks",new xs);const r=this._injector=QR(n,t==null?void 0:t.override),{theme:s,darkMode:i,locale:o,locales:a,logLevel:l}=t;s&&this._injector.get(Ds).setTheme(s),i&&this._injector.get(Ds).setDarkMode(i),a&&this._injector.get(En).load(a),o&&this._injector.get(En).setLocale(o),l&&this._injector.get(pt).setLogLevel(l),this._init(r)}get _univerInstanceService(){return this._injector.get(Kn)}get _pluginService(){return this._injector.get(exports.PluginService)}__getInjector(){return this._injector}onDispose(t){const n=this._disposingCallbacks.add(je(t));return je(()=>n.dispose(!0))}dispose(){this._disposingCallbacks.dispose(),this._injector.dispose()}setLocale(t){this._injector.get(En).setLocale(t)}createUnit(t,n){return this._univerInstanceService.createUnit(t,n)}createUniverSheet(t){return this._injector.get(pt).warn("[Univer]","Univer.createUniverSheet is deprecated, use createUnit instead"),this._univerInstanceService.createUnit(ve.UNIVER_SHEET,t)}createUniverDoc(t){return this._injector.get(pt).warn("[Univer]","Univer.createUniverDoc is deprecated, use createUnit instead"),this._univerInstanceService.createUnit(ve.UNIVER_DOC,t)}createUniverSlide(t){return this._injector.get(pt).warn("[Univer]","Univer.createUniverSlide is deprecated, use createUnit instead"),this._univerInstanceService.createUnit(ve.UNIVER_SLIDE,t)}_init(t){this._univerInstanceService.registerCtorForType(ve.UNIVER_SHEET,exports.Workbook),this._univerInstanceService.registerCtorForType(ve.UNIVER_DOC,yt),this._univerInstanceService.registerCtorForType(ve.UNIVER_SLIDE,oa);const n=t.get(Kn);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<xe.Ready&&(this._injector.get(exports.LifecycleService).stage=xe.Ready)}registerPlugin(t,n){this._pluginService.registerPlugin(t,n)}}function QR(e,t){const n=qh([[Dh],[En],[Ds],[exports.LifecycleService],[exports.PluginService],[Mr],[Kn,{useClass:exports.UniverInstanceService}],[zh,{useClass:Kh}],[pt,{useClass:Ul,lazy:!0}],[Ur,{useClass:exports.CommandService}],[Xs,{useClass:exports.LocalUndoRedoService,lazy:!0}],[ia,{useClass:yh}],[Xn,{useClass:Ll}],[Ks,{useClass:exports.ResourceManagerService,lazy:!0}],[Qi,{useClass:no,lazy:!0}],[Ah,{useClass:exports.AuthzIoLocalService}],[Th,{useClass:exports.MentionIOLocalService,lazy:!0}]],t),r=e?e.createChild(n):new Ae.Injector(n);return Nl(r,[[Mr],[Qi]]),r}function fd(e){return e.map(t=>t/255)}function md(e){return e.map(t=>Math.round(t*255))}const mt=[[.333,-.667,-.667,0,1],[-.667,.333,-.667,0,1],[-.667,-.667,.333,0,1],[0,0,0,1,0]];function eI(e){const t=e[0],n=e[1],r=e[2];let s=[mt[0][0]*t+mt[0][1]*n+mt[0][2]*r+mt[0][4],mt[1][0]*t+mt[1][1]*n+mt[1][2]*r+mt[1][4],mt[2][0]*t+mt[2][1]*n+mt[2][2]*r+mt[2][4]];return s=s.map(i=>i>1?1:i<0?0:i),s}function tI(e){return md(eI(fd(e)))}function nI([e,t,n]){const r=Math.max(e,t,n),s=Math.min(e,t,n),i=(r+s)/2;let o=0,a=0;if(r!==s){const l=r-s;switch(a=i>.5?l/(2-r-s):l/(r+s),r){case e:o=(t-n)/l+(t<n?6:0);break;case t:o=(n-e)/l+2;break;case n:o=(e-t)/l+4;break}o/=6}return[o,a,i]}function Ls(e,t,n){const r=[e,t,n].map(s=>s<=.03928?s/12.92:((s+.055)/1.055)**2.4);return .2126*r[0]+.7152*r[1]+.0722*r[2]}function Al(e,t){return(Math.max(e,t)+.05)/(Math.min(e,t)+.05)}function rI(e,t,n){let r,s,i;if(t===0)r=s=i=n;else{const o=(c,u,h)=>{let d=h;return d<0&&(d+=1),d>1&&(d-=1),d<.16666666666666666?c+(u-c)*6*d:d<.5?u:d<.6666666666666666?c+(u-c)*(.6666666666666666-d)*6:c},a=n<.5?n*(1+t):n+t-n*t,l=2*n-a;r=o(l,a,e+1/3),s=o(l,a,e),i=o(l,a,e-1/3)}return[r,s,i]}const Ii={r:1,g:1,b:1},Si={r:0,g:0,b:0},sI=Ls(Ii.r,Ii.g,Ii.b),iI=Ls(Si.r,Si.g,Si.b);function oI(e){const t=Ls(e[0],e[1],e[2]),n=Al(sI,t),r=nI(e);let s=1-r[2],i,o,a;do i=rI(r[0],r[1],s),o=Ls(i[0],i[1],i[2]),a=Al(o,iI),s+=.01;while(s<=1&&s>=0&&Math.abs(a-n)<.01);return i}function aI(e){return md(oI(fd(e)))}Cd();exports.ABCToNumber=Zg;exports.AUTO_HEIGHT_FOR_MERGED_CELLS=Yc;exports.AbsoluteRefType=Ge;exports.ActionIterator=Ln;exports.AlignTypeH=mu;exports.AlignTypeV=gu;exports.ArrangeTypeEnum=Eu;exports.ArrowsAndMarkersShapes=Jl;exports.AsyncInterceptorManager=TC;exports.AsyncLock=d0;exports.AutoFillSeries=Hl;exports.BaselineOffset=jt;exports.BasicShapes=Zl;exports.BlockType=Kc;exports.BooleanNumber=ie;exports.BorderStyleTypes=De;exports.BorderType=jl;exports.BuildTextUtils=Qe;exports.BulletAlignment=Fr;exports.COLORS=Ai;exports.CanceledError=Ad;exports.CellModeEnum=Un;exports.CellValueType=Qt;exports.Color=Rn;exports.ColorBuilder=ks;exports.ColorKit=bt;exports.ColorType=_t;exports.ColumnSeparatorType=Zc;exports.CommandType=xr;exports.CommonHideTypes=Wl;exports.ConfigService=yh;exports.ContextService=Ll;exports.CopyPasteType=Yl;exports.CustomCommandExecutionError=Oi;exports.CustomDecorationType=_n;exports.CustomRangeType=rn;exports.DEFAULT_CELL=Ag;exports.DEFAULT_DOC=ta;exports.DEFAULT_DOCUMENT_SUB_COMPONENT_ID=UC;exports.DEFAULT_EMPTY_DOCUMENT_VALUE=jc;exports.DEFAULT_RANGE=wg;exports.DEFAULT_RANGE_ARRAY=vg;exports.DEFAULT_SELECTION=bg;exports.DEFAULT_SLIDE=Su;exports.DEFAULT_STYLES=rt;exports.DEFAULT_WORKSHEET_COLUMN_COUNT=Fh;exports.DEFAULT_WORKSHEET_COLUMN_COUNT_KEY=uR;exports.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT=jh;exports.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY=mR;exports.DEFAULT_WORKSHEET_COLUMN_WIDTH=$h;exports.DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY=dR;exports.DEFAULT_WORKSHEET_ROW_COUNT=kh;exports.DEFAULT_WORKSHEET_ROW_COUNT_KEY=cR;exports.DEFAULT_WORKSHEET_ROW_HEIGHT=Bh;exports.DEFAULT_WORKSHEET_ROW_HEIGHT_KEY=hR;exports.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH=Hh;exports.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY=fR;exports.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY=Bo;exports.DOCS_NORMAL_EDITOR_UNIT_ID_KEY=Fo;exports.DOCS_ZEN_EDITOR_UNIT_ID_KEY=Hc;exports.DOC_DRAWING_PRINTING_COMPONENT_KEY=Dg;exports.DOC_RANGE_TYPE=fc;exports.DashStyleType=ru;exports.DataStreamTreeNodeType=Tu;exports.DataStreamTreeTokenType=ot;exports.DataValidationErrorStyle=sd;exports.DataValidationImeMode=id;exports.DataValidationOperator=od;exports.DataValidationRenderMode=ad;exports.DataValidationStatus=ld;exports.DataValidationType=cd;exports.DeleteDirection=Gl;exports.DependentOn=DR;exports.DesktopLogService=Ul;exports.DeveloperMetadataVisibility=Vl;exports.Dimension=zl;exports.Direction=Kl;exports.Disposable=Ke;exports.DisposableCollection=xs;exports.DocStyleType=Vc;exports.DocumentDataModel=yt;exports.DocumentFlavor=$o;exports.DrawingTypeEnum=Cu;exports.EDITOR_ACTIVATED=Nh;exports.EXTENSION_NAMES=Ou;exports.ErrorService=Dh;exports.EventState=bh;exports.EventSubject=PC;exports.FOCUSING_COMMON_DRAWINGS=qC;exports.FOCUSING_DOC=Er;exports.FOCUSING_EDITOR_BUT_HIDDEN=YC;exports.FOCUSING_EDITOR_INPUT_FORMULA=GC;exports.FOCUSING_EDITOR_STANDALONE=zC;exports.FOCUSING_FX_BAR_EDITOR=Mh;exports.FOCUSING_PANEL_EDITOR=KC;exports.FOCUSING_SHEET=$n;exports.FOCUSING_SLIDE=Cr;exports.FOCUSING_UNIT=pr;exports.FOCUSING_UNIVER_EDITOR=VC;exports.FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE=XC;exports.FORMULA_EDITOR_ACTIVATED=ZC;exports.FollowNumberWithType=zc;exports.FontItalic=Is;exports.FontStyleType=Fn;exports.FontWeight=Ss;exports.GridType=Xc;exports.HLSColor=lc;exports.HorizontalAlign=At;exports.IAuthzIoService=Ah;exports.ICommandService=Ur;exports.IConfigService=ia;exports.IContextService=Xn;exports.IImageIoService=eo;exports.ILocalStorageService=AR;exports.ILogService=pt;exports.IMentionIOService=Th;exports.IPermissionService=zh;exports.IResourceLoaderService=Qi;exports.IResourceManagerService=Ks;exports.IS_ROW_STYLE_PRECEDE_COLUMN_STYLE=Wc;exports.IUndoRedoService=Xs;exports.IUniverInstanceService=Kn;exports.ImageCacheMap=rd;exports.ImageSourceType=la;exports.ImageUploadStatusType=nd;exports.InterceptorEffectEnum=Bn;exports.InterceptorManager=wC;exports.InterpolationPointType=Xl;exports.JSON1=I0;exports.JSONX=Yt;exports.LRUHelper=lr;exports.LRUMap=br;exports.LifecycleStages=xe;exports.ListGlyphType=fe;exports.LocaleService=En;exports.LocaleType=Pr;exports.LogLevel=xl;exports.MOVE_BUFFER_VALUE=ar;exports.MemoryCursor=On;exports.MentionType=Rs;exports.NAMED_STYLE_MAP=yg;exports.NAMED_STYLE_SPACE_MAP=Ng;exports.NamedStyleType=Xe;exports.NilCommand=Pl;exports.NumberUnitType=fu;exports.ObjectMatrix=ht;exports.ObjectRelativeFromH=hu;exports.ObjectRelativeFromV=du;exports.OtherShapes=Ql;exports.PAGE_SIZE=Lg;exports.PAPER_TYPES=Og;exports.PRESET_LIST_TYPE=jr;exports.PRINT_CHART_COMPONENT_KEY=Mg;exports.PageElementType=Ru;exports.PageOrientType=pu;exports.PageType=Ho;exports.PaperType=lt;exports.ParagraphElementType=Qc;exports.ParagraphStyleBuilder=Nr;exports.ParagraphStyleValue=Yr;exports.PermissionService=Kh;exports.PermissionStatus=aa;exports.Plugin=Ji;exports.PositionedObjectLayoutType=tu;exports.PresetListType=Ut;exports.ProtectionType=ql;exports.QuickListType=hh;exports.QuickListTypeMap=A0;exports.RANGE_DIRECTION=dc;exports.RANGE_TYPE=_e;exports.RBush=As;exports.RCDisposable=Md;exports.RGBA_PAREN=lf;exports.RGB_PAREN=af;exports.ROTATE_BUFFER_VALUE=$l;exports.RTree=XR;exports.Range=Gn;exports.Rectangle=sn;exports.RedoCommand=td;exports.RedoCommandId=Jh;exports.RefAlias=qg;exports.Registry=ra;exports.RegistryAsMap=sa;exports.RelativeDate=tc;exports.RelativeSlideLink=Iu;exports.RgbColor=Os;exports.RichTextBuilder=pn;exports.RichTextValue=Jt;exports.RxDisposable=Nd;exports.SHEET_EDITOR_UNITS=Tg;exports.SectionType=qc;exports.SheetTypes=nc;exports.SheetViewModel=Yh;exports.SliceBodyType=ea;exports.SlideDataModel=oa;exports.SpacingRule=nu;exports.SpecialShapes=ec;exports.Styles=Lh;exports.THEME_COLORS=ac;exports.TabStopAlignment=su;exports.TableAlignmentType=ou;exports.TableLayoutType=au;exports.TableRowHeightRule=cu;exports.TableSizeType=iu;exports.TableTextWrapType=lu;exports.TextDecoration=rc;exports.TextDecorationBuilder=Zt;exports.TextDirection=wr;exports.TextDirectionType=Jc;exports.TextStyleBuilder=tn;exports.TextStyleValue=Wr;exports.TextX=Ne;exports.TextXActionType=Z;exports.ThemeColor=vs;exports.ThemeColorType=st;exports.ThemeColors=Ps;exports.ThemeService=Ds;exports.Tools=z;exports.UndoCommand=ed;exports.UndoCommandId=Qh;exports.UnitModel=zs;exports.Univer=JR;exports.UniverInstanceType=ve;exports.UpdateDocsAttributeType=Ee;exports.UserManagerService=Mr;exports.VerticalAlign=gn;exports.VerticalAlignmentType=uu;exports.Worksheet=Dr;exports.WrapStrategy=Cn;exports.WrapTextType=eu;exports.addLinkToDocumentModel=xh;exports.afterInitApply=Hd;exports.afterTime=Bd;exports.awaitTime=$R;exports.binSearchFirstGreaterThanTarget=Bl;exports.binarySearchArray=jd;exports.bufferDebounceTime=Fd;exports.cellToRange=Ff;exports.characterSpacingControlType=_u;exports.checkForSubstrings=$f;exports.checkIfMove=Yd;exports.checkParagraphHasBullet=Sm;exports.checkParagraphHasIndent=Om;exports.checkParagraphHasIndentByStyle=Ec;exports.codeToBlob=Wd;exports.composeBody=zi;exports.composeInterceptors=vh;exports.composeStyles=wi;exports.concatMatrixArray=Af;exports.convertBodyToHtml=of;exports.convertCellToRange=mc;exports.convertObservableToBehaviorSubject=$d;exports.covertCellValue=Di;exports.covertCellValues=Bf;exports.covertTextRunToHtml=bi;exports.createAsyncInterceptorKey=bC;exports.createDefaultUser=Ms;exports.createDocumentModelWithStyle=Rr;exports.createInterceptorKey=vC;exports.createInternalEditorID=Sg;exports.createRowColIter=Bi;exports.dayjs=Gt;exports.debounce=JE;exports.dedupe=Rd;exports.dedupeBy=Id;exports.deepCompare=so;exports.delayAnimationFrame=HR;exports.deleteContent=Rc;exports.extractPureTextFromCell=Gh;exports.fromCallback=kl;exports.fromEventSubject=kC;exports.fromObservable=yd;exports.generateRandomId=Wt;exports.get=Vu;exports.getArrayLength=en;exports.getBodySlice=Tt;exports.getBodySliceHtml=as;exports.getBorderStyleType=Uf;exports.getCellCoordByIndexSimple=ca;exports.getCellInfoInMergeData=wf;exports.getCellPositionByIndexSimple=KR;exports.getCellValueType=Sf;exports.getCellWithCoordByIndexCore=xn;exports.getColorStyle=Dt;exports.getCustomBlockSlice=gh;exports.getCustomDecorationSlice=ph;exports.getCustomRangeSlice=_h;exports.getDocsUpdateBody=Pf;exports.getIntersectRange=wu;exports.getOriginCellValue=_R;exports.getParagraphsSlice=mh;exports.getPlainText=js;exports.getReverseDirection=Gd;exports.getSectionBreakSlice=P0;exports.getTableSlice=fh;exports.getTextRunSlice=Ns;exports.getTransformOffsetX=ud;exports.getTransformOffsetY=hd;exports.getWorksheetUID=RR;exports.groupBy=vd;exports.handleStyleToString=xf;exports.hashAlgorithm=wm;exports.horizontalLineSegmentsSubtraction=Fs;exports.insertMatrixArray=Ti;exports.insertTextToContent=Cc;exports.invertColorByHSL=aI;exports.invertColorByMatrix=tI;exports.isBlackColor=Rf;exports.isBooleanString=l0;exports.isCellCoverable=Mi;exports.isCellV=hc;exports.isEmptyCell=gc;exports.isFormulaId=Lf;exports.isFormulaString=_c;exports.isICellData=uc;exports.isInternalEditorID=Gc;exports.isNodeEnv=sf;exports.isNotNullOrUndefined=Uh;exports.isNullCell=Of;exports.isNumeric=wh;exports.isPatternEqualWithoutDecimal=Ig;exports.isRangesEqual=tR;exports.isRealNum=vm;exports.isSafeNumeric=NC;exports.isSameStyleTextRun=pc;exports.isUnitRangesEqual=nR;exports.isValidRange=kf;exports.isWhiteColor=If;exports.makeArray=wd;exports.makeCellRangeToRangeData=Df;exports.makeCellToSelection=Mf;exports.makeCustomRangeStream=r_;exports.mapObjectMatrix=bf;exports.merge=qo;exports.mergeOverrideWithDependencies=qh;exports.mergeSets=LC;exports.mergeWith=n0;exports.mergeWorksheetSnapshotWithDefault=Wh;exports.mixinClass=yC;exports.moveMatrixArray=Ni;exports.moveRangeByOffset=$g;exports.nameCharacterCheck=BR;exports.normalizeBody=k0;exports.normalizeTextRuns=Hr;exports.numberToABC=Qg;exports.numberToListABC=e_;exports.numfmt=Rg;exports.queryObjectMatrix=Xg;exports.registerDependencies=bd;exports.remove=Lr;exports.repeatStringNumTimes=Au;exports.replaceInDocumentBody=xC;exports.requestImmediateMacroTask=DC;exports.rotate=Od;exports.searchArray=or;exports.searchInOrderedArray=Fl;exports.selectionToArray=vf;exports.sequence=Dl;exports.sequenceAsync=Ml;exports.sequenceExecute=Us;exports.sequenceExecuteAsync=kd;exports.set=s0;exports.shallowEqual=qu;exports.skipParseTagNames=jR;exports.sliceMatrixArray=Tf;exports.sortRules=t_;exports.sortRulesByDesc=n_;exports.sortRulesFactory=Br;exports.spliceArray=yi;exports.splitIntoGrid=jo;exports.takeAfter=vi;exports.textDiff=Zo;exports.throttle=OC;exports.toDisposable=je;exports.touchDependencies=Nl;exports.updateAttributeByDelete=Eh;exports.updateAttributeByInsert=Ch;exports.willLoseNumericPrecision=MC;Object.keys(Ae).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>Ae[e]})});