@univerjs/preset-sheets-thread-comment 0.6.10 → 0.7.0-nightly.202505071607

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.css CHANGED
@@ -1 +1 @@
1
- .univer-m-0{margin:0}.univer-grid{display:grid}.univer-list-none{list-style-type:none}.univer-gap-2{gap:.5rem}.univer-break-words{word-wrap:break-word}.univer-rounded-lg{border-radius:.5rem}.univer-p-0{padding:0}.univer-p-4{padding:1rem}.univer-text-sm{font-size:.875rem;line-height:1.25rem}.hover\:univer-bg-gray-200:hover{--tw-bg-opacity: 1;background-color:#e3e5ea;background-color:rgba(227,229,234,var(--tw-bg-opacity, 1))}.\[\&_a\]\:univer-cursor-pointer a{cursor:pointer}.\[\&_a\]\:univer-rounded a{border-radius:.25rem}.\[\&_a\]\:univer-p-1 a{padding:.25rem}.univer-thread-comment-editor-buttons{margin-top:12px;display:flex;flex-direction:row;justify-content:flex-end}.univer-thread-comment-editor-suggestion{display:flex;align-items:center;font-size:13px;color:rgb(var(--color-black))}.univer-thread-comment-editor-suggestionActive{background-color:rgba(var(--grey-50))}.univer-thread-comment-editor-suggestion-icon{width:24px;height:24px;border-radius:12px;margin-right:6px}.univer-thread-comment{padding:16px;background:rgba(var(--color-white));border:1px solid rgba(var(--grey-200));border-radius:8px;box-sizing:border-box;position:relative;width:278px}.univer-thread-comment-active{box-shadow:var(--box-shadow-base)}.univer-thread-comment-content{max-height:300px;overflow-y:auto;overflow-x:hidden;scrollbar-color:rgba(var(--scrollbar-color),.7) transparent;scrollbar-gutter:auto;scrollbar-width:thin}.univer-thread-comment-highlight{background-color:rgb(var(--gold-400));position:absolute;top:0;left:0;right:0;height:6px;border-top-left-radius:6px;border-top-right-radius:6px}.univer-thread-comment-icon-container{display:flex;flex-direction:row;flex-shrink:0;flex-grow:0}.univer-thread-comment-icon{width:24px;height:24px;border-radius:3px;margin-left:4px;display:inline-flex;justify-content:center;align-items:center;cursor:pointer;font-size:16px}.univer-thread-comment-icon:hover{background-color:rgba(var(--grey-50))}.univer-thread-comment-title{display:flex;flex-direction:row;align-items:center;justify-content:space-between;margin-bottom:16px;font-size:14px;line-height:20px}.univer-thread-comment-title-position{display:flex;flex-direction:row;align-items:center;flex:1 1 0;overflow:hidden}.univer-thread-comment-title-highlight{width:3px;height:14px;border-radius:1.5px;background-color:rgba(var(--gold-400));margin-right:8px;flex-shrink:0;flex-grow:0}.univer-thread-comment-title-position-text{flex:1 1 0;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.univer-thread-comment-username{font-size:14px;font-weight:500;line-height:20px}.univer-thread-comment-item{margin-bottom:12px;padding-left:30px;position:relative}.univer-thread-comment-item-head{width:24px;height:24px;border-radius:12px;position:absolute;left:0;top:0}.univer-thread-comment-item-title{display:flex;justify-content:space-between;height:24px;align-items:center;margin-bottom:4px}.univer-thread-comment-item-title-position{color:rgba(var(--color-black));font-size:14px;line-height:20px}.univer-thread-comment-item-title-highlight{width:3px;height:14px;border-radius:2px;margin-right:8px;margin-top:3px;background-color:rgba(var(--gold-400))}.univer-thread-comment-item-time{font-size:12px;line-height:1.5;margin-bottom:4px;color:rgba(var(--grey-600))}.univer-thread-comment-item-content{font-size:13px;line-height:20px;color:rgba(var(--color-black))}.univer-thread-comment-item-at{color:rgba(var(--blue-400))}.univer-thread-comment-panel{min-height:100%;display:flex;flex-direction:column;padding-bottom:12px}.univer-thread-comment-panel .univer-thread-comment{margin-top:12px}.univer-thread-comment-panel-forms{display:flex;flex-direction:row;justify-content:space-between;margin-top:12px}.univer-thread-comment-panel-forms .univer-select{width:120px}.univer-thread-comment-panel-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;color:rgb(var(--grey-600));font-size:13px;flex:1}.univer-thread-comment-panel-add{margin-top:8px;display:flex;flex-direction:row}.univer-thread-comment-panel-add svg{margin-right:6px}.univer-thread-comment-panel-solved{margin-top:12px;font-size:var(--font-size-xs)}
1
+ .univer-absolute{position:absolute}.univer-relative{position:relative}.univer-left-0{left:0}.univer-right-0{right:0}.univer-top-0{top:0}.univer-m-0{margin:0}.univer-mb-1{margin-bottom:4px}.univer-mb-3{margin-bottom:12px}.univer-mb-4{margin-bottom:16px}.univer-ml-1{margin-left:4px}.univer-mr-1\.5{margin-right:6px}.univer-mr-2{margin-right:8px}.univer-mt-2{margin-top:8px}.univer-mt-3{margin-top:12px}.univer-box-border{box-sizing:border-box}.univer-flex{display:flex}.univer-inline-flex{display:inline-flex}.univer-grid{display:grid}.univer-h-1\.5{height:6px}.univer-h-3\.5{height:14px}.univer-h-6{height:24px}.univer-max-h-\[300px\]{max-height:300px}.univer-min-h-full{min-height:100%}.univer-w-6{width:24px}.univer-w-\[278px\]{width:278px}.univer-w-\[3px\]{width:3px}.univer-w-full{width:100%}.univer-flex-1{flex:1 1 0%}.univer-flex-shrink-0{flex-shrink:0}.univer-flex-grow-0{flex-grow:0}.univer-cursor-pointer{cursor:pointer}.univer-list-none{list-style-type:none}.univer-flex-row{flex-direction:row}.univer-flex-col{flex-direction:column}.univer-items-center{align-items:center}.univer-justify-end{justify-content:flex-end}.univer-justify-center{justify-content:center}.univer-justify-between{justify-content:space-between}.univer-gap-3{gap:12px}.univer-overflow-hidden{overflow:hidden}.univer-overflow-y-auto{overflow-y:auto}.univer-overflow-x-hidden{overflow-x:hidden}.univer-text-ellipsis{text-overflow:ellipsis}.univer-whitespace-nowrap{white-space:nowrap}.univer-break-words{word-wrap:break-word}.univer-rounded-\[3px\]{border-radius:3px}.univer-rounded-full{border-radius:9999px}.univer-rounded-lg{border-radius:8px}.univer-rounded-sm{border-radius:2px}.univer-rounded-t-md{border-top-left-radius:6px;border-top-right-radius:6px}.univer-border{border-width:1px}.univer-border-solid{border-style:solid}.univer-border-gray-200{border-color:var(--univer-gray-200)}.univer-bg-gray-50{background-color:var(--univer-gray-50)}.univer-bg-white{background-color:var(--univer-white)}.univer-bg-yellow-400{background-color:var(--univer-yellow-400)}.univer-bg-cover{background-size:cover}.univer-bg-center{background-position:center}.univer-bg-no-repeat{background-repeat:no-repeat}.univer-p-1\.5{padding:6px}.univer-p-4{padding:16px}.univer-pb-3{padding-bottom:12px}.univer-pl-\[30px\]{padding-left:30px}.univer-text-\[13px\]{font-size:13px}.univer-text-\[13px\]\/normal{font-size:13px;line-height:1.5}.univer-text-base{font-size:16px;line-height:24px}.univer-text-sm{font-size:14px;line-height:20px}.univer-text-xs{font-size:12px;line-height:16px}.univer-text-xs\/normal{font-size:12px;line-height:1.5}.univer-font-medium{font-weight:500}.univer-leading-5{line-height:20px}.univer-text-gray-600{color:var(--univer-gray-600)}.univer-text-gray-900{color:var(--univer-gray-900)}.univer-text-green-500{color:var(--univer-green-500)}.univer-text-primary-600{color:var(--univer-primary-600)}.univer-shadow{--tw-shadow: 0 1px 3px 0 rgba(0, 0, 0, .1), 0 1px 2px -1px rgba(0, 0, 0, .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:0 0 #0000,0 0 #0000,0 1px 3px #0000001a,0 1px 2px -1px #0000001a;box-shadow:var(--tw-ring-offset-shadow, 0 0 rgba(0,0,0,0)),var(--tw-ring-shadow, 0 0 rgba(0,0,0,0)),var(--tw-shadow)}.hover\:univer-bg-gray-200:hover{background-color:var(--univer-gray-200)}.hover\:univer-bg-gray-50:hover{background-color:var(--univer-gray-50)}.\[\&_a\]\:univer-block a{display:block}.\[\&_a\]\:univer-cursor-pointer a{cursor:pointer}.\[\&_a\]\:univer-rounded a{border-radius:4px}.\[\&_a\]\:univer-px-2 a{padding-left:8px;padding-right:8px}.\[\&_a\]\:univer-py-1\.5 a{padding-top:6px;padding-bottom:6px}.\[\&_a\]\:univer-transition-colors a{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}
package/lib/umd/index.js CHANGED
@@ -11,18 +11,59 @@
11
11
 
12
12
 
13
13
  // @univerjs/thread-comment-ui/index
14
- (function(c,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("@univerjs/core"),require("@univerjs/thread-comment"),require("@univerjs/ui"),require("rxjs"),require("react/jsx-runtime"),require("@univerjs/design"),require("react"),require("@univerjs/docs-ui")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/thread-comment","@univerjs/ui","rxjs","react/jsx-runtime","@univerjs/design","react","@univerjs/docs-ui"],o):(c=typeof globalThis<"u"?globalThis:c||self,o(c.UniverThreadCommentUi={},c.UniverCore,c.UniverThreadComment,c.UniverUi,c.rxjs,c.React,c.UniverDesign,c.React,c.UniverDocsUi))})(this,function(c,o,_,C,te,a,V,m,se){"use strict";var Ge=Object.defineProperty;var Ye=(c,o,_)=>o in c?Ge(c,o,{enumerable:!0,configurable:!0,writable:!0,value:_}):c[o]=_;var K=(c,o,_)=>Ye(c,typeof o!="symbol"?o+"":o,_);var Ne=Object.getOwnPropertyDescriptor,Pe=(n,e,t,r)=>{for(var i=r>1?void 0:r?Ne(e,t):e,d=n.length-1,h;d>=0;d--)(h=n[d])&&(i=h(i)||i);return i},le=(n,e)=>(t,r)=>e(t,r,n);c.ThreadCommentPanelService=class extends o.Disposable{constructor(t,r){super();K(this,"_panelVisible",!1);K(this,"_panelVisible$",new te.BehaviorSubject(!1));K(this,"_activeCommentId");K(this,"_activeCommentId$",new te.BehaviorSubject(void 0));K(this,"panelVisible$",this._panelVisible$.asObservable());K(this,"activeCommentId$",this._activeCommentId$.asObservable());this._sidebarService=t,this._univerInstanceService=r,this._init(),this.disposeWithMe(()=>{this._activeCommentId$.complete(),this._panelVisible$.complete()})}_init(){this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(t=>{t.visible||this.setPanelVisible(!1)})),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(o.UniverInstanceType.UNIVER_SHEET).pipe(te.filter(t=>!t)).subscribe(()=>{this._sidebarService.close()}))}get panelVisible(){return this._panelVisible}get activeCommentId(){return this._activeCommentId}setPanelVisible(t){this._panelVisible=t,this._panelVisible$.next(t)}setActiveComment(t){this._activeCommentId=t,this._activeCommentId$.next(t)}},c.ThreadCommentPanelService=Pe([le(0,o.Inject(C.ISidebarService)),le(1,o.IUniverInstanceService)],c.ThreadCommentPanelService);const me="thread-comment-panel",xe="UNIVER_THREAD_COMMENT_UI_PLUGIN",ce={id:"thread-comment-ui.operation.toggle-panel",type:o.CommandType.OPERATION,handler(n){const e=n.get(C.ISidebarService),t=n.get(c.ThreadCommentPanelService);return t.panelVisible?(e.close(),t.setPanelVisible(!1)):(e.open({header:{title:"threadCommentUI.panel.title"},children:{label:me},width:330}),t.setPanelVisible(!0)),!0}},F={id:"thread-comment-ui.operation.set-active-comment",type:o.CommandType.OPERATION,handler(n,e){return n.get(c.ThreadCommentPanelService).setActiveComment(e),!0}},Ee="thread-comment-ui.config",he={};var De=Object.defineProperty,Oe=Object.getOwnPropertyDescriptor,Me=(n,e,t)=>e in n?De(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,we=(n,e,t,r)=>{for(var i=r>1?void 0:r?Oe(e,t):e,d=n.length-1,h;d>=0;d--)(h=n[d])&&(i=h(i)||i);return i},de=(n,e)=>(t,r)=>e(t,r,n),ue=(n,e,t)=>Me(n,typeof e!="symbol"?e+"":e,t);c.UniverThreadCommentUIPlugin=class extends o.Plugin{constructor(e=he,t,r,i){super(),this._config=e,this._injector=t,this._commandService=r,this._configService=i;const{menu:d,...h}=o.merge({},he,this._config);d&&this._configService.setConfig("menu",d,{merge:!0}),this._configService.setConfig(Ee,h)}onStarting(){var e;o.mergeOverrideWithDependencies([[c.ThreadCommentPanelService]],(e=this._config)==null?void 0:e.overrides).forEach(t=>{this._injector.add(t)}),[ce,F].forEach(t=>{this._commandService.registerCommand(t)})}},ue(c.UniverThreadCommentUIPlugin,"pluginName",xe),ue(c.UniverThreadCommentUIPlugin,"type",o.UniverInstanceType.UNIVER_UNKNOWN),c.UniverThreadCommentUIPlugin=we([o.DependentOn(_.UniverThreadCommentPlugin),de(1,o.Inject(o.Injector)),de(2,o.ICommandService),de(3,o.IConfigService)],c.UniverThreadCommentUIPlugin);var M=function(){return M=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i])}return n},M.apply(this,arguments)},He=function(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(n);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(n,r[i])&&(t[r[i]]=n[r[i]]);return t},q=m.forwardRef(function(n,e){var t=n.icon,r=n.id,i=n.className,d=n.extend,h=He(n,["icon","id","className","extend"]),g="univerjs-icon univerjs-icon-".concat(r," ").concat(i||"").trim(),T=m.useRef("_".concat($e()));return ve(t,"".concat(r),{defIds:t.defIds,idSuffix:T.current},M({ref:e,className:g},h),d)});function ve(n,e,t,r,i){return m.createElement(n.tag,M(M({key:e},ke(n,t,i)),r),(je(n,t).children||[]).map(function(d,h){return ve(d,"".concat(e,"-").concat(n.tag,"-").concat(h),t,void 0,i)}))}function ke(n,e,t){var r=M({},n.attrs);t!=null&&t.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=t.colorChannel1),n.tag==="mask"&&r.id&&(r.id=r.id+e.idSuffix),Object.entries(r).forEach(function(d){var h=d[0],g=d[1];h==="mask"&&typeof g=="string"&&(r[h]=g.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))});var i=e.defIds;return!i||i.length===0||(n.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+e.idSuffix),Object.entries(r).forEach(function(d){var h=d[0],g=d[1];typeof g=="string"&&(r[h]=g.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),r}function je(n,e){var t,r=e.defIds;return!r||r.length===0?n:n.tag==="defs"&&(!((t=n.children)===null||t===void 0)&&t.length)?M(M({},n),{children:n.children.map(function(i){return typeof i.attrs.id=="string"&&r&&r.indexOf(i.attrs.id)>-1?M(M({},i),{attrs:M(M({},i.attrs),{id:i.attrs.id+e.idSuffix})}):i})}):n}function $e(){return Math.random().toString(36).substring(2,8)}q.displayName="UniverIcon";var Le={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.3313 1.4667C5.3313 1.13533 5.59993.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443 14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443zM6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928 9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171 10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778 9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539 9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263 6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539 5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778 6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171z"}},{tag:"path",attrs:{fill:"currentColor",d:"M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Ce=m.forwardRef(function(n,e){return m.createElement(q,Object.assign({},n,{id:"delete-single",ref:e,icon:Le}))});Ce.displayName="DeleteSingle";var Ae={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z"}}]},fe=m.forwardRef(function(n,e){return m.createElement(q,Object.assign({},n,{id:"increase-single",ref:e,icon:Ae}))});fe.displayName="IncreaseSingle";var Ve={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3 9C3.55228 9 4 8.55228 4 8 4 7.44772 3.55228 7 3 7 2.44772 7 2 7.44772 2 8 2 8.55228 2.44772 9 3 9zM8 9C8.55228 9 9 8.55228 9 8 9 7.44772 8.55228 7 8 7 7.44772 7 7 7.44772 7 8 7 8.55228 7.44772 9 8 9zM13 9C13.5523 9 14 8.55228 14 8 14 7.44772 13.5523 7 13 7 12.4477 7 12 7.44772 12 8 12 8.55228 12.4477 9 13 9z"}}]},pe=m.forwardRef(function(n,e){return m.createElement(q,Object.assign({},n,{id:"more-horizontal-single",ref:e,icon:Ve}))});pe.displayName="MoreHorizontalSingle";var Be={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{stroke:"currentColor",d:"M7.48389 10.3267V12.1905C7.48389 12.7428 7.9316 13.1905 8.48389 13.1905H11.2216L12.2955 14.2644L13.3695 13.1905H14.1593C14.7116 13.1905 15.1593 12.7428 15.1593 12.1905V8.46289C15.1593 7.91061 14.7116 7.46289 14.1593 7.46289H12.2955",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M0.840332 3.73535C0.840332 2.63078 1.73576 1.73535 2.84033 1.73535H10.2955C11.4001 1.73535 12.2955 2.63078 12.2955 3.73535V8.32676C12.2955 9.43132 11.4001 10.3268 10.2955 10.3268H5.6014L4.1695 11.7587L3.05978 10.3268H2.84033C1.73576 10.3268 0.840332 9.43133 0.840332 8.32676V3.73535Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M6.41016 6.1311H6.76813M8.91626 6.1311H9.27424M3.90454 6.1311H4.26252",strokeLinecap:"round",strokeWidth:1.2}}]},Ie=m.forwardRef(function(n,e){return m.createElement(q,Object.assign({},n,{id:"reply-to-comment-single",ref:e,icon:Be}))});Ie.displayName="ReplyToCommentSingle";var Fe={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6106 15.4036C12.4766 15.4036 15.6106 12.2696 15.6106 8.40356C15.6106 4.53757 12.4766 1.40356 8.6106 1.40356C4.7446 1.40356 1.6106 4.53757 1.6106 8.40356C1.6106 12.2696 4.7446 15.4036 8.6106 15.4036ZM12.3351 6.82773C12.5694 6.59342 12.5694 6.21352 12.3351 5.9792C12.1007 5.74489 11.7208 5.74489 11.4865 5.9792L7.91079 9.55494L6.33506 7.9792C6.10074 7.74489 5.72084 7.74489 5.48653 7.9792C5.25221 8.21352 5.25221 8.59342 5.48653 8.82773L7.48653 10.8277C7.72084 11.062 8.10074 11.062 8.33506 10.8277L12.3351 6.82773Z",fillRule:"evenodd",clipRule:"evenodd"}}]},ge=m.forwardRef(function(n,e){return m.createElement(q,Object.assign({},n,{id:"resolved-single",ref:e,icon:Fe}))});ge.displayName="ResolvedSingle";var We={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"circle",attrs:{cx:8.73,cy:8.4,r:6.4,stroke:"currentColor",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M6.02637 8.40356L8.02637 10.4036L12.0264 6.40356",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}}]},Se=m.forwardRef(function(n,e){return m.createElement(q,Object.assign({},n,{id:"solve-single",ref:e,icon:We}))});Se.displayName="SolveSingle";const be={threadCommentEditorButtons:"univer-thread-comment-editor-buttons"};function Te(n){return{id:"d",body:n,documentStyle:{}}}const ye=m.forwardRef((n,e)=>{var A;const{comment:t,onSave:r,id:i,onCancel:d,autoFocus:h,unitId:g,type:T}=n,E=C.useDependency(o.ICommandService),w=C.useDependency(o.LocaleService),[B,H]=m.useState(!1),D=C.useDependency(se.IEditorService),v=m.useRef(null),S=T===o.UniverInstanceType.UNIVER_SHEET?o.DOCS_NORMAL_EDITOR_UNIT_ID_KEY:g,[k,N]=m.useState(()=>{var u,f,b;return o.BuildTextUtils.transform.getPlainText((b=(f=(u=v.current)==null?void 0:u.getDocumentData().body)==null?void 0:f.dataStream)!=null?b:"")});m.useEffect(()=>{var f,b,l,p;N(o.BuildTextUtils.transform.getPlainText((l=(b=(f=v.current)==null?void 0:f.getDocumentData().body)==null?void 0:b.dataStream)!=null?l:""));const u=(p=v.current)==null?void 0:p.selectionChange$.subscribe(()=>{var Z,P,U;N(o.BuildTextUtils.transform.getPlainText((U=(P=(Z=v.current)==null?void 0:Z.getDocumentData().body)==null?void 0:P.dataStream)!=null?U:""))});return()=>u==null?void 0:u.unsubscribe()},[(A=v.current)==null?void 0:A.selectionChange$]);const $=m.useMemo(()=>({keyCodes:[{keyCode:C.KeyCode.ENTER}],handler:u=>{u===C.KeyCode.ENTER&&E.executeCommand(se.BreakLineCommand.id)}}),[E]);m.useImperativeHandle(e,()=>({reply(u){var f,b;(f=v.current)==null||f.focus(),(b=v.current)==null||b.setDocumentData(Te(u))}}));const y=()=>{if(v.current){const u=o.Tools.deepClone(v.current.getDocumentData().body);H(!1),r==null||r({...t,text:u}),v.current.replaceText(""),setTimeout(()=>{var f,b;(f=v.current)==null||f.setSelectionRanges([]),(b=v.current)==null||b.blur()},10)}};return a.jsxs("div",{className:be.threadCommentEditor,onClick:u=>u.preventDefault(),children:[a.jsx(se.RichTextEditor,{editorRef:v,autoFocus:h,style:{width:"100%"},keyboardEventConfig:$,placeholder:w.t("threadCommentUI.editor.placeholder"),initialValue:(t==null?void 0:t.text)&&Te(t.text),onFocusChange:u=>u&&H(u),isSingle:!1,maxHeight:64,onClickOutside:()=>{setTimeout(()=>{D.focus(S)},30)}}),B?a.jsxs("div",{className:be.threadCommentEditorButtons,children:[a.jsx(V.Button,{style:{marginRight:12},onClick:()=>{var u;d==null||d(),H(!1),(u=v.current)==null||u.replaceText("",!0),E.executeCommand(F.id)},children:w.t("threadCommentUI.editor.cancel")}),a.jsx(V.Button,{variant:"primary",disabled:!k,onClick:y,children:w.t(i?"threadCommentUI.editor.save":"threadCommentUI.editor.reply")})]}):null]})}),qe=n=>{const{dataStream:e,customRanges:t}=n,r=e.endsWith(`\r
15
- `)?e.length-2:e.length,i=[];let d=0;return t==null||t.forEach(h=>{d<h.startIndex&&i.push({type:"text",content:e.slice(d,h.startIndex)}),i.push({type:"mention",content:{label:e.slice(h.startIndex,h.endIndex+1),id:h.rangeId}}),d=h.endIndex+1}),i.push({type:"text",content:e.slice(d,r)}),i},ze=n=>{const{paragraphs:e=[]}=n;let t=0;return e.map(r=>{const i=o.getBodySlice(n,t,r.startIndex);return t=r.startIndex+1,qe(i)})},Ke=n=>{let e="";const t=[];return n.forEach(r=>{switch(r.type){case"text":e+=r.content;break;case"mention":{const i=e.length;e+=r.content.label;const d=e.length-1;t.push({rangeId:r.content.id,rangeType:o.CustomRangeType.MENTION,startIndex:i,endIndex:d,properties:{}});break}}}),e+=`
16
- \r`,{textRuns:[],paragraphs:[{startIndex:e.length-2,paragraphStyle:{}}],sectionBreaks:[{startIndex:e.length-1}],dataStream:e,customRanges:t}},I={threadComment:"univer-thread-comment",threadCommentActive:"univer-thread-comment-active",threadCommentContent:"univer-thread-comment-content",threadCommentHighlight:"univer-thread-comment-highlight",threadCommentIconContainer:"univer-thread-comment-icon-container",threadCommentIcon:"univer-thread-comment-icon",threadCommentTitle:"univer-thread-comment-title",threadCommentTitlePosition:"univer-thread-comment-title-position",threadCommentTitleHighlight:"univer-thread-comment-title-highlight",threadCommentTitlePositionText:"univer-thread-comment-title-position-text",threadCommentUsername:"univer-thread-comment-username",threadCommentItem:"univer-thread-comment-item",threadCommentItemHead:"univer-thread-comment-item-head",threadCommentItemTitle:"univer-thread-comment-item-title",threadCommentItemTime:"univer-thread-comment-item-time",threadCommentItemContent:"univer-thread-comment-item-content",threadCommentItemAt:"univer-thread-comment-item-at"},_e="__mock__",Ze=n=>{const{item:e,unitId:t,subUnitId:r,editing:i,onEditingChange:d,onReply:h,resolved:g,isRoot:T,onClose:E,onDeleteComment:w,type:B}=n,H=C.useDependency(o.ICommandService),D=C.useDependency(o.LocaleService),v=C.useDependency(o.UserManagerService),S=v.getUser(e.personId),k=C.useObservable(v.currentUser$),N=(k==null?void 0:k.userID)===e.personId,$=e.id===_e,[y,A]=m.useState(!1),u=()=>{(w==null?void 0:w(e))!==!1&&(H.executeCommand(T?_.DeleteCommentTreeCommand.id:_.DeleteCommentCommand.id,{unitId:t,subUnitId:r,commentId:e.id}),T&&(E==null||E()))};return a.jsxs("div",{className:I.threadCommentItem,onMouseLeave:()=>A(!1),onMouseEnter:()=>A(!0),children:[a.jsx("img",{className:I.threadCommentItemHead,src:S==null?void 0:S.avatar}),a.jsxs("div",{className:I.threadCommentItemTitle,children:[a.jsx("div",{className:I.threadCommentUsername,children:(S==null?void 0:S.name)||" "}),a.jsxs("div",{children:[$||g?null:y?a.jsx("div",{className:I.threadCommentIcon,onClick:()=>h(S),children:a.jsx(Ie,{})}):null,N&&!$&&!g?a.jsx(V.Dropdown,{overlay:a.jsx("div",{className:"univer-rounded-lg univer-p-4 univer-theme",children:a.jsxs("ul",{className:`
17
- univer-m-0 univer-grid univer-list-none univer-gap-2 univer-p-0
18
- univer-text-sm
19
- [&_a]:univer-cursor-pointer [&_a]:univer-rounded [&_a]:univer-p-1
20
- `,children:[a.jsx("li",{children:a.jsx("a",{className:"hover:univer-bg-gray-200",onClick:()=>d==null?void 0:d(!0),children:D.t("threadCommentUI.item.edit")})}),a.jsx("li",{children:a.jsx("a",{className:"hover:univer-bg-gray-200",onClick:u,children:D.t("threadCommentUI.item.delete")})})]})}),children:a.jsx("div",{className:I.threadCommentIcon,children:a.jsx(pe,{})})}):null]})]}),a.jsx("div",{className:I.threadCommentItemTime,children:e.dT}),i?a.jsx(ye,{type:B,id:e.id,comment:e,onCancel:()=>d==null?void 0:d(!1),autoFocus:!0,unitId:t,subUnitId:r,onSave:({text:f,attachments:b})=>{d==null||d(!1),H.executeCommand(_.UpdateCommentCommand.id,{unitId:t,subUnitId:r,payload:{commentId:e.id,text:f,attachments:b}})}}):a.jsx("div",{className:I.threadCommentItemContent,children:ze(e.text).map((f,b)=>a.jsx("div",{className:"univer-break-words",children:f.map((l,p)=>{switch(l.type){case"mention":return a.jsxs("a",{className:I.threadCommentItemAt,children:[l.content.label," "]},p);default:return l.content}})},b))})]})},Ue=n=>{var X,ee,ie;const{id:e,unitId:t,subUnitId:r,refStr:i,showEdit:d=!0,onClick:h,showHighlight:g,onClose:T,getSubUnitName:E,prefix:w,autoFocus:B,onMouseEnter:H,onMouseLeave:D,onAddComment:v,onDeleteComment:S,onResolve:k,type:N}=n,$=C.useDependency(_.ThreadCommentModel),[y,A]=m.useState(!1),[u,f]=m.useState(""),b=m.useMemo(()=>$.commentUpdate$.pipe(te.debounceTime(16)),[$]);C.useObservable(b);const l=e?$.getCommentWithChildren(t,r,e):null,p=C.useDependency(o.ICommandService),Z=C.useDependency(o.UserManagerService),P=l==null?void 0:l.root.resolved,U=C.useObservable(Z.currentUser$),R=m.useRef(null),ne=[...l?[l.root]:[{id:_e,text:{dataStream:`
21
- \r`},personId:(X=U==null?void 0:U.userID)!=null?X:"",ref:i!=null?i:"",dT:"",unitId:t,subUnitId:r,threadId:""}],...(ee=l==null?void 0:l.children)!=null?ee:[]],j=m.useRef(null),Y=x=>{x.stopPropagation(),P?p.executeCommand(F.id,{unitId:t,subUnitId:r,commentId:e}):p.executeCommand(F.id),p.executeCommand(_.ResolveCommentCommand.id,{unitId:t,subUnitId:r,commentId:e,resolved:!P}),k==null||k(!P)},W=x=>{x.stopPropagation(),p.executeCommand(F.id),!(l!=null&&l.root&&(S==null?void 0:S(l.root))===!1)&&(p.executeCommand(_.DeleteCommentTreeCommand.id,{unitId:t,subUnitId:r,commentId:e}),T==null||T())};m.useEffect(()=>D==null?void 0:D(),[]);const J=E((ie=l==null?void 0:l.root.subUnitId)!=null?ie:r),Q=d&&!u&&!P,re=`${i||(l==null?void 0:l.root.ref)||""}${J?" · ":""}${J}`;return a.jsxs("div",{className:V.clsx(I.threadComment,{[I.threadCommentActive]:!P&&(g||y||w==="cell")}),onClick:h,id:`${w}-${t}-${r}-${e}`,onMouseEnter:()=>{H==null||H(),A(!0)},onMouseLeave:()=>{D==null||D(),A(!1)},children:[!P&&g?a.jsx("div",{className:I.threadCommentHighlight}):null,a.jsxs("div",{className:I.threadCommentTitle,children:[a.jsxs("div",{className:I.threadCommentTitlePosition,children:[a.jsx("div",{className:I.threadCommentTitleHighlight}),a.jsx(V.Tooltip,{showIfEllipsis:!0,title:re,children:a.jsx("div",{className:I.threadCommentTitlePositionText,children:re})})]}),l?a.jsxs("div",{className:I.threadCommentIconContainer,children:[a.jsx("div",{onClick:Y,className:I.threadCommentIcon,style:{color:P?"rgb(var(--green-500))":""},children:P?a.jsx(ge,{}):a.jsx(Se,{})}),(U==null?void 0:U.userID)===l.root.personId?a.jsx("div",{className:I.threadCommentIcon,onClick:W,children:a.jsx(Ce,{})}):null]}):null]}),a.jsx("div",{className:I.threadCommentContent,ref:j,children:ne.map(x=>a.jsx(Ze,{onClose:T,unitId:t,subUnitId:r,item:x,isRoot:x.id===(l==null?void 0:l.root.id),editing:u===x.id,resolved:l==null?void 0:l.root.resolved,type:N,onEditingChange:s=>{f(s?x.id:"")},onReply:s=>{s&&requestAnimationFrame(()=>{var L;(L=R.current)==null||L.reply(Ke([{type:"mention",content:{id:s.userID,label:s.name}}]))})},onAddComment:v,onDeleteComment:S},x.id))}),Q?a.jsx("div",{children:a.jsx(ye,{ref:R,type:N,unitId:t,subUnitId:r,onSave:async({text:x,attachments:s})=>{const L={text:x,attachments:s,dT:_.getDT(),id:o.generateRandomId(),ref:i,personId:U==null?void 0:U.userID,parentId:l==null?void 0:l.root.id,unitId:t,subUnitId:r,threadId:l==null?void 0:l.root.threadId};(v==null?void 0:v(L))!==!1&&(await p.executeCommand(_.AddCommentCommand.id,{unitId:t,subUnitId:r,comment:L}),j.current&&(j.current.scrollTop=j.current.scrollHeight))},autoFocus:B||!l,onCancel:()=>{l||T==null||T()}},`${B}`)}):null]})},G={threadCommentPanel:"univer-thread-comment-panel",threadCommentPanelForms:"univer-thread-comment-panel-forms",threadCommentPanelEmpty:"univer-thread-comment-panel-empty",threadCommentPanelAdd:"univer-thread-comment-panel-add",threadCommentPanelSolved:"univer-thread-comment-panel-solved"},Re=n=>{const{unitId:e,subUnitId$:t,type:r,onAdd:i,getSubUnitName:d,onResolve:h,sortComments:g,onItemLeave:T,onItemEnter:E,disableAdd:w,tempComment:B,onAddComment:H,onDeleteComment:D,showComments:v}=n,[S,k]=m.useState("all"),[N,$]=m.useState("all"),y=C.useDependency(o.LocaleService),A=C.useDependency(o.UserManagerService),u=C.useDependency(_.ThreadCommentModel),[f,b]=m.useState(()=>u.getUnit(e)),l=C.useDependency(c.ThreadCommentPanelService),p=C.useObservable(l.activeCommentId$),Z=C.useObservable(u.commentUpdate$),P=C.useDependency(o.ICommandService),U=C.useObservable(t),R=m.useRef(!0),ne="panel",j=C.useObservable(A.currentUser$),Y=m.useMemo(()=>{var oe;const s=S==="all"?f:(oe=f.filter(O=>O.subUnitId===U))!=null?oe:[],L=g!=null?g:O=>O,ae=s.map(O=>{var z;return{...O.root,children:(z=O.children)!=null?z:[],users:O.relativeUsers}});if(v){const O=new Map;return ae.forEach(z=>{O.set(z.id,z)}),[...v,""].map(z=>O.get(z)).filter(Boolean)}else return L(ae)},[v,S,f,g,U]),W=m.useMemo(()=>[...Y.filter(s=>!s.resolved),...Y.filter(s=>s.resolved)],[Y]),J=m.useMemo(()=>N==="resolved"?W.filter(s=>s.resolved):N==="unsolved"?W.filter(s=>!s.resolved):N==="concern_me"&&j!=null&&j.userID?W.filter(s=>s==null?void 0:s.users.has(j.userID)):W,[W,j==null?void 0:j.userID,N]),Q=B?[B,...J]:J,re=Q.filter(s=>!s.resolved),X=Q.filter(s=>s.resolved),ee=N!=="all"||S!=="all",ie=()=>{$("all"),k("all")};m.useEffect(()=>{e&&b(u.getUnit(e))},[e,u,Z]),m.useEffect(()=>{var O;if(!p)return;if(!R.current){R.current=!0;return}const{unitId:s,subUnitId:L,commentId:ae}=p,oe=`${ne}-${s}-${L}-${ae}`;(O=document.getElementById(oe))==null||O.scrollIntoView({block:"center"})},[p]);const x=s=>a.jsx(Ue,{prefix:ne,getSubUnitName:d,id:s.id,unitId:s.unitId,subUnitId:s.subUnitId,refStr:s.ref,type:r,showEdit:(p==null?void 0:p.commentId)===s.id,showHighlight:(p==null?void 0:p.commentId)===s.id,onClick:()=>{R.current=!1,s.resolved?P.executeCommand(F.id):P.executeCommand(F.id,{unitId:s.unitId,subUnitId:s.subUnitId,commentId:s.id,temp:!1})},onMouseEnter:()=>E==null?void 0:E(s),onMouseLeave:()=>T==null?void 0:T(s),onAddComment:H,onDeleteComment:D,onResolve:L=>h==null?void 0:h(s.id,L)},s.id);return a.jsxs("div",{className:G.threadCommentPanel,children:[a.jsxs("div",{className:G.threadCommentPanelForms,children:[r===o.UniverInstanceType.UNIVER_SHEET?a.jsx(V.Select,{borderless:!0,value:S,onChange:s=>k(s),options:[{value:"current",label:y.t("threadCommentUI.filter.sheet.current")},{value:"all",label:y.t("threadCommentUI.filter.sheet.all")}]}):null,a.jsx(V.Select,{borderless:!0,value:N,onChange:s=>$(s),options:[{value:"all",label:y.t("threadCommentUI.filter.status.all")},{value:"resolved",label:y.t("threadCommentUI.filter.status.resolved")},{value:"unsolved",label:y.t("threadCommentUI.filter.status.unsolved")},{value:"concern_me",label:y.t("threadCommentUI.filter.status.concernMe")}]})]}),re.map(x),X.length?a.jsx("div",{className:G.threadCommentPanelSolved,children:"已解决"}):null,X.map(x),Q.length?null:a.jsxs("div",{className:G.threadCommentPanelEmpty,children:[ee?y.t("threadCommentUI.panel.filterEmpty"):y.t("threadCommentUI.panel.empty"),ee?a.jsx(V.Button,{variant:"link",onClick:ie,children:y.t("threadCommentUI.panel.reset")}):a.jsxs(V.Button,{id:"thread-comment-add",className:G.threadCommentPanelAdd,variant:"primary",onClick:i,disabled:w,children:[a.jsx(fe,{}),y.t("threadCommentUI.panel.addComment")]})]})]})};c.SetActiveCommentOperation=F,c.THREAD_COMMENT_PANEL=me,c.ThreadCommentPanel=Re,c.ThreadCommentTree=Ue,c.ToggleSheetCommentPanelOperation=ce,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
14
+ (function(c,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("@univerjs/core"),require("@univerjs/thread-comment"),require("@univerjs/ui"),require("rxjs"),require("react/jsx-runtime"),require("@univerjs/design"),require("react"),require("@univerjs/docs-ui")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/thread-comment","@univerjs/ui","rxjs","react/jsx-runtime","@univerjs/design","react","@univerjs/docs-ui"],l):(c=typeof globalThis<"u"?globalThis:c||self,l(c.UniverThreadCommentUi={},c.UniverCore,c.UniverThreadComment,c.UniverUi,c.rxjs,c.React,c.UniverDesign,c.React,c.UniverDocsUi))})(this,function(c,l,_,f,X,s,B,d,se){"use strict";var Ke=Object.defineProperty;var Ge=(c,l,_)=>l in c?Ke(c,l,{enumerable:!0,configurable:!0,writable:!0,value:_}):c[l]=_;var Y=(c,l,_)=>Ge(c,typeof l!="symbol"?l+"":l,_);var Se=Object.getOwnPropertyDescriptor,_e=(t,e,n,r)=>{for(var i=r>1?void 0:r?Se(e,n):e,a=t.length-1,v;a>=0;a--)(v=t[a])&&(i=v(i)||i);return i},ae=(t,e)=>(n,r)=>e(n,r,t);c.ThreadCommentPanelService=class extends l.Disposable{constructor(n,r){super();Y(this,"_panelVisible",!1);Y(this,"_panelVisible$",new X.BehaviorSubject(!1));Y(this,"_activeCommentId");Y(this,"_activeCommentId$",new X.BehaviorSubject(void 0));Y(this,"panelVisible$",this._panelVisible$.asObservable());Y(this,"activeCommentId$",this._activeCommentId$.asObservable());this._sidebarService=n,this._univerInstanceService=r,this._init(),this.disposeWithMe(()=>{this._activeCommentId$.complete(),this._panelVisible$.complete()})}_init(){this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(n=>{n.visible||this.setPanelVisible(!1)})),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(l.UniverInstanceType.UNIVER_SHEET).pipe(X.filter(n=>!n)).subscribe(()=>{this._sidebarService.close()}))}get panelVisible(){return this._panelVisible}get activeCommentId(){return this._activeCommentId}setPanelVisible(n){this._panelVisible=n,this._panelVisible$.next(n)}setActiveComment(n){this._activeCommentId=n,this._activeCommentId$.next(n)}},c.ThreadCommentPanelService=_e([ae(0,l.Inject(f.ISidebarService)),ae(1,l.IUniverInstanceService)],c.ThreadCommentPanelService);const oe="thread-comment-panel",Te="UNIVER_THREAD_COMMENT_UI_PLUGIN",de={id:"thread-comment-ui.operation.toggle-panel",type:l.CommandType.OPERATION,handler(t){const e=t.get(f.ISidebarService),n=t.get(c.ThreadCommentPanelService);return n.panelVisible?(e.close(),n.setPanelVisible(!1)):(e.open({header:{title:"threadCommentUI.panel.title"},children:{label:oe},width:330}),n.setPanelVisible(!0)),!0}},z={id:"thread-comment-ui.operation.set-active-comment",type:l.CommandType.OPERATION,handler(t,e){return t.get(c.ThreadCommentPanelService).setActiveComment(e),!0}},Ne="thread-comment-ui.config",ue={};var Ue=Object.defineProperty,we=Object.getOwnPropertyDescriptor,Oe=(t,e,n)=>e in t?Ue(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,De=(t,e,n,r)=>{for(var i=r>1?void 0:r?we(e,n):e,a=t.length-1,v;a>=0;a--)(v=t[a])&&(i=v(i)||i);return i},le=(t,e)=>(n,r)=>e(n,r,t),ce=(t,e,n)=>Oe(t,typeof e!="symbol"?e+"":e,n);c.UniverThreadCommentUIPlugin=class extends l.Plugin{constructor(e=ue,n,r,i){super(),this._config=e,this._injector=n,this._commandService=r,this._configService=i;const{menu:a,...v}=l.merge({},ue,this._config);a&&this._configService.setConfig("menu",a,{merge:!0}),this._configService.setConfig(Ne,v)}onStarting(){var e;l.mergeOverrideWithDependencies([[c.ThreadCommentPanelService]],(e=this._config)==null?void 0:e.overrides).forEach(n=>{this._injector.add(n)}),[de,z].forEach(n=>{this._commandService.registerCommand(n)})}},ce(c.UniverThreadCommentUIPlugin,"pluginName",Te),ce(c.UniverThreadCommentUIPlugin,"type",l.UniverInstanceType.UNIVER_UNKNOWN),c.UniverThreadCommentUIPlugin=De([l.DependentOn(_.UniverThreadCommentPlugin),le(1,l.Inject(l.Injector)),le(2,l.ICommandService),le(3,l.IConfigService)],c.UniverThreadCommentUIPlugin);var E=function(){return E=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},E.apply(this,arguments)},Ee=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n},K=d.forwardRef(function(t,e){var n=t.icon,r=t.id,i=t.className,a=t.extend,v=Ee(t,["icon","id","className","extend"]),C="univerjs-icon univerjs-icon-".concat(r," ").concat(i||"").trim(),I=d.useRef("_".concat(ke()));return ve(n,"".concat(r),{defIds:n.defIds,idSuffix:I.current},E({ref:e,className:C},v),a)});function ve(t,e,n,r,i){return d.createElement(t.tag,E(E({key:e},Me(t,n,i)),r),(je(t,n).children||[]).map(function(a,v){return ve(a,"".concat(e,"-").concat(t.tag,"-").concat(v),n,void 0,i)}))}function Me(t,e,n){var r=E({},t.attrs);n!=null&&n.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=n.colorChannel1),t.tag==="mask"&&r.id&&(r.id=r.id+e.idSuffix),Object.entries(r).forEach(function(a){var v=a[0],C=a[1];v==="mask"&&typeof C=="string"&&(r[v]=C.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))});var i=e.defIds;return!i||i.length===0||(t.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+e.idSuffix),Object.entries(r).forEach(function(a){var v=a[0],C=a[1];typeof C=="string"&&(r[v]=C.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),r}function je(t,e){var n,r=e.defIds;return!r||r.length===0?t:t.tag==="defs"&&(!((n=t.children)===null||n===void 0)&&n.length)?E(E({},t),{children:t.children.map(function(i){return typeof i.attrs.id=="string"&&r&&r.indexOf(i.attrs.id)>-1?E(E({},i),{attrs:E(E({},i.attrs),{id:i.attrs.id+e.idSuffix})}):i})}):t}function ke(){return Math.random().toString(36).substring(2,8)}K.displayName="UniverIcon";var Pe={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.3313 1.4667C5.3313 1.13533 5.59993.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443 14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443zM6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928 9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171 10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778 9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539 9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263 6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539 5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778 6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171z"}},{tag:"path",attrs:{fill:"currentColor",d:"M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z",fillRule:"evenodd",clipRule:"evenodd"}}]},me=d.forwardRef(function(t,e){return d.createElement(K,Object.assign({},t,{id:"delete-single",ref:e,icon:Pe}))});me.displayName="DeleteSingle";var $e={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z"}}]},fe=d.forwardRef(function(t,e){return d.createElement(K,Object.assign({},t,{id:"increase-single",ref:e,icon:$e}))});fe.displayName="IncreaseSingle";var He={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3 9C3.55228 9 4 8.55228 4 8 4 7.44772 3.55228 7 3 7 2.44772 7 2 7.44772 2 8 2 8.55228 2.44772 9 3 9zM8 9C8.55228 9 9 8.55228 9 8 9 7.44772 8.55228 7 8 7 7.44772 7 7 7.44772 7 8 7 8.55228 7.44772 9 8 9zM13 9C13.5523 9 14 8.55228 14 8 14 7.44772 13.5523 7 13 7 12.4477 7 12 7.44772 12 8 12 8.55228 12.4477 9 13 9z"}}]},he=d.forwardRef(function(t,e){return d.createElement(K,Object.assign({},t,{id:"more-horizontal-single",ref:e,icon:He}))});he.displayName="MoreHorizontalSingle";var Le={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{stroke:"currentColor",d:"M7.48389 10.3267V12.1905C7.48389 12.7428 7.9316 13.1905 8.48389 13.1905H11.2216L12.2955 14.2644L13.3695 13.1905H14.1593C14.7116 13.1905 15.1593 12.7428 15.1593 12.1905V8.46289C15.1593 7.91061 14.7116 7.46289 14.1593 7.46289H12.2955",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M0.840332 3.73535C0.840332 2.63078 1.73576 1.73535 2.84033 1.73535H10.2955C11.4001 1.73535 12.2955 2.63078 12.2955 3.73535V8.32676C12.2955 9.43132 11.4001 10.3268 10.2955 10.3268H5.6014L4.1695 11.7587L3.05978 10.3268H2.84033C1.73576 10.3268 0.840332 9.43133 0.840332 8.32676V3.73535Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M6.41016 6.1311H6.76813M8.91626 6.1311H9.27424M3.90454 6.1311H4.26252",strokeLinecap:"round",strokeWidth:1.2}}]},pe=d.forwardRef(function(t,e){return d.createElement(K,Object.assign({},t,{id:"reply-to-comment-single",ref:e,icon:Le}))});pe.displayName="ReplyToCommentSingle";var Ve={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6106 15.4036C12.4766 15.4036 15.6106 12.2696 15.6106 8.40356C15.6106 4.53757 12.4766 1.40356 8.6106 1.40356C4.7446 1.40356 1.6106 4.53757 1.6106 8.40356C1.6106 12.2696 4.7446 15.4036 8.6106 15.4036ZM12.3351 6.82773C12.5694 6.59342 12.5694 6.21352 12.3351 5.9792C12.1007 5.74489 11.7208 5.74489 11.4865 5.9792L7.91079 9.55494L6.33506 7.9792C6.10074 7.74489 5.72084 7.74489 5.48653 7.9792C5.25221 8.21352 5.25221 8.59342 5.48653 8.82773L7.48653 10.8277C7.72084 11.062 8.10074 11.062 8.33506 10.8277L12.3351 6.82773Z",fillRule:"evenodd",clipRule:"evenodd"}}]},ge=d.forwardRef(function(t,e){return d.createElement(K,Object.assign({},t,{id:"resolved-single",ref:e,icon:Ve}))});ge.displayName="ResolvedSingle";var Be={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"circle",attrs:{cx:8.73,cy:8.4,r:6.4,stroke:"currentColor",strokeWidth:1.2}},{tag:"path",attrs:{stroke:"currentColor",d:"M6.02637 8.40356L8.02637 10.4036L12.0264 6.40356",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.2}}]},Ce=d.forwardRef(function(t,e){return d.createElement(K,Object.assign({},t,{id:"solve-single",ref:e,icon:Be}))});Ce.displayName="SolveSingle";function Ie(t){return{id:"d",body:t,documentStyle:{}}}const be=d.forwardRef((t,e)=>{var L;const{comment:n,onSave:r,id:i,onCancel:a,autoFocus:v,unitId:C,type:I}=t,O=f.useDependency(l.ICommandService),M=f.useDependency(l.LocaleService),[F,j]=d.useState(!1),T=f.useDependency(se.IEditorService),h=d.useRef(null),p=I===l.UniverInstanceType.UNIVER_SHEET?l.DOCS_NORMAL_EDITOR_UNIT_ID_KEY:C,[k,N]=d.useState(()=>{var m,g,b;return l.BuildTextUtils.transform.getPlainText((b=(g=(m=h.current)==null?void 0:m.getDocumentData().body)==null?void 0:g.dataStream)!=null?b:"")});d.useEffect(()=>{var g,b,U,x;N(l.BuildTextUtils.transform.getPlainText((U=(b=(g=h.current)==null?void 0:g.getDocumentData().body)==null?void 0:b.dataStream)!=null?U:""));const m=(x=h.current)==null?void 0:x.selectionChange$.subscribe(()=>{var o,w,G;N(l.BuildTextUtils.transform.getPlainText((G=(w=(o=h.current)==null?void 0:o.getDocumentData().body)==null?void 0:w.dataStream)!=null?G:""))});return()=>m==null?void 0:m.unsubscribe()},[(L=h.current)==null?void 0:L.selectionChange$]);const q=d.useMemo(()=>({keyCodes:[{keyCode:f.KeyCode.ENTER}],handler:m=>{m===f.KeyCode.ENTER&&O.executeCommand(se.BreakLineCommand.id)}}),[O]);d.useImperativeHandle(e,()=>({reply(m){var b,U;if(!h.current)return;T.focus((b=h.current.getEditorId())!=null?b:"");const g=Ie(m);(U=h.current)==null||U.setDocumentData(g,[{startOffset:g.body.dataStream.length-2,endOffset:g.body.dataStream.length-2,collapsed:!0}])}}));const S=()=>{if(h.current){const m=l.Tools.deepClone(h.current.getDocumentData().body);j(!1),r==null||r({...n,text:m}),h.current.replaceText(""),setTimeout(()=>{var g,b;(g=h.current)==null||g.setSelectionRanges([]),(b=h.current)==null||b.blur()},10)}};return s.jsxs("div",{onClick:m=>m.preventDefault(),children:[s.jsx(se.RichTextEditor,{className:"univer-w-full",editorRef:h,autoFocus:v,keyboardEventConfig:q,placeholder:M.t("threadCommentUI.editor.placeholder"),initialValue:(n==null?void 0:n.text)&&Ie(n.text),onFocusChange:m=>m&&j(m),isSingle:!1,maxHeight:64,onClickOutside:()=>{setTimeout(()=>{T.focus(p)},30)}}),F?s.jsxs("div",{className:"univer-mt-3 univer-flex univer-flex-row univer-justify-end",children:[s.jsx(B.Button,{style:{marginRight:12},onClick:()=>{var m;a==null||a(),j(!1),(m=h.current)==null||m.replaceText("",!0),O.executeCommand(z.id)},children:M.t("threadCommentUI.editor.cancel")}),s.jsx(B.Button,{variant:"primary",disabled:!k,onClick:S,children:M.t(i?"threadCommentUI.editor.save":"threadCommentUI.editor.reply")})]}):null]})}),Ae=t=>{const{dataStream:e,customRanges:n}=t,r=e.endsWith(`\r
15
+ `)?e.length-2:e.length,i=[];let a=0;return n==null||n.forEach(v=>{a<v.startIndex&&i.push({type:"text",content:e.slice(a,v.startIndex)}),i.push({type:"mention",content:{label:e.slice(v.startIndex,v.endIndex+1),id:v.rangeId}}),a=v.endIndex+1}),i.push({type:"text",content:e.slice(a,r)}),i},We=t=>{const{paragraphs:e=[]}=t;let n=0;return e.map(r=>{const i=l.getBodySlice(t,n,r.startIndex);return n=r.startIndex+1,Ae(i)})},Fe=t=>{let e="";const n=[];return t.forEach(r=>{switch(r.type){case"text":e+=r.content;break;case"mention":{const i=e.length;e+=r.content.label;const a=e.length-1;n.push({rangeId:r.content.id,rangeType:l.CustomRangeType.MENTION,startIndex:i,endIndex:a,properties:{},wholeEntity:!0});break}}}),e+=`\r
16
+ `,{textRuns:[],paragraphs:[{startIndex:e.length-2,paragraphStyle:{}}],sectionBreaks:[{startIndex:e.length-1}],dataStream:e,customRanges:n}},xe="__mock__",qe=t=>{const{item:e,unitId:n,subUnitId:r,editing:i,onEditingChange:a,onReply:v,resolved:C,isRoot:I,onClose:O,onDeleteComment:M,type:F}=t,j=f.useDependency(l.ICommandService),T=f.useDependency(l.LocaleService),h=f.useDependency(l.UserManagerService),p=h.getUser(e.personId),k=f.useObservable(h.currentUser$),N=(k==null?void 0:k.userID)===e.personId,q=e.id===xe,[S,L]=d.useState(!1),m=f.useConfigValue(f.UI_PLUGIN_CONFIG_KEY),g=m==null?void 0:m.avatarFallback,b=()=>{(M==null?void 0:M(e))!==!1&&(j.executeCommand(I?_.DeleteCommentTreeCommand.id:_.DeleteCommentCommand.id,{unitId:n,subUnitId:r,commentId:e.id}),I&&(O==null||O()))};return s.jsxs("div",{className:"univer-relative univer-mb-3 univer-pl-[30px]",onMouseLeave:()=>L(!1),onMouseEnter:()=>L(!0),children:[s.jsx("div",{className:`
17
+ univer-absolute univer-left-0 univer-top-0 univer-h-6 univer-w-6 univer-rounded-full univer-bg-cover
18
+ univer-bg-center univer-bg-no-repeat
19
+ `,style:{backgroundImage:`url(${(p==null?void 0:p.avatar)||g})`}}),p?s.jsxs("div",{className:"univer-mb-1 univer-flex univer-h-6 univer-items-center univer-justify-between",children:[s.jsx("div",{className:"univer-text-sm univer-font-medium univer-leading-5",children:(p==null?void 0:p.name)||" "}),s.jsxs("div",{children:[q||C?null:S&&p?s.jsx("div",{className:`
20
+ univer-ml-1 univer-inline-flex univer-h-6 univer-w-6
21
+ univer-cursor-pointer univer-items-center univer-justify-center
22
+ univer-rounded-sm univer-text-base
23
+ hover:univer-bg-gray-50
24
+ `,onClick:()=>v(p),children:s.jsx(pe,{})}):null,N&&!q&&!C?s.jsx(B.Dropdown,{overlay:s.jsx("div",{className:"univer-rounded-lg",children:s.jsxs("ul",{className:`
25
+ univer-m-0 univer-box-border univer-grid univer-list-none
26
+ univer-p-1.5 univer-text-[13px] univer-text-sm
27
+ [&_a]:univer-block [&_a]:univer-cursor-pointer
28
+ [&_a]:univer-rounded [&_a]:univer-px-2 [&_a]:univer-py-1.5
29
+ [&_a]:univer-transition-colors
30
+ `,children:[s.jsx("li",{children:s.jsx("a",{className:"hover:univer-bg-gray-200",onClick:()=>a==null?void 0:a(!0),children:T.t("threadCommentUI.item.edit")})}),s.jsx("li",{children:s.jsx("a",{className:"hover:univer-bg-gray-200",onClick:b,children:T.t("threadCommentUI.item.delete")})})]})}),children:s.jsx("div",{className:`
31
+ univer-ml-1 univer-inline-flex univer-h-6 univer-w-6 univer-cursor-pointer
32
+ univer-items-center univer-justify-center univer-rounded-sm
33
+ univer-text-base
34
+ hover:univer-bg-gray-50
35
+ `,children:s.jsx(he,{})})}):null]})]}):null,s.jsx("div",{className:"univer-mb-1 univer-text-xs/normal univer-text-gray-600",children:e.dT}),i?s.jsx(be,{type:F,id:e.id,comment:e,onCancel:()=>a==null?void 0:a(!1),autoFocus:!0,unitId:n,subUnitId:r,onSave:({text:U,attachments:x})=>{a==null||a(!1),j.executeCommand(_.UpdateCommentCommand.id,{unitId:n,subUnitId:r,payload:{commentId:e.id,text:U,attachments:x}})}}):s.jsx("div",{className:"univer-text-[13px]/normal univer-text-gray-900",children:We(e.text).map((U,x)=>s.jsx("div",{className:"univer-break-words",children:U.map((o,w)=>{switch(o.type){case"mention":return s.jsxs("a",{className:"univer-text-primary-600",children:[o.content.label," "]},w);default:return o.content}})},x))})]})},ye=t=>{var ie,Q,u;const{id:e,unitId:n,subUnitId:r,refStr:i,showEdit:a=!0,onClick:v,showHighlight:C,onClose:I,getSubUnitName:O,prefix:M,autoFocus:F,onMouseEnter:j,onMouseLeave:T,onAddComment:h,onDeleteComment:p,onResolve:k,type:N,style:q,full:S}=t,L=f.useDependency(_.ThreadCommentModel),[m,g]=d.useState(!1),[b,U]=d.useState(""),x=d.useMemo(()=>L.commentUpdate$.pipe(X.debounceTime(16)),[L]);f.useObservable(x);const o=e?L.getCommentWithChildren(n,r,e):null,w=f.useDependency(l.ICommandService),G=f.useDependency(l.UserManagerService),P=o==null?void 0:o.root.resolved,$=f.useObservable(G.currentUser$),A=d.useRef(null),R=[...o?[o.root]:[{id:xe,text:{dataStream:`
36
+ \r`},personId:(ie=$==null?void 0:$.userID)!=null?ie:"",ref:i!=null?i:"",dT:"",unitId:n,subUnitId:r,threadId:""}],...(Q=o==null?void 0:o.children)!=null?Q:[]],V=d.useRef(null),ee=y=>{y.stopPropagation(),P?w.executeCommand(z.id,{unitId:n,subUnitId:r,commentId:e}):w.executeCommand(z.id),w.executeCommand(_.ResolveCommentCommand.id,{unitId:n,subUnitId:r,commentId:e,resolved:!P}),k==null||k(!P)},J=y=>{y.stopPropagation(),w.executeCommand(z.id),!(o!=null&&o.root&&(p==null?void 0:p(o.root))===!1)&&(w.executeCommand(_.DeleteCommentTreeCommand.id,{unitId:n,subUnitId:r,commentId:e}),I==null||I())};d.useEffect(()=>T==null?void 0:T(),[]);const ne=O((u=o==null?void 0:o.root.subUnitId)!=null?u:r),te=a&&!b&&!P,re=`${i||(o==null?void 0:o.root.ref)||""}${ne?" · ":""}${ne}`;return s.jsxs("div",{className:B.clsx(`
37
+ univer-relative univer-box-border univer-rounded-lg univer-border univer-border-solid
38
+ univer-border-gray-200 univer-bg-white univer-p-4
39
+ `,S?"univer-w-full":"univer-w-[278px]",{"univer-shadow":!P&&(C||m||M==="cell")}),style:q,onClick:v,id:`${M}-${n}-${r}-${e}`,onMouseEnter:()=>{j==null||j(),g(!0)},onMouseLeave:()=>{T==null||T(),g(!1)},children:[!P&&C?s.jsx("div",{className:`
40
+ univer-absolute univer-left-0 univer-right-0 univer-top-0 univer-h-1.5 univer-rounded-t-md
41
+ univer-bg-yellow-400
42
+ `}):null,s.jsxs("div",{className:`
43
+ univer-mb-4 univer-flex univer-flex-row univer-items-center univer-justify-between univer-text-sm
44
+ univer-leading-5
45
+ `,children:[s.jsxs("div",{className:"univer-flex univer-flex-1 univer-flex-row univer-items-center univer-overflow-hidden",children:[s.jsx("div",{className:`
46
+ univer-mr-2 univer-h-3.5 univer-w-[3px] univer-flex-shrink-0 univer-flex-grow-0
47
+ univer-rounded-sm univer-bg-yellow-400
48
+ `}),s.jsx(B.Tooltip,{showIfEllipsis:!0,title:re,children:s.jsx("div",{className:`
49
+ univer-flex-1 univer-overflow-hidden univer-text-ellipsis univer-whitespace-nowrap
50
+ `,children:re})})]}),o?s.jsxs("div",{className:"univer-flex univer-flex-shrink-0 univer-flex-grow-0 univer-flex-row",children:[s.jsx("div",{onClick:ee,className:B.clsx(`
51
+ univer-ml-1 univer-inline-flex univer-h-6 univer-w-6 univer-cursor-pointer
52
+ univer-items-center univer-justify-center univer-rounded-[3px] univer-text-base
53
+ hover:univer-bg-gray-50
54
+ `,{"univer-text-green-500":P}),children:P?s.jsx(ge,{}):s.jsx(Ce,{})}),($==null?void 0:$.userID)===o.root.personId?s.jsx("div",{className:`
55
+ univer-ml-1 univer-inline-flex univer-h-6 univer-w-6 univer-cursor-pointer
56
+ univer-items-center univer-justify-center univer-rounded-[3px]
57
+ univer-text-base
58
+ hover:univer-bg-gray-50
59
+ `,onClick:J,children:s.jsx(me,{})}):null]}):null]}),s.jsx("div",{ref:V,className:"univer-max-h-[300px] univer-overflow-y-auto univer-overflow-x-hidden",children:R.map(y=>s.jsx(qe,{onClose:I,unitId:n,subUnitId:r,item:y,isRoot:y.id===(o==null?void 0:o.root.id),editing:b===y.id,resolved:o==null?void 0:o.root.resolved,type:N,onEditingChange:H=>{U(H?y.id:"")},onReply:H=>{H&&requestAnimationFrame(()=>{var W;(W=A.current)==null||W.reply(Fe([{type:"mention",content:{id:H.userID,label:`@${H.name}`}},{type:"text",content:" "}]))})},onAddComment:h,onDeleteComment:p},y.id))}),te?s.jsx("div",{children:s.jsx(be,{ref:A,type:N,unitId:n,subUnitId:r,onSave:async({text:y,attachments:H})=>{const W={text:y,attachments:H,dT:_.getDT(),id:l.generateRandomId(),ref:i,personId:$==null?void 0:$.userID,parentId:o==null?void 0:o.root.id,unitId:n,subUnitId:r,threadId:o==null?void 0:o.root.threadId};(h==null?void 0:h(W))!==!1&&(await w.executeCommand(_.AddCommentCommand.id,{unitId:n,subUnitId:r,comment:W}),V.current&&(V.current.scrollTop=V.current.scrollHeight))},autoFocus:F||!o,onCancel:()=>{o||I==null||I()}},`${F}`)}):null]})},ze=t=>{const{unitId:e,subUnitId$:n,type:r,onAdd:i,getSubUnitName:a,onResolve:v,sortComments:C,onItemLeave:I,onItemEnter:O,disableAdd:M,tempComment:F,onAddComment:j,onDeleteComment:T,showComments:h}=t,[p,k]=d.useState("all"),[N,q]=d.useState("all"),S=f.useDependency(l.LocaleService),L=f.useDependency(l.UserManagerService),m=f.useDependency(_.ThreadCommentModel),[g,b]=d.useState(()=>m.getUnit(e)),U=f.useDependency(c.ThreadCommentPanelService),x=f.useObservable(U.activeCommentId$),o=f.useObservable(m.commentUpdate$),w=f.useDependency(l.ICommandService),G=f.useObservable(n),P=d.useRef(!0),$="panel",A=f.useObservable(L.currentUser$),R=d.useMemo(()=>{var W;const u=p==="all"?g:(W=g.filter(D=>D.subUnitId===G))!=null?W:[],y=C!=null?C:D=>D,H=u.map(D=>{var Z;return{...D.root,children:(Z=D.children)!=null?Z:[],users:D.relativeUsers}});if(h){const D=new Map;return H.forEach(Z=>{D.set(Z.id,Z)}),[...h,""].map(Z=>D.get(Z)).filter(Boolean)}else return y(H)},[h,p,g,C,G]),V=d.useMemo(()=>[...R.filter(u=>!u.resolved),...R.filter(u=>u.resolved)],[R]),ee=d.useMemo(()=>N==="resolved"?V.filter(u=>u.resolved):N==="unsolved"?V.filter(u=>!u.resolved):N==="concern_me"&&A!=null&&A.userID?V.filter(u=>u==null?void 0:u.users.has(A.userID)):V,[V,A==null?void 0:A.userID,N]),J=F?[F,...ee]:ee,ne=J.filter(u=>!u.resolved),te=J.filter(u=>u.resolved),re=N!=="all"||p!=="all",ie=()=>{q("all"),k("all")};d.useEffect(()=>{e&&b(m.getUnit(e))},[e,m,o]),d.useEffect(()=>{var D;if(!x)return;if(!P.current){P.current=!0;return}const{unitId:u,subUnitId:y,commentId:H}=x,W=`${$}-${u}-${y}-${H}`;(D=document.getElementById(W))==null||D.scrollIntoView({block:"center"})},[x]);const Q=u=>s.jsx(ye,{full:!0,prefix:$,getSubUnitName:a,id:u.id,unitId:u.unitId,subUnitId:u.subUnitId,refStr:u.ref,type:r,showEdit:(x==null?void 0:x.commentId)===u.id,showHighlight:(x==null?void 0:x.commentId)===u.id,onClick:()=>{P.current=!1,u.resolved?w.executeCommand(z.id):w.executeCommand(z.id,{unitId:u.unitId,subUnitId:u.subUnitId,commentId:u.id,temp:!1})},onMouseEnter:()=>O==null?void 0:O(u),onMouseLeave:()=>I==null?void 0:I(u),onAddComment:j,onDeleteComment:T,onResolve:y=>v==null?void 0:v(u.id,y)},u.id);return s.jsxs("div",{className:"univer-flex univer-min-h-full univer-flex-col univer-pb-3",children:[s.jsxs("div",{className:"univer-mt-3 univer-flex univer-flex-row univer-justify-between",children:[r===l.UniverInstanceType.UNIVER_SHEET?s.jsx(B.Select,{borderless:!0,value:p,options:[{value:"current",label:S.t("threadCommentUI.filter.sheet.current")},{value:"all",label:S.t("threadCommentUI.filter.sheet.all")}],onChange:k}):null,s.jsx(B.Select,{borderless:!0,value:N,options:[{value:"all",label:S.t("threadCommentUI.filter.status.all")},{value:"resolved",label:S.t("threadCommentUI.filter.status.resolved")},{value:"unsolved",label:S.t("threadCommentUI.filter.status.unsolved")},{value:"concern_me",label:S.t("threadCommentUI.filter.status.concernMe")}],onChange:q})]}),J.length===0?s.jsxs("div",{className:`
60
+ univer-flex univer-flex-1 univer-flex-col univer-items-center univer-justify-center
61
+ univer-text-[13px] univer-text-gray-600
62
+ `,children:[S.t("threadCommentUI.panel.empty"),re?s.jsx("div",{className:"univer-mt-2 univer-flex univer-flex-row",children:s.jsx(B.Button,{onClick:ie,children:S.t("threadCommentUI.panel.reset")})}):M?null:s.jsx("div",{className:"univer-mt-2 univer-flex univer-flex-row",children:s.jsxs(B.Button,{onClick:i,children:[s.jsx(fe,{className:"univer-mr-1.5"}),S.t("threadCommentUI.panel.add")]})})]}):s.jsxs("div",{className:"univer-mt-3 univer-flex univer-flex-col univer-gap-3",children:[ne.map(Q),te.length>0&&s.jsx("div",{className:"univer-text-xs",children:S.t("threadCommentUI.panel.solved")}),te.map(Q)]})]})};c.SetActiveCommentOperation=z,c.THREAD_COMMENT_PANEL=oe,c.ThreadCommentPanel=ze,c.ThreadCommentTree=ye,c.ToggleSheetCommentPanelOperation=de,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
22
63
 
