@univerjs/action-recorder 0.5.0 → 0.5.1-nightly.202411301606

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cjs/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var Z=Object.defineProperty;var K=(e,n,r)=>n in e?Z(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var v=(e,n,r)=>K(e,typeof n!="symbol"?n+"":n,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@univerjs/core"),s=require("@univerjs/sheets"),T=require("@univerjs/sheets-filter"),m=require("@univerjs/sheets-ui"),d=require("@univerjs/ui"),A=require("rxjs"),C=require("@univerjs/design"),S=require("react");var p=function(){return p=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},p.apply(this,arguments)},Y=function(e,n){var r={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(r[t]=e[t]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,t=Object.getOwnPropertySymbols(e);o<t.length;o++)n.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(e,t[o])&&(r[t[o]]=e[t[o]]);return r},L=S.forwardRef(function(e,n){var r=e.icon,t=e.id,o=e.className,c=e.extend,i=Y(e,["icon","id","className","extend"]),u="univerjs-icon univerjs-icon-".concat(t," ").concat(o||"").trim(),l=S.useRef("_".concat(ee()));return B(r,"".concat(t),{defIds:r.defIds,idSuffix:l.current},p({ref:n,className:u},i),c)});function B(e,n,r,t,o){return S.createElement(e.tag,p(p({key:n},Q(e,r,o)),t),(X(e,r).children||[]).map(function(c,i){return B(c,"".concat(n,"-").concat(e.tag,"-").concat(i),r,void 0,o)}))}function Q(e,n,r){var t=p({},e.attrs);r!=null&&r.colorChannel1&&t.fill==="colorChannel1"&&(t.fill=r.colorChannel1);var o=n.defIds;return!o||o.length===0||(e.tag==="use"&&t["xlink:href"]&&(t["xlink:href"]=t["xlink:href"]+n.idSuffix),Object.entries(t).forEach(function(c){var i=c[0],u=c[1];typeof u=="string"&&(t[i]=u.replace(/url\(#(.*)\)/,"url(#$1".concat(n.idSuffix,")")))})),t}function X(e,n){var r,t=n.defIds;return!t||t.length===0?e:e.tag==="defs"&&(!((r=e.children)===null||r===void 0)&&r.length)?p(p({},e),{children:e.children.map(function(o){return typeof o.attrs.id=="string"&&t&&t.indexOf(o.attrs.id)>-1?p(p({},o),{attrs:p(p({},o.attrs),{id:o.attrs.id+n.idSuffix})}):o})}):e}function ee(){return Math.random().toString(36).substring(2,8)}L.displayName="UniverIcon";var re={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"g",attrs:{fill:"currentColor",clipPath:"url(#record-single_clip0_1559_19)"},children:[{tag:"path",attrs:{d:"M7.60303 10C8.7076 10 9.60303 9.10457 9.60303 8C9.60303 6.89543 8.7076 6 7.60303 6C6.49846 6 5.60303 6.89543 5.60303 8C5.60303 9.10457 6.49846 10 7.60303 10Z"}},{tag:"path",attrs:{d:"M1.66943 5.29023C1.66941 3.85426 2.83349 2.69017 4.26946 2.69019L10.9362 2.69026C12.3192 2.69028 13.45 3.77008 13.5315 5.13259L14.5692 4.55638C15.3024 4.14929 16.2032 4.67947 16.2032 5.51809V10.4819C16.2032 11.3205 15.3024 11.8507 14.5692 11.4436L13.5315 10.8674C13.45 12.2299 12.3192 13.3097 10.9362 13.3097H4.26953C2.83361 13.3097 1.66956 12.1457 1.66953 10.7098L1.66943 5.29023ZM13.5362 9.49743L15.0032 10.312V5.68799L13.5362 6.50254V9.49743ZM4.26945 3.89019C3.49623 3.89018 2.86942 4.517 2.86943 5.29021L2.86953 10.7098C2.86955 11.483 3.49634 12.1097 4.26953 12.1097H10.9362C11.7094 12.1097 12.3362 11.4829 12.3362 10.7097V5.29026C12.3362 4.51707 11.7094 3.89027 10.9362 3.89026L4.26945 3.89019Z",fillRule:"evenodd",clipRule:"evenodd"}}]},{tag:"defs",attrs:{},children:[{tag:"clipPath",attrs:{id:"record-single_clip0_1559_19"},children:[{tag:"path",attrs:{fill:"#fff",d:"M0 0H16V16H0z",transform:"translate(.94)"}}]}]}],defIds:["record-single_clip0_1559_19"]},U=S.forwardRef(function(e,n){return S.createElement(L,Object.assign({},e,{id:"record-single",ref:n,icon:re}))});U.displayName="RecordSingle";var te=Object.defineProperty,ne=Object.getOwnPropertyDescriptor,oe=(e,n,r,t)=>{for(var o=t>1?void 0:t?ne(n,r):n,c=e.length-1,i;c>=0;c--)(i=e[c])&&(o=(t?i(n,r,o):i(o))||o);return t&&o&&te(n,r,o),o},P=(e,n)=>(r,t)=>n(r,t,e);exports.ActionRecorderService=class extends a.Disposable{constructor(r,t,o,c){super();v(this,"_shouldRecordCommands",new Set);v(this,"_panelOpened$",new A.BehaviorSubject(!1));v(this,"panelOpened$",this._panelOpened$.asObservable());v(this,"_recorder",null);v(this,"_recording$",new A.BehaviorSubject(!1));v(this,"recording$",this._recording$.asObservable());v(this,"_recorded$",new A.BehaviorSubject([]));v(this,"_recordedCommands$",new A.BehaviorSubject([]));v(this,"recordedCommands$",this._recordedCommands$.asObservable());this._commandSrv=r,this._logService=t,this._localFileService=o,this._instanceService=c}get recording(){return this._recording$.getValue()}get _recorded(){return this._recorded$.getValue()}get _recordedCommands(){return this._recordedCommands$.getValue()}registerRecordedCommand(r){if(r.type===a.CommandType.MUTATION)throw new Error("[CommandRecorderService] Cannot record mutation commands.");this._shouldRecordCommands.add(r.id)}togglePanel(r){this._panelOpened$.next(r),r===!1&&this.stopRecording()}startRecording(r=!1){this._recorder=this._commandSrv.onCommandExecuted(t=>{var o,c;if(this._shouldRecordCommands.has(t.id)){const i=this._recorded,u=this._recordedCommands;let l={...t};const _=(o=this._instanceService.getFocusedUnit())==null?void 0:o.getUnitId(),{unitId:h=_,subUnitId:f}=l==null?void 0:l.params;if(r&&h&&f){const x=(c=this._instanceService.getUnit(h).getSheetBySheetId(f))==null?void 0:c.getName();l={...l,params:{...l.params,subUnitId:x}}}l.id===s.SetSelectionsOperation.id&&i.length>0&&i[i.length-1].id===s.SetSelectionsOperation.id?i[i.length-1]=l:(i.push(l),this._recorded$.next(i),l.type===a.CommandType.COMMAND&&(u.push(l),this._recordedCommands$.next(u)))}}),this._recording$.next(!0)}stopRecording(){var r;(r=this._recorder)==null||r.dispose(),this._recorder=null,this._recorded$.next([]),this._recordedCommands$.next([]),this._recording$.next(!1)}completeRecording(){const r=this._recorded.slice();this._localFileService.downloadFile(new Blob([JSON.stringify(r,null,2)]),"recorded-commands.json"),this._logService.error("Recorded commands:",r),this.stopRecording()}};exports.ActionRecorderService=oe([P(0,a.ICommandService),P(1,a.ILogService),P(2,d.ILocalFileService),P(3,a.IUniverInstanceService)],exports.ActionRecorderService);const V={id:"action-recorder.command.start-recording",type:a.CommandType.COMMAND,handler:(e,n)=>(e.get(exports.ActionRecorderService).startRecording(!!(n!=null&&n.replaceId)),!0)},W={id:"action-recorder.command.complete-recording",type:a.CommandType.COMMAND,handler:e=>(e.get(exports.ActionRecorderService).completeRecording(),!0)},q={id:"action-recorder.command.stop-recording",type:a.CommandType.COMMAND,handler:e=>(e.get(exports.ActionRecorderService).completeRecording(),!0)};var ce=Object.defineProperty,ie=Object.getOwnPropertyDescriptor,ae=(e,n,r,t)=>{for(var o=t>1?void 0:t?ie(n,r):n,c=e.length-1,i;c>=0;c--)(i=e[c])&&(o=(t?i(n,r,o):i(o))||o);return t&&o&&ce(n,r,o),o},I=(e,n)=>(r,t)=>n(r,t,e),N=(e=>(e.DEFAULT="default",e.NAME="name",e.ACTIVE="active",e))(N||{});exports.ActionReplayService=class extends a.Disposable{constructor(n,r,t,o,c){super(),this._messageService=n,this._instanceService=r,this._localFileService=t,this._logService=o,this._commandService=c}async replayLocalJSON(n="default"){const r=await this._localFileService.openFile({multiple:!1,accept:".json"});if(r.length!==1)return!1;const t=r[0];try{return this.replayCommands(JSON.parse(await t.text()),{mode:n})}catch{return this._messageService.show({type:C.MessageType.Error,content:`Failed to replay commands from local file ${t.name}.`}),!1}}async replayCommands(n,r){var c,i,u;const t=(c=this._instanceService.getFocusedUnit())==null?void 0:c.getUnitId();t||this._logService.error("[ReplayService]","no focused unit to replay commands");const{mode:o}=r||{};for(const l of n){const{id:_,params:h}=l,f=h;if(f){if(typeof f.unitId<"u"&&(f.unitId=t),o==="name"&&f.subUnitId!=="undefined"){const R=(i=this._instanceService.getFocusedUnit().getSheetBySheetName(f.subUnitId))==null?void 0:i.getSheetId();R?f.subUnitId=R:this._logService.error("[ReplayService]",`failed to find subunit by subUnitName = ${f.subUnitId}`)}if(o==="active"&&f.subUnitId!=="undefined"){const R=(u=this._instanceService.getFocusedUnit().getActiveSheet())==null?void 0:u.getSheetId();R?f.subUnitId=R:this._logService.error("[ReplayService]","failed to find active subunit")}if(!await this._commandService.executeCommand(_,h))return!1}else if(!await this._commandService.executeCommand(_))return!1}return!0}async replayCommandsWithDelay(n){var t;const r=(t=this._instanceService.getFocusedUnit())==null?void 0:t.getUnitId();r||this._logService.error("[ReplayService]","no focused unit to replay commands");for(const o of n){await a.awaitTime(se());const{id:c,params:i}=o;if(i){if(typeof i.unitId<"u"&&(i.unitId=r),!await this._commandService.executeCommand(c,i))return!1}else if(!await this._commandService.executeCommand(c))return!1}return!0}};exports.ActionReplayService=ae([I(0,d.IMessageService),I(1,a.IUniverInstanceService),I(2,d.ILocalFileService),I(3,a.ILogService),I(4,a.ICommandService)],exports.ActionReplayService);function se(){return Math.floor(Math.random()*800)+200}const w={id:"action-recorder.command.replay-local-records",type:a.CommandType.COMMAND,handler:async e=>{const r=await e.get(exports.ActionReplayService).replayLocalJSON();return r&&e.get(d.IMessageService).show({type:C.MessageType.Success,content:"Successfully replayed local records"}),r}},$={id:"action-recorder.command.replay-local-records-name",type:a.CommandType.COMMAND,handler:async e=>{const r=await e.get(exports.ActionReplayService).replayLocalJSON(N.NAME);return r&&e.get(d.IMessageService).show({type:C.MessageType.Success,content:"Successfully replayed local records"}),r}},F={id:"action-recorder.command.replay-local-records-active",type:a.CommandType.COMMAND,handler:async e=>{const r=await e.get(exports.ActionReplayService).replayLocalJSON(N.ACTIVE);return r&&e.get(d.IMessageService).show({type:C.MessageType.Success,content:"Successfully replayed local records"}),r}},E={id:"action-recorder.operation.open-panel",type:a.CommandType.OPERATION,handler(e){return e.get(exports.ActionRecorderService).togglePanel(!0),!0}},z={id:"action-recorder.operation.close-panel",type:a.CommandType.OPERATION,handler(e){return e.get(exports.ActionRecorderService).togglePanel(!1),!0}};var k={exports:{}},M={};/**
1
+ "use strict";var K=Object.defineProperty;var Y=(r,n,e)=>n in r?K(r,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[n]=e;var S=(r,n,e)=>Y(r,typeof n!="symbol"?n+"":n,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@univerjs/core"),s=require("@univerjs/sheets"),T=require("@univerjs/sheets-filter"),p=require("@univerjs/sheets-ui"),u=require("@univerjs/ui"),b=require("rxjs"),R=require("@univerjs/design"),g=require("react");var v=function(){return v=Object.assign||function(r){for(var n,e=1,t=arguments.length;e<t;e++){n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])}return r},v.apply(this,arguments)},Q=function(r,n){var e={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&n.indexOf(t)<0&&(e[t]=r[t]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,t=Object.getOwnPropertySymbols(r);o<t.length;o++)n.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(r,t[o])&&(e[t[o]]=r[t[o]]);return e},q=g.forwardRef(function(r,n){var e=r.icon,t=r.id,o=r.className,i=r.extend,c=Q(r,["icon","id","className","extend"]),l="univerjs-icon univerjs-icon-".concat(t," ").concat(o||"").trim(),d=g.useRef("_".concat(re()));return J(e,"".concat(t),{defIds:e.defIds,idSuffix:d.current},v({ref:n,className:l},c),i)});function J(r,n,e,t,o){return g.createElement(r.tag,v(v({key:n},X(r,e,o)),t),(ee(r,e).children||[]).map(function(i,c){return J(i,"".concat(n,"-").concat(r.tag,"-").concat(c),e,void 0,o)}))}function X(r,n,e){var t=v({},r.attrs);e!=null&&e.colorChannel1&&t.fill==="colorChannel1"&&(t.fill=e.colorChannel1);var o=n.defIds;return!o||o.length===0||(r.tag==="use"&&t["xlink:href"]&&(t["xlink:href"]=t["xlink:href"]+n.idSuffix),Object.entries(t).forEach(function(i){var c=i[0],l=i[1];typeof l=="string"&&(t[c]=l.replace(/url\(#(.*)\)/,"url(#$1".concat(n.idSuffix,")")))})),t}function ee(r,n){var e,t=n.defIds;return!t||t.length===0?r:r.tag==="defs"&&(!((e=r.children)===null||e===void 0)&&e.length)?v(v({},r),{children:r.children.map(function(o){return typeof o.attrs.id=="string"&&t&&t.indexOf(o.attrs.id)>-1?v(v({},o),{attrs:v(v({},o.attrs),{id:o.attrs.id+n.idSuffix})}):o})}):r}function re(){return Math.random().toString(36).substring(2,8)}q.displayName="UniverIcon";var te={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"g",attrs:{fill:"currentColor",clipPath:"url(#record-single_clip0_1559_19)"},children:[{tag:"path",attrs:{d:"M7.60303 10C8.7076 10 9.60303 9.10457 9.60303 8C9.60303 6.89543 8.7076 6 7.60303 6C6.49846 6 5.60303 6.89543 5.60303 8C5.60303 9.10457 6.49846 10 7.60303 10Z"}},{tag:"path",attrs:{d:"M1.66943 5.29023C1.66941 3.85426 2.83349 2.69017 4.26946 2.69019L10.9362 2.69026C12.3192 2.69028 13.45 3.77008 13.5315 5.13259L14.5692 4.55638C15.3024 4.14929 16.2032 4.67947 16.2032 5.51809V10.4819C16.2032 11.3205 15.3024 11.8507 14.5692 11.4436L13.5315 10.8674C13.45 12.2299 12.3192 13.3097 10.9362 13.3097H4.26953C2.83361 13.3097 1.66956 12.1457 1.66953 10.7098L1.66943 5.29023ZM13.5362 9.49743L15.0032 10.312V5.68799L13.5362 6.50254V9.49743ZM4.26945 3.89019C3.49623 3.89018 2.86942 4.517 2.86943 5.29021L2.86953 10.7098C2.86955 11.483 3.49634 12.1097 4.26953 12.1097H10.9362C11.7094 12.1097 12.3362 11.4829 12.3362 10.7097V5.29026C12.3362 4.51707 11.7094 3.89027 10.9362 3.89026L4.26945 3.89019Z",fillRule:"evenodd",clipRule:"evenodd"}}]},{tag:"defs",attrs:{},children:[{tag:"clipPath",attrs:{id:"record-single_clip0_1559_19"},children:[{tag:"path",attrs:{fill:"#fff",d:"M0 0H16V16H0z",transform:"translate(.94)"}}]}]}],defIds:["record-single_clip0_1559_19"]},N=g.forwardRef(function(r,n){return g.createElement(q,Object.assign({},r,{id:"record-single",ref:n,icon:te}))});N.displayName="RecordSingle";var ne=Object.defineProperty,oe=Object.getOwnPropertyDescriptor,ie=(r,n,e,t)=>{for(var o=t>1?void 0:t?oe(n,e):n,i=r.length-1,c;i>=0;i--)(c=r[i])&&(o=(t?c(n,e,o):c(o))||o);return t&&o&&ne(n,e,o),o},x=(r,n)=>(e,t)=>n(e,t,r);exports.ActionRecorderService=class extends a.Disposable{constructor(e,t,o,i){super();S(this,"_shouldRecordCommands",new Set);S(this,"_panelOpened$",new b.BehaviorSubject(!1));S(this,"panelOpened$",this._panelOpened$.asObservable());S(this,"_recorder",null);S(this,"_recording$",new b.BehaviorSubject(!1));S(this,"recording$",this._recording$.asObservable());S(this,"_recorded$",new b.BehaviorSubject([]));S(this,"_recordedCommands$",new b.BehaviorSubject([]));S(this,"recordedCommands$",this._recordedCommands$.asObservable());this._commandSrv=e,this._logService=t,this._localFileService=o,this._instanceService=i}get recording(){return this._recording$.getValue()}get _recorded(){return this._recorded$.getValue()}get _recordedCommands(){return this._recordedCommands$.getValue()}registerRecordedCommand(e){if(e.type===a.CommandType.MUTATION)throw new Error("[CommandRecorderService] Cannot record mutation commands.");this._shouldRecordCommands.add(e.id)}togglePanel(e){this._panelOpened$.next(e),e===!1&&this.stopRecording()}startRecording(e=!1){this._recorder=this._commandSrv.onCommandExecuted(t=>{var o,i;if(this._shouldRecordCommands.has(t.id)){const c=this._recorded,l=this._recordedCommands;let d={...t};const h=(o=this._instanceService.getFocusedUnit())==null?void 0:o.getUnitId(),{unitId:f=h,subUnitId:m}=d==null?void 0:d.params;if(e&&f&&m){const y=(i=this._instanceService.getUnit(f).getSheetBySheetId(m))==null?void 0:i.getName();d={...d,params:{...d.params,subUnitId:y}}}d.id===s.SetSelectionsOperation.id&&c.length>0&&c[c.length-1].id===s.SetSelectionsOperation.id?c[c.length-1]=d:(c.push(d),this._recorded$.next(c),d.type===a.CommandType.COMMAND&&(l.push(d),this._recordedCommands$.next(l)))}}),this._recording$.next(!0)}stopRecording(){var e;(e=this._recorder)==null||e.dispose(),this._recorder=null,this._recorded$.next([]),this._recordedCommands$.next([]),this._recording$.next(!1)}completeRecording(){const e=this._recorded.slice();this._localFileService.downloadFile(new Blob([JSON.stringify(e,null,2)]),"recorded-commands.json"),this._logService.error("Recorded commands:",e),this.stopRecording()}};exports.ActionRecorderService=ie([x(0,a.ICommandService),x(1,a.ILogService),x(2,u.ILocalFileService),x(3,a.IUniverInstanceService)],exports.ActionRecorderService);const W={id:"action-recorder.command.start-recording",type:a.CommandType.COMMAND,handler:(r,n)=>(r.get(exports.ActionRecorderService).startRecording(!!(n!=null&&n.replaceId)),!0)},z={id:"action-recorder.command.complete-recording",type:a.CommandType.COMMAND,handler:r=>(r.get(exports.ActionRecorderService).completeRecording(),!0)},k={id:"action-recorder.command.stop-recording",type:a.CommandType.COMMAND,handler:r=>(r.get(exports.ActionRecorderService).completeRecording(),!0)};var ce=Object.defineProperty,ae=Object.getOwnPropertyDescriptor,se=(r,n,e,t)=>{for(var o=t>1?void 0:t?ae(n,e):n,i=r.length-1,c;i>=0;i--)(c=r[i])&&(o=(t?c(n,e,o):c(o))||o);return t&&o&&ce(n,e,o),o},O=(r,n)=>(e,t)=>n(e,t,r),w=(r=>(r.DEFAULT="default",r.NAME="name",r.ACTIVE="active",r))(w||{});exports.ActionReplayService=class extends a.Disposable{constructor(n,e,t,o,i){super(),this._messageService=n,this._instanceService=e,this._localFileService=t,this._logService=o,this._commandService=i}async replayLocalJSON(n="default"){const e=await this._localFileService.openFile({multiple:!1,accept:".json"});if(e.length!==1)return!1;const t=e[0];try{return this.replayCommands(JSON.parse(await t.text()),{mode:n})}catch{return this._messageService.show({type:R.MessageType.Error,content:`Failed to replay commands from local file ${t.name}.`}),!1}}async replayCommands(n,e){var i,c,l;const t=(i=this._instanceService.getFocusedUnit())==null?void 0:i.getUnitId();t||this._logService.error("[ReplayService]","no focused unit to replay commands");const{mode:o}=e||{};for(const d of n){const{id:h,params:f}=d,m=f;if(m){if(typeof m.unitId<"u"&&(m.unitId=t),o==="name"&&m.subUnitId!=="undefined"){const C=(c=this._instanceService.getFocusedUnit().getSheetBySheetName(m.subUnitId))==null?void 0:c.getSheetId();C?m.subUnitId=C:this._logService.error("[ReplayService]",`failed to find subunit by subUnitName = ${m.subUnitId}`)}if(o==="active"&&m.subUnitId!=="undefined"){const C=(l=this._instanceService.getFocusedUnit().getActiveSheet())==null?void 0:l.getSheetId();C?m.subUnitId=C:this._logService.error("[ReplayService]","failed to find active subunit")}if(!await this._commandService.executeCommand(h,f))return!1}else if(!await this._commandService.executeCommand(h))return!1}return!0}async replayCommandsWithDelay(n){var t;const e=(t=this._instanceService.getFocusedUnit())==null?void 0:t.getUnitId();e||this._logService.error("[ReplayService]","no focused unit to replay commands");for(const o of n){await a.awaitTime(de());const{id:i,params:c}=o;if(c){if(typeof c.unitId<"u"&&(c.unitId=e),!await this._commandService.executeCommand(i,c))return!1}else if(!await this._commandService.executeCommand(i))return!1}return!0}};exports.ActionReplayService=se([O(0,u.IMessageService),O(1,a.IUniverInstanceService),O(2,u.ILocalFileService),O(3,a.ILogService),O(4,a.ICommandService)],exports.ActionReplayService);function de(){return Math.floor(Math.random()*800)+200}const $={id:"action-recorder.command.replay-local-records",type:a.CommandType.COMMAND,handler:async r=>{const e=await r.get(exports.ActionReplayService).replayLocalJSON();return e&&r.get(u.IMessageService).show({type:R.MessageType.Success,content:"Successfully replayed local records"}),e}},E={id:"action-recorder.command.replay-local-records-name",type:a.CommandType.COMMAND,handler:async r=>{const e=await r.get(exports.ActionReplayService).replayLocalJSON(w.NAME);return e&&r.get(u.IMessageService).show({type:R.MessageType.Success,content:"Successfully replayed local records"}),e}},F={id:"action-recorder.command.replay-local-records-active",type:a.CommandType.COMMAND,handler:async r=>{const e=await r.get(exports.ActionReplayService).replayLocalJSON(w.ACTIVE);return e&&r.get(u.IMessageService).show({type:R.MessageType.Success,content:"Successfully replayed local records"}),e}},D={id:"action-recorder.operation.open-panel",type:a.CommandType.OPERATION,handler(r){return r.get(exports.ActionRecorderService).togglePanel(!0),!0}},H={id:"action-recorder.operation.close-panel",type:a.CommandType.OPERATION,handler(r){return r.get(exports.ActionRecorderService).togglePanel(!1),!0}};var j={exports:{}},A={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,4 +6,4 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var de=S,le=Symbol.for("react.element"),me=Symbol.for("react.fragment"),ue=Object.prototype.hasOwnProperty,fe=de.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,pe={key:!0,ref:!0,__self:!0,__source:!0};function H(e,n,r){var t,o={},c=null,i=null;r!==void 0&&(c=""+r),n.key!==void 0&&(c=""+n.key),n.ref!==void 0&&(i=n.ref);for(t in n)ue.call(n,t)&&!pe.hasOwnProperty(t)&&(o[t]=n[t]);if(e&&e.defaultProps)for(t in n=e.defaultProps,n)o[t]===void 0&&(o[t]=n[t]);return{$$typeof:le,type:e,key:c,ref:i,props:o,_owner:fe.current}}M.Fragment=me;M.jsx=H;M.jsxs=H;k.exports=M;var g=k.exports;function J(e){var n,r,t="";if(typeof e=="string"||typeof e=="number")t+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(n=0;n<o;n++)e[n]&&(r=J(e[n]))&&(t&&(t+=" "),t+=r)}else for(r in e)e[r]&&(t&&(t+=" "),t+=r);return t}function ve(){for(var e,n,r=0,t="",o=arguments.length;r<o;r++)(e=arguments[r])&&(n=J(e))&&(t&&(t+=" "),t+=n);return t}const Se="univer-action-recorder-panel",ge="univer-action-recorder-panel-icon",he="univer-action-recorder-panel-icon-recording",Ce="univer-recording",_e="univer-action-recorder-panel-title",ye="univer-action-recorder-panel-actions",O={actionRecorderPanel:Se,actionRecorderPanelIcon:ge,actionRecorderPanelIconRecording:he,recording:Ce,actionRecorderPanelTitle:_e,actionRecorderPanelActions:ye};function Re(){const e=a.useDependency(exports.ActionRecorderService);return d.useObservable(e.panelOpened$)?g.jsx(Ie,{}):null}function Ie(){var h;const e=a.useDependency(a.ICommandService),n=a.useDependency(exports.ActionRecorderService),r=d.useObservable(n.recording$),t=d.useObservable(n.recordedCommands$),o=(h=t==null?void 0:t.length)!=null?h:0,c=S.useCallback(()=>{r||e.executeCommand(z.id)},[e,r]),i=S.useCallback(f=>{r||e.executeCommand(V.id,{replaceId:f})},[e,r]),u=S.useCallback(()=>{r&&e.executeCommand(W.id)},[e,r]),l=S.useCallback(()=>{r&&e.executeCommand(q.id)},[e,r]),_=r?o===0?"Recording...":`${o}: ${t[o-1].id}`:"Start Recording";return g.jsxs("div",{className:O.actionRecorderPanel,children:[g.jsx("div",{className:ve(O.actionRecorderPanelIcon,r?O.actionRecorderPanelIconRecording:!1),children:g.jsx(U,{})}),g.jsx("div",{className:O.actionRecorderPanelTitle,children:_}),g.jsxs("div",{className:O.actionRecorderPanelActions,children:[g.jsx(C.Button,{type:"default",size:"small",onClick:r?l:c,children:r?"Cancel":"Close"}),g.jsx(C.Button,{type:"primary",size:"small",onClick:r?u:()=>i(),children:r?"Save":"Start"}),!r&&g.jsx(C.Button,{type:"primary",size:"small",onClick:()=>i(!0),children:"Start(N)"})]})]})}const G="RECORD_MENU_ITEM";function Oe(){return{id:G,type:d.MenuItemType.SUBITEMS,icon:"RecordSingle",tooltip:"action-recorder.menu.title"}}function Ae(e){const n=e.get(exports.ActionRecorderService);return{id:E.id,title:"action-recorder.menu.record",type:d.MenuItemType.BUTTON,disabled$:n.panelOpened$}}function Pe(){return{id:w.id,title:"action-recorder.menu.replay-local",type:d.MenuItemType.BUTTON}}function be(){return{id:$.id,title:"action-recorder.menu.replay-local-name",type:d.MenuItemType.BUTTON}}function Me(){return{id:F.id,title:"action-recorder.menu.replay-local-active",type:d.MenuItemType.BUTTON}}const xe={[d.RibbonStartGroup.OTHERS]:{[G]:{order:10,menuItemFactory:Oe,[E.id]:{order:1,menuItemFactory:Ae},[w.id]:{order:2,menuItemFactory:Pe},[$.id]:{order:3,menuItemFactory:be},[F.id]:{order:4,menuItemFactory:Me}}}};var Te=Object.defineProperty,je=Object.getOwnPropertyDescriptor,Ue=(e,n,r,t)=>{for(var o=t>1?void 0:t?je(n,r):n,c=e.length-1,i;c>=0;c--)(i=e[c])&&(o=(t?i(n,r,o):i(o))||o);return t&&o&&Te(n,r,o),o},y=(e,n)=>(r,t)=>n(r,t,e);let b=class extends a.Disposable{constructor(e,n,r,t,o,c){super(),this._commandSrv=e,this._uiPartsSrv=n,this._menuManagerService=r,this._componentManager=t,this._actionRecorderService=o,this._injector=c,this._initCommands(),this._initUI(),this._initSheetsCommands(),this._initDocsCommands()}_initCommands(){[V,q,W,E,z,w,$,F].forEach(e=>this._commandSrv.registerCommand(e))}_initUI(){this._uiPartsSrv.registerComponent(d.BuiltInUIPart.GLOBAL,()=>a.connectInjector(Re,this._injector)),this._componentManager.register("RecordSingle",U),this._menuManagerService.mergeMenu(xe)}_initSheetsCommands(){[s.CopySheetCommand,s.DeleteRangeMoveLeftCommand,s.DeleteRangeMoveUpCommand,s.DeltaColumnWidthCommand,s.DeltaRowHeightCommand,s.InsertSheetCommand,s.InsertColAfterCommand,s.InsertColBeforeCommand,s.InsertRowAfterCommand,s.InsertRowBeforeCommand,s.RemoveSheetCommand,s.SetStyleCommand,s.AddWorksheetMergeCommand,s.AddWorksheetMergeAllCommand,s.AddWorksheetMergeVerticalCommand,s.AddWorksheetMergeHorizontalCommand,s.SetFrozenCommand,s.CancelFrozenCommand,s.SetHorizontalTextAlignCommand,s.SetOverlineCommand,m.SetRangeBoldCommand,m.SetRangeFontFamilyCommand,m.SetRangeFontSizeCommand,m.SetRangeItalicCommand,m.SetRangeStrickThroughCommand,m.SetRangeSubscriptCommand,m.SetRangeSuperscriptCommand,m.SetRangeTextColorCommand,m.SetRangeUnderlineCommand,s.SetRangeValuesCommand,s.SetStrikeThroughCommand,s.SetTextColorCommand,s.SetTextRotationCommand,s.SetTextWrapCommand,s.SetVerticalTextAlignCommand,m.SheetCopyCommand,m.SheetCutCommand,m.SheetPasteBesidesBorderCommand,m.SheetPasteColWidthCommand,m.SheetPasteCommand,m.SheetPasteFormatCommand,m.SheetPasteShortKeyCommand,m.SheetPasteValueCommand,s.SetWorksheetActivateCommand,s.SetWorksheetActiveOperation,s.SetSelectionsOperation,T.SetSheetFilterRangeCommand,T.SetSheetsFilterCriteriaCommand,T.RemoveSheetFilterCommand].forEach(e=>this._actionRecorderService.registerRecordedCommand(e))}_initDocsCommands(){}};b=Ue([y(0,a.ICommandService),y(1,d.IUIPartsService),y(2,d.IMenuManagerService),y(3,a.Inject(d.ComponentManager)),y(4,a.Inject(exports.ActionRecorderService)),y(5,a.Inject(a.Injector))],b);const Ne="action-recorder.config",we={};var $e=Object.defineProperty,Fe=Object.getOwnPropertyDescriptor,Ee=(e,n,r,t)=>{for(var o=t>1?void 0:t?Fe(n,r):n,c=e.length-1,i;c>=0;c--)(i=e[c])&&(o=(t?i(n,r,o):i(o))||o);return t&&o&&$e(n,r,o),o},D=(e,n)=>(r,t)=>n(r,t,e),j;exports.UniverActionRecorderPlugin=(j=class extends a.Plugin{constructor(n=we,r,t){super(),this._config=n,this._injector=r,this._configService=t;const{menu:o,...c}=this._config;o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(Ne,c)}onStarting(){(this._config.replayOnly?[[exports.ActionReplayService]]:[[exports.ActionRecorderService],[exports.ActionReplayService],[b]]).forEach(r=>this._injector.add(r))}onSteady(){this._config.replayOnly||this._injector.get(b)}},v(j,"pluginName","UNIVER_ACTION_RECORDER_PLUGIN"),j);exports.UniverActionRecorderPlugin=Ee([D(1,a.Inject(a.Injector)),D(2,a.IConfigService)],exports.UniverActionRecorderPlugin);
9
+ */var L;function le(){if(L)return A;L=1;var r=g,n=Symbol.for("react.element"),e=Symbol.for("react.fragment"),t=Object.prototype.hasOwnProperty,o=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function c(l,d,h){var f,m={},y=null,C=null;h!==void 0&&(y=""+h),d.key!==void 0&&(y=""+d.key),d.ref!==void 0&&(C=d.ref);for(f in d)t.call(d,f)&&!i.hasOwnProperty(f)&&(m[f]=d[f]);if(l&&l.defaultProps)for(f in d=l.defaultProps,d)m[f]===void 0&&(m[f]=d[f]);return{$$typeof:n,type:l,key:y,ref:C,props:m,_owner:o.current}}return A.Fragment=e,A.jsx=c,A.jsxs=c,A}var B;function me(){return B||(B=1,j.exports=le()),j.exports}var _=me();function G(r){var n,e,t="";if(typeof r=="string"||typeof r=="number")t+=r;else if(typeof r=="object")if(Array.isArray(r)){var o=r.length;for(n=0;n<o;n++)r[n]&&(e=G(r[n]))&&(t&&(t+=" "),t+=e)}else for(e in r)r[e]&&(t&&(t+=" "),t+=e);return t}function ue(){for(var r,n,e=0,t="",o=arguments.length;e<o;e++)(r=arguments[e])&&(n=G(r))&&(t&&(t+=" "),t+=n);return t}const fe="univer-action-recorder-panel",pe="univer-action-recorder-panel-icon",ve="univer-action-recorder-panel-icon-recording",Se="univer-recording",ge="univer-action-recorder-panel-title",he="univer-action-recorder-panel-actions",P={actionRecorderPanel:fe,actionRecorderPanelIcon:pe,actionRecorderPanelIconRecording:ve,recording:Se,actionRecorderPanelTitle:ge,actionRecorderPanelActions:he};function _e(){const r=a.useDependency(exports.ActionRecorderService);return u.useObservable(r.panelOpened$)?_.jsx(Ce,{}):null}function Ce(){var f;const r=a.useDependency(a.ICommandService),n=a.useDependency(exports.ActionRecorderService),e=u.useObservable(n.recording$),t=u.useObservable(n.recordedCommands$),o=(f=t==null?void 0:t.length)!=null?f:0,i=g.useCallback(()=>{e||r.executeCommand(H.id)},[r,e]),c=g.useCallback(m=>{e||r.executeCommand(W.id,{replaceId:m})},[r,e]),l=g.useCallback(()=>{e&&r.executeCommand(z.id)},[r,e]),d=g.useCallback(()=>{e&&r.executeCommand(k.id)},[r,e]),h=e?o===0?"Recording...":`${o}: ${t[o-1].id}`:"Start Recording";return _.jsxs("div",{className:P.actionRecorderPanel,children:[_.jsx("div",{className:ue(P.actionRecorderPanelIcon,e?P.actionRecorderPanelIconRecording:!1),children:_.jsx(N,{})}),_.jsx("div",{className:P.actionRecorderPanelTitle,children:h}),_.jsxs("div",{className:P.actionRecorderPanelActions,children:[_.jsx(R.Button,{type:"default",size:"small",onClick:e?d:i,children:e?"Cancel":"Close"}),_.jsx(R.Button,{type:"primary",size:"small",onClick:e?l:()=>c(),children:e?"Save":"Start"}),!e&&_.jsx(R.Button,{type:"primary",size:"small",onClick:()=>c(!0),children:"Start(N)"})]})]})}const Z="RECORD_MENU_ITEM";function ye(){return{id:Z,type:u.MenuItemType.SUBITEMS,icon:"RecordSingle",tooltip:"action-recorder.menu.title"}}function Re(r){const n=r.get(exports.ActionRecorderService);return{id:D.id,title:"action-recorder.menu.record",type:u.MenuItemType.BUTTON,disabled$:n.panelOpened$}}function Ie(){return{id:$.id,title:"action-recorder.menu.replay-local",type:u.MenuItemType.BUTTON}}function Oe(){return{id:E.id,title:"action-recorder.menu.replay-local-name",type:u.MenuItemType.BUTTON}}function Ae(){return{id:F.id,title:"action-recorder.menu.replay-local-active",type:u.MenuItemType.BUTTON}}const Pe={[u.RibbonStartGroup.OTHERS]:{[Z]:{order:10,menuItemFactory:ye,[D.id]:{order:1,menuItemFactory:Re},[$.id]:{order:2,menuItemFactory:Ie},[E.id]:{order:3,menuItemFactory:Oe},[F.id]:{order:4,menuItemFactory:Ae}}}};var be=Object.defineProperty,xe=Object.getOwnPropertyDescriptor,Me=(r,n,e,t)=>{for(var o=t>1?void 0:t?xe(n,e):n,i=r.length-1,c;i>=0;i--)(c=r[i])&&(o=(t?c(n,e,o):c(o))||o);return t&&o&&be(n,e,o),o},I=(r,n)=>(e,t)=>n(e,t,r);let M=class extends a.Disposable{constructor(r,n,e,t,o,i){super(),this._commandSrv=r,this._uiPartsSrv=n,this._menuManagerService=e,this._componentManager=t,this._actionRecorderService=o,this._injector=i,this._initCommands(),this._initUI(),this._initSheetsCommands(),this._initDocsCommands()}_initCommands(){[W,k,z,D,H,$,E,F].forEach(r=>this._commandSrv.registerCommand(r))}_initUI(){this._uiPartsSrv.registerComponent(u.BuiltInUIPart.GLOBAL,()=>a.connectInjector(_e,this._injector)),this._componentManager.register("RecordSingle",N),this._menuManagerService.mergeMenu(Pe)}_initSheetsCommands(){[s.CopySheetCommand,s.DeleteRangeMoveLeftCommand,s.DeleteRangeMoveUpCommand,s.DeltaColumnWidthCommand,s.DeltaRowHeightCommand,s.InsertSheetCommand,s.InsertColAfterCommand,s.InsertColBeforeCommand,s.InsertRowAfterCommand,s.InsertRowBeforeCommand,s.RemoveSheetCommand,s.SetStyleCommand,s.AddWorksheetMergeCommand,s.AddWorksheetMergeAllCommand,s.AddWorksheetMergeVerticalCommand,s.AddWorksheetMergeHorizontalCommand,s.SetFrozenCommand,s.CancelFrozenCommand,s.SetHorizontalTextAlignCommand,s.SetOverlineCommand,p.SetRangeBoldCommand,p.SetRangeFontFamilyCommand,p.SetRangeFontSizeCommand,p.SetRangeItalicCommand,p.SetRangeStrickThroughCommand,p.SetRangeSubscriptCommand,p.SetRangeSuperscriptCommand,p.SetRangeTextColorCommand,p.SetRangeUnderlineCommand,s.SetRangeValuesCommand,s.SetStrikeThroughCommand,s.SetTextColorCommand,s.SetTextRotationCommand,s.SetTextWrapCommand,s.SetVerticalTextAlignCommand,p.SheetCopyCommand,p.SheetCutCommand,p.SheetPasteBesidesBorderCommand,p.SheetPasteColWidthCommand,p.SheetPasteCommand,p.SheetPasteFormatCommand,p.SheetPasteShortKeyCommand,p.SheetPasteValueCommand,s.SetWorksheetActivateCommand,s.SetWorksheetActiveOperation,s.SetSelectionsOperation,T.SetSheetFilterRangeCommand,T.SetSheetsFilterCriteriaCommand,T.RemoveSheetFilterCommand].forEach(r=>this._actionRecorderService.registerRecordedCommand(r))}_initDocsCommands(){}};M=Me([I(0,a.ICommandService),I(1,u.IUIPartsService),I(2,u.IMenuManagerService),I(3,a.Inject(u.ComponentManager)),I(4,a.Inject(exports.ActionRecorderService)),I(5,a.Inject(a.Injector))],M);const Te="action-recorder.config",je={};var Ue=Object.defineProperty,Ne=Object.getOwnPropertyDescriptor,we=(r,n,e,t)=>{for(var o=t>1?void 0:t?Ne(n,e):n,i=r.length-1,c;i>=0;i--)(c=r[i])&&(o=(t?c(n,e,o):c(o))||o);return t&&o&&Ue(n,e,o),o},V=(r,n)=>(e,t)=>n(e,t,r),U;exports.UniverActionRecorderPlugin=(U=class extends a.Plugin{constructor(n=je,e,t){super(),this._config=n,this._injector=e,this._configService=t;const{menu:o,...i}=this._config;o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(Te,i)}onStarting(){(this._config.replayOnly?[[exports.ActionReplayService]]:[[exports.ActionRecorderService],[exports.ActionReplayService],[M]]).forEach(e=>this._injector.add(e))}onSteady(){this._config.replayOnly||this._injector.get(M)}},S(U,"pluginName","UNIVER_ACTION_RECORDER_PLUGIN"),U);exports.UniverActionRecorderPlugin=we([V(1,a.Inject(a.Injector)),V(2,a.IConfigService)],exports.UniverActionRecorderPlugin);
@@ -0,0 +1 @@
1
+ "use strict";const e={"action-recorder":{menu:{title:"Enregistrer les actions",record:"Enregistrer les actions...","replay-local":"Lecture de l'enregistrement local..."}}};module.exports=e;
package/lib/es/index.js CHANGED
@@ -1,40 +1,40 @@
1
- var se = Object.defineProperty;
2
- var de = (e, r, t) => r in e ? se(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
3
- var m = (e, r, t) => de(e, typeof r != "symbol" ? r + "" : r, t);
4
- import { Disposable as F, CommandType as u, ICommandService as M, ILogService as k, IUniverInstanceService as G, awaitTime as le, useDependency as j, Inject as x, Injector as Z, connectInjector as me, Plugin as ue, IConfigService as fe } from "@univerjs/core";
5
- import { SetSelectionsOperation as T, CopySheetCommand as pe, DeleteRangeMoveLeftCommand as ge, DeleteRangeMoveUpCommand as he, DeltaColumnWidthCommand as ve, DeltaRowHeightCommand as Se, InsertSheetCommand as _e, InsertColAfterCommand as Ce, InsertColBeforeCommand as ye, InsertRowAfterCommand as Re, InsertRowBeforeCommand as Ie, RemoveSheetCommand as Oe, SetStyleCommand as Pe, AddWorksheetMergeCommand as xe, AddWorksheetMergeAllCommand as be, AddWorksheetMergeVerticalCommand as Me, AddWorksheetMergeHorizontalCommand as Ne, SetFrozenCommand as Ue, CancelFrozenCommand as Ae, SetHorizontalTextAlignCommand as we, SetOverlineCommand as $e, SetRangeValuesCommand as je, SetStrikeThroughCommand as Te, SetTextColorCommand as Ee, SetTextRotationCommand as Fe, SetTextWrapCommand as De, SetVerticalTextAlignCommand as Le, SetWorksheetActivateCommand as Be, SetWorksheetActiveOperation as Ve } from "@univerjs/sheets";
6
- import { SetSheetFilterRangeCommand as We, SetSheetsFilterCriteriaCommand as ze, RemoveSheetFilterCommand as He } from "@univerjs/sheets-filter";
7
- import { SetRangeBoldCommand as Je, SetRangeFontFamilyCommand as ke, SetRangeFontSizeCommand as Ge, SetRangeItalicCommand as Ze, SetRangeStrickThroughCommand as qe, SetRangeSubscriptCommand as Ke, SetRangeSuperscriptCommand as Ye, SetRangeTextColorCommand as Qe, SetRangeUnderlineCommand as Xe, SheetCopyCommand as er, SheetCutCommand as rr, SheetPasteBesidesBorderCommand as tr, SheetPasteColWidthCommand as nr, SheetPasteCommand as or, SheetPasteFormatCommand as ir, SheetPasteShortKeyCommand as cr, SheetPasteValueCommand as ar } from "@univerjs/sheets-ui";
8
- import { ILocalFileService as q, IMessageService as N, useObservable as E, RibbonStartGroup as sr, MenuItemType as R, ComponentManager as dr, IUIPartsService as lr, IMenuManagerService as mr, BuiltInUIPart as ur } from "@univerjs/ui";
9
- import { BehaviorSubject as I } from "rxjs";
1
+ var le = Object.defineProperty;
2
+ var me = (e, r, t) => r in e ? le(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
3
+ var u = (e, r, t) => me(e, typeof r != "symbol" ? r + "" : r, t);
4
+ import { Disposable as D, CommandType as g, ICommandService as M, ILogService as K, IUniverInstanceService as Y, awaitTime as ue, useDependency as T, Inject as b, Injector as Q, connectInjector as fe, Plugin as pe, IConfigService as ge } from "@univerjs/core";
5
+ import { SetSelectionsOperation as E, CopySheetCommand as he, DeleteRangeMoveLeftCommand as ve, DeleteRangeMoveUpCommand as Se, DeltaColumnWidthCommand as _e, DeltaRowHeightCommand as Ce, InsertSheetCommand as ye, InsertColAfterCommand as Re, InsertColBeforeCommand as Ie, InsertRowAfterCommand as Oe, InsertRowBeforeCommand as Pe, RemoveSheetCommand as xe, SetStyleCommand as be, AddWorksheetMergeCommand as Ne, AddWorksheetMergeAllCommand as Me, AddWorksheetMergeVerticalCommand as Ae, AddWorksheetMergeHorizontalCommand as Ue, SetFrozenCommand as we, CancelFrozenCommand as $e, SetHorizontalTextAlignCommand as je, SetOverlineCommand as Te, SetRangeValuesCommand as Ee, SetStrikeThroughCommand as Fe, SetTextColorCommand as De, SetTextRotationCommand as Le, SetTextWrapCommand as Be, SetVerticalTextAlignCommand as Ve, SetWorksheetActivateCommand as Je, SetWorksheetActiveOperation as We } from "@univerjs/sheets";
6
+ import { SetSheetFilterRangeCommand as ze, SetSheetsFilterCriteriaCommand as He, RemoveSheetFilterCommand as qe } from "@univerjs/sheets-filter";
7
+ import { SetRangeBoldCommand as ke, SetRangeFontFamilyCommand as Ge, SetRangeFontSizeCommand as Ze, SetRangeItalicCommand as Ke, SetRangeStrickThroughCommand as Ye, SetRangeSubscriptCommand as Qe, SetRangeSuperscriptCommand as Xe, SetRangeTextColorCommand as er, SetRangeUnderlineCommand as rr, SheetCopyCommand as tr, SheetCutCommand as nr, SheetPasteBesidesBorderCommand as or, SheetPasteColWidthCommand as ir, SheetPasteCommand as cr, SheetPasteFormatCommand as ar, SheetPasteShortKeyCommand as sr, SheetPasteValueCommand as dr } from "@univerjs/sheets-ui";
8
+ import { ILocalFileService as X, IMessageService as A, useObservable as F, RibbonStartGroup as lr, MenuItemType as I, ComponentManager as mr, IUIPartsService as ur, IMenuManagerService as fr, BuiltInUIPart as pr } from "@univerjs/ui";
9
+ import { BehaviorSubject as O } from "rxjs";
10
10
  import { MessageType as U, Button as w } from "@univerjs/design";
11
- import fr, { forwardRef as K, useRef as pr, createElement as Y, useCallback as O } from "react";
12
- var d = function() {
13
- return d = Object.assign || function(e) {
11
+ import gr, { forwardRef as ee, useRef as hr, createElement as re, useCallback as P } from "react";
12
+ var l = function() {
13
+ return l = Object.assign || function(e) {
14
14
  for (var r, t = 1, n = arguments.length; t < n; t++) {
15
15
  r = arguments[t];
16
16
  for (var o in r) Object.prototype.hasOwnProperty.call(r, o) && (e[o] = r[o]);
17
17
  }
18
18
  return e;
19
- }, d.apply(this, arguments);
20
- }, gr = function(e, r) {
19
+ }, l.apply(this, arguments);
20
+ }, vr = function(e, r) {
21
21
  var t = {};
22
22
  for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && r.indexOf(n) < 0 && (t[n] = e[n]);
23
23
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
24
24
  for (var o = 0, n = Object.getOwnPropertySymbols(e); o < n.length; o++)
25
25
  r.indexOf(n[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[o]) && (t[n[o]] = e[n[o]]);
26
26
  return t;
27
- }, Q = K(function(e, r) {
28
- var t = e.icon, n = e.id, o = e.className, i = e.extend, c = gr(e, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(n, " ").concat(o || "").trim(), p = pr("_".concat(Sr()));
29
- return X(t, "".concat(n), { defIds: t.defIds, idSuffix: p.current }, d({ ref: r, className: a }, c), i);
27
+ }, te = ee(function(e, r) {
28
+ var t = e.icon, n = e.id, o = e.className, i = e.extend, c = vr(e, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(n, " ").concat(o || "").trim(), d = hr("_".concat(Cr()));
29
+ return ne(t, "".concat(n), { defIds: t.defIds, idSuffix: d.current }, l({ ref: r, className: a }, c), i);
30
30
  });
31
- function X(e, r, t, n, o) {
32
- return Y(e.tag, d(d({ key: r }, hr(e, t, o)), n), (vr(e, t).children || []).map(function(i, c) {
33
- return X(i, "".concat(r, "-").concat(e.tag, "-").concat(c), t, void 0, o);
31
+ function ne(e, r, t, n, o) {
32
+ return re(e.tag, l(l({ key: r }, Sr(e, t, o)), n), (_r(e, t).children || []).map(function(i, c) {
33
+ return ne(i, "".concat(r, "-").concat(e.tag, "-").concat(c), t, void 0, o);
34
34
  }));
35
35
  }
36
- function hr(e, r, t) {
37
- var n = d({}, e.attrs);
36
+ function Sr(e, r, t) {
37
+ var n = l({}, e.attrs);
38
38
  t != null && t.colorChannel1 && n.fill === "colorChannel1" && (n.fill = t.colorChannel1);
39
39
  var o = r.defIds;
40
40
  return !o || o.length === 0 || (e.tag === "use" && n["xlink:href"] && (n["xlink:href"] = n["xlink:href"] + r.idSuffix), Object.entries(n).forEach(function(i) {
@@ -42,41 +42,41 @@ function hr(e, r, t) {
42
42
  typeof a == "string" && (n[c] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(r.idSuffix, ")")));
43
43
  })), n;
44
44
  }
45
- function vr(e, r) {
45
+ function _r(e, r) {
46
46
  var t, n = r.defIds;
47
- return !n || n.length === 0 ? e : e.tag === "defs" && (!((t = e.children) === null || t === void 0) && t.length) ? d(d({}, e), { children: e.children.map(function(o) {
48
- return typeof o.attrs.id == "string" && n && n.indexOf(o.attrs.id) > -1 ? d(d({}, o), { attrs: d(d({}, o.attrs), { id: o.attrs.id + r.idSuffix }) }) : o;
47
+ return !n || n.length === 0 ? e : e.tag === "defs" && (!((t = e.children) === null || t === void 0) && t.length) ? l(l({}, e), { children: e.children.map(function(o) {
48
+ return typeof o.attrs.id == "string" && n && n.indexOf(o.attrs.id) > -1 ? l(l({}, o), { attrs: l(l({}, o.attrs), { id: o.attrs.id + r.idSuffix }) }) : o;
49
49
  }) }) : e;
50
50
  }
51
- function Sr() {
51
+ function Cr() {
52
52
  return Math.random().toString(36).substring(2, 8);
53
53
  }
54
- Q.displayName = "UniverIcon";
55
- var _r = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "g", attrs: { fill: "currentColor", clipPath: "url(#record-single_clip0_1559_19)" }, children: [{ tag: "path", attrs: { d: "M7.60303 10C8.7076 10 9.60303 9.10457 9.60303 8C9.60303 6.89543 8.7076 6 7.60303 6C6.49846 6 5.60303 6.89543 5.60303 8C5.60303 9.10457 6.49846 10 7.60303 10Z" } }, { tag: "path", attrs: { d: "M1.66943 5.29023C1.66941 3.85426 2.83349 2.69017 4.26946 2.69019L10.9362 2.69026C12.3192 2.69028 13.45 3.77008 13.5315 5.13259L14.5692 4.55638C15.3024 4.14929 16.2032 4.67947 16.2032 5.51809V10.4819C16.2032 11.3205 15.3024 11.8507 14.5692 11.4436L13.5315 10.8674C13.45 12.2299 12.3192 13.3097 10.9362 13.3097H4.26953C2.83361 13.3097 1.66956 12.1457 1.66953 10.7098L1.66943 5.29023ZM13.5362 9.49743L15.0032 10.312V5.68799L13.5362 6.50254V9.49743ZM4.26945 3.89019C3.49623 3.89018 2.86942 4.517 2.86943 5.29021L2.86953 10.7098C2.86955 11.483 3.49634 12.1097 4.26953 12.1097H10.9362C11.7094 12.1097 12.3362 11.4829 12.3362 10.7097V5.29026C12.3362 4.51707 11.7094 3.89027 10.9362 3.89026L4.26945 3.89019Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, { tag: "defs", attrs: {}, children: [{ tag: "clipPath", attrs: { id: "record-single_clip0_1559_19" }, children: [{ tag: "path", attrs: { fill: "#fff", d: "M0 0H16V16H0z", transform: "translate(.94)" } }] }] }], defIds: ["record-single_clip0_1559_19"] }, D = K(function(e, r) {
56
- return Y(Q, Object.assign({}, e, {
54
+ te.displayName = "UniverIcon";
55
+ var yr = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "g", attrs: { fill: "currentColor", clipPath: "url(#record-single_clip0_1559_19)" }, children: [{ tag: "path", attrs: { d: "M7.60303 10C8.7076 10 9.60303 9.10457 9.60303 8C9.60303 6.89543 8.7076 6 7.60303 6C6.49846 6 5.60303 6.89543 5.60303 8C5.60303 9.10457 6.49846 10 7.60303 10Z" } }, { tag: "path", attrs: { d: "M1.66943 5.29023C1.66941 3.85426 2.83349 2.69017 4.26946 2.69019L10.9362 2.69026C12.3192 2.69028 13.45 3.77008 13.5315 5.13259L14.5692 4.55638C15.3024 4.14929 16.2032 4.67947 16.2032 5.51809V10.4819C16.2032 11.3205 15.3024 11.8507 14.5692 11.4436L13.5315 10.8674C13.45 12.2299 12.3192 13.3097 10.9362 13.3097H4.26953C2.83361 13.3097 1.66956 12.1457 1.66953 10.7098L1.66943 5.29023ZM13.5362 9.49743L15.0032 10.312V5.68799L13.5362 6.50254V9.49743ZM4.26945 3.89019C3.49623 3.89018 2.86942 4.517 2.86943 5.29021L2.86953 10.7098C2.86955 11.483 3.49634 12.1097 4.26953 12.1097H10.9362C11.7094 12.1097 12.3362 11.4829 12.3362 10.7097V5.29026C12.3362 4.51707 11.7094 3.89027 10.9362 3.89026L4.26945 3.89019Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, { tag: "defs", attrs: {}, children: [{ tag: "clipPath", attrs: { id: "record-single_clip0_1559_19" }, children: [{ tag: "path", attrs: { fill: "#fff", d: "M0 0H16V16H0z", transform: "translate(.94)" } }] }] }], defIds: ["record-single_clip0_1559_19"] }, L = ee(function(e, r) {
56
+ return re(te, Object.assign({}, e, {
57
57
  id: "record-single",
58
58
  ref: r,
59
- icon: _r
59
+ icon: yr
60
60
  }));
61
61
  });
62
- D.displayName = "RecordSingle";
63
- var Cr = Object.defineProperty, yr = Object.getOwnPropertyDescriptor, Rr = (e, r, t, n) => {
64
- for (var o = n > 1 ? void 0 : n ? yr(r, t) : r, i = e.length - 1, c; i >= 0; i--)
62
+ L.displayName = "RecordSingle";
63
+ var Rr = Object.defineProperty, Ir = Object.getOwnPropertyDescriptor, Or = (e, r, t, n) => {
64
+ for (var o = n > 1 ? void 0 : n ? Ir(r, t) : r, i = e.length - 1, c; i >= 0; i--)
65
65
  (c = e[i]) && (o = (n ? c(r, t, o) : c(o)) || o);
66
- return n && o && Cr(r, t, o), o;
67
- }, P = (e, r) => (t, n) => r(t, n, e);
68
- let l = class extends F {
66
+ return n && o && Rr(r, t, o), o;
67
+ }, x = (e, r) => (t, n) => r(t, n, e);
68
+ let m = class extends D {
69
69
  constructor(r, t, n, o) {
70
70
  super();
71
- m(this, "_shouldRecordCommands", /* @__PURE__ */ new Set());
72
- m(this, "_panelOpened$", new I(!1));
73
- m(this, "panelOpened$", this._panelOpened$.asObservable());
74
- m(this, "_recorder", null);
75
- m(this, "_recording$", new I(!1));
76
- m(this, "recording$", this._recording$.asObservable());
77
- m(this, "_recorded$", new I([]));
78
- m(this, "_recordedCommands$", new I([]));
79
- m(this, "recordedCommands$", this._recordedCommands$.asObservable());
71
+ u(this, "_shouldRecordCommands", /* @__PURE__ */ new Set());
72
+ u(this, "_panelOpened$", new O(!1));
73
+ u(this, "panelOpened$", this._panelOpened$.asObservable());
74
+ u(this, "_recorder", null);
75
+ u(this, "_recording$", new O(!1));
76
+ u(this, "recording$", this._recording$.asObservable());
77
+ u(this, "_recorded$", new O([]));
78
+ u(this, "_recordedCommands$", new O([]));
79
+ u(this, "recordedCommands$", this._recordedCommands$.asObservable());
80
80
  this._commandSrv = r, this._logService = t, this._localFileService = n, this._instanceService = o;
81
81
  }
82
82
  get recording() {
@@ -89,7 +89,7 @@ let l = class extends F {
89
89
  return this._recordedCommands$.getValue();
90
90
  }
91
91
  registerRecordedCommand(r) {
92
- if (r.type === u.MUTATION) throw new Error("[CommandRecorderService] Cannot record mutation commands.");
92
+ if (r.type === g.MUTATION) throw new Error("[CommandRecorderService] Cannot record mutation commands.");
93
93
  this._shouldRecordCommands.add(r.id);
94
94
  }
95
95
  togglePanel(r) {
@@ -101,18 +101,18 @@ let l = class extends F {
101
101
  if (this._shouldRecordCommands.has(t.id)) {
102
102
  const i = this._recorded, c = this._recordedCommands;
103
103
  let a = { ...t };
104
- const p = (n = this._instanceService.getFocusedUnit()) == null ? void 0 : n.getUnitId(), { unitId: g = p, subUnitId: s } = a == null ? void 0 : a.params;
105
- if (r && g && s) {
106
- const S = (o = this._instanceService.getUnit(g).getSheetBySheetId(s)) == null ? void 0 : o.getName();
104
+ const d = (n = this._instanceService.getFocusedUnit()) == null ? void 0 : n.getUnitId(), { unitId: f = d, subUnitId: s } = a == null ? void 0 : a.params;
105
+ if (r && f && s) {
106
+ const p = (o = this._instanceService.getUnit(f).getSheetBySheetId(s)) == null ? void 0 : o.getName();
107
107
  a = {
108
108
  ...a,
109
109
  params: {
110
110
  ...a.params,
111
- subUnitId: S
111
+ subUnitId: p
112
112
  }
113
113
  };
114
114
  }
115
- a.id === T.id && i.length > 0 && i[i.length - 1].id === T.id ? i[i.length - 1] = a : (i.push(a), this._recorded$.next(i), a.type === u.COMMAND && (c.push(a), this._recordedCommands$.next(c)));
115
+ a.id === E.id && i.length > 0 && i[i.length - 1].id === E.id ? i[i.length - 1] = a : (i.push(a), this._recorded$.next(i), a.type === g.COMMAND && (c.push(a), this._recordedCommands$.next(c)));
116
116
  }
117
117
  }), this._recording$.next(!0);
118
118
  }
@@ -125,31 +125,31 @@ let l = class extends F {
125
125
  this._localFileService.downloadFile(new Blob([JSON.stringify(r, null, 2)]), "recorded-commands.json"), this._logService.error("Recorded commands:", r), this.stopRecording();
126
126
  }
127
127
  };
128
- l = Rr([
129
- P(0, M),
130
- P(1, k),
131
- P(2, q),
132
- P(3, G)
133
- ], l);
134
- const ee = {
128
+ m = Or([
129
+ x(0, M),
130
+ x(1, K),
131
+ x(2, X),
132
+ x(3, Y)
133
+ ], m);
134
+ const oe = {
135
135
  id: "action-recorder.command.start-recording",
136
- type: u.COMMAND,
137
- handler: (e, r) => (e.get(l).startRecording(!!(r != null && r.replaceId)), !0)
138
- }, re = {
136
+ type: g.COMMAND,
137
+ handler: (e, r) => (e.get(m).startRecording(!!(r != null && r.replaceId)), !0)
138
+ }, ie = {
139
139
  id: "action-recorder.command.complete-recording",
140
- type: u.COMMAND,
141
- handler: (e) => (e.get(l).completeRecording(), !0)
142
- }, te = {
140
+ type: g.COMMAND,
141
+ handler: (e) => (e.get(m).completeRecording(), !0)
142
+ }, ce = {
143
143
  id: "action-recorder.command.stop-recording",
144
- type: u.COMMAND,
145
- handler: (e) => (e.get(l).completeRecording(), !0)
144
+ type: g.COMMAND,
145
+ handler: (e) => (e.get(m).completeRecording(), !0)
146
146
  };
147
- var Ir = Object.defineProperty, Or = Object.getOwnPropertyDescriptor, Pr = (e, r, t, n) => {
148
- for (var o = n > 1 ? void 0 : n ? Or(r, t) : r, i = e.length - 1, c; i >= 0; i--)
147
+ var Pr = Object.defineProperty, xr = Object.getOwnPropertyDescriptor, br = (e, r, t, n) => {
148
+ for (var o = n > 1 ? void 0 : n ? xr(r, t) : r, i = e.length - 1, c; i >= 0; i--)
149
149
  (c = e[i]) && (o = (n ? c(r, t, o) : c(o)) || o);
150
- return n && o && Ir(r, t, o), o;
151
- }, C = (e, r) => (t, n) => r(t, n, e), L = /* @__PURE__ */ ((e) => (e.DEFAULT = "default", e.NAME = "name", e.ACTIVE = "active", e))(L || {});
152
- let h = class extends F {
150
+ return n && o && Pr(r, t, o), o;
151
+ }, C = (e, r) => (t, n) => r(t, n, e), B = /* @__PURE__ */ ((e) => (e.DEFAULT = "default", e.NAME = "name", e.ACTIVE = "active", e))(B || {});
152
+ let S = class extends D {
153
153
  constructor(e, r, t, n, o) {
154
154
  super(), this._messageService = e, this._instanceService = r, this._localFileService = t, this._logService = n, this._commandService = o;
155
155
  }
@@ -180,18 +180,18 @@ let h = class extends F {
180
180
  t || this._logService.error("[ReplayService]", "no focused unit to replay commands");
181
181
  const { mode: n } = r || {};
182
182
  for (const a of e) {
183
- const { id: p, params: g } = a, s = g;
183
+ const { id: d, params: f } = a, s = f;
184
184
  if (s) {
185
185
  if (typeof s.unitId < "u" && (s.unitId = t), n === "name" && s.subUnitId !== "undefined") {
186
- const _ = (i = this._instanceService.getFocusedUnit().getSheetBySheetName(s.subUnitId)) == null ? void 0 : i.getSheetId();
187
- _ ? s.subUnitId = _ : this._logService.error("[ReplayService]", `failed to find subunit by subUnitName = ${s.subUnitId}`);
186
+ const h = (i = this._instanceService.getFocusedUnit().getSheetBySheetName(s.subUnitId)) == null ? void 0 : i.getSheetId();
187
+ h ? s.subUnitId = h : this._logService.error("[ReplayService]", `failed to find subunit by subUnitName = ${s.subUnitId}`);
188
188
  }
189
189
  if (n === "active" && s.subUnitId !== "undefined") {
190
- const _ = (c = this._instanceService.getFocusedUnit().getActiveSheet()) == null ? void 0 : c.getSheetId();
191
- _ ? s.subUnitId = _ : this._logService.error("[ReplayService]", "failed to find active subunit");
190
+ const h = (c = this._instanceService.getFocusedUnit().getActiveSheet()) == null ? void 0 : c.getSheetId();
191
+ h ? s.subUnitId = h : this._logService.error("[ReplayService]", "failed to find active subunit");
192
192
  }
193
- if (!await this._commandService.executeCommand(p, g)) return !1;
194
- } else if (!await this._commandService.executeCommand(p)) return !1;
193
+ if (!await this._commandService.executeCommand(d, f)) return !1;
194
+ } else if (!await this._commandService.executeCommand(d)) return !1;
195
195
  }
196
196
  return !0;
197
197
  }
@@ -204,7 +204,7 @@ let h = class extends F {
204
204
  const r = (t = this._instanceService.getFocusedUnit()) == null ? void 0 : t.getUnitId();
205
205
  r || this._logService.error("[ReplayService]", "no focused unit to replay commands");
206
206
  for (const n of e) {
207
- await le(xr());
207
+ await ue(Nr());
208
208
  const { id: o, params: i } = n;
209
209
  if (i) {
210
210
  if (typeof i.unitId < "u" && (i.unitId = r), !await this._commandService.executeCommand(o, i)) return !1;
@@ -213,60 +213,60 @@ let h = class extends F {
213
213
  return !0;
214
214
  }
215
215
  };
216
- h = Pr([
217
- C(0, N),
218
- C(1, G),
219
- C(2, q),
220
- C(3, k),
216
+ S = br([
217
+ C(0, A),
218
+ C(1, Y),
219
+ C(2, X),
220
+ C(3, K),
221
221
  C(4, M)
222
- ], h);
223
- function xr() {
222
+ ], S);
223
+ function Nr() {
224
224
  return Math.floor(Math.random() * 800) + 200;
225
225
  }
226
- const B = {
226
+ const V = {
227
227
  id: "action-recorder.command.replay-local-records",
228
- type: u.COMMAND,
228
+ type: g.COMMAND,
229
229
  handler: async (e) => {
230
- const t = await e.get(h).replayLocalJSON();
231
- return t && e.get(N).show({
230
+ const t = await e.get(S).replayLocalJSON();
231
+ return t && e.get(A).show({
232
232
  type: U.Success,
233
233
  content: "Successfully replayed local records"
234
234
  }), t;
235
235
  }
236
- }, V = {
236
+ }, J = {
237
237
  id: "action-recorder.command.replay-local-records-name",
238
- type: u.COMMAND,
238
+ type: g.COMMAND,
239
239
  handler: async (e) => {
240
- const t = await e.get(h).replayLocalJSON(L.NAME);
241
- return t && e.get(N).show({
240
+ const t = await e.get(S).replayLocalJSON(B.NAME);
241
+ return t && e.get(A).show({
242
242
  type: U.Success,
243
243
  content: "Successfully replayed local records"
244
244
  }), t;
245
245
  }
246
246
  }, W = {
247
247
  id: "action-recorder.command.replay-local-records-active",
248
- type: u.COMMAND,
248
+ type: g.COMMAND,
249
249
  handler: async (e) => {
250
- const t = await e.get(h).replayLocalJSON(L.ACTIVE);
251
- return t && e.get(N).show({
250
+ const t = await e.get(S).replayLocalJSON(B.ACTIVE);
251
+ return t && e.get(A).show({
252
252
  type: U.Success,
253
253
  content: "Successfully replayed local records"
254
254
  }), t;
255
255
  }
256
256
  }, z = {
257
257
  id: "action-recorder.operation.open-panel",
258
- type: u.OPERATION,
258
+ type: g.OPERATION,
259
259
  handler(e) {
260
- return e.get(l).togglePanel(!0), !0;
260
+ return e.get(m).togglePanel(!0), !0;
261
261
  }
262
- }, ne = {
262
+ }, ae = {
263
263
  id: "action-recorder.operation.close-panel",
264
- type: u.OPERATION,
264
+ type: g.OPERATION,
265
265
  handler(e) {
266
- return e.get(l).togglePanel(!1), !0;
266
+ return e.get(m).togglePanel(!1), !0;
267
267
  }
268
268
  };
269
- var oe = { exports: {} }, A = {};
269
+ var $ = { exports: {} }, y = {};
270
270
  /**
271
271
  * @license React
272
272
  * react-jsx-runtime.production.min.js
@@ -276,159 +276,163 @@ var oe = { exports: {} }, A = {};
276
276
  * This source code is licensed under the MIT license found in the
277
277
  * LICENSE file in the root directory of this source tree.
278
278
  */
279
- var br = fr, Mr = Symbol.for("react.element"), Nr = Symbol.for("react.fragment"), Ur = Object.prototype.hasOwnProperty, Ar = br.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, wr = { key: !0, ref: !0, __self: !0, __source: !0 };
280
- function ie(e, r, t) {
281
- var n, o = {}, i = null, c = null;
282
- t !== void 0 && (i = "" + t), r.key !== void 0 && (i = "" + r.key), r.ref !== void 0 && (c = r.ref);
283
- for (n in r) Ur.call(r, n) && !wr.hasOwnProperty(n) && (o[n] = r[n]);
284
- if (e && e.defaultProps) for (n in r = e.defaultProps, r) o[n] === void 0 && (o[n] = r[n]);
285
- return { $$typeof: Mr, type: e, key: i, ref: c, props: o, _owner: Ar.current };
279
+ var q;
280
+ function Mr() {
281
+ if (q) return y;
282
+ q = 1;
283
+ var e = gr, r = Symbol.for("react.element"), t = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, o = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 };
284
+ function c(a, d, f) {
285
+ var s, p = {}, h = null, H = null;
286
+ f !== void 0 && (h = "" + f), d.key !== void 0 && (h = "" + d.key), d.ref !== void 0 && (H = d.ref);
287
+ for (s in d) n.call(d, s) && !i.hasOwnProperty(s) && (p[s] = d[s]);
288
+ if (a && a.defaultProps) for (s in d = a.defaultProps, d) p[s] === void 0 && (p[s] = d[s]);
289
+ return { $$typeof: r, type: a, key: h, ref: H, props: p, _owner: o.current };
290
+ }
291
+ return y.Fragment = t, y.jsx = c, y.jsxs = c, y;
292
+ }
293
+ var k;
294
+ function Ar() {
295
+ return k || (k = 1, $.exports = Mr()), $.exports;
286
296
  }
287
- A.Fragment = Nr;
288
- A.jsx = ie;
289
- A.jsxs = ie;
290
- oe.exports = A;
291
- var f = oe.exports;
292
- function ce(e) {
297
+ var v = Ar();
298
+ function se(e) {
293
299
  var r, t, n = "";
294
300
  if (typeof e == "string" || typeof e == "number") n += e;
295
301
  else if (typeof e == "object") if (Array.isArray(e)) {
296
302
  var o = e.length;
297
- for (r = 0; r < o; r++) e[r] && (t = ce(e[r])) && (n && (n += " "), n += t);
303
+ for (r = 0; r < o; r++) e[r] && (t = se(e[r])) && (n && (n += " "), n += t);
298
304
  } else for (t in e) e[t] && (n && (n += " "), n += t);
299
305
  return n;
300
306
  }
301
- function $r() {
302
- for (var e, r, t = 0, n = "", o = arguments.length; t < o; t++) (e = arguments[t]) && (r = ce(e)) && (n && (n += " "), n += r);
307
+ function Ur() {
308
+ for (var e, r, t = 0, n = "", o = arguments.length; t < o; t++) (e = arguments[t]) && (r = se(e)) && (n && (n += " "), n += r);
303
309
  return n;
304
310
  }
305
- const jr = "univer-action-recorder-panel", Tr = "univer-action-recorder-panel-icon", Er = "univer-action-recorder-panel-icon-recording", Fr = "univer-recording", Dr = "univer-action-recorder-panel-title", Lr = "univer-action-recorder-panel-actions", y = {
306
- actionRecorderPanel: jr,
307
- actionRecorderPanelIcon: Tr,
308
- actionRecorderPanelIconRecording: Er,
309
- recording: Fr,
310
- actionRecorderPanelTitle: Dr,
311
- actionRecorderPanelActions: Lr
311
+ const wr = "univer-action-recorder-panel", $r = "univer-action-recorder-panel-icon", jr = "univer-action-recorder-panel-icon-recording", Tr = "univer-recording", Er = "univer-action-recorder-panel-title", Fr = "univer-action-recorder-panel-actions", R = {
312
+ actionRecorderPanel: wr,
313
+ actionRecorderPanelIcon: $r,
314
+ actionRecorderPanelIconRecording: jr,
315
+ recording: Tr,
316
+ actionRecorderPanelTitle: Er,
317
+ actionRecorderPanelActions: Fr
312
318
  };
313
- function Br() {
314
- const e = j(l);
315
- return E(e.panelOpened$) ? /* @__PURE__ */ f.jsx(Vr, {}) : null;
319
+ function Dr() {
320
+ const e = T(m);
321
+ return F(e.panelOpened$) ? /* @__PURE__ */ v.jsx(Lr, {}) : null;
316
322
  }
317
- function Vr() {
323
+ function Lr() {
318
324
  var s;
319
- const e = j(M), r = j(l), t = E(r.recording$), n = E(r.recordedCommands$), o = (s = n == null ? void 0 : n.length) != null ? s : 0, i = O(() => {
320
- t || e.executeCommand(ne.id);
321
- }, [e, t]), c = O((S) => {
322
- t || e.executeCommand(ee.id, { replaceId: S });
323
- }, [e, t]), a = O(() => {
324
- t && e.executeCommand(re.id);
325
- }, [e, t]), p = O(() => {
326
- t && e.executeCommand(te.id);
327
- }, [e, t]), g = t ? o === 0 ? "Recording..." : `${o}: ${n[o - 1].id}` : "Start Recording";
328
- return /* @__PURE__ */ f.jsxs("div", { className: y.actionRecorderPanel, children: [
329
- /* @__PURE__ */ f.jsx("div", { className: $r(y.actionRecorderPanelIcon, t ? y.actionRecorderPanelIconRecording : !1), children: /* @__PURE__ */ f.jsx(D, {}) }),
330
- /* @__PURE__ */ f.jsx("div", { className: y.actionRecorderPanelTitle, children: g }),
331
- /* @__PURE__ */ f.jsxs("div", { className: y.actionRecorderPanelActions, children: [
332
- /* @__PURE__ */ f.jsx(w, { type: "default", size: "small", onClick: t ? p : i, children: t ? "Cancel" : "Close" }),
333
- /* @__PURE__ */ f.jsx(w, { type: "primary", size: "small", onClick: t ? a : () => c(), children: t ? "Save" : "Start" }),
334
- !t && /* @__PURE__ */ f.jsx(w, { type: "primary", size: "small", onClick: () => c(!0), children: "Start(N)" })
325
+ const e = T(M), r = T(m), t = F(r.recording$), n = F(r.recordedCommands$), o = (s = n == null ? void 0 : n.length) != null ? s : 0, i = P(() => {
326
+ t || e.executeCommand(ae.id);
327
+ }, [e, t]), c = P((p) => {
328
+ t || e.executeCommand(oe.id, { replaceId: p });
329
+ }, [e, t]), a = P(() => {
330
+ t && e.executeCommand(ie.id);
331
+ }, [e, t]), d = P(() => {
332
+ t && e.executeCommand(ce.id);
333
+ }, [e, t]), f = t ? o === 0 ? "Recording..." : `${o}: ${n[o - 1].id}` : "Start Recording";
334
+ return /* @__PURE__ */ v.jsxs("div", { className: R.actionRecorderPanel, children: [
335
+ /* @__PURE__ */ v.jsx("div", { className: Ur(R.actionRecorderPanelIcon, t ? R.actionRecorderPanelIconRecording : !1), children: /* @__PURE__ */ v.jsx(L, {}) }),
336
+ /* @__PURE__ */ v.jsx("div", { className: R.actionRecorderPanelTitle, children: f }),
337
+ /* @__PURE__ */ v.jsxs("div", { className: R.actionRecorderPanelActions, children: [
338
+ /* @__PURE__ */ v.jsx(w, { type: "default", size: "small", onClick: t ? d : i, children: t ? "Cancel" : "Close" }),
339
+ /* @__PURE__ */ v.jsx(w, { type: "primary", size: "small", onClick: t ? a : () => c(), children: t ? "Save" : "Start" }),
340
+ !t && /* @__PURE__ */ v.jsx(w, { type: "primary", size: "small", onClick: () => c(!0), children: "Start(N)" })
335
341
  ] })
336
342
  ] });
337
343
  }
338
- const ae = "RECORD_MENU_ITEM";
339
- function Wr() {
344
+ const de = "RECORD_MENU_ITEM";
345
+ function Br() {
340
346
  return {
341
- id: ae,
342
- type: R.SUBITEMS,
347
+ id: de,
348
+ type: I.SUBITEMS,
343
349
  icon: "RecordSingle",
344
350
  tooltip: "action-recorder.menu.title"
345
351
  };
346
352
  }
347
- function zr(e) {
348
- const r = e.get(l);
353
+ function Vr(e) {
354
+ const r = e.get(m);
349
355
  return {
350
356
  id: z.id,
351
357
  title: "action-recorder.menu.record",
352
- type: R.BUTTON,
358
+ type: I.BUTTON,
353
359
  disabled$: r.panelOpened$
354
360
  };
355
361
  }
356
- function Hr() {
362
+ function Jr() {
357
363
  return {
358
- id: B.id,
364
+ id: V.id,
359
365
  title: "action-recorder.menu.replay-local",
360
- type: R.BUTTON
366
+ type: I.BUTTON
361
367
  };
362
368
  }
363
- function Jr() {
369
+ function Wr() {
364
370
  return {
365
- id: V.id,
371
+ id: J.id,
366
372
  title: "action-recorder.menu.replay-local-name",
367
- type: R.BUTTON
373
+ type: I.BUTTON
368
374
  };
369
375
  }
370
- function kr() {
376
+ function zr() {
371
377
  return {
372
378
  id: W.id,
373
379
  title: "action-recorder.menu.replay-local-active",
374
- type: R.BUTTON
380
+ type: I.BUTTON
375
381
  };
376
382
  }
377
- const Gr = {
378
- [sr.OTHERS]: {
379
- [ae]: {
383
+ const Hr = {
384
+ [lr.OTHERS]: {
385
+ [de]: {
380
386
  order: 10,
381
- menuItemFactory: Wr,
387
+ menuItemFactory: Br,
382
388
  [z.id]: {
383
389
  order: 1,
384
- menuItemFactory: zr
390
+ menuItemFactory: Vr
385
391
  },
386
- [B.id]: {
392
+ [V.id]: {
387
393
  order: 2,
388
- menuItemFactory: Hr
394
+ menuItemFactory: Jr
389
395
  },
390
- [V.id]: {
396
+ [J.id]: {
391
397
  order: 3,
392
- menuItemFactory: Jr
398
+ menuItemFactory: Wr
393
399
  },
394
400
  [W.id]: {
395
401
  order: 4,
396
- menuItemFactory: kr
402
+ menuItemFactory: zr
397
403
  }
398
404
  }
399
405
  }
400
406
  };
401
- var Zr = Object.defineProperty, qr = Object.getOwnPropertyDescriptor, Kr = (e, r, t, n) => {
402
- for (var o = n > 1 ? void 0 : n ? qr(r, t) : r, i = e.length - 1, c; i >= 0; i--)
407
+ var qr = Object.defineProperty, kr = Object.getOwnPropertyDescriptor, Gr = (e, r, t, n) => {
408
+ for (var o = n > 1 ? void 0 : n ? kr(r, t) : r, i = e.length - 1, c; i >= 0; i--)
403
409
  (c = e[i]) && (o = (n ? c(r, t, o) : c(o)) || o);
404
- return n && o && Zr(r, t, o), o;
405
- }, v = (e, r) => (t, n) => r(t, n, e);
406
- let b = class extends F {
410
+ return n && o && qr(r, t, o), o;
411
+ }, _ = (e, r) => (t, n) => r(t, n, e);
412
+ let N = class extends D {
407
413
  constructor(e, r, t, n, o, i) {
408
414
  super(), this._commandSrv = e, this._uiPartsSrv = r, this._menuManagerService = t, this._componentManager = n, this._actionRecorderService = o, this._injector = i, this._initCommands(), this._initUI(), this._initSheetsCommands(), this._initDocsCommands();
409
415
  }
410
416
  _initCommands() {
411
417
  [
412
- ee,
413
- te,
414
- re,
418
+ oe,
419
+ ce,
420
+ ie,
415
421
  z,
416
- ne,
417
- B,
422
+ ae,
418
423
  V,
424
+ J,
419
425
  W
420
426
  ].forEach((e) => this._commandSrv.registerCommand(e));
421
427
  }
422
428
  _initUI() {
423
- this._uiPartsSrv.registerComponent(ur.GLOBAL, () => me(Br, this._injector)), this._componentManager.register("RecordSingle", D), this._menuManagerService.mergeMenu(Gr);
429
+ this._uiPartsSrv.registerComponent(pr.GLOBAL, () => fe(Dr, this._injector)), this._componentManager.register("RecordSingle", L), this._menuManagerService.mergeMenu(Hr);
424
430
  }
425
431
  _initSheetsCommands() {
426
432
  [
427
433
  // InsertColCommand,
428
434
  // InsertRowCommand,
429
435
  // #region basic commands
430
- pe,
431
- ge,
432
436
  he,
433
437
  ve,
434
438
  Se,
@@ -441,98 +445,100 @@ let b = class extends F {
441
445
  Pe,
442
446
  xe,
443
447
  be,
444
- Me,
445
448
  Ne,
449
+ Me,
450
+ Ae,
451
+ Ue,
446
452
  // ResetBackgroundColorCommand,
447
453
  // ResetTextColorCommand,
448
454
  // SetBackgroundColorCommand,
449
455
  // SetBoldCommand,
450
456
  // SetFontFamilyCommand,
451
457
  // SetFontSizeCommand,
452
- Ue,
453
- Ae,
454
458
  we,
455
- // SetItalicCommand,
456
459
  $e,
457
- Je,
460
+ je,
461
+ // SetItalicCommand,
462
+ Te,
458
463
  ke,
459
464
  Ge,
460
465
  Ze,
461
- qe,
462
466
  Ke,
463
467
  Ye,
464
468
  Qe,
465
469
  Xe,
466
- je,
467
- Te,
470
+ er,
471
+ rr,
468
472
  Ee,
469
473
  Fe,
470
474
  De,
471
- // SetUnderlineCommand,
472
475
  Le,
473
- er,
474
- rr,
476
+ Be,
477
+ // SetUnderlineCommand,
478
+ Ve,
475
479
  tr,
476
480
  nr,
477
481
  or,
478
482
  ir,
479
483
  cr,
480
484
  ar,
481
- Be,
482
- Ve,
483
- T,
485
+ sr,
486
+ dr,
487
+ Je,
488
+ We,
489
+ E,
484
490
  // #endregion
485
491
  // #region data validation command
486
492
  // #endregion
487
493
  // #region conditional formatting command
488
494
  // #endregion
489
495
  // #region filter command
490
- We,
491
496
  ze,
492
- He
497
+ He,
498
+ qe
493
499
  // #endregion
494
500
  ].forEach((e) => this._actionRecorderService.registerRecordedCommand(e));
495
501
  }
496
502
  _initDocsCommands() {
497
503
  }
498
504
  };
499
- b = Kr([
500
- v(0, M),
501
- v(1, lr),
502
- v(2, mr),
503
- v(3, x(dr)),
504
- v(4, x(l)),
505
- v(5, x(Z))
506
- ], b);
507
- const Yr = "action-recorder.config", Qr = {};
508
- var Xr = Object.defineProperty, et = Object.getOwnPropertyDescriptor, rt = (e, r, t, n) => {
509
- for (var o = n > 1 ? void 0 : n ? et(r, t) : r, i = e.length - 1, c; i >= 0; i--)
505
+ N = Gr([
506
+ _(0, M),
507
+ _(1, ur),
508
+ _(2, fr),
509
+ _(3, b(mr)),
510
+ _(4, b(m)),
511
+ _(5, b(Q))
512
+ ], N);
513
+ const Zr = "action-recorder.config", Kr = {};
514
+ var Yr = Object.defineProperty, Qr = Object.getOwnPropertyDescriptor, Xr = (e, r, t, n) => {
515
+ for (var o = n > 1 ? void 0 : n ? Qr(r, t) : r, i = e.length - 1, c; i >= 0; i--)
510
516
  (c = e[i]) && (o = (n ? c(r, t, o) : c(o)) || o);
511
- return n && o && Xr(r, t, o), o;
512
- }, H = (e, r) => (t, n) => r(t, n, e), $;
513
- let J = ($ = class extends ue {
514
- constructor(e = Qr, r, t) {
517
+ return n && o && Yr(r, t, o), o;
518
+ }, G = (e, r) => (t, n) => r(t, n, e), j;
519
+ let Z = (j = class extends pe {
520
+ constructor(e = Kr, r, t) {
515
521
  super(), this._config = e, this._injector = r, this._configService = t;
516
522
  const { menu: n, ...o } = this._config;
517
- n && this._configService.setConfig("menu", n, { merge: !0 }), this._configService.setConfig(Yr, o);
523
+ n && this._configService.setConfig("menu", n, { merge: !0 }), this._configService.setConfig(Zr, o);
518
524
  }
519
525
  onStarting() {
520
- (this._config.replayOnly ? [[h]] : [
521
- [l],
522
- [h],
523
- [b]
526
+ (this._config.replayOnly ? [[S]] : [
527
+ [m],
528
+ [S],
529
+ [N]
524
530
  ]).forEach((r) => this._injector.add(r));
525
531
  }
526
532
  onSteady() {
527
- this._config.replayOnly || this._injector.get(b);
533
+ this._config.replayOnly || this._injector.get(N);
528
534
  }
529
- }, m($, "pluginName", "UNIVER_ACTION_RECORDER_PLUGIN"), $);
530
- J = rt([
531
- H(1, x(Z)),
532
- H(2, fe)
533
- ], J);
535
+ }, u(j, "pluginName", "UNIVER_ACTION_RECORDER_PLUGIN"), j);
536
+ Z = Xr([
537
+ G(1, b(Q)),
538
+ G(2, ge)
539
+ ], Z);
534
540
  export {
535
- l as ActionRecorderService,
536
- h as ActionReplayService,
537
- J as UniverActionRecorderPlugin
541
+ m as ActionRecorderService,
542
+ S as ActionReplayService,
543
+ Z as UniverActionRecorderPlugin
538
544
  };
@@ -0,0 +1,12 @@
1
+ const e = {
2
+ "action-recorder": {
3
+ menu: {
4
+ title: "Enregistrer les actions",
5
+ record: "Enregistrer les actions...",
6
+ "replay-local": "Lecture de l'enregistrement local..."
7
+ }
8
+ }
9
+ };
10
+ export {
11
+ e as default
12
+ };
@@ -1,5 +1,5 @@
1
1
  import { MenuConfig } from '@univerjs/ui';
2
- export declare const PLUGIN_CONFIG_KEY = "action-recorder.config";
2
+ export declare const ACTION_RECORDER_PLUGIN_CONFIG_KEY = "action-recorder.config";
3
3
  export declare const configSymbol: unique symbol;
4
4
  export interface IUniverActionRecorderConfig {
5
5
  menu?: MenuConfig;
@@ -13,6 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import './global.css';
16
17
  export { UniverActionRecorderPlugin } from './plugin';
17
18
  export { ActionRecorderService } from './services/action-recorder.service';
18
19
  export { ActionReplayService } from './services/replay.service';
@@ -0,0 +1,3 @@
1
+ import { default as enUS } from './en-US';
2
+ declare const locale: typeof enUS;
3
+ export default locale;
package/lib/umd/index.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(a,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/sheets-filter"),require("@univerjs/sheets-ui"),require("@univerjs/ui"),require("rxjs"),require("@univerjs/design"),require("react")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","@univerjs/sheets-filter","@univerjs/sheets-ui","@univerjs/ui","rxjs","@univerjs/design","react"],i):(a=typeof globalThis<"u"?globalThis:a||self,i(a.UniverActionRecorder={},a.UniverCore,a.UniverSheets,a.UniverSheetsFilter,a.UniverSheetsUi,a.UniverUi,a.rxjs,a.UniverDesign,a.React))})(this,function(a,i,s,T,m,l,A,_,g){"use strict";var Ne=Object.defineProperty;var we=(a,i,s)=>i in a?Ne(a,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[i]=s;var p=(a,i,s)=>we(a,typeof i!="symbol"?i+"":i,s);var F;var S=function(){return S=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},S.apply(this,arguments)},Y=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n},B=g.forwardRef(function(e,t){var n=e.icon,r=e.id,o=e.className,c=e.extend,d=Y(e,["icon","id","className","extend"]),f="univerjs-icon univerjs-icon-".concat(r," ").concat(o||"").trim(),u=g.useRef("_".concat(X()));return $(n,"".concat(r),{defIds:n.defIds,idSuffix:u.current},S({ref:t,className:f},d),c)});function $(e,t,n,r,o){return g.createElement(e.tag,S(S({key:t},q(e,n,o)),r),(Q(e,n).children||[]).map(function(c,d){return $(c,"".concat(t,"-").concat(e.tag,"-").concat(d),n,void 0,o)}))}function q(e,t,n){var r=S({},e.attrs);n!=null&&n.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=n.colorChannel1);var o=t.defIds;return!o||o.length===0||(e.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+t.idSuffix),Object.entries(r).forEach(function(c){var d=c[0],f=c[1];typeof f=="string"&&(r[d]=f.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),r}function Q(e,t){var n,r=t.defIds;return!r||r.length===0?e:e.tag==="defs"&&(!((n=e.children)===null||n===void 0)&&n.length)?S(S({},e),{children:e.children.map(function(o){return typeof o.attrs.id=="string"&&r&&r.indexOf(o.attrs.id)>-1?S(S({},o),{attrs:S(S({},o.attrs),{id:o.attrs.id+t.idSuffix})}):o})}):e}function X(){return Math.random().toString(36).substring(2,8)}B.displayName="UniverIcon";var ee={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"g",attrs:{fill:"currentColor",clipPath:"url(#record-single_clip0_1559_19)"},children:[{tag:"path",attrs:{d:"M7.60303 10C8.7076 10 9.60303 9.10457 9.60303 8C9.60303 6.89543 8.7076 6 7.60303 6C6.49846 6 5.60303 6.89543 5.60303 8C5.60303 9.10457 6.49846 10 7.60303 10Z"}},{tag:"path",attrs:{d:"M1.66943 5.29023C1.66941 3.85426 2.83349 2.69017 4.26946 2.69019L10.9362 2.69026C12.3192 2.69028 13.45 3.77008 13.5315 5.13259L14.5692 4.55638C15.3024 4.14929 16.2032 4.67947 16.2032 5.51809V10.4819C16.2032 11.3205 15.3024 11.8507 14.5692 11.4436L13.5315 10.8674C13.45 12.2299 12.3192 13.3097 10.9362 13.3097H4.26953C2.83361 13.3097 1.66956 12.1457 1.66953 10.7098L1.66943 5.29023ZM13.5362 9.49743L15.0032 10.312V5.68799L13.5362 6.50254V9.49743ZM4.26945 3.89019C3.49623 3.89018 2.86942 4.517 2.86943 5.29021L2.86953 10.7098C2.86955 11.483 3.49634 12.1097 4.26953 12.1097H10.9362C11.7094 12.1097 12.3362 11.4829 12.3362 10.7097V5.29026C12.3362 4.51707 11.7094 3.89027 10.9362 3.89026L4.26945 3.89019Z",fillRule:"evenodd",clipRule:"evenodd"}}]},{tag:"defs",attrs:{},children:[{tag:"clipPath",attrs:{id:"record-single_clip0_1559_19"},children:[{tag:"path",attrs:{fill:"#fff",d:"M0 0H16V16H0z",transform:"translate(.94)"}}]}]}],defIds:["record-single_clip0_1559_19"]},N=g.forwardRef(function(e,t){return g.createElement(B,Object.assign({},e,{id:"record-single",ref:t,icon:ee}))});N.displayName="RecordSingle";var ne=Object.defineProperty,re=Object.getOwnPropertyDescriptor,te=(e,t,n,r)=>{for(var o=r>1?void 0:r?re(t,n):t,c=e.length-1,d;c>=0;c--)(d=e[c])&&(o=(r?d(t,n,o):d(o))||o);return r&&o&&ne(t,n,o),o},j=(e,t)=>(n,r)=>t(n,r,e);a.ActionRecorderService=class extends i.Disposable{constructor(n,r,o,c){super();p(this,"_shouldRecordCommands",new Set);p(this,"_panelOpened$",new A.BehaviorSubject(!1));p(this,"panelOpened$",this._panelOpened$.asObservable());p(this,"_recorder",null);p(this,"_recording$",new A.BehaviorSubject(!1));p(this,"recording$",this._recording$.asObservable());p(this,"_recorded$",new A.BehaviorSubject([]));p(this,"_recordedCommands$",new A.BehaviorSubject([]));p(this,"recordedCommands$",this._recordedCommands$.asObservable());this._commandSrv=n,this._logService=r,this._localFileService=o,this._instanceService=c}get recording(){return this._recording$.getValue()}get _recorded(){return this._recorded$.getValue()}get _recordedCommands(){return this._recordedCommands$.getValue()}registerRecordedCommand(n){if(n.type===i.CommandType.MUTATION)throw new Error("[CommandRecorderService] Cannot record mutation commands.");this._shouldRecordCommands.add(n.id)}togglePanel(n){this._panelOpened$.next(n),n===!1&&this.stopRecording()}startRecording(n=!1){this._recorder=this._commandSrv.onCommandExecuted(r=>{var o,c;if(this._shouldRecordCommands.has(r.id)){const d=this._recorded,f=this._recordedCommands;let u={...r};const R=(o=this._instanceService.getFocusedUnit())==null?void 0:o.getUnitId(),{unitId:y=R,subUnitId:v}=u==null?void 0:u.params;if(n&&y&&v){const L=(c=this._instanceService.getUnit(y).getSheetBySheetId(v))==null?void 0:c.getName();u={...u,params:{...u.params,subUnitId:L}}}u.id===s.SetSelectionsOperation.id&&d.length>0&&d[d.length-1].id===s.SetSelectionsOperation.id?d[d.length-1]=u:(d.push(u),this._recorded$.next(d),u.type===i.CommandType.COMMAND&&(f.push(u),this._recordedCommands$.next(f)))}}),this._recording$.next(!0)}stopRecording(){var n;(n=this._recorder)==null||n.dispose(),this._recorder=null,this._recorded$.next([]),this._recordedCommands$.next([]),this._recording$.next(!1)}completeRecording(){const n=this._recorded.slice();this._localFileService.downloadFile(new Blob([JSON.stringify(n,null,2)]),"recorded-commands.json"),this._logService.error("Recorded commands:",n),this.stopRecording()}},a.ActionRecorderService=te([j(0,i.ICommandService),j(1,i.ILogService),j(2,l.ILocalFileService),j(3,i.IUniverInstanceService)],a.ActionRecorderService);const V={id:"action-recorder.command.start-recording",type:i.CommandType.COMMAND,handler:(e,t)=>(e.get(a.ActionRecorderService).startRecording(!!(t!=null&&t.replaceId)),!0)},W={id:"action-recorder.command.complete-recording",type:i.CommandType.COMMAND,handler:e=>(e.get(a.ActionRecorderService).completeRecording(),!0)},z={id:"action-recorder.command.stop-recording",type:i.CommandType.COMMAND,handler:e=>(e.get(a.ActionRecorderService).completeRecording(),!0)};var oe=Object.defineProperty,ie=Object.getOwnPropertyDescriptor,ce=(e,t,n,r)=>{for(var o=r>1?void 0:r?ie(t,n):t,c=e.length-1,d;c>=0;c--)(d=e[c])&&(o=(r?d(t,n,o):d(o))||o);return r&&o&&oe(t,n,o),o},I=(e,t)=>(n,r)=>t(n,r,e),w=(e=>(e.DEFAULT="default",e.NAME="name",e.ACTIVE="active",e))(w||{});a.ActionReplayService=class extends i.Disposable{constructor(t,n,r,o,c){super(),this._messageService=t,this._instanceService=n,this._localFileService=r,this._logService=o,this._commandService=c}async replayLocalJSON(t="default"){const n=await this._localFileService.openFile({multiple:!1,accept:".json"});if(n.length!==1)return!1;const r=n[0];try{return this.replayCommands(JSON.parse(await r.text()),{mode:t})}catch{return this._messageService.show({type:_.MessageType.Error,content:`Failed to replay commands from local file ${r.name}.`}),!1}}async replayCommands(t,n){var c,d,f;const r=(c=this._instanceService.getFocusedUnit())==null?void 0:c.getUnitId();r||this._logService.error("[ReplayService]","no focused unit to replay commands");const{mode:o}=n||{};for(const u of t){const{id:R,params:y}=u,v=y;if(v){if(typeof v.unitId<"u"&&(v.unitId=r),o==="name"&&v.subUnitId!=="undefined"){const P=(d=this._instanceService.getFocusedUnit().getSheetBySheetName(v.subUnitId))==null?void 0:d.getSheetId();P?v.subUnitId=P:this._logService.error("[ReplayService]",`failed to find subunit by subUnitName = ${v.subUnitId}`)}if(o==="active"&&v.subUnitId!=="undefined"){const P=(f=this._instanceService.getFocusedUnit().getActiveSheet())==null?void 0:f.getSheetId();P?v.subUnitId=P:this._logService.error("[ReplayService]","failed to find active subunit")}if(!await this._commandService.executeCommand(R,y))return!1}else if(!await this._commandService.executeCommand(R))return!1}return!0}async replayCommandsWithDelay(t){var r;const n=(r=this._instanceService.getFocusedUnit())==null?void 0:r.getUnitId();n||this._logService.error("[ReplayService]","no focused unit to replay commands");for(const o of t){await i.awaitTime(ae());const{id:c,params:d}=o;if(d){if(typeof d.unitId<"u"&&(d.unitId=n),!await this._commandService.executeCommand(c,d))return!1}else if(!await this._commandService.executeCommand(c))return!1}return!0}},a.ActionReplayService=ce([I(0,l.IMessageService),I(1,i.IUniverInstanceService),I(2,l.ILocalFileService),I(3,i.ILogService),I(4,i.ICommandService)],a.ActionReplayService);function ae(){return Math.floor(Math.random()*800)+200}const U={id:"action-recorder.command.replay-local-records",type:i.CommandType.COMMAND,handler:async e=>{const n=await e.get(a.ActionReplayService).replayLocalJSON();return n&&e.get(l.IMessageService).show({type:_.MessageType.Success,content:"Successfully replayed local records"}),n}},x={id:"action-recorder.command.replay-local-records-name",type:i.CommandType.COMMAND,handler:async e=>{const n=await e.get(a.ActionReplayService).replayLocalJSON(w.NAME);return n&&e.get(l.IMessageService).show({type:_.MessageType.Success,content:"Successfully replayed local records"}),n}},D={id:"action-recorder.command.replay-local-records-active",type:i.CommandType.COMMAND,handler:async e=>{const n=await e.get(a.ActionReplayService).replayLocalJSON(w.ACTIVE);return n&&e.get(l.IMessageService).show({type:_.MessageType.Success,content:"Successfully replayed local records"}),n}},E={id:"action-recorder.operation.open-panel",type:i.CommandType.OPERATION,handler(e){return e.get(a.ActionRecorderService).togglePanel(!0),!0}},k={id:"action-recorder.operation.close-panel",type:i.CommandType.OPERATION,handler(e){return e.get(a.ActionRecorderService).togglePanel(!1),!0}};var H={exports:{}},b={};/**
1
+ (function(c,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/sheets-filter"),require("@univerjs/sheets-ui"),require("@univerjs/ui"),require("rxjs"),require("@univerjs/design"),require("react")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","@univerjs/sheets-filter","@univerjs/sheets-ui","@univerjs/ui","rxjs","@univerjs/design","react"],i):(c=typeof globalThis<"u"?globalThis:c||self,i(c.UniverActionRecorder={},c.UniverCore,c.UniverSheets,c.UniverSheetsFilter,c.UniverSheetsUi,c.UniverUi,c.rxjs,c.UniverDesign,c.React))})(this,function(c,i,s,N,S,m,b,h,_){"use strict";var be=Object.defineProperty;var Me=(c,i,s)=>i in c?be(c,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):c[i]=s;var g=(c,i,s)=>Me(c,typeof i!="symbol"?i+"":i,s);var B;var p=function(){return p=Object.assign||function(n){for(var t,e=1,r=arguments.length;e<r;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o])}return n},p.apply(this,arguments)},Y=function(n,t){var e={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&t.indexOf(r)<0&&(e[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(n);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(n,r[o])&&(e[r[o]]=n[r[o]]);return e},$=_.forwardRef(function(n,t){var e=n.icon,r=n.id,o=n.className,a=n.extend,d=Y(n,["icon","id","className","extend"]),u="univerjs-icon univerjs-icon-".concat(r," ").concat(o||"").trim(),l=_.useRef("_".concat(ee()));return V(e,"".concat(r),{defIds:e.defIds,idSuffix:l.current},p({ref:t,className:u},d),a)});function V(n,t,e,r,o){return _.createElement(n.tag,p(p({key:t},Q(n,e,o)),r),(X(n,e).children||[]).map(function(a,d){return V(a,"".concat(t,"-").concat(n.tag,"-").concat(d),e,void 0,o)}))}function Q(n,t,e){var r=p({},n.attrs);e!=null&&e.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=e.colorChannel1);var o=t.defIds;return!o||o.length===0||(n.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+t.idSuffix),Object.entries(r).forEach(function(a){var d=a[0],u=a[1];typeof u=="string"&&(r[d]=u.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),r}function X(n,t){var e,r=t.defIds;return!r||r.length===0?n:n.tag==="defs"&&(!((e=n.children)===null||e===void 0)&&e.length)?p(p({},n),{children:n.children.map(function(o){return typeof o.attrs.id=="string"&&r&&r.indexOf(o.attrs.id)>-1?p(p({},o),{attrs:p(p({},o.attrs),{id:o.attrs.id+t.idSuffix})}):o})}):n}function ee(){return Math.random().toString(36).substring(2,8)}$.displayName="UniverIcon";var ne={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"g",attrs:{fill:"currentColor",clipPath:"url(#record-single_clip0_1559_19)"},children:[{tag:"path",attrs:{d:"M7.60303 10C8.7076 10 9.60303 9.10457 9.60303 8C9.60303 6.89543 8.7076 6 7.60303 6C6.49846 6 5.60303 6.89543 5.60303 8C5.60303 9.10457 6.49846 10 7.60303 10Z"}},{tag:"path",attrs:{d:"M1.66943 5.29023C1.66941 3.85426 2.83349 2.69017 4.26946 2.69019L10.9362 2.69026C12.3192 2.69028 13.45 3.77008 13.5315 5.13259L14.5692 4.55638C15.3024 4.14929 16.2032 4.67947 16.2032 5.51809V10.4819C16.2032 11.3205 15.3024 11.8507 14.5692 11.4436L13.5315 10.8674C13.45 12.2299 12.3192 13.3097 10.9362 13.3097H4.26953C2.83361 13.3097 1.66956 12.1457 1.66953 10.7098L1.66943 5.29023ZM13.5362 9.49743L15.0032 10.312V5.68799L13.5362 6.50254V9.49743ZM4.26945 3.89019C3.49623 3.89018 2.86942 4.517 2.86943 5.29021L2.86953 10.7098C2.86955 11.483 3.49634 12.1097 4.26953 12.1097H10.9362C11.7094 12.1097 12.3362 11.4829 12.3362 10.7097V5.29026C12.3362 4.51707 11.7094 3.89027 10.9362 3.89026L4.26945 3.89019Z",fillRule:"evenodd",clipRule:"evenodd"}}]},{tag:"defs",attrs:{},children:[{tag:"clipPath",attrs:{id:"record-single_clip0_1559_19"},children:[{tag:"path",attrs:{fill:"#fff",d:"M0 0H16V16H0z",transform:"translate(.94)"}}]}]}],defIds:["record-single_clip0_1559_19"]},w=_.forwardRef(function(n,t){return _.createElement($,Object.assign({},n,{id:"record-single",ref:t,icon:ne}))});w.displayName="RecordSingle";var re=Object.defineProperty,te=Object.getOwnPropertyDescriptor,oe=(n,t,e,r)=>{for(var o=r>1?void 0:r?te(t,e):t,a=n.length-1,d;a>=0;a--)(d=n[a])&&(o=(r?d(t,e,o):d(o))||o);return r&&o&&re(t,e,o),o},M=(n,t)=>(e,r)=>t(e,r,n);c.ActionRecorderService=class extends i.Disposable{constructor(e,r,o,a){super();g(this,"_shouldRecordCommands",new Set);g(this,"_panelOpened$",new b.BehaviorSubject(!1));g(this,"panelOpened$",this._panelOpened$.asObservable());g(this,"_recorder",null);g(this,"_recording$",new b.BehaviorSubject(!1));g(this,"recording$",this._recording$.asObservable());g(this,"_recorded$",new b.BehaviorSubject([]));g(this,"_recordedCommands$",new b.BehaviorSubject([]));g(this,"recordedCommands$",this._recordedCommands$.asObservable());this._commandSrv=e,this._logService=r,this._localFileService=o,this._instanceService=a}get recording(){return this._recording$.getValue()}get _recorded(){return this._recorded$.getValue()}get _recordedCommands(){return this._recordedCommands$.getValue()}registerRecordedCommand(e){if(e.type===i.CommandType.MUTATION)throw new Error("[CommandRecorderService] Cannot record mutation commands.");this._shouldRecordCommands.add(e.id)}togglePanel(e){this._panelOpened$.next(e),e===!1&&this.stopRecording()}startRecording(e=!1){this._recorder=this._commandSrv.onCommandExecuted(r=>{var o,a;if(this._shouldRecordCommands.has(r.id)){const d=this._recorded,u=this._recordedCommands;let l={...r};const R=(o=this._instanceService.getFocusedUnit())==null?void 0:o.getUnitId(),{unitId:v=R,subUnitId:f}=l==null?void 0:l.params;if(e&&v&&f){const I=(a=this._instanceService.getUnit(v).getSheetBySheetId(f))==null?void 0:a.getName();l={...l,params:{...l.params,subUnitId:I}}}l.id===s.SetSelectionsOperation.id&&d.length>0&&d[d.length-1].id===s.SetSelectionsOperation.id?d[d.length-1]=l:(d.push(l),this._recorded$.next(d),l.type===i.CommandType.COMMAND&&(u.push(l),this._recordedCommands$.next(u)))}}),this._recording$.next(!0)}stopRecording(){var e;(e=this._recorder)==null||e.dispose(),this._recorder=null,this._recorded$.next([]),this._recordedCommands$.next([]),this._recording$.next(!1)}completeRecording(){const e=this._recorded.slice();this._localFileService.downloadFile(new Blob([JSON.stringify(e,null,2)]),"recorded-commands.json"),this._logService.error("Recorded commands:",e),this.stopRecording()}},c.ActionRecorderService=oe([M(0,i.ICommandService),M(1,i.ILogService),M(2,m.ILocalFileService),M(3,i.IUniverInstanceService)],c.ActionRecorderService);const J={id:"action-recorder.command.start-recording",type:i.CommandType.COMMAND,handler:(n,t)=>(n.get(c.ActionRecorderService).startRecording(!!(t!=null&&t.replaceId)),!0)},W={id:"action-recorder.command.complete-recording",type:i.CommandType.COMMAND,handler:n=>(n.get(c.ActionRecorderService).completeRecording(),!0)},z={id:"action-recorder.command.stop-recording",type:i.CommandType.COMMAND,handler:n=>(n.get(c.ActionRecorderService).completeRecording(),!0)};var ie=Object.defineProperty,ce=Object.getOwnPropertyDescriptor,ae=(n,t,e,r)=>{for(var o=r>1?void 0:r?ce(t,e):t,a=n.length-1,d;a>=0;a--)(d=n[a])&&(o=(r?d(t,e,o):d(o))||o);return r&&o&&ie(t,e,o),o},P=(n,t)=>(e,r)=>t(e,r,n),U=(n=>(n.DEFAULT="default",n.NAME="name",n.ACTIVE="active",n))(U||{});c.ActionReplayService=class extends i.Disposable{constructor(t,e,r,o,a){super(),this._messageService=t,this._instanceService=e,this._localFileService=r,this._logService=o,this._commandService=a}async replayLocalJSON(t="default"){const e=await this._localFileService.openFile({multiple:!1,accept:".json"});if(e.length!==1)return!1;const r=e[0];try{return this.replayCommands(JSON.parse(await r.text()),{mode:t})}catch{return this._messageService.show({type:h.MessageType.Error,content:`Failed to replay commands from local file ${r.name}.`}),!1}}async replayCommands(t,e){var a,d,u;const r=(a=this._instanceService.getFocusedUnit())==null?void 0:a.getUnitId();r||this._logService.error("[ReplayService]","no focused unit to replay commands");const{mode:o}=e||{};for(const l of t){const{id:R,params:v}=l,f=v;if(f){if(typeof f.unitId<"u"&&(f.unitId=r),o==="name"&&f.subUnitId!=="undefined"){const y=(d=this._instanceService.getFocusedUnit().getSheetBySheetName(f.subUnitId))==null?void 0:d.getSheetId();y?f.subUnitId=y:this._logService.error("[ReplayService]",`failed to find subunit by subUnitName = ${f.subUnitId}`)}if(o==="active"&&f.subUnitId!=="undefined"){const y=(u=this._instanceService.getFocusedUnit().getActiveSheet())==null?void 0:u.getSheetId();y?f.subUnitId=y:this._logService.error("[ReplayService]","failed to find active subunit")}if(!await this._commandService.executeCommand(R,v))return!1}else if(!await this._commandService.executeCommand(R))return!1}return!0}async replayCommandsWithDelay(t){var r;const e=(r=this._instanceService.getFocusedUnit())==null?void 0:r.getUnitId();e||this._logService.error("[ReplayService]","no focused unit to replay commands");for(const o of t){await i.awaitTime(de());const{id:a,params:d}=o;if(d){if(typeof d.unitId<"u"&&(d.unitId=e),!await this._commandService.executeCommand(a,d))return!1}else if(!await this._commandService.executeCommand(a))return!1}return!0}},c.ActionReplayService=ae([P(0,m.IMessageService),P(1,i.IUniverInstanceService),P(2,m.ILocalFileService),P(3,i.ILogService),P(4,i.ICommandService)],c.ActionReplayService);function de(){return Math.floor(Math.random()*800)+200}const x={id:"action-recorder.command.replay-local-records",type:i.CommandType.COMMAND,handler:async n=>{const e=await n.get(c.ActionReplayService).replayLocalJSON();return e&&n.get(m.IMessageService).show({type:h.MessageType.Success,content:"Successfully replayed local records"}),e}},E={id:"action-recorder.command.replay-local-records-name",type:i.CommandType.COMMAND,handler:async n=>{const e=await n.get(c.ActionReplayService).replayLocalJSON(U.NAME);return e&&n.get(m.IMessageService).show({type:h.MessageType.Success,content:"Successfully replayed local records"}),e}},D={id:"action-recorder.command.replay-local-records-active",type:i.CommandType.COMMAND,handler:async n=>{const e=await n.get(c.ActionReplayService).replayLocalJSON(U.ACTIVE);return e&&n.get(m.IMessageService).show({type:h.MessageType.Success,content:"Successfully replayed local records"}),e}},F={id:"action-recorder.operation.open-panel",type:i.CommandType.OPERATION,handler(n){return n.get(c.ActionRecorderService).togglePanel(!0),!0}},k={id:"action-recorder.operation.close-panel",type:i.CommandType.OPERATION,handler(n){return n.get(c.ActionRecorderService).togglePanel(!1),!0}};var L={exports:{}},A={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,4 +6,4 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var de=g,se=Symbol.for("react.element"),le=Symbol.for("react.fragment"),me=Object.prototype.hasOwnProperty,ue=de.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,fe={key:!0,ref:!0,__self:!0,__source:!0};function J(e,t,n){var r,o={},c=null,d=null;n!==void 0&&(c=""+n),t.key!==void 0&&(c=""+t.key),t.ref!==void 0&&(d=t.ref);for(r in t)me.call(t,r)&&!fe.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)o[r]===void 0&&(o[r]=t[r]);return{$$typeof:se,type:e,key:c,ref:d,props:o,_owner:ue.current}}b.Fragment=le,b.jsx=J,b.jsxs=J,H.exports=b;var C=H.exports;function G(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=G(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function ve(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=G(e))&&(r&&(r+=" "),r+=t);return r}const O={actionRecorderPanel:"univer-action-recorder-panel",actionRecorderPanelIcon:"univer-action-recorder-panel-icon",actionRecorderPanelIconRecording:"univer-action-recorder-panel-icon-recording",recording:"univer-recording",actionRecorderPanelTitle:"univer-action-recorder-panel-title",actionRecorderPanelActions:"univer-action-recorder-panel-actions"};function Se(){const e=i.useDependency(a.ActionRecorderService);return l.useObservable(e.panelOpened$)?C.jsx(pe,{}):null}function pe(){var y;const e=i.useDependency(i.ICommandService),t=i.useDependency(a.ActionRecorderService),n=l.useObservable(t.recording$),r=l.useObservable(t.recordedCommands$),o=(y=r==null?void 0:r.length)!=null?y:0,c=g.useCallback(()=>{n||e.executeCommand(k.id)},[e,n]),d=g.useCallback(v=>{n||e.executeCommand(V.id,{replaceId:v})},[e,n]),f=g.useCallback(()=>{n&&e.executeCommand(W.id)},[e,n]),u=g.useCallback(()=>{n&&e.executeCommand(z.id)},[e,n]),R=n?o===0?"Recording...":`${o}: ${r[o-1].id}`:"Start Recording";return C.jsxs("div",{className:O.actionRecorderPanel,children:[C.jsx("div",{className:ve(O.actionRecorderPanelIcon,n?O.actionRecorderPanelIconRecording:!1),children:C.jsx(N,{})}),C.jsx("div",{className:O.actionRecorderPanelTitle,children:R}),C.jsxs("div",{className:O.actionRecorderPanelActions,children:[C.jsx(_.Button,{type:"default",size:"small",onClick:n?u:c,children:n?"Cancel":"Close"}),C.jsx(_.Button,{type:"primary",size:"small",onClick:n?f:()=>d(),children:n?"Save":"Start"}),!n&&C.jsx(_.Button,{type:"primary",size:"small",onClick:()=>d(!0),children:"Start(N)"})]})]})}const Z="RECORD_MENU_ITEM";function ge(){return{id:Z,type:l.MenuItemType.SUBITEMS,icon:"RecordSingle",tooltip:"action-recorder.menu.title"}}function Ce(e){const t=e.get(a.ActionRecorderService);return{id:E.id,title:"action-recorder.menu.record",type:l.MenuItemType.BUTTON,disabled$:t.panelOpened$}}function ye(){return{id:U.id,title:"action-recorder.menu.replay-local",type:l.MenuItemType.BUTTON}}function _e(){return{id:x.id,title:"action-recorder.menu.replay-local-name",type:l.MenuItemType.BUTTON}}function he(){return{id:D.id,title:"action-recorder.menu.replay-local-active",type:l.MenuItemType.BUTTON}}const Re={[l.RibbonStartGroup.OTHERS]:{[Z]:{order:10,menuItemFactory:ge,[E.id]:{order:1,menuItemFactory:Ce},[U.id]:{order:2,menuItemFactory:ye},[x.id]:{order:3,menuItemFactory:_e},[D.id]:{order:4,menuItemFactory:he}}}};var Ie=Object.defineProperty,Oe=Object.getOwnPropertyDescriptor,Pe=(e,t,n,r)=>{for(var o=r>1?void 0:r?Oe(t,n):t,c=e.length-1,d;c>=0;c--)(d=e[c])&&(o=(r?d(t,n,o):d(o))||o);return r&&o&&Ie(t,n,o),o},h=(e,t)=>(n,r)=>t(n,r,e);let M=class extends i.Disposable{constructor(e,t,n,r,o,c){super(),this._commandSrv=e,this._uiPartsSrv=t,this._menuManagerService=n,this._componentManager=r,this._actionRecorderService=o,this._injector=c,this._initCommands(),this._initUI(),this._initSheetsCommands(),this._initDocsCommands()}_initCommands(){[V,z,W,E,k,U,x,D].forEach(e=>this._commandSrv.registerCommand(e))}_initUI(){this._uiPartsSrv.registerComponent(l.BuiltInUIPart.GLOBAL,()=>i.connectInjector(Se,this._injector)),this._componentManager.register("RecordSingle",N),this._menuManagerService.mergeMenu(Re)}_initSheetsCommands(){[s.CopySheetCommand,s.DeleteRangeMoveLeftCommand,s.DeleteRangeMoveUpCommand,s.DeltaColumnWidthCommand,s.DeltaRowHeightCommand,s.InsertSheetCommand,s.InsertColAfterCommand,s.InsertColBeforeCommand,s.InsertRowAfterCommand,s.InsertRowBeforeCommand,s.RemoveSheetCommand,s.SetStyleCommand,s.AddWorksheetMergeCommand,s.AddWorksheetMergeAllCommand,s.AddWorksheetMergeVerticalCommand,s.AddWorksheetMergeHorizontalCommand,s.SetFrozenCommand,s.CancelFrozenCommand,s.SetHorizontalTextAlignCommand,s.SetOverlineCommand,m.SetRangeBoldCommand,m.SetRangeFontFamilyCommand,m.SetRangeFontSizeCommand,m.SetRangeItalicCommand,m.SetRangeStrickThroughCommand,m.SetRangeSubscriptCommand,m.SetRangeSuperscriptCommand,m.SetRangeTextColorCommand,m.SetRangeUnderlineCommand,s.SetRangeValuesCommand,s.SetStrikeThroughCommand,s.SetTextColorCommand,s.SetTextRotationCommand,s.SetTextWrapCommand,s.SetVerticalTextAlignCommand,m.SheetCopyCommand,m.SheetCutCommand,m.SheetPasteBesidesBorderCommand,m.SheetPasteColWidthCommand,m.SheetPasteCommand,m.SheetPasteFormatCommand,m.SheetPasteShortKeyCommand,m.SheetPasteValueCommand,s.SetWorksheetActivateCommand,s.SetWorksheetActiveOperation,s.SetSelectionsOperation,T.SetSheetFilterRangeCommand,T.SetSheetsFilterCriteriaCommand,T.RemoveSheetFilterCommand].forEach(e=>this._actionRecorderService.registerRecordedCommand(e))}_initDocsCommands(){}};M=Pe([h(0,i.ICommandService),h(1,l.IUIPartsService),h(2,l.IMenuManagerService),h(3,i.Inject(l.ComponentManager)),h(4,i.Inject(a.ActionRecorderService)),h(5,i.Inject(i.Injector))],M);const Ae="action-recorder.config",je={};var be=Object.defineProperty,Me=Object.getOwnPropertyDescriptor,Te=(e,t,n,r)=>{for(var o=r>1?void 0:r?Me(t,n):t,c=e.length-1,d;c>=0;c--)(d=e[c])&&(o=(r?d(t,n,o):d(o))||o);return r&&o&&be(t,n,o),o},K=(e,t)=>(n,r)=>t(n,r,e);a.UniverActionRecorderPlugin=(F=class extends i.Plugin{constructor(t=je,n,r){super(),this._config=t,this._injector=n,this._configService=r;const{menu:o,...c}=this._config;o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(Ae,c)}onStarting(){(this._config.replayOnly?[[a.ActionReplayService]]:[[a.ActionRecorderService],[a.ActionReplayService],[M]]).forEach(n=>this._injector.add(n))}onSteady(){this._config.replayOnly||this._injector.get(M)}},p(F,"pluginName","UNIVER_ACTION_RECORDER_PLUGIN"),F),a.UniverActionRecorderPlugin=Te([K(1,i.Inject(i.Injector)),K(2,i.IConfigService)],a.UniverActionRecorderPlugin),Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})});
9
+ */var H;function se(){if(H)return A;H=1;var n=_,t=Symbol.for("react.element"),e=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,o=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function d(u,l,R){var v,f={},I=null,y=null;R!==void 0&&(I=""+R),l.key!==void 0&&(I=""+l.key),l.ref!==void 0&&(y=l.ref);for(v in l)r.call(l,v)&&!a.hasOwnProperty(v)&&(f[v]=l[v]);if(u&&u.defaultProps)for(v in l=u.defaultProps,l)f[v]===void 0&&(f[v]=l[v]);return{$$typeof:t,type:u,key:I,ref:y,props:f,_owner:o.current}}return A.Fragment=e,A.jsx=d,A.jsxs=d,A}var G;function le(){return G||(G=1,L.exports=se()),L.exports}var C=le();function q(n){var t,e,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var o=n.length;for(t=0;t<o;t++)n[t]&&(e=q(n[t]))&&(r&&(r+=" "),r+=e)}else for(e in n)n[e]&&(r&&(r+=" "),r+=e);return r}function me(){for(var n,t,e=0,r="",o=arguments.length;e<o;e++)(n=arguments[e])&&(t=q(n))&&(r&&(r+=" "),r+=t);return r}const j={actionRecorderPanel:"univer-action-recorder-panel",actionRecorderPanelIcon:"univer-action-recorder-panel-icon",actionRecorderPanelIconRecording:"univer-action-recorder-panel-icon-recording",recording:"univer-recording",actionRecorderPanelTitle:"univer-action-recorder-panel-title",actionRecorderPanelActions:"univer-action-recorder-panel-actions"};function ue(){const n=i.useDependency(c.ActionRecorderService);return m.useObservable(n.panelOpened$)?C.jsx(fe,{}):null}function fe(){var v;const n=i.useDependency(i.ICommandService),t=i.useDependency(c.ActionRecorderService),e=m.useObservable(t.recording$),r=m.useObservable(t.recordedCommands$),o=(v=r==null?void 0:r.length)!=null?v:0,a=_.useCallback(()=>{e||n.executeCommand(k.id)},[n,e]),d=_.useCallback(f=>{e||n.executeCommand(J.id,{replaceId:f})},[n,e]),u=_.useCallback(()=>{e&&n.executeCommand(W.id)},[n,e]),l=_.useCallback(()=>{e&&n.executeCommand(z.id)},[n,e]),R=e?o===0?"Recording...":`${o}: ${r[o-1].id}`:"Start Recording";return C.jsxs("div",{className:j.actionRecorderPanel,children:[C.jsx("div",{className:me(j.actionRecorderPanelIcon,e?j.actionRecorderPanelIconRecording:!1),children:C.jsx(w,{})}),C.jsx("div",{className:j.actionRecorderPanelTitle,children:R}),C.jsxs("div",{className:j.actionRecorderPanelActions,children:[C.jsx(h.Button,{type:"default",size:"small",onClick:e?l:a,children:e?"Cancel":"Close"}),C.jsx(h.Button,{type:"primary",size:"small",onClick:e?u:()=>d(),children:e?"Save":"Start"}),!e&&C.jsx(h.Button,{type:"primary",size:"small",onClick:()=>d(!0),children:"Start(N)"})]})]})}const Z="RECORD_MENU_ITEM";function ve(){return{id:Z,type:m.MenuItemType.SUBITEMS,icon:"RecordSingle",tooltip:"action-recorder.menu.title"}}function Se(n){const t=n.get(c.ActionRecorderService);return{id:F.id,title:"action-recorder.menu.record",type:m.MenuItemType.BUTTON,disabled$:t.panelOpened$}}function pe(){return{id:x.id,title:"action-recorder.menu.replay-local",type:m.MenuItemType.BUTTON}}function ge(){return{id:E.id,title:"action-recorder.menu.replay-local-name",type:m.MenuItemType.BUTTON}}function _e(){return{id:D.id,title:"action-recorder.menu.replay-local-active",type:m.MenuItemType.BUTTON}}const Ce={[m.RibbonStartGroup.OTHERS]:{[Z]:{order:10,menuItemFactory:ve,[F.id]:{order:1,menuItemFactory:Se},[x.id]:{order:2,menuItemFactory:pe},[E.id]:{order:3,menuItemFactory:ge},[D.id]:{order:4,menuItemFactory:_e}}}};var Re=Object.defineProperty,ye=Object.getOwnPropertyDescriptor,he=(n,t,e,r)=>{for(var o=r>1?void 0:r?ye(t,e):t,a=n.length-1,d;a>=0;a--)(d=n[a])&&(o=(r?d(t,e,o):d(o))||o);return r&&o&&Re(t,e,o),o},O=(n,t)=>(e,r)=>t(e,r,n);let T=class extends i.Disposable{constructor(n,t,e,r,o,a){super(),this._commandSrv=n,this._uiPartsSrv=t,this._menuManagerService=e,this._componentManager=r,this._actionRecorderService=o,this._injector=a,this._initCommands(),this._initUI(),this._initSheetsCommands(),this._initDocsCommands()}_initCommands(){[J,z,W,F,k,x,E,D].forEach(n=>this._commandSrv.registerCommand(n))}_initUI(){this._uiPartsSrv.registerComponent(m.BuiltInUIPart.GLOBAL,()=>i.connectInjector(ue,this._injector)),this._componentManager.register("RecordSingle",w),this._menuManagerService.mergeMenu(Ce)}_initSheetsCommands(){[s.CopySheetCommand,s.DeleteRangeMoveLeftCommand,s.DeleteRangeMoveUpCommand,s.DeltaColumnWidthCommand,s.DeltaRowHeightCommand,s.InsertSheetCommand,s.InsertColAfterCommand,s.InsertColBeforeCommand,s.InsertRowAfterCommand,s.InsertRowBeforeCommand,s.RemoveSheetCommand,s.SetStyleCommand,s.AddWorksheetMergeCommand,s.AddWorksheetMergeAllCommand,s.AddWorksheetMergeVerticalCommand,s.AddWorksheetMergeHorizontalCommand,s.SetFrozenCommand,s.CancelFrozenCommand,s.SetHorizontalTextAlignCommand,s.SetOverlineCommand,S.SetRangeBoldCommand,S.SetRangeFontFamilyCommand,S.SetRangeFontSizeCommand,S.SetRangeItalicCommand,S.SetRangeStrickThroughCommand,S.SetRangeSubscriptCommand,S.SetRangeSuperscriptCommand,S.SetRangeTextColorCommand,S.SetRangeUnderlineCommand,s.SetRangeValuesCommand,s.SetStrikeThroughCommand,s.SetTextColorCommand,s.SetTextRotationCommand,s.SetTextWrapCommand,s.SetVerticalTextAlignCommand,S.SheetCopyCommand,S.SheetCutCommand,S.SheetPasteBesidesBorderCommand,S.SheetPasteColWidthCommand,S.SheetPasteCommand,S.SheetPasteFormatCommand,S.SheetPasteShortKeyCommand,S.SheetPasteValueCommand,s.SetWorksheetActivateCommand,s.SetWorksheetActiveOperation,s.SetSelectionsOperation,N.SetSheetFilterRangeCommand,N.SetSheetsFilterCriteriaCommand,N.RemoveSheetFilterCommand].forEach(n=>this._actionRecorderService.registerRecordedCommand(n))}_initDocsCommands(){}};T=he([O(0,i.ICommandService),O(1,m.IUIPartsService),O(2,m.IMenuManagerService),O(3,i.Inject(m.ComponentManager)),O(4,i.Inject(c.ActionRecorderService)),O(5,i.Inject(i.Injector))],T);const Ie="action-recorder.config",Oe={};var Pe=Object.defineProperty,Ae=Object.getOwnPropertyDescriptor,je=(n,t,e,r)=>{for(var o=r>1?void 0:r?Ae(t,e):t,a=n.length-1,d;a>=0;a--)(d=n[a])&&(o=(r?d(t,e,o):d(o))||o);return r&&o&&Pe(t,e,o),o},K=(n,t)=>(e,r)=>t(e,r,n);c.UniverActionRecorderPlugin=(B=class extends i.Plugin{constructor(t=Oe,e,r){super(),this._config=t,this._injector=e,this._configService=r;const{menu:o,...a}=this._config;o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(Ie,a)}onStarting(){(this._config.replayOnly?[[c.ActionReplayService]]:[[c.ActionRecorderService],[c.ActionReplayService],[T]]).forEach(e=>this._injector.add(e))}onSteady(){this._config.replayOnly||this._injector.get(T)}},g(B,"pluginName","UNIVER_ACTION_RECORDER_PLUGIN"),B),c.UniverActionRecorderPlugin=je([K(1,i.Inject(i.Injector)),K(2,i.IConfigService)],c.UniverActionRecorderPlugin),Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
@@ -0,0 +1 @@
1
+ (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.UniverActionRecorderFrFR=n())})(this,function(){"use strict";return{"action-recorder":{menu:{title:"Enregistrer les actions",record:"Enregistrer les actions...","replay-local":"Lecture de l'enregistrement local..."}}}});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/action-recorder",
3
- "version": "0.5.0",
3
+ "version": "0.5.1-nightly.202411301606",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -52,23 +52,23 @@
52
52
  "rxjs": ">=7.0.0"
53
53
  },
54
54
  "dependencies": {
55
- "@univerjs/icons": "^0.2.7",
55
+ "@univerjs/icons": "^0.2.8",
56
56
  "clsx": "^2.1.1",
57
- "@univerjs/core": "0.5.0",
58
- "@univerjs/design": "0.5.0",
59
- "@univerjs/sheets-ui": "0.5.0",
60
- "@univerjs/ui": "0.5.0",
61
- "@univerjs/sheets": "0.5.0",
62
- "@univerjs/sheets-filter": "0.5.0"
57
+ "@univerjs/core": "0.5.1-nightly.202411301606",
58
+ "@univerjs/design": "0.5.1-nightly.202411301606",
59
+ "@univerjs/sheets": "0.5.1-nightly.202411301606",
60
+ "@univerjs/sheets-filter": "0.5.1-nightly.202411301606",
61
+ "@univerjs/ui": "0.5.1-nightly.202411301606",
62
+ "@univerjs/sheets-ui": "0.5.1-nightly.202411301606"
63
63
  },
64
64
  "devDependencies": {
65
- "less": "^4.2.0",
65
+ "less": "^4.2.1",
66
66
  "react": "18.3.1",
67
67
  "rxjs": "^7.8.1",
68
- "typescript": "^5.6.3",
69
- "vite": "^5.4.11",
70
- "vitest": "^2.1.5",
71
- "@univerjs-infra/shared": "0.5.0"
68
+ "typescript": "^5.7.2",
69
+ "vite": "^6.0.1",
70
+ "vitest": "^2.1.6",
71
+ "@univerjs-infra/shared": "0.5.1"
72
72
  },
73
73
  "space": {
74
74
  ".": {
package/LICENSE DELETED
@@ -1,176 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS