@univerjs/core 0.18.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cjs/index.js CHANGED
@@ -1,9 +1,9 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`async-lock`);c=s(c);let l=require(`@wendellhu/redi`),u=require(`lodash-es`),d=require(`rxjs`),f=require(`@univerjs/protocol`),p=require(`nanoid`),m=require(`ot-json1`);m=s(m);let h=require(`rxjs/operators`),g=require(`numfmt`);g=s(g);let _=require(`dayjs`);_=s(_);let ee=require(`dayjs/plugin/advancedFormat`);ee=s(ee);let te=require(`dayjs/plugin/customParseFormat`);te=s(te);let ne=require(`dayjs/plugin/localeData`);ne=s(ne);let re=require(`dayjs/plugin/localizedFormat`);re=s(re);let ie=require(`dayjs/plugin/utc`);ie=s(ie);let ae=require(`dayjs/plugin/weekday`);ae=s(ae);let oe=require(`dayjs/plugin/weekOfYear`);oe=s(oe);let se=require(`dayjs/plugin/weekYear`);se=s(se);let ce=require(`rbush`);ce=s(ce);let le=require(`fast-diff`);le=s(le);let ue=require(`@univerjs/themes`),de=require(`kdbush`);de=s(de);const fe=typeof global<`u`?global:typeof self<`u`?self:window;function pe(){let e=new Map,t=0;typeof fe.requestIdleCallback!=`function`&&(fe.requestIdleCallback=function(n){let r=Date.now(),i=++t,a=setTimeout(function(){e.delete(i);let t=Math.max(0,50-(Date.now()-r));n({didTimeout:t===0,timeRemaining(){return t}})},1);return e.set(i,a),i}),typeof fe.cancelIdleCallback!=`function`&&(fe.cancelIdleCallback=function(t){let n=e.get(t);n!==void 0&&(clearTimeout(n),e.delete(t))})}function me(){typeof fe.Array.prototype.findLastIndex!=`function`&&(fe.Array.prototype.findLastIndex=function(e,t){if(this==null)throw TypeError(`Array.prototype.findLastIndex called on null or undefined`);if(typeof e!=`function`)throw TypeError(`callback must be a function`);let n=this.length>>>0;for(let r=n-1;r>=0;r--)if(r in this&&e.call(t,this[r],r,this))return r;return-1}),typeof fe.Array.prototype.findLast!=`function`&&(fe.Array.prototype.findLast=function(e,t){let n=this.findLastIndex(e,t);return n===-1?void 0:this[n]})}function he(){typeof fe.String.prototype.at!=`function`&&(fe.String.prototype.at=function(e){if(this==null)throw TypeError(`String.prototype.at called on null or undefined`);let t=this.length;if(e<0&&(e=t+e),!(e<0||e>=t))return this.charAt(e)})}function ge(){pe(),me(),he()}function _e(e,t){let n=e.indexOf(t);return n>-1?(e.splice(n,1),!0):!1}function ve(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function ye(e,t){let n=new Set,r=[];for(let i of e){let e=t(i);n.has(e)||(n.add(e),r.push(i))}return r}function be(e,t){for(let n=e.length-1;n>-1;n--){let r=e[n];if(t(r,n))return r}return null}function xe(e,t){if(e.length===0)return e;let n=t%e.length;return e.slice(n).concat(e.slice(0,n))}function Se(e,t){let n=new Map;return e.forEach(e=>{let r=t(e),i=n.get(r);n.has(r)||(i=[],n.set(r,i)),i.push(e)}),n}function Ce(e){return Array.isArray(e)?e:[e]}const we=new Set([`true`,`false`]);function Te(e){return we.has(e.toLowerCase())}const Ee=`__INTERNAL_EDITOR__`,De=`${Ee}DOCS_NORMAL`,Oe=`${Ee}DOCS_FORMULA_BAR`,ke=`${Ee}ZEN_EDITOR`,Ae=`${Ee}COMMENT_EDITOR`,je=Symbol(`AUTO_HEIGHT_FOR_MERGED_CELLS`);function Me(e){return`${Ee}${e}`}function Ne(e){return e.startsWith(Ee)}function Pe(e){return e===Ae}function Fe(e,t){t.forEach(t=>e.add(t))}function Ie(e,t){t.forEach(([t])=>{e.has(t)&&e.get(t)})}function Le(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;let i=Object.prototype.hasOwnProperty.bind(t);for(let r=0;r<n.length;r++){let a=n[r];if(!i(a)||e[a]!==t[a])return!1}return!0}var Re=class extends Error{constructor(e){super(e),this.name=`CustomCommandExecutionError`}},ze=class extends Re{constructor(){super(`Canceled by facade`),this.name=`CanceledError`}};function Be(e,t=16){let n=0,r=null;return function(...i){let a=Date.now();a-n<t?(r&&clearTimeout(r),r=setTimeout(()=>{n=a,e.apply(this,i)},t)):(n=a,e.apply(this,i))}}function Ve(e){"@babel/helpers - typeof";return Ve=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Ve(e)}function He(e,t){if(Ve(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Ve(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Ue(e){var t=He(e,`string`);return Ve(t)==`symbol`?t:t+``}function v(e,t,n){return(t=Ue(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let We=function(e){return e[e.Style=1]=`Style`,e[e.Value=2]=`Value`,e}({});function Ge(e){return`sheet_interceptor_${e}`}const Ke=e=>function(t,n){let r=-1,i=t;for(let t=0;t<=e.length;t++){if(t<=r)throw Error(`[SheetInterceptorService]: next() called multiple times!`);if(r=t,t===e.length)return i;let a=e[t],o=!1;if(i=a.handler(i,n,e=>(o=!0,e)),!o)break}return i};var qe=class{constructor(e){v(this,`_interceptorsByName`,new Map),v(this,`_interceptorPoints`,void 0),this._interceptorPoints=e}fetchThroughInterceptors(e,t){let n=e,r=this._interceptorsByName.get(n);return t&&(r=r.filter(t)),Ke(r||[])}intercept(e,t){let n=e;this._interceptorsByName.has(n)||this._interceptorsByName.set(n,[]);let r=this._interceptorsByName.get(n);return r.push(t),this._interceptorsByName.set(n,r.sort((e,t)=>{var n,r;return((n=t.priority)==null?0:n)-((r=e.priority)==null?0:r)})),()=>_e(this._interceptorsByName.get(n),t)}getInterceptPoints(){return this._interceptorPoints}dispose(){this._interceptorsByName.clear()}};function Je(e){return`sheet_async_interceptor_${e}`}const Ye=e=>async function(t,n){let r=-1,i=t;for(let t=0;t<=e.length;t++){if(t<=r)throw Error(`[SheetInterceptorService]: next() called multiple times!`);if(r=t,t===e.length)return i;let a=e[t],o=!1;if(i=await a.handler(i,n,async e=>(o=!0,e)),!o)break}return i};var Xe=class{constructor(e){v(this,`_asyncInterceptorsByName`,new Map),v(this,`_asyncInterceptorPoints`,void 0),this._asyncInterceptorPoints=e}fetchThroughAsyncInterceptors(e,t){let n=e,r=this._asyncInterceptorsByName.get(n);return t&&(r=r.filter(t)),Ye(r||[])}async interceptAsync(e,t){let n=e;this._asyncInterceptorsByName.has(n)||this._asyncInterceptorsByName.set(n,[]);let r=this._asyncInterceptorsByName.get(n);return r.push(t),this._asyncInterceptorsByName.set(n,r.sort((e,t)=>{var n,r;return((n=t.priority)==null?0:n)-((r=e.priority)==null?0:r)})),()=>_e(this._asyncInterceptorsByName.get(n),t)}getInterceptPoints(){return this._asyncInterceptorPoints}dispose(){this._asyncInterceptorsByName.clear()}};function Ze(e){return e.map(e=>e/255)}function Qe(e){return e.map(e=>Math.round(e*255))}function $e([e,t,n]){let r=Math.max(e,t,n),i=Math.min(e,t,n),a=(r+i)/2,o=0,s=0;if(r!==i){let c=r-i;switch(s=a>.5?c/(2-r-i):c/(r+i),r){case e:o=(t-n)/c+(t<n?6:0);break;case t:o=(n-e)/c+2;break;case n:o=(e-t)/c+4;break}o/=6}return[o,s,a]}function et(e,t,n){let r=[e,t,n].map(e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4);return .2126*r[0]+.7152*r[1]+.0722*r[2]}function tt(e,t){return(Math.max(e,t)+.05)/(Math.min(e,t)+.05)}function nt(e,t,n){let r,i,a;if(t===0)r=i=a=n;else{let o=(e,t,n)=>{let r=n;return r<0&&(r+=1),r>1&&--r,r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e},s=n<.5?n*(1+t):n+t-n*t,c=2*n-s;r=o(c,s,e+1/3),i=o(c,s,e),a=o(c,s,e-1/3)}return[r,i,a]}const rt={r:1,g:1,b:1},it={r:0,g:0,b:0},at=et(rt.r,rt.g,rt.b),ot=et(it.r,it.g,it.b);function st(e){let t=tt(at,et(e[0],e[1],e[2])),n=$e(e),r=1-n[2],i,a,o;do i=nt(n[0],n[1],r),a=et(i[0],i[1],i[2]),o=tt(a,ot),r+=.01;while(r<=1&&r>=0&&Math.abs(o-t)<.01);return i}function ct(e){return Qe(st(Ze(e)))}const y=[[.333,-.667,-.667,0,1],[-.667,.333,-.667,0,1],[-.667,-.667,.333,0,1],[0,0,0,1,0]];function lt(e){let t=e[0],n=e[1],r=e[2],i=[y[0][0]*t+y[0][1]*n+y[0][2]*r+y[0][4],y[1][0]*t+y[1][1]*n+y[1][2]*r+y[1][4],y[2][0]*t+y[2][1]*n+y[2][2]*r+y[2][4]];return i=i.map(e=>e>1?1:e<0?0:e),i}function ut(e){return Qe(lt(Ze(e)))}var dt=class{constructor(){v(this,`cursor`,0)}reset(){return this.cursor=0,this}moveCursor(e){this.cursor+=e}moveCursorTo(e){this.cursor=e}};function ft(e,t){for(let n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}function pt(e){return/^-?\d+(\.\d+)?$/.test(e)}function mt(e){return pt(e)?Number(e)<=2**53-1:!1}function ht(e){return Number(e)>2**53-1||e.length>=18}var gt=class e{constructor(){v(this,`_data`,[])}static create(){return new e}add(e){this._data.indexOf(e)>-1||this._data.push(e)}delete(e){let t=this._data.indexOf(e);this._data.splice(t,1)}getData(){return this._data}},_t=class e{constructor(){v(this,`_data`,new Map)}static create(){return new e}add(e,t){this._data.has(e)||this._data.set(e,t)}delete(e){this._data.delete(e)}getData(){return this._data}};function vt(e){let t=new MessageChannel,n=!1,r=()=>{n||e()};return t.port1.onmessage=r,t.port2.postMessage(null),()=>{n=!0,t.port1.onmessage=null,t.port1.close(),t.port2.close()}}async function yt(e){for(let[t,n]of e.entries())try{if(!await n())return{index:t,result:!1}}catch(e){return{index:t,result:!1,error:e}}return{result:!0,index:-1}}function bt(e){for(let[t,n]of e.entries())try{if(!n())return{index:t,result:!1}}catch(e){return{index:t,result:!1,error:e}}return{result:!0,index:-1}}function xt(e,t){return t.forEach(t=>e.add(t)),e}function St(e){return e instanceof d.Subscription||e instanceof d.Subject||e&&`closed`in e&&e.unsubscribe!==void 0}function b(e){let t=!1;return e?St(e)?{dispose:()=>e.unsubscribe()}:typeof e==`function`?{dispose:()=>{t||(t=!0,e())}}:e:b(()=>{})}var Ct=class{constructor(){v(this,`_disposables`,new Set)}add(e){let t=b(e);return this._disposables.add(t),{dispose:(e=!1)=>{e||t.dispose(),this._disposables.delete(t)}}}dispose(){this._disposables.forEach(e=>{e.dispose()}),this._disposables.clear()}},x=class{constructor(){v(this,`_disposed`,!1),v(this,`_collection`,new Ct)}disposeWithMe(e){return this._collection.add(e)}ensureNotDisposed(){if(this._disposed)throw Error(`[Disposable]: object is disposed!`)}dispose(){this._disposed||(this._disposed=!0,this._collection.dispose())}},wt=class extends x{constructor(...e){super(...e),v(this,`dispose$`,new d.Subject)}dispose(){super.dispose(),this.dispose$.next(),this.dispose$.complete()}},Tt=class extends x{constructor(e){super(),this._rootDisposable=e,v(this,`_ref`,0)}inc(){if(this._disposed)throw Error(`[RCDisposable]: should not ref to a disposed.`);this._ref+=1}dec(){--this._ref,this._ref===0&&(this._rootDisposable.dispose(),this.dispose())}},Et=class extends x{};const Dt=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`.split(`.`)),Ot=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 kt(e){if(!Number.isNaN(+e))return!1;if(e.startsWith(`http://localhost:3002`)||e.startsWith(`localhost:3002`))return!0;if(Ot.test(e)){if(At(e))return!0;try{let t=new URL(Mt(e)).hostname.split(`.`).pop();if(t&&Dt.has(t))return!0}catch{return!1}}return!1}function At(e){return/^[a-zA-Z]+:\/\//.test(e)}function jt(e){return/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(e)}function Mt(e){return At(e)?e:jt(e)?`mailto://${e}`:`https://${e}`}function Nt(e,t){try{let n=new URL(t),r=n.pathname.endsWith(`/`)?n.pathname:`${n.pathname}/`,i=e.startsWith(`/`)?e.substring(1):e;return new URL(i,n.origin+r).toString()}catch(t){return console.error(`Error resolving URL with base URL:`,t),e}}function Pt(e,t){return S.getValueType(e)===S.getValueType(t)?S.isArray(e)?Ft(e,t):S.isObject(e)?It(e,t):S.isDate(e)?e.getTime()===t.getTime():S.isRegExp(e)?e.toString()===t.toString():e===t:!1}function Ft(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;n++){let r=e[n],i=t[n];if(!Pt(r,i))return!1}return!0}function It(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i of n){if(!r.includes(i))return!1;let n=e[i],a=t[i];if(!Pt(n,a))return!1}return!0}var S=class e{static deleteNull(e){for(let t in e)(e[t]===null||e[t]===void 0)&&delete e[t];return e}static getSystemType(){let e=navigator.userAgent,t=navigator.platform===`Win32`||navigator.platform===`Windows`,n=navigator.platform===`Mac68K`||navigator.platform===`MacPPC`||navigator.platform===`Macintosh`||navigator.platform===`MacIntel`;if(n)return`Mac`;if(navigator.platform===`X11`&&!t&&!n)return`Unix`;if(String(navigator.platform).indexOf(`Linux`)>-1)return`Linux`;if(t){if(e.indexOf(`Windows NT 5.0`)>-1||e.indexOf(`Windows 2000`)>-1)return`Windows 2000`;if(e.indexOf(`Windows NT 5.1`)>-1||e.indexOf(`Windows XP`)>-1)return`Windows XP`;if(e.indexOf(`Windows NT 5.2`)>-1||e.indexOf(`Windows 2003`)>-1)return`Windows 2003`;if(e.indexOf(`Windows NT 6.0`)>-1||e.indexOf(`Windows Vista`)>-1)return`Windows Vista`;if(e.indexOf(`Windows NT 6.1`)>-1||e.indexOf(`Windows 7`)>-1)return`Windows 7`;if(e.indexOf(`Windows NT 10`)>-1||e.indexOf(`Windows 10`)>-1)return`Windows 10`;if(e.indexOf(`Windows NT 11`)>-1||e.indexOf(`Windows 11`)>-1)return`Windows 11`}return`Unknown system`}static getBrowserType(){let e=navigator.userAgent,t=e.indexOf(`Opera`)>-1,n=e.indexOf(`compatible`)>-1&&e.indexOf(`MSIE`)>-1&&!t,r=e.indexOf(`Trident`)>-1&&e.indexOf(`rv:11.0`)>-1,i=e.indexOf(`Edge`)>-1,a=e.indexOf(`Firefox`)>-1,o=e.indexOf(`Safari`)>-1&&e.indexOf(`Chrome`)===-1,s=e.indexOf(`Chrome`)>-1&&e.indexOf(`Safari`)>-1;if(n){RegExp(`MSIE (\\d+\\.\\d+);`).test(e);let t=Number.parseFloat(RegExp.$1);return t===7?`IE7`:t===8?`IE8`:t===9?`IE9`:t===10?`IE10`:`0`}return a?`FF`:t?`Opera`:o?`Safari`:s?`Chrome`:i?`Edge`:r?`IE11`:`Unknown browser`}static deepMerge(t,...n){n.forEach(e=>e&&a(e));function r(t,n){t.forEach((t,a)=>{if(e.isArray(t)){var o;let e=(o=n[a])==null?[]:o;n[a]=e,r(t,e);return}if(e.isObject(t)){var s;let e=(s=n[a])==null?{}:s;n[a]=e,i(t,e);return}n[a]=t})}function i(t,n){Object.keys(t).forEach(a=>{let o=t[a];if(e.isObject(o)){var s;let e=(s=n[a])==null?{}:s;n[a]=e,i(o,e);return}if(e.isArray(o)){var c;let e=(c=n[a])==null?[]:c;n[a]=e,r(o,e);return}n[a]=o})}function a(n){Object.keys(n).forEach(a=>{let o=n[a];if(e.isArray(o)){var s;let e=(s=t[a])==null?[]:s;t[a]=e,r(o,e);return}if(e.isObject(o)){var c;let e=(c=t[a])==null?{}:c;t[a]=e,i(o,e);return}t[a]=o})}return t}static diffValue(e,t){return Pt(e,t)}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)){let n=[];return t.forEach((t,r)=>{n[r]=e.deepClone(t)}),n}if(this.isObject(t)){let n={};return Object.keys(t).forEach(r=>{let i=t[r];n[r]=e.deepClone(i)}),Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n}return t}static getValueType(e){return Object.prototype.toString.apply(e)}static isDefine(e){return e!=null}static isBlank(e){return this.isDefine(e)?this.isString(e)?e.trim()===``:!1:!0}static isPlainObject(e){return this.isDefine(e)?Object.getPrototypeOf(e)===Object.getPrototypeOf({}):!1}static isDate(e){return this.getValueType(e)===`[object Date]`}static isRegExp(e){return this.getValueType(e)===`[object RegExp]`}static isArray(e){return this.getValueType(e)===`[object Array]`}static isString(e){return this.getValueType(e)===`[object String]`}static isNumber(e){return this.getValueType(e)===`[object Number]`}static isStringNumber(e){return!isNaN(Number.parseFloat(e))&&isFinite(e)}static isObject(e){return this.getValueType(e)===`[object Object]`}static isEmptyObject(e){for(let t in e)return!1;return!0}static isTablet(){return/ipad|android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent.toLowerCase())}static isIPhone(){return/iPhone/i.test(navigator.userAgent)}static isLegalUrl(e){return kt(e)}static normalizeUrl(e){return Mt(e)}static topLevelDomainCombiningString(){return[...Dt].join(`|`)}static removeNull(t){return this.isObject(t)&&Object.keys(t).forEach(n=>{let r=t[n];r==null?delete t[n]:e.removeNull(r)}),t}static numToWord(e){let t=``;for(;e>0;){let n=e%26;n=n===0?n=26:n,t=String.fromCharCode(96+n)+t,e=(e-n)/26}return t.toLocaleUpperCase()}static ABCatNum(e){if(e==null||e.length===0)return NaN;let t=e.toLowerCase().split(``),n=t.length,r=0,i=0;for(let e=0;e<n;e++)i=t[e].charCodeAt(0)-96,r+=i*26**(n-e-1);return r===0?NaN:r-1}static chatAtABC(e){let t=``;for(;e>=0;)t=String.fromCharCode(e%26+97)+t,e=Math.floor(e/26)-1;return t.toUpperCase()}static commonExtend(e,t){let n={};for(let t in e)n[t]=e[t];for(let e in t)t[e]!=null&&(n[e]=t[e]);return n}static hasIntersectionBetweenTwoRanges(e,t,n,r){return t>=n&&r>=e}static isStartValidPosition(e){return/^[A-Za-zА-Яа-яЁё_]/.test(e)}static isValidParameter(e){let t=/[~!@#$%^&*()+=\-{}\[\]\|:;"'<>,?\/ ]+/.test(e),n=e.length<=255;return!t&&n}static clamp(e,t,n){return Math.max(t,Math.min(n,e))}static now(){return performance&&performance.now?performance.now():Date.now()}};function C(e=21,t){return t?(0,p.customAlphabet)(t,e)():(0,p.nanoid)(e)}function Lt(...e){let t={},n=e.length;for(let r=n-1;r>=0;r--){let n=e[r];if(n){let e=Object.keys(n);for(let r of e)t[r]===void 0&&(t[r]=n[r])}}return t}const Rt=()=>typeof process<`u`&&process.versions!=null&&process.versions.node!=null;function zt(e){let t=e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`).replace(/\\\*/g,`.*`).replace(/\\\?/g,`.`);return RegExp(`^${t}$`,`i`)}let Bt=function(e){return e[e.DEFAULT_SERIES=0]=`DEFAULT_SERIES`,e[e.ALTERNATE_SERIES=1]=`ALTERNATE_SERIES`,e}({}),w=function(e){return 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}({}),Vt=function(e){return 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}({}),Ht=function(e){return e[e.UNSUPPORTED=0]=`UNSUPPORTED`,e[e.RGB=1]=`RGB`,e[e.HEX=2]=`HEX`,e[e.THEME=3]=`THEME`,e}({}),Ut=function(e){return e[e.ON=0]=`ON`,e[e.OFF=1]=`OFF`,e}({}),Wt=function(e){return 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}({}),Gt=function(e){return e[e.LEFT=0]=`LEFT`,e[e.RIGHT=1]=`RIGHT`,e}({}),Kt=function(e){return e[e.DOCUMENT=0]=`DOCUMENT`,e[e.PROJECT=1]=`PROJECT`,e}({}),qt=function(e){return e[e.COLUMNS=0]=`COLUMNS`,e[e.ROWS=1]=`ROWS`,e}({}),Jt=function(e){return e[e.UP=0]=`UP`,e[e.RIGHT=1]=`RIGHT`,e[e.DOWN=2]=`DOWN`,e[e.LEFT=3]=`LEFT`,e}({});function Yt(e){switch(e){case Jt.LEFT:return Jt.RIGHT;case Jt.RIGHT:return Jt.LEFT;case Jt.UP:return Jt.DOWN;case Jt.DOWN:return Jt.UP}}let Xt=function(e){return 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}({}),Zt=function(e){return 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.JA_JP=`jaJP`,e.KO_KR=`koKR`,e.ES_ES=`esES`,e.CA_ES=`caES`,e.SK_SK=`skSK`,e}({}),Qt=function(e){return 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}({}),$t=function(e){return e[e.RANGE=0]=`RANGE`,e[e.SHEET=1]=`SHEET`,e}({}),en=function(e){return 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}({}),tn=function(e){return 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}({}),nn=function(e){return 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}({}),rn=function(e){return 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}({}),an=function(e){return 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}({}),on=function(e){return e[e.GRID=0]=`GRID`,e[e.KANBAN=1]=`KANBAN`,e[e.GANTT=2]=`GANTT`,e}({}),sn=function(e){return e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.LEFT_TO_RIGHT=1]=`LEFT_TO_RIGHT`,e[e.RIGHT_TO_LEFT=2]=`RIGHT_TO_LEFT`,e}({}),cn=function(e){return 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}({}),T=function(e){return 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}({}),ln=function(e){return e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.TOP=1]=`TOP`,e[e.MIDDLE=2]=`MIDDLE`,e[e.BOTTOM=3]=`BOTTOM`,e}({}),un=function(e){return e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.OVERFLOW=1]=`OVERFLOW`,e[e.CLIP=2]=`CLIP`,e[e.WRAP=3]=`WRAP`,e}({}),dn=function(e){return e[e.NORMAL=0]=`NORMAL`,e[e.ITALIC=1]=`ITALIC`,e}({}),fn=function(e){return e[e.NORMAL=0]=`NORMAL`,e[e.BOLD=1]=`BOLD`,e}({}),pn=function(e){return e[e.NORMAL=1]=`NORMAL`,e[e.SUBSCRIPT=2]=`SUBSCRIPT`,e[e.SUPERSCRIPT=3]=`SUPERSCRIPT`,e}({}),E=function(e){return e[e.FALSE=0]=`FALSE`,e[e.TRUE=1]=`TRUE`,e}({}),mn=function(e){return e[e.STRING=1]=`STRING`,e[e.NUMBER=2]=`NUMBER`,e[e.BOOLEAN=3]=`BOOLEAN`,e[e.FORCE_STRING=4]=`FORCE_STRING`,e}({}),D=function(e){return 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}({}),hn=function(e){return 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}({}),gn=function(e){return e[e.character=0]=`character`,e[e.paragraph=1]=`paragraph`,e[e.table=2]=`table`,e[e.numbering=3]=`numbering`,e}({}),_n=function(e){return e[e.TAB=0]=`TAB`,e[e.SPACE=1]=`SPACE`,e[e.NOTHING=2]=`NOTHING`,e}({}),O=function(e){return 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}({}),vn=function(e){return 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}({}),yn=function(e){return 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}({}),bn=function(e){return e[e.COMMENT=0]=`COMMENT`,e[e.DELETED=9999]=`DELETED`,e}({}),xn=function(e){return e[e.DRAWING=0]=`DRAWING`,e[e.CUSTOM=1]=`CUSTOM`,e}({}),Sn=function(e){return e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.TRADITIONAL=1]=`TRADITIONAL`,e[e.MODERN=2]=`MODERN`,e}({}),Cn=function(e){return 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}({}),wn=function(e){return 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}({}),Tn=function(e){return 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}({}),En=function(e){return e[e.NORMAL=0]=`NORMAL`,e[e.TBRL=1]=`TBRL`,e[e.LRTBV=2]=`LRTBV`,e}({}),Dn=function(e){return 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}({}),On=function(e){return e[e.BOTH_SIDES=0]=`BOTH_SIDES`,e[e.LEFT=1]=`LEFT`,e[e.RIGHT=2]=`RIGHT`,e[e.LARGEST=3]=`LARGEST`,e}({}),kn=function(e){return 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}({}),k=function(e){return 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}({}),An=function(e){return e[e.AUTO=0]=`AUTO`,e[e.AT_LEAST=1]=`AT_LEAST`,e[e.EXACT=2]=`EXACT`,e}({}),jn=function(e){return 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}({}),Mn=function(e){return 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}({}),Nn=function(e){return e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.SPECIFIED=1]=`SPECIFIED`,e}({}),Pn=function(e){return e[e.START=0]=`START`,e[e.CENTER=1]=`CENTER`,e[e.END=2]=`END`,e}({}),Fn=function(e){return e[e.AUTO_FIT=0]=`AUTO_FIT`,e[e.FIXED=1]=`FIXED`,e}({}),In=function(e){return e[e.NONE=0]=`NONE`,e[e.WRAP=1]=`WRAP`,e}({}),Ln=function(e){return e[e.AUTO=0]=`AUTO`,e[e.AT_LEAST=1]=`AT_LEAST`,e[e.EXACT=2]=`EXACT`,e}({}),Rn=function(e){return 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}({}),zn=function(e){return e.NORMAL=`normal`,e.BOLD=`bold`,e.ITALIC=`italic`,e}({}),Bn=function(e){return 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}({}),Vn=function(e){return 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}({}),Hn=function(e){return 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}({}),Un=function(e){return 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}({}),Wn=function(e){return 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}({}),Gn=function(e){return e[e.compressPunctuation=0]=`compressPunctuation`,e[e.compressPunctuationAndJapaneseKana=1]=`compressPunctuationAndJapaneseKana`,e[e.doNotCompress=2]=`doNotCompress`,e}({}),Kn=function(e){return e[e.PORTRAIT=0]=`PORTRAIT`,e[e.LANDSCAPE=1]=`LANDSCAPE`,e}({}),A=function(e){return 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}({});const qn=[A.A3,A.A4,A.A5,A.B4,A.B5,A.Letter,A.Tabloid,A.Legal,A.Statement,A.Executive,A.Folio];let Jn=function(e){return e[e.forward=0]=`forward`,e[e.backward=1]=`backward`,e[e.front=2]=`front`,e[e.back=3]=`back`,e}({}),Yn=function(e){return 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}({}),Xn=function(e){return 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}({}),Zn=function(e){return 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}({}),Qn=function(e){return 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}({});function $n(e=C(6),t=Zt.EN_US,n=``){return{id:e,locale:t,title:n,tableSource:{},drawings:{},drawingsOrder:[],headers:{},footers:{},body:{dataStream:`\r
2
- `,textRuns:[],customBlocks:[],tables:[],paragraphs:[{startIndex:0,paragraphStyle:{spaceAbove:{v:5},lineSpacing:1,spaceBelow:{v:0}}}],sectionBreaks:[{startIndex:1}]},documentStyle:{pageSize:{width:595/.75,height:842/.75},documentFlavor:Sn.TRADITIONAL,marginTop:50,marginBottom:50,marginRight:50,marginLeft:50,renderConfig:{zeroWidthParagraphBreak:E.FALSE,vertexAngle:0,centerAngle:0,background:{rgb:`#ccc`}},autoHyphenation:E.TRUE,doNotHyphenateCaps:E.FALSE,consecutiveHyphenLimit:2,defaultHeaderId:``,defaultFooterId:``,evenPageHeaderId:``,evenPageFooterId:``,firstPageHeaderId:``,firstPageFooterId:``,evenAndOddHeaders:E.FALSE,useFirstPageHeaderFooter:E.FALSE,marginHeader:30,marginFooter:30},settings:{}}}let j=function(e){return e[e.COVER=0]=`COVER`,e[e.REPLACE=1]=`REPLACE`,e}({}),M=function(e){return e.RETAIN=`r`,e.INSERT=`i`,e.DELETE=`d`,e}({});const er=(0,l.createIdentifier)(`univer.config-service`);var tr=class{constructor(){v(this,`_configChanged$`,new d.Subject),v(this,`configChanged$`,this._configChanged$.asObservable()),v(this,`_config`,new Map)}dispose(){this._config.clear(),this._configChanged$.complete()}getConfig(e){return this._config.get(e)}setConfig(e,t,n){var r;let{merge:i=!1}=n||{},a=(r=this._config.get(e))==null?{}:r;a=i?(0,u.merge)(a,t):t,this._config.set(e,a),this._configChanged$.next({[e]:a})}deleteConfig(e){return this._config.delete(e)}subscribeConfigValue$(e){return new d.Observable(t=>{Object.prototype.hasOwnProperty.call(this._config,e)&&t.next(this._config.get(e));let n=this.configChanged$.pipe((0,d.filter)(t=>Object.prototype.hasOwnProperty.call(t,e))).subscribe(n=>t.next(n[e]));return()=>n.unsubscribe()})}};const nr=(0,l.createIdentifier)(`univer.context-service`);var rr=class extends x{constructor(...e){super(...e),v(this,`_contextChanged$`,new d.Subject),v(this,`contextChanged$`,this._contextChanged$.asObservable()),v(this,`_contextMap`,new Map)}dispose(){super.dispose(),this._contextChanged$.complete(),this._contextMap.clear()}getContextValue(e){var t;return(t=this._contextMap.get(e))==null?!1:t}setContextValue(e,t){this._contextMap.set(e,t),this._contextChanged$.next({[e]:t})}subscribeContextValue$(e){return new d.Observable(t=>{let n=this._contextChanged$.pipe((0,d.filter)(t=>t[e]!==void 0)).subscribe(n=>t.next(n[e]));return this._contextMap.has(e)&&t.next(this._contextMap.get(e)),()=>n.unsubscribe()})}};let ir=function(e){return 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}({});const N=(0,l.createIdentifier)(`univer.log`);var ar=class extends x{constructor(...e){super(...e),v(this,`_logLevel`,ir.INFO),v(this,`_deduction`,new Set)}dispose(){super.dispose(),this._logLevel=ir.INFO,this._deduction.clear()}debug(...e){this._logLevel>=ir.VERBOSE&&this._log(console.debug,...e)}log(...e){this._logLevel>=ir.INFO&&this._log(console.log,...e)}warn(...e){this._logLevel>=ir.WARN&&this._log(console.warn,...e)}error(...e){this._logLevel>=ir.ERROR&&this._log(console.error,...e)}deprecate(...e){this._logLevel>=ir.WARN&&this._logWithDeduplication(console.error,...e)}setLogLevel(e){this._logLevel=e}_log(e,...t){let n=t[0];/^\[(.*?)\]/g.test(n)?e(`\x1B[97;104m${n}\x1B[0m`,...t.slice(1)):e(...t)}_logWithDeduplication(e,...t){let n=or(...t);this._deduction.has(n)||(this._deduction.add(n),this._log(e,...t))}};function or(...e){return e.map(e=>JSON.stringify(e)).join(``)}function P(e,t){return function(n,r){t(n,r,e)}}function F(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}const sr=`command.logExecution`;let I=function(e){return e[e.COMMAND=0]=`COMMAND`,e[e.OPERATION=1]=`OPERATION`,e[e.MUTATION=2]=`MUTATION`,e}({});const cr=(0,l.createIdentifier)(`univer.core.command-service`);var lr=class{constructor(){v(this,`_commands`,new Map),v(this,`_commandTypes`,new Map)}registerCommand(e){if(this._commands.has(e.id))throw Error(`[CommandRegistry]: command "${e.id}" has been registered before.`);return this._commands.set(e.id,e),this._commandTypes.set(e.id,e.type),b(()=>{this.unregisterCommand(e.id)})}unregisterCommand(e){this._commands.delete(e),this._commandTypes.delete(e)}hasCommand(e){return this._commands.has(e)}getCommand(e){return this._commands.has(e)?[this._commands.get(e)]:null}getCommandType(e){return this._commandTypes.get(e)}};const ur={id:`nil`,type:I.COMMAND,handler:()=>!0};let dr=class extends x{constructor(e,t,n){super(),this._injector=e,this._logService=t,this._configService=n,v(this,`_commandRegistry`,void 0),v(this,`_beforeCommandExecutionListeners`,[]),v(this,`_commandExecutedListeners`,[]),v(this,`_collabMutationListeners`,[]),v(this,`_multiCommandDisposables`,new Map),v(this,`_commandExecutingLevel`,0),v(this,`_commandExecutionStack`,[]),this._commandRegistry=new lr,this.registerCommand(ur)}dispose(){super.dispose(),this._commandExecutedListeners.length=0,this._beforeCommandExecutionListeners.length=0,this._collabMutationListeners.length=0}disposed(){return this._disposed}hasCommand(e){return this._commandRegistry.hasCommand(e)}registerCommand(e){return this._commandRegistry.registerCommand(e)}unregisterCommand(e){var t;this._commandRegistry.unregisterCommand(e),(t=this._multiCommandDisposables.get(e))==null||t.dispose()}registerMultipleCommand(e){return this._registerMultiCommand(e)}beforeCommandExecuted(e){if(this._beforeCommandExecutionListeners.indexOf(e)===-1)return this._beforeCommandExecutionListeners.push(e),b(()=>{let t=this._beforeCommandExecutionListeners.indexOf(e);this._beforeCommandExecutionListeners.splice(t,1)});throw Error(`[CommandService]: could not add a listener twice.`)}onCommandExecuted(e){if(this._commandExecutedListeners.indexOf(e)===-1)return this._commandExecutedListeners.push(e),b(()=>{let t=this._commandExecutedListeners.indexOf(e);this._commandExecutedListeners.splice(t,1)});throw Error(`[CommandService]: could not add a listener twice.`)}onMutationExecutedForCollab(e){if(this._collabMutationListeners.indexOf(e)===-1)return this._collabMutationListeners.push(e),b(()=>{let t=this._collabMutationListeners.indexOf(e);this._collabMutationListeners.splice(t,1)});throw Error(`[CommandService]: could not add a collab mutation listener twice.`)}async executeCommand(e,t,n){try{let r=this._commandRegistry.getCommand(e);if(r){let[e]=r,i={id:e.id,type:e.type,params:t},a=this._pushCommandExecutionStack(i),o=n==null?{}:n;this._beforeCommandExecutionListeners.forEach(e=>e(i,o));let s=await this._execute(e,t,o);return o.syncOnly||this._commandExecutedListeners.forEach(e=>e(i,o)),e.type===I.MUTATION&&this._collabMutationListeners.forEach(e=>e(i,o)),a.dispose(),s}throw Error(`[CommandService]: command "${e}" is not registered.`)}catch(e){if(e instanceof Re)return!1;throw e}}syncExecuteCommand(e,t,n){try{let i=this._commandRegistry.getCommand(e);if(i){let[e]=i,a={id:e.id,type:e.type,params:t};if(e.type===I.MUTATION){let e=be(this._commandExecutionStack,e=>e.type===I.COMMAND);if(e){var r;a.params=(r=a.params)==null?{}:r,a.params.trigger=e.id}}let o=this._pushCommandExecutionStack(a),s=n==null?{}:n;this._beforeCommandExecutionListeners.forEach(e=>e(a,s));let c=this._syncExecute(e,t,s);return s.syncOnly||this._commandExecutedListeners.forEach(e=>e(a,s)),e.type===I.MUTATION&&this._collabMutationListeners.forEach(e=>e(a,s)),o.dispose(),c}throw Error(`[CommandService]: command "${e}" is not registered.`)}catch(e){if(e instanceof Re)return!1;throw e}}_pushCommandExecutionStack(e){return this._commandExecutionStack.push(e),b(()=>_e(this._commandExecutionStack,e))}_registerMultiCommand(e){let t=this._commandRegistry.getCommand(e.id),n;if(!t){n=new fr(e.id);let t=new Ct;t.add(this._commandRegistry.registerCommand(n)),t.add(b(()=>{this._multiCommandDisposables.delete(e.id)})),this._multiCommandDisposables.set(e.id,t)}else if(t[0].multi!==!0)throw Error(`Command has registered as a single command.`);else n=t[0];let r=n.registerImplementation(e);return b(()=>{if(r.dispose(),!n.hasImplementations()){var t;(t=this._multiCommandDisposables.get(e.id))==null||t.dispose()}})}async _execute(e,t,n){if(n!=null&&n.syncOnly)return!0;this._configService.getConfig(`command.logExecution`)!==!1&&this._logService.debug(`[CommandService]`,`${`|-`.repeat(Math.max(this._commandExecutingLevel,0))}executing command "${e.id}"`),this._commandExecutingLevel++;let r;try{r=await this._injector.invoke(e.handler,t,n),this._commandExecutingLevel--}catch(e){throw r=!1,this._commandExecutingLevel=0,e}return r}_syncExecute(e,t,n){if(n!=null&&n.syncOnly)return!0;this._configService.getConfig(`command.logExecution`)!==!1&&this._logService.debug(`[CommandService]`,`${`|-`.repeat(Math.max(0,this._commandExecutingLevel))}executing command "${e.id}".`),this._commandExecutingLevel++;let r;try{if(r=this._injector.invoke(e.handler,t,n),r instanceof Promise)throw TypeError(`[CommandService]: Command handler should not return a promise.`);this._commandExecutingLevel--}catch(e){throw r=!1,this._commandExecutingLevel=0,e}return r}};dr=F([P(0,(0,l.Inject)(l.Injector)),P(1,N),P(2,er)],dr);var fr=class{constructor(e){this.id=e,v(this,`name`,void 0),v(this,`multi`,!0),v(this,`type`,I.COMMAND),v(this,`priority`,0),v(this,`_implementations`,[]),v(this,`handler`,async(e,t)=>{if(!this._implementations.length)return!1;let n=e.get(N),r=e.get(nr),i=e.get(l.Injector);for(let e of this._implementations){let a=e.command.preconditions;if((!a||a&&a(r))&&(n.debug(`[MultiCommand]`,`executing implementation "${e.command.name}".`),await i.invoke(e.command.handler,t)))return!0}return!1}),this.name=e}registerImplementation(e){let t={command:e};return this._implementations.push(t),this._implementations.sort((e,t)=>t.command.priority-e.command.priority),b(()=>{let e=this._implementations.indexOf(t);this._implementations.splice(e,1)})}hasImplementations(){return this._implementations.length>0}};function pr(e,t,n){return bt(e.map(e=>()=>t.syncExecuteCommand(e.id,e.params,n)))}function mr(e,t,n){return yt(e.map(e=>()=>t.executeCommand(e.id,e.params,n)))}function hr(e){return new d.Observable(t=>{let n=e((...e)=>t.next(e));return()=>n==null?void 0:n.dispose()})}function gr(e){return function(t){return new d.Observable(n=>(t.subscribe({next:t=>{n.next(t),e(t)&&n.complete()},complete:()=>n.complete(),error:e=>n.error(e)}),()=>n.unsubscribe()))}}function _r(e=0){return t=>{let n=[];return t.pipe((0,d.tap)(e=>n.push(e)),(0,d.debounceTime)(e),(0,d.map)(()=>n),(0,d.tap)(()=>n=[]))}}function vr(e){let t=new d.ReplaySubject(1);return setTimeout(()=>t.next(),e),t.pipe((0,d.take)(1))}function yr(e,t){let n=new d.BehaviorSubject(t);return e.subscribe(n),n}const br=e=>new Promise(t=>{(0,d.merge)(hr(e.onCommandExecuted.bind(e)).pipe((0,h.filter)(([e])=>e.type===I.MUTATION)),(0,d.timer)(300)).pipe((0,h.debounceTime)(16),(0,h.first)()).subscribe(()=>{t()})});function xr(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 Sr(e,t){let n=0,r=e.length-1;for(;n<=r;){let i=Math.floor((r+n)/2);if(t<e[i]&&(i===0||t>=e[i-1]))return i;if(t>=e[i])n=i+1;else if(t<e[i])r=i-1;else return-1}return-1}function Cr(e,t){let n=0,r=e.length;for(;n<r;){let i=Math.floor((n+r)/2);e[i]<=t?n=i+1:r=i}return n<e.length?n:e.length-1}function wr(e,t,n=!1){let r=e.length-1;if(t<0||t<e[0])return 0;if(r=e.length<40||t<=e[20]||t>=e[r-20]?xr(e,t):Cr(e,t),n){let t=e[r];return e.indexOf(t)}return r}function Tr(e){let t=new Blob([e],{type:`text/javascript`});return window.URL.createObjectURL(t)}function Er(e,t){if(t==null||e==null)return!0;let{left:n=0,top:r=0,height:i=0,width:a=0,angle:o=0}=t,{left:s=0,top:c=0,height:l=0,width:u=0,angle:d=0}=e,f=u,p=l,m=a,h=i;return Math.abs(s-n)>2||Math.abs(c-r)>2||Math.abs(f-m)>2||Math.abs(p-h)>2||Math.abs(d-o)>1}const Dr={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],darkyellow:[139,128,0],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]};var Or=class e{static mix(t,n,r){var i,a;r=Math.min(1,Math.max(0,r));let o=new e(t).toRgb(),s=new e(n).toRgb(),c=(i=o.a)==null?1:i,l=(a=s.a)==null?1:a;return new e({r:(s.r-o.r)*r+o.r,g:(s.g-o.g)*r+o.g,b:(s.b-o.b)*r+o.b,a:(l-c)*r+c})}static getContrastRatio(t,n){let r=new e(t).getLuminance(),i=new e(n).getLuminance();return(Math.max(r,i)+.05)/(Math.min(r,i)+.05)}constructor(t){if(v(this,`_color`,void 0),v(this,`_rgbColor`,void 0),v(this,`_isValid`,!1),t==null){this._setNullColor();return}if(t instanceof e){this._color={...t._color},this._rgbColor={...t._rgbColor};return}let n=jr(t);if(n==null){this._setNullColor();return}this._color=n;let r=Ir(this._color);if(r==null){this._setNullColor();return}this._rgbColor=r,this._isValid=!0}get isValid(){return this._isValid}toRgb(){return this._rgbColor}toRgbString(){let{r:e,g:t,b:n,a:r=1}=this.toRgb(),i=r<1;return`rgb${i?`a`:``}(${e},${t},${n}${i?`,${r}`:``})`}toString(){return this.toRgbString()}toHexString(e){let{r:t,g:n,b:r,a:i=1}=this.toRgb(),a=i<1,o=[kr(Math.round(t).toString(16)),kr(Math.round(n).toString(16)),kr(Math.round(r).toString(16)),kr(Math.round(i*255).toString(16))];return e&&o[0][0]===o[0][1]&&o[1][0]===o[1][1]&&o[2][0]===o[2][1]&&o[3][0]===o[3][1]?a?`#${o[0][0]}${o[1][0]}${o[2][0]}${o[3][0]}`:`#${o[0][0]}${o[1][0]}${o[2][0]}`:a?`#${o[0]}${o[1]}${o[2]}${o[3]}`:`#${o[0]}${o[1]}${o[2]}`}toHsv(){return Vr(this.toRgb())}toHsl(){return Br(this.toRgb())}lighten(t=10){let n=this.toHsl();return n.l+=t,n.l=Math.min(Math.max(n.l,0),100),new e(n)}darken(t=10){let n=this.toHsl();return n.l-=t,n.l=Math.min(Math.max(n.l,0),100),new e(n)}setAlpha(t){return new e({...this._rgbColor,a:t})}getLuminance(){let{r:e,g:t,b:n}=this.toRgb();return e=Ar(e),t=Ar(t),n=Ar(n),Number((.2126*e+.7152*t+.0722*n).toFixed(3))}getBrightness(){let{r:e,g:t,b:n}=this.toRgb();return(e*299+t*587+n*114)/1e3}getAlpha(){var e;return(e=this._color.a)==null?1:e}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 kr=e=>e.length===1?`0${e}`:e,Ar=e=>(e/=255,e<=.03928?e/12.92:((e+.055)/1.055)**2.4),jr=e=>{if(Ur(e)){if(`r`in e){let t={r:Math.round(e.r),g:Math.round(e.g),b:Math.round(e.b)};return e.a!==void 0&&(t.a=e.a),t}if(`l`in e){let t={h:Math.round(e.h),s:e.s,l:e.l};return e.a!==void 0&&(t.a=e.a),t}let t={h:Math.round(e.h),s:e.s,v:e.v};return e.a!==void 0&&(t.a=e.a),t}let t=e.trim().toLowerCase();if(Dr[t]){let e=Dr[t],n={r:Math.round(e[0]),g:Math.round(e[1]),b:Math.round(e[2])};return n.a=e[3]||1,n}if(t.startsWith(`#`))return Mr(t);if(t.startsWith(`rgb`))return Nr(t);if(t.startsWith(`hsl`))return Pr(t);if(t.startsWith(`hsv`))return Fr(t)},Mr=e=>{let t=e.substring(1),n=RegExp(`.{1,${t.length>=6?2:1}}`,`g`),r=t.match(n);if(!r||r.length<3)throw Error(`The color '${e}' is illegal hex color`);r[0].length===1&&(r=r.map(e=>e+e));let i={r:Number.parseInt(r[0],16),g:Number.parseInt(r[1],16),b:Number.parseInt(r[2],16)};return r.length>3&&(i.a=Number.parseInt(r[3],16)/255),i},Nr=e=>{let t=e.indexOf(`(`);if(t===-1)throw Error(`The color '${e}' is illegal rgb color`);let n=e.substring(t+1,e.length-1).split(`,`);if(n.length<3)throw Error(`The color '${e}' is illegal rgb color`);let 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},Pr=e=>{let t=e.indexOf(`(`);if(t===-1)throw Error(`The color '${e}' is illegal hsl color`);let n=e.substring(t+1,e.length-1).split(`,`);if(n.length<3)throw Error(`The color '${e}' is illegal hsl color`);let 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},Fr=e=>{let t=e.indexOf(`(`);if(t===-1)throw Error(`The color '${e}' is illegal hsv color`);let n=e.substring(t+1,e.length-1).split(`,`);if(n.length<3)throw Error(`The color '${e}' is illegal hsv color`);let 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},Ir=e=>{let t=jr(e);if(t!=null)return`r`in t?t:`l`in t?Rr(t):zr(t)},Lr=(e,t,n)=>(n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e),Rr=e=>{let{h:t,s:n,l:r}=e;t/=360,n/=100,r/=100;let i=0,a=0,o=0;if(n===0)i=a=o=r;else{let e=r<.5?r*(1+n):r+n-r*n,s=2*r-e;i=Lr(s,e,t+1/3),a=Lr(s,e,t),o=Lr(s,e,t-1/3)}let s={r:Math.round(i*255),g:Math.round(a*255),b:Math.round(o*255)};return e.a!==void 0&&(s.a=e.a),s},zr=e=>{let{h:t,s:n,v:r}=e;t=t/360*6,n/=100,r/=100;let i=Math.floor(t),a=t-i,o=r*(1-n),s=r*(1-a*n),c=r*(1-(1-a)*n),l=i%6,u=[r,s,o,o,c,r][l],d=[c,r,r,s,o,o][l],f=[o,o,c,r,r,s][l],p={r:u*255,g:d*255,b:f*255};return e.a!==void 0&&(p.a=e.a),p},Br=e=>{let{r:t,g:n,b:r}=e;t/=255,n/=255,r/=255;let i=Math.max(t,n,r),a=Math.min(t,n,r),o=(i+a)/2,s,c;if(i===a)s=c=0;else{let e=i-a;switch(c=o>.5?e/(2-i-a):e/(i+a),i){case t:s=(n-r)/e+(n<r?6:0);break;case n:s=(r-t)/e+2;break;default:s=(t-n)/e+4;break}s/=6}let l={h:Math.round(s*360),s:Math.round(c*100),l:Math.round(o*100)};return e.a!==void 0&&(l.a=e.a),l},Vr=e=>{let{r:t,g:n,b:r}=e;t/=255,n/=255,r/=255;let i=Math.max(t,n,r),a=Math.min(t,n,r),o,s=i,c=i-a,l=i===0?0:c/i;if(i===a)o=0;else{switch(i){case t:o=(n-r)/c+(n<r?6:0);break;case n:o=(r-t)/c+2;break;default:o=(t-n)/c+4;break}o/=6}let u={h:Math.round(o*360),s:Math.round(l*100),v:Math.round(s*100)};return e.a!==void 0&&(u.a=e.a),u},Hr=e=>e==null,Ur=e=>!Hr(e)&&typeof e==`object`;function Wr(e){return!!(/^#(?:[0]{3}|[0]{6})\b/.test(e)||/^rgb\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*\)$/.test(e)||/^rgba\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*,\s*(1|1\.0*|0?\.\d+)\)$/.test(e)||/^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*\)$/.test(e)||/^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/.test(e))}function Gr(e){return!!(/^#(?:[Ff]{3}|[Ff]{6})\b/.test(e)||/^rgb\s*\(\s*255\s*,\s*255\s*,\s*255\s*\)$/.test(e)||/^rgba\s*\(\s*255\s*,\s*255\s*,\s*255\s*,\s*(1|1\.0*|0?\.\d+)\)$/.test(e)||/^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*\)$/.test(e)||/^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/.test(e))}function Kr(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 qr(e){if(e.t!==void 0)return e.t;if(typeof e.v==`string`)return mn.STRING;if(typeof e.v==`number`)return mn.NUMBER;if(typeof e.v==`boolean`)return mn.BOOLEAN}function Jr(e){if(e==null)return!0;let{v:t,f:n,si:r,p:i,custom:a}=e;return!(!(t==null||typeof t==`string`&&t.length===0)||n!=null&&n.length>0||r!=null&&r.length>0||i!=null||a!=null)}function Yr(e){return e!=null&&(typeof e==`string`||typeof e==`number`||typeof e==`boolean`)}let L=function(e){return e[e.NORMAL=0]=`NORMAL`,e[e.ROW=1]=`ROW`,e[e.COLUMN=2]=`COLUMN`,e[e.ALL=3]=`ALL`,e}({}),R=function(e){return e[e.NONE=0]=`NONE`,e[e.ROW=1]=`ROW`,e[e.COLUMN=2]=`COLUMN`,e[e.ALL=3]=`ALL`,e}({});function Xr(e){return[e.startRow,e.startColumn,e.endRow,e.endColumn]}let Zr=function(e){return e.NONE=`none`,e.BACKWARD=`backward`,e.FORWARD=`forward`,e}({}),Qr=function(e){return e.RECT=`RECT`,e.TEXT=`TEXT`,e}({});function $r(e,t,n){let r=!1,i=!1,a=e,o=t,s=e,c=t;if(n==null)return{actualRow:e,actualColumn:t,isMergedMainCell:i,isMerged:r,endRow:a,endColumn:o,startRow:s,startColumn:c};for(let l=0;l<n.length;l++){let{startRow:u,endRow:d,startColumn:f,endColumn:p}=n[l];if(e===u&&t===f){a=d,o=p,s=u,c=f,i=!0;break}if(e>=u&&e<=d&&t>=f&&t<=p){a=d,o=p,s=u,c=f,r=!0;break}}return{actualRow:e,actualColumn:t,isMergedMainCell:i,isMerged:r,endRow:a,endColumn:o,startRow:s,startColumn:c}}let ei=function(e){return e.Raw=`raw`,e.Intercepted=`intercepted`,e.Both=`both`,e}({});const ti={[hn.OFFICE]:{[D.ACCENT1]:`#4472C4`,[D.ACCENT2]:`#ED7D31`,[D.ACCENT3]:`#A5A5A5`,[D.ACCENT4]:`#70AD47`,[D.ACCENT5]:`#5B9BD5`,[D.ACCENT6]:`#70AD47`,[D.DARK1]:`#000000`,[D.DARK2]:`#44546A`,[D.LIGHT1]:`#FFFFFF`,[D.LIGHT2]:`#E7E6E6`,[D.HYPERLINK]:`#0563C1`,[D.FOLLOWED_HYPERLINK]:`#954F72`}};function ni(e){return e===`@@@`||e===`@`}function ri(e){return e==null||e===`General`}const ii=(e,t)=>{if(e&&!t||!e&&t)return!1;let n=e=>{let t=g.tokenize(e),n=``,r=!1,i=!1;for(let e of t){if(e.type===g.tokenTypes.POINT){r=!0;continue}if(!(i&&e.type===g.tokenTypes.MINUS)&&e.type!==g.tokenTypes.SKIP){if(e.type===g.tokenTypes.COLOR){i=!0;continue}else i=!1;r&&e.type===g.tokenTypes.ZERO||(r=!1,r||(n+=e.value||``))}}return n};return n(e)===n(t)},ai=new Set([`m d`]),oi=new Set([`h:mm AM/PM`,`hh:mm AM/PM`]),si=new Set([`$`,`¥`,`₽`,`₫`,`NT$`,`€`,`₩`,`﷼`]),ci=e=>{var t,n;let r=(t=(n=g.parseDate(e))==null?g.parseTime(e):n)==null?g.parseNumber(e):t;if(!r)return null;let{z:i}=r;if(i){if(ai.has(i)||oi.has(i)&&!/\s(A|AM|P|PM)$/i.test(e))return null;if(i.includes(`#,##0`)){if(/[.,]$/.test(e))return null;let t=e.replace(RegExp(`^[${[...si].join(``)}]+`),``).trim();if(t.includes(`,`)&&!/^-?\d{1,3}(,\d{3})*(\.\d+)?$/.test(t))return null}}return r};function li(e,t){let n={};for(let r in e){let i=Number(r),a=e[i];for(let e in a){let r=Number(e),o=a[r],s=t(i,r,o);s!==void 0&&(n[i]?n[i][r]=s:n[i]={[r]:s})}}return n}function ui(e){let t=0,n=Object.keys(e);for(let e of n){let n=Number(e);t=Math.max(t,n)}return t+1}const di=e=>e==null||typeof e==`object`&&Object.keys(e).length===0;function fi(e,t,n){let r=ui(n),i=n;for(let t=r-1;t>=e;t--)di(i[t])?delete i[t+1]:i[t+1]=i[t];di(t)||(i[e]=t)}function pi(e,t,n){let r=Object.keys(n).reduce((e,t)=>Math.max(e,Number.parseInt(t)),0)+1;for(let i=e;i<r;i++)i<e+t?delete n[i]:n[i]!==void 0&&(n[i-t]=n[i],delete n[i])}function mi(e,t){let n=e,r=Object.keys(n),i=r.length,a=t,o=Object.keys(a),s=o.length,c={},l=0;for(let e=0;e<i;e++,l++)c[l]=n[r[e]];for(let e=0;e<s;e++,l++)c[l]=a[o[e]];return c}function hi(e,t,n){let r=n;if(ui(n)>0){let n={},i=0;for(let a=e;a<=t;a++)r[a]&&(n[i]=r[a],i++);return n}return{}}function gi(e,t,n,r){let i=e>n;if(!i&&e+t>n)throw Error(`Invalid move operation`);i?_i(e,t,n,r):vi(e,t,n,r)}function _i(e,t,n,r){let i=r,a=[];for(let n=e;n<e+t;n++)a.push(i[n]);for(let r=e-1;r>=n;r--){let e=i[r];i[r+t]=e,e===void 0&&delete i[r+t]}a.forEach((e,t)=>{i[n+t]=e,e===void 0&&delete i[n+t]})}function vi(e,t,n,r){let i=r,a=[];for(let n=e;n<e+t;n++)a.push(i[n]);for(let r=e+t;r<n;r++){let e=i[r];i[r-t]=e,e===void 0&&delete i[r-t]}a.forEach((e,r)=>{i[n+r-t]=e,e===void 0&&delete i[n+r-t]})}var yi=class e{constructor(e={}){v(this,`_matrix`,void 0),this._setOriginValue(e)}static MakeObjectMatrixSize(t){return new e({[t-1]:{}})}getMatrix(){return this._matrix}forEach(e){let t=this._matrix,n=Object.keys(t);for(let r of n){let n=Number(r),i=t[n];if(e(n,i)===!1)return this}return this}forRow(e){let t=this._matrix,n=Object.keys(t);for(let r of n){let n=Number(r),i=t[n];if(e(n,Object.keys(i).map(e=>Number(e)))===!1)return this}return this}forValue(e){let t=this._matrix;for(let n in t){let r=Number(n),i=t[r];if(i)for(let t in i){let n=Number(t),a=i[n];if(e(r,n,a)===!1)return this}}return this}swapRow(e,t){let n=this._matrix[e],r=this._matrix[t];this._matrix[e]=r,this._matrix[t]=n}getRow(e){return this._matrix[e]}getRowOrCreate(e){let t=this.getRow(e);return t==null&&(t={},this._matrix[e]=t),t}reset(){this._setOriginValue({})}hasValue(){let e=this._matrix,t=Object.keys(e);if(t.length===0)return!1;for(let n of t){let t=e[Number(n)];if(Object.keys(t).length>0)return!0}return!1}getValue(e,t){var n;return(n=this._matrix)==null||(n=n[e])==null?void 0:n[t]}setValue(e,t,n){let r=this.getRowOrCreate(e);r[t]=n}deleteValue(e,t){var n;(n=this._matrix)==null||(n=n[e])==null||delete n[t]}realDeleteValue(e,t){var n;if((n=this._matrix)==null||(n=n[e])==null||delete n[t],this.getRow(e)){let t=this.getRow(e);if(t==null)return;if(Object.keys(t).length===0){var r;(r=this._matrix)==null||delete r[e]}}}setRow(e,t){this._matrix[e]=t}moveRows(e,t,n){gi(e,t,n,this._matrix)}moveColumns(e,t,n){this.forEach((r,i)=>{gi(e,t,n,i)})}insertRows(e,t){let n=Object.keys(this._matrix);for(let r=n.length-1;r>=0;r--){let i=Number(n[r]);if(i>=e){let e=this._matrix[i];delete this._matrix[i],this._matrix[i+t]=e}}}insertColumns(e,t){let n=Object.keys(this._matrix);for(let r=0;r<n.length;r++){let i=Number(n[r]),a=this._matrix[i],o=Object.keys(a);for(let n=o.length-1;n>=0;n--){let r=Number(o[n]);if(r>=e){let e=a[r];delete a[r],a[r+t]=e}}}}removeRows(e,t){pi(e,t,this._matrix)}removeColumns(e,t){this.forEach((n,r)=>{r&&pi(e,t,r)})}getFragment(t,n,r,i){let a=new e,o=0;for(let e=t;e<=n;e++){let t={},n=0;for(let a=r;a<=i;a++)t[n]=this.getValue(e,a),n++;a.setRow(o,t),o++}return a}getSlice(t,n,r,i){let a=new e;for(let e=t;e<=n;e++)for(let t=r;t<=i;t++){let n=this.getValue(e,t);n&&a.setValue(e,t,S.deepClone(n))}return a}getSliceDataAndCellCountByRows(t,n){let r=new e,i=0;for(let e=t;e<=n;e++){let t=this.getRow(e);t&&(r.setRow(e,t),i+=Object.keys(t).length)}return{sliceData:r,cellCount:i}}getSizeOf(){return Object.keys(this._matrix).length}getLength(){return ui(this._matrix)}getRange(){let e=this.getLength()-1,t=0,n=this.getLength();for(let e=0;e<n;e++){let n=this.getRow(e);if(n){let e=ui(n)-1;t=e>t?e:t}}return{startRow:0,startColumn:0,endRow:e,endColumn:t}}getRealRange(){let e=Object.keys(this._matrix),t=e.length,n=t>0?Number(e[0]):0,r=t>0?Number(e[t-1]):0,i=-1/0,a=0;for(let t of e){let e=this.getRow(Number(t));if(e){let t=Object.keys(e);if(t.length>0){let e=Number(t[0]),n=Number(t[t.length-1]);(i===-1/0||e<i)&&(i=e),n>a&&(a=n)}}}return i===-1/0&&(i=0),{startRow:n,endRow:r,startColumn:i,endColumn:a}}getRealRowRange(){let e=Object.keys(this._matrix),t=e.length;return{startRow:t>0?Number(e[0]):0,endRow:t>0?Number(e[t-1]):0}}toNativeArray(){let e=[];return this.forValue((t,n,r)=>{e.push(r)}),e}toArray(){let e=[];return this.forRow((t,n)=>{e[t]==null&&(e[t]=[]),n.forEach(n=>{e[t][n]=this.getValue(t,n)})}),e}toFullArray(){let{endColumn:e,endRow:t}=this.getRange(),n=[];for(let r=0;r<=t;r++){let t=Array(e+1).fill(void 0);n.push(t)}return this.forValue((e,t,r)=>{n[e][t]=r}),n}toJSON(){return this._matrix}clone(){let e=JSON.stringify(this._matrix);return JSON.parse(e)}getData(){let e=JSON.stringify(this._matrix);return JSON.parse(e)}getArrayData(){let t=0,n=0,r=!1,i=!1,a=new e;return this.forEach((e,o)=>{r||(r=!0,t=e),Object.keys(o).forEach(r=>{let o=Number(r);i?o<n&&(n=o):(i=!0,n=o);let s=this.getValue(e,o);a.setValue(e-t,o-n,s)})}),a.getData()}getStartEndScope(){let e=1/0,t=-1/0,n=1/0,r=-1/0,i=Object.keys(this._matrix);i.length>0&&(e=+i[0],t=+i[i.length-1]);for(let e of i){let t=Object.keys(this._matrix[e]);t.length>0&&(n=Math.min(n,+t[0]),r=Math.max(r,+t[t.length-1]))}return{startRow:e,endRow:t,startColumn:n,endColumn:r}}getDataRange(){let e=0,t=0,n=0,r=-1,i=!1,a=!1;return this.forEach((o,s)=>{if(i||(i=!0,e=o),s==null)return;let c=ui(s)-1;c>n&&(n=c),Object.keys(s).forEach(e=>{let n=Number(e);a?n<t&&(t=n):(a=!0,t=n)}),o>r&&(r=o)}),{startRow:e,startColumn:t,endRow:r,endColumn:n}}getDiscreteRanges(){let e=[];return this.forEach((t,n)=>{Object.keys(n).forEach(n=>{let r=Number(n),i=!1;for(let n of e)if(t>=n.startRow&&t<=n.endRow+1&&r>=n.startColumn&&r<=n.endColumn+1){n.endRow=Math.max(t,n.endRow),n.endColumn=Math.max(r,n.endColumn),i=!0;break}i||e.push({startRow:t,endRow:t,startColumn:r,endColumn:r})})}),e}merge(e){this.forValue((t,n)=>{let r=e.getValue(t,n);r!=null&&this.setValue(t,n,r)})}concatRows(e){let t=e.getMatrix();for(let e in t){let n=Number(e);this.setRow(n,t[n])}}_setOriginValue(e={}){this._matrix=e}};function bi(e){let{actualRow:t,actualColumn:n,isMerged:r,isMergedMainCell:i,mergeInfo:a}=e,{startY:o,endY:s,startX:c,endX:l}=e,u=t,d=n,f=t,p=n;if(r&&a){let{startRow:e,startColumn:t,endRow:n,endColumn:r,startY:i,endY:m,startX:h,endX:g}=a;u=e,d=t,f=n,p=r,o=i,s=m,c=h,l=g}return i&&(o=a.startY,s=a.endY,c=a.startX,l=a.endX,f=a.endRow,p=a.endColumn),{startRow:u,startColumn:d,endRow:f,endColumn:p,startY:o,endY:s,startX:c,endX:l}}const xi=bi;function Si(e){if(!e)return;let{actualRow:t,actualColumn:n,isMerged:r,isMergedMainCell:i,startRow:a,startColumn:o,endRow:s,endColumn:c}=e,l=t,u=n,d=t,f=n;return(r||i)&&(l=a,u=o,d=s,f=c),{startRow:l,startColumn:u,endRow:d,endColumn:f}}function Ci(e){var t;return!e||((e==null||(t=e.v)==null?void 0:t.toString())||``).length===0&&!e.p}function wi(e){return Ci(e)&&(e==null?void 0:e.coverable)!==!1}function z(e){if(e){if(e.rgb)return new Or(e.rgb).toHexString();if(e.th!=null){var t;let n=(t=ti[hn.OFFICE])==null?void 0:t[e.th];if(n)return new Or(n).toRgbString()}}return null}function Ti(e){return S.isString(e)&&e.substring(0,1)===`=`&&e.length>1}function Ei(e){return S.isString(e)&&e.length>0}function Di(e,t=!1){let n=``,r=new Map([[`ff`,()=>{e.ff&&(n+=`font-family: ${e.ff}; `)}],[`fs`,()=>{if(e.fs){let t=e.fs;e.va&&(t/=2),n+=`font-size: ${t}pt; `}}],[`it`,()=>{e.it&&(n+=`font-style: italic; `)}],[`bl`,()=>{e.bl&&(n+=`font-weight: bold; `)}],[`ul`,()=>{var t;(t=e.ul)!=null&&t.s&&(n.indexOf(`text-decoration-line`)>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(e,t)=>`${t} underline`):n+=`text-decoration: underline; `,e.ul.cl&&n.indexOf(`text-decoration-color`)===-1&&(n+=`text-decoration-color: ${z(e.ul.cl)}; `),e.ul.t&&n.indexOf(`text-decoration-style`)===-1&&(n+=`text-decoration-style: ${e.ul.t} `))}],[`st`,()=>{var t;(t=e.st)!=null&&t.s&&(n.indexOf(`text-decoration-line`)>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(e,t)=>`${t} line-through`):n+=`text-decoration-line: line-through; `,e.st.cl&&n.indexOf(`text-decoration-color`)===-1&&(n+=`text-decoration-color: ${z(e.st.cl)}; `),e.st.t&&n.indexOf(`text-decoration-style`)===-1&&(n+=`text-decoration-style: ${e.st.t} `))}],[`ol`,()=>{var t;(t=e.ol)!=null&&t.s&&(n.indexOf(`text-decoration-line`)>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(e,t)=>`${t} overline`):n+=`text-decoration-line: overline; `,e.ol.cl&&n.indexOf(`text-decoration-color`)===-1&&(n+=`text-decoration-color: ${z(e.ol.cl)}; `),e.ol.t&&n.indexOf(`text-decoration-style`)===-1&&(n+=`text-decoration-style: ${e.ol.t} `))}],[`bg`,()=>{e.bg&&(n+=`background: ${z(e.bg)}; `)}],[`bd`,()=>{var t,r,i,a;if((t=e.bd)!=null&&t.b){var o,s;n+=`border-bottom: ${Oi((o=e.bd)==null?void 0:o.b.s)} ${(s=z(e.bd.b.cl))==null?``:s}; `}if((r=e.bd)!=null&&r.t){var c,l;n+=`border-top: ${Oi((c=e.bd)==null?void 0:c.t.s)} ${(l=z(e.bd.t.cl))==null?``:l}; `}if((i=e.bd)!=null&&i.r){var u,d;n+=`border-right: ${Oi((u=e.bd)==null?void 0:u.r.s)} ${(d=z(e.bd.r.cl))==null?``:d}; `}if((a=e.bd)!=null&&a.l){var f,p;n+=`border-left: ${Oi((f=e.bd)==null?void 0:f.l.s)} ${(p=z(e.bd.l.cl))==null?``:p}; `}}],[`cl`,()=>{e.cl&&(n+=`color: ${z(e.cl)}; `)}],[`va`,()=>{e.va===pn.SUBSCRIPT?n+=`vertical-align: sub; `:e.va===pn.SUPERSCRIPT&&(n+=`vertical-align: super; `)}],[`td`,()=>{e.td===sn.LEFT_TO_RIGHT?n+=`direction: ltr; `:e.td===sn.RIGHT_TO_LEFT&&(n+=`direction: rtl; `)}],[`tr`,()=>{if(e.tr){var t,r,i;n+=`--data-rotate: (${(t=e.tr)==null?void 0:t.a}deg${(r=e.tr)!=null&&r.v?` ,${(i=e.tr)==null?void 0:i.v}`:``});`}}],[`ht`,()=>{e.ht===T.LEFT?n+=`text-align: left; `:e.ht===T.RIGHT?n+=`text-align: right; `:e.ht===T.CENTER?n+=`text-align: center; `:e.ht===T.JUSTIFIED&&(n+=`text-align: justify; `)}],[`vt`,()=>{e.vt===ln.BOTTOM?n+=`vertical-align: bottom; `:e.vt===ln.TOP?n+=`vertical-align: top; `:e.vt===ln.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 t,r,i,a,o,s,c,l;let u=`${(t=e.pd)==null?void 0:t.b}pt`,d=`${(r=e.pd)==null?void 0:r.t}pt`,f=`${(i=e.pd)==null?void 0:i.l}pt`,p=`${(a=e.pd)==null?void 0:a.r}pt`;(o=e.pd)!=null&&o.b&&(n+=`padding-bottom: ${u}; `),(s=e.pd)!=null&&s.t&&(n+=`padding-top: ${d}; `),(c=e.pd)!=null&&c.l&&(n+=`padding-left: ${f}; `),(l=e.pd)!=null&&l.r&&(n+=`padding-right: ${p}; `)}]]),i=[`bd`,`tr`,`tb`];for(let n in e){var a;t&&i.includes(n)||(a=r.get(n))==null||a()}return n}function Oi(e){let t=``;return e===w.NONE?t=`none`:e===w.THIN?t=`0.5pt solid`:e===w.HAIR?t=`0.5pt double`:e===w.DOTTED?t=`0.5pt dotted`:e===w.DASHED||e===w.DASH_DOT?t=`0.5pt dashed`:e===w.DASH_DOT_DOT?t=`0.5pt dotted`:e===w.DOUBLE?t=`0.5pt double`:e===w.MEDIUM?t=`1pt solid`:e===w.MEDIUM_DASHED||e===w.MEDIUM_DASH_DOT?t=`1pt dashed`:e===w.MEDIUM_DASH_DOT_DOT?t=`1pt dotted`:e===w.SLANT_DASH_DOT?t=`0.5pt dashed`:e===w.THICK&&(t=`1.5pt solid`),t}function ki(e){let t=0;if(e=e.trim(),e===`none`)t=w.NONE;else if(e===`0.5pt solid`)t=w.THIN;else if(e===`0.5pt double`)t=w.HAIR;else if(e===`0.5pt dotted`)t=w.DOTTED;else if(e===`0.5pt dashed`)t=w.DASHED;else if(e===`1pt solid`)t=w.MEDIUM;else if(e===`1pt dashed`)t=w.MEDIUM_DASHED;else if(e===`1pt dotted`)t=w.MEDIUM_DASH_DOT_DOT;else if(e===`1.5pt solid`)t=w.THICK;else if(!e.includes(`none`))t=w.THIN;else return w.NONE;return t}function Ai(e,t){let n=e.body;if(t){let{headers:r,footers:i}=e;r!=null&&r[t]?n=r[t].body:i!=null&&i[t]&&(n=i[t].body)}return n}function ji(e,t){let{startRow:n,endRow:r,startColumn:i,endColumn:a,rangeType:o}=e;if(n<0||i<0||r<0||a<0||!(Number.isNaN(n)&&Number.isNaN(r))&&o===L.COLUMN||!(Number.isNaN(i)&&Number.isNaN(a))&&o===L.ROW||o!==L.ROW&&o!==L.COLUMN&&(Number.isNaN(i)||Number.isNaN(n)||Number.isNaN(a)||Number.isNaN(r)))return!1;if(t){let e=t.getRowCount(),n=t.getColumnCount();if(r>=e||a>=n)return!1}return!0}function Mi(e,t){return{startRow:e,endRow:e,startColumn:t,endColumn:t}}function Ni(e){if(Ti(e))return{f:e,v:null,p:null};if(Yr(e)){if(typeof e==`string`){let t=ci(e);if(t&&t.z)return{v:t.v,p:null,f:null,s:{n:{pattern:t.z||`General`}}}}return{v:e,p:null,f:null}}return Kr(e),e}function Pi(e,t){let n=new yi,{startRow:r,startColumn:i,endRow:a,endColumn:o}=t;if(S.isArray(e))for(let t=0;t<=a-r;t++)for(let a=0;a<=o-i;a++)n.setValue(t+r,a+i,Ni(e[t][a]));else new yi(e).forValue((e,t,r)=>{n.setValue(e,t,Ni(r))});return n.getMatrix()}function Fi(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?Object.keys(e).every(n=>Fi(e[n],t[n])):!1:e===t:!1}function Ii(e,t){let n=e.ts||{},r=t.ts||{};return e.sId===t.sId?Fi(n,r):!1}function Li(e,t){return t.some(t=>e.indexOf(t)>-1)}_.default.extend(te.default),_.default.extend(ee.default),_.default.extend(ae.default),_.default.extend(ne.default),_.default.extend(oe.default),_.default.extend(se.default),_.default.extend(ie.default),_.default.extend(re.default);function Ri(e,t,n,r){if(e>t)throw Error(`a1 should be less than a2`);if(n>r)throw Error(`b1 should be less than b2`);if(t<n||r<e)return[e,t];if(n<=e&&r>=t)return[];let i=r-n+1;return e<n&&t>r?[e,t-i]:n<=e&&r<t?[r+1-i,t-i]:n>e&&r>=t?[e,n-1]:[e,t]}function zi(e){if(e==null)return!1;let t=e.bullet;return(t==null?void 0:t.listId)!=null}function Bi(e){if(e==null)return!1;let t=e.paragraphStyle;return Vi(t)}function Vi(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 Hi(e,t,n){return e.slice(0,t)+n+e.slice(t)}function Ui(e,t,n){return t>n?e:e.slice(0,t)+e.slice(n)}function Wi(e){if(e==null||typeof e==`boolean`)return!1;if(typeof e==`number`)return!isNaN(e);if(typeof e==`string`){let t=e.trim();return t===``?!1:!isNaN(Number(t))}return!1}function Gi(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+(t<<6)+(t<<16)-t;return t>>>0}function Ki(e){if(e.length===0)return[];let t=e.slice().sort((e,t)=>(Array.isArray(e)?e[0]:e)-(Array.isArray(t)?t[0]:t)),n=[],r=Array.isArray(t[0])?t[0][0]:t[0],i=r;for(let e=1;e<t.length;e++){let a=t[e],o,s;Array.isArray(a)?(o=a[0],s=a[1]):(o=a,s=a),o<=i+1?i=Math.max(i,s):(n.push([r,i]),r=o,i=s)}return n.push([r,i]),n}function qi(e){if(e.length===0)return[];let t=e.slice().sort((e,t)=>e[0]-t[0]),n=[],[r,i]=t[0];for(let e=1;e<t.length;e++){let[a,o]=t[e];a<=i+1?i=Math.max(i,o):(n.push([r,i]),r=a,i=o)}return n.push([r,i]),n}function Ji(...e){let t;return t=e.length===1&&Array.isArray(e[0])?e[0]:e,(0,u.merge)({},...t)}let Yi,Xi,Zi,Qi;const B=Symbol(`newer`),V=Symbol(`older`);Yi=Symbol.iterator;var $i=class{constructor(e){v(this,`entry`,void 0),this.entry=e}[Yi](){return this}next(){let e=this.entry;return e?(this.entry=e[B],{done:!1,value:e.key}):{done:!0,value:void 0}}};Xi=Symbol.iterator;var ea=class{constructor(e){v(this,`entry`,void 0),this.entry=e}[Xi](){return this}next(){let e=this.entry;return e?(this.entry=e[B],{done:!1,value:e.value}):{done:!0,value:void 0}}};Zi=Symbol.iterator;var ta=class{constructor(e){v(this,`entry`,void 0),this.entry=e}[Zi](){return this}next(){let e=this.entry;return e?(this.entry=e[B],{done:!1,value:[e.key,e.value]}):{done:!0,value:void 0}}},na=class{constructor(e,t){v(this,`key`,void 0),v(this,`value`,void 0),v(this,B,void 0),v(this,V,void 0),this.key=e,this.value=t,this[B]=void 0,this[V]=void 0}toJSON(){return{key:this.key,value:this.value}}};Qi=Symbol.iterator;var ra=class{onShift(e){if(this._onShiftListeners.indexOf(e)===-1)return this._onShiftListeners.push(e),b(()=>_e(this._onShiftListeners,e));throw Error(`[LRUMap]: the listener has been registered!`)}constructor(...e){if(v(this,`_keymap`,void 0),v(this,`size`,0),v(this,`limit`,void 0),v(this,`oldest`,void 0),v(this,`newest`,void 0),v(this,`_onShiftListeners`,[]),ia.hasLength(e,1)){if(ia.isNumber(e[0])){let t=e[0];this._initialize(t,void 0);return}if(ia.isIterable(e[0])){let t=e[0];this._initialize(0,t);return}return}if(ia.hasLength(e,2)){let t=e[0],n=e[1];this._initialize(t,n)}}_initialize(e,t){this.oldest=void 0,this.newest=void 0,this.size=0,this.limit=e,this._keymap=new Map,t&&(this.assign(t),e<1&&(this.limit=this.size))}_markEntryAsUsed(e){e!==this.newest&&(e[B]&&(e===this.oldest&&(this.oldest=e[B]),e[B][V]=e[V]),e[V]&&(e[V][B]=e[B]),e[B]=void 0,e[V]=this.newest,this.newest&&(this.newest[B]=e),this.newest=e)}assign(e){let t,n=this.limit||Number.MAX_VALUE;this._keymap.clear();let r=e[Symbol.iterator]();for(let e=r.next();!e.done;e=r.next()){let r=new na(e.value[0],e.value[1]);if(this._keymap.set(r.key,r),t?(t[B]=r,r[V]=t):this.oldest=r,t=r,n--===0)throw Error(`overflow`)}this.newest=t,this.size=this._keymap.size}set(e,t){let n=this._keymap.get(e);return n?(n.value=t,this._markEntryAsUsed(n),this):(this._keymap.set(e,n=new na(e,t)),this.newest?(this.newest[B]=n,n[V]=this.newest):this.oldest=n,this.newest=n,++this.size,this.size>this.limit&&this.shift(),this)}shift(){let e=this.oldest;if(e)return this.oldest&&this.oldest[B]?(this.oldest=this.oldest[B],this.oldest[V]=void 0):(this.oldest=void 0,this.newest=void 0),e[B]=e[V]=void 0,this._keymap.delete(e.key),--this.size,this._onShiftListeners.forEach(t=>t(e)),[e.key,e.value]}get(e){let t=this._keymap.get(e);if(t)return this._markEntryAsUsed(t),t.value}has(e){return this._keymap.has(e)}find(e){let t=this._keymap.get(e);return t?t.value:void 0}delete(e){let t=this._keymap.get(e);if(t)return this._keymap.delete(t.key),t[B]&&t[V]?(t[V][B]=t[B],t[B][V]=t[V]):t[B]?(t[B][V]=void 0,this.oldest=t[B]):t[V]?(t[V][B]=void 0,this.newest=t[V]):this.oldest=this.newest=void 0,this.size--,t.value}clear(){this.oldest=void 0,this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new $i(this.oldest)}values(){return new ea(this.oldest)}entries(){return this[Symbol.iterator]()}[Qi](){return new ta(this.oldest)}forEach(e,t){typeof t!=`object`&&(t=this);let n=this.oldest;for(;n;)e.call(t,n.value,n.key,this),n=n[B]}toJSON(){let e=Array(this.size),t=0,n=this.oldest;for(;n;)e[t++]={key:n.key,value:n.value},n=n[B];return e}toString(){let e=``,t=this.oldest;for(;t;)e+=`${String(t.key)}:${t.value}`,t=t[B],t&&(e+=` < `);return e}},ia=class{static hasLength(e,t){return e.length===t}static getValueType(e){return Object.prototype.toString.apply(e)}static isObject(e){return this.getValueType(e)===`[object Object]`}static isIterable(e){return e[Symbol.iterator]!=null}static isNumber(e){return this.getValueType(e)===`[object Number]`}};function aa(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r<65||r>90)return-1;t=t*26+(r-64)}return t}const oa=1048576,sa=16384,ca={sheetId:``,range:{startRow:-1,endRow:-1,startColumn:-1,endColumn:-1}},la={startRow:-1,startColumn:-1,endRow:-1,endColumn:-1},ua={startRow:0,startColumn:0,endRow:0,endColumn:0},da={row:0,column:0},H={ff:`Arial`,fs:11,it:E.FALSE,bl:E.FALSE,ul:{s:E.FALSE},st:{s:E.FALSE},ol:{s:E.FALSE},tr:{a:0,v:E.FALSE},td:sn.UNSPECIFIED,cl:{rgb:`#000000`},bg:{rgb:`#fff`},ht:T.UNSPECIFIED,vt:ln.UNSPECIFIED,tb:un.UNSPECIFIED,pd:{t:0,r:0,b:0,l:0},n:null,bd:{b:null,l:null,r:null,t:null}},fa={id:`default_slide`,title:`defaultSlide`,pageSize:{width:300,height:300}},pa=[De,ke,Oe],ma={[k.HEADING_1]:{fs:20,bl:1},[k.HEADING_2]:{fs:18,bl:1},[k.HEADING_3]:{fs:16,bl:1},[k.HEADING_4]:{fs:14,bl:1},[k.HEADING_5]:{fs:12,bl:1},[k.NORMAL_TEXT]:null,[k.TITLE]:{fs:26,bl:1},[k.SUBTITLE]:{fs:15,cl:{rgb:`#999999`}},[k.NAMED_STYLE_TYPE_UNSPECIFIED]:null},ha={[k.HEADING_1]:{spaceAbove:{v:20},spaceBelow:{v:10}},[k.HEADING_2]:{spaceAbove:{v:18},spaceBelow:{v:10}},[k.HEADING_3]:{spaceAbove:{v:16},spaceBelow:{v:10}},[k.HEADING_4]:{spaceAbove:{v:14},spaceBelow:{v:8}},[k.HEADING_5]:{spaceAbove:{v:12},spaceBelow:{v:8}},[k.NORMAL_TEXT]:{spaceAbove:{v:0},spaceBelow:{v:0}},[k.TITLE]:{spaceAbove:{v:0},spaceBelow:{v:7}},[k.SUBTITLE]:{spaceAbove:{v:0},spaceBelow:{v:16}},[k.NAMED_STYLE_TYPE_UNSPECIFIED]:null};let ga=function(e){return e.ARRAY_CONVERTOR=`ARRAY_CONVERTOR`,e.MATRIX_CONVERTOR=`MATRIX_CONVERTOR`,e}({});const _a={[A.A3]:{width:1123,height:1587},[A.A4]:{width:794,height:1124},[A.A5]:{width:559,height:794},[A.B4]:{width:944,height:1344},[A.B5]:{width:665,height:944},[A.Executive]:{width:696,height:1008},[A.Folio]:{width:816,height:1248},[A.Legal]:{width:816,height:1344},[A.Letter]:{width:816,height:1056},[A.Statement]:{width:528,height:816},[A.Tabloid]:{width:1056,height:1632}};function va(e,t){let{textRuns:n=[]}=t,r=0;for(let t of n){let{ts:n={},st:i,ed:a}=t;if(n[e]==null)return E.FALSE;switch(e){case`bl`:case`it`:if(n[e]===E.FALSE)return E.FALSE;break;case`ul`:case`st`:if(n[e].s===E.FALSE)return E.FALSE;break;default:throw Error(`unknown style key: ${e} in IStyleBase`)}r+=a-i}return t.dataStream.indexOf(`\r
3
- `)===r?E.TRUE:E.FALSE}var ya=class e{constructor(e,t,n){this._deps=n,v(this,`_range`,void 0),v(this,`_worksheet`,void 0),this._range=t,this._worksheet=e}static foreach(e,t){let{startRow:n,startColumn:r,endRow:i,endColumn:a}=e;for(let e=n;e<=i;e++)for(let n=r;n<=a;n++)t(e,n)}getRangeData(){return this._range}getValue(){return this.getValues()[0][0]}getValues(){let{startRow:e,endRow:t,startColumn:n,endColumn:r}=this._range,i=[];for(let a=e;a<=t;a++){let e=[];for(let t=n;t<=r;t++)e.push(this.getMatrix().getValue(a,t)||null);i.push(e)}return i}getMatrix(){let{startRow:e,endRow:t,startColumn:n,endColumn:r}=this._range,i=this._worksheet.getCellMatrix(),a=new yi;for(let o=e;o<=t;o++)for(let e=n;e<=r;e++)a.setValue(o,e,i.getValue(o,e)||null);return a}getMatrixObject(){let{startRow:e,endRow:t,startColumn:n,endColumn:r}=this._range,i=this._worksheet.getCellMatrix(),a=new yi;for(let o=e;o<=t;o++)for(let t=n;t<=r;t++)a.setValue(o-e,t-n,i.getValue(o,t)||{});return a}getA1Notation(){let{startRow:e,endRow:t,startColumn:n,endColumn:r}=this._range,i,a;return n<r?(i=S.numToWord(n+1)+(e+1),a=S.numToWord(r+1)+(t+1)):(i=S.numToWord(r+1)+(t+1),a=S.numToWord(n+1)+(e+1)),i===a?`${i}`:`${i}:${a}`}getBackground(){return this.getBackgrounds()[0][0]}getBackgrounds(){let e=this._deps.getStyles();return this.getValues().map(t=>t.map(t=>{var n;let r=e.getStyleByCell(t);return(r==null||(n=r.bg)==null?void 0:n.rgb)||H.bg.rgb}))}getCell(t,n){let{startRow:r,startColumn:i}=this._range,a={startRow:r+t,endRow:r+t,startColumn:i+n,endColumn:i+n};return new e(this._worksheet,a,this._deps)}getColumn(){return this._range.startColumn}getObjectValue(e={}){return this.getObjectValues(e)[0][0]}getObjectValues(e={}){let{startRow:t,endRow:n,startColumn:r,endColumn:i}=this._range,a=this._worksheet.getCellMatrix().getFragment(t,n,r,i).getData();if(e.isIncludeStyle){let e=this._deps.getStyles();for(let s=0;s<=n-t;s++)for(let t=0;t<=i-r;t++){var o;if(a==null||(a==null||(o=a[s])==null?void 0:o[t])==null)continue;let n=a[s][t].s;n&&(a[s][t].s=e.get(n))}}return a}getFontColor(){return this.getFontColors()[0][0]}getFontColors(){let e=this._deps.getStyles();return this.getValues().map(t=>t.map(t=>{var n;let r=e.getStyleByCell(t);return(r==null||(n=r.cl)==null?void 0:n.rgb)||H.cl.rgb}))}getFontFamilies(){return this._getStyles(`ff`)}getFontFamily(){return this.getFontFamilies()[0][0]}getUnderlines(){return this._getStyles(`ul`)}getUnderline(){var e,t;let{p:n}=(e=this.getValue())==null?{}:e;return n&&Array.isArray((t=n.body)==null?void 0:t.textRuns)&&n.body.textRuns.length>0?va(`ul`,n.body)===E.TRUE?{s:E.TRUE}:{s:E.FALSE}:this.getUnderlines()[0][0]}getOverlines(){return this._getStyles(`ol`)}getOverline(){return this.getOverlines()[0][0]}getStrikeThrough(){var e,t;let{p:n}=(e=this.getValue())==null?{}:e;return n&&Array.isArray((t=n.body)==null?void 0:t.textRuns)&&n.body.textRuns.length>0?va(`st`,n.body)===E.TRUE?{s:E.TRUE}:{s:E.FALSE}:this.getStrikeThroughs()[0][0]}getStrikeThroughs(){return this._getStyles(`st`)}getFontSize(){var e,t;let n=((e=this.getValue())==null?void 0:e.p)||{};return n&&Array.isArray((t=n.body)==null?void 0:t.textRuns)&&n.body.textRuns.length>0&&n.body.textRuns.some(e=>{var t;return(e==null||(t=e.ts)==null?void 0:t.fs)!=null})?Math.max(...n.body.textRuns.map(e=>{var t;return(e==null||(t=e.ts)==null?void 0:t.fs)||0})):this.getFontSizes()[0][0]}getFontSizes(){return this._getStyles(`fs`)}getBorder(){return this.getBorders()[0][0]}getBorders(){return this._getStyles(`bd`)}getFontStyle(){var e,t;let{p:n}=(e=this.getValue())==null?{}:e;return n&&Array.isArray((t=n.body)==null?void 0:t.textRuns)&&n.body.textRuns.length>0?va(`it`,n.body)===E.TRUE?dn.ITALIC:dn.NORMAL:this._getFontStyles()[0][0]}_getFontStyles(){return this._getStyles(`it`)}getFontWeight(){var e,t;let{p:n}=(e=this.getValue())==null?{}:e;return n&&Array.isArray((t=n.body)==null?void 0:t.textRuns)&&n.body.textRuns.length>0?va(`bl`,n.body)===E.TRUE?fn.BOLD:fn.NORMAL:this._getFontWeights()[0][0]}_getFontWeights(){return this._getStyles(`bl`)}getGridId(){return this._worksheet.getSheetId()}getHeight(){let{_range:e,_worksheet:t}=this,{startRow:n,endRow:r}=e,i=0;for(let e=0;e<=r-n;e++){let n=t.getRowHeight(e);i+=n}return i}getHorizontalAlignment(){return this.getHorizontalAlignments()[0][0]}getHorizontalAlignments(){return this._getStyles(`ht`)}getLastColumn(){return this._range.endColumn}getLastRow(){return this._range.endRow}getNumColumns(){let{startColumn:e,endColumn:t}=this._range;return t-e+1}getNumRows(){let{startRow:e,endRow:t}=this._range;return t-e+1}getRichTextValue(){return this.getRichTextValues()[0][0]}getRichTextValues(){return this.getValues().map(e=>e.map(e=>(e==null?void 0:e.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(){let e=this._deps.getStyles();return this.getValues().map(t=>t.map(t=>e.getStyleByCell(t)))}getVerticalAlignment(){return this.getVerticalAlignments()[0][0]}getVerticalAlignments(){return this._getStyles(`vt`)}getWidth(){let{_range:e,_worksheet:t}=this,{startColumn:n,endColumn:r}=e,i=0;for(let e=0;e<=r-n;e++)i+=t.getColumnWidth(e);return i}getWrap(){return this.getWrapStrategy()===un.WRAP?E.TRUE:E.FALSE}getWrapStrategies(){return this._getStyles(`tb`)}getWrapStrategy(){return this.getWrapStrategies()[0][0]}forEach(t){e.foreach(this._range,t)}_getStyles(e){let t=this._deps.getStyles();return this.getValues().map(n=>n.map(n=>{let r=t&&t.getStyleByCell(n);return r&&r[e]||H[e]}))}};v(ya,`transformRange`,(e,t)=>{let n=t.getMaxColumns()-1,r=t.getMaxRows()-1;return e.rangeType===L.ALL?{startColumn:0,startRow:0,endColumn:n,endRow:r}:e.rangeType===L.COLUMN?{startRow:0,endRow:r,startColumn:e.startColumn,endColumn:e.endColumn}:e.rangeType===L.ROW?{startColumn:0,endColumn:n,startRow:e.startRow,endRow:e.endRow}:{startColumn:e.startColumn,endColumn:Math.min(e.endColumn,n),startRow:e.startRow,endRow:Math.min(e.endRow,r)}});function ba(e,t,n,r=!1){if(t===0&&n===0)return e;let i={...e},a=i.startAbsoluteRefType||R.NONE,o=i.endAbsoluteRefType||R.NONE,s=i.rangeType||L.NORMAL;if(!r&&a===R.ALL&&o===R.ALL)return i;let c=xa(i.startRow,n,i.startColumn,t,s),l=xa(i.endRow,n,i.endColumn,t,s);return r||a===R.NONE&&o===R.NONE?i={...i,startRow:c.row,startColumn:c.column,endRow:l.row,endColumn:l.column}:(a===R.NONE?i={...i,startRow:c.row,startColumn:c.column}:a===R.COLUMN?i={...i,startRow:c.row}:a===R.ROW&&(i={...i,startColumn:c.column}),o===R.NONE?i={...i,endRow:l.row,endColumn:l.column}:o===R.COLUMN?i={...i,endRow:l.row}:o===R.ROW&&(i={...i,endColumn:l.column}),i)}function xa(e,t,n,r,i){return i===L.NORMAL?{row:e+t,column:n+r}:i===L.ROW?{row:e+t,column:n}:i===L.COLUMN?{row:e,column:n+r}:{row:e,column:n}}function Sa(e){let t=new Set,n=new Set;for(let r of e)t.add(r.startColumn),t.add(r.endColumn+1),n.add(r.startRow),n.add(r.endRow+1);let r=Array.from(t).sort((e,t)=>e-t),i=Array.from(n).sort((e,t)=>e-t);e.sort((e,t)=>e.startRow-t.startRow||e.startColumn-t.startColumn);let a=[];for(let t=0;t<i.length-1;t++)for(let n=0;n<r.length-1;n++){let o=r[n],s=r[n+1]-1,c=i[t],l=i[t+1]-1;for(let t of e){if(t.startRow>l)break;if(t.startRow<=c&&t.endRow>=l&&t.startColumn<=o&&t.endColumn>=s){a.push({startColumn:o,endColumn:s,startRow:c,endRow:l});break}}}return a}function Ca(e){e.sort((e,t)=>e.startRow-t.startRow||e.startColumn-t.startColumn);let t={};for(let n of e)t[n.startRow]||(t[n.startRow]=[]),t[n.startRow].push(n);let n=[];for(let e in t){let r=t[+e];r.sort((e,t)=>e.startColumn-t.startColumn);let i=r[0];for(let e=1;e<r.length;e++){let t=r[e];t.startColumn<=i.endColumn+1&&t.startRow===i.startRow&&t.endRow===i.endRow?i.endColumn=Math.max(i.endColumn,t.endColumn):(n.push(i),i=t)}n.push(i)}return n}function wa(e){e.sort((e,t)=>e.startColumn-t.startColumn||e.startRow-t.startRow);let t={};for(let n of e)t[n.startColumn]||(t[n.startColumn]=[]),t[n.startColumn].push(n);let n=[];for(let e in t){let r=t[+e];r.sort((e,t)=>e.startRow-t.startRow);let i=r[0];for(let e=1;e<r.length;e++){let t=r[e];t.startRow<=i.endRow+1&&t.startColumn===i.startColumn&&t.endColumn===i.endColumn?i.endRow=Math.max(i.endRow,t.endRow):(n.push(i),i=t)}n.push(i)}return n}function Ta(e){return wa(Ca(Sa(e)))}function Ea(e,t){let n=[];return e.forEach(e=>{n.push(...U.subtract(e,t))}),U.mergeRanges(n)}function Da(e,t){let n=Oa(e.startRow,e.endRow,t.startRow,t.endRow),r=Oa(e.startColumn,e.endColumn,t.startColumn,t.endColumn);if(!n||!r)return null;let[i,a]=n,[o,s]=r;return{startRow:i,endRow:a,startColumn:o,endColumn:s,rangeType:ka(e.rangeType,t.rangeType,i,a,o,s)}}function Oa(e,t,n,r){let i=isNaN(e)?-1/0:e,a=isNaN(t)?1/0:t,o=isNaN(n)?-1/0:n,s=isNaN(r)?1/0:r,c=Math.max(i,o),l=Math.min(a,s);return c<=l?[c===-1/0?NaN:c,l===1/0?NaN:l]:null}function ka(e,t,n,r,i,a){let o=e===void 0?Aa(n,r,i,a):e,s=t===void 0?Aa(n,r,i,a):t;return o===L.ALL||s===L.ALL?o===s?o:o===L.ALL?s:o:o===s?o:(o===L.NORMAL||L.NORMAL,L.NORMAL)}function Aa(e,t,n,r){let i=!isNaN(e)&&!isNaN(t),a=!isNaN(n)&&!isNaN(r);return i&&a?L.NORMAL:i?L.ROW:a?L.COLUMN:L.ALL}var U=class e{static clone(e){return e.rangeType===void 0?{startRow:e.startRow,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn}:{startRow:e.startRow,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn,rangeType:e.rangeType}}static equals(e,t){return e==null||t==null?!1:e.endRow===t.endRow&&e.endColumn===t.endColumn&&e.startRow===t.startRow&&e.startColumn===t.startColumn&&(e.rangeType===t.rangeType||e.rangeType===void 0&&t.rangeType===L.NORMAL||t.rangeType===void 0&&e.rangeType===L.NORMAL)}static simpleRangesIntersect(e,t){let{startRow:n,endRow:r,startColumn:i,endColumn:a}=e,{startRow:o,endRow:s,startColumn:c,endColumn:l}=t;return n<=s&&r>=o&&i<=l&&a>=c}static intersects(e,t){if(e.rangeType===L.ROW&&t.rangeType===L.COLUMN||e.rangeType===L.COLUMN&&t.rangeType===L.ROW)return!0;if(e.rangeType===L.ROW&&t.rangeType===L.ROW)return e.startRow<=t.endRow&&e.endRow>=t.startRow;if(e.rangeType===L.COLUMN&&t.rangeType===L.COLUMN)return e.startColumn<=t.endColumn&&e.endColumn>=t.startColumn;let n=Number.isNaN(e.startRow)?0:e.startRow,r=Number.isNaN(e.endRow)?oa-1:e.endRow,i=Number.isNaN(e.startColumn)?0:e.startColumn,a=Number.isNaN(e.endColumn)?sa-1:e.endColumn,o=Number.isNaN(t.startRow)?0:t.startRow,s=Number.isNaN(t.endRow)?oa-1:t.endRow,c=Number.isNaN(t.startColumn)?0:t.startColumn,l=Number.isNaN(t.endColumn)?sa-1:t.endColumn,u=Math.abs(i+a-c-l),d=Math.abs(i-a)+Math.abs(c-l),f=Math.abs(n+r-o-s),p=Math.abs(n-r)+Math.abs(o-s);return u<=d&&f<=p}static doAnyRangesIntersect(e,t){let n=new ce.default;return n.load(e.map(e=>({minX:e.startColumn,minY:e.startRow,maxX:e.endColumn,maxY:e.endRow}))),t.some(e=>n.search({minX:e.startColumn,minY:e.startRow,maxX:e.endColumn,maxY:e.endRow}).length>0)}static getIntersects(e,t){let n=e.startRow,r=e.endRow,i=e.startColumn,a=e.endColumn,o=t.startRow,s=t.endRow,c=t.startColumn,l=t.endColumn,u,d,f,p;if(o<=r)d=o>=n?o:n;else return null;if(s>=n)p=s>=r?r:s;else return null;if(c<=a)u=c>i?c:i;else return null;if(l>=i)f=l>=a?a:l;else return null;return{startRow:d,endRow:p,startColumn:u,endColumn:f,rangeType:L.NORMAL}}static contains(e,t){return e.startRow<=t.startRow&&e.endRow>=t.endRow&&e.startColumn<=t.startColumn&&e.endColumn>=t.endColumn}static realContain(t,n){return e.contains(t,n)&&(t.startRow<n.startRow||t.endRow>n.endRow||t.startColumn<n.startColumn||t.endColumn>n.endColumn)}static union(...e){return e.reduce((e,t)=>({startRow:Math.min(e.startRow,t.startRow),startColumn:Math.min(e.startColumn,t.startColumn),endRow:Math.max(e.endRow,t.endRow),endColumn:Math.max(e.endColumn,t.endColumn),rangeType:L.NORMAL}),e[0])}static realUnion(...t){let n=t.some(e=>e.rangeType===L.COLUMN),r=t.some(e=>e.rangeType===L.ROW),i=e.union(...t);return{startColumn:r?NaN:i.startColumn,endColumn:r?NaN:i.endColumn,startRow:n?NaN:i.startRow,endRow:n?NaN:i.endRow,rangeType:r?L.ROW:n?L.COLUMN:L.NORMAL}}static subtract(e,t){if(t.startRow>e.endRow||t.endRow<e.startRow||t.startColumn>e.endColumn||t.endColumn<e.startColumn)return[e];let n=[];t.startRow>=e.startRow&&n.push({startRow:e.startRow,startColumn:e.startColumn,endRow:t.startRow-1,endColumn:e.endColumn}),t.endRow<=e.endRow&&n.push({startRow:t.endRow+1,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn});let r=Math.max(e.startRow,t.startRow),i=Math.min(e.endRow,t.endRow);return t.startColumn>=e.startColumn&&n.push({startRow:r,startColumn:e.startColumn,endRow:i,endColumn:t.startColumn-1}),t.endColumn<=e.endColumn&&n.push({startRow:r,startColumn:t.endColumn+1,endRow:i,endColumn:e.endColumn}),n.filter(e=>e.startRow<=e.endRow&&e.startColumn<=e.endColumn)}static mergeRanges(e){return Ta(e)}static splitIntoGrid(e){return Sa(e)}static subtractMulti(e,t){if(!t.length)return e;let n=e;return t.forEach(e=>{n=Ea(n,e)}),n}static hasIntersectionBetweenTwoRect(e,t){return!(e.left>t.right||e.right<t.left||e.top>t.bottom||e.bottom<t.top)}static getIntersectionBetweenTwoRect(e,t){let n=Math.max(e.left,t.left),r=Math.min(e.right,t.right),i=Math.max(e.top,t.top),a=Math.min(e.bottom,t.bottom);return r<=n||a<=i?null:{left:n,right:r,top:i,bottom:a,width:r-n,height:a-i}}static sort(e){return e.sort((e,t)=>e.startRow-t.startRow||e.startColumn-t.startColumn)}};v(U,`getRelativeRange`,(e,t)=>({startRow:e.startRow-t.startRow,endRow:e.endRow-e.startRow,startColumn:e.startColumn-t.startColumn,endColumn:e.endColumn-e.startColumn})),v(U,`getPositionRange`,(e,t,n)=>({...n||{},startRow:n&&[R.ROW,R.ALL].includes(n.startAbsoluteRefType||0)?n.startRow:e.startRow+t.startRow,endRow:n&&[R.ROW,R.ALL].includes(n.endAbsoluteRefType||0)?n.endRow:e.endRow+e.startRow+t.startRow,startColumn:n&&[R.COLUMN,R.ALL].includes(n.startAbsoluteRefType||0)?n.startColumn:e.startColumn+t.startColumn,endColumn:n&&[R.COLUMN,R.ALL].includes(n.endAbsoluteRefType||0)?n.endColumn:e.endColumn+e.startColumn+t.startColumn})),v(U,`moveHorizontal`,(e,t=0,n=0)=>({...e,startColumn:e.startColumn+t,endColumn:e.endColumn+t+n})),v(U,`moveVertical`,(e,t=0,n=0)=>({...e,startRow:e.startRow+t,endRow:e.endRow+t+n})),v(U,`moveOffset`,(e,t,n)=>{let r={...e};switch(e.startAbsoluteRefType){case R.ROW:r.startColumn+=t;break;case R.COLUMN:r.startRow+=n;break;case R.ALL:break;case R.NONE:default:r.startRow+=n,r.startColumn+=t;break}switch(e.endAbsoluteRefType){case R.ROW:r.endColumn+=t;break;case R.COLUMN:r.endRow+=n;break;case R.ALL:break;case R.NONE:default:r.endRow+=n,r.endColumn+=t;break}return r});function ja(e,t){if(e.length===0||e[0].length===0)return null;let n=Array(e[0].length).fill(0),r=0,i=null;for(let a=0;a<e.length;a++){for(let r=0;r<e[0].length;r++)n[r]=t(e[a][r])?n[r]+1:0;let o=Ma(n);o.area>r&&(r=o.area,i={startColumn:o.start,startRow:a-o.height+1,endColumn:o.end,endRow:a})}return i}function Ma(e){let t=[],n=0,r={area:0,height:0,start:0,end:0},i=0;for(;i<e.length;)if(t.length===0||e[i]>=e[t[t.length-1]])t.push(i++);else{let a=e[t.pop()],o=t.length===0?i:i-t[t.length-1]-1;a*o>n&&(n=a*o,r={area:n,height:a,start:t.length===0?0:t[t.length-1]+1,end:i-1})}for(;t.length>0;){let a=e[t.pop()],o=t.length===0?i:i-t[t.length-1]-1;a*o>n&&(n=a*o,r={area:n,height:a,start:t.length===0?0:t[t.length-1]+1,end:i-1})}return r}function Na(e,t){ya.foreach(t,(t,n)=>{e[t][n]=void 0})}function Pa(e,t){let n=e.toFullArray(),r=[];for(;;){let e=ja(n,t);if(!e)break;r.push(e),Na(n,e)}return r}var Fa=class{constructor(e,t){v(this,`_values`,[]),v(this,`_keys`,[]),v(this,`_keyMaps`,new Map),this._values=e,this._keys=t,e.forEach(e=>{this._initKeyMap(e)})}_initKeyMap(e){this._keys.forEach(t=>{let n=e[t],r=this._keyMaps.get(t)||new Map;r.set(n,e),this._keyMaps.set(t,r)})}getValue(e,t){let n=t||this._keys;for(let t=0;t<n.length;t++){let r=this._keyMaps.get(n[t]);if(r!=null&&r.has(e))return r.get(e)}return null}hasValue(e){for(let t=0;t<this._keys.length;t++){let n=this._keyMaps.get(this._keys[t]);if(n!=null&&n.has(e))return!0}return!1}addValue(e){this._values.push(e),this._initKeyMap(e)}setValue(e,t,n){let r=this.getValue(e);r&&Object.keys(r).includes(t)&&(r[t]=n)}deleteValue(e,t){let n=this.getValue(e,t);if(n){this._keys.forEach(e=>{let t=this._keyMaps.get(e),r=n[e];t==null||t.delete(r)});let e=this._values.findIndex(e=>e===n);this._values.splice(e,1)}}getValues(){return this._values}getKeyMap(e){var t;return[...((t=this._keyMaps.get(e))==null?void 0:t.keys())||[]]}clear(){this._values=[],this._keys=[],this._keyMaps.clear()}};function Ia(e,t,n,r){return{forEach(i){for(let a=e;a<=t;a++)for(let e=n;e<=r;e++)i(a,e)}}}function La(e){if(e==null||e.length===0)return NaN;let t=e.toLowerCase().split(``),n=t.length,r=e=>e.charCodeAt(0)-96,i=0,a=0;for(let e=0;e<n;e++)a=r(t[e]),i+=a*26**(n-e-1);return i===0?NaN:i-1}function Ra(e){let t=``;for(;e>=0;)t=String.fromCharCode(e%26+65)+t,e=Math.floor(e/26)-1;return t}function za(e,t){let n=``;for(;t>0;)n+=e,t--;return n}function Ba(e,t=!1){let n=97;return t&&(n=65),za(String.fromCharCode(e%26+n),Math.floor(e/26)+1)}function Va(e,t){return e.zIndex>t.zIndex?1:e.zIndex===t.zIndex?0:-1}function Ha(e,t){return e.zIndex>t.zIndex?-1:e.zIndex===t.zIndex?0:1}function Ua(e=`index`,t=1){return(n,r)=>n[e]>r[e]?t:n[e]===r[e]?0:-t}function Wa(e,t=!1){let n=[];for(let r of e){let{st:e,ed:i,ts:a}=r;if(r.sId===void 0&&delete r.sId,e===i||!t&&S.isEmptyObject(a)&&r.sId==null)continue;if(n.length===0){n.push(r);continue}let o=n.pop();Ii(r,o)&&S.hasIntersectionBetweenTwoRanges(o.st,o.ed,r.st,r.ed)?n.push({...r,st:o.st,ed:i}):n.push(o,r)}return n}function Ga(e,t,n,r){var i;let{textRuns:a}=e;if(a==null)return;let o=[],s=a.length,c=!1,l=(i=t.textRuns)==null?[]:i;if(l.length)for(let e of l)e.st+=r,e.ed+=r;for(let e=0;e<s;e++){let t=a[e],{st:i,ed:s}=t;if(s<=r)o.push(t);else if(r>i&&r<s){c=!0;let e={...t,ed:r};o.push(e),l.length&&o.push(...l);let i={...t,st:r+n,ed:s+n};o.push(i)}else t.st+=n,t.ed+=n,c||(c=!0,o.push(...l)),o.push(t)}c||(c=!0,o.push(...l)),e.textRuns=Wa(o)}function Ka(e,t,n,r){let{paragraphs:i}=e;if(i==null)return;let{paragraphs:a}=t,o=[],s=-1;for(let e=0,t=i.length;e<t;e++){let t=i[e],{startIndex:a}=t;a>=r&&(t.startIndex+=n),s===-1&&a>=r&&(s=e),o.push(t.startIndex)}let c=-1;if(a){for(let e=0,t=a.length;e<t;e++){let t=a[e];t.startIndex+=r;let n=t.startIndex;c=o.indexOf(n)}c!==-1&&i.splice(c,1),i.push(...a),i.sort(Ua(`startIndex`))}}function qa(e,t,n,r){let{sectionBreaks:i}=e;if(i==null)return;for(let e=0,t=i.length;e<t;e++){let t=i[e],{startIndex:a}=t;a>=r&&(t.startIndex+=n)}let a=t.sectionBreaks;if(a){for(let e=0,t=a.length;e<t;e++){let t=a[e];t.startIndex+=r}i.push(...a),i.sort(Ua(`startIndex`))}}function Ja(e,t,n,r){let{customBlocks:i=[]}=e;for(let e=0,t=i.length;e<t;e++){let t=i[e],{startIndex:a}=t;a>=r&&(t.startIndex+=n)}let a=t.customBlocks;if(a){for(let e=0,t=a.length;e<t;e++){let t=a[e];t.startIndex+=r}i.push(...a),i.sort(Ua(`startIndex`))}i.length&&!e.customBlocks&&(e.customBlocks=i)}function Ya(e,t,n,r){let{tables:i}=e;if(i==null)return;for(let e=0,t=i.length;e<t;e++){let t=i[e],{startIndex:a,endIndex:o}=t;a>r?(t.startIndex+=n,t.endIndex+=n):o>r&&(t.endIndex+=n)}let a=t.tables;if(a){for(let e=0,t=a.length;e<t;e++){let t=a[e];t.startIndex+=r,t.endIndex+=r}i.push(...a),i.sort(Ua(`startIndex`))}}const Xa=e=>e.split(`$`)[0];function Za(e){if(e.length<=1)return e;e.sort((e,t)=>e.startIndex-t.startIndex);let t=[],n={...e[0]};n.rangeId=Xa(n.rangeId);for(let r=1;r<e.length;r++){let i=e[r];i.rangeId=Xa(i.rangeId),i.rangeId===n.rangeId&&Le(n.properties,i.properties)&&n.endIndex+1>=i.startIndex?n.endIndex=i.endIndex:(t.push(n),n={...i})}t.push(n);let r=Object.create(null);for(let e=0,n=t.length;e<n;e++){let n=t[e],i=n.rangeId;r[i]?(n.rangeId=`${i}\$${r[i]}`,r[i]=r[i]+1):r[i]=1}return t}function Qa(e,t){let n=e.findIndex(e=>e.startIndex<t&&e.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 $a(e){if(e.length<=1)return e;e.sort((e,t)=>e.startIndex-t.startIndex);let t=[],n={...e[0]};for(let r=1;r<e.length;r++){let i=e[r];i.id===n.id&&n.endIndex+1>=i.startIndex?n.endIndex=i.endIndex:(t.push(n),n={...i})}return t.push(n),t}function eo(e,t){e.filter(e=>e.startIndex<t&&e.endIndex>=t).forEach(n=>{let r=e.indexOf(n);e.splice(r,1,{id:n.id,type:n.type,startIndex:n.startIndex,endIndex:t-1},{id:n.id,type:n.type,startIndex:t,endIndex:n.endIndex})})}function to(e,t,n,r){e.customRanges||(e.customRanges=[]);let{customRanges:i}=e;Qa(i,r);for(let e=0,t=i.length;e<t;e++){let t=i[e],{startIndex:a}=t;a>=r&&(t.startIndex+=n,t.endIndex+=n)}let a=[];if(t.customRanges){for(let e=0,n=t.customRanges.length;e<n;e++){let n=t.customRanges[e];n.startIndex+=r,n.endIndex+=r,a.push(n)}i.push(...a)}e.customRanges=Za(i)}function no(e,t,n,r){e.customDecorations||(e.customDecorations=[]);let{customDecorations:i}=e;eo(i,r);for(let e=0,t=i.length;e<t;e++){let t=i[e],{startIndex:a}=t;a>=r&&(t.startIndex+=n,t.endIndex+=n)}let a=[];if(t.customDecorations){for(let e=0,n=t.customDecorations.length;e<n;e++){let n=t.customDecorations[e];n.startIndex+=r,n.endIndex+=r,a.push(n)}i.push(...a)}e.customDecorations=$a(i)}function ro(e,t,n){let{textRuns:r}=e,i=n,a=n+t,o=[];if(r){let n=[];for(let e=0,s=r.length;e<s;e++){let s=r[e],{st:c,ed:l}=s;if(i<=c&&a>=l){o.push({...s,st:c-i,ed:l-i});continue}else c<=i&&l>=a?(o.push({...s,st:i-i,ed:a-i}),s.ed-=t):i>=c&&i<l?(o.push({...s,st:i-i,ed:l-i}),s.ed=i):a>c&&a<=l?(o.push({...s,st:c-i,ed:a-i}),s.st=a-t,s.ed-=t):c>=a&&(s.st-=t,s.ed-=t);n.push(s)}e.textRuns=n}return o.length===0&&o.push({st:0,ed:t,ts:{}}),o}function io(e,t,n){let{paragraphs:r}=e,i=n,a=n+t,o=[],s=null,c=!1;if(r){let l=[];for(let e=0,u=r.length;e<u;e++){let u=r[e],{startIndex:d}=u;if(d>=i&&d<a){o.push({...u,startIndex:d-n}),c=!0;continue}else d>=a&&(u.startIndex-=t);l.push(u),s==null&&c&&(s=u)}e.paragraphs=l}return o}function ao(e,t,n){let{sectionBreaks:r}=e,i=n,a=n+t-1,o=[];if(r){let s=[];for(let e=0,c=r.length;e<c;e++){let c=r[e],{startIndex:l}=c;if(l>=i&&l<=a){o.push({...c,startIndex:l-n});continue}else l>a&&(c.startIndex-=t);s.push(c)}e.sectionBreaks=s}return o}function oo(e,t,n){let{customBlocks:r=[]}=e,i=n,a=n+t-1,o=[];if(r){let s=[];for(let e=0,c=r.length;e<c;e++){let c=r[e],{startIndex:l}=c;if(l>=i&&l<=a){o.push({...c,startIndex:l-n});continue}else l>a&&(c.startIndex-=t);s.push(c)}e.customBlocks=s}return r.length&&!e.customBlocks&&(e.customBlocks=r),o}function so(e,t,n){let{tables:r}=e,i=n,a=n+t-1,o=[];if(r){let s=[];for(let e=0,c=r.length;e<c;e++){let c=r[e],{startIndex:l,endIndex:u}=c;if(i<=l&&a>=u){o.push({...c,startIndex:l-n,endIndex:u-n});continue}else if(l<=i&&u>=a){let e=Ri(l,u,i,a);if(e.length===0||(c.startIndex=e[0],c.endIndex=e[1],c.startIndex===c.endIndex))continue}else a<l&&(c.startIndex-=t,c.endIndex-=t);s.push(c)}e.tables=s}return o}function co(e,t,n){let{customRanges:r}=e,i=n,a=n+t-1,o=[];if(r){let n=[];for(let e=0,s=r.length;e<s;e++){let s=r[e],{startIndex:c,endIndex:l}=s;if(c>=i&&l<=a){o.push(s);continue}else if(Math.max(i,c)<=Math.min(a,l)){let e=Ri(c,l,i,a);if(e.length===0)continue;s.startIndex=e[0],s.endIndex=e[1]}else a<c&&(s.startIndex-=t,s.endIndex-=t);n.push(s)}e.customRanges=Za(n)}return o}function lo(e,t,n,r=!0){let{customDecorations:i}=e,a=n,o=n+t-1,s=[];if(i){let n=[];for(let e=0,c=i.length;e<c;e++){let c=i[e],{startIndex:l,endIndex:u}=c;if(l>=a&&u<=o){s.push(c);continue}else if(Math.max(a,l)<=Math.min(o,u)){let e=Ri(l,u,a,o);if(e.length===0)continue;c.startIndex=e[0],c.endIndex=e[1]}else o<l&&r&&(c.startIndex-=t,c.endIndex-=t);n.push(c)}e.customDecorations=n}return s}let W=function(e){return 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}({}),G=function(e){return 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}({});const uo={"a)":{glyphFormat:`%1)`,glyphType:O.DECIMAL},"1.":{glyphFormat:`%1.`,glyphType:O.DECIMAL},"a.":{glyphFormat:`%1.`,glyphType:O.LOWER_LETTER},"A.":{glyphFormat:`%1.`,glyphType:O.UPPER_LETTER},"i.":{glyphFormat:`%1.`,glyphType:O.LOWER_ROMAN},"I.":{glyphFormat:`%1.`,glyphType:O.UPPER_LETTER}},fo=e=>[...e,...e,...e].map((e,t)=>({glyphFormat:` %${t+1}`,glyphSymbol:e,bulletAlignment:vn.START,textStyle:{fs:12},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*t}}})),po=e=>e.map((e,t)=>({...e,bulletAlignment:vn.START,textStyle:{fs:12},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*t}}})),mo=(e,t)=>Array(9).fill(0).map((n,r)=>({glyphFormat:` %${r+1}`,glyphSymbol:e,bulletAlignment:vn.START,textStyle:{fs:16},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*r},textStyle:t}})),ho={[G.BULLET_LIST]:{listType:G.BULLET_LIST,nestingLevel:fo([`●`,`○`,`■`])},[G.BULLET_LIST_1]:{listType:G.BULLET_LIST,nestingLevel:fo([`❖`,`➢`,`■`])},[G.BULLET_LIST_2]:{listType:G.BULLET_LIST,nestingLevel:fo([`✔`,`●`,`◆`])},[G.BULLET_LIST_3]:{listType:G.BULLET_LIST,nestingLevel:fo([`■`,`◆`,`○`])},[G.BULLET_LIST_4]:{listType:G.BULLET_LIST,nestingLevel:fo([`✧`,`○`,`■`])},[G.BULLET_LIST_5]:{listType:G.BULLET_LIST,nestingLevel:fo([`➢`,`○`,`◆`])},[G.ORDER_LIST]:{listType:G.ORDER_LIST,nestingLevel:po([{glyphFormat:`%1.`,glyphType:O.DECIMAL},{glyphFormat:`%2.`,glyphType:O.LOWER_LETTER},{glyphFormat:`%3.`,glyphType:O.LOWER_ROMAN},{glyphFormat:`%4.`,glyphType:O.DECIMAL},{glyphFormat:`%5.`,glyphType:O.LOWER_LETTER},{glyphFormat:`%6.`,glyphType:O.LOWER_ROMAN},{glyphFormat:`%7.`,glyphType:O.DECIMAL},{glyphFormat:`%8.`,glyphType:O.LOWER_LETTER},{glyphFormat:`%9.`,glyphType:O.LOWER_ROMAN}])},[G.ORDER_LIST_1]:{listType:G.ORDER_LIST,nestingLevel:po([{glyphFormat:`%1)`,glyphType:O.DECIMAL},{glyphFormat:`%2)`,glyphType:O.LOWER_LETTER},{glyphFormat:`%3)`,glyphType:O.LOWER_ROMAN},{glyphFormat:`%4)`,glyphType:O.DECIMAL},{glyphFormat:`%5)`,glyphType:O.LOWER_LETTER},{glyphFormat:`%6)`,glyphType:O.LOWER_ROMAN},{glyphFormat:`%7)`,glyphType:O.DECIMAL},{glyphFormat:`%8)`,glyphType:O.LOWER_LETTER},{glyphFormat:`%9)`,glyphType:O.LOWER_ROMAN}])},[G.ORDER_LIST_2]:{listType:G.ORDER_LIST,nestingLevel:po([`%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:O.DECIMAL})))},[G.ORDER_LIST_3]:{listType:G.ORDER_LIST,nestingLevel:po([{glyphFormat:`%1.`,glyphType:O.UPPER_LETTER},{glyphFormat:`%2.`,glyphType:O.LOWER_LETTER},{glyphFormat:`%3.`,glyphType:O.LOWER_ROMAN},{glyphFormat:`%4.`,glyphType:O.UPPER_LETTER},{glyphFormat:`%5.`,glyphType:O.LOWER_LETTER},{glyphFormat:`%6.`,glyphType:O.LOWER_ROMAN},{glyphFormat:`%7.`,glyphType:O.UPPER_LETTER},{glyphFormat:`%8.`,glyphType:O.LOWER_LETTER},{glyphFormat:`%9.`,glyphType:O.LOWER_ROMAN}])},[G.ORDER_LIST_4]:{listType:G.ORDER_LIST,nestingLevel:po([{glyphFormat:`%1.`,glyphType:O.UPPER_LETTER},{glyphFormat:`%2.`,glyphType:O.DECIMAL},{glyphFormat:`%3.`,glyphType:O.LOWER_ROMAN},{glyphFormat:`%4.`,glyphType:O.UPPER_LETTER},{glyphFormat:`%5.`,glyphType:O.DECIMAL},{glyphFormat:`%6.`,glyphType:O.LOWER_ROMAN},{glyphFormat:`%7.`,glyphType:O.UPPER_LETTER},{glyphFormat:`%8.`,glyphType:O.DECIMAL},{glyphFormat:`%9.`,glyphType:O.LOWER_ROMAN}])},[G.ORDER_LIST_5]:{listType:G.ORDER_LIST,nestingLevel:po([{glyphFormat:`%1.`,glyphType:O.DECIMAL_ZERO},{glyphFormat:`%2.`,glyphType:O.LOWER_LETTER},{glyphFormat:`%3.`,glyphType:O.LOWER_ROMAN},{glyphFormat:`%4.`,glyphType:O.DECIMAL_ZERO},{glyphFormat:`%5.`,glyphType:O.LOWER_LETTER},{glyphFormat:`%6.`,glyphType:O.LOWER_ROMAN},{glyphFormat:`%7.`,glyphType:O.DECIMAL_ZERO},{glyphFormat:`%8.`,glyphType:O.LOWER_LETTER},{glyphFormat:`%9.`,glyphType:O.LOWER_ROMAN}])},[G.CHECK_LIST]:{listType:G.CHECK_LIST,nestingLevel:mo(`☐`)},[G.CHECK_LIST_CHECKED]:{listType:G.CHECK_LIST_CHECKED,nestingLevel:mo(`☑`,{st:{s:E.TRUE}})}},go=e=>{let{glyphFormat:t,glyphType:n}=e,r=S.deepClone(ho[G.ORDER_LIST]);return r.nestingLevel[0].glyphFormat=t,r.nestingLevel[0].glyphType=n,r},_o={[G.ORDER_LIST_QUICK_2]:go(uo[W.ORDER_LIST_QUICK_2]),[G.ORDER_LIST_QUICK_3]:go(uo[W.ORDER_LIST_QUICK_3]),[G.ORDER_LIST_QUICK_4]:go(uo[W.ORDER_LIST_QUICK_4]),[G.ORDER_LIST_QUICK_6]:go(uo[W.ORDER_LIST_QUICK_6])};Object.assign(ho,_o);const vo={[W.ORDER_LIST_QUICK_1]:G.ORDER_LIST,[W.ORDER_LIST_QUICK_2]:G.ORDER_LIST_QUICK_2,[W.ORDER_LIST_QUICK_3]:G.ORDER_LIST_QUICK_3,[W.ORDER_LIST_QUICK_4]:G.ORDER_LIST_QUICK_4,[W.ORDER_LIST_QUICK_5]:G.ORDER_LIST_3,[W.ORDER_LIST_QUICK_6]:G.ORDER_LIST_QUICK_6,[W.ORDER_LIST_QUICK_7]:G.ORDER_LIST_5,[W.BULLET_LIST]:G.BULLET_LIST};function yo(e,t,n,r,i){return{dataStream:``,textRuns:bo(e,t,n,r,i),paragraphs:So(e,t,n,r,i),sectionBreaks:Co(e,t,n,r,i),customBlocks:wo(e,t,n,r,i),tables:To(e,t,n,r,i),customRanges:Eo(e,t,n,r,i),customDecorations:Do(e,t,n,r,i)}}function bo(e,t,n,r,i){let{textRuns:a}=e,{textRuns:o}=t;if(a==null||o==null)return;let s=ro(e,n,r);return i!==j.REPLACE&&(t.textRuns=xo(o,s,i)),Ga(e,t,n,r),s}function xo(e,t,n){if(t.length===0)return e;e=S.deepClone(e),t=S.deepClone(t);let r=[],i=e.length,a=t.length,o=0,s=0,c=null;function l(){return c?(r.push(c),c=null,!0):!1}for(;o<i&&s<a;){let{st:i,ed:a,ts:u}=e[o],{st:d,ed:f,ts:p,sId:m}=t[s],h;if(h=n===j.COVER?{...p,...u}:{...u},a<d)l()||r.push(e[o]),o++;else if(f<i)l()||r.push(t[s]),s++;else{let n={st:Math.min(i,d),ed:Math.max(i,d),ts:i<d?{...u}:{...p},sId:i<d?void 0:m};n.ed>n.st&&r.push(n),r.push({st:Math.max(i,d),ed:Math.min(a,f),ts:h,sId:m}),a<f?(o++,t[s].st=a,t[s].st===t[s].ed&&s++):(s++,e[o].st=f,e[o].st===e[o].ed&&o++);let l={st:Math.min(a,f),ed:Math.max(a,f),ts:a<f?{...p}:{...u},sId:a<f?m:void 0};c=l.ed>l.st?l:null}}l();let u=r[r.length-1],d=e[i-1],f=t[a-1];return u&&u.ed!==Math.max(d.ed,f.ed)&&(d.ed>f.ed?r.push(d):r.push(f)),Wa(r)}function So(e,t,n,r,i){let{paragraphs:a}=e,{paragraphs:o}=t;if(a==null||o==null)return;let s=io(e,n,r);if(i!==j.REPLACE){let e=[];for(let t of o){let{startIndex:n,paragraphStyle:r,bullet:a}=t,o=[];for(let e of s){let{startIndex:t,paragraphStyle:s,bullet:c}=e,l,u;if(i===j.COVER?(l={...s,...r},u={listId:``,listType:G.BULLET_LIST,nestingLevel:0,textStyle:{},...c,...a}):(l={...r,...s},u={listId:``,listType:G.BULLET_LIST,nestingLevel:0,textStyle:{},...a,...c}),n===t){o.push({startIndex:n,paragraphStyle:l,bullet:u});break}}e.push(...o),o=[]}t.paragraphs=e}return Ka(e,t,n,r),s}function Co(e,t,n,r,i){let{sectionBreaks:a}=e,{sectionBreaks:o}=t;if(a==null||o==null)return;let s=ao(e,n,r);if(i!==j.REPLACE){let e=[];for(let t of o){let{startIndex:n}=t,r=[];for(let e of s){let{startIndex:a}=e;if(n===a){i===j.COVER?r.push({...e,...t}):r.push({...t,...e});break}}e.push(...r),r=[]}t.sectionBreaks=e}return qa(e,t,n,r),s}function wo(e,t,n,r,i){let{customBlocks:a=[]}=e,{customBlocks:o}=t;if(a==null||o==null)return;let s=oo(e,n,r);if(i!==j.REPLACE){let e=[];for(let t of o){let{startIndex:n}=t,r=[];for(let e of s){let{startIndex:a}=e;if(n===a){i===j.COVER?r.push({...e,...t}):r.push({...t,...e});break}}e.push(...r),r=[]}t.customBlocks=e}return Ja(e,t,n,r),a.length&&!e.customBlocks&&(e.customBlocks=a),s}function To(e,t,n,r,i){let{tables:a}=e,{tables:o}=t;if(a==null||o==null)return;let s=so(e,n,r);if(i!==j.REPLACE){let e=[];for(let t of o){let{startIndex:n,endIndex:r}=t,a=[];for(let e of s){let{startIndex:o,endIndex:s}=e;if(o>=n&&s<=r){i===j.COVER?a.push({...e,...t}):a.push({...t,...e});break}}e.push(...a),a=[]}t.tables=e}return Ya(e,t,n,r),s}function Eo(e,t,n,r,i){e.customRanges||(e.customRanges=[]),Qa(e.customRanges,r),Qa(e.customRanges,r+n);let a=r,o=r+n-1,{customRanges:s}=t,c=[],l=new Map;return e.customRanges.forEach(e=>{let{startIndex:t,endIndex:n}=e;t>=a&&n<=o?l.set(e.rangeId,e):c.push(e)}),s?(s.forEach(e=>{let{startIndex:t,endIndex:n}=e;c.push({...e,startIndex:t+r,endIndex:n+r})}),e.customRanges=Za(c),[]):[]}function Do(e,t,n,r,i){e.customDecorations||(e.customDecorations=[]),eo(e.customDecorations,r),eo(e.customDecorations,r+n);let a=[],{customDecorations:o}=e,{customDecorations:s=[]}=t;if(i===j.REPLACE){for(let e=0;e<o.length;e++){let t=o[e],{startIndex:i,endIndex:s}=t;i>=r&&s<=r+n-1&&a.push(t)}s.forEach(e=>{let{startIndex:t,endIndex:n}=e;o.push({...e,startIndex:t+r,endIndex:n+r})})}else for(let e of s){let{id:t}=e;if(e.type===bn.DELETED){let e=o.filter(e=>e.id===t);e.length&&a.push(...e)}else o.push({...e,startIndex:e.startIndex+r,endIndex:e.endIndex+r})}for(let e of a){let{id:t}=e,n=o.findIndex(e=>e.id===t);n!==-1&&o.splice(n,1)}return e.customDecorations=$a(o),a}let Oo=function(e){return e[e.copy=0]=`copy`,e[e.cut=1]=`cut`,e}({});function ko(e,t,n,r=!0){let{textRuns:i}=e;if(i){let e=[];for(let r of i){let i=S.deepClone(r),{st:a,ed:o}=i;S.hasIntersectionBetweenTwoRanges(a,o,t,n)&&(t>=a&&t<=o?e.push({...i,st:t,ed:Math.min(n,o)}):n>=a&&n<=o?e.push({...i,st:Math.max(t,a),ed:n}):e.push(i))}return Wa(e.map(e=>{let{st:n,ed:r}=e;return{...e,st:n-t,ed:r-t}}))}else if(r)return[{st:0,ed:n-t,ts:{}}]}function Ao(e,t,n){let{tables:r=[]}=e,i=[];for(let e of r){let r=S.deepClone(e),{startIndex:a,endIndex:o}=r;a>=t&&o<=n&&i.push({...r,startIndex:a-t,endIndex:o-t})}return i}function jo(e,t,n){let{paragraphs:r=[]}=e,i=[];for(let e of r){let{startIndex:r}=e;if(r>=t&&r<n){let t=S.deepClone(e);i.push(t)}}if(i.length)return i.map(e=>({...e,startIndex:e.startIndex-t}))}function Mo(e,t,n){let{sectionBreaks:r=[]}=e,i=[];for(let e of r){let{startIndex:r}=e;r>=t&&r<=n&&i.push(S.deepClone(e))}if(i.length)return i.map(e=>({...e,startIndex:e.startIndex-t}))}function No(e,t,n){let{customBlocks:r=[]}=e,i=[];for(let e of r){let{startIndex:r}=e;r>=t&&r<n&&i.push(S.deepClone(e))}if(i.length)return i.map(e=>({...e,startIndex:e.startIndex-t}))}function K(e,t,n,r=!0,i=Oo.cut){let{dataStream:a}=e,o={dataStream:a.slice(t,n)};o.textRuns=ko(e,t,n,r);let s=Ao(e,t,n);if(s.length&&(o.tables=s),o.paragraphs=jo(e,t,n),i===Oo.cut){let i=Io(e,t,n);i?o.customDecorations=i:r&&(o.customDecorations=[])}let{customRanges:c}=Fo(e,t,n);return c?o.customRanges=c:r&&(o.customRanges=[]),o.customBlocks=No(e,t,n),o}function Po(e){let{dataStream:t,textRuns:n,paragraphs:r,customRanges:i,customDecorations:a,tables:o}=e,s=0,c=0;i==null||i.forEach(e=>{e.startIndex<0&&(s=Math.max(s,-e.startIndex)),e.endIndex>t.length-1&&(c=Math.max(c,e.endIndex-t.length+1))});let l=`${t}`;return n&&(n[0]&&(n[0].st=n[0].st-s),n[n.length-1]&&(n[n.length-1].ed=n[n.length-1].ed+c)),n==null||n.forEach(e=>{e.st+=s,e.ed+=s}),r==null||r.forEach(e=>{e.startIndex+=s}),i==null||i.forEach(e=>{e.startIndex+=s,e.endIndex+=s}),a==null||a.forEach(e=>{e.startIndex+=s,e.endIndex+=c}),o==null||o.forEach(e=>{e.startIndex+=s,e.endIndex+=c}),{...e,dataStream:l,textRuns:n,paragraphs:r,customRanges:i,customDecorations:a,tables:o}}function Fo(e,t,n){if(e.customRanges==null)return{};let{customRanges:r}=e;return{customRanges:r.filter(e=>Math.max(e.startIndex,t)<=Math.min(e.endIndex,n-1)).map(e=>({...e,startIndex:Math.max(e.startIndex,t),endIndex:Math.min(e.endIndex,n-1)})).map(e=>({...e,startIndex:e.startIndex-t,endIndex:e.endIndex-t})),leftOffset:0,rightOffset:0}}function Io(e,t,n){if(e.customDecorations==null)return;let{customDecorations:r=[]}=e,i=[];return r.forEach(e=>{if(Math.max(e.startIndex,t)<=Math.min(e.endIndex,n-1)){let r=S.deepClone(e);i.push({...r,startIndex:Math.max(r.startIndex-t,0),endIndex:Math.min(r.endIndex,n-1)-t})}}),i}function Lo(e,t,n){return e==null||t==null?e==null?t:e:xo(e,t,n)}function Ro(e,t,n){if(e==null||t==null)return e==null?t:e;if(t.length===0||e.length===0)return e;if(t.length>1||e.length>1)throw Error(`Cannot cover multiple customRanges`);return n===j.REPLACE?[{...e[0]}]:[{...t[0],...e[0]}]}function zo(e,t,n){return t.length===0||e.length===0||n===j.REPLACE?e:[...e,...t.filter(t=>!e.some(e=>t.id===e.id))]}function Bo(e,t,n=j.COVER){if(t.dataStream!==``)throw Error(`Cannot compose other body with non-empty dataStream`);let r={dataStream:e.dataStream},{textRuns:i,paragraphs:a=[],customRanges:o,customDecorations:s=[]}=e,{textRuns:c,paragraphs:l=[],customRanges:u,customDecorations:d=[]}=t;r.textRuns=Lo(c,i,n),r.customRanges=Ro(u,o,n);let f=zo(d,s,n);f.length&&(r.customDecorations=f);let p=[],m=0,h=0;for(;m<a.length&&h<l.length;){let e=a[m],t=l[h],{startIndex:n}=e,{startIndex:r}=t;n===r?(p.push(S.deepMerge(e,t)),m++,h++):n<r?(p.push(S.deepClone(e)),m++):(p.push(S.deepClone(t)),h++)}return m<a.length&&p.push(...a.slice(m)),h<l.length&&p.push(...l.slice(h)),p.length&&(r.paragraphs=p),r}function Vo(e){let{body:t}=e;if(t==null)return!0;let{textRuns:n,paragraphs:r,customRanges:i,customBlocks:a,customDecorations:o,tables:s}=t;return n==null&&r==null&&i==null&&a==null&&o==null&&s==null}var Ho=class{constructor(e){this._actions=e,v(this,`_index`,0),v(this,`_offset`,0)}hasNext(){return this.peekLength()<1/0}next(e){e||(e=1/0);let t=this._actions[this._index];if(t){let n=this._offset,r=t.len;return e>=r-n?(e=r-n,this._index+=1,this._offset=0):this._offset+=e,t.t===M.DELETE||t.t===M.RETAIN&&t.body==null?S.deepClone({...t,len:e}):S.deepClone({...t,len:e,body:K(t.body,n,n+e,!1)})}else return{t:M.RETAIN,len:1/0}}peek(){return this._actions[this._index]}peekLength(){return this._actions[this._index]?this._actions[this._index].len-this._offset:1/0}peekType(){let e=this._actions[this._index];return e?e.t:M.RETAIN}rest(){if(!this.hasNext())return[];if(this._offset===0)return this._actions.slice(this._index);{let e=this._offset,t=this._index,n=this.next(),r=this._actions.slice(this._index);return this._offset=e,this._index=t,[n].concat(r)}}};function Uo(e,t,n){let{dataStream:r}=e,i=n,a=n+t,o=ro(e,t,n),s=io(e,t,n),c=ao(e,t,n),l=oo(e,t,n),u=so(e,t,n),d=co(e,t,n),f=lo(e,t,n),p=``;return r&&(e.dataStream=Ui(r,i,a),p=r.slice(i,a)),{dataStream:p,textRuns:o,paragraphs:s,sectionBreaks:c,customBlocks:l,tables:u,customRanges:d,customDecorations:f}}function Wo(e,t,n,r){e.dataStream=Hi(e.dataStream,r,t.dataStream),Ga(e,t,n,r),Ka(e,t,n,r),qa(e,t,n,r),Ja(e,t,n,r),Ya(e,t,n,r),to(e,t,n,r),no(e,t,n,r)}function Go(e,t,n,r,i=j.COVER){return yo(e,t,n,r,i)}function Ko(e,t,n){return t<=0?{dataStream:``}:Uo(e,t,n)}function qo(e,t,n,r){n!==0&&Wo(e,t,n,r)}function Jo(e,t){let n=new dt;return n.reset(),t.forEach(t=>{let r=S.deepClone(t);switch(r.t){case M.RETAIN:{let{coverType:t,body:i,len:a}=r;i!=null&&Go(e,i,a,n.cursor,t),n.moveCursor(a);break}case M.INSERT:{let{body:t,len:i}=r;qo(e,t,i,n.cursor),n.moveCursor(i);break}case M.DELETE:{let{len:t}=r;Ko(e,t,n.cursor);break}default:throw Error(`Unknown action type for action: ${r}.`)}}),e}var q=function(e){return e[e.COVER=0]=`COVER`,e[e.COVER_ONLY_NOT_EXISTED=1]=`COVER_ONLY_NOT_EXISTED`,e}(q||{});function Yo(e,t,n,r,i){if(e==null||t==null)return t;if(e.length===0||t.length===0)return[];t=S.deepClone(t),e=S.deepClone(e);let a=[],o=t.length,s=e.length,c=0,l=0,u=null;function d(){return u?(a.push(u),u=null,!0):!1}for(;c<o&&l<s;){let{st:o,ed:s,ts:f}=t[c],{st:p,ed:m,ts:h,sId:g}=e[l],_={};if(i===q.COVER)_={...f},n===j.COVER&&r===j.REPLACE&&h&&(_=Object.assign({},h,_));else if(_={...f},n===j.REPLACE){if(r===j.REPLACE)_={...h};else if(f&&h){let e=Object.keys(f);for(let t of e)h[t]&&delete _[t]}}else if(r===j.REPLACE){if(h){let e=Object.keys(h);for(let t of e)h[t]!==void 0&&(_[t]=h[t])}}else if(h){let e=Object.keys(h);for(let t of e)_[t]!==void 0&&delete _[t]}if(s<p)d()||a.push(t[c]),c++;else if(m<o)d()||a.push(e[l]),l++;else{let n={st:Math.min(o,p),ed:Math.max(o,p),ts:o<p?{...f}:{...h},sId:o<p?void 0:g};n.ed>n.st&&a.push(),a.push({st:Math.max(o,p),ed:Math.min(s,m),ts:_,sId:g}),s<m?(c++,e[l].st=s,e[l].st===e[l].ed&&l++):(l++,t[c].st=m,t[c].st===t[c].ed&&c++);let r={st:Math.min(s,m),ed:Math.max(s,m),ts:s<m?{...h}:{...f},sId:s<m?g:void 0};u=r.ed>r.st?r:null}}d();let f=a[a.length-1],p=t[o-1],m=e[s-1];return f.ed!==Math.max(p.ed,m.ed)&&(p.ed>m.ed?a.push(p):a.push(m)),Wa(a,!0)}function Xo(e,t,n,r,i){if(e==null||t==null)return t;if(e.length===0||t.length===0)return[];if(e.length>1||t.length>1)throw Error(`CustomRanges is only supported transform for length one now.`);let a=e[0],o=t[0];if(n===j.REPLACE)return i===q.COVER_ONLY_NOT_EXISTED?[S.deepClone(a)]:[S.deepClone(o)];if(r===j.REPLACE){let e=S.deepClone(o);return i===q.COVER_ONLY_NOT_EXISTED&&Object.assign(e,S.deepClone(a)),[e]}else{let e=S.deepClone(o);return i===q.COVER_ONLY_NOT_EXISTED&&Object.assign(e,S.deepClone(a)),[e]}}function Zo(e,t,n,r,i){let a={startIndex:t.startIndex};if(t.paragraphStyle&&(a.paragraphStyle=S.deepClone(t.paragraphStyle),e.paragraphStyle)){if(n===j.REPLACE)if(r===j.REPLACE)i===q.COVER_ONLY_NOT_EXISTED&&(a.paragraphStyle={...e.paragraphStyle});else if(i===q.COVER_ONLY_NOT_EXISTED){let t=Object.keys(e.paragraphStyle);for(let n of t)e.paragraphStyle[n]!==void 0&&(a.paragraphStyle[n]=e.paragraphStyle[n])}else{let t=Object.keys(e.paragraphStyle);for(let n of t)a.paragraphStyle[n]===void 0&&(a.paragraphStyle[n]=e.paragraphStyle[n])}else if(r===j.REPLACE)if(i===q.COVER_ONLY_NOT_EXISTED){let t=Object.keys(e.paragraphStyle);for(let n of t)e.paragraphStyle[n]!==void 0&&(a.paragraphStyle[n]=e.paragraphStyle[n])}else{let t=Object.keys(e.paragraphStyle);for(let n of t)a.paragraphStyle[n]===void 0&&(a.paragraphStyle[n]=e.paragraphStyle[n])}else if(i===q.COVER_ONLY_NOT_EXISTED){let t=Object.keys(e.paragraphStyle);for(let e of t)a.paragraphStyle[e]&&delete a.paragraphStyle[e]}}return n===j.REPLACE&&r===j.REPLACE?a.bullet=i===q.COVER_ONLY_NOT_EXISTED?S.deepClone(e.bullet):S.deepClone(t.bullet):e.bullet===void 0?a.bullet=S.deepClone(t.bullet):n===j.REPLACE||r===j.REPLACE?a.bullet=i===q.COVER&&t.bullet?S.deepClone(t.bullet):S.deepClone(e.bullet):i===q.COVER&&t.bullet!==void 0&&(a.bullet=S.deepClone(t.bullet)),a}function Qo(e,t){if(e==null||t==null)return t;if(e.length===0||t.length===0)return S.deepClone(t);let n=[];for(let r of t){let{id:t,type:i}=r,a=!1;for(let o of e)if(o.id===t){(o.type===bn.DELETED||i===bn.DELETED)&&(a=!0,n.push({...r,type:bn.DELETED}));break}a||n.push(r)}return n}function $o(e,t,n=!1){let{body:r,coverType:i=j.COVER}=e,{body:a,coverType:o=j.COVER}=t;if(r==null||r.dataStream!==``||a==null||a.dataStream!==``)throw Error(`Data stream is not supported in retain transform.`);let s={dataStream:``},c=o,{textRuns:l,paragraphs:u=[],customRanges:d,customDecorations:f}=r,{textRuns:p,paragraphs:m=[],customRanges:h,customDecorations:g}=a,_=Yo(l,p,i,o,n?q.COVER_ONLY_NOT_EXISTED:q.COVER);_&&(s.textRuns=_);let ee=Xo(d,h,i,o,n?q.COVER_ONLY_NOT_EXISTED:q.COVER);ee&&(s.customRanges=ee);let te=Qo(f,g);te&&(s.customDecorations=te);let ne=[],re=0,ie=0;for(;re<u.length&&ie<m.length;){let e=u[re],t=m[ie],{startIndex:r}=e,{startIndex:a}=t;if(r===a){let a={startIndex:r};a=n?Zo(e,t,i,o,q.COVER_ONLY_NOT_EXISTED):Zo(e,t,i,o,q.COVER),ne.push(a),re++,ie++}else r<a?re++:(ne.push(S.deepClone(t)),ie++)}return ie<m.length&&ne.push(...m.slice(ie)),ne.length&&(s.paragraphs=ne),{coverType:c,body:s}}function es(e){return Object.keys(e).length===1}var J=class e{constructor(){v(this,`_actions`,[])}static apply(e,t){return Jo(e,t)}static compose(t,n){let r=new Ho(t),i=new Ho(n),a=new e;for(;r.hasNext()||i.hasNext();)if(i.peekType()===M.INSERT)a.push(i.next());else if(r.peekType()===M.DELETE)a.push(r.next());else{let e=Math.min(r.peekLength(),i.peekLength()),t=r.next(e),n=i.next(e);if(t.t===M.INSERT&&n.t===M.RETAIN)n.body==null?a.push(t):a.push({...t,body:Bo(t.body,n.body,n.coverType)});else if(t.t===M.RETAIN&&n.t===M.RETAIN)if(t.body==null&&n.body==null)a.push(t.len===1/0?n:t);else if(t.body&&n.body){let e=t.coverType===j.REPLACE||n.coverType===j.REPLACE?j.REPLACE:j.COVER;a.push({...t,t:M.RETAIN,coverType:e,body:Bo(t.body,n.body,n.coverType)})}else a.push(t.body?t:n);else t.t===M.RETAIN&&n.t===M.DELETE?a.push(n):t.t===M.INSERT&&(n.t,M.DELETE)}return a.trimEndUselessRetainAction(),a.serialize()}static transform(e,t,n=`right`){return this._transform(t,e,n===`left`?`right`:`left`)}static _transform(t,n,r=`right`){let i=new Ho(t),a=new Ho(n),o=new e;for(;i.hasNext()||a.hasNext();)if(i.peekType()===M.INSERT&&(r===`left`||a.peekType()!==M.INSERT)){let e=i.next();o.retain(e.len)}else if(a.peekType()===M.INSERT)o.push(a.next());else{let e=Math.min(i.peekLength(),a.peekLength()),t=i.next(e),n=a.next(e);if(t.t===M.DELETE)continue;if(n.t===M.DELETE){o.push(n);continue}if(t.body==null||n.body==null)o.push(n);else{let{coverType:e,body:i}=$o(t,n,r===`left`);o.push({...n,t:M.RETAIN,coverType:e,body:i})}}return o.trimEndUselessRetainAction(),o.serialize()}static transformPosition(e,t,n=!1){let r=new Ho(e),i=0;for(;r.hasNext()&&i<=t;){let e=r.peekLength(),a=r.peekType();if(r.next(),a===M.DELETE){t-=Math.min(e,t-i);continue}else a===M.INSERT&&(i<t||!n)&&(t+=e);i+=e}return t}static isNoop(e){return e.length===0}static invert(e){let t=[];for(let n of e)if(n.t===M.INSERT)t.push({t:M.DELETE,len:n.len,body:n.body});else if(n.t===M.DELETE){if(n.body==null)throw Error(`Can not invert DELETE action without body property, makeInvertible must be called first.`);t.push({t:M.INSERT,body:n.body,len:n.len})}else if(n.body!=null){if(n.oldBody==null)throw Error(`Can not invert RETAIN action without oldBody property, makeInvertible must be called first.`);t.push({t:M.RETAIN,body:n.oldBody,oldBody:n.body,len:n.len,coverType:j.REPLACE})}else t.push(n);return t}static makeInvertible(e,t){let n=[],r=0;for(let i of e){if(i.t===M.DELETE&&(i.body==null||i.body&&i.body.dataStream.length!==i.len)){let e=K(t,r,r+i.len,!1);i.len=e.dataStream.length,i.body=e}if(i.t===M.RETAIN&&i.body!=null){let e=K(t,r,r+i.len,!0);i.oldBody={...e,dataStream:``},i.len=e.dataStream.length}n.push(i),i.t!==M.INSERT&&(r+=i.len)}return n}insert(e,t){let n={t:M.INSERT,body:t,len:e};return this.push(n),this}retain(e,t,n){let r={t:M.RETAIN,len:e};return t!=null&&(r.body=t),n!=null&&(r.coverType=n),this.push(r),this}delete(e){let t={t:M.DELETE,len:e};return this.push(t),this}empty(){return this._actions=[],this}serialize(){return this._actions}push(...e){if(e.length>1){for(let t of e)this.push(t);return this}let t=this._actions.length,n=this._actions[t-1],r=S.deepClone(e[0]);if(r.t===M.RETAIN&&r.len===0&&r.body==null)return this;if(typeof n==`object`){if(n.t===M.DELETE&&r.t===M.DELETE)return n.len+=r.len,this;if(n.t===M.DELETE&&r.t===M.INSERT&&(--t,n=this._actions[t-1],n==null))return this._actions.unshift(r),this;if(n.t===M.RETAIN&&r.t===M.RETAIN&&n.body==null&&r.body==null)return n.len+=r.len,this;if(n.t===M.INSERT&&es(n.body)&&r.t===M.INSERT&&es(r.body))return n.len+=r.len,n.body.dataStream+=r.body.dataStream,this}return t===this._actions.length?this._actions.push(r):this._actions.splice(t,0,r),this}trimEndUselessRetainAction(){let e=this._actions[this._actions.length-1];for(;e&&e.t===M.RETAIN&&Vo(e);)this._actions.pop(),e=this._actions[this._actions.length-1];return this}};v(J,`id`,`text-x`),v(J,`uri`,`https://github.com/dream-num/univer#text-x`),Object.defineProperty(J,`name`,{value:`text-x`});var Y=class e{static registerSubtype(e){var t;e==null||this._subTypes.has(e.name)&&((t=this._subTypes.get(e.name))==null?void 0:t.id)!==J.id||(this._subTypes.set(e.name,e),m.type.registerSubtype(e))}static apply(e,t){if(!m.type.isNoop(t))return m.type.apply(e,t)}static compose(e,t){return m.type.compose(e,t)}static transform(e,t,n){return m.type.transform(e,t,n)}static transformPosition(e,t,n=`right`){return e&&e.length===2&&e[0]===`body`&&e[1].et===J.name?J.transformPosition(e[1].e,t,n===`left`):t}static invertWithDoc(e,t){return m.type.invertWithDoc(e,t)}static isNoop(e){return m.type.isNoop(e)}static getInstance(){return this._instance==null&&(this._instance=new e),this._instance}removeOp(e,t){return m.removeOp(e,t)}moveOp(e,t){return m.moveOp(e,t)}insertOp(e,t){return m.insertOp(e,t)}replaceOp(e,t,n){return m.replaceOp(e,t,n)}editOp(e,t=[`body`]){return m.editOp(t,J.name,e)}};v(Y,`uri`,`https://github.com/dream-num/univer#json-x`),v(Y,`_subTypes`,new Map),v(Y,`_instance`,null),Y.registerSubtype(J);let ts=function(e){return 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}({}),X=function(e){return 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}({});function ns(e){return`${e}`}const rs=[X.TABLE_START,X.TABLE_ROW_START,X.TABLE_CELL_START,X.TABLE_CELL_END,X.TABLE_ROW_END,X.TABLE_END],is=e=>{let t=e.endsWith(`\r
5
- `)?e.slice(0,-2):e;return rs.reduce((e,t)=>e.replaceAll(t,``),t)},as=e=>e?is(e).replaceAll(`\r`,``)===``:!0,os=e=>{let t=e.replace(/\n/g,`\r`),n=[],r=[],i=0,a=``,o=(o,s=!0)=>{let c=t.slice(i,o);if(S.isLegalUrl(c)){let t=C(),l=`${c}`,u={startIndex:i,endIndex:i+l.length-1,rangeId:t,rangeType:yn.HYPERLINK,properties:{url:e}};r.push(u),a+=l,i=o+1,s&&(a+=`\r`,n.push({startIndex:o}))}else a+=t.slice(i,o+1),i=o+1,s&&n.push({startIndex:o})},s=0;for(let e=0;e<t.length;e++)t[e]===`\r`&&(o(e),s=e);return(s!==t.length-1||t.length===1)&&o(t.length,!1),{dataStream:a,paragraphs:n,customRanges:r}},ss={id:`default_doc`,documentStyle:{}};var cs=class extends Et{getUnitId(){throw Error(`Method not implemented.`)}constructor(e){var t;super(),v(this,`type`,f.UniverType.UNIVER_DOC),v(this,`_name$`,new d.BehaviorSubject(``)),v(this,`name$`,this._name$.asObservable()),v(this,`snapshot`,void 0),this.snapshot={...ss,...e},this._name$.next((t=this.snapshot.title)==null?`No Title`:t)}getRev(){var e;return(e=this.snapshot.rev)==null?1:e}incrementRev(){this.snapshot.rev=this.getRev()+1}setRev(e){this.snapshot.rev=e}setName(e){this.snapshot.title=e,this._name$.next(e)}get drawings(){return this.snapshot.drawings}get documentStyle(){return this.snapshot.documentStyle}get lists(){return this.snapshot.lists}get zoomRatio(){var e;return((e=this.snapshot.settings)==null?void 0:e.zoomRatio)||1}resetDrawing(e,t){this.snapshot.drawings=e,this.snapshot.drawingsOrder=t}getBody(){return this.snapshot.body}getSnapshot(){return this.snapshot}getBulletPresetList(){var e;let t=(e=this.snapshot.lists)==null?{}:e;return{...ho,...t}}updateDocumentId(e){this.snapshot.id=e}updateDocumentRenderConfig(e){let{documentStyle:t}=this.snapshot;t.renderConfig==null?t.renderConfig=e:t.renderConfig={...t.renderConfig,...e}}getDocumentStyle(){return this.snapshot.documentStyle}updateDocumentStyle(e){this.snapshot.documentStyle==null?this.snapshot.documentStyle=e:this.snapshot.documentStyle={...this.snapshot.documentStyle,...e}}updateDocumentDataMargin(e){let{t,l:n,b:r,r:i}=e,{documentStyle:a}=this.snapshot;t!=null&&(a.marginTop=t),n!=null&&(a.marginLeft=n),r!=null&&(a.marginBottom=r),i!=null&&(a.marginRight=i)}updateDocumentDataPageSize(e,t){let{documentStyle:n}=this.snapshot;if(!n.pageSize){n.pageSize={width:e==null?1/0:e,height:t==null?1/0:t};return}e!==void 0&&(n.pageSize.width=e),t!==void 0&&(n.pageSize.height=t)}updateDrawing(e,t){let{drawings:n}=this,{width:r,height:i,left:a,top:o}=t,s=n==null?void 0:n[e];if(!s)return;let c=s.docTransform;c.size.width=r,c.size.height=i,c.positionH.posOffset=a,c.positionV.posOffset=o}setZoomRatio(e=1){this.snapshot.settings?this.snapshot.settings.zoomRatio=e:this.snapshot.settings={zoomRatio:e}}setDisabled(e){this.snapshot.disabled=e}getDisabled(){return this.snapshot.disabled}getTitle(){return this.snapshot.title}},ls=class e extends cs{constructor(e){var t,n;super(S.isEmptyObject(e)?$n():e),v(this,`_unitId`,void 0),v(this,`headerModelMap`,new Map),v(this,`footerModelMap`,new Map),v(this,`change$`,new d.BehaviorSubject(0)),this._unitId=(t=this.snapshot.id)==null?C(6):t,this._initializeHeaderFooterModel(),this._name$.next((n=this.snapshot.title)==null?``:n)}dispose(){super.dispose(),this.headerModelMap.forEach(e=>{e.dispose()}),this.footerModelMap.forEach(e=>{e.dispose()}),this._name$.complete()}getDrawings(){return this.snapshot.drawings}getDrawingsOrder(){return this.snapshot.drawingsOrder}getCustomRanges(){var e;return(e=this.snapshot.body)==null?void 0:e.customRanges}getCustomDecorations(){var e;return(e=this.snapshot.body)==null?void 0:e.customDecorations}getSettings(){return this.snapshot.settings}reset(e){if(e.id&&e.id!==this._unitId)throw Error(`Cannot reset a document model with a different unit id!`);this.snapshot={...ss,...e},this._initializeHeaderFooterModel(),this.change$.next(this.change$.value+1)}getSelfOrHeaderFooterModel(e){if(e!=null){if(this.headerModelMap.has(e))return this.headerModelMap.get(e);if(this.footerModelMap.has(e))return this.footerModelMap.get(e)}return this}getUnitId(){return this._unitId}apply(e){if(!Y.isNoop(e))return this.snapshot=Y.apply(this.snapshot,e),e!=null&&e.some(e=>Array.isArray(e)&&((e==null?void 0:e[0])===`headers`||(e==null?void 0:e[0])===`footers`))&&(this.headerModelMap.clear(),this.footerModelMap.clear(),this._initializeHeaderFooterModel()),this.change$.next(this.change$.value+1),this.snapshot}sliceBody(e,t,n=Oo.copy){let r=this.getBody();if(r!=null)return K(r,e,t,!1,n)}_initializeHeaderFooterModel(){let{headers:t,footers:n}=this.getSnapshot();if(t)for(let n in t){let r=t[n];this.headerModelMap.set(n,new e(r)),this.headerModelMap.get(n).updateDocumentId(this.getUnitId())}if(n)for(let t in n){let r=n[t];this.footerModelMap.set(t,new e(r)),this.footerModelMap.get(t).updateDocumentId(this.getUnitId())}}updateDocumentId(e){super.updateDocumentId(e),this._unitId=e}getPlainText(){var e,t;return is((e=(t=this.getBody())==null?void 0:t.dataStream)==null?``:e)}};function us(e){let{ranges:t,id:n,type:r}=e,i=new J,a=0;for(let e=0;e<t.length;e++){let{startOffset:o,endOffset:s}=t[e];o>0&&i.push({t:M.RETAIN,len:o-a}),i.push({t:M.RETAIN,body:{dataStream:``,customDecorations:[{id:n,type:r,startIndex:0,endIndex:s-o-1}]},len:s-o}),a=s}return i}function ds(e){var t;let{id:n,segmentId:r,documentDataModel:i}=e,a=i==null?void 0:i.getBody();if(!i||!a)return!1;let o=(t=i.getSelfOrHeaderFooterModel(r))==null||(t=t.getBody())==null||(t=t.customDecorations)==null?void 0:t.find(e=>e.id===n);if(!o)return!1;let s=new J,{startIndex:c,endIndex:l}=o,u=l-c+1;return s.push({t:M.RETAIN,len:c}),s.push({t:M.RETAIN,len:u,body:{dataStream:``,customDecorations:[{startIndex:0,endIndex:u-1,id:n,type:bn.DELETED}]}}),s}function fs(e,t,n,r){return e<=n&&t>=n||e>=n&&e<=r}function ps(e,t){let n=[];for(let r=0,i=t.length;r<i;r++){let i=t[r];e.collapsed?i.startIndex<e.startOffset&&e.startOffset<=i.endIndex&&n.push(i):fs(e.startOffset,e.endOffset-1,i.startIndex,i.endIndex)&&n.push(i)}return n}function ms(e){return{...S.deepClone(e),rangeId:C()}}function hs(e,t){let n=[],r=e[0];for(let i of t)i<e[0]||i>e[1]||(r<i&&n.push([r,i-1]),r=i+1);return r<=e[1]&&n.push([r,e[1]]),n}function gs(e,t,n,r){let i=[];for(let a=0,o=n.length;a<o;a++){let o=n[a];if((r===void 0||o.rangeType===r)&&Math.max(o.startIndex,e)<=Math.min(o.endIndex,t)&&i.push({...o}),o.startIndex>t)break}return i}function _s(e,t){var n,r,i,a,o;let s=gs(e.startOffset,e.collapsed?e.startOffset:e.endOffset-1,(n=t.customRanges)==null?[]:n),c=Math.min(e.startOffset,(r=(i=s[0])==null?void 0:i.startIndex)==null?1/0:r),l=Math.max(e.endOffset,((a=(o=s[s.length-1])==null?void 0:o.endIndex)==null?-1/0:a)+1);return{startOffset:c,endOffset:l,collapsed:c===l}}function vs(e){var t,n;let{rangeId:r,segmentId:i,documentDataModel:a,insert:o}=e,s=(t=a.getSelfOrHeaderFooterModel(i).getBody())==null||(t=t.customRanges)==null?void 0:t.find(e=>e.rangeId===r);if(!s)return!1;let{startIndex:c,endIndex:l}=s,u=new J,d=l-c+1;u.push({t:M.RETAIN,len:c}),u.push({t:M.RETAIN,len:d,body:{dataStream:``,customRanges:[]}}),o&&u.push({t:M.INSERT,body:o,len:o.dataStream.length});let f=l+1+((n=o==null?void 0:o.dataStream.length)==null?0:n);return u.selections=[{startOffset:f,endOffset:f,collapsed:!0}],u}function ys(e){let{ranges:t,rangeId:n,rangeType:r,wholeEntity:i,properties:a,body:o}=e,s=0,c=new J,l=!1;return t.forEach(e=>{var t,u,d;let f=_s(e,o);if(!f||!o)return!1;let{startOffset:p,endOffset:m}=f,h=(t=o.customRanges)==null?[]:t,g=(e,t,o)=>{var l,u,d,f;let p=gs(e,t,h,r),m=Math.min((l=(u=p[0])==null?void 0:u.startIndex)==null?1/0:l,e),g=Math.max((d=(f=p[p.length-1])==null?void 0:f.endIndex)==null?-1/0:d,t),_={rangeId:o?`${n}$${o}`:n,rangeType:r,startIndex:0,endIndex:g-m,wholeEntity:i,properties:{...a}};c.push({t:M.RETAIN,len:m-s}),c.push({t:M.RETAIN,len:g-m+1,body:{dataStream:``,customRanges:[_]},coverType:j.COVER}),s=g+1},_=((u=o.paragraphs)==null?[]:u).filter(e=>e.startIndex<m&&e.startIndex>p),ee=((d=o.customBlocks)==null?[]:d).filter(e=>e.startIndex<m&&e.startIndex>p);hs([p,m-1],[..._.map(e=>e.startIndex),...ee.map(e=>e.startIndex)]).forEach(([e,t],n)=>g(e,t,n)),l=!0,c.selections=[{startOffset:f.endOffset,endOffset:f.endOffset,collapsed:!0}]}),l?c:!1}function bs(e,t,n=0,r=null,i=!0){e.sort((e,t)=>e.startOffset-t.startOffset);let a=[],{paragraphs:o=[]}=t,s=o==null?void 0:o.find(t=>t.startIndex>=e[0].startOffset&&t.startIndex<e[0].endOffset),c=n;if(e.forEach(e=>{let{startOffset:t,endOffset:n}=e;t>c&&(a.push({t:M.RETAIN,len:t-c}),c=t),c<n&&(a.push({t:M.DELETE,len:n-c}),c=n)}),r&&a.push({t:M.INSERT,body:r,len:r.dataStream.length}),s&&i){let t=o.find(t=>t.startIndex-n>=e[e.length-1].endOffset-1);t&&(t.startIndex>c&&(a.push({t:M.RETAIN,len:t.startIndex-c}),c=t.startIndex),a.push({t:M.RETAIN,len:1,body:{dataStream:``,paragraphs:[{...t,startIndex:0,bullet:s==null?void 0:s.bullet}]},coverType:j.REPLACE}))}return a}function xs(e,t,n=0){let r=[],i=n;return e.forEach(e=>{let{startOffset:n,endOffset:a}=e;n>i&&(r.push({t:M.RETAIN,len:n-i}),i=n),a>i&&(r.push({t:M.RETAIN,len:a-i,body:{...S.deepClone(t),dataStream:``}}),i=a)}),r}const Ss=e=>{var t;let{selection:n,body:r,doc:i}=e,a=n.segmentId,o=(t=i.getSelfOrHeaderFooterModel(a))==null?void 0:t.getBody();if(!o)return!1;let s=n.collapsed?null:K(o,n.startOffset,n.endOffset),c=(0,le.default)(s?s.dataStream:``,r.dataStream),l=0,u=c.map(([e,t])=>{switch(e){case 0:{let e={t:M.RETAIN,body:{...K(r,l,l+t.length,!1),dataStream:``},len:t.length};return l+=t.length,e}case 1:{let e={t:M.INSERT,body:K(r,l,l+t.length),len:t.length};return l+=t.length,e}default:return{t:M.DELETE,len:t.length}}}),d=new J;return d.push({t:M.RETAIN,len:n.startOffset}),d.push(...u),d};function Cs(e,t){return!!((e==null?void 0:e.length)===(t==null?void 0:t.length)&&e!=null&&e.every((e,n)=>JSON.stringify(e)===JSON.stringify(t==null?void 0:t[n])))}const ws=e=>{var t;let{selection:n,body:r,doc:i,themeService:a}=e,o=n.segmentId,s=(t=i.getSelfOrHeaderFooterModel(o))==null?void 0:t.getBody();if(!s)return!1;let c=n.collapsed?null:K(s,n.startOffset,n.endOffset),l=(0,le.default)(c?c.dataStream:``,r.dataStream),u=0,d=l.map(([e,t])=>{switch(e){case 0:{let e=ko(r,u,u+t.length,!1),n=ko(c,u,u+t.length,!1),i={t:M.RETAIN,body:Cs(e,n)?void 0:{textRuns:e==null?void 0:e.map(e=>{var t,n,r,i;return{...e,ts:{...e.ts,cl:!((t=e.ts)==null||(t=t.cl)==null||(t=t.rgb)==null)&&t.includes(`.`)?{rgb:a.getColorFromTheme((n=(r=e.ts)==null||(r=r.cl)==null?void 0:r.rgb)==null?``:n)}:(i=e.ts)==null?void 0:i.cl}}}),dataStream:``},len:t.length};return u+=t.length,i}case 1:{let e={t:M.INSERT,body:K(r,u,u+t.length),len:t.length};return u+=t.length,e}default:return{t:M.DELETE,len:t.length}}});if(d.every(e=>e.t===M.RETAIN&&!e.body))return!1;let f=new J;return f.push({t:M.RETAIN,len:n.startOffset}),f.push(...d),f};function Ts(e,t){let n=[],{customBlocks:r=[]}=e;for(let e of t){let{startOffset:t,endOffset:i}=e;if(!(t==null||i==null))for(let e of r){let{startIndex:r}=e;r>=t&&r<i&&n.push(e.blockId)}}return n}function Es(e,t=``){if(!t)return[`body`];let{headers:n,footers:r}=e.getSnapshot();if(n==null&&r==null)throw 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 Error(`Segment id not found in headers or footers`)}const Ds=e=>{var t,n;let{selection:r,documentDataModel:i,drawings:a}=e,{collapsed:o,startOffset:s,segmentId:c}=r,l=new J,u=Y.getInstance(),d=[],f=i.getSelfOrHeaderFooterModel(c).getBody();if(!f)return!1;let p=(t=(n=i.getSnapshot().drawingsOrder)==null?void 0:n.length)==null?0:t,m=0;if(o)s>0&&l.push({t:M.RETAIN,len:s});else{var h,g;let e=bs([r],f,0,null,!1);l.push(...e);let t=Ts(f,[r]),n=(h=i.getDrawings())==null?{}:h,a=(g=i.getDrawingsOrder())==null?[]:g,o=t.sort((e,t)=>a.indexOf(e)>a.indexOf(t)?-1:a.indexOf(e)<a.indexOf(t)?1:0);if(o.length>0)for(let e of o){let t=n[e],r=a.indexOf(e);if(t==null||r<0)continue;let i=u.removeOp([`drawings`,e],t),o=u.removeOp([`drawingsOrder`,r],e);d.push(i),d.push(o),m++}}l.push({t:M.INSERT,body:{dataStream:`\b`.repeat(a.length),customBlocks:a.map((e,t)=>({startIndex:t,blockId:e.drawingId}))},len:a.length});let _=Es(i,c),ee=u.editOp(l.serialize(),_);d.push(ee);for(let e of a){let{drawingId:t}=e,n=u.insertOp([`drawings`,t],e),r=u.insertOp([`drawingsOrder`,p-m],t);d.push(n),d.push(r)}return d.reduce((e,t)=>Y.compose(e,t),null)};function Os(e,t){if(t===void 0)return{startOffset:e,endOffset:e,collapsed:!0};if(t<e)throw Error(`Cannot make a doc selection when endOffset ${t} is less than startOffset ${e}.`);return{startOffset:e,endOffset:t,collapsed:e===t}}function ks(e){let{startOffset:t,endOffset:n,collapsed:r}=e;return{startOffset:Math.min(t,n),endOffset:Math.max(t,n),collapsed:r}}function As(e,t,n,r){return Math.max(e,n)<=Math.min(t,r)}function js(e,t,n,r){let{startOffset:i,endOffset:a}=e,o=r==null?Ps(t,n):r,s=[],c=-1;for(let e=0;e<o.length;e++){let t=o[e],{startIndex:n}=t;(i>c&&i<=n||a>c&&a<=n||n>=i&&n<=a)&&s.push(t),c=n}return s}function Ms(e,t,n){let r=[],i=Ps(t,n);for(let a of e){let e=js(a,t,n,i);r.push(...e)}return r}const Ns=[X.PARAGRAPH,X.TABLE_START,X.TABLE_END,X.TABLE_ROW_START,X.TABLE_CELL_START,X.TABLE_CELL_END];function Ps(e,t){let n=[];for(let r=0;r<e.length;r++){let i=e[r],{startIndex:a}=i,o=a-1;for(;!Ns.includes(t[o])&&o>=0;)o--;n.push({...i,paragraphStart:o+1,paragraphEnd:i.startIndex})}return n}const Fs=e=>{var t,n;let{paragraphs:r,segmentId:i,document:a}=e,o=e.listType,s=(t=(n=a.getSelfOrHeaderFooterModel(i).getBody())==null?void 0:n.paragraphs)==null?[]:t,c=r.every(e=>{var t;return((t=e.bullet)==null?void 0:t.listType.indexOf(o))===0}),l=C(6);if(r.length===1){let e=s.indexOf(r[0]),t=s[e-1],n=s[e+1];t&&t.bullet&&t.bullet.listType.indexOf(o)===0?(l=t.bullet.listId,o!==G.CHECK_LIST&&(o=t.bullet.listType)):n&&n.bullet&&n.bullet.listType.indexOf(o)===0&&(l=n.bullet.listId,o!==G.CHECK_LIST&&(o=n.bullet.listType))}let u=new dt;u.reset();let d=new J;for(let e of r){var f;let{startIndex:t,paragraphStyle:n={},bullet:r}=e;d.push({t:M.RETAIN,len:t-u.cursor}),d.push({t:M.RETAIN,len:1,body:{dataStream:``,paragraphs:[c?{paragraphStyle:n,startIndex:0}:{startIndex:0,paragraphStyle:{...n},bullet:{nestingLevel:(f=r==null?void 0:r.nestingLevel)==null?0:f,textStyle:{fs:20},listType:o,listId:l}}]},coverType:j.REPLACE}),u.moveCursorTo(t+1)}return d},Is=e=>{var t;let{paragraphIndex:n,segmentId:r,document:i}=e,a=(t=i.getSelfOrHeaderFooterModel(r).getBody())==null?void 0:t.paragraphs;if(a==null)return!1;let o=a.find(e=>e.startIndex===n);if(!(o!=null&&o.bullet)||o.bullet.listType.indexOf(G.CHECK_LIST)===-1)return!1;let s=new dt;s.reset();let c=new J,{startIndex:l,paragraphStyle:u={}}=o,d=o.bullet.listType===G.CHECK_LIST?G.CHECK_LIST_CHECKED:G.CHECK_LIST;return c.push({t:M.RETAIN,len:l-s.cursor}),c.push({t:M.RETAIN,len:1,body:{dataStream:``,paragraphs:[{...o,paragraphStyle:u,startIndex:0,bullet:{...o.bullet,listType:d}}]},coverType:j.REPLACE}),s.moveCursorTo(l+1),c},Ls=e=>{var t;let{paragraphs:n,listType:r,segmentId:i,document:a}=e;if(((t=a.getSelfOrHeaderFooterModel(i).getBody())==null?void 0:t.paragraphs)==null)return!1;let o=C(6),s=new dt;s.reset();let c=new J;for(let e of n){var l;let{startIndex:t,paragraphStyle:n={},bullet:i}=e;c.push({t:M.RETAIN,len:t-s.cursor}),c.push({t:M.RETAIN,len:1,body:{dataStream:``,paragraphs:[{startIndex:0,paragraphStyle:n,bullet:{nestingLevel:(l=i==null?void 0:i.nestingLevel)==null?0:l,textStyle:(i==null?void 0:i.listType)===r?i.textStyle:{fs:20},listType:r,listId:o}}]},coverType:j.REPLACE}),s.moveCursorTo(t+1)}return c};function Rs(e,t){return t.some(t=>e.startIndex>t.startIndex&&e.startIndex<t.endIndex)}const zs=e=>{var t,n,r;let{paragraphs:i,document:a,type:o}=e,s=new dt;s.reset();let c=new J,l=(t=a.getSnapshot().lists)==null?{}:t,u=(n=(r=a.getBody())==null?void 0:r.tables)==null?[]:n,d={...ho,...l};for(let e of i){let{startIndex:t,paragraphStyle:n={},bullet:r}=e,i=Rs(e,u);if(c.push({t:M.RETAIN,len:t-s.cursor}),r){let e=d[r.listType].nestingLevel.length-1;i&&(e=Math.min(e,2)),c.push({t:M.RETAIN,len:1,body:{dataStream:``,paragraphs:[{startIndex:0,paragraphStyle:{...n},bullet:{...r,nestingLevel:Math.max(Math.min(r.nestingLevel+o,e),0)}}]},coverType:j.REPLACE})}else c.push({t:M.RETAIN,len:1});s.moveCursorTo(t+1)}return c},Bs=e=>{var t,n,r,i;let{textRanges:a,segmentId:o,document:s,style:c,paragraphTextRun:l,cursor:u,deleteLen:d,textX:f}=e,p=s.getSelfOrHeaderFooterModel(o),m=Ms(a,(t=(n=p.getBody())==null?void 0:n.paragraphs)==null?[]:t,(r=(i=p.getBody())==null?void 0:i.dataStream)==null?``:r),h=new dt;u&&h.moveCursorTo(u);let g=f==null?new J:f;m.sort((e,t)=>e.startIndex-t.startIndex);let _=Math.max(0,m[0].paragraphStart-1);_>h.cursor&&(g.push({t:M.RETAIN,len:_-h.cursor}),h.moveCursorTo(_)),d&&g.push({t:M.DELETE,len:d});for(let e of m){let{startIndex:t,paragraphStyle:n={}}=e,r=t-h.cursor;g.push({t:M.RETAIN,len:r,...l?{body:{dataStream:``,textRuns:[{ts:l,st:0,ed:r}]},coverType:j.REPLACE}:null}),g.push({t:M.RETAIN,len:1,body:{dataStream:``,paragraphs:[{startIndex:0,paragraphStyle:{...n,...c}}]},coverType:j.REPLACE}),h.moveCursorTo(t+1)}return g};var Z=class{};v(Z,`customRange`,{add:ys,delete:vs,copyCustomRange:ms,getCustomRangesInterestsWithSelection:ps,isIntersecting:fs}),v(Z,`customDecoration`,{add:us,delete:ds}),v(Z,`selection`,{replace:Ss,makeSelection:Os,normalizeSelection:ks,delete:bs,replaceTextRuns:ws,retain:xs}),v(Z,`range`,{isIntersects:As,getParagraphsInRange:js,getParagraphsInRanges:Ms}),v(Z,`transform`,{getPlainText:is,fromPlainText:os,isEmptyDocument:as}),v(Z,`paragraph`,{bullet:{set:Ls,switch:Fs,toggleChecklist:Is,changeNestLevel:zs},style:{set:Bs},util:{transform:Ps,getParagraphsInRange:js,getParagraphsInRanges:Ms}}),v(Z,`drawing`,{add:Ds});function Vs(e,t,n,r){if(t===``)return e;let i=new ls({id:`mock-id`,body:e,documentStyle:{}}),a=t.length,o;for(;(o=(r?i.getBody().dataStream:i.getBody().dataStream.toLowerCase()).indexOf(t))>=0;){let e=new J,t=Y.getInstance();if(o>0&&e.retain(o),n.length>0){var s;let t=i.sliceBody(o,o+a),r={dataStream:n};Array.isArray(t==null?void 0:t.textRuns)&&t.textRuns.length&&(r.textRuns=[{...t.textRuns[0],st:0,ed:n.length}]),!(t==null||(s=t.customRanges)==null)&&s.length&&(r.customRanges=[{...t.customRanges[0],startIndex:0,endIndex:n.length-1}]),e.insert(n.length,r)}e.delete(a),i.apply(t.editOp(e.serialize()))}let c=i.getBody();return i.dispose(),c}function Hs(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 Us(e){var t;return e.body=Hs((t=e.body)==null?{dataStream:``}:t),e.drawingsOrder||(e.drawingsOrder=[]),e.drawings||(e.drawings={}),e.documentStyle||(e.documentStyle={}),e}var Ws=class e{static create(t={}){return new e(t)}constructor(e={}){v(this,`_style`,void 0),this._style=e}get fontFamily(){return this._style.ff}get fontSize(){return this._style.fs}get italic(){return this._style.it===E.TRUE}get bold(){return this._style.bl===E.TRUE}get underline(){return this._style.ul&&Ks.create(this._style.ul)}get bottomBorderLine(){return this._style.bbl&&Ks.create(this._style.bbl)}get strikethrough(){return this._style.st&&Ks.create(this._style.st)}get overline(){return this._style.ol&&Ks.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 Gs.create(S.deepClone(this._style))}getValue(){return{...this._style}}},Gs=class e extends Ws{static create(t={}){return new e(t)}constructor(e={}){super(e)}setFontFamily(e){return this._style.ff=e,this}setFontSize(e){return this._style.fs=e,this}setItalic(e){return this._style.it=e?1:0,this}setBold(e){return this._style.bl=e?1:0,this}setUnderline(e){return this._style.ul=e.build(),this}setBottomBorderLine(e){return this._style.bbl=e.build(),this}setStrikethrough(e){return this._style.st=e.build(),this}setOverline(e){return this._style.ol=e.build(),this}setBackground(e){return this._style.bg=e,this}setBorder(e){return this._style.bd=e,this}setColor(e){return this._style.cl=e,this}setVerticalAlign(e){return this._style.va=e,this}copy(){return e.create(S.deepClone(this._style))}build(){return this.getValue()}},Ks=class e{static create(t={s:1}){return new e(t)}constructor(e={s:1}){v(this,`_decoration`,void 0),this._decoration=e}get show(){return this._decoration.s===E.TRUE}get followFontColor(){return this._decoration.c===E.TRUE}get color(){return this._decoration.cl}get type(){return this._decoration.t}setShow(e){return this._decoration.s=e?1:0,this}setFollowFontColor(e){return this._decoration.c=e?1:0,this}setColor(e){return this._decoration.cl=e,this}setLineType(e){return this._decoration.t=e,this}copy(){return e.create(S.deepClone(this._decoration))}build(){return{...this._decoration}}},qs=class e{static create(t={}){return new e(t)}constructor(e={}){v(this,`_style`,void 0),this._style=e}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===E.TRUE}get keepNext(){return this._style.keepNext===E.TRUE}get wordWrap(){return this._style.wordWrap===E.TRUE}get widowControl(){return this._style.widowControl===E.TRUE}get shading(){return this._style.shading}get suppressHyphenation(){return this._style.suppressHyphenation===E.TRUE}copy(){return Js.create(S.deepClone(this._style))}getValue(){return this._style}},Js=class e extends qs{static create(t={}){return new e(t)}constructor(e={}){super(e)}setIndentFirstLine(e){return this._style.indentFirstLine=e,this}setHanging(e){return this._style.hanging=e,this}setIndentStart(e){return this._style.indentStart=e,this}setTabStops(e){return this._style.tabStops=e,this}setIndentEnd(e){return this._style.indentEnd=e,this}setTextStyle(e){return this._style.textStyle=e,this}setHeadingId(e){return this._style.headingId=e,this}setNamedStyleType(e){return this._style.namedStyleType=e,this}setHorizontalAlign(e){return this._style.horizontalAlign=e,this}setLineSpacing(e){return this._style.lineSpacing=e,this}setDirection(e){return this._style.direction=e,this}setSpacingRule(e){return this._style.spacingRule=e,this}setSnapToGrid(e){return this._style.snapToGrid=e?1:0,this}setSpaceAbove(e){return this._style.spaceAbove=e,this}setSpaceBelow(e){return this._style.spaceBelow=e,this}setBorderBetween(e){return this._style.borderBetween=e,this}setBorderTop(e){return this._style.borderTop=e,this}setBorderBottom(e){return this._style.borderBottom=e,this}setBorderLeft(e){return this._style.borderLeft=e,this}setBorderRight(e){return this._style.borderRight=e,this}setKeepLines(e){return this._style.keepLines=e?1:0,this}setKeepNext(e){return this._style.keepNext=e?1:0,this}setWordWrap(e){return this._style.wordWrap=e?1:0,this}setWidowControl(e){return this._style.widowControl=e?1:0,this}setShading(e){return this._style.shading=e,this}setSuppressHyphenation(e){return this._style.suppressHyphenation=e?1:0,this}copy(){return e.create(S.deepClone(this._style))}build(){return this.getValue()}},Ys=class e{static create(t){return new e(t)}static createByBody(t){return new e({body:t,id:`d`,documentStyle:{}})}constructor(e){if(v(this,`_data`,void 0),!e.body)throw Error(`Invalid document data, body is required`);this._data=Us(e)}copy(){return Xs.create(S.deepClone(this._data))}slice(e,t){let{body:n,...r}=this._data;return Xs.create({...S.deepClone(r),body:K(n,e,t)})}toPlainText(){var e,t;return Z.transform.getPlainText((e=(t=this._data.body)==null?void 0:t.dataStream)==null?``:e).replaceAll(`\r`,`
6
- `)}getParagraphStyle(){var e;return qs.create((e=this._data.body)==null||(e=e.paragraphs)==null?void 0:e[0].paragraphStyle)}getParagraphBullet(){var e;return(e=this._data.body)==null||(e=e.paragraphs)==null?void 0:e[0].bullet}getParagraphs(){var e,t;let n=(e=(t=this._data.body)==null?void 0:t.paragraphs)==null?[]:e,r=0;return n.map(e=>{let t=this.slice(r,e.startIndex);return r=e.startIndex,t})}getTextRuns(){var e,t;return((e=(t=this._data.body)==null?void 0:t.textRuns)==null?[]:e).map(e=>({...e,ts:e.ts?Ws.create(e.ts):null}))}getLinks(){var e,t;return(e=(t=this._data.body)==null||(t=t.customRanges)==null?void 0:t.filter(e=>e.rangeType===yn.HYPERLINK))==null?[]:e}getData(){return this._data}},Xs=class e extends Ys{static newEmptyData(){return Us({id:`d`,documentStyle:{},drawings:{},drawingsOrder:[],body:{dataStream:`\r
7
- `,customBlocks:[],customRanges:[],paragraphs:[{startIndex:0}],textRuns:[],tables:[],sectionBreaks:[]}})}static create(t){return new e(t==null?e.newEmptyData():t)}constructor(e){super(e),v(this,`_doc`,void 0),this._doc=new ls(e)}insertText(e,t,n){var r,i;let a=((r=(i=this._data.body)==null?void 0:i.dataStream.length)==null?2:r)-2,o,s;if(typeof e==`string`?o=e:(a=Math.min(e,a),o=t),s=typeof t==`object`?t instanceof Gs?t.build():t:n instanceof Gs?n.build():n,!o)return this;let c={dataStream:o,textRuns:s?[{ts:s,st:a,ed:a+o.length}]:[]},l=Z.selection.replace({doc:this._doc,selection:{startOffset:a,endOffset:a,collapsed:!0},body:c});if(!l)throw Error(`Insert text failed, please check.`);return J.apply(this._doc.getBody(),l.serialize()),this}insertRichText(e,t){var n,r;let i=((n=(r=this._data.body)==null?void 0:r.dataStream.length)==null?2:n)-2,a;typeof e==`object`?a=e instanceof Ys?e.getData():e:(i=Math.min(e,i),a=t instanceof Ys?t.getData():t);let o=Z.selection.replace({doc:this._doc,selection:{startOffset:i,endOffset:i,collapsed:!0},body:a.body});if(!o)throw Error(`Insert text failed, please check.`);return J.apply(this._doc.getBody(),o.serialize()),this}delete(e,t){if(t!==void 0){if(!t)return this;let n=Z.selection.delete([{startOffset:e,endOffset:e+t,collapsed:!0}],this._data.body);J.apply(this._doc.getBody(),n)}return this}setStyle(e,t,n){let r={dataStream:``,textRuns:[{ts:n instanceof Gs?n.build():n,st:0,ed:t-e}]},i=Z.selection.retain([{startOffset:e,endOffset:t,collapsed:!0}],r);return J.apply(this._doc.getBody(),i),this}setLink(e,t,n){let r=Z.customRange.add({rangeType:yn.HYPERLINK,rangeId:C(),properties:{url:n},ranges:[{startOffset:e,endOffset:t,collapsed:!1}],body:this._data.body});if(!r)throw Error(`Insert text failed, please check.`);return J.apply(this._doc.getBody(),r.serialize()),this}cancelLink(e,t){if(typeof e==`string`){let t=Z.customRange.delete({rangeId:e,documentDataModel:this._doc});if(!t)throw Error(`Insert text failed, please check.`);J.apply(this._doc.getBody(),t.serialize())}else this.slice(e,t).getLinks().forEach(e=>{let t=Z.customRange.delete({rangeId:e.rangeId,documentDataModel:this._doc});if(!t)throw Error(`Insert text failed, please check.`);J.apply(this._doc.getBody(),t.serialize())});return this}updateLink(e,t){var n;let r=(n=this._data.body)==null||(n=n.customRanges)==null?void 0:n.find(t=>t.rangeId===e);if(!r)throw Error(`Link not found`);return r.properties.url=t,this}insertParagraph(e,t){let n,r;if(typeof e==`object`){var i,a;n={dataStream:`\r`,paragraphs:[{startIndex:0,paragraphStyle:e.build()}]},r=((i=(a=this._data.body)==null?void 0:a.dataStream.length)==null?2:i)-2}else r=e,n={dataStream:`\r`,paragraphs:[{startIndex:0,paragraphStyle:t==null?void 0:t.build()}]};return this.insertRichText(r,Ys.create({body:n,id:`d`,documentStyle:{}})),this}insertLink(t,n,r){let i=``,a=``;typeof t==`string`?(i=t,a=n):(i=n,a=r);let o=e.createByBody({dataStream:i,customRanges:[{rangeType:yn.HYPERLINK,rangeId:C(),properties:{url:a},startIndex:0,endIndex:i.length-1}]});return typeof t==`number`?this.insertRichText(t,o):this.insertRichText(o)}},Zs=class{constructor(){v(this,`skipNextObservers`,!1),v(this,`lastReturnValue`,void 0),v(this,`isStopPropagation`,!1)}stopPropagation(){this.isStopPropagation=!0}},Qs=class extends d.Subject{constructor(...e){super(...e),v(this,`_sortedObservers`,[])}unsubscribe(){super.unsubscribe(),this._sortedObservers.length=0}complete(){super.complete(),this._sortedObservers.length=0}subscribeEvent(e){let t;t=typeof e==`function`?{next:([t,n])=>e(t,n)}:e;let n=super.subscribe(t);return this._sortedObservers.push(t),this._sortedObservers.sort((e,t)=>{var n,r;return((n=e.priority)==null?0:n)-((r=t.priority)==null?0:r)}),n.add(()=>this._sortedObservers=this._sortedObservers.filter(e=>e!==t)),n}clearObservers(){this._sortedObservers.forEach(e=>{var t;return(t=e.complete)==null?void 0:t.call(e)}),this._sortedObservers.length=0}emitEvent(e){if(!this.closed){let n=new Zs;n.lastReturnValue=e;for(let r of this._sortedObservers){var t;if(n.lastReturnValue=(t=r.next)==null?void 0:t.call(r,[e,n]),n.skipNextObservers)return{handled:!0,lastReturnValue:n.lastReturnValue,stopPropagation:n.isStopPropagation}}return{handled:this._sortedObservers.length>0,lastReturnValue:n.lastReturnValue,stopPropagation:n.isStopPropagation}}throw Error(`[EventSubject]: cannot emit event on a closed subject.`)}};function $s(e){return new d.Observable(t=>{let n=e.subscribeEvent(e=>{t.next(e)});return()=>n.unsubscribe()})}const ec=(0,l.createIdentifier)(`core.resource-manager.service`),tc={[f.UnitRole.Editor]:`Editor`,[f.UnitRole.Owner]:`Owner`,[f.UnitRole.Reader]:`Reader`,[f.UnitRole.UNRECOGNIZED]:`UNRECOGNIZED`},nc=e=>e?{userID:`${tc[e]}_${C(8)}`,name:tc[e],avatar:``}:{userID:``,name:``,avatar:``,anonymous:!0,canBindAnonymous:!1},rc=(e,t)=>e.startsWith(tc[t]);var ic=class extends x{constructor(...e){super(...e),v(this,`_model`,new Map),v(this,`_userChange$`,new d.Subject),v(this,`userChange$`,this._userChange$.asObservable()),v(this,`_currentUser$`,new d.BehaviorSubject(nc())),v(this,`currentUser$`,this._currentUser$.asObservable())}dispose(){super.dispose(),this._model.clear(),this._userChange$.complete(),this._currentUser$.complete()}getCurrentUser(){return this._currentUser$.getValue()}setCurrentUser(e){this.addUser(e),this._currentUser$.next(e)}addUser(e){this._model.set(e.userID,e),this._userChange$.next({type:`add`,user:e})}getUser(e,t){let n=this._model.get(e);if(n)return n;t&&t()}delete(e){let t=this.getUser(e);this._model.delete(e),t&&this._userChange$.next({type:`delete`,user:t})}clear(){this._model.clear(),this._userChange$.next({type:`clear`})}list(){return Array.from(this._model.values())}};let ac=class{constructor(e,t){this._resourceManagerService=e,this._userManagerService=t,v(this,`_permissionMap`,new Map([])),v(this,`_permissionOverrides`,new Map),this._initSnapshot(),this._initDefaultUser()}_initDefaultUser(){let e=this._userManagerService.getCurrentUser();e&&e.userID||this._userManagerService.setCurrentUser(nc(f.UnitRole.Owner))}_getRole(e){let t=this._userManagerService.getCurrentUser();return t?rc(t.userID,e):!1}_initSnapshot(){this._resourceManagerService.registerPluginResource({toJson:e=>{let t=[...this._permissionMap.keys()].reduce((e,t)=>(e[t]=this._permissionMap.get(t),e),{});return JSON.stringify(t)},parseJson:e=>JSON.parse(e),pluginName:`SHEET_AuthzIoMockService_PLUGIN`,businesses:[f.UniverType.UNIVER_SHEET,f.UniverType.UNIVER_DOC,f.UniverType.UNIVER_SLIDE],onLoad:(e,t)=>{for(let e in t)this._permissionMap.set(e,t[e])},onUnLoad:()=>{this._permissionMap.clear()}})}async create(e){let t=C(8),{objectType:n,selectRangeObject:r,worksheetObject:i}=e,a=r||i,o={objectType:n,unitID:(a==null?void 0:a.unitID)||``,name:(a==null?void 0:a.name)||``,strategies:[{action:6,role:f.UnitRole.Owner},{action:16,role:f.UnitRole.Owner},{action:17,role:f.UnitRole.Owner},{action:18,role:f.UnitRole.Owner},{action:19,role:f.UnitRole.Owner},{action:33,role:f.UnitRole.Owner},{action:34,role:f.UnitRole.Owner},{action:35,role:f.UnitRole.Owner},{action:36,role:f.UnitRole.Owner},{action:37,role:f.UnitRole.Owner},{action:38,role:f.UnitRole.Owner},{action:39,role:f.UnitRole.Owner},{action:40,role:f.UnitRole.Owner}],selectRangeObject:r};return this._permissionMap.set(t,o),t}async allowed(e){let{objectID:t,actions:n}=e,r=this._permissionMap.get(t);return r?n.map(e=>{let n=`${t}:${e}`;if(this._permissionOverrides.has(n))return{action:e,allowed:this._permissionOverrides.get(n)};let i=r.strategies.find(t=>t.action===e);return i?{action:e,allowed:this._getRole(i.role)}:{action:e,allowed:this._getRole(f.UnitRole.Owner)||this._getRole(f.UnitRole.Editor)}}):n.map(e=>({action:e,allowed:this._getRole(f.UnitRole.Owner)||this._getRole(f.UnitRole.Editor)}))}async batchAllowed(e){let t=await Promise.all(e.map(e=>this.allowed(e)));return e.map((e,n)=>({unitID:e.unitID,objectID:e.objectID,actions:t[n]}))}async list(e){let t=[],n=[{action:6,role:f.UnitRole.Owner},{action:16,role:f.UnitRole.Owner},{action:17,role:f.UnitRole.Owner},{action:18,role:f.UnitRole.Owner},{action:19,role:f.UnitRole.Owner},{action:33,role:f.UnitRole.Owner},{action:34,role:f.UnitRole.Owner},{action:35,role:f.UnitRole.Owner},{action:36,role:f.UnitRole.Owner},{action:37,role:f.UnitRole.Owner},{action:38,role:f.UnitRole.Owner},{action:39,role:f.UnitRole.Owner},{action:40,role:f.UnitRole.Owner}];return e.objectIDs.forEach(r=>{let i=this._permissionMap.get(r),a=(i==null?void 0:i.strategies)||n,o={objectID:r,unitID:e.unitID,objectType:(i==null?void 0:i.objectType)||3,name:(i==null?void 0:i.name)||``,shareOn:!1,shareRole:f.UnitRole.Owner,shareScope:-1,scope:{read:f.ObjectScope.AllCollaborator,edit:f.ObjectScope.AllCollaborator},creator:nc(f.UnitRole.Owner),strategies:a.map(e=>({action:e.action,role:e.role})),actions:e.actions.map(e=>{let t=`${r}:${e}`;if(this._permissionOverrides.has(t))return{action:e,allowed:this._permissionOverrides.get(t)};let n=a.find(t=>t.action===e);return n?{action:e,allowed:this._getRole(n.role)}:{action:e,allowed:this._getRole(f.UnitRole.Owner)||this._getRole(f.UnitRole.Editor)}})};t.push(o)}),t}async listCollaborators(){return[]}async listRoles(){return{roles:[],actions:[]}}async deleteCollaborator(){}async update(e){let{objectID:t,strategies:n}=e,r=this._permissionMap.get(t);r&&n&&(r.strategies=n.map(e=>({action:e.action,role:e.role})),this._permissionMap.set(t,r),n.forEach(e=>{e.role===f.UnitRole.Reader?this.setPermissionOverride(t,e.action,!1):(e.role===f.UnitRole.Owner||e.role===f.UnitRole.Editor)&&this.clearPermissionOverride(t,e.action)}))}setPermissionOverride(e,t,n){let r=`${e}:${t}`;this._permissionOverrides.set(r,n)}clearPermissionOverride(e,t){let n=`${e}:${t}`;this._permissionOverrides.delete(n)}clearAllOverrides(e){let t=[];this._permissionOverrides.forEach((n,r)=>{r.startsWith(`${e}:`)&&t.push(r)}),t.forEach(e=>this._permissionOverrides.delete(e))}async updateCollaborator(){}async createCollaborator(){}async putCollaborators(e){}};ac=F([P(0,ec),P(1,(0,l.Inject)(ic))],ac);const oc=(0,l.createIdentifier)(`IAuthzIoIoService`),sc=(0,l.createIdentifier)(`univer.confirm-service`);var cc=class{constructor(){v(this,`confirmOptions$`,new d.Subject)}dispose(){this.confirmOptions$.complete()}open(e){throw Error(`This is not implemented in the test service!`)}confirm(e){return Promise.resolve(!0)}close(e){throw Error(`This is not implemented in the test service!`)}};const lc=`FOCUSING_UNIT`,uc=`FOCUSING_SHEET`,dc=`FOCUSING_DOC`,fc=`FOCUSING_SLIDE`,pc=`EDITOR_ACTIVATED`,mc=`FOCUSING_FX_BAR_EDITOR`;var hc=class extends x{constructor(...e){super(...e),v(this,`_error$`,new d.Subject),v(this,`error$`,this._error$.asObservable())}dispose(){this._error$.complete()}emit(e){this._error$.next({errorKey:e})}};let gc=function(e){return e.URL=`URL`,e.UUID=`UUID`,e.BASE64=`BASE64`,e}({}),_c=function(e){return e.SUCCUSS=`0`,e.ERROR_EXCEED_SIZE=`1`,e.ERROR_IMAGE_TYPE=`2`,e.ERROR_UPLOAD_COUNT_LIMIT=`3`,e.ERROR_IMAGE=`4`,e}({});const vc=(0,l.createIdentifier)(`core.image-io.service`),yc=(0,l.createIdentifier)(`core.url-image.service`);var bc=`@univerjs/core`,xc=`0.18.0`;function Sc(e=``,t=Zt.ZH_CN,n=``){return{id:e,sheetOrder:[],name:n,appVersion:xc,locale:t,styles:{},sheets:{},resources:[]}}var Cc=class{constructor(e={}){v(this,`_styles`,void 0),v(this,`_cacheMap`,new ra(1e5)),this._styles=e,this._generateCacheMap()}each(e){return Object.entries(this._styles).forEach(e),this}search(e,t){return this._cacheMap.has(t)?this._cacheMap.get(t):this._getExistingStyleId(e)||`-1`}get(e){return typeof e==`string`?(e=String(e),this._styles[e]):e}add(e,t){let n=C(6);return this._styles[n]=e,this._cacheMap.set(t,n),n}setValue(e){if(e==null)return;let t=JSON.stringify(e),n=this.search(e,t);return n===`-1`?this.add(e,t):n}addCustomStyle(e,t){t!=null&&(this._styles[e]=t,this._cacheMap.set(JSON.stringify(t),e))}remove(e){let t=this._styles[e];t&&(delete this._styles[e],this._cacheMap.delete(JSON.stringify(t)))}toJSON(){return this._styles}getStyleByCell(e){let t;t=e&&S.isObject(e.s)?e.s:(e==null?void 0:e.s)&&this.get(e.s);let n=e==null?void 0:e.interceptorStyle;return n?{...t,...n}:t}_generateCacheMap(){let{_styles:e,_cacheMap:t}=this;for(let n in e){let r=JSON.stringify(e[n]);t.set(r,n)}}_getExistingStyleId(e){let{_styles:t}=this;for(let n in t)if(S.diffValue(t[n],e))return n;return null}};const wc=(e,t)=>t.length===e.length&&!e.some(e=>t.some(t=>!U.equals(t,e))),Tc=(e,t)=>t.length===e.length&&e.every((e,n)=>{let r=t[n];return r.unitId===e.unitId&&r.sheetId===e.sheetId&&U.equals(e.range,r.range)}),Ec={t:0,b:2,l:2,r:2},Dc=e=>({sbr:.6,sbo:e,spr:.6,spo:e});function Oc(e,t,n={}){let r=e.length,{textRotation:i,paddingData:a,horizontalAlign:o=T.UNSPECIFIED,verticalAlign:s=ln.UNSPECIFIED,wrapStrategy:c=un.UNSPECIFIED,cellValueType:l}=n,{t:u,r:d,b:f,l:p}=a||Ec,{vertexAngle:m,centerAngle:h}=Ic(i);return new ls({id:`d`,body:{dataStream:`${e}\r
8
- `,textRuns:[{ts:t,st:0,ed:r}],paragraphs:[{startIndex:r,paragraphStyle:{horizontalAlign:o}}],sectionBreaks:[{startIndex:r+1}]},documentStyle:{pageSize:{width:1/0,height:1/0},marginTop:u,marginBottom:f,marginRight:d,marginLeft:p,renderConfig:{horizontalAlign:o,verticalAlign:s,centerAngle:h,vertexAngle:m,wrapStrategy:c,cellValueType:l}},drawings:{},drawingsOrder:[]})}function kc(e){if(!e)return{};let{tr:t,td:n,ht:r,vt:i,tb:a,pd:o}=e;return{textRotation:t,textDirection:n,horizontalAlign:r,verticalAlign:i,wrapStrategy:a,paddingData:o}}function Ac(e){if(!e)return{};let{ff:t,fs:n,it:r,bl:i,ul:a,st:o,ol:s,cl:c}=e,l={};return t&&(l.ff=t),n&&(l.fs=n),r&&(l.it=r),i&&(l.bl=i),a&&(l.ul=a),o&&(l.st=o),s&&(l.ol=s),c&&(l.cl=c),l}function jc(e,t,n){var r;let i=e.getBody();if((r=i.customRanges)!=null&&r.some(e=>e.rangeType===yn.HYPERLINK))return;let a=Z.customRange.add({ranges:[{startOffset:0,endOffset:i.dataStream.length-1,collapsed:!1}],rangeId:n,rangeType:yn.HYPERLINK,body:i,properties:{url:t,refId:n}});a&&J.apply(i,a.serialize())}function Mc(e){return e!=null}function Nc(){return{p:null,s:null,v:null,t:null,f:null,si:null,ref:null,xf:null}}function Pc(e){let t=H.ff,n=H.fs;if(!e){let e=`${n}pt ${t}`;return{fontCache:e,fontString:e,fontSize:n,originFontSize:n,fontFamily:t}}let r=zn.ITALIC;(e.it===0||e.it===void 0)&&(r=zn.NORMAL);let i=zn.BOLD;(e.bl===0||e.bl===void 0)&&(i=zn.NORMAL);let a=n;e.fs&&(a=Math.ceil(e.fs));let o=t;if(e.ff){let n=e.ff;n=n.replace(/"/g,``).replace(/'/g,``),n.indexOf(` `)>-1&&(n=`"${n}"`),n==null&&(n=t),o=n}let{va:s}=e,c=a;if(s===pn.SUBSCRIPT||s===pn.SUPERSCRIPT){let{sbr:e,spr:t}=Fc(o,c);c*=s===pn.SUBSCRIPT?e:t}let l=`${r} ${i} ${c}pt ${o}`;return{fontCache:l,fontString:`${l}, "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif `,fontSize:c,originFontSize:a,fontFamily:o}}function Fc(e,t){return Dc(t)}function Ic(e){let{a:t=0,v:n=E.FALSE}=e||{a:0,v:E.FALSE},r=0,i=t;return n===E.TRUE&&(r=90,i=90),{centerAngle:r,vertexAngle:i}}function Q(e){if(typeof e!=`object`||!e)return e;if(Array.isArray(e)){let t=e.length,n=Array(t);for(let r=0;r<t;r++)n[r]=Q(e[r]);return n}let t={},n=Object.keys(e);for(let r=0,i=n.length;r<i;r++){let i=n[r];t[i]=Q(e[i])}return t}function Lc(e){if(e==null)return e;let t={};return e.p!==void 0&&(t.p=e.p===null?null:Q(e.p)),e.s!==void 0&&(e.s===null||typeof e.s==`string`?t.s=e.s:t.s=Q(e.s)),e.v!==void 0&&(t.v=e.v),e.t!==void 0&&(t.t=e.t),e.f!==void 0&&(t.f=e.f),e.ref!==void 0&&(t.ref=e.ref),e.xf!==void 0&&(t.xf=e.xf),e.si!==void 0&&(t.si=e.si),e.custom!==void 0&&(t.custom=e.custom===null?null:Q(e.custom)),t}function Rc(e){if(e==null)return e;let t={};return e.p!==void 0&&(t.p=e.p===null?null:Q(e.p)),e.s!==void 0&&(e.s===null||typeof e.s==`string`?t.s=e.s:t.s=Q(e.s)),e.v!==void 0&&(t.v=e.v),e.t!==void 0&&(t.t=e.t),e.f!==void 0&&(t.f=e.f),e.ref!==void 0&&(t.ref=e.ref),e.xf!==void 0&&(t.xf=e.xf),e.si!==void 0&&(t.si=e.si),e.custom!==void 0&&(t.custom=e.custom===null?null:Q(e.custom)),e.rowSpan!==void 0&&(t.rowSpan=e.rowSpan),e.colSpan!==void 0&&(t.colSpan=e.colSpan),e.displayV!==void 0&&(t.displayV=e.displayV),t}function zc(e){let t={},n=Object.keys(e);for(let r=0,i=n.length;r<i;r++){let i=n[r],a=Number(i),o=e[a];if(o===void 0)continue;let s={},c=Object.keys(o);for(let e=0,t=c.length;e<t;e++){let t=c[e],n=Number(t),r=o[n];r!=null&&(s[n]=Lc(r))}t[a]=s}return t}function Bc(e){let t={},n=Object.keys(e);for(let r=0,i=n.length;r<i;r++){let i=n[r],a=Number(i),o=e[a];if(o===void 0)continue;let s={};`h`in o&&o.h!==void 0&&(s.h=o.h),`ia`in o&&o.ia!==void 0&&(s.ia=o.ia),`ah`in o&&o.ah!==void 0&&(s.ah=o.ah),`hd`in o&&o.hd!==void 0&&(s.hd=o.hd),`w`in o&&o.w!==void 0&&(s.w=o.w),`s`in o&&o.s!==void 0&&(o.s===null||typeof o.s==`string`?s.s=o.s:s.s=Q(o.s)),`custom`in o&&o.custom!==void 0&&(s.custom=o.custom===null?null:Q(o.custom)),t[a]=s}return t}function Vc(e){let t=e.length,n=Array(t);for(let r=0;r<t;r++){let t=e[r];n[r]={startRow:t.startRow,startColumn:t.startColumn,endRow:t.endRow,endColumn:t.endColumn,rangeType:t.rangeType,startAbsoluteRefType:t.startAbsoluteRefType,endAbsoluteRefType:t.endAbsoluteRefType}}return n}function Hc(e){let t={id:e.id,name:e.name,tabColor:e.tabColor,hidden:e.hidden,rowCount:e.rowCount,columnCount:e.columnCount,zoomRatio:e.zoomRatio,scrollTop:e.scrollTop,scrollLeft:e.scrollLeft,defaultColumnWidth:e.defaultColumnWidth,defaultRowHeight:e.defaultRowHeight,showGridlines:e.showGridlines,rightToLeft:e.rightToLeft,freeze:{xSplit:e.freeze.xSplit,ySplit:e.freeze.ySplit,startRow:e.freeze.startRow,startColumn:e.freeze.startColumn},rowHeader:{width:e.rowHeader.width,hidden:e.rowHeader.hidden},columnHeader:{height:e.columnHeader.height,hidden:e.columnHeader.hidden},mergeData:Vc(e.mergeData),cellData:zc(e.cellData),rowData:Bc(e.rowData),columnData:Bc(e.columnData)};return e.gridlinesColor!==void 0&&(t.gridlinesColor=e.gridlinesColor),e.defaultStyle!==void 0&&(e.defaultStyle===null||typeof e.defaultStyle==`string`?t.defaultStyle=e.defaultStyle:t.defaultStyle=Q(e.defaultStyle)),e.custom!==void 0&&(t.custom=e.custom===null?null:Q(e.custom)),t}var Uc=class{constructor(e,t){this._config=e,v(this,`_columnData`,{}),this._columnData=t}getColumnData(){return this._columnData}getColVisible(e){let{_columnData:t}=this,n=t[e];return n?n.hd!==E.TRUE:!0}getColumnStyle(e){var t;return(t=this._columnData[e])==null?void 0:t.s}setColumnStyle(e,t){let n=this.getColumnOrCreate(e);n.s=t}getHiddenCols(e=0,t=this.getSize()-1){let n=[],r=!1,i=-1;for(let a=e;a<=t;a++){let e=this.getColVisible(a);r&&e?(r=!1,n.push({rangeType:L.COLUMN,startColumn:i,endColumn:a-1,startRow:0,endRow:0})):!r&&!e&&(r=!0,i=a)}return r&&n.push({startRow:0,endRow:0,startColumn:i,endColumn:t,rangeType:L.COLUMN}),n}getVisibleCols(e=0,t=this.getSize()-1){let n=[],r=!1,i=-1;for(let a=e;a<=t;a++){let e=this.getColVisible(a);r&&!e?(r=!1,n.push({rangeType:L.COLUMN,startColumn:i,endColumn:a-1,startRow:0,endRow:0})):!r&&e&&(r=!0,i=a)}return r&&n.push({startRow:0,endRow:0,startColumn:i,endColumn:t,rangeType:L.COLUMN}),n}getColumnDatas(e,t){let n={},r=0;for(let i=e;i<e+t;i++){let e=this.getColumn(i);n[r]=e==null?{w:this._config.defaultColumnWidth,hd:E.FALSE}:e,r++}return n}getSize(){return ui(this._columnData)}getColumnWidth(e){var t,n;return(t=(n=this._columnData[e])==null?void 0:n.w)==null?this._config.defaultColumnWidth:t}setColumnWidth(e,t){let n=this._columnData[e];t===this._config.defaultColumnWidth?n&&(delete n.w,Object.keys(n).length===0&&delete this._columnData[e]):this._columnData[e]=n?{...n,w:t}:{w:t}}getColumn(e){return this._columnData[e]}insertColumnsWithData(e,t,n){let r=t-e+1,i=Object.keys(this._columnData);for(let t=i.length-1;t>=0;t--){let n=Number(i[t]);n>=e&&(this._columnData[n+r]=this._columnData[n],delete this._columnData[n])}for(let r=e;r<=t;r++){let t=n==null?void 0:n[r-e];t!=null&&Object.keys(t).length>0&&(this._columnData[r]={...t})}}removeColumn(e){delete this._columnData[e]}getColumnOrCreate(e){let{_columnData:t}=this,n=t[e];if(n)return n;let r={};return this._columnData[e]=r,r}setCustomMetadata(e,t){let n=this.getColumn(e);n&&(n.custom=t)}getCustomMetadata(e){var t;return(t=this.getColumn(e))==null?void 0:t.custom}},Wc=class{constructor(e,t,n){this._config=e,this._viewModel=t,v(this,`_rowData`,void 0),this._rowData=n}getRowData(){return this._rowData}getRowStyle(e){var t;return(t=this._rowData[e])==null?void 0:t.s}setRowStyle(e,t){let n=this.getRowOrCreate(e);n.s=t}getRowDatas(e,t){let n={},r=0;for(let i=e;i<e+t;i++){let e=this.getRow(i);n[r]=e==null?{h:this._config.defaultRowHeight,hd:E.FALSE}:e,r++}return n}getRowHeight(e,t=1){let{_rowData:n}=this,r=this._config,i=0;for(let a=0;a<t;a++){let{ia:t,ah:o,h:s=r.defaultRowHeight}=n[a+e]||{hd:E.FALSE,h:r.defaultRowHeight};i+=(t==null||t===E.TRUE)&&typeof o==`number`?o:s}return i}setRowHeight(e,t){let n=this._rowData[e];if(t===this._config.defaultRowHeight)n&&(delete n.h,Object.keys(n).length===0&&delete this._rowData[e]);else{let r=Math.min(t,2e3);this._rowData[e]=n?{...n,h:r}:{h:r}}}getRow(e){return this._rowData[e]}insertRowsWithData(e,t,n){let r=t-e+1,i=Object.keys(this._rowData);for(let t=i.length-1;t>=0;t--){let n=Number(i[t]);n>=e&&(this._rowData[n+r]=this._rowData[n],delete this._rowData[n])}for(let r=e;r<=t;r++){let t=n==null?void 0:n[r-e];t!=null&&Object.keys(t).length>0&&(this._rowData[r]={...t})}}removeRow(e){delete this._rowData[e]}getRowOrCreate(e){let{_rowData:t}=this,n=t[e];if(n)return n;let r={};return t[e]=r,r}getHiddenRows(e=0,t=this.getSize()-1){let n=[],r=!1,i=-1;for(let a=e;a<=t;a++){let e=this.getRowRawVisible(a);r&&e?(r=!1,n.push({startRow:i,endRow:a-1,startColumn:0,endColumn:0,rangeType:L.ROW})):!r&&!e&&(r=!0,i=a)}return r&&n.push({startRow:i,endRow:t,startColumn:0,endColumn:0,rangeType:L.ROW}),n}getVisibleRows(e=0,t=this.getSize()-1){let n=[],r=!1,i=-1;for(let a=e;a<=t;a++){let e=this.getRowRawVisible(a);r&&!e?(r=!1,n.push({startRow:i,endRow:a-1,startColumn:0,endColumn:0,rangeType:L.ROW})):!r&&e&&(r=!0,i=a)}return r&&n.push({startRow:i,endRow:t,startColumn:0,endColumn:0,rangeType:L.ROW}),n}getRowRawVisible(e){let t=this.getRow(e);return t?t.hd!==E.TRUE:!0}getSize(){return ui(this._rowData)}setCustomMetadata(e,t){let n=this.getRow(e);n&&(n.custom=t)}getCustomMetadata(e){var t;return(t=this.getRow(e))==null?void 0:t.custom}};const Gc=1e3;function Kc(e){let t={name:`Sheet1`,id:`sheet-01`,tabColor:``,hidden:E.FALSE,rowCount:Gc,columnCount:20,zoomRatio:1,freeze:{xSplit:0,ySplit:0,startRow:-1,startColumn:-1},scrollTop:0,scrollLeft:0,defaultColumnWidth:88,defaultRowHeight:24,mergeData:[],cellData:{},rowData:{},columnData:{},showGridlines:E.TRUE,rowHeader:{width:46,hidden:E.FALSE},columnHeader:{height:20,hidden:E.FALSE},rightToLeft:E.FALSE};return Object.keys(t).forEach(n=>{let r=n;e[r]===void 0&&(e[r]=t[r])}),e}var qc=class extends x{constructor(e){super(),v(this,`_cellCache`,new Map),v(this,`_rowCache`,new Map),v(this,`_columnCache`,new Map),v(this,`_hasRow`,!1),v(this,`_hasColumn`,!1),v(this,`_hasAll`,!1),v(this,`_allIndex`,-1),v(this,`_mergeData`,void 0),v(this,`_rangeMap`,new ra(5e4)),this._init(e.concat())}_init(e){this._mergeData=e,this._createCache(e)}_clearCache(){this._cellCache.clear(),this._rowCache.clear(),this._columnCache.clear(),this._hasAll=!1,this._allIndex=-1,this._rangeMap.clear(),this._hasColumn=!1,this._hasRow=!1}_createCache(e){let t=0;for(let n of e){let{rangeType:e}=n;e===L.ROW?this._createRowCache(n,t):e===L.COLUMN?this._createColumnCache(n,t):e===L.ALL?this._createCellAllCache(t):this._createCellCache(n,t),t++}}rebuild(e){this._clearCache(),this._init(e.concat())}_createRowCache(e,t){let{startRow:n,endRow:r}=e;for(let e=n;e<=r;e++)this._rowCache.set(e,t),this._hasRow=!0}_createColumnCache(e,t){let{startColumn:n,endColumn:r}=e;for(let e=n;e<=r;e++)this._columnCache.set(e,t),this._hasColumn=!0}_createCellAllCache(e){this._hasAll=!0,this._allIndex=e}_createCellCache(e,t){for(let n=e.startRow;n<=e.endRow;n++){let r=this._cellCache.get(n);r==null&&(r=new Map,this._cellCache.set(n,r));for(let n=e.startColumn;n<=e.endColumn;n++)r.set(n,t)}}add(e){this._mergeData.push(e),this._clearCache(),this._createCache(this._mergeData)}remove(e,t){let n=this._getMergeDataIndex(e,t);n!==-1&&(this._mergeData.splice(n,1),this._clearCache(),this._createCache(this._mergeData))}getMergedCell(e,t){let n=this._getMergeDataIndex(e,t);return n===-1?null:this._mergeData[n]}getMergeDataIndex(e,t){return this._getMergeDataIndex(e,t)}isRowContainsMergedCell(e){return this._hasAll||!S.isEmptyObject(this._columnCache)?!0:this._mergeData.some(t=>t.startRow<=e&&e<=t.endRow)}isColumnContainsMergedCell(e){return this._hasAll||!S.isEmptyObject(this._rowCache)?!0:this._mergeData.some(t=>t.startColumn<=e&&e<=t.endColumn)}getMergedCellRange(e,t,n,r){let i=[],a=`${e}-${t}-${n}-${r}`;if(this._rangeMap.has(a))return this._getRangeFromCache(a);let o=0,s=[];for(let a of this._mergeData||[])U.intersects(a,{startRow:e,endRow:n,startColumn:t,endColumn:r})&&(i.push({...a}),s.push(o)),o++;return this._rangeMap.set(a,s),i}_getRangeFromCache(e){let t=this._rangeMap.get(e)||[],n=[];for(let e of t)n.push({...this._mergeData[e]});return n}_getMergeDataIndex(e,t){var n;if(this._hasAll)return this._allIndex;if(this._hasRow){let t=this._rowCache.get(e);if(t!==void 0)return t}if(this._hasColumn){let e=this._columnCache.get(t);if(e!==void 0)return e}let r=(n=this._cellCache.get(e))==null?void 0:n.get(t);return r===void 0?-1:r}getMergeDataSnapshot(){return this._mergeData}dispose(){this._clearCache(),this._mergeData=[]}},Jc=class extends x{constructor(e){super(),this.getRawCell=e,v(this,`_cellContentInterceptor`,null),v(this,`_rowFilteredInterceptor`,null)}dispose(){super.dispose(),this._cellContentInterceptor=null,this._rowFilteredInterceptor=null}getCell(e,t,n,r){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(e,t,We.Value|We.Style,n,r):this.getRawCell(e,t)}getCellValueOnly(e,t){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(e,t,We.Value):this.getRawCell(e,t)}getCellStyleOnly(e,t){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(e,t,We.Style):this.getRawCell(e,t)}getRowFiltered(e){var t,n;return(t=(n=this._rowFilteredInterceptor)==null?void 0:n.getRowFiltered(e))==null?!1:t}registerCellContentInterceptor(e){if(this._cellContentInterceptor)throw Error(`[SheetViewModel]: Interceptor already registered.`);return this._cellContentInterceptor=e,b(()=>this._cellContentInterceptor=null)}registerRowFilteredInterceptor(e){if(this._rowFilteredInterceptor)throw Error(`[SheetViewModel]: Interceptor already registered.`);return this._rowFilteredInterceptor=e,b(()=>this._rowFilteredInterceptor=null)}};const Yc={isDeepClone:!1,displayRawFormula:!1,ignoreTextRotation:!1};var Xc=class e{constructor(e,t,n){var r;this.unitId=e,this._styles=n,v(this,`_sheetId`,void 0),v(this,`_snapshot`,void 0),v(this,`_cellData`,void 0),v(this,`_rowManager`,void 0),v(this,`_columnManager`,void 0),v(this,`_viewModel`,void 0),v(this,`_spanModel`,void 0),v(this,`_isRowStylePrecedeColumnStyle`,!0),v(this,`_getCellHeight`,void 0),this._snapshot=Kc(t);let{columnData:i,rowData:a,cellData:o}=this._snapshot;this._sheetId=(r=this._snapshot.id)==null?C(6):r,this._cellData=new yi(o),this._viewModel=new Jc((e,t)=>this.getCellRaw(e,t)),this._rowManager=new Wc(this._snapshot,this._viewModel,a),this._columnManager=new Uc(this._snapshot,i),this._spanModel=new qc(this._snapshot.mergeData)}__interceptViewModel(e){e(this._viewModel)}__registerGetCellHeight(e){return this._getCellHeight=e,b(()=>{this._getCellHeight=null})}getSnapshot(){return this._snapshot}getCellHeight(e,t){return this._getCellHeight?this._getCellHeight(e,t):this._snapshot.defaultRowHeight}setMergeData(e){this._snapshot.mergeData=e,this.getSpanModel().rebuild(e)}getSpanModel(){return this._spanModel}setIsRowStylePrecedeColumnStyle(e){this._isRowStylePrecedeColumnStyle=e}getStyleDataByHash(e){return{...this._styles.get(e)}}setStyleData(e){return this._styles.setValue(e)}getColumnStyle(e,t=!1){return t?this._columnManager.getColumnStyle(e):this._styles.get(this._columnManager.getColumnStyle(e))}setColumnStyle(e,t){this._columnManager.setColumnStyle(e,t)}getRowStyle(e,t=!1){return t?this._rowManager.getRowStyle(e):this._styles.get(this._rowManager.getRowStyle(e))}setRowStyle(e,t){this._rowManager.setRowStyle(e,t)}getDefaultCellStyle(){return this._snapshot.defaultStyle}getDefaultCellStyleInternal(){let e=this._snapshot.defaultStyle;return this._styles.get(e)}setDefaultCellStyle(e){this._snapshot.defaultStyle=e}getCellStyle(e,t){let n=this.getCell(e,t);if(n){let e=n.s;return typeof e==`string`?this._styles.get(e):e}return null}getComposedCellStyle(e,t,n){let r=this.getDefaultCellStyleInternal(),i=this.getRowStyle(e),a=this.getColumnStyle(t),o=this.getCell(e,t),s=this._styles.getStyleByCell(o);return(n==null?this._isRowStylePrecedeColumnStyle:n)?Lt(r,a,i,o==null?void 0:o.themeStyle,s):Lt(r,i,a,o==null?void 0:o.themeStyle,s)}getComposedCellStyleByCellData(e,t,n,r){let i=this.getDefaultCellStyleInternal(),a=this.getRowStyle(e),o=this.getColumnStyle(t),s=this._styles.getStyleByCell(n);return(r==null?this._isRowStylePrecedeColumnStyle:r)?Lt(i,o,a,n==null?void 0:n.themeStyle,s):Lt(i,a,o,n==null?void 0:n.themeStyle,s)}getComposedCellStyleWithoutSelf(e,t,n,r){let i=n===void 0?this.getComposedCellStyle(e,t,r):this.getComposedCellStyleByCellData(e,t,n,r),a=this.getCellRaw(e,t);if(!a||!a.s)return i;let o=typeof a.s==`string`?this._styles.get(a.s):a.s;if(!o)return i;for(let e in o)e in i&&delete i[e];return i}getCellMatrix(){return this._cellData}getCellMatrixPrintRange(){let e=this.getCellMatrix(),t=this.getMergeData(),n=-1,r=-1,i=-1,a=-1,o=!1,s=!1;return e.forEach((t,c)=>{Object.keys(c).forEach(c=>{let l=+c,u=e.getValue(t,l),d=u!=null&&u.s?this._styles.get(u.s):null,f=(d==null?void 0:d.bd)&&(d.bd.b||d.bd.l||d.bd.r||d.bd.t||d.bd.bc_tr||d.bd.bl_tr||d.bd.ml_tr||d.bd.tl_bc||d.bd.tl_br||d.bd.tl_mr);(u&&(u.v!==null&&u.v!==void 0&&u.v!==``||u.p)||d!=null&&d.bg||f)&&(o?n=Math.min(n,t):(n=t,o=!0),r=Math.max(r,t),s?i=Math.min(i,l):(s=!0,i=l),a=Math.max(a,l))})}),t.forEach(e=>{o?n=Math.min(n,e.startRow):(n=e.startRow,o=!0),r=Math.max(r,e.endRow),s?i=Math.min(i,e.startColumn):(i=e.startColumn,o=!0),a=Math.max(a,e.endColumn)}),!o||!s?null:{startColumn:i,startRow:n,endColumn:a,endRow:r}}getRowManager(){return this._rowManager}getUnitId(){return this.unitId}getSheetId(){return this._sheetId}getColumnManager(){return this._columnManager}getName(){return this._snapshot.name}clone(){let{_snapshot:t}=this,n=Hc(t);return new e(this.unitId,n,this._styles)}getMergeData(){return this._spanModel.getMergeDataSnapshot()}getMergedCell(e,t){return this._spanModel.getMergedCell(e,t)}getMergedCellRange(e,t,n,r){return this._spanModel.getMergedCellRange(e,t,n,r)}isRowContainsMergedCell(e){return this._spanModel.isRowContainsMergedCell(e)}isColumnContainsMergedCell(e){return this._spanModel.isColumnContainsMergedCell(e)}getCellInfoInMergeData(e,t){let n=this.getMergedCell(e,t),r=!1,i=!1,a=e,o=t,s=e,c=t;if(n){let{startRow:l,endRow:u,startColumn:d,endColumn:f}=n;e===l&&t===d?(a=u,o=f,s=l,c=d,i=!0):e>=l&&e<=u&&t>=d&&t<=f&&(a=u,o=f,s=l,c=d,r=!0)}return{actualRow:e,actualColumn:t,isMergedMainCell:i,isMerged:r,endRow:a,endColumn:o,startRow:s,startColumn:c}}getCell(e,t){return e<0||t<0?null:this._viewModel.getCell(e,t)}getCellValueOnly(e,t){return e<0||t<0?null:this._viewModel.getCellValueOnly(e,t)}getCellStyleOnly(e,t){return e<0||t<0?null:this._viewModel.getCellStyleOnly(e,t)}getCellRaw(e,t){return this.getCellMatrix().getValue(e,t)}getCellWithFilteredInterceptors(e,t,n,r){return this._viewModel.getCell(e,t,n,r)}getRowFiltered(e){return this._viewModel.getRowFiltered(e)}getRangeFilterRows(e){let t=[];for(let n=e.startRow;n<=e.endRow;n++)this.getRowFiltered(n)&&t.push(n);return t}getMatrixWithMergedCells(e,t,n,r,i=ei.Raw){let a=this.getCellMatrix(),o=this._spanModel.getMergedCellRange(e,t,n,r),s=new yi;return Ia(e,n,t,r).forEach((e,t)=>{let n;if(i===ei.Raw)n=this.getCellRaw(e,t);else if(i===ei.Intercepted)n=this.getCell(e,t);else if(i===ei.Both){let i=this.getCellRaw(e,t);if(i){var r;n={...i};let a=(r=this.getCell(e,t))==null?void 0:r.v;Mc(a)&&n&&(n.displayV=String(a))}}n&&s.setValue(e,t,n)}),o.forEach(e=>{let{startColumn:t,startRow:n,endColumn:r,endRow:i}=e;Ia(n,i,t,r).forEach((e,o)=>{e===n&&o===t&&s.setValue(e,o,{...a.getValue(e,o),rowSpan:i-n+1,colSpan:r-t+1}),(e!==n||o!==t)&&s.realDeleteValue(e,o)})}),s}getRange(e,t,n,r){return typeof e==`object`?new ya(this,e,{getStyles:()=>this._styles}):new ya(this,{startRow:e,startColumn:t,endColumn:r||t,endRow:n||e},{getStyles:()=>this._styles})}getScrollLeftTopFromSnapshot(){return{scrollLeft:this._snapshot.scrollLeft,scrollTop:this._snapshot.scrollTop}}getZoomRatio(){return this._snapshot.zoomRatio||1}getConfig(){return this._snapshot}getFreeze(){return this._snapshot.freeze}getMaxColumns(){let{_snapshot:e}=this,{columnCount:t}=e;return t}getMaxRows(){let{_snapshot:e}=this,{rowCount:t}=e;return t}getRowCount(){return this._snapshot.rowCount}setRowCount(e){this._snapshot.rowCount=e}getColumnCount(){return this._snapshot.columnCount}setColumnCount(e){this._snapshot.columnCount=e}isSheetHidden(){return this._snapshot.hidden}hasHiddenGridlines(){let{_snapshot:e}=this,{showGridlines:t}=e;return t===0}getGridlinesColor(){return this.getConfig().gridlinesColor}getTabColor(){let{_snapshot:e}=this,{tabColor:t}=e;return t}getColumnWidth(e){return this.getColumnManager().getColumnWidth(e)}getRowHeight(e){return this._viewModel.getRowFiltered(e)?0:this.getRowManager().getRowHeight(e)}isRowFiltered(e){return this._viewModel.getRowFiltered(e)}getRowVisible(e){return!this.isRowFiltered(e)&&this.getRowRawVisible(e)}getRowRawVisible(e){return this.getRowManager().getRowRawVisible(e)}getHiddenRows(e,t){let n=this.getMaxColumns()-1,r=this._rowManager.getHiddenRows(e,t);return r.forEach(e=>e.endColumn=n),r}getColVisible(e){return this._columnManager.getColVisible(e)}getHiddenCols(e,t){let n=this.getMaxRows()-1,r=this._columnManager.getHiddenCols(e,t);return r.forEach(e=>e.endRow=n),r}getVisibleRows(){let e=this.getRowCount();return this._rowManager.getVisibleRows(0,e-1)}getVisibleCols(){let e=this.getColumnCount();return this._columnManager.getVisibleCols(0,e-1)}isRightToLeft(){let{_snapshot:e}=this,{rightToLeft:t}=e;return t}getLastRowWithContent(){return this._cellData.getRealRowRange().endRow}getLastColumnWithContent(){return this.getDataRealRange().endColumn}getDataRealRange(){return this._cellData.getRealRange()}getDataRangeScope(){return this._cellData.getStartEndScope()}cellHasValue(e){return e&&(e.v!==void 0||e.f!==void 0||e.p!==void 0)}iterateByRow(e,t=!0){let{startRow:n,startColumn:r,endRow:i,endColumn:a}=e,o=this;return{[Symbol.iterator]:()=>{let e=n,s=r;return{next(){for(;;){if(s>a&&(e+=1,s=r),e>i)return{done:!0,value:void 0};let n=o.getCell(e,s),c=!n,l=o.getMergedCell(e,s);if(l){if(e!==l.startRow||s!==l.startColumn){s=l.endColumn+1;continue}if(c&&t){s=l.endColumn+1;continue}let r={row:e,col:s,value:n};return r.colSpan=l.endColumn-l.startColumn+1,r.rowSpan=l.endRow-l.startRow+1,s=l.endColumn+1,{done:!1,value:r}}if(c&&t)s+=1;else{let t={row:e,col:s,value:n};return s+=1,{done:!1,value:t}}}}}}}}iterateByColumn(e,t=!0,n=!0){let{startRow:r,startColumn:i,endRow:a,endColumn:o}=e,s=this;return{[Symbol.iterator]:()=>{let e=r,c=i;return{next(){for(;;){if(e>a&&(c+=1,e=r),c>o)return{done:!0,value:void 0};let i=s.getMergedCell(e,c);if(i){let r=e!==i.startRow,a=r||c!==i.startColumn;if(n&&a||!n&&r){e=i.endRow+1;continue}let o=s.getCell(i.startRow,i.startColumn);if(!o&&t){e=i.endRow+1;continue}let l={row:e,col:i.startColumn,value:o};return l.colSpan=i.endColumn-i.startColumn+1,l.rowSpan=i.endRow-i.startRow+1,e=i.endRow+1,{done:!1,value:l}}let l=s.getCell(e,c);if(!l&&t)e+=1;else{let t={row:e,col:c,value:l};return e+=1,{done:!1,value:t}}}}}}}}getCellDocumentModel(e,t,n=Yc){var r;if(!e)return;let{isDeepClone:i,displayRawFormula:a,ignoreTextRotation:o}={...Yc,...n},s,c=`document`,l=kc(t),u=o?H.tr:l.textRotation||H.tr,d=l.horizontalAlign||H.ht,f=l.verticalAlign||H.vt,p=l.wrapStrategy||H.tb,m=l.paddingData||Ec;if(e.f&&a)s=Oc(e.f.toString(),{},{verticalAlign:f}),d=H.ht;else if(e.p){let{centerAngle:t,vertexAngle:n}=Ic(u);s=this._updateConfigAndGetDocumentModel(i?S.deepClone(e.p):e.p,d,m,{horizontalAlign:d,verticalAlign:f,centerAngle:t,vertexAngle:n,wrapStrategy:p,zeroWidthParagraphBreak:1})}else if(e.v!=null){let n=Ac(t);c=Pc(n).fontCache;let r=Zc(e);e.t===mn.FORCE_STRING&&a&&(r=`'${r}`),s=Oc(r,n,{...l,textRotation:u,cellValueType:e.t})}return s&&e.linkUrl&&e.linkId&&jc(s,e.linkUrl,e.linkId),{documentModel:s,fontString:c,textRotation:u,wrapStrategy:p,verticalAlign:f,horizontalAlign:d,paddingData:m,fill:t==null||(r=t.bg)==null?void 0:r.rgb}}_updateConfigAndGetDocumentModel(e,t,n,r){var i,a,o,s,c;if(!r||!((i=e.body)!=null&&i.dataStream))return;e.documentStyle||(e.documentStyle={}),e.documentStyle.marginTop=(a=n.t)==null?0:a,e.documentStyle.marginBottom=(o=n.b)==null?2:o,e.documentStyle.marginLeft=(s=n.l)==null?2:s,e.documentStyle.marginRight=(c=n.r)==null?2:c,e.documentStyle.pageSize={width:1/0,height:1/0},e.documentStyle.renderConfig={...e.documentStyle.renderConfig,...r};let l=e.body.paragraphs||[];for(let e of l)e.paragraphStyle||(e.paragraphStyle={}),e.paragraphStyle.horizontalAlign=t;return new ls(e)}getBlankCellDocumentModel(e,t,n){let r=this.getComposedCellStyleByCellData(t,n,e),i=Ac(r),a=this.getCellDocumentModel(e,r,{ignoreTextRotation:!0});if(a!=null)return a.documentModel==null&&(a.documentModel=Oc(``,i)),a;let o=`document`,s=H.tr,c=H.ht,l=H.vt,u=H.tb,d=Ec;return o=Pc({}).fontCache,{documentModel:Oc(``,i),fontString:o,textRotation:s,wrapStrategy:u,verticalAlign:l,horizontalAlign:c,paddingData:d}}getCellDocumentModelWithFormula(e,t,n){let r=this.getComposedCellStyleByCellData(t,n,e);return this.getCellDocumentModel(e,r,{isDeepClone:!0,displayRawFormula:!0,ignoreTextRotation:!0})}getCustomMetadata(){return this._snapshot.custom}setCustomMetadata(e){this._snapshot.custom=e}};function Zc(e){var t;if(!e)return``;let n=(t=e.p)==null||(t=t.body)==null?void 0:t.dataStream;if(n)return Z.transform.getPlainText(n);let r=e.v;return typeof r==`string`?e.t===mn.BOOLEAN?r.toUpperCase():r.replace(/[\r\n]/g,``):typeof r==`number`?e.t===mn.BOOLEAN?r?`TRUE`:`FALSE`:r.toString():typeof r==`boolean`?r?`TRUE`:`FALSE`:``}function Qc(e){if(e===null)return``;if(e!=null&&e.p){let t=e==null?void 0:e.p.body;if(t==null)return``;let n=t.dataStream;return Z.transform.getPlainText(n)}return e==null?void 0:e.v}function $c(e,t){return`${e.getUnitId()}|${t.getSheetId()}`}let el=class extends Et{get _activeSheet(){return this._activeSheet$.getValue()}get name(){return this._name$.getValue()}static isIRangeType(e){return typeof e==`string`||`startRow`in e||`row`in e}constructor(e={},t){super(),this._logService=t,v(this,`type`,f.UniverType.UNIVER_SHEET),v(this,`_sheetCreated$`,new d.Subject),v(this,`sheetCreated$`,this._sheetCreated$.asObservable()),v(this,`_sheetDisposed$`,new d.Subject),v(this,`sheetDisposed$`,this._sheetDisposed$.asObservable()),v(this,`_activeSheet$`,new d.BehaviorSubject(null)),v(this,`activeSheet$`,this._activeSheet$.asObservable()),v(this,`_worksheets`,void 0),v(this,`_styles`,void 0),v(this,`_snapshot`,void 0),v(this,`_unitId`,void 0),v(this,`_count`,void 0),v(this,`_name$`,void 0),v(this,`name$`,void 0);let n=Sc();S.isEmptyObject(e)?this._snapshot=n:this._snapshot=S.commonExtend(n,e);let{styles:r}=this._snapshot;(this._snapshot.id==null||this._snapshot.id.length===0)&&(this._snapshot.id=C(6)),this._unitId=this._snapshot.id,this._styles=new Cc(r),this._count=1,this._worksheets=new Map,this._name$=new d.BehaviorSubject(e.name||``),this.name$=this._name$.asObservable(),this._parseWorksheetSnapshots()}dispose(){super.dispose(),this._sheetCreated$.complete(),this._sheetDisposed$.complete(),this._activeSheet$.complete(),this._name$.complete(),Array.from(this._worksheets.keys()).forEach(e=>{this._removeSheet(e)})}save(){return S.deepClone(this._snapshot)}getSnapshot(){return this._snapshot}getName(){return this._snapshot.name}setName(e){this._name$.next(e),this._snapshot.name=e}getUnitId(){return this._unitId}getRev(){var e;return(e=this._snapshot.rev)==null?1:e}incrementRev(){this._snapshot.rev=this.getRev()+1}setRev(e){this._snapshot.rev=e}addWorksheet(e,t,n){let{sheets:r,sheetOrder:i}=this._snapshot;if(r[e])return!1;r[e]=n,i.splice(t,0,e),this.ensureSheetOrderUnique();let a=new Xc(this._unitId,n,this._styles);return this._worksheets.set(e,a),this._sheetCreated$.next(a),!0}getSheetOrders(){return this._snapshot.sheetOrder}ensureSheetOrderUnique(){let e=new Set,t=[];for(let n of this._snapshot.sheetOrder)e.has(n)||(e.add(n),t.push(n));this._snapshot.sheetOrder=t,e.clear()}getWorksheets(){return this._worksheets}getActiveSpreadsheet(){return this}getStyles(){return this._styles}addStyles(e){Object.entries(e).forEach(([e,t])=>{this._styles.addCustomStyle(e,t)})}removeStyles(e){e.forEach(e=>{this._styles.remove(e)})}getConfig(){return this._snapshot}getIndexBySheetId(e){let{sheetOrder:t}=this._snapshot;return t.findIndex(t=>t===e)}getActiveSheet(e){if(!this._activeSheet&&e===void 0)throw Error(`[Workbook]: no active Worksheet on Workbook ${this._unitId}!`);return this._activeSheet}ensureActiveSheet(){let e=this._activeSheet;if(e)return e;let t=this._snapshot.sheetOrder;for(let e=0,n=t.length;e<n;e++){let n=this._worksheets.get(t[e]);if(n&&n.isSheetHidden()!==E.TRUE)return this.setActiveSheet(n),n}let n=this._worksheets.get(t[0]);return this.setActiveSheet(n),n}setActiveSheet(e){this._activeSheet$.next(e)}_removeSheet(e){let t=this._worksheets.get(e);return t?(this._worksheets.delete(e),this._snapshot.sheetOrder.splice(this._snapshot.sheetOrder.indexOf(e),1),this.ensureSheetOrderUnique(),this._sheetDisposed$.next(t),!0):!1}removeSheet(e){let t=this._removeSheet(e);return t&&delete this._snapshot.sheets[e],t}getActiveSheetIndex(){let{sheetOrder:e}=this._snapshot;return e.findIndex(e=>this._worksheets.get(e)===this._activeSheet)}getSheetSize(){return this._snapshot.sheetOrder.length}getSheets(){let{sheetOrder:e}=this._snapshot;return e.map(e=>this._worksheets.get(e))}getSheetsName(){let{sheetOrder:e}=this._snapshot,t=[];return e.forEach(e=>{let n=this._worksheets.get(e);n&&t.push(n.getName())}),t}getSheetIndex(e){let{sheetOrder:t}=this._snapshot;return t.findIndex(t=>e.getSheetId()===t)}getSheetBySheetName(e){let{sheetOrder:t}=this._snapshot,n=t.find(t=>this._worksheets.get(t).getName()===e);return this._worksheets.get(n)}getSheetBySheetId(e){return this._worksheets.get(e)}getSheetByIndex(e){let{sheetOrder:t}=this._snapshot;return this._worksheets.get(t[e])}getHiddenWorksheets(){return this.getSheets().filter(e=>e.getConfig().hidden===E.TRUE).map(e=>e.getConfig().id)}getUnhiddenWorksheets(){return this.getSheets().filter(e=>e.getConfig().hidden!==E.TRUE).map(e=>e.getConfig().id)}load(e){this._snapshot=e}checkSheetName(e){return this.getSheetsName().some(t=>t.toLowerCase()===e.toLowerCase())}uniqueSheetName(e=`Sheet1`){let t=e;for(;this.checkSheetName(t);)t=e+this._count,this._count++;return t}generateNewSheetName(e){let t=e+this._count;for(;this.checkSheetName(t);)t=e+this._count,this._count++;return t}_parseWorksheetSnapshots(){let{_snapshot:e,_worksheets:t}=this,{sheets:n,sheetOrder:r}=e;if(S.isEmptyObject(n)){let e=C();n[e]={id:e}}for(let e in n){let i=n[e],{name:a}=i;i.name=this.uniqueSheetName(a),i.name!==a&&this._logService.debug(`[Workbook]`,`The worksheet name ${a} is duplicated, we changed it to ${i.name}. Please fix the problem in your snapshot.`);let o=new Xc(this._unitId,i,this._styles);t.set(e,o),r.includes(e)||r.push(e)}this.ensureSheetOrderUnique(),this.ensureActiveSheet()}getCustomMetadata(){return this._snapshot.custom}setCustomMetadata(e){this._snapshot.custom=e}};el=F([P(1,N)],el);var tl=class extends Et{get _activePage(){let e=this._activePage$.getValue();if(!e){var t,n;let e=(t=this.getPageOrder())==null?void 0:t[0];return e?(n=this.getPages())==null?void 0:n[e]:null}return e}constructor(e){var t;super(),v(this,`type`,f.UniverType.UNIVER_SLIDE),v(this,`_activePage$`,new d.BehaviorSubject(null)),v(this,`activePage$`,this._activePage$.asObservable()),v(this,`_name$`,void 0),v(this,`name$`,void 0),v(this,`_snapshot`,void 0),v(this,`_unitId`,void 0),this._snapshot={...fa,...e},this._unitId=(t=this._snapshot.id)==null?C(6):t,this._name$=new d.BehaviorSubject(this._snapshot.title),this.name$=this._name$.asObservable()}setName(e){var t;this._snapshot.title=e,this._name$.next(e),this._unitId=(t=this._snapshot.id)==null?C(6):t}getRev(){return 0}incrementRev(){}setRev(e){}getSnapshot(){return this._snapshot}getUnitId(){return this._unitId}getPages(){var e;return(e=this._snapshot.body)==null?void 0:e.pages}getPageOrder(){var e;return(e=this._snapshot.body)==null?void 0:e.pageOrder}getPage(e){let t=this.getPages();return t==null?void 0:t[e]}getElementsByPage(e){var t;return(t=this.getPage(e))==null?void 0:t.pageElements}getElement(e,t){var n;return(n=this.getElementsByPage(e))==null?void 0:n[t]}getPageSize(){return this._snapshot.pageSize}getBlankPage(){let e=C(6);return{id:e,pageType:Xn.SLIDE,zIndex:10,title:e,description:``,pageBackgroundFill:{rgb:`rgb(255,255,255)`},pageElements:{}}}setActivePage(e){this._activePage$.next(e)}getActivePage(){return this._activePage}updatePage(e,t){this._snapshot.body&&(this._snapshot.body.pages[e]=t)}appendPage(e){var t;if(!this._snapshot.body)return;this._snapshot.body.pages[e.id]=e;let n=this._activePage,r=this._snapshot.body.pageOrder.indexOf((t=n==null?void 0:n.id)==null?``:t);this._snapshot.body.pageOrder.splice(r+1,0,e.id)}};const nl=(0,l.createIdentifier)(`univer.current`);let rl=class extends x{constructor(e,t,n){super(),this._injector=e,this._contextService=t,this._logService=n,v(this,`_unitsByType`,new Map),v(this,`_createHandler`,void 0),v(this,`_ctorByType`,new Map),v(this,`_currentUnits`,new Map),v(this,`_currentUnits$`,new d.BehaviorSubject(this._currentUnits)),v(this,`currentUnits$`,this._currentUnits$.asObservable()),v(this,`_unitAdded$`,new d.Subject),v(this,`unitAdded$`,this._unitAdded$.asObservable()),v(this,`_unitDisposed$`,new d.Subject),v(this,`unitDisposed$`,this._unitDisposed$.asObservable()),v(this,`_focused$`,new d.BehaviorSubject(null)),v(this,`focused$`,this._focused$.asObservable())}dispose(){super.dispose(),this._focused$.complete(),this._currentUnits$.complete(),this._unitAdded$.complete(),this._currentUnits.forEach(e=>e==null?void 0:e.dispose()),this._currentUnits.clear(),this._unitsByType.clear()}__setCreateHandler(e){this._createHandler=e}createUnit(e,t,n){return this._createHandler(e,t,this._ctorByType.get(e),n)}registerCtorForType(e,t){return this._ctorByType.set(e,t),{dispose:()=>{this._ctorByType.delete(e)}}}getCurrentTypeOfUnit$(e){return this.currentUnits$.pipe((0,d.map)(t=>{var n;return(n=t.get(e))==null?null:n}),(0,d.distinctUntilChanged)())}getCurrentUnitForType(e){return this._currentUnits.get(e)}getCurrentUnitOfType(e){return this.getCurrentUnitForType(e)}setCurrentUnitForType(e){let t=this._getUnitById(e);if(!t)throw Error(`[UniverInstanceService]: no document with unitId ${e}!`);this._currentUnits.set(t[1],t[0]),this._currentUnits$.next(this._currentUnits)}getTypeOfUnitAdded$(e){return this._unitAdded$.pipe((0,d.filter)(t=>t.type===e))}__addUnit(e,t){var n;this._logService.debug(`[UniverInstanceService]: Adding unit with id ${e.getUnitId()}`);let r=e.type;this._unitsByType.has(r)||this._unitsByType.set(r,[]);let i=this._unitsByType.get(r),a=e.getUnitId();if(i.findIndex(e=>e.getUnitId()===a)!==-1)throw Error(`[UniverInstanceService]: cannot create a unit with the same unit id: ${a}.`);i.push(e),this._unitAdded$.next(e),((n=t==null?void 0:t.makeCurrent)==null||n)&&this.setCurrentUnitForType(e.getUnitId())}getTypeOfUnitDisposed$(e){return this.unitDisposed$.pipe((0,d.filter)(t=>t.type===e))}getUnit(e,t){var n;let r=(n=this._getUnitById(e))==null?void 0:n[0];return t&&(r==null?void 0:r.type)!==t?null:r}getCurrentUniverDocInstance(){return this.getCurrentUnitForType(f.UniverType.UNIVER_DOC)}getUniverDocInstance(e){return this.getUnit(e,f.UniverType.UNIVER_DOC)}getUniverSheetInstance(e){return this.getUnit(e,f.UniverType.UNIVER_SHEET)}getAllUnitsForType(e){var t;return(t=this._unitsByType.get(e))==null?[]:t}changeDoc(e,t){let n=this.getAllUnitsForType(f.UniverType.UNIVER_DOC),r=n.find(t=>t.getUnitId()===e);if(r!=null){let e=n.indexOf(r);n.splice(e,1)}this.__addUnit(t)}get focused(){var e;let t=this._focused$.getValue();return t?(e=this._getUnitById(t))==null?void 0:e[0]:null}focusUnit(e){this._focused$.next(e),this.focused instanceof el?(this._contextService.setContextValue(lc,!0),this._contextService.setContextValue(dc,!1),this._contextService.setContextValue(uc,!0),this._contextService.setContextValue(fc,!1),this.setCurrentUnitForType(e)):this.focused instanceof ls?(this._contextService.setContextValue(lc,!0),this._contextService.setContextValue(dc,!0),this._contextService.setContextValue(uc,!1),this._contextService.setContextValue(fc,!1),this.setCurrentUnitForType(e)):this.focused instanceof tl?(this._contextService.setContextValue(lc,!0),this._contextService.setContextValue(dc,!1),this._contextService.setContextValue(uc,!1),this._contextService.setContextValue(fc,!0),this.setCurrentUnitForType(e)):(this._contextService.setContextValue(lc,!1),this._contextService.setContextValue(dc,!1),this._contextService.setContextValue(uc,!1),this._contextService.setContextValue(fc,!1))}getFocusedUnit(){return this.focused}getUnitType(e){let t=this._getUnitById(e);return t?t[1]:f.UniverType.UNRECOGNIZED}disposeUnit(e){this._logService.debug(`[UniverInstanceService]: Disposing unit with id ${e}`);let t=this._getUnitById(e);if(!t)return this._logService.debug(`[UniverInstanceService]: No unit found with id ${e}`),!1;let[n,r]=t,i=this._unitsByType.get(r),a=i.indexOf(n);return i.splice(a,1),this._tryResetCurrentOnRemoval(e,r),this._tryResetFocusOnRemoval(e),this._unitDisposed$.next(n),n.dispose(),!0}_tryResetCurrentOnRemoval(e,t){let n=this.getCurrentUnitForType(t);(n==null?void 0:n.getUnitId())===e&&(this._currentUnits.set(t,null),this._currentUnits$.next(this._currentUnits))}_tryResetFocusOnRemoval(e){var t;((t=this.focused)==null?void 0:t.getUnitId())===e&&this._focused$.next(null)}_getUnitById(e){for(let[t,n]of this._unitsByType){let r=n.find(t=>t.getUnitId()===e);if(r)return[r,t]}}};rl=F([P(0,(0,l.Inject)(l.Injector)),P(1,nr),P(2,(0,l.Inject)(N))],rl);let $=function(e){return e[e.Starting=0]=`Starting`,e[e.Ready=1]=`Ready`,e[e.Rendered=2]=`Rendered`,e[e.Steady=3]=`Steady`,e}({});const il={[$.Starting]:`Starting`,[$.Ready]:`Ready`,[$.Rendered]:`Rendered`,[$.Steady]:`Steady`};var al=class extends Error{constructor(e){super(`[LifecycleService]: lifecycle stage "${il[e]}" will never be reached!`),this.name=`LifecycleUnreachableError`}};let ol=class extends x{constructor(e){super(),this._logService=e,v(this,`_lifecycle$`,new d.BehaviorSubject($.Starting)),v(this,`lifecycle$`,this._lifecycle$.asObservable()),v(this,`_lock`,!1),this._reportProgress($.Starting)}get stage(){return this._lifecycle$.getValue()}set stage(e){if(this._lock)throw Error(`[LifecycleService]: cannot set new stage when related logic is all handled!`);if(e<this.stage)throw Error(`[LifecycleService]: lifecycle stage cannot go backward!`);e!==this.stage&&(this._lock=!0,this._reportProgress(e),this._lifecycle$.next(e),this._lock=!1)}dispose(){this._lifecycle$.complete(),super.dispose()}onStage(e){return(0,d.firstValueFrom)(this.lifecycle$.pipe((0,d.filter)(t=>t>=e),gr(t=>t===e),(0,d.map)(()=>void 0))).catch(t=>t.name===`EmptyError`?Promise.reject(new al(e)):Promise.reject(t))}subscribeWithPrevious(){return(0,d.merge)(sl(this.stage),this._lifecycle$.pipe((0,d.skip)(1))).pipe(gr(e=>e===$.Steady))}_reportProgress(e){this._logService.debug(`[LifecycleService]`,`lifecycle progressed to "${il[e]}".`)}};ol=F([P(0,N)],ol);function sl(e){switch(e){case $.Starting:return(0,d.of)($.Starting);case $.Ready:return(0,d.of)($.Starting,$.Ready);case $.Rendered:return(0,d.of)($.Starting,$.Ready,$.Rendered);default:return(0,d.of)($.Starting,$.Ready,$.Rendered,$.Steady)}}const cl=(0,l.createIdentifier)(`ILocalStorageService`);var ll=class extends x{get _currentLocale(){return this._currentLocale$.value}constructor(){super(),v(this,`_currentLocale$`,new d.BehaviorSubject(Zt.ZH_CN)),v(this,`currentLocale$`,this._currentLocale$.asObservable()),v(this,`_locales`,null),v(this,`localeChanged$`,new d.Subject),v(this,`t`,(e,...t)=>{if(!this._locales)throw Error(`[LocaleService]: Locale not initialized`);let n=e.split(`.`),r=this.resolveKeyPath(this._locales[this._currentLocale],n);if(typeof r==`string`){let e=r;return t.forEach((t,n)=>{e=e.replace(`{${n}}`,t)}),e}else return e}),this.disposeWithMe(b(()=>{this._locales=null,this._currentLocale$.complete(),this.localeChanged$.complete()}))}load(e){var t;this._locales=(0,u.merge)((t=this._locales)==null?{}:t,e)}setLocale(e){this._currentLocale$.next(e),this.localeChanged$.next()}getLocales(){var e;return(e=this._locales)==null?void 0:e[this._currentLocale]}getCurrentLocale(){return this._currentLocale}resolveKeyPath(e,t){let n=t.shift();if(n&&e&&n in e){let r=e[n];return t.length>0&&(typeof r==`object`||Array.isArray(r))?this.resolveKeyPath(r,t):r}return null}};let ul=class{constructor(e){this._userManagerService=e}async list(e){return{list:[{type:Qt.PERSON,mentions:[{objectType:Qt.PERSON,objectId:this._userManagerService.getCurrentUser().userID,label:this._userManagerService.getCurrentUser().name,metadata:{icon:this._userManagerService.getCurrentUser().avatar}}],metadata:{},title:`PEOPLE`}],page:e.page,size:e.size,total:1}}};ul=F([P(0,(0,l.Inject)(ic))],ul);const dl=(0,l.createIdentifier)(`univer.service.mention-io`);let fl=function(e){return e.INIT=`init`,e.FETCHING=`fetching`,e.DONE=`done`,e}({});const pl=(0,l.createIdentifier)(`univer.permission-service`);var ml=class extends x{constructor(...e){super(...e),v(this,`_permissionPointMap`,new Map),v(this,`_permissionPointUpdate$`,new d.Subject),v(this,`permissionPointUpdate$`,this._permissionPointUpdate$.asObservable()),v(this,`_showComponents`,!0)}setShowComponents(e){this._showComponents=e}getShowComponents(){return this._showComponents}deletePermissionPoint(e){let t=this._permissionPointMap.get(e);t&&(t.complete(),this._permissionPointMap.delete(e))}addPermissionPoint(e){let t=e instanceof d.BehaviorSubject,n=t?e.getValue():e;return n.id?this._permissionPointMap.get(n.id)?(console.warn(`${n.id} PermissionPoint already exists`),!1):(this._permissionPointMap.set(n.id,t?e:new d.BehaviorSubject(n)),this._permissionPointUpdate$.next(n),!0):!1}updatePermissionPoint(e,t){let n=this._permissionPointMap.get(e);if(!n)return;let r=n.getValue();r.value=t,r.status=fl.DONE,n.next(r),this._permissionPointUpdate$.next(r)}clearPermissionMap(){this._permissionPointMap.clear()}getPermissionPoint(e){let t=this._permissionPointMap.get(e);if(t)return t.getValue()}getPermissionPoint$(e){let t=this._permissionPointMap.get(e);if(t)return t}composePermission$(e){return(0,d.combineLatest)(e.map(e=>{var t;let n=(t=this._permissionPointMap)==null?void 0:t.get(e);if(!n)throw Error(`[PermissionService]: ${e} permissionPoint does not exist!`);return n.asObservable()})).pipe((0,h.map)(e=>e))}composePermission(e){return e.map(e=>{var t;let n=(t=this._permissionPointMap)==null?void 0:t.get(e);if(!n)throw Error(`[PermissionService]: ${e} permissionPoint does not exist!`);return n.getValue()})}getAllPermissionPoint(){let e=new Map;return this._permissionPointMap.forEach((t,n)=>{e.set(n,t)}),e}};function hl(e,t){if(!t)return e;let n=[];for(let r of e){let e=t.find(([e])=>e===r[0]);if(e){if(e[1]===null)continue;n.push([r[0],e[1]])}else n.push(r)}return n}const gl=Symbol(`DependentOn`);var _l=class extends x{onStarting(){}onReady(){}onRendered(){}onSteady(){}getUnitType(){return this.constructor.type}getPluginName(){return this.constructor.pluginName}};v(_l,`pluginName`,void 0),v(_l,`packageName`,bc),v(_l,`version`,xc),v(_l,`type`,f.UniverType.UNIVER_UNKNOWN);var vl=class{constructor(){v(this,`_plugins`,[])}addPlugin(e){this._plugins.push(e)}removePlugins(){let e=this._plugins.slice();return this._plugins.length=0,e}forEachPlugin(e){this._plugins.forEach(e)}};function yl(...e){return function(t){t[gl]=e}}let bl=class{constructor(e,t,n){this._injector=e,this._lifecycleService=t,this._logService=n,v(this,`_pluginRegistry`,new Map),v(this,`_pluginStore`,new vl),v(this,`_seenPlugins`,new Set),v(this,`_loadedPlugins`,new Set),v(this,`_loadedPluginTypes`,new Set([f.UniverType.UNIVER_UNKNOWN])),v(this,`_flushTimerByType`,new Map)}dispose(){this._pluginStore.removePlugins().forEach(e=>e.dispose()),this._flushTimerByType.forEach(e=>clearTimeout(e))}registerPlugin(e,t){this._assertPluginValid(e);let n={plugin:e,options:t};this._pluginRegistry.set(e.pluginName,n),this._logService.debug(`[PluginService]`,`Plugin "${e.pluginName}" registered.`);let{type:r}=e;this._loadedPluginTypes.has(r)&&(r===f.UniverType.UNIVER_UNKNOWN?this._loadFromPlugins([n]):this._flushType(r))}startPluginsForType(e){this._loadedPluginTypes.has(e)||this._loadPluginsForType(e)}_loadPluginsForType(e){let t=Array.from(this._pluginRegistry.keys()),n=[];t.forEach(t=>{let r=this._pluginRegistry.get(t);r.plugin.type===e&&n.push(r)}),this._loadFromPlugins(n),this._loadedPluginTypes.add(e)}_assertPluginValid(e){let{type:t,pluginName:n,packageName:r,version:i}=e;if(t===f.UniverType.UNRECOGNIZED)throw Error(`[PluginService]: invalid plugin type for ${e.name}. Please assign a "type" to your plugin.`);if(!n)throw Error(`[PluginService]: no plugin name for ${e.name}. Please assign a "pluginName" to your plugin.`);if(i&&i!==_l.version)throw Error(`[PluginService]: package "${r==null?`UNKNOWN`:r}" version mismatch. Plugin version is "${i}" but @univerjs/core version is "${_l.version}". Please make sure all @univerjs packages use the same version.`);if(this._seenPlugins.has(n))throw Error(`[PluginService]: duplicated plugin name for "${n}". Maybe a plugin that dependents on "${n} has already registered it. In that case please register "${n}" before the that plugin.`);this._seenPlugins.add(e.pluginName)}_flushType(e){this._flushTimerByType.get(e)===void 0&&this._flushTimerByType.set(e,setTimeout(()=>{this._loadPluginsForType(e),this._flushTimerByType.delete(e)},4))}_loadFromPlugins(e){let t=[],n=new Set,r=e=>{let{plugin:i}=e,{pluginName:a}=i;if(this._loadedPlugins.has(a)||n.has(a))return;n.add(a),this._pluginRegistry.delete(a);let o=i[gl];o&&o.forEach(e=>{let t=this._pluginRegistry.get(e.pluginName);if(t)r(t);else if(!this._seenPlugins.has(e.pluginName)&&!n.has(e.pluginName)){if(i.type===f.UniverType.UNIVER_UNKNOWN&&e.type!==f.UniverType.UNIVER_UNKNOWN)throw Error(`[PluginService]: cannot register a plugin with Univer type that depends on a plugin with other type. The dependent is ${i.pluginName} and the dependency is ${e.pluginName}.`);i.type!==e.type&&e.type!==f.UniverType.UNIVER_UNKNOWN&&this._logService.debug(`[PluginService]`,`Plugin "${a}" depends on "${e.pluginName}" which has different type.`),this._logService.debug(`[PluginService]`,`Plugin "${a}" depends on "${e.pluginName}" which is not registered. Univer will automatically register it with default configuration.`),this._assertPluginValid(e),r({plugin:e,options:void 0})}}),t.push(e)};e.forEach(e=>r(e));let i=t.map(e=>this._initPlugin(e.plugin,e.options));this._pluginsRunLifecycle(i)}_pluginsRunLifecycle(e){let t=this._lifecycleService.stage;if(sl(t).subscribe(t=>this._runStage(e,t)),t!==$.Steady){let t=this._lifecycleService.lifecycle$.pipe((0,d.skip)(1)).subscribe(n=>{this._runStage(e,n),n===$.Steady&&t.unsubscribe()})}}_runStage(e,t){e.forEach(e=>{switch(t){case $.Starting:e.onStarting();break;case $.Ready:e.onReady();break;case $.Rendered:e.onRendered();break;case $.Steady:e.onSteady();break}})}_initPlugin(e,t){let n=this._injector.createInstance(e,t);return this._pluginStore.addPlugin(n),this._loadedPlugins.add(e.pluginName),this._logService.debug(`[PluginService]`,`Plugin "${n.getPluginName()}" loaded.`),n}};bl=F([P(0,(0,l.Inject)(l.Injector)),P(1,(0,l.Inject)(ol)),P(2,N)],bl);const xl=(0,l.createIdentifier)(`resource-loader-service`);let Sl=class extends x{constructor(e){super(),this._logService=e,v(this,`_resourceMap`,new Map),v(this,`_register$`,new d.Subject),v(this,`register$`,this._register$.asObservable())}getAllResourceHooks(){return[...this._resourceMap.values()]}getResources(e,t){return t?this.getResourcesByType(e,t):this.getAllResourceHooks().map(t=>{let n=t.toJson(e);return{name:t.pluginName,data:n}})}getResourcesByType(e,t){return this.getAllResourceHooks().filter(e=>e.businesses.includes(t)).map(t=>{let n=t.toJson(e);return{name:t.pluginName,data:n}})}registerPluginResource(e){let t=e.pluginName;if(this._resourceMap.has(t))throw Error(`the pluginName is registered {${t}}`);return this._resourceMap.set(t,e),this._register$.next(e),b(()=>this._resourceMap.delete(t))}disposePluginResource(e){this._resourceMap.delete(e)}loadResources(e,t){this.getAllResourceHooks().forEach(n=>{var r;let i=t==null||(r=t.find(e=>e.name===n.pluginName))==null?void 0:r.data;if(i)try{let t=n.parseJson(i);n.onLoad(e,t)}catch(e){this._logService.error(`[ResourceManagerService]`,`loadResources error`,e)}})}unloadResources(e,t){this.getAllResourceHooks().filter(e=>e.businesses.includes(t)).forEach(t=>{t.onUnLoad(e)})}dispose(){this._register$.complete(),this._resourceMap.clear()}};Sl=F([P(0,N)],Sl);var Cl=class extends x{get darkMode(){return this._darkMode$.getValue()}constructor(){super(),v(this,`_darkMode$`,new d.BehaviorSubject(!1)),v(this,`darkMode$`,this._darkMode$.asObservable()),v(this,`_validColorCache`,new Map),v(this,`_currentTheme`,ue.defaultTheme),v(this,`_currentTheme$`,new d.BehaviorSubject(this._currentTheme)),v(this,`currentTheme$`,this._currentTheme$.asObservable()),this.disposeWithMe(b(()=>{this._currentTheme=ue.defaultTheme,this._currentTheme$.complete(),this._darkMode$.complete()}))}isValidThemeColor(e){if(this._validColorCache.has(e))return this._validColorCache.get(e);let t=!1,n=e.split(`.`);if(n.length===1)t=e in ue.defaultTheme;else if(n.length===2){let[e,r]=n;t=e in ue.defaultTheme&&r in this._currentTheme[e]}return this._validColorCache.set(e,t),t}getCurrentTheme(){return this._currentTheme}setTheme(e){this._currentTheme=e,this._currentTheme$.next(e)}setDarkMode(e){this._darkMode$.next(e)}getColorFromTheme(e){return(0,u.get)(this._currentTheme,e)}},wl=function(e){return e[e.WAITING=0]=`WAITING`,e[e.CREATED=1]=`CREATED`,e}(wl||{});const Tl=(0,l.createIdentifier)(`univer.undo-redo.service`);var El=class{dispose(){}async dispatchToHandlers(){return!1}};const Dl=`univer.command.redo`,Ol=`univer.command.undo`,kl=new class extends El{constructor(...e){super(...e),v(this,`type`,I.COMMAND),v(this,`id`,Ol)}handler(e){let t=e.get(Tl),n=t.pitchTopUndoElement();if(!n)return!1;let r=e.get(cr);return pr(n.undoMutations,r)?(t.popUndoToRedo(),!0):!1}},Al=new class extends El{constructor(...e){super(...e),v(this,`type`,I.COMMAND),v(this,`id`,Dl)}handler(e){let t=e.get(Tl),n=t.pitchTopRedoElement();if(!n)return!1;let r=e.get(cr);return pr(n.redoMutations,r)?(t.popRedoToUndo(),!0):!1}};let jl=class extends x{constructor(e,t,n){super(),this._univerInstanceService=e,this._commandService=t,this._contextService=n,v(this,`undoRedoStatus$`,void 0),v(this,`_undoRedoStatus$`,new d.BehaviorSubject({undos:0,redos:0})),v(this,`_undoStacks`,new Map),v(this,`_redoStacks`,new Map),v(this,`_batchingStatus`,new Map),this.undoRedoStatus$=this._undoRedoStatus$.asObservable(),this.disposeWithMe(this._commandService.registerCommand(kl)),this.disposeWithMe(this._commandService.registerCommand(Al)),this.disposeWithMe(b(()=>this._undoRedoStatus$.complete())),this.disposeWithMe(b(this._univerInstanceService.focused$.subscribe(()=>this._updateStatus())))}pushUndoRedo(e){let{unitID:t}=e,n=this._getRedoStack(t,!0),r=this._getUndoStack(t,!0);if(n.length=0,this._batchingStatus.has(e.unitID)){let t=this._batchingStatus.get(e.unitID),n=this._pitchUndoElement(e.unitID);t===wl.WAITING||!n?(i(e),this._batchingStatus.set(e.unitID,wl.CREATED)):this._tryBatchingElements(n,e)}else i(e);function i(e){r.push(e),r.length>20&&r.splice(0,1)}this._updateStatus()}clearUndoRedo(e){let t=this._getRedoStack(e);t&&(t.length=0);let n=this._getUndoStack(e);n&&(n.length=0),this._updateStatus()}pitchTopUndoElement(){let e=this._getFocusedUnitId();return this._pitchUndoElement(e)}pitchTopRedoElement(){let e=this._getFocusedUnitId();return this._pitchRedoElement(e)}_pitchUndoElement(e){let t=this._getUndoStack(e);return t!=null&&t.length?t[t.length-1]:null}_pitchRedoElement(e){let t=this._getRedoStack(e);return t!=null&&t.length?t[t.length-1]:null}popUndoToRedo(){let e=this._getUndoStackForFocused().pop();e&&(e.redoMutations.length>0&&this._getRedoStackForFocused().push(e),this._updateStatus())}popRedoToUndo(){let e=this._getRedoStackForFocused().pop();e&&(this._getUndoStackForFocused().push(e),this._updateStatus())}rollback(e,t){let n=t||this._getFocusedUnitId(),r=this._getUndoStack(n),i=r==null?void 0:r[(r==null?void 0:r.length)-1];i&&i.id===e&&(r.pop(),pr(i.undoMutations,this._commandService))}__tempBatchingUndoRedo(e){if(this._batchingStatus.has(e))throw Error(`[LocalUndoRedoService]: cannot batching undo redo twice at the same time!`);return this._batchingStatus.set(e,wl.WAITING),b(()=>this._batchingStatus.delete(e))}_updateStatus(){var e,t;let n=this._getFocusedUnitId(),r=n&&((e=this._undoStacks.get(n))==null?void 0:e.length)||0,i=n&&((t=this._redoStacks.get(n))==null?void 0:t.length)||0;this._undoRedoStatus$.next({undos:r,redos:i})}_getUndoStack(e,t=!1){let n=this._undoStacks.get(e);return!n&&t&&(n=[],this._undoStacks.set(e,n)),n||null}_getRedoStack(e,t=!1){let n=this._redoStacks.get(e);return!n&&t&&(n=[],this._redoStacks.set(e,n)),n||null}_getUndoStackForFocused(){let e=this._getFocusedUnitId();if(!e)throw Error(`No focused univer instance!`);return this._getUndoStack(e,!0)}_getRedoStackForFocused(){let e=this._getFocusedUnitId();if(!e)throw Error(`No focused univer instance!`);return this._getRedoStack(e,!0)}_tryBatchingElements(e,t){e.redoMutations.push(...t.redoMutations),e.undoMutations.push(...t.undoMutations)}_getFocusedUnitId(){let e=``,t=this._contextService.getContextValue(uc),n=this._contextService.getContextValue(mc),r=this._contextService.getContextValue(pc);if(t)if(n)e=Oe;else if(r)e=De;else{var i,a;e=(i=(a=this._univerInstanceService.getFocusedUnit())==null?void 0:a.getUnitId())==null?``:i}else{var o,s;e=(o=(s=this._univerInstanceService.getFocusedUnit())==null?void 0:s.getUnitId())==null?``:o}return e}};jl=F([P(0,nl),P(1,cr),P(2,nr)],jl);var Ml=class{constructor(e,t=1e3){this._injector=e,v(this,`_imageCacheMap`,void 0),this._imageCacheMap=new ra(t)}_getImageCacheKey(e,t){return`${e}-${t}`}getImage(e,t,n,r){let i=this._getImageCacheKey(e,t);return this._imageCacheMap.get(i)||((async()=>{let a=new Image,o=this._injector.has(vc)?this._injector.get(vc):null,s=this._injector.has(yc)?this._injector.get(yc):null;if(e===gc.UUID)try{a.src=await(o==null?void 0:o.getImage(t))||``}catch(e){console.error(e)}else if(e===gc.URL)try{a.src=await(s==null?void 0:s.getImage(t))||t}catch{a.src=t}else a.src=t;a.onload=()=>{a.removeAttribute(`data-error`),n==null||n()},a.onerror=()=>{a.setAttribute(`data-error`,`true`),r==null||r()},this._imageCacheMap.set(i,a)})(),null)}};function Nl(e){return!(e.length===0||e.length>31||e.startsWith(`'`)||e.endsWith(`'`)||/[:\\\/\?\*\[\]]/.test(e))}function Pl(e,t){return!(!e||e.length===0||e.length>255||t.has(e)||/[ :\\\/\?\*\[\]]/.test(e)||!/^[\p{L}_]/u.test(e)||/^\$?[A-Za-z]{1,3}\$?[0-9]+$/.test(e)||/^[rR]\d+[cC]\d+$/.test(e)||/^\d+$/.test(e))}var Fl=class{constructor(e=!1){this._enableOneCellCache=e,v(this,`_tree`,new Map),v(this,`_oneCellCache`,new Map),v(this,`_kdTree`,new Map)}dispose(){this.clear()}getTree(e,t){return this._tree.has(e)||this._tree.set(e,new Map),this._tree.get(e).has(t)||this._tree.get(e).set(t,new ce.default),this._tree.get(e).get(t)}_getOneCellCache(e,t,n,r){return this._oneCellCache.has(e)||this._oneCellCache.set(e,new Map),this._oneCellCache.get(e).has(t)||this._oneCellCache.get(e).set(t,new Map),this._oneCellCache.get(e).get(t).has(n)||this._oneCellCache.get(e).get(t).set(n,new Map),this._oneCellCache.get(e).get(t).get(n).has(r)||this._oneCellCache.get(e).get(t).get(n).set(r,new Set),this._oneCellCache.get(e).get(t).get(n).get(r)}_removeOneCellCache(e,t,n,r,i){let a=this._oneCellCache.get(e);if(!a)return;let o=a.get(t);if(!o)return;let s=o.get(n);if(!s)return;let c=s.get(r);c&&c.delete(i)}_removeCellCacheByRange(e){let{unitId:t,sheetId:n,range:r,id:i}=e,a=this._oneCellCache.get(t);if(!a)return;let o=a.get(n);if(!o)return;let{startRow:s,startColumn:c,endRow:l,endColumn:u}=r;for(let e=s;e<=l;e++){let t=o.get(e);if(t)for(let e=c;e<=u;e++){let n=t.get(e);n&&n.delete(i)}}}_insertOneCellCache(e,t,n,r,i){this._getOneCellCache(e,t,n,r).add(i)}_getRdTreeItems(e){let t=[];for(let[n,r]of e)for(let[e,i]of r)t.push({x:e,y:n,ids:i});return t}_searchByOneCellCache(e){var t;let{unitId:n,sheetId:r,range:i}=e,{startRow:a,startColumn:o,endRow:s,endColumn:c}=i,l=(t=this._kdTree.get(n))==null?void 0:t.get(r);if(!l)return[];let{tree:u,items:d}=l,f=u.range(o,a,c,s),p=[];for(let e of f){let t=d[e];p.push(...Array.from(t.ids))}return p}openKdTree(){for(let[t,n]of this._oneCellCache){this._kdTree.has(t)||this._kdTree.set(t,new Map);for(let[r,i]of n){var e;let n=this._getRdTreeItems(i),a=new de.default(n.length);(e=this._kdTree.get(t))==null||e.set(r,{tree:a,items:n});for(let e of n)a.add(e.x,e.y);a.finish()}}}closeKdTree(){for(let[t,n]of this._oneCellCache)for(let[r,i]of n){var e;(e=this._kdTree.get(t))==null||e.set(r,void 0)}}insert(e){let{unitId:t,sheetId:n,range:r,id:i}=e;if(!t||t.length===0)return;let{startRow:a,endRow:o,startColumn:s,endColumn:c}=r;if(this._enableOneCellCache&&a===o&&s===c){this._insertOneCellCache(t,n,a,s,i);return}let l=this.getTree(t,n);Number.isNaN(a)&&(a=0),Number.isNaN(s)&&(s=0),Number.isNaN(o)&&(o=1/0),Number.isNaN(c)&&(c=1/0),l.insert({minX:s,minY:a,maxX:c,maxY:o,id:i})}bulkInsert(e){for(let t of e)this.insert(t)}*searchGenerator(e){var t;let{unitId:n,sheetId:r,range:i}=e;if(this._enableOneCellCache){let t=this._searchByOneCellCache(e);for(let e of t)yield e}let a=(t=this._tree.get(n))==null?void 0:t.get(r);if(!a)return;let o=a.search({minX:i.startColumn,minY:i.startRow,maxX:i.endColumn,maxY:i.endRow});for(let e of o)yield e.id}bulkSearch(e,t){let n=new Set;for(let r of e)for(let e of this.searchGenerator(r))(t==null?void 0:t.has(e))!==!0&&n.add(e);return n}removeById(e,t){if(t){var n,r;(n=this._tree.get(e))==null||n.delete(t),(r=this._oneCellCache.get(e))==null||r.delete(t)}else this._tree.delete(e),this._oneCellCache.delete(e)}_removeRTreeItem(e){let{unitId:t,sheetId:n,range:r,id:i}=e,a=this.getTree(t,n),o=a.search({minX:r.startColumn,minY:r.startRow,maxX:r.endColumn,maxY:r.endRow});for(let e=0;e<o.length;e++)o[e].id===i&&a.remove(o[e])}remove(e){let{unitId:t,sheetId:n,range:r,id:i}=e,{startRow:a,startColumn:o,endRow:s,endColumn:c}=r;this._enableOneCellCache?a===s&&o===c?this._removeOneCellCache(t,n,r.startRow,r.startColumn,i):(this._removeCellCacheByRange(e),this._removeRTreeItem(e)):this._removeRTreeItem(e)}bulkRemove(e){for(let t of e)this.remove(t)}clear(){this._tree.clear(),this._oneCellCache.clear()}toJSON(){let e={};return this._tree.forEach((t,n)=>{e[n]={},t.forEach((t,r)=>{e[n][r]=t.toJSON()})}),e}fromJSON(e){this._tree.clear();for(let t in e){this._tree.set(t,new Map);for(let n in e[t]){let r=new ce.default;r.fromJSON(e[t][n]),this._tree.get(t).set(n,r)}}}};function Il(e){return new Promise(t=>setTimeout(t,e))}function Ll(e=1){return new Promise(t=>{let n=0,r=()=>{n++,n>=e?t():requestAnimationFrame(r)};requestAnimationFrame(r)})}let Rl=class extends x{constructor(e){super(),this._localeService=e,v(this,`_fontLocale`,void 0),v(this,`_dirty`,!0),this._localeInitial()}get dirty(){return this._dirty}getFontLocale(){return this._fontLocale}makeDirty(e){this._dirty=e}dispose(){super.dispose(),this._fontLocale=null}_localeInitial(){}};Rl=F([P(0,(0,l.Inject)(ll))],Rl);let zl=class extends Rl{constructor(e,t,n,r,i,a){super(n),this.worksheet=e,this._styles=t,this._contextService=r,this._configService=i,this._injector=a,v(this,`_worksheetData`,void 0),v(this,`_renderRawFormula`,!1),v(this,`_cellData`,void 0),v(this,`_imageCacheMap`,void 0),v(this,`_skipAutoHeightForMergedCells`,!0),v(this,`_rowTotalHeight`,0),v(this,`_columnTotalWidth`,0),v(this,`_rowHeaderWidth`,0),v(this,`_columnHeaderHeight`,0),v(this,`_rowHeightAccumulation`,[]),v(this,`_columnWidthAccumulation`,[]),v(this,`_marginTop`,0),v(this,`_marginLeft`,0),v(this,`_scaleX`,void 0),v(this,`_scaleY`,void 0),v(this,`_scrollX`,void 0),v(this,`_scrollY`,void 0),this._worksheetData=this.worksheet.getConfig(),this._cellData=this.worksheet.getCellMatrix(),this._imageCacheMap=new Ml(this._injector),this.initConfig()}initConfig(){var e,t;this._skipAutoHeightForMergedCells=!((e=this._configService.getConfig(je))!=null&&e),this.worksheet.setIsRowStylePrecedeColumnStyle((t=this._configService.getConfig(`isRowStylePrecedeColumnStyle`))==null?!1:t)}resetCache(){}getWorksheetConfig(){return this._worksheetData}getLocation(){return[this.worksheet.getUnitId(),this.worksheet.getSheetId()]}set columnHeaderHeight(e){this._columnHeaderHeight=e,this._worksheetData.columnHeader.height=e}set rowHeaderWidth(e){this._rowHeaderWidth=e,this._worksheetData.rowHeader.width=e}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(e){this._marginLeft=e}setMarginTop(e){this._marginTop=e}setScale(e,t){this._updateLayout(),this._scaleX=e,this._scaleY=t||e,this._updateLayout()}setScroll(e,t){S.isDefine(e)&&(this._scrollX=e),S.isDefine(t)&&(this._scrollY=t)}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(e,t,n){let r=0,i=[],a=t;for(let t=0;t<e;t++){let e=n;if(this.worksheet.getRowFiltered(t))e=0;else if(a[t]!=null){let r=a[t];if(!r)continue;let{h:i=n,ah:o,ia:s}=r;e=(s==null||s===E.TRUE)&&typeof o==`number`&&o>0?o:i,r.hd===E.TRUE&&(e=0)}r+=e,i.push(r)}return{rowTotalHeight:r,rowHeightAccumulation:i}}_generateColumnMatrixCache(e,t,n){let r=0,i=[],a=t;for(let t=0;t<e;t++){let e=n;if(a[t]!=null){let n=a[t];if(!n)continue;n.w!=null&&(e=n.w),n.hd===E.TRUE&&(e=0)}r+=e,i.push(r)}return{columnTotalWidth:r,columnWidthAccumulation:i}}intersectMergeRange(e,t){return!!this.worksheet.getMergedCell(e,t)}_getOverflowBound(e,t,n,r,i=T.LEFT){let a=0;if(t>n){let o=this._columnWidthAccumulation.length-1;for(let s=t;s>=n;s--){let n=s;if(!wi(this.worksheet.getCell(e,n))&&n!==t||this.intersectMergeRange(e,n))return n===t?n:n+1>o?o:n+1;let{startX:c,endX:l}=Hl(e,n,this.rowHeightAccumulation,this.columnWidthAccumulation);if(i===T.CENTER&&n===t?a+=(l-c)/2:a+=l-c,r<a)return n}return t}for(let o=t;o<=n;o++){let n=o;if(!wi(this.worksheet.getCell(e,n))&&n!==t||this.intersectMergeRange(e,n))return n===t?n:n-1<0?0:n-1;let{startX:s,endX:c}=Hl(e,n,this.rowHeightAccumulation,this.columnWidthAccumulation);if(i===T.CENTER&&n===t?a+=(c-s)/2:a+=c-s,r<a)return n}return n}_updateLayout(){if(!this.dirty)return;let{rowData:e,columnData:t,defaultRowHeight:n,defaultColumnWidth:r,rowCount:i,columnCount:a,rowHeader:o,columnHeader:s}=this._worksheetData,{rowTotalHeight:c,rowHeightAccumulation:l}=this._generateRowMatrixCache(i,e,n),{columnTotalWidth:u,columnWidthAccumulation:d}=this._generateColumnMatrixCache(a,t,r);this._rowHeaderWidth=o.hidden===E.TRUE?0:this._dynamicallyUpdateRowHeaderWidth(o),this._columnHeaderHeight=s.hidden===E.TRUE?0:s.height,this._rowTotalHeight=c,this._rowHeightAccumulation=l,this._columnTotalWidth=u,this._columnWidthAccumulation=d,this.makeDirty(!1)}calculate(){return this.resetCache(),this._updateLayout(),this}resetRangeCache(e){}_dynamicallyUpdateRowHeaderWidth(e){let t=`${this.worksheet.getRowCount()}`.length*8;return Math.max(e.width,t)}_hasUnMergedCellInRow(e,t,n){if(!this.worksheet.getMergeData())return!1;for(let r=t;r<=n;r++){let{isMerged:t,isMergedMainCell:n}=this.worksheet.getCellInfoInMergeData(e,r);if(!t&&!n)return!0}return!1}expandRangeByMerge(e,t){let{startRow:n,startColumn:r,endRow:i,endColumn:a}=e,o=this._worksheetData.mergeData;if(!o)return{startRow:n,startColumn:r,endRow:i,endColumn:a};let s=!0,c=new yi,l=0,u=null;for(;s;){s=!1;for(let e=0;e<o.length;e++){let{startRow:t,startColumn:d,endRow:f,endColumn:p}=o[e];if(c.getValue(t,d))continue;let m={startColumn:r,startRow:n,endColumn:a,endRow:i},h={startColumn:d,startRow:t,endColumn:p,endRow:f};Da(m,h)&&(n=Math.min(n,t),r=Math.min(r,d),i=Math.max(i,f),a=Math.max(a,p),c.setValue(t,d,!0),s=!0,l++,u=h)}}return t&&l===1&&U.contains(u,e)?{startRow:u.startRow,startColumn:u.startColumn,endRow:u.startRow,endColumn:u.startColumn}:{startRow:n,startColumn:r,endRow:i,endColumn:a}}getColumnCount(){return this._columnWidthAccumulation.length}getRowCount(){return this._rowHeightAccumulation.length}_getCellMergeInfo(e,t){return this.worksheet.getCellInfoInMergeData(e,t)}getNoMergeCellPositionByIndex(e,t,n=!0){return this.getNoMergeCellWithCoordByIndex(e,t,n)}getNoMergeCellWithCoordByIndex(e,t,n=!0){let{rowHeightAccumulation:r,columnWidthAccumulation:i,rowHeaderWidthAndMarginLeft:a,columnHeaderHeightAndMarginTop:o}=this,{startY:s,endY:c,startX:l,endX:u}=Hl(e,t,r,i);return n&&(s+=o,c+=o,l+=a,u+=a),{startY:s,endY:c,startX:l,endX:u}}getNoMergeCellPositionByIndexWithNoHeader(e,t){let{rowHeightAccumulation:n,columnWidthAccumulation:r}=this,{startY:i,endY:a,startX:o,endX:s}=Hl(e,t,n,r);return{startY:i,endY:a,startX:o,endX:s}}getRowIndexByOffsetY(e,t,n,r){let{rowHeightAccumulation:i}=this;e=Wl(e,t,n,this.columnHeaderHeightAndMarginTop);let a=wr(i,e,r==null?void 0:r.firstMatch);if(r!=null&&r.closeFirst){var o;Math.abs(i[a]-e)<Math.abs(e-((o=i[a-1])==null?0:o))&&(a+=1)}return a}getColumnIndexByOffsetX(e,t,n,r){let i=Ul(e,t,n,this.rowHeaderWidthAndMarginLeft),{columnWidthAccumulation:a}=this,o=wr(a,i,r==null?void 0:r.firstMatch);if(r!=null&&r.closeFirst){var s;Math.abs(a[o]-i)<Math.abs(i-((s=a[o-1])==null?0:s))&&(o+=1)}return o}getCellIndexByOffset(e,t,n,r,i,a){return{row:this.getRowIndexByOffsetY(t,r,i,a),column:this.getColumnIndexByOffsetX(e,n,i,a)}}getCellByOffset(e,t,n,r,i){var a;let o=(a=this)==null?void 0:a.getCellIndexByOffset(e,t,n,r,i,{firstMatch:!0});return o?this.worksheet.getCellInfoInMergeData(o.row,o.column):null}getCellWithCoordByIndex(e,t,n=!0){var r;let{rowHeightAccumulation:i,columnWidthAccumulation:a,rowHeaderWidthAndMarginLeft:o,columnHeaderHeightAndMarginTop:s}=this,c=Hl(e,t,i,a,(r=this.worksheet)==null?void 0:r.getCellInfoInMergeData(e,t)),{isMerged:l,isMergedMainCell:u}=c,{startY:d,endY:f,startX:p,endX:m,mergeInfo:h}=c,g=o,_=s;return n===!1&&(g=0,_=0),d+=_,f+=_,p+=g,m+=g,h.startY+=_,h.endY+=_,h.startX+=g,h.endX+=g,{actualRow:e,actualColumn:t,startX:p,startY:d,endX:m,endY:f,isMerged:l,isMergedMainCell:u,mergeInfo:h}}getCellWithCoordByOffset(e,t,n,r,i,a){let{row:o,column:s}=this.getCellIndexByOffset(e,t,n,r,i,a);return this.getCellWithCoordByIndex(o,s)}getOffsetByColumn(e){let{columnWidthAccumulation:t,rowHeaderWidthAndMarginLeft:n}=this,r=t.length-1,i=t[e];return i==null?e<0?n:t[r]+n:i+n}getOffsetByRow(e){let{rowHeightAccumulation:t,columnHeaderHeightAndMarginTop:n}=this,r=t.length-1,i=t[e];return i==null?e<0?n:t[r]+n:i+n}getOffsetRelativeToRowCol(e,t){let n=wr(this.columnWidthAccumulation,e),r=0;r=n===0?e:e-this._columnWidthAccumulation[n-1];let i=wr(this.rowHeightAccumulation,t),a=0;return a=i===0?t:t-this._rowHeightAccumulation[i-1],{row:i,column:n,columnOffset:r,rowOffset:a}}_updateConfigAndGetDocumentModel(e,t,n,r){var i,a,o,s,c;if(!r||!((i=e.body)!=null&&i.dataStream))return;e.documentStyle||(e.documentStyle={}),e.documentStyle.marginTop=(a=n.t)==null?0:a,e.documentStyle.marginBottom=(o=n.b)==null?2:o,e.documentStyle.marginLeft=(s=n.l)==null?2:s,e.documentStyle.marginRight=(c=n.r)==null?2:c,e.documentStyle.pageSize={width:1/0,height:1/0},e.documentStyle.renderConfig={...e.documentStyle.renderConfig,...r};let l=e.body.paragraphs||[];for(let e of l)e.paragraphStyle||(e.paragraphStyle={}),e.paragraphStyle.horizontalAlign=t;return new ls(e)}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,this.worksheet=null}};zl=F([P(2,(0,l.Inject)(ll)),P(3,nr),P(4,er),P(5,(0,l.Inject)(l.Injector))],zl);function Bl(e,t,n,r){let i=e-1,a=t-1,o=n[i]||0,s=n[e];s==null&&(s=n[n.length-1]);let c=r[a]||0,l=r[t];return l==null&&(l=r[r.length-1]),{startY:o,endY:s,startX:c,endX:l}}function Vl(e,t,n,r){return Bl(e,t,n,r)}function Hl(e,t,n,r,i){e=S.clamp(e,0,n.length-1),t=S.clamp(t,0,r.length-1);let{startY:a,endY:o,startX:s,endX:c}=Bl(e,t,n,r);if(!i)return{startY:a,endY:o,startX:s,endX:c,isMerged:!1,isMergedMainCell:!1,actualRow:e,actualColumn:t,mergeInfo:{startY:a,endY:o,startX:s,endX:c,startRow:e,startColumn:t,endRow:e,endColumn:t}};let{isMerged:l,isMergedMainCell:u,startRow:d,startColumn:f,endRow:p,endColumn:m}=i,h={startRow:d,startColumn:f,endRow:p,endColumn:m,startY:a,endY:o,startX:s,endX:c},g=n.length-1,_=r.length-1;if(l&&d!==-1&&f!==-1){let e=n[d-1]||0,t=n[p]||n[g],i=r[f-1]||0,a=r[m]||r[_];h={...h,startY:e,endY:t,startX:i,endX:a}}else if(!l&&p!==-1&&m!==-1){let e=n[p]||n[g],t=r[m]||r[_];h={...h,startY:a,endY:e,startX:s,endX:t}}return{isMerged:l,isMergedMainCell:u,actualRow:e,actualColumn:t,startY:a,endY:o,startX:s,endX:c,mergeInfo:h}}function Ul(e,t,n,r){let{x:i}=n;return e/t+i-r}function Wl(e,t,n,r){let{y:i}=n;return e=e/t+i-r,e}const Gl=[`script`,`style`,`meta`,`comment`,`link`];let Kl=function(e){return e[e.INFO=0]=`INFO`,e[e.STOP=1]=`STOP`,e[e.WARNING=2]=`WARNING`,e}({}),ql=function(e){return 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}({}),Jl=function(e){return 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}({}),Yl=function(e){return e[e.TEXT=0]=`TEXT`,e[e.ARROW=1]=`ARROW`,e[e.CUSTOM=2]=`CUSTOM`,e}({}),Xl=function(e){return e.VALID=`valid`,e.INVALID=`invalid`,e.VALIDATING=`validating`,e}({}),Zl=function(e){return 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}({}),Ql=class extends x{constructor(e,t){super(),this._resourceManagerService=e,this._univerInstanceService=t,this._init()}_init(){let e=e=>{e.businesses.forEach(t=>{switch(t){case f.UniverType.UNRECOGNIZED:case f.UniverType.UNIVER_UNKNOWN:case f.UniverType.UNIVER_SLIDE:case f.UniverType.UNIVER_DOC:this._univerInstanceService.getAllUnitsForType(f.UniverType.UNIVER_DOC).forEach(t=>{let n=(t.getSnapshot().resources||[]).find(t=>t.name===e.pluginName);if(n)try{let r=e.parseJson(n.data);e.onLoad(t.getUnitId(),r)}catch{console.error(`Load Document{${t.getUnitId()}} Resources{${e.pluginName}} Data Error.`)}});break;case f.UniverType.UNIVER_SHEET:this._univerInstanceService.getAllUnitsForType(f.UniverType.UNIVER_SHEET).forEach(t=>{let n=(t.getSnapshot().resources||[]).find(t=>t.name===e.pluginName);if(n)try{let r=e.parseJson(n.data);e.onLoad(t.getUnitId(),r)}catch{console.error(`Load Workbook{${t.getUnitId()}} Resources{${e.pluginName}} Data Error.`)}})}})};this._resourceManagerService.getAllResourceHooks().forEach(t=>e(t)),this.disposeWithMe(this._resourceManagerService.register$.subscribe(t=>e(t))),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(f.UniverType.UNIVER_SHEET).subscribe(e=>{this._resourceManagerService.loadResources(e.getUnitId(),e.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(f.UniverType.UNIVER_DOC).subscribe(e=>{Ne(e.getUnitId())||this._resourceManagerService.loadResources(e.getUnitId(),e.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(f.UniverType.UNIVER_SHEET).subscribe(e=>{this._resourceManagerService.unloadResources(e.getUnitId(),f.UniverType.UNIVER_SHEET)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(f.UniverType.UNIVER_DOC).subscribe(e=>{this._resourceManagerService.unloadResources(e.getUnitId(),f.UniverType.UNIVER_DOC)}))}saveUnit(e){let t=this._univerInstanceService.getUnit(e);if(!t)return null;let n=this._resourceManagerService.getResources(e,t.type),r=S.deepClone(t.getSnapshot());return r.resources=n,r}};Ql=F([P(0,(0,l.Inject)(ec)),P(1,(0,l.Inject)(nl))],Ql);var $l=class{get _univerInstanceService(){return this._injector.get(nl)}get _pluginService(){return this._injector.get(bl)}constructor(e={},t){v(this,`_startedTypes`,new Set),v(this,`_injector`,void 0),v(this,`_disposingCallbacks`,new Ct);let n=this._injector=eu(t,e==null?void 0:e.override),{theme:r,darkMode:i,locale:a,locales:o,logLevel:s,logCommandExecution:c}=e;r&&this._injector.get(Cl).setTheme(r),i&&this._injector.get(Cl).setDarkMode(i),o&&this._injector.get(ll).load(o),a&&this._injector.get(ll).setLocale(a),s&&this._injector.get(N).setLogLevel(s),c!==void 0&&this._injector.get(er).setConfig(sr,c),this._init(n)}__getInjector(){return this._injector}onDispose(e){let t=this._disposingCallbacks.add(b(e));return b(()=>t.dispose(!0))}dispose(){this._disposingCallbacks.dispose(),this._injector.dispose()}setLocale(e){this._injector.get(ll).setLocale(e)}createUnit(e,t){return this._univerInstanceService.createUnit(e,t)}createUniverSheet(e){return this._injector.get(N).warn(`[Univer]`,`Univer.createUniverSheet is deprecated, use createUnit instead`),this._univerInstanceService.createUnit(f.UniverType.UNIVER_SHEET,e)}createUniverDoc(e){return this._injector.get(N).warn(`[Univer]`,`Univer.createUniverDoc is deprecated, use createUnit instead`),this._univerInstanceService.createUnit(f.UniverType.UNIVER_DOC,e)}createUniverSlide(e){return this._injector.get(N).warn(`[Univer]`,`Univer.createUniverSlide is deprecated, use createUnit instead`),this._univerInstanceService.createUnit(f.UniverType.UNIVER_SLIDE,e)}_init(e){this._univerInstanceService.registerCtorForType(f.UniverType.UNIVER_SHEET,el),this._univerInstanceService.registerCtorForType(f.UniverType.UNIVER_DOC,ls),this._univerInstanceService.registerCtorForType(f.UniverType.UNIVER_SLIDE,tl);let t=e.get(nl);t.__setCreateHandler((n,r,i,a)=>{if(!this._startedTypes.has(n)){this._pluginService.startPluginsForType(n),this._startedTypes.add(n);let o=e.createInstance(i,r);return t.__addUnit(o,a),this._tryProgressToReady(),o}let o=e.createInstance(i,r);return t.__addUnit(o,a),o})}_tryProgressToReady(){this._injector.get(ol).stage<$.Ready&&(this._injector.get(ol).stage=$.Ready)}registerPlugin(e,t){this._pluginService.registerPlugin(e,t)}registerPlugins(e){e.forEach(e=>{let[t,n]=e;this._pluginService.registerPlugin(t,n)})}};function eu(e,t){let n=hl([[hc],[ll],[Cl],[ol],[bl],[ic],[nl,{useClass:rl}],[pl,{useClass:ml}],[N,{useClass:ar,lazy:!0}],[cr,{useClass:dr}],[Tl,{useClass:jl,lazy:!0}],[er,{useClass:tr}],[nr,{useClass:rr}],[ec,{useClass:Sl,lazy:!0}],[xl,{useClass:Ql,lazy:!0}],[oc,{useClass:ac}],[dl,{useClass:ul,lazy:!0}]],t),r=e?e.createChild(n):new l.Injector(n);return Ie(r,[[ic],[xl]]),r}ge(),exports.ABCToNumber=La,exports.AUTO_HEIGHT_FOR_MERGED_CELLS=je,exports.AbsoluteRefType=R,exports.ActionIterator=Ho,exports.AlignTypeH=Un,exports.AlignTypeV=Wn,exports.ArrangeTypeEnum=Jn,exports.ArrowsAndMarkersShapes=tn,exports.AsyncInterceptorManager=Xe,exports.AsyncLock=c.default,Object.defineProperty(exports,`AuthzIoLocalService`,{enumerable:!0,get:function(){return ac}}),exports.AutoFillSeries=Bt,exports.BaselineOffset=pn,exports.BasicShapes=en,exports.BlockType=xn,exports.BooleanNumber=E,exports.BorderStyleTypes=w,exports.BorderType=Vt,exports.BuildTextUtils=Z,exports.BulletAlignment=vn,exports.COLORS=Dr,exports.COMMAND_LOG_EXECUTION_CONFIG_KEY=sr,exports.CanceledError=ze,exports.CellModeEnum=ei,exports.CellValueType=mn,exports.ColorKit=Or,exports.ColorType=Ht,exports.ColumnSeparatorType=Tn,Object.defineProperty(exports,`CommandService`,{enumerable:!0,get:function(){return dr}}),exports.CommandType=I,exports.CommonHideTypes=Ut,exports.ConfigService=tr,exports.ContextService=rr,exports.CopyPasteType=Wt,exports.CustomCommandExecutionError=Re,exports.CustomDecorationType=bn,exports.CustomRangeType=yn,exports.DEFAULT_CELL=da,exports.DEFAULT_DOC=ss,exports.DEFAULT_DOCUMENT_SUB_COMPONENT_ID=`__default_document_sub_component_id20231101__`,exports.DEFAULT_EMPTY_DOCUMENT_VALUE=`\r
9
- `,exports.DEFAULT_NUMBER_FORMAT=`General`,exports.DEFAULT_RANGE=la,exports.DEFAULT_RANGE_ARRAY=ca,exports.DEFAULT_SELECTION=ua,exports.DEFAULT_SLIDE=fa,exports.DEFAULT_STYLES=H,exports.DEFAULT_TEXT_FORMAT=`@@@`,exports.DEFAULT_TEXT_FORMAT_EXCEL=`@`,exports.DEFAULT_WORKSHEET_COLUMN_COUNT=20,exports.DEFAULT_WORKSHEET_COLUMN_COUNT_KEY=`DEFAULT_WORKSHEET_COLUMN_COUNT`,exports.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT=20,exports.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY=`DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT`,exports.DEFAULT_WORKSHEET_COLUMN_WIDTH=88,exports.DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY=`DEFAULT_WORKSHEET_COLUMN_WIDTH`,exports.DEFAULT_WORKSHEET_ROW_COUNT=Gc,exports.DEFAULT_WORKSHEET_ROW_COUNT_KEY=`DEFAULT_WORKSHEET_ROW_COUNT`,exports.DEFAULT_WORKSHEET_ROW_HEIGHT=24,exports.DEFAULT_WORKSHEET_ROW_HEIGHT_KEY=`DEFAULT_WORKSHEET_ROW_HEIGHT`,exports.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH=46,exports.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY=`DEFAULT_WORKSHEET_ROW_TITLE_WIDTH`,exports.DOCS_COMMENT_EDITOR_UNIT_ID_KEY=Ae,exports.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY=Oe,exports.DOCS_NORMAL_EDITOR_UNIT_ID_KEY=De,exports.DOCS_ZEN_EDITOR_UNIT_ID_KEY=ke,exports.DOC_DRAWING_PRINTING_COMPONENT_KEY=`univer-docs-drawing-printing`,exports.DOC_RANGE_TYPE=Qr,exports.DashStyleType=jn,exports.DataStreamTreeNodeType=ts,exports.DataStreamTreeTokenType=X,exports.DataValidationErrorStyle=Kl,exports.DataValidationImeMode=ql,exports.DataValidationOperator=Jl,exports.DataValidationRenderMode=Yl,exports.DataValidationStatus=Xl,exports.DataValidationType=Zl,exports.DeleteDirection=Gt,exports.DependentOn=yl,exports.DesktopLogService=ar,exports.DeveloperMetadataVisibility=Kt,exports.Dimension=qt,exports.Direction=Jt,exports.Disposable=x,exports.DisposableCollection=Ct,exports.DocStyleType=gn,exports.DocumentDataModel=ls,exports.DocumentFlavor=Sn,exports.DrawingTypeEnum=Yn,exports.EDITOR_ACTIVATED=pc,exports.EXTENSION_NAMES=ga,exports.ErrorService=hc,exports.EventState=Zs,exports.EventSubject=Qs,exports.FOCUSING_COMMENT_EDITOR=`FOCUSING_COMMENT_EDITOR`,exports.FOCUSING_COMMON_DRAWINGS=`FOCUSING_COMMON_DRAWINGS`,exports.FOCUSING_DOC=dc,exports.FOCUSING_EDITOR_BUT_HIDDEN=`FOCUSING_EDITOR_BUT_HIDDEN`,exports.FOCUSING_EDITOR_INPUT_FORMULA=`FOCUSING_EDITOR_INPUT_FORMULA`,exports.FOCUSING_EDITOR_STANDALONE=`FOCUSING_EDITOR_INPUT_FORMULA`,exports.FOCUSING_FX_BAR_EDITOR=mc,exports.FOCUSING_PANEL_EDITOR=`FOCUSING_PANEL_EDITOR`,exports.FOCUSING_SHAPE_TEXT_EDITOR=`FOCUSING_SHAPE_TEXT_EDITOR`,exports.FOCUSING_SHEET=uc,exports.FOCUSING_SLIDE=fc,exports.FOCUSING_UNIT=lc,exports.FOCUSING_UNIVER_EDITOR=`FOCUSING_UNIVER_EDITOR`,exports.FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE=`FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE`,exports.FORMULA_EDITOR_ACTIVATED=`FORMULA_EDITOR_ACTIVATED`,exports.FollowNumberWithType=_n,exports.FontItalic=dn,exports.FontStyleType=zn,exports.FontWeight=fn,exports.GridType=Cn,exports.HorizontalAlign=T,exports.IAuthzIoService=oc,exports.ICommandService=cr,exports.IConfigService=er,exports.IConfirmService=sc,exports.IContextService=nr,exports.IImageIoService=vc,exports.ILocalStorageService=cl,exports.ILogService=N,exports.IMentionIOService=dl,exports.IPermissionService=pl,exports.IResourceLoaderService=xl,exports.IResourceManagerService=ec,exports.IS_ROW_STYLE_PRECEDE_COLUMN_STYLE=`isRowStylePrecedeColumnStyle`,exports.IURLImageService=yc,exports.IUndoRedoService=Tl,exports.IUniverInstanceService=nl,exports.ImageCacheMap=Ml,exports.ImageSourceType=gc,exports.ImageUploadStatusType=_c,Object.defineProperty(exports,`Inject`,{enumerable:!0,get:function(){return l.Inject}}),Object.defineProperty(exports,`InjectSelf`,{enumerable:!0,get:function(){return l.InjectSelf}}),Object.defineProperty(exports,`Injector`,{enumerable:!0,get:function(){return l.Injector}}),exports.InterceptorEffectEnum=We,exports.InterceptorManager=qe,exports.InterpolationPointType=Xt,Object.defineProperty(exports,`JSON1`,{enumerable:!0,get:function(){return m}}),exports.JSONX=Y,exports.LRUHelper=ia,exports.LRUMap=ra,Object.defineProperty(exports,`LifecycleService`,{enumerable:!0,get:function(){return ol}}),exports.LifecycleStages=$,exports.LifecycleUnreachableError=al,exports.ListGlyphType=O,Object.defineProperty(exports,`LocalUndoRedoService`,{enumerable:!0,get:function(){return jl}}),exports.LocaleService=ll,exports.LocaleType=Zt,exports.LogLevel=ir,Object.defineProperty(exports,`LookUp`,{enumerable:!0,get:function(){return l.LookUp}}),exports.MAX_COLUMN_COUNT=sa,exports.MAX_ROW_COUNT=oa,exports.MOVE_BUFFER_VALUE=2,Object.defineProperty(exports,`Many`,{enumerable:!0,get:function(){return l.Many}}),exports.MemoryCursor=dt,Object.defineProperty(exports,`MentionIOLocalService`,{enumerable:!0,get:function(){return ul}}),exports.MentionType=Qt,exports.NAMED_STYLE_MAP=ma,exports.NAMED_STYLE_SPACE_MAP=ha,exports.NamedStyleType=k,exports.NilCommand=ur,exports.NumberUnitType=Hn,exports.ObjectMatrix=yi,exports.ObjectRelativeFromH=Bn,exports.ObjectRelativeFromV=Vn,Object.defineProperty(exports,`Optional`,{enumerable:!0,get:function(){return l.Optional}}),exports.OtherShapes=nn,exports.PAGE_SIZE=_a,exports.PAPER_TYPES=qn,exports.PRESET_LIST_TYPE=ho,exports.PRINT_CHART_COMPONENT_KEY=`univer-sheets-chart-print-chart`,exports.PageElementType=Zn,exports.PageOrientType=Kn,exports.PageType=Xn,exports.PaperType=A,exports.ParagraphElementType=Dn,exports.ParagraphStyleBuilder=Js,exports.ParagraphStyleValue=qs,exports.PermissionService=ml,exports.PermissionStatus=fl,exports.Plugin=_l,Object.defineProperty(exports,`PluginService`,{enumerable:!0,get:function(){return bl}}),exports.PositionedObjectLayoutType=kn,exports.PresetListType=G,exports.ProtectionType=$t,Object.defineProperty(exports,`Quantity`,{enumerable:!0,get:function(){return l.Quantity}}),exports.QuickListType=W,exports.QuickListTypeMap=vo,exports.RANGE_DIRECTION=Zr,exports.RANGE_TYPE=L,exports.RBush=ce.default,exports.RCDisposable=Tt,exports.RGBA_PAREN=`rgba(`,exports.RGB_PAREN=`rgb(`,exports.ROTATE_BUFFER_VALUE=1,exports.RTree=Fl,exports.Range=ya,exports.Rectangle=U,Object.defineProperty(exports,`RediError`,{enumerable:!0,get:function(){return l.RediError}}),exports.RedoCommand=Al,exports.RedoCommandId=Dl,exports.RefAlias=Fa,exports.Registry=gt,exports.RegistryAsMap=_t,exports.RelativeDate=an,exports.RelativeSlideLink=Qn,Object.defineProperty(exports,`ResourceManagerService`,{enumerable:!0,get:function(){return Sl}}),exports.RichTextBuilder=Xs,exports.RichTextValue=Ys,exports.RxDisposable=wt,exports.SHEET_EDITOR_UNITS=pa,exports.SectionType=wn,Object.defineProperty(exports,`Self`,{enumerable:!0,get:function(){return l.Self}}),Object.defineProperty(exports,`SheetSkeleton`,{enumerable:!0,get:function(){return zl}}),exports.SheetTypes=on,exports.SheetViewModel=Jc,Object.defineProperty(exports,`Skeleton`,{enumerable:!0,get:function(){return Rl}}),Object.defineProperty(exports,`SkipSelf`,{enumerable:!0,get:function(){return l.SkipSelf}}),exports.SliceBodyType=Oo,exports.SlideDataModel=tl,exports.SpacingRule=An,exports.SpecialShapes=rn,exports.Styles=Cc,exports.THEME_COLORS=ti,exports.TabStopAlignment=Mn,exports.TableAlignmentType=Pn,exports.TableLayoutType=Fn,exports.TableRowHeightRule=Ln,exports.TableSizeType=Nn,exports.TableTextWrapType=In,exports.TestConfirmService=cc,exports.TextDecoration=cn,exports.TextDecorationBuilder=Ks,exports.TextDirection=sn,exports.TextDirectionType=En,exports.TextStyleBuilder=Gs,exports.TextStyleValue=Ws,exports.TextX=J,exports.TextXActionType=M,exports.ThemeColorType=D,exports.ThemeColors=hn,exports.ThemeService=Cl,exports.Tools=S,exports.UndoCommand=kl,exports.UndoCommandId=Ol,exports.UnitModel=Et,exports.Univer=$l,Object.defineProperty(exports,`UniverInstanceService`,{enumerable:!0,get:function(){return rl}}),Object.defineProperty(exports,`UniverInstanceType`,{enumerable:!0,get:function(){return f.UniverType}}),exports.UpdateDocsAttributeType=j,exports.UserManagerService=ic,exports.VerticalAlign=ln,exports.VerticalAlignmentType=Rn,Object.defineProperty(exports,`WithNew`,{enumerable:!0,get:function(){return l.WithNew}}),Object.defineProperty(exports,`Workbook`,{enumerable:!0,get:function(){return el}}),exports.Worksheet=Xc,exports.WrapStrategy=un,exports.WrapTextType=On,exports.addLinkToDocumentModel=jc,exports.afterInitApply=br,exports.afterTime=vr,exports.awaitTime=Il,exports.binSearchFirstGreaterThanTarget=Cr,exports.binarySearchArray=Sr,exports.bufferDebounceTime=_r,exports.cellToRange=Mi,exports.characterSpacingControlType=Gn,exports.checkForSubstrings=Li,exports.checkIfMove=Er,exports.checkParagraphHasBullet=zi,exports.checkParagraphHasIndent=Bi,exports.checkParagraphHasIndentByStyle=Vi,exports.cloneCellData=Lc,exports.cloneCellDataMatrix=zc,exports.cloneCellDataWithSpanAndDisplay=Rc,exports.cloneValue=Q,exports.cloneWorksheetData=Hc,exports.codeToBlob=Tr,exports.columnLabelToNumber=aa,exports.composeBody=Bo,exports.composeInterceptors=Ke,exports.composeStyles=Lt,exports.concatMatrixArray=mi,exports.convertCellToRange=bi,exports.convertObservableToBehaviorSubject=yr,exports.covertCellValue=Ni,exports.covertCellValues=Pi,exports.createAsyncInterceptorKey=Je,exports.createDefaultUser=nc,exports.createDocumentModelWithStyle=Oc,Object.defineProperty(exports,`createIdentifier`,{enumerable:!0,get:function(){return l.createIdentifier}}),exports.createInterceptorKey=Ge,exports.createInternalEditorID=Me,exports.createREGEXFromWildChar=zt,exports.createRowColIter=Ia,exports.customNameCharacterCheck=Pl,exports.dayjs=_.default,Object.defineProperty(exports,`debounce`,{enumerable:!0,get:function(){return u.debounce}}),exports.dedupe=ve,exports.dedupeBy=ye,exports.deepCompare=Fi,exports.delayAnimationFrame=Ll,exports.deleteContent=Ui,exports.extractPureTextFromCell=Zc,Object.defineProperty(exports,`forwardRef`,{enumerable:!0,get:function(){return l.forwardRef}}),exports.fromCallback=hr,exports.fromEventSubject=$s,exports.generateIntervalsByPoints=Ki,exports.generateRandomId=C,Object.defineProperty(exports,`get`,{enumerable:!0,get:function(){return u.get}}),exports.getArrayLength=ui,exports.getBodySlice=K,exports.getBorderStyleType=ki,exports.getCellCoordByIndexSimple=Bl,exports.getCellInfoInMergeData=$r,exports.getCellPositionByIndexSimple=Vl,exports.getCellValueType=qr,exports.getCellWithCoordByIndexCore=Hl,exports.getColorStyle=z,exports.getCustomBlockSlice=No,exports.getCustomDecorationSlice=Io,exports.getCustomRangeSlice=Fo,exports.getDocsUpdateBody=Ai,exports.getEmptyCell=Nc,exports.getIntersectRange=Da,exports.getNumfmtParseValueFilter=ci,exports.getOriginCellValue=Qc,exports.getParagraphsSlice=jo,exports.getPlainText=is,exports.getReverseDirection=Yt,exports.getSectionBreakSlice=Mo,exports.getTableSlice=Ao,exports.getTextRunSlice=ko,exports.getTransformOffsetX=Ul,exports.getTransformOffsetY=Wl,exports.getWorksheetUID=$c,exports.groupBy=Se,exports.handleStyleToString=Di,exports.hashAlgorithm=Gi,exports.horizontalLineSegmentsSubtraction=Ri,exports.insertMatrixArray=fi,exports.insertTextToContent=Hi,exports.invertColorByHSL=ct,exports.invertColorByMatrix=ut,Object.defineProperty(exports,`isAsyncDependencyItem`,{enumerable:!0,get:function(){return l.isAsyncDependencyItem}}),Object.defineProperty(exports,`isAsyncHook`,{enumerable:!0,get:function(){return l.isAsyncHook}}),exports.isBlackColor=Wr,exports.isBooleanString=Te,exports.isCellCoverable=wi,exports.isCellV=Yr,Object.defineProperty(exports,`isClassDependencyItem`,{enumerable:!0,get:function(){return l.isClassDependencyItem}}),exports.isCommentEditorID=Pe,Object.defineProperty(exports,`isCtor`,{enumerable:!0,get:function(){return l.isCtor}}),exports.isDefaultFormat=ri,Object.defineProperty(exports,`isDisposable`,{enumerable:!0,get:function(){return l.isDisposable}}),exports.isEmptyCell=Ci,Object.defineProperty(exports,`isFactoryDependencyItem`,{enumerable:!0,get:function(){return l.isFactoryDependencyItem}}),exports.isFormulaId=Ei,exports.isFormulaString=Ti,exports.isICellData=Kr,exports.isInternalEditorID=Ne,exports.isNodeEnv=Rt,exports.isNotNullOrUndefined=Mc,exports.isNullCell=Jr,exports.isNumeric=pt,exports.isPatternEqualWithoutDecimal=ii,exports.isRangesEqual=wc,exports.isRealNum=Wi,exports.isSafeNumeric=mt,exports.isSameStyleTextRun=Ii,exports.isTextFormat=ni,exports.isUnitRangesEqual=Tc,exports.isValidRange=ji,Object.defineProperty(exports,`isValueDependencyItem`,{enumerable:!0,get:function(){return l.isValueDependencyItem}}),exports.isWhiteColor=Gr,exports.makeArray=Ce,exports.makeCellRangeToRangeData=Si,exports.makeCellToSelection=xi,exports.makeCustomRangeStream=ns,exports.mapObjectMatrix=li,Object.defineProperty(exports,`merge`,{enumerable:!0,get:function(){return u.merge}}),exports.mergeIntervals=qi,exports.mergeLocales=Ji,exports.mergeOverrideWithDependencies=hl,exports.mergeSets=xt,Object.defineProperty(exports,`mergeWith`,{enumerable:!0,get:function(){return u.mergeWith}}),exports.mergeWorksheetSnapshotWithDefault=Kc,exports.mixinClass=ft,exports.moveMatrixArray=gi,exports.moveRangeByOffset=ba,exports.nameCharacterCheck=Nl,exports.normalizeBody=Po,exports.normalizeTextRuns=Wa,exports.numberToABC=Ra,exports.numberToListABC=Ba,Object.defineProperty(exports,`numfmt`,{enumerable:!0,get:function(){return g}}),exports.queryObjectMatrix=Pa,exports.registerDependencies=Fe,exports.remove=_e,exports.repeatStringNumTimes=za,exports.replaceInDocumentBody=Vs,exports.requestImmediateMacroTask=vt,exports.resolveWithBasePath=Nt,exports.rotate=xe,exports.searchArray=wr,exports.searchInOrderedArray=xr,exports.selectionToArray=Xr,exports.sequence=bt,exports.sequenceAsync=yt,exports.sequenceExecute=pr,exports.sequenceExecuteAsync=mr,Object.defineProperty(exports,`set`,{enumerable:!0,get:function(){return u.set}}),Object.defineProperty(exports,`setDependencies`,{enumerable:!0,get:function(){return l.setDependencies}}),exports.shallowEqual=Le,exports.skipParseTagNames=Gl,exports.sliceMatrixArray=hi,exports.sortRules=Va,exports.sortRulesByDesc=Ha,exports.sortRulesFactory=Ua,exports.spliceArray=pi,exports.splitIntoGrid=Sa,exports.takeAfter=gr,Object.defineProperty(exports,`textDiff`,{enumerable:!0,get:function(){return le.default}}),exports.throttle=Be,exports.toDisposable=b,exports.touchDependencies=Ie,exports.updateAttributeByDelete=Uo,exports.updateAttributeByInsert=Wo,exports.willLoseNumericPrecision=ht;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`async-lock`);c=s(c);let l=require(`@wendellhu/redi`),u=require(`lodash-es`),d=require(`rxjs`),f=require(`@univerjs/protocol`),p=require(`nanoid`),m=require(`ot-json1`);m=s(m);let h=require(`rxjs/operators`),g=require(`numfmt`);g=s(g);let _=require(`dayjs`);_=s(_);let ee=require(`dayjs/plugin/advancedFormat`);ee=s(ee);let te=require(`dayjs/plugin/customParseFormat`);te=s(te);let ne=require(`dayjs/plugin/localeData`);ne=s(ne);let re=require(`dayjs/plugin/localizedFormat`);re=s(re);let ie=require(`dayjs/plugin/utc`);ie=s(ie);let ae=require(`dayjs/plugin/weekday`);ae=s(ae);let oe=require(`dayjs/plugin/weekOfYear`);oe=s(oe);let se=require(`dayjs/plugin/weekYear`);se=s(se);let ce=require(`rbush`);ce=s(ce);let le=require(`fast-diff`);le=s(le);let ue=require(`@univerjs/themes`),de=require(`kdbush`);de=s(de);const fe=typeof global<`u`?global:typeof self<`u`?self:window;function pe(){let e=new Map,t=0;typeof fe.requestIdleCallback!=`function`&&(fe.requestIdleCallback=function(n){let r=Date.now(),i=++t,a=setTimeout(function(){e.delete(i);let t=Math.max(0,50-(Date.now()-r));n({didTimeout:t===0,timeRemaining(){return t}})},1);return e.set(i,a),i}),typeof fe.cancelIdleCallback!=`function`&&(fe.cancelIdleCallback=function(t){let n=e.get(t);n!==void 0&&(clearTimeout(n),e.delete(t))})}function me(){typeof fe.Array.prototype.findLastIndex!=`function`&&(fe.Array.prototype.findLastIndex=function(e,t){if(this==null)throw TypeError(`Array.prototype.findLastIndex called on null or undefined`);if(typeof e!=`function`)throw TypeError(`callback must be a function`);let n=this.length>>>0;for(let r=n-1;r>=0;r--)if(r in this&&e.call(t,this[r],r,this))return r;return-1}),typeof fe.Array.prototype.findLast!=`function`&&(fe.Array.prototype.findLast=function(e,t){let n=this.findLastIndex(e,t);return n===-1?void 0:this[n]})}function he(){typeof fe.String.prototype.at!=`function`&&(fe.String.prototype.at=function(e){if(this==null)throw TypeError(`String.prototype.at called on null or undefined`);let t=this.length;if(e<0&&(e=t+e),!(e<0||e>=t))return this.charAt(e)})}function ge(){pe(),me(),he()}function _e(e,t){let n=e.indexOf(t);return n>-1?(e.splice(n,1),!0):!1}function ve(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function ye(e,t){let n=new Set,r=[];for(let i of e){let e=t(i);n.has(e)||(n.add(e),r.push(i))}return r}function be(e,t){for(let n=e.length-1;n>-1;n--){let r=e[n];if(t(r,n))return r}return null}function xe(e,t){if(e.length===0)return e;let n=t%e.length;return e.slice(n).concat(e.slice(0,n))}function Se(e,t){let n=new Map;return e.forEach(e=>{let r=t(e),i=n.get(r);n.has(r)||(i=[],n.set(r,i)),i.push(e)}),n}function Ce(e){return Array.isArray(e)?e:[e]}const we=new Set([`true`,`false`]);function Te(e){return we.has(e.toLowerCase())}const Ee=`__INTERNAL_EDITOR__`,De=`${Ee}DOCS_NORMAL`,Oe=`${Ee}DOCS_FORMULA_BAR`,ke=`${Ee}ZEN_EDITOR`,Ae=`${Ee}COMMENT_EDITOR`,je=Symbol(`AUTO_HEIGHT_FOR_MERGED_CELLS`);function Me(e){return`${Ee}${e}`}function Ne(e){return e.startsWith(Ee)}function Pe(e){return e.startsWith(Ae)}function Fe(e,t){t.forEach(t=>e.add(t))}function Ie(e,t){t.forEach(([t])=>{e.has(t)&&e.get(t)})}function Le(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;let i=Object.prototype.hasOwnProperty.bind(t);for(let r=0;r<n.length;r++){let a=n[r];if(!i(a)||e[a]!==t[a])return!1}return!0}var Re=class extends Error{constructor(e){super(e),this.name=`CustomCommandExecutionError`}},ze=class extends Re{constructor(){super(`Canceled by facade`),this.name=`CanceledError`}};function Be(e,t=16){let n=0,r=null;return function(...i){let a=Date.now();a-n<t?(r&&clearTimeout(r),r=setTimeout(()=>{n=a,e.apply(this,i)},t)):(n=a,e.apply(this,i))}}function Ve(e){"@babel/helpers - typeof";return Ve=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Ve(e)}function He(e,t){if(Ve(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Ve(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Ue(e){var t=He(e,`string`);return Ve(t)==`symbol`?t:t+``}function v(e,t,n){return(t=Ue(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let We=function(e){return e[e.Style=1]=`Style`,e[e.Value=2]=`Value`,e}({});function Ge(e){return`sheet_interceptor_${e}`}const Ke=e=>function(t,n){let r=-1,i=t;for(let t=0;t<=e.length;t++){if(t<=r)throw Error(`[SheetInterceptorService]: next() called multiple times!`);if(r=t,t===e.length)return i;let a=e[t],o=!1;if(i=a.handler(i,n,e=>(o=!0,e)),!o)break}return i};var qe=class{constructor(e){v(this,`_interceptorsByName`,new Map),v(this,`_interceptorPoints`,void 0),this._interceptorPoints=e}fetchThroughInterceptors(e,t){let n=e,r=this._interceptorsByName.get(n);return t&&(r=r.filter(t)),Ke(r||[])}intercept(e,t){let n=e;this._interceptorsByName.has(n)||this._interceptorsByName.set(n,[]);let r=this._interceptorsByName.get(n);return r.push(t),this._interceptorsByName.set(n,r.sort((e,t)=>{var n,r;return((n=t.priority)==null?0:n)-((r=e.priority)==null?0:r)})),()=>_e(this._interceptorsByName.get(n),t)}getInterceptPoints(){return this._interceptorPoints}dispose(){this._interceptorsByName.clear()}};function Je(e){return`sheet_async_interceptor_${e}`}const Ye=e=>async function(t,n){let r=-1,i=t;for(let t=0;t<=e.length;t++){if(t<=r)throw Error(`[SheetInterceptorService]: next() called multiple times!`);if(r=t,t===e.length)return i;let a=e[t],o=!1;if(i=await a.handler(i,n,async e=>(o=!0,e)),!o)break}return i};var Xe=class{constructor(e){v(this,`_asyncInterceptorsByName`,new Map),v(this,`_asyncInterceptorPoints`,void 0),this._asyncInterceptorPoints=e}fetchThroughAsyncInterceptors(e,t){let n=e,r=this._asyncInterceptorsByName.get(n);return t&&(r=r.filter(t)),Ye(r||[])}async interceptAsync(e,t){let n=e;this._asyncInterceptorsByName.has(n)||this._asyncInterceptorsByName.set(n,[]);let r=this._asyncInterceptorsByName.get(n);return r.push(t),this._asyncInterceptorsByName.set(n,r.sort((e,t)=>{var n,r;return((n=t.priority)==null?0:n)-((r=e.priority)==null?0:r)})),()=>_e(this._asyncInterceptorsByName.get(n),t)}getInterceptPoints(){return this._asyncInterceptorPoints}dispose(){this._asyncInterceptorsByName.clear()}};function Ze(e){return e.map(e=>e/255)}function Qe(e){return e.map(e=>Math.round(e*255))}function $e([e,t,n]){let r=Math.max(e,t,n),i=Math.min(e,t,n),a=(r+i)/2,o=0,s=0;if(r!==i){let c=r-i;switch(s=a>.5?c/(2-r-i):c/(r+i),r){case e:o=(t-n)/c+(t<n?6:0);break;case t:o=(n-e)/c+2;break;case n:o=(e-t)/c+4;break}o/=6}return[o,s,a]}function et(e,t,n){let r=[e,t,n].map(e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4);return .2126*r[0]+.7152*r[1]+.0722*r[2]}function tt(e,t){return(Math.max(e,t)+.05)/(Math.min(e,t)+.05)}function nt(e,t,n){let r,i,a;if(t===0)r=i=a=n;else{let o=(e,t,n)=>{let r=n;return r<0&&(r+=1),r>1&&--r,r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e},s=n<.5?n*(1+t):n+t-n*t,c=2*n-s;r=o(c,s,e+1/3),i=o(c,s,e),a=o(c,s,e-1/3)}return[r,i,a]}const rt={r:1,g:1,b:1},it={r:0,g:0,b:0},at=et(rt.r,rt.g,rt.b),ot=et(it.r,it.g,it.b);function st(e){let t=tt(at,et(e[0],e[1],e[2])),n=$e(e),r=1-n[2],i,a,o;do i=nt(n[0],n[1],r),a=et(i[0],i[1],i[2]),o=tt(a,ot),r+=.01;while(r<=1&&r>=0&&Math.abs(o-t)<.01);return i}function ct(e){return Qe(st(Ze(e)))}const y=[[.333,-.667,-.667,0,1],[-.667,.333,-.667,0,1],[-.667,-.667,.333,0,1],[0,0,0,1,0]];function lt(e){let t=e[0],n=e[1],r=e[2],i=[y[0][0]*t+y[0][1]*n+y[0][2]*r+y[0][4],y[1][0]*t+y[1][1]*n+y[1][2]*r+y[1][4],y[2][0]*t+y[2][1]*n+y[2][2]*r+y[2][4]];return i=i.map(e=>e>1?1:e<0?0:e),i}function ut(e){return Qe(lt(Ze(e)))}var dt=class{constructor(){v(this,`cursor`,0)}reset(){return this.cursor=0,this}moveCursor(e){this.cursor+=e}moveCursorTo(e){this.cursor=e}};function ft(e,t){for(let n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}function pt(e){return/^-?\d+(\.\d+)?$/.test(e)}function mt(e){return pt(e)?Number(e)<=2**53-1:!1}function ht(e){return Number(e)>2**53-1||e.length>=18}var gt=class e{constructor(){v(this,`_data`,[])}static create(){return new e}add(e){this._data.indexOf(e)>-1||this._data.push(e)}delete(e){let t=this._data.indexOf(e);this._data.splice(t,1)}getData(){return this._data}},_t=class e{constructor(){v(this,`_data`,new Map)}static create(){return new e}add(e,t){this._data.has(e)||this._data.set(e,t)}delete(e){this._data.delete(e)}getData(){return this._data}};function vt(e){let t=new MessageChannel,n=!1,r=()=>{n||e()};return t.port1.onmessage=r,t.port2.postMessage(null),()=>{n=!0,t.port1.onmessage=null,t.port1.close(),t.port2.close()}}async function yt(e){for(let[t,n]of e.entries())try{if(!await n())return{index:t,result:!1}}catch(e){return{index:t,result:!1,error:e}}return{result:!0,index:-1}}function bt(e){for(let[t,n]of e.entries())try{if(!n())return{index:t,result:!1}}catch(e){return{index:t,result:!1,error:e}}return{result:!0,index:-1}}function xt(e,t){return t.forEach(t=>e.add(t)),e}function St(e){return e instanceof d.Subscription||e instanceof d.Subject||e&&`closed`in e&&e.unsubscribe!==void 0}function b(e){let t=!1;return e?St(e)?{dispose:()=>e.unsubscribe()}:typeof e==`function`?{dispose:()=>{t||(t=!0,e())}}:e:b(()=>{})}var Ct=class{constructor(){v(this,`_disposables`,new Set)}add(e){let t=b(e);return this._disposables.add(t),{dispose:(e=!1)=>{e||t.dispose(),this._disposables.delete(t)}}}dispose(){this._disposables.forEach(e=>{e.dispose()}),this._disposables.clear()}},x=class{constructor(){v(this,`_disposed`,!1),v(this,`_collection`,new Ct)}disposeWithMe(e){return this._collection.add(e)}ensureNotDisposed(){if(this._disposed)throw Error(`[Disposable]: object is disposed!`)}dispose(){this._disposed||(this._disposed=!0,this._collection.dispose())}},wt=class extends x{constructor(...e){super(...e),v(this,`dispose$`,new d.Subject)}dispose(){super.dispose(),this.dispose$.next(),this.dispose$.complete()}},Tt=class extends x{constructor(e){super(),this._rootDisposable=e,v(this,`_ref`,0)}inc(){if(this._disposed)throw Error(`[RCDisposable]: should not ref to a disposed.`);this._ref+=1}dec(){--this._ref,this._ref===0&&(this._rootDisposable.dispose(),this.dispose())}},Et=class extends x{};const Dt=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`.split(`.`)),Ot=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 kt(e){if(!Number.isNaN(+e))return!1;if(e.startsWith(`http://localhost:3002`)||e.startsWith(`localhost:3002`))return!0;if(Ot.test(e)){if(At(e))return!0;try{let t=new URL(Mt(e)).hostname.split(`.`).pop();if(t&&Dt.has(t))return!0}catch{return!1}}return!1}function At(e){return/^[a-zA-Z]+:\/\//.test(e)}function jt(e){return/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(e)}function Mt(e){return At(e)?e:jt(e)?`mailto://${e}`:`https://${e}`}function Nt(e,t){try{let n=new URL(t),r=n.pathname.endsWith(`/`)?n.pathname:`${n.pathname}/`,i=e.startsWith(`/`)?e.substring(1):e;return new URL(i,n.origin+r).toString()}catch(t){return console.error(`Error resolving URL with base URL:`,t),e}}function Pt(e,t){return S.getValueType(e)===S.getValueType(t)?S.isArray(e)?Ft(e,t):S.isObject(e)?It(e,t):S.isDate(e)?e.getTime()===t.getTime():S.isRegExp(e)?e.toString()===t.toString():e===t:!1}function Ft(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;n++){let r=e[n],i=t[n];if(!Pt(r,i))return!1}return!0}function It(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i of n){if(!r.includes(i))return!1;let n=e[i],a=t[i];if(!Pt(n,a))return!1}return!0}var S=class e{static deleteNull(e){for(let t in e)(e[t]===null||e[t]===void 0)&&delete e[t];return e}static getSystemType(){let e=navigator.userAgent,t=navigator.platform===`Win32`||navigator.platform===`Windows`,n=navigator.platform===`Mac68K`||navigator.platform===`MacPPC`||navigator.platform===`Macintosh`||navigator.platform===`MacIntel`;if(n)return`Mac`;if(navigator.platform===`X11`&&!t&&!n)return`Unix`;if(String(navigator.platform).indexOf(`Linux`)>-1)return`Linux`;if(t){if(e.indexOf(`Windows NT 5.0`)>-1||e.indexOf(`Windows 2000`)>-1)return`Windows 2000`;if(e.indexOf(`Windows NT 5.1`)>-1||e.indexOf(`Windows XP`)>-1)return`Windows XP`;if(e.indexOf(`Windows NT 5.2`)>-1||e.indexOf(`Windows 2003`)>-1)return`Windows 2003`;if(e.indexOf(`Windows NT 6.0`)>-1||e.indexOf(`Windows Vista`)>-1)return`Windows Vista`;if(e.indexOf(`Windows NT 6.1`)>-1||e.indexOf(`Windows 7`)>-1)return`Windows 7`;if(e.indexOf(`Windows NT 10`)>-1||e.indexOf(`Windows 10`)>-1)return`Windows 10`;if(e.indexOf(`Windows NT 11`)>-1||e.indexOf(`Windows 11`)>-1)return`Windows 11`}return`Unknown system`}static getBrowserType(){let e=navigator.userAgent,t=e.indexOf(`Opera`)>-1,n=e.indexOf(`compatible`)>-1&&e.indexOf(`MSIE`)>-1&&!t,r=e.indexOf(`Trident`)>-1&&e.indexOf(`rv:11.0`)>-1,i=e.indexOf(`Edge`)>-1,a=e.indexOf(`Firefox`)>-1,o=e.indexOf(`Safari`)>-1&&e.indexOf(`Chrome`)===-1,s=e.indexOf(`Chrome`)>-1&&e.indexOf(`Safari`)>-1;if(n){RegExp(`MSIE (\\d+\\.\\d+);`).test(e);let t=Number.parseFloat(RegExp.$1);return t===7?`IE7`:t===8?`IE8`:t===9?`IE9`:t===10?`IE10`:`0`}return a?`FF`:t?`Opera`:o?`Safari`:s?`Chrome`:i?`Edge`:r?`IE11`:`Unknown browser`}static deepMerge(t,...n){n.forEach(e=>e&&a(e));function r(t,n){t.forEach((t,a)=>{if(e.isArray(t)){var o;let e=(o=n[a])==null?[]:o;n[a]=e,r(t,e);return}if(e.isObject(t)){var s;let e=(s=n[a])==null?{}:s;n[a]=e,i(t,e);return}n[a]=t})}function i(t,n){Object.keys(t).forEach(a=>{let o=t[a];if(e.isObject(o)){var s;let e=(s=n[a])==null?{}:s;n[a]=e,i(o,e);return}if(e.isArray(o)){var c;let e=(c=n[a])==null?[]:c;n[a]=e,r(o,e);return}n[a]=o})}function a(n){Object.keys(n).forEach(a=>{let o=n[a];if(e.isArray(o)){var s;let e=(s=t[a])==null?[]:s;t[a]=e,r(o,e);return}if(e.isObject(o)){var c;let e=(c=t[a])==null?{}:c;t[a]=e,i(o,e);return}t[a]=o})}return t}static diffValue(e,t){return Pt(e,t)}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)){let n=[];return t.forEach((t,r)=>{n[r]=e.deepClone(t)}),n}if(this.isObject(t)){let n={};return Object.keys(t).forEach(r=>{let i=t[r];n[r]=e.deepClone(i)}),Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n}return t}static getValueType(e){return Object.prototype.toString.apply(e)}static isDefine(e){return e!=null}static isBlank(e){return this.isDefine(e)?this.isString(e)?e.trim()===``:!1:!0}static isPlainObject(e){return this.isDefine(e)?Object.getPrototypeOf(e)===Object.getPrototypeOf({}):!1}static isDate(e){return this.getValueType(e)===`[object Date]`}static isRegExp(e){return this.getValueType(e)===`[object RegExp]`}static isArray(e){return this.getValueType(e)===`[object Array]`}static isString(e){return this.getValueType(e)===`[object String]`}static isNumber(e){return this.getValueType(e)===`[object Number]`}static isStringNumber(e){return!isNaN(Number.parseFloat(e))&&isFinite(e)}static isObject(e){return this.getValueType(e)===`[object Object]`}static isEmptyObject(e){for(let t in e)return!1;return!0}static isTablet(){return/ipad|android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent.toLowerCase())}static isIPhone(){return/iPhone/i.test(navigator.userAgent)}static isLegalUrl(e){return kt(e)}static normalizeUrl(e){return Mt(e)}static topLevelDomainCombiningString(){return[...Dt].join(`|`)}static removeNull(t){return this.isObject(t)&&Object.keys(t).forEach(n=>{let r=t[n];r==null?delete t[n]:e.removeNull(r)}),t}static numToWord(e){let t=``;for(;e>0;){let n=e%26;n=n===0?n=26:n,t=String.fromCharCode(96+n)+t,e=(e-n)/26}return t.toLocaleUpperCase()}static ABCatNum(e){if(e==null||e.length===0)return NaN;let t=e.toLowerCase().split(``),n=t.length,r=0,i=0;for(let e=0;e<n;e++)i=t[e].charCodeAt(0)-96,r+=i*26**(n-e-1);return r===0?NaN:r-1}static chatAtABC(e){let t=``;for(;e>=0;)t=String.fromCharCode(e%26+97)+t,e=Math.floor(e/26)-1;return t.toUpperCase()}static commonExtend(e,t){let n={};for(let t in e)n[t]=e[t];for(let e in t)t[e]!=null&&(n[e]=t[e]);return n}static hasIntersectionBetweenTwoRanges(e,t,n,r){return t>=n&&r>=e}static isStartValidPosition(e){return/^[A-Za-zА-Яа-яЁё_]/.test(e)}static isValidParameter(e){let t=/[~!@#$%^&*()+=\-{}\[\]\|:;"'<>,?\/ ]+/.test(e),n=e.length<=255;return!t&&n}static clamp(e,t,n){return Math.max(t,Math.min(n,e))}static now(){return performance&&performance.now?performance.now():Date.now()}};function C(e=21,t){return t?(0,p.customAlphabet)(t,e)():(0,p.nanoid)(e)}function Lt(...e){let t={},n=e.length;for(let r=n-1;r>=0;r--){let n=e[r];if(n){let e=Object.keys(n);for(let r of e)t[r]===void 0&&(t[r]=n[r])}}return t}const Rt=()=>typeof process<`u`&&process.versions!=null&&process.versions.node!=null;function zt(e){let t=e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`).replace(/\\\*/g,`.*`).replace(/\\\?/g,`.`);return RegExp(`^${t}$`,`i`)}let Bt=function(e){return e[e.DEFAULT_SERIES=0]=`DEFAULT_SERIES`,e[e.ALTERNATE_SERIES=1]=`ALTERNATE_SERIES`,e}({}),w=function(e){return 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}({}),Vt=function(e){return 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}({}),Ht=function(e){return e[e.UNSUPPORTED=0]=`UNSUPPORTED`,e[e.RGB=1]=`RGB`,e[e.HEX=2]=`HEX`,e[e.THEME=3]=`THEME`,e}({}),Ut=function(e){return e[e.ON=0]=`ON`,e[e.OFF=1]=`OFF`,e}({}),Wt=function(e){return 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}({}),Gt=function(e){return e[e.LEFT=0]=`LEFT`,e[e.RIGHT=1]=`RIGHT`,e}({}),Kt=function(e){return e[e.DOCUMENT=0]=`DOCUMENT`,e[e.PROJECT=1]=`PROJECT`,e}({}),qt=function(e){return e[e.COLUMNS=0]=`COLUMNS`,e[e.ROWS=1]=`ROWS`,e}({}),Jt=function(e){return e[e.UP=0]=`UP`,e[e.RIGHT=1]=`RIGHT`,e[e.DOWN=2]=`DOWN`,e[e.LEFT=3]=`LEFT`,e}({});function Yt(e){switch(e){case Jt.LEFT:return Jt.RIGHT;case Jt.RIGHT:return Jt.LEFT;case Jt.UP:return Jt.DOWN;case Jt.DOWN:return Jt.UP}}let Xt=function(e){return 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}({}),Zt=function(e){return 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.JA_JP=`jaJP`,e.KO_KR=`koKR`,e.ES_ES=`esES`,e.CA_ES=`caES`,e.SK_SK=`skSK`,e}({}),Qt=function(e){return 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}({}),$t=function(e){return e[e.RANGE=0]=`RANGE`,e[e.SHEET=1]=`SHEET`,e}({}),en=function(e){return 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}({}),tn=function(e){return 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}({}),nn=function(e){return 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}({}),rn=function(e){return 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}({}),an=function(e){return 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}({}),on=function(e){return e[e.GRID=0]=`GRID`,e[e.KANBAN=1]=`KANBAN`,e[e.GANTT=2]=`GANTT`,e}({}),sn=function(e){return e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.LEFT_TO_RIGHT=1]=`LEFT_TO_RIGHT`,e[e.RIGHT_TO_LEFT=2]=`RIGHT_TO_LEFT`,e}({}),cn=function(e){return 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}({}),T=function(e){return 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}({}),ln=function(e){return e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.TOP=1]=`TOP`,e[e.MIDDLE=2]=`MIDDLE`,e[e.BOTTOM=3]=`BOTTOM`,e}({}),un=function(e){return e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.OVERFLOW=1]=`OVERFLOW`,e[e.CLIP=2]=`CLIP`,e[e.WRAP=3]=`WRAP`,e}({}),dn=function(e){return e[e.NORMAL=0]=`NORMAL`,e[e.ITALIC=1]=`ITALIC`,e}({}),fn=function(e){return e[e.NORMAL=0]=`NORMAL`,e[e.BOLD=1]=`BOLD`,e}({}),pn=function(e){return e[e.NORMAL=1]=`NORMAL`,e[e.SUBSCRIPT=2]=`SUBSCRIPT`,e[e.SUPERSCRIPT=3]=`SUPERSCRIPT`,e}({}),E=function(e){return e[e.FALSE=0]=`FALSE`,e[e.TRUE=1]=`TRUE`,e}({}),mn=function(e){return e[e.STRING=1]=`STRING`,e[e.NUMBER=2]=`NUMBER`,e[e.BOOLEAN=3]=`BOOLEAN`,e[e.FORCE_STRING=4]=`FORCE_STRING`,e}({}),D=function(e){return 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}({}),hn=function(e){return 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}({}),gn=function(e){return e[e.character=0]=`character`,e[e.paragraph=1]=`paragraph`,e[e.table=2]=`table`,e[e.numbering=3]=`numbering`,e}({}),_n=function(e){return e[e.TAB=0]=`TAB`,e[e.SPACE=1]=`SPACE`,e[e.NOTHING=2]=`NOTHING`,e}({}),O=function(e){return 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}({}),vn=function(e){return 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}({}),yn=function(e){return 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}({}),bn=function(e){return e[e.COMMENT=0]=`COMMENT`,e[e.DELETED=9999]=`DELETED`,e}({}),xn=function(e){return e[e.DRAWING=0]=`DRAWING`,e[e.CUSTOM=1]=`CUSTOM`,e}({}),Sn=function(e){return e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.TRADITIONAL=1]=`TRADITIONAL`,e[e.MODERN=2]=`MODERN`,e}({}),Cn=function(e){return 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}({}),wn=function(e){return 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}({}),Tn=function(e){return 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}({}),En=function(e){return e[e.NORMAL=0]=`NORMAL`,e[e.TBRL=1]=`TBRL`,e[e.LRTBV=2]=`LRTBV`,e}({}),Dn=function(e){return 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}({}),On=function(e){return e[e.BOTH_SIDES=0]=`BOTH_SIDES`,e[e.LEFT=1]=`LEFT`,e[e.RIGHT=2]=`RIGHT`,e[e.LARGEST=3]=`LARGEST`,e}({}),kn=function(e){return 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}({}),k=function(e){return 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}({}),An=function(e){return e[e.AUTO=0]=`AUTO`,e[e.AT_LEAST=1]=`AT_LEAST`,e[e.EXACT=2]=`EXACT`,e}({}),jn=function(e){return 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}({}),Mn=function(e){return 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}({}),Nn=function(e){return e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.SPECIFIED=1]=`SPECIFIED`,e}({}),Pn=function(e){return e[e.START=0]=`START`,e[e.CENTER=1]=`CENTER`,e[e.END=2]=`END`,e}({}),Fn=function(e){return e[e.AUTO_FIT=0]=`AUTO_FIT`,e[e.FIXED=1]=`FIXED`,e}({}),In=function(e){return e[e.NONE=0]=`NONE`,e[e.WRAP=1]=`WRAP`,e}({}),Ln=function(e){return e[e.AUTO=0]=`AUTO`,e[e.AT_LEAST=1]=`AT_LEAST`,e[e.EXACT=2]=`EXACT`,e}({}),Rn=function(e){return 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}({}),zn=function(e){return e.NORMAL=`normal`,e.BOLD=`bold`,e.ITALIC=`italic`,e}({}),Bn=function(e){return 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}({}),Vn=function(e){return 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}({}),Hn=function(e){return 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}({}),Un=function(e){return 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}({}),Wn=function(e){return 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}({}),Gn=function(e){return e[e.compressPunctuation=0]=`compressPunctuation`,e[e.compressPunctuationAndJapaneseKana=1]=`compressPunctuationAndJapaneseKana`,e[e.doNotCompress=2]=`doNotCompress`,e}({}),Kn=function(e){return e[e.PORTRAIT=0]=`PORTRAIT`,e[e.LANDSCAPE=1]=`LANDSCAPE`,e}({}),A=function(e){return 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}({});const qn=[A.A3,A.A4,A.A5,A.B4,A.B5,A.Letter,A.Tabloid,A.Legal,A.Statement,A.Executive,A.Folio];let Jn=function(e){return e[e.forward=0]=`forward`,e[e.backward=1]=`backward`,e[e.front=2]=`front`,e[e.back=3]=`back`,e}({}),Yn=function(e){return 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}({}),Xn=function(e){return 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}({}),Zn=function(e){return 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}({}),Qn=function(e){return 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}({});function $n(){return e=>e}const er=$n()([`s`,`c`,`cl`,`t`]),tr=$n()([`rgb`,`th`]),nr=$n()([`s`,`cl`]),rr=$n()([`t`,`r`,`b`,`l`,`tl_br`,`tl_bc`,`tl_mr`,`bl_tr`,`ml_tr`,`bc_tr`]),ir=$n()([`a`,`v`]),ar=$n()([`t`,`r`,`b`,`l`]),or=$n()([`ff`,`fs`,`it`,`bl`,`ul`,`bbl`,`st`,`ol`,`bg`,`bd`,`cl`,`va`,`n`,`tr`,`td`,`ht`,`vt`,`tb`,`pd`]);function sr(e=C(6),t=Zt.EN_US,n=``){return{id:e,locale:t,title:n,tableSource:{},drawings:{},drawingsOrder:[],headers:{},footers:{},body:{dataStream:`\r
2
+ `,textRuns:[],customBlocks:[],tables:[],paragraphs:[{startIndex:0,paragraphStyle:{spaceAbove:{v:5},lineSpacing:1,spaceBelow:{v:0}}}],sectionBreaks:[{startIndex:1}]},documentStyle:{pageSize:{width:595/.75,height:842/.75},documentFlavor:Sn.TRADITIONAL,marginTop:50,marginBottom:50,marginRight:50,marginLeft:50,renderConfig:{zeroWidthParagraphBreak:E.FALSE,vertexAngle:0,centerAngle:0,background:{rgb:`#ccc`}},autoHyphenation:E.TRUE,doNotHyphenateCaps:E.FALSE,consecutiveHyphenLimit:2,defaultHeaderId:``,defaultFooterId:``,evenPageHeaderId:``,evenPageFooterId:``,firstPageHeaderId:``,firstPageFooterId:``,evenAndOddHeaders:E.FALSE,useFirstPageHeaderFooter:E.FALSE,marginHeader:30,marginFooter:30},settings:{}}}let j=function(e){return e[e.COVER=0]=`COVER`,e[e.REPLACE=1]=`REPLACE`,e}({}),M=function(e){return e.RETAIN=`r`,e.INSERT=`i`,e.DELETE=`d`,e}({});const cr=(0,l.createIdentifier)(`univer.config-service`);var lr=class{constructor(){v(this,`_configChanged$`,new d.Subject),v(this,`configChanged$`,this._configChanged$.asObservable()),v(this,`_config`,new Map)}dispose(){this._config.clear(),this._configChanged$.complete()}getConfig(e){return this._config.get(e)}setConfig(e,t,n){var r;let{merge:i=!1}=n||{},a=(r=this._config.get(e))==null?{}:r;a=i?(0,u.merge)(a,t):t,this._config.set(e,a),this._configChanged$.next({[e]:a})}deleteConfig(e){return this._config.delete(e)}subscribeConfigValue$(e){return new d.Observable(t=>{Object.prototype.hasOwnProperty.call(this._config,e)&&t.next(this._config.get(e));let n=this.configChanged$.pipe((0,d.filter)(t=>Object.prototype.hasOwnProperty.call(t,e))).subscribe(n=>t.next(n[e]));return()=>n.unsubscribe()})}};const ur=(0,l.createIdentifier)(`univer.context-service`);var dr=class extends x{constructor(...e){super(...e),v(this,`_contextChanged$`,new d.Subject),v(this,`contextChanged$`,this._contextChanged$.asObservable()),v(this,`_contextMap`,new Map)}dispose(){super.dispose(),this._contextChanged$.complete(),this._contextMap.clear()}getContextValue(e){var t;return(t=this._contextMap.get(e))==null?!1:t}setContextValue(e,t){this._contextMap.set(e,t),this._contextChanged$.next({[e]:t})}subscribeContextValue$(e){return new d.Observable(t=>{let n=this._contextChanged$.pipe((0,d.filter)(t=>t[e]!==void 0)).subscribe(n=>t.next(n[e]));return this._contextMap.has(e)&&t.next(this._contextMap.get(e)),()=>n.unsubscribe()})}};let fr=function(e){return 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}({});const N=(0,l.createIdentifier)(`univer.log`);var pr=class extends x{constructor(...e){super(...e),v(this,`_logLevel`,fr.INFO),v(this,`_deduction`,new Set)}dispose(){super.dispose(),this._logLevel=fr.INFO,this._deduction.clear()}debug(...e){this._logLevel>=fr.VERBOSE&&this._log(console.debug,...e)}log(...e){this._logLevel>=fr.INFO&&this._log(console.log,...e)}warn(...e){this._logLevel>=fr.WARN&&this._log(console.warn,...e)}error(...e){this._logLevel>=fr.ERROR&&this._log(console.error,...e)}deprecate(...e){this._logLevel>=fr.WARN&&this._logWithDeduplication(console.error,...e)}setLogLevel(e){this._logLevel=e}_log(e,...t){let n=t[0];/^\[(.*?)\]/g.test(n)?e(`\x1B[97;104m${n}\x1B[0m`,...t.slice(1)):e(...t)}_logWithDeduplication(e,...t){let n=mr(...t);this._deduction.has(n)||(this._deduction.add(n),this._log(e,...t))}};function mr(...e){return e.map(e=>JSON.stringify(e)).join(``)}function P(e,t){return function(n,r){t(n,r,e)}}function F(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}const hr=`command.logExecution`;let I=function(e){return e[e.COMMAND=0]=`COMMAND`,e[e.OPERATION=1]=`OPERATION`,e[e.MUTATION=2]=`MUTATION`,e}({});const gr=(0,l.createIdentifier)(`univer.core.command-service`);var _r=class{constructor(){v(this,`_commands`,new Map),v(this,`_commandTypes`,new Map)}registerCommand(e){if(this._commands.has(e.id))throw Error(`[CommandRegistry]: command "${e.id}" has been registered before.`);return this._commands.set(e.id,e),this._commandTypes.set(e.id,e.type),b(()=>{this.unregisterCommand(e.id)})}unregisterCommand(e){this._commands.delete(e),this._commandTypes.delete(e)}hasCommand(e){return this._commands.has(e)}getCommand(e){return this._commands.has(e)?[this._commands.get(e)]:null}getCommandType(e){return this._commandTypes.get(e)}};const vr={id:`nil`,type:I.COMMAND,handler:()=>!0};let yr=class extends x{constructor(e,t,n){super(),this._injector=e,this._logService=t,this._configService=n,v(this,`_commandRegistry`,void 0),v(this,`_beforeCommandExecutionListeners`,[]),v(this,`_commandExecutedListeners`,[]),v(this,`_collabMutationListeners`,[]),v(this,`_multiCommandDisposables`,new Map),v(this,`_commandExecutingLevel`,0),v(this,`_commandExecutionStack`,[]),this._commandRegistry=new _r,this.registerCommand(vr)}dispose(){super.dispose(),this._commandExecutedListeners.length=0,this._beforeCommandExecutionListeners.length=0,this._collabMutationListeners.length=0}disposed(){return this._disposed}hasCommand(e){return this._commandRegistry.hasCommand(e)}registerCommand(e){return this._commandRegistry.registerCommand(e)}unregisterCommand(e){var t;this._commandRegistry.unregisterCommand(e),(t=this._multiCommandDisposables.get(e))==null||t.dispose()}registerMultipleCommand(e){return this._registerMultiCommand(e)}beforeCommandExecuted(e){if(this._beforeCommandExecutionListeners.indexOf(e)===-1)return this._beforeCommandExecutionListeners.push(e),b(()=>{let t=this._beforeCommandExecutionListeners.indexOf(e);this._beforeCommandExecutionListeners.splice(t,1)});throw Error(`[CommandService]: could not add a listener twice.`)}onCommandExecuted(e){if(this._commandExecutedListeners.indexOf(e)===-1)return this._commandExecutedListeners.push(e),b(()=>{let t=this._commandExecutedListeners.indexOf(e);this._commandExecutedListeners.splice(t,1)});throw Error(`[CommandService]: could not add a listener twice.`)}onMutationExecutedForCollab(e){if(this._collabMutationListeners.indexOf(e)===-1)return this._collabMutationListeners.push(e),b(()=>{let t=this._collabMutationListeners.indexOf(e);this._collabMutationListeners.splice(t,1)});throw Error(`[CommandService]: could not add a collab mutation listener twice.`)}async executeCommand(e,t,n){try{let r=this._commandRegistry.getCommand(e);if(r){let[e]=r,i={id:e.id,type:e.type,params:t},a=this._pushCommandExecutionStack(i),o=n==null?{}:n;this._beforeCommandExecutionListeners.forEach(e=>e(i,o));let s=await this._execute(e,t,o);return o.syncOnly||this._commandExecutedListeners.forEach(e=>e(i,o)),e.type===I.MUTATION&&this._collabMutationListeners.forEach(e=>e(i,o)),a.dispose(),s}throw Error(`[CommandService]: command "${e}" is not registered.`)}catch(e){if(e instanceof Re)return!1;throw e}}syncExecuteCommand(e,t,n){try{let i=this._commandRegistry.getCommand(e);if(i){let[e]=i,a={id:e.id,type:e.type,params:t};if(e.type===I.MUTATION){let e=be(this._commandExecutionStack,e=>e.type===I.COMMAND);if(e){var r;a.params=(r=a.params)==null?{}:r,a.params.trigger=e.id}}let o=this._pushCommandExecutionStack(a),s=n==null?{}:n;this._beforeCommandExecutionListeners.forEach(e=>e(a,s));let c=this._syncExecute(e,t,s);return s.syncOnly||this._commandExecutedListeners.forEach(e=>e(a,s)),e.type===I.MUTATION&&this._collabMutationListeners.forEach(e=>e(a,s)),o.dispose(),c}throw Error(`[CommandService]: command "${e}" is not registered.`)}catch(e){if(e instanceof Re)return!1;throw e}}_pushCommandExecutionStack(e){return this._commandExecutionStack.push(e),b(()=>_e(this._commandExecutionStack,e))}_registerMultiCommand(e){let t=this._commandRegistry.getCommand(e.id),n;if(!t){n=new br(e.id);let t=new Ct;t.add(this._commandRegistry.registerCommand(n)),t.add(b(()=>{this._multiCommandDisposables.delete(e.id)})),this._multiCommandDisposables.set(e.id,t)}else if(t[0].multi!==!0)throw Error(`Command has registered as a single command.`);else n=t[0];let r=n.registerImplementation(e);return b(()=>{if(r.dispose(),!n.hasImplementations()){var t;(t=this._multiCommandDisposables.get(e.id))==null||t.dispose()}})}async _execute(e,t,n){if(n!=null&&n.syncOnly)return!0;this._configService.getConfig(`command.logExecution`)!==!1&&this._logService.debug(`[CommandService]`,`${`|-`.repeat(Math.max(this._commandExecutingLevel,0))}executing command "${e.id}"`),this._commandExecutingLevel++;let r;try{r=await this._injector.invoke(e.handler,t,n),this._commandExecutingLevel--}catch(e){throw r=!1,this._commandExecutingLevel=0,e}return r}_syncExecute(e,t,n){if(n!=null&&n.syncOnly)return!0;this._configService.getConfig(`command.logExecution`)!==!1&&this._logService.debug(`[CommandService]`,`${`|-`.repeat(Math.max(0,this._commandExecutingLevel))}executing command "${e.id}".`),this._commandExecutingLevel++;let r;try{if(r=this._injector.invoke(e.handler,t,n),r instanceof Promise)throw TypeError(`[CommandService]: Command handler should not return a promise.`);this._commandExecutingLevel--}catch(e){throw r=!1,this._commandExecutingLevel=0,e}return r}};yr=F([P(0,(0,l.Inject)(l.Injector)),P(1,N),P(2,cr)],yr);var br=class{constructor(e){this.id=e,v(this,`name`,void 0),v(this,`multi`,!0),v(this,`type`,I.COMMAND),v(this,`priority`,0),v(this,`_implementations`,[]),v(this,`handler`,async(e,t)=>{if(!this._implementations.length)return!1;let n=e.get(N),r=e.get(ur),i=e.get(l.Injector);for(let e of this._implementations){let a=e.command.preconditions;if((!a||a&&a(r))&&(n.debug(`[MultiCommand]`,`executing implementation "${e.command.name}".`),await i.invoke(e.command.handler,t)))return!0}return!1}),this.name=e}registerImplementation(e){let t={command:e};return this._implementations.push(t),this._implementations.sort((e,t)=>t.command.priority-e.command.priority),b(()=>{let e=this._implementations.indexOf(t);this._implementations.splice(e,1)})}hasImplementations(){return this._implementations.length>0}};function xr(e,t,n){return bt(e.map(e=>()=>t.syncExecuteCommand(e.id,e.params,n)))}function Sr(e,t,n){return yt(e.map(e=>()=>t.executeCommand(e.id,e.params,n)))}function Cr(e){return new d.Observable(t=>{let n=e((...e)=>t.next(e));return()=>n==null?void 0:n.dispose()})}function wr(e){return function(t){return new d.Observable(n=>(t.subscribe({next:t=>{n.next(t),e(t)&&n.complete()},complete:()=>n.complete(),error:e=>n.error(e)}),()=>n.unsubscribe()))}}function Tr(e=0){return t=>{let n=[];return t.pipe((0,d.tap)(e=>n.push(e)),(0,d.debounceTime)(e),(0,d.map)(()=>n),(0,d.tap)(()=>n=[]))}}function Er(e){let t=new d.ReplaySubject(1);return setTimeout(()=>t.next(),e),t.pipe((0,d.take)(1))}function Dr(e,t){let n=new d.BehaviorSubject(t);return e.subscribe(n),n}const Or=e=>new Promise(t=>{(0,d.merge)(Cr(e.onCommandExecuted.bind(e)).pipe((0,h.filter)(([e])=>e.type===I.MUTATION)),(0,d.timer)(300)).pipe((0,h.debounceTime)(16),(0,h.first)()).subscribe(()=>{t()})});function kr(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 Ar(e,t){let n=0,r=e.length-1;for(;n<=r;){let i=Math.floor((r+n)/2);if(t<e[i]&&(i===0||t>=e[i-1]))return i;if(t>=e[i])n=i+1;else if(t<e[i])r=i-1;else return-1}return-1}function jr(e,t){let n=0,r=e.length;for(;n<r;){let i=Math.floor((n+r)/2);e[i]<=t?n=i+1:r=i}return n<e.length?n:e.length-1}function Mr(e,t,n=!1){let r=e.length-1;if(t<0||t<e[0])return 0;if(r=e.length<40||t<=e[20]||t>=e[r-20]?kr(e,t):jr(e,t),n){let t=e[r];return e.indexOf(t)}return r}function Nr(e){let t=new Blob([e],{type:`text/javascript`});return window.URL.createObjectURL(t)}function Pr(e,t){if(t==null||e==null)return!0;let{left:n=0,top:r=0,height:i=0,width:a=0,angle:o=0}=t,{left:s=0,top:c=0,height:l=0,width:u=0,angle:d=0}=e,f=u,p=l,m=a,h=i;return Math.abs(s-n)>2||Math.abs(c-r)>2||Math.abs(f-m)>2||Math.abs(p-h)>2||Math.abs(d-o)>1}const Fr={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],darkyellow:[139,128,0],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]};var Ir=class e{static mix(t,n,r){var i,a;r=Math.min(1,Math.max(0,r));let o=new e(t).toRgb(),s=new e(n).toRgb(),c=(i=o.a)==null?1:i,l=(a=s.a)==null?1:a;return new e({r:(s.r-o.r)*r+o.r,g:(s.g-o.g)*r+o.g,b:(s.b-o.b)*r+o.b,a:(l-c)*r+c})}static getContrastRatio(t,n){let r=new e(t).getLuminance(),i=new e(n).getLuminance();return(Math.max(r,i)+.05)/(Math.min(r,i)+.05)}constructor(t){if(v(this,`_color`,void 0),v(this,`_rgbColor`,void 0),v(this,`_isValid`,!1),t==null){this._setNullColor();return}if(t instanceof e){this._color={...t._color},this._rgbColor={...t._rgbColor};return}let n=zr(t);if(n==null){this._setNullColor();return}this._color=n;let r=Wr(this._color);if(r==null){this._setNullColor();return}this._rgbColor=r,this._isValid=!0}get isValid(){return this._isValid}toRgb(){return this._rgbColor}toRgbString(){let{r:e,g:t,b:n,a:r=1}=this.toRgb(),i=r<1;return`rgb${i?`a`:``}(${e},${t},${n}${i?`,${r}`:``})`}toString(){return this.toRgbString()}toHexString(e){let{r:t,g:n,b:r,a:i=1}=this.toRgb(),a=i<1,o=[Lr(Math.round(t).toString(16)),Lr(Math.round(n).toString(16)),Lr(Math.round(r).toString(16)),Lr(Math.round(i*255).toString(16))];return e&&o[0][0]===o[0][1]&&o[1][0]===o[1][1]&&o[2][0]===o[2][1]&&o[3][0]===o[3][1]?a?`#${o[0][0]}${o[1][0]}${o[2][0]}${o[3][0]}`:`#${o[0][0]}${o[1][0]}${o[2][0]}`:a?`#${o[0]}${o[1]}${o[2]}${o[3]}`:`#${o[0]}${o[1]}${o[2]}`}toHsv(){return Yr(this.toRgb())}toHsl(){return Jr(this.toRgb())}lighten(t=10){let n=this.toHsl();return n.l+=t,n.l=Math.min(Math.max(n.l,0),100),new e(n)}darken(t=10){let n=this.toHsl();return n.l-=t,n.l=Math.min(Math.max(n.l,0),100),new e(n)}setAlpha(t){return new e({...this._rgbColor,a:t})}getLuminance(){let{r:e,g:t,b:n}=this.toRgb();return e=Rr(e),t=Rr(t),n=Rr(n),Number((.2126*e+.7152*t+.0722*n).toFixed(3))}getBrightness(){let{r:e,g:t,b:n}=this.toRgb();return(e*299+t*587+n*114)/1e3}getAlpha(){var e;return(e=this._color.a)==null?1:e}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 Lr=e=>e.length===1?`0${e}`:e,Rr=e=>(e/=255,e<=.03928?e/12.92:((e+.055)/1.055)**2.4),zr=e=>{if(Zr(e)){if(`r`in e){let t={r:Math.round(e.r),g:Math.round(e.g),b:Math.round(e.b)};return e.a!==void 0&&(t.a=e.a),t}if(`l`in e){let t={h:Math.round(e.h),s:e.s,l:e.l};return e.a!==void 0&&(t.a=e.a),t}let t={h:Math.round(e.h),s:e.s,v:e.v};return e.a!==void 0&&(t.a=e.a),t}let t=e.trim().toLowerCase();if(Fr[t]){let e=Fr[t],n={r:Math.round(e[0]),g:Math.round(e[1]),b:Math.round(e[2])};return n.a=e[3]||1,n}if(t.startsWith(`#`))return Br(t);if(t.startsWith(`rgb`))return Vr(t);if(t.startsWith(`hsl`))return Hr(t);if(t.startsWith(`hsv`))return Ur(t)},Br=e=>{let t=e.substring(1),n=RegExp(`.{1,${t.length>=6?2:1}}`,`g`),r=t.match(n);if(!r||r.length<3)throw Error(`The color '${e}' is illegal hex color`);r[0].length===1&&(r=r.map(e=>e+e));let i={r:Number.parseInt(r[0],16),g:Number.parseInt(r[1],16),b:Number.parseInt(r[2],16)};return r.length>3&&(i.a=Number.parseInt(r[3],16)/255),i},Vr=e=>{let t=e.indexOf(`(`);if(t===-1)throw Error(`The color '${e}' is illegal rgb color`);let n=e.substring(t+1,e.length-1).split(`,`);if(n.length<3)throw Error(`The color '${e}' is illegal rgb color`);let 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},Hr=e=>{let t=e.indexOf(`(`);if(t===-1)throw Error(`The color '${e}' is illegal hsl color`);let n=e.substring(t+1,e.length-1).split(`,`);if(n.length<3)throw Error(`The color '${e}' is illegal hsl color`);let 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},Ur=e=>{let t=e.indexOf(`(`);if(t===-1)throw Error(`The color '${e}' is illegal hsv color`);let n=e.substring(t+1,e.length-1).split(`,`);if(n.length<3)throw Error(`The color '${e}' is illegal hsv color`);let 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},Wr=e=>{let t=zr(e);if(t!=null)return`r`in t?t:`l`in t?Kr(t):qr(t)},Gr=(e,t,n)=>(n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e),Kr=e=>{let{h:t,s:n,l:r}=e;t/=360,n/=100,r/=100;let i=0,a=0,o=0;if(n===0)i=a=o=r;else{let e=r<.5?r*(1+n):r+n-r*n,s=2*r-e;i=Gr(s,e,t+1/3),a=Gr(s,e,t),o=Gr(s,e,t-1/3)}let s={r:Math.round(i*255),g:Math.round(a*255),b:Math.round(o*255)};return e.a!==void 0&&(s.a=e.a),s},qr=e=>{let{h:t,s:n,v:r}=e;t=t/360*6,n/=100,r/=100;let i=Math.floor(t),a=t-i,o=r*(1-n),s=r*(1-a*n),c=r*(1-(1-a)*n),l=i%6,u=[r,s,o,o,c,r][l],d=[c,r,r,s,o,o][l],f=[o,o,c,r,r,s][l],p={r:u*255,g:d*255,b:f*255};return e.a!==void 0&&(p.a=e.a),p},Jr=e=>{let{r:t,g:n,b:r}=e;t/=255,n/=255,r/=255;let i=Math.max(t,n,r),a=Math.min(t,n,r),o=(i+a)/2,s,c;if(i===a)s=c=0;else{let e=i-a;switch(c=o>.5?e/(2-i-a):e/(i+a),i){case t:s=(n-r)/e+(n<r?6:0);break;case n:s=(r-t)/e+2;break;default:s=(t-n)/e+4;break}s/=6}let l={h:Math.round(s*360),s:Math.round(c*100),l:Math.round(o*100)};return e.a!==void 0&&(l.a=e.a),l},Yr=e=>{let{r:t,g:n,b:r}=e;t/=255,n/=255,r/=255;let i=Math.max(t,n,r),a=Math.min(t,n,r),o,s=i,c=i-a,l=i===0?0:c/i;if(i===a)o=0;else{switch(i){case t:o=(n-r)/c+(n<r?6:0);break;case n:o=(r-t)/c+2;break;default:o=(t-n)/c+4;break}o/=6}let u={h:Math.round(o*360),s:Math.round(l*100),v:Math.round(s*100)};return e.a!==void 0&&(u.a=e.a),u},Xr=e=>e==null,Zr=e=>!Xr(e)&&typeof e==`object`;function Qr(e){return!!(/^#(?:[0]{3}|[0]{6})\b/.test(e)||/^rgb\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*\)$/.test(e)||/^rgba\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*,\s*(1|1\.0*|0?\.\d+)\)$/.test(e)||/^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*\)$/.test(e)||/^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/.test(e))}function $r(e){return!!(/^#(?:[Ff]{3}|[Ff]{6})\b/.test(e)||/^rgb\s*\(\s*255\s*,\s*255\s*,\s*255\s*\)$/.test(e)||/^rgba\s*\(\s*255\s*,\s*255\s*,\s*255\s*,\s*(1|1\.0*|0?\.\d+)\)$/.test(e)||/^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*\)$/.test(e)||/^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/.test(e))}function ei(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 ti(e){if(e.t!==void 0)return e.t;if(typeof e.v==`string`)return mn.STRING;if(typeof e.v==`number`)return mn.NUMBER;if(typeof e.v==`boolean`)return mn.BOOLEAN}function ni(e){if(e==null)return!0;let{v:t,f:n,si:r,p:i,custom:a}=e;return!(!(t==null||typeof t==`string`&&t.length===0)||n!=null&&n.length>0||r!=null&&r.length>0||i!=null||a!=null)}function ri(e){return e!=null&&(typeof e==`string`||typeof e==`number`||typeof e==`boolean`)}let L=function(e){return e[e.NORMAL=0]=`NORMAL`,e[e.ROW=1]=`ROW`,e[e.COLUMN=2]=`COLUMN`,e[e.ALL=3]=`ALL`,e}({}),R=function(e){return e[e.NONE=0]=`NONE`,e[e.ROW=1]=`ROW`,e[e.COLUMN=2]=`COLUMN`,e[e.ALL=3]=`ALL`,e}({});function ii(e){return[e.startRow,e.startColumn,e.endRow,e.endColumn]}let ai=function(e){return e.NONE=`none`,e.BACKWARD=`backward`,e.FORWARD=`forward`,e}({}),oi=function(e){return e.RECT=`RECT`,e.TEXT=`TEXT`,e}({});function si(e,t,n){let r=!1,i=!1,a=e,o=t,s=e,c=t;if(n==null)return{actualRow:e,actualColumn:t,isMergedMainCell:i,isMerged:r,endRow:a,endColumn:o,startRow:s,startColumn:c};for(let l=0;l<n.length;l++){let{startRow:u,endRow:d,startColumn:f,endColumn:p}=n[l];if(e===u&&t===f){a=d,o=p,s=u,c=f,i=!0;break}if(e>=u&&e<=d&&t>=f&&t<=p){a=d,o=p,s=u,c=f,r=!0;break}}return{actualRow:e,actualColumn:t,isMergedMainCell:i,isMerged:r,endRow:a,endColumn:o,startRow:s,startColumn:c}}let ci=function(e){return e.Raw=`raw`,e.Intercepted=`intercepted`,e.Both=`both`,e}({});const li={[hn.OFFICE]:{[D.ACCENT1]:`#4472C4`,[D.ACCENT2]:`#ED7D31`,[D.ACCENT3]:`#A5A5A5`,[D.ACCENT4]:`#70AD47`,[D.ACCENT5]:`#5B9BD5`,[D.ACCENT6]:`#70AD47`,[D.DARK1]:`#000000`,[D.DARK2]:`#44546A`,[D.LIGHT1]:`#FFFFFF`,[D.LIGHT2]:`#E7E6E6`,[D.HYPERLINK]:`#0563C1`,[D.FOLLOWED_HYPERLINK]:`#954F72`}};function ui(e){return e===`@@@`||e===`@`}function di(e){return e==null||e===`General`}const fi=(e,t)=>{if(e&&!t||!e&&t)return!1;let n=e=>{let t=g.tokenize(e),n=``,r=!1,i=!1;for(let e of t){if(e.type===g.tokenTypes.POINT){r=!0;continue}if(!(i&&e.type===g.tokenTypes.MINUS)&&e.type!==g.tokenTypes.SKIP){if(e.type===g.tokenTypes.COLOR){i=!0;continue}else i=!1;r&&e.type===g.tokenTypes.ZERO||(r=!1,r||(n+=e.value||``))}}return n};return n(e)===n(t)},pi=new Set([`m d`]),mi=new Set([`h:mm AM/PM`,`hh:mm AM/PM`]),hi=new Set([`$`,`¥`,`₽`,`₫`,`NT$`,`€`,`₩`,`﷼`]),gi=e=>{var t,n;let r=(t=(n=g.parseDate(e))==null?g.parseTime(e):n)==null?g.parseNumber(e):t;if(!r)return null;let{z:i}=r;if(i){if(pi.has(i)||mi.has(i)&&!/\s(A|AM|P|PM)$/i.test(e))return null;if(i.includes(`#,##0`)){if(/[.,]$/.test(e))return null;let t=e.replace(RegExp(`^[${[...hi].join(``)}]+`),``).trim();if(t.includes(`,`)&&!/^-?\d{1,3}(,\d{3})*(\.\d+)?$/.test(t))return null}}return r};function _i(e,t){let n={};for(let r in e){let i=Number(r),a=e[i];for(let e in a){let r=Number(e),o=a[r],s=t(i,r,o);s!==void 0&&(n[i]?n[i][r]=s:n[i]={[r]:s})}}return n}function vi(e){let t=0,n=Object.keys(e);for(let e of n){let n=Number(e);t=Math.max(t,n)}return t+1}const yi=e=>e==null||typeof e==`object`&&Object.keys(e).length===0;function bi(e,t,n){let r=vi(n),i=n;for(let t=r-1;t>=e;t--)yi(i[t])?delete i[t+1]:i[t+1]=i[t];yi(t)||(i[e]=t)}function xi(e,t,n){let r=Object.keys(n).reduce((e,t)=>Math.max(e,Number.parseInt(t)),0)+1;for(let i=e;i<r;i++)i<e+t?delete n[i]:n[i]!==void 0&&(n[i-t]=n[i],delete n[i])}function Si(e,t){let n=e,r=Object.keys(n),i=r.length,a=t,o=Object.keys(a),s=o.length,c={},l=0;for(let e=0;e<i;e++,l++)c[l]=n[r[e]];for(let e=0;e<s;e++,l++)c[l]=a[o[e]];return c}function Ci(e,t,n){let r=n;if(vi(n)>0){let n={},i=0;for(let a=e;a<=t;a++)r[a]&&(n[i]=r[a],i++);return n}return{}}function wi(e,t,n,r){let i=e>n;if(!i&&e+t>n)throw Error(`Invalid move operation`);i?Ti(e,t,n,r):Ei(e,t,n,r)}function Ti(e,t,n,r){let i=r,a=[];for(let n=e;n<e+t;n++)a.push(i[n]);for(let r=e-1;r>=n;r--){let e=i[r];i[r+t]=e,e===void 0&&delete i[r+t]}a.forEach((e,t)=>{i[n+t]=e,e===void 0&&delete i[n+t]})}function Ei(e,t,n,r){let i=r,a=[];for(let n=e;n<e+t;n++)a.push(i[n]);for(let r=e+t;r<n;r++){let e=i[r];i[r-t]=e,e===void 0&&delete i[r-t]}a.forEach((e,r)=>{i[n+r-t]=e,e===void 0&&delete i[n+r-t]})}var Di=class e{constructor(e={}){v(this,`_matrix`,void 0),this._setOriginValue(e)}static MakeObjectMatrixSize(t){return new e({[t-1]:{}})}getMatrix(){return this._matrix}forEach(e){let t=this._matrix,n=Object.keys(t);for(let r of n){let n=Number(r),i=t[n];if(e(n,i)===!1)return this}return this}forRow(e){let t=this._matrix,n=Object.keys(t);for(let r of n){let n=Number(r),i=t[n];if(e(n,Object.keys(i).map(e=>Number(e)))===!1)return this}return this}forValue(e){let t=this._matrix;for(let n in t){let r=Number(n),i=t[r];if(i)for(let t in i){let n=Number(t),a=i[n];if(e(r,n,a)===!1)return this}}return this}swapRow(e,t){let n=this._matrix[e],r=this._matrix[t];this._matrix[e]=r,this._matrix[t]=n}getRow(e){return this._matrix[e]}getRowOrCreate(e){let t=this.getRow(e);return t==null&&(t={},this._matrix[e]=t),t}reset(){this._setOriginValue({})}hasValue(){let e=this._matrix,t=Object.keys(e);if(t.length===0)return!1;for(let n of t){let t=e[Number(n)];if(Object.keys(t).length>0)return!0}return!1}getValue(e,t){var n;return(n=this._matrix)==null||(n=n[e])==null?void 0:n[t]}setValue(e,t,n){let r=this.getRowOrCreate(e);r[t]=n}deleteValue(e,t){var n;(n=this._matrix)==null||(n=n[e])==null||delete n[t]}realDeleteValue(e,t){var n;if((n=this._matrix)==null||(n=n[e])==null||delete n[t],this.getRow(e)){let t=this.getRow(e);if(t==null)return;if(Object.keys(t).length===0){var r;(r=this._matrix)==null||delete r[e]}}}setRow(e,t){this._matrix[e]=t}moveRows(e,t,n){wi(e,t,n,this._matrix)}moveColumns(e,t,n){this.forEach((r,i)=>{wi(e,t,n,i)})}insertRows(e,t){let n=Object.keys(this._matrix);for(let r=n.length-1;r>=0;r--){let i=Number(n[r]);if(i>=e){let e=this._matrix[i];delete this._matrix[i],this._matrix[i+t]=e}}}insertColumns(e,t){let n=Object.keys(this._matrix);for(let r=0;r<n.length;r++){let i=Number(n[r]),a=this._matrix[i],o=Object.keys(a);for(let n=o.length-1;n>=0;n--){let r=Number(o[n]);if(r>=e){let e=a[r];delete a[r],a[r+t]=e}}}}removeRows(e,t){xi(e,t,this._matrix)}removeColumns(e,t){this.forEach((n,r)=>{r&&xi(e,t,r)})}getFragment(t,n,r,i){let a=new e,o=0;for(let e=t;e<=n;e++){let t={},n=0;for(let a=r;a<=i;a++)t[n]=this.getValue(e,a),n++;a.setRow(o,t),o++}return a}getSlice(t,n,r,i){let a=new e;for(let e=t;e<=n;e++)for(let t=r;t<=i;t++){let n=this.getValue(e,t);n&&a.setValue(e,t,S.deepClone(n))}return a}getSliceDataAndCellCountByRows(t,n){let r=new e,i=0;for(let e=t;e<=n;e++){let t=this.getRow(e);t&&(r.setRow(e,t),i+=Object.keys(t).length)}return{sliceData:r,cellCount:i}}getSizeOf(){return Object.keys(this._matrix).length}getLength(){return vi(this._matrix)}getRange(){let e=this.getLength()-1,t=0,n=this.getLength();for(let e=0;e<n;e++){let n=this.getRow(e);if(n){let e=vi(n)-1;t=e>t?e:t}}return{startRow:0,startColumn:0,endRow:e,endColumn:t}}getRealRange(){let e=Object.keys(this._matrix),t=e.length,n=t>0?Number(e[0]):0,r=t>0?Number(e[t-1]):0,i=-1/0,a=0;for(let t of e){let e=this.getRow(Number(t));if(e){let t=Object.keys(e);if(t.length>0){let e=Number(t[0]),n=Number(t[t.length-1]);(i===-1/0||e<i)&&(i=e),n>a&&(a=n)}}}return i===-1/0&&(i=0),{startRow:n,endRow:r,startColumn:i,endColumn:a}}getRealRowRange(){let e=Object.keys(this._matrix),t=e.length;return{startRow:t>0?Number(e[0]):0,endRow:t>0?Number(e[t-1]):0}}toNativeArray(){let e=[];return this.forValue((t,n,r)=>{e.push(r)}),e}toArray(){let e=[];return this.forRow((t,n)=>{e[t]==null&&(e[t]=[]),n.forEach(n=>{e[t][n]=this.getValue(t,n)})}),e}toFullArray(){let{endColumn:e,endRow:t}=this.getRange(),n=[];for(let r=0;r<=t;r++){let t=Array(e+1).fill(void 0);n.push(t)}return this.forValue((e,t,r)=>{n[e][t]=r}),n}toJSON(){return this._matrix}clone(){let e=JSON.stringify(this._matrix);return JSON.parse(e)}getData(){let e=JSON.stringify(this._matrix);return JSON.parse(e)}getArrayData(){let t=0,n=0,r=!1,i=!1,a=new e;return this.forEach((e,o)=>{r||(r=!0,t=e),Object.keys(o).forEach(r=>{let o=Number(r);i?o<n&&(n=o):(i=!0,n=o);let s=this.getValue(e,o);a.setValue(e-t,o-n,s)})}),a.getData()}getStartEndScope(){let e=1/0,t=-1/0,n=1/0,r=-1/0,i=Object.keys(this._matrix);i.length>0&&(e=+i[0],t=+i[i.length-1]);for(let e of i){let t=Object.keys(this._matrix[e]);t.length>0&&(n=Math.min(n,+t[0]),r=Math.max(r,+t[t.length-1]))}return{startRow:e,endRow:t,startColumn:n,endColumn:r}}getDataRange(){let e=0,t=0,n=0,r=-1,i=!1,a=!1;return this.forEach((o,s)=>{if(i||(i=!0,e=o),s==null)return;let c=vi(s)-1;c>n&&(n=c),Object.keys(s).forEach(e=>{let n=Number(e);a?n<t&&(t=n):(a=!0,t=n)}),o>r&&(r=o)}),{startRow:e,startColumn:t,endRow:r,endColumn:n}}getDiscreteRanges(){let e=[];return this.forEach((t,n)=>{Object.keys(n).forEach(n=>{let r=Number(n),i=!1;for(let n of e)if(t>=n.startRow&&t<=n.endRow+1&&r>=n.startColumn&&r<=n.endColumn+1){n.endRow=Math.max(t,n.endRow),n.endColumn=Math.max(r,n.endColumn),i=!0;break}i||e.push({startRow:t,endRow:t,startColumn:r,endColumn:r})})}),e}merge(e){this.forValue((t,n)=>{let r=e.getValue(t,n);r!=null&&this.setValue(t,n,r)})}concatRows(e){let t=e.getMatrix();for(let e in t){let n=Number(e);this.setRow(n,t[n])}}_setOriginValue(e={}){this._matrix=e}};function Oi(e){let{actualRow:t,actualColumn:n,isMerged:r,isMergedMainCell:i,mergeInfo:a}=e,{startY:o,endY:s,startX:c,endX:l}=e,u=t,d=n,f=t,p=n;if(r&&a){let{startRow:e,startColumn:t,endRow:n,endColumn:r,startY:i,endY:m,startX:h,endX:g}=a;u=e,d=t,f=n,p=r,o=i,s=m,c=h,l=g}return i&&(o=a.startY,s=a.endY,c=a.startX,l=a.endX,f=a.endRow,p=a.endColumn),{startRow:u,startColumn:d,endRow:f,endColumn:p,startY:o,endY:s,startX:c,endX:l}}const ki=Oi;function Ai(e){if(!e)return;let{actualRow:t,actualColumn:n,isMerged:r,isMergedMainCell:i,startRow:a,startColumn:o,endRow:s,endColumn:c}=e,l=t,u=n,d=t,f=n;return(r||i)&&(l=a,u=o,d=s,f=c),{startRow:l,startColumn:u,endRow:d,endColumn:f}}function ji(e){var t;return!e||((e==null||(t=e.v)==null?void 0:t.toString())||``).length===0&&!e.p}function Mi(e){return ji(e)&&(e==null?void 0:e.coverable)!==!1}function z(e){if(e){if(e.rgb)return new Ir(e.rgb).toHexString();if(e.th!=null){var t;let n=(t=li[hn.OFFICE])==null?void 0:t[e.th];if(n)return new Ir(n).toRgbString()}}return null}function Ni(e){return S.isString(e)&&e.substring(0,1)===`=`&&e.length>1}function Pi(e){return S.isString(e)&&e.length>0}function Fi(e,t=!1){let n=``,r=new Map([[`ff`,()=>{e.ff&&(n+=`font-family: ${e.ff}; `)}],[`fs`,()=>{if(e.fs){let t=e.fs;e.va&&(t/=2),n+=`font-size: ${t}pt; `}}],[`it`,()=>{e.it&&(n+=`font-style: italic; `)}],[`bl`,()=>{e.bl&&(n+=`font-weight: bold; `)}],[`ul`,()=>{var t;(t=e.ul)!=null&&t.s&&(n.indexOf(`text-decoration-line`)>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(e,t)=>`${t} underline`):n+=`text-decoration: underline; `,e.ul.cl&&n.indexOf(`text-decoration-color`)===-1&&(n+=`text-decoration-color: ${z(e.ul.cl)}; `),e.ul.t&&n.indexOf(`text-decoration-style`)===-1&&(n+=`text-decoration-style: ${e.ul.t} `))}],[`st`,()=>{var t;(t=e.st)!=null&&t.s&&(n.indexOf(`text-decoration-line`)>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(e,t)=>`${t} line-through`):n+=`text-decoration-line: line-through; `,e.st.cl&&n.indexOf(`text-decoration-color`)===-1&&(n+=`text-decoration-color: ${z(e.st.cl)}; `),e.st.t&&n.indexOf(`text-decoration-style`)===-1&&(n+=`text-decoration-style: ${e.st.t} `))}],[`ol`,()=>{var t;(t=e.ol)!=null&&t.s&&(n.indexOf(`text-decoration-line`)>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(e,t)=>`${t} overline`):n+=`text-decoration-line: overline; `,e.ol.cl&&n.indexOf(`text-decoration-color`)===-1&&(n+=`text-decoration-color: ${z(e.ol.cl)}; `),e.ol.t&&n.indexOf(`text-decoration-style`)===-1&&(n+=`text-decoration-style: ${e.ol.t} `))}],[`bg`,()=>{e.bg&&(n+=`background: ${z(e.bg)}; `)}],[`bd`,()=>{var t,r,i,a;if((t=e.bd)!=null&&t.b){var o,s;n+=`border-bottom: ${Ii((o=e.bd)==null?void 0:o.b.s)} ${(s=z(e.bd.b.cl))==null?``:s}; `}if((r=e.bd)!=null&&r.t){var c,l;n+=`border-top: ${Ii((c=e.bd)==null?void 0:c.t.s)} ${(l=z(e.bd.t.cl))==null?``:l}; `}if((i=e.bd)!=null&&i.r){var u,d;n+=`border-right: ${Ii((u=e.bd)==null?void 0:u.r.s)} ${(d=z(e.bd.r.cl))==null?``:d}; `}if((a=e.bd)!=null&&a.l){var f,p;n+=`border-left: ${Ii((f=e.bd)==null?void 0:f.l.s)} ${(p=z(e.bd.l.cl))==null?``:p}; `}}],[`cl`,()=>{e.cl&&(n+=`color: ${z(e.cl)}; `)}],[`va`,()=>{e.va===pn.SUBSCRIPT?n+=`vertical-align: sub; `:e.va===pn.SUPERSCRIPT&&(n+=`vertical-align: super; `)}],[`td`,()=>{e.td===sn.LEFT_TO_RIGHT?n+=`direction: ltr; `:e.td===sn.RIGHT_TO_LEFT&&(n+=`direction: rtl; `)}],[`tr`,()=>{if(e.tr){var t,r,i;n+=`--data-rotate: (${(t=e.tr)==null?void 0:t.a}deg${(r=e.tr)!=null&&r.v?` ,${(i=e.tr)==null?void 0:i.v}`:``});`}}],[`ht`,()=>{e.ht===T.LEFT?n+=`text-align: left; `:e.ht===T.RIGHT?n+=`text-align: right; `:e.ht===T.CENTER?n+=`text-align: center; `:e.ht===T.JUSTIFIED&&(n+=`text-align: justify; `)}],[`vt`,()=>{e.vt===ln.BOTTOM?n+=`vertical-align: bottom; `:e.vt===ln.TOP?n+=`vertical-align: top; `:e.vt===ln.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 t,r,i,a,o,s,c,l;let u=`${(t=e.pd)==null?void 0:t.b}pt`,d=`${(r=e.pd)==null?void 0:r.t}pt`,f=`${(i=e.pd)==null?void 0:i.l}pt`,p=`${(a=e.pd)==null?void 0:a.r}pt`;(o=e.pd)!=null&&o.b&&(n+=`padding-bottom: ${u}; `),(s=e.pd)!=null&&s.t&&(n+=`padding-top: ${d}; `),(c=e.pd)!=null&&c.l&&(n+=`padding-left: ${f}; `),(l=e.pd)!=null&&l.r&&(n+=`padding-right: ${p}; `)}]]),i=[`bd`,`tr`,`tb`];for(let n in e){var a;t&&i.includes(n)||(a=r.get(n))==null||a()}return n}function Ii(e){let t=``;return e===w.NONE?t=`none`:e===w.THIN?t=`0.5pt solid`:e===w.HAIR?t=`0.5pt double`:e===w.DOTTED?t=`0.5pt dotted`:e===w.DASHED||e===w.DASH_DOT?t=`0.5pt dashed`:e===w.DASH_DOT_DOT?t=`0.5pt dotted`:e===w.DOUBLE?t=`0.5pt double`:e===w.MEDIUM?t=`1pt solid`:e===w.MEDIUM_DASHED||e===w.MEDIUM_DASH_DOT?t=`1pt dashed`:e===w.MEDIUM_DASH_DOT_DOT?t=`1pt dotted`:e===w.SLANT_DASH_DOT?t=`0.5pt dashed`:e===w.THICK&&(t=`1.5pt solid`),t}function Li(e){let t=0;if(e=e.trim(),e===`none`)t=w.NONE;else if(e===`0.5pt solid`)t=w.THIN;else if(e===`0.5pt double`)t=w.HAIR;else if(e===`0.5pt dotted`)t=w.DOTTED;else if(e===`0.5pt dashed`)t=w.DASHED;else if(e===`1pt solid`)t=w.MEDIUM;else if(e===`1pt dashed`)t=w.MEDIUM_DASHED;else if(e===`1pt dotted`)t=w.MEDIUM_DASH_DOT_DOT;else if(e===`1.5pt solid`)t=w.THICK;else if(!e.includes(`none`))t=w.THIN;else return w.NONE;return t}function Ri(e,t){let n=e.body;if(t){let{headers:r,footers:i}=e;r!=null&&r[t]?n=r[t].body:i!=null&&i[t]&&(n=i[t].body)}return n}function zi(e,t){let{startRow:n,endRow:r,startColumn:i,endColumn:a,rangeType:o}=e;if(n<0||i<0||r<0||a<0||!(Number.isNaN(n)&&Number.isNaN(r))&&o===L.COLUMN||!(Number.isNaN(i)&&Number.isNaN(a))&&o===L.ROW||o!==L.ROW&&o!==L.COLUMN&&(Number.isNaN(i)||Number.isNaN(n)||Number.isNaN(a)||Number.isNaN(r)))return!1;if(t){let e=t.getRowCount(),n=t.getColumnCount();if(r>=e||a>=n)return!1}return!0}function Bi(e,t){return{startRow:e,endRow:e,startColumn:t,endColumn:t}}function Vi(e){if(Ni(e))return{f:e,v:null,p:null};if(ri(e)){if(typeof e==`string`){let t=gi(e);if(t&&t.z)return{v:t.v,p:null,f:null,s:{n:{pattern:t.z||`General`}}}}return{v:e,p:null,f:null}}return ei(e),e}function Hi(e,t){let n=new Di,{startRow:r,startColumn:i,endRow:a,endColumn:o}=t;if(S.isArray(e))for(let t=0;t<=a-r;t++)for(let a=0;a<=o-i;a++)n.setValue(t+r,a+i,Vi(e[t][a]));else new Di(e).forValue((e,t,r)=>{n.setValue(e,t,Vi(r))});return n.getMatrix()}function Ui(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?Object.keys(e).every(n=>Ui(e[n],t[n])):!1:e===t:!1}function Wi(e,t){let n=e.ts||{},r=t.ts||{};return e.sId===t.sId?Ui(n,r):!1}function Gi(e,t){return t.some(t=>e.indexOf(t)>-1)}_.default.extend(te.default),_.default.extend(ee.default),_.default.extend(ae.default),_.default.extend(ne.default),_.default.extend(oe.default),_.default.extend(se.default),_.default.extend(ie.default),_.default.extend(re.default);function Ki(e,t,n,r){if(e>t)throw Error(`a1 should be less than a2`);if(n>r)throw Error(`b1 should be less than b2`);if(t<n||r<e)return[e,t];if(n<=e&&r>=t)return[];let i=r-n+1;return e<n&&t>r?[e,t-i]:n<=e&&r<t?[r+1-i,t-i]:n>e&&r>=t?[e,n-1]:[e,t]}function qi(e){if(e==null)return!1;let t=e.bullet;return(t==null?void 0:t.listId)!=null}function Ji(e){if(e==null)return!1;let t=e.paragraphStyle;return Yi(t)}function Yi(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 Xi(e,t,n){return e.slice(0,t)+n+e.slice(t)}function Zi(e,t,n){return t>n?e:e.slice(0,t)+e.slice(n)}function Qi(e){if(e==null||typeof e==`boolean`)return!1;if(typeof e==`number`)return!isNaN(e);if(typeof e==`string`){let t=e.trim();return t===``?!1:!isNaN(Number(t))}return!1}function $i(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+(t<<6)+(t<<16)-t;return t>>>0}function ea(e){if(e.length===0)return[];let t=e.slice().sort((e,t)=>(Array.isArray(e)?e[0]:e)-(Array.isArray(t)?t[0]:t)),n=[],r=Array.isArray(t[0])?t[0][0]:t[0],i=r;for(let e=1;e<t.length;e++){let a=t[e],o,s;Array.isArray(a)?(o=a[0],s=a[1]):(o=a,s=a),o<=i+1?i=Math.max(i,s):(n.push([r,i]),r=o,i=s)}return n.push([r,i]),n}function ta(e){if(e.length===0)return[];let t=e.slice().sort((e,t)=>e[0]-t[0]),n=[],[r,i]=t[0];for(let e=1;e<t.length;e++){let[a,o]=t[e];a<=i+1?i=Math.max(i,o):(n.push([r,i]),r=a,i=o)}return n.push([r,i]),n}function na(...e){let t;return t=e.length===1&&Array.isArray(e[0])?e[0]:e,(0,u.merge)({},...t)}let ra,ia,aa,oa;const B=Symbol(`newer`),V=Symbol(`older`);ra=Symbol.iterator;var sa=class{constructor(e){v(this,`entry`,void 0),this.entry=e}[ra](){return this}next(){let e=this.entry;return e?(this.entry=e[B],{done:!1,value:e.key}):{done:!0,value:void 0}}};ia=Symbol.iterator;var ca=class{constructor(e){v(this,`entry`,void 0),this.entry=e}[ia](){return this}next(){let e=this.entry;return e?(this.entry=e[B],{done:!1,value:e.value}):{done:!0,value:void 0}}};aa=Symbol.iterator;var la=class{constructor(e){v(this,`entry`,void 0),this.entry=e}[aa](){return this}next(){let e=this.entry;return e?(this.entry=e[B],{done:!1,value:[e.key,e.value]}):{done:!0,value:void 0}}},ua=class{constructor(e,t){v(this,`key`,void 0),v(this,`value`,void 0),v(this,B,void 0),v(this,V,void 0),this.key=e,this.value=t,this[B]=void 0,this[V]=void 0}toJSON(){return{key:this.key,value:this.value}}};oa=Symbol.iterator;var da=class{onShift(e){if(this._onShiftListeners.indexOf(e)===-1)return this._onShiftListeners.push(e),b(()=>_e(this._onShiftListeners,e));throw Error(`[LRUMap]: the listener has been registered!`)}constructor(...e){if(v(this,`_keymap`,void 0),v(this,`size`,0),v(this,`limit`,void 0),v(this,`oldest`,void 0),v(this,`newest`,void 0),v(this,`_onShiftListeners`,[]),fa.hasLength(e,1)){if(fa.isNumber(e[0])){let t=e[0];this._initialize(t,void 0);return}if(fa.isIterable(e[0])){let t=e[0];this._initialize(0,t);return}return}if(fa.hasLength(e,2)){let t=e[0],n=e[1];this._initialize(t,n)}}_initialize(e,t){this.oldest=void 0,this.newest=void 0,this.size=0,this.limit=e,this._keymap=new Map,t&&(this.assign(t),e<1&&(this.limit=this.size))}_markEntryAsUsed(e){e!==this.newest&&(e[B]&&(e===this.oldest&&(this.oldest=e[B]),e[B][V]=e[V]),e[V]&&(e[V][B]=e[B]),e[B]=void 0,e[V]=this.newest,this.newest&&(this.newest[B]=e),this.newest=e)}assign(e){let t,n=this.limit||Number.MAX_VALUE;this._keymap.clear();let r=e[Symbol.iterator]();for(let e=r.next();!e.done;e=r.next()){let r=new ua(e.value[0],e.value[1]);if(this._keymap.set(r.key,r),t?(t[B]=r,r[V]=t):this.oldest=r,t=r,n--===0)throw Error(`overflow`)}this.newest=t,this.size=this._keymap.size}set(e,t){let n=this._keymap.get(e);return n?(n.value=t,this._markEntryAsUsed(n),this):(this._keymap.set(e,n=new ua(e,t)),this.newest?(this.newest[B]=n,n[V]=this.newest):this.oldest=n,this.newest=n,++this.size,this.size>this.limit&&this.shift(),this)}shift(){let e=this.oldest;if(e)return this.oldest&&this.oldest[B]?(this.oldest=this.oldest[B],this.oldest[V]=void 0):(this.oldest=void 0,this.newest=void 0),e[B]=e[V]=void 0,this._keymap.delete(e.key),--this.size,this._onShiftListeners.forEach(t=>t(e)),[e.key,e.value]}get(e){let t=this._keymap.get(e);if(t)return this._markEntryAsUsed(t),t.value}has(e){return this._keymap.has(e)}find(e){let t=this._keymap.get(e);return t?t.value:void 0}delete(e){let t=this._keymap.get(e);if(t)return this._keymap.delete(t.key),t[B]&&t[V]?(t[V][B]=t[B],t[B][V]=t[V]):t[B]?(t[B][V]=void 0,this.oldest=t[B]):t[V]?(t[V][B]=void 0,this.newest=t[V]):this.oldest=this.newest=void 0,this.size--,t.value}clear(){this.oldest=void 0,this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new sa(this.oldest)}values(){return new ca(this.oldest)}entries(){return this[Symbol.iterator]()}[oa](){return new la(this.oldest)}forEach(e,t){typeof t!=`object`&&(t=this);let n=this.oldest;for(;n;)e.call(t,n.value,n.key,this),n=n[B]}toJSON(){let e=Array(this.size),t=0,n=this.oldest;for(;n;)e[t++]={key:n.key,value:n.value},n=n[B];return e}toString(){let e=``,t=this.oldest;for(;t;)e+=`${String(t.key)}:${t.value}`,t=t[B],t&&(e+=` < `);return e}},fa=class{static hasLength(e,t){return e.length===t}static getValueType(e){return Object.prototype.toString.apply(e)}static isObject(e){return this.getValueType(e)===`[object Object]`}static isIterable(e){return e[Symbol.iterator]!=null}static isNumber(e){return this.getValueType(e)===`[object Number]`}};function pa(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r<65||r>90)return-1;t=t*26+(r-64)}return t}const ma=1048576,ha=16384,ga={sheetId:``,range:{startRow:-1,endRow:-1,startColumn:-1,endColumn:-1}},_a={startRow:-1,startColumn:-1,endRow:-1,endColumn:-1},va={startRow:0,startColumn:0,endRow:0,endColumn:0},ya={row:0,column:0},H={ff:`Arial`,fs:11,it:E.FALSE,bl:E.FALSE,ul:{s:E.FALSE},st:{s:E.FALSE},ol:{s:E.FALSE},tr:{a:0,v:E.FALSE},td:sn.UNSPECIFIED,cl:{rgb:`#000000`},bg:{rgb:`#fff`},ht:T.UNSPECIFIED,vt:ln.UNSPECIFIED,tb:un.UNSPECIFIED,pd:{t:0,r:0,b:0,l:0},n:null,bd:{b:null,l:null,r:null,t:null}},ba={id:`default_slide`,title:`defaultSlide`,pageSize:{width:300,height:300}},xa=[De,ke,Oe],Sa={[k.HEADING_1]:{fs:20,bl:1},[k.HEADING_2]:{fs:18,bl:1},[k.HEADING_3]:{fs:16,bl:1},[k.HEADING_4]:{fs:14,bl:1},[k.HEADING_5]:{fs:12,bl:1},[k.NORMAL_TEXT]:null,[k.TITLE]:{fs:26,bl:1},[k.SUBTITLE]:{fs:15,cl:{rgb:`#999999`}},[k.NAMED_STYLE_TYPE_UNSPECIFIED]:null},Ca={[k.HEADING_1]:{spaceAbove:{v:20},spaceBelow:{v:10}},[k.HEADING_2]:{spaceAbove:{v:18},spaceBelow:{v:10}},[k.HEADING_3]:{spaceAbove:{v:16},spaceBelow:{v:10}},[k.HEADING_4]:{spaceAbove:{v:14},spaceBelow:{v:8}},[k.HEADING_5]:{spaceAbove:{v:12},spaceBelow:{v:8}},[k.NORMAL_TEXT]:{spaceAbove:{v:0},spaceBelow:{v:0}},[k.TITLE]:{spaceAbove:{v:0},spaceBelow:{v:7}},[k.SUBTITLE]:{spaceAbove:{v:0},spaceBelow:{v:16}},[k.NAMED_STYLE_TYPE_UNSPECIFIED]:null};let wa=function(e){return e.ARRAY_CONVERTOR=`ARRAY_CONVERTOR`,e.MATRIX_CONVERTOR=`MATRIX_CONVERTOR`,e}({});const Ta={[A.A3]:{width:1123,height:1587},[A.A4]:{width:794,height:1124},[A.A5]:{width:559,height:794},[A.B4]:{width:944,height:1344},[A.B5]:{width:665,height:944},[A.Executive]:{width:696,height:1008},[A.Folio]:{width:816,height:1248},[A.Legal]:{width:816,height:1344},[A.Letter]:{width:816,height:1056},[A.Statement]:{width:528,height:816},[A.Tabloid]:{width:1056,height:1632}};function Ea(e,t){let{textRuns:n=[]}=t,r=0;for(let t of n){let{ts:n={},st:i,ed:a}=t;if(n[e]==null)return E.FALSE;switch(e){case`bl`:case`it`:if(n[e]===E.FALSE)return E.FALSE;break;case`ul`:case`st`:if(n[e].s===E.FALSE)return E.FALSE;break;default:throw Error(`unknown style key: ${e} in IStyleBase`)}r+=a-i}return t.dataStream.indexOf(`\r
3
+ `)===r?E.TRUE:E.FALSE}var Da=class e{constructor(e,t,n){this._deps=n,v(this,`_range`,void 0),v(this,`_worksheet`,void 0),this._range=t,this._worksheet=e}static foreach(e,t){let{startRow:n,startColumn:r,endRow:i,endColumn:a}=e;for(let e=n;e<=i;e++)for(let n=r;n<=a;n++)t(e,n)}getRangeData(){return this._range}getValue(){return this.getValues()[0][0]}getValues(){let{startRow:e,endRow:t,startColumn:n,endColumn:r}=this._range,i=[];for(let a=e;a<=t;a++){let e=[];for(let t=n;t<=r;t++)e.push(this.getMatrix().getValue(a,t)||null);i.push(e)}return i}getMatrix(){let{startRow:e,endRow:t,startColumn:n,endColumn:r}=this._range,i=this._worksheet.getCellMatrix(),a=new Di;for(let o=e;o<=t;o++)for(let e=n;e<=r;e++)a.setValue(o,e,i.getValue(o,e)||null);return a}getMatrixObject(){let{startRow:e,endRow:t,startColumn:n,endColumn:r}=this._range,i=this._worksheet.getCellMatrix(),a=new Di;for(let o=e;o<=t;o++)for(let t=n;t<=r;t++)a.setValue(o-e,t-n,i.getValue(o,t)||{});return a}getA1Notation(){let{startRow:e,endRow:t,startColumn:n,endColumn:r}=this._range,i,a;return n<r?(i=S.numToWord(n+1)+(e+1),a=S.numToWord(r+1)+(t+1)):(i=S.numToWord(r+1)+(t+1),a=S.numToWord(n+1)+(e+1)),i===a?`${i}`:`${i}:${a}`}getBackground(){return this.getBackgrounds()[0][0]}getBackgrounds(){let e=this._deps.getStyles();return this.getValues().map(t=>t.map(t=>{var n;let r=e.getStyleByCell(t);return(r==null||(n=r.bg)==null?void 0:n.rgb)||H.bg.rgb}))}getCell(t,n){let{startRow:r,startColumn:i}=this._range,a={startRow:r+t,endRow:r+t,startColumn:i+n,endColumn:i+n};return new e(this._worksheet,a,this._deps)}getColumn(){return this._range.startColumn}getObjectValue(e={}){return this.getObjectValues(e)[0][0]}getObjectValues(e={}){let{startRow:t,endRow:n,startColumn:r,endColumn:i}=this._range,a=this._worksheet.getCellMatrix().getFragment(t,n,r,i).getData();if(e.isIncludeStyle){let e=this._deps.getStyles();for(let s=0;s<=n-t;s++)for(let t=0;t<=i-r;t++){var o;if(a==null||(a==null||(o=a[s])==null?void 0:o[t])==null)continue;let n=a[s][t].s;n&&(a[s][t].s=e.get(n))}}return a}getFontColor(){return this.getFontColors()[0][0]}getFontColors(){let e=this._deps.getStyles();return this.getValues().map(t=>t.map(t=>{var n;let r=e.getStyleByCell(t);return(r==null||(n=r.cl)==null?void 0:n.rgb)||H.cl.rgb}))}getFontFamilies(){return this._getStyles(`ff`)}getFontFamily(){return this.getFontFamilies()[0][0]}getUnderlines(){return this._getStyles(`ul`)}getUnderline(){var e,t;let{p:n}=(e=this.getValue())==null?{}:e;return n&&Array.isArray((t=n.body)==null?void 0:t.textRuns)&&n.body.textRuns.length>0?Ea(`ul`,n.body)===E.TRUE?{s:E.TRUE}:{s:E.FALSE}:this.getUnderlines()[0][0]}getOverlines(){return this._getStyles(`ol`)}getOverline(){return this.getOverlines()[0][0]}getStrikeThrough(){var e,t;let{p:n}=(e=this.getValue())==null?{}:e;return n&&Array.isArray((t=n.body)==null?void 0:t.textRuns)&&n.body.textRuns.length>0?Ea(`st`,n.body)===E.TRUE?{s:E.TRUE}:{s:E.FALSE}:this.getStrikeThroughs()[0][0]}getStrikeThroughs(){return this._getStyles(`st`)}getFontSize(){var e,t;let n=((e=this.getValue())==null?void 0:e.p)||{};return n&&Array.isArray((t=n.body)==null?void 0:t.textRuns)&&n.body.textRuns.length>0&&n.body.textRuns.some(e=>{var t;return(e==null||(t=e.ts)==null?void 0:t.fs)!=null})?Math.max(...n.body.textRuns.map(e=>{var t;return(e==null||(t=e.ts)==null?void 0:t.fs)||0})):this.getFontSizes()[0][0]}getFontSizes(){return this._getStyles(`fs`)}getBorder(){return this.getBorders()[0][0]}getBorders(){return this._getStyles(`bd`)}getFontStyle(){var e,t;let{p:n}=(e=this.getValue())==null?{}:e;return n&&Array.isArray((t=n.body)==null?void 0:t.textRuns)&&n.body.textRuns.length>0?Ea(`it`,n.body)===E.TRUE?dn.ITALIC:dn.NORMAL:this._getFontStyles()[0][0]}_getFontStyles(){return this._getStyles(`it`)}getFontWeight(){var e,t;let{p:n}=(e=this.getValue())==null?{}:e;return n&&Array.isArray((t=n.body)==null?void 0:t.textRuns)&&n.body.textRuns.length>0?Ea(`bl`,n.body)===E.TRUE?fn.BOLD:fn.NORMAL:this._getFontWeights()[0][0]}_getFontWeights(){return this._getStyles(`bl`)}getGridId(){return this._worksheet.getSheetId()}getHeight(){let{_range:e,_worksheet:t}=this,{startRow:n,endRow:r}=e,i=0;for(let e=0;e<=r-n;e++){let n=t.getRowHeight(e);i+=n}return i}getHorizontalAlignment(){return this.getHorizontalAlignments()[0][0]}getHorizontalAlignments(){return this._getStyles(`ht`)}getLastColumn(){return this._range.endColumn}getLastRow(){return this._range.endRow}getNumColumns(){let{startColumn:e,endColumn:t}=this._range;return t-e+1}getNumRows(){let{startRow:e,endRow:t}=this._range;return t-e+1}getRichTextValue(){return this.getRichTextValues()[0][0]}getRichTextValues(){return this.getValues().map(e=>e.map(e=>(e==null?void 0:e.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(){let e=this._deps.getStyles();return this.getValues().map(t=>t.map(t=>e.getStyleByCell(t)))}getVerticalAlignment(){return this.getVerticalAlignments()[0][0]}getVerticalAlignments(){return this._getStyles(`vt`)}getWidth(){let{_range:e,_worksheet:t}=this,{startColumn:n,endColumn:r}=e,i=0;for(let e=0;e<=r-n;e++)i+=t.getColumnWidth(e);return i}getWrap(){return this.getWrapStrategy()===un.WRAP?E.TRUE:E.FALSE}getWrapStrategies(){return this._getStyles(`tb`)}getWrapStrategy(){return this.getWrapStrategies()[0][0]}forEach(t){e.foreach(this._range,t)}_getStyles(e){let t=this._deps.getStyles();return this.getValues().map(n=>n.map(n=>{let r=t&&t.getStyleByCell(n);return r&&r[e]||H[e]}))}};v(Da,`transformRange`,(e,t)=>{let n=t.getMaxColumns()-1,r=t.getMaxRows()-1;return e.rangeType===L.ALL?{startColumn:0,startRow:0,endColumn:n,endRow:r}:e.rangeType===L.COLUMN?{startRow:0,endRow:r,startColumn:e.startColumn,endColumn:e.endColumn}:e.rangeType===L.ROW?{startColumn:0,endColumn:n,startRow:e.startRow,endRow:e.endRow}:{startColumn:e.startColumn,endColumn:Math.min(e.endColumn,n),startRow:e.startRow,endRow:Math.min(e.endRow,r)}});function Oa(e,t,n,r=!1){if(t===0&&n===0)return e;let i={...e},a=i.startAbsoluteRefType||R.NONE,o=i.endAbsoluteRefType||R.NONE,s=i.rangeType||L.NORMAL;if(!r&&a===R.ALL&&o===R.ALL)return i;let c=ka(i.startRow,n,i.startColumn,t,s),l=ka(i.endRow,n,i.endColumn,t,s);return r||a===R.NONE&&o===R.NONE?i={...i,startRow:c.row,startColumn:c.column,endRow:l.row,endColumn:l.column}:(a===R.NONE?i={...i,startRow:c.row,startColumn:c.column}:a===R.COLUMN?i={...i,startRow:c.row}:a===R.ROW&&(i={...i,startColumn:c.column}),o===R.NONE?i={...i,endRow:l.row,endColumn:l.column}:o===R.COLUMN?i={...i,endRow:l.row}:o===R.ROW&&(i={...i,endColumn:l.column}),i)}function ka(e,t,n,r,i){return i===L.NORMAL?{row:e+t,column:n+r}:i===L.ROW?{row:e+t,column:n}:i===L.COLUMN?{row:e,column:n+r}:{row:e,column:n}}function Aa(e){let t=new Set,n=new Set;for(let r of e)t.add(r.startColumn),t.add(r.endColumn+1),n.add(r.startRow),n.add(r.endRow+1);let r=Array.from(t).sort((e,t)=>e-t),i=Array.from(n).sort((e,t)=>e-t);e.sort((e,t)=>e.startRow-t.startRow||e.startColumn-t.startColumn);let a=[];for(let t=0;t<i.length-1;t++)for(let n=0;n<r.length-1;n++){let o=r[n],s=r[n+1]-1,c=i[t],l=i[t+1]-1;for(let t of e){if(t.startRow>l)break;if(t.startRow<=c&&t.endRow>=l&&t.startColumn<=o&&t.endColumn>=s){a.push({startColumn:o,endColumn:s,startRow:c,endRow:l});break}}}return a}function ja(e){e.sort((e,t)=>e.startRow-t.startRow||e.startColumn-t.startColumn);let t={};for(let n of e)t[n.startRow]||(t[n.startRow]=[]),t[n.startRow].push(n);let n=[];for(let e in t){let r=t[+e];r.sort((e,t)=>e.startColumn-t.startColumn);let i=r[0];for(let e=1;e<r.length;e++){let t=r[e];t.startColumn<=i.endColumn+1&&t.startRow===i.startRow&&t.endRow===i.endRow?i.endColumn=Math.max(i.endColumn,t.endColumn):(n.push(i),i=t)}n.push(i)}return n}function Ma(e){e.sort((e,t)=>e.startColumn-t.startColumn||e.startRow-t.startRow);let t={};for(let n of e)t[n.startColumn]||(t[n.startColumn]=[]),t[n.startColumn].push(n);let n=[];for(let e in t){let r=t[+e];r.sort((e,t)=>e.startRow-t.startRow);let i=r[0];for(let e=1;e<r.length;e++){let t=r[e];t.startRow<=i.endRow+1&&t.startColumn===i.startColumn&&t.endColumn===i.endColumn?i.endRow=Math.max(i.endRow,t.endRow):(n.push(i),i=t)}n.push(i)}return n}function Na(e){return Ma(ja(Aa(e)))}function Pa(e,t){let n=[];return e.forEach(e=>{n.push(...U.subtract(e,t))}),U.mergeRanges(n)}function Fa(e,t){let n=Ia(e.startRow,e.endRow,t.startRow,t.endRow),r=Ia(e.startColumn,e.endColumn,t.startColumn,t.endColumn);if(!n||!r)return null;let[i,a]=n,[o,s]=r;return{startRow:i,endRow:a,startColumn:o,endColumn:s,rangeType:La(e.rangeType,t.rangeType,i,a,o,s)}}function Ia(e,t,n,r){let i=isNaN(e)?-1/0:e,a=isNaN(t)?1/0:t,o=isNaN(n)?-1/0:n,s=isNaN(r)?1/0:r,c=Math.max(i,o),l=Math.min(a,s);return c<=l?[c===-1/0?NaN:c,l===1/0?NaN:l]:null}function La(e,t,n,r,i,a){let o=e===void 0?Ra(n,r,i,a):e,s=t===void 0?Ra(n,r,i,a):t;return o===L.ALL||s===L.ALL?o===s?o:o===L.ALL?s:o:o===s?o:(o===L.NORMAL||L.NORMAL,L.NORMAL)}function Ra(e,t,n,r){let i=!isNaN(e)&&!isNaN(t),a=!isNaN(n)&&!isNaN(r);return i&&a?L.NORMAL:i?L.ROW:a?L.COLUMN:L.ALL}var U=class e{static clone(e){return e.rangeType===void 0?{startRow:e.startRow,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn}:{startRow:e.startRow,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn,rangeType:e.rangeType}}static equals(e,t){return e==null||t==null?!1:e.endRow===t.endRow&&e.endColumn===t.endColumn&&e.startRow===t.startRow&&e.startColumn===t.startColumn&&(e.rangeType===t.rangeType||e.rangeType===void 0&&t.rangeType===L.NORMAL||t.rangeType===void 0&&e.rangeType===L.NORMAL)}static simpleRangesIntersect(e,t){let{startRow:n,endRow:r,startColumn:i,endColumn:a}=e,{startRow:o,endRow:s,startColumn:c,endColumn:l}=t;return n<=s&&r>=o&&i<=l&&a>=c}static intersects(e,t){if(e.rangeType===L.ROW&&t.rangeType===L.COLUMN||e.rangeType===L.COLUMN&&t.rangeType===L.ROW)return!0;if(e.rangeType===L.ROW&&t.rangeType===L.ROW)return e.startRow<=t.endRow&&e.endRow>=t.startRow;if(e.rangeType===L.COLUMN&&t.rangeType===L.COLUMN)return e.startColumn<=t.endColumn&&e.endColumn>=t.startColumn;let n=Number.isNaN(e.startRow)?0:e.startRow,r=Number.isNaN(e.endRow)?ma-1:e.endRow,i=Number.isNaN(e.startColumn)?0:e.startColumn,a=Number.isNaN(e.endColumn)?ha-1:e.endColumn,o=Number.isNaN(t.startRow)?0:t.startRow,s=Number.isNaN(t.endRow)?ma-1:t.endRow,c=Number.isNaN(t.startColumn)?0:t.startColumn,l=Number.isNaN(t.endColumn)?ha-1:t.endColumn,u=Math.abs(i+a-c-l),d=Math.abs(i-a)+Math.abs(c-l),f=Math.abs(n+r-o-s),p=Math.abs(n-r)+Math.abs(o-s);return u<=d&&f<=p}static doAnyRangesIntersect(e,t){let n=new ce.default;return n.load(e.map(e=>({minX:e.startColumn,minY:e.startRow,maxX:e.endColumn,maxY:e.endRow}))),t.some(e=>n.search({minX:e.startColumn,minY:e.startRow,maxX:e.endColumn,maxY:e.endRow}).length>0)}static getIntersects(e,t){let n=e.startRow,r=e.endRow,i=e.startColumn,a=e.endColumn,o=t.startRow,s=t.endRow,c=t.startColumn,l=t.endColumn,u,d,f,p;if(o<=r)d=o>=n?o:n;else return null;if(s>=n)p=s>=r?r:s;else return null;if(c<=a)u=c>i?c:i;else return null;if(l>=i)f=l>=a?a:l;else return null;return{startRow:d,endRow:p,startColumn:u,endColumn:f,rangeType:L.NORMAL}}static contains(e,t){return e.startRow<=t.startRow&&e.endRow>=t.endRow&&e.startColumn<=t.startColumn&&e.endColumn>=t.endColumn}static realContain(t,n){return e.contains(t,n)&&(t.startRow<n.startRow||t.endRow>n.endRow||t.startColumn<n.startColumn||t.endColumn>n.endColumn)}static union(...e){return e.reduce((e,t)=>({startRow:Math.min(e.startRow,t.startRow),startColumn:Math.min(e.startColumn,t.startColumn),endRow:Math.max(e.endRow,t.endRow),endColumn:Math.max(e.endColumn,t.endColumn),rangeType:L.NORMAL}),e[0])}static realUnion(...t){let n=t.some(e=>e.rangeType===L.COLUMN),r=t.some(e=>e.rangeType===L.ROW),i=e.union(...t);return{startColumn:r?NaN:i.startColumn,endColumn:r?NaN:i.endColumn,startRow:n?NaN:i.startRow,endRow:n?NaN:i.endRow,rangeType:r?L.ROW:n?L.COLUMN:L.NORMAL}}static subtract(e,t){if(t.startRow>e.endRow||t.endRow<e.startRow||t.startColumn>e.endColumn||t.endColumn<e.startColumn)return[e];let n=[];t.startRow>=e.startRow&&n.push({startRow:e.startRow,startColumn:e.startColumn,endRow:t.startRow-1,endColumn:e.endColumn}),t.endRow<=e.endRow&&n.push({startRow:t.endRow+1,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn});let r=Math.max(e.startRow,t.startRow),i=Math.min(e.endRow,t.endRow);return t.startColumn>=e.startColumn&&n.push({startRow:r,startColumn:e.startColumn,endRow:i,endColumn:t.startColumn-1}),t.endColumn<=e.endColumn&&n.push({startRow:r,startColumn:t.endColumn+1,endRow:i,endColumn:e.endColumn}),n.filter(e=>e.startRow<=e.endRow&&e.startColumn<=e.endColumn)}static mergeRanges(e){return Na(e)}static splitIntoGrid(e){return Aa(e)}static subtractMulti(e,t){if(!t.length)return e;let n=e;return t.forEach(e=>{n=Pa(n,e)}),n}static hasIntersectionBetweenTwoRect(e,t){return!(e.left>t.right||e.right<t.left||e.top>t.bottom||e.bottom<t.top)}static getIntersectionBetweenTwoRect(e,t){let n=Math.max(e.left,t.left),r=Math.min(e.right,t.right),i=Math.max(e.top,t.top),a=Math.min(e.bottom,t.bottom);return r<=n||a<=i?null:{left:n,right:r,top:i,bottom:a,width:r-n,height:a-i}}static sort(e){return e.sort((e,t)=>e.startRow-t.startRow||e.startColumn-t.startColumn)}};v(U,`getRelativeRange`,(e,t)=>({startRow:e.startRow-t.startRow,endRow:e.endRow-e.startRow,startColumn:e.startColumn-t.startColumn,endColumn:e.endColumn-e.startColumn})),v(U,`getPositionRange`,(e,t,n)=>({...n||{},startRow:n&&[R.ROW,R.ALL].includes(n.startAbsoluteRefType||0)?n.startRow:e.startRow+t.startRow,endRow:n&&[R.ROW,R.ALL].includes(n.endAbsoluteRefType||0)?n.endRow:e.endRow+e.startRow+t.startRow,startColumn:n&&[R.COLUMN,R.ALL].includes(n.startAbsoluteRefType||0)?n.startColumn:e.startColumn+t.startColumn,endColumn:n&&[R.COLUMN,R.ALL].includes(n.endAbsoluteRefType||0)?n.endColumn:e.endColumn+e.startColumn+t.startColumn})),v(U,`moveHorizontal`,(e,t=0,n=0)=>({...e,startColumn:e.startColumn+t,endColumn:e.endColumn+t+n})),v(U,`moveVertical`,(e,t=0,n=0)=>({...e,startRow:e.startRow+t,endRow:e.endRow+t+n})),v(U,`moveOffset`,(e,t,n)=>{let r={...e};switch(e.startAbsoluteRefType){case R.ROW:r.startColumn+=t;break;case R.COLUMN:r.startRow+=n;break;case R.ALL:break;case R.NONE:default:r.startRow+=n,r.startColumn+=t;break}switch(e.endAbsoluteRefType){case R.ROW:r.endColumn+=t;break;case R.COLUMN:r.endRow+=n;break;case R.ALL:break;case R.NONE:default:r.endRow+=n,r.endColumn+=t;break}return r});function za(e,t){if(e.length===0||e[0].length===0)return null;let n=Array(e[0].length).fill(0),r=0,i=null;for(let a=0;a<e.length;a++){for(let r=0;r<e[0].length;r++)n[r]=t(e[a][r])?n[r]+1:0;let o=Ba(n);o.area>r&&(r=o.area,i={startColumn:o.start,startRow:a-o.height+1,endColumn:o.end,endRow:a})}return i}function Ba(e){let t=[],n=0,r={area:0,height:0,start:0,end:0},i=0;for(;i<e.length;)if(t.length===0||e[i]>=e[t[t.length-1]])t.push(i++);else{let a=e[t.pop()],o=t.length===0?i:i-t[t.length-1]-1;a*o>n&&(n=a*o,r={area:n,height:a,start:t.length===0?0:t[t.length-1]+1,end:i-1})}for(;t.length>0;){let a=e[t.pop()],o=t.length===0?i:i-t[t.length-1]-1;a*o>n&&(n=a*o,r={area:n,height:a,start:t.length===0?0:t[t.length-1]+1,end:i-1})}return r}function Va(e,t){Da.foreach(t,(t,n)=>{e[t][n]=void 0})}function Ha(e,t){let n=e.toFullArray(),r=[];for(;;){let e=za(n,t);if(!e)break;r.push(e),Va(n,e)}return r}var Ua=class{constructor(e,t){v(this,`_values`,[]),v(this,`_keys`,[]),v(this,`_keyMaps`,new Map),this._values=e,this._keys=t,e.forEach(e=>{this._initKeyMap(e)})}_initKeyMap(e){this._keys.forEach(t=>{let n=e[t],r=this._keyMaps.get(t)||new Map;r.set(n,e),this._keyMaps.set(t,r)})}getValue(e,t){let n=t||this._keys;for(let t=0;t<n.length;t++){let r=this._keyMaps.get(n[t]);if(r!=null&&r.has(e))return r.get(e)}return null}hasValue(e){for(let t=0;t<this._keys.length;t++){let n=this._keyMaps.get(this._keys[t]);if(n!=null&&n.has(e))return!0}return!1}addValue(e){this._values.push(e),this._initKeyMap(e)}setValue(e,t,n){let r=this.getValue(e);r&&Object.keys(r).includes(t)&&(r[t]=n)}deleteValue(e,t){let n=this.getValue(e,t);if(n){this._keys.forEach(e=>{let t=this._keyMaps.get(e),r=n[e];t==null||t.delete(r)});let e=this._values.findIndex(e=>e===n);this._values.splice(e,1)}}getValues(){return this._values}getKeyMap(e){var t;return[...((t=this._keyMaps.get(e))==null?void 0:t.keys())||[]]}clear(){this._values=[],this._keys=[],this._keyMaps.clear()}};function Wa(e,t,n,r){return{forEach(i){for(let a=e;a<=t;a++)for(let e=n;e<=r;e++)i(a,e)}}}function Ga(e){if(e==null||e.length===0)return NaN;let t=e.toLowerCase().split(``),n=t.length,r=e=>e.charCodeAt(0)-96,i=0,a=0;for(let e=0;e<n;e++)a=r(t[e]),i+=a*26**(n-e-1);return i===0?NaN:i-1}function Ka(e){let t=``;for(;e>=0;)t=String.fromCharCode(e%26+65)+t,e=Math.floor(e/26)-1;return t}function qa(e,t){let n=``;for(;t>0;)n+=e,t--;return n}function Ja(e,t=!1){let n=97;return t&&(n=65),qa(String.fromCharCode(e%26+n),Math.floor(e/26)+1)}function Ya(e,t){return e.zIndex>t.zIndex?1:e.zIndex===t.zIndex?0:-1}function Xa(e,t){return e.zIndex>t.zIndex?-1:e.zIndex===t.zIndex?0:1}function Za(e=`index`,t=1){return(n,r)=>n[e]>r[e]?t:n[e]===r[e]?0:-t}function Qa(e,t=!1){let n=[];for(let r of e){let{st:e,ed:i,ts:a}=r;if(r.sId===void 0&&delete r.sId,e===i||!t&&S.isEmptyObject(a)&&r.sId==null)continue;if(n.length===0){n.push(r);continue}let o=n.pop();Wi(r,o)&&S.hasIntersectionBetweenTwoRanges(o.st,o.ed,r.st,r.ed)?n.push({...r,st:o.st,ed:i}):n.push(o,r)}return n}function $a(e,t,n,r){var i;let{textRuns:a}=e;if(a==null)return;let o=[],s=a.length,c=!1,l=(i=t.textRuns)==null?[]:i;if(l.length)for(let e of l)e.st+=r,e.ed+=r;for(let e=0;e<s;e++){let t=a[e],{st:i,ed:s}=t;if(s<=r)o.push(t);else if(r>i&&r<s){c=!0;let e={...t,ed:r};o.push(e),l.length&&o.push(...l);let i={...t,st:r+n,ed:s+n};o.push(i)}else t.st+=n,t.ed+=n,c||(c=!0,o.push(...l)),o.push(t)}c||(c=!0,o.push(...l)),e.textRuns=Qa(o)}function eo(e,t,n,r){let{paragraphs:i}=e;if(i==null)return;let{paragraphs:a}=t,o=[],s=-1;for(let e=0,t=i.length;e<t;e++){let t=i[e],{startIndex:a}=t;a>=r&&(t.startIndex+=n),s===-1&&a>=r&&(s=e),o.push(t.startIndex)}let c=-1;if(a){for(let e=0,t=a.length;e<t;e++){let t=a[e];t.startIndex+=r;let n=t.startIndex;c=o.indexOf(n)}c!==-1&&i.splice(c,1),i.push(...a),i.sort(Za(`startIndex`))}}function to(e,t,n,r){let{sectionBreaks:i}=e;if(i==null)return;for(let e=0,t=i.length;e<t;e++){let t=i[e],{startIndex:a}=t;a>=r&&(t.startIndex+=n)}let a=t.sectionBreaks;if(a){for(let e=0,t=a.length;e<t;e++){let t=a[e];t.startIndex+=r}i.push(...a),i.sort(Za(`startIndex`))}}function no(e,t,n,r){let{customBlocks:i=[]}=e;for(let e=0,t=i.length;e<t;e++){let t=i[e],{startIndex:a}=t;a>=r&&(t.startIndex+=n)}let a=t.customBlocks;if(a){for(let e=0,t=a.length;e<t;e++){let t=a[e];t.startIndex+=r}i.push(...a),i.sort(Za(`startIndex`))}i.length&&!e.customBlocks&&(e.customBlocks=i)}function ro(e,t,n,r){let{tables:i}=e;if(i==null)return;for(let e=0,t=i.length;e<t;e++){let t=i[e],{startIndex:a,endIndex:o}=t;a>r?(t.startIndex+=n,t.endIndex+=n):o>r&&(t.endIndex+=n)}let a=t.tables;if(a){for(let e=0,t=a.length;e<t;e++){let t=a[e];t.startIndex+=r,t.endIndex+=r}i.push(...a),i.sort(Za(`startIndex`))}}const io=e=>e.split(`$`)[0];function ao(e){if(e.length<=1)return e;e.sort((e,t)=>e.startIndex-t.startIndex);let t=[],n={...e[0]};n.rangeId=io(n.rangeId);for(let r=1;r<e.length;r++){let i=e[r];i.rangeId=io(i.rangeId),i.rangeId===n.rangeId&&Le(n.properties,i.properties)&&n.endIndex+1>=i.startIndex?n.endIndex=i.endIndex:(t.push(n),n={...i})}t.push(n);let r=Object.create(null);for(let e=0,n=t.length;e<n;e++){let n=t[e],i=n.rangeId;r[i]?(n.rangeId=`${i}\$${r[i]}`,r[i]=r[i]+1):r[i]=1}return t}function oo(e,t){let n=e.findIndex(e=>e.startIndex<t&&e.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 so(e){if(e.length<=1)return e;e.sort((e,t)=>e.startIndex-t.startIndex);let t=[],n={...e[0]};for(let r=1;r<e.length;r++){let i=e[r];i.id===n.id&&n.endIndex+1>=i.startIndex?n.endIndex=i.endIndex:(t.push(n),n={...i})}return t.push(n),t}function co(e,t){e.filter(e=>e.startIndex<t&&e.endIndex>=t).forEach(n=>{let r=e.indexOf(n);e.splice(r,1,{id:n.id,type:n.type,startIndex:n.startIndex,endIndex:t-1},{id:n.id,type:n.type,startIndex:t,endIndex:n.endIndex})})}function lo(e,t,n,r){e.customRanges||(e.customRanges=[]);let{customRanges:i}=e;oo(i,r);for(let e=0,t=i.length;e<t;e++){let t=i[e],{startIndex:a}=t;a>=r&&(t.startIndex+=n,t.endIndex+=n)}let a=[];if(t.customRanges){for(let e=0,n=t.customRanges.length;e<n;e++){let n=t.customRanges[e];n.startIndex+=r,n.endIndex+=r,a.push(n)}i.push(...a)}e.customRanges=ao(i)}function uo(e,t,n,r){e.customDecorations||(e.customDecorations=[]);let{customDecorations:i}=e;co(i,r);for(let e=0,t=i.length;e<t;e++){let t=i[e],{startIndex:a}=t;a>=r&&(t.startIndex+=n,t.endIndex+=n)}let a=[];if(t.customDecorations){for(let e=0,n=t.customDecorations.length;e<n;e++){let n=t.customDecorations[e];n.startIndex+=r,n.endIndex+=r,a.push(n)}i.push(...a)}e.customDecorations=so(i)}function fo(e,t,n){let{textRuns:r}=e,i=n,a=n+t,o=[];if(r){let n=[];for(let e=0,s=r.length;e<s;e++){let s=r[e],{st:c,ed:l}=s;if(i<=c&&a>=l){o.push({...s,st:c-i,ed:l-i});continue}else c<=i&&l>=a?(o.push({...s,st:i-i,ed:a-i}),s.ed-=t):i>=c&&i<l?(o.push({...s,st:i-i,ed:l-i}),s.ed=i):a>c&&a<=l?(o.push({...s,st:c-i,ed:a-i}),s.st=a-t,s.ed-=t):c>=a&&(s.st-=t,s.ed-=t);n.push(s)}e.textRuns=n}return o.length===0&&o.push({st:0,ed:t,ts:{}}),o}function po(e,t,n){let{paragraphs:r}=e,i=n,a=n+t,o=[],s=null,c=!1;if(r){let l=[];for(let e=0,u=r.length;e<u;e++){let u=r[e],{startIndex:d}=u;if(d>=i&&d<a){o.push({...u,startIndex:d-n}),c=!0;continue}else d>=a&&(u.startIndex-=t);l.push(u),s==null&&c&&(s=u)}e.paragraphs=l}return o}function mo(e,t,n){let{sectionBreaks:r}=e,i=n,a=n+t-1,o=[];if(r){let s=[];for(let e=0,c=r.length;e<c;e++){let c=r[e],{startIndex:l}=c;if(l>=i&&l<=a){o.push({...c,startIndex:l-n});continue}else l>a&&(c.startIndex-=t);s.push(c)}e.sectionBreaks=s}return o}function ho(e,t,n){let{customBlocks:r=[]}=e,i=n,a=n+t-1,o=[];if(r){let s=[];for(let e=0,c=r.length;e<c;e++){let c=r[e],{startIndex:l}=c;if(l>=i&&l<=a){o.push({...c,startIndex:l-n});continue}else l>a&&(c.startIndex-=t);s.push(c)}e.customBlocks=s}return r.length&&!e.customBlocks&&(e.customBlocks=r),o}function go(e,t,n){let{tables:r}=e,i=n,a=n+t-1,o=[];if(r){let s=[];for(let e=0,c=r.length;e<c;e++){let c=r[e],{startIndex:l,endIndex:u}=c;if(i<=l&&a>=u){o.push({...c,startIndex:l-n,endIndex:u-n});continue}else if(l<=i&&u>=a){let e=Ki(l,u,i,a);if(e.length===0||(c.startIndex=e[0],c.endIndex=e[1],c.startIndex===c.endIndex))continue}else a<l&&(c.startIndex-=t,c.endIndex-=t);s.push(c)}e.tables=s}return o}function _o(e,t,n){let{customRanges:r}=e,i=n,a=n+t-1,o=[];if(r){let n=[];for(let e=0,s=r.length;e<s;e++){let s=r[e],{startIndex:c,endIndex:l}=s;if(c>=i&&l<=a){o.push(s);continue}else if(Math.max(i,c)<=Math.min(a,l)){let e=Ki(c,l,i,a);if(e.length===0)continue;s.startIndex=e[0],s.endIndex=e[1]}else a<c&&(s.startIndex-=t,s.endIndex-=t);n.push(s)}e.customRanges=ao(n)}return o}function vo(e,t,n,r=!0){let{customDecorations:i}=e,a=n,o=n+t-1,s=[];if(i){let n=[];for(let e=0,c=i.length;e<c;e++){let c=i[e],{startIndex:l,endIndex:u}=c;if(l>=a&&u<=o){s.push(c);continue}else if(Math.max(a,l)<=Math.min(o,u)){let e=Ki(l,u,a,o);if(e.length===0)continue;c.startIndex=e[0],c.endIndex=e[1]}else o<l&&r&&(c.startIndex-=t,c.endIndex-=t);n.push(c)}e.customDecorations=n}return s}let W=function(e){return 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}({}),G=function(e){return 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}({});const yo={"a)":{glyphFormat:`%1)`,glyphType:O.DECIMAL},"1.":{glyphFormat:`%1.`,glyphType:O.DECIMAL},"a.":{glyphFormat:`%1.`,glyphType:O.LOWER_LETTER},"A.":{glyphFormat:`%1.`,glyphType:O.UPPER_LETTER},"i.":{glyphFormat:`%1.`,glyphType:O.LOWER_ROMAN},"I.":{glyphFormat:`%1.`,glyphType:O.UPPER_LETTER}},bo=e=>[...e,...e,...e].map((e,t)=>({glyphFormat:` %${t+1}`,glyphSymbol:e,bulletAlignment:vn.START,textStyle:{fs:12},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*t}}})),xo=e=>e.map((e,t)=>({...e,bulletAlignment:vn.START,textStyle:{fs:12},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*t}}})),So=(e,t)=>Array(9).fill(0).map((n,r)=>({glyphFormat:` %${r+1}`,glyphSymbol:e,bulletAlignment:vn.START,textStyle:{fs:16},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*r},textStyle:t}})),Co={[G.BULLET_LIST]:{listType:G.BULLET_LIST,nestingLevel:bo([`●`,`○`,`■`])},[G.BULLET_LIST_1]:{listType:G.BULLET_LIST,nestingLevel:bo([`❖`,`➢`,`■`])},[G.BULLET_LIST_2]:{listType:G.BULLET_LIST,nestingLevel:bo([`✔`,`●`,`◆`])},[G.BULLET_LIST_3]:{listType:G.BULLET_LIST,nestingLevel:bo([`■`,`◆`,`○`])},[G.BULLET_LIST_4]:{listType:G.BULLET_LIST,nestingLevel:bo([`✧`,`○`,`■`])},[G.BULLET_LIST_5]:{listType:G.BULLET_LIST,nestingLevel:bo([`➢`,`○`,`◆`])},[G.ORDER_LIST]:{listType:G.ORDER_LIST,nestingLevel:xo([{glyphFormat:`%1.`,glyphType:O.DECIMAL},{glyphFormat:`%2.`,glyphType:O.LOWER_LETTER},{glyphFormat:`%3.`,glyphType:O.LOWER_ROMAN},{glyphFormat:`%4.`,glyphType:O.DECIMAL},{glyphFormat:`%5.`,glyphType:O.LOWER_LETTER},{glyphFormat:`%6.`,glyphType:O.LOWER_ROMAN},{glyphFormat:`%7.`,glyphType:O.DECIMAL},{glyphFormat:`%8.`,glyphType:O.LOWER_LETTER},{glyphFormat:`%9.`,glyphType:O.LOWER_ROMAN}])},[G.ORDER_LIST_1]:{listType:G.ORDER_LIST,nestingLevel:xo([{glyphFormat:`%1)`,glyphType:O.DECIMAL},{glyphFormat:`%2)`,glyphType:O.LOWER_LETTER},{glyphFormat:`%3)`,glyphType:O.LOWER_ROMAN},{glyphFormat:`%4)`,glyphType:O.DECIMAL},{glyphFormat:`%5)`,glyphType:O.LOWER_LETTER},{glyphFormat:`%6)`,glyphType:O.LOWER_ROMAN},{glyphFormat:`%7)`,glyphType:O.DECIMAL},{glyphFormat:`%8)`,glyphType:O.LOWER_LETTER},{glyphFormat:`%9)`,glyphType:O.LOWER_ROMAN}])},[G.ORDER_LIST_2]:{listType:G.ORDER_LIST,nestingLevel:xo([`%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:O.DECIMAL})))},[G.ORDER_LIST_3]:{listType:G.ORDER_LIST,nestingLevel:xo([{glyphFormat:`%1.`,glyphType:O.UPPER_LETTER},{glyphFormat:`%2.`,glyphType:O.LOWER_LETTER},{glyphFormat:`%3.`,glyphType:O.LOWER_ROMAN},{glyphFormat:`%4.`,glyphType:O.UPPER_LETTER},{glyphFormat:`%5.`,glyphType:O.LOWER_LETTER},{glyphFormat:`%6.`,glyphType:O.LOWER_ROMAN},{glyphFormat:`%7.`,glyphType:O.UPPER_LETTER},{glyphFormat:`%8.`,glyphType:O.LOWER_LETTER},{glyphFormat:`%9.`,glyphType:O.LOWER_ROMAN}])},[G.ORDER_LIST_4]:{listType:G.ORDER_LIST,nestingLevel:xo([{glyphFormat:`%1.`,glyphType:O.UPPER_LETTER},{glyphFormat:`%2.`,glyphType:O.DECIMAL},{glyphFormat:`%3.`,glyphType:O.LOWER_ROMAN},{glyphFormat:`%4.`,glyphType:O.UPPER_LETTER},{glyphFormat:`%5.`,glyphType:O.DECIMAL},{glyphFormat:`%6.`,glyphType:O.LOWER_ROMAN},{glyphFormat:`%7.`,glyphType:O.UPPER_LETTER},{glyphFormat:`%8.`,glyphType:O.DECIMAL},{glyphFormat:`%9.`,glyphType:O.LOWER_ROMAN}])},[G.ORDER_LIST_5]:{listType:G.ORDER_LIST,nestingLevel:xo([{glyphFormat:`%1.`,glyphType:O.DECIMAL_ZERO},{glyphFormat:`%2.`,glyphType:O.LOWER_LETTER},{glyphFormat:`%3.`,glyphType:O.LOWER_ROMAN},{glyphFormat:`%4.`,glyphType:O.DECIMAL_ZERO},{glyphFormat:`%5.`,glyphType:O.LOWER_LETTER},{glyphFormat:`%6.`,glyphType:O.LOWER_ROMAN},{glyphFormat:`%7.`,glyphType:O.DECIMAL_ZERO},{glyphFormat:`%8.`,glyphType:O.LOWER_LETTER},{glyphFormat:`%9.`,glyphType:O.LOWER_ROMAN}])},[G.CHECK_LIST]:{listType:G.CHECK_LIST,nestingLevel:So(`☐`)},[G.CHECK_LIST_CHECKED]:{listType:G.CHECK_LIST_CHECKED,nestingLevel:So(`☑`,{st:{s:E.TRUE}})}},wo=e=>{let{glyphFormat:t,glyphType:n}=e,r=S.deepClone(Co[G.ORDER_LIST]);return r.nestingLevel[0].glyphFormat=t,r.nestingLevel[0].glyphType=n,r},To={[G.ORDER_LIST_QUICK_2]:wo(yo[W.ORDER_LIST_QUICK_2]),[G.ORDER_LIST_QUICK_3]:wo(yo[W.ORDER_LIST_QUICK_3]),[G.ORDER_LIST_QUICK_4]:wo(yo[W.ORDER_LIST_QUICK_4]),[G.ORDER_LIST_QUICK_6]:wo(yo[W.ORDER_LIST_QUICK_6])};Object.assign(Co,To);const Eo={[W.ORDER_LIST_QUICK_1]:G.ORDER_LIST,[W.ORDER_LIST_QUICK_2]:G.ORDER_LIST_QUICK_2,[W.ORDER_LIST_QUICK_3]:G.ORDER_LIST_QUICK_3,[W.ORDER_LIST_QUICK_4]:G.ORDER_LIST_QUICK_4,[W.ORDER_LIST_QUICK_5]:G.ORDER_LIST_3,[W.ORDER_LIST_QUICK_6]:G.ORDER_LIST_QUICK_6,[W.ORDER_LIST_QUICK_7]:G.ORDER_LIST_5,[W.BULLET_LIST]:G.BULLET_LIST};function Do(e,t,n,r,i){return{dataStream:``,textRuns:Oo(e,t,n,r,i),paragraphs:Ao(e,t,n,r,i),sectionBreaks:jo(e,t,n,r,i),customBlocks:Mo(e,t,n,r,i),tables:No(e,t,n,r,i),customRanges:Po(e,t,n,r,i),customDecorations:Fo(e,t,n,r,i)}}function Oo(e,t,n,r,i){let{textRuns:a}=e,{textRuns:o}=t;if(a==null||o==null)return;let s=fo(e,n,r);return i!==j.REPLACE&&(t.textRuns=ko(o,s,i)),$a(e,t,n,r),s}function ko(e,t,n){if(t.length===0)return e;e=S.deepClone(e),t=S.deepClone(t);let r=[],i=e.length,a=t.length,o=0,s=0,c=null;function l(){return c?(r.push(c),c=null,!0):!1}for(;o<i&&s<a;){let{st:i,ed:a,ts:u}=e[o],{st:d,ed:f,ts:p,sId:m}=t[s],h;if(h=n===j.COVER?{...p,...u}:{...u},a<d)l()||r.push(e[o]),o++;else if(f<i)l()||r.push(t[s]),s++;else{let n={st:Math.min(i,d),ed:Math.max(i,d),ts:i<d?{...u}:{...p},sId:i<d?void 0:m};n.ed>n.st&&r.push(n),r.push({st:Math.max(i,d),ed:Math.min(a,f),ts:h,sId:m}),a<f?(o++,t[s].st=a,t[s].st===t[s].ed&&s++):(s++,e[o].st=f,e[o].st===e[o].ed&&o++);let l={st:Math.min(a,f),ed:Math.max(a,f),ts:a<f?{...p}:{...u},sId:a<f?m:void 0};c=l.ed>l.st?l:null}}l();let u=r[r.length-1],d=e[i-1],f=t[a-1];return u&&u.ed!==Math.max(d.ed,f.ed)&&(d.ed>f.ed?r.push(d):r.push(f)),Qa(r)}function Ao(e,t,n,r,i){let{paragraphs:a}=e,{paragraphs:o}=t;if(a==null||o==null)return;let s=po(e,n,r);if(i!==j.REPLACE){let e=[];for(let t of o){let{startIndex:n,paragraphStyle:r,bullet:a}=t,o=[];for(let e of s){let{startIndex:t,paragraphStyle:s,bullet:c}=e,l,u;if(i===j.COVER?(l={...s,...r},u={listId:``,listType:G.BULLET_LIST,nestingLevel:0,textStyle:{},...c,...a}):(l={...r,...s},u={listId:``,listType:G.BULLET_LIST,nestingLevel:0,textStyle:{},...a,...c}),n===t){o.push({startIndex:n,paragraphStyle:l,bullet:u});break}}e.push(...o),o=[]}t.paragraphs=e}return eo(e,t,n,r),s}function jo(e,t,n,r,i){let{sectionBreaks:a}=e,{sectionBreaks:o}=t;if(a==null||o==null)return;let s=mo(e,n,r);if(i!==j.REPLACE){let e=[];for(let t of o){let{startIndex:n}=t,r=[];for(let e of s){let{startIndex:a}=e;if(n===a){i===j.COVER?r.push({...e,...t}):r.push({...t,...e});break}}e.push(...r),r=[]}t.sectionBreaks=e}return to(e,t,n,r),s}function Mo(e,t,n,r,i){let{customBlocks:a=[]}=e,{customBlocks:o}=t;if(a==null||o==null)return;let s=ho(e,n,r);if(i!==j.REPLACE){let e=[];for(let t of o){let{startIndex:n}=t,r=[];for(let e of s){let{startIndex:a}=e;if(n===a){i===j.COVER?r.push({...e,...t}):r.push({...t,...e});break}}e.push(...r),r=[]}t.customBlocks=e}return no(e,t,n,r),a.length&&!e.customBlocks&&(e.customBlocks=a),s}function No(e,t,n,r,i){let{tables:a}=e,{tables:o}=t;if(a==null||o==null)return;let s=go(e,n,r);if(i!==j.REPLACE){let e=[];for(let t of o){let{startIndex:n,endIndex:r}=t,a=[];for(let e of s){let{startIndex:o,endIndex:s}=e;if(o>=n&&s<=r){i===j.COVER?a.push({...e,...t}):a.push({...t,...e});break}}e.push(...a),a=[]}t.tables=e}return ro(e,t,n,r),s}function Po(e,t,n,r,i){e.customRanges||(e.customRanges=[]),oo(e.customRanges,r),oo(e.customRanges,r+n);let a=r,o=r+n-1,{customRanges:s}=t,c=[],l=new Map;return e.customRanges.forEach(e=>{let{startIndex:t,endIndex:n}=e;t>=a&&n<=o?l.set(e.rangeId,e):c.push(e)}),s?(s.forEach(e=>{let{startIndex:t,endIndex:n}=e;c.push({...e,startIndex:t+r,endIndex:n+r})}),e.customRanges=ao(c),[]):[]}function Fo(e,t,n,r,i){e.customDecorations||(e.customDecorations=[]),co(e.customDecorations,r),co(e.customDecorations,r+n);let a=[],{customDecorations:o}=e,{customDecorations:s=[]}=t;if(i===j.REPLACE){for(let e=0;e<o.length;e++){let t=o[e],{startIndex:i,endIndex:s}=t;i>=r&&s<=r+n-1&&a.push(t)}s.forEach(e=>{let{startIndex:t,endIndex:n}=e;o.push({...e,startIndex:t+r,endIndex:n+r})})}else for(let e of s){let{id:t}=e;if(e.type===bn.DELETED){let e=o.filter(e=>e.id===t);e.length&&a.push(...e)}else o.push({...e,startIndex:e.startIndex+r,endIndex:e.endIndex+r})}for(let e of a){let{id:t}=e,n=o.findIndex(e=>e.id===t);n!==-1&&o.splice(n,1)}return e.customDecorations=so(o),a}let Io=function(e){return e[e.copy=0]=`copy`,e[e.cut=1]=`cut`,e}({});function Lo(e,t,n,r=!0){let{textRuns:i}=e;if(i){let e=[];for(let r of i){let i=S.deepClone(r),{st:a,ed:o}=i;S.hasIntersectionBetweenTwoRanges(a,o,t,n)&&(t>=a&&t<=o?e.push({...i,st:t,ed:Math.min(n,o)}):n>=a&&n<=o?e.push({...i,st:Math.max(t,a),ed:n}):e.push(i))}return Qa(e.map(e=>{let{st:n,ed:r}=e;return{...e,st:n-t,ed:r-t}}))}else if(r)return[{st:0,ed:n-t,ts:{}}]}function Ro(e,t,n){let{tables:r=[]}=e,i=[];for(let e of r){let r=S.deepClone(e),{startIndex:a,endIndex:o}=r;a>=t&&o<=n&&i.push({...r,startIndex:a-t,endIndex:o-t})}return i}function zo(e,t,n){let{paragraphs:r=[]}=e,i=[];for(let e of r){let{startIndex:r}=e;if(r>=t&&r<n){let t=S.deepClone(e);i.push(t)}}if(i.length)return i.map(e=>({...e,startIndex:e.startIndex-t}))}function Bo(e,t,n){let{sectionBreaks:r=[]}=e,i=[];for(let e of r){let{startIndex:r}=e;r>=t&&r<=n&&i.push(S.deepClone(e))}if(i.length)return i.map(e=>({...e,startIndex:e.startIndex-t}))}function Vo(e,t,n){let{customBlocks:r=[]}=e,i=[];for(let e of r){let{startIndex:r}=e;r>=t&&r<n&&i.push(S.deepClone(e))}if(i.length)return i.map(e=>({...e,startIndex:e.startIndex-t}))}function K(e,t,n,r=!0,i=Io.cut){let{dataStream:a}=e,o={dataStream:a.slice(t,n)};o.textRuns=Lo(e,t,n,r);let s=Ro(e,t,n);if(s.length&&(o.tables=s),o.paragraphs=zo(e,t,n),i===Io.cut){let i=Wo(e,t,n);i?o.customDecorations=i:r&&(o.customDecorations=[])}let{customRanges:c}=Uo(e,t,n);return c?o.customRanges=c:r&&(o.customRanges=[]),o.customBlocks=Vo(e,t,n),o}function Ho(e){let{dataStream:t,textRuns:n,paragraphs:r,customRanges:i,customDecorations:a,tables:o}=e,s=0,c=0;i==null||i.forEach(e=>{e.startIndex<0&&(s=Math.max(s,-e.startIndex)),e.endIndex>t.length-1&&(c=Math.max(c,e.endIndex-t.length+1))});let l=`${t}`;return n&&(n[0]&&(n[0].st=n[0].st-s),n[n.length-1]&&(n[n.length-1].ed=n[n.length-1].ed+c)),n==null||n.forEach(e=>{e.st+=s,e.ed+=s}),r==null||r.forEach(e=>{e.startIndex+=s}),i==null||i.forEach(e=>{e.startIndex+=s,e.endIndex+=s}),a==null||a.forEach(e=>{e.startIndex+=s,e.endIndex+=c}),o==null||o.forEach(e=>{e.startIndex+=s,e.endIndex+=c}),{...e,dataStream:l,textRuns:n,paragraphs:r,customRanges:i,customDecorations:a,tables:o}}function Uo(e,t,n){if(e.customRanges==null)return{};let{customRanges:r}=e;return{customRanges:r.filter(e=>Math.max(e.startIndex,t)<=Math.min(e.endIndex,n-1)).map(e=>({...e,startIndex:Math.max(e.startIndex,t),endIndex:Math.min(e.endIndex,n-1)})).map(e=>({...e,startIndex:e.startIndex-t,endIndex:e.endIndex-t})),leftOffset:0,rightOffset:0}}function Wo(e,t,n){if(e.customDecorations==null)return;let{customDecorations:r=[]}=e,i=[];return r.forEach(e=>{if(Math.max(e.startIndex,t)<=Math.min(e.endIndex,n-1)){let r=S.deepClone(e);i.push({...r,startIndex:Math.max(r.startIndex-t,0),endIndex:Math.min(r.endIndex,n-1)-t})}}),i}function Go(e,t,n){return e==null||t==null?e==null?t:e:ko(e,t,n)}function Ko(e,t,n){if(e==null||t==null)return e==null?t:e;if(t.length===0||e.length===0)return e;if(t.length>1||e.length>1)throw Error(`Cannot cover multiple customRanges`);return n===j.REPLACE?[{...e[0]}]:[{...t[0],...e[0]}]}function qo(e,t,n){return t.length===0||e.length===0||n===j.REPLACE?e:[...e,...t.filter(t=>!e.some(e=>t.id===e.id))]}function Jo(e,t,n=j.COVER){if(t.dataStream!==``)throw Error(`Cannot compose other body with non-empty dataStream`);let r={dataStream:e.dataStream},{textRuns:i,paragraphs:a=[],customRanges:o,customDecorations:s=[]}=e,{textRuns:c,paragraphs:l=[],customRanges:u,customDecorations:d=[]}=t;r.textRuns=Go(c,i,n),r.customRanges=Ko(u,o,n);let f=qo(d,s,n);f.length&&(r.customDecorations=f);let p=[],m=0,h=0;for(;m<a.length&&h<l.length;){let e=a[m],t=l[h],{startIndex:n}=e,{startIndex:r}=t;n===r?(p.push(S.deepMerge(e,t)),m++,h++):n<r?(p.push(S.deepClone(e)),m++):(p.push(S.deepClone(t)),h++)}return m<a.length&&p.push(...a.slice(m)),h<l.length&&p.push(...l.slice(h)),p.length&&(r.paragraphs=p),r}function Yo(e){let{body:t}=e;if(t==null)return!0;let{textRuns:n,paragraphs:r,customRanges:i,customBlocks:a,customDecorations:o,tables:s}=t;return n==null&&r==null&&i==null&&a==null&&o==null&&s==null}var Xo=class{constructor(e){this._actions=e,v(this,`_index`,0),v(this,`_offset`,0)}hasNext(){return this.peekLength()<1/0}next(e){e||(e=1/0);let t=this._actions[this._index];if(t){let n=this._offset,r=t.len;return e>=r-n?(e=r-n,this._index+=1,this._offset=0):this._offset+=e,t.t===M.DELETE||t.t===M.RETAIN&&t.body==null?S.deepClone({...t,len:e}):S.deepClone({...t,len:e,body:K(t.body,n,n+e,!1)})}else return{t:M.RETAIN,len:1/0}}peek(){return this._actions[this._index]}peekLength(){return this._actions[this._index]?this._actions[this._index].len-this._offset:1/0}peekType(){let e=this._actions[this._index];return e?e.t:M.RETAIN}rest(){if(!this.hasNext())return[];if(this._offset===0)return this._actions.slice(this._index);{let e=this._offset,t=this._index,n=this.next(),r=this._actions.slice(this._index);return this._offset=e,this._index=t,[n].concat(r)}}};function Zo(e,t,n){let{dataStream:r}=e,i=n,a=n+t,o=fo(e,t,n),s=po(e,t,n),c=mo(e,t,n),l=ho(e,t,n),u=go(e,t,n),d=_o(e,t,n),f=vo(e,t,n),p=``;return r&&(e.dataStream=Zi(r,i,a),p=r.slice(i,a)),{dataStream:p,textRuns:o,paragraphs:s,sectionBreaks:c,customBlocks:l,tables:u,customRanges:d,customDecorations:f}}function Qo(e,t,n,r){e.dataStream=Xi(e.dataStream,r,t.dataStream),$a(e,t,n,r),eo(e,t,n,r),to(e,t,n,r),no(e,t,n,r),ro(e,t,n,r),lo(e,t,n,r),uo(e,t,n,r)}function $o(e,t,n,r,i=j.COVER){return Do(e,t,n,r,i)}function es(e,t,n){return t<=0?{dataStream:``}:Zo(e,t,n)}function ts(e,t,n,r){n!==0&&Qo(e,t,n,r)}function ns(e,t){let n=new dt;return n.reset(),t.forEach(t=>{let r=S.deepClone(t);switch(r.t){case M.RETAIN:{let{coverType:t,body:i,len:a}=r;i!=null&&$o(e,i,a,n.cursor,t),n.moveCursor(a);break}case M.INSERT:{let{body:t,len:i}=r;ts(e,t,i,n.cursor),n.moveCursor(i);break}case M.DELETE:{let{len:t}=r;es(e,t,n.cursor);break}default:throw Error(`Unknown action type for action: ${r}.`)}}),e}var q=function(e){return e[e.COVER=0]=`COVER`,e[e.COVER_ONLY_NOT_EXISTED=1]=`COVER_ONLY_NOT_EXISTED`,e}(q||{});function rs(e,t,n,r,i){if(e==null||t==null)return t;if(e.length===0||t.length===0)return[];t=S.deepClone(t),e=S.deepClone(e);let a=[],o=t.length,s=e.length,c=0,l=0,u=null;function d(){return u?(a.push(u),u=null,!0):!1}for(;c<o&&l<s;){let{st:o,ed:s,ts:f}=t[c],{st:p,ed:m,ts:h,sId:g}=e[l],_={};if(i===q.COVER)_={...f},n===j.COVER&&r===j.REPLACE&&h&&(_=Object.assign({},h,_));else if(_={...f},n===j.REPLACE){if(r===j.REPLACE)_={...h};else if(f&&h){let e=Object.keys(f);for(let t of e)h[t]&&delete _[t]}}else if(r===j.REPLACE){if(h){let e=Object.keys(h);for(let t of e)h[t]!==void 0&&(_[t]=h[t])}}else if(h){let e=Object.keys(h);for(let t of e)_[t]!==void 0&&delete _[t]}if(s<p)d()||a.push(t[c]),c++;else if(m<o)d()||a.push(e[l]),l++;else{let n={st:Math.min(o,p),ed:Math.max(o,p),ts:o<p?{...f}:{...h},sId:o<p?void 0:g};n.ed>n.st&&a.push(),a.push({st:Math.max(o,p),ed:Math.min(s,m),ts:_,sId:g}),s<m?(c++,e[l].st=s,e[l].st===e[l].ed&&l++):(l++,t[c].st=m,t[c].st===t[c].ed&&c++);let r={st:Math.min(s,m),ed:Math.max(s,m),ts:s<m?{...h}:{...f},sId:s<m?g:void 0};u=r.ed>r.st?r:null}}d();let f=a[a.length-1],p=t[o-1],m=e[s-1];return f.ed!==Math.max(p.ed,m.ed)&&(p.ed>m.ed?a.push(p):a.push(m)),Qa(a,!0)}function is(e,t,n,r,i){if(e==null||t==null)return t;if(e.length===0||t.length===0)return[];if(e.length>1||t.length>1)throw Error(`CustomRanges is only supported transform for length one now.`);let a=e[0],o=t[0];if(n===j.REPLACE)return i===q.COVER_ONLY_NOT_EXISTED?[S.deepClone(a)]:[S.deepClone(o)];if(r===j.REPLACE){let e=S.deepClone(o);return i===q.COVER_ONLY_NOT_EXISTED&&Object.assign(e,S.deepClone(a)),[e]}else{let e=S.deepClone(o);return i===q.COVER_ONLY_NOT_EXISTED&&Object.assign(e,S.deepClone(a)),[e]}}function as(e,t,n,r,i){let a={startIndex:t.startIndex};if(t.paragraphStyle&&(a.paragraphStyle=S.deepClone(t.paragraphStyle),e.paragraphStyle)){if(n===j.REPLACE)if(r===j.REPLACE)i===q.COVER_ONLY_NOT_EXISTED&&(a.paragraphStyle={...e.paragraphStyle});else if(i===q.COVER_ONLY_NOT_EXISTED){let t=Object.keys(e.paragraphStyle);for(let n of t)e.paragraphStyle[n]!==void 0&&(a.paragraphStyle[n]=e.paragraphStyle[n])}else{let t=Object.keys(e.paragraphStyle);for(let n of t)a.paragraphStyle[n]===void 0&&(a.paragraphStyle[n]=e.paragraphStyle[n])}else if(r===j.REPLACE)if(i===q.COVER_ONLY_NOT_EXISTED){let t=Object.keys(e.paragraphStyle);for(let n of t)e.paragraphStyle[n]!==void 0&&(a.paragraphStyle[n]=e.paragraphStyle[n])}else{let t=Object.keys(e.paragraphStyle);for(let n of t)a.paragraphStyle[n]===void 0&&(a.paragraphStyle[n]=e.paragraphStyle[n])}else if(i===q.COVER_ONLY_NOT_EXISTED){let t=Object.keys(e.paragraphStyle);for(let e of t)a.paragraphStyle[e]&&delete a.paragraphStyle[e]}}return n===j.REPLACE&&r===j.REPLACE?a.bullet=i===q.COVER_ONLY_NOT_EXISTED?S.deepClone(e.bullet):S.deepClone(t.bullet):e.bullet===void 0?a.bullet=S.deepClone(t.bullet):n===j.REPLACE||r===j.REPLACE?a.bullet=i===q.COVER&&t.bullet?S.deepClone(t.bullet):S.deepClone(e.bullet):i===q.COVER&&t.bullet!==void 0&&(a.bullet=S.deepClone(t.bullet)),a}function os(e,t){if(e==null||t==null)return t;if(e.length===0||t.length===0)return S.deepClone(t);let n=[];for(let r of t){let{id:t,type:i}=r,a=!1;for(let o of e)if(o.id===t){(o.type===bn.DELETED||i===bn.DELETED)&&(a=!0,n.push({...r,type:bn.DELETED}));break}a||n.push(r)}return n}function ss(e,t,n=!1){let{body:r,coverType:i=j.COVER}=e,{body:a,coverType:o=j.COVER}=t;if(r==null||r.dataStream!==``||a==null||a.dataStream!==``)throw Error(`Data stream is not supported in retain transform.`);let s={dataStream:``},c=o,{textRuns:l,paragraphs:u=[],customRanges:d,customDecorations:f}=r,{textRuns:p,paragraphs:m=[],customRanges:h,customDecorations:g}=a,_=rs(l,p,i,o,n?q.COVER_ONLY_NOT_EXISTED:q.COVER);_&&(s.textRuns=_);let ee=is(d,h,i,o,n?q.COVER_ONLY_NOT_EXISTED:q.COVER);ee&&(s.customRanges=ee);let te=os(f,g);te&&(s.customDecorations=te);let ne=[],re=0,ie=0;for(;re<u.length&&ie<m.length;){let e=u[re],t=m[ie],{startIndex:r}=e,{startIndex:a}=t;if(r===a){let a={startIndex:r};a=n?as(e,t,i,o,q.COVER_ONLY_NOT_EXISTED):as(e,t,i,o,q.COVER),ne.push(a),re++,ie++}else r<a?re++:(ne.push(S.deepClone(t)),ie++)}return ie<m.length&&ne.push(...m.slice(ie)),ne.length&&(s.paragraphs=ne),{coverType:c,body:s}}function cs(e){return Object.keys(e).length===1}var J=class e{constructor(){v(this,`_actions`,[])}static apply(e,t){return ns(e,t)}static compose(t,n){let r=new Xo(t),i=new Xo(n),a=new e;for(;r.hasNext()||i.hasNext();)if(i.peekType()===M.INSERT)a.push(i.next());else if(r.peekType()===M.DELETE)a.push(r.next());else{let e=Math.min(r.peekLength(),i.peekLength()),t=r.next(e),n=i.next(e);if(t.t===M.INSERT&&n.t===M.RETAIN)n.body==null?a.push(t):a.push({...t,body:Jo(t.body,n.body,n.coverType)});else if(t.t===M.RETAIN&&n.t===M.RETAIN)if(t.body==null&&n.body==null)a.push(t.len===1/0?n:t);else if(t.body&&n.body){let e=t.coverType===j.REPLACE||n.coverType===j.REPLACE?j.REPLACE:j.COVER;a.push({...t,t:M.RETAIN,coverType:e,body:Jo(t.body,n.body,n.coverType)})}else a.push(t.body?t:n);else t.t===M.RETAIN&&n.t===M.DELETE?a.push(n):t.t===M.INSERT&&(n.t,M.DELETE)}return a.trimEndUselessRetainAction(),a.serialize()}static transform(e,t,n=`right`){return this._transform(t,e,n===`left`?`right`:`left`)}static _transform(t,n,r=`right`){let i=new Xo(t),a=new Xo(n),o=new e;for(;i.hasNext()||a.hasNext();)if(i.peekType()===M.INSERT&&(r===`left`||a.peekType()!==M.INSERT)){let e=i.next();o.retain(e.len)}else if(a.peekType()===M.INSERT)o.push(a.next());else{let e=Math.min(i.peekLength(),a.peekLength()),t=i.next(e),n=a.next(e);if(t.t===M.DELETE)continue;if(n.t===M.DELETE){o.push(n);continue}if(t.body==null||n.body==null)o.push(n);else{let{coverType:e,body:i}=ss(t,n,r===`left`);o.push({...n,t:M.RETAIN,coverType:e,body:i})}}return o.trimEndUselessRetainAction(),o.serialize()}static transformPosition(e,t,n=!1){let r=new Xo(e),i=0;for(;r.hasNext()&&i<=t;){let e=r.peekLength(),a=r.peekType();if(r.next(),a===M.DELETE){t-=Math.min(e,t-i);continue}else a===M.INSERT&&(i<t||!n)&&(t+=e);i+=e}return t}static isNoop(e){return e.length===0}static invert(e){let t=[];for(let n of e)if(n.t===M.INSERT)t.push({t:M.DELETE,len:n.len,body:n.body});else if(n.t===M.DELETE){if(n.body==null)throw Error(`Can not invert DELETE action without body property, makeInvertible must be called first.`);t.push({t:M.INSERT,body:n.body,len:n.len})}else if(n.body!=null){if(n.oldBody==null)throw Error(`Can not invert RETAIN action without oldBody property, makeInvertible must be called first.`);t.push({t:M.RETAIN,body:n.oldBody,oldBody:n.body,len:n.len,coverType:j.REPLACE})}else t.push(n);return t}static makeInvertible(e,t){let n=[],r=0;for(let i of e){if(i.t===M.DELETE&&(i.body==null||i.body&&i.body.dataStream.length!==i.len)){let e=K(t,r,r+i.len,!1);i.len=e.dataStream.length,i.body=e}if(i.t===M.RETAIN&&i.body!=null){let e=K(t,r,r+i.len,!0);i.oldBody={...e,dataStream:``},i.len=e.dataStream.length}n.push(i),i.t!==M.INSERT&&(r+=i.len)}return n}insert(e,t){let n={t:M.INSERT,body:t,len:e};return this.push(n),this}retain(e,t,n){let r={t:M.RETAIN,len:e};return t!=null&&(r.body=t),n!=null&&(r.coverType=n),this.push(r),this}delete(e){let t={t:M.DELETE,len:e};return this.push(t),this}empty(){return this._actions=[],this}serialize(){return this._actions}push(...e){if(e.length>1){for(let t of e)this.push(t);return this}let t=this._actions.length,n=this._actions[t-1],r=S.deepClone(e[0]);if(r.t===M.RETAIN&&r.len===0&&r.body==null)return this;if(typeof n==`object`){if(n.t===M.DELETE&&r.t===M.DELETE)return n.len+=r.len,this;if(n.t===M.DELETE&&r.t===M.INSERT&&(--t,n=this._actions[t-1],n==null))return this._actions.unshift(r),this;if(n.t===M.RETAIN&&r.t===M.RETAIN&&n.body==null&&r.body==null)return n.len+=r.len,this;if(n.t===M.INSERT&&cs(n.body)&&r.t===M.INSERT&&cs(r.body))return n.len+=r.len,n.body.dataStream+=r.body.dataStream,this}return t===this._actions.length?this._actions.push(r):this._actions.splice(t,0,r),this}trimEndUselessRetainAction(){let e=this._actions[this._actions.length-1];for(;e&&e.t===M.RETAIN&&Yo(e);)this._actions.pop(),e=this._actions[this._actions.length-1];return this}};v(J,`id`,`text-x`),v(J,`uri`,`https://github.com/dream-num/univer#text-x`),Object.defineProperty(J,`name`,{value:`text-x`});var Y=class e{static registerSubtype(e){var t;e==null||this._subTypes.has(e.name)&&((t=this._subTypes.get(e.name))==null?void 0:t.id)!==J.id||(this._subTypes.set(e.name,e),m.type.registerSubtype(e))}static apply(e,t){if(!m.type.isNoop(t))return m.type.apply(e,t)}static compose(e,t){return m.type.compose(e,t)}static transform(e,t,n){return m.type.transform(e,t,n)}static transformPosition(e,t,n=`right`){return e&&e.length===2&&e[0]===`body`&&e[1].et===J.name?J.transformPosition(e[1].e,t,n===`left`):t}static invertWithDoc(e,t){return m.type.invertWithDoc(e,t)}static isNoop(e){return m.type.isNoop(e)}static getInstance(){return this._instance==null&&(this._instance=new e),this._instance}removeOp(e,t){return m.removeOp(e,t)}moveOp(e,t){return m.moveOp(e,t)}insertOp(e,t){return m.insertOp(e,t)}replaceOp(e,t,n){return m.replaceOp(e,t,n)}editOp(e,t=[`body`]){return m.editOp(t,J.name,e)}};v(Y,`uri`,`https://github.com/dream-num/univer#json-x`),v(Y,`_subTypes`,new Map),v(Y,`_instance`,null),Y.registerSubtype(J);let ls=function(e){return 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}({}),X=function(e){return 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}({});function us(e){return`${e}`}const ds=[X.TABLE_START,X.TABLE_ROW_START,X.TABLE_CELL_START,X.TABLE_CELL_END,X.TABLE_ROW_END,X.TABLE_END],fs=e=>{let t=e.endsWith(`\r
5
+ `)?e.slice(0,-2):e;return ds.reduce((e,t)=>e.replaceAll(t,``),t)},ps=e=>e?fs(e).replaceAll(`\r`,``)===``:!0,ms=e=>{let t=e.replace(/\n/g,`\r`),n=[],r=[],i=0,a=``,o=(o,s=!0)=>{let c=t.slice(i,o);if(S.isLegalUrl(c)){let t=C(),l=`${c}`,u={startIndex:i,endIndex:i+l.length-1,rangeId:t,rangeType:yn.HYPERLINK,properties:{url:e}};r.push(u),a+=l,i=o+1,s&&(a+=`\r`,n.push({startIndex:o}))}else a+=t.slice(i,o+1),i=o+1,s&&n.push({startIndex:o})},s=0;for(let e=0;e<t.length;e++)t[e]===`\r`&&(o(e),s=e);return(s!==t.length-1||t.length===1)&&o(t.length,!1),{dataStream:a,paragraphs:n,customRanges:r}},hs={id:`default_doc`,documentStyle:{}};var gs=class extends Et{getUnitId(){throw Error(`Method not implemented.`)}constructor(e){var t;super(),v(this,`type`,f.UniverType.UNIVER_DOC),v(this,`_name$`,new d.BehaviorSubject(``)),v(this,`name$`,this._name$.asObservable()),v(this,`snapshot`,void 0),this.snapshot={...hs,...e},this._name$.next((t=this.snapshot.title)==null?`No Title`:t)}getRev(){var e;return(e=this.snapshot.rev)==null?1:e}incrementRev(){this.snapshot.rev=this.getRev()+1}setRev(e){this.snapshot.rev=e}setName(e){this.snapshot.title=e,this._name$.next(e)}get drawings(){return this.snapshot.drawings}get documentStyle(){return this.snapshot.documentStyle}get lists(){return this.snapshot.lists}get zoomRatio(){var e;return((e=this.snapshot.settings)==null?void 0:e.zoomRatio)||1}resetDrawing(e,t){this.snapshot.drawings=e,this.snapshot.drawingsOrder=t}getBody(){return this.snapshot.body}getSnapshot(){return this.snapshot}getBulletPresetList(){var e;let t=(e=this.snapshot.lists)==null?{}:e;return{...Co,...t}}updateDocumentId(e){this.snapshot.id=e}updateDocumentRenderConfig(e){let{documentStyle:t}=this.snapshot;t.renderConfig==null?t.renderConfig=e:t.renderConfig={...t.renderConfig,...e}}getDocumentStyle(){return this.snapshot.documentStyle}updateDocumentStyle(e){this.snapshot.documentStyle==null?this.snapshot.documentStyle=e:this.snapshot.documentStyle={...this.snapshot.documentStyle,...e}}updateDocumentDataMargin(e){let{t,l:n,b:r,r:i}=e,{documentStyle:a}=this.snapshot;t!=null&&(a.marginTop=t),n!=null&&(a.marginLeft=n),r!=null&&(a.marginBottom=r),i!=null&&(a.marginRight=i)}updateDocumentDataPageSize(e,t){let{documentStyle:n}=this.snapshot;if(!n.pageSize){n.pageSize={width:e==null?1/0:e,height:t==null?1/0:t};return}e!==void 0&&(n.pageSize.width=e),t!==void 0&&(n.pageSize.height=t)}updateDrawing(e,t){let{drawings:n}=this,{width:r,height:i,left:a,top:o}=t,s=n==null?void 0:n[e];if(!s)return;let c=s.docTransform;c.size.width=r,c.size.height=i,c.positionH.posOffset=a,c.positionV.posOffset=o}setZoomRatio(e=1){this.snapshot.settings?this.snapshot.settings.zoomRatio=e:this.snapshot.settings={zoomRatio:e}}setDisabled(e){this.snapshot.disabled=e}getDisabled(){return this.snapshot.disabled}getTitle(){return this.snapshot.title}},_s=class e extends gs{constructor(e){var t,n;super(S.isEmptyObject(e)?sr():e),v(this,`_unitId`,void 0),v(this,`headerModelMap`,new Map),v(this,`footerModelMap`,new Map),v(this,`change$`,new d.BehaviorSubject(0)),this._unitId=(t=this.snapshot.id)==null?C(6):t,this._initializeHeaderFooterModel(),this._name$.next((n=this.snapshot.title)==null?``:n)}dispose(){super.dispose(),this.headerModelMap.forEach(e=>{e.dispose()}),this.footerModelMap.forEach(e=>{e.dispose()}),this._name$.complete()}getDrawings(){return this.snapshot.drawings}getDrawingsOrder(){return this.snapshot.drawingsOrder}getCustomRanges(){var e;return(e=this.snapshot.body)==null?void 0:e.customRanges}getCustomDecorations(){var e;return(e=this.snapshot.body)==null?void 0:e.customDecorations}getSettings(){return this.snapshot.settings}reset(e){if(e.id&&e.id!==this._unitId)throw Error(`Cannot reset a document model with a different unit id!`);this.snapshot={...hs,...e},this._initializeHeaderFooterModel(),this.change$.next(this.change$.value+1)}getSelfOrHeaderFooterModel(e){if(e!=null){if(this.headerModelMap.has(e))return this.headerModelMap.get(e);if(this.footerModelMap.has(e))return this.footerModelMap.get(e)}return this}getUnitId(){return this._unitId}apply(e){if(!Y.isNoop(e))return this.snapshot=Y.apply(this.snapshot,e),e!=null&&e.some(e=>Array.isArray(e)&&((e==null?void 0:e[0])===`headers`||(e==null?void 0:e[0])===`footers`))&&(this.headerModelMap.clear(),this.footerModelMap.clear(),this._initializeHeaderFooterModel()),this.change$.next(this.change$.value+1),this.snapshot}sliceBody(e,t,n=Io.copy){let r=this.getBody();if(r!=null)return K(r,e,t,!1,n)}_initializeHeaderFooterModel(){let{headers:t,footers:n}=this.getSnapshot();if(t)for(let n in t){let r=t[n];this.headerModelMap.set(n,new e(r)),this.headerModelMap.get(n).updateDocumentId(this.getUnitId())}if(n)for(let t in n){let r=n[t];this.footerModelMap.set(t,new e(r)),this.footerModelMap.get(t).updateDocumentId(this.getUnitId())}}updateDocumentId(e){super.updateDocumentId(e),this._unitId=e}getPlainText(){var e,t;return fs((e=(t=this.getBody())==null?void 0:t.dataStream)==null?``:e)}};function vs(e){let{ranges:t,id:n,type:r}=e,i=new J,a=0;for(let e=0;e<t.length;e++){let{startOffset:o,endOffset:s}=t[e];o>0&&i.push({t:M.RETAIN,len:o-a}),i.push({t:M.RETAIN,body:{dataStream:``,customDecorations:[{id:n,type:r,startIndex:0,endIndex:s-o-1}]},len:s-o}),a=s}return i}function ys(e){var t;let{id:n,segmentId:r,documentDataModel:i}=e,a=i==null?void 0:i.getBody();if(!i||!a)return!1;let o=(t=i.getSelfOrHeaderFooterModel(r))==null||(t=t.getBody())==null||(t=t.customDecorations)==null?void 0:t.find(e=>e.id===n);if(!o)return!1;let s=new J,{startIndex:c,endIndex:l}=o,u=l-c+1;return s.push({t:M.RETAIN,len:c}),s.push({t:M.RETAIN,len:u,body:{dataStream:``,customDecorations:[{startIndex:0,endIndex:u-1,id:n,type:bn.DELETED}]}}),s}function bs(e,t,n,r){return e<=n&&t>=n||e>=n&&e<=r}function xs(e,t){let n=[];for(let r=0,i=t.length;r<i;r++){let i=t[r];e.collapsed?i.startIndex<e.startOffset&&e.startOffset<=i.endIndex&&n.push(i):bs(e.startOffset,e.endOffset-1,i.startIndex,i.endIndex)&&n.push(i)}return n}function Ss(e){return{...S.deepClone(e),rangeId:C()}}function Cs(e,t){let n=[],r=e[0];for(let i of t)i<e[0]||i>e[1]||(r<i&&n.push([r,i-1]),r=i+1);return r<=e[1]&&n.push([r,e[1]]),n}function ws(e,t,n,r){let i=[];for(let a=0,o=n.length;a<o;a++){let o=n[a];if((r===void 0||o.rangeType===r)&&Math.max(o.startIndex,e)<=Math.min(o.endIndex,t)&&i.push({...o}),o.startIndex>t)break}return i}function Ts(e,t){var n,r,i,a,o;let s=ws(e.startOffset,e.collapsed?e.startOffset:e.endOffset-1,(n=t.customRanges)==null?[]:n),c=Math.min(e.startOffset,(r=(i=s[0])==null?void 0:i.startIndex)==null?1/0:r),l=Math.max(e.endOffset,((a=(o=s[s.length-1])==null?void 0:o.endIndex)==null?-1/0:a)+1);return{startOffset:c,endOffset:l,collapsed:c===l}}function Es(e){var t,n;let{rangeId:r,segmentId:i,documentDataModel:a,insert:o}=e,s=(t=a.getSelfOrHeaderFooterModel(i).getBody())==null||(t=t.customRanges)==null?void 0:t.find(e=>e.rangeId===r);if(!s)return!1;let{startIndex:c,endIndex:l}=s,u=new J,d=l-c+1;u.push({t:M.RETAIN,len:c}),u.push({t:M.RETAIN,len:d,body:{dataStream:``,customRanges:[]}}),o&&u.push({t:M.INSERT,body:o,len:o.dataStream.length});let f=l+1+((n=o==null?void 0:o.dataStream.length)==null?0:n);return u.selections=[{startOffset:f,endOffset:f,collapsed:!0}],u}function Ds(e){let{ranges:t,rangeId:n,rangeType:r,wholeEntity:i,properties:a,body:o}=e,s=0,c=new J,l=!1;return t.forEach(e=>{var t,u,d;let f=Ts(e,o);if(!f||!o)return!1;let{startOffset:p,endOffset:m}=f,h=(t=o.customRanges)==null?[]:t,g=(e,t,o)=>{var l,u,d,f;let p=ws(e,t,h,r),m=Math.min((l=(u=p[0])==null?void 0:u.startIndex)==null?1/0:l,e),g=Math.max((d=(f=p[p.length-1])==null?void 0:f.endIndex)==null?-1/0:d,t),_={rangeId:o?`${n}$${o}`:n,rangeType:r,startIndex:0,endIndex:g-m,wholeEntity:i,properties:{...a}};c.push({t:M.RETAIN,len:m-s}),c.push({t:M.RETAIN,len:g-m+1,body:{dataStream:``,customRanges:[_]},coverType:j.COVER}),s=g+1},_=((u=o.paragraphs)==null?[]:u).filter(e=>e.startIndex<m&&e.startIndex>p),ee=((d=o.customBlocks)==null?[]:d).filter(e=>e.startIndex<m&&e.startIndex>p);Cs([p,m-1],[..._.map(e=>e.startIndex),...ee.map(e=>e.startIndex)]).forEach(([e,t],n)=>g(e,t,n)),l=!0,c.selections=[{startOffset:f.endOffset,endOffset:f.endOffset,collapsed:!0}]}),l?c:!1}function Os(e,t,n=0,r=null,i=!0){e.sort((e,t)=>e.startOffset-t.startOffset);let a=[],{paragraphs:o=[]}=t,s=o==null?void 0:o.find(t=>t.startIndex>=e[0].startOffset&&t.startIndex<e[0].endOffset),c=n;if(e.forEach(e=>{let{startOffset:t,endOffset:n}=e;t>c&&(a.push({t:M.RETAIN,len:t-c}),c=t),c<n&&(a.push({t:M.DELETE,len:n-c}),c=n)}),r&&a.push({t:M.INSERT,body:r,len:r.dataStream.length}),s&&i){let t=o.find(t=>t.startIndex-n>=e[e.length-1].endOffset-1);t&&(t.startIndex>c&&(a.push({t:M.RETAIN,len:t.startIndex-c}),c=t.startIndex),a.push({t:M.RETAIN,len:1,body:{dataStream:``,paragraphs:[{...t,startIndex:0,bullet:s==null?void 0:s.bullet}]},coverType:j.REPLACE}))}return a}function ks(e,t,n=0){let r=[],i=n;return e.forEach(e=>{let{startOffset:n,endOffset:a}=e;n>i&&(r.push({t:M.RETAIN,len:n-i}),i=n),a>i&&(r.push({t:M.RETAIN,len:a-i,body:{...S.deepClone(t),dataStream:``}}),i=a)}),r}const As=e=>{var t;let{selection:n,body:r,doc:i}=e,a=n.segmentId,o=(t=i.getSelfOrHeaderFooterModel(a))==null?void 0:t.getBody();if(!o)return!1;let s=n.collapsed?null:K(o,n.startOffset,n.endOffset),c=(0,le.default)(s?s.dataStream:``,r.dataStream),l=0,u=c.map(([e,t])=>{switch(e){case 0:{let e={t:M.RETAIN,body:{...K(r,l,l+t.length,!1),dataStream:``},len:t.length};return l+=t.length,e}case 1:{let e={t:M.INSERT,body:K(r,l,l+t.length),len:t.length};return l+=t.length,e}default:return{t:M.DELETE,len:t.length}}}),d=new J;return d.push({t:M.RETAIN,len:n.startOffset}),d.push(...u),d};function js(e,t){return!!((e==null?void 0:e.length)===(t==null?void 0:t.length)&&e!=null&&e.every((e,n)=>JSON.stringify(e)===JSON.stringify(t==null?void 0:t[n])))}const Ms=e=>{var t;let{selection:n,body:r,doc:i,themeService:a}=e,o=n.segmentId,s=(t=i.getSelfOrHeaderFooterModel(o))==null?void 0:t.getBody();if(!s)return!1;let c=n.collapsed?null:K(s,n.startOffset,n.endOffset),l=(0,le.default)(c?c.dataStream:``,r.dataStream),u=0,d=l.map(([e,t])=>{switch(e){case 0:{let e=Lo(r,u,u+t.length,!1),n=Lo(c,u,u+t.length,!1),i={t:M.RETAIN,body:js(e,n)?void 0:{textRuns:e==null?void 0:e.map(e=>{var t,n,r,i;return{...e,ts:{...e.ts,cl:!((t=e.ts)==null||(t=t.cl)==null||(t=t.rgb)==null)&&t.includes(`.`)?{rgb:a.getColorFromTheme((n=(r=e.ts)==null||(r=r.cl)==null?void 0:r.rgb)==null?``:n)}:(i=e.ts)==null?void 0:i.cl}}}),dataStream:``},len:t.length};return u+=t.length,i}case 1:{let e={t:M.INSERT,body:K(r,u,u+t.length),len:t.length};return u+=t.length,e}default:return{t:M.DELETE,len:t.length}}});if(d.every(e=>e.t===M.RETAIN&&!e.body))return!1;let f=new J;return f.push({t:M.RETAIN,len:n.startOffset}),f.push(...d),f};function Ns(e,t){let n=[],{customBlocks:r=[]}=e;for(let e of t){let{startOffset:t,endOffset:i}=e;if(!(t==null||i==null))for(let e of r){let{startIndex:r}=e;r>=t&&r<i&&n.push(e.blockId)}}return n}function Ps(e,t=``){if(!t)return[`body`];let{headers:n,footers:r}=e.getSnapshot();if(n==null&&r==null)throw 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 Error(`Segment id not found in headers or footers`)}const Fs=e=>{var t,n;let{selection:r,documentDataModel:i,drawings:a}=e,{collapsed:o,startOffset:s,segmentId:c}=r,l=new J,u=Y.getInstance(),d=[],f=i.getSelfOrHeaderFooterModel(c).getBody();if(!f)return!1;let p=(t=(n=i.getSnapshot().drawingsOrder)==null?void 0:n.length)==null?0:t,m=0;if(o)s>0&&l.push({t:M.RETAIN,len:s});else{var h,g;let e=Os([r],f,0,null,!1);l.push(...e);let t=Ns(f,[r]),n=(h=i.getDrawings())==null?{}:h,a=(g=i.getDrawingsOrder())==null?[]:g,o=t.sort((e,t)=>a.indexOf(e)>a.indexOf(t)?-1:a.indexOf(e)<a.indexOf(t)?1:0);if(o.length>0)for(let e of o){let t=n[e],r=a.indexOf(e);if(t==null||r<0)continue;let i=u.removeOp([`drawings`,e],t),o=u.removeOp([`drawingsOrder`,r],e);d.push(i),d.push(o),m++}}l.push({t:M.INSERT,body:{dataStream:`\b`.repeat(a.length),customBlocks:a.map((e,t)=>({startIndex:t,blockId:e.drawingId}))},len:a.length});let _=Ps(i,c),ee=u.editOp(l.serialize(),_);d.push(ee);for(let e of a){let{drawingId:t}=e,n=u.insertOp([`drawings`,t],e),r=u.insertOp([`drawingsOrder`,p-m],t);d.push(n),d.push(r)}return d.reduce((e,t)=>Y.compose(e,t),null)};function Is(e,t){if(t===void 0)return{startOffset:e,endOffset:e,collapsed:!0};if(t<e)throw Error(`Cannot make a doc selection when endOffset ${t} is less than startOffset ${e}.`);return{startOffset:e,endOffset:t,collapsed:e===t}}function Ls(e){let{startOffset:t,endOffset:n,collapsed:r}=e;return{startOffset:Math.min(t,n),endOffset:Math.max(t,n),collapsed:r}}function Rs(e,t,n,r){return Math.max(e,n)<=Math.min(t,r)}function zs(e,t,n,r){let{startOffset:i,endOffset:a}=e,o=r==null?Hs(t,n):r,s=[],c=-1;for(let e=0;e<o.length;e++){let t=o[e],{startIndex:n}=t;(i>c&&i<=n||a>c&&a<=n||n>=i&&n<=a)&&s.push(t),c=n}return s}function Bs(e,t,n){let r=[],i=Hs(t,n);for(let a of e){let e=zs(a,t,n,i);r.push(...e)}return r}const Vs=[X.PARAGRAPH,X.TABLE_START,X.TABLE_END,X.TABLE_ROW_START,X.TABLE_CELL_START,X.TABLE_CELL_END];function Hs(e,t){let n=[];for(let r=0;r<e.length;r++){let i=e[r],{startIndex:a}=i,o=a-1;for(;!Vs.includes(t[o])&&o>=0;)o--;n.push({...i,paragraphStart:o+1,paragraphEnd:i.startIndex})}return n}const Us=e=>{var t,n;let{paragraphs:r,segmentId:i,document:a}=e,o=e.listType,s=(t=(n=a.getSelfOrHeaderFooterModel(i).getBody())==null?void 0:n.paragraphs)==null?[]:t,c=r.every(e=>{var t;return((t=e.bullet)==null?void 0:t.listType.indexOf(o))===0}),l=C(6);if(r.length===1){let e=s.indexOf(r[0]),t=s[e-1],n=s[e+1];t&&t.bullet&&t.bullet.listType.indexOf(o)===0?(l=t.bullet.listId,o!==G.CHECK_LIST&&(o=t.bullet.listType)):n&&n.bullet&&n.bullet.listType.indexOf(o)===0&&(l=n.bullet.listId,o!==G.CHECK_LIST&&(o=n.bullet.listType))}let u=new dt;u.reset();let d=new J;for(let e of r){var f;let{startIndex:t,paragraphStyle:n={},bullet:r}=e;d.push({t:M.RETAIN,len:t-u.cursor}),d.push({t:M.RETAIN,len:1,body:{dataStream:``,paragraphs:[c?{paragraphStyle:n,startIndex:0}:{startIndex:0,paragraphStyle:{...n},bullet:{nestingLevel:(f=r==null?void 0:r.nestingLevel)==null?0:f,textStyle:{fs:20},listType:o,listId:l}}]},coverType:j.REPLACE}),u.moveCursorTo(t+1)}return d},Ws=e=>{var t;let{paragraphIndex:n,segmentId:r,document:i}=e,a=(t=i.getSelfOrHeaderFooterModel(r).getBody())==null?void 0:t.paragraphs;if(a==null)return!1;let o=a.find(e=>e.startIndex===n);if(!(o!=null&&o.bullet)||o.bullet.listType.indexOf(G.CHECK_LIST)===-1)return!1;let s=new dt;s.reset();let c=new J,{startIndex:l,paragraphStyle:u={}}=o,d=o.bullet.listType===G.CHECK_LIST?G.CHECK_LIST_CHECKED:G.CHECK_LIST;return c.push({t:M.RETAIN,len:l-s.cursor}),c.push({t:M.RETAIN,len:1,body:{dataStream:``,paragraphs:[{...o,paragraphStyle:u,startIndex:0,bullet:{...o.bullet,listType:d}}]},coverType:j.REPLACE}),s.moveCursorTo(l+1),c},Gs=e=>{var t;let{paragraphs:n,listType:r,segmentId:i,document:a}=e;if(((t=a.getSelfOrHeaderFooterModel(i).getBody())==null?void 0:t.paragraphs)==null)return!1;let o=C(6),s=new dt;s.reset();let c=new J;for(let e of n){var l;let{startIndex:t,paragraphStyle:n={},bullet:i}=e;c.push({t:M.RETAIN,len:t-s.cursor}),c.push({t:M.RETAIN,len:1,body:{dataStream:``,paragraphs:[{startIndex:0,paragraphStyle:n,bullet:{nestingLevel:(l=i==null?void 0:i.nestingLevel)==null?0:l,textStyle:(i==null?void 0:i.listType)===r?i.textStyle:{fs:20},listType:r,listId:o}}]},coverType:j.REPLACE}),s.moveCursorTo(t+1)}return c};function Ks(e,t){return t.some(t=>e.startIndex>t.startIndex&&e.startIndex<t.endIndex)}const qs=e=>{var t,n,r;let{paragraphs:i,document:a,type:o}=e,s=new dt;s.reset();let c=new J,l=(t=a.getSnapshot().lists)==null?{}:t,u=(n=(r=a.getBody())==null?void 0:r.tables)==null?[]:n,d={...Co,...l};for(let e of i){let{startIndex:t,paragraphStyle:n={},bullet:r}=e,i=Ks(e,u);if(c.push({t:M.RETAIN,len:t-s.cursor}),r){let e=d[r.listType].nestingLevel.length-1;i&&(e=Math.min(e,2)),c.push({t:M.RETAIN,len:1,body:{dataStream:``,paragraphs:[{startIndex:0,paragraphStyle:{...n},bullet:{...r,nestingLevel:Math.max(Math.min(r.nestingLevel+o,e),0)}}]},coverType:j.REPLACE})}else c.push({t:M.RETAIN,len:1});s.moveCursorTo(t+1)}return c},Js=e=>{var t,n,r,i;let{textRanges:a,segmentId:o,document:s,style:c,paragraphTextRun:l,cursor:u,deleteLen:d,textX:f}=e,p=s.getSelfOrHeaderFooterModel(o),m=Bs(a,(t=(n=p.getBody())==null?void 0:n.paragraphs)==null?[]:t,(r=(i=p.getBody())==null?void 0:i.dataStream)==null?``:r),h=new dt;u&&h.moveCursorTo(u);let g=f==null?new J:f;m.sort((e,t)=>e.startIndex-t.startIndex);let _=Math.max(0,m[0].paragraphStart-1);_>h.cursor&&(g.push({t:M.RETAIN,len:_-h.cursor}),h.moveCursorTo(_)),d&&g.push({t:M.DELETE,len:d});for(let e of m){let{startIndex:t,paragraphStyle:n={}}=e,r=t-h.cursor;g.push({t:M.RETAIN,len:r,...l?{body:{dataStream:``,textRuns:[{ts:l,st:0,ed:r}]},coverType:j.REPLACE}:null}),g.push({t:M.RETAIN,len:1,body:{dataStream:``,paragraphs:[{startIndex:0,paragraphStyle:{...n,...c}}]},coverType:j.REPLACE}),h.moveCursorTo(t+1)}return g};var Z=class{};v(Z,`customRange`,{add:Ds,delete:Es,copyCustomRange:Ss,getCustomRangesInterestsWithSelection:xs,isIntersecting:bs}),v(Z,`customDecoration`,{add:vs,delete:ys}),v(Z,`selection`,{replace:As,makeSelection:Is,normalizeSelection:Ls,delete:Os,replaceTextRuns:Ms,retain:ks}),v(Z,`range`,{isIntersects:Rs,getParagraphsInRange:zs,getParagraphsInRanges:Bs}),v(Z,`transform`,{getPlainText:fs,fromPlainText:ms,isEmptyDocument:ps}),v(Z,`paragraph`,{bullet:{set:Gs,switch:Us,toggleChecklist:Ws,changeNestLevel:qs},style:{set:Js},util:{transform:Hs,getParagraphsInRange:zs,getParagraphsInRanges:Bs}}),v(Z,`drawing`,{add:Fs});function Ys(e,t,n,r){if(t===``)return e;let i=new _s({id:`mock-id`,body:e,documentStyle:{}}),a=t.length,o;for(;(o=(r?i.getBody().dataStream:i.getBody().dataStream.toLowerCase()).indexOf(t))>=0;){let e=new J,t=Y.getInstance();if(o>0&&e.retain(o),n.length>0){var s;let t=i.sliceBody(o,o+a),r={dataStream:n};Array.isArray(t==null?void 0:t.textRuns)&&t.textRuns.length&&(r.textRuns=[{...t.textRuns[0],st:0,ed:n.length}]),!(t==null||(s=t.customRanges)==null)&&s.length&&(r.customRanges=[{...t.customRanges[0],startIndex:0,endIndex:n.length-1}]),e.insert(n.length,r)}e.delete(a),i.apply(t.editOp(e.serialize()))}let c=i.getBody();return i.dispose(),c}function Xs(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 Zs(e){var t;return e.body=Xs((t=e.body)==null?{dataStream:``}:t),e.drawingsOrder||(e.drawingsOrder=[]),e.drawings||(e.drawings={}),e.documentStyle||(e.documentStyle={}),e}var Qs=class e{static create(t={}){return new e(t)}constructor(e={}){v(this,`_style`,void 0),this._style=e}get fontFamily(){return this._style.ff}get fontSize(){return this._style.fs}get italic(){return this._style.it===E.TRUE}get bold(){return this._style.bl===E.TRUE}get underline(){return this._style.ul&&ec.create(this._style.ul)}get bottomBorderLine(){return this._style.bbl&&ec.create(this._style.bbl)}get strikethrough(){return this._style.st&&ec.create(this._style.st)}get overline(){return this._style.ol&&ec.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 $s.create(S.deepClone(this._style))}getValue(){return{...this._style}}},$s=class e extends Qs{static create(t={}){return new e(t)}constructor(e={}){super(e)}setFontFamily(e){return this._style.ff=e,this}setFontSize(e){return this._style.fs=e,this}setItalic(e){return this._style.it=e?1:0,this}setBold(e){return this._style.bl=e?1:0,this}setUnderline(e){return this._style.ul=e.build(),this}setBottomBorderLine(e){return this._style.bbl=e.build(),this}setStrikethrough(e){return this._style.st=e.build(),this}setOverline(e){return this._style.ol=e.build(),this}setBackground(e){return this._style.bg=e,this}setBorder(e){return this._style.bd=e,this}setColor(e){return this._style.cl=e,this}setVerticalAlign(e){return this._style.va=e,this}copy(){return e.create(S.deepClone(this._style))}build(){return this.getValue()}},ec=class e{static create(t={s:1}){return new e(t)}constructor(e={s:1}){v(this,`_decoration`,void 0),this._decoration=e}get show(){return this._decoration.s===E.TRUE}get followFontColor(){return this._decoration.c===E.TRUE}get color(){return this._decoration.cl}get type(){return this._decoration.t}setShow(e){return this._decoration.s=e?1:0,this}setFollowFontColor(e){return this._decoration.c=e?1:0,this}setColor(e){return this._decoration.cl=e,this}setLineType(e){return this._decoration.t=e,this}copy(){return e.create(S.deepClone(this._decoration))}build(){return{...this._decoration}}},tc=class e{static create(t={}){return new e(t)}constructor(e={}){v(this,`_style`,void 0),this._style=e}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===E.TRUE}get keepNext(){return this._style.keepNext===E.TRUE}get wordWrap(){return this._style.wordWrap===E.TRUE}get widowControl(){return this._style.widowControl===E.TRUE}get shading(){return this._style.shading}get suppressHyphenation(){return this._style.suppressHyphenation===E.TRUE}copy(){return nc.create(S.deepClone(this._style))}getValue(){return this._style}},nc=class e extends tc{static create(t={}){return new e(t)}constructor(e={}){super(e)}setIndentFirstLine(e){return this._style.indentFirstLine=e,this}setHanging(e){return this._style.hanging=e,this}setIndentStart(e){return this._style.indentStart=e,this}setTabStops(e){return this._style.tabStops=e,this}setIndentEnd(e){return this._style.indentEnd=e,this}setTextStyle(e){return this._style.textStyle=e,this}setHeadingId(e){return this._style.headingId=e,this}setNamedStyleType(e){return this._style.namedStyleType=e,this}setHorizontalAlign(e){return this._style.horizontalAlign=e,this}setLineSpacing(e){return this._style.lineSpacing=e,this}setDirection(e){return this._style.direction=e,this}setSpacingRule(e){return this._style.spacingRule=e,this}setSnapToGrid(e){return this._style.snapToGrid=e?1:0,this}setSpaceAbove(e){return this._style.spaceAbove=e,this}setSpaceBelow(e){return this._style.spaceBelow=e,this}setBorderBetween(e){return this._style.borderBetween=e,this}setBorderTop(e){return this._style.borderTop=e,this}setBorderBottom(e){return this._style.borderBottom=e,this}setBorderLeft(e){return this._style.borderLeft=e,this}setBorderRight(e){return this._style.borderRight=e,this}setKeepLines(e){return this._style.keepLines=e?1:0,this}setKeepNext(e){return this._style.keepNext=e?1:0,this}setWordWrap(e){return this._style.wordWrap=e?1:0,this}setWidowControl(e){return this._style.widowControl=e?1:0,this}setShading(e){return this._style.shading=e,this}setSuppressHyphenation(e){return this._style.suppressHyphenation=e?1:0,this}copy(){return e.create(S.deepClone(this._style))}build(){return this.getValue()}},rc=class e{static create(t){return new e(t)}static createByBody(t){return new e({body:t,id:`d`,documentStyle:{}})}constructor(e){if(v(this,`_data`,void 0),!e.body)throw Error(`Invalid document data, body is required`);this._data=Zs(e)}copy(){return ic.create(S.deepClone(this._data))}slice(e,t){let{body:n,...r}=this._data;return ic.create({...S.deepClone(r),body:K(n,e,t)})}toPlainText(){var e,t;return Z.transform.getPlainText((e=(t=this._data.body)==null?void 0:t.dataStream)==null?``:e).replaceAll(`\r`,`
6
+ `)}getParagraphStyle(){var e;return tc.create((e=this._data.body)==null||(e=e.paragraphs)==null?void 0:e[0].paragraphStyle)}getParagraphBullet(){var e;return(e=this._data.body)==null||(e=e.paragraphs)==null?void 0:e[0].bullet}getParagraphs(){var e,t;let n=(e=(t=this._data.body)==null?void 0:t.paragraphs)==null?[]:e,r=0;return n.map(e=>{let t=this.slice(r,e.startIndex);return r=e.startIndex,t})}getTextRuns(){var e,t;return((e=(t=this._data.body)==null?void 0:t.textRuns)==null?[]:e).map(e=>({...e,ts:e.ts?Qs.create(e.ts):null}))}getLinks(){var e,t;return(e=(t=this._data.body)==null||(t=t.customRanges)==null?void 0:t.filter(e=>e.rangeType===yn.HYPERLINK))==null?[]:e}getData(){return this._data}},ic=class e extends rc{static newEmptyData(){return Zs({id:`d`,documentStyle:{},drawings:{},drawingsOrder:[],body:{dataStream:`\r
7
+ `,customBlocks:[],customRanges:[],paragraphs:[{startIndex:0}],textRuns:[],tables:[],sectionBreaks:[]}})}static create(t){return new e(t==null?e.newEmptyData():t)}constructor(e){super(e),v(this,`_doc`,void 0),this._doc=new _s(e)}insertText(e,t,n){var r,i;let a=((r=(i=this._data.body)==null?void 0:i.dataStream.length)==null?2:r)-2,o,s;if(typeof e==`string`?o=e:(a=Math.min(e,a),o=t),s=typeof t==`object`?t instanceof $s?t.build():t:n instanceof $s?n.build():n,!o)return this;let c={dataStream:o,textRuns:s?[{ts:s,st:a,ed:a+o.length}]:[]},l=Z.selection.replace({doc:this._doc,selection:{startOffset:a,endOffset:a,collapsed:!0},body:c});if(!l)throw Error(`Insert text failed, please check.`);return J.apply(this._doc.getBody(),l.serialize()),this}insertRichText(e,t){var n,r;let i=((n=(r=this._data.body)==null?void 0:r.dataStream.length)==null?2:n)-2,a;typeof e==`object`?a=e instanceof rc?e.getData():e:(i=Math.min(e,i),a=t instanceof rc?t.getData():t);let o=Z.selection.replace({doc:this._doc,selection:{startOffset:i,endOffset:i,collapsed:!0},body:a.body});if(!o)throw Error(`Insert text failed, please check.`);return J.apply(this._doc.getBody(),o.serialize()),this}delete(e,t){if(t!==void 0){if(!t)return this;let n=Z.selection.delete([{startOffset:e,endOffset:e+t,collapsed:!0}],this._data.body);J.apply(this._doc.getBody(),n)}return this}setStyle(e,t,n){let r={dataStream:``,textRuns:[{ts:n instanceof $s?n.build():n,st:0,ed:t-e}]},i=Z.selection.retain([{startOffset:e,endOffset:t,collapsed:!0}],r);return J.apply(this._doc.getBody(),i),this}setLink(e,t,n){let r=Z.customRange.add({rangeType:yn.HYPERLINK,rangeId:C(),properties:{url:n},ranges:[{startOffset:e,endOffset:t,collapsed:!1}],body:this._data.body});if(!r)throw Error(`Insert text failed, please check.`);return J.apply(this._doc.getBody(),r.serialize()),this}cancelLink(e,t){if(typeof e==`string`){let t=Z.customRange.delete({rangeId:e,documentDataModel:this._doc});if(!t)throw Error(`Insert text failed, please check.`);J.apply(this._doc.getBody(),t.serialize())}else this.slice(e,t).getLinks().forEach(e=>{let t=Z.customRange.delete({rangeId:e.rangeId,documentDataModel:this._doc});if(!t)throw Error(`Insert text failed, please check.`);J.apply(this._doc.getBody(),t.serialize())});return this}updateLink(e,t){var n;let r=(n=this._data.body)==null||(n=n.customRanges)==null?void 0:n.find(t=>t.rangeId===e);if(!r)throw Error(`Link not found`);return r.properties.url=t,this}insertParagraph(e,t){let n,r;if(typeof e==`object`){var i,a;n={dataStream:`\r`,paragraphs:[{startIndex:0,paragraphStyle:e.build()}]},r=((i=(a=this._data.body)==null?void 0:a.dataStream.length)==null?2:i)-2}else r=e,n={dataStream:`\r`,paragraphs:[{startIndex:0,paragraphStyle:t==null?void 0:t.build()}]};return this.insertRichText(r,rc.create({body:n,id:`d`,documentStyle:{}})),this}insertLink(t,n,r){let i=``,a=``;typeof t==`string`?(i=t,a=n):(i=n,a=r);let o=e.createByBody({dataStream:i,customRanges:[{rangeType:yn.HYPERLINK,rangeId:C(),properties:{url:a},startIndex:0,endIndex:i.length-1}]});return typeof t==`number`?this.insertRichText(t,o):this.insertRichText(o)}},ac=class{constructor(){v(this,`skipNextObservers`,!1),v(this,`lastReturnValue`,void 0),v(this,`isStopPropagation`,!1)}stopPropagation(){this.isStopPropagation=!0}},oc=class extends d.Subject{constructor(...e){super(...e),v(this,`_sortedObservers`,[])}unsubscribe(){super.unsubscribe(),this._sortedObservers.length=0}complete(){super.complete(),this._sortedObservers.length=0}subscribeEvent(e){let t;t=typeof e==`function`?{next:([t,n])=>e(t,n)}:e;let n=super.subscribe(t);return this._sortedObservers.push(t),this._sortedObservers.sort((e,t)=>{var n,r;return((n=e.priority)==null?0:n)-((r=t.priority)==null?0:r)}),n.add(()=>this._sortedObservers=this._sortedObservers.filter(e=>e!==t)),n}clearObservers(){this._sortedObservers.forEach(e=>{var t;return(t=e.complete)==null?void 0:t.call(e)}),this._sortedObservers.length=0}emitEvent(e){if(!this.closed){let n=new ac;n.lastReturnValue=e;for(let r of this._sortedObservers){var t;if(n.lastReturnValue=(t=r.next)==null?void 0:t.call(r,[e,n]),n.skipNextObservers)return{handled:!0,lastReturnValue:n.lastReturnValue,stopPropagation:n.isStopPropagation}}return{handled:this._sortedObservers.length>0,lastReturnValue:n.lastReturnValue,stopPropagation:n.isStopPropagation}}throw Error(`[EventSubject]: cannot emit event on a closed subject.`)}};function sc(e){return new d.Observable(t=>{let n=e.subscribeEvent(e=>{t.next(e)});return()=>n.unsubscribe()})}const cc=(0,l.createIdentifier)(`core.resource-manager.service`),lc={[f.UnitRole.Editor]:`Editor`,[f.UnitRole.Owner]:`Owner`,[f.UnitRole.Reader]:`Reader`,[f.UnitRole.UNRECOGNIZED]:`UNRECOGNIZED`},uc=e=>e?{userID:`${lc[e]}_${C(8)}`,name:lc[e],avatar:``}:{userID:``,name:``,avatar:``,anonymous:!0,canBindAnonymous:!1},dc=(e,t)=>e.startsWith(lc[t]);var fc=class extends x{constructor(...e){super(...e),v(this,`_model`,new Map),v(this,`_userChange$`,new d.Subject),v(this,`userChange$`,this._userChange$.asObservable()),v(this,`_currentUser$`,new d.BehaviorSubject(uc())),v(this,`currentUser$`,this._currentUser$.asObservable())}dispose(){super.dispose(),this._model.clear(),this._userChange$.complete(),this._currentUser$.complete()}getCurrentUser(){return this._currentUser$.getValue()}setCurrentUser(e){this.addUser(e),this._currentUser$.next(e)}addUser(e){this._model.set(e.userID,e),this._userChange$.next({type:`add`,user:e})}getUser(e,t){let n=this._model.get(e);if(n)return n;t&&t()}delete(e){let t=this.getUser(e);this._model.delete(e),t&&this._userChange$.next({type:`delete`,user:t})}clear(){this._model.clear(),this._userChange$.next({type:`clear`})}list(){return Array.from(this._model.values())}};let pc=class{constructor(e,t){this._resourceManagerService=e,this._userManagerService=t,v(this,`_permissionMap`,new Map([])),v(this,`_permissionOverrides`,new Map),this._initSnapshot(),this._initDefaultUser()}_initDefaultUser(){let e=this._userManagerService.getCurrentUser();e&&e.userID||this._userManagerService.setCurrentUser(uc(f.UnitRole.Owner))}_getRole(e){let t=this._userManagerService.getCurrentUser();return t?dc(t.userID,e):!1}_initSnapshot(){this._resourceManagerService.registerPluginResource({toJson:e=>{let t=[...this._permissionMap.keys()].reduce((e,t)=>(e[t]=this._permissionMap.get(t),e),{});return JSON.stringify(t)},parseJson:e=>JSON.parse(e),pluginName:`SHEET_AuthzIoMockService_PLUGIN`,businesses:[f.UniverType.UNIVER_SHEET,f.UniverType.UNIVER_DOC,f.UniverType.UNIVER_SLIDE],onLoad:(e,t)=>{for(let e in t)this._permissionMap.set(e,t[e])},onUnLoad:()=>{this._permissionMap.clear()}})}async create(e){let t=C(8),{objectType:n,selectRangeObject:r,worksheetObject:i}=e,a=r||i,o={objectType:n,unitID:(a==null?void 0:a.unitID)||``,name:(a==null?void 0:a.name)||``,strategies:[{action:6,role:f.UnitRole.Owner},{action:16,role:f.UnitRole.Owner},{action:17,role:f.UnitRole.Owner},{action:18,role:f.UnitRole.Owner},{action:19,role:f.UnitRole.Owner},{action:33,role:f.UnitRole.Owner},{action:34,role:f.UnitRole.Owner},{action:35,role:f.UnitRole.Owner},{action:36,role:f.UnitRole.Owner},{action:37,role:f.UnitRole.Owner},{action:38,role:f.UnitRole.Owner},{action:39,role:f.UnitRole.Owner},{action:40,role:f.UnitRole.Owner}],selectRangeObject:r};return this._permissionMap.set(t,o),t}async allowed(e){let{objectID:t,actions:n}=e,r=this._permissionMap.get(t);return r?n.map(e=>{let n=`${t}:${e}`;if(this._permissionOverrides.has(n))return{action:e,allowed:this._permissionOverrides.get(n)};let i=r.strategies.find(t=>t.action===e);return i?{action:e,allowed:this._getRole(i.role)}:{action:e,allowed:this._getRole(f.UnitRole.Owner)||this._getRole(f.UnitRole.Editor)}}):n.map(e=>({action:e,allowed:this._getRole(f.UnitRole.Owner)||this._getRole(f.UnitRole.Editor)}))}async batchAllowed(e){let t=await Promise.all(e.map(e=>this.allowed(e)));return e.map((e,n)=>({unitID:e.unitID,objectID:e.objectID,actions:t[n]}))}async list(e){let t=[],n=[{action:6,role:f.UnitRole.Owner},{action:16,role:f.UnitRole.Owner},{action:17,role:f.UnitRole.Owner},{action:18,role:f.UnitRole.Owner},{action:19,role:f.UnitRole.Owner},{action:33,role:f.UnitRole.Owner},{action:34,role:f.UnitRole.Owner},{action:35,role:f.UnitRole.Owner},{action:36,role:f.UnitRole.Owner},{action:37,role:f.UnitRole.Owner},{action:38,role:f.UnitRole.Owner},{action:39,role:f.UnitRole.Owner},{action:40,role:f.UnitRole.Owner}];return e.objectIDs.forEach(r=>{let i=this._permissionMap.get(r),a=(i==null?void 0:i.strategies)||n,o={objectID:r,unitID:e.unitID,objectType:(i==null?void 0:i.objectType)||3,name:(i==null?void 0:i.name)||``,shareOn:!1,shareRole:f.UnitRole.Owner,shareScope:-1,scope:{read:f.ObjectScope.AllCollaborator,edit:f.ObjectScope.AllCollaborator},creator:uc(f.UnitRole.Owner),strategies:a.map(e=>({action:e.action,role:e.role})),actions:e.actions.map(e=>{let t=`${r}:${e}`;if(this._permissionOverrides.has(t))return{action:e,allowed:this._permissionOverrides.get(t)};let n=a.find(t=>t.action===e);return n?{action:e,allowed:this._getRole(n.role)}:{action:e,allowed:this._getRole(f.UnitRole.Owner)||this._getRole(f.UnitRole.Editor)}})};t.push(o)}),t}async listCollaborators(){return[]}async listRoles(){return{roles:[],actions:[]}}async deleteCollaborator(){}async update(e){let{objectID:t,strategies:n}=e,r=this._permissionMap.get(t);r&&n&&(r.strategies=n.map(e=>({action:e.action,role:e.role})),this._permissionMap.set(t,r),n.forEach(e=>{e.role===f.UnitRole.Reader?this.setPermissionOverride(t,e.action,!1):(e.role===f.UnitRole.Owner||e.role===f.UnitRole.Editor)&&this.clearPermissionOverride(t,e.action)}))}setPermissionOverride(e,t,n){let r=`${e}:${t}`;this._permissionOverrides.set(r,n)}clearPermissionOverride(e,t){let n=`${e}:${t}`;this._permissionOverrides.delete(n)}clearAllOverrides(e){let t=[];this._permissionOverrides.forEach((n,r)=>{r.startsWith(`${e}:`)&&t.push(r)}),t.forEach(e=>this._permissionOverrides.delete(e))}async updateCollaborator(){}async createCollaborator(){}async putCollaborators(e){}};pc=F([P(0,cc),P(1,(0,l.Inject)(fc))],pc);const mc=(0,l.createIdentifier)(`IAuthzIoIoService`),hc=(0,l.createIdentifier)(`univer.confirm-service`);var gc=class{constructor(){v(this,`confirmOptions$`,new d.Subject)}dispose(){this.confirmOptions$.complete()}open(e){throw Error(`This is not implemented in the test service!`)}confirm(e){return Promise.resolve(!0)}close(e){throw Error(`This is not implemented in the test service!`)}};const _c=`FOCUSING_UNIT`,vc=`FOCUSING_SHEET`,yc=`FOCUSING_DOC`,bc=`FOCUSING_SLIDE`,xc=`EDITOR_ACTIVATED`,Sc=`FOCUSING_FX_BAR_EDITOR`;var Cc=class extends x{constructor(...e){super(...e),v(this,`_error$`,new d.Subject),v(this,`error$`,this._error$.asObservable())}dispose(){this._error$.complete()}emit(e){this._error$.next({errorKey:e})}};let wc=function(e){return e.URL=`URL`,e.UUID=`UUID`,e.BASE64=`BASE64`,e}({}),Tc=function(e){return e.SUCCUSS=`0`,e.ERROR_EXCEED_SIZE=`1`,e.ERROR_IMAGE_TYPE=`2`,e.ERROR_UPLOAD_COUNT_LIMIT=`3`,e.ERROR_IMAGE=`4`,e}({});const Ec=(0,l.createIdentifier)(`core.image-io.service`),Dc=(0,l.createIdentifier)(`core.url-image.service`);var Oc=`@univerjs/core`,kc=`0.19.0`;function Ac(e=``,t=Zt.ZH_CN,n=``){return{id:e,sheetOrder:[],name:n,appVersion:kc,locale:t,styles:{},sheets:{},resources:[]}}var jc=class{constructor(e={}){v(this,`_styles`,void 0),v(this,`_cacheMap`,new da(1e5)),this._styles=e,this._generateCacheMap()}each(e){return Object.entries(this._styles).forEach(e),this}search(e,t){return this._cacheMap.has(t)?this._cacheMap.get(t):this._getExistingStyleId(e)||`-1`}get(e){return typeof e==`string`?(e=String(e),this._styles[e]):e}add(e,t){let n=C(6);return this._styles[n]=e,this._cacheMap.set(t,n),n}setValue(e){if(e==null)return;let t=JSON.stringify(e),n=this.search(e,t);return n===`-1`?this.add(e,t):n}addCustomStyle(e,t){t!=null&&(this._styles[e]=t,this._cacheMap.set(JSON.stringify(t),e))}remove(e){let t=this._styles[e];t&&(delete this._styles[e],this._cacheMap.delete(JSON.stringify(t)))}toJSON(){return this._styles}getStyleByCell(e){let t;t=e&&S.isObject(e.s)?e.s:(e==null?void 0:e.s)&&this.get(e.s);let n=e==null?void 0:e.interceptorStyle;return n?{...t,...n}:t}_generateCacheMap(){let{_styles:e,_cacheMap:t}=this;for(let n in e){let r=JSON.stringify(e[n]);t.set(r,n)}}_getExistingStyleId(e){let{_styles:t}=this;for(let n in t)if(S.diffValue(t[n],e))return n;return null}};const Mc=(e,t)=>t.length===e.length&&!e.some(e=>t.some(t=>!U.equals(t,e))),Nc=(e,t)=>t.length===e.length&&e.every((e,n)=>{let r=t[n];return r.unitId===e.unitId&&r.sheetId===e.sheetId&&U.equals(e.range,r.range)}),Pc={t:0,b:2,l:2,r:2},Fc=e=>({sbr:.6,sbo:e,spr:.6,spo:e});function Ic(e,t,n={}){let r=e.length,{textRotation:i,paddingData:a,horizontalAlign:o=T.UNSPECIFIED,verticalAlign:s=ln.UNSPECIFIED,wrapStrategy:c=un.UNSPECIFIED,cellValueType:l}=n,{t:u,r:d,b:f,l:p}=a||Pc,{vertexAngle:m,centerAngle:h}=Wc(i);return new _s({id:`d`,body:{dataStream:`${e}\r
8
+ `,textRuns:[{ts:t,st:0,ed:r}],paragraphs:[{startIndex:r,paragraphStyle:{horizontalAlign:o}}],sectionBreaks:[{startIndex:r+1}]},documentStyle:{pageSize:{width:1/0,height:1/0},marginTop:u,marginBottom:f,marginRight:d,marginLeft:p,renderConfig:{horizontalAlign:o,verticalAlign:s,centerAngle:h,vertexAngle:m,wrapStrategy:c,cellValueType:l}},drawings:{},drawingsOrder:[]})}function Lc(e){if(!e)return{};let{tr:t,td:n,ht:r,vt:i,tb:a,pd:o}=e;return{textRotation:t,textDirection:n,horizontalAlign:r,verticalAlign:i,wrapStrategy:a,paddingData:o}}function Rc(e){if(!e)return{};let{ff:t,fs:n,it:r,bl:i,ul:a,st:o,ol:s,cl:c}=e,l={};return t&&(l.ff=t),n&&(l.fs=n),r&&(l.it=r),i&&(l.bl=i),a&&(l.ul=a),o&&(l.st=o),s&&(l.ol=s),c&&(l.cl=c),l}function zc(e,t,n){var r;let i=e.getBody();if((r=i.customRanges)!=null&&r.some(e=>e.rangeType===yn.HYPERLINK))return;let a=Z.customRange.add({ranges:[{startOffset:0,endOffset:i.dataStream.length-1,collapsed:!1}],rangeId:n,rangeType:yn.HYPERLINK,body:i,properties:{url:t,refId:n}});a&&J.apply(i,a.serialize())}function Bc(e){return e!=null}function Vc(){return{p:null,s:null,v:null,t:null,f:null,si:null,ref:null,xf:null}}function Hc(e){let t=H.ff,n=H.fs;if(!e){let e=`${n}pt ${t}`;return{fontCache:e,fontString:e,fontSize:n,originFontSize:n,fontFamily:t}}let r=zn.ITALIC;(e.it===0||e.it===void 0)&&(r=zn.NORMAL);let i=zn.BOLD;(e.bl===0||e.bl===void 0)&&(i=zn.NORMAL);let a=n;e.fs&&(a=Math.ceil(e.fs));let o=t;if(e.ff){let n=e.ff;n=n.replace(/"/g,``).replace(/'/g,``),n.indexOf(` `)>-1&&(n=`"${n}"`),n==null&&(n=t),o=n}let{va:s}=e,c=a;if(s===pn.SUBSCRIPT||s===pn.SUPERSCRIPT){let{sbr:e,spr:t}=Uc(o,c);c*=s===pn.SUBSCRIPT?e:t}let l=`${r} ${i} ${c}pt ${o}`;return{fontCache:l,fontString:`${l}, "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif `,fontSize:c,originFontSize:a,fontFamily:o}}function Uc(e,t){return Fc(t)}function Wc(e){let{a:t=0,v:n=E.FALSE}=e||{a:0,v:E.FALSE},r=0,i=t;return n===E.TRUE&&(r=90,i=90),{centerAngle:r,vertexAngle:i}}function Q(e){if(typeof e!=`object`||!e)return e;if(Array.isArray(e)){let t=e.length,n=Array(t);for(let r=0;r<t;r++)n[r]=Q(e[r]);return n}let t={},n=Object.keys(e);for(let r=0,i=n.length;r<i;r++){let i=n[r];t[i]=Q(e[i])}return t}function Gc(e){if(e==null)return e;let t={};return e.p!==void 0&&(t.p=e.p===null?null:Q(e.p)),e.s!==void 0&&(e.s===null||typeof e.s==`string`?t.s=e.s:t.s=Q(e.s)),e.v!==void 0&&(t.v=e.v),e.t!==void 0&&(t.t=e.t),e.f!==void 0&&(t.f=e.f),e.ref!==void 0&&(t.ref=e.ref),e.xf!==void 0&&(t.xf=e.xf),e.si!==void 0&&(t.si=e.si),e.custom!==void 0&&(t.custom=e.custom===null?null:Q(e.custom)),t}function Kc(e){if(e==null)return e;let t={};return e.p!==void 0&&(t.p=e.p===null?null:Q(e.p)),e.s!==void 0&&(e.s===null||typeof e.s==`string`?t.s=e.s:t.s=Q(e.s)),e.v!==void 0&&(t.v=e.v),e.t!==void 0&&(t.t=e.t),e.f!==void 0&&(t.f=e.f),e.ref!==void 0&&(t.ref=e.ref),e.xf!==void 0&&(t.xf=e.xf),e.si!==void 0&&(t.si=e.si),e.custom!==void 0&&(t.custom=e.custom===null?null:Q(e.custom)),e.rowSpan!==void 0&&(t.rowSpan=e.rowSpan),e.colSpan!==void 0&&(t.colSpan=e.colSpan),e.displayV!==void 0&&(t.displayV=e.displayV),t}function qc(e){let t={},n=Object.keys(e);for(let r=0,i=n.length;r<i;r++){let i=n[r],a=Number(i),o=e[a];if(o===void 0)continue;let s={},c=Object.keys(o);for(let e=0,t=c.length;e<t;e++){let t=c[e],n=Number(t),r=o[n];r!=null&&(s[n]=Gc(r))}t[a]=s}return t}function Jc(e){let t={},n=Object.keys(e);for(let r=0,i=n.length;r<i;r++){let i=n[r],a=Number(i),o=e[a];if(o===void 0)continue;let s={};`h`in o&&o.h!==void 0&&(s.h=o.h),`ia`in o&&o.ia!==void 0&&(s.ia=o.ia),`ah`in o&&o.ah!==void 0&&(s.ah=o.ah),`hd`in o&&o.hd!==void 0&&(s.hd=o.hd),`w`in o&&o.w!==void 0&&(s.w=o.w),`s`in o&&o.s!==void 0&&(o.s===null||typeof o.s==`string`?s.s=o.s:s.s=Q(o.s)),`custom`in o&&o.custom!==void 0&&(s.custom=o.custom===null?null:Q(o.custom)),t[a]=s}return t}function Yc(e){let t=e.length,n=Array(t);for(let r=0;r<t;r++){let t=e[r];n[r]={startRow:t.startRow,startColumn:t.startColumn,endRow:t.endRow,endColumn:t.endColumn,rangeType:t.rangeType,startAbsoluteRefType:t.startAbsoluteRefType,endAbsoluteRefType:t.endAbsoluteRefType}}return n}function Xc(e){let t={id:e.id,name:e.name,tabColor:e.tabColor,hidden:e.hidden,rowCount:e.rowCount,columnCount:e.columnCount,zoomRatio:e.zoomRatio,scrollTop:e.scrollTop,scrollLeft:e.scrollLeft,defaultColumnWidth:e.defaultColumnWidth,defaultRowHeight:e.defaultRowHeight,showGridlines:e.showGridlines,rightToLeft:e.rightToLeft,freeze:{xSplit:e.freeze.xSplit,ySplit:e.freeze.ySplit,startRow:e.freeze.startRow,startColumn:e.freeze.startColumn},rowHeader:{width:e.rowHeader.width,hidden:e.rowHeader.hidden},columnHeader:{height:e.columnHeader.height,hidden:e.columnHeader.hidden},mergeData:Yc(e.mergeData),cellData:qc(e.cellData),rowData:Jc(e.rowData),columnData:Jc(e.columnData)};return e.gridlinesColor!==void 0&&(t.gridlinesColor=e.gridlinesColor),e.defaultStyle!==void 0&&(e.defaultStyle===null||typeof e.defaultStyle==`string`?t.defaultStyle=e.defaultStyle:t.defaultStyle=Q(e.defaultStyle)),e.custom!==void 0&&(t.custom=e.custom===null?null:Q(e.custom)),t}var Zc=class{constructor(e,t){this._config=e,v(this,`_columnData`,{}),this._columnData=t}getColumnData(){return this._columnData}getColVisible(e){let{_columnData:t}=this,n=t[e];return n?n.hd!==E.TRUE:!0}getColumnStyle(e){var t;return(t=this._columnData[e])==null?void 0:t.s}setColumnStyle(e,t){let n=this.getColumnOrCreate(e);n.s=t}getHiddenCols(e=0,t=this.getSize()-1){let n=[],r=!1,i=-1;for(let a=e;a<=t;a++){let e=this.getColVisible(a);r&&e?(r=!1,n.push({rangeType:L.COLUMN,startColumn:i,endColumn:a-1,startRow:0,endRow:0})):!r&&!e&&(r=!0,i=a)}return r&&n.push({startRow:0,endRow:0,startColumn:i,endColumn:t,rangeType:L.COLUMN}),n}getVisibleCols(e=0,t=this.getSize()-1){let n=[],r=!1,i=-1;for(let a=e;a<=t;a++){let e=this.getColVisible(a);r&&!e?(r=!1,n.push({rangeType:L.COLUMN,startColumn:i,endColumn:a-1,startRow:0,endRow:0})):!r&&e&&(r=!0,i=a)}return r&&n.push({startRow:0,endRow:0,startColumn:i,endColumn:t,rangeType:L.COLUMN}),n}getColumnDatas(e,t){let n={},r=0;for(let i=e;i<e+t;i++){let e=this.getColumn(i);n[r]=e==null?{w:this._config.defaultColumnWidth,hd:E.FALSE}:e,r++}return n}getSize(){return vi(this._columnData)}getColumnWidth(e){var t,n;return(t=(n=this._columnData[e])==null?void 0:n.w)==null?this._config.defaultColumnWidth:t}setColumnWidth(e,t){let n=this._columnData[e];t===this._config.defaultColumnWidth?n&&(delete n.w,Object.keys(n).length===0&&delete this._columnData[e]):this._columnData[e]=n?{...n,w:t}:{w:t}}getColumn(e){return this._columnData[e]}insertColumnsWithData(e,t,n){let r=t-e+1,i=Object.keys(this._columnData);for(let t=i.length-1;t>=0;t--){let n=Number(i[t]);n>=e&&(this._columnData[n+r]=this._columnData[n],delete this._columnData[n])}for(let r=e;r<=t;r++){let t=n==null?void 0:n[r-e];t!=null&&Object.keys(t).length>0&&(this._columnData[r]={...t})}}removeColumn(e){delete this._columnData[e]}getColumnOrCreate(e){let{_columnData:t}=this,n=t[e];if(n)return n;let r={};return this._columnData[e]=r,r}setCustomMetadata(e,t){let n=this.getColumn(e);n&&(n.custom=t)}getCustomMetadata(e){var t;return(t=this.getColumn(e))==null?void 0:t.custom}},Qc=class{constructor(e,t,n){this._config=e,this._viewModel=t,v(this,`_rowData`,void 0),this._rowData=n}getRowData(){return this._rowData}getRowStyle(e){var t;return(t=this._rowData[e])==null?void 0:t.s}setRowStyle(e,t){let n=this.getRowOrCreate(e);n.s=t}getRowDatas(e,t){let n={},r=0;for(let i=e;i<e+t;i++){let e=this.getRow(i);n[r]=e==null?{h:this._config.defaultRowHeight,hd:E.FALSE}:e,r++}return n}getRowHeight(e,t=1){let{_rowData:n}=this,r=this._config,i=0;for(let a=0;a<t;a++){let{ia:t,ah:o,h:s=r.defaultRowHeight}=n[a+e]||{hd:E.FALSE,h:r.defaultRowHeight};i+=(t==null||t===E.TRUE)&&typeof o==`number`?o:s}return i}setRowHeight(e,t){let n=this._rowData[e];if(t===this._config.defaultRowHeight)n&&(delete n.h,Object.keys(n).length===0&&delete this._rowData[e]);else{let r=Math.min(t,2e3);this._rowData[e]=n?{...n,h:r}:{h:r}}}getRow(e){return this._rowData[e]}insertRowsWithData(e,t,n){let r=t-e+1,i=Object.keys(this._rowData);for(let t=i.length-1;t>=0;t--){let n=Number(i[t]);n>=e&&(this._rowData[n+r]=this._rowData[n],delete this._rowData[n])}for(let r=e;r<=t;r++){let t=n==null?void 0:n[r-e];t!=null&&Object.keys(t).length>0&&(this._rowData[r]={...t})}}removeRow(e){delete this._rowData[e]}getRowOrCreate(e){let{_rowData:t}=this,n=t[e];if(n)return n;let r={};return t[e]=r,r}getHiddenRows(e=0,t=this.getSize()-1){let n=[],r=!1,i=-1;for(let a=e;a<=t;a++){let e=this.getRowRawVisible(a);r&&e?(r=!1,n.push({startRow:i,endRow:a-1,startColumn:0,endColumn:0,rangeType:L.ROW})):!r&&!e&&(r=!0,i=a)}return r&&n.push({startRow:i,endRow:t,startColumn:0,endColumn:0,rangeType:L.ROW}),n}getVisibleRows(e=0,t=this.getSize()-1){let n=[],r=!1,i=-1;for(let a=e;a<=t;a++){let e=this.getRowRawVisible(a);r&&!e?(r=!1,n.push({startRow:i,endRow:a-1,startColumn:0,endColumn:0,rangeType:L.ROW})):!r&&e&&(r=!0,i=a)}return r&&n.push({startRow:i,endRow:t,startColumn:0,endColumn:0,rangeType:L.ROW}),n}getRowRawVisible(e){let t=this.getRow(e);return t?t.hd!==E.TRUE:!0}getSize(){return vi(this._rowData)}setCustomMetadata(e,t){let n=this.getRow(e);n&&(n.custom=t)}getCustomMetadata(e){var t;return(t=this.getRow(e))==null?void 0:t.custom}};const $c=1e3;function el(e){let t={name:`Sheet1`,id:`sheet-01`,tabColor:``,hidden:E.FALSE,rowCount:$c,columnCount:20,zoomRatio:1,freeze:{xSplit:0,ySplit:0,startRow:-1,startColumn:-1},scrollTop:0,scrollLeft:0,defaultColumnWidth:88,defaultRowHeight:24,mergeData:[],cellData:{},rowData:{},columnData:{},showGridlines:E.TRUE,rowHeader:{width:46,hidden:E.FALSE},columnHeader:{height:20,hidden:E.FALSE},rightToLeft:E.FALSE};return Object.keys(t).forEach(n=>{let r=n;e[r]===void 0&&(e[r]=t[r])}),e}var tl=class extends x{constructor(e){super(),v(this,`_cellCache`,new Map),v(this,`_rowCache`,new Map),v(this,`_columnCache`,new Map),v(this,`_hasRow`,!1),v(this,`_hasColumn`,!1),v(this,`_hasAll`,!1),v(this,`_allIndex`,-1),v(this,`_mergeData`,void 0),v(this,`_rangeMap`,new da(5e4)),this._init(e.concat())}_init(e){this._mergeData=e,this._createCache(e)}_clearCache(){this._cellCache.clear(),this._rowCache.clear(),this._columnCache.clear(),this._hasAll=!1,this._allIndex=-1,this._rangeMap.clear(),this._hasColumn=!1,this._hasRow=!1}_createCache(e){let t=0;for(let n of e){let{rangeType:e}=n;e===L.ROW?this._createRowCache(n,t):e===L.COLUMN?this._createColumnCache(n,t):e===L.ALL?this._createCellAllCache(t):this._createCellCache(n,t),t++}}rebuild(e){this._clearCache(),this._init(e.concat())}_createRowCache(e,t){let{startRow:n,endRow:r}=e;for(let e=n;e<=r;e++)this._rowCache.set(e,t),this._hasRow=!0}_createColumnCache(e,t){let{startColumn:n,endColumn:r}=e;for(let e=n;e<=r;e++)this._columnCache.set(e,t),this._hasColumn=!0}_createCellAllCache(e){this._hasAll=!0,this._allIndex=e}_createCellCache(e,t){for(let n=e.startRow;n<=e.endRow;n++){let r=this._cellCache.get(n);r==null&&(r=new Map,this._cellCache.set(n,r));for(let n=e.startColumn;n<=e.endColumn;n++)r.set(n,t)}}add(e){this._mergeData.push(e),this._clearCache(),this._createCache(this._mergeData)}remove(e,t){let n=this._getMergeDataIndex(e,t);n!==-1&&(this._mergeData.splice(n,1),this._clearCache(),this._createCache(this._mergeData))}getMergedCell(e,t){let n=this._getMergeDataIndex(e,t);return n===-1?null:this._mergeData[n]}getMergeDataIndex(e,t){return this._getMergeDataIndex(e,t)}isRowContainsMergedCell(e){return this._hasAll||!S.isEmptyObject(this._columnCache)?!0:this._mergeData.some(t=>t.startRow<=e&&e<=t.endRow)}isColumnContainsMergedCell(e){return this._hasAll||!S.isEmptyObject(this._rowCache)?!0:this._mergeData.some(t=>t.startColumn<=e&&e<=t.endColumn)}getMergedCellRange(e,t,n,r){let i=[],a=`${e}-${t}-${n}-${r}`;if(this._rangeMap.has(a))return this._getRangeFromCache(a);let o=0,s=[];for(let a of this._mergeData||[])U.intersects(a,{startRow:e,endRow:n,startColumn:t,endColumn:r})&&(i.push({...a}),s.push(o)),o++;return this._rangeMap.set(a,s),i}_getRangeFromCache(e){let t=this._rangeMap.get(e)||[],n=[];for(let e of t)n.push({...this._mergeData[e]});return n}_getMergeDataIndex(e,t){var n;if(this._hasAll)return this._allIndex;if(this._hasRow){let t=this._rowCache.get(e);if(t!==void 0)return t}if(this._hasColumn){let e=this._columnCache.get(t);if(e!==void 0)return e}let r=(n=this._cellCache.get(e))==null?void 0:n.get(t);return r===void 0?-1:r}getMergeDataSnapshot(){return this._mergeData}dispose(){this._clearCache(),this._mergeData=[]}},nl=class extends x{constructor(e){super(),this.getRawCell=e,v(this,`_cellContentInterceptor`,null),v(this,`_rowFilteredInterceptor`,null)}dispose(){super.dispose(),this._cellContentInterceptor=null,this._rowFilteredInterceptor=null}getCell(e,t,n,r){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(e,t,We.Value|We.Style,n,r):this.getRawCell(e,t)}getCellValueOnly(e,t){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(e,t,We.Value):this.getRawCell(e,t)}getCellStyleOnly(e,t){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(e,t,We.Style):this.getRawCell(e,t)}getRowFiltered(e){var t,n;return(t=(n=this._rowFilteredInterceptor)==null?void 0:n.getRowFiltered(e))==null?!1:t}registerCellContentInterceptor(e){if(this._cellContentInterceptor)throw Error(`[SheetViewModel]: Interceptor already registered.`);return this._cellContentInterceptor=e,b(()=>this._cellContentInterceptor=null)}registerRowFilteredInterceptor(e){if(this._rowFilteredInterceptor)throw Error(`[SheetViewModel]: Interceptor already registered.`);return this._rowFilteredInterceptor=e,b(()=>this._rowFilteredInterceptor=null)}};const rl={isDeepClone:!1,displayRawFormula:!1,ignoreTextRotation:!1};var il=class e{constructor(e,t,n){var r;this.unitId=e,this._styles=n,v(this,`_sheetId`,void 0),v(this,`_snapshot`,void 0),v(this,`_cellData`,void 0),v(this,`_rowManager`,void 0),v(this,`_columnManager`,void 0),v(this,`_viewModel`,void 0),v(this,`_spanModel`,void 0),v(this,`_isRowStylePrecedeColumnStyle`,!0),v(this,`_getCellHeight`,void 0),this._snapshot=el(t);let{columnData:i,rowData:a,cellData:o}=this._snapshot;this._sheetId=(r=this._snapshot.id)==null?C(6):r,this._cellData=new Di(o),this._viewModel=new nl((e,t)=>this.getCellRaw(e,t)),this._rowManager=new Qc(this._snapshot,this._viewModel,a),this._columnManager=new Zc(this._snapshot,i),this._spanModel=new tl(this._snapshot.mergeData)}__interceptViewModel(e){e(this._viewModel)}__registerGetCellHeight(e){return this._getCellHeight=e,b(()=>{this._getCellHeight=null})}getSnapshot(){return this._snapshot}getCellHeight(e,t){return this._getCellHeight?this._getCellHeight(e,t):this._snapshot.defaultRowHeight}setMergeData(e){this._snapshot.mergeData=e,this.getSpanModel().rebuild(e)}getSpanModel(){return this._spanModel}setIsRowStylePrecedeColumnStyle(e){this._isRowStylePrecedeColumnStyle=e}getStyleDataByHash(e){return{...this._styles.get(e)}}setStyleData(e){return this._styles.setValue(e)}getColumnStyle(e,t=!1){return t?this._columnManager.getColumnStyle(e):this._styles.get(this._columnManager.getColumnStyle(e))}setColumnStyle(e,t){this._columnManager.setColumnStyle(e,t)}getRowStyle(e,t=!1){return t?this._rowManager.getRowStyle(e):this._styles.get(this._rowManager.getRowStyle(e))}setRowStyle(e,t){this._rowManager.setRowStyle(e,t)}getDefaultCellStyle(){return this._snapshot.defaultStyle}getDefaultCellStyleInternal(){let e=this._snapshot.defaultStyle;return this._styles.get(e)}setDefaultCellStyle(e){this._snapshot.defaultStyle=e}getCellStyle(e,t){let n=this.getCell(e,t);if(n){let e=n.s;return typeof e==`string`?this._styles.get(e):e}return null}getComposedCellStyle(e,t,n){let r=this.getDefaultCellStyleInternal(),i=this.getRowStyle(e),a=this.getColumnStyle(t),o=this.getCell(e,t),s=this._styles.getStyleByCell(o);return(n==null?this._isRowStylePrecedeColumnStyle:n)?Lt(r,a,i,o==null?void 0:o.themeStyle,s):Lt(r,i,a,o==null?void 0:o.themeStyle,s)}getComposedCellStyleByCellData(e,t,n,r){let i=this.getDefaultCellStyleInternal(),a=this.getRowStyle(e),o=this.getColumnStyle(t),s=this._styles.getStyleByCell(n);return(r==null?this._isRowStylePrecedeColumnStyle:r)?Lt(i,o,a,n==null?void 0:n.themeStyle,s):Lt(i,a,o,n==null?void 0:n.themeStyle,s)}getComposedCellStyleWithoutSelf(e,t,n,r){let i=n===void 0?this.getComposedCellStyle(e,t,r):this.getComposedCellStyleByCellData(e,t,n,r),a=this.getCellRaw(e,t);if(!a||!a.s)return i;let o=typeof a.s==`string`?this._styles.get(a.s):a.s;if(!o)return i;for(let e in o)e in i&&delete i[e];return i}getCellMatrix(){return this._cellData}getCellMatrixPrintRange(){let e=this.getCellMatrix(),t=this.getMergeData(),n=-1,r=-1,i=-1,a=-1,o=!1,s=!1;return e.forEach((t,c)=>{Object.keys(c).forEach(c=>{let l=+c,u=e.getValue(t,l),d=u!=null&&u.s?this._styles.get(u.s):null,f=(d==null?void 0:d.bd)&&(d.bd.b||d.bd.l||d.bd.r||d.bd.t||d.bd.bc_tr||d.bd.bl_tr||d.bd.ml_tr||d.bd.tl_bc||d.bd.tl_br||d.bd.tl_mr);(u&&(u.v!==null&&u.v!==void 0&&u.v!==``||u.p)||d!=null&&d.bg||f)&&(o?n=Math.min(n,t):(n=t,o=!0),r=Math.max(r,t),s?i=Math.min(i,l):(s=!0,i=l),a=Math.max(a,l))})}),t.forEach(e=>{o?n=Math.min(n,e.startRow):(n=e.startRow,o=!0),r=Math.max(r,e.endRow),s?i=Math.min(i,e.startColumn):(i=e.startColumn,o=!0),a=Math.max(a,e.endColumn)}),!o||!s?null:{startColumn:i,startRow:n,endColumn:a,endRow:r}}getRowManager(){return this._rowManager}getUnitId(){return this.unitId}getSheetId(){return this._sheetId}getColumnManager(){return this._columnManager}getName(){return this._snapshot.name}clone(){let{_snapshot:t}=this,n=Xc(t);return new e(this.unitId,n,this._styles)}getMergeData(){return this._spanModel.getMergeDataSnapshot()}getMergedCell(e,t){return this._spanModel.getMergedCell(e,t)}getMergedCellRange(e,t,n,r){return this._spanModel.getMergedCellRange(e,t,n,r)}isRowContainsMergedCell(e){return this._spanModel.isRowContainsMergedCell(e)}isColumnContainsMergedCell(e){return this._spanModel.isColumnContainsMergedCell(e)}getCellInfoInMergeData(e,t){let n=this.getMergedCell(e,t),r=!1,i=!1,a=e,o=t,s=e,c=t;if(n){let{startRow:l,endRow:u,startColumn:d,endColumn:f}=n;e===l&&t===d?(a=u,o=f,s=l,c=d,i=!0):e>=l&&e<=u&&t>=d&&t<=f&&(a=u,o=f,s=l,c=d,r=!0)}return{actualRow:e,actualColumn:t,isMergedMainCell:i,isMerged:r,endRow:a,endColumn:o,startRow:s,startColumn:c}}getCell(e,t){return e<0||t<0?null:this._viewModel.getCell(e,t)}getCellValueOnly(e,t){return e<0||t<0?null:this._viewModel.getCellValueOnly(e,t)}getCellStyleOnly(e,t){return e<0||t<0?null:this._viewModel.getCellStyleOnly(e,t)}getCellRaw(e,t){return this.getCellMatrix().getValue(e,t)}getCellWithFilteredInterceptors(e,t,n,r){return this._viewModel.getCell(e,t,n,r)}getRowFiltered(e){return this._viewModel.getRowFiltered(e)}getRangeFilterRows(e){let t=[];for(let n=e.startRow;n<=e.endRow;n++)this.getRowFiltered(n)&&t.push(n);return t}getMatrixWithMergedCells(e,t,n,r,i=ci.Raw){let a=this.getCellMatrix(),o=this._spanModel.getMergedCellRange(e,t,n,r),s=new Di;return Wa(e,n,t,r).forEach((e,t)=>{let n;if(i===ci.Raw)n=this.getCellRaw(e,t);else if(i===ci.Intercepted)n=this.getCell(e,t);else if(i===ci.Both){let i=this.getCellRaw(e,t);if(i){var r;n={...i};let a=(r=this.getCell(e,t))==null?void 0:r.v;Bc(a)&&n&&(n.displayV=String(a))}}n&&s.setValue(e,t,n)}),o.forEach(e=>{let{startColumn:t,startRow:n,endColumn:r,endRow:i}=e;Wa(n,i,t,r).forEach((e,o)=>{e===n&&o===t&&s.setValue(e,o,{...a.getValue(e,o),rowSpan:i-n+1,colSpan:r-t+1}),(e!==n||o!==t)&&s.realDeleteValue(e,o)})}),s}getRange(e,t,n,r){return typeof e==`object`?new Da(this,e,{getStyles:()=>this._styles}):new Da(this,{startRow:e,startColumn:t,endColumn:r||t,endRow:n||e},{getStyles:()=>this._styles})}getScrollLeftTopFromSnapshot(){return{scrollLeft:this._snapshot.scrollLeft,scrollTop:this._snapshot.scrollTop}}getZoomRatio(){return this._snapshot.zoomRatio||1}getConfig(){return this._snapshot}getFreeze(){return this._snapshot.freeze}getMaxColumns(){let{_snapshot:e}=this,{columnCount:t}=e;return t}getMaxRows(){let{_snapshot:e}=this,{rowCount:t}=e;return t}getRowCount(){return this._snapshot.rowCount}setRowCount(e){this._snapshot.rowCount=e}getColumnCount(){return this._snapshot.columnCount}setColumnCount(e){this._snapshot.columnCount=e}isSheetHidden(){return this._snapshot.hidden}hasHiddenGridlines(){let{_snapshot:e}=this,{showGridlines:t}=e;return t===0}getGridlinesColor(){return this.getConfig().gridlinesColor}getTabColor(){let{_snapshot:e}=this,{tabColor:t}=e;return t}getColumnWidth(e){return this.getColumnManager().getColumnWidth(e)}getRowHeight(e){return this._viewModel.getRowFiltered(e)?0:this.getRowManager().getRowHeight(e)}isRowFiltered(e){return this._viewModel.getRowFiltered(e)}getRowVisible(e){return!this.isRowFiltered(e)&&this.getRowRawVisible(e)}getRowRawVisible(e){return this.getRowManager().getRowRawVisible(e)}getHiddenRows(e,t){let n=this.getMaxColumns()-1,r=this._rowManager.getHiddenRows(e,t);return r.forEach(e=>e.endColumn=n),r}getColVisible(e){return this._columnManager.getColVisible(e)}getHiddenCols(e,t){let n=this.getMaxRows()-1,r=this._columnManager.getHiddenCols(e,t);return r.forEach(e=>e.endRow=n),r}getVisibleRows(){let e=this.getRowCount();return this._rowManager.getVisibleRows(0,e-1)}getVisibleCols(){let e=this.getColumnCount();return this._columnManager.getVisibleCols(0,e-1)}isRightToLeft(){let{_snapshot:e}=this,{rightToLeft:t}=e;return t}getLastRowWithContent(){return this._cellData.getRealRowRange().endRow}getLastColumnWithContent(){return this.getDataRealRange().endColumn}getDataRealRange(){return this._cellData.getRealRange()}getDataRangeScope(){return this._cellData.getStartEndScope()}cellHasValue(e){return e&&(e.v!==void 0||e.f!==void 0||e.p!==void 0)}iterateByRow(e,t=!0){let{startRow:n,startColumn:r,endRow:i,endColumn:a}=e,o=this;return{[Symbol.iterator]:()=>{let e=n,s=r;return{next(){for(;;){if(s>a&&(e+=1,s=r),e>i)return{done:!0,value:void 0};let n=o.getCell(e,s),c=!n,l=o.getMergedCell(e,s);if(l){if(e!==l.startRow||s!==l.startColumn){s=l.endColumn+1;continue}if(c&&t){s=l.endColumn+1;continue}let r={row:e,col:s,value:n};return r.colSpan=l.endColumn-l.startColumn+1,r.rowSpan=l.endRow-l.startRow+1,s=l.endColumn+1,{done:!1,value:r}}if(c&&t)s+=1;else{let t={row:e,col:s,value:n};return s+=1,{done:!1,value:t}}}}}}}}iterateByColumn(e,t=!0,n=!0){let{startRow:r,startColumn:i,endRow:a,endColumn:o}=e,s=this;return{[Symbol.iterator]:()=>{let e=r,c=i;return{next(){for(;;){if(e>a&&(c+=1,e=r),c>o)return{done:!0,value:void 0};let i=s.getMergedCell(e,c);if(i){let r=e!==i.startRow,a=r||c!==i.startColumn;if(n&&a||!n&&r){e=i.endRow+1;continue}let o=s.getCell(i.startRow,i.startColumn);if(!o&&t){e=i.endRow+1;continue}let l={row:e,col:i.startColumn,value:o};return l.colSpan=i.endColumn-i.startColumn+1,l.rowSpan=i.endRow-i.startRow+1,e=i.endRow+1,{done:!1,value:l}}let l=s.getCell(e,c);if(!l&&t)e+=1;else{let t={row:e,col:c,value:l};return e+=1,{done:!1,value:t}}}}}}}}getCellDocumentModel(e,t,n=rl){var r;if(!e)return;let{isDeepClone:i,displayRawFormula:a,ignoreTextRotation:o}={...rl,...n},s,c=`document`,l=Lc(t),u=o?H.tr:l.textRotation||H.tr,d=l.horizontalAlign||H.ht,f=l.verticalAlign||H.vt,p=l.wrapStrategy||H.tb,m=l.paddingData||Pc;if(e.f&&a)s=Ic(e.f.toString(),{},{verticalAlign:f}),d=H.ht;else if(e.p){let{centerAngle:t,vertexAngle:n}=Wc(u);s=this._updateConfigAndGetDocumentModel(i?S.deepClone(e.p):e.p,d,m,{horizontalAlign:d,verticalAlign:f,centerAngle:t,vertexAngle:n,wrapStrategy:p,zeroWidthParagraphBreak:1})}else if(e.v!=null){let n=Rc(t);c=Hc(n).fontCache;let r=al(e);e.t===mn.FORCE_STRING&&a&&(r=`'${r}`),s=Ic(r,n,{...l,textRotation:u,cellValueType:e.t})}return s&&e.linkUrl&&e.linkId&&zc(s,e.linkUrl,e.linkId),{documentModel:s,fontString:c,textRotation:u,wrapStrategy:p,verticalAlign:f,horizontalAlign:d,paddingData:m,fill:t==null||(r=t.bg)==null?void 0:r.rgb}}_updateConfigAndGetDocumentModel(e,t,n,r){var i,a,o,s,c;if(!r||!((i=e.body)!=null&&i.dataStream))return;e.documentStyle||(e.documentStyle={}),e.documentStyle.marginTop=(a=n.t)==null?0:a,e.documentStyle.marginBottom=(o=n.b)==null?2:o,e.documentStyle.marginLeft=(s=n.l)==null?2:s,e.documentStyle.marginRight=(c=n.r)==null?2:c,e.documentStyle.pageSize={width:1/0,height:1/0},e.documentStyle.renderConfig={...e.documentStyle.renderConfig,...r};let l=e.body.paragraphs||[];for(let e of l)e.paragraphStyle||(e.paragraphStyle={}),e.paragraphStyle.horizontalAlign=t;return new _s(e)}getBlankCellDocumentModel(e,t,n){let r=this.getComposedCellStyleByCellData(t,n,e),i=Rc(r),a=this.getCellDocumentModel(e,r,{ignoreTextRotation:!0});if(a!=null)return a.documentModel==null&&(a.documentModel=Ic(``,i)),a;let o=`document`,s=H.tr,c=H.ht,l=H.vt,u=H.tb,d=Pc;return o=Hc({}).fontCache,{documentModel:Ic(``,i),fontString:o,textRotation:s,wrapStrategy:u,verticalAlign:l,horizontalAlign:c,paddingData:d}}getCellDocumentModelWithFormula(e,t,n){let r=this.getComposedCellStyleByCellData(t,n,e);return this.getCellDocumentModel(e,r,{isDeepClone:!0,displayRawFormula:!0,ignoreTextRotation:!0})}getCustomMetadata(){return this._snapshot.custom}setCustomMetadata(e){this._snapshot.custom=e}};function al(e){var t;if(!e)return``;let n=(t=e.p)==null||(t=t.body)==null?void 0:t.dataStream;if(n)return Z.transform.getPlainText(n);let r=e.v;return typeof r==`string`?e.t===mn.BOOLEAN?r.toUpperCase():r.replace(/[\r\n]/g,``):typeof r==`number`?e.t===mn.BOOLEAN?r?`TRUE`:`FALSE`:r.toString():typeof r==`boolean`?r?`TRUE`:`FALSE`:``}function ol(e){if(e===null)return``;if(e!=null&&e.p){let t=e==null?void 0:e.p.body;if(t==null)return``;let n=t.dataStream;return Z.transform.getPlainText(n)}return e==null?void 0:e.v}function sl(e,t){return`${e.getUnitId()}|${t.getSheetId()}`}let cl=class extends Et{get _activeSheet(){return this._activeSheet$.getValue()}get name(){return this._name$.getValue()}static isIRangeType(e){return typeof e==`string`||`startRow`in e||`row`in e}constructor(e={},t){super(),this._logService=t,v(this,`type`,f.UniverType.UNIVER_SHEET),v(this,`_sheetCreated$`,new d.Subject),v(this,`sheetCreated$`,this._sheetCreated$.asObservable()),v(this,`_sheetDisposed$`,new d.Subject),v(this,`sheetDisposed$`,this._sheetDisposed$.asObservable()),v(this,`_activeSheet$`,new d.BehaviorSubject(null)),v(this,`activeSheet$`,this._activeSheet$.asObservable()),v(this,`_worksheets`,void 0),v(this,`_styles`,void 0),v(this,`_snapshot`,void 0),v(this,`_unitId`,void 0),v(this,`_count`,void 0),v(this,`_name$`,void 0),v(this,`name$`,void 0);let n=Ac();S.isEmptyObject(e)?this._snapshot=n:this._snapshot=S.commonExtend(n,e);let{styles:r}=this._snapshot;(this._snapshot.id==null||this._snapshot.id.length===0)&&(this._snapshot.id=C(6)),this._unitId=this._snapshot.id,this._styles=new jc(r),this._count=1,this._worksheets=new Map,this._name$=new d.BehaviorSubject(e.name||``),this.name$=this._name$.asObservable(),this._parseWorksheetSnapshots()}dispose(){super.dispose(),this._sheetCreated$.complete(),this._sheetDisposed$.complete(),this._activeSheet$.complete(),this._name$.complete(),Array.from(this._worksheets.keys()).forEach(e=>{this._removeSheet(e)})}save(){return S.deepClone(this._snapshot)}getSnapshot(){return this._snapshot}getName(){return this._snapshot.name}setName(e){this._name$.next(e),this._snapshot.name=e}getUnitId(){return this._unitId}getRev(){var e;return(e=this._snapshot.rev)==null?1:e}incrementRev(){this._snapshot.rev=this.getRev()+1}setRev(e){this._snapshot.rev=e}addWorksheet(e,t,n){let{sheets:r,sheetOrder:i}=this._snapshot;if(r[e])return!1;r[e]=n,i.splice(t,0,e),this.ensureSheetOrderUnique();let a=new il(this._unitId,n,this._styles);return this._worksheets.set(e,a),this._sheetCreated$.next(a),!0}getSheetOrders(){return this._snapshot.sheetOrder}ensureSheetOrderUnique(){let e=new Set,t=[];for(let n of this._snapshot.sheetOrder)e.has(n)||(e.add(n),t.push(n));this._snapshot.sheetOrder=t,e.clear()}getWorksheets(){return this._worksheets}getActiveSpreadsheet(){return this}getStyles(){return this._styles}addStyles(e){Object.entries(e).forEach(([e,t])=>{this._styles.addCustomStyle(e,t)})}removeStyles(e){e.forEach(e=>{this._styles.remove(e)})}getConfig(){return this._snapshot}getIndexBySheetId(e){let{sheetOrder:t}=this._snapshot;return t.findIndex(t=>t===e)}getActiveSheet(e){if(!this._activeSheet&&e===void 0)throw Error(`[Workbook]: no active Worksheet on Workbook ${this._unitId}!`);return this._activeSheet}ensureActiveSheet(){let e=this._activeSheet;if(e)return e;let t=this._snapshot.sheetOrder;for(let e=0,n=t.length;e<n;e++){let n=this._worksheets.get(t[e]);if(n&&n.isSheetHidden()!==E.TRUE)return this.setActiveSheet(n),n}let n=this._worksheets.get(t[0]);return this.setActiveSheet(n),n}setActiveSheet(e){this._activeSheet$.next(e)}_removeSheet(e){let t=this._worksheets.get(e);return t?(this._worksheets.delete(e),this._snapshot.sheetOrder.splice(this._snapshot.sheetOrder.indexOf(e),1),this.ensureSheetOrderUnique(),this._sheetDisposed$.next(t),!0):!1}removeSheet(e){let t=this._removeSheet(e);return t&&delete this._snapshot.sheets[e],t}getActiveSheetIndex(){let{sheetOrder:e}=this._snapshot;return e.findIndex(e=>this._worksheets.get(e)===this._activeSheet)}getSheetSize(){return this._snapshot.sheetOrder.length}getSheets(){let{sheetOrder:e}=this._snapshot;return e.map(e=>this._worksheets.get(e))}getSheetsName(){let{sheetOrder:e}=this._snapshot,t=[];return e.forEach(e=>{let n=this._worksheets.get(e);n&&t.push(n.getName())}),t}getSheetIndex(e){let{sheetOrder:t}=this._snapshot;return t.findIndex(t=>e.getSheetId()===t)}getSheetBySheetName(e){let{sheetOrder:t}=this._snapshot,n=t.find(t=>this._worksheets.get(t).getName()===e);return this._worksheets.get(n)}getSheetBySheetId(e){return this._worksheets.get(e)}getSheetByIndex(e){let{sheetOrder:t}=this._snapshot;return this._worksheets.get(t[e])}getHiddenWorksheets(){return this.getSheets().filter(e=>e.getConfig().hidden===E.TRUE).map(e=>e.getConfig().id)}getUnhiddenWorksheets(){return this.getSheets().filter(e=>e.getConfig().hidden!==E.TRUE).map(e=>e.getConfig().id)}load(e){this._snapshot=e}checkSheetName(e){return this.getSheetsName().some(t=>t.toLowerCase()===e.toLowerCase())}uniqueSheetName(e=`Sheet1`){let t=e;for(;this.checkSheetName(t);)t=e+this._count,this._count++;return t}generateNewSheetName(e){let t=e+this._count;for(;this.checkSheetName(t);)t=e+this._count,this._count++;return t}_parseWorksheetSnapshots(){let{_snapshot:e,_worksheets:t}=this,{sheets:n,sheetOrder:r}=e;if(S.isEmptyObject(n)){let e=C();n[e]={id:e}}for(let e in n){let i=n[e],{name:a}=i;i.name=this.uniqueSheetName(a),i.name!==a&&this._logService.debug(`[Workbook]`,`The worksheet name ${a} is duplicated, we changed it to ${i.name}. Please fix the problem in your snapshot.`);let o=new il(this._unitId,i,this._styles);t.set(e,o),r.includes(e)||r.push(e)}this.ensureSheetOrderUnique(),this.ensureActiveSheet()}getCustomMetadata(){return this._snapshot.custom}setCustomMetadata(e){this._snapshot.custom=e}};cl=F([P(1,N)],cl);var ll=class extends Et{get _activePage(){let e=this._activePage$.getValue();if(!e){var t,n;let e=(t=this.getPageOrder())==null?void 0:t[0];return e?(n=this.getPages())==null?void 0:n[e]:null}return e}constructor(e){var t;super(),v(this,`type`,f.UniverType.UNIVER_SLIDE),v(this,`_activePage$`,new d.BehaviorSubject(null)),v(this,`activePage$`,this._activePage$.asObservable()),v(this,`_name$`,void 0),v(this,`name$`,void 0),v(this,`_snapshot`,void 0),v(this,`_unitId`,void 0),this._snapshot={...ba,...e},this._unitId=(t=this._snapshot.id)==null?C(6):t,this._name$=new d.BehaviorSubject(this._snapshot.title),this.name$=this._name$.asObservable()}setName(e){var t;this._snapshot.title=e,this._name$.next(e),this._unitId=(t=this._snapshot.id)==null?C(6):t}getRev(){return 0}incrementRev(){}setRev(e){}getSnapshot(){return this._snapshot}getUnitId(){return this._unitId}getPages(){var e;return(e=this._snapshot.body)==null?void 0:e.pages}getPageOrder(){var e;return(e=this._snapshot.body)==null?void 0:e.pageOrder}getPage(e){let t=this.getPages();return t==null?void 0:t[e]}getElementsByPage(e){var t;return(t=this.getPage(e))==null?void 0:t.pageElements}getElement(e,t){var n;return(n=this.getElementsByPage(e))==null?void 0:n[t]}getPageSize(){return this._snapshot.pageSize}getBlankPage(){let e=C(6);return{id:e,pageType:Xn.SLIDE,zIndex:10,title:e,description:``,pageBackgroundFill:{rgb:`rgb(255,255,255)`},pageElements:{}}}setActivePage(e){this._activePage$.next(e)}getActivePage(){return this._activePage}updatePage(e,t){this._snapshot.body&&(this._snapshot.body.pages[e]=t)}appendPage(e){var t;if(!this._snapshot.body)return;this._snapshot.body.pages[e.id]=e;let n=this._activePage,r=this._snapshot.body.pageOrder.indexOf((t=n==null?void 0:n.id)==null?``:t);this._snapshot.body.pageOrder.splice(r+1,0,e.id)}};const ul=(0,l.createIdentifier)(`univer.current`);let dl=class extends x{constructor(e,t,n){super(),this._injector=e,this._contextService=t,this._logService=n,v(this,`_unitsByType`,new Map),v(this,`_createHandler`,void 0),v(this,`_ctorByType`,new Map),v(this,`_currentUnits`,new Map),v(this,`_currentUnits$`,new d.BehaviorSubject(this._currentUnits)),v(this,`currentUnits$`,this._currentUnits$.asObservable()),v(this,`_unitAdded$`,new d.Subject),v(this,`unitAdded$`,this._unitAdded$.asObservable()),v(this,`_unitDisposed$`,new d.Subject),v(this,`unitDisposed$`,this._unitDisposed$.asObservable()),v(this,`_focused$`,new d.BehaviorSubject(null)),v(this,`focused$`,this._focused$.asObservable())}dispose(){super.dispose(),this._focused$.complete(),this._currentUnits$.complete(),this._unitAdded$.complete(),this._currentUnits.forEach(e=>e==null?void 0:e.dispose()),this._currentUnits.clear(),this._unitsByType.clear()}__setCreateHandler(e){this._createHandler=e}createUnit(e,t,n){return this._createHandler(e,t,this._ctorByType.get(e),n)}registerCtorForType(e,t){return this._ctorByType.set(e,t),{dispose:()=>{this._ctorByType.delete(e)}}}getCurrentTypeOfUnit$(e){return this.currentUnits$.pipe((0,d.map)(t=>{var n;return(n=t.get(e))==null?null:n}),(0,d.distinctUntilChanged)())}getCurrentUnitForType(e){return this._currentUnits.get(e)}getCurrentUnitOfType(e){return this.getCurrentUnitForType(e)}setCurrentUnitForType(e){let t=this._getUnitById(e);if(!t)throw Error(`[UniverInstanceService]: no document with unitId ${e}!`);this._currentUnits.set(t[1],t[0]),this._currentUnits$.next(this._currentUnits)}getTypeOfUnitAdded$(e){return this._unitAdded$.pipe((0,d.filter)(t=>t.type===e))}__addUnit(e,t){var n;this._logService.debug(`[UniverInstanceService]: Adding unit with id ${e.getUnitId()}`);let r=e.type;this._unitsByType.has(r)||this._unitsByType.set(r,[]);let i=this._unitsByType.get(r),a=e.getUnitId();if(i.findIndex(e=>e.getUnitId()===a)!==-1)throw Error(`[UniverInstanceService]: cannot create a unit with the same unit id: ${a}.`);i.push(e),this._unitAdded$.next(e),((n=t==null?void 0:t.makeCurrent)==null||n)&&this.setCurrentUnitForType(e.getUnitId())}getTypeOfUnitDisposed$(e){return this.unitDisposed$.pipe((0,d.filter)(t=>t.type===e))}getUnit(e,t){var n;let r=(n=this._getUnitById(e))==null?void 0:n[0];return t&&(r==null?void 0:r.type)!==t?null:r}getCurrentUniverDocInstance(){return this.getCurrentUnitForType(f.UniverType.UNIVER_DOC)}getUniverDocInstance(e){return this.getUnit(e,f.UniverType.UNIVER_DOC)}getUniverSheetInstance(e){return this.getUnit(e,f.UniverType.UNIVER_SHEET)}getAllUnitsForType(e){var t;return(t=this._unitsByType.get(e))==null?[]:t}changeDoc(e,t){let n=this.getAllUnitsForType(f.UniverType.UNIVER_DOC),r=n.find(t=>t.getUnitId()===e);if(r!=null){let e=n.indexOf(r);n.splice(e,1)}this.__addUnit(t)}get focused(){var e;let t=this._focused$.getValue();return t?(e=this._getUnitById(t))==null?void 0:e[0]:null}focusUnit(e){this._focused$.next(e),this.focused instanceof cl?(this._contextService.setContextValue(_c,!0),this._contextService.setContextValue(yc,!1),this._contextService.setContextValue(vc,!0),this._contextService.setContextValue(bc,!1),this.setCurrentUnitForType(e)):this.focused instanceof _s?(this._contextService.setContextValue(_c,!0),this._contextService.setContextValue(yc,!0),this._contextService.setContextValue(vc,!1),this._contextService.setContextValue(bc,!1),this.setCurrentUnitForType(e)):this.focused instanceof ll?(this._contextService.setContextValue(_c,!0),this._contextService.setContextValue(yc,!1),this._contextService.setContextValue(vc,!1),this._contextService.setContextValue(bc,!0),this.setCurrentUnitForType(e)):(this._contextService.setContextValue(_c,!1),this._contextService.setContextValue(yc,!1),this._contextService.setContextValue(vc,!1),this._contextService.setContextValue(bc,!1))}getFocusedUnit(){return this.focused}getUnitType(e){let t=this._getUnitById(e);return t?t[1]:f.UniverType.UNRECOGNIZED}disposeUnit(e){this._logService.debug(`[UniverInstanceService]: Disposing unit with id ${e}`);let t=this._getUnitById(e);if(!t)return this._logService.debug(`[UniverInstanceService]: No unit found with id ${e}`),!1;let[n,r]=t,i=this._unitsByType.get(r),a=i.indexOf(n);return i.splice(a,1),this._tryResetCurrentOnRemoval(e,r),this._tryResetFocusOnRemoval(e),this._unitDisposed$.next(n),n.dispose(),!0}_tryResetCurrentOnRemoval(e,t){let n=this.getCurrentUnitForType(t);(n==null?void 0:n.getUnitId())===e&&(this._currentUnits.set(t,null),this._currentUnits$.next(this._currentUnits))}_tryResetFocusOnRemoval(e){var t;((t=this.focused)==null?void 0:t.getUnitId())===e&&this._focused$.next(null)}_getUnitById(e){for(let[t,n]of this._unitsByType){let r=n.find(t=>t.getUnitId()===e);if(r)return[r,t]}}};dl=F([P(0,(0,l.Inject)(l.Injector)),P(1,ur),P(2,(0,l.Inject)(N))],dl);let $=function(e){return e[e.Starting=0]=`Starting`,e[e.Ready=1]=`Ready`,e[e.Rendered=2]=`Rendered`,e[e.Steady=3]=`Steady`,e}({});const fl={[$.Starting]:`Starting`,[$.Ready]:`Ready`,[$.Rendered]:`Rendered`,[$.Steady]:`Steady`};var pl=class extends Error{constructor(e){super(`[LifecycleService]: lifecycle stage "${fl[e]}" will never be reached!`),this.name=`LifecycleUnreachableError`}};let ml=class extends x{constructor(e){super(),this._logService=e,v(this,`_lifecycle$`,new d.BehaviorSubject($.Starting)),v(this,`lifecycle$`,this._lifecycle$.asObservable()),v(this,`_lock`,!1),this._reportProgress($.Starting)}get stage(){return this._lifecycle$.getValue()}set stage(e){if(this._lock)throw Error(`[LifecycleService]: cannot set new stage when related logic is all handled!`);if(e<this.stage)throw Error(`[LifecycleService]: lifecycle stage cannot go backward!`);e!==this.stage&&(this._lock=!0,this._reportProgress(e),this._lifecycle$.next(e),this._lock=!1)}dispose(){this._lifecycle$.complete(),super.dispose()}onStage(e){return(0,d.firstValueFrom)(this.lifecycle$.pipe((0,d.filter)(t=>t>=e),wr(t=>t===e),(0,d.map)(()=>void 0))).catch(t=>t.name===`EmptyError`?Promise.reject(new pl(e)):Promise.reject(t))}subscribeWithPrevious(){return(0,d.merge)(hl(this.stage),this._lifecycle$.pipe((0,d.skip)(1))).pipe(wr(e=>e===$.Steady))}_reportProgress(e){this._logService.debug(`[LifecycleService]`,`lifecycle progressed to "${fl[e]}".`)}};ml=F([P(0,N)],ml);function hl(e){switch(e){case $.Starting:return(0,d.of)($.Starting);case $.Ready:return(0,d.of)($.Starting,$.Ready);case $.Rendered:return(0,d.of)($.Starting,$.Ready,$.Rendered);default:return(0,d.of)($.Starting,$.Ready,$.Rendered,$.Steady)}}const gl=(0,l.createIdentifier)(`ILocalStorageService`);var _l=class extends x{get _currentLocale(){return this._currentLocale$.value}constructor(){super(),v(this,`_currentLocale$`,new d.BehaviorSubject(Zt.ZH_CN)),v(this,`currentLocale$`,this._currentLocale$.asObservable()),v(this,`_locales`,null),v(this,`localeChanged$`,new d.Subject),v(this,`t`,(e,...t)=>{if(!this._locales)throw Error(`[LocaleService]: Locale not initialized`);let n=e.split(`.`),r=this.resolveKeyPath(this._locales[this._currentLocale],n);if(typeof r==`string`){let e=r;return t.forEach((t,n)=>{e=e.replace(`{${n}}`,t)}),e}else return e}),this.disposeWithMe(b(()=>{this._locales=null,this._currentLocale$.complete(),this.localeChanged$.complete()}))}load(e){var t;this._locales=(0,u.merge)((t=this._locales)==null?{}:t,e)}setLocale(e){this._currentLocale$.next(e),this.localeChanged$.next()}getLocales(){var e;return(e=this._locales)==null?void 0:e[this._currentLocale]}getCurrentLocale(){return this._currentLocale}resolveKeyPath(e,t){let n=t.shift();if(n&&e&&n in e){let r=e[n];return t.length>0&&(typeof r==`object`||Array.isArray(r))?this.resolveKeyPath(r,t):r}return null}};let vl=class{constructor(e){this._userManagerService=e}async list(e){return{list:[{type:Qt.PERSON,mentions:[{objectType:Qt.PERSON,objectId:this._userManagerService.getCurrentUser().userID,label:this._userManagerService.getCurrentUser().name,metadata:{icon:this._userManagerService.getCurrentUser().avatar}}],metadata:{},title:`PEOPLE`}],page:e.page,size:e.size,total:1}}};vl=F([P(0,(0,l.Inject)(fc))],vl);const yl=(0,l.createIdentifier)(`univer.service.mention-io`);let bl=function(e){return e.INIT=`init`,e.FETCHING=`fetching`,e.DONE=`done`,e}({});const xl=(0,l.createIdentifier)(`univer.permission-service`);var Sl=class extends x{constructor(...e){super(...e),v(this,`_permissionPointMap`,new Map),v(this,`_permissionPointUpdate$`,new d.Subject),v(this,`permissionPointUpdate$`,this._permissionPointUpdate$.asObservable()),v(this,`_showComponents`,!0)}setShowComponents(e){this._showComponents=e}getShowComponents(){return this._showComponents}deletePermissionPoint(e){let t=this._permissionPointMap.get(e);t&&(t.complete(),this._permissionPointMap.delete(e))}addPermissionPoint(e){let t=e instanceof d.BehaviorSubject,n=t?e.getValue():e;return n.id?this._permissionPointMap.get(n.id)?(console.warn(`${n.id} PermissionPoint already exists`),!1):(this._permissionPointMap.set(n.id,t?e:new d.BehaviorSubject(n)),this._permissionPointUpdate$.next(n),!0):!1}updatePermissionPoint(e,t){let n=this._permissionPointMap.get(e);if(!n)return;let r=n.getValue();r.value=t,r.status=bl.DONE,n.next(r),this._permissionPointUpdate$.next(r)}clearPermissionMap(){this._permissionPointMap.clear()}getPermissionPoint(e){let t=this._permissionPointMap.get(e);if(t)return t.getValue()}getPermissionPoint$(e){let t=this._permissionPointMap.get(e);if(t)return t}composePermission$(e){return(0,d.combineLatest)(e.map(e=>{var t;let n=(t=this._permissionPointMap)==null?void 0:t.get(e);if(!n)throw Error(`[PermissionService]: ${e} permissionPoint does not exist!`);return n.asObservable()})).pipe((0,h.map)(e=>e))}composePermission(e){return e.map(e=>{var t;let n=(t=this._permissionPointMap)==null?void 0:t.get(e);if(!n)throw Error(`[PermissionService]: ${e} permissionPoint does not exist!`);return n.getValue()})}getAllPermissionPoint(){let e=new Map;return this._permissionPointMap.forEach((t,n)=>{e.set(n,t)}),e}};function Cl(e,t){if(!t)return e;let n=[];for(let r of e){let e=t.find(([e])=>e===r[0]);if(e){if(e[1]===null)continue;n.push([r[0],e[1]])}else n.push(r)}return n}const wl=Symbol(`DependentOn`);var Tl=class extends x{onStarting(){}onReady(){}onRendered(){}onSteady(){}getUnitType(){return this.constructor.type}getPluginName(){return this.constructor.pluginName}};v(Tl,`pluginName`,void 0),v(Tl,`packageName`,Oc),v(Tl,`version`,kc),v(Tl,`type`,f.UniverType.UNIVER_UNKNOWN);var El=class{constructor(){v(this,`_plugins`,[])}addPlugin(e){this._plugins.push(e)}removePlugins(){let e=this._plugins.slice();return this._plugins.length=0,e}forEachPlugin(e){this._plugins.forEach(e)}};function Dl(...e){return function(t){t[wl]=e}}let Ol=class{constructor(e,t,n){this._injector=e,this._lifecycleService=t,this._logService=n,v(this,`_pluginRegistry`,new Map),v(this,`_pluginStore`,new El),v(this,`_seenPlugins`,new Set),v(this,`_loadedPlugins`,new Set),v(this,`_loadedPluginTypes`,new Set([f.UniverType.UNIVER_UNKNOWN])),v(this,`_flushTimerByType`,new Map)}dispose(){this._pluginStore.removePlugins().forEach(e=>e.dispose()),this._flushTimerByType.forEach(e=>clearTimeout(e))}registerPlugin(e,t){this._assertPluginValid(e);let n={plugin:e,options:t};this._pluginRegistry.set(e.pluginName,n),this._logService.debug(`[PluginService]`,`Plugin "${e.pluginName}" registered.`);let{type:r}=e;this._loadedPluginTypes.has(r)&&(r===f.UniverType.UNIVER_UNKNOWN?this._loadFromPlugins([n]):this._flushType(r))}startPluginsForType(e){this._loadedPluginTypes.has(e)||this._loadPluginsForType(e)}_loadPluginsForType(e){let t=Array.from(this._pluginRegistry.keys()),n=[];t.forEach(t=>{let r=this._pluginRegistry.get(t);r.plugin.type===e&&n.push(r)}),this._loadFromPlugins(n),this._loadedPluginTypes.add(e)}_assertPluginValid(e){let{type:t,pluginName:n,packageName:r,version:i}=e;if(t===f.UniverType.UNRECOGNIZED)throw Error(`[PluginService]: invalid plugin type for ${e.name}. Please assign a "type" to your plugin.`);if(!n)throw Error(`[PluginService]: no plugin name for ${e.name}. Please assign a "pluginName" to your plugin.`);if(i&&i!==Tl.version)throw Error(`[PluginService]: package "${r==null?`UNKNOWN`:r}" version mismatch. Plugin version is "${i}" but @univerjs/core version is "${Tl.version}". Please make sure all @univerjs packages use the same version.`);if(this._seenPlugins.has(n))throw Error(`[PluginService]: duplicated plugin name for "${n}". Maybe a plugin that dependents on "${n} has already registered it. In that case please register "${n}" before the that plugin.`);this._seenPlugins.add(e.pluginName)}_flushType(e){this._flushTimerByType.get(e)===void 0&&this._flushTimerByType.set(e,setTimeout(()=>{this._loadPluginsForType(e),this._flushTimerByType.delete(e)},4))}_loadFromPlugins(e){let t=[],n=new Set,r=e=>{let{plugin:i}=e,{pluginName:a}=i;if(this._loadedPlugins.has(a)||n.has(a))return;n.add(a),this._pluginRegistry.delete(a);let o=i[wl];o&&o.forEach(e=>{let t=this._pluginRegistry.get(e.pluginName);if(t)r(t);else if(!this._seenPlugins.has(e.pluginName)&&!n.has(e.pluginName)){if(i.type===f.UniverType.UNIVER_UNKNOWN&&e.type!==f.UniverType.UNIVER_UNKNOWN)throw Error(`[PluginService]: cannot register a plugin with Univer type that depends on a plugin with other type. The dependent is ${i.pluginName} and the dependency is ${e.pluginName}.`);i.type!==e.type&&e.type!==f.UniverType.UNIVER_UNKNOWN&&this._logService.debug(`[PluginService]`,`Plugin "${a}" depends on "${e.pluginName}" which has different type.`),this._logService.debug(`[PluginService]`,`Plugin "${a}" depends on "${e.pluginName}" which is not registered. Univer will automatically register it with default configuration.`),this._assertPluginValid(e),r({plugin:e,options:void 0})}}),t.push(e)};e.forEach(e=>r(e));let i=t.map(e=>this._initPlugin(e.plugin,e.options));this._pluginsRunLifecycle(i)}_pluginsRunLifecycle(e){let t=this._lifecycleService.stage;if(hl(t).subscribe(t=>this._runStage(e,t)),t!==$.Steady){let t=this._lifecycleService.lifecycle$.pipe((0,d.skip)(1)).subscribe(n=>{this._runStage(e,n),n===$.Steady&&t.unsubscribe()})}}_runStage(e,t){e.forEach(e=>{switch(t){case $.Starting:e.onStarting();break;case $.Ready:e.onReady();break;case $.Rendered:e.onRendered();break;case $.Steady:e.onSteady();break}})}_initPlugin(e,t){let n=this._injector.createInstance(e,t);return this._pluginStore.addPlugin(n),this._loadedPlugins.add(e.pluginName),this._logService.debug(`[PluginService]`,`Plugin "${n.getPluginName()}" loaded.`),n}};Ol=F([P(0,(0,l.Inject)(l.Injector)),P(1,(0,l.Inject)(ml)),P(2,N)],Ol);const kl=(0,l.createIdentifier)(`resource-loader-service`);let Al=class extends x{constructor(e){super(),this._logService=e,v(this,`_resourceMap`,new Map),v(this,`_register$`,new d.Subject),v(this,`register$`,this._register$.asObservable())}getAllResourceHooks(){return[...this._resourceMap.values()]}getResources(e,t){return t?this.getResourcesByType(e,t):this.getAllResourceHooks().map(t=>{let n=t.toJson(e);return{name:t.pluginName,data:n}})}getResourcesByType(e,t){return this.getAllResourceHooks().filter(e=>e.businesses.includes(t)).map(t=>{let n=t.toJson(e);return{name:t.pluginName,data:n}})}registerPluginResource(e){let t=e.pluginName;if(this._resourceMap.has(t))throw Error(`the pluginName is registered {${t}}`);return this._resourceMap.set(t,e),this._register$.next(e),b(()=>this._resourceMap.delete(t))}disposePluginResource(e){this._resourceMap.delete(e)}loadResources(e,t){this.getAllResourceHooks().forEach(n=>{var r;let i=t==null||(r=t.find(e=>e.name===n.pluginName))==null?void 0:r.data;if(i)try{let t=n.parseJson(i);n.onLoad(e,t)}catch(e){this._logService.error(`[ResourceManagerService]`,`loadResources error`,e)}})}unloadResources(e,t){this.getAllResourceHooks().filter(e=>e.businesses.includes(t)).forEach(t=>{t.onUnLoad(e)})}dispose(){this._register$.complete(),this._resourceMap.clear()}};Al=F([P(0,N)],Al);var jl=class extends x{get darkMode(){return this._darkMode$.getValue()}constructor(){super(),v(this,`_darkMode$`,new d.BehaviorSubject(!1)),v(this,`darkMode$`,this._darkMode$.asObservable()),v(this,`_validColorCache`,new Map),v(this,`_currentTheme`,ue.defaultTheme),v(this,`_currentTheme$`,new d.BehaviorSubject(this._currentTheme)),v(this,`currentTheme$`,this._currentTheme$.asObservable()),this.disposeWithMe(b(()=>{this._currentTheme=ue.defaultTheme,this._currentTheme$.complete(),this._darkMode$.complete()}))}isValidThemeColor(e){if(this._validColorCache.has(e))return this._validColorCache.get(e);let t=!1,n=e.split(`.`);if(n.length===1)t=e in ue.defaultTheme;else if(n.length===2){let[e,r]=n;t=e in ue.defaultTheme&&r in this._currentTheme[e]}return this._validColorCache.set(e,t),t}getCurrentTheme(){return this._currentTheme}setTheme(e){this._currentTheme=e,this._currentTheme$.next(e)}setDarkMode(e){this._darkMode$.next(e)}getColorFromTheme(e){return(0,u.get)(this._currentTheme,e)}},Ml=function(e){return e[e.WAITING=0]=`WAITING`,e[e.CREATED=1]=`CREATED`,e}(Ml||{});const Nl=(0,l.createIdentifier)(`univer.undo-redo.service`);var Pl=class{dispose(){}async dispatchToHandlers(){return!1}};const Fl=`univer.command.redo`,Il=`univer.command.undo`,Ll=new class extends Pl{constructor(...e){super(...e),v(this,`type`,I.COMMAND),v(this,`id`,Il)}handler(e){let t=e.get(Nl),n=t.pitchTopUndoElement();if(!n)return!1;let r=e.get(gr);return xr(n.undoMutations,r)?(t.popUndoToRedo(),!0):!1}},Rl=new class extends Pl{constructor(...e){super(...e),v(this,`type`,I.COMMAND),v(this,`id`,Fl)}handler(e){let t=e.get(Nl),n=t.pitchTopRedoElement();if(!n)return!1;let r=e.get(gr);return xr(n.redoMutations,r)?(t.popRedoToUndo(),!0):!1}};let zl=class extends x{constructor(e,t,n){super(),this._univerInstanceService=e,this._commandService=t,this._contextService=n,v(this,`undoRedoStatus$`,void 0),v(this,`_undoRedoStatus$`,new d.BehaviorSubject({undos:0,redos:0})),v(this,`_undoStacks`,new Map),v(this,`_redoStacks`,new Map),v(this,`_batchingStatus`,new Map),this.undoRedoStatus$=this._undoRedoStatus$.asObservable(),this.disposeWithMe(this._commandService.registerCommand(Ll)),this.disposeWithMe(this._commandService.registerCommand(Rl)),this.disposeWithMe(b(()=>this._undoRedoStatus$.complete())),this.disposeWithMe(b(this._univerInstanceService.focused$.subscribe(()=>this._updateStatus())))}pushUndoRedo(e){let{unitID:t}=e,n=this._getRedoStack(t,!0),r=this._getUndoStack(t,!0);if(n.length=0,this._batchingStatus.has(e.unitID)){let t=this._batchingStatus.get(e.unitID),n=this._pitchUndoElement(e.unitID);t===Ml.WAITING||!n?(i(e),this._batchingStatus.set(e.unitID,Ml.CREATED)):this._tryBatchingElements(n,e)}else i(e);function i(e){r.push(e),r.length>20&&r.splice(0,1)}this._updateStatus()}clearUndoRedo(e){let t=this._getRedoStack(e);t&&(t.length=0);let n=this._getUndoStack(e);n&&(n.length=0),this._updateStatus()}pitchTopUndoElement(){let e=this._getFocusedUnitId();return this._pitchUndoElement(e)}pitchTopRedoElement(){let e=this._getFocusedUnitId();return this._pitchRedoElement(e)}_pitchUndoElement(e){let t=this._getUndoStack(e);return t!=null&&t.length?t[t.length-1]:null}_pitchRedoElement(e){let t=this._getRedoStack(e);return t!=null&&t.length?t[t.length-1]:null}popUndoToRedo(){let e=this._getUndoStackForFocused().pop();e&&(e.redoMutations.length>0&&this._getRedoStackForFocused().push(e),this._updateStatus())}popRedoToUndo(){let e=this._getRedoStackForFocused().pop();e&&(this._getUndoStackForFocused().push(e),this._updateStatus())}rollback(e,t){let n=t||this._getFocusedUnitId(),r=this._getUndoStack(n),i=r==null?void 0:r[(r==null?void 0:r.length)-1];i&&i.id===e&&(r.pop(),xr(i.undoMutations,this._commandService))}__tempBatchingUndoRedo(e){if(this._batchingStatus.has(e))throw Error(`[LocalUndoRedoService]: cannot batching undo redo twice at the same time!`);return this._batchingStatus.set(e,Ml.WAITING),b(()=>this._batchingStatus.delete(e))}_updateStatus(){var e,t;let n=this._getFocusedUnitId(),r=n&&((e=this._undoStacks.get(n))==null?void 0:e.length)||0,i=n&&((t=this._redoStacks.get(n))==null?void 0:t.length)||0;this._undoRedoStatus$.next({undos:r,redos:i})}_getUndoStack(e,t=!1){let n=this._undoStacks.get(e);return!n&&t&&(n=[],this._undoStacks.set(e,n)),n||null}_getRedoStack(e,t=!1){let n=this._redoStacks.get(e);return!n&&t&&(n=[],this._redoStacks.set(e,n)),n||null}_getUndoStackForFocused(){let e=this._getFocusedUnitId();if(!e)throw Error(`No focused univer instance!`);return this._getUndoStack(e,!0)}_getRedoStackForFocused(){let e=this._getFocusedUnitId();if(!e)throw Error(`No focused univer instance!`);return this._getRedoStack(e,!0)}_tryBatchingElements(e,t){e.redoMutations.push(...t.redoMutations),e.undoMutations.push(...t.undoMutations)}_getFocusedUnitId(){let e=``,t=this._contextService.getContextValue(vc),n=this._contextService.getContextValue(Sc),r=this._contextService.getContextValue(xc);if(t)if(n)e=Oe;else if(r)e=De;else{var i,a;e=(i=(a=this._univerInstanceService.getFocusedUnit())==null?void 0:a.getUnitId())==null?``:i}else{var o,s;e=(o=(s=this._univerInstanceService.getFocusedUnit())==null?void 0:s.getUnitId())==null?``:o}return e}};zl=F([P(0,ul),P(1,gr),P(2,ur)],zl);var Bl=class{constructor(e,t=1e3){this._injector=e,v(this,`_imageCacheMap`,void 0),this._imageCacheMap=new da(t)}_getImageCacheKey(e,t){return`${e}-${t}`}getImage(e,t,n,r){let i=this._getImageCacheKey(e,t);return this._imageCacheMap.get(i)||((async()=>{let a=new Image,o=this._injector.has(Ec)?this._injector.get(Ec):null,s=this._injector.has(Dc)?this._injector.get(Dc):null;if(e===wc.UUID)try{a.src=await(o==null?void 0:o.getImage(t))||``}catch(e){console.error(e)}else if(e===wc.URL)try{a.src=await(s==null?void 0:s.getImage(t))||t}catch{a.src=t}else a.src=t;a.onload=()=>{a.removeAttribute(`data-error`),n==null||n()},a.onerror=()=>{a.setAttribute(`data-error`,`true`),r==null||r()},this._imageCacheMap.set(i,a)})(),null)}};function Vl(e){return!(e.length===0||e.length>31||e.startsWith(`'`)||e.endsWith(`'`)||/[:\\\/\?\*\[\]]/.test(e))}function Hl(e,t){return!(!e||e.length===0||e.length>255||t.has(e)||/[ :\\\/\?\*\[\]]/.test(e)||!/^[\p{L}_]/u.test(e)||/^\$?[A-Za-z]{1,3}\$?[0-9]+$/.test(e)||/^[rR]\d+[cC]\d+$/.test(e)||/^\d+$/.test(e))}var Ul=class{constructor(e=!1){this._enableOneCellCache=e,v(this,`_tree`,new Map),v(this,`_oneCellCache`,new Map),v(this,`_kdTree`,new Map)}dispose(){this.clear()}getTree(e,t){return this._tree.has(e)||this._tree.set(e,new Map),this._tree.get(e).has(t)||this._tree.get(e).set(t,new ce.default),this._tree.get(e).get(t)}_getOneCellCache(e,t,n,r){return this._oneCellCache.has(e)||this._oneCellCache.set(e,new Map),this._oneCellCache.get(e).has(t)||this._oneCellCache.get(e).set(t,new Map),this._oneCellCache.get(e).get(t).has(n)||this._oneCellCache.get(e).get(t).set(n,new Map),this._oneCellCache.get(e).get(t).get(n).has(r)||this._oneCellCache.get(e).get(t).get(n).set(r,new Set),this._oneCellCache.get(e).get(t).get(n).get(r)}_removeOneCellCache(e,t,n,r,i){let a=this._oneCellCache.get(e);if(!a)return;let o=a.get(t);if(!o)return;let s=o.get(n);if(!s)return;let c=s.get(r);c&&c.delete(i)}_removeCellCacheByRange(e){let{unitId:t,sheetId:n,range:r,id:i}=e,a=this._oneCellCache.get(t);if(!a)return;let o=a.get(n);if(!o)return;let{startRow:s,startColumn:c,endRow:l,endColumn:u}=r;for(let e=s;e<=l;e++){let t=o.get(e);if(t)for(let e=c;e<=u;e++){let n=t.get(e);n&&n.delete(i)}}}_insertOneCellCache(e,t,n,r,i){this._getOneCellCache(e,t,n,r).add(i)}_getRdTreeItems(e){let t=[];for(let[n,r]of e)for(let[e,i]of r)t.push({x:e,y:n,ids:i});return t}_searchByOneCellCache(e){var t;let{unitId:n,sheetId:r,range:i}=e,{startRow:a,startColumn:o,endRow:s,endColumn:c}=i,l=(t=this._kdTree.get(n))==null?void 0:t.get(r);if(!l)return[];let{tree:u,items:d}=l,f=u.range(o,a,c,s),p=[];for(let e of f){let t=d[e];p.push(...Array.from(t.ids))}return p}openKdTree(){for(let[t,n]of this._oneCellCache){this._kdTree.has(t)||this._kdTree.set(t,new Map);for(let[r,i]of n){var e;let n=this._getRdTreeItems(i),a=new de.default(n.length);(e=this._kdTree.get(t))==null||e.set(r,{tree:a,items:n});for(let e of n)a.add(e.x,e.y);a.finish()}}}closeKdTree(){for(let[t,n]of this._oneCellCache)for(let[r,i]of n){var e;(e=this._kdTree.get(t))==null||e.set(r,void 0)}}insert(e){let{unitId:t,sheetId:n,range:r,id:i}=e;if(!t||t.length===0)return;let{startRow:a,endRow:o,startColumn:s,endColumn:c}=r;if(this._enableOneCellCache&&a===o&&s===c){this._insertOneCellCache(t,n,a,s,i);return}let l=this.getTree(t,n);Number.isNaN(a)&&(a=0),Number.isNaN(s)&&(s=0),Number.isNaN(o)&&(o=1/0),Number.isNaN(c)&&(c=1/0),l.insert({minX:s,minY:a,maxX:c,maxY:o,id:i})}bulkInsert(e){for(let t of e)this.insert(t)}*searchGenerator(e){var t;let{unitId:n,sheetId:r,range:i}=e;if(this._enableOneCellCache){let t=this._searchByOneCellCache(e);for(let e of t)yield e}let a=(t=this._tree.get(n))==null?void 0:t.get(r);if(!a)return;let o=a.search({minX:i.startColumn,minY:i.startRow,maxX:i.endColumn,maxY:i.endRow});for(let e of o)yield e.id}bulkSearch(e,t){let n=new Set;for(let r of e)for(let e of this.searchGenerator(r))(t==null?void 0:t.has(e))!==!0&&n.add(e);return n}removeById(e,t){if(t){var n,r;(n=this._tree.get(e))==null||n.delete(t),(r=this._oneCellCache.get(e))==null||r.delete(t)}else this._tree.delete(e),this._oneCellCache.delete(e)}_removeRTreeItem(e){let{unitId:t,sheetId:n,range:r,id:i}=e,a=this.getTree(t,n),o=a.search({minX:r.startColumn,minY:r.startRow,maxX:r.endColumn,maxY:r.endRow});for(let e=0;e<o.length;e++)o[e].id===i&&a.remove(o[e])}remove(e){let{unitId:t,sheetId:n,range:r,id:i}=e,{startRow:a,startColumn:o,endRow:s,endColumn:c}=r;this._enableOneCellCache?a===s&&o===c?this._removeOneCellCache(t,n,r.startRow,r.startColumn,i):(this._removeCellCacheByRange(e),this._removeRTreeItem(e)):this._removeRTreeItem(e)}bulkRemove(e){for(let t of e)this.remove(t)}clear(){this._tree.clear(),this._oneCellCache.clear()}toJSON(){let e={};return this._tree.forEach((t,n)=>{e[n]={},t.forEach((t,r)=>{e[n][r]=t.toJSON()})}),e}fromJSON(e){this._tree.clear();for(let t in e){this._tree.set(t,new Map);for(let n in e[t]){let r=new ce.default;r.fromJSON(e[t][n]),this._tree.get(t).set(n,r)}}}};function Wl(e){return new Promise(t=>setTimeout(t,e))}function Gl(e=1){return new Promise(t=>{let n=0,r=()=>{n++,n>=e?t():requestAnimationFrame(r)};requestAnimationFrame(r)})}let Kl=class extends x{constructor(e){super(),this._localeService=e,v(this,`_fontLocale`,void 0),v(this,`_dirty`,!0),this._localeInitial()}get dirty(){return this._dirty}getFontLocale(){return this._fontLocale}makeDirty(e){this._dirty=e}dispose(){super.dispose(),this._fontLocale=null}_localeInitial(){}};Kl=F([P(0,(0,l.Inject)(_l))],Kl);let ql=class extends Kl{constructor(e,t,n,r,i,a){super(n),this.worksheet=e,this._styles=t,this._contextService=r,this._configService=i,this._injector=a,v(this,`_worksheetData`,void 0),v(this,`_renderRawFormula`,!1),v(this,`_cellData`,void 0),v(this,`_imageCacheMap`,void 0),v(this,`_skipAutoHeightForMergedCells`,!0),v(this,`_rowTotalHeight`,0),v(this,`_columnTotalWidth`,0),v(this,`_rowHeaderWidth`,0),v(this,`_columnHeaderHeight`,0),v(this,`_rowHeightAccumulation`,[]),v(this,`_columnWidthAccumulation`,[]),v(this,`_marginTop`,0),v(this,`_marginLeft`,0),v(this,`_scaleX`,void 0),v(this,`_scaleY`,void 0),v(this,`_scrollX`,void 0),v(this,`_scrollY`,void 0),this._worksheetData=this.worksheet.getConfig(),this._cellData=this.worksheet.getCellMatrix(),this._imageCacheMap=new Bl(this._injector),this.initConfig()}initConfig(){var e,t;this._skipAutoHeightForMergedCells=!((e=this._configService.getConfig(je))!=null&&e),this.worksheet.setIsRowStylePrecedeColumnStyle((t=this._configService.getConfig(`isRowStylePrecedeColumnStyle`))==null?!1:t)}resetCache(){}getWorksheetConfig(){return this._worksheetData}getLocation(){return[this.worksheet.getUnitId(),this.worksheet.getSheetId()]}set columnHeaderHeight(e){this._columnHeaderHeight=e,this._worksheetData.columnHeader.height=e}set rowHeaderWidth(e){this._rowHeaderWidth=e,this._worksheetData.rowHeader.width=e}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(e){this._marginLeft=e}setMarginTop(e){this._marginTop=e}setScale(e,t){this._updateLayout(),this._scaleX=e,this._scaleY=t||e,this._updateLayout()}setScroll(e,t){S.isDefine(e)&&(this._scrollX=e),S.isDefine(t)&&(this._scrollY=t)}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(e,t,n){let r=0,i=[],a=t;for(let t=0;t<e;t++){let e=n;if(this.worksheet.getRowFiltered(t))e=0;else if(a[t]!=null){let r=a[t];if(!r)continue;let{h:i=n,ah:o,ia:s}=r;e=(s==null||s===E.TRUE)&&typeof o==`number`&&o>0?o:i,r.hd===E.TRUE&&(e=0)}r+=e,i.push(r)}return{rowTotalHeight:r,rowHeightAccumulation:i}}_generateColumnMatrixCache(e,t,n){let r=0,i=[],a=t;for(let t=0;t<e;t++){let e=n;if(a[t]!=null){let n=a[t];if(!n)continue;n.w!=null&&(e=n.w),n.hd===E.TRUE&&(e=0)}r+=e,i.push(r)}return{columnTotalWidth:r,columnWidthAccumulation:i}}intersectMergeRange(e,t){return!!this.worksheet.getMergedCell(e,t)}_getOverflowBound(e,t,n,r,i=T.LEFT){let a=0;if(t>n){let o=this._columnWidthAccumulation.length-1;for(let s=t;s>=n;s--){let n=s;if(!Mi(this.worksheet.getCell(e,n))&&n!==t||this.intersectMergeRange(e,n))return n===t?n:n+1>o?o:n+1;let{startX:c,endX:l}=Xl(e,n,this.rowHeightAccumulation,this.columnWidthAccumulation);if(i===T.CENTER&&n===t?a+=(l-c)/2:a+=l-c,r<a)return n}return t}for(let o=t;o<=n;o++){let n=o;if(!Mi(this.worksheet.getCell(e,n))&&n!==t||this.intersectMergeRange(e,n))return n===t?n:n-1<0?0:n-1;let{startX:s,endX:c}=Xl(e,n,this.rowHeightAccumulation,this.columnWidthAccumulation);if(i===T.CENTER&&n===t?a+=(c-s)/2:a+=c-s,r<a)return n}return n}_updateLayout(){if(!this.dirty)return;let{rowData:e,columnData:t,defaultRowHeight:n,defaultColumnWidth:r,rowCount:i,columnCount:a,rowHeader:o,columnHeader:s}=this._worksheetData,{rowTotalHeight:c,rowHeightAccumulation:l}=this._generateRowMatrixCache(i,e,n),{columnTotalWidth:u,columnWidthAccumulation:d}=this._generateColumnMatrixCache(a,t,r);this._rowHeaderWidth=o.hidden===E.TRUE?0:this._dynamicallyUpdateRowHeaderWidth(o),this._columnHeaderHeight=s.hidden===E.TRUE?0:s.height,this._rowTotalHeight=c,this._rowHeightAccumulation=l,this._columnTotalWidth=u,this._columnWidthAccumulation=d,this.makeDirty(!1)}calculate(){return this.resetCache(),this._updateLayout(),this}resetRangeCache(e){}_dynamicallyUpdateRowHeaderWidth(e){let t=`${this.worksheet.getRowCount()}`.length*8;return Math.max(e.width,t)}_hasUnMergedCellInRow(e,t,n){if(!this.worksheet.getMergeData())return!1;for(let r=t;r<=n;r++){let{isMerged:t,isMergedMainCell:n}=this.worksheet.getCellInfoInMergeData(e,r);if(!t&&!n)return!0}return!1}expandRangeByMerge(e,t){let{startRow:n,startColumn:r,endRow:i,endColumn:a}=e,o=this._worksheetData.mergeData;if(!o)return{startRow:n,startColumn:r,endRow:i,endColumn:a};let s=!0,c=new Di,l=0,u=null;for(;s;){s=!1;for(let e=0;e<o.length;e++){let{startRow:t,startColumn:d,endRow:f,endColumn:p}=o[e];if(c.getValue(t,d))continue;let m={startColumn:r,startRow:n,endColumn:a,endRow:i},h={startColumn:d,startRow:t,endColumn:p,endRow:f};Fa(m,h)&&(n=Math.min(n,t),r=Math.min(r,d),i=Math.max(i,f),a=Math.max(a,p),c.setValue(t,d,!0),s=!0,l++,u=h)}}return t&&l===1&&U.contains(u,e)?{startRow:u.startRow,startColumn:u.startColumn,endRow:u.startRow,endColumn:u.startColumn}:{startRow:n,startColumn:r,endRow:i,endColumn:a}}getColumnCount(){return this._columnWidthAccumulation.length}getRowCount(){return this._rowHeightAccumulation.length}_getCellMergeInfo(e,t){return this.worksheet.getCellInfoInMergeData(e,t)}getNoMergeCellPositionByIndex(e,t,n=!0){return this.getNoMergeCellWithCoordByIndex(e,t,n)}getNoMergeCellWithCoordByIndex(e,t,n=!0){let{rowHeightAccumulation:r,columnWidthAccumulation:i,rowHeaderWidthAndMarginLeft:a,columnHeaderHeightAndMarginTop:o}=this,{startY:s,endY:c,startX:l,endX:u}=Xl(e,t,r,i);return n&&(s+=o,c+=o,l+=a,u+=a),{startY:s,endY:c,startX:l,endX:u}}getNoMergeCellPositionByIndexWithNoHeader(e,t){let{rowHeightAccumulation:n,columnWidthAccumulation:r}=this,{startY:i,endY:a,startX:o,endX:s}=Xl(e,t,n,r);return{startY:i,endY:a,startX:o,endX:s}}getRowIndexByOffsetY(e,t,n,r){let{rowHeightAccumulation:i}=this;e=Ql(e,t,n,this.columnHeaderHeightAndMarginTop);let a=Mr(i,e,r==null?void 0:r.firstMatch);if(r!=null&&r.closeFirst){var o;Math.abs(i[a]-e)<Math.abs(e-((o=i[a-1])==null?0:o))&&(a+=1)}return a}getColumnIndexByOffsetX(e,t,n,r){let i=Zl(e,t,n,this.rowHeaderWidthAndMarginLeft),{columnWidthAccumulation:a}=this,o=Mr(a,i,r==null?void 0:r.firstMatch);if(r!=null&&r.closeFirst){var s;Math.abs(a[o]-i)<Math.abs(i-((s=a[o-1])==null?0:s))&&(o+=1)}return o}getCellIndexByOffset(e,t,n,r,i,a){return{row:this.getRowIndexByOffsetY(t,r,i,a),column:this.getColumnIndexByOffsetX(e,n,i,a)}}getCellByOffset(e,t,n,r,i){var a;let o=(a=this)==null?void 0:a.getCellIndexByOffset(e,t,n,r,i,{firstMatch:!0});return o?this.worksheet.getCellInfoInMergeData(o.row,o.column):null}getCellWithCoordByIndex(e,t,n=!0){var r;let{rowHeightAccumulation:i,columnWidthAccumulation:a,rowHeaderWidthAndMarginLeft:o,columnHeaderHeightAndMarginTop:s}=this,c=Xl(e,t,i,a,(r=this.worksheet)==null?void 0:r.getCellInfoInMergeData(e,t)),{isMerged:l,isMergedMainCell:u}=c,{startY:d,endY:f,startX:p,endX:m,mergeInfo:h}=c,g=o,_=s;return n===!1&&(g=0,_=0),d+=_,f+=_,p+=g,m+=g,h.startY+=_,h.endY+=_,h.startX+=g,h.endX+=g,{actualRow:e,actualColumn:t,startX:p,startY:d,endX:m,endY:f,isMerged:l,isMergedMainCell:u,mergeInfo:h}}getCellWithCoordByOffset(e,t,n,r,i,a){let{row:o,column:s}=this.getCellIndexByOffset(e,t,n,r,i,a);return this.getCellWithCoordByIndex(o,s)}getOffsetByColumn(e){let{columnWidthAccumulation:t,rowHeaderWidthAndMarginLeft:n}=this,r=t.length-1,i=t[e];return i==null?e<0?n:t[r]+n:i+n}getOffsetByRow(e){let{rowHeightAccumulation:t,columnHeaderHeightAndMarginTop:n}=this,r=t.length-1,i=t[e];return i==null?e<0?n:t[r]+n:i+n}getOffsetRelativeToRowCol(e,t){let n=Mr(this.columnWidthAccumulation,e),r=0;r=n===0?e:e-this._columnWidthAccumulation[n-1];let i=Mr(this.rowHeightAccumulation,t),a=0;return a=i===0?t:t-this._rowHeightAccumulation[i-1],{row:i,column:n,columnOffset:r,rowOffset:a}}_updateConfigAndGetDocumentModel(e,t,n,r){var i,a,o,s,c;if(!r||!((i=e.body)!=null&&i.dataStream))return;e.documentStyle||(e.documentStyle={}),e.documentStyle.marginTop=(a=n.t)==null?0:a,e.documentStyle.marginBottom=(o=n.b)==null?2:o,e.documentStyle.marginLeft=(s=n.l)==null?2:s,e.documentStyle.marginRight=(c=n.r)==null?2:c,e.documentStyle.pageSize={width:1/0,height:1/0},e.documentStyle.renderConfig={...e.documentStyle.renderConfig,...r};let l=e.body.paragraphs||[];for(let e of l)e.paragraphStyle||(e.paragraphStyle={}),e.paragraphStyle.horizontalAlign=t;return new _s(e)}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,this.worksheet=null}};ql=F([P(2,(0,l.Inject)(_l)),P(3,ur),P(4,cr),P(5,(0,l.Inject)(l.Injector))],ql);function Jl(e,t,n,r){let i=e-1,a=t-1,o=n[i]||0,s=n[e];s==null&&(s=n[n.length-1]);let c=r[a]||0,l=r[t];return l==null&&(l=r[r.length-1]),{startY:o,endY:s,startX:c,endX:l}}function Yl(e,t,n,r){return Jl(e,t,n,r)}function Xl(e,t,n,r,i){e=S.clamp(e,0,n.length-1),t=S.clamp(t,0,r.length-1);let{startY:a,endY:o,startX:s,endX:c}=Jl(e,t,n,r);if(!i)return{startY:a,endY:o,startX:s,endX:c,isMerged:!1,isMergedMainCell:!1,actualRow:e,actualColumn:t,mergeInfo:{startY:a,endY:o,startX:s,endX:c,startRow:e,startColumn:t,endRow:e,endColumn:t}};let{isMerged:l,isMergedMainCell:u,startRow:d,startColumn:f,endRow:p,endColumn:m}=i,h={startRow:d,startColumn:f,endRow:p,endColumn:m,startY:a,endY:o,startX:s,endX:c},g=n.length-1,_=r.length-1;if(l&&d!==-1&&f!==-1){let e=n[d-1]||0,t=n[p]||n[g],i=r[f-1]||0,a=r[m]||r[_];h={...h,startY:e,endY:t,startX:i,endX:a}}else if(!l&&p!==-1&&m!==-1){let e=n[p]||n[g],t=r[m]||r[_];h={...h,startY:a,endY:e,startX:s,endX:t}}return{isMerged:l,isMergedMainCell:u,actualRow:e,actualColumn:t,startY:a,endY:o,startX:s,endX:c,mergeInfo:h}}function Zl(e,t,n,r){let{x:i}=n;return e/t+i-r}function Ql(e,t,n,r){let{y:i}=n;return e=e/t+i-r,e}const $l=[`script`,`style`,`meta`,`comment`,`link`];let eu=function(e){return e[e.INFO=0]=`INFO`,e[e.STOP=1]=`STOP`,e[e.WARNING=2]=`WARNING`,e}({}),tu=function(e){return 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}({}),nu=function(e){return 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}({}),ru=function(e){return e[e.TEXT=0]=`TEXT`,e[e.ARROW=1]=`ARROW`,e[e.CUSTOM=2]=`CUSTOM`,e}({}),iu=function(e){return e.VALID=`valid`,e.INVALID=`invalid`,e.VALIDATING=`validating`,e}({}),au=function(e){return 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}({}),ou=class extends x{constructor(e,t){super(),this._resourceManagerService=e,this._univerInstanceService=t,this._init()}_init(){let e=e=>{e.businesses.forEach(t=>{switch(t){case f.UniverType.UNRECOGNIZED:case f.UniverType.UNIVER_UNKNOWN:case f.UniverType.UNIVER_SLIDE:case f.UniverType.UNIVER_DOC:this._univerInstanceService.getAllUnitsForType(f.UniverType.UNIVER_DOC).forEach(t=>{let n=(t.getSnapshot().resources||[]).find(t=>t.name===e.pluginName);if(n)try{let r=e.parseJson(n.data);e.onLoad(t.getUnitId(),r)}catch{console.error(`Load Document{${t.getUnitId()}} Resources{${e.pluginName}} Data Error.`)}});break;case f.UniverType.UNIVER_SHEET:this._univerInstanceService.getAllUnitsForType(f.UniverType.UNIVER_SHEET).forEach(t=>{let n=(t.getSnapshot().resources||[]).find(t=>t.name===e.pluginName);if(n)try{let r=e.parseJson(n.data);e.onLoad(t.getUnitId(),r)}catch{console.error(`Load Workbook{${t.getUnitId()}} Resources{${e.pluginName}} Data Error.`)}})}})};this._resourceManagerService.getAllResourceHooks().forEach(t=>e(t)),this.disposeWithMe(this._resourceManagerService.register$.subscribe(t=>e(t))),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(f.UniverType.UNIVER_SHEET).subscribe(e=>{this._resourceManagerService.loadResources(e.getUnitId(),e.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(f.UniverType.UNIVER_DOC).subscribe(e=>{Ne(e.getUnitId())||this._resourceManagerService.loadResources(e.getUnitId(),e.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(f.UniverType.UNIVER_SHEET).subscribe(e=>{this._resourceManagerService.unloadResources(e.getUnitId(),f.UniverType.UNIVER_SHEET)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(f.UniverType.UNIVER_DOC).subscribe(e=>{this._resourceManagerService.unloadResources(e.getUnitId(),f.UniverType.UNIVER_DOC)}))}saveUnit(e){let t=this._univerInstanceService.getUnit(e);if(!t)return null;let n=this._resourceManagerService.getResources(e,t.type),r=S.deepClone(t.getSnapshot());return r.resources=n,r}};ou=F([P(0,(0,l.Inject)(cc)),P(1,(0,l.Inject)(ul))],ou);var su=class{get _univerInstanceService(){return this._injector.get(ul)}get _pluginService(){return this._injector.get(Ol)}constructor(e={},t){v(this,`_startedTypes`,new Set),v(this,`_injector`,void 0),v(this,`_disposingCallbacks`,new Ct);let n=this._injector=cu(t,e==null?void 0:e.override),{theme:r,darkMode:i,locale:a,locales:o,logLevel:s,logCommandExecution:c}=e;r&&this._injector.get(jl).setTheme(r),i&&this._injector.get(jl).setDarkMode(i),o&&this._injector.get(_l).load(o),a&&this._injector.get(_l).setLocale(a),s&&this._injector.get(N).setLogLevel(s),c!==void 0&&this._injector.get(cr).setConfig(hr,c),this._init(n)}__getInjector(){return this._injector}onDispose(e){let t=this._disposingCallbacks.add(b(e));return b(()=>t.dispose(!0))}dispose(){this._disposingCallbacks.dispose(),this._injector.dispose()}setLocale(e){this._injector.get(_l).setLocale(e)}createUnit(e,t){return this._univerInstanceService.createUnit(e,t)}createUniverSheet(e){return this._injector.get(N).warn(`[Univer]`,`Univer.createUniverSheet is deprecated, use createUnit instead`),this._univerInstanceService.createUnit(f.UniverType.UNIVER_SHEET,e)}createUniverDoc(e){return this._injector.get(N).warn(`[Univer]`,`Univer.createUniverDoc is deprecated, use createUnit instead`),this._univerInstanceService.createUnit(f.UniverType.UNIVER_DOC,e)}createUniverSlide(e){return this._injector.get(N).warn(`[Univer]`,`Univer.createUniverSlide is deprecated, use createUnit instead`),this._univerInstanceService.createUnit(f.UniverType.UNIVER_SLIDE,e)}_init(e){this._univerInstanceService.registerCtorForType(f.UniverType.UNIVER_SHEET,cl),this._univerInstanceService.registerCtorForType(f.UniverType.UNIVER_DOC,_s),this._univerInstanceService.registerCtorForType(f.UniverType.UNIVER_SLIDE,ll);let t=e.get(ul);t.__setCreateHandler((n,r,i,a)=>{if(!this._startedTypes.has(n)){this._pluginService.startPluginsForType(n),this._startedTypes.add(n);let o=e.createInstance(i,r);return t.__addUnit(o,a),this._tryProgressToReady(),o}let o=e.createInstance(i,r);return t.__addUnit(o,a),o})}_tryProgressToReady(){this._injector.get(ml).stage<$.Ready&&(this._injector.get(ml).stage=$.Ready)}registerPlugin(e,t){this._pluginService.registerPlugin(e,t)}registerPlugins(e){e.forEach(e=>{let[t,n]=e;this._pluginService.registerPlugin(t,n)})}};function cu(e,t){let n=Cl([[Cc],[_l],[jl],[ml],[Ol],[fc],[ul,{useClass:dl}],[xl,{useClass:Sl}],[N,{useClass:pr,lazy:!0}],[gr,{useClass:yr}],[Nl,{useClass:zl,lazy:!0}],[cr,{useClass:lr}],[ur,{useClass:dr}],[cc,{useClass:Al,lazy:!0}],[kl,{useClass:ou,lazy:!0}],[mc,{useClass:pc}],[yl,{useClass:vl,lazy:!0}]],t),r=e?e.createChild(n):new l.Injector(n);return Ie(r,[[fc],[kl]]),r}ge(),exports.ABCToNumber=Ga,exports.AUTO_HEIGHT_FOR_MERGED_CELLS=je,exports.AbsoluteRefType=R,exports.ActionIterator=Xo,exports.AlignTypeH=Un,exports.AlignTypeV=Wn,exports.ArrangeTypeEnum=Jn,exports.ArrowsAndMarkersShapes=tn,exports.AsyncInterceptorManager=Xe,exports.AsyncLock=c.default,Object.defineProperty(exports,`AuthzIoLocalService`,{enumerable:!0,get:function(){return pc}}),exports.AutoFillSeries=Bt,exports.BORDER_KEYS=rr,exports.BORDER_STYLE_KEYS=nr,exports.BaselineOffset=pn,exports.BasicShapes=en,exports.BlockType=xn,exports.BooleanNumber=E,exports.BorderStyleTypes=w,exports.BorderType=Vt,exports.BuildTextUtils=Z,exports.BulletAlignment=vn,exports.COLORS=Fr,exports.COLOR_STYLE_KEYS=tr,exports.COMMAND_LOG_EXECUTION_CONFIG_KEY=hr,exports.CanceledError=ze,exports.CellModeEnum=ci,exports.CellValueType=mn,exports.ColorKit=Ir,exports.ColorType=Ht,exports.ColumnSeparatorType=Tn,Object.defineProperty(exports,`CommandService`,{enumerable:!0,get:function(){return yr}}),exports.CommandType=I,exports.CommonHideTypes=Ut,exports.ConfigService=lr,exports.ContextService=dr,exports.CopyPasteType=Wt,exports.CustomCommandExecutionError=Re,exports.CustomDecorationType=bn,exports.CustomRangeType=yn,exports.DEFAULT_CELL=ya,exports.DEFAULT_DOC=hs,exports.DEFAULT_DOCUMENT_SUB_COMPONENT_ID=`__default_document_sub_component_id20231101__`,exports.DEFAULT_EMPTY_DOCUMENT_VALUE=`\r
9
+ `,exports.DEFAULT_NUMBER_FORMAT=`General`,exports.DEFAULT_RANGE=_a,exports.DEFAULT_RANGE_ARRAY=ga,exports.DEFAULT_SELECTION=va,exports.DEFAULT_SLIDE=ba,exports.DEFAULT_STYLES=H,exports.DEFAULT_TEXT_FORMAT=`@@@`,exports.DEFAULT_TEXT_FORMAT_EXCEL=`@`,exports.DEFAULT_WORKSHEET_COLUMN_COUNT=20,exports.DEFAULT_WORKSHEET_COLUMN_COUNT_KEY=`DEFAULT_WORKSHEET_COLUMN_COUNT`,exports.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT=20,exports.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY=`DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT`,exports.DEFAULT_WORKSHEET_COLUMN_WIDTH=88,exports.DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY=`DEFAULT_WORKSHEET_COLUMN_WIDTH`,exports.DEFAULT_WORKSHEET_ROW_COUNT=$c,exports.DEFAULT_WORKSHEET_ROW_COUNT_KEY=`DEFAULT_WORKSHEET_ROW_COUNT`,exports.DEFAULT_WORKSHEET_ROW_HEIGHT=24,exports.DEFAULT_WORKSHEET_ROW_HEIGHT_KEY=`DEFAULT_WORKSHEET_ROW_HEIGHT`,exports.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH=46,exports.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY=`DEFAULT_WORKSHEET_ROW_TITLE_WIDTH`,exports.DOCS_COMMENT_EDITOR_UNIT_ID_KEY=Ae,exports.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY=Oe,exports.DOCS_NORMAL_EDITOR_UNIT_ID_KEY=De,exports.DOCS_ZEN_EDITOR_UNIT_ID_KEY=ke,exports.DOC_DRAWING_PRINTING_COMPONENT_KEY=`univer-docs-drawing-printing`,exports.DOC_RANGE_TYPE=oi,exports.DashStyleType=jn,exports.DataStreamTreeNodeType=ls,exports.DataStreamTreeTokenType=X,exports.DataValidationErrorStyle=eu,exports.DataValidationImeMode=tu,exports.DataValidationOperator=nu,exports.DataValidationRenderMode=ru,exports.DataValidationStatus=iu,exports.DataValidationType=au,exports.DeleteDirection=Gt,exports.DependentOn=Dl,exports.DesktopLogService=pr,exports.DeveloperMetadataVisibility=Kt,exports.Dimension=qt,exports.Direction=Jt,exports.Disposable=x,exports.DisposableCollection=Ct,exports.DocStyleType=gn,exports.DocumentDataModel=_s,exports.DocumentFlavor=Sn,exports.DrawingTypeEnum=Yn,exports.EDITOR_ACTIVATED=xc,exports.EXTENSION_NAMES=wa,exports.ErrorService=Cc,exports.EventState=ac,exports.EventSubject=oc,exports.FOCUSING_COMMENT_EDITOR=`FOCUSING_COMMENT_EDITOR`,exports.FOCUSING_COMMON_DRAWINGS=`FOCUSING_COMMON_DRAWINGS`,exports.FOCUSING_DOC=yc,exports.FOCUSING_EDITOR_BUT_HIDDEN=`FOCUSING_EDITOR_BUT_HIDDEN`,exports.FOCUSING_EDITOR_INPUT_FORMULA=`FOCUSING_EDITOR_INPUT_FORMULA`,exports.FOCUSING_EDITOR_STANDALONE=`FOCUSING_EDITOR_INPUT_FORMULA`,exports.FOCUSING_FX_BAR_EDITOR=Sc,exports.FOCUSING_PANEL_EDITOR=`FOCUSING_PANEL_EDITOR`,exports.FOCUSING_SHAPE_TEXT_EDITOR=`FOCUSING_SHAPE_TEXT_EDITOR`,exports.FOCUSING_SHEET=vc,exports.FOCUSING_SLIDE=bc,exports.FOCUSING_UNIT=_c,exports.FOCUSING_UNIVER_EDITOR=`FOCUSING_UNIVER_EDITOR`,exports.FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE=`FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE`,exports.FORMULA_EDITOR_ACTIVATED=`FORMULA_EDITOR_ACTIVATED`,exports.FollowNumberWithType=_n,exports.FontItalic=dn,exports.FontStyleType=zn,exports.FontWeight=fn,exports.GridType=Cn,exports.HorizontalAlign=T,exports.IAuthzIoService=mc,exports.ICommandService=gr,exports.IConfigService=cr,exports.IConfirmService=hc,exports.IContextService=ur,exports.IImageIoService=Ec,exports.ILocalStorageService=gl,exports.ILogService=N,exports.IMentionIOService=yl,exports.IPermissionService=xl,exports.IResourceLoaderService=kl,exports.IResourceManagerService=cc,exports.IS_ROW_STYLE_PRECEDE_COLUMN_STYLE=`isRowStylePrecedeColumnStyle`,exports.IURLImageService=Dc,exports.IUndoRedoService=Nl,exports.IUniverInstanceService=ul,exports.ImageCacheMap=Bl,exports.ImageSourceType=wc,exports.ImageUploadStatusType=Tc,Object.defineProperty(exports,`Inject`,{enumerable:!0,get:function(){return l.Inject}}),Object.defineProperty(exports,`InjectSelf`,{enumerable:!0,get:function(){return l.InjectSelf}}),Object.defineProperty(exports,`Injector`,{enumerable:!0,get:function(){return l.Injector}}),exports.InterceptorEffectEnum=We,exports.InterceptorManager=qe,exports.InterpolationPointType=Xt,Object.defineProperty(exports,`JSON1`,{enumerable:!0,get:function(){return m}}),exports.JSONX=Y,exports.LRUHelper=fa,exports.LRUMap=da,Object.defineProperty(exports,`LifecycleService`,{enumerable:!0,get:function(){return ml}}),exports.LifecycleStages=$,exports.LifecycleUnreachableError=pl,exports.ListGlyphType=O,Object.defineProperty(exports,`LocalUndoRedoService`,{enumerable:!0,get:function(){return zl}}),exports.LocaleService=_l,exports.LocaleType=Zt,exports.LogLevel=fr,Object.defineProperty(exports,`LookUp`,{enumerable:!0,get:function(){return l.LookUp}}),exports.MAX_COLUMN_COUNT=ha,exports.MAX_ROW_COUNT=ma,exports.MOVE_BUFFER_VALUE=2,Object.defineProperty(exports,`Many`,{enumerable:!0,get:function(){return l.Many}}),exports.MemoryCursor=dt,Object.defineProperty(exports,`MentionIOLocalService`,{enumerable:!0,get:function(){return vl}}),exports.MentionType=Qt,exports.NAMED_STYLE_MAP=Sa,exports.NAMED_STYLE_SPACE_MAP=Ca,exports.NamedStyleType=k,exports.NilCommand=vr,exports.NumberUnitType=Hn,exports.ObjectMatrix=Di,exports.ObjectRelativeFromH=Bn,exports.ObjectRelativeFromV=Vn,Object.defineProperty(exports,`Optional`,{enumerable:!0,get:function(){return l.Optional}}),exports.OtherShapes=nn,exports.PADDING_KEYS=ar,exports.PAGE_SIZE=Ta,exports.PAPER_TYPES=qn,exports.PRESET_LIST_TYPE=Co,exports.PRINT_CHART_COMPONENT_KEY=`univer-sheets-chart-print-chart`,exports.PageElementType=Zn,exports.PageOrientType=Kn,exports.PageType=Xn,exports.PaperType=A,exports.ParagraphElementType=Dn,exports.ParagraphStyleBuilder=nc,exports.ParagraphStyleValue=tc,exports.PermissionService=Sl,exports.PermissionStatus=bl,exports.Plugin=Tl,Object.defineProperty(exports,`PluginService`,{enumerable:!0,get:function(){return Ol}}),exports.PositionedObjectLayoutType=kn,exports.PresetListType=G,exports.ProtectionType=$t,Object.defineProperty(exports,`Quantity`,{enumerable:!0,get:function(){return l.Quantity}}),exports.QuickListType=W,exports.QuickListTypeMap=Eo,exports.RANGE_DIRECTION=ai,exports.RANGE_TYPE=L,exports.RBush=ce.default,exports.RCDisposable=Tt,exports.RGBA_PAREN=`rgba(`,exports.RGB_PAREN=`rgb(`,exports.ROTATE_BUFFER_VALUE=1,exports.RTree=Ul,exports.Range=Da,exports.Rectangle=U,Object.defineProperty(exports,`RediError`,{enumerable:!0,get:function(){return l.RediError}}),exports.RedoCommand=Rl,exports.RedoCommandId=Fl,exports.RefAlias=Ua,exports.Registry=gt,exports.RegistryAsMap=_t,exports.RelativeDate=an,exports.RelativeSlideLink=Qn,Object.defineProperty(exports,`ResourceManagerService`,{enumerable:!0,get:function(){return Al}}),exports.RichTextBuilder=ic,exports.RichTextValue=rc,exports.RxDisposable=wt,exports.SHEET_EDITOR_UNITS=xa,exports.STYLE_KEYS=or,exports.SectionType=wn,Object.defineProperty(exports,`Self`,{enumerable:!0,get:function(){return l.Self}}),Object.defineProperty(exports,`SheetSkeleton`,{enumerable:!0,get:function(){return ql}}),exports.SheetTypes=on,exports.SheetViewModel=nl,Object.defineProperty(exports,`Skeleton`,{enumerable:!0,get:function(){return Kl}}),Object.defineProperty(exports,`SkipSelf`,{enumerable:!0,get:function(){return l.SkipSelf}}),exports.SliceBodyType=Io,exports.SlideDataModel=ll,exports.SpacingRule=An,exports.SpecialShapes=rn,exports.Styles=jc,exports.TEXT_DECORATION_KEYS=er,exports.TEXT_ROTATION_KEYS=ir,exports.THEME_COLORS=li,exports.TabStopAlignment=Mn,exports.TableAlignmentType=Pn,exports.TableLayoutType=Fn,exports.TableRowHeightRule=Ln,exports.TableSizeType=Nn,exports.TableTextWrapType=In,exports.TestConfirmService=gc,exports.TextDecoration=cn,exports.TextDecorationBuilder=ec,exports.TextDirection=sn,exports.TextDirectionType=En,exports.TextStyleBuilder=$s,exports.TextStyleValue=Qs,exports.TextX=J,exports.TextXActionType=M,exports.ThemeColorType=D,exports.ThemeColors=hn,exports.ThemeService=jl,exports.Tools=S,exports.UndoCommand=Ll,exports.UndoCommandId=Il,exports.UnitModel=Et,exports.Univer=su,Object.defineProperty(exports,`UniverInstanceService`,{enumerable:!0,get:function(){return dl}}),Object.defineProperty(exports,`UniverInstanceType`,{enumerable:!0,get:function(){return f.UniverType}}),exports.UpdateDocsAttributeType=j,exports.UserManagerService=fc,exports.VerticalAlign=ln,exports.VerticalAlignmentType=Rn,Object.defineProperty(exports,`WithNew`,{enumerable:!0,get:function(){return l.WithNew}}),Object.defineProperty(exports,`Workbook`,{enumerable:!0,get:function(){return cl}}),exports.Worksheet=il,exports.WrapStrategy=un,exports.WrapTextType=On,exports.addLinkToDocumentModel=zc,exports.afterInitApply=Or,exports.afterTime=Er,exports.awaitTime=Wl,exports.binSearchFirstGreaterThanTarget=jr,exports.binarySearchArray=Ar,exports.bufferDebounceTime=Tr,exports.cellToRange=Bi,exports.characterSpacingControlType=Gn,exports.checkForSubstrings=Gi,exports.checkIfMove=Pr,exports.checkParagraphHasBullet=qi,exports.checkParagraphHasIndent=Ji,exports.checkParagraphHasIndentByStyle=Yi,exports.cloneCellData=Gc,exports.cloneCellDataMatrix=qc,exports.cloneCellDataWithSpanAndDisplay=Kc,exports.cloneValue=Q,exports.cloneWorksheetData=Xc,exports.codeToBlob=Nr,exports.columnLabelToNumber=pa,exports.composeBody=Jo,exports.composeInterceptors=Ke,exports.composeStyles=Lt,exports.concatMatrixArray=Si,exports.convertCellToRange=Oi,exports.convertObservableToBehaviorSubject=Dr,exports.covertCellValue=Vi,exports.covertCellValues=Hi,exports.createAsyncInterceptorKey=Je,exports.createDefaultUser=uc,exports.createDocumentModelWithStyle=Ic,Object.defineProperty(exports,`createIdentifier`,{enumerable:!0,get:function(){return l.createIdentifier}}),exports.createInterceptorKey=Ge,exports.createInternalEditorID=Me,exports.createREGEXFromWildChar=zt,exports.createRowColIter=Wa,exports.customNameCharacterCheck=Hl,exports.dayjs=_.default,Object.defineProperty(exports,`debounce`,{enumerable:!0,get:function(){return u.debounce}}),exports.dedupe=ve,exports.dedupeBy=ye,exports.deepCompare=Ui,exports.delayAnimationFrame=Gl,exports.deleteContent=Zi,exports.extractPureTextFromCell=al,Object.defineProperty(exports,`forwardRef`,{enumerable:!0,get:function(){return l.forwardRef}}),exports.fromCallback=Cr,exports.fromEventSubject=sc,exports.generateIntervalsByPoints=ea,exports.generateRandomId=C,Object.defineProperty(exports,`get`,{enumerable:!0,get:function(){return u.get}}),exports.getArrayLength=vi,exports.getBodySlice=K,exports.getBorderStyleType=Li,exports.getCellCoordByIndexSimple=Jl,exports.getCellInfoInMergeData=si,exports.getCellPositionByIndexSimple=Yl,exports.getCellValueType=ti,exports.getCellWithCoordByIndexCore=Xl,exports.getColorStyle=z,exports.getCustomBlockSlice=Vo,exports.getCustomDecorationSlice=Wo,exports.getCustomRangeSlice=Uo,exports.getDocsUpdateBody=Ri,exports.getEmptyCell=Vc,exports.getIntersectRange=Fa,exports.getNumfmtParseValueFilter=gi,exports.getOriginCellValue=ol,exports.getParagraphsSlice=zo,exports.getPlainText=fs,exports.getReverseDirection=Yt,exports.getSectionBreakSlice=Bo,exports.getTableSlice=Ro,exports.getTextRunSlice=Lo,exports.getTransformOffsetX=Zl,exports.getTransformOffsetY=Ql,exports.getWorksheetUID=sl,exports.groupBy=Se,exports.handleStyleToString=Fi,exports.hashAlgorithm=$i,exports.horizontalLineSegmentsSubtraction=Ki,exports.insertMatrixArray=bi,exports.insertTextToContent=Xi,exports.invertColorByHSL=ct,exports.invertColorByMatrix=ut,Object.defineProperty(exports,`isAsyncDependencyItem`,{enumerable:!0,get:function(){return l.isAsyncDependencyItem}}),Object.defineProperty(exports,`isAsyncHook`,{enumerable:!0,get:function(){return l.isAsyncHook}}),exports.isBlackColor=Qr,exports.isBooleanString=Te,exports.isCellCoverable=Mi,exports.isCellV=ri,Object.defineProperty(exports,`isClassDependencyItem`,{enumerable:!0,get:function(){return l.isClassDependencyItem}}),exports.isCommentEditorID=Pe,Object.defineProperty(exports,`isCtor`,{enumerable:!0,get:function(){return l.isCtor}}),exports.isDefaultFormat=di,Object.defineProperty(exports,`isDisposable`,{enumerable:!0,get:function(){return l.isDisposable}}),exports.isEmptyCell=ji,Object.defineProperty(exports,`isFactoryDependencyItem`,{enumerable:!0,get:function(){return l.isFactoryDependencyItem}}),exports.isFormulaId=Pi,exports.isFormulaString=Ni,exports.isICellData=ei,exports.isInternalEditorID=Ne,exports.isNodeEnv=Rt,exports.isNotNullOrUndefined=Bc,exports.isNullCell=ni,exports.isNumeric=pt,exports.isPatternEqualWithoutDecimal=fi,exports.isRangesEqual=Mc,exports.isRealNum=Qi,exports.isSafeNumeric=mt,exports.isSameStyleTextRun=Wi,exports.isTextFormat=ui,exports.isUnitRangesEqual=Nc,exports.isValidRange=zi,Object.defineProperty(exports,`isValueDependencyItem`,{enumerable:!0,get:function(){return l.isValueDependencyItem}}),exports.isWhiteColor=$r,exports.makeArray=Ce,exports.makeCellRangeToRangeData=Ai,exports.makeCellToSelection=ki,exports.makeCustomRangeStream=us,exports.mapObjectMatrix=_i,Object.defineProperty(exports,`merge`,{enumerable:!0,get:function(){return u.merge}}),exports.mergeIntervals=ta,exports.mergeLocales=na,exports.mergeOverrideWithDependencies=Cl,exports.mergeSets=xt,Object.defineProperty(exports,`mergeWith`,{enumerable:!0,get:function(){return u.mergeWith}}),exports.mergeWorksheetSnapshotWithDefault=el,exports.mixinClass=ft,exports.moveMatrixArray=wi,exports.moveRangeByOffset=Oa,exports.nameCharacterCheck=Vl,exports.normalizeBody=Ho,exports.normalizeTextRuns=Qa,exports.numberToABC=Ka,exports.numberToListABC=Ja,Object.defineProperty(exports,`numfmt`,{enumerable:!0,get:function(){return g}}),exports.queryObjectMatrix=Ha,exports.registerDependencies=Fe,exports.remove=_e,exports.repeatStringNumTimes=qa,exports.replaceInDocumentBody=Ys,exports.requestImmediateMacroTask=vt,exports.resolveWithBasePath=Nt,exports.rotate=xe,exports.searchArray=Mr,exports.searchInOrderedArray=kr,exports.selectionToArray=ii,exports.sequence=bt,exports.sequenceAsync=yt,exports.sequenceExecute=xr,exports.sequenceExecuteAsync=Sr,Object.defineProperty(exports,`set`,{enumerable:!0,get:function(){return u.set}}),Object.defineProperty(exports,`setDependencies`,{enumerable:!0,get:function(){return l.setDependencies}}),exports.shallowEqual=Le,exports.skipParseTagNames=$l,exports.sliceMatrixArray=Ci,exports.sortRules=Ya,exports.sortRulesByDesc=Xa,exports.sortRulesFactory=Za,exports.spliceArray=xi,exports.splitIntoGrid=Aa,exports.takeAfter=wr,Object.defineProperty(exports,`textDiff`,{enumerable:!0,get:function(){return le.default}}),exports.throttle=Be,exports.toDisposable=b,exports.touchDependencies=Ie,exports.updateAttributeByDelete=Zo,exports.updateAttributeByInsert=Qo,exports.willLoseNumericPrecision=ht;