@univerjs/preset-sheets-thread-comment 0.23.0 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/lib/cjs/locales/ar-SA.js +1 -0
  2. package/lib/cjs/locales/de-DE.js +1 -0
  3. package/lib/cjs/locales/id-ID.js +1 -0
  4. package/lib/cjs/locales/it-IT.js +1 -0
  5. package/lib/cjs/locales/pl-PL.js +1 -0
  6. package/lib/cjs/locales/pt-BR.js +1 -0
  7. package/lib/cjs/locales/zh-HK.js +1 -0
  8. package/lib/es/locales/ar-SA.js +10 -0
  9. package/lib/es/locales/de-DE.js +10 -0
  10. package/lib/es/locales/id-ID.js +10 -0
  11. package/lib/es/locales/it-IT.js +10 -0
  12. package/lib/es/locales/pl-PL.js +10 -0
  13. package/lib/es/locales/pt-BR.js +10 -0
  14. package/lib/es/locales/zh-HK.js +10 -0
  15. package/lib/locales/ar-SA.js +10 -0
  16. package/lib/locales/de-DE.js +10 -0
  17. package/lib/locales/id-ID.js +10 -0
  18. package/lib/locales/it-IT.js +10 -0
  19. package/lib/locales/pl-PL.js +10 -0
  20. package/lib/locales/pt-BR.js +10 -0
  21. package/lib/locales/zh-HK.js +10 -0
  22. package/lib/types/locales/ar-SA.d.ts +4 -0
  23. package/lib/types/locales/de-DE.d.ts +4 -0
  24. package/lib/types/locales/id-ID.d.ts +4 -0
  25. package/lib/types/locales/it-IT.d.ts +4 -0
  26. package/lib/types/locales/pl-PL.d.ts +4 -0
  27. package/lib/types/locales/pt-BR.d.ts +4 -0
  28. package/lib/types/locales/zh-HK.d.ts +4 -0
  29. package/lib/umd/index.js +8 -8
  30. package/lib/umd/locales/ar-SA.js +8 -0
  31. package/lib/umd/locales/ca-ES.js +2 -2
  32. package/lib/umd/locales/de-DE.js +8 -0
  33. package/lib/umd/locales/en-US.js +2 -2
  34. package/lib/umd/locales/es-ES.js +2 -2
  35. package/lib/umd/locales/fa-IR.js +2 -2
  36. package/lib/umd/locales/fr-FR.js +2 -2
  37. package/lib/umd/locales/id-ID.js +8 -0
  38. package/lib/umd/locales/it-IT.js +8 -0
  39. package/lib/umd/locales/ja-JP.js +2 -2
  40. package/lib/umd/locales/ko-KR.js +2 -2
  41. package/lib/umd/locales/pl-PL.js +8 -0
  42. package/lib/umd/locales/pt-BR.js +8 -0
  43. package/lib/umd/locales/ru-RU.js +2 -2
  44. package/lib/umd/locales/sk-SK.js +2 -2
  45. package/lib/umd/locales/vi-VN.js +2 -2
  46. package/lib/umd/locales/zh-CN.js +2 -2
  47. package/lib/umd/locales/zh-HK.js +8 -0
  48. package/lib/umd/locales/zh-TW.js +2 -2
  49. package/package.json +7 -7
@@ -0,0 +1 @@
1
+ "use strict";const e=require("@univerjs/core"),r=require("@univerjs/sheets-thread-comment-ui/locale/ar-SA"),s=require("@univerjs/thread-comment-ui/locale/ar-SA"),t=e.mergeLocales(r,s);module.exports=t;
@@ -0,0 +1 @@
1
+ "use strict";const e=require("@univerjs/core"),r=require("@univerjs/sheets-thread-comment-ui/locale/de-DE"),s=require("@univerjs/thread-comment-ui/locale/de-DE"),t=e.mergeLocales(r,s);module.exports=t;
@@ -0,0 +1 @@
1
+ "use strict";const e=require("@univerjs/core"),r=require("@univerjs/sheets-thread-comment-ui/locale/id-ID"),s=require("@univerjs/thread-comment-ui/locale/id-ID"),t=e.mergeLocales(r,s);module.exports=t;
@@ -0,0 +1 @@
1
+ "use strict";const e=require("@univerjs/core"),r=require("@univerjs/sheets-thread-comment-ui/locale/it-IT"),t=require("@univerjs/thread-comment-ui/locale/it-IT"),s=e.mergeLocales(r,t);module.exports=s;
@@ -0,0 +1 @@
1
+ "use strict";const e=require("@univerjs/core"),r=require("@univerjs/sheets-thread-comment-ui/locale/pl-PL"),s=require("@univerjs/thread-comment-ui/locale/pl-PL"),t=e.mergeLocales(r,s);module.exports=t;
@@ -0,0 +1 @@
1
+ "use strict";const e=require("@univerjs/core"),r=require("@univerjs/sheets-thread-comment-ui/locale/pt-BR"),t=require("@univerjs/thread-comment-ui/locale/pt-BR"),s=e.mergeLocales(r,t);module.exports=s;
@@ -0,0 +1 @@
1
+ "use strict";const e=require("@univerjs/core"),r=require("@univerjs/sheets-thread-comment-ui/locale/zh-HK"),s=require("@univerjs/thread-comment-ui/locale/zh-HK"),t=e.mergeLocales(r,s);module.exports=t;
@@ -0,0 +1,10 @@
1
+ import { mergeLocales as e } from "@univerjs/core";
2
+ import r from "@univerjs/sheets-thread-comment-ui/locale/ar-SA";
3
+ import m from "@univerjs/thread-comment-ui/locale/ar-SA";
4
+ const s = e(
5
+ r,
6
+ m
7
+ );
8
+ export {
9
+ s as default
10
+ };
@@ -0,0 +1,10 @@
1
+ import { mergeLocales as e } from "@univerjs/core";
2
+ import r from "@univerjs/sheets-thread-comment-ui/locale/de-DE";
3
+ import m from "@univerjs/thread-comment-ui/locale/de-DE";
4
+ const s = e(
5
+ r,
6
+ m
7
+ );
8
+ export {
9
+ s as default
10
+ };
@@ -0,0 +1,10 @@
1
+ import { mergeLocales as e } from "@univerjs/core";
2
+ import r from "@univerjs/sheets-thread-comment-ui/locale/id-ID";
3
+ import m from "@univerjs/thread-comment-ui/locale/id-ID";
4
+ const s = e(
5
+ r,
6
+ m
7
+ );
8
+ export {
9
+ s as default
10
+ };
@@ -0,0 +1,10 @@
1
+ import { mergeLocales as e } from "@univerjs/core";
2
+ import r from "@univerjs/sheets-thread-comment-ui/locale/it-IT";
3
+ import t from "@univerjs/thread-comment-ui/locale/it-IT";
4
+ const s = e(
5
+ r,
6
+ t
7
+ );
8
+ export {
9
+ s as default
10
+ };
@@ -0,0 +1,10 @@
1
+ import { mergeLocales as e } from "@univerjs/core";
2
+ import r from "@univerjs/sheets-thread-comment-ui/locale/pl-PL";
3
+ import m from "@univerjs/thread-comment-ui/locale/pl-PL";
4
+ const s = e(
5
+ r,
6
+ m
7
+ );
8
+ export {
9
+ s as default
10
+ };
@@ -0,0 +1,10 @@
1
+ import { mergeLocales as e } from "@univerjs/core";
2
+ import r from "@univerjs/sheets-thread-comment-ui/locale/pt-BR";
3
+ import t from "@univerjs/thread-comment-ui/locale/pt-BR";
4
+ const s = e(
5
+ r,
6
+ t
7
+ );
8
+ export {
9
+ s as default
10
+ };
@@ -0,0 +1,10 @@
1
+ import { mergeLocales as e } from "@univerjs/core";
2
+ import r from "@univerjs/sheets-thread-comment-ui/locale/zh-HK";
3
+ import m from "@univerjs/thread-comment-ui/locale/zh-HK";
4
+ const s = e(
5
+ r,
6
+ m
7
+ );
8
+ export {
9
+ s as default
10
+ };
@@ -0,0 +1,10 @@
1
+ import { mergeLocales as e } from "@univerjs/core";
2
+ import r from "@univerjs/sheets-thread-comment-ui/locale/ar-SA";
3
+ import m from "@univerjs/thread-comment-ui/locale/ar-SA";
4
+ const s = e(
5
+ r,
6
+ m
7
+ );
8
+ export {
9
+ s as default
10
+ };
@@ -0,0 +1,10 @@
1
+ import { mergeLocales as e } from "@univerjs/core";
2
+ import r from "@univerjs/sheets-thread-comment-ui/locale/de-DE";
3
+ import m from "@univerjs/thread-comment-ui/locale/de-DE";
4
+ const s = e(
5
+ r,
6
+ m
7
+ );
8
+ export {
9
+ s as default
10
+ };
@@ -0,0 +1,10 @@
1
+ import { mergeLocales as e } from "@univerjs/core";
2
+ import r from "@univerjs/sheets-thread-comment-ui/locale/id-ID";
3
+ import m from "@univerjs/thread-comment-ui/locale/id-ID";
4
+ const s = e(
5
+ r,
6
+ m
7
+ );
8
+ export {
9
+ s as default
10
+ };
@@ -0,0 +1,10 @@
1
+ import { mergeLocales as e } from "@univerjs/core";
2
+ import r from "@univerjs/sheets-thread-comment-ui/locale/it-IT";
3
+ import t from "@univerjs/thread-comment-ui/locale/it-IT";
4
+ const s = e(
5
+ r,
6
+ t
7
+ );
8
+ export {
9
+ s as default
10
+ };
@@ -0,0 +1,10 @@
1
+ import { mergeLocales as e } from "@univerjs/core";
2
+ import r from "@univerjs/sheets-thread-comment-ui/locale/pl-PL";
3
+ import m from "@univerjs/thread-comment-ui/locale/pl-PL";
4
+ const s = e(
5
+ r,
6
+ m
7
+ );
8
+ export {
9
+ s as default
10
+ };
@@ -0,0 +1,10 @@
1
+ import { mergeLocales as e } from "@univerjs/core";
2
+ import r from "@univerjs/sheets-thread-comment-ui/locale/pt-BR";
3
+ import t from "@univerjs/thread-comment-ui/locale/pt-BR";
4
+ const s = e(
5
+ r,
6
+ t
7
+ );
8
+ export {
9
+ s as default
10
+ };
@@ -0,0 +1,10 @@
1
+ import { mergeLocales as e } from "@univerjs/core";
2
+ import r from "@univerjs/sheets-thread-comment-ui/locale/zh-HK";
3
+ import m from "@univerjs/thread-comment-ui/locale/zh-HK";
4
+ const s = e(
5
+ r,
6
+ m
7
+ );
8
+ export {
9
+ s as default
10
+ };
@@ -0,0 +1,4 @@
1
+ declare const _default: {
2
+ [x: string]: any;
3
+ };
4
+ export default _default;
@@ -0,0 +1,4 @@
1
+ declare const _default: {
2
+ [x: string]: any;
3
+ };
4
+ export default _default;
@@ -0,0 +1,4 @@
1
+ declare const _default: {
2
+ [x: string]: any;
3
+ };
4
+ export default _default;
@@ -0,0 +1,4 @@
1
+ declare const _default: {
2
+ [x: string]: any;
3
+ };
4
+ export default _default;
@@ -0,0 +1,4 @@
1
+ declare const _default: {
2
+ [x: string]: any;
3
+ };
4
+ export default _default;
@@ -0,0 +1,4 @@
1
+ declare const _default: {
2
+ [x: string]: any;
3
+ };
4
+ export default _default;
@@ -0,0 +1,4 @@
1
+ declare const _default: {
2
+ [x: string]: any;
3
+ };
4
+ export default _default;
package/lib/umd/index.js CHANGED
@@ -1,20 +1,20 @@
1
1
  // @univerjs/thread-comment/index
