@univerjs/sheets-hyper-link-ui 0.5.4 → 0.5.5-experimental.20250123-34738ff
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/facade.js +1 -1
- package/lib/cjs/index.js +1 -9
- package/lib/cjs/locale/en-US.js +1 -1
- package/lib/cjs/locale/fa-IR.js +1 -1
- package/lib/cjs/locale/fr-FR.js +1 -1
- package/lib/cjs/locale/ru-RU.js +1 -1
- package/lib/cjs/locale/vi-VN.js +1 -1
- package/lib/cjs/locale/zh-CN.js +1 -1
- package/lib/cjs/locale/zh-TW.js +1 -1
- package/lib/es/facade.js +14 -10
- package/lib/es/index.js +1316 -1326
- package/lib/es/locale/en-US.js +2 -2
- package/lib/es/locale/fa-IR.js +2 -2
- package/lib/es/locale/fr-FR.js +2 -2
- package/lib/es/locale/ru-RU.js +2 -2
- package/lib/es/locale/vi-VN.js +2 -2
- package/lib/es/locale/zh-CN.js +2 -2
- package/lib/es/locale/zh-TW.js +2 -2
- package/lib/types/views/CellLinkEdit/index.d.ts +16 -2
- package/lib/types/views/CellLinkPopup/index.d.ts +2 -3
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -9
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +17 -17
- package/LICENSE +0 -176
package/lib/es/locale/en-US.js
CHANGED
package/lib/es/locale/fa-IR.js
CHANGED
package/lib/es/locale/fr-FR.js
CHANGED
package/lib/es/locale/ru-RU.js
CHANGED
package/lib/es/locale/vi-VN.js
CHANGED
package/lib/es/locale/zh-CN.js
CHANGED
package/lib/es/locale/zh-TW.js
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
2
16
|
export declare const CellLinkEdit: {
|
|
3
|
-
():
|
|
17
|
+
(): import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
4
18
|
componentKey: string;
|
|
5
19
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ICustomRange, Nullable } from '@univerjs/core';
|
|
2
|
-
import { default as React } from 'react';
|
|
3
2
|
import { HyperLinkEditSourceType } from '../../types/enums/edit-source';
|
|
4
3
|
interface ICellLinkPopupPureProps {
|
|
5
4
|
customRange?: Nullable<ICustomRange>;
|
|
@@ -11,9 +10,9 @@ interface ICellLinkPopupPureProps {
|
|
|
11
10
|
copyPermission?: boolean;
|
|
12
11
|
type: HyperLinkEditSourceType;
|
|
13
12
|
}
|
|
14
|
-
export declare const CellLinkPopupPure: (props: ICellLinkPopupPureProps) =>
|
|
13
|
+
export declare const CellLinkPopupPure: (props: ICellLinkPopupPureProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
15
14
|
export declare const CellLinkPopup: {
|
|
16
|
-
():
|
|
15
|
+
(): import("react/jsx-runtime").JSX.Element | null;
|
|
17
16
|
componentKey: string;
|
|
18
17
|
};
|
|
19
18
|
export {};
|
package/lib/umd/facade.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(global,factory){typeof exports=="object"&&typeof module<"u"?factory(require("@univerjs/sheets-hyper-link"),require("@univerjs/sheets-hyper-link-ui"),require("@univerjs/sheets-hyper-link/facade"),require("@univerjs/sheets/facade")):typeof define=="function"&&define.amd?define(["@univerjs/sheets-hyper-link","@univerjs/sheets-hyper-link-ui","@univerjs/sheets-hyper-link/facade","@univerjs/sheets/facade"],factory):(global=typeof globalThis<"u"?globalThis:global||self,factory(global.UniverSheetsHyperLink,global.UniverSheetsHyperLinkUi,global.UniverSheetsHyperLinkFacade,global.UniverSheetsFacade))})(this,function(sheetsHyperLink,sheetsHyperLinkUi,facade$1,facade){"use strict";var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});const _FWorkbookHyperLinkUIMixin=class _FWorkbookHyperLinkUIMixin extends facade$1.FWorkbookHyperLinkMixin{navigateToSheetHyperlink(hyperlink){const parserService=this._injector.get(sheetsHyperLink.SheetsHyperLinkParserService),resolverService=this._injector.get(sheetsHyperLinkUi.SheetsHyperLinkResolverService),info=parserService.parseHyperLink(hyperlink);resolverService.navigate(info)}};__name(_FWorkbookHyperLinkUIMixin,"FWorkbookHyperLinkUIMixin");let FWorkbookHyperLinkUIMixin=_FWorkbookHyperLinkUIMixin;facade.FWorkbook.extend(FWorkbookHyperLinkUIMixin)});
|
package/lib/umd/index.js
CHANGED
|
@@ -1,9 +1 @@
|
|
|
1
|
-
(function(g,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("@univerjs/core"),require("@univerjs/sheets-hyper-link"),require("@univerjs/sheets-ui"),require("@univerjs/design"),require("@univerjs/engine-formula"),require("@univerjs/sheets"),require("@univerjs/ui"),require("@univerjs/docs-ui"),require("@univerjs/engine-render"),require("rxjs"),require("@univerjs/docs"),require("react"),require("@univerjs/sheets-formula-ui"),require("@univerjs/sheets-data-validation")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets-hyper-link","@univerjs/sheets-ui","@univerjs/design","@univerjs/engine-formula","@univerjs/sheets","@univerjs/ui","@univerjs/docs-ui","@univerjs/engine-render","rxjs","@univerjs/docs","react","@univerjs/sheets-formula-ui","@univerjs/sheets-data-validation"],s):(g=typeof globalThis<"u"?globalThis:g||self,s(g.UniverSheetsHyperLinkUi={},g.UniverCore,g.UniverSheetsHyperLink,g.UniverSheetsUi,g.UniverDesign,g.UniverEngineFormula,g.UniverSheets,g.UniverUi,g.UniverDocsUi,g.UniverEngineRender,g.rxjs,g.UniverDocs,g.React,g.UniverSheetsFormulaUi,g.UniverSheetsDataValidation))})(this,function(g,s,S,y,w,X,E,b,ee,pe,P,he,C,Vt,it){"use strict";var zn=Object.defineProperty;var Jn=(g,s,S)=>s in g?zn(g,s,{enumerable:!0,configurable:!0,writable:!0,value:S}):g[s]=S;var K=(g,s,S)=>Jn(g,typeof s!="symbol"?s+"":s,S);function Re(e){return s.Tools.isLegalUrl(e)}function Ft(e){return/^[a-zA-Z]+:\/\//.test(e)}function Zt(e){return/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(e)}function Wt(e){if(Re(e)){const n=Ft(e)?e:Zt(e)?`mailto://${e}`:`http://${e}`;let t;try{t=new URL(n)}catch{return e}return t.hostname===location.hostname&&t.port===location.port&&t.protocol===location.protocol&&t.pathname===location.pathname&&t.hash&&!t.search?t.hash:n}return e}const rt="sheets-hyper-link-ui.config",st={};var Kt=Object.defineProperty,Yt=Object.getOwnPropertyDescriptor,Gt=(e,n,t,i)=>{for(var r=i>1?void 0:i?Yt(n,t):n,a=e.length-1,o;a>=0;a--)(o=e[a])&&(r=(i?o(n,t,r):o(r))||r);return i&&r&&Kt(n,t,r),r},ue=(e,n)=>(t,i)=>n(t,i,e);function $t(e,n){const t=n.getMergeData(),i=n.getMaxColumns()-1,r=n.getMaxRows()-1;if(i<e.endColumn&&(e.endColumn=i),r<e.endRow&&(e.endRow=r),e.rangeType===s.RANGE_TYPE.COLUMN||s.RANGE_TYPE.ROW)return e;const a=[];return t.forEach(o=>{s.Rectangle.intersects(e,o)&&a.push(o)}),s.Rectangle.realUnion(e,...a)}g.SheetsHyperLinkResolverService=class{constructor(n,t,i,r,a,o){this._univerInstanceService=n,this._commandService=t,this._definedNamesService=i,this._messageService=r,this._localeService=a,this._configService=o}navigate(n){switch(n.type){case S.SheetHyperLinkType.URL:this.navigateToOtherWebsite(n.url);break;default:this._navigateToUniver(n.searchObj)}}_navigateToUniver(n){const{gid:t,range:i,rangeid:r}=n,a=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!a)return;const o=a.getUnitId();if(r){const l=this._definedNamesService.getValueById(o,r);if(!l)return;const{formulaOrRefString:u}=l,p=this._definedNamesService.getWorksheetByRef(o,u);if(!p){this._messageService.show({content:this._localeService.t("hyperLink.message.refError"),type:w.MessageType.Error});return}if(p.isSheetHidden()){this._messageService.show({content:this._localeService.t("hyperLink.message.hiddenSheet"),type:w.MessageType.Error});return}this.navigateToDefineName(o,r)}if(t){if(i){const l=X.deserializeRangeWithSheet(i);s.isValidRange(l.range)&&i!==S.ERROR_RANGE&&this.navigateToRange(o,t,l.range);return}this.navigateToSheetById(o,t)}}async navigateToRange(n,t,i,r){const a=await this.navigateToSheetById(n,t);if(a){const o=$t(i,a);await this._commandService.executeCommand(E.SetSelectionsOperation.id,{unitId:n,subUnitId:t,selections:[{range:o,primary:null}]}),await this._commandService.executeCommand(y.ScrollToRangeOperation.id,{range:o,forceTop:r})}}async navigateToSheetById(n,t){const i=this._univerInstanceService.getUnit(n,s.UniverInstanceType.UNIVER_SHEET);if(!i)return!1;const r=i.getActiveSheet();if(!r)return!1;if(r.getSheetId()===t)return r;const a=i.getSheetBySheetId(t);return a?i.getHiddenWorksheets().indexOf(t)>-1?(this._messageService.show({content:this._localeService.t("hyperLink.message.hiddenSheet"),type:w.MessageType.Error}),!1):await this._commandService.executeCommand(E.SetWorksheetActiveOperation.id,{unitId:n,subUnitId:t})?a:!1:(this._messageService.show({content:this._localeService.t("hyperLink.message.noSheet"),type:w.MessageType.Error}),!1)}async navigateToDefineName(n,t){return this._definedNamesService.focusRange(n,t),!0}async navigateToOtherWebsite(n){var i;const t=this._configService.getConfig(rt);if((i=t==null?void 0:t.urlHandler)!=null&&i.navigateToOtherWebsite)return t.urlHandler.navigateToOtherWebsite(n);window.open(n,"_blank","noopener noreferrer")}},g.SheetsHyperLinkResolverService=Gt([ue(0,s.IUniverInstanceService),ue(1,s.ICommandService),ue(2,X.IDefinedNamesService),ue(3,b.IMessageService),ue(4,s.Inject(s.LocaleService)),ue(5,s.IConfigService)],g.SheetsHyperLinkResolverService);const Ve="SHEET_HYPER_LINK_UI_PLUGIN";var zt=Object.defineProperty,Jt=Object.getOwnPropertyDescriptor,Xt=(e,n,t,i)=>{for(var r=i>1?void 0:i?Jt(n,t):n,a=e.length-1,o;a>=0;a--)(o=e[a])&&(r=(i?o(n,t,r):o(r))||r);return i&&r&&zt(n,t,r),r},Pe=(e,n)=>(t,i)=>n(t,i,e);g.SheetsHyperLinkCopyPasteController=class extends s.Disposable{constructor(t,i,r,a){super();K(this,"_plainTextFilter",new Set);K(this,"_copyInfo");this._sheetClipboardService=t,this._hyperLinkModel=i,this._injector=r,this._resolverService=a,this._initCopyPaste(),this.disposeWithMe(()=>{this._plainTextFilter.clear()})}registerPlainTextFilter(t){this._plainTextFilter.add(t)}removePlainTextFilter(t){this._plainTextFilter.delete(t)}_filterPlainText(t){return Array.from(this._plainTextFilter).every(i=>i(t))}_initCopyPaste(){this._sheetClipboardService.addClipboardHook({id:Ve,onBeforeCopy:(t,i,r)=>this._collect(t,i,r),onPasteCells:(t,i,r,a)=>{const{copyType:o=y.COPY_TYPE.COPY,pasteType:l}=a,{range:u}=t||{},{range:p,unitId:d,subUnitId:h}=i;return this._generateMutations(p,{copyType:o,pasteType:l,copyRange:u,unitId:d,subUnitId:h})},onPastePlainText:(t,i)=>{const r=this._filterPlainText(i);if(Re(i)&&r){const{range:a,unitId:o,subUnitId:l}=t,{ranges:[u],mapFunc:p}=y.virtualizeDiscreteRanges([a]),d=[],h=[];return s.Range.foreach(u,(f,v)=>{const{row:R,col:L}=p(f,v),T=this._hyperLinkModel.getHyperLinkByLocation(o,l,R,L);T&&d.push({id:S.RemoveHyperLinkMutation.id,params:{unitId:o,subUnitId:l,id:T.id}}),T&&h.push({id:S.AddHyperLinkMutation.id,params:{unitId:o,subUnitId:l,link:T}})}),{redos:d,undos:h}}return{undos:[],redos:[]}},priority:99})}_collect(t,i,r){const a=new s.ObjectMatrix;this._copyInfo={unitId:t,subUnitId:i,matrix:a};const o=this._injector.invoke(p=>y.rangeToDiscreteRange(r,p,t,i));if(!o)return;const{rows:l,cols:u}=o;l.forEach((p,d)=>{u.forEach((h,f)=>{var R;const v=this._hyperLinkModel.getHyperLinkByLocation(t,i,p,h);a.setValue(d,f,(R=v==null?void 0:v.id)!=null?R:"")})})}_generateMutations(t,i){if(!this._copyInfo)return{redos:[],undos:[]};if(!this._copyInfo||!this._copyInfo.matrix.getSizeOf()||!i.copyRange)return{redos:[],undos:[]};if([y.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_COL_WIDTH,y.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_VALUE,y.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT,y.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMULA].includes(i.pasteType))return{redos:[],undos:[]};const{unitId:a,subUnitId:o}=this._copyInfo,l=[],u=[],{ranges:[p,d],mapFunc:h}=y.virtualizeDiscreteRanges([i.copyRange,t]);return y.getRepeatRange(p,d,!0).forEach(({startRange:v})=>{var R;(R=this._copyInfo)==null||R.matrix.forValue((L,T,c)=>{const k=s.Rectangle.getPositionRange({startRow:L,endRow:L,startColumn:T,endColumn:T},v),j=this._hyperLinkModel.getHyperLink(a,o,c),{row:M,col:U}=h(k.startRow,k.startColumn),V=this._hyperLinkModel.getHyperLinkByLocation(i.unitId,i.subUnitId,M,U),B=s.Tools.generateRandomId();V&&l.push({id:S.RemoveHyperLinkMutation.id,params:{unitId:i.unitId,subUnitId:i.subUnitId,id:V.id}}),j&&(l.push({id:S.AddHyperLinkMutation.id,params:{unitId:i.unitId,subUnitId:i.subUnitId,link:{...j,id:B,row:M,column:U}}}),u.push({id:S.RemoveHyperLinkMutation.id,params:{unitId:i.unitId,subUnitId:i.subUnitId,id:B}})),V&&u.push({id:S.AddHyperLinkMutation.id,params:{unitId:i.unitId,subUnitId:i.subUnitId,link:V}})})}),{redos:l,undos:u}}},g.SheetsHyperLinkCopyPasteController=Xt([Pe(0,y.ISheetClipboardService),Pe(1,s.Inject(S.HyperLinkModel)),Pe(2,s.Inject(s.Injector)),Pe(3,s.Inject(g.SheetsHyperLinkResolverService))],g.SheetsHyperLinkCopyPasteController);var I=(e=>(e.EDITING="editing",e.VIEWING="viewing",e.ZEN_EDITOR="zen_mode",e))(I||{}),Fe={exports:{}},ve={};/**
|
|
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 ot;function Qt(){if(ot)return ve;ot=1;var e=C,n=Symbol.for("react.element"),t=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,r=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function o(l,u,p){var d,h={},f=null,v=null;p!==void 0&&(f=""+p),u.key!==void 0&&(f=""+u.key),u.ref!==void 0&&(v=u.ref);for(d in u)i.call(u,d)&&!a.hasOwnProperty(d)&&(h[d]=u[d]);if(l&&l.defaultProps)for(d in u=l.defaultProps,u)h[d]===void 0&&(h[d]=u[d]);return{$$typeof:n,type:l,key:f,ref:v,props:h,_owner:r.current}}return ve.Fragment=t,ve.jsx=o,ve.jsxs=o,ve}var at;function qt(){return at||(at=1,Fe.exports=Qt()),Fe.exports}var m=qt();class Ze extends s.Disposable{constructor(){super(...arguments);K(this,"_customHyperLinks",new Map)}isBuiltInLinkType(t){return t!==S.SheetHyperLinkType.URL}getOptions(){return Array.from(this._customHyperLinks.values()).map(({option:t})=>t)}findCustomHyperLink(t){return Array.from(this._customHyperLinks.values()).find(r=>r.match(t))}registerCustomHyperLink(t){this._customHyperLinks.set(t.type,t)}getCustomHyperLink(t){return this._customHyperLinks.get(t)}removeCustomHyperLink(t){const{_customHyperLinks:i}=this;i.delete(t)}dispose(){super.dispose(),this._customHyperLinks.clear()}}const ct={cellLinkEdit:"univer-cell-link-edit",cellLinkEditButtons:"univer-cell-link-edit-buttons"},Le=()=>{var Lt;const[e,n]=C.useState(""),[t,i]=C.useState(!1),[r,a]=C.useState(""),[o,l]=C.useState(!0),[u,p]=C.useState(S.SheetHyperLinkType.URL),[d,h]=C.useState(""),f=s.useDependency(s.LocaleService),v=s.useDependency(X.IDefinedNamesService),R=s.useDependency(y.IEditorBridgeService),L=s.useDependency(s.IUniverInstanceService),T=s.useDependency(g.SheetsHyperLinkPopupService),c=b.useObservable(T.currentEditing$),k=s.useDependency(S.SheetsHyperLinkParserService),j=s.useDependency(g.SheetsHyperLinkResolverService),M=s.useDependency(s.ICommandService),U=s.useDependency(Ze),V=C.useMemo(()=>U.getOptions(),[U]),B=s.useDependency(b.IZenZoneService),Q=s.useDependency(pe.IRenderManagerService),fe=s.useDependency(y.IMarkSelectionService),Be=s.useDependency(he.DocSelectionManagerService),ae=s.useDependency(s.IContextService),me=s.useDependency(s.ThemeService),Ie=s.useDependency(he.DocSelectionManagerService),ye=C.useRef({}),ce=C.useMemo(()=>{if(!U.isBuiltInLinkType(u))return U.getCustomHyperLink(u)},[U,u]),[W,Zn]=C.useState(!1),[Ce,Xe]=C.useState(!1),F=C.useRef(!1),$=L.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET),Wn=($==null?void 0:$.getActiveSheet().getSheetId())||"",te=C.useCallback(_=>{a(_.replaceAll(s.DataStreamTreeTokenType.CUSTOM_RANGE_START,"").replaceAll(s.DataStreamTreeTokenType.CUSTOM_RANGE_END,""))},[a]);C.useEffect(()=>{var _,D,O,N,x,z,Tt,Ot,kt,Dt,bt,wt,Nt,Mt,Ut,Ht,xt;if((c==null?void 0:c.row)!==void 0&&c.col!==void 0){const{customRange:le,row:tt,col:nt}=c;let{label:q}=c;typeof q=="number"&&(q=`${q}`);let J;if(le)J={id:(_=le==null?void 0:le.rangeId)!=null?_:"",display:q!=null?q:"",payload:(O=(D=le==null?void 0:le.properties)==null?void 0:D.url)!=null?O:"",row:tt,column:nt};else if(c.type===I.VIEWING){const H=L.getUnit(c.unitId),ie=H==null?void 0:H.getSheetBySheetId(c.subUnitId),A=ie==null?void 0:ie.getCellRaw(c.row,c.col),de=(z=(x=(N=A==null?void 0:A.p)==null?void 0:N.body)==null?void 0:x.customRanges)==null?void 0:z.find(At=>{var Bt;return At.rangeType===s.CustomRangeType.HYPERLINK&&((Bt=At.properties)==null?void 0:Bt.url)}),Ee=A==null?void 0:A.v;A&&(!s.BuildTextUtils.transform.isEmptyDocument((Ot=(Tt=A.p)==null?void 0:Tt.body)==null?void 0:Ot.dataStream)||s.Tools.isDefine(Ee))&&l(!1),J={id:"",display:"",payload:(Dt=(kt=de==null?void 0:de.properties)==null?void 0:kt.url)!=null?Dt:"",row:tt,column:nt}}else{const H=L.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC),ie=Be.getActiveTextRange(),A=H==null?void 0:H.getBody(),de=ie&&A?ie:null,Ee=de&&((wt=s.BuildTextUtils.customRange.getCustomRangesInterestsWithSelection(de,(bt=A==null?void 0:A.customRanges)!=null?bt:[]))==null?void 0:wt[0]);l(!1),J={id:"",display:q!=null?q:"",payload:(Mt=(Nt=Ee==null?void 0:Ee.properties)==null?void 0:Nt.url)!=null?Mt:"",row:tt,column:nt}}n(J.id);const jt=U.findCustomHyperLink(J);if(jt){const H=jt.convert(J);p(H.type),h(H.payload),te(H.display);return}te(J.display);const ne=k.parseHyperLink(J.payload);switch(p(ne.type===S.SheetHyperLinkType.INVALID?S.SheetHyperLinkType.RANGE:ne.type),ne.type){case S.SheetHyperLinkType.URL:{h(ne.url),ne.url===J.display&&(F.current=!0);break}case S.SheetHyperLinkType.RANGE:{const H=ne.searchObj,ie=H.gid&&(xt=(Ht=(Ut=L.getUnit(c.unitId))==null?void 0:Ut.getSheetBySheetId(H.gid))==null?void 0:Ht.getName())!=null?xt:"",A=X.serializeRangeWithSheet(ie,X.deserializeRangeWithSheet(H.range).range);h(A),A===J.display&&(F.current=!0);break}case S.SheetHyperLinkType.SHEET:{const H=ne.searchObj;h(H.gid);break}case S.SheetHyperLinkType.DEFINE_NAME:{const H=ne.searchObj;h(H.rangeid);break}default:h("");break}}},[c,j,U,Be,L]),C.useEffect(()=>{let _=null;if(c&&!c.customRangeId&&c.type===I.VIEWING&&s.Tools.isDefine(c.row)&&s.Tools.isDefine(c.col)){const D=L.getUnit(c.unitId,s.UniverInstanceType.UNIVER_SHEET),O=D==null?void 0:D.getSheetBySheetId(c.subUnitId),N=O==null?void 0:O.getMergedCell(c.row,c.col),x=new s.ColorKit(me.getCurrentTheme().hyacinth500).toRgb();_=fe.addShape({range:N!=null?N:{startColumn:c.col,endColumn:c.col,startRow:c.row,endRow:c.row},style:{fill:`rgb(${x.r}, ${x.g}, ${x.b}, 0.12)`,strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null},[],-1)}return()=>{_&&fe.removeShape(_)}},[c,fe,me,L]),C.useEffect(()=>{Xe(u===S.SheetHyperLinkType.RANGE)},[u]),C.useEffect(()=>{const _=(c==null?void 0:c.type)===I.ZEN_EDITOR?Q.getRenderById(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY):Q.getRenderById(R.getCurrentEditorId()),D=new s.DisposableCollection;if(_){const O=_.with(ee.DocSelectionRenderService);O.setReserveRangesStatus(!0),D.add(()=>{O.setReserveRangesStatus(!1)})}return()=>{R.disableForceKeepVisible(),D.dispose()}},[c==null?void 0:c.type,R,Q]),C.useEffect(()=>(T.setIsKeepVisible(Ce),()=>{T.setIsKeepVisible(!1)}),[Ce,T]),C.useEffect(()=>()=>{B.temporaryHidden&&(B.show(),ae.setContextValue(s.FOCUSING_SHEET,!1))},[ae,B]),C.useEffect(()=>{if(Ce)return R.enableForceKeepVisible(),()=>{R.disableForceKeepVisible()}},[Ce,R]);const Kn=[{label:f.t("hyperLink.form.link"),value:S.SheetHyperLinkType.URL},{label:f.t("hyperLink.form.range"),value:S.SheetHyperLinkType.RANGE},{label:f.t("hyperLink.form.worksheet"),value:S.SheetHyperLinkType.SHEET},{label:f.t("hyperLink.form.definedName"),value:S.SheetHyperLinkType.DEFINE_NAME},...V];if(!$)return;const Yn=$.getHiddenWorksheets(),Qe=$.getSheets().map(_=>({label:_.getName(),value:_.getSheetId()})).filter(_=>Yn.indexOf(_.value)===-1),qe=Object.values((Lt=v.getDefinedNameMap($.getUnitId()))!=null?Lt:{}).map(_=>({label:_.name,value:_.id})),Pt=(_,D)=>{if(_===S.SheetHyperLinkType.URL)return Wt(D);if(_===S.SheetHyperLinkType.RANGE){const O=X.deserializeRangeWithSheet(D),N=$.getSheetBySheetName(O.sheetName);if(N)return`#gid=${N.getSheetId()}&range=${X.serializeRange(O.range)}`}return`#${_}=${D}`},Gn=b.useEvent(_=>{var x;const O=_.split(",").map(X.deserializeRangeWithSheet)[0];if(!O||!s.isValidRange(O.range))return;O.sheetName||(O.sheetName=((x=$.getActiveSheet())==null?void 0:x.getName())||"");const N=X.serializeRangeToRefString(O);h(N),N&&(F.current||!r)&&(te(N),F.current=!0)}),et=async()=>{if(o&&!r||!d||u===S.SheetHyperLinkType.URL&&!Re(d)){Zn(!0);return}if(c)if(e){const _=c.type===I.ZEN_EDITOR||c.type===I.EDITING?S.UpdateRichHyperLinkCommand.id:S.UpdateHyperLinkCommand.id;await M.executeCommand(_,{id:e,unitId:c.unitId,subUnitId:c.subUnitId,payload:{display:o?r:"",payload:Pt(u,d)},row:c.row,column:c.col,documentId:c.type===I.ZEN_EDITOR?s.DOCS_ZEN_EDITOR_UNIT_ID_KEY:R.getCurrentEditorId()})}else{const _=c.type===I.ZEN_EDITOR||c.type===I.EDITING?S.AddRichHyperLinkCommand.id:S.AddHyperLinkCommand.id;await M.executeCommand(_,{unitId:c.unitId,subUnitId:c.subUnitId,link:{id:s.generateRandomId(),row:c.row,column:c.col,payload:Pt(u,d),display:o?r:""},documentId:c.type===I.ZEN_EDITOR?s.DOCS_ZEN_EDITOR_UNIT_ID_KEY:R.getCurrentEditorId()})}if((c==null?void 0:c.type)===I.VIEWING){await M.executeCommand(E.SetWorksheetActiveOperation.id,{unitId:c.unitId,subUnitId:c.subUnitId});const _=1;await M.executeCommand(y.ScrollToRangeOperation.id,{range:{startRow:Math.max(c.row-_,0),endRow:c.row+_,startColumn:Math.max(c.col-_,0),endColumn:c.col+_}})}M.executeCommand(Se.id)},$n=_=>{var O;if(u!==S.SheetHyperLinkType.RANGE)return;const D=(O=ye.current)==null?void 0:O.handleOutClick;D&&D(_,()=>Xe(!1))};return c?m.jsxs("div",{className:ct.cellLinkEdit,style:{display:t?"none":"block"},onClick:$n,children:[o?m.jsx(w.FormLayout,{label:f.t("hyperLink.form.label"),error:W&&!r?f.t("hyperLink.form.inputError"):"",children:m.jsx(w.Input,{value:r,onChange:_=>{te(_),F.current=!1},placeholder:f.t("hyperLink.form.labelPlaceholder"),autoFocus:!0,onKeyDown:_=>{_.keyCode===b.KeyCode.ENTER&&et()}})}):null,m.jsx(w.FormLayout,{label:f.t("hyperLink.form.type"),children:m.jsx(w.Select,{options:Kn,value:u,onChange:_=>{p(_),h("")}})}),u===S.SheetHyperLinkType.URL&&m.jsx(w.FormLayout,{error:W?d?Re(d)?"":f.t("hyperLink.form.linkError"):f.t("hyperLink.form.inputError"):"",children:m.jsx(w.Input,{value:d,onChange:_=>{h(_),_&&(F.current||!r||r===d)&&(te(_),F.current=!0)},placeholder:f.t("hyperLink.form.linkPlaceholder"),autoFocus:!0,onKeyDown:_=>{_.keyCode===b.KeyCode.ENTER&&et()}})}),u===S.SheetHyperLinkType.RANGE&&m.jsx(w.FormLayout,{error:W&&!d?f.t("hyperLink.form.inputError"):"",children:m.jsx(Vt.RangeSelector,{unitId:$.getUnitId(),subUnitId:Wn,isOnlyOneRange:!0,isSupportAcrossSheet:!0,initValue:d,onChange:Gn,isFocus:Ce,onFocus:()=>Xe(!0),actions:ye.current,onRangeSelectorDialogVisibleChange:async _=>{var D,O;if(_)c.type===I.ZEN_EDITOR&&(B.hide(),ae.setContextValue(s.FOCUSING_SHEET,!0)),c.type!==I.VIEWING&&R.enableForceKeepVisible(),i(!0);else{if(await j.navigateToRange(c.unitId,c.subUnitId,{startRow:c.row,endRow:c.row,startColumn:c.col,endColumn:c.col},!0),c.type===I.ZEN_EDITOR){await M.executeCommand(E.SetSelectionsOperation.id,{unitId:c.unitId,subUnitId:c.subUnitId,selections:[{range:{startRow:c.row,endRow:c.row,startColumn:c.col,endColumn:c.col}}]}),B.show(),ae.setContextValue(s.FOCUSING_SHEET,!1);const N=(D=Q.getRenderById(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY))==null?void 0:D.with(ee.DocBackScrollRenderController),x=(O=Ie.getTextRanges({unitId:s.DOCS_ZEN_EDITOR_UNIT_ID_KEY,subUnitId:s.DOCS_ZEN_EDITOR_UNIT_ID_KEY}))==null?void 0:O[0];N&&x&&(N.scrollToRange(x),Ie.refreshSelection({unitId:s.DOCS_ZEN_EDITOR_UNIT_ID_KEY,subUnitId:s.DOCS_ZEN_EDITOR_UNIT_ID_KEY}))}R.disableForceKeepVisible(),i(!1)}}})}),u===S.SheetHyperLinkType.SHEET&&m.jsx(w.FormLayout,{error:W&&!d?f.t("hyperLink.form.selectError"):"",children:m.jsx(w.Select,{options:Qe,value:d,onChange:_=>{var N,x;h(_);const D=(N=Qe.find(z=>z.value===_))==null?void 0:N.label,O=(x=Qe.find(z=>z.value===d))==null?void 0:x.label;D&&(F.current||!r||r===O)&&(te(D),F.current=!0)}})}),u===S.SheetHyperLinkType.DEFINE_NAME&&m.jsx(w.FormLayout,{error:W&&!d?f.t("hyperLink.form.selectError"):"",children:m.jsx(w.Select,{options:qe,value:d,onChange:_=>{var N,x;h(_);const D=(N=qe.find(z=>z.value===_))==null?void 0:N.label,O=(x=qe.find(z=>z.value===d))==null?void 0:x.label;D&&(F.current||!r||r===O)&&(te(D),F.current=!0)}})}),(ce==null?void 0:ce.Form)&&m.jsx(ce.Form,{linkId:e,payload:d,display:r,showError:W,setByPayload:F,setDisplay:_=>{te(_),F.current=!0},setPayload:h}),m.jsxs("div",{className:ct.cellLinkEditButtons,children:[m.jsx(w.Button,{onClick:()=>{c&&j.navigateToRange(c.unitId,c.subUnitId,{startRow:c.row,endRow:c.row,startColumn:c.col,endColumn:c.col},!0),M.executeCommand(Se.id)},children:f.t("hyperLink.form.cancel")}),m.jsx(w.Button,{type:"primary",style:{marginLeft:8},onClick:async()=>{et()},children:f.t("hyperLink.form.ok")})]})]}):null};Le.componentKey="univer.sheet.cell-link-edit";var Z=function(){return Z=Object.assign||function(e){for(var n,t=1,i=arguments.length;t<i;t++){n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Z.apply(this,arguments)},en=function(e,n){var t={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&n.indexOf(i)<0&&(t[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,i=Object.getOwnPropertySymbols(e);r<i.length;r++)n.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(t[i[r]]=e[i[r]]);return t},re=C.forwardRef(function(e,n){var t=e.icon,i=e.id,r=e.className,a=e.extend,o=en(e,["icon","id","className","extend"]),l="univerjs-icon univerjs-icon-".concat(i," ").concat(r||"").trim(),u=C.useRef("_".concat(rn()));return lt(t,"".concat(i),{defIds:t.defIds,idSuffix:u.current},Z({ref:n,className:l},o),a)});function lt(e,n,t,i,r){return C.createElement(e.tag,Z(Z({key:n},tn(e,t,r)),i),(nn(e,t).children||[]).map(function(a,o){return lt(a,"".concat(n,"-").concat(e.tag,"-").concat(o),t,void 0,r)}))}function tn(e,n,t){var i=Z({},e.attrs);t!=null&&t.colorChannel1&&i.fill==="colorChannel1"&&(i.fill=t.colorChannel1);var r=n.defIds;return!r||r.length===0||(e.tag==="use"&&i["xlink:href"]&&(i["xlink:href"]=i["xlink:href"]+n.idSuffix),Object.entries(i).forEach(function(a){var o=a[0],l=a[1];typeof l=="string"&&(i[o]=l.replace(/url\(#(.*)\)/,"url(#$1".concat(n.idSuffix,")")))})),i}function nn(e,n){var t,i=n.defIds;return!i||i.length===0?e:e.tag==="defs"&&(!((t=e.children)===null||t===void 0)&&t.length)?Z(Z({},e),{children:e.children.map(function(r){return typeof r.attrs.id=="string"&&i&&i.indexOf(r.attrs.id)>-1?Z(Z({},r),{attrs:Z(Z({},r.attrs),{id:r.attrs.id+n.idSuffix})}):r})}):e}function rn(){return Math.random().toString(36).substring(2,8)}re.displayName="UniverIcon";var sn={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M7.9999 1.12915C8.03875 1.12915 8.07673 1.13284 8.11352 1.13989H12.2599C13.6958 1.13989 14.8599 2.30395 14.8599 3.73989V7.88619C14.867 7.92301 14.8707 7.96102 14.8707 7.9999C14.8707 8.03878 14.867 8.0768 14.8599 8.11362V12.2599C14.8599 13.6958 13.6958 14.8599 12.2599 14.8599H8.11362C8.0768 14.867 8.03878 14.8707 7.9999 14.8707C7.96102 14.8707 7.92301 14.867 7.88619 14.8599H3.73989C2.30396 14.8599 1.13989 13.6958 1.13989 12.2599V8.11352C1.13284 8.07673 1.12915 8.03875 1.12915 7.9999C1.12915 7.96106 1.13284 7.92308 1.13989 7.88629V3.73989C1.13989 2.30396 2.30395 1.13989 3.73989 1.13989H7.88629C7.92308 1.13284 7.96106 1.12915 7.9999 1.12915ZM2.33989 8.5999V12.2599C2.33989 13.0331 2.9667 13.6599 3.73989 13.6599H7.3999V8.5999H2.33989ZM7.3999 7.3999H2.33989V3.73989C2.33989 2.9667 2.96669 2.33989 3.73989 2.33989H7.3999V7.3999ZM8.5999 8.5999V13.6599H12.2599C13.0331 13.6599 13.6599 13.0331 13.6599 12.2599V8.5999H8.5999ZM13.6599 7.3999H8.5999V2.33989H12.2599C13.0331 2.33989 13.6599 2.96669 13.6599 3.73989V7.3999Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Te=C.forwardRef(function(e,n){return C.createElement(re,Object.assign({},e,{id:"all-border-single",ref:n,icon:sn}))});Te.displayName="AllBorderSingle";var on={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M4.1302 12.4251C4.25802 13.7417 5.36779 14.7708 6.71792 14.7708H11.7179C13.1539 14.7708 14.3179 13.6067 14.3179 12.1708V6.1708C14.3179 4.78586 13.2351 3.65383 11.8698 3.57517C11.742 2.25858 10.6323 1.22949 9.28213 1.22949H4.28213C2.84619 1.22949 1.68213 2.39355 1.68213 3.82949V9.82949C1.68213 11.2144 2.76497 12.3465 4.1302 12.4251ZM10.6583 3.5708H6.71792C5.28198 3.5708 4.11792 4.73486 4.11792 6.1708V11.22C3.4221 11.1387 2.88213 10.5471 2.88213 9.82949V3.82949C2.88213 3.05629 3.50893 2.42949 4.28213 2.42949H9.28213C9.96695 2.42949 10.5369 2.92119 10.6583 3.5708ZM13.1179 6.1708C13.1179 5.3976 12.4911 4.7708 11.7179 4.7708H6.71792C5.94472 4.7708 5.31792 5.3976 5.31792 6.1708V12.1708C5.31792 12.944 5.94472 13.5708 6.71792 13.5708H11.7179C12.4911 13.5708 13.1179 12.944 13.1179 12.1708V6.1708Z",fillRule:"evenodd",clipRule:"evenodd"}}]},ut=C.forwardRef(function(e,n){return C.createElement(re,Object.assign({},e,{id:"copy-single",ref:n,icon:on}))});ut.displayName="CopySingle";var an={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M9.8816 1.97978C11.0177 0.843607 12.862 0.884962 14.0004 2.02342C15.1389 3.16188 15.1803 5.00612 14.0441 6.14228L11.399 8.78737C11.1608 9.02559 10.7746 9.02559 10.5363 8.78737C10.2981 8.54915 10.2981 8.16292 10.5363 7.9247L13.1814 5.2796C13.8195 4.64155 13.8217 3.57006 13.1378 2.8861C12.4538 2.20211 11.3823 2.20438 10.7443 2.84245L7.6976 5.88911L7.69317 5.89349C7.05959 6.53211 7.05894 7.60014 7.74132 8.28252C7.97954 8.52074 7.97954 8.90697 7.74132 9.14519C7.5031 9.38341 7.11687 9.38341 6.87865 9.14519C5.74016 8.00671 5.69884 6.16251 6.83497 5.02633L6.84021 5.02116L9.8816 1.97978Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M4.61426 7.2364C4.85248 6.99818 5.23871 6.99818 5.47693 7.2364C5.71515 7.47462 5.71515 7.86085 5.47693 8.09907L2.83183 10.7442C2.19375 11.3823 2.1915 12.4537 2.87547 13.1377C3.55945 13.8217 4.6309 13.8194 5.26899 13.1813L8.31566 10.1347C8.32262 10.1277 8.32971 10.121 8.33691 10.1144C8.34408 10.1064 8.3515 10.0986 8.35916 10.091C8.99721 9.45291 8.99949 8.38145 8.3155 7.69746C8.07728 7.45924 8.07728 7.07301 8.3155 6.83479C8.55372 6.59657 8.93995 6.59657 9.17817 6.83479C10.3166 7.97327 10.358 9.81748 9.22183 10.9536C9.21487 10.9606 9.20779 10.9673 9.20058 10.9739C9.19341 10.9819 9.18599 10.9897 9.17833 10.9973L6.13166 14.044C4.99548 15.1802 3.15127 15.1389 2.01279 14.0004C0.874362 12.8619 0.83297 11.0177 1.96916 9.8815L4.61426 7.2364Z"}}]},We=C.forwardRef(function(e,n){return C.createElement(re,Object.assign({},e,{id:"link-single",ref:n,icon:an}))});We.displayName="LinkSingle";var cn={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12.5935 3.47302C11.6354 2.51492 10.082 2.51492 9.12388 3.47302L7.83534 4.76157C7.60102 4.99588 7.22112 4.99588 6.98681 4.76157 6.75249 4.52725 6.75249 4.14735 6.98681 3.91304L8.27535 2.62449C9.70209 1.19776 12.0153 1.19776 13.442 2.62449 14.8688 4.05123 14.8688 6.36442 13.442 7.79116L12.1535 9.0797C11.9192 9.31402 11.5393 9.31402 11.3049 9.0797 11.0706 8.84539 11.0706 8.46549 11.3049 8.23117L12.5935 6.94263C13.5516 5.98452 13.5516 4.43113 12.5935 3.47302zM3.40637 12.6606C2.44827 11.7025 2.44827 10.1491 3.40637 9.19102L4.69492 7.90248C4.92923 7.66816 4.92923 7.28826 4.69492 7.05395 4.4606 6.81963 4.0807 6.81963 3.84639 7.05395L2.55784 8.34249C1.13111 9.76923 1.13111 12.0824 2.55784 13.5092 3.98458 14.9359 6.29777 14.9359 7.72451 13.5092L9.01305 12.2206C9.24737 11.9863 9.24737 11.6064 9.01305 11.3721 8.77874 11.1378 8.39884 11.1378 8.16452 11.3721L6.87598 12.6606C5.91787 13.6187 4.36448 13.6187 3.40637 12.6606zM3.5852 2.80332C3.35088 2.569 2.97098 2.569 2.73667 2.80332 2.50235 3.03763 2.50235 3.41753 2.73667 3.65185L12.4151 13.3302C12.6494 13.5646 13.0293 13.5646 13.2636 13.3302 13.4979 13.0959 13.4979 12.716 13.2636 12.4817L3.5852 2.80332z"}}]},dt=C.forwardRef(function(e,n){return C.createElement(re,Object.assign({},e,{id:"unlink-single",ref:n,icon:cn}))});dt.displayName="UnlinkSingle";var ln={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12.6551 1.98906C11.7476 1.08113 10.2757 1.08149 9.3686 1.98987L4.82542 6.53955C4.75087 6.61421 4.69336 6.70411 4.65682 6.80309L3.2461 10.625C3.16506 10.8446 3.21909 11.0912 3.3845 11.2568C3.54991 11.4224 3.79651 11.4767 4.01616 11.3959L7.85031 9.98517C7.94979 9.94856 8.04014 9.89077 8.11508 9.81579L12.6552 5.27327C13.5618 4.36621 13.5618 2.89607 12.6551 1.98906ZM10.2177 2.83779C10.6562 2.39869 11.3677 2.39851 11.8064 2.8374C12.2447 3.27584 12.2447 3.9865 11.8065 4.42497L7.3392 8.89457L4.82213 9.82068L5.74706 7.31487L10.2177 2.83779Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.79238 13.2999C1.46101 13.2999 1.19238 13.5685 1.19238 13.8999C1.19238 14.2313 1.46101 14.4999 1.79238 14.4999H14.4924C14.8238 14.4999 15.0924 14.2313 15.0924 13.8999C15.0924 13.5685 14.8238 13.2999 14.4924 13.2999H1.79238Z"}}]},pt=C.forwardRef(function(e,n){return C.createElement(re,Object.assign({},e,{id:"write-single",ref:n,icon:ln}))});pt.displayName="WriteSingle";var un={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"#35BD4B",d:"M3.4535 1.12549C2.7002 1.12549 2.08954 1.73615 2.08954 2.48945V13.5104C2.08954 14.2637 2.7002 14.8744 3.4535 14.8744H12.5465C13.2998 14.8744 13.9105 14.2637 13.9105 13.5104V5.0992L10.0091 1.12549H3.4535Z"}},{tag:"path",attrs:{fill:"#32A846",d:"M10.0075 1.12549L13.9104 5.09842H10.6742C10.306 5.09842 10.0075 4.79994 10.0075 4.43175V1.12549Z"}},{tag:"path",attrs:{fill:"#fff",d:"M7.8088 10.2949L6.3764 12.403C6.26259 12.5705 6.03455 12.614 5.86705 12.5002C5.69955 12.3864 5.65603 12.1584 5.76984 11.9909L7.3655 9.64252L5.94042 7.54519C5.82661 7.37769 5.87013 7.14964 6.03763 7.03583C6.20512 6.92202 6.43317 6.96555 6.54698 7.13304L7.8088 8.9901L9.07062 7.13304C9.18443 6.96555 9.41248 6.92202 9.57997 7.03583C9.74747 7.14964 9.79099 7.37769 9.67718 7.54519L8.2521 9.64252L9.84776 11.9909C9.96157 12.1584 9.91805 12.3864 9.75055 12.5002C9.58305 12.614 9.35501 12.5705 9.2412 12.403L7.8088 10.2949Z",fillRule:"evenodd",clipRule:"evenodd"}}]},ht=C.forwardRef(function(e,n){return C.createElement(re,Object.assign({},e,{id:"xlsx",ref:n,icon:un}))});ht.displayName="Xlsx";function vt(e){var n,t,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(n=0;n<r;n++)e[n]&&(t=vt(e[n]))&&(i&&(i+=" "),i+=t)}else for(t in e)e[t]&&(i&&(i+=" "),i+=t);return i}function gt(){for(var e,n,t=0,i="",r=arguments.length;t<r;t++)(e=arguments[t])&&(n=vt(e))&&(i&&(i+=" "),i+=n);return i}const Y={cellLink:"univer-cell-link",cellLinkType:"univer-cell-link-type",cellLinkContent:"univer-cell-link-content",cellLinkContentError:"univer-cell-link-content-error",cellLinkUrl:"univer-cell-link-url",cellLinkOperations:"univer-cell-link-operations",cellLinkOperation:"univer-cell-link-operation",cellLinkOperationError:"univer-cell-link-operation-error"},dn={[S.SheetHyperLinkType.URL]:m.jsx(We,{}),[S.SheetHyperLinkType.SHEET]:m.jsx(ht,{}),[S.SheetHyperLinkType.RANGE]:m.jsx(Te,{}),[S.SheetHyperLinkType.DEFINE_NAME]:m.jsx(Te,{}),[S.SheetHyperLinkType.INVALID]:m.jsx(Te,{})},St=e=>{var j,M;const n=s.useDependency(g.SheetsHyperLinkPopupService),t=s.useDependency(s.ICommandService),i=s.useDependency(b.IMessageService),r=s.useDependency(s.LocaleService),a=s.useDependency(g.SheetsHyperLinkResolverService),o=s.useDependency(y.IEditorBridgeService),l=s.useDependency(S.SheetsHyperLinkParserService),u=s.useDependency(b.IZenZoneService),{customRange:p,row:d,col:h,unitId:f,subUnitId:v,editPermission:R,copyPermission:L,type:T}=e;if(!((j=p==null?void 0:p.properties)!=null&&j.url))return null;const c=l.parseHyperLink((M=p.properties.url)!=null?M:""),k=c.type===S.SheetHyperLinkType.INVALID;return m.jsxs("div",{className:Y.cellLink,onClick:()=>n.hideCurrentPopup(),children:[m.jsxs("div",{className:gt(Y.cellLinkContent,{[Y.cellLinkContentError]:k}),onClick:()=>{u.visible||k||a.navigate(c)},children:[m.jsx("div",{className:Y.cellLinkType,children:dn[c.type]}),m.jsx(w.Tooltip,{showIfEllipsis:!0,title:c.name,asChild:!0,children:m.jsx("span",{className:Y.cellLinkUrl,children:c.name})})]}),m.jsxs("div",{className:Y.cellLinkOperations,children:[L&&m.jsx("div",{className:gt(Y.cellLinkOperation,{[Y.cellLinkOperationError]:k}),onClick:()=>{if(!k){if(c.type!==S.SheetHyperLinkType.URL){const U=new URL(window.location.href);U.hash=c.url.slice(1),navigator.clipboard.writeText(U.href)}else navigator.clipboard.writeText(c.url);i.show({content:r.t("hyperLink.message.coped"),type:w.MessageType.Info})}},children:m.jsx(w.Tooltip,{placement:"bottom",title:r.t("hyperLink.popup.copy"),children:m.jsx(ut,{})})}),R&&m.jsxs(m.Fragment,{children:[m.jsx("div",{className:Y.cellLinkOperation,onClick:()=>{t.executeCommand(ke.id,{unitId:f,subUnitId:v,row:d,col:h,customRangeId:p.rangeId,type:T})},children:m.jsx(w.Tooltip,{placement:"bottom",title:r.t("hyperLink.popup.edit"),children:m.jsx(pt,{})})}),m.jsx("div",{className:Y.cellLinkOperation,onClick:()=>{const U=T===I.EDITING||T===I.ZEN_EDITOR?S.CancelRichHyperLinkCommand.id:S.CancelHyperLinkCommand.id;t.syncExecuteCommand(U,{unitId:f,subUnitId:v,id:p.rangeId,row:d,column:h,documentId:T===I.ZEN_EDITOR?s.DOCS_ZEN_EDITOR_UNIT_ID_KEY:o.getCurrentEditorId()})&&n.hideCurrentPopup(void 0,!0)},children:m.jsx(w.Tooltip,{placement:"bottom",title:r.t("hyperLink.popup.cancel"),children:m.jsx(dt,{})})})]})]})]})},Oe=()=>{var r,a;const e=s.useDependency(g.SheetsHyperLinkPopupService),[n,t]=C.useState(null),i=s.useDependency(s.IUniverInstanceService);if(C.useEffect(()=>{t(e.currentPopup);const o=e.currentPopup$.subscribe(l=>{t(l)});return()=>{o.unsubscribe()}},[e.currentPopup,e.currentPopup$]),!n)return null;if(n.showAll){const o=i.getUnit(n.unitId,s.UniverInstanceType.UNIVER_SHEET),l=o==null?void 0:o.getSheetBySheetId(n.subUnitId),u=l==null?void 0:l.getCell(n.row,n.col),p=(a=(r=u==null?void 0:u.p)==null?void 0:r.body)==null?void 0:a.customRanges;return p!=null&&p.length?m.jsx("div",{children:p.map(d=>m.jsx(St,{...n,customRange:d},d.rangeId))}):null}return m.jsx(St,{...n})};Oe.componentKey="univer.sheet.cell-link-popup";var pn=Object.defineProperty,hn=Object.getOwnPropertyDescriptor,vn=(e,n,t,i)=>{for(var r=i>1?void 0:i?hn(n,t):n,a=e.length-1,o;a>=0;a--)(o=e[a])&&(r=(i?o(n,t,r):o(r))||r);return i&&r&&pn(n,t,r),r},se=(e,n)=>(t,i)=>n(t,i,e);const _t=(e,n)=>{var t,i;return e.unitId===n.unitId&&e.subUnitId===n.subUnitId&&e.row===n.row&&e.col===n.col&&((t=e.customRange)==null?void 0:t.rangeId)===((i=n.customRange)==null?void 0:i.rangeId)&&e.type===n.type};g.SheetsHyperLinkPopupService=class extends s.Disposable{constructor(t,i,r,a,o,l,u){super();K(this,"_currentPopup",null);K(this,"_currentPopup$",new P.Subject);K(this,"currentPopup$",this._currentPopup$.asObservable());K(this,"_currentEditingPopup",null);K(this,"_currentEditing$",new P.BehaviorSubject(null));K(this,"currentEditing$",this._currentEditing$.asObservable());K(this,"_isKeepVisible",!1);this._sheetCanvasPopManagerService=t,this._injector=i,this._univerInstanceService=r,this._editorBridgeService=a,this._textSelectionManagerService=o,this._docCanvasPopManagerService=l,this._zenZoneService=u,this.disposeWithMe(()=>{this.hideCurrentPopup(),this.endEditing(),this._currentEditing$.complete(),this._currentPopup$.complete()})}get currentPopup(){return this._currentPopup}get currentEditing(){return this._currentEditing$.getValue()}setIsKeepVisible(t){this._isKeepVisible=t}getIsKeepVisible(){return this._isKeepVisible}showPopup(t){if(this._currentPopup&&_t(t,this._currentPopup)||(this.hideCurrentPopup(void 0,!0),t.type!==I.ZEN_EDITOR&&this._zenZoneService.visible))return;const i=this._currentEditing$.getValue();if(i&&_t(t,i))return;const{unitId:r,subUnitId:a,row:o,col:l,customRangeRect:u,customRange:p}=t;let d;const h={componentKey:Oe.componentKey,direction:"bottom",onClickOutside:()=>{this.hideCurrentPopup()},onClick:()=>{this.hideCurrentPopup(t.type,!0)}};if(t.type===I.EDITING){if(!p)return;d=u&&this._sheetCanvasPopManagerService.attachPopupToAbsolutePosition(u,h)}else if(t.type===I.ZEN_EDITOR){if(!p)return;d=this._docCanvasPopManagerService.attachPopupToRange({startOffset:p.startIndex,endOffset:p.endIndex+1,collapsed:!1},h,s.DOCS_ZEN_EDITOR_UNIT_ID_KEY)}else if(t.showAll)d=this._sheetCanvasPopManagerService.attachPopupToCell(t.row,t.col,h,r,a);else{if(!p)return;d=u&&this._sheetCanvasPopManagerService.attachPopupByPosition(u,h,t)}d&&(this._currentPopup={unitId:r,subUnitId:a,disposable:d,row:o,col:l,editPermission:!!t.editPermission,copyPermission:!!t.copyPermission,customRange:p,type:t.type,showAll:t.showAll},this._currentPopup$.next(this._currentPopup))}hideCurrentPopup(t,i){var r,a;this._currentPopup&&((!t||t===this._currentPopup.type)&&this._currentPopup.disposable.canDispose()||i)&&((a=(r=this._currentPopup)==null?void 0:r.disposable)==null||a.dispose(),this._currentPopup=null,this._currentPopup$.next(null))}_getEditingRange(){var r,a,o;const t=this._editorBridgeService.isVisible().visible,i=this._editorBridgeService.getEditCellState();if(t&&i){const l=this._textSelectionManagerService.getActiveTextRange(),u=(r=i.documentLayoutObject.documentModel)==null?void 0:r.getBody();if(!u)return null;if(!l||l.collapsed)return{startOffset:0,endOffset:u.dataStream.length-2,collapsed:u.dataStream.length-2===0,label:s.BuildTextUtils.transform.getPlainText(u.dataStream)};const p=s.BuildTextUtils.customRange.getCustomRangesInterestsWithSelection(l,(o=(a=u.customRanges)==null?void 0:a.filter(f=>f.rangeType===s.CustomRangeType.HYPERLINK))!=null?o:[]);let d=l.startOffset,h=l.endOffset;return p.forEach(f=>{d=Math.min(d,f.startIndex),h=Math.max(h,f.endIndex+1)}),{startOffset:d,endOffset:h,collapsed:d===h,label:s.BuildTextUtils.transform.getPlainText(u.dataStream.slice(d,h))}}return null}get _editPopup(){return{componentKey:Le.componentKey,direction:"vertical",onClickOutside:()=>{this.getIsKeepVisible()||this.endEditing()},onContextMenu:()=>{this.getIsKeepVisible()||this.endEditing()},hiddenType:"hide"}}startAddEditing(t){var o,l,u,p,d;const{unitId:i,subUnitId:r,type:a}=t;if(a===I.ZEN_EDITOR){const h=this._univerInstanceService.getUnit(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY,s.UniverInstanceType.UNIVER_DOC);if(!h)return;const f=this._textSelectionManagerService.getActiveTextRange();if(!f)return;this._currentEditingPopup=this._docCanvasPopManagerService.attachPopupToRange(f,this._editPopup,s.DOCS_ZEN_EDITOR_UNIT_ID_KEY);const v=(o=h.getBody())==null?void 0:o.dataStream.slice(f.startOffset,f.endOffset);this._currentEditing$.next({...t,label:v})}else if(a===I.EDITING){const h=this._getEditingRange();if(!h)return;this._textSelectionManagerService.replaceDocRanges([{...h}],{unitId:s.DOCS_NORMAL_EDITOR_UNIT_ID_KEY,subUnitId:s.DOCS_NORMAL_EDITOR_UNIT_ID_KEY});const f=this._injector.get(pe.IRenderManagerService).getRenderById(s.DOCS_NORMAL_EDITOR_UNIT_ID_KEY);if(!f)return;const v=ee.calcDocRangePositions(h,f);if(!(v!=null&&v.length))return;this._currentEditingPopup=this._sheetCanvasPopManagerService.attachPopupToAbsolutePosition(v.pop(),this._editPopup,i,r),this._currentEditing$.next({...t,label:(l=h==null?void 0:h.label)!=null?l:""})}else{this._currentEditingPopup=this._sheetCanvasPopManagerService.attachPopupToCell(t.row,t.col,this._editPopup,i,r);const h=this._univerInstanceService.getUnit(i,s.UniverInstanceType.UNIVER_SHEET),f=h==null?void 0:h.getSheetBySheetId(r),v=f==null?void 0:f.getCellRaw(t.row,t.col);this._currentEditing$.next({...t,label:v!=null&&v.p?s.BuildTextUtils.transform.getPlainText((p=(u=v.p.body)==null?void 0:u.dataStream)!=null?p:""):((d=v==null?void 0:v.v)!=null?d:"").toString()})}}startEditing(t){var l,u,p,d,h,f;(l=this._currentEditingPopup)==null||l.dispose(),this.hideCurrentPopup(void 0,!0);const{unitId:i,subUnitId:r}=t;let a,o;if(t.type===I.ZEN_EDITOR){const v=this._univerInstanceService.getUnit(s.DOCS_ZEN_EDITOR_UNIT_ID_KEY,s.UniverInstanceType.UNIVER_DOC);if(a=(p=(u=v==null?void 0:v.getBody())==null?void 0:u.customRanges)==null?void 0:p.find(R=>R.rangeId===t.customRangeId),o=a?(d=v==null?void 0:v.getBody())==null?void 0:d.dataStream.slice(a.startIndex,a.endIndex+1):"",!a||!o)return;this._textSelectionManagerService.replaceTextRanges([{startOffset:a.startIndex,endOffset:a.endIndex+1}]),this._currentEditingPopup=this._docCanvasPopManagerService.attachPopupToRange({startOffset:a.startIndex,endOffset:a.endIndex,collapsed:!1},this._editPopup,s.DOCS_ZEN_EDITOR_UNIT_ID_KEY)}else if(t.type===I.EDITING){const v=y.getEditingCustomRangePosition(this._injector,t.unitId,t.subUnitId,t.row,t.col,t.customRangeId);if(!v||!((h=v.rects)!=null&&h.length))return;a=v.customRange,o=v.label,this._textSelectionManagerService.replaceTextRanges([{startOffset:a.startIndex,endOffset:a.endIndex+1}]),this._currentEditingPopup=this._sheetCanvasPopManagerService.attachPopupToAbsolutePosition(v.rects.pop(),this._editPopup,i,r)}else{const v=this._univerInstanceService.getUnit(i,s.UniverInstanceType.UNIVER_SHEET),R=v==null?void 0:v.getSheetBySheetId(r),L=R==null?void 0:R.getCellRaw(t.row,t.col),T=v==null?void 0:v.getStyles().getStyleByCell(L),c=T==null?void 0:T.tr,k=y.getCustomRangePosition(this._injector,t.unitId,t.subUnitId,t.row,t.col,t.customRangeId);if(!k||!((f=k.rects)!=null&&f.length))return;a=k.customRange,o=k.label,c?this._currentEditingPopup=this._sheetCanvasPopManagerService.attachPopupToCell(t.row,t.col,this._editPopup,i,r):this._currentEditingPopup=this._sheetCanvasPopManagerService.attachPopupByPosition(k.rects.pop(),this._editPopup,{unitId:i,subUnitId:r,row:t.row,col:t.col})}this._currentEditing$.next({...t,customRange:a,label:o})}endEditing(t){var r;const i=this._currentEditing$.getValue();i&&(!t||t===i.type)&&((r=this._currentEditingPopup)==null||r.dispose(),this._currentEditing$.next(null))}},g.SheetsHyperLinkPopupService=vn([se(0,s.Inject(y.SheetCanvasPopManagerService)),se(1,s.Inject(s.Injector)),se(2,s.IUniverInstanceService),se(3,y.IEditorBridgeService),se(4,s.Inject(he.DocSelectionManagerService)),se(5,s.Inject(ee.DocCanvasPopManagerService)),se(6,b.IZenZoneService)],g.SheetsHyperLinkPopupService);var ge=(e=>(e[e.ALLOWED=0]="ALLOWED",e[e.DISABLED_BY_CELL=1]="DISABLED_BY_CELL",e[e.ALLOW_ON_EDITING=2]="ALLOW_ON_EDITING",e))(ge||{});const gn=new Set([s.DataValidationType.CHECKBOX,s.DataValidationType.LIST,s.DataValidationType.LIST_MULTIPLE]),Ke=(e,n,t,i)=>{var l,u;const r=n.getCell(t,i);if(r!=null&&r.f||r!=null&&r.si)return 1;const a=e.has(it.SheetDataValidationModel)?e.get(it.SheetDataValidationModel):null,o=a==null?void 0:a.getRuleByLocation(n.getUnitId(),n.getSheetId(),t,i);return o&&gn.has(o.type)?!0:(u=(l=r==null?void 0:r.p)==null?void 0:l.drawingsOrder)!=null&&u.length?2:0},Sn=e=>{const n=e.get(s.IUniverInstanceService).getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!n)return!0;const t=n.getActiveSheet(),i=e.get(E.SheetsSelectionsService).getCurrentSelections();if(!i.length)return!0;const r=i[0].range.startRow,a=i[0].range.startColumn;return Ke(e,t,r,a)===1},_n=e=>{const n=e.get(he.DocSelectionManagerService),t=e.get(s.IUniverInstanceService),i=n.getTextRanges();if(!(i!=null&&i.length))return!0;const r=t.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC);return!!(!r||i.every(o=>o.collapsed)||!r.getSelfOrHeaderFooterModel(i[0].segmentId).getBody())},ke={type:s.CommandType.OPERATION,id:"sheet.operation.open-hyper-link-edit-panel",handler(e,n){if(!n)return!1;const t=e.get(g.SheetsHyperLinkPopupService);return n.customRangeId?t.startEditing(n):t.startAddEditing(n),!0}},Se={type:s.CommandType.OPERATION,id:"sheet.operation.close-hyper-link-popup",handler(e){return e.get(g.SheetsHyperLinkPopupService).endEditing(),!0}},De={type:s.CommandType.OPERATION,id:"sheet.operation.insert-hyper-link",handler(e){var h;const n=e.get(s.IUniverInstanceService),t=E.getSheetCommandTarget(n),i=e.get(y.IEditorBridgeService);if(!t)return!1;const r=e.get(s.ICommandService),o=e.get(E.SheetsSelectionsService).getCurrentLastSelection();if(!o)return!1;const l=o.range.startRow,u=o.range.startColumn,p=i.isVisible(),d=((h=n.getFocusedUnit())==null?void 0:h.getUnitId())===s.DOCS_ZEN_EDITOR_UNIT_ID_KEY;return r.executeCommand(ke.id,{unitId:t.unitId,subUnitId:t.subUnitId,row:l,col:u,type:d?I.ZEN_EDITOR:p.visible?I.EDITING:I.VIEWING})}},oe={type:s.CommandType.OPERATION,id:"sheet.operation.insert-hyper-link-toolbar",handler(e){if(Sn(e))return!1;const n=e.get(s.ICommandService);return e.get(g.SheetsHyperLinkPopupService).currentEditing?n.executeCommand(Se.id):n.executeCommand(De.id)}},Ye=(e,n=s.DOCS_ZEN_EDITOR_UNIT_ID_KEY)=>{var r;const t=e.get(s.IUniverInstanceService),i=(r=e.get(pe.IRenderManagerService).getRenderById(n))==null?void 0:r.with(ee.DocSelectionRenderService);return i?i.textSelectionInner$.pipe(P.map(()=>{const o=e.get(y.IEditorBridgeService).getEditCellState();if(!o)return!0;const l=E.getSheetCommandTarget(t,{unitId:o.unitId,subUnitId:o.sheetId});return!(l!=null&&l.worksheet)||Ke(e,l.worksheet,o.row,o.column)===1?!0:_n(e)})):P.of(!0)},ft=e=>{const n=y.getCurrentRangeDisable$(e,{workbookTypes:[E.WorkbookEditablePermission],worksheetTypes:[E.WorksheetEditPermission,E.WorksheetSetCellValuePermission,E.WorksheetInsertHyperlinkPermission],rangeTypes:[E.RangeProtectionPermissionEditPoint]},!0),t=e.get(s.IUniverInstanceService),i=e.get(E.SheetsSelectionsService),r=e.has(y.IEditorBridgeService)?e.get(y.IEditorBridgeService):null,a=t.focused$.pipe(P.filter(o=>!!o),P.map(o=>t.getUnit(o,s.UniverInstanceType.UNIVER_SHEET)),P.filter(o=>!!o),P.switchMap(o=>o.activeSheet$),P.switchMap(o=>i.selectionMoveEnd$.pipe(P.map(l=>o&&{selections:l,sheet:o}))),P.map(o=>{if(!o)return ge.DISABLED_BY_CELL;const{selections:l,sheet:u}=o;if(!l.length)return ge.DISABLED_BY_CELL;const p=l[0].range.startRow,d=l[0].range.startColumn;return Ke(e,u,p,d)}),P.switchMap(o=>{if(o===ge.DISABLED_BY_CELL)return P.of(!0);const l=(r?r.visible$:P.of(null)).pipe(P.map(p=>p!=null&&p.visible?s.DOCS_NORMAL_EDITOR_UNIT_ID_KEY:void 0)),u=e.get(s.IContextService).subscribeContextValue$(s.FOCUSING_FX_BAR_EDITOR);return P.combineLatest([l,u]).pipe(P.switchMap(([p,d])=>p?d?P.of(!0):Ye(e,p):P.of(o===ge.ALLOW_ON_EDITING)))}));return n.pipe(P.distinctUntilChanged(),P.switchMap(o=>a.pipe(P.map(l=>o||l))))},be={commandId:De.id,type:b.MenuItemType.BUTTON,title:"hyperLink.menu.add",icon:"LinkSingle"},we=e=>`${e}-zen-editor`,fn=e=>({...be,id:be.commandId,hidden$:b.getMenuHiddenObservable(e,s.UniverInstanceType.UNIVER_SHEET),disabled$:ft(e)}),mn=e=>({...be,id:we(be.commandId),hidden$:b.getMenuHiddenObservable(e,s.UniverInstanceType.UNIVER_DOC,s.DOCS_ZEN_EDITOR_UNIT_ID_KEY),disabled$:Ye(e)}),Ne={tooltip:"hyperLink.form.addTitle",commandId:oe.id,type:b.MenuItemType.BUTTON,icon:"LinkSingle"},In=e=>({...Ne,id:Ne.commandId,hidden$:b.getMenuHiddenObservable(e,s.UniverInstanceType.UNIVER_SHEET),disabled$:ft(e)}),yn=e=>({...Ne,id:we(Ne.commandId),hidden$:b.getMenuHiddenObservable(e,s.UniverInstanceType.UNIVER_DOC,s.DOCS_ZEN_EDITOR_UNIT_ID_KEY),disabled$:Ye(e)}),Ge={id:oe.id,binding:b.KeyCode.K|b.MetaKeys.CTRL_COMMAND,preconditions:y.whenSheetEditorFocused};var Cn=Object.defineProperty,En=Object.getOwnPropertyDescriptor,Rn=(e,n,t,i)=>{for(var r=i>1?void 0:i?En(n,t):n,a=e.length-1,o;a>=0;a--)(o=e[a])&&(r=(i?o(n,t,r):o(r))||r);return i&&r&&Cn(n,t,r),r},mt=(e,n)=>(t,i)=>n(t,i,e);let Me=class extends s.Disposable{constructor(e,n){super(),this._autoFillService=e,this._hyperLinkModel=n,this._initAutoFill()}_initAutoFill(){const e=()=>({redos:[],undos:[]}),n=(i,r)=>{const{source:a,target:o,unitId:l,subUnitId:u}=i,p=y.virtualizeDiscreteRanges([a,o]),[d,h]=p.ranges,{mapFunc:f}=p,v={row:d.startRow,col:d.startColumn},R=y.getAutoFillRepeatRange(d,h),L=[],T=[];return R.forEach(c=>{const k=c.repeatStartCell,j=c.relativeRange,M={startRow:v.row,startColumn:v.col,endColumn:v.col,endRow:v.row},U={startRow:k.row,startColumn:k.col,endColumn:k.col,endRow:k.row};s.Range.foreach(j,(V,B)=>{const Q=s.Rectangle.getPositionRange({startRow:V,startColumn:B,endColumn:B,endRow:V},M),{row:fe,col:Be}=f(Q.startRow,Q.startColumn),ae=this._hyperLinkModel.getHyperLinkByLocation(l,u,fe,Be),me=s.Rectangle.getPositionRange({startRow:V,startColumn:B,endColumn:B,endRow:V},U),{row:Ie,col:ye}=f(me.startRow,me.startColumn),ce=s.Tools.generateRandomId(),W=this._hyperLinkModel.getHyperLinkByLocation(l,u,Ie,ye);W&&L.push({id:S.RemoveHyperLinkMutation.id,params:{unitId:l,subUnitId:u,id:W.id}}),(y.APPLY_TYPE.COPY===r||y.APPLY_TYPE.SERIES===r)&&ae&&(L.push({id:S.AddHyperLinkMutation.id,params:{unitId:l,subUnitId:u,link:{...ae,id:ce,row:Ie,column:ye}}}),T.push({id:S.RemoveHyperLinkMutation.id,params:{unitId:l,subUnitId:u,id:ce}})),W&&T.push({id:S.AddHyperLinkMutation.id,params:{unitId:l,subUnitId:u,link:W}})})}),{undos:T,redos:L}},t={id:Ve,onFillData:(i,r,a)=>a===y.APPLY_TYPE.COPY||a===y.APPLY_TYPE.ONLY_FORMAT||a===y.APPLY_TYPE.SERIES?n(i,a):e()};this.disposeWithMe(this._autoFillService.addHook(t))}};Me=Rn([mt(0,y.IAutoFillService),mt(1,s.Inject(S.HyperLinkModel))],Me);var Pn=Object.defineProperty,Ln=Object.getOwnPropertyDescriptor,Tn=(e,n,t,i)=>{for(var r=i>1?void 0:i?Ln(n,t):n,a=e.length-1,o;a>=0;a--)(o=e[a])&&(r=(i?o(n,t,r):o(r))||r);return i&&r&&Pn(n,t,r),r},$e=(e,n)=>(t,i)=>n(t,i,e);let Ue=class extends s.Disposable{constructor(e,n,t){super(),this._localeService=e,this._commandService=n,this._sheetPermissionCheckController=t,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(e=>{e.id===Ge.id&&(this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[E.WorkbookEditablePermission],rangeTypes:[E.RangeProtectionPermissionEditPoint],worksheetTypes:[E.WorksheetEditPermission,E.WorksheetSetCellValuePermission,E.WorksheetInsertHyperlinkPermission]})||this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.hyperLinkErr")))}))}};Ue=Tn([$e(0,s.Inject(s.LocaleService)),$e(1,s.ICommandService),$e(2,s.Inject(E.SheetPermissionCheckController))],Ue);var On=Object.defineProperty,kn=Object.getOwnPropertyDescriptor,Dn=(e,n,t,i)=>{for(var r=i>1?void 0:i?kn(n,t):n,a=e.length-1,o;a>=0;a--)(o=e[a])&&(r=(i?o(n,t,r):o(r))||r);return i&&r&&On(n,t,r),r},G=(e,n)=>(t,i)=>n(t,i,e);let He=class extends s.Disposable{constructor(e,n,t,i,r,a,o,l,u,p){super(),this._hoverManagerService=e,this._sheetsHyperLinkPopupService=n,this._renderManagerService=t,this._permissionService=i,this._sheetPermissionCheckController=r,this._commandService=a,this._editorBridgeService=o,this._textSelectionManagerService=l,this._univerInstanceService=u,this._zenZoneService=p,this._initHoverListener(),this._initCommandListener(),this._initHoverEditingListener(),this._initTextSelectionListener(),this._initZenEditor()}_getLinkPermission(e){const{unitId:n,subUnitId:t,row:i,col:r}=e,a=this._univerInstanceService.getUnit(n,s.UniverInstanceType.UNIVER_SHEET);if(!(a==null?void 0:a.getSheetBySheetId(t)))return{viewPermission:!1,editPermission:!1,copyPermission:!1};const l=this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[E.WorkbookViewPermission],worksheetTypes:[E.WorksheetViewPermission],rangeTypes:[E.RangeProtectionPermissionViewPoint]},[{startRow:i,startColumn:r,endRow:i,endColumn:r}]),u=this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[E.WorkbookEditablePermission],worksheetTypes:[E.WorksheetEditPermission,E.WorksheetInsertHyperlinkPermission],rangeTypes:[E.RangeProtectionPermissionEditPoint]},[{startRow:i,startColumn:r,endRow:i,endColumn:r}]),p=this._permissionService.composePermission([new E.WorkbookCopyPermission(n).id,new E.WorksheetCopyPermission(n,t).id]).every(d=>d.value);return{viewPermission:l,editPermission:u,copyPermission:p}}_initHoverListener(){this.disposeWithMe(this._hoverManagerService.currentRichText$.pipe(P.debounceTime(200)).subscribe(e=>{var M,U;if(!e){this._sheetsHyperLinkPopupService.hideCurrentPopup();return}const{unitId:n,subUnitId:t,row:i,col:r}=e,a=this._renderManagerService.getRenderById(n);if(!a)return;const o=this._univerInstanceService.getUnit(n,s.UniverInstanceType.UNIVER_SHEET),l=o==null?void 0:o.getSheetBySheetId(t);if(!l)return;if(!a.with(y.HoverRenderController).active){this._sheetsHyperLinkPopupService.hideCurrentPopup(I.VIEWING);return}const p=(M=a==null?void 0:a.with(y.SheetSkeletonManagerService).getWorksheetSkeleton(t))==null?void 0:M.skeleton,d=r,h=i;let f=h,v=d;p&&p.overflowCache.forValue((V,B,Q)=>{s.Rectangle.contains(Q,{startColumn:d,endColumn:d,startRow:h,endRow:h})&&(f=V,v=B)});const{viewPermission:R,editPermission:L,copyPermission:T}=this._getLinkPermission(e);if(!R){this._sheetsHyperLinkPopupService.hideCurrentPopup();return}const c=l.getCellStyleOnly(f,v),k=o.getStyles().getStyleByCell(c),j=(U=k==null?void 0:k.tr)==null?void 0:U.a;if(!j&&!e.customRange){this._sheetsHyperLinkPopupService.hideCurrentPopup();return}this._sheetsHyperLinkPopupService.showPopup({row:f,col:v,editPermission:L,copyPermission:T,customRange:e.customRange,customRangeRect:e.rect,type:I.VIEWING,unitId:n,subUnitId:t,showAll:!!j})}))}_initHoverEditingListener(){let e=null;this.disposeWithMe(this._editorBridgeService.currentEditCellState$.pipe(P.switchMap(n=>this._editorBridgeService.visible$.pipe(P.map(t=>({visible:t,state:n}))))).subscribe(({visible:n,state:t})=>{if(!t||t.editorUnitId!==s.DOCS_NORMAL_EDITOR_UNIT_ID_KEY)return;if(!n.visible){e==null||e.unsubscribe(),this._sheetsHyperLinkPopupService.hideCurrentPopup(I.EDITING),this._sheetsHyperLinkPopupService.endEditing(I.EDITING);return}const{editorUnitId:i,unitId:r,sheetId:a,row:o,column:l}=t,u=this._renderManagerService.getRenderById(i);if(!u)return;const{editPermission:p,viewPermission:d,copyPermission:h}=this._getLinkPermission({unitId:r,subUnitId:a,row:o,col:l}),f=u.with(ee.DocEventManagerService);d&&(e==null||e.unsubscribe(),e=f.hoverCustomRanges$.pipe(P.debounceTime(200)).subscribe(v=>{var k,j;const R=v.find(M=>M.range.rangeType===s.CustomRangeType.HYPERLINK);if(!R){this._sheetsHyperLinkPopupService.hideCurrentPopup();return}const L=R.rects[R.rects.length-1];if(!((j=(k=this._renderManagerService.getRenderById(r))==null?void 0:k.with(y.SheetSkeletonManagerService).getWorksheetSkeleton(a))==null?void 0:j.skeleton)||!L)return;const c=u.engine.getCanvasElement().getBoundingClientRect();this._sheetsHyperLinkPopupService.showPopup({unitId:r,subUnitId:a,row:o,col:l,customRange:R.range,customRangeRect:{left:L.left+c.left,top:L.top+c.top,bottom:L.bottom+c.top,right:L.right+c.left},editPermission:p,copyPermission:h,type:I.EDITING})}))})),this.disposeWithMe(()=>{e==null||e.unsubscribe()})}_initZenEditor(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(e=>{e?(this._sheetsHyperLinkPopupService.hideCurrentPopup(I.VIEWING),this._sheetsHyperLinkPopupService.hideCurrentPopup(I.EDITING),this._sheetsHyperLinkPopupService.endEditing(I.EDITING),this._sheetsHyperLinkPopupService.hideCurrentPopup(I.VIEWING)):(this._sheetsHyperLinkPopupService.hideCurrentPopup(I.ZEN_EDITOR),this._sheetsHyperLinkPopupService.endEditing(I.ZEN_EDITOR))})),this.disposeWithMe(this._univerInstanceService.focused$.pipe(P.switchMap(e=>{const n=e===s.DOCS_ZEN_EDITOR_UNIT_ID_KEY?this._renderManagerService.getRenderById(e):null;return n?n.with(ee.DocEventManagerService).hoverCustomRanges$.pipe(P.debounceTime(200)):new P.Observable(t=>{t.next(null)})})).subscribe(e=>{const n=e==null?void 0:e.find(i=>i.range.rangeType===s.CustomRangeType.HYPERLINK),t=this._editorBridgeService.getEditCellState();if(n&&t){const{unitId:i,sheetId:r,row:a,column:o}=t,{editPermission:l,viewPermission:u,copyPermission:p}=this._getLinkPermission({unitId:i,subUnitId:r,row:a,col:o});u&&this._sheetsHyperLinkPopupService.showPopup({type:I.ZEN_EDITOR,unitId:i,subUnitId:r,row:a,col:o,customRange:n.range,editPermission:l,copyPermission:p})}else this._sheetsHyperLinkPopupService.hideCurrentPopup(I.ZEN_EDITOR)}))}_initTextSelectionListener(){this.disposeWithMe(this._textSelectionManagerService.textSelection$.subscribe(e=>{e&&e.unitId===s.DOCS_NORMAL_EDITOR_UNIT_ID_KEY&&this._sheetsHyperLinkPopupService.endEditing(I.EDITING)}))}_initCommandListener(){const e=[E.ClearSelectionContentCommand.id,E.ClearSelectionAllCommand.id,E.ClearSelectionFormatCommand.id];this.disposeWithMe(this._commandService.onCommandExecuted(n=>{e.includes(n.id)&&this._sheetsHyperLinkPopupService.hideCurrentPopup()}))}};He=Dn([G(0,s.Inject(y.HoverManagerService)),G(1,s.Inject(g.SheetsHyperLinkPopupService)),G(2,s.Inject(pe.IRenderManagerService)),G(3,s.Inject(s.IPermissionService)),G(4,s.Inject(E.SheetPermissionCheckController)),G(5,s.ICommandService),G(6,y.IEditorBridgeService),G(7,s.Inject(he.DocSelectionManagerService)),G(8,s.IUniverInstanceService),G(9,b.IZenZoneService)],He);var bn=Object.defineProperty,wn=Object.getOwnPropertyDescriptor,It=(e,n,t,i)=>{for(var r=i>1?void 0:i?wn(n,t):n,a=e.length-1,o;a>=0;a--)(o=e[a])&&(r=(i?o(n,t,r):o(r))||r);return i&&r&&bn(n,t,r),r},ze=(e,n)=>(t,i)=>n(t,i,e);let Je=class extends s.Disposable{constructor(e,n){super(),this._context=e,this._hyperLinkModel=n,this._initSkeletonChange()}_initSkeletonChange(){const e=()=>{var n;(n=this._context.mainComponent)==null||n.makeForceDirty()};this.disposeWithMe(this._hyperLinkModel.linkUpdate$.pipe(P.debounceTime(16)).subscribe(()=>{e()}))}};Je=It([ze(1,s.Inject(S.HyperLinkModel))],Je);let xe=class extends s.Disposable{constructor(e,n){super(),this._sheetInterceptorService=e,this._hyperLinkModel=n,this._initViewModelIntercept()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(E.INTERCEPTOR_POINT.CELL_CONTENT,{effect:s.InterceptorEffectEnum.Value,priority:100,handler:(e,n,t)=>{const{row:i,col:r,unitId:a,subUnitId:o}=n,l=this._hyperLinkModel.getHyperLinkByLocation(a,o,i,r);return t(l?{...e,linkUrl:l.payload,linkId:l.id}:e)}}))}};xe=It([ze(0,s.Inject(E.SheetInterceptorService)),ze(1,s.Inject(S.HyperLinkModel))],xe);const Nn={[b.RibbonStartGroup.OTHERS]:{[oe.id]:{order:2,menuItemFactory:In},[we(oe.id)]:{order:2,menuItemFactory:yn}},[b.ContextMenuPosition.MAIN_AREA]:{[b.ContextMenuGroup.OTHERS]:{order:1,[oe.id]:{order:0,menuItemFactory:fn},[we(oe.id)]:{order:0,menuItemFactory:mn}}}};var Mn=Object.defineProperty,Un=Object.getOwnPropertyDescriptor,Hn=(e,n,t,i)=>{for(var r=i>1?void 0:i?Un(n,t):n,a=e.length-1,o;a>=0;a--)(o=e[a])&&(r=(i?o(n,t,r):o(r))||r);return i&&r&&Mn(n,t,r),r},_e=(e,n)=>(t,i)=>n(t,i,e);let je=class extends s.Disposable{constructor(e,n,t,i,r){super(),this._componentManager=e,this._commandService=n,this._menuManagerService=t,this._injector=i,this._shortcutService=r,this._initComponents(),this._initCommands(),this._initMenus(),this._initShortCut()}_initComponents(){[[Oe,Oe.componentKey],[Le,Le.componentKey],[We,"LinkSingle"]].forEach(([e,n])=>{this._componentManager.register(n,e)})}_initCommands(){[ke,Se,De,oe].forEach(e=>{this._commandService.registerCommand(e)})}_initMenus(){this._menuManagerService.mergeMenu(Nn)}_initShortCut(){this._shortcutService.registerShortcut(Ge)}};je=Hn([_e(0,s.Inject(b.ComponentManager)),_e(1,s.ICommandService),_e(2,b.IMenuManagerService),_e(3,s.Inject(s.Injector)),_e(4,s.Inject(b.IShortcutService))],je);var xn=Object.defineProperty,jn=Object.getOwnPropertyDescriptor,An=(e,n,t,i)=>{for(var r=i>1?void 0:i?jn(n,t):n,a=e.length-1,o;a>=0;a--)(o=e[a])&&(r=(i?o(n,t,r):o(r))||r);return i&&r&&xn(n,t,r),r},yt=(e,n)=>(t,i)=>n(t,i,e);let Ae=class extends s.Disposable{constructor(e,n){super(),this._parserService=e,this._resolverService=n,this._handleInitUrl()}_handleInitUrl(){const e=location.hash;if(e){const n=this._parserService.parseHyperLink(e);this._resolverService.navigate(n)}}};Ae=An([yt(0,s.Inject(S.SheetsHyperLinkParserService)),yt(1,s.Inject(g.SheetsHyperLinkResolverService))],Ae);var Ct=Object.defineProperty,Bn=Object.getOwnPropertyDescriptor,Vn=(e,n,t)=>n in e?Ct(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,Fn=(e,n,t,i)=>{for(var r=i>1?void 0:i?Bn(n,t):n,a=e.length-1,o;a>=0;a--)(o=e[a])&&(r=(i?o(n,t,r):o(r))||r);return i&&r&&Ct(n,t,r),r},Et=(e,n)=>(t,i)=>n(t,i,e),Rt=(e,n,t)=>Vn(e,typeof n!="symbol"?n+"":n,t);g.UniverSheetsHyperLinkUIPlugin=class extends s.Plugin{constructor(n=st,t,i){super(),this._config=n,this._injector=t,this._configService=i;const{menu:r,...a}=s.merge({},st,this._config);r&&this._configService.setConfig("menu",r,{merge:!0}),this._configService.setConfig(rt,a)}onStarting(){[[g.SheetsHyperLinkResolverService],[g.SheetsHyperLinkPopupService],[Ze],[xe],[He],[je],[Me],[g.SheetsHyperLinkCopyPasteController],[Ue],[Ae]].forEach(t=>this._injector.add(t)),this._injector.get(xe)}onReady(){this._injector.get(pe.IRenderManagerService).registerRenderModule(s.UniverInstanceType.UNIVER_SHEET,[Je]),this._injector.get(Me),this._injector.get(g.SheetsHyperLinkCopyPasteController),this._injector.get(je)}onRendered(){this._injector.get(Ue),this._injector.get(Ae),this._injector.get(He)}},Rt(g.UniverSheetsHyperLinkUIPlugin,"pluginName",Ve),Rt(g.UniverSheetsHyperLinkUIPlugin,"type",s.UniverInstanceType.UNIVER_SHEET),g.UniverSheetsHyperLinkUIPlugin=Fn([s.DependentOn(S.UniverSheetsHyperLinkPlugin,ee.UniverDocsUIPlugin),Et(1,s.Inject(s.Injector)),Et(2,s.IConfigService)],g.UniverSheetsHyperLinkUIPlugin),g.CloseHyperLinkPopupOperation=Se,g.InsertHyperLinkOperation=De,g.InsertLinkShortcut=Ge,g.OpenHyperLinkEditPanelOperation=ke,g.SheetsHyperLinkSidePanelService=Ze,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(global,factory){typeof exports=="object"&&typeof module<"u"?factory(exports,require("@univerjs/core"),require("@univerjs/sheets-hyper-link"),require("@univerjs/sheets-ui"),require("@univerjs/design"),require("@univerjs/engine-formula"),require("@univerjs/sheets"),require("@univerjs/ui"),require("@univerjs/docs-ui"),require("@univerjs/engine-render"),require("rxjs"),require("@univerjs/docs"),require("react/jsx-runtime"),require("@univerjs/sheets-formula-ui"),require("react"),require("@univerjs/sheets-data-validation")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets-hyper-link","@univerjs/sheets-ui","@univerjs/design","@univerjs/engine-formula","@univerjs/sheets","@univerjs/ui","@univerjs/docs-ui","@univerjs/engine-render","rxjs","@univerjs/docs","react/jsx-runtime","@univerjs/sheets-formula-ui","react","@univerjs/sheets-data-validation"],factory):(global=typeof globalThis<"u"?globalThis:global||self,factory(global.UniverSheetsHyperLinkUi={},global.UniverCore,global.UniverSheetsHyperLink,global.UniverSheetsUi,global.UniverDesign,global.UniverEngineFormula,global.UniverSheets,global.UniverUi,global.UniverDocsUi,global.UniverEngineRender,global.rxjs,global.UniverDocs,global.React,global.UniverSheetsFormulaUi,global.React,global.UniverSheetsDataValidation))})(this,function(exports2,core,sheetsHyperLink,sheetsUi,design,engineFormula,sheets,ui,docsUi,engineRender,rxjs,docs,jsxRuntime,sheetsFormulaUi,react,sheetsDataValidation){"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);var _a,_b,_c,_d,_e,_f,_g,_h,_i,_j,_k;function isLegalLink(link){return core.Tools.isLegalUrl(link)}__name(isLegalLink,"isLegalLink");function hasProtocol(urlString){return/^[a-zA-Z]+:\/\//.test(urlString)}__name(hasProtocol,"hasProtocol");function isEmail(url){return/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(url)}__name(isEmail,"isEmail");function serializeUrl(urlStr){if(isLegalLink(urlStr)){const transformedUrl=hasProtocol(urlStr)?urlStr:isEmail(urlStr)?`mailto://${urlStr}`:`http://${urlStr}`;let url;try{url=new URL(transformedUrl)}catch{return urlStr}return url.hostname===location.hostname&&url.port===location.port&&url.protocol===location.protocol&&url.pathname===location.pathname&&url.hash&&!url.search?url.hash:transformedUrl}return urlStr}__name(serializeUrl,"serializeUrl");const SHEETS_HYPER_LINK_UI_PLUGIN_CONFIG_KEY="sheets-hyper-link-ui.config",defaultPluginConfig={};var __defProp$9=Object.defineProperty,__getOwnPropDesc$9=Object.getOwnPropertyDescriptor,__decorateClass$9=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$9(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$9(target,key,result),result},"__decorateClass$9"),__decorateParam$9=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$9");function getContainRange(range,worksheet){const mergedCells=worksheet.getMergeData(),maxCol=worksheet.getMaxColumns()-1,maxRow=worksheet.getMaxRows()-1;if(maxCol<range.endColumn&&(range.endColumn=maxCol),maxRow<range.endRow&&(range.endRow=maxRow),range.rangeType===core.RANGE_TYPE.COLUMN||core.RANGE_TYPE.ROW)return range;const relativeCells=[];return mergedCells.forEach(cell=>{core.Rectangle.intersects(range,cell)&&relativeCells.push(cell)}),core.Rectangle.realUnion(range,...relativeCells)}__name(getContainRange,"getContainRange"),exports2.SheetsHyperLinkResolverService=(_a=class{constructor(_univerInstanceService,_commandService,_definedNamesService,_messageService,_localeService,_configService){this._univerInstanceService=_univerInstanceService,this._commandService=_commandService,this._definedNamesService=_definedNamesService,this._messageService=_messageService,this._localeService=_localeService,this._configService=_configService}navigate(info){switch(info.type){case sheetsHyperLink.SheetHyperLinkType.URL:this.navigateToOtherWebsite(info.url);break;default:this._navigateToUniver(info.searchObj)}}_navigateToUniver(params){const{gid,range,rangeid}=params,workbook=this._univerInstanceService.getCurrentUnitForType(core.UniverInstanceType.UNIVER_SHEET);if(!workbook)return;const unitId=workbook.getUnitId();if(rangeid){const item=this._definedNamesService.getValueById(unitId,rangeid);if(!item)return;const{formulaOrRefString}=item,worksheet=this._definedNamesService.getWorksheetByRef(unitId,formulaOrRefString);if(!worksheet){this._messageService.show({content:this._localeService.t("hyperLink.message.refError"),type:design.MessageType.Error});return}if(worksheet.isSheetHidden()){this._messageService.show({content:this._localeService.t("hyperLink.message.hiddenSheet"),type:design.MessageType.Error});return}this.navigateToDefineName(unitId,rangeid)}if(gid){if(range){const rangeInfo=engineFormula.deserializeRangeWithSheet(range);core.isValidRange(rangeInfo.range)&&range!==sheetsHyperLink.ERROR_RANGE&&this.navigateToRange(unitId,gid,rangeInfo.range);return}this.navigateToSheetById(unitId,gid)}}async navigateToRange(unitId,subUnitId,range,forceTop){const worksheet=await this.navigateToSheetById(unitId,subUnitId);if(worksheet){const realRange=getContainRange(range,worksheet);await this._commandService.executeCommand(sheets.SetSelectionsOperation.id,{unitId,subUnitId,selections:[{range:realRange,primary:null}]}),await this._commandService.executeCommand(sheetsUi.ScrollToRangeOperation.id,{range:realRange,forceTop})}}async navigateToSheetById(unitId,subUnitId){const workbook=this._univerInstanceService.getUnit(unitId,core.UniverInstanceType.UNIVER_SHEET);if(!workbook)return!1;const worksheet=workbook.getActiveSheet();if(!worksheet)return!1;if(worksheet.getSheetId()===subUnitId)return worksheet;const targetSheet=workbook.getSheetBySheetId(subUnitId);return targetSheet?workbook.getHiddenWorksheets().indexOf(subUnitId)>-1?(this._messageService.show({content:this._localeService.t("hyperLink.message.hiddenSheet"),type:design.MessageType.Error}),!1):await this._commandService.executeCommand(sheets.SetWorksheetActiveOperation.id,{unitId,subUnitId})?targetSheet:!1:(this._messageService.show({content:this._localeService.t("hyperLink.message.noSheet"),type:design.MessageType.Error}),!1)}async navigateToDefineName(unitId,rangeId){return this._definedNamesService.focusRange(unitId,rangeId),!0}async navigateToOtherWebsite(url){var _a2;const config=this._configService.getConfig(SHEETS_HYPER_LINK_UI_PLUGIN_CONFIG_KEY);if((_a2=config==null?void 0:config.urlHandler)!=null&&_a2.navigateToOtherWebsite)return config.urlHandler.navigateToOtherWebsite(url);window.open(url,"_blank","noopener noreferrer")}},__name(_a,"SheetsHyperLinkResolverService"),_a),exports2.SheetsHyperLinkResolverService=__decorateClass$9([__decorateParam$9(0,core.IUniverInstanceService),__decorateParam$9(1,core.ICommandService),__decorateParam$9(2,engineFormula.IDefinedNamesService),__decorateParam$9(3,ui.IMessageService),__decorateParam$9(4,core.Inject(core.LocaleService)),__decorateParam$9(5,core.IConfigService)],exports2.SheetsHyperLinkResolverService);const SHEET_HYPER_LINK_UI_PLUGIN="SHEET_HYPER_LINK_UI_PLUGIN";var __defProp$8=Object.defineProperty,__getOwnPropDesc$8=Object.getOwnPropertyDescriptor,__decorateClass$8=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$8(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$8(target,key,result),result},"__decorateClass$8"),__decorateParam$8=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$8");exports2.SheetsHyperLinkCopyPasteController=(_b=class extends core.Disposable{constructor(_sheetClipboardService,_hyperLinkModel,_injector,_resolverService){super();__publicField(this,"_plainTextFilter",new Set);__publicField(this,"_copyInfo");this._sheetClipboardService=_sheetClipboardService,this._hyperLinkModel=_hyperLinkModel,this._injector=_injector,this._resolverService=_resolverService,this._initCopyPaste(),this.disposeWithMe(()=>{this._plainTextFilter.clear()})}registerPlainTextFilter(filter){this._plainTextFilter.add(filter)}removePlainTextFilter(filter){this._plainTextFilter.delete(filter)}_filterPlainText(text){return Array.from(this._plainTextFilter).every(filter=>filter(text))}_initCopyPaste(){this._sheetClipboardService.addClipboardHook({id:SHEET_HYPER_LINK_UI_PLUGIN,onBeforeCopy:__name((unitId,subUnitId,range)=>this._collect(unitId,subUnitId,range),"onBeforeCopy"),onPasteCells:__name((pasteFrom,pasteTo,data,payload)=>{const{copyType=sheetsUi.COPY_TYPE.COPY,pasteType}=payload,{range:copyRange}=pasteFrom||{},{range:pastedRange,unitId,subUnitId}=pasteTo;return this._generateMutations(pastedRange,{copyType,pasteType,copyRange,unitId,subUnitId})},"onPasteCells"),onPastePlainText:__name((pasteTo,clipText)=>{const filterResult=this._filterPlainText(clipText);if(isLegalLink(clipText)&&filterResult){const{range,unitId,subUnitId}=pasteTo,{ranges:[pasteToRange],mapFunc}=sheetsUi.virtualizeDiscreteRanges([range]),redos=[],undos=[];return core.Range.foreach(pasteToRange,(originRow,originCol)=>{const{row,col:column}=mapFunc(originRow,originCol),link=this._hyperLinkModel.getHyperLinkByLocation(unitId,subUnitId,row,column);link&&redos.push({id:sheetsHyperLink.RemoveHyperLinkMutation.id,params:{unitId,subUnitId,id:link.id}}),link&&undos.push({id:sheetsHyperLink.AddHyperLinkMutation.id,params:{unitId,subUnitId,link}})}),{redos,undos}}return{undos:[],redos:[]}},"onPastePlainText"),priority:99})}_collect(unitId,subUnitId,range){const matrix=new core.ObjectMatrix;this._copyInfo={unitId,subUnitId,matrix};const discreteRange=this._injector.invoke(accessor=>sheetsUi.rangeToDiscreteRange(range,accessor,unitId,subUnitId));if(!discreteRange)return;const{rows,cols}=discreteRange;rows.forEach((row,rowIndex)=>{cols.forEach((col,colIndex)=>{var _a2;const link=this._hyperLinkModel.getHyperLinkByLocation(unitId,subUnitId,row,col);matrix.setValue(rowIndex,colIndex,(_a2=link==null?void 0:link.id)!=null?_a2:"")})})}_generateMutations(pastedRange,copyInfo){if(!this._copyInfo)return{redos:[],undos:[]};if(!this._copyInfo||!this._copyInfo.matrix.getSizeOf()||!copyInfo.copyRange)return{redos:[],undos:[]};if([sheetsUi.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_COL_WIDTH,sheetsUi.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_VALUE,sheetsUi.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT,sheetsUi.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMULA].includes(copyInfo.pasteType))return{redos:[],undos:[]};const{unitId,subUnitId}=this._copyInfo,redos=[],undos=[],{ranges:[vCopyRange,vPastedRange],mapFunc}=sheetsUi.virtualizeDiscreteRanges([copyInfo.copyRange,pastedRange]);return sheetsUi.getRepeatRange(vCopyRange,vPastedRange,!0).forEach(({startRange})=>{var _a2;(_a2=this._copyInfo)==null||_a2.matrix.forValue((row,col,ruleId)=>{const range=core.Rectangle.getPositionRange({startRow:row,endRow:row,startColumn:col,endColumn:col},startRange),oldLink=this._hyperLinkModel.getHyperLink(unitId,subUnitId,ruleId),{row:startRow,col:startColumn}=mapFunc(range.startRow,range.startColumn),currentLink=this._hyperLinkModel.getHyperLinkByLocation(copyInfo.unitId,copyInfo.subUnitId,startRow,startColumn),id=core.Tools.generateRandomId();currentLink&&redos.push({id:sheetsHyperLink.RemoveHyperLinkMutation.id,params:{unitId:copyInfo.unitId,subUnitId:copyInfo.subUnitId,id:currentLink.id}}),oldLink&&(redos.push({id:sheetsHyperLink.AddHyperLinkMutation.id,params:{unitId:copyInfo.unitId,subUnitId:copyInfo.subUnitId,link:{...oldLink,id,row:startRow,column:startColumn}}}),undos.push({id:sheetsHyperLink.RemoveHyperLinkMutation.id,params:{unitId:copyInfo.unitId,subUnitId:copyInfo.subUnitId,id}})),currentLink&&undos.push({id:sheetsHyperLink.AddHyperLinkMutation.id,params:{unitId:copyInfo.unitId,subUnitId:copyInfo.subUnitId,link:currentLink}})})}),{redos,undos}}},__name(_b,"SheetsHyperLinkCopyPasteController"),_b),exports2.SheetsHyperLinkCopyPasteController=__decorateClass$8([__decorateParam$8(0,sheetsUi.ISheetClipboardService),__decorateParam$8(1,core.Inject(sheetsHyperLink.HyperLinkModel)),__decorateParam$8(2,core.Inject(core.Injector)),__decorateParam$8(3,core.Inject(exports2.SheetsHyperLinkResolverService))],exports2.SheetsHyperLinkCopyPasteController);var HyperLinkEditSourceType=(HyperLinkEditSourceType2=>(HyperLinkEditSourceType2.EDITING="editing",HyperLinkEditSourceType2.VIEWING="viewing",HyperLinkEditSourceType2.ZEN_EDITOR="zen_mode",HyperLinkEditSourceType2))(HyperLinkEditSourceType||{});const _SheetsHyperLinkSidePanelService=class _SheetsHyperLinkSidePanelService extends core.Disposable{constructor(){super(...arguments);__publicField(this,"_customHyperLinks",new Map)}isBuiltInLinkType(type){return type!==sheetsHyperLink.SheetHyperLinkType.URL}getOptions(){return Array.from(this._customHyperLinks.values()).map(({option})=>option)}findCustomHyperLink(link){return Array.from(this._customHyperLinks.values()).find(item=>item.match(link))}registerCustomHyperLink(customHyperLink){this._customHyperLinks.set(customHyperLink.type,customHyperLink)}getCustomHyperLink(type){return this._customHyperLinks.get(type)}removeCustomHyperLink(type){const{_customHyperLinks}=this;_customHyperLinks.delete(type)}dispose(){super.dispose(),this._customHyperLinks.clear()}};__name(_SheetsHyperLinkSidePanelService,"SheetsHyperLinkSidePanelService");let SheetsHyperLinkSidePanelService=_SheetsHyperLinkSidePanelService;const styles$1={cellLinkEdit:"univer-cell-link-edit",cellLinkEditButtons:"univer-cell-link-edit-buttons"},CellLinkEdit=__name(()=>{var _a2;const[id,setId]=react.useState(""),[hide,setHide]=react.useState(!1),[display,_setDisplay]=react.useState(""),[showLabel,setShowLabel]=react.useState(!0),[type,setType]=react.useState(sheetsHyperLink.SheetHyperLinkType.URL),[payload,setPayload]=react.useState(""),localeService=core.useDependency(core.LocaleService),definedNameService=core.useDependency(engineFormula.IDefinedNamesService),editorBridgeService=core.useDependency(sheetsUi.IEditorBridgeService),univerInstanceService=core.useDependency(core.IUniverInstanceService),popupService=core.useDependency(exports2.SheetsHyperLinkPopupService),editing=ui.useObservable(popupService.currentEditing$),parserService=core.useDependency(sheetsHyperLink.SheetsHyperLinkParserService),resolverService=core.useDependency(exports2.SheetsHyperLinkResolverService),commandService=core.useDependency(core.ICommandService),sidePanelService=core.useDependency(SheetsHyperLinkSidePanelService),sidePanelOptions=react.useMemo(()=>sidePanelService.getOptions(),[sidePanelService]),zenZoneService=core.useDependency(ui.IZenZoneService),renderManagerService=core.useDependency(engineRender.IRenderManagerService),markSelectionService=core.useDependency(sheetsUi.IMarkSelectionService),textSelectionService=core.useDependency(docs.DocSelectionManagerService),contextService=core.useDependency(core.IContextService),themeService=core.useDependency(core.ThemeService),docSelectionManagerService=core.useDependency(docs.DocSelectionManagerService),rangeSelectorActionsRef=react.useRef({}),customHyperLinkSidePanel=react.useMemo(()=>{if(!sidePanelService.isBuiltInLinkType(type))return sidePanelService.getCustomHyperLink(type)},[sidePanelService,type]),[showError,setShowError]=react.useState(!1),[isFocusRangeSelector,isFocusRangeSelectorSet]=react.useState(!1),setByPayload=react.useRef(!1),workbook=univerInstanceService.getCurrentUnitForType(core.UniverInstanceType.UNIVER_SHEET),subUnitId=(workbook==null?void 0:workbook.getActiveSheet().getSheetId())||"",setDisplay=react.useCallback(value=>{_setDisplay(value.replaceAll(core.DataStreamTreeTokenType.CUSTOM_RANGE_START,"").replaceAll(core.DataStreamTreeTokenType.CUSTOM_RANGE_END,""))},[_setDisplay]);react.useEffect(()=>{var _a3,_b2,_c2,_d2,_e2,_f2,_g2,_h2,_i2,_j2,_k2,_l,_m,_n,_o,_p,_q;if((editing==null?void 0:editing.row)!==void 0&&editing.col!==void 0){const{customRange,row,col}=editing;let{label}=editing;typeof label=="number"&&(label=`${label}`);let link;if(customRange)link={id:(_a3=customRange==null?void 0:customRange.rangeId)!=null?_a3:"",display:label!=null?label:"",payload:(_c2=(_b2=customRange==null?void 0:customRange.properties)==null?void 0:_b2.url)!=null?_c2:"",row,column:col};else if(editing.type===HyperLinkEditSourceType.VIEWING){const workbook2=univerInstanceService.getUnit(editing.unitId),worksheet=workbook2==null?void 0:workbook2.getSheetBySheetId(editing.subUnitId),cell=worksheet==null?void 0:worksheet.getCellRaw(editing.row,editing.col),range=(_f2=(_e2=(_d2=cell==null?void 0:cell.p)==null?void 0:_d2.body)==null?void 0:_e2.customRanges)==null?void 0:_f2.find(range2=>{var _a4;return range2.rangeType===core.CustomRangeType.HYPERLINK&&((_a4=range2.properties)==null?void 0:_a4.url)}),cellValue=cell==null?void 0:cell.v;cell&&(!core.BuildTextUtils.transform.isEmptyDocument((_h2=(_g2=cell.p)==null?void 0:_g2.body)==null?void 0:_h2.dataStream)||core.Tools.isDefine(cellValue))&&setShowLabel(!1),link={id:"",display:"",payload:(_j2=(_i2=range==null?void 0:range.properties)==null?void 0:_i2.url)!=null?_j2:"",row,column:col}}else{const doc=univerInstanceService.getCurrentUnitForType(core.UniverInstanceType.UNIVER_DOC),currentSelection=textSelectionService.getActiveTextRange(),body=doc==null?void 0:doc.getBody(),selection=currentSelection&&body?currentSelection:null,customRange2=selection&&((_l=core.BuildTextUtils.customRange.getCustomRangesInterestsWithSelection(selection,(_k2=body==null?void 0:body.customRanges)!=null?_k2:[]))==null?void 0:_l[0]);setShowLabel(!1),link={id:"",display:label!=null?label:"",payload:(_n=(_m=customRange2==null?void 0:customRange2.properties)==null?void 0:_m.url)!=null?_n:"",row,column:col}}setId(link.id);const customLink=sidePanelService.findCustomHyperLink(link);if(customLink){const customLinkInfo=customLink.convert(link);setType(customLinkInfo.type),setPayload(customLinkInfo.payload),setDisplay(customLinkInfo.display);return}setDisplay(link.display);const linkInfo=parserService.parseHyperLink(link.payload);switch(setType(linkInfo.type===sheetsHyperLink.SheetHyperLinkType.INVALID?sheetsHyperLink.SheetHyperLinkType.RANGE:linkInfo.type),linkInfo.type){case sheetsHyperLink.SheetHyperLinkType.URL:{setPayload(linkInfo.url),linkInfo.url===link.display&&(setByPayload.current=!0);break}case sheetsHyperLink.SheetHyperLinkType.RANGE:{const params=linkInfo.searchObj,sheetName=params.gid&&(_q=(_p=(_o=univerInstanceService.getUnit(editing.unitId))==null?void 0:_o.getSheetBySheetId(params.gid))==null?void 0:_p.getName())!=null?_q:"",payload2=engineFormula.serializeRangeWithSheet(sheetName,engineFormula.deserializeRangeWithSheet(params.range).range);setPayload(payload2),payload2===link.display&&(setByPayload.current=!0);break}case sheetsHyperLink.SheetHyperLinkType.SHEET:{const params=linkInfo.searchObj;setPayload(params.gid);break}case sheetsHyperLink.SheetHyperLinkType.DEFINE_NAME:{const params=linkInfo.searchObj;setPayload(params.rangeid);break}default:setPayload("");break}}},[editing,resolverService,sidePanelService,textSelectionService,univerInstanceService]),react.useEffect(()=>{let id2=null;if(editing&&!editing.customRangeId&&editing.type===HyperLinkEditSourceType.VIEWING&&core.Tools.isDefine(editing.row)&&core.Tools.isDefine(editing.col)){const workbook2=univerInstanceService.getUnit(editing.unitId,core.UniverInstanceType.UNIVER_SHEET),worksheet=workbook2==null?void 0:workbook2.getSheetBySheetId(editing.subUnitId),mergeInfo=worksheet==null?void 0:worksheet.getMergedCell(editing.row,editing.col),color=new core.ColorKit(themeService.getCurrentTheme().hyacinth500).toRgb();id2=markSelectionService.addShape({range:mergeInfo!=null?mergeInfo:{startColumn:editing.col,endColumn:editing.col,startRow:editing.row,endRow:editing.row},style:{fill:`rgb(${color.r}, ${color.g}, ${color.b}, 0.12)`,strokeWidth:1,stroke:"#FFBD37",widgets:{}},primary:null},[],-1)}return()=>{id2&&markSelectionService.removeShape(id2)}},[editing,markSelectionService,themeService,univerInstanceService]),react.useEffect(()=>{isFocusRangeSelectorSet(type===sheetsHyperLink.SheetHyperLinkType.RANGE)},[type]),react.useEffect(()=>{const render2=(editing==null?void 0:editing.type)===HyperLinkEditSourceType.ZEN_EDITOR?renderManagerService.getRenderById(core.DOCS_ZEN_EDITOR_UNIT_ID_KEY):renderManagerService.getRenderById(editorBridgeService.getCurrentEditorId()),disposeCollection=new core.DisposableCollection;if(render2){const selectionRenderService=render2.with(docsUi.DocSelectionRenderService);selectionRenderService.setReserveRangesStatus(!0),disposeCollection.add(()=>{selectionRenderService.setReserveRangesStatus(!1)})}return()=>{editorBridgeService.disableForceKeepVisible(),disposeCollection.dispose()}},[editing==null?void 0:editing.type,editorBridgeService,renderManagerService]),react.useEffect(()=>(popupService.setIsKeepVisible(isFocusRangeSelector),()=>{popupService.setIsKeepVisible(!1)}),[isFocusRangeSelector,popupService]),react.useEffect(()=>()=>{zenZoneService.temporaryHidden&&(zenZoneService.show(),contextService.setContextValue(core.FOCUSING_SHEET,!1))},[contextService,zenZoneService]),react.useEffect(()=>{if(isFocusRangeSelector)return editorBridgeService.enableForceKeepVisible(),()=>{editorBridgeService.disableForceKeepVisible()}},[isFocusRangeSelector,editorBridgeService]);const linkTypeOptions=[{label:localeService.t("hyperLink.form.link"),value:sheetsHyperLink.SheetHyperLinkType.URL},{label:localeService.t("hyperLink.form.range"),value:sheetsHyperLink.SheetHyperLinkType.RANGE},{label:localeService.t("hyperLink.form.worksheet"),value:sheetsHyperLink.SheetHyperLinkType.SHEET},{label:localeService.t("hyperLink.form.definedName"),value:sheetsHyperLink.SheetHyperLinkType.DEFINE_NAME},...sidePanelOptions];if(!workbook)return;const hiddens=workbook.getHiddenWorksheets(),sheetsOption=workbook.getSheets().map(sheet=>({label:sheet.getName(),value:sheet.getSheetId()})).filter(opt=>hiddens.indexOf(opt.value)===-1),definedNames=Object.values((_a2=definedNameService.getDefinedNameMap(workbook.getUnitId()))!=null?_a2:{}).map(value=>({label:value.name,value:value.id})),formatUrl=__name((type2,payload2)=>{if(type2===sheetsHyperLink.SheetHyperLinkType.URL)return serializeUrl(payload2);if(type2===sheetsHyperLink.SheetHyperLinkType.RANGE){const info=engineFormula.deserializeRangeWithSheet(payload2),worksheet=workbook.getSheetBySheetName(info.sheetName);if(worksheet)return`#gid=${worksheet.getSheetId()}&range=${engineFormula.serializeRange(info.range)}`}return`#${type2}=${payload2}`},"formatUrl"),handleRangeChange=ui.useEvent(rangeText=>{var _a3;const range=rangeText.split(",").map(engineFormula.deserializeRangeWithSheet)[0];if(!range||!core.isValidRange(range.range))return;range.sheetName||(range.sheetName=((_a3=workbook.getActiveSheet())==null?void 0:_a3.getName())||"");const newPayload=engineFormula.serializeRangeToRefString(range);setPayload(newPayload),newPayload&&(setByPayload.current||!display)&&(setDisplay(newPayload),setByPayload.current=!0)}),handleSubmit=__name(async()=>{if(showLabel&&!display||!payload||type===sheetsHyperLink.SheetHyperLinkType.URL&&!isLegalLink(payload)){setShowError(!0);return}if(editing)if(id){const commandId=editing.type===HyperLinkEditSourceType.ZEN_EDITOR||editing.type===HyperLinkEditSourceType.EDITING?sheetsHyperLink.UpdateRichHyperLinkCommand.id:sheetsHyperLink.UpdateHyperLinkCommand.id;await commandService.executeCommand(commandId,{id,unitId:editing.unitId,subUnitId:editing.subUnitId,payload:{display:showLabel?display:"",payload:formatUrl(type,payload)},row:editing.row,column:editing.col,documentId:editing.type===HyperLinkEditSourceType.ZEN_EDITOR?core.DOCS_ZEN_EDITOR_UNIT_ID_KEY:editorBridgeService.getCurrentEditorId()})}else{const commandId=editing.type===HyperLinkEditSourceType.ZEN_EDITOR||editing.type===HyperLinkEditSourceType.EDITING?sheetsHyperLink.AddRichHyperLinkCommand.id:sheetsHyperLink.AddHyperLinkCommand.id;await commandService.executeCommand(commandId,{unitId:editing.unitId,subUnitId:editing.subUnitId,link:{id:core.generateRandomId(),row:editing.row,column:editing.col,payload:formatUrl(type,payload),display:showLabel?display:""},documentId:editing.type===HyperLinkEditSourceType.ZEN_EDITOR?core.DOCS_ZEN_EDITOR_UNIT_ID_KEY:editorBridgeService.getCurrentEditorId()})}if((editing==null?void 0:editing.type)===HyperLinkEditSourceType.VIEWING){await commandService.executeCommand(sheets.SetWorksheetActiveOperation.id,{unitId:editing.unitId,subUnitId:editing.subUnitId});const GAP=1;await commandService.executeCommand(sheetsUi.ScrollToRangeOperation.id,{range:{startRow:Math.max(editing.row-GAP,0),endRow:editing.row+GAP,startColumn:Math.max(editing.col-GAP,0),endColumn:editing.col+GAP}})}commandService.executeCommand(CloseHyperLinkPopupOperation.id)},"handleSubmit"),handlePanelClick=__name(e=>{var _a3;if(type!==sheetsHyperLink.SheetHyperLinkType.RANGE)return;const handleOutClick=(_a3=rangeSelectorActionsRef.current)==null?void 0:_a3.handleOutClick;handleOutClick&&handleOutClick(e,()=>isFocusRangeSelectorSet(!1))},"handlePanelClick");return editing?jsxRuntime.jsxs("div",{className:styles$1.cellLinkEdit,style:{display:hide?"none":"block"},onClick:handlePanelClick,children:[showLabel?jsxRuntime.jsx(design.FormLayout,{label:localeService.t("hyperLink.form.label"),error:showError&&!display?localeService.t("hyperLink.form.inputError"):"",children:jsxRuntime.jsx(design.Input,{value:display,onChange:__name(v=>{setDisplay(v),setByPayload.current=!1},"onChange"),placeholder:localeService.t("hyperLink.form.labelPlaceholder"),autoFocus:!0,onKeyDown:__name(e=>{e.keyCode===ui.KeyCode.ENTER&&handleSubmit()},"onKeyDown")})}):null,jsxRuntime.jsx(design.FormLayout,{label:localeService.t("hyperLink.form.type"),children:jsxRuntime.jsx(design.Select,{options:linkTypeOptions,value:type,onChange:__name(newType=>{setType(newType),setPayload("")},"onChange")})}),type===sheetsHyperLink.SheetHyperLinkType.URL&&jsxRuntime.jsx(design.FormLayout,{error:showError?payload?isLegalLink(payload)?"":localeService.t("hyperLink.form.linkError"):localeService.t("hyperLink.form.inputError"):"",children:jsxRuntime.jsx(design.Input,{value:payload,onChange:__name(newLink=>{setPayload(newLink),newLink&&(setByPayload.current||!display||display===payload)&&(setDisplay(newLink),setByPayload.current=!0)},"onChange"),placeholder:localeService.t("hyperLink.form.linkPlaceholder"),autoFocus:!0,onKeyDown:__name(e=>{e.keyCode===ui.KeyCode.ENTER&&handleSubmit()},"onKeyDown")})}),type===sheetsHyperLink.SheetHyperLinkType.RANGE&&jsxRuntime.jsx(design.FormLayout,{error:showError&&!payload?localeService.t("hyperLink.form.inputError"):"",children:jsxRuntime.jsx(sheetsFormulaUi.RangeSelector,{unitId:workbook.getUnitId(),subUnitId,isOnlyOneRange:!0,isSupportAcrossSheet:!0,initValue:payload,onChange:handleRangeChange,isFocus:isFocusRangeSelector,onFocus:__name(()=>isFocusRangeSelectorSet(!0),"onFocus"),actions:rangeSelectorActionsRef.current,onRangeSelectorDialogVisibleChange:__name(async visible=>{var _a3,_b2;if(visible)editing.type===HyperLinkEditSourceType.ZEN_EDITOR&&(zenZoneService.hide(),contextService.setContextValue(core.FOCUSING_SHEET,!0)),editing.type!==HyperLinkEditSourceType.VIEWING&&editorBridgeService.enableForceKeepVisible(),setHide(!0);else{if(await resolverService.navigateToRange(editing.unitId,editing.subUnitId,{startRow:editing.row,endRow:editing.row,startColumn:editing.col,endColumn:editing.col},!0),editing.type===HyperLinkEditSourceType.ZEN_EDITOR){await commandService.executeCommand(sheets.SetSelectionsOperation.id,{unitId:editing.unitId,subUnitId:editing.subUnitId,selections:[{range:{startRow:editing.row,endRow:editing.row,startColumn:editing.col,endColumn:editing.col}}]}),zenZoneService.show(),contextService.setContextValue(core.FOCUSING_SHEET,!1);const docBackScrollRenderController=(_a3=renderManagerService.getRenderById(core.DOCS_ZEN_EDITOR_UNIT_ID_KEY))==null?void 0:_a3.with(docsUi.DocBackScrollRenderController),range=(_b2=docSelectionManagerService.getTextRanges({unitId:core.DOCS_ZEN_EDITOR_UNIT_ID_KEY,subUnitId:core.DOCS_ZEN_EDITOR_UNIT_ID_KEY}))==null?void 0:_b2[0];docBackScrollRenderController&&range&&(docBackScrollRenderController.scrollToRange(range),docSelectionManagerService.refreshSelection({unitId:core.DOCS_ZEN_EDITOR_UNIT_ID_KEY,subUnitId:core.DOCS_ZEN_EDITOR_UNIT_ID_KEY}))}editorBridgeService.disableForceKeepVisible(),setHide(!1)}},"onRangeSelectorDialogVisibleChange")})}),type===sheetsHyperLink.SheetHyperLinkType.SHEET&&jsxRuntime.jsx(design.FormLayout,{error:showError&&!payload?localeService.t("hyperLink.form.selectError"):"",children:jsxRuntime.jsx(design.Select,{options:sheetsOption,value:payload,onChange:__name(newPayload=>{var _a3,_b2;setPayload(newPayload);const label=(_a3=sheetsOption.find(i=>i.value===newPayload))==null?void 0:_a3.label,oldLabel=(_b2=sheetsOption.find(i=>i.value===payload))==null?void 0:_b2.label;label&&(setByPayload.current||!display||display===oldLabel)&&(setDisplay(label),setByPayload.current=!0)},"onChange")})}),type===sheetsHyperLink.SheetHyperLinkType.DEFINE_NAME&&jsxRuntime.jsx(design.FormLayout,{error:showError&&!payload?localeService.t("hyperLink.form.selectError"):"",children:jsxRuntime.jsx(design.Select,{options:definedNames,value:payload,onChange:__name(newValue=>{var _a3,_b2;setPayload(newValue);const label=(_a3=definedNames.find(i=>i.value===newValue))==null?void 0:_a3.label,oldLabel=(_b2=definedNames.find(i=>i.value===payload))==null?void 0:_b2.label;label&&(setByPayload.current||!display||display===oldLabel)&&(setDisplay(label),setByPayload.current=!0)},"onChange")})}),(customHyperLinkSidePanel==null?void 0:customHyperLinkSidePanel.Form)&&jsxRuntime.jsx(customHyperLinkSidePanel.Form,{linkId:id,payload,display,showError,setByPayload,setDisplay:__name(newLink=>{setDisplay(newLink),setByPayload.current=!0},"setDisplay"),setPayload}),jsxRuntime.jsxs("div",{className:styles$1.cellLinkEditButtons,children:[jsxRuntime.jsx(design.Button,{onClick:__name(()=>{editing&&resolverService.navigateToRange(editing.unitId,editing.subUnitId,{startRow:editing.row,endRow:editing.row,startColumn:editing.col,endColumn:editing.col},!0),commandService.executeCommand(CloseHyperLinkPopupOperation.id)},"onClick"),children:localeService.t("hyperLink.form.cancel")}),jsxRuntime.jsx(design.Button,{type:"primary",style:{marginLeft:8},onClick:__name(async()=>{handleSubmit()},"onClick"),children:localeService.t("hyperLink.form.ok")})]})]}):null},"CellLinkEdit");CellLinkEdit.componentKey="univer.sheet.cell-link-edit";var __assign=function(){return __assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p])}return t},__assign.apply(this,arguments)},__rest=function(s,e){var t={};for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0&&(t[p]=s[p]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,p=Object.getOwnPropertySymbols(s);i<p.length;i++)e.indexOf(p[i])<0&&Object.prototype.propertyIsEnumerable.call(s,p[i])&&(t[p[i]]=s[p[i]]);return t},IconBase=react.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=react.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 react.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(_a2){var key=_a2[0],value=_a2[1];typeof value=="string"&&(attrs[key]=value.replace(/url\(#(.*)\)/,"url(#$1".concat(runtimeProps.idSuffix,")")))})),attrs}__name(replaceRuntimeIdsAndExtInAttrs,"replaceRuntimeIdsAndExtInAttrs");function replaceRuntimeIdsInDefs(node,runtimeProps){var _a2,defIds=runtimeProps.defIds;return!defIds||defIds.length===0?node:node.tag==="defs"&&(!((_a2=node.children)===null||_a2===void 0)&&_a2.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$5={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M7.9999 1.12915C8.03875 1.12915 8.07673 1.13284 8.11352 1.13989H12.2599C13.6958 1.13989 14.8599 2.30395 14.8599 3.73989V7.88619C14.867 7.92301 14.8707 7.96102 14.8707 7.9999C14.8707 8.03878 14.867 8.0768 14.8599 8.11362V12.2599C14.8599 13.6958 13.6958 14.8599 12.2599 14.8599H8.11362C8.0768 14.867 8.03878 14.8707 7.9999 14.8707C7.96102 14.8707 7.92301 14.867 7.88619 14.8599H3.73989C2.30396 14.8599 1.13989 13.6958 1.13989 12.2599V8.11352C1.13284 8.07673 1.12915 8.03875 1.12915 7.9999C1.12915 7.96106 1.13284 7.92308 1.13989 7.88629V3.73989C1.13989 2.30396 2.30395 1.13989 3.73989 1.13989H7.88629C7.92308 1.13284 7.96106 1.12915 7.9999 1.12915ZM2.33989 8.5999V12.2599C2.33989 13.0331 2.9667 13.6599 3.73989 13.6599H7.3999V8.5999H2.33989ZM7.3999 7.3999H2.33989V3.73989C2.33989 2.9667 2.96669 2.33989 3.73989 2.33989H7.3999V7.3999ZM8.5999 8.5999V13.6599H12.2599C13.0331 13.6599 13.6599 13.0331 13.6599 12.2599V8.5999H8.5999ZM13.6599 7.3999H8.5999V2.33989H12.2599C13.0331 2.33989 13.6599 2.96669 13.6599 3.73989V7.3999Z",fillRule:"evenodd",clipRule:"evenodd"}}]},AllBorderSingle=react.forwardRef(function(props,ref){return react.createElement(IconBase,Object.assign({},props,{id:"all-border-single",ref,icon:element$5}))});AllBorderSingle.displayName="AllBorderSingle";var element$4={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M4.1302 12.4251C4.25802 13.7417 5.36779 14.7708 6.71792 14.7708H11.7179C13.1539 14.7708 14.3179 13.6067 14.3179 12.1708V6.1708C14.3179 4.78586 13.2351 3.65383 11.8698 3.57517C11.742 2.25858 10.6323 1.22949 9.28213 1.22949H4.28213C2.84619 1.22949 1.68213 2.39355 1.68213 3.82949V9.82949C1.68213 11.2144 2.76497 12.3465 4.1302 12.4251ZM10.6583 3.5708H6.71792C5.28198 3.5708 4.11792 4.73486 4.11792 6.1708V11.22C3.4221 11.1387 2.88213 10.5471 2.88213 9.82949V3.82949C2.88213 3.05629 3.50893 2.42949 4.28213 2.42949H9.28213C9.96695 2.42949 10.5369 2.92119 10.6583 3.5708ZM13.1179 6.1708C13.1179 5.3976 12.4911 4.7708 11.7179 4.7708H6.71792C5.94472 4.7708 5.31792 5.3976 5.31792 6.1708V12.1708C5.31792 12.944 5.94472 13.5708 6.71792 13.5708H11.7179C12.4911 13.5708 13.1179 12.944 13.1179 12.1708V6.1708Z",fillRule:"evenodd",clipRule:"evenodd"}}]},CopySingle=react.forwardRef(function(props,ref){return react.createElement(IconBase,Object.assign({},props,{id:"copy-single",ref,icon:element$4}))});CopySingle.displayName="CopySingle";var element$3={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M9.8816 1.97978C11.0177 0.843607 12.862 0.884962 14.0004 2.02342C15.1389 3.16188 15.1803 5.00612 14.0441 6.14228L11.399 8.78737C11.1608 9.02559 10.7746 9.02559 10.5363 8.78737C10.2981 8.54915 10.2981 8.16292 10.5363 7.9247L13.1814 5.2796C13.8195 4.64155 13.8217 3.57006 13.1378 2.8861C12.4538 2.20211 11.3823 2.20438 10.7443 2.84245L7.6976 5.88911L7.69317 5.89349C7.05959 6.53211 7.05894 7.60014 7.74132 8.28252C7.97954 8.52074 7.97954 8.90697 7.74132 9.14519C7.5031 9.38341 7.11687 9.38341 6.87865 9.14519C5.74016 8.00671 5.69884 6.16251 6.83497 5.02633L6.84021 5.02116L9.8816 1.97978Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M4.61426 7.2364C4.85248 6.99818 5.23871 6.99818 5.47693 7.2364C5.71515 7.47462 5.71515 7.86085 5.47693 8.09907L2.83183 10.7442C2.19375 11.3823 2.1915 12.4537 2.87547 13.1377C3.55945 13.8217 4.6309 13.8194 5.26899 13.1813L8.31566 10.1347C8.32262 10.1277 8.32971 10.121 8.33691 10.1144C8.34408 10.1064 8.3515 10.0986 8.35916 10.091C8.99721 9.45291 8.99949 8.38145 8.3155 7.69746C8.07728 7.45924 8.07728 7.07301 8.3155 6.83479C8.55372 6.59657 8.93995 6.59657 9.17817 6.83479C10.3166 7.97327 10.358 9.81748 9.22183 10.9536C9.21487 10.9606 9.20779 10.9673 9.20058 10.9739C9.19341 10.9819 9.18599 10.9897 9.17833 10.9973L6.13166 14.044C4.99548 15.1802 3.15127 15.1389 2.01279 14.0004C0.874362 12.8619 0.83297 11.0177 1.96916 9.8815L4.61426 7.2364Z"}}]},LinkSingle=react.forwardRef(function(props,ref){return react.createElement(IconBase,Object.assign({},props,{id:"link-single",ref,icon:element$3}))});LinkSingle.displayName="LinkSingle";var element$2={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12.5935 3.47302C11.6354 2.51492 10.082 2.51492 9.12388 3.47302L7.83534 4.76157C7.60102 4.99588 7.22112 4.99588 6.98681 4.76157 6.75249 4.52725 6.75249 4.14735 6.98681 3.91304L8.27535 2.62449C9.70209 1.19776 12.0153 1.19776 13.442 2.62449 14.8688 4.05123 14.8688 6.36442 13.442 7.79116L12.1535 9.0797C11.9192 9.31402 11.5393 9.31402 11.3049 9.0797 11.0706 8.84539 11.0706 8.46549 11.3049 8.23117L12.5935 6.94263C13.5516 5.98452 13.5516 4.43113 12.5935 3.47302zM3.40637 12.6606C2.44827 11.7025 2.44827 10.1491 3.40637 9.19102L4.69492 7.90248C4.92923 7.66816 4.92923 7.28826 4.69492 7.05395 4.4606 6.81963 4.0807 6.81963 3.84639 7.05395L2.55784 8.34249C1.13111 9.76923 1.13111 12.0824 2.55784 13.5092 3.98458 14.9359 6.29777 14.9359 7.72451 13.5092L9.01305 12.2206C9.24737 11.9863 9.24737 11.6064 9.01305 11.3721 8.77874 11.1378 8.39884 11.1378 8.16452 11.3721L6.87598 12.6606C5.91787 13.6187 4.36448 13.6187 3.40637 12.6606zM3.5852 2.80332C3.35088 2.569 2.97098 2.569 2.73667 2.80332 2.50235 3.03763 2.50235 3.41753 2.73667 3.65185L12.4151 13.3302C12.6494 13.5646 13.0293 13.5646 13.2636 13.3302 13.4979 13.0959 13.4979 12.716 13.2636 12.4817L3.5852 2.80332z"}}]},UnlinkSingle=react.forwardRef(function(props,ref){return react.createElement(IconBase,Object.assign({},props,{id:"unlink-single",ref,icon:element$2}))});UnlinkSingle.displayName="UnlinkSingle";var element$1={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12.6551 1.98906C11.7476 1.08113 10.2757 1.08149 9.3686 1.98987L4.82542 6.53955C4.75087 6.61421 4.69336 6.70411 4.65682 6.80309L3.2461 10.625C3.16506 10.8446 3.21909 11.0912 3.3845 11.2568C3.54991 11.4224 3.79651 11.4767 4.01616 11.3959L7.85031 9.98517C7.94979 9.94856 8.04014 9.89077 8.11508 9.81579L12.6552 5.27327C13.5618 4.36621 13.5618 2.89607 12.6551 1.98906ZM10.2177 2.83779C10.6562 2.39869 11.3677 2.39851 11.8064 2.8374C12.2447 3.27584 12.2447 3.9865 11.8065 4.42497L7.3392 8.89457L4.82213 9.82068L5.74706 7.31487L10.2177 2.83779Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.79238 13.2999C1.46101 13.2999 1.19238 13.5685 1.19238 13.8999C1.19238 14.2313 1.46101 14.4999 1.79238 14.4999H14.4924C14.8238 14.4999 15.0924 14.2313 15.0924 13.8999C15.0924 13.5685 14.8238 13.2999 14.4924 13.2999H1.79238Z"}}]},WriteSingle=react.forwardRef(function(props,ref){return react.createElement(IconBase,Object.assign({},props,{id:"write-single",ref,icon:element$1}))});WriteSingle.displayName="WriteSingle";var element={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"#35BD4B",d:"M3.4535 1.12549C2.7002 1.12549 2.08954 1.73615 2.08954 2.48945V13.5104C2.08954 14.2637 2.7002 14.8744 3.4535 14.8744H12.5465C13.2998 14.8744 13.9105 14.2637 13.9105 13.5104V5.0992L10.0091 1.12549H3.4535Z"}},{tag:"path",attrs:{fill:"#32A846",d:"M10.0075 1.12549L13.9104 5.09842H10.6742C10.306 5.09842 10.0075 4.79994 10.0075 4.43175V1.12549Z"}},{tag:"path",attrs:{fill:"#fff",d:"M7.8088 10.2949L6.3764 12.403C6.26259 12.5705 6.03455 12.614 5.86705 12.5002C5.69955 12.3864 5.65603 12.1584 5.76984 11.9909L7.3655 9.64252L5.94042 7.54519C5.82661 7.37769 5.87013 7.14964 6.03763 7.03583C6.20512 6.92202 6.43317 6.96555 6.54698 7.13304L7.8088 8.9901L9.07062 7.13304C9.18443 6.96555 9.41248 6.92202 9.57997 7.03583C9.74747 7.14964 9.79099 7.37769 9.67718 7.54519L8.2521 9.64252L9.84776 11.9909C9.96157 12.1584 9.91805 12.3864 9.75055 12.5002C9.58305 12.614 9.35501 12.5705 9.2412 12.403L7.8088 10.2949Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Xlsx=react.forwardRef(function(props,ref){return react.createElement(IconBase,Object.assign({},props,{id:"xlsx",ref,icon:element}))});Xlsx.displayName="Xlsx";function r(e){var t,f,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f)}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}__name(r,"r");function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}__name(clsx,"clsx");const styles={cellLink:"univer-cell-link",cellLinkType:"univer-cell-link-type",cellLinkContent:"univer-cell-link-content",cellLinkContentError:"univer-cell-link-content-error",cellLinkUrl:"univer-cell-link-url",cellLinkOperations:"univer-cell-link-operations",cellLinkOperation:"univer-cell-link-operation",cellLinkOperationError:"univer-cell-link-operation-error"},iconsMap={[sheetsHyperLink.SheetHyperLinkType.URL]:jsxRuntime.jsx(LinkSingle,{}),[sheetsHyperLink.SheetHyperLinkType.SHEET]:jsxRuntime.jsx(Xlsx,{}),[sheetsHyperLink.SheetHyperLinkType.RANGE]:jsxRuntime.jsx(AllBorderSingle,{}),[sheetsHyperLink.SheetHyperLinkType.DEFINE_NAME]:jsxRuntime.jsx(AllBorderSingle,{}),[sheetsHyperLink.SheetHyperLinkType.INVALID]:jsxRuntime.jsx(AllBorderSingle,{})},CellLinkPopupPure=__name(props=>{var _a2,_b2;const popupService=core.useDependency(exports2.SheetsHyperLinkPopupService),commandService=core.useDependency(core.ICommandService),messageService=core.useDependency(ui.IMessageService),localeService=core.useDependency(core.LocaleService),resolverService=core.useDependency(exports2.SheetsHyperLinkResolverService),editorBridgeService=core.useDependency(sheetsUi.IEditorBridgeService),parserHyperLinkService=core.useDependency(sheetsHyperLink.SheetsHyperLinkParserService),zenZoneService=core.useDependency(ui.IZenZoneService),{customRange,row,col,unitId,subUnitId,editPermission,copyPermission,type}=props;if(!((_a2=customRange==null?void 0:customRange.properties)!=null&&_a2.url))return null;const linkObj=parserHyperLinkService.parseHyperLink((_b2=customRange.properties.url)!=null?_b2:""),isError=linkObj.type===sheetsHyperLink.SheetHyperLinkType.INVALID;return jsxRuntime.jsxs("div",{className:styles.cellLink,onClick:__name(()=>popupService.hideCurrentPopup(),"onClick"),children:[jsxRuntime.jsxs("div",{className:clsx(styles.cellLinkContent,{[styles.cellLinkContentError]:isError}),onClick:__name(()=>{zenZoneService.visible||isError||resolverService.navigate(linkObj)},"onClick"),children:[jsxRuntime.jsx("div",{className:styles.cellLinkType,children:iconsMap[linkObj.type]}),jsxRuntime.jsx(design.Tooltip,{showIfEllipsis:!0,title:linkObj.name,asChild:!0,children:jsxRuntime.jsx("span",{className:styles.cellLinkUrl,children:linkObj.name})})]}),jsxRuntime.jsxs("div",{className:styles.cellLinkOperations,children:[copyPermission&&jsxRuntime.jsx("div",{className:clsx(styles.cellLinkOperation,{[styles.cellLinkOperationError]:isError}),onClick:__name(()=>{if(!isError){if(linkObj.type!==sheetsHyperLink.SheetHyperLinkType.URL){const url=new URL(window.location.href);url.hash=linkObj.url.slice(1),navigator.clipboard.writeText(url.href)}else navigator.clipboard.writeText(linkObj.url);messageService.show({content:localeService.t("hyperLink.message.coped"),type:design.MessageType.Info})}},"onClick"),children:jsxRuntime.jsx(design.Tooltip,{placement:"bottom",title:localeService.t("hyperLink.popup.copy"),children:jsxRuntime.jsx(CopySingle,{})})}),editPermission&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:styles.cellLinkOperation,onClick:__name(()=>{commandService.executeCommand(OpenHyperLinkEditPanelOperation.id,{unitId,subUnitId,row,col,customRangeId:customRange.rangeId,type})},"onClick"),children:jsxRuntime.jsx(design.Tooltip,{placement:"bottom",title:localeService.t("hyperLink.popup.edit"),children:jsxRuntime.jsx(WriteSingle,{})})}),jsxRuntime.jsx("div",{className:styles.cellLinkOperation,onClick:__name(()=>{const commandId=type===HyperLinkEditSourceType.EDITING||type===HyperLinkEditSourceType.ZEN_EDITOR?sheetsHyperLink.CancelRichHyperLinkCommand.id:sheetsHyperLink.CancelHyperLinkCommand.id;commandService.syncExecuteCommand(commandId,{unitId,subUnitId,id:customRange.rangeId,row,column:col,documentId:type===HyperLinkEditSourceType.ZEN_EDITOR?core.DOCS_ZEN_EDITOR_UNIT_ID_KEY:editorBridgeService.getCurrentEditorId()})&&popupService.hideCurrentPopup(void 0,!0)},"onClick"),children:jsxRuntime.jsx(design.Tooltip,{placement:"bottom",title:localeService.t("hyperLink.popup.cancel"),children:jsxRuntime.jsx(UnlinkSingle,{})})})]})]})]})},"CellLinkPopupPure"),CellLinkPopup=__name(()=>{var _a2,_b2;const popupService=core.useDependency(exports2.SheetsHyperLinkPopupService),[currentPopup,setCurrentPopup]=react.useState(null),univerInstanceService=core.useDependency(core.IUniverInstanceService);if(react.useEffect(()=>{setCurrentPopup(popupService.currentPopup);const ob=popupService.currentPopup$.subscribe(popup=>{setCurrentPopup(popup)});return()=>{ob.unsubscribe()}},[popupService.currentPopup,popupService.currentPopup$]),!currentPopup)return null;if(currentPopup.showAll){const workbook=univerInstanceService.getUnit(currentPopup.unitId,core.UniverInstanceType.UNIVER_SHEET),worksheet=workbook==null?void 0:workbook.getSheetBySheetId(currentPopup.subUnitId),cell=worksheet==null?void 0:worksheet.getCell(currentPopup.row,currentPopup.col),customRanges=(_b2=(_a2=cell==null?void 0:cell.p)==null?void 0:_a2.body)==null?void 0:_b2.customRanges;return customRanges!=null&&customRanges.length?jsxRuntime.jsx("div",{children:customRanges.map(customRange=>jsxRuntime.jsx(CellLinkPopupPure,{...currentPopup,customRange},customRange.rangeId))}):null}return jsxRuntime.jsx(CellLinkPopupPure,{...currentPopup})},"CellLinkPopup");CellLinkPopup.componentKey="univer.sheet.cell-link-popup";var __defProp$7=Object.defineProperty,__getOwnPropDesc$7=Object.getOwnPropertyDescriptor,__decorateClass$7=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$7(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$7(target,key,result),result},"__decorateClass$7"),__decorateParam$7=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$7");const isEqualLink=__name((a,b)=>{var _a2,_b2;return a.unitId===b.unitId&&a.subUnitId===b.subUnitId&&a.row===b.row&&a.col===b.col&&((_a2=a.customRange)==null?void 0:_a2.rangeId)===((_b2=b.customRange)==null?void 0:_b2.rangeId)&&a.type===b.type},"isEqualLink");exports2.SheetsHyperLinkPopupService=(_c=class extends core.Disposable{constructor(_sheetCanvasPopManagerService,_injector,_univerInstanceService,_editorBridgeService,_textSelectionManagerService,_docCanvasPopManagerService,_zenZoneService){super();__publicField(this,"_currentPopup",null);__publicField(this,"_currentPopup$",new rxjs.Subject);__publicField(this,"currentPopup$",this._currentPopup$.asObservable());__publicField(this,"_currentEditingPopup",null);__publicField(this,"_currentEditing$",new rxjs.BehaviorSubject(null));__publicField(this,"currentEditing$",this._currentEditing$.asObservable());__publicField(this,"_isKeepVisible",!1);this._sheetCanvasPopManagerService=_sheetCanvasPopManagerService,this._injector=_injector,this._univerInstanceService=_univerInstanceService,this._editorBridgeService=_editorBridgeService,this._textSelectionManagerService=_textSelectionManagerService,this._docCanvasPopManagerService=_docCanvasPopManagerService,this._zenZoneService=_zenZoneService,this.disposeWithMe(()=>{this.hideCurrentPopup(),this.endEditing(),this._currentEditing$.complete(),this._currentPopup$.complete()})}get currentPopup(){return this._currentPopup}get currentEditing(){return this._currentEditing$.getValue()}setIsKeepVisible(v){this._isKeepVisible=v}getIsKeepVisible(){return this._isKeepVisible}showPopup(location2){if(this._currentPopup&&isEqualLink(location2,this._currentPopup)||(this.hideCurrentPopup(void 0,!0),location2.type!==HyperLinkEditSourceType.ZEN_EDITOR&&this._zenZoneService.visible))return;const currentEditing=this._currentEditing$.getValue();if(currentEditing&&isEqualLink(location2,currentEditing))return;const{unitId,subUnitId,row,col,customRangeRect,customRange}=location2;let disposable;const popup={componentKey:CellLinkPopup.componentKey,direction:"bottom",onClickOutside:__name(()=>{this.hideCurrentPopup()},"onClickOutside"),onClick:__name(()=>{this.hideCurrentPopup(location2.type,!0)},"onClick")};if(location2.type===HyperLinkEditSourceType.EDITING){if(!customRange)return;disposable=customRangeRect&&this._sheetCanvasPopManagerService.attachPopupToAbsolutePosition(customRangeRect,popup)}else if(location2.type===HyperLinkEditSourceType.ZEN_EDITOR){if(!customRange)return;disposable=this._docCanvasPopManagerService.attachPopupToRange({startOffset:customRange.startIndex,endOffset:customRange.endIndex+1,collapsed:!1},popup,core.DOCS_ZEN_EDITOR_UNIT_ID_KEY)}else if(location2.showAll)disposable=this._sheetCanvasPopManagerService.attachPopupToCell(location2.row,location2.col,popup,unitId,subUnitId);else{if(!customRange)return;disposable=customRangeRect&&this._sheetCanvasPopManagerService.attachPopupByPosition(customRangeRect,popup,location2)}disposable&&(this._currentPopup={unitId,subUnitId,disposable,row,col,editPermission:!!location2.editPermission,copyPermission:!!location2.copyPermission,customRange,type:location2.type,showAll:location2.showAll},this._currentPopup$.next(this._currentPopup))}hideCurrentPopup(type,force){var _a2,_b2;this._currentPopup&&((!type||type===this._currentPopup.type)&&this._currentPopup.disposable.canDispose()||force)&&((_b2=(_a2=this._currentPopup)==null?void 0:_a2.disposable)==null||_b2.dispose(),this._currentPopup=null,this._currentPopup$.next(null))}_getEditingRange(){var _a2,_b2,_c2;const visible=this._editorBridgeService.isVisible().visible,state=this._editorBridgeService.getEditCellState();if(visible&&state){const textRange=this._textSelectionManagerService.getActiveTextRange(),body=(_a2=state.documentLayoutObject.documentModel)==null?void 0:_a2.getBody();if(!body)return null;if(!textRange||textRange.collapsed)return{startOffset:0,endOffset:body.dataStream.length-2,collapsed:body.dataStream.length-2===0,label:core.BuildTextUtils.transform.getPlainText(body.dataStream)};const links=core.BuildTextUtils.customRange.getCustomRangesInterestsWithSelection(textRange,(_c2=(_b2=body.customRanges)==null?void 0:_b2.filter(i=>i.rangeType===core.CustomRangeType.HYPERLINK))!=null?_c2:[]);let start=textRange.startOffset,end=textRange.endOffset;return links.forEach(link=>{start=Math.min(start,link.startIndex),end=Math.max(end,link.endIndex+1)}),{startOffset:start,endOffset:end,collapsed:start===end,label:core.BuildTextUtils.transform.getPlainText(body.dataStream.slice(start,end))}}return null}get _editPopup(){return{componentKey:CellLinkEdit.componentKey,direction:"vertical",onClickOutside:__name(()=>{this.getIsKeepVisible()||this.endEditing()},"onClickOutside"),onContextMenu:__name(()=>{this.getIsKeepVisible()||this.endEditing()},"onContextMenu"),hiddenType:"hide"}}startAddEditing(link){var _a2,_b2,_c2,_d2,_e2;const{unitId,subUnitId,type}=link;if(type===HyperLinkEditSourceType.ZEN_EDITOR){const document=this._univerInstanceService.getUnit(core.DOCS_ZEN_EDITOR_UNIT_ID_KEY,core.UniverInstanceType.UNIVER_DOC);if(!document)return;const range=this._textSelectionManagerService.getActiveTextRange();if(!range)return;this._currentEditingPopup=this._docCanvasPopManagerService.attachPopupToRange(range,this._editPopup,core.DOCS_ZEN_EDITOR_UNIT_ID_KEY);const label=(_a2=document.getBody())==null?void 0:_a2.dataStream.slice(range.startOffset,range.endOffset);this._currentEditing$.next({...link,label})}else if(type===HyperLinkEditSourceType.EDITING){const range=this._getEditingRange();if(!range)return;this._textSelectionManagerService.replaceDocRanges([{...range}],{unitId:core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY,subUnitId:core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY});const currentRender=this._injector.get(engineRender.IRenderManagerService).getRenderById(core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY);if(!currentRender)return;const rects=docsUi.calcDocRangePositions(range,currentRender);if(!(rects!=null&&rects.length))return;this._currentEditingPopup=this._sheetCanvasPopManagerService.attachPopupToAbsolutePosition(rects.pop(),this._editPopup,unitId,subUnitId),this._currentEditing$.next({...link,label:(_b2=range==null?void 0:range.label)!=null?_b2:""})}else{this._currentEditingPopup=this._sheetCanvasPopManagerService.attachPopupToCell(link.row,link.col,this._editPopup,unitId,subUnitId);const workbook=this._univerInstanceService.getUnit(unitId,core.UniverInstanceType.UNIVER_SHEET),worksheet=workbook==null?void 0:workbook.getSheetBySheetId(subUnitId),cell=worksheet==null?void 0:worksheet.getCellRaw(link.row,link.col);this._currentEditing$.next({...link,label:cell!=null&&cell.p?core.BuildTextUtils.transform.getPlainText((_d2=(_c2=cell.p.body)==null?void 0:_c2.dataStream)!=null?_d2:""):((_e2=cell==null?void 0:cell.v)!=null?_e2:"").toString()})}}startEditing(link){var _a2,_b2,_c2,_d2,_e2,_f2;(_a2=this._currentEditingPopup)==null||_a2.dispose(),this.hideCurrentPopup(void 0,!0);const{unitId,subUnitId}=link;let customRange,label;if(link.type===HyperLinkEditSourceType.ZEN_EDITOR){const document=this._univerInstanceService.getUnit(core.DOCS_ZEN_EDITOR_UNIT_ID_KEY,core.UniverInstanceType.UNIVER_DOC);if(customRange=(_c2=(_b2=document==null?void 0:document.getBody())==null?void 0:_b2.customRanges)==null?void 0:_c2.find(range=>range.rangeId===link.customRangeId),label=customRange?(_d2=document==null?void 0:document.getBody())==null?void 0:_d2.dataStream.slice(customRange.startIndex,customRange.endIndex+1):"",!customRange||!label)return;this._textSelectionManagerService.replaceTextRanges([{startOffset:customRange.startIndex,endOffset:customRange.endIndex+1}]),this._currentEditingPopup=this._docCanvasPopManagerService.attachPopupToRange({startOffset:customRange.startIndex,endOffset:customRange.endIndex,collapsed:!1},this._editPopup,core.DOCS_ZEN_EDITOR_UNIT_ID_KEY)}else if(link.type===HyperLinkEditSourceType.EDITING){const customRangeInfo=sheetsUi.getEditingCustomRangePosition(this._injector,link.unitId,link.subUnitId,link.row,link.col,link.customRangeId);if(!customRangeInfo||!((_e2=customRangeInfo.rects)!=null&&_e2.length))return;customRange=customRangeInfo.customRange,label=customRangeInfo.label,this._textSelectionManagerService.replaceTextRanges([{startOffset:customRange.startIndex,endOffset:customRange.endIndex+1}]),this._currentEditingPopup=this._sheetCanvasPopManagerService.attachPopupToAbsolutePosition(customRangeInfo.rects.pop(),this._editPopup,unitId,subUnitId)}else{const workbook=this._univerInstanceService.getUnit(unitId,core.UniverInstanceType.UNIVER_SHEET),worksheet=workbook==null?void 0:workbook.getSheetBySheetId(subUnitId),cell=worksheet==null?void 0:worksheet.getCellRaw(link.row,link.col),style=workbook==null?void 0:workbook.getStyles().getStyleByCell(cell),tr=style==null?void 0:style.tr,customRangeInfo=sheetsUi.getCustomRangePosition(this._injector,link.unitId,link.subUnitId,link.row,link.col,link.customRangeId);if(!customRangeInfo||!((_f2=customRangeInfo.rects)!=null&&_f2.length))return;customRange=customRangeInfo.customRange,label=customRangeInfo.label,tr?this._currentEditingPopup=this._sheetCanvasPopManagerService.attachPopupToCell(link.row,link.col,this._editPopup,unitId,subUnitId):this._currentEditingPopup=this._sheetCanvasPopManagerService.attachPopupByPosition(customRangeInfo.rects.pop(),this._editPopup,{unitId,subUnitId,row:link.row,col:link.col})}this._currentEditing$.next({...link,customRange,label})}endEditing(type){var _a2;const current=this._currentEditing$.getValue();current&&(!type||type===current.type)&&((_a2=this._currentEditingPopup)==null||_a2.dispose(),this._currentEditing$.next(null))}},__name(_c,"SheetsHyperLinkPopupService"),_c),exports2.SheetsHyperLinkPopupService=__decorateClass$7([__decorateParam$7(0,core.Inject(sheetsUi.SheetCanvasPopManagerService)),__decorateParam$7(1,core.Inject(core.Injector)),__decorateParam$7(2,core.IUniverInstanceService),__decorateParam$7(3,sheetsUi.IEditorBridgeService),__decorateParam$7(4,core.Inject(docs.DocSelectionManagerService)),__decorateParam$7(5,core.Inject(docsUi.DocCanvasPopManagerService)),__decorateParam$7(6,ui.IZenZoneService)],exports2.SheetsHyperLinkPopupService);var DisableLinkType=(DisableLinkType2=>(DisableLinkType2[DisableLinkType2.ALLOWED=0]="ALLOWED",DisableLinkType2[DisableLinkType2.DISABLED_BY_CELL=1]="DISABLED_BY_CELL",DisableLinkType2[DisableLinkType2.ALLOW_ON_EDITING=2]="ALLOW_ON_EDITING",DisableLinkType2))(DisableLinkType||{});const disables=new Set([core.DataValidationType.CHECKBOX,core.DataValidationType.LIST,core.DataValidationType.LIST_MULTIPLE]),getShouldDisableCellLink=__name((accessor,worksheet,row,col)=>{var _a2,_b2;const cell=worksheet.getCell(row,col);if(cell!=null&&cell.f||cell!=null&&cell.si)return 1;const dataValidationModel=accessor.has(sheetsDataValidation.SheetDataValidationModel)?accessor.get(sheetsDataValidation.SheetDataValidationModel):null,rule=dataValidationModel==null?void 0:dataValidationModel.getRuleByLocation(worksheet.getUnitId(),worksheet.getSheetId(),row,col);return rule&&disables.has(rule.type)?!0:(_b2=(_a2=cell==null?void 0:cell.p)==null?void 0:_a2.drawingsOrder)!=null&&_b2.length?2:0},"getShouldDisableCellLink"),getShouldDisableCurrentCellLink=__name(accessor=>{const unit=accessor.get(core.IUniverInstanceService).getCurrentUnitForType(core.UniverInstanceType.UNIVER_SHEET);if(!unit)return!0;const worksheet=unit.getActiveSheet(),selections=accessor.get(sheets.SheetsSelectionsService).getCurrentSelections();if(!selections.length)return!0;const row=selections[0].range.startRow,col=selections[0].range.startColumn;return getShouldDisableCellLink(accessor,worksheet,row,col)===1},"getShouldDisableCurrentCellLink"),shouldDisableAddLink=__name(accessor=>{const textSelectionService=accessor.get(docs.DocSelectionManagerService),univerInstanceService=accessor.get(core.IUniverInstanceService),textRanges=textSelectionService.getTextRanges();if(!(textRanges!=null&&textRanges.length))return!0;const doc=univerInstanceService.getCurrentUnitForType(core.UniverInstanceType.UNIVER_DOC);return!!(!doc||textRanges.every(range=>range.collapsed)||!doc.getSelfOrHeaderFooterModel(textRanges[0].segmentId).getBody())},"shouldDisableAddLink"),OpenHyperLinkEditPanelOperation={type:core.CommandType.OPERATION,id:"sheet.operation.open-hyper-link-edit-panel",handler(accessor,params){if(!params)return!1;const popupService=accessor.get(exports2.SheetsHyperLinkPopupService);return params.customRangeId?popupService.startEditing(params):popupService.startAddEditing(params),!0}},CloseHyperLinkPopupOperation={type:core.CommandType.OPERATION,id:"sheet.operation.close-hyper-link-popup",handler(accessor){return accessor.get(exports2.SheetsHyperLinkPopupService).endEditing(),!0}},InsertHyperLinkOperation={type:core.CommandType.OPERATION,id:"sheet.operation.insert-hyper-link",handler(accessor){var _a2;const univerInstanceService=accessor.get(core.IUniverInstanceService),target=sheets.getSheetCommandTarget(univerInstanceService),editorBridgeService=accessor.get(sheetsUi.IEditorBridgeService);if(!target)return!1;const commandService=accessor.get(core.ICommandService),selection=accessor.get(sheets.SheetsSelectionsService).getCurrentLastSelection();if(!selection)return!1;const row=selection.range.startRow,col=selection.range.startColumn,visible=editorBridgeService.isVisible(),isZenEditor=((_a2=univerInstanceService.getFocusedUnit())==null?void 0:_a2.getUnitId())===core.DOCS_ZEN_EDITOR_UNIT_ID_KEY;return commandService.executeCommand(OpenHyperLinkEditPanelOperation.id,{unitId:target.unitId,subUnitId:target.subUnitId,row,col,type:isZenEditor?HyperLinkEditSourceType.ZEN_EDITOR:visible.visible?HyperLinkEditSourceType.EDITING:HyperLinkEditSourceType.VIEWING})}},InsertHyperLinkToolbarOperation={type:core.CommandType.OPERATION,id:"sheet.operation.insert-hyper-link-toolbar",handler(accessor){if(getShouldDisableCurrentCellLink(accessor))return!1;const commandService=accessor.get(core.ICommandService);return accessor.get(exports2.SheetsHyperLinkPopupService).currentEditing?commandService.executeCommand(CloseHyperLinkPopupOperation.id):commandService.executeCommand(InsertHyperLinkOperation.id)}},getEditingLinkDisable$=__name((accessor,unitId=core.DOCS_ZEN_EDITOR_UNIT_ID_KEY)=>{var _a2;const univerInstanceService=accessor.get(core.IUniverInstanceService),docSelctionService=(_a2=accessor.get(engineRender.IRenderManagerService).getRenderById(unitId))==null?void 0:_a2.with(docsUi.DocSelectionRenderService);return docSelctionService?docSelctionService.textSelectionInner$.pipe(rxjs.map(()=>{const state=accessor.get(sheetsUi.IEditorBridgeService).getEditCellState();if(!state)return!0;const target=sheets.getSheetCommandTarget(univerInstanceService,{unitId:state.unitId,subUnitId:state.sheetId});return!(target!=null&&target.worksheet)||getShouldDisableCellLink(accessor,target.worksheet,state.row,state.column)===1?!0:shouldDisableAddLink(accessor)})):rxjs.of(!0)},"getEditingLinkDisable$"),getLinkDisable$=__name(accessor=>{const disableRange$=sheetsUi.getCurrentRangeDisable$(accessor,{workbookTypes:[sheets.WorkbookEditablePermission],worksheetTypes:[sheets.WorksheetEditPermission,sheets.WorksheetSetCellValuePermission,sheets.WorksheetInsertHyperlinkPermission],rangeTypes:[sheets.RangeProtectionPermissionEditPoint]},!0),univerInstanceService=accessor.get(core.IUniverInstanceService),sheetSelectionService=accessor.get(sheets.SheetsSelectionsService),editorBridgeService=accessor.has(sheetsUi.IEditorBridgeService)?accessor.get(sheetsUi.IEditorBridgeService):null,disableCell$=univerInstanceService.focused$.pipe(rxjs.filter(focused=>!!focused),rxjs.map(focused=>univerInstanceService.getUnit(focused,core.UniverInstanceType.UNIVER_SHEET)),rxjs.filter(unit=>!!unit),rxjs.switchMap(unit=>unit.activeSheet$),rxjs.switchMap(sheet=>sheetSelectionService.selectionMoveEnd$.pipe(rxjs.map(selections=>sheet&&{selections,sheet}))),rxjs.map(sheetWithSelection=>{if(!sheetWithSelection)return DisableLinkType.DISABLED_BY_CELL;const{selections,sheet}=sheetWithSelection;if(!selections.length)return DisableLinkType.DISABLED_BY_CELL;const row=selections[0].range.startRow,col=selections[0].range.startColumn;return getShouldDisableCellLink(accessor,sheet,row,col)}),rxjs.switchMap(disableCell=>{if(disableCell===DisableLinkType.DISABLED_BY_CELL)return rxjs.of(!0);const isEditing$=(editorBridgeService?editorBridgeService.visible$:rxjs.of(null)).pipe(rxjs.map(visible=>visible!=null&&visible.visible?core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY:void 0)),focusingFxBarEditor$=accessor.get(core.IContextService).subscribeContextValue$(core.FOCUSING_FX_BAR_EDITOR);return rxjs.combineLatest([isEditing$,focusingFxBarEditor$]).pipe(rxjs.switchMap(([editing,focusingFxBarEditor])=>editing?focusingFxBarEditor?rxjs.of(!0):getEditingLinkDisable$(accessor,editing):rxjs.of(disableCell===DisableLinkType.ALLOW_ON_EDITING)))}));return disableRange$.pipe(rxjs.distinctUntilChanged(),rxjs.switchMap(disableRange=>disableCell$.pipe(rxjs.map(disableCell=>disableRange||disableCell))))},"getLinkDisable$"),linkMenu={commandId:InsertHyperLinkOperation.id,type:ui.MenuItemType.BUTTON,title:"hyperLink.menu.add",icon:"LinkSingle"},genZenEditorMenuId=__name(id=>`${id}-zen-editor`,"genZenEditorMenuId"),insertLinkMenuFactory=__name(accessor=>({...linkMenu,id:linkMenu.commandId,hidden$:ui.getMenuHiddenObservable(accessor,core.UniverInstanceType.UNIVER_SHEET),disabled$:getLinkDisable$(accessor)}),"insertLinkMenuFactory"),zenEditorInsertLinkMenuFactory=__name(accessor=>({...linkMenu,id:genZenEditorMenuId(linkMenu.commandId),hidden$:ui.getMenuHiddenObservable(accessor,core.UniverInstanceType.UNIVER_DOC,core.DOCS_ZEN_EDITOR_UNIT_ID_KEY),disabled$:getEditingLinkDisable$(accessor)}),"zenEditorInsertLinkMenuFactory"),linkToolbarMenu={tooltip:"hyperLink.form.addTitle",commandId:InsertHyperLinkToolbarOperation.id,type:ui.MenuItemType.BUTTON,icon:"LinkSingle"},insertLinkMenuToolbarFactory=__name(accessor=>({...linkToolbarMenu,id:linkToolbarMenu.commandId,hidden$:ui.getMenuHiddenObservable(accessor,core.UniverInstanceType.UNIVER_SHEET),disabled$:getLinkDisable$(accessor)}),"insertLinkMenuToolbarFactory"),zenEditorInsertLinkMenuToolbarFactory=__name(accessor=>({...linkToolbarMenu,id:genZenEditorMenuId(linkToolbarMenu.commandId),hidden$:ui.getMenuHiddenObservable(accessor,core.UniverInstanceType.UNIVER_DOC,core.DOCS_ZEN_EDITOR_UNIT_ID_KEY),disabled$:getEditingLinkDisable$(accessor)}),"zenEditorInsertLinkMenuToolbarFactory"),InsertLinkShortcut={id:InsertHyperLinkToolbarOperation.id,binding:ui.KeyCode.K|ui.MetaKeys.CTRL_COMMAND,preconditions:sheetsUi.whenSheetEditorFocused};var __defProp$6=Object.defineProperty,__getOwnPropDesc$6=Object.getOwnPropertyDescriptor,__decorateClass$6=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$6(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$6(target,key,result),result},"__decorateClass$6"),__decorateParam$6=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$6");let SheetsHyperLinkAutoFillController=(_d=class extends core.Disposable{constructor(_autoFillService,_hyperLinkModel){super(),this._autoFillService=_autoFillService,this._hyperLinkModel=_hyperLinkModel,this._initAutoFill()}_initAutoFill(){const noopReturnFunc=__name(()=>({redos:[],undos:[]}),"noopReturnFunc"),generalApplyFunc=__name((location2,applyType)=>{const{source:sourceRange,target:targetRange,unitId,subUnitId}=location2,virtualRange=sheetsUi.virtualizeDiscreteRanges([sourceRange,targetRange]),[vSourceRange,vTargetRange]=virtualRange.ranges,{mapFunc}=virtualRange,sourceStartCell={row:vSourceRange.startRow,col:vSourceRange.startColumn},repeats=sheetsUi.getAutoFillRepeatRange(vSourceRange,vTargetRange),redos=[],undos=[];return repeats.forEach(repeat=>{const targetStartCell=repeat.repeatStartCell,relativeRange=repeat.relativeRange,sourceRange2={startRow:sourceStartCell.row,startColumn:sourceStartCell.col,endColumn:sourceStartCell.col,endRow:sourceStartCell.row},targetRange2={startRow:targetStartCell.row,startColumn:targetStartCell.col,endColumn:targetStartCell.col,endRow:targetStartCell.row};core.Range.foreach(relativeRange,(row,col)=>{const sourcePositionRange=core.Rectangle.getPositionRange({startRow:row,startColumn:col,endColumn:col,endRow:row},sourceRange2),{row:sourceRow,col:sourceCol}=mapFunc(sourcePositionRange.startRow,sourcePositionRange.startColumn),link=this._hyperLinkModel.getHyperLinkByLocation(unitId,subUnitId,sourceRow,sourceCol),targetPositionRange=core.Rectangle.getPositionRange({startRow:row,startColumn:col,endColumn:col,endRow:row},targetRange2),{row:targetRow,col:targetCol}=mapFunc(targetPositionRange.startRow,targetPositionRange.startColumn),id=core.Tools.generateRandomId(),currentLink=this._hyperLinkModel.getHyperLinkByLocation(unitId,subUnitId,targetRow,targetCol);currentLink&&redos.push({id:sheetsHyperLink.RemoveHyperLinkMutation.id,params:{unitId,subUnitId,id:currentLink.id}}),(sheetsUi.APPLY_TYPE.COPY===applyType||sheetsUi.APPLY_TYPE.SERIES===applyType)&&link&&(redos.push({id:sheetsHyperLink.AddHyperLinkMutation.id,params:{unitId,subUnitId,link:{...link,id,row:targetRow,column:targetCol}}}),undos.push({id:sheetsHyperLink.RemoveHyperLinkMutation.id,params:{unitId,subUnitId,id}})),currentLink&&undos.push({id:sheetsHyperLink.AddHyperLinkMutation.id,params:{unitId,subUnitId,link:currentLink}})})}),{undos,redos}},"generalApplyFunc"),hook={id:SHEET_HYPER_LINK_UI_PLUGIN,onFillData:__name((location2,direction,applyType)=>applyType===sheetsUi.APPLY_TYPE.COPY||applyType===sheetsUi.APPLY_TYPE.ONLY_FORMAT||applyType===sheetsUi.APPLY_TYPE.SERIES?generalApplyFunc(location2,applyType):noopReturnFunc(),"onFillData")};this.disposeWithMe(this._autoFillService.addHook(hook))}},__name(_d,"SheetsHyperLinkAutoFillController"),_d);SheetsHyperLinkAutoFillController=__decorateClass$6([__decorateParam$6(0,sheetsUi.IAutoFillService),__decorateParam$6(1,core.Inject(sheetsHyperLink.HyperLinkModel))],SheetsHyperLinkAutoFillController);var __defProp$5=Object.defineProperty,__getOwnPropDesc$5=Object.getOwnPropertyDescriptor,__decorateClass$5=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$5(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$5(target,key,result),result},"__decorateClass$5"),__decorateParam$5=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$5");let SheetsHyperLinkPermissionController=(_e=class extends core.Disposable{constructor(_localeService,_commandService,_sheetPermissionCheckController){super(),this._localeService=_localeService,this._commandService=_commandService,this._sheetPermissionCheckController=_sheetPermissionCheckController,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(command=>{command.id===InsertLinkShortcut.id&&(this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[sheets.WorkbookEditablePermission],rangeTypes:[sheets.RangeProtectionPermissionEditPoint],worksheetTypes:[sheets.WorksheetEditPermission,sheets.WorksheetSetCellValuePermission,sheets.WorksheetInsertHyperlinkPermission]})||this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.hyperLinkErr")))}))}},__name(_e,"SheetsHyperLinkPermissionController"),_e);SheetsHyperLinkPermissionController=__decorateClass$5([__decorateParam$5(0,core.Inject(core.LocaleService)),__decorateParam$5(1,core.ICommandService),__decorateParam$5(2,core.Inject(sheets.SheetPermissionCheckController))],SheetsHyperLinkPermissionController);var __defProp$4=Object.defineProperty,__getOwnPropDesc$4=Object.getOwnPropertyDescriptor,__decorateClass$4=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$4(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$4(target,key,result),result},"__decorateClass$4"),__decorateParam$4=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$4");let SheetsHyperLinkPopupController=(_f=class extends core.Disposable{constructor(_hoverManagerService,_sheetsHyperLinkPopupService,_renderManagerService,_permissionService,_sheetPermissionCheckController,_commandService,_editorBridgeService,_textSelectionManagerService,_univerInstanceService,_zenZoneService){super(),this._hoverManagerService=_hoverManagerService,this._sheetsHyperLinkPopupService=_sheetsHyperLinkPopupService,this._renderManagerService=_renderManagerService,this._permissionService=_permissionService,this._sheetPermissionCheckController=_sheetPermissionCheckController,this._commandService=_commandService,this._editorBridgeService=_editorBridgeService,this._textSelectionManagerService=_textSelectionManagerService,this._univerInstanceService=_univerInstanceService,this._zenZoneService=_zenZoneService,this._initHoverListener(),this._initCommandListener(),this._initHoverEditingListener(),this._initTextSelectionListener(),this._initZenEditor()}_getLinkPermission(location2){const{unitId,subUnitId,row:currentRow,col:currentCol}=location2,workbook=this._univerInstanceService.getUnit(unitId,core.UniverInstanceType.UNIVER_SHEET);if(!(workbook==null?void 0:workbook.getSheetBySheetId(subUnitId)))return{viewPermission:!1,editPermission:!1,copyPermission:!1};const viewPermission=this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[sheets.WorkbookViewPermission],worksheetTypes:[sheets.WorksheetViewPermission],rangeTypes:[sheets.RangeProtectionPermissionViewPoint]},[{startRow:currentRow,startColumn:currentCol,endRow:currentRow,endColumn:currentCol}]),editPermission=this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[sheets.WorkbookEditablePermission],worksheetTypes:[sheets.WorksheetEditPermission,sheets.WorksheetInsertHyperlinkPermission],rangeTypes:[sheets.RangeProtectionPermissionEditPoint]},[{startRow:currentRow,startColumn:currentCol,endRow:currentRow,endColumn:currentCol}]),copyPermission=this._permissionService.composePermission([new sheets.WorkbookCopyPermission(unitId).id,new sheets.WorksheetCopyPermission(unitId,subUnitId).id]).every(permission=>permission.value);return{viewPermission,editPermission,copyPermission}}_initHoverListener(){this.disposeWithMe(this._hoverManagerService.currentRichText$.pipe(rxjs.debounceTime(200)).subscribe(currentCell=>{var _a2,_b2;if(!currentCell){this._sheetsHyperLinkPopupService.hideCurrentPopup();return}const{unitId,subUnitId,row,col}=currentCell,renderer=this._renderManagerService.getRenderById(unitId);if(!renderer)return;const workbook=this._univerInstanceService.getUnit(unitId,core.UniverInstanceType.UNIVER_SHEET),worksheet=workbook==null?void 0:workbook.getSheetBySheetId(subUnitId);if(!worksheet)return;if(!renderer.with(sheetsUi.HoverRenderController).active){this._sheetsHyperLinkPopupService.hideCurrentPopup(HyperLinkEditSourceType.VIEWING);return}const skeleton=(_a2=renderer==null?void 0:renderer.with(sheetsUi.SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId))==null?void 0:_a2.skeleton,currentCol=col,currentRow=row;let targetRow=currentRow,targetCol=currentCol;skeleton&&skeleton.overflowCache.forValue((row2,col2,value)=>{core.Rectangle.contains(value,{startColumn:currentCol,endColumn:currentCol,startRow:currentRow,endRow:currentRow})&&(targetRow=row2,targetCol=col2)});const{viewPermission,editPermission,copyPermission}=this._getLinkPermission(currentCell);if(!viewPermission){this._sheetsHyperLinkPopupService.hideCurrentPopup();return}const cell=worksheet.getCellStyleOnly(targetRow,targetCol),style=workbook.getStyles().getStyleByCell(cell),tr=(_b2=style==null?void 0:style.tr)==null?void 0:_b2.a;if(!tr&&!currentCell.customRange){this._sheetsHyperLinkPopupService.hideCurrentPopup();return}this._sheetsHyperLinkPopupService.showPopup({row:targetRow,col:targetCol,editPermission,copyPermission,customRange:currentCell.customRange,customRangeRect:currentCell.rect,type:HyperLinkEditSourceType.VIEWING,unitId,subUnitId,showAll:!!tr})}))}_initHoverEditingListener(){let subscribe=null;this.disposeWithMe(this._editorBridgeService.currentEditCellState$.pipe(rxjs.switchMap(state=>this._editorBridgeService.visible$.pipe(rxjs.map(visible=>({visible,state}))))).subscribe(({visible,state})=>{if(!state||state.editorUnitId!==core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY)return;if(!visible.visible){subscribe==null||subscribe.unsubscribe(),this._sheetsHyperLinkPopupService.hideCurrentPopup(HyperLinkEditSourceType.EDITING),this._sheetsHyperLinkPopupService.endEditing(HyperLinkEditSourceType.EDITING);return}const{editorUnitId,unitId,sheetId,row,column}=state,renderer=this._renderManagerService.getRenderById(editorUnitId);if(!renderer)return;const{editPermission,viewPermission,copyPermission}=this._getLinkPermission({unitId,subUnitId:sheetId,row,col:column}),docEventService=renderer.with(docsUi.DocEventManagerService);viewPermission&&(subscribe==null||subscribe.unsubscribe(),subscribe=docEventService.hoverCustomRanges$.pipe(rxjs.debounceTime(200)).subscribe(customRanges=>{var _a2,_b2;const customRange=customRanges.find(customRange2=>customRange2.range.rangeType===core.CustomRangeType.HYPERLINK);if(!customRange){this._sheetsHyperLinkPopupService.hideCurrentPopup();return}const rect=customRange.rects[customRange.rects.length-1];if(!((_b2=(_a2=this._renderManagerService.getRenderById(unitId))==null?void 0:_a2.with(sheetsUi.SheetSkeletonManagerService).getWorksheetSkeleton(sheetId))==null?void 0:_b2.skeleton)||!rect)return;const canvasClientRect=renderer.engine.getCanvasElement().getBoundingClientRect();this._sheetsHyperLinkPopupService.showPopup({unitId,subUnitId:sheetId,row,col:column,customRange:customRange.range,customRangeRect:{left:rect.left+canvasClientRect.left,top:rect.top+canvasClientRect.top,bottom:rect.bottom+canvasClientRect.top,right:rect.right+canvasClientRect.left},editPermission,copyPermission,type:HyperLinkEditSourceType.EDITING})}))})),this.disposeWithMe(()=>{subscribe==null||subscribe.unsubscribe()})}_initZenEditor(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(visible=>{visible?(this._sheetsHyperLinkPopupService.hideCurrentPopup(HyperLinkEditSourceType.VIEWING),this._sheetsHyperLinkPopupService.hideCurrentPopup(HyperLinkEditSourceType.EDITING),this._sheetsHyperLinkPopupService.endEditing(HyperLinkEditSourceType.EDITING),this._sheetsHyperLinkPopupService.hideCurrentPopup(HyperLinkEditSourceType.VIEWING)):(this._sheetsHyperLinkPopupService.hideCurrentPopup(HyperLinkEditSourceType.ZEN_EDITOR),this._sheetsHyperLinkPopupService.endEditing(HyperLinkEditSourceType.ZEN_EDITOR))})),this.disposeWithMe(this._univerInstanceService.focused$.pipe(rxjs.switchMap(id=>{const render2=id===core.DOCS_ZEN_EDITOR_UNIT_ID_KEY?this._renderManagerService.getRenderById(id):null;return render2?render2.with(docsUi.DocEventManagerService).hoverCustomRanges$.pipe(rxjs.debounceTime(200)):new rxjs.Observable(sub=>{sub.next(null)})})).subscribe(value=>{const range=value==null?void 0:value.find(range2=>range2.range.rangeType===core.CustomRangeType.HYPERLINK),state=this._editorBridgeService.getEditCellState();if(range&&state){const{unitId,sheetId,row,column}=state,{editPermission,viewPermission,copyPermission}=this._getLinkPermission({unitId,subUnitId:sheetId,row,col:column});viewPermission&&this._sheetsHyperLinkPopupService.showPopup({type:HyperLinkEditSourceType.ZEN_EDITOR,unitId,subUnitId:sheetId,row,col:column,customRange:range.range,editPermission,copyPermission})}else this._sheetsHyperLinkPopupService.hideCurrentPopup(HyperLinkEditSourceType.ZEN_EDITOR)}))}_initTextSelectionListener(){this.disposeWithMe(this._textSelectionManagerService.textSelection$.subscribe(selection=>{selection&&selection.unitId===core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY&&this._sheetsHyperLinkPopupService.endEditing(HyperLinkEditSourceType.EDITING)}))}_initCommandListener(){const HIDE_COMMAND_LIST=[sheets.ClearSelectionContentCommand.id,sheets.ClearSelectionAllCommand.id,sheets.ClearSelectionFormatCommand.id];this.disposeWithMe(this._commandService.onCommandExecuted(command=>{HIDE_COMMAND_LIST.includes(command.id)&&this._sheetsHyperLinkPopupService.hideCurrentPopup()}))}},__name(_f,"SheetsHyperLinkPopupController"),_f);SheetsHyperLinkPopupController=__decorateClass$4([__decorateParam$4(0,core.Inject(sheetsUi.HoverManagerService)),__decorateParam$4(1,core.Inject(exports2.SheetsHyperLinkPopupService)),__decorateParam$4(2,core.Inject(engineRender.IRenderManagerService)),__decorateParam$4(3,core.Inject(core.IPermissionService)),__decorateParam$4(4,core.Inject(sheets.SheetPermissionCheckController)),__decorateParam$4(5,core.ICommandService),__decorateParam$4(6,sheetsUi.IEditorBridgeService),__decorateParam$4(7,core.Inject(docs.DocSelectionManagerService)),__decorateParam$4(8,core.IUniverInstanceService),__decorateParam$4(9,ui.IZenZoneService)],SheetsHyperLinkPopupController);var __defProp$3=Object.defineProperty,__getOwnPropDesc$3=Object.getOwnPropertyDescriptor,__decorateClass$3=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$3(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$3(target,key,result),result},"__decorateClass$3"),__decorateParam$3=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$3");let SheetsHyperLinkRenderController=(_g=class extends core.Disposable{constructor(_context,_hyperLinkModel){super(),this._context=_context,this._hyperLinkModel=_hyperLinkModel,this._initSkeletonChange()}_initSkeletonChange(){const markSkeletonDirty=__name(()=>{var _a2;(_a2=this._context.mainComponent)==null||_a2.makeForceDirty()},"markSkeletonDirty");this.disposeWithMe(this._hyperLinkModel.linkUpdate$.pipe(rxjs.debounceTime(16)).subscribe(()=>{markSkeletonDirty()}))}},__name(_g,"SheetsHyperLinkRenderController"),_g);SheetsHyperLinkRenderController=__decorateClass$3([__decorateParam$3(1,core.Inject(sheetsHyperLink.HyperLinkModel))],SheetsHyperLinkRenderController);let SheetsHyperLinkRenderManagerController=(_h=class extends core.Disposable{constructor(_sheetInterceptorService,_hyperLinkModel){super(),this._sheetInterceptorService=_sheetInterceptorService,this._hyperLinkModel=_hyperLinkModel,this._initViewModelIntercept()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(sheets.INTERCEPTOR_POINT.CELL_CONTENT,{effect:core.InterceptorEffectEnum.Value,priority:100,handler:__name((cell,pos,next)=>{const{row,col,unitId,subUnitId}=pos,link=this._hyperLinkModel.getHyperLinkByLocation(unitId,subUnitId,row,col);return next(link?{...cell,linkUrl:link.payload,linkId:link.id}:cell)},"handler")}))}},__name(_h,"SheetsHyperLinkRenderManagerController"),_h);SheetsHyperLinkRenderManagerController=__decorateClass$3([__decorateParam$3(0,core.Inject(sheets.SheetInterceptorService)),__decorateParam$3(1,core.Inject(sheetsHyperLink.HyperLinkModel))],SheetsHyperLinkRenderManagerController);const menuSchema={[ui.RibbonStartGroup.OTHERS]:{[InsertHyperLinkToolbarOperation.id]:{order:2,menuItemFactory:insertLinkMenuToolbarFactory},[genZenEditorMenuId(InsertHyperLinkToolbarOperation.id)]:{order:2,menuItemFactory:zenEditorInsertLinkMenuToolbarFactory}},[ui.ContextMenuPosition.MAIN_AREA]:{[ui.ContextMenuGroup.OTHERS]:{order:1,[InsertHyperLinkToolbarOperation.id]:{order:0,menuItemFactory:insertLinkMenuFactory},[genZenEditorMenuId(InsertHyperLinkToolbarOperation.id)]:{order:0,menuItemFactory:zenEditorInsertLinkMenuFactory}}}};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");let SheetsHyperLinkUIController=(_i=class extends core.Disposable{constructor(_componentManager,_commandService,_menuManagerService,_injector,_shortcutService){super(),this._componentManager=_componentManager,this._commandService=_commandService,this._menuManagerService=_menuManagerService,this._injector=_injector,this._shortcutService=_shortcutService,this._initComponents(),this._initCommands(),this._initMenus(),this._initShortCut()}_initComponents(){[[CellLinkPopup,CellLinkPopup.componentKey],[CellLinkEdit,CellLinkEdit.componentKey],[LinkSingle,"LinkSingle"]].forEach(([comp,key])=>{this._componentManager.register(key,comp)})}_initCommands(){[OpenHyperLinkEditPanelOperation,CloseHyperLinkPopupOperation,InsertHyperLinkOperation,InsertHyperLinkToolbarOperation].forEach(command=>{this._commandService.registerCommand(command)})}_initMenus(){this._menuManagerService.mergeMenu(menuSchema)}_initShortCut(){this._shortcutService.registerShortcut(InsertLinkShortcut)}},__name(_i,"SheetsHyperLinkUIController"),_i);SheetsHyperLinkUIController=__decorateClass$2([__decorateParam$2(0,core.Inject(ui.ComponentManager)),__decorateParam$2(1,core.ICommandService),__decorateParam$2(2,ui.IMenuManagerService),__decorateParam$2(3,core.Inject(core.Injector)),__decorateParam$2(4,core.Inject(ui.IShortcutService))],SheetsHyperLinkUIController);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");let SheetHyperLinkUrlController=(_j=class extends core.Disposable{constructor(_parserService,_resolverService){super(),this._parserService=_parserService,this._resolverService=_resolverService,this._handleInitUrl()}_handleInitUrl(){const hash=location.hash;if(hash){const linkInfo=this._parserService.parseHyperLink(hash);this._resolverService.navigate(linkInfo)}}},__name(_j,"SheetHyperLinkUrlController"),_j);SheetHyperLinkUrlController=__decorateClass$1([__decorateParam$1(0,core.Inject(sheetsHyperLink.SheetsHyperLinkParserService)),__decorateParam$1(1,core.Inject(exports2.SheetsHyperLinkResolverService))],SheetHyperLinkUrlController);var __defProp2=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__defNormalProp2=__name((obj,key,value)=>key in obj?__defProp2(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,"__defNormalProp"),__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"),__publicField2=__name((obj,key,value)=>__defNormalProp2(obj,typeof key!="symbol"?key+"":key,value),"__publicField");exports2.UniverSheetsHyperLinkUIPlugin=(_k=class extends core.Plugin{constructor(_config=defaultPluginConfig,_injector,_configService){super(),this._config=_config,this._injector=_injector,this._configService=_configService;const{menu,...rest}=core.merge({},defaultPluginConfig,this._config);menu&&this._configService.setConfig("menu",menu,{merge:!0}),this._configService.setConfig(SHEETS_HYPER_LINK_UI_PLUGIN_CONFIG_KEY,rest)}onStarting(){[[exports2.SheetsHyperLinkResolverService],[exports2.SheetsHyperLinkPopupService],[SheetsHyperLinkSidePanelService],[SheetsHyperLinkRenderManagerController],[SheetsHyperLinkPopupController],[SheetsHyperLinkUIController],[SheetsHyperLinkAutoFillController],[exports2.SheetsHyperLinkCopyPasteController],[SheetsHyperLinkPermissionController],[SheetHyperLinkUrlController]].forEach(dep=>this._injector.add(dep)),this._injector.get(SheetsHyperLinkRenderManagerController)}onReady(){this._injector.get(engineRender.IRenderManagerService).registerRenderModule(core.UniverInstanceType.UNIVER_SHEET,[SheetsHyperLinkRenderController]),this._injector.get(SheetsHyperLinkAutoFillController),this._injector.get(exports2.SheetsHyperLinkCopyPasteController),this._injector.get(SheetsHyperLinkUIController)}onRendered(){this._injector.get(SheetsHyperLinkPermissionController),this._injector.get(SheetHyperLinkUrlController),this._injector.get(SheetsHyperLinkPopupController)}},__name(_k,"UniverSheetsHyperLinkUIPlugin"),_k),__publicField2(exports2.UniverSheetsHyperLinkUIPlugin,"pluginName",SHEET_HYPER_LINK_UI_PLUGIN),__publicField2(exports2.UniverSheetsHyperLinkUIPlugin,"type",core.UniverInstanceType.UNIVER_SHEET),exports2.UniverSheetsHyperLinkUIPlugin=__decorateClass([core.DependentOn(sheetsHyperLink.UniverSheetsHyperLinkPlugin,docsUi.UniverDocsUIPlugin),__decorateParam(1,core.Inject(core.Injector)),__decorateParam(2,core.IConfigService)],exports2.UniverSheetsHyperLinkUIPlugin),exports2.CloseHyperLinkPopupOperation=CloseHyperLinkPopupOperation,exports2.InsertHyperLinkOperation=InsertHyperLinkOperation,exports2.InsertLinkShortcut=InsertLinkShortcut,exports2.OpenHyperLinkEditPanelOperation=OpenHyperLinkEditPanelOperation,exports2.SheetsHyperLinkSidePanelService=SheetsHyperLinkSidePanelService,Object.defineProperty(exports2,Symbol.toStringTag,{value:"Module"})});
|
package/lib/umd/locale/en-US.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(global,factory){typeof exports=="object"&&typeof module<"u"?module.exports=factory():typeof define=="function"&&define.amd?define(factory):(global=typeof globalThis<"u"?globalThis:global||self,global.UniverSheetsHyperLinkUiEnUS=factory())})(this,function(){"use strict";return{hyperLink:{form:{editTitle:"Edit Link",addTitle:"Insert Link",label:"Label",type:"Type",link:"Link",linkPlaceholder:"Enter link",range:"Range",worksheet:"Worksheet",definedName:"Defined Name",ok:"Confirm",cancel:"Cancel",labelPlaceholder:"Enter label",inputError:"Please enter",selectError:"Please select",linkError:"Please enter a legal link"},menu:{add:"Insert Link"},message:{noSheet:"Target sheet has been delete",refError:"Invalid Range",hiddenSheet:"Cannot open the link because the linked sheet is hidden",coped:"Link copied to clipboard"},popup:{copy:"Copy Link",edit:"Edit Link",cancel:"Cancel Link"}}}});
|
package/lib/umd/locale/fa-IR.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(global,factory){typeof exports=="object"&&typeof module<"u"?module.exports=factory():typeof define=="function"&&define.amd?define(factory):(global=typeof globalThis<"u"?globalThis:global||self,global.UniverSheetsHyperLinkUiFaIR=factory())})(this,function(){"use strict";return{hyperLink:{form:{editTitle:"ویرایش لینک",addTitle:"درج لینک",label:"برچسب",type:"نوع",link:"لینک",linkPlaceholder:"لینک را وارد کنید",range:"محدوده",worksheet:"برگ کار",definedName:"نام تعریف شده",ok:"تایید",cancel:"انصراف",labelPlaceholder:"برچسب را وارد کنید",inputError:"لطفا وارد کنید",selectError:"لطفا انتخاب کنید",linkError:"لطفا یک لینک معتبر وارد کنید"},menu:{add:"درج لینک"},message:{noSheet:"برگ هدف حذف شده است",refError:"محدوده نامعتبر",hiddenSheet:"نمیتوان لینک را باز کرد زیرا برگ مرتبط پنهان است",coped:"لینک به کلیپ بورد کپی شد"},popup:{copy:"کپی لینک",edit:"ویرایش لینک",cancel:"لینک را لغو کنید"}}}});
|
package/lib/umd/locale/fr-FR.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(global,factory){typeof exports=="object"&&typeof module<"u"?module.exports=factory():typeof define=="function"&&define.amd?define(factory):(global=typeof globalThis<"u"?globalThis:global||self,global.UniverSheetsHyperLinkUiFrFR=factory())})(this,function(){"use strict";return{hyperLink:{form:{editTitle:"Modifier le lien",addTitle:"Insérer un lien",label:"Titre",type:"Type",link:"Lien",linkPlaceholder:"Entrez le lien",range:"Plage",worksheet:"Feuille de calcul",definedName:"Nom défini",ok:"Confirmer",cancel:"Annuler",labelPlaceholder:"Entrez le titre",inputError:"Veuillez entrer",selectError:"Veuillez sélectionner",linkError:"Veuillez entrer un lien valide"},menu:{add:"Insérer un lien"},message:{noSheet:"La feuille cible a été supprimée",refError:"Plage invalide",hiddenSheet:"Impossible d'ouvrir le lien car la feuille liée est masquée",coped:"Lien copié dans le presse-papiers"},popup:{copy:"Copier le lien",edit:"Modifier le lien",cancel:"Annuler le lien"}}}});
|
package/lib/umd/locale/ru-RU.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(global,factory){typeof exports=="object"&&typeof module<"u"?module.exports=factory():typeof define=="function"&&define.amd?define(factory):(global=typeof globalThis<"u"?globalThis:global||self,global.UniverSheetsHyperLinkUiRuRU=factory())})(this,function(){"use strict";return{hyperLink:{form:{editTitle:"Редактировать ссылку",addTitle:"Вставить ссылку",label:"Метка",type:"Тип",link:"Ссылка",linkPlaceholder:"Введите ссылку",range:"Диапазон",worksheet:"Лист",definedName:"Определенное имя",ok:"ОК",cancel:"Отмена",labelPlaceholder:"Введите метку",inputError:"Пожалуйста, введите",selectError:"Пожалуйста, выберите",linkError:"Пожалуйста, введите корректную ссылку"},menu:{add:"Вставить ссылку"},message:{noSheet:"Целевой лист был удален",refError:"Недопустимый диапазон",hiddenSheet:"Невозможно открыть ссылку, так как связанный лист скрыт",coped:"Ссылка скопирована в буфер обмена"},popup:{copy:"Копировать ссылку",edit:"Редактировать ссылку",cancel:"Отменить ссылку"}}}});
|
package/lib/umd/locale/vi-VN.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(global,factory){typeof exports=="object"&&typeof module<"u"?module.exports=factory():typeof define=="function"&&define.amd?define(factory):(global=typeof globalThis<"u"?globalThis:global||self,global.UniverSheetsHyperLinkUiViVN=factory())})(this,function(){"use strict";return{hyperLink:{form:{editTitle:"Chỉnh sửa liên kết",addTitle:"Chèn liên kết",label:"Văn bản",labelPlaceholder:"Nhập văn bản",type:"Loại",link:"Liên kết",linkPlaceholder:"Nhập địa chỉ liên kết",range:"Ô",worksheet:"Bảng tính",definedName:"Tên đã xác định",ok:"Xác nhận",cancel:"Hủy",inputError:"Vui lòng nhập",selectError:"Vui lòng chọn",linkError:"Vui lòng nhập liên kết hợp lệ"},menu:{add:"Thêm liên kết"},message:{noSheet:"Bảng con này đã bị xóa",refError:"Tham chiếu lỗi",hiddenSheet:"Không thể mở bảng con bị ẩn",coped:"Liên kết đã được sao chép vào clipboard"},popup:{copy:"Sao chép",edit:"Chỉnh sửa",cancel:"Hủy liên kết"}}}});
|
package/lib/umd/locale/zh-CN.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(global,factory){typeof exports=="object"&&typeof module<"u"?module.exports=factory():typeof define=="function"&&define.amd?define(factory):(global=typeof globalThis<"u"?globalThis:global||self,global.UniverSheetsHyperLinkUiZhCN=factory())})(this,function(){"use strict";return{hyperLink:{form:{editTitle:"编辑链接",addTitle:"插入链接",label:"文本",labelPlaceholder:"输入文本",type:"类型",link:"链接",linkPlaceholder:"输入链接地址",range:"单元格",worksheet:"工作表",definedName:"定义的名称",ok:"确认",cancel:"取消",inputError:"请输入",selectError:"请选择",linkError:"请输入合法的链接"},menu:{add:"添加链接"},message:{noSheet:"该子表已被删除",refError:"错误的引用",hiddenSheet:"无法打开被隐藏的子表",coped:"链接已被复制到剪贴板"},popup:{copy:"复制",edit:"编辑",cancel:"取消链接"}}}});
|
package/lib/umd/locale/zh-TW.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(global,factory){typeof exports=="object"&&typeof module<"u"?module.exports=factory():typeof define=="function"&&define.amd?define(factory):(global=typeof globalThis<"u"?globalThis:global||self,global.UniverSheetsHyperLinkUiZhTW=factory())})(this,function(){"use strict";return{hyperLink:{form:{editTitle:"編輯連結",addTitle:"插入連結",label:"文本",labelPlaceholder:"輸入文字",type:"類型",link:"連結",linkPlaceholder:"輸入連結位址",range:"單元格",worksheet:"工作表",definedName:"定義的名稱",ok:"確認",cancel:"取消",inputError:"請輸入",selectError:"請選擇",linkError:"請輸入合法的連結"},menu:{add:"新增連結"},message:{noSheet:"該子表已被刪除",refError:"錯誤的引用",hiddenSheet:"無法開啟被隱藏的子表",coped:"連結已複製到剪貼簿"},popup:{copy:"複製",edit:"編輯",cancel:"取消連結"}}}});
|