@univerjs/sheets-hyper-link-ui 0.2.4-alpha.0 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cjs/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var De=Object.defineProperty;var $e=(i,e,n)=>e in i?De(i,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[e]=n;var B=(i,e,n)=>$e(i,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@univerjs/core"),u=require("@univerjs/sheets"),m=require("@univerjs/sheets-hyper-link"),S=require("@univerjs/sheets-ui"),ye=require("@univerjs/engine-render"),ge=require("rxjs"),_=require("react"),ke=require("clsx"),k=require("@univerjs/design"),H=require("@univerjs/ui"),N=require("@univerjs/engine-formula"),Ae=require("@univerjs/docs-hyper-link"),Ve=require("@univerjs/docs");var Be=Object.defineProperty,We=Object.getOwnPropertyDescriptor,Fe=(i,e,n,t)=>{for(var r=t>1?void 0:t?We(e,n):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(t?s(e,n,r):s(r))||r);return t&&r&&Be(e,n,r),r},he=(i,e)=>(n,t)=>e(n,t,i);exports.SheetsHyperLinkRemoveSheetController=class extends a.Disposable{constructor(e,n,t){super(),this._sheetInterceptorService=e,this._univerInstanceService=n,this._hyperLinkModel=t,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{var n;if(e.id===u.RemoveSheetCommand.id){const t=e.params,r=t.unitId?this._univerInstanceService.getUnit(t.unitId):this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!r)return{redos:[],undos:[]};const o=r.getUnitId(),s=t.subUnitId||((n=r.getActiveSheet())==null?void 0:n.getSheetId());if(!s)return{redos:[],undos:[]};const c=this._hyperLinkModel.getSubUnit(o,s),l=c.map(v=>({id:m.RemoveHyperLinkMutation.id,params:{unitId:o,subUnitId:s,id:v.id}})),p=c.map(v=>({id:m.AddHyperLinkMutation.id,params:{unitId:o,subUnitId:s,link:v}}));return{redos:l,undos:p}}return{redos:[],undos:[]}}}))}};exports.SheetsHyperLinkRemoveSheetController=Fe([a.OnLifecycle(a.LifecycleStages.Ready,exports.SheetsHyperLinkRemoveSheetController),he(0,a.Inject(u.SheetInterceptorService)),he(1,a.IUniverInstanceService),he(2,a.Inject(m.HyperLinkModel))],exports.SheetsHyperLinkRemoveSheetController);var Ye=Object.defineProperty,Ke=Object.getOwnPropertyDescriptor,be=(i,e,n,t)=>{for(var r=t>1?void 0:t?Ke(e,n):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(t?s(e,n,r):s(r))||r);return t&&r&&Ye(e,n,r),r},z=(i,e)=>(n,t)=>e(n,t,i);exports.SheetsHyperLinkRenderController=class extends a.Disposable{constructor(e,n,t,r){super(),this._context=e,this._hyperLinkModel=n,this._sheetSkeletonManagerService=t,this._renderManagerService=r,this._initSkeletonChange()}_initSkeletonChange(){const e=()=>{var c;const n=this._context.unit,t=n.getUnitId(),r=(c=n.getActiveSheet())==null?void 0:c.getSheetId();if(!r){console.warn("No active sheet found");return}const o=this._sheetSkeletonManagerService.getOrCreateSkeleton({sheetId:r}),s=this._renderManagerService.getRenderById(t);o==null||o.makeDirty(!0),o==null||o.calculate(),s&&s.mainComponent.makeForceDirty()};this.disposeWithMe(this._hyperLinkModel.linkUpdate$.subscribe(()=>{e()}))}};exports.SheetsHyperLinkRenderController=be([z(1,a.Inject(m.HyperLinkModel)),z(2,a.Inject(S.SheetSkeletonManagerService)),z(3,ye.IRenderManagerService)],exports.SheetsHyperLinkRenderController);exports.SheetsHyperLinkRenderManagerController=class extends a.Disposable{constructor(e,n,t){super(),this._sheetInterceptorService=e,this._hyperLinkModel=n,this._themeService=t,this._initViewModelIntercept()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(u.INTERCEPTOR_POINT.CELL_CONTENT,{handler:(e,n,t)=>{const{row:r,col:o,unitId:s,subUnitId:c}=n,l=this._hyperLinkModel.getHyperLinkByLocation(s,c,r,o),p=this._themeService.getCurrentTheme();return t(l?{...e,interceptorStyle:{ul:{s:a.BooleanNumber.TRUE},cl:{rgb:p.blue500}}}:e)},priority:100}))}};exports.SheetsHyperLinkRenderManagerController=be([a.OnLifecycle(a.LifecycleStages.Ready,exports.SheetsHyperLinkRenderManagerController),z(0,a.Inject(u.SheetInterceptorService)),z(1,a.Inject(m.HyperLinkModel)),z(2,a.Inject(a.ThemeService))],exports.SheetsHyperLinkRenderManagerController);var He={exports:{}},ae={};/**
1
+ "use strict";var De=Object.defineProperty;var $e=(i,e,n)=>e in i?De(i,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[e]=n;var B=(i,e,n)=>$e(i,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@univerjs/core"),u=require("@univerjs/sheets"),m=require("@univerjs/sheets-hyper-link"),S=require("@univerjs/sheets-ui"),ye=require("@univerjs/engine-render"),ie=require("rxjs"),_=require("react"),ke=require("clsx"),k=require("@univerjs/design"),H=require("@univerjs/ui"),N=require("@univerjs/engine-formula"),Ae=require("@univerjs/docs-hyper-link"),Ve=require("@univerjs/docs");var Be=Object.defineProperty,We=Object.getOwnPropertyDescriptor,Fe=(i,e,n,t)=>{for(var r=t>1?void 0:t?We(e,n):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(t?s(e,n,r):s(r))||r);return t&&r&&Be(e,n,r),r},me=(i,e)=>(n,t)=>e(n,t,i);exports.SheetsHyperLinkRemoveSheetController=class extends a.Disposable{constructor(e,n,t){super(),this._sheetInterceptorService=e,this._univerInstanceService=n,this._hyperLinkModel=t,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{var n;if(e.id===u.RemoveSheetCommand.id){const t=e.params,r=t.unitId?this._univerInstanceService.getUnit(t.unitId):this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!r)return{redos:[],undos:[]};const o=r.getUnitId(),s=t.subUnitId||((n=r.getActiveSheet())==null?void 0:n.getSheetId());if(!s)return{redos:[],undos:[]};const c=this._hyperLinkModel.getSubUnit(o,s),l=c.map(v=>({id:m.RemoveHyperLinkMutation.id,params:{unitId:o,subUnitId:s,id:v.id}})),p=c.map(v=>({id:m.AddHyperLinkMutation.id,params:{unitId:o,subUnitId:s,link:v}}));return{redos:l,undos:p}}return{redos:[],undos:[]}}}))}};exports.SheetsHyperLinkRemoveSheetController=Fe([a.OnLifecycle(a.LifecycleStages.Ready,exports.SheetsHyperLinkRemoveSheetController),me(0,a.Inject(u.SheetInterceptorService)),me(1,a.IUniverInstanceService),me(2,a.Inject(m.HyperLinkModel))],exports.SheetsHyperLinkRemoveSheetController);var Ye=Object.defineProperty,Ke=Object.getOwnPropertyDescriptor,be=(i,e,n,t)=>{for(var r=t>1?void 0:t?Ke(e,n):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(t?s(e,n,r):s(r))||r);return t&&r&&Ye(e,n,r),r},z=(i,e)=>(n,t)=>e(n,t,i);exports.SheetsHyperLinkRenderController=class extends a.Disposable{constructor(e,n,t,r){super(),this._context=e,this._hyperLinkModel=n,this._sheetSkeletonManagerService=t,this._renderManagerService=r,this._initSkeletonChange()}_initSkeletonChange(){const e=()=>{var c;const n=this._context.unit,t=n.getUnitId(),r=(c=n.getActiveSheet())==null?void 0:c.getSheetId();if(!r){console.warn("No active sheet found");return}const o=this._sheetSkeletonManagerService.getOrCreateSkeleton({sheetId:r}),s=this._renderManagerService.getRenderById(t);o==null||o.makeDirty(!0),o==null||o.calculate(),s&&s.mainComponent.makeForceDirty()};this.disposeWithMe(this._hyperLinkModel.linkUpdate$.pipe(ie.debounceTime(16)).subscribe(()=>{e()}))}};exports.SheetsHyperLinkRenderController=be([z(1,a.Inject(m.HyperLinkModel)),z(2,a.Inject(S.SheetSkeletonManagerService)),z(3,ye.IRenderManagerService)],exports.SheetsHyperLinkRenderController);exports.SheetsHyperLinkRenderManagerController=class extends a.Disposable{constructor(e,n,t){super(),this._sheetInterceptorService=e,this._hyperLinkModel=n,this._themeService=t,this._initViewModelIntercept()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(u.INTERCEPTOR_POINT.CELL_CONTENT,{handler:(e,n,t)=>{const{row:r,col:o,unitId:s,subUnitId:c}=n,l=this._hyperLinkModel.getHyperLinkByLocation(s,c,r,o),p=this._themeService.getCurrentTheme();return t(l?{...e,interceptorStyle:{ul:{s:a.BooleanNumber.TRUE},cl:{rgb:p.blue500}}}:e)},priority:100}))}};exports.SheetsHyperLinkRenderManagerController=be([a.OnLifecycle(a.LifecycleStages.Ready,exports.SheetsHyperLinkRenderManagerController),z(0,a.Inject(u.SheetInterceptorService)),z(1,a.Inject(m.HyperLinkModel)),z(2,a.Inject(a.ThemeService))],exports.SheetsHyperLinkRenderManagerController);var He={exports:{}},ce={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,4 +6,4 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var ze=_,qe=Symbol.for("react.element"),Ze=Symbol.for("react.fragment"),Ge=Object.prototype.hasOwnProperty,Xe=ze.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Je={key:!0,ref:!0,__self:!0,__source:!0};function Ee(i,e,n){var t,r={},o=null,s=null;n!==void 0&&(o=""+n),e.key!==void 0&&(o=""+e.key),e.ref!==void 0&&(s=e.ref);for(t in e)Ge.call(e,t)&&!Je.hasOwnProperty(t)&&(r[t]=e[t]);if(i&&i.defaultProps)for(t in e=i.defaultProps,e)r[t]===void 0&&(r[t]=e[t]);return{$$typeof:qe,type:i,key:o,ref:s,props:r,_owner:Xe.current}}ae.Fragment=Ze;ae.jsx=Ee;ae.jsxs=Ee;He.exports=ae;var h=He.exports,U=function(){return U=Object.assign||function(i){for(var e,n=1,t=arguments.length;n<t;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(i[r]=e[r])}return i},U.apply(this,arguments)},Qe=function(i,e){var n={};for(var t in i)Object.prototype.hasOwnProperty.call(i,t)&&e.indexOf(t)<0&&(n[t]=i[t]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,t=Object.getOwnPropertySymbols(i);r<t.length;r++)e.indexOf(t[r])<0&&Object.prototype.propertyIsEnumerable.call(i,t[r])&&(n[t[r]]=i[t[r]]);return n},W=_.forwardRef(function(i,e){var n=i.icon,t=i.id,r=i.className,o=i.extend,s=Qe(i,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(t," ").concat(r||"").trim(),l=_.useRef("_".concat(nt()));return Oe(n,"".concat(t),{defIds:n.defIds,idSuffix:l.current},U({ref:e,className:c},s),o)});function Oe(i,e,n,t,r){return _.createElement(i.tag,U(U({key:e},et(i,n,r)),t),(tt(i,n).children||[]).map(function(o,s){return Oe(o,"".concat(e,"-").concat(i.tag,"-").concat(s),n,void 0,r)}))}function et(i,e,n){var t=U({},i.attrs);n!=null&&n.colorChannel1&&t.fill==="colorChannel1"&&(t.fill=n.colorChannel1);var r=e.defIds;return!r||r.length===0||(i.tag==="use"&&t["xlink:href"]&&(t["xlink:href"]=t["xlink:href"]+e.idSuffix),Object.entries(t).forEach(function(o){var s=o[0],c=o[1];typeof c=="string"&&(t[s]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),t}function tt(i,e){var n,t=e.defIds;return!t||t.length===0?i:i.tag==="defs"&&(!((n=i.children)===null||n===void 0)&&n.length)?U(U({},i),{children:i.children.map(function(r){return typeof r.attrs.id=="string"&&t&&t.indexOf(r.attrs.id)>-1?U(U({},r),{attrs:U(U({},r.attrs),{id:r.attrs.id+e.idSuffix})}):r})}):i}function nt(){return Math.random().toString(36).substring(2,8)}W.displayName="UniverIcon";var rt={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"}}]},ne=_.forwardRef(function(i,e){return _.createElement(W,Object.assign({},i,{id:"all-border-single",ref:e,icon:rt}))});ne.displayName="AllBorderSingle";var it={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.02547 12.4251C5.15328 13.7417 6.26305 14.7708 7.61318 14.7708H12.6132C14.0491 14.7708 15.2132 13.6067 15.2132 12.1708V6.1708C15.2132 4.78586 14.1303 3.65383 12.7651 3.57517C12.6373 2.25858 11.5275 1.22949 10.1774 1.22949H5.17739C3.74145 1.22949 2.57739 2.39355 2.57739 3.82949V9.82949C2.57739 11.2144 3.66024 12.3465 5.02547 12.4251ZM11.5535 3.5708H7.61318C6.17724 3.5708 5.01318 4.73486 5.01318 6.1708V11.22C4.31736 11.1387 3.77739 10.5471 3.77739 9.82949V3.82949C3.77739 3.05629 4.40419 2.42949 5.17739 2.42949H10.1774C10.8622 2.42949 11.4322 2.92119 11.5535 3.5708ZM14.0132 6.1708C14.0132 5.3976 13.3864 4.7708 12.6132 4.7708H7.61318C6.83998 4.7708 6.21318 5.3976 6.21318 6.1708V12.1708C6.21318 12.944 6.83998 13.5708 7.61318 13.5708H12.6132C13.3864 13.5708 14.0132 12.944 14.0132 12.1708V6.1708Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Me=_.forwardRef(function(i,e){return _.createElement(W,Object.assign({},i,{id:"copy-single",ref:e,icon:it}))});Me.displayName="CopySingle";var ot={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.9564 2.91332C4.91407 1.87102 3.22413 1.87101 2.18182 2.91333L2.18182 2.91333C1.13953 3.95567 1.13952 5.6456 2.18182 6.68791L8.27777 12.7838C9.72408 14.2302 12.069 14.2302 13.5154 12.7839L13.0911 12.3596L13.5154 12.7839C14.9617 11.3375 14.9617 8.99257 13.5154 7.54626L8.39476 2.42566C8.16044 2.19134 7.78054 2.19134 7.54623 2.42566C7.31191 2.65997 7.31191 3.03987 7.54623 3.27419L12.6668 8.39479L13.0911 7.97052L12.6668 8.39479C13.6445 9.37247 13.6445 10.9576 12.6668 11.9353L13.0399 12.3084L12.6668 11.9353C11.6891 12.913 10.104 12.913 9.1263 11.9353L3.03035 5.83938C2.45668 5.26571 2.45667 4.33556 3.03036 3.76184C3.60403 3.18818 4.53416 3.18817 5.10788 3.76185C5.10788 3.76186 5.10788 3.76186 5.10789 3.76186L11.2038 9.8578L11.601 9.46061L11.2038 9.8578C11.3735 10.0275 11.3735 10.3026 11.2038 10.4723L11.2038 10.4723C11.0341 10.642 10.759 10.642 10.5893 10.4723L5.46874 5.35171C5.23442 5.1174 4.85452 5.1174 4.62021 5.35171C4.38589 5.58602 4.38589 5.96592 4.62021 6.20024L9.74078 11.3208C10.3791 11.9591 11.414 11.9591 12.0523 11.3208C12.0523 11.3208 12.0523 11.3208 12.0523 11.3208M12.0523 11.3208C12.6907 10.6825 12.6906 9.64757 12.0523 9.00927L5.95641 2.91333L5.9564 2.91332",fillRule:"evenodd",clipRule:"evenodd"}}]},ie=_.forwardRef(function(i,e){return _.createElement(W,Object.assign({},i,{id:"link-single",ref:e,icon:ot}))});ie.displayName="LinkSingle";var st={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"}}]},we=_.forwardRef(function(i,e){return _.createElement(W,Object.assign({},i,{id:"unlink-single",ref:e,icon:st}))});we.displayName="UnlinkSingle";var at={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"}}]},Te=_.forwardRef(function(i,e){return _.createElement(W,Object.assign({},i,{id:"write-single",ref:e,icon:at}))});Te.displayName="WriteSingle";var ct={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"#35BD4B",d:"M3.36396 1.12549C2.61066 1.12549 2 1.73615 2 2.48945V13.5104C2 14.2637 2.61066 14.8744 3.36396 14.8744H12.457C13.2103 14.8744 13.821 14.2637 13.821 13.5104V5.0992L9.91954 1.12549H3.36396Z"}},{tag:"path",attrs:{fill:"#32A846",d:"M9.91797 1.12549L13.8209 5.09842H10.5846C10.2164 5.09842 9.91797 4.79994 9.91797 4.43175V1.12549Z"}},{tag:"path",attrs:{fill:"#fff",d:"M7.71926 10.2949L6.28687 12.403C6.17306 12.5705 5.94501 12.614 5.77751 12.5002C5.61002 12.3864 5.56649 12.1584 5.6803 11.9909L7.27596 9.64252L5.85088 7.54519C5.73707 7.37769 5.78059 7.14964 5.94809 7.03583C6.11558 6.92202 6.34363 6.96555 6.45744 7.13304L7.71926 8.9901L8.98108 7.13304C9.09489 6.96555 9.32294 6.92202 9.49044 7.03583C9.65793 7.14964 9.70146 7.37769 9.58765 7.54519L8.16256 9.64252L9.75822 11.9909C9.87203 12.1584 9.82851 12.3864 9.66101 12.5002C9.49351 12.614 9.26547 12.5705 9.15166 12.403L7.71926 10.2949Z",fillRule:"evenodd",clipRule:"evenodd"}}]},ve=_.forwardRef(function(i,e){return _.createElement(W,Object.assign({},i,{id:"xlsx",ref:e,icon:ct}))});ve.displayName="Xlsx";var lt=Object.defineProperty,dt=Object.getOwnPropertyDescriptor,pt=(i,e,n,t)=>{for(var r=t>1?void 0:t?dt(e,n):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(t?s(e,n,r):s(r))||r);return t&&r&&lt(e,n,r),r},G=(i,e)=>(n,t)=>e(n,t,i);function ut(i,e){const n=e.getMergeData(),t=e.getMaxColumns()-1,r=e.getMaxRows()-1;if(t<i.endColumn&&(i.endColumn=t),r<i.endRow&&(i.endRow=r),i.rangeType===a.RANGE_TYPE.COLUMN||a.RANGE_TYPE.ROW)return i;const o=[];return n.forEach(s=>{a.Rectangle.intersects(i,s)&&o.push(s)}),a.Rectangle.realUnion(i,...o)}exports.SheetsHyperLinkResolverService=class{constructor(e,n,t,r,o){this._univerInstanceService=e,this._commandService=n,this._definedNamesService=t,this._messageService=r,this._localeService=o}_getURLName(e){var l;const{gid:n,range:t,rangeid:r}=e,o=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!o)return null;const s=n?o.getSheetBySheetId(n):o.getActiveSheet(),c=(l=s==null?void 0:s.getName())!=null?l:"";if(t){const p=N.deserializeRangeWithSheet(t).range;return a.isValidRange(p)&&t!==m.ERROR_RANGE?{type:"range",name:N.serializeRangeWithSheet(c,p)}:{type:"range-error",name:this._localeService.t("hyperLink.message.refError")}}if(r){const p=this._definedNamesService.getValueById(o.getUnitId(),r);return p?{type:"defineName",name:p.formulaOrRefString}:{type:"range-error",name:this._localeService.t("hyperLink.message.refError")}}if(n){const p=o.getSheetBySheetId(n);return p?{type:"sheet",name:p.getName()}:{type:"sheet-error",name:this._localeService.t("hyperLink.message.refError")}}return null}navigateTo(e){const{gid:n,range:t,rangeid:r}=e,o=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!o)return;const s=o.getUnitId();if(r&&this.navigateToDefineName(s,r),!!n){if(t){const c=N.deserializeRangeWithSheet(t);a.isValidRange(c.range)&&t!==m.ERROR_RANGE&&this.navigateToRange(s,n,c.range);return}this.navigateToSheetById(s,n)}}parseHyperLink(e){var n,t,r;if(e!=null&&e.startsWith("#")){const o=new URLSearchParams(e.slice(1)),s={gid:(n=o.get("gid"))!=null?n:"",range:(t=o.get("range"))!=null?t:"",rangeid:(r=o.get("rangeid"))!=null?r:""},c=this._getURLName(s);return{type:(c==null?void 0:c.type)||"link",name:(c==null?void 0:c.name)||e,url:e,searchObj:s,handler:()=>{this.navigateTo(s)}}}else return{type:"outer",name:e,url:e,handler:()=>{this.navigateToOtherWebsite(e)}}}async navigateToRange(e,n,t){const r=await this.navigateToSheetById(e,n);if(r){const o=ut(t,r);await this._commandService.executeCommand(u.SetSelectionsOperation.id,{unitId:e,subUnitId:n,selections:[{range:o}]}),await this._commandService.executeCommand(S.ScrollToRangeOperation.id,{range:o})}}async navigateToSheet(e,n){const t=this._univerInstanceService.getUnit(e,a.UniverInstanceType.UNIVER_SHEET);if(!t)return!1;const r=t.getActiveSheet();if((r==null?void 0:r.getName())===n)return!0;const o=t.getSheetBySheetName(n);if(!o){this._messageService.show({content:this._localeService.t("hyperLink.message.noSheet"),type:k.MessageType.Error});return}const s=o.getSheetId();return t.getHiddenWorksheets().indexOf(s)>-1&&this._messageService.show({content:this._localeService.t("hyperLink.message.hiddenSheet"),type:k.MessageType.Error}),await this._commandService.executeCommand(u.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:s})}async navigateToSheetById(e,n){const t=this._univerInstanceService.getUnit(e,a.UniverInstanceType.UNIVER_SHEET);if(!t)return!1;const r=t.getActiveSheet();if(!r)return!1;if(r.getSheetId()===n)return r;const o=t.getSheetBySheetId(n);return o?t.getHiddenWorksheets().indexOf(n)>-1?(this._messageService.show({content:this._localeService.t("hyperLink.message.hiddenSheet"),type:k.MessageType.Error}),!1):await this._commandService.executeCommand(u.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:n})?o:!1:(this._messageService.show({content:this._localeService.t("hyperLink.message.noSheet"),type:k.MessageType.Error}),!1)}async navigateToDefineName(e,n){return this._definedNamesService.focusRange(e,n),!0}async navigateToOtherWebsite(e){window.open(e,"_blank","noopener noreferrer")}};exports.SheetsHyperLinkResolverService=pt([G(0,a.IUniverInstanceService),G(1,a.ICommandService),G(2,N.IDefinedNamesService),G(3,H.IMessageService),G(4,a.Inject(a.LocaleService))],exports.SheetsHyperLinkResolverService);function J(i){return a.Tools.isLegalUrl(i)}function ht(i){return/^[a-zA-Z]+:\/\//.test(i)}function mt(i){return/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(i)}function Se(i){if(J(i)){const e=ht(i)?i:mt(i)?`mailto://${i}`:`http://${i}`,n=new URL(e);return n.hostname===location.hostname&&n.port===location.port&&n.protocol===location.protocol&&n.pathname===location.pathname&&n.hash&&!n.search?n.hash:e}return i}function gt(i){if(i===null)return"";if(i!=null&&i.p){const e=i==null?void 0:i.p.body;if(e==null)return"";const n=e.dataStream;return n.substring(n.length-2,n.length)===a.DEFAULT_EMPTY_DOCUMENT_VALUE?n.substring(0,n.length-2):n}return i==null?void 0:i.v}const vt="univer-cell-link-edit-buttons",yt={cellLinkEditButtons:vt},oe=()=>{var Z;const[i,e]=_.useState(""),[n,t]=_.useState(""),[r,o]=_.useState("link"),[s,c]=_.useState(""),l=a.useDependency(a.LocaleService),p=a.useDependency(N.IDefinedNamesService),v=a.useDependency(a.IUniverInstanceService),f=a.useDependency(exports.SheetsHyperLinkPopupService),d=H.useObservable(f.currentEditing$),C=a.useDependency(m.HyperLinkModel),y=a.useDependency(exports.SheetsHyperLinkResolverService),L=a.useDependency(a.ICommandService),[I,M]=_.useState(!1),b=_.useRef(!1);_.useEffect(()=>{var g,R,O;if((d==null?void 0:d.row)!==void 0&&d.column!==void 0){const P=C.getHyperLinkByLocationSync(d.unitId,d.subUnitId,d.row,d.column);if(P){const ee=y.parseHyperLink(P.payload);if(e(P.id),t(P.display),ee.type==="outer"){o("link"),c(ee.url),ee.url===P.display&&(b.current=!0);return}else{const D=ee.searchObj;if(D.rangeid){o("rangeid"),c(D.rangeid);return}if(D.range){const Ne=D.gid&&(O=(R=(g=v.getUnit(d.unitId))==null?void 0:g.getSheetBySheetId(D.gid))==null?void 0:R.getName())!=null?O:"";if(o("range"),D.range===m.ERROR_RANGE)c("");else{const Ce=N.serializeRangeWithSheet(Ne,N.deserializeRangeWithSheet(D.range).range);c(Ce),Ce===P.display&&(b.current=!0)}return}if(D.gid){o("gid"),c(D.gid);return}}}const w=v.getUnit(d.unitId),j=w==null?void 0:w.getSheetBySheetId(d.subUnitId),xe=j==null?void 0:j.getCellRaw(d.row,d.column),ue=gt(xe);o("link"),c(""),t((ue!=null?ue:"").toString()),e("");return}o("link"),c(""),t(""),e("")},[d,C,y,v]);const T=_.useMemo(()=>s,[r]),$=[{label:l.t("hyperLink.form.link"),value:"link"},{label:l.t("hyperLink.form.range"),value:"range"},{label:l.t("hyperLink.form.worksheet"),value:"gid"},{label:l.t("hyperLink.form.definedName"),value:"rangeid"}],E=v.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!E)return;const F=E.getHiddenWorksheets(),A=E.getSheets().map(g=>({label:g.getName(),value:g.getSheetId()})).filter(g=>F.indexOf(g.value)===-1),V=Object.values((Z=p.getDefinedNameMap(E.getUnitId()))!=null?Z:{}).map(g=>({label:g.name,value:g.id})),q=(g,R)=>{if(g==="link")return Se(R);if(g==="range"){const O=N.deserializeRangeWithSheet(R),P=E.getSheetBySheetName(O.sheetName);if(P)return`#gid=${P.getSheetId()}&range=${N.serializeRange(O.range)}`}return`#${g}=${R}`},de=H.useEvent(g=>{var P;const R=g[0];if(!R||!a.isValidRange(R.range))return;R.sheetName||(R.sheetName=((P=E.getActiveSheet())==null?void 0:P.getName())||"");const O=N.serializeRangeToRefString(R);c(O),O&&(b.current||!n)&&(t(O),b.current=!0)}),pe=async()=>{if(d&&(i?await L.executeCommand(m.UpdateHyperLinkCommand.id,{unitId:d.unitId,subUnitId:d.subUnitId,id:i,payload:{display:n,payload:q(r,s)}}):await L.executeCommand(m.AddHyperLinkCommand.id,{unitId:d.unitId,subUnitId:d.subUnitId,link:{id:a.Tools.generateRandomId(),row:d.row,column:d.column,payload:q(r,s),display:n}})),d){await L.executeCommand(u.SetWorksheetActiveOperation.id,{unitId:d.unitId,subUnitId:d.subUnitId});const g=1;await L.executeCommand(S.ScrollToRangeOperation.id,{range:{startRow:Math.max(d.row-g,0),endRow:d.row+g,startColumn:Math.max(d.column-g,0),endColumn:d.column+g}})}L.executeCommand(Q.id)};return h.jsxs("div",{children:[h.jsx(k.FormLayout,{label:l.t("hyperLink.form.label"),error:I&&!n?l.t("hyperLink.form.inputError"):"",children:h.jsx(k.Input,{value:n,onChange:g=>{t(g),b.current=!1},placeholder:l.t("hyperLink.form.labelPlaceholder")})}),h.jsx(k.FormLayout,{label:l.t("hyperLink.form.type"),children:h.jsx(k.Select,{options:$,value:r,onChange:g=>{o(g),c("")}})}),r==="link"&&h.jsx(k.FormLayout,{error:I?s?J(s)?"":l.t("hyperLink.form.linkError"):l.t("hyperLink.form.inputError"):"",children:h.jsx(k.Input,{value:s,onChange:g=>{c(g),g&&(b.current||!n||n===s)&&(t(g),b.current=!0)},placeholder:l.t("hyperLink.form.linkPlaceholder")})}),r==="range"&&h.jsx(k.FormLayout,{error:I&&!s?l.t("hyperLink.form.inputError"):"",children:h.jsx(H.RangeSelector,{openForSheetUnitId:E.getUnitId(),id:a.createInternalEditorID("hyper-link-edit"),isSingleChoice:!0,value:T,onChange:de})}),r==="gid"&&h.jsx(k.FormLayout,{error:I&&!s?l.t("hyperLink.form.selectError"):"",children:h.jsx(k.Select,{options:A,value:s,onChange:g=>{var P,w;c(g);const R=(P=A.find(j=>j.value===g))==null?void 0:P.label,O=(w=A.find(j=>j.value===s))==null?void 0:w.label;R&&(b.current||!n||n===O)&&(t(R),b.current=!0)}})}),r==="rangeid"&&h.jsx(k.FormLayout,{error:I&&!s?l.t("hyperLink.form.selectError"):"",children:h.jsx(k.Select,{options:V,value:s,onChange:g=>{var P,w;c(g);const R=(P=V.find(j=>j.value===g))==null?void 0:P.label,O=(w=V.find(j=>j.value===s))==null?void 0:w.label;R&&(b.current||!n||n===O)&&(t(R),b.current=!0)}})}),h.jsxs("div",{className:yt.cellLinkEditButtons,children:[h.jsx(k.Button,{onClick:()=>{d&&L.executeCommand(u.SetWorksheetActiveOperation.id,{unitId:d.unitId,subUnitId:d.subUnitId}),L.executeCommand(Q.id)},children:l.t("hyperLink.form.cancel")}),h.jsx(k.Button,{type:"primary",style:{marginLeft:8},onClick:async()=>{if(!n||!s||r==="link"&&!J(s)){M(!0);return}pe()},children:l.t("hyperLink.form.ok")})]})]})};oe.componentKey="univer.sheet.cell-link-edit";const ce={type:a.CommandType.OPERATION,id:"sheet.operation.open-hyper-link-sidebar",handler(i,e){if(!e)return!1;const{unitId:n,subUnitId:t,row:r,column:o}=e,s=i.get(m.HyperLinkModel),c=i.get(H.ISidebarService),l=i.get(exports.SheetsHyperLinkPopupService),p=s.getHyperLinkByLocation(n,t,r,o);return l.startEditing(e),c.open({header:{title:p?"hyperLink.form.editTitle":"hyperLink.form.addTitle"},children:{label:oe.componentKey}}),!0}},Q={type:a.CommandType.OPERATION,id:"sheet.operation.close-hyper-link-sidebar",handler(i){const e=i.get(H.ISidebarService),n=i.get(exports.SheetsHyperLinkPopupService);return e.close(),n.endEditing(),!0}},le={type:a.CommandType.OPERATION,id:"sheet.operation.insert-hyper-link",handler(i){const e=i.get(a.IUniverInstanceService),n=u.getSheetCommandTarget(e);if(!n)return!1;const t=i.get(a.ICommandService),o=i.get(u.SheetsSelectionsService).getCurrentLastSelection();if(!o)return!1;const s=o.primary.startRow,c=o.primary.startColumn;return t.executeCommand(ce.id,{unitId:n.unitId,subUnitId:n.subUnitId,row:s,column:c})}},fe={type:a.CommandType.OPERATION,id:"sheet.operation.insert-hyper-link-toolbar",handler(i){const e=i.get(a.ICommandService);return i.get(exports.SheetsHyperLinkPopupService).currentEditing?e.executeCommand(Q.id):e.executeCommand(le.id)}},St="univer-cell-link",ft="univer-cell-link-type",_t="univer-cell-link-content",Lt="univer-cell-link-content-error",Ct="univer-cell-link-url",kt="univer-cell-link-operations",It="univer-cell-link-operation",Rt="univer-cell-link-operation-error",x={cellLink:St,cellLinkType:ft,cellLinkContent:_t,cellLinkContentError:Lt,cellLinkUrl:Ct,cellLinkOperations:kt,cellLinkOperation:It,cellLinkOperationError:Rt},Pt={outer:h.jsx(ie,{}),link:h.jsx(ie,{}),sheet:h.jsx(ve,{}),range:h.jsx(ne,{}),defineName:h.jsx(ne,{}),"range-error":h.jsx(ne,{}),"sheet-error":h.jsx(ve,{})},se=()=>{const i=a.useDependency(exports.SheetsHyperLinkPopupService),e=a.useDependency(m.HyperLinkModel),n=a.useDependency(a.ICommandService),t=a.useDependency(H.IMessageService),r=a.useDependency(a.LocaleService),[o,s]=_.useState(null),c=a.useDependency(exports.SheetsHyperLinkResolverService);if(_.useEffect(()=>{s(i.currentPopup);const y=i.currentPopup$.subscribe(L=>{s(L)});return()=>{y.unsubscribe()}},[i.currentPopup,i.currentPopup$]),!o)return null;const{unitId:l,subUnitId:p,id:v}=o,f=e.getHyperLink(l,p,v);if(!f)return null;const d=c.parseHyperLink(f.payload),C=d.type.indexOf("error")>-1;return h.jsxs("div",{className:x.cellLink,onClick:()=>i.hideCurrentPopup(),children:[h.jsxs("div",{className:ke(x.cellLinkContent,{[x.cellLinkContentError]:C}),onClick:d.handler,children:[h.jsx("div",{className:x.cellLinkType,children:Pt[d.type]}),h.jsx(k.Tooltip,{showIfEllipsis:!0,title:d.name,children:h.jsx("span",{className:x.cellLinkUrl,children:d.name})})]}),h.jsxs("div",{className:x.cellLinkOperations,children:[o.copyPermission&&h.jsx("div",{className:ke(x.cellLinkOperation,{[x.cellLinkOperationError]:C}),onClick:()=>{if(!C){if(d.type!=="outer"){const y=new URL(window.location.href);y.hash=d.url.slice(1),navigator.clipboard.writeText(y.href)}else navigator.clipboard.writeText(d.url);t.show({content:r.t("hyperLink.message.coped"),type:k.MessageType.Info})}},children:h.jsx(k.Tooltip,{placement:"bottom",title:r.t("hyperLink.popup.copy"),children:h.jsx(Me,{})})}),o.editPermission&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:x.cellLinkOperation,onClick:()=>{n.executeCommand(ce.id,{unitId:l,subUnitId:p,row:f.row,column:f.column})},children:h.jsx(k.Tooltip,{placement:"bottom",title:r.t("hyperLink.popup.edit"),children:h.jsx(Te,{})})}),h.jsx("div",{className:x.cellLinkOperation,onClick:()=>{n.executeCommand(m.CancelHyperLinkCommand.id,{unitId:l,subUnitId:p,id:f.id})},children:h.jsx(k.Tooltip,{placement:"bottom",title:r.t("hyperLink.popup.cancel"),children:h.jsx(we,{})})})]})]})]})};se.componentKey="univer.sheet.cell-link-popup";var bt=Object.defineProperty,Ht=Object.getOwnPropertyDescriptor,Et=(i,e,n,t)=>{for(var r=t>1?void 0:t?Ht(e,n):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(t?s(e,n,r):s(r))||r);return t&&r&&bt(e,n,r),r},Ie=(i,e)=>(n,t)=>e(n,t,i);const Ot=(i,e)=>i.unitId===e.unitId&&i.subUnitId===e.subUnitId&&i.row===e.row&&i.col===e.col;exports.SheetsHyperLinkPopupService=class extends a.Disposable{constructor(n,t){super();B(this,"_currentPopup",null);B(this,"_currentPopup$",new ge.Subject);B(this,"currentPopup$",this._currentPopup$.asObservable());B(this,"_currentEditing$",new ge.BehaviorSubject(null));B(this,"currentEditing$",this._currentEditing$.asObservable());this._hyperLinkModel=n,this._sheetCanvasPopManagerService=t,this.disposeWithMe(()=>{this.hideCurrentPopup(),this.endEditing(),this._currentEditing$.complete(),this._currentPopup$.complete()})}get currentPopup(){return this._currentPopup}get currentEditing(){return this._currentEditing$.getValue()}showPopup(n){if(this._currentPopup&&Ot(n,this._currentPopup))return;this.hideCurrentPopup();const{unitId:t,subUnitId:r,row:o,col:s}=n,c=this._hyperLinkModel.getHyperLinkByLocation(t,r,o,s);if(!c)return;const l=this._sheetCanvasPopManagerService.attachPopupToCell(o,s,{componentKey:se.componentKey,direction:"bottom",closeOnSelfTarget:!0,onClickOutside:()=>{this.hideCurrentPopup()}});l&&(this._currentPopup={unitId:t,subUnitId:r,id:c.id,disposable:l,row:o,col:s,editPermission:!!n.editPermission,copyPermission:!!n.copyPermission},this._currentPopup$.next(this._currentPopup))}hideCurrentPopup(){var n;this._currentPopup&&((n=this._currentPopup.disposable)==null||n.dispose(),this._currentPopup=null,this._currentPopup$.next(null))}startEditing(n){this._currentEditing$.next(n)}endEditing(){this._currentEditing$.next(null)}};exports.SheetsHyperLinkPopupService=Et([Ie(0,a.Inject(m.HyperLinkModel)),Ie(1,a.Inject(S.SheetCanvasPopManagerService))],exports.SheetsHyperLinkPopupService);var Mt=Object.defineProperty,wt=Object.getOwnPropertyDescriptor,Tt=(i,e,n,t)=>{for(var r=t>1?void 0:t?wt(e,n):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(t?s(e,n,r):s(r))||r);return t&&r&&Mt(e,n,r),r},Y=(i,e)=>(n,t)=>e(n,t,i);exports.SheetHyperLinkSetRangeController=class extends a.Disposable{constructor(e,n,t,r,o,s){super(),this._sheetInterceptorService=e,this._injector=n,this._hyperLinkModel=t,this._selectionManagerService=r,this._univerInstanceService=o,this._editorBridgeService=s,this._initCommandInterceptor()}_initCommandInterceptor(){this._initAddHyperLinkCommandInterceptor(),this._initSetRangeValuesCommandInterceptor(),this._initUpdateHyperLinkCommandInterceptor(),this._initClearSelectionCommandInterceptor(),this._initRichTextEditorInterceptor()}_getCurrentCell(e,n,t,r){var o,s;return(s=(o=this._univerInstanceService.getUnit(e,a.UniverInstanceType.UNIVER_SHEET))==null?void 0:o.getSheetBySheetId(n))==null?void 0:s.getCell(t,r)}_initAddHyperLinkCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{var n;if(e.id===m.AddHyperLinkCommand.id){const t=e.params,{unitId:r,subUnitId:o,link:s}=t,c=this._getCurrentCell(r,o,s.row,s.column),l={unitId:r,subUnitId:o,cellValue:{[s.row]:{[s.column]:{v:s.display,p:null,t:(n=c==null?void 0:c.t)!=null?n:void 0}}}};return{redos:[{id:u.SetRangeValuesMutation.id,params:l}],undos:[{id:u.SetRangeValuesMutation.id,params:u.SetRangeValuesUndoMutationFactory(this._injector,l)}]}}return{redos:[],undos:[]}}}))}_initUpdateHyperLinkCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{if(e.id===m.UpdateHyperLinkCommand.id){const n=e.params,{unitId:t,subUnitId:r,id:o,payload:s}=n,c=this._hyperLinkModel.getHyperLink(t,r,o);if(c&&c.display!==s.display){const l={unitId:t,subUnitId:r,cellValue:{[c.row]:{[c.column]:{v:s.display,t:a.CellValueType.STRING,p:null}}}};return{redos:[{id:u.SetRangeValuesMutation.id,params:l}],undos:[{id:u.SetRangeValuesMutation.id,params:u.SetRangeValuesUndoMutationFactory(this._injector,l)}]}}}return{redos:[],undos:[]}}}))}_initSetRangeValuesCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{if(e.id===u.SetRangeValuesCommand.id){const n=e.params,{unitId:t,subUnitId:r}=n,o=[],s=[];return n.cellValue&&new a.ObjectMatrix(n.cellValue).forValue((c,l,p)=>{var C,y,L,I,M,b,T;const v=(L=p==null?void 0:p.v)!=null?L:(y=(C=p==null?void 0:p.p)==null?void 0:C.body)==null?void 0:y.dataStream.slice(0,-2),f=(v!=null?v:"").toString(),d=this._hyperLinkModel.getHyperLinkByLocation(t,r,c,l);if(!d){if(J(f)||(I=p==null?void 0:p.custom)!=null&&I.__link_url){const $=(b=(M=p==null?void 0:p.custom)==null?void 0:M.__link_url)!=null?b:f,E=a.Tools.generateRandomId();s.push({id:m.RemoveHyperLinkMutation.id,params:{unitId:t,subUnitId:r,id:E}}),o.push({id:m.AddHyperLinkMutation.id,params:{unitId:t,subUnitId:r,link:{id:E,row:c,column:l,display:f,payload:Se($)}}})}return}(v===""||((T=p==null?void 0:p.custom)==null?void 0:T.__link_url)==="")&&(o.push({id:m.RemoveHyperLinkMutation.id,params:{unitId:t,subUnitId:r,id:d.id}}),s.push({id:m.AddHyperLinkMutation.id,params:{unitId:t,subUnitId:r,link:d}}))}),{undos:s,redos:o}}return{redos:[],undos:[]}}}))}_initClearSelectionCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{if(e.id===u.ClearSelectionContentCommand.id||e.id===u.ClearSelectionAllCommand.id||e.id===u.ClearSelectionFormatCommand.id){const n=[],t=[],r=this._selectionManagerService.getCurrentLastSelection(),o=u.getSheetCommandTarget(this._univerInstanceService);if(r&&o){const{unitId:s,subUnitId:c}=o;a.Range.foreach(r.range,(l,p)=>{const v=this._hyperLinkModel.getHyperLinkByLocation(s,c,l,p);v&&(n.push({id:m.RemoveHyperLinkMutation.id,params:{unitId:s,subUnitId:c,id:v.id}}),t.push({id:m.AddHyperLinkMutation.id,params:{unitId:s,subUnitId:c,link:v}}))})}return{redos:n,undos:t}}return{redos:[],undos:[]}}}))}_initRichTextEditorInterceptor(){this.disposeWithMe(this._editorBridgeService.interceptor.intercept(this._editorBridgeService.interceptor.getInterceptPoints().AFTER_CELL_EDIT,{handler:(e,n,t)=>{var r,o,s,c,l,p;if(e!=null&&e.p){const v=(o=(r=e.p.body)==null?void 0:r.customRanges)==null?void 0:o.find(d=>d.rangeType===a.CustomRangeType.HYPERLINK),f=(s=e.p.resources)==null?void 0:s.find(d=>d.name===Ae.DOC_HYPER_LINK_PLUGIN);if(v&&f){const d=v.rangeId,C=(p=(l=(c=JSON.parse(f.data))==null?void 0:c.links)==null?void 0:l.find(y=>y.id===d))==null?void 0:p.payload;return t({...e,p:null,v:Ve.getPlainTextFormDocument(e.p),t:a.CellValueType.STRING,custom:{__link_url:C}})}}return t(e)}}))}};exports.SheetHyperLinkSetRangeController=Tt([a.OnLifecycle(a.LifecycleStages.Starting,exports.SheetHyperLinkSetRangeController),Y(0,a.Inject(u.SheetInterceptorService)),Y(1,a.Inject(a.Injector)),Y(2,a.Inject(m.HyperLinkModel)),Y(3,a.Inject(u.SheetsSelectionsService)),Y(4,a.IUniverInstanceService),Y(5,S.IEditorBridgeService)],exports.SheetHyperLinkSetRangeController);var Ut=Object.defineProperty,jt=Object.getOwnPropertyDescriptor,xt=(i,e,n,t)=>{for(var r=t>1?void 0:t?jt(e,n):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(t?s(e,n,r):s(r))||r);return t&&r&&Ut(e,n,r),r},X=(i,e)=>(n,t)=>e(n,t,i);exports.SheetsHyperLinkPopupController=class extends a.Disposable{constructor(e,n,t,r,o){super(),this._hoverManagerService=e,this._sheetsHyperLinkPopupService=n,this._renderManagerService=t,this._permissionService=r,this._sheetPermissionInterceptorBaseController=o,this._initHoverListener()}_initHoverListener(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(ge.debounceTime(100)).subscribe(e=>{var d,C;if(!e){this._sheetsHyperLinkPopupService.hideCurrentPopup();return}const n=(C=(d=this._renderManagerService.getRenderById(e.location.unitId))==null?void 0:d.with(S.SheetSkeletonManagerService).getWorksheetSkeleton(e.location.subUnitId))==null?void 0:C.skeleton,t=e.location.col,r=e.location.row;let o=r,s=t;if(n&&n.overflowCache.forValue((y,L,I)=>{a.Rectangle.contains(I,{startColumn:t,endColumn:t,startRow:r,endRow:r})&&(o=y,s=L)}),!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[u.WorkbookViewPermission],worksheetTypes:[u.WorksheetViewPermission],rangeTypes:[u.RangeProtectionPermissionViewPoint]},[{startRow:r,startColumn:t,endRow:r,endColumn:t}])){this._sheetsHyperLinkPopupService.hideCurrentPopup();return}const l=this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetEditPermission,u.WorksheetInsertHyperlinkPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]},[{startRow:r,startColumn:t,endRow:r,endColumn:t}]),p=e.location.unitId,v=e.location.subUnitId,f=this._permissionService.composePermission([new u.WorkbookCopyPermission(p).id,new u.WorksheetCopyPermission(p,v).id]).every(y=>y.value);this._sheetsHyperLinkPopupService.showPopup({...e.location,row:o,col:s,editPermission:l,copyPermission:f})}))}};exports.SheetsHyperLinkPopupController=xt([a.OnLifecycle(a.LifecycleStages.Rendered,exports.SheetsHyperLinkPopupController),X(0,a.Inject(S.HoverManagerService)),X(1,a.Inject(exports.SheetsHyperLinkPopupService)),X(2,a.Inject(ye.IRenderManagerService)),X(3,a.Inject(a.IPermissionService)),X(4,a.Inject(S.SheetPermissionInterceptorBaseController))],exports.SheetsHyperLinkPopupController);const Nt=i=>({id:le.id,type:H.MenuItemType.BUTTON,positions:[H.MenuPosition.CONTEXT_MENU],title:"hyperLink.menu.add",hidden$:H.getMenuHiddenObservable(i,a.UniverInstanceType.UNIVER_SHEET),icon:"LinkSingle",disabled$:S.getCurrentRangeDisable$(i,{workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetEditPermission,u.WorksheetSetCellValuePermission,u.WorksheetInsertHyperlinkPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]})}),Dt=i=>({tooltip:"hyperLink.form.addTitle",positions:H.MenuPosition.TOOLBAR_START,group:H.MenuGroup.TOOLBAR_OTHERS,id:fe.id,type:H.MenuItemType.BUTTON,icon:"LinkSingle",hidden$:H.getMenuHiddenObservable(i,a.UniverInstanceType.UNIVER_SHEET),disabled$:S.getCurrentRangeDisable$(i,{workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetEditPermission,u.WorksheetSetCellValuePermission,u.WorksheetInsertHyperlinkPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]})}),_e={id:fe.id,binding:H.KeyCode.K|H.MetaKeys.CTRL_COMMAND,preconditions:S.whenSheetEditorFocused};var $t=Object.defineProperty,At=Object.getOwnPropertyDescriptor,Vt=(i,e,n,t)=>{for(var r=t>1?void 0:t?At(e,n):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(t?s(e,n,r):s(r))||r);return t&&r&&$t(e,n,r),r},K=(i,e)=>(n,t)=>e(n,t,i);exports.SheetsHyperLinkUIController=class extends a.Disposable{constructor(e,n,t,r,o,s,c){super(),this._config=e,this._componentManager=n,this._commandService=t,this._localeService=r,this._menuService=o,this._injector=s,this._shortcutService=c,this._initComponents(),this._initCommands(),this._initMenus(),this._initShortCut()}_initComponents(){[[se,se.componentKey],[oe,oe.componentKey],[ie,"LinkSingle"]].forEach(([e,n])=>{this._componentManager.register(n,e)})}_initCommands(){[ce,Q,le,fe].forEach(e=>{this._commandService.registerCommand(e)})}_initMenus(){var e,n,t,r;this._menuService.addMenuItem(Nt(this._injector),(n=(e=this._config)==null?void 0:e.menu)!=null?n:{}),this._menuService.addMenuItem(Dt(this._injector),(r=(t=this._config)==null?void 0:t.menu)!=null?r:{})}_initShortCut(){this._shortcutService.registerShortcut(_e)}};exports.SheetsHyperLinkUIController=Vt([a.OnLifecycle(a.LifecycleStages.Ready,exports.SheetsHyperLinkUIController),K(1,a.Inject(H.ComponentManager)),K(2,a.ICommandService),K(3,a.Inject(a.LocaleService)),K(4,H.IMenuService),K(5,a.Inject(a.Injector)),K(6,a.Inject(H.IShortcutService))],exports.SheetsHyperLinkUIController);const Le="SHEET_HYPER_LINK_UI_PLUGIN";var Bt=Object.defineProperty,Wt=Object.getOwnPropertyDescriptor,Ft=(i,e,n,t)=>{for(var r=t>1?void 0:t?Wt(e,n):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(t?s(e,n,r):s(r))||r);return t&&r&&Bt(e,n,r),r},Re=(i,e)=>(n,t)=>e(n,t,i);exports.SheetsHyperLinkAutoFillController=class extends a.Disposable{constructor(e,n){super(),this._autoFillService=e,this._hyperLinkModel=n,this._initAutoFill()}_initAutoFill(){const e=()=>({redos:[],undos:[]}),n=(r,o)=>{const{source:s,target:c,unitId:l,subUnitId:p}=r,v=S.virtualizeDiscreteRanges([s,c]),[f,d]=v.ranges,{mapFunc:C}=v,y={row:f.startRow,col:f.startColumn},L=S.getAutoFillRepeatRange(f,d),I=[],M=[];return L.forEach(b=>{const T=b.repeatStartCell,$=b.relativeRange,E={startRow:y.row,startColumn:y.col,endColumn:y.col,endRow:y.row},F={startRow:T.row,startColumn:T.col,endColumn:T.col,endRow:T.row};a.Range.foreach($,(A,V)=>{const q=a.Rectangle.getPositionRange({startRow:A,startColumn:V,endColumn:V,endRow:A},E),{row:de,col:pe}=C(q.startRow,q.startColumn),Z=this._hyperLinkModel.getHyperLinkByLocation(l,p,de,pe);if(Z){const g=a.Rectangle.getPositionRange({startRow:A,startColumn:V,endColumn:V,endRow:A},F),{row:R,col:O}=C(g.startRow,g.startColumn),P=a.Tools.generateRandomId(),w=this._hyperLinkModel.getHyperLinkByLocation(l,p,R,O);w&&I.push({id:m.RemoveHyperLinkMutation.id,params:{unitId:l,subUnitId:p,id:w.id}}),(S.APPLY_TYPE.COPY===o||S.APPLY_TYPE.SERIES===o)&&(I.push({id:m.AddHyperLinkMutation.id,params:{unitId:l,subUnitId:p,link:{...Z,id:P,row:R,column:O}}}),M.push({id:m.RemoveHyperLinkMutation.id,params:{unitId:l,subUnitId:p,id:P}})),w&&M.push({id:m.AddHyperLinkMutation.id,params:{unitId:l,subUnitId:p,link:w}})}})}),{undos:M,redos:I}},t={id:Le,onFillData:(r,o,s)=>s===S.APPLY_TYPE.COPY||s===S.APPLY_TYPE.ONLY_FORMAT||s===S.APPLY_TYPE.SERIES?n(r,s):e()};this.disposeWithMe(this._autoFillService.addHook(t))}};exports.SheetsHyperLinkAutoFillController=Ft([a.OnLifecycle(a.LifecycleStages.Ready,exports.SheetsHyperLinkAutoFillController),Re(0,S.IAutoFillService),Re(1,a.Inject(m.HyperLinkModel))],exports.SheetsHyperLinkAutoFillController);var Yt=Object.defineProperty,Kt=Object.getOwnPropertyDescriptor,zt=(i,e,n,t)=>{for(var r=t>1?void 0:t?Kt(e,n):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(t?s(e,n,r):s(r))||r);return t&&r&&Yt(e,n,r),r},te=(i,e)=>(n,t)=>e(n,t,i);exports.SheetsHyperLinkCopyPasteController=class extends a.Disposable{constructor(n,t,r,o){super();B(this,"_copyInfo");this._sheetClipboardService=n,this._hyperLinkModel=t,this._injector=r,this._resolverService=o,this._initCopyPaste()}_initCopyPaste(){this._sheetClipboardService.addClipboardHook({id:Le,onBeforeCopy:(n,t,r)=>this._collect(n,t,r),onPasteCells:(n,t,r,o)=>{const{copyType:s=S.COPY_TYPE.COPY,pasteType:c}=o,{range:l}=n||{},{range:p,unitId:v,subUnitId:f}=t;return this._generateMutations(p,{copyType:s,pasteType:c,copyRange:l,unitId:v,subUnitId:f})},onPastePlainText:(n,t)=>{if(J(t)){const r=Se(t),{range:o,unitId:s,subUnitId:c}=n,{ranges:[l],mapFunc:p}=S.virtualizeDiscreteRanges([o]),v=[],f=[];return a.Range.foreach(l,(d,C)=>{const{row:y,col:L}=p(d,C),I=this._hyperLinkModel.getHyperLinkByLocation(s,c,y,L);I&&v.push({id:m.RemoveHyperLinkMutation.id,params:{unitId:s,subUnitId:c,id:I.id}});const M=a.Tools.generateRandomId();v.push({id:m.AddHyperLinkMutation.id,params:{unitId:s,subUnitId:c,link:{id:M,row:y,column:L,payload:r}}}),f.push({id:m.RemoveHyperLinkMutation.id,params:{unitId:s,subUnitId:c,id:M}}),I&&f.push({id:m.AddHyperLinkMutation.id,params:{unitId:s,subUnitId:c,link:I}})}),{redos:v,undos:f}}return{undos:[],redos:[]}}})}_collect(n,t,r){const o=new a.ObjectMatrix;this._copyInfo={unitId:n,subUnitId:t,matrix:o};const s={get:this._injector.get.bind(this._injector)},c=S.rangeToDiscreteRange(r,s,n,t);if(!c)return;const{rows:l,cols:p}=c;l.forEach((v,f)=>{p.forEach((d,C)=>{var L;const y=this._hyperLinkModel.getHyperLinkByLocation(n,t,v,d);o.setValue(f,C,(L=y==null?void 0:y.id)!=null?L:"")})})}_generateMutations(n,t){if(!this._copyInfo)return{redos:[],undos:[]};if(!this._copyInfo||!this._copyInfo.matrix.getSizeOf()||!t.copyRange)return{redos:[],undos:[]};if([S.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_COL_WIDTH,S.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_VALUE,S.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT,S.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMULA].includes(t.pasteType))return{redos:[],undos:[]};const{unitId:r,subUnitId:o}=this._copyInfo,s=[],c=[],{ranges:[l,p],mapFunc:v}=S.virtualizeDiscreteRanges([t.copyRange,n]);return S.getRepeatRange(l,p,!0).forEach(({startRange:d})=>{var C;(C=this._copyInfo)==null||C.matrix.forValue((y,L,I)=>{const M=a.Rectangle.getPositionRange({startRow:y,endRow:y,startColumn:L,endColumn:L},d),b=this._hyperLinkModel.getHyperLink(r,o,I),{row:T,col:$}=v(M.startRow,M.startColumn),E=this._hyperLinkModel.getHyperLinkByLocation(t.unitId,t.subUnitId,T,$),F=a.Tools.generateRandomId();E&&s.push({id:m.RemoveHyperLinkMutation.id,params:{unitId:t.unitId,subUnitId:t.subUnitId,id:E.id}}),b&&(s.push({id:m.AddHyperLinkMutation.id,params:{unitId:t.unitId,subUnitId:t.subUnitId,link:{...b,id:F,row:T,column:$}}}),c.push({id:m.RemoveHyperLinkMutation.id,params:{unitId:t.unitId,subUnitId:t.subUnitId,id:F}})),E&&c.push({id:m.AddHyperLinkMutation.id,params:{unitId:t.unitId,subUnitId:t.subUnitId,link:E}})})}),{redos:s,undos:c}}};exports.SheetsHyperLinkCopyPasteController=zt([a.OnLifecycle(a.LifecycleStages.Ready,exports.SheetsHyperLinkCopyPasteController),te(0,S.ISheetClipboardService),te(1,a.Inject(m.HyperLinkModel)),te(2,a.Inject(a.Injector)),te(3,a.Inject(exports.SheetsHyperLinkResolverService))],exports.SheetsHyperLinkCopyPasteController);var qt=Object.defineProperty,Zt=Object.getOwnPropertyDescriptor,Gt=(i,e,n,t)=>{for(var r=t>1?void 0:t?Zt(e,n):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(t?s(e,n,r):s(r))||r);return t&&r&&qt(e,n,r),r},Xt=(i,e)=>(n,t)=>e(n,t,i);exports.SheetHyperLinkUrlController=class extends a.Disposable{constructor(e){super(),this._resolverService=e,this._handleInitUrl()}_handleInitUrl(){const e=location.hash;e&&this._resolverService.parseHyperLink(e).handler()}};exports.SheetHyperLinkUrlController=Gt([a.OnLifecycle(a.LifecycleStages.Rendered,exports.SheetHyperLinkUrlController),Xt(0,a.Inject(exports.SheetsHyperLinkResolverService))],exports.SheetHyperLinkUrlController);var Jt=Object.defineProperty,Qt=Object.getOwnPropertyDescriptor,en=(i,e,n,t)=>{for(var r=t>1?void 0:t?Qt(e,n):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(t?s(e,n,r):s(r))||r);return t&&r&&Jt(e,n,r),r},me=(i,e)=>(n,t)=>e(n,t,i);let re=class extends a.Disposable{constructor(i,e,n){super(),this._localeService=i,this._commandService=e,this._sheetPermissionInterceptorBaseController=n,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(i=>{i.id===_e.id&&(this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[u.WorkbookEditablePermission],rangeTypes:[u.RangeProtectionPermissionEditPoint],worksheetTypes:[u.WorksheetEditPermission,u.WorksheetSetCellValuePermission,u.WorksheetInsertHyperlinkPermission]})||this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.hyperLinkErr")))}))}};re=en([a.OnLifecycle(a.LifecycleStages.Rendered,re),me(0,a.Inject(a.LocaleService)),me(1,a.ICommandService),me(2,a.Inject(S.SheetPermissionInterceptorBaseController))],re);var Ue=Object.defineProperty,tn=Object.getOwnPropertyDescriptor,nn=(i,e,n)=>e in i?Ue(i,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[e]=n,rn=(i,e,n,t)=>{for(var r=t>1?void 0:t?tn(e,n):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(t?s(e,n,r):s(r))||r);return t&&r&&Ue(e,n,r),r},Pe=(i,e)=>(n,t)=>e(n,t,i),je=(i,e,n)=>nn(i,typeof e!="symbol"?e+"":e,n);exports.UniverSheetsHyperLinkUIPlugin=class extends a.Plugin{constructor(e,n,t){super(),this._config=e,this._injector=n,this._renderManagerService=t}onStarting(e){[[exports.SheetsHyperLinkResolverService],[exports.SheetsHyperLinkPopupService],[exports.SheetsHyperLinkRemoveSheetController],[exports.SheetsHyperLinkRenderManagerController],[exports.SheetHyperLinkSetRangeController],[exports.SheetsHyperLinkPopupController],[exports.SheetsHyperLinkUIController,{useFactory:()=>this._injector.createInstance(exports.SheetsHyperLinkUIController,this._config)}],[exports.SheetsHyperLinkAutoFillController],[exports.SheetsHyperLinkCopyPasteController],[re],[exports.SheetHyperLinkUrlController]].forEach(t=>e.add(t))}onReady(){[[exports.SheetsHyperLinkRenderController]].forEach(n=>this._renderManagerService.registerRenderModule(a.UniverInstanceType.UNIVER_SHEET,n))}};je(exports.UniverSheetsHyperLinkUIPlugin,"pluginName",Le);je(exports.UniverSheetsHyperLinkUIPlugin,"type",a.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsHyperLinkUIPlugin=rn([a.DependentOn(m.UniverSheetsHyperLinkPlugin),Pe(1,a.Inject(a.Injector)),Pe(2,ye.IRenderManagerService)],exports.UniverSheetsHyperLinkUIPlugin);exports.CloseHyperLinkSidebarOperation=Q;exports.InsertHyperLinkOperation=le;exports.InsertLinkShortcut=_e;exports.OpenHyperLinkSidebarOperation=ce;
9
+ */var ze=_,qe=Symbol.for("react.element"),Ze=Symbol.for("react.fragment"),Ge=Object.prototype.hasOwnProperty,Xe=ze.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Je={key:!0,ref:!0,__self:!0,__source:!0};function Ee(i,e,n){var t,r={},o=null,s=null;n!==void 0&&(o=""+n),e.key!==void 0&&(o=""+e.key),e.ref!==void 0&&(s=e.ref);for(t in e)Ge.call(e,t)&&!Je.hasOwnProperty(t)&&(r[t]=e[t]);if(i&&i.defaultProps)for(t in e=i.defaultProps,e)r[t]===void 0&&(r[t]=e[t]);return{$$typeof:qe,type:i,key:o,ref:s,props:r,_owner:Xe.current}}ce.Fragment=Ze;ce.jsx=Ee;ce.jsxs=Ee;He.exports=ce;var h=He.exports,U=function(){return U=Object.assign||function(i){for(var e,n=1,t=arguments.length;n<t;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(i[r]=e[r])}return i},U.apply(this,arguments)},Qe=function(i,e){var n={};for(var t in i)Object.prototype.hasOwnProperty.call(i,t)&&e.indexOf(t)<0&&(n[t]=i[t]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,t=Object.getOwnPropertySymbols(i);r<t.length;r++)e.indexOf(t[r])<0&&Object.prototype.propertyIsEnumerable.call(i,t[r])&&(n[t[r]]=i[t[r]]);return n},W=_.forwardRef(function(i,e){var n=i.icon,t=i.id,r=i.className,o=i.extend,s=Qe(i,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(t," ").concat(r||"").trim(),l=_.useRef("_".concat(nt()));return Oe(n,"".concat(t),{defIds:n.defIds,idSuffix:l.current},U({ref:e,className:c},s),o)});function Oe(i,e,n,t,r){return _.createElement(i.tag,U(U({key:e},et(i,n,r)),t),(tt(i,n).children||[]).map(function(o,s){return Oe(o,"".concat(e,"-").concat(i.tag,"-").concat(s),n,void 0,r)}))}function et(i,e,n){var t=U({},i.attrs);n!=null&&n.colorChannel1&&t.fill==="colorChannel1"&&(t.fill=n.colorChannel1);var r=e.defIds;return!r||r.length===0||(i.tag==="use"&&t["xlink:href"]&&(t["xlink:href"]=t["xlink:href"]+e.idSuffix),Object.entries(t).forEach(function(o){var s=o[0],c=o[1];typeof c=="string"&&(t[s]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),t}function tt(i,e){var n,t=e.defIds;return!t||t.length===0?i:i.tag==="defs"&&(!((n=i.children)===null||n===void 0)&&n.length)?U(U({},i),{children:i.children.map(function(r){return typeof r.attrs.id=="string"&&t&&t.indexOf(r.attrs.id)>-1?U(U({},r),{attrs:U(U({},r.attrs),{id:r.attrs.id+e.idSuffix})}):r})}):i}function nt(){return Math.random().toString(36).substring(2,8)}W.displayName="UniverIcon";var rt={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"}}]},ne=_.forwardRef(function(i,e){return _.createElement(W,Object.assign({},i,{id:"all-border-single",ref:e,icon:rt}))});ne.displayName="AllBorderSingle";var it={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.02547 12.4251C5.15328 13.7417 6.26305 14.7708 7.61318 14.7708H12.6132C14.0491 14.7708 15.2132 13.6067 15.2132 12.1708V6.1708C15.2132 4.78586 14.1303 3.65383 12.7651 3.57517C12.6373 2.25858 11.5275 1.22949 10.1774 1.22949H5.17739C3.74145 1.22949 2.57739 2.39355 2.57739 3.82949V9.82949C2.57739 11.2144 3.66024 12.3465 5.02547 12.4251ZM11.5535 3.5708H7.61318C6.17724 3.5708 5.01318 4.73486 5.01318 6.1708V11.22C4.31736 11.1387 3.77739 10.5471 3.77739 9.82949V3.82949C3.77739 3.05629 4.40419 2.42949 5.17739 2.42949H10.1774C10.8622 2.42949 11.4322 2.92119 11.5535 3.5708ZM14.0132 6.1708C14.0132 5.3976 13.3864 4.7708 12.6132 4.7708H7.61318C6.83998 4.7708 6.21318 5.3976 6.21318 6.1708V12.1708C6.21318 12.944 6.83998 13.5708 7.61318 13.5708H12.6132C13.3864 13.5708 14.0132 12.944 14.0132 12.1708V6.1708Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Me=_.forwardRef(function(i,e){return _.createElement(W,Object.assign({},i,{id:"copy-single",ref:e,icon:it}))});Me.displayName="CopySingle";var ot={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.9564 2.91332C4.91407 1.87102 3.22413 1.87101 2.18182 2.91333L2.18182 2.91333C1.13953 3.95567 1.13952 5.6456 2.18182 6.68791L8.27777 12.7838C9.72408 14.2302 12.069 14.2302 13.5154 12.7839L13.0911 12.3596L13.5154 12.7839C14.9617 11.3375 14.9617 8.99257 13.5154 7.54626L8.39476 2.42566C8.16044 2.19134 7.78054 2.19134 7.54623 2.42566C7.31191 2.65997 7.31191 3.03987 7.54623 3.27419L12.6668 8.39479L13.0911 7.97052L12.6668 8.39479C13.6445 9.37247 13.6445 10.9576 12.6668 11.9353L13.0399 12.3084L12.6668 11.9353C11.6891 12.913 10.104 12.913 9.1263 11.9353L3.03035 5.83938C2.45668 5.26571 2.45667 4.33556 3.03036 3.76184C3.60403 3.18818 4.53416 3.18817 5.10788 3.76185C5.10788 3.76186 5.10788 3.76186 5.10789 3.76186L11.2038 9.8578L11.601 9.46061L11.2038 9.8578C11.3735 10.0275 11.3735 10.3026 11.2038 10.4723L11.2038 10.4723C11.0341 10.642 10.759 10.642 10.5893 10.4723L5.46874 5.35171C5.23442 5.1174 4.85452 5.1174 4.62021 5.35171C4.38589 5.58602 4.38589 5.96592 4.62021 6.20024L9.74078 11.3208C10.3791 11.9591 11.414 11.9591 12.0523 11.3208C12.0523 11.3208 12.0523 11.3208 12.0523 11.3208M12.0523 11.3208C12.6907 10.6825 12.6906 9.64757 12.0523 9.00927L5.95641 2.91333L5.9564 2.91332",fillRule:"evenodd",clipRule:"evenodd"}}]},oe=_.forwardRef(function(i,e){return _.createElement(W,Object.assign({},i,{id:"link-single",ref:e,icon:ot}))});oe.displayName="LinkSingle";var st={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"}}]},we=_.forwardRef(function(i,e){return _.createElement(W,Object.assign({},i,{id:"unlink-single",ref:e,icon:st}))});we.displayName="UnlinkSingle";var at={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"}}]},Te=_.forwardRef(function(i,e){return _.createElement(W,Object.assign({},i,{id:"write-single",ref:e,icon:at}))});Te.displayName="WriteSingle";var ct={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"#35BD4B",d:"M3.36396 1.12549C2.61066 1.12549 2 1.73615 2 2.48945V13.5104C2 14.2637 2.61066 14.8744 3.36396 14.8744H12.457C13.2103 14.8744 13.821 14.2637 13.821 13.5104V5.0992L9.91954 1.12549H3.36396Z"}},{tag:"path",attrs:{fill:"#32A846",d:"M9.91797 1.12549L13.8209 5.09842H10.5846C10.2164 5.09842 9.91797 4.79994 9.91797 4.43175V1.12549Z"}},{tag:"path",attrs:{fill:"#fff",d:"M7.71926 10.2949L6.28687 12.403C6.17306 12.5705 5.94501 12.614 5.77751 12.5002C5.61002 12.3864 5.56649 12.1584 5.6803 11.9909L7.27596 9.64252L5.85088 7.54519C5.73707 7.37769 5.78059 7.14964 5.94809 7.03583C6.11558 6.92202 6.34363 6.96555 6.45744 7.13304L7.71926 8.9901L8.98108 7.13304C9.09489 6.96555 9.32294 6.92202 9.49044 7.03583C9.65793 7.14964 9.70146 7.37769 9.58765 7.54519L8.16256 9.64252L9.75822 11.9909C9.87203 12.1584 9.82851 12.3864 9.66101 12.5002C9.49351 12.614 9.26547 12.5705 9.15166 12.403L7.71926 10.2949Z",fillRule:"evenodd",clipRule:"evenodd"}}]},ve=_.forwardRef(function(i,e){return _.createElement(W,Object.assign({},i,{id:"xlsx",ref:e,icon:ct}))});ve.displayName="Xlsx";var lt=Object.defineProperty,dt=Object.getOwnPropertyDescriptor,pt=(i,e,n,t)=>{for(var r=t>1?void 0:t?dt(e,n):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(t?s(e,n,r):s(r))||r);return t&&r&&lt(e,n,r),r},G=(i,e)=>(n,t)=>e(n,t,i);function ut(i,e){const n=e.getMergeData(),t=e.getMaxColumns()-1,r=e.getMaxRows()-1;if(t<i.endColumn&&(i.endColumn=t),r<i.endRow&&(i.endRow=r),i.rangeType===a.RANGE_TYPE.COLUMN||a.RANGE_TYPE.ROW)return i;const o=[];return n.forEach(s=>{a.Rectangle.intersects(i,s)&&o.push(s)}),a.Rectangle.realUnion(i,...o)}exports.SheetsHyperLinkResolverService=class{constructor(e,n,t,r,o){this._univerInstanceService=e,this._commandService=n,this._definedNamesService=t,this._messageService=r,this._localeService=o}_getURLName(e){var l;const{gid:n,range:t,rangeid:r}=e,o=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!o)return null;const s=n?o.getSheetBySheetId(n):o.getActiveSheet(),c=(l=s==null?void 0:s.getName())!=null?l:"";if(t){const p=N.deserializeRangeWithSheet(t).range;return a.isValidRange(p)&&t!==m.ERROR_RANGE?{type:"range",name:N.serializeRangeWithSheet(c,p)}:{type:"range-error",name:this._localeService.t("hyperLink.message.refError")}}if(r){const p=this._definedNamesService.getValueById(o.getUnitId(),r);return p?{type:"defineName",name:p.formulaOrRefString}:{type:"range-error",name:this._localeService.t("hyperLink.message.refError")}}if(n){const p=o.getSheetBySheetId(n);return p?{type:"sheet",name:p.getName()}:{type:"sheet-error",name:this._localeService.t("hyperLink.message.refError")}}return null}navigateTo(e){const{gid:n,range:t,rangeid:r}=e,o=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!o)return;const s=o.getUnitId();if(r&&this.navigateToDefineName(s,r),!!n){if(t){const c=N.deserializeRangeWithSheet(t);a.isValidRange(c.range)&&t!==m.ERROR_RANGE&&this.navigateToRange(s,n,c.range);return}this.navigateToSheetById(s,n)}}parseHyperLink(e){var n,t,r;if(e!=null&&e.startsWith("#")){const o=new URLSearchParams(e.slice(1)),s={gid:(n=o.get("gid"))!=null?n:"",range:(t=o.get("range"))!=null?t:"",rangeid:(r=o.get("rangeid"))!=null?r:""},c=this._getURLName(s);return{type:(c==null?void 0:c.type)||"link",name:(c==null?void 0:c.name)||e,url:e,searchObj:s,handler:()=>{this.navigateTo(s)}}}else return{type:"outer",name:e,url:e,handler:()=>{this.navigateToOtherWebsite(e)}}}async navigateToRange(e,n,t){const r=await this.navigateToSheetById(e,n);if(r){const o=ut(t,r);await this._commandService.executeCommand(u.SetSelectionsOperation.id,{unitId:e,subUnitId:n,selections:[{range:o}]}),await this._commandService.executeCommand(S.ScrollToRangeOperation.id,{range:o})}}async navigateToSheet(e,n){const t=this._univerInstanceService.getUnit(e,a.UniverInstanceType.UNIVER_SHEET);if(!t)return!1;const r=t.getActiveSheet();if((r==null?void 0:r.getName())===n)return!0;const o=t.getSheetBySheetName(n);if(!o){this._messageService.show({content:this._localeService.t("hyperLink.message.noSheet"),type:k.MessageType.Error});return}const s=o.getSheetId();return t.getHiddenWorksheets().indexOf(s)>-1&&this._messageService.show({content:this._localeService.t("hyperLink.message.hiddenSheet"),type:k.MessageType.Error}),await this._commandService.executeCommand(u.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:s})}async navigateToSheetById(e,n){const t=this._univerInstanceService.getUnit(e,a.UniverInstanceType.UNIVER_SHEET);if(!t)return!1;const r=t.getActiveSheet();if(!r)return!1;if(r.getSheetId()===n)return r;const o=t.getSheetBySheetId(n);return o?t.getHiddenWorksheets().indexOf(n)>-1?(this._messageService.show({content:this._localeService.t("hyperLink.message.hiddenSheet"),type:k.MessageType.Error}),!1):await this._commandService.executeCommand(u.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:n})?o:!1:(this._messageService.show({content:this._localeService.t("hyperLink.message.noSheet"),type:k.MessageType.Error}),!1)}async navigateToDefineName(e,n){return this._definedNamesService.focusRange(e,n),!0}async navigateToOtherWebsite(e){window.open(e,"_blank","noopener noreferrer")}};exports.SheetsHyperLinkResolverService=pt([G(0,a.IUniverInstanceService),G(1,a.ICommandService),G(2,N.IDefinedNamesService),G(3,H.IMessageService),G(4,a.Inject(a.LocaleService))],exports.SheetsHyperLinkResolverService);function J(i){return a.Tools.isLegalUrl(i)}function ht(i){return/^[a-zA-Z]+:\/\//.test(i)}function mt(i){return/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(i)}function Se(i){if(J(i)){const e=ht(i)?i:mt(i)?`mailto://${i}`:`http://${i}`,n=new URL(e);return n.hostname===location.hostname&&n.port===location.port&&n.protocol===location.protocol&&n.pathname===location.pathname&&n.hash&&!n.search?n.hash:e}return i}function gt(i){if(i===null)return"";if(i!=null&&i.p){const e=i==null?void 0:i.p.body;if(e==null)return"";const n=e.dataStream;return n.substring(n.length-2,n.length)===a.DEFAULT_EMPTY_DOCUMENT_VALUE?n.substring(0,n.length-2):n}return i==null?void 0:i.v}const vt="univer-cell-link-edit-buttons",yt={cellLinkEditButtons:vt},se=()=>{var Z;const[i,e]=_.useState(""),[n,t]=_.useState(""),[r,o]=_.useState("link"),[s,c]=_.useState(""),l=a.useDependency(a.LocaleService),p=a.useDependency(N.IDefinedNamesService),v=a.useDependency(a.IUniverInstanceService),f=a.useDependency(exports.SheetsHyperLinkPopupService),d=H.useObservable(f.currentEditing$),C=a.useDependency(m.HyperLinkModel),y=a.useDependency(exports.SheetsHyperLinkResolverService),L=a.useDependency(a.ICommandService),[I,M]=_.useState(!1),b=_.useRef(!1);_.useEffect(()=>{var g,R,O;if((d==null?void 0:d.row)!==void 0&&d.column!==void 0){const P=C.getHyperLinkByLocationSync(d.unitId,d.subUnitId,d.row,d.column);if(P){const ee=y.parseHyperLink(P.payload);if(e(P.id),t(P.display),ee.type==="outer"){o("link"),c(ee.url),ee.url===P.display&&(b.current=!0);return}else{const D=ee.searchObj;if(D.rangeid){o("rangeid"),c(D.rangeid);return}if(D.range){const Ne=D.gid&&(O=(R=(g=v.getUnit(d.unitId))==null?void 0:g.getSheetBySheetId(D.gid))==null?void 0:R.getName())!=null?O:"";if(o("range"),D.range===m.ERROR_RANGE)c("");else{const Ce=N.serializeRangeWithSheet(Ne,N.deserializeRangeWithSheet(D.range).range);c(Ce),Ce===P.display&&(b.current=!0)}return}if(D.gid){o("gid"),c(D.gid);return}}}const w=v.getUnit(d.unitId),j=w==null?void 0:w.getSheetBySheetId(d.subUnitId),xe=j==null?void 0:j.getCellRaw(d.row,d.column),he=gt(xe);o("link"),c(""),t((he!=null?he:"").toString()),e("");return}o("link"),c(""),t(""),e("")},[d,C,y,v]);const T=_.useMemo(()=>s,[r]),$=[{label:l.t("hyperLink.form.link"),value:"link"},{label:l.t("hyperLink.form.range"),value:"range"},{label:l.t("hyperLink.form.worksheet"),value:"gid"},{label:l.t("hyperLink.form.definedName"),value:"rangeid"}],E=v.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!E)return;const F=E.getHiddenWorksheets(),A=E.getSheets().map(g=>({label:g.getName(),value:g.getSheetId()})).filter(g=>F.indexOf(g.value)===-1),V=Object.values((Z=p.getDefinedNameMap(E.getUnitId()))!=null?Z:{}).map(g=>({label:g.name,value:g.id})),q=(g,R)=>{if(g==="link")return Se(R);if(g==="range"){const O=N.deserializeRangeWithSheet(R),P=E.getSheetBySheetName(O.sheetName);if(P)return`#gid=${P.getSheetId()}&range=${N.serializeRange(O.range)}`}return`#${g}=${R}`},pe=H.useEvent(g=>{var P;const R=g[0];if(!R||!a.isValidRange(R.range))return;R.sheetName||(R.sheetName=((P=E.getActiveSheet())==null?void 0:P.getName())||"");const O=N.serializeRangeToRefString(R);c(O),O&&(b.current||!n)&&(t(O),b.current=!0)}),ue=async()=>{if(d&&(i?await L.executeCommand(m.UpdateHyperLinkCommand.id,{unitId:d.unitId,subUnitId:d.subUnitId,id:i,payload:{display:n,payload:q(r,s)}}):await L.executeCommand(m.AddHyperLinkCommand.id,{unitId:d.unitId,subUnitId:d.subUnitId,link:{id:a.Tools.generateRandomId(),row:d.row,column:d.column,payload:q(r,s),display:n}})),d){await L.executeCommand(u.SetWorksheetActiveOperation.id,{unitId:d.unitId,subUnitId:d.subUnitId});const g=1;await L.executeCommand(S.ScrollToRangeOperation.id,{range:{startRow:Math.max(d.row-g,0),endRow:d.row+g,startColumn:Math.max(d.column-g,0),endColumn:d.column+g}})}L.executeCommand(Q.id)};return h.jsxs("div",{children:[h.jsx(k.FormLayout,{label:l.t("hyperLink.form.label"),error:I&&!n?l.t("hyperLink.form.inputError"):"",children:h.jsx(k.Input,{value:n,onChange:g=>{t(g),b.current=!1},placeholder:l.t("hyperLink.form.labelPlaceholder")})}),h.jsx(k.FormLayout,{label:l.t("hyperLink.form.type"),children:h.jsx(k.Select,{options:$,value:r,onChange:g=>{o(g),c("")}})}),r==="link"&&h.jsx(k.FormLayout,{error:I?s?J(s)?"":l.t("hyperLink.form.linkError"):l.t("hyperLink.form.inputError"):"",children:h.jsx(k.Input,{value:s,onChange:g=>{c(g),g&&(b.current||!n||n===s)&&(t(g),b.current=!0)},placeholder:l.t("hyperLink.form.linkPlaceholder")})}),r==="range"&&h.jsx(k.FormLayout,{error:I&&!s?l.t("hyperLink.form.inputError"):"",children:h.jsx(H.RangeSelector,{openForSheetUnitId:E.getUnitId(),id:a.createInternalEditorID("hyper-link-edit"),isSingleChoice:!0,value:T,onChange:pe})}),r==="gid"&&h.jsx(k.FormLayout,{error:I&&!s?l.t("hyperLink.form.selectError"):"",children:h.jsx(k.Select,{options:A,value:s,onChange:g=>{var P,w;c(g);const R=(P=A.find(j=>j.value===g))==null?void 0:P.label,O=(w=A.find(j=>j.value===s))==null?void 0:w.label;R&&(b.current||!n||n===O)&&(t(R),b.current=!0)}})}),r==="rangeid"&&h.jsx(k.FormLayout,{error:I&&!s?l.t("hyperLink.form.selectError"):"",children:h.jsx(k.Select,{options:V,value:s,onChange:g=>{var P,w;c(g);const R=(P=V.find(j=>j.value===g))==null?void 0:P.label,O=(w=V.find(j=>j.value===s))==null?void 0:w.label;R&&(b.current||!n||n===O)&&(t(R),b.current=!0)}})}),h.jsxs("div",{className:yt.cellLinkEditButtons,children:[h.jsx(k.Button,{onClick:()=>{d&&L.executeCommand(u.SetWorksheetActiveOperation.id,{unitId:d.unitId,subUnitId:d.subUnitId}),L.executeCommand(Q.id)},children:l.t("hyperLink.form.cancel")}),h.jsx(k.Button,{type:"primary",style:{marginLeft:8},onClick:async()=>{if(!n||!s||r==="link"&&!J(s)){M(!0);return}ue()},children:l.t("hyperLink.form.ok")})]})]})};se.componentKey="univer.sheet.cell-link-edit";const le={type:a.CommandType.OPERATION,id:"sheet.operation.open-hyper-link-sidebar",handler(i,e){if(!e)return!1;const{unitId:n,subUnitId:t,row:r,column:o}=e,s=i.get(m.HyperLinkModel),c=i.get(H.ISidebarService),l=i.get(exports.SheetsHyperLinkPopupService),p=s.getHyperLinkByLocation(n,t,r,o);return l.startEditing(e),c.open({header:{title:p?"hyperLink.form.editTitle":"hyperLink.form.addTitle"},children:{label:se.componentKey}}),!0}},Q={type:a.CommandType.OPERATION,id:"sheet.operation.close-hyper-link-sidebar",handler(i){const e=i.get(H.ISidebarService),n=i.get(exports.SheetsHyperLinkPopupService);return e.close(),n.endEditing(),!0}},de={type:a.CommandType.OPERATION,id:"sheet.operation.insert-hyper-link",handler(i){const e=i.get(a.IUniverInstanceService),n=u.getSheetCommandTarget(e);if(!n)return!1;const t=i.get(a.ICommandService),o=i.get(u.SheetsSelectionsService).getCurrentLastSelection();if(!o)return!1;const s=o.primary.startRow,c=o.primary.startColumn;return t.executeCommand(le.id,{unitId:n.unitId,subUnitId:n.subUnitId,row:s,column:c})}},fe={type:a.CommandType.OPERATION,id:"sheet.operation.insert-hyper-link-toolbar",handler(i){const e=i.get(a.ICommandService);return i.get(exports.SheetsHyperLinkPopupService).currentEditing?e.executeCommand(Q.id):e.executeCommand(de.id)}},St="univer-cell-link",ft="univer-cell-link-type",_t="univer-cell-link-content",Lt="univer-cell-link-content-error",Ct="univer-cell-link-url",kt="univer-cell-link-operations",It="univer-cell-link-operation",Rt="univer-cell-link-operation-error",x={cellLink:St,cellLinkType:ft,cellLinkContent:_t,cellLinkContentError:Lt,cellLinkUrl:Ct,cellLinkOperations:kt,cellLinkOperation:It,cellLinkOperationError:Rt},Pt={outer:h.jsx(oe,{}),link:h.jsx(oe,{}),sheet:h.jsx(ve,{}),range:h.jsx(ne,{}),defineName:h.jsx(ne,{}),"range-error":h.jsx(ne,{}),"sheet-error":h.jsx(ve,{})},ae=()=>{const i=a.useDependency(exports.SheetsHyperLinkPopupService),e=a.useDependency(m.HyperLinkModel),n=a.useDependency(a.ICommandService),t=a.useDependency(H.IMessageService),r=a.useDependency(a.LocaleService),[o,s]=_.useState(null),c=a.useDependency(exports.SheetsHyperLinkResolverService);if(_.useEffect(()=>{s(i.currentPopup);const y=i.currentPopup$.subscribe(L=>{s(L)});return()=>{y.unsubscribe()}},[i.currentPopup,i.currentPopup$]),!o)return null;const{unitId:l,subUnitId:p,id:v}=o,f=e.getHyperLink(l,p,v);if(!f)return null;const d=c.parseHyperLink(f.payload),C=d.type.indexOf("error")>-1;return h.jsxs("div",{className:x.cellLink,onClick:()=>i.hideCurrentPopup(),children:[h.jsxs("div",{className:ke(x.cellLinkContent,{[x.cellLinkContentError]:C}),onClick:d.handler,children:[h.jsx("div",{className:x.cellLinkType,children:Pt[d.type]}),h.jsx(k.Tooltip,{showIfEllipsis:!0,title:d.name,children:h.jsx("span",{className:x.cellLinkUrl,children:d.name})})]}),h.jsxs("div",{className:x.cellLinkOperations,children:[o.copyPermission&&h.jsx("div",{className:ke(x.cellLinkOperation,{[x.cellLinkOperationError]:C}),onClick:()=>{if(!C){if(d.type!=="outer"){const y=new URL(window.location.href);y.hash=d.url.slice(1),navigator.clipboard.writeText(y.href)}else navigator.clipboard.writeText(d.url);t.show({content:r.t("hyperLink.message.coped"),type:k.MessageType.Info})}},children:h.jsx(k.Tooltip,{placement:"bottom",title:r.t("hyperLink.popup.copy"),children:h.jsx(Me,{})})}),o.editPermission&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:x.cellLinkOperation,onClick:()=>{n.executeCommand(le.id,{unitId:l,subUnitId:p,row:f.row,column:f.column})},children:h.jsx(k.Tooltip,{placement:"bottom",title:r.t("hyperLink.popup.edit"),children:h.jsx(Te,{})})}),h.jsx("div",{className:x.cellLinkOperation,onClick:()=>{n.executeCommand(m.CancelHyperLinkCommand.id,{unitId:l,subUnitId:p,id:f.id})},children:h.jsx(k.Tooltip,{placement:"bottom",title:r.t("hyperLink.popup.cancel"),children:h.jsx(we,{})})})]})]})]})};ae.componentKey="univer.sheet.cell-link-popup";var bt=Object.defineProperty,Ht=Object.getOwnPropertyDescriptor,Et=(i,e,n,t)=>{for(var r=t>1?void 0:t?Ht(e,n):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(t?s(e,n,r):s(r))||r);return t&&r&&bt(e,n,r),r},Ie=(i,e)=>(n,t)=>e(n,t,i);const Ot=(i,e)=>i.unitId===e.unitId&&i.subUnitId===e.subUnitId&&i.row===e.row&&i.col===e.col;exports.SheetsHyperLinkPopupService=class extends a.Disposable{constructor(n,t){super();B(this,"_currentPopup",null);B(this,"_currentPopup$",new ie.Subject);B(this,"currentPopup$",this._currentPopup$.asObservable());B(this,"_currentEditing$",new ie.BehaviorSubject(null));B(this,"currentEditing$",this._currentEditing$.asObservable());this._hyperLinkModel=n,this._sheetCanvasPopManagerService=t,this.disposeWithMe(()=>{this.hideCurrentPopup(),this.endEditing(),this._currentEditing$.complete(),this._currentPopup$.complete()})}get currentPopup(){return this._currentPopup}get currentEditing(){return this._currentEditing$.getValue()}showPopup(n){if(this._currentPopup&&Ot(n,this._currentPopup))return;this.hideCurrentPopup();const{unitId:t,subUnitId:r,row:o,col:s}=n,c=this._hyperLinkModel.getHyperLinkByLocation(t,r,o,s);if(!c)return;const l=this._sheetCanvasPopManagerService.attachPopupToCell(o,s,{componentKey:ae.componentKey,direction:"bottom",closeOnSelfTarget:!0,onClickOutside:()=>{this.hideCurrentPopup()}});l&&(this._currentPopup={unitId:t,subUnitId:r,id:c.id,disposable:l,row:o,col:s,editPermission:!!n.editPermission,copyPermission:!!n.copyPermission},this._currentPopup$.next(this._currentPopup))}hideCurrentPopup(){var n;this._currentPopup&&((n=this._currentPopup.disposable)==null||n.dispose(),this._currentPopup=null,this._currentPopup$.next(null))}startEditing(n){this._currentEditing$.next(n)}endEditing(){this._currentEditing$.next(null)}};exports.SheetsHyperLinkPopupService=Et([Ie(0,a.Inject(m.HyperLinkModel)),Ie(1,a.Inject(S.SheetCanvasPopManagerService))],exports.SheetsHyperLinkPopupService);var Mt=Object.defineProperty,wt=Object.getOwnPropertyDescriptor,Tt=(i,e,n,t)=>{for(var r=t>1?void 0:t?wt(e,n):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(t?s(e,n,r):s(r))||r);return t&&r&&Mt(e,n,r),r},Y=(i,e)=>(n,t)=>e(n,t,i);exports.SheetHyperLinkSetRangeController=class extends a.Disposable{constructor(e,n,t,r,o,s){super(),this._sheetInterceptorService=e,this._injector=n,this._hyperLinkModel=t,this._selectionManagerService=r,this._univerInstanceService=o,this._editorBridgeService=s,this._initCommandInterceptor()}_initCommandInterceptor(){this._initAddHyperLinkCommandInterceptor(),this._initSetRangeValuesCommandInterceptor(),this._initUpdateHyperLinkCommandInterceptor(),this._initClearSelectionCommandInterceptor(),this._initRichTextEditorInterceptor()}_getCurrentCell(e,n,t,r){var o,s;return(s=(o=this._univerInstanceService.getUnit(e,a.UniverInstanceType.UNIVER_SHEET))==null?void 0:o.getSheetBySheetId(n))==null?void 0:s.getCell(t,r)}_initAddHyperLinkCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{var n;if(e.id===m.AddHyperLinkCommand.id){const t=e.params,{unitId:r,subUnitId:o,link:s}=t,c=this._getCurrentCell(r,o,s.row,s.column),l={unitId:r,subUnitId:o,cellValue:{[s.row]:{[s.column]:{v:s.display,p:null,t:(n=c==null?void 0:c.t)!=null?n:void 0}}}};return{redos:[{id:u.SetRangeValuesMutation.id,params:l}],undos:[{id:u.SetRangeValuesMutation.id,params:u.SetRangeValuesUndoMutationFactory(this._injector,l)}]}}return{redos:[],undos:[]}}}))}_initUpdateHyperLinkCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{if(e.id===m.UpdateHyperLinkCommand.id){const n=e.params,{unitId:t,subUnitId:r,id:o,payload:s}=n,c=this._hyperLinkModel.getHyperLink(t,r,o);if(c&&c.display!==s.display){const l={unitId:t,subUnitId:r,cellValue:{[c.row]:{[c.column]:{v:s.display,t:a.CellValueType.STRING,p:null}}}};return{redos:[{id:u.SetRangeValuesMutation.id,params:l}],undos:[{id:u.SetRangeValuesMutation.id,params:u.SetRangeValuesUndoMutationFactory(this._injector,l)}]}}}return{redos:[],undos:[]}}}))}_initSetRangeValuesCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{if(e.id===u.SetRangeValuesCommand.id){const n=e.params,{unitId:t,subUnitId:r}=n,o=[],s=[];return n.cellValue&&new a.ObjectMatrix(n.cellValue).forValue((c,l,p)=>{var C,y,L,I,M,b,T;const v=(L=p==null?void 0:p.v)!=null?L:(y=(C=p==null?void 0:p.p)==null?void 0:C.body)==null?void 0:y.dataStream.slice(0,-2),f=(v!=null?v:"").toString(),d=this._hyperLinkModel.getHyperLinkByLocation(t,r,c,l);if(!d){if(J(f)||(I=p==null?void 0:p.custom)!=null&&I.__link_url){const $=(b=(M=p==null?void 0:p.custom)==null?void 0:M.__link_url)!=null?b:f,E=a.Tools.generateRandomId();s.push({id:m.RemoveHyperLinkMutation.id,params:{unitId:t,subUnitId:r,id:E}}),o.push({id:m.AddHyperLinkMutation.id,params:{unitId:t,subUnitId:r,link:{id:E,row:c,column:l,display:f,payload:Se($)}}})}return}(v===""||((T=p==null?void 0:p.custom)==null?void 0:T.__link_url)==="")&&(o.push({id:m.RemoveHyperLinkMutation.id,params:{unitId:t,subUnitId:r,id:d.id}}),s.push({id:m.AddHyperLinkMutation.id,params:{unitId:t,subUnitId:r,link:d}}))}),{undos:s,redos:o}}return{redos:[],undos:[]}}}))}_initClearSelectionCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{if(e.id===u.ClearSelectionContentCommand.id||e.id===u.ClearSelectionAllCommand.id||e.id===u.ClearSelectionFormatCommand.id){const n=[],t=[],r=this._selectionManagerService.getCurrentLastSelection(),o=u.getSheetCommandTarget(this._univerInstanceService);if(r&&o){const{unitId:s,subUnitId:c}=o;a.Range.foreach(r.range,(l,p)=>{const v=this._hyperLinkModel.getHyperLinkByLocation(s,c,l,p);v&&(n.push({id:m.RemoveHyperLinkMutation.id,params:{unitId:s,subUnitId:c,id:v.id}}),t.push({id:m.AddHyperLinkMutation.id,params:{unitId:s,subUnitId:c,link:v}}))})}return{redos:n,undos:t}}return{redos:[],undos:[]}}}))}_initRichTextEditorInterceptor(){this.disposeWithMe(this._editorBridgeService.interceptor.intercept(this._editorBridgeService.interceptor.getInterceptPoints().AFTER_CELL_EDIT,{handler:(e,n,t)=>{var r,o,s,c,l,p;if(e!=null&&e.p){const v=(o=(r=e.p.body)==null?void 0:r.customRanges)==null?void 0:o.find(d=>d.rangeType===a.CustomRangeType.HYPERLINK),f=(s=e.p.resources)==null?void 0:s.find(d=>d.name===Ae.DOC_HYPER_LINK_PLUGIN);if(v&&f){const d=v.rangeId,C=(p=(l=(c=JSON.parse(f.data))==null?void 0:c.links)==null?void 0:l.find(y=>y.id===d))==null?void 0:p.payload;return t({...e,p:null,v:Ve.getPlainTextFormDocument(e.p),t:a.CellValueType.STRING,custom:{__link_url:C}})}}return t(e)}}))}};exports.SheetHyperLinkSetRangeController=Tt([a.OnLifecycle(a.LifecycleStages.Starting,exports.SheetHyperLinkSetRangeController),Y(0,a.Inject(u.SheetInterceptorService)),Y(1,a.Inject(a.Injector)),Y(2,a.Inject(m.HyperLinkModel)),Y(3,a.Inject(u.SheetsSelectionsService)),Y(4,a.IUniverInstanceService),Y(5,S.IEditorBridgeService)],exports.SheetHyperLinkSetRangeController);var Ut=Object.defineProperty,jt=Object.getOwnPropertyDescriptor,xt=(i,e,n,t)=>{for(var r=t>1?void 0:t?jt(e,n):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(t?s(e,n,r):s(r))||r);return t&&r&&Ut(e,n,r),r},X=(i,e)=>(n,t)=>e(n,t,i);exports.SheetsHyperLinkPopupController=class extends a.Disposable{constructor(e,n,t,r,o){super(),this._hoverManagerService=e,this._sheetsHyperLinkPopupService=n,this._renderManagerService=t,this._permissionService=r,this._sheetPermissionInterceptorBaseController=o,this._initHoverListener()}_initHoverListener(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(ie.debounceTime(200)).subscribe(e=>{var d,C;if(!e){this._sheetsHyperLinkPopupService.hideCurrentPopup();return}const n=(C=(d=this._renderManagerService.getRenderById(e.location.unitId))==null?void 0:d.with(S.SheetSkeletonManagerService).getWorksheetSkeleton(e.location.subUnitId))==null?void 0:C.skeleton,t=e.location.col,r=e.location.row;let o=r,s=t;if(n&&n.overflowCache.forValue((y,L,I)=>{a.Rectangle.contains(I,{startColumn:t,endColumn:t,startRow:r,endRow:r})&&(o=y,s=L)}),!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[u.WorkbookViewPermission],worksheetTypes:[u.WorksheetViewPermission],rangeTypes:[u.RangeProtectionPermissionViewPoint]},[{startRow:r,startColumn:t,endRow:r,endColumn:t}])){this._sheetsHyperLinkPopupService.hideCurrentPopup();return}const l=this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetEditPermission,u.WorksheetInsertHyperlinkPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]},[{startRow:r,startColumn:t,endRow:r,endColumn:t}]),p=e.location.unitId,v=e.location.subUnitId,f=this._permissionService.composePermission([new u.WorkbookCopyPermission(p).id,new u.WorksheetCopyPermission(p,v).id]).every(y=>y.value);this._sheetsHyperLinkPopupService.showPopup({...e.location,row:o,col:s,editPermission:l,copyPermission:f})}))}};exports.SheetsHyperLinkPopupController=xt([a.OnLifecycle(a.LifecycleStages.Rendered,exports.SheetsHyperLinkPopupController),X(0,a.Inject(S.HoverManagerService)),X(1,a.Inject(exports.SheetsHyperLinkPopupService)),X(2,a.Inject(ye.IRenderManagerService)),X(3,a.Inject(a.IPermissionService)),X(4,a.Inject(S.SheetPermissionInterceptorBaseController))],exports.SheetsHyperLinkPopupController);const Nt=i=>({id:de.id,type:H.MenuItemType.BUTTON,positions:[H.MenuPosition.CONTEXT_MENU],title:"hyperLink.menu.add",hidden$:H.getMenuHiddenObservable(i,a.UniverInstanceType.UNIVER_SHEET),icon:"LinkSingle",disabled$:S.getCurrentRangeDisable$(i,{workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetEditPermission,u.WorksheetSetCellValuePermission,u.WorksheetInsertHyperlinkPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]})}),Dt=i=>({tooltip:"hyperLink.form.addTitle",positions:H.MenuPosition.TOOLBAR_START,group:H.MenuGroup.TOOLBAR_OTHERS,id:fe.id,type:H.MenuItemType.BUTTON,icon:"LinkSingle",hidden$:H.getMenuHiddenObservable(i,a.UniverInstanceType.UNIVER_SHEET),disabled$:S.getCurrentRangeDisable$(i,{workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetEditPermission,u.WorksheetSetCellValuePermission,u.WorksheetInsertHyperlinkPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]})}),_e={id:fe.id,binding:H.KeyCode.K|H.MetaKeys.CTRL_COMMAND,preconditions:S.whenSheetEditorFocused};var $t=Object.defineProperty,At=Object.getOwnPropertyDescriptor,Vt=(i,e,n,t)=>{for(var r=t>1?void 0:t?At(e,n):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(t?s(e,n,r):s(r))||r);return t&&r&&$t(e,n,r),r},K=(i,e)=>(n,t)=>e(n,t,i);exports.SheetsHyperLinkUIController=class extends a.Disposable{constructor(e,n,t,r,o,s,c){super(),this._config=e,this._componentManager=n,this._commandService=t,this._localeService=r,this._menuService=o,this._injector=s,this._shortcutService=c,this._initComponents(),this._initCommands(),this._initMenus(),this._initShortCut()}_initComponents(){[[ae,ae.componentKey],[se,se.componentKey],[oe,"LinkSingle"]].forEach(([e,n])=>{this._componentManager.register(n,e)})}_initCommands(){[le,Q,de,fe].forEach(e=>{this._commandService.registerCommand(e)})}_initMenus(){var e,n,t,r;this._menuService.addMenuItem(Nt(this._injector),(n=(e=this._config)==null?void 0:e.menu)!=null?n:{}),this._menuService.addMenuItem(Dt(this._injector),(r=(t=this._config)==null?void 0:t.menu)!=null?r:{})}_initShortCut(){this._shortcutService.registerShortcut(_e)}};exports.SheetsHyperLinkUIController=Vt([a.OnLifecycle(a.LifecycleStages.Ready,exports.SheetsHyperLinkUIController),K(1,a.Inject(H.ComponentManager)),K(2,a.ICommandService),K(3,a.Inject(a.LocaleService)),K(4,H.IMenuService),K(5,a.Inject(a.Injector)),K(6,a.Inject(H.IShortcutService))],exports.SheetsHyperLinkUIController);const Le="SHEET_HYPER_LINK_UI_PLUGIN";var Bt=Object.defineProperty,Wt=Object.getOwnPropertyDescriptor,Ft=(i,e,n,t)=>{for(var r=t>1?void 0:t?Wt(e,n):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(t?s(e,n,r):s(r))||r);return t&&r&&Bt(e,n,r),r},Re=(i,e)=>(n,t)=>e(n,t,i);exports.SheetsHyperLinkAutoFillController=class extends a.Disposable{constructor(e,n){super(),this._autoFillService=e,this._hyperLinkModel=n,this._initAutoFill()}_initAutoFill(){const e=()=>({redos:[],undos:[]}),n=(r,o)=>{const{source:s,target:c,unitId:l,subUnitId:p}=r,v=S.virtualizeDiscreteRanges([s,c]),[f,d]=v.ranges,{mapFunc:C}=v,y={row:f.startRow,col:f.startColumn},L=S.getAutoFillRepeatRange(f,d),I=[],M=[];return L.forEach(b=>{const T=b.repeatStartCell,$=b.relativeRange,E={startRow:y.row,startColumn:y.col,endColumn:y.col,endRow:y.row},F={startRow:T.row,startColumn:T.col,endColumn:T.col,endRow:T.row};a.Range.foreach($,(A,V)=>{const q=a.Rectangle.getPositionRange({startRow:A,startColumn:V,endColumn:V,endRow:A},E),{row:pe,col:ue}=C(q.startRow,q.startColumn),Z=this._hyperLinkModel.getHyperLinkByLocation(l,p,pe,ue);if(Z){const g=a.Rectangle.getPositionRange({startRow:A,startColumn:V,endColumn:V,endRow:A},F),{row:R,col:O}=C(g.startRow,g.startColumn),P=a.Tools.generateRandomId(),w=this._hyperLinkModel.getHyperLinkByLocation(l,p,R,O);w&&I.push({id:m.RemoveHyperLinkMutation.id,params:{unitId:l,subUnitId:p,id:w.id}}),(S.APPLY_TYPE.COPY===o||S.APPLY_TYPE.SERIES===o)&&(I.push({id:m.AddHyperLinkMutation.id,params:{unitId:l,subUnitId:p,link:{...Z,id:P,row:R,column:O}}}),M.push({id:m.RemoveHyperLinkMutation.id,params:{unitId:l,subUnitId:p,id:P}})),w&&M.push({id:m.AddHyperLinkMutation.id,params:{unitId:l,subUnitId:p,link:w}})}})}),{undos:M,redos:I}},t={id:Le,onFillData:(r,o,s)=>s===S.APPLY_TYPE.COPY||s===S.APPLY_TYPE.ONLY_FORMAT||s===S.APPLY_TYPE.SERIES?n(r,s):e()};this.disposeWithMe(this._autoFillService.addHook(t))}};exports.SheetsHyperLinkAutoFillController=Ft([a.OnLifecycle(a.LifecycleStages.Ready,exports.SheetsHyperLinkAutoFillController),Re(0,S.IAutoFillService),Re(1,a.Inject(m.HyperLinkModel))],exports.SheetsHyperLinkAutoFillController);var Yt=Object.defineProperty,Kt=Object.getOwnPropertyDescriptor,zt=(i,e,n,t)=>{for(var r=t>1?void 0:t?Kt(e,n):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(t?s(e,n,r):s(r))||r);return t&&r&&Yt(e,n,r),r},te=(i,e)=>(n,t)=>e(n,t,i);exports.SheetsHyperLinkCopyPasteController=class extends a.Disposable{constructor(n,t,r,o){super();B(this,"_copyInfo");this._sheetClipboardService=n,this._hyperLinkModel=t,this._injector=r,this._resolverService=o,this._initCopyPaste()}_initCopyPaste(){this._sheetClipboardService.addClipboardHook({id:Le,onBeforeCopy:(n,t,r)=>this._collect(n,t,r),onPasteCells:(n,t,r,o)=>{const{copyType:s=S.COPY_TYPE.COPY,pasteType:c}=o,{range:l}=n||{},{range:p,unitId:v,subUnitId:f}=t;return this._generateMutations(p,{copyType:s,pasteType:c,copyRange:l,unitId:v,subUnitId:f})},onPastePlainText:(n,t)=>{if(J(t)){const r=Se(t),{range:o,unitId:s,subUnitId:c}=n,{ranges:[l],mapFunc:p}=S.virtualizeDiscreteRanges([o]),v=[],f=[];return a.Range.foreach(l,(d,C)=>{const{row:y,col:L}=p(d,C),I=this._hyperLinkModel.getHyperLinkByLocation(s,c,y,L);I&&v.push({id:m.RemoveHyperLinkMutation.id,params:{unitId:s,subUnitId:c,id:I.id}});const M=a.Tools.generateRandomId();v.push({id:m.AddHyperLinkMutation.id,params:{unitId:s,subUnitId:c,link:{id:M,row:y,column:L,payload:r}}}),f.push({id:m.RemoveHyperLinkMutation.id,params:{unitId:s,subUnitId:c,id:M}}),I&&f.push({id:m.AddHyperLinkMutation.id,params:{unitId:s,subUnitId:c,link:I}})}),{redos:v,undos:f}}return{undos:[],redos:[]}}})}_collect(n,t,r){const o=new a.ObjectMatrix;this._copyInfo={unitId:n,subUnitId:t,matrix:o};const s={get:this._injector.get.bind(this._injector)},c=S.rangeToDiscreteRange(r,s,n,t);if(!c)return;const{rows:l,cols:p}=c;l.forEach((v,f)=>{p.forEach((d,C)=>{var L;const y=this._hyperLinkModel.getHyperLinkByLocation(n,t,v,d);o.setValue(f,C,(L=y==null?void 0:y.id)!=null?L:"")})})}_generateMutations(n,t){if(!this._copyInfo)return{redos:[],undos:[]};if(!this._copyInfo||!this._copyInfo.matrix.getSizeOf()||!t.copyRange)return{redos:[],undos:[]};if([S.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_COL_WIDTH,S.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_VALUE,S.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT,S.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMULA].includes(t.pasteType))return{redos:[],undos:[]};const{unitId:r,subUnitId:o}=this._copyInfo,s=[],c=[],{ranges:[l,p],mapFunc:v}=S.virtualizeDiscreteRanges([t.copyRange,n]);return S.getRepeatRange(l,p,!0).forEach(({startRange:d})=>{var C;(C=this._copyInfo)==null||C.matrix.forValue((y,L,I)=>{const M=a.Rectangle.getPositionRange({startRow:y,endRow:y,startColumn:L,endColumn:L},d),b=this._hyperLinkModel.getHyperLink(r,o,I),{row:T,col:$}=v(M.startRow,M.startColumn),E=this._hyperLinkModel.getHyperLinkByLocation(t.unitId,t.subUnitId,T,$),F=a.Tools.generateRandomId();E&&s.push({id:m.RemoveHyperLinkMutation.id,params:{unitId:t.unitId,subUnitId:t.subUnitId,id:E.id}}),b&&(s.push({id:m.AddHyperLinkMutation.id,params:{unitId:t.unitId,subUnitId:t.subUnitId,link:{...b,id:F,row:T,column:$}}}),c.push({id:m.RemoveHyperLinkMutation.id,params:{unitId:t.unitId,subUnitId:t.subUnitId,id:F}})),E&&c.push({id:m.AddHyperLinkMutation.id,params:{unitId:t.unitId,subUnitId:t.subUnitId,link:E}})})}),{redos:s,undos:c}}};exports.SheetsHyperLinkCopyPasteController=zt([a.OnLifecycle(a.LifecycleStages.Ready,exports.SheetsHyperLinkCopyPasteController),te(0,S.ISheetClipboardService),te(1,a.Inject(m.HyperLinkModel)),te(2,a.Inject(a.Injector)),te(3,a.Inject(exports.SheetsHyperLinkResolverService))],exports.SheetsHyperLinkCopyPasteController);var qt=Object.defineProperty,Zt=Object.getOwnPropertyDescriptor,Gt=(i,e,n,t)=>{for(var r=t>1?void 0:t?Zt(e,n):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(t?s(e,n,r):s(r))||r);return t&&r&&qt(e,n,r),r},Xt=(i,e)=>(n,t)=>e(n,t,i);exports.SheetHyperLinkUrlController=class extends a.Disposable{constructor(e){super(),this._resolverService=e,this._handleInitUrl()}_handleInitUrl(){const e=location.hash;e&&this._resolverService.parseHyperLink(e).handler()}};exports.SheetHyperLinkUrlController=Gt([a.OnLifecycle(a.LifecycleStages.Rendered,exports.SheetHyperLinkUrlController),Xt(0,a.Inject(exports.SheetsHyperLinkResolverService))],exports.SheetHyperLinkUrlController);var Jt=Object.defineProperty,Qt=Object.getOwnPropertyDescriptor,en=(i,e,n,t)=>{for(var r=t>1?void 0:t?Qt(e,n):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(t?s(e,n,r):s(r))||r);return t&&r&&Jt(e,n,r),r},ge=(i,e)=>(n,t)=>e(n,t,i);let re=class extends a.Disposable{constructor(i,e,n){super(),this._localeService=i,this._commandService=e,this._sheetPermissionInterceptorBaseController=n,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(i=>{i.id===_e.id&&(this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[u.WorkbookEditablePermission],rangeTypes:[u.RangeProtectionPermissionEditPoint],worksheetTypes:[u.WorksheetEditPermission,u.WorksheetSetCellValuePermission,u.WorksheetInsertHyperlinkPermission]})||this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.hyperLinkErr")))}))}};re=en([a.OnLifecycle(a.LifecycleStages.Rendered,re),ge(0,a.Inject(a.LocaleService)),ge(1,a.ICommandService),ge(2,a.Inject(S.SheetPermissionInterceptorBaseController))],re);var Ue=Object.defineProperty,tn=Object.getOwnPropertyDescriptor,nn=(i,e,n)=>e in i?Ue(i,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[e]=n,rn=(i,e,n,t)=>{for(var r=t>1?void 0:t?tn(e,n):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(t?s(e,n,r):s(r))||r);return t&&r&&Ue(e,n,r),r},Pe=(i,e)=>(n,t)=>e(n,t,i),je=(i,e,n)=>nn(i,typeof e!="symbol"?e+"":e,n);exports.UniverSheetsHyperLinkUIPlugin=class extends a.Plugin{constructor(e,n,t){super(),this._config=e,this._injector=n,this._renderManagerService=t}onStarting(e){[[exports.SheetsHyperLinkResolverService],[exports.SheetsHyperLinkPopupService],[exports.SheetsHyperLinkRemoveSheetController],[exports.SheetsHyperLinkRenderManagerController],[exports.SheetHyperLinkSetRangeController],[exports.SheetsHyperLinkPopupController],[exports.SheetsHyperLinkUIController,{useFactory:()=>this._injector.createInstance(exports.SheetsHyperLinkUIController,this._config)}],[exports.SheetsHyperLinkAutoFillController],[exports.SheetsHyperLinkCopyPasteController],[re],[exports.SheetHyperLinkUrlController]].forEach(t=>e.add(t))}onReady(){[[exports.SheetsHyperLinkRenderController]].forEach(n=>this._renderManagerService.registerRenderModule(a.UniverInstanceType.UNIVER_SHEET,n))}};je(exports.UniverSheetsHyperLinkUIPlugin,"pluginName",Le);je(exports.UniverSheetsHyperLinkUIPlugin,"type",a.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsHyperLinkUIPlugin=rn([a.DependentOn(m.UniverSheetsHyperLinkPlugin),Pe(1,a.Inject(a.Injector)),Pe(2,ye.IRenderManagerService)],exports.UniverSheetsHyperLinkUIPlugin);exports.CloseHyperLinkSidebarOperation=Q;exports.InsertHyperLinkOperation=de;exports.InsertLinkShortcut=_e;exports.OpenHyperLinkSidebarOperation=le;
package/lib/es/index.js CHANGED
@@ -1,17 +1,17 @@
1
- var zt = Object.defineProperty;
2
- var Gt = (e, t, n) => t in e ? zt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var W = (e, t, n) => Gt(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { Disposable as O, UniverInstanceType as E, OnLifecycle as B, LifecycleStages as D, Inject as h, IUniverInstanceService as ue, BooleanNumber as qt, ThemeService as Xt, isValidRange as ze, LocaleService as pe, RANGE_TYPE as lt, Rectangle as ne, ICommandService as K, Tools as re, DEFAULT_EMPTY_DOCUMENT_VALUE as Jt, useDependency as k, createInternalEditorID as Qt, CommandType as je, CellValueType as dt, ObjectMatrix as _t, Range as Qe, CustomRangeType as en, Injector as Ne, IPermissionService as tn, Plugin as nn, DependentOn as rn } from "@univerjs/core";
5
- import { RemoveSheetCommand as on, SheetInterceptorService as et, INTERCEPTOR_POINT as sn, SetSelectionsOperation as an, SetWorksheetActiveOperation as Ee, getSheetCommandTarget as Ct, SheetsSelectionsService as yt, SetRangeValuesMutation as fe, SetRangeValuesUndoMutationFactory as ut, SetRangeValuesCommand as cn, ClearSelectionContentCommand as ln, ClearSelectionAllCommand as dn, ClearSelectionFormatCommand as un, WorkbookViewPermission as pn, WorksheetViewPermission as hn, RangeProtectionPermissionViewPoint as mn, WorkbookEditablePermission as $e, WorksheetEditPermission as Be, WorksheetInsertHyperlinkPermission as De, RangeProtectionPermissionEditPoint as Ve, WorkbookCopyPermission as gn, WorksheetCopyPermission as fn, WorksheetSetCellValuePermission as tt } from "@univerjs/sheets";
6
- import { RemoveHyperLinkMutation as T, AddHyperLinkMutation as U, HyperLinkModel as H, ERROR_RANGE as Ge, UpdateHyperLinkCommand as St, AddHyperLinkCommand as Lt, CancelHyperLinkCommand as vn, UniverSheetsHyperLinkPlugin as _n } from "@univerjs/sheets-hyper-link";
7
- import { SheetSkeletonManagerService as It, ScrollToRangeOperation as kt, SheetCanvasPopManagerService as Cn, IEditorBridgeService as yn, HoverManagerService as Sn, SheetPermissionInterceptorBaseController as Pt, whenSheetEditorFocused as Ln, getCurrentRangeDisable$ as bt, APPLY_TYPE as oe, IAutoFillService as In, virtualizeDiscreteRanges as qe, getAutoFillRepeatRange as kn, COPY_TYPE as Pn, rangeToDiscreteRange as bn, PREDEFINED_HOOK_NAME as ve, getRepeatRange as Rn, ISheetClipboardService as wn } from "@univerjs/sheets-ui";
1
+ var Gt = Object.defineProperty;
2
+ var qt = (e, t, n) => t in e ? Gt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var W = (e, t, n) => qt(e, typeof t != "symbol" ? t + "" : t, n);
4
+ import { Disposable as O, UniverInstanceType as E, OnLifecycle as B, LifecycleStages as D, Inject as h, IUniverInstanceService as ue, BooleanNumber as Xt, ThemeService as Jt, isValidRange as ze, LocaleService as pe, RANGE_TYPE as lt, Rectangle as ne, ICommandService as K, Tools as re, DEFAULT_EMPTY_DOCUMENT_VALUE as Qt, useDependency as k, createInternalEditorID as en, CommandType as je, CellValueType as dt, ObjectMatrix as _t, Range as Qe, CustomRangeType as tn, Injector as Ne, IPermissionService as nn, Plugin as rn, DependentOn as on } from "@univerjs/core";
5
+ import { RemoveSheetCommand as sn, SheetInterceptorService as et, INTERCEPTOR_POINT as an, SetSelectionsOperation as cn, SetWorksheetActiveOperation as Ee, getSheetCommandTarget as Ct, SheetsSelectionsService as yt, SetRangeValuesMutation as fe, SetRangeValuesUndoMutationFactory as ut, SetRangeValuesCommand as ln, ClearSelectionContentCommand as dn, ClearSelectionAllCommand as un, ClearSelectionFormatCommand as pn, WorkbookViewPermission as hn, WorksheetViewPermission as mn, RangeProtectionPermissionViewPoint as gn, WorkbookEditablePermission as $e, WorksheetEditPermission as Be, WorksheetInsertHyperlinkPermission as De, RangeProtectionPermissionEditPoint as Ve, WorkbookCopyPermission as fn, WorksheetCopyPermission as vn, WorksheetSetCellValuePermission as tt } from "@univerjs/sheets";
6
+ import { RemoveHyperLinkMutation as T, AddHyperLinkMutation as U, HyperLinkModel as H, ERROR_RANGE as Ge, UpdateHyperLinkCommand as St, AddHyperLinkCommand as Lt, CancelHyperLinkCommand as _n, UniverSheetsHyperLinkPlugin as Cn } from "@univerjs/sheets-hyper-link";
7
+ import { SheetSkeletonManagerService as It, ScrollToRangeOperation as kt, SheetCanvasPopManagerService as yn, IEditorBridgeService as Sn, HoverManagerService as Ln, SheetPermissionInterceptorBaseController as Pt, whenSheetEditorFocused as In, getCurrentRangeDisable$ as bt, APPLY_TYPE as oe, IAutoFillService as kn, virtualizeDiscreteRanges as qe, getAutoFillRepeatRange as Pn, COPY_TYPE as bn, rangeToDiscreteRange as Rn, PREDEFINED_HOOK_NAME as ve, getRepeatRange as wn, ISheetClipboardService as En } from "@univerjs/sheets-ui";
8
8
  import { IRenderManagerService as nt } from "@univerjs/engine-render";
9
- import { Subject as En, BehaviorSubject as On, debounceTime as Mn } from "rxjs";
10
- import xn, { forwardRef as Y, useRef as Rt, createElement as Z, useState as ee, useEffect as wt, useMemo as Tn } from "react";
9
+ import { debounceTime as Rt, Subject as On, BehaviorSubject as Mn } from "rxjs";
10
+ import xn, { forwardRef as Y, useRef as wt, createElement as Z, useState as ee, useEffect as Et, useMemo as Tn } from "react";
11
11
  import pt from "clsx";
12
12
  import { MessageType as ce, FormLayout as X, Input as ht, Select as Ke, Button as mt, Tooltip as _e } from "@univerjs/design";
13
- import { IMessageService as Et, useObservable as Un, useEvent as Hn, RangeSelector as jn, ISidebarService as Ot, KeyCode as Nn, MetaKeys as $n, MenuItemType as Mt, MenuPosition as xt, getMenuHiddenObservable as Tt, MenuGroup as Bn, ComponentManager as Dn, IShortcutService as Vn, IMenuService as An } from "@univerjs/ui";
14
- import { deserializeRangeWithSheet as Oe, serializeRangeWithSheet as Ut, IDefinedNamesService as Ht, serializeRangeToRefString as Wn, serializeRange as Fn } from "@univerjs/engine-formula";
13
+ import { IMessageService as Ot, useObservable as Un, useEvent as Hn, RangeSelector as jn, ISidebarService as Mt, KeyCode as Nn, MetaKeys as $n, MenuItemType as xt, MenuPosition as Tt, getMenuHiddenObservable as Ut, MenuGroup as Bn, ComponentManager as Dn, IShortcutService as Vn, IMenuService as An } from "@univerjs/ui";
14
+ import { deserializeRangeWithSheet as Oe, serializeRangeWithSheet as Ht, IDefinedNamesService as jt, serializeRangeToRefString as Wn, serializeRange as Fn } from "@univerjs/engine-formula";
15
15
  import { DOC_HYPER_LINK_PLUGIN as Kn } from "@univerjs/docs-hyper-link";
16
16
  import { getPlainTextFormDocument as Yn } from "@univerjs/docs";
17
17
  var Zn = Object.defineProperty, zn = Object.getOwnPropertyDescriptor, Gn = (e, t, n, r) => {
@@ -28,7 +28,7 @@ let ye = class extends O {
28
28
  this._sheetInterceptorService.interceptCommand({
29
29
  getMutations: (e) => {
30
30
  var t;
31
- if (e.id === on.id) {
31
+ if (e.id === sn.id) {
32
32
  const n = e.params, r = n.unitId ? this._univerInstanceService.getUnit(n.unitId) : this._univerInstanceService.getCurrentUnitForType(E.UNIVER_SHEET);
33
33
  if (!r)
34
34
  return { redos: [], undos: [] };
@@ -64,7 +64,7 @@ ye = Gn([
64
64
  Ye(1, ue),
65
65
  Ye(2, h(H))
66
66
  ], ye);
67
- var qn = Object.defineProperty, Xn = Object.getOwnPropertyDescriptor, jt = (e, t, n, r) => {
67
+ var qn = Object.defineProperty, Xn = Object.getOwnPropertyDescriptor, Nt = (e, t, n, r) => {
68
68
  for (var i = r > 1 ? void 0 : r ? Xn(t, n) : t, o = e.length - 1, s; o >= 0; o--)
69
69
  (s = e[o]) && (i = (r ? s(t, n, i) : s(i)) || i);
70
70
  return r && i && qn(t, n, i), i;
@@ -84,12 +84,12 @@ let Xe = class extends O {
84
84
  const i = this._sheetSkeletonManagerService.getOrCreateSkeleton({ sheetId: r }), o = this._renderManagerService.getRenderById(n);
85
85
  i == null || i.makeDirty(!0), i == null || i.calculate(), o && o.mainComponent.makeForceDirty();
86
86
  };
87
- this.disposeWithMe(this._hyperLinkModel.linkUpdate$.subscribe(() => {
87
+ this.disposeWithMe(this._hyperLinkModel.linkUpdate$.pipe(Rt(16)).subscribe(() => {
88
88
  e();
89
89
  }));
90
90
  }
91
91
  };
92
- Xe = jt([
92
+ Xe = Nt([
93
93
  te(1, h(H)),
94
94
  te(2, h(It)),
95
95
  te(3, nt)
@@ -101,7 +101,7 @@ let Se = class extends O {
101
101
  _initViewModelIntercept() {
102
102
  this.disposeWithMe(
103
103
  this._sheetInterceptorService.intercept(
104
- sn.CELL_CONTENT,
104
+ an.CELL_CONTENT,
105
105
  {
106
106
  handler: (e, t, n) => {
107
107
  const { row: r, col: i, unitId: o, subUnitId: s } = t, c = this._hyperLinkModel.getHyperLinkByLocation(o, s, r, i), a = this._themeService.getCurrentTheme();
@@ -109,7 +109,7 @@ let Se = class extends O {
109
109
  ...e,
110
110
  interceptorStyle: {
111
111
  ul: {
112
- s: qt.TRUE
112
+ s: Xt.TRUE
113
113
  },
114
114
  cl: {
115
115
  rgb: a.blue500
@@ -123,13 +123,13 @@ let Se = class extends O {
123
123
  );
124
124
  }
125
125
  };
126
- Se = jt([
126
+ Se = Nt([
127
127
  B(D.Ready, Se),
128
128
  te(0, h(et)),
129
129
  te(1, h(H)),
130
- te(2, h(Xt))
130
+ te(2, h(Jt))
131
131
  ], Se);
132
- var Nt = { exports: {} }, Ae = {};
132
+ var $t = { exports: {} }, Ae = {};
133
133
  /**
134
134
  * @license React
135
135
  * react-jsx-runtime.production.min.js
@@ -140,7 +140,7 @@ var Nt = { exports: {} }, Ae = {};
140
140
  * LICENSE file in the root directory of this source tree.
141
141
  */
142
142
  var Jn = xn, Qn = Symbol.for("react.element"), er = Symbol.for("react.fragment"), tr = Object.prototype.hasOwnProperty, nr = Jn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, rr = { key: !0, ref: !0, __self: !0, __source: !0 };
143
- function $t(e, t, n) {
143
+ function Bt(e, t, n) {
144
144
  var r, i = {}, o = null, s = null;
145
145
  n !== void 0 && (o = "" + n), t.key !== void 0 && (o = "" + t.key), t.ref !== void 0 && (s = t.ref);
146
146
  for (r in t) tr.call(t, r) && !rr.hasOwnProperty(r) && (i[r] = t[r]);
@@ -148,10 +148,10 @@ function $t(e, t, n) {
148
148
  return { $$typeof: Qn, type: e, key: o, ref: s, props: i, _owner: nr.current };
149
149
  }
150
150
  Ae.Fragment = er;
151
- Ae.jsx = $t;
152
- Ae.jsxs = $t;
153
- Nt.exports = Ae;
154
- var d = Nt.exports, b = function() {
151
+ Ae.jsx = Bt;
152
+ Ae.jsxs = Bt;
153
+ $t.exports = Ae;
154
+ var d = $t.exports, b = function() {
155
155
  return b = Object.assign || function(e) {
156
156
  for (var t, n = 1, r = arguments.length; n < r; n++) {
157
157
  t = arguments[n];
@@ -167,12 +167,12 @@ var d = Nt.exports, b = function() {
167
167
  t.indexOf(r[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[i]) && (n[r[i]] = e[r[i]]);
168
168
  return n;
169
169
  }, z = Y(function(e, t) {
170
- var n = e.icon, r = e.id, i = e.className, o = e.extend, s = ir(e, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(r, " ").concat(i || "").trim(), a = Rt("_".concat(ar()));
171
- return Bt(n, "".concat(r), { defIds: n.defIds, idSuffix: a.current }, b({ ref: t, className: c }, s), o);
170
+ var n = e.icon, r = e.id, i = e.className, o = e.extend, s = ir(e, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(r, " ").concat(i || "").trim(), a = wt("_".concat(ar()));
171
+ return Dt(n, "".concat(r), { defIds: n.defIds, idSuffix: a.current }, b({ ref: t, className: c }, s), o);
172
172
  });
173
- function Bt(e, t, n, r, i) {
173
+ function Dt(e, t, n, r, i) {
174
174
  return Z(e.tag, b(b({ key: t }, or(e, n, i)), r), (sr(e, n).children || []).map(function(o, s) {
175
- return Bt(o, "".concat(t, "-").concat(e.tag, "-").concat(s), n, void 0, i);
175
+ return Dt(o, "".concat(t, "-").concat(e.tag, "-").concat(s), n, void 0, i);
176
176
  }));
177
177
  }
178
178
  function or(e, t, n) {
@@ -202,14 +202,14 @@ var cr = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em"
202
202
  }));
203
203
  });
204
204
  Le.displayName = "AllBorderSingle";
205
- var lr = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.02547 12.4251C5.15328 13.7417 6.26305 14.7708 7.61318 14.7708H12.6132C14.0491 14.7708 15.2132 13.6067 15.2132 12.1708V6.1708C15.2132 4.78586 14.1303 3.65383 12.7651 3.57517C12.6373 2.25858 11.5275 1.22949 10.1774 1.22949H5.17739C3.74145 1.22949 2.57739 2.39355 2.57739 3.82949V9.82949C2.57739 11.2144 3.66024 12.3465 5.02547 12.4251ZM11.5535 3.5708H7.61318C6.17724 3.5708 5.01318 4.73486 5.01318 6.1708V11.22C4.31736 11.1387 3.77739 10.5471 3.77739 9.82949V3.82949C3.77739 3.05629 4.40419 2.42949 5.17739 2.42949H10.1774C10.8622 2.42949 11.4322 2.92119 11.5535 3.5708ZM14.0132 6.1708C14.0132 5.3976 13.3864 4.7708 12.6132 4.7708H7.61318C6.83998 4.7708 6.21318 5.3976 6.21318 6.1708V12.1708C6.21318 12.944 6.83998 13.5708 7.61318 13.5708H12.6132C13.3864 13.5708 14.0132 12.944 14.0132 12.1708V6.1708Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Dt = Y(function(e, t) {
205
+ var lr = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.02547 12.4251C5.15328 13.7417 6.26305 14.7708 7.61318 14.7708H12.6132C14.0491 14.7708 15.2132 13.6067 15.2132 12.1708V6.1708C15.2132 4.78586 14.1303 3.65383 12.7651 3.57517C12.6373 2.25858 11.5275 1.22949 10.1774 1.22949H5.17739C3.74145 1.22949 2.57739 2.39355 2.57739 3.82949V9.82949C2.57739 11.2144 3.66024 12.3465 5.02547 12.4251ZM11.5535 3.5708H7.61318C6.17724 3.5708 5.01318 4.73486 5.01318 6.1708V11.22C4.31736 11.1387 3.77739 10.5471 3.77739 9.82949V3.82949C3.77739 3.05629 4.40419 2.42949 5.17739 2.42949H10.1774C10.8622 2.42949 11.4322 2.92119 11.5535 3.5708ZM14.0132 6.1708C14.0132 5.3976 13.3864 4.7708 12.6132 4.7708H7.61318C6.83998 4.7708 6.21318 5.3976 6.21318 6.1708V12.1708C6.21318 12.944 6.83998 13.5708 7.61318 13.5708H12.6132C13.3864 13.5708 14.0132 12.944 14.0132 12.1708V6.1708Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Vt = Y(function(e, t) {
206
206
  return Z(z, Object.assign({}, e, {
207
207
  id: "copy-single",
208
208
  ref: t,
209
209
  icon: lr
210
210
  }));
211
211
  });
212
- Dt.displayName = "CopySingle";
212
+ Vt.displayName = "CopySingle";
213
213
  var dr = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.9564 2.91332C4.91407 1.87102 3.22413 1.87101 2.18182 2.91333L2.18182 2.91333C1.13953 3.95567 1.13952 5.6456 2.18182 6.68791L8.27777 12.7838C9.72408 14.2302 12.069 14.2302 13.5154 12.7839L13.0911 12.3596L13.5154 12.7839C14.9617 11.3375 14.9617 8.99257 13.5154 7.54626L8.39476 2.42566C8.16044 2.19134 7.78054 2.19134 7.54623 2.42566C7.31191 2.65997 7.31191 3.03987 7.54623 3.27419L12.6668 8.39479L13.0911 7.97052L12.6668 8.39479C13.6445 9.37247 13.6445 10.9576 12.6668 11.9353L13.0399 12.3084L12.6668 11.9353C11.6891 12.913 10.104 12.913 9.1263 11.9353L3.03035 5.83938C2.45668 5.26571 2.45667 4.33556 3.03036 3.76184C3.60403 3.18818 4.53416 3.18817 5.10788 3.76185C5.10788 3.76186 5.10788 3.76186 5.10789 3.76186L11.2038 9.8578L11.601 9.46061L11.2038 9.8578C11.3735 10.0275 11.3735 10.3026 11.2038 10.4723L11.2038 10.4723C11.0341 10.642 10.759 10.642 10.5893 10.4723L5.46874 5.35171C5.23442 5.1174 4.85452 5.1174 4.62021 5.35171C4.38589 5.58602 4.38589 5.96592 4.62021 6.20024L9.74078 11.3208C10.3791 11.9591 11.414 11.9591 12.0523 11.3208C12.0523 11.3208 12.0523 11.3208 12.0523 11.3208M12.0523 11.3208C12.6907 10.6825 12.6906 9.64757 12.0523 9.00927L5.95641 2.91333L5.9564 2.91332", fillRule: "evenodd", clipRule: "evenodd" } }] }, Me = Y(function(e, t) {
214
214
  return Z(z, Object.assign({}, e, {
215
215
  id: "link-single",
@@ -218,22 +218,22 @@ var dr = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em"
218
218
  }));
219
219
  });
220
220
  Me.displayName = "LinkSingle";
221
- var ur = { 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" } }] }, Vt = Y(function(e, t) {
221
+ var ur = { 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" } }] }, At = Y(function(e, t) {
222
222
  return Z(z, Object.assign({}, e, {
223
223
  id: "unlink-single",
224
224
  ref: t,
225
225
  icon: ur
226
226
  }));
227
227
  });
228
- Vt.displayName = "UnlinkSingle";
229
- var pr = { 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" } }] }, At = Y(function(e, t) {
228
+ At.displayName = "UnlinkSingle";
229
+ var pr = { 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" } }] }, Wt = Y(function(e, t) {
230
230
  return Z(z, Object.assign({}, e, {
231
231
  id: "write-single",
232
232
  ref: t,
233
233
  icon: pr
234
234
  }));
235
235
  });
236
- At.displayName = "WriteSingle";
236
+ Wt.displayName = "WriteSingle";
237
237
  var hr = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "#35BD4B", d: "M3.36396 1.12549C2.61066 1.12549 2 1.73615 2 2.48945V13.5104C2 14.2637 2.61066 14.8744 3.36396 14.8744H12.457C13.2103 14.8744 13.821 14.2637 13.821 13.5104V5.0992L9.91954 1.12549H3.36396Z" } }, { tag: "path", attrs: { fill: "#32A846", d: "M9.91797 1.12549L13.8209 5.09842H10.5846C10.2164 5.09842 9.91797 4.79994 9.91797 4.43175V1.12549Z" } }, { tag: "path", attrs: { fill: "#fff", d: "M7.71926 10.2949L6.28687 12.403C6.17306 12.5705 5.94501 12.614 5.77751 12.5002C5.61002 12.3864 5.56649 12.1584 5.6803 11.9909L7.27596 9.64252L5.85088 7.54519C5.73707 7.37769 5.78059 7.14964 5.94809 7.03583C6.11558 6.92202 6.34363 6.96555 6.45744 7.13304L7.71926 8.9901L8.98108 7.13304C9.09489 6.96555 9.32294 6.92202 9.49044 7.03583C9.65793 7.14964 9.70146 7.37769 9.58765 7.54519L8.16256 9.64252L9.75822 11.9909C9.87203 12.1584 9.82851 12.3864 9.66101 12.5002C9.49351 12.614 9.26547 12.5705 9.15166 12.403L7.71926 10.2949Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Je = Y(function(e, t) {
238
238
  return Z(z, Object.assign({}, e, {
239
239
  id: "xlsx",
@@ -270,7 +270,7 @@ let F = class {
270
270
  const a = Oe(n).range;
271
271
  return ze(a) && n !== Ge ? {
272
272
  type: "range",
273
- name: Ut(s, a)
273
+ name: Ht(s, a)
274
274
  } : {
275
275
  type: "range-error",
276
276
  name: this._localeService.t("hyperLink.message.refError")
@@ -344,7 +344,7 @@ let F = class {
344
344
  if (r) {
345
345
  const i = vr(n, r);
346
346
  await this._commandService.executeCommand(
347
- an.id,
347
+ cn.id,
348
348
  {
349
349
  unitId: e,
350
350
  subUnitId: t,
@@ -406,8 +406,8 @@ let F = class {
406
406
  F = fr([
407
407
  se(0, ue),
408
408
  se(1, K),
409
- se(2, Ht),
410
- se(3, Et),
409
+ se(2, jt),
410
+ se(3, Ot),
411
411
  se(4, h(pe))
412
412
  ], F);
413
413
  function de(e) {
@@ -434,7 +434,7 @@ function yr(e) {
434
434
  if (t == null)
435
435
  return "";
436
436
  const n = t.dataStream;
437
- return n.substring(n.length - 2, n.length) === Jt ? n.substring(0, n.length - 2) : n;
437
+ return n.substring(n.length - 2, n.length) === Qt ? n.substring(0, n.length - 2) : n;
438
438
  }
439
439
  return e == null ? void 0 : e.v;
440
440
  }
@@ -445,8 +445,8 @@ const Sr = "univer-cell-link-edit-buttons", Lr = {
445
445
  const [e, t] = ee(""), [n, r] = ee(""), [i, o] = ee(
446
446
  "link"
447
447
  /* link */
448
- ), [s, c] = ee(""), a = k(pe), u = k(Ht), g = k(ue), f = k($), l = Un(f.currentEditing$), m = k(H), _ = k(F), v = k(K), [L, M] = ee(!1), y = Rt(!1);
449
- wt(() => {
448
+ ), [s, c] = ee(""), a = k(pe), u = k(jt), g = k(ue), f = k($), l = Un(f.currentEditing$), m = k(H), _ = k(F), v = k(K), [L, M] = ee(!1), y = wt(!1);
449
+ Et(() => {
450
450
  var p, S, I;
451
451
  if ((l == null ? void 0 : l.row) !== void 0 && l.column !== void 0) {
452
452
  const C = m.getHyperLinkByLocationSync(l.unitId, l.subUnitId, l.row, l.column);
@@ -468,14 +468,14 @@ const Sr = "univer-cell-link-edit-buttons", Lr = {
468
468
  return;
469
469
  }
470
470
  if (N.range) {
471
- const Zt = N.gid && (I = (S = (p = g.getUnit(l.unitId)) == null ? void 0 : p.getSheetBySheetId(N.gid)) == null ? void 0 : S.getName()) != null ? I : "";
471
+ const zt = N.gid && (I = (S = (p = g.getUnit(l.unitId)) == null ? void 0 : p.getSheetBySheetId(N.gid)) == null ? void 0 : S.getName()) != null ? I : "";
472
472
  if (o(
473
473
  "range"
474
474
  /* range */
475
475
  ), N.range === Ge)
476
476
  c("");
477
477
  else {
478
- const ct = Ut(Zt, Oe(N.range).range);
478
+ const ct = Ht(zt, Oe(N.range).range);
479
479
  c(ct), ct === C.display && (y.current = !0);
480
480
  }
481
481
  return;
@@ -489,7 +489,7 @@ const Sr = "univer-cell-link-edit-buttons", Lr = {
489
489
  }
490
490
  }
491
491
  }
492
- const j = g.getUnit(l.unitId), w = j == null ? void 0 : j.getSheetBySheetId(l.subUnitId), Yt = w == null ? void 0 : w.getCellRaw(l.row, l.column), Fe = yr(Yt);
492
+ const j = g.getUnit(l.unitId), w = j == null ? void 0 : j.getSheetBySheetId(l.subUnitId), Zt = w == null ? void 0 : w.getCellRaw(l.row, l.column), Fe = yr(Zt);
493
493
  o(
494
494
  "link"
495
495
  /* link */
@@ -629,7 +629,7 @@ const Sr = "univer-cell-link-edit-buttons", Lr = {
629
629
  jn,
630
630
  {
631
631
  openForSheetUnitId: P.getUnitId(),
632
- id: Qt("hyper-link-edit"),
632
+ id: en("hyper-link-edit"),
633
633
  isSingleChoice: !0,
634
634
  value: V,
635
635
  onChange: We
@@ -699,7 +699,7 @@ const it = {
699
699
  handler(e, t) {
700
700
  if (!t)
701
701
  return !1;
702
- const { unitId: n, subUnitId: r, row: i, column: o } = t, s = e.get(H), c = e.get(Ot), a = e.get($), u = s.getHyperLinkByLocation(n, r, i, o);
702
+ const { unitId: n, subUnitId: r, row: i, column: o } = t, s = e.get(H), c = e.get(Mt), a = e.get($), u = s.getHyperLinkByLocation(n, r, i, o);
703
703
  return a.startEditing(t), c.open({
704
704
  header: {
705
705
  title: u ? "hyperLink.form.editTitle" : "hyperLink.form.addTitle"
@@ -713,7 +713,7 @@ const it = {
713
713
  type: je.OPERATION,
714
714
  id: "sheet.operation.close-hyper-link-sidebar",
715
715
  handler(e) {
716
- const t = e.get(Ot), n = e.get($);
716
+ const t = e.get(Mt), n = e.get($);
717
717
  return t.close(), n.endEditing(), !0;
718
718
  }
719
719
  }, ot = {
@@ -759,8 +759,8 @@ const it = {
759
759
  "range-error": /* @__PURE__ */ d.jsx(Le, {}),
760
760
  "sheet-error": /* @__PURE__ */ d.jsx(Je, {})
761
761
  }, Ue = () => {
762
- const e = k($), t = k(H), n = k(K), r = k(Et), i = k(pe), [o, s] = ee(null), c = k(F);
763
- if (wt(() => {
762
+ const e = k($), t = k(H), n = k(K), r = k(Ot), i = k(pe), [o, s] = ee(null), c = k(F);
763
+ if (Et(() => {
764
764
  s(e.currentPopup);
765
765
  const _ = e.currentPopup$.subscribe((v) => {
766
766
  s(v);
@@ -797,7 +797,7 @@ const it = {
797
797
  });
798
798
  }
799
799
  },
800
- children: /* @__PURE__ */ d.jsx(_e, { placement: "bottom", title: i.t("hyperLink.popup.copy"), children: /* @__PURE__ */ d.jsx(Dt, {}) })
800
+ children: /* @__PURE__ */ d.jsx(_e, { placement: "bottom", title: i.t("hyperLink.popup.copy"), children: /* @__PURE__ */ d.jsx(Vt, {}) })
801
801
  }
802
802
  ),
803
803
  o.editPermission && /* @__PURE__ */ d.jsxs(d.Fragment, { children: [
@@ -813,7 +813,7 @@ const it = {
813
813
  column: f.column
814
814
  });
815
815
  },
816
- children: /* @__PURE__ */ d.jsx(_e, { placement: "bottom", title: i.t("hyperLink.popup.edit"), children: /* @__PURE__ */ d.jsx(At, {}) })
816
+ children: /* @__PURE__ */ d.jsx(_e, { placement: "bottom", title: i.t("hyperLink.popup.edit"), children: /* @__PURE__ */ d.jsx(Wt, {}) })
817
817
  }
818
818
  ),
819
819
  /* @__PURE__ */ d.jsx(
@@ -821,13 +821,13 @@ const it = {
821
821
  {
822
822
  className: x.cellLinkOperation,
823
823
  onClick: () => {
824
- n.executeCommand(vn.id, {
824
+ n.executeCommand(_n.id, {
825
825
  unitId: a,
826
826
  subUnitId: u,
827
827
  id: f.id
828
828
  });
829
829
  },
830
- children: /* @__PURE__ */ d.jsx(_e, { placement: "bottom", title: i.t("hyperLink.popup.cancel"), children: /* @__PURE__ */ d.jsx(Vt, {}) })
830
+ children: /* @__PURE__ */ d.jsx(_e, { placement: "bottom", title: i.t("hyperLink.popup.cancel"), children: /* @__PURE__ */ d.jsx(At, {}) })
831
831
  }
832
832
  )
833
833
  ] })
@@ -845,9 +845,9 @@ let $ = class extends O {
845
845
  constructor(t, n) {
846
846
  super();
847
847
  W(this, "_currentPopup", null);
848
- W(this, "_currentPopup$", new En());
848
+ W(this, "_currentPopup$", new On());
849
849
  W(this, "currentPopup$", this._currentPopup$.asObservable());
850
- W(this, "_currentEditing$", new On(null));
850
+ W(this, "_currentEditing$", new Mn(null));
851
851
  W(this, "currentEditing$", this._currentEditing$.asObservable());
852
852
  this._hyperLinkModel = t, this._sheetCanvasPopManagerService = n, this.disposeWithMe(() => {
853
853
  this.hideCurrentPopup(), this.endEditing(), this._currentEditing$.complete(), this._currentPopup$.complete();
@@ -898,7 +898,7 @@ let $ = class extends O {
898
898
  };
899
899
  $ = Ur([
900
900
  gt(0, h(H)),
901
- gt(1, h(Cn))
901
+ gt(1, h(yn))
902
902
  ], $);
903
903
  var jr = Object.defineProperty, Nr = Object.getOwnPropertyDescriptor, $r = (e, t, n, r) => {
904
904
  for (var i = r > 1 ? void 0 : r ? Nr(t, n) : t, o = e.length - 1, s; o >= 0; o--)
@@ -995,7 +995,7 @@ let Ie = class extends O {
995
995
  _initSetRangeValuesCommandInterceptor() {
996
996
  this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
997
997
  getMutations: (e) => {
998
- if (e.id === cn.id) {
998
+ if (e.id === ln.id) {
999
999
  const t = e.params, { unitId: n, subUnitId: r } = t, i = [], o = [];
1000
1000
  return t.cellValue && new _t(t.cellValue).forValue((s, c, a) => {
1001
1001
  var l, m, _, v, L, M, y;
@@ -1057,7 +1057,7 @@ let Ie = class extends O {
1057
1057
  _initClearSelectionCommandInterceptor() {
1058
1058
  this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
1059
1059
  getMutations: (e) => {
1060
- if (e.id === ln.id || e.id === dn.id || e.id === un.id) {
1060
+ if (e.id === dn.id || e.id === un.id || e.id === pn.id) {
1061
1061
  const t = [], n = [], r = this._selectionManagerService.getCurrentLastSelection(), i = Ct(this._univerInstanceService);
1062
1062
  if (r && i) {
1063
1063
  const { unitId: o, subUnitId: s } = i;
@@ -1100,7 +1100,7 @@ let Ie = class extends O {
1100
1100
  handler: (e, t, n) => {
1101
1101
  var r, i, o, s, c, a;
1102
1102
  if (e != null && e.p) {
1103
- const u = (i = (r = e.p.body) == null ? void 0 : r.customRanges) == null ? void 0 : i.find((f) => f.rangeType === en.HYPERLINK), g = (o = e.p.resources) == null ? void 0 : o.find((f) => f.name === Kn);
1103
+ const u = (i = (r = e.p.body) == null ? void 0 : r.customRanges) == null ? void 0 : i.find((f) => f.rangeType === tn.HYPERLINK), g = (o = e.p.resources) == null ? void 0 : o.find((f) => f.name === Kn);
1104
1104
  if (u && g) {
1105
1105
  const f = u.rangeId, l = (a = (c = (s = JSON.parse(g.data)) == null ? void 0 : s.links) == null ? void 0 : c.find((m) => m.id === f)) == null ? void 0 : a.payload;
1106
1106
  return n({
@@ -1128,7 +1128,7 @@ Ie = $r([
1128
1128
  J(2, h(H)),
1129
1129
  J(3, h(yt)),
1130
1130
  J(4, ue),
1131
- J(5, yn)
1131
+ J(5, Sn)
1132
1132
  ], Ie);
1133
1133
  var Br = Object.defineProperty, Dr = Object.getOwnPropertyDescriptor, Vr = (e, t, n, r) => {
1134
1134
  for (var i = r > 1 ? void 0 : r ? Dr(t, n) : t, o = e.length - 1, s; o >= 0; o--)
@@ -1141,7 +1141,7 @@ let ke = class extends O {
1141
1141
  }
1142
1142
  _initHoverListener() {
1143
1143
  this.disposeWithMe(
1144
- this._hoverManagerService.currentCell$.pipe(Mn(100)).subscribe((e) => {
1144
+ this._hoverManagerService.currentCell$.pipe(Rt(200)).subscribe((e) => {
1145
1145
  var f, l;
1146
1146
  if (!e) {
1147
1147
  this._sheetsHyperLinkPopupService.hideCurrentPopup();
@@ -1152,9 +1152,9 @@ let ke = class extends O {
1152
1152
  if (t && t.overflowCache.forValue((m, _, v) => {
1153
1153
  ne.contains(v, { startColumn: n, endColumn: n, startRow: r, endRow: r }) && (i = m, o = _);
1154
1154
  }), !this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
1155
- workbookTypes: [pn],
1156
- worksheetTypes: [hn],
1157
- rangeTypes: [mn]
1155
+ workbookTypes: [hn],
1156
+ worksheetTypes: [mn],
1157
+ rangeTypes: [gn]
1158
1158
  }, [{ startRow: r, startColumn: n, endRow: r, endColumn: n }])) {
1159
1159
  this._sheetsHyperLinkPopupService.hideCurrentPopup();
1160
1160
  return;
@@ -1163,7 +1163,7 @@ let ke = class extends O {
1163
1163
  workbookTypes: [$e],
1164
1164
  worksheetTypes: [Be, De],
1165
1165
  rangeTypes: [Ve]
1166
- }, [{ startRow: r, startColumn: n, endRow: r, endColumn: n }]), a = e.location.unitId, u = e.location.subUnitId, g = this._permissionService.composePermission([new gn(a).id, new fn(a, u).id]).every((m) => m.value);
1166
+ }, [{ startRow: r, startColumn: n, endRow: r, endColumn: n }]), a = e.location.unitId, u = e.location.subUnitId, g = this._permissionService.composePermission([new fn(a).id, new vn(a, u).id]).every((m) => m.value);
1167
1167
  this._sheetsHyperLinkPopupService.showPopup({
1168
1168
  ...e.location,
1169
1169
  row: i,
@@ -1177,33 +1177,33 @@ let ke = class extends O {
1177
1177
  };
1178
1178
  ke = Vr([
1179
1179
  B(D.Rendered, ke),
1180
- ae(0, h(Sn)),
1180
+ ae(0, h(Ln)),
1181
1181
  ae(1, h($)),
1182
1182
  ae(2, h(nt)),
1183
- ae(3, h(tn)),
1183
+ ae(3, h(nn)),
1184
1184
  ae(4, h(Pt))
1185
1185
  ], ke);
1186
1186
  const Ar = (e) => ({
1187
1187
  id: ot.id,
1188
- type: Mt.BUTTON,
1189
- positions: [xt.CONTEXT_MENU],
1188
+ type: xt.BUTTON,
1189
+ positions: [Tt.CONTEXT_MENU],
1190
1190
  title: "hyperLink.menu.add",
1191
- hidden$: Tt(e, E.UNIVER_SHEET),
1191
+ hidden$: Ut(e, E.UNIVER_SHEET),
1192
1192
  icon: "LinkSingle",
1193
1193
  disabled$: bt(e, { workbookTypes: [$e], worksheetTypes: [Be, tt, De], rangeTypes: [Ve] })
1194
1194
  }), Wr = (e) => ({
1195
1195
  tooltip: "hyperLink.form.addTitle",
1196
- positions: xt.TOOLBAR_START,
1196
+ positions: Tt.TOOLBAR_START,
1197
1197
  group: Bn.TOOLBAR_OTHERS,
1198
1198
  id: st.id,
1199
- type: Mt.BUTTON,
1199
+ type: xt.BUTTON,
1200
1200
  icon: "LinkSingle",
1201
- hidden$: Tt(e, E.UNIVER_SHEET),
1201
+ hidden$: Ut(e, E.UNIVER_SHEET),
1202
1202
  disabled$: bt(e, { workbookTypes: [$e], worksheetTypes: [Be, tt, De], rangeTypes: [Ve] })
1203
- }), Wt = {
1203
+ }), Ft = {
1204
1204
  id: st.id,
1205
1205
  binding: Nn.K | $n.CTRL_COMMAND,
1206
- preconditions: Ln
1206
+ preconditions: In
1207
1207
  };
1208
1208
  var Fr = Object.defineProperty, Kr = Object.getOwnPropertyDescriptor, Yr = (e, t, n, r) => {
1209
1209
  for (var i = r > 1 ? void 0 : r ? Kr(t, n) : t, o = e.length - 1, s; o >= 0; o--)
@@ -1238,7 +1238,7 @@ let le = class extends O {
1238
1238
  this._menuService.addMenuItem(Ar(this._injector), (t = (e = this._config) == null ? void 0 : e.menu) != null ? t : {}), this._menuService.addMenuItem(Wr(this._injector), (r = (n = this._config) == null ? void 0 : n.menu) != null ? r : {});
1239
1239
  }
1240
1240
  _initShortCut() {
1241
- this._shortcutService.registerShortcut(Wt);
1241
+ this._shortcutService.registerShortcut(Ft);
1242
1242
  }
1243
1243
  };
1244
1244
  le = Yr([
@@ -1266,7 +1266,7 @@ let Pe = class extends O {
1266
1266
  const { source: o, target: s, unitId: c, subUnitId: a } = r, u = qe([o, s]), [g, f] = u.ranges, { mapFunc: l } = u, m = {
1267
1267
  row: g.startRow,
1268
1268
  col: g.startColumn
1269
- }, _ = kn(g, f), v = [], L = [];
1269
+ }, _ = Pn(g, f), v = [], L = [];
1270
1270
  return _.forEach((M) => {
1271
1271
  const y = M.repeatStartCell, V = M.relativeRange, R = {
1272
1272
  startRow: m.row,
@@ -1348,7 +1348,7 @@ let Pe = class extends O {
1348
1348
  };
1349
1349
  Pe = Gr([
1350
1350
  B(D.Ready, Pe),
1351
- ft(0, In),
1351
+ ft(0, kn),
1352
1352
  ft(1, h(H))
1353
1353
  ], Pe);
1354
1354
  var qr = Object.defineProperty, Xr = Object.getOwnPropertyDescriptor, Jr = (e, t, n, r) => {
@@ -1367,7 +1367,7 @@ let be = class extends O {
1367
1367
  id: at,
1368
1368
  onBeforeCopy: (t, n, r) => this._collect(t, n, r),
1369
1369
  onPasteCells: (t, n, r, i) => {
1370
- const { copyType: o = Pn.COPY, pasteType: s } = i, { range: c } = t || {}, { range: a, unitId: u, subUnitId: g } = n;
1370
+ const { copyType: o = bn.COPY, pasteType: s } = i, { range: c } = t || {}, { range: a, unitId: u, subUnitId: g } = n;
1371
1371
  return this._generateMutations(a, { copyType: o, pasteType: s, copyRange: c, unitId: u, subUnitId: g });
1372
1372
  },
1373
1373
  onPastePlainText: (t, n) => {
@@ -1426,7 +1426,7 @@ let be = class extends O {
1426
1426
  };
1427
1427
  const o = {
1428
1428
  get: this._injector.get.bind(this._injector)
1429
- }, s = bn(r, o, t, n);
1429
+ }, s = Rn(r, o, t, n);
1430
1430
  if (!s)
1431
1431
  return;
1432
1432
  const { rows: c, cols: a } = s;
@@ -1454,7 +1454,7 @@ let be = class extends O {
1454
1454
  ))
1455
1455
  return { redos: [], undos: [] };
1456
1456
  const { unitId: r, subUnitId: i } = this._copyInfo, o = [], s = [], { ranges: [c, a], mapFunc: u } = qe([n.copyRange, t]);
1457
- return Rn(c, a, !0).forEach(({ startRange: f }) => {
1457
+ return wn(c, a, !0).forEach(({ startRange: f }) => {
1458
1458
  var l;
1459
1459
  (l = this._copyInfo) == null || l.matrix.forValue((m, _, v) => {
1460
1460
  const L = ne.getPositionRange(
@@ -1506,7 +1506,7 @@ let be = class extends O {
1506
1506
  };
1507
1507
  be = Jr([
1508
1508
  B(D.Ready, be),
1509
- Ce(0, wn),
1509
+ Ce(0, En),
1510
1510
  Ce(1, h(H)),
1511
1511
  Ce(2, h(Ne)),
1512
1512
  Ce(3, h(F))
@@ -1541,7 +1541,7 @@ let we = class extends O {
1541
1541
  _commandExecutedListener() {
1542
1542
  this.disposeWithMe(
1543
1543
  this._commandService.beforeCommandExecuted((e) => {
1544
- e.id === Wt.id && (this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
1544
+ e.id === Ft.id && (this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
1545
1545
  workbookTypes: [$e],
1546
1546
  rangeTypes: [Ve],
1547
1547
  worksheetTypes: [Be, tt, De]
@@ -1556,12 +1556,12 @@ we = oi([
1556
1556
  Ze(1, K),
1557
1557
  Ze(2, h(Pt))
1558
1558
  ], we);
1559
- var Ft = Object.defineProperty, si = Object.getOwnPropertyDescriptor, ai = (e, t, n) => t in e ? Ft(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, ci = (e, t, n, r) => {
1559
+ var Kt = Object.defineProperty, si = Object.getOwnPropertyDescriptor, ai = (e, t, n) => t in e ? Kt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, ci = (e, t, n, r) => {
1560
1560
  for (var i = r > 1 ? void 0 : r ? si(t, n) : t, o = e.length - 1, s; o >= 0; o--)
1561
1561
  (s = e[o]) && (i = (r ? s(t, n, i) : s(i)) || i);
1562
- return r && i && Ft(t, n, i), i;
1563
- }, vt = (e, t) => (n, r) => t(n, r, e), Kt = (e, t, n) => ai(e, typeof t != "symbol" ? t + "" : t, n);
1564
- let He = class extends nn {
1562
+ return r && i && Kt(t, n, i), i;
1563
+ }, vt = (e, t) => (n, r) => t(n, r, e), Yt = (e, t, n) => ai(e, typeof t != "symbol" ? t + "" : t, n);
1564
+ let He = class extends rn {
1565
1565
  constructor(e, t, n) {
1566
1566
  super(), this._config = e, this._injector = t, this._renderManagerService = n;
1567
1567
  }
@@ -1591,17 +1591,17 @@ let He = class extends nn {
1591
1591
  ].forEach((t) => this._renderManagerService.registerRenderModule(E.UNIVER_SHEET, t));
1592
1592
  }
1593
1593
  };
1594
- Kt(He, "pluginName", at);
1595
- Kt(He, "type", E.UNIVER_SHEET);
1594
+ Yt(He, "pluginName", at);
1595
+ Yt(He, "type", E.UNIVER_SHEET);
1596
1596
  He = ci([
1597
- rn(_n),
1597
+ on(Cn),
1598
1598
  vt(1, h(Ne)),
1599
1599
  vt(2, nt)
1600
1600
  ], He);
1601
1601
  export {
1602
1602
  Te as CloseHyperLinkSidebarOperation,
1603
1603
  ot as InsertHyperLinkOperation,
1604
- Wt as InsertLinkShortcut,
1604
+ Ft as InsertLinkShortcut,
1605
1605
  it as OpenHyperLinkSidebarOperation,
1606
1606
  Ie as SheetHyperLinkSetRangeController,
1607
1607
  Re as SheetHyperLinkUrlController,
package/lib/umd/index.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(l,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/sheets-hyper-link"),require("@univerjs/sheets-ui"),require("@univerjs/engine-render"),require("rxjs"),require("react"),require("clsx"),require("@univerjs/design"),require("@univerjs/ui"),require("@univerjs/engine-formula"),require("@univerjs/docs-hyper-link"),require("@univerjs/docs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","@univerjs/sheets-hyper-link","@univerjs/sheets-ui","@univerjs/engine-render","rxjs","react","clsx","@univerjs/design","@univerjs/ui","@univerjs/engine-formula","@univerjs/docs-hyper-link","@univerjs/docs"],a):(l=typeof globalThis<"u"?globalThis:l||self,a(l.UniverSheetsHyperLinkUi={},l.UniverCore,l.UniverSheets,l.UniverSheetsHyperLink,l.UniverSheetsUi,l.UniverEngineRender,l.rxjs,l.React,l.clsx,l.UniverDesign,l.UniverUi,l.UniverEngineFormula,l.UniverDocsHyperLink,l.UniverDocs))})(this,function(l,a,h,v,f,ue,pe,C,ke,I,O,D,De,Ae){"use strict";var Gn=Object.defineProperty;var Xn=(l,a,h)=>a in l?Gn(l,a,{enumerable:!0,configurable:!0,writable:!0,value:h}):l[a]=h;var $=(l,a,h)=>Xn(l,typeof a!="symbol"?a+"":a,h);var Ve=Object.defineProperty,Be=Object.getOwnPropertyDescriptor,xe=(i,e,t,n)=>{for(var r=n>1?void 0:n?Be(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Ve(e,t,r),r},he=(i,e)=>(t,n)=>e(t,n,i);l.SheetsHyperLinkRemoveSheetController=class extends a.Disposable{constructor(e,t,n){super(),this._sheetInterceptorService=e,this._univerInstanceService=t,this._hyperLinkModel=n,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{var t;if(e.id===h.RemoveSheetCommand.id){const n=e.params,r=n.unitId?this._univerInstanceService.getUnit(n.unitId):this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!r)return{redos:[],undos:[]};const o=r.getUnitId(),s=n.subUnitId||((t=r.getActiveSheet())==null?void 0:t.getSheetId());if(!s)return{redos:[],undos:[]};const c=this._hyperLinkModel.getSubUnit(o,s),d=c.map(S=>({id:v.RemoveHyperLinkMutation.id,params:{unitId:o,subUnitId:s,id:S.id}})),p=c.map(S=>({id:v.AddHyperLinkMutation.id,params:{unitId:o,subUnitId:s,link:S}}));return{redos:d,undos:p}}return{redos:[],undos:[]}}}))}},l.SheetsHyperLinkRemoveSheetController=xe([a.OnLifecycle(a.LifecycleStages.Ready,l.SheetsHyperLinkRemoveSheetController),he(0,a.Inject(h.SheetInterceptorService)),he(1,a.IUniverInstanceService),he(2,a.Inject(v.HyperLinkModel))],l.SheetsHyperLinkRemoveSheetController);var We=Object.defineProperty,Fe=Object.getOwnPropertyDescriptor,Ie=(i,e,t,n)=>{for(var r=n>1?void 0:n?Fe(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&We(e,t,r),r},Y=(i,e)=>(t,n)=>e(t,n,i);l.SheetsHyperLinkRenderController=class extends a.Disposable{constructor(e,t,n,r){super(),this._context=e,this._hyperLinkModel=t,this._sheetSkeletonManagerService=n,this._renderManagerService=r,this._initSkeletonChange()}_initSkeletonChange(){const e=()=>{var c;const t=this._context.unit,n=t.getUnitId(),r=(c=t.getActiveSheet())==null?void 0:c.getSheetId();if(!r){console.warn("No active sheet found");return}const o=this._sheetSkeletonManagerService.getOrCreateSkeleton({sheetId:r}),s=this._renderManagerService.getRenderById(n);o==null||o.makeDirty(!0),o==null||o.calculate(),s&&s.mainComponent.makeForceDirty()};this.disposeWithMe(this._hyperLinkModel.linkUpdate$.subscribe(()=>{e()}))}},l.SheetsHyperLinkRenderController=Ie([Y(1,a.Inject(v.HyperLinkModel)),Y(2,a.Inject(f.SheetSkeletonManagerService)),Y(3,ue.IRenderManagerService)],l.SheetsHyperLinkRenderController),l.SheetsHyperLinkRenderManagerController=class extends a.Disposable{constructor(e,t,n){super(),this._sheetInterceptorService=e,this._hyperLinkModel=t,this._themeService=n,this._initViewModelIntercept()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(h.INTERCEPTOR_POINT.CELL_CONTENT,{handler:(e,t,n)=>{const{row:r,col:o,unitId:s,subUnitId:c}=t,d=this._hyperLinkModel.getHyperLinkByLocation(s,c,r,o),p=this._themeService.getCurrentTheme();return n(d?{...e,interceptorStyle:{ul:{s:a.BooleanNumber.TRUE},cl:{rgb:p.blue500}}}:e)},priority:100}))}},l.SheetsHyperLinkRenderManagerController=Ie([a.OnLifecycle(a.LifecycleStages.Ready,l.SheetsHyperLinkRenderManagerController),Y(0,a.Inject(h.SheetInterceptorService)),Y(1,a.Inject(v.HyperLinkModel)),Y(2,a.Inject(a.ThemeService))],l.SheetsHyperLinkRenderManagerController);var Re={exports:{}},ne={};/**
1
+ (function(l,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/sheets-hyper-link"),require("@univerjs/sheets-ui"),require("@univerjs/engine-render"),require("rxjs"),require("react"),require("clsx"),require("@univerjs/design"),require("@univerjs/ui"),require("@univerjs/engine-formula"),require("@univerjs/docs-hyper-link"),require("@univerjs/docs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","@univerjs/sheets-hyper-link","@univerjs/sheets-ui","@univerjs/engine-render","rxjs","react","clsx","@univerjs/design","@univerjs/ui","@univerjs/engine-formula","@univerjs/docs-hyper-link","@univerjs/docs"],a):(l=typeof globalThis<"u"?globalThis:l||self,a(l.UniverSheetsHyperLinkUi={},l.UniverCore,l.UniverSheets,l.UniverSheetsHyperLink,l.UniverSheetsUi,l.UniverEngineRender,l.rxjs,l.React,l.clsx,l.UniverDesign,l.UniverUi,l.UniverEngineFormula,l.UniverDocsHyperLink,l.UniverDocs))})(this,function(l,a,h,v,f,pe,ne,C,ke,I,O,D,De,Ae){"use strict";var Gn=Object.defineProperty;var Xn=(l,a,h)=>a in l?Gn(l,a,{enumerable:!0,configurable:!0,writable:!0,value:h}):l[a]=h;var $=(l,a,h)=>Xn(l,typeof a!="symbol"?a+"":a,h);var Ve=Object.defineProperty,Be=Object.getOwnPropertyDescriptor,xe=(i,e,t,n)=>{for(var r=n>1?void 0:n?Be(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Ve(e,t,r),r},he=(i,e)=>(t,n)=>e(t,n,i);l.SheetsHyperLinkRemoveSheetController=class extends a.Disposable{constructor(e,t,n){super(),this._sheetInterceptorService=e,this._univerInstanceService=t,this._hyperLinkModel=n,this._initSheetChange()}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{var t;if(e.id===h.RemoveSheetCommand.id){const n=e.params,r=n.unitId?this._univerInstanceService.getUnit(n.unitId):this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!r)return{redos:[],undos:[]};const o=r.getUnitId(),s=n.subUnitId||((t=r.getActiveSheet())==null?void 0:t.getSheetId());if(!s)return{redos:[],undos:[]};const c=this._hyperLinkModel.getSubUnit(o,s),d=c.map(S=>({id:v.RemoveHyperLinkMutation.id,params:{unitId:o,subUnitId:s,id:S.id}})),p=c.map(S=>({id:v.AddHyperLinkMutation.id,params:{unitId:o,subUnitId:s,link:S}}));return{redos:d,undos:p}}return{redos:[],undos:[]}}}))}},l.SheetsHyperLinkRemoveSheetController=xe([a.OnLifecycle(a.LifecycleStages.Ready,l.SheetsHyperLinkRemoveSheetController),he(0,a.Inject(h.SheetInterceptorService)),he(1,a.IUniverInstanceService),he(2,a.Inject(v.HyperLinkModel))],l.SheetsHyperLinkRemoveSheetController);var We=Object.defineProperty,Fe=Object.getOwnPropertyDescriptor,Ie=(i,e,t,n)=>{for(var r=n>1?void 0:n?Fe(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&We(e,t,r),r},Y=(i,e)=>(t,n)=>e(t,n,i);l.SheetsHyperLinkRenderController=class extends a.Disposable{constructor(e,t,n,r){super(),this._context=e,this._hyperLinkModel=t,this._sheetSkeletonManagerService=n,this._renderManagerService=r,this._initSkeletonChange()}_initSkeletonChange(){const e=()=>{var c;const t=this._context.unit,n=t.getUnitId(),r=(c=t.getActiveSheet())==null?void 0:c.getSheetId();if(!r){console.warn("No active sheet found");return}const o=this._sheetSkeletonManagerService.getOrCreateSkeleton({sheetId:r}),s=this._renderManagerService.getRenderById(n);o==null||o.makeDirty(!0),o==null||o.calculate(),s&&s.mainComponent.makeForceDirty()};this.disposeWithMe(this._hyperLinkModel.linkUpdate$.pipe(ne.debounceTime(16)).subscribe(()=>{e()}))}},l.SheetsHyperLinkRenderController=Ie([Y(1,a.Inject(v.HyperLinkModel)),Y(2,a.Inject(f.SheetSkeletonManagerService)),Y(3,pe.IRenderManagerService)],l.SheetsHyperLinkRenderController),l.SheetsHyperLinkRenderManagerController=class extends a.Disposable{constructor(e,t,n){super(),this._sheetInterceptorService=e,this._hyperLinkModel=t,this._themeService=n,this._initViewModelIntercept()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(h.INTERCEPTOR_POINT.CELL_CONTENT,{handler:(e,t,n)=>{const{row:r,col:o,unitId:s,subUnitId:c}=t,d=this._hyperLinkModel.getHyperLinkByLocation(s,c,r,o),p=this._themeService.getCurrentTheme();return n(d?{...e,interceptorStyle:{ul:{s:a.BooleanNumber.TRUE},cl:{rgb:p.blue500}}}:e)},priority:100}))}},l.SheetsHyperLinkRenderManagerController=Ie([a.OnLifecycle(a.LifecycleStages.Ready,l.SheetsHyperLinkRenderManagerController),Y(0,a.Inject(h.SheetInterceptorService)),Y(1,a.Inject(v.HyperLinkModel)),Y(2,a.Inject(a.ThemeService))],l.SheetsHyperLinkRenderManagerController);var Re={exports:{}},te={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,4 +6,4 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var $e=C,Ye=Symbol.for("react.element"),Ke=Symbol.for("react.fragment"),ze=Object.prototype.hasOwnProperty,Ze=$e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Ge={key:!0,ref:!0,__self:!0,__source:!0};function Pe(i,e,t){var n,r={},o=null,s=null;t!==void 0&&(o=""+t),e.key!==void 0&&(o=""+e.key),e.ref!==void 0&&(s=e.ref);for(n in e)ze.call(e,n)&&!Ge.hasOwnProperty(n)&&(r[n]=e[n]);if(i&&i.defaultProps)for(n in e=i.defaultProps,e)r[n]===void 0&&(r[n]=e[n]);return{$$typeof:Ye,type:i,key:o,ref:s,props:r,_owner:Ze.current}}ne.Fragment=Ke,ne.jsx=Pe,ne.jsxs=Pe,Re.exports=ne;var m=Re.exports,T=function(){return T=Object.assign||function(i){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(i[r]=e[r])}return i},T.apply(this,arguments)},Xe=function(i,e){var t={};for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&e.indexOf(n)<0&&(t[n]=i[n]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(i);r<n.length;r++)e.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(i,n[r])&&(t[n[r]]=i[n[r]]);return t},F=C.forwardRef(function(i,e){var t=i.icon,n=i.id,r=i.className,o=i.extend,s=Xe(i,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(n," ").concat(r||"").trim(),d=C.useRef("_".concat(qe()));return Ee(t,"".concat(n),{defIds:t.defIds,idSuffix:d.current},T({ref:e,className:c},s),o)});function Ee(i,e,t,n,r){return C.createElement(i.tag,T(T({key:e},Je(i,t,r)),n),(Qe(i,t).children||[]).map(function(o,s){return Ee(o,"".concat(e,"-").concat(i.tag,"-").concat(s),t,void 0,r)}))}function Je(i,e,t){var n=T({},i.attrs);t!=null&&t.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=t.colorChannel1);var r=e.defIds;return!r||r.length===0||(i.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+e.idSuffix),Object.entries(n).forEach(function(o){var s=o[0],c=o[1];typeof c=="string"&&(n[s]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),n}function Qe(i,e){var t,n=e.defIds;return!n||n.length===0?i:i.tag==="defs"&&(!((t=i.children)===null||t===void 0)&&t.length)?T(T({},i),{children:i.children.map(function(r){return typeof r.attrs.id=="string"&&n&&n.indexOf(r.attrs.id)>-1?T(T({},r),{attrs:T(T({},r.attrs),{id:r.attrs.id+e.idSuffix})}):r})}):i}function qe(){return Math.random().toString(36).substring(2,8)}F.displayName="UniverIcon";var en={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(i,e){return C.createElement(F,Object.assign({},i,{id:"all-border-single",ref:e,icon:en}))});te.displayName="AllBorderSingle";var nn={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.02547 12.4251C5.15328 13.7417 6.26305 14.7708 7.61318 14.7708H12.6132C14.0491 14.7708 15.2132 13.6067 15.2132 12.1708V6.1708C15.2132 4.78586 14.1303 3.65383 12.7651 3.57517C12.6373 2.25858 11.5275 1.22949 10.1774 1.22949H5.17739C3.74145 1.22949 2.57739 2.39355 2.57739 3.82949V9.82949C2.57739 11.2144 3.66024 12.3465 5.02547 12.4251ZM11.5535 3.5708H7.61318C6.17724 3.5708 5.01318 4.73486 5.01318 6.1708V11.22C4.31736 11.1387 3.77739 10.5471 3.77739 9.82949V3.82949C3.77739 3.05629 4.40419 2.42949 5.17739 2.42949H10.1774C10.8622 2.42949 11.4322 2.92119 11.5535 3.5708ZM14.0132 6.1708C14.0132 5.3976 13.3864 4.7708 12.6132 4.7708H7.61318C6.83998 4.7708 6.21318 5.3976 6.21318 6.1708V12.1708C6.21318 12.944 6.83998 13.5708 7.61318 13.5708H12.6132C13.3864 13.5708 14.0132 12.944 14.0132 12.1708V6.1708Z",fillRule:"evenodd",clipRule:"evenodd"}}]},be=C.forwardRef(function(i,e){return C.createElement(F,Object.assign({},i,{id:"copy-single",ref:e,icon:nn}))});be.displayName="CopySingle";var tn={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.9564 2.91332C4.91407 1.87102 3.22413 1.87101 2.18182 2.91333L2.18182 2.91333C1.13953 3.95567 1.13952 5.6456 2.18182 6.68791L8.27777 12.7838C9.72408 14.2302 12.069 14.2302 13.5154 12.7839L13.0911 12.3596L13.5154 12.7839C14.9617 11.3375 14.9617 8.99257 13.5154 7.54626L8.39476 2.42566C8.16044 2.19134 7.78054 2.19134 7.54623 2.42566C7.31191 2.65997 7.31191 3.03987 7.54623 3.27419L12.6668 8.39479L13.0911 7.97052L12.6668 8.39479C13.6445 9.37247 13.6445 10.9576 12.6668 11.9353L13.0399 12.3084L12.6668 11.9353C11.6891 12.913 10.104 12.913 9.1263 11.9353L3.03035 5.83938C2.45668 5.26571 2.45667 4.33556 3.03036 3.76184C3.60403 3.18818 4.53416 3.18817 5.10788 3.76185C5.10788 3.76186 5.10788 3.76186 5.10789 3.76186L11.2038 9.8578L11.601 9.46061L11.2038 9.8578C11.3735 10.0275 11.3735 10.3026 11.2038 10.4723L11.2038 10.4723C11.0341 10.642 10.759 10.642 10.5893 10.4723L5.46874 5.35171C5.23442 5.1174 4.85452 5.1174 4.62021 5.35171C4.38589 5.58602 4.38589 5.96592 4.62021 6.20024L9.74078 11.3208C10.3791 11.9591 11.414 11.9591 12.0523 11.3208C12.0523 11.3208 12.0523 11.3208 12.0523 11.3208M12.0523 11.3208C12.6907 10.6825 12.6906 9.64757 12.0523 9.00927L5.95641 2.91333L5.9564 2.91332",fillRule:"evenodd",clipRule:"evenodd"}}]},re=C.forwardRef(function(i,e){return C.createElement(F,Object.assign({},i,{id:"link-single",ref:e,icon:tn}))});re.displayName="LinkSingle";var rn={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"}}]},Oe=C.forwardRef(function(i,e){return C.createElement(F,Object.assign({},i,{id:"unlink-single",ref:e,icon:rn}))});Oe.displayName="UnlinkSingle";var on={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"}}]},Me=C.forwardRef(function(i,e){return C.createElement(F,Object.assign({},i,{id:"write-single",ref:e,icon:on}))});Me.displayName="WriteSingle";var sn={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"#35BD4B",d:"M3.36396 1.12549C2.61066 1.12549 2 1.73615 2 2.48945V13.5104C2 14.2637 2.61066 14.8744 3.36396 14.8744H12.457C13.2103 14.8744 13.821 14.2637 13.821 13.5104V5.0992L9.91954 1.12549H3.36396Z"}},{tag:"path",attrs:{fill:"#32A846",d:"M9.91797 1.12549L13.8209 5.09842H10.5846C10.2164 5.09842 9.91797 4.79994 9.91797 4.43175V1.12549Z"}},{tag:"path",attrs:{fill:"#fff",d:"M7.71926 10.2949L6.28687 12.403C6.17306 12.5705 5.94501 12.614 5.77751 12.5002C5.61002 12.3864 5.56649 12.1584 5.6803 11.9909L7.27596 9.64252L5.85088 7.54519C5.73707 7.37769 5.78059 7.14964 5.94809 7.03583C6.11558 6.92202 6.34363 6.96555 6.45744 7.13304L7.71926 8.9901L8.98108 7.13304C9.09489 6.96555 9.32294 6.92202 9.49044 7.03583C9.65793 7.14964 9.70146 7.37769 9.58765 7.54519L8.16256 9.64252L9.75822 11.9909C9.87203 12.1584 9.82851 12.3864 9.66101 12.5002C9.49351 12.614 9.26547 12.5705 9.15166 12.403L7.71926 10.2949Z",fillRule:"evenodd",clipRule:"evenodd"}}]},me=C.forwardRef(function(i,e){return C.createElement(F,Object.assign({},i,{id:"xlsx",ref:e,icon:sn}))});me.displayName="Xlsx";var an=Object.defineProperty,ln=Object.getOwnPropertyDescriptor,cn=(i,e,t,n)=>{for(var r=n>1?void 0:n?ln(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&an(e,t,r),r},G=(i,e)=>(t,n)=>e(t,n,i);function dn(i,e){const t=e.getMergeData(),n=e.getMaxColumns()-1,r=e.getMaxRows()-1;if(n<i.endColumn&&(i.endColumn=n),r<i.endRow&&(i.endRow=r),i.rangeType===a.RANGE_TYPE.COLUMN||a.RANGE_TYPE.ROW)return i;const o=[];return t.forEach(s=>{a.Rectangle.intersects(i,s)&&o.push(s)}),a.Rectangle.realUnion(i,...o)}l.SheetsHyperLinkResolverService=class{constructor(e,t,n,r,o){this._univerInstanceService=e,this._commandService=t,this._definedNamesService=n,this._messageService=r,this._localeService=o}_getURLName(e){var d;const{gid:t,range:n,rangeid:r}=e,o=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!o)return null;const s=t?o.getSheetBySheetId(t):o.getActiveSheet(),c=(d=s==null?void 0:s.getName())!=null?d:"";if(n){const p=D.deserializeRangeWithSheet(n).range;return a.isValidRange(p)&&n!==v.ERROR_RANGE?{type:"range",name:D.serializeRangeWithSheet(c,p)}:{type:"range-error",name:this._localeService.t("hyperLink.message.refError")}}if(r){const p=this._definedNamesService.getValueById(o.getUnitId(),r);return p?{type:"defineName",name:p.formulaOrRefString}:{type:"range-error",name:this._localeService.t("hyperLink.message.refError")}}if(t){const p=o.getSheetBySheetId(t);return p?{type:"sheet",name:p.getName()}:{type:"sheet-error",name:this._localeService.t("hyperLink.message.refError")}}return null}navigateTo(e){const{gid:t,range:n,rangeid:r}=e,o=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!o)return;const s=o.getUnitId();if(r&&this.navigateToDefineName(s,r),!!t){if(n){const c=D.deserializeRangeWithSheet(n);a.isValidRange(c.range)&&n!==v.ERROR_RANGE&&this.navigateToRange(s,t,c.range);return}this.navigateToSheetById(s,t)}}parseHyperLink(e){var t,n,r;if(e!=null&&e.startsWith("#")){const o=new URLSearchParams(e.slice(1)),s={gid:(t=o.get("gid"))!=null?t:"",range:(n=o.get("range"))!=null?n:"",rangeid:(r=o.get("rangeid"))!=null?r:""},c=this._getURLName(s);return{type:(c==null?void 0:c.type)||"link",name:(c==null?void 0:c.name)||e,url:e,searchObj:s,handler:()=>{this.navigateTo(s)}}}else return{type:"outer",name:e,url:e,handler:()=>{this.navigateToOtherWebsite(e)}}}async navigateToRange(e,t,n){const r=await this.navigateToSheetById(e,t);if(r){const o=dn(n,r);await this._commandService.executeCommand(h.SetSelectionsOperation.id,{unitId:e,subUnitId:t,selections:[{range:o}]}),await this._commandService.executeCommand(f.ScrollToRangeOperation.id,{range:o})}}async navigateToSheet(e,t){const n=this._univerInstanceService.getUnit(e,a.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();if((r==null?void 0:r.getName())===t)return!0;const o=n.getSheetBySheetName(t);if(!o){this._messageService.show({content:this._localeService.t("hyperLink.message.noSheet"),type:I.MessageType.Error});return}const s=o.getSheetId();return n.getHiddenWorksheets().indexOf(s)>-1&&this._messageService.show({content:this._localeService.t("hyperLink.message.hiddenSheet"),type:I.MessageType.Error}),await this._commandService.executeCommand(h.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:s})}async navigateToSheetById(e,t){const n=this._univerInstanceService.getUnit(e,a.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();if(!r)return!1;if(r.getSheetId()===t)return r;const o=n.getSheetBySheetId(t);return o?n.getHiddenWorksheets().indexOf(t)>-1?(this._messageService.show({content:this._localeService.t("hyperLink.message.hiddenSheet"),type:I.MessageType.Error}),!1):await this._commandService.executeCommand(h.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:t})?o:!1:(this._messageService.show({content:this._localeService.t("hyperLink.message.noSheet"),type:I.MessageType.Error}),!1)}async navigateToDefineName(e,t){return this._definedNamesService.focusRange(e,t),!0}async navigateToOtherWebsite(e){window.open(e,"_blank","noopener noreferrer")}},l.SheetsHyperLinkResolverService=cn([G(0,a.IUniverInstanceService),G(1,a.ICommandService),G(2,D.IDefinedNamesService),G(3,O.IMessageService),G(4,a.Inject(a.LocaleService))],l.SheetsHyperLinkResolverService);function X(i){return a.Tools.isLegalUrl(i)}function un(i){return/^[a-zA-Z]+:\/\//.test(i)}function pn(i){return/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(i)}function ve(i){if(X(i)){const e=un(i)?i:pn(i)?`mailto://${i}`:`http://${i}`,t=new URL(e);return t.hostname===location.hostname&&t.port===location.port&&t.protocol===location.protocol&&t.pathname===location.pathname&&t.hash&&!t.search?t.hash:e}return i}function hn(i){if(i===null)return"";if(i!=null&&i.p){const e=i==null?void 0:i.p.body;if(e==null)return"";const t=e.dataStream;return t.substring(t.length-2,t.length)===a.DEFAULT_EMPTY_DOCUMENT_VALUE?t.substring(0,t.length-2):t}return i==null?void 0:i.v}const mn={cellLinkEditButtons:"univer-cell-link-edit-buttons"},ie=()=>{var ee;const[i,e]=C.useState(""),[t,n]=C.useState(""),[r,o]=C.useState("link"),[s,c]=C.useState(""),d=a.useDependency(a.LocaleService),p=a.useDependency(D.IDefinedNamesService),S=a.useDependency(a.IUniverInstanceService),_=a.useDependency(l.SheetsHyperLinkPopupService),u=O.useObservable(_.currentEditing$),k=a.useDependency(v.HyperLinkModel),y=a.useDependency(l.SheetsHyperLinkResolverService),L=a.useDependency(a.ICommandService),[R,H]=C.useState(!1),b=C.useRef(!1);C.useEffect(()=>{var g,P,w;if((u==null?void 0:u.row)!==void 0&&u.column!==void 0){const E=k.getHyperLinkByLocationSync(u.unitId,u.subUnitId,u.row,u.column);if(E){const de=y.parseHyperLink(E.payload);if(e(E.id),n(E.display),de.type==="outer"){o("link"),c(de.url),de.url===E.display&&(b.current=!0);return}else{const V=de.searchObj;if(V.rangeid){o("rangeid"),c(V.rangeid);return}if(V.range){const Zn=V.gid&&(w=(P=(g=S.getUnit(u.unitId))==null?void 0:g.getSheetBySheetId(V.gid))==null?void 0:P.getName())!=null?w:"";if(o("range"),V.range===v.ERROR_RANGE)c("");else{const Ne=D.serializeRangeWithSheet(Zn,D.deserializeRangeWithSheet(V.range).range);c(Ne),Ne===E.display&&(b.current=!0)}return}if(V.gid){o("gid"),c(V.gid);return}}}const j=S.getUnit(u.unitId),N=j==null?void 0:j.getSheetBySheetId(u.subUnitId),zn=N==null?void 0:N.getCellRaw(u.row,u.column),Le=hn(zn);o("link"),c(""),n((Le!=null?Le:"").toString()),e("");return}o("link"),c(""),n(""),e("")},[u,k,y,S]);const U=C.useMemo(()=>s,[r]),B=[{label:d.t("hyperLink.form.link"),value:"link"},{label:d.t("hyperLink.form.range"),value:"range"},{label:d.t("hyperLink.form.worksheet"),value:"gid"},{label:d.t("hyperLink.form.definedName"),value:"rangeid"}],M=S.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!M)return;const Z=M.getHiddenWorksheets(),x=M.getSheets().map(g=>({label:g.getName(),value:g.getSheetId()})).filter(g=>Z.indexOf(g.value)===-1),W=Object.values((ee=p.getDefinedNameMap(M.getUnitId()))!=null?ee:{}).map(g=>({label:g.name,value:g.id})),q=(g,P)=>{if(g==="link")return ve(P);if(g==="range"){const w=D.deserializeRangeWithSheet(P),E=M.getSheetBySheetName(w.sheetName);if(E)return`#gid=${E.getSheetId()}&range=${D.serializeRange(w.range)}`}return`#${g}=${P}`},_e=O.useEvent(g=>{var E;const P=g[0];if(!P||!a.isValidRange(P.range))return;P.sheetName||(P.sheetName=((E=M.getActiveSheet())==null?void 0:E.getName())||"");const w=D.serializeRangeToRefString(P);c(w),w&&(b.current||!t)&&(n(w),b.current=!0)}),Ce=async()=>{if(u&&(i?await L.executeCommand(v.UpdateHyperLinkCommand.id,{unitId:u.unitId,subUnitId:u.subUnitId,id:i,payload:{display:t,payload:q(r,s)}}):await L.executeCommand(v.AddHyperLinkCommand.id,{unitId:u.unitId,subUnitId:u.subUnitId,link:{id:a.Tools.generateRandomId(),row:u.row,column:u.column,payload:q(r,s),display:t}})),u){await L.executeCommand(h.SetWorksheetActiveOperation.id,{unitId:u.unitId,subUnitId:u.subUnitId});const g=1;await L.executeCommand(f.ScrollToRangeOperation.id,{range:{startRow:Math.max(u.row-g,0),endRow:u.row+g,startColumn:Math.max(u.column-g,0),endColumn:u.column+g}})}L.executeCommand(J.id)};return m.jsxs("div",{children:[m.jsx(I.FormLayout,{label:d.t("hyperLink.form.label"),error:R&&!t?d.t("hyperLink.form.inputError"):"",children:m.jsx(I.Input,{value:t,onChange:g=>{n(g),b.current=!1},placeholder:d.t("hyperLink.form.labelPlaceholder")})}),m.jsx(I.FormLayout,{label:d.t("hyperLink.form.type"),children:m.jsx(I.Select,{options:B,value:r,onChange:g=>{o(g),c("")}})}),r==="link"&&m.jsx(I.FormLayout,{error:R?s?X(s)?"":d.t("hyperLink.form.linkError"):d.t("hyperLink.form.inputError"):"",children:m.jsx(I.Input,{value:s,onChange:g=>{c(g),g&&(b.current||!t||t===s)&&(n(g),b.current=!0)},placeholder:d.t("hyperLink.form.linkPlaceholder")})}),r==="range"&&m.jsx(I.FormLayout,{error:R&&!s?d.t("hyperLink.form.inputError"):"",children:m.jsx(O.RangeSelector,{openForSheetUnitId:M.getUnitId(),id:a.createInternalEditorID("hyper-link-edit"),isSingleChoice:!0,value:U,onChange:_e})}),r==="gid"&&m.jsx(I.FormLayout,{error:R&&!s?d.t("hyperLink.form.selectError"):"",children:m.jsx(I.Select,{options:x,value:s,onChange:g=>{var E,j;c(g);const P=(E=x.find(N=>N.value===g))==null?void 0:E.label,w=(j=x.find(N=>N.value===s))==null?void 0:j.label;P&&(b.current||!t||t===w)&&(n(P),b.current=!0)}})}),r==="rangeid"&&m.jsx(I.FormLayout,{error:R&&!s?d.t("hyperLink.form.selectError"):"",children:m.jsx(I.Select,{options:W,value:s,onChange:g=>{var E,j;c(g);const P=(E=W.find(N=>N.value===g))==null?void 0:E.label,w=(j=W.find(N=>N.value===s))==null?void 0:j.label;P&&(b.current||!t||t===w)&&(n(P),b.current=!0)}})}),m.jsxs("div",{className:mn.cellLinkEditButtons,children:[m.jsx(I.Button,{onClick:()=>{u&&L.executeCommand(h.SetWorksheetActiveOperation.id,{unitId:u.unitId,subUnitId:u.subUnitId}),L.executeCommand(J.id)},children:d.t("hyperLink.form.cancel")}),m.jsx(I.Button,{type:"primary",style:{marginLeft:8},onClick:async()=>{if(!t||!s||r==="link"&&!X(s)){H(!0);return}Ce()},children:d.t("hyperLink.form.ok")})]})]})};ie.componentKey="univer.sheet.cell-link-edit";const oe={type:a.CommandType.OPERATION,id:"sheet.operation.open-hyper-link-sidebar",handler(i,e){if(!e)return!1;const{unitId:t,subUnitId:n,row:r,column:o}=e,s=i.get(v.HyperLinkModel),c=i.get(O.ISidebarService),d=i.get(l.SheetsHyperLinkPopupService),p=s.getHyperLinkByLocation(t,n,r,o);return d.startEditing(e),c.open({header:{title:p?"hyperLink.form.editTitle":"hyperLink.form.addTitle"},children:{label:ie.componentKey}}),!0}},J={type:a.CommandType.OPERATION,id:"sheet.operation.close-hyper-link-sidebar",handler(i){const e=i.get(O.ISidebarService),t=i.get(l.SheetsHyperLinkPopupService);return e.close(),t.endEditing(),!0}},se={type:a.CommandType.OPERATION,id:"sheet.operation.insert-hyper-link",handler(i){const e=i.get(a.IUniverInstanceService),t=h.getSheetCommandTarget(e);if(!t)return!1;const n=i.get(a.ICommandService),o=i.get(h.SheetsSelectionsService).getCurrentLastSelection();if(!o)return!1;const s=o.primary.startRow,c=o.primary.startColumn;return n.executeCommand(oe.id,{unitId:t.unitId,subUnitId:t.subUnitId,row:s,column:c})}},ge={type:a.CommandType.OPERATION,id:"sheet.operation.insert-hyper-link-toolbar",handler(i){const e=i.get(a.ICommandService);return i.get(l.SheetsHyperLinkPopupService).currentEditing?e.executeCommand(J.id):e.executeCommand(se.id)}},A={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"},vn={outer:m.jsx(re,{}),link:m.jsx(re,{}),sheet:m.jsx(me,{}),range:m.jsx(te,{}),defineName:m.jsx(te,{}),"range-error":m.jsx(te,{}),"sheet-error":m.jsx(me,{})},ae=()=>{const i=a.useDependency(l.SheetsHyperLinkPopupService),e=a.useDependency(v.HyperLinkModel),t=a.useDependency(a.ICommandService),n=a.useDependency(O.IMessageService),r=a.useDependency(a.LocaleService),[o,s]=C.useState(null),c=a.useDependency(l.SheetsHyperLinkResolverService);if(C.useEffect(()=>{s(i.currentPopup);const y=i.currentPopup$.subscribe(L=>{s(L)});return()=>{y.unsubscribe()}},[i.currentPopup,i.currentPopup$]),!o)return null;const{unitId:d,subUnitId:p,id:S}=o,_=e.getHyperLink(d,p,S);if(!_)return null;const u=c.parseHyperLink(_.payload),k=u.type.indexOf("error")>-1;return m.jsxs("div",{className:A.cellLink,onClick:()=>i.hideCurrentPopup(),children:[m.jsxs("div",{className:ke(A.cellLinkContent,{[A.cellLinkContentError]:k}),onClick:u.handler,children:[m.jsx("div",{className:A.cellLinkType,children:vn[u.type]}),m.jsx(I.Tooltip,{showIfEllipsis:!0,title:u.name,children:m.jsx("span",{className:A.cellLinkUrl,children:u.name})})]}),m.jsxs("div",{className:A.cellLinkOperations,children:[o.copyPermission&&m.jsx("div",{className:ke(A.cellLinkOperation,{[A.cellLinkOperationError]:k}),onClick:()=>{if(!k){if(u.type!=="outer"){const y=new URL(window.location.href);y.hash=u.url.slice(1),navigator.clipboard.writeText(y.href)}else navigator.clipboard.writeText(u.url);n.show({content:r.t("hyperLink.message.coped"),type:I.MessageType.Info})}},children:m.jsx(I.Tooltip,{placement:"bottom",title:r.t("hyperLink.popup.copy"),children:m.jsx(be,{})})}),o.editPermission&&m.jsxs(m.Fragment,{children:[m.jsx("div",{className:A.cellLinkOperation,onClick:()=>{t.executeCommand(oe.id,{unitId:d,subUnitId:p,row:_.row,column:_.column})},children:m.jsx(I.Tooltip,{placement:"bottom",title:r.t("hyperLink.popup.edit"),children:m.jsx(Me,{})})}),m.jsx("div",{className:A.cellLinkOperation,onClick:()=>{t.executeCommand(v.CancelHyperLinkCommand.id,{unitId:d,subUnitId:p,id:_.id})},children:m.jsx(I.Tooltip,{placement:"bottom",title:r.t("hyperLink.popup.cancel"),children:m.jsx(Oe,{})})})]})]})]})};ae.componentKey="univer.sheet.cell-link-popup";var gn=Object.defineProperty,Sn=Object.getOwnPropertyDescriptor,yn=(i,e,t,n)=>{for(var r=n>1?void 0:n?Sn(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&gn(e,t,r),r},we=(i,e)=>(t,n)=>e(t,n,i);const fn=(i,e)=>i.unitId===e.unitId&&i.subUnitId===e.subUnitId&&i.row===e.row&&i.col===e.col;l.SheetsHyperLinkPopupService=class extends a.Disposable{constructor(t,n){super();$(this,"_currentPopup",null);$(this,"_currentPopup$",new pe.Subject);$(this,"currentPopup$",this._currentPopup$.asObservable());$(this,"_currentEditing$",new pe.BehaviorSubject(null));$(this,"currentEditing$",this._currentEditing$.asObservable());this._hyperLinkModel=t,this._sheetCanvasPopManagerService=n,this.disposeWithMe(()=>{this.hideCurrentPopup(),this.endEditing(),this._currentEditing$.complete(),this._currentPopup$.complete()})}get currentPopup(){return this._currentPopup}get currentEditing(){return this._currentEditing$.getValue()}showPopup(t){if(this._currentPopup&&fn(t,this._currentPopup))return;this.hideCurrentPopup();const{unitId:n,subUnitId:r,row:o,col:s}=t,c=this._hyperLinkModel.getHyperLinkByLocation(n,r,o,s);if(!c)return;const d=this._sheetCanvasPopManagerService.attachPopupToCell(o,s,{componentKey:ae.componentKey,direction:"bottom",closeOnSelfTarget:!0,onClickOutside:()=>{this.hideCurrentPopup()}});d&&(this._currentPopup={unitId:n,subUnitId:r,id:c.id,disposable:d,row:o,col:s,editPermission:!!t.editPermission,copyPermission:!!t.copyPermission},this._currentPopup$.next(this._currentPopup))}hideCurrentPopup(){var t;this._currentPopup&&((t=this._currentPopup.disposable)==null||t.dispose(),this._currentPopup=null,this._currentPopup$.next(null))}startEditing(t){this._currentEditing$.next(t)}endEditing(){this._currentEditing$.next(null)}},l.SheetsHyperLinkPopupService=yn([we(0,a.Inject(v.HyperLinkModel)),we(1,a.Inject(f.SheetCanvasPopManagerService))],l.SheetsHyperLinkPopupService);var _n=Object.defineProperty,Cn=Object.getOwnPropertyDescriptor,Ln=(i,e,t,n)=>{for(var r=n>1?void 0:n?Cn(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&_n(e,t,r),r},K=(i,e)=>(t,n)=>e(t,n,i);l.SheetHyperLinkSetRangeController=class extends a.Disposable{constructor(e,t,n,r,o,s){super(),this._sheetInterceptorService=e,this._injector=t,this._hyperLinkModel=n,this._selectionManagerService=r,this._univerInstanceService=o,this._editorBridgeService=s,this._initCommandInterceptor()}_initCommandInterceptor(){this._initAddHyperLinkCommandInterceptor(),this._initSetRangeValuesCommandInterceptor(),this._initUpdateHyperLinkCommandInterceptor(),this._initClearSelectionCommandInterceptor(),this._initRichTextEditorInterceptor()}_getCurrentCell(e,t,n,r){var o,s;return(s=(o=this._univerInstanceService.getUnit(e,a.UniverInstanceType.UNIVER_SHEET))==null?void 0:o.getSheetBySheetId(t))==null?void 0:s.getCell(n,r)}_initAddHyperLinkCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{var t;if(e.id===v.AddHyperLinkCommand.id){const n=e.params,{unitId:r,subUnitId:o,link:s}=n,c=this._getCurrentCell(r,o,s.row,s.column),d={unitId:r,subUnitId:o,cellValue:{[s.row]:{[s.column]:{v:s.display,p:null,t:(t=c==null?void 0:c.t)!=null?t:void 0}}}};return{redos:[{id:h.SetRangeValuesMutation.id,params:d}],undos:[{id:h.SetRangeValuesMutation.id,params:h.SetRangeValuesUndoMutationFactory(this._injector,d)}]}}return{redos:[],undos:[]}}}))}_initUpdateHyperLinkCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{if(e.id===v.UpdateHyperLinkCommand.id){const t=e.params,{unitId:n,subUnitId:r,id:o,payload:s}=t,c=this._hyperLinkModel.getHyperLink(n,r,o);if(c&&c.display!==s.display){const d={unitId:n,subUnitId:r,cellValue:{[c.row]:{[c.column]:{v:s.display,t:a.CellValueType.STRING,p:null}}}};return{redos:[{id:h.SetRangeValuesMutation.id,params:d}],undos:[{id:h.SetRangeValuesMutation.id,params:h.SetRangeValuesUndoMutationFactory(this._injector,d)}]}}}return{redos:[],undos:[]}}}))}_initSetRangeValuesCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{if(e.id===h.SetRangeValuesCommand.id){const t=e.params,{unitId:n,subUnitId:r}=t,o=[],s=[];return t.cellValue&&new a.ObjectMatrix(t.cellValue).forValue((c,d,p)=>{var k,y,L,R,H,b,U;const S=(L=p==null?void 0:p.v)!=null?L:(y=(k=p==null?void 0:p.p)==null?void 0:k.body)==null?void 0:y.dataStream.slice(0,-2),_=(S!=null?S:"").toString(),u=this._hyperLinkModel.getHyperLinkByLocation(n,r,c,d);if(!u){if(X(_)||(R=p==null?void 0:p.custom)!=null&&R.__link_url){const B=(b=(H=p==null?void 0:p.custom)==null?void 0:H.__link_url)!=null?b:_,M=a.Tools.generateRandomId();s.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:n,subUnitId:r,id:M}}),o.push({id:v.AddHyperLinkMutation.id,params:{unitId:n,subUnitId:r,link:{id:M,row:c,column:d,display:_,payload:ve(B)}}})}return}(S===""||((U=p==null?void 0:p.custom)==null?void 0:U.__link_url)==="")&&(o.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:n,subUnitId:r,id:u.id}}),s.push({id:v.AddHyperLinkMutation.id,params:{unitId:n,subUnitId:r,link:u}}))}),{undos:s,redos:o}}return{redos:[],undos:[]}}}))}_initClearSelectionCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{if(e.id===h.ClearSelectionContentCommand.id||e.id===h.ClearSelectionAllCommand.id||e.id===h.ClearSelectionFormatCommand.id){const t=[],n=[],r=this._selectionManagerService.getCurrentLastSelection(),o=h.getSheetCommandTarget(this._univerInstanceService);if(r&&o){const{unitId:s,subUnitId:c}=o;a.Range.foreach(r.range,(d,p)=>{const S=this._hyperLinkModel.getHyperLinkByLocation(s,c,d,p);S&&(t.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:s,subUnitId:c,id:S.id}}),n.push({id:v.AddHyperLinkMutation.id,params:{unitId:s,subUnitId:c,link:S}}))})}return{redos:t,undos:n}}return{redos:[],undos:[]}}}))}_initRichTextEditorInterceptor(){this.disposeWithMe(this._editorBridgeService.interceptor.intercept(this._editorBridgeService.interceptor.getInterceptPoints().AFTER_CELL_EDIT,{handler:(e,t,n)=>{var r,o,s,c,d,p;if(e!=null&&e.p){const S=(o=(r=e.p.body)==null?void 0:r.customRanges)==null?void 0:o.find(u=>u.rangeType===a.CustomRangeType.HYPERLINK),_=(s=e.p.resources)==null?void 0:s.find(u=>u.name===De.DOC_HYPER_LINK_PLUGIN);if(S&&_){const u=S.rangeId,k=(p=(d=(c=JSON.parse(_.data))==null?void 0:c.links)==null?void 0:d.find(y=>y.id===u))==null?void 0:p.payload;return n({...e,p:null,v:Ae.getPlainTextFormDocument(e.p),t:a.CellValueType.STRING,custom:{__link_url:k}})}}return n(e)}}))}},l.SheetHyperLinkSetRangeController=Ln([a.OnLifecycle(a.LifecycleStages.Starting,l.SheetHyperLinkSetRangeController),K(0,a.Inject(h.SheetInterceptorService)),K(1,a.Inject(a.Injector)),K(2,a.Inject(v.HyperLinkModel)),K(3,a.Inject(h.SheetsSelectionsService)),K(4,a.IUniverInstanceService),K(5,f.IEditorBridgeService)],l.SheetHyperLinkSetRangeController);var kn=Object.defineProperty,In=Object.getOwnPropertyDescriptor,Rn=(i,e,t,n)=>{for(var r=n>1?void 0:n?In(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&kn(e,t,r),r},Q=(i,e)=>(t,n)=>e(t,n,i);l.SheetsHyperLinkPopupController=class extends a.Disposable{constructor(e,t,n,r,o){super(),this._hoverManagerService=e,this._sheetsHyperLinkPopupService=t,this._renderManagerService=n,this._permissionService=r,this._sheetPermissionInterceptorBaseController=o,this._initHoverListener()}_initHoverListener(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(pe.debounceTime(100)).subscribe(e=>{var u,k;if(!e){this._sheetsHyperLinkPopupService.hideCurrentPopup();return}const t=(k=(u=this._renderManagerService.getRenderById(e.location.unitId))==null?void 0:u.with(f.SheetSkeletonManagerService).getWorksheetSkeleton(e.location.subUnitId))==null?void 0:k.skeleton,n=e.location.col,r=e.location.row;let o=r,s=n;if(t&&t.overflowCache.forValue((y,L,R)=>{a.Rectangle.contains(R,{startColumn:n,endColumn:n,startRow:r,endRow:r})&&(o=y,s=L)}),!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[h.WorkbookViewPermission],worksheetTypes:[h.WorksheetViewPermission],rangeTypes:[h.RangeProtectionPermissionViewPoint]},[{startRow:r,startColumn:n,endRow:r,endColumn:n}])){this._sheetsHyperLinkPopupService.hideCurrentPopup();return}const d=this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[h.WorkbookEditablePermission],worksheetTypes:[h.WorksheetEditPermission,h.WorksheetInsertHyperlinkPermission],rangeTypes:[h.RangeProtectionPermissionEditPoint]},[{startRow:r,startColumn:n,endRow:r,endColumn:n}]),p=e.location.unitId,S=e.location.subUnitId,_=this._permissionService.composePermission([new h.WorkbookCopyPermission(p).id,new h.WorksheetCopyPermission(p,S).id]).every(y=>y.value);this._sheetsHyperLinkPopupService.showPopup({...e.location,row:o,col:s,editPermission:d,copyPermission:_})}))}},l.SheetsHyperLinkPopupController=Rn([a.OnLifecycle(a.LifecycleStages.Rendered,l.SheetsHyperLinkPopupController),Q(0,a.Inject(f.HoverManagerService)),Q(1,a.Inject(l.SheetsHyperLinkPopupService)),Q(2,a.Inject(ue.IRenderManagerService)),Q(3,a.Inject(a.IPermissionService)),Q(4,a.Inject(f.SheetPermissionInterceptorBaseController))],l.SheetsHyperLinkPopupController);const Pn=i=>({id:se.id,type:O.MenuItemType.BUTTON,positions:[O.MenuPosition.CONTEXT_MENU],title:"hyperLink.menu.add",hidden$:O.getMenuHiddenObservable(i,a.UniverInstanceType.UNIVER_SHEET),icon:"LinkSingle",disabled$:f.getCurrentRangeDisable$(i,{workbookTypes:[h.WorkbookEditablePermission],worksheetTypes:[h.WorksheetEditPermission,h.WorksheetSetCellValuePermission,h.WorksheetInsertHyperlinkPermission],rangeTypes:[h.RangeProtectionPermissionEditPoint]})}),En=i=>({tooltip:"hyperLink.form.addTitle",positions:O.MenuPosition.TOOLBAR_START,group:O.MenuGroup.TOOLBAR_OTHERS,id:ge.id,type:O.MenuItemType.BUTTON,icon:"LinkSingle",hidden$:O.getMenuHiddenObservable(i,a.UniverInstanceType.UNIVER_SHEET),disabled$:f.getCurrentRangeDisable$(i,{workbookTypes:[h.WorkbookEditablePermission],worksheetTypes:[h.WorksheetEditPermission,h.WorksheetSetCellValuePermission,h.WorksheetInsertHyperlinkPermission],rangeTypes:[h.RangeProtectionPermissionEditPoint]})}),Se={id:ge.id,binding:O.KeyCode.K|O.MetaKeys.CTRL_COMMAND,preconditions:f.whenSheetEditorFocused};var bn=Object.defineProperty,On=Object.getOwnPropertyDescriptor,Mn=(i,e,t,n)=>{for(var r=n>1?void 0:n?On(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&bn(e,t,r),r},z=(i,e)=>(t,n)=>e(t,n,i);l.SheetsHyperLinkUIController=class extends a.Disposable{constructor(e,t,n,r,o,s,c){super(),this._config=e,this._componentManager=t,this._commandService=n,this._localeService=r,this._menuService=o,this._injector=s,this._shortcutService=c,this._initComponents(),this._initCommands(),this._initMenus(),this._initShortCut()}_initComponents(){[[ae,ae.componentKey],[ie,ie.componentKey],[re,"LinkSingle"]].forEach(([e,t])=>{this._componentManager.register(t,e)})}_initCommands(){[oe,J,se,ge].forEach(e=>{this._commandService.registerCommand(e)})}_initMenus(){var e,t,n,r;this._menuService.addMenuItem(Pn(this._injector),(t=(e=this._config)==null?void 0:e.menu)!=null?t:{}),this._menuService.addMenuItem(En(this._injector),(r=(n=this._config)==null?void 0:n.menu)!=null?r:{})}_initShortCut(){this._shortcutService.registerShortcut(Se)}},l.SheetsHyperLinkUIController=Mn([a.OnLifecycle(a.LifecycleStages.Ready,l.SheetsHyperLinkUIController),z(1,a.Inject(O.ComponentManager)),z(2,a.ICommandService),z(3,a.Inject(a.LocaleService)),z(4,O.IMenuService),z(5,a.Inject(a.Injector)),z(6,a.Inject(O.IShortcutService))],l.SheetsHyperLinkUIController);const ye="SHEET_HYPER_LINK_UI_PLUGIN";var wn=Object.defineProperty,Hn=Object.getOwnPropertyDescriptor,jn=(i,e,t,n)=>{for(var r=n>1?void 0:n?Hn(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&wn(e,t,r),r},He=(i,e)=>(t,n)=>e(t,n,i);l.SheetsHyperLinkAutoFillController=class extends a.Disposable{constructor(e,t){super(),this._autoFillService=e,this._hyperLinkModel=t,this._initAutoFill()}_initAutoFill(){const e=()=>({redos:[],undos:[]}),t=(r,o)=>{const{source:s,target:c,unitId:d,subUnitId:p}=r,S=f.virtualizeDiscreteRanges([s,c]),[_,u]=S.ranges,{mapFunc:k}=S,y={row:_.startRow,col:_.startColumn},L=f.getAutoFillRepeatRange(_,u),R=[],H=[];return L.forEach(b=>{const U=b.repeatStartCell,B=b.relativeRange,M={startRow:y.row,startColumn:y.col,endColumn:y.col,endRow:y.row},Z={startRow:U.row,startColumn:U.col,endColumn:U.col,endRow:U.row};a.Range.foreach(B,(x,W)=>{const q=a.Rectangle.getPositionRange({startRow:x,startColumn:W,endColumn:W,endRow:x},M),{row:_e,col:Ce}=k(q.startRow,q.startColumn),ee=this._hyperLinkModel.getHyperLinkByLocation(d,p,_e,Ce);if(ee){const g=a.Rectangle.getPositionRange({startRow:x,startColumn:W,endColumn:W,endRow:x},Z),{row:P,col:w}=k(g.startRow,g.startColumn),E=a.Tools.generateRandomId(),j=this._hyperLinkModel.getHyperLinkByLocation(d,p,P,w);j&&R.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:d,subUnitId:p,id:j.id}}),(f.APPLY_TYPE.COPY===o||f.APPLY_TYPE.SERIES===o)&&(R.push({id:v.AddHyperLinkMutation.id,params:{unitId:d,subUnitId:p,link:{...ee,id:E,row:P,column:w}}}),H.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:d,subUnitId:p,id:E}})),j&&H.push({id:v.AddHyperLinkMutation.id,params:{unitId:d,subUnitId:p,link:j}})}})}),{undos:H,redos:R}},n={id:ye,onFillData:(r,o,s)=>s===f.APPLY_TYPE.COPY||s===f.APPLY_TYPE.ONLY_FORMAT||s===f.APPLY_TYPE.SERIES?t(r,s):e()};this.disposeWithMe(this._autoFillService.addHook(n))}},l.SheetsHyperLinkAutoFillController=jn([a.OnLifecycle(a.LifecycleStages.Ready,l.SheetsHyperLinkAutoFillController),He(0,f.IAutoFillService),He(1,a.Inject(v.HyperLinkModel))],l.SheetsHyperLinkAutoFillController);var Tn=Object.defineProperty,Un=Object.getOwnPropertyDescriptor,Nn=(i,e,t,n)=>{for(var r=n>1?void 0:n?Un(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Tn(e,t,r),r},le=(i,e)=>(t,n)=>e(t,n,i);l.SheetsHyperLinkCopyPasteController=class extends a.Disposable{constructor(t,n,r,o){super();$(this,"_copyInfo");this._sheetClipboardService=t,this._hyperLinkModel=n,this._injector=r,this._resolverService=o,this._initCopyPaste()}_initCopyPaste(){this._sheetClipboardService.addClipboardHook({id:ye,onBeforeCopy:(t,n,r)=>this._collect(t,n,r),onPasteCells:(t,n,r,o)=>{const{copyType:s=f.COPY_TYPE.COPY,pasteType:c}=o,{range:d}=t||{},{range:p,unitId:S,subUnitId:_}=n;return this._generateMutations(p,{copyType:s,pasteType:c,copyRange:d,unitId:S,subUnitId:_})},onPastePlainText:(t,n)=>{if(X(n)){const r=ve(n),{range:o,unitId:s,subUnitId:c}=t,{ranges:[d],mapFunc:p}=f.virtualizeDiscreteRanges([o]),S=[],_=[];return a.Range.foreach(d,(u,k)=>{const{row:y,col:L}=p(u,k),R=this._hyperLinkModel.getHyperLinkByLocation(s,c,y,L);R&&S.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:s,subUnitId:c,id:R.id}});const H=a.Tools.generateRandomId();S.push({id:v.AddHyperLinkMutation.id,params:{unitId:s,subUnitId:c,link:{id:H,row:y,column:L,payload:r}}}),_.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:s,subUnitId:c,id:H}}),R&&_.push({id:v.AddHyperLinkMutation.id,params:{unitId:s,subUnitId:c,link:R}})}),{redos:S,undos:_}}return{undos:[],redos:[]}}})}_collect(t,n,r){const o=new a.ObjectMatrix;this._copyInfo={unitId:t,subUnitId:n,matrix:o};const s={get:this._injector.get.bind(this._injector)},c=f.rangeToDiscreteRange(r,s,t,n);if(!c)return;const{rows:d,cols:p}=c;d.forEach((S,_)=>{p.forEach((u,k)=>{var L;const y=this._hyperLinkModel.getHyperLinkByLocation(t,n,S,u);o.setValue(_,k,(L=y==null?void 0:y.id)!=null?L:"")})})}_generateMutations(t,n){if(!this._copyInfo)return{redos:[],undos:[]};if(!this._copyInfo||!this._copyInfo.matrix.getSizeOf()||!n.copyRange)return{redos:[],undos:[]};if([f.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_COL_WIDTH,f.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_VALUE,f.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT,f.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMULA].includes(n.pasteType))return{redos:[],undos:[]};const{unitId:r,subUnitId:o}=this._copyInfo,s=[],c=[],{ranges:[d,p],mapFunc:S}=f.virtualizeDiscreteRanges([n.copyRange,t]);return f.getRepeatRange(d,p,!0).forEach(({startRange:u})=>{var k;(k=this._copyInfo)==null||k.matrix.forValue((y,L,R)=>{const H=a.Rectangle.getPositionRange({startRow:y,endRow:y,startColumn:L,endColumn:L},u),b=this._hyperLinkModel.getHyperLink(r,o,R),{row:U,col:B}=S(H.startRow,H.startColumn),M=this._hyperLinkModel.getHyperLinkByLocation(n.unitId,n.subUnitId,U,B),Z=a.Tools.generateRandomId();M&&s.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:n.unitId,subUnitId:n.subUnitId,id:M.id}}),b&&(s.push({id:v.AddHyperLinkMutation.id,params:{unitId:n.unitId,subUnitId:n.subUnitId,link:{...b,id:Z,row:U,column:B}}}),c.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:n.unitId,subUnitId:n.subUnitId,id:Z}})),M&&c.push({id:v.AddHyperLinkMutation.id,params:{unitId:n.unitId,subUnitId:n.subUnitId,link:M}})})}),{redos:s,undos:c}}},l.SheetsHyperLinkCopyPasteController=Nn([a.OnLifecycle(a.LifecycleStages.Ready,l.SheetsHyperLinkCopyPasteController),le(0,f.ISheetClipboardService),le(1,a.Inject(v.HyperLinkModel)),le(2,a.Inject(a.Injector)),le(3,a.Inject(l.SheetsHyperLinkResolverService))],l.SheetsHyperLinkCopyPasteController);var Dn=Object.defineProperty,An=Object.getOwnPropertyDescriptor,Vn=(i,e,t,n)=>{for(var r=n>1?void 0:n?An(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Dn(e,t,r),r},Bn=(i,e)=>(t,n)=>e(t,n,i);l.SheetHyperLinkUrlController=class extends a.Disposable{constructor(e){super(),this._resolverService=e,this._handleInitUrl()}_handleInitUrl(){const e=location.hash;e&&this._resolverService.parseHyperLink(e).handler()}},l.SheetHyperLinkUrlController=Vn([a.OnLifecycle(a.LifecycleStages.Rendered,l.SheetHyperLinkUrlController),Bn(0,a.Inject(l.SheetsHyperLinkResolverService))],l.SheetHyperLinkUrlController);var xn=Object.defineProperty,Wn=Object.getOwnPropertyDescriptor,Fn=(i,e,t,n)=>{for(var r=n>1?void 0:n?Wn(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&xn(e,t,r),r},fe=(i,e)=>(t,n)=>e(t,n,i);let ce=class extends a.Disposable{constructor(i,e,t){super(),this._localeService=i,this._commandService=e,this._sheetPermissionInterceptorBaseController=t,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(i=>{i.id===Se.id&&(this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[h.WorkbookEditablePermission],rangeTypes:[h.RangeProtectionPermissionEditPoint],worksheetTypes:[h.WorksheetEditPermission,h.WorksheetSetCellValuePermission,h.WorksheetInsertHyperlinkPermission]})||this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.hyperLinkErr")))}))}};ce=Fn([a.OnLifecycle(a.LifecycleStages.Rendered,ce),fe(0,a.Inject(a.LocaleService)),fe(1,a.ICommandService),fe(2,a.Inject(f.SheetPermissionInterceptorBaseController))],ce);var je=Object.defineProperty,$n=Object.getOwnPropertyDescriptor,Yn=(i,e,t)=>e in i?je(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,Kn=(i,e,t,n)=>{for(var r=n>1?void 0:n?$n(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&je(e,t,r),r},Te=(i,e)=>(t,n)=>e(t,n,i),Ue=(i,e,t)=>Yn(i,typeof e!="symbol"?e+"":e,t);l.UniverSheetsHyperLinkUIPlugin=class extends a.Plugin{constructor(e,t,n){super(),this._config=e,this._injector=t,this._renderManagerService=n}onStarting(e){[[l.SheetsHyperLinkResolverService],[l.SheetsHyperLinkPopupService],[l.SheetsHyperLinkRemoveSheetController],[l.SheetsHyperLinkRenderManagerController],[l.SheetHyperLinkSetRangeController],[l.SheetsHyperLinkPopupController],[l.SheetsHyperLinkUIController,{useFactory:()=>this._injector.createInstance(l.SheetsHyperLinkUIController,this._config)}],[l.SheetsHyperLinkAutoFillController],[l.SheetsHyperLinkCopyPasteController],[ce],[l.SheetHyperLinkUrlController]].forEach(n=>e.add(n))}onReady(){[[l.SheetsHyperLinkRenderController]].forEach(t=>this._renderManagerService.registerRenderModule(a.UniverInstanceType.UNIVER_SHEET,t))}},Ue(l.UniverSheetsHyperLinkUIPlugin,"pluginName",ye),Ue(l.UniverSheetsHyperLinkUIPlugin,"type",a.UniverInstanceType.UNIVER_SHEET),l.UniverSheetsHyperLinkUIPlugin=Kn([a.DependentOn(v.UniverSheetsHyperLinkPlugin),Te(1,a.Inject(a.Injector)),Te(2,ue.IRenderManagerService)],l.UniverSheetsHyperLinkUIPlugin),l.CloseHyperLinkSidebarOperation=J,l.InsertHyperLinkOperation=se,l.InsertLinkShortcut=Se,l.OpenHyperLinkSidebarOperation=oe,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
9
+ */var $e=C,Ye=Symbol.for("react.element"),Ke=Symbol.for("react.fragment"),ze=Object.prototype.hasOwnProperty,Ze=$e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Ge={key:!0,ref:!0,__self:!0,__source:!0};function Pe(i,e,t){var n,r={},o=null,s=null;t!==void 0&&(o=""+t),e.key!==void 0&&(o=""+e.key),e.ref!==void 0&&(s=e.ref);for(n in e)ze.call(e,n)&&!Ge.hasOwnProperty(n)&&(r[n]=e[n]);if(i&&i.defaultProps)for(n in e=i.defaultProps,e)r[n]===void 0&&(r[n]=e[n]);return{$$typeof:Ye,type:i,key:o,ref:s,props:r,_owner:Ze.current}}te.Fragment=Ke,te.jsx=Pe,te.jsxs=Pe,Re.exports=te;var m=Re.exports,j=function(){return j=Object.assign||function(i){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(i[r]=e[r])}return i},j.apply(this,arguments)},Xe=function(i,e){var t={};for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&e.indexOf(n)<0&&(t[n]=i[n]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(i);r<n.length;r++)e.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(i,n[r])&&(t[n[r]]=i[n[r]]);return t},F=C.forwardRef(function(i,e){var t=i.icon,n=i.id,r=i.className,o=i.extend,s=Xe(i,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(n," ").concat(r||"").trim(),d=C.useRef("_".concat(qe()));return be(t,"".concat(n),{defIds:t.defIds,idSuffix:d.current},j({ref:e,className:c},s),o)});function be(i,e,t,n,r){return C.createElement(i.tag,j(j({key:e},Je(i,t,r)),n),(Qe(i,t).children||[]).map(function(o,s){return be(o,"".concat(e,"-").concat(i.tag,"-").concat(s),t,void 0,r)}))}function Je(i,e,t){var n=j({},i.attrs);t!=null&&t.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=t.colorChannel1);var r=e.defIds;return!r||r.length===0||(i.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+e.idSuffix),Object.entries(n).forEach(function(o){var s=o[0],c=o[1];typeof c=="string"&&(n[s]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),n}function Qe(i,e){var t,n=e.defIds;return!n||n.length===0?i:i.tag==="defs"&&(!((t=i.children)===null||t===void 0)&&t.length)?j(j({},i),{children:i.children.map(function(r){return typeof r.attrs.id=="string"&&n&&n.indexOf(r.attrs.id)>-1?j(j({},r),{attrs:j(j({},r.attrs),{id:r.attrs.id+e.idSuffix})}):r})}):i}function qe(){return Math.random().toString(36).substring(2,8)}F.displayName="UniverIcon";var en={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"}}]},re=C.forwardRef(function(i,e){return C.createElement(F,Object.assign({},i,{id:"all-border-single",ref:e,icon:en}))});re.displayName="AllBorderSingle";var nn={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.02547 12.4251C5.15328 13.7417 6.26305 14.7708 7.61318 14.7708H12.6132C14.0491 14.7708 15.2132 13.6067 15.2132 12.1708V6.1708C15.2132 4.78586 14.1303 3.65383 12.7651 3.57517C12.6373 2.25858 11.5275 1.22949 10.1774 1.22949H5.17739C3.74145 1.22949 2.57739 2.39355 2.57739 3.82949V9.82949C2.57739 11.2144 3.66024 12.3465 5.02547 12.4251ZM11.5535 3.5708H7.61318C6.17724 3.5708 5.01318 4.73486 5.01318 6.1708V11.22C4.31736 11.1387 3.77739 10.5471 3.77739 9.82949V3.82949C3.77739 3.05629 4.40419 2.42949 5.17739 2.42949H10.1774C10.8622 2.42949 11.4322 2.92119 11.5535 3.5708ZM14.0132 6.1708C14.0132 5.3976 13.3864 4.7708 12.6132 4.7708H7.61318C6.83998 4.7708 6.21318 5.3976 6.21318 6.1708V12.1708C6.21318 12.944 6.83998 13.5708 7.61318 13.5708H12.6132C13.3864 13.5708 14.0132 12.944 14.0132 12.1708V6.1708Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Ee=C.forwardRef(function(i,e){return C.createElement(F,Object.assign({},i,{id:"copy-single",ref:e,icon:nn}))});Ee.displayName="CopySingle";var tn={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.9564 2.91332C4.91407 1.87102 3.22413 1.87101 2.18182 2.91333L2.18182 2.91333C1.13953 3.95567 1.13952 5.6456 2.18182 6.68791L8.27777 12.7838C9.72408 14.2302 12.069 14.2302 13.5154 12.7839L13.0911 12.3596L13.5154 12.7839C14.9617 11.3375 14.9617 8.99257 13.5154 7.54626L8.39476 2.42566C8.16044 2.19134 7.78054 2.19134 7.54623 2.42566C7.31191 2.65997 7.31191 3.03987 7.54623 3.27419L12.6668 8.39479L13.0911 7.97052L12.6668 8.39479C13.6445 9.37247 13.6445 10.9576 12.6668 11.9353L13.0399 12.3084L12.6668 11.9353C11.6891 12.913 10.104 12.913 9.1263 11.9353L3.03035 5.83938C2.45668 5.26571 2.45667 4.33556 3.03036 3.76184C3.60403 3.18818 4.53416 3.18817 5.10788 3.76185C5.10788 3.76186 5.10788 3.76186 5.10789 3.76186L11.2038 9.8578L11.601 9.46061L11.2038 9.8578C11.3735 10.0275 11.3735 10.3026 11.2038 10.4723L11.2038 10.4723C11.0341 10.642 10.759 10.642 10.5893 10.4723L5.46874 5.35171C5.23442 5.1174 4.85452 5.1174 4.62021 5.35171C4.38589 5.58602 4.38589 5.96592 4.62021 6.20024L9.74078 11.3208C10.3791 11.9591 11.414 11.9591 12.0523 11.3208C12.0523 11.3208 12.0523 11.3208 12.0523 11.3208M12.0523 11.3208C12.6907 10.6825 12.6906 9.64757 12.0523 9.00927L5.95641 2.91333L5.9564 2.91332",fillRule:"evenodd",clipRule:"evenodd"}}]},ie=C.forwardRef(function(i,e){return C.createElement(F,Object.assign({},i,{id:"link-single",ref:e,icon:tn}))});ie.displayName="LinkSingle";var rn={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"}}]},Oe=C.forwardRef(function(i,e){return C.createElement(F,Object.assign({},i,{id:"unlink-single",ref:e,icon:rn}))});Oe.displayName="UnlinkSingle";var on={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"}}]},Me=C.forwardRef(function(i,e){return C.createElement(F,Object.assign({},i,{id:"write-single",ref:e,icon:on}))});Me.displayName="WriteSingle";var sn={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"#35BD4B",d:"M3.36396 1.12549C2.61066 1.12549 2 1.73615 2 2.48945V13.5104C2 14.2637 2.61066 14.8744 3.36396 14.8744H12.457C13.2103 14.8744 13.821 14.2637 13.821 13.5104V5.0992L9.91954 1.12549H3.36396Z"}},{tag:"path",attrs:{fill:"#32A846",d:"M9.91797 1.12549L13.8209 5.09842H10.5846C10.2164 5.09842 9.91797 4.79994 9.91797 4.43175V1.12549Z"}},{tag:"path",attrs:{fill:"#fff",d:"M7.71926 10.2949L6.28687 12.403C6.17306 12.5705 5.94501 12.614 5.77751 12.5002C5.61002 12.3864 5.56649 12.1584 5.6803 11.9909L7.27596 9.64252L5.85088 7.54519C5.73707 7.37769 5.78059 7.14964 5.94809 7.03583C6.11558 6.92202 6.34363 6.96555 6.45744 7.13304L7.71926 8.9901L8.98108 7.13304C9.09489 6.96555 9.32294 6.92202 9.49044 7.03583C9.65793 7.14964 9.70146 7.37769 9.58765 7.54519L8.16256 9.64252L9.75822 11.9909C9.87203 12.1584 9.82851 12.3864 9.66101 12.5002C9.49351 12.614 9.26547 12.5705 9.15166 12.403L7.71926 10.2949Z",fillRule:"evenodd",clipRule:"evenodd"}}]},me=C.forwardRef(function(i,e){return C.createElement(F,Object.assign({},i,{id:"xlsx",ref:e,icon:sn}))});me.displayName="Xlsx";var an=Object.defineProperty,ln=Object.getOwnPropertyDescriptor,cn=(i,e,t,n)=>{for(var r=n>1?void 0:n?ln(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&an(e,t,r),r},G=(i,e)=>(t,n)=>e(t,n,i);function dn(i,e){const t=e.getMergeData(),n=e.getMaxColumns()-1,r=e.getMaxRows()-1;if(n<i.endColumn&&(i.endColumn=n),r<i.endRow&&(i.endRow=r),i.rangeType===a.RANGE_TYPE.COLUMN||a.RANGE_TYPE.ROW)return i;const o=[];return t.forEach(s=>{a.Rectangle.intersects(i,s)&&o.push(s)}),a.Rectangle.realUnion(i,...o)}l.SheetsHyperLinkResolverService=class{constructor(e,t,n,r,o){this._univerInstanceService=e,this._commandService=t,this._definedNamesService=n,this._messageService=r,this._localeService=o}_getURLName(e){var d;const{gid:t,range:n,rangeid:r}=e,o=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!o)return null;const s=t?o.getSheetBySheetId(t):o.getActiveSheet(),c=(d=s==null?void 0:s.getName())!=null?d:"";if(n){const p=D.deserializeRangeWithSheet(n).range;return a.isValidRange(p)&&n!==v.ERROR_RANGE?{type:"range",name:D.serializeRangeWithSheet(c,p)}:{type:"range-error",name:this._localeService.t("hyperLink.message.refError")}}if(r){const p=this._definedNamesService.getValueById(o.getUnitId(),r);return p?{type:"defineName",name:p.formulaOrRefString}:{type:"range-error",name:this._localeService.t("hyperLink.message.refError")}}if(t){const p=o.getSheetBySheetId(t);return p?{type:"sheet",name:p.getName()}:{type:"sheet-error",name:this._localeService.t("hyperLink.message.refError")}}return null}navigateTo(e){const{gid:t,range:n,rangeid:r}=e,o=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!o)return;const s=o.getUnitId();if(r&&this.navigateToDefineName(s,r),!!t){if(n){const c=D.deserializeRangeWithSheet(n);a.isValidRange(c.range)&&n!==v.ERROR_RANGE&&this.navigateToRange(s,t,c.range);return}this.navigateToSheetById(s,t)}}parseHyperLink(e){var t,n,r;if(e!=null&&e.startsWith("#")){const o=new URLSearchParams(e.slice(1)),s={gid:(t=o.get("gid"))!=null?t:"",range:(n=o.get("range"))!=null?n:"",rangeid:(r=o.get("rangeid"))!=null?r:""},c=this._getURLName(s);return{type:(c==null?void 0:c.type)||"link",name:(c==null?void 0:c.name)||e,url:e,searchObj:s,handler:()=>{this.navigateTo(s)}}}else return{type:"outer",name:e,url:e,handler:()=>{this.navigateToOtherWebsite(e)}}}async navigateToRange(e,t,n){const r=await this.navigateToSheetById(e,t);if(r){const o=dn(n,r);await this._commandService.executeCommand(h.SetSelectionsOperation.id,{unitId:e,subUnitId:t,selections:[{range:o}]}),await this._commandService.executeCommand(f.ScrollToRangeOperation.id,{range:o})}}async navigateToSheet(e,t){const n=this._univerInstanceService.getUnit(e,a.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();if((r==null?void 0:r.getName())===t)return!0;const o=n.getSheetBySheetName(t);if(!o){this._messageService.show({content:this._localeService.t("hyperLink.message.noSheet"),type:I.MessageType.Error});return}const s=o.getSheetId();return n.getHiddenWorksheets().indexOf(s)>-1&&this._messageService.show({content:this._localeService.t("hyperLink.message.hiddenSheet"),type:I.MessageType.Error}),await this._commandService.executeCommand(h.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:s})}async navigateToSheetById(e,t){const n=this._univerInstanceService.getUnit(e,a.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();if(!r)return!1;if(r.getSheetId()===t)return r;const o=n.getSheetBySheetId(t);return o?n.getHiddenWorksheets().indexOf(t)>-1?(this._messageService.show({content:this._localeService.t("hyperLink.message.hiddenSheet"),type:I.MessageType.Error}),!1):await this._commandService.executeCommand(h.SetWorksheetActiveOperation.id,{unitId:e,subUnitId:t})?o:!1:(this._messageService.show({content:this._localeService.t("hyperLink.message.noSheet"),type:I.MessageType.Error}),!1)}async navigateToDefineName(e,t){return this._definedNamesService.focusRange(e,t),!0}async navigateToOtherWebsite(e){window.open(e,"_blank","noopener noreferrer")}},l.SheetsHyperLinkResolverService=cn([G(0,a.IUniverInstanceService),G(1,a.ICommandService),G(2,D.IDefinedNamesService),G(3,O.IMessageService),G(4,a.Inject(a.LocaleService))],l.SheetsHyperLinkResolverService);function X(i){return a.Tools.isLegalUrl(i)}function un(i){return/^[a-zA-Z]+:\/\//.test(i)}function pn(i){return/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(i)}function ve(i){if(X(i)){const e=un(i)?i:pn(i)?`mailto://${i}`:`http://${i}`,t=new URL(e);return t.hostname===location.hostname&&t.port===location.port&&t.protocol===location.protocol&&t.pathname===location.pathname&&t.hash&&!t.search?t.hash:e}return i}function hn(i){if(i===null)return"";if(i!=null&&i.p){const e=i==null?void 0:i.p.body;if(e==null)return"";const t=e.dataStream;return t.substring(t.length-2,t.length)===a.DEFAULT_EMPTY_DOCUMENT_VALUE?t.substring(0,t.length-2):t}return i==null?void 0:i.v}const mn={cellLinkEditButtons:"univer-cell-link-edit-buttons"},oe=()=>{var ee;const[i,e]=C.useState(""),[t,n]=C.useState(""),[r,o]=C.useState("link"),[s,c]=C.useState(""),d=a.useDependency(a.LocaleService),p=a.useDependency(D.IDefinedNamesService),S=a.useDependency(a.IUniverInstanceService),_=a.useDependency(l.SheetsHyperLinkPopupService),u=O.useObservable(_.currentEditing$),k=a.useDependency(v.HyperLinkModel),y=a.useDependency(l.SheetsHyperLinkResolverService),L=a.useDependency(a.ICommandService),[R,H]=C.useState(!1),E=C.useRef(!1);C.useEffect(()=>{var g,P,w;if((u==null?void 0:u.row)!==void 0&&u.column!==void 0){const b=k.getHyperLinkByLocationSync(u.unitId,u.subUnitId,u.row,u.column);if(b){const ue=y.parseHyperLink(b.payload);if(e(b.id),n(b.display),ue.type==="outer"){o("link"),c(ue.url),ue.url===b.display&&(E.current=!0);return}else{const V=ue.searchObj;if(V.rangeid){o("rangeid"),c(V.rangeid);return}if(V.range){const Zn=V.gid&&(w=(P=(g=S.getUnit(u.unitId))==null?void 0:g.getSheetBySheetId(V.gid))==null?void 0:P.getName())!=null?w:"";if(o("range"),V.range===v.ERROR_RANGE)c("");else{const Ne=D.serializeRangeWithSheet(Zn,D.deserializeRangeWithSheet(V.range).range);c(Ne),Ne===b.display&&(E.current=!0)}return}if(V.gid){o("gid"),c(V.gid);return}}}const T=S.getUnit(u.unitId),N=T==null?void 0:T.getSheetBySheetId(u.subUnitId),zn=N==null?void 0:N.getCellRaw(u.row,u.column),Le=hn(zn);o("link"),c(""),n((Le!=null?Le:"").toString()),e("");return}o("link"),c(""),n(""),e("")},[u,k,y,S]);const U=C.useMemo(()=>s,[r]),B=[{label:d.t("hyperLink.form.link"),value:"link"},{label:d.t("hyperLink.form.range"),value:"range"},{label:d.t("hyperLink.form.worksheet"),value:"gid"},{label:d.t("hyperLink.form.definedName"),value:"rangeid"}],M=S.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!M)return;const Z=M.getHiddenWorksheets(),x=M.getSheets().map(g=>({label:g.getName(),value:g.getSheetId()})).filter(g=>Z.indexOf(g.value)===-1),W=Object.values((ee=p.getDefinedNameMap(M.getUnitId()))!=null?ee:{}).map(g=>({label:g.name,value:g.id})),q=(g,P)=>{if(g==="link")return ve(P);if(g==="range"){const w=D.deserializeRangeWithSheet(P),b=M.getSheetBySheetName(w.sheetName);if(b)return`#gid=${b.getSheetId()}&range=${D.serializeRange(w.range)}`}return`#${g}=${P}`},_e=O.useEvent(g=>{var b;const P=g[0];if(!P||!a.isValidRange(P.range))return;P.sheetName||(P.sheetName=((b=M.getActiveSheet())==null?void 0:b.getName())||"");const w=D.serializeRangeToRefString(P);c(w),w&&(E.current||!t)&&(n(w),E.current=!0)}),Ce=async()=>{if(u&&(i?await L.executeCommand(v.UpdateHyperLinkCommand.id,{unitId:u.unitId,subUnitId:u.subUnitId,id:i,payload:{display:t,payload:q(r,s)}}):await L.executeCommand(v.AddHyperLinkCommand.id,{unitId:u.unitId,subUnitId:u.subUnitId,link:{id:a.Tools.generateRandomId(),row:u.row,column:u.column,payload:q(r,s),display:t}})),u){await L.executeCommand(h.SetWorksheetActiveOperation.id,{unitId:u.unitId,subUnitId:u.subUnitId});const g=1;await L.executeCommand(f.ScrollToRangeOperation.id,{range:{startRow:Math.max(u.row-g,0),endRow:u.row+g,startColumn:Math.max(u.column-g,0),endColumn:u.column+g}})}L.executeCommand(J.id)};return m.jsxs("div",{children:[m.jsx(I.FormLayout,{label:d.t("hyperLink.form.label"),error:R&&!t?d.t("hyperLink.form.inputError"):"",children:m.jsx(I.Input,{value:t,onChange:g=>{n(g),E.current=!1},placeholder:d.t("hyperLink.form.labelPlaceholder")})}),m.jsx(I.FormLayout,{label:d.t("hyperLink.form.type"),children:m.jsx(I.Select,{options:B,value:r,onChange:g=>{o(g),c("")}})}),r==="link"&&m.jsx(I.FormLayout,{error:R?s?X(s)?"":d.t("hyperLink.form.linkError"):d.t("hyperLink.form.inputError"):"",children:m.jsx(I.Input,{value:s,onChange:g=>{c(g),g&&(E.current||!t||t===s)&&(n(g),E.current=!0)},placeholder:d.t("hyperLink.form.linkPlaceholder")})}),r==="range"&&m.jsx(I.FormLayout,{error:R&&!s?d.t("hyperLink.form.inputError"):"",children:m.jsx(O.RangeSelector,{openForSheetUnitId:M.getUnitId(),id:a.createInternalEditorID("hyper-link-edit"),isSingleChoice:!0,value:U,onChange:_e})}),r==="gid"&&m.jsx(I.FormLayout,{error:R&&!s?d.t("hyperLink.form.selectError"):"",children:m.jsx(I.Select,{options:x,value:s,onChange:g=>{var b,T;c(g);const P=(b=x.find(N=>N.value===g))==null?void 0:b.label,w=(T=x.find(N=>N.value===s))==null?void 0:T.label;P&&(E.current||!t||t===w)&&(n(P),E.current=!0)}})}),r==="rangeid"&&m.jsx(I.FormLayout,{error:R&&!s?d.t("hyperLink.form.selectError"):"",children:m.jsx(I.Select,{options:W,value:s,onChange:g=>{var b,T;c(g);const P=(b=W.find(N=>N.value===g))==null?void 0:b.label,w=(T=W.find(N=>N.value===s))==null?void 0:T.label;P&&(E.current||!t||t===w)&&(n(P),E.current=!0)}})}),m.jsxs("div",{className:mn.cellLinkEditButtons,children:[m.jsx(I.Button,{onClick:()=>{u&&L.executeCommand(h.SetWorksheetActiveOperation.id,{unitId:u.unitId,subUnitId:u.subUnitId}),L.executeCommand(J.id)},children:d.t("hyperLink.form.cancel")}),m.jsx(I.Button,{type:"primary",style:{marginLeft:8},onClick:async()=>{if(!t||!s||r==="link"&&!X(s)){H(!0);return}Ce()},children:d.t("hyperLink.form.ok")})]})]})};oe.componentKey="univer.sheet.cell-link-edit";const se={type:a.CommandType.OPERATION,id:"sheet.operation.open-hyper-link-sidebar",handler(i,e){if(!e)return!1;const{unitId:t,subUnitId:n,row:r,column:o}=e,s=i.get(v.HyperLinkModel),c=i.get(O.ISidebarService),d=i.get(l.SheetsHyperLinkPopupService),p=s.getHyperLinkByLocation(t,n,r,o);return d.startEditing(e),c.open({header:{title:p?"hyperLink.form.editTitle":"hyperLink.form.addTitle"},children:{label:oe.componentKey}}),!0}},J={type:a.CommandType.OPERATION,id:"sheet.operation.close-hyper-link-sidebar",handler(i){const e=i.get(O.ISidebarService),t=i.get(l.SheetsHyperLinkPopupService);return e.close(),t.endEditing(),!0}},ae={type:a.CommandType.OPERATION,id:"sheet.operation.insert-hyper-link",handler(i){const e=i.get(a.IUniverInstanceService),t=h.getSheetCommandTarget(e);if(!t)return!1;const n=i.get(a.ICommandService),o=i.get(h.SheetsSelectionsService).getCurrentLastSelection();if(!o)return!1;const s=o.primary.startRow,c=o.primary.startColumn;return n.executeCommand(se.id,{unitId:t.unitId,subUnitId:t.subUnitId,row:s,column:c})}},ge={type:a.CommandType.OPERATION,id:"sheet.operation.insert-hyper-link-toolbar",handler(i){const e=i.get(a.ICommandService);return i.get(l.SheetsHyperLinkPopupService).currentEditing?e.executeCommand(J.id):e.executeCommand(ae.id)}},A={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"},vn={outer:m.jsx(ie,{}),link:m.jsx(ie,{}),sheet:m.jsx(me,{}),range:m.jsx(re,{}),defineName:m.jsx(re,{}),"range-error":m.jsx(re,{}),"sheet-error":m.jsx(me,{})},le=()=>{const i=a.useDependency(l.SheetsHyperLinkPopupService),e=a.useDependency(v.HyperLinkModel),t=a.useDependency(a.ICommandService),n=a.useDependency(O.IMessageService),r=a.useDependency(a.LocaleService),[o,s]=C.useState(null),c=a.useDependency(l.SheetsHyperLinkResolverService);if(C.useEffect(()=>{s(i.currentPopup);const y=i.currentPopup$.subscribe(L=>{s(L)});return()=>{y.unsubscribe()}},[i.currentPopup,i.currentPopup$]),!o)return null;const{unitId:d,subUnitId:p,id:S}=o,_=e.getHyperLink(d,p,S);if(!_)return null;const u=c.parseHyperLink(_.payload),k=u.type.indexOf("error")>-1;return m.jsxs("div",{className:A.cellLink,onClick:()=>i.hideCurrentPopup(),children:[m.jsxs("div",{className:ke(A.cellLinkContent,{[A.cellLinkContentError]:k}),onClick:u.handler,children:[m.jsx("div",{className:A.cellLinkType,children:vn[u.type]}),m.jsx(I.Tooltip,{showIfEllipsis:!0,title:u.name,children:m.jsx("span",{className:A.cellLinkUrl,children:u.name})})]}),m.jsxs("div",{className:A.cellLinkOperations,children:[o.copyPermission&&m.jsx("div",{className:ke(A.cellLinkOperation,{[A.cellLinkOperationError]:k}),onClick:()=>{if(!k){if(u.type!=="outer"){const y=new URL(window.location.href);y.hash=u.url.slice(1),navigator.clipboard.writeText(y.href)}else navigator.clipboard.writeText(u.url);n.show({content:r.t("hyperLink.message.coped"),type:I.MessageType.Info})}},children:m.jsx(I.Tooltip,{placement:"bottom",title:r.t("hyperLink.popup.copy"),children:m.jsx(Ee,{})})}),o.editPermission&&m.jsxs(m.Fragment,{children:[m.jsx("div",{className:A.cellLinkOperation,onClick:()=>{t.executeCommand(se.id,{unitId:d,subUnitId:p,row:_.row,column:_.column})},children:m.jsx(I.Tooltip,{placement:"bottom",title:r.t("hyperLink.popup.edit"),children:m.jsx(Me,{})})}),m.jsx("div",{className:A.cellLinkOperation,onClick:()=>{t.executeCommand(v.CancelHyperLinkCommand.id,{unitId:d,subUnitId:p,id:_.id})},children:m.jsx(I.Tooltip,{placement:"bottom",title:r.t("hyperLink.popup.cancel"),children:m.jsx(Oe,{})})})]})]})]})};le.componentKey="univer.sheet.cell-link-popup";var gn=Object.defineProperty,Sn=Object.getOwnPropertyDescriptor,yn=(i,e,t,n)=>{for(var r=n>1?void 0:n?Sn(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&gn(e,t,r),r},we=(i,e)=>(t,n)=>e(t,n,i);const fn=(i,e)=>i.unitId===e.unitId&&i.subUnitId===e.subUnitId&&i.row===e.row&&i.col===e.col;l.SheetsHyperLinkPopupService=class extends a.Disposable{constructor(t,n){super();$(this,"_currentPopup",null);$(this,"_currentPopup$",new ne.Subject);$(this,"currentPopup$",this._currentPopup$.asObservable());$(this,"_currentEditing$",new ne.BehaviorSubject(null));$(this,"currentEditing$",this._currentEditing$.asObservable());this._hyperLinkModel=t,this._sheetCanvasPopManagerService=n,this.disposeWithMe(()=>{this.hideCurrentPopup(),this.endEditing(),this._currentEditing$.complete(),this._currentPopup$.complete()})}get currentPopup(){return this._currentPopup}get currentEditing(){return this._currentEditing$.getValue()}showPopup(t){if(this._currentPopup&&fn(t,this._currentPopup))return;this.hideCurrentPopup();const{unitId:n,subUnitId:r,row:o,col:s}=t,c=this._hyperLinkModel.getHyperLinkByLocation(n,r,o,s);if(!c)return;const d=this._sheetCanvasPopManagerService.attachPopupToCell(o,s,{componentKey:le.componentKey,direction:"bottom",closeOnSelfTarget:!0,onClickOutside:()=>{this.hideCurrentPopup()}});d&&(this._currentPopup={unitId:n,subUnitId:r,id:c.id,disposable:d,row:o,col:s,editPermission:!!t.editPermission,copyPermission:!!t.copyPermission},this._currentPopup$.next(this._currentPopup))}hideCurrentPopup(){var t;this._currentPopup&&((t=this._currentPopup.disposable)==null||t.dispose(),this._currentPopup=null,this._currentPopup$.next(null))}startEditing(t){this._currentEditing$.next(t)}endEditing(){this._currentEditing$.next(null)}},l.SheetsHyperLinkPopupService=yn([we(0,a.Inject(v.HyperLinkModel)),we(1,a.Inject(f.SheetCanvasPopManagerService))],l.SheetsHyperLinkPopupService);var _n=Object.defineProperty,Cn=Object.getOwnPropertyDescriptor,Ln=(i,e,t,n)=>{for(var r=n>1?void 0:n?Cn(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&_n(e,t,r),r},K=(i,e)=>(t,n)=>e(t,n,i);l.SheetHyperLinkSetRangeController=class extends a.Disposable{constructor(e,t,n,r,o,s){super(),this._sheetInterceptorService=e,this._injector=t,this._hyperLinkModel=n,this._selectionManagerService=r,this._univerInstanceService=o,this._editorBridgeService=s,this._initCommandInterceptor()}_initCommandInterceptor(){this._initAddHyperLinkCommandInterceptor(),this._initSetRangeValuesCommandInterceptor(),this._initUpdateHyperLinkCommandInterceptor(),this._initClearSelectionCommandInterceptor(),this._initRichTextEditorInterceptor()}_getCurrentCell(e,t,n,r){var o,s;return(s=(o=this._univerInstanceService.getUnit(e,a.UniverInstanceType.UNIVER_SHEET))==null?void 0:o.getSheetBySheetId(t))==null?void 0:s.getCell(n,r)}_initAddHyperLinkCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{var t;if(e.id===v.AddHyperLinkCommand.id){const n=e.params,{unitId:r,subUnitId:o,link:s}=n,c=this._getCurrentCell(r,o,s.row,s.column),d={unitId:r,subUnitId:o,cellValue:{[s.row]:{[s.column]:{v:s.display,p:null,t:(t=c==null?void 0:c.t)!=null?t:void 0}}}};return{redos:[{id:h.SetRangeValuesMutation.id,params:d}],undos:[{id:h.SetRangeValuesMutation.id,params:h.SetRangeValuesUndoMutationFactory(this._injector,d)}]}}return{redos:[],undos:[]}}}))}_initUpdateHyperLinkCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{if(e.id===v.UpdateHyperLinkCommand.id){const t=e.params,{unitId:n,subUnitId:r,id:o,payload:s}=t,c=this._hyperLinkModel.getHyperLink(n,r,o);if(c&&c.display!==s.display){const d={unitId:n,subUnitId:r,cellValue:{[c.row]:{[c.column]:{v:s.display,t:a.CellValueType.STRING,p:null}}}};return{redos:[{id:h.SetRangeValuesMutation.id,params:d}],undos:[{id:h.SetRangeValuesMutation.id,params:h.SetRangeValuesUndoMutationFactory(this._injector,d)}]}}}return{redos:[],undos:[]}}}))}_initSetRangeValuesCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{if(e.id===h.SetRangeValuesCommand.id){const t=e.params,{unitId:n,subUnitId:r}=t,o=[],s=[];return t.cellValue&&new a.ObjectMatrix(t.cellValue).forValue((c,d,p)=>{var k,y,L,R,H,E,U;const S=(L=p==null?void 0:p.v)!=null?L:(y=(k=p==null?void 0:p.p)==null?void 0:k.body)==null?void 0:y.dataStream.slice(0,-2),_=(S!=null?S:"").toString(),u=this._hyperLinkModel.getHyperLinkByLocation(n,r,c,d);if(!u){if(X(_)||(R=p==null?void 0:p.custom)!=null&&R.__link_url){const B=(E=(H=p==null?void 0:p.custom)==null?void 0:H.__link_url)!=null?E:_,M=a.Tools.generateRandomId();s.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:n,subUnitId:r,id:M}}),o.push({id:v.AddHyperLinkMutation.id,params:{unitId:n,subUnitId:r,link:{id:M,row:c,column:d,display:_,payload:ve(B)}}})}return}(S===""||((U=p==null?void 0:p.custom)==null?void 0:U.__link_url)==="")&&(o.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:n,subUnitId:r,id:u.id}}),s.push({id:v.AddHyperLinkMutation.id,params:{unitId:n,subUnitId:r,link:u}}))}),{undos:s,redos:o}}return{redos:[],undos:[]}}}))}_initClearSelectionCommandInterceptor(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{if(e.id===h.ClearSelectionContentCommand.id||e.id===h.ClearSelectionAllCommand.id||e.id===h.ClearSelectionFormatCommand.id){const t=[],n=[],r=this._selectionManagerService.getCurrentLastSelection(),o=h.getSheetCommandTarget(this._univerInstanceService);if(r&&o){const{unitId:s,subUnitId:c}=o;a.Range.foreach(r.range,(d,p)=>{const S=this._hyperLinkModel.getHyperLinkByLocation(s,c,d,p);S&&(t.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:s,subUnitId:c,id:S.id}}),n.push({id:v.AddHyperLinkMutation.id,params:{unitId:s,subUnitId:c,link:S}}))})}return{redos:t,undos:n}}return{redos:[],undos:[]}}}))}_initRichTextEditorInterceptor(){this.disposeWithMe(this._editorBridgeService.interceptor.intercept(this._editorBridgeService.interceptor.getInterceptPoints().AFTER_CELL_EDIT,{handler:(e,t,n)=>{var r,o,s,c,d,p;if(e!=null&&e.p){const S=(o=(r=e.p.body)==null?void 0:r.customRanges)==null?void 0:o.find(u=>u.rangeType===a.CustomRangeType.HYPERLINK),_=(s=e.p.resources)==null?void 0:s.find(u=>u.name===De.DOC_HYPER_LINK_PLUGIN);if(S&&_){const u=S.rangeId,k=(p=(d=(c=JSON.parse(_.data))==null?void 0:c.links)==null?void 0:d.find(y=>y.id===u))==null?void 0:p.payload;return n({...e,p:null,v:Ae.getPlainTextFormDocument(e.p),t:a.CellValueType.STRING,custom:{__link_url:k}})}}return n(e)}}))}},l.SheetHyperLinkSetRangeController=Ln([a.OnLifecycle(a.LifecycleStages.Starting,l.SheetHyperLinkSetRangeController),K(0,a.Inject(h.SheetInterceptorService)),K(1,a.Inject(a.Injector)),K(2,a.Inject(v.HyperLinkModel)),K(3,a.Inject(h.SheetsSelectionsService)),K(4,a.IUniverInstanceService),K(5,f.IEditorBridgeService)],l.SheetHyperLinkSetRangeController);var kn=Object.defineProperty,In=Object.getOwnPropertyDescriptor,Rn=(i,e,t,n)=>{for(var r=n>1?void 0:n?In(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&kn(e,t,r),r},Q=(i,e)=>(t,n)=>e(t,n,i);l.SheetsHyperLinkPopupController=class extends a.Disposable{constructor(e,t,n,r,o){super(),this._hoverManagerService=e,this._sheetsHyperLinkPopupService=t,this._renderManagerService=n,this._permissionService=r,this._sheetPermissionInterceptorBaseController=o,this._initHoverListener()}_initHoverListener(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(ne.debounceTime(200)).subscribe(e=>{var u,k;if(!e){this._sheetsHyperLinkPopupService.hideCurrentPopup();return}const t=(k=(u=this._renderManagerService.getRenderById(e.location.unitId))==null?void 0:u.with(f.SheetSkeletonManagerService).getWorksheetSkeleton(e.location.subUnitId))==null?void 0:k.skeleton,n=e.location.col,r=e.location.row;let o=r,s=n;if(t&&t.overflowCache.forValue((y,L,R)=>{a.Rectangle.contains(R,{startColumn:n,endColumn:n,startRow:r,endRow:r})&&(o=y,s=L)}),!this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[h.WorkbookViewPermission],worksheetTypes:[h.WorksheetViewPermission],rangeTypes:[h.RangeProtectionPermissionViewPoint]},[{startRow:r,startColumn:n,endRow:r,endColumn:n}])){this._sheetsHyperLinkPopupService.hideCurrentPopup();return}const d=this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[h.WorkbookEditablePermission],worksheetTypes:[h.WorksheetEditPermission,h.WorksheetInsertHyperlinkPermission],rangeTypes:[h.RangeProtectionPermissionEditPoint]},[{startRow:r,startColumn:n,endRow:r,endColumn:n}]),p=e.location.unitId,S=e.location.subUnitId,_=this._permissionService.composePermission([new h.WorkbookCopyPermission(p).id,new h.WorksheetCopyPermission(p,S).id]).every(y=>y.value);this._sheetsHyperLinkPopupService.showPopup({...e.location,row:o,col:s,editPermission:d,copyPermission:_})}))}},l.SheetsHyperLinkPopupController=Rn([a.OnLifecycle(a.LifecycleStages.Rendered,l.SheetsHyperLinkPopupController),Q(0,a.Inject(f.HoverManagerService)),Q(1,a.Inject(l.SheetsHyperLinkPopupService)),Q(2,a.Inject(pe.IRenderManagerService)),Q(3,a.Inject(a.IPermissionService)),Q(4,a.Inject(f.SheetPermissionInterceptorBaseController))],l.SheetsHyperLinkPopupController);const Pn=i=>({id:ae.id,type:O.MenuItemType.BUTTON,positions:[O.MenuPosition.CONTEXT_MENU],title:"hyperLink.menu.add",hidden$:O.getMenuHiddenObservable(i,a.UniverInstanceType.UNIVER_SHEET),icon:"LinkSingle",disabled$:f.getCurrentRangeDisable$(i,{workbookTypes:[h.WorkbookEditablePermission],worksheetTypes:[h.WorksheetEditPermission,h.WorksheetSetCellValuePermission,h.WorksheetInsertHyperlinkPermission],rangeTypes:[h.RangeProtectionPermissionEditPoint]})}),bn=i=>({tooltip:"hyperLink.form.addTitle",positions:O.MenuPosition.TOOLBAR_START,group:O.MenuGroup.TOOLBAR_OTHERS,id:ge.id,type:O.MenuItemType.BUTTON,icon:"LinkSingle",hidden$:O.getMenuHiddenObservable(i,a.UniverInstanceType.UNIVER_SHEET),disabled$:f.getCurrentRangeDisable$(i,{workbookTypes:[h.WorkbookEditablePermission],worksheetTypes:[h.WorksheetEditPermission,h.WorksheetSetCellValuePermission,h.WorksheetInsertHyperlinkPermission],rangeTypes:[h.RangeProtectionPermissionEditPoint]})}),Se={id:ge.id,binding:O.KeyCode.K|O.MetaKeys.CTRL_COMMAND,preconditions:f.whenSheetEditorFocused};var En=Object.defineProperty,On=Object.getOwnPropertyDescriptor,Mn=(i,e,t,n)=>{for(var r=n>1?void 0:n?On(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&En(e,t,r),r},z=(i,e)=>(t,n)=>e(t,n,i);l.SheetsHyperLinkUIController=class extends a.Disposable{constructor(e,t,n,r,o,s,c){super(),this._config=e,this._componentManager=t,this._commandService=n,this._localeService=r,this._menuService=o,this._injector=s,this._shortcutService=c,this._initComponents(),this._initCommands(),this._initMenus(),this._initShortCut()}_initComponents(){[[le,le.componentKey],[oe,oe.componentKey],[ie,"LinkSingle"]].forEach(([e,t])=>{this._componentManager.register(t,e)})}_initCommands(){[se,J,ae,ge].forEach(e=>{this._commandService.registerCommand(e)})}_initMenus(){var e,t,n,r;this._menuService.addMenuItem(Pn(this._injector),(t=(e=this._config)==null?void 0:e.menu)!=null?t:{}),this._menuService.addMenuItem(bn(this._injector),(r=(n=this._config)==null?void 0:n.menu)!=null?r:{})}_initShortCut(){this._shortcutService.registerShortcut(Se)}},l.SheetsHyperLinkUIController=Mn([a.OnLifecycle(a.LifecycleStages.Ready,l.SheetsHyperLinkUIController),z(1,a.Inject(O.ComponentManager)),z(2,a.ICommandService),z(3,a.Inject(a.LocaleService)),z(4,O.IMenuService),z(5,a.Inject(a.Injector)),z(6,a.Inject(O.IShortcutService))],l.SheetsHyperLinkUIController);const ye="SHEET_HYPER_LINK_UI_PLUGIN";var wn=Object.defineProperty,Hn=Object.getOwnPropertyDescriptor,Tn=(i,e,t,n)=>{for(var r=n>1?void 0:n?Hn(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&wn(e,t,r),r},He=(i,e)=>(t,n)=>e(t,n,i);l.SheetsHyperLinkAutoFillController=class extends a.Disposable{constructor(e,t){super(),this._autoFillService=e,this._hyperLinkModel=t,this._initAutoFill()}_initAutoFill(){const e=()=>({redos:[],undos:[]}),t=(r,o)=>{const{source:s,target:c,unitId:d,subUnitId:p}=r,S=f.virtualizeDiscreteRanges([s,c]),[_,u]=S.ranges,{mapFunc:k}=S,y={row:_.startRow,col:_.startColumn},L=f.getAutoFillRepeatRange(_,u),R=[],H=[];return L.forEach(E=>{const U=E.repeatStartCell,B=E.relativeRange,M={startRow:y.row,startColumn:y.col,endColumn:y.col,endRow:y.row},Z={startRow:U.row,startColumn:U.col,endColumn:U.col,endRow:U.row};a.Range.foreach(B,(x,W)=>{const q=a.Rectangle.getPositionRange({startRow:x,startColumn:W,endColumn:W,endRow:x},M),{row:_e,col:Ce}=k(q.startRow,q.startColumn),ee=this._hyperLinkModel.getHyperLinkByLocation(d,p,_e,Ce);if(ee){const g=a.Rectangle.getPositionRange({startRow:x,startColumn:W,endColumn:W,endRow:x},Z),{row:P,col:w}=k(g.startRow,g.startColumn),b=a.Tools.generateRandomId(),T=this._hyperLinkModel.getHyperLinkByLocation(d,p,P,w);T&&R.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:d,subUnitId:p,id:T.id}}),(f.APPLY_TYPE.COPY===o||f.APPLY_TYPE.SERIES===o)&&(R.push({id:v.AddHyperLinkMutation.id,params:{unitId:d,subUnitId:p,link:{...ee,id:b,row:P,column:w}}}),H.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:d,subUnitId:p,id:b}})),T&&H.push({id:v.AddHyperLinkMutation.id,params:{unitId:d,subUnitId:p,link:T}})}})}),{undos:H,redos:R}},n={id:ye,onFillData:(r,o,s)=>s===f.APPLY_TYPE.COPY||s===f.APPLY_TYPE.ONLY_FORMAT||s===f.APPLY_TYPE.SERIES?t(r,s):e()};this.disposeWithMe(this._autoFillService.addHook(n))}},l.SheetsHyperLinkAutoFillController=Tn([a.OnLifecycle(a.LifecycleStages.Ready,l.SheetsHyperLinkAutoFillController),He(0,f.IAutoFillService),He(1,a.Inject(v.HyperLinkModel))],l.SheetsHyperLinkAutoFillController);var jn=Object.defineProperty,Un=Object.getOwnPropertyDescriptor,Nn=(i,e,t,n)=>{for(var r=n>1?void 0:n?Un(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&jn(e,t,r),r},ce=(i,e)=>(t,n)=>e(t,n,i);l.SheetsHyperLinkCopyPasteController=class extends a.Disposable{constructor(t,n,r,o){super();$(this,"_copyInfo");this._sheetClipboardService=t,this._hyperLinkModel=n,this._injector=r,this._resolverService=o,this._initCopyPaste()}_initCopyPaste(){this._sheetClipboardService.addClipboardHook({id:ye,onBeforeCopy:(t,n,r)=>this._collect(t,n,r),onPasteCells:(t,n,r,o)=>{const{copyType:s=f.COPY_TYPE.COPY,pasteType:c}=o,{range:d}=t||{},{range:p,unitId:S,subUnitId:_}=n;return this._generateMutations(p,{copyType:s,pasteType:c,copyRange:d,unitId:S,subUnitId:_})},onPastePlainText:(t,n)=>{if(X(n)){const r=ve(n),{range:o,unitId:s,subUnitId:c}=t,{ranges:[d],mapFunc:p}=f.virtualizeDiscreteRanges([o]),S=[],_=[];return a.Range.foreach(d,(u,k)=>{const{row:y,col:L}=p(u,k),R=this._hyperLinkModel.getHyperLinkByLocation(s,c,y,L);R&&S.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:s,subUnitId:c,id:R.id}});const H=a.Tools.generateRandomId();S.push({id:v.AddHyperLinkMutation.id,params:{unitId:s,subUnitId:c,link:{id:H,row:y,column:L,payload:r}}}),_.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:s,subUnitId:c,id:H}}),R&&_.push({id:v.AddHyperLinkMutation.id,params:{unitId:s,subUnitId:c,link:R}})}),{redos:S,undos:_}}return{undos:[],redos:[]}}})}_collect(t,n,r){const o=new a.ObjectMatrix;this._copyInfo={unitId:t,subUnitId:n,matrix:o};const s={get:this._injector.get.bind(this._injector)},c=f.rangeToDiscreteRange(r,s,t,n);if(!c)return;const{rows:d,cols:p}=c;d.forEach((S,_)=>{p.forEach((u,k)=>{var L;const y=this._hyperLinkModel.getHyperLinkByLocation(t,n,S,u);o.setValue(_,k,(L=y==null?void 0:y.id)!=null?L:"")})})}_generateMutations(t,n){if(!this._copyInfo)return{redos:[],undos:[]};if(!this._copyInfo||!this._copyInfo.matrix.getSizeOf()||!n.copyRange)return{redos:[],undos:[]};if([f.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_COL_WIDTH,f.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_VALUE,f.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT,f.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMULA].includes(n.pasteType))return{redos:[],undos:[]};const{unitId:r,subUnitId:o}=this._copyInfo,s=[],c=[],{ranges:[d,p],mapFunc:S}=f.virtualizeDiscreteRanges([n.copyRange,t]);return f.getRepeatRange(d,p,!0).forEach(({startRange:u})=>{var k;(k=this._copyInfo)==null||k.matrix.forValue((y,L,R)=>{const H=a.Rectangle.getPositionRange({startRow:y,endRow:y,startColumn:L,endColumn:L},u),E=this._hyperLinkModel.getHyperLink(r,o,R),{row:U,col:B}=S(H.startRow,H.startColumn),M=this._hyperLinkModel.getHyperLinkByLocation(n.unitId,n.subUnitId,U,B),Z=a.Tools.generateRandomId();M&&s.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:n.unitId,subUnitId:n.subUnitId,id:M.id}}),E&&(s.push({id:v.AddHyperLinkMutation.id,params:{unitId:n.unitId,subUnitId:n.subUnitId,link:{...E,id:Z,row:U,column:B}}}),c.push({id:v.RemoveHyperLinkMutation.id,params:{unitId:n.unitId,subUnitId:n.subUnitId,id:Z}})),M&&c.push({id:v.AddHyperLinkMutation.id,params:{unitId:n.unitId,subUnitId:n.subUnitId,link:M}})})}),{redos:s,undos:c}}},l.SheetsHyperLinkCopyPasteController=Nn([a.OnLifecycle(a.LifecycleStages.Ready,l.SheetsHyperLinkCopyPasteController),ce(0,f.ISheetClipboardService),ce(1,a.Inject(v.HyperLinkModel)),ce(2,a.Inject(a.Injector)),ce(3,a.Inject(l.SheetsHyperLinkResolverService))],l.SheetsHyperLinkCopyPasteController);var Dn=Object.defineProperty,An=Object.getOwnPropertyDescriptor,Vn=(i,e,t,n)=>{for(var r=n>1?void 0:n?An(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Dn(e,t,r),r},Bn=(i,e)=>(t,n)=>e(t,n,i);l.SheetHyperLinkUrlController=class extends a.Disposable{constructor(e){super(),this._resolverService=e,this._handleInitUrl()}_handleInitUrl(){const e=location.hash;e&&this._resolverService.parseHyperLink(e).handler()}},l.SheetHyperLinkUrlController=Vn([a.OnLifecycle(a.LifecycleStages.Rendered,l.SheetHyperLinkUrlController),Bn(0,a.Inject(l.SheetsHyperLinkResolverService))],l.SheetHyperLinkUrlController);var xn=Object.defineProperty,Wn=Object.getOwnPropertyDescriptor,Fn=(i,e,t,n)=>{for(var r=n>1?void 0:n?Wn(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&xn(e,t,r),r},fe=(i,e)=>(t,n)=>e(t,n,i);let de=class extends a.Disposable{constructor(i,e,t){super(),this._localeService=i,this._commandService=e,this._sheetPermissionInterceptorBaseController=t,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(i=>{i.id===Se.id&&(this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[h.WorkbookEditablePermission],rangeTypes:[h.RangeProtectionPermissionEditPoint],worksheetTypes:[h.WorksheetEditPermission,h.WorksheetSetCellValuePermission,h.WorksheetInsertHyperlinkPermission]})||this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.hyperLinkErr")))}))}};de=Fn([a.OnLifecycle(a.LifecycleStages.Rendered,de),fe(0,a.Inject(a.LocaleService)),fe(1,a.ICommandService),fe(2,a.Inject(f.SheetPermissionInterceptorBaseController))],de);var Te=Object.defineProperty,$n=Object.getOwnPropertyDescriptor,Yn=(i,e,t)=>e in i?Te(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,Kn=(i,e,t,n)=>{for(var r=n>1?void 0:n?$n(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Te(e,t,r),r},je=(i,e)=>(t,n)=>e(t,n,i),Ue=(i,e,t)=>Yn(i,typeof e!="symbol"?e+"":e,t);l.UniverSheetsHyperLinkUIPlugin=class extends a.Plugin{constructor(e,t,n){super(),this._config=e,this._injector=t,this._renderManagerService=n}onStarting(e){[[l.SheetsHyperLinkResolverService],[l.SheetsHyperLinkPopupService],[l.SheetsHyperLinkRemoveSheetController],[l.SheetsHyperLinkRenderManagerController],[l.SheetHyperLinkSetRangeController],[l.SheetsHyperLinkPopupController],[l.SheetsHyperLinkUIController,{useFactory:()=>this._injector.createInstance(l.SheetsHyperLinkUIController,this._config)}],[l.SheetsHyperLinkAutoFillController],[l.SheetsHyperLinkCopyPasteController],[de],[l.SheetHyperLinkUrlController]].forEach(n=>e.add(n))}onReady(){[[l.SheetsHyperLinkRenderController]].forEach(t=>this._renderManagerService.registerRenderModule(a.UniverInstanceType.UNIVER_SHEET,t))}},Ue(l.UniverSheetsHyperLinkUIPlugin,"pluginName",ye),Ue(l.UniverSheetsHyperLinkUIPlugin,"type",a.UniverInstanceType.UNIVER_SHEET),l.UniverSheetsHyperLinkUIPlugin=Kn([a.DependentOn(v.UniverSheetsHyperLinkPlugin),je(1,a.Inject(a.Injector)),je(2,pe.IRenderManagerService)],l.UniverSheetsHyperLinkUIPlugin),l.CloseHyperLinkSidebarOperation=J,l.InsertHyperLinkOperation=ae,l.InsertLinkShortcut=Se,l.OpenHyperLinkSidebarOperation=se,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/sheets-hyper-link-ui",
3
- "version": "0.2.4-alpha.0",
3
+ "version": "0.2.5",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -53,20 +53,20 @@
53
53
  "clsx": ">=2.0.0",
54
54
  "react": "^16.9.0 || ^17.0.0 || ^18.0.0",
55
55
  "rxjs": ">=7.0.0",
56
- "@univerjs/core": "0.2.4-alpha.0",
57
- "@univerjs/docs": "0.2.4-alpha.0",
58
- "@univerjs/docs-hyper-link": "0.2.4-alpha.0",
59
- "@univerjs/design": "0.2.4-alpha.0",
60
- "@univerjs/engine-formula": "0.2.4-alpha.0",
61
- "@univerjs/engine-render": "0.2.4-alpha.0",
62
- "@univerjs/sheets-hyper-link": "0.2.4-alpha.0",
63
- "@univerjs/ui": "0.2.4-alpha.0",
64
- "@univerjs/sheets-ui": "0.2.4-alpha.0",
65
- "@univerjs/sheets": "0.2.4-alpha.0"
56
+ "@univerjs/core": "0.2.5",
57
+ "@univerjs/docs": "0.2.5",
58
+ "@univerjs/design": "0.2.5",
59
+ "@univerjs/docs-hyper-link": "0.2.5",
60
+ "@univerjs/engine-render": "0.2.5",
61
+ "@univerjs/sheets": "0.2.5",
62
+ "@univerjs/sheets-hyper-link": "0.2.5",
63
+ "@univerjs/engine-formula": "0.2.5",
64
+ "@univerjs/sheets-ui": "0.2.5",
65
+ "@univerjs/ui": "0.2.5"
66
66
  },
67
67
  "dependencies": {
68
- "@univerjs/icons": "^0.1.64",
69
- "@univerjs/sheets-hyper-link": "0.2.4-alpha.0"
68
+ "@univerjs/icons": "^0.1.65",
69
+ "@univerjs/sheets-hyper-link": "0.2.5"
70
70
  },
71
71
  "devDependencies": {
72
72
  "clsx": "^2.1.1",
@@ -74,15 +74,15 @@
74
74
  "typescript": "^5.5.3",
75
75
  "vite": "^5.3.4",
76
76
  "vitest": "^2.0.3",
77
- "@univerjs/core": "0.2.4-alpha.0",
78
- "@univerjs/docs-hyper-link": "0.2.4-alpha.0",
79
- "@univerjs/docs": "0.2.4-alpha.0",
80
- "@univerjs/engine-render": "0.2.4-alpha.0",
81
- "@univerjs/engine-formula": "0.2.4-alpha.0",
82
- "@univerjs/shared": "0.2.4-alpha.0",
83
- "@univerjs/sheets": "0.2.4-alpha.0",
84
- "@univerjs/ui": "0.2.4-alpha.0",
85
- "@univerjs/sheets-ui": "0.2.4-alpha.0"
77
+ "@univerjs/docs": "0.2.5",
78
+ "@univerjs/docs-hyper-link": "0.2.5",
79
+ "@univerjs/engine-formula": "0.2.5",
80
+ "@univerjs/engine-render": "0.2.5",
81
+ "@univerjs/shared": "0.2.5",
82
+ "@univerjs/core": "0.2.5",
83
+ "@univerjs/sheets": "0.2.5",
84
+ "@univerjs/ui": "0.2.5",
85
+ "@univerjs/sheets-ui": "0.2.5"
86
86
  },
87
87
  "univerSpace": {
88
88
  ".": {