2
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@univerjs/core`),require(`rxjs`)):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`rxjs`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverThreadComment={},e.UniverCore,e.rxjs))})(this,function(e,t,n){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function r(e){"@babel/helpers - typeof";return r=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},r(e)}function i(e,t){if(r(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t||`default`);if(r(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function a(e){var t=i(e,`string`);return r(t)==`symbol`?t:t+``}function o(e,t,n){return(t=a(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var s=class extends t.Disposable{set dataSource(e){this._dataSource=e}get dataSource(){return this._dataSource}constructor(){super(),o(this,`_dataSource`,null),o(this,`syncUpdateMutationToColla`,!0)}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?e.id:t}}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,r){return this._dataSource?this._dataSource.deleteComment(e,t,n,r):!0}async listThreadComments(e,t,n){return this.dataSource?this.dataSource.listComments(e,t,n):!1}saveToSnapshot(e,t){if(this._dataSource){let t={};return Object.keys(e).forEach(n=>{t[n]=e[n].map(this.dataSource.saveCommentToSnapshot)}),t}return e}};let c=(0,t.createIdentifier)(`univer.thread-comment.data-source-service`);function l(e,t){return function(n,r){t(n,r,e)}}function u(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let d=class extends t.Disposable{constructor(e,r){super(),this._dataSourceService=e,this._lifecycleService=r,o(this,`_commentsMap`,new Map),o(this,`_threadMap`,new Map),o(this,`_commentUpdate$`,new n.Subject),o(this,`commentUpdate$`,this._commentUpdate$.asObservable()),o(this,`_tasks`,[]),this.disposeWithMe(()=>{this._commentUpdate$.complete()}),this.disposeWithMe(this._lifecycleService.lifecycle$.subscribe(e=>{let n=new Map;e===t.LifecycleStages.Rendered&&(this._tasks.forEach(({unitId:e,subUnitId:t,threadIds:r})=>{let i=n.get(e);i||(i=new Map,n.set(e,i));let a=i.get(t);a||(a=new Set,i.set(t,a));for(let e of r)a.add(e)}),this._tasks=[],n.forEach((e,t)=>{e.forEach((e,n)=>{this.syncThreadComments(t,n,Array.from(e))})}))}))}_ensureCommentMap(e,t){let n=this._commentsMap.get(e);n||(n=new Map,this._commentsMap.set(e,n));let r=n.get(t);return r||(r=new Map,n.set(t,r)),r}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 r=n.get(t);return r||(r=new Map,n.set(t,r)),r}_replaceComment(e,t,n){let r=this._ensureCommentMap(e,t),i=r.get(n.id);if(i){let{children:a,...o}=n,s={...o,ref:i.ref};r.set(n.id,s),a==null||a.forEach(e=>{r.set(e.id,{...e,ref:``})}),this._commentUpdate$.next({unitId:e,subUnitId:t,type:`syncUpdate`,payload:s}),!!n.resolved!=!!i.resolved&&this._commentUpdate$.next({unitId:e,subUnitId:t,type:`resolve`,payload:{commentId:n.id,resolved:!!n.resolved}})}}async syncThreadComments(e,n,r){if(this._lifecycleService.stage<t.LifecycleStages.Rendered){this._tasks.push({unitId:e,subUnitId:n,threadIds:r});return}let i=this._ensureThreadMap(e,n),a=this._ensureCommentMap(e,n),o=await this._dataSourceService.listThreadComments(e,n,r);if(!o)return;let s=new Set(r);o.forEach(t=>{this._replaceComment(e,n,t),s.delete(t.threadId)}),s.forEach(e=>{i.delete(e),a.forEach((t,n)=>{t.threadId===e&&a.delete(n)})})}addComment(e,t,n,r){let i=this._ensureCommentMap(e,t),{parentId:a,children:o=[],...s}=n,c={...s,parentId:a===n.id?void 0:a};c.threadId||(c.threadId=c.parentId||c.id);let l=n=>{i.set(n.id,n),this._commentUpdate$.next({unitId:e,subUnitId:t,type:`add`,payload:n,isRoot:!n.parentId})};l(c);let u=this._ensureThreadMap(e,t);if(!c.parentId){u.set(c.threadId,c);for(let e of o)l(e)}return r&&this.syncThreadComments(e,t,[c.threadId]),!0}updateComment(e,t,n,r){let i=this._ensureCommentMap(e,t).get(n.commentId);return i?(i.updated=!0,i.text=n.text,i.attachments=n.attachments,i.updateT=n.updateT,this._commentUpdate$.next({unitId:e,subUnitId:t,type:`update`,payload:n,silent:r}),!0):!0}updateCommentRef(e,t,n,r){let i=this._ensureCommentMap(e,t).get(n.commentId);return i?(i.ref=n.ref,this._commentUpdate$.next({unitId:e,subUnitId:t,type:`updateRef`,payload:n,silent:r,threadId:i.threadId}),!0):!1}resolveComment(e,t,n,r){let i=this._ensureCommentMap(e,t).get(n);return i?(i.resolved=r,this._commentUpdate$.next({unitId:e,subUnitId:t,type:`resolve`,payload:{commentId:n,resolved:r}}),!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){let r=this._ensureCommentMap(e,t),i=Array.from(r.values()).filter(e=>e.threadId===n),a,o=[],s=new Set;for(let e of i)e.parentId?o.push(e):a=e,s.add(e.personId);if(a)return{root:a,children:o,relativeUsers:s,unitId:e,subUnitId:t,threadId:n}}getCommentWithChildren(e,t,n){let r=this.getComment(e,t,n);if(r)return this.getThread(e,t,r.threadId)}_deleteComment(e,t,n){let r=this._ensureCommentMap(e,t),i=r.get(n);i&&(r.delete(n),this._commentUpdate$.next({unitId:e,subUnitId:t,type:`delete`,payload:{commentId:n,isRoot:!i.parentId,comment:i}}))}deleteThread(e,t,n){this._ensureThreadMap(e,t).delete(n),this._ensureCommentMap(e,t).forEach(r=>{r.threadId===n&&this._deleteComment(e,t,r.id)})}deleteComment(e,t,n){let r=this._ensureCommentMap(e,t).get(n);return r&&(r.parentId?this._deleteComment(e,t,n):this.deleteThread(e,t,r.threadId)),!0}deleteUnit(e){let t=this._commentsMap.get(e);t&&t.forEach((t,n)=>{t.forEach(t=>{this.deleteComment(e,n,t.id)})})}getUnit(e){let t=this._threadMap.get(e);if(!t)return[];let n=[];return t.forEach((t,r)=>{t.forEach((t,i)=>{let a=this.getThread(e,r,i);a&&n.push(a)})}),n}getAll(){let e=[];return this._commentsMap.forEach((t,n)=>{e.push({unitId:n,threads:this.getUnit(n)})}),e}};d=u([l(0,(0,t.Inject)(c)),l(1,(0,t.Inject)(t.LifecycleService))],d);let f={id:`thread-comment.mutation.add-comment`,type:t.CommandType.MUTATION,handler(e,t,n){if(!t)return!1;let r=e.get(d),{unitId:i,subUnitId:a,comment:o,sync:s}=t,c=s||(n==null?void 0:n.fromChangeset)&&!o.parentId;return r.addComment(i,a,o,c)}},p={id:`thread-comment.mutation.update-comment`,type:t.CommandType.MUTATION,handler(e,t){if(!t)return!1;let n=e.get(d),{unitId:r,subUnitId:i,payload:a,silent:o}=t;return n.updateComment(r,i,a,o)}},m={id:`thread-comment.mutation.update-comment-ref`,type:t.CommandType.MUTATION,handler(e,t){if(!t)return!1;let n=e.get(d),{unitId:r,subUnitId:i,payload:a,silent:o}=t;return n.updateCommentRef(r,i,a,o)}},h={id:`thread-comment.mutation.resolve-comment`,type:t.CommandType.MUTATION,handler(e,t){if(!t)return!1;let n=e.get(d),{unitId:r,subUnitId:i,resolved:a,commentId:o}=t;return n.resolveComment(r,i,o,a)}},g={id:`thread-comment.mutation.delete-comment`,type:t.CommandType.MUTATION,handler(e,t){if(!t)return!1;let n=e.get(d),{unitId:r,subUnitId:i,commentId:a}=t;return n.deleteComment(r,i,a)}},_={id:`thread-comment.command.add-comment`,type:t.CommandType.COMMAND,async handler(e,n){if(!n)return!1;let r=e.get(t.ICommandService),i=e.get(c),{comment:a}=n,o=await i.addComment(a),s=i.syncUpdateMutationToColla,l=!a.parentId,u={id:f.id,params:{...n,comment:o}};return l?await r.executeCommand(u.id,u.params):r.executeCommand(u.id,u.params,{onlyLocal:!s})}},v={id:`thread-comment.command.update-comment`,type:t.CommandType.COMMAND,async handler(e,n){if(!n)return!1;let{unitId:r,subUnitId:i,payload:a}=n,o=e.get(t.ICommandService),s=e.get(d),l=e.get(c),u=l.syncUpdateMutationToColla,f=s.getComment(r,i,a.commentId);if(!f)return!1;let{children:m,...h}=f;if(!await l.updateComment({...h,...a}))return!1;let g={id:p.id,params:n};return o.executeCommand(g.id,g.params,{onlyLocal:!u}),!0}},y={id:`thread-comment.command.resolve-comment`,type:t.CommandType.COMMAND,async handler(e,n){if(!n)return!1;let{unitId:r,subUnitId:i,resolved:a,commentId:o}=n,s=e.get(c),l=e.get(d).getComment(r,i,o),u=s.syncUpdateMutationToColla;return!l||!await s.resolveComment({...l,resolved:a})?!1:e.get(t.ICommandService).executeCommand(h.id,n,{onlyLocal:!u})}},b={id:`thread-comment.command.delete-comment`,type:t.CommandType.COMMAND,async handler(e,n){if(!n)return!1;let r=e.get(d),i=e.get(c),a=e.get(t.ICommandService),{unitId:o,subUnitId:s,commentId:l}=n,u=i.syncUpdateMutationToColla,f=r.getComment(o,s,l);if(!f||!await i.deleteComment(o,s,f.threadId,l))return!1;let p={id:g.id,params:n};return a.executeCommand(p.id,p.params,{onlyLocal:!u})}},x={id:`thread-comment.command.delete-comment-tree`,type:t.CommandType.COMMAND,async handler(e,n){if(!n)return!1;let r=e.get(d),i=e.get(t.ICommandService),a=e.get(c),{unitId:o,subUnitId:s,commentId:l}=n,u=r.getCommentWithChildren(o,s,l);return!u||!await a.deleteComment(o,s,u.root.threadId,l)?!1:await i.executeCommand(g.id,{unitId:o,subUnitId:s,commentId:u.root.id})}};function S(e){return(0,t.dateKit)(e).format(`YYYY/MM/DD HH:mm`)}let C=`UNIVER_THREAD_COMMENT_PLUGIN`,w=`SHEET_${C}`,T=class extends t.Disposable{constructor(e,t,n){super(),this._resourceManagerService=e,this._threadCommentModel=t,this._threadCommentDataSourceService=n,this._initSnapshot()}_initSnapshot(){let e=e=>{let t=this._threadCommentModel.getUnit(e),n={};return t?(t.forEach(e=>{var t;let r=(t=n[e.subUnitId])==null?[]:t;r.push({...e.root,children:e.children}),n[e.subUnitId]=r}),JSON.stringify(this._threadCommentDataSourceService.saveToSnapshot(n,e))):``},n=e=>{if(!e)return{};try{return JSON.parse(e)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:w,businesses:[t.UniverInstanceType.UNIVER_SHEET,t.UniverInstanceType.UNIVER_DOC],toJson:t=>e(t),parseJson:e=>n(e),onUnLoad:e=>{this._threadCommentModel.deleteUnit(e)},onLoad:async(e,t)=>{Object.keys(t).forEach(n=>{let r=t[n];r.forEach(t=>{this._threadCommentModel.addComment(e,n,t)}),this._threadCommentModel.syncThreadComments(e,n,r.map(e=>e.threadId))})}}))}};T=u([l(0,t.IResourceManagerService),l(1,(0,t.Inject)(d)),l(2,c)],T);var E=`@univerjs/thread-comment`,D=`0.23.0`;let O=`thread-comment.config`;Symbol(O);let k={},A=class extends t.Plugin{constructor(e=k,n,r,i){super(),this._config=e,this._injector=n,this._commandService=r,this._configService=i;let{...a}=(0,t.merge)({},k,this._config);this._configService.setConfig(O,a)}onStarting(){var e;(0,t.mergeOverrideWithDependencies)([[c,{useClass:s}],[d],[T]],(e=this._config)==null?void 0:e.overrides).forEach(e=>{this._injector.add(e)}),[_,v,b,y,x,f,p,m,g,h].forEach(e=>{this._commandService.registerCommand(e)}),this._injector.get(T)}};o(A,`pluginName`,C),o(A,`packageName`,E),o(A,`version`,D),o(A,`type`,t.UniverInstanceType.UNIVER_UNKNOWN),A=u([l(1,(0,t.Inject)(t.Injector)),l(2,t.ICommandService),l(3,t.IConfigService)],A),e.AddCommentCommand=_,e.AddCommentMutation=f,e.DeleteCommentCommand=b,e.DeleteCommentMutation=g,e.DeleteCommentTreeCommand=x,e.IThreadCommentDataSourceService=c,e.ResolveCommentCommand=y,e.ResolveCommentMutation=h,e.SHEET_UNIVER_THREAD_COMMENT_PLUGIN=w,e.TC_PLUGIN_NAME=C,e.ThreadCommentDataSourceService=s,Object.defineProperty(e,`ThreadCommentModel`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,`ThreadCommentResourceController`,{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,`UniverThreadCommentPlugin`,{enumerable:!0,get:function(){return A}}),e.UpdateCommentCommand=v,e.UpdateCommentMutation=p,e.UpdateCommentRefMutation=m,e.getDT=S});
2
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@univerjs/core"),require("rxjs")):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`rxjs`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverThreadComment={},e.UniverCore,e.rxjs))})(this,function(e,t,n){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function r(e){"@babel/helpers - typeof";return r=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},r(e)}function i(e,t){if(r(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t||`default`);if(r(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function a(e){var t=i(e,`string`);return r(t)==`symbol`?t:t+``}function o(e,t,n){return(t=a(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var s=class extends t.Disposable{set dataSource(e){this._dataSource=e}get dataSource(){return this._dataSource}constructor(){super(),o(this,`_dataSource`,null),o(this,`syncUpdateMutationToColla`,!0)}async getThreadComment(e,t,n){return this._dataSource?(await this._dataSource.listComments(e,t,[n]))[0]:null}async addComment(e){let t=this._dataSource?await this._dataSource.addComment(e):e;return{...t,threadId:t.threadId||t.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,r){return this._dataSource?this._dataSource.deleteComment(e,t,n,r):!0}async listThreadComments(e,t,n){return this.dataSource?this.dataSource.listComments(e,t,n):!1}saveToSnapshot(e,t){if(this._dataSource){let t={};return Object.keys(e).forEach(n=>{t[n]=e[n].map(this.dataSource.saveCommentToSnapshot)}),t}return e}};let c=(0,t.createIdentifier)(`univer.thread-comment.data-source-service`);function l(e,t){return function(n,r){t(n,r,e)}}function u(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let d=class extends t.Disposable{constructor(e,r){super(),this._dataSourceService=e,this._lifecycleService=r,o(this,`_commentsMap`,new Map),o(this,`_threadMap`,new Map),o(this,`_commentUpdate$`,new n.Subject),o(this,`commentUpdate$`,this._commentUpdate$.asObservable()),o(this,`_tasks`,[]),this.disposeWithMe(()=>{this._commentUpdate$.complete()}),this.disposeWithMe(this._lifecycleService.lifecycle$.subscribe(e=>{let n=new Map;e===t.LifecycleStages.Rendered&&(this._tasks.forEach(({unitId:e,subUnitId:t,threadIds:r})=>{let i=n.get(e);i||(i=new Map,n.set(e,i));let a=i.get(t);a||(a=new Set,i.set(t,a));for(let e of r)a.add(e)}),this._tasks=[],n.forEach((e,t)=>{e.forEach((e,n)=>{this.syncThreadComments(t,n,Array.from(e))})}))}))}_ensureCommentMap(e,t){let n=this._commentsMap.get(e);n||(n=new Map,this._commentsMap.set(e,n));let r=n.get(t);return r||(r=new Map,n.set(t,r)),r}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 r=n.get(t);return r||(r=new Map,n.set(t,r)),r}_replaceComment(e,t,n){let r=this._ensureCommentMap(e,t),i=r.get(n.id);if(!i){this.addComment(e,t,n);return}let{children:a,...o}=n,s={...o,ref:i.ref};r.set(n.id,s),a==null||a.forEach(e=>{r.set(e.id,{...e,ref:``})}),this._commentUpdate$.next({unitId:e,subUnitId:t,type:`syncUpdate`,payload:s}),!!n.resolved!=!!i.resolved&&this._commentUpdate$.next({unitId:e,subUnitId:t,type:`resolve`,payload:{commentId:n.id,resolved:!!n.resolved}})}async syncThreadComments(e,n,r){if(this._lifecycleService.stage<t.LifecycleStages.Rendered){this._tasks.push({unitId:e,subUnitId:n,threadIds:r});return}let i=this._ensureThreadMap(e,n),a=this._ensureCommentMap(e,n),o=await this._dataSourceService.listThreadComments(e,n,r);if(!o)return;let s=new Set(r);o.forEach(t=>{s.has(t.threadId)&&(this._replaceComment(e,n,t),s.delete(t.threadId))}),s.forEach(e=>{i.delete(e),a.forEach((t,n)=>{t.threadId===e&&a.delete(n)})})}addComment(e,t,n,r){let i=this._ensureCommentMap(e,t),{parentId:a,children:o=[],...s}=n,c={...s,parentId:a===n.id?void 0:a};c.threadId||(c.threadId=c.parentId||c.id);let l=n=>{i.set(n.id,n),this._commentUpdate$.next({unitId:e,subUnitId:t,type:`add`,payload:n,isRoot:!n.parentId})};l(c);let u=this._ensureThreadMap(e,t);if(!c.parentId){u.set(c.threadId,c);for(let e of o)l(e)}return r&&this.syncThreadComments(e,t,[c.threadId]),!0}updateComment(e,t,n,r){let i=this._ensureCommentMap(e,t).get(n.commentId);return i?(i.updated=!0,i.text=n.text,i.attachments=n.attachments,i.updateT=n.updateT,this._commentUpdate$.next({unitId:e,subUnitId:t,type:`update`,payload:n,silent:r}),!0):!0}updateCommentRef(e,t,n,r){let i=this._ensureCommentMap(e,t).get(n.commentId);return i?(i.ref=n.ref,this._commentUpdate$.next({unitId:e,subUnitId:t,type:`updateRef`,payload:n,silent:r,threadId:i.threadId}),!0):!1}resolveComment(e,t,n,r){let i=this._ensureCommentMap(e,t).get(n);return i?(i.resolved=r,this._commentUpdate$.next({unitId:e,subUnitId:t,type:`resolve`,payload:{commentId:n,resolved:r}}),!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){let r=this._ensureCommentMap(e,t),i=Array.from(r.values()).filter(e=>e.threadId===n),a,o=[],s=new Set;for(let e of i)e.parentId?o.push(e):a=e,s.add(e.personId);if(a)return{root:a,children:o,relativeUsers:s,unitId:e,subUnitId:t,threadId:n}}getCommentWithChildren(e,t,n){let r=this.getComment(e,t,n);if(r)return this.getThread(e,t,r.threadId)}_deleteComment(e,t,n){let r=this._ensureCommentMap(e,t),i=r.get(n);i&&(r.delete(n),this._commentUpdate$.next({unitId:e,subUnitId:t,type:`delete`,payload:{commentId:n,isRoot:!i.parentId,comment:i}}))}deleteThread(e,t,n){this._ensureThreadMap(e,t).delete(n),this._ensureCommentMap(e,t).forEach(r=>{r.threadId===n&&this._deleteComment(e,t,r.id)})}deleteComment(e,t,n){let r=this._ensureCommentMap(e,t).get(n);return r&&(r.parentId?this._deleteComment(e,t,n):this.deleteThread(e,t,r.threadId)),!0}deleteUnit(e){let t=this._commentsMap.get(e);t&&t.forEach((t,n)=>{t.forEach(t=>{this.deleteComment(e,n,t.id)})})}getUnit(e){let t=this._threadMap.get(e);if(!t)return[];let n=[];return t.forEach((t,r)=>{t.forEach((t,i)=>{let a=this.getThread(e,r,i);a&&n.push(a)})}),n}getAll(){let e=[];return this._commentsMap.forEach((t,n)=>{e.push({unitId:n,threads:this.getUnit(n)})}),e}};d=u([l(0,(0,t.Inject)(c)),l(1,(0,t.Inject)(t.LifecycleService))],d);let f={id:`thread-comment.mutation.add-comment`,type:t.CommandType.MUTATION,handler(e,t,n){if(!t)return!1;let r=e.get(d),{unitId:i,subUnitId:a,comment:o,sync:s}=t,c=s||(n==null?void 0:n.fromChangeset)&&!o.parentId;return r.addComment(i,a,o,c)}},p={id:`thread-comment.mutation.update-comment`,type:t.CommandType.MUTATION,handler(e,t){if(!t)return!1;let n=e.get(d),{unitId:r,subUnitId:i,payload:a,silent:o}=t;return n.updateComment(r,i,a,o)}},m={id:`thread-comment.mutation.update-comment-ref`,type:t.CommandType.MUTATION,handler(e,t){if(!t)return!1;let n=e.get(d),{unitId:r,subUnitId:i,payload:a,silent:o}=t;return n.updateCommentRef(r,i,a,o)}},h={id:`thread-comment.mutation.resolve-comment`,type:t.CommandType.MUTATION,handler(e,t){if(!t)return!1;let n=e.get(d),{unitId:r,subUnitId:i,resolved:a,commentId:o}=t;return n.resolveComment(r,i,o,a)}},g={id:`thread-comment.mutation.delete-comment`,type:t.CommandType.MUTATION,handler(e,t){if(!t)return!1;let n=e.get(d),{unitId:r,subUnitId:i,commentId:a}=t;return n.deleteComment(r,i,a)}},_={id:`thread-comment.command.add-comment`,type:t.CommandType.COMMAND,async handler(e,n){if(!n)return!1;let r=e.get(t.ICommandService),i=e.get(c),{comment:a}=n,o=await i.addComment(a),s=i.syncUpdateMutationToColla,l=!a.parentId,u={id:f.id,params:{...n,comment:o}};return l?await r.executeCommand(u.id,u.params):r.executeCommand(u.id,u.params,{onlyLocal:!s})}},v={id:`thread-comment.command.update-comment`,type:t.CommandType.COMMAND,async handler(e,n){if(!n)return!1;let{unitId:r,subUnitId:i,payload:a}=n,o=e.get(t.ICommandService),s=e.get(d),l=e.get(c),u=l.syncUpdateMutationToColla,f=s.getComment(r,i,a.commentId);if(!f)return!1;let{children:m,...h}=f;if(!await l.updateComment({...h,...a}))return!1;let g={id:p.id,params:n};return o.executeCommand(g.id,g.params,{onlyLocal:!u}),!0}},y={id:`thread-comment.command.resolve-comment`,type:t.CommandType.COMMAND,async handler(e,n){if(!n)return!1;let{unitId:r,subUnitId:i,resolved:a,commentId:o}=n,s=e.get(c),l=e.get(d).getComment(r,i,o),u=s.syncUpdateMutationToColla;return!l||!await s.resolveComment({...l,resolved:a})?!1:e.get(t.ICommandService).executeCommand(h.id,n,{onlyLocal:!u})}},b={id:`thread-comment.command.delete-comment`,type:t.CommandType.COMMAND,async handler(e,n){if(!n)return!1;let r=e.get(d),i=e.get(c),a=e.get(t.ICommandService),{unitId:o,subUnitId:s,commentId:l}=n,u=i.syncUpdateMutationToColla,f=r.getComment(o,s,l);if(!f||!await i.deleteComment(o,s,f.threadId,l))return!1;let p={id:g.id,params:n};return a.executeCommand(p.id,p.params,{onlyLocal:!u})}},x={id:`thread-comment.command.delete-comment-tree`,type:t.CommandType.COMMAND,async handler(e,n){if(!n)return!1;let r=e.get(d),i=e.get(t.ICommandService),a=e.get(c),{unitId:o,subUnitId:s,commentId:l}=n,u=r.getCommentWithChildren(o,s,l);return!u||!await a.deleteComment(o,s,u.root.threadId,l)?!1:await i.executeCommand(g.id,{unitId:o,subUnitId:s,commentId:u.root.id})}};function S(e){return(0,t.dateKit)(e).format(`YYYY/MM/DD HH:mm`)}let C=`UNIVER_THREAD_COMMENT_PLUGIN`,w=`SHEET_${C}`,T=class extends t.Disposable{constructor(e,t,n){super(),this._resourceManagerService=e,this._threadCommentModel=t,this._threadCommentDataSourceService=n,this._initSnapshot()}_initSnapshot(){let e=e=>{let t=this._threadCommentModel.getUnit(e),n={};return t?(t.forEach(e=>{var t;let r=(t=n[e.subUnitId])==null?[]:t;r.push({...e.root,children:e.children}),n[e.subUnitId]=r}),JSON.stringify(this._threadCommentDataSourceService.saveToSnapshot(n,e))):``},n=e=>{if(!e)return{};try{return JSON.parse(e)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:w,businesses:[t.UniverInstanceType.UNIVER_SHEET,t.UniverInstanceType.UNIVER_DOC],toJson:t=>e(t),parseJson:e=>n(e),onUnLoad:e=>{this._threadCommentModel.deleteUnit(e)},onLoad:async(e,t)=>{Object.keys(t).forEach(n=>{let r=t[n];r.forEach(t=>{this._threadCommentModel.addComment(e,n,t)}),this._threadCommentModel.syncThreadComments(e,n,r.map(e=>e.threadId))})}}))}};T=u([l(0,t.IResourceManagerService),l(1,(0,t.Inject)(d)),l(2,c)],T);var E=`@univerjs/thread-comment`,D=`0.25.0`;let O={},k=class extends t.Plugin{constructor(e=O,n,r,i){super(),this._config=e,this._injector=n,this._commandService=r,this._configService=i;let{...a}=(0,t.merge)({},O,this._config);this._configService.setConfig(`thread-comment.config`,a)}onStarting(){var e;(0,t.mergeOverrideWithDependencies)([[c,{useClass:s}],[d],[T]],(e=this._config)==null?void 0:e.overrides).forEach(e=>{this._injector.add(e)}),[_,v,b,y,x,f,p,m,g,h].forEach(e=>{this._commandService.registerCommand(e)}),this._injector.get(T)}};o(k,`pluginName`,C),o(k,`packageName`,E),o(k,`version`,D),o(k,`type`,t.UniverInstanceType.UNIVER_UNKNOWN),k=u([l(1,(0,t.Inject)(t.Injector)),l(2,t.ICommandService),l(3,t.IConfigService)],k),e.AddCommentCommand=_,e.AddCommentMutation=f,e.DeleteCommentCommand=b,e.DeleteCommentMutation=g,e.DeleteCommentTreeCommand=x,e.IThreadCommentDataSourceService=c,e.ResolveCommentCommand=y,e.ResolveCommentMutation=h,e.SHEET_UNIVER_THREAD_COMMENT_PLUGIN=w,e.TC_PLUGIN_NAME=C,e.ThreadCommentDataSourceService=s,Object.defineProperty(e,"ThreadCommentModel",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"ThreadCommentResourceController",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"UniverThreadCommentPlugin",{enumerable:!0,get:function(){return k}}),e.UpdateCommentCommand=v,e.UpdateCommentMutation=p,e.UpdateCommentRefMutation=m,e.getDT=S});
3
3
 
4
4
  // @univerjs/sheets-thread-comment/index
5
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(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`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverSheetsThreadComment={},e.UniverCore,e.UniverEngineFormula,e.UniverSheets,e.UniverThreadComment,e.rxjs))})(this,function(e,t,n,r,i,a){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function o(e){"@babel/helpers - typeof";return o=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},o(e)}function s(e,t){if(o(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(o(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function c(e){var t=s(e,`string`);return o(t)==`symbol`?t:t+``}function l(e,t,n){return(t=c(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e,t){return function(n,r){t(n,r,e)}}function d(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let f=class extends t.Disposable{constructor(e,t){super(),this._threadCommentModel=e,this._univerInstanceService=t,l(this,`_matrixMap`,new Map),l(this,`_locationMap`,new Map),l(this,`_commentUpdate$`,new a.Subject),l(this,`commentUpdate$`,this._commentUpdate$.asObservable()),this._init(),this.disposeWithMe(()=>{this._commentUpdate$.complete()})}_init(){this._initData(),this._initUpdateTransform()}_ensureCommentMatrix(e,n){let r=this._matrixMap.get(e);r||(r=new Map,this._matrixMap.set(e,r));let i=r.get(n);return i||(i=new t.ObjectMatrix,r.set(n,i)),i}_ensureCommentLocationMap(e,t){let n=this._locationMap.get(e);n||(n=new Map,this._locationMap.set(e,n));let r=n.get(t);return r||(r=new Map,n.set(t,r)),r}_addCommentToMatrix(e,t,n,r){var i;let a=(i=e.getValue(t,n))==null?new Set:i;a.add(r),e.setValue(t,n,a)}_deleteCommentFromMatrix(e,t,n,r){if(t>=0&&n>=0){let i=e.getValue(t,n);i&&i.has(r)&&(i.delete(r),i.size===0&&e.realDeleteValue(t,n))}}_ensure(e,t){return{matrix:this._ensureCommentMatrix(e,t),locationMap:this._ensureCommentLocationMap(e,t)}}_initData(){let e=this._threadCommentModel.getAll();for(let t of e)for(let e of t.threads){let{unitId:t,subUnitId:n,root:r}=e;this._addComment(t,n,r)}}_addComment(e,t,r){let i=(0,n.singleReferenceToGrid)(r.ref),a=r.parentId,{row:o,column:s}=i,c=r.id,{matrix:l,locationMap:u}=this._ensure(e,t);!a&&o>=0&&s>=0&&(this._addCommentToMatrix(l,o,s,c),u.set(c,{row:o,column:s})),a||this._commentUpdate$.next({unitId:e,subUnitId:t,payload:r,type:`add`,isRoot:!a,...i})}_initUpdateTransform(){this.disposeWithMe(this._threadCommentModel.commentUpdate$.subscribe(e=>{let{unitId:r,subUnitId:i}=e;try{if(this._univerInstanceService.getUnitType(r)!==t.UniverInstanceType.UNIVER_SHEET)return}catch{}let{matrix:a,locationMap:o}=this._ensure(r,i);switch(e.type){case`add`:this._addComment(e.unitId,e.subUnitId,e.payload);break;case`delete`:{let{isRoot:t,comment:r}=e.payload;if(t){let t=(0,n.singleReferenceToGrid)(r.ref),{row:i,column:o}=t;this._deleteCommentFromMatrix(a,i,o,r.id),this._commentUpdate$.next({...e,...t})}break}case`update`:{let{commentId:t}=e.payload,a=this._threadCommentModel.getComment(r,i,t);if(!a)return;let o=(0,n.singleReferenceToGrid)(a.ref);this._commentUpdate$.next({...e,...o});break}case`updateRef`:{let t=(0,n.singleReferenceToGrid)(e.payload.ref),{commentId:r}=e.payload,i=o.get(r);if(!i)return;let{row:s,column:c}=i;this._deleteCommentFromMatrix(a,s,c,r),o.delete(r),t.row>=0&&t.column>=0&&(this._addCommentToMatrix(a,t.row,t.column,r),o.set(r,{row:t.row,column:t.column})),this._commentUpdate$.next({...e,...t});break}case`resolve`:{let{unitId:t,subUnitId:n,payload:r}=e,{locationMap:i}=this._ensure(t,n),a=i.get(r.commentId);a&&this._commentUpdate$.next({...e,...a});break}default:break}}))}getByLocation(e,t,n,r){var i;return(i=this.getAllByLocation(e,t,n,r).filter(e=>!e.resolved)[0])==null?void 0:i.id}getAllByLocation(e,t,n,r){let i=this._ensureCommentMatrix(e,t).getValue(n,r);return i?Array.from(i).map(n=>this.getComment(e,t,n)).filter(Boolean):[]}getComment(e,t,n){return this._threadCommentModel.getComment(e,t,n)}getCommentWithChildren(e,t,n,r){let i=this.getByLocation(e,t,n,r);if(!i)return;let a=this.getComment(e,t,i);if(a)return this._threadCommentModel.getThread(e,t,a.threadId)}showCommentMarker(e,t,n,r){let i=this.getByLocation(e,t,n,r);if(!i)return!1;let a=this.getComment(e,t,i);return!!(a&&!a.resolved)}getSubUnitAll(e,t){return this._threadCommentModel.getUnit(e).filter(e=>e.subUnitId===t).map(e=>e.root)}};f=d([u(0,(0,t.Inject)(i.ThreadCommentModel)),u(1,t.IUniverInstanceService)],f);let p=class extends t.Disposable{constructor(e,t,r,a,o){super(),this._refRangeService=e,this._sheetsThreadCommentModel=t,this._threadCommentModel=r,this._selectionManagerService=a,this._commandService=o,l(this,`_disposableMap`,new Map),l(this,`_watcherMap`,new Map),l(this,`_handleRangeChange`,(e,t,r,a,o)=>{let s=r.id,c={startColumn:r.column,endColumn:r.column,startRow:r.row,endRow:r.row};return a?{redos:[{id:i.UpdateCommentRefMutation.id,params:{unitId:e,subUnitId:t,payload:{ref:(0,n.serializeRange)(a),commentId:s},silent:o}}],undos:[{id:i.UpdateCommentRefMutation.id,params:{unitId:e,subUnitId:t,payload:{ref:(0,n.serializeRange)(c),commentId:s},silent:o}}]}:{redos:[{id:i.DeleteCommentMutation.id,params:{unitId:e,subUnitId:t,commentId:s}}],undos:[{id:i.AddCommentMutation.id,params:{unitId:e,subUnitId:t,comment:r,sync:!0}}]}}),this._initData(),this._initRefRange()}_getIdWithUnitId(e,t,n){return`${e}-${t}-${n}`}_register(e,t,n){let i=n.id,a={startColumn:n.column,endColumn:n.column,startRow:n.row,endRow:n.row};this._disposableMap.set(this._getIdWithUnitId(e,t,i),this._refRangeService.registerRefRange(a,i=>{let o=(0,r.handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests)(a,i,{selectionManagerService:this._selectionManagerService}),s=Array.isArray(o)?o[0]:o;return s&&s.startColumn===a.startColumn&&s.startRow===a.startRow?{undos:[],redos:[]}:this._handleRangeChange(e,t,n,s,!1)},e,t))}_watch(e,n,r){let i=r.id,a={startColumn:r.column,endColumn:r.column,startRow:r.row,endRow:r.row};this._watcherMap.set(this._getIdWithUnitId(e,n,i),this._refRangeService.watchRange(e,n,a,(i,a)=>{let{redos:o}=this._handleRangeChange(e,n,r,a,!0);(0,t.sequenceExecuteAsync)(o,this._commandService,{onlyLocal:!0})},!0))}_unwatch(e,t,n){var r;let i=this._getIdWithUnitId(e,t,n);(r=this._watcherMap.get(i))==null||r.dispose(),this._watcherMap.delete(i)}_unregister(e,t,n){var r;let i=this._getIdWithUnitId(e,t,n);(r=this._disposableMap.get(i))==null||r.dispose(),this._disposableMap.delete(i)}_initData(){let e=this._threadCommentModel.getAll();for(let t of e)for(let e of t.threads){let{unitId:t,subUnitId:r,root:i}=e,a=(0,n.singleReferenceToGrid)(i.ref),o={...i,...a};this._register(t,r,o),this._watch(t,r,o)}}_initRefRange(){this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.subscribe(e=>{let{unitId:t,subUnitId:n}=e;switch(e.type){case`add`:{if(e.payload.parentId)return;let t={...e.payload,row:e.row,column:e.column};this._register(e.unitId,e.subUnitId,t),this._watch(e.unitId,e.subUnitId,t);break}case`delete`:this._unregister(t,n,e.payload.commentId),this._unwatch(t,n,e.payload.commentId);break;case`updateRef`:{let r=this._sheetsThreadCommentModel.getComment(t,n,e.payload.commentId);if(!r)return;this._unregister(t,n,e.payload.commentId);let i={...r,row:e.row,column:e.column};e.silent||(this._unwatch(t,n,e.payload.commentId),this._watch(t,n,i)),this._register(e.unitId,e.subUnitId,i);break}}})),this.disposeWithMe((0,t.toDisposable)(()=>{this._disposableMap.forEach(e=>{e.dispose()}),this._disposableMap.clear()}))}};p=d([u(0,(0,t.Inject)(r.RefRangeService)),u(1,(0,t.Inject)(f)),u(2,(0,t.Inject)(i.ThreadCommentModel)),u(3,(0,t.Inject)(r.SheetsSelectionsService)),u(4,t.ICommandService)],p);var m=`@univerjs/sheets-thread-comment`,h=`0.23.0`;let g={},_=class extends t.Disposable{constructor(e,t,n,r){super(),this._univerInstanceService=e,this._sheetInterceptorService=t,this._threadCommentModel=n,this._threadCommentDataSourceService=r,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{if(e.id===r.RemoveSheetCommand.id){var n;let r=e.params,a=r.unitId||this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getUnitId(),o=r.subUnitId||((n=this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:n.getSheetId());if(!a||!o)return{redos:[],undos:[]};let s=this._threadCommentModel.ensureMap(a,o),c=Array.from(s.values()).filter(e=>!e.parentId),l=this._threadCommentDataSourceService.syncUpdateMutationToColla,u=[],d=[];return c.forEach(({children:e,...t})=>{u.push({id:i.DeleteCommentMutation.id,params:{unitId:a,subUnitId:o,commentId:t.id}}),d.push({id:i.AddCommentMutation.id,params:{unitId:a,subUnitId:o,comment:{...t,children:l?e:void 0},sync:!l}})}),{redos:u,undos:d}}else if(e.id===r.CopySheetCommand.id){let{unitId:n,subUnitId:r,targetSubUnitId:a}=e.params;if(!n||!r||!a)return{redos:[],undos:[]};let o=this._threadCommentModel.ensureMap(n,r),s=Array.from(o.values()).map(e=>({...e,subUnitId:a,id:(0,t.generateRandomId)(),threadId:(0,t.generateRandomId)()})).filter(e=>!e.parentId),c=this._threadCommentDataSourceService.syncUpdateMutationToColla,l=[],u=[];return s.forEach(({children:e,...t})=>{l.push({id:i.AddCommentMutation.id,params:{unitId:n,subUnitId:a,comment:{...t,children:c?e:void 0},sync:!c}}),u.push({id:i.DeleteCommentMutation.id,params:{unitId:n,subUnitId:a,commentId:t.id}})}),{redos:l,undos:u}}return{redos:[],undos:[]}}}))}};_=d([u(0,t.IUniverInstanceService),u(1,(0,t.Inject)(r.SheetInterceptorService)),u(2,(0,t.Inject)(i.ThreadCommentModel)),u(3,i.IThreadCommentDataSourceService)],_);let v=class extends t.Plugin{constructor(e=g,t,n){super(),this._config=e,this._injector=t,this._commandService=n}onStarting(){[[f],[p],[_]].forEach(e=>{this._injector.add(e)}),(0,t.touchDependencies)(this._injector,[[p],[_]])}};l(v,`pluginName`,`SHEET_THREAD_COMMENT_BASE_PLUGIN`),l(v,`packageName`,m),l(v,`version`,h),l(v,`type`,t.UniverInstanceType.UNIVER_SHEET),v=d([(0,t.DependentOn)(i.UniverThreadCommentPlugin),u(1,(0,t.Inject)(t.Injector)),u(2,(0,t.Inject)(t.ICommandService))],v),Object.defineProperty(e,`SheetsThreadCommentModel`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,`SheetsThreadCommentRefRangeController`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,`UniverSheetsThreadCommentPlugin`,{enumerable:!0,get:function(){return v}})});
5
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(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`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverSheetsThreadComment={},e.UniverCore,e.UniverEngineFormula,e.UniverSheets,e.UniverThreadComment,e.rxjs))})(this,function(e,t,n,r,i,a){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function o(e){"@babel/helpers - typeof";return o=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},o(e)}function s(e,t){if(o(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(o(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function c(e){var t=s(e,`string`);return o(t)==`symbol`?t:t+``}function l(e,t,n){return(t=c(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e,t){return function(n,r){t(n,r,e)}}function d(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let f=class extends t.Disposable{constructor(e,t){super(),this._threadCommentModel=e,this._univerInstanceService=t,l(this,`_matrixMap`,new Map),l(this,`_locationMap`,new Map),l(this,`_commentUpdate$`,new a.Subject),l(this,`commentUpdate$`,this._commentUpdate$.asObservable()),this._init(),this.disposeWithMe(()=>{this._commentUpdate$.complete()})}_init(){this._initData(),this._initUpdateTransform()}_ensureCommentMatrix(e,n){let r=this._matrixMap.get(e);r||(r=new Map,this._matrixMap.set(e,r));let i=r.get(n);return i||(i=new t.ObjectMatrix,r.set(n,i)),i}_ensureCommentLocationMap(e,t){let n=this._locationMap.get(e);n||(n=new Map,this._locationMap.set(e,n));let r=n.get(t);return r||(r=new Map,n.set(t,r)),r}_addCommentToMatrix(e,t,n,r){var i;let a=(i=e.getValue(t,n))==null?new Set:i;a.add(r),e.setValue(t,n,a)}_deleteCommentFromMatrix(e,t,n,r){if(t>=0&&n>=0){let i=e.getValue(t,n);i&&i.has(r)&&(i.delete(r),i.size===0&&e.realDeleteValue(t,n))}}_ensure(e,t){return{matrix:this._ensureCommentMatrix(e,t),locationMap:this._ensureCommentLocationMap(e,t)}}_initData(){let e=this._threadCommentModel.getAll();for(let t of e)for(let e of t.threads){let{unitId:t,subUnitId:n,root:r}=e;this._addComment(t,n,r)}}_addComment(e,t,r){let i=(0,n.singleReferenceToGrid)(r.ref),a=r.parentId,{row:o,column:s}=i,c=r.id,{matrix:l,locationMap:u}=this._ensure(e,t);!a&&o>=0&&s>=0&&(this._addCommentToMatrix(l,o,s,c),u.set(c,{row:o,column:s})),a||this._commentUpdate$.next({unitId:e,subUnitId:t,payload:r,type:`add`,isRoot:!a,...i})}_initUpdateTransform(){this.disposeWithMe(this._threadCommentModel.commentUpdate$.subscribe(e=>{let{unitId:r,subUnitId:i}=e;try{if(this._univerInstanceService.getUnitType(r)!==t.UniverInstanceType.UNIVER_SHEET)return}catch{}let{matrix:a,locationMap:o}=this._ensure(r,i);switch(e.type){case`add`:this._addComment(e.unitId,e.subUnitId,e.payload);break;case`delete`:{let{isRoot:t,comment:r}=e.payload;if(t){let t=(0,n.singleReferenceToGrid)(r.ref),{row:i,column:o}=t;this._deleteCommentFromMatrix(a,i,o,r.id),this._commentUpdate$.next({...e,...t})}break}case`update`:{let{commentId:t}=e.payload,a=this._threadCommentModel.getComment(r,i,t);if(!a)return;let o=(0,n.singleReferenceToGrid)(a.ref);this._commentUpdate$.next({...e,...o});break}case`updateRef`:{let t=(0,n.singleReferenceToGrid)(e.payload.ref),{commentId:r}=e.payload,i=o.get(r);if(!i)return;let{row:s,column:c}=i;this._deleteCommentFromMatrix(a,s,c,r),o.delete(r),t.row>=0&&t.column>=0&&(this._addCommentToMatrix(a,t.row,t.column,r),o.set(r,{row:t.row,column:t.column})),this._commentUpdate$.next({...e,...t});break}case`resolve`:{let{unitId:t,subUnitId:n,payload:r}=e,{locationMap:i}=this._ensure(t,n),a=i.get(r.commentId);a&&this._commentUpdate$.next({...e,...a});break}default:break}}))}getByLocation(e,t,n,r){var i;return(i=this.getAllByLocation(e,t,n,r).filter(e=>!e.resolved)[0])==null?void 0:i.id}getAllByLocation(e,t,n,r){let i=this._ensureCommentMatrix(e,t).getValue(n,r);if(!i)return[];let a=[];for(let n of i){let r=this.getComment(e,t,n);r&&a.push(r)}return a}getComment(e,t,n){return this._threadCommentModel.getComment(e,t,n)}getCommentWithChildren(e,t,n,r){let i=this.getByLocation(e,t,n,r);if(!i)return;let a=this.getComment(e,t,i);if(a)return this._threadCommentModel.getThread(e,t,a.threadId)}showCommentMarker(e,t,n,r){let i=this.getByLocation(e,t,n,r);if(!i)return!1;let a=this.getComment(e,t,i);return!!(a&&!a.resolved)}getSubUnitAll(e,t){return this._threadCommentModel.getUnit(e).filter(e=>e.subUnitId===t).map(e=>e.root)}};f=d([u(0,(0,t.Inject)(i.ThreadCommentModel)),u(1,t.IUniverInstanceService)],f);let p=class extends t.Disposable{constructor(e,t,r,a,o){super(),this._refRangeService=e,this._sheetsThreadCommentModel=t,this._threadCommentModel=r,this._selectionManagerService=a,this._commandService=o,l(this,`_disposableMap`,new Map),l(this,`_watcherMap`,new Map),l(this,`_handleRangeChange`,(e,t,r,a,o)=>{let s=r.id,c={startColumn:r.column,endColumn:r.column,startRow:r.row,endRow:r.row};return a?{redos:[{id:i.UpdateCommentRefMutation.id,params:{unitId:e,subUnitId:t,payload:{ref:(0,n.serializeRange)(a),commentId:s},silent:o}}],undos:[{id:i.UpdateCommentRefMutation.id,params:{unitId:e,subUnitId:t,payload:{ref:(0,n.serializeRange)(c),commentId:s},silent:o}}]}:{redos:[{id:i.DeleteCommentMutation.id,params:{unitId:e,subUnitId:t,commentId:s}}],undos:[{id:i.AddCommentMutation.id,params:{unitId:e,subUnitId:t,comment:r,sync:!0}}]}}),this._initData(),this._initRefRange()}_getIdWithUnitId(e,t,n){return`${e}-${t}-${n}`}_register(e,t,n){let i=n.id,a={startColumn:n.column,endColumn:n.column,startRow:n.row,endRow:n.row};this._disposableMap.set(this._getIdWithUnitId(e,t,i),this._refRangeService.registerRefRange(a,i=>{let o=(0,r.handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests)(a,i,{selectionManagerService:this._selectionManagerService}),s=Array.isArray(o)?o[0]:o;return s&&s.startColumn===a.startColumn&&s.startRow===a.startRow?{undos:[],redos:[]}:this._handleRangeChange(e,t,n,s,!1)},e,t))}_watch(e,n,r){let i=r.id,a={startColumn:r.column,endColumn:r.column,startRow:r.row,endRow:r.row};this._watcherMap.set(this._getIdWithUnitId(e,n,i),this._refRangeService.watchRange(e,n,a,(i,a)=>{let{redos:o}=this._handleRangeChange(e,n,r,a,!0);(0,t.sequenceExecuteAsync)(o,this._commandService,{onlyLocal:!0})},!0))}_unwatch(e,t,n){var r;let i=this._getIdWithUnitId(e,t,n);(r=this._watcherMap.get(i))==null||r.dispose(),this._watcherMap.delete(i)}_unregister(e,t,n){var r;let i=this._getIdWithUnitId(e,t,n);(r=this._disposableMap.get(i))==null||r.dispose(),this._disposableMap.delete(i)}_initData(){let e=this._threadCommentModel.getAll();for(let t of e)for(let e of t.threads){let{unitId:t,subUnitId:r,root:i}=e,a=(0,n.singleReferenceToGrid)(i.ref),o={...i,...a};this._register(t,r,o),this._watch(t,r,o)}}_initRefRange(){this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.subscribe(e=>{let{unitId:t,subUnitId:n}=e;switch(e.type){case`add`:{if(e.payload.parentId)return;let t={...e.payload,row:e.row,column:e.column};this._register(e.unitId,e.subUnitId,t),this._watch(e.unitId,e.subUnitId,t);break}case`delete`:this._unregister(t,n,e.payload.commentId),this._unwatch(t,n,e.payload.commentId);break;case`updateRef`:{let r=this._sheetsThreadCommentModel.getComment(t,n,e.payload.commentId);if(!r)return;this._unregister(t,n,e.payload.commentId);let i={...r,row:e.row,column:e.column};e.silent||(this._unwatch(t,n,e.payload.commentId),this._watch(t,n,i)),this._register(e.unitId,e.subUnitId,i);break}}})),this.disposeWithMe((0,t.toDisposable)(()=>{this._disposableMap.forEach(e=>{e.dispose()}),this._disposableMap.clear()}))}};p=d([u(0,(0,t.Inject)(r.RefRangeService)),u(1,(0,t.Inject)(f)),u(2,(0,t.Inject)(i.ThreadCommentModel)),u(3,(0,t.Inject)(r.SheetsSelectionsService)),u(4,t.ICommandService)],p);var m=`@univerjs/sheets-thread-comment`,h=`0.25.0`;let g={},_=class extends t.Disposable{constructor(e,t,n,r){super(),this._univerInstanceService=e,this._sheetInterceptorService=t,this._threadCommentModel=n,this._threadCommentDataSourceService=r,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{if(e.id===r.RemoveSheetCommand.id){var n;let r=e.params,a=r.unitId||this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getUnitId(),o=r.subUnitId||((n=this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:n.getSheetId());if(!a||!o)return{redos:[],undos:[]};let s=this._threadCommentModel.ensureMap(a,o),c=Array.from(s.values()).filter(e=>!e.parentId),l=this._threadCommentDataSourceService.syncUpdateMutationToColla,u=[],d=[];return c.forEach(({children:e,...t})=>{u.push({id:i.DeleteCommentMutation.id,params:{unitId:a,subUnitId:o,commentId:t.id}}),d.push({id:i.AddCommentMutation.id,params:{unitId:a,subUnitId:o,comment:{...t,children:l?e:void 0},sync:!l}})}),{redos:u,undos:d}}else if(e.id===r.CopySheetCommand.id){let{unitId:n,subUnitId:r,targetSubUnitId:a}=e.params;if(!n||!r||!a)return{redos:[],undos:[]};let o=this._threadCommentModel.ensureMap(n,r),s=Array.from(o.values()).map(e=>({...e,subUnitId:a,id:(0,t.generateRandomId)(),threadId:(0,t.generateRandomId)()})).filter(e=>!e.parentId),c=this._threadCommentDataSourceService.syncUpdateMutationToColla,l=[],u=[];return s.forEach(({children:e,...t})=>{l.push({id:i.AddCommentMutation.id,params:{unitId:n,subUnitId:a,comment:{...t,children:c?e:void 0},sync:!c}}),u.push({id:i.DeleteCommentMutation.id,params:{unitId:n,subUnitId:a,commentId:t.id}})}),{redos:l,undos:u}}return{redos:[],undos:[]}}}))}};_=d([u(0,t.IUniverInstanceService),u(1,(0,t.Inject)(r.SheetInterceptorService)),u(2,(0,t.Inject)(i.ThreadCommentModel)),u(3,i.IThreadCommentDataSourceService)],_);let v=class extends t.Plugin{constructor(e=g,t,n){super(),this._config=e,this._injector=t,this._commandService=n}onStarting(){[[f],[p],[_]].forEach(e=>{this._injector.add(e)}),(0,t.touchDependencies)(this._injector,[[p],[_]])}};l(v,`pluginName`,`SHEET_THREAD_COMMENT_BASE_PLUGIN`),l(v,`packageName`,m),l(v,`version`,h),l(v,`type`,t.UniverInstanceType.UNIVER_SHEET),v=d([(0,t.DependentOn)(i.UniverThreadCommentPlugin),u(1,(0,t.Inject)(t.Injector)),u(2,(0,t.Inject)(t.ICommandService))],v),Object.defineProperty(e,"SheetsThreadCommentModel",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"SheetsThreadCommentRefRangeController",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"UniverSheetsThreadCommentPlugin",{enumerable:!0,get:function(){return v}})});
6
6
 
7
7
  // @univerjs/sheets-thread-comment/facade
8
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@univerjs/core`),require(`@univerjs/sheets-thread-comment`),require(`@univerjs/sheets/facade`),require(`@univerjs/thread-comment`),require(`@univerjs/engine-formula`),require(`rxjs`),require(`@univerjs/core/facade`)):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/sheets-thread-comment`,`@univerjs/sheets/facade`,`@univerjs/thread-comment`,`@univerjs/engine-formula`,`rxjs`,`@univerjs/core/facade`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverSheetsThreadCommentFacade={},e.UniverCore,e.UniverSheetsThreadComment,e.UniverSheetsFacade,e.UniverThreadComment,e.UniverEngineFormula,e.rxjs,e.UniverCoreFacade))})(this,function(e,t,n,r,i,a,o,s){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function c(e){"@babel/helpers - typeof";return c=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},c(e)}function l(e,t){if(c(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(c(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function u(e){var t=l(e,`string`);return c(t)==`symbol`?t:t+``}function d(e,t,n){return(t=u(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f(e,t){return function(n,r){t(n,r,e)}}function p(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var m,h=class e{static create(t){return new e(t)}constructor(e){d(this,`_comment`,{id:(0,t.generateRandomId)(),ref:``,threadId:``,dT:``,personId:``,text:t.RichTextBuilder.newEmptyData().body,attachments:[],unitId:``,subUnitId:``}),e&&(this._comment=e)}get personId(){return this._comment.personId}get dateTime(){return this._comment.dT}get content(){return t.RichTextValue.createByBody(this._comment.text)}get id(){return this._comment.id}get threadId(){return this._comment.threadId}copy(){return g.create(t.Tools.deepClone(this._comment))}},g=class e extends h{static create(t){return new e(t)}setContent(e){return e instanceof t.RichTextValue?this._comment.text=e.getData().body:this._comment.text=e,this}setPersonId(e){return this._comment.personId=e,this}setDateTime(e){return this._comment.dT=(0,i.getDT)(e),this}setId(e){return this._comment.id=e,this}setThreadId(e){return this._comment.threadId=e,this}build(){return this._comment}};let _=m=class{constructor(e,t,n,r,i,a,o){this._thread=e,this._parent=t,this._injector=n,this._commandService=r,this._univerInstanceService=i,this._threadCommentModel=a,this._userManagerService=o}_getRef(){var e;return(0,a.deserializeRangeWithSheet)(((e=this._parent)==null?void 0:e.ref)||this._thread.ref).range}getIsRoot(){return!this._parent}getCommentData(){let{children:e,...t}=this._thread;return t}getReplies(){var e;let t=this._getRef(),n=this._threadCommentModel.getCommentWithChildren(this._thread.unitId,this._thread.subUnitId,t.startRow,t.startColumn);return n==null||(e=n.children)==null?void 0:e.map(e=>this._injector.createInstance(m,e))}getRange(){let e=this._univerInstanceService.getUnit(this._thread.unitId,t.UniverInstanceType.UNIVER_SHEET);if(!e)return null;let n=e.getSheetBySheetId(this._thread.subUnitId);if(!n)return null;let i=this._getRef();return this._injector.createInstance(r.FRange,e,n,i)}getContent(){return this._thread.text}getRichText(){let e=this._thread.text;return t.RichTextValue.create({body:e,documentStyle:{},id:`d`})}deleteAsync(){return this._commandService.executeCommand(this.getIsRoot()?i.DeleteCommentTreeCommand.id:i.DeleteCommentCommand.id,{commentId:this._thread.id,unitId:this._thread.unitId,subUnitId:this._thread.subUnitId})}delete(){return this.deleteAsync()}async update(e){return this.updateAsync(e)}async updateAsync(e){let n=e instanceof t.RichTextValue?e.getData().body:e,r=(0,i.getDT)();return await this._commandService.executeCommand(i.UpdateCommentCommand.id,{unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,payload:{commentId:this._thread.id,text:n,updated:!0,updateT:r}})}resolve(e){return this.resolveAsync(e)}resolveAsync(e){return this._commandService.executeCommand(i.ResolveCommentCommand.id,{unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,commentId:this._thread.id,resolved:e==null?!this._thread.resolved:e})}replyAsync(e){var n;let r=e.build();return this._commandService.executeCommand(i.AddCommentCommand.id,{unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,comment:{id:(0,t.generateRandomId)(),parentId:this._thread.id,threadId:this._thread.threadId,ref:((n=this._parent)==null?void 0:n.ref)||this._thread.ref,unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,text:r.text,attachments:r.attachments,dT:r.dT||(0,i.getDT)(),personId:r.personId||this._userManagerService.getCurrentUser().userID}})}};_=m=p([f(2,(0,t.Inject)(t.Injector)),f(3,t.ICommandService),f(4,t.IUniverInstanceService),f(5,(0,t.Inject)(n.SheetsThreadCommentModel)),f(6,(0,t.Inject)(t.UserManagerService))],_);var v=class extends r.FRange{getComment(){let e=this._injector.get(n.SheetsThreadCommentModel),t=this._workbook.getUnitId(),r=this._worksheet.getSheetId(),i=e.getByLocation(t,r,this._range.startRow,this._range.startColumn);if(!i)return null;let a=e.getComment(t,r,i);return a?this._injector.createInstance(_,a):null}getComments(){let e=this._injector.get(n.SheetsThreadCommentModel),r=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),a=[];return t.Range.foreach(this._range,(t,n)=>{let o=e.getByLocation(r,i,t,n);if(o){let t=e.getComment(r,i,o);t&&a.push(this._injector.createInstance(_,t))}}),a}addComment(e){var n;let r=this._injector,a=(n=this.getComment())==null?void 0:n.getCommentData(),o=r.get(t.ICommandService),s=r.get(t.UserManagerService),c=this._workbook.getUnitId(),l=this._worksheet.getSheetId(),u=`${t.Tools.chatAtABC(this._range.startColumn)}${this._range.startRow+1}`,d=s.getCurrentUser(),f=e instanceof g?e.build():{text:e};return o.executeCommand(i.AddCommentCommand.id,{unitId:c,subUnitId:l,comment:{text:f.text,dT:f.dT||(0,i.getDT)(),attachments:[],id:f.id||(0,t.generateRandomId)(),ref:u,personId:f.personId||d.userID,parentId:a==null?void 0:a.id,unitId:c,subUnitId:l,threadId:(a==null?void 0:a.threadId)||(0,t.generateRandomId)()}})}clearComment(){var e;let n=this._injector,r=(e=this.getComment())==null?void 0:e.getCommentData(),a=n.get(t.ICommandService),o=this._workbook.getUnitId(),s=this._worksheet.getSheetId();return r?a.executeCommand(i.DeleteCommentTreeCommand.id,{unitId:o,subUnitId:s,threadId:r.threadId,commentId:r.id}):Promise.resolve(!0)}clearComments(){let e=this.getComments().map(e=>e.deleteAsync());return Promise.all(e).then(()=>!0)}addCommentAsync(e){return this.addComment(e)}clearCommentAsync(){return this.clearComment()}clearCommentsAsync(){return this.clearComments()}};r.FRange.extend(v);var y=class extends r.FWorkbook{_initialize(){Object.defineProperty(this,`_threadCommentModel`,{get(){return this._injector.get(i.ThreadCommentModel)}})}getComments(){return this._threadCommentModel.getUnit(this._workbook.getUnitId()).map(e=>this._injector.createInstance(_,e.root))}clearComments(){let e=this.getComments().map(e=>e.deleteAsync());return Promise.all(e).then(()=>!0)}onThreadCommentChange(e){return(0,t.toDisposable)(this._threadCommentModel.commentUpdate$.pipe((0,o.filter)(e=>e.unitId===this._workbook.getUnitId())).subscribe(e))}onBeforeAddThreadComment(e){return(0,t.toDisposable)(this._commandService.beforeCommandExecuted((t,n)=>{let r=t.params;if(t.id===i.AddCommentCommand.id){if(r.unitId!==this._workbook.getUnitId())return;if(e(r,n)===!1)throw Error(`Command is stopped by the hook onBeforeAddThreadComment`)}}))}onBeforeUpdateThreadComment(e){return(0,t.toDisposable)(this._commandService.beforeCommandExecuted((t,n)=>{let r=t.params;if(t.id===i.UpdateCommentCommand.id){if(r.unitId!==this._workbook.getUnitId())return;if(e(r,n)===!1)throw Error(`Command is stopped by the hook onBeforeUpdateThreadComment`)}}))}onBeforeDeleteThreadComment(e){return(0,t.toDisposable)(this._commandService.beforeCommandExecuted((t,n)=>{let r=t.params;if(t.id===i.DeleteCommentCommand.id||t.id===i.DeleteCommentTreeCommand.id){if(r.unitId!==this._workbook.getUnitId())return;if(e(r,n)===!1)throw Error(`Command is stopped by the hook onBeforeDeleteThreadComment`)}}))}};r.FWorkbook.extend(y);var b=class extends r.FWorksheet{getComments(){return this._injector.get(n.SheetsThreadCommentModel).getSubUnitAll(this._workbook.getUnitId(),this._worksheet.getSheetId()).map(e=>this._injector.createInstance(_,e))}clearComments(){let e=this.getComments().map(e=>e.deleteAsync());return Promise.all(e).then(()=>!0)}onCommented(e){return this._injector.get(t.ICommandService).onCommandExecuted(t=>{if(t.id===i.AddCommentCommand.id){let n=t.params;e(n)}})}getCommentById(e){let t=this._injector.get(n.SheetsThreadCommentModel).getComment(this._workbook.getUnitId(),this._worksheet.getSheetId(),e);if(t)return this._injector.createInstance(_,t)}};r.FWorksheet.extend(b);var x=class extends s.FEventName{get CommentAdded(){return`CommentAdded`}get BeforeCommentAdd(){return`BeforeCommentAdd`}get CommentUpdated(){return`CommentUpdated`}get BeforeCommentUpdate(){return`BeforeCommentUpdate`}get CommentDeleted(){return`CommentDeleted`}get BeforeCommentDelete(){return`BeforeCommentDelete`}get CommentResolved(){return`CommentResolved`}get BeforeCommentResolve(){return`BeforeCommentResolve`}};s.FEventName.extend(x);var S=class extends s.FUniver{_getTargetSheet(e={}){var t;let n=e.unitId?this.getUniverSheet(e.unitId):(t=this.getActiveWorkbook)==null?void 0:t.call(this);if(!n)return null;let r=e.subUnitId?n.getSheetBySheetId(e.subUnitId):n.getActiveSheet();return r?{workbook:n,worksheet:r}:null}_initialize(e){let n=e.get(t.ICommandService);this.disposeWithMe(this.registerEventHandler(this.Event.CommentAdded,()=>n.onCommandExecuted(e=>{var t,n,r,a;if(e.id!==i.AddCommentCommand.id)return;let o=this._getTargetSheet(e.params);if(!o)return;let{workbook:s,worksheet:c}=o,{comment:l}=e.params,u=c.getCommentById(l.id);if(!u)return;let d={workbook:s,worksheet:c,row:(t=(n=u.getRange())==null?void 0:n.getRow())==null?0:t,col:(r=(a=u.getRange())==null?void 0:a.getColumn())==null?0:r,comment:u};this.fireEvent(this.Event.CommentAdded,d)}))),this.disposeWithMe(this.registerEventHandler(this.Event.CommentUpdated,()=>n.onCommandExecuted(e=>{var t,n,r,a;if(e.id!==i.UpdateCommentCommand.id)return;let o=this._getTargetSheet(e.params);if(!o)return;let{workbook:s,worksheet:c}=o,{payload:l}=e.params,u=c.getCommentById(l.commentId);if(!u)return;let d={workbook:s,worksheet:c,row:(t=(n=u.getRange())==null?void 0:n.getRow())==null?0:t,col:(r=(a=u.getRange())==null?void 0:a.getColumn())==null?0:r,comment:u};this.fireEvent(this.Event.CommentUpdated,d)}))),this.disposeWithMe(this.registerEventHandler(this.Event.CommentDeleted,()=>n.onCommandExecuted(e=>{if(e.id!==i.DeleteCommentCommand.id&&e.id!==i.DeleteCommentTreeCommand.id)return;let t=this._getTargetSheet(e.params);if(!t)return;let{workbook:n,worksheet:r}=t,{commentId:a}=e.params,o={workbook:n,worksheet:r,commentId:a};this.fireEvent(this.Event.CommentDeleted,o)}))),this.disposeWithMe(this.registerEventHandler(this.Event.CommentResolved,()=>n.onCommandExecuted(e=>{var t,n,r,a;if(e.id!==i.ResolveCommentCommand.id)return;let o=this._getTargetSheet(e.params);if(!o)return;let{workbook:s,worksheet:c}=o,{commentId:l,resolved:u}=e.params,d=c.getCommentById(l);if(!d)return;let f={workbook:s,worksheet:c,row:(t=(n=d.getRange())==null?void 0:n.getRow())==null?0:t,col:(r=(a=d.getRange())==null?void 0:a.getColumn())==null?0:r,comment:d,resolved:u};this.fireEvent(this.Event.CommentResolved,f)}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeCommentAdd,()=>n.beforeCommandExecuted(e=>{if(e.id!==i.AddCommentCommand.id)return;let n=this._getTargetSheet(e.params);if(!n)return;let{workbook:r,worksheet:o}=n,{comment:s}=e.params,{range:c}=(0,a.deserializeRangeWithSheet)(s.ref),l={workbook:r,worksheet:o,row:c.startRow,col:c.startColumn,comment:h.create(s)};if(this.fireEvent(this.Event.BeforeCommentAdd,l),l.cancel)throw new t.CanceledError}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeCommentUpdate,()=>n.beforeCommandExecuted(e=>{var n,r,a,o;if(e.id!==i.UpdateCommentCommand.id)return;let s=this._getTargetSheet(e.params);if(!s)return;let{workbook:c,worksheet:l}=s,{payload:u}=e.params,d=l.getCommentById(u.commentId);if(!d)return;let f={workbook:c,worksheet:l,row:(n=(r=d.getRange())==null?void 0:r.getRow())==null?0:n,col:(a=(o=d.getRange())==null?void 0:o.getColumn())==null?0:a,comment:d,newContent:t.RichTextValue.createByBody(u.text)};if(this.fireEvent(this.Event.BeforeCommentUpdate,f),f.cancel)throw new t.CanceledError}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeCommentDelete,()=>n.beforeCommandExecuted(e=>{var n,r,a,o;if(e.id!==i.DeleteCommentCommand.id&&e.id!==i.DeleteCommentTreeCommand.id)return;let s=this._getTargetSheet(e.params);if(!s)return;let{workbook:c,worksheet:l}=s,{commentId:u}=e.params,d=l.getCommentById(u);if(!d)return;let f={workbook:c,worksheet:l,row:(n=(r=d.getRange())==null?void 0:r.getRow())==null?0:n,col:(a=(o=d.getRange())==null?void 0:o.getColumn())==null?0:a,comment:d};if(this.fireEvent(this.Event.BeforeCommentDelete,f),f.cancel)throw new t.CanceledError}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeCommentResolve,()=>n.beforeCommandExecuted(e=>{var n,r;if(e.id!==i.ResolveCommentCommand.id)return;let a=this._getTargetSheet(e.params);if(!a)return;let{workbook:o,worksheet:s}=a,{commentId:c,resolved:l}=e.params,u=s.getCommentById(c);if(!u)return;let d={workbook:o,worksheet:s,row:(n=u.getRange().getRow())==null?0:n,col:(r=u.getRange().getColumn())==null?0:r,comment:u,resolved:l};if(this.fireEvent(this.Event.BeforeCommentResolve,d),d.cancel)throw new t.CanceledError})))}newTheadComment(e){return new g(e)}};s.FUniver.extend(S),Object.defineProperty(e,`FThreadComment`,{enumerable:!0,get:function(){return _}})});
8
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@univerjs/core"),require("@univerjs/sheets-thread-comment"),require("@univerjs/sheets/facade"),require("@univerjs/thread-comment"),require("@univerjs/engine-formula"),require("rxjs"),require("@univerjs/core/facade")):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/sheets-thread-comment`,`@univerjs/sheets/facade`,`@univerjs/thread-comment`,`@univerjs/engine-formula`,`rxjs`,`@univerjs/core/facade`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverSheetsThreadCommentFacade={},e.UniverCore,e.UniverSheetsThreadComment,e.UniverSheetsFacade,e.UniverThreadComment,e.UniverEngineFormula,e.rxjs,e.UniverCoreFacade))})(this,function(e,t,n,r,i,a,o,s){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function c(e){"@babel/helpers - typeof";return c=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},c(e)}function l(e,t){if(c(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(c(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function u(e){var t=l(e,`string`);return c(t)==`symbol`?t:t+``}function d(e,t,n){return(t=u(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f(e,t){return function(n,r){t(n,r,e)}}function p(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var m,h=class e{static create(t){return new e(t)}constructor(e){d(this,`_comment`,{id:(0,t.generateRandomId)(),ref:``,threadId:``,dT:``,personId:``,text:t.RichTextBuilder.newEmptyData().body,attachments:[],unitId:``,subUnitId:``}),e&&(this._comment=e)}get personId(){return this._comment.personId}get dateTime(){return this._comment.dT}get content(){return t.RichTextValue.createByBody(this._comment.text)}get id(){return this._comment.id}get threadId(){return this._comment.threadId}copy(){return g.create(t.Tools.deepClone(this._comment))}},g=class e extends h{static create(t){return new e(t)}setContent(e){return e instanceof t.RichTextValue?this._comment.text=e.getData().body:this._comment.text=e,this}setPersonId(e){return this._comment.personId=e,this}setDateTime(e){return this._comment.dT=(0,i.getDT)(e),this}setId(e){return this._comment.id=e,this}setThreadId(e){return this._comment.threadId=e,this}build(){return this._comment}};let _=m=class{constructor(e,t,n,r,i,a,o){this._thread=e,this._parent=t,this._injector=n,this._commandService=r,this._univerInstanceService=i,this._threadCommentModel=a,this._userManagerService=o}_getRef(){var e;return(0,a.deserializeRangeWithSheet)(((e=this._parent)==null?void 0:e.ref)||this._thread.ref).range}getIsRoot(){return!this._parent}getCommentData(){let{children:e,...t}=this._thread;return t}getReplies(){var e;let t=this._getRef(),n=this._threadCommentModel.getCommentWithChildren(this._thread.unitId,this._thread.subUnitId,t.startRow,t.startColumn);return n==null||(e=n.children)==null?void 0:e.map(e=>this._injector.createInstance(m,e))}getRange(){let e=this._univerInstanceService.getUnit(this._thread.unitId,t.UniverInstanceType.UNIVER_SHEET);if(!e)return null;let n=e.getSheetBySheetId(this._thread.subUnitId);if(!n)return null;let i=this._getRef();return this._injector.createInstance(r.FRange,e,n,i)}getContent(){return this._thread.text}getRichText(){let e=this._thread.text;return t.RichTextValue.create({body:e,documentStyle:{},id:`d`})}deleteAsync(){return this._commandService.executeCommand(this.getIsRoot()?i.DeleteCommentTreeCommand.id:i.DeleteCommentCommand.id,{commentId:this._thread.id,unitId:this._thread.unitId,subUnitId:this._thread.subUnitId})}delete(){return this.deleteAsync()}async update(e){return this.updateAsync(e)}async updateAsync(e){let n=e instanceof t.RichTextValue?e.getData().body:e,r=(0,i.getDT)();return await this._commandService.executeCommand(i.UpdateCommentCommand.id,{unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,payload:{commentId:this._thread.id,text:n,updated:!0,updateT:r}})}resolve(e){return this.resolveAsync(e)}resolveAsync(e){return this._commandService.executeCommand(i.ResolveCommentCommand.id,{unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,commentId:this._thread.id,resolved:e==null?!this._thread.resolved:e})}replyAsync(e){var n;let r=e.build();return this._commandService.executeCommand(i.AddCommentCommand.id,{unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,comment:{id:(0,t.generateRandomId)(),parentId:this._thread.id,threadId:this._thread.threadId,ref:((n=this._parent)==null?void 0:n.ref)||this._thread.ref,unitId:this._thread.unitId,subUnitId:this._thread.subUnitId,text:r.text,attachments:r.attachments,dT:r.dT||(0,i.getDT)(),personId:r.personId||this._userManagerService.getCurrentUser().userID}})}};_=m=p([f(2,(0,t.Inject)(t.Injector)),f(3,t.ICommandService),f(4,t.IUniverInstanceService),f(5,(0,t.Inject)(n.SheetsThreadCommentModel)),f(6,(0,t.Inject)(t.UserManagerService))],_);var v=class extends r.FRange{getComment(){let e=this._injector.get(n.SheetsThreadCommentModel),t=this._workbook.getUnitId(),r=this._worksheet.getSheetId(),i=e.getByLocation(t,r,this._range.startRow,this._range.startColumn);if(!i)return null;let a=e.getComment(t,r,i);return a?this._injector.createInstance(_,a):null}getComments(){let e=this._injector.get(n.SheetsThreadCommentModel),r=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),a=[];return t.Range.foreach(this._range,(t,n)=>{let o=e.getByLocation(r,i,t,n);if(o){let t=e.getComment(r,i,o);t&&a.push(this._injector.createInstance(_,t))}}),a}addComment(e){var n;let r=this._injector,a=(n=this.getComment())==null?void 0:n.getCommentData(),o=r.get(t.ICommandService),s=r.get(t.UserManagerService),c=this._workbook.getUnitId(),l=this._worksheet.getSheetId(),u=`${t.Tools.chatAtABC(this._range.startColumn)}${this._range.startRow+1}`,d=s.getCurrentUser(),f=e instanceof g?e.build():{text:e};return o.executeCommand(i.AddCommentCommand.id,{unitId:c,subUnitId:l,comment:{text:f.text,dT:f.dT||(0,i.getDT)(),attachments:[],id:f.id||(0,t.generateRandomId)(),ref:u,personId:f.personId||d.userID,parentId:a==null?void 0:a.id,unitId:c,subUnitId:l,threadId:(a==null?void 0:a.threadId)||(0,t.generateRandomId)()}})}clearComment(){var e;let n=this._injector,r=(e=this.getComment())==null?void 0:e.getCommentData(),a=n.get(t.ICommandService),o=this._workbook.getUnitId(),s=this._worksheet.getSheetId();return r?a.executeCommand(i.DeleteCommentTreeCommand.id,{unitId:o,subUnitId:s,threadId:r.threadId,commentId:r.id}):Promise.resolve(!0)}clearComments(){let e=this.getComments().map(e=>e.deleteAsync());return Promise.all(e).then(()=>!0)}addCommentAsync(e){return this.addComment(e)}clearCommentAsync(){return this.clearComment()}clearCommentsAsync(){return this.clearComments()}};r.FRange.extend(v);var y=class extends r.FWorkbook{_initialize(){Object.defineProperty(this,"_threadCommentModel",{get(){return this._injector.get(i.ThreadCommentModel)}})}getComments(){return this._threadCommentModel.getUnit(this._workbook.getUnitId()).map(e=>this._injector.createInstance(_,e.root))}clearComments(){let e=this.getComments().map(e=>e.deleteAsync());return Promise.all(e).then(()=>!0)}onThreadCommentChange(e){return(0,t.toDisposable)(this._threadCommentModel.commentUpdate$.pipe((0,o.filter)(e=>e.unitId===this._workbook.getUnitId())).subscribe(e))}onBeforeAddThreadComment(e){return(0,t.toDisposable)(this._commandService.beforeCommandExecuted((t,n)=>{let r=t.params;if(t.id===i.AddCommentCommand.id){if(r.unitId!==this._workbook.getUnitId())return;if(e(r,n)===!1)throw Error(`Command is stopped by the hook onBeforeAddThreadComment`)}}))}onBeforeUpdateThreadComment(e){return(0,t.toDisposable)(this._commandService.beforeCommandExecuted((t,n)=>{let r=t.params;if(t.id===i.UpdateCommentCommand.id){if(r.unitId!==this._workbook.getUnitId())return;if(e(r,n)===!1)throw Error(`Command is stopped by the hook onBeforeUpdateThreadComment`)}}))}onBeforeDeleteThreadComment(e){return(0,t.toDisposable)(this._commandService.beforeCommandExecuted((t,n)=>{let r=t.params;if(t.id===i.DeleteCommentCommand.id||t.id===i.DeleteCommentTreeCommand.id){if(r.unitId!==this._workbook.getUnitId())return;if(e(r,n)===!1)throw Error(`Command is stopped by the hook onBeforeDeleteThreadComment`)}}))}};r.FWorkbook.extend(y);var b=class extends r.FWorksheet{getComments(){return this._injector.get(n.SheetsThreadCommentModel).getSubUnitAll(this._workbook.getUnitId(),this._worksheet.getSheetId()).map(e=>this._injector.createInstance(_,e))}clearComments(){let e=this.getComments().map(e=>e.deleteAsync());return Promise.all(e).then(()=>!0)}onCommented(e){return this._injector.get(t.ICommandService).onCommandExecuted(t=>{if(t.id===i.AddCommentCommand.id){let n=t.params;e(n)}})}getCommentById(e){let t=this._injector.get(n.SheetsThreadCommentModel).getComment(this._workbook.getUnitId(),this._worksheet.getSheetId(),e);if(t)return this._injector.createInstance(_,t)}};r.FWorksheet.extend(b);var x=class extends s.FEventName{get CommentAdded(){return`CommentAdded`}get BeforeCommentAdd(){return`BeforeCommentAdd`}get CommentUpdated(){return`CommentUpdated`}get BeforeCommentUpdate(){return`BeforeCommentUpdate`}get CommentDeleted(){return`CommentDeleted`}get BeforeCommentDelete(){return`BeforeCommentDelete`}get CommentResolved(){return`CommentResolved`}get BeforeCommentResolve(){return`BeforeCommentResolve`}};s.FEventName.extend(x);var S=class extends s.FUniver{_getTargetSheet(e={}){var t;let n=e.unitId?this.getUniverSheet(e.unitId):(t=this.getActiveWorkbook)==null?void 0:t.call(this);if(!n)return null;let r=e.subUnitId?n.getSheetBySheetId(e.subUnitId):n.getActiveSheet();return r?{workbook:n,worksheet:r}:null}_initialize(e){let n=e.get(t.ICommandService);this.disposeWithMe(this.registerEventHandler(this.Event.CommentAdded,()=>n.onCommandExecuted(e=>{var t,n,r,a;if(e.id!==i.AddCommentCommand.id)return;let o=this._getTargetSheet(e.params);if(!o)return;let{workbook:s,worksheet:c}=o,{comment:l}=e.params,u=c.getCommentById(l.id);if(!u)return;let d={workbook:s,worksheet:c,row:(t=(n=u.getRange())==null?void 0:n.getRow())==null?0:t,col:(r=(a=u.getRange())==null?void 0:a.getColumn())==null?0:r,comment:u};this.fireEvent(this.Event.CommentAdded,d)}))),this.disposeWithMe(this.registerEventHandler(this.Event.CommentUpdated,()=>n.onCommandExecuted(e=>{var t,n,r,a;if(e.id!==i.UpdateCommentCommand.id)return;let o=this._getTargetSheet(e.params);if(!o)return;let{workbook:s,worksheet:c}=o,{payload:l}=e.params,u=c.getCommentById(l.commentId);if(!u)return;let d={workbook:s,worksheet:c,row:(t=(n=u.getRange())==null?void 0:n.getRow())==null?0:t,col:(r=(a=u.getRange())==null?void 0:a.getColumn())==null?0:r,comment:u};this.fireEvent(this.Event.CommentUpdated,d)}))),this.disposeWithMe(this.registerEventHandler(this.Event.CommentDeleted,()=>n.onCommandExecuted(e=>{if(e.id!==i.DeleteCommentCommand.id&&e.id!==i.DeleteCommentTreeCommand.id)return;let t=this._getTargetSheet(e.params);if(!t)return;let{workbook:n,worksheet:r}=t,{commentId:a}=e.params,o={workbook:n,worksheet:r,commentId:a};this.fireEvent(this.Event.CommentDeleted,o)}))),this.disposeWithMe(this.registerEventHandler(this.Event.CommentResolved,()=>n.onCommandExecuted(e=>{var t,n,r,a;if(e.id!==i.ResolveCommentCommand.id)return;let o=this._getTargetSheet(e.params);if(!o)return;let{workbook:s,worksheet:c}=o,{commentId:l,resolved:u}=e.params,d=c.getCommentById(l);if(!d)return;let f={workbook:s,worksheet:c,row:(t=(n=d.getRange())==null?void 0:n.getRow())==null?0:t,col:(r=(a=d.getRange())==null?void 0:a.getColumn())==null?0:r,comment:d,resolved:u};this.fireEvent(this.Event.CommentResolved,f)}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeCommentAdd,()=>n.beforeCommandExecuted(e=>{if(e.id!==i.AddCommentCommand.id)return;let n=this._getTargetSheet(e.params);if(!n)return;let{workbook:r,worksheet:o}=n,{comment:s}=e.params,{range:c}=(0,a.deserializeRangeWithSheet)(s.ref),l={workbook:r,worksheet:o,row:c.startRow,col:c.startColumn,comment:h.create(s)};if(this.fireEvent(this.Event.BeforeCommentAdd,l),l.cancel)throw new t.CanceledError}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeCommentUpdate,()=>n.beforeCommandExecuted(e=>{var n,r,a,o;if(e.id!==i.UpdateCommentCommand.id)return;let s=this._getTargetSheet(e.params);if(!s)return;let{workbook:c,worksheet:l}=s,{payload:u}=e.params,d=l.getCommentById(u.commentId);if(!d)return;let f={workbook:c,worksheet:l,row:(n=(r=d.getRange())==null?void 0:r.getRow())==null?0:n,col:(a=(o=d.getRange())==null?void 0:o.getColumn())==null?0:a,comment:d,newContent:t.RichTextValue.createByBody(u.text)};if(this.fireEvent(this.Event.BeforeCommentUpdate,f),f.cancel)throw new t.CanceledError}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeCommentDelete,()=>n.beforeCommandExecuted(e=>{var n,r,a,o;if(e.id!==i.DeleteCommentCommand.id&&e.id!==i.DeleteCommentTreeCommand.id)return;let s=this._getTargetSheet(e.params);if(!s)return;let{workbook:c,worksheet:l}=s,{commentId:u}=e.params,d=l.getCommentById(u);if(!d)return;let f={workbook:c,worksheet:l,row:(n=(r=d.getRange())==null?void 0:r.getRow())==null?0:n,col:(a=(o=d.getRange())==null?void 0:o.getColumn())==null?0:a,comment:d};if(this.fireEvent(this.Event.BeforeCommentDelete,f),f.cancel)throw new t.CanceledError}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeCommentResolve,()=>n.beforeCommandExecuted(e=>{var n,r;if(e.id!==i.ResolveCommentCommand.id)return;let a=this._getTargetSheet(e.params);if(!a)return;let{workbook:o,worksheet:s}=a,{commentId:c,resolved:l}=e.params,u=s.getCommentById(c);if(!u)return;let d={workbook:o,worksheet:s,row:(n=u.getRange().getRow())==null?0:n,col:(r=u.getRange().getColumn())==null?0:r,comment:u,resolved:l};if(this.fireEvent(this.Event.BeforeCommentResolve,d),d.cancel)throw new t.CanceledError})))}newTheadComment(e){return new g(e)}};s.FUniver.extend(S),Object.defineProperty(e,"FThreadComment",{enumerable:!0,get:function(){return _}})});
9
9
 
10
10
  // @univerjs/thread-comment-ui/index
11
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@univerjs/core`),require(`@univerjs/ui`),require(`rxjs`),require(`@univerjs/thread-comment`),require(`@univerjs/design`),require(`react`),require(`@univerjs/docs-ui`),require(`react/jsx-runtime`)):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/ui`,`rxjs`,`@univerjs/thread-comment`,`@univerjs/design`,`react`,`@univerjs/docs-ui`,`react/jsx-runtime`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverThreadCommentUi={},e.UniverCore,e.UniverUi,e.rxjs,e.UniverThreadComment,e.UniverDesign,e.React,e.UniverDocsUi,e.React))})(this,function(e,t,n,r,i,a,o,s,c){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function l(e){"@babel/helpers - typeof";return l=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},l(e)}function u(e,t){if(l(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(l(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function d(e){var t=u(e,`string`);return l(t)==`symbol`?t:t+``}function f(e,t,n){return(t=d(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e,t){return function(n,r){t(n,r,e)}}function m(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let h=class extends t.Disposable{constructor(e,t){super(),this._sidebarService=e,this._univerInstanceService=t,f(this,`_panelVisible`,!1),f(this,`_panelVisible$`,new r.BehaviorSubject(!1)),f(this,`_activeCommentId`,void 0),f(this,`_activeCommentId$`,new r.BehaviorSubject(void 0)),f(this,`panelVisible$`,this._panelVisible$.asObservable()),f(this,`activeCommentId$`,this._activeCommentId$.asObservable()),this._init(),this.disposeWithMe(()=>{this._activeCommentId$.complete(),this._panelVisible$.complete()})}_init(){this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(e=>{e.visible||this.setPanelVisible(!1)})),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(t.UniverInstanceType.UNIVER_SHEET).pipe((0,r.filter)(e=>!e)).subscribe(()=>{this._sidebarService.close()}))}get panelVisible(){return this._panelVisible}get activeCommentId(){return this._activeCommentId}setPanelVisible(e){this._panelVisible=e,this._panelVisible$.next(e)}setActiveComment(e){this._activeCommentId=e,this._activeCommentId$.next(e)}};h=m([p(0,(0,t.Inject)(n.ISidebarService)),p(1,t.IUniverInstanceService)],h);let g={id:`thread-comment-ui.operation.set-active-comment`,type:t.CommandType.OPERATION,handler(e,t){return e.get(h).setActiveComment(t),!0}};var _=`@univerjs/thread-comment-ui`,v=`0.23.0`;let y=`thread-comment-ui.config`;Symbol(y);let b={},x=class extends t.Plugin{constructor(e=b,n,r,i){super(),this._config=e,this._injector=n,this._commandService=r,this._configService=i;let{menu:a,...o}=(0,t.merge)({},b,this._config);a&&this._configService.setConfig(`menu`,a,{merge:!0}),this._configService.setConfig(y,o)}onStarting(){var e;(0,t.mergeOverrideWithDependencies)([[h]],(e=this._config)==null?void 0:e.overrides).forEach(e=>{this._injector.add(e)}),[g].forEach(e=>{this._commandService.registerCommand(e)})}};f(x,`pluginName`,`UNIVER_THREAD_COMMENT_UI_PLUGIN`),f(x,`packageName`,_),f(x,`version`,v),f(x,`type`,t.UniverInstanceType.UNIVER_UNKNOWN),x=m([(0,t.DependentOn)(i.UniverThreadCommentPlugin),p(1,(0,t.Inject)(t.Injector)),p(2,t.ICommandService),p(3,t.IConfigService)],x);function S({ref:e,...t}){let{icon:n,id:r,className:i,extend:a,...s}=t,c=`univerjs-icon univerjs-icon-${r} ${i||``}`.trim(),l=(0,o.useRef)(`_${E()}`);return C(n,`${r}`,{defIds:n.defIds,idSuffix:l.current},{ref:e,className:c,...s},a)}function C(e,t,n,r,i){return(0,o.createElement)(e.tag,{key:t,...w(e,n,i),...r},(T(e,n).children||[]).map((r,a)=>C(r,`${t}-${e.tag}-${a}`,n,void 0,i)))}function w(e,t,n){let r={...e.attrs};n!=null&&n.colorChannel1&&r.fill===`colorChannel1`&&(r.fill=n.colorChannel1),e.tag===`mask`&&r.id&&(r.id+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{e===`mask`&&typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))});let{defIds:i}=t;return!i||i.length===0?r:(e.tag===`use`&&r[`xlink:href`]&&(r[`xlink:href`]+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))}),r)}function T(e,t){var n;let{defIds:r}=t;return!r||r.length===0?e:e.tag===`defs`&&(n=e.children)!=null&&n.length?{...e,children:e.children.map(e=>typeof e.attrs.id==`string`&&r&&r.includes(e.attrs.id)?{...e,attrs:{...e.attrs,id:e.attrs.id+t.idSuffix}}:e)}:e}function E(){return Math.random().toString(36).substring(2,8)}S.displayName=`UniverIcon`;let D={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,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 0.866699 5.9313 0.866699H10.069C10.4004 0.866699 10.669 1.13533 10.669 1.4667C10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M1.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.64443C14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928L9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171C10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778L9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539C9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263L6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539C5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778L6.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`}}]},O=(0,o.forwardRef)(function(e,t){return(0,o.createElement)(S,Object.assign({},e,{id:`delete-icon`,ref:t,icon:D}))});O.displayName=`DeleteIcon`;let k={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,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`}}]},A=(0,o.forwardRef)(function(e,t){return(0,o.createElement)(S,Object.assign({},e,{id:`increase-icon`,ref:t,icon:k}))});A.displayName=`IncreaseIcon`;let j={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,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 8C4 7.44772 3.55228 7 3 7C2.44772 7 2 7.44772 2 8C2 8.55228 2.44772 9 3 9Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M13 9C13.5523 9 14 8.55228 14 8C14 7.44772 13.5523 7 13 7C12.4477 7 12 7.44772 12 8C12 8.55228 12.4477 9 13 9Z`}}]},M=(0,o.forwardRef)(function(e,t){return(0,o.createElement)(S,Object.assign({},e,{id:`more-horizontal-icon`,ref:t,icon:j}))});M.displayName=`MoreHorizontalIcon`;let N={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,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.76813`,strokeLinecap:`round`,strokeWidth:1.2}},{tag:`path`,attrs:{stroke:`currentColor`,d:`M8.91626 6.1311H9.27424`,strokeLinecap:`round`,strokeWidth:1.2}},{tag:`path`,attrs:{stroke:`currentColor`,d:`M3.90454 6.1311H4.26252`,strokeLinecap:`round`,strokeWidth:1.2}}]},P=(0,o.forwardRef)(function(e,t){return(0,o.createElement)(S,Object.assign({},e,{id:`reply-to-comment-icon`,ref:t,icon:N}))});P.displayName=`ReplyToCommentIcon`;let F={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,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`}}]},I=(0,o.forwardRef)(function(e,t){return(0,o.createElement)(S,Object.assign({},e,{id:`resolved-icon`,ref:t,icon:F}))});I.displayName=`ResolvedIcon`;let L={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,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}}]},R=(0,o.forwardRef)(function(e,t){return(0,o.createElement)(S,Object.assign({},e,{id:`solve-icon`,ref:t,icon:L}))});R.displayName=`SolveIcon`;function z(e){return{id:`d`,body:e,documentStyle:{}}}let B=(0,o.forwardRef)((e,r)=>{var i;let{comment:l,onSave:u,id:d,onCancel:f,autoFocus:p,unitId:m,type:h,editorId:_}=e,v=(0,n.useDependency)(t.ICommandService),y=(0,n.useDependency)(t.LocaleService),[b,x]=(0,o.useState)(!1),S=(0,n.useDependency)(s.IEditorService),C=(0,o.useRef)(null),w=h===t.UniverInstanceType.UNIVER_DOC?t.DOCS_NORMAL_EDITOR_UNIT_ID_KEY:m,[T,E]=(0,o.useState)(()=>{var e,n;return t.BuildTextUtils.transform.getPlainText((e=(n=C.current)==null||(n=n.getDocumentData().body)==null?void 0:n.dataStream)==null?``:e)});(0,o.useEffect)(()=>{var e,n,r;E(t.BuildTextUtils.transform.getPlainText((e=(n=C.current)==null||(n=n.getDocumentData().body)==null?void 0:n.dataStream)==null?``:e));let i=(r=C.current)==null?void 0:r.selectionChange$.subscribe(()=>{var e,n;E(t.BuildTextUtils.transform.getPlainText((e=(n=C.current)==null||(n=n.getDocumentData().body)==null?void 0:n.dataStream)==null?``:e))});return()=>i==null?void 0:i.unsubscribe()},[(i=C.current)==null?void 0:i.selectionChange$]);let D=(0,o.useMemo)(()=>({keyCodes:[{keyCode:n.KeyCode.ENTER}],handler:e=>{e===n.KeyCode.ENTER&&v.executeCommand(s.BreakLineCommand.id)}}),[v]);return(0,o.useImperativeHandle)(r,()=>({reply(e){var t,n;if(!C.current)return;S.focus((t=C.current.getEditorId())==null?``:t);let r=z(e);(n=C.current)==null||n.setDocumentData(r,[{startOffset:r.body.dataStream.length-2,endOffset:r.body.dataStream.length-2,collapsed:!0}])}})),(0,c.jsxs)(`div`,{onClick:e=>e.preventDefault(),children:[(0,c.jsx)(s.RichTextEditor,{className:`univer-w-full`,editorRef:C,editorId:_,autoFocus:p,keyboardEventConfig:D,placeholder:y.t(`threadCommentUI.editor.placeholder`),initialValue:(l==null?void 0:l.text)&&z(l.text),onFocusChange:e=>e&&x(e),isSingle:!1,maxHeight:64,onClickOutside:()=>{setTimeout(()=>{S.focus(w)},30)}}),b?(0,c.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-flex-row univer-justify-end univer-gap-2`,children:[(0,c.jsx)(a.Button,{onClick:()=>{var e;f==null||f(),x(!1),(e=C.current)==null||e.replaceText(``,!0),v.executeCommand(g.id)},children:y.t(`threadCommentUI.editor.cancel`)}),(0,c.jsx)(a.Button,{variant:`primary`,disabled:!T,onClick:()=>{if(C.current){let e=t.Tools.deepClone(C.current.getDocumentData().body);x(!1),u==null||u({...l,text:e}),C.current.replaceText(``),setTimeout(()=>{var e,t;(e=C.current)==null||e.setSelectionRanges([]),(t=C.current)==null||t.blur()},10)}},children:y.t(d?`threadCommentUI.editor.save`:`threadCommentUI.editor.reply`)})]}):null]})}),V=e=>{let{dataStream:t,customRanges:n}=e,r=t.endsWith(`\r
12
- `)?t.length-2:t.length,i=[],a=0;return n==null||n.forEach(e=>{a<e.startIndex&&i.push({type:`text`,content:t.slice(a,e.startIndex)}),i.push({type:`mention`,content:{label:t.slice(e.startIndex,e.endIndex+1),id:e.rangeId}}),a=e.endIndex+1}),i.push({type:`text`,content:t.slice(a,r)}),i},H=e=>{if(!e)return[];let{paragraphs:n=[]}=e;return n.map((r,i)=>V((0,t.getBodySlice)(e,i===0?0:n[i-1].startIndex+1,r.startIndex)))},U=e=>{let n=``,r=[];return e.forEach(e=>{switch(e.type){case`text`:n+=e.content;break;case`mention`:{let i=n.length;n+=e.content.label;let a=n.length-1;r.push({rangeId:e.content.id,rangeType:t.CustomRangeType.MENTION,startIndex:i,endIndex:a,properties:{},wholeEntity:!0});break}default:break}}),n+=`\r
13
- `,{textRuns:[],paragraphs:[{startIndex:n.length-2,paragraphStyle:{}}],sectionBreaks:[{startIndex:n.length-1}],dataStream:n,customRanges:r}},W=function(e){return e.CELL=`CELL`,e.PANEL=`PANEL`,e}({}),G=`__mock__`,K=e=>{let{item:r,unitId:s,subUnitId:l,editing:u,onEditingChange:d,onReply:f,resolved:p,isRoot:m,onClose:h,onDeleteComment:g,type:_,threadCommentEditorId:v}=e,y=(0,n.useDependency)(t.ICommandService),b=(0,n.useDependency)(t.LocaleService),x=(0,n.useDependency)(t.UserManagerService),S=x.getUser(r.personId),C=(0,n.useObservable)(x.currentUser$),w=(C==null?void 0:C.userID)===r.personId,T=r.id===G,[E,D]=(0,o.useState)(!1),O=(0,n.useConfigValue)(n.UI_PLUGIN_CONFIG_KEY),k=O==null?void 0:O.avatarFallback;return(0,c.jsxs)(`div`,{className:`univer-relative univer-mb-3 univer-pl-[30px]`,onMouseLeave:()=>D(!1),onMouseEnter:()=>D(!0),children:[(0,c.jsx)(`div`,{className:`univer-absolute univer-left-0 univer-top-0 univer-size-6 univer-rounded-full univer-bg-cover univer-bg-center univer-bg-no-repeat`,style:{backgroundImage:`url(${(S==null?void 0:S.avatar)||k})`}}),S?(0,c.jsxs)(`div`,{className:`univer-mb-1 univer-flex univer-h-6 univer-items-center univer-justify-between`,children:[(0,c.jsx)(`div`,{className:`univer-text-sm univer-font-medium univer-leading-5`,children:(S==null?void 0:S.name)||` `}),(0,c.jsxs)(`div`,{children:[T||p?null:E&&S?(0,c.jsx)(`div`,{className:`univer-ml-1 univer-inline-flex univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-sm univer-text-base hover:univer-bg-gray-50 dark:hover:!univer-bg-gray-800`,onClick:()=>f(S),children:(0,c.jsx)(P,{})}):null,w&&!T&&!p?(0,c.jsx)(a.Dropdown,{overlay:(0,c.jsx)(`div`,{className:`univer-rounded-lg`,children:(0,c.jsxs)(`ul`,{className:`univer-m-0 univer-box-border univer-grid univer-list-none univer-p-1.5 univer-text-sm [&_a]:univer-block [&_a]:univer-cursor-pointer [&_a]:univer-rounded [&_a]:univer-px-2 [&_a]:univer-py-1.5 [&_a]:univer-transition-colors`,children:[(0,c.jsx)(`li`,{children:(0,c.jsx)(`a`,{className:`hover:univer-bg-gray-200`,onClick:()=>d==null?void 0:d(!0),children:b.t(`threadCommentUI.item.edit`)})}),(0,c.jsx)(`li`,{children:(0,c.jsx)(`a`,{className:`hover:univer-bg-gray-200`,onClick:()=>{(g==null?void 0:g(r))!==!1&&(y.executeCommand(m?i.DeleteCommentTreeCommand.id:i.DeleteCommentCommand.id,{unitId:s,subUnitId:l,commentId:r.id}),m&&(h==null||h()))},children:b.t(`threadCommentUI.item.delete`)})})]})}),children:(0,c.jsx)(`div`,{className:`univer-ml-1 univer-inline-flex univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-sm univer-text-base hover:univer-bg-gray-50 dark:hover:!univer-bg-gray-800`,children:(0,c.jsx)(M,{})})}):null]})]}):null,(0,c.jsx)(`time`,{className:`univer-mb-1 univer-text-xs/normal univer-text-gray-600 dark:!univer-text-gray-200`,children:r.dT}),u?(0,c.jsx)(B,{type:_,id:r.id,comment:r,onCancel:()=>d==null?void 0:d(!1),autoFocus:!0,unitId:s,subUnitId:l,editorId:v,onSave:({text:e,attachments:t})=>{d==null||d(!1),y.executeCommand(i.UpdateCommentCommand.id,{unitId:s,subUnitId:l,payload:{commentId:r.id,text:e,attachments:t}})}}):(0,c.jsx)(`div`,{className:`univer-text-sm univer-text-gray-900 dark:!univer-text-white`,children:H(r.text).map((e,t)=>(0,c.jsx)(`div`,{className:`univer-break-words`,children:e.map((e,t)=>{switch(e.type){case`mention`:return(0,c.jsxs)(`a`,{className:`univer-text-primary-600`,children:[e.content.label,` `]},t);default:return e.content}})},t))})]})},q=e=>{var s,l,u;let{id:d,unitId:f,subUnitId:p,refStr:m,showEdit:h=!0,onClick:_,showHighlight:v,onClose:y,getSubUnitName:b,location:x,autoFocus:S,onMouseEnter:C,onMouseLeave:w,onAddComment:T,onDeleteComment:E,onResolve:D,type:k,style:A,full:j}=e,M=(0,n.useDependency)(i.ThreadCommentModel),[N,P]=(0,o.useState)(!1),[F,L]=(0,o.useState)(``);(0,n.useObservable)((0,o.useMemo)(()=>M.commentUpdate$.pipe((0,r.debounceTime)(16)),[M]));let z=d?M.getCommentWithChildren(f,p,d):null,V=(0,n.useDependency)(t.ICommandService),H=(0,n.useDependency)(t.UserManagerService),W=z==null?void 0:z.root.resolved,q=(0,n.useObservable)(H.currentUser$),J=(0,o.useRef)(null),Y=[...z?[z.root]:[{id:G,text:{dataStream:`
14
- \r`},personId:(s=q==null?void 0:q.userID)==null?``:s,ref:m==null?``:m,dT:``,unitId:f,subUnitId:p,threadId:``}],...(l=z==null?void 0:z.children)==null?[]:l],X=(0,o.useRef)(null),ee=e=>{e.stopPropagation(),W?V.executeCommand(g.id,{unitId:f,subUnitId:p,commentId:d}):V.executeCommand(g.id),V.executeCommand(i.ResolveCommentCommand.id,{unitId:f,subUnitId:p,commentId:d,resolved:!W}),D==null||D(!W)},te=e=>{e.stopPropagation(),V.executeCommand(g.id),!(z!=null&&z.root&&(E==null?void 0:E(z.root))===!1)&&(V.executeCommand(i.DeleteCommentTreeCommand.id,{unitId:f,subUnitId:p,commentId:d}),y==null||y())};(0,o.useEffect)(()=>w==null?void 0:w(),[]);let Z=b((u=z==null?void 0:z.root.subUnitId)==null?p:u),ne=h&&!F&&!W,Q=`${m||(z==null?void 0:z.root.ref)||``}${Z?` · `:``}${Z}`,$=`${t.DOCS_COMMENT_EDITOR_UNIT_ID_KEY}_${x}`;return(0,c.jsxs)(`div`,{id:`${x}-${f}-${p}-${d}`,className:(0,a.clsx)(`univer-relative univer-box-border univer-rounded-md univer-bg-white univer-p-4 dark:!univer-bg-gray-900 dark:!univer-text-white`,a.borderClassName,{"univer-w-[278px]":!j,"univer-w-full":j,"univer-shadow":!W&&(v||N||x===`CELL`)}),style:A,onClick:_,onMouseEnter:()=>{C==null||C(),P(!0)},onMouseLeave:()=>{w==null||w(),P(!1)},children:[!W&&v&&(0,c.jsx)(`div`,{className:`univer-absolute univer-left-0 univer-right-0 univer-top-0 univer-h-1.5 univer-rounded-t-md univer-bg-yellow-400`}),(0,c.jsxs)(`div`,{className:`univer-mb-4 univer-flex univer-flex-row univer-items-center univer-justify-between univer-text-sm univer-leading-5`,children:[(0,c.jsxs)(`div`,{className:`univer-flex univer-flex-1 univer-flex-row univer-items-center univer-overflow-hidden`,children:[(0,c.jsx)(`div`,{className:`univer-mr-2 univer-h-3.5 univer-w-[3px] univer-flex-shrink-0 univer-flex-grow-0 univer-rounded-sm univer-bg-yellow-500`}),(0,c.jsx)(a.Tooltip,{showIfEllipsis:!0,title:Q,children:(0,c.jsx)(`span`,{className:`univer-flex-1 univer-truncate`,children:Q})})]}),!!z&&(0,c.jsxs)(`div`,{className:`univer-flex univer-flex-shrink-0 univer-flex-grow-0 univer-flex-row`,children:[(0,c.jsx)(`div`,{className:(0,a.clsx)(`univer-ml-1 univer-inline-flex univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-[3px] univer-text-base hover:univer-bg-gray-50 dark:hover:!univer-bg-gray-800`,{"univer-text-green-500":W}),onClick:ee,children:W?(0,c.jsx)(I,{}):(0,c.jsx)(R,{})}),(q==null?void 0:q.userID)===z.root.personId?(0,c.jsx)(`div`,{className:`univer-ml-1 univer-inline-flex univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-[3px] univer-text-base hover:univer-bg-gray-50 dark:hover:!univer-bg-gray-800`,onClick:te,children:(0,c.jsx)(O,{})}):null]})]}),(0,c.jsx)(`div`,{ref:X,className:(0,a.clsx)(`univer-max-h-80 univer-overflow-y-auto univer-overflow-x-hidden`,a.scrollbarClassName),children:Y.map(e=>(0,c.jsx)(K,{unitId:f,subUnitId:p,item:e,isRoot:e.id===(z==null?void 0:z.root.id),editing:F===e.id,resolved:z==null?void 0:z.root.resolved,type:k,threadCommentEditorId:$,onClose:y,onEditingChange:t=>{L(t?e.id:``)},onReply:e=>{e&&requestAnimationFrame(()=>{var t;(t=J.current)==null||t.reply(U([{type:`mention`,content:{id:e.userID,label:`@${e.name}`}},{type:`text`,content:` `}]))})},onAddComment:T,onDeleteComment:E},e.id))}),ne&&(0,c.jsx)(`div`,{children:(0,c.jsx)(B,{ref:J,type:k,unitId:f,subUnitId:p,editorId:$,onSave:async({text:e,attachments:n})=>{var r,a;let o={text:e,attachments:n,dT:(0,i.getDT)(),id:(0,t.generateRandomId)(),ref:m,personId:(r=q==null?void 0:q.userID)==null?``:r,parentId:z==null?void 0:z.root.id,unitId:f,subUnitId:p,threadId:(a=z==null?void 0:z.root.threadId)==null?``:a};(T==null?void 0:T(o))!==!1&&(await V.executeCommand(i.AddCommentCommand.id,{unitId:f,subUnitId:p,comment:o}),X.current&&(X.current.scrollTop=X.current.scrollHeight))},autoFocus:S||!z,onCancel:()=>{z||y==null||y()}},`${S}`)})]})};e.SetActiveCommentOperation=g,e.ThreadCommentPanel=e=>{let{unitId:r,subUnitId$:s,type:l,onAdd:u,getSubUnitName:d,onResolve:f,sortComments:p,onItemLeave:m,onItemEnter:_,disableAdd:v,tempComment:y,onAddComment:b,onDeleteComment:x,showComments:S}=e,[C,w]=(0,o.useState)(`all`),[T,E]=(0,o.useState)(`all`),D=(0,n.useDependency)(t.LocaleService),O=(0,n.useDependency)(t.UserManagerService),k=(0,n.useDependency)(i.ThreadCommentModel),[j,M]=(0,o.useState)(()=>k.getUnit(r)),N=(0,n.useObservable)((0,n.useDependency)(h).activeCommentId$),P=(0,n.useObservable)(k.commentUpdate$),F=(0,n.useDependency)(t.ICommandService),I=(0,n.useObservable)(s),L=(0,o.useRef)(!0),R=`PANEL`,z=(0,n.useObservable)(O.currentUser$),B=(0,o.useMemo)(()=>{var e;let t=C===`all`?j:(e=j.filter(e=>e.subUnitId===I))==null?[]:e,n=p==null?(e=>e):p,r=t.map(e=>{var t;return{...e.root,children:(t=e.children)==null?[]:t,users:e.relativeUsers}});if(S){let e=new Map;return r.forEach(t=>{e.set(t.id,t)}),[...S,``].map(t=>e.get(t)).filter(Boolean)}else return n(r)},[S,C,j,p,I]),V=(0,o.useMemo)(()=>[...B.filter(e=>!e.resolved),...B.filter(e=>e.resolved)],[B]),H=(0,o.useMemo)(()=>T===`resolved`?V.filter(e=>e.resolved):T===`unsolved`?V.filter(e=>!e.resolved):T===`concern_me`&&z!=null&&z.userID?V.filter(e=>e==null?void 0:e.users.has(z.userID)):V,[V,z==null?void 0:z.userID,T]),U=y?[y,...H]:H,W=U.filter(e=>!e.resolved),G=U.filter(e=>e.resolved),K=T!==`all`||C!==`all`,J=()=>{E(`all`),w(`all`)};(0,o.useEffect)(()=>{r&&M(k.getUnit(r))},[r,k,P]),(0,o.useEffect)(()=>{var e;if(!N)return;if(!L.current){L.current=!0;return}let{unitId:t,subUnitId:n,commentId:r}=N,i=`${R}-${t}-${n}-${r}`;(e=document.getElementById(i))==null||e.scrollIntoView({block:`center`})},[N]);let Y=e=>(0,c.jsx)(q,{location:R,getSubUnitName:d,id:e.id,unitId:e.unitId,subUnitId:e.subUnitId,refStr:e.ref,type:l,showEdit:(N==null?void 0:N.commentId)===e.id,showHighlight:(N==null?void 0:N.commentId)===e.id,onClick:()=>{L.current=!1,e.resolved?F.executeCommand(g.id):F.executeCommand(g.id,{unitId:e.unitId,subUnitId:e.subUnitId,commentId:e.id,temp:!1})},onMouseEnter:()=>_==null?void 0:_(e),onMouseLeave:()=>m==null?void 0:m(e),onAddComment:b,onDeleteComment:x,onResolve:t=>f==null?void 0:f(e.id,t)},e.id);return(0,c.jsxs)(`div`,{className:`univer-flex univer-min-h-full univer-flex-col univer-pb-3`,children:[(0,c.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-flex-row univer-justify-between`,children:[l===t.UniverInstanceType.UNIVER_SHEET?(0,c.jsx)(a.Select,{borderless:!0,value:C,options:[{value:`current`,label:D.t(`threadCommentUI.filter.sheet.current`)},{value:`all`,label:D.t(`threadCommentUI.filter.sheet.all`)}],onChange:w}):null,(0,c.jsx)(a.Select,{borderless:!0,value:T,options:[{value:`all`,label:D.t(`threadCommentUI.filter.status.all`)},{value:`resolved`,label:D.t(`threadCommentUI.filter.status.resolved`)},{value:`unsolved`,label:D.t(`threadCommentUI.filter.status.unsolved`)},{value:`concern_me`,label:D.t(`threadCommentUI.filter.status.concernMe`)}],onChange:E})]}),U.length===0?(0,c.jsxs)(`div`,{className:`univer-flex univer-flex-1 univer-flex-col univer-items-center univer-justify-center univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200`,children:[D.t(`threadCommentUI.panel.empty`),K?(0,c.jsx)(`div`,{className:`univer-mt-2 univer-flex univer-flex-row`,children:(0,c.jsx)(a.Button,{onClick:J,children:D.t(`threadCommentUI.panel.reset`)})}):v?null:(0,c.jsx)(`div`,{className:`univer-mt-2 univer-flex univer-flex-row`,children:(0,c.jsxs)(a.Button,{onClick:u,children:[(0,c.jsx)(A,{className:`univer-mr-1.5`}),D.t(`threadCommentUI.panel.addComment`)]})})]}):(0,c.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-flex-col univer-gap-3`,children:[W.map(Y),G.length>0&&(0,c.jsx)(`div`,{className:`univer-text-xs`,children:D.t(`threadCommentUI.panel.solved`)}),G.map(Y)]})]})},Object.defineProperty(e,`ThreadCommentPanelService`,{enumerable:!0,get:function(){return h}}),e.ThreadCommentTree=q,e.ThreadCommentTreeLocation=W,Object.defineProperty(e,`UniverThreadCommentUIPlugin`,{enumerable:!0,get:function(){return x}})});
11
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@univerjs/core"),require("@univerjs/ui"),require("rxjs"),require("@univerjs/thread-comment"),require("@univerjs/design"),require("react"),require("@univerjs/docs-ui"),require("react/jsx-runtime")):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/ui`,`rxjs`,`@univerjs/thread-comment`,`@univerjs/design`,`react`,`@univerjs/docs-ui`,`react/jsx-runtime`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverThreadCommentUi={},e.UniverCore,e.UniverUi,e.rxjs,e.UniverThreadComment,e.UniverDesign,e.React,e.UniverDocsUi,e.React))})(this,function(e,t,n,r,i,a,o,s,c){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function l(e){"@babel/helpers - typeof";return l=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},l(e)}function u(e,t){if(l(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(l(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function d(e){var t=u(e,`string`);return l(t)==`symbol`?t:t+``}function f(e,t,n){return(t=d(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e,t){return function(n,r){t(n,r,e)}}function m(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let h=class extends t.Disposable{constructor(e,t){super(),this._sidebarService=e,this._univerInstanceService=t,f(this,`_panelVisible`,!1),f(this,`_panelVisible$`,new r.BehaviorSubject(!1)),f(this,`_activeCommentId`,void 0),f(this,`_activeCommentId$`,new r.BehaviorSubject(void 0)),f(this,`panelVisible$`,this._panelVisible$.asObservable()),f(this,`activeCommentId$`,this._activeCommentId$.asObservable()),this._init(),this.disposeWithMe(()=>{this._activeCommentId$.complete(),this._panelVisible$.complete()})}_init(){this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(e=>{e.visible||this.setPanelVisible(!1)})),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(t.UniverInstanceType.UNIVER_SHEET).pipe((0,r.filter)(e=>!e)).subscribe(()=>{this._sidebarService.close()}))}get panelVisible(){return this._panelVisible}get activeCommentId(){return this._activeCommentId}setPanelVisible(e){this._panelVisible=e,this._panelVisible$.next(e)}setActiveComment(e){this._activeCommentId=e,this._activeCommentId$.next(e)}};h=m([p(0,(0,t.Inject)(n.ISidebarService)),p(1,t.IUniverInstanceService)],h);let g={id:`thread-comment-ui.operation.set-active-comment`,type:t.CommandType.OPERATION,handler(e,t){return e.get(h).setActiveComment(t),!0}};var _=`@univerjs/thread-comment-ui`,v=`0.25.0`;let y={},b=class extends t.Plugin{constructor(e=y,n,r,i){super(),this._config=e,this._injector=n,this._commandService=r,this._configService=i;let{menu:a,...o}=(0,t.merge)({},y,this._config);a&&this._configService.setConfig(`menu`,a,{merge:!0}),this._configService.setConfig(`thread-comment-ui.config`,o)}onStarting(){var e;(0,t.mergeOverrideWithDependencies)([[h]],(e=this._config)==null?void 0:e.overrides).forEach(e=>{this._injector.add(e)}),[g].forEach(e=>{this._commandService.registerCommand(e)})}};f(b,`pluginName`,`UNIVER_THREAD_COMMENT_UI_PLUGIN`),f(b,`packageName`,_),f(b,`version`,v),f(b,`type`,t.UniverInstanceType.UNIVER_UNKNOWN),b=m([(0,t.DependentOn)(i.UniverThreadCommentPlugin),p(1,(0,t.Inject)(t.Injector)),p(2,t.ICommandService),p(3,t.IConfigService)],b);function x({ref:e,...t}){let{icon:n,id:r,className:i,extend:a,...s}=t,c=`univerjs-icon univerjs-icon-${r} ${i||``}`.trim(),l=(0,o.useRef)(`_${T()}`);return S(n,`${r}`,{defIds:n.defIds,idSuffix:l.current},{ref:e,className:c,...s},a)}function S(e,t,n,r,i){return(0,o.createElement)(e.tag,{key:t,...C(e,n,i),...r},(w(e,n).children||[]).map((r,a)=>S(r,`${t}-${e.tag}-${a}`,n,void 0,i)))}function C(e,t,n){let r={...e.attrs};n!=null&&n.colorChannel1&&r.fill===`colorChannel1`&&(r.fill=n.colorChannel1),e.tag===`mask`&&r.id&&(r.id+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{e===`mask`&&typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))});let{defIds:i}=t;return!i||i.length===0?r:(e.tag===`use`&&r[`xlink:href`]&&(r[`xlink:href`]+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))}),r)}function w(e,t){var n;let{defIds:r}=t;return!r||r.length===0?e:e.tag===`defs`&&(n=e.children)!=null&&n.length?{...e,children:e.children.map(e=>typeof e.attrs.id==`string`&&r&&r.includes(e.attrs.id)?{...e,attrs:{...e.attrs,id:e.attrs.id+t.idSuffix}}:e)}:e}function T(){return Math.random().toString(36).substring(2,8)}x.displayName=`UniverIcon`;let E={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,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 0.866699 5.9313 0.866699H10.069C10.4004 0.866699 10.669 1.13533 10.669 1.4667C10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M1.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.64443C14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928L9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171C10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778L9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539C9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263L6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539C5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778L6.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`}}]},D=(0,o.forwardRef)(function(e,t){return(0,o.createElement)(x,Object.assign({},e,{id:`delete-icon`,ref:t,icon:E}))});D.displayName=`DeleteIcon`;let O={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,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`}}]},k=(0,o.forwardRef)(function(e,t){return(0,o.createElement)(x,Object.assign({},e,{id:`increase-icon`,ref:t,icon:O}))});k.displayName=`IncreaseIcon`;let A={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,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 8C4 7.44772 3.55228 7 3 7C2.44772 7 2 7.44772 2 8C2 8.55228 2.44772 9 3 9Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M13 9C13.5523 9 14 8.55228 14 8C14 7.44772 13.5523 7 13 7C12.4477 7 12 7.44772 12 8C12 8.55228 12.4477 9 13 9Z`}}]},j=(0,o.forwardRef)(function(e,t){return(0,o.createElement)(x,Object.assign({},e,{id:`more-horizontal-icon`,ref:t,icon:A}))});j.displayName=`MoreHorizontalIcon`;let M={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,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.76813`,strokeLinecap:`round`,strokeWidth:1.2}},{tag:`path`,attrs:{stroke:`currentColor`,d:`M8.91626 6.1311H9.27424`,strokeLinecap:`round`,strokeWidth:1.2}},{tag:`path`,attrs:{stroke:`currentColor`,d:`M3.90454 6.1311H4.26252`,strokeLinecap:`round`,strokeWidth:1.2}}]},N=(0,o.forwardRef)(function(e,t){return(0,o.createElement)(x,Object.assign({},e,{id:`reply-to-comment-icon`,ref:t,icon:M}))});N.displayName=`ReplyToCommentIcon`;let P={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,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`}}]},F=(0,o.forwardRef)(function(e,t){return(0,o.createElement)(x,Object.assign({},e,{id:`resolved-icon`,ref:t,icon:P}))});F.displayName=`ResolvedIcon`;let I={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,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}}]},L=(0,o.forwardRef)(function(e,t){return(0,o.createElement)(x,Object.assign({},e,{id:`solve-icon`,ref:t,icon:I}))});L.displayName=`SolveIcon`;let R=e=>{let{dataStream:t,customRanges:n}=e,r=t.endsWith(`\r
12
+ `)?t.length-2:t.length,i=[],a=0;return n==null||n.forEach(e=>{a<e.startIndex&&i.push({type:`text`,content:t.slice(a,e.startIndex)}),i.push({type:`mention`,content:{label:t.slice(e.startIndex,e.endIndex+1),id:e.rangeId}}),a=e.endIndex+1}),i.push({type:`text`,content:t.slice(a,r)}),i},z=e=>{if(!e)return[];let{paragraphs:n=[]}=e;return n.map((r,i)=>R((0,t.getBodySlice)(e,i===0?0:n[i-1].startIndex+1,r.startIndex)))},B=e=>{let n=``,r=[];return e.forEach(e=>{switch(e.type){case`text`:n+=e.content;break;case`mention`:{let i=n.length;n+=e.content.label;let a=n.length-1;r.push({rangeId:e.content.id,rangeType:t.CustomRangeType.MENTION,startIndex:i,endIndex:a,properties:{},wholeEntity:!0});break}default:break}}),n+=`\r
13
+ `,{textRuns:[],paragraphs:[{startIndex:n.length-2,paragraphStyle:{}}],sectionBreaks:[{startIndex:n.length-1}],dataStream:n,customRanges:r}};function V(e,t,n){e.focus(t),n==null||n.focus()}function H(e){return{id:`d`,body:e,documentStyle:{}}}let U=(0,o.forwardRef)((e,r)=>{var i;let{comment:l,onSave:u,id:d,onCancel:f,autoFocus:p,unitId:m,type:h,editorId:_}=e,v=(0,n.useDependency)(t.ICommandService),y=(0,n.useDependency)(t.LocaleService),[b,x]=(0,o.useState)(!1),S=(0,n.useDependency)(s.IEditorService),C=(0,o.useRef)(null),w=h===t.UniverInstanceType.UNIVER_DOC?t.DOCS_NORMAL_EDITOR_UNIT_ID_KEY:m,[T,E]=(0,o.useState)(()=>{var e,n;return t.BuildTextUtils.transform.getPlainText((e=(n=C.current)==null||(n=n.getDocumentData().body)==null?void 0:n.dataStream)==null?``:e)});(0,o.useEffect)(()=>{var e,n,r;E(t.BuildTextUtils.transform.getPlainText((e=(n=C.current)==null||(n=n.getDocumentData().body)==null?void 0:n.dataStream)==null?``:e));let i=(r=C.current)==null?void 0:r.selectionChange$.subscribe(()=>{var e,n;E(t.BuildTextUtils.transform.getPlainText((e=(n=C.current)==null||(n=n.getDocumentData().body)==null?void 0:n.dataStream)==null?``:e))});return()=>i==null?void 0:i.unsubscribe()},[(i=C.current)==null?void 0:i.selectionChange$]);let D=(0,o.useMemo)(()=>({keyCodes:[{keyCode:n.KeyCode.ENTER}],handler:e=>{e===n.KeyCode.ENTER&&v.executeCommand(s.BreakLineCommand.id)}}),[v]);return(0,o.useImperativeHandle)(r,()=>({reply(e){var n;if(!C.current)return;V(S,_,C.current);let r=H(e);(n=C.current)==null||n.setDocumentData(r,[{startOffset:r.body.dataStream.length-2,endOffset:r.body.dataStream.length-2,collapsed:!0}]),E(t.BuildTextUtils.transform.getPlainText(r.body.dataStream)),x(!0)}})),(0,o.useEffect)(()=>{if(!p)return;let e=setTimeout(()=>{V(S,_,C.current)});return()=>clearTimeout(e)},[p,_,S]),(0,c.jsxs)(`div`,{onClick:e=>e.preventDefault(),children:[(0,c.jsx)(`div`,{onMouseDown:()=>{V(S,_,C.current),x(!0)},children:(0,c.jsx)(s.RichTextEditor,{className:`univer-w-full`,editorRef:C,editorId:_,autoFocus:p,keyboardEventConfig:D,placeholder:y.t(`thread-comment-ui.editor.placeholder`),initialValue:(l==null?void 0:l.text)&&H(l.text),onFocusChange:e=>e&&x(e),isSingle:!1,maxHeight:64,onClickOutside:()=>{setTimeout(()=>{S.focus(w)},30)}})}),b?(0,c.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-flex-row univer-justify-end univer-gap-2`,children:[(0,c.jsx)(a.Button,{type:`button`,onClick:()=>{let e=C.current;e==null||e.blur(),e==null||e.replaceText(``,!1),e==null||e.setSelectionRanges([],!1),E(``),f==null||f(),x(!1),v.executeCommand(g.id)},children:y.t(`thread-comment-ui.editor.cancel`)}),(0,c.jsx)(a.Button,{type:`button`,variant:`primary`,disabled:!T,onClick:()=>{let e=C.current;if(e){let n=t.Tools.deepClone(e.getDocumentData().body);e.blur(),e.replaceText(``,!1),e.setSelectionRanges([],!1),E(``),x(!1),u==null||u({...l,text:n})}},children:y.t(d?`thread-comment-ui.editor.save`:`thread-comment-ui.editor.reply`)})]}):null]})});function W(e){let{location:n,unitId:r,subUnitId:i,commentId:a,fallbackId:o}=e;return`${t.DOCS_COMMENT_EDITOR_UNIT_ID_KEY}_${n}_${r}_${i}_${a||o}`}let G=function(e){return e.CELL=`CELL`,e.PANEL=`PANEL`,e}({}),K=`__mock__`,q=e=>{let{item:r,unitId:s,subUnitId:l,editing:u,onEditingChange:d,onReply:f,resolved:p,isRoot:m,onClose:h,onDeleteComment:g,type:_,threadCommentEditorId:v}=e,y=(0,n.useDependency)(t.ICommandService),b=(0,n.useDependency)(t.LocaleService),x=(0,n.useDependency)(t.UserManagerService),S=x.getUser(r.personId),C=(0,n.useObservable)(x.currentUser$),w=(C==null?void 0:C.userID)===r.personId,T=r.id===K,[E,D]=(0,o.useState)(!1),O=(0,n.useConfigValue)(n.UI_PLUGIN_CONFIG_KEY),k=O==null?void 0:O.avatarFallback;return(0,c.jsxs)(`div`,{className:`univer-relative univer-mb-3 univer-pl-[30px]`,onMouseLeave:()=>D(!1),onMouseEnter:()=>D(!0),children:[(0,c.jsx)(`div`,{className:`univer-absolute univer-left-0 univer-top-0 univer-size-6 univer-rounded-full univer-bg-cover univer-bg-center univer-bg-no-repeat`,style:{backgroundImage:`url(${(S==null?void 0:S.avatar)||k})`}}),S?(0,c.jsxs)(`div`,{className:`univer-mb-1 univer-flex univer-h-6 univer-items-center univer-justify-between`,children:[(0,c.jsx)(`div`,{className:`univer-text-sm univer-font-medium univer-leading-5`,children:(S==null?void 0:S.name)||` `}),(0,c.jsxs)(`div`,{children:[T||p?null:E&&S?(0,c.jsx)(`div`,{className:`univer-ml-1 univer-inline-flex univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-sm univer-text-base hover:univer-bg-gray-50 dark:hover:!univer-bg-gray-800`,onClick:()=>f(S),children:(0,c.jsx)(N,{})}):null,w&&!T&&!p?(0,c.jsx)(a.Dropdown,{overlay:(0,c.jsx)(`div`,{className:`univer-rounded-lg`,children:(0,c.jsxs)(`ul`,{className:`univer-m-0 univer-box-border univer-grid univer-list-none univer-p-1.5 univer-text-sm [&_a]:univer-block [&_a]:univer-cursor-pointer [&_a]:univer-rounded [&_a]:univer-px-2 [&_a]:univer-py-1.5 [&_a]:univer-transition-colors`,children:[(0,c.jsx)(`li`,{children:(0,c.jsx)(`a`,{className:`hover:univer-bg-gray-200`,onClick:()=>d==null?void 0:d(!0),children:b.t(`thread-comment-ui.item.edit`)})}),(0,c.jsx)(`li`,{children:(0,c.jsx)(`a`,{className:`hover:univer-bg-gray-200`,onClick:()=>{(g==null?void 0:g(r))!==!1&&(y.executeCommand(m?i.DeleteCommentTreeCommand.id:i.DeleteCommentCommand.id,{unitId:s,subUnitId:l,commentId:r.id}),m&&(h==null||h()))},children:b.t(`thread-comment-ui.item.delete`)})})]})}),children:(0,c.jsx)(`div`,{className:`univer-ml-1 univer-inline-flex univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-sm univer-text-base hover:univer-bg-gray-50 dark:hover:!univer-bg-gray-800`,children:(0,c.jsx)(j,{})})}):null]})]}):null,(0,c.jsx)(`time`,{className:`univer-mb-1 univer-text-xs/normal univer-text-gray-600 dark:!univer-text-gray-200`,children:r.dT}),u?(0,c.jsx)(U,{type:_,id:r.id,comment:r,onCancel:()=>d==null?void 0:d(!1),autoFocus:!0,unitId:s,subUnitId:l,editorId:v,onSave:({text:e,attachments:t})=>{d==null||d(!1),y.executeCommand(i.UpdateCommentCommand.id,{unitId:s,subUnitId:l,payload:{commentId:r.id,text:e,attachments:t}})}}):(0,c.jsx)(`div`,{className:`univer-text-sm univer-text-gray-900 dark:!univer-text-white`,children:z(r.text).map((e,t)=>(0,c.jsx)(`div`,{className:`univer-break-words`,children:e.map((e,t)=>{switch(e.type){case`mention`:return(0,c.jsxs)(`a`,{className:`univer-text-primary-600`,children:[e.content.label,` `]},t);default:return e.content}})},t))})]})},J=e=>{var s,l,u;let{id:d,unitId:f,subUnitId:p,refStr:m,showEdit:h=!0,onClick:_,showHighlight:v,onClose:y,getSubUnitName:b,location:x,autoFocus:S,onMouseEnter:C,onMouseLeave:w,onAddComment:T,onDeleteComment:E,onResolve:O,type:k,style:A,full:j}=e,M=(0,n.useDependency)(i.ThreadCommentModel),[N,P]=(0,o.useState)(!1),[I,R]=(0,o.useState)(``);(0,n.useObservable)((0,o.useMemo)(()=>M.commentUpdate$.pipe((0,r.debounceTime)(16)),[M]));let z=d?M.getCommentWithChildren(f,p,d):null,V=(0,n.useDependency)(t.ICommandService),H=(0,n.useDependency)(t.UserManagerService),G=z==null?void 0:z.root.resolved,J=(0,n.useObservable)(H.currentUser$),Y=(0,o.useRef)(null),X=(0,o.useMemo)(()=>(0,t.generateRandomId)(6),[]),ee=[...z?[z.root]:[{id:K,text:{dataStream:`
14
+ \r`},personId:(s=J==null?void 0:J.userID)==null?``:s,ref:m==null?``:m,dT:``,unitId:f,subUnitId:p,threadId:``}],...(l=z==null?void 0:z.children)==null?[]:l],Z=(0,o.useRef)(null),te=e=>{e.stopPropagation(),G?V.executeCommand(g.id,{unitId:f,subUnitId:p,commentId:d}):V.executeCommand(g.id),V.executeCommand(i.ResolveCommentCommand.id,{unitId:f,subUnitId:p,commentId:d,resolved:!G}),O==null||O(!G)},ne=e=>{e.stopPropagation(),V.executeCommand(g.id),!(z!=null&&z.root&&(E==null?void 0:E(z.root))===!1)&&(V.executeCommand(i.DeleteCommentTreeCommand.id,{unitId:f,subUnitId:p,commentId:d}),y==null||y())};(0,o.useEffect)(()=>w==null?void 0:w(),[]);let Q=b((u=z==null?void 0:z.root.subUnitId)==null?p:u),re=h&&!I&&!G,$=`${m||(z==null?void 0:z.root.ref)||``}${Q?` · `:``}${Q}`,ie=W({location:x,unitId:f,subUnitId:p,commentId:d,fallbackId:X});return(0,c.jsxs)(`div`,{id:`${x}-${f}-${p}-${d}`,className:(0,a.clsx)(`univer-relative univer-box-border univer-rounded-md univer-bg-white univer-p-4 dark:!univer-bg-gray-900 dark:!univer-text-white`,a.borderClassName,{"univer-w-[278px]":!j,"univer-w-full":j,"univer-shadow":!G&&(v||N||x===`CELL`)}),style:A,onClick:_,onMouseEnter:()=>{C==null||C(),P(!0)},onMouseLeave:()=>{w==null||w(),P(!1)},children:[!G&&v&&(0,c.jsx)(`div`,{className:`univer-absolute univer-left-0 univer-right-0 univer-top-0 univer-h-1.5 univer-rounded-t-md univer-bg-yellow-400`}),(0,c.jsxs)(`div`,{className:`univer-mb-4 univer-flex univer-flex-row univer-items-center univer-justify-between univer-text-sm univer-leading-5`,children:[(0,c.jsxs)(`div`,{className:`univer-flex univer-flex-1 univer-flex-row univer-items-center univer-overflow-hidden`,children:[(0,c.jsx)(`div`,{className:`univer-mr-2 univer-h-3.5 univer-w-[3px] univer-flex-shrink-0 univer-flex-grow-0 univer-rounded-sm univer-bg-yellow-500`}),(0,c.jsx)(a.Tooltip,{showIfEllipsis:!0,title:$,children:(0,c.jsx)(`span`,{className:`univer-flex-1 univer-truncate`,children:$})})]}),!!z&&(0,c.jsxs)(`div`,{className:`univer-flex univer-flex-shrink-0 univer-flex-grow-0 univer-flex-row`,children:[(0,c.jsx)(`div`,{className:(0,a.clsx)(`univer-ml-1 univer-inline-flex univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-[3px] univer-text-base hover:univer-bg-gray-50 dark:hover:!univer-bg-gray-800`,{"univer-text-green-500":G}),onClick:te,children:G?(0,c.jsx)(F,{}):(0,c.jsx)(L,{})}),(J==null?void 0:J.userID)===z.root.personId?(0,c.jsx)(`div`,{className:`univer-ml-1 univer-inline-flex univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-[3px] univer-text-base hover:univer-bg-gray-50 dark:hover:!univer-bg-gray-800`,onClick:ne,children:(0,c.jsx)(D,{})}):null]})]}),(0,c.jsx)(`div`,{ref:Z,className:(0,a.clsx)(`univer-max-h-80 univer-overflow-y-auto univer-overflow-x-hidden`,a.scrollbarClassName),children:ee.map(e=>(0,c.jsx)(q,{unitId:f,subUnitId:p,item:e,isRoot:e.id===(z==null?void 0:z.root.id),editing:I===e.id,resolved:z==null?void 0:z.root.resolved,type:k,threadCommentEditorId:ie,onClose:y,onEditingChange:t=>{R(t?e.id:``)},onReply:e=>{e&&requestAnimationFrame(()=>{var t;(t=Y.current)==null||t.reply(B([{type:`mention`,content:{id:e.userID,label:`@${e.name}`}},{type:`text`,content:` `}]))})},onAddComment:T,onDeleteComment:E},e.id))}),re&&(0,c.jsx)(`div`,{children:(0,c.jsx)(U,{ref:Y,type:k,unitId:f,subUnitId:p,editorId:ie,onSave:async({text:e,attachments:n})=>{var r,a;let o={text:e,attachments:n,dT:(0,i.getDT)(),id:(0,t.generateRandomId)(),ref:m,personId:(r=J==null?void 0:J.userID)==null?``:r,parentId:z==null?void 0:z.root.id,unitId:f,subUnitId:p,threadId:(a=z==null?void 0:z.root.threadId)==null?``:a};(T==null?void 0:T(o))!==!1&&(await V.executeCommand(i.AddCommentCommand.id,{unitId:f,subUnitId:p,comment:o}),Z.current&&(Z.current.scrollTop=Z.current.scrollHeight))},autoFocus:S||!z,onCancel:()=>{z||y==null||y()}},`${S}`)})]})};function Y(e,t,n){return e.id?e.id:[`thread-comment-panel-temp`,n,e.unitId,e.subUnitId,e.threadId,e.ref,e.dT,t].join(`-`)}e.SetActiveCommentOperation=g,e.ThreadCommentPanel=e=>{let{unitId:r,subUnitId$:s,type:l,onAdd:u,getSubUnitName:d,onResolve:f,sortComments:p,onItemLeave:m,onItemEnter:_,disableAdd:v,tempComment:y,onAddComment:b,onDeleteComment:x,showComments:S}=e,[C,w]=(0,o.useState)(`all`),[T,E]=(0,o.useState)(`all`),D=(0,n.useDependency)(t.LocaleService),O=(0,n.useDependency)(t.UserManagerService),A=(0,n.useDependency)(i.ThreadCommentModel),[j,M]=(0,o.useState)(()=>A.getUnit(r)),N=(0,n.useObservable)((0,n.useDependency)(h).activeCommentId$),P=(0,n.useObservable)(A.commentUpdate$),F=(0,n.useDependency)(t.ICommandService),I=(0,n.useObservable)(s),L=(0,o.useRef)(!0),R=`PANEL`,z=(0,n.useObservable)(O.currentUser$),B=(0,o.useMemo)(()=>{var e;let t=C===`all`?j:(e=j.filter(e=>e.subUnitId===I))==null?[]:e,n=p==null?(e=>e):p,r=t.map(e=>{var t;return{...e.root,children:(t=e.children)==null?[]:t,users:e.relativeUsers}});if(S){let e=new Map;return r.forEach(t=>{e.set(t.id,t)}),[...S,``].map(t=>e.get(t)).filter(Boolean)}else return n(r)},[S,C,j,p,I]),V=(0,o.useMemo)(()=>[...B.filter(e=>!e.resolved),...B.filter(e=>e.resolved)],[B]),H=(0,o.useMemo)(()=>T===`resolved`?V.filter(e=>e.resolved):T===`unsolved`?V.filter(e=>!e.resolved):T===`concern_me`&&z!=null&&z.userID?V.filter(e=>e==null?void 0:e.users.has(z.userID)):V,[V,z==null?void 0:z.userID,T]),U=y?[y,...H]:H,W=U.filter(e=>!e.resolved),G=U.filter(e=>e.resolved),K=T!==`all`||C!==`all`,q=()=>{E(`all`),w(`all`)};(0,o.useEffect)(()=>{r&&M(A.getUnit(r))},[r,A,P]),(0,o.useEffect)(()=>{var e;if(!N)return;if(!L.current){L.current=!0;return}let{unitId:t,subUnitId:n,commentId:r}=N,i=`${R}-${t}-${n}-${r}`;(e=document.getElementById(i))==null||e.scrollIntoView({block:`center`})},[N]);let X=e=>(t,n)=>(0,c.jsx)(J,{location:R,getSubUnitName:d,id:t.id,unitId:t.unitId,subUnitId:t.subUnitId,refStr:t.ref,type:l,showEdit:(N==null?void 0:N.commentId)===t.id,showHighlight:(N==null?void 0:N.commentId)===t.id,onClick:()=>{L.current=!1,t.resolved?F.executeCommand(g.id):F.executeCommand(g.id,{unitId:t.unitId,subUnitId:t.subUnitId,commentId:t.id,temp:!1})},onMouseEnter:()=>_==null?void 0:_(t),onMouseLeave:()=>m==null?void 0:m(t),onAddComment:b,onDeleteComment:x,onResolve:e=>f==null?void 0:f(t.id,e)},Y(t,n,e));return(0,c.jsxs)(`div`,{className:`univer-flex univer-min-h-full univer-flex-col univer-pb-3`,children:[(0,c.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-flex-row univer-justify-between`,children:[l===t.UniverInstanceType.UNIVER_SHEET?(0,c.jsx)(a.Select,{borderless:!0,value:C,options:[{value:`current`,label:D.t(`thread-comment-ui.filter.sheet.current`)},{value:`all`,label:D.t(`thread-comment-ui.filter.sheet.all`)}],onChange:w}):null,(0,c.jsx)(a.Select,{borderless:!0,value:T,options:[{value:`all`,label:D.t(`thread-comment-ui.filter.status.all`)},{value:`resolved`,label:D.t(`thread-comment-ui.filter.status.resolved`)},{value:`unsolved`,label:D.t(`thread-comment-ui.filter.status.unsolved`)},{value:`concern_me`,label:D.t(`thread-comment-ui.filter.status.concernMe`)}],onChange:E})]}),U.length===0?(0,c.jsxs)(`div`,{className:`univer-flex univer-flex-1 univer-flex-col univer-items-center univer-justify-center univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200`,children:[D.t(`thread-comment-ui.panel.empty`),K?(0,c.jsx)(`div`,{className:`univer-mt-2 univer-flex univer-flex-row`,children:(0,c.jsx)(a.Button,{onClick:q,children:D.t(`thread-comment-ui.panel.reset`)})}):v?null:(0,c.jsx)(`div`,{className:`univer-mt-2 univer-flex univer-flex-row`,children:(0,c.jsxs)(a.Button,{onClick:u,children:[(0,c.jsx)(k,{className:`univer-mr-1.5`}),D.t(`thread-comment-ui.panel.addComment`)]})})]}):(0,c.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-flex-col univer-gap-3`,children:[W.map(X(`unsolved`)),G.length>0&&(0,c.jsx)(`div`,{className:`univer-text-xs`,children:D.t(`thread-comment-ui.panel.solved`)}),G.map(X(`solved`))]})]})},Object.defineProperty(e,"ThreadCommentPanelService",{enumerable:!0,get:function(){return h}}),e.ThreadCommentTree=J,e.ThreadCommentTreeLocation=G,Object.defineProperty(e,"UniverThreadCommentUIPlugin",{enumerable:!0,get:function(){return b}})});
15
15
 
