@univerjs/core 0.17.0 → 0.18.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.
Files changed (128) hide show
  1. package/lib/cjs/facade.js +1 -1
  2. package/lib/cjs/index.js +9 -8
  3. package/lib/es/facade.js +1 -1479
  4. package/lib/es/index.js +9 -20335
  5. package/lib/facade.js +1 -1479
  6. package/lib/index.js +9 -20335
  7. package/lib/types/common/async.d.ts +16 -1
  8. package/lib/types/common/di.d.ts +18 -2
  9. package/lib/types/common/interceptor.d.ts +16 -1
  10. package/lib/types/common/invert-color/invert-hsl.d.ts +16 -1
  11. package/lib/types/common/invert-color/invert-rgb.d.ts +16 -1
  12. package/lib/types/common/unit.d.ts +17 -2
  13. package/lib/types/docs/data-model/document-data-model.d.ts +24 -9
  14. package/lib/types/docs/data-model/empty-snapshot.d.ts +16 -1
  15. package/lib/types/docs/data-model/json-x/json-x.d.ts +19 -4
  16. package/lib/types/docs/data-model/preset-list-type.d.ts +16 -1
  17. package/lib/types/docs/data-model/replacement.d.ts +16 -1
  18. package/lib/types/docs/data-model/rich-text-builder.d.ts +21 -5
  19. package/lib/types/docs/data-model/text-x/action-iterator.d.ts +17 -1
  20. package/lib/types/docs/data-model/text-x/action-types.d.ts +17 -2
  21. package/lib/types/docs/data-model/text-x/apply-utils/common.d.ts +16 -1
  22. package/lib/types/docs/data-model/text-x/apply-utils/delete-apply.d.ts +16 -1
  23. package/lib/types/docs/data-model/text-x/apply-utils/insert-apply.d.ts +16 -1
  24. package/lib/types/docs/data-model/text-x/apply-utils/update-apply.d.ts +16 -1
  25. package/lib/types/docs/data-model/text-x/apply.d.ts +17 -2
  26. package/lib/types/docs/data-model/text-x/build-utils/custom-decoration.d.ts +17 -2
  27. package/lib/types/docs/data-model/text-x/build-utils/custom-range.d.ts +17 -2
  28. package/lib/types/docs/data-model/text-x/build-utils/drawings.d.ts +19 -4
  29. package/lib/types/docs/data-model/text-x/build-utils/index.d.ts +24 -9
  30. package/lib/types/docs/data-model/text-x/build-utils/paragraph.d.ts +18 -3
  31. package/lib/types/docs/data-model/text-x/build-utils/parse.d.ts +16 -1
  32. package/lib/types/docs/data-model/text-x/build-utils/selection.d.ts +17 -2
  33. package/lib/types/docs/data-model/text-x/build-utils/text-x-utils.d.ts +23 -7
  34. package/lib/types/docs/data-model/text-x/text-x.d.ts +18 -3
  35. package/lib/types/docs/data-model/text-x/transform-utils.d.ts +17 -2
  36. package/lib/types/docs/data-model/text-x/utils.d.ts +34 -19
  37. package/lib/types/docs/data-model/utils.d.ts +16 -1
  38. package/lib/types/facade/f-base.d.ts +17 -1
  39. package/lib/types/facade/f-blob.d.ts +17 -1
  40. package/lib/types/facade/f-doc.d.ts +17 -1
  41. package/lib/types/facade/f-enum.d.ts +15 -0
  42. package/lib/types/facade/f-event-registry.d.ts +19 -3
  43. package/lib/types/facade/f-event.d.ts +17 -2
  44. package/lib/types/facade/f-hooks.d.ts +17 -1
  45. package/lib/types/facade/f-univer.d.ts +20 -3
  46. package/lib/types/facade/f-usermanager.d.ts +17 -1
  47. package/lib/types/facade/f-util.d.ts +15 -0
  48. package/lib/types/observer/observable.d.ts +17 -1
  49. package/lib/types/services/authz-io/authz-io-local.service.d.ts +17 -2
  50. package/lib/types/services/authz-io/type.d.ts +18 -3
  51. package/lib/types/services/command/command.service.d.ts +20 -4
  52. package/lib/types/services/config/config.service.d.ts +18 -3
  53. package/lib/types/services/confirm/confirm.service.d.ts +17 -2
  54. package/lib/types/services/context/context.service.d.ts +16 -1
  55. package/lib/types/services/error/error.service.d.ts +16 -1
  56. package/lib/types/services/image-io/image-io.service.d.ts +18 -3
  57. package/lib/types/services/image-io/url-image.service.d.ts +17 -2
  58. package/lib/types/services/instance/instance.service.d.ts +22 -5
  59. package/lib/types/services/lifecycle/lifecycle.service.d.ts +16 -1
  60. package/lib/types/services/local-storage/local-storage.service.d.ts +1 -1
  61. package/lib/types/services/locale/locale.service.d.ts +17 -2
  62. package/lib/types/services/log/log.service.d.ts +16 -1
  63. package/lib/types/services/mention-io/mention-io-local.service.d.ts +16 -1
  64. package/lib/types/services/mention-io/type.d.ts +18 -3
  65. package/lib/types/services/permission/permission.service.d.ts +18 -2
  66. package/lib/types/services/permission/type.d.ts +20 -5
  67. package/lib/types/services/plugin/plugin-override.d.ts +16 -1
  68. package/lib/types/services/plugin/plugin.service.d.ts +18 -2
  69. package/lib/types/services/resource-loader/resource-loader.service.d.ts +17 -2
  70. package/lib/types/services/resource-loader/type.d.ts +17 -2
  71. package/lib/types/services/resource-manager/resource-manager.service.d.ts +19 -4
  72. package/lib/types/services/resource-manager/type.d.ts +19 -4
  73. package/lib/types/services/theme/theme.service.d.ts +16 -1
  74. package/lib/types/services/undoredo/undoredo.service.d.ts +22 -5
  75. package/lib/types/services/user-manager/const.d.ts +17 -1
  76. package/lib/types/services/user-manager/user-manager.service.d.ts +17 -2
  77. package/lib/types/shared/after-init-apply.d.ts +16 -1
  78. package/lib/types/shared/cache/image-cache.d.ts +16 -1
  79. package/lib/types/shared/check-if-move.d.ts +17 -2
  80. package/lib/types/shared/common.d.ts +22 -7
  81. package/lib/types/shared/compare.d.ts +16 -1
  82. package/lib/types/shared/dayjs.d.ts +16 -1
  83. package/lib/types/shared/doc-tool.d.ts +16 -1
  84. package/lib/types/shared/generate.d.ts +17 -2
  85. package/lib/types/shared/lifecycle.d.ts +18 -2
  86. package/lib/types/shared/lru/lru-map.d.ts +16 -1
  87. package/lib/types/shared/object-matrix-query.d.ts +16 -1
  88. package/lib/types/shared/object-matrix.d.ts +17 -2
  89. package/lib/types/shared/r-tree.d.ts +18 -2
  90. package/lib/types/shared/range.d.ts +17 -2
  91. package/lib/types/shared/rectangle.d.ts +17 -2
  92. package/lib/types/shared/rxjs.d.ts +18 -2
  93. package/lib/types/shared/tools.d.ts +17 -23
  94. package/lib/types/sheets/clone.d.ts +17 -2
  95. package/lib/types/sheets/column-manager.d.ts +19 -4
  96. package/lib/types/sheets/empty-snapshot.d.ts +16 -1
  97. package/lib/types/sheets/range.d.ts +23 -6
  98. package/lib/types/sheets/row-manager.d.ts +20 -5
  99. package/lib/types/sheets/sheet-skeleton.d.ts +21 -5
  100. package/lib/types/sheets/sheet-snapshot-utils.d.ts +16 -1
  101. package/lib/types/sheets/span-model.d.ts +16 -1
  102. package/lib/types/sheets/styles.d.ts +18 -3
  103. package/lib/types/sheets/typedef.d.ts +23 -7
  104. package/lib/types/sheets/util.d.ts +20 -4
  105. package/lib/types/sheets/workbook.d.ts +19 -4
  106. package/lib/types/sheets/worksheet.d.ts +25 -7
  107. package/lib/types/skeleton.d.ts +16 -1
  108. package/lib/types/slides/slide-model.d.ts +22 -6
  109. package/lib/types/types/const/const.d.ts +18 -2
  110. package/lib/types/types/const/page-size.d.ts +16 -1
  111. package/lib/types/types/interfaces/i-cell-custom-render.d.ts +20 -5
  112. package/lib/types/types/interfaces/i-cell-validation-data.d.ts +17 -2
  113. package/lib/types/types/interfaces/i-data-validation.d.ts +21 -6
  114. package/lib/types/types/interfaces/i-document-data-interceptor.d.ts +16 -1
  115. package/lib/types/types/interfaces/i-document-data.d.ts +20 -5
  116. package/lib/types/types/interfaces/i-drawing.d.ts +56 -3
  117. package/lib/types/types/interfaces/i-mention.d.ts +16 -1
  118. package/lib/types/types/interfaces/i-need-check-disposable.d.ts +16 -1
  119. package/lib/types/types/interfaces/i-placeholder.d.ts +16 -1
  120. package/lib/types/types/interfaces/i-shape-properties.d.ts +17 -2
  121. package/lib/types/types/interfaces/i-slide-data.d.ts +26 -11
  122. package/lib/types/types/interfaces/i-style-data.d.ts +19 -4
  123. package/lib/types/univer.d.ts +26 -10
  124. package/lib/umd/facade.js +1 -1
  125. package/lib/umd/index.js +9 -8
  126. package/package.json +9 -9
  127. package/lib/types/docs/data-model/text-x/build-utils/__test__/custom-range.spec.d.ts +0 -16
  128. package/lib/types/docs/data-model/text-x/build-utils/__test__/selection.spec.d.ts +0 -16
package/lib/cjs/index.js CHANGED
@@ -1,8 +1,9 @@
1
- "use strict";var vd=Object.defineProperty;var wd=(e,t,n)=>t in e?vd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var C=(e,t,n)=>wd(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ye=require("@wendellhu/redi"),ae=require("rxjs"),os=require("rxjs/operators"),Vr=require("@univerjs/themes");function bd(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in e)){const i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}const Ut=typeof global<"u"?global:typeof self<"u"?self:window;function yd(){const t=new Map;let n=0;typeof Ut.requestIdleCallback!="function"&&(Ut.requestIdleCallback=function(s){const i=Date.now(),o=++n,a=setTimeout(function(){t.delete(o);const c=Math.max(0,50-(Date.now()-i));s({didTimeout:c===0,timeRemaining(){return c}})},1);return t.set(o,a),o}),typeof Ut.cancelIdleCallback!="function"&&(Ut.cancelIdleCallback=function(s){const i=t.get(s);i!==void 0&&(clearTimeout(i),t.delete(s))})}function Ad(){typeof Ut.Array.prototype.findLastIndex!="function"&&(Ut.Array.prototype.findLastIndex=function(t,n){if(this==null)throw new TypeError("Array.prototype.findLastIndex called on null or undefined");if(typeof t!="function")throw new TypeError("callback must be a function");const r=this.length>>>0;for(let s=r-1;s>=0;s--)if(s in this&&t.call(n,this[s],s,this))return s;return-1}),typeof Ut.Array.prototype.findLast!="function"&&(Ut.Array.prototype.findLast=function(t,n){const r=this.findLastIndex(t,n);return r!==-1?this[r]:void 0})}function Td(){typeof Ut.String.prototype.at!="function"&&(Ut.String.prototype.at=function(t){if(this==null)throw new TypeError("String.prototype.at called on null or undefined");const n=this.length;if(t<0&&(t=n+t),!(t<0||t>=n))return this.charAt(t)})}function Nd(){yd(),Ad(),Td()}function Lr(e,t){const n=e.indexOf(t);return n>-1?(e.splice(n,1),!0):!1}function Md(e){const t=new Set,n=[];for(const r of e)t.has(r)||(t.add(r),n.push(r));return n}function Dd(e,t){const n=new Set,r=[];for(const s of e){const i=t(s);n.has(i)||(n.add(i),r.push(s))}return r}function Ld(e,t){for(let n=e.length-1;n>-1;n--){const r=e[n];if(t(r,n))return r}return null}function xd(e,t){if(e.length===0)return e;const n=t%e.length;return e.slice(n).concat(e.slice(0,n))}function Ud(e,t){const n=new Map;return e.forEach(r=>{const s=t(r);let i=n.get(s);n.has(s)||(i=[],n.set(s,i)),i.push(r)}),n}function Pd(e){return Array.isArray(e)?e:[e]}function St(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Qs,ma;function kd(){if(ma)return Qs;ma=1;var e=function(t){if(t=t||{},this.Promise=t.Promise||Promise,this.queues=Object.create(null),this.domainReentrant=t.domainReentrant||!1,this.domainReentrant){if(typeof process>"u"||typeof process.domain>"u")throw new Error("Domain-reentrant locks require `process.domain` to exist. Please flip `opts.domainReentrant = false`, use a NodeJS version that still implements Domain, or install a browser polyfill.");this.domains=Object.create(null)}this.timeout=t.timeout||e.DEFAULT_TIMEOUT,this.maxOccupationTime=t.maxOccupationTime||e.DEFAULT_MAX_OCCUPATION_TIME,this.maxExecutionTime=t.maxExecutionTime||e.DEFAULT_MAX_EXECUTION_TIME,t.maxPending===1/0||Number.isInteger(t.maxPending)&&t.maxPending>=0?this.maxPending=t.maxPending:this.maxPending=e.DEFAULT_MAX_PENDING};return e.DEFAULT_TIMEOUT=0,e.DEFAULT_MAX_OCCUPATION_TIME=0,e.DEFAULT_MAX_EXECUTION_TIME=0,e.DEFAULT_MAX_PENDING=1e3,e.prototype.acquire=function(t,n,r,s){if(Array.isArray(t))return this._acquireBatch(t,n,r,s);if(typeof n!="function")throw new Error("You must pass a function to execute");var i=null,o=null,a=null;typeof r!="function"&&(s=r,r=null,a=new this.Promise(function(k,W){i=k,o=W})),s=s||{};var l=!1,c=null,u=null,h=null,d=this,f=function(k,W,S){u&&(clearTimeout(u),u=null),h&&(clearTimeout(h),h=null),k&&(d.queues[t]&&d.queues[t].length===0&&delete d.queues[t],d.domainReentrant&&delete d.domains[t]),l||(a?W?o(W):i(S):typeof r=="function"&&r(W,S),l=!0),k&&d.queues[t]&&d.queues[t].length>0&&d.queues[t].shift()()},g=function(k){if(l)return f(k);c&&(clearTimeout(c),c=null),d.domainReentrant&&k&&(d.domains[t]=process.domain);var W=s.maxExecutionTime||d.maxExecutionTime;if(W&&(h=setTimeout(function(){d.queues[t]&&f(k,new Error("Maximum execution time is exceeded "+t))},W)),n.length===1){var S=!1;try{n(function(p,w){S||(S=!0,f(k,p,w))})}catch(p){S||(S=!0,f(k,p))}}else d._promiseTry(function(){return n()}).then(function(p){f(k,void 0,p)},function(p){f(k,p)})};d.domainReentrant&&process.domain&&(g=process.domain.bind(g));var E=s.maxPending||d.maxPending;if(!d.queues[t])d.queues[t]=[],g(!0);else if(d.domainReentrant&&process.domain&&process.domain===d.domains[t])g(!1);else if(d.queues[t].length>=E)f(!1,new Error("Too many pending tasks in queue "+t));else{var R=function(){g(!0)};s.skipQueue?d.queues[t].unshift(R):d.queues[t].push(R);var b=s.timeout||d.timeout;b&&(c=setTimeout(function(){c=null,f(!1,new Error("async-lock timed out in queue "+t))},b))}var F=s.maxOccupationTime||d.maxOccupationTime;if(F&&(u=setTimeout(function(){d.queues[t]&&f(!1,new Error("Maximum occupation time is exceeded in queue "+t))},F)),a)return a},e.prototype._acquireBatch=function(t,n,r,s){typeof r!="function"&&(s=r,r=null);var i=this,o=function(l,c){return function(u){i.acquire(l,c,u,s)}},a=t.reduceRight(function(l,c){return o(c,l)},n);if(typeof r=="function")a(r);else return new this.Promise(function(l,c){a.length===1?a(function(u,h){u?c(u):l(h)}):l(a())})},e.prototype.isBusy=function(t){return t?!!this.queues[t]:Object.keys(this.queues).length>0},e.prototype._promiseTry=function(t){try{return this.Promise.resolve(t())}catch(n){return this.Promise.reject(n)}},Qs=e,Qs}var ei,ga;function Fd(){return ga||(ga=1,ei=kd()),ei}var Hd=Fd();const Bd=St(Hd),$d=new Set(["true","false"]);function jd(e){return $d.has(e.toLowerCase())}const Gn="__INTERNAL_EDITOR__",oo=`${Gn}DOCS_NORMAL`,ao=`${Gn}DOCS_FORMULA_BAR`,Nl=`${Gn}ZEN_EDITOR`,Ml=`${Gn}COMMENT_EDITOR`,Dl=`\r
2
- `,Ll="isRowStylePrecedeColumnStyle",xl=Symbol("AUTO_HEIGHT_FOR_MERGED_CELLS");function Wd(e){return`${Gn}${e}`}function Ul(e){return e.startsWith(Gn)}function Yd(e){return e===Ml}function zd(e,t){t.forEach(n=>e.add(n))}function Pl(e,t){t.forEach(([n])=>{e.has(n)&&e.get(n)})}function kl(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;const s=Object.prototype.hasOwnProperty.bind(t);for(let i=0;i<n.length;i++){const o=n[i];if(!s(o))return!1;const a=e[o],l=t[o];if(a!==l)return!1}return!0}class Cs extends Error{constructor(t){super(t),this.name="CustomCommandExecutionError"}}class Vd extends Cs{constructor(){super("Canceled by facade"),this.name="CanceledError"}}function Kd(e,t=16){let n=0,r=null;return function(...i){const o=Date.now();o-n<t?(r&&clearTimeout(r),r=setTimeout(()=>{n=o,e.apply(this,i)},t)):(n=o,e.apply(this,i))}}var xn=(e=>(e[e.Style=1]="Style",e[e.Value=2]="Value",e))(xn||{});function Gd(e){return`sheet_interceptor_${e}`}const Fl=e=>function(t,n){let r=-1,s=t;for(let i=0;i<=e.length;i++){if(i<=r)throw new Error("[SheetInterceptorService]: next() called multiple times!");if(r=i,i===e.length)return s;const o=e[i];let a=!1;if(s=o.handler(s,n,l=>(a=!0,l)),!a)break}return s};class Xd{constructor(t){C(this,"_interceptorsByName",new Map);C(this,"_interceptorPoints");this._interceptorPoints=t}fetchThroughInterceptors(t,n){const r=t;let s=this._interceptorsByName.get(r);return n&&(s=s.filter(n)),Fl(s||[])}intercept(t,n){const r=t;this._interceptorsByName.has(r)||this._interceptorsByName.set(r,[]);const s=this._interceptorsByName.get(r);return s.push(n),this._interceptorsByName.set(r,s.sort((i,o)=>{var a,l;return((a=o.priority)!=null?a:0)-((l=i.priority)!=null?l:0)})),()=>Lr(this._interceptorsByName.get(r),n)}getInterceptPoints(){return this._interceptorPoints}dispose(){this._interceptorsByName.clear()}}function qd(e){return`sheet_async_interceptor_${e}`}const Jd=e=>async function(t,n){let r=-1,s=t;for(let i=0;i<=e.length;i++){if(i<=r)throw new Error("[SheetInterceptorService]: next() called multiple times!");if(r=i,i===e.length)return s;const o=e[i];let a=!1;if(s=await o.handler(s,n,async l=>(a=!0,l)),!a)break}return s};class Zd{constructor(t){C(this,"_asyncInterceptorsByName",new Map);C(this,"_asyncInterceptorPoints");this._asyncInterceptorPoints=t}fetchThroughAsyncInterceptors(t,n){const r=t;let s=this._asyncInterceptorsByName.get(r);return n&&(s=s.filter(n)),Jd(s||[])}async interceptAsync(t,n){const r=t;this._asyncInterceptorsByName.has(r)||this._asyncInterceptorsByName.set(r,[]);const s=this._asyncInterceptorsByName.get(r);return s.push(n),this._asyncInterceptorsByName.set(r,s.sort((i,o)=>{var a,l;return((a=o.priority)!=null?a:0)-((l=i.priority)!=null?l:0)})),()=>Lr(this._asyncInterceptorsByName.get(r),n)}getInterceptPoints(){return this._asyncInterceptorPoints}dispose(){this._asyncInterceptorsByName.clear()}}function Hl(e){return e.map(t=>t/255)}function Bl(e){return e.map(t=>Math.round(t*255))}function Qd([e,t,n]){const r=Math.max(e,t,n),s=Math.min(e,t,n),i=(r+s)/2;let o=0,a=0;if(r!==s){const l=r-s;switch(a=i>.5?l/(2-r-s):l/(r+s),r){case e:o=(t-n)/l+(t<n?6:0);break;case t:o=(n-e)/l+2;break;case n:o=(e-t)/l+4;break}o/=6}return[o,a,i]}function Rs(e,t,n){const r=[e,t,n].map(s=>s<=.03928?s/12.92:((s+.055)/1.055)**2.4);return .2126*r[0]+.7152*r[1]+.0722*r[2]}function _a(e,t){return(Math.max(e,t)+.05)/(Math.min(e,t)+.05)}function ef(e,t,n){let r,s,i;if(t===0)r=s=i=n;else{const o=(c,u,h)=>{let d=h;return d<0&&(d+=1),d>1&&(d-=1),d<.16666666666666666?c+(u-c)*6*d:d<.5?u:d<.6666666666666666?c+(u-c)*(.6666666666666666-d)*6:c},a=n<.5?n*(1+t):n+t-n*t,l=2*n-a;r=o(l,a,e+1/3),s=o(l,a,e),i=o(l,a,e-1/3)}return[r,s,i]}const ti={r:1,g:1,b:1},ni={r:0,g:0,b:0},tf=Rs(ti.r,ti.g,ti.b),nf=Rs(ni.r,ni.g,ni.b);function rf(e){const t=Rs(e[0],e[1],e[2]),n=_a(tf,t),r=Qd(e);let s=1-r[2],i,o,a;do i=ef(r[0],r[1],s),o=Rs(i[0],i[1],i[2]),a=_a(o,nf),s+=.01;while(s<=1&&s>=0&&Math.abs(a-n)<.01);return i}function sf(e){return Bl(rf(Hl(e)))}const Ct=[[.333,-.667,-.667,0,1],[-.667,.333,-.667,0,1],[-.667,-.667,.333,0,1],[0,0,0,1,0]];function of(e){const t=e[0],n=e[1],r=e[2];let s=[Ct[0][0]*t+Ct[0][1]*n+Ct[0][2]*r+Ct[0][4],Ct[1][0]*t+Ct[1][1]*n+Ct[1][2]*r+Ct[1][4],Ct[2][0]*t+Ct[2][1]*n+Ct[2][2]*r+Ct[2][4]];return s=s.map(i=>i>1?1:i<0?0:i),s}function af(e){return Bl(of(Hl(e)))}var $l=typeof global=="object"&&global&&global.Object===Object&&global,lf=typeof self=="object"&&self&&self.Object===Object&&self,In=$l||lf||Function("return this")(),Yn=In.Symbol,jl=Object.prototype,cf=jl.hasOwnProperty,uf=jl.toString,er=Yn?Yn.toStringTag:void 0;function hf(e){var t=cf.call(e,er),n=e[er];try{e[er]=void 0;var r=!0}catch{}var s=uf.call(e);return r&&(t?e[er]=n:delete e[er]),s}var df=Object.prototype,ff=df.toString;function mf(e){return ff.call(e)}var gf="[object Null]",_f="[object Undefined]",pa=Yn?Yn.toStringTag:void 0;function xr(e){return e==null?e===void 0?_f:gf:pa&&pa in Object(e)?hf(e):mf(e)}function Xn(e){return e!=null&&typeof e=="object"}var pf="[object Symbol]";function xs(e){return typeof e=="symbol"||Xn(e)&&xr(e)==pf}function Ef(e,t){for(var n=-1,r=e==null?0:e.length,s=Array(r);++n<r;)s[n]=t(e[n],n,e);return s}var zn=Array.isArray,Ea=Yn?Yn.prototype:void 0,Ca=Ea?Ea.toString:void 0;function Wl(e){if(typeof e=="string")return e;if(zn(e))return Ef(e,Wl)+"";if(xs(e))return Ca?Ca.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var Cf=/\s/;function Rf(e){for(var t=e.length;t--&&Cf.test(e.charAt(t)););return t}var If=/^\s+/;function Sf(e){return e&&e.slice(0,Rf(e)+1).replace(If,"")}function It(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Ra=NaN,Of=/^[-+]0x[0-9a-f]+$/i,vf=/^0b[01]+$/i,wf=/^0o[0-7]+$/i,bf=parseInt;function Ia(e){if(typeof e=="number")return e;if(xs(e))return Ra;if(It(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=It(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Sf(e);var n=vf.test(e);return n||wf.test(e)?bf(e.slice(2),n?2:8):Of.test(e)?Ra:+e}function Yl(e){return e}var yf="[object AsyncFunction]",Af="[object Function]",Tf="[object GeneratorFunction]",Nf="[object Proxy]";function lo(e){if(!It(e))return!1;var t=xr(e);return t==Af||t==Tf||t==yf||t==Nf}var ri=In["__core-js_shared__"],Sa=(function(){var e=/[^.]+$/.exec(ri&&ri.keys&&ri.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function Mf(e){return!!Sa&&Sa in e}var Df=Function.prototype,Lf=Df.toString;function xf(e){if(e!=null){try{return Lf.call(e)}catch{}try{return e+""}catch{}}return""}var Uf=/[\\^$.*+?()[\]{}|]/g,Pf=/^\[object .+?Constructor\]$/,kf=Function.prototype,Ff=Object.prototype,Hf=kf.toString,Bf=Ff.hasOwnProperty,$f=RegExp("^"+Hf.call(Bf).replace(Uf,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function jf(e){if(!It(e)||Mf(e))return!1;var t=lo(e)?$f:Pf;return t.test(xf(e))}function Wf(e,t){return e==null?void 0:e[t]}function co(e,t){var n=Wf(e,t);return jf(n)?n:void 0}var Oa=Object.create,Yf=(function(){function e(){}return function(t){if(!It(t))return{};if(Oa)return Oa(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}})();function zf(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Vf(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}var Kf=800,Gf=16,Xf=Date.now;function qf(e){var t=0,n=0;return function(){var r=Xf(),s=Gf-(r-n);if(n=r,s>0){if(++t>=Kf)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Jf(e){return function(){return e}}var Is=(function(){try{var e=co(Object,"defineProperty");return e({},"",{}),e}catch{}})(),Zf=Is?function(e,t){return Is(e,"toString",{configurable:!0,enumerable:!1,value:Jf(t),writable:!0})}:Yl,Qf=qf(Zf),em=9007199254740991,tm=/^(?:0|[1-9]\d*)$/;function uo(e,t){var n=typeof e;return t=t==null?em:t,!!t&&(n=="number"||n!="symbol"&&tm.test(e))&&e>-1&&e%1==0&&e<t}function ho(e,t,n){t=="__proto__"&&Is?Is(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Us(e,t){return e===t||e!==e&&t!==t}var nm=Object.prototype,rm=nm.hasOwnProperty;function zl(e,t,n){var r=e[t];(!(rm.call(e,t)&&Us(r,n))||n===void 0&&!(t in e))&&ho(e,t,n)}function sm(e,t,n,r){var s=!n;n||(n={});for(var i=-1,o=t.length;++i<o;){var a=t[i],l=void 0;l===void 0&&(l=e[a]),s?ho(n,a,l):zl(n,a,l)}return n}var va=Math.max;function im(e,t,n){return t=va(t===void 0?e.length-1:t,0),function(){for(var r=arguments,s=-1,i=va(r.length-t,0),o=Array(i);++s<i;)o[s]=r[t+s];s=-1;for(var a=Array(t+1);++s<t;)a[s]=r[s];return a[t]=n(o),zf(e,this,a)}}function om(e,t){return Qf(im(e,t,Yl),e+"")}var am=9007199254740991;function Vl(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=am}function fo(e){return e!=null&&Vl(e.length)&&!lo(e)}function lm(e,t,n){if(!It(n))return!1;var r=typeof t;return(r=="number"?fo(n)&&uo(t,n.length):r=="string"&&t in n)?Us(n[t],e):!1}function Kl(e){return om(function(t,n){var r=-1,s=n.length,i=s>1?n[s-1]:void 0,o=s>2?n[2]:void 0;for(i=e.length>3&&typeof i=="function"?(s--,i):void 0,o&&lm(n[0],n[1],o)&&(i=s<3?void 0:i,s=1),t=Object(t);++r<s;){var a=n[r];a&&e(t,a,r,i)}return t})}var cm=Object.prototype;function Gl(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||cm;return e===n}function um(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var hm="[object Arguments]";function wa(e){return Xn(e)&&xr(e)==hm}var Xl=Object.prototype,dm=Xl.hasOwnProperty,fm=Xl.propertyIsEnumerable,yi=wa((function(){return arguments})())?wa:function(e){return Xn(e)&&dm.call(e,"callee")&&!fm.call(e,"callee")};function mm(){return!1}var ql=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ba=ql&&typeof module=="object"&&module&&!module.nodeType&&module,gm=ba&&ba.exports===ql,ya=gm?In.Buffer:void 0,_m=ya?ya.isBuffer:void 0,Jl=_m||mm,pm="[object Arguments]",Em="[object Array]",Cm="[object Boolean]",Rm="[object Date]",Im="[object Error]",Sm="[object Function]",Om="[object Map]",vm="[object Number]",wm="[object Object]",bm="[object RegExp]",ym="[object Set]",Am="[object String]",Tm="[object WeakMap]",Nm="[object ArrayBuffer]",Mm="[object DataView]",Dm="[object Float32Array]",Lm="[object Float64Array]",xm="[object Int8Array]",Um="[object Int16Array]",Pm="[object Int32Array]",km="[object Uint8Array]",Fm="[object Uint8ClampedArray]",Hm="[object Uint16Array]",Bm="[object Uint32Array]",He={};He[Dm]=He[Lm]=He[xm]=He[Um]=He[Pm]=He[km]=He[Fm]=He[Hm]=He[Bm]=!0;He[pm]=He[Em]=He[Nm]=He[Cm]=He[Mm]=He[Rm]=He[Im]=He[Sm]=He[Om]=He[vm]=He[wm]=He[bm]=He[ym]=He[Am]=He[Tm]=!1;function $m(e){return Xn(e)&&Vl(e.length)&&!!He[xr(e)]}function jm(e){return function(t){return e(t)}}var Zl=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Sr=Zl&&typeof module=="object"&&module&&!module.nodeType&&module,Wm=Sr&&Sr.exports===Zl,si=Wm&&$l.process,Aa=(function(){try{var e=Sr&&Sr.require&&Sr.require("util").types;return e||si&&si.binding&&si.binding("util")}catch{}})(),Ta=Aa&&Aa.isTypedArray,Ql=Ta?jm(Ta):$m;function Ym(e,t){var n=zn(e),r=!n&&yi(e),s=!n&&!r&&Jl(e),i=!n&&!r&&!s&&Ql(e),o=n||r||s||i,a=o?um(e.length,String):[],l=a.length;for(var c in e)o&&(c=="length"||s&&(c=="offset"||c=="parent")||i&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||uo(c,l))||a.push(c);return a}function zm(e,t){return function(n){return e(t(n))}}function Vm(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var Km=Object.prototype,Gm=Km.hasOwnProperty;function Xm(e){if(!It(e))return Vm(e);var t=Gl(e),n=[];for(var r in e)r=="constructor"&&(t||!Gm.call(e,r))||n.push(r);return n}function ec(e){return fo(e)?Ym(e):Xm(e)}var qm=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Jm=/^\w*$/;function Zm(e,t){if(zn(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||xs(e)?!0:Jm.test(e)||!qm.test(e)||t!=null&&e in Object(t)}var br=co(Object,"create");function Qm(){this.__data__=br?br(null):{},this.size=0}function eg(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var tg="__lodash_hash_undefined__",ng=Object.prototype,rg=ng.hasOwnProperty;function sg(e){var t=this.__data__;if(br){var n=t[e];return n===tg?void 0:n}return rg.call(t,e)?t[e]:void 0}var ig=Object.prototype,og=ig.hasOwnProperty;function ag(e){var t=this.__data__;return br?t[e]!==void 0:og.call(t,e)}var lg="__lodash_hash_undefined__";function cg(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=br&&t===void 0?lg:t,this}function Cn(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Cn.prototype.clear=Qm;Cn.prototype.delete=eg;Cn.prototype.get=sg;Cn.prototype.has=ag;Cn.prototype.set=cg;function ug(){this.__data__=[],this.size=0}function Ps(e,t){for(var n=e.length;n--;)if(Us(e[n][0],t))return n;return-1}var hg=Array.prototype,dg=hg.splice;function fg(e){var t=this.__data__,n=Ps(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():dg.call(t,n,1),--this.size,!0}function mg(e){var t=this.__data__,n=Ps(t,e);return n<0?void 0:t[n][1]}function gg(e){return Ps(this.__data__,e)>-1}function _g(e,t){var n=this.__data__,r=Ps(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function zt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}zt.prototype.clear=ug;zt.prototype.delete=fg;zt.prototype.get=mg;zt.prototype.has=gg;zt.prototype.set=_g;var tc=co(In,"Map");function pg(){this.size=0,this.__data__={hash:new Cn,map:new(tc||zt),string:new Cn}}function Eg(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function ks(e,t){var n=e.__data__;return Eg(t)?n[typeof t=="string"?"string":"hash"]:n.map}function Cg(e){var t=ks(this,e).delete(e);return this.size-=t?1:0,t}function Rg(e){return ks(this,e).get(e)}function Ig(e){return ks(this,e).has(e)}function Sg(e,t){var n=ks(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function rn(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}rn.prototype.clear=pg;rn.prototype.delete=Cg;rn.prototype.get=Rg;rn.prototype.has=Ig;rn.prototype.set=Sg;var Og="Expected a function";function mo(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(Og);var n=function(){var r=arguments,s=t?t.apply(this,r):r[0],i=n.cache;if(i.has(s))return i.get(s);var o=e.apply(this,r);return n.cache=i.set(s,o)||i,o};return n.cache=new(mo.Cache||rn),n}mo.Cache=rn;var vg=500;function wg(e){var t=mo(e,function(r){return n.size===vg&&n.clear(),r}),n=t.cache;return t}var bg=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,yg=/\\(\\)?/g,Ag=wg(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(bg,function(n,r,s,i){t.push(s?i.replace(yg,"$1"):r||n)}),t});function Tg(e){return e==null?"":Wl(e)}function nc(e,t){return zn(e)?e:Zm(e,t)?[e]:Ag(Tg(e))}function rc(e){if(typeof e=="string"||xs(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function Ng(e,t){t=nc(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[rc(t[n++])];return n&&n==r?e:void 0}function sc(e,t,n){var r=e==null?void 0:Ng(e,t);return r===void 0?n:r}var ic=zm(Object.getPrototypeOf,Object),Mg="[object Object]",Dg=Function.prototype,Lg=Object.prototype,oc=Dg.toString,xg=Lg.hasOwnProperty,Ug=oc.call(Object);function Pg(e){if(!Xn(e)||xr(e)!=Mg)return!1;var t=ic(e);if(t===null)return!0;var n=xg.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&oc.call(n)==Ug}function kg(){this.__data__=new zt,this.size=0}function Fg(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function Hg(e){return this.__data__.get(e)}function Bg(e){return this.__data__.has(e)}var $g=200;function jg(e,t){var n=this.__data__;if(n instanceof zt){var r=n.__data__;if(!tc||r.length<$g-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new rn(r)}return n.set(e,t),this.size=n.size,this}function qn(e){var t=this.__data__=new zt(e);this.size=t.size}qn.prototype.clear=kg;qn.prototype.delete=Fg;qn.prototype.get=Hg;qn.prototype.has=Bg;qn.prototype.set=jg;var ac=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Na=ac&&typeof module=="object"&&module&&!module.nodeType&&module,Wg=Na&&Na.exports===ac,Ma=Wg?In.Buffer:void 0;Ma&&Ma.allocUnsafe;function Yg(e,t){return e.slice()}var Da=In.Uint8Array;function zg(e){var t=new e.constructor(e.byteLength);return new Da(t).set(new Da(e)),t}function Vg(e,t){var n=zg(e.buffer);return new e.constructor(n,e.byteOffset,e.length)}function Kg(e){return typeof e.constructor=="function"&&!Gl(e)?Yf(ic(e)):{}}function Gg(e){return function(t,n,r){for(var s=-1,i=Object(t),o=r(t),a=o.length;a--;){var l=o[++s];if(n(i[l],l,i)===!1)break}return t}}var Xg=Gg(),ii=function(){return In.Date.now()},qg="Expected a function",Jg=Math.max,Zg=Math.min;function Qg(e,t,n){var r,s,i,o,a,l,c=0,u=!1,h=!1,d=!0;if(typeof e!="function")throw new TypeError(qg);t=Ia(t)||0,It(n)&&(u=!!n.leading,h="maxWait"in n,i=h?Jg(Ia(n.maxWait)||0,t):i,d="trailing"in n?!!n.trailing:d);function f(p){var w=r,A=s;return r=s=void 0,c=p,o=e.apply(A,w),o}function g(p){return c=p,a=setTimeout(b,t),u?f(p):o}function E(p){var w=p-l,A=p-c,H=t-w;return h?Zg(H,i-A):H}function R(p){var w=p-l,A=p-c;return l===void 0||w>=t||w<0||h&&A>=i}function b(){var p=ii();if(R(p))return F(p);a=setTimeout(b,E(p))}function F(p){return a=void 0,d&&r?f(p):(r=s=void 0,o)}function k(){a!==void 0&&clearTimeout(a),c=0,r=l=s=a=void 0}function W(){return a===void 0?o:F(ii())}function S(){var p=ii(),w=R(p);if(r=arguments,s=this,l=p,w){if(a===void 0)return g(l);if(h)return clearTimeout(a),a=setTimeout(b,t),f(l)}return a===void 0&&(a=setTimeout(b,t)),o}return S.cancel=k,S.flush=W,S}function Ai(e,t,n){(n!==void 0&&!Us(e[t],n)||n===void 0&&!(t in e))&&ho(e,t,n)}function e_(e){return Xn(e)&&fo(e)}function Ti(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}function t_(e){return sm(e,ec(e))}function n_(e,t,n,r,s,i,o){var a=Ti(e,n),l=Ti(t,n),c=o.get(l);if(c){Ai(e,n,c);return}var u=i?i(a,l,n+"",e,t,o):void 0,h=u===void 0;if(h){var d=zn(l),f=!d&&Jl(l),g=!d&&!f&&Ql(l);u=l,d||f||g?zn(a)?u=a:e_(a)?u=Vf(a):f?(h=!1,u=Yg(l)):g?(h=!1,u=Vg(l)):u=[]:Pg(l)||yi(l)?(u=a,yi(a)?u=t_(a):(!It(a)||lo(a))&&(u=Kg(l))):h=!1}h&&(o.set(l,u),s(u,l,r,i,o),o.delete(l)),Ai(e,n,u)}function go(e,t,n,r,s){e!==t&&Xg(t,function(i,o){if(s||(s=new qn),It(i))n_(e,t,o,n,go,r,s);else{var a=r?r(Ti(e,o),i,o+"",e,t,s):void 0;a===void 0&&(a=i),Ai(e,o,a)}},ec)}var r_=Kl(function(e,t,n,r){go(e,t,n,r)}),Fs=Kl(function(e,t,n){go(e,t,n)});function s_(e,t,n,r){if(!It(e))return e;t=nc(t,e);for(var s=-1,i=t.length,o=i-1,a=e;a!=null&&++s<i;){var l=rc(t[s]),c=n;if(l==="__proto__"||l==="constructor"||l==="prototype")return e;if(s!=o){var u=a[l];c=void 0,c===void 0&&(c=It(u)?u:uo(t[s+1])?[]:{})}zl(a,l,c),a=a[l]}return e}function i_(e,t,n){return e==null?e:s_(e,t,n)}class Sn{constructor(){C(this,"cursor",0)}reset(){return this.cursor=0,this}moveCursor(t){this.cursor+=t}moveCursorTo(t){this.cursor=t}}function o_(e,t){for(const n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}function lc(e){return/^-?\d+(\.\d+)?$/.test(e)}function a_(e){return lc(e)?Number(e)<=Number.MAX_SAFE_INTEGER:!1}function l_(e){return Number(e)>Number.MAX_SAFE_INTEGER||e.length>=18}class _o{constructor(){C(this,"_data",[])}static create(){return new _o}add(t){this._data.indexOf(t)>-1||this._data.push(t)}delete(t){const n=this._data.indexOf(t);this._data.splice(n,1)}getData(){return this._data}}class po{constructor(){C(this,"_data",new Map)}static create(){return new po}add(t,n){this._data.has(t)||this._data.set(t,n)}delete(t){this._data.delete(t)}getData(){return this._data}}function c_(e){const t=new MessageChannel;let n=!1;const r=()=>{n||e()};return t.port1.onmessage=r,t.port2.postMessage(null),()=>{n=!0,t.port1.onmessage=null,t.port1.close(),t.port2.close()}}async function cc(e){for(const[t,n]of e.entries())try{if(!await n())return{index:t,result:!1}}catch(r){return{index:t,result:!1,error:r}}return{result:!0,index:-1}}function uc(e){for(const[t,n]of e.entries())try{if(!n())return{index:t,result:!1}}catch(r){return{index:t,result:!1,error:r}}return{result:!0,index:-1}}function u_(e,t){return t.forEach(n=>e.add(n)),e}function h_(e){return e instanceof ae.Subscription||e instanceof ae.Subject||e&&"closed"in e&&typeof e.unsubscribe<"u"}function Ye(e){let t=!1;return e?h_(e)?{dispose:()=>e.unsubscribe()}:typeof e=="function"?{dispose:()=>{t||(t=!0,e())}}:e:Ye(()=>{})}class Hs{constructor(){C(this,"_disposables",new Set)}add(t){const n=Ye(t);return this._disposables.add(n),{dispose:(r=!1)=>{r||n.dispose(),this._disposables.delete(n)}}}dispose(){this._disposables.forEach(t=>{t.dispose()}),this._disposables.clear()}}class Xe{constructor(){C(this,"_disposed",!1);C(this,"_collection",new Hs)}disposeWithMe(t){return this._collection.add(t)}ensureNotDisposed(){if(this._disposed)throw new Error("[Disposable]: object is disposed!")}dispose(){this._disposed||(this._disposed=!0,this._collection.dispose())}}class d_ extends Xe{constructor(){super(...arguments);C(this,"dispose$",new ae.Subject)}dispose(){super.dispose(),this.dispose$.next(),this.dispose$.complete()}}class f_ extends Xe{constructor(n){super();C(this,"_ref",0);this._rootDisposable=n}inc(){if(this._disposed)throw new Error("[RCDisposable]: should not ref to a disposed.");this._ref+=1}dec(){this._ref-=1,this._ref===0&&(this._rootDisposable.dispose(),this.dispose())}}var ve=(e=>(e[e.UNIVER_UNKNOWN=0]="UNIVER_UNKNOWN",e[e.UNIVER_DOC=1]="UNIVER_DOC",e[e.UNIVER_SHEET=2]="UNIVER_SHEET",e[e.UNIVER_SLIDE=3]="UNIVER_SLIDE",e[e.UNIVER_PROJECT=4]="UNIVER_PROJECT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(ve||{}),Ie=(e=>(e[e.Reader=0]="Reader",e[e.Editor=1]="Editor",e[e.Owner=2]="Owner",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(Ie||{}),Ni=(e=>(e[e.SomeCollaborator=0]="SomeCollaborator",e[e.AllCollaborator=1]="AllCollaborator",e[e.OneSelf=2]="OneSelf",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(Ni||{});class Bs extends Xe{}const hc=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"]),m_=new RegExp("^(?:(?:(?:https?|ftp):)?\\/\\/)?(?:\\S+(?::\\S*)?@)?(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z0-9\\u00a1-\\uffff][a-z0-9\\u00a1-\\uffff_-]{0,62})?[a-z0-9\\u00a1-\\uffff]\\.)+(?:[a-z\\u00a1-\\uffff]{2,}\\.?))(?::\\d{2,5})?(?:[/?#]\\S*)?$","i");function g_(e){if(!Number.isNaN(+e))return!1;if(e.startsWith("http://localhost:3002")||e.startsWith("localhost:3002"))return!0;if(m_.test(e)){if(dc(e))return!0;try{const r=new URL(fc(e)).hostname.split(".").pop();if(r&&hc.has(r))return!0}catch{return!1}}return!1}function dc(e){return/^[a-zA-Z]+:\/\//.test(e)}function __(e){return/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(e)}function fc(e){return dc(e)?e:__(e)?`mailto://${e}`:`https://${e}`}function p_(e,t){try{const n=new URL(t),r=n.pathname.endsWith("/")?n.pathname:`${n.pathname}/`,s=e.startsWith("/")?e.substring(1):e;return new URL(s,n.origin+r).toString()}catch(n){return console.error("Error resolving URL with base URL:",n),e}}const E_="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let C_=e=>crypto.getRandomValues(new Uint8Array(e)),R_=(e,t,n)=>{let r=(2<<Math.log2(e.length-1))-1,s=-~(1.6*r*t/e.length);return(i=t)=>{let o="";for(;;){let a=n(s),l=s|0;for(;l--;)if(o+=e[a[l]&r]||"",o.length>=i)return o}}},I_=(e,t=21)=>R_(e,t|0,C_),S_=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=E_[n[e]&63];return t};const Xt=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];function Eo(e,t){const n=Z.getValueType(e),r=Z.getValueType(t);return n!==r?!1:Z.isArray(e)?O_(e,t):Z.isObject(e)?v_(e,t):Z.isDate(e)?e.getTime()===t.getTime():Z.isRegExp(e)?e.toString()===t.toString():e===t}function O_(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;n++){const s=e[n],i=t[n];if(!Eo(s,i))return!1}return!0}function v_(e,t){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const s of n){if(!r.includes(s))return!1;const i=e[s],o=t[s];if(!Eo(i,o))return!1}return!0}class Z{static deleteNull(t){for(const n in t)(t[n]===null||t[n]===void 0)&&delete t[n];return t}static stringAt(t){let n="",r=t;for(;r>=Xt.length;)r/=Xt.length,r-=1,n+=Xt[r%Xt.length];const s=t%Xt.length;return n+=Xt[s],n}static indexAt(t){let n=0;for(let r=0;r<t.length-1;r+=1){const s=t.charCodeAt(r)-65,i=t.length-1-r;n+=Xt.length**i+Xt.length*s}return n+=t.charCodeAt(t.length-1)-65,n}static deleteBlank(t){return Z.isString(t)?t.replace(/\s/g,""):t}static getSystemType(){const t=navigator.userAgent,n=navigator.platform==="Win32"||navigator.platform==="Windows",r=navigator.platform==="Mac68K"||navigator.platform==="MacPPC"||navigator.platform==="Macintosh"||navigator.platform==="MacIntel";if(r)return"Mac";if(navigator.platform==="X11"&&!n&&!r)return"Unix";if(String(navigator.platform).indexOf("Linux")>-1)return"Linux";if(n){if(t.indexOf("Windows NT 5.0")>-1||t.indexOf("Windows 2000")>-1)return"Windows 2000";if(t.indexOf("Windows NT 5.1")>-1||t.indexOf("Windows XP")>-1)return"Windows XP";if(t.indexOf("Windows NT 5.2")>-1||t.indexOf("Windows 2003")>-1)return"Windows 2003";if(t.indexOf("Windows NT 6.0")>-1||t.indexOf("Windows Vista")>-1)return"Windows Vista";if(t.indexOf("Windows NT 6.1")>-1||t.indexOf("Windows 7")>-1)return"Windows 7";if(t.indexOf("Windows NT 10")>-1||t.indexOf("Windows 10")>-1)return"Windows 10";if(t.indexOf("Windows NT 11")>-1||t.indexOf("Windows 11")>-1)return"Windows 11"}return"Unknown system"}static getBrowserType(){const t=navigator.userAgent,n=t.indexOf("Opera")>-1,r=t.indexOf("compatible")>-1&&t.indexOf("MSIE")>-1&&!n,s=t.indexOf("Trident")>-1&&t.indexOf("rv:11.0")>-1,i=t.indexOf("Edge")>-1,o=t.indexOf("Firefox")>-1,a=t.indexOf("Safari")>-1&&t.indexOf("Chrome")===-1,l=t.indexOf("Chrome")>-1&&t.indexOf("Safari")>-1;if(r){new RegExp("MSIE (\\d+\\.\\d+);").test(t);const u=Number.parseFloat(RegExp.$1);return u===7?"IE7":u===8?"IE8":u===9?"IE9":u===10?"IE10":"0"}return o?"FF":n?"Opera":a?"Safari":l?"Chrome":i?"Edge":s?"IE11":"Unknown browser"}static getClassName(t){return t.constructor.name}static deepMerge(t,...n){n.forEach(o=>o&&i(o));function r(o,a){o.forEach((l,c)=>{var u,h;if(Z.isArray(l)){const d=(u=a[c])!=null?u:[];a[c]=d,r(l,d);return}if(Z.isObject(l)){const d=(h=a[c])!=null?h:{};a[c]=d,s(l,d);return}a[c]=l})}function s(o,a){Object.keys(o).forEach(l=>{var u,h;const c=o[l];if(Z.isObject(c)){const d=(u=a[l])!=null?u:{};a[l]=d,s(c,d);return}if(Z.isArray(c)){const d=(h=a[l])!=null?h:[];a[l]=d,r(c,d);return}a[l]=c})}function i(o){Object.keys(o).forEach(a=>{var c,u;const l=o[a];if(Z.isArray(l)){const h=(c=t[a])!=null?c:[];t[a]=h,r(l,h);return}if(Z.isObject(l)){const h=(u=t[a])!=null?u:{};t[a]=h,s(l,h);return}t[a]=l})}return t}static numberFixed(t,n){return Number(Number(t).toFixed(n))}static diffValue(t,n){return Eo(t,n)}static deepClone(t){if(!this.isDefine(t))return t;if(this.isRegExp(t))return new RegExp(t);if(this.isDate(t))return new Date(t);if(this.isArray(t)){const n=[];return t.forEach((r,s)=>{n[s]=Z.deepClone(r)}),n}if(this.isObject(t)){const n={};return Object.keys(t).forEach(r=>{const s=t[r];n[r]=Z.deepClone(s)}),Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n}return t}static getLanguage(){const t="en-US";return globalThis.navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||t}static getValueType(t){return Object.prototype.toString.apply(t)}static isDefine(t){return t!=null}static isBlank(t){return this.isDefine(t)?this.isString(t)?t.trim()==="":!1:!0}static isPlainObject(t){return this.isDefine(t)?Object.getPrototypeOf(t)===Object.getPrototypeOf({}):!1}static isDate(t){return this.getValueType(t)==="[object Date]"}static isRegExp(t){return this.getValueType(t)==="[object RegExp]"}static isArray(t){return this.getValueType(t)==="[object Array]"}static isString(t){return this.getValueType(t)==="[object String]"}static isNumber(t){return this.getValueType(t)==="[object Number]"}static isStringNumber(t){return!isNaN(Number.parseFloat(t))&&isFinite(t)}static isObject(t){return this.getValueType(t)==="[object Object]"}static isEmptyObject(t){for(const n in t)return!1;return!0}static 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(t){return g_(t)}static normalizeUrl(t){return fc(t)}static topLevelDomainCombiningString(){return[...hc].join("|")}static removeNull(t){return this.isObject(t)&&Object.keys(t).forEach(n=>{const r=t[n];r==null?delete t[n]:Z.removeNull(r)}),t}static fillTwoDimensionalArray(t,n,r){return new Array(t).fill(r).map(s=>new Array(n).fill(r))}static numToWord(t){let n="";for(;t>0;){let r=t%26;r=r===0?r=26:r,n=String.fromCharCode(96+r)+n,t=(t-r)/26}return n.toLocaleUpperCase()}static ABCatNum(t){if(t==null||t.length===0)return Number.NaN;const n=t.toLowerCase().split(""),r=n.length;let s=0,i=0;for(let o=0;o<r;o++)i=n[o].charCodeAt(0)-96,s+=i*26**(r-o-1);return s===0?Number.NaN:s-1}static chatAtABC(t){let i="";for(;t>=0;)i=String.fromCharCode(t%26+97)+i,t=Math.floor(t/26)-1;return i.toUpperCase()}static commonExtend(t,n){const r={};for(const s in t)r[s]=t[s];for(const s in n)n[s]!=null&&(r[s]=n[s]);return r}static hasIntersectionBetweenTwoRanges(t,n,r,s){return n>=r&&s>=t}static isStartValidPosition(t){return/^[A-Za-zА-Яа-яЁё_]/.test(t)}static isValidParameter(t){const n=/[~!@#$%^&*()+=\-{}\[\]\|:;"'<>,?\/ ]+/.test(t),r=t.length<=255;return!n&&r}static clamp(t,n,r){return Math.max(n,Math.min(r,t))}static now(){return performance&&performance.now?performance.now():Date.now()}}function nt(e=21,t){return t?I_(t,e)():S_(e)}function or(...e){const t={},n=e.length;for(let r=n-1;r>=0;r--){const s=e[r];if(s){const i=Object.keys(s);for(const o of i)t[o]===void 0&&(t[o]=s[o])}}return t}const w_=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null;function b_(e){const n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\\\*/g,".*").replace(/\\\?/g,".");return new RegExp(`^${n}$`,"i")}var mc=(e=>(e[e.DEFAULT_SERIES=0]="DEFAULT_SERIES",e[e.ALTERNATE_SERIES=1]="ALTERNATE_SERIES",e))(mc||{}),xe=(e=>(e[e.NONE=0]="NONE",e[e.THIN=1]="THIN",e[e.HAIR=2]="HAIR",e[e.DOTTED=3]="DOTTED",e[e.DASHED=4]="DASHED",e[e.DASH_DOT=5]="DASH_DOT",e[e.DASH_DOT_DOT=6]="DASH_DOT_DOT",e[e.DOUBLE=7]="DOUBLE",e[e.MEDIUM=8]="MEDIUM",e[e.MEDIUM_DASHED=9]="MEDIUM_DASHED",e[e.MEDIUM_DASH_DOT=10]="MEDIUM_DASH_DOT",e[e.MEDIUM_DASH_DOT_DOT=11]="MEDIUM_DASH_DOT_DOT",e[e.SLANT_DASH_DOT=12]="SLANT_DASH_DOT",e[e.THICK=13]="THICK",e))(xe||{}),gc=(e=>(e.TOP="top",e.BOTTOM="bottom",e.LEFT="left",e.RIGHT="right",e.NONE="none",e.ALL="all",e.OUTSIDE="outside",e.INSIDE="inside",e.HORIZONTAL="horizontal",e.VERTICAL="vertical",e.TLBR="tlbr",e.TLBC_TLMR="tlbc_tlmr",e.TLBR_TLBC_TLMR="tlbr_tlbc_tlmr",e.BLTR="bl_tr",e.MLTR_BCTR="mltr_bctr",e))(gc||{}),_c=(e=>(e[e.UNSUPPORTED=0]="UNSUPPORTED",e[e.RGB=1]="RGB",e[e.HEX=2]="HEX",e[e.THEME=3]="THEME",e))(_c||{}),pc=(e=>(e[e.ON=0]="ON",e[e.OFF=1]="OFF",e))(pc||{}),Ec=(e=>(e[e.PASTE_NORMAL=0]="PASTE_NORMAL",e[e.PASTE_NO_BORDERS=1]="PASTE_NO_BORDERS",e[e.PASTE_FORMAT=2]="PASTE_FORMAT",e[e.PASTE_FORMULA=3]="PASTE_FORMULA",e[e.PASTE_DATA_VALIDATION=4]="PASTE_DATA_VALIDATION",e[e.PASTE_VALUES=5]="PASTE_VALUES",e[e.PASTE_CONDITIONAL_FORMATTING=6]="PASTE_CONDITIONAL_FORMATTING",e[e.PASTE_COLUMN_WIDTHS=7]="PASTE_COLUMN_WIDTHS",e))(Ec||{}),Cc=(e=>(e[e.LEFT=0]="LEFT",e[e.RIGHT=1]="RIGHT",e))(Cc||{}),Rc=(e=>(e[e.DOCUMENT=0]="DOCUMENT",e[e.PROJECT=1]="PROJECT",e))(Rc||{}),Ic=(e=>(e[e.COLUMNS=0]="COLUMNS",e[e.ROWS=1]="ROWS",e))(Ic||{}),Sc=(e=>(e[e.UP=0]="UP",e[e.RIGHT=1]="RIGHT",e[e.DOWN=2]="DOWN",e[e.LEFT=3]="LEFT",e))(Sc||{});function y_(e){switch(e){case 3:return 1;case 1:return 3;case 0:return 2;case 2:return 0}}var Oc=(e=>(e[e.INTERPOLATION_POINT_TYPE_UNSPECIFIED=0]="INTERPOLATION_POINT_TYPE_UNSPECIFIED",e[e.MIN=1]="MIN",e[e.MAX=2]="MAX",e[e.NUMBER=3]="NUMBER",e[e.PERCENT=4]="PERCENT",e[e.PERCENTILE=5]="PERCENTILE",e))(Oc||{}),Ur=(e=>(e.EN_US="enUS",e.FR_FR="frFR",e.ZH_CN="zhCN",e.RU_RU="ruRU",e.ZH_TW="zhTW",e.VI_VN="viVN",e.FA_IR="faIR",e.JA_JP="jaJP",e.KO_KR="koKR",e.ES_ES="esES",e.CA_ES="caES",e.SK_SK="skSK",e))(Ur||{}),Ss=(e=>(e[e.PERSON=0]="PERSON",e[e.FILE=1]="FILE",e[e.DATE=2]="DATE",e[e.LOCATION=3]="LOCATION",e[e.EVENT=4]="EVENT",e))(Ss||{}),vc=(e=>(e[e.RANGE=0]="RANGE",e[e.SHEET=1]="SHEET",e))(vc||{}),wc=(e=>(e.Line="line",e.LineInv="lineInv",e.Triangle="triangle",e.RtTriangle="rtTriangle",e.Rect="rect",e.Diamond="diamond",e.Parallelogram="parallelogram",e.Trapezoid="trapezoid",e.NonIsocelesTrapezoid="nonIsocelesTrapezoid",e.Pentagon="pentagon",e.Hexagon="hexagon",e.Heptagon="heptagon",e.Octagon="octagon",e.Decagon="decagon",e.Dodecagon="dodecagon",e.Star4="star4",e.Star5="star5",e.Star6="star6",e.Star7="star7",e.Star8="star8",e.Star10="star10",e.Star12="star12",e.Star16="star16",e.Star24="star24",e.Star32="star32",e.RoundRect="roundRect",e.Round1Rect="round1Rect",e.Round2SameRect="round2SameRect",e.Round2DiagRect="round2DiagRect",e.Ellipse="ellipse",e))(wc||{}),bc=(e=>(e.RightArrow="rightArrow",e.LeftArrow="leftArrow",e.UpArrow="upArrow",e.DownArrow="downArrow",e.LeftRightArrow="leftRightArrow",e.UpDownArrow="upDownArrow",e.QuadArrow="quadArrow",e.LeftRightUpArrow="leftRightUpArrow",e.BentArrow="bentArrow",e.UturnArrow="uturnArrow",e.CircularArrow="circularArrow",e.NotchedRightArrow="notchedRightArrow",e.HomePlate="homePlate",e.Chevron="chevron",e.LeftCircularArrow="leftCircularArrow",e.LeftRightCircularArrow="leftRightCircularArrow",e))(bc||{}),yc=(e=>(e.Plaque="plaque",e.Can="can",e.Cube="cube",e.Bevel="bevel",e.Donut="donut",e.NoSmoking="noSmoking",e.BlockArc="blockArc",e.FoldedCorner="foldedCorner",e))(yc||{}),Ac=(e=>(e.SmileyFace="smileyFace",e.Heart="heart",e.LightningBolt="lightningBolt",e.Sun="sun",e.Moon="moon",e.Cloud="cloud",e.Arc="arc",e.Backpack="backpack",e.Frame="frame",e.HalfFrame="halfFrame",e.Corner="corner",e.Chord="chord",e.Pie="pie",e.Teardrop="teardrop",e.WedgeRectCallout="wedgeRectCallout",e.WedgeRRectCallout="wedgeRRectCallout",e.WedgeEllipseCallout="wedgeEllipseCallout",e.CloudCallout="cloudCallout",e.BorderCallout1="borderCallout1",e.BorderCallout2="borderCallout2",e.BorderCallout3="borderCallout3",e.AccentCallout1="accentCallout1",e.AccentCallout2="accentCallout2",e.AccentCallout3="accentCallout3",e.Callout1="callout1",e.Callout2="callout2",e.Callout3="callout3",e.ActionButtonBackPrevious="actionButtonBackPrevious",e.ActionButtonEnd="actionButtonEnd",e.ActionButtonForwardNext="actionButtonForwardNext",e.ActionButtonHelp="actionButtonHelp",e.ActionButtonHome="actionButtonHome",e.ActionButtonInformation="actionButtonInformation",e.ActionButtonMovie="actionButtonMovie",e.ActionButtonReturn="actionButtonReturn",e.ActionButtonSound="actionButtonSound",e))(Ac||{}),Tc=(e=>(e[e.RELATIVE_DATE_UNSPECIFIED=0]="RELATIVE_DATE_UNSPECIFIED",e[e.PAST_YEAR=1]="PAST_YEAR",e[e.PAST_MONTH=2]="PAST_MONTH",e[e.PAST_WEEK=3]="PAST_WEEK",e[e.YESTERDAY=4]="YESTERDAY",e[e.TODAY=5]="TODAY",e[e.TOMORROW=6]="TOMORROW",e))(Tc||{}),Nc=(e=>(e[e.GRID=0]="GRID",e[e.KANBAN=1]="KANBAN",e[e.GANTT=2]="GANTT",e))(Nc||{}),yr=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",e[e.RIGHT_TO_LEFT=2]="RIGHT_TO_LEFT",e))(yr||{}),Mc=(e=>(e[e.DASH=0]="DASH",e[e.DASH_DOT_DOT_HEAVY=1]="DASH_DOT_DOT_HEAVY",e[e.DASH_DOT_HEAVY=2]="DASH_DOT_HEAVY",e[e.DASHED_HEAVY=3]="DASHED_HEAVY",e[e.DASH_LONG=4]="DASH_LONG",e[e.DASH_LONG_HEAVY=5]="DASH_LONG_HEAVY",e[e.DOT_DASH=6]="DOT_DASH",e[e.DOT_DOT_DASH=7]="DOT_DOT_DASH",e[e.DOTTED=8]="DOTTED",e[e.DOTTED_HEAVY=9]="DOTTED_HEAVY",e[e.DOUBLE=10]="DOUBLE",e[e.NONE=11]="NONE",e[e.SINGLE=12]="SINGLE",e[e.THICK=13]="THICK",e[e.WAVE=14]="WAVE",e[e.WAVY_DOUBLE=15]="WAVY_DOUBLE",e[e.WAVY_HEAVY=16]="WAVY_HEAVY",e[e.WORDS=17]="WORDS",e))(Mc||{}),At=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LEFT=1]="LEFT",e[e.CENTER=2]="CENTER",e[e.RIGHT=3]="RIGHT",e[e.JUSTIFIED=4]="JUSTIFIED",e[e.BOTH=5]="BOTH",e[e.DISTRIBUTED=6]="DISTRIBUTED",e))(At||{}),mn=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TOP=1]="TOP",e[e.MIDDLE=2]="MIDDLE",e[e.BOTTOM=3]="BOTTOM",e))(mn||{}),Rn=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.OVERFLOW=1]="OVERFLOW",e[e.CLIP=2]="CLIP",e[e.WRAP=3]="WRAP",e))(Rn||{}),Os=(e=>(e[e.NORMAL=0]="NORMAL",e[e.ITALIC=1]="ITALIC",e))(Os||{}),vs=(e=>(e[e.NORMAL=0]="NORMAL",e[e.BOLD=1]="BOLD",e))(vs||{}),gn=(e=>(e[e.NORMAL=1]="NORMAL",e[e.SUBSCRIPT=2]="SUBSCRIPT",e[e.SUPERSCRIPT=3]="SUPERSCRIPT",e))(gn||{}),ce=(e=>(e[e.FALSE=0]="FALSE",e[e.TRUE=1]="TRUE",e))(ce||{}),Zt=(e=>(e[e.STRING=1]="STRING",e[e.NUMBER=2]="NUMBER",e[e.BOOLEAN=3]="BOOLEAN",e[e.FORCE_STRING=4]="FORCE_STRING",e))(Zt||{}),ot=(e=>(e[e.DARK1=0]="DARK1",e[e.LIGHT1=1]="LIGHT1",e[e.DARK2=2]="DARK2",e[e.LIGHT2=3]="LIGHT2",e[e.ACCENT1=4]="ACCENT1",e[e.ACCENT2=5]="ACCENT2",e[e.ACCENT3=6]="ACCENT3",e[e.ACCENT4=7]="ACCENT4",e[e.ACCENT5=8]="ACCENT5",e[e.ACCENT6=9]="ACCENT6",e[e.HYPERLINK=10]="HYPERLINK",e[e.FOLLOWED_HYPERLINK=11]="FOLLOWED_HYPERLINK",e))(ot||{}),$s=(e=>(e.OFFICE="Office",e.OFFICE_2007_2010="Office 2007-2010",e.GRAYSCALE="Grayscale",e.BLUE_WARM="Blue Warm",e.BLUE="Blue",e.BLUE_II="Blue II",e.BLUE_GREEN="Blue Green",e.GREEN="Green",e.GREEN_YELLOW="Green Yellow",e.YELLOW="Yellow",e.YELLOW_ORANGE="Yellow Orange",e.ORANGE="Orange",e.ORANGE_RED="Orange Red",e.RED_ORANGE="Red Orange",e.RED="Red",e.RED_VIOLET="Red Violet",e.VIOLET="Violet",e.VIOLET_II="Violet II",e.MEDIAN="Median",e.PAPER="Paper",e.MARQUEE="Marquee",e.SLIPSTREAM="Slipstream",e.Aspect="Aspect",e))($s||{}),Dc=(e=>(e[e.character=0]="character",e[e.paragraph=1]="paragraph",e[e.table=2]="table",e[e.numbering=3]="numbering",e))(Dc||{}),Lc=(e=>(e[e.TAB=0]="TAB",e[e.SPACE=1]="SPACE",e[e.NOTHING=2]="NOTHING",e))(Lc||{}),fe=(e=>(e[e.BULLET=0]="BULLET",e[e.NONE=1]="NONE",e[e.DECIMAL=2]="DECIMAL",e[e.DECIMAL_ZERO=3]="DECIMAL_ZERO",e[e.UPPER_LETTER=4]="UPPER_LETTER",e[e.LOWER_LETTER=5]="LOWER_LETTER",e[e.UPPER_ROMAN=6]="UPPER_ROMAN",e[e.LOWER_ROMAN=7]="LOWER_ROMAN",e[e.ORDINAL=8]="ORDINAL",e[e.CARDINAL_TEXT=9]="CARDINAL_TEXT",e[e.ORDINAL_TEXT=10]="ORDINAL_TEXT",e[e.HEX=11]="HEX",e[e.CHICAGO=12]="CHICAGO",e[e.IDEOGRAPH_DIGITAL=13]="IDEOGRAPH_DIGITAL",e[e.JAPANESE_COUNTING=14]="JAPANESE_COUNTING",e[e.AIUEO=15]="AIUEO",e[e.IROHA=16]="IROHA",e[e.DECIMAL_FULL_WIDTH=17]="DECIMAL_FULL_WIDTH",e[e.DECIMAL_HALF_WIDTH=18]="DECIMAL_HALF_WIDTH",e[e.JAPANESE_LEGAL=19]="JAPANESE_LEGAL",e[e.JAPANESE_DIGITAL_TEN_THOUSAND=20]="JAPANESE_DIGITAL_TEN_THOUSAND",e[e.DECIMAL_ENCLOSED_CIRCLE=21]="DECIMAL_ENCLOSED_CIRCLE",e[e.DECIMAL_FULL_WIDTH2=22]="DECIMAL_FULL_WIDTH2",e[e.AIUEO_FULL_WIDTH=23]="AIUEO_FULL_WIDTH",e[e.IROHA_FULL_WIDTH=24]="IROHA_FULL_WIDTH",e[e.GANADA=25]="GANADA",e[e.CHOSUNG=26]="CHOSUNG",e[e.DECIMAL_ENCLOSED_FULLSTOP=27]="DECIMAL_ENCLOSED_FULLSTOP",e[e.DECIMAL_ENCLOSED_PAREN=28]="DECIMAL_ENCLOSED_PAREN",e[e.DECIMAL_ENCLOSED_CIRCLE_CHINESE=29]="DECIMAL_ENCLOSED_CIRCLE_CHINESE",e[e.IDEOGRAPH_ENCLOSED_CIRCLE=30]="IDEOGRAPH_ENCLOSED_CIRCLE",e[e.IDEOGRAPH_TRADITIONAL=31]="IDEOGRAPH_TRADITIONAL",e[e.IDEOGRAPH_ZODIAC=32]="IDEOGRAPH_ZODIAC",e[e.IDEOGRAPH_ZODIAC_TRADITIONAL=33]="IDEOGRAPH_ZODIAC_TRADITIONAL",e[e.TAIWANESE_COUNTING=34]="TAIWANESE_COUNTING",e[e.IDEOGRAPH_LEGAL_TRADITIONAL=35]="IDEOGRAPH_LEGAL_TRADITIONAL",e[e.TAIWANESE_COUNTING_THOUSAND=36]="TAIWANESE_COUNTING_THOUSAND",e[e.TAIWANESE_DIGITAL=37]="TAIWANESE_DIGITAL",e[e.CHINESE_COUNTING=38]="CHINESE_COUNTING",e[e.CHINESE_LEGAL_SIMPLIFIED=39]="CHINESE_LEGAL_SIMPLIFIED",e[e.CHINESE_COUNTING_THOUSAND=40]="CHINESE_COUNTING_THOUSAND",e[e.KOREAN_DIGITAL=41]="KOREAN_DIGITAL",e[e.KOREAN_COUNTING=42]="KOREAN_COUNTING",e[e.KOREAN_LEGAL=43]="KOREAN_LEGAL",e[e.KOREAN_DIGITAL2=44]="KOREAN_DIGITAL2",e[e.VIETNAMESE_COUNTING=45]="VIETNAMESE_COUNTING",e[e.RUSSIAN_LOWER=46]="RUSSIAN_LOWER",e[e.RUSSIAN_UPPER=47]="RUSSIAN_UPPER",e[e.NUMBER_IN_DASH=48]="NUMBER_IN_DASH",e[e.HEBREW1=49]="HEBREW1",e[e.HEBREW2=50]="HEBREW2",e[e.ARABIC_ALPHA=51]="ARABIC_ALPHA",e[e.ARABIC_ABJAD=52]="ARABIC_ABJAD",e[e.HINDI_VOWELS=53]="HINDI_VOWELS",e[e.HINDI_CONSONANTS=54]="HINDI_CONSONANTS",e[e.HINDI_NUMBERS=55]="HINDI_NUMBERS",e[e.HINDI_COUNTING=56]="HINDI_COUNTING",e[e.THAI_LETTERS=57]="THAI_LETTERS",e[e.THAI_NUMBERS=58]="THAI_NUMBERS",e[e.THAI_COUNTING=59]="THAI_COUNTING",e[e.CUSTOM=60]="CUSTOM",e))(fe||{}),Pr=(e=>(e[e.BULLET_ALIGNMENT_UNSPECIFIED=0]="BULLET_ALIGNMENT_UNSPECIFIED",e[e.START=1]="START",e[e.CENTER=2]="CENTER",e[e.END=3]="END",e[e.BOTH=4]="BOTH",e))(Pr||{}),tn=(e=>(e[e.HYPERLINK=0]="HYPERLINK",e[e.FIELD=1]="FIELD",e[e.SDT=2]="SDT",e[e.BOOKMARK=3]="BOOKMARK",e[e.COMMENT=4]="COMMENT",e[e.CUSTOM=5]="CUSTOM",e[e.MENTION=6]="MENTION",e[e.UNI_FORMULA=7]="UNI_FORMULA",e[e.DELTED=9999]="DELTED",e))(tn||{}),_n=(e=>(e[e.COMMENT=0]="COMMENT",e[e.DELETED=9999]="DELETED",e))(_n||{}),xc=(e=>(e[e.DRAWING=0]="DRAWING",e[e.CUSTOM=1]="CUSTOM",e))(xc||{}),Co=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TRADITIONAL=1]="TRADITIONAL",e[e.MODERN=2]="MODERN",e))(Co||{}),Uc=(e=>(e[e.DEFAULT=0]="DEFAULT",e[e.LINES=1]="LINES",e[e.LINES_AND_CHARS=2]="LINES_AND_CHARS",e[e.SNAP_TO_CHARS=3]="SNAP_TO_CHARS",e))(Uc||{}),Pc=(e=>(e[e.SECTION_TYPE_UNSPECIFIED=0]="SECTION_TYPE_UNSPECIFIED",e[e.CONTINUOUS=1]="CONTINUOUS",e[e.NEXT_PAGE=2]="NEXT_PAGE",e[e.EVEN_PAGE=3]="EVEN_PAGE",e[e.ODD_PAGE=4]="ODD_PAGE",e))(Pc||{}),kc=(e=>(e[e.COLUMN_SEPARATOR_STYLE_UNSPECIFIED=0]="COLUMN_SEPARATOR_STYLE_UNSPECIFIED",e[e.NONE=1]="NONE",e[e.BETWEEN_EACH_COLUMN=2]="BETWEEN_EACH_COLUMN",e))(kc||{}),Fc=(e=>(e[e.NORMAL=0]="NORMAL",e[e.TBRL=1]="TBRL",e[e.LRTBV=2]="LRTBV",e))(Fc||{}),Hc=(e=>(e[e.TEXT_RUN=0]="TEXT_RUN",e[e.AUTO_TEXT=1]="AUTO_TEXT",e[e.PAGE_BREAK=2]="PAGE_BREAK",e[e.COLUMN_BREAK=3]="COLUMN_BREAK",e[e.FOOT_NOTE_REFERENCE=4]="FOOT_NOTE_REFERENCE",e[e.HORIZONTAL_RULE=5]="HORIZONTAL_RULE",e[e.EQUATION=6]="EQUATION",e[e.DRAWING=7]="DRAWING",e[e.PERSON=8]="PERSON",e[e.RICH_LINK=9]="RICH_LINK",e))(Hc||{}),Bc=(e=>(e[e.BOTH_SIDES=0]="BOTH_SIDES",e[e.LEFT=1]="LEFT",e[e.RIGHT=2]="RIGHT",e[e.LARGEST=3]="LARGEST",e))(Bc||{}),$c=(e=>(e[e.INLINE=0]="INLINE",e[e.WRAP_NONE=1]="WRAP_NONE",e[e.WRAP_POLYGON=2]="WRAP_POLYGON",e[e.WRAP_SQUARE=3]="WRAP_SQUARE",e[e.WRAP_THROUGH=4]="WRAP_THROUGH",e[e.WRAP_TIGHT=5]="WRAP_TIGHT",e[e.WRAP_TOP_AND_BOTTOM=6]="WRAP_TOP_AND_BOTTOM",e))($c||{}),qe=(e=>(e[e.NAMED_STYLE_TYPE_UNSPECIFIED=0]="NAMED_STYLE_TYPE_UNSPECIFIED",e[e.NORMAL_TEXT=1]="NORMAL_TEXT",e[e.TITLE=2]="TITLE",e[e.SUBTITLE=3]="SUBTITLE",e[e.HEADING_1=4]="HEADING_1",e[e.HEADING_2=5]="HEADING_2",e[e.HEADING_3=6]="HEADING_3",e[e.HEADING_4=7]="HEADING_4",e[e.HEADING_5=8]="HEADING_5",e))(qe||{}),jc=(e=>(e[e.AUTO=0]="AUTO",e[e.AT_LEAST=1]="AT_LEAST",e[e.EXACT=2]="EXACT",e))(jc||{}),Wc=(e=>(e[e.DASH_STYLE_UNSPECIFIED=0]="DASH_STYLE_UNSPECIFIED",e[e.SOLID=1]="SOLID",e[e.DOT=2]="DOT",e[e.DASH=3]="DASH",e))(Wc||{}),Yc=(e=>(e[e.TAB_STOP_ALIGNMENT_UNSPECIFIED=0]="TAB_STOP_ALIGNMENT_UNSPECIFIED",e[e.START=1]="START",e[e.CENTER=2]="CENTER",e[e.END=3]="END",e))(Yc||{}),zc=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SPECIFIED=1]="SPECIFIED",e))(zc||{}),Vc=(e=>(e[e.START=0]="START",e[e.CENTER=1]="CENTER",e[e.END=2]="END",e))(Vc||{}),Kc=(e=>(e[e.AUTO_FIT=0]="AUTO_FIT",e[e.FIXED=1]="FIXED",e))(Kc||{}),Gc=(e=>(e[e.NONE=0]="NONE",e[e.WRAP=1]="WRAP",e))(Gc||{}),Xc=(e=>(e[e.AUTO=0]="AUTO",e[e.AT_LEAST=1]="AT_LEAST",e[e.EXACT=2]="EXACT",e))(Xc||{}),qc=(e=>(e[e.CONTENT_ALIGNMENT_UNSPECIFIED=0]="CONTENT_ALIGNMENT_UNSPECIFIED",e[e.BOTH=1]="BOTH",e[e.TOP=2]="TOP",e[e.CENTER=3]="CENTER",e[e.BOTTOM=4]="BOTTOM",e))(qc||{}),Un=(e=>(e.NORMAL="normal",e.BOLD="bold",e.ITALIC="italic",e))(Un||{}),Jc=(e=>(e[e.PAGE=0]="PAGE",e[e.COLUMN=1]="COLUMN",e[e.CHARACTER=2]="CHARACTER",e[e.MARGIN=3]="MARGIN",e[e.INSIDE_MARGIN=4]="INSIDE_MARGIN",e[e.OUTSIDE_MARGIN=5]="OUTSIDE_MARGIN",e[e.LEFT_MARGIN=6]="LEFT_MARGIN",e[e.RIGHT_MARGIN=7]="RIGHT_MARGIN",e))(Jc||{}),Zc=(e=>(e[e.PAGE=0]="PAGE",e[e.PARAGRAPH=1]="PARAGRAPH",e[e.LINE=2]="LINE",e[e.MARGIN=3]="MARGIN",e[e.TOP_MARGIN=4]="TOP_MARGIN",e[e.BOTTOM_MARGIN=5]="BOTTOM_MARGIN",e[e.INSIDE_MARGIN=6]="INSIDE_MARGIN",e[e.OUTSIDE_MARGIN=7]="OUTSIDE_MARGIN",e))(Zc||{}),Qc=(e=>(e[e.POINT=0]="POINT",e[e.LINE=1]="LINE",e[e.CHARACTER=2]="CHARACTER",e[e.PIXEL=3]="PIXEL",e[e.PERCENT=4]="PERCENT",e))(Qc||{}),eu=(e=>(e[e.CENTER=0]="CENTER",e[e.INSIDE=1]="INSIDE",e[e.LEFT=2]="LEFT",e[e.OUTSIDE=3]="OUTSIDE",e[e.RIGHT=4]="RIGHT",e[e.BOTH=5]="BOTH",e[e.DISTRIBUTE=6]="DISTRIBUTE",e))(eu||{}),tu=(e=>(e[e.BOTTOM=0]="BOTTOM",e[e.CENTER=1]="CENTER",e[e.INSIDE=2]="INSIDE",e[e.OUTSIDE=3]="OUTSIDE",e[e.TOP=4]="TOP",e))(tu||{}),nu=(e=>(e[e.compressPunctuation=0]="compressPunctuation",e[e.compressPunctuationAndJapaneseKana=1]="compressPunctuationAndJapaneseKana",e[e.doNotCompress=2]="doNotCompress",e))(nu||{}),ru=(e=>(e[e.PORTRAIT=0]="PORTRAIT",e[e.LANDSCAPE=1]="LANDSCAPE",e))(ru||{}),ht=(e=>(e.Letter="Letter",e.Tabloid="Tabloid",e.Legal="Legal",e.Statement="Statement",e.Executive="Executive",e.Folio="Folio",e.A3="A3",e.A4="A4",e.A5="A5",e.B4="B4",e.B5="B5",e))(ht||{});const A_=["A3","A4","A5","B4","B5","Letter","Tabloid","Legal","Statement","Executive","Folio"];var su=(e=>(e[e.forward=0]="forward",e[e.backward=1]="backward",e[e.front=2]="front",e[e.back=3]="back",e))(su||{}),iu=(e=>(e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e[e.DRAWING_IMAGE=0]="DRAWING_IMAGE",e[e.DRAWING_SHAPE=1]="DRAWING_SHAPE",e[e.DRAWING_CHART=2]="DRAWING_CHART",e[e.DRAWING_TABLE=3]="DRAWING_TABLE",e[e.DRAWING_SMART_ART=4]="DRAWING_SMART_ART",e[e.DRAWING_VIDEO=5]="DRAWING_VIDEO",e[e.DRAWING_GROUP=6]="DRAWING_GROUP",e[e.DRAWING_UNIT=7]="DRAWING_UNIT",e[e.DRAWING_DOM=8]="DRAWING_DOM",e))(iu||{}),Ro=(e=>(e[e.SLIDE=0]="SLIDE",e[e.MASTER=1]="MASTER",e[e.LAYOUT=2]="LAYOUT",e[e.HANDOUT_MASTER=3]="HANDOUT_MASTER",e[e.NOTES_MASTER=4]="NOTES_MASTER",e))(Ro||{}),ou=(e=>(e[e.SHAPE=0]="SHAPE",e[e.IMAGE=1]="IMAGE",e[e.TEXT=2]="TEXT",e[e.SPREADSHEET=3]="SPREADSHEET",e[e.DOCUMENT=4]="DOCUMENT",e[e.SLIDE=5]="SLIDE",e))(ou||{}),au=(e=>(e[e.RELATIVE_SLIDE_LINK_UNSPECIFIED=0]="RELATIVE_SLIDE_LINK_UNSPECIFIED",e[e.NEXT_SLIDE=1]="NEXT_SLIDE",e[e.PREVIOUS_SLIDE=2]="PREVIOUS_SLIDE",e[e.FIRST_SLIDE=3]="FIRST_SLIDE",e[e.LAST_SLIDE=4]="LAST_SLIDE",e))(au||{});function T_(e=nt(6),t=Ur.EN_US,n=""){return{id:e,locale:t,title:n,tableSource:{},drawings:{},drawingsOrder:[],headers:{},footers:{},body:{dataStream:`\r
3
- `,textRuns:[],customBlocks:[],tables:[],paragraphs:[{startIndex:0,paragraphStyle:{spaceAbove:{v:5},lineSpacing:1,spaceBelow:{v:0}}}],sectionBreaks:[{startIndex:1}]},documentStyle:{pageSize:{width:793.3333333333334,height:1122.6666666666667},documentFlavor:Co.TRADITIONAL,marginTop:50,marginBottom:50,marginRight:50,marginLeft:50,renderConfig:{zeroWidthParagraphBreak:ce.FALSE,vertexAngle:0,centerAngle:0,background:{rgb:"#ccc"}},autoHyphenation:ce.TRUE,doNotHyphenateCaps:ce.FALSE,consecutiveHyphenLimit:2,defaultHeaderId:"",defaultFooterId:"",evenPageHeaderId:"",evenPageFooterId:"",firstPageHeaderId:"",firstPageFooterId:"",evenAndOddHeaders:ce.FALSE,useFirstPageHeaderFooter:ce.FALSE,marginHeader:30,marginFooter:30},settings:{}}}var cn={},tr={},Kr={},La;function N_(){if(La)return Kr;La=1,Object.defineProperty(Kr,"__esModule",{value:!0});function e(r,s){if(Array.isArray(s))return!1;for(let i in r)if(!n(r[i],s[i]))return!1;for(let i in s)if(r[i]===void 0)return!1;return!0}function t(r,s){if(!Array.isArray(s)||r.length!==s.length)return!1;for(let i=0;i<r.length;i++)if(!n(r[i],s[i]))return!1;return!0}function n(r,s){return r===s?!0:r===null||s===null||typeof r!="object"||typeof s!="object"?!1:Array.isArray(r)?t(r,s):e(r,s)}return Kr.default=n,Kr}var Gr={},xa;function M_(){if(xa)return Gr;xa=1,Object.defineProperty(Gr,"__esModule",{value:!0});function e(t){if(t===null)return null;if(Array.isArray(t))return t.map(e);if(typeof t=="object"){const n={};for(let r in t)n[r]=e(t[r]);return n}else return t}return Gr.default=e,Gr}var oi={},Ua;function lu(){return Ua||(Ua=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.eachChildOf=e.advancer=e.readCursor=e.writeCursor=e.WriteCursor=e.ReadCursor=e.isValidPathItem=void 0;function t(u,h){if(!u)throw new Error(h)}const n=u=>u!=null&&typeof u=="object"&&!Array.isArray(u),r=(u,h)=>typeof u==typeof h?u>h:typeof u=="string"&&typeof h=="number";function s(u,h){for(let d in u){const f=d;h.write(f,u[f])}}e.isValidPathItem=u=>typeof u=="number"||typeof u=="string"&&u!=="__proto__";class i{constructor(h=null){this.parents=[],this.indexes=[],this.lcIdx=-1,this.idx=-1,this.container=h}ascend(){t(this.parents.length===this.indexes.length/2),this.idx===0?this.parents.length?(this.lcIdx=this.indexes.pop(),this.container=this.parents.pop(),this.idx=this.indexes.pop()):(this.lcIdx=0,this.idx=-1):(t(this.idx>0),this.idx--,n(this.container[this.idx])&&this.idx--)}getPath(){const h=[];let d=this.container,f=this.parents.length-1,g=this.idx;for(;g>=0;)h.unshift(d[g]),g===0?(g=this.indexes[f*2],d=this.parents[f--]):g-=n(d[g-1])?2:1;return h}}class o extends i{get(){return this.container?this.container.slice(this.idx+1):null}getKey(){return t(this.container!=null,"Invalid call to getKey before cursor descended"),this.container[this.idx]}getComponent(){let h;return this.container&&this.container.length>this.idx+1&&n(h=this.container[this.idx+1])?h:null}descendFirst(){let h=this.idx+1;if(!this.container||h>=this.container.length||n(this.container[h])&&h+1>=this.container.length)return!1;n(this.container[h])&&h++;const d=this.container[h];return Array.isArray(d)?(this.indexes.push(this.idx),this.parents.push(this.container),this.indexes.push(h),this.idx=0,this.container=d):this.idx=h,!0}nextSibling(){if(t(this.parents.length===this.indexes.length/2),this.idx>0||this.parents.length===0)return!1;const h=this.indexes[this.indexes.length-1]+1,d=this.parents[this.parents.length-1];return h>=d.length?!1:(t(!isNaN(h)),this.indexes[this.indexes.length-1]=h,this.container=d[h],!0)}_init(h,d,f,g){this.container=h,this.idx=d,this.parents=f.slice(),this.indexes=g.slice()}clone(){const h=new o;return h._init(this.container,this.idx,this.parents,this.indexes),h}*[Symbol.iterator](){if(this.descendFirst()){do yield this.getKey();while(this.nextSibling());this.ascend()}}traverse(h,d){const f=this.getComponent();f&&d(f,h);for(const g of this)h&&h.descend(g),this.traverse(h,d),h&&h.ascend()}eachPick(h,d){this.traverse(h,(f,g)=>{f.p!=null&&d(f.p,g)})}eachDrop(h,d){this.traverse(h,(f,g)=>{f.d!=null&&d(f.d,g)})}}e.ReadCursor=o;class a extends i{constructor(h=null){super(h),this.pendingDescent=[],this._op=h}flushDescent(){t(this.parents.length===this.indexes.length/2),this.container===null&&(this._op=this.container=[]);for(let h=0;h<this.pendingDescent.length;h++){const d=this.pendingDescent[h];let f=this.idx+1;if(f<this.container.length&&n(this.container[f])&&f++,t(f===this.container.length||!n(this.container[f])),f===this.container.length)this.container.push(d),this.idx=f;else if(this.container[f]===d)this.idx=f;else{if(!Array.isArray(this.container[f])){const g=this.container.splice(f,this.container.length-f);this.container.push(g),this.lcIdx>-1&&(this.lcIdx=f)}for(this.indexes.push(this.idx),this.parents.push(this.container),this.lcIdx!==-1&&(t(r(d,this.container[this.lcIdx][0])),f=this.lcIdx+1,this.lcIdx=-1);f<this.container.length&&r(d,this.container[f][0]);)f++;if(this.indexes.push(f),this.idx=0,f<this.container.length&&this.container[f][0]===d)this.container=this.container[f];else{const g=[d];this.container.splice(f,0,g),this.container=g}}}this.pendingDescent.length=0}reset(){this.lcIdx=-1}getComponent(){this.flushDescent();const h=this.idx+1;if(h<this.container.length&&n(this.container[h]))return this.container[h];{const d={};return this.container.splice(h,0,d),d}}write(h,d){const f=this.getComponent();t(f[h]==null||f[h]===d,"Internal consistency error: Overwritten component. File a bug"),f[h]=d}get(){return this._op}descend(h){if(!e.isValidPathItem(h))throw Error("Invalid JSON key");this.pendingDescent.push(h)}descendPath(h){return this.pendingDescent.push(...h),this}ascend(){this.pendingDescent.length?this.pendingDescent.pop():super.ascend()}mergeTree(h,d=s){if(h===null)return;if(t(Array.isArray(h)),h===this._op)throw Error("Cannot merge into my own tree");const f=this.lcIdx,g=this.parents.length;let E=0;for(let R=0;R<h.length;R++){const b=h[R];typeof b=="string"||typeof b=="number"?(E++,this.descend(b)):Array.isArray(b)?this.mergeTree(b,d):typeof b=="object"&&d(b,this)}for(;E--;)this.ascend();this.lcIdx=this.parents.length===g?f:-1}at(h,d){this.descendPath(h),d(this);for(let f=0;f<h.length;f++)this.ascend();return this}writeAtPath(h,d,f){return this.at(h,()=>this.write(d,f)),this.reset(),this}writeMove(h,d,f=0){return this.writeAtPath(h,"p",f).writeAtPath(d,"d",f)}getPath(){const h=super.getPath();return h.push(...this.pendingDescent),h}}e.WriteCursor=a,e.writeCursor=()=>new a,e.readCursor=u=>new o(u);function l(u,h,d){let f,g;g=f=u?u.descendFirst():!1;function E(R){let b;for(;g;){const F=b=u.getKey();if(R!=null){let k=!1;if(h&&typeof F=="number"&&(b=h(F,u.getComponent()),b<0&&(b=~b,k=!0)),r(b,R))return null;if(b===R&&!k)return u}d&&typeof b=="number"&&d(b,u.getComponent()),g=u.nextSibling()}return null}return E.end=()=>{f&&u.ascend()},E}e.advancer=l;function c(u,h,d){let f,g,E,R;for(f=g=u&&u.descendFirst(),E=R=h&&h.descendFirst();f||E;){let b=f?u.getKey():null,F=E?h.getKey():null;b!==null&&F!==null&&(r(F,b)?F=null:b!==F&&(b=null)),d(b==null?F:b,b!=null?u:null,F!=null?h:null),b!=null&&f&&(f=u.nextSibling()),F!=null&&E&&(E=h.nextSibling())}g&&u.ascend(),R&&h.ascend()}e.eachChildOf=c})(oi)),oi}var ai={},Pa;function cu(){return Pa||(Pa=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ConflictType=void 0,(function(t){t[t.RM_UNEXPECTED_CONTENT=1]="RM_UNEXPECTED_CONTENT",t[t.DROP_COLLISION=2]="DROP_COLLISION",t[t.BLACKHOLE=3]="BLACKHOLE"})(e.ConflictType||(e.ConflictType={}))})(ai)),ai}var yt={},un={},ka;function Io(){return ka||(ka=1,Object.defineProperty(un,"__esModule",{value:!0}),un.uniToStrPos=un.strPosToUni=void 0,un.strPosToUni=(e,t=e.length)=>{let n=0,r=0;for(;r<t;r++){const s=e.charCodeAt(r);s>=55296&&s<=57343&&(n++,r++)}if(r!==t)throw Error("Invalid offset - splits unicode bytes");return r-n},un.uniToStrPos=(e,t)=>{let n=0;for(;t>0;t--){const r=e.charCodeAt(n);n+=r>=55296&&r<=57343?2:1}return n}),un}var li={},Fa;function Mi(){return Fa||(Fa=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.uniSlice=e.dlen=e.eachOp=void 0;const t=Io(),n=S=>{if(!Array.isArray(S))throw Error("Op must be an array of components");let p=null;for(let w=0;w<S.length;w++){const A=S[w];switch(typeof A){case"object":if(typeof A.d!="number"&&typeof A.d!="string")throw Error("Delete must be number or string");if(e.dlen(A.d)<=0)throw Error("Deletes must not be empty");break;case"string":if(!(A.length>0))throw Error("Inserts cannot be empty");break;case"number":if(!(A>0))throw Error("Skip components must be >0");if(typeof p=="number")throw Error("Adjacent skip components should be combined");break}p=A}if(typeof p=="number")throw Error("Op has a trailing skip")};function r(S,p){let w=0,A=0;for(let H=0;H<S.length;H++){const B=S[H];switch(p(B,w,A),typeof B){case"object":w+=e.dlen(B.d);break;case"string":A+=t.strPosToUni(B);break;case"number":w+=B,A+=B;break}}}e.eachOp=r;function s(S,p){const w=[],A=a(w);return r(S,(H,B,m)=>{A(p(H,B,m))}),h(w)}const i=S=>S,o=S=>s(S,i);e.dlen=S=>typeof S=="number"?S:t.strPosToUni(S);const a=S=>p=>{if(!(!p||p.d===0||p.d===""))if(S.length===0)S.push(p);else if(typeof p==typeof S[S.length-1])if(typeof p=="object"){const w=S[S.length-1];w.d=typeof w.d=="string"&&typeof p.d=="string"?w.d+p.d:e.dlen(w.d)+e.dlen(p.d)}else S[S.length-1]+=p;else S.push(p)},l=S=>typeof S=="number"?S:typeof S=="string"?t.strPosToUni(S):typeof S.d=="number"?S.d:t.strPosToUni(S.d);e.uniSlice=(S,p,w)=>{const A=t.uniToStrPos(S,p),H=w==null?1/0:t.uniToStrPos(S,w);return S.slice(A,H)};const c=(S,p,w)=>typeof S=="number"?w==null?S-p:Math.min(S,w)-p:e.uniSlice(S,p,w),u=S=>{let p=0,w=0;return{take:(B,m)=>{if(p===S.length)return B===-1?null:B;const x=S[p];let O;if(typeof x=="number")return B===-1||x-w<=B?(O=x-w,++p,w=0,O):(w+=B,B);if(typeof x=="string"){if(B===-1||m==="i"||t.strPosToUni(x.slice(w))<=B)return O=x.slice(w),++p,w=0,O;{const N=w+t.uniToStrPos(x.slice(w),B);return O=x.slice(w,N),w=N,O}}else{if(B===-1||m==="d"||e.dlen(x.d)-w<=B)return O={d:c(x.d,w)},++p,w=0,O;{let N=c(x.d,w,w+B);return w+=B,{d:N}}}},peek:()=>S[p]}},h=S=>(S.length>0&&typeof S[S.length-1]=="number"&&S.pop(),S);function d(S,p,w){if(w!=="left"&&w!=="right")throw Error("side ("+w+") must be 'left' or 'right'");n(S),n(p);const A=[],H=a(A),{take:B,peek:m}=u(S);for(let O=0;O<p.length;O++){const N=p[O];let y,v;switch(typeof N){case"number":for(y=N;y>0;)v=B(y,"i"),H(v),typeof v!="string"&&(y-=l(v));break;case"string":w==="left"&&typeof m()=="string"&&H(B(-1)),H(t.strPosToUni(N));break;case"object":for(y=e.dlen(N.d);y>0;)switch(v=B(y,"i"),typeof v){case"number":y-=v;break;case"string":H(v);break;case"object":y-=e.dlen(v.d)}break}}let x;for(;x=B(-1);)H(x);return h(A)}function f(S,p){n(S),n(p);const w=[],A=a(w),{take:H}=u(S);for(let m=0;m<p.length;m++){const x=p[m];let O,N;switch(typeof x){case"number":for(O=x;O>0;)N=H(O,"d"),A(N),typeof N!="object"&&(O-=l(N));break;case"string":A(x);break;case"object":O=e.dlen(x.d);let y=0;for(;y<O;)switch(N=H(O-y,"d"),typeof N){case"number":A({d:c(x.d,y,y+N)}),y+=N;break;case"string":y+=t.strPosToUni(N);break;case"object":A(N)}break}}let B;for(;B=H(-1);)A(B);return h(w)}const g=(S,p)=>{let w=0;for(let A=0;A<p.length&&S>w;A++){const H=p[A];switch(typeof H){case"number":{w+=H;break}case"string":const B=t.strPosToUni(H);w+=B,S+=B;break;case"object":S-=Math.min(e.dlen(H.d),S-w);break}}return S},E=(S,p)=>typeof S=="number"?g(S,p):S.map(w=>g(w,p));function R(S,p,w){return s(S,(A,H)=>typeof A=="object"&&typeof A.d=="number"?{d:w.slice(p,H,H+A.d)}:A)}function b(S){return s(S,p=>{switch(typeof p){case"object":if(typeof p.d=="number")throw Error("Cannot invert text op: Deleted characters missing from operation. makeInvertible must be called first.");return p.d;case"string":return{d:p};case"number":return p}})}function F(S){return s(S,p=>typeof p=="object"&&typeof p.d=="string"?{d:t.strPosToUni(p.d)}:p)}function k(S){let p=!0;return r(S,w=>{typeof w=="object"&&typeof w.d=="number"&&(p=!1)}),p}function W(S){return{name:"text-unicode",uri:"http://sharejs.org/types/text-unicode",trim:h,normalize:o,checkOp:n,create(p=""){if(typeof p!="string")throw Error("Initial data must be a string");return S.create(p)},apply(p,w){n(w);const A=S.builder(p);for(let H=0;H<w.length;H++){const B=w[H];switch(typeof B){case"number":A.skip(B);break;case"string":A.append(B);break;case"object":A.del(e.dlen(B.d));break}}return A.build()},transform:d,compose:f,transformPosition:g,transformSelection:E,isInvertible:k,makeInvertible(p,w){return R(p,w,S)},stripInvertible:F,invert:b,invertWithDoc(p,w){return b(R(p,w,S))},isNoop:p=>p.length===0}}e.default=W})(li)),li}var Xr={},Ha;function D_(){if(Ha)return Xr;Ha=1,Object.defineProperty(Xr,"__esModule",{value:!0});const e=Mi(),t=Io();function n(r,s){return{get:r,getLength(){return r().length},insert(i,o,a){const l=t.strPosToUni(r(),i);return s([l,o],a)},remove(i,o,a){const l=t.strPosToUni(r(),i);return s([l,{d:o}],a)},_onOp(i){e.eachOp(i,(o,a,l)=>{switch(typeof o){case"string":this.onInsert&&this.onInsert(l,o);break;case"object":const c=e.dlen(o.d);this.onRemove&&this.onRemove(l,c)}})},onInsert:null,onRemove:null}}return Xr.default=n,n.provides={text:!0},Xr}var Ba;function L_(){return Ba||(Ba=1,(function(e){var t=yt&&yt.__createBinding||(Object.create?(function(d,f,g,E){E===void 0&&(E=g),Object.defineProperty(d,E,{enumerable:!0,get:function(){return f[g]}})}):(function(d,f,g,E){E===void 0&&(E=g),d[E]=f[g]})),n=yt&&yt.__setModuleDefault||(Object.create?(function(d,f){Object.defineProperty(d,"default",{enumerable:!0,value:f})}):function(d,f){d.default=f}),r=yt&&yt.__importStar||function(d){if(d&&d.__esModule)return d;var f={};if(d!=null)for(var g in d)Object.hasOwnProperty.call(d,g)&&t(f,d,g);return n(f,d),f},s=yt&&yt.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(e,"__esModule",{value:!0}),e.type=e.remove=e.insert=void 0;const i=Io(),o=r(Mi()),a=s(D_()),l={create(d){return d},toString(d){return d},builder(d){if(typeof d!="string")throw Error("Invalid document snapshot: "+d);const f=[];return{skip(g){let E=i.uniToStrPos(d,g);if(E>d.length)throw Error("The op is too long for this document");f.push(d.slice(0,E)),d=d.slice(E)},append(g){f.push(g)},del(g){d=d.slice(i.uniToStrPos(d,g))},build(){return f.join("")+d}}},slice:o.uniSlice},c=o.default(l),u=Object.assign(Object.assign({},c),{api:a.default});e.type=u,e.insert=(d,f)=>f.length===0?[]:d===0?[f]:[d,f],e.remove=(d,f)=>o.dlen(f)===0?[]:d===0?[{d:f}]:[d,{d:f}];var h=Mi();Object.defineProperty(e,"makeType",{enumerable:!0,get:function(){return h.default}})})(yt)),yt}var $a;function x_(){return $a||($a=1,(function(e){var t=tr&&tr.__importDefault||function(I){return I&&I.__esModule?I:{default:I}};Object.defineProperty(e,"__esModule",{value:!0}),e.editOp=e.replaceOp=e.insertOp=e.moveOp=e.removeOp=e.type=void 0;const n=t(N_()),r=t(M_()),s=lu(),i=cu();function o(I,L){if(!I)throw new Error(L)}e.type={name:"json1",uri:"http://sharejs.org/types/JSONv1",readCursor:s.readCursor,writeCursor:s.writeCursor,create:I=>I,isNoop:I=>I==null,setDebug(I){},registerSubtype:b,checkValidOp:H,normalize:B,apply:m,transformPosition:x,compose:O,tryTransform:D,transform:J,makeInvertible:v,invert:N,invertWithDoc:T,RM_UNEXPECTED_CONTENT:i.ConflictType.RM_UNEXPECTED_CONTENT,DROP_COLLISION:i.ConflictType.DROP_COLLISION,BLACKHOLE:i.ConflictType.BLACKHOLE,transformNoConflict:(I,L,Y)=>le(()=>!0,I,L,Y),typeAllowingConflictsPred:I=>Object.assign(Object.assign({},e.type),{transform:(L,Y,z)=>le(I,L,Y,z)})};const a=I=>I?I.getComponent():null;function l(I){return I&&typeof I=="object"&&!Array.isArray(I)}const c=I=>Array.isArray(I)?I.slice():I!==null&&typeof I=="object"?Object.assign({},I):I,u=I=>I&&(I.p!=null||I.r!==void 0),h=I=>I&&(I.d!=null||I.i!==void 0);function d(I,L){return o(I!=null),typeof L=="number"?(o(Array.isArray(I),"Invalid key - child is not an array"),(I=I.slice()).splice(L,1)):(o(l(I),"Invalid key - child is not an object"),delete(I=Object.assign({},I))[L]),I}function f(I,L,Y){return typeof L=="number"?(o(I!=null,"Container is missing for key"),o(Array.isArray(I),"Cannot use numerical key for object container"),o(I.length>=L,"Cannot insert into out of bounds index"),I.splice(L,0,Y)):(o(l(I),"Cannot insert into missing item"),o(I[L]===void 0,"Trying to overwrite value at key. Your op needs to remove it first"),I[L]=Y),Y}e.removeOp=(I,L=!0)=>s.writeCursor().writeAtPath(I,"r",L).get(),e.moveOp=(I,L)=>s.writeCursor().writeMove(I,L).get(),e.insertOp=(I,L)=>s.writeCursor().writeAtPath(I,"i",L).get(),e.replaceOp=(I,L,Y)=>s.writeCursor().at(I,z=>{z.write("r",L),z.write("i",Y)}).get(),e.editOp=(I,L,Y,z=!1)=>s.writeCursor().at(I,$=>p($,L,Y,z)).get();const g=(I,L)=>I!=null&&(typeof L=="number"?Array.isArray(I):typeof I=="object"),E=(I,L)=>g(I,L)?I[L]:void 0,R={};function b(I){let L=I.type?I.type:I;L.name&&(R[L.name]=L),L.uri&&(R[L.uri]=L)}const F=I=>{const L=R[I];if(L)return L;throw Error("Missing type: "+I)};b(L_());const k=(I,L)=>I+L;b({name:"number",apply:k,compose:k,invert:I=>-I,transform:I=>I});const W=I=>I==null?null:I.et?F(I.et):I.es?R["text-unicode"]:I.ena!=null?R.number:null,S=I=>I.es?I.es:I.ena!=null?I.ena:I.e,p=(I,L,Y,z=!1)=>{const[$,j]=typeof L=="string"?[F(L),L]:[L,L.name];!z&&$.isNoop&&$.isNoop(Y)||(j==="number"?I.write("ena",Y):j==="text-unicode"?I.write("es",Y):(I.write("et",j),I.write("e",Y)))};function w(I){o(typeof I=="number"),o(I>=0),o(I===(0|I))}function A(I){typeof I=="number"?w(I):o(typeof I=="string")}function H(I){if(I===null)return;const L=new Set,Y=new Set,z=j=>{let Q=!0,ee=!1;for(let U in j){const K=j[U];if(Q=!1,o(U==="p"||U==="r"||U==="d"||U==="i"||U==="e"||U==="es"||U==="ena"||U==="et","Invalid component item '"+U+"'"),U==="p")w(K),o(!L.has(K)),L.add(K),o(j.r===void 0);else if(U==="d")w(K),o(!Y.has(K)),Y.add(K),o(j.i===void 0);else if(U==="e"||U==="es"||U==="ena"){o(!ee),ee=!0;const X=W(j);o(X,"Missing type in edit"),X.checkValidOp&&X.checkValidOp(S(j))}}o(!Q)},$=(j,Q,ee)=>{if(!Array.isArray(j))throw Error("Op must be null or a list");if(j.length===0)throw Error("Empty descent");Q||A(j[0]);let U=1,K=0,X=0;for(let ne=0;ne<j.length;ne++){const me=j[ne];if(o(me!=null),Array.isArray(me)){const pe=$(me,!1);if(K){const G=typeof X,he=typeof pe;G===he?o(X<pe,"descent keys are not in order"):o(G==="number"&&he==="string")}X=pe,K++,U=3}else typeof me=="object"?(o(U===1,`Prev not scalar - instead ${U}`),z(me),U=2):(o(U!==3),A(me),o(s.isValidPathItem(me),"Invalid path key"),U=1)}return o(K!==1,"Operation makes multiple descents. Remove some []"),o(U===2||U===3),j[0]};$(I,!0),o(L.size===Y.size,"Mismatched picks and drops in op");for(let j=0;j<L.size;j++)o(L.has(j)),o(Y.has(j))}function B(I){let L=0,Y=[];const z=s.writeCursor();return z.mergeTree(I,($,j)=>{const Q=W($);if(Q){const U=S($);p(j,Q,Q.normalize?Q.normalize(U):U)}for(const U of["r","p","i","d"])if($[U]!==void 0){const K=U==="p"||U==="d"?(ee=$[U],Y[ee]==null&&(Y[ee]=L++),Y[ee]):$[U];j.write(U,K)}var ee}),z.get()}function m(I,L){if(H(L),L===null)return I;const Y=[];return(function z($,j){let Q=$,ee=0,U={root:$},K=0,X=U,ne="root";function me(){for(;K<ee;K++){let pe=j[K];typeof pe!="object"&&(o(g(X,ne)),X=X[ne]=c(X[ne]),ne=pe)}}for(;ee<j.length;ee++){const pe=j[ee];if(Array.isArray(pe)){const G=z(Q,pe);G!==Q&&G!==void 0&&(me(),Q=X[ne]=G)}else if(typeof pe=="object"){pe.d!=null?(me(),Q=f(X,ne,Y[pe.d])):pe.i!==void 0&&(me(),Q=f(X,ne,pe.i));const G=W(pe);if(G)me(),Q=X[ne]=G.apply(Q,S(pe));else if(pe.e!==void 0)throw Error("Subtype "+pe.et+" undefined")}else Q=E(Q,pe)}return U.root})(I=(function z($,j){const Q=[];let ee=0;for(;ee<j.length;ee++){const ne=j[ee];if(Array.isArray(ne))break;typeof ne!="object"&&(Q.push($),$=E($,ne))}for(let ne=j.length-1;ne>=ee;ne--)$=z($,j[ne]);for(--ee;ee>=0;ee--){const ne=j[ee];if(typeof ne!="object"){const me=Q.pop();$=$===E(me,ne)?me:$===void 0?d(me,ne):(K=ne,X=$,(U=c(U=me))[K]=X,U)}else u(ne)&&(o($!==void 0,"Cannot pick up or remove undefined"),ne.p!=null&&(Y[ne.p]=$),$=void 0)}var U,K,X;return $})(I,L),L)}function x(I,L){I=I.slice(),H(L);const Y=s.readCursor(L);let z,$,j=!1;const Q=[];for(let U=0;;U++){const K=I[U],X=Y.getComponent();if(X&&(X.r!==void 0?j=!0:X.p!=null&&(j=!1,z=X.p,$=U)),U>=I.length)break;let ne=0;const me=s.advancer(Y,void 0,(G,he)=>{u(he)&&ne++});Q.unshift(me);const pe=me(K);if(typeof K=="number"&&(I[U]-=ne),!pe)break}if(Q.forEach(U=>U.end()),j)return null;const ee=()=>{let U=0;if(z!=null){const K=Y.getPath();U=K.length,I=K.concat(I.slice($))}for(;U<I.length;U++){const K=I[U],X=a(Y),ne=W(X);if(ne){const G=S(X);ne.transformPosition&&(I[U]=ne.transformPosition(I[U],G));break}let me=0;const pe=s.advancer(Y,(G,he)=>h(he)?~(G-me):G-me,(G,he)=>{h(he)&&me++})(K);if(typeof K=="number"&&(I[U]+=me),!pe)break}};return z!=null?Y.eachDrop(null,U=>{U===z&&ee()}):ee(),I}function O(I,L){if(H(I),H(L),I==null)return L;if(L==null)return I;let Y=0;const z=s.readCursor(I),$=s.readCursor(L),j=s.writeCursor(),Q=[],ee=[],U=[],K=[],X=[],ne=[],me=new Set;z.traverse(null,G=>{G.p!=null&&(U[G.p]=z.clone())}),$.traverse(null,G=>{G.d!=null&&(K[G.d]=$.clone())});const pe=s.writeCursor();return(function G(he,Ue,Ne,Se,Be,Ft,rt,Je){o(Ue||Ne);const $e=a(Ue),pt=a(Ne),Ot=!!pt&&pt.r!==void 0,on=!!$e&&$e.i!==void 0,Et=$e?$e.d:null,ut=pt?pt.p:null,Ht=(Ft||Ot)&&ut==null;if(ut!=null)Se=K[ut],rt=ee[ut]=new s.WriteCursor;else if(pt&&pt.r!==void 0)Se=null;else{const se=a(Se);se&&se.d!=null&&(Se=null)}const Ae=a(Se);if(Et!=null)if(he=U[Et],Je=Q[Et]=new s.WriteCursor,Ht)Ft&&!Ot&&Je.write("r",!0);else{const se=X[Et]=Y++;rt.write("d",se)}else if($e&&$e.i!==void 0)he=null;else{const se=a(he);se&&se.p!=null&&(he=null)}let oe;on?(o(Be===void 0),oe=$e.i):oe=Be;const Ce=(ut==null?!on||Ft||Ot:oe===void 0)?null:rt.getComponent();if(ut!=null){if(!(Be!==void 0||on)){const se=Et!=null?X[Et]:Y++;ne[ut]=se,Je.write("p",se)}}else Ot&&(on||Be!==void 0||(pt.r,Je.write("r",pt.r)));const ue=Ht?null:W($e),re=W(Ae);if((ue||re)&&(ue&&ue.name,re&&re.name),ue&&re){o(ue===re);const se=S($e),Re=S(Ae),Ge=ue.compose(se,Re);p(rt,ue,Ge),me.add(Ae)}else ue?p(rt,ue,S($e)):re&&(p(rt,re,S(Ae)),me.add(Ae));const de=typeof oe=="object"&&oe!=null;let be=!1,we=0,Te=0,Ke=0,ze=0,je=0;const tt=s.advancer(Se,(se,Re)=>h(Re)?ze-se-1:se-ze,(se,Re)=>{h(Re)&&ze++}),Oe=s.advancer(he,(se,Re)=>u(Re)?we-se-1:se-we,(se,Re)=>{u(Re)&&we++});if(s.eachChildOf(Ue,Ne,(se,Re,Ge)=>{let st,Bt,an=se,vt=se,Qn=se;if(typeof se=="number"){let Ze=se+Ke;Bt=tt(Ze),vt=Ze+ze;let We=se+Te;st=Oe(We),h(a(Bt))&&(st=null),an=We+we,Qn=se+je,o(an>=0,"p1PickKey is negative"),o(vt>=0,"p2DropKey is negative");const wt=h(a(Re)),$t=u(a(Ge));(wt||$t&&!Ht)&&je--,wt&&Te--,$t&&Ke--}else st=Oe(se),Bt=tt(se);Je.descend(an),rt.descend(vt);const On=de&&!h(a(Re))?oe[Qn]:void 0,Mt=G(st,Re,Ge,Bt,On,Ht,rt,Je);var Dt,ge,Fe;de&&!Ht?On!==Mt&&(be||(oe=Array.isArray(oe)?oe.slice():Object.assign({},oe),be=!0),Dt=oe,Fe=Mt,typeof(ge=Qn)=="number"?(o(Array.isArray(Dt)),o(ge<Dt.length)):(o(!Array.isArray(Dt)),o(Dt[ge]!==void 0)),Fe===void 0?typeof ge=="number"?Dt.splice(ge,1):delete Dt[ge]:Dt[ge]=Fe):o(Mt===void 0),rt.ascend(),Je.ascend()}),Oe.end(),tt.end(),Ce!=null)Ce.i=oe;else if(!Ft&&!Ot&&ut==null)return oe})(z,z.clone(),$,$.clone(),void 0,!1,j,pe),j.reset(),j.mergeTree(pe.get()),j.reset(),j.get(),Q.map(G=>G.get()),ee.map(G=>G.get()),z.traverse(j,(G,he)=>{const Ue=G.p;if(Ue!=null){const Ne=X[Ue];Ne!=null&&he.write("p",Ne);const Se=Q[Ue];Se&&Se.get(),Se&&he.mergeTree(Se.get())}else G.r!==void 0&&he.write("r",G.r)}),j.reset(),j.get(),$.traverse(j,(G,he)=>{const Ue=G.d;if(Ue!=null){const Se=ne[Ue];Se!=null&&he.write("d",Se);const Be=ee[Ue];Be&&he.mergeTree(Be.get())}else G.i!==void 0&&he.write("i",G.i);const Ne=W(G);Ne&&!me.has(G)&&p(he,Ne,S(G))}),j.get()}function N(I){if(I==null)return null;const L=new s.ReadCursor(I),Y=new s.WriteCursor;let z;const $=[],j=[];return(function Q(ee,U,K){const X=ee.getComponent();let ne,me=!1;if(X){X.p!=null&&(U.write("d",X.p),$[X.p]=ee.clone()),X.r!==void 0&&U.write("i",X.r),X.d!=null&&(U.write("p",X.d),K=void 0),X.i!==void 0&&(K=ne=X.i);const G=W(X);G&&(K===void 0?(z||(z=new Set),z.add(X)):(S(X),K=G.apply(K,S(X)),me=!0))}let pe=0;for(const G of ee){U.descend(G);const he=typeof G=="number"?G-pe:G,Ue=E(K,he);h(ee.getComponent())&&pe++;const Ne=Q(ee,U,Ue);if(K!==void 0&&Ne!==void 0){if(me||(me=!0,K=c(K)),!g(K,he))throw Error("Cannot modify child - invalid operation");K[he]=Ne}U.ascend()}if(ne===void 0)return me?K:void 0;U.write("r",K)})(L,Y,void 0),z&&(Y.reset(),(function Q(ee,U,K){const X=U.getComponent();if(X){const G=X.d;if(G!=null&&(ee=$[G],K=j[G]=s.writeCursor()),z.has(X)){const he=W(X);if(!he.invert)throw Error(`Cannot invert subtype ${he.name}`);p(K,he,he.invert(S(X)))}}let ne=0,me=0;const pe=s.advancer(ee,(G,he)=>u(he)?ne-G-1:G-ne,(G,he)=>{u(he)&&ne++});for(const G of U)if(typeof G=="number"){const he=G-me,Ue=pe(he),Ne=he+ne;K.descend(Ne),Q(Ue,U,K),h(U.getComponent())&&me++,K.ascend()}else K.descend(G),Q(pe(G),U,K),K.ascend();pe.end()})(L.clone(),L,Y),j.length&&(Y.reset(),L.traverse(Y,(Q,ee)=>{const U=Q.p;if(U!=null){const K=j[U];K&&K.get(),K&&ee.mergeTree(K.get())}}))),Y.get()}const y=(I,L)=>I.some(Y=>typeof Y=="object"&&(Array.isArray(Y)?y(Y,L):L(Y)));function v(I,L){if(I==null||!y(I,U=>{var K;return U.r!==void 0||((K=W(U))===null||K===void 0?void 0:K.makeInvertible)!=null}))return I;const Y=new s.ReadCursor(I),z=new s.WriteCursor;let $=!1;const j=[],Q=[],ee=(U,K,X)=>{const ne=U.getComponent();let me=!1;if(ne){ne.d!=null&&K.write("d",ne.d),ne.i!==void 0&&K.write("i",ne.i);const G=ne.p;if(G!=null&&(j[G]=U.clone(),o(X!==void 0,"Operation picks up at an invalid key"),Q[G]=X,K.write("p",ne.p)),ne.r!==void 0&&X===void 0)throw Error("Invalid doc / op in makeInvertible: removed item missing from doc");const he=W(ne);he&&(he.makeInvertible?$=!0:p(K,he,S(ne),!0))}let pe=0;for(const G of U){K.descend(G);const he=typeof G=="number"?G-pe:G,Ue=E(X,he),Ne=ee(U,K,Ue);Ue!==Ne&&(me||(me=!0,X=c(X)),Ne===void 0?(X=d(X,he),typeof G=="number"&&pe++):X[he]=Ne),K.ascend()}return ne&&(ne.r!==void 0?(K.write("r",r.default(X)),X=void 0):ne.p!=null&&(X=void 0)),X};return ee(Y,z,L),z.get(),$&&(z.reset(),(function U(K,X,ne,me,pe){const G=X.getComponent();if(G){G.i!==void 0?(me=G.i,pe=!0):G.d!=null&&(me=Q[G.d],K=j[G.d],pe=!1,G.d);let Se=W(G);if(Se&&Se.makeInvertible){const Be=S(G);p(ne,Se,Se.makeInvertible(Be,me),!0)}}let he=0,Ue=0;const Ne=s.advancer(K,(Se,Be)=>u(Be)?he-Se-1:Se-he,(Se,Be)=>{u(Be)&&he++});for(const Se of X)if(typeof Se=="number"){const Be=Se-Ue,Ft=Ne(Be),rt=Be+he,Je=E(me,pe?Be:rt);ne.descend(Se),U(Ft,X,ne,Je,pe),h(X.getComponent())&&Ue++,ne.ascend()}else{const Be=E(me,Se);ne.descend(Se),U(Ne(Se),X,ne,Be,pe),ne.ascend()}Ne.end()})(Y.clone(),Y,z,L,!1)),z.get()}function T(I,L){return N(v(I,L))}const M=I=>{if(I==null)return null;const L=I.slice();for(let Y=0;Y<I.length;Y++){const z=L[Y];Array.isArray(z)&&(L[Y]=M(z))}return L};function D(I,L,Y){o(Y==="left"||Y==="right","Direction must be left or right");const z=Y==="left"?0:1;if(L==null)return{ok:!0,result:I};H(I),H(L);let $=null;const j=[],Q=[],ee=[],U=[],K=[],X=[],ne=[],me=[],pe=[],G=[],he=[],Ue=[],Ne=[],Se=[],Be=[];let Ft=0;const rt=s.readCursor(I),Je=s.readCursor(L),$e=s.writeCursor();if((function Ae(oe,Ce=null,ue){const re=a(Ce);re&&(re.r!==void 0?ue=Ce.clone():re.p!=null&&(ue=null,X[re.p]=oe.clone()));const de=oe.getComponent();let be;de&&(be=de.p)!=null&&(K[be]=Ce?Ce.clone():null,ee[be]=oe.clone(),ue&&(G[be]=!0,pe[be]=ue),re&&re.p!=null&&(Se[be]=re.p));const we=s.advancer(Ce);for(const Te of oe)Ae(oe,we(Te),ue);we.end()})(Je,rt,null),(function Ae(oe,Ce,ue,re,de){const be=ue.getComponent();let we,Te=!1;be&&((we=be.d)!=null?(U[we]=ue.clone(),re!=null&&(Be[re]==null&&(Be[re]=[]),Be[re].push(we)),G[we],oe=K[we]||null,Ce=ee[we]||null,G[we]?(de&&(he[we]=!0),de=pe[we]||null):!de||z!==1&&Se[we]!=null||$==null&&($={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(de.getPath()),op2:e.moveOp(Ce.getPath(),ue.getPath())}),Te=!0):be.i!==void 0&&(oe=Ce=null,Te=!0,de&&$==null&&($={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(de.getPath()),op2:e.insertOp(ue.getPath(),be.i)})));const Ke=a(oe);Ke&&(Ke.r!==void 0?de=oe.clone():Ke.p!=null&&(Ke.p,re=Ke.p,de=null));const ze=W(be);ze&&de&&$==null&&($={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(de.getPath()),op2:e.editOp(ue.getPath(),ze,S(be),!0)});let je=0,tt=0;const Oe=s.advancer(Ce,(Re,Ge)=>u(Ge)?je-Re-1:Re-je,(Re,Ge)=>{u(Ge)&&je++}),se=s.advancer(oe);for(const Re of ue)if(typeof Re=="number"){const Ge=Re-tt,st=Oe(Ge);tt+=+Ae(se(Ge+je),st,ue,re,de)}else{const Ge=Oe(Re);Ae(se(Re),Ge,ue,re,de)}return Oe.end(),se.end(),Te})(rt,Je,Je.clone(),null,null),U.map(Ae=>Ae&&Ae.get()),$)return{ok:!1,conflict:$};he.map(Ae=>!!Ae);const pt=[];let Ot=null;(function Ae(oe,Ce,ue,re,de){let be=!1;const we=a(Ce);if(u(we)){const Oe=we.p;Oe!=null?(ue=U[Oe],re=Ue[Oe]=s.writeCursor(),be=!0,de=null):(ue=null,de=Ce.clone())}else h(a(ue))&&(ue=null);const Te=oe.getComponent();if(Te){const Oe=Te.p;Oe!=null?(de&&(me[Oe]=de),pt[Oe]=de||z===1&&be?null:re.getComponent(),j[Oe]=oe.clone(),ue&&(ne[Oe]=ue.clone())):Te.r!==void 0&&(de||re.write("r",!0),(de||be)&&(Ot==null&&(Ot=new Set),Ot.add(Te)))}let Ke=0,ze=0;const je=s.advancer(Ce,void 0,(Oe,se)=>{u(se)&&Ke++}),tt=s.advancer(ue,(Oe,se)=>h(se)?~(Oe-ze):Oe-ze,(Oe,se)=>{h(se)&&ze++});if(oe)for(const Oe of oe)if(typeof Oe=="string"){const se=je(Oe),Re=tt(Oe);re.descend(Oe),Ae(oe,se,Re,re,de),re.ascend()}else{const se=je(Oe),Re=Oe-Ke,Ge=u(a(se))?null:tt(Re),st=Re+ze;o(st>=0),re.descend(st),Ae(oe,se,Ge,re,de),re.ascend()}je.end(),tt.end()})(rt,Je,Je.clone(),$e,null),$e.reset();let on=[];if((function Ae(oe,Ce,ue,re,de,be){o(Ce);const we=Ce.getComponent();let Te=a(re),Ke=!1;const ze=(ge,Fe,Ze)=>ge?e.moveOp(ge.getPath(),Fe.getPath()):e.insertOp(Fe.getPath(),Ze.i);if(h(we)){const ge=we.d;ge!=null&&(Q[ge]=Ce.clone());const Fe=ge!=null?pt[ge]:null;let Ze=!1;if(we.i!==void 0||ge!=null&&Fe){let We;Te&&(Te.i!==void 0||(We=Te.d)!=null&&!G[We])&&(Ze=We!=null?ge!=null&&ge===Se[We]:n.default(Te.i,we.i),Ze||We!=null&&z!==1&&Se[We]!=null||$==null&&($={type:i.ConflictType.DROP_COLLISION,op1:ze(ge!=null?j[ge]:null,Ce,we),op2:ze(We!=null?ee[We]:null,re,Te)})),Ze||(be?$==null&&($={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:ze(ge!=null?j[ge]:null,Ce,we),op2:e.removeOp(be.getPath())}):(ge!=null?(on[Ft]=ge,de.write("d",Fe.p=Ft++)):de.write("i",r.default(we.i)),Ke=!0))}else if(ge!=null&&!Fe){const We=me[ge];We&&(be=We.clone())}ge!=null?(oe=j[ge],ue=X[ge],re=ne[ge]):we.i!==void 0&&(oe=ue=null,Ze||(re=null))}else u(a(oe))&&(oe=ue=re=null);const je=a(oe),tt=a(ue);if(u(tt)){const ge=tt.p;tt.r!==void 0&&(!je||je.r===void 0)||G[ge]?(re=null,be=ue.clone()):ge!=null&&(re=U[ge],z!==1&&Se[ge]!=null||((de=Ne[ge])||(de=Ne[ge]=s.writeCursor()),de.reset(),be=null))}else!h(we)&&h(Te)&&(re=null);Te=re!=null?re.getComponent():null;const Oe=W(we);if(Oe){const ge=S(we);if(be)$==null&&($={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.editOp(Ce.getPath(),Oe,ge,!0),op2:e.removeOp(be.getPath())});else{const Fe=W(Te);let Ze;if(Fe){if(Oe!==Fe)throw Error("Transforming incompatible types");const We=S(Te);Ze=Oe.transform(ge,We,Y)}else Ze=r.default(ge);p(de,Oe,Ze)}}let se=0,Re=0,Ge=0,st=0,Bt=0,an=0,vt=oe!=null&&oe.descendFirst(),Qn=vt;const On=s.advancer(ue,void 0,(ge,Fe)=>{u(Fe)&&Ge++});let Mt=re!=null&&re.descendFirst(),Dt=Mt;for(const ge of Ce)if(typeof ge=="number"){let Fe;const Ze=h(Ce.getComponent()),We=ge-Re;{let Kt;for(;vt&&typeof(Kt=oe.getKey())=="number";){Kt+=se;const bt=oe.getComponent(),vn=u(bt);if(Kt>We||Kt===We&&(!vn||z===0&&Ze))break;if(vn){se--;const ln=bt.p;Se.includes(ln),bt.d,a(Ne[bt.d]),u(a(Ne[bt.d])),(bt.r===void 0||Ot&&Ot.has(bt))&&(ln==null||!pt[ln]||z!==1&&Se.includes(ln))||Bt--}vt=oe.nextSibling()}Fe=vt&&Kt===We?oe:null}const wt=We-se;let $t=On(wt);const Zs=wt-Ge;let zr=null;{let Kt,bt;for(;Mt&&typeof(Kt=re.getKey())=="number";){bt=Kt-st;const vn=re.getComponent(),ln=h(vn);if(bt>Zs)break;if(bt===Zs){if(!ln){zr=re;break}{if(z===0&&Ze){zr=re;break}const Gt=$t&&u($t.getComponent());if(z===0&&Gt)break}}if(ln){const Gt=vn.d;G[Gt],Se[Gt],vn.i===void 0&&(G[Gt]||Se[Gt]!=null&&z!==1)?(G[Gt]||Se[Gt]!=null&&z===0)&&(st++,an--):st++}Mt=re.nextSibling()}}const fa=Zs+st+Bt+an;o(fa>=0,"trying to descend to a negative index"),de.descend(fa),Ze&&(Fe=$t=zr=null,Re++),Ae(Fe,Ce,$t,zr,de,be)&&an++,de.ascend()}else{let Fe;for(;vt&&(Fe=oe.getKey(),typeof Fe!="string"||!(Fe>ge||Fe===ge));)vt=oe.nextSibling();const Ze=vt&&Fe===ge?oe:null,We=On(ge);let wt;for(;Mt&&(wt=re.getKey(),typeof wt!="string"||!(wt>ge||wt===ge));)Mt=re.nextSibling();const $t=Mt&&wt===ge?re:null;de.descend(ge),Ae(Ze,Ce,We,$t,de,be),de.ascend()}return On.end(),Qn&&oe.ascend(),Dt&&re.ascend(),Ke})(rt,rt.clone(),Je,Je.clone(),$e,null),$)return{ok:!1,conflict:$};$e.reset();const Et=(Ae,oe,Ce)=>Ae.traverse(oe,(ue,re)=>{ue.d!=null&&Ce(ue.d,Ae,re)});(G.length||Ue.length)&&(Et(Je,$e,(Ae,oe,Ce)=>{G[Ae]&&!he[Ae]&&Ce.write("r",!0),Ue[Ae]&&Ce.mergeTree(Ue[Ae].get())}),$e.reset());const ut=[],Ht=[];if((Ne.length||G.length)&&!$){const Ae=s.readCursor(M($e.get()));if(Et(Ae,null,(oe,Ce)=>{ut[oe]=Ce.clone()}),Ne.forEach(oe=>{oe&&Et(s.readCursor(oe.get()),null,(Ce,ue)=>{ut[Ce]=ue.clone()})}),(function oe(Ce,ue,re,de,be,we){const Te=a(ue);if(Te&&u(Te))if(Te.p!=null){const se=Te.p;ut[se].getPath(),re=ut[se],de=Ht[se]=s.writeCursor()}else Te.r!==void 0&&(re=null);else h(a(re))&&(re=null);const Ke=Ce.getComponent();if(Ke){let se;if((se=Ke.d)!=null){const Re=Ne[se];Re&&(Re.get(),de.mergeTree(Re.get()),re=s.readCursor(Re.get()))}}let ze=0,je=0;const tt=s.advancer(ue,void 0,(se,Re)=>{u(Re)&&ze--}),Oe=s.advancer(re,(se,Re)=>h(Re)?-(se-je)-1:se-je,(se,Re)=>{h(Re)&&je++});for(const se of Ce)if(typeof se=="number"){const Re=tt(se),Ge=se+ze,st=Oe(Ge),Bt=Ge+je;de.descend(Bt),oe(Ce,Re,st,de),de.ascend()}else de.descend(se),oe(Ce,tt(se),Oe(se),de),de.ascend();tt.end(),Oe.end()})(Je,Ae,Ae.clone(),$e),$e.reset(),$)return{ok:!1,conflict:$};if($e.get(),Ht.length){const oe=Ht.map(ue=>ue?ue.get():null),Ce=s.readCursor(M($e.get()));if(Et(Ce,$e,(ue,re,de)=>{const be=oe[ue];be&&(de.mergeTree(be),oe[ue]=null)}),oe.find(ue=>ue)){const ue=s.writeCursor(),re=s.writeCursor();let de=0,be=0;oe.forEach(we=>{we!=null&&Et(s.readCursor(we),null,Te=>{const Ke=on[Te];ue.writeMove(j[Ke].getPath(),Q[Ke].getPath(),de++);const ze=Be[Ke];ze&&ze.forEach(je=>{G[je]||z!==1&&Se[je]!=null||re.writeMove(ee[je].getPath(),U[je].getPath(),be++)})})}),$={type:i.ConflictType.BLACKHOLE,op1:ue.get(),op2:re.get()}}}}return $?{ok:!1,conflict:$}:{ok:!0,result:$e.get()}}const P=I=>{const L=new Error("Transform detected write conflict");throw L.conflict=I,L.type=L.name="writeConflict",L};function J(I,L,Y){const z=D(I,L,Y);if(z.ok)return z.result;P(z.conflict)}const V=I=>{const L=s.writeCursor();return s.readCursor(I).traverse(L,(Y,z)=>{(h(Y)||W(Y))&&z.write("r",!0)}),L.get()},ie=(I,L)=>{const{type:Y,op1:z,op2:$}=I;switch(Y){case i.ConflictType.DROP_COLLISION:return L==="left"?[null,V($)]:[V(z),null];case i.ConflictType.RM_UNEXPECTED_CONTENT:let j=!1;return s.readCursor(z).traverse(null,Q=>{Q.r!==void 0&&(j=!0)}),j?[null,V($)]:[V(z),null];case i.ConflictType.BLACKHOLE:return[V(z),V($)];default:throw Error("Unrecognised conflict: "+Y)}};function le(I,L,Y,z){let $=null;for(;;){const j=D(L,Y,z);if(j.ok)return O($,j.result);{const{conflict:Q}=j;I(Q)||P(Q);const[ee,U]=ie(Q,z);L=O(B(L),ee),Y=O(B(Y),U),$=O($,U)}}}})(tr)),tr}var ja;function U_(){return ja||(ja=1,(function(e){var t=cn&&cn.__createBinding||(Object.create?(function(i,o,a,l){l===void 0&&(l=a),Object.defineProperty(i,l,{enumerable:!0,get:function(){return o[a]}})}):(function(i,o,a,l){l===void 0&&(l=a),i[l]=o[a]})),n=cn&&cn.__exportStar||function(i,o){for(var a in i)a!=="default"&&!o.hasOwnProperty(a)&&t(o,i,a)};Object.defineProperty(e,"__esModule",{value:!0}),n(x_(),e);var r=lu();Object.defineProperty(e,"ReadCursor",{enumerable:!0,get:function(){return r.ReadCursor}}),Object.defineProperty(e,"WriteCursor",{enumerable:!0,get:function(){return r.WriteCursor}});var s=cu();Object.defineProperty(e,"ConflictType",{enumerable:!0,get:function(){return s.ConflictType}})})(cn)),cn}var at=U_();const P_=St(at),k_=bd({__proto__:null,default:P_},[at]);var Ee=(e=>(e[e.COVER=0]="COVER",e[e.REPLACE=1]="REPLACE",e))(Ee||{}),q=(e=>(e.RETAIN="r",e.INSERT="i",e.DELETE="d",e))(q||{});const kr=ye.createIdentifier("univer.config-service");class uu{constructor(){C(this,"_configChanged$",new ae.Subject);C(this,"configChanged$",this._configChanged$.asObservable());C(this,"_config",new Map)}dispose(){this._config.clear(),this._configChanged$.complete()}getConfig(t){return this._config.get(t)}setConfig(t,n,r){var o;const{merge:s=!1}=r||{};let i=(o=this._config.get(t))!=null?o:{};s?i=Fs(i,n):i=n,this._config.set(t,i),this._configChanged$.next({[t]:i})}deleteConfig(t){return this._config.delete(t)}subscribeConfigValue$(t){return new ae.Observable(n=>{Object.prototype.hasOwnProperty.call(this._config,t)&&n.next(this._config.get(t));const r=this.configChanged$.pipe(ae.filter(s=>Object.prototype.hasOwnProperty.call(s,t))).subscribe(s=>n.next(s[t]));return()=>r.unsubscribe()})}}const Jn=ye.createIdentifier("univer.context-service");class hu extends Xe{constructor(){super(...arguments);C(this,"_contextChanged$",new ae.Subject);C(this,"contextChanged$",this._contextChanged$.asObservable());C(this,"_contextMap",new Map)}dispose(){super.dispose(),this._contextChanged$.complete(),this._contextMap.clear()}getContextValue(n){var r;return(r=this._contextMap.get(n))!=null?r:!1}setContextValue(n,r){this._contextMap.set(n,r),this._contextChanged$.next({[n]:r})}subscribeContextValue$(n){return new ae.Observable(r=>{const s=this._contextChanged$.pipe(ae.filter(i=>typeof i[n]<"u")).subscribe(i=>r.next(i[n]));return this._contextMap.has(n)&&r.next(this._contextMap.get(n)),()=>s.unsubscribe()})}}var du=(e=>(e[e.SILENT=0]="SILENT",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.VERBOSE=4]="VERBOSE",e))(du||{});const gt=ye.createIdentifier("univer.log");class fu extends Xe{constructor(){super(...arguments);C(this,"_logLevel",3);C(this,"_deduction",new Set)}dispose(){super.dispose(),this._logLevel=3,this._deduction.clear()}debug(...n){this._logLevel>=4&&this._log(console.debug,...n)}log(...n){this._logLevel>=3&&this._log(console.log,...n)}warn(...n){this._logLevel>=2&&this._log(console.warn,...n)}error(...n){this._logLevel>=1&&this._log(console.error,...n)}deprecate(...n){this._logLevel>=2&&this._logWithDeduplication(console.error,...n)}setLogLevel(n){this._logLevel=n}_log(n,...r){const s=r[0];/^\[(.*?)\]/g.test(s)?n(`\x1B[97;104m${s}\x1B[0m`,...r.slice(1)):n(...r)}_logWithDeduplication(n,...r){const s=F_(...r);this._deduction.has(s)||(this._deduction.add(s),this._log(n,...r))}}function F_(...e){return e.map(t=>JSON.stringify(t)).join("")}var H_=Object.getOwnPropertyDescriptor,B_=(e,t,n,r)=>{for(var s=r>1?void 0:r?H_(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},ci=(e,t)=>(n,r)=>t(n,r,e);const ws="command.logExecution";var Fr=(e=>(e[e.COMMAND=0]="COMMAND",e[e.OPERATION=1]="OPERATION",e[e.MUTATION=2]="MUTATION",e))(Fr||{});const Hr=ye.createIdentifier("univer.core.command-service");class $_{constructor(){C(this,"_commands",new Map);C(this,"_commandTypes",new Map)}registerCommand(t){if(this._commands.has(t.id))throw new Error(`[CommandRegistry]: command "${t.id}" has been registered before.`);return this._commands.set(t.id,t),this._commandTypes.set(t.id,t.type),Ye(()=>{this.unregisterCommand(t.id)})}unregisterCommand(t){this._commands.delete(t),this._commandTypes.delete(t)}hasCommand(t){return this._commands.has(t)}getCommand(t){return this._commands.has(t)?[this._commands.get(t)]:null}getCommandType(t){return this._commandTypes.get(t)}}const mu={id:"nil",type:0,handler:()=>!0};exports.CommandService=class extends Xe{constructor(n,r,s){super();C(this,"_commandRegistry");C(this,"_beforeCommandExecutionListeners",[]);C(this,"_commandExecutedListeners",[]);C(this,"_collabMutationListeners",[]);C(this,"_multiCommandDisposables",new Map);C(this,"_commandExecutingLevel",0);C(this,"_commandExecutionStack",[]);this._injector=n,this._logService=r,this._configService=s,this._commandRegistry=new $_,this.registerCommand(mu)}dispose(){super.dispose(),this._commandExecutedListeners.length=0,this._beforeCommandExecutionListeners.length=0,this._collabMutationListeners.length=0}disposed(){return this._disposed}hasCommand(n){return this._commandRegistry.hasCommand(n)}registerCommand(n){return this._commandRegistry.registerCommand(n)}unregisterCommand(n){var r;this._commandRegistry.unregisterCommand(n),(r=this._multiCommandDisposables.get(n))==null||r.dispose()}registerMultipleCommand(n){return this._registerMultiCommand(n)}beforeCommandExecuted(n){if(this._beforeCommandExecutionListeners.indexOf(n)===-1)return this._beforeCommandExecutionListeners.push(n),Ye(()=>{const r=this._beforeCommandExecutionListeners.indexOf(n);this._beforeCommandExecutionListeners.splice(r,1)});throw new Error("[CommandService]: could not add a listener twice.")}onCommandExecuted(n){if(this._commandExecutedListeners.indexOf(n)===-1)return this._commandExecutedListeners.push(n),Ye(()=>{const r=this._commandExecutedListeners.indexOf(n);this._commandExecutedListeners.splice(r,1)});throw new Error("[CommandService]: could not add a listener twice.")}onMutationExecutedForCollab(n){if(this._collabMutationListeners.indexOf(n)===-1)return this._collabMutationListeners.push(n),Ye(()=>{const r=this._collabMutationListeners.indexOf(n);this._collabMutationListeners.splice(r,1)});throw new Error("[CommandService]: could not add a collab mutation listener twice.")}async executeCommand(n,r,s){try{const i=this._commandRegistry.getCommand(n);if(i){const[o]=i,a={id:o.id,type:o.type,params:r},l=this._pushCommandExecutionStack(a),c=s!=null?s:{};this._beforeCommandExecutionListeners.forEach(h=>h(a,c));const u=await this._execute(o,r,c);return c.syncOnly?o.type===2&&this._collabMutationListeners.forEach(h=>h(a,c)):(this._commandExecutedListeners.forEach(h=>h(a,c)),o.type===2&&this._collabMutationListeners.forEach(h=>h(a,c))),l.dispose(),u}throw new Error(`[CommandService]: command "${n}" is not registered.`)}catch(i){if(i instanceof Cs)return!1;throw i}}syncExecuteCommand(n,r,s){var i;try{const o=this._commandRegistry.getCommand(n);if(o){const[a]=o,l={id:a.id,type:a.type,params:r};if(a.type===2){const d=Ld(this._commandExecutionStack,f=>f.type===0);d&&(l.params=(i=l.params)!=null?i:{},l.params.trigger=d.id)}const c=this._pushCommandExecutionStack(l),u=s!=null?s:{};this._beforeCommandExecutionListeners.forEach(d=>d(l,u));const h=this._syncExecute(a,r,u);return u.syncOnly?a.type===2&&this._collabMutationListeners.forEach(d=>d(l,u)):(this._commandExecutedListeners.forEach(d=>d(l,u)),a.type===2&&this._collabMutationListeners.forEach(d=>d(l,u))),c.dispose(),h}throw new Error(`[CommandService]: command "${n}" is not registered.`)}catch(o){if(o instanceof Cs)return!1;throw o}}_pushCommandExecutionStack(n){return this._commandExecutionStack.push(n),Ye(()=>Lr(this._commandExecutionStack,n))}_registerMultiCommand(n){const r=this._commandRegistry.getCommand(n.id);let s;if(r){if(r[0].multi!==!0)throw new Error("Command has registered as a single command.");s=r[0]}else{s=new j_(n.id);const o=new Hs;o.add(this._commandRegistry.registerCommand(s)),o.add(Ye(()=>{this._multiCommandDisposables.delete(n.id)})),this._multiCommandDisposables.set(n.id,o)}const i=s.registerImplementation(n);return Ye(()=>{var o;i.dispose(),s.hasImplementations()||(o=this._multiCommandDisposables.get(n.id))==null||o.dispose()})}async _execute(n,r,s){if(s!=null&&s.syncOnly)return!0;this._configService.getConfig(ws)!==!1&&this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(this._commandExecutingLevel,0))}executing command "${n.id}"`),this._commandExecutingLevel++;let i;try{i=await this._injector.invoke(n.handler,r,s),this._commandExecutingLevel--}catch(o){throw i=!1,this._commandExecutingLevel=0,o}return i}_syncExecute(n,r,s){if(s!=null&&s.syncOnly)return!0;this._configService.getConfig(ws)!==!1&&this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(0,this._commandExecutingLevel))}executing command "${n.id}".`),this._commandExecutingLevel++;let i;try{if(i=this._injector.invoke(n.handler,r,s),i instanceof Promise)throw new TypeError("[CommandService]: Command handler should not return a promise.");this._commandExecutingLevel--}catch(o){throw i=!1,this._commandExecutingLevel=0,o}return i}};exports.CommandService=B_([ci(0,ye.Inject(ye.Injector)),ci(1,gt),ci(2,kr)],exports.CommandService);class j_{constructor(t){C(this,"name");C(this,"multi",!0);C(this,"type",0);C(this,"priority",0);C(this,"_implementations",[]);C(this,"handler",async(t,n)=>{if(!this._implementations.length)return!1;const r=t.get(gt),s=t.get(Jn),i=t.get(ye.Injector);for(const o of this._implementations){const a=o.command.preconditions;if((!a||a&&a(s))&&(r.debug("[MultiCommand]",`executing implementation "${o.command.name}".`),await i.invoke(o.command.handler,n)))return!0}return!1});this.id=t,this.name=t}registerImplementation(t){const n={command:t};return this._implementations.push(n),this._implementations.sort((r,s)=>s.command.priority-r.command.priority),Ye(()=>{const r=this._implementations.indexOf(n);this._implementations.splice(r,1)})}hasImplementations(){return this._implementations.length>0}}function js(e,t,n){const r=e.map(s=>()=>t.syncExecuteCommand(s.id,s.params,n));return uc(r)}function W_(e,t,n){const r=e.map(s=>()=>t.executeCommand(s.id,s.params,n));return cc(r)}function gu(e){return new ae.Observable(t=>{const n=e((...r)=>t.next(r));return()=>n==null?void 0:n.dispose()})}function Di(e){return function(n){return new ae.Observable(r=>(n.subscribe({next:s=>{r.next(s),e(s)&&r.complete()},complete:()=>r.complete(),error:s=>r.error(s)}),()=>r.unsubscribe()))}}function Y_(e=0){return t=>{let n=[];return t.pipe(ae.tap(r=>n.push(r)),ae.debounceTime(e),ae.map(()=>n),ae.tap(()=>n=[]))}}function z_(e){const t=new ae.ReplaySubject(1);return setTimeout(()=>t.next(),e),t.pipe(ae.take(1))}function V_(e,t){const n=new ae.BehaviorSubject(t);return e.subscribe(n),n}const K_=e=>new Promise(t=>{ae.merge(gu(e.onCommandExecuted.bind(e)).pipe(os.filter(([n])=>n.type===Fr.MUTATION)),ae.timer(300)).pipe(os.debounceTime(16),os.first()).subscribe(()=>{t()})});function _u(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 G_(e,t){let n=0,r=e.length-1;for(;n<=r;){const s=Math.floor((r+n)/2);if(t<e[s]&&(s===0||t>=e[s-1]))return s;if(t>=e[s])n=s+1;else if(t<e[s])r=s-1;else return-1}return-1}function pu(e,t){let n=0,r=e.length;for(;n<r;){const s=Math.floor((n+r)/2);e[s]<=t?n=s+1:r=s}return n<e.length?n:e.length-1}function ar(e,t,n=!1){let r=e.length-1;if(t<0||t<e[0])return 0;if(e.length<40||t<=e[20]||t>=e[r-20]?r=_u(e,t):r=pu(e,t),n){const s=e[r];return e.indexOf(s)}return r}function X_(e){const t=new Blob([e],{type:"text/javascript"});return window.URL.createObjectURL(t)}const lr=2,Eu=1;function q_(e,t){if(t==null||e==null)return!0;const{left:n=0,top:r=0,height:s=0,width:i=0,angle:o=0}=t,{left:a=0,top:l=0,height:c=0,width:u=0,angle:h=0}=e,d=u,f=c,g=i,E=s;return Math.abs(a-n)>lr||Math.abs(l-r)>lr||Math.abs(d-g)>lr||Math.abs(f-E)>lr||Math.abs(h-o)>Eu}const J_="rgb(",Z_="rgba(",Li={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]};class ft{constructor(t){C(this,"_color");C(this,"_rgbColor");C(this,"_isValid",!1);if(t==null){this._setNullColor();return}if(t instanceof ft){this._color={...t._color},this._rgbColor={...t._rgbColor};return}const n=Cu(t);if(n==null){this._setNullColor();return}this._color=n;const r=rp(this._color);if(r==null){this._setNullColor();return}this._rgbColor=r,this._isValid=!0}static mix(t,n,r){var c,u;r=Math.min(1,Math.max(0,r));const s=new ft(t).toRgb(),i=new ft(n).toRgb(),o=(c=s.a)!=null?c:1,a=(u=i.a)!=null?u:1,l={r:(i.r-s.r)*r+s.r,g:(i.g-s.g)*r+s.g,b:(i.b-s.b)*r+s.b,a:(a-o)*r+o};return new ft(l)}static getContrastRatio(t,n){const r=new ft(t).getLuminance(),s=new ft(n).getLuminance();return(Math.max(r,s)+.05)/(Math.min(r,s)+.05)}get isValid(){return this._isValid}toRgb(){return this._rgbColor}toRgbString(){const{r:t,g:n,b:r,a:s=1}=this.toRgb(),i=s<1;return`rgb${i?"a":""}(${t},${n},${r}${i?`,${s}`:""})`}toString(){return this.toRgbString()}toHexString(t){const{r:n,g:r,b:s,a:i=1}=this.toRgb(),o=i<1,a=[qr(Math.round(n).toString(16)),qr(Math.round(r).toString(16)),qr(Math.round(s).toString(16)),qr(Math.round(i*255).toString(16))];return t&&a[0][0]===a[0][1]&&a[1][0]===a[1][1]&&a[2][0]===a[2][1]&&a[3][0]===a[3][1]?o?`#${a[0][0]}${a[1][0]}${a[2][0]}${a[3][0]}`:`#${a[0][0]}${a[1][0]}${a[2][0]}`:o?`#${a[0]}${a[1]}${a[2]}${a[3]}`:`#${a[0]}${a[1]}${a[2]}`}toHsv(){return ap(this.toRgb())}toHsl(){return op(this.toRgb())}lighten(t=10){const n=this.toHsl();return n.l+=t,n.l=Math.min(Math.max(n.l,0),100),new ft(n)}darken(t=10){const n=this.toHsl();return n.l-=t,n.l=Math.min(Math.max(n.l,0),100),new ft(n)}setAlpha(t){return new ft({...this._rgbColor,a:t})}getLuminance(){let{r:t,g:n,b:r}=this.toRgb();return t=ui(t),n=ui(n),r=ui(r),Number((.2126*t+.7152*n+.0722*r).toFixed(3))}getBrightness(){const{r:t,g:n,b:r}=this.toRgb();return(t*299+n*587+r*114)/1e3}getAlpha(){var t;return(t=this._color.a)!=null?t:1}isDark(){return this.getBrightness()<128}isLight(){return!this.isDark()}_setNullColor(){this._isValid=!1,this._color={r:0,g:0,b:0,a:0},this._rgbColor={r:0,g:0,b:0,a:0}}}const qr=e=>e.length===1?`0${e}`:e,ui=e=>(e/=255,e<=.03928?e/12.92:((e+.055)/1.055)**2.4),Cu=e=>{if(cp(e)){if("r"in e){const r={r:Math.round(e.r),g:Math.round(e.g),b:Math.round(e.b)};return e.a!==void 0&&(r.a=e.a),r}if("l"in e){const r={h:Math.round(e.h),s:e.s,l:e.l};return e.a!==void 0&&(r.a=e.a),r}const n={h:Math.round(e.h),s:e.s,v:e.v};return e.a!==void 0&&(n.a=e.a),n}const t=e.trim().toLowerCase();if(Li[t]){const n=Li[t],r={r:Math.round(n[0]),g:Math.round(n[1]),b:Math.round(n[2])};return r.a=n[3]||1,r}if(t.startsWith("#"))return Q_(t);if(t.startsWith("rgb"))return ep(t);if(t.startsWith("hsl"))return tp(t);if(t.startsWith("hsv"))return np(t)},Q_=e=>{const t=e.substring(1),n=new RegExp(`.{1,${t.length>=6?2:1}}`,"g");let r=t.match(n);if(!r||r.length<3)throw new Error(`The color '${e}' is illegal hex color`);r[0].length===1&&(r=r.map(i=>i+i));const s={r:Number.parseInt(r[0],16),g:Number.parseInt(r[1],16),b:Number.parseInt(r[2],16)};return r.length>3&&(s.a=Number.parseInt(r[3],16)/255),s},ep=e=>{const t=e.indexOf("(");if(t===-1)throw new Error(`The color '${e}' is illegal rgb color`);const n=e.substring(t+1,e.length-1).split(",");if(n.length<3)throw new Error(`The color '${e}' is illegal rgb color`);const r={r:Number.parseInt(n[0],10),g:Number.parseInt(n[1],10),b:Number.parseInt(n[2],10)};return n.length>3&&(r.a=Number.parseFloat(n[3])),r},tp=e=>{const t=e.indexOf("(");if(t===-1)throw new Error(`The color '${e}' is illegal hsl color`);const n=e.substring(t+1,e.length-1).split(",");if(n.length<3)throw new Error(`The color '${e}' is illegal hsl color`);const r={h:Number.parseInt(n[0],10),s:Number.parseFloat(n[1]),l:Number.parseFloat(n[2])};return n.length>3&&(r.a=Number.parseFloat(n[3])),r},np=e=>{const t=e.indexOf("(");if(t===-1)throw new Error(`The color '${e}' is illegal hsv color`);const n=e.substring(t+1,e.length-1).split(",");if(n.length<3)throw new Error(`The color '${e}' is illegal hsv color`);const r={h:Number.parseInt(n[0],10),s:Number.parseFloat(n[1]),v:Number.parseFloat(n[2])};return n.length>3&&(r.a=Number.parseFloat(n[3])),r},rp=e=>{const t=Cu(e);if(t!=null)return"r"in t?t:"l"in t?sp(t):ip(t)},hi=(e,t,n)=>(n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e),sp=e=>{let{h:t,s:n,l:r}=e;t/=360,n/=100,r/=100;let s=0,i=0,o=0;if(n===0)s=i=o=r;else{const l=r<.5?r*(1+n):r+n-r*n,c=2*r-l;s=hi(c,l,t+1/3),i=hi(c,l,t),o=hi(c,l,t-1/3)}const a={r:Math.round(s*255),g:Math.round(i*255),b:Math.round(o*255)};return e.a!==void 0&&(a.a=e.a),a},ip=e=>{let{h:t,s:n,v:r}=e;t=t/360*6,n/=100,r/=100;const s=Math.floor(t),i=t-s,o=r*(1-n),a=r*(1-i*n),l=r*(1-(1-i)*n),c=s%6,u=[r,a,o,o,l,r][c],h=[l,r,r,a,o,o][c],d=[o,o,l,r,r,a][c],f={r:u*255,g:h*255,b:d*255};return e.a!==void 0&&(f.a=e.a),f},op=e=>{let{r:t,g:n,b:r}=e;t/=255,n/=255,r/=255;const s=Math.max(t,n,r),i=Math.min(t,n,r),o=(s+i)/2;let a,l;if(s===i)a=l=0;else{const u=s-i;switch(l=o>.5?u/(2-s-i):u/(s+i),s){case t:a=(n-r)/u+(n<r?6:0);break;case n:a=(r-t)/u+2;break;default:a=(t-n)/u+4;break}a/=6}const c={h:Math.round(a*360),s:Math.round(l*100),l:Math.round(o*100)};return e.a!==void 0&&(c.a=e.a),c},ap=e=>{let{r:t,g:n,b:r}=e;t/=255,n/=255,r/=255;const s=Math.max(t,n,r),i=Math.min(t,n,r);let o;const a=s,l=s-i,c=s===0?0:l/s;if(s===i)o=0;else{switch(s){case t:o=(n-r)/l+(n<r?6:0);break;case n:o=(r-t)/l+2;break;default:o=(t-n)/l+4;break}o/=6}const u={h:Math.round(o*360),s:Math.round(c*100),v:Math.round(a*100)};return e.a!==void 0&&(u.a=e.a),u},lp=e=>e==null,cp=e=>!lp(e)&&typeof e=="object";function up(e){const t=/^#(?:[0]{3}|[0]{6})\b/,n=/^rgb\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*\)$/,r=/^rgba\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*,\s*(1|1\.0*|0?\.\d+)\)$/,s=/^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*\)$/,i=/^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/;return!!(t.test(e)||n.test(e)||r.test(e)||s.test(e)||i.test(e))}function hp(e){const t=/^#(?:[Ff]{3}|[Ff]{6})\b/,n=/^rgb\s*\(\s*255\s*,\s*255\s*,\s*255\s*\)$/,r=/^rgba\s*\(\s*255\s*,\s*255\s*,\s*255\s*,\s*(1|1\.0*|0?\.\d+)\)$/,s=/^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*\)$/,i=/^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/;return!!(t.test(e)||n.test(e)||r.test(e)||s.test(e)||i.test(e))}function Ru(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 dp(e){if(e.t!==void 0)return e.t;if(typeof e.v=="string")return Zt.STRING;if(typeof e.v=="number")return Zt.NUMBER;if(typeof e.v=="boolean")return Zt.BOOLEAN}function fp(e){if(e==null)return!0;const{v:t,f:n,si:r,p:s,custom:i}=e;return!(!(t==null||typeof t=="string"&&t.length===0)||n!=null&&n.length>0||r!=null&&r.length>0||s!=null||i!=null)}function Iu(e){return e!=null&&(typeof e=="string"||typeof e=="number"||typeof e=="boolean")}var _e=(e=>(e[e.NORMAL=0]="NORMAL",e[e.ROW=1]="ROW",e[e.COLUMN=2]="COLUMN",e[e.ALL=3]="ALL",e))(_e||{}),Me=(e=>(e[e.NONE=0]="NONE",e[e.ROW=1]="ROW",e[e.COLUMN=2]="COLUMN",e[e.ALL=3]="ALL",e))(Me||{});function mp(e){return[e.startRow,e.startColumn,e.endRow,e.endColumn]}var Su=(e=>(e.NONE="none",e.BACKWARD="backward",e.FORWARD="forward",e))(Su||{}),Ou=(e=>(e.RECT="RECT",e.TEXT="TEXT",e))(Ou||{});function gp(e,t,n){let r=!1,s=!1,i=e,o=t,a=e,l=t;if(n==null)return{actualRow:e,actualColumn:t,isMergedMainCell:s,isMerged:r,endRow:i,endColumn:o,startRow:a,startColumn:l};for(let c=0;c<n.length;c++){const{startRow:u,endRow:h,startColumn:d,endColumn:f}=n[c];if(e===u&&t===d){i=h,o=f,a=u,l=d,s=!0;break}if(e>=u&&e<=h&&t>=d&&t<=f){i=h,o=f,a=u,l=d,r=!0;break}}return{actualRow:e,actualColumn:t,isMergedMainCell:s,isMerged:r,endRow:i,endColumn:o,startRow:a,startColumn:l}}var Pn=(e=>(e.Raw="raw",e.Intercepted="intercepted",e.Both="both",e))(Pn||{});const vu={[$s.OFFICE]:{[ot.ACCENT1]:"#4472C4",[ot.ACCENT2]:"#ED7D31",[ot.ACCENT3]:"#A5A5A5",[ot.ACCENT4]:"#70AD47",[ot.ACCENT5]:"#5B9BD5",[ot.ACCENT6]:"#70AD47",[ot.DARK1]:"#000000",[ot.DARK2]:"#44546A",[ot.LIGHT1]:"#FFFFFF",[ot.LIGHT2]:"#E7E6E6",[ot.HYPERLINK]:"#0563C1",[ot.FOLLOWED_HYPERLINK]:"#954F72"}},cr=2,ur=2**2,as=2**3,hr=2**4,dr=2**5,fr=2**6,xi=2**7,Ui=2**8,Pi=2**9,_p=0,pp=2958466,Ep=-694324,Cp=35830291,Rp=-1,Wa=1,jn=6,So="general",Oo="hash",Wn="zero",vo="qmark",wo="slash",Ar="group",bs="scale",bo="comma",yo="break",Ws="text",Ao="plus",To="minus",ys="point",No="space",Mo="percent",Ys="digit",Do="calendar",Tr="error",Lo="datetime",xo="duration",Uo="condition",Po="dbnum",ko="natnum",Fo="locale",Ho="color",wu="modifier",Bo="ampm",$o="escaped",jo="string",Wo="skip",Yo="exp",zo="fill",Vo="paren",zs="char",Ip=["#000","#FFF","#F00","#0F0","#00F","#FF0","#F0F","#0FF","#000","#FFF","#F00","#0F0","#00F","#FF0","#F0F","#0FF","#800","#080","#008","#880","#808","#088","#CCC","#888","#99F","#936","#FFC","#CFF","#606","#F88","#06C","#CCF","#008","#F0F","#FF0","#0FF","#808","#800","#088","#00F","#0CF","#CFF","#CFC","#FF9","#9CF","#F9C","#C9F","#FC9","#36F","#3CC","#9C0","#FC0"],ki=["¤","$","£","¥","֏","؋","৳","฿","៛","₡","₦","₩","₪","₫","€","₭","₮","₱","₲","₴","₸","₹","₺","₼","₽","₾","₿"],Fi=new RegExp("["+ki.join("")+"]"),di=Object.freeze({1078:"af",1052:"sq",1118:"am",5121:"ar_DZ",15361:"ar_BH",3073:"ar_EG",2049:"ar_IQ",11265:"ar_JO",13313:"ar_KW",12289:"ar_LB",4097:"ar_LY",6145:"ar_MA",8193:"ar_OM",16385:"ar_QA",1025:"ar_SA",10241:"ar_SY",7169:"ar_TN",14337:"ar_AE",9217:"ar_YE",1067:"hy",1101:"as",2092:"az_AZ",1068:"az_AZ",1069:"eu",1059:"be",2117:"bn",1093:"bn_IN",5146:"bs",1026:"bg",1109:"my",1027:"ca",2052:"zh_CN",3076:"zh_HK",5124:"zh_MO",4100:"zh_SG",1028:"zh_TW",1050:"hr",1029:"cs",1030:"da",1125:"dv",2067:"nl_BE",1043:"nl_NL",1126:"bin",3081:"en_AU",10249:"en_BZ",4105:"en_CA",9225:"en_CB",2057:"en_GB",16393:"en_IN",6153:"en_IE",8201:"en_JM",5129:"en_NZ",13321:"en_PH",7177:"en_ZA",11273:"en_TT",1033:"en_US",12297:"en_ZW",1061:"et",1071:"mk",1080:"fo",1065:"fa",1124:"fil",1035:"fi",2060:"fr_BE",11276:"fr_CM",3084:"fr_CA",9228:"fr_CG",12300:"fr_CI",1036:"fr_FR",5132:"fr_LU",13324:"fr_ML",6156:"fr_MC",14348:"fr_MA",10252:"fr_SN",4108:"fr_CH",7180:"fr",1122:"fy_NL",2108:"gd_IE",1084:"gd",1110:"gl",1079:"ka",3079:"de_AT",1031:"de_DE",5127:"de_LI",4103:"de_LU",2055:"de_CH",1032:"el",1140:"gn",1095:"gu",1279:"en",1037:"he",1081:"hi",1038:"hu",1039:"is",1136:"ig_NG",1057:"id",1040:"it_IT",2064:"it_CH",1041:"ja",1099:"kn",1120:"ks",1087:"kk",1107:"km",1111:"kok",1042:"ko",1088:"ky",1108:"lo",1142:"la",1062:"lv",1063:"lt",2110:"ms_BN",1086:"ms_MY",1100:"ml",1082:"mt",1112:"mni",1153:"mi",1102:"mr",1104:"mn",2128:"mn",1121:"ne",1044:"no_NO",2068:"no_NO",1096:"or",1045:"pl",1046:"pt_BR",2070:"pt_PT",1094:"pa",1047:"rm",2072:"ro_MO",1048:"ro_RO",1049:"ru",2073:"ru_MO",1083:"se",1103:"sa",3098:"sr_SP",2074:"sr_SP",1072:"st",1074:"tn",1113:"sd",1115:"si",1051:"sk",1060:"sl",1143:"so",1070:"sb",11274:"es_AR",16394:"es_BO",13322:"es_CL",9226:"es_CO",5130:"es_CR",7178:"es_DO",12298:"es_EC",17418:"es_SV",4106:"es_GT",18442:"es_HN",2058:"es_MX",19466:"es_NI",6154:"es_PA",15370:"es_PY",10250:"es_PE",20490:"es_PR",1034:"es_ES",14346:"es_UY",8202:"es_VE",1089:"sw",2077:"sv_FI",1053:"sv_SE",1114:"syc",1064:"tg",1097:"ta",1092:"tt",1098:"te",1054:"th",1105:"bo",1073:"ts",1055:"tr",1090:"tk",1058:"uk",1056:"ur",2115:"uz_UZ",1091:"uz_UZ",1075:"ve",1066:"vi",1106:"cy",1076:"xh",1085:"yi",1077:"zu"}),bu=/^([a-z\d]+)(?:[_-]([a-z\d]+))?(?:\.([a-z\d]+))?(?:@([a-z\d]+))?$/i,kn={},_=(e,t="")=>e.replace(/~/g,t).split(";"),ke=(e,t=0,n=0)=>(e.mmm||(e.mmm=t<1?e.mmmm.concat():e.mmmm.map(r=>{const s=r.slice(0,t%10);return s+(t<10||r===s?"":".")})),e.ddd||(e.ddd=n<1?e.dddd.concat():e.dddd.map(r=>{const s=r.slice(0,n%10);return s+(n<10||r===s?"":".")})),!e.mmm6&&e.mmmm6&&(e.mmm6=e.mmmm6),e),Sp={group:" ",decimal:".",positive:"+",negative:"-",percent:"%",exponent:"E",nan:"NaN",infinity:"∞",ampm:_("AM;PM"),mmmm6:_("Muharram;Safar;Rabiʻ I;Rabiʻ II;Jumada I;Jumada II;Rajab;Shaʻban;Ramadan;Shawwal;Dhuʻl-Qiʻdah;Dhuʻl-Hijjah"),mmm6:_("Muh.;Saf.;Rab. I;Rab. II;Jum. I;Jum. II;Raj.;Sha.;Ram.;Shaw.;Dhuʻl-Q.;Dhuʻl-H."),mmmm:_("January;February;March;April;May;June;July;August;September;October;November;December"),mmm:_("Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec"),dddd:_("Sunday;Monday;Tuesday;Wednesday;Thursday;Friday;Saturday"),ddd:_("Sun;Mon;Tue;Wed;Thu;Fri;Sat"),bool:_("TRUE;FALSE"),preferMDY:!1};function Ko(e){const t=bu.exec(e);if(!t)throw new SyntaxError(`Malformed locale: ${e}`);return{lang:t[1]+(t[2]?"_"+t[2]:""),language:t[1],territory:t[2]||""}}function Go(e){if(typeof e=="number")return di[e&65535]||null;const t=parseInt(e,16);return isFinite(t)&&di[t&65535]?di[t&65535]||null:bu.test(e)?e:null}function Zn(e){const t=Go(e);let n=null;if(t){const r=Ko(t);n=kn[r.lang]||kn[r.language]||null}return n}function Hi(e){return Object.assign({},Sp,e)}function te(e,t){const n=typeof t=="object"?t:Ko(t);return kn[n.lang]=Hi(e),n.language!==n.lang&&!kn[n.language]&&(kn[n.language]=Hi(e)),kn[n.lang]}const nn=Hi({group:",",preferMDY:!0});nn.isDefault=!0;te({group:",",ampm:_("上午;下午"),mmmm:_("一月;二月;三月;四月;五月;六月;七月;八月;九月;十月;十一月;十二月"),mmm:_("1月;2月;3月;4月;5月;6月;7月;8月;9月;10月;11月;12月"),dddd:_("~日;~一;~二;~三;~四;~五;~六","星期"),ddd:_("周日;周一;周二;周三;周四;周五;周六")},"zh_CN");const Xo={group:",",ampm:_("上午;下午"),mmmm:_("1月;2月;3月;4月;5月;6月;7月;8月;9月;10月;11月;12月"),mmm:_("1月;2月;3月;4月;5月;6月;7月;8月;9月;10月;11月;12月"),dddd:_("~日;~一;~二;~三;~四;~五;~六","星期"),ddd:_("周日;周一;周二;周三;周四;周五;周六")};te({...Xo,nan:"非數值",dddd:_("~日;~一;~二;~三;~四;~五;~六","星期")},"zh_TW");te({...Xo,dddd:_("~日;~一;~二;~三;~四;~五;~六","星期")},"zh_HK");te({...Xo,ampm:_("午前;午後"),dddd:_("日~;月~;火~;水~;木~;金~;土~","曜日"),ddd:_("日;月;火;水;木;金;土")},"ja");te({group:",",ampm:_("오전;오후"),mmmm:_("1월;2월;3월;4월;5월;6월;7월;8월;9월;10월;11월;12월"),mmm:_("1월;2월;3월;4월;5월;6월;7월;8월;9월;10월;11월;12월"),dddd:_("일요일;월요일;화요일;수요일;목요일;금요일;토요일"),ddd:_("일;월;화;수;목;금;토")},"ko");te({group:",",ampm:_("ก่อนเที่ยง;หลังเที่ยง"),mmmm:_("มกร~;กุมภาพันธ์;มีน~;เมษายน;พฤษภ~;มิถุนายน;กรกฎ~;สิงห~;กันยายน;ตุล~;พฤศจิกายน;ธันว~","าคม"),mmm:_("ม.ค.;ก.พ.;มี.ค.;เม.ย.;พ.ค.;มิ.ย.;ก.ค.;ส.ค.;ก.ย.;ต.ค.;พ.ย.;ธ.ค."),dddd:_("วันอาทิตย์;วันจันทร์;วันอังคาร;วันพุธ;วันพฤหัสบดี;วันศุกร์;วันเสาร์"),ddd:_("อา.;จ.;อ.;พ.;พฤ.;ศ.;ส.")},"th");te(ke({decimal:",",ampm:_("dop.;odp."),mmmm:_("ledna;února;března;dubna;května;června;července;srpna;září;října;listopadu;prosince"),mmm:_("I;II;III;IV;V;VI;VII;VIII;IX;X;XI;XII"),dddd:_("neděle;pondělí;úterý;středa;čtvrtek;pátek;sobota"),bool:_("PRAVDA;NEPRAVDA")},-1,2),"cs");te(ke({group:".",decimal:",",mmmm:_("januar;februar;marts;april;maj;juni;juli;august;september;oktober;november;december"),dddd:_("søn~;man~;tirs~;ons~;tors~;fre~;lør~","dag"),bool:_("SAND;FALSK")},13,13),"da");te(ke({group:".",decimal:",",ampm:_("a.m.;p.m."),mmmm:_("januari;februari;maart;april;mei;juni;juli;augustus;september;oktober;november;december"),mmm:_("jan.;feb.;mrt.;apr.;mei;jun.;jul.;aug.;sep.;okt.;nov.;dec."),dddd:_("zondag;maandag;dinsdag;woensdag;donderdag;vrijdag;zaterdag"),bool:_("WAAR;ONWAAR")},-1,2),"nl");te({group:",",preferMDY:!0},"en");te({group:",",preferMDY:!0},"en_US");te({group:","},"en_AU");te({group:","},"en_CA");te({group:","},"en_GB");te({group:",",mmm:_("Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sept;Oct;Nov;Dec")},"en_IE");te(ke({decimal:",",nan:"epäluku",ampm:_("ap.;ip."),mmmm:_("tammi~;helmi~;maalis~;huhti~;touko~;kesä~;heinä~;elo~;syys~;loka~;marras~;joulu~","kuuta"),mmm:_("tammik.;helmik.;maalisk.;huhtik.;toukok.;kesäk.;heinäk.;elok.;syysk.;lokak.;marrask.;jouluk."),dddd:_("sunnun~;maanan~;tiis~;keskiviikkona;tors~;perjan~;lauan~","taina"),bool:_("TOSI;EPÄTOSI")},-1,2),"fi");const qo=ke({group:" ",decimal:",",mmmm:_("janvier;février;mars;avril;mai;juin;juillet;août;septembre;octobre;novembre;décembre"),mmm:_("janv.;févr.;mars;avr.;mai;juin;juil.;août;sept.;oct.;nov.;déc."),dddd:_("~manche;lun~;mar~;mercre~;jeu~;vendre~;same~","di"),bool:_("VRAI;FAUX")},-1,13);te({...qo},"fr");te({...qo,mmm:_("janv.;févr.;mars;avr.;mai;juin;juill.;août;sept.;oct.;nov.;déc.")},"fr_CA");te({group:"'",decimal:".",...qo},"fr_CH");const yu=ke({mmmm:_("Januar;Februar;März;April;Mai;Juni;Juli;August;September;Oktober;November;Dezember"),mmm:_("Jan.;Feb.;März;Apr.;Mai;Juni;Juli;Aug.;Sept.;Okt.;Nov.;Dez."),dddd:_("Sonn~;Mon~;Diens~;Mittwoch;Donners~;Frei~;Sams~","tag"),bool:_("WAHR;FALSCH")},-1,12);te({group:".",decimal:",",...yu},"de");te({group:"'",decimal:".",...yu},"de_CH");te(ke({group:".",decimal:",",ampm:_("π.μ.;μ.μ."),mmmm:_("Ιανουαρ~;Φεβρουαρ~;Μαρτ~;Απριλ~;Μαΐου;Ιουν~;Ιουλ~;Αυγούστου;Σεπτεμβρ~;Οκτωβρ~;Νοεμβρ~;Δεκεμβρ~","ίου"),mmm:_("Ιαν;Φεβ;Μαρ;Απρ;Μαΐ;Ιουν;Ιουλ;Αυγ;Σεπ;Οκτ;Νοε;Δεκ"),dddd:_("Κυριακή;Δευτέρα;Τρίτη;Τετάρτη;Πέμπτη;Παρασκευή;Σάββατο")},-1,3),"el");te({decimal:",",ampm:_("de.;du."),mmmm:_("január;február;március;április;május;június;július;augusztus;szeptember;október;november;december"),mmm:_("jan.;febr.;márc.;ápr.;máj.;jún.;júl.;aug.;szept.;okt.;nov.;dec."),dddd:_("vasárnap;hétfő;kedd;szerda;csütörtök;péntek;szombat"),ddd:_("V;H;K;Sze;Cs;P;Szo"),bool:_("IGAZ;HAMIS")},"hu");te(ke({group:".",decimal:",",ampm:_("f.h.;e.h."),mmmm:_("janúar;febrúar;mars;apríl;maí;júní;júlí;ágúst;september;október;nóvember;desember"),dddd:_("sunnu~;mánu~;þriðju~;miðviku~;fimmtu~;föstu~;laugar~","dagur")},13,13),"is");te(ke({group:".",decimal:",",mmmm:_("Januari;Februari;Maret;April;Mei;Juni;Juli;Agustus;September;Oktober;November;Desember"),dddd:_("Minggu;Senin;Selasa;Rabu;Kamis;Jumat;Sabtu")},3,3),"id");const Au=ke({mmmm:_("gennaio;febbraio;marzo;aprile;maggio;giugno;luglio;agosto;settembre;ottobre;novembre;dicembre"),dddd:_("domenica;lunedì;martedì;mercoledì;giovedì;venerdì;sabato"),bool:_("VERO;FALSO")},3,3);te({group:".",decimal:",",...Au},"it");te({group:"'",decimal:".",...Au},"it_CH");const Tu={decimal:",",ampm:_("a.m.;p.m."),mmmm:_("januar;februar;mars;april;mai;juni;juli;august;september;oktober;november;desember"),mmm:_("jan.;feb.;mar.;apr.;mai;jun.;jul.;aug.;sep.;okt.;nov.;des."),dddd:_("søn~;man~;tirs~;ons~;tors~;fre~;lør~","dag"),bool:_("SANN;USANN")};te(ke({...Tu},-1,13),"nb");te(ke({...Tu},-1,13),"no");te(ke({decimal:",",mmmm:_("stycznia;lutego;marca;kwietnia;maja;czerwca;lipca;sierpnia;września;października;listopada;grudnia"),dddd:_("niedziela;poniedziałek;wtorek;środa;czwartek;piątek;sobota"),ddd:_("niedz.;pon.;wt.;śr.;czw.;pt.;sob."),bool:_("PRAWDA;FAŁSZ")},3,-1),"pl");const Nu={group:".",decimal:",",mmmm:_("janeiro;fevereiro;março;abril;maio;junho;julho;agosto;setembro;outubro;novembro;dezembro"),dddd:_("domingo;segunda-feira;terça-feira;quarta-feira;quinta-feira;sexta-feira;sábado"),bool:_("VERDADEIRO;FALSO")};te(ke(Nu,13,13),"pt");te(ke(Nu,13,13),"pt_BR");te({decimal:",",nan:"не число",mmmm:_("января;февраля;марта;апреля;мая;июня;июля;августа;сентября;октября;ноября;декабря"),mmm:_("янв.;февр.;мар.;апр.;мая;июн.;июл.;авг.;сент.;окт.;нояб.;дек."),dddd:_("воскресенье;понедельник;вторник;среда;четверг;пятница;суббота"),ddd:_("вс;пн;вт;ср;чт;пт;сб"),mmmm6:_("рамадан;шавваль;зуль-каада;зуль-хиджжа;мухаррам;раби-уль-авваль;раби-уль-ахир;джумад-уль-авваль;джумад-уль-ахир;раджаб;шаабан;рамадан"),mmm6:_("рам.;шав.;зуль-к.;зуль-х.;мух.;раб. I;раб. II;джум. I;джум. II;радж.;шааб.;рам."),bool:_("ИСТИНА;ЛОЖЬ")},"ru");te(ke({decimal:",",mmmm:_("januára;februára;marca;apríla;mája;júna;júla;augusta;septembra;októbra;novembra;decembra"),dddd:_("nedeľa;pondelok;utorok;streda;štvrtok;piatok;sobota")},3,2),"sk");const kt={group:".",decimal:",",ampm:_("a. m.;p. m."),mmmm:_("enero;febrero;marzo;abril;mayo;junio;julio;agosto;septiem~;octu~;noviem~;diciem~","bre"),mmm:_("ene;feb;mar;abr;may;jun;jul;ago;sept;oct;nov;dic"),dddd:_("domingo;lunes;martes;miércoles;jueves;viernes;sábado"),ddd:_("dom;lun;mar;mié;jue;vie;sáb"),bool:_("VERDADERO;FALSO")},Op=_("ene;feb;mar;abr;may;jun;jul;ago;sep;oct;nov;dic"),Jo=_("ene.;feb.;mar.;abr.;may.;jun.;jul.;ago.;sept.;oct.;nov.;dic.");te({...kt},"es");te({...kt},"es_AR");te({...kt},"es_BO");te({...kt},"es_CL");te({...kt},"es_CO");te({...kt},"es_EC");te({...kt,mmm:Op,ampm:_("a.m.;p.m.")},"es_MX");te({...kt,mmm:Jo},"es_PY");te({...kt,mmm:Jo},"es_UY");te({...kt,mmm:Jo,mmmm:_("enero;febrero;marzo;abril;mayo;junio;julio;agosto;setiembre;octubre;noviembre;diciembre")},"es_VE");te({decimal:",",ampm:_("fm;em"),mmmm:_("januari;februari;mars;april;maj;juni;juli;augusti;september;oktober;november;december"),mmm:_("jan.;feb.;mars;apr.;maj;juni;juli;aug.;sep.;okt.;nov.;dec."),dddd:_("sön~;mån~;tis~;ons~;tors~;fre~;lör~","dag"),ddd:_("sön;mån;tis;ons;tors;fre;lör")},"sv");te(ke({group:".",decimal:",",ampm:_("ÖÖ;ÖS"),mmmm:_("Ocak;Şubat;Mart;Nisan;Mayıs;Haziran;Temmuz;Ağustos;Eylül;Ekim;Kasım;Aralık"),mmm:_("Oca;Şub;Mar;Nis;May;Haz;Tem;Ağu;Eyl;Eki;Kas;Ara"),dddd:_("Pazar;Pazartesi;Salı;Çarşamba;Perşembe;Cuma;Cumartesi"),ddd:_("Paz;Pzt;Sal;Çar;Per;Cum;Cmt"),bool:_("DOĞRU;YANLIŞ")},3,-1),"tr");te({group:",",ampm:_("yb;yh"),mmmm:_("Ionawr;Chwefror;Mawrth;Ebrill;Mai;Mehefin;Gorffennaf;Awst;Medi;Hydref;Tachwedd;Rhagfyr"),mmm:_("Ion;Chwef;Maw;Ebr;Mai;Meh;Gorff;Awst;Medi;Hyd;Tach;Rhag"),dddd:_("Dydd Sul;Dydd Llun;Dydd Mawrth;Dydd Mercher;Dydd Iau;Dydd Gwener;Dydd Sadwrn"),ddd:_("Sul;Llun;Maw;Mer;Iau;Gwen;Sad")},"cy");te({group:".",decimal:",",mmmm:_("yanvar;fevral;mart;aprel;may;iyun;iyul;avqust;sentyabr;oktyabr;noyabr;dekabr"),mmm:_("yan;fev;mar;apr;may;iyn;iyl;avq;sen;okt;noy;dek"),dddd:_("bazar;bazar ertəsi;çərşənbə axşamı;çərşənbə;cümə axşamı;cümə;şənbə"),ddd:_("B.;B.e.;Ç.a.;Ç.;C.a.;C.;Ş.")},"az");te(ke({decimal:",",mmmm:_("студзеня;лютага;сакавіка;красавіка;мая;чэрвеня;ліпеня;жніўня;верасня;кастрычніка;лістапада;снежня"),dddd:_("нядзеля;панядзелак;аўторак;серада;чацвер;пятніца;субота"),ddd:_("нд;пн;аў;ср;чц;пт;сб")},3,-1),"be");te({decimal:",",ampm:_("пр.об.;сл.об."),mmmm:_("януари;февруари;март;април;май;юни;юли;август;септември;октомври;ноември;декември"),mmm:_("яну;фев;март;апр;май;юни;юли;авг;сеп;окт;ное;дек"),dddd:_("неделя;понеделник;вторник;сряда;четвъртък;петък;събота"),ddd:_("нд;пн;вт;ср;чт;пт;сб"),bool:_("ИСТИНА;ЛОЖЬ")},"bg");te({group:".",decimal:",",mmmm:_("de gener;de febrer;de març;d’abril;de maig;de juny;de juliol;d’agost;de setembre;d’octubre;de novembre;de desembre"),mmm:_("de gen.;de febr.;de març;d’abr.;de maig;de juny;de jul.;d’ag.;de set.;d’oct.;de nov.;de des."),dddd:_("diumenge;dilluns;dimarts;dimecres;dijous;divendres;dissabte"),ddd:_("dg.;dl.;dt.;dc.;dj.;dv.;ds."),ampm:_("a. m.;p. m.")},"ca");te(ke({group:",",decimal:".",mmmm:_("Enero;Pebrero;Marso;Abril;Mayo;Hunyo;Hulyo;Agosto;Setyembre;Oktubre;Nobyembre;Disyembre"),dddd:_("Linggo;Lunes;Martes;Miyerkules;Huwebes;Biyernes;Sabado")},3,3),"fil");te({group:",",decimal:".",mmmm:_("જાન્યુઆરી;ફેબ્રુઆરી;માર્ચ;એપ્રિલ;મે;જૂન;જુલાઈ;ઑગસ્ટ;સપ્ટેમ્બર;ઑક્ટોબર;નવેમ્બર;ડિસેમ્બર"),mmm:_("જાન્યુ;ફેબ્રુ;માર્ચ;એપ્રિલ;મે;જૂન;જુલાઈ;ઑગસ્ટ;સપ્ટે;ઑક્ટો;નવે;ડિસે"),dddd:_("રવિ~;સોમ~;મંગળ~;બુધ~;ગુરુ~;શુક્ર~;શનિ~","વાર"),ddd:_("રવિ;સોમ;મંગળ;બુધ;ગુરુ;શુક્ર;શનિ")},"gu");te({group:",",decimal:".",ampm:_("לפנה״צ;אחה״צ"),dddd:_("~ראשון;~שני;~שלישי;~רביעי;~חמישי;~שישי;~שבת","יום "),ddd:_("~א׳;~ב׳;~ג׳;~ד׳;~ה׳;~ו׳;שבת","יום "),mmmm:_("ינואר;פברואר;מרץ;אפריל;מאי;יוני;יולי;אוגוסט;ספטמבר;אוקטובר;נובמבר;דצמבר"),mmm:_("ינו׳;פבר׳;מרץ;אפר׳;מאי;יוני;יולי;אוג׳;ספט׳;אוק׳;נוב׳;דצמ׳"),mmmm6:_("רמדאן;שוואל;ד׳ו אל־קעדה;ד׳ו אל־חיג׳ה;מוחרם;רביע אל־אוול;רביע א־ת׳אני;ג׳ומאדא אל־אולא;ג׳ומאדא א־ת׳אניה;רג׳ב;שעבאן;רמדאן"),mmm6:_("רמדאן;שוואל;ד׳ו אל־קעדה;ד׳ו אל־חיג׳ה;מוחרם;רביע א׳;רביע ב׳;ג׳ומאדא א׳;ג׳ומאדא ב׳;רג׳ב;שעבאן;רמדאן")},"he");te(ke({group:".",decimal:",",mmmm:_("siječnja;veljače;ožujka;travnja;svibnja;lipnja;srpnja;kolovoza;rujna;listopada;studenoga;prosinca"),mmm:_("sij;velj;ožu;tra;svi;lip;srp;kol;ruj;lis;stu;pro"),dddd:_("nedjelja;ponedjeljak;utorak;srijeda;četvrtak;petak;subota")},-1,3),"hr");te({decimal:",",mmmm:_("հունվարի;փետրվարի;մարտի;ապրիլի;մայիսի;հունիսի;հուլիսի;օգոստոսի;սեպտեմբերի;հոկտեմբերի;նոյեմբերի;դեկտեմբերի"),mmm:_("հնվ;փտվ;մրտ;ապր;մյս;հնս;հլս;օգս;սեպ;հոկ;նոյ;դեկ"),dddd:_("կիրակի;երկուշաբթի;երեքշաբթի;չորեքշաբթի;հինգշաբթի;ուրբաթ;շաբաթ"),ddd:_("կիր;երկ;երք;չրք;հնգ;ուր;շբթ")},"hy");te(ke({decimal:",",mmmm:_("იანვარი;თებერვალი;მარტი;აპრილი;მაისი;ივნისი;ივლისი;აგვისტო;სექტემბერი;ოქტომბერი;ნოემბერი;დეკემბერი"),dddd:_("კვირა;ორშაბათი;სამშაბათი;ოთხშაბათი;ხუთშაბათი;პარასკევი;შაბათი")},3,3),"ka");te(ke({decimal:",",mmmm:_("қаңтар;ақпан;наурыз;сәуір;мамыр;маусым;шілде;тамыз;қыркүйек;қазан;қараша;желтоқсан"),dddd:_("жексенбі;дүйсенбі;сейсенбі;сәрсенбі;бейсенбі;жұма;сенбі"),ddd:_("жс;дс;сс;ср;бс;жм;сб")},13,-1),"kk");te({group:",",mmmm:_("ಜನವರಿ;ಫೆಬ್ರವರಿ;ಮಾರ್ಚ್;ಏಪ್ರಿಲ್;ಮೇ;ಜೂನ್;ಜುಲೈ;ಆಗಸ್ಟ್;ಸೆಪ್ಟೆಂಬರ್;ಅಕ್ಟೋಬರ್;ನವೆಂಬರ್;ಡಿಸೆಂಬರ್"),mmm:_("ಜನವರಿ;ಫೆಬ್ರವರಿ;ಮಾರ್ಚ್;ಏಪ್ರಿ;ಮೇ;ಜೂನ್;ಜುಲೈ;ಆಗಸ್ಟ್;ಸೆಪ್ಟೆಂ;ಅಕ್ಟೋ;ನವೆಂ;ಡಿಸೆಂ"),dddd:_("ಭಾನು~;ಸೋಮ~;ಮಂಗಳ~;ಬುಧ~;ಗುರು~;ಶುಕ್ರ~;ಶನಿ~","ವಾರ"),ddd:_("ಭಾನು;ಸೋಮ;ಮಂಗಳ;ಬುಧ;ಗುರು;ಶುಕ್ರ;ಶನಿ"),ampm:_("ಪೂರ್ವಾಹ್ನ;ಅಪರಾಹ್ನ")},"kn");te({decimal:",",mmmm:_("sausio;vasario;kovo;balandžio;gegužės;birželio;liepos;rugpjūčio;rugsėjo;spalio;lapkričio;gruodžio"),mmm:_("saus.;vas.;kov.;bal.;geg.;birž.;liep.;rugp.;rugs.;spal.;lapkr.;gruod."),dddd:_("sekmadienis;pirmadienis;antradienis;trečiadienis;ketvirtadienis;penktadienis;šeštadienis"),ddd:_("sk;pr;an;tr;kt;pn;št"),ampm:_("priešpiet;popiet")},"lt");te({decimal:",",mmmm:_("janvāris;februāris;marts;aprīlis;maijs;jūnijs;jūlijs;augusts;septembris;oktobris;novembris;decembris"),mmm:_("janv.;febr.;marts;apr.;maijs;jūn.;jūl.;aug.;sept.;okt.;nov.;dec."),dddd:_("svētdiena;pirmdiena;otrdiena;trešdiena;ceturtdiena;piektdiena;sestdiena"),ddd:_("svētd.;pirmd.;otrd.;trešd.;ceturtd.;piektd.;sestd."),ampm:_("priekšpusdienā;pēcpusdienā")},"lv");te({group:",",decimal:".",mmmm:_("ജനുവരി;ഫെബ്രുവരി;മാർച്ച്;ഏപ്രിൽ;മേയ്;ജൂൺ;ജൂലൈ;ഓഗസ്റ്റ്;സെപ്റ്റംബർ;ഒക്‌ടോബർ;നവംബർ;ഡിസംബർ"),mmm:_("ജനു;ഫെബ്രു;മാർ;ഏപ്രി;മേയ്;ജൂൺ;ജൂലൈ;ഓഗ;സെപ്റ്റം;ഒക്ടോ;നവം;ഡിസം"),dddd:_("ഞായറാഴ്‌ച;തിങ്കളാഴ്‌ച;ചൊവ്വാഴ്ച;ബുധനാഴ്‌ച;വ്യാഴാഴ്‌ച;വെള്ളിയാഴ്‌ച;ശനിയാഴ്‌ച"),ddd:_("ഞായർ;തിങ്കൾ;ചൊവ്വ;ബുധൻ;വ്യാഴം;വെള്ളി;ശനി")},"ml");te({group:",",decimal:".",mmmm:_("нэгдүгээ~;хоёрдугаа~;гуравдугаа~;дөрөвдүгээ~;тавдугаа~;зургаадугаа~;долоодугаа~;наймдугаа~;есдүгээ~;аравдугаа~;арван нэгдүгээ~;арван хоёрдугаа~","р сар"),mmm:_("1~;2~;3~;4~;5~;6~;7~;8~;9~;10~;11~;12~","-р сар"),dddd:_("ням;даваа;мягмар;лхагва;пүрэв;баасан;бямба"),ddd:_("Ня;Да;Мя;Лх;Пү;Ба;Бя"),ampm:_("ү.ө.;ү.х.")},"mn");te({group:",",decimal:".",mmmm:_("जानेवारी;फेब्रुवारी;मार्च;एप्रिल;मे;जून;जुलै;ऑगस्ट;सप्टेंबर;ऑक्टोबर;नोव्हेंबर;डिसेंबर"),mmm:_("जाने;फेब्रु;मार्च;एप्रि;मे;जून;जुलै;ऑग;सप्टें;ऑक्टो;नोव्हें;डिसें"),dddd:_("रविवार;सोमवार;मंगळवार;बुधवार;गुरुवार;शुक्रवार;शनिवार"),ddd:_("रवि;सोम;मंगळ;बुध;गुरु;शुक्र;शनि")},"mr");te(ke({group:",",decimal:".",mmmm:_("ဇန်နဝါရီ;ဖေဖော်ဝါရီ;မတ်;ဧပြီ;မေ;ဇွန်;ဇူလိုင်;ဩဂုတ်;စက်တင်ဘာ;အောက်တိုဘာ;နိုဝင်ဘာ;ဒီဇင်ဘာ"),mmm:_("ဇန်;ဖေ;မတ်;ဧ;မေ;ဇွန်;ဇူ;ဩ;စက်;အောက်;နို;ဒီ"),dddd:_("တနင်္ဂနွေ;တနင်္လာ;အင်္ဂါ;ဗုဒ္ဓဟူး;ကြာသပတေး;သောကြာ;စနေ"),ampm:_("နံနက်;ညနေ")},-1,0),"my");te({group:",",decimal:".",mmmm:_("ਜਨਵਰੀ;ਫ਼ਰਵਰੀ;ਮਾਰਚ;ਅਪ੍ਰੈਲ;ਮਈ;ਜੂਨ;ਜੁਲਾਈ;ਅਗਸਤ;ਸਤੰਬਰ;ਅਕਤੂਬਰ;ਨਵੰਬਰ;ਦਸੰਬਰ"),mmm:_("ਜਨ;ਫ਼ਰ;ਮਾਰਚ;ਅਪ੍ਰੈ;ਮਈ;ਜੂਨ;ਜੁਲਾ;ਅਗ;ਸਤੰ;ਅਕਤੂ;ਨਵੰ;ਦਸੰ"),dddd:_("ਐਤਵਾਰ;ਸੋਮਵਾਰ;ਮੰਗਲਵਾਰ;ਬੁੱਧਵਾਰ;ਵੀਰਵਾਰ;ਸ਼ੁੱਕਰਵਾਰ;ਸ਼ਨਿੱਚਰਵਾਰ"),ddd:_("ਐਤ;ਸੋਮ;ਮੰਗਲ;ਬੁੱਧ;ਵੀਰ;ਸ਼ੁੱਕਰ;ਸ਼ਨਿੱਚਰ"),ampm:_("ਪੂ.ਦੁ.;ਬਾ.ਦੁ.")},"pa");te({group:".",decimal:",",mmmm:_("ianuarie;februarie;martie;aprilie;mai;iunie;iulie;august;septem~;octom~;noiem~;decem~","brie"),mmm:_("ian.;feb.;mar.;apr.;mai;iun.;iul.;aug.;sept.;oct.;nov.;dec."),dddd:_("duminică;luni;marți;miercuri;joi;vineri;sâmbătă"),ddd:_("dum.;lun.;mar.;mie.;joi;vin.;sâm."),ampm:_("a.m.;p.m.")},"ro");te(ke({group:".",decimal:",",mmmm:_("januar;februar;marec;april;maj;junij;julij;avgust;september;oktober;november;december"),mmm:_("jan.;feb.;mar.;apr.;maj;jun.;jul.;avg.;sep.;okt.;nov.;dec."),dddd:_("nedelja;ponedeljek;torek;sreda;četrtek;petek;sobota"),ampm:_("dop.;pop.")},-1,13),"sl");te(ke({group:".",decimal:",",mmmm:_("јануар;фебруар;март;април;мај;јун;јул;август;септембар;октобар;новембар;децембар"),dddd:_("недеља;понедељак;уторак;среда;четвртак;петак;субота")},3,3),"sr");te({group:",",decimal:".",mmmm:_("ஜனவரி;பிப்ரவரி;மார்ச்;ஏப்ரல்;மே;ஜூன்;ஜூலை;ஆகஸ்ட்;செப்டம்பர்;அக்டோபர்;நவம்பர்;டிசம்பர்"),mmm:_("ஜன.;பிப்.;மார்.;ஏப்.;மே;ஜூன்;ஜூலை;ஆக.;செப்.;அக்.;நவ.;டிச."),dddd:_("ஞாயிறு;திங்கள்;செவ்வாய்;புதன்;வியாழன்;வெள்ளி;சனி"),ddd:_("ஞாயி.;திங்.;செவ்.;புத.;வியா.;வெள்.;சனி")},"ta");te({group:",",decimal:".",mmmm:_("జనవరి;ఫిబ్రవరి;మార్చి;ఏప్రిల్;మే;జూన్;జులై;ఆగస్టు;సెప్టెంబర్;అక్టోబర్;నవంబర్;డిసెంబర్"),mmm:_("జన;ఫిబ్ర;మార్చి;ఏప్రి;మే;జూన్;జులై;ఆగ;సెప్టెం;అక్టో;నవం;డిసెం"),dddd:_("ఆదివారం;సోమవారం;మంగళవారం;బుధవారం;గురువారం;శుక్రవారం;శనివారం"),ddd:_("ఆది;సోమ;మంగళ;బుధ;గురు;శుక్ర;శని")},"te");te({decimal:",",mmmm:_("січня;лютого;березня;квітня;травня;червня;липня;серпня;вересня;жовтня;листопада;грудня"),mmm:_("січ.;лют.;бер.;квіт.;трав.;черв.;лип.;серп.;вер.;жовт.;лист.;груд."),dddd:_("неділю;понеділок;вівторок;середу;четвер;пʼятницю;суботу"),ddd:_("нд;пн;вт;ср;чт;пт;сб"),ampm:_("дп;пп")},"uk");te({group:".",decimal:",",mmmm:_("~1;~2;~3;~4;~5;~6;~7;~8;~9;~10;~11;~12","tháng "),mmm:_("~1;~2;~3;~4;~5;~6;~7;~8;~9;~10;~11;~12","thg "),dddd:_("Chủ Nhật;Thứ Hai;Thứ Ba;Thứ Tư;Thứ Năm;Thứ Sáu;Thứ Bảy"),ddd:_("CN;Th 2;Th 3;Th 4;Th 5;Th 6;Th 7"),ampm:_("SA;CH")},"vi");te(ke({group:"٬",decimal:"٫",ampm:_("ص;م"),mmmm:_("يناير;فبراير;مارس;أبريل;مايو;يونيو;يوليو;أغسطس;سبتمبر;أكتوبر;نوفمبر;ديسمبر"),dddd:_("الأحد;الاثنين;الثلاثاء;الأربعاء;الخميس;الجمعة;السبت"),mmmm6:_("رمضان;شوال;ذو القعدة;ذو الحجة;محرم;ربيع الأول;ربيع الآخرة;جمادى الأولى;جمادى الآخرة;رجب;شعبان;رمضان")},0,0),"ar");te({group:",",decimal:".",mmmm:_("জানুয়ারী;ফেব্রুয়ারী;মার্চ;এপ্রিল;মে;জুন;জুলাই;আগস্ট;সেপ্টেম্বর;অক্টোবর;নভেম্বর;ডিসেম্বর"),mmm:_("জানু;ফেব;মার্চ;এপ্রি;মে;জুন;জুল;আগ;সেপ্টেঃ;অক্টোঃ;নভেঃ;ডিসেঃ"),dddd:_("রবিবার;সোমবার;মঙ্গলবার;বুধবার;বৃহস্পতিবার;শুক্রবার;শনিবার"),ddd:_("রবি;সোম;মঙ্গল;বুধ;বৃহস্পতি;শুক্র;শনি")},"bn");te({group:",",decimal:".",mmmm:_("जनवरी;फ़रवरी;मार्च;अप्रैल;मई;जून;जुलाई;अगस्त;सितंबर;अक्तूबर;नवंबर;दिसंबर"),mmm:_("जन॰;फ़र॰;मार्च;अप्रैल;मई;जून;जुल॰;अग॰;सित॰;अक्तू॰;नव॰;दिस॰"),dddd:_("रविवार;सोमवार;मंगलवार;बुधवार;गुरुवार;शुक्रवार;शनिवार"),ddd:_("रवि;सोम;मंगल;बुध;गुरु;शुक्र;शनि"),ampm:_("am;pm")},"hi");const Mu={overflow:"######",dateErrorThrows:!1,dateErrorNumber:!0,bigintErrorNumber:!1,dateSpanLarge:!0,leap1900:!0,nbsp:!1,throws:!0,invalid:"######",locale:"",ignoreTimezone:!1,grouping:[3,3],indexColors:!0,skipChar:"",repeatChar:""};function Rt(e,t=0){if(typeof e!="number")return e;if(e<0)return-Rt(-e,t);if(t){const n=10**t||1;return Rt(e*n,0)/n}return Math.round(e)}const vp=1e-13;function Du(e,t=2,n=2){const r=e<0?-1:1,s=10**(t||2),i=10**(n||2);let o=Math.abs(e),a=0,l=0,c=0,u=1,h,d;if(e=o,e%1===0)d=[e*r,1];else if(e<1e-19)d=[r,1e19];else if(e>1e19)d=[1e19*r,1];else{do if(o=1/(o-Math.floor(o)),h=u,u=u*Math.floor(o)+a,a=h,l=c,c=Math.floor(e*u+.5),c>=s||u>=i)return[r*l,a];while(Math.abs(e-c/u)>=vp&&o!==Math.floor(o));d=[r*c,u]}return d}const mt=Math.floor;function Lu(e,t=!0){if(t&&e>=0){if(e===0)return[1900,1,0];if(e===60)return[1900,2,29];if(e<60)return[1900,e<32?1:2,(e-1)%31+1]}let n=e+68569+2415019;const r=mt(4*n/146097);n=n-mt((146097*r+3)/4);const s=mt(4e3*(n+1)/1461001);n=n-mt(1461*s/4)+31;const i=mt(80*n/2447),o=n-mt(2447*i/80);n=mt(i/11);const a=i+2-12*n;return[100*(r-49)+s+n|0,a|0,o|0]}function wp(e){return Lu(e+1462)}function bp(e){if(e===60)throw new Error("#VALUE!");if(e<=1)return[1317,8,29];if(e<60)return[1317,e<32?9:10,1+(e-2)%30];const t=10631/30,n=8.01/60;let r=e+466935;const s=mt(r/10631);r=r-10631*s;const i=mt((r-n)/t);r=r-mt(i*t+n);const o=mt((r+28.5001)/29.5);return o===13?[30*s+i,12,30]:[30*s+i,o,r-mt(29.5001*o-29)]}function xu(e,t=0,n=!0){const r=mt(e);return t===jn?bp(r):t===Rp?wp(r):Lu(r,n)}const Jr=Math.floor,fi=86400;function Zo(e,t){let n=null;if(Array.isArray(e)){const[r,s,i,o,a,l]=e;n=Date.UTC(r,s==null?0:s-1,i!=null?i:1,o||0,a||0,l||0)}else if(e instanceof Date&&(n=e*1,!t||!t.ignoreTimezone)){const r=new Date;r.setUTCFullYear(e.getFullYear(),e.getMonth(),e.getDate()),r.setUTCHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),n=r*1}if(n!=null&&isFinite(n)){const r=n/864e5;return r-(r<=-25509?-25568:-25569)}return null}function yp(e,t){let n=e|0;const r=fi*(e-n);let s=Jr(r);r-s>.9999&&(s+=1,s===fi&&(s=0,n+=1));const i=s<0?fi+s:s,[o,a,l]=xu(e,0,t&&t.leap1900),c=Jr(i/60/60)%60,u=Jr(i/60)%60,h=Jr(i)%60;return[o,a,l,c,u,h]}const Ap=["!d-m-y","!d-m-Y","!j-m-y","!j-m-Y","!d-n-y","!d-n-Y","!j-n-y","!j-n-Y","?m-d-y","?m-d-Y","?m-j-y","?m-j-Y","?n-d-y","?n-d-Y","?n-j-y","?n-j-Y","d-M-y","d-M-Y","j-M-y","j-M-Y","M-d-y","M-d-Y","M-j-y","M-j-Y","d-F-y","d-F-Y","F-d-y","F-d-Y","F-j-y","F-j-Y","j-F-y","j-F-Y","y-F-d","y-F-j","y-M-d","y-M-j","Y-F-d","Y-F-j","Y-M-d","Y-m-d","Y-M-j","Y-m-j","Y-n-d","Y-n-j","j-F","j-M","d-F","d-M","n-d","n-j","n-Y","m-d","m-j","m-Y","M-Y","M-y","F-y","F-Y","Y-M","Y-n","Y-m","Y-F","Y-M"],Tp={j:"d",d:"d",D:"ddd",l:"dddd",n:"m",m:"m",M:"mmm",F:"mmmm",y:"yy",Y:"yyyy"},Np={j:"dd",d:"dd",D:"ddd",l:"dddd",n:"mm",m:"mm",M:"mmm",F:"mmmm",y:"yy",Y:"yyyy"},Uu={},Pu={};function dt(e,t,n=1){if(e){const r=e[0],s=e.slice(1);r==="!"?dt(s,t,4):r==="?"?dt(s,t,2):(t[r]=t[r]||{},dt(s,t[r],n))}else t.$=n}function Ya(e,t){dt(e,t),dt(e+" x",t),dt(e+" l",t),dt(e+" l x",t),dt("l "+e,t),dt("l "+e+" x",t),dt(e+" D",t),dt(e+" D x",t),dt("D "+e,t),dt("D "+e+" x",t)}Ap.forEach(e=>{e[0]!=="?"&&Ya(e,Uu),e[0]!=="!"&&Ya(e,Pu)});const Mp=new Date().getUTCFullYear(),za=".",Dp=",",mi=" ",Or=" ",vr=" ",ls="'",cs="٬",Lp={".":[Dp,Or,vr,ls,cs],",":[za,Or,vr,ls,cs],"٫":[za,Or,vr,ls,cs]},gi=e=>e&&e.length===1&&e>="0"&&e<="9";function Qo(e,t={}){const n=Zn(t.locale||"")||nn,r=n.decimal,s=[...Lp[r]||[ls,cs]];!s.includes(n.group)&&n.group!==mi&&n.group!==r&&s.push(n.group);let i="",o="",a=1,l="",c=!1,u=!1,h=!1,d=!1,f=!1,g=null,E=!1,R=0;const b=[mi,Or,vr,"+","%","(","-"].concat(ki);for(;b.includes(e[R]);){const w=e[R];if(w==="-"){if(c||u)return null;c=!0,a=-1}else if(Fi.test(w)){if(f)return null;f=!0,g=w}else if(w==="("){if(u||c)return null;u=!0,a=-1}else if(w==="%"){if(d)return null;d=!0}R++}let F=!1,k;if(e[R]===r||gi(e[R]))for(;R<e.length;){const w=e[R];if(!k&&s.includes(w))k=w;else if(!(k&&k===w))if(w===r){if(F)break;i+=".",F=!0}else if(gi(w))i+=w;else break;R++}if(e[R]==="e"||e[R]==="E"){o+=e[R],R++,(e[R]==="+"||e[R]==="-")&&(o+=e[R],R++);const w=R;for(;gi(e[R]);)o+=e[R],R++;if(w===R)return null}const W=[mi,Or,vr,"%","$",")"].concat(ki);for(;W.includes(e[R]);){const w=e[R];if(Fi.test(w)){if(f)return null;f=!0,g=w,E=!0}else if(w===")"){if(h||!u)return null;h=!0}else if(w==="%"){if(d)return null;d=!0}R++}if(R!==e.length)return null;let S=parseFloat(i+o);if(!isFinite(S))return null;if(o){if(d||f)return null;l="0.00E+00"}else if(d){if(f)return null;l=i.includes(".")?"0.00%":"0%",S*=.01}else if(f){const w=i.includes(".")?"#,##0.00":"#,##0";E?l=w+g:l=g+w}else k&&(l=i.includes(".")?"#,##0.00":"#,##0");const p={v:S*a};return l&&(p.z=l),p}function xp(e,t,n){if(n<1||t<1||t>12)return!1;if(t===2){const s=e%4===0&&e%100!==0||e%400===0||e===1900?29:28;if(n>s)return!1}else if((t===4||t===6||t===9||t===11)&&n>30||(t===1||t===3||t===5||t===7||t===8||t===10||t===12)&&n>31)return!1;return!0}const Va=(e,t,n=!1)=>{for(const r of t)if(e.startsWith(r[0])){let s=r[0].length;return n&&(r[2]==="D"||r[2]==="M")&&e[s]==="."&&s++,[e.slice(0,s),r]}return["",null]},Lt=(e,t,n,r)=>{const s=n.path||"",i=Object.keys(t);for(let o=0;o<i.length;o++){let a;const l=i[o];if(t[l]){if(l==="$"||l==="€")e||(a=n);else if(l==="-"){const c=/^(\s*([./-]|,\s)\s*|\s+)/.exec(e);if(c){const u=c[1]==="-"||c[1]==="/"||c[1]==="."?c[1]:" ";if(!n.sep||n.sep===u){const h=c[0].replace(/\s+/g," ");a=Lt(e.slice(c[0].length),t[l],{...n,sep:u,path:s+h},r)}}}else if(l===" "){const c=/^[,.]?\s+/.exec(e);if(c){const u=c[0].replace(/\s+/g," ");a=Lt(e.slice(c[0].length),t[l],{...n,path:s+u},r)}}else if(l==="j"||l==="d"){const c=/^(0?[1-9]|1\d|2\d|3[01])\b/.exec(e);c&&(a=Lt(e.slice(c[0].length),t[l],{...n,day:c[0],path:s+l},r))}else if(l==="n"||l==="m"){const c=/^(0?[1-9]|1[012])\b/.exec(e);c&&(a=Lt(e.slice(c[0].length),t[l],{...n,month:+c[0],_mon:c[0],path:s+l},r))}else if(l==="F"||l==="M"){const[c,u]=Va(e,r.mon,r.mp);u&&u[2]===l&&(a=Lt(e.slice(c.length),t[l],{...n,month:u[1],_mon:c,path:s+l},r))}else if(l==="l"||l==="D"){const[c,u]=Va(e,r.day,r.dp);u&&u[2]===l&&(a=Lt(e.slice(c.length),t[l],{...n,path:s+l},r))}else if(l==="y"){const c=/^\d\d\b/.exec(e);if(c){const u=+c[0]>=30?+c[0]+1900:+c[0]+2e3;a=Lt(e.slice(c[0].length),t[l],{...n,year:u,path:s+l},r)}}else if(l==="Y"){const c=/^\d\d\d\d\b/.exec(e);c&&(a=Lt(e.slice(c[0].length),t[l],{...n,year:+c[0],path:s+l},r))}else if(l==="x"){const c=Vs(e,{locale:r.locale});c&&(a=Lt("",t[l],{...n,time:c.v,tf:c.z,path:s+l},r))}else throw new Error(`Unknown date token "${l}"`);if(a&&xp(n.year||1916,n.month||1,n.day?+n.day:1))return a}}},ku=e=>e.replace(/\s+/g," ").trim().replace(/’/,"'").replace(/\.$/,"").toLowerCase(),Zr=(e,t)=>{const n=e.map((r,s)=>[ku(r),s+1,t]);return n.sort((r,s)=>s[0].length-r[0].length),n};function ea(e,t={}){var i;const n=Zn(t.locale||"")||nn,r={mon:Zr(n.mmmm,"F").concat(Zr(n.mmm,"M")),mp:n.mmm[0].at(-1)===".",day:Zr(n.dddd,"l").concat(Zr(n.ddd,"D")),dp:n.ddd[0].at(-1)===".",locale:t.locale},s=Lt(ku(e),n.preferMDY?Pu:Uu,{path:""},r);if(s){if(s.sep==="."&&s.path.length===3)return null;const o=+((i=s.year)!=null?i:Mp);s.day||(s.day=1);let a=-1/0;if(o<1900)return null;o<=1900&&s.month<=2?a=25568:o<1e4&&(a=25569);const l=Date.UTC(o,s.month-1,s.day)/864e5+a+(s.time||0);if(l>=0&&l<=2958465){const c=s._mon[0]==="0"||s.day[0]==="0"||s._mon.length===2&&s.day.length===2,u=s.path.replace(/[jdlDnmMFyYx]/g,h=>h==="x"?s.tf||"":(c?Np[h]:Tp[h])||h);return{v:l,z:u}}}return null}const _i=e=>e.replace(/\s+/g,"").trim().replace(/\./g,"").toLowerCase();function Vs(e,t={}){const n=Zn(t.locale||"")||nn,r=/^\s*([10]?\d|2[0-4])(?::([0-5]\d|\d))?(?::([0-5]\d|\d))?(\.\d{1,10})?(?=\s*[^\s\d]|$)/.exec(e);let s="";if(r){const i=_i(e.slice(r[0].length));if(i===_i(n.ampm[0])||i==="a"||i==="am")s="a";else if(i===_i(n.ampm[1])||i==="p"||i==="pm")s="p";else if(i)return null}if(r){const[,i,o,a,l]=r;if(l&&!a||!s&&!o&&!a)return null;let c=+(i||0)*1;if(s){if(c>=13)return null;s==="p"&&(c+=12)}const u=+(o||0)*1,h=+(a||0)*1,d=+(l||0)*1;return{v:(c*60*60+u*60+h+d)/(3600*24),z:(i.length===2?"hh":"h")+":mm"+(a?":ss":"")+(s?" AM/PM":"")}}return null}function Fu(e,t={}){const n=Zn(t.locale||"")||nn,r=e.trim().toLowerCase(),s=n.bool[0].toLowerCase();if(r==="true"||r===s)return{v:!0};const i=n.bool[1].toLowerCase();return r==="false"||r===i?{v:!1}:null}function Up(e,t){var n,r,s;return(s=(r=(n=Qo(e,t))!=null?n:ea(e,t))!=null?r:Vs(e,t))!=null?s:Fu(e,t)}function hn(e,t,n){return t[n+"_max"]=e.length,t[n+"_min"]=e.replace(/#/g,"").length,t}function Ve(e,t){typeof e=="string"?t.push({type:"string",value:e}):t.push(e)}function Ka(e,t){const n=e&&e.type;return n===Oo||n===Wn||n===vo||n===Ys&&t==="den"}function mr(e){var k,W,S;const t=[],n={scale:1,percent:!1,text:!1,date:0,date_eval:!1,date_system:Wa,sec_decimals:0,general:!1,clock:24,int_pattern:[],frac_pattern:[],man_pattern:[],den_pattern:[],num_pattern:[],tokens:t};let r="int",s=null;const i=[];let o,a=!1,l=-1,c=!1,u="",h=!1;for(;++l<e.length&&!c;){const p=e[l],w=p.type||Tr;if(u+=p.raw,w===So)n.general=!0,Ve(p,t);else if(Ka(p,r)){const A=n[r+"_pattern"];Ka(o,r)||(o==null?void 0:o.type)===Ar?(A.push((A.pop()||"")+p.value),s.num+=p.value):(A.push(p.value),s={type:r,num:p.value},Ve(s,t))}else if(w===Vo)p.value==="("&&(n.parens=!0),Ve(p.value,t);else if(w===Ys)Ve(p.value,t);else if(w===wo)if(h=!0,n[r+"_pattern"].length){if(!s)throw new SyntaxError("Format pattern is missing a numerator");n.fractions=!0,n.num_pattern.push(n[r+"_pattern"].pop()),s.type="num",r="den",Ve({type:"div"},t)}else Ve(p.value,t);else if(w===bo)Ve(",",t);else if(w===bs)n.scale=.001**p.raw.length;else if(w===Ar){if(r==="int"&&(n.grouping=!0),r==="den")throw new SyntaxError("Cannot group denominator digits")}else if(w===No)Ve(p,t);else if(w===yo){c=!0;break}else if(w===Ws)n.text=!0,Ve(p,t);else if(w===Ao||w===To)Ve(p,t);else if(w===xo){const A=p.value.toLowerCase(),H=A[0],B={type:"",size:0,date:1,pad:A.length};H==="h"?(B.size=hr,B.type="hour-elap"):H==="m"?(B.size=dr,B.type="min-elap"):(B.size=fr,B.type="sec-elap"),n.date=n.date|B.size,i.push(B),Ve(B,t)}else if(n.date&&w===ys&&((k=e[l+1])==null?void 0:k.type)===Wn){let A=1;l++;let H="0";((W=e[l+1])==null?void 0:W.type)===Wn&&(H+="0",A=2,l++),((S=e[l+1])==null?void 0:S.type)===Wn&&(H+="0",A=3,l++),u+=H;const B=[fr,xi,Ui,Pi][A];n.date=n.date|B,n.date_eval=!0,n.sec_decimals=Math.max(n.sec_decimals,A),Ve({type:"subsec",size:B,decimals:A,date:1},t)}else if(w===Do)a||(p.value==="B2"||p.value==="b2"?n.date_system=jn:n.date_system=Wa);else if(w===Lo){const A={type:"",size:0,date:1},H=p.value.toLowerCase(),B=H[0];if(H==="y"||H==="yy")A.size=cr,A.type="year-short";else if(B==="y"||B==="e")A.size=cr,A.type="year";else if(H==="b"||H==="bb")A.size=cr,A.type="b-year-short";else if(B==="b")A.size=cr,A.type="b-year";else if(H==="d"||H==="dd")A.size=as,A.type="day",A.pad=/dd/.test(H);else if(H==="ddd"||H==="aaa")A.size=as,A.type="weekday-short";else if(B==="d"||B==="a")A.size=as,A.type="weekday";else if(B==="h")A.size=hr,A.type="hour",A.pad=/hh/i.test(H);else if(B==="m"){H.length===3?(A.size=ur,A.type="monthname-short"):H.length===5?(A.size=ur,A.type="monthname-single"):H.length>=4&&(A.size=ur,A.type="monthname");const m=i[i.length-1];!A.type&&m&&!m.used&&m.size&(hr|fr)&&(m.used=!0,A.size=dr,A.type="min",A.pad=/mm/.test(H)),A.type||(A.size=ur,A.type="month",A.pad=/mm/.test(H),A.indeterminate=!0)}else if(B==="s"){A.size=fr,A.type="sec",A.pad=/ss/.test(H);const m=i[i.length-1];m&&m.size&dr?A.used=!0:m&&m.indeterminate&&(delete m.indeterminate,m.size=dr,m.type="min",A.used=!0)}n.date=n.date|A.size,n.date_eval=!0,i.push(A),Ve(A,t)}else if(w===Bo)n.clock=12,n.date=n.date|hr,n.date_eval=!0,p.short=p.value==="A/P",Ve(p,t);else if(w===jo||w===$o||w===zs)Ve(p.value,t);else if(w===Uo)n.condition=[p.value[0],parseFloat(p.value[1])];else if(w===Fo){const A=p.value.split("-"),H=A.length<2?"":A.slice(1).join("-"),B=A[0];B&&Ve(B,t);const m=Go(H);m&&(n.locale=m);const x=parseInt(H,16);isFinite(x)&&x&16711680&&(x>>16&255)===6&&(n.date_system=jn),a=!0}else if(w===Ho){let A,H=p.value.toLowerCase();(A=/^color\s*(\d+)$/i.exec(H))&&(H=parseInt(A[1],10)),n.color=H}else if(w===Mo)n.scale=100,n.percent=!0,Ve("%",t);else if(w===ys)Ve(p,t),n.date||(n.dec_fractions=!0,r="frac");else if(w===Yo)n.exponential=!0,n.exp_plus=p.value.includes("+"),r="man",Ve({type:"exp",plus:n.exp_plus},t);else if(w===Wo)Ve(p,t);else if(w===zo)Ve(p,t);else if(!(w===Po||w===ko))throw w===Tr?new SyntaxError(`Illegal character: ${u}`):new SyntaxError(`Unknown token ${w} in ${u}`);o=p}if(n.tokensUsed=l,n.pattern=u,/^((?:\[[^\]]+\])+)(;|$)/.test(n.pattern)&&!/^\[(?:h+|m+|s+)\]/.test(n.pattern)&&Ve({type:"text"},t),n.fractions&&n.dec_fractions||n.grouping&&!n.int_pattern.length||n.fractions&&n.exponential||n.fractions&&n.den_pattern.length*n.num_pattern.length===0||h&&!n.fractions&&!n.date||n.exponential&&(n.int_pattern.length||n.frac_pattern.length)*n.man_pattern.length===0)throw new SyntaxError(`Invalid pattern: ${u}`);const d=n.int_pattern.join(""),f=n.man_pattern.join(""),g=n.frac_pattern.join("");hn(d,n,"int");let E=0;for(let p=0;p<d.length;p++){const w=d[d.length-1-p];/^[0-9?]/.test(w)&&(E=p+1)}n.int_min=E,hn(g,n,"frac"),hn(f,n,"man");let R=n.num_pattern.join(""),b=n.den_pattern[0]||"";if(b.includes("?")||R.includes("?")?(b=b.replace(/\d/g,"?"),b=b.replace(/#$/g,"?"),hn(R,n,"num"),hn(b,n,"den"),R=R.replace(/#$/g,"?")):(hn(R,n,"num"),hn(b,n,"den")),n.int_p=d,n.man_p=f,n.num_p=R,n.den_p=b,n.den_pattern.length&&(n.denominator=parseInt(n.den_pattern.join("").replace(/\D/g,""),10)),n.integer=!!d.length,!n.integer&&!n.exponential&&g.length){const p=n.tokens.findIndex(w=>w.type==="point");n.tokens.splice(p,0,{type:"int",value:"#"}),n.integer=!0,n.int_pattern=["#"],n.int_p="#"}if(n.fractions)for(let p=0;p<t.length-1;p++){const w=t[p];if(w.type!=="string"&&w.type!=="space")continue;const A=t[p+1].type;A==="num"?w.rule="num+int":A==="div"?w.rule="num":A==="den"&&(w.rule="den")}return n.grouping&&n.int_pattern.length>1&&(n.grouping=!1),n}function Pp(e){if(e===0)return e;const t=Math.ceil(Math.log10(e<0?-e:e)),n=10**(16-Math.floor(t));return isFinite(n)?Math.round(e*n)/n:0}function Hu(e,t=0){const n=Math.floor(Math.log10(e));return t>1?Math.floor(n/t)*t:n}function Bu(e,t=1){return t<-300?parseFloat(e.toExponential().split("e")[0]):e*10**-t}const kp={total:1,sign:0,period:0,int:1,frac:0};function Fp(e,t=!0){const n=Math.abs(e);if(!n)return kp;const r=t&&e<0?1:0,s=Math.floor(n),i=Math.floor(Math.log10(n)+1);let o=0,a=0;if(s!==n){o=1;const l=String(Rt(n*10**-i,15));let c=l.length,u=!0,h=0;for(;h<=l.length;){if(l[h]==="."){c--;break}else l[h]==="0"&&u?c--:u=!1;h++}a=c-i,a<0&&(a=0,o=0)}return{total:r+Math.max(i,1)+o+a,digits:Math.max(i,0)+a,sign:r,period:o,int:Math.max(i,1),frac:a}}const Tn=(e,t)=>e.replace(/\./,t.decimal),Ga=(e,t,n)=>{const r=Math.abs(t);let s;return e===1?s=e:s=Rt(e,5),[Tn(s+"",n),n.exponent,t<0?n.negative:n.positive,r<10?"0":"",r]};function Xa(e,t,n,r){const s=n|0;if(typeof n=="string")e.push(n);else if(n===s)e.push(Math.abs(s));else{const i=Math.abs(n);let o=Hu(i),a=Bu(i,o);a===10&&(a=1,o++);const l=Fp(i);if(o>=-4&&o<=-1){const c=i.toPrecision(10+o).replace(/\.?0+$/,"");e.push(Tn(c,r))}else if(o===10){const c=i.toFixed(10).slice(0,12).replace(/\.$/,"");e.push(Tn(c,r))}else if(Math.abs(o)<=9)if(l.total<=11){const c=Rt(i,9).toFixed(l.frac);e.push(Tn(c,r))}else o===9?e.push(Math.floor(i)):o>=0&&o<9?e.push(Tn(String(Rt(i,9-o)),r)):e.push(...Ga(a,o,r));else l.total>=12?e.push(...Ga(a,o,r)):e.push(Tn(Rt(i,9).toFixed(l.frac),r))}return e}function dn(e,t=!1){return e==="0"?"0":e==="?"?t?" ":" ":""}const nr=86400,Hp=(e,t,n)=>n?e<Ep||t>=Cp:e<_p||t>=pp;function qa(e,t,n,r){var y,v;let s="",i="",o="",a="",l="",c="",u=0,h=0;if(typeof e=="bigint"){if(e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER)e=Number(e);else return n.bigintErrorNumber?String(e):n.overflow;h=e}else h=Math.trunc(e);let d=0,f=0,g=1,E=0,R=0,b=0,F=0,k=0,W=0;const S=r||nn;if(!t.text&&isFinite(t.scale)&&t.scale!==1&&(e=Pp(e*t.scale)),t.exponential){let T=Math.abs(e);T&&(u=Hu(T,t.int_max)),e&&!t.integer&&u++,T=Bu(T,u),t.int_max===1&&Rt(T,t.frac_max)===10&&(T=1,u++),e=e<0?-T:T,s+=Math.abs(u)}if(t.integer){const T=Math.abs(Rt(e,t.fractions?1:t.frac_max));c+=T<1?"":Math.floor(T)}const p=(y=n.grouping[0])!=null?y:3,w=(v=n.grouping[1])!=null?v:p;t.dec_fractions&&(l=String(Rt(e,t.frac_max)).split(".")[1]||"");const A=!t.error&&(t.num_p.includes("0")||t.den_p.includes("0"));let H=A;if(t.fractions){H=A||!!(e%1);const T=Math.abs(t.integer?e%1:e);if(T)if(H=!0,t.denominator&&isFinite(t.denominator))a+=t.denominator,o+=Rt(T*t.denominator),o==="0"&&(o="",a="",H=A);else{const M=Du(T,1/0,t.den_max);o+=M[0],a+=M[1],t.integer&&o==="0"&&(o="",a="",H=A)}else!e&&!t.integer&&(H=!0,o="0",a="1");t.integer&&!H&&!Math.trunc(e)&&(c="0")}if(t.date){h=Math.trunc(e);const T=nr*(e-h);if(d=Math.floor(T),W=T-d,Math.abs(W)<1e-6?W=0:W>.9999&&(W=0,d+=1,d===nr&&(d=0,h+=1)),W){const M=t.date&Pi||t.date&Ui||t.date&xi;(M===Pi&&W>.9995||M===Ui&&W>.995||M===xi&&W>.95||!M&&W>=.5)&&(d++,W=0)}if(h||t.date_system){const M=xu(e,t.date_system,n.leap1900);f=M[0],g=M[1],E=M[2]}if(d){const M=d<0?nr+d:d;k=Math.floor(M)%60,F=Math.floor(M/60)%60,b=Math.floor(M/60/60)%60}if(R=(6+h)%7,t.date_eval&&Hp(e,h+d/nr,n.dateSpanLarge)){if(n.dateErrorThrows)throw new Error("Date out of bounds");if(n.dateErrorNumber){const M=e<0?[S.negative]:[];return Xa(M,{},e,S).join("")}return n.overflow}}const B=dn("?",n.nbsp);u<0?i="-":t.exp_plus&&(i="+");const m=[],x=(T,M,D,P)=>{const J=!P&&T.length>M.length?D.length+T.length-M.length:D.length;T.length<M.length&&(P+=T.length-M.length);for(let V=0;V<J;V++)m.push(T[V+P]||dn(D[V],n.nbsp));return J};let O=!1;const N={int:0,frac:0,man:0,num:0,den:0};for(let T=0,M=t.tokens.length;T<M;T++){const D=t.tokens[T],P=D.type,J=D.num?D.num.length:0;if(P==="string")D.rule?D.rule==="num"?H?m.push(D.value.replace(/ /g,B)):(t.num_min>0||t.den_min>0)&&m.push(D.value.replace(/./g,B)):D.rule==="num+int"?H&&c?m.push(D.value.replace(/ /g,B)):t.den_min>0&&(c||t.num_min)&&m.push(D.value.replace(/./g,B)):D.rule==="den"&&(H?m.push(D.value.replace(/ /g,B)):(t.den_min>0||t.den_min>0)&&m.push(D.value.replace(/./g,B))):m.push(D.value.replace(/ /g,B));else if(P==="space")D.rule==="num+int"?(H||t.num_min||t.den_min)&&(c||t.num_min)&&m.push(B):m.push(B);else if(P==="error")m.push(n.invalid);else if(P==="point")m.push(t.date?D.value:S.decimal);else if(P==="general")Xa(m,t,e,S);else if(P==="exp")m.push(S.exponent);else if(P==="minus")D.volatile&&t.date||D.volatile&&(e>=0||typeof e!="number")||(D.volatile&&!t.fractions&&(t.integer||t.dec_fractions)?(e<0&&c&&c!=="0"||l)&&m.push(S.negative):m.push(S.negative));else if(P==="plus")m.push(S.positive);else if(P==="text")m.push(e);else if(P==="fill")n.fillChar&&m.push(n.fillChar,D.value);else if(P==="skip")n.skipChar?m.push(n.skipChar,D.value):m.push(n.nbsp?" ":" ");else if(P==="div")H?m.push("/"):t.num_min>0||t.den_min>0?m.push(B):m.push(dn("#",n.nbsp));else if(P==="int")if(t.int_pattern.length===1){const V=t.int_p,ie=Math.max(t.int_min,c.length);let le="";for(let I=ie;I>0;I--){const L=c.charAt(c.length-I),Y=L?"":V.charAt(V.length-I)||V[0];let z="";if(t.grouping){const $=I-1-p;$>=0&&!($%w)&&(z=L||Y==="0"?S.group:dn("?",n.nbsp))}le+=(L||dn(Y,n.nbsp))+z}m.push(le)}else N.int+=x(c,t.int_p,D.num,N.int);else if(P==="frac"){const V=N.frac;for(let ie=0;ie<J;ie++)m.push(l[ie+V]||dn(D.num[ie],n.nbsp));N.frac+=J}else if(P==="man")!N[P]&&!N.man&&m.push(i),N.man+=x(s,t.man_p,D.num,N.man);else if(P==="num")N.num+=x(o,t.num_p,D.num,N.num);else if(P==="den"){const V=N.den;for(let ie=0;ie<J;ie++){let le=a[ie+V];if(!le){const I=D.num[ie];"123456789".includes(I)||O&&I==="0"?(O=!0,le=n.nbsp?" ":" "):!O&&ie===J-1&&I==="0"&&!a?le="1":le=dn(I,n.nbsp)}m.push(le)}N.den+=J}else if(P==="year")f<0&&m.push(S.negative),m.push(String(Math.abs(f)).padStart(4,"0"));else if(P==="year-short"){const V=f%100;m.push(V<10?"0":"",V)}else if(P==="month")m.push(D.pad&&g<10?"0":"",g);else if(P==="monthname-single")t.date_system===jn?m.push(S.mmmm6[g-1].charAt(0)):m.push(S.mmmm[g-1].charAt(0));else if(P==="monthname-short")t.date_system===jn?m.push(S.mmm6[g-1]):m.push(S.mmm[g-1]);else if(P==="monthname")t.date_system===jn?m.push(S.mmmm6[g-1]):m.push(S.mmmm[g-1]);else if(D.type==="weekday-short")m.push(S.ddd[R]);else if(P==="weekday")m.push(S.dddd[R]);else if(P==="day")m.push(D.pad&&E<10?"0":"",E);else if(P==="hour"){const V=b%t.clock||(t.clock<24?t.clock:0);m.push(D.pad&&V<10?"0":"",V)}else if(P==="min")m.push(D.pad&&F<10?"0":"",F);else if(P==="sec")m.push(D.pad&&k<10?"0":"",k);else if(P==="subsec"){m.push(S.decimal);const V=W.toFixed(t.sec_decimals);m.push(V.slice(2,2+D.decimals))}else if(P==="ampm"){const V=b<12?0:1;D.short&&!r?m.push("AP"[V]):m.push(S.ampm[V])}else if(P==="hour-elap"){e<0&&m.push(S.negative);const V=h*24+Math.floor(Math.abs(d)/3600);m.push(String(Math.abs(V)).padStart(D.pad,"0"))}else if(P==="min-elap"){e<0&&m.push(S.negative);const V=h*1440+Math.floor(Math.abs(d)/60);m.push(String(Math.abs(V)).padStart(D.pad,"0"))}else if(P==="sec-elap"){e<0&&m.push(S.negative);const V=h*nr+Math.abs(d);m.push(String(Math.abs(V)).padStart(D.pad,"0"))}else if(P==="b-year")m.push(f+543);else if(P==="b-year-short"){const V=(f+543)%100;m.push(V<10?"0":"",V)}}return m.join("")}const Bp=mr([{type:Ws,value:"@",raw:"@"}]);function $u(e,t){for(let n=0;n<3;n++){const r=t[n];if(r){let s;if(r.condition){const i=r.condition[0],o=r.condition[1];i==="="?s=e===o:i===">"?s=e>o:i==="<"?s=e<o:i===">="?s=e>=o:i==="<="?s=e<=o:i==="<>"&&(s=e!==o)}else s=!0;if(s)return r}}}function $p(e,t,n){const r=t.partitions;let s=r[3],i=null;return(typeof e=="number"||typeof e=="bigint")&&isFinite(e)&&(s=$u(e,r)),s&&s.color&&(i=s.color),i&&typeof i=="number"&&n.indexColors&&(i=Ip[i-1]||"#000"),i}function jp(e,t,n){const r=t.partitions,s=Zn(t.locale||n.locale),i=r[3]?r[3]:Bp;if(typeof e=="boolean"&&(e=(s||nn).bool[e?0:1]),e==null)return"";const o=typeof e=="bigint";if(typeof e!="number"&&!o)return qa(e,i,n,s);if(!o&&!isFinite(e)){const l=s||nn;return isNaN(e)?l.nan:(e<0?l.negative:"")+l.infinity}const a=$u(e,r);return a?qa(e,a,n,s):n.overflow}function ju(e){return!!(e[0]&&e[0].percent||e[1]&&e[1].percent||e[2]&&e[2].percent||e[3]&&e[3].percent)}function Wu(e){return!!(e[0]&&e[0].date||e[1]&&e[1].date||e[2]&&e[2].date||e[3]&&e[3].date)}function Yu(e){const[t,n,r,s]=e;return!!((!t||t.generated)&&(!n||n.generated)&&(!r||r.generated)&&s&&s.text&&!s.generated)}const Wp={text:15,datetime:10.8,date:10.8,time:10.8,percent:10.6,currency:10.4,grouped:10.2,scientific:6,number:4,fraction:2,general:0,error:0},Yp=[["DMY",1],["DM",2],["MY",3],["MDY",4],["MD",5],["hmsa",6],["hma",7],["hms",8],["hm",9]];function zp(e,t=null){var h;const[n,r]=e,s=n.frac_max,i={type:"general",isDate:Wu(e),isText:Yu(e),isPercent:ju(e),maxDecimals:n.general?9:s,scale:(h=n.scale)!=null?h:1,color:0,parentheses:0,grouped:n.grouping?1:0},o=!i.isDate&&!i.isText&&!n.error&&n.tokens.some(d=>d.type==="string"&&(t?d.value===t:Fi.test(d.value)));let a="G",l=s>=0?Math.min(15,s):"",c="",u="";if(r&&r.color&&(u="-",i.color=1),n.parens&&(c="()",i.parentheses=1),o)a="C",i.type="currency";else if(n.error)i.type="error",i.maxDecimals=0;else if(i.isDate){let d=0,f=0,g="";n.tokens.forEach(R=>{const b=R.type;/^(b-)?year/.test(b)?(g+="Y",f++):b.startsWith("month")?(g+="M",f++):/^(week)?day/.test(b)?(g+="D",f++):(b==="hour"||b==="min"||b==="sec"||b==="ampm")&&(g+=b[0],d++)}),i.type="date",f&&d?i.type="datetime":!f&&d&&(i.type="time");const E=Yp.find(R=>g.startsWith(R[0]));a=E?"D":"G",l=E?E[1]:""}else i.isText?(a="G",i.type="text",l="",i.maxDecimals=0):n.general?(a="G",i.type="general",l=""):n.fractions?(a="G",i.type="fraction",l=""):n.exponential?(a="S",i.type="scientific"):i.isPercent?(a="P",i.type="percent"):n.grouping?(a=",",i.type="grouped"):(n.int_max||s)&&(a="F",i.type="number");return i.code=a+l+u+c,i.level=Wp[i.type],Object.freeze(i)}function Vp(e){const[t]=e;return{year:!!(t.date&cr),month:!!(t.date&ur),day:!!(t.date&as),hours:!!(t.date&hr),minutes:!!(t.date&dr),seconds:!!(t.date&fr),clockType:t.clock===12?12:24}}const Kp=[[So,/^General/i,0],[Oo,/^#/,0],[Wn,/^0/,0],[vo,/^\?/,0],[wo,/^\//,0],[yo,/^;/,0],[Ws,/^@/,0],[Ao,/^\+/,0],[To,/^-/,0],[ys,/^\./,0],[No,/^ /,0],[Mo,/^%/,0],[Ys,/^[1-9]/,0],[Do,/^(?:B[12])/i,0],[Tr,/^B$/,0],[Lo,/^(?:[hH]+|[mM]+|[sS]+|[yY]+|[bB]+|[dD]+|[gG]+|[aA]{3,}|e+)/,0],[xo,/^(?:\[(h+|m+|s+)\])/i,1],[Uo,/^\[(<[=>]?|>=?|=)\s*(-?[.\d]+)\]/,[1,2]],[Po,/^\[(DBNum[0-4]?\d)\]/i,1],[ko,/^\[(NatNum[0-4]?\d)\]/i,1],[Fo,/^\[\$([^\]]+)\]/,1],[Ho,/^\[(black|blue|cyan|green|magenta|red|white|yellow|color\s*\d+)\]/i,1],[wu,/^\[([^\]]+)\]/,1],[Bo,/^(?:AM\/PM|am\/pm|A\/P)/,0],[$o,/^\\(.)/,1],[jo,/^"([^"]*?)"/,1],[Wo,/^_(\\.|.)/,1],[Yo,/^[Ee]([+-])/,1],[zo,/^\*(\\.|.)/,1],[Vo,/^[()]/,0],[Tr,/^[EÈÉÊËèéêëĒēĔĕĖėĘęĚěȄȅȆȇȨȩNnÑñŃńŅņŇňǸǹ["*/\\_]/,0],[zs,/^./,0]],Gp=63,Xp=35,qp=48,Jp=57,pi=e=>{const t=(e||"\0").charCodeAt(0);return t===Gp||t===Xp||t>=qp&&t<=Jp};function Fn(e){let t=0;const n=[],r=[];for(;t<e.length;){const s=e.slice(t);let i=0;const o=/^(,+)(.)?/.exec(s);if(o){const a=o[1];i=a.length;const l=e[t-1]||"";let c=!1,u=!1;pi(l)?(c=!0,u=!0):l==="."&&(u=!0);const h=o[2]||"";if(c&&(!h||h===";")&&(c=!1),u&&pi(h)&&(u=!1),c&&!u)n.push({type:Ar,value:",",raw:a});else if(!c&&u)n.push({type:bs,value:",",raw:a});else if(c&&u){const d={type:bs,value:",",raw:a};n.push(d),r.push(d)}else n.push({type:bo,value:",",raw:a})}else{let a;for(const[l,c,u]of Kp){const h=c.exec(s);if(h){const d=Array.isArray(u)?u.map(f=>h[f]):h[u||0];a={type:l,value:d,raw:h[0]},n.push(a),i=h[0].length;break}}r.length&&a.raw===";"&&(r.length=0),r.length&&pi(a.raw)&&(r.forEach(l=>l.type=Ar),r.length=0)}if(!i){const a=s[0];i=1,n.push({type:zs,value:a,raw:a})}t+=i}return n}const Ei=e=>{const t=e.condition;t&&t[1]<0&&(t[0]==="<"||t[0]==="<="||t[0]==="=")||e.tokens.unshift({type:"minus",volatile:!0})},Ja=(e,t=null)=>{const n={};for(const r in e)Array.isArray(e[r])?n[r]=[...e[r]]:n[r]=e[r];return t&&n.tokens.unshift(t),n.generated=!0,n};function Zp(e){var h;const t=[];let n=!1,r,s=null,i=0,o=!1,a=0,l=0,c=Fn(e);do{if(o=mr(c),(o.date||o.general)&&(o.int_pattern.length||o.frac_pattern.length||o.scale!==1||o.text))throw new Error("Illegal format");if(o.condition&&(l++,n=!0),o.text){if(s)throw new Error("Unexpected partition");s=o}o.locale&&(r=Go(o.locale)),t.push(o),i=((h=c[o.tokensUsed])==null?void 0:h.type)==="break"?1:0,c=c.slice(o.tokensUsed+i),a++}while(i&&a<4&&l<3);if(i)throw new Error("Unexpected partition");if(l>2)throw new Error("Unexpected condition");const u=t[3];if(u&&(u.int_pattern.length||u.frac_pattern.length||u.date))throw new Error("Unexpected partition");if(n){const d=t.length;if(d===1&&(t[1]=mr(Fn("General")),t[1].generated=!0),d<3){const f=t[0],g=t[1];if(Ei(f),g.condition)Ei(g);else{const E=f.condition;(E[0]==="="||E[1]>=0&&(E[0]===">"||E[0]===">="))&&g.tokens.unshift({type:"minus",volatile:!0})}}else t.forEach(Ei)}else{if(t.length<4&&s)for(let d=0,f=t.length;d<f;d++)t[d]===s&&t.splice(d,1);if(t.length<1&&s&&(t[0]=mr(Fn("General")),t[0].generated=!0),t.length<2){const d={type:"minus",volatile:!0};t.push(Ja(t[0],d))}if(t.length<3&&t.push(Ja(t[0])),t.length<4)if(s)t.push(s);else{const d=mr(Fn("@"));d.generated=!0,t.push(d)}t[0].condition=[">",0],t[1].condition=["<",0],t[2].condition=null}return{pattern:e,partitions:t,locale:r}}const Za=Object.create({});function sn(e,t=!1){e||(e="General");let n=Za[e];if(!n)try{n=Zp(e),Za[e]=n}catch(r){if(t)throw r;const s={tokens:[{type:"error"}],error:r.message};n={pattern:e,partitions:[s,s,s,s],error:r.message,locale:null}}return n}function Qp(e,t,n={}){var o;const r=Object.assign({},Mu,n),s=sn(e,r.throws),i=(o=Zo(t,r))!=null?o:t;return jp(i,s,r)}function eE(e,t,n){var o;const r=Object.assign({},Mu,n),s=sn(e,r.throws),i=(o=Zo(t,r))!=null?o:t;return $p(i,s,r)}function tE(e){const t=sn(e,!1);return Wu(t.partitions)}function nE(e){const t=sn(e,!1);return ju(t.partitions)}function rE(e){const t=sn(e,!1);return Yu(t.partitions)}function sE(e){try{return sn(e,!0),!0}catch{return!1}}function iE(e,t={}){const n=sn(e,!1);return n.info||(n.info=zp(n.partitions,t==null?void 0:t.currency)),n.info}function oE(e){const t=sn(e,!1);return t.dateInfo||(t.dateInfo=Vp(t.partitions)),t.dateInfo}const Nn=Object.freeze({AMPM:Bo,BREAK:yo,CALENDAR:Do,CHAR:zs,COLOR:Ho,COMMA:bo,CONDITION:Uo,DATETIME:Lo,DBNUM:Po,DIGIT:Ys,DURATION:xo,ERROR:Tr,ESCAPED:$o,EXP:Yo,FILL:zo,GENERAL:So,GROUP:Ar,HASH:Oo,LOCALE:Fo,MINUS:To,MODIFIER:wu,NATNUM:ko,PAREN:Vo,PERCENT:Mo,PLUS:Ao,POINT:ys,QMARK:vo,SCALE:bs,SKIP:Wo,SLASH:wo,SPACE:No,STRING:jo,TEXT:Ws,ZERO:Wn}),aE=Object.freeze(Object.defineProperty({__proto__:null,addLocale:te,dateFromSerial:yp,dateToSerial:Zo,dec2frac:Du,format:Qp,formatColor:eE,getFormatDateInfo:oE,getFormatInfo:iE,getLocale:Zn,isDateFormat:tE,isPercentFormat:nE,isTextFormat:rE,isValidFormat:sE,parseBool:Fu,parseDate:ea,parseLocale:Ko,parseNumber:Qo,parseTime:Vs,parseValue:Up,round:Rt,tokenTypes:Nn,tokenize:Fn},Symbol.toStringTag,{value:"Module"})),zu="@@@",Vu="@",ta="General";function lE(e){return e===zu||e===Vu}function cE(e){return e==null||e===ta}const uE=(e,t)=>{if(e&&!t||!e&&t)return!1;const n=i=>{const o=Fn(i);let a="",l=!1,c=!1;for(const u of o){if(u.type===Nn.POINT){l=!0;continue}if(!(c&&u.type===Nn.MINUS)&&u.type!==Nn.SKIP){if(u.type===Nn.COLOR){c=!0;continue}else c=!1;l&&u.type===Nn.ZERO||(l=!1,l||(a+=u.value||""))}}return a},r=n(e),s=n(t);return r===s},hE=new Set(["m d"]),dE=new Set(["h:mm AM/PM","hh:mm AM/PM"]),fE=new Set(["$","¥","₽","₫","NT$","€","₩","﷼"]),Ku=e=>{var r,s;const t=(s=(r=ea(e))!=null?r:Vs(e))!=null?s:Qo(e);if(!t)return null;const{z:n}=t;if(n){if(hE.has(n)||dE.has(n)&&!/\s(A|AM|P|PM)$/i.test(e))return null;if(n.includes("#,##0")){if(/[.,]$/.test(e))return null;const i=e.replace(new RegExp(`^[${[...fE].join("")}]+`),"").trim();if(i.includes(",")&&!/^-?\d{1,3}(,\d{3})*(\.\d+)?$/.test(i))return null}}return t};function mE(e,t){const n={};for(const r in e){const s=Number(r),i=e[s];for(const o in i){const a=Number(o),l=i[a],c=t(s,a,l);c!==void 0&&(n[s]?n[s][a]=c:n[s]={[a]:c})}}return n}function Qt(e){let t=0;const n=Object.keys(e);for(const r of n){const s=Number(r);t=Math.max(t,s)}return t+1}const Qa=e=>e==null||typeof e=="object"&&Object.keys(e).length===0;function gE(e,t,n){const r=Qt(n),s=n;for(let i=r-1;i>=e;i--)Qa(s[i])?delete s[i+1]:s[i+1]=s[i];Qa(t)||(s[e]=t)}function Bi(e,t,n){const r=Object.keys(n).reduce((s,i)=>Math.max(s,Number.parseInt(i)),0)+1;for(let s=e;s<r;s++)s<e+t?delete n[s]:n[s]!==void 0&&(n[s-t]=n[s],delete n[s])}function _E(e,t){const n=e,r=Object.keys(n),s=r.length,i=t,o=Object.keys(i),a=o.length,l={};let c=0;for(let u=0;u<s;u++,c++){const h=r[u];l[c]=n[h]}for(let u=0;u<a;u++,c++){const h=o[u];l[c]=i[h]}return l}function pE(e,t,n){const r=n;if(Qt(n)>0){const i={};let o=0;for(let a=e;a<=t;a++)r[a]&&(i[o]=r[a],o++);return i}return{}}function $i(e,t,n,r){const s=e>n;if(!s&&e+t>n)throw new Error("Invalid move operation");s?EE(e,t,n,r):CE(e,t,n,r)}function EE(e,t,n,r){const s=r,i=[];for(let o=e;o<e+t;o++)i.push(s[o]);for(let o=e-1;o>=n;o--){const a=s[o];s[o+t]=a,a===void 0&&delete s[o+t]}i.forEach((o,a)=>{s[n+a]=o,o===void 0&&delete s[n+a]})}function CE(e,t,n,r){const s=r,i=[];for(let o=e;o<e+t;o++)i.push(s[o]);for(let o=e+t;o<n;o++){const a=s[o];s[o-t]=a,a===void 0&&delete s[o-t]}i.forEach((o,a)=>{s[n+a-t]=o,o===void 0&&delete s[n+a-t]})}class ct{constructor(t={}){C(this,"_matrix");this._setOriginValue(t)}static MakeObjectMatrixSize(t){return new ct({[t-1]:{}})}getMatrix(){return this._matrix}forEach(t){const n=this._matrix,r=Object.keys(n);for(const s of r){const i=Number(s),o=n[i];if(t(i,o)===!1)return this}return this}forRow(t){const n=this._matrix,r=Object.keys(n);for(const s of r){const i=Number(s),o=n[i];if(t(i,Object.keys(o).map(l=>Number(l)))===!1)return this}return this}forValue(t){const n=this._matrix;for(const r in n){const s=Number(r),i=n[s];if(i)for(const o in i){const a=Number(o),l=i[a];if(t(s,a,l)===!1)return this}}return this}swapRow(t,n){const r=this._matrix[t],s=this._matrix[n];this._matrix[t]=s,this._matrix[n]=r}getRow(t){return this._matrix[t]}getRowOrCreate(t){let n=this.getRow(t);return n==null&&(n={},this._matrix[t]=n),n}reset(){this._setOriginValue({})}hasValue(){const t=this._matrix,n=Object.keys(t);if(n.length===0)return!1;for(const r of n){const s=Number(r),i=t[s];if(Object.keys(i).length>0)return!0}return!1}getValue(t,n){var r,s;return(s=(r=this._matrix)==null?void 0:r[t])==null?void 0:s[n]}setValue(t,n,r){const s=this.getRowOrCreate(t);s[n]=r}deleteValue(t,n){var r,s;(s=(r=this._matrix)==null?void 0:r[t])==null||delete s[n]}realDeleteValue(t,n){var r,s,i;if((s=(r=this._matrix)==null?void 0:r[t])==null||delete s[n],this.getRow(t)){const o=this.getRow(t);if(o==null)return;Object.keys(o).length===0&&((i=this._matrix)==null||delete i[t])}}setRow(t,n){this._matrix[t]=n}moveRows(t,n,r){$i(t,n,r,this._matrix)}moveColumns(t,n,r){this.forEach((s,i)=>{$i(t,n,r,i)})}insertRows(t,n){const r=Object.keys(this._matrix);for(let s=r.length-1;s>=0;s--){const i=Number(r[s]);if(i>=t){const o=this._matrix[i];delete this._matrix[i],this._matrix[i+n]=o}}}insertColumns(t,n){const r=Object.keys(this._matrix);for(let s=0;s<r.length;s++){const i=Number(r[s]),o=this._matrix[i],a=Object.keys(o);for(let l=a.length-1;l>=0;l--){const c=Number(a[l]);if(c>=t){const u=o[c];delete o[c],o[c+n]=u}}}}removeRows(t,n){Bi(t,n,this._matrix)}removeColumns(t,n){this.forEach((r,s)=>{s&&Bi(t,n,s)})}getFragment(t,n,r,s){const i=new ct;let o=0;for(let a=t;a<=n;a++){const l={};let c=0;for(let u=r;u<=s;u++){const h=this.getValue(a,u);l[c]=h,c++}i.setRow(o,l),o++}return i}getSlice(t,n,r,s){const i=new ct;for(let o=t;o<=n;o++)for(let a=r;a<=s;a++){const l=this.getValue(o,a);l&&i.setValue(o,a,Z.deepClone(l))}return i}getSliceDataAndCellCountByRows(t,n){const r=new ct;let s=0;for(let i=t;i<=n;i++){const o=this.getRow(i);o&&(r.setRow(i,o),s+=Object.keys(o).length)}return{sliceData:r,cellCount:s}}getSizeOf(){return Object.keys(this._matrix).length}getLength(){return Qt(this._matrix)}getRange(){const r=this.getLength()-1;let s=0;const i=this.getLength();for(let o=0;o<i;o++){const a=this.getRow(o);if(a){const l=Qt(a)-1;s=l>s?l:s}}return{startRow:0,startColumn:0,endRow:r,endColumn:s}}getRealRange(){const t=Object.keys(this._matrix),n=t.length,r=n>0?Number(t[0]):0,s=n>0?Number(t[n-1]):0;let i=-1/0,o=0;for(const a of t){const l=this.getRow(Number(a));if(l){const c=Object.keys(l);if(c.length>0){const u=Number(c[0]),h=Number(c[c.length-1]);(i===-1/0||u<i)&&(i=u),h>o&&(o=h)}}}return i===-1/0&&(i=0),{startRow:r,endRow:s,startColumn:i,endColumn:o}}getRealRowRange(){const t=Object.keys(this._matrix),n=t.length,r=n>0?Number(t[0]):0,s=n>0?Number(t[n-1]):0;return{startRow:r,endRow:s}}toNativeArray(){const t=new Array;return this.forValue((n,r,s)=>{t.push(s)}),t}toArray(){const t=[];return this.forRow((n,r)=>{t[n]==null&&(t[n]=[]),r.forEach(s=>{t[n][s]=this.getValue(n,s)})}),t}toFullArray(){const t=this.getRange(),{endColumn:n,endRow:r}=t,s=[];for(let i=0;i<=r;i++){const o=new Array(n+1).fill(void 0);s.push(o)}return this.forValue((i,o,a)=>{s[i][o]=a}),s}toJSON(){return this._matrix}clone(){const t=JSON.stringify(this._matrix);return JSON.parse(t)}getData(){const t=JSON.stringify(this._matrix);return JSON.parse(t)}getArrayData(){let t=0,n=0,r=!1,s=!1;const i=new ct;return this.forEach((o,a)=>{r||(r=!0,t=o),Object.keys(a).forEach(l=>{const c=Number(l);s?c<n&&(n=c):(s=!0,n=c);const u=this.getValue(o,c);i.setValue(o-t,c-n,u)})}),i.getData()}getStartEndScope(){let t=1/0,n=-1/0,r=1/0,s=-1/0;const i=Object.keys(this._matrix);i.length>0&&(t=+i[0],n=+i[i.length-1]);for(const o of i){const a=Object.keys(this._matrix[o]);a.length>0&&(r=Math.min(r,+a[0]),s=Math.max(s,+a[a.length-1]))}return{startRow:t,endRow:n,startColumn:r,endColumn:s}}getDataRange(){let t=0,n=0,r=0,s=-1,i=!1,o=!1;return this.forEach((a,l)=>{if(i||(i=!0,t=a),l==null)return;const c=Qt(l)-1;c>r&&(r=c),Object.keys(l).forEach(u=>{const h=Number(u);o?h<n&&(n=h):(o=!0,n=h)}),a>s&&(s=a)}),{startRow:t,startColumn:n,endRow:s,endColumn:r}}getDiscreteRanges(){const t=[];return this.forEach((n,r)=>{Object.keys(r).forEach(s=>{const i=Number(s);let o=!1;for(const a of t)if(n>=a.startRow&&n<=a.endRow+1&&i>=a.startColumn&&i<=a.endColumn+1){a.endRow=Math.max(n,a.endRow),a.endColumn=Math.max(i,a.endColumn),o=!0;break}o||t.push({startRow:n,endRow:n,startColumn:i,endColumn:i})})}),t}merge(t){this.forValue((n,r)=>{const s=t.getValue(n,r);s!=null&&this.setValue(n,r,s)})}concatRows(t){const n=t.getMatrix();for(const r in n){const s=Number(r);this.setRow(s,n[s])}}_setOriginValue(t={}){this._matrix=t}}function Gu(e){const{actualRow:t,actualColumn:n,isMerged:r,isMergedMainCell:s,mergeInfo:i}=e;let{startY:o,endY:a,startX:l,endX:c}=e,u=t,h=n,d=t,f=n;if(r&&i){const{startRow:g,startColumn:E,endRow:R,endColumn:b,startY:F,endY:k,startX:W,endX:S}=i;u=g,h=E,d=R,f=b,o=F,a=k,l=W,c=S}return s&&(o=i.startY,a=i.endY,l=i.startX,c=i.endX,d=i.endRow,f=i.endColumn),{startRow:u,startColumn:h,endRow:d,endColumn:f,startY:o,endY:a,startX:l,endX:c}}const RE=Gu;function IE(e){if(!e)return;const{actualRow:t,actualColumn:n,isMerged:r,isMergedMainCell:s,startRow:i,startColumn:o,endRow:a,endColumn:l}=e;let c=t,u=n,h=t,d=n;return(r||s)&&(c=i,u=o,h=a,d=l),{startRow:c,startColumn:u,endRow:h,endColumn:d}}function Xu(e){var n;return!e||(((n=e==null?void 0:e.v)==null?void 0:n.toString())||"").length===0&&!e.p}function ji(e){return Xu(e)&&(e==null?void 0:e.coverable)!==!1}function xt(e){var t;if(e){if(e.rgb)return new ft(e.rgb).toHexString();if(e.th!=null){const n=(t=vu[$s.OFFICE])==null?void 0:t[e.th];if(n)return new ft(n).toRgbString()}}return null}function qu(e){return Z.isString(e)&&e.substring(0,1)==="="&&e.length>1}function SE(e){return Z.isString(e)&&e.length>0}function OE(e,t=!1){var i;let n="";const r=new Map([["ff",()=>{e.ff&&(n+=`font-family: ${e.ff}; `)}],["fs",()=>{if(e.fs){let o=e.fs;e.va&&(o/=2),n+=`font-size: ${o}pt; `}}],["it",()=>{e.it&&(n+="font-style: italic; ")}],["bl",()=>{e.bl&&(n+="font-weight: bold; ")}],["ul",()=>{var o;(o=e.ul)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} underline`):n+="text-decoration: underline; ",e.ul.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${xt(e.ul.cl)}; `),e.ul.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${e.ul.t} `))}],["st",()=>{var o;(o=e.st)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} line-through`):n+="text-decoration-line: line-through; ",e.st.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${xt(e.st.cl)}; `),e.st.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${e.st.t} `))}],["ol",()=>{var o;(o=e.ol)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} overline`):n+="text-decoration-line: overline; ",e.ol.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${xt(e.ol.cl)}; `),e.ol.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${e.ol.t} `))}],["bg",()=>{e.bg&&(n+=`background: ${xt(e.bg)}; `)}],["bd",()=>{var o,a,l,c,u,h,d,f,g,E,R,b;(o=e.bd)!=null&&o.b&&(n+=`border-bottom: ${Qr((a=e.bd)==null?void 0:a.b.s)} ${(l=xt(e.bd.b.cl))!=null?l:""}; `),(c=e.bd)!=null&&c.t&&(n+=`border-top: ${Qr((u=e.bd)==null?void 0:u.t.s)} ${(h=xt(e.bd.t.cl))!=null?h:""}; `),(d=e.bd)!=null&&d.r&&(n+=`border-right: ${Qr((f=e.bd)==null?void 0:f.r.s)} ${(g=xt(e.bd.r.cl))!=null?g:""}; `),(E=e.bd)!=null&&E.l&&(n+=`border-left: ${Qr((R=e.bd)==null?void 0:R.l.s)} ${(b=xt(e.bd.l.cl))!=null?b:""}; `)}],["cl",()=>{e.cl&&(n+=`color: ${xt(e.cl)}; `)}],["va",()=>{e.va===gn.SUBSCRIPT?n+="vertical-align: sub; ":e.va===gn.SUPERSCRIPT&&(n+="vertical-align: super; ")}],["td",()=>{e.td===yr.LEFT_TO_RIGHT?n+="direction: ltr; ":e.td===yr.RIGHT_TO_LEFT&&(n+="direction: rtl; ")}],["tr",()=>{var o,a,l;e.tr&&(n+=`--data-rotate: (${(o=e.tr)==null?void 0:o.a}deg${(a=e.tr)!=null&&a.v?` ,${(l=e.tr)==null?void 0:l.v}`:""});`)}],["ht",()=>{e.ht===At.LEFT?n+="text-align: left; ":e.ht===At.RIGHT?n+="text-align: right; ":e.ht===At.CENTER?n+="text-align: center; ":e.ht===At.JUSTIFIED&&(n+="text-align: justify; ")}],["vt",()=>{e.vt===mn.BOTTOM?n+="vertical-align: bottom; ":e.vt===mn.TOP?n+="vertical-align: top; ":e.vt===mn.MIDDLE&&(n+="vertical-align: middle; ")}],["tb",()=>{e.tb===Rn.CLIP?n+="white-space: nowrap; overflow-x: hidden; ":e.tb===Rn.WRAP&&(n+="white-space: normal;")}],["pd",()=>{var u,h,d,f,g,E,R,b;const o=`${(u=e.pd)==null?void 0:u.b}pt`,a=`${(h=e.pd)==null?void 0:h.t}pt`,l=`${(d=e.pd)==null?void 0:d.l}pt`,c=`${(f=e.pd)==null?void 0:f.r}pt`;(g=e.pd)!=null&&g.b&&(n+=`padding-bottom: ${o}; `),(E=e.pd)!=null&&E.t&&(n+=`padding-top: ${a}; `),(R=e.pd)!=null&&R.l&&(n+=`padding-left: ${l}; `),(b=e.pd)!=null&&b.r&&(n+=`padding-right: ${c}; `)}]]),s=["bd","tr","tb"];for(const o in e)t&&s.includes(o)||(i=r.get(o))==null||i();return n}function Qr(e){let t="";return e===xe.NONE?t="none":e===xe.THIN?t="0.5pt solid":e===xe.HAIR?t="0.5pt double":e===xe.DOTTED?t="0.5pt dotted":e===xe.DASHED||e===xe.DASH_DOT?t="0.5pt dashed":e===xe.DASH_DOT_DOT?t="0.5pt dotted":e===xe.DOUBLE?t="0.5pt double":e===xe.MEDIUM?t="1pt solid":e===xe.MEDIUM_DASHED||e===xe.MEDIUM_DASH_DOT?t="1pt dashed":e===xe.MEDIUM_DASH_DOT_DOT?t="1pt dotted":e===xe.SLANT_DASH_DOT?t="0.5pt dashed":e===xe.THICK&&(t="1.5pt solid"),t}function vE(e){let t=0;if(e=e.trim(),e==="none")t=xe.NONE;else if(e==="0.5pt solid")t=xe.THIN;else if(e==="0.5pt double")t=xe.HAIR;else if(e==="0.5pt dotted")t=xe.DOTTED;else if(e==="0.5pt dashed")t=xe.DASHED;else if(e==="1pt solid")t=xe.MEDIUM;else if(e==="1pt dashed")t=xe.MEDIUM_DASHED;else if(e==="1pt dotted")t=xe.MEDIUM_DASH_DOT_DOT;else if(e==="1.5pt solid")t=xe.THICK;else if(!e.includes("none"))t=xe.THIN;else return xe.NONE;return t}function wE(e,t){let n=e.body;if(t){const{headers:r,footers:s}=e;r!=null&&r[t]?n=r[t].body:s!=null&&s[t]&&(n=s[t].body)}return n}function bE(e,t){const{startRow:n,endRow:r,startColumn:s,endColumn:i,rangeType:o}=e;if(n<0||s<0||r<0||i<0||!(Number.isNaN(n)&&Number.isNaN(r))&&o===_e.COLUMN||!(Number.isNaN(s)&&Number.isNaN(i))&&o===_e.ROW||o!==_e.ROW&&o!==_e.COLUMN&&(Number.isNaN(s)||Number.isNaN(n)||Number.isNaN(i)||Number.isNaN(r)))return!1;if(t){const a=t.getRowCount(),l=t.getColumnCount();if(r>=a||i>=l)return!1}return!0}function yE(e,t){return{startRow:e,endRow:e,startColumn:t,endColumn:t}}function Wi(e){if(qu(e))return{f:e,v:null,p:null};if(Iu(e)){if(typeof e=="string"){const t=Ku(e);if(t&&t.z)return{v:t.v,p:null,f:null,s:{n:{pattern:t.z||ta}}}}return{v:e,p:null,f:null}}return Ru(e),e}function AE(e,t){const n=new ct,{startRow:r,startColumn:s,endRow:i,endColumn:o}=t;if(Z.isArray(e))for(let a=0;a<=i-r;a++)for(let l=0;l<=o-s;l++)n.setValue(a+r,l+s,Wi(e[a][l]));else new ct(e).forValue((l,c,u)=>{n.setValue(l,c,Wi(u))});return n.getMatrix()}function na(e,t){return Object.prototype.toString.call(e)===Object.prototype.toString.call(t)?Object.prototype.toString.call(e)==="[object Object]"||Object.prototype.toString.call(e)==="[object Array]"?Object.keys(e).length!==Object.keys(t).length?!1:Object.keys(e).every(n=>na(e[n],t[n])):e===t:!1}function Ju(e,t){const n=e.ts||{},r=t.ts||{};return e.sId!==t.sId?!1:na(n,r)}function TE(e,t){return t.some(n=>e.indexOf(n)>-1)}var us={exports:{}},NE=us.exports,el;function ME(){return el||(el=1,(function(e,t){(function(n,r){e.exports=r()})(NE,(function(){var n=1e3,r=6e4,s=36e5,i="millisecond",o="second",a="minute",l="hour",c="day",u="week",h="month",d="quarter",f="year",g="date",E="Invalid Date",R=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,b=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,F={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(N){var y=["th","st","nd","rd"],v=N%100;return"["+N+(y[(v-20)%10]||y[v]||y[0])+"]"}},k=function(N,y,v){var T=String(N);return!T||T.length>=y?N:""+Array(y+1-T.length).join(v)+N},W={s:k,z:function(N){var y=-N.utcOffset(),v=Math.abs(y),T=Math.floor(v/60),M=v%60;return(y<=0?"+":"-")+k(T,2,"0")+":"+k(M,2,"0")},m:function N(y,v){if(y.date()<v.date())return-N(v,y);var T=12*(v.year()-y.year())+(v.month()-y.month()),M=y.clone().add(T,h),D=v-M<0,P=y.clone().add(T+(D?-1:1),h);return+(-(T+(v-M)/(D?M-P:P-M))||0)},a:function(N){return N<0?Math.ceil(N)||0:Math.floor(N)},p:function(N){return{M:h,y:f,w:u,d:c,D:g,h:l,m:a,s:o,ms:i,Q:d}[N]||String(N||"").toLowerCase().replace(/s$/,"")},u:function(N){return N===void 0}},S="en",p={};p[S]=F;var w="$isDayjsObject",A=function(N){return N instanceof x||!(!N||!N[w])},H=function N(y,v,T){var M;if(!y)return S;if(typeof y=="string"){var D=y.toLowerCase();p[D]&&(M=D),v&&(p[D]=v,M=D);var P=y.split("-");if(!M&&P.length>1)return N(P[0])}else{var J=y.name;p[J]=y,M=J}return!T&&M&&(S=M),M||!T&&S},B=function(N,y){if(A(N))return N.clone();var v=typeof y=="object"?y:{};return v.date=N,v.args=arguments,new x(v)},m=W;m.l=H,m.i=A,m.w=function(N,y){return B(N,{locale:y.$L,utc:y.$u,x:y.$x,$offset:y.$offset})};var x=(function(){function N(v){this.$L=H(v.locale,null,!0),this.parse(v),this.$x=this.$x||v.x||{},this[w]=!0}var y=N.prototype;return y.parse=function(v){this.$d=(function(T){var M=T.date,D=T.utc;if(M===null)return new Date(NaN);if(m.u(M))return new Date;if(M instanceof Date)return new Date(M);if(typeof M=="string"&&!/Z$/i.test(M)){var P=M.match(R);if(P){var J=P[2]-1||0,V=(P[7]||"0").substring(0,3);return D?new Date(Date.UTC(P[1],J,P[3]||1,P[4]||0,P[5]||0,P[6]||0,V)):new Date(P[1],J,P[3]||1,P[4]||0,P[5]||0,P[6]||0,V)}}return new Date(M)})(v),this.init()},y.init=function(){var v=this.$d;this.$y=v.getFullYear(),this.$M=v.getMonth(),this.$D=v.getDate(),this.$W=v.getDay(),this.$H=v.getHours(),this.$m=v.getMinutes(),this.$s=v.getSeconds(),this.$ms=v.getMilliseconds()},y.$utils=function(){return m},y.isValid=function(){return this.$d.toString()!==E},y.isSame=function(v,T){var M=B(v);return this.startOf(T)<=M&&M<=this.endOf(T)},y.isAfter=function(v,T){return B(v)<this.startOf(T)},y.isBefore=function(v,T){return this.endOf(T)<B(v)},y.$g=function(v,T,M){return m.u(v)?this[T]:this.set(M,v)},y.unix=function(){return Math.floor(this.valueOf()/1e3)},y.valueOf=function(){return this.$d.getTime()},y.startOf=function(v,T){var M=this,D=!!m.u(T)||T,P=m.p(v),J=function($,j){var Q=m.w(M.$u?Date.UTC(M.$y,j,$):new Date(M.$y,j,$),M);return D?Q:Q.endOf(c)},V=function($,j){return m.w(M.toDate()[$].apply(M.toDate("s"),(D?[0,0,0,0]:[23,59,59,999]).slice(j)),M)},ie=this.$W,le=this.$M,I=this.$D,L="set"+(this.$u?"UTC":"");switch(P){case f:return D?J(1,0):J(31,11);case h:return D?J(1,le):J(0,le+1);case u:var Y=this.$locale().weekStart||0,z=(ie<Y?ie+7:ie)-Y;return J(D?I-z:I+(6-z),le);case c:case g:return V(L+"Hours",0);case l:return V(L+"Minutes",1);case a:return V(L+"Seconds",2);case o:return V(L+"Milliseconds",3);default:return this.clone()}},y.endOf=function(v){return this.startOf(v,!1)},y.$set=function(v,T){var M,D=m.p(v),P="set"+(this.$u?"UTC":""),J=(M={},M[c]=P+"Date",M[g]=P+"Date",M[h]=P+"Month",M[f]=P+"FullYear",M[l]=P+"Hours",M[a]=P+"Minutes",M[o]=P+"Seconds",M[i]=P+"Milliseconds",M)[D],V=D===c?this.$D+(T-this.$W):T;if(D===h||D===f){var ie=this.clone().set(g,1);ie.$d[J](V),ie.init(),this.$d=ie.set(g,Math.min(this.$D,ie.daysInMonth())).$d}else J&&this.$d[J](V);return this.init(),this},y.set=function(v,T){return this.clone().$set(v,T)},y.get=function(v){return this[m.p(v)]()},y.add=function(v,T){var M,D=this;v=Number(v);var P=m.p(T),J=function(le){var I=B(D);return m.w(I.date(I.date()+Math.round(le*v)),D)};if(P===h)return this.set(h,this.$M+v);if(P===f)return this.set(f,this.$y+v);if(P===c)return J(1);if(P===u)return J(7);var V=(M={},M[a]=r,M[l]=s,M[o]=n,M)[P]||1,ie=this.$d.getTime()+v*V;return m.w(ie,this)},y.subtract=function(v,T){return this.add(-1*v,T)},y.format=function(v){var T=this,M=this.$locale();if(!this.isValid())return M.invalidDate||E;var D=v||"YYYY-MM-DDTHH:mm:ssZ",P=m.z(this),J=this.$H,V=this.$m,ie=this.$M,le=M.weekdays,I=M.months,L=M.meridiem,Y=function(j,Q,ee,U){return j&&(j[Q]||j(T,D))||ee[Q].slice(0,U)},z=function(j){return m.s(J%12||12,j,"0")},$=L||function(j,Q,ee){var U=j<12?"AM":"PM";return ee?U.toLowerCase():U};return D.replace(b,(function(j,Q){return Q||(function(ee){switch(ee){case"YY":return String(T.$y).slice(-2);case"YYYY":return m.s(T.$y,4,"0");case"M":return ie+1;case"MM":return m.s(ie+1,2,"0");case"MMM":return Y(M.monthsShort,ie,I,3);case"MMMM":return Y(I,ie);case"D":return T.$D;case"DD":return m.s(T.$D,2,"0");case"d":return String(T.$W);case"dd":return Y(M.weekdaysMin,T.$W,le,2);case"ddd":return Y(M.weekdaysShort,T.$W,le,3);case"dddd":return le[T.$W];case"H":return String(J);case"HH":return m.s(J,2,"0");case"h":return z(1);case"hh":return z(2);case"a":return $(J,V,!0);case"A":return $(J,V,!1);case"m":return String(V);case"mm":return m.s(V,2,"0");case"s":return String(T.$s);case"ss":return m.s(T.$s,2,"0");case"SSS":return m.s(T.$ms,3,"0");case"Z":return P}return null})(j)||P.replace(":","")}))},y.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},y.diff=function(v,T,M){var D,P=this,J=m.p(T),V=B(v),ie=(V.utcOffset()-this.utcOffset())*r,le=this-V,I=function(){return m.m(P,V)};switch(J){case f:D=I()/12;break;case h:D=I();break;case d:D=I()/3;break;case u:D=(le-ie)/6048e5;break;case c:D=(le-ie)/864e5;break;case l:D=le/s;break;case a:D=le/r;break;case o:D=le/n;break;default:D=le}return M?D:m.a(D)},y.daysInMonth=function(){return this.endOf(h).$D},y.$locale=function(){return p[this.$L]},y.locale=function(v,T){if(!v)return this.$L;var M=this.clone(),D=H(v,T,!0);return D&&(M.$L=D),M},y.clone=function(){return m.w(this.$d,this)},y.toDate=function(){return new Date(this.valueOf())},y.toJSON=function(){return this.isValid()?this.toISOString():null},y.toISOString=function(){return this.$d.toISOString()},y.toString=function(){return this.$d.toUTCString()},N})(),O=x.prototype;return B.prototype=O,[["$ms",i],["$s",o],["$m",a],["$H",l],["$W",c],["$M",h],["$y",f],["$D",g]].forEach((function(N){O[N[1]]=function(y){return this.$g(y,N[0],N[1])}})),B.extend=function(N,y){return N.$i||(N(y,x,B),N.$i=!0),B},B.locale=H,B.isDayjs=A,B.unix=function(N){return B(1e3*N)},B.en=p[S],B.Ls=p,B.p={},B}))})(us)),us.exports}var DE=ME();const Vt=St(DE);var hs={exports:{}},LE=hs.exports,tl;function xE(){return tl||(tl=1,(function(e,t){(function(n,r){e.exports=r()})(LE,(function(){return function(n,r){var s=r.prototype,i=s.format;s.format=function(o){var a=this,l=this.$locale();if(!this.isValid())return i.bind(this)(o);var c=this.$utils(),u=(o||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(h){switch(h){case"Q":return Math.ceil((a.$M+1)/3);case"Do":return l.ordinal(a.$D);case"gggg":return a.weekYear();case"GGGG":return a.isoWeekYear();case"wo":return l.ordinal(a.week(),"W");case"w":case"ww":return c.s(a.week(),h==="w"?1:2,"0");case"W":case"WW":return c.s(a.isoWeek(),h==="W"?1:2,"0");case"k":case"kk":return c.s(String(a.$H===0?24:a.$H),h==="k"?1:2,"0");case"X":return Math.floor(a.$d.getTime()/1e3);case"x":return a.$d.getTime();case"z":return"["+a.offsetName()+"]";case"zzz":return"["+a.offsetName("long")+"]";default:return h}}));return i.bind(this)(u)}}}))})(hs)),hs.exports}var UE=xE();const PE=St(UE);var ds={exports:{}},kE=ds.exports,nl;function FE(){return nl||(nl=1,(function(e,t){(function(n,r){e.exports=r()})(kE,(function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},r=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,s=/\d/,i=/\d\d/,o=/\d\d?/,a=/\d*[^-_:/,()\s\d]+/,l={},c=function(R){return(R=+R)+(R>68?1900:2e3)},u=function(R){return function(b){this[R]=+b}},h=[/[+-]\d\d:?(\d\d)?|Z/,function(R){(this.zone||(this.zone={})).offset=(function(b){if(!b||b==="Z")return 0;var F=b.match(/([+-]|\d\d)/g),k=60*F[1]+(+F[2]||0);return k===0?0:F[0]==="+"?-k:k})(R)}],d=function(R){var b=l[R];return b&&(b.indexOf?b:b.s.concat(b.f))},f=function(R,b){var F,k=l.meridiem;if(k){for(var W=1;W<=24;W+=1)if(R.indexOf(k(W,0,b))>-1){F=W>12;break}}else F=R===(b?"pm":"PM");return F},g={A:[a,function(R){this.afternoon=f(R,!1)}],a:[a,function(R){this.afternoon=f(R,!0)}],Q:[s,function(R){this.month=3*(R-1)+1}],S:[s,function(R){this.milliseconds=100*+R}],SS:[i,function(R){this.milliseconds=10*+R}],SSS:[/\d{3}/,function(R){this.milliseconds=+R}],s:[o,u("seconds")],ss:[o,u("seconds")],m:[o,u("minutes")],mm:[o,u("minutes")],H:[o,u("hours")],h:[o,u("hours")],HH:[o,u("hours")],hh:[o,u("hours")],D:[o,u("day")],DD:[i,u("day")],Do:[a,function(R){var b=l.ordinal,F=R.match(/\d+/);if(this.day=F[0],b)for(var k=1;k<=31;k+=1)b(k).replace(/\[|\]/g,"")===R&&(this.day=k)}],w:[o,u("week")],ww:[i,u("week")],M:[o,u("month")],MM:[i,u("month")],MMM:[a,function(R){var b=d("months"),F=(d("monthsShort")||b.map((function(k){return k.slice(0,3)}))).indexOf(R)+1;if(F<1)throw new Error;this.month=F%12||F}],MMMM:[a,function(R){var b=d("months").indexOf(R)+1;if(b<1)throw new Error;this.month=b%12||b}],Y:[/[+-]?\d+/,u("year")],YY:[i,function(R){this.year=c(R)}],YYYY:[/\d{4}/,u("year")],Z:h,ZZ:h};function E(R){var b,F;b=R,F=l&&l.formats;for(var k=(R=b.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(B,m,x){var O=x&&x.toUpperCase();return m||F[x]||n[x]||F[O].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(N,y,v){return y||v.slice(1)}))}))).match(r),W=k.length,S=0;S<W;S+=1){var p=k[S],w=g[p],A=w&&w[0],H=w&&w[1];k[S]=H?{regex:A,parser:H}:p.replace(/^\[|\]$/g,"")}return function(B){for(var m={},x=0,O=0;x<W;x+=1){var N=k[x];if(typeof N=="string")O+=N.length;else{var y=N.regex,v=N.parser,T=B.slice(O),M=y.exec(T)[0];v.call(m,M),B=B.replace(M,"")}}return(function(D){var P=D.afternoon;if(P!==void 0){var J=D.hours;P?J<12&&(D.hours+=12):J===12&&(D.hours=0),delete D.afternoon}})(m),m}}return function(R,b,F){F.p.customParseFormat=!0,R&&R.parseTwoDigitYear&&(c=R.parseTwoDigitYear);var k=b.prototype,W=k.parse;k.parse=function(S){var p=S.date,w=S.utc,A=S.args;this.$u=w;var H=A[1];if(typeof H=="string"){var B=A[2]===!0,m=A[3]===!0,x=B||m,O=A[2];m&&(O=A[2]),l=this.$locale(),!B&&O&&(l=F.Ls[O]),this.$d=(function(T,M,D,P){try{if(["x","X"].indexOf(M)>-1)return new Date((M==="X"?1e3:1)*T);var J=E(M)(T),V=J.year,ie=J.month,le=J.day,I=J.hours,L=J.minutes,Y=J.seconds,z=J.milliseconds,$=J.zone,j=J.week,Q=new Date,ee=le||(V||ie?1:Q.getDate()),U=V||Q.getFullYear(),K=0;V&&!ie||(K=ie>0?ie-1:Q.getMonth());var X,ne=I||0,me=L||0,pe=Y||0,G=z||0;return $?new Date(Date.UTC(U,K,ee,ne,me,pe,G+60*$.offset*1e3)):D?new Date(Date.UTC(U,K,ee,ne,me,pe,G)):(X=new Date(U,K,ee,ne,me,pe,G),j&&(X=P(X).week(j).toDate()),X)}catch{return new Date("")}})(p,H,w,F),this.init(),O&&O!==!0&&(this.$L=this.locale(O).$L),x&&p!=this.format(H)&&(this.$d=new Date("")),l={}}else if(H instanceof Array)for(var N=H.length,y=1;y<=N;y+=1){A[1]=H[y-1];var v=F.apply(this,A);if(v.isValid()){this.$d=v.$d,this.$L=v.$L,this.init();break}y===N&&(this.$d=new Date(""))}else W.call(this,S)}}}))})(ds)),ds.exports}var HE=FE();const BE=St(HE);var fs={exports:{}},$E=fs.exports,rl;function jE(){return rl||(rl=1,(function(e,t){(function(n,r){e.exports=r()})($E,(function(){return function(n,r,s){var i=r.prototype,o=function(h){return h&&(h.indexOf?h:h.s)},a=function(h,d,f,g,E){var R=h.name?h:h.$locale(),b=o(R[d]),F=o(R[f]),k=b||F.map((function(S){return S.slice(0,g)}));if(!E)return k;var W=R.weekStart;return k.map((function(S,p){return k[(p+(W||0))%7]}))},l=function(){return s.Ls[s.locale()]},c=function(h,d){return h.formats[d]||(function(f){return f.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(g,E,R){return E||R.slice(1)}))})(h.formats[d.toUpperCase()])},u=function(){var h=this;return{months:function(d){return d?d.format("MMMM"):a(h,"months")},monthsShort:function(d){return d?d.format("MMM"):a(h,"monthsShort","months",3)},firstDayOfWeek:function(){return h.$locale().weekStart||0},weekdays:function(d){return d?d.format("dddd"):a(h,"weekdays")},weekdaysMin:function(d){return d?d.format("dd"):a(h,"weekdaysMin","weekdays",2)},weekdaysShort:function(d){return d?d.format("ddd"):a(h,"weekdaysShort","weekdays",3)},longDateFormat:function(d){return c(h.$locale(),d)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};i.localeData=function(){return u.bind(this)()},s.localeData=function(){var h=l();return{firstDayOfWeek:function(){return h.weekStart||0},weekdays:function(){return s.weekdays()},weekdaysShort:function(){return s.weekdaysShort()},weekdaysMin:function(){return s.weekdaysMin()},months:function(){return s.months()},monthsShort:function(){return s.monthsShort()},longDateFormat:function(d){return c(h,d)},meridiem:h.meridiem,ordinal:h.ordinal}},s.months=function(){return a(l(),"months")},s.monthsShort=function(){return a(l(),"monthsShort","months",3)},s.weekdays=function(h){return a(l(),"weekdays",null,null,h)},s.weekdaysShort=function(h){return a(l(),"weekdaysShort","weekdays",3,h)},s.weekdaysMin=function(h){return a(l(),"weekdaysMin","weekdays",2,h)}}}))})(fs)),fs.exports}var WE=jE();const YE=St(WE);var ms={exports:{}},zE=ms.exports,sl;function VE(){return sl||(sl=1,(function(e,t){(function(n,r){e.exports=r()})(zE,(function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(r,s,i){var o=s.prototype,a=o.format;i.en.formats=n,o.format=function(l){l===void 0&&(l="YYYY-MM-DDTHH:mm:ssZ");var c=this.$locale().formats,u=(function(h,d){return h.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(f,g,E){var R=E&&E.toUpperCase();return g||d[E]||n[E]||d[R].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(b,F,k){return F||k.slice(1)}))}))})(l,c===void 0?{}:c);return a.call(this,u)}}}))})(ms)),ms.exports}var KE=VE();const GE=St(KE);var gs={exports:{}},XE=gs.exports,il;function qE(){return il||(il=1,(function(e,t){(function(n,r){e.exports=r()})(XE,(function(){var n="minute",r=/[+-]\d\d(?::?\d\d)?/g,s=/([+-]|\d\d)/g;return function(i,o,a){var l=o.prototype;a.utc=function(E){var R={date:E,utc:!0,args:arguments};return new o(R)},l.utc=function(E){var R=a(this.toDate(),{locale:this.$L,utc:!0});return E?R.add(this.utcOffset(),n):R},l.local=function(){return a(this.toDate(),{locale:this.$L,utc:!1})};var c=l.parse;l.parse=function(E){E.utc&&(this.$u=!0),this.$utils().u(E.$offset)||(this.$offset=E.$offset),c.call(this,E)};var u=l.init;l.init=function(){if(this.$u){var E=this.$d;this.$y=E.getUTCFullYear(),this.$M=E.getUTCMonth(),this.$D=E.getUTCDate(),this.$W=E.getUTCDay(),this.$H=E.getUTCHours(),this.$m=E.getUTCMinutes(),this.$s=E.getUTCSeconds(),this.$ms=E.getUTCMilliseconds()}else u.call(this)};var h=l.utcOffset;l.utcOffset=function(E,R){var b=this.$utils().u;if(b(E))return this.$u?0:b(this.$offset)?h.call(this):this.$offset;if(typeof E=="string"&&(E=(function(S){S===void 0&&(S="");var p=S.match(r);if(!p)return null;var w=(""+p[0]).match(s)||["-",0,0],A=w[0],H=60*+w[1]+ +w[2];return H===0?0:A==="+"?H:-H})(E),E===null))return this;var F=Math.abs(E)<=16?60*E:E;if(F===0)return this.utc(R);var k=this.clone();if(R)return k.$offset=F,k.$u=!1,k;var W=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(k=this.local().add(F+W,n)).$offset=F,k.$x.$localOffset=W,k};var d=l.format;l.format=function(E){var R=E||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return d.call(this,R)},l.valueOf=function(){var E=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*E},l.isUTC=function(){return!!this.$u},l.toISOString=function(){return this.toDate().toISOString()},l.toString=function(){return this.toDate().toUTCString()};var f=l.toDate;l.toDate=function(E){return E==="s"&&this.$offset?a(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():f.call(this)};var g=l.diff;l.diff=function(E,R,b){if(E&&this.$u===E.$u)return g.call(this,E,R,b);var F=this.local(),k=a(E).local();return g.call(F,k,R,b)}}}))})(gs)),gs.exports}var JE=qE();const ZE=St(JE);var _s={exports:{}},QE=_s.exports,ol;function e0(){return ol||(ol=1,(function(e,t){(function(n,r){e.exports=r()})(QE,(function(){return function(n,r){r.prototype.weekday=function(s){var i=this.$locale().weekStart||0,o=this.$W,a=(o<i?o+7:o)-i;return this.$utils().u(s)?a:this.subtract(a,"day").add(s,"day")}}}))})(_s)),_s.exports}var t0=e0();const n0=St(t0);var ps={exports:{}},r0=ps.exports,al;function s0(){return al||(al=1,(function(e,t){(function(n,r){e.exports=r()})(r0,(function(){var n="week",r="year";return function(s,i,o){var a=i.prototype;a.week=function(l){if(l===void 0&&(l=null),l!==null)return this.add(7*(l-this.week()),"day");var c=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var u=o(this).startOf(r).add(1,r).date(c),h=o(this).endOf(n);if(u.isBefore(h))return 1}var d=o(this).startOf(r).date(c).startOf(n).subtract(1,"millisecond"),f=this.diff(d,n,!0);return f<0?o(this).startOf("week").week():Math.ceil(f)},a.weeks=function(l){return l===void 0&&(l=null),this.week(l)}}}))})(ps)),ps.exports}var i0=s0();const o0=St(i0);var Es={exports:{}},a0=Es.exports,ll;function l0(){return ll||(ll=1,(function(e,t){(function(n,r){e.exports=r()})(a0,(function(){return function(n,r){r.prototype.weekYear=function(){var s=this.month(),i=this.week(),o=this.year();return i===1&&s===11?o+1:s===0&&i>=52?o-1:o}}}))})(Es)),Es.exports}var c0=l0();const u0=St(c0);Vt.extend(BE);Vt.extend(PE);Vt.extend(n0);Vt.extend(YE);Vt.extend(o0);Vt.extend(u0);Vt.extend(ZE);Vt.extend(GE);function Ks(e,t,n,r){if(e>t)throw new Error("a1 should be less than a2");if(n>r)throw new Error("b1 should be less than b2");if(t<n||r<e)return[e,t];if(n<=e&&r>=t)return[];const s=r-n+1;return e<n&&t>r?[e,t-s]:n<=e&&r<t?[r+1-s,t-s]:n>e&&r>=t?[e,n-1]:[e,t]}function h0(e){if(e==null)return!1;const t=e.bullet;return(t==null?void 0:t.listId)!=null}function d0(e){if(e==null)return!1;const t=e.paragraphStyle;return Zu(t)}function Zu(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 Qu(e,t,n){return e.slice(0,t)+n+e.slice(t)}function eh(e,t,n){return t>n?e:e.slice(0,t)+e.slice(n)}function f0(e){if(e==null||typeof e=="boolean")return!1;if(typeof e=="number")return!isNaN(e);if(typeof e=="string"){const t=e.trim();return t===""?!1:!isNaN(Number(t))}return!1}function m0(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 g0(e){if(e.length===0)return[];const t=e.slice().sort((i,o)=>(Array.isArray(i)?i[0]:i)-(Array.isArray(o)?o[0]:o)),n=[];let r=Array.isArray(t[0])?t[0][0]:t[0],s=r;for(let i=1;i<t.length;i++){const o=t[i];let a,l;Array.isArray(o)?(a=o[0],l=o[1]):(a=o,l=o),a<=s+1?s=Math.max(s,l):(n.push([r,s]),r=a,s=l)}return n.push([r,s]),n}function _0(e){if(e.length===0)return[];const t=e.slice().sort((i,o)=>i[0]-o[0]),n=[];let[r,s]=t[0];for(let i=1;i<t.length;i++){const[o,a]=t[i];o<=s+1?s=Math.max(s,a):(n.push([r,s]),r=o,s=a)}return n.push([r,s]),n}function p0(...e){let t;return e.length===1&&Array.isArray(e[0])?t=e[0]:t=e,Fs({},...t)}const Le=Symbol("newer"),Qe=Symbol("older");class E0{constructor(t){C(this,"entry");this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[Le],{done:!1,value:t.key}):{done:!0,value:void 0}}}class C0{constructor(t){C(this,"entry");this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[Le],{done:!1,value:t.value}):{done:!0,value:void 0}}}class R0{constructor(t){C(this,"entry");this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[Le],{done:!1,value:[t.key,t.value]}):{done:!0,value:void 0}}}var Al,Tl;Tl=Le,Al=Qe;class cl{constructor(t,n){C(this,"key");C(this,"value");C(this,Tl);C(this,Al);this.key=t,this.value=n,this[Le]=void 0,this[Qe]=void 0}toJSON(){return{key:this.key,value:this.value}}}class Gs{constructor(...t){C(this,"_keymap");C(this,"size",0);C(this,"limit");C(this,"oldest");C(this,"newest");C(this,"_onShiftListeners",[]);if(gr.hasLength(t,1)){if(gr.isNumber(t[0])){const n=t[0];this._initialize(n,void 0);return}if(gr.isIterable(t[0])){const n=t[0];this._initialize(0,n);return}return}if(gr.hasLength(t,2)){const n=t[0],r=t[1];this._initialize(n,r)}}onShift(t){if(this._onShiftListeners.indexOf(t)===-1)return this._onShiftListeners.push(t),Ye(()=>Lr(this._onShiftListeners,t));throw new Error("[LRUMap]: the listener has been registered!")}_initialize(t,n){this.oldest=void 0,this.newest=void 0,this.size=0,this.limit=t,this._keymap=new Map,n&&(this.assign(n),t<1&&(this.limit=this.size))}_markEntryAsUsed(t){t!==this.newest&&(t[Le]&&(t===this.oldest&&(this.oldest=t[Le]),t[Le][Qe]=t[Qe]),t[Qe]&&(t[Qe][Le]=t[Le]),t[Le]=void 0,t[Qe]=this.newest,this.newest&&(this.newest[Le]=t),this.newest=t)}assign(t){let n,r=this.limit||Number.MAX_VALUE;this._keymap.clear();const s=t[Symbol.iterator]();for(let i=s.next();!i.done;i=s.next()){const o=new cl(i.value[0],i.value[1]);if(this._keymap.set(o.key,o),n?(n[Le]=o,o[Qe]=n):this.oldest=o,n=o,r--===0)throw new Error("overflow")}this.newest=n,this.size=this._keymap.size}set(t,n){let r=this._keymap.get(t);return r?(r.value=n,this._markEntryAsUsed(r),this):(this._keymap.set(t,r=new cl(t,n)),this.newest?(this.newest[Le]=r,r[Qe]=this.newest):this.oldest=r,this.newest=r,++this.size,this.size>this.limit&&this.shift(),this)}shift(){const t=this.oldest;if(t)return this.oldest&&this.oldest[Le]?(this.oldest=this.oldest[Le],this.oldest[Qe]=void 0):(this.oldest=void 0,this.newest=void 0),t[Le]=t[Qe]=void 0,this._keymap.delete(t.key),--this.size,this._onShiftListeners.forEach(n=>n(t)),[t.key,t.value]}get(t){const n=this._keymap.get(t);if(n)return this._markEntryAsUsed(n),n.value}has(t){return this._keymap.has(t)}find(t){const n=this._keymap.get(t);return n?n.value:void 0}delete(t){const n=this._keymap.get(t);if(n)return this._keymap.delete(n.key),n[Le]&&n[Qe]?(n[Qe][Le]=n[Le],n[Le][Qe]=n[Qe]):n[Le]?(n[Le][Qe]=void 0,this.oldest=n[Le]):n[Qe]?(n[Qe][Le]=void 0,this.newest=n[Qe]):this.oldest=this.newest=void 0,this.size--,n.value}clear(){this.oldest=void 0,this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new E0(this.oldest)}values(){return new C0(this.oldest)}entries(){return this[Symbol.iterator]()}[Symbol.iterator](){return new R0(this.oldest)}forEach(t,n){typeof n!="object"&&(n=this);let r=this.oldest;for(;r;)t.call(n,r.value,r.key,this),r=r[Le]}toJSON(){const t=new Array(this.size);let n=0,r=this.oldest;for(;r;)t[n++]={key:r.key,value:r.value},r=r[Le];return t}toString(){let t="",n=this.oldest;for(;n;)t+=`${String(n.key)}:${n.value}`,n=n[Le],n&&(t+=" < ");return t}}class gr{static hasLength(t,n){return t.length===n}static getValueType(t){return Object.prototype.toString.apply(t)}static isObject(t){return this.getValueType(t)==="[object Object]"}static isIterable(t){return t[Symbol.iterator]!=null}static isNumber(t){return this.getValueType(t)==="[object Number]"}}function I0(e){let t=0;for(let n=0;n<e.length;n++){const r=e.charCodeAt(n);if(r<65||r>90)return-1;t=t*26+(r-64)}return t}const Yi=1048576,zi=16384,S0={sheetId:"",range:{startRow:-1,endRow:-1,startColumn:-1,endColumn:-1}},O0={startRow:-1,startColumn:-1,endRow:-1,endColumn:-1},v0={startRow:0,startColumn:0,endRow:0,endColumn:0},w0={row:0,column:0},it={ff:"Arial",fs:11,it:ce.FALSE,bl:ce.FALSE,ul:{s:ce.FALSE},st:{s:ce.FALSE},ol:{s:ce.FALSE},tr:{a:0,v:ce.FALSE},td:yr.UNSPECIFIED,cl:{rgb:"#000000"},bg:{rgb:"#fff"},ht:At.UNSPECIFIED,vt:mn.UNSPECIFIED,tb:Rn.UNSPECIFIED,pd:{t:0,r:0,b:0,l:0},n:null,bd:{b:null,l:null,r:null,t:null}},th={id:"default_slide",title:"defaultSlide",pageSize:{width:300,height:300}},b0=[oo,Nl,ao],y0={[qe.HEADING_1]:{fs:20,bl:1},[qe.HEADING_2]:{fs:18,bl:1},[qe.HEADING_3]:{fs:16,bl:1},[qe.HEADING_4]:{fs:14,bl:1},[qe.HEADING_5]:{fs:12,bl:1},[qe.NORMAL_TEXT]:null,[qe.TITLE]:{fs:26,bl:1},[qe.SUBTITLE]:{fs:15,cl:{rgb:"#999999"}},[qe.NAMED_STYLE_TYPE_UNSPECIFIED]:null},wn=4,A0={[qe.HEADING_1]:{spaceAbove:{v:20},spaceBelow:{v:6+wn}},[qe.HEADING_2]:{spaceAbove:{v:18},spaceBelow:{v:6+wn}},[qe.HEADING_3]:{spaceAbove:{v:16},spaceBelow:{v:6+wn}},[qe.HEADING_4]:{spaceAbove:{v:14},spaceBelow:{v:4+wn}},[qe.HEADING_5]:{spaceAbove:{v:12},spaceBelow:{v:4+wn}},[qe.NORMAL_TEXT]:{spaceAbove:{v:0},spaceBelow:{v:0}},[qe.TITLE]:{spaceAbove:{v:0},spaceBelow:{v:3+wn}},[qe.SUBTITLE]:{spaceAbove:{v:0},spaceBelow:{v:16}},[qe.NAMED_STYLE_TYPE_UNSPECIFIED]:null},T0="univer-sheets-chart-print-chart",N0="univer-docs-drawing-printing";var nh=(e=>(e.ARRAY_CONVERTOR="ARRAY_CONVERTOR",e.MATRIX_CONVERTOR="MATRIX_CONVERTOR",e))(nh||{});const M0={[ht.A3]:{width:1123,height:1587},[ht.A4]:{width:794,height:1124},[ht.A5]:{width:559,height:794},[ht.B4]:{width:944,height:1344},[ht.B5]:{width:665,height:944},[ht.Executive]:{width:696,height:1008},[ht.Folio]:{width:816,height:1248},[ht.Legal]:{width:816,height:1344},[ht.Letter]:{width:816,height:1056},[ht.Statement]:{width:528,height:816},[ht.Tabloid]:{width:1056,height:1632}};function es(e,t){const{textRuns:n=[]}=t;let r=0;for(const i of n){const{ts:o={},st:a,ed:l}=i;if(o[e]==null)return ce.FALSE;switch(e){case"bl":case"it":{if(o[e]===ce.FALSE)return ce.FALSE;break}case"ul":case"st":{if(o[e].s===ce.FALSE)return ce.FALSE;break}default:throw new Error(`unknown style key: ${e} in IStyleBase`)}r+=l-a}return t.dataStream.indexOf(`\r
4
- `)===r?ce.TRUE:ce.FALSE}const wr=class wr{constructor(t,n,r){C(this,"_range");C(this,"_worksheet");this._deps=r,this._range=n,this._worksheet=t}static foreach(t,n){const{startRow:r,startColumn:s,endRow:i,endColumn:o}=t;for(let a=r;a<=i;a++)for(let l=s;l<=o;l++)n(a,l)}getRangeData(){return this._range}getValue(){return this.getValues()[0][0]}getValues(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range,i=[];for(let o=t;o<=n;o++){const a=[];for(let l=r;l<=s;l++)a.push(this.getMatrix().getValue(o,l)||null);i.push(a)}return i}getMatrix(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range,i=this._worksheet.getCellMatrix(),o=new ct;for(let a=t;a<=n;a++)for(let l=r;l<=s;l++)o.setValue(a,l,i.getValue(a,l)||null);return o}getMatrixObject(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range,i=this._worksheet.getCellMatrix(),o=new ct;for(let a=t;a<=n;a++)for(let l=r;l<=s;l++)o.setValue(a-t,l-r,i.getValue(a,l)||{});return o}getA1Notation(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range;let i,o;return r<s?(i=Z.numToWord(r+1)+(t+1),o=Z.numToWord(s+1)+(n+1)):(i=Z.numToWord(s+1)+(n+1),o=Z.numToWord(r+1)+(t+1)),i===o?`${i}`:`${i}:${o}`}getBackground(){return this.getBackgrounds()[0][0]}getBackgrounds(){const t=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>{var i;const s=t.getStyleByCell(r);return((i=s==null?void 0:s.bg)==null?void 0:i.rgb)||it.bg.rgb}))}getCell(t,n){const{startRow:r,startColumn:s}=this._range,i={startRow:r+t,endRow:r+t,startColumn:s+n,endColumn:s+n};return new wr(this._worksheet,i,this._deps)}getColumn(){return this._range.startColumn}getObjectValue(t={}){return this.getObjectValues(t)[0][0]}getObjectValues(t={}){var a;const{startRow:n,endRow:r,startColumn:s,endColumn:i}=this._range,o=this._worksheet.getCellMatrix().getFragment(n,r,s,i).getData();if(t.isIncludeStyle){const l=this._deps.getStyles();for(let c=0;c<=r-n;c++)for(let u=0;u<=i-s;u++){if(o==null||((a=o==null?void 0:o[c])==null?void 0:a[u])==null)continue;const h=o[c][u].s;h&&(o[c][u].s=l.get(h))}}return o}getFontColor(){return this.getFontColors()[0][0]}getFontColors(){const t=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>{var i;const s=t.getStyleByCell(r);return((i=s==null?void 0:s.cl)==null?void 0:i.rgb)||it.cl.rgb}))}getFontFamilies(){return this._getStyles("ff")}getFontFamily(){return this.getFontFamilies()[0][0]}getUnderlines(){return this._getStyles("ul")}getUnderline(){var n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?es("ul",t.body)===ce.TRUE?{s:ce.TRUE}:{s:ce.FALSE}:this.getUnderlines()[0][0]}getOverlines(){return this._getStyles("ol")}getOverline(){return this.getOverlines()[0][0]}getStrikeThrough(){var n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?es("st",t.body)===ce.TRUE?{s:ce.TRUE}:{s:ce.FALSE}:this.getStrikeThroughs()[0][0]}getStrikeThroughs(){return this._getStyles("st")}getFontSize(){var n,r;const t=((n=this.getValue())==null?void 0:n.p)||{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?t.body.textRuns.some(s=>{var i;return((i=s==null?void 0:s.ts)==null?void 0:i.fs)!=null})?Math.max(...t.body.textRuns.map(s=>{var i;return((i=s==null?void 0:s.ts)==null?void 0:i.fs)||0})):this.getFontSizes()[0][0]:this.getFontSizes()[0][0]}getFontSizes(){return this._getStyles("fs")}getBorder(){return this.getBorders()[0][0]}getBorders(){return this._getStyles("bd")}getFontStyle(){var n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?es("it",t.body)===ce.TRUE?Os.ITALIC:Os.NORMAL:this._getFontStyles()[0][0]}_getFontStyles(){return this._getStyles("it")}getFontWeight(){var n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?es("bl",t.body)===ce.TRUE?vs.BOLD:vs.NORMAL:this._getFontWeights()[0][0]}_getFontWeights(){return this._getStyles("bl")}getGridId(){return this._worksheet.getSheetId()}getHeight(){const{_range:t,_worksheet:n}=this,{startRow:r,endRow:s}=t;let i=0;for(let o=0;o<=s-r;o++){const a=n.getRowHeight(o);i+=a}return i}getHorizontalAlignment(){return this.getHorizontalAlignments()[0][0]}getHorizontalAlignments(){return this._getStyles("ht")}getLastColumn(){return this._range.endColumn}getLastRow(){return this._range.endRow}getNumColumns(){const{startColumn:t,endColumn:n}=this._range;return n-t+1}getNumRows(){const{startRow:t,endRow:n}=this._range;return n-t+1}getRichTextValue(){return this.getRichTextValues()[0][0]}getRichTextValues(){return this.getValues().map(t=>t.map(n=>(n==null?void 0:n.p)||""))}getRowIndex(){return this._range.startRow}getSheet(){return this._worksheet}getTextDirection(){return this.getTextDirections()[0][0]}getTextDirections(){return this._getStyles("td")}getTextRotation(){return this.getTextRotations()[0][0]}getTextRotations(){return this._getStyles("tr")}getTextStyle(){return this.getTextStyles()[0][0]}getTextStyles(){const t=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>t.getStyleByCell(r)))}getVerticalAlignment(){return this.getVerticalAlignments()[0][0]}getVerticalAlignments(){return this._getStyles("vt")}getWidth(){const{_range:t,_worksheet:n}=this,{startColumn:r,endColumn:s}=t;let i=0;for(let o=0;o<=s-r;o++)i+=n.getColumnWidth(o);return i}getWrap(){return this.getWrapStrategy()===Rn.WRAP?ce.TRUE:ce.FALSE}getWrapStrategies(){return this._getStyles("tb")}getWrapStrategy(){return this.getWrapStrategies()[0][0]}forEach(t){wr.foreach(this._range,t)}_getStyles(t){const n=this._deps.getStyles();return this.getValues().map(r=>r.map(s=>{const i=n&&n.getStyleByCell(s);return i&&i[t]||it[t]}))}};C(wr,"transformRange",(t,n)=>{const r=n.getMaxColumns()-1,s=n.getMaxRows()-1;return t.rangeType===_e.ALL?{startColumn:0,startRow:0,endColumn:r,endRow:s}:t.rangeType===_e.COLUMN?{startRow:0,endRow:s,startColumn:t.startColumn,endColumn:t.endColumn}:t.rangeType===_e.ROW?{startColumn:0,endColumn:r,startRow:t.startRow,endRow:t.endRow}:{startColumn:t.startColumn,endColumn:Math.min(t.endColumn,r),startRow:t.startRow,endRow:Math.min(t.endRow,s)}});let Vn=wr;function rh(e,t,n=0,r=e.length-1,s=D0){for(;r>n;){if(r-n>600){const l=r-n+1,c=t-n+1,u=Math.log(l),h=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*h*(l-h)/l)*(c-l/2<0?-1:1),f=Math.max(n,Math.floor(t-c*h/l+d)),g=Math.min(r,Math.floor(t+(l-c)*h/l+d));rh(e,t,f,g,s)}const i=e[t];let o=n,a=r;for(rr(e,n,t),s(e[r],i)>0&&rr(e,n,r);o<a;){for(rr(e,o,a),o++,a--;s(e[o],i)<0;)o++;for(;s(e[a],i)>0;)a--}s(e[n],i)===0?rr(e,n,a):(a++,rr(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}}function rr(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function D0(e,t){return e<t?-1:e>t?1:0}class As{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let n=this.data;const r=[];if(!ns(t,n))return r;const s=this.toBBox,i=[];for(;n;){for(let o=0;o<n.children.length;o++){const a=n.children[o],l=n.leaf?s(a):a;ns(t,l)&&(n.leaf?r.push(a):Ri(t,l)?this._all(a,r):i.push(a))}n=i.pop()}return r}collides(t){let n=this.data;if(!ns(t,n))return!1;const r=[];for(;n;){for(let s=0;s<n.children.length;s++){const i=n.children[s],o=n.leaf?this.toBBox(i):i;if(ns(t,o)){if(n.leaf||Ri(t,o))return!0;r.push(i)}}n=r.pop()}return!1}load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(let r=0;r<t.length;r++)this.insert(t[r]);return this}let n=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length)this.data=n;else if(this.data.height===n.height)this._splitRoot(this.data,n);else{if(this.data.height<n.height){const r=this.data;this.data=n,n=r}this._insert(n,this.data.height-n.height-1,!0)}return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=Mn([]),this}remove(t,n){if(!t)return this;let r=this.data;const s=this.toBBox(t),i=[],o=[];let a,l,c;for(;r||i.length;){if(r||(r=i.pop(),l=i[i.length-1],a=o.pop(),c=!0),r.leaf){const u=L0(t,r.children,n);if(u!==-1)return r.children.splice(u,1),i.push(r),this._condense(i),this}!c&&!r.leaf&&Ri(r,s)?(i.push(r),o.push(a),a=0,l=r,r=r.children[0]):l?(a++,r=l.children[a],c=!1):r=null}return this}toBBox(t){return t}compareMinX(t,n){return t.minX-n.minX}compareMinY(t,n){return t.minY-n.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,n){const r=[];for(;t;)t.leaf?n.push(...t.children):r.push(...t.children),t=r.pop();return n}_build(t,n,r,s){const i=r-n+1;let o=this._maxEntries,a;if(i<=o)return a=Mn(t.slice(n,r+1)),bn(a,this.toBBox),a;s||(s=Math.ceil(Math.log(i)/Math.log(o)),o=Math.ceil(i/Math.pow(o,s-1))),a=Mn([]),a.leaf=!1,a.height=s;const l=Math.ceil(i/o),c=l*Math.ceil(Math.sqrt(o));ul(t,n,r,c,this.compareMinX);for(let u=n;u<=r;u+=c){const h=Math.min(u+c-1,r);ul(t,u,h,l,this.compareMinY);for(let d=u;d<=h;d+=l){const f=Math.min(d+l-1,h);a.children.push(this._build(t,d,f,s-1))}}return bn(a,this.toBBox),a}_chooseSubtree(t,n,r,s){for(;s.push(n),!(n.leaf||s.length-1===r);){let i=1/0,o=1/0,a;for(let l=0;l<n.children.length;l++){const c=n.children[l],u=Ci(c),h=P0(t,c)-u;h<o?(o=h,i=u<i?u:i,a=c):h===o&&u<i&&(i=u,a=c)}n=a||n.children[0]}return n}_insert(t,n,r){const s=r?t:this.toBBox(t),i=[],o=this._chooseSubtree(s,this.data,n,i);for(o.children.push(t),pr(o,s);n>=0&&i[n].children.length>this._maxEntries;)this._split(i,n),n--;this._adjustParentBBoxes(s,i,n)}_split(t,n){const r=t[n],s=r.children.length,i=this._minEntries;this._chooseSplitAxis(r,i,s);const o=this._chooseSplitIndex(r,i,s),a=Mn(r.children.splice(o,r.children.length-o));a.height=r.height,a.leaf=r.leaf,bn(r,this.toBBox),bn(a,this.toBBox),n?t[n-1].children.push(a):this._splitRoot(r,a)}_splitRoot(t,n){this.data=Mn([t,n]),this.data.height=t.height+1,this.data.leaf=!1,bn(this.data,this.toBBox)}_chooseSplitIndex(t,n,r){let s,i=1/0,o=1/0;for(let a=n;a<=r-n;a++){const l=_r(t,0,a,this.toBBox),c=_r(t,a,r,this.toBBox),u=k0(l,c),h=Ci(l)+Ci(c);u<i?(i=u,s=a,o=h<o?h:o):u===i&&h<o&&(o=h,s=a)}return s||r-n}_chooseSplitAxis(t,n,r){const s=t.leaf?this.compareMinX:x0,i=t.leaf?this.compareMinY:U0,o=this._allDistMargin(t,n,r,s),a=this._allDistMargin(t,n,r,i);o<a&&t.children.sort(s)}_allDistMargin(t,n,r,s){t.children.sort(s);const i=this.toBBox,o=_r(t,0,n,i),a=_r(t,r-n,r,i);let l=ts(o)+ts(a);for(let c=n;c<r-n;c++){const u=t.children[c];pr(o,t.leaf?i(u):u),l+=ts(o)}for(let c=r-n-1;c>=n;c--){const u=t.children[c];pr(a,t.leaf?i(u):u),l+=ts(a)}return l}_adjustParentBBoxes(t,n,r){for(let s=r;s>=0;s--)pr(n[s],t)}_condense(t){for(let n=t.length-1,r;n>=0;n--)t[n].children.length===0?n>0?(r=t[n-1].children,r.splice(r.indexOf(t[n]),1)):this.clear():bn(t[n],this.toBBox)}}function L0(e,t,n){if(!n)return t.indexOf(e);for(let r=0;r<t.length;r++)if(n(e,t[r]))return r;return-1}function bn(e,t){_r(e,0,e.children.length,t,e)}function _r(e,t,n,r,s){s||(s=Mn(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(let i=t;i<n;i++){const o=e.children[i];pr(s,e.leaf?r(o):o)}return s}function pr(e,t){return e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),e}function x0(e,t){return e.minX-t.minX}function U0(e,t){return e.minY-t.minY}function Ci(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function ts(e){return e.maxX-e.minX+(e.maxY-e.minY)}function P0(e,t){return(Math.max(t.maxX,e.maxX)-Math.min(t.minX,e.minX))*(Math.max(t.maxY,e.maxY)-Math.min(t.minY,e.minY))}function k0(e,t){const n=Math.max(e.minX,t.minX),r=Math.max(e.minY,t.minY),s=Math.min(e.maxX,t.maxX),i=Math.min(e.maxY,t.maxY);return Math.max(0,s-n)*Math.max(0,i-r)}function Ri(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function ns(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function Mn(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function ul(e,t,n,r,s){const i=[t,n];for(;i.length;){if(n=i.pop(),t=i.pop(),n-t<=r)continue;const o=t+Math.ceil((n-t)/r/2)*r;rh(e,o,t,n,s),i.push(t,o,o,n)}}function F0(e,t,n,r=!1){if(t===0&&n===0)return e;let s={...e};const i=s.startAbsoluteRefType||Me.NONE,o=s.endAbsoluteRefType||Me.NONE,a=s.rangeType||_e.NORMAL;if(!r&&i===Me.ALL&&o===Me.ALL)return s;const l=hl(s.startRow,n,s.startColumn,t,a),c=hl(s.endRow,n,s.endColumn,t,a);return r||i===Me.NONE&&o===Me.NONE?s={...s,startRow:l.row,startColumn:l.column,endRow:c.row,endColumn:c.column}:(i===Me.NONE?s={...s,startRow:l.row,startColumn:l.column}:i===Me.COLUMN?s={...s,startRow:l.row}:i===Me.ROW&&(s={...s,startColumn:l.column}),o===Me.NONE?s={...s,endRow:c.row,endColumn:c.column}:o===Me.COLUMN?s={...s,endRow:c.row}:o===Me.ROW&&(s={...s,endColumn:c.column}),s)}function hl(e,t,n,r,s){return s===_e.NORMAL?{row:e+t,column:n+r}:s===_e.ROW?{row:e+t,column:n}:s===_e.COLUMN?{row:e,column:n+r}:{row:e,column:n}}function ra(e){const t=new Set,n=new Set;for(const o of e)t.add(o.startColumn),t.add(o.endColumn+1),n.add(o.startRow),n.add(o.endRow+1);const r=Array.from(t).sort((o,a)=>o-a),s=Array.from(n).sort((o,a)=>o-a);e.sort((o,a)=>o.startRow-a.startRow||o.startColumn-a.startColumn);const i=[];for(let o=0;o<s.length-1;o++)for(let a=0;a<r.length-1;a++){const l=r[a],c=r[a+1]-1,u=s[o],h=s[o+1]-1;for(const d of e){if(d.startRow>h)break;if(d.startRow<=u&&d.endRow>=h&&d.startColumn<=l&&d.endColumn>=c){i.push({startColumn:l,endColumn:c,startRow:u,endRow:h});break}}}return i}function H0(e){e.sort((r,s)=>r.startRow-s.startRow||r.startColumn-s.startColumn);const t={};for(const r of e)t[r.startRow]||(t[r.startRow]=[]),t[r.startRow].push(r);const n=[];for(const r in t){const s=t[+r];s.sort((o,a)=>o.startColumn-a.startColumn);let i=s[0];for(let o=1;o<s.length;o++){const a=s[o];a.startColumn<=i.endColumn+1&&a.startRow===i.startRow&&a.endRow===i.endRow?i.endColumn=Math.max(i.endColumn,a.endColumn):(n.push(i),i=a)}n.push(i)}return n}function B0(e){e.sort((r,s)=>r.startColumn-s.startColumn||r.startRow-s.startRow);const t={};for(const r of e)t[r.startColumn]||(t[r.startColumn]=[]),t[r.startColumn].push(r);const n=[];for(const r in t){const s=t[+r];s.sort((o,a)=>o.startRow-a.startRow);let i=s[0];for(let o=1;o<s.length;o++){const a=s[o];a.startRow<=i.endRow+1&&a.startColumn===i.startColumn&&a.endColumn===i.endColumn?i.endRow=Math.max(i.endRow,a.endRow):(n.push(i),i=a)}n.push(i)}return n}function $0(e){const t=ra(e),n=H0(t);return B0(n)}function j0(e,t){const n=[];return e.forEach(r=>{n.push(...Wt.subtract(r,t))}),Wt.mergeRanges(n)}function sh(e,t){const n=dl(e.startRow,e.endRow,t.startRow,t.endRow),r=dl(e.startColumn,e.endColumn,t.startColumn,t.endColumn);if(!n||!r)return null;const[s,i]=n,[o,a]=r,l=W0(e.rangeType,t.rangeType,s,i,o,a);return{startRow:s,endRow:i,startColumn:o,endColumn:a,rangeType:l}}function dl(e,t,n,r){const s=isNaN(e)?-1/0:e,i=isNaN(t)?1/0:t,o=isNaN(n)?-1/0:n,a=isNaN(r)?1/0:r,l=Math.max(s,o),c=Math.min(i,a);if(l<=c){const u=l===-1/0?Number.NaN:l,h=c===1/0?Number.NaN:c;return[u,h]}else return null}function W0(e,t,n,r,s,i){const o=e!==void 0?e:fl(n,r,s,i),a=t!==void 0?t:fl(n,r,s,i);return o===_e.ALL||a===_e.ALL?o===a?o:o===_e.ALL?a:o:o===a?o:(o===_e.NORMAL||a===_e.NORMAL,_e.NORMAL)}function fl(e,t,n,r){const s=!isNaN(e)&&!isNaN(t),i=!isNaN(n)&&!isNaN(r);return s&&i?_e.NORMAL:s?_e.ROW:i?_e.COLUMN:_e.ALL}const jt=class jt{static clone(t){return t.rangeType!==void 0?{startRow:t.startRow,startColumn:t.startColumn,endRow:t.endRow,endColumn:t.endColumn,rangeType:t.rangeType}:{startRow:t.startRow,startColumn:t.startColumn,endRow:t.endRow,endColumn:t.endColumn}}static equals(t,n){return t==null||n==null?!1:t.endRow===n.endRow&&t.endColumn===n.endColumn&&t.startRow===n.startRow&&t.startColumn===n.startColumn&&(t.rangeType===n.rangeType||t.rangeType===void 0&&n.rangeType===_e.NORMAL||n.rangeType===void 0&&t.rangeType===_e.NORMAL)}static simpleRangesIntersect(t,n){const{startRow:r,endRow:s,startColumn:i,endColumn:o}=t,{startRow:a,endRow:l,startColumn:c,endColumn:u}=n,h=r<=l&&s>=a,d=i<=u&&o>=c;return h&&d}static intersects(t,n){if(t.rangeType===_e.ROW&&n.rangeType===_e.COLUMN||t.rangeType===_e.COLUMN&&n.rangeType===_e.ROW)return!0;if(t.rangeType===_e.ROW&&n.rangeType===_e.ROW)return t.startRow<=n.endRow&&t.endRow>=n.startRow;if(t.rangeType===_e.COLUMN&&n.rangeType===_e.COLUMN)return t.startColumn<=n.endColumn&&t.endColumn>=n.startColumn;const r=Number.isNaN(t.startRow)?0:t.startRow,s=Number.isNaN(t.endRow)?Yi-1:t.endRow,i=Number.isNaN(t.startColumn)?0:t.startColumn,o=Number.isNaN(t.endColumn)?zi-1:t.endColumn,a=Number.isNaN(n.startRow)?0:n.startRow,l=Number.isNaN(n.endRow)?Yi-1:n.endRow,c=Number.isNaN(n.startColumn)?0:n.startColumn,u=Number.isNaN(n.endColumn)?zi-1:n.endColumn,h=Math.abs(i+o-c-u),d=Math.abs(i-o)+Math.abs(c-u),f=Math.abs(r+s-a-l),g=Math.abs(r-s)+Math.abs(a-l);return h<=d&&f<=g}static doAnyRangesIntersect(t,n){const r=new As;return r.load(t.map(s=>({minX:s.startColumn,minY:s.startRow,maxX:s.endColumn,maxY:s.endRow}))),n.some(s=>r.search({minX:s.startColumn,minY:s.startRow,maxX:s.endColumn,maxY:s.endRow}).length>0)}static getIntersects(t,n){const r=t.startRow,s=t.endRow,i=t.startColumn,o=t.endColumn,a=n.startRow,l=n.endRow,c=n.startColumn,u=n.endColumn;let h,d,f,g;if(a<=s)a>=r?d=a:d=r;else return null;if(l>=r)l>=s?g=s:g=l;else return null;if(c<=o)c>i?h=c:h=i;else return null;if(u>=i)u>=o?f=o:f=u;else return null;return{startRow:d,endRow:g,startColumn:h,endColumn:f,rangeType:_e.NORMAL}}static contains(t,n){return t.startRow<=n.startRow&&t.endRow>=n.endRow&&t.startColumn<=n.startColumn&&t.endColumn>=n.endColumn}static realContain(t,n){return jt.contains(t,n)&&(t.startRow<n.startRow||t.endRow>n.endRow||t.startColumn<n.startColumn||t.endColumn>n.endColumn)}static union(...t){return t.reduce((n,r)=>({startRow:Math.min(n.startRow,r.startRow),startColumn:Math.min(n.startColumn,r.startColumn),endRow:Math.max(n.endRow,r.endRow),endColumn:Math.max(n.endColumn,r.endColumn),rangeType:_e.NORMAL}),t[0])}static realUnion(...t){const n=t.some(i=>i.rangeType===_e.COLUMN),r=t.some(i=>i.rangeType===_e.ROW),s=jt.union(...t);return{startColumn:r?Number.NaN:s.startColumn,endColumn:r?Number.NaN:s.endColumn,startRow:n?Number.NaN:s.startRow,endRow:n?Number.NaN:s.endRow,rangeType:r?_e.ROW:n?_e.COLUMN:_e.NORMAL}}static subtract(t,n){if(n.startRow>t.endRow||n.endRow<t.startRow||n.startColumn>t.endColumn||n.endColumn<t.startColumn)return[t];const r=[];n.startRow>=t.startRow&&r.push({startRow:t.startRow,startColumn:t.startColumn,endRow:n.startRow-1,endColumn:t.endColumn}),n.endRow<=t.endRow&&r.push({startRow:n.endRow+1,startColumn:t.startColumn,endRow:t.endRow,endColumn:t.endColumn});const s=Math.max(t.startRow,n.startRow),i=Math.min(t.endRow,n.endRow);return n.startColumn>=t.startColumn&&r.push({startRow:s,startColumn:t.startColumn,endRow:i,endColumn:n.startColumn-1}),n.endColumn<=t.endColumn&&r.push({startRow:s,startColumn:n.endColumn+1,endRow:i,endColumn:t.endColumn}),r.filter(a=>a.startRow<=a.endRow&&a.startColumn<=a.endColumn)}static mergeRanges(t){return $0(t)}static splitIntoGrid(t){return ra(t)}static subtractMulti(t,n){if(!n.length)return t;let r=t;return n.forEach(s=>{r=j0(r,s)}),r}static hasIntersectionBetweenTwoRect(t,n){return!(t.left>n.right||t.right<n.left||t.top>n.bottom||t.bottom<n.top)}static getIntersectionBetweenTwoRect(t,n){const r=Math.max(t.left,n.left),s=Math.min(t.right,n.right),i=Math.max(t.top,n.top),o=Math.min(t.bottom,n.bottom);return s<=r||o<=i?null:{left:r,right:s,top:i,bottom:o,width:s-r,height:o-i}}static sort(t){return t.sort((n,r)=>n.startRow-r.startRow||n.startColumn-r.startColumn)}};C(jt,"getRelativeRange",(t,n)=>({startRow:t.startRow-n.startRow,endRow:t.endRow-t.startRow,startColumn:t.startColumn-n.startColumn,endColumn:t.endColumn-t.startColumn})),C(jt,"getPositionRange",(t,n,r)=>({...r||{},startRow:r&&[Me.ROW,Me.ALL].includes(r.startAbsoluteRefType||0)?r.startRow:t.startRow+n.startRow,endRow:r&&[Me.ROW,Me.ALL].includes(r.endAbsoluteRefType||0)?r.endRow:t.endRow+t.startRow+n.startRow,startColumn:r&&[Me.COLUMN,Me.ALL].includes(r.startAbsoluteRefType||0)?r.startColumn:t.startColumn+n.startColumn,endColumn:r&&[Me.COLUMN,Me.ALL].includes(r.endAbsoluteRefType||0)?r.endColumn:t.endColumn+t.startColumn+n.startColumn})),C(jt,"moveHorizontal",(t,n=0,r=0)=>({...t,startColumn:t.startColumn+n,endColumn:t.endColumn+n+r})),C(jt,"moveVertical",(t,n=0,r=0)=>({...t,startRow:t.startRow+n,endRow:t.endRow+n+r})),C(jt,"moveOffset",(t,n,r)=>{const s={...t};switch(t.startAbsoluteRefType){case Me.ROW:s.startColumn+=n;break;case Me.COLUMN:s.startRow+=r;break;case Me.ALL:break;case Me.NONE:default:s.startRow+=r,s.startColumn+=n;break}switch(t.endAbsoluteRefType){case Me.ROW:s.endColumn+=n;break;case Me.COLUMN:s.endRow+=r;break;case Me.ALL:break;case Me.NONE:default:s.endRow+=r,s.endColumn+=n;break}return s});let Wt=jt;function Y0(e,t){if(e.length===0||e[0].length===0)return null;const n=new Array(e[0].length).fill(0);let r=0,s=null;for(let i=0;i<e.length;i++){for(let a=0;a<e[0].length;a++)n[a]=t(e[i][a])?n[a]+1:0;const o=z0(n);o.area>r&&(r=o.area,s={startColumn:o.start,startRow:i-o.height+1,endColumn:o.end,endRow:i})}return s}function z0(e){const t=[];let n=0,r={area:0,height:0,start:0,end:0},s=0;for(;s<e.length;)if(t.length===0||e[s]>=e[t[t.length-1]])t.push(s++);else{const i=e[t.pop()],o=t.length===0?s:s-t[t.length-1]-1;i*o>n&&(n=i*o,r={area:n,height:i,start:t.length===0?0:t[t.length-1]+1,end:s-1})}for(;t.length>0;){const i=e[t.pop()],o=t.length===0?s:s-t[t.length-1]-1;i*o>n&&(n=i*o,r={area:n,height:i,start:t.length===0?0:t[t.length-1]+1,end:s-1})}return r}function V0(e,t){Vn.foreach(t,(n,r)=>{e[n][r]=void 0})}function K0(e,t){const n=e.toFullArray(),r=[];for(;;){const s=Y0(n,t);if(!s)break;r.push(s),V0(n,s)}return r}class G0{constructor(t,n){C(this,"_values",[]);C(this,"_keys",[]);C(this,"_keyMaps",new Map);this._values=t,this._keys=n,t.forEach(r=>{this._initKeyMap(r)})}_initKeyMap(t){this._keys.forEach(n=>{const r=t[n],s=this._keyMaps.get(n)||new Map;s.set(r,t),this._keyMaps.set(n,s)})}getValue(t,n){const r=n||this._keys;for(let s=0;s<r.length;s++){const i=this._keyMaps.get(r[s]);if(i!=null&&i.has(t))return i.get(t)}return null}hasValue(t){for(let n=0;n<this._keys.length;n++){const r=this._keyMaps.get(this._keys[n]);if(r!=null&&r.has(t))return!0}return!1}addValue(t){this._values.push(t),this._initKeyMap(t)}setValue(t,n,r){const s=this.getValue(t);s&&Object.keys(s).includes(n)&&(s[n]=r)}deleteValue(t,n){const r=this.getValue(t,n);if(r){this._keys.forEach(i=>{const o=this._keyMaps.get(i),a=r[i];o==null||o.delete(a)});const s=this._values.findIndex(i=>i===r);this._values.splice(s,1)}}getValues(){return this._values}getKeyMap(t){var n;return[...((n=this._keyMaps.get(t))==null?void 0:n.keys())||[]]}clear(){this._values=[],this._keys=[],this._keyMaps.clear()}}function Vi(e,t,n,r){return{forEach(s){for(let i=e;i<=t;i++)for(let o=n;o<=r;o++)s(i,o)}}}function X0(e){if(e==null||e.length===0)return Number.NaN;const t=e.toLowerCase().split(""),n=t.length,r=o=>o.charCodeAt(0)-96;let s=0,i=0;for(let o=0;o<n;o++)i=r(t[o]),s+=i*26**(n-o-1);return s===0?Number.NaN:s-1}const Ts=65,ih=90,q0=97;function J0(e){const t=ih-Ts+1;let n="";for(;e>=0;)n=String.fromCharCode(e%t+Ts)+n,e=Math.floor(e/t)-1;return n}function oh(e,t){let n="";for(;t>0;)n+=e,t--;return n}function Z0(e,t=!1){const n=ih-Ts+1;let r=q0;t&&(r=Ts);const s=String.fromCharCode(e%n+r),i=Math.floor(e/n)+1;return oh(s,i)}function Q0(e,t){return e.zIndex>t.zIndex?1:e.zIndex===t.zIndex?0:-1}function eC(e,t){return e.zIndex>t.zIndex?-1:e.zIndex===t.zIndex?0:1}function Br(e="index",t=1){return(n,r)=>n[e]>r[e]?t:n[e]===r[e]?0:-t}function $r(e,t=!1){const n=[];for(const r of e){const{st:s,ed:i,ts:o}=r;if(r.sId===void 0&&delete r.sId,s===i||!t&&Z.isEmptyObject(o)&&r.sId==null)continue;if(n.length===0){n.push(r);continue}const a=n.pop();Ju(r,a)&&Z.hasIntersectionBetweenTwoRanges(a.st,a.ed,r.st,r.ed)?n.push({...r,st:a.st,ed:i}):n.push(a,r)}return n}function ah(e,t,n,r){var c;const{textRuns:s}=e;if(s==null)return;const i=[],o=s.length;let a=!1;const l=(c=t.textRuns)!=null?c:[];if(l.length)for(const u of l)u.st+=r,u.ed+=r;for(let u=0;u<o;u++){const h=s[u],{st:d,ed:f}=h;if(f<=r)i.push(h);else if(r>d&&r<f){a=!0;const g={...h,ed:r};i.push(g),l.length&&i.push(...l);const E={...h,st:r+n,ed:f+n};i.push(E)}else h.st+=n,h.ed+=n,a||(a=!0,i.push(...l)),i.push(h)}a||(a=!0,i.push(...l)),e.textRuns=$r(i)}function lh(e,t,n,r){const{paragraphs:s}=e;if(s==null)return;const{paragraphs:i}=t,o=[];for(let l=0,c=s.length;l<c;l++){const u=s[l],{startIndex:h}=u;h>=r&&(u.startIndex+=n),o.push(u.startIndex)}let a=-1;if(i){for(let l=0,c=i.length;l<c;l++){const u=i[l];u.startIndex+=r;const h=u.startIndex;a=o.indexOf(h)}a!==-1&&s.splice(a,1),s.push(...i),s.sort(Br("startIndex"))}}function ch(e,t,n,r){const{sectionBreaks:s}=e;if(s==null)return;for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:c}=l;c>=r&&(l.startIndex+=n)}const i=t.sectionBreaks;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=r}s.push(...i),s.sort(Br("startIndex"))}}function uh(e,t,n,r){const{customBlocks:s=[]}=e;for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:c}=l;c>=r&&(l.startIndex+=n)}const i=t.customBlocks;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=r}s.push(...i),s.sort(Br("startIndex"))}s.length&&!e.customBlocks&&(e.customBlocks=s)}function hh(e,t,n,r){const{tables:s}=e;if(s==null)return;for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:c,endIndex:u}=l;c>r?(l.startIndex+=n,l.endIndex+=n):u>r&&(l.endIndex+=n)}const i=t.tables;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=r,l.endIndex+=r}s.push(...i),s.sort(Br("startIndex"))}}const dh="$",ml=e=>e.split(dh)[0];function sa(e){if(e.length<=1)return e;e.sort((s,i)=>s.startIndex-i.startIndex);const t=[];let n={...e[0]};n.rangeId=ml(n.rangeId);for(let s=1;s<e.length;s++){const i=e[s];i.rangeId=ml(i.rangeId),i.rangeId===n.rangeId&&kl(n.properties,i.properties)&&n.endIndex+1>=i.startIndex?n.endIndex=i.endIndex:(t.push(n),n={...i})}t.push(n);const r=Object.create(null);for(let s=0,i=t.length;s<i;s++){const o=t[s],a=o.rangeId;r[a]?(o.rangeId=`${a}${dh}${r[a]}`,r[a]=r[a]+1):r[a]=1}return t}function Ki(e,t){const n=e.findIndex(s=>s.startIndex<t&&s.endIndex>=t),r=e[n];r&&e.splice(n,1,{rangeId:r.rangeId,rangeType:r.rangeType,startIndex:r.startIndex,endIndex:t-1,properties:{...r.properties}},{rangeId:r.rangeId,rangeType:r.rangeType,startIndex:t,endIndex:r.endIndex,properties:{...r.properties}})}function fh(e){if(e.length<=1)return e;e.sort((r,s)=>r.startIndex-s.startIndex);const t=[];let n={...e[0]};for(let r=1;r<e.length;r++){const s=e[r];s.id===n.id&&n.endIndex+1>=s.startIndex?n.endIndex=s.endIndex:(t.push(n),n={...s})}return t.push(n),t}function Gi(e,t){e.filter(r=>r.startIndex<t&&r.endIndex>=t).forEach(r=>{const s=e.indexOf(r);e.splice(s,1,{id:r.id,type:r.type,startIndex:r.startIndex,endIndex:t-1},{id:r.id,type:r.type,startIndex:t,endIndex:r.endIndex})})}function tC(e,t,n,r){e.customRanges||(e.customRanges=[]);const{customRanges:s}=e;Ki(s,r);for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:c}=l;c>=r&&(l.startIndex+=n,l.endIndex+=n)}const i=[];if(t.customRanges){for(let o=0,a=t.customRanges.length;o<a;o++){const l=t.customRanges[o];l.startIndex+=r,l.endIndex+=r,i.push(l)}s.push(...i)}e.customRanges=sa(s)}function nC(e,t,n,r){e.customDecorations||(e.customDecorations=[]);const{customDecorations:s}=e;Gi(s,r);for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:c}=l;c>=r&&(l.startIndex+=n,l.endIndex+=n)}const i=[];if(t.customDecorations){for(let o=0,a=t.customDecorations.length;o<a;o++){const l=t.customDecorations[o];l.startIndex+=r,l.endIndex+=r,i.push(l)}s.push(...i)}e.customDecorations=fh(s)}function mh(e,t,n){const{textRuns:r}=e,s=n,i=n+t,o=[];if(r){const a=[];for(let l=0,c=r.length;l<c;l++){const u=r[l],{st:h,ed:d}=u;if(s<=h&&i>=d){o.push({...u,st:h-s,ed:d-s});continue}else h<=s&&d>=i?(o.push({...u,st:s-s,ed:i-s}),u.ed-=t):s>=h&&s<d?(o.push({...u,st:s-s,ed:d-s}),u.ed=s):i>h&&i<=d?(o.push({...u,st:h-s,ed:i-s}),u.st=i-t,u.ed-=t):h>=i&&(u.st-=t,u.ed-=t);a.push(u)}e.textRuns=a}return o.length===0&&o.push({st:0,ed:t,ts:{}}),o}function gh(e,t,n){const{paragraphs:r}=e,s=n,i=n+t,o=[];if(r){const a=[];for(let l=0,c=r.length;l<c;l++){const u=r[l],{startIndex:h}=u;if(h>=s&&h<i){o.push({...u,startIndex:h-n});continue}else h>=i&&(u.startIndex-=t);a.push(u)}e.paragraphs=a}return o}function _h(e,t,n){const{sectionBreaks:r}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,c=r.length;l<c;l++){const u=r[l],{startIndex:h}=u;if(h>=s&&h<=i){o.push({...u,startIndex:h-n});continue}else h>i&&(u.startIndex-=t);a.push(u)}e.sectionBreaks=a}return o}function ph(e,t,n){const{customBlocks:r=[]}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,c=r.length;l<c;l++){const u=r[l],{startIndex:h}=u;if(h>=s&&h<=i){o.push({...u,startIndex:h-n});continue}else h>i&&(u.startIndex-=t);a.push(u)}e.customBlocks=a}return r.length&&!e.customBlocks&&(e.customBlocks=r),o}function Eh(e,t,n){const{tables:r}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,c=r.length;l<c;l++){const u=r[l],{startIndex:h,endIndex:d}=u;if(s<=h&&i>=d){o.push({...u,startIndex:h-n,endIndex:d-n});continue}else if(h<=s&&d>=i){const f=Ks(h,d,s,i);if(f.length===0||(u.startIndex=f[0],u.endIndex=f[1],u.startIndex===u.endIndex))continue}else i<h&&(u.startIndex-=t,u.endIndex-=t);a.push(u)}e.tables=a}return o}function rC(e,t,n){const{customRanges:r}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,c=r.length;l<c;l++){const u=r[l],{startIndex:h,endIndex:d}=u;if(h>=s&&d<=i){o.push(u);continue}else if(Math.max(s,h)<=Math.min(i,d)){const f=Ks(h,d,s,i);if(f.length===0)continue;u.startIndex=f[0],u.endIndex=f[1]}else i<h&&(u.startIndex-=t,u.endIndex-=t);a.push(u)}e.customRanges=sa(a)}return o}function sC(e,t,n,r=!0){const{customDecorations:s}=e,i=n,o=n+t-1,a=[];if(s){const l=[];for(let c=0,u=s.length;c<u;c++){const h=s[c],{startIndex:d,endIndex:f}=h;if(d>=i&&f<=o){a.push(h);continue}else if(Math.max(i,d)<=Math.min(o,f)){const g=Ks(d,f,i,o);if(g.length===0)continue;h.startIndex=g[0],h.endIndex=g[1]}else o<d&&r&&(h.startIndex-=t,h.endIndex-=t);l.push(h)}e.customDecorations=l}return a}var Ch=(e=>(e.ORDER_LIST_QUICK_1="1.",e.ORDER_LIST_QUICK_2="a)",e.ORDER_LIST_QUICK_3="a.",e.ORDER_LIST_QUICK_4="i.",e.ORDER_LIST_QUICK_5="A.",e.ORDER_LIST_QUICK_6="I.",e.ORDER_LIST_QUICK_7="01.",e.BULLET_LIST="*",e))(Ch||{}),Pt=(e=>(e.BULLET_LIST="BULLET_LIST",e.BULLET_LIST_1="BULLET_LIST_1",e.BULLET_LIST_2="BULLET_LIST_2",e.BULLET_LIST_3="BULLET_LIST_3",e.BULLET_LIST_4="BULLET_LIST_4",e.BULLET_LIST_5="BULLET_LIST_5",e.ORDER_LIST="ORDER_LIST",e.ORDER_LIST_1="ORDER_LIST_1",e.ORDER_LIST_2="ORDER_LIST_2",e.ORDER_LIST_3="ORDER_LIST_3",e.ORDER_LIST_4="ORDER_LIST_4",e.ORDER_LIST_5="ORDER_LIST_5",e.ORDER_LIST_QUICK_2="ORDER_LIST_QUICK_2",e.ORDER_LIST_QUICK_3="ORDER_LIST_QUICK_3",e.ORDER_LIST_QUICK_4="ORDER_LIST_QUICK_4",e.ORDER_LIST_QUICK_5="ORDER_LIST_QUICK_5",e.ORDER_LIST_QUICK_6="ORDER_LIST_QUICK_6",e.CHECK_LIST="CHECK_LIST",e.CHECK_LIST_CHECKED="CHECK_LIST_CHECKED",e))(Pt||{});const rs={"a)":{glyphFormat:"%1)",glyphType:fe.DECIMAL},"1.":{glyphType:fe.DECIMAL},"a.":{glyphFormat:"%1.",glyphType:fe.LOWER_LETTER},"A.":{glyphType:fe.UPPER_LETTER},"i.":{glyphFormat:"%1.",glyphType:fe.LOWER_ROMAN},"I.":{glyphFormat:"%1.",glyphType:fe.UPPER_LETTER}},yn=e=>[...e,...e,...e].map((t,n)=>({glyphFormat:` %${n+1}`,glyphSymbol:t,bulletAlignment:Pr.START,textStyle:{fs:12},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*n}}})),An=e=>e.map((t,n)=>({...t,bulletAlignment:Pr.START,textStyle:{fs:12},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*n}}})),gl=(e,t)=>new Array(9).fill(0).map((n,r)=>({glyphFormat:` %${r+1}`,glyphSymbol:e,bulletAlignment:Pr.START,textStyle:{fs:16},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*r},textStyle:t}})),jr={BULLET_LIST:{listType:"BULLET_LIST",nestingLevel:yn(["●","○","■"])},BULLET_LIST_1:{listType:"BULLET_LIST",nestingLevel:yn(["❖","➢","■"])},BULLET_LIST_2:{listType:"BULLET_LIST",nestingLevel:yn(["✔","●","◆"])},BULLET_LIST_3:{listType:"BULLET_LIST",nestingLevel:yn(["■","◆","○"])},BULLET_LIST_4:{listType:"BULLET_LIST",nestingLevel:yn(["✧","○","■"])},BULLET_LIST_5:{listType:"BULLET_LIST",nestingLevel:yn(["➢","○","◆"])},ORDER_LIST:{listType:"ORDER_LIST",nestingLevel:An([{glyphFormat:"%1.",glyphType:fe.DECIMAL},{glyphFormat:"%2.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%3.",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:fe.DECIMAL},{glyphFormat:"%5.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%6.",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:fe.DECIMAL},{glyphFormat:"%8.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%9.",glyphType:fe.LOWER_ROMAN}])},ORDER_LIST_1:{listType:"ORDER_LIST",nestingLevel:An([{glyphFormat:"%1)",glyphType:fe.DECIMAL},{glyphFormat:"%2)",glyphType:fe.LOWER_LETTER},{glyphFormat:"%3)",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%4)",glyphType:fe.DECIMAL},{glyphFormat:"%5)",glyphType:fe.LOWER_LETTER},{glyphFormat:"%6)",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%7)",glyphType:fe.DECIMAL},{glyphFormat:"%8)",glyphType:fe.LOWER_LETTER},{glyphFormat:"%9)",glyphType:fe.LOWER_ROMAN}])},ORDER_LIST_2:{listType:"ORDER_LIST",nestingLevel:An(["%1.","%1.%2.","%1.%2.%3.","%1.%2.%3.%4.","%1.%2.%3.%4.%5.","%1.%2.%3.%4.%5.%6.","%1.%2.%3.%4.%5.%6.%7."].map(e=>({glyphFormat:e,glyphType:fe.DECIMAL})))},ORDER_LIST_3:{listType:"ORDER_LIST",nestingLevel:An([{glyphFormat:"%1.",glyphType:fe.UPPER_LETTER},{glyphFormat:"%2.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%3.",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:fe.UPPER_LETTER},{glyphFormat:"%5.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%6.",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:fe.UPPER_LETTER},{glyphFormat:"%8.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%9.",glyphType:fe.LOWER_ROMAN}])},ORDER_LIST_4:{listType:"ORDER_LIST",nestingLevel:An([{glyphFormat:"%1.",glyphType:fe.UPPER_LETTER},{glyphFormat:"%2.",glyphType:fe.DECIMAL},{glyphFormat:"%3.",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:fe.UPPER_LETTER},{glyphFormat:"%5.",glyphType:fe.DECIMAL},{glyphFormat:"%6.",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:fe.UPPER_LETTER},{glyphFormat:"%8.",glyphType:fe.DECIMAL},{glyphFormat:"%9.",glyphType:fe.LOWER_ROMAN}])},ORDER_LIST_5:{listType:"ORDER_LIST",nestingLevel:An([{glyphFormat:"%1.",glyphType:fe.DECIMAL_ZERO},{glyphFormat:"%2.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%3.",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:fe.DECIMAL_ZERO},{glyphFormat:"%5.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%6.",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:fe.DECIMAL_ZERO},{glyphFormat:"%8.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%9.",glyphType:fe.LOWER_ROMAN}])},CHECK_LIST:{listType:"CHECK_LIST",nestingLevel:gl("☐")},CHECK_LIST_CHECKED:{listType:"CHECK_LIST_CHECKED",nestingLevel:gl("☑",{st:{s:ce.TRUE}})}},ss=e=>{const{glyphFormat:t,glyphType:n}=e,r=Z.deepClone(jr.ORDER_LIST);return r.nestingLevel[0].glyphFormat=t,r.nestingLevel[0].glyphType=n,r},iC={ORDER_LIST_QUICK_2:ss(rs["a)"]),ORDER_LIST_QUICK_3:ss(rs["a."]),ORDER_LIST_QUICK_4:ss(rs["i."]),ORDER_LIST_QUICK_6:ss(rs["I."])};Object.assign(jr,iC);const oC={"1.":"ORDER_LIST","a)":"ORDER_LIST_QUICK_2","a.":"ORDER_LIST_QUICK_3","i.":"ORDER_LIST_QUICK_4","A.":"ORDER_LIST_3","I.":"ORDER_LIST_QUICK_6","01.":"ORDER_LIST_5","*":"BULLET_LIST"};function aC(e,t,n,r,s){const i=lC(e,t,n,r,s),o=cC(e,t,n,r,s),a=uC(e,t,n,r,s),l=hC(e,t,n,r,s),c=dC(e,t,n,r,s),u=fC(e,t,n,r),h=mC(e,t,n,r,s);return{dataStream:"",textRuns:i,paragraphs:o,sectionBreaks:a,customBlocks:l,tables:c,customRanges:u,customDecorations:h}}function lC(e,t,n,r,s){const{textRuns:i}=e,{textRuns:o}=t;if(i==null||o==null)return;const a=mh(e,n,r);if(s!==Ee.REPLACE){const l=Rh(o,a,s);t.textRuns=l}return ah(e,t,n,r),a}function Rh(e,t,n){if(t.length===0)return e;e=Z.deepClone(e),t=Z.deepClone(t);const r=[],s=e.length,i=t.length;let o=0,a=0,l=null;function c(){return l?(r.push(l),l=null,!0):!1}for(;o<s&&a<i;){const{st:f,ed:g,ts:E}=e[o],{st:R,ed:b,ts:F,sId:k}=t[a];let W;if(n===Ee.COVER?W={...F,...E}:W={...E},g<R)c()||r.push(e[o]),o++;else if(b<f)c()||r.push(t[a]),a++;else{const S={st:Math.min(f,R),ed:Math.max(f,R),ts:f<R?{...E}:{...F},sId:f<R?void 0:k};S.ed>S.st&&r.push(S),r.push({st:Math.max(f,R),ed:Math.min(g,b),ts:W,sId:k}),g<b?(o++,t[a].st=g,t[a].st===t[a].ed&&a++):(a++,e[o].st=b,e[o].st===e[o].ed&&o++);const p={st:Math.min(g,b),ed:Math.max(g,b),ts:g<b?{...F}:{...E},sId:g<b?k:void 0};l=p.ed>p.st?p:null}}c();const u=r[r.length-1],h=e[s-1],d=t[i-1];return u&&u.ed!==Math.max(h.ed,d.ed)&&(h.ed>d.ed?r.push(h):r.push(d)),$r(r)}function cC(e,t,n,r,s){const{paragraphs:i}=e,{paragraphs:o}=t;if(i==null||o==null)return;const a=gh(e,n,r);if(s!==Ee.REPLACE){const l=[];for(const c of o){const{startIndex:u,paragraphStyle:h,bullet:d}=c;let f=[];for(const g of a){const{startIndex:E,paragraphStyle:R,bullet:b}=g;let F,k;if(s===Ee.COVER?(F={...R,...h},k={listId:"",listType:Pt.BULLET_LIST,nestingLevel:0,textStyle:{},...b,...d}):(F={...h,...R},k={listId:"",listType:Pt.BULLET_LIST,nestingLevel:0,textStyle:{},...d,...b}),u===E){f.push({startIndex:u,paragraphStyle:F,bullet:k});break}}l.push(...f),f=[]}t.paragraphs=l}return lh(e,t,n,r),a}function uC(e,t,n,r,s){const{sectionBreaks:i}=e,{sectionBreaks:o}=t;if(i==null||o==null)return;const a=_h(e,n,r);if(s!==Ee.REPLACE){const l=[];for(const c of o){const{startIndex:u}=c;let h=[];for(const d of a){const{startIndex:f}=d;if(u===f){s===Ee.COVER?h.push({...d,...c}):h.push({...c,...d});break}}l.push(...h),h=[]}t.sectionBreaks=l}return ch(e,t,n,r),a}function hC(e,t,n,r,s){const{customBlocks:i=[]}=e,{customBlocks:o}=t;if(i==null||o==null)return;const a=ph(e,n,r);if(s!==Ee.REPLACE){const l=[];for(const c of o){const{startIndex:u}=c;let h=[];for(const d of a){const{startIndex:f}=d;if(u===f){s===Ee.COVER?h.push({...d,...c}):h.push({...c,...d});break}}l.push(...h),h=[]}t.customBlocks=l}return uh(e,t,n,r),i.length&&!e.customBlocks&&(e.customBlocks=i),a}function dC(e,t,n,r,s){const{tables:i}=e,{tables:o}=t;if(i==null||o==null)return;const a=Eh(e,n,r);if(s!==Ee.REPLACE){const l=[];for(const c of o){const{startIndex:u,endIndex:h}=c;let d=[];for(const f of a){const{startIndex:g,endIndex:E}=f;if(g>=u&&E<=h){s===Ee.COVER?d.push({...f,...c}):d.push({...c,...f});break}}l.push(...d),d=[]}t.tables=l}return hh(e,t,n,r),a}function fC(e,t,n,r,s){e.customRanges||(e.customRanges=[]),Ki(e.customRanges,r),Ki(e.customRanges,r+n);const i=r,o=r+n-1,{customRanges:a}=t,l=[],c=new Map;e.customRanges.forEach(h=>{const{startIndex:d,endIndex:f}=h;d>=i&&f<=o?c.set(h.rangeId,h):l.push(h)});const u=[];return a?(a.forEach(h=>{const{startIndex:d,endIndex:f}=h;l.push({...h,startIndex:d+r,endIndex:f+r})}),e.customRanges=sa(l),u):[]}function mC(e,t,n,r,s){e.customDecorations||(e.customDecorations=[]),Gi(e.customDecorations,r),Gi(e.customDecorations,r+n);const i=[],{customDecorations:o}=e,{customDecorations:a=[]}=t;if(s===Ee.REPLACE){for(let l=0;l<o.length;l++){const c=o[l],{startIndex:u,endIndex:h}=c;u>=r&&h<=r+n-1&&i.push(c)}a.forEach(l=>{const{startIndex:c,endIndex:u}=l;o.push({...l,startIndex:c+r,endIndex:u+r})})}else for(const l of a){const{id:c}=l;if(l.type===_n.DELETED){const u=o.filter(h=>h.id===c);u.length&&i.push(...u)}else o.push({...l,startIndex:l.startIndex+r,endIndex:l.endIndex+r})}for(const l of i){const{id:c}=l,u=o.findIndex(h=>h.id===c);u!==-1&&o.splice(u,1)}return e.customDecorations=fh(o),i}var ia=(e=>(e[e.copy=0]="copy",e[e.cut=1]="cut",e))(ia||{});function Ns(e,t,n,r=!0){const{textRuns:s}=e;if(s){const i=[];for(const o of s){const a=Z.deepClone(o),{st:l,ed:c}=a;Z.hasIntersectionBetweenTwoRanges(l,c,t,n)&&(t>=l&&t<=c?i.push({...a,st:t,ed:Math.min(n,c)}):n>=l&&n<=c?i.push({...a,st:Math.max(t,l),ed:n}):i.push(a))}return $r(i.map(o=>{const{st:a,ed:l}=o;return{...o,st:a-t,ed:l-t}}))}else if(r)return[{st:0,ed:n-t,ts:{}}]}function Ih(e,t,n){const{tables:r=[]}=e,s=[];for(const i of r){const o=Z.deepClone(i),{startIndex:a,endIndex:l}=o;a>=t&&l<=n&&s.push({...o,startIndex:a-t,endIndex:l-t})}return s}function Sh(e,t,n){const{paragraphs:r=[]}=e,s=[];for(const i of r){const{startIndex:o}=i;if(o>=t&&o<n){const a=Z.deepClone(i);s.push(a)}}if(s.length)return s.map(i=>({...i,startIndex:i.startIndex-t}))}function gC(e,t,n){const{sectionBreaks:r=[]}=e,s=[];for(const i of r){const{startIndex:o}=i;o>=t&&o<=n&&s.push(Z.deepClone(i))}if(s.length)return s.map(i=>({...i,startIndex:i.startIndex-t}))}function Oh(e,t,n){const{customBlocks:r=[]}=e,s=[];for(const i of r){const{startIndex:o}=i;o>=t&&o<n&&s.push(Z.deepClone(i))}if(s.length)return s.map(i=>({...i,startIndex:i.startIndex-t}))}function Tt(e,t,n,r=!0,s=1){const{dataStream:i}=e,o={dataStream:i.slice(t,n)};o.textRuns=Ns(e,t,n,r);const a=Ih(e,t,n);if(a.length&&(o.tables=a),o.paragraphs=Sh(e,t,n),s===1){const c=wh(e,t,n);c?o.customDecorations=c:r&&(o.customDecorations=[])}const{customRanges:l}=vh(e,t,n);return l?o.customRanges=l:r&&(o.customRanges=[]),o.customBlocks=Oh(e,t,n),o}function _C(e){const{dataStream:t,textRuns:n,paragraphs:r,customRanges:s,customDecorations:i,tables:o}=e;let a=0,l=0;s==null||s.forEach(u=>{u.startIndex<0&&(a=Math.max(a,-u.startIndex)),u.endIndex>t.length-1&&(l=Math.max(l,u.endIndex-t.length+1))});const c=`${t}`;return n&&(n[0]&&(n[0].st=n[0].st-a),n[n.length-1]&&(n[n.length-1].ed=n[n.length-1].ed+l)),n==null||n.forEach(u=>{u.st+=a,u.ed+=a}),r==null||r.forEach(u=>{u.startIndex+=a}),s==null||s.forEach(u=>{u.startIndex+=a,u.endIndex+=a}),i==null||i.forEach(u=>{u.startIndex+=a,u.endIndex+=l}),o==null||o.forEach(u=>{u.startIndex+=a,u.endIndex+=l}),{...e,dataStream:c,textRuns:n,paragraphs:r,customRanges:s,customDecorations:i,tables:o}}function vh(e,t,n){if(e.customRanges==null)return{};const{customRanges:r}=e;return{customRanges:r.filter(a=>Math.max(a.startIndex,t)<=Math.min(a.endIndex,n-1)).map(a=>({...a,startIndex:Math.max(a.startIndex,t),endIndex:Math.min(a.endIndex,n-1)})).map(a=>({...a,startIndex:a.startIndex-t,endIndex:a.endIndex-t})),leftOffset:0,rightOffset:0}}function wh(e,t,n){if(e.customDecorations==null)return;const{customDecorations:r=[]}=e,s=[];return r.forEach(i=>{if(Math.max(i.startIndex,t)<=Math.min(i.endIndex,n-1)){const o=Z.deepClone(i);s.push({...o,startIndex:Math.max(o.startIndex-t,0),endIndex:Math.min(o.endIndex,n-1)-t})}}),s}function pC(e,t,n){return e==null||t==null?e!=null?e:t:Rh(e,t,n)}function EC(e,t,n){if(e==null||t==null)return e!=null?e:t;if(t.length===0||e.length===0)return e;if(t.length>1||e.length>1)throw new Error("Cannot cover multiple customRanges");return n===Ee.REPLACE?[{...e[0]}]:[{...t[0],...e[0]}]}function CC(e,t,n){return t.length===0||e.length===0||n===Ee.REPLACE?e:[...e,...t.filter(r=>!e.some(s=>r.id===s.id))]}function Xi(e,t,n=Ee.COVER){if(t.dataStream!=="")throw new Error("Cannot compose other body with non-empty dataStream");const r={dataStream:e.dataStream},{textRuns:s,paragraphs:i=[],customRanges:o,customDecorations:a=[]}=e,{textRuns:l,paragraphs:c=[],customRanges:u,customDecorations:h=[]}=t;r.textRuns=pC(l,s,n),r.customRanges=EC(u,o,n);const d=CC(h,a,n);d.length&&(r.customDecorations=d);const f=[];let g=0,E=0;for(;g<i.length&&E<c.length;){const R=i[g],b=c[E],{startIndex:F}=R,{startIndex:k}=b;F===k?(f.push(Z.deepMerge(R,b)),g++,E++):F<k?(f.push(Z.deepClone(R)),g++):(f.push(Z.deepClone(b)),E++)}return g<i.length&&f.push(...i.slice(g)),E<c.length&&f.push(...c.slice(E)),f.length&&(r.paragraphs=f),r}function RC(e){const{body:t}=e;if(t==null)return!0;const{textRuns:n,paragraphs:r,customRanges:s,customBlocks:i,customDecorations:o,tables:a}=t;return n==null&&r==null&&s==null&&i==null&&o==null&&a==null}class Dn{constructor(t){C(this,"_index",0);C(this,"_offset",0);this._actions=t}hasNext(){return this.peekLength()<Number.POSITIVE_INFINITY}next(t){t||(t=Number.POSITIVE_INFINITY);const n=this._actions[this._index];if(n){const r=this._offset,s=n.len;return t>=s-r?(t=s-r,this._index+=1,this._offset=0):this._offset+=t,n.t===q.DELETE||n.t===q.RETAIN&&n.body==null?Z.deepClone({...n,len:t}):Z.deepClone({...n,len:t,body:Tt(n.body,r,r+t,!1)})}else return{t:q.RETAIN,len:Number.POSITIVE_INFINITY}}peek(){return this._actions[this._index]}peekLength(){return this._actions[this._index]?this._actions[this._index].len-this._offset:Number.POSITIVE_INFINITY}peekType(){const t=this._actions[this._index];return t?t.t:q.RETAIN}rest(){if(this.hasNext()){if(this._offset===0)return this._actions.slice(this._index);{const t=this._offset,n=this._index,r=this.next(),s=this._actions.slice(this._index);return this._offset=t,this._index=n,[r].concat(s)}}else return[]}}function bh(e,t,n){const{dataStream:r}=e,s=n,i=n+t,o=mh(e,t,n),a=gh(e,t,n),l=_h(e,t,n),c=ph(e,t,n),u=Eh(e,t,n),h=rC(e,t,n),d=sC(e,t,n);let f="";return r&&(e.dataStream=eh(r,s,i),f=r.slice(s,i)),{dataStream:f,textRuns:o,paragraphs:a,sectionBreaks:l,customBlocks:c,tables:u,customRanges:h,customDecorations:d}}function yh(e,t,n,r){e.dataStream=Qu(e.dataStream,r,t.dataStream),ah(e,t,n,r),lh(e,t,n,r),ch(e,t,n,r),uh(e,t,n,r),hh(e,t,n,r),tC(e,t,n,r),nC(e,t,n,r)}function IC(e,t,n,r,s=Ee.COVER){return aC(e,t,n,r,s)}function SC(e,t,n){return t<=0?{dataStream:""}:bh(e,t,n)}function OC(e,t,n,r){n!==0&&yh(e,t,n,r)}function vC(e,t){const n=new Sn;return n.reset(),t.forEach(r=>{const s=Z.deepClone(r);switch(s.t){case q.RETAIN:{const{coverType:i,body:o,len:a}=s;o!=null&&IC(e,o,a,n.cursor,i),n.moveCursor(a);break}case q.INSERT:{const{body:i,len:o}=s;OC(e,i,o,n.cursor),n.moveCursor(o);break}case q.DELETE:{const{len:i}=s;SC(e,i,n.cursor);break}default:throw new Error(`Unknown action type for action: ${s}.`)}}),e}function wC(e,t,n,r,s){if(e==null||t==null)return t;if(e.length===0||t.length===0)return[];t=Z.deepClone(t),e=Z.deepClone(e);const i=[],o=t.length,a=e.length;let l=0,c=0,u=null;function h(){return u?(i.push(u),u=null,!0):!1}for(;l<o&&c<a;){const{st:E,ed:R,ts:b}=t[l],{st:F,ed:k,ts:W,sId:S}=e[c];let p={};if(s===0)p={...b},n===Ee.COVER&&r===Ee.REPLACE&&W&&(p=Object.assign({},W,p));else if(p={...b},n===Ee.REPLACE){if(r===Ee.REPLACE)p={...W};else if(b&&W){const w=Object.keys(b);for(const A of w)W[A]&&delete p[A]}}else if(r===Ee.REPLACE){if(W){const w=Object.keys(W);for(const A of w)W[A]!==void 0&&(p[A]=W[A])}}else if(W){const w=Object.keys(W);for(const A of w)p[A]!==void 0&&delete p[A]}if(R<F)h()||i.push(t[l]),l++;else if(k<E)h()||i.push(e[c]),c++;else{const w={st:Math.min(E,F),ed:Math.max(E,F),ts:E<F?{...b}:{...W}};w.ed>w.st&&i.push(),i.push({st:Math.max(E,F),ed:Math.min(R,k),ts:p,sId:S}),R<k?(l++,e[c].st=R,e[c].st===e[c].ed&&c++):(c++,t[l].st=k,t[l].st===t[l].ed&&l++);const A={st:Math.min(R,k),ed:Math.max(R,k),ts:R<k?{...W}:{...b},sId:R<k?S:void 0};u=A.ed>A.st?A:null}}h();const d=i[i.length-1],f=t[o-1],g=e[a-1];return d.ed!==Math.max(f.ed,g.ed)&&(f.ed>g.ed?i.push(f):i.push(g)),$r(i,!0)}function bC(e,t,n,r,s){if(e==null||t==null)return t;if(e.length===0||t.length===0)return[];if(e.length>1||t.length>1)throw new Error("CustomRanges is only supported transform for length one now.");const i=e[0],o=t[0];if(n===Ee.REPLACE)return s===1?[Z.deepClone(i)]:[Z.deepClone(o)];if(r===Ee.REPLACE){const a=Z.deepClone(o);return s===1&&Object.assign(a,Z.deepClone(i)),[a]}else{const a=Z.deepClone(o);return s===1&&Object.assign(a,Z.deepClone(i)),[a]}}function _l(e,t,n,r,s){const i={startIndex:t.startIndex};if(t.paragraphStyle&&(i.paragraphStyle=Z.deepClone(t.paragraphStyle),e.paragraphStyle)){if(n===Ee.REPLACE)if(r===Ee.REPLACE)s===1&&(i.paragraphStyle={...e.paragraphStyle});else if(s===1){const o=Object.keys(e.paragraphStyle);for(const a of o)e.paragraphStyle[a]!==void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else{const o=Object.keys(e.paragraphStyle);for(const a of o)i.paragraphStyle[a]===void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else if(r===Ee.REPLACE)if(s===1){const o=Object.keys(e.paragraphStyle);for(const a of o)e.paragraphStyle[a]!==void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else{const o=Object.keys(e.paragraphStyle);for(const a of o)i.paragraphStyle[a]===void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else if(s===1){const o=Object.keys(e.paragraphStyle);for(const a of o)i.paragraphStyle[a]&&delete i.paragraphStyle[a]}}return n===Ee.REPLACE&&r===Ee.REPLACE?i.bullet=s===1?Z.deepClone(e.bullet):Z.deepClone(t.bullet):e.bullet===void 0?i.bullet=Z.deepClone(t.bullet):n===Ee.REPLACE||r===Ee.REPLACE?i.bullet=s===0&&t.bullet?Z.deepClone(t.bullet):Z.deepClone(e.bullet):s===0&&t.bullet!==void 0&&(i.bullet=Z.deepClone(t.bullet)),i}function yC(e,t){if(e==null||t==null)return t;if(e.length===0||t.length===0)return Z.deepClone(t);const n=[];for(const r of t){const{id:s,type:i}=r;let o=!1;for(const a of e)if(a.id===s){(a.type===_n.DELETED||i===_n.DELETED)&&(o=!0,n.push({...r,type:_n.DELETED}));break}o||n.push(r)}return n}function AC(e,t,n=!1){const{body:r,coverType:s=Ee.COVER}=e,{body:i,coverType:o=Ee.COVER}=t;if(r==null||r.dataStream!==""||i==null||i.dataStream!=="")throw new Error("Data stream is not supported in retain transform.");const a={dataStream:""},l=o,{textRuns:c,paragraphs:u=[],customRanges:h,customDecorations:d}=r,{textRuns:f,paragraphs:g=[],customRanges:E,customDecorations:R}=i,b=wC(c,f,s,o,n?1:0);b&&(a.textRuns=b);const F=bC(h,E,s,o,n?1:0);F&&(a.customRanges=F);const k=yC(d,R);k&&(a.customDecorations=k);const W=[];let S=0,p=0;for(;S<u.length&&p<g.length;){const w=u[S],A=g[p],{startIndex:H}=w,{startIndex:B}=A;if(H===B){let m={startIndex:H};n?m=_l(w,A,s,o,1):m=_l(w,A,s,o,0),W.push(m),S++,p++}else H<B?S++:(W.push(Z.deepClone(A)),p++)}return p<g.length&&W.push(...g.slice(p)),W.length&&(a.paragraphs=W),{coverType:l,body:a}}function pl(e){return Object.keys(e).length===1}const Bn=class Bn{constructor(){C(this,"_actions",[])}static apply(t,n){return vC(t,n)}static compose(t,n){const r=new Dn(t),s=new Dn(n),i=new Bn;for(;r.hasNext()||s.hasNext();)if(s.peekType()===q.INSERT)i.push(s.next());else if(r.peekType()===q.DELETE)i.push(r.next());else{const o=Math.min(r.peekLength(),s.peekLength()),a=r.next(o),l=s.next(o);if(a.t===q.INSERT&&l.t===q.RETAIN)l.body==null?i.push(a):i.push({...a,body:Xi(a.body,l.body,l.coverType)});else if(a.t===q.RETAIN&&l.t===q.RETAIN)if(a.body==null&&l.body==null)i.push(a.len!==Number.POSITIVE_INFINITY?a:l);else if(a.body&&l.body){const c=a.coverType===Ee.REPLACE||l.coverType===Ee.REPLACE?Ee.REPLACE:Ee.COVER;i.push({...a,t:q.RETAIN,coverType:c,body:Xi(a.body,l.body,l.coverType)})}else i.push(a.body?a:l);else a.t===q.RETAIN&&l.t===q.DELETE?i.push(l):a.t===q.INSERT&&(l.t,q.DELETE)}return i.trimEndUselessRetainAction(),i.serialize()}static transform(t,n,r="right"){return this._transform(n,t,r==="left"?"right":"left")}static _transform(t,n,r="right"){const s=new Dn(t),i=new Dn(n),o=new Bn;for(;s.hasNext()||i.hasNext();)if(s.peekType()===q.INSERT&&(r==="left"||i.peekType()!==q.INSERT)){const a=s.next();o.retain(a.len)}else if(i.peekType()===q.INSERT)o.push(i.next());else{const a=Math.min(s.peekLength(),i.peekLength()),l=s.next(a),c=i.next(a);if(l.t===q.DELETE)continue;if(c.t===q.DELETE){o.push(c);continue}if(l.body==null||c.body==null)o.push(c);else{const{coverType:u,body:h}=AC(l,c,r==="left");o.push({...c,t:q.RETAIN,coverType:u,body:h})}}return o.trimEndUselessRetainAction(),o.serialize()}static transformPosition(t,n,r=!1){const s=new Dn(t);let i=0;for(;s.hasNext()&&i<=n;){const o=s.peekLength(),a=s.peekType();if(s.next(),a===q.DELETE){n-=Math.min(o,n-i);continue}else a===q.INSERT&&(i<n||!r)&&(n+=o);i+=o}return n}static isNoop(t){return t.length===0}static invert(t){const n=[];for(const r of t)if(r.t===q.INSERT)n.push({t:q.DELETE,len:r.len,body:r.body});else if(r.t===q.DELETE){if(r.body==null)throw new Error("Can not invert DELETE action without body property, makeInvertible must be called first.");n.push({t:q.INSERT,body:r.body,len:r.len})}else if(r.body!=null){if(r.oldBody==null)throw new Error("Can not invert RETAIN action without oldBody property, makeInvertible must be called first.");n.push({t:q.RETAIN,body:r.oldBody,oldBody:r.body,len:r.len,coverType:Ee.REPLACE})}else n.push(r);return n}static makeInvertible(t,n){const r=[];let s=0;for(const i of t){if(i.t===q.DELETE&&(i.body==null||i.body&&i.body.dataStream.length!==i.len)){const o=Tt(n,s,s+i.len,!1);i.len=o.dataStream.length,i.body=o}if(i.t===q.RETAIN&&i.body!=null){const o=Tt(n,s,s+i.len,!0);i.oldBody={...o,dataStream:""},i.len=o.dataStream.length}r.push(i),i.t!==q.INSERT&&(s+=i.len)}return r}insert(t,n){const r={t:q.INSERT,body:n,len:t};return this.push(r),this}retain(t,n,r){const s={t:q.RETAIN,len:t};return n!=null&&(s.body=n),r!=null&&(s.coverType=r),this.push(s),this}delete(t){const n={t:q.DELETE,len:t};return this.push(n),this}empty(){return this._actions=[],this}serialize(){return this._actions}push(...t){if(t.length>1){for(const i of t)this.push(i);return this}let n=this._actions.length,r=this._actions[n-1];const s=Z.deepClone(t[0]);if(s.t===q.RETAIN&&s.len===0&&s.body==null)return this;if(typeof r=="object"){if(r.t===q.DELETE&&s.t===q.DELETE)return r.len+=s.len,this;if(r.t===q.DELETE&&s.t===q.INSERT&&(n-=1,r=this._actions[n-1],r==null))return this._actions.unshift(s),this;if(r.t===q.RETAIN&&s.t===q.RETAIN&&r.body==null&&s.body==null)return r.len+=s.len,this;if(r.t===q.INSERT&&pl(r.body)&&s.t===q.INSERT&&pl(s.body))return r.len+=s.len,r.body.dataStream+=s.body.dataStream,this}return n===this._actions.length?this._actions.push(s):this._actions.splice(n,0,s),this}trimEndUselessRetainAction(){let t=this._actions[this._actions.length-1];for(;t&&t.t===q.RETAIN&&RC(t);)this._actions.pop(),t=this._actions[this._actions.length-1];return this}};C(Bn,"id","text-x"),C(Bn,"uri","https://github.com/dream-num/univer#text-x");let De=Bn;Object.defineProperty(De,"name",{value:"text-x"});const $n=class $n{static registerSubtype(t){var n;t==null||this._subTypes.has(t.name)&&((n=this._subTypes.get(t.name))==null?void 0:n.id)!==De.id||(this._subTypes.set(t.name,t),at.type.registerSubtype(t))}static apply(t,n){if(!at.type.isNoop(n))return at.type.apply(t,n)}static compose(t,n){return at.type.compose(t,n)}static transform(t,n,r){return at.type.transform(t,n,r)}static transformPosition(t,n,r="right"){return t&&t.length===2&&t[0]==="body"&&t[1].et===De.name?De.transformPosition(t[1].e,n,r==="left"):n}static invertWithDoc(t,n){return at.type.invertWithDoc(t,n)}static isNoop(t){return at.type.isNoop(t)}static getInstance(){return this._instance==null&&(this._instance=new $n),this._instance}removeOp(t,n){return at.removeOp(t,n)}moveOp(t,n){return at.moveOp(t,n)}insertOp(t,n){return at.insertOp(t,n)}replaceOp(t,n,r){return at.replaceOp(t,n,r)}editOp(t,n=["body"]){return at.editOp(n,De.name,t)}};C($n,"uri","https://github.com/dream-num/univer#json-x"),C($n,"_subTypes",new Map),C($n,"_instance",null);let Yt=$n;Yt.registerSubtype(De);var Ah=(e=>(e.PARAGRAPH="PARAGRAPH",e.SECTION_BREAK="SECTION_BREAK",e.TABLE="TABLE",e.TABLE_ROW="TABLE_ROW",e.TABLE_CELL="TABLE_CELL",e.CUSTOM_BLOCK="CUSTOM_BLOCK",e))(Ah||{}),lt=(e=>(e.PARAGRAPH="\r",e.SECTION_BREAK=`
5
- `,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))(lt||{});function TC(e){return`${e}`}const NC=[lt.TABLE_START,lt.TABLE_ROW_START,lt.TABLE_CELL_START,lt.TABLE_CELL_END,lt.TABLE_ROW_END,lt.TABLE_END],Xs=e=>{const t=e.endsWith(`\r
6
- `)?e.slice(0,-2):e;return NC.reduce((n,r)=>n.replaceAll(r,""),t)},MC=e=>e?Xs(e).replaceAll("\r","")==="":!0,DC=e=>{const t=e.replace(/\n/g,"\r"),n=[],r=[];let s=0,i="";const o=(l,c=!0)=>{const u=t.slice(s,l);if(Z.isLegalUrl(u)){const h=nt(),d=`${u}`,f={startIndex:s,endIndex:s+d.length-1,rangeId:h,rangeType:tn.HYPERLINK,properties:{url:e}};r.push(f),i+=d,s=l+1,c&&(i+="\r",n.push({startIndex:l}))}else i+=t.slice(s,l+1),s=l+1,c&&n.push({startIndex:l})};let a=0;for(let l=0;l<t.length;l++)t[l]==="\r"&&(o(l),a=l);return(a!==t.length-1||t.length===1)&&o(t.length,!1),{dataStream:i,paragraphs:n,customRanges:r}},oa={id:"default_doc",documentStyle:{}};class LC extends Bs{constructor(n){var r;super();C(this,"type",ve.UNIVER_DOC);C(this,"_name$",new ae.BehaviorSubject(""));C(this,"name$",this._name$.asObservable());C(this,"snapshot");this.snapshot={...oa,...n},this._name$.next((r=this.snapshot.title)!=null?r:"No Title")}getUnitId(){throw new Error("Method not implemented.")}getRev(){var n;return(n=this.snapshot.rev)!=null?n:1}incrementRev(){this.snapshot.rev=this.getRev()+1}setRev(n){this.snapshot.rev=n}setName(n){this.snapshot.title=n,this._name$.next(n)}get drawings(){return this.snapshot.drawings}get documentStyle(){return this.snapshot.documentStyle}get lists(){return this.snapshot.lists}get zoomRatio(){var n;return((n=this.snapshot.settings)==null?void 0:n.zoomRatio)||1}resetDrawing(n,r){this.snapshot.drawings=n,this.snapshot.drawingsOrder=r}getBody(){return this.snapshot.body}getSnapshot(){return this.snapshot}getBulletPresetList(){var s;const n=(s=this.snapshot.lists)!=null?s:{};return{...jr,...n}}updateDocumentId(n){this.snapshot.id=n}updateDocumentRenderConfig(n){const{documentStyle:r}=this.snapshot;r.renderConfig==null?r.renderConfig=n:r.renderConfig={...r.renderConfig,...n}}getDocumentStyle(){return this.snapshot.documentStyle}updateDocumentStyle(n){this.snapshot.documentStyle==null?this.snapshot.documentStyle=n:this.snapshot.documentStyle={...this.snapshot.documentStyle,...n}}updateDocumentDataMargin(n){const{t:r,l:s,b:i,r:o}=n,{documentStyle:a}=this.snapshot;r!=null&&(a.marginTop=r),s!=null&&(a.marginLeft=s),i!=null&&(a.marginBottom=i),o!=null&&(a.marginRight=o)}updateDocumentDataPageSize(n,r){const{documentStyle:s}=this.snapshot;if(!s.pageSize){s.pageSize={width:n!=null?n:Number.POSITIVE_INFINITY,height:r!=null?r:Number.POSITIVE_INFINITY};return}n!==void 0&&(s.pageSize.width=n),r!==void 0&&(s.pageSize.height=r)}updateDrawing(n,r){const{drawings:s}=this,{width:i,height:o,left:a,top:l}=r,c=s==null?void 0:s[n];if(!c)return;const u=c.docTransform;u.size.width=i,u.size.height=o,u.positionH.posOffset=a,u.positionV.posOffset=l}setZoomRatio(n=1){this.snapshot.settings?this.snapshot.settings.zoomRatio=n:this.snapshot.settings={zoomRatio:n}}setDisabled(n){this.snapshot.disabled=n}getDisabled(){return this.snapshot.disabled}getTitle(){return this.snapshot.title}}class Nt extends LC{constructor(n){var s,i;super(Z.isEmptyObject(n)?T_():n);C(this,"_unitId");C(this,"headerModelMap",new Map);C(this,"footerModelMap",new Map);C(this,"change$",new ae.BehaviorSubject(0));const r=6;this._unitId=(s=this.snapshot.id)!=null?s:nt(r),this._initializeHeaderFooterModel(),this._name$.next((i=this.snapshot.title)!=null?i:"")}dispose(){super.dispose(),this.headerModelMap.forEach(n=>{n.dispose()}),this.footerModelMap.forEach(n=>{n.dispose()}),this._name$.complete()}getDrawings(){return this.snapshot.drawings}getDrawingsOrder(){return this.snapshot.drawingsOrder}getCustomRanges(){var n;return(n=this.snapshot.body)==null?void 0:n.customRanges}getCustomDecorations(){var n;return(n=this.snapshot.body)==null?void 0:n.customDecorations}getSettings(){return this.snapshot.settings}reset(n){if(n.id&&n.id!==this._unitId)throw new Error("Cannot reset a document model with a different unit id!");this.snapshot={...oa,...n},this._initializeHeaderFooterModel(),this.change$.next(this.change$.value+1)}getSelfOrHeaderFooterModel(n){if(n!=null){if(this.headerModelMap.has(n))return this.headerModelMap.get(n);if(this.footerModelMap.has(n))return this.footerModelMap.get(n)}return this}getUnitId(){return this._unitId}apply(n){if(!Yt.isNoop(n))return this.snapshot=Yt.apply(this.snapshot,n),n!=null&&n.some(r=>Array.isArray(r)&&((r==null?void 0:r[0])==="headers"||(r==null?void 0:r[0])==="footers"))&&(this.headerModelMap.clear(),this.footerModelMap.clear(),this._initializeHeaderFooterModel()),this.change$.next(this.change$.value+1),this.snapshot}sliceBody(n,r,s=ia.copy){const i=this.getBody();if(i!=null)return Tt(i,n,r,!1,s)}_initializeHeaderFooterModel(){const{headers:n,footers:r}=this.getSnapshot();if(n)for(const s in n){const i=n[s];this.headerModelMap.set(s,new Nt(i)),this.headerModelMap.get(s).updateDocumentId(this.getUnitId())}if(r)for(const s in r){const i=r[s];this.footerModelMap.set(s,new Nt(i)),this.footerModelMap.get(s).updateDocumentId(this.getUnitId())}}updateDocumentId(n){super.updateDocumentId(n),this._unitId=n}getPlainText(){var n,r;return Xs((r=(n=this.getBody())==null?void 0:n.dataStream)!=null?r:"")}}function xC(e){const{ranges:t,id:n,type:r}=e,s=new De;let i=0;for(let o=0;o<t.length;o++){const a=t[o],{startOffset:l,endOffset:c}=a;l>0&&s.push({t:q.RETAIN,len:l-i}),s.push({t:q.RETAIN,body:{dataStream:"",customDecorations:[{id:n,type:r,startIndex:0,endIndex:c-l-1}]},len:c-l}),i=c}return s}function UC(e){var u,h,d;const{id:t,segmentId:n,documentDataModel:r}=e,s=r==null?void 0:r.getBody();if(!r||!s)return!1;const i=(d=(h=(u=r.getSelfOrHeaderFooterModel(n))==null?void 0:u.getBody())==null?void 0:h.customDecorations)==null?void 0:d.find(f=>f.id===t);if(!i)return!1;const o=new De,{startIndex:a,endIndex:l}=i,c=l-a+1;return o.push({t:q.RETAIN,len:a}),o.push({t:q.RETAIN,len:c,body:{dataStream:"",customDecorations:[{startIndex:0,endIndex:c-1,id:t,type:_n.DELETED}]}}),o}function Th(e,t,n,r){return e<=n&&t>=n||e>=n&&e<=r}function PC(e,t){const n=[];for(let r=0,s=t.length;r<s;r++){const i=t[r];e.collapsed?i.startIndex<e.startOffset&&e.startOffset<=i.endIndex&&n.push(i):Th(e.startOffset,e.endOffset-1,i.startIndex,i.endIndex)&&n.push(i)}return n}function kC(e){return{...Z.deepClone(e),rangeId:nt()}}function FC(e,t){const n=[];let r=e[0];for(const s of t)s<e[0]||s>e[1]||(r<s&&n.push([r,s-1]),r=s+1);return r<=e[1]&&n.push([r,e[1]]),n}function Nh(e,t,n,r){const s=[];for(let i=0,o=n.length;i<o;i++){const a=n[i];if((r===void 0||a.rangeType===r)&&Math.max(a.startIndex,e)<=Math.min(a.endIndex,t)&&s.push({...a}),a.startIndex>t)break}return s}function HC(e,t){var i,o,a,l,c;const n=Nh(e.startOffset,e.collapsed?e.startOffset:e.endOffset-1,(i=t.customRanges)!=null?i:[]),r=Math.min(e.startOffset,(a=(o=n[0])==null?void 0:o.startIndex)!=null?a:1/0),s=Math.max(e.endOffset,((c=(l=n[n.length-1])==null?void 0:l.endIndex)!=null?c:-1/0)+1);return{startOffset:r,endOffset:s,collapsed:r===s}}var Ii,El;function BC(){if(El)return Ii;El=1;var e=-1,t=1,n=0;function r(m,x,O,N,y){if(m===x)return m?[[n,m]]:[];if(O!=null){var v=H(m,x,O);if(v)return v}var T=a(m,x),M=m.substring(0,T);m=m.substring(T),x=x.substring(T),T=c(m,x);var D=m.substring(m.length-T);m=m.substring(0,m.length-T),x=x.substring(0,x.length-T);var P=s(m,x);return M&&P.unshift([n,M]),D&&P.push([n,D]),F(P,y),N&&h(P),P}function s(m,x){var O;if(!m)return[[t,x]];if(!x)return[[e,m]];var N=m.length>x.length?m:x,y=m.length>x.length?x:m,v=N.indexOf(y);if(v!==-1)return O=[[t,N.substring(0,v)],[n,y],[t,N.substring(v+y.length)]],m.length>x.length&&(O[0][0]=O[2][0]=e),O;if(y.length===1)return[[e,m],[t,x]];var T=u(m,x);if(T){var M=T[0],D=T[1],P=T[2],J=T[3],V=T[4],ie=r(M,P),le=r(D,J);return ie.concat([[n,V]],le)}return i(m,x)}function i(m,x){for(var O=m.length,N=x.length,y=Math.ceil((O+N)/2),v=y,T=2*y,M=new Array(T),D=new Array(T),P=0;P<T;P++)M[P]=-1,D[P]=-1;M[v+1]=0,D[v+1]=0;for(var J=O-N,V=J%2!==0,ie=0,le=0,I=0,L=0,Y=0;Y<y;Y++){for(var z=-Y+ie;z<=Y-le;z+=2){var $=v+z,j;z===-Y||z!==Y&&M[$-1]<M[$+1]?j=M[$+1]:j=M[$-1]+1;for(var Q=j-z;j<O&&Q<N&&m.charAt(j)===x.charAt(Q);)j++,Q++;if(M[$]=j,j>O)le+=2;else if(Q>N)ie+=2;else if(V){var ee=v+J-z;if(ee>=0&&ee<T&&D[ee]!==-1){var U=O-D[ee];if(j>=U)return o(m,x,j,Q)}}}for(var K=-Y+I;K<=Y-L;K+=2){var ee=v+K,U;K===-Y||K!==Y&&D[ee-1]<D[ee+1]?U=D[ee+1]:U=D[ee-1]+1;for(var X=U-K;U<O&&X<N&&m.charAt(O-U-1)===x.charAt(N-X-1);)U++,X++;if(D[ee]=U,U>O)L+=2;else if(X>N)I+=2;else if(!V){var $=v+J-K;if($>=0&&$<T&&M[$]!==-1){var j=M[$],Q=v+j-$;if(U=O-U,j>=U)return o(m,x,j,Q)}}}}return[[e,m],[t,x]]}function o(m,x,O,N){var y=m.substring(0,O),v=x.substring(0,N),T=m.substring(O),M=x.substring(N),D=r(y,v),P=r(T,M);return D.concat(P)}function a(m,x){if(!m||!x||m.charAt(0)!==x.charAt(0))return 0;for(var O=0,N=Math.min(m.length,x.length),y=N,v=0;O<y;)m.substring(v,y)==x.substring(v,y)?(O=y,v=O):N=y,y=Math.floor((N-O)/2+O);return k(m.charCodeAt(y-1))&&y--,y}function l(m,x){var O=m.length,N=x.length;if(O==0||N==0)return 0;O>N?m=m.substring(O-N):O<N&&(x=x.substring(0,O));var y=Math.min(O,N);if(m==x)return y;for(var v=0,T=1;;){var M=m.substring(y-T),D=x.indexOf(M);if(D==-1)return v;T+=D,(D==0||m.substring(y-T)==x.substring(0,T))&&(v=T,T++)}}function c(m,x){if(!m||!x||m.slice(-1)!==x.slice(-1))return 0;for(var O=0,N=Math.min(m.length,x.length),y=N,v=0;O<y;)m.substring(m.length-y,m.length-v)==x.substring(x.length-y,x.length-v)?(O=y,v=O):N=y,y=Math.floor((N-O)/2+O);return W(m.charCodeAt(m.length-y))&&y--,y}function u(m,x){var O=m.length>x.length?m:x,N=m.length>x.length?x:m;if(O.length<4||N.length*2<O.length)return null;function y(le,I,L){for(var Y=le.substring(L,L+Math.floor(le.length/4)),z=-1,$="",j,Q,ee,U;(z=I.indexOf(Y,z+1))!==-1;){var K=a(le.substring(L),I.substring(z)),X=c(le.substring(0,L),I.substring(0,z));$.length<X+K&&($=I.substring(z-X,z)+I.substring(z,z+K),j=le.substring(0,L-X),Q=le.substring(L+K),ee=I.substring(0,z-X),U=I.substring(z+K))}return $.length*2>=le.length?[j,Q,ee,U,$]:null}var v=y(O,N,Math.ceil(O.length/4)),T=y(O,N,Math.ceil(O.length/2)),M;if(!v&&!T)return null;T?v?M=v[4].length>T[4].length?v:T:M=T:M=v;var D,P,J,V;m.length>x.length?(D=M[0],P=M[1],J=M[2],V=M[3]):(J=M[0],V=M[1],D=M[2],P=M[3]);var ie=M[4];return[D,P,J,V,ie]}function h(m){for(var x=!1,O=[],N=0,y=null,v=0,T=0,M=0,D=0,P=0;v<m.length;)m[v][0]==n?(O[N++]=v,T=D,M=P,D=0,P=0,y=m[v][1]):(m[v][0]==t?D+=m[v][1].length:P+=m[v][1].length,y&&y.length<=Math.max(T,M)&&y.length<=Math.max(D,P)&&(m.splice(O[N-1],0,[e,y]),m[O[N-1]+1][0]=t,N--,N--,v=N>0?O[N-1]:-1,T=0,M=0,D=0,P=0,y=null,x=!0)),v++;for(x&&F(m),b(m),v=1;v<m.length;){if(m[v-1][0]==e&&m[v][0]==t){var J=m[v-1][1],V=m[v][1],ie=l(J,V),le=l(V,J);ie>=le?(ie>=J.length/2||ie>=V.length/2)&&(m.splice(v,0,[n,V.substring(0,ie)]),m[v-1][1]=J.substring(0,J.length-ie),m[v+1][1]=V.substring(ie),v++):(le>=J.length/2||le>=V.length/2)&&(m.splice(v,0,[n,J.substring(0,le)]),m[v-1][0]=t,m[v-1][1]=V.substring(0,V.length-le),m[v+1][0]=e,m[v+1][1]=J.substring(le),v++),v++}v++}}var d=/[^a-zA-Z0-9]/,f=/\s/,g=/[\r\n]/,E=/\n\r?\n$/,R=/^\r?\n\r?\n/;function b(m){function x(le,I){if(!le||!I)return 6;var L=le.charAt(le.length-1),Y=I.charAt(0),z=L.match(d),$=Y.match(d),j=z&&L.match(f),Q=$&&Y.match(f),ee=j&&L.match(g),U=Q&&Y.match(g),K=ee&&le.match(E),X=U&&I.match(R);return K||X?5:ee||U?4:z&&!j&&Q?3:j||Q?2:z||$?1:0}for(var O=1;O<m.length-1;){if(m[O-1][0]==n&&m[O+1][0]==n){var N=m[O-1][1],y=m[O][1],v=m[O+1][1],T=c(N,y);if(T){var M=y.substring(y.length-T);N=N.substring(0,N.length-T),y=M+y.substring(0,y.length-T),v=M+v}for(var D=N,P=y,J=v,V=x(N,y)+x(y,v);y.charAt(0)===v.charAt(0);){N+=y.charAt(0),y=y.substring(1)+v.charAt(0),v=v.substring(1);var ie=x(N,y)+x(y,v);ie>=V&&(V=ie,D=N,P=y,J=v)}m[O-1][1]!=D&&(D?m[O-1][1]=D:(m.splice(O-1,1),O--),m[O][1]=P,J?m[O+1][1]=J:(m.splice(O+1,1),O--))}O++}}function F(m,x){m.push([n,""]);for(var O=0,N=0,y=0,v="",T="",M;O<m.length;){if(O<m.length-1&&!m[O][1]){m.splice(O,1);continue}switch(m[O][0]){case t:y++,T+=m[O][1],O++;break;case e:N++,v+=m[O][1],O++;break;case n:var D=O-y-N-1;if(x){if(D>=0&&p(m[D][1])){var P=m[D][1].slice(-1);if(m[D][1]=m[D][1].slice(0,-1),v=P+v,T=P+T,!m[D][1]){m.splice(D,1),O--;var J=D-1;m[J]&&m[J][0]===t&&(y++,T=m[J][1]+T,J--),m[J]&&m[J][0]===e&&(N++,v=m[J][1]+v,J--),D=J}}if(S(m[O][1])){var P=m[O][1].charAt(0);m[O][1]=m[O][1].slice(1),v+=P,T+=P}}if(O<m.length-1&&!m[O][1]){m.splice(O,1);break}if(v.length>0||T.length>0){v.length>0&&T.length>0&&(M=a(T,v),M!==0&&(D>=0?m[D][1]+=T.substring(0,M):(m.splice(0,0,[n,T.substring(0,M)]),O++),T=T.substring(M),v=v.substring(M)),M=c(T,v),M!==0&&(m[O][1]=T.substring(T.length-M)+m[O][1],T=T.substring(0,T.length-M),v=v.substring(0,v.length-M)));var V=y+N;v.length===0&&T.length===0?(m.splice(O-V,V),O=O-V):v.length===0?(m.splice(O-V,V,[t,T]),O=O-V+1):T.length===0?(m.splice(O-V,V,[e,v]),O=O-V+1):(m.splice(O-V,V,[e,v],[t,T]),O=O-V+2)}O!==0&&m[O-1][0]===n?(m[O-1][1]+=m[O][1],m.splice(O,1)):O++,y=0,N=0,v="",T="";break}}m[m.length-1][1]===""&&m.pop();var ie=!1;for(O=1;O<m.length-1;)m[O-1][0]===n&&m[O+1][0]===n&&(m[O][1].substring(m[O][1].length-m[O-1][1].length)===m[O-1][1]?(m[O][1]=m[O-1][1]+m[O][1].substring(0,m[O][1].length-m[O-1][1].length),m[O+1][1]=m[O-1][1]+m[O+1][1],m.splice(O-1,1),ie=!0):m[O][1].substring(0,m[O+1][1].length)==m[O+1][1]&&(m[O-1][1]+=m[O+1][1],m[O][1]=m[O][1].substring(m[O+1][1].length)+m[O+1][1],m.splice(O+1,1),ie=!0)),O++;ie&&F(m,x)}function k(m){return m>=55296&&m<=56319}function W(m){return m>=56320&&m<=57343}function S(m){return W(m.charCodeAt(0))}function p(m){return k(m.charCodeAt(m.length-1))}function w(m){for(var x=[],O=0;O<m.length;O++)m[O][1].length>0&&x.push(m[O]);return x}function A(m,x,O,N){return p(m)||S(N)?null:w([[n,m],[e,x],[t,O],[n,N]])}function H(m,x,O){var N=typeof O=="number"?{index:O,length:0}:O.oldRange,y=typeof O=="number"?null:O.newRange,v=m.length,T=x.length;if(N.length===0&&(y===null||y.length===0)){var M=N.index,D=m.slice(0,M),P=m.slice(M),J=y?y.index:null;e:{var V=M+T-v;if(J!==null&&J!==V||V<0||V>T)break e;var ie=x.slice(0,V),le=x.slice(V);if(le!==P)break e;var I=Math.min(M,V),L=D.slice(0,I),Y=ie.slice(0,I);if(L!==Y)break e;var z=D.slice(I),$=ie.slice(I);return A(L,z,$,P)}e:{if(J!==null&&J!==M)break e;var j=M,ie=x.slice(0,j),le=x.slice(j);if(ie!==D)break e;var Q=Math.min(v-j,T-j),ee=P.slice(P.length-Q),U=le.slice(le.length-Q);if(ee!==U)break e;var z=P.slice(0,P.length-Q),$=le.slice(0,le.length-Q);return A(D,z,$,ee)}}if(N.length>0&&y&&y.length===0)e:{var L=m.slice(0,N.index),ee=m.slice(N.index+N.length),I=L.length,Q=ee.length;if(T<I+Q)break e;var Y=x.slice(0,I),U=x.slice(T-Q);if(L!==Y||ee!==U)break e;var z=m.slice(I,v-Q),$=x.slice(I,T-Q);return A(L,z,$,ee)}return null}function B(m,x,O,N){return r(m,x,O,N,!0)}return B.INSERT=t,B.DELETE=e,B.EQUAL=n,Ii=B,Ii}var $C=BC();const aa=St($C);function jC(e){var h,d,f;const{rangeId:t,segmentId:n,documentDataModel:r,insert:s}=e,i=(d=(h=r.getSelfOrHeaderFooterModel(n).getBody())==null?void 0:h.customRanges)==null?void 0:d.find(g=>g.rangeId===t);if(!i)return!1;const{startIndex:o,endIndex:a}=i,l=new De,c=a-o+1;l.push({t:q.RETAIN,len:o}),l.push({t:q.RETAIN,len:c,body:{dataStream:"",customRanges:[]}}),s&&l.push({t:q.INSERT,body:s,len:s.dataStream.length});const u=a+1+((f=s==null?void 0:s.dataStream.length)!=null?f:0);return l.selections=[{startOffset:u,endOffset:u,collapsed:!0}],l}function WC(e){const{ranges:t,rangeId:n,rangeType:r,wholeEntity:s,properties:i,body:o}=e;let a=0;const l=new De;let c=!1;return t.forEach(u=>{var k,W,S;const h=HC(u,o);if(!h||!o)return!1;const{startOffset:d,endOffset:f}=h,g=(k=o.customRanges)!=null?k:[],E=(p,w,A)=>{var O,N,y,v;const H=Nh(p,w,g,r),B=Math.min((N=(O=H[0])==null?void 0:O.startIndex)!=null?N:1/0,p),m=Math.max((v=(y=H[H.length-1])==null?void 0:y.endIndex)!=null?v:-1/0,w),x={rangeId:A?`${n}$${A}`:n,rangeType:r,startIndex:0,endIndex:m-B,wholeEntity:s,properties:{...i}};l.push({t:q.RETAIN,len:B-a}),l.push({t:q.RETAIN,len:m-B+1,body:{dataStream:"",customRanges:[x]},coverType:Ee.COVER}),a=m+1},R=((W=o.paragraphs)!=null?W:[]).filter(p=>p.startIndex<f&&p.startIndex>d),b=((S=o.customBlocks)!=null?S:[]).filter(p=>p.startIndex<f&&p.startIndex>d);FC([d,f-1],[...R.map(p=>p.startIndex),...b.map(p=>p.startIndex)]).forEach(([p,w],A)=>E(p,w,A)),c=!0,l.selections=[{startOffset:h.endOffset,endOffset:h.endOffset,collapsed:!0}]}),c?l:!1}function Mh(e,t,n=0,r=null,s=!0){e.sort((c,u)=>c.startOffset-u.startOffset);const i=[],{paragraphs:o=[]}=t,a=o==null?void 0:o.find(c=>c.startIndex>=e[0].startOffset&&c.startIndex<e[0].endOffset);let l=n;if(e.forEach(c=>{const{startOffset:u,endOffset:h}=c;u>l&&(i.push({t:q.RETAIN,len:u-l}),l=u),l<h&&(i.push({t:q.DELETE,len:h-l}),l=h)}),r&&i.push({t:q.INSERT,body:r,len:r.dataStream.length}),a&&s){const c=o.find(u=>u.startIndex-n>=e[e.length-1].endOffset-1);c&&(c.startIndex>l&&(i.push({t:q.RETAIN,len:c.startIndex-l}),l=c.startIndex),i.push({t:q.RETAIN,len:1,body:{dataStream:"",paragraphs:[{...c,startIndex:0,bullet:a==null?void 0:a.bullet}]},coverType:Ee.REPLACE}))}return i}function YC(e,t,n=0){const r=[];let s=n;return e.forEach(i=>{const{startOffset:o,endOffset:a}=i;o>s&&(r.push({t:q.RETAIN,len:o-s}),s=o),a>s&&(r.push({t:q.RETAIN,len:a-s,body:{...Z.deepClone(t),dataStream:""}}),s=a)}),r}const zC=e=>{var h;const{selection:t,body:n,doc:r}=e,s=t.segmentId,i=(h=r.getSelfOrHeaderFooterModel(s))==null?void 0:h.getBody();if(!i)return!1;const o=t.collapsed?null:Tt(i,t.startOffset,t.endOffset),a=aa(o?o.dataStream:"",n.dataStream);let l=0;const c=a.map(([d,f])=>{switch(d){case 0:{const g={t:q.RETAIN,body:{...Tt(n,l,l+f.length,!1),dataStream:""},len:f.length};return l+=f.length,g}case 1:{const g={t:q.INSERT,body:Tt(n,l,l+f.length),len:f.length};return l+=f.length,g}default:return{t:q.DELETE,len:f.length}}}),u=new De;return u.push({t:q.RETAIN,len:t.startOffset}),u.push(...c),u};function VC(e,t){return!!((e==null?void 0:e.length)===(t==null?void 0:t.length)&&(e!=null&&e.every((n,r)=>JSON.stringify(n)===JSON.stringify(t==null?void 0:t[r]))))}const KC=e=>{var d;const{selection:t,body:n,doc:r,themeService:s}=e,i=t.segmentId,o=(d=r.getSelfOrHeaderFooterModel(i))==null?void 0:d.getBody();if(!o)return!1;const a=t.collapsed?null:Tt(o,t.startOffset,t.endOffset),l=aa(a?a.dataStream:"",n.dataStream);let c=0;const u=l.map(([f,g])=>{switch(f){case 0:{const E=Ns(n,c,c+g.length,!1),R=Ns(a,c,c+g.length,!1),b={t:q.RETAIN,body:VC(E,R)?void 0:{textRuns:E==null?void 0:E.map(F=>{var k,W,S,p,w,A,H;return{...F,ts:{...F.ts,cl:(S=(W=(k=F.ts)==null?void 0:k.cl)==null?void 0:W.rgb)!=null&&S.includes(".")?{rgb:s.getColorFromTheme((A=(w=(p=F.ts)==null?void 0:p.cl)==null?void 0:w.rgb)!=null?A:"")}:(H=F.ts)==null?void 0:H.cl}}}),dataStream:""},len:g.length};return c+=g.length,b}case 1:{const E={t:q.INSERT,body:Tt(n,c,c+g.length),len:g.length};return c+=g.length,E}default:return{t:q.DELETE,len:g.length}}});if(u.every(f=>f.t===q.RETAIN&&!f.body))return!1;const h=new De;return h.push({t:q.RETAIN,len:t.startOffset}),h.push(...u),h};function GC(e,t){const n=[],{customBlocks:r=[]}=e;for(const s of t){const{startOffset:i,endOffset:o}=s;if(!(i==null||o==null))for(const a of r){const{startIndex:l}=a;l>=i&&l<o&&n.push(a.blockId)}}return n}function XC(e,t=""){if(!t)return["body"];const{headers:n,footers:r}=e.getSnapshot();if(n==null&&r==null)throw new Error("Document data model must have headers or footers when update by segment id");if((n==null?void 0:n[t])!=null)return["headers",t,"body"];if((r==null?void 0:r[t])!=null)return["footers",t,"body"];throw new Error("Segment id not found in headers or footers")}const qC=e=>{var E,R,b,F;const{selection:t,documentDataModel:n,drawings:r}=e,{collapsed:s,startOffset:i,segmentId:o}=t,a=new De,l=Yt.getInstance(),c=[],u=n.getSelfOrHeaderFooterModel(o).getBody();if(!u)return!1;const h=(R=(E=n.getSnapshot().drawingsOrder)==null?void 0:E.length)!=null?R:0;let d=0;if(s)i>0&&a.push({t:q.RETAIN,len:i});else{const k=Mh([t],u,0,null,!1);a.push(...k);const W=GC(u,[t]),S=(b=n.getDrawings())!=null?b:{},p=(F=n.getDrawingsOrder())!=null?F:[],w=W.sort((A,H)=>p.indexOf(A)>p.indexOf(H)?-1:p.indexOf(A)<p.indexOf(H)?1:0);if(w.length>0)for(const A of w){const H=S[A],B=p.indexOf(A);if(H==null||B<0)continue;const m=l.removeOp(["drawings",A],H),x=l.removeOp(["drawingsOrder",B],A);c.push(m),c.push(x),d++}}a.push({t:q.INSERT,body:{dataStream:"\b".repeat(r.length),customBlocks:r.map((k,W)=>({startIndex:W,blockId:k.drawingId}))},len:r.length});const f=XC(n,o),g=l.editOp(a.serialize(),f);c.push(g);for(const k of r){const{drawingId:W}=k,S=l.insertOp(["drawings",W],k),p=l.insertOp(["drawingsOrder",h-d],W);c.push(S),c.push(p)}return c.reduce((k,W)=>Yt.compose(k,W),null)};function JC(e,t){if(typeof t>"u")return{startOffset:e,endOffset:e,collapsed:!0};if(t<e)throw new Error(`Cannot make a doc selection when endOffset ${t} is less than startOffset ${e}.`);return{startOffset:e,endOffset:t,collapsed:e===t}}function ZC(e){const{startOffset:t,endOffset:n,collapsed:r}=e,s=Math.min(t,n),i=Math.max(t,n);return{startOffset:s,endOffset:i,collapsed:r}}function QC(e,t,n,r){return Math.max(e,n)<=Math.min(t,r)}function qi(e,t,n,r){const{startOffset:s,endOffset:i}=e,o=r!=null?r:la(t,n),a=[];let l=-1;for(let c=0;c<o.length;c++){const u=o[c],{startIndex:h}=u;(s>l&&s<=h||i>l&&i<=h||h>=s&&h<=i)&&a.push(u),l=h}return a}function Ji(e,t,n){const r=[],s=la(t,n);for(const i of e){const o=qi(i,t,n,s);r.push(...o)}return r}const eR=[lt.PARAGRAPH,lt.TABLE_START,lt.TABLE_END,lt.TABLE_ROW_START,lt.TABLE_CELL_START,lt.TABLE_CELL_END];function la(e,t){const n=[];for(let r=0;r<e.length;r++){const s=e[r],{startIndex:i}=s;let o=i-1;for(;!eR.includes(t[o])&&o>=0;)o--;n.push({...s,paragraphStart:o+1,paragraphEnd:s.startIndex})}return n}const tR=e=>{var h,d,f;const{paragraphs:t,segmentId:n,document:r}=e;let s=e.listType;const i=(d=(h=r.getSelfOrHeaderFooterModel(n).getBody())==null?void 0:h.paragraphs)!=null?d:[],o=t.every(g=>{var E;return((E=g.bullet)==null?void 0:E.listType.indexOf(s))===0});let l=nt(6);if(t.length===1){const g=i.indexOf(t[0]),E=i[g-1],R=i[g+1];E&&E.bullet&&E.bullet.listType.indexOf(s)===0?(l=E.bullet.listId,s!==Pt.CHECK_LIST&&(s=E.bullet.listType)):R&&R.bullet&&R.bullet.listType.indexOf(s)===0&&(l=R.bullet.listId,s!==Pt.CHECK_LIST&&(s=R.bullet.listType))}const c=new Sn;c.reset();const u=new De;for(const g of t){const{startIndex:E,paragraphStyle:R={},bullet:b}=g;u.push({t:q.RETAIN,len:E-c.cursor}),u.push({t:q.RETAIN,len:1,body:{dataStream:"",paragraphs:[o?{paragraphStyle:R,startIndex:0}:{startIndex:0,paragraphStyle:{...R},bullet:{nestingLevel:(f=b==null?void 0:b.nestingLevel)!=null?f:0,textStyle:{fs:20},listType:s,listId:l}}]},coverType:Ee.REPLACE}),c.moveCursorTo(E+1)}return u},nR=e=>{var h;const{paragraphIndex:t,segmentId:n,document:r}=e,s=(h=r.getSelfOrHeaderFooterModel(n).getBody())==null?void 0:h.paragraphs;if(s==null)return!1;const i=s.find(d=>d.startIndex===t);if(!(i!=null&&i.bullet)||i.bullet.listType.indexOf(Pt.CHECK_LIST)===-1)return!1;const o=new Sn;o.reset();const a=new De,{startIndex:l,paragraphStyle:c={}}=i,u=i.bullet.listType===Pt.CHECK_LIST?Pt.CHECK_LIST_CHECKED:Pt.CHECK_LIST;return a.push({t:q.RETAIN,len:l-o.cursor}),a.push({t:q.RETAIN,len:1,body:{dataStream:"",paragraphs:[{...i,paragraphStyle:c,startIndex:0,bullet:{...i.bullet,listType:u}}]},coverType:Ee.REPLACE}),o.moveCursorTo(l+1),a},rR=e=>{var u,h;const{paragraphs:t,listType:n,segmentId:r,document:s}=e;if(((u=s.getSelfOrHeaderFooterModel(r).getBody())==null?void 0:u.paragraphs)==null)return!1;const a=nt(6),l=new Sn;l.reset();const c=new De;for(const d of t){const{startIndex:f,paragraphStyle:g={},bullet:E}=d;c.push({t:q.RETAIN,len:f-l.cursor}),c.push({t:q.RETAIN,len:1,body:{dataStream:"",paragraphs:[{startIndex:0,paragraphStyle:g,bullet:{nestingLevel:(h=E==null?void 0:E.nestingLevel)!=null?h:0,textStyle:(E==null?void 0:E.listType)===n?E.textStyle:{fs:20},listType:n,listId:a}}]},coverType:Ee.REPLACE}),l.moveCursorTo(f+1)}return c};function sR(e,t){return t.some(n=>e.startIndex>n.startIndex&&e.startIndex<n.endIndex)}const iR=e=>{var c,u,h;const{paragraphs:t,document:n,type:r}=e,s=new Sn;s.reset();const i=new De,o=(c=n.getSnapshot().lists)!=null?c:{},a=(h=(u=n.getBody())==null?void 0:u.tables)!=null?h:[],l={...jr,...o};for(const d of t){const{startIndex:f,paragraphStyle:g={},bullet:E}=d,R=sR(d,a);if(i.push({t:q.RETAIN,len:f-s.cursor}),E){const b=E.listType;let F=l[b].nestingLevel.length-1;R&&(F=Math.min(F,2)),i.push({t:q.RETAIN,len:1,body:{dataStream:"",paragraphs:[{startIndex:0,paragraphStyle:{...g},bullet:{...E,nestingLevel:Math.max(Math.min(E.nestingLevel+r,F),0)}}]},coverType:Ee.REPLACE})}else i.push({t:q.RETAIN,len:1});s.moveCursorTo(f+1)}return i},oR=e=>{var R,b,F,k;const{textRanges:t,segmentId:n,document:r,style:s,paragraphTextRun:i,cursor:o,deleteLen:a,textX:l}=e,c=r.getSelfOrHeaderFooterModel(n),u=(b=(R=c.getBody())==null?void 0:R.paragraphs)!=null?b:[],h=(k=(F=c.getBody())==null?void 0:F.dataStream)!=null?k:"",d=Ji(t,u,h),f=new Sn;o&&f.moveCursorTo(o);const g=l!=null?l:new De;d.sort((W,S)=>W.startIndex-S.startIndex);const E=Math.max(0,d[0].paragraphStart-1);E>f.cursor&&(g.push({t:q.RETAIN,len:E-f.cursor}),f.moveCursorTo(E)),a&&g.push({t:q.DELETE,len:a});for(const W of d){const{startIndex:S,paragraphStyle:p={}}=W,w=S-f.cursor;g.push({t:q.RETAIN,len:w,...i?{body:{dataStream:"",textRuns:[{ts:i,st:0,ed:w}]},coverType:Ee.REPLACE}:null}),g.push({t:q.RETAIN,len:1,body:{dataStream:"",paragraphs:[{startIndex:0,paragraphStyle:{...p,...s}}]},coverType:Ee.REPLACE}),f.moveCursorTo(S+1)}return g};class et{}C(et,"customRange",{add:WC,delete:jC,copyCustomRange:kC,getCustomRangesInterestsWithSelection:PC,isIntersecting:Th}),C(et,"customDecoration",{add:xC,delete:UC}),C(et,"selection",{replace:zC,makeSelection:JC,normalizeSelection:ZC,delete:Mh,replaceTextRuns:KC,retain:YC}),C(et,"range",{isIntersects:QC,getParagraphsInRange:qi,getParagraphsInRanges:Ji}),C(et,"transform",{getPlainText:Xs,fromPlainText:DC,isEmptyDocument:MC}),C(et,"paragraph",{bullet:{set:rR,switch:tR,toggleChecklist:nR,changeNestLevel:iR},style:{set:oR},util:{transform:la,getParagraphsInRange:qi,getParagraphsInRanges:Ji}}),C(et,"drawing",{add:qC});function aR(e,t,n,r){var c;if(t==="")return e;const s={id:"mock-id",body:e,documentStyle:{}},i=new Nt(s),o=t.length;let a;for(;(a=(r?i.getBody().dataStream:i.getBody().dataStream.toLowerCase()).indexOf(t))>=0;){const u=new De,h=Yt.getInstance();if(a>0&&u.retain(a),n.length>0){const d=i.sliceBody(a,a+o),f={dataStream:n};if(Array.isArray(d==null?void 0:d.textRuns)&&d.textRuns.length&&(f.textRuns=[{...d.textRuns[0],st:0,ed:n.length}]),(c=d==null?void 0:d.customRanges)!=null&&c.length){const g=d.customRanges[0];f.customRanges=[{...g,startIndex:0,endIndex:n.length-1}]}u.insert(n.length,f)}u.delete(o),i.apply(h.editOp(u.serialize()))}const l=i.getBody();return i.dispose(),l}function lR(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 Dh(e){var t;return e.body=lR((t=e.body)!=null?t:{dataStream:""}),e.drawingsOrder||(e.drawingsOrder=[]),e.drawings||(e.drawings={}),e.documentStyle||(e.documentStyle={}),e}class Wr{constructor(t={}){C(this,"_style");this._style=t}static create(t={}){return new Wr(t)}get fontFamily(){return this._style.ff}get fontSize(){return this._style.fs}get italic(){return this._style.it===ce.TRUE}get bold(){return this._style.bl===ce.TRUE}get underline(){return this._style.ul&&qt.create(this._style.ul)}get bottomBorderLine(){return this._style.bbl&&qt.create(this._style.bbl)}get strikethrough(){return this._style.st&&qt.create(this._style.st)}get overline(){return this._style.ol&&qt.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 en.create(Z.deepClone(this._style))}getValue(){return{...this._style}}}class en extends Wr{static create(t={}){return new en(t)}constructor(t={}){super(t)}setFontFamily(t){return this._style.ff=t,this}setFontSize(t){return this._style.fs=t,this}setItalic(t){return this._style.it=t?1:0,this}setBold(t){return this._style.bl=t?1:0,this}setUnderline(t){return this._style.ul=t.build(),this}setBottomBorderLine(t){return this._style.bbl=t.build(),this}setStrikethrough(t){return this._style.st=t.build(),this}setOverline(t){return this._style.ol=t.build(),this}setBackground(t){return this._style.bg=t,this}setBorder(t){return this._style.bd=t,this}setColor(t){return this._style.cl=t,this}setVerticalAlign(t){return this._style.va=t,this}copy(){return en.create(Z.deepClone(this._style))}build(){return this.getValue()}}class qt{constructor(t={s:1}){C(this,"_decoration");this._decoration=t}static create(t={s:1}){return new qt(t)}get show(){return this._decoration.s===ce.TRUE}get followFontColor(){return this._decoration.c===ce.TRUE}get color(){return this._decoration.cl}get type(){return this._decoration.t}setShow(t){return this._decoration.s=t?1:0,this}setFollowFontColor(t){return this._decoration.c=t?1:0,this}setColor(t){return this._decoration.cl=t,this}setLineType(t){return this._decoration.t=t,this}copy(){return qt.create(Z.deepClone(this._decoration))}build(){return{...this._decoration}}}class Yr{constructor(t={}){C(this,"_style");this._style=t}static create(t={}){return new Yr(t)}get indentFirstLine(){return this._style.indentFirstLine}get hanging(){return this._style.hanging}get indentStart(){return this._style.indentStart}get tabStops(){return this._style.tabStops}get indentEnd(){return this._style.indentEnd}get textStyle(){return this._style.textStyle}get headingId(){return this._style.headingId}get namedStyleType(){return this._style.namedStyleType}get horizontalAlign(){return this._style.horizontalAlign}get lineSpacing(){return this._style.lineSpacing}get direction(){return this._style.direction}get spacingRule(){return this._style.spacingRule}get snapToGrid(){return this._style.snapToGrid}get spaceAbove(){return this._style.spaceAbove}get spaceBelow(){return this._style.spaceBelow}get borderBetween(){return this._style.borderBetween}get borderTop(){return this._style.borderTop}get borderBottom(){return this._style.borderBottom}get borderLeft(){return this._style.borderLeft}get borderRight(){return this._style.borderRight}get keepLines(){return this._style.keepLines===ce.TRUE}get keepNext(){return this._style.keepNext===ce.TRUE}get wordWrap(){return this._style.wordWrap===ce.TRUE}get widowControl(){return this._style.widowControl===ce.TRUE}get shading(){return this._style.shading}get suppressHyphenation(){return this._style.suppressHyphenation===ce.TRUE}copy(){return Nr.create(Z.deepClone(this._style))}getValue(){return this._style}}class Nr extends Yr{static create(t={}){return new Nr(t)}constructor(t={}){super(t)}setIndentFirstLine(t){return this._style.indentFirstLine=t,this}setHanging(t){return this._style.hanging=t,this}setIndentStart(t){return this._style.indentStart=t,this}setTabStops(t){return this._style.tabStops=t,this}setIndentEnd(t){return this._style.indentEnd=t,this}setTextStyle(t){return this._style.textStyle=t,this}setHeadingId(t){return this._style.headingId=t,this}setNamedStyleType(t){return this._style.namedStyleType=t,this}setHorizontalAlign(t){return this._style.horizontalAlign=t,this}setLineSpacing(t){return this._style.lineSpacing=t,this}setDirection(t){return this._style.direction=t,this}setSpacingRule(t){return this._style.spacingRule=t,this}setSnapToGrid(t){return this._style.snapToGrid=t?1:0,this}setSpaceAbove(t){return this._style.spaceAbove=t,this}setSpaceBelow(t){return this._style.spaceBelow=t,this}setBorderBetween(t){return this._style.borderBetween=t,this}setBorderTop(t){return this._style.borderTop=t,this}setBorderBottom(t){return this._style.borderBottom=t,this}setBorderLeft(t){return this._style.borderLeft=t,this}setBorderRight(t){return this._style.borderRight=t,this}setKeepLines(t){return this._style.keepLines=t?1:0,this}setKeepNext(t){return this._style.keepNext=t?1:0,this}setWordWrap(t){return this._style.wordWrap=t?1:0,this}setWidowControl(t){return this._style.widowControl=t?1:0,this}setShading(t){return this._style.shading=t,this}setSuppressHyphenation(t){return this._style.suppressHyphenation=t?1:0,this}copy(){return Nr.create(Z.deepClone(this._style))}build(){return this.getValue()}}class Jt{constructor(t){C(this,"_data");if(!t.body)throw new Error("Invalid document data, body is required");this._data=Dh(t)}static create(t){return new Jt(t)}static createByBody(t){return new Jt({body:t,id:"d",documentStyle:{}})}copy(){return pn.create(Z.deepClone(this._data))}slice(t,n){const{body:r,...s}=this._data;return pn.create({...Z.deepClone(s),body:Tt(r,t,n)})}toPlainText(){var t,n;return et.transform.getPlainText((n=(t=this._data.body)==null?void 0:t.dataStream)!=null?n:"").replaceAll("\r",`
7
- `)}getParagraphStyle(){var t,n;return Yr.create((n=(t=this._data.body)==null?void 0:t.paragraphs)==null?void 0:n[0].paragraphStyle)}getParagraphBullet(){var t,n;return(n=(t=this._data.body)==null?void 0:t.paragraphs)==null?void 0:n[0].bullet}getParagraphs(){var r,s;const t=(s=(r=this._data.body)==null?void 0:r.paragraphs)!=null?s:[];let n=0;return t.map(i=>{const o=this.slice(n,i.startIndex);return n=i.startIndex,o})}getTextRuns(){var t,n;return((n=(t=this._data.body)==null?void 0:t.textRuns)!=null?n:[]).map(r=>({...r,ts:r.ts?Wr.create(r.ts):null}))}getLinks(){var t,n,r;return(r=(n=(t=this._data.body)==null?void 0:t.customRanges)==null?void 0:n.filter(s=>s.rangeType===tn.HYPERLINK))!=null?r:[]}getData(){return this._data}}class pn extends Jt{constructor(n){super(n);C(this,"_doc");this._doc=new Nt(n)}static newEmptyData(){return Dh({id:"d",documentStyle:{},drawings:{},drawingsOrder:[],body:{dataStream:`\r
8
- `,customBlocks:[],customRanges:[],paragraphs:[{startIndex:0}],textRuns:[],tables:[],sectionBreaks:[]}})}static create(n){return new pn(n!=null?n:pn.newEmptyData())}insertText(n,r,s){var u,h;let i=((h=(u=this._data.body)==null?void 0:u.dataStream.length)!=null?h:2)-2,o,a;if(typeof n=="string"?o=n:(i=Math.min(n,i),o=r),typeof r=="object"?a=r instanceof en?r.build():r:a=s instanceof en?s.build():s,!o)return this;const l={dataStream:o,textRuns:a?[{ts:a,st:i,ed:i+o.length}]:[]},c=et.selection.replace({doc:this._doc,selection:{startOffset:i,endOffset:i,collapsed:!0},body:l});if(!c)throw new Error("Insert text failed, please check.");return De.apply(this._doc.getBody(),c.serialize()),this}insertRichText(n,r){var a,l;let s=((l=(a=this._data.body)==null?void 0:a.dataStream.length)!=null?l:2)-2,i;typeof n=="object"?i=n instanceof Jt?n.getData():n:(s=Math.min(n,s),i=r instanceof Jt?r.getData():r);const o=et.selection.replace({doc:this._doc,selection:{startOffset:s,endOffset:s,collapsed:!0},body:i.body});if(!o)throw new Error("Insert text failed, please check.");return De.apply(this._doc.getBody(),o.serialize()),this}delete(n,r){if(r!==void 0){if(!r)return this;const s=et.selection.delete([{startOffset:n,endOffset:n+r,collapsed:!0}],this._data.body);De.apply(this._doc.getBody(),s)}return this}setStyle(n,r,s){const i={dataStream:"",textRuns:[{ts:s instanceof en?s.build():s,st:0,ed:r-n}]},o=et.selection.retain([{startOffset:n,endOffset:r,collapsed:!0}],i);return De.apply(this._doc.getBody(),o),this}setLink(n,r,s){const i=et.customRange.add({rangeType:tn.HYPERLINK,rangeId:nt(),properties:{url:s},ranges:[{startOffset:n,endOffset:r,collapsed:!1}],body:this._data.body});if(!i)throw new Error("Insert text failed, please check.");return De.apply(this._doc.getBody(),i.serialize()),this}cancelLink(n,r){if(typeof n=="string"){const s=et.customRange.delete({rangeId:n,documentDataModel:this._doc});if(!s)throw new Error("Insert text failed, please check.");De.apply(this._doc.getBody(),s.serialize())}else this.slice(n,r).getLinks().forEach(i=>{const o=et.customRange.delete({rangeId:i.rangeId,documentDataModel:this._doc});if(!o)throw new Error("Insert text failed, please check.");De.apply(this._doc.getBody(),o.serialize())});return this}updateLink(n,r){var i,o;const s=(o=(i=this._data.body)==null?void 0:i.customRanges)==null?void 0:o.find(a=>a.rangeId===n);if(!s)throw new Error("Link not found");return s.properties.url=r,this}insertParagraph(n,r){var o,a;let s,i;return typeof n=="object"?(s={dataStream:"\r",paragraphs:[{startIndex:0,paragraphStyle:n.build()}]},i=((a=(o=this._data.body)==null?void 0:o.dataStream.length)!=null?a:2)-2):(i=n,s={dataStream:"\r",paragraphs:[{startIndex:0,paragraphStyle:r==null?void 0:r.build()}]}),this.insertRichText(i,Jt.create({body:s,id:"d",documentStyle:{}})),this}insertLink(n,r,s){let i="",o="";typeof n=="string"?(i=n,o=r):(i=r,o=s);const a=pn.createByBody({dataStream:i,customRanges:[{rangeType:tn.HYPERLINK,rangeId:nt(),properties:{url:o},startIndex:0,endIndex:i.length-1}]});return typeof n=="number"?this.insertRichText(n,a):this.insertRichText(a)}}const cR="__default_document_sub_component_id20231101__";class Lh{constructor(){C(this,"skipNextObservers",!1);C(this,"lastReturnValue");C(this,"isStopPropagation",!1)}stopPropagation(){this.isStopPropagation=!0}}class uR extends ae.Subject{constructor(){super(...arguments);C(this,"_sortedObservers",[])}unsubscribe(){super.unsubscribe(),this._sortedObservers.length=0}complete(){super.complete(),this._sortedObservers.length=0}subscribeEvent(n){let r;typeof n=="function"?r={next:([i,o])=>n(i,o)}:r=n;const s=super.subscribe(r);return this._sortedObservers.push(r),this._sortedObservers.sort((i,o)=>{var a,l;return((a=i.priority)!=null?a:0)-((l=o.priority)!=null?l:0)}),s.add(()=>this._sortedObservers=this._sortedObservers.filter(i=>i!==r)),s}clearObservers(){this._sortedObservers.forEach(n=>{var r;return(r=n.complete)==null?void 0:r.call(n)}),this._sortedObservers.length=0}emitEvent(n){var r;if(!this.closed){const s=new Lh;s.lastReturnValue=n;for(const i of this._sortedObservers){const o=(r=i.next)==null?void 0:r.call(i,[n,s]);if(s.lastReturnValue=o,s.skipNextObservers)return{handled:!0,lastReturnValue:s.lastReturnValue,stopPropagation:s.isStopPropagation}}return{handled:this._sortedObservers.length>0,lastReturnValue:s.lastReturnValue,stopPropagation:s.isStopPropagation}}throw new Error("[EventSubject]: cannot emit event on a closed subject.")}}function hR(e){return new ae.Observable(t=>{const n=e.subscribeEvent(r=>{t.next(r)});return()=>n.unsubscribe()})}const qs=ye.createIdentifier("core.resource-manager.service"),Zi={[Ie.Editor]:"Editor",[Ie.Owner]:"Owner",[Ie.Reader]:"Reader",[Ie.UNRECOGNIZED]:"UNRECOGNIZED"},Ms=e=>e?{userID:`${Zi[e]}_${nt(8)}`,name:Zi[e],avatar:""}:{userID:"",name:"",avatar:"",anonymous:!0,canBindAnonymous:!1},dR=(e,t)=>e.startsWith(Zi[t]);class Mr extends Xe{constructor(){super(...arguments);C(this,"_model",new Map);C(this,"_userChange$",new ae.Subject);C(this,"userChange$",this._userChange$.asObservable());C(this,"_currentUser$",new ae.BehaviorSubject(Ms()));C(this,"currentUser$",this._currentUser$.asObservable())}dispose(){super.dispose(),this._model.clear(),this._userChange$.complete(),this._currentUser$.complete()}getCurrentUser(){return this._currentUser$.getValue()}setCurrentUser(n){this.addUser(n),this._currentUser$.next(n)}addUser(n){this._model.set(n.userID,n),this._userChange$.next({type:"add",user:n})}getUser(n,r){const s=this._model.get(n);if(s)return s;r&&r()}delete(n){const r=this.getUser(n);this._model.delete(n),r&&this._userChange$.next({type:"delete",user:r})}clear(){this._model.clear(),this._userChange$.next({type:"clear"})}list(){return Array.from(this._model.values())}}var fR=Object.getOwnPropertyDescriptor,mR=(e,t,n,r)=>{for(var s=r>1?void 0:r?fR(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Cl=(e,t)=>(n,r)=>t(n,r,e);exports.AuthzIoLocalService=class{constructor(t,n){C(this,"_permissionMap",new Map([]));C(this,"_permissionOverrides",new Map);this._resourceManagerService=t,this._userManagerService=n,this._initSnapshot(),this._initDefaultUser()}_initDefaultUser(){const t=this._userManagerService.getCurrentUser();t&&t.userID||this._userManagerService.setCurrentUser(Ms(Ie.Owner))}_getRole(t){const n=this._userManagerService.getCurrentUser();return n?dR(n.userID,t):!1}_initSnapshot(){this._resourceManagerService.registerPluginResource({toJson:t=>{const n=[...this._permissionMap.keys()].reduce((r,s)=>{const i=this._permissionMap.get(s);return r[s]=i,r},{});return JSON.stringify(n)},parseJson:t=>JSON.parse(t),pluginName:"SHEET_AuthzIoMockService_PLUGIN",businesses:[ve.UNIVER_SHEET,ve.UNIVER_DOC,ve.UNIVER_SLIDE],onLoad:(t,n)=>{for(const r in n)this._permissionMap.set(r,n[r])},onUnLoad:()=>{this._permissionMap.clear()}})}async create(t){const n=nt(8),{objectType:r,selectRangeObject:s,worksheetObject:i}=t,o=s||i,a={objectType:r,unitID:(o==null?void 0:o.unitID)||"",name:(o==null?void 0:o.name)||"",strategies:[{action:6,role:Ie.Owner},{action:16,role:Ie.Owner},{action:17,role:Ie.Owner},{action:18,role:Ie.Owner},{action:19,role:Ie.Owner},{action:33,role:Ie.Owner},{action:34,role:Ie.Owner},{action:35,role:Ie.Owner},{action:36,role:Ie.Owner},{action:37,role:Ie.Owner},{action:38,role:Ie.Owner},{action:39,role:Ie.Owner},{action:40,role:Ie.Owner}],selectRangeObject:s};return this._permissionMap.set(n,a),n}async allowed(t){const{objectID:n,actions:r}=t,s=this._permissionMap.get(n);return s?r.map(o=>{const a=`${n}:${o}`;if(this._permissionOverrides.has(a))return{action:o,allowed:this._permissionOverrides.get(a)};const l=s.strategies.find(c=>c.action===o);return l?{action:o,allowed:this._getRole(l.role)}:{action:o,allowed:this._getRole(Ie.Owner)||this._getRole(Ie.Editor)}}):r.map(a=>({action:a,allowed:this._getRole(Ie.Owner)||this._getRole(Ie.Editor)}))}async batchAllowed(t){const n=await Promise.all(t.map(s=>this.allowed(s)));return t.map((s,i)=>({unitID:s.unitID,objectID:s.objectID,actions:n[i]}))}async list(t){const n=[],r=[{action:6,role:Ie.Owner},{action:16,role:Ie.Owner},{action:17,role:Ie.Owner},{action:18,role:Ie.Owner},{action:19,role:Ie.Owner},{action:33,role:Ie.Owner},{action:34,role:Ie.Owner},{action:35,role:Ie.Owner},{action:36,role:Ie.Owner},{action:37,role:Ie.Owner},{action:38,role:Ie.Owner},{action:39,role:Ie.Owner},{action:40,role:Ie.Owner}];return t.objectIDs.forEach(s=>{const i=this._permissionMap.get(s),o=(i==null?void 0:i.strategies)||r,a={objectID:s,unitID:t.unitID,objectType:(i==null?void 0:i.objectType)||3,name:(i==null?void 0:i.name)||"",shareOn:!1,shareRole:Ie.Owner,shareScope:-1,scope:{read:Ni.AllCollaborator,edit:Ni.AllCollaborator},creator:Ms(Ie.Owner),strategies:o.map(l=>({action:l.action,role:l.role})),actions:t.actions.map(l=>{const c=`${s}:${l}`;if(this._permissionOverrides.has(c))return{action:l,allowed:this._permissionOverrides.get(c)};const u=o.find(h=>h.action===l);if(!u){const h=this._getRole(Ie.Owner)||this._getRole(Ie.Editor);return{action:l,allowed:h}}return{action:l,allowed:this._getRole(u.role)}})};n.push(a)}),n}async listCollaborators(){return[]}async listRoles(){return{roles:[],actions:[]}}async deleteCollaborator(){}async update(t){const{objectID:n,strategies:r}=t,s=this._permissionMap.get(n);s&&r&&(s.strategies=r.map(i=>({action:i.action,role:i.role})),this._permissionMap.set(n,s),r.forEach(i=>{i.role===Ie.Reader?this.setPermissionOverride(n,i.action,!1):(i.role===Ie.Owner||i.role===Ie.Editor)&&this.clearPermissionOverride(n,i.action)}))}setPermissionOverride(t,n,r){const s=`${t}:${n}`;this._permissionOverrides.set(s,r)}clearPermissionOverride(t,n){const r=`${t}:${n}`;this._permissionOverrides.delete(r)}clearAllOverrides(t){const n=[];this._permissionOverrides.forEach((r,s)=>{s.startsWith(`${t}:`)&&n.push(s)}),n.forEach(r=>this._permissionOverrides.delete(r))}async updateCollaborator(){}async createCollaborator(){}async putCollaborators(t){}};exports.AuthzIoLocalService=mR([Cl(0,qs),Cl(1,ye.Inject(Mr))],exports.AuthzIoLocalService);const xh=ye.createIdentifier("IAuthzIoIoService"),gR=ye.createIdentifier("univer.confirm-service");class _R{constructor(){C(this,"confirmOptions$",new ae.Subject)}dispose(){this.confirmOptions$.complete()}open(t){throw new Error("This is not implemented in the test service!")}confirm(t){return Promise.resolve(!0)}close(t){throw new Error("This is not implemented in the test service!")}}const Er="FOCUSING_UNIT",Hn="FOCUSING_SHEET",Cr="FOCUSING_DOC",Rr="FOCUSING_SLIDE",pR="FOCUSING_EDITOR_BUT_HIDDEN",Uh="EDITOR_ACTIVATED",ER="FOCUSING_EDITOR_INPUT_FORMULA",Ph="FOCUSING_FX_BAR_EDITOR",CR="FOCUSING_UNIVER_EDITOR",RR="FOCUSING_EDITOR_INPUT_FORMULA",IR="FOCUSING_COMMENT_EDITOR",SR="FOCUSING_PANEL_EDITOR",OR="FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE",vR="FOCUSING_COMMON_DRAWINGS",wR="FOCUSING_SHAPE_TEXT_EDITOR",bR="FORMULA_EDITOR_ACTIVATED";class kh extends Xe{constructor(){super(...arguments);C(this,"_error$",new ae.Subject);C(this,"error$",this._error$.asObservable())}dispose(){this._error$.complete()}emit(n){this._error$.next({errorKey:n})}}var Ds=(e=>(e.URL="URL",e.UUID="UUID",e.BASE64="BASE64",e))(Ds||{}),Fh=(e=>(e.SUCCUSS="0",e.ERROR_EXCEED_SIZE="1",e.ERROR_IMAGE_TYPE="2",e.ERROR_UPLOAD_COUNT_LIMIT="3",e.ERROR_IMAGE="4",e))(Fh||{});const Qi=ye.createIdentifier("core.image-io.service"),eo=ye.createIdentifier("core.url-image.service"),yR="@univerjs/core",AR="0.17.0",to={name:yR,version:AR};function TR(e="",t=Ur.ZH_CN,n=""){return{id:e,sheetOrder:[],name:n,appVersion:to.version,locale:t,styles:{},sheets:{},resources:[]}}class Hh{constructor(t={}){C(this,"_styles");C(this,"_cacheMap",new Gs(1e5));this._styles=t,this._generateCacheMap()}each(t){return Object.entries(this._styles).forEach(t),this}search(t,n){if(this._cacheMap.has(n))return this._cacheMap.get(n);const r=this._getExistingStyleId(t);return r||"-1"}get(t){return typeof t!="string"?t:(t=String(t),this._styles[t])}add(t,n){const r=nt(6);return this._styles[r]=t,this._cacheMap.set(n,r),r}setValue(t){if(t==null)return;const n=JSON.stringify(t),r=this.search(t,n);return r!=="-1"?r:this.add(t,n)}addCustomStyle(t,n){n!=null&&(this._styles[t]=n,this._cacheMap.set(JSON.stringify(n),t))}remove(t){const n=this._styles[t];n&&(delete this._styles[t],this._cacheMap.delete(JSON.stringify(n)))}toJSON(){return this._styles}getStyleByCell(t){let n;t&&Z.isObject(t.s)?n=t.s:n=(t==null?void 0:t.s)&&this.get(t.s);const r=t==null?void 0:t.interceptorStyle;return r?{...n,...r}:n}_generateCacheMap(){const{_styles:t,_cacheMap:n}=this;for(const r in t){const s=JSON.stringify(t[r]);n.set(s,r)}}_getExistingStyleId(t){const{_styles:n}=this;for(const r in n)if(Z.diffValue(n[r],t))return r;return null}}const NR=(e,t)=>t.length===e.length&&!e.some(n=>t.some(r=>!Wt.equals(r,n))),MR=(e,t)=>t.length===e.length&&e.every((n,r)=>{const s=t[r];return s.unitId===n.unitId&&s.sheetId===n.sheetId&&Wt.equals(n.range,s.range)}),no={t:0,b:2,l:2,r:2},DR=e=>({sbr:.6,sbo:e,spr:.6,spo:e}),Rl=90;function Ir(e,t,n={}){const r=e.length,{textRotation:s,paddingData:i,horizontalAlign:o=At.UNSPECIFIED,verticalAlign:a=mn.UNSPECIFIED,wrapStrategy:l=Rn.UNSPECIFIED,cellValueType:c}=n,{t:u,r:h,b:d,l:f}=i||no,{vertexAngle:g,centerAngle:E}=jh(s),R={id:"d",body:{dataStream:`${e}${Dl}`,textRuns:[{ts:t,st:0,ed:r}],paragraphs:[{startIndex:r,paragraphStyle:{horizontalAlign:o}}],sectionBreaks:[{startIndex:r+1}]},documentStyle:{pageSize:{width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY},marginTop:u,marginBottom:d,marginRight:h,marginLeft:f,renderConfig:{horizontalAlign:o,verticalAlign:a,centerAngle:E,vertexAngle:g,wrapStrategy:l,cellValueType:c}},drawings:{},drawingsOrder:[]};return new Nt(R)}function LR(e){if(!e)return{};const{tr:t,td:n,ht:r,vt:s,tb:i,pd:o}=e;return{textRotation:t,textDirection:n,horizontalAlign:r,verticalAlign:s,wrapStrategy:i,paddingData:o}}function Il(e){if(!e)return{};const{ff:t,fs:n,it:r,bl:s,ul:i,st:o,ol:a,cl:l}=e,c={};return t&&(c.ff=t),n&&(c.fs=n),r&&(c.it=r),s&&(c.bl=s),i&&(c.ul=i),o&&(c.st=o),a&&(c.ol=a),l&&(c.cl=l),c}function Bh(e,t,n){var i;const r=e.getBody();if((i=r.customRanges)!=null&&i.some(o=>o.rangeType===tn.HYPERLINK))return;const s=et.customRange.add({ranges:[{startOffset:0,endOffset:r.dataStream.length-1,collapsed:!1}],rangeId:n,rangeType:tn.HYPERLINK,body:r,properties:{url:t,refId:n}});s&&De.apply(r,s.serialize())}function $h(e){return e!=null}function xR(){return{p:null,s:null,v:null,t:null,f:null,si:null,ref:null,xf:null}}const UR='"Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif';function Sl(e){const t=it.ff,n=it.fs;if(!e){const h=`${n}pt ${t}`;return{fontCache:h,fontString:h,fontSize:n,originFontSize:n,fontFamily:t}}let r=Un.ITALIC;(e.it===0||e.it===void 0)&&(r=Un.NORMAL);let s=Un.BOLD;(e.bl===0||e.bl===void 0)&&(s=Un.NORMAL);let i=n;e.fs&&(i=Math.ceil(e.fs));let o=t;if(e.ff){let h=e.ff;h=h.replace(/"/g,"").replace(/'/g,""),h.indexOf(" ")>-1&&(h=`"${h}"`),h==null&&(h=t),o=h}const{va:a}=e;let l=i;if(a===gn.SUBSCRIPT||a===gn.SUPERSCRIPT){const h=PR(o,l),{sbr:d,spr:f}=h;l*=a===gn.SUBSCRIPT?d:f}const c=`${r} ${s} ${l}pt ${o}`,u=`${c}, ${UR} `;return{fontCache:c,fontString:u,fontSize:l,originFontSize:i,fontFamily:o}}function PR(e,t){return DR(t)}function jh(e){const{a:t=0,v:n=ce.FALSE}=e||{a:0,v:ce.FALSE};let r=0,s=t;return n===ce.TRUE&&(r=Rl,s=Rl),{centerAngle:r,vertexAngle:s}}function _t(e){if(e==null||typeof e!=="object")return e;if(Array.isArray(e)){const s=e.length,i=new Array(s);for(let o=0;o<s;o++)i[o]=_t(e[o]);return i}const n={},r=Object.keys(e);for(let s=0,i=r.length;s<i;s++){const o=r[s];n[o]=_t(e[o])}return n}function Wh(e){if(e==null)return e;const t={};return e.p!==void 0&&(t.p=e.p===null?null:_t(e.p)),e.s!==void 0&&(e.s===null||typeof e.s=="string"?t.s=e.s:t.s=_t(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:_t(e.custom)),t}function kR(e){if(e==null)return e;const t={};return e.p!==void 0&&(t.p=e.p===null?null:_t(e.p)),e.s!==void 0&&(e.s===null||typeof e.s=="string"?t.s=e.s:t.s=_t(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:_t(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 Yh(e){const t={},n=Object.keys(e);for(let r=0,s=n.length;r<s;r++){const i=n[r],o=Number(i),a=e[o];if(a===void 0)continue;const l={},c=Object.keys(a);for(let u=0,h=c.length;u<h;u++){const d=c[u],f=Number(d),g=a[f];g!=null&&(l[f]=Wh(g))}t[o]=l}return t}function Ol(e){const t={},n=Object.keys(e);for(let r=0,s=n.length;r<s;r++){const i=n[r],o=Number(i),a=e[o];if(a===void 0)continue;const l={};"h"in a&&a.h!==void 0&&(l.h=a.h),"ia"in a&&a.ia!==void 0&&(l.ia=a.ia),"ah"in a&&a.ah!==void 0&&(l.ah=a.ah),"hd"in a&&a.hd!==void 0&&(l.hd=a.hd),"w"in a&&a.w!==void 0&&(l.w=a.w),"s"in a&&a.s!==void 0&&(a.s===null||typeof a.s=="string"?l.s=a.s:l.s=_t(a.s)),"custom"in a&&a.custom!==void 0&&(l.custom=a.custom===null?null:_t(a.custom)),t[o]=l}return t}function FR(e){const t=e.length,n=new Array(t);for(let r=0;r<t;r++){const s=e[r];n[r]={startRow:s.startRow,startColumn:s.startColumn,endRow:s.endRow,endColumn:s.endColumn,rangeType:s.rangeType,startAbsoluteRefType:s.startAbsoluteRefType,endAbsoluteRefType:s.endAbsoluteRefType}}return n}function zh(e){const 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:FR(e.mergeData),cellData:Yh(e.cellData),rowData:Ol(e.rowData),columnData:Ol(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=_t(e.defaultStyle)),e.custom!==void 0&&(t.custom=e.custom===null?null:_t(e.custom)),t}class HR{constructor(t,n){C(this,"_columnData",{});this._config=t,this._columnData=n}getColumnData(){return this._columnData}getColVisible(t){const{_columnData:n}=this,r=n[t];return r?r.hd!==ce.TRUE:!0}getColumnStyle(t){var n;return(n=this._columnData[t])==null?void 0:n.s}setColumnStyle(t,n){const r=this.getColumnOrCreate(t);r.s=n}getHiddenCols(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getColVisible(o);s&&a?(s=!1,r.push({rangeType:_e.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!s&&!a&&(s=!0,i=o)}return s&&r.push({startRow:0,endRow:0,startColumn:i,endColumn:n,rangeType:_e.COLUMN}),r}getVisibleCols(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getColVisible(o);s&&!a?(s=!1,r.push({rangeType:_e.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!s&&a&&(s=!0,i=o)}return s&&r.push({startRow:0,endRow:0,startColumn:i,endColumn:n,rangeType:_e.COLUMN}),r}getColumnDatas(t,n){const r={};let s=0;for(let i=t;i<t+n;i++){const o=this.getColumn(i);r[s]=o!=null?o:{w:this._config.defaultColumnWidth,hd:ce.FALSE},s++}return r}getSize(){return Qt(this._columnData)}getColumnWidth(t){var n,r;return(r=(n=this._columnData[t])==null?void 0:n.w)!=null?r:this._config.defaultColumnWidth}setColumnWidth(t,n){const r=this._columnData[t];n===this._config.defaultColumnWidth?r&&(delete r.w,Object.keys(r).length===0&&delete this._columnData[t]):this._columnData[t]=r?{...r,w:n}:{w:n}}getColumn(t){return this._columnData[t]}insertColumnsWithData(t,n,r){const s=n-t+1,i=Object.keys(this._columnData);for(let o=i.length-1;o>=0;o--){const a=Number(i[o]);a>=t&&(this._columnData[a+s]=this._columnData[a],delete this._columnData[a])}for(let o=t;o<=n;o++){const a=r==null?void 0:r[o-t];a!=null&&Object.keys(a).length>0&&(this._columnData[o]={...a})}}removeColumn(t){delete this._columnData[t]}getColumnOrCreate(t){const{_columnData:n}=this,r=n[t];if(r)return r;const s={};return this._columnData[t]=s,s}setCustomMetadata(t,n){const r=this.getColumn(t);r&&(r.custom=n)}getCustomMetadata(t){var n;return(n=this.getColumn(t))==null?void 0:n.custom}}const BR=2e3;class $R{constructor(t,n,r){C(this,"_rowData");this._config=t,this._viewModel=n,this._rowData=r}getRowData(){return this._rowData}getRowStyle(t){var n;return(n=this._rowData[t])==null?void 0:n.s}setRowStyle(t,n){const r=this.getRowOrCreate(t);r.s=n}getRowDatas(t,n){const r={};let s=0;for(let i=t;i<t+n;i++){const o=this.getRow(i);r[s]=o!=null?o:{h:this._config.defaultRowHeight,hd:ce.FALSE},s++}return r}getRowHeight(t,n=1){const{_rowData:r}=this,s=this._config;let i=0;for(let o=0;o<n;o++){const a=r[o+t]||{hd:ce.FALSE,h:s.defaultRowHeight},{ia:l,ah:c,h:u=s.defaultRowHeight}=a;i+=(l==null||l===ce.TRUE)&&typeof c=="number"?c:u}return i}setRowHeight(t,n){const r=this._rowData[t];if(n===this._config.defaultRowHeight)r&&(delete r.h,Object.keys(r).length===0&&delete this._rowData[t]);else{const s=Math.min(n,BR);this._rowData[t]=r?{...r,h:s}:{h:s}}}getRow(t){return this._rowData[t]}insertRowsWithData(t,n,r){const s=n-t+1,i=Object.keys(this._rowData);for(let o=i.length-1;o>=0;o--){const a=Number(i[o]);a>=t&&(this._rowData[a+s]=this._rowData[a],delete this._rowData[a])}for(let o=t;o<=n;o++){const a=r==null?void 0:r[o-t];a!=null&&Object.keys(a).length>0&&(this._rowData[o]={...a})}}removeRow(t){delete this._rowData[t]}getRowOrCreate(t){const{_rowData:n}=this,r=n[t];if(r)return r;const s={};return n[t]=s,s}getHiddenRows(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getRowRawVisible(o);s&&a?(s=!1,r.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:_e.ROW})):!s&&!a&&(s=!0,i=o)}return s&&r.push({startRow:i,endRow:n,startColumn:0,endColumn:0,rangeType:_e.ROW}),r}getVisibleRows(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getRowRawVisible(o);s&&!a?(s=!1,r.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:_e.ROW})):!s&&a&&(s=!0,i=o)}return s&&r.push({startRow:i,endRow:n,startColumn:0,endColumn:0,rangeType:_e.ROW}),r}getRowRawVisible(t){const n=this.getRow(t);return n?n.hd!==ce.TRUE:!0}getSize(){return Qt(this._rowData)}setCustomMetadata(t,n){const r=this.getRow(t);r&&(r.custom=n)}getCustomMetadata(t){var n;return(n=this.getRow(t))==null?void 0:n.custom}}const jR="DEFAULT_WORKSHEET_ROW_COUNT",Vh=1e3,WR="DEFAULT_WORKSHEET_COLUMN_COUNT",Kh=20,YR="DEFAULT_WORKSHEET_ROW_HEIGHT",Gh=24,zR="DEFAULT_WORKSHEET_COLUMN_WIDTH",Xh=88,VR="DEFAULT_WORKSHEET_ROW_TITLE_WIDTH",qh=46,KR="DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT",Jh=20;function Zh(e){const t={name:"Sheet1",id:"sheet-01",tabColor:"",hidden:ce.FALSE,rowCount:Vh,columnCount:Kh,zoomRatio:1,freeze:{xSplit:0,ySplit:0,startRow:-1,startColumn:-1},scrollTop:0,scrollLeft:0,defaultColumnWidth:Xh,defaultRowHeight:Gh,mergeData:[],cellData:{},rowData:{},columnData:{},showGridlines:ce.TRUE,rowHeader:{width:qh,hidden:ce.FALSE},columnHeader:{height:Jh,hidden:ce.FALSE},rightToLeft:ce.FALSE};return Object.keys(t).forEach(n=>{const r=n;typeof e[r]>"u"&&(e[r]=t[r])}),e}class GR extends Xe{constructor(n){super();C(this,"_cellCache",new Map);C(this,"_rowCache",new Map);C(this,"_columnCache",new Map);C(this,"_hasRow",!1);C(this,"_hasColumn",!1);C(this,"_hasAll",!1);C(this,"_allIndex",-1);C(this,"_mergeData");C(this,"_rangeMap",new Gs(5e4));this._init(n.concat())}_init(n){this._mergeData=n,this._createCache(n)}_clearCache(){this._cellCache.clear(),this._rowCache.clear(),this._columnCache.clear(),this._hasAll=!1,this._allIndex=-1,this._rangeMap.clear(),this._hasColumn=!1,this._hasRow=!1}_createCache(n){let r=0;for(const s of n){const{rangeType:i}=s;i===_e.ROW?this._createRowCache(s,r):i===_e.COLUMN?this._createColumnCache(s,r):i===_e.ALL?this._createCellAllCache(r):this._createCellCache(s,r),r++}}rebuild(n){this._clearCache(),this._init(n.concat())}_createRowCache(n,r){const{startRow:s,endRow:i}=n;for(let o=s;o<=i;o++)this._rowCache.set(o,r),this._hasRow=!0}_createColumnCache(n,r){const{startColumn:s,endColumn:i}=n;for(let o=s;o<=i;o++)this._columnCache.set(o,r),this._hasColumn=!0}_createCellAllCache(n){this._hasAll=!0,this._allIndex=n}_createCellCache(n,r){for(let s=n.startRow;s<=n.endRow;s++){let i=this._cellCache.get(s);i==null&&(i=new Map,this._cellCache.set(s,i));for(let o=n.startColumn;o<=n.endColumn;o++)i.set(o,r)}}add(n){this._mergeData.push(n),this._clearCache(),this._createCache(this._mergeData)}remove(n,r){const s=this._getMergeDataIndex(n,r);s!==-1&&(this._mergeData.splice(s,1),this._clearCache(),this._createCache(this._mergeData))}getMergedCell(n,r){const s=this._getMergeDataIndex(n,r);return s!==-1?this._mergeData[s]:null}getMergeDataIndex(n,r){return this._getMergeDataIndex(n,r)}isRowContainsMergedCell(n){return this._hasAll||!Z.isEmptyObject(this._columnCache)?!0:this._mergeData.some(r=>r.startRow<=n&&n<=r.endRow)}isColumnContainsMergedCell(n){return this._hasAll||!Z.isEmptyObject(this._rowCache)?!0:this._mergeData.some(r=>r.startColumn<=n&&n<=r.endColumn)}getMergedCellRange(n,r,s,i){const o=[],a=`${n}-${r}-${s}-${i}`;if(this._rangeMap.has(a))return this._getRangeFromCache(a);let l=0;const c=[];for(const u of this._mergeData||[])Wt.intersects(u,{startRow:n,endRow:s,startColumn:r,endColumn:i})&&(o.push({...u}),c.push(l)),l++;return this._rangeMap.set(a,c),o}_getRangeFromCache(n){const r=this._rangeMap.get(n)||[],s=[];for(const i of r)s.push({...this._mergeData[i]});return s}_getMergeDataIndex(n,r){var i;if(this._hasAll)return this._allIndex;if(this._hasRow){const o=this._rowCache.get(n);if(o!==void 0)return o}if(this._hasColumn){const o=this._columnCache.get(r);if(o!==void 0)return o}const s=(i=this._cellCache.get(n))==null?void 0:i.get(r);return s!==void 0?s:-1}getMergeDataSnapshot(){return this._mergeData}dispose(){this._clearCache(),this._mergeData=[]}}class Qh extends Xe{constructor(n){super();C(this,"_cellContentInterceptor",null);C(this,"_rowFilteredInterceptor",null);this.getRawCell=n}dispose(){super.dispose(),this._cellContentInterceptor=null,this._rowFilteredInterceptor=null}getCell(n,r,s,i){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,r,xn.Value|xn.Style,s,i):this.getRawCell(n,r)}getCellValueOnly(n,r){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,r,xn.Value):this.getRawCell(n,r)}getCellStyleOnly(n,r){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,r,xn.Style):this.getRawCell(n,r)}getRowFiltered(n){var r,s;return(s=(r=this._rowFilteredInterceptor)==null?void 0:r.getRowFiltered(n))!=null?s:!1}registerCellContentInterceptor(n){if(this._cellContentInterceptor)throw new Error("[SheetViewModel]: Interceptor already registered.");return this._cellContentInterceptor=n,Ye(()=>this._cellContentInterceptor=null)}registerRowFilteredInterceptor(n){if(this._rowFilteredInterceptor)throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowFilteredInterceptor=n,Ye(()=>this._rowFilteredInterceptor=null)}}const vl={isDeepClone:!1,displayRawFormula:!1,ignoreTextRotation:!1};class Dr{constructor(t,n,r){C(this,"_sheetId");C(this,"_snapshot");C(this,"_cellData");C(this,"_rowManager");C(this,"_columnManager");C(this,"_viewModel");C(this,"_spanModel");C(this,"_isRowStylePrecedeColumnStyle",!0);C(this,"_getCellHeight");var a;this.unitId=t,this._styles=r,this._snapshot=Zh(n);const{columnData:s,rowData:i,cellData:o}=this._snapshot;this._sheetId=(a=this._snapshot.id)!=null?a:nt(6),this._cellData=new ct(o),this._viewModel=new Qh((l,c)=>this.getCellRaw(l,c)),this._rowManager=new $R(this._snapshot,this._viewModel,i),this._columnManager=new HR(this._snapshot,s),this._spanModel=new GR(this._snapshot.mergeData)}__interceptViewModel(t){t(this._viewModel)}__registerGetCellHeight(t){return this._getCellHeight=t,Ye(()=>{this._getCellHeight=null})}getSnapshot(){return this._snapshot}getCellHeight(t,n){return this._getCellHeight?this._getCellHeight(t,n):this._snapshot.defaultRowHeight}setMergeData(t){this._snapshot.mergeData=t,this.getSpanModel().rebuild(t)}getSpanModel(){return this._spanModel}setIsRowStylePrecedeColumnStyle(t){this._isRowStylePrecedeColumnStyle=t}getStyleDataByHash(t){return{...this._styles.get(t)}}setStyleData(t){return this._styles.setValue(t)}getColumnStyle(t,n=!1){return n?this._columnManager.getColumnStyle(t):this._styles.get(this._columnManager.getColumnStyle(t))}setColumnStyle(t,n){this._columnManager.setColumnStyle(t,n)}getRowStyle(t,n=!1){return n?this._rowManager.getRowStyle(t):this._styles.get(this._rowManager.getRowStyle(t))}setRowStyle(t,n){this._rowManager.setRowStyle(t,n)}getDefaultCellStyle(){return this._snapshot.defaultStyle}getDefaultCellStyleInternal(){const t=this._snapshot.defaultStyle;return this._styles.get(t)}setDefaultCellStyle(t){this._snapshot.defaultStyle=t}getCellStyle(t,n){const r=this.getCell(t,n);if(r){const s=r.s;return typeof s=="string"?this._styles.get(s):s}return null}getComposedCellStyle(t,n,r){const s=this.getDefaultCellStyleInternal(),i=this.getRowStyle(t),o=this.getColumnStyle(n),a=this.getCell(t,n),l=this._styles.getStyleByCell(a);return(r!=null?r:this._isRowStylePrecedeColumnStyle)?or(s,o,i,a==null?void 0:a.themeStyle,l):or(s,i,o,a==null?void 0:a.themeStyle,l)}getComposedCellStyleByCellData(t,n,r,s){const i=this.getDefaultCellStyleInternal(),o=this.getRowStyle(t),a=this.getColumnStyle(n),l=this._styles.getStyleByCell(r);return(s!=null?s:this._isRowStylePrecedeColumnStyle)?or(i,a,o,r==null?void 0:r.themeStyle,l):or(i,o,a,r==null?void 0:r.themeStyle,l)}getComposedCellStyleWithoutSelf(t,n,r,s){const i=r===void 0?this.getComposedCellStyle(t,n,s):this.getComposedCellStyleByCellData(t,n,r,s),o=this.getCellRaw(t,n);if(!o||!o.s)return i;const a=typeof o.s=="string"?this._styles.get(o.s):o.s;if(!a)return i;for(const l in a)l in i&&delete i[l];return i}getCellMatrix(){return this._cellData}getCellMatrixPrintRange(){const t=this.getCellMatrix(),n=this.getMergeData();let r=-1,s=-1,i=-1,o=-1,a=!1,l=!1;return t.forEach((c,u)=>{Object.keys(u).forEach(h=>{const d=+h,f=t.getValue(c,d),g=f!=null&&f.s?this._styles.get(f.s):null,E=(g==null?void 0:g.bd)&&(g.bd.b||g.bd.l||g.bd.r||g.bd.t||g.bd.bc_tr||g.bd.bl_tr||g.bd.ml_tr||g.bd.tl_bc||g.bd.tl_br||g.bd.tl_mr);(f&&(f.v!==null&&f.v!==void 0&&f.v!==""||f.p)||g!=null&&g.bg||E)&&(a?r=Math.min(r,c):(r=c,a=!0),s=Math.max(s,c),l?i=Math.min(i,d):(l=!0,i=d),o=Math.max(o,d))})}),n.forEach(c=>{a?r=Math.min(r,c.startRow):(r=c.startRow,a=!0),s=Math.max(s,c.endRow),l?i=Math.min(i,c.startColumn):(i=c.startColumn,a=!0),o=Math.max(o,c.endColumn)}),!a||!l?null:{startColumn:i,startRow:r,endColumn:o,endRow:s}}getRowManager(){return this._rowManager}getUnitId(){return this.unitId}getSheetId(){return this._sheetId}getColumnManager(){return this._columnManager}getName(){return this._snapshot.name}clone(){const{_snapshot:t}=this,n=zh(t);return new Dr(this.unitId,n,this._styles)}getMergeData(){return this._spanModel.getMergeDataSnapshot()}getMergedCell(t,n){return this._spanModel.getMergedCell(t,n)}getMergedCellRange(t,n,r,s){return this._spanModel.getMergedCellRange(t,n,r,s)}isRowContainsMergedCell(t){return this._spanModel.isRowContainsMergedCell(t)}isColumnContainsMergedCell(t){return this._spanModel.isColumnContainsMergedCell(t)}getCellInfoInMergeData(t,n){const r=this.getMergedCell(t,n);let s=!1,i=!1,o=t,a=n,l=t,c=n;if(r){const{startRow:u,endRow:h,startColumn:d,endColumn:f}=r;t===u&&n===d?(o=h,a=f,l=u,c=d,i=!0):t>=u&&t<=h&&n>=d&&n<=f&&(o=h,a=f,l=u,c=d,s=!0)}return{actualRow:t,actualColumn:n,isMergedMainCell:i,isMerged:s,endRow:o,endColumn:a,startRow:l,startColumn:c}}getCell(t,n){return t<0||n<0?null:this._viewModel.getCell(t,n)}getCellValueOnly(t,n){return t<0||n<0?null:this._viewModel.getCellValueOnly(t,n)}getCellStyleOnly(t,n){return t<0||n<0?null:this._viewModel.getCellStyleOnly(t,n)}getCellRaw(t,n){return this.getCellMatrix().getValue(t,n)}getCellWithFilteredInterceptors(t,n,r,s){return this._viewModel.getCell(t,n,r,s)}getRowFiltered(t){return this._viewModel.getRowFiltered(t)}getRangeFilterRows(t){const n=[];for(let r=t.startRow;r<=t.endRow;r++)this.getRowFiltered(r)&&n.push(r);return n}getMatrixWithMergedCells(t,n,r,s,i=Pn.Raw){const o=this.getCellMatrix(),a=this._spanModel.getMergedCellRange(t,n,r,s),l=new ct;return Vi(t,r,n,s).forEach((c,u)=>{var d;let h;if(i===Pn.Raw)h=this.getCellRaw(c,u);else if(i===Pn.Intercepted)h=this.getCell(c,u);else if(i===Pn.Both){const f=this.getCellRaw(c,u);if(f){h={...f};const g=(d=this.getCell(c,u))==null?void 0:d.v;$h(g)&&h&&(h.displayV=String(g))}}h&&l.setValue(c,u,h)}),a.forEach(c=>{const{startColumn:u,startRow:h,endColumn:d,endRow:f}=c;Vi(h,f,u,d).forEach((g,E)=>{g===h&&E===u&&l.setValue(g,E,{...o.getValue(g,E),rowSpan:f-h+1,colSpan:d-u+1}),(g!==h||E!==u)&&l.realDeleteValue(g,E)})}),l}getRange(t,n,r,s){return typeof t=="object"?new Vn(this,t,{getStyles:()=>this._styles}):new Vn(this,{startRow:t,startColumn:n,endColumn:s||n,endRow:r||t},{getStyles:()=>this._styles})}getScrollLeftTopFromSnapshot(){return{scrollLeft:this._snapshot.scrollLeft,scrollTop:this._snapshot.scrollTop}}getZoomRatio(){return this._snapshot.zoomRatio||1}getConfig(){return this._snapshot}getFreeze(){return this._snapshot.freeze}getMaxColumns(){const{_snapshot:t}=this,{columnCount:n}=t;return n}getMaxRows(){const{_snapshot:t}=this,{rowCount:n}=t;return n}getRowCount(){return this._snapshot.rowCount}setRowCount(t){this._snapshot.rowCount=t}getColumnCount(){return this._snapshot.columnCount}setColumnCount(t){this._snapshot.columnCount=t}isSheetHidden(){return this._snapshot.hidden}hasHiddenGridlines(){const{_snapshot:t}=this,{showGridlines:n}=t;return n===0}getGridlinesColor(){return this.getConfig().gridlinesColor}getTabColor(){const{_snapshot:t}=this,{tabColor:n}=t;return n}getColumnWidth(t){return this.getColumnManager().getColumnWidth(t)}getRowHeight(t){return this._viewModel.getRowFiltered(t)?0:this.getRowManager().getRowHeight(t)}isRowFiltered(t){return this._viewModel.getRowFiltered(t)}getRowVisible(t){return!this.isRowFiltered(t)&&this.getRowRawVisible(t)}getRowRawVisible(t){return this.getRowManager().getRowRawVisible(t)}getHiddenRows(t,n){const r=this.getMaxColumns()-1,s=this._rowManager.getHiddenRows(t,n);return s.forEach(i=>i.endColumn=r),s}getColVisible(t){return this._columnManager.getColVisible(t)}getHiddenCols(t,n){const r=this.getMaxRows()-1,s=this._columnManager.getHiddenCols(t,n);return s.forEach(i=>i.endRow=r),s}getVisibleRows(){const t=this.getRowCount();return this._rowManager.getVisibleRows(0,t-1)}getVisibleCols(){const t=this.getColumnCount();return this._columnManager.getVisibleCols(0,t-1)}isRightToLeft(){const{_snapshot:t}=this,{rightToLeft:n}=t;return n}getLastRowWithContent(){return this._cellData.getRealRowRange().endRow}getLastColumnWithContent(){return this.getDataRealRange().endColumn}getDataRealRange(){return this._cellData.getRealRange()}getDataRangeScope(){return this._cellData.getStartEndScope()}cellHasValue(t){return t&&(t.v!==void 0||t.f!==void 0||t.p!==void 0)}iterateByRow(t,n=!0){const{startRow:r,startColumn:s,endRow:i,endColumn:o}=t,a=this;return{[Symbol.iterator]:()=>{let l=r,c=s;return{next(){for(;;){if(c>o&&(l+=1,c=s),l>i)return{done:!0,value:void 0};const u=a.getCell(l,c),h=!u,d=a.getMergedCell(l,c);if(d){if(l!==d.startRow||c!==d.startColumn){c=d.endColumn+1;continue}if(h&&n){c=d.endColumn+1;continue}const g={row:l,col:c,value:u};return g.colSpan=d.endColumn-d.startColumn+1,g.rowSpan=d.endRow-d.startRow+1,c=d.endColumn+1,{done:!1,value:g}}if(h&&n)c+=1;else{const f={row:l,col:c,value:u};return c+=1,{done:!1,value:f}}}}}}}}iterateByColumn(t,n=!0,r=!0){const{startRow:s,startColumn:i,endRow:o,endColumn:a}=t,l=this;return{[Symbol.iterator]:()=>{let c=s,u=i;return{next(){for(;;){if(c>o&&(u+=1,c=s),u>a)return{done:!0,value:void 0};const h=l.getMergedCell(c,u);if(h){const g=c!==h.startRow,E=g||u!==h.startColumn;if(r&&E||!r&&g){c=h.endRow+1;continue}const R=l.getCell(h.startRow,h.startColumn);if(!R&&n){c=h.endRow+1;continue}const F={row:c,col:h.startColumn,value:R};return F.colSpan=h.endColumn-h.startColumn+1,F.rowSpan=h.endRow-h.startRow+1,c=h.endRow+1,{done:!1,value:F}}const d=l.getCell(c,u);if(!d&&n)c+=1;else{const g={row:c,col:u,value:d};return c+=1,{done:!1,value:g}}}}}}}}getCellDocumentModel(t,n,r=vl){var E;if(!t)return;const{isDeepClone:s,displayRawFormula:i,ignoreTextRotation:o}={...vl,...r};let a,l="document";const c=LR(n),u=o?it.tr:c.textRotation||it.tr;let h=c.horizontalAlign||it.ht;const d=c.verticalAlign||it.vt,f=c.wrapStrategy||it.tb,g=c.paddingData||no;if(t.f&&i)a=Ir(t.f.toString(),{},{verticalAlign:d}),h=it.ht;else if(t.p){const{centerAngle:R,vertexAngle:b}=jh(u);a=this._updateConfigAndGetDocumentModel(s?Z.deepClone(t.p):t.p,h,g,{horizontalAlign:h,verticalAlign:d,centerAngle:R,vertexAngle:b,wrapStrategy:f,zeroWidthParagraphBreak:1})}else if(t.v!=null){const R=Il(n);l=Sl(R).fontCache;let b=ed(t);t.t===Zt.FORCE_STRING&&i&&(b=`'${b}`),a=Ir(b,R,{...c,textRotation:u,cellValueType:t.t})}return a&&t.linkUrl&&t.linkId&&Bh(a,t.linkUrl,t.linkId),{documentModel:a,fontString:l,textRotation:u,wrapStrategy:f,verticalAlign:d,horizontalAlign:h,paddingData:g,fill:(E=n==null?void 0:n.bg)==null?void 0:E.rgb}}_updateConfigAndGetDocumentModel(t,n,r,s){var o,a,l,c,u;if(!s||!((o=t.body)!=null&&o.dataStream))return;t.documentStyle||(t.documentStyle={}),t.documentStyle.marginTop=(a=r.t)!=null?a:0,t.documentStyle.marginBottom=(l=r.b)!=null?l:2,t.documentStyle.marginLeft=(c=r.l)!=null?c:2,t.documentStyle.marginRight=(u=r.r)!=null?u:2,t.documentStyle.pageSize={width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY},t.documentStyle.renderConfig={...t.documentStyle.renderConfig,...s};const i=t.body.paragraphs||[];for(const h of i)h.paragraphStyle||(h.paragraphStyle={}),h.paragraphStyle.horizontalAlign=n;return new Nt(t)}getBlankCellDocumentModel(t,n,r){const s=this.getComposedCellStyleByCellData(n,r,t),i=Il(s),o=this.getCellDocumentModel(t,s,{ignoreTextRotation:!0});if(o!=null)return o.documentModel==null&&(o.documentModel=Ir("",i)),o;const a="";let l="document";const c=it.tr,u=it.ht,h=it.vt,d=it.tb,f=no;return l=Sl({}).fontCache,{documentModel:Ir(a,i),fontString:l,textRotation:c,wrapStrategy:d,verticalAlign:h,horizontalAlign:u,paddingData:f}}getCellDocumentModelWithFormula(t,n,r){const s=this.getComposedCellStyleByCellData(n,r,t);return this.getCellDocumentModel(t,s,{isDeepClone:!0,displayRawFormula:!0,ignoreTextRotation:!0})}getCustomMetadata(){return this._snapshot.custom}setCustomMetadata(t){this._snapshot.custom=t}}function ed(e){var r,s;if(!e)return"";const t=(s=(r=e.p)==null?void 0:r.body)==null?void 0:s.dataStream;if(t)return et.transform.getPlainText(t);const n=e.v;return typeof n=="string"?e.t===Zt.BOOLEAN?n.toUpperCase():n.replace(/[\r\n]/g,""):typeof n=="number"?e.t===Zt.BOOLEAN?n?"TRUE":"FALSE":n.toString():typeof n=="boolean"?n?"TRUE":"FALSE":""}function XR(e){if(e===null)return"";if(e!=null&&e.p){const t=e==null?void 0:e.p.body;if(t==null)return"";const n=t.dataStream;return et.transform.getPlainText(n)}return e==null?void 0:e.v}var qR=Object.getOwnPropertyDescriptor,JR=(e,t,n,r)=>{for(var s=r>1?void 0:r?qR(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},ZR=(e,t)=>(n,r)=>t(n,r,e);function QR(e,t){return`${e.getUnitId()}|${t.getSheetId()}`}exports.Workbook=class extends Bs{constructor(n={},r){super();C(this,"type",ve.UNIVER_SHEET);C(this,"_sheetCreated$",new ae.Subject);C(this,"sheetCreated$",this._sheetCreated$.asObservable());C(this,"_sheetDisposed$",new ae.Subject);C(this,"sheetDisposed$",this._sheetDisposed$.asObservable());C(this,"_activeSheet$",new ae.BehaviorSubject(null));C(this,"activeSheet$",this._activeSheet$.asObservable());C(this,"_worksheets");C(this,"_styles");C(this,"_snapshot");C(this,"_unitId");C(this,"_count");C(this,"_name$");C(this,"name$");this._logService=r;const s=TR();Z.isEmptyObject(n)?this._snapshot=s:this._snapshot=Z.commonExtend(s,n);const{styles:i}=this._snapshot;(this._snapshot.id==null||this._snapshot.id.length===0)&&(this._snapshot.id=nt(6)),this._unitId=this._snapshot.id,this._styles=new Hh(i),this._count=1,this._worksheets=new Map,this._name$=new ae.BehaviorSubject(n.name||""),this.name$=this._name$.asObservable(),this._parseWorksheetSnapshots()}get _activeSheet(){return this._activeSheet$.getValue()}get name(){return this._name$.getValue()}static isIRangeType(n){return typeof n=="string"||"startRow"in n||"row"in n}dispose(){super.dispose(),this._sheetCreated$.complete(),this._sheetDisposed$.complete(),this._activeSheet$.complete(),this._name$.complete(),Array.from(this._worksheets.keys()).forEach(r=>{this._removeSheet(r)})}save(){return Z.deepClone(this._snapshot)}getSnapshot(){return this._snapshot}getName(){return this._snapshot.name}setName(n){this._name$.next(n),this._snapshot.name=n}getUnitId(){return this._unitId}getRev(){var n;return(n=this._snapshot.rev)!=null?n:1}incrementRev(){this._snapshot.rev=this.getRev()+1}setRev(n){this._snapshot.rev=n}addWorksheet(n,r,s){const{sheets:i,sheetOrder:o}=this._snapshot;if(i[n])return!1;i[n]=s,o.splice(r,0,n),this.ensureSheetOrderUnique();const a=new Dr(this._unitId,s,this._styles);return this._worksheets.set(n,a),this._sheetCreated$.next(a),!0}getSheetOrders(){return this._snapshot.sheetOrder}ensureSheetOrderUnique(){const n=new Set,r=[];for(const s of this._snapshot.sheetOrder)n.has(s)||(n.add(s),r.push(s));this._snapshot.sheetOrder=r,n.clear()}getWorksheets(){return this._worksheets}getActiveSpreadsheet(){return this}getStyles(){return this._styles}addStyles(n){Object.entries(n).forEach(([r,s])=>{this._styles.addCustomStyle(r,s)})}removeStyles(n){n.forEach(r=>{this._styles.remove(r)})}getConfig(){return this._snapshot}getIndexBySheetId(n){const{sheetOrder:r}=this._snapshot;return r.findIndex(s=>s===n)}getActiveSheet(n){if(!this._activeSheet&&typeof n>"u")throw new Error(`[Workbook]: no active Worksheet on Workbook ${this._unitId}!`);return this._activeSheet}ensureActiveSheet(){const n=this._activeSheet;if(n)return n;const r=this._snapshot.sheetOrder;for(let i=0,o=r.length;i<o;i++){const a=this._worksheets.get(r[i]);if(a&&a.isSheetHidden()!==ce.TRUE)return this.setActiveSheet(a),a}const s=this._worksheets.get(r[0]);return this.setActiveSheet(s),s}setActiveSheet(n){this._activeSheet$.next(n)}_removeSheet(n){const r=this._worksheets.get(n);return r?(this._worksheets.delete(n),this._snapshot.sheetOrder.splice(this._snapshot.sheetOrder.indexOf(n),1),this.ensureSheetOrderUnique(),this._sheetDisposed$.next(r),!0):!1}removeSheet(n){const r=this._removeSheet(n);return r&&delete this._snapshot.sheets[n],r}getActiveSheetIndex(){const{sheetOrder:n}=this._snapshot;return n.findIndex(r=>this._worksheets.get(r)===this._activeSheet)}getSheetSize(){return this._snapshot.sheetOrder.length}getSheets(){const{sheetOrder:n}=this._snapshot;return n.map(r=>this._worksheets.get(r))}getSheetsName(){const{sheetOrder:n}=this._snapshot,r=[];return n.forEach(s=>{const i=this._worksheets.get(s);i&&r.push(i.getName())}),r}getSheetIndex(n){const{sheetOrder:r}=this._snapshot;return r.findIndex(s=>n.getSheetId()===s)}getSheetBySheetName(n){const{sheetOrder:r}=this._snapshot,s=r.find(i=>this._worksheets.get(i).getName()===n);return this._worksheets.get(s)}getSheetBySheetId(n){return this._worksheets.get(n)}getSheetByIndex(n){const{sheetOrder:r}=this._snapshot;return this._worksheets.get(r[n])}getHiddenWorksheets(){return this.getSheets().filter(n=>n.getConfig().hidden===ce.TRUE).map(n=>n.getConfig().id)}getUnhiddenWorksheets(){return this.getSheets().filter(n=>n.getConfig().hidden!==ce.TRUE).map(n=>n.getConfig().id)}load(n){this._snapshot=n}checkSheetName(n){return this.getSheetsName().some(s=>s.toLowerCase()===n.toLowerCase())}uniqueSheetName(n="Sheet1"){let r=n;for(;this.checkSheetName(r);)r=n+this._count,this._count++;return r}generateNewSheetName(n){let r=n+this._count;for(;this.checkSheetName(r);)r=n+this._count,this._count++;return r}_parseWorksheetSnapshots(){const{_snapshot:n,_worksheets:r}=this,{sheets:s,sheetOrder:i}=n;if(Z.isEmptyObject(s)){const o=nt();s[o]={id:o}}for(const o in s){const a=s[o],{name:l}=a;a.name=this.uniqueSheetName(l),a.name!==l&&this._logService.debug("[Workbook]",`The worksheet name ${l} is duplicated, we changed it to ${a.name}. Please fix the problem in your snapshot.`);const c=new Dr(this._unitId,a,this._styles);r.set(o,c),i.includes(o)||i.push(o)}this.ensureSheetOrderUnique(),this.ensureActiveSheet()}getCustomMetadata(){return this._snapshot.custom}setCustomMetadata(n){this._snapshot.custom=n}};exports.Workbook=JR([ZR(1,gt)],exports.Workbook);class ca extends Bs{constructor(n){var r;super();C(this,"type",ve.UNIVER_SLIDE);C(this,"_activePage$",new ae.BehaviorSubject(null));C(this,"activePage$",this._activePage$.asObservable());C(this,"_name$");C(this,"name$");C(this,"_snapshot");C(this,"_unitId");this._snapshot={...th,...n},this._unitId=(r=this._snapshot.id)!=null?r:nt(6),this._name$=new ae.BehaviorSubject(this._snapshot.title),this.name$=this._name$.asObservable()}get _activePage(){var r,s;const n=this._activePage$.getValue();if(!n){const i=(r=this.getPageOrder())==null?void 0:r[0];return i?(s=this.getPages())==null?void 0:s[i]:null}return n}setName(n){var r;this._snapshot.title=n,this._name$.next(n),this._unitId=(r=this._snapshot.id)!=null?r:nt(6)}getRev(){return 0}incrementRev(){}setRev(n){}getSnapshot(){return this._snapshot}getUnitId(){return this._unitId}getPages(){var n;return(n=this._snapshot.body)==null?void 0:n.pages}getPageOrder(){var n;return(n=this._snapshot.body)==null?void 0:n.pageOrder}getPage(n){const r=this.getPages();return r==null?void 0:r[n]}getElementsByPage(n){var r;return(r=this.getPage(n))==null?void 0:r.pageElements}getElement(n,r){var s;return(s=this.getElementsByPage(n))==null?void 0:s[r]}getPageSize(){return this._snapshot.pageSize}getBlankPage(){const n=nt(6);return{id:n,pageType:Ro.SLIDE,zIndex:10,title:n,description:"",pageBackgroundFill:{rgb:"rgb(255,255,255)"},pageElements:{}}}setActivePage(n){this._activePage$.next(n)}getActivePage(){return this._activePage}updatePage(n,r){this._snapshot.body&&(this._snapshot.body.pages[n]=r)}appendPage(n){var i;if(!this._snapshot.body)return;this._snapshot.body.pages[n.id]=n;const r=this._activePage,s=this._snapshot.body.pageOrder.indexOf((i=r==null?void 0:r.id)!=null?i:"");this._snapshot.body.pageOrder.splice(s+1,0,n.id)}}var eI=Object.getOwnPropertyDescriptor,tI=(e,t,n,r)=>{for(var s=r>1?void 0:r?eI(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Si=(e,t)=>(n,r)=>t(n,r,e);const Kn=ye.createIdentifier("univer.current");exports.UniverInstanceService=class extends Xe{constructor(n,r,s){super();C(this,"_unitsByType",new Map);C(this,"_createHandler");C(this,"_ctorByType",new Map);C(this,"_currentUnits",new Map);C(this,"_currentUnits$",new ae.BehaviorSubject(this._currentUnits));C(this,"currentUnits$",this._currentUnits$.asObservable());C(this,"_unitAdded$",new ae.Subject);C(this,"unitAdded$",this._unitAdded$.asObservable());C(this,"_unitDisposed$",new ae.Subject);C(this,"unitDisposed$",this._unitDisposed$.asObservable());C(this,"_focused$",new ae.BehaviorSubject(null));C(this,"focused$",this._focused$.asObservable());this._injector=n,this._contextService=r,this._logService=s}dispose(){super.dispose(),this._focused$.complete(),this._currentUnits$.complete(),this._unitAdded$.complete(),this._currentUnits.forEach(n=>n==null?void 0:n.dispose()),this._currentUnits.clear(),this._unitsByType.clear()}__setCreateHandler(n){this._createHandler=n}createUnit(n,r,s){return this._createHandler(n,r,this._ctorByType.get(n),s)}registerCtorForType(n,r){return this._ctorByType.set(n,r),{dispose:()=>{this._ctorByType.delete(n)}}}getCurrentTypeOfUnit$(n){return this.currentUnits$.pipe(ae.map(r=>{var s;return(s=r.get(n))!=null?s:null}),ae.distinctUntilChanged())}getCurrentUnitForType(n){return this._currentUnits.get(n)}getCurrentUnitOfType(n){return this.getCurrentUnitForType(n)}setCurrentUnitForType(n){const r=this._getUnitById(n);if(!r)throw new Error(`[UniverInstanceService]: no document with unitId ${n}!`);this._currentUnits.set(r[1],r[0]),this._currentUnits$.next(this._currentUnits)}getTypeOfUnitAdded$(n){return this._unitAdded$.pipe(ae.filter(r=>r.type===n))}__addUnit(n,r){var a;this._logService.debug(`[UniverInstanceService]: Adding unit with id ${n.getUnitId()}`);const s=n.type;this._unitsByType.has(s)||this._unitsByType.set(s,[]);const i=this._unitsByType.get(s),o=n.getUnitId();if(i.findIndex(l=>l.getUnitId()===o)!==-1)throw new Error(`[UniverInstanceService]: cannot create a unit with the same unit id: ${o}.`);i.push(n),this._unitAdded$.next(n),((a=r==null?void 0:r.makeCurrent)==null||a)&&this.setCurrentUnitForType(n.getUnitId())}getTypeOfUnitDisposed$(n){return this.unitDisposed$.pipe(ae.filter(r=>r.type===n))}getUnit(n,r){var i;const s=(i=this._getUnitById(n))==null?void 0:i[0];return r&&(s==null?void 0:s.type)!==r?null:s}getCurrentUniverDocInstance(){return this.getCurrentUnitForType(ve.UNIVER_DOC)}getUniverDocInstance(n){return this.getUnit(n,ve.UNIVER_DOC)}getUniverSheetInstance(n){return this.getUnit(n,ve.UNIVER_SHEET)}getAllUnitsForType(n){var r;return(r=this._unitsByType.get(n))!=null?r:[]}changeDoc(n,r){const s=this.getAllUnitsForType(ve.UNIVER_DOC),i=s.find(o=>o.getUnitId()===n);if(i!=null){const o=s.indexOf(i);s.splice(o,1)}this.__addUnit(r)}get focused(){var r;const n=this._focused$.getValue();return n?(r=this._getUnitById(n))==null?void 0:r[0]:null}focusUnit(n){this._focused$.next(n),this.focused instanceof exports.Workbook?(this._contextService.setContextValue(Er,!0),this._contextService.setContextValue(Cr,!1),this._contextService.setContextValue(Hn,!0),this._contextService.setContextValue(Rr,!1),this.setCurrentUnitForType(n)):this.focused instanceof Nt?(this._contextService.setContextValue(Er,!0),this._contextService.setContextValue(Cr,!0),this._contextService.setContextValue(Hn,!1),this._contextService.setContextValue(Rr,!1),this.setCurrentUnitForType(n)):this.focused instanceof ca?(this._contextService.setContextValue(Er,!0),this._contextService.setContextValue(Cr,!1),this._contextService.setContextValue(Hn,!1),this._contextService.setContextValue(Rr,!0),this.setCurrentUnitForType(n)):(this._contextService.setContextValue(Er,!1),this._contextService.setContextValue(Cr,!1),this._contextService.setContextValue(Hn,!1),this._contextService.setContextValue(Rr,!1))}getFocusedUnit(){return this.focused}getUnitType(n){const r=this._getUnitById(n);return r?r[1]:ve.UNRECOGNIZED}disposeUnit(n){this._logService.debug(`[UniverInstanceService]: Disposing unit with id ${n}`);const r=this._getUnitById(n);if(!r)return this._logService.debug(`[UniverInstanceService]: No unit found with id ${n}`),!1;const[s,i]=r,o=this._unitsByType.get(i),a=o.indexOf(s);return o.splice(a,1),this._tryResetCurrentOnRemoval(n,i),this._tryResetFocusOnRemoval(n),this._unitDisposed$.next(s),s.dispose(),!0}_tryResetCurrentOnRemoval(n,r){const s=this.getCurrentUnitForType(r);(s==null?void 0:s.getUnitId())===n&&(this._currentUnits.set(r,null),this._currentUnits$.next(this._currentUnits))}_tryResetFocusOnRemoval(n){var r;((r=this.focused)==null?void 0:r.getUnitId())===n&&this._focused$.next(null)}_getUnitById(n){for(const[r,s]of this._unitsByType){const i=s.find(o=>o.getUnitId()===n);if(i)return[i,r]}}};exports.UniverInstanceService=tI([Si(0,ye.Inject(ye.Injector)),Si(1,Jn),Si(2,ye.Inject(gt))],exports.UniverInstanceService);var Pe=(e=>(e[e.Starting=0]="Starting",e[e.Ready=1]="Ready",e[e.Rendered=2]="Rendered",e[e.Steady=3]="Steady",e))(Pe||{});const td={0:"Starting",1:"Ready",2:"Rendered",3:"Steady"};var nI=Object.getOwnPropertyDescriptor,rI=(e,t,n,r)=>{for(var s=r>1?void 0:r?nI(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},sI=(e,t)=>(n,r)=>t(n,r,e);class nd extends Error{constructor(t){super(`[LifecycleService]: lifecycle stage "${td[t]}" will never be reached!`),this.name="LifecycleUnreachableError"}}exports.LifecycleService=class extends Xe{constructor(n){super();C(this,"_lifecycle$",new ae.BehaviorSubject(Pe.Starting));C(this,"lifecycle$",this._lifecycle$.asObservable());C(this,"_lock",!1);this._logService=n,this._reportProgress(Pe.Starting)}get stage(){return this._lifecycle$.getValue()}set stage(n){if(this._lock)throw new Error("[LifecycleService]: cannot set new stage when related logic is all handled!");if(n<this.stage)throw new Error("[LifecycleService]: lifecycle stage cannot go backward!");n!==this.stage&&(this._lock=!0,this._reportProgress(n),this._lifecycle$.next(n),this._lock=!1)}dispose(){this._lifecycle$.complete(),super.dispose()}onStage(n){return ae.firstValueFrom(this.lifecycle$.pipe(ae.filter(r=>r>=n),Di(r=>r===n),ae.map(()=>{}))).catch(r=>r.name==="EmptyError"?Promise.reject(new nd(n)):Promise.reject(r))}subscribeWithPrevious(){return ae.merge(rd(this.stage),this._lifecycle$.pipe(ae.skip(1))).pipe(Di(n=>n===Pe.Steady))}_reportProgress(n){this._logService.debug("[LifecycleService]",`lifecycle progressed to "${td[n]}".`)}};exports.LifecycleService=rI([sI(0,gt)],exports.LifecycleService);function rd(e){switch(e){case Pe.Starting:return ae.of(Pe.Starting);case Pe.Ready:return ae.of(Pe.Starting,Pe.Ready);case Pe.Rendered:return ae.of(Pe.Starting,Pe.Ready,Pe.Rendered);default:return ae.of(Pe.Starting,Pe.Ready,Pe.Rendered,Pe.Steady)}}const iI=ye.createIdentifier("ILocalStorageService");class En extends Xe{constructor(){super();C(this,"_currentLocale$",new ae.BehaviorSubject(Ur.ZH_CN));C(this,"currentLocale$",this._currentLocale$.asObservable());C(this,"_locales",null);C(this,"localeChanged$",new ae.Subject);C(this,"t",(n,...r)=>{if(!this._locales)throw new Error("[LocaleService]: Locale not initialized");const s=n.split("."),i=this.resolveKeyPath(this._locales[this._currentLocale],s);if(typeof i=="string"){let o=i;return r.forEach((a,l)=>{o=o.replace(`{${l}}`,a)}),o}else return n});this.disposeWithMe(Ye(()=>{this._locales=null,this._currentLocale$.complete(),this.localeChanged$.complete()}))}get _currentLocale(){return this._currentLocale$.value}load(n){var r;this._locales=Fs((r=this._locales)!=null?r:{},n)}setLocale(n){this._currentLocale$.next(n),this.localeChanged$.next()}getLocales(){var n;return(n=this._locales)==null?void 0:n[this._currentLocale]}getCurrentLocale(){return this._currentLocale}resolveKeyPath(n,r){const s=r.shift();if(s&&n&&s in n){const i=n[s];return r.length>0&&(typeof i=="object"||Array.isArray(i))?this.resolveKeyPath(i,r):i}return null}}var oI=Object.getOwnPropertyDescriptor,aI=(e,t,n,r)=>{for(var s=r>1?void 0:r?oI(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},lI=(e,t)=>(n,r)=>t(n,r,e);exports.MentionIOLocalService=class{constructor(t){this._userManagerService=t}async list(t){return{list:[{type:Ss.PERSON,mentions:[{objectType:Ss.PERSON,objectId:this._userManagerService.getCurrentUser().userID,label:this._userManagerService.getCurrentUser().name,metadata:{icon:this._userManagerService.getCurrentUser().avatar}}],metadata:{},title:"PEOPLE"}],page:t.page,size:t.size,total:1}}};exports.MentionIOLocalService=aI([lI(0,ye.Inject(Mr))],exports.MentionIOLocalService);const sd=ye.createIdentifier("univer.service.mention-io");var ua=(e=>(e.INIT="init",e.FETCHING="fetching",e.DONE="done",e))(ua||{});const id=ye.createIdentifier("univer.permission-service");class od extends Xe{constructor(){super(...arguments);C(this,"_permissionPointMap",new Map);C(this,"_permissionPointUpdate$",new ae.Subject);C(this,"permissionPointUpdate$",this._permissionPointUpdate$.asObservable());C(this,"_showComponents",!0)}setShowComponents(n){this._showComponents=n}getShowComponents(){return this._showComponents}deletePermissionPoint(n){const r=this._permissionPointMap.get(n);r&&(r.complete(),this._permissionPointMap.delete(n))}addPermissionPoint(n){const r=n instanceof ae.BehaviorSubject,s=r?n.getValue():n;return s.id?this._permissionPointMap.get(s.id)?(console.warn(`${s.id} PermissionPoint already exists`),!1):(this._permissionPointMap.set(s.id,r?n:new ae.BehaviorSubject(s)),this._permissionPointUpdate$.next(s),!0):!1}updatePermissionPoint(n,r){const s=this._permissionPointMap.get(n);if(!s)return;const i=s.getValue();i.value=r,i.status=ua.DONE,s.next(i),this._permissionPointUpdate$.next(i)}clearPermissionMap(){this._permissionPointMap.clear()}getPermissionPoint(n){const r=this._permissionPointMap.get(n);if(r)return r.getValue()}getPermissionPoint$(n){const r=this._permissionPointMap.get(n);if(r)return r}composePermission$(n){const r=n.map(s=>{var o;const i=(o=this._permissionPointMap)==null?void 0:o.get(s);if(!i)throw new Error(`[PermissionService]: ${s} permissionPoint does not exist!`);return i.asObservable()});return ae.combineLatest(r).pipe(os.map(s=>s))}composePermission(n){return n.map(s=>{var o;const i=(o=this._permissionPointMap)==null?void 0:o.get(s);if(!i)throw new Error(`[PermissionService]: ${s} permissionPoint does not exist!`);return i.getValue()})}getAllPermissionPoint(){const n=new Map;return this._permissionPointMap.forEach((r,s)=>{n.set(s,r)}),n}}function ad(e,t){if(!t)return e;const n=[];for(const r of e){const s=t.find(([i])=>i===r[0]);if(s){if(s[1]===null)continue;n.push([r[0],s[1]])}else n.push(r)}return n}var cI=Object.getOwnPropertyDescriptor,uI=(e,t,n,r)=>{for(var s=r>1?void 0:r?cI(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Oi=(e,t)=>(n,r)=>t(n,r,e);const hI=4,ld=Symbol("DependentOn");class fn extends Xe{onStarting(){}onReady(){}onRendered(){}onSteady(){}getUnitType(){return this.constructor.type}getPluginName(){return this.constructor.pluginName}}C(fn,"pluginName"),C(fn,"packageName",to.name),C(fn,"version",to.version),C(fn,"type",ve.UNIVER_UNKNOWN);class dI{constructor(){C(this,"_plugins",[])}addPlugin(t){this._plugins.push(t)}removePlugins(){const t=this._plugins.slice();return this._plugins.length=0,t}forEachPlugin(t){this._plugins.forEach(t)}}function fI(...e){return function(t){t[ld]=e}}exports.PluginService=class{constructor(t,n,r){C(this,"_pluginRegistry",new Map);C(this,"_pluginStore",new dI);C(this,"_seenPlugins",new Set);C(this,"_loadedPlugins",new Set);C(this,"_loadedPluginTypes",new Set([ve.UNIVER_UNKNOWN]));C(this,"_flushTimerByType",new Map);this._injector=t,this._lifecycleService=n,this._logService=r}dispose(){this._pluginStore.removePlugins().forEach(t=>t.dispose()),this._flushTimerByType.forEach(t=>clearTimeout(t))}registerPlugin(t,n){this._assertPluginValid(t);const r={plugin:t,options:n};this._pluginRegistry.set(t.pluginName,r),this._logService.debug("[PluginService]",`Plugin "${t.pluginName}" registered.`);const{type:s}=t;this._loadedPluginTypes.has(s)&&(s===ve.UNIVER_UNKNOWN?this._loadFromPlugins([r]):this._flushType(s))}startPluginsForType(t){this._loadedPluginTypes.has(t)||this._loadPluginsForType(t)}_loadPluginsForType(t){const n=Array.from(this._pluginRegistry.keys()),r=[];n.forEach(s=>{const i=this._pluginRegistry.get(s);i.plugin.type===t&&r.push(i)}),this._loadFromPlugins(r),this._loadedPluginTypes.add(t)}_assertPluginValid(t){const{type:n,pluginName:r,packageName:s,version:i}=t;if(n===ve.UNRECOGNIZED)throw new Error(`[PluginService]: invalid plugin type for ${t.name}. Please assign a "type" to your plugin.`);if(!r)throw new Error(`[PluginService]: no plugin name for ${t.name}. Please assign a "pluginName" to your plugin.`);if(i&&i!==fn.version)throw new Error(`[PluginService]: package "${s!=null?s:"UNKNOWN"}" version mismatch. Plugin version is "${i}" but @univerjs/core version is "${fn.version}". Please make sure all @univerjs packages use the same version.`);if(this._seenPlugins.has(r))throw new Error(`[PluginService]: duplicated plugin name for "${r}". Maybe a plugin that dependents on "${r} has already registered it. In that case please register "${r}" before the that plugin.`);this._seenPlugins.add(t.pluginName)}_flushType(t){this._flushTimerByType.get(t)===void 0&&this._flushTimerByType.set(t,setTimeout(()=>{this._loadPluginsForType(t),this._flushTimerByType.delete(t)},hI))}_loadFromPlugins(t){const n=[],r=new Set,s=o=>{const{plugin:a}=o,{pluginName:l}=a;if(this._loadedPlugins.has(l)||r.has(l))return;r.add(l),this._pluginRegistry.delete(l);const c=a[ld];c&&c.forEach(u=>{const h=this._pluginRegistry.get(u.pluginName);if(h)s(h);else if(!this._seenPlugins.has(u.pluginName)&&!r.has(u.pluginName)){if(a.type===ve.UNIVER_UNKNOWN&&u.type!==ve.UNIVER_UNKNOWN)throw new Error(`[PluginService]: cannot register a plugin with Univer type that depends on a plugin with other type. The dependent is ${a.pluginName} and the dependency is ${u.pluginName}.`);a.type!==u.type&&u.type!==ve.UNIVER_UNKNOWN&&this._logService.debug("[PluginService]",`Plugin "${l}" depends on "${u.pluginName}" which has different type.`),this._logService.debug("[PluginService]",`Plugin "${l}" depends on "${u.pluginName}" which is not registered. Univer will automatically register it with default configuration.`),this._assertPluginValid(u),s({plugin:u,options:void 0})}}),n.push(o)};t.forEach(o=>s(o));const i=n.map(o=>this._initPlugin(o.plugin,o.options));this._pluginsRunLifecycle(i)}_pluginsRunLifecycle(t){const n=this._lifecycleService.stage;if(rd(n).subscribe(r=>this._runStage(t,r)),n!==Pe.Steady){const r=this._lifecycleService.lifecycle$.pipe(ae.skip(1)).subscribe(s=>{this._runStage(t,s),s===Pe.Steady&&r.unsubscribe()})}}_runStage(t,n){t.forEach(r=>{switch(n){case Pe.Starting:r.onStarting();break;case Pe.Ready:r.onReady();break;case Pe.Rendered:r.onRendered();break;case Pe.Steady:r.onSteady();break}})}_initPlugin(t,n){const r=this._injector.createInstance(t,n);return this._pluginStore.addPlugin(r),this._loadedPlugins.add(t.pluginName),this._logService.debug("[PluginService]",`Plugin "${r.getPluginName()}" loaded.`),r}};exports.PluginService=uI([Oi(0,ye.Inject(ye.Injector)),Oi(1,ye.Inject(exports.LifecycleService)),Oi(2,gt)],exports.PluginService);const ro=ye.createIdentifier("resource-loader-service");var mI=Object.getOwnPropertyDescriptor,gI=(e,t,n,r)=>{for(var s=r>1?void 0:r?mI(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},_I=(e,t)=>(n,r)=>t(n,r,e);exports.ResourceManagerService=class extends Xe{constructor(n){super();C(this,"_resourceMap",new Map);C(this,"_register$",new ae.Subject);C(this,"register$",this._register$.asObservable());this._logService=n}getAllResourceHooks(){return[...this._resourceMap.values()]}getResources(n,r){return r?this.getResourcesByType(n,r):this.getAllResourceHooks().map(o=>{const a=o.toJson(n);return{name:o.pluginName,data:a}})}getResourcesByType(n,r){return this.getAllResourceHooks().filter(o=>o.businesses.includes(r)).map(o=>{const a=o.toJson(n);return{name:o.pluginName,data:a}})}registerPluginResource(n){const r=n.pluginName;if(this._resourceMap.has(r))throw new Error(`the pluginName is registered {${r}}`);return this._resourceMap.set(r,n),this._register$.next(n),Ye(()=>this._resourceMap.delete(r))}disposePluginResource(n){this._resourceMap.delete(n)}loadResources(n,r){this.getAllResourceHooks().forEach(s=>{var o;const i=(o=r==null?void 0:r.find(a=>a.name===s.pluginName))==null?void 0:o.data;if(i)try{const a=s.parseJson(i);s.onLoad(n,a)}catch(a){this._logService.error("[ResourceManagerService]","loadResources error",a)}})}unloadResources(n,r){this.getAllResourceHooks().filter(s=>s.businesses.includes(r)).forEach(s=>{s.onUnLoad(n)})}dispose(){this._register$.complete(),this._resourceMap.clear()}};exports.ResourceManagerService=gI([_I(0,gt)],exports.ResourceManagerService);class Ls extends Xe{constructor(){super();C(this,"_darkMode$",new ae.BehaviorSubject(!1));C(this,"darkMode$",this._darkMode$.asObservable());C(this,"_validColorCache",new Map);C(this,"_currentTheme",Vr.defaultTheme);C(this,"_currentTheme$",new ae.BehaviorSubject(this._currentTheme));C(this,"currentTheme$",this._currentTheme$.asObservable());this.disposeWithMe(Ye(()=>{this._currentTheme=Vr.defaultTheme,this._currentTheme$.complete(),this._darkMode$.complete()}))}get darkMode(){return this._darkMode$.getValue()}isValidThemeColor(n){if(this._validColorCache.has(n))return this._validColorCache.get(n);let r=!1;const s=n.split(".");if(s.length===1)r=n in Vr.defaultTheme;else if(s.length===2){const[i,o]=s;r=i in Vr.defaultTheme&&o in this._currentTheme[i]}return this._validColorCache.set(n,r),r}getCurrentTheme(){return this._currentTheme}setTheme(n){this._currentTheme=n,this._currentTheme$.next(n)}setDarkMode(n){this._darkMode$.next(n)}getColorFromTheme(n){return sc(this._currentTheme,n)}}var pI=Object.getOwnPropertyDescriptor,EI=(e,t,n,r)=>{for(var s=r>1?void 0:r?pI(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},vi=(e,t)=>(n,r)=>t(n,r,e);const Js=ye.createIdentifier("univer.undo-redo.service"),CI=20;class cd{dispose(){}async dispatchToHandlers(){return!1}}const ud="univer.command.redo",hd="univer.command.undo",dd=new class extends cd{constructor(){super(...arguments);C(this,"type",Fr.COMMAND);C(this,"id",hd)}handler(t){const n=t.get(Js),r=n.pitchTopUndoElement();if(!r)return!1;const s=t.get(Hr);return js(r.undoMutations,s)?(n.popUndoToRedo(),!0):!1}},fd=new class extends cd{constructor(){super(...arguments);C(this,"type",Fr.COMMAND);C(this,"id",ud)}handler(t){const n=t.get(Js),r=n.pitchTopRedoElement();if(!r)return!1;const s=t.get(Hr);return js(r.redoMutations,s)?(n.popRedoToUndo(),!0):!1}};exports.LocalUndoRedoService=class extends Xe{constructor(n,r,s){super();C(this,"undoRedoStatus$");C(this,"_undoRedoStatus$",new ae.BehaviorSubject({undos:0,redos:0}));C(this,"_undoStacks",new Map);C(this,"_redoStacks",new Map);C(this,"_batchingStatus",new Map);this._univerInstanceService=n,this._commandService=r,this._contextService=s,this.undoRedoStatus$=this._undoRedoStatus$.asObservable(),this.disposeWithMe(this._commandService.registerCommand(dd)),this.disposeWithMe(this._commandService.registerCommand(fd)),this.disposeWithMe(Ye(()=>this._undoRedoStatus$.complete())),this.disposeWithMe(Ye(this._univerInstanceService.focused$.subscribe(()=>this._updateStatus())))}pushUndoRedo(n){const{unitID:r}=n,s=this._getRedoStack(r,!0),i=this._getUndoStack(r,!0);if(s.length=0,this._batchingStatus.has(n.unitID)){const a=this._batchingStatus.get(n.unitID),l=this._pitchUndoElement(n.unitID);a===0||!l?(o(n),this._batchingStatus.set(n.unitID,1)):this._tryBatchingElements(l,n)}else o(n);function o(a){i.push(a),i.length>CI&&i.splice(0,1)}this._updateStatus()}clearUndoRedo(n){const r=this._getRedoStack(n);r&&(r.length=0);const s=this._getUndoStack(n);s&&(s.length=0),this._updateStatus()}pitchTopUndoElement(){const n=this._getFocusedUnitId();return this._pitchUndoElement(n)}pitchTopRedoElement(){const n=this._getFocusedUnitId();return this._pitchRedoElement(n)}_pitchUndoElement(n){const r=this._getUndoStack(n);return r!=null&&r.length?r[r.length-1]:null}_pitchRedoElement(n){const r=this._getRedoStack(n);return r!=null&&r.length?r[r.length-1]:null}popUndoToRedo(){const r=this._getUndoStackForFocused().pop();r&&(r.redoMutations.length>0&&this._getRedoStackForFocused().push(r),this._updateStatus())}popRedoToUndo(){const r=this._getRedoStackForFocused().pop();r&&(this._getUndoStackForFocused().push(r),this._updateStatus())}rollback(n,r){const s=r||this._getFocusedUnitId(),i=this._getUndoStack(s),o=i==null?void 0:i[(i==null?void 0:i.length)-1];o&&o.id===n&&(i.pop(),js(o.undoMutations,this._commandService))}__tempBatchingUndoRedo(n){if(this._batchingStatus.has(n))throw new Error("[LocalUndoRedoService]: cannot batching undo redo twice at the same time!");return this._batchingStatus.set(n,0),Ye(()=>this._batchingStatus.delete(n))}_updateStatus(){var i,o;const n=this._getFocusedUnitId(),r=n&&((i=this._undoStacks.get(n))==null?void 0:i.length)||0,s=n&&((o=this._redoStacks.get(n))==null?void 0:o.length)||0;this._undoRedoStatus$.next({undos:r,redos:s})}_getUndoStack(n,r=!1){let s=this._undoStacks.get(n);return!s&&r&&(s=[],this._undoStacks.set(n,s)),s||null}_getRedoStack(n,r=!1){let s=this._redoStacks.get(n);return!s&&r&&(s=[],this._redoStacks.set(n,s)),s||null}_getUndoStackForFocused(){const n=this._getFocusedUnitId();if(!n)throw new Error("No focused univer instance!");return this._getUndoStack(n,!0)}_getRedoStackForFocused(){const n=this._getFocusedUnitId();if(!n)throw new Error("No focused univer instance!");return this._getRedoStack(n,!0)}_tryBatchingElements(n,r){n.redoMutations.push(...r.redoMutations),n.undoMutations.push(...r.undoMutations)}_getFocusedUnitId(){var o,a,l,c;let n="";const r=this._contextService.getContextValue(Hn),s=this._contextService.getContextValue(Ph),i=this._contextService.getContextValue(Uh);return r?s?n=ao:i?n=oo:n=(a=(o=this._univerInstanceService.getFocusedUnit())==null?void 0:o.getUnitId())!=null?a:"":n=(c=(l=this._univerInstanceService.getFocusedUnit())==null?void 0:l.getUnitId())!=null?c:"",n}};exports.LocalUndoRedoService=EI([vi(0,Kn),vi(1,Hr),vi(2,Jn)],exports.LocalUndoRedoService);class md{constructor(t,n=1e3){C(this,"_imageCacheMap");this._injector=t,this._imageCacheMap=new Gs(n)}_getImageCacheKey(t,n){return`${t}-${n}`}getImage(t,n,r,s){const i=this._getImageCacheKey(t,n),o=this._imageCacheMap.get(i);return o||((async()=>{const a=new Image,l=this._injector.has(Qi)?this._injector.get(Qi):null,c=this._injector.has(eo)?this._injector.get(eo):null;if(t===Ds.UUID)try{a.src=await(l==null?void 0:l.getImage(n))||""}catch(u){console.error(u)}else if(t===Ds.URL)try{const u=await(c==null?void 0:c.getImage(n));a.src=u||n}catch{a.src=n}else a.src=n;a.onload=()=>{a.removeAttribute("data-error"),r==null||r()},a.onerror=()=>{a.setAttribute("data-error","true"),s==null||s()},this._imageCacheMap.set(i,a)})(),null)}}function RI(e){return!(e.length===0||e.length>31||e.startsWith("'")||e.endsWith("'")||/[:\\\/\?\*\[\]]/.test(e))}function II(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))}const wl=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],wi=1,sr=8;class ha{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[n,r]=new Uint8Array(t,0,2);if(n!==219)throw new Error("Data does not appear to be in a KDBush format.");const s=r>>4;if(s!==wi)throw new Error(`Got v${s} data when expected v${wi}.`);const i=wl[r&15];if(!i)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(t,2,1),[a]=new Uint32Array(t,4,1);return new ha(a,o,i,t)}constructor(t,n=64,r=Float64Array,s){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+n,2),65535),this.ArrayType=r,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const i=wl.indexOf(this.ArrayType),o=t*2*this.ArrayType.BYTES_PER_ELEMENT,a=t*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-a%8)%8;if(i<0)throw new Error(`Unexpected typed array class: ${r}.`);s&&s instanceof ArrayBuffer?(this.data=s,this.ids=new this.IndexArrayType(this.data,sr,t),this.coords=new this.ArrayType(this.data,sr+a+l,t*2),this._pos=t*2,this._finished=!0):(this.data=new ArrayBuffer(sr+o+a+l),this.ids=new this.IndexArrayType(this.data,sr,t),this.coords=new this.ArrayType(this.data,sr+a+l,t*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(wi<<4)+i]),new Uint16Array(this.data,2,1)[0]=n,new Uint32Array(this.data,4,1)[0]=t)}add(t,n){const r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=t,this.coords[this._pos++]=n,r}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return so(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,n,r,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:i,coords:o,nodeSize:a}=this,l=[0,i.length-1,0],c=[];for(;l.length;){const u=l.pop()||0,h=l.pop()||0,d=l.pop()||0;if(h-d<=a){for(let R=d;R<=h;R++){const b=o[2*R],F=o[2*R+1];b>=t&&b<=r&&F>=n&&F<=s&&c.push(i[R])}continue}const f=d+h>>1,g=o[2*f],E=o[2*f+1];g>=t&&g<=r&&E>=n&&E<=s&&c.push(i[f]),(u===0?t<=g:n<=E)&&(l.push(d),l.push(f-1),l.push(1-u)),(u===0?r>=g:s>=E)&&(l.push(f+1),l.push(h),l.push(1-u))}return c}within(t,n,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:s,coords:i,nodeSize:o}=this,a=[0,s.length-1,0],l=[],c=r*r;for(;a.length;){const u=a.pop()||0,h=a.pop()||0,d=a.pop()||0;if(h-d<=o){for(let R=d;R<=h;R++)bl(i[2*R],i[2*R+1],t,n)<=c&&l.push(s[R]);continue}const f=d+h>>1,g=i[2*f],E=i[2*f+1];bl(g,E,t,n)<=c&&l.push(s[f]),(u===0?t-r<=g:n-r<=E)&&(a.push(d),a.push(f-1),a.push(1-u)),(u===0?t+r>=g:n+r>=E)&&(a.push(f+1),a.push(h),a.push(1-u))}return l}}function so(e,t,n,r,s,i){if(s-r<=n)return;const o=r+s>>1;gd(e,t,o,r,s,i),so(e,t,n,r,o-1,1-i),so(e,t,n,o+1,s,1-i)}function gd(e,t,n,r,s,i){for(;s>r;){if(s-r>600){const c=s-r+1,u=n-r+1,h=Math.log(c),d=.5*Math.exp(2*h/3),f=.5*Math.sqrt(h*d*(c-d)/c)*(u-c/2<0?-1:1),g=Math.max(r,Math.floor(n-u*d/c+f)),E=Math.min(s,Math.floor(n+(c-u)*d/c+f));gd(e,t,n,g,E,i)}const o=t[2*n+i];let a=r,l=s;for(ir(e,t,r,n),t[2*s+i]>o&&ir(e,t,r,s);a<l;){for(ir(e,t,a,l),a++,l--;t[2*a+i]<o;)a++;for(;t[2*l+i]>o;)l--}t[2*r+i]===o?ir(e,t,r,l):(l++,ir(e,t,l,s)),l<=n&&(r=l+1),n<=l&&(s=l-1)}}function ir(e,t,n,r){bi(e,n,r),bi(t,2*n,2*r),bi(t,2*n+1,2*r+1)}function bi(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function bl(e,t,n,r){const s=e-n,i=t-r;return s*s+i*i}class SI{constructor(t=!1){C(this,"_tree",new Map);C(this,"_oneCellCache",new Map);C(this,"_kdTree",new Map);this._enableOneCellCache=t}dispose(){this.clear()}getTree(t,n){return this._tree.has(t)||this._tree.set(t,new Map),this._tree.get(t).has(n)||this._tree.get(t).set(n,new As),this._tree.get(t).get(n)}_getOneCellCache(t,n,r,s){return this._oneCellCache.has(t)||this._oneCellCache.set(t,new Map),this._oneCellCache.get(t).has(n)||this._oneCellCache.get(t).set(n,new Map),this._oneCellCache.get(t).get(n).has(r)||this._oneCellCache.get(t).get(n).set(r,new Map),this._oneCellCache.get(t).get(n).get(r).has(s)||this._oneCellCache.get(t).get(n).get(r).set(s,new Set),this._oneCellCache.get(t).get(n).get(r).get(s)}_removeOneCellCache(t,n,r,s,i){const o=this._oneCellCache.get(t);if(!o)return;const a=o.get(n);if(!a)return;const l=a.get(r);if(!l)return;const c=l.get(s);c&&c.delete(i)}_removeCellCacheByRange(t){const{unitId:n,sheetId:r,range:s,id:i}=t,o=this._oneCellCache.get(n);if(!o)return;const a=o.get(r);if(!a)return;const{startRow:l,startColumn:c,endRow:u,endColumn:h}=s;for(let d=l;d<=u;d++){const f=a.get(d);if(f)for(let g=c;g<=h;g++){const E=f.get(g);E&&E.delete(i)}}}_insertOneCellCache(t,n,r,s,i){this._getOneCellCache(t,n,r,s).add(i)}_getRdTreeItems(t){const n=[];for(const[r,s]of t)for(const[i,o]of s)n.push({x:i,y:r,ids:o});return n}_searchByOneCellCache(t){var g;const{unitId:n,sheetId:r,range:s}=t,{startRow:i,startColumn:o,endRow:a,endColumn:l}=s,c=(g=this._kdTree.get(n))==null?void 0:g.get(r);if(!c)return[];const{tree:u,items:h}=c,d=u.range(o,i,l,a),f=[];for(const E of d){const R=h[E];f.push(...Array.from(R.ids))}return f}openKdTree(){var t;for(const[n,r]of this._oneCellCache){this._kdTree.has(n)||this._kdTree.set(n,new Map);for(const[s,i]of r){const o=this._getRdTreeItems(i),a=new ha(o.length);(t=this._kdTree.get(n))==null||t.set(s,{tree:a,items:o});for(const l of o)a.add(l.x,l.y);a.finish()}}}closeKdTree(){var t;for(const[n,r]of this._oneCellCache)for(const[s,i]of r)(t=this._kdTree.get(n))==null||t.set(s,void 0)}insert(t){const{unitId:n,sheetId:r,range:s,id:i}=t;if(!n||n.length===0)return;let{startRow:o,endRow:a,startColumn:l,endColumn:c}=s;if(this._enableOneCellCache&&o===a&&l===c){this._insertOneCellCache(n,r,o,l,i);return}const u=this.getTree(n,r);Number.isNaN(o)&&(o=0),Number.isNaN(l)&&(l=0),Number.isNaN(a)&&(a=Number.POSITIVE_INFINITY),Number.isNaN(c)&&(c=Number.POSITIVE_INFINITY),u.insert({minX:l,minY:o,maxX:c,maxY:a,id:i})}bulkInsert(t){for(const n of t)this.insert(n)}*searchGenerator(t){var a;const{unitId:n,sheetId:r,range:s}=t;if(this._enableOneCellCache){const l=this._searchByOneCellCache(t);for(const c of l)yield c}const i=(a=this._tree.get(n))==null?void 0:a.get(r);if(!i)return;const o=i.search({minX:s.startColumn,minY:s.startRow,maxX:s.endColumn,maxY:s.endRow});for(const l of o)yield l.id}bulkSearch(t,n){const r=new Set;for(const s of t)for(const i of this.searchGenerator(s))(n==null?void 0:n.has(i))!==!0&&r.add(i);return r}removeById(t,n){var r,s;n?((r=this._tree.get(t))==null||r.delete(n),(s=this._oneCellCache.get(t))==null||s.delete(n)):(this._tree.delete(t),this._oneCellCache.delete(t))}_removeRTreeItem(t){const{unitId:n,sheetId:r,range:s,id:i}=t,o=this.getTree(n,r),a=o.search({minX:s.startColumn,minY:s.startRow,maxX:s.endColumn,maxY:s.endRow});for(let l=0;l<a.length;l++)a[l].id===i&&o.remove(a[l])}remove(t){const{unitId:n,sheetId:r,range:s,id:i}=t,{startRow:o,startColumn:a,endRow:l,endColumn:c}=s;this._enableOneCellCache?o===l&&a===c?this._removeOneCellCache(n,r,s.startRow,s.startColumn,i):(this._removeCellCacheByRange(t),this._removeRTreeItem(t)):this._removeRTreeItem(t)}bulkRemove(t){for(const n of t)this.remove(n)}clear(){this._tree.clear(),this._oneCellCache.clear()}toJSON(){const t={};return this._tree.forEach((n,r)=>{t[r]={},n.forEach((s,i)=>{t[r][i]=s.toJSON()})}),t}fromJSON(t){this._tree.clear();for(const n in t){this._tree.set(n,new Map);for(const r in t[n]){const s=new As;s.fromJSON(t[n][r]),this._tree.get(n).set(r,s)}}}}function OI(e){return new Promise(t=>setTimeout(t,e))}function vI(e=1){return new Promise(t=>{let n=0;const r=()=>{n++,n>=e?t():requestAnimationFrame(r)};requestAnimationFrame(r)})}var wI=Object.getOwnPropertyDescriptor,bI=(e,t,n,r)=>{for(var s=r>1?void 0:r?wI(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},yI=(e,t)=>(n,r)=>t(n,r,e);exports.Skeleton=class extends Xe{constructor(n){super();C(this,"_fontLocale");C(this,"_dirty",!0);this._localeService=n,this._localeInitial()}get dirty(){return this._dirty}getFontLocale(){return this._fontLocale}makeDirty(n){this._dirty=n}dispose(){super.dispose(),this._fontLocale=null}_localeInitial(){}};exports.Skeleton=bI([yI(0,ye.Inject(En))],exports.Skeleton);var AI=Object.getOwnPropertyDescriptor,TI=(e,t,n,r)=>{for(var s=r>1?void 0:r?AI(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},is=(e,t)=>(n,r)=>t(n,r,e);exports.SheetSkeleton=class extends exports.Skeleton{constructor(n,r,s,i,o,a){super(s);C(this,"_worksheetData");C(this,"_renderRawFormula",!1);C(this,"_cellData");C(this,"_imageCacheMap");C(this,"_skipAutoHeightForMergedCells",!0);C(this,"_rowTotalHeight",0);C(this,"_columnTotalWidth",0);C(this,"_rowHeaderWidth",0);C(this,"_columnHeaderHeight",0);C(this,"_rowHeightAccumulation",[]);C(this,"_columnWidthAccumulation",[]);C(this,"_marginTop",0);C(this,"_marginLeft",0);C(this,"_scaleX");C(this,"_scaleY");C(this,"_scrollX");C(this,"_scrollY");this.worksheet=n,this._styles=r,this._contextService=i,this._configService=o,this._injector=a,this._worksheetData=this.worksheet.getConfig(),this._cellData=this.worksheet.getCellMatrix(),this._imageCacheMap=new md(this._injector),this.initConfig()}initConfig(){var n,r;this._skipAutoHeightForMergedCells=!((n=this._configService.getConfig(xl))!=null&&n),this.worksheet.setIsRowStylePrecedeColumnStyle((r=this._configService.getConfig(Ll))!=null?r:!1)}resetCache(){}getWorksheetConfig(){return this._worksheetData}getLocation(){return[this.worksheet.getUnitId(),this.worksheet.getSheetId()]}set columnHeaderHeight(n){this._columnHeaderHeight=n,this._worksheetData.columnHeader.height=n}set rowHeaderWidth(n){this._rowHeaderWidth=n,this._worksheetData.rowHeader.width=n}get rowHeightAccumulation(){return this._rowHeightAccumulation}get rowTotalHeight(){return this._rowTotalHeight}get columnWidthAccumulation(){return this._columnWidthAccumulation}get columnTotalWidth(){return this._columnTotalWidth}get rowHeaderWidth(){return this._rowHeaderWidth}get columnHeaderHeight(){return this._columnHeaderHeight}setMarginLeft(n){this._marginLeft=n}setMarginTop(n){this._marginTop=n}setScale(n,r){this._updateLayout(),this._scaleX=n,this._scaleY=r||n,this._updateLayout()}setScroll(n,r){Z.isDefine(n)&&(this._scrollX=n),Z.isDefine(r)&&(this._scrollY=r)}get scrollX(){return this._scrollX}get scrollY(){return this._scrollY}get scaleX(){return this._scaleX}get scaleY(){return this._scaleY}get rowHeaderWidthAndMarginLeft(){return this.rowHeaderWidth+this._marginLeft}get columnHeaderHeightAndMarginTop(){return this.columnHeaderHeight+this._marginTop}get imageCacheMap(){return this._imageCacheMap}_generateRowMatrixCache(n,r,s){let i=0;const o=[],a=r;for(let l=0;l<n;l++){let c=s;if(this.worksheet.getRowFiltered(l))c=0;else if(a[l]!=null){const u=a[l];if(!u)continue;const{h=s,ah:d,ia:f}=u;(f==null||f===ce.TRUE)&&typeof d=="number"&&d>0?c=d:c=h,u.hd===ce.TRUE&&(c=0)}i+=c,o.push(i)}return{rowTotalHeight:i,rowHeightAccumulation:o}}_generateColumnMatrixCache(n,r,s){let i=0;const o=[],a=r;for(let l=0;l<n;l++){let c=s;if(a[l]!=null){const u=a[l];if(!u)continue;u.w!=null&&(c=u.w),u.hd===ce.TRUE&&(c=0)}i+=c,o.push(i)}return{columnTotalWidth:i,columnWidthAccumulation:o}}intersectMergeRange(n,r){return!!this.worksheet.getMergedCell(n,r)}_getOverflowBound(n,r,s,i,o=At.LEFT){let a=0;if(r>s){const l=this._columnWidthAccumulation.length-1;for(let c=r;c>=s;c--){const u=c,h=this.worksheet.getCell(n,u);if(!ji(h)&&u!==r||this.intersectMergeRange(n,u))return u===r?u:u+1>l?l:u+1;const{startX:d,endX:f}=Ln(n,u,this.rowHeightAccumulation,this.columnWidthAccumulation);if(o===At.CENTER&&u===r?a+=(f-d)/2:a+=f-d,i<a)return u}return r}for(let l=r;l<=s;l++){const c=l,u=this.worksheet.getCell(n,c);if(!ji(u)&&c!==r||this.intersectMergeRange(n,c))return c===r?c:c-1<0?0:c-1;const{startX:h,endX:d}=Ln(n,c,this.rowHeightAccumulation,this.columnWidthAccumulation);if(o===At.CENTER&&c===r?a+=(d-h)/2:a+=d-h,i<a)return c}return s}_updateLayout(){if(!this.dirty)return;const{rowData:n,columnData:r,defaultRowHeight:s,defaultColumnWidth:i,rowCount:o,columnCount:a,rowHeader:l,columnHeader:c}=this._worksheetData,{rowTotalHeight:u,rowHeightAccumulation:h}=this._generateRowMatrixCache(o,n,s),{columnTotalWidth:d,columnWidthAccumulation:f}=this._generateColumnMatrixCache(a,r,i);this._rowHeaderWidth=l.hidden!==ce.TRUE?this._dynamicallyUpdateRowHeaderWidth(l):0,this._columnHeaderHeight=c.hidden!==ce.TRUE?c.height:0,this._rowTotalHeight=u,this._rowHeightAccumulation=h,this._columnTotalWidth=d,this._columnWidthAccumulation=f,this.makeDirty(!1)}calculate(){return this.resetCache(),this._updateLayout(),this}resetRangeCache(n){}_dynamicallyUpdateRowHeaderWidth(n){const s=`${this.worksheet.getRowCount()}`.length*8;return Math.max(n.width,s)}_hasUnMergedCellInRow(n,r,s){if(!this.worksheet.getMergeData())return!1;for(let o=r;o<=s;o++){const{isMerged:a,isMergedMainCell:l}=this.worksheet.getCellInfoInMergeData(n,o);if(!a&&!l)return!0}return!1}expandRangeByMerge(n,r){let{startRow:s,startColumn:i,endRow:o,endColumn:a}=n;const l=this._worksheetData.mergeData;if(!l)return{startRow:s,startColumn:i,endRow:o,endColumn:a};let c=!0;const u=new ct;let h=0,d=null;for(;c;){c=!1;for(let f=0;f<l.length;f++){const{startRow:g,startColumn:E,endRow:R,endColumn:b}=l[f];if(u.getValue(g,E))continue;const F={startColumn:i,startRow:s,endColumn:a,endRow:o},k={startColumn:E,startRow:g,endColumn:b,endRow:R};sh(F,k)&&(s=Math.min(s,g),i=Math.min(i,E),o=Math.max(o,R),a=Math.max(a,b),u.setValue(g,E,!0),c=!0,h++,d=k)}}return r&&h===1&&Wt.contains(d,n)?{startRow:d.startRow,startColumn:d.startColumn,endRow:d.startRow,endColumn:d.startColumn}:{startRow:s,startColumn:i,endRow:o,endColumn:a}}getColumnCount(){return this._columnWidthAccumulation.length}getRowCount(){return this._rowHeightAccumulation.length}_getCellMergeInfo(n,r){return this.worksheet.getCellInfoInMergeData(n,r)}getNoMergeCellPositionByIndex(n,r,s=!0){return this.getNoMergeCellWithCoordByIndex(n,r,s)}getNoMergeCellWithCoordByIndex(n,r,s=!0){const{rowHeightAccumulation:i,columnWidthAccumulation:o,rowHeaderWidthAndMarginLeft:a,columnHeaderHeightAndMarginTop:l}=this;let{startY:c,endY:u,startX:h,endX:d}=Ln(n,r,i,o);return s&&(c+=l,u+=l,h+=a,d+=a),{startY:c,endY:u,startX:h,endX:d}}getNoMergeCellPositionByIndexWithNoHeader(n,r){const{rowHeightAccumulation:s,columnWidthAccumulation:i}=this,{startY:o,endY:a,startX:l,endX:c}=Ln(n,r,s,i);return{startY:o,endY:a,startX:l,endX:c}}getRowIndexByOffsetY(n,r,s,i){var l;const{rowHeightAccumulation:o}=this;n=pd(n,r,s,this.columnHeaderHeightAndMarginTop);let a=ar(o,n,i==null?void 0:i.firstMatch);return i!=null&&i.closeFirst&&Math.abs(o[a]-n)<Math.abs(n-((l=o[a-1])!=null?l:0))&&(a=a+1),a}getColumnIndexByOffsetX(n,r,s,i){var c;const o=_d(n,r,s,this.rowHeaderWidthAndMarginLeft),{columnWidthAccumulation:a}=this;let l=ar(a,o,i==null?void 0:i.firstMatch);return i!=null&&i.closeFirst&&Math.abs(a[l]-o)<Math.abs(o-((c=a[l-1])!=null?c:0))&&(l=l+1),l}getCellIndexByOffset(n,r,s,i,o,a){const l=this.getRowIndexByOffsetY(r,i,o,a),c=this.getColumnIndexByOffsetX(n,s,o,a);return{row:l,column:c}}getCellByOffset(n,r,s,i,o){const a=this==null?void 0:this.getCellIndexByOffset(n,r,s,i,o,{firstMatch:!0});return a?this.worksheet.getCellInfoInMergeData(a.row,a.column):null}getCellWithCoordByIndex(n,r,s=!0){const{rowHeightAccumulation:i,columnWidthAccumulation:o,rowHeaderWidthAndMarginLeft:a,columnHeaderHeightAndMarginTop:l}=this,c=Ln(n,r,i,o,this.worksheet.getCellInfoInMergeData(n,r)),{isMerged:u,isMergedMainCell:h}=c;let{startY:d,endY:f,startX:g,endX:E,mergeInfo:R}=c,b=a,F=l;return s===!1&&(b=0,F=0),d+=F,f+=F,g+=b,E+=b,R.startY+=F,R.endY+=F,R.startX+=b,R.endX+=b,{actualRow:n,actualColumn:r,startX:g,startY:d,endX:E,endY:f,isMerged:u,isMergedMainCell:h,mergeInfo:R}}getCellWithCoordByOffset(n,r,s,i,o,a){const{row:l,column:c}=this.getCellIndexByOffset(n,r,s,i,o,a);return this.getCellWithCoordByIndex(l,c)}getOffsetByColumn(n){const{columnWidthAccumulation:r,rowHeaderWidthAndMarginLeft:s}=this,i=r.length-1,o=r[n];return o!=null?o+s:n<0?s:r[i]+s}getOffsetByRow(n){const{rowHeightAccumulation:r,columnHeaderHeightAndMarginTop:s}=this,i=r.length-1,o=r[n];return o!=null?o+s:n<0?s:r[i]+s}getOffsetRelativeToRowCol(n,r){const s=ar(this.columnWidthAccumulation,n);let i=0;s===0?i=n:i=n-this._columnWidthAccumulation[s-1];const o=ar(this.rowHeightAccumulation,r);let a=0;return o===0?a=r:a=r-this._rowHeightAccumulation[o-1],{row:o,column:s,columnOffset:i,rowOffset:a}}_updateConfigAndGetDocumentModel(n,r,s,i){var a,l,c,u,h;if(!i||!((a=n.body)!=null&&a.dataStream))return;n.documentStyle||(n.documentStyle={}),n.documentStyle.marginTop=(l=s.t)!=null?l:0,n.documentStyle.marginBottom=(c=s.b)!=null?c:2,n.documentStyle.marginLeft=(u=s.l)!=null?u:2,n.documentStyle.marginRight=(h=s.r)!=null?h:2,n.documentStyle.pageSize={width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY},n.documentStyle.renderConfig={...n.documentStyle.renderConfig,...i};const o=n.body.paragraphs||[];for(const d of o)d.paragraphStyle||(d.paragraphStyle={}),d.paragraphStyle.horizontalAlign=r;return new Nt(n)}dispose(){super.dispose(),this._rowHeightAccumulation=[],this._columnWidthAccumulation=[],this._rowTotalHeight=0,this._columnTotalWidth=0,this._rowHeaderWidth=0,this._columnHeaderHeight=0,this._worksheetData=null,this._cellData=null,this._styles=null,this.worksheet=null}};exports.SheetSkeleton=TI([is(2,ye.Inject(En)),is(3,Jn),is(4,kr),is(5,ye.Inject(ye.Injector))],exports.SheetSkeleton);function da(e,t,n,r){const s=e-1,i=t-1,o=n[s]||0;let a=n[e];a==null&&(a=n[n.length-1]);const l=r[i]||0;let c=r[t];return c==null&&(c=r[r.length-1]),{startY:o,endY:a,startX:l,endX:c}}function NI(e,t,n,r){return da(e,t,n,r)}function Ln(e,t,n,r,s){e=Z.clamp(e,0,n.length-1),t=Z.clamp(t,0,r.length-1);let{startY:i,endY:o,startX:a,endX:l}=da(e,t,n,r);if(!s)return{startY:i,endY:o,startX:a,endX:l,isMerged:!1,isMergedMainCell:!1,actualRow:e,actualColumn:t,mergeInfo:{startY:i,endY:o,startX:a,endX:l,startRow:e,startColumn:t,endRow:e,endColumn:t}};const{isMerged:c,isMergedMainCell:u,startRow:h,startColumn:d,endRow:f,endColumn:g}=s;let E={startRow:h,startColumn:d,endRow:f,endColumn:g,startY:i,endY:o,startX:a,endX:l};const R=n.length-1,b=r.length-1;if(c&&h!==-1&&d!==-1){const F=n[h-1]||0,k=n[f]||n[R],W=r[d-1]||0,S=r[g]||r[b];E={...E,startY:F,endY:k,startX:W,endX:S}}else if(!c&&f!==-1&&g!==-1){const F=n[f]||n[R],k=r[g]||r[b];E={...E,startY:i,endY:F,startX:a,endX:k}}return{isMerged:c,isMergedMainCell:u,actualRow:e,actualColumn:t,startY:i,endY:o,startX:a,endX:l,mergeInfo:E}}function _d(e,t,n,r){const{x:s}=n;return e/t+s-r}function pd(e,t,n,r){const{y:s}=n;return e=e/t+s-r,e}const MI=["script","style","meta","comment","link"];var Ed=(e=>(e[e.INFO=0]="INFO",e[e.STOP=1]="STOP",e[e.WARNING=2]="WARNING",e))(Ed||{}),Cd=(e=>(e[e.DISABLED=0]="DISABLED",e[e.FULL_ALPHA=1]="FULL_ALPHA",e[e.FULL_HANGUL=2]="FULL_HANGUL",e[e.FULL_KATAKANA=3]="FULL_KATAKANA",e[e.HALF_ALPHA=4]="HALF_ALPHA",e[e.HALF_HANGUL=5]="HALF_HANGUL",e[e.HALF_KATAKANA=6]="HALF_KATAKANA",e[e.HIRAGANA=7]="HIRAGANA",e[e.NO_CONTROL=8]="NO_CONTROL",e[e.OFF=9]="OFF",e[e.ON=10]="ON",e))(Cd||{}),Rd=(e=>(e.BETWEEN="between",e.EQUAL="equal",e.GREATER_THAN="greaterThan",e.GREATER_THAN_OR_EQUAL="greaterThanOrEqual",e.LESS_THAN="lessThan",e.LESS_THAN_OR_EQUAL="lessThanOrEqual",e.NOT_BETWEEN="notBetween",e.NOT_EQUAL="notEqual",e))(Rd||{}),Id=(e=>(e[e.TEXT=0]="TEXT",e[e.ARROW=1]="ARROW",e[e.CUSTOM=2]="CUSTOM",e))(Id||{}),Sd=(e=>(e.VALID="valid",e.INVALID="invalid",e.VALIDATING="validating",e))(Sd||{}),Od=(e=>(e.CUSTOM="custom",e.LIST="list",e.LIST_MULTIPLE="listMultiple",e.NONE="none",e.TEXT_LENGTH="textLength",e.DATE="date",e.TIME="time",e.WHOLE="whole",e.DECIMAL="decimal",e.CHECKBOX="checkbox",e.ANY="any",e))(Od||{}),DI=Object.getOwnPropertyDescriptor,LI=(e,t,n,r)=>{for(var s=r>1?void 0:r?DI(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},yl=(e,t)=>(n,r)=>t(n,r,e);let io=class extends Xe{constructor(e,t){super(),this._resourceManagerService=e,this._univerInstanceService=t,this._init()}_init(){const e=n=>{n.businesses.forEach(r=>{switch(r){case ve.UNRECOGNIZED:case ve.UNIVER_UNKNOWN:case ve.UNIVER_SLIDE:case ve.UNIVER_DOC:{this._univerInstanceService.getAllUnitsForType(ve.UNIVER_DOC).forEach(s=>{const o=(s.getSnapshot().resources||[]).find(a=>a.name===n.pluginName);if(o)try{const a=n.parseJson(o.data);n.onLoad(s.getUnitId(),a)}catch{console.error(`Load Document{${s.getUnitId()}} Resources{${n.pluginName}} Data Error.`)}});break}case ve.UNIVER_SHEET:this._univerInstanceService.getAllUnitsForType(ve.UNIVER_SHEET).forEach(s=>{const o=(s.getSnapshot().resources||[]).find(a=>a.name===n.pluginName);if(o)try{const a=n.parseJson(o.data);n.onLoad(s.getUnitId(),a)}catch{console.error(`Load Workbook{${s.getUnitId()}} Resources{${n.pluginName}} Data Error.`)}})}})};this._resourceManagerService.getAllResourceHooks().forEach(n=>e(n)),this.disposeWithMe(this._resourceManagerService.register$.subscribe(n=>e(n))),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(ve.UNIVER_SHEET).subscribe(n=>{this._resourceManagerService.loadResources(n.getUnitId(),n.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(ve.UNIVER_DOC).subscribe(n=>{const r=n.getUnitId();Ul(r)||this._resourceManagerService.loadResources(n.getUnitId(),n.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(ve.UNIVER_SHEET).subscribe(n=>{this._resourceManagerService.unloadResources(n.getUnitId(),ve.UNIVER_SHEET)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(ve.UNIVER_DOC).subscribe(n=>{this._resourceManagerService.unloadResources(n.getUnitId(),ve.UNIVER_DOC)}))}saveUnit(e){const t=this._univerInstanceService.getUnit(e);if(!t)return null;const n=this._resourceManagerService.getResources(e,t.type),r=Z.deepClone(t.getSnapshot());return r.resources=n,r}};io=LI([yl(0,ye.Inject(qs)),yl(1,ye.Inject(Kn))],io);class xI{constructor(t={},n){C(this,"_startedTypes",new Set);C(this,"_injector");C(this,"_disposingCallbacks",new Hs);const r=this._injector=UI(n,t==null?void 0:t.override),{theme:s,darkMode:i,locale:o,locales:a,logLevel:l,logCommandExecution:c}=t;s&&this._injector.get(Ls).setTheme(s),i&&this._injector.get(Ls).setDarkMode(i),a&&this._injector.get(En).load(a),o&&this._injector.get(En).setLocale(o),l&&this._injector.get(gt).setLogLevel(l),c!==void 0&&this._injector.get(kr).setConfig(ws,c),this._init(r)}get _univerInstanceService(){return this._injector.get(Kn)}get _pluginService(){return this._injector.get(exports.PluginService)}__getInjector(){return this._injector}onDispose(t){const n=this._disposingCallbacks.add(Ye(t));return Ye(()=>n.dispose(!0))}dispose(){this._disposingCallbacks.dispose(),this._injector.dispose()}setLocale(t){this._injector.get(En).setLocale(t)}createUnit(t,n){return this._univerInstanceService.createUnit(t,n)}createUniverSheet(t){return this._injector.get(gt).warn("[Univer]","Univer.createUniverSheet is deprecated, use createUnit instead"),this._univerInstanceService.createUnit(ve.UNIVER_SHEET,t)}createUniverDoc(t){return this._injector.get(gt).warn("[Univer]","Univer.createUniverDoc is deprecated, use createUnit instead"),this._univerInstanceService.createUnit(ve.UNIVER_DOC,t)}createUniverSlide(t){return this._injector.get(gt).warn("[Univer]","Univer.createUniverSlide is deprecated, use createUnit instead"),this._univerInstanceService.createUnit(ve.UNIVER_SLIDE,t)}_init(t){this._univerInstanceService.registerCtorForType(ve.UNIVER_SHEET,exports.Workbook),this._univerInstanceService.registerCtorForType(ve.UNIVER_DOC,Nt),this._univerInstanceService.registerCtorForType(ve.UNIVER_SLIDE,ca);const n=t.get(Kn);n.__setCreateHandler((r,s,i,o)=>{if(!this._startedTypes.has(r)){this._pluginService.startPluginsForType(r),this._startedTypes.add(r);const l=t.createInstance(i,s);return n.__addUnit(l,o),this._tryProgressToReady(),l}const a=t.createInstance(i,s);return n.__addUnit(a,o),a})}_tryProgressToReady(){this._injector.get(exports.LifecycleService).stage<Pe.Ready&&(this._injector.get(exports.LifecycleService).stage=Pe.Ready)}registerPlugin(t,n){this._pluginService.registerPlugin(t,n)}registerPlugins(t){t.forEach(n=>{const[r,s]=n;this._pluginService.registerPlugin(r,s)})}}function UI(e,t){const n=ad([[kh],[En],[Ls],[exports.LifecycleService],[exports.PluginService],[Mr],[Kn,{useClass:exports.UniverInstanceService}],[id,{useClass:od}],[gt,{useClass:fu,lazy:!0}],[Hr,{useClass:exports.CommandService}],[Js,{useClass:exports.LocalUndoRedoService,lazy:!0}],[kr,{useClass:uu}],[Jn,{useClass:hu}],[qs,{useClass:exports.ResourceManagerService,lazy:!0}],[ro,{useClass:io,lazy:!0}],[xh,{useClass:exports.AuthzIoLocalService}],[sd,{useClass:exports.MentionIOLocalService,lazy:!0}]],t),r=e?e.createChild(n):new ye.Injector(n);return Pl(r,[[Mr],[ro]]),r}Nd();exports.ABCToNumber=X0;exports.AUTO_HEIGHT_FOR_MERGED_CELLS=xl;exports.AbsoluteRefType=Me;exports.ActionIterator=Dn;exports.AlignTypeH=eu;exports.AlignTypeV=tu;exports.ArrangeTypeEnum=su;exports.ArrowsAndMarkersShapes=bc;exports.AsyncInterceptorManager=Zd;exports.AsyncLock=Bd;exports.AutoFillSeries=mc;exports.BaselineOffset=gn;exports.BasicShapes=wc;exports.BlockType=xc;exports.BooleanNumber=ce;exports.BorderStyleTypes=xe;exports.BorderType=gc;exports.BuildTextUtils=et;exports.BulletAlignment=Pr;exports.COLORS=Li;exports.COMMAND_LOG_EXECUTION_CONFIG_KEY=ws;exports.CanceledError=Vd;exports.CellModeEnum=Pn;exports.CellValueType=Zt;exports.ColorKit=ft;exports.ColorType=_c;exports.ColumnSeparatorType=kc;exports.CommandType=Fr;exports.CommonHideTypes=pc;exports.ConfigService=uu;exports.ContextService=hu;exports.CopyPasteType=Ec;exports.CustomCommandExecutionError=Cs;exports.CustomDecorationType=_n;exports.CustomRangeType=tn;exports.DEFAULT_CELL=w0;exports.DEFAULT_DOC=oa;exports.DEFAULT_DOCUMENT_SUB_COMPONENT_ID=cR;exports.DEFAULT_EMPTY_DOCUMENT_VALUE=Dl;exports.DEFAULT_NUMBER_FORMAT=ta;exports.DEFAULT_RANGE=O0;exports.DEFAULT_RANGE_ARRAY=S0;exports.DEFAULT_SELECTION=v0;exports.DEFAULT_SLIDE=th;exports.DEFAULT_STYLES=it;exports.DEFAULT_TEXT_FORMAT=zu;exports.DEFAULT_TEXT_FORMAT_EXCEL=Vu;exports.DEFAULT_WORKSHEET_COLUMN_COUNT=Kh;exports.DEFAULT_WORKSHEET_COLUMN_COUNT_KEY=WR;exports.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT=Jh;exports.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY=KR;exports.DEFAULT_WORKSHEET_COLUMN_WIDTH=Xh;exports.DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY=zR;exports.DEFAULT_WORKSHEET_ROW_COUNT=Vh;exports.DEFAULT_WORKSHEET_ROW_COUNT_KEY=jR;exports.DEFAULT_WORKSHEET_ROW_HEIGHT=Gh;exports.DEFAULT_WORKSHEET_ROW_HEIGHT_KEY=YR;exports.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH=qh;exports.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY=VR;exports.DOCS_COMMENT_EDITOR_UNIT_ID_KEY=Ml;exports.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY=ao;exports.DOCS_NORMAL_EDITOR_UNIT_ID_KEY=oo;exports.DOCS_ZEN_EDITOR_UNIT_ID_KEY=Nl;exports.DOC_DRAWING_PRINTING_COMPONENT_KEY=N0;exports.DOC_RANGE_TYPE=Ou;exports.DashStyleType=Wc;exports.DataStreamTreeNodeType=Ah;exports.DataStreamTreeTokenType=lt;exports.DataValidationErrorStyle=Ed;exports.DataValidationImeMode=Cd;exports.DataValidationOperator=Rd;exports.DataValidationRenderMode=Id;exports.DataValidationStatus=Sd;exports.DataValidationType=Od;exports.DeleteDirection=Cc;exports.DependentOn=fI;exports.DesktopLogService=fu;exports.DeveloperMetadataVisibility=Rc;exports.Dimension=Ic;exports.Direction=Sc;exports.Disposable=Xe;exports.DisposableCollection=Hs;exports.DocStyleType=Dc;exports.DocumentDataModel=Nt;exports.DocumentFlavor=Co;exports.DrawingTypeEnum=iu;exports.EDITOR_ACTIVATED=Uh;exports.EXTENSION_NAMES=nh;exports.ErrorService=kh;exports.EventState=Lh;exports.EventSubject=uR;exports.FOCUSING_COMMENT_EDITOR=IR;exports.FOCUSING_COMMON_DRAWINGS=vR;exports.FOCUSING_DOC=Cr;exports.FOCUSING_EDITOR_BUT_HIDDEN=pR;exports.FOCUSING_EDITOR_INPUT_FORMULA=ER;exports.FOCUSING_EDITOR_STANDALONE=RR;exports.FOCUSING_FX_BAR_EDITOR=Ph;exports.FOCUSING_PANEL_EDITOR=SR;exports.FOCUSING_SHAPE_TEXT_EDITOR=wR;exports.FOCUSING_SHEET=Hn;exports.FOCUSING_SLIDE=Rr;exports.FOCUSING_UNIT=Er;exports.FOCUSING_UNIVER_EDITOR=CR;exports.FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE=OR;exports.FORMULA_EDITOR_ACTIVATED=bR;exports.FollowNumberWithType=Lc;exports.FontItalic=Os;exports.FontStyleType=Un;exports.FontWeight=vs;exports.GridType=Uc;exports.HorizontalAlign=At;exports.IAuthzIoService=xh;exports.ICommandService=Hr;exports.IConfigService=kr;exports.IConfirmService=gR;exports.IContextService=Jn;exports.IImageIoService=Qi;exports.ILocalStorageService=iI;exports.ILogService=gt;exports.IMentionIOService=sd;exports.IPermissionService=id;exports.IResourceLoaderService=ro;exports.IResourceManagerService=qs;exports.IS_ROW_STYLE_PRECEDE_COLUMN_STYLE=Ll;exports.IURLImageService=eo;exports.IUndoRedoService=Js;exports.IUniverInstanceService=Kn;exports.ImageCacheMap=md;exports.ImageSourceType=Ds;exports.ImageUploadStatusType=Fh;exports.InterceptorEffectEnum=xn;exports.InterceptorManager=Xd;exports.InterpolationPointType=Oc;exports.JSON1=k_;exports.JSONX=Yt;exports.LRUHelper=gr;exports.LRUMap=Gs;exports.LifecycleStages=Pe;exports.LifecycleUnreachableError=nd;exports.ListGlyphType=fe;exports.LocaleService=En;exports.LocaleType=Ur;exports.LogLevel=du;exports.MAX_COLUMN_COUNT=zi;exports.MAX_ROW_COUNT=Yi;exports.MOVE_BUFFER_VALUE=lr;exports.MemoryCursor=Sn;exports.MentionType=Ss;exports.NAMED_STYLE_MAP=y0;exports.NAMED_STYLE_SPACE_MAP=A0;exports.NamedStyleType=qe;exports.NilCommand=mu;exports.NumberUnitType=Qc;exports.ObjectMatrix=ct;exports.ObjectRelativeFromH=Jc;exports.ObjectRelativeFromV=Zc;exports.OtherShapes=yc;exports.PAGE_SIZE=M0;exports.PAPER_TYPES=A_;exports.PRESET_LIST_TYPE=jr;exports.PRINT_CHART_COMPONENT_KEY=T0;exports.PageElementType=ou;exports.PageOrientType=ru;exports.PageType=Ro;exports.PaperType=ht;exports.ParagraphElementType=Hc;exports.ParagraphStyleBuilder=Nr;exports.ParagraphStyleValue=Yr;exports.PermissionService=od;exports.PermissionStatus=ua;exports.Plugin=fn;exports.PositionedObjectLayoutType=$c;exports.PresetListType=Pt;exports.ProtectionType=vc;exports.QuickListType=Ch;exports.QuickListTypeMap=oC;exports.RANGE_DIRECTION=Su;exports.RANGE_TYPE=_e;exports.RBush=As;exports.RCDisposable=f_;exports.RGBA_PAREN=Z_;exports.RGB_PAREN=J_;exports.ROTATE_BUFFER_VALUE=Eu;exports.RTree=SI;exports.Range=Vn;exports.Rectangle=Wt;exports.RedoCommand=fd;exports.RedoCommandId=ud;exports.RefAlias=G0;exports.Registry=_o;exports.RegistryAsMap=po;exports.RelativeDate=Tc;exports.RelativeSlideLink=au;exports.RichTextBuilder=pn;exports.RichTextValue=Jt;exports.RxDisposable=d_;exports.SHEET_EDITOR_UNITS=b0;exports.SectionType=Pc;exports.SheetTypes=Nc;exports.SheetViewModel=Qh;exports.SliceBodyType=ia;exports.SlideDataModel=ca;exports.SpacingRule=jc;exports.SpecialShapes=Ac;exports.Styles=Hh;exports.THEME_COLORS=vu;exports.TabStopAlignment=Yc;exports.TableAlignmentType=Vc;exports.TableLayoutType=Kc;exports.TableRowHeightRule=Xc;exports.TableSizeType=zc;exports.TableTextWrapType=Gc;exports.TestConfirmService=_R;exports.TextDecoration=Mc;exports.TextDecorationBuilder=qt;exports.TextDirection=yr;exports.TextDirectionType=Fc;exports.TextStyleBuilder=en;exports.TextStyleValue=Wr;exports.TextX=De;exports.TextXActionType=q;exports.ThemeColorType=ot;exports.ThemeColors=$s;exports.ThemeService=Ls;exports.Tools=Z;exports.UndoCommand=dd;exports.UndoCommandId=hd;exports.UnitModel=Bs;exports.Univer=xI;exports.UniverInstanceType=ve;exports.UpdateDocsAttributeType=Ee;exports.UserManagerService=Mr;exports.VerticalAlign=mn;exports.VerticalAlignmentType=qc;exports.Worksheet=Dr;exports.WrapStrategy=Rn;exports.WrapTextType=Bc;exports.addLinkToDocumentModel=Bh;exports.afterInitApply=K_;exports.afterTime=z_;exports.awaitTime=OI;exports.binSearchFirstGreaterThanTarget=pu;exports.binarySearchArray=G_;exports.bufferDebounceTime=Y_;exports.cellToRange=yE;exports.characterSpacingControlType=nu;exports.checkForSubstrings=TE;exports.checkIfMove=q_;exports.checkParagraphHasBullet=h0;exports.checkParagraphHasIndent=d0;exports.checkParagraphHasIndentByStyle=Zu;exports.cloneCellData=Wh;exports.cloneCellDataMatrix=Yh;exports.cloneCellDataWithSpanAndDisplay=kR;exports.cloneValue=_t;exports.cloneWorksheetData=zh;exports.codeToBlob=X_;exports.columnLabelToNumber=I0;exports.composeBody=Xi;exports.composeInterceptors=Fl;exports.composeStyles=or;exports.concatMatrixArray=_E;exports.convertCellToRange=Gu;exports.convertObservableToBehaviorSubject=V_;exports.covertCellValue=Wi;exports.covertCellValues=AE;exports.createAsyncInterceptorKey=qd;exports.createDefaultUser=Ms;exports.createDocumentModelWithStyle=Ir;exports.createInterceptorKey=Gd;exports.createInternalEditorID=Wd;exports.createREGEXFromWildChar=b_;exports.createRowColIter=Vi;exports.customNameCharacterCheck=II;exports.dayjs=Vt;exports.debounce=Qg;exports.dedupe=Md;exports.dedupeBy=Dd;exports.deepCompare=na;exports.delayAnimationFrame=vI;exports.deleteContent=eh;exports.extractPureTextFromCell=ed;exports.fromCallback=gu;exports.fromEventSubject=hR;exports.generateIntervalsByPoints=g0;exports.generateRandomId=nt;exports.get=sc;exports.getArrayLength=Qt;exports.getBodySlice=Tt;exports.getBorderStyleType=vE;exports.getCellCoordByIndexSimple=da;exports.getCellInfoInMergeData=gp;exports.getCellPositionByIndexSimple=NI;exports.getCellValueType=dp;exports.getCellWithCoordByIndexCore=Ln;exports.getColorStyle=xt;exports.getCustomBlockSlice=Oh;exports.getCustomDecorationSlice=wh;exports.getCustomRangeSlice=vh;exports.getDocsUpdateBody=wE;exports.getEmptyCell=xR;exports.getIntersectRange=sh;exports.getNumfmtParseValueFilter=Ku;exports.getOriginCellValue=XR;exports.getParagraphsSlice=Sh;exports.getPlainText=Xs;exports.getReverseDirection=y_;exports.getSectionBreakSlice=gC;exports.getTableSlice=Ih;exports.getTextRunSlice=Ns;exports.getTransformOffsetX=_d;exports.getTransformOffsetY=pd;exports.getWorksheetUID=QR;exports.groupBy=Ud;exports.handleStyleToString=OE;exports.hashAlgorithm=m0;exports.horizontalLineSegmentsSubtraction=Ks;exports.insertMatrixArray=gE;exports.insertTextToContent=Qu;exports.invertColorByHSL=sf;exports.invertColorByMatrix=af;exports.isBlackColor=up;exports.isBooleanString=jd;exports.isCellCoverable=ji;exports.isCellV=Iu;exports.isCommentEditorID=Yd;exports.isDefaultFormat=cE;exports.isEmptyCell=Xu;exports.isFormulaId=SE;exports.isFormulaString=qu;exports.isICellData=Ru;exports.isInternalEditorID=Ul;exports.isNodeEnv=w_;exports.isNotNullOrUndefined=$h;exports.isNullCell=fp;exports.isNumeric=lc;exports.isPatternEqualWithoutDecimal=uE;exports.isRangesEqual=NR;exports.isRealNum=f0;exports.isSafeNumeric=a_;exports.isSameStyleTextRun=Ju;exports.isTextFormat=lE;exports.isUnitRangesEqual=MR;exports.isValidRange=bE;exports.isWhiteColor=hp;exports.makeArray=Pd;exports.makeCellRangeToRangeData=IE;exports.makeCellToSelection=RE;exports.makeCustomRangeStream=TC;exports.mapObjectMatrix=mE;exports.merge=Fs;exports.mergeIntervals=_0;exports.mergeLocales=p0;exports.mergeOverrideWithDependencies=ad;exports.mergeSets=u_;exports.mergeWith=r_;exports.mergeWorksheetSnapshotWithDefault=Zh;exports.mixinClass=o_;exports.moveMatrixArray=$i;exports.moveRangeByOffset=F0;exports.nameCharacterCheck=RI;exports.normalizeBody=_C;exports.normalizeTextRuns=$r;exports.numberToABC=J0;exports.numberToListABC=Z0;exports.numfmt=aE;exports.queryObjectMatrix=K0;exports.registerDependencies=zd;exports.remove=Lr;exports.repeatStringNumTimes=oh;exports.replaceInDocumentBody=aR;exports.requestImmediateMacroTask=c_;exports.resolveWithBasePath=p_;exports.rotate=xd;exports.searchArray=ar;exports.searchInOrderedArray=_u;exports.selectionToArray=mp;exports.sequence=uc;exports.sequenceAsync=cc;exports.sequenceExecute=js;exports.sequenceExecuteAsync=W_;exports.set=i_;exports.shallowEqual=kl;exports.skipParseTagNames=MI;exports.sliceMatrixArray=pE;exports.sortRules=Q0;exports.sortRulesByDesc=eC;exports.sortRulesFactory=Br;exports.spliceArray=Bi;exports.splitIntoGrid=ra;exports.takeAfter=Di;exports.textDiff=aa;exports.throttle=Kd;exports.toDisposable=Ye;exports.touchDependencies=Pl;exports.updateAttributeByDelete=bh;exports.updateAttributeByInsert=yh;exports.willLoseNumericPrecision=l_;Object.keys(ye).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>ye[e]})});
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;