@univerjs/sheets-conditional-formatting-ui 0.10.10 → 0.10.11
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 +1 -1
- package/lib/es/index.js +1 -1
- package/lib/index.css +1 -1
- package/lib/index.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +14 -14
package/lib/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Et=Object.defineProperty;var jt=(t,e,i)=>e in t?Et(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i;var ee=(t,e,i)=>jt(t,typeof e!="symbol"?e+"":e,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@univerjs/core"),U=require("@univerjs/sheets"),n=require("@univerjs/sheets-conditional-formatting"),P=require("@univerjs/ui"),u=require("react/jsx-runtime"),C=require("react"),M=require("@univerjs/design"),qe=require("@univerjs/engine-formula"),xe=require("@univerjs/sheets-formula-ui"),B=require("@univerjs/sheets-ui"),X=require("rxjs"),ht=require("@univerjs/engine-render"),fe=require("rxjs/operators"),Ge={type:a.CommandType.COMMAND,id:"sheet.command.add-average-conditional-rule",handler(t,e){if(!e)return!1;const{ranges:i,style:r,stopIfTrue:s,operator:o}=e,l=t.get(n.ConditionalFormattingRuleModel),v=t.get(a.ICommandService),c=t.get(a.IUniverInstanceService),h=U.getSheetCommandTarget(c);if(!h)return!1;const{unitId:d,subUnitId:m}=h,g=l.createCfId(d,m),b={ranges:i,cfId:g,stopIfTrue:!!s,rule:{type:n.CFRuleType.highlightCell,subType:n.CFSubRuleType.average,operator:o,style:r}};return v.executeCommand(n.AddConditionalRuleMutation.id,{unitId:d,subUnitId:m,rule:b})}},Ze={type:a.CommandType.COMMAND,id:"sheet.command.add-color-scale-conditional-rule",handler(t,e){if(!e)return!1;const{ranges:i,config:r,stopIfTrue:s}=e,o=t.get(n.ConditionalFormattingRuleModel),l=t.get(a.ICommandService),v=t.get(a.IUniverInstanceService),c=U.getSheetCommandTarget(v);if(!c)return!1;const{unitId:h,subUnitId:d}=c,m=o.createCfId(h,d),g={ranges:i,cfId:m,stopIfTrue:!!s,rule:{type:n.CFRuleType.colorScale,config:r}};return l.executeCommand(n.AddConditionalRuleMutation.id,{unitId:h,subUnitId:d,rule:g})}},ze={type:a.CommandType.COMMAND,id:"sheet.command.add-data-bar-conditional-rule",handler(t,e){if(!e)return!1;const{ranges:i,min:r,max:s,nativeColor:o,positiveColor:l,isGradient:v,stopIfTrue:c,isShowValue:h}=e,d=t.get(n.ConditionalFormattingRuleModel),m=t.get(a.IUniverInstanceService),g=U.getSheetCommandTarget(m);if(!g)return!1;const{unitId:b,subUnitId:S}=g,y=t.get(a.ICommandService),_=d.createCfId(b,S),T={ranges:i,cfId:_,stopIfTrue:!!c,rule:{type:n.CFRuleType.dataBar,isShowValue:h,config:{min:r,max:s,nativeColor:o,positiveColor:l,isGradient:v}}};return y.executeCommand(n.AddConditionalRuleMutation.id,{unitId:b,subUnitId:S,rule:T})}},Ye={type:a.CommandType.COMMAND,id:"sheet.command.add-duplicate-values-conditional-rule",handler(t,e){if(!e)return!1;const{ranges:i,style:r,stopIfTrue:s}=e,o=t.get(n.ConditionalFormattingRuleModel),l=t.get(a.ICommandService),v=t.get(a.IUniverInstanceService),c=U.getSheetCommandTarget(v);if(!c)return!1;const{unitId:h,subUnitId:d}=c,m=o.createCfId(h,d),g={ranges:i,cfId:m,stopIfTrue:!!s,rule:{type:n.CFRuleType.highlightCell,subType:n.CFSubRuleType.duplicateValues,style:r}};return l.executeCommand(n.AddConditionalRuleMutation.id,{unitId:h,subUnitId:d,rule:g})}},Ke={type:a.CommandType.COMMAND,id:"sheet.command.add-number-conditional-rule",handler(t,e){if(!e)return!1;const{ranges:i,style:r,stopIfTrue:s,operator:o,value:l}=e,v=t.get(n.ConditionalFormattingRuleModel),c=t.get(a.ICommandService),h=t.get(a.IUniverInstanceService),d=U.getSheetCommandTarget(h);if(!d)return!1;const{unitId:m,subUnitId:g}=d,b=v.createCfId(m,g);let S;if([n.CFNumberOperator.between,n.CFNumberOperator.notBetween].includes(o)){const y=l;if(y.length!==2||!Array.isArray(y))return!1;S={ranges:i,cfId:b,stopIfTrue:!!s,rule:{type:n.CFRuleType.highlightCell,subType:n.CFSubRuleType.number,operator:o,style:r,value:y}}}else{const y=l;if(typeof y!="number")return!1;S={ranges:i,cfId:b,stopIfTrue:!!s,rule:{type:n.CFRuleType.highlightCell,subType:n.CFSubRuleType.number,operator:o,style:r,value:y}}}return c.executeCommand(n.AddConditionalRuleMutation.id,{unitId:m,subUnitId:g,rule:S})}},Xe={type:a.CommandType.COMMAND,id:"sheet.command.add-rank-conditional-rule",handler(t,e){if(!e)return!1;const{ranges:i,style:r,stopIfTrue:s,isPercent:o,isBottom:l,value:v}=e,c=t.get(n.ConditionalFormattingRuleModel),h=t.get(a.IUniverInstanceService),d=t.get(a.ICommandService),m=U.getSheetCommandTarget(h);if(!m)return!1;const{unitId:g,subUnitId:b}=m,S=c.createCfId(g,b),y={ranges:i,cfId:S,stopIfTrue:!!s,rule:{type:n.CFRuleType.highlightCell,subType:n.CFSubRuleType.rank,isPercent:o,isBottom:l,style:r,value:v}};return d.executeCommand(n.AddConditionalRuleMutation.id,{unitId:g,subUnitId:b,rule:y})}},Je={type:a.CommandType.COMMAND,id:"sheet.command.add-text-conditional-rule",handler(t,e){if(!e)return!1;const{ranges:i,style:r,stopIfTrue:s,operator:o,value:l}=e,v=t.get(n.ConditionalFormattingRuleModel),c=t.get(a.IUniverInstanceService),h=U.getSheetCommandTarget(c);if(!h)return!1;const{unitId:d,subUnitId:m}=h,g=t.get(a.ICommandService),b=v.createCfId(d,m),S={ranges:i,cfId:b,stopIfTrue:!!s,rule:{type:n.CFRuleType.highlightCell,subType:n.CFSubRuleType.text,operator:o,style:r,value:l}};return g.executeCommand(n.AddConditionalRuleMutation.id,{unitId:d,subUnitId:m,rule:S})}},Qe={type:a.CommandType.COMMAND,id:"sheet.command.add-time-period-conditional-rule",handler(t,e){if(!e)return!1;const{ranges:i,style:r,stopIfTrue:s,operator:o}=e,l=t.get(n.ConditionalFormattingRuleModel),v=t.get(a.IUniverInstanceService),c=t.get(a.ICommandService),h=U.getSheetCommandTarget(v);if(!h)return!1;const{unitId:d,subUnitId:m}=h,g=l.createCfId(d,m),b={ranges:i,cfId:g,stopIfTrue:!!s,rule:{type:n.CFRuleType.highlightCell,subType:n.CFSubRuleType.timePeriod,operator:o,style:r}};return c.executeCommand(n.AddConditionalRuleMutation.id,{unitId:d,subUnitId:m,rule:b})}},et={type:a.CommandType.COMMAND,id:"sheet.command.add-uniqueValues-conditional-rule",handler(t,e){if(!e)return!1;const{ranges:i,style:r,stopIfTrue:s}=e,o=t.get(n.ConditionalFormattingRuleModel),l=t.get(a.IUniverInstanceService),v=t.get(a.ICommandService),c=U.getSheetCommandTarget(l);if(!c)return!1;const{unitId:h,subUnitId:d}=c,m=o.createCfId(h,d),g={ranges:i,cfId:m,stopIfTrue:!!s,rule:{type:n.CFRuleType.highlightCell,subType:n.CFSubRuleType.uniqueValues,style:r}};return v.executeCommand(n.AddConditionalRuleMutation.id,{unitId:h,subUnitId:d,rule:g})}};var Y=function(){return Y=Object.assign||function(t){for(var e,i=1,r=arguments.length;i<r;i++){e=arguments[i];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s])}return t},Y.apply(this,arguments)},Mt=function(t,e){var i={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(i[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(i[r[s]]=t[r[s]]);return i},K=C.forwardRef(function(t,e){var i=t.icon,r=t.id,s=t.className,o=t.extend,l=Mt(t,["icon","id","className","extend"]),v="univerjs-icon univerjs-icon-".concat(r," ").concat(s||"").trim(),c=C.useRef("_".concat(Ut()));return gt(i,"".concat(r),{defIds:i.defIds,idSuffix:c.current},Y({ref:e,className:v},l),o)});function gt(t,e,i,r,s){return C.createElement(t.tag,Y(Y({key:e},Vt(t,i,s)),r),(Ot(t,i).children||[]).map(function(o,l){return gt(o,"".concat(e,"-").concat(t.tag,"-").concat(l),i,void 0,s)}))}function Vt(t,e,i){var r=Y({},t.attrs);i!=null&&i.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=i.colorChannel1),t.tag==="mask"&&r.id&&(r.id=r.id+e.idSuffix),Object.entries(r).forEach(function(o){var l=o[0],v=o[1];l==="mask"&&typeof v=="string"&&(r[l]=v.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))});var s=e.defIds;return!s||s.length===0||(t.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+e.idSuffix),Object.entries(r).forEach(function(o){var l=o[0],v=o[1];typeof v=="string"&&(r[l]=v.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),r}function Ot(t,e){var i,r=e.defIds;return!r||r.length===0?t:t.tag==="defs"&&(!((i=t.children)===null||i===void 0)&&i.length)?Y(Y({},t),{children:t.children.map(function(s){return typeof s.attrs.id=="string"&&r&&r.includes(s.attrs.id)?Y(Y({},s),{attrs:Y(Y({},s.attrs),{id:s.attrs.id+e.idSuffix})}):s})}):t}function Ut(){return Math.random().toString(36).substring(2,8)}K.displayName="UniverIcon";var kt={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M4.65791 1.30005C3.77355 1.30005 3.05664 2.01696 3.05664 2.90132V12.8588C3.05664 13.8755 3.88086 14.6998 4.89759 14.6998H9.1016C11.2233 14.6998 12.9433 12.9798 12.9433 10.8581C12.9433 9.13925 11.8145 7.68407 10.2578 7.1934C10.8806 6.56856 11.2655 5.70659 11.2655 4.75472C11.2655 2.84676 9.71883 1.30005 7.81087 1.30005H4.65791ZM4.25664 2.90132C4.25664 2.6797 4.4363 2.50005 4.65791 2.50005H7.81087C9.05609 2.50005 10.0655 3.5095 10.0655 4.75472C10.0655 5.99993 9.05609 7.00938 7.81087 7.00938H4.25664V2.90132ZM4.25664 12.8588V8.21636H9.1016C10.5606 8.21636 11.7433 9.39909 11.7433 10.8581C11.7433 12.317 10.5606 13.4998 9.1016 13.4998H4.89759C4.5436 13.4998 4.25664 13.2128 4.25664 12.8588Z",fillRule:"evenodd",clipRule:"evenodd"}}]},pt=C.forwardRef(function(t,e){return C.createElement(K,Object.assign({},t,{id:"bold-icon",ref:e,icon:kt}))});pt.displayName="BoldIcon";var Pt={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.3313 1.4667C5.3313 1.13533 5.59993 0.866699 5.9313 0.866699H10.069C10.4004 0.866699 10.669 1.13533 10.669 1.4667C10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443C14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928L9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171C10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778L9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539C9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263L6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539C5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778L6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Ve=C.forwardRef(function(t,e){return C.createElement(K,Object.assign({},t,{id:"delete-icon",ref:e,icon:Pt}))});Ve.displayName="DeleteIcon";var Dt={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"colorChannel1",d:"M1.98682 13.4992C1.98682 12.5603 2.74793 11.7992 3.68682 11.7992H14.2868C15.2257 11.7992 15.9868 12.5603 15.9868 13.4992V13.4992C15.9868 14.4381 15.2257 15.1992 14.2868 15.1992H3.68682C2.74793 15.1992 1.98682 14.4381 1.98682 13.4992V13.4992Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M10.3014 1.70389C9.85268 0.479568 8.12109 0.479557 7.67238 1.70389L4.72235 9.75326C4.60832 10.0644 4.76811 10.4091 5.07924 10.5231C5.39038 10.6371 5.73504 10.4773 5.84907 10.1662L6.99975 7.02646C7.03588 7.03324 7.07314 7.03679 7.11123 7.03679H10.9778L12.1247 10.1662C12.2387 10.4773 12.5834 10.6371 12.8945 10.5231C13.2057 10.4091 13.3654 10.0644 13.2514 9.75326L10.3014 1.70389ZM10.538 5.83679L9.17467 2.11682C9.11057 1.94192 8.8632 1.94192 8.7991 2.11682L7.43576 5.83679H10.538Z",fillRule:"evenodd",clipRule:"evenodd"}}]},ft=C.forwardRef(function(t,e){return C.createElement(K,Object.assign({},t,{id:"font-color-double-icon",ref:e,icon:Dt}))});ft.displayName="FontColorDoubleIcon";var Lt={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z"}}]},Ct=C.forwardRef(function(t,e){return C.createElement(K,Object.assign({},t,{id:"increase-icon",ref:e,icon:Lt}))});Ct.displayName="IncreaseIcon";var At={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M9.80385 1.40005H11.9997C12.3311 1.40005 12.5997 1.66868 12.5997 2.00005C12.5997 2.33143 12.3311 2.60005 11.9997 2.60005H10.1185L7.12251 13.4001H9.33324C9.66461 13.4001 9.93324 13.6687 9.93324 14.0001C9.93324 14.3314 9.66461 14.6001 9.33324 14.6001H6.34785C6.33847 14.6003 6.32905 14.6003 6.31962 14.6001H3.9999C3.66853 14.6001 3.3999 14.3314 3.3999 14.0001C3.3999 13.6687 3.66853 13.4001 3.9999 13.4001H5.87719L8.87322 2.60005H6.66641C6.33504 2.60005 6.06641 2.33143 6.06641 2.00005C6.06641 1.66868 6.33504 1.40005 6.66641 1.40005H9.52916C9.61698 1.37929 9.71064 1.3781 9.80385 1.40005Z"}}]},yt=C.forwardRef(function(t,e){return C.createElement(K,Object.assign({},t,{id:"italic-icon",ref:e,icon:At}))});yt.displayName="ItalicIcon";var $t={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M11.3536 6.14645C11.5488 6.34171 11.5488 6.65829 11.3536 6.85355L8.35355 9.85355C8.15829 10.0488 7.84171 10.0488 7.64645 9.85355L4.64645 6.85355C4.45118 6.65829 4.45118 6.34171 4.64645 6.14645C4.84171 5.95118 5.15829 5.95118 5.35355 6.14645L8 8.79289L10.6464 6.14645C10.8417 5.95118 11.1583 5.95118 11.3536 6.14645Z",fillRule:"evenodd",clipRule:"evenodd"}}]},tt=C.forwardRef(function(t,e){return C.createElement(K,Object.assign({},t,{id:"more-down-icon",ref:e,icon:$t}))});tt.displayName="MoreDownIcon";var Ht={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.01281 1.36643C8.79386 0.585377 10.0602 0.585378 10.8412 1.36643L12.9223 3.44752C13.7034 4.22857 13.7034 5.4949 12.9223 6.27595L9.36445 9.83383C8.5834 10.6149 7.31707 10.6149 6.53602 9.83383L4.45493 7.75273C3.67388 6.97168 3.67388 5.70535 4.45493 4.9243L8.01281 1.36643ZM9.9927 2.21495C9.68028 1.90253 9.17375 1.90253 8.86133 2.21495L5.30346 5.77283L5.29671 5.77966L10.839 6.66224L12.0738 5.42742C12.3862 5.115 12.3862 4.60847 12.0738 4.29605L9.9927 2.21495Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M14.5179 9.48875C14.5179 9.99175 14.1101 10.3995 13.607 10.3995C13.1041 10.3995 12.6963 9.99175 12.6963 9.48875C12.6963 9.1773 13.0455 8.59966 13.3114 8.20487C13.4549 7.99177 13.7591 7.99177 13.9027 8.20486C14.1687 8.59965 14.5179 9.1773 14.5179 9.48875Z"}},{tag:"path",attrs:{fill:"colorChannel1",d:"M1.98682 13.4992C1.98682 12.5603 2.74793 11.7992 3.68682 11.7992H14.2868C15.2257 11.7992 15.9868 12.5603 15.9868 13.4992V13.4992C15.9868 14.4381 15.2257 15.1992 14.2868 15.1992H3.68682C2.74793 15.1992 1.98682 14.4381 1.98682 13.4992V13.4992Z"}}]},bt=C.forwardRef(function(t,e){return C.createElement(K,Object.assign({},t,{id:"paint-bucket-double-icon",ref:e,icon:Ht}))});bt.displayName="PaintBucketDoubleIcon";var Bt={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"mask",attrs:{id:"mask0_622_8",width:16,height:16,x:0,y:0,maskUnits:"userSpaceOnUse"},children:[{tag:"path",attrs:{fill:"#D9D9D9",d:"M0 0H16V16H0z"}}]},{tag:"g",attrs:{fill:"currentColor",mask:"url(#mask0_622_8)"},children:[{tag:"path",attrs:{d:"M6 5C6.55228 5 7 4.55228 7 4C7 3.44772 6.55228 3 6 3C5.44772 3 5 3.44772 5 4C5 4.55228 5.44772 5 6 5Z"}},{tag:"path",attrs:{d:"M6 9C6.55228 9 7 8.55229 7 8C7 7.44772 6.55228 7 6 7C5.44772 7 5 7.44772 5 8C5 8.55229 5.44772 9 6 9Z"}},{tag:"path",attrs:{d:"M7 12C7 12.5523 6.55228 13 6 13C5.44772 13 5 12.5523 5 12C5 11.4477 5.44772 11 6 11C6.55228 11 7 11.4477 7 12Z"}},{tag:"path",attrs:{d:"M10 5C10.5523 5 11 4.55228 11 4C11 3.44772 10.5523 3 10 3C9.44771 3 9 3.44772 9 4C9 4.55228 9.44771 5 10 5Z"}},{tag:"path",attrs:{d:"M11 8C11 8.55229 10.5523 9 10 9C9.44771 9 9 8.55229 9 8C9 7.44772 9.44771 7 10 7C10.5523 7 11 7.44772 11 8Z"}},{tag:"path",attrs:{d:"M10 13C10.5523 13 11 12.5523 11 12C11 11.4477 10.5523 11 10 11C9.44771 11 9 11.4477 9 12C9 12.5523 9.44771 13 10 13Z"}}]}]},It=C.forwardRef(function(t,e){return C.createElement(K,Object.assign({},t,{id:"sequence-icon",ref:e,icon:Bt}))});It.displayName="SequenceIcon";var Wt={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"mask",attrs:{id:"mask0_436_41",width:17,height:17,x:0,y:0,maskUnits:"userSpaceOnUse"},children:[{tag:"path",attrs:{fill:"#D9D9D9",d:"M.35.48H16.35V16.48H.35z"}}]},{tag:"g",attrs:{mask:"url(#mask0_436_41)",fillRule:"evenodd",clipRule:"evenodd"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M2.27177 13.714L13.5855 2.40025L14.434 3.24878L3.1203 14.5625L2.27177 13.714Z"}},{tag:"path",attrs:{fill:"#E5E5E5",d:"M4.2603 1.82495L2.89617 1.82495C2.23343 1.82495 1.69617 2.36221 1.69617 3.02495L1.69617 4.38908L3.02617 4.38908L3.02617 3.15495L4.2603 3.15495L4.2603 1.82495ZM15.0092 4.38908L15.0092 3.02495C15.0092 2.36221 14.4719 1.82495 13.8092 1.82495L12.4451 1.82495L12.4451 3.15495L13.6792 3.15495L13.6792 4.38908L15.0092 4.38908ZM6.98856 1.82495L6.98856 3.15495L9.71681 3.15495L9.71681 1.82495L6.98856 1.82495ZM15.0092 7.11734L13.6792 7.11734L13.6792 9.84559L15.0092 9.84559L15.0092 7.11734ZM15.0092 12.5739L13.6792 12.5739L13.6792 13.808L12.4451 13.808L12.4451 15.138L13.8092 15.138C14.4719 15.138 15.0092 14.6007 15.0092 13.938L15.0092 12.5739ZM9.71681 15.138L9.71681 13.808L6.98856 13.808L6.98856 15.138L9.71681 15.138ZM4.2603 15.138L4.2603 13.808L3.02617 13.808L3.02617 12.5739L1.69617 12.5739L1.69617 13.938C1.69617 14.6007 2.23343 15.138 2.89617 15.138L4.2603 15.138ZM1.69617 9.8456L3.02617 9.8456L3.02617 7.11734L1.69617 7.11734L1.69617 9.8456Z"}}]}]},Te=C.forwardRef(function(t,e){return C.createElement(K,Object.assign({},t,{id:"slash-icon",ref:e,icon:Wt}))});Te.displayName="SlashIcon";var qt={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.00033 1.20996C6.43345 1.20996 5.23596 1.88077 4.64804 2.94304C4.06338 3.99943 4.15123 5.32084 4.90099 6.47062C5.08199 6.7482 5.45374 6.82648 5.73131 6.64548C6.00888 6.46448 6.08716 6.09273 5.90616 5.81516C5.36418 4.98402 5.35768 4.13897 5.69797 3.52412C6.035 2.91515 6.78176 2.40996 8.00033 2.40996C9.19423 2.40996 10.0017 2.93409 10.5236 3.46755C10.7871 3.73682 10.9756 4.00712 11.0974 4.20903C11.158 4.30951 11.2013 4.39164 11.2284 4.44625C11.2419 4.47351 11.2514 4.49377 11.2568 4.50588L11.2621 4.51771C11.3901 4.82216 11.7407 4.96686 12.046 4.83992C12.3519 4.71267 12.4968 4.36149 12.3695 4.05552L11.8231 4.28278C12.3695 4.05552 12.3697 4.0558 12.3695 4.05552L12.3691 4.05437L12.3685 4.05298L12.367 4.04953L12.3629 4.03993L12.3498 4.01036C12.3388 3.98619 12.3234 3.95326 12.3033 3.91282C12.2632 3.83203 12.2043 3.72072 12.1249 3.58908C11.9666 3.32674 11.7235 2.97805 11.3814 2.62834C10.6921 1.92381 9.59192 1.20996 8.00033 1.20996Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M2.11953 8.5999H7.88935C10.1109 9.46549 10.5895 10.7649 10.4268 11.6869C10.2475 12.703 9.26939 13.5898 8.00009 13.5898C6.63323 13.5898 5.77631 13.0502 5.25534 12.528C4.99021 12.2623 4.80823 11.9965 4.69365 11.7993C4.63659 11.7011 4.59698 11.6211 4.5727 11.5686C4.56059 11.5424 4.55236 11.5231 4.54774 11.512L4.54352 11.5016C4.4267 11.193 4.0823 11.0363 3.77279 11.1516C3.46228 11.2673 3.30438 11.6129 3.4201 11.9234L3.9649 11.7203C3.4201 11.9234 3.41998 11.9231 3.4201 11.9234L3.4206 11.9247L3.42118 11.9263L3.42262 11.9301L3.42661 11.9403C3.42977 11.9484 3.43394 11.9588 3.43914 11.9713C3.44956 11.9965 3.46418 12.0304 3.48334 12.0719C3.52161 12.1547 3.57828 12.2682 3.65608 12.4021C3.81124 12.6692 4.0534 13.0223 4.40584 13.3756C5.12 14.0914 6.27196 14.7898 8.00009 14.7898C9.82574 14.7898 11.3236 13.5101 11.6085 11.8955C11.812 10.7422 11.3901 9.55402 10.2665 8.5999H13.8804C14.2117 8.5999 14.4803 8.33127 14.4803 7.9999C14.4803 7.66853 14.2117 7.3999 13.8804 7.3999H8.01411C8.0048 7.39968 7.99551 7.39969 7.98625 7.3999H2.11953C1.78816 7.3999 1.51953 7.66853 1.51953 7.9999C1.51953 8.33127 1.78816 8.5999 2.11953 8.5999Z"}}]},St=C.forwardRef(function(t,e){return C.createElement(K,Object.assign({},t,{id:"strikethrough-icon",ref:e,icon:qt}))});St.displayName="StrikethroughIcon";var Gt={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M4.46416 2.03237C4.46416 1.701 4.19553 1.43237 3.86416 1.43237C3.53279 1.43237 3.26416 1.701 3.26416 2.03237V7.33338C3.26416 10.0313 5.35834 12.2667 7.9999 12.2667C10.6415 12.2667 12.7356 10.0313 12.7356 7.33338V2.03237C12.7356 1.701 12.467 1.43237 12.1356 1.43237C11.8043 1.43237 11.5356 1.701 11.5356 2.03237V7.33338C11.5356 9.42194 9.92656 11.0667 7.9999 11.0667C6.07325 11.0667 4.46416 9.42194 4.46416 7.33338V2.03237Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M2.66641 13.4663C2.33504 13.4663 2.06641 13.7349 2.06641 14.0663C2.06641 14.3977 2.33504 14.6663 2.66641 14.6663H13.3331C13.6644 14.6663 13.9331 14.3977 13.9331 14.0663C13.9331 13.7349 13.6644 13.4663 13.3331 13.4663H2.66641Z"}}]},xt=C.forwardRef(function(t,e){return C.createElement(K,Object.assign({},t,{id:"underline-icon",ref:e,icon:Gt}))});xt.displayName="UnderlineIcon";const ie=t=>{const{color:e,onChange:i,disable:r=!1,Icon:s=bt,className:o}=t,l=C.useMemo(()=>new a.ColorKit(e),[e]),v=()=>{const c={className:M.clsx("univer-fill-primary-600",r&&o),extend:{colorChannel1:l.isValid?e:""}};return u.jsx(s,{...c})};return r?v():u.jsx(M.Dropdown,{overlay:u.jsx("div",{className:"univer-rounded-lg univer-p-4",children:u.jsx(M.ColorPicker,{value:e,onChange:i})}),children:u.jsx("span",{className:M.clsx("univer-flex univer-cursor-pointer univer-items-center univer-rounded univer-p-1 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",o),children:v()})})},de=t=>{var o,l,v,c,h;const e=t.rule;if(!e)return null;const i=C.useMemo(()=>{if(e.type===n.CFRuleType.colorScale){const d=e.config.map((b,S)=>({color:new a.ColorKit(b.color),value:S})),m=d.length-1;return new Array(5).fill("").map((b,S,y)=>S*m/(y.length-1)).map(b=>n.getColorScaleFromValue(d,b))}return null},[e]),r=C.useMemo(()=>{if(e.type===n.CFRuleType.iconSet)return e.config.map(d=>{const m=n.iconMap[d.iconType];return m&&m[Number(d.iconId)]})},[e]),s="univer-pointer-events-none univer-flex univer-h-5 univer-min-w-[72px] univer-items-center univer-justify-center univer-text-xs";switch(e.type){case n.CFRuleType.dataBar:{const{isGradient:d}=e.config,m=d?`linear-gradient(to right, ${e.config.positiveColor||n.defaultDataBarPositiveColor}, rgb(255 255 255))`:e.config.positiveColor,g=d?`linear-gradient(to right, rgb(255 255 255),${e.config.nativeColor||n.defaultDataBarNativeColor})`:e.config.nativeColor;return u.jsxs("div",{className:s,children:[u.jsx("div",{className:"univer-h-full univer-w-1/2 univer-border univer-border-solid",style:{background:g,borderColor:(o=e.config.nativeColor)!=null?o:n.defaultDataBarNativeColor}}),u.jsx("div",{className:"univer-h-full univer-w-1/2 univer-border univer-border-solid",style:{background:m,borderColor:(l=e.config.positiveColor)!=null?l:n.defaultDataBarPositiveColor}})]})}case n.CFRuleType.colorScale:return i&&u.jsx("div",{className:s,children:i.map((d,m)=>u.jsx("div",{className:"univer-h-full",style:{width:`${100/i.length}%`,background:d}},m))});case n.CFRuleType.iconSet:return r&&u.jsx("div",{className:s,children:r.map((d,m)=>d?u.jsx("img",{className:"univer-h-full",src:d,draggable:!1},m):u.jsx(Te,{},m))});case n.CFRuleType.highlightCell:{const{ul:d,st:m,it:g,bl:b,bg:S,cl:y}=e.style,_=(d==null?void 0:d.s)===a.BooleanNumber.TRUE,T=(m==null?void 0:m.s)===a.BooleanNumber.TRUE,w=g===a.BooleanNumber.TRUE,E=b===a.BooleanNumber.TRUE,N=(v=S==null?void 0:S.rgb)!=null?v:n.DEFAULT_BG_COLOR,p=(c=y==null?void 0:y.rgb)!=null?c:n.DEFAULT_FONT_COLOR,x={textDecoration:(h=`${_?"underline":""} ${T?"line-through":""}`.replace(/^ /,""))!=null?h:void 0,backgroundColor:N,color:p};return u.jsx("div",{className:M.clsx(s,{"univer-font-bold":E,"univer-italic":w}),style:x,children:"123"})}}},Re=M.clsx("univer-mt-5 univer-px-1 univer-py-2 univer-rounded",M.borderClassName),re=(t,e)=>({label:e.t(`sheet.cf.valueType.${t}`),value:t}),Ae=t=>{var S;const{type:e,className:i,onChange:r,id:s,value:o}=t,l=P.useDependency(a.IUniverInstanceService),v=l.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET).getUnitId(),c=(S=l.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:S.getSheetId(),h=C.useMemo(()=>String(o).startsWith("=")?String(o):"=",[o]),d=C.useMemo(()=>[n.CFValueType.max,n.CFValueType.min,"none"].includes(e)?{disabled:!0}:[n.CFValueType.percent,n.CFValueType.percentile].includes(e)?{min:0,max:100}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[e]),m=C.useRef(null),[g,b]=C.useState(!1);return P.useSidebarClick(y=>{var T;((T=m.current)==null?void 0:T.isClickOutSide(y))&&b(!1)}),e===n.CFValueType.formula?u.jsx("div",{className:"univer-ml-1 univer-w-full",children:u.jsx(xe.FormulaEditor,{ref:m,className:M.clsx("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-white [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent",M.borderClassName),initValue:h,unitId:v,subUnitId:c,isFocus:g,onChange:(y="")=>{r(y||"")},onFocus:()=>b(!0)})}):u.jsx(M.InputNumber,{className:i,value:Number(t.value)||0,onChange:y=>t.onChange(y||0),...d})},Zt=t=>{var k;const{interceptorManager:e}=t,i=P.useDependency(a.LocaleService),r=((k=t.rule)==null?void 0:k.type)===n.CFRuleType.colorScale?t.rule:void 0,s=[re(n.CFValueType.num,i),re(n.CFValueType.percent,i),re(n.CFValueType.percentile,i),re(n.CFValueType.formula,i)],o=[re(n.CFValueType.min,i),...s],l=[re("none",i),...s],v=[re(n.CFValueType.max,i),...s],[c,h]=C.useState(()=>{var F;const f=n.CFValueType.min;return r&&((F=r.config[0])==null?void 0:F.value.type)||f}),[d,m]=C.useState(()=>{var F;const f="none";return!r||r.config.length!==3?f:((F=r.config[1])==null?void 0:F.value.type)||f}),[g,b]=C.useState(()=>{var F;const f=n.CFValueType.max;return r&&((F=r.config[r.config.length-1])==null?void 0:F.value.type)||f}),[S,y]=C.useState(()=>{if(!r)return 10;const F=r.config[0];return(F==null?void 0:F.value.value)===void 0?10:F==null?void 0:F.value.value}),[_,T]=C.useState(()=>{var L;if(!r||r.config.length!==3)return 50;const F=(L=r.config[1])==null?void 0:L.value.value;return F===void 0?50:F}),[w,E]=C.useState(()=>{var L;if(!r)return 90;const F=(L=r.config[r.config.length-1])==null?void 0:L.value.value;return F===void 0?90:F}),[N,p]=C.useState(()=>{var F;const f="#d0d9fb";return r&&((F=r.config[0])==null?void 0:F.color)||f}),[x,R]=C.useState(()=>{var F;const f="#7790f3";return!r||r.config.length!==3?f:((F=r.config[1])==null?void 0:F.color)||f}),[I,V]=C.useState(()=>{var F;const f="#2e55ef";return r&&((F=r.config[r.config.length-1])==null?void 0:F.color)||f}),j=C.useMemo(()=>f=>{const{minType:F,medianType:L,maxType:q,minValue:J,medianValue:Q,maxValue:se,minColor:oe,medianColor:D,maxColor:A}=f,H=[];return H.push({color:oe,value:{type:F,value:J}}),L!=="none"&&H.push({color:D,value:{type:L,value:Q}}),H.push({color:A,value:{type:q,value:se}}),{config:H.map((G,Z)=>({...G,index:Z})),type:n.CFRuleType.colorScale}},[]);C.useEffect(()=>e.intercept(e.getInterceptPoints().submit,{handler(){return j({minType:c,medianType:d,maxType:g,minValue:S,medianValue:_,maxValue:w,minColor:N,medianColor:x,maxColor:I})}}),[j,c,d,g,S,_,w,N,x,I,e]);const O=f=>{t.onChange(j(f))};return u.jsxs("div",{children:[u.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:i.t("sheet.cf.panel.styleRule")}),u.jsx("div",{className:Re,children:u.jsx(de,{rule:j({minType:c,medianType:d,maxType:g,minValue:S,medianValue:_,maxValue:w,minColor:N,medianColor:x,maxColor:I})})}),u.jsx("div",{className:"univer-mt-3 univer-text-xs univer-text-gray-600 dark:!univer-text-gray-200",children:i.t("sheet.cf.valueType.min")}),u.jsxs("div",{className:"univer-mt-3 univer-flex univer-h-8 univer-items-center",children:[u.jsx(M.Select,{className:"univer-flex-shrink-0",options:o,value:c,onChange:f=>{h(f);const F=n.createDefaultValueByValueType(f,10);y(F),O({minType:f,medianType:d,maxType:g,minValue:F,medianValue:_,maxValue:w,minColor:N,medianColor:x,maxColor:I})}}),u.jsx(Ae,{id:"min",className:"univer-ml-1",value:S,type:c,onChange:f=>{y(f),O({minType:c,medianType:d,maxType:g,minValue:f,medianValue:_,maxValue:w,minColor:N,medianColor:x,maxColor:I})}}),u.jsx(ie,{className:"univer-ml-1",color:N,onChange:f=>{p(f),O({minType:c,medianType:d,maxType:g,minValue:S,medianValue:_,maxValue:w,minColor:f,medianColor:x,maxColor:I})}})]}),u.jsx("div",{className:"univer-text-gray-600dark:!univer-text-gray-200 univer-mt-3 univer-text-xs",children:i.t("sheet.cf.panel.medianValue")}),u.jsxs("div",{className:"univer-mt-3 univer-flex univer-h-8 univer-items-center",children:[u.jsx(M.Select,{className:"univer-flex-shrink-0",options:l,value:d,onChange:f=>{m(f);const F=n.createDefaultValueByValueType(f,50);T(F),O({minType:c,medianType:f,maxType:g,minValue:S,medianValue:F,maxValue:w,minColor:N,medianColor:x,maxColor:I})}}),u.jsx(Ae,{id:"median",className:"univer-ml-1",value:_,type:d,onChange:f=>{T(f),O({minType:c,medianType:d,maxType:g,minValue:S,medianValue:f,maxValue:w,minColor:N,medianColor:x,maxColor:I})}}),d!=="none"&&u.jsx(ie,{className:"univer-ml-1",color:x,onChange:f=>{R(f),O({minType:c,medianType:d,maxType:g,minValue:S,medianValue:_,maxValue:w,minColor:N,medianColor:f,maxColor:I})}})]}),u.jsx("div",{className:"univer-mt-3 univer-text-xs univer-text-gray-600 dark:!univer-text-gray-200",children:i.t("sheet.cf.valueType.max")}),u.jsxs("div",{className:"univer-mt-3 univer-flex univer-h-8 univer-items-center",children:[u.jsx(M.Select,{className:"univer-flex-shrink-0",options:v,value:g,onChange:f=>{b(f);const F=n.createDefaultValueByValueType(f,90);E(F),O({minType:c,medianType:d,maxType:f,minValue:S,medianValue:_,maxValue:F,minColor:N,medianColor:x,maxColor:I})}}),u.jsx(Ae,{id:"max",className:"univer-ml-1",value:w,type:g,onChange:f=>{E(f),O({minType:c,medianType:d,maxType:g,minValue:S,medianValue:_,maxValue:f,minColor:N,medianColor:x,maxColor:I})}}),u.jsx(ie,{className:"univer-ml-1",color:I,onChange:f=>{V(f),O({minType:c,medianType:d,maxType:g,minValue:S,medianValue:_,maxValue:w,minColor:N,medianColor:x,maxColor:f})}})]})]})},ae=(t,e)=>({label:e.t(`sheet.cf.valueType.${t}`),value:t}),rt=t=>{var y;const{onChange:e,className:i,value:r,type:s,id:o,disabled:l=!1}=t,v=P.useDependency(a.IUniverInstanceService),c=v.getCurrentUnitOfType(a.UniverInstanceType.UNIVER_SHEET).getUnitId(),h=(y=v.getCurrentUnitOfType(a.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:y.getSheetId(),d=C.useRef(null),[m,g]=C.useState(!1);P.useSidebarClick(_=>{var w;((w=d.current)==null?void 0:w.isClickOutSide(_))&&g(!1)});const b=C.useRef(r),S=C.useMemo(()=>[n.CFValueType.percentile,n.CFValueType.percent].includes(s)?{max:100,min:0}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[s]);if(s===n.CFValueType.formula){const _=String(b.current).startsWith("=")?String(b.current)||"":"=";return u.jsx("div",{className:"univer-ml-3 univer-w-full",children:u.jsx(xe.FormulaEditor,{ref:d,className:M.clsx("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-white [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent",M.borderClassName),initValue:_,unitId:c,subUnitId:h,isFocus:m,onChange:(T="")=>{e(T||"")},onFocus:()=>g(!0)})})}return u.jsx(M.InputNumber,{className:i,value:Number(r)||0,disabled:l,onChange:_=>{e(_||0)},...S})},zt=t=>{var k;const{interceptorManager:e}=t,i=P.useDependency(a.LocaleService),r=((k=t.rule)==null?void 0:k.type)===n.CFRuleType.dataBar?t.rule:void 0,[s,o]=C.useState(()=>{var F;return r&&(F=r.config)!=null&&F.isGradient?"1":"0"}),[l,v]=C.useState(()=>{var f;return r&&((f=r.config)==null?void 0:f.positiveColor)||n.defaultDataBarPositiveColor}),[c,h]=C.useState(()=>{var f;return r&&((f=r.config)==null?void 0:f.nativeColor)||n.defaultDataBarNativeColor}),d=[ae(n.CFValueType.num,i),ae(n.CFValueType.percent,i),ae(n.CFValueType.percentile,i),ae(n.CFValueType.formula,i)],m=[ae(n.CFValueType.min,i),...d],g=[ae(n.CFValueType.max,i),...d],[b,S]=C.useState(()=>{var F;const f=m[0].value;return r&&((F=r.config)==null?void 0:F.min.type)||f}),[y,_]=C.useState(()=>{var F;const f=g[0].value;return r&&((F=r.config)==null?void 0:F.max.type)||f}),[T,w]=C.useState(()=>{var L;if(!r)return 0;const F=((L=r.config)==null?void 0:L.min)||{};return F.type===n.CFValueType.formula?F.value||"=":F.value||0}),[E,N]=C.useState(()=>{var L;if(!r)return 100;const F=((L=r.config)==null?void 0:L.max)||{};return F.type===n.CFValueType.formula?F.value||"=":F.value===void 0?100:F.value}),[p,x]=C.useState(()=>r?r.isShowValue===void 0?!0:!!r.isShowValue:!0),R=f=>({config:{min:{type:f.minValueType,value:f.minValue},max:{type:f.maxValueType,value:f.maxValue},isGradient:f.isGradient==="1",positiveColor:f.positiveColor||n.defaultDataBarPositiveColor,nativeColor:f.nativeColor||n.defaultDataBarNativeColor},type:n.CFRuleType.dataBar,isShowValue:f.isShowValue});C.useEffect(()=>e.intercept(e.getInterceptPoints().submit,{handler(){return R({isGradient:s,minValue:T,minValueType:b,maxValue:E,maxValueType:y,positiveColor:l,nativeColor:c,isShowValue:p})}}),[s,T,b,E,y,l,c,e,p]);const I=f=>{t.onChange(R(f))},V=f=>{v(f),I({isGradient:s,minValue:T,minValueType:b,maxValue:E,maxValueType:y,positiveColor:f,nativeColor:c,isShowValue:p})},j=f=>{h(f),I({isGradient:s,minValue:T,minValueType:b,maxValue:E,maxValueType:y,positiveColor:l,nativeColor:f,isShowValue:p})},O=f=>d.map(F=>F.value).includes(f);return u.jsxs("div",{children:[u.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:i.t("sheet.cf.panel.styleRule")}),u.jsx("div",{className:Re,children:u.jsx(de,{rule:R({isGradient:s,minValue:T,minValueType:b,maxValue:E,maxValueType:y,positiveColor:l,nativeColor:c,isShowValue:p})})}),u.jsxs("div",{children:[u.jsx("div",{className:"univer-mt-3 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:i.t("sheet.cf.panel.fillType")}),u.jsxs("div",{className:"univer-ml-1 univer-mt-3 univer-flex univer-items-center",children:[u.jsxs(M.RadioGroup,{value:s,onChange:f=>{o(f),I({isGradient:f,minValue:T,minValueType:b,maxValue:E,maxValueType:y,positiveColor:l,nativeColor:c,isShowValue:p})},children:[u.jsx(M.Radio,{value:"0",children:u.jsx("span",{className:"univer-text-xs",children:i.t("sheet.cf.panel.pureColor")})}),u.jsx(M.Radio,{value:"1",children:u.jsx("span",{className:"univer-text-xs",children:i.t("sheet.cf.panel.gradient")})})]}),u.jsxs("div",{className:"univer-ml-6 univer-flex univer-items-center univer-text-xs",children:[u.jsx(M.Checkbox,{checked:!p,onChange:f=>{x(!f),I({isGradient:f,minValue:T,minValueType:b,maxValue:E,maxValueType:y,positiveColor:l,nativeColor:c,isShowValue:!f})}}),i.t("sheet.cf.panel.onlyShowDataBar")]})]})]}),u.jsxs("div",{children:[u.jsx("div",{className:"univer-mt-3 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:i.t("sheet.cf.panel.colorSet")}),u.jsxs("div",{className:"univer-ml-1 univer-mt-3 univer-flex univer-items-center",children:[u.jsxs("div",{className:"univer-flex univer-items-center",children:[u.jsx("div",{className:"univer-text-xs",children:i.t("sheet.cf.panel.native")}),u.jsx(ie,{color:c,onChange:j})]}),u.jsxs("div",{className:"univer-ml-3 univer-flex univer-items-center",children:[u.jsx("div",{className:"univer-text-xs",children:i.t("sheet.cf.panel.positive")}),u.jsx(ie,{color:l,onChange:V})]})]})]}),u.jsxs("div",{children:[u.jsx("div",{className:"univer-mt-3 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:i.t("sheet.cf.valueType.min")}),u.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center",children:[u.jsx(M.Select,{className:"univer-w-1/2 univer-flex-shrink-0",options:m,value:b,onChange:f=>{S(f);const F=n.createDefaultValueByValueType(f,10);w(F),I({isGradient:s,minValue:F,minValueType:f,maxValue:E,maxValueType:y,positiveColor:l,nativeColor:c,isShowValue:p})}}),u.jsx(rt,{id:"min",className:"univer-ml-3",disabled:!O(b),type:b,value:T,onChange:f=>{w(f||0),I({isGradient:s,minValue:f||0,minValueType:b,maxValue:E,maxValueType:y,positiveColor:l,nativeColor:c,isShowValue:p})}})]}),u.jsx("div",{className:"univer-mt-3 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:i.t("sheet.cf.valueType.max")}),u.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center",children:[u.jsx(M.Select,{className:"univer-w-1/2 univer-flex-shrink-0",options:g,value:y,onChange:f=>{_(f);const F=n.createDefaultValueByValueType(f,90);N(F),I({isGradient:s,minValue:T,minValueType:b,maxValue:F,maxValueType:f,positiveColor:l,nativeColor:c,isShowValue:p})}}),u.jsx(rt,{className:"univer-ml-3",disabled:!O(y),id:"max",type:y,value:E,onChange:f=>{N(f||0),I({isGradient:s,minValue:T,minValueType:b,maxValue:f||0,maxValueType:y,positiveColor:l,nativeColor:c,isShowValue:p})}})]})]})]})},we=t=>[a.BooleanNumber.FALSE,void 0].includes(t)?a.BooleanNumber.TRUE:a.BooleanNumber.FALSE,Ne=t=>t!==a.BooleanNumber.FALSE,nt=t=>{const{style:e,onChange:i,className:r}=t,[s,o]=C.useState(()=>{if(e!=null&&e.bl)return e.bl}),[l,v]=C.useState(()=>{if(e!=null&&e.it)return e.it}),[c,h]=C.useState(()=>{if(e!=null&&e.ul)return e.ul.s}),[d,m]=C.useState(()=>{if(e!=null&&e.st)return e.st.s}),[g,b]=C.useState(()=>{var w;const T="#2f56ef";return(w=e==null?void 0:e.cl)!=null&&w.rgb?e.cl.rgb:T}),[S,y]=C.useState(()=>{var w;const T="#e8ecfc";return(w=e==null?void 0:e.bg)!=null&&w.rgb?e.bg.rgb:T});C.useEffect(()=>{const T={bl:s,it:l};g!==void 0&&(T.cl={rgb:g}),S!==void 0&&(T.bg={rgb:S}),d!==void 0&&(T.st={s:d}),c!==void 0&&(T.ul={s:c}),i(n.removeUndefinedAttr(T))},[s,l,c,d,g,S]);const _="univer-flex univer-cursor-pointer univer-items-center univer-rounded univer-px-1";return u.jsxs("div",{className:M.clsx("univer-my-2.5 univer-flex univer-justify-between",r),children:[u.jsx("div",{className:M.clsx(_,{"univer-bg-gray-100 dark:!univer-bg-gray-700":Ne(s||a.BooleanNumber.FALSE)}),onClick:()=>o(we(s)),children:u.jsx(pt,{})}),u.jsx("div",{className:M.clsx(_,{"univer-bg-gray-100 dark:!univer-bg-gray-700":Ne(l||a.BooleanNumber.FALSE)}),onClick:()=>v(we(l)),children:u.jsx(yt,{})}),u.jsx("div",{className:M.clsx(_,{"univer-bg-gray-100 dark:!univer-bg-gray-700":Ne(c||a.BooleanNumber.FALSE)}),onClick:()=>h(we(c)),children:u.jsx(xt,{})}),u.jsx("div",{className:M.clsx(_,{"univer-bg-gray-100 dark:!univer-bg-gray-700":Ne(d||a.BooleanNumber.FALSE)}),onClick:()=>m(we(d)),children:u.jsx(St,{})}),u.jsx(ie,{color:g,onChange:b,Icon:ft}),u.jsx(ie,{color:S,onChange:y})]})},Yt=t=>{var N;const{onChange:e,interceptorManager:i}=t,r=P.useDependency(a.LocaleService),o=P.useDependency(a.IUniverInstanceService).getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET),l=o.getActiveSheet(),v=((N=t.rule)==null?void 0:N.type)===n.CFRuleType.highlightCell?t.rule:void 0,c=C.useRef(null),[h,d]=C.useState(!1),m=C.useRef(null),[g,b]=C.useState({}),[S,y]=C.useState(()=>(v==null?void 0:v.subType)===n.CFSubRuleType.formula?v.value:"="),[_,T]=C.useState(void 0),w=p=>({style:p.style,value:S,type:n.CFRuleType.highlightCell,subType:n.CFSubRuleType.formula});C.useEffect(()=>i.intercept(i.getInterceptPoints().submit,{handler(){return w({style:g})}}),[g,S,i]),C.useEffect(()=>i.intercept(i.getInterceptPoints().beforeSubmit,{handler:(x,R,I)=>_||S.length===1||!S.startsWith("=")?(T(r.t("sheet.cf.errorMessage.formulaError")),!1):I(x)}),[_,S]);const E=p=>{e(w(p))};return P.useSidebarClick(p=>{var R;((R=m.current)==null?void 0:R.isClickOutSide(p))&&d(!1)}),u.jsxs("div",{ref:c,children:[u.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:r.t("sheet.cf.panel.styleRule")}),u.jsx("div",{className:"univer-mt-3",children:u.jsx(xe.FormulaEditor,{ref:m,className:M.clsx("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-white [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent",M.borderClassName),errorText:_,isFocus:h,initValue:S,unitId:o.getUnitId(),subUnitId:l==null?void 0:l.getSheetId(),onFocus:()=>{d(!0)},onChange:p=>{y(p),E({style:g})},onVerify:(p,x)=>{!p||x.length===1?T(r.t("sheet.cf.errorMessage.formulaError")):T(void 0)}})}),u.jsx("div",{className:Re,children:u.jsx(de,{rule:w({style:g})})}),u.jsx(nt,{style:v==null?void 0:v.style,className:"univer-mt-3",onChange:p=>{b(p),E({style:p})}})]})},Ee=t=>u.jsxs("div",{className:"univer-relative",children:[u.jsx("div",{className:"univer-absolute univer-bottom-[-13px] univer-z-[999] univer-text-[10px] univer-text-red-500",children:t.errorText}),t.children]}),$=(t,e)=>({label:e.t(`sheet.cf.operator.${t}`),value:t}),Kt=t=>{const{type:e,operator:i,onChange:r,value:s,interceptorManager:o}=t,l=P.useDependency(a.LocaleService),[v,c]=C.useState(()=>typeof s=="number"?s:0),[h,d]=C.useState(""),[m,g]=C.useState(()=>typeof s=="string"?s:""),[b,S]=C.useState(""),[y,_]=C.useState(()=>Array.isArray(s)?s[0]===void 0?0:s[0]:0),[T,w]=C.useState(""),[E,N]=C.useState(()=>Array.isArray(s)?s[1]===void 0?100:s[1]:100),[p,x]=C.useState("");switch(C.useEffect(()=>{switch(e){case n.CFSubRuleType.text:{[n.CFTextOperator.beginsWith,n.CFTextOperator.endsWith,n.CFTextOperator.containsText,n.CFTextOperator.notContainsText,n.CFTextOperator.equal,n.CFTextOperator.notEqual].includes(i)&&r(m);break}case n.CFSubRuleType.number:{[n.CFNumberOperator.equal,n.CFNumberOperator.notEqual,n.CFNumberOperator.greaterThan,n.CFNumberOperator.greaterThanOrEqual,n.CFNumberOperator.lessThan,n.CFNumberOperator.lessThanOrEqual].includes(i)&&r(v),[n.CFNumberOperator.between,n.CFNumberOperator.notBetween].includes(i)&&r([y,E]);break}}},[e]),C.useEffect(()=>{const R=o.intercept(o.getInterceptPoints().beforeSubmit,{handler:(I,V,j)=>{switch(e){case n.CFSubRuleType.text:if([n.CFTextOperator.beginsWith,n.CFTextOperator.containsText,n.CFTextOperator.endsWith,n.CFTextOperator.notEqual,n.CFTextOperator.notContainsText,n.CFTextOperator.equal].includes(i))return m?j(I):(S(l.t("sheet.cf.errorMessage.notBlank")),!1)}return j(I)}});return()=>{R()}},[e,v,m,i]),e){case n.CFSubRuleType.text:{if([n.CFTextOperator.beginsWith,n.CFTextOperator.endsWith,n.CFTextOperator.containsText,n.CFTextOperator.notContainsText,n.CFTextOperator.equal,n.CFTextOperator.notEqual].includes(i)){const R=I=>{g(I),r(I)};return u.jsx("div",{className:"univer-mt-3",children:u.jsx(Ee,{errorText:b,children:u.jsx(M.Input,{value:m,onChange:I=>{S(""),R(I)}})})})}break}case n.CFSubRuleType.number:{if([n.CFNumberOperator.equal,n.CFNumberOperator.notEqual,n.CFNumberOperator.greaterThan,n.CFNumberOperator.greaterThanOrEqual,n.CFNumberOperator.lessThan,n.CFNumberOperator.lessThanOrEqual].includes(i)){const R=I=>{c(I||0),r(I||0),d("")};return u.jsx("div",{className:"univer-mt-3",children:u.jsx(Ee,{errorText:h,children:u.jsx(M.InputNumber,{className:"univer-w-full",min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,value:v,onChange:R})})})}if([n.CFNumberOperator.between,n.CFNumberOperator.notBetween].includes(i)){const R=V=>{_(V||0),r([V||0,E]),w("")},I=V=>{N(V||0),r([y,V||0]),x("")};return u.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center",children:[u.jsx(Ee,{errorText:T,children:u.jsx(M.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,value:y,onChange:R})}),u.jsx(Ee,{errorText:p,children:u.jsx(M.InputNumber,{className:"univer-ml-3",min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,value:E,onChange:I})})]})}}}return null},it=(t,e)=>{switch(t){case n.CFSubRuleType.text:return[$(n.CFTextOperator.containsText,e),$(n.CFTextOperator.notContainsText,e),$(n.CFTextOperator.beginsWith,e),$(n.CFTextOperator.endsWith,e),$(n.CFTextOperator.equal,e),$(n.CFTextOperator.notEqual,e),$(n.CFTextOperator.containsBlanks,e),$(n.CFTextOperator.notContainsBlanks,e),$(n.CFTextOperator.containsErrors,e),$(n.CFTextOperator.notContainsErrors,e)];case n.CFSubRuleType.number:return[$(n.CFNumberOperator.between,e),$(n.CFNumberOperator.notBetween,e),$(n.CFNumberOperator.equal,e),$(n.CFNumberOperator.notEqual,e),$(n.CFNumberOperator.greaterThan,e),$(n.CFNumberOperator.greaterThanOrEqual,e),$(n.CFNumberOperator.lessThan,e),$(n.CFNumberOperator.lessThanOrEqual,e)];case n.CFSubRuleType.timePeriod:return[$(n.CFTimePeriodOperator.yesterday,e),$(n.CFTimePeriodOperator.today,e),$(n.CFTimePeriodOperator.tomorrow,e),$(n.CFTimePeriodOperator.last7Days,e),$(n.CFTimePeriodOperator.lastWeek,e),$(n.CFTimePeriodOperator.thisWeek,e),$(n.CFTimePeriodOperator.nextWeek,e),$(n.CFTimePeriodOperator.lastMonth,e),$(n.CFTimePeriodOperator.thisMonth,e),$(n.CFTimePeriodOperator.nextMonth,e)]}},st=t=>{var N;const{interceptorManager:e,onChange:i}=t,r=P.useDependency(a.LocaleService),s=((N=t.rule)==null?void 0:N.type)===n.CFRuleType.highlightCell?t.rule:void 0,[o,l]=C.useState(()=>{const p=n.CFSubRuleType.text;return s&&s.subType||p}),v=[{value:n.CFSubRuleType.text,label:r.t("sheet.cf.subRuleType.text")},{value:n.CFSubRuleType.number,label:r.t("sheet.cf.subRuleType.number")},{value:n.CFSubRuleType.timePeriod,label:r.t("sheet.cf.subRuleType.timePeriod")},{value:n.CFSubRuleType.duplicateValues,label:r.t("sheet.cf.subRuleType.duplicateValues")},{value:n.CFSubRuleType.uniqueValues,label:r.t("sheet.cf.subRuleType.uniqueValues")}],c=C.useMemo(()=>it(o,r),[o]),[h,d]=C.useState(()=>{const p=c?c[0].value:void 0;return s&&s.operator||p}),[m,g]=C.useState(()=>{var R;return s?(R=s.value)!=null?R:n.createDefaultValue(s.subType,s.operator):""}),[b,S]=C.useState({}),y=C.useMemo(()=>p=>{var x,R,I,V,j,O,k,f,F,L,q,J,Q,se,oe;switch(p.subType||o){case n.CFSubRuleType.text:{if([n.CFTextOperator.beginsWith,n.CFTextOperator.endsWith,n.CFTextOperator.containsText,n.CFTextOperator.notContainsText,n.CFTextOperator.equal,n.CFTextOperator.notEqual].includes(h))return{type:n.CFRuleType.highlightCell,subType:(x=p.subType)!=null?x:o,operator:(R=p.operator)!=null?R:h,style:(I=p.style)!=null?I:b,value:(V=p.value)!=null?V:m};break}case n.CFSubRuleType.number:{if([n.CFNumberOperator.equal,n.CFNumberOperator.notEqual,n.CFNumberOperator.greaterThan,n.CFNumberOperator.greaterThanOrEqual,n.CFNumberOperator.lessThan,n.CFNumberOperator.lessThanOrEqual].includes(h))return{type:n.CFRuleType.highlightCell,subType:(j=p.subType)!=null?j:o,operator:(O=p.operator)!=null?O:h,style:(k=p.style)!=null?k:b,value:(f=p.value)!=null?f:m};if([n.CFNumberOperator.between,n.CFNumberOperator.notBetween].includes(h))return{type:n.CFRuleType.highlightCell,subType:(F=p.subType)!=null?F:o,operator:(L=p.operator)!=null?L:h,style:(q=p.style)!=null?q:b,value:(J=p.value)!=null?J:m};break}}return{type:n.CFRuleType.highlightCell,subType:(Q=p.subType)!=null?Q:o,operator:(se=p.operator)!=null?se:h,style:(oe=p.style)!=null?oe:b}},[o,h,m,b]);C.useEffect(()=>e.intercept(e.getInterceptPoints().submit,{handler(){return y({})}}),[y,e]),C.useEffect(()=>{v.some(p=>p.value===o)||l(v[0].value)},[v]);const _=p=>{const x=p,R=it(x,r),I=R&&R[0].value;l(x),d(I),I&&g(n.createDefaultValue(x,I)),i(y({subType:x,operator:I}))},T=p=>{const x=p;d(x),i(y({operator:x}))},w=p=>{g(p),i(y({value:p}))},E=C.useMemo(()=>`${o}_${h}_${Math.random()}`,[o,h]);return u.jsxs("div",{children:[u.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:r.t("sheet.cf.panel.styleRule")}),u.jsxs("div",{className:"univer-flex univer-justify-between univer-gap-4",children:[u.jsx(M.Select,{className:"univer-mt-3 univer-w-full",onChange:_,value:o,options:v}),(c==null?void 0:c.length)&&u.jsx(M.Select,{className:"univer-mt-3 univer-w-full",onChange:T,value:h||"",options:c})]}),u.jsx(Kt,{value:m,interceptorManager:e,type:o,operator:h,rule:s,onChange:w},E),u.jsx("div",{className:Re,children:u.jsx(de,{rule:y({})})}),u.jsx(nt,{style:s==null?void 0:s.style,className:"univer-ml-1",onChange:p=>{S(p),i(y({style:p}))}})]})},Tt=(t,e)=>(n.iconMap[t]||[])[Number(e)]||"",Xt=t=>{var d;const{error:e,type:i,onChange:r}=t,s=P.useDependency(a.IUniverInstanceService),o=s.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET).getUnitId(),l=(d=s.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:d.getSheetId(),v=C.useRef(null),[c,h]=C.useState(!1);return P.useSidebarClick(m=>{var b;((b=v.current)==null?void 0:b.isClickOutSide(m))&&h(!1)}),u.jsx("div",{className:"univer-relative",children:i!==n.CFValueType.formula?u.jsxs(u.Fragment,{children:[u.jsx(M.InputNumber,{className:M.clsx({"univer-border-red-500":e}),value:Number(t.value)||0,onChange:m=>r(m!=null?m:0)}),e&&u.jsx("div",{className:"univer-absolute univer-text-xs univer-text-red-500",children:e})]}):u.jsx("div",{className:"univer-w-full",children:u.jsx(xe.FormulaEditor,{ref:v,className:M.clsx("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-white [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent",M.borderClassName),initValue:String(t.value),unitId:o,subUnitId:l,isFocus:c,onChange:(m="")=>{r(m||"")},onFocus:()=>h(!0)})})})},ot=(t,e,i)=>({operator:n.CFNumberOperator.greaterThan,value:{type:n.CFValueType.num,value:(i.length-1-e)*10},iconType:t,iconId:String(e)}),Jt=C.forwardRef((t,e)=>{const{onClick:i}=t,r=P.useDependency(a.LocaleService),s=o=>{i(o)};return u.jsx("div",{ref:e,className:"univer-w-80",children:n.iconGroup.map((o,l)=>u.jsxs("div",{className:"univer-mb-3",children:[u.jsx("div",{className:"univer-mb-1 univer-text-sm",children:r.t(o.title)}),u.jsx("div",{className:"univer-flex univer-flex-wrap",children:o.group.map(v=>u.jsx("div",{className:"univer-mb-1 univer-flex univer-w-1/2 univer-items-center",onClick:()=>{s(v.name)},children:u.jsx("a",{className:"univer-cursor-pointer univer-rounded hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",children:v.list.map((c,h)=>u.jsx("img",{className:"univer-size-5",src:c,draggable:!1},h))})},v.name))})]},l))})}),Qt=t=>{const{onClick:e}=t,i=C.useMemo(()=>{const s=[];for(const o in n.iconMap){const l=n.iconMap[o],v=o;l.forEach((c,h)=>{s.push({iconType:v,base64:c,iconId:String(h)})})}return s},[]),r=s=>{e(s.iconType,s.iconId)};return u.jsxs("div",{children:[u.jsxs("div",{className:"univer-mb-2.5 univer-flex univer-cursor-pointer univer-items-center univer-pl-1",onClick:()=>r({iconType:n.EMPTY_ICON_TYPE,iconId:""}),children:[u.jsx(Te,{className:"univer-size-5"}),u.jsx("span",{className:"univer-ml-2",children:"无单元格图标"})]}),u.jsx("div",{className:"univer-flex univer-w-64 univer-flex-wrap",children:i.map(s=>u.jsx("div",{className:"univer-mb-2 univer-mr-2 univer-flex univer-cursor-pointer univer-items-center univer-justify-center univer-rounded hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",children:u.jsx("img",{className:"univer-size-5",src:s.base64,draggable:!1,onClick:()=>r(s)})},`${s.iconType}_${s.iconId}`))})]})},en=t=>{const{onChange:e,configList:i,errorMap:r={}}=t,s=P.useDependency(a.LocaleService),o=[{label:s.t(`sheet.cf.symbol.${n.CFNumberOperator.greaterThan}`),value:n.CFNumberOperator.greaterThan},{label:s.t(`sheet.cf.symbol.${n.CFNumberOperator.greaterThanOrEqual}`),value:n.CFNumberOperator.greaterThanOrEqual}],l=[{label:s.t(`sheet.cf.valueType.${n.CFValueType.num}`),value:n.CFValueType.num},{label:s.t(`sheet.cf.valueType.${n.CFValueType.percent}`),value:n.CFValueType.percent},{label:s.t(`sheet.cf.valueType.${n.CFValueType.percentile}`),value:n.CFValueType.percentile},{label:s.t(`sheet.cf.valueType.${n.CFValueType.formula}`),value:n.CFValueType.formula}],v=(m,g)=>{e([String(g),"value","value"],m)},c=(m,g)=>{e([String(g),"operator"],m);const b=n.createDefaultValue(n.CFSubRuleType.number,m);v(b,g)},h=(m,g)=>{e([String(g),"value","type"],m);const b=i[g],S=n.createDefaultValue(n.CFSubRuleType.number,b.operator);v(S,g)};return C.useMemo(()=>i.map((m,g)=>{const b=r[g],S=Tt(m.iconType,m.iconId),y=g===i.length-1,_=g===0,T=i[g-1],w=(T==null?void 0:T.value.type)===n.CFValueType.formula?s.t("sheet.cf.valueType.formula"):T==null?void 0:T.value.value,E=(N,p)=>{const x={...m,iconId:p,iconType:N};e([String(g)],x)};return u.jsxs("div",{className:g?"univer-mt-6":"univer-mt-3",children:[u.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center univer-justify-between univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:[u.jsxs("div",{className:"univer-w-[45%]",children:[s.t("sheet.cf.iconSet.icon"),g+1]}),u.jsx("div",{className:"univer-w-[45%]",children:u.jsxs(u.Fragment,{children:[!_&&!y&&s.t("sheet.cf.iconSet.rule"),!_&&!y&&u.jsxs("span",{className:"univer-font-medium univer-text-gray-600 dark:!univer-text-gray-200",children:[s.t("sheet.cf.iconSet.when"),s.t(`sheet.cf.symbol.${n.getOppositeOperator(T.operator)}`),w,y?"":` ${s.t("sheet.cf.iconSet.and")} `]})]})})]}),u.jsxs("div",{className:"univer-mt-3 univer-grid univer-grid-cols-2 univer-gap-4",children:[u.jsx("div",{className:"univer-flex univer-items-center",children:u.jsx(M.Dropdown,{overlay:u.jsx("div",{className:"univer-rounded-lg univer-p-4",children:u.jsx(Qt,{onClick:E,iconId:m.iconId,iconType:m.iconType})}),children:u.jsxs("div",{className:M.clsx("univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center univer-justify-between univer-rounded-md univer-bg-white univer-px-4 univer-py-2 univer-text-xs univer-text-gray-600 univer-transition-all hover:univer-border-primary-600 dark:!univer-text-gray-200",M.borderClassName),children:[S?u.jsx("img",{src:S,className:"univer-size-4",draggable:!1}):u.jsx(Te,{className:"univer-size-4"}),u.jsx(tt,{})]})})}),y?u.jsxs("div",{className:"univer-mt-0 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:[s.t("sheet.cf.iconSet.rule"),u.jsxs("span",{className:"univer-font-medium",children:[s.t("sheet.cf.iconSet.when"),s.t(`sheet.cf.symbol.${n.getOppositeOperator(T.operator)}`),w,y?"":` ${s.t("sheet.cf.iconSet.and")} `]})]}):u.jsx(M.Select,{options:o,value:m.operator,onChange:N=>{c(N,g)}})]}),y?u.jsx("div",{}):u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"univer-mt-3 univer-grid univer-grid-cols-2 univer-gap-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:[u.jsx("div",{children:s.t("sheet.cf.iconSet.type")}),u.jsx("div",{children:s.t("sheet.cf.iconSet.value")})]}),u.jsxs("div",{className:"univer-mt-3 univer-grid univer-grid-cols-2 univer-gap-4",children:[u.jsx(M.Select,{options:l,value:m.value.type,onChange:N=>{h(N,g)}}),u.jsx(Xt,{id:g,type:m.value.type,error:b,value:m.value.value||"",onChange:N=>{v(N,g)}})]})]})]},g)}),[i,r])},tn=t=>{var N;const{interceptorManager:e}=t,i=((N=t.rule)==null?void 0:N.type)===n.CFRuleType.iconSet?t.rule:void 0,r=P.useDependency(a.LocaleService),[s,o]=C.useState({}),[l,v]=C.useState(()=>{const p=Object.keys(n.iconMap)[0];if(i&&i.config.length){const x=i.config[0].iconType;if(!i.config.some(I=>I.iconType!==x))return x}return p}),[c,h]=C.useState(()=>{if(i&&i.config.length)return a.Tools.deepClone(i==null?void 0:i.config);const p=n.iconMap[l]||[];return new Array(p.length).fill("").map((x,R,I)=>R===I.length-1?{operator:n.CFNumberOperator.lessThanOrEqual,value:{type:n.CFValueType.num,value:Number.MAX_SAFE_INTEGER},iconType:l,iconId:String(R)}:ot(l,R,I))}),[d,m]=C.useState(()=>i?!!i.isShowValue:!0),g=C.useMemo(()=>{const p=c.map(x=>Tt(x.iconType,x.iconId));return u.jsx("div",{className:"univer-flex univer-items-center",children:p.map((x,R)=>x?u.jsx("img",{className:"univer-size-5",src:x},R):u.jsx(Te,{className:"univer-size-5"},R))})},[c]),b=p=>{if(p.reduce((R,I,V)=>R.preType&&!R.result||p.length-1===V?R:I.value.type===n.CFValueType.formula?{preType:n.CFValueType.formula,result:!1}:R.preType?{result:R.preType===I.value.type,preType:I.value.type}:{result:!0,preType:I.value.type},{result:!0,preType:""}).result&&[n.CFValueType.num,n.CFValueType.percent,n.CFValueType.percentile].includes(p[0].value.type)){const R={};return p.forEach((I,V,j)=>{if(V-1<0||V===j.length-1)return;const k=p[V-1],f=n.getOppositeOperator(k.operator);n.compareWithNumber({operator:f,value:k.value.value},I.value.value)||(R[V]=`${r.t(`sheet.cf.form.${f}`,String(k.value.value))} `)}),R}return{}},S=(p,x)=>{a.get(c,p)!==x&&(a.set(c,p,x),h([...c]),o(b(c)))},y=p=>{v(p);const x=n.iconMap[p]||[],R=new Array(x.length).fill("").map((I,V,j)=>ot(p,V,j));h(R),o(b(R))};C.useEffect(()=>{const p=e.intercept(e.getInterceptPoints().submit,{handler(){return{type:n.CFRuleType.iconSet,isShowValue:d,config:c}}});return()=>{p()}},[d,c,e]),C.useEffect(()=>{const p=e.intercept(e.getInterceptPoints().beforeSubmit,{handler(){return Object.keys(s).length===0}});return()=>{p()}},[d,c,e,s]);const _=()=>{const p=c.map(x=>({...x}));c.forEach((x,R)=>{const I=c.length-1-R,V=p[I];x.iconId=V.iconId,x.iconType=V.iconType}),h([...c])},T=P.useDependency(P.ILayoutService),[w,E]=C.useState();return P.useScrollYOverContainer(w,T.rootContainerElement),u.jsxs("div",{children:[u.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600",children:r.t("sheet.cf.panel.styleRule")}),u.jsx("div",{className:"univer-mt-3",children:u.jsx(M.Dropdown,{overlay:u.jsx("div",{className:"univer-rounded-lg univer-p-4",children:u.jsx(Jt,{ref:p=>{!w&&p&&E(p)},iconType:l,onClick:y})}),children:u.jsxs("div",{className:M.clsx("univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center univer-justify-between univer-rounded-md univer-bg-white univer-px-4 univer-py-2 univer-text-xs univer-text-gray-600 univer-transition-all hover:univer-border-primary-600",M.borderClassName),children:[g,u.jsx(tt,{})]})})}),u.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center univer-text-xs",children:[u.jsxs("div",{className:"univer-flex univer-items-center univer-text-xs",children:[u.jsx(M.Checkbox,{onChange:_}),r.t("sheet.cf.iconSet.reverseIconOrder")]}),u.jsxs("div",{className:"univer-ml-6 univer-flex univer-items-center univer-text-xs",children:[u.jsx(M.Checkbox,{checked:!d,onChange:p=>{m(!p)}}),r.t("sheet.cf.iconSet.onlyShowIcon")]})]}),u.jsx(en,{errorMap:s,onChange:S,configList:c})]})},nn=t=>{var _;const{onChange:e,interceptorManager:i}=t,r=P.useDependency(a.LocaleService),s=((_=t.rule)==null?void 0:_.type)===n.CFRuleType.highlightCell?t.rule:void 0,o=[{label:r.t("sheet.cf.panel.isNotBottom"),value:"isNotBottom"},{label:r.t("sheet.cf.panel.isBottom"),value:"isBottom"},{label:r.t("sheet.cf.panel.greaterThanAverage"),value:"greaterThanAverage"},{label:r.t("sheet.cf.panel.lessThanAverage"),value:"lessThanAverage"}],[l,v]=C.useState(()=>{const T=o[0].value,w=s==null?void 0:s.type;if(!s)return T;switch(w){case n.CFRuleType.highlightCell:switch(s.subType){case n.CFSubRuleType.average:return[n.CFNumberOperator.greaterThan,n.CFNumberOperator.greaterThanOrEqual].includes(s.operator)?"greaterThanAverage":[n.CFNumberOperator.lessThan,n.CFNumberOperator.lessThanOrEqual].includes(s.operator)?"lessThanAverage":T;case n.CFSubRuleType.rank:return s.isBottom?"isBottom":"isNotBottom"}}return T}),[c,h]=C.useState(()=>{const w=s==null?void 0:s.type;if(!s)return 10;switch(w){case n.CFRuleType.highlightCell:switch(s.subType){case n.CFSubRuleType.rank:return s.value||10}}return 10}),[d,m]=C.useState(()=>{const w=s==null?void 0:s.type;if(!s)return!1;switch(w){case n.CFRuleType.highlightCell:switch(s.subType){case n.CFSubRuleType.rank:return s.isPercent||!1}}return!1}),[g,b]=C.useState({}),S=T=>{const{type:w,isPercent:E,value:N,style:p}=T;if(w==="isNotBottom")return{type:n.CFRuleType.highlightCell,subType:n.CFSubRuleType.rank,isPercent:E,isBottom:!1,value:N,style:p};if(w==="isBottom")return{type:n.CFRuleType.highlightCell,subType:n.CFSubRuleType.rank,isPercent:E,isBottom:!0,value:N,style:p};if(w==="greaterThanAverage")return{type:n.CFRuleType.highlightCell,subType:n.CFSubRuleType.average,operator:n.CFNumberOperator.greaterThan,style:p};if(w==="lessThanAverage")return{type:n.CFRuleType.highlightCell,subType:n.CFSubRuleType.average,operator:n.CFNumberOperator.lessThan,style:p}};C.useEffect(()=>i.intercept(i.getInterceptPoints().submit,{handler(){return S({type:l,isPercent:d,value:c,style:g})}}),[l,d,c,g,i]);const y=T=>{e(S(T))};return u.jsxs("div",{children:[u.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:r.t("sheet.cf.panel.styleRule")}),u.jsx(M.Select,{className:"univer-mt-3 univer-w-full",value:l,options:o,onChange:T=>{v(T),y({type:T,isPercent:d,value:c,style:g})}}),["isNotBottom","isBottom"].includes(l)&&u.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center",children:[u.jsx(M.InputNumber,{min:1,max:1e3,value:c,onChange:T=>{const w=T||0;h(w),y({type:l,isPercent:d,value:w,style:g})}}),u.jsxs("div",{className:"univer-ml-3 univer-flex univer-items-center univer-text-xs",children:[u.jsx(M.Checkbox,{checked:d,onChange:T=>{m(!!T),y({type:l,isPercent:!!T,value:c,style:g})}}),r.t("sheet.cf.valueType.percent")]})]}),u.jsx("div",{className:Re,children:u.jsx(de,{rule:S({type:l,isPercent:d,value:c,style:g})})}),u.jsx(nt,{style:s==null?void 0:s.style,className:"univer-mt-3",onChange:T=>{b(T),y({type:l,isPercent:d,value:c,style:T})}})]})},rn=a.createInterceptorKey("beforeSubmit"),sn=a.createInterceptorKey("submit"),at=t=>t.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET).getUnitId(),lt=t=>{var e;return(e=t.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:e.getSheetId()},on=t=>{var R,I,V;const e=P.useDependency(a.LocaleService),i=P.useDependency(a.ICommandService),r=P.useDependency(a.IUniverInstanceService),s=P.useDependency(n.ConditionalFormattingRuleModel),o=P.useDependency(U.SheetsSelectionsService),l=at(r),v=lt(r),[c,h]=C.useState(void 0),d=C.useRef((I=(R=t.rule)==null?void 0:R.ranges)!=null?I:[]),m=C.useMemo(()=>{var O,k,f;let j=(O=t.rule)==null?void 0:O.ranges;return j!=null&&j.length||(j=(f=(k=o.getCurrentSelections())==null?void 0:k.map(F=>F.range))!=null?f:[]),d.current=j,j!=null&&j.length?j.map(F=>{const L=qe.serializeRange(F);return L==="NaN"?"":L}).filter(F=>!!F).join(","):""},[t.rule]),g=[{label:e.t("sheet.cf.ruleType.highlightCell"),value:"1"},{label:e.t("sheet.cf.panel.rankAndAverage"),value:"2"},{label:e.t("sheet.cf.ruleType.dataBar"),value:"3"},{label:e.t("sheet.cf.ruleType.colorScale"),value:"4"},{label:e.t("sheet.cf.ruleType.formula"),value:"5"},{label:e.t("sheet.cf.ruleType.iconSet"),value:"6"}],[b,S]=C.useState(()=>{var k,f;const j=(k=t.rule)==null?void 0:k.rule.type,O=g[0].value;if(!j)return O;switch(j){case n.CFRuleType.highlightCell:{switch((f=t.rule)==null?void 0:f.rule.subType){case n.CFSubRuleType.number:case n.CFSubRuleType.text:case n.CFSubRuleType.duplicateValues:case n.CFSubRuleType.uniqueValues:case n.CFSubRuleType.timePeriod:return"1";case n.CFSubRuleType.average:case n.CFSubRuleType.rank:return"2";case n.CFSubRuleType.formula:return"5"}break}case n.CFRuleType.dataBar:return"3";case n.CFRuleType.colorScale:return"4";case n.CFRuleType.iconSet:return"6"}return O}),y=C.useRef(void 0),_=C.useMemo(()=>new a.InterceptorManager({beforeSubmit:rn,submit:sn}),[]),T=C.useMemo(()=>{switch(b){case"1":return st;case"2":return nn;case"3":return zt;case"4":return Zt;case"5":return Yt;case"6":return tn;default:return st}},[b]);C.useEffect(()=>{const j=i.onCommandExecuted(O=>{if(O.id===U.RemoveSheetMutation.id){const k=O.params;k.subUnitId===v&&k.unitId===l&&t.onCancel()}O.id===U.SetWorksheetActiveOperation.id&&t.onCancel()});return()=>j.dispose()},[]);const w=j=>{y.current=j},E=j=>{const O=j.split(",").filter(k=>!!k).map(qe.deserializeRangeWithSheet).map(k=>k.range);d.current=O},N=()=>{if(c)return;const O=(()=>{const f=r.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET).getActiveSheet();if(!f)throw new Error("No active sheet found");return d.current.map(q=>U.setEndForRange(q,f.getRowCount(),f.getColumnCount())).filter(q=>!(Number.isNaN(q.startRow)||Number.isNaN(q.startColumn)))})();if(_.fetchThroughInterceptors(_.getInterceptPoints().beforeSubmit)(!0,null)){const f=_.fetchThroughInterceptors(_.getInterceptPoints().submit)(null,null);if(f){const F=at(r),L=lt(r);if(!F||!L)throw new Error("No active sheet found");let q={};t.rule&&t.rule.cfId?(q={...t.rule,ranges:O,rule:f},i.executeCommand(n.SetCfCommand.id,{unitId:F,subUnitId:L,rule:q}),t.onCancel()):(q={cfId:s.createCfId(F,L),ranges:O,rule:f,stopIfTrue:!1},i.executeCommand(n.AddCfCommand.id,{unitId:F,subUnitId:L,rule:q}),t.onCancel())}}},p=()=>{t.onCancel()},x=(j,O)=>{j?O.length<1?h(e.t("sheet.cf.errorMessage.rangeError")):h(void 0):h(e.t("sheet.cf.errorMessage.rangeError"))};return u.jsxs("div",{children:[u.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:e.t("sheet.cf.panel.range")}),u.jsxs("div",{className:"univer-mt-4",children:[u.jsx(xe.RangeSelector,{unitId:l,subUnitId:v,initialValue:m,onChange:(j,O)=>E(O),onVerify:x}),c&&u.jsx("div",{className:"univer-mt-1 univer-text-xs univer-text-red-500",children:c})]}),u.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:e.t("sheet.cf.panel.styleType")}),u.jsx(M.Select,{className:"univer-mt-4 univer-w-full",value:b,options:g,onChange:j=>S(j)}),u.jsx(T,{interceptorManager:_,rule:(V=t.rule)==null?void 0:V.rule,onChange:w}),u.jsxs("div",{className:"univer-mt-4 univer-flex univer-justify-end",children:[u.jsx(M.Button,{onClick:p,children:e.t("sheet.cf.panel.cancel")}),u.jsx(M.Button,{className:"univer-ml-3",variant:"primary",onClick:N,children:e.t("sheet.cf.panel.submit")})]})]})};var an=Object.getOwnPropertyDescriptor,ln=(t,e,i,r)=>{for(var s=r>1?void 0:r?an(e,i):e,o=t.length-1,l;o>=0;o--)(l=t[o])&&(s=l(s)||s);return s},un=(t,e)=>(i,r)=>e(i,r,t);let ce=class extends a.Disposable{constructor(e){super();ee(this,"_initLocal",()=>{});ee(this,"_findReplaceIndex",e=>{const i=/\{([^}]+)?\}/g,r=[];let s=i.exec(e);for(;s;)r.push({startIndex:s.index,key:Number(s[1]),endIndex:s.index+s[0].length-1}),s=i.exec(e);return r});this._localeService=e,this._initLocal()}tWithReactNode(e,...i){const r=this._localeService.getLocales(),s=e.split("."),o=r&&this._localeService.resolveKeyPath(r,s);if(typeof o=="string"){const l=[];return this._findReplaceIndex(o).forEach((v,c,h)=>{const d=h[c-1]||{endIndex:-1};if(d.endIndex+1<v.startIndex){const m=o.slice(d.endIndex+1,v.startIndex);m&&l.push(m)}if(i[v.key]&&l.push(i[v.key]),c===h.length-1){const m=o.slice(v.endIndex+1);m&&l.push(m)}}),l}return[]}};ce=ln([un(0,a.Inject(a.LocaleService))],ce);const cn=(t,e)=>{const i=t.rule;switch(i.type){case n.CFRuleType.colorScale:return e.t("sheet.cf.ruleType.colorScale");case n.CFRuleType.dataBar:return e.t("sheet.cf.ruleType.dataBar");case n.CFRuleType.iconSet:return e.t("sheet.cf.ruleType.iconSet");case n.CFRuleType.highlightCell:switch(i.subType){case n.CFSubRuleType.average:{const r=i.operator;return e.t(`sheet.cf.preview.describe.${r}`,e.t("sheet.cf.subRuleType.average"))}case n.CFSubRuleType.duplicateValues:return e.t("sheet.cf.subRuleType.duplicateValues");case n.CFSubRuleType.uniqueValues:return e.t("sheet.cf.subRuleType.uniqueValues");case n.CFSubRuleType.number:{const r=i.operator;return e.t(`sheet.cf.preview.describe.${r}`,...Array.isArray(i.value)?i.value.map(s=>String(s)):[String(i.value||"")])}case n.CFSubRuleType.text:{const r=i.operator;return e.t(`sheet.cf.preview.describe.${r}`,i.value||"")}case n.CFSubRuleType.timePeriod:{const r=i.operator;return e.t(`sheet.cf.preview.describe.${r}`)}case n.CFSubRuleType.rank:return i.isPercent?i.isBottom?e.t("sheet.cf.preview.describe.bottomNPercent",String(i.value)):e.t("sheet.cf.preview.describe.topNPercent",String(i.value)):i.isBottom?e.t("sheet.cf.preview.describe.bottomN",String(i.value)):e.t("sheet.cf.preview.describe.topN",String(i.value));case n.CFSubRuleType.formula:return e.t("sheet.cf.ruleType.formula")}}};let ut=0;const dn=t=>{const{onClick:e}=t,i=P.useDependency(n.ConditionalFormattingRuleModel),r=P.useDependency(a.IUniverInstanceService),s=P.useDependency(U.SheetsSelectionsService),o=P.useDependency(a.ICommandService),l=P.useDependency(a.LocaleService),v=P.useDependency(a.Injector),c=P.useDependency(P.ISidebarService),h=P.useDependency(ce),d=P.useObservable(()=>r.getCurrentTypeOfUnit$(a.UniverInstanceType.UNIVER_SHEET),void 0,void 0,[]),m=d.getUnitId(),g=d.getActiveSheet();if(!g)throw new Error("No active sheet found");const b=g.getSheetId(),[S,y]=C.useState([]),[_,T]=C.useState("2"),[w,E]=C.useState(0),[N,p]=C.useState(-1),[x,R]=C.useState(ut),I=C.useRef(null),V=[{label:l.t("sheet.cf.panel.workSheet"),value:"2"},{label:l.t("sheet.cf.panel.selectedRange"),value:"1"}],j=()=>{const D=i.getSubunitRules(m,b);if(!D||!D.length)return[];if(_==="1"){const A=s.getCurrentLastSelection();if(!A)return[];const H=A.range;return D.filter(G=>G.ranges.some(Z=>a.Rectangle.intersects(Z,H)))}else if(_==="2")return[...D];return[]},[O,k]=C.useState(j);B.useHighlightRange(S),C.useEffect(()=>{const D=o.onCommandExecuted(A=>{A.id===U.SetWorksheetActiveOperation.id&&E(Math.random())});return()=>D.dispose()}),C.useEffect(()=>{k(j)},[_,w,m,b]),C.useEffect(()=>{if(_==="2")return;const D=new X.Observable(A=>{const H=[U.SetSelectionsOperation.id,n.AddConditionalRuleMutation.id,n.SetConditionalRuleMutation.id,n.DeleteConditionalRuleMutation.id,n.MoveConditionalRuleMutation.id],W=o.onCommandExecuted(G=>{const{id:Z,params:te}=G,ne=r.getCurrentUnitOfType(a.UniverInstanceType.UNIVER_SHEET).getUnitId();H.includes(Z)&&te.unitId===ne&&A.next(null)});return()=>W.dispose()}).pipe(X.debounceTime(16)).subscribe(()=>{k(j)});return()=>{D.unsubscribe()}},[r,_,m,b]),C.useEffect(()=>{const D=i.$ruleChange.subscribe(()=>{E(Math.random())});return()=>D.unsubscribe()},[i]),C.useEffect(()=>{const D=()=>{var G,Z;const W=Math.max(0,((Z=(G=I.current)==null?void 0:G.getBoundingClientRect().width)!=null?Z:0)-8);return ut=W,W},H=new X.Observable(W=>{const G=c.getContainer();if(G){let Z=setTimeout(()=>{W.next(void 0)},150);const te=()=>{Z&&clearTimeout(Z),Z=null},ne=_e=>{_e.propertyName==="width"&&(te(),W.next(void 0))};return G.addEventListener("transitionend",ne),()=>{te(),G.removeEventListener("transitionend",ne)}}}).pipe(X.debounceTime(16)).subscribe(()=>{R(D())});return()=>{H.unsubscribe()}},[]);const f=D=>{var W;const A=r.getCurrentUnitOfType(a.UniverInstanceType.UNIVER_SHEET).getUnitId(),H=(W=r.getCurrentUnitOfType(a.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:W.getSheetId();if(!A||!H)throw new Error("No active sheet found");o.executeCommand(n.DeleteCfCommand.id,{unitId:A,subUnitId:H,cfId:D.cfId})},F=(D,A)=>{p(A.y)},L=(D,A,H)=>{var _e;p(-1);const W=r.getCurrentUnitOfType(a.UniverInstanceType.UNIVER_SHEET).getUnitId(),G=(_e=r.getCurrentUnitOfType(a.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:_e.getSheetId();if(!W||!G)throw new Error("No active sheet found");const Z=wt=>{const Nt=O.length;return Math.min(Nt-1,Math.max(0,wt))},te=O[Z(A.y)].cfId,ne=O[Z(H.y)].cfId;te!==ne&&o.executeCommand(n.MoveCfCommand.id,{unitId:W,subUnitId:G,start:{id:te,type:"self"},end:{id:ne,type:H.y>A.y?"after":"before"}})},q=()=>{t.onCreate()},J=()=>{_==="2"?o.executeCommand(n.ClearWorksheetCfCommand.id):_==="1"&&O.map(A=>({unitId:m,subUnitId:b,cfId:A.cfId})).forEach(A=>{o.executeCommand(n.DeleteCfCommand.id,A)})},Q=C.useMemo(()=>{const D=r.getCurrentUnitOfType(a.UniverInstanceType.UNIVER_SHEET),A=D.getActiveSheet();return O.filter(H=>{const W=H.ranges;return U.checkRangesEditablePermission(v,D.getUnitId(),A.getSheetId(),W)})},[O]),se=Q.map((D,A)=>({i:D.cfId,x:0,w:12,y:A,h:1,isResizable:!1})),oe=C.useMemo(()=>{const D=r.getCurrentUnitOfType(a.UniverInstanceType.UNIVER_SHEET),A=D.getActiveSheet();return O.every(H=>{const W=H.ranges;return U.checkRangesEditablePermission(v,D.getUnitId(),A.getSheetId(),W)})},[O]);return u.jsxs("div",{children:[u.jsxs("div",{className:"univer-flex univer-items-center univer-justify-between univer-gap-2 univer-text-sm",children:[u.jsx("div",{className:"univer-flex univer-items-center univer-gap-2",children:h.tWithReactNode("sheet.cf.panel.managerRuleSelect",u.jsx(M.Select,{className:"univer-w-36",options:V,value:_,onChange:D=>{T(D)}})).map((D,A)=>u.jsx("span",{children:D},A))}),u.jsxs("div",{className:"univer-flex univer-justify-end",children:[u.jsx(M.Tooltip,{title:l.t("sheet.cf.panel.createRule"),placement:"bottom",children:u.jsx("a",{className:"univer-size-5 univer-cursor-pointer",onClick:q,children:u.jsx(Ct,{})})}),O.length&&oe?u.jsx(M.Tooltip,{title:l.t("sheet.cf.panel.clear"),placement:"bottom",children:u.jsx("a",{className:"univer-size-5 univer-cursor-pointer",onClick:J,children:u.jsx(Ve,{className:"univer-text-red-500"})})}):u.jsx("div",{children:u.jsx(Ve,{className:"univer-text-gray-300"})})]})]}),u.jsx("div",{ref:I,children:x>0&&u.jsx(M.ReactGridLayout,{className:"[&_.react-grid-item]:univer-transition-none [&_.react-grid-placeholder]:univer-rounded [&_.react-grid-placeholder]:!univer-bg-gray-200",draggableHandle:".draggableHandle",layout:se,cols:12,rowHeight:60,width:x,margin:[0,10],onDragStop:L,onDragStart:F,children:Q==null?void 0:Q.map((D,A)=>u.jsx("div",{children:u.jsxs("div",{className:M.clsx("univer-group univer-relative univer-flex univer-items-center univer-justify-between univer-rounded univer-py-2 univer-pl-5 univer-pr-8 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",{"univer-bg-gray-100 dark:!univer-bg-gray-700":N===A}),onMouseMove:()=>{D.ranges!==S&&y(D.ranges)},onMouseLeave:()=>y([]),onClick:()=>{e(D)},children:[u.jsx("div",{className:M.clsx("univer-absolute univer-left-0 univer-hidden univer-size-5 univer-cursor-grab univer-items-center univer-justify-center univer-rounded group-hover:univer-flex","draggableHandle"),onClick:H=>H.stopPropagation(),children:u.jsx(It,{})}),u.jsxs("div",{className:"univer-min-w-0 univer-max-w-full univer-flex-shrink univer-overflow-hidden",children:[u.jsx("div",{className:"univer-text-sm univer-text-gray-900 dark:!univer-text-white",children:cn(D,l)}),u.jsx("div",{className:"univer-text-xs univer-text-gray-400",children:D.ranges.map(H=>qe.serializeRange(H)).join(",")})]}),u.jsx("div",{children:u.jsx(de,{rule:D.rule})}),u.jsx("div",{className:M.clsx("univer-absolute univer-right-1 univer-hidden univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded hover:univer-bg-gray-200 group-hover:univer-flex",{"univer-flex univer-items-center univer-justify-center":N===A}),onClick:H=>{H.stopPropagation(),f(D),y([])},children:u.jsx(Ve,{})})]})},`${D.cfId}`))})})]})},vn=t=>{const[e,i]=C.useState(t.rule),[r,s]=C.useState(!!t.rule),o=()=>{s(!0)},l=()=>{s(!1),i(void 0)},v=c=>{i(c),s(!0)};return u.jsx("div",{className:"univer-flex univer-h-full univer-flex-col univer-justify-between univer-py-4",children:r?u.jsx(on,{onCancel:l,rule:e}):u.jsx(dn,{onClick:v,onCreate:o})})};var mn=Object.getOwnPropertyDescriptor,hn=(t,e,i,r)=>{for(var s=r>1?void 0:r?mn(e,i):e,o=t.length-1,l;o>=0;o--)(l=t[o])&&(s=l(s)||s);return s},ve=(t,e)=>(i,r)=>e(i,r,t);const je="sheet.conditional.formatting.panel";let Ce=class extends a.Disposable{constructor(e,i,r,s,o){super();ee(this,"_sidebarDisposable",null);this._univerInstanceService=e,this._injector=i,this._componentManager=r,this._sidebarService=s,this._localeService=o,this._initPanel(),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(a.UniverInstanceType.UNIVER_SHEET).subscribe(l=>{var v;l||(v=this._sidebarDisposable)==null||v.dispose()})),this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(l=>{l.id===je&&(l.visible||setTimeout(()=>{this._sidebarService.sidebarOptions$.next({visible:!1})}))}))}openPanel(e){const i={id:je,header:{title:this._localeService.t("sheet.cf.title")},children:{label:je,rule:e,key:a.generateRandomId(4)},onClose:()=>this._sidebarDisposable=null};this._sidebarDisposable=this._sidebarService.open(i)}_initPanel(){this.disposeWithMe(this._componentManager.register(je,vn))}};Ce=hn([ve(0,a.IUniverInstanceService),ve(1,a.Inject(a.Injector)),ve(2,a.Inject(P.ComponentManager)),ve(3,a.Inject(P.ISidebarService)),ve(4,a.Inject(a.LocaleService))],Ce);var z=(t=>(t[t.createRule=1]="createRule",t[t.viewRule=2]="viewRule",t[t.highlightCell=3]="highlightCell",t[t.rank=4]="rank",t[t.formula=5]="formula",t[t.colorScale=6]="colorScale",t[t.dataBar=7]="dataBar",t[t.icon=8]="icon",t[t.clearRangeRules=9]="clearRangeRules",t[t.clearWorkSheetRules=10]="clearWorkSheetRules",t))(z||{});const Fe={id:"sheet.operation.open.conditional.formatting.panel",type:a.CommandType.OPERATION,handler:(t,e)=>{var v;const i=t.get(Ce),r=t.get(U.SheetsSelectionsService),s=t.get(a.ICommandService),o=((v=r.getCurrentSelections())==null?void 0:v.map(c=>c.range))||[];switch(e.value){case 3:{i.openPanel({...n.createDefaultRule(),ranges:o});break}case 4:{const c={...n.createDefaultRule,ranges:o,rule:{type:n.CFRuleType.highlightCell,subType:n.CFSubRuleType.rank}};i.openPanel(c);break}case 5:{const c={...n.createDefaultRule,ranges:o,rule:{type:n.CFRuleType.highlightCell,subType:n.CFSubRuleType.formula,value:"="}};i.openPanel(c);break}case 6:{const c={...n.createDefaultRule,ranges:o,rule:{type:n.CFRuleType.colorScale,config:[]}};i.openPanel(c);break}case 7:{const c={...n.createDefaultRule,ranges:o,rule:{type:n.CFRuleType.dataBar,isShowValue:!0}};i.openPanel(c);break}case 8:{const c={...n.createDefaultRule,ranges:o,rule:{type:n.CFRuleType.iconSet,config:[],isShowValue:!0}};i.openPanel(c);break}case 2:{i.openPanel();break}case 1:{i.openPanel({...n.createDefaultRule(),ranges:o});break}case 9:{s.executeCommand(n.ClearRangeCfCommand.id,{ranges:o});break}case 10:{s.executeCommand(n.ClearWorksheetCfCommand.id);break}}return!0}};var gn=Object.getOwnPropertyDescriptor,pn=(t,e,i,r)=>{for(var s=r>1?void 0:r?gn(e,i):e,o=t.length-1,l;o>=0;o--)(l=t[o])&&(s=l(s)||s);return s},me=(t,e)=>(i,r)=>e(i,r,t);exports.ConditionalFormattingClearController=class extends a.Disposable{constructor(e,i,r,s,o){super(),this._injector=e,this._univerInstanceService=i,this._sheetInterceptorService=r,this._selectionManagerService=s,this._conditionalFormattingRuleModel=o,this._init()}_init(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{var o;const i=[],r=[],s={redos:i,undos:r};if([U.ClearSelectionFormatCommand.id,U.ClearSelectionAllCommand.id].includes(e.id)){const l=(o=this._selectionManagerService.getCurrentSelections())==null?void 0:o.map(S=>S.range);if(!l)return s;const v=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET),c=v.getActiveSheet();if(!c)return s;const h=v.getUnitId(),d=c.getSheetId(),m=this._conditionalFormattingRuleModel.getSubunitRules(h,d);if(!m||!m.length)return s;const{redos:g,undos:b}=ct(this._injector,m,l,h,d);i.push(...g),r.push(...b)}return s}})),this.disposeWithMe(this._sheetInterceptorService.interceptRanges({getMutations:({unitId:e,subUnitId:i,ranges:r})=>{const s=[],o=[],l={redos:s,undos:o};if(!r||!r.length)return l;const v=this._conditionalFormattingRuleModel.getSubunitRules(e,i);if(!v||!v.length)return l;const{redos:c,undos:h}=ct(this._injector,v,r,e,i);return s.push(...c),o.push(...h),l}}))}};exports.ConditionalFormattingClearController=pn([me(0,a.Inject(a.Injector)),me(1,a.Inject(a.IUniverInstanceService)),me(2,a.Inject(U.SheetInterceptorService)),me(3,a.Inject(U.SheetsSelectionsService)),me(4,a.Inject(n.ConditionalFormattingRuleModel))],exports.ConditionalFormattingClearController);function ct(t,e,i,r,s){const o=[],l=[];return e.filter(v=>i.some(c=>v.ranges.some(h=>a.Rectangle.getIntersects(h,c)))).forEach(v=>{const h=new U.RangeMergeUtil().add(...v.ranges).subtract(...i).merge();if(h.length){const d={id:n.SetConditionalRuleMutation.id,params:{unitId:r,subUnitId:s,rule:{...v,ranges:h}}},m=n.setConditionalRuleMutationUndoFactory(t,d.params);o.push(d),l.push(...m)}else{const d={id:n.DeleteConditionalRuleMutation.id,params:{unitId:r,subUnitId:s,cfId:v.cfId}},m=n.DeleteConditionalRuleMutationUndoFactory(t,d.params);o.push(d),l.push(...m)}}),{redos:o,undos:l}}var fn=Object.getOwnPropertyDescriptor,Cn=(t,e,i,r)=>{for(var s=r>1?void 0:r?fn(e,i):e,o=t.length-1,l;o>=0;o--)(l=t[o])&&(s=l(s)||s);return s},he=(t,e)=>(i,r)=>e(i,r,t);let ye=class extends a.Disposable{constructor(e,i,r,s,o){super();ee(this,"_copyInfo");this._sheetClipboardService=e,this._conditionalFormattingRuleModel=i,this._injector=r,this._conditionalFormattingViewModel=s,this._univerInstanceService=o,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:n.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onBeforeCopy:(e,i,r)=>this._collectConditionalRule(e,i,r),onPasteCells:(e,i,r,s)=>{const{copyType:o=B.COPY_TYPE.COPY,pasteType:l}=s,{range:v}=e||{},{range:c}=i;return this._generateConditionalFormattingMutations(c,{copyType:o,pasteType:l,copyRange:v})}}))}_collectConditionalRule(e,i,r){const s=new a.ObjectMatrix,o={};this._copyInfo={matrix:s,info:{unitId:e,subUnitId:i,cfMap:o}};const l=this._injector.invoke(d=>U.rangeToDiscreteRange(r,d,e,i));if(!l)return;const{rows:v,cols:c}=l,h=new Set;v.forEach((d,m)=>{c.forEach((g,b)=>{const S=this._conditionalFormattingViewModel.getCellCfs(e,i,d,g);S&&(S.forEach(y=>h.add(y.cfId)),s.setValue(m,b,S.map(y=>y.cfId)))})}),h.forEach(d=>{const m=this._conditionalFormattingRuleModel.getRule(e,i,d);m&&(o[d]=m.rule)})}_generateConditionalFormattingMutations(e,i){const r=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET),s=r.getActiveSheet(),o=r.getUnitId();if(!s)return{redos:[],undos:[]};const l=s.getSheetId();if(i.copyType===B.COPY_TYPE.CUT)return this._copyInfo=null,{redos:[],undos:[]};if(!this._copyInfo||!i.copyRange)return{redos:[],undos:[]};if(![B.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT,B.PREDEFINED_HOOK_NAME.DEFAULT_PASTE,B.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_BESIDES_BORDER].includes(i.pasteType))return{redos:[],undos:[]};const{ranges:[c,h],mapFunc:d}=B.virtualizeDiscreteRanges([i.copyRange,e]),m=B.getRepeatRange(c,h,!0),g={};a.Range.foreach(h,(p,x)=>{const{row:R,col:I}=d(p,x),V=this._conditionalFormattingViewModel.getCellCfs(o,l,R,I);V&&V.forEach(j=>{if(!g[j.cfId]){const O=new a.ObjectMatrix;g[j.cfId]=O;const k=this._conditionalFormattingRuleModel.getRule(o,l,j.cfId);k==null||k.ranges.forEach(f=>{a.Range.foreach(f,(F,L)=>{O.setValue(F,L,1)})})}g[j.cfId].realDeleteValue(R,I)})});const{matrix:b,info:S}=this._copyInfo,y=[];let _=this._conditionalFormattingRuleModel.createCfId(o,l);const T={},w=p=>{if(T[p])return T[p];const x=S==null?void 0:S.cfMap[p],R=[...this._conditionalFormattingRuleModel.getSubunitRules(o,l)||[],...y].find(I=>a.Tools.diffValue(I.rule,x));if(R)return T[p]=R,R;{const I={rule:x,cfId:_,ranges:[],stopIfTrue:!1};return T[p]=I,y.push(I),_=`${Number(_)+1}`,I}};m.forEach(p=>{b&&b.forValue((x,R,I)=>{const V=a.Rectangle.getPositionRange({startRow:x,endRow:x,startColumn:R,endColumn:R},p.startRange),{row:j,col:O}=d(V.startRow,V.startColumn);I.forEach(k=>{if(!g[k]){const f=w(k),F=new a.ObjectMatrix;g[k]=F,f.ranges.forEach(L=>{a.Range.foreach(L,(q,J)=>{F.setValue(q,J,1)})})}g[k].setValue(j,O,1)})})});const E=[],N=[];for(const p in g){const x=g[p],R=U.findAllRectangle(U.createTopMatrixFromMatrix(x));if(!R.length){const I={unitId:o,subUnitId:l,cfId:p};E.push({id:n.DeleteConditionalRuleMutation.id,params:I}),N.push(...n.DeleteConditionalRuleMutationUndoFactory(this._injector,I))}if(y.some(I=>I.cfId===p)){const I=w(p),V={unitId:o,subUnitId:l,rule:{...I,ranges:R}};E.push({id:n.AddConditionalRuleMutation.id,params:V}),N.push(n.AddConditionalRuleMutationUndoFactory(this._injector,V))}else{const I=this._conditionalFormattingRuleModel.getRule(o,l,p);if(!I)continue;const V={unitId:o,subUnitId:l,rule:{...I,ranges:R}};E.push({id:n.SetConditionalRuleMutation.id,params:V}),N.push(...n.setConditionalRuleMutationUndoFactory(this._injector,V))}}return{redos:E,undos:N}}};ye=Cn([he(0,a.Inject(B.ISheetClipboardService)),he(1,a.Inject(n.ConditionalFormattingRuleModel)),he(2,a.Inject(a.Injector)),he(3,a.Inject(n.ConditionalFormattingViewModel)),he(4,a.Inject(a.IUniverInstanceService))],ye);var yn=Object.getOwnPropertyDescriptor,bn=(t,e,i,r)=>{for(var s=r>1?void 0:r?yn(e,i):e,o=t.length-1,l;o>=0;o--)(l=t[o])&&(s=l(s)||s);return s},$e=(t,e)=>(i,r)=>e(i,r,t);let be=class extends a.Disposable{constructor(t,e,i){super(),this._localeService=t,this._commandService=e,this._sheetPermissionCheckController=i,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(t=>{t.id===n.AddCfCommand.id&&(this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[U.WorkbookEditablePermission],rangeTypes:[U.RangeProtectionPermissionEditPoint],worksheetTypes:[U.WorksheetEditPermission,U.WorksheetSetCellStylePermission]},t.params.rule.ranges)||this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.setStyleErr")))}))}};be=bn([$e(0,a.Inject(a.LocaleService)),$e(1,a.ICommandService),$e(2,a.Inject(U.SheetPermissionCheckController))],be);var In=Object.getOwnPropertyDescriptor,Sn=(t,e,i,r)=>{for(var s=r>1?void 0:r?In(e,i):e,o=t.length-1,l;o>=0;o--)(l=t[o])&&(s=l(s)||s);return s},Me=(t,e)=>(i,r)=>e(i,r,t);let Ie=class extends a.Disposable{constructor(t,e,i,r){super(),this._conditionalFormattingRuleModel=t,this._univerInstanceService=e,this._injector=i,this._refRangeService=r,this._initRefRange()}_initRefRange(){const t=new Map,e=(r,s,o)=>`${r}_${s}_${o}`,i=(r,s,o)=>{const l=c=>{const h=[...o.ranges],d=h.map(g=>U.handleDefaultRangeChangeWithEffectRefCommands(g,c)).filter(g=>!!g);if(n.isRangesEqual(d,h))return{redos:[],undos:[]};if(d.length){const g={unitId:r,subUnitId:s,rule:{...o,ranges:d}},b=[{id:n.SetConditionalRuleMutation.id,params:g}],S=n.setConditionalRuleMutationUndoFactory(this._injector,g);return{redos:b,undos:S}}else{const g={unitId:r,subUnitId:s,cfId:o.cfId},b=[{id:n.DeleteConditionalRuleMutation.id,params:g}],S=n.DeleteConditionalRuleMutationUndoFactory(this._injector,g);return{redos:b,undos:S}}},v=[];o.ranges.forEach(c=>{const h=this._refRangeService.registerRefRange(c,l);v.push(()=>h.dispose())}),t.set(e(r,s,o.cfId),()=>v.forEach(c=>c()))};this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe(r=>{const{unitId:s,subUnitId:o,rule:l}=r,v=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET),c=v.getActiveSheet();if(!(r.unitId!==v.getUnitId()||r.subUnitId!==(c==null?void 0:c.getSheetId())))switch(r.type){case"add":{i(r.unitId,r.subUnitId,r.rule);break}case"delete":{const h=t.get(e(s,o,l.cfId));h&&h();break}case"set":{const h=t.get(e(s,o,l.cfId));h&&h(),i(r.unitId,r.subUnitId,r.rule)}}})),this.disposeWithMe(a.toDisposable(()=>{t.forEach(r=>{r()}),t.clear()}))}};Ie=Sn([Me(0,a.Inject(n.ConditionalFormattingRuleModel)),Me(1,a.Inject(a.IUniverInstanceService)),Me(2,a.Inject(a.Injector)),Me(3,a.Inject(U.RefRangeService))],Ie);var xn=Object.getOwnPropertyDescriptor,Tn=(t,e,i,r)=>{for(var s=r>1?void 0:r?xn(e,i):e,o=t.length-1,l;o>=0;o--)(l=t[o])&&(s=l(s)||s);return s},le=(t,e)=>(i,r)=>e(i,r,t);let Se=class extends a.Disposable{constructor(e,i,r,s,o,l){super();ee(this,"_ruleChangeCacheMap",new Map);this._sheetInterceptorService=e,this._conditionalFormattingService=i,this._univerInstanceService=r,this._renderManagerService=s,this._conditionalFormattingViewModel=o,this._conditionalFormattingRuleModel=l,this._initViewModelInterceptor(),this._initSkeleton(),this.disposeWithMe(()=>{this._ruleChangeCacheMap.clear()})}_markDirtySkeleton(){var i,r,s;const e=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET).getUnitId();(i=this._renderManagerService.getRenderById(e))==null||i.with(B.SheetSkeletonManagerService).reCalculate(),(s=(r=this._renderManagerService.getRenderById(e))==null?void 0:r.mainComponent)==null||s.makeDirty()}_initSkeleton(){this.disposeWithMe(X.merge(this._conditionalFormattingRuleModel.$ruleChange,this._conditionalFormattingViewModel.markDirty$).pipe(fe.bufferTime(16),fe.filter(e=>!!e.length),fe.filter(e=>{const i=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!i)return!1;const r=i.getActiveSheet();return r?e.filter(s=>s.unitId===i.getUnitId()&&s.subUnitId===r.getSheetId()).length>0:!1})).subscribe(()=>this._markDirtySkeleton()))}_initViewModelInterceptor(){this.disposeWithMe(this._sheetInterceptorService.intercept(U.INTERCEPTOR_POINT.CELL_CONTENT,{effect:a.InterceptorEffectEnum.Style,handler:(e,i,r)=>{const s=this._conditionalFormattingService.composeStyle(i.unitId,i.subUnitId,i.row,i.col);if(!s)return r(e);const o=i.workbook.getStyles(),l=(typeof(e==null?void 0:e.s)=="string"?o.get(e==null?void 0:e.s):e==null?void 0:e.s)||{},v=e===i.rawData?{...i.rawData}:e;if(s.style){const c={...l,...s.style};Object.assign(v,{s:c})}return v.fontRenderExtension||(v.fontRenderExtension={},s.isShowValue!==void 0&&(v.fontRenderExtension.isSkip=!s.isShowValue)),s.dataBar&&(v.dataBar=s.dataBar),s.iconSet&&(v.iconSet=s.iconSet,v.fontRenderExtension.leftOffset=n.DEFAULT_PADDING+n.DEFAULT_WIDTH),r(v)},priority:10}))}};Se=Tn([le(0,a.Inject(U.SheetInterceptorService)),le(1,a.Inject(n.ConditionalFormattingService)),le(2,a.Inject(a.IUniverInstanceService)),le(3,a.Inject(ht.IRenderManagerService)),le(4,a.Inject(n.ConditionalFormattingViewModel)),le(5,a.Inject(n.ConditionalFormattingRuleModel))],Se);const Rt="sheets-conditional-formatting-ui.config",Oe={};var Rn=Object.defineProperty,Fn=Object.getOwnPropertyDescriptor,_n=(t,e,i)=>e in t?Rn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,wn=(t,e,i,r)=>{for(var s=r>1?void 0:r?Fn(e,i):e,o=t.length-1,l;o>=0;o--)(l=t[o])&&(s=l(s)||s);return s},He=(t,e)=>(i,r)=>e(i,r,t),Ft=(t,e,i)=>_n(t,typeof e!="symbol"?e+"":e,i);exports.UniverSheetsConditionalFormattingMobileUIPlugin=class extends a.Plugin{constructor(e=Oe,i,r,s){super(),this._config=e,this._injector=i,this._commandService=r,this._configService=s;const{menu:o,...l}=a.merge({},Oe,this._config);o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(Rt,l),this._initCommand(),this._injector.add([Se]),this._injector.add([Ie]),this._injector.add([ye]),this._injector.add([be]),this._injector.add([ce])}_initCommand(){[Ge,Ze,ze,Ye,Ke,Xe,Je,Qe,et,Fe].forEach(e=>{this._commandService.registerCommand(e)})}};Ft(exports.UniverSheetsConditionalFormattingMobileUIPlugin,"pluginName",`${n.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_MOBILE_UI_PLUGIN`);Ft(exports.UniverSheetsConditionalFormattingMobileUIPlugin,"type",a.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsConditionalFormattingMobileUIPlugin=wn([a.DependentOn(n.UniverSheetsConditionalFormattingPlugin),He(1,a.Inject(a.Injector)),He(2,a.Inject(a.ICommandService)),He(3,a.IConfigService)],exports.UniverSheetsConditionalFormattingMobileUIPlugin);var Nn=Object.getOwnPropertyDescriptor,En=(t,e,i,r)=>{for(var s=r>1?void 0:r?Nn(e,i):e,o=t.length-1,l;o>=0;o--)(l=t[o])&&(s=l(s)||s);return s},ge=(t,e)=>(i,r)=>e(i,r,t);let Ue=class extends a.Disposable{constructor(t,e,i,r,s){super(),this._injector=t,this._univerInstanceService=e,this._autoFillService=i,this._conditionalFormattingRuleModel=r,this._conditionalFormattingViewModel=s,this._initAutoFill()}_initAutoFill(){const t=()=>({redos:[],undos:[]}),e=(s,o,l,v,c)=>{var b;const h=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET).getUnitId(),d=(b=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:b.getSheetId();if(!h||!d)return;const m={startRow:s.row,startColumn:s.col,endColumn:s.col,endRow:s.row},g={startRow:o.row,startColumn:o.col,endColumn:o.col,endRow:o.row};a.Range.foreach(l,(S,y)=>{const _=a.Rectangle.getPositionRange({startRow:S,startColumn:y,endColumn:y,endRow:S},m),T=a.Rectangle.getPositionRange({startRow:S,startColumn:y,endColumn:y,endRow:S},g),{row:w,col:E}=c(_.startRow,_.startColumn),N=this._conditionalFormattingViewModel.getCellCfs(h,d,w,E),{row:p,col:x}=c(T.startRow,T.startColumn),R=this._conditionalFormattingViewModel.getCellCfs(h,d,p,x);R&&R.forEach(I=>{let V=v.get(I.cfId);if(!v.get(I.cfId)){const j=this._conditionalFormattingRuleModel.getRule(h,d,I.cfId);if(!j)return;V=new a.ObjectMatrix,j.ranges.forEach(O=>{a.Range.foreach(O,(k,f)=>{V.setValue(k,f,1)})}),v.set(I.cfId,V)}V.realDeleteValue(p,x)}),N&&N.forEach(I=>{let V=v.get(I.cfId);if(!v.get(I.cfId)){const j=this._conditionalFormattingRuleModel.getRule(h,d,I.cfId);if(!j)return;V=new a.ObjectMatrix,j.ranges.forEach(O=>{a.Range.foreach(O,(k,f)=>{V.setValue(k,f,1)})}),v.set(I.cfId,V)}V.setValue(p,x,1)})})},i=(s,o)=>{var T,w,E;const l=(T=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:T.getUnitId(),v=(E=(w=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:w.getActiveSheet())==null?void 0:E.getSheetId(),c=new Map,h=[],d=[];if(!l||!v)return t();const m=B.virtualizeDiscreteRanges([s,o]),[g,b]=m.ranges,{mapFunc:S}=m,y={row:g.startRow,col:g.startColumn};return B.getAutoFillRepeatRange(g,b).forEach(N=>{e(y,N.repeatStartCell,N.relativeRange,c,S)}),c.forEach((N,p)=>{const x=this._conditionalFormattingRuleModel.getRule(l,v,p);if(!x)return;const R=U.findAllRectangle(U.createTopMatrixFromMatrix(N));if(R.length){const I={unitId:l,subUnitId:v,rule:{...x,ranges:R}};h.push({id:n.SetConditionalRuleMutation.id,params:I}),d.push(...n.setConditionalRuleMutationUndoFactory(this._injector,I))}else{const I={unitId:l,subUnitId:v,cfId:x.cfId};h.push({id:n.DeleteConditionalRuleMutation.id,params:I}),d.push(...n.DeleteConditionalRuleMutationUndoFactory(this._injector,I))}}),{undos:d,redos:h}},r={id:n.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onFillData:(s,o,l)=>{if(l===B.APPLY_TYPE.COPY||l===B.APPLY_TYPE.ONLY_FORMAT||l===B.APPLY_TYPE.SERIES){const{source:v,target:c}=s;return i(v,c)}return t()}};this.disposeWithMe(this._autoFillService.addHook(r))}};Ue=En([ge(0,a.Inject(a.Injector)),ge(1,a.Inject(a.IUniverInstanceService)),ge(2,a.Inject(B.IAutoFillService)),ge(3,a.Inject(n.ConditionalFormattingRuleModel)),ge(4,a.Inject(n.ConditionalFormattingViewModel))],Ue);var jn=Object.getOwnPropertyDescriptor,Mn=(t,e,i,r)=>{for(var s=r>1?void 0:r?jn(e,i):e,o=t.length-1,l;o>=0;o--)(l=t[o])&&(s=l(s)||s);return s},dt=(t,e)=>(i,r)=>e(i,r,t);let ke=class extends a.Disposable{constructor(t,e){super(),this._sheetInterceptorService=t,this._conditionalFormattingService=e,this._initInterceptorEditorEnd()}_initInterceptorEditorEnd(){this.disposeWithMe(a.toDisposable(this._sheetInterceptorService.writeCellInterceptor.intercept(U.AFTER_CELL_EDIT,{handler:(t,e,i)=>{var l,v,c;t||i(t);const r=this._conditionalFormattingService.composeStyle(e.unitId,e.subUnitId,e.row,e.col),s=(l=r==null?void 0:r.style)!=null?l:{},o=Object.keys(s);if(t!=null&&t.p)return(c=(v=t.p.body)==null?void 0:v.textRuns)==null||c.forEach(h=>{h.ts&&o.forEach(d=>{var m;(m=h.ts)==null||delete m[d]})}),i(t);{const h={...(typeof(t==null?void 0:t.s)=="string"?e.workbook.getStyles().get(t.s):t==null?void 0:t.s)||{}};o.forEach(m=>{delete h[m]});const d={...t,s:{...h}};return i(d)}}})))}};ke=Mn([dt(0,a.Inject(U.SheetInterceptorService)),dt(1,a.Inject(n.ConditionalFormattingService))],ke);const vt=[U.SetWorksheetActiveOperation.id,n.AddConditionalRuleMutation.id,n.SetConditionalRuleMutation.id,n.DeleteConditionalRuleMutation.id,n.MoveConditionalRuleMutation.id],pe=[{label:{name:"sheet.cf.ruleType.highlightCell",selectable:!1},value:z.highlightCell},{label:{name:"sheet.cf.panel.rankAndAverage",selectable:!1},value:z.rank},{label:{name:"sheet.cf.ruleType.formula",selectable:!1},value:z.formula},{label:{name:"sheet.cf.ruleType.colorScale",selectable:!1},value:z.colorScale},{label:{name:"sheet.cf.ruleType.dataBar",selectable:!1},value:z.dataBar},{label:{name:"sheet.cf.ruleType.iconSet",selectable:!1},value:z.icon},{label:{name:"sheet.cf.menu.manageConditionalFormatting",selectable:!1},value:z.viewRule},{label:{name:"sheet.cf.menu.createConditionalFormatting",selectable:!1},value:z.createRule},{label:{name:"sheet.cf.menu.clearRangeRules",selectable:!1},value:z.clearRangeRules,disabled:!1},{label:{name:"sheet.cf.menu.clearWorkSheetRules",selectable:!1},value:z.clearWorkSheetRules}],Vn=t=>{const e=t.get(U.SheetsSelectionsService),i=t.get(a.ICommandService),r=t.get(a.IUniverInstanceService),s=t.get(n.ConditionalFormattingRuleModel),o=new X.Observable(c=>X.merge(e.selectionMoveEnd$,e.selectionSet$,new X.Observable(h=>{const d=i.onCommandExecuted(m=>{var y;const{id:g,params:b}=m,S=(y=r.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:y.getUnitId();vt.includes(g)&&b.unitId===S&&h.next(null)});return()=>d.dispose()})).pipe(fe.debounceTime(16)).subscribe(()=>{var y;const h=((y=e.getCurrentSelections())==null?void 0:y.map(_=>_.range))||[],d=r.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!d)return;const m=d.getActiveSheet();if(!m)return;const S=(s.getSubunitRules(d.getUnitId(),m.getSheetId())||[]).filter(_=>_.ranges.some(T=>h.some(w=>a.Rectangle.intersects(w,T)))).map(_=>_.ranges).every(_=>U.checkRangesEditablePermission(t,d.getUnitId(),m.getSheetId(),_));c.next(S)})),l=new X.Observable(c=>new X.Observable(h=>{const d=i.onCommandExecuted(m=>{var y;const{id:g,params:b}=m,S=(y=r.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:y.getUnitId();vt.includes(g)&&b.unitId===S&&h.next(null)});return()=>d.dispose()}).pipe(fe.debounceTime(16)).subscribe(()=>{const h=r.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!h)return;const d=h.getActiveSheet();if(!d)return;const m=s.getSubunitRules(h.getUnitId(),d.getSheetId())||[];if(!m.length)return c.next(!1),!1;const g=m.map(b=>b.ranges).every(b=>U.checkRangesEditablePermission(t,h.getUnitId(),d.getSheetId(),b));c.next(g)})),v=new X.Observable(c=>{o.subscribe(h=>{const d=pe.find(m=>m.value===z.clearRangeRules);d&&(d.disabled=!h,c.next(pe))}),l.subscribe(h=>{const d=pe.find(m=>m.value===z.clearWorkSheetRules);d&&(d.disabled=!h,c.next(pe))}),c.next(pe)});return{id:Fe.id,type:P.MenuItemType.SELECTOR,icon:"ConditionsDoubleIcon",tooltip:"sheet.cf.title",selections:v,hidden$:P.getMenuHiddenObservable(t,a.UniverInstanceType.UNIVER_SHEET),disabled$:B.getCurrentRangeDisable$(t,{workbookTypes:[U.WorkbookEditablePermission],worksheetTypes:[U.WorksheetSetCellStylePermission,U.WorksheetEditPermission],rangeTypes:[U.RangeProtectionPermissionEditPoint]})}},On={[P.RibbonDataGroup.RULES]:{[Fe.id]:{order:1,menuItemFactory:Vn}}};var Un=Object.getOwnPropertyDescriptor,kn=(t,e,i,r)=>{for(var s=r>1?void 0:r?Un(e,i):e,o=t.length-1,l;o>=0;o--)(l=t[o])&&(s=l(s)||s);return s},mt=(t,e)=>(i,r)=>e(i,r,t);let Pe=class extends a.Disposable{constructor(e,i){super();ee(this,"_sidebarDisposable",null);this._injector=e,this._menuManagerService=i,this._menuManagerService.mergeMenu(On)}};Pe=kn([mt(0,a.Inject(a.Injector)),mt(1,P.IMenuManagerService)],Pe);var Pn=Object.getOwnPropertyDescriptor,Dn=(t,e,i,r)=>{for(var s=r>1?void 0:r?Pn(e,i):e,o=t.length-1,l;o>=0;o--)(l=t[o])&&(s=l(s)||s);return s},ue=(t,e)=>(i,r)=>e(i,r,t);const Ln=(t,e)=>{const i=d=>d.endRow-d.startRow+1,r=d=>d.endColumn-d.startColumn+1,s=i(e)%i(t),o=r(e)%r(t),l=Math.floor(i(e)/i(t)),v=Math.floor(r(e)/r(t)),c=[],h={startRow:0,endRow:i(t)-1,startColumn:0,endColumn:r(t)-1};if(i(e)===1&&r(e)===1){const d={startRow:e.startRow,endRow:e.startRow,startColumn:e.startColumn,endColumn:e.startColumn};return c.push({repeatRelativeRange:h,startRange:d}),c}for(let d=0;d<l+(s?.1:0);d++)for(let m=0;m<v+(o?.1:0);m++){const g=i(t)*d,b=r(t)*m,S={startRow:g+e.startRow,endRow:g+e.startRow,startColumn:b+e.startColumn,endColumn:b+e.startColumn};let y=h;d===l&&s&&(y={...y},y.endRow=y.endRow-(i(t)-s)),m===v&&o&&(y={...y},y.endColumn=y.endColumn-(r(t)-o)),c.push({repeatRelativeRange:y,startRange:S})}return c};let De=class extends a.Disposable{constructor(e,i,r,s,o,l){super();ee(this,"_painterConfig",null);this._injector=e,this._univerInstanceService=i,this._formatPainterService=r,this._sheetsSelectionsService=s,this._conditionalFormattingRuleModel=o,this._conditionalFormattingViewModel=l,this._initFormattingPainter()}_initFormattingPainter(){const e=()=>({redos:[],undos:[]}),i=(o,l,v,c,h)=>{const{unitId:d,subUnitId:m}=this._painterConfig,{targetUnitId:g,targetSubUnitId:b}=h,S={startRow:o.row,startColumn:o.col,endColumn:o.col,endRow:o.row},y={startRow:l.row,startColumn:l.col,endColumn:l.col,endRow:l.row};a.Range.foreach(v,(_,T)=>{const w=a.Rectangle.getPositionRange({startRow:_,startColumn:T,endColumn:T,endRow:_},S),E=a.Rectangle.getPositionRange({startRow:_,startColumn:T,endColumn:T,endRow:_},y),N=this._conditionalFormattingViewModel.getCellCfs(d,m,w.startRow,w.startColumn),p=this._conditionalFormattingViewModel.getCellCfs(g,b,E.startRow,E.startColumn);p&&p.forEach(x=>{let R=c.get(x.cfId);if(!c.get(x.cfId)){const I=this._conditionalFormattingRuleModel.getRule(g,b,x.cfId);if(!I)return;R=new a.ObjectMatrix,I.ranges.forEach(V=>{a.Range.foreach(V,(j,O)=>{R.setValue(j,O,1)})}),c.set(x.cfId,R)}R.realDeleteValue(E.startRow,E.startColumn)}),N&&N.forEach(x=>{const R=c.get(x.cfId);R&&R.setValue(E.startRow,E.startColumn,1)})})},r=(o,l,v)=>{var w;const{range:c,unitId:h,subUnitId:d}=this._painterConfig,m=o!==h||d!==l,g=new Map,b=[],S=[];if(!o||!l||!h||!d)return e();const y=(w=this._conditionalFormattingRuleModel.getSubunitRules(h,d))!=null?w:[];y==null||y.forEach(E=>{const{ranges:N,cfId:p}=E;if(N.some(x=>a.Rectangle.intersects(c,x))){const x=new a.ObjectMatrix;m||N.forEach(R=>{a.Range.foreach(R,(I,V)=>{x.setValue(I,V,1)})}),g.set(p,x)}});const _={row:c.startRow,col:c.startColumn};return Ln(c,v).forEach(E=>{i(_,{row:E.startRange.startRow,col:E.startRange.startColumn},E.repeatRelativeRange,g,{targetUnitId:o,targetSubUnitId:l})}),g.forEach((E,N)=>{if(m){const p=this._conditionalFormattingRuleModel.getRule(o,l,N),x=U.findAllRectangle(U.createTopMatrixFromMatrix(E));if(p)if(x.length){const R={unitId:o,subUnitId:l,rule:{...p,ranges:x}};b.push({id:n.SetConditionalRuleMutation.id,params:R}),S.push(...n.setConditionalRuleMutationUndoFactory(this._injector,R))}else{const R={unitId:o,subUnitId:l,cfId:p.cfId};b.push({id:n.DeleteConditionalRuleMutation.id,params:R}),S.push(...n.DeleteConditionalRuleMutationUndoFactory(this._injector,R))}else if(x.length){const R=this._conditionalFormattingRuleModel.getRule(h,d,N);if(R){const I={unitId:o,subUnitId:l,rule:{...a.Tools.deepClone(R),cfId:this._conditionalFormattingRuleModel.createCfId(o,l),ranges:x}};b.push({id:n.AddConditionalRuleMutation.id,params:I}),S.push(n.AddConditionalRuleMutationUndoFactory(this._injector,I))}}}else{const p=this._conditionalFormattingRuleModel.getRule(h,d,N);if(!p)return;const x=U.findAllRectangle(U.createTopMatrixFromMatrix(E));if(x.length){const R={unitId:h,subUnitId:d,rule:{...p,ranges:x}};b.push({id:n.SetConditionalRuleMutation.id,params:R}),S.push(...n.setConditionalRuleMutationUndoFactory(this._injector,R))}else{const R={unitId:h,subUnitId:d,cfId:p.cfId};b.push({id:n.DeleteConditionalRuleMutation.id,params:R}),S.push(...n.DeleteConditionalRuleMutationUndoFactory(this._injector,R))}}}),{undos:S,redos:b}},s={id:n.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onStatusChange:o=>{var l,v,c;switch(o){case B.FormatPainterStatus.INFINITE:case B.FormatPainterStatus.ONCE:{const h=(l=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:l.getUnitId(),d=(c=(v=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:v.getActiveSheet())==null?void 0:c.getSheetId(),m=this._sheetsSelectionsService.getCurrentLastSelection(),g=m==null?void 0:m.range;h&&d&&g&&(this._painterConfig={unitId:h,subUnitId:d,range:g});break}case B.FormatPainterStatus.OFF:{this._painterConfig=null;break}}},onApply:(o,l,v)=>this._painterConfig?r(o,l,v):{redos:[],undos:[]}};this._formatPainterService.addHook(s)}};De=Dn([ue(0,a.Inject(a.Injector)),ue(1,a.Inject(a.IUniverInstanceService)),ue(2,a.Inject(B.IFormatPainterService)),ue(3,a.Inject(U.SheetsSelectionsService)),ue(4,a.Inject(n.ConditionalFormattingRuleModel)),ue(5,a.Inject(n.ConditionalFormattingViewModel))],De);var An=Object.getOwnPropertyDescriptor,$n=(t,e,i,r)=>{for(var s=r>1?void 0:r?An(e,i):e,o=t.length-1,l;o>=0;o--)(l=t[o])&&(s=l(s)||s);return s},Be=(t,e)=>(i,r)=>e(i,r,t);let Le=class extends a.Disposable{constructor(t,e,i){super(),this._conditionalFormattingViewModel=t,this._univerInstanceService=e,this._renderManagerService=i,this._init()}_init(){const t=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET),e=i=>{const r=i.getUnitId(),s=this._renderManagerService.getRenderById(r);if(!s)return;const o=s.with(B.SheetSkeletonManagerService);this.disposeWithMe(o.currentSkeleton$.subscribe(l=>{if(l){const v=l.skeleton.rowColumnSegment,c=v.endColumn-v.startColumn+1,d=(v.endRow-v.startRow+1)*c*9,m=Math.max(n.CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH,d);this._conditionalFormattingViewModel.setCacheLength(m)}}))};t&&e(t),this._univerInstanceService.getCurrentTypeOfUnit$(a.UniverInstanceType.UNIVER_SHEET).subscribe(i=>{i&&e(i)})}};Le=$n([Be(0,a.Inject(n.ConditionalFormattingViewModel)),Be(1,a.IUniverInstanceService),Be(2,ht.IRenderManagerService)],Le);var Hn=Object.defineProperty,Bn=Object.getOwnPropertyDescriptor,Wn=(t,e,i)=>e in t?Hn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,qn=(t,e,i,r)=>{for(var s=r>1?void 0:r?Bn(e,i):e,o=t.length-1,l;o>=0;o--)(l=t[o])&&(s=l(s)||s);return s},We=(t,e)=>(i,r)=>e(i,r,t),_t=(t,e,i)=>Wn(t,typeof e!="symbol"?e+"":e,i);exports.UniverSheetsConditionalFormattingUIPlugin=class extends a.Plugin{constructor(e=Oe,i,r,s){super(),this._config=e,this._injector=i,this._commandService=r,this._configService=s;const{menu:o,...l}=a.merge({},Oe,this._config);o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(Rt,l),this._initCommand()}onStarting(){a.registerDependencies(this._injector,[[Se],[Ie],[ye],[Ue],[be],[Ce],[Pe],[ce],[ke],[exports.ConditionalFormattingClearController],[De],[Le]]),a.touchDependencies(this._injector,[[Se]])}onReady(){a.touchDependencies(this._injector,[[Pe],[Ce]])}onRendered(){a.touchDependencies(this._injector,[[Ue],[exports.ConditionalFormattingClearController],[ye],[ke],[ce],[De],[be],[Ie],[Le]])}_initCommand(){[Ge,Ze,ze,Ye,Ke,Xe,Je,Qe,et,Fe].forEach(e=>{this._commandService.registerCommand(e)})}};_t(exports.UniverSheetsConditionalFormattingUIPlugin,"pluginName",`${n.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_UI_PLUGIN`);_t(exports.UniverSheetsConditionalFormattingUIPlugin,"type",a.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsConditionalFormattingUIPlugin=qn([a.DependentOn(n.UniverSheetsConditionalFormattingPlugin),We(1,a.Inject(a.Injector)),We(2,a.Inject(a.ICommandService)),We(3,a.IConfigService)],exports.UniverSheetsConditionalFormattingUIPlugin);exports.AddAverageCfCommand=Ge;exports.AddColorScaleConditionalRuleCommand=Ze;exports.AddDataBarConditionalRuleCommand=ze;exports.AddDuplicateValuesCfCommand=Ye;exports.AddNumberCfCommand=Ke;exports.AddRankCfCommand=Xe;exports.AddTextCfCommand=Je;exports.AddTimePeriodCfCommand=Qe;exports.AddUniqueValuesCfCommand=et;exports.OpenConditionalFormattingOperator=Fe;
|
|
1
|
+
"use strict";var Et=Object.defineProperty;var jt=(t,e,i)=>e in t?Et(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i;var ee=(t,e,i)=>jt(t,typeof e!="symbol"?e+"":e,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@univerjs/core"),U=require("@univerjs/sheets"),n=require("@univerjs/sheets-conditional-formatting"),P=require("@univerjs/ui"),u=require("react/jsx-runtime"),C=require("react"),M=require("@univerjs/design"),qe=require("@univerjs/engine-formula"),xe=require("@univerjs/sheets-formula-ui"),B=require("@univerjs/sheets-ui"),X=require("rxjs"),ht=require("@univerjs/engine-render"),fe=require("rxjs/operators"),Ge={type:a.CommandType.COMMAND,id:"sheet.command.add-average-conditional-rule",handler(t,e){if(!e)return!1;const{ranges:i,style:r,stopIfTrue:s,operator:o}=e,l=t.get(n.ConditionalFormattingRuleModel),v=t.get(a.ICommandService),c=t.get(a.IUniverInstanceService),h=U.getSheetCommandTarget(c);if(!h)return!1;const{unitId:d,subUnitId:m}=h,g=l.createCfId(d,m),b={ranges:i,cfId:g,stopIfTrue:!!s,rule:{type:n.CFRuleType.highlightCell,subType:n.CFSubRuleType.average,operator:o,style:r}};return v.executeCommand(n.AddConditionalRuleMutation.id,{unitId:d,subUnitId:m,rule:b})}},Ze={type:a.CommandType.COMMAND,id:"sheet.command.add-color-scale-conditional-rule",handler(t,e){if(!e)return!1;const{ranges:i,config:r,stopIfTrue:s}=e,o=t.get(n.ConditionalFormattingRuleModel),l=t.get(a.ICommandService),v=t.get(a.IUniverInstanceService),c=U.getSheetCommandTarget(v);if(!c)return!1;const{unitId:h,subUnitId:d}=c,m=o.createCfId(h,d),g={ranges:i,cfId:m,stopIfTrue:!!s,rule:{type:n.CFRuleType.colorScale,config:r}};return l.executeCommand(n.AddConditionalRuleMutation.id,{unitId:h,subUnitId:d,rule:g})}},ze={type:a.CommandType.COMMAND,id:"sheet.command.add-data-bar-conditional-rule",handler(t,e){if(!e)return!1;const{ranges:i,min:r,max:s,nativeColor:o,positiveColor:l,isGradient:v,stopIfTrue:c,isShowValue:h}=e,d=t.get(n.ConditionalFormattingRuleModel),m=t.get(a.IUniverInstanceService),g=U.getSheetCommandTarget(m);if(!g)return!1;const{unitId:b,subUnitId:S}=g,y=t.get(a.ICommandService),_=d.createCfId(b,S),T={ranges:i,cfId:_,stopIfTrue:!!c,rule:{type:n.CFRuleType.dataBar,isShowValue:h,config:{min:r,max:s,nativeColor:o,positiveColor:l,isGradient:v}}};return y.executeCommand(n.AddConditionalRuleMutation.id,{unitId:b,subUnitId:S,rule:T})}},Ye={type:a.CommandType.COMMAND,id:"sheet.command.add-duplicate-values-conditional-rule",handler(t,e){if(!e)return!1;const{ranges:i,style:r,stopIfTrue:s}=e,o=t.get(n.ConditionalFormattingRuleModel),l=t.get(a.ICommandService),v=t.get(a.IUniverInstanceService),c=U.getSheetCommandTarget(v);if(!c)return!1;const{unitId:h,subUnitId:d}=c,m=o.createCfId(h,d),g={ranges:i,cfId:m,stopIfTrue:!!s,rule:{type:n.CFRuleType.highlightCell,subType:n.CFSubRuleType.duplicateValues,style:r}};return l.executeCommand(n.AddConditionalRuleMutation.id,{unitId:h,subUnitId:d,rule:g})}},Ke={type:a.CommandType.COMMAND,id:"sheet.command.add-number-conditional-rule",handler(t,e){if(!e)return!1;const{ranges:i,style:r,stopIfTrue:s,operator:o,value:l}=e,v=t.get(n.ConditionalFormattingRuleModel),c=t.get(a.ICommandService),h=t.get(a.IUniverInstanceService),d=U.getSheetCommandTarget(h);if(!d)return!1;const{unitId:m,subUnitId:g}=d,b=v.createCfId(m,g);let S;if([n.CFNumberOperator.between,n.CFNumberOperator.notBetween].includes(o)){const y=l;if(y.length!==2||!Array.isArray(y))return!1;S={ranges:i,cfId:b,stopIfTrue:!!s,rule:{type:n.CFRuleType.highlightCell,subType:n.CFSubRuleType.number,operator:o,style:r,value:y}}}else{const y=l;if(typeof y!="number")return!1;S={ranges:i,cfId:b,stopIfTrue:!!s,rule:{type:n.CFRuleType.highlightCell,subType:n.CFSubRuleType.number,operator:o,style:r,value:y}}}return c.executeCommand(n.AddConditionalRuleMutation.id,{unitId:m,subUnitId:g,rule:S})}},Xe={type:a.CommandType.COMMAND,id:"sheet.command.add-rank-conditional-rule",handler(t,e){if(!e)return!1;const{ranges:i,style:r,stopIfTrue:s,isPercent:o,isBottom:l,value:v}=e,c=t.get(n.ConditionalFormattingRuleModel),h=t.get(a.IUniverInstanceService),d=t.get(a.ICommandService),m=U.getSheetCommandTarget(h);if(!m)return!1;const{unitId:g,subUnitId:b}=m,S=c.createCfId(g,b),y={ranges:i,cfId:S,stopIfTrue:!!s,rule:{type:n.CFRuleType.highlightCell,subType:n.CFSubRuleType.rank,isPercent:o,isBottom:l,style:r,value:v}};return d.executeCommand(n.AddConditionalRuleMutation.id,{unitId:g,subUnitId:b,rule:y})}},Je={type:a.CommandType.COMMAND,id:"sheet.command.add-text-conditional-rule",handler(t,e){if(!e)return!1;const{ranges:i,style:r,stopIfTrue:s,operator:o,value:l}=e,v=t.get(n.ConditionalFormattingRuleModel),c=t.get(a.IUniverInstanceService),h=U.getSheetCommandTarget(c);if(!h)return!1;const{unitId:d,subUnitId:m}=h,g=t.get(a.ICommandService),b=v.createCfId(d,m),S={ranges:i,cfId:b,stopIfTrue:!!s,rule:{type:n.CFRuleType.highlightCell,subType:n.CFSubRuleType.text,operator:o,style:r,value:l}};return g.executeCommand(n.AddConditionalRuleMutation.id,{unitId:d,subUnitId:m,rule:S})}},Qe={type:a.CommandType.COMMAND,id:"sheet.command.add-time-period-conditional-rule",handler(t,e){if(!e)return!1;const{ranges:i,style:r,stopIfTrue:s,operator:o}=e,l=t.get(n.ConditionalFormattingRuleModel),v=t.get(a.IUniverInstanceService),c=t.get(a.ICommandService),h=U.getSheetCommandTarget(v);if(!h)return!1;const{unitId:d,subUnitId:m}=h,g=l.createCfId(d,m),b={ranges:i,cfId:g,stopIfTrue:!!s,rule:{type:n.CFRuleType.highlightCell,subType:n.CFSubRuleType.timePeriod,operator:o,style:r}};return c.executeCommand(n.AddConditionalRuleMutation.id,{unitId:d,subUnitId:m,rule:b})}},et={type:a.CommandType.COMMAND,id:"sheet.command.add-uniqueValues-conditional-rule",handler(t,e){if(!e)return!1;const{ranges:i,style:r,stopIfTrue:s}=e,o=t.get(n.ConditionalFormattingRuleModel),l=t.get(a.IUniverInstanceService),v=t.get(a.ICommandService),c=U.getSheetCommandTarget(l);if(!c)return!1;const{unitId:h,subUnitId:d}=c,m=o.createCfId(h,d),g={ranges:i,cfId:m,stopIfTrue:!!s,rule:{type:n.CFRuleType.highlightCell,subType:n.CFSubRuleType.uniqueValues,style:r}};return v.executeCommand(n.AddConditionalRuleMutation.id,{unitId:h,subUnitId:d,rule:g})}};var Y=function(){return Y=Object.assign||function(t){for(var e,i=1,r=arguments.length;i<r;i++){e=arguments[i];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s])}return t},Y.apply(this,arguments)},Mt=function(t,e){var i={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(i[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(i[r[s]]=t[r[s]]);return i},K=C.forwardRef(function(t,e){var i=t.icon,r=t.id,s=t.className,o=t.extend,l=Mt(t,["icon","id","className","extend"]),v="univerjs-icon univerjs-icon-".concat(r," ").concat(s||"").trim(),c=C.useRef("_".concat(Ut()));return gt(i,"".concat(r),{defIds:i.defIds,idSuffix:c.current},Y({ref:e,className:v},l),o)});function gt(t,e,i,r,s){return C.createElement(t.tag,Y(Y({key:e},Vt(t,i,s)),r),(Ot(t,i).children||[]).map(function(o,l){return gt(o,"".concat(e,"-").concat(t.tag,"-").concat(l),i,void 0,s)}))}function Vt(t,e,i){var r=Y({},t.attrs);i!=null&&i.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=i.colorChannel1),t.tag==="mask"&&r.id&&(r.id=r.id+e.idSuffix),Object.entries(r).forEach(function(o){var l=o[0],v=o[1];l==="mask"&&typeof v=="string"&&(r[l]=v.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))});var s=e.defIds;return!s||s.length===0||(t.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+e.idSuffix),Object.entries(r).forEach(function(o){var l=o[0],v=o[1];typeof v=="string"&&(r[l]=v.replace(/url\(#(.*)\)/,"url(#$1".concat(e.idSuffix,")")))})),r}function Ot(t,e){var i,r=e.defIds;return!r||r.length===0?t:t.tag==="defs"&&(!((i=t.children)===null||i===void 0)&&i.length)?Y(Y({},t),{children:t.children.map(function(s){return typeof s.attrs.id=="string"&&r&&r.includes(s.attrs.id)?Y(Y({},s),{attrs:Y(Y({},s.attrs),{id:s.attrs.id+e.idSuffix})}):s})}):t}function Ut(){return Math.random().toString(36).substring(2,8)}K.displayName="UniverIcon";var kt={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M4.65791 1.30005C3.77355 1.30005 3.05664 2.01696 3.05664 2.90132V12.8588C3.05664 13.8755 3.88086 14.6998 4.89759 14.6998H9.1016C11.2233 14.6998 12.9433 12.9798 12.9433 10.8581C12.9433 9.13925 11.8145 7.68407 10.2578 7.1934C10.8806 6.56856 11.2655 5.70659 11.2655 4.75472C11.2655 2.84676 9.71883 1.30005 7.81087 1.30005H4.65791ZM4.25664 2.90132C4.25664 2.6797 4.4363 2.50005 4.65791 2.50005H7.81087C9.05609 2.50005 10.0655 3.5095 10.0655 4.75472C10.0655 5.99993 9.05609 7.00938 7.81087 7.00938H4.25664V2.90132ZM4.25664 12.8588V8.21636H9.1016C10.5606 8.21636 11.7433 9.39909 11.7433 10.8581C11.7433 12.317 10.5606 13.4998 9.1016 13.4998H4.89759C4.5436 13.4998 4.25664 13.2128 4.25664 12.8588Z",fillRule:"evenodd",clipRule:"evenodd"}}]},pt=C.forwardRef(function(t,e){return C.createElement(K,Object.assign({},t,{id:"bold-icon",ref:e,icon:kt}))});pt.displayName="BoldIcon";var Pt={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.3313 1.4667C5.3313 1.13533 5.59993 0.866699 5.9313 0.866699H10.069C10.4004 0.866699 10.669 1.13533 10.669 1.4667C10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443C14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928L9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171C10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778L9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539C9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263L6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539C5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778L6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Ve=C.forwardRef(function(t,e){return C.createElement(K,Object.assign({},t,{id:"delete-icon",ref:e,icon:Pt}))});Ve.displayName="DeleteIcon";var Dt={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"colorChannel1",d:"M1.98682 13.4992C1.98682 12.5603 2.74793 11.7992 3.68682 11.7992H14.2868C15.2257 11.7992 15.9868 12.5603 15.9868 13.4992V13.4992C15.9868 14.4381 15.2257 15.1992 14.2868 15.1992H3.68682C2.74793 15.1992 1.98682 14.4381 1.98682 13.4992V13.4992Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M10.3014 1.70389C9.85268 0.479568 8.12109 0.479557 7.67238 1.70389L4.72235 9.75326C4.60832 10.0644 4.76811 10.4091 5.07924 10.5231C5.39038 10.6371 5.73504 10.4773 5.84907 10.1662L6.99975 7.02646C7.03588 7.03324 7.07314 7.03679 7.11123 7.03679H10.9778L12.1247 10.1662C12.2387 10.4773 12.5834 10.6371 12.8945 10.5231C13.2057 10.4091 13.3654 10.0644 13.2514 9.75326L10.3014 1.70389ZM10.538 5.83679L9.17467 2.11682C9.11057 1.94192 8.8632 1.94192 8.7991 2.11682L7.43576 5.83679H10.538Z",fillRule:"evenodd",clipRule:"evenodd"}}]},ft=C.forwardRef(function(t,e){return C.createElement(K,Object.assign({},t,{id:"font-color-double-icon",ref:e,icon:Dt}))});ft.displayName="FontColorDoubleIcon";var Lt={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z"}}]},Ct=C.forwardRef(function(t,e){return C.createElement(K,Object.assign({},t,{id:"increase-icon",ref:e,icon:Lt}))});Ct.displayName="IncreaseIcon";var At={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M9.80385 1.40005H11.9997C12.3311 1.40005 12.5997 1.66868 12.5997 2.00005C12.5997 2.33143 12.3311 2.60005 11.9997 2.60005H10.1185L7.12251 13.4001H9.33324C9.66461 13.4001 9.93324 13.6687 9.93324 14.0001C9.93324 14.3314 9.66461 14.6001 9.33324 14.6001H6.34785C6.33847 14.6003 6.32905 14.6003 6.31962 14.6001H3.9999C3.66853 14.6001 3.3999 14.3314 3.3999 14.0001C3.3999 13.6687 3.66853 13.4001 3.9999 13.4001H5.87719L8.87322 2.60005H6.66641C6.33504 2.60005 6.06641 2.33143 6.06641 2.00005C6.06641 1.66868 6.33504 1.40005 6.66641 1.40005H9.52916C9.61698 1.37929 9.71064 1.3781 9.80385 1.40005Z"}}]},yt=C.forwardRef(function(t,e){return C.createElement(K,Object.assign({},t,{id:"italic-icon",ref:e,icon:At}))});yt.displayName="ItalicIcon";var $t={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M11.3536 6.14645C11.5488 6.34171 11.5488 6.65829 11.3536 6.85355L8.35355 9.85355C8.15829 10.0488 7.84171 10.0488 7.64645 9.85355L4.64645 6.85355C4.45118 6.65829 4.45118 6.34171 4.64645 6.14645C4.84171 5.95118 5.15829 5.95118 5.35355 6.14645L8 8.79289L10.6464 6.14645C10.8417 5.95118 11.1583 5.95118 11.3536 6.14645Z",fillRule:"evenodd",clipRule:"evenodd"}}]},tt=C.forwardRef(function(t,e){return C.createElement(K,Object.assign({},t,{id:"more-down-icon",ref:e,icon:$t}))});tt.displayName="MoreDownIcon";var Ht={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.01281 1.36643C8.79386 0.585377 10.0602 0.585378 10.8412 1.36643L12.9223 3.44752C13.7034 4.22857 13.7034 5.4949 12.9223 6.27595L9.36445 9.83383C8.5834 10.6149 7.31707 10.6149 6.53602 9.83383L4.45493 7.75273C3.67388 6.97168 3.67388 5.70535 4.45493 4.9243L8.01281 1.36643ZM9.9927 2.21495C9.68028 1.90253 9.17375 1.90253 8.86133 2.21495L5.30346 5.77283L5.29671 5.77966L10.839 6.66224L12.0738 5.42742C12.3862 5.115 12.3862 4.60847 12.0738 4.29605L9.9927 2.21495Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M14.5179 9.48875C14.5179 9.99175 14.1101 10.3995 13.607 10.3995C13.1041 10.3995 12.6963 9.99175 12.6963 9.48875C12.6963 9.1773 13.0455 8.59966 13.3114 8.20487C13.4549 7.99177 13.7591 7.99177 13.9027 8.20486C14.1687 8.59965 14.5179 9.1773 14.5179 9.48875Z"}},{tag:"path",attrs:{fill:"colorChannel1",d:"M1.98682 13.4992C1.98682 12.5603 2.74793 11.7992 3.68682 11.7992H14.2868C15.2257 11.7992 15.9868 12.5603 15.9868 13.4992V13.4992C15.9868 14.4381 15.2257 15.1992 14.2868 15.1992H3.68682C2.74793 15.1992 1.98682 14.4381 1.98682 13.4992V13.4992Z"}}]},bt=C.forwardRef(function(t,e){return C.createElement(K,Object.assign({},t,{id:"paint-bucket-double-icon",ref:e,icon:Ht}))});bt.displayName="PaintBucketDoubleIcon";var Bt={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"mask",attrs:{id:"mask0_622_8",width:16,height:16,x:0,y:0,maskUnits:"userSpaceOnUse"},children:[{tag:"path",attrs:{fill:"#D9D9D9",d:"M0 0H16V16H0z"}}]},{tag:"g",attrs:{fill:"currentColor",mask:"url(#mask0_622_8)"},children:[{tag:"path",attrs:{d:"M6 5C6.55228 5 7 4.55228 7 4C7 3.44772 6.55228 3 6 3C5.44772 3 5 3.44772 5 4C5 4.55228 5.44772 5 6 5Z"}},{tag:"path",attrs:{d:"M6 9C6.55228 9 7 8.55229 7 8C7 7.44772 6.55228 7 6 7C5.44772 7 5 7.44772 5 8C5 8.55229 5.44772 9 6 9Z"}},{tag:"path",attrs:{d:"M7 12C7 12.5523 6.55228 13 6 13C5.44772 13 5 12.5523 5 12C5 11.4477 5.44772 11 6 11C6.55228 11 7 11.4477 7 12Z"}},{tag:"path",attrs:{d:"M10 5C10.5523 5 11 4.55228 11 4C11 3.44772 10.5523 3 10 3C9.44771 3 9 3.44772 9 4C9 4.55228 9.44771 5 10 5Z"}},{tag:"path",attrs:{d:"M11 8C11 8.55229 10.5523 9 10 9C9.44771 9 9 8.55229 9 8C9 7.44772 9.44771 7 10 7C10.5523 7 11 7.44772 11 8Z"}},{tag:"path",attrs:{d:"M10 13C10.5523 13 11 12.5523 11 12C11 11.4477 10.5523 11 10 11C9.44771 11 9 11.4477 9 12C9 12.5523 9.44771 13 10 13Z"}}]}]},It=C.forwardRef(function(t,e){return C.createElement(K,Object.assign({},t,{id:"sequence-icon",ref:e,icon:Bt}))});It.displayName="SequenceIcon";var Wt={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"mask",attrs:{id:"mask0_436_41",width:17,height:17,x:0,y:0,maskUnits:"userSpaceOnUse"},children:[{tag:"path",attrs:{fill:"#D9D9D9",d:"M.35.48H16.35V16.48H.35z"}}]},{tag:"g",attrs:{mask:"url(#mask0_436_41)",fillRule:"evenodd",clipRule:"evenodd"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M2.27177 13.714L13.5855 2.40025L14.434 3.24878L3.1203 14.5625L2.27177 13.714Z"}},{tag:"path",attrs:{fill:"#E5E5E5",d:"M4.2603 1.82495L2.89617 1.82495C2.23343 1.82495 1.69617 2.36221 1.69617 3.02495L1.69617 4.38908L3.02617 4.38908L3.02617 3.15495L4.2603 3.15495L4.2603 1.82495ZM15.0092 4.38908L15.0092 3.02495C15.0092 2.36221 14.4719 1.82495 13.8092 1.82495L12.4451 1.82495L12.4451 3.15495L13.6792 3.15495L13.6792 4.38908L15.0092 4.38908ZM6.98856 1.82495L6.98856 3.15495L9.71681 3.15495L9.71681 1.82495L6.98856 1.82495ZM15.0092 7.11734L13.6792 7.11734L13.6792 9.84559L15.0092 9.84559L15.0092 7.11734ZM15.0092 12.5739L13.6792 12.5739L13.6792 13.808L12.4451 13.808L12.4451 15.138L13.8092 15.138C14.4719 15.138 15.0092 14.6007 15.0092 13.938L15.0092 12.5739ZM9.71681 15.138L9.71681 13.808L6.98856 13.808L6.98856 15.138L9.71681 15.138ZM4.2603 15.138L4.2603 13.808L3.02617 13.808L3.02617 12.5739L1.69617 12.5739L1.69617 13.938C1.69617 14.6007 2.23343 15.138 2.89617 15.138L4.2603 15.138ZM1.69617 9.8456L3.02617 9.8456L3.02617 7.11734L1.69617 7.11734L1.69617 9.8456Z"}}]}]},Te=C.forwardRef(function(t,e){return C.createElement(K,Object.assign({},t,{id:"slash-icon",ref:e,icon:Wt}))});Te.displayName="SlashIcon";var qt={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.00033 1.20996C6.43345 1.20996 5.23596 1.88077 4.64804 2.94304C4.06338 3.99943 4.15123 5.32084 4.90099 6.47062C5.08199 6.7482 5.45374 6.82648 5.73131 6.64548C6.00888 6.46448 6.08716 6.09273 5.90616 5.81516C5.36418 4.98402 5.35768 4.13897 5.69797 3.52412C6.035 2.91515 6.78176 2.40996 8.00033 2.40996C9.19423 2.40996 10.0017 2.93409 10.5236 3.46755C10.7871 3.73682 10.9756 4.00712 11.0974 4.20903C11.158 4.30951 11.2013 4.39164 11.2284 4.44625C11.2419 4.47351 11.2514 4.49377 11.2568 4.50588L11.2621 4.51771C11.3901 4.82216 11.7407 4.96686 12.046 4.83992C12.3519 4.71267 12.4968 4.36149 12.3695 4.05552L11.8231 4.28278C12.3695 4.05552 12.3697 4.0558 12.3695 4.05552L12.3691 4.05437L12.3685 4.05298L12.367 4.04953L12.3629 4.03993L12.3498 4.01036C12.3388 3.98619 12.3234 3.95326 12.3033 3.91282C12.2632 3.83203 12.2043 3.72072 12.1249 3.58908C11.9666 3.32674 11.7235 2.97805 11.3814 2.62834C10.6921 1.92381 9.59192 1.20996 8.00033 1.20996Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M2.11953 8.5999H7.88935C10.1109 9.46549 10.5895 10.7649 10.4268 11.6869C10.2475 12.703 9.26939 13.5898 8.00009 13.5898C6.63323 13.5898 5.77631 13.0502 5.25534 12.528C4.99021 12.2623 4.80823 11.9965 4.69365 11.7993C4.63659 11.7011 4.59698 11.6211 4.5727 11.5686C4.56059 11.5424 4.55236 11.5231 4.54774 11.512L4.54352 11.5016C4.4267 11.193 4.0823 11.0363 3.77279 11.1516C3.46228 11.2673 3.30438 11.6129 3.4201 11.9234L3.9649 11.7203C3.4201 11.9234 3.41998 11.9231 3.4201 11.9234L3.4206 11.9247L3.42118 11.9263L3.42262 11.9301L3.42661 11.9403C3.42977 11.9484 3.43394 11.9588 3.43914 11.9713C3.44956 11.9965 3.46418 12.0304 3.48334 12.0719C3.52161 12.1547 3.57828 12.2682 3.65608 12.4021C3.81124 12.6692 4.0534 13.0223 4.40584 13.3756C5.12 14.0914 6.27196 14.7898 8.00009 14.7898C9.82574 14.7898 11.3236 13.5101 11.6085 11.8955C11.812 10.7422 11.3901 9.55402 10.2665 8.5999H13.8804C14.2117 8.5999 14.4803 8.33127 14.4803 7.9999C14.4803 7.66853 14.2117 7.3999 13.8804 7.3999H8.01411C8.0048 7.39968 7.99551 7.39969 7.98625 7.3999H2.11953C1.78816 7.3999 1.51953 7.66853 1.51953 7.9999C1.51953 8.33127 1.78816 8.5999 2.11953 8.5999Z"}}]},St=C.forwardRef(function(t,e){return C.createElement(K,Object.assign({},t,{id:"strikethrough-icon",ref:e,icon:qt}))});St.displayName="StrikethroughIcon";var Gt={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M4.46416 2.03237C4.46416 1.701 4.19553 1.43237 3.86416 1.43237C3.53279 1.43237 3.26416 1.701 3.26416 2.03237V7.33338C3.26416 10.0313 5.35834 12.2667 7.9999 12.2667C10.6415 12.2667 12.7356 10.0313 12.7356 7.33338V2.03237C12.7356 1.701 12.467 1.43237 12.1356 1.43237C11.8043 1.43237 11.5356 1.701 11.5356 2.03237V7.33338C11.5356 9.42194 9.92656 11.0667 7.9999 11.0667C6.07325 11.0667 4.46416 9.42194 4.46416 7.33338V2.03237Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M2.66641 13.4663C2.33504 13.4663 2.06641 13.7349 2.06641 14.0663C2.06641 14.3977 2.33504 14.6663 2.66641 14.6663H13.3331C13.6644 14.6663 13.9331 14.3977 13.9331 14.0663C13.9331 13.7349 13.6644 13.4663 13.3331 13.4663H2.66641Z"}}]},xt=C.forwardRef(function(t,e){return C.createElement(K,Object.assign({},t,{id:"underline-icon",ref:e,icon:Gt}))});xt.displayName="UnderlineIcon";const ie=t=>{const{color:e,onChange:i,disable:r=!1,Icon:s=bt,className:o}=t,l=C.useMemo(()=>new a.ColorKit(e),[e]),v=()=>{const c={className:M.clsx("univer-fill-primary-600",r&&o),extend:{colorChannel1:l.isValid?e:""}};return u.jsx(s,{...c})};return r?v():u.jsx(M.Dropdown,{overlay:u.jsx("div",{className:"univer-rounded-lg univer-p-4",children:u.jsx(M.ColorPicker,{value:e,onChange:i})}),children:u.jsx("span",{className:M.clsx("univer-flex univer-cursor-pointer univer-items-center univer-rounded univer-p-1 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",o),children:v()})})},de=t=>{var o,l,v,c,h;const e=t.rule;if(!e)return null;const i=C.useMemo(()=>{if(e.type===n.CFRuleType.colorScale){const d=e.config.map((b,S)=>({color:new a.ColorKit(b.color),value:S})),m=d.length-1;return new Array(5).fill("").map((b,S,y)=>S*m/(y.length-1)).map(b=>n.getColorScaleFromValue(d,b))}return null},[e]),r=C.useMemo(()=>{if(e.type===n.CFRuleType.iconSet)return e.config.map(d=>{const m=n.iconMap[d.iconType];return m&&m[Number(d.iconId)]})},[e]),s="univer-pointer-events-none univer-flex univer-h-5 univer-min-w-[72px] univer-items-center univer-justify-center univer-text-xs";switch(e.type){case n.CFRuleType.dataBar:{const{isGradient:d}=e.config,m=d?`linear-gradient(to right, ${e.config.positiveColor||n.defaultDataBarPositiveColor}, rgb(255 255 255))`:e.config.positiveColor,g=d?`linear-gradient(to right, rgb(255 255 255),${e.config.nativeColor||n.defaultDataBarNativeColor})`:e.config.nativeColor;return u.jsxs("div",{className:s,children:[u.jsx("div",{className:"univer-h-full univer-w-1/2 univer-border univer-border-solid",style:{background:g,borderColor:(o=e.config.nativeColor)!=null?o:n.defaultDataBarNativeColor}}),u.jsx("div",{className:"univer-h-full univer-w-1/2 univer-border univer-border-solid",style:{background:m,borderColor:(l=e.config.positiveColor)!=null?l:n.defaultDataBarPositiveColor}})]})}case n.CFRuleType.colorScale:return i&&u.jsx("div",{className:s,children:i.map((d,m)=>u.jsx("div",{className:"univer-h-full",style:{width:`${100/i.length}%`,background:d}},m))});case n.CFRuleType.iconSet:return r&&u.jsx("div",{className:s,children:r.map((d,m)=>d?u.jsx("img",{className:"univer-h-full",src:d,draggable:!1},m):u.jsx(Te,{},m))});case n.CFRuleType.highlightCell:{const{ul:d,st:m,it:g,bl:b,bg:S,cl:y}=e.style,_=(d==null?void 0:d.s)===a.BooleanNumber.TRUE,T=(m==null?void 0:m.s)===a.BooleanNumber.TRUE,w=g===a.BooleanNumber.TRUE,E=b===a.BooleanNumber.TRUE,N=(v=S==null?void 0:S.rgb)!=null?v:n.DEFAULT_BG_COLOR,p=(c=y==null?void 0:y.rgb)!=null?c:n.DEFAULT_FONT_COLOR,x={textDecoration:(h=`${_?"underline":""} ${T?"line-through":""}`.replace(/^ /,""))!=null?h:void 0,backgroundColor:N,color:p};return u.jsx("div",{className:M.clsx(s,{"univer-font-bold":E,"univer-italic":w}),style:x,children:"123"})}}},Re=M.clsx("univer-mt-5 univer-px-1 univer-py-2 univer-rounded",M.borderClassName),re=(t,e)=>({label:e.t(`sheet.cf.valueType.${t}`),value:t}),Ae=t=>{var S;const{type:e,className:i,onChange:r,id:s,value:o}=t,l=P.useDependency(a.IUniverInstanceService),v=l.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET).getUnitId(),c=(S=l.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:S.getSheetId(),h=C.useMemo(()=>String(o).startsWith("=")?String(o):"=",[o]),d=C.useMemo(()=>[n.CFValueType.max,n.CFValueType.min,"none"].includes(e)?{disabled:!0}:[n.CFValueType.percent,n.CFValueType.percentile].includes(e)?{min:0,max:100}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[e]),m=C.useRef(null),[g,b]=C.useState(!1);return P.useSidebarClick(y=>{var T;((T=m.current)==null?void 0:T.isClickOutSide(y))&&b(!1)}),e===n.CFValueType.formula?u.jsx("div",{className:"univer-ml-1 univer-w-full",children:u.jsx(xe.FormulaEditor,{ref:m,className:M.clsx("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-white [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent",M.borderClassName),initValue:h,unitId:v,subUnitId:c,isFocus:g,onChange:(y="")=>{r(y||"")},onFocus:()=>b(!0)})}):u.jsx(M.InputNumber,{className:i,value:Number(t.value)||0,onChange:y=>t.onChange(y||0),...d})},Zt=t=>{var k;const{interceptorManager:e}=t,i=P.useDependency(a.LocaleService),r=((k=t.rule)==null?void 0:k.type)===n.CFRuleType.colorScale?t.rule:void 0,s=[re(n.CFValueType.num,i),re(n.CFValueType.percent,i),re(n.CFValueType.percentile,i),re(n.CFValueType.formula,i)],o=[re(n.CFValueType.min,i),...s],l=[re("none",i),...s],v=[re(n.CFValueType.max,i),...s],[c,h]=C.useState(()=>{var F;const f=n.CFValueType.min;return r&&((F=r.config[0])==null?void 0:F.value.type)||f}),[d,m]=C.useState(()=>{var F;const f="none";return!r||r.config.length!==3?f:((F=r.config[1])==null?void 0:F.value.type)||f}),[g,b]=C.useState(()=>{var F;const f=n.CFValueType.max;return r&&((F=r.config[r.config.length-1])==null?void 0:F.value.type)||f}),[S,y]=C.useState(()=>{if(!r)return 10;const F=r.config[0];return(F==null?void 0:F.value.value)===void 0?10:F==null?void 0:F.value.value}),[_,T]=C.useState(()=>{var L;if(!r||r.config.length!==3)return 50;const F=(L=r.config[1])==null?void 0:L.value.value;return F===void 0?50:F}),[w,E]=C.useState(()=>{var L;if(!r)return 90;const F=(L=r.config[r.config.length-1])==null?void 0:L.value.value;return F===void 0?90:F}),[N,p]=C.useState(()=>{var F;const f="#d0d9fb";return r&&((F=r.config[0])==null?void 0:F.color)||f}),[x,R]=C.useState(()=>{var F;const f="#7790f3";return!r||r.config.length!==3?f:((F=r.config[1])==null?void 0:F.color)||f}),[I,V]=C.useState(()=>{var F;const f="#2e55ef";return r&&((F=r.config[r.config.length-1])==null?void 0:F.color)||f}),j=C.useMemo(()=>f=>{const{minType:F,medianType:L,maxType:q,minValue:J,medianValue:Q,maxValue:se,minColor:oe,medianColor:D,maxColor:A}=f,H=[];return H.push({color:oe,value:{type:F,value:J}}),L!=="none"&&H.push({color:D,value:{type:L,value:Q}}),H.push({color:A,value:{type:q,value:se}}),{config:H.map((G,Z)=>({...G,index:Z})),type:n.CFRuleType.colorScale}},[]);C.useEffect(()=>e.intercept(e.getInterceptPoints().submit,{handler(){return j({minType:c,medianType:d,maxType:g,minValue:S,medianValue:_,maxValue:w,minColor:N,medianColor:x,maxColor:I})}}),[j,c,d,g,S,_,w,N,x,I,e]);const O=f=>{t.onChange(j(f))};return u.jsxs("div",{children:[u.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:i.t("sheet.cf.panel.styleRule")}),u.jsx("div",{className:Re,children:u.jsx(de,{rule:j({minType:c,medianType:d,maxType:g,minValue:S,medianValue:_,maxValue:w,minColor:N,medianColor:x,maxColor:I})})}),u.jsx("div",{className:"univer-mt-3 univer-text-xs univer-text-gray-600 dark:!univer-text-gray-200",children:i.t("sheet.cf.valueType.min")}),u.jsxs("div",{className:"univer-mt-3 univer-flex univer-h-8 univer-items-center",children:[u.jsx(M.Select,{className:"univer-flex-shrink-0",options:o,value:c,onChange:f=>{h(f);const F=n.createDefaultValueByValueType(f,10);y(F),O({minType:f,medianType:d,maxType:g,minValue:F,medianValue:_,maxValue:w,minColor:N,medianColor:x,maxColor:I})}}),u.jsx(Ae,{id:"min",className:"univer-ml-1",value:S,type:c,onChange:f=>{y(f),O({minType:c,medianType:d,maxType:g,minValue:f,medianValue:_,maxValue:w,minColor:N,medianColor:x,maxColor:I})}}),u.jsx(ie,{className:"univer-ml-1",color:N,onChange:f=>{p(f),O({minType:c,medianType:d,maxType:g,minValue:S,medianValue:_,maxValue:w,minColor:f,medianColor:x,maxColor:I})}})]}),u.jsx("div",{className:"univer-text-gray-600dark:!univer-text-gray-200 univer-mt-3 univer-text-xs",children:i.t("sheet.cf.panel.medianValue")}),u.jsxs("div",{className:"univer-mt-3 univer-flex univer-h-8 univer-items-center",children:[u.jsx(M.Select,{className:"univer-flex-shrink-0",options:l,value:d,onChange:f=>{m(f);const F=n.createDefaultValueByValueType(f,50);T(F),O({minType:c,medianType:f,maxType:g,minValue:S,medianValue:F,maxValue:w,minColor:N,medianColor:x,maxColor:I})}}),u.jsx(Ae,{id:"median",className:"univer-ml-1",value:_,type:d,onChange:f=>{T(f),O({minType:c,medianType:d,maxType:g,minValue:S,medianValue:f,maxValue:w,minColor:N,medianColor:x,maxColor:I})}}),d!=="none"&&u.jsx(ie,{className:"univer-ml-1",color:x,onChange:f=>{R(f),O({minType:c,medianType:d,maxType:g,minValue:S,medianValue:_,maxValue:w,minColor:N,medianColor:f,maxColor:I})}})]}),u.jsx("div",{className:"univer-mt-3 univer-text-xs univer-text-gray-600 dark:!univer-text-gray-200",children:i.t("sheet.cf.valueType.max")}),u.jsxs("div",{className:"univer-mt-3 univer-flex univer-h-8 univer-items-center",children:[u.jsx(M.Select,{className:"univer-flex-shrink-0",options:v,value:g,onChange:f=>{b(f);const F=n.createDefaultValueByValueType(f,90);E(F),O({minType:c,medianType:d,maxType:f,minValue:S,medianValue:_,maxValue:F,minColor:N,medianColor:x,maxColor:I})}}),u.jsx(Ae,{id:"max",className:"univer-ml-1",value:w,type:g,onChange:f=>{E(f),O({minType:c,medianType:d,maxType:g,minValue:S,medianValue:_,maxValue:f,minColor:N,medianColor:x,maxColor:I})}}),u.jsx(ie,{className:"univer-ml-1",color:I,onChange:f=>{V(f),O({minType:c,medianType:d,maxType:g,minValue:S,medianValue:_,maxValue:w,minColor:N,medianColor:x,maxColor:f})}})]})]})},ae=(t,e)=>({label:e.t(`sheet.cf.valueType.${t}`),value:t}),rt=t=>{var y;const{onChange:e,className:i,value:r,type:s,id:o,disabled:l=!1}=t,v=P.useDependency(a.IUniverInstanceService),c=v.getCurrentUnitOfType(a.UniverInstanceType.UNIVER_SHEET).getUnitId(),h=(y=v.getCurrentUnitOfType(a.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:y.getSheetId(),d=C.useRef(null),[m,g]=C.useState(!1);P.useSidebarClick(_=>{var w;((w=d.current)==null?void 0:w.isClickOutSide(_))&&g(!1)});const b=C.useRef(r),S=C.useMemo(()=>[n.CFValueType.percentile,n.CFValueType.percent].includes(s)?{max:100,min:0}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[s]);if(s===n.CFValueType.formula){const _=String(b.current).startsWith("=")?String(b.current)||"":"=";return u.jsx("div",{className:"univer-ml-3 univer-w-full",children:u.jsx(xe.FormulaEditor,{ref:d,className:M.clsx("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-white [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent",M.borderClassName),initValue:_,unitId:c,subUnitId:h,isFocus:m,onChange:(T="")=>{e(T||"")},onFocus:()=>g(!0)})})}return u.jsx(M.InputNumber,{className:i,value:Number(r)||0,disabled:l,onChange:_=>{e(_||0)},...S})},zt=t=>{var k;const{interceptorManager:e}=t,i=P.useDependency(a.LocaleService),r=((k=t.rule)==null?void 0:k.type)===n.CFRuleType.dataBar?t.rule:void 0,[s,o]=C.useState(()=>{var F;return r&&(F=r.config)!=null&&F.isGradient?"1":"0"}),[l,v]=C.useState(()=>{var f;return r&&((f=r.config)==null?void 0:f.positiveColor)||n.defaultDataBarPositiveColor}),[c,h]=C.useState(()=>{var f;return r&&((f=r.config)==null?void 0:f.nativeColor)||n.defaultDataBarNativeColor}),d=[ae(n.CFValueType.num,i),ae(n.CFValueType.percent,i),ae(n.CFValueType.percentile,i),ae(n.CFValueType.formula,i)],m=[ae(n.CFValueType.min,i),...d],g=[ae(n.CFValueType.max,i),...d],[b,S]=C.useState(()=>{var F;const f=m[0].value;return r&&((F=r.config)==null?void 0:F.min.type)||f}),[y,_]=C.useState(()=>{var F;const f=g[0].value;return r&&((F=r.config)==null?void 0:F.max.type)||f}),[T,w]=C.useState(()=>{var L;if(!r)return 0;const F=((L=r.config)==null?void 0:L.min)||{};return F.type===n.CFValueType.formula?F.value||"=":F.value||0}),[E,N]=C.useState(()=>{var L;if(!r)return 100;const F=((L=r.config)==null?void 0:L.max)||{};return F.type===n.CFValueType.formula?F.value||"=":F.value===void 0?100:F.value}),[p,x]=C.useState(()=>r?r.isShowValue===void 0?!0:!!r.isShowValue:!0),R=f=>({config:{min:{type:f.minValueType,value:f.minValue},max:{type:f.maxValueType,value:f.maxValue},isGradient:f.isGradient==="1",positiveColor:f.positiveColor||n.defaultDataBarPositiveColor,nativeColor:f.nativeColor||n.defaultDataBarNativeColor},type:n.CFRuleType.dataBar,isShowValue:f.isShowValue});C.useEffect(()=>e.intercept(e.getInterceptPoints().submit,{handler(){return R({isGradient:s,minValue:T,minValueType:b,maxValue:E,maxValueType:y,positiveColor:l,nativeColor:c,isShowValue:p})}}),[s,T,b,E,y,l,c,e,p]);const I=f=>{t.onChange(R(f))},V=f=>{v(f),I({isGradient:s,minValue:T,minValueType:b,maxValue:E,maxValueType:y,positiveColor:f,nativeColor:c,isShowValue:p})},j=f=>{h(f),I({isGradient:s,minValue:T,minValueType:b,maxValue:E,maxValueType:y,positiveColor:l,nativeColor:f,isShowValue:p})},O=f=>d.map(F=>F.value).includes(f);return u.jsxs("div",{children:[u.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:i.t("sheet.cf.panel.styleRule")}),u.jsx("div",{className:Re,children:u.jsx(de,{rule:R({isGradient:s,minValue:T,minValueType:b,maxValue:E,maxValueType:y,positiveColor:l,nativeColor:c,isShowValue:p})})}),u.jsxs("div",{children:[u.jsx("div",{className:"univer-mt-3 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:i.t("sheet.cf.panel.fillType")}),u.jsxs("div",{className:"univer-ml-1 univer-mt-3 univer-flex univer-items-center",children:[u.jsxs(M.RadioGroup,{value:s,onChange:f=>{o(f),I({isGradient:f,minValue:T,minValueType:b,maxValue:E,maxValueType:y,positiveColor:l,nativeColor:c,isShowValue:p})},children:[u.jsx(M.Radio,{value:"0",children:u.jsx("span",{className:"univer-text-xs",children:i.t("sheet.cf.panel.pureColor")})}),u.jsx(M.Radio,{value:"1",children:u.jsx("span",{className:"univer-text-xs",children:i.t("sheet.cf.panel.gradient")})})]}),u.jsxs("div",{className:"univer-ml-6 univer-flex univer-items-center univer-text-xs",children:[u.jsx(M.Checkbox,{checked:!p,onChange:f=>{x(!f),I({isGradient:f,minValue:T,minValueType:b,maxValue:E,maxValueType:y,positiveColor:l,nativeColor:c,isShowValue:!f})}}),i.t("sheet.cf.panel.onlyShowDataBar")]})]})]}),u.jsxs("div",{children:[u.jsx("div",{className:"univer-mt-3 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:i.t("sheet.cf.panel.colorSet")}),u.jsxs("div",{className:"univer-ml-1 univer-mt-3 univer-flex univer-items-center",children:[u.jsxs("div",{className:"univer-flex univer-items-center",children:[u.jsx("div",{className:"univer-text-xs",children:i.t("sheet.cf.panel.native")}),u.jsx(ie,{color:c,onChange:j})]}),u.jsxs("div",{className:"univer-ml-3 univer-flex univer-items-center",children:[u.jsx("div",{className:"univer-text-xs",children:i.t("sheet.cf.panel.positive")}),u.jsx(ie,{color:l,onChange:V})]})]})]}),u.jsxs("div",{children:[u.jsx("div",{className:"univer-mt-3 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:i.t("sheet.cf.valueType.min")}),u.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center",children:[u.jsx(M.Select,{className:"univer-w-1/2 univer-flex-shrink-0",options:m,value:b,onChange:f=>{S(f);const F=n.createDefaultValueByValueType(f,10);w(F),I({isGradient:s,minValue:F,minValueType:f,maxValue:E,maxValueType:y,positiveColor:l,nativeColor:c,isShowValue:p})}}),u.jsx(rt,{id:"min",className:"univer-ml-3",disabled:!O(b),type:b,value:T,onChange:f=>{w(f||0),I({isGradient:s,minValue:f||0,minValueType:b,maxValue:E,maxValueType:y,positiveColor:l,nativeColor:c,isShowValue:p})}})]}),u.jsx("div",{className:"univer-mt-3 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:i.t("sheet.cf.valueType.max")}),u.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center",children:[u.jsx(M.Select,{className:"univer-w-1/2 univer-flex-shrink-0",options:g,value:y,onChange:f=>{_(f);const F=n.createDefaultValueByValueType(f,90);N(F),I({isGradient:s,minValue:T,minValueType:b,maxValue:F,maxValueType:f,positiveColor:l,nativeColor:c,isShowValue:p})}}),u.jsx(rt,{className:"univer-ml-3",disabled:!O(y),id:"max",type:y,value:E,onChange:f=>{N(f||0),I({isGradient:s,minValue:T,minValueType:b,maxValue:f||0,maxValueType:y,positiveColor:l,nativeColor:c,isShowValue:p})}})]})]})]})},we=t=>[a.BooleanNumber.FALSE,void 0].includes(t)?a.BooleanNumber.TRUE:a.BooleanNumber.FALSE,Ne=t=>t!==a.BooleanNumber.FALSE,nt=t=>{const{style:e,onChange:i,className:r}=t,[s,o]=C.useState(()=>{if(e!=null&&e.bl)return e.bl}),[l,v]=C.useState(()=>{if(e!=null&&e.it)return e.it}),[c,h]=C.useState(()=>{if(e!=null&&e.ul)return e.ul.s}),[d,m]=C.useState(()=>{if(e!=null&&e.st)return e.st.s}),[g,b]=C.useState(()=>{var w;const T="#2f56ef";return(w=e==null?void 0:e.cl)!=null&&w.rgb?e.cl.rgb:T}),[S,y]=C.useState(()=>{var w;const T="#e8ecfc";return(w=e==null?void 0:e.bg)!=null&&w.rgb?e.bg.rgb:T});C.useEffect(()=>{const T={bl:s,it:l};g!==void 0&&(T.cl={rgb:g}),S!==void 0&&(T.bg={rgb:S}),d!==void 0&&(T.st={s:d}),c!==void 0&&(T.ul={s:c}),i(n.removeUndefinedAttr(T))},[s,l,c,d,g,S]);const _="univer-flex univer-cursor-pointer univer-items-center univer-rounded univer-px-1";return u.jsxs("div",{className:M.clsx("univer-my-2.5 univer-flex univer-justify-between",r),children:[u.jsx("div",{className:M.clsx(_,{"univer-bg-gray-100 dark:!univer-bg-gray-700":Ne(s||a.BooleanNumber.FALSE)}),onClick:()=>o(we(s)),children:u.jsx(pt,{})}),u.jsx("div",{className:M.clsx(_,{"univer-bg-gray-100 dark:!univer-bg-gray-700":Ne(l||a.BooleanNumber.FALSE)}),onClick:()=>v(we(l)),children:u.jsx(yt,{})}),u.jsx("div",{className:M.clsx(_,{"univer-bg-gray-100 dark:!univer-bg-gray-700":Ne(c||a.BooleanNumber.FALSE)}),onClick:()=>h(we(c)),children:u.jsx(xt,{})}),u.jsx("div",{className:M.clsx(_,{"univer-bg-gray-100 dark:!univer-bg-gray-700":Ne(d||a.BooleanNumber.FALSE)}),onClick:()=>m(we(d)),children:u.jsx(St,{})}),u.jsx(ie,{color:g,onChange:b,Icon:ft}),u.jsx(ie,{color:S,onChange:y})]})},Yt=t=>{var N;const{onChange:e,interceptorManager:i}=t,r=P.useDependency(a.LocaleService),o=P.useDependency(a.IUniverInstanceService).getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET),l=o.getActiveSheet(),v=((N=t.rule)==null?void 0:N.type)===n.CFRuleType.highlightCell?t.rule:void 0,c=C.useRef(null),[h,d]=C.useState(!1),m=C.useRef(null),[g,b]=C.useState({}),[S,y]=C.useState(()=>(v==null?void 0:v.subType)===n.CFSubRuleType.formula?v.value:"="),[_,T]=C.useState(void 0),w=p=>({style:p.style,value:S,type:n.CFRuleType.highlightCell,subType:n.CFSubRuleType.formula});C.useEffect(()=>i.intercept(i.getInterceptPoints().submit,{handler(){return w({style:g})}}),[g,S,i]),C.useEffect(()=>i.intercept(i.getInterceptPoints().beforeSubmit,{handler:(x,R,I)=>_||S.length===1||!S.startsWith("=")?(T(r.t("sheet.cf.errorMessage.formulaError")),!1):I(x)}),[_,S]);const E=p=>{e(w(p))};return P.useSidebarClick(p=>{var R;((R=m.current)==null?void 0:R.isClickOutSide(p))&&d(!1)}),u.jsxs("div",{ref:c,children:[u.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:r.t("sheet.cf.panel.styleRule")}),u.jsx("div",{className:"univer-mt-3",children:u.jsx(xe.FormulaEditor,{ref:m,className:M.clsx("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-white [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent",M.borderClassName),errorText:_,isFocus:h,initValue:S,unitId:o.getUnitId(),subUnitId:l==null?void 0:l.getSheetId(),onFocus:()=>{d(!0)},onChange:p=>{y(p),E({style:g})},onVerify:(p,x)=>{!p||x.length===1?T(r.t("sheet.cf.errorMessage.formulaError")):T(void 0)}})}),u.jsx("div",{className:Re,children:u.jsx(de,{rule:w({style:g})})}),u.jsx(nt,{style:v==null?void 0:v.style,className:"univer-mt-3",onChange:p=>{b(p),E({style:p})}})]})},Ee=t=>u.jsxs("div",{className:"univer-relative",children:[u.jsx("div",{className:"univer-absolute univer-bottom-[-13px] univer-z-[999] univer-text-[10px] univer-text-red-500",children:t.errorText}),t.children]}),$=(t,e)=>({label:e.t(`sheet.cf.operator.${t}`),value:t}),Kt=t=>{const{type:e,operator:i,onChange:r,value:s,interceptorManager:o}=t,l=P.useDependency(a.LocaleService),[v,c]=C.useState(()=>typeof s=="number"?s:0),[h,d]=C.useState(""),[m,g]=C.useState(()=>typeof s=="string"?s:""),[b,S]=C.useState(""),[y,_]=C.useState(()=>Array.isArray(s)?s[0]===void 0?0:s[0]:0),[T,w]=C.useState(""),[E,N]=C.useState(()=>Array.isArray(s)?s[1]===void 0?100:s[1]:100),[p,x]=C.useState("");switch(C.useEffect(()=>{switch(e){case n.CFSubRuleType.text:{[n.CFTextOperator.beginsWith,n.CFTextOperator.endsWith,n.CFTextOperator.containsText,n.CFTextOperator.notContainsText,n.CFTextOperator.equal,n.CFTextOperator.notEqual].includes(i)&&r(m);break}case n.CFSubRuleType.number:{[n.CFNumberOperator.equal,n.CFNumberOperator.notEqual,n.CFNumberOperator.greaterThan,n.CFNumberOperator.greaterThanOrEqual,n.CFNumberOperator.lessThan,n.CFNumberOperator.lessThanOrEqual].includes(i)&&r(v),[n.CFNumberOperator.between,n.CFNumberOperator.notBetween].includes(i)&&r([y,E]);break}}},[e]),C.useEffect(()=>{const R=o.intercept(o.getInterceptPoints().beforeSubmit,{handler:(I,V,j)=>{switch(e){case n.CFSubRuleType.text:if([n.CFTextOperator.beginsWith,n.CFTextOperator.containsText,n.CFTextOperator.endsWith,n.CFTextOperator.notEqual,n.CFTextOperator.notContainsText,n.CFTextOperator.equal].includes(i))return m?j(I):(S(l.t("sheet.cf.errorMessage.notBlank")),!1)}return j(I)}});return()=>{R()}},[e,v,m,i]),e){case n.CFSubRuleType.text:{if([n.CFTextOperator.beginsWith,n.CFTextOperator.endsWith,n.CFTextOperator.containsText,n.CFTextOperator.notContainsText,n.CFTextOperator.equal,n.CFTextOperator.notEqual].includes(i)){const R=I=>{g(I),r(I)};return u.jsx("div",{className:"univer-mt-3",children:u.jsx(Ee,{errorText:b,children:u.jsx(M.Input,{value:m,onChange:I=>{S(""),R(I)}})})})}break}case n.CFSubRuleType.number:{if([n.CFNumberOperator.equal,n.CFNumberOperator.notEqual,n.CFNumberOperator.greaterThan,n.CFNumberOperator.greaterThanOrEqual,n.CFNumberOperator.lessThan,n.CFNumberOperator.lessThanOrEqual].includes(i)){const R=I=>{c(I||0),r(I||0),d("")};return u.jsx("div",{className:"univer-mt-3",children:u.jsx(Ee,{errorText:h,children:u.jsx(M.InputNumber,{className:"univer-w-full",min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,value:v,onChange:R})})})}if([n.CFNumberOperator.between,n.CFNumberOperator.notBetween].includes(i)){const R=V=>{_(V||0),r([V||0,E]),w("")},I=V=>{N(V||0),r([y,V||0]),x("")};return u.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center",children:[u.jsx(Ee,{errorText:T,children:u.jsx(M.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,value:y,onChange:R})}),u.jsx(Ee,{errorText:p,children:u.jsx(M.InputNumber,{className:"univer-ml-3",min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,value:E,onChange:I})})]})}}}return null},it=(t,e)=>{switch(t){case n.CFSubRuleType.text:return[$(n.CFTextOperator.containsText,e),$(n.CFTextOperator.notContainsText,e),$(n.CFTextOperator.beginsWith,e),$(n.CFTextOperator.endsWith,e),$(n.CFTextOperator.equal,e),$(n.CFTextOperator.notEqual,e),$(n.CFTextOperator.containsBlanks,e),$(n.CFTextOperator.notContainsBlanks,e),$(n.CFTextOperator.containsErrors,e),$(n.CFTextOperator.notContainsErrors,e)];case n.CFSubRuleType.number:return[$(n.CFNumberOperator.between,e),$(n.CFNumberOperator.notBetween,e),$(n.CFNumberOperator.equal,e),$(n.CFNumberOperator.notEqual,e),$(n.CFNumberOperator.greaterThan,e),$(n.CFNumberOperator.greaterThanOrEqual,e),$(n.CFNumberOperator.lessThan,e),$(n.CFNumberOperator.lessThanOrEqual,e)];case n.CFSubRuleType.timePeriod:return[$(n.CFTimePeriodOperator.yesterday,e),$(n.CFTimePeriodOperator.today,e),$(n.CFTimePeriodOperator.tomorrow,e),$(n.CFTimePeriodOperator.last7Days,e),$(n.CFTimePeriodOperator.lastWeek,e),$(n.CFTimePeriodOperator.thisWeek,e),$(n.CFTimePeriodOperator.nextWeek,e),$(n.CFTimePeriodOperator.lastMonth,e),$(n.CFTimePeriodOperator.thisMonth,e),$(n.CFTimePeriodOperator.nextMonth,e)]}},st=t=>{var N;const{interceptorManager:e,onChange:i}=t,r=P.useDependency(a.LocaleService),s=((N=t.rule)==null?void 0:N.type)===n.CFRuleType.highlightCell?t.rule:void 0,[o,l]=C.useState(()=>{const p=n.CFSubRuleType.text;return s&&s.subType||p}),v=[{value:n.CFSubRuleType.text,label:r.t("sheet.cf.subRuleType.text")},{value:n.CFSubRuleType.number,label:r.t("sheet.cf.subRuleType.number")},{value:n.CFSubRuleType.timePeriod,label:r.t("sheet.cf.subRuleType.timePeriod")},{value:n.CFSubRuleType.duplicateValues,label:r.t("sheet.cf.subRuleType.duplicateValues")},{value:n.CFSubRuleType.uniqueValues,label:r.t("sheet.cf.subRuleType.uniqueValues")}],c=C.useMemo(()=>it(o,r),[o]),[h,d]=C.useState(()=>{const p=c?c[0].value:void 0;return s&&s.operator||p}),[m,g]=C.useState(()=>{var R;return s?(R=s.value)!=null?R:n.createDefaultValue(s.subType,s.operator):""}),[b,S]=C.useState({}),y=C.useMemo(()=>p=>{var x,R,I,V,j,O,k,f,F,L,q,J,Q,se,oe;switch(p.subType||o){case n.CFSubRuleType.text:{if([n.CFTextOperator.beginsWith,n.CFTextOperator.endsWith,n.CFTextOperator.containsText,n.CFTextOperator.notContainsText,n.CFTextOperator.equal,n.CFTextOperator.notEqual].includes(h))return{type:n.CFRuleType.highlightCell,subType:(x=p.subType)!=null?x:o,operator:(R=p.operator)!=null?R:h,style:(I=p.style)!=null?I:b,value:(V=p.value)!=null?V:m};break}case n.CFSubRuleType.number:{if([n.CFNumberOperator.equal,n.CFNumberOperator.notEqual,n.CFNumberOperator.greaterThan,n.CFNumberOperator.greaterThanOrEqual,n.CFNumberOperator.lessThan,n.CFNumberOperator.lessThanOrEqual].includes(h))return{type:n.CFRuleType.highlightCell,subType:(j=p.subType)!=null?j:o,operator:(O=p.operator)!=null?O:h,style:(k=p.style)!=null?k:b,value:(f=p.value)!=null?f:m};if([n.CFNumberOperator.between,n.CFNumberOperator.notBetween].includes(h))return{type:n.CFRuleType.highlightCell,subType:(F=p.subType)!=null?F:o,operator:(L=p.operator)!=null?L:h,style:(q=p.style)!=null?q:b,value:(J=p.value)!=null?J:m};break}}return{type:n.CFRuleType.highlightCell,subType:(Q=p.subType)!=null?Q:o,operator:(se=p.operator)!=null?se:h,style:(oe=p.style)!=null?oe:b}},[o,h,m,b]);C.useEffect(()=>e.intercept(e.getInterceptPoints().submit,{handler(){return y({})}}),[y,e]),C.useEffect(()=>{v.some(p=>p.value===o)||l(v[0].value)},[v]);const _=p=>{const x=p,R=it(x,r),I=R&&R[0].value;l(x),d(I),I&&g(n.createDefaultValue(x,I)),i(y({subType:x,operator:I}))},T=p=>{const x=p;d(x),i(y({operator:x}))},w=p=>{g(p),i(y({value:p}))},E=C.useMemo(()=>`${o}_${h}_${Math.random()}`,[o,h]);return u.jsxs("div",{children:[u.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:r.t("sheet.cf.panel.styleRule")}),u.jsxs("div",{className:"univer-flex univer-justify-between univer-gap-4",children:[u.jsx(M.Select,{className:"univer-mt-3 univer-w-full",onChange:_,value:o,options:v}),(c==null?void 0:c.length)&&u.jsx(M.Select,{className:"univer-mt-3 univer-w-full",onChange:T,value:h||"",options:c})]}),u.jsx(Kt,{value:m,interceptorManager:e,type:o,operator:h,rule:s,onChange:w},E),u.jsx("div",{className:Re,children:u.jsx(de,{rule:y({})})}),u.jsx(nt,{style:s==null?void 0:s.style,className:"univer-ml-1",onChange:p=>{S(p),i(y({style:p}))}})]})},Tt=(t,e)=>(n.iconMap[t]||[])[Number(e)]||"",Xt=t=>{var d;const{error:e,type:i,onChange:r}=t,s=P.useDependency(a.IUniverInstanceService),o=s.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET).getUnitId(),l=(d=s.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:d.getSheetId(),v=C.useRef(null),[c,h]=C.useState(!1);return P.useSidebarClick(m=>{var b;((b=v.current)==null?void 0:b.isClickOutSide(m))&&h(!1)}),u.jsx("div",{className:"univer-relative",children:i!==n.CFValueType.formula?u.jsxs(u.Fragment,{children:[u.jsx(M.InputNumber,{className:M.clsx({"univer-border-red-500":e}),value:Number(t.value)||0,onChange:m=>r(m!=null?m:0)}),e&&u.jsx("div",{className:"univer-absolute univer-text-xs univer-text-red-500",children:e})]}):u.jsx("div",{className:"univer-w-full",children:u.jsx(xe.FormulaEditor,{ref:v,className:M.clsx("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-white [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent",M.borderClassName),initValue:String(t.value),unitId:o,subUnitId:l,isFocus:c,onChange:(m="")=>{r(m||"")},onFocus:()=>h(!0)})})})},ot=(t,e,i)=>({operator:n.CFNumberOperator.greaterThan,value:{type:n.CFValueType.num,value:(i.length-1-e)*10},iconType:t,iconId:String(e)}),Jt=C.forwardRef((t,e)=>{const{onClick:i}=t,r=P.useDependency(a.LocaleService),s=o=>{i(o)};return u.jsx("div",{ref:e,className:"univer-w-80",children:n.iconGroup.map((o,l)=>u.jsxs("div",{className:"univer-mb-3",children:[u.jsx("div",{className:"univer-mb-1 univer-text-sm",children:r.t(o.title)}),u.jsx("div",{className:"univer-flex univer-flex-wrap",children:o.group.map(v=>u.jsx("div",{className:"univer-mb-1 univer-flex univer-w-1/2 univer-items-center",onClick:()=>{s(v.name)},children:u.jsx("a",{className:"univer-cursor-pointer univer-rounded hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",children:v.list.map((c,h)=>u.jsx("img",{className:"univer-size-5",src:c,draggable:!1},h))})},v.name))})]},l))})}),Qt=t=>{const{onClick:e}=t,i=C.useMemo(()=>{const s=[];for(const o in n.iconMap){const l=n.iconMap[o],v=o;l.forEach((c,h)=>{s.push({iconType:v,base64:c,iconId:String(h)})})}return s},[]),r=s=>{e(s.iconType,s.iconId)};return u.jsxs("div",{children:[u.jsxs("div",{className:"univer-mb-2.5 univer-flex univer-cursor-pointer univer-items-center univer-pl-1",onClick:()=>r({iconType:n.EMPTY_ICON_TYPE,iconId:""}),children:[u.jsx(Te,{className:"univer-size-5"}),u.jsx("span",{className:"univer-ml-2",children:"无单元格图标"})]}),u.jsx("div",{className:"univer-flex univer-w-64 univer-flex-wrap",children:i.map(s=>u.jsx("div",{className:"univer-mb-2 univer-mr-2 univer-flex univer-cursor-pointer univer-items-center univer-justify-center univer-rounded hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",children:u.jsx("img",{className:"univer-size-5",src:s.base64,draggable:!1,onClick:()=>r(s)})},`${s.iconType}_${s.iconId}`))})]})},en=t=>{const{onChange:e,configList:i,errorMap:r={}}=t,s=P.useDependency(a.LocaleService),o=[{label:s.t(`sheet.cf.symbol.${n.CFNumberOperator.greaterThan}`),value:n.CFNumberOperator.greaterThan},{label:s.t(`sheet.cf.symbol.${n.CFNumberOperator.greaterThanOrEqual}`),value:n.CFNumberOperator.greaterThanOrEqual}],l=[{label:s.t(`sheet.cf.valueType.${n.CFValueType.num}`),value:n.CFValueType.num},{label:s.t(`sheet.cf.valueType.${n.CFValueType.percent}`),value:n.CFValueType.percent},{label:s.t(`sheet.cf.valueType.${n.CFValueType.percentile}`),value:n.CFValueType.percentile},{label:s.t(`sheet.cf.valueType.${n.CFValueType.formula}`),value:n.CFValueType.formula}],v=(m,g)=>{e([String(g),"value","value"],m)},c=(m,g)=>{e([String(g),"operator"],m);const b=n.createDefaultValue(n.CFSubRuleType.number,m);v(b,g)},h=(m,g)=>{e([String(g),"value","type"],m);const b=i[g],S=n.createDefaultValue(n.CFSubRuleType.number,b.operator);v(S,g)};return C.useMemo(()=>i.map((m,g)=>{const b=r[g],S=Tt(m.iconType,m.iconId),y=g===i.length-1,_=g===0,T=i[g-1],w=(T==null?void 0:T.value.type)===n.CFValueType.formula?s.t("sheet.cf.valueType.formula"):T==null?void 0:T.value.value,E=(N,p)=>{const x={...m,iconId:p,iconType:N};e([String(g)],x)};return u.jsxs("div",{className:g?"univer-mt-6":"univer-mt-3",children:[u.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center univer-justify-between univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:[u.jsxs("div",{className:"univer-w-[45%]",children:[s.t("sheet.cf.iconSet.icon"),g+1]}),u.jsx("div",{className:"univer-w-[45%]",children:u.jsxs(u.Fragment,{children:[!_&&!y&&s.t("sheet.cf.iconSet.rule"),!_&&!y&&u.jsxs("span",{className:"univer-font-medium univer-text-gray-600 dark:!univer-text-gray-200",children:[s.t("sheet.cf.iconSet.when"),s.t(`sheet.cf.symbol.${n.getOppositeOperator(T.operator)}`),w,y?"":` ${s.t("sheet.cf.iconSet.and")} `]})]})})]}),u.jsxs("div",{className:"univer-mt-3 univer-grid univer-grid-cols-2 univer-gap-4",children:[u.jsx("div",{className:"univer-flex univer-items-center",children:u.jsx(M.Dropdown,{overlay:u.jsx("div",{className:"univer-rounded-lg univer-p-4",children:u.jsx(Qt,{onClick:E,iconId:m.iconId,iconType:m.iconType})}),children:u.jsxs("div",{className:M.clsx("univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center univer-justify-between univer-rounded-md univer-bg-white univer-px-4 univer-py-2 univer-text-xs univer-text-gray-600 univer-transition-all hover:univer-border-primary-600 dark:!univer-text-gray-200",M.borderClassName),children:[S?u.jsx("img",{src:S,className:"univer-size-4",draggable:!1}):u.jsx(Te,{className:"univer-size-4"}),u.jsx(tt,{})]})})}),y?u.jsxs("div",{className:"univer-mt-0 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:[s.t("sheet.cf.iconSet.rule"),u.jsxs("span",{className:"univer-font-medium",children:[s.t("sheet.cf.iconSet.when"),s.t(`sheet.cf.symbol.${n.getOppositeOperator(T.operator)}`),w,y?"":` ${s.t("sheet.cf.iconSet.and")} `]})]}):u.jsx(M.Select,{options:o,value:m.operator,onChange:N=>{c(N,g)}})]}),y?u.jsx("div",{}):u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"univer-mt-3 univer-grid univer-grid-cols-2 univer-gap-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:[u.jsx("div",{children:s.t("sheet.cf.iconSet.type")}),u.jsx("div",{children:s.t("sheet.cf.iconSet.value")})]}),u.jsxs("div",{className:"univer-mt-3 univer-grid univer-grid-cols-2 univer-gap-4",children:[u.jsx(M.Select,{options:l,value:m.value.type,onChange:N=>{h(N,g)}}),u.jsx(Xt,{id:g,type:m.value.type,error:b,value:m.value.value||"",onChange:N=>{v(N,g)}})]})]})]},g)}),[i,r])},tn=t=>{var N;const{interceptorManager:e}=t,i=((N=t.rule)==null?void 0:N.type)===n.CFRuleType.iconSet?t.rule:void 0,r=P.useDependency(a.LocaleService),[s,o]=C.useState({}),[l,v]=C.useState(()=>{const p=Object.keys(n.iconMap)[0];if(i&&i.config.length){const x=i.config[0].iconType;if(!i.config.some(I=>I.iconType!==x))return x}return p}),[c,h]=C.useState(()=>{if(i&&i.config.length)return a.Tools.deepClone(i==null?void 0:i.config);const p=n.iconMap[l]||[];return new Array(p.length).fill("").map((x,R,I)=>R===I.length-1?{operator:n.CFNumberOperator.lessThanOrEqual,value:{type:n.CFValueType.num,value:Number.MAX_SAFE_INTEGER},iconType:l,iconId:String(R)}:ot(l,R,I))}),[d,m]=C.useState(()=>i?!!i.isShowValue:!0),g=C.useMemo(()=>{const p=c.map(x=>Tt(x.iconType,x.iconId));return u.jsx("div",{className:"univer-flex univer-items-center",children:p.map((x,R)=>x?u.jsx("img",{className:"univer-size-5",src:x},R):u.jsx(Te,{className:"univer-size-5"},R))})},[c]),b=p=>{if(p.reduce((R,I,V)=>R.preType&&!R.result||p.length-1===V?R:I.value.type===n.CFValueType.formula?{preType:n.CFValueType.formula,result:!1}:R.preType?{result:R.preType===I.value.type,preType:I.value.type}:{result:!0,preType:I.value.type},{result:!0,preType:""}).result&&[n.CFValueType.num,n.CFValueType.percent,n.CFValueType.percentile].includes(p[0].value.type)){const R={};return p.forEach((I,V,j)=>{if(V-1<0||V===j.length-1)return;const k=p[V-1],f=n.getOppositeOperator(k.operator);n.compareWithNumber({operator:f,value:k.value.value},I.value.value)||(R[V]=`${r.t(`sheet.cf.form.${f}`,String(k.value.value))} `)}),R}return{}},S=(p,x)=>{a.get(c,p)!==x&&(a.set(c,p,x),h([...c]),o(b(c)))},y=p=>{v(p);const x=n.iconMap[p]||[],R=new Array(x.length).fill("").map((I,V,j)=>ot(p,V,j));h(R),o(b(R))};C.useEffect(()=>{const p=e.intercept(e.getInterceptPoints().submit,{handler(){return{type:n.CFRuleType.iconSet,isShowValue:d,config:c}}});return()=>{p()}},[d,c,e]),C.useEffect(()=>{const p=e.intercept(e.getInterceptPoints().beforeSubmit,{handler(){return Object.keys(s).length===0}});return()=>{p()}},[d,c,e,s]);const _=()=>{const p=c.map(x=>({...x}));c.forEach((x,R)=>{const I=c.length-1-R,V=p[I];x.iconId=V.iconId,x.iconType=V.iconType}),h([...c])},T=P.useDependency(P.ILayoutService),[w,E]=C.useState();return P.useScrollYOverContainer(w,T.rootContainerElement),u.jsxs("div",{children:[u.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600",children:r.t("sheet.cf.panel.styleRule")}),u.jsx("div",{className:"univer-mt-3",children:u.jsx(M.Dropdown,{overlay:u.jsx("div",{className:"univer-rounded-lg univer-p-4",children:u.jsx(Jt,{ref:p=>{!w&&p&&E(p)},iconType:l,onClick:y})}),children:u.jsxs("div",{className:M.clsx("univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center univer-justify-between univer-rounded-md univer-bg-white univer-px-4 univer-py-2 univer-text-xs univer-text-gray-600 univer-transition-all hover:univer-border-primary-600",M.borderClassName),children:[g,u.jsx(tt,{})]})})}),u.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center univer-text-xs",children:[u.jsxs("div",{className:"univer-flex univer-items-center univer-text-xs",children:[u.jsx(M.Checkbox,{onChange:_}),r.t("sheet.cf.iconSet.reverseIconOrder")]}),u.jsxs("div",{className:"univer-ml-6 univer-flex univer-items-center univer-text-xs",children:[u.jsx(M.Checkbox,{checked:!d,onChange:p=>{m(!p)}}),r.t("sheet.cf.iconSet.onlyShowIcon")]})]}),u.jsx(en,{errorMap:s,onChange:S,configList:c})]})},nn=t=>{var _;const{onChange:e,interceptorManager:i}=t,r=P.useDependency(a.LocaleService),s=((_=t.rule)==null?void 0:_.type)===n.CFRuleType.highlightCell?t.rule:void 0,o=[{label:r.t("sheet.cf.panel.isNotBottom"),value:"isNotBottom"},{label:r.t("sheet.cf.panel.isBottom"),value:"isBottom"},{label:r.t("sheet.cf.panel.greaterThanAverage"),value:"greaterThanAverage"},{label:r.t("sheet.cf.panel.lessThanAverage"),value:"lessThanAverage"}],[l,v]=C.useState(()=>{const T=o[0].value,w=s==null?void 0:s.type;if(!s)return T;switch(w){case n.CFRuleType.highlightCell:switch(s.subType){case n.CFSubRuleType.average:return[n.CFNumberOperator.greaterThan,n.CFNumberOperator.greaterThanOrEqual].includes(s.operator)?"greaterThanAverage":[n.CFNumberOperator.lessThan,n.CFNumberOperator.lessThanOrEqual].includes(s.operator)?"lessThanAverage":T;case n.CFSubRuleType.rank:return s.isBottom?"isBottom":"isNotBottom"}}return T}),[c,h]=C.useState(()=>{const w=s==null?void 0:s.type;if(!s)return 10;switch(w){case n.CFRuleType.highlightCell:switch(s.subType){case n.CFSubRuleType.rank:return s.value||10}}return 10}),[d,m]=C.useState(()=>{const w=s==null?void 0:s.type;if(!s)return!1;switch(w){case n.CFRuleType.highlightCell:switch(s.subType){case n.CFSubRuleType.rank:return s.isPercent||!1}}return!1}),[g,b]=C.useState({}),S=T=>{const{type:w,isPercent:E,value:N,style:p}=T;if(w==="isNotBottom")return{type:n.CFRuleType.highlightCell,subType:n.CFSubRuleType.rank,isPercent:E,isBottom:!1,value:N,style:p};if(w==="isBottom")return{type:n.CFRuleType.highlightCell,subType:n.CFSubRuleType.rank,isPercent:E,isBottom:!0,value:N,style:p};if(w==="greaterThanAverage")return{type:n.CFRuleType.highlightCell,subType:n.CFSubRuleType.average,operator:n.CFNumberOperator.greaterThan,style:p};if(w==="lessThanAverage")return{type:n.CFRuleType.highlightCell,subType:n.CFSubRuleType.average,operator:n.CFNumberOperator.lessThan,style:p}};C.useEffect(()=>i.intercept(i.getInterceptPoints().submit,{handler(){return S({type:l,isPercent:d,value:c,style:g})}}),[l,d,c,g,i]);const y=T=>{e(S(T))};return u.jsxs("div",{children:[u.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:r.t("sheet.cf.panel.styleRule")}),u.jsx(M.Select,{className:"univer-mt-3 univer-w-full",value:l,options:o,onChange:T=>{v(T),y({type:T,isPercent:d,value:c,style:g})}}),["isNotBottom","isBottom"].includes(l)&&u.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center",children:[u.jsx(M.InputNumber,{min:1,max:1e3,value:c,onChange:T=>{const w=T||0;h(w),y({type:l,isPercent:d,value:w,style:g})}}),u.jsxs("div",{className:"univer-ml-3 univer-flex univer-items-center univer-text-xs",children:[u.jsx(M.Checkbox,{checked:d,onChange:T=>{m(!!T),y({type:l,isPercent:!!T,value:c,style:g})}}),r.t("sheet.cf.valueType.percent")]})]}),u.jsx("div",{className:Re,children:u.jsx(de,{rule:S({type:l,isPercent:d,value:c,style:g})})}),u.jsx(nt,{style:s==null?void 0:s.style,className:"univer-mt-3",onChange:T=>{b(T),y({type:l,isPercent:d,value:c,style:T})}})]})},rn=a.createInterceptorKey("beforeSubmit"),sn=a.createInterceptorKey("submit"),at=t=>t.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET).getUnitId(),lt=t=>{var e;return(e=t.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:e.getSheetId()},on=t=>{var R,I,V;const e=P.useDependency(a.LocaleService),i=P.useDependency(a.ICommandService),r=P.useDependency(a.IUniverInstanceService),s=P.useDependency(n.ConditionalFormattingRuleModel),o=P.useDependency(U.SheetsSelectionsService),l=at(r),v=lt(r),[c,h]=C.useState(void 0),d=C.useRef((I=(R=t.rule)==null?void 0:R.ranges)!=null?I:[]),m=C.useMemo(()=>{var O,k,f;let j=(O=t.rule)==null?void 0:O.ranges;return j!=null&&j.length||(j=(f=(k=o.getCurrentSelections())==null?void 0:k.map(F=>F.range))!=null?f:[]),d.current=j,j!=null&&j.length?j.map(F=>{const L=qe.serializeRange(F);return L==="NaN"?"":L}).filter(F=>!!F).join(","):""},[t.rule]),g=[{label:e.t("sheet.cf.ruleType.highlightCell"),value:"1"},{label:e.t("sheet.cf.panel.rankAndAverage"),value:"2"},{label:e.t("sheet.cf.ruleType.dataBar"),value:"3"},{label:e.t("sheet.cf.ruleType.colorScale"),value:"4"},{label:e.t("sheet.cf.ruleType.formula"),value:"5"},{label:e.t("sheet.cf.ruleType.iconSet"),value:"6"}],[b,S]=C.useState(()=>{var k,f;const j=(k=t.rule)==null?void 0:k.rule.type,O=g[0].value;if(!j)return O;switch(j){case n.CFRuleType.highlightCell:{switch((f=t.rule)==null?void 0:f.rule.subType){case n.CFSubRuleType.number:case n.CFSubRuleType.text:case n.CFSubRuleType.duplicateValues:case n.CFSubRuleType.uniqueValues:case n.CFSubRuleType.timePeriod:return"1";case n.CFSubRuleType.average:case n.CFSubRuleType.rank:return"2";case n.CFSubRuleType.formula:return"5"}break}case n.CFRuleType.dataBar:return"3";case n.CFRuleType.colorScale:return"4";case n.CFRuleType.iconSet:return"6"}return O}),y=C.useRef(void 0),_=C.useMemo(()=>new a.InterceptorManager({beforeSubmit:rn,submit:sn}),[]),T=C.useMemo(()=>{switch(b){case"1":return st;case"2":return nn;case"3":return zt;case"4":return Zt;case"5":return Yt;case"6":return tn;default:return st}},[b]);C.useEffect(()=>{const j=i.onCommandExecuted(O=>{if(O.id===U.RemoveSheetMutation.id){const k=O.params;k.subUnitId===v&&k.unitId===l&&t.onCancel()}O.id===U.SetWorksheetActiveOperation.id&&t.onCancel()});return()=>j.dispose()},[]);const w=j=>{y.current=j},E=j=>{const O=j.split(",").filter(k=>!!k).map(qe.deserializeRangeWithSheet).map(k=>k.range);d.current=O},N=()=>{if(c)return;const O=(()=>{const f=r.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET).getActiveSheet();if(!f)throw new Error("No active sheet found");return d.current.map(q=>U.setEndForRange(q,f.getRowCount(),f.getColumnCount())).filter(q=>!(Number.isNaN(q.startRow)||Number.isNaN(q.startColumn)))})();if(_.fetchThroughInterceptors(_.getInterceptPoints().beforeSubmit)(!0,null)){const f=_.fetchThroughInterceptors(_.getInterceptPoints().submit)(null,null);if(f){const F=at(r),L=lt(r);if(!F||!L)throw new Error("No active sheet found");let q={};t.rule&&t.rule.cfId?(q={...t.rule,ranges:O,rule:f},i.executeCommand(n.SetCfCommand.id,{unitId:F,subUnitId:L,rule:q}),t.onCancel()):(q={cfId:s.createCfId(F,L),ranges:O,rule:f,stopIfTrue:!1},i.executeCommand(n.AddCfCommand.id,{unitId:F,subUnitId:L,rule:q}),t.onCancel())}}},p=()=>{t.onCancel()},x=(j,O)=>{j?O.length<1?h(e.t("sheet.cf.errorMessage.rangeError")):h(void 0):h(e.t("sheet.cf.errorMessage.rangeError"))};return u.jsxs("div",{children:[u.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:e.t("sheet.cf.panel.range")}),u.jsxs("div",{className:"univer-mt-4",children:[u.jsx(xe.RangeSelector,{unitId:l,subUnitId:v,initialValue:m,onChange:(j,O)=>E(O),onVerify:x}),c&&u.jsx("div",{className:"univer-mt-1 univer-text-xs univer-text-red-500",children:c})]}),u.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:e.t("sheet.cf.panel.styleType")}),u.jsx(M.Select,{className:"univer-mt-4 univer-w-full",value:b,options:g,onChange:j=>S(j)}),u.jsx(T,{interceptorManager:_,rule:(V=t.rule)==null?void 0:V.rule,onChange:w}),u.jsxs("div",{className:"univer-mt-4 univer-flex univer-justify-end",children:[u.jsx(M.Button,{onClick:p,children:e.t("sheet.cf.panel.cancel")}),u.jsx(M.Button,{className:"univer-ml-3",variant:"primary",onClick:N,children:e.t("sheet.cf.panel.submit")})]})]})};var an=Object.getOwnPropertyDescriptor,ln=(t,e,i,r)=>{for(var s=r>1?void 0:r?an(e,i):e,o=t.length-1,l;o>=0;o--)(l=t[o])&&(s=l(s)||s);return s},un=(t,e)=>(i,r)=>e(i,r,t);let ce=class extends a.Disposable{constructor(e){super();ee(this,"_initLocal",()=>{});ee(this,"_findReplaceIndex",e=>{const i=/\{([^}]+)?\}/g,r=[];let s=i.exec(e);for(;s;)r.push({startIndex:s.index,key:Number(s[1]),endIndex:s.index+s[0].length-1}),s=i.exec(e);return r});this._localeService=e,this._initLocal()}tWithReactNode(e,...i){const r=this._localeService.getLocales(),s=e.split("."),o=r&&this._localeService.resolveKeyPath(r,s);if(typeof o=="string"){const l=[];return this._findReplaceIndex(o).forEach((v,c,h)=>{const d=h[c-1]||{endIndex:-1};if(d.endIndex+1<v.startIndex){const m=o.slice(d.endIndex+1,v.startIndex);m&&l.push(m)}if(i[v.key]&&l.push(i[v.key]),c===h.length-1){const m=o.slice(v.endIndex+1);m&&l.push(m)}}),l}return[]}};ce=ln([un(0,a.Inject(a.LocaleService))],ce);const cn=(t,e)=>{const i=t.rule;switch(i.type){case n.CFRuleType.colorScale:return e.t("sheet.cf.ruleType.colorScale");case n.CFRuleType.dataBar:return e.t("sheet.cf.ruleType.dataBar");case n.CFRuleType.iconSet:return e.t("sheet.cf.ruleType.iconSet");case n.CFRuleType.highlightCell:switch(i.subType){case n.CFSubRuleType.average:{const r=i.operator;return e.t(`sheet.cf.preview.describe.${r}`,e.t("sheet.cf.subRuleType.average"))}case n.CFSubRuleType.duplicateValues:return e.t("sheet.cf.subRuleType.duplicateValues");case n.CFSubRuleType.uniqueValues:return e.t("sheet.cf.subRuleType.uniqueValues");case n.CFSubRuleType.number:{const r=i.operator;return e.t(`sheet.cf.preview.describe.${r}`,...Array.isArray(i.value)?i.value.map(s=>String(s)):[String(i.value||"")])}case n.CFSubRuleType.text:{const r=i.operator;return e.t(`sheet.cf.preview.describe.${r}`,i.value||"")}case n.CFSubRuleType.timePeriod:{const r=i.operator;return e.t(`sheet.cf.preview.describe.${r}`)}case n.CFSubRuleType.rank:return i.isPercent?i.isBottom?e.t("sheet.cf.preview.describe.bottomNPercent",String(i.value)):e.t("sheet.cf.preview.describe.topNPercent",String(i.value)):i.isBottom?e.t("sheet.cf.preview.describe.bottomN",String(i.value)):e.t("sheet.cf.preview.describe.topN",String(i.value));case n.CFSubRuleType.formula:return e.t("sheet.cf.ruleType.formula")}}};let ut=0;const dn=t=>{const{onClick:e}=t,i=P.useDependency(n.ConditionalFormattingRuleModel),r=P.useDependency(a.IUniverInstanceService),s=P.useDependency(U.SheetsSelectionsService),o=P.useDependency(a.ICommandService),l=P.useDependency(a.LocaleService),v=P.useDependency(a.Injector),c=P.useDependency(P.ISidebarService),h=P.useDependency(ce),d=P.useObservable(()=>r.getCurrentTypeOfUnit$(a.UniverInstanceType.UNIVER_SHEET),void 0,void 0,[]),m=d.getUnitId(),g=d.getActiveSheet();if(!g)throw new Error("No active sheet found");const b=g.getSheetId(),[S,y]=C.useState([]),[_,T]=C.useState("2"),[w,E]=C.useState(0),[N,p]=C.useState(-1),[x,R]=C.useState(ut),I=C.useRef(null),V=[{label:l.t("sheet.cf.panel.workSheet"),value:"2"},{label:l.t("sheet.cf.panel.selectedRange"),value:"1"}],j=()=>{const D=i.getSubunitRules(m,b);if(!D||!D.length)return[];if(_==="1"){const A=s.getCurrentLastSelection();if(!A)return[];const H=A.range;return D.filter(G=>G.ranges.some(Z=>a.Rectangle.intersects(Z,H)))}else if(_==="2")return[...D];return[]},[O,k]=C.useState(j);B.useHighlightRange(S),C.useEffect(()=>{const D=o.onCommandExecuted(A=>{A.id===U.SetWorksheetActiveOperation.id&&E(Math.random())});return()=>D.dispose()}),C.useEffect(()=>{k(j)},[_,w,m,b]),C.useEffect(()=>{if(_==="2")return;const D=new X.Observable(A=>{const H=[U.SetSelectionsOperation.id,n.AddConditionalRuleMutation.id,n.SetConditionalRuleMutation.id,n.DeleteConditionalRuleMutation.id,n.MoveConditionalRuleMutation.id],W=o.onCommandExecuted(G=>{const{id:Z,params:te}=G,ne=r.getCurrentUnitOfType(a.UniverInstanceType.UNIVER_SHEET).getUnitId();H.includes(Z)&&te.unitId===ne&&A.next(null)});return()=>W.dispose()}).pipe(X.debounceTime(16)).subscribe(()=>{k(j)});return()=>{D.unsubscribe()}},[r,_,m,b]),C.useEffect(()=>{const D=i.$ruleChange.subscribe(()=>{E(Math.random())});return()=>D.unsubscribe()},[i]),C.useEffect(()=>{const D=()=>{var G,Z;const W=Math.max(0,((Z=(G=I.current)==null?void 0:G.getBoundingClientRect().width)!=null?Z:0)-8);return ut=W,W},H=new X.Observable(W=>{const G=c.getContainer();if(G){let Z=setTimeout(()=>{W.next(void 0)},150);const te=()=>{Z&&clearTimeout(Z),Z=null},ne=_e=>{_e.propertyName==="width"&&(te(),W.next(void 0))};return G.addEventListener("transitionend",ne),()=>{te(),G.removeEventListener("transitionend",ne)}}}).pipe(X.debounceTime(16)).subscribe(()=>{R(D())});return()=>{H.unsubscribe()}},[]);const f=D=>{var W;const A=r.getCurrentUnitOfType(a.UniverInstanceType.UNIVER_SHEET).getUnitId(),H=(W=r.getCurrentUnitOfType(a.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:W.getSheetId();if(!A||!H)throw new Error("No active sheet found");o.executeCommand(n.DeleteCfCommand.id,{unitId:A,subUnitId:H,cfId:D.cfId})},F=(D,A)=>{p(A.y)},L=(D,A,H)=>{var _e;p(-1);const W=r.getCurrentUnitOfType(a.UniverInstanceType.UNIVER_SHEET).getUnitId(),G=(_e=r.getCurrentUnitOfType(a.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:_e.getSheetId();if(!W||!G)throw new Error("No active sheet found");const Z=wt=>{const Nt=O.length;return Math.min(Nt-1,Math.max(0,wt))},te=O[Z(A.y)].cfId,ne=O[Z(H.y)].cfId;te!==ne&&o.executeCommand(n.MoveCfCommand.id,{unitId:W,subUnitId:G,start:{id:te,type:"self"},end:{id:ne,type:H.y>A.y?"after":"before"}})},q=()=>{t.onCreate()},J=()=>{_==="2"?o.executeCommand(n.ClearWorksheetCfCommand.id):_==="1"&&O.map(A=>({unitId:m,subUnitId:b,cfId:A.cfId})).forEach(A=>{o.executeCommand(n.DeleteCfCommand.id,A)})},Q=C.useMemo(()=>{const D=r.getCurrentUnitOfType(a.UniverInstanceType.UNIVER_SHEET),A=D.getActiveSheet();return O.filter(H=>{const W=H.ranges;return U.checkRangesEditablePermission(v,D.getUnitId(),A.getSheetId(),W)})},[O]),se=Q.map((D,A)=>({i:D.cfId,x:0,w:12,y:A,h:1,isResizable:!1})),oe=C.useMemo(()=>{const D=r.getCurrentUnitOfType(a.UniverInstanceType.UNIVER_SHEET),A=D.getActiveSheet();return O.every(H=>{const W=H.ranges;return U.checkRangesEditablePermission(v,D.getUnitId(),A.getSheetId(),W)})},[O]);return u.jsxs("div",{children:[u.jsxs("div",{className:"univer-flex univer-items-center univer-justify-between univer-gap-2 univer-text-sm",children:[u.jsx("div",{className:"univer-flex univer-items-center univer-gap-2",children:h.tWithReactNode("sheet.cf.panel.managerRuleSelect",u.jsx(M.Select,{className:"univer-w-36",options:V,value:_,onChange:D=>{T(D)}})).map((D,A)=>u.jsx("span",{children:D},A))}),u.jsxs("div",{className:"univer-flex univer-justify-end",children:[u.jsx(M.Tooltip,{title:l.t("sheet.cf.panel.createRule"),placement:"bottom",children:u.jsx("a",{className:"univer-size-5 univer-cursor-pointer",onClick:q,children:u.jsx(Ct,{})})}),O.length&&oe?u.jsx(M.Tooltip,{title:l.t("sheet.cf.panel.clear"),placement:"bottom",children:u.jsx("a",{className:"univer-size-5 univer-cursor-pointer",onClick:J,children:u.jsx(Ve,{className:"univer-text-red-500"})})}):u.jsx("div",{children:u.jsx(Ve,{className:"univer-text-gray-300"})})]})]}),u.jsx("div",{ref:I,children:x>0&&u.jsx(M.ReactGridLayout,{className:"[&_.react-grid-item]:univer-transition-none [&_.react-grid-placeholder]:univer-rounded [&_.react-grid-placeholder]:!univer-bg-gray-200",draggableHandle:".draggableHandle",layout:se,cols:12,rowHeight:60,width:x,margin:[0,10],onDragStop:L,onDragStart:F,children:Q==null?void 0:Q.map((D,A)=>u.jsx("div",{children:u.jsxs("div",{className:M.clsx("univer-group univer-relative univer-flex univer-items-center univer-justify-between univer-rounded univer-py-2 univer-pl-5 univer-pr-8 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",{"univer-bg-gray-100 dark:!univer-bg-gray-700":N===A}),onMouseMove:()=>{D.ranges!==S&&y(D.ranges)},onMouseLeave:()=>y([]),onClick:()=>{e(D)},children:[u.jsx("div",{className:M.clsx("univer-absolute univer-left-0 univer-hidden univer-size-5 univer-cursor-grab univer-items-center univer-justify-center univer-rounded group-hover:univer-flex","draggableHandle"),onClick:H=>H.stopPropagation(),children:u.jsx(It,{})}),u.jsxs("div",{className:"univer-min-w-0 univer-max-w-full univer-flex-shrink univer-overflow-hidden",children:[u.jsx("div",{className:"univer-text-sm univer-text-gray-900 dark:!univer-text-white",children:cn(D,l)}),u.jsx("div",{className:"univer-text-xs univer-text-gray-400",children:D.ranges.map(H=>qe.serializeRange(H)).join(",")})]}),u.jsx("div",{children:u.jsx(de,{rule:D.rule})}),u.jsx("div",{className:M.clsx("univer-absolute univer-right-1 univer-hidden univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded group-hover:univer-flex hover:univer-bg-gray-200",{"univer-flex univer-items-center univer-justify-center":N===A}),onClick:H=>{H.stopPropagation(),f(D),y([])},children:u.jsx(Ve,{})})]})},`${D.cfId}`))})})]})},vn=t=>{const[e,i]=C.useState(t.rule),[r,s]=C.useState(!!t.rule),o=()=>{s(!0)},l=()=>{s(!1),i(void 0)},v=c=>{i(c),s(!0)};return u.jsx("div",{className:"univer-flex univer-h-full univer-flex-col univer-justify-between univer-py-4",children:r?u.jsx(on,{onCancel:l,rule:e}):u.jsx(dn,{onClick:v,onCreate:o})})};var mn=Object.getOwnPropertyDescriptor,hn=(t,e,i,r)=>{for(var s=r>1?void 0:r?mn(e,i):e,o=t.length-1,l;o>=0;o--)(l=t[o])&&(s=l(s)||s);return s},ve=(t,e)=>(i,r)=>e(i,r,t);const je="sheet.conditional.formatting.panel";let Ce=class extends a.Disposable{constructor(e,i,r,s,o){super();ee(this,"_sidebarDisposable",null);this._univerInstanceService=e,this._injector=i,this._componentManager=r,this._sidebarService=s,this._localeService=o,this._initPanel(),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(a.UniverInstanceType.UNIVER_SHEET).subscribe(l=>{var v;l||(v=this._sidebarDisposable)==null||v.dispose()})),this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(l=>{l.id===je&&(l.visible||setTimeout(()=>{this._sidebarService.sidebarOptions$.next({visible:!1})}))}))}openPanel(e){const i={id:je,header:{title:this._localeService.t("sheet.cf.title")},children:{label:je,rule:e,key:a.generateRandomId(4)},onClose:()=>this._sidebarDisposable=null};this._sidebarDisposable=this._sidebarService.open(i)}_initPanel(){this.disposeWithMe(this._componentManager.register(je,vn))}};Ce=hn([ve(0,a.IUniverInstanceService),ve(1,a.Inject(a.Injector)),ve(2,a.Inject(P.ComponentManager)),ve(3,a.Inject(P.ISidebarService)),ve(4,a.Inject(a.LocaleService))],Ce);var z=(t=>(t[t.createRule=1]="createRule",t[t.viewRule=2]="viewRule",t[t.highlightCell=3]="highlightCell",t[t.rank=4]="rank",t[t.formula=5]="formula",t[t.colorScale=6]="colorScale",t[t.dataBar=7]="dataBar",t[t.icon=8]="icon",t[t.clearRangeRules=9]="clearRangeRules",t[t.clearWorkSheetRules=10]="clearWorkSheetRules",t))(z||{});const Fe={id:"sheet.operation.open.conditional.formatting.panel",type:a.CommandType.OPERATION,handler:(t,e)=>{var v;const i=t.get(Ce),r=t.get(U.SheetsSelectionsService),s=t.get(a.ICommandService),o=((v=r.getCurrentSelections())==null?void 0:v.map(c=>c.range))||[];switch(e.value){case 3:{i.openPanel({...n.createDefaultRule(),ranges:o});break}case 4:{const c={...n.createDefaultRule,ranges:o,rule:{type:n.CFRuleType.highlightCell,subType:n.CFSubRuleType.rank}};i.openPanel(c);break}case 5:{const c={...n.createDefaultRule,ranges:o,rule:{type:n.CFRuleType.highlightCell,subType:n.CFSubRuleType.formula,value:"="}};i.openPanel(c);break}case 6:{const c={...n.createDefaultRule,ranges:o,rule:{type:n.CFRuleType.colorScale,config:[]}};i.openPanel(c);break}case 7:{const c={...n.createDefaultRule,ranges:o,rule:{type:n.CFRuleType.dataBar,isShowValue:!0}};i.openPanel(c);break}case 8:{const c={...n.createDefaultRule,ranges:o,rule:{type:n.CFRuleType.iconSet,config:[],isShowValue:!0}};i.openPanel(c);break}case 2:{i.openPanel();break}case 1:{i.openPanel({...n.createDefaultRule(),ranges:o});break}case 9:{s.executeCommand(n.ClearRangeCfCommand.id,{ranges:o});break}case 10:{s.executeCommand(n.ClearWorksheetCfCommand.id);break}}return!0}};var gn=Object.getOwnPropertyDescriptor,pn=(t,e,i,r)=>{for(var s=r>1?void 0:r?gn(e,i):e,o=t.length-1,l;o>=0;o--)(l=t[o])&&(s=l(s)||s);return s},me=(t,e)=>(i,r)=>e(i,r,t);exports.ConditionalFormattingClearController=class extends a.Disposable{constructor(e,i,r,s,o){super(),this._injector=e,this._univerInstanceService=i,this._sheetInterceptorService=r,this._selectionManagerService=s,this._conditionalFormattingRuleModel=o,this._init()}_init(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{var o;const i=[],r=[],s={redos:i,undos:r};if([U.ClearSelectionFormatCommand.id,U.ClearSelectionAllCommand.id].includes(e.id)){const l=(o=this._selectionManagerService.getCurrentSelections())==null?void 0:o.map(S=>S.range);if(!l)return s;const v=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET),c=v.getActiveSheet();if(!c)return s;const h=v.getUnitId(),d=c.getSheetId(),m=this._conditionalFormattingRuleModel.getSubunitRules(h,d);if(!m||!m.length)return s;const{redos:g,undos:b}=ct(this._injector,m,l,h,d);i.push(...g),r.push(...b)}return s}})),this.disposeWithMe(this._sheetInterceptorService.interceptRanges({getMutations:({unitId:e,subUnitId:i,ranges:r})=>{const s=[],o=[],l={redos:s,undos:o};if(!r||!r.length)return l;const v=this._conditionalFormattingRuleModel.getSubunitRules(e,i);if(!v||!v.length)return l;const{redos:c,undos:h}=ct(this._injector,v,r,e,i);return s.push(...c),o.push(...h),l}}))}};exports.ConditionalFormattingClearController=pn([me(0,a.Inject(a.Injector)),me(1,a.Inject(a.IUniverInstanceService)),me(2,a.Inject(U.SheetInterceptorService)),me(3,a.Inject(U.SheetsSelectionsService)),me(4,a.Inject(n.ConditionalFormattingRuleModel))],exports.ConditionalFormattingClearController);function ct(t,e,i,r,s){const o=[],l=[];return e.filter(v=>i.some(c=>v.ranges.some(h=>a.Rectangle.getIntersects(h,c)))).forEach(v=>{const h=new U.RangeMergeUtil().add(...v.ranges).subtract(...i).merge();if(h.length){const d={id:n.SetConditionalRuleMutation.id,params:{unitId:r,subUnitId:s,rule:{...v,ranges:h}}},m=n.setConditionalRuleMutationUndoFactory(t,d.params);o.push(d),l.push(...m)}else{const d={id:n.DeleteConditionalRuleMutation.id,params:{unitId:r,subUnitId:s,cfId:v.cfId}},m=n.DeleteConditionalRuleMutationUndoFactory(t,d.params);o.push(d),l.push(...m)}}),{redos:o,undos:l}}var fn=Object.getOwnPropertyDescriptor,Cn=(t,e,i,r)=>{for(var s=r>1?void 0:r?fn(e,i):e,o=t.length-1,l;o>=0;o--)(l=t[o])&&(s=l(s)||s);return s},he=(t,e)=>(i,r)=>e(i,r,t);let ye=class extends a.Disposable{constructor(e,i,r,s,o){super();ee(this,"_copyInfo");this._sheetClipboardService=e,this._conditionalFormattingRuleModel=i,this._injector=r,this._conditionalFormattingViewModel=s,this._univerInstanceService=o,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:n.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onBeforeCopy:(e,i,r)=>this._collectConditionalRule(e,i,r),onPasteCells:(e,i,r,s)=>{const{copyType:o=B.COPY_TYPE.COPY,pasteType:l}=s,{range:v}=e||{},{range:c}=i;return this._generateConditionalFormattingMutations(c,{copyType:o,pasteType:l,copyRange:v})}}))}_collectConditionalRule(e,i,r){const s=new a.ObjectMatrix,o={};this._copyInfo={matrix:s,info:{unitId:e,subUnitId:i,cfMap:o}};const l=this._injector.invoke(d=>U.rangeToDiscreteRange(r,d,e,i));if(!l)return;const{rows:v,cols:c}=l,h=new Set;v.forEach((d,m)=>{c.forEach((g,b)=>{const S=this._conditionalFormattingViewModel.getCellCfs(e,i,d,g);S&&(S.forEach(y=>h.add(y.cfId)),s.setValue(m,b,S.map(y=>y.cfId)))})}),h.forEach(d=>{const m=this._conditionalFormattingRuleModel.getRule(e,i,d);m&&(o[d]=m.rule)})}_generateConditionalFormattingMutations(e,i){const r=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET),s=r.getActiveSheet(),o=r.getUnitId();if(!s)return{redos:[],undos:[]};const l=s.getSheetId();if(i.copyType===B.COPY_TYPE.CUT)return this._copyInfo=null,{redos:[],undos:[]};if(!this._copyInfo||!i.copyRange)return{redos:[],undos:[]};if(![B.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT,B.PREDEFINED_HOOK_NAME.DEFAULT_PASTE,B.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_BESIDES_BORDER].includes(i.pasteType))return{redos:[],undos:[]};const{ranges:[c,h],mapFunc:d}=B.virtualizeDiscreteRanges([i.copyRange,e]),m=B.getRepeatRange(c,h,!0),g={};a.Range.foreach(h,(p,x)=>{const{row:R,col:I}=d(p,x),V=this._conditionalFormattingViewModel.getCellCfs(o,l,R,I);V&&V.forEach(j=>{if(!g[j.cfId]){const O=new a.ObjectMatrix;g[j.cfId]=O;const k=this._conditionalFormattingRuleModel.getRule(o,l,j.cfId);k==null||k.ranges.forEach(f=>{a.Range.foreach(f,(F,L)=>{O.setValue(F,L,1)})})}g[j.cfId].realDeleteValue(R,I)})});const{matrix:b,info:S}=this._copyInfo,y=[];let _=this._conditionalFormattingRuleModel.createCfId(o,l);const T={},w=p=>{if(T[p])return T[p];const x=S==null?void 0:S.cfMap[p],R=[...this._conditionalFormattingRuleModel.getSubunitRules(o,l)||[],...y].find(I=>a.Tools.diffValue(I.rule,x));if(R)return T[p]=R,R;{const I={rule:x,cfId:_,ranges:[],stopIfTrue:!1};return T[p]=I,y.push(I),_=`${Number(_)+1}`,I}};m.forEach(p=>{b&&b.forValue((x,R,I)=>{const V=a.Rectangle.getPositionRange({startRow:x,endRow:x,startColumn:R,endColumn:R},p.startRange),{row:j,col:O}=d(V.startRow,V.startColumn);I.forEach(k=>{if(!g[k]){const f=w(k),F=new a.ObjectMatrix;g[k]=F,f.ranges.forEach(L=>{a.Range.foreach(L,(q,J)=>{F.setValue(q,J,1)})})}g[k].setValue(j,O,1)})})});const E=[],N=[];for(const p in g){const x=g[p],R=U.findAllRectangle(U.createTopMatrixFromMatrix(x));if(!R.length){const I={unitId:o,subUnitId:l,cfId:p};E.push({id:n.DeleteConditionalRuleMutation.id,params:I}),N.push(...n.DeleteConditionalRuleMutationUndoFactory(this._injector,I))}if(y.some(I=>I.cfId===p)){const I=w(p),V={unitId:o,subUnitId:l,rule:{...I,ranges:R}};E.push({id:n.AddConditionalRuleMutation.id,params:V}),N.push(n.AddConditionalRuleMutationUndoFactory(this._injector,V))}else{const I=this._conditionalFormattingRuleModel.getRule(o,l,p);if(!I)continue;const V={unitId:o,subUnitId:l,rule:{...I,ranges:R}};E.push({id:n.SetConditionalRuleMutation.id,params:V}),N.push(...n.setConditionalRuleMutationUndoFactory(this._injector,V))}}return{redos:E,undos:N}}};ye=Cn([he(0,a.Inject(B.ISheetClipboardService)),he(1,a.Inject(n.ConditionalFormattingRuleModel)),he(2,a.Inject(a.Injector)),he(3,a.Inject(n.ConditionalFormattingViewModel)),he(4,a.Inject(a.IUniverInstanceService))],ye);var yn=Object.getOwnPropertyDescriptor,bn=(t,e,i,r)=>{for(var s=r>1?void 0:r?yn(e,i):e,o=t.length-1,l;o>=0;o--)(l=t[o])&&(s=l(s)||s);return s},$e=(t,e)=>(i,r)=>e(i,r,t);let be=class extends a.Disposable{constructor(t,e,i){super(),this._localeService=t,this._commandService=e,this._sheetPermissionCheckController=i,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(t=>{t.id===n.AddCfCommand.id&&(this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[U.WorkbookEditablePermission],rangeTypes:[U.RangeProtectionPermissionEditPoint],worksheetTypes:[U.WorksheetEditPermission,U.WorksheetSetCellStylePermission]},t.params.rule.ranges)||this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.setStyleErr")))}))}};be=bn([$e(0,a.Inject(a.LocaleService)),$e(1,a.ICommandService),$e(2,a.Inject(U.SheetPermissionCheckController))],be);var In=Object.getOwnPropertyDescriptor,Sn=(t,e,i,r)=>{for(var s=r>1?void 0:r?In(e,i):e,o=t.length-1,l;o>=0;o--)(l=t[o])&&(s=l(s)||s);return s},Me=(t,e)=>(i,r)=>e(i,r,t);let Ie=class extends a.Disposable{constructor(t,e,i,r){super(),this._conditionalFormattingRuleModel=t,this._univerInstanceService=e,this._injector=i,this._refRangeService=r,this._initRefRange()}_initRefRange(){const t=new Map,e=(r,s,o)=>`${r}_${s}_${o}`,i=(r,s,o)=>{const l=c=>{const h=[...o.ranges],d=h.map(g=>U.handleDefaultRangeChangeWithEffectRefCommands(g,c)).filter(g=>!!g);if(n.isRangesEqual(d,h))return{redos:[],undos:[]};if(d.length){const g={unitId:r,subUnitId:s,rule:{...o,ranges:d}},b=[{id:n.SetConditionalRuleMutation.id,params:g}],S=n.setConditionalRuleMutationUndoFactory(this._injector,g);return{redos:b,undos:S}}else{const g={unitId:r,subUnitId:s,cfId:o.cfId},b=[{id:n.DeleteConditionalRuleMutation.id,params:g}],S=n.DeleteConditionalRuleMutationUndoFactory(this._injector,g);return{redos:b,undos:S}}},v=[];o.ranges.forEach(c=>{const h=this._refRangeService.registerRefRange(c,l);v.push(()=>h.dispose())}),t.set(e(r,s,o.cfId),()=>v.forEach(c=>c()))};this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe(r=>{const{unitId:s,subUnitId:o,rule:l}=r,v=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET),c=v.getActiveSheet();if(!(r.unitId!==v.getUnitId()||r.subUnitId!==(c==null?void 0:c.getSheetId())))switch(r.type){case"add":{i(r.unitId,r.subUnitId,r.rule);break}case"delete":{const h=t.get(e(s,o,l.cfId));h&&h();break}case"set":{const h=t.get(e(s,o,l.cfId));h&&h(),i(r.unitId,r.subUnitId,r.rule)}}})),this.disposeWithMe(a.toDisposable(()=>{t.forEach(r=>{r()}),t.clear()}))}};Ie=Sn([Me(0,a.Inject(n.ConditionalFormattingRuleModel)),Me(1,a.Inject(a.IUniverInstanceService)),Me(2,a.Inject(a.Injector)),Me(3,a.Inject(U.RefRangeService))],Ie);var xn=Object.getOwnPropertyDescriptor,Tn=(t,e,i,r)=>{for(var s=r>1?void 0:r?xn(e,i):e,o=t.length-1,l;o>=0;o--)(l=t[o])&&(s=l(s)||s);return s},le=(t,e)=>(i,r)=>e(i,r,t);let Se=class extends a.Disposable{constructor(e,i,r,s,o,l){super();ee(this,"_ruleChangeCacheMap",new Map);this._sheetInterceptorService=e,this._conditionalFormattingService=i,this._univerInstanceService=r,this._renderManagerService=s,this._conditionalFormattingViewModel=o,this._conditionalFormattingRuleModel=l,this._initViewModelInterceptor(),this._initSkeleton(),this.disposeWithMe(()=>{this._ruleChangeCacheMap.clear()})}_markDirtySkeleton(){var i,r,s;const e=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET).getUnitId();(i=this._renderManagerService.getRenderById(e))==null||i.with(B.SheetSkeletonManagerService).reCalculate(),(s=(r=this._renderManagerService.getRenderById(e))==null?void 0:r.mainComponent)==null||s.makeDirty()}_initSkeleton(){this.disposeWithMe(X.merge(this._conditionalFormattingRuleModel.$ruleChange,this._conditionalFormattingViewModel.markDirty$).pipe(fe.bufferTime(16),fe.filter(e=>!!e.length),fe.filter(e=>{const i=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!i)return!1;const r=i.getActiveSheet();return r?e.filter(s=>s.unitId===i.getUnitId()&&s.subUnitId===r.getSheetId()).length>0:!1})).subscribe(()=>this._markDirtySkeleton()))}_initViewModelInterceptor(){this.disposeWithMe(this._sheetInterceptorService.intercept(U.INTERCEPTOR_POINT.CELL_CONTENT,{effect:a.InterceptorEffectEnum.Style,handler:(e,i,r)=>{const s=this._conditionalFormattingService.composeStyle(i.unitId,i.subUnitId,i.row,i.col);if(!s)return r(e);const o=i.workbook.getStyles(),l=(typeof(e==null?void 0:e.s)=="string"?o.get(e==null?void 0:e.s):e==null?void 0:e.s)||{},v=e===i.rawData?{...i.rawData}:e;if(s.style){const c={...l,...s.style};Object.assign(v,{s:c})}return v.fontRenderExtension||(v.fontRenderExtension={},s.isShowValue!==void 0&&(v.fontRenderExtension.isSkip=!s.isShowValue)),s.dataBar&&(v.dataBar=s.dataBar),s.iconSet&&(v.iconSet=s.iconSet,v.fontRenderExtension.leftOffset=n.DEFAULT_PADDING+n.DEFAULT_WIDTH),r(v)},priority:10}))}};Se=Tn([le(0,a.Inject(U.SheetInterceptorService)),le(1,a.Inject(n.ConditionalFormattingService)),le(2,a.Inject(a.IUniverInstanceService)),le(3,a.Inject(ht.IRenderManagerService)),le(4,a.Inject(n.ConditionalFormattingViewModel)),le(5,a.Inject(n.ConditionalFormattingRuleModel))],Se);const Rt="sheets-conditional-formatting-ui.config",Oe={};var Rn=Object.defineProperty,Fn=Object.getOwnPropertyDescriptor,_n=(t,e,i)=>e in t?Rn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,wn=(t,e,i,r)=>{for(var s=r>1?void 0:r?Fn(e,i):e,o=t.length-1,l;o>=0;o--)(l=t[o])&&(s=l(s)||s);return s},He=(t,e)=>(i,r)=>e(i,r,t),Ft=(t,e,i)=>_n(t,typeof e!="symbol"?e+"":e,i);exports.UniverSheetsConditionalFormattingMobileUIPlugin=class extends a.Plugin{constructor(e=Oe,i,r,s){super(),this._config=e,this._injector=i,this._commandService=r,this._configService=s;const{menu:o,...l}=a.merge({},Oe,this._config);o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(Rt,l),this._initCommand(),this._injector.add([Se]),this._injector.add([Ie]),this._injector.add([ye]),this._injector.add([be]),this._injector.add([ce])}_initCommand(){[Ge,Ze,ze,Ye,Ke,Xe,Je,Qe,et,Fe].forEach(e=>{this._commandService.registerCommand(e)})}};Ft(exports.UniverSheetsConditionalFormattingMobileUIPlugin,"pluginName",`${n.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_MOBILE_UI_PLUGIN`);Ft(exports.UniverSheetsConditionalFormattingMobileUIPlugin,"type",a.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsConditionalFormattingMobileUIPlugin=wn([a.DependentOn(n.UniverSheetsConditionalFormattingPlugin),He(1,a.Inject(a.Injector)),He(2,a.Inject(a.ICommandService)),He(3,a.IConfigService)],exports.UniverSheetsConditionalFormattingMobileUIPlugin);var Nn=Object.getOwnPropertyDescriptor,En=(t,e,i,r)=>{for(var s=r>1?void 0:r?Nn(e,i):e,o=t.length-1,l;o>=0;o--)(l=t[o])&&(s=l(s)||s);return s},ge=(t,e)=>(i,r)=>e(i,r,t);let Ue=class extends a.Disposable{constructor(t,e,i,r,s){super(),this._injector=t,this._univerInstanceService=e,this._autoFillService=i,this._conditionalFormattingRuleModel=r,this._conditionalFormattingViewModel=s,this._initAutoFill()}_initAutoFill(){const t=()=>({redos:[],undos:[]}),e=(s,o,l,v,c)=>{var b;const h=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET).getUnitId(),d=(b=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:b.getSheetId();if(!h||!d)return;const m={startRow:s.row,startColumn:s.col,endColumn:s.col,endRow:s.row},g={startRow:o.row,startColumn:o.col,endColumn:o.col,endRow:o.row};a.Range.foreach(l,(S,y)=>{const _=a.Rectangle.getPositionRange({startRow:S,startColumn:y,endColumn:y,endRow:S},m),T=a.Rectangle.getPositionRange({startRow:S,startColumn:y,endColumn:y,endRow:S},g),{row:w,col:E}=c(_.startRow,_.startColumn),N=this._conditionalFormattingViewModel.getCellCfs(h,d,w,E),{row:p,col:x}=c(T.startRow,T.startColumn),R=this._conditionalFormattingViewModel.getCellCfs(h,d,p,x);R&&R.forEach(I=>{let V=v.get(I.cfId);if(!v.get(I.cfId)){const j=this._conditionalFormattingRuleModel.getRule(h,d,I.cfId);if(!j)return;V=new a.ObjectMatrix,j.ranges.forEach(O=>{a.Range.foreach(O,(k,f)=>{V.setValue(k,f,1)})}),v.set(I.cfId,V)}V.realDeleteValue(p,x)}),N&&N.forEach(I=>{let V=v.get(I.cfId);if(!v.get(I.cfId)){const j=this._conditionalFormattingRuleModel.getRule(h,d,I.cfId);if(!j)return;V=new a.ObjectMatrix,j.ranges.forEach(O=>{a.Range.foreach(O,(k,f)=>{V.setValue(k,f,1)})}),v.set(I.cfId,V)}V.setValue(p,x,1)})})},i=(s,o)=>{var T,w,E;const l=(T=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:T.getUnitId(),v=(E=(w=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:w.getActiveSheet())==null?void 0:E.getSheetId(),c=new Map,h=[],d=[];if(!l||!v)return t();const m=B.virtualizeDiscreteRanges([s,o]),[g,b]=m.ranges,{mapFunc:S}=m,y={row:g.startRow,col:g.startColumn};return B.getAutoFillRepeatRange(g,b).forEach(N=>{e(y,N.repeatStartCell,N.relativeRange,c,S)}),c.forEach((N,p)=>{const x=this._conditionalFormattingRuleModel.getRule(l,v,p);if(!x)return;const R=U.findAllRectangle(U.createTopMatrixFromMatrix(N));if(R.length){const I={unitId:l,subUnitId:v,rule:{...x,ranges:R}};h.push({id:n.SetConditionalRuleMutation.id,params:I}),d.push(...n.setConditionalRuleMutationUndoFactory(this._injector,I))}else{const I={unitId:l,subUnitId:v,cfId:x.cfId};h.push({id:n.DeleteConditionalRuleMutation.id,params:I}),d.push(...n.DeleteConditionalRuleMutationUndoFactory(this._injector,I))}}),{undos:d,redos:h}},r={id:n.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onFillData:(s,o,l)=>{if(l===B.APPLY_TYPE.COPY||l===B.APPLY_TYPE.ONLY_FORMAT||l===B.APPLY_TYPE.SERIES){const{source:v,target:c}=s;return i(v,c)}return t()}};this.disposeWithMe(this._autoFillService.addHook(r))}};Ue=En([ge(0,a.Inject(a.Injector)),ge(1,a.Inject(a.IUniverInstanceService)),ge(2,a.Inject(B.IAutoFillService)),ge(3,a.Inject(n.ConditionalFormattingRuleModel)),ge(4,a.Inject(n.ConditionalFormattingViewModel))],Ue);var jn=Object.getOwnPropertyDescriptor,Mn=(t,e,i,r)=>{for(var s=r>1?void 0:r?jn(e,i):e,o=t.length-1,l;o>=0;o--)(l=t[o])&&(s=l(s)||s);return s},dt=(t,e)=>(i,r)=>e(i,r,t);let ke=class extends a.Disposable{constructor(t,e){super(),this._sheetInterceptorService=t,this._conditionalFormattingService=e,this._initInterceptorEditorEnd()}_initInterceptorEditorEnd(){this.disposeWithMe(a.toDisposable(this._sheetInterceptorService.writeCellInterceptor.intercept(U.AFTER_CELL_EDIT,{handler:(t,e,i)=>{var l,v,c;t||i(t);const r=this._conditionalFormattingService.composeStyle(e.unitId,e.subUnitId,e.row,e.col),s=(l=r==null?void 0:r.style)!=null?l:{},o=Object.keys(s);if(t!=null&&t.p)return(c=(v=t.p.body)==null?void 0:v.textRuns)==null||c.forEach(h=>{h.ts&&o.forEach(d=>{var m;(m=h.ts)==null||delete m[d]})}),i(t);{const h={...(typeof(t==null?void 0:t.s)=="string"?e.workbook.getStyles().get(t.s):t==null?void 0:t.s)||{}};o.forEach(m=>{delete h[m]});const d={...t,s:{...h}};return i(d)}}})))}};ke=Mn([dt(0,a.Inject(U.SheetInterceptorService)),dt(1,a.Inject(n.ConditionalFormattingService))],ke);const vt=[U.SetWorksheetActiveOperation.id,n.AddConditionalRuleMutation.id,n.SetConditionalRuleMutation.id,n.DeleteConditionalRuleMutation.id,n.MoveConditionalRuleMutation.id],pe=[{label:{name:"sheet.cf.ruleType.highlightCell",selectable:!1},value:z.highlightCell},{label:{name:"sheet.cf.panel.rankAndAverage",selectable:!1},value:z.rank},{label:{name:"sheet.cf.ruleType.formula",selectable:!1},value:z.formula},{label:{name:"sheet.cf.ruleType.colorScale",selectable:!1},value:z.colorScale},{label:{name:"sheet.cf.ruleType.dataBar",selectable:!1},value:z.dataBar},{label:{name:"sheet.cf.ruleType.iconSet",selectable:!1},value:z.icon},{label:{name:"sheet.cf.menu.manageConditionalFormatting",selectable:!1},value:z.viewRule},{label:{name:"sheet.cf.menu.createConditionalFormatting",selectable:!1},value:z.createRule},{label:{name:"sheet.cf.menu.clearRangeRules",selectable:!1},value:z.clearRangeRules,disabled:!1},{label:{name:"sheet.cf.menu.clearWorkSheetRules",selectable:!1},value:z.clearWorkSheetRules}],Vn=t=>{const e=t.get(U.SheetsSelectionsService),i=t.get(a.ICommandService),r=t.get(a.IUniverInstanceService),s=t.get(n.ConditionalFormattingRuleModel),o=new X.Observable(c=>X.merge(e.selectionMoveEnd$,e.selectionSet$,new X.Observable(h=>{const d=i.onCommandExecuted(m=>{var y;const{id:g,params:b}=m,S=(y=r.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:y.getUnitId();vt.includes(g)&&b.unitId===S&&h.next(null)});return()=>d.dispose()})).pipe(fe.debounceTime(16)).subscribe(()=>{var y;const h=((y=e.getCurrentSelections())==null?void 0:y.map(_=>_.range))||[],d=r.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!d)return;const m=d.getActiveSheet();if(!m)return;const S=(s.getSubunitRules(d.getUnitId(),m.getSheetId())||[]).filter(_=>_.ranges.some(T=>h.some(w=>a.Rectangle.intersects(w,T)))).map(_=>_.ranges).every(_=>U.checkRangesEditablePermission(t,d.getUnitId(),m.getSheetId(),_));c.next(S)})),l=new X.Observable(c=>new X.Observable(h=>{const d=i.onCommandExecuted(m=>{var y;const{id:g,params:b}=m,S=(y=r.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:y.getUnitId();vt.includes(g)&&b.unitId===S&&h.next(null)});return()=>d.dispose()}).pipe(fe.debounceTime(16)).subscribe(()=>{const h=r.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);if(!h)return;const d=h.getActiveSheet();if(!d)return;const m=s.getSubunitRules(h.getUnitId(),d.getSheetId())||[];if(!m.length)return c.next(!1),!1;const g=m.map(b=>b.ranges).every(b=>U.checkRangesEditablePermission(t,h.getUnitId(),d.getSheetId(),b));c.next(g)})),v=new X.Observable(c=>{o.subscribe(h=>{const d=pe.find(m=>m.value===z.clearRangeRules);d&&(d.disabled=!h,c.next(pe))}),l.subscribe(h=>{const d=pe.find(m=>m.value===z.clearWorkSheetRules);d&&(d.disabled=!h,c.next(pe))}),c.next(pe)});return{id:Fe.id,type:P.MenuItemType.SELECTOR,icon:"ConditionsDoubleIcon",tooltip:"sheet.cf.title",selections:v,hidden$:P.getMenuHiddenObservable(t,a.UniverInstanceType.UNIVER_SHEET),disabled$:B.getCurrentRangeDisable$(t,{workbookTypes:[U.WorkbookEditablePermission],worksheetTypes:[U.WorksheetSetCellStylePermission,U.WorksheetEditPermission],rangeTypes:[U.RangeProtectionPermissionEditPoint]})}},On={[P.RibbonDataGroup.RULES]:{[Fe.id]:{order:1,menuItemFactory:Vn}}};var Un=Object.getOwnPropertyDescriptor,kn=(t,e,i,r)=>{for(var s=r>1?void 0:r?Un(e,i):e,o=t.length-1,l;o>=0;o--)(l=t[o])&&(s=l(s)||s);return s},mt=(t,e)=>(i,r)=>e(i,r,t);let Pe=class extends a.Disposable{constructor(e,i){super();ee(this,"_sidebarDisposable",null);this._injector=e,this._menuManagerService=i,this._menuManagerService.mergeMenu(On)}};Pe=kn([mt(0,a.Inject(a.Injector)),mt(1,P.IMenuManagerService)],Pe);var Pn=Object.getOwnPropertyDescriptor,Dn=(t,e,i,r)=>{for(var s=r>1?void 0:r?Pn(e,i):e,o=t.length-1,l;o>=0;o--)(l=t[o])&&(s=l(s)||s);return s},ue=(t,e)=>(i,r)=>e(i,r,t);const Ln=(t,e)=>{const i=d=>d.endRow-d.startRow+1,r=d=>d.endColumn-d.startColumn+1,s=i(e)%i(t),o=r(e)%r(t),l=Math.floor(i(e)/i(t)),v=Math.floor(r(e)/r(t)),c=[],h={startRow:0,endRow:i(t)-1,startColumn:0,endColumn:r(t)-1};if(i(e)===1&&r(e)===1){const d={startRow:e.startRow,endRow:e.startRow,startColumn:e.startColumn,endColumn:e.startColumn};return c.push({repeatRelativeRange:h,startRange:d}),c}for(let d=0;d<l+(s?.1:0);d++)for(let m=0;m<v+(o?.1:0);m++){const g=i(t)*d,b=r(t)*m,S={startRow:g+e.startRow,endRow:g+e.startRow,startColumn:b+e.startColumn,endColumn:b+e.startColumn};let y=h;d===l&&s&&(y={...y},y.endRow=y.endRow-(i(t)-s)),m===v&&o&&(y={...y},y.endColumn=y.endColumn-(r(t)-o)),c.push({repeatRelativeRange:y,startRange:S})}return c};let De=class extends a.Disposable{constructor(e,i,r,s,o,l){super();ee(this,"_painterConfig",null);this._injector=e,this._univerInstanceService=i,this._formatPainterService=r,this._sheetsSelectionsService=s,this._conditionalFormattingRuleModel=o,this._conditionalFormattingViewModel=l,this._initFormattingPainter()}_initFormattingPainter(){const e=()=>({redos:[],undos:[]}),i=(o,l,v,c,h)=>{const{unitId:d,subUnitId:m}=this._painterConfig,{targetUnitId:g,targetSubUnitId:b}=h,S={startRow:o.row,startColumn:o.col,endColumn:o.col,endRow:o.row},y={startRow:l.row,startColumn:l.col,endColumn:l.col,endRow:l.row};a.Range.foreach(v,(_,T)=>{const w=a.Rectangle.getPositionRange({startRow:_,startColumn:T,endColumn:T,endRow:_},S),E=a.Rectangle.getPositionRange({startRow:_,startColumn:T,endColumn:T,endRow:_},y),N=this._conditionalFormattingViewModel.getCellCfs(d,m,w.startRow,w.startColumn),p=this._conditionalFormattingViewModel.getCellCfs(g,b,E.startRow,E.startColumn);p&&p.forEach(x=>{let R=c.get(x.cfId);if(!c.get(x.cfId)){const I=this._conditionalFormattingRuleModel.getRule(g,b,x.cfId);if(!I)return;R=new a.ObjectMatrix,I.ranges.forEach(V=>{a.Range.foreach(V,(j,O)=>{R.setValue(j,O,1)})}),c.set(x.cfId,R)}R.realDeleteValue(E.startRow,E.startColumn)}),N&&N.forEach(x=>{const R=c.get(x.cfId);R&&R.setValue(E.startRow,E.startColumn,1)})})},r=(o,l,v)=>{var w;const{range:c,unitId:h,subUnitId:d}=this._painterConfig,m=o!==h||d!==l,g=new Map,b=[],S=[];if(!o||!l||!h||!d)return e();const y=(w=this._conditionalFormattingRuleModel.getSubunitRules(h,d))!=null?w:[];y==null||y.forEach(E=>{const{ranges:N,cfId:p}=E;if(N.some(x=>a.Rectangle.intersects(c,x))){const x=new a.ObjectMatrix;m||N.forEach(R=>{a.Range.foreach(R,(I,V)=>{x.setValue(I,V,1)})}),g.set(p,x)}});const _={row:c.startRow,col:c.startColumn};return Ln(c,v).forEach(E=>{i(_,{row:E.startRange.startRow,col:E.startRange.startColumn},E.repeatRelativeRange,g,{targetUnitId:o,targetSubUnitId:l})}),g.forEach((E,N)=>{if(m){const p=this._conditionalFormattingRuleModel.getRule(o,l,N),x=U.findAllRectangle(U.createTopMatrixFromMatrix(E));if(p)if(x.length){const R={unitId:o,subUnitId:l,rule:{...p,ranges:x}};b.push({id:n.SetConditionalRuleMutation.id,params:R}),S.push(...n.setConditionalRuleMutationUndoFactory(this._injector,R))}else{const R={unitId:o,subUnitId:l,cfId:p.cfId};b.push({id:n.DeleteConditionalRuleMutation.id,params:R}),S.push(...n.DeleteConditionalRuleMutationUndoFactory(this._injector,R))}else if(x.length){const R=this._conditionalFormattingRuleModel.getRule(h,d,N);if(R){const I={unitId:o,subUnitId:l,rule:{...a.Tools.deepClone(R),cfId:this._conditionalFormattingRuleModel.createCfId(o,l),ranges:x}};b.push({id:n.AddConditionalRuleMutation.id,params:I}),S.push(n.AddConditionalRuleMutationUndoFactory(this._injector,I))}}}else{const p=this._conditionalFormattingRuleModel.getRule(h,d,N);if(!p)return;const x=U.findAllRectangle(U.createTopMatrixFromMatrix(E));if(x.length){const R={unitId:h,subUnitId:d,rule:{...p,ranges:x}};b.push({id:n.SetConditionalRuleMutation.id,params:R}),S.push(...n.setConditionalRuleMutationUndoFactory(this._injector,R))}else{const R={unitId:h,subUnitId:d,cfId:p.cfId};b.push({id:n.DeleteConditionalRuleMutation.id,params:R}),S.push(...n.DeleteConditionalRuleMutationUndoFactory(this._injector,R))}}}),{undos:S,redos:b}},s={id:n.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onStatusChange:o=>{var l,v,c;switch(o){case B.FormatPainterStatus.INFINITE:case B.FormatPainterStatus.ONCE:{const h=(l=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:l.getUnitId(),d=(c=(v=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET))==null?void 0:v.getActiveSheet())==null?void 0:c.getSheetId(),m=this._sheetsSelectionsService.getCurrentLastSelection(),g=m==null?void 0:m.range;h&&d&&g&&(this._painterConfig={unitId:h,subUnitId:d,range:g});break}case B.FormatPainterStatus.OFF:{this._painterConfig=null;break}}},onApply:(o,l,v)=>this._painterConfig?r(o,l,v):{redos:[],undos:[]}};this._formatPainterService.addHook(s)}};De=Dn([ue(0,a.Inject(a.Injector)),ue(1,a.Inject(a.IUniverInstanceService)),ue(2,a.Inject(B.IFormatPainterService)),ue(3,a.Inject(U.SheetsSelectionsService)),ue(4,a.Inject(n.ConditionalFormattingRuleModel)),ue(5,a.Inject(n.ConditionalFormattingViewModel))],De);var An=Object.getOwnPropertyDescriptor,$n=(t,e,i,r)=>{for(var s=r>1?void 0:r?An(e,i):e,o=t.length-1,l;o>=0;o--)(l=t[o])&&(s=l(s)||s);return s},Be=(t,e)=>(i,r)=>e(i,r,t);let Le=class extends a.Disposable{constructor(t,e,i){super(),this._conditionalFormattingViewModel=t,this._univerInstanceService=e,this._renderManagerService=i,this._init()}_init(){const t=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET),e=i=>{const r=i.getUnitId(),s=this._renderManagerService.getRenderById(r);if(!s)return;const o=s.with(B.SheetSkeletonManagerService);this.disposeWithMe(o.currentSkeleton$.subscribe(l=>{if(l){const v=l.skeleton.rowColumnSegment,c=v.endColumn-v.startColumn+1,d=(v.endRow-v.startRow+1)*c*9,m=Math.max(n.CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH,d);this._conditionalFormattingViewModel.setCacheLength(m)}}))};t&&e(t),this._univerInstanceService.getCurrentTypeOfUnit$(a.UniverInstanceType.UNIVER_SHEET).subscribe(i=>{i&&e(i)})}};Le=$n([Be(0,a.Inject(n.ConditionalFormattingViewModel)),Be(1,a.IUniverInstanceService),Be(2,ht.IRenderManagerService)],Le);var Hn=Object.defineProperty,Bn=Object.getOwnPropertyDescriptor,Wn=(t,e,i)=>e in t?Hn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,qn=(t,e,i,r)=>{for(var s=r>1?void 0:r?Bn(e,i):e,o=t.length-1,l;o>=0;o--)(l=t[o])&&(s=l(s)||s);return s},We=(t,e)=>(i,r)=>e(i,r,t),_t=(t,e,i)=>Wn(t,typeof e!="symbol"?e+"":e,i);exports.UniverSheetsConditionalFormattingUIPlugin=class extends a.Plugin{constructor(e=Oe,i,r,s){super(),this._config=e,this._injector=i,this._commandService=r,this._configService=s;const{menu:o,...l}=a.merge({},Oe,this._config);o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(Rt,l),this._initCommand()}onStarting(){a.registerDependencies(this._injector,[[Se],[Ie],[ye],[Ue],[be],[Ce],[Pe],[ce],[ke],[exports.ConditionalFormattingClearController],[De],[Le]]),a.touchDependencies(this._injector,[[Se]])}onReady(){a.touchDependencies(this._injector,[[Pe],[Ce]])}onRendered(){a.touchDependencies(this._injector,[[Ue],[exports.ConditionalFormattingClearController],[ye],[ke],[ce],[De],[be],[Ie],[Le]])}_initCommand(){[Ge,Ze,ze,Ye,Ke,Xe,Je,Qe,et,Fe].forEach(e=>{this._commandService.registerCommand(e)})}};_t(exports.UniverSheetsConditionalFormattingUIPlugin,"pluginName",`${n.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_UI_PLUGIN`);_t(exports.UniverSheetsConditionalFormattingUIPlugin,"type",a.UniverInstanceType.UNIVER_SHEET);exports.UniverSheetsConditionalFormattingUIPlugin=qn([a.DependentOn(n.UniverSheetsConditionalFormattingPlugin),We(1,a.Inject(a.Injector)),We(2,a.Inject(a.ICommandService)),We(3,a.IConfigService)],exports.UniverSheetsConditionalFormattingUIPlugin);exports.AddAverageCfCommand=Ge;exports.AddColorScaleConditionalRuleCommand=Ze;exports.AddDataBarConditionalRuleCommand=ze;exports.AddDuplicateValuesCfCommand=Ye;exports.AddNumberCfCommand=Ke;exports.AddRankCfCommand=Xe;exports.AddTextCfCommand=Je;exports.AddTimePeriodCfCommand=Qe;exports.AddUniqueValuesCfCommand=et;exports.OpenConditionalFormattingOperator=Fe;
|
package/lib/es/index.js
CHANGED
|
@@ -2466,7 +2466,7 @@ const ji = (t) => {
|
|
|
2466
2466
|
/* @__PURE__ */ c(
|
|
2467
2467
|
"div",
|
|
2468
2468
|
{
|
|
2469
|
-
className: Y("univer-absolute univer-right-1 univer-hidden univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded hover:univer-bg-gray-200
|
|
2469
|
+
className: Y("univer-absolute univer-right-1 univer-hidden univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded group-hover:univer-flex hover:univer-bg-gray-200", {
|
|
2470
2470
|
"univer-flex univer-items-center univer-justify-center": T === B
|
|
2471
2471
|
}),
|
|
2472
2472
|
onClick: (G) => {
|
package/lib/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.univer-pointer-events-none{pointer-events:none}.univer-absolute{position:absolute}.univer-relative{position:relative}.univer-bottom-\[-13px\]{bottom:-13px}.univer-left-0{left:0}.univer-right-1{right:.25rem}.univer-z-\[999\]{z-index:999}.univer-my-2\.5{margin-top:.625rem;margin-bottom:.625rem}.univer-mb-1{margin-bottom:.25rem}.univer-mb-2{margin-bottom:.5rem}.univer-mb-2\.5{margin-bottom:.625rem}.univer-mb-3{margin-bottom:.75rem}.univer-ml-1{margin-left:.25rem}.univer-ml-2{margin-left:.5rem}.univer-ml-3{margin-left:.75rem}.univer-ml-6{margin-left:1.5rem}.univer-mr-2{margin-right:.5rem}.univer-mt-0{margin-top:0}.univer-mt-1{margin-top:.25rem}.univer-mt-3{margin-top:.75rem}.univer-mt-4{margin-top:1rem}.univer-mt-5{margin-top:1.25rem}.univer-mt-6{margin-top:1.5rem}.univer-box-border{box-sizing:border-box}.univer-flex{display:flex}.univer-grid{display:grid}.univer-hidden{display:none}.univer-size-4{width:1rem;height:1rem}.univer-size-5{width:1.25rem;height:1.25rem}.univer-size-6{width:1.5rem;height:1.5rem}.univer-h-5{height:1.25rem}.univer-h-8{height:2rem}.univer-h-full{height:100%}.univer-w-1\/2{width:50%}.univer-w-36{width:9rem}.univer-w-64{width:16rem}.univer-w-80{width:20rem}.univer-w-\[45\%\]{width:45%}.univer-w-full{width:100%}.univer-min-w-0{min-width:0px}.univer-min-w-\[72px\]{min-width:72px}.univer-max-w-full{max-width:100%}.univer-flex-shrink{flex-shrink:1}.univer-flex-shrink-0{flex-shrink:0}.univer-cursor-grab{cursor:grab}.univer-cursor-pointer{cursor:pointer}.univer-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.univer-flex-col{flex-direction:column}.univer-flex-wrap{flex-wrap:wrap}.univer-items-center{align-items:center}.univer-justify-end{justify-content:flex-end}.univer-justify-center{justify-content:center}.univer-justify-between{justify-content:space-between}.univer-gap-2{gap:.5rem}.univer-gap-4{gap:1rem}.univer-overflow-hidden{overflow:hidden}.univer-rounded{border-radius:.25rem}.univer-rounded-lg{border-radius:.5rem}.univer-rounded-md{border-radius:.375rem}.univer-border{border-width:1px}.univer-border-solid{border-style:solid}.univer-border-red-500{border-color:var(--univer-red-500)}.\!univer-bg-gray-700{background-color:var(--univer-gray-700)!important}.univer-bg-gray-100{background-color:var(--univer-gray-100)}.univer-bg-white{background-color:var(--univer-white)}.univer-fill-primary-600{fill:var(--univer-primary-600)}.univer-p-1{padding:.25rem}.univer-p-4{padding:1rem}.univer-px-1{padding-left:.25rem;padding-right:.25rem}.univer-px-4{padding-left:1rem;padding-right:1rem}.univer-py-2{padding-top:.5rem;padding-bottom:.5rem}.univer-py-4{padding-top:1rem;padding-bottom:1rem}.univer-pl-1{padding-left:.25rem}.univer-pl-5{padding-left:1.25rem}.univer-pr-8{padding-right:2rem}.univer-pt-2{padding-top:.5rem}.univer-text-\[10px\]{font-size:10px}.univer-text-sm{font-size:.875rem;line-height:1.25rem}.univer-text-xs{font-size:.75rem;line-height:1rem}.univer-font-bold{font-weight:700}.univer-font-medium{font-weight:500}.univer-italic{font-style:italic}.univer-text-gray-300{color:var(--univer-gray-300)}.univer-text-gray-400{color:var(--univer-gray-400)}.univer-text-gray-600{color:var(--univer-gray-600)}.univer-text-gray-900{color:var(--univer-gray-900)}.univer-text-red-500{color:var(--univer-red-500)}.univer-transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.univer-transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.hover\:univer-border-primary-600:hover{border-color:var(--univer-primary-600)}.hover\:univer-bg-gray-100:hover{background-color:var(--univer-gray-100)}.hover\:univer-bg-gray-200:hover{background-color:var(--univer-gray-200)}.
|
|
1
|
+
.univer-pointer-events-none{pointer-events:none}.univer-absolute{position:absolute}.univer-relative{position:relative}.univer-bottom-\[-13px\]{bottom:-13px}.univer-left-0{left:0}.univer-right-1{right:.25rem}.univer-z-\[999\]{z-index:999}.univer-my-2\.5{margin-top:.625rem;margin-bottom:.625rem}.univer-mb-1{margin-bottom:.25rem}.univer-mb-2{margin-bottom:.5rem}.univer-mb-2\.5{margin-bottom:.625rem}.univer-mb-3{margin-bottom:.75rem}.univer-ml-1{margin-left:.25rem}.univer-ml-2{margin-left:.5rem}.univer-ml-3{margin-left:.75rem}.univer-ml-6{margin-left:1.5rem}.univer-mr-2{margin-right:.5rem}.univer-mt-0{margin-top:0}.univer-mt-1{margin-top:.25rem}.univer-mt-3{margin-top:.75rem}.univer-mt-4{margin-top:1rem}.univer-mt-5{margin-top:1.25rem}.univer-mt-6{margin-top:1.5rem}.univer-box-border{box-sizing:border-box}.univer-flex{display:flex}.univer-grid{display:grid}.univer-hidden{display:none}.univer-size-4{width:1rem;height:1rem}.univer-size-5{width:1.25rem;height:1.25rem}.univer-size-6{width:1.5rem;height:1.5rem}.univer-h-5{height:1.25rem}.univer-h-8{height:2rem}.univer-h-full{height:100%}.univer-w-1\/2{width:50%}.univer-w-36{width:9rem}.univer-w-64{width:16rem}.univer-w-80{width:20rem}.univer-w-\[45\%\]{width:45%}.univer-w-full{width:100%}.univer-min-w-0{min-width:0px}.univer-min-w-\[72px\]{min-width:72px}.univer-max-w-full{max-width:100%}.univer-flex-shrink{flex-shrink:1}.univer-flex-shrink-0{flex-shrink:0}.univer-cursor-grab{cursor:grab}.univer-cursor-pointer{cursor:pointer}.univer-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.univer-flex-col{flex-direction:column}.univer-flex-wrap{flex-wrap:wrap}.univer-items-center{align-items:center}.univer-justify-end{justify-content:flex-end}.univer-justify-center{justify-content:center}.univer-justify-between{justify-content:space-between}.univer-gap-2{gap:.5rem}.univer-gap-4{gap:1rem}.univer-overflow-hidden{overflow:hidden}.univer-rounded{border-radius:.25rem}.univer-rounded-lg{border-radius:.5rem}.univer-rounded-md{border-radius:.375rem}.univer-border{border-width:1px}.univer-border-solid{border-style:solid}.univer-border-red-500{border-color:var(--univer-red-500)}.\!univer-bg-gray-700{background-color:var(--univer-gray-700)!important}.univer-bg-gray-100{background-color:var(--univer-gray-100)}.univer-bg-white{background-color:var(--univer-white)}.univer-fill-primary-600{fill:var(--univer-primary-600)}.univer-p-1{padding:.25rem}.univer-p-4{padding:1rem}.univer-px-1{padding-left:.25rem;padding-right:.25rem}.univer-px-4{padding-left:1rem;padding-right:1rem}.univer-py-2{padding-top:.5rem;padding-bottom:.5rem}.univer-py-4{padding-top:1rem;padding-bottom:1rem}.univer-pl-1{padding-left:.25rem}.univer-pl-5{padding-left:1.25rem}.univer-pr-8{padding-right:2rem}.univer-pt-2{padding-top:.5rem}.univer-text-\[10px\]{font-size:10px}.univer-text-sm{font-size:.875rem;line-height:1.25rem}.univer-text-xs{font-size:.75rem;line-height:1rem}.univer-font-bold{font-weight:700}.univer-font-medium{font-weight:500}.univer-italic{font-style:italic}.univer-text-gray-300{color:var(--univer-gray-300)}.univer-text-gray-400{color:var(--univer-gray-400)}.univer-text-gray-600{color:var(--univer-gray-600)}.univer-text-gray-900{color:var(--univer-gray-900)}.univer-text-red-500{color:var(--univer-red-500)}.univer-transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.univer-transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.univer-group:hover .group-hover\:univer-flex{display:flex}.hover\:univer-border-primary-600:hover{border-color:var(--univer-primary-600)}.hover\:univer-bg-gray-100:hover{background-color:var(--univer-gray-100)}.hover\:univer-bg-gray-200:hover{background-color:var(--univer-gray-200)}.dark\:\!univer-bg-gray-700:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-700)!important}.dark\:\!univer-text-gray-200:where(.univer-dark,.univer-dark *){color:var(--univer-gray-200)!important}.dark\:\!univer-text-white:where(.univer-dark,.univer-dark *){color:var(--univer-white)!important}.dark\:hover\:\!univer-bg-gray-700:hover:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-700)!important}.\[\&\>div\:first-child\]\:univer-px-2\.5>div:first-child{padding-left:.625rem;padding-right:.625rem}.\[\&\>div\]\:univer-h-5>div{height:1.25rem}.\[\&\>div\]\:univer-ring-transparent>div{--univer-tw-ring-color: transparent }.\[\&_\.react-grid-item\]\:univer-transition-none .react-grid-item{transition-property:none}.\[\&_\.react-grid-placeholder\]\:univer-rounded .react-grid-placeholder{border-radius:.25rem}.\[\&_\.react-grid-placeholder\]\:\!univer-bg-gray-200 .react-grid-placeholder{background-color:var(--univer-gray-200)!important}
|