16
16
  // @univerjs/sheets-thread-comment-ui/index
17
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@univerjs/core`),require(`@univerjs/sheets`),require(`@univerjs/sheets-thread-comment`),require(`@univerjs/thread-comment-ui`),require(`@univerjs/ui`),require(`@univerjs/sheets-ui`),require(`rxjs`),require(`@univerjs/engine-render`),require(`@univerjs/engine-formula`),require(`@univerjs/thread-comment`),require(`react`),require(`react/jsx-runtime`)):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/sheets`,`@univerjs/sheets-thread-comment`,`@univerjs/thread-comment-ui`,`@univerjs/ui`,`@univerjs/sheets-ui`,`rxjs`,`@univerjs/engine-render`,`@univerjs/engine-formula`,`@univerjs/thread-comment`,`react`,`react/jsx-runtime`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverSheetsThreadCommentUi={},e.UniverCore,e.UniverSheets,e.UniverSheetsThreadComment,e.UniverThreadCommentUi,e.UniverUi,e.UniverSheetsUi,e.rxjs,e.UniverEngineRender,e.UniverEngineFormula,e.UniverThreadComment,e.React,e.React))})(this,function(e,t,n,r,i,a,o,s,c,l,u,d,f){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});let p=`univer.sheet.thread-comment-modal`,m=`univer.sheet.thread-comment-panel`,h=`SHEET_THREAD_COMMENT_UI_PLUGIN`;function g(e){"@babel/helpers - typeof";return g=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},g(e)}function _(e,t){if(g(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(g(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function v(e){var t=_(e,`string`);return g(t)==`symbol`?t:t+``}function y(e,t,n){return(t=v(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function b(e,t){return function(n,r){t(n,r,e)}}function x(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let S=class extends t.Disposable{get activePopup(){return this._activePopup}constructor(e,t,n){super(),this._canvasPopupManagerService=e,this._zenZoneService=t,this._cellPopupManagerService=n,y(this,`_lastPopup`,null),y(this,`_activePopup`,void 0),y(this,`_activePopup$`,new s.BehaviorSubject(null)),y(this,`activePopup$`,this._activePopup$.asObservable()),this._initZenVisible(),this.disposeWithMe(()=>{this._activePopup$.complete()})}_initZenVisible(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(e=>{e&&this.hidePopup()}))}dispose(){super.dispose(),this.hidePopup()}showPopup(e,n){var r;let{row:i,col:a,unitId:o,subUnitId:s}=e;if(this._activePopup&&i===this._activePopup.row&&a===this._activePopup.col&&o===this._activePopup.unitId&&s===((r=this.activePopup)==null?void 0:r.subUnitId)){this._activePopup=e,this._activePopup$.next(e);return}if(this._lastPopup&&this._lastPopup.dispose(),this._zenZoneService.visible)return;this._activePopup=e,this._activePopup$.next(e);let c=this._cellPopupManagerService.showPopup({row:i,col:a,unitId:o,subUnitId:s},{componentKey:p,onClickOutside:()=>{this.hidePopup()},direction:`horizontal`,excludeOutside:[...Array.from(document.querySelectorAll(`.univer-thread-comment`)),document.getElementById(`thread-comment-add`)].filter(Boolean),priority:2});if(!c)throw Error(`[SheetsThreadCommentPopupService]: cannot show popup!`);let l=new t.DisposableCollection;l.add(c),l.add({dispose:()=>{n==null||n()}}),this._lastPopup=l}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))}};S=x([b(0,(0,t.Inject)(o.SheetCanvasPopManagerService)),b(1,a.IZenZoneService),b(2,(0,t.Inject)(o.CellPopupManagerService))],S);let C={type:t.CommandType.OPERATION,id:`sheet.operation.show-comment-modal`,handler(e){var a;let o=e.get(n.SheetsSelectionsService),s=e.get(t.IUniverInstanceService),c=e.get(S),l=e.get(i.ThreadCommentPanelService),u=(a=o.getCurrentLastSelection())==null?void 0:a.primary,d=e.get(r.SheetsThreadCommentModel);if(!u)return!1;let f=(0,n.getSheetCommandTarget)(s);if(!f)return!1;let{workbook:p,worksheet:m,unitId:h,subUnitId:g}=f,_={workbook:p,worksheet:m,unitId:h,subUnitId:g,row:u.startRow,col:u.startColumn};c.showPopup(_);let v=d.getByLocation(h,g,u.startRow,u.startColumn);return v&&l.setActiveComment({unitId:h,subUnitId:g,commentId:v,trigger:`context-menu`}),!0}},w={id:`sheet.operation.toggle-comment-panel`,type:t.CommandType.OPERATION,handler(e){let t=e.get(a.ISidebarService),n=e.get(i.ThreadCommentPanelService);return n.panelVisible?(t.close(),n.setPanelVisible(!1)):(t.open({header:{title:`threadCommentUI.panel.title`},children:{label:m},width:360}),n.setPanelVisible(!0)),!0}};var T=`@univerjs/sheets-thread-comment-ui`,E=`0.23.0`;let D=`sheets-thread-comment.config`;Symbol(D);let O={},k=class extends t.Disposable{constructor(e,t,n,r){super(),this._sheetInterceptorService=e,this._sheetsThreadCommentModel=t,this._univerInstanceService=n,this._renderManagerService=r,this._initViewModelIntercept(),this._initSkeletonChange()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(n.INTERCEPTOR_POINT.CELL_CONTENT,{effect:t.InterceptorEffectEnum.Style,handler:(e,t,n)=>{let{row:r,col:i,unitId:a,subUnitId:o}=t;return this._sheetsThreadCommentModel.showCommentMarker(a,o,r,i)?((!e||e===t.rawData)&&(e={...t.rawData}),e.markers={...e==null?void 0:e.markers,tr:{color:`#FFBD37`,size:6}},n(e)):n(e)},priority:100}))}_initSkeletonChange(){let e=()=>{var e;let n=this._univerInstanceService.getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET);if(!n)return;let r=n.getUnitId(),i=this._renderManagerService.getRenderById(r);i==null||(e=i.mainComponent)==null||e.makeForceDirty()};this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe((0,s.debounceTime)(16)).subscribe(()=>{e()}))}};k=x([b(0,(0,t.Inject)(n.SheetInterceptorService)),b(1,(0,t.Inject)(r.SheetsThreadCommentModel)),b(2,t.IUniverInstanceService),b(3,c.IRenderManagerService)],k);let A=(e,t,n)=>{let r=(0,l.singleReferenceToGrid)(e),i=n.row-t.row,a=n.column-t.column;return(0,l.serializeRange)({startColumn:r.column+a,startRow:r.row+i,endColumn:r.column+a,endRow:r.row+i})},j=class extends t.Disposable{constructor(e,t,n){super(),this._sheetClipboardService=e,this._sheetsThreadCommentModel=t,this._threadCommentDataSourceService=n,y(this,`_copyInfo`,void 0),this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:h,onBeforeCopy:(e,t,n)=>{this._copyInfo={unitId:e,subUnitId:t,range:n}},onPasteCells:(e,n,r,i)=>{let{unitId:a,subUnitId:s,range:c}=n,l={row:c.rows[0],column:c.cols[0]};if(i.copyType===o.COPY_TYPE.CUT&&this._copyInfo){let{range:e,unitId:n,subUnitId:r}=this._copyInfo,i={row:e.startRow,column:e.startColumn};if(!(a===n&&s===r)){let o=[];t.Range.foreach(e,(e,t)=>{let i=this._sheetsThreadCommentModel.getAllByLocation(n,r,e,t);this._threadCommentDataSourceService.syncUpdateMutationToColla?i.forEach(e=>{o.push(e)}):i.forEach(({children:e,...t})=>{t.parentId||o.push(t)})});let c=[],d=[],f=[],p=[],m=e=>{c.unshift({id:u.DeleteCommentMutation.id,params:{unitId:n,subUnitId:r,commentId:e.id}}),f.push({id:u.AddCommentMutation.id,params:{unitId:a,subUnitId:s,comment:{...e,ref:A(e.ref,i,l),unitId:a,subUnitId:s},sync:!0}}),d.push({id:u.AddCommentMutation.id,params:{unitId:n,subUnitId:r,comment:e,sync:!0}}),p.unshift({id:u.DeleteCommentMutation.id,params:{unitId:a,subUnitId:s,commentId:e.id}})};return o.forEach(e=>{m(e)}),{redos:[...c,...f],undos:[...p,...d]}}}return{redos:[],undos:[]}}}))}};j=x([b(0,(0,t.Inject)(o.ISheetClipboardService)),b(1,(0,t.Inject)(r.SheetsThreadCommentModel)),b(2,u.IThreadCommentDataSourceService)],j);let M=class extends t.Disposable{constructor(e,t,n,r){super(),this._hoverManagerService=e,this._sheetsThreadCommentPopupService=t,this._sheetsThreadCommentModel=n,this._sheetPermissionCheckController=r,this._initHoverEvent()}_initHoverEvent(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe((0,s.debounceTime)(100)).subscribe(e=>{let t=this._sheetsThreadCommentPopupService.activePopup;if(e&&(t&&t.temp||!t)){let{location:r}=e,{unitId:i,subUnitId:a,row:o,col:s}=r,c=this._sheetsThreadCommentModel.getByLocation(i,a,o,s);if(c){if(!this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[n.WorkbookCommentPermission],worksheetTypes:[n.WorksheetViewPermission],rangeTypes:[n.RangeProtectionPermissionViewPoint]},[{startRow:o,startColumn:s,endRow:o,endColumn:s}],i,a))return;let e=this._sheetsThreadCommentModel.getComment(i,a,c);e&&!e.resolved&&this._sheetsThreadCommentPopupService.showPopup({unitId:i,subUnitId:a,row:o,col:s,commentId:c,temp:!0})}else t&&this._sheetsThreadCommentPopupService.hidePopup()}}))}};M=x([b(0,(0,t.Inject)(o.HoverManagerService)),b(1,(0,t.Inject)(S)),b(2,(0,t.Inject)(r.SheetsThreadCommentModel)),b(3,(0,t.Inject)(n.SheetPermissionCheckController))],M);let N=class extends t.Disposable{constructor(e,t,n,r){super(),this._localeService=e,this._commandService=t,this._sheetPermissionCheckController=n,this._sheetsThreadCommentModel=r,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(e=>{let{id:t}=e;if(t===C.id||t===w.id)this._sheetPermissionCheckController.permissionCheckWithoutRange({workbookTypes:[n.WorkbookCommentPermission],worksheetTypes:[n.WorksheetViewPermission]})||this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t(`permission.dialog.commentErr`));else if(t===u.AddCommentCommand.id){let{unitId:t,subUnitId:r,comment:i}=e.params,{row:a,column:o}=(0,l.singleReferenceToGrid)(i.ref);this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[n.WorkbookCommentPermission],worksheetTypes:[n.WorksheetViewPermission],rangeTypes:[n.RangeProtectionPermissionViewPoint]},[{startRow:a,startColumn:o,endRow:a,endColumn:o}],t,r)||this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t(`permission.dialog.commentErr`))}else if(t===u.UpdateCommentCommand.id){let{unitId:t,subUnitId:r,payload:i}=e.params,{commentId:a}=i,o=this._sheetsThreadCommentModel.getComment(t,r,a);if(o){let{row:e,column:i}=(0,l.singleReferenceToGrid)(o.ref);this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[n.WorkbookCommentPermission],worksheetTypes:[n.WorksheetViewPermission],rangeTypes:[n.RangeProtectionPermissionViewPoint]},[{startRow:e,startColumn:i,endRow:e,endColumn:i}],t,r)||this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t(`permission.dialog.commentErr`))}}else if(t===u.ResolveCommentCommand.id||t===u.DeleteCommentCommand.id||t===u.DeleteCommentTreeCommand.id){let{unitId:t,subUnitId:r,commentId:i}=e.params,a=this._sheetsThreadCommentModel.getComment(t,r,i);if(a){let{row:e,column:i}=(0,l.singleReferenceToGrid)(a.ref);this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[n.WorkbookCommentPermission],worksheetTypes:[n.WorksheetViewPermission],rangeTypes:[n.RangeProtectionPermissionViewPoint]},[{startRow:e,startColumn:i,endRow:e,endColumn:i}],t,r)||this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t(`permission.dialog.commentErr`))}}}))}};N=x([b(0,(0,t.Inject)(t.LocaleService)),b(1,t.ICommandService),b(2,(0,t.Inject)(n.SheetPermissionCheckController)),b(3,(0,t.Inject)(r.SheetsThreadCommentModel))],N);let P=class extends t.Disposable{constructor(e,t,n,r,i,a,o,s,c,l){super(),this._commandService=e,this._sheetsThreadCommentPopupService=t,this._sheetsThreadCommentModel=n,this._threadCommentPanelService=r,this._univerInstanceService=i,this._sheetPermissionCheckController=a,this._markSelectionService=o,this._sheetSelectionService=s,this._editorBridgeService=c,this._renderManagerService=l,y(this,`_isSwitchToCommenting`,!1),y(this,`_selectionShapeInfo`,null),this._initCommandListener(),this._initPanelListener(),this._initMarkSelection(),this._initSelectionUpdateListener(),this._initEditorBridge()}_handleSelectionChange(e,n,r){var a,s,c;let l=(a=e[0])==null?void 0:a.range,u=this._renderManagerService.getRenderById(n),d=u==null||(s=u.with(o.SheetSkeletonManagerService).getSkeletonParam(r))==null?void 0:s.skeleton;if(!d||!l)return;let f=d.getCellWithCoordByIndex(l.startRow,l.startColumn);if((((c=l.rangeType)==null?t.RANGE_TYPE.NORMAL:c)!==t.RANGE_TYPE.NORMAL||l.endColumn-l.startColumn>0||l.endRow-l.startRow>0)&&!((f.isMerged||f.isMergedMainCell)&&t.Rectangle.equals(f.mergeInfo,l))){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(i.SetActiveCommentOperation.id);return}let p=f.actualRow,m=f.actualColumn;if(!this._sheetsThreadCommentModel.showCommentMarker(n,r,p,m)){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(i.SetActiveCommentOperation.id);return}let h=this._sheetsThreadCommentModel.getByLocation(n,r,p,m);h&&this._commandService.executeCommand(i.SetActiveCommentOperation.id,{unitId:n,subUnitId:r,commentId:h})}_initSelectionUpdateListener(){this.disposeWithMe(this._sheetSelectionService.selectionMoveEnd$.subscribe(e=>{if(this._isSwitchToCommenting)return;let t=this._sheetSelectionService.currentSelectionParam;t&&this._handleSelectionChange(e,t.unitId,t.sheetId)}))}_initEditorBridge(){this.disposeWithMe(this._editorBridgeService.visible$.subscribe(e=>{e.visible&&this._sheetsThreadCommentPopupService.hidePopup()}))}_initCommandListener(){this._commandService.onCommandExecuted(e=>{if(e.id===u.DeleteCommentMutation.id){let t=e.params,n=this._sheetsThreadCommentPopupService.activePopup;if(!n)return;let{unitId:r,subUnitId:i,commentId:a}=n;t.unitId===r&&t.subUnitId===i&&t.commentId===a&&this._sheetsThreadCommentPopupService.hidePopup()}})}_initPanelListener(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(async e=>{if(e){var r;let{unitId:i,subUnitId:a,commentId:s,trigger:c}=e,u=this._sheetsThreadCommentModel.getComment(i,a,s);if(!u||u.resolved)return;let d=this._univerInstanceService.getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET);if(!d||d.getUnitId()!==i)return;this._isSwitchToCommenting=!0,((r=d.getActiveSheet())==null?void 0:r.getSheetId())!==a&&await this._commandService.executeCommand(n.SetWorksheetActiveOperation.id,{unitId:i,subUnitId:a}),this._isSwitchToCommenting=!1;let f=(0,l.singleReferenceToGrid)(u.ref),{row:p,column:m}=f;if(!this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[n.WorkbookCommentPermission],worksheetTypes:[n.WorksheetViewPermission],rangeTypes:[n.RangeProtectionPermissionViewPoint]},[{startRow:p,startColumn:m,endRow:p,endColumn:m}],i,a)||(await this._commandService.executeCommand(o.ScrollToRangeOperation.id,{range:{startRow:Math.max(f.row-1,0),endRow:f.row+1,startColumn:Math.max(f.column-1,0),endColumn:f.column+1}}),this._editorBridgeService.isVisible().visible))return;this._sheetsThreadCommentPopupService.showPopup({unitId:i,subUnitId:a,row:f.row,col:f.column,commentId:u.id,trigger:c})}else this._sheetsThreadCommentPopupService.hidePopup()}))}_initMarkSelection(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe((0,s.debounceTime)(100)).subscribe(e=>{var n,r;if(!e){this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);return}let{unitId:i,subUnitId:a,commentId:o}=e;this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);let s=this._sheetsThreadCommentModel.getComment(i,a,o);if(!s)return;let{row:c,column:u}=(0,l.singleReferenceToGrid)(s.ref);if(Number.isNaN(c)||Number.isNaN(u))return null;let d=(n=this._univerInstanceService.getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET))==null?void 0:n.getSheetBySheetId(a),f=(r=d==null?void 0:d.getMergedCell(c,u))==null?{startColumn:u,endColumn:u,startRow:c,endRow:c}:r,p=this._markSelectionService.addShape({range:f,style:{fill:`rgba(255, 189, 55, 0.35)`,strokeWidth:1,stroke:`#FFBD37`,widgets:{}},primary:null},[],-1);p&&(this._selectionShapeInfo={...e,shapeId:p})}))}};P=x([b(0,t.ICommandService),b(1,(0,t.Inject)(S)),b(2,(0,t.Inject)(r.SheetsThreadCommentModel)),b(3,(0,t.Inject)(i.ThreadCommentPanelService)),b(4,t.IUniverInstanceService),b(5,(0,t.Inject)(n.SheetPermissionCheckController)),b(6,o.IMarkSelectionService),b(7,(0,t.Inject)(n.SheetsSelectionsService)),b(8,o.IEditorBridgeService),b(9,c.IRenderManagerService)],P);function F({ref:e,...t}){let{icon:n,id:r,className:i,extend:a,...o}=t,s=`univerjs-icon univerjs-icon-${r} ${i||``}`.trim(),c=(0,d.useRef)(`_${z()}`);return I(n,`${r}`,{defIds:n.defIds,idSuffix:c.current},{ref:e,className:s,...o},a)}function I(e,t,n,r,i){return(0,d.createElement)(e.tag,{key:t,...L(e,n,i),...r},(R(e,n).children||[]).map((r,a)=>I(r,`${t}-${e.tag}-${a}`,n,void 0,i)))}function L(e,t,n){let r={...e.attrs};n!=null&&n.colorChannel1&&r.fill===`colorChannel1`&&(r.fill=n.colorChannel1),e.tag===`mask`&&r.id&&(r.id+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{e===`mask`&&typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))});let{defIds:i}=t;return!i||i.length===0?r:(e.tag===`use`&&r[`xlink:href`]&&(r[`xlink:href`]+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))}),r)}function R(e,t){var n;let{defIds:r}=t;return!r||r.length===0?e:e.tag===`defs`&&(n=e.children)!=null&&n.length?{...e,children:e.children.map(e=>typeof e.attrs.id==`string`&&r&&r.includes(e.attrs.id)?{...e,attrs:{...e.attrs,id:e.attrs.id+t.idSuffix}}:e)}:e}function z(){return Math.random().toString(36).substring(2,8)}F.displayName=`UniverIcon`;let B={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,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.13521C5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M8.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.78345Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M11.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`}},{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`}}]},V=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(F,Object.assign({},e,{id:`comment-icon`,ref:t,icon:B}))});V.displayName=`CommentIcon`;let H=e=>({id:C.id,type:a.MenuItemType.BUTTON,icon:`CommentIcon`,title:`sheetThreadComment.menu.addComment`,hidden$:(0,a.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_SHEET),disabled$:(0,o.getCurrentRangeDisable$)(e,{workbookTypes:[n.WorkbookCommentPermission],worksheetTypes:[n.WorksheetViewPermission],rangeTypes:[n.RangeProtectionPermissionViewPoint]})}),U=e=>({id:w.id,type:a.MenuItemType.BUTTON,icon:`CommentIcon`,tooltip:`sheetThreadComment.menu.commentManagement`,disabled$:(0,o.getCurrentRangeDisable$)(e,{workbookTypes:[n.WorkbookCommentPermission],worksheetTypes:[n.WorksheetViewPermission],rangeTypes:[n.RangeProtectionPermissionViewPoint]}),hidden$:(0,a.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_SHEET)}),W={id:C.id,binding:a.KeyCode.M|a.MetaKeys.CTRL_COMMAND|a.MetaKeys.ALT,preconditions:o.whenSheetEditorFocused},G={[a.RibbonInsertGroup.MEDIA]:{[w.id]:{order:2,menuItemFactory:U}},[a.ContextMenuPosition.MAIN_AREA]:{[a.ContextMenuGroup.OTHERS]:{[C.id]:{order:0,menuItemFactory:H}}}},K=()=>{let e=(0,a.useDependency)(t.IUniverInstanceService),n=(0,a.useDependency)(S),o=(0,a.useObservable)(n.activePopup$),s=(0,a.useDependency)(r.SheetsThreadCommentModel);if((0,a.useObservable)(s.commentUpdate$),!o)return null;let{row:c,col:l,unitId:u,subUnitId:d,trigger:p}=o,m=s.getByLocation(u,d,c,l),h=`${t.Tools.chatAtABC(l)}${c+1}`;return(0,f.jsx)(i.ThreadCommentTree,{onClick:()=>{n.persistPopup()},location:i.ThreadCommentTreeLocation.CELL,id:m,unitId:u,subUnitId:d,type:t.UniverInstanceType.UNIVER_SHEET,refStr:h,onClose:()=>{n.hidePopup()},getSubUnitName:n=>{var r,i;return(r=(i=e.getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET))==null||(i=i.getSheetBySheetId(n))==null?void 0:i.getName())==null?``:r},autoFocus:p===`context-menu`})},q=()=>{var e;let n=(0,a.useDependency)(o.IMarkSelectionService),r=(0,a.useDependency)(t.IUniverInstanceService),c=(0,a.useDependency)(S),u=r.getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET),p=u.getUnitId(),m=(0,a.useDependency)(t.ICommandService),h=(0,d.useMemo)(()=>u.activeSheet$.pipe((0,s.map)(e=>e==null?void 0:e.getSheetId())),[u.activeSheet$]),g=(0,a.useObservable)(h,(e=u.getActiveSheet())==null?void 0:e.getSheetId()),_=(0,d.useRef)(null),v=(0,a.useDependency)(i.ThreadCommentPanelService),y=(0,a.useObservable)(v.activeCommentId$),b=(0,a.useObservable)(v.panelVisible$,v.panelVisible),x=(0,d.useCallback)(e=>{let t=u.getSheets(),n={};t.forEach((e,t)=>{n[e.getSheetId()]=t});let r=e=>e.map(e=>{var t;let r=(0,l.singleReferenceToGrid)(e.ref),i=[(t=n[e.subUnitId])==null?0:t,r.row,r.column];return{...e,p:i}}).sort((e,t)=>e.p[0]===t.p[0]?e.p[1]===t.p[1]?e.p[2]-t.p[2]:e.p[1]-t.p[1]:e.p[0]-t.p[0]);return[...r(e.filter(e=>!e.resolved)),...r(e.filter(e=>e.resolved))]},[u]),w=(0,d.useCallback)(e=>{if(e.unitId===p&&e.subUnitId===g&&!e.resolved){var t;let{row:r,column:i}=(0,l.singleReferenceToGrid)(e.ref),a=u.getSheetBySheetId(e.subUnitId),o=(t=a==null?void 0:a.getMergedCell(r,i))==null?{startColumn:i,endColumn:i,startRow:r,endRow:r}:t;if(!Number.isNaN(r)&&!Number.isNaN(i))return n.addShape({range:o,style:{fill:`rgb(255, 189, 55, 0.35)`,strokeWidth:1,stroke:`#FFBD37`,widgets:{}},primary:null})}return null},[n,g,p]),T=e=>{var t,n;return(t=(n=u.getSheetBySheetId(e))==null?void 0:n.getName())==null?``:t},E=()=>{m.executeCommand(C.id)},D=e=>{y&&y.unitId===e.unitId&&y.subUnitId===e.subUnitId&&y.commentId===e.id||(_.current&&(n.removeShape(_.current),_.current=null),_.current=w(e))},O=()=>{_.current&&(n.removeShape(_.current),_.current=null)};return(0,d.useEffect)(()=>{!b&&_.current&&n.removeShape(_.current)},[n,b]),(0,f.jsx)(i.ThreadCommentPanel,{unitId:p,subUnitId$:h,type:t.UniverInstanceType.UNIVER_SHEET,onAdd:E,getSubUnitName:T,onResolve:(e,t)=>{t&&c.hidePopup()},sortComments:x,onItemEnter:D,onItemLeave:O,onDeleteComment:()=>(O(),!0)})},J=class extends t.Disposable{constructor(e,t,n){super(),this._menuManagerService=e,this._componentManager=t,this._shortcutService=n,this._initMenu(),this._initShortcut(),this._initComponent()}_initShortcut(){this._shortcutService.registerShortcut(W)}_initMenu(){this._menuManagerService.mergeMenu(G)}_initComponent(){[[p,K],[m,q],[`CommentIcon`,V]].forEach(([e,t])=>{this.disposeWithMe(this._componentManager.register(e,t))})}};J=x([b(0,a.IMenuManagerService),b(1,(0,t.Inject)(a.ComponentManager)),b(2,a.IShortcutService)],J);let Y=class extends t.Plugin{constructor(e=O,n,r,i){super(),this._config=e,this._injector=n,this._commandService=r,this._configService=i;let{menu:a,...o}=(0,t.merge)({},O,this._config);a&&this._configService.setConfig(`menu`,a,{merge:!0}),this._configService.setConfig(D,o)}onStarting(){[[J],[k],[j],[M],[P],[S],[N]].forEach(e=>{this._injector.add(e)}),[C,w].forEach(e=>{this._commandService.registerCommand(e)}),this._injector.get(J)}onReady(){this._injector.get(k)}onRendered(){this._injector.get(j),this._injector.get(M),this._injector.get(P),this._injector.get(N)}};y(Y,`pluginName`,h),y(Y,`packageName`,T),y(Y,`version`,E),y(Y,`type`,t.UniverInstanceType.UNIVER_SHEET),Y=x([(0,t.DependentOn)(i.UniverThreadCommentUIPlugin,r.UniverSheetsThreadCommentPlugin),b(1,(0,t.Inject)(t.Injector)),b(2,(0,t.Inject)(t.ICommandService)),b(3,t.IConfigService)],Y),Object.defineProperty(e,`AddCommentCommand`,{enumerable:!0,get:function(){return u.AddCommentCommand}}),Object.defineProperty(e,`DeleteCommentCommand`,{enumerable:!0,get:function(){return u.DeleteCommentCommand}}),Object.defineProperty(e,`DeleteCommentTreeCommand`,{enumerable:!0,get:function(){return u.DeleteCommentTreeCommand}}),Object.defineProperty(e,`IThreadCommentDataSourceService`,{enumerable:!0,get:function(){return u.IThreadCommentDataSourceService}}),Object.defineProperty(e,`ResolveCommentCommand`,{enumerable:!0,get:function(){return u.ResolveCommentCommand}}),Object.defineProperty(e,`SheetsThreadCommentPopupService`,{enumerable:!0,get:function(){return S}}),e.ShowAddSheetCommentModalOperation=C,e.ToggleSheetCommentPanelOperation=w,Object.defineProperty(e,`UniverSheetsThreadCommentUIPlugin`,{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,`UniverThreadCommentUIPlugin`,{enumerable:!0,get:function(){return i.UniverThreadCommentUIPlugin}}),Object.defineProperty(e,`UpdateCommentCommand`,{enumerable:!0,get:function(){return u.UpdateCommentCommand}})});
17
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/sheets-thread-comment"),require("@univerjs/thread-comment-ui"),require("@univerjs/ui"),require("@univerjs/sheets-ui"),require("rxjs"),require("@univerjs/engine-render"),require("@univerjs/engine-formula"),require("@univerjs/thread-comment"),require("react"),require("react/jsx-runtime")):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/sheets`,`@univerjs/sheets-thread-comment`,`@univerjs/thread-comment-ui`,`@univerjs/ui`,`@univerjs/sheets-ui`,`rxjs`,`@univerjs/engine-render`,`@univerjs/engine-formula`,`@univerjs/thread-comment`,`react`,`react/jsx-runtime`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverSheetsThreadCommentUi={},e.UniverCore,e.UniverSheets,e.UniverSheetsThreadComment,e.UniverThreadCommentUi,e.UniverUi,e.UniverSheetsUi,e.rxjs,e.UniverEngineRender,e.UniverEngineFormula,e.UniverThreadComment,e.React,e.React))})(this,function(e,t,n,r,i,a,o,s,c,l,u,d,f){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});let p=`univer.sheet.thread-comment-modal`,m=`univer.sheet.thread-comment-panel`,h=`SHEET_THREAD_COMMENT_UI_PLUGIN`;function g(e){"@babel/helpers - typeof";return g=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},g(e)}function _(e,t){if(g(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(g(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function v(e){var t=_(e,`string`);return g(t)==`symbol`?t:t+``}function y(e,t,n){return(t=v(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function b(e,t){return function(n,r){t(n,r,e)}}function x(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let S=class extends t.Disposable{get activePopup(){return this._activePopup}constructor(e,t,n){super(),this._canvasPopupManagerService=e,this._zenZoneService=t,this._cellPopupManagerService=n,y(this,`_lastPopup`,null),y(this,`_activePopup`,void 0),y(this,`_activePopup$`,new s.BehaviorSubject(null)),y(this,`activePopup$`,this._activePopup$.asObservable()),this._initZenVisible(),this.disposeWithMe(()=>{this._activePopup$.complete()})}_initZenVisible(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(e=>{e&&this.hidePopup()}))}dispose(){super.dispose(),this.hidePopup()}showPopup(e,n){var r;let{row:i,col:a,unitId:o,subUnitId:s}=e;if(this._activePopup&&i===this._activePopup.row&&a===this._activePopup.col&&o===this._activePopup.unitId&&s===((r=this.activePopup)==null?void 0:r.subUnitId)){this._activePopup=e,this._activePopup$.next(e);return}if(this._lastPopup&&this._lastPopup.dispose(),this._zenZoneService.visible)return;this._activePopup=e,this._activePopup$.next(e);let c=this._cellPopupManagerService.showPopup({row:i,col:a,unitId:o,subUnitId:s},{componentKey:p,onClickOutside:()=>{this.hidePopup()},direction:`horizontal`,excludeOutside:[...Array.from(document.querySelectorAll(`.univer-thread-comment`)),document.getElementById(`thread-comment-add`)].filter(Boolean),priority:2});if(!c)throw Error(`[SheetsThreadCommentPopupService]: cannot show popup!`);let l=new t.DisposableCollection;l.add(c),l.add({dispose:()=>{n==null||n()}}),this._lastPopup=l}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))}};S=x([b(0,(0,t.Inject)(o.SheetCanvasPopManagerService)),b(1,a.IZenZoneService),b(2,(0,t.Inject)(o.CellPopupManagerService))],S);let C={type:t.CommandType.OPERATION,id:`sheet.operation.show-comment-modal`,handler(e){var a;let o=e.get(n.SheetsSelectionsService),s=e.get(t.IUniverInstanceService),c=e.get(S),l=e.get(i.ThreadCommentPanelService),u=(a=o.getCurrentLastSelection())==null?void 0:a.primary,d=e.get(r.SheetsThreadCommentModel);if(!u)return!1;let f=(0,n.getSheetCommandTarget)(s);if(!f)return!1;let{workbook:p,worksheet:m,unitId:h,subUnitId:g}=f,_={workbook:p,worksheet:m,unitId:h,subUnitId:g,row:u.startRow,col:u.startColumn};c.showPopup(_);let v=d.getByLocation(h,g,u.startRow,u.startColumn);return v&&l.setActiveComment({unitId:h,subUnitId:g,commentId:v,trigger:`context-menu`}),!0}},w={id:`sheet.operation.toggle-comment-panel`,type:t.CommandType.OPERATION,handler(e){let t=e.get(a.ISidebarService),n=e.get(i.ThreadCommentPanelService);return n.panelVisible?(t.close(),n.setPanelVisible(!1)):(t.open({header:{title:`sheets-thread-comment-ui.panel.title`},children:{label:m},width:360}),n.setPanelVisible(!0)),!0}};var T=`@univerjs/sheets-thread-comment-ui`,E=`0.25.0`;let D={},O=class extends t.Disposable{constructor(e,t,n,r){super(),this._sheetInterceptorService=e,this._sheetsThreadCommentModel=t,this._univerInstanceService=n,this._renderManagerService=r,this._initViewModelIntercept(),this._initSkeletonChange()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(n.INTERCEPTOR_POINT.CELL_CONTENT,{effect:t.InterceptorEffectEnum.Style,handler:(e,t,n)=>{let{row:r,col:i,unitId:a,subUnitId:o}=t;return this._sheetsThreadCommentModel.showCommentMarker(a,o,r,i)?((!e||e===t.rawData)&&(e={...t.rawData}),e.markers={...e==null?void 0:e.markers,tr:{color:`#FFBD37`,size:6}},n(e)):n(e)},priority:100}))}_initSkeletonChange(){let e=()=>{var e;let n=this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET);if(!n)return;let r=n.getUnitId(),i=this._renderManagerService.getRenderById(r);i==null||(e=i.mainComponent)==null||e.makeForceDirty()};this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe((0,s.debounceTime)(16)).subscribe(()=>{e()}))}};O=x([b(0,(0,t.Inject)(n.SheetInterceptorService)),b(1,(0,t.Inject)(r.SheetsThreadCommentModel)),b(2,t.IUniverInstanceService),b(3,c.IRenderManagerService)],O);let k=(e,t,n)=>{let r=(0,l.singleReferenceToGrid)(e),i=n.row-t.row,a=n.column-t.column;return(0,l.serializeRange)({startColumn:r.column+a,startRow:r.row+i,endColumn:r.column+a,endRow:r.row+i})},A=class extends t.Disposable{constructor(e,t,n){super(),this._sheetClipboardService=e,this._sheetsThreadCommentModel=t,this._threadCommentDataSourceService=n,y(this,`_copyInfo`,void 0),this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:h,onBeforeCopy:(e,t,n)=>{this._copyInfo={unitId:e,subUnitId:t,range:n}},onPasteCells:(e,n,r,i)=>{let{unitId:a,subUnitId:s,range:c}=n,l={row:c.rows[0],column:c.cols[0]};if(i.copyType===o.COPY_TYPE.CUT&&this._copyInfo){let{range:e,unitId:n,subUnitId:r}=this._copyInfo,i={row:e.startRow,column:e.startColumn};if(!(a===n&&s===r)){let o=[];t.Range.foreach(e,(e,t)=>{let i=this._sheetsThreadCommentModel.getAllByLocation(n,r,e,t);this._threadCommentDataSourceService.syncUpdateMutationToColla?i.forEach(e=>{o.push(e)}):i.forEach(({children:e,...t})=>{t.parentId||o.push(t)})});let c=[],d=[],f=[],p=[],m=e=>{c.unshift({id:u.DeleteCommentMutation.id,params:{unitId:n,subUnitId:r,commentId:e.id}}),f.push({id:u.AddCommentMutation.id,params:{unitId:a,subUnitId:s,comment:{...e,ref:k(e.ref,i,l),unitId:a,subUnitId:s},sync:!0}}),d.push({id:u.AddCommentMutation.id,params:{unitId:n,subUnitId:r,comment:e,sync:!0}}),p.unshift({id:u.DeleteCommentMutation.id,params:{unitId:a,subUnitId:s,commentId:e.id}})};return o.forEach(e=>{m(e)}),{redos:[...c,...f],undos:[...p,...d]}}}return{redos:[],undos:[]}}}))}};A=x([b(0,(0,t.Inject)(o.ISheetClipboardService)),b(1,(0,t.Inject)(r.SheetsThreadCommentModel)),b(2,u.IThreadCommentDataSourceService)],A);let j=class extends t.Disposable{constructor(e,t,n,r){super(),this._hoverManagerService=e,this._sheetsThreadCommentPopupService=t,this._sheetsThreadCommentModel=n,this._sheetPermissionCheckController=r,this._initHoverEvent()}_initHoverEvent(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe((0,s.debounceTime)(100)).subscribe(e=>{let t=this._sheetsThreadCommentPopupService.activePopup;if(e&&(t&&t.temp||!t)){let{location:r}=e,{unitId:i,subUnitId:a,row:o,col:s}=r,c=this._sheetsThreadCommentModel.getByLocation(i,a,o,s);if(c){if(!this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[n.WorkbookCommentPermission],worksheetTypes:[n.WorksheetViewPermission],rangeTypes:[n.RangeProtectionPermissionViewPoint]},[{startRow:o,startColumn:s,endRow:o,endColumn:s}],i,a))return;let e=this._sheetsThreadCommentModel.getComment(i,a,c);e&&!e.resolved&&this._sheetsThreadCommentPopupService.showPopup({unitId:i,subUnitId:a,row:o,col:s,commentId:c,temp:!0})}else t&&this._sheetsThreadCommentPopupService.hidePopup()}}))}};j=x([b(0,(0,t.Inject)(o.HoverManagerService)),b(1,(0,t.Inject)(S)),b(2,(0,t.Inject)(r.SheetsThreadCommentModel)),b(3,(0,t.Inject)(n.SheetPermissionCheckController))],j);let M=class extends t.Disposable{constructor(e,t,n,r){super(),this._localeService=e,this._commandService=t,this._sheetPermissionCheckController=n,this._sheetsThreadCommentModel=r,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(e=>{let{id:t}=e;if(t===C.id||t===w.id)this._sheetPermissionCheckController.permissionCheckWithoutRange({workbookTypes:[n.WorkbookCommentPermission],worksheetTypes:[n.WorksheetViewPermission]})||this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t(`sheets-thread-comment-ui.permission.commentErr`));else if(t===u.AddCommentCommand.id){let{unitId:t,subUnitId:r,comment:i}=e.params,{row:a,column:o}=(0,l.singleReferenceToGrid)(i.ref);this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[n.WorkbookCommentPermission],worksheetTypes:[n.WorksheetViewPermission],rangeTypes:[n.RangeProtectionPermissionViewPoint]},[{startRow:a,startColumn:o,endRow:a,endColumn:o}],t,r)||this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t(`sheets-thread-comment-ui.permission.commentErr`))}else if(t===u.UpdateCommentCommand.id){let{unitId:t,subUnitId:r,payload:i}=e.params,{commentId:a}=i,o=this._sheetsThreadCommentModel.getComment(t,r,a);if(o){let{row:e,column:i}=(0,l.singleReferenceToGrid)(o.ref);this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[n.WorkbookCommentPermission],worksheetTypes:[n.WorksheetViewPermission],rangeTypes:[n.RangeProtectionPermissionViewPoint]},[{startRow:e,startColumn:i,endRow:e,endColumn:i}],t,r)||this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t(`sheets-thread-comment-ui.permission.commentErr`))}}else if(t===u.ResolveCommentCommand.id||t===u.DeleteCommentCommand.id||t===u.DeleteCommentTreeCommand.id){let{unitId:t,subUnitId:r,commentId:i}=e.params,a=this._sheetsThreadCommentModel.getComment(t,r,i);if(a){let{row:e,column:i}=(0,l.singleReferenceToGrid)(a.ref);this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[n.WorkbookCommentPermission],worksheetTypes:[n.WorksheetViewPermission],rangeTypes:[n.RangeProtectionPermissionViewPoint]},[{startRow:e,startColumn:i,endRow:e,endColumn:i}],t,r)||this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t(`sheets-thread-comment-ui.permission.commentErr`))}}}))}};M=x([b(0,(0,t.Inject)(t.LocaleService)),b(1,t.ICommandService),b(2,(0,t.Inject)(n.SheetPermissionCheckController)),b(3,(0,t.Inject)(r.SheetsThreadCommentModel))],M);let N=class extends t.Disposable{constructor(e,t,n,r,i,a,o,s,c,l){super(),this._commandService=e,this._sheetsThreadCommentPopupService=t,this._sheetsThreadCommentModel=n,this._threadCommentPanelService=r,this._univerInstanceService=i,this._sheetPermissionCheckController=a,this._markSelectionService=o,this._sheetSelectionService=s,this._editorBridgeService=c,this._renderManagerService=l,y(this,`_isSwitchToCommenting`,!1),y(this,`_selectionShapeInfo`,null),this._initCommandListener(),this._initPanelListener(),this._initMarkSelection(),this._initSelectionUpdateListener(),this._initEditorBridge()}_handleSelectionChange(e,n,r){var a,s,c;let l=(a=e[0])==null?void 0:a.range,u=this._renderManagerService.getRenderById(n),d=u==null||(s=u.with(o.SheetSkeletonManagerService).getSkeletonParam(r))==null?void 0:s.skeleton;if(!d||!l)return;let f=d.getCellWithCoordByIndex(l.startRow,l.startColumn);if((((c=l.rangeType)==null?t.RANGE_TYPE.NORMAL:c)!==t.RANGE_TYPE.NORMAL||l.endColumn-l.startColumn>0||l.endRow-l.startRow>0)&&!((f.isMerged||f.isMergedMainCell)&&t.Rectangle.equals(f.mergeInfo,l))){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(i.SetActiveCommentOperation.id);return}let p=f.actualRow,m=f.actualColumn;if(!this._sheetsThreadCommentModel.showCommentMarker(n,r,p,m)){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(i.SetActiveCommentOperation.id);return}let h=this._sheetsThreadCommentModel.getByLocation(n,r,p,m);h&&this._commandService.executeCommand(i.SetActiveCommentOperation.id,{unitId:n,subUnitId:r,commentId:h})}_initSelectionUpdateListener(){this.disposeWithMe(this._sheetSelectionService.selectionMoveEnd$.subscribe(e=>{if(this._isSwitchToCommenting)return;let t=this._sheetSelectionService.currentSelectionParam;t&&this._handleSelectionChange(e,t.unitId,t.sheetId)}))}_initEditorBridge(){this.disposeWithMe(this._editorBridgeService.visible$.subscribe(e=>{e.visible&&this._sheetsThreadCommentPopupService.hidePopup()}))}_initCommandListener(){this._commandService.onCommandExecuted(e=>{if(e.id===u.DeleteCommentMutation.id){let t=e.params,n=this._sheetsThreadCommentPopupService.activePopup;if(!n)return;let{unitId:r,subUnitId:i,commentId:a}=n;t.unitId===r&&t.subUnitId===i&&t.commentId===a&&this._sheetsThreadCommentPopupService.hidePopup()}})}_initPanelListener(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(async e=>{if(e){var r;let{unitId:i,subUnitId:a,commentId:s,trigger:c}=e,u=this._sheetsThreadCommentModel.getComment(i,a,s);if(!u||u.resolved)return;let d=this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET);if(!d||d.getUnitId()!==i)return;this._isSwitchToCommenting=!0,((r=d.getActiveSheet())==null?void 0:r.getSheetId())!==a&&await this._commandService.executeCommand(n.SetWorksheetActiveOperation.id,{unitId:i,subUnitId:a}),this._isSwitchToCommenting=!1;let f=(0,l.singleReferenceToGrid)(u.ref),{row:p,column:m}=f;if(!this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[n.WorkbookCommentPermission],worksheetTypes:[n.WorksheetViewPermission],rangeTypes:[n.RangeProtectionPermissionViewPoint]},[{startRow:p,startColumn:m,endRow:p,endColumn:m}],i,a)||(await this._commandService.executeCommand(o.ScrollToRangeOperation.id,{range:{startRow:Math.max(f.row-1,0),endRow:f.row+1,startColumn:Math.max(f.column-1,0),endColumn:f.column+1}}),this._editorBridgeService.isVisible().visible))return;this._sheetsThreadCommentPopupService.showPopup({unitId:i,subUnitId:a,row:f.row,col:f.column,commentId:u.id,trigger:c})}else this._sheetsThreadCommentPopupService.hidePopup()}))}_initMarkSelection(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe((0,s.debounceTime)(100)).subscribe(e=>{var n,r;if(!e){this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);return}let{unitId:i,subUnitId:a,commentId:o}=e;this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);let s=this._sheetsThreadCommentModel.getComment(i,a,o);if(!s)return;let{row:c,column:u}=(0,l.singleReferenceToGrid)(s.ref);if(Number.isNaN(c)||Number.isNaN(u))return null;let d=(n=this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET))==null?void 0:n.getSheetBySheetId(a),f=(r=d==null?void 0:d.getMergedCell(c,u))==null?{startColumn:u,endColumn:u,startRow:c,endRow:c}:r,p=this._markSelectionService.addShape({range:f,style:{fill:`rgba(255, 189, 55, 0.35)`,strokeWidth:1,stroke:`#FFBD37`,widgets:{}},primary:null},[],-1);p&&(this._selectionShapeInfo={...e,shapeId:p})}))}};N=x([b(0,t.ICommandService),b(1,(0,t.Inject)(S)),b(2,(0,t.Inject)(r.SheetsThreadCommentModel)),b(3,(0,t.Inject)(i.ThreadCommentPanelService)),b(4,t.IUniverInstanceService),b(5,(0,t.Inject)(n.SheetPermissionCheckController)),b(6,o.IMarkSelectionService),b(7,(0,t.Inject)(n.SheetsSelectionsService)),b(8,o.IEditorBridgeService),b(9,c.IRenderManagerService)],N);function P({ref:e,...t}){let{icon:n,id:r,className:i,extend:a,...o}=t,s=`univerjs-icon univerjs-icon-${r} ${i||``}`.trim(),c=(0,d.useRef)(`_${R()}`);return F(n,`${r}`,{defIds:n.defIds,idSuffix:c.current},{ref:e,className:s,...o},a)}function F(e,t,n,r,i){return(0,d.createElement)(e.tag,{key:t,...I(e,n,i),...r},(L(e,n).children||[]).map((r,a)=>F(r,`${t}-${e.tag}-${a}`,n,void 0,i)))}function I(e,t,n){let r={...e.attrs};n!=null&&n.colorChannel1&&r.fill===`colorChannel1`&&(r.fill=n.colorChannel1),e.tag===`mask`&&r.id&&(r.id+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{e===`mask`&&typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))});let{defIds:i}=t;return!i||i.length===0?r:(e.tag===`use`&&r[`xlink:href`]&&(r[`xlink:href`]+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))}),r)}function L(e,t){var n;let{defIds:r}=t;return!r||r.length===0?e:e.tag===`defs`&&(n=e.children)!=null&&n.length?{...e,children:e.children.map(e=>typeof e.attrs.id==`string`&&r&&r.includes(e.attrs.id)?{...e,attrs:{...e.attrs,id:e.attrs.id+t.idSuffix}}:e)}:e}function R(){return Math.random().toString(36).substring(2,8)}P.displayName=`UniverIcon`;let z={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,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.13521C5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M8.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.78345Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M11.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`}},{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`}}]},B=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(P,Object.assign({},e,{id:`comment-icon`,ref:t,icon:z}))});B.displayName=`CommentIcon`;let V=e=>({id:C.id,type:a.MenuItemType.BUTTON,icon:`CommentIcon`,title:`sheets-thread-comment-ui.menu.addComment`,hidden$:(0,a.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_SHEET),disabled$:(0,o.getCurrentRangeDisable$)(e,{workbookTypes:[n.WorkbookCommentPermission],worksheetTypes:[n.WorksheetViewPermission],rangeTypes:[n.RangeProtectionPermissionViewPoint]})}),H=e=>({id:w.id,type:a.MenuItemType.BUTTON,icon:`CommentIcon`,tooltip:`sheets-thread-comment-ui.menu.commentManagement`,disabled$:(0,o.getCurrentRangeDisable$)(e,{workbookTypes:[n.WorkbookCommentPermission],worksheetTypes:[n.WorksheetViewPermission],rangeTypes:[n.RangeProtectionPermissionViewPoint]}),hidden$:(0,a.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_SHEET)}),U={id:C.id,binding:a.KeyCode.M|a.MetaKeys.CTRL_COMMAND|a.MetaKeys.ALT,preconditions:o.whenSheetEditorFocused},W={[a.RibbonInsertGroup.MEDIA]:{[w.id]:{order:2,menuItemFactory:H}},[a.ContextMenuPosition.MAIN_AREA]:{[a.ContextMenuGroup.OTHERS]:{[C.id]:{order:0,menuItemFactory:V}}}},G=()=>{let e=(0,a.useDependency)(t.IUniverInstanceService),n=(0,a.useDependency)(S),o=(0,a.useObservable)(n.activePopup$),s=(0,a.useDependency)(r.SheetsThreadCommentModel);if((0,a.useObservable)(s.commentUpdate$),!o)return null;let{row:c,col:l,unitId:u,subUnitId:d,trigger:p}=o,m=s.getByLocation(u,d,c,l),h=`${t.Tools.chatAtABC(l)}${c+1}`;return(0,f.jsx)(i.ThreadCommentTree,{onClick:()=>{n.persistPopup()},location:i.ThreadCommentTreeLocation.CELL,id:m,unitId:u,subUnitId:d,type:t.UniverInstanceType.UNIVER_SHEET,refStr:h,onClose:()=>{n.hidePopup()},getSubUnitName:n=>{var r,i;return(r=(i=e.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET))==null||(i=i.getSheetBySheetId(n))==null?void 0:i.getName())==null?``:r},autoFocus:p===`context-menu`})},K=()=>{var e;let n=(0,a.useDependency)(o.IMarkSelectionService),r=(0,a.useDependency)(t.IUniverInstanceService),c=(0,a.useDependency)(S),u=r.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET),p=u.getUnitId(),m=(0,a.useDependency)(t.ICommandService),h=(0,d.useMemo)(()=>u.activeSheet$.pipe((0,s.map)(e=>e==null?void 0:e.getSheetId())),[u.activeSheet$]),g=(0,a.useObservable)(h,(e=u.getActiveSheet())==null?void 0:e.getSheetId()),_=(0,d.useRef)(null),v=(0,a.useDependency)(i.ThreadCommentPanelService),y=(0,a.useObservable)(v.activeCommentId$),b=(0,a.useObservable)(v.panelVisible$,v.panelVisible),x=(0,d.useCallback)(e=>{let t=u.getSheets(),n={};t.forEach((e,t)=>{n[e.getSheetId()]=t});let r=e=>e.map(e=>{var t;let r=(0,l.singleReferenceToGrid)(e.ref),i=[(t=n[e.subUnitId])==null?0:t,r.row,r.column];return{...e,p:i}}).sort((e,t)=>e.p[0]===t.p[0]?e.p[1]===t.p[1]?e.p[2]-t.p[2]:e.p[1]-t.p[1]:e.p[0]-t.p[0]);return[...r(e.filter(e=>!e.resolved)),...r(e.filter(e=>e.resolved))]},[u]),w=(0,d.useCallback)(e=>{if(e.unitId===p&&e.subUnitId===g&&!e.resolved){var t;let{row:r,column:i}=(0,l.singleReferenceToGrid)(e.ref),a=u.getSheetBySheetId(e.subUnitId),o=(t=a==null?void 0:a.getMergedCell(r,i))==null?{startColumn:i,endColumn:i,startRow:r,endRow:r}:t;if(!Number.isNaN(r)&&!Number.isNaN(i))return n.addShape({range:o,style:{fill:`rgb(255, 189, 55, 0.35)`,strokeWidth:1,stroke:`#FFBD37`,widgets:{}},primary:null})}return null},[n,g,p]),T=e=>{var t,n;return(t=(n=u.getSheetBySheetId(e))==null?void 0:n.getName())==null?``:t},E=()=>{m.executeCommand(C.id)},D=e=>{y&&y.unitId===e.unitId&&y.subUnitId===e.subUnitId&&y.commentId===e.id||(_.current&&(n.removeShape(_.current),_.current=null),_.current=w(e))},O=()=>{_.current&&(n.removeShape(_.current),_.current=null)};return(0,d.useEffect)(()=>{!b&&_.current&&n.removeShape(_.current)},[n,b]),(0,f.jsx)(i.ThreadCommentPanel,{unitId:p,subUnitId$:h,type:t.UniverInstanceType.UNIVER_SHEET,onAdd:E,getSubUnitName:T,onResolve:(e,t)=>{t&&c.hidePopup()},sortComments:x,onItemEnter:D,onItemLeave:O,onDeleteComment:()=>(O(),!0)})},q=class extends t.Disposable{constructor(e,t,n){super(),this._menuManagerService=e,this._componentManager=t,this._shortcutService=n,this._initMenu(),this._initShortcut(),this._initComponent()}_initShortcut(){this._shortcutService.registerShortcut(U)}_initMenu(){this._menuManagerService.mergeMenu(W)}_initComponent(){[[p,G],[m,K],[`CommentIcon`,B]].forEach(([e,t])=>{this.disposeWithMe(this._componentManager.register(e,t))})}};q=x([b(0,a.IMenuManagerService),b(1,(0,t.Inject)(a.ComponentManager)),b(2,a.IShortcutService)],q);let J=class extends t.Plugin{constructor(e=D,n,r,i){super(),this._config=e,this._injector=n,this._commandService=r,this._configService=i;let{menu:a,...o}=(0,t.merge)({},D,this._config);a&&this._configService.setConfig(`menu`,a,{merge:!0}),this._configService.setConfig(`sheets-thread-comment.config`,o)}onStarting(){[[q],[O],[A],[j],[N],[S],[M]].forEach(e=>{this._injector.add(e)}),[C,w].forEach(e=>{this._commandService.registerCommand(e)}),this._injector.get(q)}onReady(){this._injector.get(O)}onRendered(){this._injector.get(A),this._injector.get(j),this._injector.get(N),this._injector.get(M)}};y(J,`pluginName`,h),y(J,`packageName`,T),y(J,`version`,E),y(J,`type`,t.UniverInstanceType.UNIVER_SHEET),J=x([(0,t.DependentOn)(i.UniverThreadCommentUIPlugin,r.UniverSheetsThreadCommentPlugin),b(1,(0,t.Inject)(t.Injector)),b(2,(0,t.Inject)(t.ICommandService)),b(3,t.IConfigService)],J),Object.defineProperty(e,"AddCommentCommand",{enumerable:!0,get:function(){return u.AddCommentCommand}}),Object.defineProperty(e,"DeleteCommentCommand",{enumerable:!0,get:function(){return u.DeleteCommentCommand}}),Object.defineProperty(e,"DeleteCommentTreeCommand",{enumerable:!0,get:function(){return u.DeleteCommentTreeCommand}}),Object.defineProperty(e,"IThreadCommentDataSourceService",{enumerable:!0,get:function(){return u.IThreadCommentDataSourceService}}),Object.defineProperty(e,"ResolveCommentCommand",{enumerable:!0,get:function(){return u.ResolveCommentCommand}}),Object.defineProperty(e,"SheetsThreadCommentPopupService",{enumerable:!0,get:function(){return S}}),e.ShowAddSheetCommentModalOperation=C,e.ToggleSheetCommentPanelOperation=w,Object.defineProperty(e,"UniverSheetsThreadCommentUIPlugin",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"UniverThreadCommentUIPlugin",{enumerable:!0,get:function(){return i.UniverThreadCommentUIPlugin}}),Object.defineProperty(e,"UpdateCommentCommand",{enumerable:!0,get:function(){return u.UpdateCommentCommand}})});
18
18
 
