@univerjs/find-replace 0.3.0-alpha.1 → 0.3.0-nightly.202410101606

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,9 +1 @@
1
- "use strict";var __defProp=Object.defineProperty;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __publicField=(obj,key,value)=>__defNormalProp(obj,typeof key!="symbol"?key+"":key,value);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@univerjs/core"),ui=require("@univerjs/ui"),rxjs=require("rxjs"),engineRender=require("@univerjs/engine-render"),require$$0=require("react"),design=require("@univerjs/design");var __assign=function(){return __assign=Object.assign||function(t){for(var s,i=1,n2=arguments.length;i<n2;i++){s=arguments[i];for(var p2 in s)Object.prototype.hasOwnProperty.call(s,p2)&&(t[p2]=s[p2])}return t},__assign.apply(this,arguments)},__rest=function(s,e){var t={};for(var p2 in s)Object.prototype.hasOwnProperty.call(s,p2)&&e.indexOf(p2)<0&&(t[p2]=s[p2]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,p2=Object.getOwnPropertySymbols(s);i<p2.length;i++)e.indexOf(p2[i])<0&&Object.prototype.propertyIsEnumerable.call(s,p2[i])&&(t[p2[i]]=s[p2[i]]);return t},IconBase=require$$0.forwardRef(function(props,ref){var icon=props.icon,id=props.id,className=props.className,extend=props.extend,restProps=__rest(props,["icon","id","className","extend"]),cls="univerjs-icon univerjs-icon-".concat(id," ").concat(className||"").trim(),idSuffix=require$$0.useRef("_".concat(generateShortUuid()));return render(icon,"".concat(id),{defIds:icon.defIds,idSuffix:idSuffix.current},__assign({ref,className:cls},restProps),extend)});function render(node,id,runtimeProps,rootProps,extend){return require$$0.createElement(node.tag,__assign(__assign({key:id},replaceRuntimeIdsAndExtInAttrs(node,runtimeProps,extend)),rootProps),(replaceRuntimeIdsInDefs(node,runtimeProps).children||[]).map(function(child,index){return render(child,"".concat(id,"-").concat(node.tag,"-").concat(index),runtimeProps,void 0,extend)}))}__name(render,"render");function replaceRuntimeIdsAndExtInAttrs(node,runtimeProps,extend){var attrs=__assign({},node.attrs);extend!=null&&extend.colorChannel1&&attrs.fill==="colorChannel1"&&(attrs.fill=extend.colorChannel1);var defIds=runtimeProps.defIds;return!defIds||defIds.length===0||(node.tag==="use"&&attrs["xlink:href"]&&(attrs["xlink:href"]=attrs["xlink:href"]+runtimeProps.idSuffix),Object.entries(attrs).forEach(function(_a5){var key=_a5[0],value=_a5[1];typeof value=="string"&&(attrs[key]=value.replace(/url\(#(.*)\)/,"url(#$1".concat(runtimeProps.idSuffix,")")))})),attrs}__name(replaceRuntimeIdsAndExtInAttrs,"replaceRuntimeIdsAndExtInAttrs");function replaceRuntimeIdsInDefs(node,runtimeProps){var _a5,defIds=runtimeProps.defIds;return!defIds||defIds.length===0?node:node.tag==="defs"&&(!((_a5=node.children)===null||_a5===void 0)&&_a5.length)?__assign(__assign({},node),{children:node.children.map(function(child){return typeof child.attrs.id=="string"&&defIds&&defIds.indexOf(child.attrs.id)>-1?__assign(__assign({},child),{attrs:__assign(__assign({},child.attrs),{id:child.attrs.id+runtimeProps.idSuffix})}):child})}):node}__name(replaceRuntimeIdsInDefs,"replaceRuntimeIdsInDefs");function generateShortUuid(){return Math.random().toString(36).substring(2,8)}__name(generateShortUuid,"generateShortUuid");IconBase.displayName="UniverIcon";var element={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"}}]}]},SearchSingle16=require$$0.forwardRef(function(props,ref){return require$$0.createElement(IconBase,Object.assign({},props,{id:"search-single-16",ref,icon:element}))});SearchSingle16.displayName="SearchSingle16";const FIND_REPLACE_INPUT_FOCUS="FIND_REPLACE_INPUT_FOCUS",FIND_REPLACE_DIALOG_FOCUS="FIND_REPLACE_DIALOG_FOCUS",FIND_REPLACE_REPLACE_REVEALED="FIND_REPLACE_REPLACE_REVEALED";var __defProp$2=Object.defineProperty,__getOwnPropDesc$2=Object.getOwnPropertyDescriptor,__decorateClass$2=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$2(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$2(target,key,result),result},"__decorateClass$2"),__decorateParam$2=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$2");const _FindModel=class _FindModel extends core.Disposable{};__name(_FindModel,"FindModel");let FindModel=_FindModel;const IFindReplaceService=core.createIdentifier("find-replace.service");function shouldStateUpdateTriggerResearch(statusUpdate){return typeof statusUpdate.findString<"u"||typeof statusUpdate.inputtingFindString<"u"||typeof statusUpdate.findDirection<"u"||typeof statusUpdate.matchesTheWholeCell<"u"||typeof statusUpdate.caseSensitive<"u"||typeof statusUpdate.findScope<"u"||typeof statusUpdate.findBy<"u"}__name(shouldStateUpdateTriggerResearch,"shouldStateUpdateTriggerResearch");var _a;let FindReplaceModel=(_a=class extends core.Disposable{constructor(_state,_providers,_univerInstanceService){super();__publicField(this,"currentMatch$",new rxjs.BehaviorSubject(null));__publicField(this,"replaceables$",new rxjs.BehaviorSubject([]));__publicField(this,"_findModels",[]);__publicField(this,"_matchingModel",null);__publicField(this,"_matches",[]);__publicField(this,"_currentSearchingDisposables",null);this._state=_state,this._providers=_providers,this._univerInstanceService=_univerInstanceService,this.disposeWithMe(this._state.stateUpdates$.pipe(rxjs.throttleTime(200,void 0,{leading:!0,trailing:!0})).subscribe(async stateUpdate=>{const state=this._state.state;shouldStateUpdateTriggerResearch(stateUpdate)&&(state.findString!==""&&!state.replaceRevealed?(await this._startSearching(),this._state.changeState({findCompleted:!0})):stateUpdate.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({...createInitFindReplaceState(),revealed:!1})}async start(){if(!this._state.findString)return{results:[]};const complete=await this._startSearching();return this._state.changeState({findCompleted:!0}),complete}async _startSearching(){if(!this._state.findString)return{results:[]};const providers=Array.from(this._providers),findModels=this._findModels=(await Promise.all(providers.map(provider=>provider.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(findModels);const newMatches=this._matches=findModels.map(c=>c.getMatches()).flat();return this.replaceables$.next(newMatches.filter(m2=>m2.replaceable)),newMatches.length?(this._moveToInitialMatch(findModels),this._state.changeState({matchesCount:newMatches.length}),{results:newMatches}):(this._state.changeState({matchesCount:0,matchesPosition:0}),{results:[]})}_stopSearching(){var _a5;this._providers.forEach(provider=>provider.terminate()),this._findModels=[],this._matches=[],this._matchingModel=null,(_a5=this._currentSearchingDisposables)==null||_a5.dispose(),this._currentSearchingDisposables=null,this.currentMatch$.next(null),this.replaceables$.next([]),this._state.changeState({findCompleted:!1,matchesCount:0,matchesPosition:0})}_subscribeToModelsChanges(models){const disposables=this._currentSearchingDisposables=new core.DisposableCollection,matchesUpdateSubscription=rxjs.combineLatest(models.map(model=>model.matchesUpdate$)).pipe(rxjs.debounceTime(220)).subscribe(([...allMatches])=>{const newMatches=this._matches=allMatches.flat();newMatches.length?(this._moveToInitialMatch(this._findModels,!0),this._state.changeState({matchesCount:newMatches.length}),this.replaceables$.next(newMatches.filter(m2=>m2.replaceable))):(this._state.changeState({matchesCount:0,matchesPosition:0}),this.replaceables$.next([]))});models.forEach(model=>disposables.add(core.toDisposable(model.activelyChangingMatch$.subscribe(match=>{const index=this._matches.findIndex(m2=>m2===match);this._state.changeState({matchesPosition:index+1})})))),disposables.add(core.toDisposable(matchesUpdateSubscription))}async replace(){return this._matchingModel?this._matchingModel.replace(this._state.replaceString):!1}async replaceAll(){const result=await Promise.all(this._findModels.map(m2=>m2.replaceAll(this._state.replaceString))).then(results=>results.reduce((acc,cur)=>(acc.success+=cur.success,acc.failure+=cur.failure,acc),{success:0,failure:0}));return result.failure===0&&this._stopSearching(),result}getCurrentMatch(){return this._state.matchesPosition>0?this._matches[this._state.matchesPosition-1]:null}_markMatch(match){const index=this._matches.findIndex(value=>value===match);this.currentMatch$.next(match),this._state.changeState({matchesPosition:index+1})}moveToNextMatch(){if(!this._matchingModel)return;const loopInCurrentUnit=this._findModels.length===1,nextMatch=this._matchingModel.moveToNextMatch({loop:loopInCurrentUnit});if(nextMatch)this._markMatch(nextMatch);else{const currentModelIndex=this._findModels.findIndex(m2=>m2===this._matchingModel);this._moveToNextUnitMatch(currentModelIndex)}}_moveToNextUnitMatch(startingIndex){const l2=this._findModels.length;for(let i=(startingIndex+1)%l2;i!==startingIndex;){const nextPositionModel=this._findModels[i],nextMatch=nextPositionModel.moveToNextMatch({ignoreSelection:!0});if(nextMatch){this._matchingModel=nextPositionModel,this._markMatch(nextMatch);return}i=(i+1)%l2}if(this._matchingModel){const nextMatch=this._matchingModel.moveToNextMatch({ignoreSelection:!0});nextMatch&&this._markMatch(nextMatch)}}moveToPreviousMatch(){if(!this._matchingModel)return;const loopInCurrentUnit=this._findModels.length===1,nextMatch=this._matchingModel.moveToPreviousMatch({loop:loopInCurrentUnit});if(nextMatch){const index=this._matches.findIndex(value=>value===nextMatch);this.currentMatch$.next(nextMatch),this._state.changeState({matchesPosition:index+1})}else{const l2=this._findModels.length,currentModelIndex=this._findModels.findIndex(m2=>m2===this._matchingModel);for(let i=(currentModelIndex-1+l2)%l2;i!==currentModelIndex;){const nextPositionModel=this._findModels[i],nextMatch3=nextPositionModel.moveToPreviousMatch({ignoreSelection:!0});if(nextMatch3){this._matchingModel=nextPositionModel,this._markMatch(nextMatch3);return}i=(i-1)%l2}const nextMatch2=this._matchingModel.moveToPreviousMatch({ignoreSelection:!0});nextMatch2&&this._markMatch(nextMatch2)}}_moveToInitialMatch(findModels,noFocus=!1){var _a5;const focusedUnitId=(_a5=this._univerInstanceService.getFocusedUnit())==null?void 0:_a5.getUnitId();if(!focusedUnitId)return-1;const i=findModels.findIndex(model=>model.unitId===focusedUnitId);if(i!==-1){this._matchingModel=findModels[i];const nextMatch=this._matchingModel.moveToNextMatch({stayIfOnMatch:!0,noFocus});if(nextMatch)return this._markMatch(nextMatch),i}return this._moveToNextUnitMatch(i),0}},__name(_a,"FindReplaceModel"),_a);FindReplaceModel=__decorateClass$2([__decorateParam$2(2,core.IUniverInstanceService)],FindReplaceModel);var FindDirection=(FindDirection2=>(FindDirection2.ROW="row",FindDirection2.COLUMN="column",FindDirection2))(FindDirection||{}),FindBy=(FindBy2=>(FindBy2.VALUE="value",FindBy2.FORMULA="formula",FindBy2))(FindBy||{}),FindScope=(FindScope2=>(FindScope2.SUBUNIT="subunit",FindScope2.UNIT="unit",FindScope2))(FindScope||{});function createInitFindReplaceState(){return{caseSensitive:!1,findBy:"value",findCompleted:!1,findDirection:"row",findScope:"subunit",findString:"",inputtingFindString:"",matchesCount:0,matchesPosition:0,matchesTheWholeCell:!1,replaceRevealed:!1,replaceString:"",revealed:!0}}__name(createInitFindReplaceState,"createInitFindReplaceState");const _FindReplaceState=class _FindReplaceState{constructor(){__publicField(this,"_stateUpdates$",new rxjs.Subject);__publicField(this,"stateUpdates$",this._stateUpdates$.asObservable());__publicField(this,"_state$",new rxjs.BehaviorSubject(createInitFindReplaceState()));__publicField(this,"state$",this._state$.asObservable());__publicField(this,"_findString","");__publicField(this,"_inputtingFindString","");__publicField(this,"_replaceString","");__publicField(this,"_revealed",!1);__publicField(this,"_replaceRevealed",!1);__publicField(this,"_matchesPosition",0);__publicField(this,"_matchesCount",0);__publicField(this,"_caseSensitive",!0);__publicField(this,"_matchesTheWholeCell",!1);__publicField(this,"_findDirection","row");__publicField(this,"_findScope","subunit");__publicField(this,"_findBy","value");__publicField(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(changes){let changed=!1;const changedState={};typeof changes.findString<"u"&&changes.findString!==this._findString&&(this._findString=changes.findString,changedState.findString=this._findString,changed=!0),typeof changes.revealed<"u"&&changes.revealed!==this._revealed&&(this._revealed=changes.revealed,changedState.revealed=changes.revealed,changed=!0),typeof changes.replaceRevealed<"u"&&changes.replaceRevealed!==this._replaceRevealed&&(this._replaceRevealed=changes.replaceRevealed,changedState.replaceRevealed=changes.replaceRevealed,changed=!0),typeof changes.replaceString<"u"&&changes.replaceString!==this._replaceString&&(this._replaceString=changes.replaceString,changedState.replaceString=changes.replaceString,changed=!0),typeof changes.matchesCount<"u"&&changes.matchesCount!==this._matchesCount&&(this._matchesCount=changes.matchesCount,changedState.matchesCount=changes.matchesCount,changed=!0),typeof changes.matchesPosition<"u"&&changes.matchesPosition!==this._matchesPosition&&(this._matchesPosition=changes.matchesPosition,changedState.matchesPosition=changes.matchesPosition,changed=!0),typeof changes.findBy<"u"&&changes.findBy!==this._findBy&&(this._findBy=changes.findBy,changedState.findBy=changes.findBy,changed=!0),typeof changes.findScope<"u"&&changes.findScope!==this._findScope&&(this._findScope=changes.findScope,changedState.findScope=changes.findScope,changed=!0),typeof changes.findDirection<"u"&&changes.findDirection!==this._findDirection&&(this._findDirection=changes.findDirection,changedState.findDirection=changes.findDirection,changed=!0),typeof changes.caseSensitive<"u"&&changes.caseSensitive!==this._caseSensitive&&(this._caseSensitive=changes.caseSensitive,changedState.caseSensitive=changes.caseSensitive,changed=!0),typeof changes.matchesTheWholeCell<"u"&&changes.matchesTheWholeCell!==this._matchesTheWholeCell&&(this._matchesTheWholeCell=changes.matchesTheWholeCell,changedState.matchesTheWholeCell=changes.matchesTheWholeCell,changed=!0),typeof changes.inputtingFindString<"u"&&changes.inputtingFindString!==this._inputtingFindString&&(this._inputtingFindString=changes.inputtingFindString,changedState.inputtingFindString=changes.inputtingFindString,changed=!0),typeof changes.findCompleted<"u"&&changes.findCompleted!==this._findCompleted&&(this._findCompleted=changes.findCompleted,changedState.findCompleted=changes.findCompleted,changed=!0),changed&&(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(changedState))}};__name(_FindReplaceState,"FindReplaceState");let FindReplaceState=_FindReplaceState;var _a2;let FindReplaceService=(_a2=class extends core.Disposable{constructor(_injector,_contextService){super();__publicField(this,"_providers",new Set);__publicField(this,"_state",new FindReplaceState);__publicField(this,"_model");__publicField(this,"_currentMatch$",new rxjs.BehaviorSubject(null));__publicField(this,"currentMatch$",this._currentMatch$.asObservable());__publicField(this,"_replaceables$",new rxjs.BehaviorSubject([]));__publicField(this,"replaceables$",this._replaceables$.asObservable());__publicField(this,"_focusSignal$",new rxjs.Subject);__publicField(this,"focusSignal$",this._focusSignal$.asObservable());this._injector=_injector,this._contextService=_contextService}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 _a5;return(_a5=this._model)==null?void 0:_a5.getCurrentMatch()}getFindString(){return this._state.findString}changeFindString(findString){this._state.changeState({findString})}focusFindInput(){this._focusSignal$.next()}changeInputtingFindString(value){value?this._state.changeState({inputtingFindString:value}):this._state.changeState({inputtingFindString:"",findString:""})}changeReplaceString(replaceString){this._state.changeState({replaceString})}changeMatchesTheWholeCell(matchesTheWholeCell){this._state.changeState({matchesTheWholeCell})}changeCaseSensitive(caseSensitive){this._state.changeState({caseSensitive})}changeFindBy(findBy){this._state.changeState({findBy}),this._toggleDisplayRawFormula(findBy==="formula")}changeFindScope(scope){this._state.changeState({findScope:scope})}changeFindDirection(direction){this._state.changeState({findDirection:direction})}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(revealReplace=!1){if(this._providers.size===0)return!1;this._model=this._injector.createInstance(FindReplaceModel,this._state,this._providers),this._model.currentMatch$.subscribe(match=>this._currentMatch$.next(match)),this._model.replaceables$.subscribe(replaceables=>this._replaceables$.next(replaceables));const newState=createInitFindReplaceState();return revealReplace&&(newState.replaceRevealed=!0),this._state.changeState(newState),this._toggleRevealReplace(revealReplace),!0}find(){var _a5;(_a5=this._model)==null||_a5.start()}terminate(){var _a5;(_a5=this._model)==null||_a5.dispose(),this._model=null,this._toggleDisplayRawFormula(!1),this._toggleRevealReplace(!1)}registerFindReplaceProvider(provider){return this._providers.add(provider),core.toDisposable(()=>this._providers.delete(provider))}_toggleRevealReplace(revealReplace){this._contextService.setContextValue(FIND_REPLACE_REPLACE_REVEALED,revealReplace)}_toggleDisplayRawFormula(force){this._contextService.setContextValue(engineRender.RENDER_RAW_FORMULA_KEY,force)}},__name(_a2,"FindReplaceService"),_a2);FindReplaceService=__decorateClass$2([__decorateParam$2(0,core.Inject(core.Injector)),__decorateParam$2(1,core.IContextService)],FindReplaceService);const OpenFindDialogOperation={id:"ui.operation.open-find-dialog",type:core.CommandType.OPERATION,handler:__name(accessor=>{const findReplaceService=accessor.get(IFindReplaceService);return findReplaceService.revealed?findReplaceService.focusFindInput():findReplaceService.start(),!0},"handler")},OpenReplaceDialogOperation={id:"ui.operation.open-replace-dialog",type:core.CommandType.OPERATION,handler:__name(accessor=>{const findReplaceService=accessor.get(IFindReplaceService);return findReplaceService.revealed?findReplaceService.replaceRevealed?findReplaceService.focusFindInput():findReplaceService.revealReplace():findReplaceService.start(!0),!0},"handler")},GoToNextMatchOperation={type:core.CommandType.OPERATION,id:"ui.operation.go-to-next-match",handler:__name(accessor=>(accessor.get(IFindReplaceService).moveToNextMatch(),!0),"handler")},GoToPreviousMatchOperation={type:core.CommandType.OPERATION,id:"ui.operation.go-to-previous-match",handler:__name(accessor=>(accessor.get(IFindReplaceService).moveToPreviousMatch(),!0),"handler")};var jsxRuntime={exports:{}},reactJsxRuntime_production_min={};/**
2
- * @license React
3
- * react-jsx-runtime.production.min.js
4
- *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var f=require$$0,k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};function q(c,a,g){var b,d={},e=null,h=null;g!==void 0&&(e=""+g),a.key!==void 0&&(e=""+a.key),a.ref!==void 0&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)d[b]===void 0&&(d[b]=a[b]);return{$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}__name(q,"q");reactJsxRuntime_production_min.Fragment=l;reactJsxRuntime_production_min.jsx=q;reactJsxRuntime_production_min.jsxs=q;jsxRuntime.exports=reactJsxRuntime_production_min;var jsxRuntimeExports=jsxRuntime.exports;const ReplaceCurrentMatchCommand={id:"ui.command.replace-current-match",type:core.CommandType.COMMAND,handler:__name(accessor=>accessor.get(IFindReplaceService).replace(),"handler")},CONFIRM_REPLACE_ALL_ID="CONFIRM_REPLACE_ALL",ReplaceAllMatchesCommand={id:"ui.command.replace-all-matches",type:core.CommandType.COMMAND,handler:__name(async accessor=>{const confirmService=accessor.get(ui.IConfirmService),localeService=accessor.get(core.LocaleService),messageService=accessor.get(ui.IMessageService);if(!await confirmService.confirm({id:CONFIRM_REPLACE_ALL_ID,title:{title:localeService.t("find-replace.replace.confirm.title")},cancelText:localeService.t("button.cancel"),confirmText:localeService.t("button.confirm")}))return!1;const result=await accessor.get(IFindReplaceService).replaceAll(),{success,failure}=result;return failure>0?(success===0?messageService.show({type:design.MessageType.Error,content:localeService.t("find-replace.replace.all-failure")}):messageService.show({type:design.MessageType.Warning,content:localeService.t("find-replace.replace.partial-success",`${success}`,`${failure}`)}),!1):(messageService.show({type:design.MessageType.Success,content:localeService.t("find-replace.replace.all-success",`${success}`)}),!0)},"handler")};function SearchInput(props){const{findCompleted:findComplete,localeService,matchesCount,matchesPosition,findString,findReplaceService,onChange,...rest}=props,text=findComplete&&matchesCount===0?localeService.t("find-replace.dialog.no-result"):matchesCount===0?" ":void 0;return jsxRuntimeExports.jsx(design.InputWithSlot,{autoFocus:!0,placeholder:localeService.t("find-replace.dialog.find-placeholder"),slot:jsxRuntimeExports.jsx(design.Pager,{loop:!0,text,value:matchesPosition,total:matchesCount,onChange:__name(newIndex=>{matchesPosition===matchesCount&&newIndex===1?findReplaceService.moveToNextMatch():matchesPosition===1&&newIndex===matchesCount||newIndex<matchesPosition?findReplaceService.moveToPreviousMatch():findReplaceService.moveToNextMatch()},"onChange")}),value:findString,onChange:__name(value=>onChange==null?void 0:onChange(value),"onChange"),...rest})}__name(SearchInput,"SearchInput");const findReplaceDialogContainer="univer-find-replace-dialog-container",findReplaceExpandContainer="univer-find-replace-expand-container",buttonText="univer-button-text",findReplaceButtonsGroup="univer-find-replace-buttons-group",findReplaceButtonsGroupRight="univer-find-replace-buttons-group-right",styles={findReplaceDialogContainer,findReplaceExpandContainer,buttonText,findReplaceButtonsGroup,findReplaceButtonsGroupRight};function useFindInputFocus(findReplaceService,ref){const focus=require$$0.useCallback(()=>{var _a5;(_a5=document.querySelector(".univer-find-input input"))==null||_a5.focus()},[]),selectHasFocus=require$$0.useCallback(()=>{const allInputs=document.querySelectorAll(".univer-find-replace-dialog-container .univer-select-selection-search-input");return Array.from(allInputs).some(input=>input===document.activeElement)},[]);return require$$0.useImperativeHandle(ref,()=>({focus,selectHasFocus})),require$$0.useEffect(()=>{const subscription=findReplaceService.focusSignal$.subscribe(()=>focus());return()=>subscription.unsubscribe()},[findReplaceService,focus]),{focus,selectHasFocus}}__name(useFindInputFocus,"useFindInputFocus");const FindDialog=require$$0.forwardRef(__name(function(_props,ref){const localeService=core.useDependency(core.LocaleService),findReplaceService=core.useDependency(IFindReplaceService),commandService=core.useDependency(core.ICommandService),state=ui.useObservable(findReplaceService.state$,void 0,!0),{findCompleted,findString,matchesCount,matchesPosition}=state,revealReplace=require$$0.useCallback(()=>{commandService.executeCommand(OpenReplaceDialogOperation.id)},[commandService]),onFindStringChange=require$$0.useCallback(findString2=>findReplaceService.changeFindString(findString2),[findReplaceService]);return useFindInputFocus(findReplaceService,ref),jsxRuntimeExports.jsxs(require$$0.Fragment,{children:[jsxRuntimeExports.jsx(SearchInput,{findCompleted,className:"univer-find-input",matchesCount,matchesPosition,findReplaceService,localeService,findString,onChange:onFindStringChange}),jsxRuntimeExports.jsx("div",{className:styles.findReplaceExpandContainer,children:jsxRuntimeExports.jsx(design.Button,{type:"text",size:"small",onClick:revealReplace,children:localeService.t("find-replace.dialog.advanced-finding")})})]})},"FindDialogImpl")),ReplaceDialog=require$$0.forwardRef(__name(function(_props,ref){const findReplaceService=core.useDependency(IFindReplaceService),localeService=core.useDependency(core.LocaleService),commandService=core.useDependency(core.ICommandService),messageService=core.useDependency(ui.IMessageService),currentMatch=ui.useObservable(findReplaceService.currentMatch$,void 0,!0),replaceables=ui.useObservable(findReplaceService.replaceables$,void 0,!0),state=ui.useObservable(findReplaceService.state$,void 0,!0),{matchesCount,matchesPosition,findString,inputtingFindString,replaceString,caseSensitive,matchesTheWholeCell,findDirection,findScope,findBy,findCompleted}=state,findDisabled=inputtingFindString.length===0,replaceDisabled=matchesCount===0||!(currentMatch!=null&&currentMatch.replaceable),replaceAllDisabled=replaceables.length===0,onFindStringChange=require$$0.useCallback(newValue=>findReplaceService.changeInputtingFindString(newValue),[findReplaceService]),onReplaceStringChange=require$$0.useCallback(replaceString2=>findReplaceService.changeReplaceString(replaceString2),[findReplaceService]),{focus}=useFindInputFocus(findReplaceService,ref),onClickFindButton=require$$0.useCallback(()=>{findString===inputtingFindString?findReplaceService.moveToNextMatch():(findReplaceService.changeFindString(inputtingFindString),findReplaceService.find())},[findString,inputtingFindString,findReplaceService]),onClickReplaceButton=require$$0.useCallback(()=>commandService.executeCommand(ReplaceCurrentMatchCommand.id),[commandService]),onClickReplaceAllButton=require$$0.useCallback(async()=>{await commandService.executeCommand(ReplaceAllMatchesCommand.id),focus()},[commandService]),onChangeFindDirection=require$$0.useCallback(findDirection2=>{findReplaceService.changeFindDirection(findDirection2)},[findReplaceService]),onChangeFindScope=require$$0.useCallback(findScope2=>{findReplaceService.changeFindScope(findScope2)},[findReplaceService]),onChangeFindBy=require$$0.useCallback(findBy2=>{findReplaceService.changeFindBy(findBy2)},[findReplaceService]),findScopeOptions=useFindScopeOptions(localeService),findDirectionOptions=useFindDirectionOptions(localeService),findByOptions=useFindByOptions(localeService);return require$$0.useEffect(()=>{const shouldDisplayNoMatchInfo=findCompleted&&matchesCount===0;let messageDisposable=null;return shouldDisplayNoMatchInfo&&(messageDisposable=messageService.show({content:localeService.t("find-replace.dialog.no-match"),type:design.MessageType.Warning,duration:5e3})),()=>messageDisposable==null?void 0:messageDisposable.dispose()},[findCompleted,matchesCount,messageService,localeService]),jsxRuntimeExports.jsxs(require$$0.Fragment,{children:[jsxRuntimeExports.jsx(design.FormLayout,{label:localeService.t("find-replace.dialog.find"),children:jsxRuntimeExports.jsx(SearchInput,{findCompleted,className:"univer-find-input",matchesCount,matchesPosition,findReplaceService,localeService,findString:inputtingFindString,onChange:onFindStringChange})}),jsxRuntimeExports.jsx(design.FormLayout,{label:localeService.t("find-replace.dialog.replace"),children:jsxRuntimeExports.jsx(design.Input,{placeholder:localeService.t("find-replace.dialog.replace-placeholder"),value:replaceString,onChange:__name(value=>onReplaceStringChange(value),"onChange")})}),jsxRuntimeExports.jsx(design.FormLayout,{label:localeService.t("find-replace.dialog.find-direction.title"),children:jsxRuntimeExports.jsx(design.Select,{value:findDirection,options:findDirectionOptions,onChange:onChangeFindDirection})}),jsxRuntimeExports.jsx(design.FormDualColumnLayout,{children:jsxRuntimeExports.jsxs(require$$0.Fragment,{children:[jsxRuntimeExports.jsx(design.FormLayout,{label:localeService.t("find-replace.dialog.find-scope.title"),children:jsxRuntimeExports.jsx(design.Select,{value:findScope,options:findScopeOptions,onChange:onChangeFindScope})}),jsxRuntimeExports.jsx(design.FormLayout,{label:localeService.t("find-replace.dialog.find-by.title"),children:jsxRuntimeExports.jsx(design.Select,{value:findBy,options:findByOptions,onChange:onChangeFindBy})})]})}),jsxRuntimeExports.jsx(design.FormDualColumnLayout,{children:jsxRuntimeExports.jsxs(require$$0.Fragment,{children:[jsxRuntimeExports.jsx(design.FormLayout,{children:jsxRuntimeExports.jsx(design.Checkbox,{checked:caseSensitive,onChange:__name(checked=>{findReplaceService.changeCaseSensitive(checked)},"onChange"),children:localeService.t("find-replace.dialog.case-sensitive")})}),jsxRuntimeExports.jsx(design.FormLayout,{children:jsxRuntimeExports.jsx(design.Checkbox,{checked:matchesTheWholeCell,onChange:__name(checked=>{findReplaceService.changeMatchesTheWholeCell(checked)},"onChange"),children:localeService.t("find-replace.dialog.match-the-whole-cell")})})]})}),jsxRuntimeExports.jsxs("div",{className:styles.findReplaceButtonsGroup,children:[jsxRuntimeExports.jsx(design.Button,{type:"primary",onClick:onClickFindButton,disabled:findDisabled,children:localeService.t("find-replace.dialog.find")}),jsxRuntimeExports.jsxs("span",{className:styles.findReplaceButtonsGroupRight,children:[jsxRuntimeExports.jsx(design.Button,{disabled:replaceDisabled,onClick:onClickReplaceButton,children:localeService.t("find-replace.dialog.replace")}),jsxRuntimeExports.jsx(design.Button,{disabled:replaceAllDisabled,onClick:onClickReplaceAllButton,children:localeService.t("find-replace.dialog.replace-all")})]})]})]})},"ReplaceDIalogImpl"));function FindReplaceDialog(){const findReplaceService=core.useDependency(IFindReplaceService),layoutService=core.useDependency(ui.ILayoutService),contextService=core.useDependency(core.IContextService),state=ui.useObservable(findReplaceService.state$,void 0,!0),dialogContainerRef=require$$0.useRef(null);require$$0.useEffect(()=>{let disposable;return dialogContainerRef.current&&(disposable=layoutService.registerContainerElement(dialogContainerRef.current)),()=>disposable==null?void 0:disposable.dispose()},[layoutService]);const focusRef=require$$0.useRef(null),setDialogContainerFocus=require$$0.useCallback(focused=>contextService.setContextValue(FIND_REPLACE_DIALOG_FOCUS,focused),[contextService]),setDialogInputFocus=require$$0.useCallback(focused=>contextService.setContextValue(FIND_REPLACE_INPUT_FOCUS,focused),[contextService]);return require$$0.useEffect(()=>{var _a5;const focusSubscription=rxjs.fromEvent(document,"focusin").subscribe(event=>{var _a6;event.target&&((_a6=dialogContainerRef.current)!=null&&_a6.contains(event.target))?setDialogContainerFocus(!0):setDialogContainerFocus(!1),!focusRef.current||!focusRef.current.selectHasFocus()?setDialogInputFocus(!0):setDialogInputFocus(!1)});return(_a5=focusRef.current)==null||_a5.focus(),setDialogContainerFocus(!0),setDialogInputFocus(!0),()=>{focusSubscription.unsubscribe(),setDialogContainerFocus(!1)}},[setDialogContainerFocus,setDialogInputFocus]),jsxRuntimeExports.jsx("div",{className:styles.findReplaceDialogContainer,ref:dialogContainerRef,children:state.replaceRevealed?jsxRuntimeExports.jsx(ReplaceDialog,{ref:focusRef}):jsxRuntimeExports.jsx(FindDialog,{ref:focusRef})})}__name(FindReplaceDialog,"FindReplaceDialog");function useFindScopeOptions(localeService){const locale=localeService.getCurrentLocale();return require$$0.useMemo(()=>[{label:localeService.t("find-replace.dialog.find-scope.current-sheet"),value:FindScope.SUBUNIT},{label:localeService.t("find-replace.dialog.find-scope.workbook"),value:FindScope.UNIT}],[locale])}__name(useFindScopeOptions,"useFindScopeOptions");function useFindDirectionOptions(localeService){const locale=localeService.getCurrentLocale();return require$$0.useMemo(()=>[{label:localeService.t("find-replace.dialog.find-direction.row"),value:FindDirection.ROW},{label:localeService.t("find-replace.dialog.find-direction.column"),value:FindDirection.COLUMN}],[locale])}__name(useFindDirectionOptions,"useFindDirectionOptions");function useFindByOptions(localeService){const locale=localeService.getCurrentLocale();return require$$0.useMemo(()=>[{label:localeService.t("find-replace.dialog.find-by.value"),value:FindBy.VALUE},{label:localeService.t("find-replace.dialog.find-by.formula"),value:FindBy.FORMULA}],[locale])}__name(useFindByOptions,"useFindByOptions");function whenFindReplaceDialogFocused(contextService){return contextService.getContextValue(FIND_REPLACE_DIALOG_FOCUS)}__name(whenFindReplaceDialogFocused,"whenFindReplaceDialogFocused");function whenReplaceRevealed(contextService){return contextService.getContextValue(FIND_REPLACE_REPLACE_REVEALED)}__name(whenReplaceRevealed,"whenReplaceRevealed");function whenFindReplaceInputFocused(contextService){return contextService.getContextValue(FIND_REPLACE_INPUT_FOCUS)}__name(whenFindReplaceInputFocused,"whenFindReplaceInputFocused");const FIND_REPLACE_SHORTCUT_GROUP="7_find-replace-shortcuts";function whenSheetFocused(contextService){return contextService.getContextValue(core.FOCUSING_SHEET)}__name(whenSheetFocused,"whenSheetFocused");function whenEditorNotActivated(contextService){return!contextService.getContextValue(core.EDITOR_ACTIVATED)}__name(whenEditorNotActivated,"whenEditorNotActivated");const OpenFindDialogShortcutItem={id:OpenFindDialogOperation.id,description:"find-replace.shortcut.open-find-dialog",binding:ui.KeyCode.F|ui.MetaKeys.CTRL_COMMAND,group:FIND_REPLACE_SHORTCUT_GROUP,preconditions(contextService){return!whenFindReplaceDialogFocused(contextService)&&whenSheetFocused(contextService)&&whenEditorNotActivated(contextService)}},MacOpenFindDialogShortcutItem={id:OpenFindDialogOperation.id,description:"find-replace.shortcut.open-find-dialog",binding:ui.KeyCode.F|ui.MetaKeys.CTRL_COMMAND,mac:ui.KeyCode.F|ui.MetaKeys.MAC_CTRL,preconditions(contextService){return!whenFindReplaceDialogFocused(contextService)&&whenSheetFocused(contextService)&&whenEditorNotActivated(contextService)}},OpenReplaceDialogShortcutItem={id:OpenReplaceDialogOperation.id,description:"find-replace.shortcut.open-replace-dialog",binding:ui.KeyCode.H|ui.MetaKeys.CTRL_COMMAND,mac:ui.KeyCode.H|ui.MetaKeys.MAC_CTRL,group:FIND_REPLACE_SHORTCUT_GROUP,preconditions(contextService){return whenSheetFocused(contextService)&&whenEditorNotActivated(contextService)&&(!whenFindReplaceDialogFocused(contextService)||!whenReplaceRevealed(contextService))}},GoToNextFindMatchShortcutItem={id:GoToNextMatchOperation.id,description:"find-replace.shortcut.go-to-next-match",binding:ui.KeyCode.ENTER,group:FIND_REPLACE_SHORTCUT_GROUP,priority:1e3,preconditions(contextService){return whenFindReplaceInputFocused(contextService)&&whenFindReplaceDialogFocused(contextService)}},GoToPreviousFindMatchShortcutItem={id:GoToPreviousMatchOperation.id,description:"find-replace.shortcut.go-to-previous-match",binding:ui.KeyCode.ENTER|ui.MetaKeys.SHIFT,group:FIND_REPLACE_SHORTCUT_GROUP,priority:1e3,preconditions(contextService){return whenFindReplaceInputFocused(contextService)&&whenFindReplaceDialogFocused(contextService)}};function FindReplaceMenuItemFactory(accessor){const contextService=accessor.get(core.IContextService);return{id:OpenFindDialogOperation.id,icon:"SearchIcon",tooltip:"find-replace.toolbar",type:ui.MenuItemType.BUTTON,hidden$:ui.getMenuHiddenObservable(accessor,core.UniverInstanceType.UNIVER_SHEET),disabled$:rxjs.combineLatest([contextService.subscribeContextValue$(core.EDITOR_ACTIVATED),contextService.subscribeContextValue$(core.FOCUSING_SHEET)]).pipe(rxjs.map(([editorActivated,focusingSheet])=>editorActivated||!focusingSheet))}}__name(FindReplaceMenuItemFactory,"FindReplaceMenuItemFactory");const menuSchema={[ui.RibbonStartGroup.OTHERS]:{[OpenFindDialogOperation.id]:{order:2,menuItemFactory:FindReplaceMenuItemFactory}}};var __defProp$1=Object.defineProperty,__getOwnPropDesc$1=Object.getOwnPropertyDescriptor,__decorateClass$1=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$1(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$1(target,key,result),result},"__decorateClass$1"),__decorateParam$1=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$1");const FIND_REPLACE_DIALOG_ID="DESKTOP_FIND_REPLACE_DIALOG",FIND_REPLACE_PANEL_WIDTH=350,FIND_REPLACE_PANEL_RIGHT_PADDING=20,FIND_REPLACE_PANEL_TOP_PADDING=-90;var _a3;exports.FindReplaceController=(_a3=class extends core.RxDisposable{constructor(_univerInstanceService,_menuManagerService,_shortcutService,_commandService,_findReplaceService,_dialogService,_layoutService,_localeService,_componentManager,_injector){super();__publicField(this,"_closingListenerDisposable");this._univerInstanceService=_univerInstanceService,this._menuManagerService=_menuManagerService,this._shortcutService=_shortcutService,this._commandService=_commandService,this._findReplaceService=_findReplaceService,this._dialogService=_dialogService,this._layoutService=_layoutService,this._localeService=_localeService,this._componentManager=_componentManager,this._injector=_injector,this._initCommands(),this._initUI(),this._initShortcuts()}dispose(){var _a5;super.dispose(),(_a5=this._closingListenerDisposable)==null||_a5.dispose(),this._closingListenerDisposable=null}_initCommands(){[OpenFindDialogOperation,OpenReplaceDialogOperation,GoToNextMatchOperation,GoToPreviousMatchOperation,ReplaceAllMatchesCommand,ReplaceCurrentMatchCommand].forEach(c=>{this.disposeWithMe(this._commandService.registerCommand(c))})}_initShortcuts(){[OpenReplaceDialogShortcutItem,OpenFindDialogShortcutItem,MacOpenFindDialogShortcutItem,GoToPreviousFindMatchShortcutItem,GoToNextFindMatchShortcutItem].forEach(s=>this.disposeWithMe(this._shortcutService.registerShortcut(s)))}_initUI(){this.disposeWithMe(this._componentManager.register("FindReplaceDialog",FindReplaceDialog)),this.disposeWithMe(this._componentManager.register("SearchIcon",SearchSingle16)),this._menuManagerService.mergeMenu(menuSchema),this._findReplaceService.stateUpdates$.pipe(rxjs.takeUntil(this.dispose$)).subscribe(newState=>{newState.revealed===!0&&this._openPanel()})}_openPanel(){this._dialogService.open({id:FIND_REPLACE_DIALOG_ID,draggable:!0,width:FIND_REPLACE_PANEL_WIDTH,title:{title:this._localeService.t("find-replace.dialog.title")},children:{label:"FindReplaceDialog"},destroyOnClose:!0,defaultPosition:getFindReplaceDialogDefaultPosition(),preservePositionOnDestroy:!0,onClose:__name(()=>this.closePanel(),"onClose")}),this._closingListenerDisposable=core.toDisposable(this._univerInstanceService.focused$.pipe(rxjs.takeUntil(this.dispose$)).subscribe(focused=>{(!focused||!this._univerInstanceService.getUniverSheetInstance(focused))&&this.closePanel()}))}closePanel(){this._closingListenerDisposable&&(this._closingListenerDisposable.dispose(),this._closingListenerDisposable=null,this._dialogService.close(FIND_REPLACE_DIALOG_ID),this._findReplaceService.terminate(),queueMicrotask(()=>this._layoutService.focus()))}},__name(_a3,"FindReplaceController"),_a3);exports.FindReplaceController=__decorateClass$1([core.OnLifecycle(core.LifecycleStages.Rendered,exports.FindReplaceController),__decorateParam$1(0,core.IUniverInstanceService),__decorateParam$1(1,ui.IMenuManagerService),__decorateParam$1(2,ui.IShortcutService),__decorateParam$1(3,core.ICommandService),__decorateParam$1(4,IFindReplaceService),__decorateParam$1(5,ui.IDialogService),__decorateParam$1(6,ui.ILayoutService),__decorateParam$1(7,core.Inject(core.LocaleService)),__decorateParam$1(8,core.Inject(ui.ComponentManager)),__decorateParam$1(9,core.Inject(core.Injector))],exports.FindReplaceController);function getFindReplaceDialogDefaultPosition(){const{innerWidth}=window;return{x:(innerWidth-FIND_REPLACE_PANEL_WIDTH)/2-FIND_REPLACE_PANEL_RIGHT_PADDING,y:FIND_REPLACE_PANEL_TOP_PADDING}}__name(getFindReplaceDialogDefaultPosition,"getFindReplaceDialogDefaultPosition");const PLUGIN_CONFIG_KEY="find-replace.config",defaultPluginConfig={};var __defProp2=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__decorateClass=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp2(target,key,result),result},"__decorateClass"),__decorateParam=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam");const PLUGIN_NAME="UNIVER_FIND_REPLACE_PLUGIN";var _a4;exports.UniverFindReplacePlugin=(_a4=class extends core.Plugin{constructor(_config=defaultPluginConfig,_injector,_configService){super(),this._config=_config,this._injector=_injector,this._configService=_configService;const{...rest}=this._config;this._configService.setConfig(PLUGIN_CONFIG_KEY,rest)}onStarting(){[[exports.FindReplaceController],[IFindReplaceService,{useClass:FindReplaceService}]].forEach(d=>{this._injector.add(d)})}},__name(_a4,"UniverFindReplacePlugin"),__publicField(_a4,"pluginName",PLUGIN_NAME),_a4);exports.UniverFindReplacePlugin=__decorateClass([__decorateParam(1,core.Inject(core.Injector)),__decorateParam(2,core.IConfigService)],exports.UniverFindReplacePlugin);exports.FindBy=FindBy;exports.FindDirection=FindDirection;exports.FindModel=FindModel;exports.FindScope=FindScope;exports.GoToNextMatchOperation=GoToNextMatchOperation;exports.GoToPreviousMatchOperation=GoToPreviousMatchOperation;exports.IFindReplaceService=IFindReplaceService;exports.OpenFindDialogOperation=OpenFindDialogOperation;exports.OpenReplaceDialogOperation=OpenReplaceDialogOperation;exports.ReplaceAllMatchesCommand=ReplaceAllMatchesCommand;exports.ReplaceCurrentMatchCommand=ReplaceCurrentMatchCommand;
1
+ 'use strict';const _0x539a8d=_0x2db0;(function(_0x5561ec,_0x2fe9c8){const _0x531c0f=_0x2db0,_0x22796c=_0x5561ec();while(!![]){try{const _0x2869b7=-parseInt(_0x531c0f(0x146))/0x1*(parseInt(_0x531c0f(0x18d))/0x2)+parseInt(_0x531c0f(0x197))/0x3*(parseInt(_0x531c0f(0x1cd))/0x4)+-parseInt(_0x531c0f(0x177))/0x5*(parseInt(_0x531c0f(0x1bb))/0x6)+-parseInt(_0x531c0f(0x1b5))/0x7+-parseInt(_0x531c0f(0x1c2))/0x8+-parseInt(_0x531c0f(0x292))/0x9*(-parseInt(_0x531c0f(0x2a0))/0xa)+parseInt(_0x531c0f(0x202))/0xb*(parseInt(_0x531c0f(0x142))/0xc);if(_0x2869b7===_0x2fe9c8)break;else _0x22796c['push'](_0x22796c['shift']());}catch(_0x27db66){_0x22796c['push'](_0x22796c['shift']());}}}(_0x825d,0xcb598));var __defProp=Object[_0x539a8d(0x289)],__defNormalProp=(_0x1daf82,_0x112355,_0x572049)=>_0x112355 in _0x1daf82?__defProp(_0x1daf82,_0x112355,{'enumerable':!0x0,'configurable':!0x0,'writable':!0x0,'value':_0x572049}):_0x1daf82[_0x112355]=_0x572049,__name=(_0x556855,_0x499f7a)=>__defProp(_0x556855,_0x539a8d(0x27b),{'value':_0x499f7a,'configurable':!0x0}),__publicField=(_0x2d3b59,_0x2a0aae,_0x5cd4ca)=>__defNormalProp(_0x2d3b59,typeof _0x2a0aae!=_0x539a8d(0x26c)?_0x2a0aae+'':_0x2a0aae,_0x5cd4ca);Object[_0x539a8d(0x289)](exports,Symbol['toStringTag'],{'value':_0x539a8d(0x265)});const core=require('@univerjs/core'),ui=require(_0x539a8d(0x1f0)),rxjs=require('rxjs'),design=require(_0x539a8d(0x1d7)),engineRender=require(_0x539a8d(0x192)),require$$0=require(_0x539a8d(0x1e9)),PLUGIN_CONFIG_KEY=_0x539a8d(0x154),defaultPluginConfig={};var __assign=function(){const _0x57e5d2=_0x539a8d;return __assign=Object[_0x57e5d2(0x262)]||function(_0x378365){const _0x8bc9c6=_0x57e5d2;for(var _0x5f1947,_0x4f70e6=0x1,_0x47103c=arguments[_0x8bc9c6(0x19e)];_0x4f70e6<_0x47103c;_0x4f70e6++){_0x5f1947=arguments[_0x4f70e6];for(var _0x6508c9 in _0x5f1947)Object['prototype'][_0x8bc9c6(0x1b3)][_0x8bc9c6(0x26f)](_0x5f1947,_0x6508c9)&&(_0x378365[_0x6508c9]=_0x5f1947[_0x6508c9]);}return _0x378365;},__assign['apply'](this,arguments);},__rest=function(_0x1ad34b,_0x138566){const _0x1efa1c=_0x539a8d;var _0x5df1fc={};for(var _0x13ba3a in _0x1ad34b)Object[_0x1efa1c(0x169)][_0x1efa1c(0x1b3)][_0x1efa1c(0x26f)](_0x1ad34b,_0x13ba3a)&&_0x138566[_0x1efa1c(0x198)](_0x13ba3a)<0x0&&(_0x5df1fc[_0x13ba3a]=_0x1ad34b[_0x13ba3a]);if(_0x1ad34b!=null&&typeof Object[_0x1efa1c(0x2ad)]==_0x1efa1c(0x2a5)){for(var _0x4f124d=0x0,_0x13ba3a=Object[_0x1efa1c(0x2ad)](_0x1ad34b);_0x4f124d<_0x13ba3a[_0x1efa1c(0x19e)];_0x4f124d++)_0x138566[_0x1efa1c(0x198)](_0x13ba3a[_0x4f124d])<0x0&&Object[_0x1efa1c(0x169)]['propertyIsEnumerable'][_0x1efa1c(0x26f)](_0x1ad34b,_0x13ba3a[_0x4f124d])&&(_0x5df1fc[_0x13ba3a[_0x4f124d]]=_0x1ad34b[_0x13ba3a[_0x4f124d]]);}return _0x5df1fc;},IconBase=require$$0[_0x539a8d(0x1e0)](function(_0x23ef13,_0x3dcc44){const _0x213f1a=_0x539a8d;var _0x5e4426=_0x23ef13[_0x213f1a(0x261)],_0x4d1898=_0x23ef13['id'],_0x15b6da=_0x23ef13[_0x213f1a(0x23d)],_0x42f222=_0x23ef13[_0x213f1a(0x1b4)],_0x14c66f=__rest(_0x23ef13,[_0x213f1a(0x261),'id','className',_0x213f1a(0x1b4)]),_0x357704=_0x213f1a(0x238)[_0x213f1a(0x257)](_0x4d1898,'\x20')[_0x213f1a(0x257)](_0x15b6da||'')[_0x213f1a(0x29b)](),_0x407850=require$$0[_0x213f1a(0x212)]('_'[_0x213f1a(0x257)](generateShortUuid()));return render(_0x5e4426,''[_0x213f1a(0x257)](_0x4d1898),{'defIds':_0x5e4426[_0x213f1a(0x224)],'idSuffix':_0x407850[_0x213f1a(0x19c)]},__assign({'ref':_0x3dcc44,'className':_0x357704},_0x14c66f),_0x42f222);});function render(_0x5705be,_0x5eb490,_0x37fb48,_0x23abb6,_0x391b9d){const _0x543577=_0x539a8d;return require$$0[_0x543577(0x255)](_0x5705be[_0x543577(0x145)],__assign(__assign({'key':_0x5eb490},replaceRuntimeIdsAndExtInAttrs(_0x5705be,_0x37fb48,_0x391b9d)),_0x23abb6),(replaceRuntimeIdsInDefs(_0x5705be,_0x37fb48)[_0x543577(0x25d)]||[])[_0x543577(0x1ee)](function(_0x55b05b,_0x15039e){const _0x116c54=_0x543577;return render(_0x55b05b,''[_0x116c54(0x257)](_0x5eb490,'-')[_0x116c54(0x257)](_0x5705be['tag'],'-')[_0x116c54(0x257)](_0x15039e),_0x37fb48,void 0x0,_0x391b9d);}));}__name(render,_0x539a8d(0x1cb));function replaceRuntimeIdsAndExtInAttrs(_0x13ed0e,_0xcb950b,_0x3a699f){const _0x3cad96=_0x539a8d;var _0x433d46=__assign({},_0x13ed0e[_0x3cad96(0x254)]);_0x3a699f!=null&&_0x3a699f[_0x3cad96(0x28c)]&&_0x433d46[_0x3cad96(0x1c6)]===_0x3cad96(0x28c)&&(_0x433d46[_0x3cad96(0x1c6)]=_0x3a699f[_0x3cad96(0x28c)]);var _0x4caf2a=_0xcb950b['defIds'];return!_0x4caf2a||_0x4caf2a[_0x3cad96(0x19e)]===0x0||(_0x13ed0e[_0x3cad96(0x145)]==='use'&&_0x433d46[_0x3cad96(0x1f1)]&&(_0x433d46[_0x3cad96(0x1f1)]=_0x433d46['xlink:href']+_0xcb950b[_0x3cad96(0x1d5)]),Object['entries'](_0x433d46)['forEach'](function(_0x3433e9){const _0x440521=_0x3cad96;var _0x2fe041=_0x3433e9[0x0],_0x2953a5=_0x3433e9[0x1];typeof _0x2953a5==_0x440521(0x281)&&(_0x433d46[_0x2fe041]=_0x2953a5[_0x440521(0x1bd)](/url\(#(.*)\)/,_0x440521(0x1e6)[_0x440521(0x257)](_0xcb950b[_0x440521(0x1d5)],')')));})),_0x433d46;}__name(replaceRuntimeIdsAndExtInAttrs,'replaceRuntimeIdsAndExtInAttrs');function replaceRuntimeIdsInDefs(_0x342d38,_0x320fc7){const _0x2fd7db=_0x539a8d;var _0x422567,_0x243c71=_0x320fc7[_0x2fd7db(0x224)];return!_0x243c71||_0x243c71[_0x2fd7db(0x19e)]===0x0?_0x342d38:_0x342d38['tag']===_0x2fd7db(0x252)&&(!((_0x422567=_0x342d38[_0x2fd7db(0x25d)])===null||_0x422567===void 0x0)&&_0x422567[_0x2fd7db(0x19e)])?__assign(__assign({},_0x342d38),{'children':_0x342d38[_0x2fd7db(0x25d)][_0x2fd7db(0x1ee)](function(_0x428cf9){const _0xc9e13c=_0x2fd7db;return typeof _0x428cf9[_0xc9e13c(0x254)]['id']==_0xc9e13c(0x281)&&_0x243c71&&_0x243c71[_0xc9e13c(0x198)](_0x428cf9[_0xc9e13c(0x254)]['id'])>-0x1?__assign(__assign({},_0x428cf9),{'attrs':__assign(__assign({},_0x428cf9[_0xc9e13c(0x254)]),{'id':_0x428cf9[_0xc9e13c(0x254)]['id']+_0x320fc7[_0xc9e13c(0x1d5)]})}):_0x428cf9;})}):_0x342d38;}__name(replaceRuntimeIdsInDefs,_0x539a8d(0x16d));function generateShortUuid(){const _0x23351f=_0x539a8d;return Math[_0x23351f(0x21d)]()['toString'](0x24)[_0x23351f(0x287)](0x2,0x8);}__name(generateShortUuid,_0x539a8d(0x28f)),IconBase[_0x539a8d(0x1b0)]=_0x539a8d(0x194);var element={'tag':_0x539a8d(0x23e),'attrs':{'fill':_0x539a8d(0x295),'viewBox':'0\x200\x2017\x2017','width':_0x539a8d(0x1c7),'height':_0x539a8d(0x1c7)},'children':[{'tag':'mask','attrs':{'id':_0x539a8d(0x23a),'style':{'maskType':_0x539a8d(0x1f8)},'width':0x11,'height':0x11,'x':0x0,'y':0x0,'maskUnits':_0x539a8d(0x14a)},'children':[{'tag':_0x539a8d(0x13c),'attrs':{'fill':_0x539a8d(0x264),'d':'M0.9\x200.09H16.9V16.09H0.9z'}}]},{'tag':'g','attrs':{'mask':_0x539a8d(0x2a9)},'children':[{'tag':_0x539a8d(0x13c),'attrs':{'fill':'currentColor','d':_0x539a8d(0x1c9),'fillRule':_0x539a8d(0x1f2),'clipRule':_0x539a8d(0x1f2)}}]}]},SearchSingle16=require$$0[_0x539a8d(0x1e0)](function(_0x50ddfd,_0x3aeb6b){const _0xfd78b2=_0x539a8d;return require$$0['createElement'](IconBase,Object[_0xfd78b2(0x262)]({},_0x50ddfd,{'id':_0xfd78b2(0x298),'ref':_0x3aeb6b,'icon':element}));});SearchSingle16['displayName']=_0x539a8d(0x206);const FIND_REPLACE_INPUT_FOCUS=_0x539a8d(0x2a6),FIND_REPLACE_DIALOG_FOCUS=_0x539a8d(0x162),FIND_REPLACE_REPLACE_REVEALED=_0x539a8d(0x17f);var __defProp$2=Object['defineProperty'],__getOwnPropDesc$2=Object[_0x539a8d(0x284)],__decorateClass$2=__name((_0x4e6edf,_0x376c20,_0x526de4,_0x11cb63)=>{const _0x1fad56=_0x539a8d;for(var _0x4adedd=_0x11cb63>0x1?void 0x0:_0x11cb63?__getOwnPropDesc$2(_0x376c20,_0x526de4):_0x376c20,_0x1bb04b=_0x4e6edf[_0x1fad56(0x19e)]-0x1,_0x18faab;_0x1bb04b>=0x0;_0x1bb04b--)(_0x18faab=_0x4e6edf[_0x1bb04b])&&(_0x4adedd=(_0x11cb63?_0x18faab(_0x376c20,_0x526de4,_0x4adedd):_0x18faab(_0x4adedd))||_0x4adedd);return _0x11cb63&&_0x4adedd&&__defProp$2(_0x376c20,_0x526de4,_0x4adedd),_0x4adedd;},'__decorateClass$2'),__decorateParam$2=__name((_0xe38156,_0x2b06a4)=>(_0x28a767,_0xf8964d)=>_0x2b06a4(_0x28a767,_0xf8964d,_0xe38156),_0x539a8d(0x17a));const _FindModel=class _FindModel extends core[_0x539a8d(0x189)]{};__name(_FindModel,_0x539a8d(0x15e));let FindModel=_FindModel;const IFindReplaceService=core[_0x539a8d(0x20a)](_0x539a8d(0x237));function shouldStateUpdateTriggerResearch(_0x30bc3b){const _0x5a8544=_0x539a8d;return typeof _0x30bc3b[_0x5a8544(0x277)]<'u'||typeof _0x30bc3b[_0x5a8544(0x215)]<'u'||typeof _0x30bc3b[_0x5a8544(0x25a)]<'u'||typeof _0x30bc3b['matchesTheWholeCell']<'u'||typeof _0x30bc3b[_0x5a8544(0x161)]<'u'||typeof _0x30bc3b[_0x5a8544(0x26e)]<'u'||typeof _0x30bc3b[_0x5a8544(0x207)]<'u';}__name(shouldStateUpdateTriggerResearch,'shouldStateUpdateTriggerResearch');var _a;let FindReplaceModel=(_a=class extends core['Disposable']{constructor(_0x2fddbf,_0x14541b,_0x530293){const _0x3cb928=_0x539a8d;super(),__publicField(this,_0x3cb928(0x2af),new rxjs['BehaviorSubject'](null)),__publicField(this,_0x3cb928(0x1da),new rxjs['BehaviorSubject']([])),__publicField(this,_0x3cb928(0x2a3),[]),__publicField(this,_0x3cb928(0x225),null),__publicField(this,_0x3cb928(0x220),[]),__publicField(this,_0x3cb928(0x167),null),(this[_0x3cb928(0x259)]=_0x2fddbf,this[_0x3cb928(0x1d8)]=_0x14541b,this[_0x3cb928(0x22a)]=_0x530293,this['disposeWithMe'](this[_0x3cb928(0x259)][_0x3cb928(0x175)][_0x3cb928(0x23c)](rxjs[_0x3cb928(0x1e4)](0xc8,void 0x0,{'leading':!0x0,'trailing':!0x0}))[_0x3cb928(0x143)](async _0x1a2400=>{const _0x2f59d6=_0x3cb928,_0x326f09=this[_0x2f59d6(0x259)][_0x2f59d6(0x1ca)];shouldStateUpdateTriggerResearch(_0x1a2400)&&(_0x326f09[_0x2f59d6(0x277)]!==''&&!_0x326f09['replaceRevealed']?(await this[_0x2f59d6(0x22e)](),this[_0x2f59d6(0x259)][_0x2f59d6(0x172)]({'findCompleted':!0x0})):_0x1a2400['replaceRevealed']!==!0x0&&this[_0x2f59d6(0x29e)]());})));}get[_0x539a8d(0x216)](){const _0x2262ce=_0x539a8d;return this['_findModels'][_0x2262ce(0x19e)]>0x0;}[_0x539a8d(0x153)](){const _0x2d4c66=_0x539a8d;super[_0x2d4c66(0x153)](),this[_0x2d4c66(0x29e)](),this[_0x2d4c66(0x2af)][_0x2d4c66(0x1a6)](),this[_0x2d4c66(0x1da)][_0x2d4c66(0x1a6)](),this[_0x2d4c66(0x259)][_0x2d4c66(0x172)]({...createInitFindReplaceState(),'revealed':!0x1});}async[_0x539a8d(0x25f)](){const _0x413c35=_0x539a8d;if(!this['_state'][_0x413c35(0x277)])return{'results':[]};const _0xf1de1a=await this['_startSearching']();return this[_0x413c35(0x259)][_0x413c35(0x172)]({'findCompleted':!0x0}),_0xf1de1a;}async[_0x539a8d(0x22e)](){const _0x28dd0a=_0x539a8d;if(!this[_0x28dd0a(0x259)]['findString'])return{'results':[]};const _0x5709b0=Array[_0x28dd0a(0x14d)](this[_0x28dd0a(0x1d8)]),_0x1fc148=this[_0x28dd0a(0x2a3)]=(await Promise[_0x28dd0a(0x251)](_0x5709b0[_0x28dd0a(0x1ee)](_0x357d99=>_0x357d99[_0x28dd0a(0x1cc)]({'findString':this[_0x28dd0a(0x259)][_0x28dd0a(0x277)],'findDirection':this['_state'][_0x28dd0a(0x25a)],'findScope':this[_0x28dd0a(0x259)][_0x28dd0a(0x26e)],'findBy':this[_0x28dd0a(0x259)][_0x28dd0a(0x207)],'replaceRevealed':this[_0x28dd0a(0x259)]['replaceRevealed'],'caseSensitive':this['_state']['caseSensitive'],'matchesTheWholeCell':this[_0x28dd0a(0x259)][_0x28dd0a(0x1af)]}))))['flat']();this[_0x28dd0a(0x1ac)](_0x1fc148);const _0x57555c=this[_0x28dd0a(0x220)]=_0x1fc148['map'](_0x86dd50=>_0x86dd50['getMatches']())['flat']();return this['replaceables$'][_0x28dd0a(0x1c3)](_0x57555c[_0x28dd0a(0x1f9)](_0x2feb77=>_0x2feb77[_0x28dd0a(0x21f)])),_0x57555c[_0x28dd0a(0x19e)]?(this['_moveToInitialMatch'](_0x1fc148),this[_0x28dd0a(0x259)][_0x28dd0a(0x172)]({'matchesCount':_0x57555c[_0x28dd0a(0x19e)]}),{'results':_0x57555c}):(this[_0x28dd0a(0x259)][_0x28dd0a(0x172)]({'matchesCount':0x0,'matchesPosition':0x0}),{'results':[]});}[_0x539a8d(0x29e)](){const _0x530a9c=_0x539a8d;var _0x4b846b;this[_0x530a9c(0x1d8)][_0x530a9c(0x24e)](_0x41cc35=>_0x41cc35['terminate']()),this[_0x530a9c(0x2a3)]=[],this['_matches']=[],this[_0x530a9c(0x225)]=null,(_0x4b846b=this[_0x530a9c(0x167)])==null||_0x4b846b[_0x530a9c(0x153)](),this[_0x530a9c(0x167)]=null,this[_0x530a9c(0x2af)]['next'](null),this[_0x530a9c(0x1da)][_0x530a9c(0x1c3)]([]),this['_state'][_0x530a9c(0x172)]({'findCompleted':!0x1,'matchesCount':0x0,'matchesPosition':0x0});}['_subscribeToModelsChanges'](_0x2af239){const _0x45a8b5=_0x539a8d,_0x4be538=this[_0x45a8b5(0x167)]=new core[(_0x45a8b5(0x267))](),_0x1a0477=rxjs[_0x45a8b5(0x2ae)](_0x2af239[_0x45a8b5(0x1ee)](_0x26d7b1=>_0x26d7b1['matchesUpdate$']))[_0x45a8b5(0x23c)](rxjs[_0x45a8b5(0x2ab)](0xdc))[_0x45a8b5(0x143)](([..._0x2484d5])=>{const _0x34149c=_0x45a8b5,_0x3ae32d=this['_matches']=_0x2484d5[_0x34149c(0x16e)]();_0x3ae32d[_0x34149c(0x19e)]?(this[_0x34149c(0x191)](this[_0x34149c(0x2a3)],!0x0),this[_0x34149c(0x259)][_0x34149c(0x172)]({'matchesCount':_0x3ae32d['length']}),this['replaceables$']['next'](_0x3ae32d[_0x34149c(0x1f9)](_0x4d7f7f=>_0x4d7f7f[_0x34149c(0x21f)]))):(this[_0x34149c(0x259)]['changeState']({'matchesCount':0x0,'matchesPosition':0x0}),this[_0x34149c(0x1da)][_0x34149c(0x1c3)]([]));});_0x2af239[_0x45a8b5(0x24e)](_0x2d869b=>_0x4be538[_0x45a8b5(0x291)](core[_0x45a8b5(0x174)](_0x2d869b[_0x45a8b5(0x18b)][_0x45a8b5(0x143)](_0x3320a6=>{const _0x80bfe=_0x45a8b5,_0x49316e=this['_matches'][_0x80bfe(0x1eb)](_0x189250=>_0x189250===_0x3320a6);this[_0x80bfe(0x259)][_0x80bfe(0x172)]({'matchesPosition':_0x49316e+0x1});})))),_0x4be538[_0x45a8b5(0x291)](core[_0x45a8b5(0x174)](_0x1a0477));}async[_0x539a8d(0x1bd)](){const _0x5026c3=_0x539a8d;return this['_matchingModel']?this['_matchingModel'][_0x5026c3(0x1bd)](this[_0x5026c3(0x259)][_0x5026c3(0x214)]):!0x1;}async[_0x539a8d(0x229)](){const _0x28de71=_0x539a8d,_0x59c1a0=await Promise[_0x28de71(0x251)](this[_0x28de71(0x2a3)][_0x28de71(0x1ee)](_0x335cee=>_0x335cee[_0x28de71(0x229)](this[_0x28de71(0x259)][_0x28de71(0x214)])))['then'](_0x2a3e2b=>_0x2a3e2b[_0x28de71(0x1ef)]((_0x41ab6f,_0x494fe7)=>(_0x41ab6f[_0x28de71(0x221)]+=_0x494fe7[_0x28de71(0x221)],_0x41ab6f[_0x28de71(0x193)]+=_0x494fe7[_0x28de71(0x193)],_0x41ab6f),{'success':0x0,'failure':0x0}));return _0x59c1a0[_0x28de71(0x193)]===0x0&&this[_0x28de71(0x29e)](),_0x59c1a0;}[_0x539a8d(0x1a2)](){const _0x1dba2a=_0x539a8d;return this['_state'][_0x1dba2a(0x183)]>0x0?this[_0x1dba2a(0x220)][this[_0x1dba2a(0x259)][_0x1dba2a(0x183)]-0x1]:null;}[_0x539a8d(0x22b)](_0x3a6919){const _0x55c8a6=_0x539a8d,_0x3bc0ef=this[_0x55c8a6(0x220)][_0x55c8a6(0x1eb)](_0x380311=>_0x380311===_0x3a6919);this[_0x55c8a6(0x2af)][_0x55c8a6(0x1c3)](_0x3a6919),this[_0x55c8a6(0x259)][_0x55c8a6(0x172)]({'matchesPosition':_0x3bc0ef+0x1});}['moveToNextMatch'](){const _0x3682ed=_0x539a8d;if(!this[_0x3682ed(0x225)])return;const _0x394b08=this['_findModels'][_0x3682ed(0x19e)]===0x1,_0x197459=this[_0x3682ed(0x225)][_0x3682ed(0x1ba)]({'loop':_0x394b08});if(_0x197459)this[_0x3682ed(0x22b)](_0x197459);else{const _0x5daddc=this[_0x3682ed(0x2a3)][_0x3682ed(0x1eb)](_0x4239c5=>_0x4239c5===this[_0x3682ed(0x225)]);this[_0x3682ed(0x19b)](_0x5daddc);}}[_0x539a8d(0x19b)](_0x2bd86f){const _0x4990bd=_0x539a8d,_0x186864=this['_findModels'][_0x4990bd(0x19e)];for(let _0x26f177=(_0x2bd86f+0x1)%_0x186864;_0x26f177!==_0x2bd86f;){const _0x1bb6c1=this['_findModels'][_0x26f177],_0x203cbf=_0x1bb6c1[_0x4990bd(0x1ba)]({'ignoreSelection':!0x0});if(_0x203cbf){this[_0x4990bd(0x225)]=_0x1bb6c1,this[_0x4990bd(0x22b)](_0x203cbf);return;}_0x26f177=(_0x26f177+0x1)%_0x186864;}if(this[_0x4990bd(0x225)]){const _0x5a6b31=this[_0x4990bd(0x225)][_0x4990bd(0x1ba)]({'ignoreSelection':!0x0});_0x5a6b31&&this['_markMatch'](_0x5a6b31);}}[_0x539a8d(0x2a8)](){const _0x75b754=_0x539a8d;if(!this[_0x75b754(0x225)])return;const _0x504c33=this[_0x75b754(0x2a3)]['length']===0x1,_0x2825f9=this[_0x75b754(0x225)][_0x75b754(0x2a8)]({'loop':_0x504c33});if(_0x2825f9){const _0x2c2b6d=this[_0x75b754(0x220)]['findIndex'](_0x30bf45=>_0x30bf45===_0x2825f9);this[_0x75b754(0x2af)][_0x75b754(0x1c3)](_0x2825f9),this[_0x75b754(0x259)][_0x75b754(0x172)]({'matchesPosition':_0x2c2b6d+0x1});}else{const _0x25ecdf=this['_findModels'][_0x75b754(0x19e)],_0x4108e6=this[_0x75b754(0x2a3)]['findIndex'](_0x4470f5=>_0x4470f5===this[_0x75b754(0x225)]);for(let _0x19610=(_0x4108e6-0x1+_0x25ecdf)%_0x25ecdf;_0x19610!==_0x4108e6;){const _0xf651b0=this[_0x75b754(0x2a3)][_0x19610],_0x49d75d=_0xf651b0['moveToPreviousMatch']({'ignoreSelection':!0x0});if(_0x49d75d){this['_matchingModel']=_0xf651b0,this[_0x75b754(0x22b)](_0x49d75d);return;}_0x19610=(_0x19610-0x1)%_0x25ecdf;}const _0x43d43a=this[_0x75b754(0x225)][_0x75b754(0x2a8)]({'ignoreSelection':!0x0});_0x43d43a&&this['_markMatch'](_0x43d43a);}}[_0x539a8d(0x191)](_0x3cb19c,_0x25a0ff=!0x1){const _0x119840=_0x539a8d;var _0x5bc63d;const _0x1a3cda=(_0x5bc63d=this[_0x119840(0x22a)][_0x119840(0x170)]())==null?void 0x0:_0x5bc63d[_0x119840(0x165)]();if(!_0x1a3cda)return-0x1;const _0x443196=_0x3cb19c['findIndex'](_0x3b8a2a=>_0x3b8a2a[_0x119840(0x1d9)]===_0x1a3cda);if(_0x443196!==-0x1){this[_0x119840(0x225)]=_0x3cb19c[_0x443196];const _0x24c389=this[_0x119840(0x225)][_0x119840(0x1ba)]({'stayIfOnMatch':!0x0,'noFocus':_0x25a0ff});if(_0x24c389)return this['_markMatch'](_0x24c389),_0x443196;}return this[_0x119840(0x19b)](_0x443196),0x0;}},__name(_a,_0x539a8d(0x272)),_a);FindReplaceModel=__decorateClass$2([__decorateParam$2(0x2,core[_0x539a8d(0x279)])],FindReplaceModel);var FindDirection=(_0x172c1a=>(_0x172c1a[_0x539a8d(0x19d)]='row',_0x172c1a[_0x539a8d(0x1d3)]=_0x539a8d(0x248),_0x172c1a))(FindDirection||{}),FindBy=(_0xf5ca6f=>(_0xf5ca6f[_0x539a8d(0x1ec)]=_0x539a8d(0x1a9),_0xf5ca6f['FORMULA']='formula',_0xf5ca6f))(FindBy||{}),FindScope=(_0x4f3469=>(_0x4f3469['SUBUNIT']=_0x539a8d(0x14c),_0x4f3469['UNIT']=_0x539a8d(0x231),_0x4f3469))(FindScope||{});function createInitFindReplaceState(){const _0x454d98=_0x539a8d;return{'caseSensitive':!0x1,'findBy':_0x454d98(0x1a9),'findCompleted':!0x1,'findDirection':_0x454d98(0x244),'findScope':'subunit','findString':'','inputtingFindString':'','matchesCount':0x0,'matchesPosition':0x0,'matchesTheWholeCell':!0x1,'replaceRevealed':!0x1,'replaceString':'','revealed':!0x0};}__name(createInitFindReplaceState,_0x539a8d(0x1aa));const _FindReplaceState=class _FindReplaceState{constructor(){const _0x1ce1e9=_0x539a8d;__publicField(this,'_stateUpdates$',new rxjs['Subject']()),__publicField(this,_0x1ce1e9(0x175),this[_0x1ce1e9(0x276)][_0x1ce1e9(0x18e)]()),__publicField(this,_0x1ce1e9(0x13d),new rxjs[(_0x1ce1e9(0x26b))](createInitFindReplaceState())),__publicField(this,_0x1ce1e9(0x22c),this['_state$'][_0x1ce1e9(0x18e)]()),__publicField(this,_0x1ce1e9(0x1e7),''),__publicField(this,_0x1ce1e9(0x1ae),''),__publicField(this,'_replaceString',''),__publicField(this,'_revealed',!0x1),__publicField(this,_0x1ce1e9(0x213),!0x1),__publicField(this,_0x1ce1e9(0x1b6),0x0),__publicField(this,_0x1ce1e9(0x241),0x0),__publicField(this,'_caseSensitive',!0x0),__publicField(this,_0x1ce1e9(0x139),!0x1),__publicField(this,_0x1ce1e9(0x17c),'row'),__publicField(this,_0x1ce1e9(0x260),_0x1ce1e9(0x14c)),__publicField(this,'_findBy',_0x1ce1e9(0x1a9)),__publicField(this,'_findCompleted',!0x1);}get['state'](){const _0x3fb2bc=_0x539a8d;return this[_0x3fb2bc(0x13d)]['getValue']();}get[_0x539a8d(0x215)](){const _0x5271c6=_0x539a8d;return this[_0x5271c6(0x1ae)];}get[_0x539a8d(0x277)](){return this['_findString'];}get[_0x539a8d(0x21b)](){return this['_revealed'];}get[_0x539a8d(0x16a)](){const _0x330fe8=_0x539a8d;return this[_0x330fe8(0x213)];}get[_0x539a8d(0x183)](){return this['_matchesPosition'];}get[_0x539a8d(0x1be)](){const _0x3dc3d8=_0x539a8d;return this[_0x3dc3d8(0x241)];}get['replaceString'](){return this['_replaceString'];}get['caseSensitive'](){const _0x509470=_0x539a8d;return this[_0x509470(0x1a8)];}get[_0x539a8d(0x1af)](){const _0x160de8=_0x539a8d;return this[_0x160de8(0x139)];}get[_0x539a8d(0x25a)](){const _0x6917dc=_0x539a8d;return this[_0x6917dc(0x17c)];}get[_0x539a8d(0x26e)](){const _0x2d5274=_0x539a8d;return this[_0x2d5274(0x260)];}get[_0x539a8d(0x207)](){return this['_findBy'];}get[_0x539a8d(0x29a)](){const _0x47da5e=_0x539a8d;return this[_0x47da5e(0x1d0)];}[_0x539a8d(0x172)](_0x3a55a3){const _0x547a84=_0x539a8d;let _0x5d399a=!0x1;const _0x5b549b={};typeof _0x3a55a3[_0x547a84(0x277)]<'u'&&_0x3a55a3[_0x547a84(0x277)]!==this[_0x547a84(0x1e7)]&&(this[_0x547a84(0x1e7)]=_0x3a55a3['findString'],_0x5b549b[_0x547a84(0x277)]=this[_0x547a84(0x1e7)],_0x5d399a=!0x0),typeof _0x3a55a3[_0x547a84(0x21b)]<'u'&&_0x3a55a3[_0x547a84(0x21b)]!==this[_0x547a84(0x29f)]&&(this[_0x547a84(0x29f)]=_0x3a55a3['revealed'],_0x5b549b[_0x547a84(0x21b)]=_0x3a55a3[_0x547a84(0x21b)],_0x5d399a=!0x0),typeof _0x3a55a3[_0x547a84(0x16a)]<'u'&&_0x3a55a3[_0x547a84(0x16a)]!==this[_0x547a84(0x213)]&&(this[_0x547a84(0x213)]=_0x3a55a3[_0x547a84(0x16a)],_0x5b549b[_0x547a84(0x16a)]=_0x3a55a3[_0x547a84(0x16a)],_0x5d399a=!0x0),typeof _0x3a55a3['replaceString']<'u'&&_0x3a55a3[_0x547a84(0x214)]!==this['_replaceString']&&(this[_0x547a84(0x149)]=_0x3a55a3['replaceString'],_0x5b549b[_0x547a84(0x214)]=_0x3a55a3[_0x547a84(0x214)],_0x5d399a=!0x0),typeof _0x3a55a3[_0x547a84(0x1be)]<'u'&&_0x3a55a3[_0x547a84(0x1be)]!==this[_0x547a84(0x241)]&&(this[_0x547a84(0x241)]=_0x3a55a3[_0x547a84(0x1be)],_0x5b549b[_0x547a84(0x1be)]=_0x3a55a3[_0x547a84(0x1be)],_0x5d399a=!0x0),typeof _0x3a55a3['matchesPosition']<'u'&&_0x3a55a3[_0x547a84(0x183)]!==this[_0x547a84(0x1b6)]&&(this[_0x547a84(0x1b6)]=_0x3a55a3['matchesPosition'],_0x5b549b[_0x547a84(0x183)]=_0x3a55a3[_0x547a84(0x183)],_0x5d399a=!0x0),typeof _0x3a55a3['findBy']<'u'&&_0x3a55a3[_0x547a84(0x207)]!==this[_0x547a84(0x25e)]&&(this[_0x547a84(0x25e)]=_0x3a55a3[_0x547a84(0x207)],_0x5b549b[_0x547a84(0x207)]=_0x3a55a3[_0x547a84(0x207)],_0x5d399a=!0x0),typeof _0x3a55a3[_0x547a84(0x26e)]<'u'&&_0x3a55a3['findScope']!==this[_0x547a84(0x260)]&&(this['_findScope']=_0x3a55a3[_0x547a84(0x26e)],_0x5b549b['findScope']=_0x3a55a3['findScope'],_0x5d399a=!0x0),typeof _0x3a55a3['findDirection']<'u'&&_0x3a55a3[_0x547a84(0x25a)]!==this['_findDirection']&&(this[_0x547a84(0x17c)]=_0x3a55a3['findDirection'],_0x5b549b[_0x547a84(0x25a)]=_0x3a55a3['findDirection'],_0x5d399a=!0x0),typeof _0x3a55a3[_0x547a84(0x161)]<'u'&&_0x3a55a3[_0x547a84(0x161)]!==this[_0x547a84(0x1a8)]&&(this[_0x547a84(0x1a8)]=_0x3a55a3['caseSensitive'],_0x5b549b[_0x547a84(0x161)]=_0x3a55a3['caseSensitive'],_0x5d399a=!0x0),typeof _0x3a55a3[_0x547a84(0x1af)]<'u'&&_0x3a55a3[_0x547a84(0x1af)]!==this[_0x547a84(0x139)]&&(this[_0x547a84(0x139)]=_0x3a55a3[_0x547a84(0x1af)],_0x5b549b[_0x547a84(0x1af)]=_0x3a55a3[_0x547a84(0x1af)],_0x5d399a=!0x0),typeof _0x3a55a3[_0x547a84(0x215)]<'u'&&_0x3a55a3[_0x547a84(0x215)]!==this[_0x547a84(0x1ae)]&&(this['_inputtingFindString']=_0x3a55a3[_0x547a84(0x215)],_0x5b549b['inputtingFindString']=_0x3a55a3[_0x547a84(0x215)],_0x5d399a=!0x0),typeof _0x3a55a3[_0x547a84(0x29a)]<'u'&&_0x3a55a3['findCompleted']!==this[_0x547a84(0x1d0)]&&(this['_findCompleted']=_0x3a55a3[_0x547a84(0x29a)],_0x5b549b[_0x547a84(0x29a)]=_0x3a55a3[_0x547a84(0x29a)],_0x5d399a=!0x0),_0x5d399a&&(this[_0x547a84(0x13d)]['next']({'caseSensitive':this[_0x547a84(0x1a8)],'findBy':this[_0x547a84(0x25e)],'findCompleted':this[_0x547a84(0x1d0)],'findDirection':this[_0x547a84(0x17c)],'findScope':this[_0x547a84(0x260)],'findString':this[_0x547a84(0x1e7)],'inputtingFindString':this['_inputtingFindString'],'matchesCount':this[_0x547a84(0x241)],'matchesPosition':this[_0x547a84(0x1b6)],'matchesTheWholeCell':this[_0x547a84(0x139)],'replaceRevealed':this[_0x547a84(0x213)],'revealed':this[_0x547a84(0x29f)]}),this[_0x547a84(0x276)][_0x547a84(0x1c3)](_0x5b549b));}};__name(_FindReplaceState,_0x539a8d(0x268));let FindReplaceState=_FindReplaceState;var _a2;let FindReplaceService=(_a2=class extends core[_0x539a8d(0x189)]{constructor(_0x31dba1,_0x2d1d4b){const _0x561408=_0x539a8d;super(),__publicField(this,_0x561408(0x1d8),new Set()),__publicField(this,_0x561408(0x259),new FindReplaceState()),__publicField(this,'_model'),__publicField(this,_0x561408(0x137),new rxjs[(_0x561408(0x26b))](null)),__publicField(this,_0x561408(0x2af),this['_currentMatch$'][_0x561408(0x18e)]()),__publicField(this,_0x561408(0x208),new rxjs[(_0x561408(0x26b))]([])),__publicField(this,_0x561408(0x1da),this[_0x561408(0x208)][_0x561408(0x18e)]()),__publicField(this,_0x561408(0x24d),new rxjs['Subject']()),__publicField(this,_0x561408(0x217),this[_0x561408(0x24d)]['asObservable']()),(this[_0x561408(0x1d6)]=_0x31dba1,this[_0x561408(0x26a)]=_0x2d1d4b);}get[_0x539a8d(0x175)](){const _0x45291c=_0x539a8d;return this[_0x45291c(0x259)][_0x45291c(0x175)];}get[_0x539a8d(0x22c)](){const _0x5a97ac=_0x539a8d;return this[_0x5a97ac(0x259)]['state$'];}get[_0x539a8d(0x21b)](){const _0x24e5cb=_0x539a8d;return this['_state'][_0x24e5cb(0x21b)];}get[_0x539a8d(0x16a)](){const _0x55fd52=_0x539a8d;return this[_0x55fd52(0x259)][_0x55fd52(0x16a)];}[_0x539a8d(0x153)](){const _0x20b523=_0x539a8d;super[_0x20b523(0x153)](),this[_0x20b523(0x137)][_0x20b523(0x1c3)](null),this[_0x20b523(0x137)][_0x20b523(0x1a6)](),this['_replaceables$'][_0x20b523(0x1c3)]([]),this[_0x20b523(0x208)][_0x20b523(0x1a6)](),this[_0x20b523(0x24d)][_0x20b523(0x1a6)]();}[_0x539a8d(0x1a2)](){const _0x5098ce=_0x539a8d;var _0x104ddb;return(_0x104ddb=this[_0x5098ce(0x1d4)])==null?void 0x0:_0x104ddb[_0x5098ce(0x1a2)]();}[_0x539a8d(0x1f5)](){return this['_state']['findString'];}[_0x539a8d(0x1de)](_0x385e80){const _0x8ac2ea=_0x539a8d;this[_0x8ac2ea(0x259)]['changeState']({'findString':_0x385e80});}[_0x539a8d(0x210)](){const _0x3ff4ea=_0x539a8d;this[_0x3ff4ea(0x24d)][_0x3ff4ea(0x1c3)]();}[_0x539a8d(0x240)](_0xd25c0c){const _0x4f0a0e=_0x539a8d;_0xd25c0c?this[_0x4f0a0e(0x259)][_0x4f0a0e(0x172)]({'inputtingFindString':_0xd25c0c}):this['_state'][_0x4f0a0e(0x172)]({'inputtingFindString':'','findString':''});}[_0x539a8d(0x22f)](_0x5242fa){const _0x46713e=_0x539a8d;this['_state'][_0x46713e(0x172)]({'replaceString':_0x5242fa});}[_0x539a8d(0x1dc)](_0x1464b5){const _0x3da9e9=_0x539a8d;this['_state'][_0x3da9e9(0x172)]({'matchesTheWholeCell':_0x1464b5});}[_0x539a8d(0x271)](_0x25156b){const _0x25a8e1=_0x539a8d;this[_0x25a8e1(0x259)][_0x25a8e1(0x172)]({'caseSensitive':_0x25156b});}[_0x539a8d(0x17d)](_0x3c4ca0){const _0x92a65f=_0x539a8d;this[_0x92a65f(0x259)][_0x92a65f(0x172)]({'findBy':_0x3c4ca0}),this[_0x92a65f(0x219)](_0x3c4ca0==='formula');}[_0x539a8d(0x15f)](_0x5f5067){const _0x143caa=_0x539a8d;this[_0x143caa(0x259)][_0x143caa(0x172)]({'findScope':_0x5f5067});}[_0x539a8d(0x158)](_0x58856b){const _0x13adfe=_0x539a8d;this[_0x13adfe(0x259)]['changeState']({'findDirection':_0x58856b});}[_0x539a8d(0x1ba)](){const _0x4574c5=_0x539a8d;this['_model']&&(this[_0x4574c5(0x259)][_0x4574c5(0x16a)]&&!this['_model'][_0x4574c5(0x216)]?(this[_0x4574c5(0x259)]['changeState']({'findString':this[_0x4574c5(0x259)]['inputtingFindString']}),this[_0x4574c5(0x1d4)][_0x4574c5(0x25f)]()):this[_0x4574c5(0x1d4)][_0x4574c5(0x1ba)](),this[_0x4574c5(0x24d)][_0x4574c5(0x1c3)]());}[_0x539a8d(0x2a8)](){const _0x32df88=_0x539a8d;this[_0x32df88(0x1d4)]&&(this[_0x32df88(0x259)]['replaceRevealed']&&!this['_model']['searched']?(this['_state'][_0x32df88(0x172)]({'findString':this['_state'][_0x32df88(0x215)]}),this['_model'][_0x32df88(0x25f)]()):this['_model']['moveToPreviousMatch'](),this[_0x32df88(0x24d)]['next']());}async[_0x539a8d(0x1bd)](){const _0x1a1c0a=_0x539a8d;return this['_model']?this[_0x1a1c0a(0x1d4)][_0x1a1c0a(0x1bd)]():!0x1;}async['replaceAll'](){const _0xe890ad=_0x539a8d;if(!this[_0xe890ad(0x1d4)])throw new Error('[FindReplaceService]\x20replaceAll:\x20model\x20is\x20not\x20initialized!');return this[_0xe890ad(0x1d4)][_0xe890ad(0x229)]();}[_0x539a8d(0x1b8)](){const _0x4d521e=_0x539a8d;this[_0x4d521e(0x259)]['changeState']({'replaceRevealed':!0x0,'inputtingFindString':this['_state'][_0x4d521e(0x277)]}),this[_0x4d521e(0x274)](!0x0);}[_0x539a8d(0x25f)](_0x27f477=!0x1){const _0x572c9e=_0x539a8d;if(this['_providers'][_0x572c9e(0x15c)]===0x0)return!0x1;this['_model']=this['_injector'][_0x572c9e(0x157)](FindReplaceModel,this[_0x572c9e(0x259)],this[_0x572c9e(0x1d8)]),this[_0x572c9e(0x1d4)][_0x572c9e(0x2af)][_0x572c9e(0x143)](_0x54eb50=>this[_0x572c9e(0x137)]['next'](_0x54eb50)),this['_model'][_0x572c9e(0x1da)]['subscribe'](_0x5b0fee=>this[_0x572c9e(0x208)][_0x572c9e(0x1c3)](_0x5b0fee));const _0x231a82=createInitFindReplaceState();return _0x27f477&&(_0x231a82[_0x572c9e(0x16a)]=!0x0),this[_0x572c9e(0x259)]['changeState'](_0x231a82),this[_0x572c9e(0x274)](_0x27f477),!0x0;}[_0x539a8d(0x1cc)](){const _0x1d44fb=_0x539a8d;var _0x93e3fd;(_0x93e3fd=this[_0x1d44fb(0x1d4)])==null||_0x93e3fd[_0x1d44fb(0x25f)]();}['terminate'](){const _0x157436=_0x539a8d;var _0x13779b;(_0x13779b=this[_0x157436(0x1d4)])==null||_0x13779b[_0x157436(0x153)](),this['_model']=null,this[_0x157436(0x219)](!0x1),this[_0x157436(0x274)](!0x1);}[_0x539a8d(0x1e8)](_0x5ead32){const _0x933f2=_0x539a8d;return this[_0x933f2(0x1d8)][_0x933f2(0x291)](_0x5ead32),core[_0x933f2(0x174)](()=>this['_providers'][_0x933f2(0x1ce)](_0x5ead32));}[_0x539a8d(0x274)](_0x29b9c1){const _0x51861d=_0x539a8d;this['_contextService'][_0x51861d(0x1c5)](FIND_REPLACE_REPLACE_REVEALED,_0x29b9c1);}[_0x539a8d(0x219)](_0x3d203d){const _0x4e89be=_0x539a8d;this[_0x4e89be(0x26a)][_0x4e89be(0x1c5)](engineRender[_0x4e89be(0x1ab)],_0x3d203d);}},__name(_a2,_0x539a8d(0x160)),_a2);FindReplaceService=__decorateClass$2([__decorateParam$2(0x0,core['Inject'](core[_0x539a8d(0x27d)])),__decorateParam$2(0x1,core[_0x539a8d(0x151)])],FindReplaceService);const ReplaceCurrentMatchCommand={'id':_0x539a8d(0x296),'type':core[_0x539a8d(0x159)][_0x539a8d(0x286)],'handler':__name(_0x59bc6a=>_0x59bc6a['get'](IFindReplaceService)[_0x539a8d(0x1bd)](),'handler')},CONFIRM_REPLACE_ALL_ID=_0x539a8d(0x13e),ReplaceAllMatchesCommand={'id':'ui.command.replace-all-matches','type':core[_0x539a8d(0x159)][_0x539a8d(0x286)],'handler':__name(async _0x1f156c=>{const _0xe6805=_0x539a8d,_0x3e24dd=_0x1f156c[_0xe6805(0x18f)](ui[_0xe6805(0x152)]),_0x567193=_0x1f156c['get'](core[_0xe6805(0x24c)]),_0x7194fe=_0x1f156c[_0xe6805(0x18f)](ui[_0xe6805(0x1c0)]);if(!await _0x3e24dd[_0xe6805(0x186)]({'id':CONFIRM_REPLACE_ALL_ID,'title':{'title':_0x567193['t'](_0xe6805(0x201))},'cancelText':_0x567193['t']('button.cancel'),'confirmText':_0x567193['t'](_0xe6805(0x204))}))return!0x1;const _0x5f0c3f=await _0x1f156c[_0xe6805(0x18f)](IFindReplaceService)['replaceAll'](),{success:_0xbb22f9,failure:_0x2d5084}=_0x5f0c3f;return _0x2d5084>0x0?(_0xbb22f9===0x0?_0x7194fe['show']({'type':design[_0xe6805(0x256)]['Error'],'content':_0x567193['t'](_0xe6805(0x275))}):_0x7194fe[_0xe6805(0x247)]({'type':design['MessageType'][_0xe6805(0x228)],'content':_0x567193['t']('find-replace.replace.partial-success',''+_0xbb22f9,''+_0x2d5084)}),!0x1):(_0x7194fe[_0xe6805(0x247)]({'type':design[_0xe6805(0x256)][_0xe6805(0x278)],'content':_0x567193['t'](_0xe6805(0x14b),''+_0xbb22f9)}),!0x0);},_0x539a8d(0x163))},OpenFindDialogOperation={'id':'ui.operation.open-find-dialog','type':core['CommandType']['OPERATION'],'handler':__name(_0x1d7265=>{const _0x5f32c3=_0x539a8d,_0x3afc32=_0x1d7265[_0x5f32c3(0x18f)](IFindReplaceService);return _0x3afc32[_0x5f32c3(0x21b)]?_0x3afc32[_0x5f32c3(0x210)]():_0x3afc32[_0x5f32c3(0x25f)](),!0x0;},'handler')},OpenReplaceDialogOperation={'id':_0x539a8d(0x185),'type':core[_0x539a8d(0x159)][_0x539a8d(0x1ff)],'handler':__name(_0x33fbaf=>{const _0xf50e08=_0x539a8d,_0x423bac=_0x33fbaf['get'](IFindReplaceService);return _0x423bac['revealed']?_0x423bac[_0xf50e08(0x16a)]?_0x423bac['focusFindInput']():_0x423bac['revealReplace']():_0x423bac[_0xf50e08(0x25f)](!0x0),!0x0;},_0x539a8d(0x163))},GoToNextMatchOperation={'type':core[_0x539a8d(0x159)][_0x539a8d(0x1ff)],'id':_0x539a8d(0x270),'handler':__name(_0x2c35ff=>(_0x2c35ff[_0x539a8d(0x18f)](IFindReplaceService)['moveToNextMatch'](),!0x0),_0x539a8d(0x163))},GoToPreviousMatchOperation={'type':core[_0x539a8d(0x159)][_0x539a8d(0x1ff)],'id':'ui.operation.go-to-previous-match','handler':__name(_0x5278d7=>(_0x5278d7[_0x539a8d(0x18f)](IFindReplaceService)['moveToPreviousMatch'](),!0x0),_0x539a8d(0x163))};var jsxRuntime={'exports':{}},reactJsxRuntime_production_min={},f=require$$0,k=Symbol['for']('react.element'),l=Symbol['for'](_0x539a8d(0x28a)),m=Object[_0x539a8d(0x169)][_0x539a8d(0x1b3)],n=f[_0x539a8d(0x235)][_0x539a8d(0x13f)],p={'key':!0x0,'ref':!0x0,'__self':!0x0,'__source':!0x0};function q(_0x4990de,_0x382b2a,_0x1f46cd){const _0xf5a293=_0x539a8d;var _0xd809ad,_0x2f283e={},_0x199e9a=null,_0x5371b1=null;_0x1f46cd!==void 0x0&&(_0x199e9a=''+_0x1f46cd),_0x382b2a[_0xf5a293(0x293)]!==void 0x0&&(_0x199e9a=''+_0x382b2a['key']),_0x382b2a['ref']!==void 0x0&&(_0x5371b1=_0x382b2a['ref']);for(_0xd809ad in _0x382b2a)m[_0xf5a293(0x26f)](_0x382b2a,_0xd809ad)&&!p[_0xf5a293(0x1b3)](_0xd809ad)&&(_0x2f283e[_0xd809ad]=_0x382b2a[_0xd809ad]);if(_0x4990de&&_0x4990de[_0xf5a293(0x182)]){for(_0xd809ad in(_0x382b2a=_0x4990de[_0xf5a293(0x182)],_0x382b2a))_0x2f283e[_0xd809ad]===void 0x0&&(_0x2f283e[_0xd809ad]=_0x382b2a[_0xd809ad]);}return{'$$typeof':k,'type':_0x4990de,'key':_0x199e9a,'ref':_0x5371b1,'props':_0x2f283e,'_owner':n[_0xf5a293(0x19c)]};}__name(q,'q'),reactJsxRuntime_production_min['Fragment']=l,reactJsxRuntime_production_min[_0x539a8d(0x243)]=q,reactJsxRuntime_production_min['jsxs']=q,jsxRuntime[_0x539a8d(0x199)]=reactJsxRuntime_production_min;var jsxRuntimeExports=jsxRuntime[_0x539a8d(0x199)];function SearchInput(_0x25d261){const _0xb30c09=_0x539a8d,{findCompleted:_0x101e39,localeService:_0x18e2aa,matchesCount:_0x1c73a7,matchesPosition:_0x5308f2,findString:_0x542318,findReplaceService:_0x37bcd0,onChange:_0x120b94,..._0x3ca3b0}=_0x25d261,_0x4e2e42=_0x101e39&&_0x1c73a7===0x0?_0x18e2aa['t']('find-replace.dialog.no-result'):_0x1c73a7===0x0?'\x20':void 0x0;return jsxRuntimeExports[_0xb30c09(0x243)](design[_0xb30c09(0x205)],{'autoFocus':!0x0,'placeholder':_0x18e2aa['t'](_0xb30c09(0x227)),'slot':jsxRuntimeExports[_0xb30c09(0x243)](design[_0xb30c09(0x25b)],{'loop':!0x0,'text':_0x4e2e42,'value':_0x5308f2,'total':_0x1c73a7,'onChange':__name(_0x105954=>{const _0x2e4b94=_0xb30c09;_0x5308f2===_0x1c73a7&&_0x105954===0x1?_0x37bcd0[_0x2e4b94(0x1ba)]():_0x5308f2===0x1&&_0x105954===_0x1c73a7||_0x105954<_0x5308f2?_0x37bcd0[_0x2e4b94(0x2a8)]():_0x37bcd0[_0x2e4b94(0x1ba)]();},_0xb30c09(0x211))}),'value':_0x542318,'onChange':__name(_0x2fa5e1=>_0x120b94==null?void 0x0:_0x120b94(_0x2fa5e1),_0xb30c09(0x211)),..._0x3ca3b0});}__name(SearchInput,_0x539a8d(0x190));const findReplaceDialogContainer=_0x539a8d(0x1ad),findReplaceExpandContainer=_0x539a8d(0x1f6),buttonText=_0x539a8d(0x234),findReplaceButtonsGroup=_0x539a8d(0x20d),findReplaceButtonsGroupRight=_0x539a8d(0x195),styles={'findReplaceDialogContainer':findReplaceDialogContainer,'findReplaceExpandContainer':findReplaceExpandContainer,'buttonText':buttonText,'findReplaceButtonsGroup':findReplaceButtonsGroup,'findReplaceButtonsGroupRight':findReplaceButtonsGroupRight};function useFindInputFocus(_0x454a30,_0x52bcb8){const _0x54079e=_0x539a8d,_0x6ab03f=require$$0[_0x54079e(0x226)](()=>{const _0x16d109=_0x54079e;var _0x2f7a0b;(_0x2f7a0b=document[_0x16d109(0x1bf)](_0x16d109(0x13b)))==null||_0x2f7a0b[_0x16d109(0x1f3)]();},[]),_0x46fcc4=require$$0['useCallback'](()=>{const _0x1189e6=_0x54079e,_0x494d2e=document[_0x1189e6(0x188)](_0x1189e6(0x1d2));return Array[_0x1189e6(0x14d)](_0x494d2e)[_0x1189e6(0x171)](_0x60d085=>_0x60d085===document['activeElement']);},[]);return require$$0[_0x54079e(0x21c)](_0x52bcb8,()=>({'focus':_0x6ab03f,'selectHasFocus':_0x46fcc4})),require$$0[_0x54079e(0x148)](()=>{const _0x45f6ca=_0x54079e,_0x4a3b78=_0x454a30[_0x45f6ca(0x217)][_0x45f6ca(0x143)](()=>_0x6ab03f());return()=>_0x4a3b78[_0x45f6ca(0x1a3)]();},[_0x454a30,_0x6ab03f]),{'focus':_0x6ab03f,'selectHasFocus':_0x46fcc4};}__name(useFindInputFocus,_0x539a8d(0x1f7));const FindDialog=require$$0['forwardRef'](__name(function(_0xc8585b,_0x477e9b){const _0x45dc71=_0x539a8d,_0x338fbd=core[_0x45dc71(0x27e)](core[_0x45dc71(0x24c)]),_0x359e07=core[_0x45dc71(0x27e)](IFindReplaceService),_0x1ef9d9=core[_0x45dc71(0x27e)](core[_0x45dc71(0x282)]),_0x4181b0=ui[_0x45dc71(0x1c8)](_0x359e07[_0x45dc71(0x22c)],void 0x0,!0x0),{findCompleted:_0x346776,findString:_0x5e6942,matchesCount:_0x12c338,matchesPosition:_0x3f8cc0}=_0x4181b0,_0x370973=require$$0[_0x45dc71(0x226)](()=>{const _0x1aec28=_0x45dc71;_0x1ef9d9[_0x1aec28(0x166)](OpenReplaceDialogOperation['id']);},[_0x1ef9d9]),_0x1fcff3=require$$0['useCallback'](_0x2dee07=>_0x359e07['changeFindString'](_0x2dee07),[_0x359e07]);return useFindInputFocus(_0x359e07,_0x477e9b),jsxRuntimeExports[_0x45dc71(0x200)](require$$0['Fragment'],{'children':[jsxRuntimeExports[_0x45dc71(0x243)](SearchInput,{'findCompleted':_0x346776,'className':'univer-find-input','matchesCount':_0x12c338,'matchesPosition':_0x3f8cc0,'findReplaceService':_0x359e07,'localeService':_0x338fbd,'findString':_0x5e6942,'onChange':_0x1fcff3}),jsxRuntimeExports[_0x45dc71(0x243)](_0x45dc71(0x1bc),{'className':styles[_0x45dc71(0x290)],'children':jsxRuntimeExports[_0x45dc71(0x243)](design[_0x45dc71(0x297)],{'type':'text','size':_0x45dc71(0x24b),'onClick':_0x370973,'children':_0x338fbd['t'](_0x45dc71(0x1fc))})})]});},_0x539a8d(0x1ed))),ReplaceDialog=require$$0[_0x539a8d(0x1e0)](__name(function(_0x23d5cb,_0x18d768){const _0x5d5de4=_0x539a8d,_0x1d072c=core[_0x5d5de4(0x27e)](IFindReplaceService),_0x4ff3a2=core[_0x5d5de4(0x27e)](core[_0x5d5de4(0x24c)]),_0x3cf0c5=core[_0x5d5de4(0x27e)](core[_0x5d5de4(0x282)]),_0x4b2bc8=core['useDependency'](ui['IMessageService']),_0x17bbeb=ui[_0x5d5de4(0x1c8)](_0x1d072c['currentMatch$'],void 0x0,!0x0),_0x28ff13=ui[_0x5d5de4(0x1c8)](_0x1d072c[_0x5d5de4(0x1da)],void 0x0,!0x0),_0x40d915=ui[_0x5d5de4(0x1c8)](_0x1d072c[_0x5d5de4(0x22c)],void 0x0,!0x0),{matchesCount:_0x35fe6e,matchesPosition:_0xf62799,findString:_0xf86684,inputtingFindString:_0x25d0a9,replaceString:_0x47600b,caseSensitive:_0x197e4b,matchesTheWholeCell:_0x2dc235,findDirection:_0x35b617,findScope:_0x36769d,findBy:_0x160e60,findCompleted:_0x20e52b}=_0x40d915,_0x5466e8=_0x25d0a9[_0x5d5de4(0x19e)]===0x0,_0x300a92=_0x35fe6e===0x0||!(_0x17bbeb!=null&&_0x17bbeb[_0x5d5de4(0x21f)]),_0x5b0e45=_0x28ff13[_0x5d5de4(0x19e)]===0x0,_0x150faf=require$$0['useCallback'](_0x5b1340=>_0x1d072c[_0x5d5de4(0x240)](_0x5b1340),[_0x1d072c]),_0x32f87c=require$$0[_0x5d5de4(0x226)](_0x2cab3e=>_0x1d072c[_0x5d5de4(0x22f)](_0x2cab3e),[_0x1d072c]),{focus:_0x511dbf}=useFindInputFocus(_0x1d072c,_0x18d768),_0x4e01e5=require$$0[_0x5d5de4(0x226)](()=>{const _0x50543d=_0x5d5de4;_0xf86684===_0x25d0a9?_0x1d072c[_0x50543d(0x1ba)]():(_0x1d072c[_0x50543d(0x1de)](_0x25d0a9),_0x1d072c[_0x50543d(0x1cc)]());},[_0xf86684,_0x25d0a9,_0x1d072c]),_0x2adeab=require$$0['useCallback'](()=>_0x3cf0c5['executeCommand'](ReplaceCurrentMatchCommand['id']),[_0x3cf0c5]),_0x397b29=require$$0[_0x5d5de4(0x226)](async()=>{const _0x46ad39=_0x5d5de4;await _0x3cf0c5[_0x46ad39(0x166)](ReplaceAllMatchesCommand['id']),_0x511dbf();},[_0x3cf0c5]),_0x53b7ff=require$$0['useCallback'](_0x4a334e=>{const _0x30b7d7=_0x5d5de4;_0x1d072c[_0x30b7d7(0x158)](_0x4a334e);},[_0x1d072c]),_0x1862a9=require$$0['useCallback'](_0x229e5a=>{const _0xce7bd9=_0x5d5de4;_0x1d072c[_0xce7bd9(0x15f)](_0x229e5a);},[_0x1d072c]),_0xf503d2=require$$0[_0x5d5de4(0x226)](_0x553444=>{_0x1d072c['changeFindBy'](_0x553444);},[_0x1d072c]),_0xb19f50=useFindScopeOptions(_0x4ff3a2),_0x39c97d=useFindDirectionOptions(_0x4ff3a2),_0x4e9a2b=useFindByOptions(_0x4ff3a2);return require$$0[_0x5d5de4(0x148)](()=>{const _0x1e335f=_0x5d5de4,_0x1eb1c7=_0x20e52b&&_0x35fe6e===0x0;let _0x5c3205=null;return _0x1eb1c7&&(_0x5c3205=_0x4b2bc8['show']({'content':_0x4ff3a2['t'](_0x1e335f(0x1b9)),'type':design['MessageType'][_0x1e335f(0x228)],'duration':0x1388})),()=>_0x5c3205==null?void 0x0:_0x5c3205['dispose']();},[_0x20e52b,_0x35fe6e,_0x4b2bc8,_0x4ff3a2]),jsxRuntimeExports['jsxs'](require$$0['Fragment'],{'children':[jsxRuntimeExports[_0x5d5de4(0x243)](design[_0x5d5de4(0x283)],{'label':_0x4ff3a2['t'](_0x5d5de4(0x280)),'children':jsxRuntimeExports[_0x5d5de4(0x243)](SearchInput,{'findCompleted':_0x20e52b,'className':'univer-find-input','matchesCount':_0x35fe6e,'matchesPosition':_0xf62799,'findReplaceService':_0x1d072c,'localeService':_0x4ff3a2,'findString':_0x25d0a9,'onChange':_0x150faf})}),jsxRuntimeExports['jsx'](design[_0x5d5de4(0x283)],{'label':_0x4ff3a2['t'](_0x5d5de4(0x20b)),'children':jsxRuntimeExports[_0x5d5de4(0x243)](design[_0x5d5de4(0x294)],{'placeholder':_0x4ff3a2['t'](_0x5d5de4(0x28b)),'value':_0x47600b,'onChange':__name(_0x57c90f=>_0x32f87c(_0x57c90f),'onChange')})}),jsxRuntimeExports[_0x5d5de4(0x243)](design[_0x5d5de4(0x283)],{'label':_0x4ff3a2['t'](_0x5d5de4(0x1f4)),'children':jsxRuntimeExports[_0x5d5de4(0x243)](design['Select'],{'value':_0x35b617,'options':_0x39c97d,'onChange':_0x53b7ff})}),jsxRuntimeExports[_0x5d5de4(0x243)](design['FormDualColumnLayout'],{'children':jsxRuntimeExports[_0x5d5de4(0x200)](require$$0[_0x5d5de4(0x14e)],{'children':[jsxRuntimeExports[_0x5d5de4(0x243)](design[_0x5d5de4(0x283)],{'label':_0x4ff3a2['t'](_0x5d5de4(0x1ea)),'children':jsxRuntimeExports[_0x5d5de4(0x243)](design[_0x5d5de4(0x285)],{'value':_0x36769d,'options':_0xb19f50,'onChange':_0x1862a9})}),jsxRuntimeExports[_0x5d5de4(0x243)](design[_0x5d5de4(0x283)],{'label':_0x4ff3a2['t']('find-replace.dialog.find-by.title'),'children':jsxRuntimeExports[_0x5d5de4(0x243)](design[_0x5d5de4(0x285)],{'value':_0x160e60,'options':_0x4e9a2b,'onChange':_0xf503d2})})]})}),jsxRuntimeExports[_0x5d5de4(0x243)](design[_0x5d5de4(0x26d)],{'children':jsxRuntimeExports[_0x5d5de4(0x200)](require$$0[_0x5d5de4(0x14e)],{'children':[jsxRuntimeExports[_0x5d5de4(0x243)](design['FormLayout'],{'children':jsxRuntimeExports['jsx'](design[_0x5d5de4(0x196)],{'checked':_0x197e4b,'onChange':__name(_0x45e650=>{const _0xa27b40=_0x5d5de4;_0x1d072c[_0xa27b40(0x271)](_0x45e650);},'onChange'),'children':_0x4ff3a2['t'](_0x5d5de4(0x13a))})}),jsxRuntimeExports['jsx'](design[_0x5d5de4(0x283)],{'children':jsxRuntimeExports[_0x5d5de4(0x243)](design[_0x5d5de4(0x196)],{'checked':_0x2dc235,'onChange':__name(_0xfb43fa=>{const _0x677543=_0x5d5de4;_0x1d072c[_0x677543(0x1dc)](_0xfb43fa);},_0x5d5de4(0x211)),'children':_0x4ff3a2['t'](_0x5d5de4(0x236))})})]})}),jsxRuntimeExports[_0x5d5de4(0x200)](_0x5d5de4(0x1bc),{'className':styles['findReplaceButtonsGroup'],'children':[jsxRuntimeExports[_0x5d5de4(0x243)](design['Button'],{'type':_0x5d5de4(0x1db),'onClick':_0x4e01e5,'disabled':_0x5466e8,'children':_0x4ff3a2['t']('find-replace.dialog.find')}),jsxRuntimeExports[_0x5d5de4(0x200)](_0x5d5de4(0x245),{'className':styles[_0x5d5de4(0x233)],'children':[jsxRuntimeExports[_0x5d5de4(0x243)](design[_0x5d5de4(0x297)],{'disabled':_0x300a92,'onClick':_0x2adeab,'children':_0x4ff3a2['t'](_0x5d5de4(0x20b))}),jsxRuntimeExports[_0x5d5de4(0x243)](design[_0x5d5de4(0x297)],{'disabled':_0x5b0e45,'onClick':_0x397b29,'children':_0x4ff3a2['t']('find-replace.dialog.replace-all')})]})]})]});},_0x539a8d(0x20f)));function FindReplaceDialog(){const _0x18fa57=_0x539a8d,_0x36da27=core[_0x18fa57(0x27e)](IFindReplaceService),_0x356b05=core['useDependency'](ui[_0x18fa57(0x1fd)]),_0x5dae12=core['useDependency'](core[_0x18fa57(0x151)]),_0x4bec5e=ui[_0x18fa57(0x1c8)](_0x36da27['state$'],void 0x0,!0x0),_0x59415a=require$$0['useRef'](null);require$$0[_0x18fa57(0x148)](()=>{const _0x375dda=_0x18fa57;let _0x2b0593;return _0x59415a['current']&&(_0x2b0593=_0x356b05['registerContainerElement'](_0x59415a[_0x375dda(0x19c)])),()=>_0x2b0593==null?void 0x0:_0x2b0593[_0x375dda(0x153)]();},[_0x356b05]);const _0xd770e7=require$$0['useRef'](null),_0x40c9b5=require$$0[_0x18fa57(0x226)](_0x5162a2=>_0x5dae12[_0x18fa57(0x1c5)](FIND_REPLACE_DIALOG_FOCUS,_0x5162a2),[_0x5dae12]),_0x552d77=require$$0[_0x18fa57(0x226)](_0x537a21=>_0x5dae12[_0x18fa57(0x1c5)](FIND_REPLACE_INPUT_FOCUS,_0x537a21),[_0x5dae12]);return require$$0[_0x18fa57(0x148)](()=>{const _0x2f2a5c=_0x18fa57;var _0x31977c;const _0x96818f=rxjs[_0x2f2a5c(0x1a5)](document,_0x2f2a5c(0x2a7))['subscribe'](_0x501033=>{const _0x5303c7=_0x2f2a5c;var _0xcf1eb9;_0x501033[_0x5303c7(0x17e)]&&((_0xcf1eb9=_0x59415a['current'])!=null&&_0xcf1eb9['contains'](_0x501033['target']))?_0x40c9b5(!0x0):_0x40c9b5(!0x1),!_0xd770e7['current']||!_0xd770e7[_0x5303c7(0x19c)][_0x5303c7(0x178)]()?_0x552d77(!0x0):_0x552d77(!0x1);});return(_0x31977c=_0xd770e7[_0x2f2a5c(0x19c)])==null||_0x31977c[_0x2f2a5c(0x1f3)](),_0x40c9b5(!0x0),_0x552d77(!0x0),()=>{const _0x281196=_0x2f2a5c;_0x96818f[_0x281196(0x1a3)](),_0x40c9b5(!0x1);};},[_0x40c9b5,_0x552d77]),jsxRuntimeExports[_0x18fa57(0x243)](_0x18fa57(0x1bc),{'className':styles['findReplaceDialogContainer'],'ref':_0x59415a,'children':_0x4bec5e[_0x18fa57(0x16a)]?jsxRuntimeExports[_0x18fa57(0x243)](ReplaceDialog,{'ref':_0xd770e7}):jsxRuntimeExports['jsx'](FindDialog,{'ref':_0xd770e7})});}__name(FindReplaceDialog,_0x539a8d(0x269));function useFindScopeOptions(_0x5031f2){const _0x7f9e8d=_0x539a8d,_0x3dd3c9=_0x5031f2['getCurrentLocale']();return require$$0[_0x7f9e8d(0x16f)](()=>[{'label':_0x5031f2['t'](_0x7f9e8d(0x21a)),'value':FindScope['SUBUNIT']},{'label':_0x5031f2['t'](_0x7f9e8d(0x266)),'value':FindScope[_0x7f9e8d(0x299)]}],[_0x3dd3c9]);}__name(useFindScopeOptions,_0x539a8d(0x140));function useFindDirectionOptions(_0x42ff4e){const _0x3013ea=_0x539a8d,_0x2cddda=_0x42ff4e[_0x3013ea(0x23f)]();return require$$0[_0x3013ea(0x16f)](()=>[{'label':_0x42ff4e['t'](_0x3013ea(0x187)),'value':FindDirection[_0x3013ea(0x19d)]},{'label':_0x42ff4e['t'](_0x3013ea(0x242)),'value':FindDirection[_0x3013ea(0x1d3)]}],[_0x2cddda]);}__name(useFindDirectionOptions,_0x539a8d(0x1e2));function useFindByOptions(_0x2e99a9){const _0x475211=_0x539a8d,_0x5307ff=_0x2e99a9['getCurrentLocale']();return require$$0[_0x475211(0x16f)](()=>[{'label':_0x2e99a9['t'](_0x475211(0x1b7)),'value':FindBy[_0x475211(0x1ec)]},{'label':_0x2e99a9['t'](_0x475211(0x1fb)),'value':FindBy[_0x475211(0x263)]}],[_0x5307ff]);}__name(useFindByOptions,'useFindByOptions');function _0x2db0(_0x1b1515,_0x5cabe9){const _0x825d42=_0x825d();return _0x2db0=function(_0x2db08c,_0x3f63fb){_0x2db08c=_0x2db08c-0x137;let _0x2deae0=_0x825d42[_0x2db08c];return _0x2deae0;},_0x2db0(_0x1b1515,_0x5cabe9);}function whenFindReplaceDialogFocused(_0x3f3f2e){const _0x5a3d42=_0x539a8d;return _0x3f3f2e[_0x5a3d42(0x156)](FIND_REPLACE_DIALOG_FOCUS);}__name(whenFindReplaceDialogFocused,'whenFindReplaceDialogFocused');function whenReplaceRevealed(_0x13188b){const _0x34ae0f=_0x539a8d;return _0x13188b[_0x34ae0f(0x156)](FIND_REPLACE_REPLACE_REVEALED);}__name(whenReplaceRevealed,_0x539a8d(0x2a2));function whenFindReplaceInputFocused(_0x40cd5d){const _0x55ba33=_0x539a8d;return _0x40cd5d[_0x55ba33(0x156)](FIND_REPLACE_INPUT_FOCUS);}__name(whenFindReplaceInputFocused,_0x539a8d(0x1b1));const FIND_REPLACE_SHORTCUT_GROUP=_0x539a8d(0x258);function whenSheetFocused(_0x397c04){const _0x2ad103=_0x539a8d;return _0x397c04[_0x2ad103(0x156)](core[_0x2ad103(0x27f)]);}__name(whenSheetFocused,'whenSheetFocused');function whenEditorNotActivated(_0xb8219a){const _0xf678a2=_0x539a8d;return!_0xb8219a['getContextValue'](core[_0xf678a2(0x1c4)]);}__name(whenEditorNotActivated,_0x539a8d(0x1df));const OpenFindDialogShortcutItem={'id':OpenFindDialogOperation['id'],'description':_0x539a8d(0x1e5),'binding':ui['KeyCode']['F']|ui[_0x539a8d(0x1fa)][_0x539a8d(0x232)],'group':FIND_REPLACE_SHORTCUT_GROUP,'preconditions'(_0x5ddaa8){return!whenFindReplaceDialogFocused(_0x5ddaa8)&&whenSheetFocused(_0x5ddaa8)&&whenEditorNotActivated(_0x5ddaa8);}},MacOpenFindDialogShortcutItem={'id':OpenFindDialogOperation['id'],'description':_0x539a8d(0x1e5),'binding':ui['KeyCode']['F']|ui[_0x539a8d(0x1fa)][_0x539a8d(0x232)],'mac':ui[_0x539a8d(0x27c)]['F']|ui[_0x539a8d(0x1fa)][_0x539a8d(0x29d)],'preconditions'(_0x401d3b){return!whenFindReplaceDialogFocused(_0x401d3b)&&whenSheetFocused(_0x401d3b)&&whenEditorNotActivated(_0x401d3b);}},OpenReplaceDialogShortcutItem={'id':OpenReplaceDialogOperation['id'],'description':_0x539a8d(0x1a7),'binding':ui[_0x539a8d(0x27c)]['H']|ui['MetaKeys'][_0x539a8d(0x232)],'mac':ui[_0x539a8d(0x27c)]['H']|ui[_0x539a8d(0x1fa)]['MAC_CTRL'],'group':FIND_REPLACE_SHORTCUT_GROUP,'preconditions'(_0x3d27da){return whenSheetFocused(_0x3d27da)&&whenEditorNotActivated(_0x3d27da)&&(!whenFindReplaceDialogFocused(_0x3d27da)||!whenReplaceRevealed(_0x3d27da));}},GoToNextFindMatchShortcutItem={'id':GoToNextMatchOperation['id'],'description':_0x539a8d(0x17b),'binding':ui[_0x539a8d(0x27c)][_0x539a8d(0x16b)],'group':FIND_REPLACE_SHORTCUT_GROUP,'priority':0x3e8,'preconditions'(_0x3163e3){return whenFindReplaceInputFocused(_0x3163e3)&&whenFindReplaceDialogFocused(_0x3163e3);}},GoToPreviousFindMatchShortcutItem={'id':GoToPreviousMatchOperation['id'],'description':_0x539a8d(0x1a0),'binding':ui['KeyCode'][_0x539a8d(0x16b)]|ui[_0x539a8d(0x1fa)][_0x539a8d(0x1e1)],'group':FIND_REPLACE_SHORTCUT_GROUP,'priority':0x3e8,'preconditions'(_0x491eb3){return whenFindReplaceInputFocused(_0x491eb3)&&whenFindReplaceDialogFocused(_0x491eb3);}};function FindReplaceMenuItemFactory(_0x46f451){const _0x3406ab=_0x539a8d,_0x31503b=_0x46f451[_0x3406ab(0x18f)](core[_0x3406ab(0x151)]);return{'id':OpenFindDialogOperation['id'],'icon':'SearchIcon','tooltip':_0x3406ab(0x15a),'type':ui['MenuItemType'][_0x3406ab(0x25c)],'hidden$':ui['getMenuHiddenObservable'](_0x46f451,core[_0x3406ab(0x218)][_0x3406ab(0x1fe)]),'disabled$':rxjs['combineLatest']([_0x31503b[_0x3406ab(0x18c)](core['EDITOR_ACTIVATED']),_0x31503b[_0x3406ab(0x18c)](core['FOCUSING_SHEET'])])[_0x3406ab(0x23c)](rxjs[_0x3406ab(0x1ee)](([_0x4c0159,_0x12068e])=>_0x4c0159||!_0x12068e))};}__name(FindReplaceMenuItemFactory,_0x539a8d(0x288));const menuSchema={[ui[_0x539a8d(0x22d)][_0x539a8d(0x184)]]:{[OpenFindDialogOperation['id']]:{'order':0x2,'menuItemFactory':FindReplaceMenuItemFactory}}};var __defProp$1=Object[_0x539a8d(0x289)],__getOwnPropDesc$1=Object[_0x539a8d(0x284)],__decorateClass$1=__name((_0x57b92a,_0x46791d,_0x26ad55,_0x3e1c35)=>{const _0x1bd394=_0x539a8d;for(var _0x299590=_0x3e1c35>0x1?void 0x0:_0x3e1c35?__getOwnPropDesc$1(_0x46791d,_0x26ad55):_0x46791d,_0x1fec63=_0x57b92a[_0x1bd394(0x19e)]-0x1,_0x1bef26;_0x1fec63>=0x0;_0x1fec63--)(_0x1bef26=_0x57b92a[_0x1fec63])&&(_0x299590=(_0x3e1c35?_0x1bef26(_0x46791d,_0x26ad55,_0x299590):_0x1bef26(_0x299590))||_0x299590);return _0x3e1c35&&_0x299590&&__defProp$1(_0x46791d,_0x26ad55,_0x299590),_0x299590;},_0x539a8d(0x1dd)),__decorateParam$1=__name((_0x20d5f6,_0x2b1732)=>(_0x6d15bd,_0x3e451b)=>_0x2b1732(_0x6d15bd,_0x3e451b,_0x20d5f6),_0x539a8d(0x27a));const FIND_REPLACE_DIALOG_ID=_0x539a8d(0x2a1),FIND_REPLACE_PANEL_WIDTH=0x15e,FIND_REPLACE_PANEL_RIGHT_PADDING=0x14,FIND_REPLACE_PANEL_TOP_PADDING=-0x5a;var _a3;exports['FindReplaceController']=(_a3=class extends core[_0x539a8d(0x1b2)]{constructor(_0x72eadf,_0x307112,_0x4007a2,_0x385b75,_0x19c74c,_0x15fdb4,_0x434e84,_0x22c0ee,_0x4b40e9,_0x21e4c6){const _0xb09888=_0x539a8d;super(),__publicField(this,'_closingListenerDisposable'),(this[_0xb09888(0x22a)]=_0x72eadf,this[_0xb09888(0x230)]=_0x307112,this[_0xb09888(0x28d)]=_0x4007a2,this['_commandService']=_0x385b75,this[_0xb09888(0x21e)]=_0x19c74c,this[_0xb09888(0x250)]=_0x15fdb4,this['_layoutService']=_0x434e84,this[_0xb09888(0x18a)]=_0x22c0ee,this[_0xb09888(0x20c)]=_0x4b40e9,this['_injector']=_0x21e4c6,this[_0xb09888(0x24f)](),this[_0xb09888(0x1e3)](),this[_0xb09888(0x203)]());}[_0x539a8d(0x153)](){const _0x6e1754=_0x539a8d;var _0x2b2b9a;super[_0x6e1754(0x153)](),(_0x2b2b9a=this['_closingListenerDisposable'])==null||_0x2b2b9a['dispose'](),this['_closingListenerDisposable']=null;}[_0x539a8d(0x24f)](){const _0x397563=_0x539a8d;[OpenFindDialogOperation,OpenReplaceDialogOperation,GoToNextMatchOperation,GoToPreviousMatchOperation,ReplaceAllMatchesCommand,ReplaceCurrentMatchCommand][_0x397563(0x24e)](_0xaaa4e4=>{const _0x1c41ed=_0x397563;this[_0x1c41ed(0x180)](this['_commandService'][_0x1c41ed(0x209)](_0xaaa4e4));});}['_initShortcuts'](){const _0x58d652=_0x539a8d;[OpenReplaceDialogShortcutItem,OpenFindDialogShortcutItem,MacOpenFindDialogShortcutItem,GoToPreviousFindMatchShortcutItem,GoToNextFindMatchShortcutItem]['forEach'](_0x4256dd=>this['disposeWithMe'](this[_0x58d652(0x28d)][_0x58d652(0x15b)](_0x4256dd)));}['_initUI'](){const _0x58c888=_0x539a8d;this[_0x58c888(0x180)](this[_0x58c888(0x20c)][_0x58c888(0x155)](_0x58c888(0x269),FindReplaceDialog)),this[_0x58c888(0x180)](this['_componentManager'][_0x58c888(0x155)](_0x58c888(0x176),SearchSingle16)),this[_0x58c888(0x230)][_0x58c888(0x164)](menuSchema),this[_0x58c888(0x21e)][_0x58c888(0x175)][_0x58c888(0x23c)](rxjs[_0x58c888(0x19a)](this['dispose$']))['subscribe'](_0x1580c9=>{const _0x71784f=_0x58c888;_0x1580c9[_0x71784f(0x21b)]===!0x0&&this[_0x71784f(0x144)]();});}[_0x539a8d(0x144)](){const _0x4cd034=_0x539a8d;this[_0x4cd034(0x250)][_0x4cd034(0x173)]({'id':FIND_REPLACE_DIALOG_ID,'draggable':!0x0,'width':FIND_REPLACE_PANEL_WIDTH,'title':{'title':this[_0x4cd034(0x18a)]['t'](_0x4cd034(0x239))},'children':{'label':'FindReplaceDialog'},'destroyOnClose':!0x0,'defaultPosition':getFindReplaceDialogDefaultPosition(),'preservePositionOnDestroy':!0x0,'onClose':__name(()=>this[_0x4cd034(0x179)](),'onClose')}),this['_closingListenerDisposable']=core[_0x4cd034(0x174)](this[_0x4cd034(0x22a)][_0x4cd034(0x273)][_0x4cd034(0x23c)](rxjs[_0x4cd034(0x19a)](this[_0x4cd034(0x168)]))[_0x4cd034(0x143)](_0x4219f1=>{const _0x10e511=_0x4cd034;(!_0x4219f1||!this[_0x10e511(0x22a)]['getUniverSheetInstance'](_0x4219f1))&&this[_0x10e511(0x179)]();}));}['closePanel'](){const _0x1283c5=_0x539a8d;this[_0x1283c5(0x249)]&&(this['_closingListenerDisposable'][_0x1283c5(0x153)](),this[_0x1283c5(0x249)]=null,this['_dialogService']['close'](FIND_REPLACE_DIALOG_ID),this[_0x1283c5(0x21e)][_0x1283c5(0x19f)](),queueMicrotask(()=>this['_layoutService'][_0x1283c5(0x1f3)]()));}},__name(_a3,_0x539a8d(0x223)),_a3),exports[_0x539a8d(0x223)]=__decorateClass$1([__decorateParam$1(0x0,core[_0x539a8d(0x279)]),__decorateParam$1(0x1,ui['IMenuManagerService']),__decorateParam$1(0x2,ui[_0x539a8d(0x20e)]),__decorateParam$1(0x3,core[_0x539a8d(0x282)]),__decorateParam$1(0x4,IFindReplaceService),__decorateParam$1(0x5,ui['IDialogService']),__decorateParam$1(0x6,ui[_0x539a8d(0x1fd)]),__decorateParam$1(0x7,core[_0x539a8d(0x1a1)](core[_0x539a8d(0x24c)])),__decorateParam$1(0x8,core[_0x539a8d(0x1a1)](ui[_0x539a8d(0x1d1)])),__decorateParam$1(0x9,core[_0x539a8d(0x1a1)](core[_0x539a8d(0x27d)]))],exports[_0x539a8d(0x223)]);function getFindReplaceDialogDefaultPosition(){const {innerWidth:_0x49a700}=window;return{'x':(_0x49a700-FIND_REPLACE_PANEL_WIDTH)/0x2-FIND_REPLACE_PANEL_RIGHT_PADDING,'y':FIND_REPLACE_PANEL_TOP_PADDING};}__name(getFindReplaceDialogDefaultPosition,_0x539a8d(0x2a4));var __defProp2=Object[_0x539a8d(0x289)],__getOwnPropDesc=Object[_0x539a8d(0x284)],__decorateClass=__name((_0x5eec7e,_0x394308,_0x13128c,_0x3fe60a)=>{const _0x480e9b=_0x539a8d;for(var _0x3661bc=_0x3fe60a>0x1?void 0x0:_0x3fe60a?__getOwnPropDesc(_0x394308,_0x13128c):_0x394308,_0x4bdfae=_0x5eec7e[_0x480e9b(0x19e)]-0x1,_0x34b166;_0x4bdfae>=0x0;_0x4bdfae--)(_0x34b166=_0x5eec7e[_0x4bdfae])&&(_0x3661bc=(_0x3fe60a?_0x34b166(_0x394308,_0x13128c,_0x3661bc):_0x34b166(_0x3661bc))||_0x3661bc);return _0x3fe60a&&_0x3661bc&&__defProp2(_0x394308,_0x13128c,_0x3661bc),_0x3661bc;},_0x539a8d(0x138)),__decorateParam=__name((_0x46cb5a,_0x51a916)=>(_0x336ce2,_0x342d5)=>_0x51a916(_0x336ce2,_0x342d5,_0x46cb5a),_0x539a8d(0x15d));const PLUGIN_NAME=_0x539a8d(0x23b);function _0x825d(){const _0x349605=['whenEditorNotActivated','forwardRef','SHIFT','useFindDirectionOptions','_initUI','throttleTime','find-replace.shortcut.open-find-dialog','url(#$1','_findString','registerFindReplaceProvider','react','find-replace.dialog.find-scope.title','findIndex','VALUE','FindDialogImpl','map','reduce','@univerjs/ui','xlink:href','evenodd','focus','find-replace.dialog.find-direction.title','getFindString','univer-find-replace-expand-container','useFindInputFocus','alpha','filter','MetaKeys','find-replace.dialog.find-by.formula','find-replace.dialog.advanced-finding','ILayoutService','UNIVER_SHEET','OPERATION','jsxs','find-replace.replace.confirm.title','38841YUOnHo','_initShortcuts','button.confirm','InputWithSlot','SearchSingle16','findBy','_replaceables$','registerCommand','createIdentifier','find-replace.dialog.replace','_componentManager','univer-find-replace-buttons-group','IShortcutService','ReplaceDIalogImpl','focusFindInput','onChange','useRef','_replaceRevealed','replaceString','inputtingFindString','searched','focusSignal$','UniverInstanceType','_toggleDisplayRawFormula','find-replace.dialog.find-scope.current-sheet','revealed','useImperativeHandle','random','_findReplaceService','replaceable','_matches','success','ReplaceCurrentMatchCommand','FindReplaceController','defIds','_matchingModel','useCallback','find-replace.dialog.find-placeholder','Warning','replaceAll','_univerInstanceService','_markMatch','state$','RibbonStartGroup','_startSearching','changeReplaceString','_menuManagerService','unit','CTRL_COMMAND','findReplaceButtonsGroupRight','univer-button-text','__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED','find-replace.dialog.match-the-whole-cell','find-replace.service','univerjs-icon\x20univerjs-icon-','find-replace.dialog.title','mask0_217_40','UNIVER_FIND_REPLACE_PLUGIN','pipe','className','svg','getCurrentLocale','changeInputtingFindString','_matchesCount','find-replace.dialog.find-direction.column','jsx','row','span','GoToNextMatchOperation','show','column','_closingListenerDisposable','FindScope','small','LocaleService','_focusSignal$','forEach','_initCommands','_dialogService','all','defs','UniverFindReplacePlugin','attrs','createElement','MessageType','concat','7_find-replace-shortcuts','_state','findDirection','Pager','BUTTON','children','_findBy','start','_findScope','icon','assign','FORMULA','#D9D9D9','Module','find-replace.dialog.find-scope.workbook','DisposableCollection','FindReplaceState','FindReplaceDialog','_contextService','BehaviorSubject','symbol','FormDualColumnLayout','findScope','call','ui.operation.go-to-next-match','changeCaseSensitive','FindReplaceModel','focused$','_toggleRevealReplace','find-replace.replace.all-failure','_stateUpdates$','findString','Success','IUniverInstanceService','__decorateParam$1','name','KeyCode','Injector','useDependency','FOCUSING_SHEET','find-replace.dialog.find','string','ICommandService','FormLayout','getOwnPropertyDescriptor','Select','COMMAND','substring','FindReplaceMenuItemFactory','defineProperty','react.fragment','find-replace.dialog.replace-placeholder','colorChannel1','_shortcutService','_config','generateShortUuid','findReplaceExpandContainer','add','613449CtGttC','key','Input','none','ui.command.replace-current-match','Button','search-single-16','UNIT','findCompleted','trim','OpenFindDialogOperation','MAC_CTRL','_stopSearching','_revealed','110okmAZh','DESKTOP_FIND_REPLACE_DIALOG','whenReplaceRevealed','_findModels','getFindReplaceDialogDefaultPosition','function','FIND_REPLACE_INPUT_FOCUS','focusin','moveToPreviousMatch','url(#mask0_217_40)','pluginName','debounceTime','Plugin','getOwnPropertySymbols','combineLatest','currentMatch$','_currentMatch$','__decorateClass','_matchesTheWholeCell','find-replace.dialog.case-sensitive','.univer-find-input\x20input','path','_state$','CONFIRM_REPLACE_ALL','ReactCurrentOwner','useFindScopeOptions','onRendered','8508gaFCgf','subscribe','_openPanel','tag','613wbpRzL','OpenReplaceDialogOperation','useEffect','_replaceString','userSpaceOnUse','find-replace.replace.all-success','subunit','from','Fragment','onStarting','IFindReplaceService','IContextService','IConfirmService','dispose','find-replace.config','register','getContextValue','createInstance','changeFindDirection','CommandType','find-replace.toolbar','registerShortcut','size','__decorateParam','FindModel','changeFindScope','FindReplaceService','caseSensitive','FIND_REPLACE_DIALOG_FOCUS','handler','mergeMenu','getUnitId','executeCommand','_currentSearchingDisposables','dispose$','prototype','replaceRevealed','ENTER','ReplaceAllMatchesCommand','replaceRuntimeIdsInDefs','flat','useMemo','getFocusedUnit','some','changeState','open','toDisposable','stateUpdates$','SearchIcon','140vCGkou','selectHasFocus','closePanel','__decorateParam$2','find-replace.shortcut.go-to-next-match','_findDirection','changeFindBy','target','FIND_REPLACE_REPLACE_REVEALED','disposeWithMe','IConfigService','defaultProps','matchesPosition','OTHERS','ui.operation.open-replace-dialog','confirm','find-replace.dialog.find-direction.row','querySelectorAll','Disposable','_localeService','activelyChangingMatch$','subscribeContextValue$','1138FzRkSe','asObservable','get','SearchInput','_moveToInitialMatch','@univerjs/engine-render','failure','UniverIcon','univer-find-replace-buttons-group-right','Checkbox','75fjAxvo','indexOf','exports','takeUntil','_moveToNextUnitMatch','current','ROW','length','terminate','find-replace.shortcut.go-to-previous-match','Inject','getCurrentMatch','unsubscribe','FindDirection','fromEvent','complete','find-replace.shortcut.open-replace-dialog','_caseSensitive','value','createInitFindReplaceState','RENDER_RAW_FORMULA_KEY','_subscribeToModelsChanges','univer-find-replace-dialog-container','_inputtingFindString','matchesTheWholeCell','displayName','whenFindReplaceInputFocused','RxDisposable','hasOwnProperty','extend','8793344agTiTu','_matchesPosition','find-replace.dialog.find-by.value','revealReplace','find-replace.dialog.no-match','moveToNextMatch','164784MMRczj','div','replace','matchesCount','querySelector','IMessageService','GoToPreviousMatchOperation','2320592iIUoGh','next','EDITOR_ACTIVATED','setContextValue','fill','1em','useObservable','M2.39551\x207.37266C2.39551\x204.18105\x204.98281\x201.59375\x208.17441\x201.59375C11.366\x201.59375\x2013.9533\x204.18105\x2013.9533\x207.37266C13.9533\x208.72342\x2013.4898\x209.96603\x2012.7133\x2010.95L15.1964\x2013.4331C15.4619\x2013.6986\x2015.4619\x2014.1291\x2015.1964\x2014.3946C14.9309\x2014.6601\x2014.5004\x2014.6601\x2014.2349\x2014.3946L11.7518\x2011.9115C10.7678\x2012.6881\x209.52525\x2013.1516\x208.17441\x2013.1516C4.98281\x2013.1516\x202.39551\x2010.5642\x202.39551\x207.37266ZM8.17441\x202.95349C5.73378\x202.95349\x203.75525\x204.93202\x203.75525\x207.37266C3.75525\x209.81333\x205.73378\x2011.7918\x208.17441\x2011.7918C10.6151\x2011.7918\x2012.5936\x209.81333\x2012.5936\x207.37266C12.5936\x204.93202\x2010.6151\x202.95349\x208.17441\x202.95349Z','state','render','find','38996CiizLo','delete','_configService','_findCompleted','ComponentManager','.univer-find-replace-dialog-container\x20.univer-select-selection-search-input','COLUMN','_model','idSuffix','_injector','@univerjs/design','_providers','unitId','replaceables$','primary','changeMatchesTheWholeCell','__decorateClass$1','changeFindString'];_0x825d=function(){return _0x349605;};return _0x825d();}var _a4;exports[_0x539a8d(0x253)]=(_a4=class extends core[_0x539a8d(0x2ac)]{constructor(_0x2b4e3b=defaultPluginConfig,_0x3d39a6,_0x4f0bf5){const _0x3c3db9=_0x539a8d;super(),this[_0x3c3db9(0x28e)]=_0x2b4e3b,this['_injector']=_0x3d39a6,this[_0x3c3db9(0x1cf)]=_0x4f0bf5;const {..._0x3873c2}=this[_0x3c3db9(0x28e)];this['_configService']['setConfig'](PLUGIN_CONFIG_KEY,_0x3873c2);}[_0x539a8d(0x14f)](){const _0x5b87e9=_0x539a8d;[[exports['FindReplaceController']],[IFindReplaceService,{'useClass':FindReplaceService}]][_0x5b87e9(0x24e)](_0x1a21dc=>this[_0x5b87e9(0x1d6)]['add'](_0x1a21dc));}[_0x539a8d(0x141)](){const _0x36e985=_0x539a8d;this[_0x36e985(0x1d6)][_0x36e985(0x18f)](exports[_0x36e985(0x223)]);}},__name(_a4,_0x539a8d(0x253)),__publicField(_a4,_0x539a8d(0x2aa),PLUGIN_NAME),_a4),exports['UniverFindReplacePlugin']=__decorateClass([__decorateParam(0x1,core['Inject'](core[_0x539a8d(0x27d)])),__decorateParam(0x2,core[_0x539a8d(0x181)])],exports[_0x539a8d(0x253)]),exports['FindBy']=FindBy,exports[_0x539a8d(0x1a4)]=FindDirection,exports[_0x539a8d(0x15e)]=FindModel,exports[_0x539a8d(0x24a)]=FindScope,exports[_0x539a8d(0x246)]=GoToNextMatchOperation,exports[_0x539a8d(0x1c1)]=GoToPreviousMatchOperation,exports[_0x539a8d(0x150)]=IFindReplaceService,exports[_0x539a8d(0x29c)]=OpenFindDialogOperation,exports[_0x539a8d(0x147)]=OpenReplaceDialogOperation,exports[_0x539a8d(0x16c)]=ReplaceAllMatchesCommand,exports[_0x539a8d(0x222)]=ReplaceCurrentMatchCommand;