@univerjs/preset-sheets-thread-comment 0.5.1-nightly.202412041606 → 0.5.1-nightly.202412271606

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cjs/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("@univerjs-pro/thread-comment-datasource"),o=require("@univerjs/sheets-thread-comment"),i=require("@univerjs/sheets-thread-comment-ui"),m=require("@univerjs/thread-comment-ui");require("@univerjs/sheets-thread-comment/facade");function s(r={}){const{collaboration:t}=r,e=[m.UniverThreadCommentUIPlugin,o.UniverSheetsThreadCommentPlugin,i.UniverSheetsThreadCommentUIPlugin];return t&&e.push(n.UniverThreadCommentDataSourcePlugin),{plugins:e}}exports.UniverSheetsThreadCommentPreset=s;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@univerjs/sheets-thread-comment"),r=require("@univerjs/sheets-thread-comment-ui"),n=require("@univerjs/thread-comment-ui");require("@univerjs/sheets-thread-comment/facade");function o(e={}){return{plugins:[n.UniverThreadCommentUIPlugin,t.UniverSheetsThreadCommentPlugin,r.UniverSheetsThreadCommentUIPlugin]}}exports.UniverSheetsThreadCommentPreset=o;Object.keys(t).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>t[e]})});Object.keys(r).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>r[e]})});Object.keys(n).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>n[e]})});
package/lib/es/index.js CHANGED
@@ -1,16 +1,17 @@
1
- import { UniverThreadCommentDataSourcePlugin as n } from "@univerjs-pro/thread-comment-datasource";
2
- import { UniverSheetsThreadCommentPlugin as t } from "@univerjs/sheets-thread-comment";
3
- import { UniverSheetsThreadCommentUIPlugin as m } from "@univerjs/sheets-thread-comment-ui";
4
- import { UniverThreadCommentUIPlugin as i } from "@univerjs/thread-comment-ui";
1
+ import { UniverSheetsThreadCommentPlugin as e } from "@univerjs/sheets-thread-comment";
2
+ export * from "@univerjs/sheets-thread-comment";
3
+ import { UniverSheetsThreadCommentUIPlugin as r } from "@univerjs/sheets-thread-comment-ui";
4
+ export * from "@univerjs/sheets-thread-comment-ui";
5
+ import { UniverThreadCommentUIPlugin as o } from "@univerjs/thread-comment-ui";
6
+ export * from "@univerjs/thread-comment-ui";
5
7
  import "@univerjs/sheets-thread-comment/facade";