19
19
  // index
20
20
  (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/lib/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/lib/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"})}));
@@ -0,0 +1,8 @@
1
+ // @univerjs/thread-comment-ui/locale/ar-SA
2
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiArSA=t())})(this,function(){return{"thread-comment-ui":{panel:{title:`إدارة التعليقات`,empty:`لا توجد تعليقات بعد`,filterEmpty:`لا توجد نتائج مطابقة`,reset:`إعادة ضبط التصفية`,addComment:`إضافة تعليق`,solved:`تم الحل`},editor:{placeholder:`رد أو إشارة إلى آخرين باستخدام @`,reply:`تعليق`,cancel:`إلغاء`,save:`حفظ`},item:{edit:`تحرير`,delete:`حذف هذا التعليق`},filter:{sheet:{all:`كل الأوراق`,current:`الورقة الحالية`},status:{all:`كل التعليقات`,resolved:`تم الحل`,unsolved:`لم يتم الحل`,concernMe:`يتعلق بي`}}}}});
3
+
4
+ // @univerjs/sheets-thread-comment-ui/locale/ar-SA
5
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsThreadCommentUiArSA=t())})(this,function(){return{"sheets-thread-comment-ui":{panel:{title:`إدارة التعليقات`},menu:{addComment:`إضافة تعليق`,commentManagement:`إدارة التعليقات`}}}});
6
+
7
+ // locale/ar-SA
8
+ (function(e,r){typeof exports=="object"&&typeof module<"u"?module.exports=r(require("@univerjs/core"),require("@univerjs/sheets-thread-comment-ui/locale/ar-SA"),require("@univerjs/thread-comment-ui/locale/ar-SA")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-thread-comment-ui/locale/ar-SA","@univerjs/thread-comment-ui/locale/ar-SA"],r):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsThreadCommentArSA=r(e.UniverCore,e.UniverSheetsThreadCommentUiArSA,e.UniverThreadCommentUiArSA))})(this,(function(e,r,n){"use strict";return e.mergeLocales(r,n)}));
@@ -1,8 +1,8 @@
1
1
  // @univerjs/thread-comment-ui/locale/ca-ES
2
- (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiCaES=t())})(this,function(){return{threadCommentUI:{panel:{title:`Gestió de comentaris`,empty:`Encara no hi ha comentaris`,filterEmpty:`Cap resultat coincident`,reset:`Restableix el filtre`,addComment:`Afegeix un comentari`,solved:`Resolut`},editor:{placeholder:`Respon o afegeix altres amb @`,reply:`Comenta`,cancel:`Cancel·la`,save:`Desa`},item:{edit:`Edita`,delete:`Elimina aquest comentari`},filter:{sheet:{all:`Tots els fulls`,current:`Full actual`},status:{all:`Tots els comentaris`,resolved:`Resolts`,unsolved:`No resolts`,concernMe:`Em concerneix`}}}}});
2
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiCaES=t())})(this,function(){return{"thread-comment-ui":{panel:{title:`Gestió de comentaris`,empty:`Encara no hi ha comentaris`,filterEmpty:`Cap resultat coincident`,reset:`Restableix el filtre`,addComment:`Afegeix un comentari`,solved:`Resolut`},editor:{placeholder:`Respon o afegeix altres amb @`,reply:`Comenta`,cancel:`Cancel·la`,save:`Desa`},item:{edit:`Edita`,delete:`Elimina aquest comentari`},filter:{sheet:{all:`Tots els fulls`,current:`Full actual`},status:{all:`Tots els comentaris`,resolved:`Resolts`,unsolved:`No resolts`,concernMe:`Em concerneix`}}}}});
3
3
 