23
64
 
24
65
  // @univerjs/sheets-thread-comment-ui/index
25
- (function(c,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/sheets-thread-comment"),require("@univerjs/thread-comment-ui"),require("@univerjs/sheets-ui"),require("@univerjs/ui"),require("rxjs"),require("@univerjs/engine-render"),require("@univerjs/engine-formula"),require("@univerjs/thread-comment"),require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","@univerjs/sheets-thread-comment","@univerjs/thread-comment-ui","@univerjs/sheets-ui","@univerjs/ui","rxjs","@univerjs/engine-render","@univerjs/engine-formula","@univerjs/thread-comment","react/jsx-runtime","react"],s):(c=typeof globalThis<"u"?globalThis:c||self,s(c.UniverSheetsThreadCommentUi={},c.UniverCore,c.UniverSheets,c.UniverSheetsThreadComment,c.UniverThreadCommentUi,c.UniverSheetsUi,c.UniverUi,c.rxjs,c.UniverEngineRender,c.UniverEngineFormula,c.UniverThreadComment,c.React,c.React))})(this,function(c,s,p,N,g,b,v,H,ne,A,f,re,O){"use strict";var Fe=Object.defineProperty;var qe=(c,s,p)=>s in c?Fe(c,s,{enumerable:!0,configurable:!0,writable:!0,value:p}):c[s]=p;var D=(c,s,p)=>qe(c,typeof s!="symbol"?s+"":s,p);const ie="univer.sheet.thread-comment-modal",Y="comment-single",J="SHEET_THREAD_COMMENT";var he=Object.getOwnPropertyDescriptor,le=(n,t,r,e)=>{for(var i=e>1?void 0:e?he(t,r):t,o=n.length-1,a;o>=0;o--)(a=n[o])&&(i=a(i)||i);return i},oe=(n,t)=>(r,e)=>t(r,e,n);c.SheetsThreadCommentPopupService=class extends s.Disposable{constructor(r,e){super();D(this,"_lastPopup",null);D(this,"_activePopup");D(this,"_activePopup$",new H.BehaviorSubject(null));D(this,"activePopup$",this._activePopup$.asObservable());this._canvasPopupManagerService=r,this._zenZoneService=e,this._initZenVisible(),this.disposeWithMe(()=>{this._activePopup$.complete()})}get activePopup(){return this._activePopup}_initZenVisible(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(r=>{r&&this.hidePopup()}))}showPopup(r,e){var l;const{row:i,col:o,unitId:a,subUnitId:d}=r;if(this._activePopup&&i===this._activePopup.row&&o===this._activePopup.col&&a===this._activePopup.unitId&&d===((l=this.activePopup)==null?void 0:l.subUnitId)){this._activePopup=r,this._activePopup$.next(r);return}if(this._lastPopup&&this._lastPopup.dispose(),this._zenZoneService.visible)return;this._activePopup=r,this._activePopup$.next(r);const u=this._canvasPopupManagerService.attachPopupToCell(i,o,{componentKey:ie,onClickOutside:()=>{this.hidePopup()},direction:"horizontal",excludeOutside:[...Array.from(document.querySelectorAll(".univer-thread-comment")),document.getElementById("thread-comment-add")].filter(Boolean)});if(!u)throw new Error("[SheetsThreadCommentPopupService]: cannot show popup!");const m=new s.DisposableCollection;m.add(u),m.add({dispose:()=>{e==null||e()}}),this._lastPopup=m}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))}},c.SheetsThreadCommentPopupService=le([oe(0,s.Inject(b.SheetCanvasPopManagerService)),oe(1,v.IZenZoneService)],c.SheetsThreadCommentPopupService);const V={type:s.CommandType.OPERATION,id:"sheets.operation.show-comment-modal",handler(n){var I;const t=n.get(p.SheetsSelectionsService),r=n.get(s.IUniverInstanceService),e=n.get(c.SheetsThreadCommentPopupService),i=n.get(g.ThreadCommentPanelService),o=(I=t.getCurrentLastSelection())==null?void 0:I.primary,a=n.get(N.SheetsThreadCommentModel);if(!o)return!1;const d=p.getSheetCommandTarget(r);if(!d)return!1;const{workbook:u,worksheet:m,unitId:l,subUnitId:h}=d,S={workbook:u,worksheet:m,unitId:l,subUnitId:h,row:o.startRow,col:o.startColumn};e.showPopup(S);const _=a.getByLocation(l,h,o.startRow,o.startColumn);return _&&i.setActiveComment({unitId:l,subUnitId:h,commentId:_,trigger:"context-menu"}),!0}},pe="sheets-thread-comment.config",se={};var ve=Object.getOwnPropertyDescriptor,Se=(n,t,r,e)=>{for(var i=e>1?void 0:e?ve(t,r):t,o=n.length-1,a;o>=0;o--)(a=n[o])&&(i=a(i)||i);return i},L=(n,t)=>(r,e)=>t(r,e,n);let W=class extends s.Disposable{constructor(n,t,r,e){super(),this._sheetInterceptorService=n,this._sheetsThreadCommentModel=t,this._univerInstanceService=r,this._renderManagerService=e,this._initViewModelIntercept(),this._initSkeletonChange()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(p.INTERCEPTOR_POINT.CELL_CONTENT,{effect:s.InterceptorEffectEnum.Style,handler:(n,t,r)=>{const{row:e,col:i,unitId:o,subUnitId:a}=t;return this._sheetsThreadCommentModel.showCommentMarker(o,a,e,i)?r({...n,markers:{...n==null?void 0:n.markers,tr:{color:"#FFBD37",size:6}}}):r(n)},priority:100}))}_initSkeletonChange(){const n=()=>{var i;const t=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!t)return;const r=t.getUnitId(),e=this._renderManagerService.getRenderById(r);(i=e==null?void 0:e.mainComponent)==null||i.makeForceDirty()};this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(H.debounceTime(16)).subscribe(()=>{n()}))}};W=Se([L(0,s.Inject(p.SheetInterceptorService)),L(1,s.Inject(N.SheetsThreadCommentModel)),L(2,s.IUniverInstanceService),L(3,ne.IRenderManagerService)],W);var Ce=Object.getOwnPropertyDescriptor,_e=(n,t,r,e)=>{for(var i=e>1?void 0:e?Ce(t,r):t,o=n.length-1,a;o>=0;o--)(a=n[o])&&(i=a(i)||i);return i},Q=(n,t)=>(r,e)=>t(r,e,n);const fe=(n,t,r)=>{const e=A.singleReferenceToGrid(n),i=r.row-t.row,o=r.column-t.column,a={startColumn:e.column+o,startRow:e.row+i,endColumn:e.column+o,endRow:e.row+i};return A.serializeRange(a)};let x=class extends s.Disposable{constructor(t,r,e){super();D(this,"_copyInfo");this._sheetClipboardService=t,this._sheetsThreadCommentModel=r,this._threadCommentDataSourceService=e,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:J,onBeforeCopy:(t,r,e)=>{this._copyInfo={unitId:t,subUnitId:r,range:e}},onPasteCells:(t,r,e,i)=>{const{unitId:o,subUnitId:a,range:d}=r,u={row:d.rows[0],column:d.cols[0]};if(i.copyType===b.COPY_TYPE.CUT&&this._copyInfo){const{range:m,unitId:l,subUnitId:h}=this._copyInfo,S={row:m.startRow,column:m.startColumn};if(!(o===l&&a===h)){const _=[];s.Range.foreach(m,(w,C)=>{const E=this._sheetsThreadCommentModel.getAllByLocation(l,h,w,C);this._threadCommentDataSourceService.syncUpdateMutationToColla?E.forEach(P=>{_.push(P)}):E.forEach(({children:P,...j})=>{j.parentId||_.push(j)})});const I=[],M=[],$=[],B=[],te=w=>{I.unshift({id:f.DeleteCommentMutation.id,params:{unitId:l,subUnitId:h,commentId:w.id}}),$.push({id:f.AddCommentMutation.id,params:{unitId:o,subUnitId:a,comment:{...w,ref:fe(w.ref,S,u),unitId:o,subUnitId:a},sync:!0}}),M.push({id:f.AddCommentMutation.id,params:{unitId:l,subUnitId:h,comment:w,sync:!0}}),B.unshift({id:f.DeleteCommentMutation.id,params:{unitId:o,subUnitId:a,commentId:w.id}})};return _.forEach(w=>{te(w)}),{redos:[...I,...$],undos:[...B,...M]}}}return{redos:[],undos:[]}}}))}};x=_e([Q(0,s.Inject(b.ISheetClipboardService)),Q(1,s.Inject(N.SheetsThreadCommentModel)),Q(2,f.IThreadCommentDataSourceService)],x);var Ie=Object.getOwnPropertyDescriptor,ge=(n,t,r,e)=>{for(var i=e>1?void 0:e?Ie(t,r):t,o=n.length-1,a;o>=0;o--)(a=n[o])&&(i=a(i)||i);return i},F=(n,t)=>(r,e)=>t(r,e,n);let q=class extends s.Disposable{constructor(n,t,r,e){super(),this._hoverManagerService=n,this._sheetsThreadCommentPopupService=t,this._sheetsThreadCommentModel=r,this._sheetPermissionCheckController=e,this._initHoverEvent()}_initHoverEvent(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(H.debounceTime(100)).subscribe(n=>{const t=this._sheetsThreadCommentPopupService.activePopup;if(n&&(t&&t.temp||!t)){const{location:r}=n,{unitId:e,subUnitId:i,row:o,col:a}=r,d=this._sheetsThreadCommentModel.getByLocation(e,i,o,a);if(d){if(!this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]},[{startRow:o,startColumn:a,endRow:o,endColumn:a}]))return;const m=this._sheetsThreadCommentModel.getComment(e,i,d);m&&!m.resolved&&this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:i,row:o,col:a,commentId:d,temp:!0})}else t&&this._sheetsThreadCommentPopupService.hidePopup()}}))}};q=ge([F(0,s.Inject(b.HoverManagerService)),F(1,s.Inject(c.SheetsThreadCommentPopupService)),F(2,s.Inject(N.SheetsThreadCommentModel)),F(3,s.Inject(p.SheetPermissionCheckController))],q);var Pe=Object.getOwnPropertyDescriptor,Te=(n,t,r,e)=>{for(var i=e>1?void 0:e?Pe(t,r):t,o=n.length-1,a;o>=0;o--)(a=n[o])&&(i=a(i)||i);return i},R=(n,t)=>(r,e)=>t(r,e,n);let G=class extends s.Disposable{constructor(t,r,e,i,o,a,d,u,m,l){super();D(this,"_isSwitchToCommenting",!1);D(this,"_selectionShapeInfo",null);this._commandService=t,this._sheetsThreadCommentPopupService=r,this._sheetsThreadCommentModel=e,this._threadCommentPanelService=i,this._univerInstanceService=o,this._sheetPermissionCheckController=a,this._markSelectionService=d,this._sheetSelectionService=u,this._editorBridgeService=m,this._renderManagerService=l,this._initCommandListener(),this._initPanelListener(),this._initMarkSelection(),this._initSelectionUpdateListener(),this._initEditorBridge()}_handleSelectionChange(t,r,e){var S,_,I;const i=(S=t[0])==null?void 0:S.range,o=this._renderManagerService.getRenderById(r),a=(_=o==null?void 0:o.with(b.SheetSkeletonManagerService).getSkeletonParam(e))==null?void 0:_.skeleton;if(!a||!i)return;const d=a.getCellWithCoordByIndex(i.startRow,i.startColumn);if((((I=i.rangeType)!=null?I:s.RANGE_TYPE.NORMAL)!==s.RANGE_TYPE.NORMAL||i.endColumn-i.startColumn>0||i.endRow-i.startRow>0)&&!((d.isMerged||d.isMergedMainCell)&&s.Rectangle.equals(d.mergeInfo,i))){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(g.SetActiveCommentOperation.id);return}const m=d.actualRow,l=d.actualColumn;if(!this._sheetsThreadCommentModel.showCommentMarker(r,e,m,l)){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(g.SetActiveCommentOperation.id);return}const h=this._sheetsThreadCommentModel.getByLocation(r,e,m,l);h&&this._commandService.executeCommand(g.SetActiveCommentOperation.id,{unitId:r,subUnitId:e,commentId:h})}_initSelectionUpdateListener(){this.disposeWithMe(this._sheetSelectionService.selectionMoveEnd$.subscribe(t=>{if(this._isSwitchToCommenting)return;const r=this._sheetSelectionService.currentSelectionParam;r&&this._handleSelectionChange(t,r.unitId,r.sheetId)}))}_initEditorBridge(){this.disposeWithMe(this._editorBridgeService.visible$.subscribe(t=>{t.visible&&this._sheetsThreadCommentPopupService.hidePopup()}))}_initCommandListener(){this._commandService.onCommandExecuted(t=>{if(t.id===f.DeleteCommentMutation.id){const r=t.params,e=this._sheetsThreadCommentPopupService.activePopup;if(!e)return;const{unitId:i,subUnitId:o,commentId:a}=e;r.unitId===i&&r.subUnitId===o&&r.commentId===a&&this._sheetsThreadCommentPopupService.hidePopup()}})}_initPanelListener(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(async t=>{var r;if(t){const{unitId:e,subUnitId:i,commentId:o,trigger:a}=t,d=this._sheetsThreadCommentModel.getComment(e,i,o);if(!d||d.resolved)return;const u=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!u||u.getUnitId()!==e)return;this._isSwitchToCommenting=!0,((r=u.getActiveSheet())==null?void 0:r.getSheetId())!==i&&await this._commandService.executeCommand(p.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:i}),this._isSwitchToCommenting=!1;const h=A.singleReferenceToGrid(d.ref),{row:S,column:_}=h;if(!this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]},[{startRow:S,startColumn:_,endRow:S,endColumn:_}]))return;const M=1;if(await this._commandService.executeCommand(b.ScrollToRangeOperation.id,{range:{startRow:Math.max(h.row-M,0),endRow:h.row+M,startColumn:Math.max(h.column-M,0),endColumn:h.column+M}}),this._editorBridgeService.isVisible().visible)return;this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:i,row:h.row,col:h.column,commentId:d.id,trigger:a})}else this._sheetsThreadCommentPopupService.hidePopup()}))}_initMarkSelection(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe(H.debounceTime(100)).subscribe(t=>{var S,_;if(!t){this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);return}const{unitId:r,subUnitId:e,commentId:i}=t;this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);const o=this._sheetsThreadCommentModel.getComment(r,e,i);if(!o)return;const a=A.singleReferenceToGrid(o.ref),{row:d,column:u}=a;if(Number.isNaN(d)||Number.isNaN(u))return null;const m=(S=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET))==null?void 0:S.getSheetBySheetId(e),l=(_=m==null?void 0:m.getMergedCell(d,u))!=null?_:{startColumn:u,endColumn:u,startRow:d,endRow:d},h=this._markSelectionService.addShape({range:l,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null},[],-1);h&&(this._selectionShapeInfo={...t,shapeId:h})}))}};G=Te([R(0,s.ICommandService),R(1,s.Inject(c.SheetsThreadCommentPopupService)),R(2,s.Inject(N.SheetsThreadCommentModel)),R(3,s.Inject(g.ThreadCommentPanelService)),R(4,s.IUniverInstanceService),R(5,s.Inject(p.SheetPermissionCheckController)),R(6,b.IMarkSelectionService),R(7,s.Inject(p.SheetsSelectionsService)),R(8,b.IEditorBridgeService),R(9,ne.IRenderManagerService)],G);var be=Object.getOwnPropertyDescriptor,ye=(n,t,r,e)=>{for(var i=e>1?void 0:e?be(t,r):t,o=n.length-1,a;o>=0;o--)(a=n[o])&&(i=a(i)||i);return i},Z=(n,t)=>(r,e)=>t(r,e,n);let z=class extends s.Disposable{constructor(n,t,r,e){super(),this._sheetInterceptorService=n,this._univerInstanceService=t,this._threadCommentModel=r,this._threadCommentDataSourceService=e,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:n=>{var t;if(n.id===p.RemoveSheetCommand.id){const r=n.params,e=r.unitId?this._univerInstanceService.getUnit(r.unitId):this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!e)return{redos:[],undos:[]};const i=e.getUnitId(),o=r.subUnitId||((t=e.getActiveSheet())==null?void 0:t.getSheetId());if(!o)return{redos:[],undos:[]};const a=this._threadCommentModel.ensureMap(i,o),d=Array.from(a.values()).filter(S=>!S.parentId),u=d.map(S=>S.id),m=this._threadCommentDataSourceService.syncUpdateMutationToColla,l=u.map(S=>({id:f.DeleteCommentMutation.id,params:{unitId:i,subUnitId:o,commentId:S}})),h=d.map(({children:S,..._})=>({id:f.AddCommentMutation.id,params:{unitId:i,subUnitId:o,comment:{..._,children:m?S:void 0},sync:!m}}));return{redos:l,undos:h}}return{redos:[],undos:[]}}}))}};z=ye([Z(0,s.Inject(p.SheetInterceptorService)),Z(1,s.IUniverInstanceService),Z(2,s.Inject(f.ThreadCommentModel)),Z(3,f.IThreadCommentDataSourceService)],z);var y=function(){return y=Object.assign||function(n){for(var t,r=1,e=arguments.length;r<e;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}return n},y.apply(this,arguments)},Me=function(n,t){var r={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&t.indexOf(e)<0&&(r[e]=n[e]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,e=Object.getOwnPropertySymbols(n);i<e.length;i++)t.indexOf(e[i])<0&&Object.prototype.propertyIsEnumerable.call(n,e[i])&&(r[e[i]]=n[e[i]]);return r},ae=O.forwardRef(function(n,t){var r=n.icon,e=n.id,i=n.className,o=n.extend,a=Me(n,["icon","id","className","extend"]),d="univerjs-icon univerjs-icon-".concat(e," ").concat(i||"").trim(),u=O.useRef("_".concat(Ue()));return ce(r,"".concat(e),{defIds:r.defIds,idSuffix:u.current},y({ref:t,className:d},a),o)});function ce(n,t,r,e,i){return O.createElement(n.tag,y(y({key:t},we(n,r,i)),e),(Ee(n,r).children||[]).map(function(o,a){return ce(o,"".concat(t,"-").concat(n.tag,"-").concat(a),r,void 0,i)}))}function we(n,t,r){var e=y({},n.attrs);r!=null&&r.colorChannel1&&e.fill==="colorChannel1"&&(e.fill=r.colorChannel1),n.tag==="mask"&&e.id&&(e.id=e.id+t.idSuffix),Object.entries(e).forEach(function(o){var a=o[0],d=o[1];a==="mask"&&typeof d=="string"&&(e[a]=d.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))});var i=t.defIds;return!i||i.length===0||(n.tag==="use"&&e["xlink:href"]&&(e["xlink:href"]=e["xlink:href"]+t.idSuffix),Object.entries(e).forEach(function(o){var a=o[0],d=o[1];typeof d=="string"&&(e[a]=d.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),e}function Ee(n,t){var r,e=t.defIds;return!e||e.length===0?n:n.tag==="defs"&&(!((r=n.children)===null||r===void 0)&&r.length)?y(y({},n),{children:n.children.map(function(i){return typeof i.attrs.id=="string"&&e&&e.indexOf(i.attrs.id)>-1?y(y({},i),{attrs:y(y({},i.attrs),{id:i.attrs.id+t.idSuffix})}):i})}):n}function Ue(){return Math.random().toString(36).substring(2,8)}ae.displayName="UniverIcon";var Oe={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521C5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345ZM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521C8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345ZM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521C11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521 5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345zM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521 8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345zM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521 11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.84351 3.41861C1.84351 3.01861 2.15531 2.69434 2.53993 2.69434H14.9381C15.3228 2.69434 15.6346 3.01861 15.6346 3.41861V12.4611C15.6346 12.8612 15.3228 13.1854 14.9381 13.1854H8.82117L6.06643 14.6179C5.85054 14.7301 5.59416 14.7181 5.38884 14.5862C5.18352 14.4542 5.05855 14.2211 5.05855 13.9701V13.1854H2.53993C2.15531 13.1854 1.84351 12.8612 1.84351 12.4611L1.84351 3.41861ZM6.45141 12.7982L8.34531 12.0135C8.44201 11.9632 8.54864 11.9371 8.65676 11.9371H14.2417C14.3522 11.9371 14.4417 11.8475 14.4417 11.7371V4.14271C14.4417 4.03225 14.3522 3.94271 14.2417 3.94271H3.23636C3.12591 3.94271 3.03636 4.03225 3.03636 4.14271L3.03636 11.7371C3.03636 11.8475 3.12591 11.9371 3.23636 11.9371L5.75498 11.9371C6.1396 11.9371 6.45141 12.0611 6.45141 12.4611V12.7982Z",fillRule:"evenodd",clipRule:"evenodd"}}]},de=O.forwardRef(function(n,t){return O.createElement(ae,Object.assign({},n,{id:"comment-single",ref:t,icon:Oe}))});de.displayName="CommentSingle";const Re=()=>{const n=v.useDependency(s.IUniverInstanceService),t=v.useDependency(c.SheetsThreadCommentPopupService),r=v.useObservable(t.activePopup$),e=v.useDependency(N.SheetsThreadCommentModel);if(v.useObservable(e.commentUpdate$),!r)return null;const{row:i,col:o,unitId:a,subUnitId:d,trigger:u}=r,m=e.getByLocation(a,d,i,o),l=`${s.Tools.chatAtABC(o)}${i+1}`,h=()=>{t.hidePopup()},S=_=>{var I,M,$;return($=(M=(I=n.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET))==null?void 0:I.getSheetBySheetId(_))==null?void 0:M.getName())!=null?$:""};return re.jsx(g.ThreadCommentTree,{onClick:()=>{t.persistPopup()},prefix:"cell",id:m,unitId:a,subUnitId:d,type:s.UniverInstanceType.UNIVER_SHEET,refStr:l,onClose:h,getSubUnitName:S,autoFocus:u==="context-menu"})},je=()=>{var w;const n=v.useDependency(b.IMarkSelectionService),t=v.useDependency(s.IUniverInstanceService),r=v.useDependency(c.SheetsThreadCommentPopupService),e=t.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET),i=e.getUnitId(),o=v.useDependency(s.ICommandService),a=O.useMemo(()=>e.activeSheet$.pipe(H.map(C=>C==null?void 0:C.getSheetId())),[e.activeSheet$]),d=v.useObservable(a,(w=e.getActiveSheet())==null?void 0:w.getSheetId()),u=O.useRef(null),m=v.useDependency(g.ThreadCommentPanelService),l=v.useObservable(m.activeCommentId$),h=v.useObservable(m.panelVisible$,m.panelVisible),S=O.useCallback(C=>{const E=e.getSheets(),P={};E.forEach((U,T)=>{P[U.getSheetId()]=T});const j=U=>U.map(T=>{var me;const k=A.singleReferenceToGrid(T.ref),xe=[(me=P[T.subUnitId])!=null?me:0,k.row,k.column];return{...T,p:xe}}).sort((T,k)=>T.p[0]===k.p[0]?T.p[1]===k.p[1]?T.p[2]-k.p[2]:T.p[1]-k.p[1]:T.p[0]-k.p[0]);return[...j(C.filter(U=>!U.resolved)),...j(C.filter(U=>U.resolved))]},[e]),_=O.useCallback(C=>{var E;if(C.unitId===i&&C.subUnitId===d&&!C.resolved){const{row:P,column:j}=A.singleReferenceToGrid(C.ref),U=e.getSheetBySheetId(C.subUnitId),T=(E=U==null?void 0:U.getMergedCell(P,j))!=null?E:{startColumn:j,endColumn:j,startRow:P,endRow:P};if(!Number.isNaN(P)&&!Number.isNaN(j))return n.addShape({range:T,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null})}return null},[n,d,i]),I=C=>{var E,P;return(P=(E=e.getSheetBySheetId(C))==null?void 0:E.getName())!=null?P:""},M=()=>{o.executeCommand(V.id)},$=C=>{l&&l.unitId===C.unitId&&l.subUnitId===C.subUnitId&&l.commentId===C.id||(u.current&&(n.removeShape(u.current),u.current=null),u.current=_(C))},B=()=>{u.current&&(n.removeShape(u.current),u.current=null)},te=(C,E)=>{E&&r.hidePopup()};return O.useEffect(()=>{!h&&u.current&&n.removeShape(u.current)},[n,h]),re.jsx(g.ThreadCommentPanel,{unitId:i,subUnitId$:a,type:s.UniverInstanceType.UNIVER_SHEET,onAdd:M,getSubUnitName:I,onResolve:te,sortComments:S,onItemEnter:$,onItemLeave:B,onDeleteComment:()=>(B(),!0)})},ke=n=>({id:V.id,type:v.MenuItemType.BUTTON,icon:Y,title:"sheetThreadComment.menu.addComment",hidden$:v.getMenuHiddenObservable(n,s.UniverInstanceType.UNIVER_SHEET),disabled$:b.getCurrentRangeDisable$(n,{workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]})}),De=n=>({id:g.ToggleSheetCommentPanelOperation.id,type:v.MenuItemType.BUTTON,icon:Y,tooltip:"sheetThreadComment.menu.commentManagement",disabled$:b.getCurrentRangeDisable$(n,{workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]}),hidden$:v.getMenuHiddenObservable(n,s.UniverInstanceType.UNIVER_SHEET)}),Ne={id:V.id,binding:v.KeyCode.M|v.MetaKeys.CTRL_COMMAND|v.MetaKeys.ALT,preconditions:b.whenSheetEditorFocused},$e={[v.RibbonStartGroup.OTHERS]:{[g.ToggleSheetCommentPanelOperation.id]:{order:1,menuItemFactory:De}},[v.ContextMenuPosition.MAIN_AREA]:{[v.ContextMenuGroup.OTHERS]:{[V.id]:{order:0,menuItemFactory:ke}}}};var Ae=Object.getOwnPropertyDescriptor,Ve=(n,t,r,e)=>{for(var i=e>1?void 0:e?Ae(t,r):t,o=n.length-1,a;o>=0;o--)(a=n[o])&&(i=a(i)||i);return i},X=(n,t)=>(r,e)=>t(r,e,n);let K=class extends s.Disposable{constructor(n,t,r){super(),this._menuManagerService=n,this._componentManager=t,this._shortcutService=r,this._initMenu(),this._initShortcut(),this._initComponent()}_initShortcut(){this._shortcutService.registerShortcut(Ne)}_initMenu(){this._menuManagerService.mergeMenu($e)}_initComponent(){[[ie,Re],[g.THREAD_COMMENT_PANEL,je],[Y,de]].forEach(([n,t])=>{this._componentManager.register(n,t)})}};K=Ve([X(0,v.IMenuManagerService),X(1,s.Inject(v.ComponentManager)),X(2,v.IShortcutService)],K);var He=Object.defineProperty,Be=Object.getOwnPropertyDescriptor,Le=(n,t,r)=>t in n?He(n,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[t]=r,We=(n,t,r,e)=>{for(var i=e>1?void 0:e?Be(t,r):t,o=n.length-1,a;o>=0;o--)(a=n[o])&&(i=a(i)||i);return i},ee=(n,t)=>(r,e)=>t(r,e,n),ue=(n,t,r)=>Le(n,typeof t!="symbol"?t+"":t,r);c.UniverSheetsThreadCommentUIPlugin=class extends s.Plugin{constructor(t=se,r,e,i){super(),this._config=t,this._injector=r,this._commandService=e,this._configService=i;const{menu:o,...a}=s.merge({},se,this._config);o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(pe,a)}onStarting(){[[K],[W],[x],[q],[z],[G],[c.SheetsThreadCommentPopupService]].forEach(t=>{this._injector.add(t)}),[V].forEach(t=>{this._commandService.registerCommand(t)}),this._injector.get(K)}onReady(){this._injector.get(W),this._injector.get(z)}onRendered(){this._injector.get(x),this._injector.get(q),this._injector.get(G)}},ue(c.UniverSheetsThreadCommentUIPlugin,"pluginName",J),ue(c.UniverSheetsThreadCommentUIPlugin,"type",s.UniverInstanceType.UNIVER_SHEET),c.UniverSheetsThreadCommentUIPlugin=We([s.DependentOn(g.UniverThreadCommentUIPlugin,N.UniverSheetsThreadCommentPlugin),ee(1,s.Inject(s.Injector)),ee(2,s.Inject(s.ICommandService)),ee(3,s.IConfigService)],c.UniverSheetsThreadCommentUIPlugin),Object.defineProperty(c,"UniverThreadCommentUIPlugin",{enumerable:!0,get:()=>g.UniverThreadCommentUIPlugin}),Object.defineProperty(c,"AddCommentCommand",{enumerable:!0,get:()=>f.AddCommentCommand}),Object.defineProperty(c,"DeleteCommentCommand",{enumerable:!0,get:()=>f.DeleteCommentCommand}),Object.defineProperty(c,"DeleteCommentTreeCommand",{enumerable:!0,get:()=>f.DeleteCommentTreeCommand}),Object.defineProperty(c,"IThreadCommentDataSourceService",{enumerable:!0,get:()=>f.IThreadCommentDataSourceService}),Object.defineProperty(c,"ResolveCommentCommand",{enumerable:!0,get:()=>f.ResolveCommentCommand}),Object.defineProperty(c,"UpdateCommentCommand",{enumerable:!0,get:()=>f.UpdateCommentCommand}),c.SHEETS_THREAD_COMMENT=J,c.ShowAddSheetCommentModalOperation=V,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
66
+ (function(d,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/sheets-thread-comment"),require("@univerjs/thread-comment-ui"),require("@univerjs/sheets-ui"),require("@univerjs/ui"),require("rxjs"),require("@univerjs/engine-render"),require("@univerjs/engine-formula"),require("@univerjs/thread-comment"),require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","@univerjs/sheets-thread-comment","@univerjs/thread-comment-ui","@univerjs/sheets-ui","@univerjs/ui","rxjs","@univerjs/engine-render","@univerjs/engine-formula","@univerjs/thread-comment","react/jsx-runtime","react"],s):(d=typeof globalThis<"u"?globalThis:d||self,s(d.UniverSheetsThreadCommentUi={},d.UniverCore,d.UniverSheets,d.UniverSheetsThreadComment,d.UniverThreadCommentUi,d.UniverSheetsUi,d.UniverUi,d.rxjs,d.UniverEngineRender,d.UniverEngineFormula,d.UniverThreadComment,d.React,d.React))})(this,function(d,s,p,N,I,P,v,H,re,A,f,ie,O){"use strict";var Fe=Object.defineProperty;var qe=(d,s,p)=>s in d?Fe(d,s,{enumerable:!0,configurable:!0,writable:!0,value:p}):d[s]=p;var D=(d,s,p)=>qe(d,typeof s!="symbol"?s+"":s,p);const oe="univer.sheet.thread-comment-modal",Y="comment-single",J="SHEET_THREAD_COMMENT";var he=Object.getOwnPropertyDescriptor,le=(n,t,r,e)=>{for(var i=e>1?void 0:e?he(t,r):t,o=n.length-1,a;o>=0;o--)(a=n[o])&&(i=a(i)||i);return i},Q=(n,t)=>(r,e)=>t(r,e,n);d.SheetsThreadCommentPopupService=class extends s.Disposable{constructor(r,e,i){super();D(this,"_lastPopup",null);D(this,"_activePopup");D(this,"_activePopup$",new H.BehaviorSubject(null));D(this,"activePopup$",this._activePopup$.asObservable());this._canvasPopupManagerService=r,this._zenZoneService=e,this._cellPopupManagerService=i,this._initZenVisible(),this.disposeWithMe(()=>{this._activePopup$.complete()})}get activePopup(){return this._activePopup}_initZenVisible(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(r=>{r&&this.hidePopup()}))}showPopup(r,e){var l;const{row:i,col:o,unitId:a,subUnitId:c}=r;if(this._activePopup&&i===this._activePopup.row&&o===this._activePopup.col&&a===this._activePopup.unitId&&c===((l=this.activePopup)==null?void 0:l.subUnitId)){this._activePopup=r,this._activePopup$.next(r);return}if(this._lastPopup&&this._lastPopup.dispose(),this._zenZoneService.visible)return;this._activePopup=r,this._activePopup$.next(r);const u=this._cellPopupManagerService.showPopup({row:i,col:o,unitId:a,subUnitId:c},{componentKey:oe,onClickOutside:()=>{this.hidePopup()},direction:"horizontal",excludeOutside:[...Array.from(document.querySelectorAll(".univer-thread-comment")),document.getElementById("thread-comment-add")].filter(Boolean),priority:2});if(!u)throw new Error("[SheetsThreadCommentPopupService]: cannot show popup!");const m=new s.DisposableCollection;m.add(u),m.add({dispose:()=>{e==null||e()}}),this._lastPopup=m}hidePopup(){this._activePopup&&(this._lastPopup&&this._lastPopup.dispose(),this._lastPopup=null,this._activePopup=null,this._activePopup$.next(null))}persistPopup(){!this._activePopup||!this._activePopup.temp||(this._activePopup={...this._activePopup,temp:!1},this._activePopup$.next(this._activePopup))}},d.SheetsThreadCommentPopupService=le([Q(0,s.Inject(P.SheetCanvasPopManagerService)),Q(1,v.IZenZoneService),Q(2,s.Inject(P.CellPopupManagerService))],d.SheetsThreadCommentPopupService);const V={type:s.CommandType.OPERATION,id:"sheets.operation.show-comment-modal",handler(n){var g;const t=n.get(p.SheetsSelectionsService),r=n.get(s.IUniverInstanceService),e=n.get(d.SheetsThreadCommentPopupService),i=n.get(I.ThreadCommentPanelService),o=(g=t.getCurrentLastSelection())==null?void 0:g.primary,a=n.get(N.SheetsThreadCommentModel);if(!o)return!1;const c=p.getSheetCommandTarget(r);if(!c)return!1;const{workbook:u,worksheet:m,unitId:l,subUnitId:h}=c,S={workbook:u,worksheet:m,unitId:l,subUnitId:h,row:o.startRow,col:o.startColumn};e.showPopup(S);const _=a.getByLocation(l,h,o.startRow,o.startColumn);return _&&i.setActiveComment({unitId:l,subUnitId:h,commentId:_,trigger:"context-menu"}),!0}},pe="sheets-thread-comment.config",se={};var ve=Object.getOwnPropertyDescriptor,Se=(n,t,r,e)=>{for(var i=e>1?void 0:e?ve(t,r):t,o=n.length-1,a;o>=0;o--)(a=n[o])&&(i=a(i)||i);return i},L=(n,t)=>(r,e)=>t(r,e,n);let W=class extends s.Disposable{constructor(n,t,r,e){super(),this._sheetInterceptorService=n,this._sheetsThreadCommentModel=t,this._univerInstanceService=r,this._renderManagerService=e,this._initViewModelIntercept(),this._initSkeletonChange()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(p.INTERCEPTOR_POINT.CELL_CONTENT,{effect:s.InterceptorEffectEnum.Style,handler:(n,t,r)=>{const{row:e,col:i,unitId:o,subUnitId:a}=t;return this._sheetsThreadCommentModel.showCommentMarker(o,a,e,i)?r({...n,markers:{...n==null?void 0:n.markers,tr:{color:"#FFBD37",size:6}}}):r(n)},priority:100}))}_initSkeletonChange(){const n=()=>{var i;const t=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!t)return;const r=t.getUnitId(),e=this._renderManagerService.getRenderById(r);(i=e==null?void 0:e.mainComponent)==null||i.makeForceDirty()};this.disposeWithMe(this._sheetsThreadCommentModel.commentUpdate$.pipe(H.debounceTime(16)).subscribe(()=>{n()}))}};W=Se([L(0,s.Inject(p.SheetInterceptorService)),L(1,s.Inject(N.SheetsThreadCommentModel)),L(2,s.IUniverInstanceService),L(3,re.IRenderManagerService)],W);var Ce=Object.getOwnPropertyDescriptor,_e=(n,t,r,e)=>{for(var i=e>1?void 0:e?Ce(t,r):t,o=n.length-1,a;o>=0;o--)(a=n[o])&&(i=a(i)||i);return i},X=(n,t)=>(r,e)=>t(r,e,n);const fe=(n,t,r)=>{const e=A.singleReferenceToGrid(n),i=r.row-t.row,o=r.column-t.column,a={startColumn:e.column+o,startRow:e.row+i,endColumn:e.column+o,endRow:e.row+i};return A.serializeRange(a)};let x=class extends s.Disposable{constructor(t,r,e){super();D(this,"_copyInfo");this._sheetClipboardService=t,this._sheetsThreadCommentModel=r,this._threadCommentDataSourceService=e,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:J,onBeforeCopy:(t,r,e)=>{this._copyInfo={unitId:t,subUnitId:r,range:e}},onPasteCells:(t,r,e,i)=>{const{unitId:o,subUnitId:a,range:c}=r,u={row:c.rows[0],column:c.cols[0]};if(i.copyType===P.COPY_TYPE.CUT&&this._copyInfo){const{range:m,unitId:l,subUnitId:h}=this._copyInfo,S={row:m.startRow,column:m.startColumn};if(!(o===l&&a===h)){const _=[];s.Range.foreach(m,(w,C)=>{const E=this._sheetsThreadCommentModel.getAllByLocation(l,h,w,C);this._threadCommentDataSourceService.syncUpdateMutationToColla?E.forEach(T=>{_.push(T)}):E.forEach(({children:T,...j})=>{j.parentId||_.push(j)})});const g=[],M=[],$=[],B=[],ne=w=>{g.unshift({id:f.DeleteCommentMutation.id,params:{unitId:l,subUnitId:h,commentId:w.id}}),$.push({id:f.AddCommentMutation.id,params:{unitId:o,subUnitId:a,comment:{...w,ref:fe(w.ref,S,u),unitId:o,subUnitId:a},sync:!0}}),M.push({id:f.AddCommentMutation.id,params:{unitId:l,subUnitId:h,comment:w,sync:!0}}),B.unshift({id:f.DeleteCommentMutation.id,params:{unitId:o,subUnitId:a,commentId:w.id}})};return _.forEach(w=>{ne(w)}),{redos:[...g,...$],undos:[...B,...M]}}}return{redos:[],undos:[]}}}))}};x=_e([X(0,s.Inject(P.ISheetClipboardService)),X(1,s.Inject(N.SheetsThreadCommentModel)),X(2,f.IThreadCommentDataSourceService)],x);var ge=Object.getOwnPropertyDescriptor,Ie=(n,t,r,e)=>{for(var i=e>1?void 0:e?ge(t,r):t,o=n.length-1,a;o>=0;o--)(a=n[o])&&(i=a(i)||i);return i},F=(n,t)=>(r,e)=>t(r,e,n);let q=class extends s.Disposable{constructor(n,t,r,e){super(),this._hoverManagerService=n,this._sheetsThreadCommentPopupService=t,this._sheetsThreadCommentModel=r,this._sheetPermissionCheckController=e,this._initHoverEvent()}_initHoverEvent(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(H.debounceTime(100)).subscribe(n=>{const t=this._sheetsThreadCommentPopupService.activePopup;if(n&&(t&&t.temp||!t)){const{location:r}=n,{unitId:e,subUnitId:i,row:o,col:a}=r,c=this._sheetsThreadCommentModel.getByLocation(e,i,o,a);if(c){if(!this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]},[{startRow:o,startColumn:a,endRow:o,endColumn:a}]))return;const m=this._sheetsThreadCommentModel.getComment(e,i,c);m&&!m.resolved&&this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:i,row:o,col:a,commentId:c,temp:!0})}else t&&this._sheetsThreadCommentPopupService.hidePopup()}}))}};q=Ie([F(0,s.Inject(P.HoverManagerService)),F(1,s.Inject(d.SheetsThreadCommentPopupService)),F(2,s.Inject(N.SheetsThreadCommentModel)),F(3,s.Inject(p.SheetPermissionCheckController))],q);var Pe=Object.getOwnPropertyDescriptor,Te=(n,t,r,e)=>{for(var i=e>1?void 0:e?Pe(t,r):t,o=n.length-1,a;o>=0;o--)(a=n[o])&&(i=a(i)||i);return i},R=(n,t)=>(r,e)=>t(r,e,n);let G=class extends s.Disposable{constructor(t,r,e,i,o,a,c,u,m,l){super();D(this,"_isSwitchToCommenting",!1);D(this,"_selectionShapeInfo",null);this._commandService=t,this._sheetsThreadCommentPopupService=r,this._sheetsThreadCommentModel=e,this._threadCommentPanelService=i,this._univerInstanceService=o,this._sheetPermissionCheckController=a,this._markSelectionService=c,this._sheetSelectionService=u,this._editorBridgeService=m,this._renderManagerService=l,this._initCommandListener(),this._initPanelListener(),this._initMarkSelection(),this._initSelectionUpdateListener(),this._initEditorBridge()}_handleSelectionChange(t,r,e){var S,_,g;const i=(S=t[0])==null?void 0:S.range,o=this._renderManagerService.getRenderById(r),a=(_=o==null?void 0:o.with(P.SheetSkeletonManagerService).getSkeletonParam(e))==null?void 0:_.skeleton;if(!a||!i)return;const c=a.getCellWithCoordByIndex(i.startRow,i.startColumn);if((((g=i.rangeType)!=null?g:s.RANGE_TYPE.NORMAL)!==s.RANGE_TYPE.NORMAL||i.endColumn-i.startColumn>0||i.endRow-i.startRow>0)&&!((c.isMerged||c.isMergedMainCell)&&s.Rectangle.equals(c.mergeInfo,i))){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(I.SetActiveCommentOperation.id);return}const m=c.actualRow,l=c.actualColumn;if(!this._sheetsThreadCommentModel.showCommentMarker(r,e,m,l)){this._threadCommentPanelService.activeCommentId&&this._commandService.executeCommand(I.SetActiveCommentOperation.id);return}const h=this._sheetsThreadCommentModel.getByLocation(r,e,m,l);h&&this._commandService.executeCommand(I.SetActiveCommentOperation.id,{unitId:r,subUnitId:e,commentId:h})}_initSelectionUpdateListener(){this.disposeWithMe(this._sheetSelectionService.selectionMoveEnd$.subscribe(t=>{if(this._isSwitchToCommenting)return;const r=this._sheetSelectionService.currentSelectionParam;r&&this._handleSelectionChange(t,r.unitId,r.sheetId)}))}_initEditorBridge(){this.disposeWithMe(this._editorBridgeService.visible$.subscribe(t=>{t.visible&&this._sheetsThreadCommentPopupService.hidePopup()}))}_initCommandListener(){this._commandService.onCommandExecuted(t=>{if(t.id===f.DeleteCommentMutation.id){const r=t.params,e=this._sheetsThreadCommentPopupService.activePopup;if(!e)return;const{unitId:i,subUnitId:o,commentId:a}=e;r.unitId===i&&r.subUnitId===o&&r.commentId===a&&this._sheetsThreadCommentPopupService.hidePopup()}})}_initPanelListener(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(async t=>{var r;if(t){const{unitId:e,subUnitId:i,commentId:o,trigger:a}=t,c=this._sheetsThreadCommentModel.getComment(e,i,o);if(!c||c.resolved)return;const u=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!u||u.getUnitId()!==e)return;this._isSwitchToCommenting=!0,((r=u.getActiveSheet())==null?void 0:r.getSheetId())!==i&&await this._commandService.executeCommand(p.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:i}),this._isSwitchToCommenting=!1;const h=A.singleReferenceToGrid(c.ref),{row:S,column:_}=h;if(!this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]},[{startRow:S,startColumn:_,endRow:S,endColumn:_}]))return;const M=1;if(await this._commandService.executeCommand(P.ScrollToRangeOperation.id,{range:{startRow:Math.max(h.row-M,0),endRow:h.row+M,startColumn:Math.max(h.column-M,0),endColumn:h.column+M}}),this._editorBridgeService.isVisible().visible)return;this._sheetsThreadCommentPopupService.showPopup({unitId:e,subUnitId:i,row:h.row,col:h.column,commentId:c.id,trigger:a})}else this._sheetsThreadCommentPopupService.hidePopup()}))}_initMarkSelection(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe(H.debounceTime(100)).subscribe(t=>{var S,_;if(!t){this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);return}const{unitId:r,subUnitId:e,commentId:i}=t;this._selectionShapeInfo&&(this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId),this._selectionShapeInfo=null);const o=this._sheetsThreadCommentModel.getComment(r,e,i);if(!o)return;const a=A.singleReferenceToGrid(o.ref),{row:c,column:u}=a;if(Number.isNaN(c)||Number.isNaN(u))return null;const m=(S=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET))==null?void 0:S.getSheetBySheetId(e),l=(_=m==null?void 0:m.getMergedCell(c,u))!=null?_:{startColumn:u,endColumn:u,startRow:c,endRow:c},h=this._markSelectionService.addShape({range:l,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null},[],-1);h&&(this._selectionShapeInfo={...t,shapeId:h})}))}};G=Te([R(0,s.ICommandService),R(1,s.Inject(d.SheetsThreadCommentPopupService)),R(2,s.Inject(N.SheetsThreadCommentModel)),R(3,s.Inject(I.ThreadCommentPanelService)),R(4,s.IUniverInstanceService),R(5,s.Inject(p.SheetPermissionCheckController)),R(6,P.IMarkSelectionService),R(7,s.Inject(p.SheetsSelectionsService)),R(8,P.IEditorBridgeService),R(9,re.IRenderManagerService)],G);var be=Object.getOwnPropertyDescriptor,ye=(n,t,r,e)=>{for(var i=e>1?void 0:e?be(t,r):t,o=n.length-1,a;o>=0;o--)(a=n[o])&&(i=a(i)||i);return i},Z=(n,t)=>(r,e)=>t(r,e,n);let z=class extends s.Disposable{constructor(n,t,r,e){super(),this._sheetInterceptorService=n,this._univerInstanceService=t,this._threadCommentModel=r,this._threadCommentDataSourceService=e,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:n=>{var t;if(n.id===p.RemoveSheetCommand.id){const r=n.params,e=r.unitId?this._univerInstanceService.getUnit(r.unitId):this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!e)return{redos:[],undos:[]};const i=e.getUnitId(),o=r.subUnitId||((t=e.getActiveSheet())==null?void 0:t.getSheetId());if(!o)return{redos:[],undos:[]};const a=this._threadCommentModel.ensureMap(i,o),c=Array.from(a.values()).filter(S=>!S.parentId),u=c.map(S=>S.id),m=this._threadCommentDataSourceService.syncUpdateMutationToColla,l=u.map(S=>({id:f.DeleteCommentMutation.id,params:{unitId:i,subUnitId:o,commentId:S}})),h=c.map(({children:S,..._})=>({id:f.AddCommentMutation.id,params:{unitId:i,subUnitId:o,comment:{..._,children:m?S:void 0},sync:!m}}));return{redos:l,undos:h}}return{redos:[],undos:[]}}}))}};z=ye([Z(0,s.Inject(p.SheetInterceptorService)),Z(1,s.IUniverInstanceService),Z(2,s.Inject(f.ThreadCommentModel)),Z(3,f.IThreadCommentDataSourceService)],z);var y=function(){return y=Object.assign||function(n){for(var t,r=1,e=arguments.length;r<e;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}return n},y.apply(this,arguments)},Me=function(n,t){var r={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&t.indexOf(e)<0&&(r[e]=n[e]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,e=Object.getOwnPropertySymbols(n);i<e.length;i++)t.indexOf(e[i])<0&&Object.prototype.propertyIsEnumerable.call(n,e[i])&&(r[e[i]]=n[e[i]]);return r},ae=O.forwardRef(function(n,t){var r=n.icon,e=n.id,i=n.className,o=n.extend,a=Me(n,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(e," ").concat(i||"").trim(),u=O.useRef("_".concat(Ue()));return ce(r,"".concat(e),{defIds:r.defIds,idSuffix:u.current},y({ref:t,className:c},a),o)});function ce(n,t,r,e,i){return O.createElement(n.tag,y(y({key:t},we(n,r,i)),e),(Ee(n,r).children||[]).map(function(o,a){return ce(o,"".concat(t,"-").concat(n.tag,"-").concat(a),r,void 0,i)}))}function we(n,t,r){var e=y({},n.attrs);r!=null&&r.colorChannel1&&e.fill==="colorChannel1"&&(e.fill=r.colorChannel1),n.tag==="mask"&&e.id&&(e.id=e.id+t.idSuffix),Object.entries(e).forEach(function(o){var a=o[0],c=o[1];a==="mask"&&typeof c=="string"&&(e[a]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))});var i=t.defIds;return!i||i.length===0||(n.tag==="use"&&e["xlink:href"]&&(e["xlink:href"]=e["xlink:href"]+t.idSuffix),Object.entries(e).forEach(function(o){var a=o[0],c=o[1];typeof c=="string"&&(e[a]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),e}function Ee(n,t){var r,e=t.defIds;return!e||e.length===0?n:n.tag==="defs"&&(!((r=n.children)===null||r===void 0)&&r.length)?y(y({},n),{children:n.children.map(function(i){return typeof i.attrs.id=="string"&&e&&e.indexOf(i.attrs.id)>-1?y(y({},i),{attrs:y(y({},i.attrs),{id:i.attrs.id+t.idSuffix})}):i})}):n}function Ue(){return Math.random().toString(36).substring(2,8)}ae.displayName="UniverIcon";var Oe={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521C5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345ZM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521C8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345ZM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521C11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521 5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345zM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521 8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345zM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521 11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.84351 3.41861C1.84351 3.01861 2.15531 2.69434 2.53993 2.69434H14.9381C15.3228 2.69434 15.6346 3.01861 15.6346 3.41861V12.4611C15.6346 12.8612 15.3228 13.1854 14.9381 13.1854H8.82117L6.06643 14.6179C5.85054 14.7301 5.59416 14.7181 5.38884 14.5862C5.18352 14.4542 5.05855 14.2211 5.05855 13.9701V13.1854H2.53993C2.15531 13.1854 1.84351 12.8612 1.84351 12.4611L1.84351 3.41861ZM6.45141 12.7982L8.34531 12.0135C8.44201 11.9632 8.54864 11.9371 8.65676 11.9371H14.2417C14.3522 11.9371 14.4417 11.8475 14.4417 11.7371V4.14271C14.4417 4.03225 14.3522 3.94271 14.2417 3.94271H3.23636C3.12591 3.94271 3.03636 4.03225 3.03636 4.14271L3.03636 11.7371C3.03636 11.8475 3.12591 11.9371 3.23636 11.9371L5.75498 11.9371C6.1396 11.9371 6.45141 12.0611 6.45141 12.4611V12.7982Z",fillRule:"evenodd",clipRule:"evenodd"}}]},de=O.forwardRef(function(n,t){return O.createElement(ae,Object.assign({},n,{id:"comment-single",ref:t,icon:Oe}))});de.displayName="CommentSingle";const Re=()=>{const n=v.useDependency(s.IUniverInstanceService),t=v.useDependency(d.SheetsThreadCommentPopupService),r=v.useObservable(t.activePopup$),e=v.useDependency(N.SheetsThreadCommentModel);if(v.useObservable(e.commentUpdate$),!r)return null;const{row:i,col:o,unitId:a,subUnitId:c,trigger:u}=r,m=e.getByLocation(a,c,i,o),l=`${s.Tools.chatAtABC(o)}${i+1}`,h=()=>{t.hidePopup()},S=_=>{var g,M,$;return($=(M=(g=n.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET))==null?void 0:g.getSheetBySheetId(_))==null?void 0:M.getName())!=null?$:""};return ie.jsx(I.ThreadCommentTree,{onClick:()=>{t.persistPopup()},prefix:"cell",id:m,unitId:a,subUnitId:c,type:s.UniverInstanceType.UNIVER_SHEET,refStr:l,onClose:h,getSubUnitName:S,autoFocus:u==="context-menu"})},je=()=>{var w;const n=v.useDependency(P.IMarkSelectionService),t=v.useDependency(s.IUniverInstanceService),r=v.useDependency(d.SheetsThreadCommentPopupService),e=t.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET),i=e.getUnitId(),o=v.useDependency(s.ICommandService),a=O.useMemo(()=>e.activeSheet$.pipe(H.map(C=>C==null?void 0:C.getSheetId())),[e.activeSheet$]),c=v.useObservable(a,(w=e.getActiveSheet())==null?void 0:w.getSheetId()),u=O.useRef(null),m=v.useDependency(I.ThreadCommentPanelService),l=v.useObservable(m.activeCommentId$),h=v.useObservable(m.panelVisible$,m.panelVisible),S=O.useCallback(C=>{const E=e.getSheets(),T={};E.forEach((U,b)=>{T[U.getSheetId()]=b});const j=U=>U.map(b=>{var me;const k=A.singleReferenceToGrid(b.ref),xe=[(me=T[b.subUnitId])!=null?me:0,k.row,k.column];return{...b,p:xe}}).sort((b,k)=>b.p[0]===k.p[0]?b.p[1]===k.p[1]?b.p[2]-k.p[2]:b.p[1]-k.p[1]:b.p[0]-k.p[0]);return[...j(C.filter(U=>!U.resolved)),...j(C.filter(U=>U.resolved))]},[e]),_=O.useCallback(C=>{var E;if(C.unitId===i&&C.subUnitId===c&&!C.resolved){const{row:T,column:j}=A.singleReferenceToGrid(C.ref),U=e.getSheetBySheetId(C.subUnitId),b=(E=U==null?void 0:U.getMergedCell(T,j))!=null?E:{startColumn:j,endColumn:j,startRow:T,endRow:T};if(!Number.isNaN(T)&&!Number.isNaN(j))return n.addShape({range:b,style:{fill:"rgb(255, 189, 55, 0.35)",strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null})}return null},[n,c,i]),g=C=>{var E,T;return(T=(E=e.getSheetBySheetId(C))==null?void 0:E.getName())!=null?T:""},M=()=>{o.executeCommand(V.id)},$=C=>{l&&l.unitId===C.unitId&&l.subUnitId===C.subUnitId&&l.commentId===C.id||(u.current&&(n.removeShape(u.current),u.current=null),u.current=_(C))},B=()=>{u.current&&(n.removeShape(u.current),u.current=null)},ne=(C,E)=>{E&&r.hidePopup()};return O.useEffect(()=>{!h&&u.current&&n.removeShape(u.current)},[n,h]),ie.jsx(I.ThreadCommentPanel,{unitId:i,subUnitId$:a,type:s.UniverInstanceType.UNIVER_SHEET,onAdd:M,getSubUnitName:g,onResolve:ne,sortComments:S,onItemEnter:$,onItemLeave:B,onDeleteComment:()=>(B(),!0)})},ke=n=>({id:V.id,type:v.MenuItemType.BUTTON,icon:Y,title:"sheetThreadComment.menu.addComment",hidden$:v.getMenuHiddenObservable(n,s.UniverInstanceType.UNIVER_SHEET),disabled$:P.getCurrentRangeDisable$(n,{workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]})}),De=n=>({id:I.ToggleSheetCommentPanelOperation.id,type:v.MenuItemType.BUTTON,icon:Y,tooltip:"sheetThreadComment.menu.commentManagement",disabled$:P.getCurrentRangeDisable$(n,{workbookTypes:[p.WorkbookCommentPermission],worksheetTypes:[p.WorksheetViewPermission],rangeTypes:[p.RangeProtectionPermissionViewPoint]}),hidden$:v.getMenuHiddenObservable(n,s.UniverInstanceType.UNIVER_SHEET)}),Ne={id:V.id,binding:v.KeyCode.M|v.MetaKeys.CTRL_COMMAND|v.MetaKeys.ALT,preconditions:P.whenSheetEditorFocused},$e={[v.RibbonStartGroup.OTHERS]:{[I.ToggleSheetCommentPanelOperation.id]:{order:1,menuItemFactory:De}},[v.ContextMenuPosition.MAIN_AREA]:{[v.ContextMenuGroup.OTHERS]:{[V.id]:{order:0,menuItemFactory:ke}}}};var Ae=Object.getOwnPropertyDescriptor,Ve=(n,t,r,e)=>{for(var i=e>1?void 0:e?Ae(t,r):t,o=n.length-1,a;o>=0;o--)(a=n[o])&&(i=a(i)||i);return i},ee=(n,t)=>(r,e)=>t(r,e,n);let K=class extends s.Disposable{constructor(n,t,r){super(),this._menuManagerService=n,this._componentManager=t,this._shortcutService=r,this._initMenu(),this._initShortcut(),this._initComponent()}_initShortcut(){this._shortcutService.registerShortcut(Ne)}_initMenu(){this._menuManagerService.mergeMenu($e)}_initComponent(){[[oe,Re],[I.THREAD_COMMENT_PANEL,je],[Y,de]].forEach(([n,t])=>{this._componentManager.register(n,t)})}};K=Ve([ee(0,v.IMenuManagerService),ee(1,s.Inject(v.ComponentManager)),ee(2,v.IShortcutService)],K);var He=Object.defineProperty,Be=Object.getOwnPropertyDescriptor,Le=(n,t,r)=>t in n?He(n,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[t]=r,We=(n,t,r,e)=>{for(var i=e>1?void 0:e?Be(t,r):t,o=n.length-1,a;o>=0;o--)(a=n[o])&&(i=a(i)||i);return i},te=(n,t)=>(r,e)=>t(r,e,n),ue=(n,t,r)=>Le(n,typeof t!="symbol"?t+"":t,r);d.UniverSheetsThreadCommentUIPlugin=class extends s.Plugin{constructor(t=se,r,e,i){super(),this._config=t,this._injector=r,this._commandService=e,this._configService=i;const{menu:o,...a}=s.merge({},se,this._config);o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(pe,a)}onStarting(){[[K],[W],[x],[q],[z],[G],[d.SheetsThreadCommentPopupService]].forEach(t=>{this._injector.add(t)}),[V].forEach(t=>{this._commandService.registerCommand(t)}),this._injector.get(K)}onReady(){this._injector.get(W),this._injector.get(z)}onRendered(){this._injector.get(x),this._injector.get(q),this._injector.get(G)}},ue(d.UniverSheetsThreadCommentUIPlugin,"pluginName",J),ue(d.UniverSheetsThreadCommentUIPlugin,"type",s.UniverInstanceType.UNIVER_SHEET),d.UniverSheetsThreadCommentUIPlugin=We([s.DependentOn(I.UniverThreadCommentUIPlugin,N.UniverSheetsThreadCommentPlugin),te(1,s.Inject(s.Injector)),te(2,s.Inject(s.ICommandService)),te(3,s.IConfigService)],d.UniverSheetsThreadCommentUIPlugin),Object.defineProperty(d,"UniverThreadCommentUIPlugin",{enumerable:!0,get:()=>I.UniverThreadCommentUIPlugin}),Object.defineProperty(d,"AddCommentCommand",{enumerable:!0,get:()=>f.AddCommentCommand}),Object.defineProperty(d,"DeleteCommentCommand",{enumerable:!0,get:()=>f.DeleteCommentCommand}),Object.defineProperty(d,"DeleteCommentTreeCommand",{enumerable:!0,get:()=>f.DeleteCommentTreeCommand}),Object.defineProperty(d,"IThreadCommentDataSourceService",{enumerable:!0,get:()=>f.IThreadCommentDataSourceService}),Object.defineProperty(d,"ResolveCommentCommand",{enumerable:!0,get:()=>f.ResolveCommentCommand}),Object.defineProperty(d,"UpdateCommentCommand",{enumerable:!0,get:()=>f.UpdateCommentCommand}),d.SHEETS_THREAD_COMMENT=J,d.ShowAddSheetCommentModalOperation=V,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
26
67
 
27
68
 
28
69
  // index
@@ -1,5 +1,5 @@
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(){"use strict";return{threadCommentUI:{panel:{title:"Comment Management",empty:"No comments yet",filterEmpty:"No match result",reset:"Reset Filter",addComment:"Add Comment"},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(){"use strict";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"}}}}});
3
3
 
4
4
 
5
5
  // @univerjs/sheets-thread-comment-ui/locale/en-US
@@ -1,5 +1,5 @@
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(){"use strict";return{threadCommentUI:{panel:{title:"مدیریت نظرات",empty:"هنوز نظری وجود ندارد",filterEmpty:"نتیجه ای یافت نشد",reset:"بازنشانی فیلتر",addComment:"افزودن نظر"},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(){"use strict";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:"موضوع مربوط به من"}}}}});
3
3
 
4
4
 
5
5
  // @univerjs/sheets-thread-comment-ui/locale/fa-IR
@@ -1,5 +1,5 @@
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(){"use strict";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"},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(){"use strict";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"}}}}});
3
3
 
4
4
 
5
5
  // @univerjs/sheets-thread-comment-ui/locale/fr-FR
@@ -1,5 +1,5 @@
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(){"use strict";return{threadCommentUI:{panel:{title:"Comment Management",empty:"No comments yet",filterEmpty:"No match result",reset:"Reset Filter",addComment:"Add Comment"},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.UniverThreadCommentUiRuRU=t())})(this,function(){"use strict";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"}}}}});
3
3
 
4
4
 
5
5
  // @univerjs/sheets-thread-comment-ui/locale/ru-RU
@@ -1,5 +1,5 @@
1
1
  // @univerjs/thread-comment-ui/locale/vi-VN
2
- (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverThreadCommentUiViVN=n())})(this,function(){"use strict";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"},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,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverThreadCommentUiViVN=n())})(this,function(){"use strict";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"}}}}});
3
3
 
