@univerjs/core 1.0.0-alpha.1 → 1.0.0-insiders.20260629-12f2e44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +1 -1
- package/lib/es/index.js +1 -1
- package/lib/index.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +3 -3
- package/LICENSE +0 -176
package/lib/cjs/index.js
CHANGED
|
@@ -15750,7 +15750,7 @@ const IURLImageService = (0, _wendellhu_redi.createIdentifier)("core.url-image.s
|
|
|
15750
15750
|
//#endregion
|
|
15751
15751
|
//#region package.json
|
|
15752
15752
|
var name = "@univerjs/core";
|
|
15753
|
-
var version = "1.0.0-
|
|
15753
|
+
var version = "1.0.0-insiders.20260629-12f2e44";
|
|
15754
15754
|
|
|
15755
15755
|
//#endregion
|
|
15756
15756
|
//#region src/sheets/empty-snapshot.ts
|
package/lib/es/index.js
CHANGED
|
@@ -15716,7 +15716,7 @@ const IURLImageService = createIdentifier("core.url-image.service");
|
|
|
15716
15716
|
//#endregion
|
|
15717
15717
|
//#region package.json
|
|
15718
15718
|
var name = "@univerjs/core";
|
|
15719
|
-
var version = "1.0.0-
|
|
15719
|
+
var version = "1.0.0-insiders.20260629-12f2e44";
|
|
15720
15720
|
|
|
15721
15721
|
//#endregion
|
|
15722
15722
|
//#region src/sheets/empty-snapshot.ts
|
package/lib/index.js
CHANGED
|
@@ -15716,7 +15716,7 @@ const IURLImageService = createIdentifier("core.url-image.service");
|
|
|
15716
15716
|
//#endregion
|
|
15717
15717
|
//#region package.json
|
|
15718
15718
|
var name = "@univerjs/core";
|
|
15719
|
-
var version = "1.0.0-
|
|
15719
|
+
var version = "1.0.0-insiders.20260629-12f2e44";
|
|
15720
15720
|
|
|
15721
15721
|
//#endregion
|
|
15722
15722
|
//#region src/sheets/empty-snapshot.ts
|
package/lib/umd/index.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
`)?t.slice(0,-2):t},Rh=e=>e?Lh(e).replaceAll(`\r`,``)===``:!0,zh=e=>{let t=e.replace(/\n/g,`\r`),n=[],r=new Set,i=[],a=0,o=``,s=(s,c=!0)=>{let l=t.slice(a,s);if(z.isLegalUrl(l)){let t=V(),u=`${l}`,d={startIndex:a,endIndex:a+u.length-1,rangeId:t,rangeType:0,properties:{url:e}};i.push(d),o+=u,a=s+1,c&&(o+=`\r`,n.push({startIndex:s,paragraphId:Is(r)}))}else o+=t.slice(a,s+1),a=s+1,c&&n.push({startIndex:s,paragraphId:Is(r)})},c=0;for(let e=0;e<t.length;e++)t[e]===`\r`&&(s(e),c=e);return(c!==t.length-1||t.length===1)&&s(t.length,!1),{dataStream:o,paragraphs:n,customRanges:i}},Bh={id:`default_doc`,documentStyle:{}};function Vh(e){if(e.id!=null&&Dt(e.id))return{...Bh,...e};let t=Hs(e.id,e.locale,e.title);if(z.isEmptyObject(e))return t;let n=z.commonExtend(t,e),{documentStyle:r,settings:i}=e;return r!=null&&(r.pageSize!=null&&(r.pageSize={...t.documentStyle.pageSize,...r.pageSize}),r.renderConfig!=null&&(r.renderConfig={...t.documentStyle.renderConfig,...r.renderConfig}),n.documentStyle=z.commonExtend(t.documentStyle,r)),i!=null&&(n.settings={...t.settings,...i}),n}var Hh=class extends M{getUnitId(){throw Error(`Method not implemented.`)}constructor(e){var r;super(),T(this,`type`,n.UniverType.UNIVER_DOC),T(this,`_name$`,new t.BehaviorSubject(``)),T(this,`name$`,this._name$.asObservable()),T(this,`snapshot`,void 0),this.snapshot=Vh(e),this._name$.next((r=this.snapshot.title)==null?`No Title`:r)}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{...Im,...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}},Uh=class e extends Hh{constructor(e){var n,r;super(z.isEmptyObject(e)?Hs():e),T(this,`_unitId`,void 0),T(this,`headerModelMap`,new Map),T(this,`footerModelMap`,new Map),T(this,`change$`,new t.BehaviorSubject(0)),this._unitId=(n=this.snapshot.id)==null?V(6):n,this._initializeHeaderFooterModel(),this._name$.next((r=this.snapshot.title)==null?``:r)}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=Vh(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(!Mh.isNoop(e))return this.snapshot=Mh.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=0){let r=this.getBody();if(r!=null)return ah(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 Lh((e=(t=this.getBody())==null?void 0:t.dataStream)==null?``:e)}};function Wh(e){let{ranges:t,id:n,type:r}=e,i=new Z,a=0;for(let e=0;e<t.length;e++){let{startOffset:o,endOffset:s}=t[e];o>0&&i.push({t:`r`,len:o-a}),i.push({t:`r`,body:{dataStream:``,customDecorations:[{id:n,type:r,startIndex:0,endIndex:s-o-1}]},len:s-o}),a=s}return i}function Gh(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 Z,{startIndex:c,endIndex:l}=o,u=l-c+1;return s.push({t:`r`,len:c}),s.push({t:`r`,len:u,body:{dataStream:``,customDecorations:[{startIndex:0,endIndex:u-1,id:n,type:9999}]}}),s}function Kh(e,t,n,r){return e<=n&&t>=n||e>=n&&e<=r}function qh(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):Kh(e.startOffset,e.endOffset-1,i.startIndex,i.endIndex)&&n.push(i)}return n}function Jh(e){return{...z.deepClone(e),rangeId:V()}}function Yh(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 Xh(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 Zh(e,t){var n,r,i,a,o;let s=Xh(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}}var Qh=h(f(((e,t)=>{var n=-1,r=1,i=0;function a(e,t,n,r,a){if(e===t)return e?[[i,e]]:[];if(n!=null){var s=D(e,t,n);if(s)return s}var c=l(e,t),u=e.substring(0,c);e=e.substring(c),t=t.substring(c),c=d(e,t);var f=e.substring(e.length-c);e=e.substring(0,e.length-c),t=t.substring(0,t.length-c);var m=o(e,t);return u&&m.unshift([i,u]),f&&m.push([i,f]),b(m,a),r&&p(m),m}function o(e,t){var o;if(!e)return[[r,t]];if(!t)return[[n,e]];var c=e.length>t.length?e:t,l=e.length>t.length?t:e,u=c.indexOf(l);if(u!==-1)return o=[[r,c.substring(0,u)],[i,l],[r,c.substring(u+l.length)]],e.length>t.length&&(o[0][0]=o[2][0]=n),o;if(l.length===1)return[[n,e],[r,t]];var d=f(e,t);if(d){var p=d[0],m=d[1],h=d[2],g=d[3],_=d[4],v=a(p,h),y=a(m,g);return v.concat([[i,_]],y)}return s(e,t)}function s(e,t){for(var i=e.length,a=t.length,o=Math.ceil((i+a)/2),s=o,l=2*o,u=Array(l),d=Array(l),f=0;f<l;f++)u[f]=-1,d[f]=-1;u[s+1]=0,d[s+1]=0;for(var p=i-a,m=p%2!=0,h=0,g=0,_=0,v=0,y=0;y<o;y++){for(var b=-y+h;b<=y-g;b+=2){for(var x=s+b,S=b===-y||b!==y&&u[x-1]<u[x+1]?u[x+1]:u[x-1]+1,C=S-b;S<i&&C<a&&e.charAt(S)===t.charAt(C);)S++,C++;if(u[x]=S,S>i)g+=2;else if(C>a)h+=2;else if(m){var w=s+p-b;if(w>=0&&w<l&&d[w]!==-1){var T=i-d[w];if(S>=T)return c(e,t,S,C)}}}for(var E=-y+_;E<=y-v;E+=2){for(var w=s+E,T=E===-y||E!==y&&d[w-1]<d[w+1]?d[w+1]:d[w-1]+1,D=T-E;T<i&&D<a&&e.charAt(i-T-1)===t.charAt(a-D-1);)T++,D++;if(d[w]=T,T>i)v+=2;else if(D>a)_+=2;else if(!m){var x=s+p-E;if(x>=0&&x<l&&u[x]!==-1){var S=u[x],C=s+S-x;if(T=i-T,S>=T)return c(e,t,S,C)}}}}return[[n,e],[r,t]]}function c(e,t,n,r){var i=e.substring(0,n),o=t.substring(0,r),s=e.substring(n),c=t.substring(r),l=a(i,o),u=a(s,c);return l.concat(u)}function l(e,t){if(!e||!t||e.charAt(0)!==t.charAt(0))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,a=0;n<i;)e.substring(a,i)==t.substring(a,i)?(n=i,a=n):r=i,i=Math.floor((r-n)/2+n);return x(e.charCodeAt(i-1))&&i--,i}function u(e,t){var n=e.length,r=t.length;if(n==0||r==0)return 0;n>r?e=e.substring(n-r):n<r&&(t=t.substring(0,n));var i=Math.min(n,r);if(e==t)return i;for(var a=0,o=1;;){var s=e.substring(i-o),c=t.indexOf(s);if(c==-1)return a;o+=c,(c==0||e.substring(i-o)==t.substring(0,o))&&(a=o,o++)}}function d(e,t){if(!e||!t||e.slice(-1)!==t.slice(-1))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,a=0;n<i;)e.substring(e.length-i,e.length-a)==t.substring(t.length-i,t.length-a)?(n=i,a=n):r=i,i=Math.floor((r-n)/2+n);return S(e.charCodeAt(e.length-i))&&i--,i}function f(e,t){var n=e.length>t.length?e:t,r=e.length>t.length?t:e;if(n.length<4||r.length*2<n.length)return null;function i(e,t,n){for(var r=e.substring(n,n+Math.floor(e.length/4)),i=-1,a=``,o,s,c,u;(i=t.indexOf(r,i+1))!==-1;){var f=l(e.substring(n),t.substring(i)),p=d(e.substring(0,n),t.substring(0,i));a.length<p+f&&(a=t.substring(i-p,i)+t.substring(i,i+f),o=e.substring(0,n-p),s=e.substring(n+f),c=t.substring(0,i-p),u=t.substring(i+f))}return a.length*2>=e.length?[o,s,c,u,a]:null}var a=i(n,r,Math.ceil(n.length/4)),o=i(n,r,Math.ceil(n.length/2)),s;if(!a&&!o)return null;s=o?a&&a[4].length>o[4].length?a:o:a;var c,u,f,p;e.length>t.length?(c=s[0],u=s[1],f=s[2],p=s[3]):(f=s[0],p=s[1],c=s[2],u=s[3]);var m=s[4];return[c,u,f,p,m]}function p(e){for(var t=!1,a=[],o=0,s=null,c=0,l=0,d=0,f=0,p=0;c<e.length;)e[c][0]==i?(a[o++]=c,l=f,d=p,f=0,p=0,s=e[c][1]):(e[c][0]==r?f+=e[c][1].length:p+=e[c][1].length,s&&s.length<=Math.max(l,d)&&s.length<=Math.max(f,p)&&(e.splice(a[o-1],0,[n,s]),e[a[o-1]+1][0]=r,o--,o--,c=o>0?a[o-1]:-1,l=0,d=0,f=0,p=0,s=null,t=!0)),c++;for(t&&b(e),y(e),c=1;c<e.length;){if(e[c-1][0]==n&&e[c][0]==r){var m=e[c-1][1],h=e[c][1],g=u(m,h),_=u(h,m);g>=_?(g>=m.length/2||g>=h.length/2)&&(e.splice(c,0,[i,h.substring(0,g)]),e[c-1][1]=m.substring(0,m.length-g),e[c+1][1]=h.substring(g),c++):(_>=m.length/2||_>=h.length/2)&&(e.splice(c,0,[i,m.substring(0,_)]),e[c-1][0]=r,e[c-1][1]=h.substring(0,h.length-_),e[c+1][0]=n,e[c+1][1]=m.substring(_),c++),c++}c++}}var m=/[^a-zA-Z0-9]/,h=/\s/,g=/[\r\n]/,_=/\n\r?\n$/,v=/^\r?\n\r?\n/;function y(e){function t(e,t){if(!e||!t)return 6;var n=e.charAt(e.length-1),r=t.charAt(0),i=n.match(m),a=r.match(m),o=i&&n.match(h),s=a&&r.match(h),c=o&&n.match(g),l=s&&r.match(g),u=c&&e.match(_),d=l&&t.match(v);return u||d?5:c||l?4:i&&!o&&s?3:o||s?2:i||a?1:0}for(var n=1;n<e.length-1;){if(e[n-1][0]==i&&e[n+1][0]==i){var r=e[n-1][1],a=e[n][1],o=e[n+1][1],s=d(r,a);if(s){var c=a.substring(a.length-s);r=r.substring(0,r.length-s),a=c+a.substring(0,a.length-s),o=c+o}for(var l=r,u=a,f=o,p=t(r,a)+t(a,o);a.charAt(0)===o.charAt(0);){r+=a.charAt(0),a=a.substring(1)+o.charAt(0),o=o.substring(1);var y=t(r,a)+t(a,o);y>=p&&(p=y,l=r,u=a,f=o)}e[n-1][1]!=l&&(l?e[n-1][1]=l:(e.splice(n-1,1),n--),e[n][1]=u,f?e[n+1][1]=f:(e.splice(n+1,1),n--))}n++}}function b(e,t){e.push([i,``]);for(var a=0,o=0,s=0,c=``,u=``,f;a<e.length;){if(a<e.length-1&&!e[a][1]){e.splice(a,1);continue}switch(e[a][0]){case r:s++,u+=e[a][1],a++;break;case n:o++,c+=e[a][1],a++;break;case i:var p=a-s-o-1;if(t){if(p>=0&&w(e[p][1])){var m=e[p][1].slice(-1);if(e[p][1]=e[p][1].slice(0,-1),c=m+c,u=m+u,!e[p][1]){e.splice(p,1),a--;var h=p-1;e[h]&&e[h][0]===r&&(s++,u=e[h][1]+u,h--),e[h]&&e[h][0]===n&&(o++,c=e[h][1]+c,h--),p=h}}if(C(e[a][1])){var m=e[a][1].charAt(0);e[a][1]=e[a][1].slice(1),c+=m,u+=m}}if(a<e.length-1&&!e[a][1]){e.splice(a,1);break}if(c.length>0||u.length>0){c.length>0&&u.length>0&&(f=l(u,c),f!==0&&(p>=0?e[p][1]+=u.substring(0,f):(e.splice(0,0,[i,u.substring(0,f)]),a++),u=u.substring(f),c=c.substring(f)),f=d(u,c),f!==0&&(e[a][1]=u.substring(u.length-f)+e[a][1],u=u.substring(0,u.length-f),c=c.substring(0,c.length-f)));var g=s+o;c.length===0&&u.length===0?(e.splice(a-g,g),a-=g):c.length===0?(e.splice(a-g,g,[r,u]),a=a-g+1):u.length===0?(e.splice(a-g,g,[n,c]),a=a-g+1):(e.splice(a-g,g,[n,c],[r,u]),a=a-g+2)}a!==0&&e[a-1][0]===i?(e[a-1][1]+=e[a][1],e.splice(a,1)):a++,s=0,o=0,c=``,u=``;break}}e[e.length-1][1]===``&&e.pop();var _=!1;for(a=1;a<e.length-1;)e[a-1][0]===i&&e[a+1][0]===i&&(e[a][1].substring(e[a][1].length-e[a-1][1].length)===e[a-1][1]?(e[a][1]=e[a-1][1]+e[a][1].substring(0,e[a][1].length-e[a-1][1].length),e[a+1][1]=e[a-1][1]+e[a+1][1],e.splice(a-1,1),_=!0):e[a][1].substring(0,e[a+1][1].length)==e[a+1][1]&&(e[a-1][1]+=e[a+1][1],e[a][1]=e[a][1].substring(e[a+1][1].length)+e[a+1][1],e.splice(a+1,1),_=!0)),a++;_&&b(e,t)}function x(e){return e>=55296&&e<=56319}function S(e){return e>=56320&&e<=57343}function C(e){return S(e.charCodeAt(0))}function w(e){return x(e.charCodeAt(e.length-1))}function T(e){for(var t=[],n=0;n<e.length;n++)e[n][1].length>0&&t.push(e[n]);return t}function E(e,t,a,o){return w(e)||C(o)?null:T([[i,e],[n,t],[r,a],[i,o]])}function D(e,t,n){var r=typeof n==`number`?{index:n,length:0}:n.oldRange,i=typeof n==`number`?null:n.newRange,a=e.length,o=t.length;if(r.length===0&&(i===null||i.length===0)){var s=r.index,c=e.slice(0,s),l=e.slice(s),u=i?i.index:null;editBefore:{var d=s+o-a;if(u!==null&&u!==d||d<0||d>o)break editBefore;var f=t.slice(0,d),p=t.slice(d);if(p!==l)break editBefore;var m=Math.min(s,d),h=c.slice(0,m),g=f.slice(0,m);if(h!==g)break editBefore;var _=c.slice(m),v=f.slice(m);return E(h,_,v,l)}editAfter:{if(u!==null&&u!==s)break editAfter;var y=s,f=t.slice(0,y),p=t.slice(y);if(f!==c)break editAfter;var b=Math.min(a-y,o-y),x=l.slice(l.length-b),S=p.slice(p.length-b);if(x!==S)break editAfter;var _=l.slice(0,l.length-b),v=p.slice(0,p.length-b);return E(c,_,v,x)}}if(r.length>0&&i&&i.length===0)replaceRange:{var h=e.slice(0,r.index),x=e.slice(r.index+r.length),m=h.length,b=x.length;if(o<m+b)break replaceRange;var g=t.slice(0,m),S=t.slice(o-b);if(h!==g||x!==S)break replaceRange;var _=e.slice(m,a-b),v=t.slice(m,o-b);return E(h,_,v,x)}return null}function O(e,t,n,r){return a(e,t,n,r,!0)}O.INSERT=r,O.DELETE=n,O.EQUAL=i,t.exports=O}))());function $h(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 Z,d=l-c+1;u.push({t:`r`,len:c}),u.push({t:`r`,len:d,body:{dataStream:``,customRanges:[]}}),o&&u.push({t:`i`,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 eg(e){let{ranges:t,rangeId:n,rangeType:r,wholeEntity:i,properties:a,body:o}=e,s=0,c=new Z,l=!1;return t.forEach(e=>{var t,u,d;let f=Zh(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=Xh(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:`r`,len:m-s}),c.push({t:`r`,len:g-m+1,body:{dataStream:``,customRanges:[_]},coverType:0}),s=g+1},_=((u=o.paragraphs)==null?[]:u).filter(e=>e.startIndex<m&&e.startIndex>p),v=((d=o.customBlocks)==null?[]:d).filter(e=>e.startIndex<m&&e.startIndex>p);Yh([p,m-1],[..._.map(e=>e.startIndex),...v.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 tg(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:`r`,len:t-c}),c=t),c<n&&(a.push({t:`d`,len:n-c}),c=n)}),r&&a.push({t:`i`,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:`r`,len:t.startIndex-c}),c=t.startIndex),a.push({t:`r`,len:1,body:{dataStream:``,paragraphs:[{...t,startIndex:0,bullet:s==null?void 0:s.bullet}]},coverType:1}))}return a}function ng(e,t,n=0){let r=[],i=n;return e.forEach(e=>{let{startOffset:n,endOffset:a}=e;n>i&&(r.push({t:`r`,len:n-i}),i=n),a>i&&(r.push({t:`r`,len:a-i,body:{...z.deepClone(t),dataStream:``}}),i=a)}),r}let rg=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:ah(o,n.startOffset,n.endOffset),c=(0,Qh.default)(s?s.dataStream:``,r.dataStream),l=0,u=c.map(([e,t])=>{switch(e){case 0:{let e={t:`r`,body:{...ah(r,l,l+t.length,!1),dataStream:``},len:t.length};return l+=t.length,e}case 1:{let e={t:`i`,body:ah(r,l,l+t.length),len:t.length};return l+=t.length,e}default:return{t:`d`,len:t.length}}}),d=new Z;return d.push({t:`r`,len:n.startOffset}),d.push(...u),d};function ig(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])))}let ag=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:ah(s,n.startOffset,n.endOffset),l=(0,Qh.default)(c?c.dataStream:``,r.dataStream),u=0,d=l.map(([e,t])=>{switch(e){case 0:{let e=Qm(r,u,u+t.length,!1),n={t:`r`,body:ig(e,Qm(c,u,u+t.length,!1))?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,n}case 1:{let e={t:`i`,body:ah(r,u,u+t.length),len:t.length};return u+=t.length,e}default:return{t:`d`,len:t.length}}});if(d.every(e=>e.t===`r`&&!e.body))return!1;let f=new Z;return f.push({t:`r`,len:n.startOffset}),f.push(...d),f};function og(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}let sg=e=>{var t,n;let{selection:r,documentDataModel:i,drawings:a}=e,{collapsed:o,startOffset:s,segmentId:c}=r,l=new Z,u=Mh.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,h=o?cg(f,s==null?0:s):s==null?0:s;if(o)h>0&&l.push({t:`r`,len:h});else{var g,_;let e=tg([r],f,0,null,!1);l.push(...e);let t=og(f,[r]),n=(g=i.getDrawings())==null?{}:g,a=(_=i.getDrawingsOrder())==null?[]:_,o=t.sort((e,t)=>a.indexOf(e)>a.indexOf(t)?-1:+(a.indexOf(e)<a.indexOf(t)));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++}}let v=lg(f,a,h);l.push({t:`i`,body:v,len:v.dataStream.length});let y=gh(i,c),b=u.editOp(l.serialize(),y);d.push(b);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)=>Mh.compose(e,t),null)};function cg(e,t){return t===0&&e.dataStream[0]===`\r`?1:t}function lg(e,t,n){var r;let i=`\b`.repeat(t.length),a=e.dataStream[n]===`
|
|
6
6
|
`||e.dataStream[n]===void 0;return{dataStream:a?`${i}\r`:i,customBlocks:t.map((e,t)=>({startIndex:t,blockId:e.drawingId})),...a?{paragraphs:[{startIndex:i.length,paragraphId:Is(new Set((r=e.paragraphs)==null?void 0:r.map(e=>e.paragraphId)))}]}:{}}}function ug(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 dg(e){let{startOffset:t,endOffset:n,collapsed:r}=e;return{startOffset:Math.min(t,n),endOffset:Math.max(t,n),collapsed:r}}function fg(e,t,n,r){return Math.max(e,n)<=Math.min(t,r)}function pg(e,t,n,r){let{startOffset:i,endOffset:a}=e,o=r==null?gg(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 mg(e,t,n){let r=[],i=gg(t,n);for(let a of e){let e=pg(a,t,n,i);r.push(...e)}return r}let hg=[`\r`,``,``,`\x1B`,``,``];function gg(e,t){let n=[];for(let r=0;r<e.length;r++){let i=e[r],{startIndex:a}=i,o=a-1;for(;!hg.includes(t[o])&&o>=0;)o--;n.push({...i,paragraphStart:o+1,paragraphEnd:i.startIndex})}return n}let _g=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=V(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!==`CHECK_LIST`&&(o=t.bullet.listType)):n&&n.bullet&&n.bullet.listType.indexOf(o)===0&&(l=n.bullet.listId,o!==`CHECK_LIST`&&(o=n.bullet.listType))}let u=new fo;u.reset();let d=new Z;for(let e of r){var f;let{startIndex:t,paragraphId:n,paragraphStyle:r={},bullet:i}=e;d.push({t:`r`,len:t-u.cursor}),d.push({t:`r`,len:1,body:{dataStream:``,paragraphs:[c?{paragraphId:n,paragraphStyle:r,startIndex:0}:{startIndex:0,paragraphId:n,paragraphStyle:{...r},bullet:{nestingLevel:(f=i==null?void 0:i.nestingLevel)==null?0:f,textStyle:{fs:20},listType:o,listId:l}}]},coverType:1}),u.moveCursorTo(t+1)}return d},vg=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(`CHECK_LIST`)===-1)return!1;let s=new fo;s.reset();let c=new Z,{startIndex:l,paragraphStyle:u={}}=o,d=o.bullet.listType===`CHECK_LIST`?`CHECK_LIST_CHECKED`:`CHECK_LIST`;return c.push({t:`r`,len:l-s.cursor}),c.push({t:`r`,len:1,body:{dataStream:``,paragraphs:[{...o,paragraphStyle:u,startIndex:0,bullet:{...o.bullet,listType:d}}]},coverType:1}),s.moveCursorTo(l+1),c},yg=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=V(6),s=new fo;s.reset();let c=new Z;for(let e of n){var l;let{startIndex:t,paragraphId:n,paragraphStyle:i={},bullet:a}=e;c.push({t:`r`,len:t-s.cursor}),c.push({t:`r`,len:1,body:{dataStream:``,paragraphs:[{startIndex:0,paragraphId:n,paragraphStyle:i,bullet:{nestingLevel:(l=a==null?void 0:a.nestingLevel)==null?0:l,textStyle:(a==null?void 0:a.listType)===r?a.textStyle:{fs:20},listType:r,listId:o}}]},coverType:1}),s.moveCursorTo(t+1)}return c};function bg(e,t){return t.some(t=>e.startIndex>t.startIndex&&e.startIndex<t.endIndex)}let xg=e=>{var t,n,r;let{paragraphs:i,document:a,type:o}=e,s=new fo;s.reset();let c=new Z,l=(t=a.getSnapshot().lists)==null?{}:t,u=(n=(r=a.getBody())==null?void 0:r.tables)==null?[]:n,d={...Im,...l};for(let e of i){let{startIndex:t,paragraphId:n,paragraphStyle:r={},bullet:i}=e,a=bg(e,u);if(c.push({t:`r`,len:t-s.cursor}),i){let e=d[i.listType].nestingLevel.length-1;a&&(e=Math.min(e,2)),c.push({t:`r`,len:1,body:{dataStream:``,paragraphs:[{startIndex:0,paragraphId:n,paragraphStyle:{...r},bullet:{...i,nestingLevel:Math.max(Math.min(i.nestingLevel+o,e),0)}}]},coverType:1})}else c.push({t:`r`,len:1});s.moveCursorTo(t+1)}return c},Sg=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=mg(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 fo;u&&h.moveCursorTo(u);let g=f==null?new Z:f;m.sort((e,t)=>e.startIndex-t.startIndex);let _=Math.max(0,m[0].paragraphStart-1);_>h.cursor&&(g.push({t:`r`,len:_-h.cursor}),h.moveCursorTo(_)),d&&g.push({t:`d`,len:d});for(let e of m){let{startIndex:t,paragraphId:n,paragraphStyle:r={}}=e,i=t-h.cursor;g.push({t:`r`,len:i,...l?{body:{dataStream:``,textRuns:[{ts:l,st:0,ed:i}]},coverType:1}:null}),g.push({t:`r`,len:1,body:{dataStream:``,paragraphs:[{startIndex:0,paragraphId:n,paragraphStyle:{...r,...c}}]},coverType:1}),h.moveCursorTo(t+1)}return g};var Q=class{};T(Q,`customRange`,{add:eg,delete:$h,copyCustomRange:Jh,getCustomRangesInterestsWithSelection:qh,isIntersecting:Kh}),T(Q,`customDecoration`,{add:Wh,delete:Gh}),T(Q,`selection`,{replace:rg,makeSelection:ug,normalizeSelection:dg,delete:tg,replaceTextRuns:ag,retain:ng}),T(Q,`range`,{isIntersects:fg,getParagraphsInRange:pg,getParagraphsInRanges:mg}),T(Q,`transform`,{getPlainText:Lh,fromPlainText:zh,isEmptyDocument:Rh}),T(Q,`paragraph`,{bullet:{set:yg,switch:_g,toggleChecklist:vg,changeNestLevel:xg},style:{set:Sg},util:{transform:gg,getParagraphsInRange:pg,getParagraphsInRanges:mg}}),T(Q,`drawing`,{add:sg});function Cg(e,t,n,r){if(t===``)return e;let i=new Uh({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 Z,t=Mh.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 wg(e){if(e.customRanges||(e.customRanges=[]),!e.paragraphs){e.paragraphs=[];let t=new Set;for(let n=0;n<e.dataStream.length;n++)e.dataStream[n]===`\r`&&e.paragraphs.push({startIndex:n,paragraphId:Is(t)})}return e.customBlocks||(e.customBlocks=[]),e.textRuns||(e.textRuns=[]),e.customDecorations||(e.customDecorations=[]),e.sectionBreaks||(e.sectionBreaks=[]),e.tables||(e.tables=[]),e}function Tg(e){var t;return e.body=wg((t=e.body)==null?{dataStream:``}:t),e.drawingsOrder||(e.drawingsOrder=[]),e.drawings||(e.drawings={}),e.documentStyle||(e.documentStyle={}),e}var Eg=class e{static create(t={}){return new e(t)}constructor(e={}){T(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===1}get bold(){return this._style.bl===1}get underline(){return this._style.ul&&Og.create(this._style.ul)}get bottomBorderLine(){return this._style.bbl&&Og.create(this._style.bbl)}get strikethrough(){return this._style.st&&Og.create(this._style.st)}get overline(){return this._style.ol&&Og.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 Dg.create(z.deepClone(this._style))}getValue(){return{...this._style}}},Dg=class e extends Eg{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,this}setBold(e){return this._style.bl=+!!e,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(z.deepClone(this._style))}build(){return this.getValue()}},Og=class e{static create(t={s:1}){return new e(t)}constructor(e={s:1}){T(this,`_decoration`,void 0),this._decoration=e}get show(){return this._decoration.s===1}get followFontColor(){return this._decoration.c===1}get color(){return this._decoration.cl}get type(){return this._decoration.t}setShow(e){return this._decoration.s=+!!e,this}setFollowFontColor(e){return this._decoration.c=+!!e,this}setColor(e){return this._decoration.cl=e,this}setLineType(e){return this._decoration.t=e,this}copy(){return e.create(z.deepClone(this._decoration))}build(){return{...this._decoration}}},kg=class e{static create(t={}){return new e(t)}constructor(e={}){T(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===1}get keepNext(){return this._style.keepNext===1}get wordWrap(){return this._style.wordWrap===1}get widowControl(){return this._style.widowControl===1}get shading(){return this._style.shading}get suppressHyphenation(){return this._style.suppressHyphenation===1}copy(){return Ag.create(z.deepClone(this._style))}getValue(){return this._style}},Ag=class e extends kg{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,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,this}setKeepNext(e){return this._style.keepNext=+!!e,this}setWordWrap(e){return this._style.wordWrap=+!!e,this}setWidowControl(e){return this._style.widowControl=+!!e,this}setShading(e){return this._style.shading=e,this}setSuppressHyphenation(e){return this._style.suppressHyphenation=+!!e,this}copy(){return e.create(z.deepClone(this._style))}build(){return this.getValue()}},jg=class e{static create(t){return new e(t)}static createByBody(t){return new e({body:t,id:`d`,documentStyle:{}})}constructor(e){if(T(this,`_data`,void 0),!e.body)throw Error(`Invalid document data, body is required`);this._data=Tg(e)}copy(){return Mg.create(z.deepClone(this._data))}slice(e,t){let{body:n,...r}=this._data;return Mg.create({...z.deepClone(r),body:ah(n,e,t)})}toPlainText(){var e,t;return Q.transform.getPlainText((e=(t=this._data.body)==null?void 0:t.dataStream)==null?``:e).replaceAll(`\r`,`
|
|
7
7
|
`)}getParagraphStyle(){var e;return kg.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?Eg.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===0))==null?[]:e}getData(){return this._data}},Mg=class e extends jg{static newEmptyData(){return Tg({id:`d`,documentStyle:{},drawings:{},drawingsOrder:[],body:{dataStream:`\r
|
|
8
|
-
`,customBlocks:[],customRanges:[],paragraphs:[{startIndex:0,paragraphId:Is(new Set)}],textRuns:[],tables:[],sectionBreaks:[]}})}static create(t){return new e(t==null?e.newEmptyData():t)}constructor(e){super(e),T(this,`_doc`,void 0),this._doc=new Uh(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 Dg?t.build():t:n instanceof Dg?n.build():n,!o)return this;let c={dataStream:o,textRuns:s?[{ts:s,st:a,ed:a+o.length}]:[]},l=Q.selection.replace({doc:this._doc,selection:{startOffset:a,endOffset:a,collapsed:!0},body:c});if(!l)throw Error(`Insert text failed, please check.`);return Z.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 jg?e.getData():e:(i=Math.min(e,i),a=t instanceof jg?t.getData():t);let o=Q.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 Z.apply(this._doc.getBody(),o.serialize()),this}delete(e,t){if(t!==void 0){if(!t)return this;let n=Q.selection.delete([{startOffset:e,endOffset:e+t,collapsed:!0}],this._data.body);Z.apply(this._doc.getBody(),n)}return this}setStyle(e,t,n){let r={dataStream:``,textRuns:[{ts:n instanceof Dg?n.build():n,st:0,ed:t-e}]},i=Q.selection.retain([{startOffset:e,endOffset:t,collapsed:!0}],r);return Z.apply(this._doc.getBody(),i),this}setLink(e,t,n){let r=Q.customRange.add({rangeType:0,rangeId:V(),properties:{url:n},ranges:[{startOffset:e,endOffset:t,collapsed:!1}],body:this._data.body});if(!r)throw Error(`Insert text failed, please check.`);return Z.apply(this._doc.getBody(),r.serialize()),this}cancelLink(e,t){if(typeof e==`string`){let t=Q.customRange.delete({rangeId:e,documentDataModel:this._doc});if(!t)throw Error(`Insert text failed, please check.`);Z.apply(this._doc.getBody(),t.serialize())}else this.slice(e,t).getLinks().forEach(e=>{let t=Q.customRange.delete({rangeId:e.rangeId,documentDataModel:this._doc});if(!t)throw Error(`Insert text failed, please check.`);Z.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,paragraphId:Is(new Set),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,paragraphId:Is(new Set),paragraphStyle:t==null?void 0:t.build()}]};return this.insertRichText(r,jg.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:0,rangeId:V(),properties:{url:a},startIndex:0,endIndex:i.length-1}]});return typeof t==`number`?this.insertRichText(t,o):this.insertRichText(o)}},Ng=class{constructor(){T(this,`skipNextObservers`,!1),T(this,`lastReturnValue`,void 0),T(this,`isStopPropagation`,!1)}stopPropagation(){this.isStopPropagation=!0}},Pg=class extends t.Subject{constructor(...e){super(...e),T(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 Ng;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 Fg(e){return new t.Observable(t=>{let n=e.subscribeEvent(e=>{t.next(e)});return()=>n.unsubscribe()})}let Ig=(0,r.createIdentifier)(`core.resource-manager.service`),Lg={[n.UnitRole.Editor]:`Editor`,[n.UnitRole.Owner]:`Owner`,[n.UnitRole.Reader]:`Reader`,[n.UnitRole.UNRECOGNIZED]:`UNRECOGNIZED`},Rg=e=>e?{userID:`${Lg[e]}_${V(8)}`,name:Lg[e],avatar:``}:{userID:``,name:``,avatar:``,anonymous:!0,canBindAnonymous:!1},zg=(e,t)=>e.startsWith(Lg[t]);var Bg=class extends k{constructor(...e){super(...e),T(this,`_model`,new Map),T(this,`_userChange$`,new t.Subject),T(this,`userChange$`,this._userChange$.asObservable()),T(this,`_currentUser$`,new t.BehaviorSubject(Rg())),T(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 Vg=class{constructor(e,t){this._resourceManagerService=e,this._userManagerService=t,T(this,`_permissionMap`,new Map([])),T(this,`_permissionOverrides`,new Map),T(this,`_cfgEnableObjInherit`,!1),this._initSnapshot(),this._initDefaultUser()}_initDefaultUser(){let e=this._userManagerService.getCurrentUser();e&&e.userID||this._userManagerService.setCurrentUser(Rg(n.UnitRole.Owner))}_getRole(e){let t=this._userManagerService.getCurrentUser();return t?zg(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:[n.UniverType.UNIVER_SHEET,n.UniverType.UNIVER_DOC,n.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=V(8),{objectType:r,selectRangeObject:i,worksheetObject:a}=e,o=i||a,s={objectType:r,unitID:(o==null?void 0:o.unitID)||``,name:(o==null?void 0:o.name)||``,strategies:[{action:6,role:n.UnitRole.Owner},{action:16,role:n.UnitRole.Owner},{action:17,role:n.UnitRole.Owner},{action:18,role:n.UnitRole.Owner},{action:19,role:n.UnitRole.Owner},{action:33,role:n.UnitRole.Owner},{action:34,role:n.UnitRole.Owner},{action:35,role:n.UnitRole.Owner},{action:36,role:n.UnitRole.Owner},{action:37,role:n.UnitRole.Owner},{action:38,role:n.UnitRole.Owner},{action:39,role:n.UnitRole.Owner},{action:40,role:n.UnitRole.Owner}],selectRangeObject:i};return this._permissionMap.set(t,s),t}async allowed(e){let{objectID:t,actions:r}=e,i=this._permissionMap.get(t);return i?r.map(e=>{let r=`${t}:${e}`;if(this._permissionOverrides.has(r))return{action:e,allowed:this._permissionOverrides.get(r)};let a=i.strategies.find(t=>t.action===e);return a?{action:e,allowed:this._getRole(a.role)}:{action:e,allowed:this._getRole(n.UnitRole.Owner)||this._getRole(n.UnitRole.Editor)}}):r.map(e=>({action:e,allowed:this._getRole(n.UnitRole.Owner)||this._getRole(n.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=[],r=[{action:6,role:n.UnitRole.Owner},{action:16,role:n.UnitRole.Owner},{action:17,role:n.UnitRole.Owner},{action:18,role:n.UnitRole.Owner},{action:19,role:n.UnitRole.Owner},{action:33,role:n.UnitRole.Owner},{action:34,role:n.UnitRole.Owner},{action:35,role:n.UnitRole.Owner},{action:36,role:n.UnitRole.Owner},{action:37,role:n.UnitRole.Owner},{action:38,role:n.UnitRole.Owner},{action:39,role:n.UnitRole.Owner},{action:40,role:n.UnitRole.Owner}];return e.objectIDs.forEach(i=>{let a=this._permissionMap.get(i),o=(a==null?void 0:a.strategies)||r,s={objectID:i,unitID:e.unitID,objectType:(a==null?void 0:a.objectType)||3,name:(a==null?void 0:a.name)||``,shareOn:!1,shareRole:n.UnitRole.Owner,shareScope:-1,scope:{read:n.ObjectScope.AllCollaborator,edit:n.ObjectScope.AllCollaborator},creator:Rg(n.UnitRole.Owner),strategies:o.map(e=>({action:e.action,role:e.role})),actions:e.actions.map(e=>{let t=`${i}:${e}`;if(this._permissionOverrides.has(t))return{action:e,allowed:this._permissionOverrides.get(t)};let r=o.find(t=>t.action===e);return r?{action:e,allowed:this._getRole(r.role)}:{action:e,allowed:this._getRole(n.UnitRole.Owner)||this._getRole(n.UnitRole.Editor)}})};t.push(s)}),t}async listCollaborators(){return[]}async listRoles(){return{roles:[],actions:[]}}async deleteCollaborator(){}async update(e){let{objectID:t,strategies:r}=e,i=this._permissionMap.get(t);i&&r&&(i.strategies=r.map(e=>({action:e.action,role:e.role})),this._permissionMap.set(t,i),r.forEach(e=>{e.role===n.UnitRole.Reader?this.setPermissionOverride(t,e.action,!1):(e.role===n.UnitRole.Owner||e.role===n.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){}setCfgEnableObjInherit(e){this._cfgEnableObjInherit=e}getCfgEnableObjInherit(){return this._cfgEnableObjInherit}};Vg=lc([U(0,Ig),U(1,(0,r.Inject)(Bg))],Vg);let Hg=(0,r.createIdentifier)(`IAuthzIoIoService`),Ug=(0,r.createIdentifier)(`univer.confirm-service`);var Wg=class{constructor(){T(this,`confirmOptions$`,new t.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!`)}};let Gg=`FOCUSING_UNIT`,Kg=`FOCUSING_SHEET`,qg=`FOCUSING_DOC`,Jg=`FOCUSING_SLIDE`,Yg=`EDITOR_ACTIVATED`,Xg=`FOCUSING_FX_BAR_EDITOR`;var Zg=class extends k{constructor(...e){super(...e),T(this,`_error$`,new t.Subject),T(this,`error$`,this._error$.asObservable())}dispose(){this._error$.complete()}emit(e){this._error$.next({errorKey:e})}};let Qg=function(e){return e.URL=`URL`,e.UUID=`UUID`,e.BASE64=`BASE64`,e}({}),$g=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}({}),e_=(0,r.createIdentifier)(`core.image-io.service`),t_=(0,r.createIdentifier)(`core.url-image.service`);var n_=`@univerjs/core`,r_=`1.0.0-alpha.1`;function i_(e=``,t=`zhCN`,n=``){return{id:e,sheetOrder:[],name:n,appVersion:r_,locale:t,styles:{},sheets:{},resources:[]}}var a_=class{constructor(e={}){T(this,`_styles`,void 0),T(this,`_cacheMap`,new ip(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=V(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&&z.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(z.diffValue(t[n],e))return n;return null}};let o_=(e,t)=>t.length===e.length&&!e.some(e=>t.some(t=>!Bp.equals(t,e))),s_=(e,t)=>t.length===e.length&&e.every((e,n)=>{let r=t[n];return r.unitId===e.unitId&&r.sheetId===e.sheetId&&Bp.equals(e.range,r.range)}),c_={t:0,b:2,l:2,r:2},l_=e=>({sbr:.6,sbo:e,spr:.6,spo:e});function u_(e,t,n={}){let r=e.length,{textRotation:i,paddingData:a,horizontalAlign:o=0,verticalAlign:s=0,wrapStrategy:c=0,cellValueType:l}=n,{t:u,r:d,b:f,l:p}=a||c_,{vertexAngle:m,centerAngle:h}=y_(i);return new Uh({id:`d`,body:{dataStream:`${e}\r
|
|
8
|
+
`,customBlocks:[],customRanges:[],paragraphs:[{startIndex:0,paragraphId:Is(new Set)}],textRuns:[],tables:[],sectionBreaks:[]}})}static create(t){return new e(t==null?e.newEmptyData():t)}constructor(e){super(e),T(this,`_doc`,void 0),this._doc=new Uh(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 Dg?t.build():t:n instanceof Dg?n.build():n,!o)return this;let c={dataStream:o,textRuns:s?[{ts:s,st:a,ed:a+o.length}]:[]},l=Q.selection.replace({doc:this._doc,selection:{startOffset:a,endOffset:a,collapsed:!0},body:c});if(!l)throw Error(`Insert text failed, please check.`);return Z.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 jg?e.getData():e:(i=Math.min(e,i),a=t instanceof jg?t.getData():t);let o=Q.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 Z.apply(this._doc.getBody(),o.serialize()),this}delete(e,t){if(t!==void 0){if(!t)return this;let n=Q.selection.delete([{startOffset:e,endOffset:e+t,collapsed:!0}],this._data.body);Z.apply(this._doc.getBody(),n)}return this}setStyle(e,t,n){let r={dataStream:``,textRuns:[{ts:n instanceof Dg?n.build():n,st:0,ed:t-e}]},i=Q.selection.retain([{startOffset:e,endOffset:t,collapsed:!0}],r);return Z.apply(this._doc.getBody(),i),this}setLink(e,t,n){let r=Q.customRange.add({rangeType:0,rangeId:V(),properties:{url:n},ranges:[{startOffset:e,endOffset:t,collapsed:!1}],body:this._data.body});if(!r)throw Error(`Insert text failed, please check.`);return Z.apply(this._doc.getBody(),r.serialize()),this}cancelLink(e,t){if(typeof e==`string`){let t=Q.customRange.delete({rangeId:e,documentDataModel:this._doc});if(!t)throw Error(`Insert text failed, please check.`);Z.apply(this._doc.getBody(),t.serialize())}else this.slice(e,t).getLinks().forEach(e=>{let t=Q.customRange.delete({rangeId:e.rangeId,documentDataModel:this._doc});if(!t)throw Error(`Insert text failed, please check.`);Z.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,paragraphId:Is(new Set),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,paragraphId:Is(new Set),paragraphStyle:t==null?void 0:t.build()}]};return this.insertRichText(r,jg.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:0,rangeId:V(),properties:{url:a},startIndex:0,endIndex:i.length-1}]});return typeof t==`number`?this.insertRichText(t,o):this.insertRichText(o)}},Ng=class{constructor(){T(this,`skipNextObservers`,!1),T(this,`lastReturnValue`,void 0),T(this,`isStopPropagation`,!1)}stopPropagation(){this.isStopPropagation=!0}},Pg=class extends t.Subject{constructor(...e){super(...e),T(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 Ng;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 Fg(e){return new t.Observable(t=>{let n=e.subscribeEvent(e=>{t.next(e)});return()=>n.unsubscribe()})}let Ig=(0,r.createIdentifier)(`core.resource-manager.service`),Lg={[n.UnitRole.Editor]:`Editor`,[n.UnitRole.Owner]:`Owner`,[n.UnitRole.Reader]:`Reader`,[n.UnitRole.UNRECOGNIZED]:`UNRECOGNIZED`},Rg=e=>e?{userID:`${Lg[e]}_${V(8)}`,name:Lg[e],avatar:``}:{userID:``,name:``,avatar:``,anonymous:!0,canBindAnonymous:!1},zg=(e,t)=>e.startsWith(Lg[t]);var Bg=class extends k{constructor(...e){super(...e),T(this,`_model`,new Map),T(this,`_userChange$`,new t.Subject),T(this,`userChange$`,this._userChange$.asObservable()),T(this,`_currentUser$`,new t.BehaviorSubject(Rg())),T(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 Vg=class{constructor(e,t){this._resourceManagerService=e,this._userManagerService=t,T(this,`_permissionMap`,new Map([])),T(this,`_permissionOverrides`,new Map),T(this,`_cfgEnableObjInherit`,!1),this._initSnapshot(),this._initDefaultUser()}_initDefaultUser(){let e=this._userManagerService.getCurrentUser();e&&e.userID||this._userManagerService.setCurrentUser(Rg(n.UnitRole.Owner))}_getRole(e){let t=this._userManagerService.getCurrentUser();return t?zg(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:[n.UniverType.UNIVER_SHEET,n.UniverType.UNIVER_DOC,n.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=V(8),{objectType:r,selectRangeObject:i,worksheetObject:a}=e,o=i||a,s={objectType:r,unitID:(o==null?void 0:o.unitID)||``,name:(o==null?void 0:o.name)||``,strategies:[{action:6,role:n.UnitRole.Owner},{action:16,role:n.UnitRole.Owner},{action:17,role:n.UnitRole.Owner},{action:18,role:n.UnitRole.Owner},{action:19,role:n.UnitRole.Owner},{action:33,role:n.UnitRole.Owner},{action:34,role:n.UnitRole.Owner},{action:35,role:n.UnitRole.Owner},{action:36,role:n.UnitRole.Owner},{action:37,role:n.UnitRole.Owner},{action:38,role:n.UnitRole.Owner},{action:39,role:n.UnitRole.Owner},{action:40,role:n.UnitRole.Owner}],selectRangeObject:i};return this._permissionMap.set(t,s),t}async allowed(e){let{objectID:t,actions:r}=e,i=this._permissionMap.get(t);return i?r.map(e=>{let r=`${t}:${e}`;if(this._permissionOverrides.has(r))return{action:e,allowed:this._permissionOverrides.get(r)};let a=i.strategies.find(t=>t.action===e);return a?{action:e,allowed:this._getRole(a.role)}:{action:e,allowed:this._getRole(n.UnitRole.Owner)||this._getRole(n.UnitRole.Editor)}}):r.map(e=>({action:e,allowed:this._getRole(n.UnitRole.Owner)||this._getRole(n.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=[],r=[{action:6,role:n.UnitRole.Owner},{action:16,role:n.UnitRole.Owner},{action:17,role:n.UnitRole.Owner},{action:18,role:n.UnitRole.Owner},{action:19,role:n.UnitRole.Owner},{action:33,role:n.UnitRole.Owner},{action:34,role:n.UnitRole.Owner},{action:35,role:n.UnitRole.Owner},{action:36,role:n.UnitRole.Owner},{action:37,role:n.UnitRole.Owner},{action:38,role:n.UnitRole.Owner},{action:39,role:n.UnitRole.Owner},{action:40,role:n.UnitRole.Owner}];return e.objectIDs.forEach(i=>{let a=this._permissionMap.get(i),o=(a==null?void 0:a.strategies)||r,s={objectID:i,unitID:e.unitID,objectType:(a==null?void 0:a.objectType)||3,name:(a==null?void 0:a.name)||``,shareOn:!1,shareRole:n.UnitRole.Owner,shareScope:-1,scope:{read:n.ObjectScope.AllCollaborator,edit:n.ObjectScope.AllCollaborator},creator:Rg(n.UnitRole.Owner),strategies:o.map(e=>({action:e.action,role:e.role})),actions:e.actions.map(e=>{let t=`${i}:${e}`;if(this._permissionOverrides.has(t))return{action:e,allowed:this._permissionOverrides.get(t)};let r=o.find(t=>t.action===e);return r?{action:e,allowed:this._getRole(r.role)}:{action:e,allowed:this._getRole(n.UnitRole.Owner)||this._getRole(n.UnitRole.Editor)}})};t.push(s)}),t}async listCollaborators(){return[]}async listRoles(){return{roles:[],actions:[]}}async deleteCollaborator(){}async update(e){let{objectID:t,strategies:r}=e,i=this._permissionMap.get(t);i&&r&&(i.strategies=r.map(e=>({action:e.action,role:e.role})),this._permissionMap.set(t,i),r.forEach(e=>{e.role===n.UnitRole.Reader?this.setPermissionOverride(t,e.action,!1):(e.role===n.UnitRole.Owner||e.role===n.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){}setCfgEnableObjInherit(e){this._cfgEnableObjInherit=e}getCfgEnableObjInherit(){return this._cfgEnableObjInherit}};Vg=lc([U(0,Ig),U(1,(0,r.Inject)(Bg))],Vg);let Hg=(0,r.createIdentifier)(`IAuthzIoIoService`),Ug=(0,r.createIdentifier)(`univer.confirm-service`);var Wg=class{constructor(){T(this,`confirmOptions$`,new t.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!`)}};let Gg=`FOCUSING_UNIT`,Kg=`FOCUSING_SHEET`,qg=`FOCUSING_DOC`,Jg=`FOCUSING_SLIDE`,Yg=`EDITOR_ACTIVATED`,Xg=`FOCUSING_FX_BAR_EDITOR`;var Zg=class extends k{constructor(...e){super(...e),T(this,`_error$`,new t.Subject),T(this,`error$`,this._error$.asObservable())}dispose(){this._error$.complete()}emit(e){this._error$.next({errorKey:e})}};let Qg=function(e){return e.URL=`URL`,e.UUID=`UUID`,e.BASE64=`BASE64`,e}({}),$g=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}({}),e_=(0,r.createIdentifier)(`core.image-io.service`),t_=(0,r.createIdentifier)(`core.url-image.service`);var n_=`@univerjs/core`,r_=`1.0.0-insiders.20260629-12f2e44`;function i_(e=``,t=`zhCN`,n=``){return{id:e,sheetOrder:[],name:n,appVersion:r_,locale:t,styles:{},sheets:{},resources:[]}}var a_=class{constructor(e={}){T(this,`_styles`,void 0),T(this,`_cacheMap`,new ip(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=V(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&&z.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(z.diffValue(t[n],e))return n;return null}};let o_=(e,t)=>t.length===e.length&&!e.some(e=>t.some(t=>!Bp.equals(t,e))),s_=(e,t)=>t.length===e.length&&e.every((e,n)=>{let r=t[n];return r.unitId===e.unitId&&r.sheetId===e.sheetId&&Bp.equals(e.range,r.range)}),c_={t:0,b:2,l:2,r:2},l_=e=>({sbr:.6,sbo:e,spr:.6,spo:e});function u_(e,t,n={}){let r=e.length,{textRotation:i,paddingData:a,horizontalAlign:o=0,verticalAlign:s=0,wrapStrategy:c=0,cellValueType:l}=n,{t:u,r:d,b:f,l:p}=a||c_,{vertexAngle:m,centerAngle:h}=y_(i);return new Uh({id:`d`,body:{dataStream:`${e}\r
|
|
9
9
|
`,textRuns:[{ts:t,st:0,ed:r}],paragraphs:[{startIndex:r,paragraphId:Is(new Set),paragraphStyle:{horizontalAlign:o}}],sectionBreaks:[{startIndex:r+1}]},documentStyle:{pageSize:{width:1/0,height:1/0},documentFlavor:0,marginTop:u,marginBottom:f,marginRight:d,marginLeft:p,paragraphLineGapDefault:0,renderConfig:{horizontalAlign:o,verticalAlign:s,centerAngle:h,vertexAngle:m,wrapStrategy:c,cellValueType:l}},drawings:{},drawingsOrder:[]})}function d_(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 f_(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 p_(e,t,n){var r;let i=e.getBody();if((r=i.customRanges)!=null&&r.some(e=>e.rangeType===0))return;let a=Q.customRange.add({ranges:[{startOffset:0,endOffset:i.dataStream.length-1,collapsed:!1}],rangeId:n,rangeType:0,body:i,properties:{url:t,refId:n}});a&&Z.apply(i,a.serialize())}function m_(e){return e!=null}function h_(){return{p:null,s:null,v:null,t:null,f:null,si:null,ref:null,xf:null}}function g_(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=`italic`;(e.it===0||e.it===void 0)&&(r=`normal`);let i=`bold`;(e.bl===0||e.bl===void 0)&&(i=`normal`);let a=n;e.fs&&(a=Math.ceil(e.fs));let o=__(e.ff,t),{va:s}=e,c=a;if(s===2||s===3){let{sbr:e,spr:t}=v_(o,c);c*=s===2?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 __(e,t){return e!=null&&e.trim()?e.split(`,`).map(e=>{let t=e.trim().replace(/^['"]|['"]$/g,``);return t.includes(` `)?`"${t}"`:t}).filter(Boolean).join(`, `):t}function v_(e,t){return l_(t)}function y_(e){let{a:t=0,v:n=0}=e||{a:0,v:0},r=0,i=t;return n===1&&(r=90,i=90),{centerAngle:r,vertexAngle:i}}function b_(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]=b_(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]=b_(e[i])}return t}function x_(e){if(e==null)return e;let t={};return e.p!==void 0&&(t.p=e.p===null?null:b_(e.p)),e.s!==void 0&&(e.s===null||typeof e.s==`string`?t.s=e.s:t.s=b_(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:b_(e.custom)),t}function S_(e){if(e==null)return e;let t={};return e.p!==void 0&&(t.p=e.p===null?null:b_(e.p)),e.s!==void 0&&(e.s===null||typeof e.s==`string`?t.s=e.s:t.s=b_(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:b_(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 C_(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]=x_(r))}t[a]=s}return t}function w_(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=b_(o.s)),`custom`in o&&o.custom!==void 0&&(s.custom=o.custom===null?null:b_(o.custom)),t[a]=s}return t}function T_(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 E_(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:T_(e.mergeData),cellData:C_(e.cellData),rowData:w_(e.rowData),columnData:w_(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=b_(e.defaultStyle)),e.custom!==void 0&&(t.custom=e.custom===null?null:b_(e.custom)),t}var D_=class{constructor(e,t){this._config=e,T(this,`_columnData`,{}),this._columnData=t}getColumnData(){return this._columnData}getColVisible(e){let{_columnData:t}=this,n=t[e];return n?n.hd!==1:!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:2,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:2}),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:2,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:2}),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:0}:e,r++}return n}getSize(){return Rd(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}},O_=class{constructor(e,t,n){this._config=e,this._viewModel=t,T(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:0}: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:0,h:r.defaultRowHeight};i+=(t==null||t===1)&&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:1})):!r&&!e&&(r=!0,i=a)}return r&&n.push({startRow:i,endRow:t,startColumn:0,endColumn:0,rangeType:1}),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:1})):!r&&e&&(r=!0,i=a)}return r&&n.push({startRow:i,endRow:t,startColumn:0,endColumn:0,rangeType:1}),n}getRowRawVisible(e){let t=this.getRow(e);return t?t.hd!==1:!0}getSize(){return Rd(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}};let k_=1e3;function A_(e){let t={name:`Sheet1`,id:`sheet-01`,tabColor:``,hidden:0,rowCount:k_,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:1,rowHeader:{width:46,hidden:0},columnHeader:{height:20,hidden:0},rightToLeft:0};return Object.keys(t).forEach(n=>{let r=n;e[r]===void 0&&(e[r]=t[r])}),e}var j_=class extends k{constructor(e){super(),T(this,`_cellCache`,new Map),T(this,`_rowCache`,new Map),T(this,`_columnCache`,new Map),T(this,`_hasRow`,!1),T(this,`_hasColumn`,!1),T(this,`_hasAll`,!1),T(this,`_allIndex`,-1),T(this,`_mergeData`,void 0),T(this,`_rangeMap`,new ip(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===1?this._createRowCache(n,t):e===2?this._createColumnCache(n,t):e===3?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||!z.isEmptyObject(this._columnCache)?!0:this._mergeData.some(t=>t.startRow<=e&&e<=t.endRow)}isColumnContainsMergedCell(e){return this._hasAll||!z.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||[])Bp.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=[]}},M_=class extends k{constructor(e){super(),this.getRawCell=e,T(this,`_cellContentInterceptor`,null),T(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,3,n,r):this.getRawCell(e,t)}getCellValueOnly(e,t){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(e,t,2):this.getRawCell(e,t)}getCellStyleOnly(e,t){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(e,t,1):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,D(()=>this._cellContentInterceptor=null)}registerRowFilteredInterceptor(e){if(this._rowFilteredInterceptor)throw Error(`[SheetViewModel]: Interceptor already registered.`);return this._rowFilteredInterceptor=e,D(()=>this._rowFilteredInterceptor=null)}};let N_={isDeepClone:!1,displayRawFormula:!1,ignoreTextRotation:!1};var P_=class e{constructor(e,t,n){var r;this.unitId=e,this._styles=n,T(this,`_sheetId`,void 0),T(this,`_snapshot`,void 0),T(this,`_cellData`,void 0),T(this,`_rowManager`,void 0),T(this,`_columnManager`,void 0),T(this,`_viewModel`,void 0),T(this,`_spanModel`,void 0),T(this,`_isRowStylePrecedeColumnStyle`,!0),T(this,`_getCellHeight`,void 0),this._snapshot=A_(t);let{columnData:i,rowData:a,cellData:o}=this._snapshot;this._sheetId=(r=this._snapshot.id)==null?V(6):r,this._cellData=new qd(o),this._viewModel=new M_((e,t)=>this.getCellRaw(e,t)),this._rowManager=new O_(this._snapshot,this._viewModel,a),this._columnManager=new D_(this._snapshot,i),this._spanModel=new j_(this._snapshot.mergeData)}__interceptViewModel(e){e(this._viewModel)}__registerGetCellHeight(e){return this._getCellHeight=e,D(()=>{this._getCellHeight=null})}getSnapshot(){return this._snapshot}getCellHeight(e,t){return this._getCellHeight?this._getCellHeight(e,t):this.getRowHeight(e)}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)?ae(r,a,i,o==null?void 0:o.themeStyle,s):ae(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)?ae(i,o,a,n==null?void 0:n.themeStyle,s):ae(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=E_(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=`raw`){let a=this.getCellMatrix(),o=this._spanModel.getMergedCellRange(e,t,n,r),s=new qd;return Kp(e,n,t,r).forEach((e,t)=>{let n;if(i===`raw`)n=this.getCellRaw(e,t);else if(i===`intercepted`)n=this.getCell(e,t);else if(i===`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;m_(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;Kp(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 up(this,e,{getStyles:()=>this._styles}):new up(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=N_){var r;if(!e)return;let{isDeepClone:i,displayRawFormula:a,ignoreTextRotation:o}={...N_,...n},s,c=`document`,l=d_(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||c_;if(e.f&&a)s=u_(e.f.toString(),{},{verticalAlign:f}),d=H.ht;else if(e.p){let{centerAngle:t,vertexAngle:n}=y_(u);s=this._updateConfigAndGetDocumentModel(i?z.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=f_(t);c=g_(n).fontCache;let r=F_(e);e.t===4&&a&&(r=`'${r}`),s=u_(r,n,{...l,textRotation:u,cellValueType:e.t})}return s&&e.linkUrl&&e.linkId&&p_(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.documentFlavor=0,e.documentStyle.paragraphLineGapDefault=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 Uh(e)}getBlankCellDocumentModel(e,t,n){let r=this.getComposedCellStyleByCellData(t,n,e),i=f_(r),a=this.getCellDocumentModel(e,r,{ignoreTextRotation:!0});if(a!=null)return a.documentModel==null&&(a.documentModel=u_(``,i)),a;let o=`document`,s=H.tr,c=H.ht,l=H.vt,u=H.tb,d=c_;return o=g_({}).fontCache,{documentModel:u_(``,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 F_(e){var t;if(!e)return``;let n=(t=e.p)==null||(t=t.body)==null?void 0:t.dataStream;if(n)return Q.transform.getPlainText(n);let r=e.v;return typeof r==`string`?e.t===3?r.toUpperCase():r.replace(/[\r\n]/g,``):typeof r==`number`?e.t===3?r?`TRUE`:`FALSE`:r.toString():typeof r==`boolean`?r?`TRUE`:`FALSE`:``}function I_(e){var t;if(!e)return``;let n=(t=e.p)==null||(t=t.body)==null?void 0:t.dataStream;if(n)return Q.transform.getPlainText(n);let r=e.v;if(r==null)return``;if(e.t===3){if(typeof r==`string`)return r.toUpperCase();if(typeof r==`number`)return r?`TRUE`:`FALSE`}return typeof r==`boolean`?r?`TRUE`:`FALSE`:String(r)}function L_(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 Q.transform.getPlainText(n)}return e==null?void 0:e.v}function R_(e,t){return`${e.getUnitId()}|${t.getSheetId()}`}let z_=class extends M{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={},r){super(),this._logService=r,T(this,`type`,n.UniverType.UNIVER_SHEET),T(this,`_sheetCreated$`,new t.Subject),T(this,`sheetCreated$`,this._sheetCreated$.asObservable()),T(this,`_sheetDisposed$`,new t.Subject),T(this,`sheetDisposed$`,this._sheetDisposed$.asObservable()),T(this,`_activeSheet$`,new t.BehaviorSubject(null)),T(this,`activeSheet$`,this._activeSheet$.asObservable()),T(this,`_worksheets`,void 0),T(this,`_styles`,void 0),T(this,`_snapshot`,void 0),T(this,`_unitId`,void 0),T(this,`_count`,void 0),T(this,`_name$`,void 0),T(this,`name$`,void 0);let i=i_();z.isEmptyObject(e)?this._snapshot=i:this._snapshot=z.commonExtend(i,e);let{styles:a}=this._snapshot;(this._snapshot.id==null||this._snapshot.id.length===0)&&(this._snapshot.id=V(6)),this._unitId=this._snapshot.id,this._styles=new a_(a),this._count=1,this._worksheets=new Map,this._name$=new t.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 z.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 P_(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()!==1)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===1).map(e=>e.getConfig().id)}getUnhiddenWorksheets(){return this.getSheets().filter(e=>e.getConfig().hidden!==1).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(z.isEmptyObject(n)){let e=V();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 P_(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}};z_=lc([U(1,oc)],z_);let B_=(0,r.createIdentifier)(`univer.current`),V_=class extends k{constructor(e,n,r){super(),this._injector=e,this._contextService=n,this._logService=r,T(this,`_unitsByType`,new Map),T(this,`_createHandler`,void 0),T(this,`_ctorByType`,new Map),T(this,`_currentUnits`,new Map),T(this,`_currentUnits$`,new t.BehaviorSubject(this._currentUnits)),T(this,`currentUnits$`,this._currentUnits$.asObservable()),T(this,`_unitAdded$`,new t.Subject),T(this,`unitAdded$`,this._unitAdded$.asObservable()),T(this,`_unitDisposed$`,new t.Subject),T(this,`unitDisposed$`,this._unitDisposed$.asObservable()),T(this,`_focused$`,new t.BehaviorSubject(null)),T(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)}}}__getCtorByType(e){return this._ctorByType.get(e)}getCurrentTypeOfUnit$(e){return this.currentUnits$.pipe((0,t.map)(t=>{var n;return(n=t.get(e))==null?null:n}),(0,t.distinctUntilChanged)())}getCurrentUnitOfType(e){return this._currentUnits.get(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,t.filter)(t=>t.unit.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({unit:e,options:t}),((n=t==null?void 0:t.makeCurrent)==null||n)&&this.setCurrentUnitForType(e.getUnitId())}getTypeOfUnitDisposed$(e){return this.unitDisposed$.pipe((0,t.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.getCurrentUnitOfType(n.UniverType.UNIVER_DOC)}getUniverDocInstance(e){return this.getUnit(e,n.UniverType.UNIVER_DOC)}getUniverSheetInstance(e){return this.getUnit(e,n.UniverType.UNIVER_SHEET)}getAllUnitsForType(e){var t;return(t=this._unitsByType.get(e))==null?[]:t}changeDoc(e,t){let r=this.getAllUnitsForType(n.UniverType.UNIVER_DOC),i=r.find(t=>t.getUnitId()===e);if(i!=null){let e=r.indexOf(i);r.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){var t;this._focused$.next(e),this.focused instanceof z_?(this._contextService.setContextValue(Gg,!0),this._contextService.setContextValue(qg,!1),this._contextService.setContextValue(Kg,!0),this._contextService.setContextValue(Jg,!1),this.setCurrentUnitForType(e)):this.focused instanceof Uh?(this._contextService.setContextValue(Gg,!0),this._contextService.setContextValue(qg,!0),this._contextService.setContextValue(Kg,!1),this._contextService.setContextValue(Jg,!1),this.setCurrentUnitForType(e)):((t=this.focused)==null?void 0:t.type)===n.UniverType.UNIVER_SLIDE?(this._contextService.setContextValue(Gg,!0),this._contextService.setContextValue(qg,!1),this._contextService.setContextValue(Kg,!1),this._contextService.setContextValue(Jg,!0),this.setCurrentUnitForType(e)):(this._contextService.setContextValue(Gg,!1),this._contextService.setContextValue(qg,!1),this._contextService.setContextValue(Kg,!1),this._contextService.setContextValue(Jg,!1))}getFocusedUnit(){return this.focused}getUnitType(e){let t=this._getUnitById(e);return t?t[1]:n.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.getCurrentUnitOfType(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]}}};V_=lc([U(0,(0,r.Inject)(r.Injector)),U(1,rc),U(2,(0,r.Inject)(oc))],V_);let H_=function(e){return e[e.Starting=0]=`Starting`,e[e.Ready=1]=`Ready`,e[e.Rendered=2]=`Rendered`,e[e.Steady=3]=`Steady`,e}({}),U_={0:`Starting`,1:`Ready`,2:`Rendered`,3:`Steady`};var W_=class extends Error{constructor(e){super(`[LifecycleService]: lifecycle stage "${U_[e]}" will never be reached!`),this.name=`LifecycleUnreachableError`}};let G_=class extends k{constructor(e){super(),this._logService=e,T(this,`_lifecycle$`,new t.BehaviorSubject(0)),T(this,`lifecycle$`,this._lifecycle$.asObservable()),T(this,`_lock`,!1),this._reportProgress(0)}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,t.firstValueFrom)(this.lifecycle$.pipe((0,t.filter)(t=>t>=e),bc(t=>t===e),(0,t.map)(()=>void 0))).catch(t=>t.name===`EmptyError`?Promise.reject(new W_(e)):Promise.reject(t))}subscribeWithPrevious(){return(0,t.merge)(K_(this.stage),this._lifecycle$.pipe((0,t.skip)(1))).pipe(bc(e=>e===3))}_reportProgress(e){this._logService.debug(`[LifecycleService]`,`lifecycle progressed to "${U_[e]}".`)}};G_=lc([U(0,oc)],G_);function K_(e){switch(e){case 0:return(0,t.of)(0);case 1:return(0,t.of)(0,1);case 2:return(0,t.of)(0,1,2);default:return(0,t.of)(0,1,2,3)}}let q_=(0,r.createIdentifier)(`ILocalStorageService`);var J_=class extends k{get _currentLocale(){return this._currentLocale$.value}constructor(){super(),T(this,`_currentLocale$`,new t.BehaviorSubject(`zhCN`)),T(this,`currentLocale$`,this._currentLocale$.asObservable()),T(this,`_direction$`,new t.BehaviorSubject(`ltr`)),T(this,`direction$`,this._direction$.asObservable()),T(this,`_locales`,null),T(this,`localeChanged$`,new t.Subject),T(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(D(()=>{this._locales=null,this._currentLocale$.complete(),this._direction$.complete(),this.localeChanged$.complete()}))}load(e){var t;this._locales=so((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}setDirection(e){this._direction$.next(e)}getDirection(){return this._direction$.value}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 Y_=class{constructor(e){this._userManagerService=e}async list(e){return{list:[{type:0,mentions:[{objectType:0,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}}};Y_=lc([U(0,(0,r.Inject)(Bg))],Y_);let X_=(0,r.createIdentifier)(`univer.service.mention-io`),Z_=function(e){return e.INIT=`init`,e.FETCHING=`fetching`,e.DONE=`done`,e}({}),Q_=(0,r.createIdentifier)(`univer.permission-service`);var $_=class extends k{constructor(...e){super(...e),T(this,`_permissionPointMap`,new Map),T(this,`_permissionPointUpdate$`,new t.Subject),T(this,`permissionPointUpdate$`,this._permissionPointUpdate$.asObservable()),T(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 n=e instanceof t.BehaviorSubject,r=n?e.getValue():e;return r.id?this._permissionPointMap.get(r.id)?(console.warn(`${r.id} PermissionPoint already exists`),!1):(this._permissionPointMap.set(r.id,n?e:new t.BehaviorSubject(r)),this._permissionPointUpdate$.next(r),!0):!1}updatePermissionPoint(e,t){let n=this._permissionPointMap.get(e);if(!n)return;let r=n.getValue();r.value=t,r.status=`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,t.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,i.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 ev(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}let tv=Symbol(`DependentOn`);var nv=class extends k{onStarting(){}onReady(){}onRendered(){}onSteady(){}getUnitType(){return this.constructor.type}getPluginName(){return this.constructor.pluginName}};T(nv,`pluginName`,void 0),T(nv,`packageName`,n_),T(nv,`version`,r_),T(nv,`type`,n.UniverType.UNIVER_UNKNOWN);var rv=class{constructor(){T(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 iv(...e){return function(t){t[tv]=e}}let av=class{constructor(e,t,r){this._injector=e,this._lifecycleService=t,this._logService=r,T(this,`_pluginRegistry`,new Map),T(this,`_pluginStore`,new rv),T(this,`_seenPlugins`,new Set),T(this,`_loadedPlugins`,new Set),T(this,`_loadedPluginTypes`,new Set([n.UniverType.UNIVER_UNKNOWN])),T(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 r={plugin:e,options:t};this._pluginRegistry.set(e.pluginName,r),this._logService.debug(`[PluginService]`,`Plugin "${e.pluginName}" registered.`);let{type:i}=e;this._loadedPluginTypes.has(i)&&(i===n.UniverType.UNIVER_UNKNOWN?this._loadFromPlugins([r]):this._flushType(i))}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:r,packageName:i,version:a}=e;if(t===n.UniverType.UNRECOGNIZED)throw Error(`[PluginService]: invalid plugin type for ${e.name}. Please assign a "type" to your plugin.`);if(!r)throw Error(`[PluginService]: no plugin name for ${e.name}. Please assign a "pluginName" to your plugin.`);if(a&&a!==nv.version&&this._logService.error(`[PluginService]`,[`Plugin version mismatch.`,` plugin: "${r||e.name}"`,` package: "${i}"`,` plugin version: "${a}"`,` core version: "${nv.version}"`,` registration will continue, but please make sure all @univerjs packages use the same version.`].join(`
|
|
10
10
|
`)),this._seenPlugins.has(r))throw 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(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=[],r=new Set,i=e=>{let{plugin:a}=e,{pluginName:o}=a;if(this._loadedPlugins.has(o)||r.has(o))return;r.add(o),this._pluginRegistry.delete(o);let s=a[tv];s&&s.forEach(e=>{let t=this._pluginRegistry.get(e.pluginName);if(t)i(t);else if(!this._seenPlugins.has(e.pluginName)&&!r.has(e.pluginName)){if(a.type===n.UniverType.UNIVER_UNKNOWN&&e.type!==n.UniverType.UNIVER_UNKNOWN)throw 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 ${e.pluginName}.`);a.type!==e.type&&e.type!==n.UniverType.UNIVER_UNKNOWN&&this._logService.debug(`[PluginService]`,`Plugin "${o}" depends on "${e.pluginName}" which has different type.`),this._logService.debug(`[PluginService]`,`Plugin "${o}" depends on "${e.pluginName}" which is not registered. Univer will automatically register it with default configuration.`),this._assertPluginValid(e),i({plugin:e,options:void 0})}}),t.push(e)};e.forEach(e=>i(e));let a=t.map(e=>this._initPlugin(e.plugin,e.options));this._pluginsRunLifecycle(a)}_pluginsRunLifecycle(e){let n=this._lifecycleService.stage;if(K_(n).subscribe(t=>this._runStage(e,t)),n!==3){let n=this._lifecycleService.lifecycle$.pipe((0,t.skip)(1)).subscribe(t=>{this._runStage(e,t),t===3&&n.unsubscribe()})}}_runStage(e,t){e.forEach(e=>{switch(t){case 0:e.onStarting();break;case 1:e.onReady();break;case 2:e.onRendered();break;case 3: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}};av=lc([U(0,(0,r.Inject)(r.Injector)),U(1,(0,r.Inject)(G_)),U(2,oc)],av);let ov=(0,r.createIdentifier)(`resource-loader-service`),sv=class extends k{constructor(e){super(),this._logService=e,T(this,`_resourceMap`,new Map),T(this,`_register$`,new t.Subject),T(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){let n=this.getAllResourceHooks(),r=[];for(let i=0;i<n.length;i++){let a=n[i];if(!a.businesses.includes(t))continue;let o=a.toJson(e);r.push({name:a.pluginName,data:o})}return r}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),D(()=>this._resourceMap.delete(t))}disposePluginResource(e){this._resourceMap.delete(e)}loadResources(e,t){let n=this.getAllResourceHooks();for(let i=0;i<n.length;i++){var r;let a=n[i],o=t==null||(r=t.find(e=>e.name===a.pluginName))==null?void 0:r.data;if(o)try{let t=a.parseJson(o);a.onLoad(e,t)}catch(e){this._logService.error(`[ResourceManagerService]`,`loadResources error`,e)}}}unloadResources(e,t){let n=this.getAllResourceHooks();for(let r=0;r<n.length;r++){let i=n[r];i.businesses.includes(t)&&i.onUnLoad(e)}}dispose(){this._register$.complete(),this._resourceMap.clear()}};sv=lc([U(0,oc)],sv);var cv=class extends k{get darkMode(){return this._darkMode$.getValue()}constructor(){super(),T(this,`_darkMode$`,new t.BehaviorSubject(!1)),T(this,`darkMode$`,this._darkMode$.asObservable()),T(this,`_validColorCache`,new Map),T(this,`_currentTheme`,a.defaultTheme),T(this,`_currentTheme$`,new t.BehaviorSubject(this._currentTheme)),T(this,`currentTheme$`,this._currentTheme$.asObservable()),this.disposeWithMe(D(()=>{this._currentTheme=a.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 a.defaultTheme;else if(n.length===2){let[e,r]=n;t=e in a.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 ti(this._currentTheme,e)}};let lv=(0,r.createIdentifier)(`univer.undo-redo.service`);var uv=class{dispose(){}async dispatchToHandlers(){return!1}};let dv=`univer.command.redo`,fv=`univer.command.undo`,pv=new class extends uv{constructor(...e){super(...e),T(this,`type`,0),T(this,`id`,fv)}handler(e){let t=e.get(lv),n=t.pitchTopUndoElement();if(!n)return!1;let r=e.get(fc);return _c(n.undoMutations,r).result?(t.popUndoToRedo(),!0):!1}},mv=new class extends uv{constructor(...e){super(...e),T(this,`type`,0),T(this,`id`,dv)}handler(e){let t=e.get(lv),n=t.pitchTopRedoElement();if(!n)return!1;let r=e.get(fc);return _c(n.redoMutations,r).result?(t.popRedoToUndo(),!0):!1}},hv=class extends k{constructor(e,n,r){super(),this._univerInstanceService=e,this._commandService=n,this._contextService=r,T(this,`undoRedoStatus$`,void 0),T(this,`_undoRedoStatus$`,new t.BehaviorSubject({undos:0,redos:0})),T(this,`_undoStacks`,new Map),T(this,`_redoStacks`,new Map),T(this,`_batchingStatus`,new Map),this.undoRedoStatus$=this._undoRedoStatus$.asObservable(),this.disposeWithMe(this._commandService.registerCommand(pv)),this.disposeWithMe(this._commandService.registerCommand(mv)),this.disposeWithMe(D(()=>this._undoRedoStatus$.complete())),this.disposeWithMe(D(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===0||!n?(i(e),this._batchingStatus.set(e.unitID,1)):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(),_c(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,0),D(()=>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(Kg),n=this._contextService.getContextValue(Xg),r=this._contextService.getContextValue(Yg);if(t)if(n)e=Ct;else if(r)e=St;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}};hv=lc([U(0,B_),U(1,fc),U(2,rc)],hv);var gv=class{constructor(e,t=1e3){this._injector=e,T(this,`_imageCacheMap`,void 0),this._imageCacheMap=new ip(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(e_)?this._injector.get(e_):null,s=this._injector.has(t_)?this._injector.get(t_):null;if(e===`UUID`)try{a.src=await(o==null?void 0:o.getImage(t))||``}catch(e){console.error(e)}else if(e===`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 _v(e){return!(e.length===0||e.length>31||e.startsWith(`'`)||e.endsWith(`'`)||/[:\\\/\?\*\[\]]/.test(e))}function vv(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))}let yv=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],$=new Uint32Array(96);var bv=class e{static from(t){if(!t||t.byteLength===void 0||t.buffer)throw Error(`Data must be an instance of ArrayBuffer or SharedArrayBuffer.`);let[n,r]=new Uint8Array(t,0,2);if(n!==219)throw Error(`Data does not appear to be in a KDBush format.`);let i=r>>4;if(i!==1)throw Error(`Got v${i} data when expected v1.`);let a=yv[r&15];if(!a)throw Error(`Unrecognized array type.`);let[o]=new Uint16Array(t,2,1),[s]=new Uint32Array(t,4,1);return new e(s,o,a,void 0,t)}constructor(e,t=64,n=Float64Array,r=ArrayBuffer,i){if(isNaN(e)||e<0)throw Error(`Unexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let a=yv.indexOf(this.ArrayType),o=e*2*this.ArrayType.BYTES_PER_ELEMENT,s=e*this.IndexArrayType.BYTES_PER_ELEMENT,c=(8-s%8)%8;if(a<0)throw Error(`Unexpected typed array class: ${n}.`);if(i)this.data=i,this.ids=new this.IndexArrayType(i,8,e),this.coords=new n(i,8+s+c,e*2),this._pos=e*2,this._finished=!0;else{let i=this.data=new r(8+o+s+c);this.ids=new this.IndexArrayType(i,8,e),this.coords=new n(i,8+s+c,e*2),this._pos=0,this._finished=!1,new Uint8Array(i,0,2).set([219,16+a]),new Uint16Array(i,2,1)[0]=t,new Uint32Array(i,4,1)[0]=e}}add(e,t){let n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=t,n}finish(){let e=this._pos>>1;if(e!==this.numItems)throw Error(`Added ${e} items when expected ${this.numItems}.`);return xv(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,n,r){if(!this._finished)throw Error(`Data not yet indexed - call index.finish().`);let{ids:i,coords:a,nodeSize:o}=this;$[0]=0,$[1]=i.length-1,$[2]=0;let s=3,c=[];for(;s>0;){let l=$[--s],u=$[--s],d=$[--s];if(u-d<=o){for(let o=d;o<=u;o++){let s=a[2*o],l=a[2*o+1];s>=e&&s<=n&&l>=t&&l<=r&&c.push(i[o])}continue}let f=d+u>>1,p=a[2*f],m=a[2*f+1];p>=e&&p<=n&&m>=t&&m<=r&&c.push(i[f]),(l===0?e<=p:t<=m)&&($[s++]=d,$[s++]=f-1,$[s++]=1-l),(l===0?n>=p:r>=m)&&($[s++]=f+1,$[s++]=u,$[s++]=1-l)}return c}within(e,t,n){let r=[];return this.withinInto(e,t,n,r),r}withinInto(e,t,n,r){if(!this._finished)throw Error(`Data not yet indexed - call index.finish().`);let{ids:i,coords:a,nodeSize:o}=this;$[0]=0,$[1]=i.length-1,$[2]=0;let s=3,c=0,l=n*n;for(;s>0;){let u=$[--s],d=$[--s],f=$[--s];if(d-f<=o){for(let n=f;n<=d;n++)Tv(a[2*n],a[2*n+1],e,t)<=l&&(r[c++]=i[n]);continue}let p=f+d>>1,m=a[2*p],h=a[2*p+1];Tv(m,h,e,t)<=l&&(r[c++]=i[p]),(u===0?e-n<=m:t-n<=h)&&($[s++]=f,$[s++]=p-1,$[s++]=1-u),(u===0?e+n>=m:t+n>=h)&&($[s++]=p+1,$[s++]=d,$[s++]=1-u)}return c}};function xv(e,t,n,r,i,a){if(i-r<=n)return;let o=r+i>>1;Sv(e,t,o,r,i,a),xv(e,t,n,r,o-1,1-a),xv(e,t,n,o+1,i,1-a)}function Sv(e,t,n,r,i,a){for(;i>r;){if(i-r>600){let o=i-r+1,s=n-r+1,c=Math.log(o),l=.5*Math.exp(2*c/3),u=.5*Math.sqrt(c*l*(o-l)/o)*(s-o/2<0?-1:1);Sv(e,t,n,Math.max(r,Math.floor(n-s*l/o+u)),Math.min(i,Math.floor(n+(o-s)*l/o+u)),a)}let o=t[2*n+a],s=r,c=i;for(Cv(e,t,r,n),t[2*i+a]>o&&Cv(e,t,r,i);s<c;){for(Cv(e,t,s,c),s++,c--;t[2*s+a]<o;)s++;for(;t[2*c+a]>o;)c--}t[2*r+a]===o?Cv(e,t,r,c):(c++,Cv(e,t,c,i)),c<=n&&(r=c+1),n<=c&&(i=c-1)}}function Cv(e,t,n,r){wv(e,n,r),wv(t,2*n,2*r),wv(t,2*n+1,2*r+1)}function wv(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function Tv(e,t,n,r){let i=e-n,a=t-r;return i*i+a*a}var Ev=class{constructor(e=!1){this._enableOneCellCache=e,T(this,`_tree`,new Map),T(this,`_oneCellCache`,new Map),T(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 mp),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 bv(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 mp;r.fromJSON(e[t][n]),this._tree.get(t).set(n,r)}}}};function Dv(e){return new Promise(t=>setTimeout(t,e))}function Ov(e=1){return new Promise(t=>{let n=0,r=()=>{n++,n>=e?t():requestAnimationFrame(r)};requestAnimationFrame(r)})}let kv=class extends k{constructor(e){super(),this._localeService=e,T(this,`_fontLocale`,void 0),T(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(){}};kv=lc([U(0,(0,r.Inject)(J_))],kv);function Av(e={}){let t={defaultBackgroundColor:`rgba(24, 119, 242, 0.08)`,defaultStripeColor:`rgba(24, 119, 242, 0.25)`,rowGaps:{1:{size:6},3:{size:10,color:`rgba(245, 158, 11, 0.14)`},6:{size:14,color:`rgba(16, 185, 129, 0.12)`,stripeColor:`rgba(5, 150, 105, 0.35)`}},colGaps:{1:{size:5},2:{size:8,stripeColor:`rgba(59, 130, 246, 0.35)`},4:{size:12,color:`rgba(244, 63, 94, 0.12)`,stripeColor:`rgba(225, 29, 72, 0.30)`}}};return{...t,...e,rowGaps:{...t.rowGaps,...e.rowGaps},colGaps:{...t.colGaps,...e.colGaps}}}let jv=class extends kv{constructor(e,t,n,r,i,a){super(n),this.worksheet=e,this._styles=t,this._contextService=r,this._configService=i,this._injector=a,T(this,`_worksheetData`,void 0),T(this,`_renderRawFormula`,!1),T(this,`_cellData`,void 0),T(this,`_imageCacheMap`,void 0),T(this,`_skipAutoHeightForMergedCells`,!0),T(this,`_rowTotalHeight`,0),T(this,`_columnTotalWidth`,0),T(this,`_rowHeaderWidth`,0),T(this,`_columnHeaderHeight`,0),T(this,`_rowHeightAccumulation`,[]),T(this,`_columnWidthAccumulation`,[]),T(this,`_marginTop`,0),T(this,`_marginLeft`,0),T(this,`_gapConfig`,{}),T(this,`_scaleX`,1),T(this,`_scaleY`,1),T(this,`_scrollX`,0),T(this,`_scrollY`,0),this._worksheetData=this.worksheet.getConfig(),this._cellData=this.worksheet.getCellMatrix(),this._imageCacheMap=new gv(this._injector),this.initConfig()}initConfig(){var e,t;this._skipAutoHeightForMergedCells=!((e=this._configService.getConfig(Tt))!=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){z.isDefine(e)&&(this._scrollX=e),z.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}get gapConfig(){return this._gapConfig}setGapConfig(e){this._gapConfig=this._fillDefaultGapThemeColors(e),this.makeDirty(!0),this._updateLayout()}_fillDefaultGapThemeColors(e){var t,n;if(e.defaultBackgroundColor&&e.defaultStripeColor)return e;let{r,g:i,b:a}=new Mc(this._injector.get(cv).getColorFromTheme(`primary.500`)).toRgb();return{...e,defaultBackgroundColor:(t=e.defaultBackgroundColor)==null?`rgba(${r}, ${i}, ${a}, 0.025)`:t,defaultStripeColor:(n=e.defaultStripeColor)==null?`rgba(${r}, ${i}, ${a}, 0.08)`:n}}getRowGapSize(e){var t,n;return(t=(n=this._gapConfig.rowGaps)==null||(n=n[e])==null?void 0:n.size)==null?0:t}getColGapSize(e){var t,n;return(t=(n=this._gapConfig.colGaps)==null||(n=n[e])==null?void 0:n.size)==null?0:t}getGapSizeGetter(){if(!(!this._gapConfig.rowGaps&&!this._gapConfig.colGaps))return{row:e=>this.getRowGapSize(e),col:e=>this.getColGapSize(e)}}getRowGapAtPosition(e){let{rowGaps:t}=this._gapConfig;if(!t)return-1;for(let a of Object.keys(t)){var n,r,i;let o=Number(a),s=(n=(r=t[o])==null?void 0:r.size)==null?0:n;if(s<=0)continue;let c=(i=this._rowHeightAccumulation[o-1])==null?0:i,l=c+s;if(e>=c&&e<l)return o}return-1}getColGapAtPosition(e){let{colGaps:t}=this._gapConfig;if(!t)return-1;for(let a of Object.keys(t)){var n,r,i;let o=Number(a),s=(n=(r=t[o])==null?void 0:r.size)==null?0:n;if(s<=0)continue;let c=(i=this._columnWidthAccumulation[o-1])==null?0:i,l=c+s;if(e>=c&&e<l)return o}return-1}_generateRowMatrixCache(e,t,n){let r=0,i=[],a=t;for(let t=0;t<e;t++){var o,s;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===1)&&typeof o==`number`&&o>0?o:i,r.hd===1&&(e=0)}let c=(o=(s=this._gapConfig.rowGaps)==null||(s=s[t])==null?void 0:s.size)==null?0:o;r+=c,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++){var o,s;let e=n;if(a[t]!=null){let n=a[t];if(!n)continue;n.w!=null&&(e=n.w),n.hd===1&&(e=0)}let c=(o=(s=this._gapConfig.colGaps)==null||(s=s[t])==null?void 0:s.size)==null?0:o;r+=c,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=1){let a=0;if(t>n){let o=this._columnWidthAccumulation.length-1;for(let s=t;s>=n;s--){let n=s;if(!Qd(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}=Nv(e,n,this.rowHeightAccumulation,this.columnWidthAccumulation,void 0,this.getGapSizeGetter());if(i===2&&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(!Qd(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}=Nv(e,n,this.rowHeightAccumulation,this.columnWidthAccumulation,void 0,this.getGapSizeGetter());if(i===2&&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===1?0:this._dynamicallyUpdateRowHeaderWidth(o),this._columnHeaderHeight=s.hidden===1?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 qd,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};Ip(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&&Bp.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)}getNoMergeCellWithCoordByIndex(e,t,n=!0){let{rowHeightAccumulation:r,columnWidthAccumulation:i,rowHeaderWidthAndMarginLeft:a,columnHeaderHeightAndMarginTop:o}=this,{startY:s,endY:c,startX:l,endX:u}=Nv(e,t,r,i,void 0,this.getGapSizeGetter());return n&&(s+=o,c+=o,l+=a,u+=a),{startY:s,endY:c,startX:l,endX:u}}getRowIndexByOffsetY(e,t,n,r){let{rowHeightAccumulation:i}=this;e=Fv(e,t,n,this.columnHeaderHeightAndMarginTop);let a=Oc(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=Pv(e,t,n,this.rowHeaderWidthAndMarginLeft),{columnWidthAccumulation:a}=this,o=Oc(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=Nv(e,t,i,a,(r=this.worksheet)==null?void 0:r.getCellInfoInMergeData(e,t),this.getGapSizeGetter()),{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=Oc(this.columnWidthAccumulation,e),r=e-((this._columnWidthAccumulation[n-1]||0)+this.getColGapSize(n)),i=Oc(this.rowHeightAccumulation,t);return{row:i,column:n,columnOffset:r,rowOffset:t-((this._rowHeightAccumulation[i-1]||0)+this.getRowGapSize(i))}}getCellIndexAndOffsetByPosition(e,t){let{actualRow:n,actualColumn:r,startX:i,startY:a}=this.getCellWithCoordByOffset(e,t,this._scaleX,this._scaleY,{x:this._scrollX,y:this._scrollY});return{row:n,rowOffset:t-a,column:r,columnOffset:e-i}}_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.documentFlavor=0,e.documentStyle.paragraphLineGapDefault=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 Uh(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}};jv=lc([U(2,(0,r.Inject)(J_)),U(3,rc),U(4,tc),U(5,(0,r.Inject)(r.Injector))],jv);function Mv(e,t,n,r,i=0,a=0){let o=e-1,s=t-1,c=(n[o]||0)+i,l=n[e];l==null&&(l=n[n.length-1]);let u=(r[s]||0)+a,d=r[t];return d==null&&(d=r[r.length-1]),{startY:c,endY:l,startX:u,endX:d}}function Nv(e,t,n,r,i,a){var o,s;e=z.clamp(e,0,n.length-1),t=z.clamp(t,0,r.length-1);let{startY:c,endY:l,startX:u,endX:d}=Mv(e,t,n,r,(o=a==null?void 0:a.row(e))==null?0:o,(s=a==null?void 0:a.col(t))==null?0:s);if(!i)return{startY:c,endY:l,startX:u,endX:d,isMerged:!1,isMergedMainCell:!1,actualRow:e,actualColumn:t,mergeInfo:{startY:c,endY:l,startX:u,endX:d,startRow:e,startColumn:t,endRow:e,endColumn:t}};let{isMerged:f,isMergedMainCell:p,startRow:m,startColumn:h,endRow:g,endColumn:_}=i,v={startRow:m,startColumn:h,endRow:g,endColumn:_,startY:c,endY:l,startX:u,endX:d},y=n.length-1,b=r.length-1;if(f&&m!==-1&&h!==-1){var x,S;let e=(x=a==null?void 0:a.row(m))==null?0:x,t=(S=a==null?void 0:a.col(h))==null?0:S,i=(n[m-1]||0)+e,o=n[g]||n[y],s=(r[h-1]||0)+t,c=r[_]||r[b];v={...v,startY:i,endY:o,startX:s,endX:c}}else if(!f&&g!==-1&&_!==-1){let e=n[g]||n[y],t=r[_]||r[b];v={...v,startY:c,endY:e,startX:u,endX:t}}return{isMerged:f,isMergedMainCell:p,actualRow:e,actualColumn:t,startY:c,endY:l,startX:u,endX:d,mergeInfo:v}}function Pv(e,t,n,r){let{x:i}=n;return e/t+i-r}function Fv(e,t,n,r){let{y:i}=n;return e=e/t+i-r,e}let Iv=[`script`,`style`,`meta`,`comment`,`link`],Lv=function(e){return e[e.INFO=0]=`INFO`,e[e.STOP=1]=`STOP`,e[e.WARNING=2]=`WARNING`,e}({}),Rv=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}({}),zv=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}({}),Bv=function(e){return e[e.TEXT=0]=`TEXT`,e[e.ARROW=1]=`ARROW`,e[e.CUSTOM=2]=`CUSTOM`,e}({}),Vv=function(e){return e.VALID=`valid`,e.INVALID=`invalid`,e.VALIDATING=`validating`,e}({}),Hv=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}({}),Uv=class extends k{constructor(e,t){super(),this._resourceManagerService=e,this._univerInstanceService=t,this._init()}_init(){let e=(e,t,n=[],r)=>{let i=n.find(t=>t.name===e.pluginName);if(i)try{let n=e.parseJson(i.data);e.onLoad(t,n)}catch{console.error(`Load ${r}{${t}} Resources{${e.pluginName}} Data Error.`)}},t=t=>{t.businesses.forEach(r=>{switch(r){case n.UniverType.UNRECOGNIZED:case n.UniverType.UNIVER_UNKNOWN:case n.UniverType.UNIVER_DOC:this._univerInstanceService.getAllUnitsForType(n.UniverType.UNIVER_DOC).forEach(n=>{e(t,n.getUnitId(),n.getSnapshot().resources,`Document`)});break;case n.UniverType.UNIVER_SLIDE:this._univerInstanceService.getAllUnitsForType(n.UniverType.UNIVER_SLIDE).forEach(n=>{e(t,n.getUnitId(),n.getSnapshot().resources,`Slide`)});break;case n.UniverType.UNIVER_SHEET:this._univerInstanceService.getAllUnitsForType(n.UniverType.UNIVER_SHEET).forEach(n=>{e(t,n.getUnitId(),n.getSnapshot().resources,`Workbook`)});break}})};this._resourceManagerService.getAllResourceHooks().forEach(e=>t(e)),this.disposeWithMe(this._resourceManagerService.register$.subscribe(e=>t(e))),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(n.UniverType.UNIVER_SHEET).subscribe(e=>{let{unit:t}=e;this._resourceManagerService.loadResources(t.getUnitId(),t.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(n.UniverType.UNIVER_DOC).subscribe(e=>{let{unit:t}=e;Dt(t.getUnitId())||this._resourceManagerService.loadResources(t.getUnitId(),t.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(n.UniverType.UNIVER_SLIDE).subscribe(e=>{let{unit:t}=e;this._resourceManagerService.loadResources(t.getUnitId(),t.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(n.UniverType.UNIVER_SHEET).subscribe(e=>{this._resourceManagerService.unloadResources(e.getUnitId(),n.UniverType.UNIVER_SHEET)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(n.UniverType.UNIVER_DOC).subscribe(e=>{this._resourceManagerService.unloadResources(e.getUnitId(),n.UniverType.UNIVER_DOC)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(n.UniverType.UNIVER_SLIDE).subscribe(e=>{this._resourceManagerService.unloadResources(e.getUnitId(),n.UniverType.UNIVER_SLIDE)}))}saveUnit(e){let t=this._univerInstanceService.getUnit(e);if(!t)return null;let n=this._resourceManagerService.getResources(e,t.type),r=z.deepClone(t.getSnapshot());return r.resources=n,r}};Uv=lc([U(0,(0,r.Inject)(Ig)),U(1,(0,r.Inject)(B_))],Uv);var Wv=class extends M{constructor(...e){super(...e),T(this,`type`,void 0),T(this,`name$`,void 0)}getUnitId(){throw Error(`Method not implemented.`)}setName(e){throw Error(`Method not implemented.`)}getSnapshot(){throw Error(`Method not implemented.`)}getRev(){throw Error(`Method not implemented.`)}incrementRev(){throw Error(`Method not implemented.`)}setRev(e){throw Error(`Method not implemented.`)}},Gv=class{get _univerInstanceService(){return this._injector.get(B_)}get _pluginService(){return this._injector.get(av)}constructor(e={},t){T(this,`_startedTypes`,new Set),T(this,`_injector`,void 0),T(this,`_disposingCallbacks`,new O);let n=this._injector=Kv(t,e==null?void 0:e.override),{theme:r,darkMode:i,locale:a,locales:o,direction:s,logLevel:c,logCommandExecution:l}=e;r&&this._injector.get(cv).setTheme(r),i&&this._injector.get(cv).setDarkMode(i),o&&this._injector.get(J_).load(o),a&&this._injector.get(J_).setLocale(a),s&&this._injector.get(J_).setDirection(s),c&&this._injector.get(oc).setLogLevel(c),l!==void 0&&this._injector.get(tc).setConfig(uc,l),this._init(n)}__getInjector(){return this._injector}onDispose(e){let t=this._disposingCallbacks.add(D(e));return D(()=>t.dispose(!0))}dispose(){this._disposingCallbacks.dispose(),this._injector.dispose()}setLocale(e){this._injector.get(J_).setLocale(e)}createUnit(e,t){return this._univerInstanceService.createUnit(e,t)}_init(e){this._univerInstanceService.registerCtorForType(n.UniverType.UNIVER_SHEET,z_),this._univerInstanceService.registerCtorForType(n.UniverType.UNIVER_DOC,Uh),this._univerInstanceService.registerCtorForType(n.UniverType.UNIVER_SLIDE,Wv);let t=e.get(B_);t.__setCreateHandler((n,r,i,a)=>{var o;let s=!this._startedTypes.has(n);s&&(this._pluginService.startPluginsForType(n),this._startedTypes.add(n));let c=(o=t.__getCtorByType(n))==null?i:o;if(!c)throw Error(`[Univer]: No constructor registered for unit type ${n}.`);let l=e.createInstance(c,r);return t.__addUnit(l,a),s&&this._tryProgressToReady(),l})}_tryProgressToReady(){this._injector.get(G_).stage<1&&(this._injector.get(G_).stage=1)}registerPlugin(e,t){this._pluginService.registerPlugin(e,t)}registerPlugins(e){e.forEach(e=>{let[t,n]=e;this._pluginService.registerPlugin(t,n)})}};function Kv(e,t){let n=ev([[Zg],[J_],[cv],[G_],[av],[Bg],[B_,{useClass:V_}],[Q_,{useClass:$_}],[oc,{useClass:sc,lazy:!0}],[fc,{useClass:hc}],[lv,{useClass:hv,lazy:!0}],[tc,{useClass:nc}],[rc,{useClass:ic}],[Ig,{useClass:sv,lazy:!0}],[ov,{useClass:Uv,lazy:!0}],[Hg,{useClass:Vg}],[X_,{useClass:Y_,lazy:!0}]],t),i=e?e.createChild(n):new r.Injector(n);return At(i,[[Bg],[ov]]),i}x(),e.ABCToNumber=qp,e.AUTO_HEIGHT_FOR_MERGED_CELLS=Tt,e.AbsoluteRefType=tl,e.ActionIterator=_h,e.AlignTypeH=os,e.AlignTypeV=ss,e.ArrangeTypeEnum=fs,e.AsyncInterceptorManager=Ht,e.AsyncLock=vt.default,Object.defineProperty(e,"AuthzIoLocalService",{enumerable:!0,get:function(){return Vg}}),e.AutoFillSeries=le,e.BORDER_KEYS=vs,e.BORDER_STYLE_KEYS=_s,e.BaseDataModel=Be,e.BaselineOffset=Ne,e.BlockType=Fo,e.BooleanNumber=Pe,e.BorderStyleTypes=ue,e.BorderType=de,e.BuildTextUtils=Q,e.BulletAlignment=jo,e.COLORS=jc,e.COLOR_STYLE_KEYS=gs,e.COMMAND_LOG_EXECUTION_CONFIG_KEY=uc,e.CanceledError=Nt,e.CellModeEnum=ol,e.CellValueType=Fe,e.ColorKit=Mc,e.ColorType=fe,e.ColumnLayoutType=Qo,e.ColumnResponsiveType=$o,e.ColumnSeparatorType=zo,Object.defineProperty(e,"CommandService",{enumerable:!0,get:function(){return hc}}),e.CommandType=dc,e.CommonHideTypes=pe,e.ConfigService=nc,e.ContextService=ic,e.CopyPasteType=me,e.CustomCommandExecutionError=Mt,e.CustomDecorationType=Po,e.CustomRangeType=No,e.DEFAULT_CELL=Ts,e.DEFAULT_DOC=Bh,e.DEFAULT_DOCUMENT_PARAGRAPH_LINE_SPACING=Os,e.DEFAULT_DOCUMENT_PARAGRAPH_SPACE_ABOVE=0,e.DEFAULT_DOCUMENT_PARAGRAPH_SPACE_BELOW=12,e.DEFAULT_DOCUMENT_SUB_COMPONENT_ID=`__default_document_sub_component_id20231101__`,e.DEFAULT_EMPTY_DOCUMENT_VALUE=`\r
|
|
11
11
|
`,e.DEFAULT_NUMBER_FORMAT=`General`,e.DEFAULT_RANGE=Cs,e.DEFAULT_RANGE_ARRAY=Ss,e.DEFAULT_SELECTION=ws,e.DEFAULT_STYLES=H,e.DEFAULT_TEXT_FORMAT=`@@@`,e.DEFAULT_TEXT_FORMAT_EXCEL=`@`,e.DEFAULT_WORKSHEET_COLUMN_COUNT=20,e.DEFAULT_WORKSHEET_COLUMN_COUNT_KEY=`DEFAULT_WORKSHEET_COLUMN_COUNT`,e.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT=20,e.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY=`DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT`,e.DEFAULT_WORKSHEET_COLUMN_WIDTH=88,e.DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY=`DEFAULT_WORKSHEET_COLUMN_WIDTH`,e.DEFAULT_WORKSHEET_ROW_COUNT=k_,e.DEFAULT_WORKSHEET_ROW_COUNT_KEY=`DEFAULT_WORKSHEET_ROW_COUNT`,e.DEFAULT_WORKSHEET_ROW_HEIGHT=24,e.DEFAULT_WORKSHEET_ROW_HEIGHT_KEY=`DEFAULT_WORKSHEET_ROW_HEIGHT`,e.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH=46,e.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY=`DEFAULT_WORKSHEET_ROW_TITLE_WIDTH`,e.DOCS_COMMENT_EDITOR_UNIT_ID_KEY=wt,e.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY=Ct,e.DOCS_NORMAL_EDITOR_UNIT_ID_KEY=St,e.DOC_DRAWING_PRINTING_COMPONENT_KEY=`univer-docs-drawing-printing`,e.DOC_RANGE_TYPE=il,e.DashStyleType=Ko,e.DataStreamTreeNodeType=Nh,e.DataStreamTreeTokenType=Ph,e.DataValidationErrorStyle=Lv,e.DataValidationImeMode=Rv,e.DataValidationOperator=zv,e.DataValidationRenderMode=Bv,e.DataValidationStatus=Vv,e.DataValidationType=Hv,e.DeleteDirection=he,e.DependentOn=iv,e.DesktopLogService=sc,e.DeveloperMetadataVisibility=ge,e.Dimension=_e,e.Direction=ve,e.Disposable=k,e.DisposableCollection=O,e.DocStyleType=Oo,e.DocumentBlockRangeType=Mo,e.DocumentBlockType=Do,e.DocumentDataModel=Uh,e.DocumentFlavor=Io,e.DrawingTypeEnum=ps,e.EDITOR_ACTIVATED=Yg,e.EXTENSION_NAMES=As,e.ErrorService=Zg,e.EventState=Ng,e.EventSubject=Pg,e.FOCUSING_COMMENT_EDITOR=`FOCUSING_COMMENT_EDITOR`,e.FOCUSING_COMMON_DRAWINGS=`FOCUSING_COMMON_DRAWINGS`,e.FOCUSING_DOC=qg,e.FOCUSING_EDITOR_BUT_HIDDEN=`FOCUSING_EDITOR_BUT_HIDDEN`,e.FOCUSING_EDITOR_INPUT_FORMULA=`FOCUSING_EDITOR_INPUT_FORMULA`,e.FOCUSING_EDITOR_STANDALONE=`FOCUSING_EDITOR_INPUT_FORMULA`,e.FOCUSING_FX_BAR_EDITOR=Xg,e.FOCUSING_PANEL_EDITOR=`FOCUSING_PANEL_EDITOR`,e.FOCUSING_SHAPE_TEXT_EDITOR=`FOCUSING_SHAPE_TEXT_EDITOR`,e.FOCUSING_SHEET=Kg,e.FOCUSING_SLIDE=Jg,e.FOCUSING_UNIT=Gg,e.FOCUSING_UNIVER_EDITOR=`FOCUSING_UNIVER_EDITOR`,e.FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE=`FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE`,e.FORMULA_EDITOR_ACTIVATED=`FORMULA_EDITOR_ACTIVATED`,e.FollowNumberWithType=ko,e.FontItalic=je,e.FontStyleType=ns,e.FontWeight=Me,e.GridType=Lo,e.HorizontalAlign=Oe,e.IAuthzIoService=Hg,e.ICommandService=fc,e.IConfigService=tc,e.IConfirmService=Ug,e.IContextService=rc,e.IImageIoService=e_,e.ILocalStorageService=q_,e.ILogService=oc,e.IMentionIOService=X_,e.IPermissionService=Q_,e.IResourceLoaderService=ov,e.IResourceManagerService=Ig,e.IS_ROW_STYLE_PRECEDE_COLUMN_STYLE=`isRowStylePrecedeColumnStyle`,e.IURLImageService=t_,e.IUndoRedoService=lv,e.IUniverInstanceService=B_,e.ImageCacheMap=gv,e.ImageSourceType=Qg,e.ImageUploadStatusType=$g,Object.defineProperty(e,"Inject",{enumerable:!0,get:function(){return r.Inject}}),Object.defineProperty(e,"InjectSelf",{enumerable:!0,get:function(){return r.InjectSelf}}),Object.defineProperty(e,"Injector",{enumerable:!0,get:function(){return r.Injector}}),e.InterceptorEffectEnum=It,e.InterceptorManager=zt,e.InterpolationPointType=be,Object.defineProperty(e,"JSON1",{enumerable:!0,get:function(){return Qs}}),e.JSONX=Mh,e.LRUHelper=ap,e.LRUMap=ip,Object.defineProperty(e,"LifecycleService",{enumerable:!0,get:function(){return G_}}),e.LifecycleStages=H_,e.LifecycleUnreachableError=W_,e.ListGlyphType=Ao,Object.defineProperty(e,"LocalUndoRedoService",{enumerable:!0,get:function(){return hv}}),e.LocaleService=J_,e.LocaleType=xe,e.LogLevel=ac,Object.defineProperty(e,"LookUp",{enumerable:!0,get:function(){return r.LookUp}}),e.MAX_COLUMN_COUNT=cp,e.MAX_ROW_COUNT=sp,e.MODERN_DOCUMENT_DEFAULT_MARGIN=66.66666666666667,e.MODERN_DOCUMENT_WIDTH=Ns,e.MOVE_BUFFER_VALUE=2,Object.defineProperty(e,"Many",{enumerable:!0,get:function(){return r.Many}}),e.MemoryCursor=fo,Object.defineProperty(e,"MentionIOLocalService",{enumerable:!0,get:function(){return Y_}}),e.MentionType=Se,e.ModernDocumentWidthMode=Ms,e.NAMED_STYLE_MAP=Ds,e.NAMED_STYLE_SPACE_MAP=ks,e.NamedStyleType=Wo,e.NilCommand=mc,e.NumberUnitType=as,e.ObjectMatrix=qd,e.ObjectRelativeFromH=rs,e.ObjectRelativeFromV=is,Object.defineProperty(e,"Optional",{enumerable:!0,get:function(){return r.Optional}}),e.PADDING_KEYS=bs,e.PAGE_SIZE=js,e.PAPER_TYPES=ds,e.PARAGRAPH_ID_PREFIX=Fs,e.PRESET_LIST_TYPE=Im,e.PRINT_CHART_COMPONENT_KEY=`univer-sheets-chart-print-chart`,e.PageOrientType=ls,e.PaperType=us,e.ParagraphElementType=Vo,e.ParagraphStyleBuilder=Ag,e.ParagraphStyleValue=kg,e.PermissionService=$_,e.PermissionStatus=Z_,e.Plugin=nv,Object.defineProperty(e,"PluginService",{enumerable:!0,get:function(){return av}}),e.PositionedObjectLayoutType=Uo,e.PresetListType=jm,e.ProtectionType=Ce,Object.defineProperty(e,"Quantity",{enumerable:!0,get:function(){return r.Quantity}}),e.QuickListType=Am,e.QuickListTypeMap=zm,e.RANGE_DIRECTION=rl,e.RANGE_TYPE=el,e.RBush=mp,e.RCDisposable=j,e.RESTORE_INSERTED_PARAGRAPH_IDS=em,e.RGBA_PAREN=`rgba(`,e.RGB_PAREN=`rgb(`,e.ROTATE_BUFFER_VALUE=1,e.RTree=Ev,e.Range=up,e.Rectangle=Bp,Object.defineProperty(e,"RediError",{enumerable:!0,get:function(){return r.RediError}}),e.RedoCommand=mv,e.RedoCommandId=dv,e.RefAlias=Gp,e.Registry=_o,e.RegistryAsMap=vo,e.RelativeDate=we,Object.defineProperty(e,"ResourceManagerService",{enumerable:!0,get:function(){return sv}}),e.RichTextBuilder=Mg,e.RichTextValue=jg,e.RxDisposable=A,e.SHEET_EDITOR_UNITS=Es,e.STYLE_KEYS=xs,e.SectionType=Ro,Object.defineProperty(e,"Self",{enumerable:!0,get:function(){return r.Self}}),Object.defineProperty(e,"SheetSkeleton",{enumerable:!0,get:function(){return jv}}),e.SheetTypes=Te,e.SheetViewModel=M_,Object.defineProperty(e,"Skeleton",{enumerable:!0,get:function(){return kv}}),Object.defineProperty(e,"SkipSelf",{enumerable:!0,get:function(){return r.SkipSelf}}),e.SliceBodyType=Zm,e.SpacingRule=Go,e.Styles=a_,e.TEXT_DECORATION_KEYS=hs,e.TEXT_ROTATION_KEYS=ys,e.THEME_COLORS=Ps,e.TabStopAlignment=qo,e.TableAlignmentType=Yo,e.TableLayoutType=Xo,e.TableRowHeightRule=es,e.TableSizeType=Jo,e.TableTextWrapType=Zo,e.TestConfirmService=Wg,e.TextDecoration=De,e.TextDecorationBuilder=Og,e.TextDirection=Ee,e.TextDirectionType=Bo,e.TextStyleBuilder=Dg,e.TextStyleValue=Eg,e.TextX=Z,e.TextXActionType=ec,e.ThemeColorType=Ie,e.ThemeColors=Le,e.ThemeService=cv,e.Tools=z,e.UndoCommand=pv,e.UndoCommandId=fv,e.UnitModel=M,e.Univer=Gv,Object.defineProperty(e,"UniverInstanceService",{enumerable:!0,get:function(){return V_}}),e.UniverInstanceType=n.UniverType,e.UpdateDocsAttributeType=$s,e.UserManagerService=Bg,e.VerticalAlign=ke,e.VerticalAlignmentType=ts,Object.defineProperty(e,"WithNew",{enumerable:!0,get:function(){return r.WithNew}}),Object.defineProperty(e,"Workbook",{enumerable:!0,get:function(){return z_}}),e.Worksheet=P_,e.WrapStrategy=Ae,e.WrapTextType=Ho,e.addLinkToDocumentModel=p_,e.afterInitApply=wc,e.afterTime=Sc,e.awaitTime=Dv,e.binSearchFirstGreaterThanTarget=Dc,e.binarySearchArray=Ec,e.bufferDebounceTime=xc,e.cellToRange=cf,e.characterSpacingControlType=cs,e.checkForSubstrings=pf,e.checkIfMove=Ac,e.checkParagraphHasBullet=Bf,e.checkParagraphHasIndent=Vf,e.checkParagraphHasIndentByStyle=Hf,e.cloneBodyWithFreshParagraphIds=Ls,e.cloneCellData=x_,e.cloneCellDataMatrix=C_,e.cloneCellDataWithSpanAndDisplay=S_,e.cloneParagraphWithId=Rs,e.cloneValue=b_,e.cloneWorksheetData=E_,e.codeToBlob=kc,e.columnLabelToNumber=op,e.composeBody=fh,e.composeInterceptors=Rt,e.composeStyles=ae,e.concatMatrixArray=Hd,e.convertCellToRange=Jd,e.convertObservableToBehaviorSubject=Cc,e.covertCellValue=lf,e.covertCellValues=uf,e.createAsyncInterceptorKey=Bt,e.createDefaultBaseTableSnapshot=Re,e.createDefaultUser=Rg,e.createDocumentModelWithStyle=u_,Object.defineProperty(e,"createIdentifier",{enumerable:!0,get:function(){return r.createIdentifier}}),e.createInterceptorKey=Lt,e.createInternalEditorID=Et,e.createParagraphId=Is,e.createREGEXFromWildChar=se,e.createRandomId=Eo,e.createRowColIter=Kp,e.createSheetGapTestConfig=Av,e.currencySymbols=Pd,e.customNameCharacterCheck=vv,e.dateKit=Rf,e.debounce=Rn,e.dedupe=dt,e.dedupeBy=ft,e.deepCompare=df,e.delayAnimationFrame=Ov,e.deleteContent=Wf,e.escapeRegExp=ce,e.extractPureTextFromCell=F_,Object.defineProperty(e,"forwardRef",{enumerable:!0,get:function(){return r.forwardRef}}),e.fromCallback=yc,e.fromEventSubject=Fg,e.generateIntervalsByPoints=qf,e.generateRandomId=V,e.get=ti,e.getArrayLength=Rd,e.getBodySlice=ah,e.getBorderStyleType=af,e.getCellCoordByIndexSimple=Mv,e.getCellInfoInMergeData=al,e.getCellValueType=Zc,e.getCellWithCoordByIndexCore=Nv,e.getColorStyle=$d,e.getCustomBlockSlice=ih,e.getCustomDecorationSlice=ch,e.getCustomRangeSlice=sh,e.getDisplayValueFromCell=I_,e.getDocsUpdateBody=of,e.getEmptyBaseSnapshot=ze,e.getEmptyCell=h_,e.getIntersectRange=Ip,e.getNumfmtParseValueFilter=Id,e.getOriginCellValue=L_,e.getParagraphsSlice=nh,e.getPlainText=Lh,e.getReverseDirection=ye,e.getRichTextEditPath=gh,e.getSectionBreakSlice=rh,e.getTableSlice=$m,e.getTextRunSlice=Qm,e.getTransformOffsetX=Pv,e.getTransformOffsetY=Fv,e.getWorksheetUID=R_,e.groupBy=ht,e.handleStyleToString=nf,e.hashAlgorithm=Kf,e.horizontalLineSegmentsSubtraction=zf,e.insertMatrixArray=Bd,e.insertTextToContent=Uf,e.invertColorByHSL=en,e.invertColorByMatrix=rn,Object.defineProperty(e,"isAsyncDependencyItem",{enumerable:!0,get:function(){return r.isAsyncDependencyItem}}),Object.defineProperty(e,"isAsyncHook",{enumerable:!0,get:function(){return r.isAsyncHook}}),e.isBlackColor=Jc,e.isBooleanString=bt,e.isCellCoverable=Qd,e.isCellV=$c,Object.defineProperty(e,"isClassDependencyItem",{enumerable:!0,get:function(){return r.isClassDependencyItem}}),e.isCommentEditorID=Ot,Object.defineProperty(e,"isCtor",{enumerable:!0,get:function(){return r.isCtor}}),e.isDefaultFormat=Ad,Object.defineProperty(e,"isDisposable",{enumerable:!0,get:function(){return r.isDisposable}}),e.isEmptyCell=Zd,Object.defineProperty(e,"isFactoryDependencyItem",{enumerable:!0,get:function(){return r.isFactoryDependencyItem}}),e.isFormulaId=tf,e.isFormulaString=ef,e.isICellData=Xc,e.isInternalEditorID=Dt,e.isNodeEnv=oe,e.isNotNullOrUndefined=m_,e.isNullCell=Qc,e.isNumeric=mo,e.isPatternEqualWithoutDecimal=jd,e.isRangesEqual=o_,e.isRealNum=Gf,e.isSafeNumeric=ho,e.isSafeUrl=L,e.isSameStyleTextRun=ff,e.isTextFormat=kd,e.isUnitRangesEqual=s_,e.isValidRange=sf,Object.defineProperty(e,"isValueDependencyItem",{enumerable:!0,get:function(){return r.isValueDependencyItem}}),e.isWhiteColor=Yc,e.makeArray=gt,e.makeCellRangeToRangeData=Xd,e.makeCellToSelection=Yd,e.makeCustomRangeStream=Fh,e.mapObjectMatrix=Ld,e.merge=so,e.mergeIntervals=Jf,e.mergeLocales=Yf,e.mergeOverrideWithDependencies=ev,e.mergeSets=So,e.mergeWith=co,e.mergeWorksheetSnapshotWithDefault=A_,e.mixinClass=po,e.moveMatrixArray=Wd,e.moveRangeByOffset=kp,e.nameCharacterCheck=_v,e.noop=Pt,e.normalizeBody=oh,e.normalizeTextRuns=tm,e.normalizeUrl=I,e.numberToABC=Jp,e.numberToListABC=Xp,Object.defineProperty(e,"numfmt",{enumerable:!0,get:function(){return _d}}),e.queryObjectMatrix=Wp,e.registerDependencies=kt,e.remove=ut,e.repeatStringNumTimes=Yp,e.replaceInDocumentBody=Cg,e.requestImmediateMacroTask=yo,e.resolveWithBasePath=R,e.rotate=mt,e.searchArray=Oc,e.searchInOrderedArray=Tc,e.selectionToArray=nl,e.sequence=xo,e.sequenceAsync=bo,e.sequenceExecute=_c,e.sequenceExecuteAsync=vc,e.set=uo,Object.defineProperty(e,"setDependencies",{enumerable:!0,get:function(){return r.setDependencies}}),e.shallowEqual=jt,e.skipParseTagNames=Iv,e.sliceMatrixArray=Ud,e.sortRules=Zp,e.sortRulesByDesc=Qp,e.sortRulesFactory=$p,e.spliceArray=Vd,e.splitIntoGrid=jp,e.takeAfter=bc,e.throttle=Ft,e.toDisposable=D,e.touchDependencies=At,e.updateAttributeByDelete=vh,e.updateAttributeByInsert=yh,e.willLoseNumericPrecision=go});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/core",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-insiders.20260629-12f2e44",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Core runtime, data models, command system, dependency injection, and Facade APIs for Univer.",
|
|
6
6
|
"author": "DreamNum Co., Ltd. <developer@univer.ai>",
|
|
@@ -70,8 +70,8 @@
|
|
|
70
70
|
"numfmt": "3.2.6",
|
|
71
71
|
"ot-json1": "^1.0.2",
|
|
72
72
|
"rbush": "^4.0.1",
|
|
73
|
-
"@univerjs/
|
|
74
|
-
"@univerjs/
|
|
73
|
+
"@univerjs/themes": "1.0.0-insiders.20260629-12f2e44",
|
|
74
|
+
"@univerjs/protocol": "1.0.0-insiders.20260629-12f2e44"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@types/async-lock": "^1.4.2",
|
package/LICENSE
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|