4
4
  // @univerjs/sheets-thread-comment-ui/locale/ca-ES
5
- (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsThreadCommentUiCaES=t())})(this,function(){return{sheetThreadComment:{menu:{addComment:`Afegeix un comentari`,commentManagement:`Gestió de comentaris`}}}});
5
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsThreadCommentUiCaES=t())})(this,function(){return{"sheets-thread-comment-ui":{panel:{title:`Gestió de comentaris`},menu:{addComment:`Afegeix un comentari`,commentManagement:`Gestió de comentaris`}}}});
6
6
 
7
7
  // locale/ca-ES
8
8
  (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n(require("@univerjs/core"),require("@univerjs/sheets-thread-comment-ui/locale/ca-ES"),require("@univerjs/thread-comment-ui/locale/ca-ES")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-thread-comment-ui/locale/ca-ES","@univerjs/thread-comment-ui/locale/ca-ES"],n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsThreadCommentCaES=n(e.UniverCore,e.UniverSheetsThreadCommentUiCaES,e.UniverThreadCommentUiCaES))})(this,(function(e,n,i){"use strict";return e.mergeLocales(n,i)}));
@@ -0,0 +1,8 @@
1
+ // @univerjs/thread-comment-ui/locale/de-DE
2
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiDeDE=t())})(this,function(){return{"thread-comment-ui":{panel:{title:`Kommentarverwaltung`,empty:`Noch keine Kommentare`,filterEmpty:`Kein Treffer`,reset:`Filter zurücksetzen`,addComment:`Kommentar hinzufügen`,solved:`Gelöst`},editor:{placeholder:`Antworten oder andere mit @ erwähnen`,reply:`Kommentar`,cancel:`Abbrechen`,save:`Speichern`},item:{edit:`Bearbeiten`,delete:`Diesen Kommentar löschen`},filter:{sheet:{all:`Alle Blätter`,current:`Aktuelles Blatt`},status:{all:`Alle Kommentare`,resolved:`Gelöst`,unsolved:`Ungelöst`,concernMe:`Betrifft mich`}}}}});
3
+
4
+ // @univerjs/sheets-thread-comment-ui/locale/de-DE
5
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsThreadCommentUiDeDE=t())})(this,function(){return{"sheets-thread-comment-ui":{panel:{title:`Kommentarverwaltung`},menu:{addComment:`Kommentar hinzufügen`,commentManagement:`Kommentarverwaltung`}}}});
6
+
7
+ // locale/de-DE
8
+ (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n(require("@univerjs/core"),require("@univerjs/sheets-thread-comment-ui/locale/de-DE"),require("@univerjs/thread-comment-ui/locale/de-DE")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-thread-comment-ui/locale/de-DE","@univerjs/thread-comment-ui/locale/de-DE"],n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsThreadCommentDeDE=n(e.UniverCore,e.UniverSheetsThreadCommentUiDeDE,e.UniverThreadCommentUiDeDE))})(this,(function(e,n,i){"use strict";return e.mergeLocales(n,i)}));
@@ -1,8 +1,8 @@
1
1
  // @univerjs/thread-comment-ui/locale/en-US
2
- (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiEnUS=t())})(this,function(){return{threadCommentUI:{panel:{title:`Comment Management`,empty:`No comments yet`,filterEmpty:`No match result`,reset:`Reset Filter`,addComment:`Add Comment`,solved:`Solved`},editor:{placeholder:`Reply or add others with @`,reply:`Comment`,cancel:`Cancel`,save:`Save`},item:{edit:`Edit`,delete:`Delete This Comment`},filter:{sheet:{all:`All sheet`,current:`Current sheet`},status:{all:`All comments`,resolved:`Resolved`,unsolved:`Not resolved`,concernMe:`Concern me`}}}}});
2
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiEnUS=t())})(this,function(){return{"thread-comment-ui":{panel:{title:`Comment Management`,empty:`No comments yet`,filterEmpty:`No match result`,reset:`Reset Filter`,addComment:`Add Comment`,solved:`Solved`},editor:{placeholder:`Reply or add others with @`,reply:`Comment`,cancel:`Cancel`,save:`Save`},item:{edit:`Edit`,delete:`Delete This Comment`},filter:{sheet:{all:`All sheet`,current:`Current sheet`},status:{all:`All comments`,resolved:`Resolved`,unsolved:`Not resolved`,concernMe:`Concern me`}}}}});
3
3
 
