@univerjs/find-replace 0.2.3 → 0.2.4

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 Te=Object.defineProperty;var Ee=(t,e,n)=>e in t?Te(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var d=(t,e,n)=>Ee(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("@univerjs/core"),y=require("@wendellhu/redi"),h=require("@univerjs/ui"),S=require("rxjs"),$e=require("@univerjs/engine-render"),c=require("react"),p=require("@univerjs/design"),M=require("@wendellhu/redi/react-bindings");var C=function(){return C=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s])}return t},C.apply(this,arguments)},Ne=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]]);return n},J=c.forwardRef(function(t,e){var n=t.icon,i=t.id,s=t.className,r=t.extend,a=Ne(t,["icon","id","className","extend"]),o="univerjs-icon univerjs-icon-".concat(i," ").concat(s||"").trim(),f=c.useRef("_".concat(Ae()));return Q(n,"".concat(i),{defIds:n.defIds,idSuffix:f.current},C({ref:e,className:o},a),r)});function Q(t,e,n,i,s){return c.createElement(t.tag,C(C({key:e},je(t,n,s)),i),(Le(t,n).children||[]).map(function(r,a){return Q(r,"".concat(e,"-").concat(t.tag,"-").concat(a),n,void 0,s)}))}function je(t,e,n){var i=C({},t.attrs);n!=null&&n.colorChannel1&&i.fill==="colorChannel1"&&(i.fill=n.colorChannel1);var s=e.defIds;return!s||s.length===0||(t.tag==="use"&&i["xlink:href"]&&(i["xlink:href"]=i["xlink:href"]+e.idSuffix),Object.entries(i).forEach(function(r){var a=r[0],o=r[1];typeof o=="string"&&(i[a]=o.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),i}function Le(t,e){var n,i=e.defIds;return!i||i.length===0?t:t.tag==="defs"&&(!((n=t.children)===null||n===void 0)&&n.length)?C(C({},t),{children:t.children.map(function(s){return typeof s.attrs.id=="string"&&i&&i.indexOf(s.attrs.id)>-1?C(C({},s),{attrs:C(C({},s.attrs),{id:s.attrs.id+e.idSuffix})}):s})}):t}function Ae(){return Math.random().toString(36).substring(2,8)}J.displayName="UniverIcon";var we={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"mask",attrs:{id:"mask0_217_40",style:{maskType:"alpha"},width:17,height:17,x:0,y:0,maskUnits:"userSpaceOnUse"},children:[{tag:"path",attrs:{fill:"#D9D9D9",d:"M0.9 0.09H16.9V16.09H0.9z"}}]},{tag:"g",attrs:{mask:"url(#mask0_217_40)"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M2.39551 7.37266C2.39551 4.18105 4.98281 1.59375 8.17441 1.59375C11.366 1.59375 13.9533 4.18105 13.9533 7.37266C13.9533 8.72342 13.4898 9.96603 12.7133 10.95L15.1964 13.4331C15.4619 13.6986 15.4619 14.1291 15.1964 14.3946C14.9309 14.6601 14.5004 14.6601 14.2349 14.3946L11.7518 11.9115C10.7678 12.6881 9.52525 13.1516 8.17441 13.1516C4.98281 13.1516 2.39551 10.5642 2.39551 7.37266ZM8.17441 2.95349C5.73378 2.95349 3.75525 4.93202 3.75525 7.37266C3.75525 9.81333 5.73378 11.7918 8.17441 11.7918C10.6151 11.7918 12.5936 9.81333 12.5936 7.37266C12.5936 4.93202 10.6151 2.95349 8.17441 2.95349Z",fillRule:"evenodd",clipRule:"evenodd"}}]}]},X=c.forwardRef(function(t,e){return c.createElement(J,Object.assign({},t,{id:"search-single-16",ref:e,icon:we}))});X.displayName="SearchSingle16";const ee="FIND_REPLACE_INPUT_FOCUS",te="FIND_REPLACE_DIALOG_FOCUS",ie="FIND_REPLACE_REPLACE_REVEALED";var Ue=Object.defineProperty,Be=Object.getOwnPropertyDescriptor,ne=(t,e,n,i)=>{for(var s=i>1?void 0:i?Be(e,n):e,r=t.length-1,a;r>=0;r--)(a=t[r])&&(s=(i?a(e,n,s):a(s))||s);return i&&s&&Ue(e,n,s),s},U=(t,e)=>(n,i)=>e(n,i,t);class We extends l.Disposable{}const R=y.createIdentifier("find-replace.service");function ke(t){return typeof t.findString<"u"||typeof t.inputtingFindString<"u"||typeof t.findDirection<"u"||typeof t.matchesTheWholeCell<"u"||typeof t.caseSensitive<"u"||typeof t.findScope<"u"||typeof t.findBy<"u"}let B=class extends l.Disposable{constructor(e,n,i){super();d(this,"currentMatch$",new S.BehaviorSubject(null));d(this,"replaceables$",new S.BehaviorSubject([]));d(this,"_findModels",[]);d(this,"_matchingModel",null);d(this,"_matches",[]);d(this,"_currentSearchingDisposables",null);this._state=e,this._providers=n,this._univerInstanceService=i,this.disposeWithMe(this._state.stateUpdates$.pipe(S.throttleTime(200,void 0,{leading:!0,trailing:!0})).subscribe(async s=>{const r=this._state.state;ke(s)&&(r.findString!==""&&!r.replaceRevealed?(await this._startSearching(),this._state.changeState({findCompleted:!0})):s.replaceRevealed!==!0&&this._stopSearching())}))}get searched(){return this._findModels.length>0}dispose(){super.dispose(),this._stopSearching(),this.currentMatch$.complete(),this.replaceables$.complete(),this._state.changeState({...k(),revealed:!1})}async start(){if(!this._state.findString)return{results:[]};const e=await this._startSearching();return this._state.changeState({findCompleted:!0}),e}async _startSearching(){if(!this._state.findString)return{results:[]};const e=Array.from(this._providers),n=this._findModels=(await Promise.all(e.map(r=>r.find({findString:this._state.findString,findDirection:this._state.findDirection,findScope:this._state.findScope,findBy:this._state.findBy,replaceRevealed:this._state.replaceRevealed,caseSensitive:this._state.caseSensitive,matchesTheWholeCell:this._state.matchesTheWholeCell})))).flat();this._subscribeToModelsChanges(n);const i=this._matches=n.map(r=>r.getMatches()).flat();if(this.replaceables$.next(i.filter(r=>r.replaceable)),!i.length)return this._state.changeState({matchesCount:0,matchesPosition:0}),{results:[]};const s=this._moveToInitialMatch(n,i);return this._state.changeState({matchesCount:i.length,matchesPosition:s+1}),{results:i}}_stopSearching(){var e;this._providers.forEach(n=>n.terminate()),this._findModels=[],this._matches=[],this._matchingModel=null,(e=this._currentSearchingDisposables)==null||e.dispose(),this._currentSearchingDisposables=null,this.currentMatch$.next(null),this.replaceables$.next([]),this._state.changeState({findCompleted:!1,matchesCount:0,matchesPosition:0})}_subscribeToModelsChanges(e){const n=this._currentSearchingDisposables=new l.DisposableCollection,i=S.combineLatest(e.map(s=>s.matchesUpdate$)).pipe(S.debounceTime(220)).subscribe(([...s])=>{const r=this._matches=s.flat();if(r.length){const a=this._moveToInitialMatch(this._findModels,r,!0);this._state.changeState({matchesCount:r.length,matchesPosition:a+1}),this.replaceables$.next(r.filter(o=>o.replaceable))}else this._state.changeState({matchesCount:0,matchesPosition:0}),this.replaceables$.next([])});e.forEach(s=>n.add(l.toDisposable(s.activelyChangingMatch$.subscribe(r=>{const a=this._matches.findIndex(o=>o===r);this._state.changeState({matchesPosition:a+1})})))),n.add(l.toDisposable(i))}async replace(){return this._matchingModel?this._matchingModel.replace(this._state.replaceString):!1}async replaceAll(){const e=await Promise.all(this._findModels.map(n=>n.replaceAll(this._state.replaceString))).then(n=>n.reduce((i,s)=>(i.success+=s.success,i.failure+=s.failure,i),{success:0,failure:0}));return e.failure===0&&this._stopSearching(),e}getCurrentMatch(){return this._state.matchesPosition>0?this._matches[this._state.matchesPosition-1]:null}moveToNextMatch(){if(!this._matchingModel)return;const e=this._findModels.length===1,n=this._matchingModel.moveToNextMatch({loop:e});if(n){const i=this._matches.findIndex(s=>s===n);this.currentMatch$.next(n),this._state.changeState({matchesPosition:i+1})}else{const i=this._findModels.findIndex(o=>o===this._matchingModel),s=this._findModels[(i+1)%this._findModels.length],r=s.moveToNextMatch(),a=this._matches.findIndex(o=>o===r);this.currentMatch$.next(r),this._matchingModel=s,this._state.changeState({matchesPosition:a+1})}}moveToPreviousMatch(){if(!this._matchingModel)return;const e=this._findModels.length===1,n=this._matchingModel.moveToPreviousMatch({loop:e});if(n){const i=this._matches.findIndex(s=>s===n);this.currentMatch$.next(n),this._state.changeState({matchesPosition:i+1})}else{const i=this._findModels.findIndex(o=>o===this._matchingModel),s=this._findModels[(i-1+this._findModels.length)%this._findModels.length],r=s.moveToPreviousMatch(),a=this._matches.findIndex(o=>o===r);this.currentMatch$.next(r),this._matchingModel=s,this._state.changeState({matchesPosition:a+1})}}_moveToInitialMatch(e,n,i=!1){var f;const s=(f=this._univerInstanceService.getFocusedUnit())==null?void 0:f.getUnitId();if(!s)return-1;const r=e.find(g=>g.unitId===s);if(r){this._matchingModel=r;const g=r.moveToNextMatch({stayIfOnMatch:!0,noFocus:i}),v=n.findIndex(m=>m===g);return this.currentMatch$.next(g),v}this._matchingModel=e[0];const a=this._matchingModel.moveToNextMatch({noFocus:i}),o=this._matches.findIndex(g=>g===a);return this.currentMatch$.next(a),o}};B=ne([U(2,l.IUniverInstanceService)],B);var P=(t=>(t.ROW="row",t.COLUMN="column",t))(P||{}),T=(t=>(t.VALUE="value",t.FORMULA="formula",t))(T||{}),E=(t=>(t.SUBUNIT="subunit",t.UNIT="unit",t))(E||{});function k(){return{caseSensitive:!1,findBy:"value",findCompleted:!1,findDirection:"row",findScope:"subunit",findString:"",inputtingFindString:"",matchesCount:0,matchesPosition:0,matchesTheWholeCell:!1,replaceRevealed:!1,replaceString:"",revealed:!0}}class Ge{constructor(){d(this,"_stateUpdates$",new S.Subject);d(this,"stateUpdates$",this._stateUpdates$.asObservable());d(this,"_state$",new S.BehaviorSubject(k()));d(this,"state$",this._state$.asObservable());d(this,"_findString","");d(this,"_inputtingFindString","");d(this,"_replaceString","");d(this,"_revealed",!1);d(this,"_replaceRevealed",!1);d(this,"_matchesPosition",0);d(this,"_matchesCount",0);d(this,"_caseSensitive",!0);d(this,"_matchesTheWholeCell",!1);d(this,"_findDirection","row");d(this,"_findScope","subunit");d(this,"_findBy","value");d(this,"_findCompleted",!1)}get state(){return this._state$.getValue()}get inputtingFindString(){return this._inputtingFindString}get findString(){return this._findString}get revealed(){return this._revealed}get replaceRevealed(){return this._replaceRevealed}get matchesPosition(){return this._matchesPosition}get matchesCount(){return this._matchesCount}get replaceString(){return this._replaceString}get caseSensitive(){return this._caseSensitive}get matchesTheWholeCell(){return this._matchesTheWholeCell}get findDirection(){return this._findDirection}get findScope(){return this._findScope}get findBy(){return this._findBy}get findCompleted(){return this._findCompleted}changeState(e){let n=!1;const i={};typeof e.findString<"u"&&e.findString!==this._findString&&(this._findString=e.findString,i.findString=this._findString,n=!0),typeof e.revealed<"u"&&e.revealed!==this._revealed&&(this._revealed=e.revealed,i.revealed=e.revealed,n=!0),typeof e.replaceRevealed<"u"&&e.replaceRevealed!==this._replaceRevealed&&(this._replaceRevealed=e.replaceRevealed,i.replaceRevealed=e.replaceRevealed,n=!0),typeof e.replaceString<"u"&&e.replaceString!==this._replaceString&&(this._replaceString=e.replaceString,i.replaceString=e.replaceString,n=!0),typeof e.matchesCount<"u"&&e.matchesCount!==this._matchesCount&&(this._matchesCount=e.matchesCount,i.matchesCount=e.matchesCount,n=!0),typeof e.matchesPosition<"u"&&e.matchesPosition!==this._matchesPosition&&(this._matchesPosition=e.matchesPosition,i.matchesPosition=e.matchesPosition,n=!0),typeof e.findBy<"u"&&e.findBy!==this._findBy&&(this._findBy=e.findBy,i.findBy=e.findBy,n=!0),typeof e.findScope<"u"&&e.findScope!==this._findScope&&(this._findScope=e.findScope,i.findScope=e.findScope,n=!0),typeof e.findDirection<"u"&&e.findDirection!==this._findDirection&&(this._findDirection=e.findDirection,i.findDirection=e.findDirection,n=!0),typeof e.caseSensitive<"u"&&e.caseSensitive!==this._caseSensitive&&(this._caseSensitive=e.caseSensitive,i.caseSensitive=e.caseSensitive,n=!0),typeof e.matchesTheWholeCell<"u"&&e.matchesTheWholeCell!==this._matchesTheWholeCell&&(this._matchesTheWholeCell=e.matchesTheWholeCell,i.matchesTheWholeCell=e.matchesTheWholeCell,n=!0),typeof e.inputtingFindString<"u"&&e.inputtingFindString!==this._inputtingFindString&&(this._inputtingFindString=e.inputtingFindString,i.inputtingFindString=e.inputtingFindString,n=!0),typeof e.findCompleted<"u"&&e.findCompleted!==this._findCompleted&&(this._findCompleted=e.findCompleted,i.findCompleted=e.findCompleted,n=!0),n&&(this._state$.next({caseSensitive:this._caseSensitive,findBy:this._findBy,findCompleted:this._findCompleted,findDirection:this._findDirection,findScope:this._findScope,findString:this._findString,inputtingFindString:this._inputtingFindString,matchesCount:this._matchesCount,matchesPosition:this._matchesPosition,matchesTheWholeCell:this._matchesTheWholeCell,replaceRevealed:this._replaceRevealed,revealed:this._revealed}),this._stateUpdates$.next(i))}}let W=class extends l.Disposable{constructor(e,n){super();d(this,"_providers",new Set);d(this,"_state",new Ge);d(this,"_model");d(this,"_currentMatch$",new S.BehaviorSubject(null));d(this,"currentMatch$",this._currentMatch$.asObservable());d(this,"_replaceables$",new S.BehaviorSubject([]));d(this,"replaceables$",this._replaceables$.asObservable());d(this,"_focusSignal$",new S.Subject);d(this,"focusSignal$",this._focusSignal$.asObservable());this._injector=e,this._contextService=n}get stateUpdates$(){return this._state.stateUpdates$}get state$(){return this._state.state$}get revealed(){return this._state.revealed}get replaceRevealed(){return this._state.replaceRevealed}dispose(){super.dispose(),this._currentMatch$.next(null),this._currentMatch$.complete(),this._replaceables$.next([]),this._replaceables$.complete(),this._focusSignal$.complete()}getCurrentMatch(){var e;return(e=this._model)==null?void 0:e.getCurrentMatch()}getFindString(){return this._state.findString}changeFindString(e){this._state.changeState({findString:e})}focusFindInput(){this._focusSignal$.next()}changeInputtingFindString(e){e?this._state.changeState({inputtingFindString:e}):this._state.changeState({inputtingFindString:"",findString:""})}changeReplaceString(e){this._state.changeState({replaceString:e})}changeMatchesTheWholeCell(e){this._state.changeState({matchesTheWholeCell:e})}changeCaseSensitive(e){this._state.changeState({caseSensitive:e})}changeFindBy(e){this._state.changeState({findBy:e}),this._toggleDisplayRawFormula(e==="formula")}changeFindScope(e){this._state.changeState({findScope:e})}changeFindDirection(e){this._state.changeState({findDirection:e})}moveToNextMatch(){this._model&&(this._state.replaceRevealed&&!this._model.searched?(this._state.changeState({findString:this._state.inputtingFindString}),this._model.start()):this._model.moveToNextMatch(),this._focusSignal$.next())}moveToPreviousMatch(){this._model&&(this._state.replaceRevealed&&!this._model.searched?(this._state.changeState({findString:this._state.inputtingFindString}),this._model.start()):this._model.moveToPreviousMatch(),this._focusSignal$.next())}async replace(){return this._model?this._model.replace():!1}async replaceAll(){if(!this._model)throw new Error("[FindReplaceService] replaceAll: model is not initialized!");return this._model.replaceAll()}revealReplace(){this._state.changeState({replaceRevealed:!0,inputtingFindString:this._state.findString}),this._toggleRevealReplace(!0)}start(e=!1){if(this._providers.size===0)return!1;this._model=this._injector.createInstance(B,this._state,this._providers),this._model.currentMatch$.subscribe(i=>this._currentMatch$.next(i)),this._model.replaceables$.subscribe(i=>this._replaceables$.next(i));const n=k();return e&&(n.replaceRevealed=!0),this._state.changeState(n),this._toggleRevealReplace(e),!0}find(){var e;(e=this._model)==null||e.start()}terminate(){var e;(e=this._model)==null||e.dispose(),this._model=null,this._toggleDisplayRawFormula(!1),this._toggleRevealReplace(!1)}registerFindReplaceProvider(e){return this._providers.add(e),l.toDisposable(()=>this._providers.delete(e))}_toggleRevealReplace(e){this._contextService.setContextValue(ie,e)}_toggleDisplayRawFormula(e){this._contextService.setContextValue($e.RENDER_RAW_FORMULA_KEY,e)}};W=ne([U(0,y.Inject(y.Injector)),U(1,l.IContextService)],W);const I={id:"ui.operation.open-find-dialog",type:l.CommandType.OPERATION,handler:t=>{const e=t.get(R);return e.revealed?e.focusFindInput():e.start(),!0}},N={id:"ui.operation.open-replace-dialog",type:l.CommandType.OPERATION,handler:t=>{const e=t.get(R);return e.revealed?e.replaceRevealed?e.focusFindInput():e.revealReplace():e.start(!0),!0}},G={type:l.CommandType.OPERATION,id:"ui.operation.go-to-next-match",handler:t=>(t.get(R).moveToNextMatch(),!0)},V={type:l.CommandType.OPERATION,id:"ui.operation.go-to-previous-match",handler:t=>(t.get(R).moveToPreviousMatch(),!0)};var se={exports:{}},j={};/**
1
+ "use strict";var Pe=Object.defineProperty;var Ee=(i,e,n)=>e in i?Pe(i,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[e]=n;var l=(i,e,n)=>Ee(i,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@univerjs/core"),b=require("@wendellhu/redi"),u=require("@univerjs/ui"),g=require("rxjs"),Ne=require("@univerjs/engine-render"),o=require("react"),p=require("@univerjs/design"),M=require("@wendellhu/redi/react-bindings");var S=function(){return S=Object.assign||function(i){for(var e,n=1,t=arguments.length;n<t;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(i[r]=e[r])}return i},S.apply(this,arguments)},je=function(i,e){var n={};for(var t in i)Object.prototype.hasOwnProperty.call(i,t)&&e.indexOf(t)<0&&(n[t]=i[t]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,t=Object.getOwnPropertySymbols(i);r<t.length;r++)e.indexOf(t[r])<0&&Object.prototype.propertyIsEnumerable.call(i,t[r])&&(n[t[r]]=i[t[r]]);return n},J=o.forwardRef(function(i,e){var n=i.icon,t=i.id,r=i.className,s=i.extend,a=je(i,["icon","id","className","extend"]),h="univerjs-icon univerjs-icon-".concat(t," ").concat(r||"").trim(),f=o.useRef("_".concat(Ae()));return Q(n,"".concat(t),{defIds:n.defIds,idSuffix:f.current},S({ref:e,className:h},a),s)});function Q(i,e,n,t,r){return o.createElement(i.tag,S(S({key:e},$e(i,n,r)),t),(Le(i,n).children||[]).map(function(s,a){return Q(s,"".concat(e,"-").concat(i.tag,"-").concat(a),n,void 0,r)}))}function $e(i,e,n){var t=S({},i.attrs);n!=null&&n.colorChannel1&&t.fill==="colorChannel1"&&(t.fill=n.colorChannel1);var r=e.defIds;return!r||r.length===0||(i.tag==="use"&&t["xlink:href"]&&(t["xlink:href"]=t["xlink:href"]+e.idSuffix),Object.entries(t).forEach(function(s){var a=s[0],h=s[1];typeof h=="string"&&(t[a]=h.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),t}function Le(i,e){var n,t=e.defIds;return!t||t.length===0?i:i.tag==="defs"&&(!((n=i.children)===null||n===void 0)&&n.length)?S(S({},i),{children:i.children.map(function(r){return typeof r.attrs.id=="string"&&t&&t.indexOf(r.attrs.id)>-1?S(S({},r),{attrs:S(S({},r.attrs),{id:r.attrs.id+e.idSuffix})}):r})}):i}function Ae(){return Math.random().toString(36).substring(2,8)}J.displayName="UniverIcon";var we={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"mask",attrs:{id:"mask0_217_40",style:{maskType:"alpha"},width:17,height:17,x:0,y:0,maskUnits:"userSpaceOnUse"},children:[{tag:"path",attrs:{fill:"#D9D9D9",d:"M0.9 0.09H16.9V16.09H0.9z"}}]},{tag:"g",attrs:{mask:"url(#mask0_217_40)"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M2.39551 7.37266C2.39551 4.18105 4.98281 1.59375 8.17441 1.59375C11.366 1.59375 13.9533 4.18105 13.9533 7.37266C13.9533 8.72342 13.4898 9.96603 12.7133 10.95L15.1964 13.4331C15.4619 13.6986 15.4619 14.1291 15.1964 14.3946C14.9309 14.6601 14.5004 14.6601 14.2349 14.3946L11.7518 11.9115C10.7678 12.6881 9.52525 13.1516 8.17441 13.1516C4.98281 13.1516 2.39551 10.5642 2.39551 7.37266ZM8.17441 2.95349C5.73378 2.95349 3.75525 4.93202 3.75525 7.37266C3.75525 9.81333 5.73378 11.7918 8.17441 11.7918C10.6151 11.7918 12.5936 9.81333 12.5936 7.37266C12.5936 4.93202 10.6151 2.95349 8.17441 2.95349Z",fillRule:"evenodd",clipRule:"evenodd"}}]}]},X=o.forwardRef(function(i,e){return o.createElement(J,Object.assign({},i,{id:"search-single-16",ref:e,icon:we}))});X.displayName="SearchSingle16";const ee="FIND_REPLACE_INPUT_FOCUS",te="FIND_REPLACE_DIALOG_FOCUS",ie="FIND_REPLACE_REPLACE_REVEALED";var Ue=Object.defineProperty,Be=Object.getOwnPropertyDescriptor,ne=(i,e,n,t)=>{for(var r=t>1?void 0:t?Be(e,n):e,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(t?a(e,n,r):a(r))||r);return t&&r&&Ue(e,n,r),r},U=(i,e)=>(n,t)=>e(n,t,i);class ke extends c.Disposable{}const C=b.createIdentifier("find-replace.service");function We(i){return typeof i.findString<"u"||typeof i.inputtingFindString<"u"||typeof i.findDirection<"u"||typeof i.matchesTheWholeCell<"u"||typeof i.caseSensitive<"u"||typeof i.findScope<"u"||typeof i.findBy<"u"}let B=class extends c.Disposable{constructor(e,n,t){super();l(this,"currentMatch$",new g.BehaviorSubject(null));l(this,"replaceables$",new g.BehaviorSubject([]));l(this,"_findModels",[]);l(this,"_matchingModel",null);l(this,"_matches",[]);l(this,"_currentSearchingDisposables",null);this._state=e,this._providers=n,this._univerInstanceService=t,this.disposeWithMe(this._state.stateUpdates$.pipe(g.throttleTime(200,void 0,{leading:!0,trailing:!0})).subscribe(async r=>{const s=this._state.state;We(r)&&(s.findString!==""&&!s.replaceRevealed?(await this._startSearching(),this._state.changeState({findCompleted:!0})):r.replaceRevealed!==!0&&this._stopSearching())}))}get searched(){return this._findModels.length>0}dispose(){super.dispose(),this._stopSearching(),this.currentMatch$.complete(),this.replaceables$.complete(),this._state.changeState({...W(),revealed:!1})}async start(){if(!this._state.findString)return{results:[]};const e=await this._startSearching();return this._state.changeState({findCompleted:!0}),e}async _startSearching(){if(!this._state.findString)return{results:[]};const e=Array.from(this._providers),n=this._findModels=(await Promise.all(e.map(r=>r.find({findString:this._state.findString,findDirection:this._state.findDirection,findScope:this._state.findScope,findBy:this._state.findBy,replaceRevealed:this._state.replaceRevealed,caseSensitive:this._state.caseSensitive,matchesTheWholeCell:this._state.matchesTheWholeCell})))).flat();this._subscribeToModelsChanges(n);const t=this._matches=n.map(r=>r.getMatches()).flat();return this.replaceables$.next(t.filter(r=>r.replaceable)),t.length?(this._moveToInitialMatch(n),this._state.changeState({matchesCount:t.length}),{results:t}):(this._state.changeState({matchesCount:0,matchesPosition:0}),{results:[]})}_stopSearching(){var e;this._providers.forEach(n=>n.terminate()),this._findModels=[],this._matches=[],this._matchingModel=null,(e=this._currentSearchingDisposables)==null||e.dispose(),this._currentSearchingDisposables=null,this.currentMatch$.next(null),this.replaceables$.next([]),this._state.changeState({findCompleted:!1,matchesCount:0,matchesPosition:0})}_subscribeToModelsChanges(e){const n=this._currentSearchingDisposables=new c.DisposableCollection,t=g.combineLatest(e.map(r=>r.matchesUpdate$)).pipe(g.debounceTime(220)).subscribe(([...r])=>{const s=this._matches=r.flat();s.length?(this._moveToInitialMatch(this._findModels,!0),this._state.changeState({matchesCount:s.length}),this.replaceables$.next(s.filter(a=>a.replaceable))):(this._state.changeState({matchesCount:0,matchesPosition:0}),this.replaceables$.next([]))});e.forEach(r=>n.add(c.toDisposable(r.activelyChangingMatch$.subscribe(s=>{const a=this._matches.findIndex(h=>h===s);this._state.changeState({matchesPosition:a+1})})))),n.add(c.toDisposable(t))}async replace(){return this._matchingModel?this._matchingModel.replace(this._state.replaceString):!1}async replaceAll(){const e=await Promise.all(this._findModels.map(n=>n.replaceAll(this._state.replaceString))).then(n=>n.reduce((t,r)=>(t.success+=r.success,t.failure+=r.failure,t),{success:0,failure:0}));return e.failure===0&&this._stopSearching(),e}getCurrentMatch(){return this._state.matchesPosition>0?this._matches[this._state.matchesPosition-1]:null}_markMatch(e){const n=this._matches.findIndex(t=>t===e);this.currentMatch$.next(e),this._state.changeState({matchesPosition:n+1})}moveToNextMatch(){if(!this._matchingModel)return;const e=this._findModels.length===1,n=this._matchingModel.moveToNextMatch({loop:e});if(n)this._markMatch(n);else{const t=this._findModels.findIndex(r=>r===this._matchingModel);this._moveToNextUnitMatch(t)}}_moveToNextUnitMatch(e){const n=this._findModels.length;for(let t=(e+1)%n;t!==e;){const r=this._findModels[t],s=r.moveToNextMatch({ignoreSelection:!0});if(s){this._matchingModel=r,this._markMatch(s);return}t=(t+1)%n}if(this._matchingModel){const t=this._matchingModel.moveToNextMatch({ignoreSelection:!0});t&&this._markMatch(t)}}moveToPreviousMatch(){if(!this._matchingModel)return;const e=this._findModels.length===1,n=this._matchingModel.moveToPreviousMatch({loop:e});if(n){const t=this._matches.findIndex(r=>r===n);this.currentMatch$.next(n),this._state.changeState({matchesPosition:t+1})}else{const t=this._findModels.length,r=this._findModels.findIndex(a=>a===this._matchingModel);for(let a=(r-1+t)%t;a!==r;){const h=this._findModels[a],f=h.moveToPreviousMatch({ignoreSelection:!0});if(f){this._matchingModel=h,this._markMatch(f);return}a=(a-1)%t}const s=this._matchingModel.moveToPreviousMatch({ignoreSelection:!0});s&&this._markMatch(s)}}_moveToInitialMatch(e,n=!1){var s;const t=(s=this._univerInstanceService.getFocusedUnit())==null?void 0:s.getUnitId();if(!t)return-1;const r=e.findIndex(a=>a.unitId===t);if(r!==-1){this._matchingModel=e[r];const a=this._matchingModel.moveToNextMatch({stayIfOnMatch:!0,noFocus:n});if(a)return this._markMatch(a),r}return this._moveToNextUnitMatch(r),0}};B=ne([U(2,c.IUniverInstanceService)],B);var O=(i=>(i.ROW="row",i.COLUMN="column",i))(O||{}),P=(i=>(i.VALUE="value",i.FORMULA="formula",i))(P||{}),E=(i=>(i.SUBUNIT="subunit",i.UNIT="unit",i))(E||{});function W(){return{caseSensitive:!1,findBy:"value",findCompleted:!1,findDirection:"row",findScope:"subunit",findString:"",inputtingFindString:"",matchesCount:0,matchesPosition:0,matchesTheWholeCell:!1,replaceRevealed:!1,replaceString:"",revealed:!0}}class Ge{constructor(){l(this,"_stateUpdates$",new g.Subject);l(this,"stateUpdates$",this._stateUpdates$.asObservable());l(this,"_state$",new g.BehaviorSubject(W()));l(this,"state$",this._state$.asObservable());l(this,"_findString","");l(this,"_inputtingFindString","");l(this,"_replaceString","");l(this,"_revealed",!1);l(this,"_replaceRevealed",!1);l(this,"_matchesPosition",0);l(this,"_matchesCount",0);l(this,"_caseSensitive",!0);l(this,"_matchesTheWholeCell",!1);l(this,"_findDirection","row");l(this,"_findScope","subunit");l(this,"_findBy","value");l(this,"_findCompleted",!1)}get state(){return this._state$.getValue()}get inputtingFindString(){return this._inputtingFindString}get findString(){return this._findString}get revealed(){return this._revealed}get replaceRevealed(){return this._replaceRevealed}get matchesPosition(){return this._matchesPosition}get matchesCount(){return this._matchesCount}get replaceString(){return this._replaceString}get caseSensitive(){return this._caseSensitive}get matchesTheWholeCell(){return this._matchesTheWholeCell}get findDirection(){return this._findDirection}get findScope(){return this._findScope}get findBy(){return this._findBy}get findCompleted(){return this._findCompleted}changeState(e){let n=!1;const t={};typeof e.findString<"u"&&e.findString!==this._findString&&(this._findString=e.findString,t.findString=this._findString,n=!0),typeof e.revealed<"u"&&e.revealed!==this._revealed&&(this._revealed=e.revealed,t.revealed=e.revealed,n=!0),typeof e.replaceRevealed<"u"&&e.replaceRevealed!==this._replaceRevealed&&(this._replaceRevealed=e.replaceRevealed,t.replaceRevealed=e.replaceRevealed,n=!0),typeof e.replaceString<"u"&&e.replaceString!==this._replaceString&&(this._replaceString=e.replaceString,t.replaceString=e.replaceString,n=!0),typeof e.matchesCount<"u"&&e.matchesCount!==this._matchesCount&&(this._matchesCount=e.matchesCount,t.matchesCount=e.matchesCount,n=!0),typeof e.matchesPosition<"u"&&e.matchesPosition!==this._matchesPosition&&(this._matchesPosition=e.matchesPosition,t.matchesPosition=e.matchesPosition,n=!0),typeof e.findBy<"u"&&e.findBy!==this._findBy&&(this._findBy=e.findBy,t.findBy=e.findBy,n=!0),typeof e.findScope<"u"&&e.findScope!==this._findScope&&(this._findScope=e.findScope,t.findScope=e.findScope,n=!0),typeof e.findDirection<"u"&&e.findDirection!==this._findDirection&&(this._findDirection=e.findDirection,t.findDirection=e.findDirection,n=!0),typeof e.caseSensitive<"u"&&e.caseSensitive!==this._caseSensitive&&(this._caseSensitive=e.caseSensitive,t.caseSensitive=e.caseSensitive,n=!0),typeof e.matchesTheWholeCell<"u"&&e.matchesTheWholeCell!==this._matchesTheWholeCell&&(this._matchesTheWholeCell=e.matchesTheWholeCell,t.matchesTheWholeCell=e.matchesTheWholeCell,n=!0),typeof e.inputtingFindString<"u"&&e.inputtingFindString!==this._inputtingFindString&&(this._inputtingFindString=e.inputtingFindString,t.inputtingFindString=e.inputtingFindString,n=!0),typeof e.findCompleted<"u"&&e.findCompleted!==this._findCompleted&&(this._findCompleted=e.findCompleted,t.findCompleted=e.findCompleted,n=!0),n&&(this._state$.next({caseSensitive:this._caseSensitive,findBy:this._findBy,findCompleted:this._findCompleted,findDirection:this._findDirection,findScope:this._findScope,findString:this._findString,inputtingFindString:this._inputtingFindString,matchesCount:this._matchesCount,matchesPosition:this._matchesPosition,matchesTheWholeCell:this._matchesTheWholeCell,replaceRevealed:this._replaceRevealed,revealed:this._revealed}),this._stateUpdates$.next(t))}}let k=class extends c.Disposable{constructor(e,n){super();l(this,"_providers",new Set);l(this,"_state",new Ge);l(this,"_model");l(this,"_currentMatch$",new g.BehaviorSubject(null));l(this,"currentMatch$",this._currentMatch$.asObservable());l(this,"_replaceables$",new g.BehaviorSubject([]));l(this,"replaceables$",this._replaceables$.asObservable());l(this,"_focusSignal$",new g.Subject);l(this,"focusSignal$",this._focusSignal$.asObservable());this._injector=e,this._contextService=n}get stateUpdates$(){return this._state.stateUpdates$}get state$(){return this._state.state$}get revealed(){return this._state.revealed}get replaceRevealed(){return this._state.replaceRevealed}dispose(){super.dispose(),this._currentMatch$.next(null),this._currentMatch$.complete(),this._replaceables$.next([]),this._replaceables$.complete(),this._focusSignal$.complete()}getCurrentMatch(){var e;return(e=this._model)==null?void 0:e.getCurrentMatch()}getFindString(){return this._state.findString}changeFindString(e){this._state.changeState({findString:e})}focusFindInput(){this._focusSignal$.next()}changeInputtingFindString(e){e?this._state.changeState({inputtingFindString:e}):this._state.changeState({inputtingFindString:"",findString:""})}changeReplaceString(e){this._state.changeState({replaceString:e})}changeMatchesTheWholeCell(e){this._state.changeState({matchesTheWholeCell:e})}changeCaseSensitive(e){this._state.changeState({caseSensitive:e})}changeFindBy(e){this._state.changeState({findBy:e}),this._toggleDisplayRawFormula(e==="formula")}changeFindScope(e){this._state.changeState({findScope:e})}changeFindDirection(e){this._state.changeState({findDirection:e})}moveToNextMatch(){this._model&&(this._state.replaceRevealed&&!this._model.searched?(this._state.changeState({findString:this._state.inputtingFindString}),this._model.start()):this._model.moveToNextMatch(),this._focusSignal$.next())}moveToPreviousMatch(){this._model&&(this._state.replaceRevealed&&!this._model.searched?(this._state.changeState({findString:this._state.inputtingFindString}),this._model.start()):this._model.moveToPreviousMatch(),this._focusSignal$.next())}async replace(){return this._model?this._model.replace():!1}async replaceAll(){if(!this._model)throw new Error("[FindReplaceService] replaceAll: model is not initialized!");return this._model.replaceAll()}revealReplace(){this._state.changeState({replaceRevealed:!0,inputtingFindString:this._state.findString}),this._toggleRevealReplace(!0)}start(e=!1){if(this._providers.size===0)return!1;this._model=this._injector.createInstance(B,this._state,this._providers),this._model.currentMatch$.subscribe(t=>this._currentMatch$.next(t)),this._model.replaceables$.subscribe(t=>this._replaceables$.next(t));const n=W();return e&&(n.replaceRevealed=!0),this._state.changeState(n),this._toggleRevealReplace(e),!0}find(){var e;(e=this._model)==null||e.start()}terminate(){var e;(e=this._model)==null||e.dispose(),this._model=null,this._toggleDisplayRawFormula(!1),this._toggleRevealReplace(!1)}registerFindReplaceProvider(e){return this._providers.add(e),c.toDisposable(()=>this._providers.delete(e))}_toggleRevealReplace(e){this._contextService.setContextValue(ie,e)}_toggleDisplayRawFormula(e){this._contextService.setContextValue(Ne.RENDER_RAW_FORMULA_KEY,e)}};k=ne([U(0,b.Inject(b.Injector)),U(1,c.IContextService)],k);const x={id:"ui.operation.open-find-dialog",type:c.CommandType.OPERATION,handler:i=>{const e=i.get(C);return e.revealed?e.focusFindInput():e.start(),!0}},j={id:"ui.operation.open-replace-dialog",type:c.CommandType.OPERATION,handler:i=>{const e=i.get(C);return e.revealed?e.replaceRevealed?e.focusFindInput():e.revealReplace():e.start(!0),!0}},G={type:c.CommandType.OPERATION,id:"ui.operation.go-to-next-match",handler:i=>(i.get(C).moveToNextMatch(),!0)},V={type:c.CommandType.OPERATION,id:"ui.operation.go-to-previous-match",handler:i=>(i.get(C).moveToPreviousMatch(),!0)};var re={exports:{}},$={};/**
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 Ve=c,He=Symbol.for("react.element"),Ke=Symbol.for("react.fragment"),qe=Object.prototype.hasOwnProperty,ze=Ve.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Ye={key:!0,ref:!0,__self:!0,__source:!0};function re(t,e,n){var i,s={},r=null,a=null;n!==void 0&&(r=""+n),e.key!==void 0&&(r=""+e.key),e.ref!==void 0&&(a=e.ref);for(i in e)qe.call(e,i)&&!Ye.hasOwnProperty(i)&&(s[i]=e[i]);if(t&&t.defaultProps)for(i in e=t.defaultProps,e)s[i]===void 0&&(s[i]=e[i]);return{$$typeof:He,type:t,key:r,ref:a,props:s,_owner:ze.current}}j.Fragment=Ke;j.jsx=re;j.jsxs=re;se.exports=j;var u=se.exports;const H={id:"ui.command.replace-current-match",type:l.CommandType.COMMAND,handler:t=>t.get(R).replace()},Ze="CONFIRM_REPLACE_ALL",K={id:"ui.command.replace-all-matches",type:l.CommandType.COMMAND,handler:async t=>{const e=t.get(h.IConfirmService),n=t.get(l.LocaleService),i=t.get(h.IMessageService);if(!await e.confirm({id:Ze,title:{title:n.t("find-replace.replace.confirm.title")},cancelText:n.t("button.cancel"),confirmText:n.t("button.confirm")}))return!1;const r=await t.get(R).replaceAll(),{success:a,failure:o}=r;return o>0?(a===0?i.show({type:p.MessageType.Error,content:n.t("find-replace.replace.all-failure")}):i.show({type:p.MessageType.Warning,content:n.t("find-replace.replace.partial-success",`${a}`,`${o}`)}),!1):(i.show({type:p.MessageType.Success,content:n.t("find-replace.replace.all-success",`${a}`)}),!0)}};function ae(t){const{findCompleted:e,localeService:n,matchesCount:i,matchesPosition:s,findString:r,findReplaceService:a,onChange:o,...f}=t,v=e&&i===0?n.t("find-replace.dialog.no-result"):i===0?" ":void 0;return u.jsx(p.InputWithSlot,{autoFocus:!0,placeholder:n.t("find-replace.dialog.find-placeholder"),slot:u.jsx(p.Pager,{loop:!0,text:v,value:s,total:i,onChange:m=>{s===i&&m===1?a.moveToNextMatch():s===1&&m===i||m<s?a.moveToPreviousMatch():a.moveToNextMatch()}}),value:r,onChange:m=>o==null?void 0:o(m),...f})}const Je="univer-find-replace-dialog-container",Qe="univer-find-replace-expand-container",Xe="univer-button-text",et="univer-find-replace-buttons-group",tt="univer-find-replace-buttons-group-right",$={findReplaceDialogContainer:Je,findReplaceExpandContainer:Qe,buttonText:Xe,findReplaceButtonsGroup:et,findReplaceButtonsGroupRight:tt};function oe(t,e){const n=c.useCallback(()=>{var s;(s=document.querySelector(".univer-find-input input"))==null||s.focus()},[]),i=c.useCallback(()=>{const s=document.querySelectorAll(".univer-find-replace-dialog-container .univer-select-selection-search-input");return Array.from(s).some(r=>r===document.activeElement)},[]);return c.useImperativeHandle(e,()=>({focus:n,selectHasFocus:i})),c.useEffect(()=>{const s=t.focusSignal$.subscribe(()=>n());return()=>s.unsubscribe()},[t,n]),{focus:n,selectHasFocus:i}}const it=c.forwardRef(function(e,n){const i=M.useDependency(l.LocaleService),s=M.useDependency(R),r=M.useDependency(l.ICommandService),a=h.useObservable(s.state$,void 0,!0),{findCompleted:o,findString:f,matchesCount:g,matchesPosition:v}=a,m=c.useCallback(()=>{r.executeCommand(N.id)},[r]),D=c.useCallback(x=>s.changeFindString(x),[s]);return oe(s,n),u.jsxs(c.Fragment,{children:[u.jsx(ae,{findCompleted:o,className:"univer-find-input",matchesCount:g,matchesPosition:v,findReplaceService:s,localeService:i,findString:f,onChange:D}),u.jsx("div",{className:$.findReplaceExpandContainer,children:u.jsx(p.Button,{type:"text",size:"small",onClick:m,children:i.t("find-replace.dialog.advanced-finding")})})]})}),nt=c.forwardRef(function(e,n){const i=M.useDependency(R),s=M.useDependency(l.LocaleService),r=M.useDependency(l.ICommandService),a=M.useDependency(h.IMessageService),o=h.useObservable(i.currentMatch$,void 0,!0),f=h.useObservable(i.replaceables$,void 0,!0),g=h.useObservable(i.state$,void 0,!0),{matchesCount:v,matchesPosition:m,findString:D,inputtingFindString:x,replaceString:de,caseSensitive:ue,matchesTheWholeCell:he,findDirection:pe,findScope:fe,findBy:_e,findCompleted:A}=g,ge=x.length===0,me=v===0||!(o!=null&&o.replaceable),ve=f.length===0,Se=c.useCallback(_=>i.changeInputtingFindString(_),[i]),Ce=c.useCallback(_=>i.changeReplaceString(_),[i]),{focus:Re}=oe(i,n),be=c.useCallback(()=>{D===x?i.moveToNextMatch():(i.changeFindString(x),i.find())},[D,x,i]),ye=c.useCallback(()=>r.executeCommand(H.id),[r]),Me=c.useCallback(async()=>{await r.executeCommand(K.id),Re()},[r]),xe=c.useCallback(_=>{i.changeFindDirection(_)},[i]),Ie=c.useCallback(_=>{i.changeFindScope(_)},[i]),Fe=c.useCallback(_=>{i.changeFindBy(_)},[i]),De=rt(s),Oe=at(s),Pe=ot(s);return c.useEffect(()=>{const _=A&&v===0;let O=null;return _&&(O=a.show({content:s.t("find-replace.dialog.no-match"),type:p.MessageType.Warning,duration:5e3})),()=>O==null?void 0:O.dispose()},[A,v,a,s]),u.jsxs(c.Fragment,{children:[u.jsx(p.FormLayout,{label:s.t("find-replace.dialog.find"),children:u.jsx(ae,{findCompleted:A,className:"univer-find-input",matchesCount:v,matchesPosition:m,findReplaceService:i,localeService:s,findString:x,onChange:Se})}),u.jsx(p.FormLayout,{label:s.t("find-replace.dialog.replace"),children:u.jsx(p.Input,{placeholder:s.t("find-replace.dialog.replace-placeholder"),value:de,onChange:_=>Ce(_)})}),u.jsx(p.FormLayout,{label:s.t("find-replace.dialog.find-direction.title"),children:u.jsx(p.Select,{value:pe,options:Oe,onChange:xe})}),u.jsx(p.FormDualColumnLayout,{children:u.jsxs(c.Fragment,{children:[u.jsx(p.FormLayout,{label:s.t("find-replace.dialog.find-scope.title"),children:u.jsx(p.Select,{value:fe,options:De,onChange:Ie})}),u.jsx(p.FormLayout,{label:s.t("find-replace.dialog.find-by.title"),children:u.jsx(p.Select,{value:_e,options:Pe,onChange:Fe})})]})}),u.jsx(p.FormDualColumnLayout,{children:u.jsxs(c.Fragment,{children:[u.jsx(p.FormLayout,{children:u.jsx(p.Checkbox,{checked:ue,onChange:_=>{i.changeCaseSensitive(_)},children:s.t("find-replace.dialog.case-sensitive")})}),u.jsx(p.FormLayout,{children:u.jsx(p.Checkbox,{checked:he,onChange:_=>{i.changeMatchesTheWholeCell(_)},children:s.t("find-replace.dialog.match-the-whole-cell")})})]})}),u.jsxs("div",{className:$.findReplaceButtonsGroup,children:[u.jsx(p.Button,{type:"primary",onClick:be,disabled:ge,children:s.t("find-replace.dialog.find")}),u.jsxs("span",{className:$.findReplaceButtonsGroupRight,children:[u.jsx(p.Button,{disabled:me,onClick:ye,children:s.t("find-replace.dialog.replace")}),u.jsx(p.Button,{disabled:ve,onClick:Me,children:s.t("find-replace.dialog.replace-all")})]})]})]})});function st(){const t=M.useDependency(R),e=M.useDependency(h.ILayoutService),n=M.useDependency(l.IContextService),i=h.useObservable(t.state$,void 0,!0),s=c.useRef(null);c.useEffect(()=>{let f;return s.current&&(f=e.registerContainerElement(s.current)),()=>f==null?void 0:f.dispose()},[e]);const r=c.useRef(null),a=c.useCallback(f=>n.setContextValue(te,f),[n]),o=c.useCallback(f=>n.setContextValue(ee,f),[n]);return c.useEffect(()=>{var g;const f=S.fromEvent(document,"focusin").subscribe(v=>{var m;v.target&&((m=s.current)!=null&&m.contains(v.target))?a(!0):a(!1),!r.current||!r.current.selectHasFocus()?o(!0):o(!1)});return(g=r.current)==null||g.focus(),a(!0),o(!0),()=>{f.unsubscribe(),a(!1)}},[a,o]),u.jsx("div",{className:$.findReplaceDialogContainer,ref:s,children:i.replaceRevealed?u.jsx(nt,{ref:r}):u.jsx(it,{ref:r})})}function rt(t){const e=t.getCurrentLocale();return c.useMemo(()=>[{label:t.t("find-replace.dialog.find-scope.current-sheet"),value:E.SUBUNIT},{label:t.t("find-replace.dialog.find-scope.workbook"),value:E.UNIT}],[e])}function at(t){const e=t.getCurrentLocale();return c.useMemo(()=>[{label:t.t("find-replace.dialog.find-direction.row"),value:P.ROW},{label:t.t("find-replace.dialog.find-direction.column"),value:P.COLUMN}],[e])}function ot(t){const e=t.getCurrentLocale();return c.useMemo(()=>[{label:t.t("find-replace.dialog.find-by.value"),value:T.VALUE},{label:t.t("find-replace.dialog.find-by.formula"),value:T.FORMULA}],[e])}function F(t){return t.getContextValue(te)}function ct(t){return t.getContextValue(ie)}function ce(t){return t.getContextValue(ee)}const L="7_find-replace-shortcuts";function q(t){return t.getContextValue(l.FOCUSING_SHEET)}function z(t){return!t.getContextValue(l.EDITOR_ACTIVATED)}const lt={id:I.id,description:"find-replace.shortcut.open-find-dialog",binding:h.KeyCode.F|h.MetaKeys.CTRL_COMMAND,group:L,preconditions(t){return!F(t)&&q(t)&&z(t)}},dt={id:I.id,description:"find-replace.shortcut.open-find-dialog",binding:h.KeyCode.F|h.MetaKeys.CTRL_COMMAND,mac:h.KeyCode.F|h.MetaKeys.MAC_CTRL,preconditions(t){return!F(t)&&q(t)&&z(t)}},ut={id:N.id,description:"find-replace.shortcut.open-replace-dialog",binding:h.KeyCode.H|h.MetaKeys.CTRL_COMMAND,mac:h.KeyCode.H|h.MetaKeys.MAC_CTRL,group:L,preconditions(t){return q(t)&&z(t)&&(!F(t)||!ct(t))}},ht={id:G.id,description:"find-replace.shortcut.go-to-next-match",binding:h.KeyCode.ENTER,group:L,priority:1e3,preconditions(t){return ce(t)&&F(t)}},pt={id:V.id,description:"find-replace.shortcut.go-to-previous-match",binding:h.KeyCode.ENTER|h.MetaKeys.SHIFT,group:L,priority:1e3,preconditions(t){return ce(t)&&F(t)}};function ft(t){const e=t.get(l.IContextService);return{id:I.id,icon:"SearchIcon",tooltip:"find-replace.toolbar",group:h.MenuGroup.TOOLBAR_OTHERS,type:h.MenuItemType.BUTTON,positions:[h.MenuPosition.TOOLBAR_START],hidden$:h.getMenuHiddenObservable(t,l.UniverInstanceType.UNIVER_SHEET),disabled$:S.combineLatest([e.subscribeContextValue$(l.EDITOR_ACTIVATED),e.subscribeContextValue$(l.FOCUSING_SHEET)]).pipe(S.map(([n,i])=>n||!i))}}var _t=Object.defineProperty,gt=Object.getOwnPropertyDescriptor,mt=(t,e,n,i)=>{for(var s=i>1?void 0:i?gt(e,n):e,r=t.length-1,a;r>=0;r--)(a=t[r])&&(s=(i?a(e,n,s):a(s))||s);return i&&s&&_t(e,n,s),s},b=(t,e)=>(n,i)=>e(n,i,t);const vt={},Y="DESKTOP_FIND_REPLACE_DIALOG",le=350,St=20,Ct=-90;exports.FindReplaceController=class extends l.RxDisposable{constructor(e,n,i,s,r,a,o,f,g,v,m){super(),this._config=e,this._univerInstanceService=n,this._menuService=i,this._shortcutService=s,this._commandService=r,this._findReplaceService=a,this._dialogService=o,this._layoutService=f,this._localeService=g,this._componentManager=v,this._injector=m,this._initCommands(),this._initUI(),this._initShortcuts()}_initCommands(){[I,N,G,V,K,H].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initShortcuts(){[ut,lt,dt,pt,ht].forEach(e=>this.disposeWithMe(this._shortcutService.registerShortcut(e)))}_initUI(){const{menu:e={}}=this._config;this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(ft),e)),this.disposeWithMe(this._componentManager.register("FindReplaceDialog",st)),this.disposeWithMe(this._componentManager.register("SearchIcon",X)),this._findReplaceService.stateUpdates$.pipe(S.takeUntil(this.dispose$)).subscribe(n=>{n.revealed===!0&&this._openPanel()}),this.disposeWithMe(this._univerInstanceService.focused$.pipe(S.takeUntil(this.dispose$)).subscribe(n=>{(!n||!this._univerInstanceService.getUniverSheetInstance(n))&&this.closePanel()}))}_openPanel(){this._dialogService.open({id:Y,draggable:!0,width:le,title:{title:this._localeService.t("find-replace.dialog.title")},children:{label:"FindReplaceDialog"},destroyOnClose:!0,defaultPosition:Rt(),preservePositionOnDestroy:!0,onClose:()=>this.closePanel()})}closePanel(){this._dialogService.close(Y),this._findReplaceService.terminate(),queueMicrotask(()=>this._layoutService.focus())}};exports.FindReplaceController=mt([l.OnLifecycle(l.LifecycleStages.Rendered,exports.FindReplaceController),b(1,l.IUniverInstanceService),b(2,h.IMenuService),b(3,h.IShortcutService),b(4,l.ICommandService),b(5,R),b(6,h.IDialogService),b(7,h.ILayoutService),b(8,y.Inject(l.LocaleService)),b(9,y.Inject(h.ComponentManager)),b(10,y.Inject(y.Injector))],exports.FindReplaceController);function Rt(){const{innerWidth:t}=window;return{x:(t-le)/2-St,y:Ct}}var bt=Object.defineProperty,yt=Object.getOwnPropertyDescriptor,Mt=(t,e,n,i)=>{for(var s=i>1?void 0:i?yt(e,n):e,r=t.length-1,a;r>=0;r--)(a=t[r])&&(s=(i?a(e,n,s):a(s))||s);return i&&s&&bt(e,n,s),s},Z=(t,e)=>(n,i)=>e(n,i,t);const xt="FIND_REPLACE_PLUGIN";var w;exports.UniverFindReplacePlugin=(w=class extends l.Plugin{constructor(e={},n,i){super(),this._config=e,this._injector=n,this._localeService=i,this._config=l.Tools.deepMerge({},vt,this._config)}onStarting(e){[[exports.FindReplaceController,{useFactory:()=>this._injector.createInstance(exports.FindReplaceController,this._config)}],[R,{useClass:W}]].forEach(n=>{e.add(n)})}},d(w,"pluginName",xt),w);exports.UniverFindReplacePlugin=Mt([Z(1,y.Inject(y.Injector)),Z(2,y.Inject(l.LocaleService))],exports.UniverFindReplacePlugin);exports.FindBy=T;exports.FindDirection=P;exports.FindModel=We;exports.FindScope=E;exports.GoToNextMatchOperation=G;exports.GoToPreviousMatchOperation=V;exports.IFindReplaceService=R;exports.OpenFindDialogOperation=I;exports.OpenReplaceDialogOperation=N;exports.ReplaceAllMatchesCommand=K;exports.ReplaceCurrentMatchCommand=H;
9
+ */var Ve=o,He=Symbol.for("react.element"),Ke=Symbol.for("react.fragment"),qe=Object.prototype.hasOwnProperty,ze=Ve.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Ye={key:!0,ref:!0,__self:!0,__source:!0};function se(i,e,n){var t,r={},s=null,a=null;n!==void 0&&(s=""+n),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(a=e.ref);for(t in e)qe.call(e,t)&&!Ye.hasOwnProperty(t)&&(r[t]=e[t]);if(i&&i.defaultProps)for(t in e=i.defaultProps,e)r[t]===void 0&&(r[t]=e[t]);return{$$typeof:He,type:i,key:s,ref:a,props:r,_owner:ze.current}}$.Fragment=Ke;$.jsx=se;$.jsxs=se;re.exports=$;var d=re.exports;const H={id:"ui.command.replace-current-match",type:c.CommandType.COMMAND,handler:i=>i.get(C).replace()},Ze="CONFIRM_REPLACE_ALL",K={id:"ui.command.replace-all-matches",type:c.CommandType.COMMAND,handler:async i=>{const e=i.get(u.IConfirmService),n=i.get(c.LocaleService),t=i.get(u.IMessageService);if(!await e.confirm({id:Ze,title:{title:n.t("find-replace.replace.confirm.title")},cancelText:n.t("button.cancel"),confirmText:n.t("button.confirm")}))return!1;const s=await i.get(C).replaceAll(),{success:a,failure:h}=s;return h>0?(a===0?t.show({type:p.MessageType.Error,content:n.t("find-replace.replace.all-failure")}):t.show({type:p.MessageType.Warning,content:n.t("find-replace.replace.partial-success",`${a}`,`${h}`)}),!1):(t.show({type:p.MessageType.Success,content:n.t("find-replace.replace.all-success",`${a}`)}),!0)}};function ae(i){const{findCompleted:e,localeService:n,matchesCount:t,matchesPosition:r,findString:s,findReplaceService:a,onChange:h,...f}=i,v=e&&t===0?n.t("find-replace.dialog.no-result"):t===0?" ":void 0;return d.jsx(p.InputWithSlot,{autoFocus:!0,placeholder:n.t("find-replace.dialog.find-placeholder"),slot:d.jsx(p.Pager,{loop:!0,text:v,value:r,total:t,onChange:m=>{r===t&&m===1?a.moveToNextMatch():r===1&&m===t||m<r?a.moveToPreviousMatch():a.moveToNextMatch()}}),value:s,onChange:m=>h==null?void 0:h(m),...f})}const Je="univer-find-replace-dialog-container",Qe="univer-find-replace-expand-container",Xe="univer-button-text",et="univer-find-replace-buttons-group",tt="univer-find-replace-buttons-group-right",N={findReplaceDialogContainer:Je,findReplaceExpandContainer:Qe,buttonText:Xe,findReplaceButtonsGroup:et,findReplaceButtonsGroupRight:tt};function oe(i,e){const n=o.useCallback(()=>{var r;(r=document.querySelector(".univer-find-input input"))==null||r.focus()},[]),t=o.useCallback(()=>{const r=document.querySelectorAll(".univer-find-replace-dialog-container .univer-select-selection-search-input");return Array.from(r).some(s=>s===document.activeElement)},[]);return o.useImperativeHandle(e,()=>({focus:n,selectHasFocus:t})),o.useEffect(()=>{const r=i.focusSignal$.subscribe(()=>n());return()=>r.unsubscribe()},[i,n]),{focus:n,selectHasFocus:t}}const it=o.forwardRef(function(e,n){const t=M.useDependency(c.LocaleService),r=M.useDependency(C),s=M.useDependency(c.ICommandService),a=u.useObservable(r.state$,void 0,!0),{findCompleted:h,findString:f,matchesCount:y,matchesPosition:v}=a,m=o.useCallback(()=>{s.executeCommand(j.id)},[s]),D=o.useCallback(I=>r.changeFindString(I),[r]);return oe(r,n),d.jsxs(o.Fragment,{children:[d.jsx(ae,{findCompleted:h,className:"univer-find-input",matchesCount:y,matchesPosition:v,findReplaceService:r,localeService:t,findString:f,onChange:D}),d.jsx("div",{className:N.findReplaceExpandContainer,children:d.jsx(p.Button,{type:"text",size:"small",onClick:m,children:t.t("find-replace.dialog.advanced-finding")})})]})}),nt=o.forwardRef(function(e,n){const t=M.useDependency(C),r=M.useDependency(c.LocaleService),s=M.useDependency(c.ICommandService),a=M.useDependency(u.IMessageService),h=u.useObservable(t.currentMatch$,void 0,!0),f=u.useObservable(t.replaceables$,void 0,!0),y=u.useObservable(t.state$,void 0,!0),{matchesCount:v,matchesPosition:m,findString:D,inputtingFindString:I,replaceString:de,caseSensitive:ue,matchesTheWholeCell:he,findDirection:pe,findScope:fe,findBy:_e,findCompleted:A}=y,ge=I.length===0,me=v===0||!(h!=null&&h.replaceable),ve=f.length===0,Se=o.useCallback(_=>t.changeInputtingFindString(_),[t]),Ce=o.useCallback(_=>t.changeReplaceString(_),[t]),{focus:Re}=oe(t,n),be=o.useCallback(()=>{D===I?t.moveToNextMatch():(t.changeFindString(I),t.find())},[D,I,t]),Me=o.useCallback(()=>s.executeCommand(H.id),[s]),ye=o.useCallback(async()=>{await s.executeCommand(K.id),Re()},[s]),Ie=o.useCallback(_=>{t.changeFindDirection(_)},[t]),xe=o.useCallback(_=>{t.changeFindScope(_)},[t]),Fe=o.useCallback(_=>{t.changeFindBy(_)},[t]),De=st(r),Te=at(r),Oe=ot(r);return o.useEffect(()=>{const _=A&&v===0;let T=null;return _&&(T=a.show({content:r.t("find-replace.dialog.no-match"),type:p.MessageType.Warning,duration:5e3})),()=>T==null?void 0:T.dispose()},[A,v,a,r]),d.jsxs(o.Fragment,{children:[d.jsx(p.FormLayout,{label:r.t("find-replace.dialog.find"),children:d.jsx(ae,{findCompleted:A,className:"univer-find-input",matchesCount:v,matchesPosition:m,findReplaceService:t,localeService:r,findString:I,onChange:Se})}),d.jsx(p.FormLayout,{label:r.t("find-replace.dialog.replace"),children:d.jsx(p.Input,{placeholder:r.t("find-replace.dialog.replace-placeholder"),value:de,onChange:_=>Ce(_)})}),d.jsx(p.FormLayout,{label:r.t("find-replace.dialog.find-direction.title"),children:d.jsx(p.Select,{value:pe,options:Te,onChange:Ie})}),d.jsx(p.FormDualColumnLayout,{children:d.jsxs(o.Fragment,{children:[d.jsx(p.FormLayout,{label:r.t("find-replace.dialog.find-scope.title"),children:d.jsx(p.Select,{value:fe,options:De,onChange:xe})}),d.jsx(p.FormLayout,{label:r.t("find-replace.dialog.find-by.title"),children:d.jsx(p.Select,{value:_e,options:Oe,onChange:Fe})})]})}),d.jsx(p.FormDualColumnLayout,{children:d.jsxs(o.Fragment,{children:[d.jsx(p.FormLayout,{children:d.jsx(p.Checkbox,{checked:ue,onChange:_=>{t.changeCaseSensitive(_)},children:r.t("find-replace.dialog.case-sensitive")})}),d.jsx(p.FormLayout,{children:d.jsx(p.Checkbox,{checked:he,onChange:_=>{t.changeMatchesTheWholeCell(_)},children:r.t("find-replace.dialog.match-the-whole-cell")})})]})}),d.jsxs("div",{className:N.findReplaceButtonsGroup,children:[d.jsx(p.Button,{type:"primary",onClick:be,disabled:ge,children:r.t("find-replace.dialog.find")}),d.jsxs("span",{className:N.findReplaceButtonsGroupRight,children:[d.jsx(p.Button,{disabled:me,onClick:Me,children:r.t("find-replace.dialog.replace")}),d.jsx(p.Button,{disabled:ve,onClick:ye,children:r.t("find-replace.dialog.replace-all")})]})]})]})});function rt(){const i=M.useDependency(C),e=M.useDependency(u.ILayoutService),n=M.useDependency(c.IContextService),t=u.useObservable(i.state$,void 0,!0),r=o.useRef(null);o.useEffect(()=>{let f;return r.current&&(f=e.registerContainerElement(r.current)),()=>f==null?void 0:f.dispose()},[e]);const s=o.useRef(null),a=o.useCallback(f=>n.setContextValue(te,f),[n]),h=o.useCallback(f=>n.setContextValue(ee,f),[n]);return o.useEffect(()=>{var y;const f=g.fromEvent(document,"focusin").subscribe(v=>{var m;v.target&&((m=r.current)!=null&&m.contains(v.target))?a(!0):a(!1),!s.current||!s.current.selectHasFocus()?h(!0):h(!1)});return(y=s.current)==null||y.focus(),a(!0),h(!0),()=>{f.unsubscribe(),a(!1)}},[a,h]),d.jsx("div",{className:N.findReplaceDialogContainer,ref:r,children:t.replaceRevealed?d.jsx(nt,{ref:s}):d.jsx(it,{ref:s})})}function st(i){const e=i.getCurrentLocale();return o.useMemo(()=>[{label:i.t("find-replace.dialog.find-scope.current-sheet"),value:E.SUBUNIT},{label:i.t("find-replace.dialog.find-scope.workbook"),value:E.UNIT}],[e])}function at(i){const e=i.getCurrentLocale();return o.useMemo(()=>[{label:i.t("find-replace.dialog.find-direction.row"),value:O.ROW},{label:i.t("find-replace.dialog.find-direction.column"),value:O.COLUMN}],[e])}function ot(i){const e=i.getCurrentLocale();return o.useMemo(()=>[{label:i.t("find-replace.dialog.find-by.value"),value:P.VALUE},{label:i.t("find-replace.dialog.find-by.formula"),value:P.FORMULA}],[e])}function F(i){return i.getContextValue(te)}function ct(i){return i.getContextValue(ie)}function ce(i){return i.getContextValue(ee)}const L="7_find-replace-shortcuts";function q(i){return i.getContextValue(c.FOCUSING_SHEET)}function z(i){return!i.getContextValue(c.EDITOR_ACTIVATED)}const lt={id:x.id,description:"find-replace.shortcut.open-find-dialog",binding:u.KeyCode.F|u.MetaKeys.CTRL_COMMAND,group:L,preconditions(i){return!F(i)&&q(i)&&z(i)}},dt={id:x.id,description:"find-replace.shortcut.open-find-dialog",binding:u.KeyCode.F|u.MetaKeys.CTRL_COMMAND,mac:u.KeyCode.F|u.MetaKeys.MAC_CTRL,preconditions(i){return!F(i)&&q(i)&&z(i)}},ut={id:j.id,description:"find-replace.shortcut.open-replace-dialog",binding:u.KeyCode.H|u.MetaKeys.CTRL_COMMAND,mac:u.KeyCode.H|u.MetaKeys.MAC_CTRL,group:L,preconditions(i){return q(i)&&z(i)&&(!F(i)||!ct(i))}},ht={id:G.id,description:"find-replace.shortcut.go-to-next-match",binding:u.KeyCode.ENTER,group:L,priority:1e3,preconditions(i){return ce(i)&&F(i)}},pt={id:V.id,description:"find-replace.shortcut.go-to-previous-match",binding:u.KeyCode.ENTER|u.MetaKeys.SHIFT,group:L,priority:1e3,preconditions(i){return ce(i)&&F(i)}};function ft(i){const e=i.get(c.IContextService);return{id:x.id,icon:"SearchIcon",tooltip:"find-replace.toolbar",group:u.MenuGroup.TOOLBAR_OTHERS,type:u.MenuItemType.BUTTON,positions:[u.MenuPosition.TOOLBAR_START],hidden$:u.getMenuHiddenObservable(i,c.UniverInstanceType.UNIVER_SHEET),disabled$:g.combineLatest([e.subscribeContextValue$(c.EDITOR_ACTIVATED),e.subscribeContextValue$(c.FOCUSING_SHEET)]).pipe(g.map(([n,t])=>n||!t))}}var _t=Object.defineProperty,gt=Object.getOwnPropertyDescriptor,mt=(i,e,n,t)=>{for(var r=t>1?void 0:t?gt(e,n):e,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(t?a(e,n,r):a(r))||r);return t&&r&&_t(e,n,r),r},R=(i,e)=>(n,t)=>e(n,t,i);const vt={},Y="DESKTOP_FIND_REPLACE_DIALOG",le=350,St=20,Ct=-90;exports.FindReplaceController=class extends c.RxDisposable{constructor(e,n,t,r,s,a,h,f,y,v,m){super(),this._config=e,this._univerInstanceService=n,this._menuService=t,this._shortcutService=r,this._commandService=s,this._findReplaceService=a,this._dialogService=h,this._layoutService=f,this._localeService=y,this._componentManager=v,this._injector=m,this._initCommands(),this._initUI(),this._initShortcuts()}_initCommands(){[x,j,G,V,K,H].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initShortcuts(){[ut,lt,dt,pt,ht].forEach(e=>this.disposeWithMe(this._shortcutService.registerShortcut(e)))}_initUI(){const{menu:e={}}=this._config;this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(ft),e)),this.disposeWithMe(this._componentManager.register("FindReplaceDialog",rt)),this.disposeWithMe(this._componentManager.register("SearchIcon",X)),this._findReplaceService.stateUpdates$.pipe(g.takeUntil(this.dispose$)).subscribe(n=>{n.revealed===!0&&this._openPanel()}),this.disposeWithMe(this._univerInstanceService.focused$.pipe(g.takeUntil(this.dispose$)).subscribe(n=>{(!n||!this._univerInstanceService.getUniverSheetInstance(n))&&this.closePanel()}))}_openPanel(){this._dialogService.open({id:Y,draggable:!0,width:le,title:{title:this._localeService.t("find-replace.dialog.title")},children:{label:"FindReplaceDialog"},destroyOnClose:!0,defaultPosition:Rt(),preservePositionOnDestroy:!0,onClose:()=>this.closePanel()})}closePanel(){this._dialogService.close(Y),this._findReplaceService.terminate(),queueMicrotask(()=>this._layoutService.focus())}};exports.FindReplaceController=mt([c.OnLifecycle(c.LifecycleStages.Rendered,exports.FindReplaceController),R(1,c.IUniverInstanceService),R(2,u.IMenuService),R(3,u.IShortcutService),R(4,c.ICommandService),R(5,C),R(6,u.IDialogService),R(7,u.ILayoutService),R(8,b.Inject(c.LocaleService)),R(9,b.Inject(u.ComponentManager)),R(10,b.Inject(b.Injector))],exports.FindReplaceController);function Rt(){const{innerWidth:i}=window;return{x:(i-le)/2-St,y:Ct}}var bt=Object.defineProperty,Mt=Object.getOwnPropertyDescriptor,yt=(i,e,n,t)=>{for(var r=t>1?void 0:t?Mt(e,n):e,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(t?a(e,n,r):a(r))||r);return t&&r&&bt(e,n,r),r},Z=(i,e)=>(n,t)=>e(n,t,i);const It="FIND_REPLACE_PLUGIN";var w;exports.UniverFindReplacePlugin=(w=class extends c.Plugin{constructor(e={},n,t){super(),this._config=e,this._injector=n,this._localeService=t,this._config=c.Tools.deepMerge({},vt,this._config)}onStarting(e){[[exports.FindReplaceController,{useFactory:()=>this._injector.createInstance(exports.FindReplaceController,this._config)}],[C,{useClass:k}]].forEach(n=>{e.add(n)})}},l(w,"pluginName",It),w);exports.UniverFindReplacePlugin=yt([Z(1,b.Inject(b.Injector)),Z(2,b.Inject(c.LocaleService))],exports.UniverFindReplacePlugin);exports.FindBy=P;exports.FindDirection=O;exports.FindModel=ke;exports.FindScope=E;exports.GoToNextMatchOperation=G;exports.GoToPreviousMatchOperation=V;exports.IFindReplaceService=C;exports.OpenFindDialogOperation=x;exports.OpenReplaceDialogOperation=j;exports.ReplaceAllMatchesCommand=K;exports.ReplaceCurrentMatchCommand=H;