6
- function l(r = {}) {
7
- const { collaboration: o } = r, e = [
8
- i,
9
- t,
10
- m
11
- ];
12
- return o && e.push(n), { plugins: e };
8
+ function h(t = {}) {
9
+ return { plugins: [
10
+ o,
11
+ e,
12
+ r
13
+ ] };
13
14
  }
14
15
  export {
15
- l as UniverSheetsThreadCommentPreset
16
+ h as UniverSheetsThreadCommentPreset
16
17
  };
package/lib/index.css CHANGED
@@ -1 +1 @@
1
- .univer-thread-comment-editor-buttons{margin-top:12px;display:flex;flex-direction:row;justify-content:flex-end}.univer-thread-comment-editor-suggestion{display:flex;align-items:center;font-size:13px;color:rgb(var(--color-black))}.univer-thread-comment-editor-suggestionActive{background-color:rgba(var(--grey-50))}.univer-thread-comment-editor-suggestion-icon{width:24px;height:24px;border-radius:12px;margin-right:6px}.univer-thread-comment{padding:16px;background:rgba(var(--color-white));border:1px solid rgba(var(--grey-200));border-radius:8px;box-sizing:border-box;position:relative;width:278px}.univer-thread-comment-active{box-shadow:var(--box-shadow-base)}.univer-thread-comment-content{max-height:300px;overflow-y:auto;overflow-x:hidden;scrollbar-color:rgba(var(--scrollbar-color),.7) transparent;scrollbar-gutter:auto;scrollbar-width:thin}.univer-thread-comment-highlight{background-color:rgb(var(--gold-400));position:absolute;top:0;left:0;right:0;height:6px;border-top-left-radius:6px;border-top-right-radius:6px}.univer-thread-comment-icon-container{display:flex;flex-direction:row;flex-shrink:0;flex-grow:0}.univer-thread-comment-icon{width:24px;height:24px;border-radius:3px;margin-left:4px;display:inline-flex;justify-content:center;align-items:center;cursor:pointer;font-size:16px}.univer-thread-comment-icon:hover{background-color:rgba(var(--grey-50))}.univer-thread-comment-title{display:flex;flex-direction:row;align-items:center;justify-content:space-between;margin-bottom:16px;font-size:14px;line-height:20px}.univer-thread-comment-title-position{display:flex;flex-direction:row;align-items:center;flex:1 1 0;overflow:hidden}.univer-thread-comment-title-highlight{width:3px;height:14px;border-radius:1.5px;background-color:rgba(var(--gold-400));margin-right:8px;flex-shrink:0;flex-grow:0}.univer-thread-comment-title-position-text{flex:1 1 0;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.univer-thread-comment-username{font-size:14px;font-weight:500;line-height:20px}.univer-thread-comment-item{margin-bottom:12px;padding-left:30px;position:relative}.univer-thread-comment-item-head{width:24px;height:24px;border-radius:12px;position:absolute;left:0;top:0}.univer-thread-comment-item-title{display:flex;justify-content:space-between;height:24px;align-items:center;margin-bottom:4px}.univer-thread-comment-item-title-position{color:rgba(var(--color-black));font-size:14px;line-height:20px}.univer-thread-comment-item-title-highlight{width:3px;height:14px;border-radius:2px;margin-right:8px;margin-top:3px;background-color:rgba(var(--gold-400))}.univer-thread-comment-item-time{font-size:12px;line-height:1.5;margin-bottom:4px;color:rgba(var(--grey-600))}.univer-thread-comment-item-content{font-size:13px;line-height:20px;color:rgba(var(--color-black))}.univer-thread-comment-item-at{color:rgba(var(--blue-400))}.univer-thread-comment-panel{min-height:100%;display:flex;flex-direction:column;padding-bottom:12px}.univer-thread-comment-panel .univer-thread-comment{margin-top:12px}.univer-thread-comment-panel-forms{display:flex;flex-direction:row;justify-content:space-between;margin-top:12px}.univer-thread-comment-panel-forms .univer-select{width:120px}.univer-thread-comment-panel-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;color:rgb(var(--grey-600));font-size:13px;flex:1}.univer-thread-comment-panel-add{margin-top:8px;display:flex;flex-direction:row}.univer-thread-comment-panel-add svg{margin-right:6px}.univer-thread-comment-panel-solved{margin-top:12px;font-size:var(--font-size-xs)}
1
+ *,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(63 131 248 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(63 131 248 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*{scrollbar-color:initial;scrollbar-width:initial}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.univer-thread-comment-editor-buttons{margin-top:12px;display:flex;flex-direction:row;justify-content:flex-end}.univer-thread-comment-editor-suggestion{display:flex;align-items:center;font-size:13px;color:rgb(var(--color-black))}.univer-thread-comment-editor-suggestionActive{background-color:rgba(var(--grey-50))}.univer-thread-comment-editor-suggestion-icon{width:24px;height:24px;border-radius:12px;margin-right:6px}.univer-thread-comment{padding:16px;background:rgba(var(--color-white));border:1px solid rgba(var(--grey-200));border-radius:8px;box-sizing:border-box;position:relative;width:278px}.univer-thread-comment-active{box-shadow:var(--box-shadow-base)}.univer-thread-comment-content{max-height:300px;overflow-y:auto;overflow-x:hidden;scrollbar-color:rgba(var(--scrollbar-color),.7) transparent;scrollbar-gutter:auto;scrollbar-width:thin}.univer-thread-comment-highlight{background-color:rgb(var(--gold-400));position:absolute;top:0;left:0;right:0;height:6px;border-top-left-radius:6px;border-top-right-radius:6px}.univer-thread-comment-icon-container{display:flex;flex-direction:row;flex-shrink:0;flex-grow:0}.univer-thread-comment-icon{width:24px;height:24px;border-radius:3px;margin-left:4px;display:inline-flex;justify-content:center;align-items:center;cursor:pointer;font-size:16px}.univer-thread-comment-icon:hover{background-color:rgba(var(--grey-50))}.univer-thread-comment-title{display:flex;flex-direction:row;align-items:center;justify-content:space-between;margin-bottom:16px;font-size:14px;line-height:20px}.univer-thread-comment-title-position{display:flex;flex-direction:row;align-items:center;flex:1 1 0;overflow:hidden}.univer-thread-comment-title-highlight{width:3px;height:14px;border-radius:1.5px;background-color:rgba(var(--gold-400));margin-right:8px;flex-shrink:0;flex-grow:0}.univer-thread-comment-title-position-text{flex:1 1 0;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.univer-thread-comment-username{font-size:14px;font-weight:500;line-height:20px}.univer-thread-comment-item{margin-bottom:12px;padding-left:30px;position:relative}.univer-thread-comment-item-head{width:24px;height:24px;border-radius:12px;position:absolute;left:0;top:0}.univer-thread-comment-item-title{display:flex;justify-content:space-between;height:24px;align-items:center;margin-bottom:4px}.univer-thread-comment-item-title-position{color:rgba(var(--color-black));font-size:14px;line-height:20px}.univer-thread-comment-item-title-highlight{width:3px;height:14px;border-radius:2px;margin-right:8px;margin-top:3px;background-color:rgba(var(--gold-400))}.univer-thread-comment-item-time{font-size:12px;line-height:1.5;margin-bottom:4px;color:rgba(var(--grey-600))}.univer-thread-comment-item-content{font-size:13px;line-height:20px;color:rgba(var(--color-black))}.univer-thread-comment-item-at{color:rgba(var(--blue-400))}.univer-thread-comment-panel{min-height:100%;display:flex;flex-direction:column;padding-bottom:12px}.univer-thread-comment-panel .univer-thread-comment{margin-top:12px}.univer-thread-comment-panel-forms{display:flex;flex-direction:row;justify-content:space-between;margin-top:12px}.univer-thread-comment-panel-forms .univer-select{width:120px}.univer-thread-comment-panel-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;color:rgb(var(--grey-600));font-size:13px;flex:1}.univer-thread-comment-panel-add{margin-top:8px;display:flex;flex-direction:row}.univer-thread-comment-panel-add svg{margin-right:6px}.univer-thread-comment-panel-solved{margin-top:12px;font-size:var(--font-size-xs)}
@@ -1,5 +1,4 @@
1
1
  export * from './umd';
2
- export * from '@univerjs-pro/thread-comment-datasource';
3
2
  export * from '@univerjs/sheets-thread-comment';
4
3
  export * from '@univerjs/sheets-thread-comment-ui';
5
4
  export * from '@univerjs/thread-comment-ui';
@@ -2,15 +2,10 @@ import { IPreset } from './types';
2
2
  import '@univerjs/sheets-thread-comment/facade';
3
3
  import '@univerjs/thread-comment-ui/lib/index.css';
4
4
  export interface IUniverSheetsThreadCommentPresetConfig {
5
- /**
6
- * If you would like to use comment with Univer's first-party collaboration features,
7
- * please set this option to `true`.
8
- */
9
- collaboration?: boolean;
10
5
  }
11
6
  /**
12
7
  * This preset add thread comment features into your application.
13
8
  *
14
9
  * @param {Partial<IUniverSheetsThreadCommentPresetConfig>} config - The configuration object.
15
10
  */
16
- export declare function UniverSheetsThreadCommentPreset(config?: Partial<IUniverSheetsThreadCommentPresetConfig>): IPreset;
11
+ export declare function UniverSheetsThreadCommentPreset(_config?: Partial<IUniverSheetsThreadCommentPresetConfig>): IPreset;
package/lib/umd/index.js CHANGED
@@ -1,13 +1,17 @@
1
+ // @univerjs/thread-comment/index
2
+ (function(s,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("@univerjs/core"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","rxjs"],c):(s=typeof globalThis<"u"?globalThis:s||self,c(s.UniverThreadComment={},s.UniverCore,s.rxjs))})(this,function(s,c,M){"use strict";var F=Object.defineProperty;var z=(s,c,M)=>c in s?F(s,c,{enumerable:!0,configurable:!0,writable:!0,value:M}):s[c]=M;var u=(s,c,M)=>z(s,typeof c!="symbol"?c+"":c,M);var T;class E extends c.Disposable{constructor(){super();u(this,"_dataSource",null);u(this,"syncUpdateMutationToColla",!0)}set dataSource(e){this._dataSource=e}get dataSource(){return this._dataSource}async getThreadComment(e,t,n){return this._dataSource?(await this._dataSource.listComments(e,t,[n]))[0]:null}async addComment(e){var t;return this._dataSource?this._dataSource.addComment(e):{...e,threadId:(t=e.threadId)!=null?t:e.id}}async updateComment(e){return this._dataSource?this._dataSource.updateComment(e):!0}async resolveComment(e){return this._dataSource?this._dataSource.resolveComment(e):!0}async deleteComment(e,t,n,o){return this._dataSource?this._dataSource.deleteComment(e,t,n,o):!0}async listThreadComments(e,t,n){return this.dataSource?this.dataSource.listComments(e,t,n):!1}saveToSnapshot(e,t){if(this._dataSource){const n={};return Object.keys(e).forEach(o=>{const a=e[o];n[o]=a.map(this.dataSource.saveCommentToSnapshot)}),n}return e}}const C=c.createIdentifier("univer.thread-comment.data-source-service");var V=Object.defineProperty,W=Object.getOwnPropertyDescriptor,b=(r,m,e,t)=>{for(var n=t>1?void 0:t?W(m,e):m,o=r.length-1,a;o>=0;o--)(a=r[o])&&(n=(t?a(m,e,n):a(n))||n);return t&&n&&V(m,e,n),n},R=(r,m)=>(e,t)=>m(e,t,r);s.ThreadCommentModel=class extends c.Disposable{constructor(e,t){super();u(this,"_commentsMap",new Map);u(this,"_threadMap",new Map);u(this,"_commentUpdate$",new M.Subject);u(this,"commentUpdate$",this._commentUpdate$.asObservable());u(this,"_tasks",[]);this._dataSourceService=e,this._lifecycleService=t,this.disposeWithMe(()=>{this._commentUpdate$.complete()}),this.disposeWithMe(this._lifecycleService.lifecycle$.subscribe(n=>{const o=new Map;n===c.LifecycleStages.Rendered&&(this._tasks.forEach(({unitId:a,subUnitId:d,threadIds:i})=>{let h=o.get(a);h||(h=new Map,o.set(a,h));let l=h.get(d);l||(l=new Set,h.set(d,l));for(const f of i)l.add(f)}),this._tasks=[],o.forEach((a,d)=>{a.forEach((i,h)=>{this.syncThreadComments(d,h,Array.from(i))})}))}))}_ensureCommentMap(e,t){let n=this._commentsMap.get(e);n||(n=new Map,this._commentsMap.set(e,n));let o=n.get(t);return o||(o=new Map,n.set(t,o)),o}ensureMap(e,t){return this._ensureCommentMap(e,t)}_ensureThreadMap(e,t){let n=this._threadMap.get(e);n||(n=new Map,this._threadMap.set(e,n));let o=n.get(t);return o||(o=new Map,n.set(t,o)),o}_replaceComment(e,t,n){const o=this._ensureCommentMap(e,t),a=o.get(n.id);if(a){const{children:d,...i}=n,h={...i,ref:a.ref};o.set(n.id,h),d==null||d.forEach(l=>{o.set(l.id,{...l,ref:""})}),this._commentUpdate$.next({unitId:e,subUnitId:t,type:"syncUpdate",payload:h}),!!n.resolved!=!!a.resolved&&this._commentUpdate$.next({unitId:e,subUnitId:t,type:"resolve",payload:{commentId:n.id,resolved:!!n.resolved}})}}async syncThreadComments(e,t,n){if(this._lifecycleService.stage<c.LifecycleStages.Rendered){this._tasks.push({unitId:e,subUnitId:t,threadIds:n});return}const o=this._ensureThreadMap(e,t),a=this._ensureCommentMap(e,t),d=await this._dataSourceService.listThreadComments(e,t,n);if(!d)return;const i=new Set(n);d.forEach(h=>{this._replaceComment(e,t,h),i.delete(h.threadId)}),i.forEach(h=>{o.delete(h),a.forEach((l,f)=>{l.threadId===h&&a.delete(f)})})}addComment(e,t,n,o){const a=this._ensureCommentMap(e,t),{parentId:d,children:i=[],...h}=n,l={...h,parentId:d===n.id?void 0:d};l.threadId||(l.threadId=l.parentId||l.id);const f=p=>{a.set(p.id,p),this._commentUpdate$.next({unitId:e,subUnitId:t,type:"add",payload:p,isRoot:!p.parentId})};f(l);const L=this._ensureThreadMap(e,t);if(!l.parentId){L.set(l.threadId,l);for(const p of i)f(p)}return o&&this.syncThreadComments(e,t,[l.threadId]),!0}updateComment(e,t,n,o){const d=this._ensureCommentMap(e,t).get(n.commentId);return d&&(d.updated=!0,d.text=n.text,d.attachments=n.attachments,d.updateT=n.updateT,this._commentUpdate$.next({unitId:e,subUnitId:t,type:"update",payload:n,silent:o})),!0}updateCommentRef(e,t,n,o){const d=this._ensureCommentMap(e,t).get(n.commentId);return d?(d.ref=n.ref,this._commentUpdate$.next({unitId:e,subUnitId:t,type:"updateRef",payload:n,silent:o,threadId:d.threadId}),!0):!1}resolveComment(e,t,n,o){const d=this._ensureCommentMap(e,t).get(n);return d?(d.resolved=o,this._commentUpdate$.next({unitId:e,subUnitId:t,type:"resolve",payload:{commentId:n,resolved:o}}),!0):!1}getComment(e,t,n){return this._ensureCommentMap(e,t).get(n)}getRootComment(e,t,n){return this._ensureThreadMap(e,t).get(n)}getThread(e,t,n){const o=this._ensureCommentMap(e,t),a=Array.from(o.values()).filter(l=>l.threadId===n);let d;const i=[],h=new Set;for(const l of a)l.parentId?i.push(l):d=l,h.add(l.personId);if(d)return{root:d,children:i,relativeUsers:h,unitId:e,subUnitId:t,threadId:n}}getCommentWithChildren(e,t,n){const o=this.getComment(e,t,n);if(o)return this.getThread(e,t,o.threadId)}_deleteComment(e,t,n){const o=this._ensureCommentMap(e,t),a=o.get(n);a&&(o.delete(n),this._commentUpdate$.next({unitId:e,subUnitId:t,type:"delete",payload:{commentId:n,isRoot:!a.parentId,comment:a}}))}deleteThread(e,t,n){this._ensureThreadMap(e,t).delete(n),this._ensureCommentMap(e,t).forEach(d=>{d.threadId===n&&this._deleteComment(e,t,d.id)})}deleteComment(e,t,n){const a=this._ensureCommentMap(e,t).get(n);return a&&(a.parentId?this._deleteComment(e,t,n):this.deleteThread(e,t,a.threadId)),!0}deleteUnit(e){const t=this._commentsMap.get(e);t&&t.forEach((n,o)=>{n.forEach(a=>{this.deleteComment(e,o,a.id)})})}getUnit(e){const t=this._threadMap.get(e);if(!t)return[];const n=[];return t.forEach((o,a)=>{o.forEach((d,i)=>{const h=this.getThread(e,a,i);h&&n.push(h)})}),n}getAll(){const e=[];return this._commentsMap.forEach((t,n)=>{e.push({unitId:n,threads:this.getUnit(n)})}),e}},s.ThreadCommentModel=b([R(0,c.Inject(C)),R(1,c.Inject(c.LifecycleService))],s.ThreadCommentModel);var v=(r=>(r[r.UNIVER_UNKNOWN=0]="UNIVER_UNKNOWN",r[r.UNIVER_DOC=1]="UNIVER_DOC",r[r.UNIVER_SHEET=2]="UNIVER_SHEET",r[r.UNIVER_SLIDE=3]="UNIVER_SLIDE",r[r.UNIVER_PROJECT=4]="UNIVER_PROJECT",r[r.UNRECOGNIZED=-1]="UNRECOGNIZED",r))(v||{});const S="UNIVER_THREAD_COMMENT_PLUGIN";var H=Object.defineProperty,J=Object.getOwnPropertyDescriptor,G=(r,m,e,t)=>{for(var n=t>1?void 0:t?J(m,e):m,o=r.length-1,a;o>=0;o--)(a=r[o])&&(n=(t?a(m,e,n):a(n))||n);return t&&n&&H(m,e,n),n},g=(r,m)=>(e,t)=>m(e,t,r);s.ThreadCommentResourceController=class extends c.Disposable{constructor(m,e,t){super(),this._resourceManagerService=m,this._threadCommentModel=e,this._threadCommentDataSourceService=t,this._initSnapshot()}_initSnapshot(){const m=t=>{const n=this._threadCommentModel.getUnit(t),o={};return n?(n.forEach(a=>{var i;const d=(i=o[a.subUnitId])!=null?i:[];d.push({...a.root,children:a.children}),o[a.subUnitId]=d}),JSON.stringify(this._threadCommentDataSourceService.saveToSnapshot(o,t))):""},e=t=>{if(!t)return{};try{return JSON.parse(t)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:`SHEET_${S}`,businesses:[v.UNIVER_SHEET,v.UNIVER_DOC],toJson:t=>m(t),parseJson:t=>e(t),onUnLoad:t=>{this._threadCommentModel.deleteUnit(t)},onLoad:async(t,n)=>{Object.keys(n).forEach(o=>{const a=n[o];a.forEach(d=>{this._threadCommentModel.addComment(t,o,d)}),this._threadCommentModel.syncThreadComments(t,o,a.map(d=>d.threadId))})}}))}},s.ThreadCommentResourceController=G([g(0,c.IResourceManagerService),g(1,c.Inject(s.ThreadCommentModel)),g(2,C)],s.ThreadCommentResourceController);const y={id:"thread-comment.mutation.add-comment",type:c.CommandType.MUTATION,handler(r,m,e){if(!m)return!1;const t=r.get(s.ThreadCommentModel),{unitId:n,subUnitId:o,comment:a,sync:d}=m,i=d||(e==null?void 0:e.fromChangeset)&&!a.parentId;return t.addComment(n,o,a,i)}},U={id:"thread-comment.mutation.update-comment",type:c.CommandType.MUTATION,handler(r,m){if(!m)return!1;const e=r.get(s.ThreadCommentModel),{unitId:t,subUnitId:n,payload:o,silent:a}=m;return e.updateComment(t,n,o,a)}},O={id:"thread-comment.mutation.update-comment-ref",type:c.CommandType.MUTATION,handler(r,m){if(!m)return!1;const e=r.get(s.ThreadCommentModel),{unitId:t,subUnitId:n,payload:o,silent:a}=m;return e.updateCommentRef(t,n,o,a)}},N={id:"thread-comment.mutation.resolve-comment",type:c.CommandType.MUTATION,handler(r,m){if(!m)return!1;const e=r.get(s.ThreadCommentModel),{unitId:t,subUnitId:n,resolved:o,commentId:a}=m;return e.resolveComment(t,n,a,o)}},_={id:"thread-comment.mutation.delete-comment",type:c.CommandType.MUTATION,handler(r,m){if(!m)return!1;const e=r.get(s.ThreadCommentModel),{unitId:t,subUnitId:n,commentId:o}=m;return e.deleteComment(t,n,o)}},D={id:"thread-comment.command.add-comment",type:c.CommandType.COMMAND,async handler(r,m){if(!m)return!1;const e=r.get(c.ICommandService),t=r.get(C),{comment:n}=m,o=await t.addComment(n),a=t.syncUpdateMutationToColla,d=!n.parentId,i={id:y.id,params:{...m,comment:o}};return d?await e.executeCommand(i.id,i.params):e.executeCommand(i.id,i.params,{onlyLocal:!a})}},P={id:"thread-comment.command.update-comment",type:c.CommandType.COMMAND,async handler(r,m){if(!m)return!1;const{unitId:e,subUnitId:t,payload:n}=m,o=r.get(c.ICommandService),a=r.get(s.ThreadCommentModel),d=r.get(C),i=d.syncUpdateMutationToColla,h=a.getComment(e,t,n.commentId);if(!h)return!1;const{children:l,...f}=h;if(!await d.updateComment({...f,...n}))return!1;const p={id:U.id,params:m};return o.executeCommand(p.id,p.params,{onlyLocal:!i}),!0}},w={id:"thread-comment.command.resolve-comment",type:c.CommandType.COMMAND,async handler(r,m){if(!m)return!1;const{unitId:e,subUnitId:t,resolved:n,commentId:o}=m,a=r.get(C),i=r.get(s.ThreadCommentModel).getComment(e,t,o),h=a.syncUpdateMutationToColla;return!i||!await a.resolveComment({...i,resolved:n})?!1:r.get(c.ICommandService).executeCommand(N.id,m,{onlyLocal:!h})}},j={id:"thread-comment.command.delete-comment",type:c.CommandType.COMMAND,async handler(r,m){if(!m)return!1;const e=r.get(s.ThreadCommentModel),t=r.get(C),n=r.get(c.ICommandService),{unitId:o,subUnitId:a,commentId:d}=m,i=t.syncUpdateMutationToColla,h=e.getComment(o,a,d);if(!h||!await t.deleteComment(o,a,h.threadId,d))return!1;const l={id:_.id,params:m};return n.executeCommand(l.id,l.params,{onlyLocal:!i})}},A={id:"thread-comment.command.delete-comment-tree",type:c.CommandType.COMMAND,async handler(r,m){if(!m)return!1;const e=r.get(s.ThreadCommentModel),t=r.get(c.ICommandService),n=r.get(C),{unitId:o,subUnitId:a,commentId:d}=m,i=e.getCommentWithChildren(o,a,d);return!i||!await n.deleteComment(o,a,i.root.threadId,d)?!1:await t.executeCommand(_.id,{unitId:o,subUnitId:a,commentId:i.root.id})}},Y="thread-comment.config",$={};var K=Object.defineProperty,B=Object.getOwnPropertyDescriptor,q=(r,m,e,t)=>{for(var n=t>1?void 0:t?B(m,e):m,o=r.length-1,a;o>=0;o--)(a=r[o])&&(n=(t?a(m,e,n):a(n))||n);return t&&n&&K(m,e,n),n},I=(r,m)=>(e,t)=>m(e,t,r);s.UniverThreadCommentPlugin=(T=class extends c.Plugin{constructor(m=$,e,t,n){super(),this._config=m,this._injector=e,this._commandService=t,this._configService=n;const{...o}=c.merge({},$,this._config);this._configService.setConfig(Y,o)}onStarting(){var m;c.mergeOverrideWithDependencies([[C,{useClass:E}],[s.ThreadCommentModel],[s.ThreadCommentResourceController]],(m=this._config)==null?void 0:m.overrides).forEach(e=>{this._injector.add(e)}),[D,P,j,w,A,y,U,O,_,N].forEach(e=>{this._commandService.registerCommand(e)}),this._injector.get(s.ThreadCommentResourceController)}},u(T,"pluginName",S),u(T,"type",c.UniverInstanceType.UNIVER_UNKNOWN),T),s.UniverThreadCommentPlugin=q([I(1,c.Inject(c.Injector)),I(2,c.ICommandService),I(3,c.IConfigService)],s.UniverThreadCommentPlugin);function Z(){return c.dayjs().format("YYYY/MM/DD HH:mm")}s.AddCommentCommand=D,s.AddCommentMutation=y,s.DeleteCommentCommand=j,s.DeleteCommentMutation=_,s.DeleteCommentTreeCommand=A,s.IThreadCommentDataSourceService=C,s.ResolveCommentCommand=w,s.ResolveCommentMutation=N,s.TC_PLUGIN_NAME=S,s.ThreadCommentDataSourceService=E,s.UpdateCommentCommand=P,s.UpdateCommentMutation=U,s.UpdateCommentRefMutation=O,s.getDT=Z,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
3
+
4
+
1
5
  // @univerjs/sheets-thread-comment/index
2
6
  (function(d,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@univerjs/core"),require("@univerjs/engine-formula"),require("@univerjs/sheets"),require("@univerjs/thread-comment"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/engine-formula","@univerjs/sheets","@univerjs/thread-comment","rxjs"],i):(d=typeof globalThis<"u"?globalThis:d||self,i(d.UniverSheetsThreadComment={},d.UniverCore,d.UniverEngineFormula,d.UniverSheets,d.UniverThreadComment,d.rxjs))})(this,function(d,i,l,g,p,S){"use strict";var O=Object.defineProperty;var x=(d,i,l)=>i in d?O(d,i,{enumerable:!0,configurable:!0,writable:!0,value:l}):d[i]=l;var f=(d,i,l)=>x(d,typeof i!="symbol"?i+"":i,l);var T=Object.defineProperty,y=Object.getOwnPropertyDescriptor,U=(h,o,e,n)=>{for(var t=n>1?void 0:n?y(o,e):o,r=h.length-1,s;r>=0;r--)(s=h[r])&&(t=(n?s(o,e,t):s(t))||t);return n&&t&&T(o,e,t),t},M=(h,o)=>(e,n)=>o(e,n,h);d.SheetsThreadCommentModel=class extends i.Disposable{constructor(e,n){super();f(this,"_matrixMap",new Map);f(this,"_locationMap",new Map);f(this,"_commentUpdate$",new S.Subject);f(this,"commentUpdate$",this._commentUpdate$.asObservable());this._threadCommentModel=e,this._univerInstanceService=n,this._init(),this.disposeWithMe(()=>{this._commentUpdate$.complete()})}_init(){this._initData(),this._initUpdateTransform()}_ensureCommentMatrix(e,n){let t=this._matrixMap.get(e);t||(t=new Map,this._matrixMap.set(e,t));let r=t.get(n);return r||(r=new i.ObjectMatrix,t.set(n,r)),r}_ensureCommentLocationMap(e,n){let t=this._locationMap.get(e);t||(t=new Map,this._locationMap.set(e,t));let r=t.get(n);return r||(r=new Map,t.set(n,r)),r}_addCommentToMatrix(e,n,t,r){var a;const s=(a=e.getValue(n,t))!=null?a:new Set;s.add(r),e.setValue(n,t,s)}_deleteCommentFromMatrix(e,n,t,r){if(n>=0&&t>=0){const s=e.getValue(n,t);s&&s.has(r)&&(s.delete(r),s.size===0&&e.realDeleteValue(n,t))}}_ensure(e,n){const t=this._ensureCommentMatrix(e,n),r=this._ensureCommentLocationMap(e,n);return{matrix:t,locationMap:r}}_initData(){const e=this._threadCommentModel.getAll();for(const n of e)for(const t of n.threads){const{unitId:r,subUnitId:s,root:a}=t;this._addComment(r,s,a)}}_addComment(e,n,t){const r=l.singleReferenceToGrid(t.ref),s=t.parentId,{row:a,column:m}=r,c=t.id,{matrix:_,locationMap:u}=this._ensure(e,n);!s&&a>=0&&m>=0&&(this._addCommentToMatrix(_,a,m,c),u.set(c,{row:a,column:m})),s||this._commentUpdate$.next({unitId:e,subUnitId:n,payload:t,type:"add",isRoot:!s,...r})}_initUpdateTransform(){this.disposeWithMe(this._threadCommentModel.commentUpdate$.subscribe(e=>{const{unitId:n,subUnitId:t}=e;try{if(this._univerInstanceService.getUnitType(n)!==i.UniverInstanceType.UNIVER_SHEET)return}catch{}const{matrix:r,locationMap:s}=this._ensure(n,t);switch(e.type){case"add":{this._addComment(e.unitId,e.subUnitId,e.payload);break}case"delete":{const{isRoot:a,comment:m}=e.payload;if(a){const c=l.singleReferenceToGrid(m.ref),{row:_,column:u}=c;this._deleteCommentFromMatrix(r,_,u,m.id),this._commentUpdate$.next({...e,...c})}break}case"update":{const{commentId:a}=e.payload,m=this._threadCommentModel.getComment(n,t,a);if(!m)return;const c=l.singleReferenceToGrid(m.ref);this._commentUpdate$.next({...e,...c});break}case"updateRef":{const a=l.singleReferenceToGrid(e.payload.ref),{commentId:m}=e.payload,c=s.get(m);if(!c)return;const{row:_,column:u}=c;this._deleteCommentFromMatrix(r,_,u,m),s.delete(m),a.row>=0&&a.column>=0&&(this._addCommentToMatrix(r,a.row,a.column,m),s.set(m,{row:a.row,column:a.column})),this._commentUpdate$.next({...e,...a});break}case"resolve":{const{unitId:a,subUnitId:m,payload:c}=e,{locationMap:_}=this._ensure(a,m),u=_.get(c.commentId);u&&this._commentUpdate$.next({...e,...u});break}}}))}getByLocation(e,n,t,r){var m;return(m=this.getAllByLocation(e,n,t,r).filter(c=>!c.resolved)[0])==null?void 0:m.id}getAllByLocation(e,n,t,r){const a=this._ensureCommentMatrix(e,n).getValue(t,r);return a?Array.from(a).map(m=>this.getComment(e,n,m)).filter(Boolean):[]}getComment(e,n,t){return this._threadCommentModel.getComment(e,n,t)}getCommentWithChildren(e,n,t,r){const s=this.getByLocation(e,n,t,r);if(!s)return;const a=this.getComment(e,n,s);if(a)return this._threadCommentModel.getThread(e,n,a.threadId)}showCommentMarker(e,n,t,r){const s=this.getByLocation(e,n,t,r);if(!s)return!1;const a=this.getComment(e,n,s);return!!(a&&!a.resolved)}getSubUnitAll(e,n){return this._threadCommentModel.getUnit(e).filter(t=>t.subUnitId===n).map(t=>t.root)}},d.SheetsThreadCommentModel=U([M(0,i.Inject(p.ThreadCommentModel)),M(1,i.IUniverInstanceService)],d.SheetsThreadCommentModel);var I=Object.defineProperty,b=Object.getOwnPropertyDescriptor,j=(h,o,e,n)=>{for(var t=n>1?void 0:n?b(o,e):o,r=h.length-1,s;r>=0;r--)(s=h[r])&&(t=(n?s(o,e,t):s(t))||t);return n&&t&&I(o,e,t),t},C=(h,o)=>(e,n)=>o(e,n,h);d.SheetsThreadCommentRefRangeController=class extends i.Disposable{constructor(e,n,t,r,s){super();f(this,"_disposableMap",new Map);f(this,"_watcherMap",new Map);f(this,"_handleRangeChange",(e,n,t,r,s)=>{const a=t.id,m={startColumn:t.column,endColumn:t.column,startRow:t.row,endRow:t.row};return r?{redos:[{id:p.UpdateCommentRefMutation.id,params:{unitId:e,subUnitId:n,payload:{ref:l.serializeRange(r),commentId:a},silent:s}}],undos:[{id:p.UpdateCommentRefMutation.id,params:{unitId:e,subUnitId:n,payload:{ref:l.serializeRange(m),commentId:a},silent:s}}]}:{redos:[{id:p.DeleteCommentMutation.id,params:{unitId:e,subUnitId:n,commentId:a}}],undos:[{id:p.AddCommentMutation.id,params:{unitId:e,subUnitId:n,comment:t,sync:!0}}]}});this._refRangeService=e,this._sheetsThreadCommentModel=n,this._threadCommentModel=t,this._selectionManagerService=r,this._commandService=s,this._initData(),this._initRefRange()}_getIdWithUnitId(e,n,t){return`${e}-${n}-${t}`}_register(e,n,t){const r=t.id,s={startColumn:t.column,endColumn:t.column,startRow:t.row,endRow:t.row};this._disposableMap.set(this._getIdWithUnitId(e,n,r),this._refRangeService.registerRefRange(s,a=>{const m=g.handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests(s,a,{selectionManagerService:this._selectionManagerService}),c=Array.isArray(m)?m[0]:m;return c&&c.startColumn===s.startColumn&&c.startRow===s.startRow?{undos:[],redos:[]}:this._handleRangeChange(e,n,t,c,!1)},e,n))}_watch(e,n,t){const r=t.id,s={startColumn:t.column,endColumn:t.column,startRow:t.row,endRow:t.row};this._watcherMap.set(this._getIdWithUnitId(e,n,r),this._refRangeService.watchRange(e,n,s,(a,m)=>{const{redos:c}=this._handleRangeChange(e,n,t,m,!0);i.sequenceExecuteAsync(c,this._commandService,{onlyLocal:!0})},!0))}_unwatch(e,n,t){var s;const r=this._getIdWithUnitId(e,n,t);(s=this._watcherMap.get(r))==null||s.dispose(),this._watcherMap.delete(r)}_unregister(e,n,t){var s;const r=this._getIdWithUnitId(e,n,t);(s=this._disposableMap.get(r))==null||s.dispose(),this._disposableMap.delete(r)}_initData(){const e=this._threadCommentModel.getAll();for(const n of e)for(const t of n.threads){const{unitId:r,subUnitId:s,root:a}=t,m=l.singleReferenceToGrid(a.ref),c={...a,...m};this._register(r,s,c),this._watch(r,s,c)}}_initRefRange(){this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.subscribe(e=>{const{unitId:n,subUnitId:t}=e;switch(e.type){case"add":{if(e.payload.parentId)return;const r={...e.payload,row:e.row,column:e.column};this._register(e.unitId,e.subUnitId,r),this._watch(e.unitId,e.subUnitId,r);break}case"delete":{this._unregister(n,t,e.payload.commentId),this._unwatch(n,t,e.payload.commentId);break}case"updateRef":{const r=this._sheetsThreadCommentModel.getComment(n,t,e.payload.commentId);if(!r)return;this._unregister(n,t,e.payload.commentId);const s={...r,row:e.row,column:e.column};e.silent||(this._unwatch(n,t,e.payload.commentId),this._watch(n,t,s)),this._register(e.unitId,e.subUnitId,s);break}}})),this.disposeWithMe(i.toDisposable(()=>{this._disposableMap.forEach(e=>{e.dispose()}),this._disposableMap.clear()}))}},d.SheetsThreadCommentRefRangeController=j([C(0,i.Inject(g.RefRangeService)),C(1,i.Inject(d.SheetsThreadCommentModel)),C(2,i.Inject(p.ThreadCommentModel)),C(3,i.Inject(g.SheetsSelectionsService)),C(4,i.ICommandService)],d.SheetsThreadCommentRefRangeController);const P="SHEET_THREAD_COMMENT_BASE_PLUGIN";var v=Object.defineProperty,$=Object.getOwnPropertyDescriptor,E=(h,o,e)=>o in h?v(h,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):h[o]=e,D=(h,o,e,n)=>{for(var t=n>1?void 0:n?$(o,e):o,r=h.length-1,s;r>=0;r--)(s=h[r])&&(t=(n?s(o,e,t):s(t))||t);return n&&t&&v(o,e,t),t},R=(h,o)=>(e,n)=>o(e,n,h),w=(h,o,e)=>E(h,typeof o!="symbol"?o+"":o,e);d.UniverSheetsThreadCommentPlugin=class extends i.Plugin{constructor(o,e,n){super(),this._injector=e,this._commandService=n}onStarting(){[[d.SheetsThreadCommentModel],[d.SheetsThreadCommentRefRangeController]].forEach(o=>{this._injector.add(o)}),this._injector.get(d.SheetsThreadCommentRefRangeController)}},w(d.UniverSheetsThreadCommentPlugin,"pluginName",P),w(d.UniverSheetsThreadCommentPlugin,"type",i.UniverInstanceType.UNIVER_SHEET),d.UniverSheetsThreadCommentPlugin=D([i.DependentOn(p.UniverThreadCommentPlugin),R(1,i.Inject(i.Injector)),R(2,i.Inject(i.ICommandService))],d.UniverSheetsThreadCommentPlugin),Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
3
7
 
4
8
 
5
9
  // @univerjs/sheets-thread-comment/facade
6
- (function(o,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@univerjs/core"),require("@univerjs/sheets/facade"),require("@univerjs/sheets-thread-comment"),require("@univerjs/thread-comment"),require("@univerjs/engine-formula"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets/facade","@univerjs/sheets-thread-comment","@univerjs/thread-comment","@univerjs/engine-formula","rxjs"],i):(o=typeof globalThis<"u"?globalThis:o||self,i(o.UniverSheetsThreadCommentFacade={},o.UniverCore,o.UniverSheetsFacade,o.UniverSheetsThreadComment,o.UniverThreadComment,o.UniverEngineFormula,o.rxjs))})(this,function(o,i,h,u,d,I,g){"use strict";var l=Object.defineProperty,f=Object.getOwnPropertyDescriptor,v=(a,t,e,n)=>{for(var r=n>1?void 0:n?f(t,e):t,m=a.length-1,s;m>=0;m--)(s=a[m])&&(r=(n?s(t,e,r):s(r))||r);return n&&r&&l(t,e,r),r},c=(a,t)=>(e,n)=>t(e,n,a);o.FThreadComment=class{constructor(t,e,n,r,m,s){this._thread=t,this._parent=e,this._injector=n,this._commandService=r,this._univerInstanceService=m,this._threadCommentModel=s}_getRef(){var n;const t=((n=this._parent)==null?void 0:n.ref)||this._thread.ref;return I.deserializeRangeWithSheet(t).range}getIsRoot(){return!this._parent}getCommentData(){const{children:t,...e}=this._thread;return e}getReplies(){var n;const t=this._getRef(),e=this._threadCommentModel.getCommentWithChildren(this._thread.unitId,this._thread.subUnitId,t.startRow,t.startColumn);return(n=e==null?void 0:e.children)==null?void 0:n.map(r=>this._injector.createInstance(o.FThreadComment,r))}getRange(){const t=this._univerInstanceService.getUnit(this._thread.unitId,i.UniverInstanceType.UNIVER_SHEET);if(!t)return null;const e=t.getSheetBySheetId(this._thread.subUnitId);if(!e)return null;const n=this._getRef();return this._injector.createInstance(h.FRange,t,e,n)}getContent(){return this._thread.text}delete(){return this._commandService.executeCommand(this.getIsRoot()?d.DeleteCommentTreeCommand.id:d.DeleteCommentCommand.id,{commentId:this._thread.id,unitId:this._thread.unitId,subUnitId:this._thread.subUnitId})}async update(t){const e=d.getDT();return await this._commandService.executeCommand(d.UpdateCommentCommand.id,{unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,payload:{commentId:this._thread.id,text:t,updated:!0,updateT:e}})}resolve(t){return this._commandService.executeCommand(d.ResolveCommentCommand.id,{unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,commentId:this._thread.id,resolved:t!=null?t:!this._thread.resolved})}},o.FThreadComment=v([c(2,i.Inject(i.Injector)),c(3,i.ICommandService),c(4,i.IUniverInstanceService),c(5,i.Inject(u.SheetsThreadCommentModel))],o.FThreadComment);class p extends h.FRange{getComment(){const e=this._injector.get(u.SheetsThreadCommentModel),n=this._workbook.getUnitId(),r=this._worksheet.getSheetId(),m=e.getByLocation(n,r,this._range.startRow,this._range.startColumn);if(!m)return null;const s=e.getComment(n,r,m);return s?this._injector.createInstance(o.FThreadComment,s):null}addComment(t){var C;const e=this._injector,n=(C=this.getComment())==null?void 0:C.getCommentData(),r=e.get(i.ICommandService),m=e.get(i.UserManagerService),s=this._workbook.getUnitId(),_=this._worksheet.getSheetId(),b=`${i.Tools.chatAtABC(this._range.startColumn)}${this._range.startRow+1}`,j=m.getCurrentUser();return r.executeCommand(d.AddCommentCommand.id,{unitId:s,subUnitId:_,comment:{text:t,attachments:[],dT:d.getDT(),id:i.Tools.generateRandomId(),ref:b,personId:j.userID,parentId:n==null?void 0:n.id,unitId:s,subUnitId:_,threadId:n==null?void 0:n.threadId}})}clearComment(){var s;const t=this._injector,e=(s=this.getComment())==null?void 0:s.getCommentData(),n=t.get(i.ICommandService),r=this._workbook.getUnitId(),m=this._worksheet.getSheetId();return e?n.executeCommand(d.DeleteCommentTreeCommand.id,{unitId:r,subUnitId:m,threadId:e.threadId,commentId:e.id}):Promise.resolve(!0)}}h.FRange.extend(p);class U extends h.FWorkbook{_initialize(){Object.defineProperty(this,"_threadCommentModel",{get(){return this._injector.get(d.ThreadCommentModel)}})}onThreadCommentChange(t){return i.toDisposable(this._threadCommentModel.commentUpdate$.pipe(g.filter(e=>e.unitId===this._workbook.getUnitId())).subscribe(t))}onBeforeAddThreadComment(t){return i.toDisposable(this._commandService.beforeCommandExecuted((e,n)=>{const r=e.params;if(e.id===d.AddCommentCommand.id){if(r.unitId!==this._workbook.getUnitId())return;if(t(r,n)===!1)throw new Error("Command is stopped by the hook onBeforeAddThreadComment")}}))}onBeforeUpdateThreadComment(t){return i.toDisposable(this._commandService.beforeCommandExecuted((e,n)=>{const r=e.params;if(e.id===d.UpdateCommentCommand.id){if(r.unitId!==this._workbook.getUnitId())return;if(t(r,n)===!1)throw new Error("Command is stopped by the hook onBeforeUpdateThreadComment")}}))}onBeforeDeleteThreadComment(t){return i.toDisposable(this._commandService.beforeCommandExecuted((e,n)=>{const r=e.params;if(e.id===d.DeleteCommentCommand.id||e.id===d.DeleteCommentTreeCommand.id){if(r.unitId!==this._workbook.getUnitId())return;if(t(r,n)===!1)throw new Error("Command is stopped by the hook onBeforeDeleteThreadComment")}}))}}h.FWorkbook.extend(U);class T extends h.FWorksheet{getComments(){return this._injector.get(u.SheetsThreadCommentModel).getSubUnitAll(this._workbook.getUnitId(),this._worksheet.getSheetId()).map(n=>this._injector.createInstance(o.FThreadComment,n))}}h.FWorksheet.extend(T),Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
10
+ (function(o,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@univerjs/core"),require("@univerjs/sheets-thread-comment"),require("@univerjs/sheets/facade"),require("@univerjs/thread-comment"),require("@univerjs/engine-formula"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets-thread-comment","@univerjs/sheets/facade","@univerjs/thread-comment","@univerjs/engine-formula","rxjs"],i):(o=typeof globalThis<"u"?globalThis:o||self,i(o.UniverSheetsThreadCommentFacade={},o.UniverCore,o.UniverSheetsThreadComment,o.UniverSheetsFacade,o.UniverThreadComment,o.UniverEngineFormula,o.rxjs))})(this,function(o,i,u,h,s,I,g){"use strict";var l=Object.defineProperty,v=Object.getOwnPropertyDescriptor,f=(a,t,e,n)=>{for(var r=n>1?void 0:n?v(t,e):t,m=a.length-1,d;m>=0;m--)(d=a[m])&&(r=(n?d(t,e,r):d(r))||r);return n&&r&&l(t,e,r),r},c=(a,t)=>(e,n)=>t(e,n,a);o.FThreadComment=class{constructor(t,e,n,r,m,d){this._thread=t,this._parent=e,this._injector=n,this._commandService=r,this._univerInstanceService=m,this._threadCommentModel=d}_getRef(){var n;const t=((n=this._parent)==null?void 0:n.ref)||this._thread.ref;return I.deserializeRangeWithSheet(t).range}getIsRoot(){return!this._parent}getCommentData(){const{children:t,...e}=this._thread;return e}getReplies(){var n;const t=this._getRef(),e=this._threadCommentModel.getCommentWithChildren(this._thread.unitId,this._thread.subUnitId,t.startRow,t.startColumn);return(n=e==null?void 0:e.children)==null?void 0:n.map(r=>this._injector.createInstance(o.FThreadComment,r))}getRange(){const t=this._univerInstanceService.getUnit(this._thread.unitId,i.UniverInstanceType.UNIVER_SHEET);if(!t)return null;const e=t.getSheetBySheetId(this._thread.subUnitId);if(!e)return null;const n=this._getRef();return this._injector.createInstance(h.FRange,t,e,n)}getContent(){return this._thread.text}delete(){return this._commandService.executeCommand(this.getIsRoot()?s.DeleteCommentTreeCommand.id:s.DeleteCommentCommand.id,{commentId:this._thread.id,unitId:this._thread.unitId,subUnitId:this._thread.subUnitId})}async update(t){const e=s.getDT();return await this._commandService.executeCommand(s.UpdateCommentCommand.id,{unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,payload:{commentId:this._thread.id,text:t,updated:!0,updateT:e}})}resolve(t){return this._commandService.executeCommand(s.ResolveCommentCommand.id,{unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,commentId:this._thread.id,resolved:t!=null?t:!this._thread.resolved})}},o.FThreadComment=f([c(2,i.Inject(i.Injector)),c(3,i.ICommandService),c(4,i.IUniverInstanceService),c(5,i.Inject(u.SheetsThreadCommentModel))],o.FThreadComment);class p extends h.FRange{getComment(){const e=this._injector.get(u.SheetsThreadCommentModel),n=this._workbook.getUnitId(),r=this._worksheet.getSheetId(),m=e.getByLocation(n,r,this._range.startRow,this._range.startColumn);if(!m)return null;const d=e.getComment(n,r,m);return d?this._injector.createInstance(o.FThreadComment,d):null}addComment(t){var _;const e=this._injector,n=(_=this.getComment())==null?void 0:_.getCommentData(),r=e.get(i.ICommandService),m=e.get(i.UserManagerService),d=this._workbook.getUnitId(),C=this._worksheet.getSheetId(),T=`${i.Tools.chatAtABC(this._range.startColumn)}${this._range.startRow+1}`,b=m.getCurrentUser();return r.executeCommand(s.AddCommentCommand.id,{unitId:d,subUnitId:C,comment:{text:t,attachments:[],dT:s.getDT(),id:i.Tools.generateRandomId(),ref:T,personId:b.userID,parentId:n==null?void 0:n.id,unitId:d,subUnitId:C,threadId:n==null?void 0:n.threadId}})}clearComment(){var d;const t=this._injector,e=(d=this.getComment())==null?void 0:d.getCommentData(),n=t.get(i.ICommandService),r=this._workbook.getUnitId(),m=this._worksheet.getSheetId();return e?n.executeCommand(s.DeleteCommentTreeCommand.id,{unitId:r,subUnitId:m,threadId:e.threadId,commentId:e.id}):Promise.resolve(!0)}}h.FRange.extend(p);class S extends h.FWorkbook{_initialize(){Object.defineProperty(this,"_threadCommentModel",{get(){return this._injector.get(s.ThreadCommentModel)}})}onThreadCommentChange(t){return i.toDisposable(this._threadCommentModel.commentUpdate$.pipe(g.filter(e=>e.unitId===this._workbook.getUnitId())).subscribe(t))}onBeforeAddThreadComment(t){return i.toDisposable(this._commandService.beforeCommandExecuted((e,n)=>{const r=e.params;if(e.id===s.AddCommentCommand.id){if(r.unitId!==this._workbook.getUnitId())return;if(t(r,n)===!1)throw new Error("Command is stopped by the hook onBeforeAddThreadComment")}}))}onBeforeUpdateThreadComment(t){return i.toDisposable(this._commandService.beforeCommandExecuted((e,n)=>{const r=e.params;if(e.id===s.UpdateCommentCommand.id){if(r.unitId!==this._workbook.getUnitId())return;if(t(r,n)===!1)throw new Error("Command is stopped by the hook onBeforeUpdateThreadComment")}}))}onBeforeDeleteThreadComment(t){return i.toDisposable(this._commandService.beforeCommandExecuted((e,n)=>{const r=e.params;if(e.id===s.DeleteCommentCommand.id||e.id===s.DeleteCommentTreeCommand.id){if(r.unitId!==this._workbook.getUnitId())return;if(t(r,n)===!1)throw new Error("Command is stopped by the hook onBeforeDeleteThreadComment")}}))}}h.FWorkbook.extend(S);class U extends h.FWorksheet{getComments(){return this._injector.get(u.SheetsThreadCommentModel).getSubUnitAll(this._workbook.getUnitId(),this._worksheet.getSheetId()).map(n=>this._injector.createInstance(o.FThreadComment,n))}onCommented(t){return this._injector.get(i.ICommandService).onCommandExecuted(n=>{if(n.id===s.AddCommentCommand.id){const r=n.params;t(r)}})}}h.FWorksheet.extend(U),Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
7
11
 
8
12
 
9
13
  // @univerjs/thread-comment-ui/index
10
- (function(c,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("@univerjs/core"),require("@univerjs/thread-comment"),require("@univerjs/ui"),require("rxjs"),require("react"),require("@univerjs/design"),require("@univerjs/docs"),require("@univerjs/docs-ui"),require("@univerjs/engine-render")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/thread-comment","@univerjs/ui","rxjs","react","@univerjs/design","@univerjs/docs","@univerjs/docs-ui","@univerjs/engine-render"],o):(c=typeof globalThis<"u"?globalThis:c||self,o(c.UniverThreadCommentUi={},c.UniverCore,c.UniverThreadComment,c.UniverUi,c.rxjs,c.React,c.UniverDesign,c.UniverDocs,c.UniverDocsUi,c.UniverEngineRender))})(this,function(c,o,_,k,re,h,E,Re,Oe,Me){"use strict";var st=Object.defineProperty;var dt=(c,o,_)=>o in c?st(c,o,{enumerable:!0,configurable:!0,writable:!0,value:_}):c[o]=_;var G=(c,o,_)=>dt(c,typeof o!="symbol"?o+"":o,_);var we=Object.defineProperty,De=Object.getOwnPropertyDescriptor,He=(n,e,t,r)=>{for(var i=r>1?void 0:r?De(e,t):e,s=n.length-1,l;s>=0;s--)(l=n[s])&&(i=(r?l(e,t,i):l(i))||i);return r&&i&&we(e,t,i),i},ce=(n,e)=>(t,r)=>e(t,r,n);c.ThreadCommentPanelService=class extends o.Disposable{constructor(t,r){super();G(this,"_panelVisible",!1);G(this,"_panelVisible$",new re.BehaviorSubject(!1));G(this,"_activeCommentId");G(this,"_activeCommentId$",new re.BehaviorSubject(void 0));G(this,"panelVisible$",this._panelVisible$.asObservable());G(this,"activeCommentId$",this._activeCommentId$.asObservable());this._sidebarService=t,this._univerInstanceService=r,this._init(),this.disposeWithMe(()=>{this._activeCommentId$.complete(),this._panelVisible$.complete()})}_init(){this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(t=>{t.visible||this.setPanelVisible(!1)})),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(o.UniverInstanceType.UNIVER_SHEET).pipe(re.filter(t=>!t)).subscribe(()=>{this._sidebarService.close()}))}get panelVisible(){return this._panelVisible}get activeCommentId(){return this._activeCommentId}setPanelVisible(t){this._panelVisible=t,this._panelVisible$.next(t)}setActiveComment(t){this._activeCommentId=t,this._activeCommentId$.next(t)}},c.ThreadCommentPanelService=He([ce(0,o.Inject(k.ISidebarService)),ce(1,o.IUniverInstanceService)],c.ThreadCommentPanelService);const he="thread-comment-panel",Ae="UNIVER_THREAD_COMMENT_UI_PLUGIN",ue={id:"thread-comment-ui.operation.toggle-panel",type:o.CommandType.OPERATION,handler(n){const e=n.get(k.ISidebarService),t=n.get(c.ThreadCommentPanelService);return t.panelVisible?(e.close(),t.setPanelVisible(!1)):(e.open({header:{title:"threadCommentUI.panel.title"},children:{label:he},width:330}),t.setPanelVisible(!0)),!0}},W={id:"thread-comment-ui.operation.set-active-comment",type:o.CommandType.OPERATION,handler(n,e){return n.get(c.ThreadCommentPanelService).setActiveComment(e),!0}},Le="thread-comment-ui.config",ke={};var ve=Object.defineProperty,Ve=Object.getOwnPropertyDescriptor,Be=(n,e,t)=>e in n?ve(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Fe=(n,e,t,r)=>{for(var i=r>1?void 0:r?Ve(e,t):e,s=n.length-1,l;s>=0;s--)(l=n[s])&&(i=(r?l(e,t,i):l(i))||i);return r&&i&&ve(e,t,i),i},le=(n,e)=>(t,r)=>e(t,r,n),Ce=(n,e,t)=>Be(n,typeof e!="symbol"?e+"":e,t);c.UniverThreadCommentUIPlugin=class extends o.Plugin{constructor(e=ke,t,r,i){super(),this._config=e,this._injector=t,this._commandService=r,this._configService=i;const{menu:s,...l}=this._config;s&&this._configService.setConfig("menu",s,{merge:!0}),this._configService.setConfig(Le,l)}onStarting(){var e;o.mergeOverrideWithDependencies([[c.ThreadCommentPanelService]],(e=this._config)==null?void 0:e.overrides).forEach(t=>{this._injector.add(t)}),[ue,W].forEach(t=>{this._commandService.registerCommand(t)})}},Ce(c.UniverThreadCommentUIPlugin,"pluginName",Ae),Ce(c.UniverThreadCommentUIPlugin,"type",o.UniverInstanceType.UNIVER_UNKNOWN),c.UniverThreadCommentUIPlugin=Fe([o.DependentOn(_.UniverThreadCommentPlugin),le(1,o.Inject(o.Injector)),le(2,o.ICommandService),le(3,o.IConfigService)],c.UniverThreadCommentUIPlugin);var me={exports:{}},Y={};/**
14
+ (function(c,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("@univerjs/core"),require("@univerjs/thread-comment"),require("@univerjs/ui"),require("rxjs"),require("react"),require("@univerjs/design"),require("@univerjs/docs"),require("@univerjs/docs-ui"),require("@univerjs/engine-render")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/thread-comment","@univerjs/ui","rxjs","react","@univerjs/design","@univerjs/docs","@univerjs/docs-ui","@univerjs/engine-render"],o):(c=typeof globalThis<"u"?globalThis:c||self,o(c.UniverThreadCommentUi={},c.UniverCore,c.UniverThreadComment,c.UniverUi,c.rxjs,c.React,c.UniverDesign,c.UniverDocs,c.UniverDocsUi,c.UniverEngineRender))})(this,function(c,o,_,k,re,h,E,Oe,Me,we){"use strict";var st=Object.defineProperty;var dt=(c,o,_)=>o in c?st(c,o,{enumerable:!0,configurable:!0,writable:!0,value:_}):c[o]=_;var G=(c,o,_)=>dt(c,typeof o!="symbol"?o+"":o,_);var De=Object.defineProperty,He=Object.getOwnPropertyDescriptor,Ae=(n,e,t,r)=>{for(var i=r>1?void 0:r?He(e,t):e,s=n.length-1,l;s>=0;s--)(l=n[s])&&(i=(r?l(e,t,i):l(i))||i);return r&&i&&De(e,t,i),i},ce=(n,e)=>(t,r)=>e(t,r,n);c.ThreadCommentPanelService=class extends o.Disposable{constructor(t,r){super();G(this,"_panelVisible",!1);G(this,"_panelVisible$",new re.BehaviorSubject(!1));G(this,"_activeCommentId");G(this,"_activeCommentId$",new re.BehaviorSubject(void 0));G(this,"panelVisible$",this._panelVisible$.asObservable());G(this,"activeCommentId$",this._activeCommentId$.asObservable());this._sidebarService=t,this._univerInstanceService=r,this._init(),this.disposeWithMe(()=>{this._activeCommentId$.complete(),this._panelVisible$.complete()})}_init(){this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(t=>{t.visible||this.setPanelVisible(!1)})),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(o.UniverInstanceType.UNIVER_SHEET).pipe(re.filter(t=>!t)).subscribe(()=>{this._sidebarService.close()}))}get panelVisible(){return this._panelVisible}get activeCommentId(){return this._activeCommentId}setPanelVisible(t){this._panelVisible=t,this._panelVisible$.next(t)}setActiveComment(t){this._activeCommentId=t,this._activeCommentId$.next(t)}},c.ThreadCommentPanelService=Ae([ce(0,o.Inject(k.ISidebarService)),ce(1,o.IUniverInstanceService)],c.ThreadCommentPanelService);const he="thread-comment-panel",Le="UNIVER_THREAD_COMMENT_UI_PLUGIN",ue={id:"thread-comment-ui.operation.toggle-panel",type:o.CommandType.OPERATION,handler(n){const e=n.get(k.ISidebarService),t=n.get(c.ThreadCommentPanelService);return t.panelVisible?(e.close(),t.setPanelVisible(!1)):(e.open({header:{title:"threadCommentUI.panel.title"},children:{label:he},width:330}),t.setPanelVisible(!0)),!0}},W={id:"thread-comment-ui.operation.set-active-comment",type:o.CommandType.OPERATION,handler(n,e){return n.get(c.ThreadCommentPanelService).setActiveComment(e),!0}},ke="thread-comment-ui.config",ve={};var Ce=Object.defineProperty,Ve=Object.getOwnPropertyDescriptor,Be=(n,e,t)=>e in n?Ce(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Fe=(n,e,t,r)=>{for(var i=r>1?void 0:r?Ve(e,t):e,s=n.length-1,l;s>=0;s--)(l=n[s])&&(i=(r?l(e,t,i):l(i))||i);return r&&i&&Ce(e,t,i),i},le=(n,e)=>(t,r)=>e(t,r,n),fe=(n,e,t)=>Be(n,typeof e!="symbol"?e+"":e,t);c.UniverThreadCommentUIPlugin=class extends o.Plugin{constructor(e=ve,t,r,i){super(),this._config=e,this._injector=t,this._commandService=r,this._configService=i;const{menu:s,...l}=o.merge({},ve,this._config);s&&this._configService.setConfig("menu",s,{merge:!0}),this._configService.setConfig(ke,l)}onStarting(){var e;o.mergeOverrideWithDependencies([[c.ThreadCommentPanelService]],(e=this._config)==null?void 0:e.overrides).forEach(t=>{this._injector.add(t)}),[ue,W].forEach(t=>{this._commandService.registerCommand(t)})}},fe(c.UniverThreadCommentUIPlugin,"pluginName",Le),fe(c.UniverThreadCommentUIPlugin,"type",o.UniverInstanceType.UNIVER_UNKNOWN),c.UniverThreadCommentUIPlugin=Fe([o.DependentOn(_.UniverThreadCommentPlugin),le(1,o.Inject(o.Injector)),le(2,o.ICommandService),le(3,o.IConfigService)],c.UniverThreadCommentUIPlugin);var me={exports:{}},Y={};/**
11
15
  * @license React
12
16
  * react-jsx-runtime.production.min.js
13
17
  *
@@ -15,13 +19,13 @@
15
19
  *
16
20
  * This source code is licensed under the MIT license found in the
17
21
  * LICENSE file in the root directory of this source tree.
18
- */var fe;function We(){if(fe)return Y;fe=1;var n=h,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function l(C,u,U){var f,p={},I=null,T=null;U!==void 0&&(I=""+U),u.key!==void 0&&(I=""+u.key),u.ref!==void 0&&(T=u.ref);for(f in u)r.call(u,f)&&!s.hasOwnProperty(f)&&(p[f]=u[f]);if(C&&C.defaultProps)for(f in u=C.defaultProps,u)p[f]===void 0&&(p[f]=u[f]);return{$$typeof:e,type:C,key:I,ref:T,props:p,_owner:i.current}}return Y.Fragment=t,Y.jsx=l,Y.jsxs=l,Y}var pe;function ze(){return pe||(pe=1,me.exports=We()),me.exports}var a=ze(),M=function(){return M=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i])}return n},M.apply(this,arguments)},Ze=function(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(n);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(n,r[i])&&(t[r[i]]=n[r[i]]);return t},z=h.forwardRef(function(n,e){var t=n.icon,r=n.id,i=n.className,s=n.extend,l=Ze(n,["icon","id","className","extend"]),C="univerjs-icon univerjs-icon-".concat(r," ").concat(i||"").trim(),u=h.useRef("_".concat(Ke()));return ge(t,"".concat(r),{defIds:t.defIds,idSuffix:u.current},M({ref:e,className:C},l),s)});function ge(n,e,t,r,i){return h.createElement(n.tag,M(M({key:e},Je(n,t,i)),r),(Ge(n,t).children||[]).map(function(s,l){return ge(s,"".concat(e,"-").concat(n.tag,"-").concat(l),t,void 0,i)}))}function Je(n,e,t){var r=M({},n.attrs);t!=null&&t.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=t.colorChannel1);var i=e.defIds;return!i||i.length===0||(n.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+e.idSuffix),Object.entries(r).forEach(function(s){var l=s[0],C=s[1];typeof C=="string"&&(r[l]=C.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),r}function Ge(n,e){var t,r=e.defIds;return!r||r.length===0?n:n.tag==="defs"&&(!((t=n.children)===null||t===void 0)&&t.length)?M(M({},n),{children:n.children.map(function(i){return typeof i.attrs.id=="string"&&r&&r.indexOf(i.attrs.id)>-1?M(M({},i),{attrs:M(M({},i.attrs),{id:i.attrs.id+e.idSuffix})}):i})}):n}function Ke(){return Math.random().toString(36).substring(2,8)}z.displayName="UniverIcon";var Ye={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.3313 1.4667C5.3313 1.13533 5.59993.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443 14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443zM6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928 9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171 10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778 9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539 9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263 6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539 5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778 6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171z"}},{tag:"path",attrs:{fill:"currentColor",d:"M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Ie=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"delete-single",ref:e,icon:Ye}))});Ie.displayName="DeleteSingle";var Qe={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z"}}]},xe=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"increase-single",ref:e,icon:Qe}))});xe.displayName="IncreaseSingle";var Xe={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3 9C3.55228 9 4 8.55228 4 8 4 7.44772 3.55228 7 3 7 2.44772 7 2 7.44772 2 8 2 8.55228 2.44772 9 3 9zM8 9C8.55228 9 9 8.55228 9 8 9 7.44772 8.55228 7 8 7 7.44772 7 7 7.44772 7 8 7 8.55228 7.44772 9 8 9zM13 9C13.5523 9 14 8.55228 14 8 14 7.44772 13.5523 7 13 7 12.4477 7 12 7.44772 12 8 12 8.55228 12.4477 9 13 9z"}}]},Se=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"more-horizontal-single",ref:e,icon:Xe}))});Se.displayName="MoreHorizontalSingle";var qe={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{stroke:"currentColor",d:"M7.48389 10.3267V12.1905C7.48389 12.7428 7.9316 13.1905 8.48389 13.1905H11.2216L12.2955 14.2644L13.3695 13.1905H14.1593C14.7116 13.1905 15.1593 12.7428 15.1593 12.1905V8.46289C15.1593 7.91061 14.7116 7.46289 14.1593 7.46289H12.2955",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M0.840332 3.73535C0.840332 2.63078 1.73576 1.73535 2.84033 1.73535H10.2955C11.4001 1.73535 12.2955 2.63078 12.2955 3.73535V8.32676C12.2955 9.43132 11.4001 10.3268 10.2955 10.3268H5.6014L4.1695 11.7587L3.05978 10.3268H2.84033C1.73576 10.3268 0.840332 9.43133 0.840332 8.32676V3.73535Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M6.41016 6.1311H6.76813M8.91626 6.1311H9.27424M3.90454 6.1311H4.26252",strokeLinecap:"round",strokeWidth:1.2}}]},ye=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"reply-to-comment-single",ref:e,icon:qe}))});ye.displayName="ReplyToCommentSingle";var $e={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6106 15.4036C12.4766 15.4036 15.6106 12.2696 15.6106 8.40356C15.6106 4.53757 12.4766 1.40356 8.6106 1.40356C4.7446 1.40356 1.6106 4.53757 1.6106 8.40356C1.6106 12.2696 4.7446 15.4036 8.6106 15.4036ZM12.3351 6.82773C12.5694 6.59342 12.5694 6.21352 12.3351 5.9792C12.1007 5.74489 11.7208 5.74489 11.4865 5.9792L7.91079 9.55494L6.33506 7.9792C6.10074 7.74489 5.72084 7.74489 5.48653 7.9792C5.25221 8.21352 5.25221 8.59342 5.48653 8.82773L7.48653 10.8277C7.72084 11.062 8.10074 11.062 8.33506 10.8277L12.3351 6.82773Z",fillRule:"evenodd",clipRule:"evenodd"}}]},be=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"resolved-single",ref:e,icon:$e}))});be.displayName="ResolvedSingle";var et={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"circle",attrs:{cx:8.73,cy:8.4,r:6.4,stroke:"currentColor",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M6.02637 8.40356L8.02637 10.4036L12.0264 6.40356",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}}]},Te=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"solve-single",ref:e,icon:et}))});Te.displayName="SolveSingle";function _e(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var i=n.length;for(e=0;e<i;e++)n[e]&&(t=_e(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function tt(){for(var n,e,t=0,r="",i=arguments.length;t<i;t++)(n=arguments[t])&&(e=_e(n))&&(r&&(r+=" "),r+=e);return r}const ie={threadCommentEditorButtons:"univer-thread-comment-editor-buttons",threadCommentEditorSuggestion:"univer-thread-comment-editor-suggestion",threadCommentEditorSuggestionActive:"univer-thread-comment-editor-suggestionActive",threadCommentEditorSuggestionIcon:"univer-thread-comment-editor-suggestion-icon"},nt=n=>{const e=/@\[(.*?)\]\((.*?)\)|(\w+)/g;let t,r=0;const i=[];for(;(t=e.exec(n))!==null;)t.index>r&&i.push({type:"text",content:n.substring(r,t.index)}),t[1]&&t[2]?i.push({type:"mention",content:{label:t[1],id:t[2]}}):t[3]&&i.push({type:"text",content:t[3]}),r=e.lastIndex;return r<n.length&&i.push({type:"text",content:n.substring(r)}),i},rt=n=>n.map(e=>{switch(e.type){case"mention":return`@[${e.content.label}](${e.content.id})`;default:return e.content}}).join(""),je=n=>{const{dataStream:e,customRanges:t}=n,r=e.length-2,i=[];let s=0;return t==null||t.forEach(l=>{s<l.startIndex&&i.push({type:"text",content:e.slice(s,l.startIndex)}),i.push({type:"mention",content:{label:e.slice(l.startIndex,l.endIndex).slice(1,-1),id:l.rangeId}}),s=l.endIndex}),i.push({type:"text",content:e.slice(s,r)}),i},Ue=n=>{let e="";const t=[];return n.forEach(r=>{switch(r.type){case"text":e+=r.content;break;case"mention":{const i=e.length;e+=`${r.content.label}`;const s=e.length;t.push({rangeId:r.content.id,rangeType:o.CustomRangeType.MENTION,startIndex:i,endIndex:s,properties:{}});break}}}),e+=`
19
- \r`,{textRuns:[],paragraphs:[{startIndex:e.length-2,paragraphStyle:{}}],sectionBreaks:[{startIndex:e.length-1}],dataStream:e,customRanges:t}},it=(n,e,t,r,i)=>{var l,C;const s=(l=n.raw)==null?void 0:l.icon;return a.jsxs("div",{className:ie.threadCommentEditorSuggestion,children:[s?a.jsx("img",{className:ie.threadCommentEditorSuggestionIcon,src:s}):null,a.jsx("div",{children:(C=n.display)!=null?C:n.id})]})},Pe=h.forwardRef((n,e)=>{var V;const{comment:t,onSave:r,id:i,onCancel:s,autoFocus:l,unitId:C}=n,u=o.useDependency(o.IMentionIOService),U=o.useDependency(o.ICommandService),f=o.useDependency(o.LocaleService),[p,I]=h.useState({...t}),[T,x]=h.useState(!1),y=h.useRef(null),D=o.useDependency(Re.DocSelectionManagerService),N=(V=o.useDependency(Me.IRenderManagerService).getCurrentTypeOfRenderer(o.UniverInstanceType.UNIVER_DOC))==null?void 0:V.with(Oe.DocSelectionRenderService);h.useImperativeHandle(e,()=>({reply(v){var b;I({...t,text:v,attachments:[]}),(b=y.current)==null||b.inputElement.focus()}}));const S=()=>{var v;p.text&&(r==null||r({...p,text:p.text}),x(!1),I({text:void 0}),(v=y.current)==null||v.inputElement.blur())};return a.jsxs("div",{className:ie.threadCommentEditor,onClick:v=>v.preventDefault(),children:[a.jsx(E.Mentions,{ref:y,autoFocus:l,style:{width:"100%"},placeholder:f.t("threadCommentUI.editor.placeholder"),value:p!=null&&p.text?rt(je(p.text)):"",onChange:v=>{v.target.value||I({...t,text:void 0}),I==null||I({...t,text:Ue(nt(v.target.value))})},onFocus:()=>{const v=D.getActiveTextRange();v&&v.collapsed&&(N==null||N.removeAllRanges()),N==null||N.blur(),x(!0)},children:a.jsx(E.Mention,{trigger:"@",data:(v,b)=>u.list({search:v,unitId:C}).then(m=>m.list.map(H=>H.mentions.map(j=>({id:j.objectId,display:j.label,raw:j}))).flat()).then(b),displayTransform:(v,b)=>`@${b} `,renderSuggestion:it},"@")}),T?a.jsxs("div",{className:ie.threadCommentEditorButtons,children:[a.jsx(E.Button,{style:{marginRight:12},onClick:()=>{s==null||s(),x(!1),I({text:void 0}),U.executeCommand(W.id)},children:f.t("threadCommentUI.editor.cancel")}),a.jsx(E.Button,{type:"primary",disabled:!p.text,onClick:S,children:f.t(i?"threadCommentUI.editor.save":"threadCommentUI.editor.reply")})]}):null]})}),g={threadComment:"univer-thread-comment",threadCommentActive:"univer-thread-comment-active",threadCommentContent:"univer-thread-comment-content",threadCommentHighlight:"univer-thread-comment-highlight",threadCommentIconContainer:"univer-thread-comment-icon-container",threadCommentIcon:"univer-thread-comment-icon",threadCommentTitle:"univer-thread-comment-title",threadCommentTitlePosition:"univer-thread-comment-title-position",threadCommentTitleHighlight:"univer-thread-comment-title-highlight",threadCommentTitlePositionText:"univer-thread-comment-title-position-text",threadCommentUsername:"univer-thread-comment-username",threadCommentItem:"univer-thread-comment-item",threadCommentItemHead:"univer-thread-comment-item-head",threadCommentItemTitle:"univer-thread-comment-item-title",threadCommentItemTitlePosition:"univer-thread-comment-item-title-position",threadCommentItemTitleHighlight:"univer-thread-comment-item-title-highlight",threadCommentItemTime:"univer-thread-comment-item-time",threadCommentItemContent:"univer-thread-comment-item-content",threadCommentItemAt:"univer-thread-comment-item-at"},Ee="__mock__",ot=n=>{const{item:e,unitId:t,subUnitId:r,editing:i,onEditingChange:s,onReply:l,resolved:C,isRoot:u,onClose:U,onDeleteComment:f}=n,p=o.useDependency(o.ICommandService),I=o.useDependency(o.LocaleService),T=o.useDependency(o.UserManagerService),x=T.getUser(e.personId),y=k.useObservable(T.currentUser$),D=(y==null?void 0:y.userID)===e.personId,P=e.id===Ee,[N,S]=h.useState(!1),V=()=>{(f==null?void 0:f(e))!==!1&&(p.executeCommand(u?_.DeleteCommentTreeCommand.id:_.DeleteCommentCommand.id,{unitId:t,subUnitId:r,commentId:e.id}),u&&(U==null||U()))};return a.jsxs("div",{className:g.threadCommentItem,onMouseLeave:()=>S(!1),onMouseEnter:()=>S(!0),children:[a.jsx("img",{className:g.threadCommentItemHead,src:x==null?void 0:x.avatar}),a.jsxs("div",{className:g.threadCommentItemTitle,children:[a.jsx("div",{className:g.threadCommentUsername,children:(x==null?void 0:x.name)||" "}),a.jsxs("div",{children:[P||C?null:N?a.jsx("div",{className:g.threadCommentIcon,onClick:()=>l(x),children:a.jsx(ye,{})}):null,D&&!P&&!C?a.jsx(E.Dropdown,{overlay:a.jsxs(E.Menu,{children:[a.jsx(E.MenuItem,{onClick:()=>s==null?void 0:s(!0),children:I.t("threadCommentUI.item.edit")},"edit"),a.jsx(E.MenuItem,{onClick:V,children:I.t("threadCommentUI.item.delete")},"delete")]}),children:a.jsx("div",{className:g.threadCommentIcon,children:a.jsx(Se,{})})}):null]})]}),a.jsx("div",{className:g.threadCommentItemTime,children:e.dT}),i?a.jsx(Pe,{id:e.id,comment:e,onCancel:()=>s==null?void 0:s(!1),autoFocus:!0,unitId:t,subUnitId:r,onSave:({text:v,attachments:b})=>{s==null||s(!1),p.executeCommand(_.UpdateCommentCommand.id,{unitId:t,subUnitId:r,payload:{commentId:e.id,text:v,attachments:b}})}}):a.jsx("div",{className:g.threadCommentItemContent,children:je(e.text).map((v,b)=>{switch(v.type){case"mention":return a.jsxs("a",{className:g.threadCommentItemAt,children:["@",v.content.label," "]},b);default:return v.content}})})]})},Ne=n=>{var ae,ee,te;const{id:e,unitId:t,subUnitId:r,refStr:i,showEdit:s=!0,onClick:l,showHighlight:C,onClose:u,getSubUnitName:U,prefix:f,autoFocus:p,onMouseEnter:I,onMouseLeave:T,onAddComment:x,onDeleteComment:y,onResolve:D}=n,P=o.useDependency(_.ThreadCommentModel),[N,S]=h.useState(!1),[V,v]=h.useState(""),b=h.useMemo(()=>P.commentUpdate$.pipe(re.debounceTime(16)),[P]);k.useObservable(b);const m=e?P.getCommentWithChildren(t,r,e):null,H=o.useDependency(o.ICommandService),j=o.useDependency(o.UserManagerService),A=m==null?void 0:m.root.resolved,w=k.useObservable(j.currentUser$),X=h.useRef(null),q=[...m?[m.root]:[{id:Ee,text:{dataStream:`
20
- \r`},personId:(ae=w==null?void 0:w.userID)!=null?ae:"",ref:i!=null?i:"",dT:"",unitId:t,subUnitId:r,threadId:""}],...(ee=m==null?void 0:m.children)!=null?ee:[]],Z=h.useRef(null),B=R=>{R.stopPropagation(),A?H.executeCommand(W.id,{unitId:t,subUnitId:r,commentId:e}):H.executeCommand(W.id),H.executeCommand(_.ResolveCommentCommand.id,{unitId:t,subUnitId:r,commentId:e,resolved:!A}),D==null||D(!A)},$=R=>{R.stopPropagation(),H.executeCommand(W.id),!(m!=null&&m.root&&(y==null?void 0:y(m.root))===!1)&&(H.executeCommand(_.DeleteCommentTreeCommand.id,{unitId:t,subUnitId:r,commentId:e}),u==null||u())};h.useEffect(()=>T==null?void 0:T(),[]);const F=U((te=m==null?void 0:m.root.subUnitId)!=null?te:r),oe=s&&!V&&!A,K=`${i||(m==null?void 0:m.root.ref)||""}${F?" · ":""}${F}`;return a.jsxs("div",{className:tt(g.threadComment,{[g.threadCommentActive]:!A&&(C||N||f==="cell")}),onClick:l,id:`${f}-${t}-${r}-${e}`,onMouseEnter:()=>{I==null||I(),S(!0)},onMouseLeave:()=>{T==null||T(),S(!1)},children:[!A&&C?a.jsx("div",{className:g.threadCommentHighlight}):null,a.jsxs("div",{className:g.threadCommentTitle,children:[a.jsxs("div",{className:g.threadCommentTitlePosition,children:[a.jsx("div",{className:g.threadCommentTitleHighlight}),a.jsx(E.Tooltip,{showIfEllipsis:!0,title:K,children:a.jsx("div",{className:g.threadCommentTitlePositionText,children:K})})]}),m?a.jsxs("div",{className:g.threadCommentIconContainer,children:[a.jsx("div",{onClick:B,className:g.threadCommentIcon,style:{color:A?"rgb(var(--green-500))":""},children:A?a.jsx(be,{}):a.jsx(Te,{})}),(w==null?void 0:w.userID)===m.root.personId?a.jsx("div",{className:g.threadCommentIcon,onClick:$,children:a.jsx(Ie,{})}):null]}):null]}),a.jsx("div",{className:g.threadCommentContent,ref:Z,children:q.map(R=>a.jsx(ot,{onClose:u,unitId:t,subUnitId:r,item:R,isRoot:R.id===(m==null?void 0:m.root.id),editing:V===R.id,resolved:m==null?void 0:m.root.resolved,onEditingChange:L=>{v(L?R.id:"")},onReply:L=>{L&&requestAnimationFrame(()=>{var d;(d=X.current)==null||d.reply(Ue([{type:"mention",content:{id:L.userID,label:L.name}}]))})},onAddComment:x,onDeleteComment:y},R.id))}),oe?a.jsx("div",{children:a.jsx(Pe,{ref:X,unitId:t,subUnitId:r,onSave:async({text:R,attachments:L})=>{const d={text:R,attachments:L,dT:_.getDT(),id:o.generateRandomId(),ref:i,personId:w==null?void 0:w.userID,parentId:m==null?void 0:m.root.id,unitId:t,subUnitId:r,threadId:m==null?void 0:m.root.threadId};(x==null?void 0:x(d))!==!1&&(await H.executeCommand(_.AddCommentCommand.id,{unitId:t,subUnitId:r,comment:d}),Z.current&&(Z.current.scrollTop=Z.current.scrollHeight))},autoFocus:p||!m,onCancel:()=>{m||u==null||u()}},`${p}`)}):null]})},Q={threadCommentPanel:"univer-thread-comment-panel",threadComment:"univer-thread-comment",threadCommentPanelForms:"univer-thread-comment-panel-forms",select:"univer-select",threadCommentPanelEmpty:"univer-thread-comment-panel-empty",threadCommentPanelAdd:"univer-thread-comment-panel-add",threadCommentPanelSolved:"univer-thread-comment-panel-solved"},at=n=>{const{unitId:e,subUnitId$:t,type:r,onAdd:i,getSubUnitName:s,onResolve:l,sortComments:C,onItemLeave:u,onItemEnter:U,disableAdd:f,tempComment:p,onAddComment:I,onDeleteComment:T,showComments:x}=n,[y,D]=h.useState("all"),[P,N]=h.useState("all"),S=o.useDependency(o.LocaleService),V=o.useDependency(o.UserManagerService),v=o.useDependency(_.ThreadCommentModel),[b,m]=h.useState(()=>v.getUnit(e)),H=o.useDependency(c.ThreadCommentPanelService),j=k.useObservable(H.activeCommentId$),A=k.useObservable(v.commentUpdate$),w=o.useDependency(o.ICommandService),X=k.useObservable(t),q=h.useRef(!0),Z="panel",B=k.useObservable(V.currentUser$),$=h.useMemo(()=>{var de;const d=y==="all"?b:(de=b.filter(O=>O.subUnitId===X))!=null?de:[],ne=C!=null?C:O=>O,se=d.map(O=>{var J;return{...O.root,children:(J=O.children)!=null?J:[],users:O.relativeUsers}});if(x){const O=new Map;return se.forEach(J=>{O.set(J.id,J)}),[...x,""].map(J=>O.get(J)).filter(Boolean)}else return ne(se)},[x,y,b,C,X]),F=h.useMemo(()=>[...$.filter(d=>!d.resolved),...$.filter(d=>d.resolved)],[$]),oe=h.useMemo(()=>P==="resolved"?F.filter(d=>d.resolved):P==="unsolved"?F.filter(d=>!d.resolved):P==="concern_me"&&B!=null&&B.userID?F.filter(d=>d==null?void 0:d.users.has(B.userID)):F,[F,B==null?void 0:B.userID,P]),K=p?[p,...oe]:oe,ae=K.filter(d=>!d.resolved),ee=K.filter(d=>d.resolved),te=P!=="all"||y!=="all",R=()=>{N("all"),D("all")};h.useEffect(()=>{e&&m(v.getUnit(e))},[e,v,A]),h.useEffect(()=>{var O;if(!j)return;if(!q.current){q.current=!0;return}const{unitId:d,subUnitId:ne,commentId:se}=j,de=`${Z}-${d}-${ne}-${se}`;(O=document.getElementById(de))==null||O.scrollIntoView({block:"center"})},[j]);const L=d=>a.jsx(Ne,{prefix:Z,getSubUnitName:s,id:d.id,unitId:d.unitId,subUnitId:d.subUnitId,refStr:d.ref,type:r,showEdit:(j==null?void 0:j.commentId)===d.id,showHighlight:(j==null?void 0:j.commentId)===d.id,onClick:()=>{q.current=!1,d.resolved?w.executeCommand(W.id):w.executeCommand(W.id,{unitId:d.unitId,subUnitId:d.subUnitId,commentId:d.id,temp:!1})},onMouseEnter:()=>U==null?void 0:U(d),onMouseLeave:()=>u==null?void 0:u(d),onAddComment:I,onDeleteComment:T,onResolve:ne=>l==null?void 0:l(d.id,ne)},d.id);return a.jsxs("div",{className:Q.threadCommentPanel,children:[a.jsxs("div",{className:Q.threadCommentPanelForms,children:[r===o.UniverInstanceType.UNIVER_SHEET?a.jsx(E.Select,{borderless:!0,value:y,onChange:d=>D(d),options:[{value:"current",label:S.t("threadCommentUI.filter.sheet.current")},{value:"all",label:S.t("threadCommentUI.filter.sheet.all")}]}):null,a.jsx(E.Select,{borderless:!0,value:P,onChange:d=>N(d),options:[{value:"all",label:S.t("threadCommentUI.filter.status.all")},{value:"resolved",label:S.t("threadCommentUI.filter.status.resolved")},{value:"unsolved",label:S.t("threadCommentUI.filter.status.unsolved")},{value:"concern_me",label:S.t("threadCommentUI.filter.status.concernMe")}]})]}),ae.map(L),ee.length?a.jsx("div",{className:Q.threadCommentPanelSolved,children:"已解决"}):null,ee.map(L),K.length?null:a.jsxs("div",{className:Q.threadCommentPanelEmpty,children:[te?S.t("threadCommentUI.panel.filterEmpty"):S.t("threadCommentUI.panel.empty"),te?a.jsx(E.Button,{onClick:R,type:"link",children:S.t("threadCommentUI.panel.reset")}):a.jsxs(E.Button,{id:"thread-comment-add",className:Q.threadCommentPanelAdd,type:"primary",onClick:i,disabled:f,children:[a.jsx(xe,{}),S.t("threadCommentUI.panel.addComment")]})]})]})};c.SetActiveCommentOperation=W,c.THREAD_COMMENT_PANEL=he,c.ThreadCommentPanel=at,c.ThreadCommentTree=Ne,c.ToggleSheetCommentPanelOperation=ue,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
22
+ */var pe;function We(){if(pe)return Y;pe=1;var n=h,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function l(C,u,U){var f,p={},I=null,T=null;U!==void 0&&(I=""+U),u.key!==void 0&&(I=""+u.key),u.ref!==void 0&&(T=u.ref);for(f in u)r.call(u,f)&&!s.hasOwnProperty(f)&&(p[f]=u[f]);if(C&&C.defaultProps)for(f in u=C.defaultProps,u)p[f]===void 0&&(p[f]=u[f]);return{$$typeof:e,type:C,key:I,ref:T,props:p,_owner:i.current}}return Y.Fragment=t,Y.jsx=l,Y.jsxs=l,Y}var ge;function ze(){return ge||(ge=1,me.exports=We()),me.exports}var a=ze(),M=function(){return M=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i])}return n},M.apply(this,arguments)},Ze=function(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(n);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(n,r[i])&&(t[r[i]]=n[r[i]]);return t},z=h.forwardRef(function(n,e){var t=n.icon,r=n.id,i=n.className,s=n.extend,l=Ze(n,["icon","id","className","extend"]),C="univerjs-icon univerjs-icon-".concat(r," ").concat(i||"").trim(),u=h.useRef("_".concat(Ke()));return Ie(t,"".concat(r),{defIds:t.defIds,idSuffix:u.current},M({ref:e,className:C},l),s)});function Ie(n,e,t,r,i){return h.createElement(n.tag,M(M({key:e},Je(n,t,i)),r),(Ge(n,t).children||[]).map(function(s,l){return Ie(s,"".concat(e,"-").concat(n.tag,"-").concat(l),t,void 0,i)}))}function Je(n,e,t){var r=M({},n.attrs);t!=null&&t.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=t.colorChannel1);var i=e.defIds;return!i||i.length===0||(n.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+e.idSuffix),Object.entries(r).forEach(function(s){var l=s[0],C=s[1];typeof C=="string"&&(r[l]=C.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),r}function Ge(n,e){var t,r=e.defIds;return!r||r.length===0?n:n.tag==="defs"&&(!((t=n.children)===null||t===void 0)&&t.length)?M(M({},n),{children:n.children.map(function(i){return typeof i.attrs.id=="string"&&r&&r.indexOf(i.attrs.id)>-1?M(M({},i),{attrs:M(M({},i.attrs),{id:i.attrs.id+e.idSuffix})}):i})}):n}function Ke(){return Math.random().toString(36).substring(2,8)}z.displayName="UniverIcon";var Ye={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.3313 1.4667C5.3313 1.13533 5.59993.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443 14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443zM6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928 9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171 10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778 9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539 9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263 6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539 5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778 6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171z"}},{tag:"path",attrs:{fill:"currentColor",d:"M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z",fillRule:"evenodd",clipRule:"evenodd"}}]},xe=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"delete-single",ref:e,icon:Ye}))});xe.displayName="DeleteSingle";var Qe={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z"}}]},Se=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"increase-single",ref:e,icon:Qe}))});Se.displayName="IncreaseSingle";var Xe={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3 9C3.55228 9 4 8.55228 4 8 4 7.44772 3.55228 7 3 7 2.44772 7 2 7.44772 2 8 2 8.55228 2.44772 9 3 9zM8 9C8.55228 9 9 8.55228 9 8 9 7.44772 8.55228 7 8 7 7.44772 7 7 7.44772 7 8 7 8.55228 7.44772 9 8 9zM13 9C13.5523 9 14 8.55228 14 8 14 7.44772 13.5523 7 13 7 12.4477 7 12 7.44772 12 8 12 8.55228 12.4477 9 13 9z"}}]},ye=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"more-horizontal-single",ref:e,icon:Xe}))});ye.displayName="MoreHorizontalSingle";var qe={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{stroke:"currentColor",d:"M7.48389 10.3267V12.1905C7.48389 12.7428 7.9316 13.1905 8.48389 13.1905H11.2216L12.2955 14.2644L13.3695 13.1905H14.1593C14.7116 13.1905 15.1593 12.7428 15.1593 12.1905V8.46289C15.1593 7.91061 14.7116 7.46289 14.1593 7.46289H12.2955",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M0.840332 3.73535C0.840332 2.63078 1.73576 1.73535 2.84033 1.73535H10.2955C11.4001 1.73535 12.2955 2.63078 12.2955 3.73535V8.32676C12.2955 9.43132 11.4001 10.3268 10.2955 10.3268H5.6014L4.1695 11.7587L3.05978 10.3268H2.84033C1.73576 10.3268 0.840332 9.43133 0.840332 8.32676V3.73535Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M6.41016 6.1311H6.76813M8.91626 6.1311H9.27424M3.90454 6.1311H4.26252",strokeLinecap:"round",strokeWidth:1.2}}]},be=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"reply-to-comment-single",ref:e,icon:qe}))});be.displayName="ReplyToCommentSingle";var $e={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6106 15.4036C12.4766 15.4036 15.6106 12.2696 15.6106 8.40356C15.6106 4.53757 12.4766 1.40356 8.6106 1.40356C4.7446 1.40356 1.6106 4.53757 1.6106 8.40356C1.6106 12.2696 4.7446 15.4036 8.6106 15.4036ZM12.3351 6.82773C12.5694 6.59342 12.5694 6.21352 12.3351 5.9792C12.1007 5.74489 11.7208 5.74489 11.4865 5.9792L7.91079 9.55494L6.33506 7.9792C6.10074 7.74489 5.72084 7.74489 5.48653 7.9792C5.25221 8.21352 5.25221 8.59342 5.48653 8.82773L7.48653 10.8277C7.72084 11.062 8.10074 11.062 8.33506 10.8277L12.3351 6.82773Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Te=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"resolved-single",ref:e,icon:$e}))});Te.displayName="ResolvedSingle";var et={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"circle",attrs:{cx:8.73,cy:8.4,r:6.4,stroke:"currentColor",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M6.02637 8.40356L8.02637 10.4036L12.0264 6.40356",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}}]},_e=h.forwardRef(function(n,e){return h.createElement(z,Object.assign({},n,{id:"solve-single",ref:e,icon:et}))});_e.displayName="SolveSingle";function je(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var i=n.length;for(e=0;e<i;e++)n[e]&&(t=je(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function tt(){for(var n,e,t=0,r="",i=arguments.length;t<i;t++)(n=arguments[t])&&(e=je(n))&&(r&&(r+=" "),r+=e);return r}const ie={threadCommentEditorButtons:"univer-thread-comment-editor-buttons",threadCommentEditorSuggestion:"univer-thread-comment-editor-suggestion",threadCommentEditorSuggestionActive:"univer-thread-comment-editor-suggestionActive",threadCommentEditorSuggestionIcon:"univer-thread-comment-editor-suggestion-icon"},nt=n=>{const e=/@\[(.*?)\]\((.*?)\)|(\w+)/g;let t,r=0;const i=[];for(;(t=e.exec(n))!==null;)t.index>r&&i.push({type:"text",content:n.substring(r,t.index)}),t[1]&&t[2]?i.push({type:"mention",content:{label:t[1],id:t[2]}}):t[3]&&i.push({type:"text",content:t[3]}),r=e.lastIndex;return r<n.length&&i.push({type:"text",content:n.substring(r)}),i},rt=n=>n.map(e=>{switch(e.type){case"mention":return`@[${e.content.label}](${e.content.id})`;default:return e.content}}).join(""),Ue=n=>{const{dataStream:e,customRanges:t}=n,r=e.length-2,i=[];let s=0;return t==null||t.forEach(l=>{s<l.startIndex&&i.push({type:"text",content:e.slice(s,l.startIndex)}),i.push({type:"mention",content:{label:e.slice(l.startIndex,l.endIndex).slice(1,-1),id:l.rangeId}}),s=l.endIndex}),i.push({type:"text",content:e.slice(s,r)}),i},Pe=n=>{let e="";const t=[];return n.forEach(r=>{switch(r.type){case"text":e+=r.content;break;case"mention":{const i=e.length;e+=`${r.content.label}`;const s=e.length;t.push({rangeId:r.content.id,rangeType:o.CustomRangeType.MENTION,startIndex:i,endIndex:s,properties:{}});break}}}),e+=`
23
+ \r`,{textRuns:[],paragraphs:[{startIndex:e.length-2,paragraphStyle:{}}],sectionBreaks:[{startIndex:e.length-1}],dataStream:e,customRanges:t}},it=(n,e,t,r,i)=>{var l,C;const s=(l=n.raw)==null?void 0:l.icon;return a.jsxs("div",{className:ie.threadCommentEditorSuggestion,children:[s?a.jsx("img",{className:ie.threadCommentEditorSuggestionIcon,src:s}):null,a.jsx("div",{children:(C=n.display)!=null?C:n.id})]})},Ee=h.forwardRef((n,e)=>{var V;const{comment:t,onSave:r,id:i,onCancel:s,autoFocus:l,unitId:C}=n,u=o.useDependency(o.IMentionIOService),U=o.useDependency(o.ICommandService),f=o.useDependency(o.LocaleService),[p,I]=h.useState({...t}),[T,x]=h.useState(!1),y=h.useRef(null),D=o.useDependency(Oe.DocSelectionManagerService),N=(V=o.useDependency(we.IRenderManagerService).getCurrentTypeOfRenderer(o.UniverInstanceType.UNIVER_DOC))==null?void 0:V.with(Me.DocSelectionRenderService);h.useImperativeHandle(e,()=>({reply(v){var b;I({...t,text:v,attachments:[]}),(b=y.current)==null||b.inputElement.focus()}}));const S=()=>{var v;p.text&&(r==null||r({...p,text:p.text}),x(!1),I({text:void 0}),(v=y.current)==null||v.inputElement.blur())};return a.jsxs("div",{className:ie.threadCommentEditor,onClick:v=>v.preventDefault(),children:[a.jsx(E.Mentions,{ref:y,autoFocus:l,style:{width:"100%"},placeholder:f.t("threadCommentUI.editor.placeholder"),value:p!=null&&p.text?rt(Ue(p.text)):"",onChange:v=>{v.target.value||I({...t,text:void 0}),I==null||I({...t,text:Pe(nt(v.target.value))})},onFocus:()=>{const v=D.getActiveTextRange();v&&v.collapsed&&(N==null||N.removeAllRanges()),N==null||N.blur(),x(!0)},children:a.jsx(E.Mention,{trigger:"@",data:(v,b)=>u.list({search:v,unitId:C}).then(m=>m.list.map(H=>H.mentions.map(j=>({id:j.objectId,display:j.label,raw:j}))).flat()).then(b),displayTransform:(v,b)=>`@${b} `,renderSuggestion:it},"@")}),T?a.jsxs("div",{className:ie.threadCommentEditorButtons,children:[a.jsx(E.Button,{style:{marginRight:12},onClick:()=>{s==null||s(),x(!1),I({text:void 0}),U.executeCommand(W.id)},children:f.t("threadCommentUI.editor.cancel")}),a.jsx(E.Button,{type:"primary",disabled:!p.text,onClick:S,children:f.t(i?"threadCommentUI.editor.save":"threadCommentUI.editor.reply")})]}):null]})}),g={threadComment:"univer-thread-comment",threadCommentActive:"univer-thread-comment-active",threadCommentContent:"univer-thread-comment-content",threadCommentHighlight:"univer-thread-comment-highlight",threadCommentIconContainer:"univer-thread-comment-icon-container",threadCommentIcon:"univer-thread-comment-icon",threadCommentTitle:"univer-thread-comment-title",threadCommentTitlePosition:"univer-thread-comment-title-position",threadCommentTitleHighlight:"univer-thread-comment-title-highlight",threadCommentTitlePositionText:"univer-thread-comment-title-position-text",threadCommentUsername:"univer-thread-comment-username",threadCommentItem:"univer-thread-comment-item",threadCommentItemHead:"univer-thread-comment-item-head",threadCommentItemTitle:"univer-thread-comment-item-title",threadCommentItemTitlePosition:"univer-thread-comment-item-title-position",threadCommentItemTitleHighlight:"univer-thread-comment-item-title-highlight",threadCommentItemTime:"univer-thread-comment-item-time",threadCommentItemContent:"univer-thread-comment-item-content",threadCommentItemAt:"univer-thread-comment-item-at"},Ne="__mock__",ot=n=>{const{item:e,unitId:t,subUnitId:r,editing:i,onEditingChange:s,onReply:l,resolved:C,isRoot:u,onClose:U,onDeleteComment:f}=n,p=o.useDependency(o.ICommandService),I=o.useDependency(o.LocaleService),T=o.useDependency(o.UserManagerService),x=T.getUser(e.personId),y=k.useObservable(T.currentUser$),D=(y==null?void 0:y.userID)===e.personId,P=e.id===Ne,[N,S]=h.useState(!1),V=()=>{(f==null?void 0:f(e))!==!1&&(p.executeCommand(u?_.DeleteCommentTreeCommand.id:_.DeleteCommentCommand.id,{unitId:t,subUnitId:r,commentId:e.id}),u&&(U==null||U()))};return a.jsxs("div",{className:g.threadCommentItem,onMouseLeave:()=>S(!1),onMouseEnter:()=>S(!0),children:[a.jsx("img",{className:g.threadCommentItemHead,src:x==null?void 0:x.avatar}),a.jsxs("div",{className:g.threadCommentItemTitle,children:[a.jsx("div",{className:g.threadCommentUsername,children:(x==null?void 0:x.name)||" "}),a.jsxs("div",{children:[P||C?null:N?a.jsx("div",{className:g.threadCommentIcon,onClick:()=>l(x),children:a.jsx(be,{})}):null,D&&!P&&!C?a.jsx(E.DropdownLegacy,{overlay:a.jsxs(E.Menu,{children:[a.jsx(E.MenuItem,{onClick:()=>s==null?void 0:s(!0),children:I.t("threadCommentUI.item.edit")},"edit"),a.jsx(E.MenuItem,{onClick:V,children:I.t("threadCommentUI.item.delete")},"delete")]}),children:a.jsx("div",{className:g.threadCommentIcon,children:a.jsx(ye,{})})}):null]})]}),a.jsx("div",{className:g.threadCommentItemTime,children:e.dT}),i?a.jsx(Ee,{id:e.id,comment:e,onCancel:()=>s==null?void 0:s(!1),autoFocus:!0,unitId:t,subUnitId:r,onSave:({text:v,attachments:b})=>{s==null||s(!1),p.executeCommand(_.UpdateCommentCommand.id,{unitId:t,subUnitId:r,payload:{commentId:e.id,text:v,attachments:b}})}}):a.jsx("div",{className:g.threadCommentItemContent,children:Ue(e.text).map((v,b)=>{switch(v.type){case"mention":return a.jsxs("a",{className:g.threadCommentItemAt,children:["@",v.content.label," "]},b);default:return v.content}})})]})},Re=n=>{var ae,ee,te;const{id:e,unitId:t,subUnitId:r,refStr:i,showEdit:s=!0,onClick:l,showHighlight:C,onClose:u,getSubUnitName:U,prefix:f,autoFocus:p,onMouseEnter:I,onMouseLeave:T,onAddComment:x,onDeleteComment:y,onResolve:D}=n,P=o.useDependency(_.ThreadCommentModel),[N,S]=h.useState(!1),[V,v]=h.useState(""),b=h.useMemo(()=>P.commentUpdate$.pipe(re.debounceTime(16)),[P]);k.useObservable(b);const m=e?P.getCommentWithChildren(t,r,e):null,H=o.useDependency(o.ICommandService),j=o.useDependency(o.UserManagerService),A=m==null?void 0:m.root.resolved,w=k.useObservable(j.currentUser$),X=h.useRef(null),q=[...m?[m.root]:[{id:Ne,text:{dataStream:`
24
+ \r`},personId:(ae=w==null?void 0:w.userID)!=null?ae:"",ref:i!=null?i:"",dT:"",unitId:t,subUnitId:r,threadId:""}],...(ee=m==null?void 0:m.children)!=null?ee:[]],Z=h.useRef(null),B=R=>{R.stopPropagation(),A?H.executeCommand(W.id,{unitId:t,subUnitId:r,commentId:e}):H.executeCommand(W.id),H.executeCommand(_.ResolveCommentCommand.id,{unitId:t,subUnitId:r,commentId:e,resolved:!A}),D==null||D(!A)},$=R=>{R.stopPropagation(),H.executeCommand(W.id),!(m!=null&&m.root&&(y==null?void 0:y(m.root))===!1)&&(H.executeCommand(_.DeleteCommentTreeCommand.id,{unitId:t,subUnitId:r,commentId:e}),u==null||u())};h.useEffect(()=>T==null?void 0:T(),[]);const F=U((te=m==null?void 0:m.root.subUnitId)!=null?te:r),oe=s&&!V&&!A,K=`${i||(m==null?void 0:m.root.ref)||""}${F?" · ":""}${F}`;return a.jsxs("div",{className:tt(g.threadComment,{[g.threadCommentActive]:!A&&(C||N||f==="cell")}),onClick:l,id:`${f}-${t}-${r}-${e}`,onMouseEnter:()=>{I==null||I(),S(!0)},onMouseLeave:()=>{T==null||T(),S(!1)},children:[!A&&C?a.jsx("div",{className:g.threadCommentHighlight}):null,a.jsxs("div",{className:g.threadCommentTitle,children:[a.jsxs("div",{className:g.threadCommentTitlePosition,children:[a.jsx("div",{className:g.threadCommentTitleHighlight}),a.jsx(E.Tooltip,{showIfEllipsis:!0,title:K,children:a.jsx("div",{className:g.threadCommentTitlePositionText,children:K})})]}),m?a.jsxs("div",{className:g.threadCommentIconContainer,children:[a.jsx("div",{onClick:B,className:g.threadCommentIcon,style:{color:A?"rgb(var(--green-500))":""},children:A?a.jsx(Te,{}):a.jsx(_e,{})}),(w==null?void 0:w.userID)===m.root.personId?a.jsx("div",{className:g.threadCommentIcon,onClick:$,children:a.jsx(xe,{})}):null]}):null]}),a.jsx("div",{className:g.threadCommentContent,ref:Z,children:q.map(R=>a.jsx(ot,{onClose:u,unitId:t,subUnitId:r,item:R,isRoot:R.id===(m==null?void 0:m.root.id),editing:V===R.id,resolved:m==null?void 0:m.root.resolved,onEditingChange:L=>{v(L?R.id:"")},onReply:L=>{L&&requestAnimationFrame(()=>{var d;(d=X.current)==null||d.reply(Pe([{type:"mention",content:{id:L.userID,label:L.name}}]))})},onAddComment:x,onDeleteComment:y},R.id))}),oe?a.jsx("div",{children:a.jsx(Ee,{ref:X,unitId:t,subUnitId:r,onSave:async({text:R,attachments:L})=>{const d={text:R,attachments:L,dT:_.getDT(),id:o.generateRandomId(),ref:i,personId:w==null?void 0:w.userID,parentId:m==null?void 0:m.root.id,unitId:t,subUnitId:r,threadId:m==null?void 0:m.root.threadId};(x==null?void 0:x(d))!==!1&&(await H.executeCommand(_.AddCommentCommand.id,{unitId:t,subUnitId:r,comment:d}),Z.current&&(Z.current.scrollTop=Z.current.scrollHeight))},autoFocus:p||!m,onCancel:()=>{m||u==null||u()}},`${p}`)}):null]})},Q={threadCommentPanel:"univer-thread-comment-panel",threadComment:"univer-thread-comment",threadCommentPanelForms:"univer-thread-comment-panel-forms",select:"univer-select",threadCommentPanelEmpty:"univer-thread-comment-panel-empty",threadCommentPanelAdd:"univer-thread-comment-panel-add",threadCommentPanelSolved:"univer-thread-comment-panel-solved"},at=n=>{const{unitId:e,subUnitId$:t,type:r,onAdd:i,getSubUnitName:s,onResolve:l,sortComments:C,onItemLeave:u,onItemEnter:U,disableAdd:f,tempComment:p,onAddComment:I,onDeleteComment:T,showComments:x}=n,[y,D]=h.useState("all"),[P,N]=h.useState("all"),S=o.useDependency(o.LocaleService),V=o.useDependency(o.UserManagerService),v=o.useDependency(_.ThreadCommentModel),[b,m]=h.useState(()=>v.getUnit(e)),H=o.useDependency(c.ThreadCommentPanelService),j=k.useObservable(H.activeCommentId$),A=k.useObservable(v.commentUpdate$),w=o.useDependency(o.ICommandService),X=k.useObservable(t),q=h.useRef(!0),Z="panel",B=k.useObservable(V.currentUser$),$=h.useMemo(()=>{var de;const d=y==="all"?b:(de=b.filter(O=>O.subUnitId===X))!=null?de:[],ne=C!=null?C:O=>O,se=d.map(O=>{var J;return{...O.root,children:(J=O.children)!=null?J:[],users:O.relativeUsers}});if(x){const O=new Map;return se.forEach(J=>{O.set(J.id,J)}),[...x,""].map(J=>O.get(J)).filter(Boolean)}else return ne(se)},[x,y,b,C,X]),F=h.useMemo(()=>[...$.filter(d=>!d.resolved),...$.filter(d=>d.resolved)],[$]),oe=h.useMemo(()=>P==="resolved"?F.filter(d=>d.resolved):P==="unsolved"?F.filter(d=>!d.resolved):P==="concern_me"&&B!=null&&B.userID?F.filter(d=>d==null?void 0:d.users.has(B.userID)):F,[F,B==null?void 0:B.userID,P]),K=p?[p,...oe]:oe,ae=K.filter(d=>!d.resolved),ee=K.filter(d=>d.resolved),te=P!=="all"||y!=="all",R=()=>{N("all"),D("all")};h.useEffect(()=>{e&&m(v.getUnit(e))},[e,v,A]),h.useEffect(()=>{var O;if(!j)return;if(!q.current){q.current=!0;return}const{unitId:d,subUnitId:ne,commentId:se}=j,de=`${Z}-${d}-${ne}-${se}`;(O=document.getElementById(de))==null||O.scrollIntoView({block:"center"})},[j]);const L=d=>a.jsx(Re,{prefix:Z,getSubUnitName:s,id:d.id,unitId:d.unitId,subUnitId:d.subUnitId,refStr:d.ref,type:r,showEdit:(j==null?void 0:j.commentId)===d.id,showHighlight:(j==null?void 0:j.commentId)===d.id,onClick:()=>{q.current=!1,d.resolved?w.executeCommand(W.id):w.executeCommand(W.id,{unitId:d.unitId,subUnitId:d.subUnitId,commentId:d.id,temp:!1})},onMouseEnter:()=>U==null?void 0:U(d),onMouseLeave:()=>u==null?void 0:u(d),onAddComment:I,onDeleteComment:T,onResolve:ne=>l==null?void 0:l(d.id,ne)},d.id);return a.jsxs("div",{className:Q.threadCommentPanel,children:[a.jsxs("div",{className:Q.threadCommentPanelForms,children:[r===o.UniverInstanceType.UNIVER_SHEET?a.jsx(E.Select,{borderless:!0,value:y,onChange:d=>D(d),options:[{value:"current",label:S.t("threadCommentUI.filter.sheet.current")},{value:"all",label:S.t("threadCommentUI.filter.sheet.all")}]}):null,a.jsx(E.Select,{borderless:!0,value:P,onChange:d=>N(d),options:[{value:"all",label:S.t("threadCommentUI.filter.status.all")},{value:"resolved",label:S.t("threadCommentUI.filter.status.resolved")},{value:"unsolved",label:S.t("threadCommentUI.filter.status.unsolved")},{value:"concern_me",label:S.t("threadCommentUI.filter.status.concernMe")}]})]}),ae.map(L),ee.length?a.jsx("div",{className:Q.threadCommentPanelSolved,children:"已解决"}):null,ee.map(L),K.length?null:a.jsxs("div",{className:Q.threadCommentPanelEmpty,children:[te?S.t("threadCommentUI.panel.filterEmpty"):S.t("threadCommentUI.panel.empty"),te?a.jsx(E.Button,{onClick:R,type:"link",children:S.t("threadCommentUI.panel.reset")}):a.jsxs(E.Button,{id:"thread-comment-add",className:Q.threadCommentPanelAdd,type:"primary",onClick:i,disabled:f,children:[a.jsx(Se,{}),S.t("threadCommentUI.panel.addComment")]})]})]})};c.SetActiveCommentOperation=W,c.THREAD_COMMENT_PANEL=he,c.ThreadCommentPanel=at,c.ThreadCommentTree=Re,c.ToggleSheetCommentPanelOperation=ue,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
21
25
 
22
26
 
23
27
  // @univerjs/sheets-thread-comment-ui/index
24
- (function(d,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/sheets-thread-comment"),require("@univerjs/thread-comment-ui"),require("@univerjs/sheets-ui"),require("@univerjs/ui"),require("rxjs"),require("@univerjs/engine-render"),require("@univerjs/engine-formula"),require("@univerjs/thread-comment"),require("react")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","@univerjs/sheets-thread-comment","@univerjs/thread-comment-ui","@univerjs/sheets-ui","@univerjs/ui","rxjs","@univerjs/engine-render","@univerjs/engine-formula","@univerjs/thread-comment","react"],a):(d=typeof globalThis<"u"?globalThis:d||self,a(d.UniverSheetsThreadCommentUi={},d.UniverCore,d.UniverSheets,d.UniverSheetsThreadComment,d.UniverThreadCommentUi,d.UniverSheetsUi,d.UniverUi,d.rxjs,d.UniverEngineRender,d.UniverEngineFormula,d.UniverThreadComment,d.React))})(this,function(d,a,v,A,P,I,f,k,ie,$,C,E){"use strict";var rt=Object.defineProperty;var it=(d,a,v)=>a in d?rt(d,a,{enumerable:!0,configurable:!0,writable:!0,value:v}):d[a]=v;var N=(d,a,v)=>it(d,typeof a!="symbol"?a+"":a,v);const oe="univer.sheet.thread-comment-modal",K="comment-single",Q="SHEET_THREAD_COMMENT";var Se=Object.defineProperty,_e=Object.getOwnPropertyDescriptor,fe=(i,t,n,e)=>{for(var r=e>1?void 0:e?_e(t,n):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&Se(t,n,r),r},se=(i,t)=>(n,e)=>t(n,e,i);d.SheetsThreadCommentPopupService=class extends a.Disposable{constructor(n,e){super();N(this,"_lastPopup",null);N(this,"_activePopup");N(this,"_activePopup$",new k.BehaviorSubject(null));N(this,"activePopup$",this._activePopup$.asObservable());this._canvasPopupManagerService=n,this._zenZoneService=e,this._initZenVisible(),this.disposeWithMe(()=>{this._activePopup$.complete()})}get activePopup(){return this._activePopup}_initZenVisible(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(n=>{n&&this.hidePopup()}))}showPopup(n,e){var m;const{row:r,col:o,unitId:s,subUnitId:c}=n;if(this._activePopup&&r===this._activePopup.row&&o===this._activePopup.col&&s===this._activePopup.unitId&&c===((m=this.activePopup)==null?void 0:m.subUnitId)){this._activePopup=n,this._activePopup$.next(n);return}if(this._lastPopup&&this._lastPopup.dispose(),this._zenZoneService.visible)return;this._activePopup=n,this._activePopup$.next(n);const u=this._canvasPopupManagerService.attachPopupToCell(r,o,{componentKey:oe,onClickOutside:()=>{this.hidePopup()},direction:"horizontal",excludeOutside:[...Array.from(document.querySelectorAll(".univer-thread-comment")),document.getElementById("thread-comment-add")].filter(Boolean)});if(!u)throw new Error("[SheetsThreadCommentPopupService]: cannot show popup!");const h=new a.DisposableCollection;h.add(u),h.add({dispose:()=>{e==null||e()}}),this._lastPopup=h}hidePopup(){this._activePopup&&(this._lastPopup&&this._lastPopup.dispose(),this._lastPopup=null,this._activePopup=null,this._activePopup$.next(null))}persistPopup(){!this._activePopup||!this._activePopup.temp||(this._activePopup={...this._activePopup,temp:!1},this._activePopup$.next(this._activePopup))}},d.SheetsThreadCommentPopupService=fe([se(0,a.Inject(I.SheetCanvasPopManagerService)),se(1,f.IZenZoneService)],d.SheetsThreadCommentPopupService);const B={type:a.CommandType.OPERATION,id:"sheets.operation.show-comment-modal",handler(i){var g;const t=i.get(v.SheetsSelectionsService),n=i.get(a.IUniverInstanceService),e=i.get(d.SheetsThreadCommentPopupService),r=i.get(P.ThreadCommentPanelService),o=(g=t.getCurrentLastSelection())==null?void 0:g.primary,s=i.get(A.SheetsThreadCommentModel);if(!o)return!1;const c=v.getSheetCommandTarget(n);if(!c)return!1;const{workbook:u,worksheet:h,unitId:m,subUnitId:l}=c,p={workbook:u,worksheet:h,unitId:m,subUnitId:l,row:o.startRow,col:o.startColumn};e.showPopup(p);const S=s.getByLocation(m,l,o.startRow,o.startColumn);return S&&r.setActiveComment({unitId:m,subUnitId:l,commentId:S,trigger:"context-menu"}),!0}},Ce="sheets-thread-comment.config",Ie={};var ge=Object.defineProperty,Pe=Object.getOwnPropertyDescriptor,Te=(i,t,n,e)=>{for(var r=e>1?void 0:e?Pe(t,n):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&ge(t,n,r),r},L=(i,t)=>(n,e)=>t(n,e,i);let W=class extends a.Disposable{constructor(i,t,n,e){super(),this._sheetInterceptorService=i,this._sheetsThreadCommentModel=t,this._univerInstanceService=n,this._renderManagerService=e,this._initViewModelIntercept(),this._initSkeletonChange()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(v.INTERCEPTOR_POINT.CELL_CONTENT,{effect:a.InterceptorEffectEnum.Style,handler:(i,t,n)=>{const{row:e,col:r,unitId:o,subUnitId:s}=t;return this._sheetsThreadCommentModel.showCommentMarker(o,s,e,r)?n({...i,markers:{...i==null?void 0:i.markers,tr:{color:"#FFBD37",size:6}}}):n(i)},priority:100}))}_initSkeletonChange(){const i=()=>{var r;const t=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!t)return;const n=t.getUnitId(),e=this._renderManagerService.getRenderById(n);(r=e==null?void 0:e.mainComponent)==null||r.makeForceDirty()};this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(k.debounceTime(16)).subscribe(()=>{i()}))}};W=Te([L(0,a.Inject(v.SheetInterceptorService)),L(1,a.Inject(A.SheetsThreadCommentModel)),L(2,a.IUniverInstanceService),L(3,ie.IRenderManagerService)],W);var be=Object.defineProperty,ye=Object.getOwnPropertyDescriptor,Me=(i,t,n,e)=>{for(var r=e>1?void 0:e?ye(t,n):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&be(t,n,r),r},X=(i,t)=>(n,e)=>t(n,e,i);const we=(i,t,n)=>{const e=$.singleReferenceToGrid(i),r=n.row-t.row,o=n.column-t.column,s={startColumn:e.column+o,startRow:e.row+r,endColumn:e.column+o,endRow:e.row+r};return $.serializeRange(s)};let F=class extends a.Disposable{constructor(t,n,e){super();N(this,"_copyInfo");this._sheetClipboardService=t,this._sheetsThreadCommentModel=n,this._threadCommentDataSourceService=e,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:Q,onBeforeCopy:(t,n,e)=>{this._copyInfo={unitId:t,subUnitId:n,range:e}},onPasteCells:(t,n,e,r)=>{const{unitId:o,subUnitId:s,range:c}=n,u={row:c.rows[0],column:c.cols[0]};if(r.copyType===I.COPY_TYPE.CUT&&this._copyInfo){const{range:h,unitId:m,subUnitId:l}=this._copyInfo,p={row:h.startRow,column:h.startColumn};if(!(o===m&&s===l)){const S=[];a.Range.foreach(h,(w,_)=>{const R=this._sheetsThreadCommentModel.getAllByLocation(m,l,w,_);this._threadCommentDataSourceService.syncUpdateMutationToColla?R.forEach(T=>{S.push(T)}):R.forEach(({children:T,...j})=>{j.parentId||S.push(j)})});const g=[],M=[],V=[],H=[],re=w=>{g.unshift({id:C.DeleteCommentMutation.id,params:{unitId:m,subUnitId:l,commentId:w.id}}),V.push({id:C.AddCommentMutation.id,params:{unitId:o,subUnitId:s,comment:{...w,ref:we(w.ref,p,u),unitId:o,subUnitId:s},sync:!0}}),M.push({id:C.AddCommentMutation.id,params:{unitId:m,subUnitId:l,comment:w,sync:!0}}),H.unshift({id:C.DeleteCommentMutation.id,params:{unitId:o,subUnitId:s,commentId:w.id}})};return S.forEach(w=>{re(w)}),{redos:[...g,...V],undos:[...H,...M]}}}return{redos:[],undos:[]}}}))}};F=Me([X(0,a.Inject(I.ISheetClipboardService)),X(1,a.Inject(A.SheetsThreadCommentModel)),X(2,C.IThreadCommentDataSourceService)],F);var Re=Object.defineProperty,Ee=Object.getOwnPropertyDescriptor,Oe=(i,t,n,e)=>{for(var r=e>1?void 0:e?Ee(t,n):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&Re(t,n,r),r},G=(i,t)=>(n,e)=>t(n,e,i);let Z=class extends a.Disposable{constructor(i,t,n,e){super(),this._hoverManagerService=i,this._sheetsThreadCommentPopupService=t,this._sheetsThreadCommentModel=n,this._sheetPermissionInterceptorBaseController=e,this._initHoverEvent()}_initHoverEvent(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(k.debounceTime(100)).subscribe(i=>{const t=this._sheetsThreadCommentPopupService.activePopup;if(i&&(t&&t.temp||!t)){const{location:n}=i,{unitId:e,subUnitId:r,row:o,col:s}=n,c=this._sheetsThreadCommentModel.getByLocation(e,r,o,s);if(c){if(!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[v.WorkbookCommentPermission],worksheetTypes:[v.WorksheetViewPermission],rangeTypes:[v.RangeProtectionPermissionViewPoint]},[{startRow:o,startColumn:s,endRow:o,endColumn:s}]))return;const h=this._sheetsThreadCommentModel.getComment(e,r,c);h&&!h.resolved&&this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:r,row:o,col:s,commentId:c,temp:!0})}else t&&this._sheetsThreadCommentPopupService.hidePopup()}}))}};Z=Oe([G(0,a.Inject(I.HoverManagerService)),G(1,a.Inject(d.SheetsThreadCommentPopupService)),G(2,a.Inject(A.SheetsThreadCommentModel)),G(3,a.Inject(I.SheetPermissionInterceptorBaseController))],Z);var Ue=Object.defineProperty,je=Object.getOwnPropertyDescriptor,De=(i,t,n,e)=>{for(var r=e>1?void 0:e?je(t,n):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&Ue(t,n,r),r},U=(i,t)=>(n,e)=>t(n,e,i);let z=class extends a.Disposable{constructor(t,n,e,r,o,s,c,u,h,m){super();N(this,"_isSwitchToCommenting",!1);N(this,"_selectionShapeInfo",null);this._commandService=t,this._sheetsThreadCommentPopupService=n,this._sheetsThreadCommentModel=e,this._threadCommentPanelService=r,this._univerInstanceService=o,this._sheetPermissionInterceptorBaseController=s,this._markSelectionService=c,this._sheetSelectionService=u,this._editorBridgeService=h,this._renderManagerService=m,this._initCommandListener(),this._initPanelListener(),this._initMarkSelection(),this._initSelectionUpdateListener(),this._initEditorBridge()}_handleSelectionChange(t,n,e){var p,S,g;const r=(p=t[0])==null?void 0:p.range,o=this._renderManagerService.getRenderById(n),s=(S=o==null?void 0:o.with(I.SheetSkeletonManagerService).getWorksheetSkeleton(e))==null?void 0:S.skeleton;if(!s||!r)return;const c=s.getCellWithCoordByIndex(r.startRow,r.startColumn);if((((g=r.rangeType)!=null?g:a.RANGE_TYPE.NORMAL)!==a.RANGE_TYPE.NORMAL||r.endColumn-r.startColumn>0||r.endRow-r.startRow>0)&&!((c.isMerged||c.isMergedMainCell)&&a.Rectangle.equals(c.mergeInfo,r))){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(P.SetActiveCommentOperation.id);return}const h=c.actualRow,m=c.actualColumn;if(!this._sheetsThreadCommentModel.showCommentMarker(n,e,h,m)){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(P.SetActiveCommentOperation.id);return}const l=this._sheetsThreadCommentModel.getByLocation(n,e,h,m);l&&this._commandService.executeCommand(P.SetActiveCommentOperation.id,{unitId:n,subUnitId:e,commentId:l})}_initSelectionUpdateListener(){this.disposeWithMe(this._sheetSelectionService.selectionMoveEnd$.subscribe(t=>{if(this._isSwitchToCommenting)return;const n=this._sheetSelectionService.currentSelectionParam;n&&this._handleSelectionChange(t,n.unitId,n.sheetId)}))}_initEditorBridge(){this.disposeWithMe(this._editorBridgeService.visible$.subscribe(t=>{t.visible&&this._sheetsThreadCommentPopupService.hidePopup()}))}_initCommandListener(){this._commandService.onCommandExecuted(t=>{if(t.id===C.DeleteCommentMutation.id){const n=t.params,e=this._sheetsThreadCommentPopupService.activePopup;if(!e)return;const{unitId:r,subUnitId:o,commentId:s}=e;n.unitId===r&&n.subUnitId===o&&n.commentId===s&&this._sheetsThreadCommentPopupService.hidePopup()}})}_initPanelListener(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(async t=>{var n;if(t){const{unitId:e,subUnitId:r,commentId:o,trigger:s}=t,c=this._sheetsThreadCommentModel.getComment(e,r,o);if(!c||c.resolved)return;const u=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!u||u.getUnitId()!==e)return;this._isSwitchToCommenting=!0,((n=u.getActiveSheet())==null?void 0:n.getSheetId())!==r&&await this._commandService.executeCommand(v.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:r}),this._isSwitchToCommenting=!1;const l=$.singleReferenceToGrid(c.ref),{row:p,column:S}=l;if(!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[v.WorkbookCommentPermission],worksheetTypes:[v.WorksheetViewPermission],rangeTypes:[v.RangeProtectionPermissionViewPoint]},[{startRow:p,startColumn:S,endRow:p,endColumn:S}]))return;const M=1;if(await this._commandService.executeCommand(I.ScrollToRangeOperation.id,{range:{startRow:Math.max(l.row-M,0),endRow:l.row+M,startColumn:Math.max(l.column-M,0),endColumn:l.column+M}}),this._editorBridgeService.isVisible().visible)return;this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:r,row:l.row,col:l.column,commentId:c.id,trigger:s})}else this._sheetsThreadCommentPopupService.hidePopup()}))}_initMarkSelection(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe(k.debounceTime(100)).subscribe(t=>{var p,S;if(!t){this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);return}const{unitId:n,subUnitId:e,commentId:r}=t;this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);const o=this._sheetsThreadCommentModel.getComment(n,e,r);if(!o)return;const s=$.singleReferenceToGrid(o.ref),{row:c,column:u}=s;if(Number.isNaN(c)||Number.isNaN(u))return null;const h=(p=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:p.getSheetBySheetId(e),m=(S=h==null?void 0:h.getMergedCell(c,u))!=null?S:{startColumn:u,endColumn:u,startRow:c,endRow:c},l=this._markSelectionService.addShape({range:m,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null},[],-1);l&&(this._selectionShapeInfo={...t,shapeId:l})}))}};z=De([U(0,a.ICommandService),U(1,a.Inject(d.SheetsThreadCommentPopupService)),U(2,a.Inject(A.SheetsThreadCommentModel)),U(3,a.Inject(P.ThreadCommentPanelService)),U(4,a.IUniverInstanceService),U(5,a.Inject(I.SheetPermissionInterceptorBaseController)),U(6,I.IMarkSelectionService),U(7,a.Inject(v.SheetsSelectionsService)),U(8,I.IEditorBridgeService),U(9,ie.IRenderManagerService)],z);var Ne=Object.defineProperty,Ae=Object.getOwnPropertyDescriptor,Ve=(i,t,n,e)=>{for(var r=e>1?void 0:e?Ae(t,n):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&Ne(t,n,r),r},q=(i,t)=>(n,e)=>t(n,e,i);let Y=class extends a.Disposable{constructor(i,t,n,e){super(),this._sheetInterceptorService=i,this._univerInstanceService=t,this._threadCommentModel=n,this._threadCommentDataSourceService=e,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:i=>{var t;if(i.id===v.RemoveSheetCommand.id){const n=i.params,e=n.unitId?this._univerInstanceService.getUnit(n.unitId):this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!e)return{redos:[],undos:[]};const r=e.getUnitId(),o=n.subUnitId||((t=e.getActiveSheet())==null?void 0:t.getSheetId());if(!o)return{redos:[],undos:[]};const s=this._threadCommentModel.ensureMap(r,o),c=Array.from(s.values()).filter(p=>!p.parentId),u=c.map(p=>p.id),h=this._threadCommentDataSourceService.syncUpdateMutationToColla,m=u.map(p=>({id:C.DeleteCommentMutation.id,params:{unitId:r,subUnitId:o,commentId:p}})),l=c.map(({children:p,...S})=>({id:C.AddCommentMutation.id,params:{unitId:r,subUnitId:o,comment:{...S,children:h?p:void 0},sync:!h}}));return{redos:m,undos:l}}return{redos:[],undos:[]}}}))}};Y=Ve([q(0,a.Inject(v.SheetInterceptorService)),q(1,a.IUniverInstanceService),q(2,a.Inject(C.ThreadCommentModel)),q(3,C.IThreadCommentDataSourceService)],Y);var y=function(){return y=Object.assign||function(i){for(var t,n=1,e=arguments.length;n<e;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},y.apply(this,arguments)},$e=function(i,t){var n={};for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&t.indexOf(e)<0&&(n[e]=i[e]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,e=Object.getOwnPropertySymbols(i);r<e.length;r++)t.indexOf(e[r])<0&&Object.prototype.propertyIsEnumerable.call(i,e[r])&&(n[e[r]]=i[e[r]]);return n},ae=E.forwardRef(function(i,t){var n=i.icon,e=i.id,r=i.className,o=i.extend,s=$e(i,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(e," ").concat(r||"").trim(),u=E.useRef("_".concat(xe()));return ce(n,"".concat(e),{defIds:n.defIds,idSuffix:u.current},y({ref:t,className:c},s),o)});function ce(i,t,n,e,r){return E.createElement(i.tag,y(y({key:t},Be(i,n,r)),e),(ke(i,n).children||[]).map(function(o,s){return ce(o,"".concat(t,"-").concat(i.tag,"-").concat(s),n,void 0,r)}))}function Be(i,t,n){var e=y({},i.attrs);n!=null&&n.colorChannel1&&e.fill==="colorChannel1"&&(e.fill=n.colorChannel1);var r=t.defIds;return!r||r.length===0||(i.tag==="use"&&e["xlink:href"]&&(e["xlink:href"]=e["xlink:href"]+t.idSuffix),Object.entries(e).forEach(function(o){var s=o[0],c=o[1];typeof c=="string"&&(e[s]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),e}function ke(i,t){var n,e=t.defIds;return!e||e.length===0?i:i.tag==="defs"&&(!((n=i.children)===null||n===void 0)&&n.length)?y(y({},i),{children:i.children.map(function(r){return typeof r.attrs.id=="string"&&e&&e.indexOf(r.attrs.id)>-1?y(y({},r),{attrs:y(y({},r.attrs),{id:r.attrs.id+t.idSuffix})}):r})}):i}function xe(){return Math.random().toString(36).substring(2,8)}ae.displayName="UniverIcon";var He={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521C5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345ZM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521C8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345ZM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521C11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521 5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345zM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521 8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345zM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521 11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.84351 3.41861C1.84351 3.01861 2.15531 2.69434 2.53993 2.69434H14.9381C15.3228 2.69434 15.6346 3.01861 15.6346 3.41861V12.4611C15.6346 12.8612 15.3228 13.1854 14.9381 13.1854H8.82117L6.06643 14.6179C5.85054 14.7301 5.59416 14.7181 5.38884 14.5862C5.18352 14.4542 5.05855 14.2211 5.05855 13.9701V13.1854H2.53993C2.15531 13.1854 1.84351 12.8612 1.84351 12.4611L1.84351 3.41861ZM6.45141 12.7982L8.34531 12.0135C8.44201 11.9632 8.54864 11.9371 8.65676 11.9371H14.2417C14.3522 11.9371 14.4417 11.8475 14.4417 11.7371V4.14271C14.4417 4.03225 14.3522 3.94271 14.2417 3.94271H3.23636C3.12591 3.94271 3.03636 4.03225 3.03636 4.14271L3.03636 11.7371C3.03636 11.8475 3.12591 11.9371 3.23636 11.9371L5.75498 11.9371C6.1396 11.9371 6.45141 12.0611 6.45141 12.4611V12.7982Z",fillRule:"evenodd",clipRule:"evenodd"}}]},ue=E.forwardRef(function(i,t){return E.createElement(ae,Object.assign({},i,{id:"comment-single",ref:t,icon:He}))});ue.displayName="CommentSingle";var ee={exports:{}},x={};/**
28
+ (function(d,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/sheets-thread-comment"),require("@univerjs/thread-comment-ui"),require("@univerjs/sheets-ui"),require("@univerjs/ui"),require("rxjs"),require("@univerjs/engine-render"),require("@univerjs/engine-formula"),require("@univerjs/thread-comment"),require("react")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","@univerjs/sheets-thread-comment","@univerjs/thread-comment-ui","@univerjs/sheets-ui","@univerjs/ui","rxjs","@univerjs/engine-render","@univerjs/engine-formula","@univerjs/thread-comment","react"],s):(d=typeof globalThis<"u"?globalThis:d||self,s(d.UniverSheetsThreadCommentUi={},d.UniverCore,d.UniverSheets,d.UniverSheetsThreadComment,d.UniverThreadCommentUi,d.UniverSheetsUi,d.UniverUi,d.rxjs,d.UniverEngineRender,d.UniverEngineFormula,d.UniverThreadComment,d.React))})(this,function(d,s,v,A,P,I,f,k,ie,$,C,E){"use strict";var rt=Object.defineProperty;var it=(d,s,v)=>s in d?rt(d,s,{enumerable:!0,configurable:!0,writable:!0,value:v}):d[s]=v;var N=(d,s,v)=>it(d,typeof s!="symbol"?s+"":s,v);const oe="univer.sheet.thread-comment-modal",K="comment-single",Q="SHEET_THREAD_COMMENT";var _e=Object.defineProperty,fe=Object.getOwnPropertyDescriptor,Ce=(i,t,n,e)=>{for(var r=e>1?void 0:e?fe(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&_e(t,n,r),r},se=(i,t)=>(n,e)=>t(n,e,i);d.SheetsThreadCommentPopupService=class extends s.Disposable{constructor(n,e){super();N(this,"_lastPopup",null);N(this,"_activePopup");N(this,"_activePopup$",new k.BehaviorSubject(null));N(this,"activePopup$",this._activePopup$.asObservable());this._canvasPopupManagerService=n,this._zenZoneService=e,this._initZenVisible(),this.disposeWithMe(()=>{this._activePopup$.complete()})}get activePopup(){return this._activePopup}_initZenVisible(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(n=>{n&&this.hidePopup()}))}showPopup(n,e){var m;const{row:r,col:o,unitId:a,subUnitId:c}=n;if(this._activePopup&&r===this._activePopup.row&&o===this._activePopup.col&&a===this._activePopup.unitId&&c===((m=this.activePopup)==null?void 0:m.subUnitId)){this._activePopup=n,this._activePopup$.next(n);return}if(this._lastPopup&&this._lastPopup.dispose(),this._zenZoneService.visible)return;this._activePopup=n,this._activePopup$.next(n);const u=this._canvasPopupManagerService.attachPopupToCell(r,o,{componentKey:oe,onClickOutside:()=>{this.hidePopup()},direction:"horizontal",excludeOutside:[...Array.from(document.querySelectorAll(".univer-thread-comment")),document.getElementById("thread-comment-add")].filter(Boolean)});if(!u)throw new Error("[SheetsThreadCommentPopupService]: cannot show popup!");const h=new s.DisposableCollection;h.add(u),h.add({dispose:()=>{e==null||e()}}),this._lastPopup=h}hidePopup(){this._activePopup&&(this._lastPopup&&this._lastPopup.dispose(),this._lastPopup=null,this._activePopup=null,this._activePopup$.next(null))}persistPopup(){!this._activePopup||!this._activePopup.temp||(this._activePopup={...this._activePopup,temp:!1},this._activePopup$.next(this._activePopup))}},d.SheetsThreadCommentPopupService=Ce([se(0,s.Inject(I.SheetCanvasPopManagerService)),se(1,f.IZenZoneService)],d.SheetsThreadCommentPopupService);const B={type:s.CommandType.OPERATION,id:"sheets.operation.show-comment-modal",handler(i){var g;const t=i.get(v.SheetsSelectionsService),n=i.get(s.IUniverInstanceService),e=i.get(d.SheetsThreadCommentPopupService),r=i.get(P.ThreadCommentPanelService),o=(g=t.getCurrentLastSelection())==null?void 0:g.primary,a=i.get(A.SheetsThreadCommentModel);if(!o)return!1;const c=v.getSheetCommandTarget(n);if(!c)return!1;const{workbook:u,worksheet:h,unitId:m,subUnitId:l}=c,p={workbook:u,worksheet:h,unitId:m,subUnitId:l,row:o.startRow,col:o.startColumn};e.showPopup(p);const S=a.getByLocation(m,l,o.startRow,o.startColumn);return S&&r.setActiveComment({unitId:m,subUnitId:l,commentId:S,trigger:"context-menu"}),!0}},Ie="sheets-thread-comment.config",ae={};var ge=Object.defineProperty,Pe=Object.getOwnPropertyDescriptor,Te=(i,t,n,e)=>{for(var r=e>1?void 0:e?Pe(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&ge(t,n,r),r},L=(i,t)=>(n,e)=>t(n,e,i);let W=class extends s.Disposable{constructor(i,t,n,e){super(),this._sheetInterceptorService=i,this._sheetsThreadCommentModel=t,this._univerInstanceService=n,this._renderManagerService=e,this._initViewModelIntercept(),this._initSkeletonChange()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(v.INTERCEPTOR_POINT.CELL_CONTENT,{effect:s.InterceptorEffectEnum.Style,handler:(i,t,n)=>{const{row:e,col:r,unitId:o,subUnitId:a}=t;return this._sheetsThreadCommentModel.showCommentMarker(o,a,e,r)?n({...i,markers:{...i==null?void 0:i.markers,tr:{color:"#FFBD37",size:6}}}):n(i)},priority:100}))}_initSkeletonChange(){const i=()=>{var r;const t=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!t)return;const n=t.getUnitId(),e=this._renderManagerService.getRenderById(n);(r=e==null?void 0:e.mainComponent)==null||r.makeForceDirty()};this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(k.debounceTime(16)).subscribe(()=>{i()}))}};W=Te([L(0,s.Inject(v.SheetInterceptorService)),L(1,s.Inject(A.SheetsThreadCommentModel)),L(2,s.IUniverInstanceService),L(3,ie.IRenderManagerService)],W);var be=Object.defineProperty,ye=Object.getOwnPropertyDescriptor,Me=(i,t,n,e)=>{for(var r=e>1?void 0:e?ye(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&be(t,n,r),r},X=(i,t)=>(n,e)=>t(n,e,i);const we=(i,t,n)=>{const e=$.singleReferenceToGrid(i),r=n.row-t.row,o=n.column-t.column,a={startColumn:e.column+o,startRow:e.row+r,endColumn:e.column+o,endRow:e.row+r};return $.serializeRange(a)};let F=class extends s.Disposable{constructor(t,n,e){super();N(this,"_copyInfo");this._sheetClipboardService=t,this._sheetsThreadCommentModel=n,this._threadCommentDataSourceService=e,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:Q,onBeforeCopy:(t,n,e)=>{this._copyInfo={unitId:t,subUnitId:n,range:e}},onPasteCells:(t,n,e,r)=>{const{unitId:o,subUnitId:a,range:c}=n,u={row:c.rows[0],column:c.cols[0]};if(r.copyType===I.COPY_TYPE.CUT&&this._copyInfo){const{range:h,unitId:m,subUnitId:l}=this._copyInfo,p={row:h.startRow,column:h.startColumn};if(!(o===m&&a===l)){const S=[];s.Range.foreach(h,(w,_)=>{const R=this._sheetsThreadCommentModel.getAllByLocation(m,l,w,_);this._threadCommentDataSourceService.syncUpdateMutationToColla?R.forEach(T=>{S.push(T)}):R.forEach(({children:T,...j})=>{j.parentId||S.push(j)})});const g=[],M=[],V=[],H=[],re=w=>{g.unshift({id:C.DeleteCommentMutation.id,params:{unitId:m,subUnitId:l,commentId:w.id}}),V.push({id:C.AddCommentMutation.id,params:{unitId:o,subUnitId:a,comment:{...w,ref:we(w.ref,p,u),unitId:o,subUnitId:a},sync:!0}}),M.push({id:C.AddCommentMutation.id,params:{unitId:m,subUnitId:l,comment:w,sync:!0}}),H.unshift({id:C.DeleteCommentMutation.id,params:{unitId:o,subUnitId:a,commentId:w.id}})};return S.forEach(w=>{re(w)}),{redos:[...g,...V],undos:[...H,...M]}}}return{redos:[],undos:[]}}}))}};F=Me([X(0,s.Inject(I.ISheetClipboardService)),X(1,s.Inject(A.SheetsThreadCommentModel)),X(2,C.IThreadCommentDataSourceService)],F);var Re=Object.defineProperty,Ee=Object.getOwnPropertyDescriptor,Oe=(i,t,n,e)=>{for(var r=e>1?void 0:e?Ee(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&Re(t,n,r),r},G=(i,t)=>(n,e)=>t(n,e,i);let Z=class extends s.Disposable{constructor(i,t,n,e){super(),this._hoverManagerService=i,this._sheetsThreadCommentPopupService=t,this._sheetsThreadCommentModel=n,this._sheetPermissionInterceptorBaseController=e,this._initHoverEvent()}_initHoverEvent(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(k.debounceTime(100)).subscribe(i=>{const t=this._sheetsThreadCommentPopupService.activePopup;if(i&&(t&&t.temp||!t)){const{location:n}=i,{unitId:e,subUnitId:r,row:o,col:a}=n,c=this._sheetsThreadCommentModel.getByLocation(e,r,o,a);if(c){if(!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[v.WorkbookCommentPermission],worksheetTypes:[v.WorksheetViewPermission],rangeTypes:[v.RangeProtectionPermissionViewPoint]},[{startRow:o,startColumn:a,endRow:o,endColumn:a}]))return;const h=this._sheetsThreadCommentModel.getComment(e,r,c);h&&!h.resolved&&this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:r,row:o,col:a,commentId:c,temp:!0})}else t&&this._sheetsThreadCommentPopupService.hidePopup()}}))}};Z=Oe([G(0,s.Inject(I.HoverManagerService)),G(1,s.Inject(d.SheetsThreadCommentPopupService)),G(2,s.Inject(A.SheetsThreadCommentModel)),G(3,s.Inject(I.SheetPermissionInterceptorBaseController))],Z);var Ue=Object.defineProperty,je=Object.getOwnPropertyDescriptor,De=(i,t,n,e)=>{for(var r=e>1?void 0:e?je(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&Ue(t,n,r),r},U=(i,t)=>(n,e)=>t(n,e,i);let z=class extends s.Disposable{constructor(t,n,e,r,o,a,c,u,h,m){super();N(this,"_isSwitchToCommenting",!1);N(this,"_selectionShapeInfo",null);this._commandService=t,this._sheetsThreadCommentPopupService=n,this._sheetsThreadCommentModel=e,this._threadCommentPanelService=r,this._univerInstanceService=o,this._sheetPermissionInterceptorBaseController=a,this._markSelectionService=c,this._sheetSelectionService=u,this._editorBridgeService=h,this._renderManagerService=m,this._initCommandListener(),this._initPanelListener(),this._initMarkSelection(),this._initSelectionUpdateListener(),this._initEditorBridge()}_handleSelectionChange(t,n,e){var p,S,g;const r=(p=t[0])==null?void 0:p.range,o=this._renderManagerService.getRenderById(n),a=(S=o==null?void 0:o.with(I.SheetSkeletonManagerService).getWorksheetSkeleton(e))==null?void 0:S.skeleton;if(!a||!r)return;const c=a.getCellWithCoordByIndex(r.startRow,r.startColumn);if((((g=r.rangeType)!=null?g:s.RANGE_TYPE.NORMAL)!==s.RANGE_TYPE.NORMAL||r.endColumn-r.startColumn>0||r.endRow-r.startRow>0)&&!((c.isMerged||c.isMergedMainCell)&&s.Rectangle.equals(c.mergeInfo,r))){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(P.SetActiveCommentOperation.id);return}const h=c.actualRow,m=c.actualColumn;if(!this._sheetsThreadCommentModel.showCommentMarker(n,e,h,m)){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(P.SetActiveCommentOperation.id);return}const l=this._sheetsThreadCommentModel.getByLocation(n,e,h,m);l&&this._commandService.executeCommand(P.SetActiveCommentOperation.id,{unitId:n,subUnitId:e,commentId:l})}_initSelectionUpdateListener(){this.disposeWithMe(this._sheetSelectionService.selectionMoveEnd$.subscribe(t=>{if(this._isSwitchToCommenting)return;const n=this._sheetSelectionService.currentSelectionParam;n&&this._handleSelectionChange(t,n.unitId,n.sheetId)}))}_initEditorBridge(){this.disposeWithMe(this._editorBridgeService.visible$.subscribe(t=>{t.visible&&this._sheetsThreadCommentPopupService.hidePopup()}))}_initCommandListener(){this._commandService.onCommandExecuted(t=>{if(t.id===C.DeleteCommentMutation.id){const n=t.params,e=this._sheetsThreadCommentPopupService.activePopup;if(!e)return;const{unitId:r,subUnitId:o,commentId:a}=e;n.unitId===r&&n.subUnitId===o&&n.commentId===a&&this._sheetsThreadCommentPopupService.hidePopup()}})}_initPanelListener(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(async t=>{var n;if(t){const{unitId:e,subUnitId:r,commentId:o,trigger:a}=t,c=this._sheetsThreadCommentModel.getComment(e,r,o);if(!c||c.resolved)return;const u=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!u||u.getUnitId()!==e)return;this._isSwitchToCommenting=!0,((n=u.getActiveSheet())==null?void 0:n.getSheetId())!==r&&await this._commandService.executeCommand(v.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:r}),this._isSwitchToCommenting=!1;const l=$.singleReferenceToGrid(c.ref),{row:p,column:S}=l;if(!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[v.WorkbookCommentPermission],worksheetTypes:[v.WorksheetViewPermission],rangeTypes:[v.RangeProtectionPermissionViewPoint]},[{startRow:p,startColumn:S,endRow:p,endColumn:S}]))return;const M=1;if(await this._commandService.executeCommand(I.ScrollToRangeOperation.id,{range:{startRow:Math.max(l.row-M,0),endRow:l.row+M,startColumn:Math.max(l.column-M,0),endColumn:l.column+M}}),this._editorBridgeService.isVisible().visible)return;this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:r,row:l.row,col:l.column,commentId:c.id,trigger:a})}else this._sheetsThreadCommentPopupService.hidePopup()}))}_initMarkSelection(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe(k.debounceTime(100)).subscribe(t=>{var p,S;if(!t){this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);return}const{unitId:n,subUnitId:e,commentId:r}=t;this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);const o=this._sheetsThreadCommentModel.getComment(n,e,r);if(!o)return;const a=$.singleReferenceToGrid(o.ref),{row:c,column:u}=a;if(Number.isNaN(c)||Number.isNaN(u))return null;const h=(p=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET))==null?void 0:p.getSheetBySheetId(e),m=(S=h==null?void 0:h.getMergedCell(c,u))!=null?S:{startColumn:u,endColumn:u,startRow:c,endRow:c},l=this._markSelectionService.addShape({range:m,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null},[],-1);l&&(this._selectionShapeInfo={...t,shapeId:l})}))}};z=De([U(0,s.ICommandService),U(1,s.Inject(d.SheetsThreadCommentPopupService)),U(2,s.Inject(A.SheetsThreadCommentModel)),U(3,s.Inject(P.ThreadCommentPanelService)),U(4,s.IUniverInstanceService),U(5,s.Inject(I.SheetPermissionInterceptorBaseController)),U(6,I.IMarkSelectionService),U(7,s.Inject(v.SheetsSelectionsService)),U(8,I.IEditorBridgeService),U(9,ie.IRenderManagerService)],z);var Ne=Object.defineProperty,Ae=Object.getOwnPropertyDescriptor,Ve=(i,t,n,e)=>{for(var r=e>1?void 0:e?Ae(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&Ne(t,n,r),r},q=(i,t)=>(n,e)=>t(n,e,i);let Y=class extends s.Disposable{constructor(i,t,n,e){super(),this._sheetInterceptorService=i,this._univerInstanceService=t,this._threadCommentModel=n,this._threadCommentDataSourceService=e,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:i=>{var t;if(i.id===v.RemoveSheetCommand.id){const n=i.params,e=n.unitId?this._univerInstanceService.getUnit(n.unitId):this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!e)return{redos:[],undos:[]};const r=e.getUnitId(),o=n.subUnitId||((t=e.getActiveSheet())==null?void 0:t.getSheetId());if(!o)return{redos:[],undos:[]};const a=this._threadCommentModel.ensureMap(r,o),c=Array.from(a.values()).filter(p=>!p.parentId),u=c.map(p=>p.id),h=this._threadCommentDataSourceService.syncUpdateMutationToColla,m=u.map(p=>({id:C.DeleteCommentMutation.id,params:{unitId:r,subUnitId:o,commentId:p}})),l=c.map(({children:p,...S})=>({id:C.AddCommentMutation.id,params:{unitId:r,subUnitId:o,comment:{...S,children:h?p:void 0},sync:!h}}));return{redos:m,undos:l}}return{redos:[],undos:[]}}}))}};Y=Ve([q(0,s.Inject(v.SheetInterceptorService)),q(1,s.IUniverInstanceService),q(2,s.Inject(C.ThreadCommentModel)),q(3,C.IThreadCommentDataSourceService)],Y);var y=function(){return y=Object.assign||function(i){for(var t,n=1,e=arguments.length;n<e;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},y.apply(this,arguments)},$e=function(i,t){var n={};for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&t.indexOf(e)<0&&(n[e]=i[e]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,e=Object.getOwnPropertySymbols(i);r<e.length;r++)t.indexOf(e[r])<0&&Object.prototype.propertyIsEnumerable.call(i,e[r])&&(n[e[r]]=i[e[r]]);return n},ce=E.forwardRef(function(i,t){var n=i.icon,e=i.id,r=i.className,o=i.extend,a=$e(i,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(e," ").concat(r||"").trim(),u=E.useRef("_".concat(xe()));return ue(n,"".concat(e),{defIds:n.defIds,idSuffix:u.current},y({ref:t,className:c},a),o)});function ue(i,t,n,e,r){return E.createElement(i.tag,y(y({key:t},Be(i,n,r)),e),(ke(i,n).children||[]).map(function(o,a){return ue(o,"".concat(t,"-").concat(i.tag,"-").concat(a),n,void 0,r)}))}function Be(i,t,n){var e=y({},i.attrs);n!=null&&n.colorChannel1&&e.fill==="colorChannel1"&&(e.fill=n.colorChannel1);var r=t.defIds;return!r||r.length===0||(i.tag==="use"&&e["xlink:href"]&&(e["xlink:href"]=e["xlink:href"]+t.idSuffix),Object.entries(e).forEach(function(o){var a=o[0],c=o[1];typeof c=="string"&&(e[a]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),e}function ke(i,t){var n,e=t.defIds;return!e||e.length===0?i:i.tag==="defs"&&(!((n=i.children)===null||n===void 0)&&n.length)?y(y({},i),{children:i.children.map(function(r){return typeof r.attrs.id=="string"&&e&&e.indexOf(r.attrs.id)>-1?y(y({},r),{attrs:y(y({},r.attrs),{id:r.attrs.id+t.idSuffix})}):r})}):i}function xe(){return Math.random().toString(36).substring(2,8)}ce.displayName="UniverIcon";var He={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521C5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345ZM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521C8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345ZM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521C11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521 5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345zM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521 8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345zM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521 11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.84351 3.41861C1.84351 3.01861 2.15531 2.69434 2.53993 2.69434H14.9381C15.3228 2.69434 15.6346 3.01861 15.6346 3.41861V12.4611C15.6346 12.8612 15.3228 13.1854 14.9381 13.1854H8.82117L6.06643 14.6179C5.85054 14.7301 5.59416 14.7181 5.38884 14.5862C5.18352 14.4542 5.05855 14.2211 5.05855 13.9701V13.1854H2.53993C2.15531 13.1854 1.84351 12.8612 1.84351 12.4611L1.84351 3.41861ZM6.45141 12.7982L8.34531 12.0135C8.44201 11.9632 8.54864 11.9371 8.65676 11.9371H14.2417C14.3522 11.9371 14.4417 11.8475 14.4417 11.7371V4.14271C14.4417 4.03225 14.3522 3.94271 14.2417 3.94271H3.23636C3.12591 3.94271 3.03636 4.03225 3.03636 4.14271L3.03636 11.7371C3.03636 11.8475 3.12591 11.9371 3.23636 11.9371L5.75498 11.9371C6.1396 11.9371 6.45141 12.0611 6.45141 12.4611V12.7982Z",fillRule:"evenodd",clipRule:"evenodd"}}]},de=E.forwardRef(function(i,t){return E.createElement(ce,Object.assign({},i,{id:"comment-single",ref:t,icon:He}))});de.displayName="CommentSingle";var ee={exports:{}},x={};/**
25
29
  * @license React
26
30
  * react-jsx-runtime.production.min.js
27
31
  *
@@ -29,11 +33,8 @@
29
33
  *
30
34
  * This source code is licensed under the MIT license found in the
31
35
  * LICENSE file in the root directory of this source tree.
32
- */var de;function Le(){if(de)return x;de=1;var i=E,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),e=Object.prototype.hasOwnProperty,r=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(c,u,h){var m,l={},p=null,S=null;h!==void 0&&(p=""+h),u.key!==void 0&&(p=""+u.key),u.ref!==void 0&&(S=u.ref);for(m in u)e.call(u,m)&&!o.hasOwnProperty(m)&&(l[m]=u[m]);if(c&&c.defaultProps)for(m in u=c.defaultProps,u)l[m]===void 0&&(l[m]=u[m]);return{$$typeof:t,type:c,key:p,ref:S,props:l,_owner:r.current}}return x.Fragment=n,x.jsx=s,x.jsxs=s,x}var me;function We(){return me||(me=1,ee.exports=Le()),ee.exports}var he=We();const Fe=()=>{const i=a.useDependency(a.IUniverInstanceService),t=a.useDependency(d.SheetsThreadCommentPopupService),n=f.useObservable(t.activePopup$),e=a.useDependency(A.SheetsThreadCommentModel);if(f.useObservable(e.commentUpdate$),!n)return null;const{row:r,col:o,unitId:s,subUnitId:c,trigger:u}=n,h=e.getByLocation(s,c,r,o),m=`${a.Tools.chatAtABC(o)}${r+1}`,l=()=>{t.hidePopup()},p=S=>{var g,M,V;return(V=(M=(g=i.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:g.getSheetBySheetId(S))==null?void 0:M.getName())!=null?V:""};return he.jsx(P.ThreadCommentTree,{onClick:()=>{t.persistPopup()},prefix:"cell",id:h,unitId:s,subUnitId:c,type:a.UniverInstanceType.UNIVER_SHEET,refStr:m,onClose:l,getSubUnitName:p,autoFocus:u==="context-menu"})},Ge=()=>{var w;const i=a.useDependency(I.IMarkSelectionService),t=a.useDependency(a.IUniverInstanceService),n=a.useDependency(d.SheetsThreadCommentPopupService),e=t.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET),r=e.getUnitId(),o=a.useDependency(a.ICommandService),s=E.useMemo(()=>e.activeSheet$.pipe(k.map(_=>_==null?void 0:_.getSheetId())),[e.activeSheet$]),c=f.useObservable(s,(w=e.getActiveSheet())==null?void 0:w.getSheetId()),u=E.useRef(),h=a.useDependency(P.ThreadCommentPanelService),m=f.useObservable(h.activeCommentId$),l=f.useObservable(h.panelVisible$,h.panelVisible),p=E.useCallback(_=>{const R=e.getSheets(),T={};R.forEach((O,b)=>{T[O.getSheetId()]=b});const j=O=>O.map(b=>{var ve;const D=$.singleReferenceToGrid(b.ref),nt=[(ve=T[b.subUnitId])!=null?ve:0,D.row,D.column];return{...b,p:nt}}).sort((b,D)=>b.p[0]===D.p[0]?b.p[1]===D.p[1]?b.p[2]-D.p[2]:b.p[1]-D.p[1]:b.p[0]-D.p[0]);return[...j(_.filter(O=>!O.resolved)),...j(_.filter(O=>O.resolved))]},[e]),S=E.useCallback(_=>{var R;if(_.unitId===r&&_.subUnitId===c&&!_.resolved){const{row:T,column:j}=$.singleReferenceToGrid(_.ref),O=e.getSheetBySheetId(_.subUnitId),b=(R=O==null?void 0:O.getMergedCell(T,j))!=null?R:{startColumn:j,endColumn:j,startRow:T,endRow:T};if(!Number.isNaN(T)&&!Number.isNaN(j))return i.addShape({range:b,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null})}},[i,c,r]),g=_=>{var R,T;return(T=(R=e.getSheetBySheetId(_))==null?void 0:R.getName())!=null?T:""},M=()=>{o.executeCommand(B.id)},V=_=>{m&&m.unitId===_.unitId&&m.subUnitId===_.subUnitId&&m.commentId===_.id||(u.current&&(i.removeShape(u.current),u.current=null),u.current=S(_))},H=()=>{u.current&&(i.removeShape(u.current),u.current=null)},re=(_,R)=>{R&&n.hidePopup()};return E.useEffect(()=>{!l&&u.current&&i.removeShape(u.current)},[i,l]),he.jsx(P.ThreadCommentPanel,{unitId:r,subUnitId$:s,type:a.UniverInstanceType.UNIVER_SHEET,onAdd:M,getSubUnitName:g,onResolve:re,sortComments:p,onItemEnter:V,onItemLeave:H,onDeleteComment:()=>(H(),!0)})},Ze=i=>({id:B.id,type:f.MenuItemType.BUTTON,icon:K,title:"sheetThreadComment.menu.addComment",hidden$:f.getMenuHiddenObservable(i,a.UniverInstanceType.UNIVER_SHEET),disabled$:I.getCurrentRangeDisable$(i,{workbookTypes:[v.WorkbookCommentPermission],worksheetTypes:[v.WorksheetViewPermission],rangeTypes:[v.RangeProtectionPermissionViewPoint]})}),ze=i=>({id:P.ToggleSheetCommentPanelOperation.id,type:f.MenuItemType.BUTTON,icon:K,tooltip:"sheetThreadComment.menu.commentManagement",disabled$:I.getCurrentRangeDisable$(i,{workbookTypes:[v.WorkbookCommentPermission],worksheetTypes:[v.WorksheetViewPermission],rangeTypes:[v.RangeProtectionPermissionViewPoint]}),hidden$:f.getMenuHiddenObservable(i,a.UniverInstanceType.UNIVER_SHEET)}),qe={id:B.id,binding:f.KeyCode.M|f.MetaKeys.CTRL_COMMAND|f.MetaKeys.ALT,preconditions:I.whenSheetEditorFocused},Ye={[f.RibbonStartGroup.OTHERS]:{[P.ToggleSheetCommentPanelOperation.id]:{order:1,menuItemFactory:ze}},[f.ContextMenuPosition.MAIN_AREA]:{[f.ContextMenuGroup.OTHERS]:{[B.id]:{order:0,menuItemFactory:Ze}}}};var Je=Object.defineProperty,Ke=Object.getOwnPropertyDescriptor,Qe=(i,t,n,e)=>{for(var r=e>1?void 0:e?Ke(t,n):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&Je(t,n,r),r},te=(i,t)=>(n,e)=>t(n,e,i);let J=class extends a.Disposable{constructor(i,t,n){super(),this._menuManagerService=i,this._componentManager=t,this._shortcutService=n,this._initMenu(),this._initShortcut(),this._initComponent()}_initShortcut(){this._shortcutService.registerShortcut(qe)}_initMenu(){this._menuManagerService.mergeMenu(Ye)}_initComponent(){[[oe,Fe],[P.THREAD_COMMENT_PANEL,Ge],[K,ue]].forEach(([i,t])=>{this._componentManager.register(i,t)})}};J=Qe([te(0,f.IMenuManagerService),te(1,a.Inject(f.ComponentManager)),te(2,f.IShortcutService)],J);var le=Object.defineProperty,Xe=Object.getOwnPropertyDescriptor,et=(i,t,n)=>t in i?le(i,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[t]=n,tt=(i,t,n,e)=>{for(var r=e>1?void 0:e?Xe(t,n):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(e?s(t,n,r):s(r))||r);return e&&r&&le(t,n,r),r},ne=(i,t)=>(n,e)=>t(n,e,i),pe=(i,t,n)=>et(i,typeof t!="symbol"?t+"":t,n);d.UniverSheetsThreadCommentUIPlugin=class extends a.Plugin{constructor(t=Ie,n,e,r){super(),this._config=t,this._injector=n,this._commandService=e,this._configService=r;const{menu:o,...s}=this._config;o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(Ce,s)}onStarting(){[[J],[W],[F],[Z],[Y],[z],[d.SheetsThreadCommentPopupService]].forEach(t=>{this._injector.add(t)}),[B].forEach(t=>{this._commandService.registerCommand(t)}),this._injector.get(J)}onReady(){this._injector.get(W),this._injector.get(Y)}onRendered(){this._injector.get(F),this._injector.get(Z),this._injector.get(z)}},pe(d.UniverSheetsThreadCommentUIPlugin,"pluginName",Q),pe(d.UniverSheetsThreadCommentUIPlugin,"type",a.UniverInstanceType.UNIVER_SHEET),d.UniverSheetsThreadCommentUIPlugin=tt([a.DependentOn(P.UniverThreadCommentUIPlugin,A.UniverSheetsThreadCommentPlugin),ne(1,a.Inject(a.Injector)),ne(2,a.Inject(a.ICommandService)),ne(3,a.IConfigService)],d.UniverSheetsThreadCommentUIPlugin),Object.defineProperty(d,"UniverThreadCommentUIPlugin",{enumerable:!0,get:()=>P.UniverThreadCommentUIPlugin}),Object.defineProperty(d,"AddCommentCommand",{enumerable:!0,get:()=>C.AddCommentCommand}),Object.defineProperty(d,"DeleteCommentCommand",{enumerable:!0,get:()=>C.DeleteCommentCommand}),Object.defineProperty(d,"DeleteCommentTreeCommand",{enumerable:!0,get:()=>C.DeleteCommentTreeCommand}),Object.defineProperty(d,"IThreadCommentDataSourceService",{enumerable:!0,get:()=>C.IThreadCommentDataSourceService}),Object.defineProperty(d,"ResolveCommentCommand",{enumerable:!0,get:()=>C.ResolveCommentCommand}),Object.defineProperty(d,"UpdateCommentCommand",{enumerable:!0,get:()=>C.UpdateCommentCommand}),d.SHEETS_THREAD_COMMENT=Q,d.ShowAddSheetCommentModalOperation=B,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
33
-
36
+ */var me;function Le(){if(me)return x;me=1;var i=E,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),e=Object.prototype.hasOwnProperty,r=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function a(c,u,h){var m,l={},p=null,S=null;h!==void 0&&(p=""+h),u.key!==void 0&&(p=""+u.key),u.ref!==void 0&&(S=u.ref);for(m in u)e.call(u,m)&&!o.hasOwnProperty(m)&&(l[m]=u[m]);if(c&&c.defaultProps)for(m in u=c.defaultProps,u)l[m]===void 0&&(l[m]=u[m]);return{$$typeof:t,type:c,key:p,ref:S,props:l,_owner:r.current}}return x.Fragment=n,x.jsx=a,x.jsxs=a,x}var he;function We(){return he||(he=1,ee.exports=Le()),ee.exports}var le=We();const Fe=()=>{const i=s.useDependency(s.IUniverInstanceService),t=s.useDependency(d.SheetsThreadCommentPopupService),n=f.useObservable(t.activePopup$),e=s.useDependency(A.SheetsThreadCommentModel);if(f.useObservable(e.commentUpdate$),!n)return null;const{row:r,col:o,unitId:a,subUnitId:c,trigger:u}=n,h=e.getByLocation(a,c,r,o),m=`${s.Tools.chatAtABC(o)}${r+1}`,l=()=>{t.hidePopup()},p=S=>{var g,M,V;return(V=(M=(g=i.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET))==null?void 0:g.getSheetBySheetId(S))==null?void 0:M.getName())!=null?V:""};return le.jsx(P.ThreadCommentTree,{onClick:()=>{t.persistPopup()},prefix:"cell",id:h,unitId:a,subUnitId:c,type:s.UniverInstanceType.UNIVER_SHEET,refStr:m,onClose:l,getSubUnitName:p,autoFocus:u==="context-menu"})},Ge=()=>{var w;const i=s.useDependency(I.IMarkSelectionService),t=s.useDependency(s.IUniverInstanceService),n=s.useDependency(d.SheetsThreadCommentPopupService),e=t.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET),r=e.getUnitId(),o=s.useDependency(s.ICommandService),a=E.useMemo(()=>e.activeSheet$.pipe(k.map(_=>_==null?void 0:_.getSheetId())),[e.activeSheet$]),c=f.useObservable(a,(w=e.getActiveSheet())==null?void 0:w.getSheetId()),u=E.useRef(),h=s.useDependency(P.ThreadCommentPanelService),m=f.useObservable(h.activeCommentId$),l=f.useObservable(h.panelVisible$,h.panelVisible),p=E.useCallback(_=>{const R=e.getSheets(),T={};R.forEach((O,b)=>{T[O.getSheetId()]=b});const j=O=>O.map(b=>{var Se;const D=$.singleReferenceToGrid(b.ref),nt=[(Se=T[b.subUnitId])!=null?Se:0,D.row,D.column];return{...b,p:nt}}).sort((b,D)=>b.p[0]===D.p[0]?b.p[1]===D.p[1]?b.p[2]-D.p[2]:b.p[1]-D.p[1]:b.p[0]-D.p[0]);return[...j(_.filter(O=>!O.resolved)),...j(_.filter(O=>O.resolved))]},[e]),S=E.useCallback(_=>{var R;if(_.unitId===r&&_.subUnitId===c&&!_.resolved){const{row:T,column:j}=$.singleReferenceToGrid(_.ref),O=e.getSheetBySheetId(_.subUnitId),b=(R=O==null?void 0:O.getMergedCell(T,j))!=null?R:{startColumn:j,endColumn:j,startRow:T,endRow:T};if(!Number.isNaN(T)&&!Number.isNaN(j))return i.addShape({range:b,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null})}},[i,c,r]),g=_=>{var R,T;return(T=(R=e.getSheetBySheetId(_))==null?void 0:R.getName())!=null?T:""},M=()=>{o.executeCommand(B.id)},V=_=>{m&&m.unitId===_.unitId&&m.subUnitId===_.subUnitId&&m.commentId===_.id||(u.current&&(i.removeShape(u.current),u.current=null),u.current=S(_))},H=()=>{u.current&&(i.removeShape(u.current),u.current=null)},re=(_,R)=>{R&&n.hidePopup()};return E.useEffect(()=>{!l&&u.current&&i.removeShape(u.current)},[i,l]),le.jsx(P.ThreadCommentPanel,{unitId:r,subUnitId$:a,type:s.UniverInstanceType.UNIVER_SHEET,onAdd:M,getSubUnitName:g,onResolve:re,sortComments:p,onItemEnter:V,onItemLeave:H,onDeleteComment:()=>(H(),!0)})},Ze=i=>({id:B.id,type:f.MenuItemType.BUTTON,icon:K,title:"sheetThreadComment.menu.addComment",hidden$:f.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_SHEET),disabled$:I.getCurrentRangeDisable$(i,{workbookTypes:[v.WorkbookCommentPermission],worksheetTypes:[v.WorksheetViewPermission],rangeTypes:[v.RangeProtectionPermissionViewPoint]})}),ze=i=>({id:P.ToggleSheetCommentPanelOperation.id,type:f.MenuItemType.BUTTON,icon:K,tooltip:"sheetThreadComment.menu.commentManagement",disabled$:I.getCurrentRangeDisable$(i,{workbookTypes:[v.WorkbookCommentPermission],worksheetTypes:[v.WorksheetViewPermission],rangeTypes:[v.RangeProtectionPermissionViewPoint]}),hidden$:f.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_SHEET)}),qe={id:B.id,binding:f.KeyCode.M|f.MetaKeys.CTRL_COMMAND|f.MetaKeys.ALT,preconditions:I.whenSheetEditorFocused},Ye={[f.RibbonStartGroup.OTHERS]:{[P.ToggleSheetCommentPanelOperation.id]:{order:1,menuItemFactory:ze}},[f.ContextMenuPosition.MAIN_AREA]:{[f.ContextMenuGroup.OTHERS]:{[B.id]:{order:0,menuItemFactory:Ze}}}};var Je=Object.defineProperty,Ke=Object.getOwnPropertyDescriptor,Qe=(i,t,n,e)=>{for(var r=e>1?void 0:e?Ke(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&Je(t,n,r),r},te=(i,t)=>(n,e)=>t(n,e,i);let J=class extends s.Disposable{constructor(i,t,n){super(),this._menuManagerService=i,this._componentManager=t,this._shortcutService=n,this._initMenu(),this._initShortcut(),this._initComponent()}_initShortcut(){this._shortcutService.registerShortcut(qe)}_initMenu(){this._menuManagerService.mergeMenu(Ye)}_initComponent(){[[oe,Fe],[P.THREAD_COMMENT_PANEL,Ge],[K,de]].forEach(([i,t])=>{this._componentManager.register(i,t)})}};J=Qe([te(0,f.IMenuManagerService),te(1,s.Inject(f.ComponentManager)),te(2,f.IShortcutService)],J);var pe=Object.defineProperty,Xe=Object.getOwnPropertyDescriptor,et=(i,t,n)=>t in i?pe(i,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[t]=n,tt=(i,t,n,e)=>{for(var r=e>1?void 0:e?Xe(t,n):t,o=i.length-1,a;o>=0;o--)(a=i[o])&&(r=(e?a(t,n,r):a(r))||r);return e&&r&&pe(t,n,r),r},ne=(i,t)=>(n,e)=>t(n,e,i),ve=(i,t,n)=>et(i,typeof t!="symbol"?t+"":t,n);d.UniverSheetsThreadCommentUIPlugin=class extends s.Plugin{constructor(t=ae,n,e,r){super(),this._config=t,this._injector=n,this._commandService=e,this._configService=r;const{menu:o,...a}=s.merge({},ae,this._config);o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(Ie,a)}onStarting(){[[J],[W],[F],[Z],[Y],[z],[d.SheetsThreadCommentPopupService]].forEach(t=>{this._injector.add(t)}),[B].forEach(t=>{this._commandService.registerCommand(t)}),this._injector.get(J)}onReady(){this._injector.get(W),this._injector.get(Y)}onRendered(){this._injector.get(F),this._injector.get(Z),this._injector.get(z)}},ve(d.UniverSheetsThreadCommentUIPlugin,"pluginName",Q),ve(d.UniverSheetsThreadCommentUIPlugin,"type",s.UniverInstanceType.UNIVER_SHEET),d.UniverSheetsThreadCommentUIPlugin=tt([s.DependentOn(P.UniverThreadCommentUIPlugin,A.UniverSheetsThreadCommentPlugin),ne(1,s.Inject(s.Injector)),ne(2,s.Inject(s.ICommandService)),ne(3,s.IConfigService)],d.UniverSheetsThreadCommentUIPlugin),Object.defineProperty(d,"UniverThreadCommentUIPlugin",{enumerable:!0,get:()=>P.UniverThreadCommentUIPlugin}),Object.defineProperty(d,"AddCommentCommand",{enumerable:!0,get:()=>C.AddCommentCommand}),Object.defineProperty(d,"DeleteCommentCommand",{enumerable:!0,get:()=>C.DeleteCommentCommand}),Object.defineProperty(d,"DeleteCommentTreeCommand",{enumerable:!0,get:()=>C.DeleteCommentTreeCommand}),Object.defineProperty(d,"IThreadCommentDataSourceService",{enumerable:!0,get:()=>C.IThreadCommentDataSourceService}),Object.defineProperty(d,"ResolveCommentCommand",{enumerable:!0,get:()=>C.ResolveCommentCommand}),Object.defineProperty(d,"UpdateCommentCommand",{enumerable:!0,get:()=>C.UpdateCommentCommand}),d.SHEETS_THREAD_COMMENT=Q,d.ShowAddSheetCommentModalOperation=B,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
34
37
 
35
- // @univerjs-pro/thread-comment-datasource/index
36
- (function(_0x5adc2b,_0x4a13c1){const _0x47cbfd=_0x1a92,_0x347189=_0x5adc2b();while(!![]){try{const _0x238598=parseInt(_0x47cbfd(0x237))/0x1*(parseInt(_0x47cbfd(0x21b))/0x2)+-parseInt(_0x47cbfd(0x1f2))/0x3+parseInt(_0x47cbfd(0x1f9))/0x4+-parseInt(_0x47cbfd(0x1d9))/0x5*(-parseInt(_0x47cbfd(0x235))/0x6)+parseInt(_0x47cbfd(0x1e3))/0x7+parseInt(_0x47cbfd(0x219))/0x8+-parseInt(_0x47cbfd(0x240))/0x9;if(_0x238598===_0x4a13c1)break;else _0x347189['push'](_0x347189['shift']());}catch(_0x5b6c59){_0x347189['push'](_0x347189['shift']());}}}(_0x39cf,0xe1d15),function(_0x3e0795,_0x1016f1){const _0x240c5a=_0x1a92;typeof exports==_0x240c5a(0x203)&&typeof module<'u'?_0x1016f1(exports,require(_0x240c5a(0x1f7)),require('@univerjs-pro/license'),require(_0x240c5a(0x223)),require('@univerjs/thread-comment-ui'),require(_0x240c5a(0x22a)),require(_0x240c5a(0x241)),require(_0x240c5a(0x220))):typeof define==_0x240c5a(0x245)&&define[_0x240c5a(0x1dd)]?define([_0x240c5a(0x228),'@univerjs-pro/collaboration-client',_0x240c5a(0x1c7),'@univerjs/core',_0x240c5a(0x1ea),_0x240c5a(0x22a),_0x240c5a(0x241),'@univerjs/network'],_0x1016f1):(_0x3e0795=typeof globalThis<'u'?globalThis:_0x3e0795||self,_0x1016f1(_0x3e0795[_0x240c5a(0x230)]={},_0x3e0795[_0x240c5a(0x1c4)],_0x3e0795[_0x240c5a(0x224)],_0x3e0795['UniverCore'],_0x3e0795[_0x240c5a(0x231)],_0x3e0795[_0x240c5a(0x233)],_0x3e0795[_0x240c5a(0x241)],_0x3e0795[_0x240c5a(0x23e)]));}(this,function(_0x3fe389,_0x38535f,_0x5dec0e,_0x471e7b,_0x2a825,_0x11c43c,_0x470645,_0x131a66){'use strict';const _0x3f17ea=_0x1a92;const _0x50c45f=_0x3f17ea(0x1c2);var _0x34e685=(_0x500887=>(_0x500887[_0x500887[_0x3f17ea(0x1e4)]=0x0]=_0x3f17ea(0x1e4),_0x500887[_0x500887[_0x3f17ea(0x20b)]=0x1]=_0x3f17ea(0x20b),_0x500887[_0x500887['UNRECOGNIZED']=-0x1]=_0x3f17ea(0x21a),_0x500887))(_0x34e685||{}),_0x2389c5=(_0xf516c5=>(_0xf516c5[_0xf516c5['Unknown']=0x0]=_0x3f17ea(0x23d),_0xf516c5[_0xf516c5['Add']=0x1]=_0x3f17ea(0x206),_0xf516c5[_0xf516c5[_0x3f17ea(0x205)]=0x2]=_0x3f17ea(0x205),_0xf516c5[_0xf516c5[_0x3f17ea(0x1dc)]=0x3]='Edit',_0xf516c5[_0xf516c5[_0x3f17ea(0x1c1)]=0x4]=_0x3f17ea(0x1c1),_0xf516c5[_0xf516c5[_0x3f17ea(0x21c)]=0x5]=_0x3f17ea(0x21c),_0xf516c5[_0xf516c5[_0x3f17ea(0x21a)]=-0x1]=_0x3f17ea(0x21a),_0xf516c5))(_0x2389c5||{});const _0x429cd=_0x504a37=>_0x471e7b[_0x3f17ea(0x1e1)](new Date(+_0x504a37))[_0x3f17ea(0x1cd)](_0x3f17ea(0x1d0)),_0x479de3=async(_0xd2ff4e,_0x358d6e)=>{const _0x125214=_0x3f17ea,_0xffdcb5=_0xd2ff4e[_0x125214(0x1f1)](_0x471e7b[_0x125214(0x21d)]),_0x54c467=_0xd2ff4e['get'](_0x131a66[_0x125214(0x1d7)]);_0x358d6e[_0x125214(0x239)](_0xca914=>{const _0x201dc9=_0x125214;_0xffdcb5[_0x201dc9(0x1cf)](_0xca914)&&_0x358d6e['delete'](_0xca914);}),_0x358d6e['size']&&(await _0x54c467[_0x125214(0x1f1)](_0x125214(0x1da),{'params':{'userIDs':[..._0x358d6e]}}))[_0x125214(0x1fc)][_0x125214(0x244)][_0x125214(0x239)](_0x2dd200=>{const _0x204bc9=_0x125214;_0x2dd200&&_0xffdcb5[_0x204bc9(0x201)](_0x2dd200);});};var _0x174499=Object['defineProperty'],_0x2779a6=Object['getOwnPropertyDescriptor'],_0x4c8dc3=(_0x208f6a,_0xee7912,_0x268e97,_0x45e18a)=>{for(var _0x352896=_0x45e18a>0x1?void 0x0:_0x45e18a?_0x2779a6(_0xee7912,_0x268e97):_0xee7912,_0x5f56d5=_0x208f6a['length']-0x1,_0x27ce27;_0x5f56d5>=0x0;_0x5f56d5--)(_0x27ce27=_0x208f6a[_0x5f56d5])&&(_0x352896=(_0x45e18a?_0x27ce27(_0xee7912,_0x268e97,_0x352896):_0x27ce27(_0x352896))||_0x352896);return _0x45e18a&&_0x352896&&_0x174499(_0xee7912,_0x268e97,_0x352896),_0x352896;},_0x30cd72=(_0x2efe3f,_0x393323)=>(_0x29e7df,_0x309a18)=>_0x393323(_0x29e7df,_0x309a18,_0x2efe3f);let _0xceb039=class extends _0x471e7b['Disposable']{constructor(_0x16dc83,_0x3f2723,_0x285018,_0x1326d2){const _0x1c342a=_0x3f17ea;super(),this[_0x1c342a(0x1d5)]=_0x16dc83,this['_threadCommentModel']=_0x3f2723,this[_0x1c342a(0x214)]=_0x285018,this[_0x1c342a(0x232)]=_0x1326d2,this['_init'](),this[_0x1c342a(0x204)]();}[_0x3f17ea(0x204)](){const _0x5eb2dc=_0x3f17ea;this[_0x5eb2dc(0x218)](this[_0x5eb2dc(0x22d)][_0x5eb2dc(0x1fb)][_0x5eb2dc(0x1e7)](_0x470645['bufferTime'](0x10))[_0x5eb2dc(0x1df)](_0x407dfd=>{const _0x41c052=_0x5eb2dc,_0x557203=new Set();_0x407dfd[_0x41c052(0x239)](_0x34ed7d=>{const _0x2c3ef0=_0x41c052;switch(_0x34ed7d[_0x2c3ef0(0x216)]){case _0x2c3ef0(0x1ed):{const _0x47de37=_0x34ed7d[_0x2c3ef0(0x229)][_0x2c3ef0(0x208)];_0x557203['add'](_0x47de37);break;}}}),_0x479de3(this['_injector'],_0x557203);}));}['_init'](){const _0x7a448e=_0x3f17ea;this[_0x7a448e(0x218)](this[_0x7a448e(0x1d5)][_0x7a448e(0x1fb)][_0x7a448e(0x1df)](async _0x5f286f=>{const _0x1abc0a=_0x7a448e;var _0x1faff8,_0x19eaad,_0x594cc4,_0x3de8bc;const _0x38d8e4=(_0x1faff8=this['_threadCommentModel'][_0x1abc0a(0x22e)](_0x5f286f['unitId'])[_0x1abc0a(0x1f5)](_0x30656e=>_0x30656e[_0x1abc0a(0x1d4)]===_0x5f286f[_0x1abc0a(0x1d4)]))==null?void 0x0:_0x1faff8['root'];if(!_0x38d8e4)return;const {unitId:_0x47f705,subUnitId:_0x251350}=_0x38d8e4;switch(_0x5f286f['user']&&this[_0x1abc0a(0x214)]['addUser'](_0x5f286f[_0x1abc0a(0x210)]),_0x5f286f[_0x1abc0a(0x216)]){case _0x2389c5[_0x1abc0a(0x206)]:break;case _0x2389c5['Reply']:{this[_0x1abc0a(0x22d)][_0x1abc0a(0x238)](_0x47f705,_0x251350,{'unitId':_0x47f705,'subUnitId':_0x251350,'ref':'','id':_0x5f286f[_0x1abc0a(0x226)],'dT':_0x429cd(+_0x5f286f[_0x1abc0a(0x1ff)]),'threadId':_0x5f286f['threadId'],'personId':(_0x594cc4=(_0x19eaad=_0x5f286f[_0x1abc0a(0x210)])==null?void 0x0:_0x19eaad[_0x1abc0a(0x209)])!=null?_0x594cc4:_0x5f286f[_0x1abc0a(0x1e0)],'text':JSON['parse'](_0x5f286f[_0x1abc0a(0x221)]),'parentId':_0x38d8e4['id']});break;}case _0x2389c5[_0x1abc0a(0x1c1)]:{const _0x4d32a7=this[_0x1abc0a(0x22d)][_0x1abc0a(0x1c6)](_0x47f705,_0x251350,_0x5f286f['replyId']);_0x4d32a7&&_0x4d32a7[_0x1abc0a(0x1ee)]&&this[_0x1abc0a(0x22d)][_0x1abc0a(0x1e6)](_0x47f705,_0x251350,_0x5f286f[_0x1abc0a(0x226)]);break;}case _0x2389c5[_0x1abc0a(0x1dc)]:{this[_0x1abc0a(0x22d)][_0x1abc0a(0x23f)](_0x47f705,_0x251350,{'commentId':_0x5f286f['replyId'],'text':JSON[_0x1abc0a(0x222)](_0x5f286f[_0x1abc0a(0x221)])});break;}case _0x2389c5['Solve']:{const _0x50ab12=(_0x3de8bc=this['_threadCommentModel']['getUnit'](_0x5f286f[_0x1abc0a(0x242)])['find'](_0x2ddec5=>_0x2ddec5[_0x1abc0a(0x1d4)]===_0x5f286f[_0x1abc0a(0x1d4)]))==null?void 0x0:_0x3de8bc['root'];_0x50ab12&&this[_0x1abc0a(0x22d)][_0x1abc0a(0x1f6)](_0x47f705,_0x251350,_0x50ab12['id'],_0x5f286f[_0x1abc0a(0x1ec)]===_0x34e685[_0x1abc0a(0x20b)]);break;}}}));}};_0xceb039=_0x4c8dc3([_0x30cd72(0x0,_0x471e7b[_0x3f17ea(0x1c3)](_0x38535f[_0x3f17ea(0x215)])),_0x30cd72(0x1,_0x471e7b[_0x3f17ea(0x1c3)](_0x11c43c['ThreadCommentModel'])),_0x30cd72(0x2,_0x471e7b[_0x3f17ea(0x1c3)](_0x471e7b[_0x3f17ea(0x21d)])),_0x30cd72(0x3,_0x471e7b[_0x3f17ea(0x1c3)](_0x471e7b[_0x3f17ea(0x22f)]))],_0xceb039);const _0x4936b6='thread-comment-data-source.config',_0x57351b={};var _0x55342f=Object[_0x3f17ea(0x1ef)],_0x2dc9f6=Object[_0x3f17ea(0x243)],_0x1c5ce6=(_0x562653,_0x26a18f,_0x52b383,_0x50c2d3)=>{const _0x14ae44=_0x3f17ea;for(var _0x6b405e=_0x50c2d3>0x1?void 0x0:_0x50c2d3?_0x2dc9f6(_0x26a18f,_0x52b383):_0x26a18f,_0xe03323=_0x562653[_0x14ae44(0x1c8)]-0x1,_0x4c8a8a;_0xe03323>=0x0;_0xe03323--)(_0x4c8a8a=_0x562653[_0xe03323])&&(_0x6b405e=(_0x50c2d3?_0x4c8a8a(_0x26a18f,_0x52b383,_0x6b405e):_0x4c8a8a(_0x6b405e))||_0x6b405e);return _0x50c2d3&&_0x6b405e&&_0x55342f(_0x26a18f,_0x52b383,_0x6b405e),_0x6b405e;},_0x4e5365=(_0x28e1dd,_0x55b330)=>(_0x2bc45f,_0x1f7447)=>_0x55b330(_0x2bc45f,_0x1f7447,_0x28e1dd);function _0x5b82b1(_0x10e2c2,_0x4b6f2a){const _0x85ddea=_0x3f17ea,_0x27acf9=_0x10e2c2['replies'][0x0];return{..._0x4b6f2a,'id':_0x27acf9['replyId'],'resolved':_0x10e2c2[_0x85ddea(0x1ec)]===0x1,'dT':_0x429cd(_0x27acf9['createTimestamp']),'personId':_0x27acf9[_0x85ddea(0x1e0)],'threadId':_0x27acf9[_0x85ddea(0x1d4)]};}function _0x17f5a9(_0x75444f,_0x39a57f,_0x5debed){const _0x23b577=_0x3f17ea;var _0x1da268,_0x5d2ba6;if(((_0x5d2ba6=(_0x1da268=_0x75444f==null?void 0x0:_0x75444f[_0x23b577(0x246)])==null?void 0x0:_0x1da268['length'])!=null?_0x5d2ba6:0x0)>0x0){const _0x5143c3=(_0x28f140,_0x27238c)=>({'id':_0x28f140[_0x23b577(0x226)],'threadId':_0x28f140[_0x23b577(0x1d4)],'dT':_0x429cd(_0x28f140[_0x23b577(0x1ff)]),'personId':_0x28f140['userId'],'resolved':_0x75444f['solved']===_0x34e685['Solved'],'unitId':_0x39a57f,'subUnitId':_0x5debed,'text':JSON[_0x23b577(0x222)](_0x28f140[_0x23b577(0x221)]),'parentId':_0x27238c}),_0x247522=_0x5143c3(_0x75444f[_0x23b577(0x246)][0x0]);return{..._0x247522,'children':_0x75444f['replies']['slice'](0x1)[_0x23b577(0x1e5)](_0xe30fbf=>_0x5143c3(_0xe30fbf,_0x247522['id']))};}return null;}let _0x16c945=class{constructor(_0x396f46,_0x1559e1,_0x5e81b6,_0x42473f){const _0x6680e9=_0x3f17ea;this[_0x6680e9(0x1f8)]=_0x396f46,this[_0x6680e9(0x214)]=_0x1559e1,this[_0x6680e9(0x20e)]=_0x5e81b6,this['_injector']=_0x42473f;}async['addComment'](_0x141156){const _0x522bcc=_0x3f17ea;var _0xd5820a,_0x15faab;const {parentId:_0x5760d0,unitId:_0x329842,text:_0x532a49,threadId:_0x5ae548}=_0x141156,_0x5b5e5b=(_0x15faab=(_0xd5820a=_0x532a49[_0x522bcc(0x1ca)])==null?void 0x0:_0xd5820a[_0x522bcc(0x23a)](_0x261b48=>_0x261b48[_0x522bcc(0x225)]===_0x471e7b[_0x522bcc(0x236)][_0x522bcc(0x20d)])[_0x522bcc(0x1e5)](_0x3962cb=>_0x3962cb[_0x522bcc(0x1f3)]))!=null?_0x15faab:[],_0x4a052e=JSON[_0x522bcc(0x1d2)](_0x532a49),_0x339c85=(await this[_0x522bcc(0x20e)][_0x522bcc(0x1e9)](_0x329842))[_0x522bcc(0x234)]();if(_0x5760d0){const _0x2bffdc={'memberId':_0x339c85,'unitId':_0x329842,'content':_0x4a052e,'mention':_0x5b5e5b,'threadId':_0x5ae548},_0x18c814=(await this['_httpService']['post'](_0x522bcc(0x200)+_0x329842+_0x522bcc(0x1de),{'body':_0x2bffdc}))['body'][_0x522bcc(0x202)];return{..._0x141156,'id':_0x18c814[_0x522bcc(0x226)],'dT':_0x471e7b[_0x522bcc(0x1e1)](+_0x18c814['createTimestamp'])['format'](_0x522bcc(0x1d0)),'personId':_0x18c814[_0x522bcc(0x1e0)]};}else{const _0x24d82f={'memberId':_0x339c85,'unitId':_0x329842,'content':_0x4a052e,'mention':_0x5b5e5b},_0x3204e3=await this[_0x522bcc(0x1f8)]['post']('/universer-api/comment/unit/'+_0x329842+_0x522bcc(0x1ce),{'body':_0x24d82f});return _0x5b82b1(_0x3204e3[_0x522bcc(0x1fc)]['comment'],_0x141156);}}async[_0x3f17ea(0x23f)](_0x570b9f){const _0x4b5797=_0x3f17ea;var _0xdf5aed,_0xf5dc2a;const {text:_0x6f884b,unitId:_0x244f9d}=_0x570b9f,_0x1c705b=(_0xf5dc2a=(_0xdf5aed=_0x6f884b[_0x4b5797(0x1ca)])==null?void 0x0:_0xdf5aed[_0x4b5797(0x23a)](_0x305454=>_0x305454[_0x4b5797(0x225)]===_0x471e7b[_0x4b5797(0x236)][_0x4b5797(0x20d)])['map'](_0x4ddc07=>_0x4ddc07['rangeId']))!=null?_0xf5dc2a:[],_0x3034ea=JSON[_0x4b5797(0x1d2)](_0x6f884b),_0x108135=_0x570b9f['threadId'],_0x4c5408=_0x570b9f['id'],_0x59de8e={'memberId':(await this[_0x4b5797(0x20e)]['requireSession'](_0x244f9d))[_0x4b5797(0x234)](),'unitId':_0x244f9d,'threadId':_0x108135,'mention':_0x1c705b,'content':_0x3034ea,'replyId':_0x4c5408},_0x5821a5=await this[_0x4b5797(0x1f8)][_0x4b5797(0x1d1)](_0x4b5797(0x200)+_0x244f9d+_0x4b5797(0x23b),{'body':_0x59de8e});return!_0x5821a5[_0x4b5797(0x1fc)][_0x4b5797(0x23c)]||_0x5821a5[_0x4b5797(0x1fc)]['error'][_0x4b5797(0x1cc)]===0x1;}async[_0x3f17ea(0x1f6)](_0x26d079){const _0x5e7c7e=_0x3f17ea,{unitId:_0x42d137}=_0x26d079,_0x5938b3=_0x26d079['threadId'],_0x557604={'memberId':this['_userService'][_0x5e7c7e(0x22b)]()[_0x5e7c7e(0x209)],'unitId':_0x42d137,'threadId':_0x5938b3,'solved':_0x26d079[_0x5e7c7e(0x1d3)]?_0x34e685[_0x5e7c7e(0x20b)]:_0x34e685[_0x5e7c7e(0x1e4)]},_0x535f08=await this[_0x5e7c7e(0x1f8)]['post'](_0x5e7c7e(0x200)+_0x42d137+'/solved',{'body':_0x557604});return!_0x535f08[_0x5e7c7e(0x1fc)][_0x5e7c7e(0x23c)]||_0x535f08[_0x5e7c7e(0x1fc)][_0x5e7c7e(0x23c)][_0x5e7c7e(0x1cc)]===0x1;}async[_0x3f17ea(0x1e6)](_0x1d3318,_0x3444e0,_0x4f5664,_0x1274b2){const _0x42c08e=_0x3f17ea,_0x1a81c6={'memberId':(await this[_0x42c08e(0x20e)]['requireSession'](_0x1d3318))[_0x42c08e(0x234)](),'threadId':_0x4f5664,'replyId':_0x1274b2,'unitId':_0x1d3318},_0x274eb3=await this[_0x42c08e(0x1f8)]['post'](_0x42c08e(0x200)+_0x1d3318+_0x42c08e(0x1d6),{'body':_0x1a81c6});return!_0x274eb3[_0x42c08e(0x1fc)][_0x42c08e(0x23c)]||_0x274eb3[_0x42c08e(0x1fc)]['error']['code']===0x1;}async[_0x3f17ea(0x1e8)](_0x3d62b6,_0x41008a,_0x1ea785){const _0x5200a=_0x3f17ea,_0x14e03e={'unitId':_0x3d62b6,'threadId':_0x1ea785},_0x5a4754=await this[_0x5200a(0x1f8)][_0x5200a(0x1d1)](_0x5200a(0x200)+_0x3d62b6+_0x5200a(0x1fe),{'body':_0x14e03e}),_0xb4fd1b=_0x1ea785['map'](_0x4a8b30=>_0x17f5a9(_0x5a4754[_0x5200a(0x1fc)]['comments'][_0x4a8b30],_0x3d62b6,_0x41008a))[_0x5200a(0x23a)](Boolean);return Object[_0x5200a(0x211)](_0x5a4754['body'][_0x5200a(0x244)])[_0x5200a(0x239)](_0x54c4d9=>{const _0x46994a=_0x5200a;this[_0x46994a(0x214)][_0x46994a(0x201)](_0x54c4d9);}),_0xb4fd1b;}[_0x3f17ea(0x227)](_0x578127){const _0x3ace52=_0x3f17ea;return{'id':_0x578127['id'],'threadId':_0x578127[_0x3ace52(0x1d4)],'ref':_0x578127['ref']};}};_0x16c945=_0x1c5ce6([_0x4e5365(0x0,_0x471e7b[_0x3f17ea(0x1c3)](_0x131a66[_0x3f17ea(0x1d7)])),_0x4e5365(0x1,_0x471e7b[_0x3f17ea(0x1c3)](_0x471e7b[_0x3f17ea(0x21d)])),_0x4e5365(0x2,_0x471e7b[_0x3f17ea(0x1c3)](_0x38535f[_0x3f17ea(0x1e2)])),_0x4e5365(0x3,_0x471e7b['Inject'](_0x471e7b['Injector']))],_0x16c945);var _0x5034bf=Object['defineProperty'],_0x1f7476=Object['getOwnPropertyDescriptor'],_0x407fac=(_0x3ce2e4,_0x1d7122,_0x3bcb0d,_0xa6260a)=>{for(var _0x350559=_0xa6260a>0x1?void 0x0:_0xa6260a?_0x1f7476(_0x1d7122,_0x3bcb0d):_0x1d7122,_0x21e92f=_0x3ce2e4['length']-0x1,_0x38c192;_0x21e92f>=0x0;_0x21e92f--)(_0x38c192=_0x3ce2e4[_0x21e92f])&&(_0x350559=(_0xa6260a?_0x38c192(_0x1d7122,_0x3bcb0d,_0x350559):_0x38c192(_0x350559))||_0x350559);return _0xa6260a&&_0x350559&&_0x5034bf(_0x1d7122,_0x3bcb0d,_0x350559),_0x350559;},_0x119877=(_0x10d8d7,_0x5c6764)=>(_0x2d14bb,_0x285127)=>_0x5c6764(_0x2d14bb,_0x285127,_0x10d8d7);let _0x3eb69d=class extends _0x471e7b[_0x3f17ea(0x1f4)]{constructor(_0x8bd012,_0x36a678){const _0x29ac0e=_0x3f17ea;super(),this['_threadCommentDataSourceService']=_0x8bd012,this[_0x29ac0e(0x1db)]=_0x36a678,this[_0x29ac0e(0x1cb)]();}[_0x3f17ea(0x1cb)](){const _0x212774=_0x3f17ea;this['_threadCommentDataSourceService'][_0x212774(0x217)]=this[_0x212774(0x1db)],this[_0x212774(0x1d8)][_0x212774(0x207)]=!0x1;}};_0x3eb69d=_0x407fac([_0x119877(0x0,_0x11c43c[_0x3f17ea(0x21e)]),_0x119877(0x1,_0x471e7b[_0x3f17ea(0x1c3)](_0x16c945))],_0x3eb69d);var _0x2b5a13=Object['defineProperty'],_0x309923=Object[_0x3f17ea(0x243)],_0x10fa16=(_0x2c1e6e,_0x54a170,_0x18789c)=>_0x54a170 in _0x2c1e6e?_0x2b5a13(_0x2c1e6e,_0x54a170,{'enumerable':!0x0,'configurable':!0x0,'writable':!0x0,'value':_0x18789c}):_0x2c1e6e[_0x54a170]=_0x18789c,_0x92608c=(_0x51d587,_0x2027b1,_0x13630d,_0x570f45)=>{const _0x3b1fb5=_0x3f17ea;for(var _0x22911e=_0x570f45>0x1?void 0x0:_0x570f45?_0x309923(_0x2027b1,_0x13630d):_0x2027b1,_0x5eb2b4=_0x51d587[_0x3b1fb5(0x1c8)]-0x1,_0x362844;_0x5eb2b4>=0x0;_0x5eb2b4--)(_0x362844=_0x51d587[_0x5eb2b4])&&(_0x22911e=(_0x570f45?_0x362844(_0x2027b1,_0x13630d,_0x22911e):_0x362844(_0x22911e))||_0x22911e);return _0x570f45&&_0x22911e&&_0x2b5a13(_0x2027b1,_0x13630d,_0x22911e),_0x22911e;},_0x839a03=(_0x5a9f1b,_0x513f80)=>(_0x2a71d7,_0x35892b)=>_0x513f80(_0x2a71d7,_0x35892b,_0x5a9f1b),_0x11d8cc=(_0x2397eb,_0x387b4a,_0x5f47cd)=>_0x10fa16(_0x2397eb,typeof _0x387b4a!='symbol'?_0x387b4a+'':_0x387b4a,_0x5f47cd);_0x3fe389[_0x3f17ea(0x21f)]=class extends _0x471e7b[_0x3f17ea(0x22c)]{constructor(_0x728d6b=_0x57351b,_0x5ead82,_0x26a729){const _0x462769=_0x3f17ea;super(),this[_0x462769(0x1eb)]=_0x728d6b,this[_0x462769(0x232)]=_0x5ead82,this[_0x462769(0x1fa)]=_0x26a729;const {..._0x3aacdd}=this['_config'];this[_0x462769(0x1fa)]['setConfig'](_0x4936b6,_0x3aacdd);}[_0x3f17ea(0x212)](){[[_0x16c945],[_0x3eb69d],[_0xceb039]]['forEach'](_0x2cedc6=>{const _0x3c86b7=_0x1a92;this[_0x3c86b7(0x232)][_0x3c86b7(0x1ed)](_0x2cedc6);});}['onReady'](){const _0x31edad=_0x3f17ea;this['_injector']['get'](_0x3eb69d),this[_0x31edad(0x232)][_0x31edad(0x1f1)](_0xceb039);}},_0x11d8cc(_0x3fe389[_0x3f17ea(0x21f)],_0x3f17ea(0x20a),_0x50c45f),_0x11d8cc(_0x3fe389[_0x3f17ea(0x21f)],_0x3f17ea(0x216),_0x471e7b[_0x3f17ea(0x1f0)][_0x3f17ea(0x213)]),_0x3fe389[_0x3f17ea(0x21f)]=_0x92608c([_0x471e7b[_0x3f17ea(0x20c)](_0x2a825[_0x3f17ea(0x1c9)],_0x38535f['UniverCollaborationClientPlugin'],_0x5dec0e[_0x3f17ea(0x1c0)]),_0x839a03(0x1,_0x471e7b[_0x3f17ea(0x1c3)](_0x471e7b[_0x3f17ea(0x22f)])),_0x839a03(0x2,_0x471e7b[_0x3f17ea(0x1fd)])],_0x3fe389[_0x3f17ea(0x21f)]),Object[_0x3f17ea(0x1ef)](_0x3fe389,Symbol[_0x3f17ea(0x20f)],{'value':_0x3f17ea(0x1c5)});}));function _0x1a92(_0x3f9644,_0x13d53c){const _0x39cf6f=_0x39cf();return _0x1a92=function(_0x1a92e5,_0x47dc1f){_0x1a92e5=_0x1a92e5-0x1c0;let _0x1cee50=_0x39cf6f[_0x1a92e5];return _0x1cee50;},_0x1a92(_0x3f9644,_0x13d53c);}function _0x39cf(){const _0x3b3ab1=['getUnit','Injector','UniverProThreadCommentDatasource','UniverThreadCommentUi','_injector','UniverThreadComment','getMemberID','3324rYuypq','CustomRangeType','1ZfGNcP','addComment','forEach','filter','/edit','error','Unknown','UniverNetwork','updateComment','11576790mtlIWb','rxjs','unitId','getOwnPropertyDescriptor','users','function','replies','UniverLicensePlugin','Delete','UNIVER_THREAD_COMMENT_DATA_SOURCE_PLUGIN','Inject','UniverProCollaborationClient','Module','getComment','@univerjs-pro/license','length','UniverThreadCommentUIPlugin','customRanges','_initDataSource','code','format','/add','getUser','YYYY/MM/DD\x20HH:mm','post','stringify','resolved','threadId','_commentService','/delete','HTTPService','_threadCommentDataSourceService','3370oKXoyG','/universer-api/user/list','_threadCommentDataSource','Edit','amd','/reply','subscribe','userId','dayjs','CollaborationSessionService','1943893dQjkFL','OpenOrReOpen','map','deleteComment','pipe','listComments','requireSession','@univerjs/thread-comment-ui','_config','solved','add','parentId','defineProperty','UniverInstanceType','get','4294662LqizUG','rangeId','Disposable','find','resolveComment','@univerjs-pro/collaboration-client','_httpService','6044440aEZWHs','_configService','commentUpdate$','body','IConfigService','/list','createTimestamp','/universer-api/comment/unit/','addUser','reply','object','_initUserSync','Reply','Add','syncUpdateMutationToColla','personId','userID','pluginName','Solved','DependentOn','COMMENT','_sessionService','toStringTag','user','values','onStarting','UNIVER_UNKNOWN','_userService','CommentService','type','dataSource','disposeWithMe','3829520kSXIIq','UNRECOGNIZED','2003836dJcMds','Solve','UserManagerService','IThreadCommentDataSourceService','UniverThreadCommentDataSourcePlugin','@univerjs/network','content','parse','@univerjs/core','UniverProLicense','rangeType','replyId','saveCommentToSnapshot','exports','payload','@univerjs/thread-comment','getCurrentUser','Plugin','_threadCommentModel'];_0x39cf=function(){return _0x3b3ab1;};return _0x39cf();}
37
38
 
38
39
  // index
39
- (function(e,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("@univerjs-pro/thread-comment-datasource"),require("@univerjs/sheets-thread-comment"),require("@univerjs/sheets-thread-comment-ui"),require("@univerjs/thread-comment-ui"),require("@univerjs/sheets-thread-comment/facade")):typeof define=="function"&&define.amd?define(["exports","@univerjs-pro/thread-comment-datasource","@univerjs/sheets-thread-comment","@univerjs/sheets-thread-comment-ui","@univerjs/thread-comment-ui","@univerjs/sheets-thread-comment/facade"],t):(e=typeof globalThis<"u"?globalThis:e||self,t(e.UniverPresetSheetsThreadComment={},e.UniverProThreadCommentDatasource,e.UniverSheetsThreadComment,e.UniverSheetsThreadCommentUi,e.UniverThreadCommentUi))})(this,function(e,t,n,i,s){"use strict";function m(o={}){const{collaboration:u}=o,r=[s.UniverThreadCommentUIPlugin,n.UniverSheetsThreadCommentPlugin,i.UniverSheetsThreadCommentUIPlugin];return u&&r.push(t.UniverThreadCommentDataSourcePlugin),{plugins:r}}e.UniverSheetsThreadCommentPreset=m,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
40
+ (function(e,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("@univerjs/sheets-thread-comment"),require("@univerjs/sheets-thread-comment-ui"),require("@univerjs/thread-comment-ui"),require("@univerjs/sheets-thread-comment/facade")):typeof define=="function"&&define.amd?define(["exports","@univerjs/sheets-thread-comment","@univerjs/sheets-thread-comment-ui","@univerjs/thread-comment-ui","@univerjs/sheets-thread-comment/facade"],n):(e=typeof globalThis<"u"?globalThis:e||self,n(e.UniverPresetSheetsThreadComment={},e.UniverSheetsThreadComment,e.UniverSheetsThreadCommentUi,e.UniverThreadCommentUi))})(this,function(e,n,t,r){"use strict";function i(s={}){return{plugins:[r.UniverThreadCommentUIPlugin,n.UniverSheetsThreadCommentPlugin,t.UniverSheetsThreadCommentUIPlugin]}}e.UniverSheetsThreadCommentPreset=i,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/preset-sheets-thread-comment",
3
- "version": "0.5.1-nightly.202412041606",
3
+ "version": "0.5.1-nightly.202412271606",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -57,15 +57,15 @@
57
57
  "rxjs": ">=7.0.0"
58
58
  },
59
59
  "dependencies": {
60
- "@univerjs-pro/thread-comment-datasource": "0.5.1-nightly.202412041606",
61
- "@univerjs/sheets-thread-comment": "0.5.1-nightly.202412041606",
62
- "@univerjs/sheets-thread-comment-ui": "0.5.1-nightly.202412041606",
63
- "@univerjs/thread-comment-ui": "0.5.1-nightly.202412041606"
60
+ "@univerjs/sheets-thread-comment": "0.5.1-nightly.202412271606",
61
+ "@univerjs/sheets-thread-comment-ui": "0.5.1-nightly.202412271606",
62
+ "@univerjs/thread-comment": "0.5.1-nightly.202412271606",
63
+ "@univerjs/thread-comment-ui": "0.5.1-nightly.202412271606"
64
64
  },
65
65
  "devDependencies": {
66
- "@univerjs/core": "0.5.1-nightly.202412041606",
66
+ "@univerjs/core": "0.5.1-nightly.202412271606",
67
67
  "typescript": "^5.7.2",
68
- "@univerjs-infra/shared": "0.5.1-nightly.202412041606"
68
+ "@univerjs-infra/shared": "0.5.1-nightly.202412271606"
69
69
  },
70
70
  "scripts": {
71
71
  "prebuild:preset": "tsx prepare.ts",