4
4
  // @univerjs/sheets-thread-comment-ui/locale/en-US
5
- (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsThreadCommentUiEnUS=t())})(this,function(){return{sheetThreadComment:{menu:{addComment:`Add Comment`,commentManagement:`Comment Management`}}}});
5
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsThreadCommentUiEnUS=t())})(this,function(){return{"sheets-thread-comment-ui":{panel:{title:`Comment Management`},menu:{addComment:`Add Comment`,commentManagement:`Comment Management`}}}});
6
6
 
7
7
  // locale/en-US
8
8
  (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n(require("@univerjs/core"),require("@univerjs/sheets-thread-comment-ui/locale/en-US"),require("@univerjs/thread-comment-ui/locale/en-US")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-thread-comment-ui/locale/en-US","@univerjs/thread-comment-ui/locale/en-US"],n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsThreadCommentEnUS=n(e.UniverCore,e.UniverSheetsThreadCommentUiEnUS,e.UniverThreadCommentUiEnUS))})(this,(function(e,n,i){"use strict";return e.mergeLocales(n,i)}));
@@ -1,8 +1,8 @@
1
1
  // @univerjs/thread-comment-ui/locale/es-ES
2
- (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiEsES=t())})(this,function(){return{threadCommentUI:{panel:{title:`Gestión de comentarios`,empty:`Aún no hay comentarios`,filterEmpty:`Sin resultados coincidentes`,reset:`Restablecer filtro`,addComment:`Añadir comentario`,solved:`Resuelto`},editor:{placeholder:`Responde o añade a otros con @`,reply:`Comentar`,cancel:`Cancelar`,save:`Guardar`},item:{edit:`Editar`,delete:`Eliminar este comentario`},filter:{sheet:{all:`Todas las hojas`,current:`Hoja actual`},status:{all:`Todos los comentarios`,resolved:`Resueltos`,unsolved:`No resueltos`,concernMe:`Me concierne`}}}}});
2
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiEsES=t())})(this,function(){return{"thread-comment-ui":{panel:{title:`Gestión de comentarios`,empty:`Aún no hay comentarios`,filterEmpty:`Sin resultados coincidentes`,reset:`Restablecer filtro`,addComment:`Añadir comentario`,solved:`Resuelto`},editor:{placeholder:`Responde o añade a otros con @`,reply:`Comentar`,cancel:`Cancelar`,save:`Guardar`},item:{edit:`Editar`,delete:`Eliminar este comentario`},filter:{sheet:{all:`Todas las hojas`,current:`Hoja actual`},status:{all:`Todos los comentarios`,resolved:`Resueltos`,unsolved:`No resueltos`,concernMe:`Me concierne`}}}}});
3
3
 