4
4
 
5
5
  // @univerjs/sheets-thread-comment-ui/locale/vi-VN
@@ -1,5 +1,5 @@
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(){"use strict";return{threadCommentUI:{panel:{title:"评论管理",empty:"暂无评论",filterEmpty:"没有匹配的结果",reset:"重置",addComment:"添加评论"},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(){"use strict";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:"与我有关"}}}}});
3
3
 
4
4
 
5
5
  // @univerjs/sheets-thread-comment-ui/locale/zh-CN
@@ -1,5 +1,5 @@
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(){"use strict";return{threadCommentUI:{panel:{title:"評論管理",empty:"暫無評論",filterEmpty:"沒有符合的結果",reset:"重置",addComment:"新增評論"},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(){"use strict";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:"與我有關"}}}}});
3
3
 
4
4
 
5
5
  // @univerjs/sheets-thread-comment-ui/locale/zh-TW
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/preset-sheets-thread-comment",
3
- "version": "0.6.10",
3
+ "version": "0.7.0-nightly.202505071607",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -57,13 +57,13 @@
57
57
  "rxjs": ">=7.0.0"
58
58
  },
59
59
  "dependencies": {
60
- "@univerjs/sheets-thread-comment": "0.6.10",
61
- "@univerjs/sheets-thread-comment-ui": "0.6.10",
62
- "@univerjs/thread-comment": "0.6.10",
63
- "@univerjs/thread-comment-ui": "0.6.10"
60
+ "@univerjs/sheets-thread-comment": "0.7.0-nightly.202505071607",
61
+ "@univerjs/sheets-thread-comment-ui": "0.7.0-nightly.202505071607",
62
+ "@univerjs/thread-comment": "0.7.0-nightly.202505071607",
63
+ "@univerjs/thread-comment-ui": "0.7.0-nightly.202505071607"
64
64
  },
65
65
  "devDependencies": {
66
- "@univerjs/core": "0.6.10",
66
+ "@univerjs/core": "0.7.0-nightly.202505071607",
67
67
  "react": "18.3.1",
68
68
  "react-dom": "18.3.1",
69
69
  "typescript": "^5.8.2",