4
4
  // @univerjs/sheets-thread-comment-ui/locale/es-ES
5
- (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsThreadCommentUiEsES=t())})(this,function(){return{sheetThreadComment:{menu:{addComment:`Añadir comentario`,commentManagement:`Gestión de comentarios`}}}});
5
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsThreadCommentUiEsES=t())})(this,function(){return{"sheets-thread-comment-ui":{panel:{title:`Gestión de comentarios`},menu:{addComment:`Añadir comentario`,commentManagement:`Gestión de comentarios`}}}});
6
6
 
7
7
  // locale/es-ES
8
8
  (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n(require("@univerjs/core"),require("@univerjs/sheets-thread-comment-ui/locale/es-ES"),require("@univerjs/thread-comment-ui/locale/es-ES")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-thread-comment-ui/locale/es-ES","@univerjs/thread-comment-ui/locale/es-ES"],n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsThreadCommentEsES=n(e.UniverCore,e.UniverSheetsThreadCommentUiEsES,e.UniverThreadCommentUiEsES))})(this,(function(e,n,s){"use strict";return e.mergeLocales(n,s)}));
@@ -1,8 +1,8 @@
1
1
  // @univerjs/thread-comment-ui/locale/fa-IR
2
- (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiFaIR=t())})(this,function(){return{threadCommentUI:{panel:{title:`مدیریت نظرات`,empty:`هنوز نظری وجود ندارد`,filterEmpty:`نتیجه ای یافت نشد`,reset:`بازنشانی فیلتر`,addComment:`افزودن نظر`,solved:`حل شده`},editor:{placeholder:`پاسخ یا اضافه کردن دیگران با @`,reply:`نظر`,cancel:`انصراف`,save:`ذخیره`},item:{edit:`ویرایش`,delete:`حذف این نظر`},filter:{sheet:{all:`همه برگه‌ها`,current:`برگه فعلی`},status:{all:`همه نظرات`,resolved:`حل شده`,unsolved:`حل نشده`,concernMe:`موضوع مربوط به من`}}}}});
2
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiFaIR=t())})(this,function(){return{"thread-comment-ui":{panel:{title:`مدیریت نظرات`,empty:`هنوز نظری وجود ندارد`,filterEmpty:`نتیجه ای یافت نشد`,reset:`بازنشانی فیلتر`,addComment:`افزودن نظر`,solved:`حل شده`},editor:{placeholder:`پاسخ یا اضافه کردن دیگران با @`,reply:`نظر`,cancel:`انصراف`,save:`ذخیره`},item:{edit:`ویرایش`,delete:`حذف این نظر`},filter:{sheet:{all:`همه برگه‌ها`,current:`برگه فعلی`},status:{all:`همه نظرات`,resolved:`حل شده`,unsolved:`حل نشده`,concernMe:`موضوع مربوط به من`}}}}});
3
3
 
4
4
  // @univerjs/sheets-thread-comment-ui/locale/fa-IR
5
- (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsThreadCommentUiFaIR=t())})(this,function(){return{sheetThreadComment:{menu:{addComment:`افزودن نظر`,commentManagement:`مدیریت نظر`}}}});
5
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsThreadCommentUiFaIR=t())})(this,function(){return{"sheets-thread-comment-ui":{panel:{title:`مدیریت نظر`},menu:{addComment:`افزودن نظر`,commentManagement:`مدیریت نظر`}}}});
6
6
 
7
7
  // locale/fa-IR
8
8
  (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n(require("@univerjs/core"),require("@univerjs/sheets-thread-comment-ui/locale/fa-IR"),require("@univerjs/thread-comment-ui/locale/fa-IR")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-thread-comment-ui/locale/fa-IR","@univerjs/thread-comment-ui/locale/fa-IR"],n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsThreadCommentFaIR=n(e.UniverCore,e.UniverSheetsThreadCommentUiFaIR,e.UniverThreadCommentUiFaIR))})(this,(function(e,n,i){"use strict";return e.mergeLocales(n,i)}));
@@ -1,8 +1,8 @@
1
1
  // @univerjs/thread-comment-ui/locale/fr-FR
2
- (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiFrFR=t())})(this,function(){return{threadCommentUI:{panel:{title:`Gestion des commentaires`,empty:`Pas encore de commentaires`,filterEmpty:`Aucun résultat correspondant`,reset:`Réinitialiser le filtre`,addComment:`Ajouter un commentaire`,solved:`Résolu`},editor:{placeholder:`Répondre ou ajouter d'autres avec @`,reply:`Commenter`,cancel:`Annuler`,save:`Enregistrer`},item:{edit:`Modifier`,delete:`Supprimer ce commentaire`},filter:{sheet:{all:`Toutes les feuilles`,current:`Feuille actuelle`},status:{all:`Tous les commentaires`,resolved:`Résolu`,unsolved:`Non résolu`,concernMe:`Me concerne`}}}}});
2
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiFrFR=t())})(this,function(){return{"thread-comment-ui":{panel:{title:`Gestion des commentaires`,empty:`Pas encore de commentaires`,filterEmpty:`Aucun résultat correspondant`,reset:`Réinitialiser le filtre`,addComment:`Ajouter un commentaire`,solved:`Résolu`},editor:{placeholder:`Répondre ou ajouter d'autres avec @`,reply:`Commenter`,cancel:`Annuler`,save:`Enregistrer`},item:{edit:`Modifier`,delete:`Supprimer ce commentaire`},filter:{sheet:{all:`Toutes les feuilles`,current:`Feuille actuelle`},status:{all:`Tous les commentaires`,resolved:`Résolu`,unsolved:`Non résolu`,concernMe:`Me concerne`}}}}});
3
3
 
4
4
  // @univerjs/sheets-thread-comment-ui/locale/fr-FR
5
- (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsThreadCommentUiFrFR=t())})(this,function(){return{sheetThreadComment:{menu:{addComment:`Ajouter un commentaire`,commentManagement:`Gestion des commentaires`}}}});
5
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsThreadCommentUiFrFR=t())})(this,function(){return{"sheets-thread-comment-ui":{panel:{title:`Gestion des commentaires`},menu:{addComment:`Ajouter un commentaire`,commentManagement:`Gestion des commentaires`}}}});
6
6
 
7
7
  // locale/fr-FR
8
8
  (function(e,r){typeof exports=="object"&&typeof module<"u"?module.exports=r(require("@univerjs/core"),require("@univerjs/sheets-thread-comment-ui/locale/fr-FR"),require("@univerjs/thread-comment-ui/locale/fr-FR")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-thread-comment-ui/locale/fr-FR","@univerjs/thread-comment-ui/locale/fr-FR"],r):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsThreadCommentFrFR=r(e.UniverCore,e.UniverSheetsThreadCommentUiFrFR,e.UniverThreadCommentUiFrFR))})(this,(function(e,r,n){"use strict";return e.mergeLocales(r,n)}));
@@ -0,0 +1,8 @@
1
+ // @univerjs/thread-comment-ui/locale/id-ID
2
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiIdID=t())})(this,function(){return{"thread-comment-ui":{panel:{title:`Manajemen Komentar`,empty:`Belum ada komentar`,filterEmpty:`Tidak ada hasil yang cocok`,reset:`Atur Ulang Filter`,addComment:`Tambah Komentar`,solved:`Terselesaikan`},editor:{placeholder:`Balas atau tambahkan orang lain dengan @`,reply:`Komentar`,cancel:`Batal`,save:`Simpan`},item:{edit:`Edit`,delete:`Hapus Komentar Ini`},filter:{sheet:{all:`Semua lembar`,current:`Lembar saat ini`},status:{all:`Semua komentar`,resolved:`Terselesaikan`,unsolved:`Belum terselesaikan`,concernMe:`Yang menyangkut saya`}}}}});
3
+
4
+ // @univerjs/sheets-thread-comment-ui/locale/id-ID
5
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsThreadCommentUiIdID=t())})(this,function(){return{"sheets-thread-comment-ui":{panel:{title:`Manajemen Komentar`},menu:{addComment:`Tambah Komentar`,commentManagement:`Manajemen Komentar`}}}});
6
+
7
+ // locale/id-ID
8
+ (function(e,i){typeof exports=="object"&&typeof module<"u"?module.exports=i(require("@univerjs/core"),require("@univerjs/sheets-thread-comment-ui/locale/id-ID"),require("@univerjs/thread-comment-ui/locale/id-ID")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-thread-comment-ui/locale/id-ID","@univerjs/thread-comment-ui/locale/id-ID"],i):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsThreadCommentIdID=i(e.UniverCore,e.UniverSheetsThreadCommentUiIdID,e.UniverThreadCommentUiIdID))})(this,(function(e,i,n){"use strict";return e.mergeLocales(i,n)}));
@@ -0,0 +1,8 @@
1
+ // @univerjs/thread-comment-ui/locale/it-IT
2
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiItIT=t())})(this,function(){return{"thread-comment-ui":{panel:{title:`Gestione commenti`,empty:`Nessun commento`,filterEmpty:`Nessun risultato`,reset:`Reimposta filtro`,addComment:`Aggiungi commento`,solved:`Risolto`},editor:{placeholder:`Rispondi o aggiungi altri con @`,reply:`Commenta`,cancel:`Annulla`,save:`Salva`},item:{edit:`Modifica`,delete:`Elimina questo commento`},filter:{sheet:{all:`Tutti i fogli`,current:`Foglio corrente`},status:{all:`Tutti i commenti`,resolved:`Risolti`,unsolved:`Non risolti`,concernMe:`Mi riguardano`}}}}});
3
+
4
+ // @univerjs/sheets-thread-comment-ui/locale/it-IT
5
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsThreadCommentUiItIT=t())})(this,function(){return{"sheets-thread-comment-ui":{panel:{title:`Gestione commenti`},menu:{addComment:`Aggiungi commento`,commentManagement:`Gestione commenti`}}}});
6
+
7
+ // locale/it-IT
8
+ (function(e,t){typeof exports=="object"&&typeof module<"u"?module.exports=t(require("@univerjs/core"),require("@univerjs/sheets-thread-comment-ui/locale/it-IT"),require("@univerjs/thread-comment-ui/locale/it-IT")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-thread-comment-ui/locale/it-IT","@univerjs/thread-comment-ui/locale/it-IT"],t):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsThreadCommentItIT=t(e.UniverCore,e.UniverSheetsThreadCommentUiItIT,e.UniverThreadCommentUiItIT))})(this,(function(e,t,i){"use strict";return e.mergeLocales(t,i)}));
@@ -1,8 +1,8 @@
1
1
  // @univerjs/thread-comment-ui/locale/ja-JP
2
- (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiJaJP=t())})(this,function(){return{threadCommentUI:{panel:{title:`コメント管理`,empty:`まだコメントはありません`,filterEmpty:`一致する結果がありません`,reset:`フィルタをリセット`,addComment:`コメントを追加`,solved:`解決済み`},editor:{placeholder:`返信または@で他のユーザーを追加`,reply:`返信`,cancel:`キャンセル`,save:`保存`},item:{edit:`編集`,delete:`コメントを削除`},filter:{sheet:{all:`すべてのシート`,current:`現在のシート`},status:{all:`すべてのコメント`,resolved:`解決済み`,unsolved:`未解決`,concernMe:`自分に関連`}}}}});
2
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiJaJP=t())})(this,function(){return{"thread-comment-ui":{panel:{title:`コメント管理`,empty:`まだコメントはありません`,filterEmpty:`一致する結果がありません`,reset:`フィルタをリセット`,addComment:`コメントを追加`,solved:`解決済み`},editor:{placeholder:`返信または@で他のユーザーを追加`,reply:`返信`,cancel:`キャンセル`,save:`保存`},item:{edit:`編集`,delete:`コメントを削除`},filter:{sheet:{all:`すべてのシート`,current:`現在のシート`},status:{all:`すべてのコメント`,resolved:`解決済み`,unsolved:`未解決`,concernMe:`自分に関連`}}}}});
3
3
 
4
4
  // @univerjs/sheets-thread-comment-ui/locale/ja-JP
5
- (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsThreadCommentUiJaJP=t())})(this,function(){return{sheetThreadComment:{menu:{addComment:`コメントを追加`,commentManagement:`コメント管理`}}}});
5
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsThreadCommentUiJaJP=t())})(this,function(){return{"sheets-thread-comment-ui":{panel:{title:`コメント管理`},menu:{addComment:`コメントを追加`,commentManagement:`コメント管理`}}}});
6
6
 
7
7
  // locale/ja-JP
8
8
  (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n(require("@univerjs/core"),require("@univerjs/sheets-thread-comment-ui/locale/ja-JP"),require("@univerjs/thread-comment-ui/locale/ja-JP")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-thread-comment-ui/locale/ja-JP","@univerjs/thread-comment-ui/locale/ja-JP"],n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsThreadCommentJaJP=n(e.UniverCore,e.UniverSheetsThreadCommentUiJaJP,e.UniverThreadCommentUiJaJP))})(this,(function(e,n,i){"use strict";return e.mergeLocales(n,i)}));
@@ -1,8 +1,8 @@
1
1
  // @univerjs/thread-comment-ui/locale/ko-KR
2
- (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiKoKR=t())})(this,function(){return{threadCommentUI:{panel:{title:`댓글 관리`,empty:`아직 댓글이 없습니다`,filterEmpty:`일치하는 결과가 없습니다`,reset:`필터 초기화`,addComment:`댓글 추가`,solved:`해결됨`},editor:{placeholder:`답변 또는 @로 다른 사람 추가`,reply:`댓글`,cancel:`취소`,save:`저장`},item:{edit:`편집`,delete:`댓글 삭제`},filter:{sheet:{all:`모든 시트`,current:`현재 시트`},status:{all:`모든 댓글`,resolved:`해결됨`,unsolved:`해결되지 않음`,concernMe:`나에게 관련됨`}}}}});
2
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiKoKR=t())})(this,function(){return{"thread-comment-ui":{panel:{title:`댓글 관리`,empty:`아직 댓글이 없습니다`,filterEmpty:`일치하는 결과가 없습니다`,reset:`필터 초기화`,addComment:`댓글 추가`,solved:`해결됨`},editor:{placeholder:`답변 또는 @로 다른 사람 추가`,reply:`댓글`,cancel:`취소`,save:`저장`},item:{edit:`편집`,delete:`댓글 삭제`},filter:{sheet:{all:`모든 시트`,current:`현재 시트`},status:{all:`모든 댓글`,resolved:`해결됨`,unsolved:`해결되지 않음`,concernMe:`나에게 관련됨`}}}}});
3
3
 
4
4
  // @univerjs/sheets-thread-comment-ui/locale/ko-KR
5
- (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsThreadCommentUiKoKR=t())})(this,function(){return{sheetThreadComment:{menu:{addComment:`댓글 추가`,commentManagement:`댓글 관리`}}}});
5
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsThreadCommentUiKoKR=t())})(this,function(){return{"sheets-thread-comment-ui":{panel:{title:`댓글 관리`},menu:{addComment:`댓글 추가`,commentManagement:`댓글 관리`}}}});
6
6
 
7
7
  // locale/ko-KR
8
8
  (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n(require("@univerjs/core"),require("@univerjs/sheets-thread-comment-ui/locale/ko-KR"),require("@univerjs/thread-comment-ui/locale/ko-KR")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-thread-comment-ui/locale/ko-KR","@univerjs/thread-comment-ui/locale/ko-KR"],n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsThreadCommentKoKR=n(e.UniverCore,e.UniverSheetsThreadCommentUiKoKR,e.UniverThreadCommentUiKoKR))})(this,(function(e,n,o){"use strict";return e.mergeLocales(n,o)}));
@@ -0,0 +1,8 @@
1
+ // @univerjs/thread-comment-ui/locale/pl-PL
2
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiPlPL=t())})(this,function(){return{"thread-comment-ui":{panel:{title:`Zarządzanie komentarzami`,empty:`Brak komentarzy`,filterEmpty:`Brak wyników`,reset:`Resetuj filtr`,addComment:`Dodaj komentarz`,solved:`Rozwiązane`},editor:{placeholder:`Odpowiedz lub dodaj innych za pomocą @`,reply:`Komentarz`,cancel:`Anuluj`,save:`Zapisz`},item:{edit:`Edytuj`,delete:`Usuń ten komentarz`},filter:{sheet:{all:`Wszystkie arkusze`,current:`Bieżący arkusz`},status:{all:`Wszystkie komentarze`,resolved:`Rozwiązane`,unsolved:`Nierozwiązane`,concernMe:`Dotyczące mnie`}}}}});
3
+
4
+ // @univerjs/sheets-thread-comment-ui/locale/pl-PL
5
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsThreadCommentUiPlPL=t())})(this,function(){return{"sheets-thread-comment-ui":{panel:{title:`Zarządzanie komentarzami`},menu:{addComment:`Dodaj komentarz`,commentManagement:`Zarządzanie komentarzami`}}}});
6
+
7
+ // locale/pl-PL
8
+ (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n(require("@univerjs/core"),require("@univerjs/sheets-thread-comment-ui/locale/pl-PL"),require("@univerjs/thread-comment-ui/locale/pl-PL")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-thread-comment-ui/locale/pl-PL","@univerjs/thread-comment-ui/locale/pl-PL"],n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsThreadCommentPlPL=n(e.UniverCore,e.UniverSheetsThreadCommentUiPlPL,e.UniverThreadCommentUiPlPL))})(this,(function(e,n,i){"use strict";return e.mergeLocales(n,i)}));
@@ -0,0 +1,8 @@
1
+ // @univerjs/thread-comment-ui/locale/pt-BR
2
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiPtBR=t())})(this,function(){return{"thread-comment-ui":{panel:{title:`Gerenciamento de Comentários`,empty:`Nenhum comentário ainda`,filterEmpty:`Nenhum resultado correspondente`,reset:`Redefinir Filtro`,addComment:`Adicionar Comentário`,solved:`Resolvido`},editor:{placeholder:`Responder ou mencionar outros com @`,reply:`Comentar`,cancel:`Cancelar`,save:`Salvar`},item:{edit:`Editar`,delete:`Excluir Este Comentário`},filter:{sheet:{all:`Todas as planilhas`,current:`Planilha atual`},status:{all:`Todos os comentários`,resolved:`Resolvidos`,unsolved:`Não resolvidos`,concernMe:`Me envolvem`}}}}});
3
+
4
+ // @univerjs/sheets-thread-comment-ui/locale/pt-BR
5
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsThreadCommentUiPtBR=t())})(this,function(){return{"sheets-thread-comment-ui":{panel:{title:`Gerenciamento de Comentários`},menu:{addComment:`Adicionar Comentário`,commentManagement:`Gerenciamento de Comentários`}}}});
6
+
7
+ // locale/pt-BR
8
+ (function(e,t){typeof exports=="object"&&typeof module<"u"?module.exports=t(require("@univerjs/core"),require("@univerjs/sheets-thread-comment-ui/locale/pt-BR"),require("@univerjs/thread-comment-ui/locale/pt-BR")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-thread-comment-ui/locale/pt-BR","@univerjs/thread-comment-ui/locale/pt-BR"],t):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsThreadCommentPtBR=t(e.UniverCore,e.UniverSheetsThreadCommentUiPtBR,e.UniverThreadCommentUiPtBR))})(this,(function(e,t,n){"use strict";return e.mergeLocales(t,n)}));
@@ -1,8 +1,8 @@
1
1
  // @univerjs/thread-comment-ui/locale/ru-RU
2
- (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiRuRU=t())})(this,function(){return{threadCommentUI:{panel:{title:`Управление комментариями`,empty:`Комментариев пока нет`,filterEmpty:`Нет совпадений`,reset:`Сбросить фильтр`,addComment:`Добавить комментарий`,solved:`Решено`},editor:{placeholder:`Отметьте пользователей через @`,reply:`Добавить комментарий`,cancel:`Отмена`,save:`Сохранить`},item:{edit:`Редактировать`,delete:`Удалить`},filter:{sheet:{all:`Все листы`,current:`Текущий лист`},status:{all:`Все комментарии`,resolved:`Решено`,unsolved:`Не решено`,concernMe:`Относящиеся ко мне`}}}}});
2
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiRuRU=t())})(this,function(){return{"thread-comment-ui":{panel:{title:`Управление комментариями`,empty:`Комментариев пока нет`,filterEmpty:`Нет совпадений`,reset:`Сбросить фильтр`,addComment:`Добавить комментарий`,solved:`Решено`},editor:{placeholder:`Отметьте пользователей через @`,reply:`Добавить комментарий`,cancel:`Отмена`,save:`Сохранить`},item:{edit:`Редактировать`,delete:`Удалить`},filter:{sheet:{all:`Все листы`,current:`Текущий лист`},status:{all:`Все комментарии`,resolved:`Решено`,unsolved:`Не решено`,concernMe:`Относящиеся ко мне`}}}}});
3
3
 
4
4
  // @univerjs/sheets-thread-comment-ui/locale/ru-RU
5
- (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsThreadCommentUiRuRU=t())})(this,function(){return{sheetThreadComment:{menu:{addComment:`Добавить комментарий`,commentManagement:`Управление комментариями`}}}});
5
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsThreadCommentUiRuRU=t())})(this,function(){return{"sheets-thread-comment-ui":{panel:{title:`Управление комментариями`},menu:{addComment:`Добавить комментарий`,commentManagement:`Управление комментариями`}}}});
6
6
 
7
7
  // locale/ru-RU
8
8
  (function(e,r){typeof exports=="object"&&typeof module<"u"?module.exports=r(require("@univerjs/core"),require("@univerjs/sheets-thread-comment-ui/locale/ru-RU"),require("@univerjs/thread-comment-ui/locale/ru-RU")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-thread-comment-ui/locale/ru-RU","@univerjs/thread-comment-ui/locale/ru-RU"],r):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsThreadCommentRuRU=r(e.UniverCore,e.UniverSheetsThreadCommentUiRuRU,e.UniverThreadCommentUiRuRU))})(this,(function(e,r,n){"use strict";return e.mergeLocales(r,n)}));
@@ -1,8 +1,8 @@
1
1
  // @univerjs/thread-comment-ui/locale/sk-SK
2
- (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiSkSK=t())})(this,function(){return{threadCommentUI:{panel:{title:`Správa komentárov`,empty:`Zatiaľ žiadne komentáre`,filterEmpty:`Žiadne zodpovedajúce výsledky`,reset:`Obnoviť filter`,addComment:`Pridať komentár`,solved:`Vyriešené`},editor:{placeholder:`Odpovedzte alebo pridajte ostatných pomocou @`,reply:`Komentovať`,cancel:`Zrušiť`,save:`Uložiť`},item:{edit:`Upraviť`,delete:`Odstrániť tento komentár`},filter:{sheet:{all:`Všetky hárky`,current:`Aktuálny hárok`},status:{all:`Všetky komentáre`,resolved:`Vyriešené`,unsolved:`Nevyriešené`,concernMe:`Týka sa ma`}}}}});
2
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiSkSK=t())})(this,function(){return{"thread-comment-ui":{panel:{title:`Správa komentárov`,empty:`Zatiaľ žiadne komentáre`,filterEmpty:`Žiadne zodpovedajúce výsledky`,reset:`Obnoviť filter`,addComment:`Pridať komentár`,solved:`Vyriešené`},editor:{placeholder:`Odpovedzte alebo pridajte ostatných pomocou @`,reply:`Komentovať`,cancel:`Zrušiť`,save:`Uložiť`},item:{edit:`Upraviť`,delete:`Odstrániť tento komentár`},filter:{sheet:{all:`Všetky hárky`,current:`Aktuálny hárok`},status:{all:`Všetky komentáre`,resolved:`Vyriešené`,unsolved:`Nevyriešené`,concernMe:`Týka sa ma`}}}}});
3
3
 
4
4
  // @univerjs/sheets-thread-comment-ui/locale/sk-SK
5
- (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsThreadCommentUiSkSK=t())})(this,function(){return{sheetThreadComment:{menu:{addComment:`Pridať komentár`,commentManagement:`Správa komentárov`}}}});
5
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsThreadCommentUiSkSK=t())})(this,function(){return{"sheets-thread-comment-ui":{panel:{title:`Správa komentárov`},menu:{addComment:`Pridať komentár`,commentManagement:`Správa komentárov`}}}});
6
6
 
7
7
  // locale/sk-SK
8
8
  (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n(require("@univerjs/core"),require("@univerjs/sheets-thread-comment-ui/locale/sk-SK"),require("@univerjs/thread-comment-ui/locale/sk-SK")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-thread-comment-ui/locale/sk-SK","@univerjs/thread-comment-ui/locale/sk-SK"],n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsThreadCommentSkSK=n(e.UniverCore,e.UniverSheetsThreadCommentUiSkSK,e.UniverThreadCommentUiSkSK))})(this,(function(e,n,i){"use strict";return e.mergeLocales(n,i)}));
@@ -1,8 +1,8 @@
1
1
  // @univerjs/thread-comment-ui/locale/vi-VN
2
- (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiViVN=t())})(this,function(){return{threadCommentUI:{panel:{title:`Quản lý Bình luận`,empty:`Chưa có bình luận`,filterEmpty:`Không có kết quả phù hợp`,reset:`Đặt lại`,addComment:`Thêm bình luận`,solved:`Đã giải quyết`},editor:{placeholder:`Phản hồi`,reply:`Phản hồi`,cancel:`Hủy`,save:`Lưu`},item:{edit:`Chỉnh sửa`,delete:`Xóa`},filter:{sheet:{all:`Tất cả bảng`,current:`Bảng hiện tại`},status:{all:`Tất cả bình luận`,resolved:`Đã giải quyết`,unsolved:`Chưa giải quyết`,concernMe:`Liên quan đến tôi`}}}}});
2
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiViVN=t())})(this,function(){return{"thread-comment-ui":{panel:{title:`Quản lý Bình luận`,empty:`Chưa có bình luận`,filterEmpty:`Không có kết quả phù hợp`,reset:`Đặt lại`,addComment:`Thêm bình luận`,solved:`Đã giải quyết`},editor:{placeholder:`Phản hồi`,reply:`Phản hồi`,cancel:`Hủy`,save:`Lưu`},item:{edit:`Chỉnh sửa`,delete:`Xóa`},filter:{sheet:{all:`Tất cả bảng`,current:`Bảng hiện tại`},status:{all:`Tất cả bình luận`,resolved:`Đã giải quyết`,unsolved:`Chưa giải quyết`,concernMe:`Liên quan đến tôi`}}}}});
3
3
 
4
4
  // @univerjs/sheets-thread-comment-ui/locale/vi-VN
5
- (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsThreadCommentUiViVN=t())})(this,function(){return{sheetThreadComment:{menu:{addComment:`Thêm bình luận`,commentManagement:`Quản lý bình luận`}}}});
5
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsThreadCommentUiViVN=t())})(this,function(){return{"sheets-thread-comment-ui":{panel:{title:`Quản lý bình luận`},menu:{addComment:`Thêm bình luận`,commentManagement:`Quản lý bình luận`}}}});
6
6
 
7
7
  // locale/vi-VN
8
8
  (function(e,i){typeof exports=="object"&&typeof module<"u"?module.exports=i(require("@univerjs/core"),require("@univerjs/sheets-thread-comment-ui/locale/vi-VN"),require("@univerjs/thread-comment-ui/locale/vi-VN")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-thread-comment-ui/locale/vi-VN","@univerjs/thread-comment-ui/locale/vi-VN"],i):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsThreadCommentViVN=i(e.UniverCore,e.UniverSheetsThreadCommentUiViVN,e.UniverThreadCommentUiViVN))})(this,(function(e,i,n){"use strict";return e.mergeLocales(i,n)}));
@@ -1,8 +1,8 @@
1
1
  // @univerjs/thread-comment-ui/locale/zh-CN
2
- (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiZhCN=t())})(this,function(){return{threadCommentUI:{panel:{title:`评论管理`,empty:`暂无评论`,filterEmpty:`没有匹配的结果`,reset:`重置`,addComment:`添加评论`,solved:`已解决`},editor:{placeholder:`回复`,reply:`回复`,cancel:`取消`,save:`保存`},item:{edit:`编辑`,delete:`删除`},filter:{sheet:{all:`所有表格`,current:`当前表格`},status:{all:`所有评论`,resolved:`已解决`,unsolved:`未解决`,concernMe:`与我有关`}}}}});
2
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiZhCN=t())})(this,function(){return{"thread-comment-ui":{panel:{title:`评论管理`,empty:`暂无评论`,filterEmpty:`没有匹配的结果`,reset:`重置`,addComment:`添加评论`,solved:`已解决`},editor:{placeholder:`回复`,reply:`回复`,cancel:`取消`,save:`保存`},item:{edit:`编辑`,delete:`删除`},filter:{sheet:{all:`所有表格`,current:`当前表格`},status:{all:`所有评论`,resolved:`已解决`,unsolved:`未解决`,concernMe:`与我有关`}}}}});
3
3
 
4
4
  // @univerjs/sheets-thread-comment-ui/locale/zh-CN
5
- (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsThreadCommentUiZhCN=t())})(this,function(){return{sheetThreadComment:{menu:{addComment:`添加评论`,commentManagement:`评论管理`}}}});
5
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsThreadCommentUiZhCN=t())})(this,function(){return{"sheets-thread-comment-ui":{panel:{title:`评论管理`},menu:{addComment:`添加评论`,commentManagement:`评论管理`}}}});
6
6
 
7
7
  // locale/zh-CN
8
8
  (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n(require("@univerjs/core"),require("@univerjs/sheets-thread-comment-ui/locale/zh-CN"),require("@univerjs/thread-comment-ui/locale/zh-CN")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-thread-comment-ui/locale/zh-CN","@univerjs/thread-comment-ui/locale/zh-CN"],n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsThreadCommentZhCN=n(e.UniverCore,e.UniverSheetsThreadCommentUiZhCN,e.UniverThreadCommentUiZhCN))})(this,(function(e,n,i){"use strict";return e.mergeLocales(n,i)}));
@@ -0,0 +1,8 @@
1
+ // @univerjs/thread-comment-ui/locale/zh-HK
2
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiZhHK=t())})(this,function(){return{"thread-comment-ui":{panel:{title:`評論管理`,empty:`暫無評論`,filterEmpty:`沒有符合的結果`,reset:`重置`,addComment:`新增評論`,solved:`已解決`},editor:{placeholder:`回覆`,reply:`回覆`,cancel:`取消`,save:`儲存`},item:{edit:`編輯`,delete:`刪除`},filter:{sheet:{all:`所有表格`,current:`當前表格`},status:{all:`所有評論`,resolved:`已解決`,unsolved:`未解決`,concernMe:`與我有關`}}}}});
3
+
4
+ // @univerjs/sheets-thread-comment-ui/locale/zh-HK
5
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsThreadCommentUiZhHK=t())})(this,function(){return{"sheets-thread-comment-ui":{panel:{title:`評論管理`},menu:{addComment:`新增評論`,commentManagement:`評論管理`}}}});
6
+
7
+ // locale/zh-HK
8
+ (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n(require("@univerjs/core"),require("@univerjs/sheets-thread-comment-ui/locale/zh-HK"),require("@univerjs/thread-comment-ui/locale/zh-HK")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-thread-comment-ui/locale/zh-HK","@univerjs/thread-comment-ui/locale/zh-HK"],n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsThreadCommentZhHK=n(e.UniverCore,e.UniverSheetsThreadCommentUiZhHK,e.UniverThreadCommentUiZhHK))})(this,(function(e,n,i){"use strict";return e.mergeLocales(n,i)}));
@@ -1,8 +1,8 @@
1
1
  // @univerjs/thread-comment-ui/locale/zh-TW
2
- (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiZhTW=t())})(this,function(){return{threadCommentUI:{panel:{title:`評論管理`,empty:`暫無評論`,filterEmpty:`沒有符合的結果`,reset:`重置`,addComment:`新增評論`,solved:`已解決`},editor:{placeholder:`回覆`,reply:`回覆`,cancel:`取消`,save:`儲存`},item:{edit:`編輯`,delete:`刪除`},filter:{sheet:{all:`所有表格`,current:`當前表格`},status:{all:`所有評論`,resolved:`已解決`,unsolved:`未解決`,concernMe:`與我有關`}}}}});
2
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverThreadCommentUiZhTW=t())})(this,function(){return{"thread-comment-ui":{panel:{title:`評論管理`,empty:`暫無評論`,filterEmpty:`沒有符合的結果`,reset:`重置`,addComment:`新增評論`,solved:`已解決`},editor:{placeholder:`回覆`,reply:`回覆`,cancel:`取消`,save:`儲存`},item:{edit:`編輯`,delete:`刪除`},filter:{sheet:{all:`所有表格`,current:`當前表格`},status:{all:`所有評論`,resolved:`已解決`,unsolved:`未解決`,concernMe:`與我有關`}}}}});
3
3
 
4
4
  // @univerjs/sheets-thread-comment-ui/locale/zh-TW
5
- (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsThreadCommentUiZhTW=t())})(this,function(){return{sheetThreadComment:{menu:{addComment:`新增評論`,commentManagement:`評論管理`}}}});
5
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsThreadCommentUiZhTW=t())})(this,function(){return{"sheets-thread-comment-ui":{panel:{title:`評論管理`},menu:{addComment:`新增評論`,commentManagement:`評論管理`}}}});
6
6
 
7
7
  // locale/zh-TW
8
8
  (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n(require("@univerjs/core"),require("@univerjs/sheets-thread-comment-ui/locale/zh-TW"),require("@univerjs/thread-comment-ui/locale/zh-TW")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-thread-comment-ui/locale/zh-TW","@univerjs/thread-comment-ui/locale/zh-TW"],n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverPresetSheetsThreadCommentZhTW=n(e.UniverCore,e.UniverSheetsThreadCommentUiZhTW,e.UniverThreadCommentUiZhTW))})(this,(function(e,n,i){"use strict";return e.mergeLocales(n,i)}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/preset-sheets-thread-comment",
3
- "version": "0.23.0",
3
+ "version": "0.25.0",
4
4
  "private": false,
5
5
  "description": "Preset for thread comments in Univer Sheets.",
6
6
  "author": "DreamNum Co., Ltd. <developer@univer.ai>",
@@ -60,18 +60,18 @@
60
60
  "rxjs": ">=7.0.0"
61
61
  },
62
62
  "dependencies": {
63
- "@univerjs/sheets-thread-comment": "0.23.0",
64
- "@univerjs/sheets-thread-comment-ui": "0.23.0",
65
- "@univerjs/thread-comment": "0.23.0",
66
- "@univerjs/thread-comment-ui": "0.23.0"
63
+ "@univerjs/sheets-thread-comment": "0.25.0",
64
+ "@univerjs/sheets-thread-comment-ui": "0.25.0",
65
+ "@univerjs/thread-comment": "0.25.0",
66
+ "@univerjs/thread-comment-ui": "0.25.0"
67
67
  },
68
68
  "devDependencies": {
69
- "@univerjs/core": "0.23.0",
69
+ "@univerjs/core": "0.25.0",
70
70
  "react": "18.3.1",
71
71
  "react-dom": "18.3.1",
72
72
  "rxjs": "7.8.2",
73
73
  "typescript": "^6.0.3",
74
- "@univerjs-infra/shared": "0.23.0"
74
+ "@univerjs-infra/shared": "0.25.0"
75
75
  },
76
76
  "scripts": {
77
77
  "prebuild:preset": "tsx prepare.ts",