@univerjs/sheets-conditional-formatting-ui 0.1.11 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cjs/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var _a=Object.defineProperty;var wa=(e,t,n)=>t in e?_a(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ae=(e,t,n)=>(wa(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("@univerjs/core"),z=require("@wendellhu/redi"),s=require("@univerjs/sheets-conditional-formatting"),k=require("@univerjs/sheets"),be=require("@univerjs/ui"),_e=require("rxjs"),Ee=require("rxjs/operators"),w=require("react"),G=require("@univerjs/design"),te=require("@wendellhu/redi/react-bindings"),no=require("@univerjs/engine-formula"),We=require("clsx"),ro=require("react-dom"),ce=require("@univerjs/sheets-ui"),Ia=require("@univerjs/engine-render"),xa={type:g.CommandType.COMMAND,id:"sheet.command.add-average-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o,operator:a}=t,i=e.get(s.ConditionalFormattingRuleModel),c=e.get(g.ICommandService),l=e.get(g.IUniverInstanceService),u=k.getSheetCommandTarget(l);if(!u)return!1;const{unitId:d,subUnitId:h}=u,f=i.createCfId(d,h),v={ranges:n,cfId:f,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.average,operator:a,style:r}};return c.executeCommand(s.AddConditionalRuleMutation.id,{unitId:d,subUnitId:h,rule:v})}},Oa={type:g.CommandType.COMMAND,id:"sheet.command.add-color-scale-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,config:r,stopIfTrue:o}=t,a=e.get(s.ConditionalFormattingRuleModel),i=e.get(g.ICommandService),c=e.get(g.IUniverInstanceService),l=k.getSheetCommandTarget(c);if(!l)return!1;const{unitId:u,subUnitId:d}=l,h=a.createCfId(u,d),f={ranges:n,cfId:h,stopIfTrue:!!o,rule:{type:s.CFRuleType.colorScale,config:r}};return i.executeCommand(s.AddConditionalRuleMutation.id,{unitId:u,subUnitId:d,rule:f})}},Ea={type:g.CommandType.COMMAND,id:"sheet.command.add-data-bar-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,min:r,max:o,nativeColor:a,positiveColor:i,isGradient:c,stopIfTrue:l,isShowValue:u}=t,d=e.get(s.ConditionalFormattingRuleModel),h=e.get(g.IUniverInstanceService),f=k.getSheetCommandTarget(h);if(!f)return!1;const{unitId:v,subUnitId:y}=f,b=e.get(g.ICommandService),x=d.createCfId(v,y),_={ranges:n,cfId:x,stopIfTrue:!!l,rule:{type:s.CFRuleType.dataBar,isShowValue:u,config:{min:r,max:o,nativeColor:a,positiveColor:i,isGradient:c}}};return b.executeCommand(s.AddConditionalRuleMutation.id,{unitId:v,subUnitId:y,rule:_})}},Ma={type:g.CommandType.COMMAND,id:"sheet.command.add-duplicate-values-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o}=t,a=e.get(s.ConditionalFormattingRuleModel),i=e.get(g.ICommandService),c=e.get(g.IUniverInstanceService),l=k.getSheetCommandTarget(c);if(!l)return!1;const{unitId:u,subUnitId:d}=l,h=a.createCfId(u,d),f={ranges:n,cfId:h,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.duplicateValues,style:r}};return i.executeCommand(s.AddConditionalRuleMutation.id,{unitId:u,subUnitId:d,rule:f})}},Da={type:g.CommandType.COMMAND,id:"sheet.command.add-number-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o,operator:a,value:i}=t,c=e.get(s.ConditionalFormattingRuleModel),l=e.get(g.ICommandService),u=e.get(g.IUniverInstanceService),d=k.getSheetCommandTarget(u);if(!d)return!1;const{unitId:h,subUnitId:f}=d,v=c.createCfId(h,f);let y;if([s.CFNumberOperator.between,s.CFNumberOperator.notBetween].includes(a)){const b=i;if(b.length!==2||!Array.isArray(b))return!1;y={ranges:n,cfId:v,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.number,operator:a,style:r,value:b}}}else{const b=i;if(typeof b!="number")return!1;y={ranges:n,cfId:v,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.number,operator:a,style:r,value:b}}}return l.executeCommand(s.AddConditionalRuleMutation.id,{unitId:h,subUnitId:f,rule:y})}},Pa={type:g.CommandType.COMMAND,id:"sheet.command.add-rank-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o,isPercent:a,isBottom:i,value:c}=t,l=e.get(s.ConditionalFormattingRuleModel),u=e.get(g.IUniverInstanceService),d=e.get(g.ICommandService),h=k.getSheetCommandTarget(u);if(!h)return!1;const{unitId:f,subUnitId:v}=h,y=l.createCfId(f,v),b={ranges:n,cfId:y,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.rank,isPercent:a,isBottom:i,style:r,value:c}};return d.executeCommand(s.AddConditionalRuleMutation.id,{unitId:f,subUnitId:v,rule:b})}},Na={type:g.CommandType.COMMAND,id:"sheet.command.add-text-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o,operator:a,value:i}=t,c=e.get(s.ConditionalFormattingRuleModel),l=e.get(g.IUniverInstanceService),u=k.getSheetCommandTarget(l);if(!u)return!1;const{unitId:d,subUnitId:h}=u,f=e.get(g.ICommandService),v=c.createCfId(d,h),y={ranges:n,cfId:v,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.text,operator:a,style:r,value:i}};return f.executeCommand(s.AddConditionalRuleMutation.id,{unitId:d,subUnitId:h,rule:y})}},Fa={type:g.CommandType.COMMAND,id:"sheet.command.add-time-period-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o,operator:a}=t,i=e.get(s.ConditionalFormattingRuleModel),c=e.get(g.IUniverInstanceService),l=e.get(g.ICommandService),u=k.getSheetCommandTarget(c);if(!u)return!1;const{unitId:d,subUnitId:h}=u,f=i.createCfId(d,h),v={ranges:n,cfId:f,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.timePeriod,operator:a,style:r}};return l.executeCommand(s.AddConditionalRuleMutation.id,{unitId:d,subUnitId:h,rule:v})}},$a={type:g.CommandType.COMMAND,id:"sheet.command.add-uniqueValues-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o}=t,a=e.get(s.ConditionalFormattingRuleModel),i=e.get(g.IUniverInstanceService),c=e.get(g.ICommandService),l=k.getSheetCommandTarget(i);if(!l)return!1;const{unitId:u,subUnitId:d}=l,h=a.createCfId(u,d),f={ranges:n,cfId:h,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.uniqueValues,style:r}};return c.executeCommand(s.AddConditionalRuleMutation.id,{unitId:u,subUnitId:d,rule:f})}},oo={type:g.CommandType.COMMAND,id:"sheet.command.clear-range-conditional-rule",handler(e,t){var b;if(!t)return!1;const n=e.get(s.ConditionalFormattingRuleModel),r=e.get(g.IUniverInstanceService),o=e.get(g.ICommandService),a=e.get(g.IUndoRedoService),i=e.get(k.SelectionManagerService),c=k.getSheetCommandTarget(r,t);if(!c)return!1;const{unitId:l,subUnitId:u}=c,d=((b=i.getSelections())==null?void 0:b.map(x=>x.range))||[],h=n.getSubunitRules(l,u);if(!(h!=null&&h.length)||!d.length)return!1;const f=[],v=[];h.forEach(x=>{const _=new g.ObjectMatrix;x.ranges.forEach(C=>{g.Range.foreach(C,(R,m)=>{_.setValue(R,m,1)})}),d.forEach(C=>{g.Range.foreach(C,(R,m)=>{_.realDeleteValue(R,m)})});const S=k.findAllRectangle(k.createTopMatrixFromMatrix(_));if(S.length){const C={...x,ranges:S},R={unitId:l,subUnitId:u,rule:C},m=s.setConditionalRuleMutationUndoFactory(e,R);f.push({id:s.SetConditionalRuleMutation.id,params:R}),v.push(...m)}else{const C={unitId:l,subUnitId:u,cfId:x.cfId},R=s.DeleteConditionalRuleMutationUndoFactory(e,C);f.push({id:s.DeleteConditionalRuleMutation.id,params:C}),v.push(...R)}});const y=g.sequenceExecute(f,o).result;return y&&a.pushUndoRedo({unitID:l,redoMutations:f,undoMutations:v}),y}},Wn={type:g.CommandType.COMMAND,id:"sheet.command.clear-worksheet-conditional-rule",handler(e,t){const n=e.get(s.ConditionalFormattingRuleModel),r=e.get(g.IUniverInstanceService),o=e.get(g.ICommandService),a=e.get(g.IUndoRedoService),i=k.getSheetCommandTarget(r,t);if(!i)return!1;const{unitId:c,subUnitId:l}=i,u=n.getSubunitRules(c,l);if(!(u!=null&&u.length))return!1;const d=u.map(y=>({cfId:y.cfId,unitId:c,subUnitId:l})),h=d.map(y=>({id:s.DeleteConditionalRuleMutation.id,params:y})),f=d.map(y=>s.DeleteConditionalRuleMutationUndoFactory(e,y)[0]),v=g.sequenceExecute(h,o).result;return v&&a.pushUndoRedo({unitID:c,redoMutations:h,undoMutations:f}),v}};var xe=function(){return xe=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},xe.apply(this,arguments)},ja=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n},rt=w.forwardRef(function(e,t){var n=e.icon,r=e.id,o=e.className,a=e.extend,i=ja(e,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(r," ").concat(o||"").trim(),l=w.useRef("_".concat(Ua()));return ao(n,"".concat(r),{defIds:n.defIds,idSuffix:l.current},xe({ref:t,className:c},i),a)});function ao(e,t,n,r,o){return w.createElement(e.tag,xe(xe({key:t},La(e,n,o)),r),(Va(e,n).children||[]).map(function(a,i){return ao(a,"".concat(t,"-").concat(e.tag,"-").concat(i),n,void 0,o)}))}function La(e,t,n){var r=xe({},e.attrs);n!=null&&n.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=n.colorChannel1);var o=t.defIds;return!o||o.length===0||(e.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+t.idSuffix),Object.entries(r).forEach(function(a){var i=a[0],c=a[1];typeof c=="string"&&(r[i]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),r}function Va(e,t){var n,r=t.defIds;return!r||r.length===0?e:e.tag==="defs"&&(!((n=e.children)===null||n===void 0)&&n.length)?xe(xe({},e),{children:e.children.map(function(o){return typeof o.attrs.id=="string"&&r&&r.indexOf(o.attrs.id)>-1?xe(xe({},o),{attrs:xe(xe({},o.attrs),{id:o.attrs.id+t.idSuffix})}):o})}):e}function Ua(){return Math.random().toString(36).substring(2,8)}rt.displayName="UniverIcon";var za={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"colorChannel1",d:"M5.59 1.51H10.46V14.459999999999999H5.59z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.34863 2.53325C1.34863 1.87051 1.88589 1.33325 2.54863 1.33325H13.482C14.1447 1.33325 14.682 1.87051 14.682 2.53325V13.4666C14.682 14.1294 14.1447 14.6666 13.482 14.6666H2.54863C1.88589 14.6666 1.34863 14.1294 1.34863 13.4666V2.53325ZM13.082 2.63325C13.2477 2.63325 13.382 2.76757 13.382 2.93325V5.09946C13.382 5.26515 13.2477 5.39946 13.082 5.39946H10.9708C10.8052 5.39946 10.6708 5.26515 10.6708 5.09946V2.93325C10.6708 2.76757 10.8052 2.63325 10.9708 2.63325H13.082ZM9.37085 2.93325C9.37085 2.76757 9.23653 2.63325 9.07085 2.63325H6.95974C6.79406 2.63325 6.65974 2.76757 6.65974 2.93325V5.09946C6.65974 5.26515 6.79406 5.39946 6.95974 5.39946L9.07085 5.39946C9.23654 5.39946 9.37085 5.26515 9.37085 5.09946V2.93325ZM5.35974 2.93325C5.35974 2.76757 5.22543 2.63325 5.05974 2.63325H2.94863C2.78295 2.63325 2.64863 2.76757 2.64863 2.93325V5.09946C2.64863 5.26515 2.78295 5.39946 2.94863 5.39946H5.05974C5.22543 5.39946 5.35974 5.26515 5.35974 5.09946V2.93325ZM2.94863 6.69946C2.78295 6.69946 2.64863 6.83378 2.64863 6.99946V9.11045C2.64863 9.27613 2.78295 9.41045 2.94863 9.41045H5.05974C5.22543 9.41045 5.35974 9.27613 5.35974 9.11045V6.99946C5.35974 6.83378 5.22543 6.69946 5.05974 6.69946H2.94863ZM2.94863 10.7104C2.78295 10.7104 2.64863 10.8448 2.64863 11.0104V13.0666C2.64863 13.2323 2.78295 13.3666 2.94863 13.3666H5.05974C5.22543 13.3666 5.35974 13.2323 5.35974 13.0666V11.0104C5.35974 10.8448 5.22543 10.7104 5.05974 10.7104H2.94863ZM6.65974 13.0666C6.65974 13.2323 6.79406 13.3666 6.95974 13.3666H9.07085C9.23653 13.3666 9.37085 13.2323 9.37085 13.0666V11.0104C9.37085 10.8448 9.23653 10.7104 9.07085 10.7104L6.95974 10.7104C6.79406 10.7104 6.65974 10.8448 6.65974 11.0104V13.0666ZM10.6708 13.0666C10.6708 13.2323 10.8052 13.3666 10.9708 13.3666H13.082C13.2477 13.3666 13.382 13.2323 13.382 13.0666V11.0104C13.382 10.8448 13.2477 10.7104 13.082 10.7104H10.9708C10.8052 10.7104 10.6708 10.8448 10.6708 11.0104V13.0666ZM13.082 9.41045C13.2477 9.41045 13.382 9.27613 13.382 9.11045V6.99946C13.382 6.83378 13.2477 6.69946 13.082 6.69946H10.9708C10.8052 6.69946 10.6708 6.83378 10.6708 6.99946V9.11045C10.6708 9.27613 10.8052 9.41045 10.9708 9.41045H13.082ZM6.95974 9.41045C6.79406 9.41045 6.65974 9.27613 6.65974 9.11045V6.99946C6.65974 6.83378 6.79406 6.69946 6.95974 6.69946L9.07085 6.69946C9.23653 6.69946 9.37085 6.83378 9.37085 6.99946V9.11045C9.37085 9.27613 9.23653 9.41045 9.07085 9.41045H6.95974Z",fillRule:"evenodd",clipRule:"evenodd"}}]},io=w.forwardRef(function(e,t){return w.createElement(rt,Object.assign({},e,{id:"conditions",ref:t,icon:za}))});io.displayName="Conditions";const Aa=io;var ka={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M6.78662 6.17993C7.12169 6.17993 7.39331 6.45156 7.39331 6.78662V10.7301C7.39331 11.0652 7.12169 11.3368 6.78662 11.3368 6.45156 11.3368 6.17993 11.0652 6.17993 10.7301V6.78662C6.17993 6.45156 6.45156 6.17993 6.78662 6.17993zM9.82007 6.78662C9.82007 6.45156 9.54844 6.17993 9.21338 6.17993 8.87831 6.17993 8.60669 6.45156 8.60669 6.78662V10.7301C8.60669 11.0652 8.87831 11.3368 9.21338 11.3368 9.54844 11.3368 9.82007 11.0652 9.82007 10.7301V6.78662z"}},{tag:"path",attrs:{fill:"currentColor",d:"M6.57094 1.32642C6.34938 1.32642 6.14544 1.44719 6.03894 1.64148L5.21395 3.14648H1.93311C1.59804 3.14648 1.32642 3.41811 1.32642 3.75317C1.32642 4.08824 1.59804 4.35986 1.93311 4.35986H2.84314V14.0669C2.84314 14.402 3.11476 14.6736 3.44983 14.6736H12.5502C12.8852 14.6736 13.1569 14.402 13.1569 14.0669V4.35986H14.0669C14.402 4.35986 14.6736 4.08824 14.6736 3.75317C14.6736 3.41811 14.402 3.14648 14.0669 3.14648H10.7895L9.98357 1.64602C9.87785 1.4492 9.67252 1.32642 9.44911 1.32642H6.57094ZM9.4122 3.14648L9.08632 2.53979H6.93024L6.59767 3.14648H9.4122ZM4.05652 4.35986V13.4602H11.9435V4.35986H4.05652Z",fillRule:"evenodd",clipRule:"evenodd"}}]},so=w.forwardRef(function(e,t){return w.createElement(rt,Object.assign({},e,{id:"delete-single",ref:t,icon:ka}))});so.displayName="DeleteSingle";const Sn=so;var Ha={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"mask",attrs:{id:"mask0_102_249",style:{maskType:"alpha"},width:16,height:16,x:0,y:0,maskUnits:"userSpaceOnUse"},children:[{tag:"path",attrs:{fill:"#D9D9D9",d:"M0 0H16V16H0z"}}]},{tag:"g",attrs:{mask:"url(#mask0_102_249)"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.74717 2.0944C8.74717 1.68671 8.41279 1.3562 8.00032 1.3562C7.58785 1.3562 7.25347 1.68671 7.25347 2.0944V7.26186H2.02541C1.61294 7.26186 1.27856 7.59237 1.27856 8.00007C1.27856 8.40777 1.61294 8.73827 2.02541 8.73827H7.25347V13.9057C7.25347 14.3134 7.58785 14.6439 8.00032 14.6439C8.41279 14.6439 8.74717 14.3134 8.74717 13.9057V8.73827H13.975C14.3874 8.73827 14.7218 8.40777 14.7218 8.00007C14.7218 7.59237 14.3874 7.26186 13.975 7.26186H8.74717V2.0944Z"}}]}]},lo=w.forwardRef(function(e,t){return w.createElement(rt,Object.assign({},e,{id:"increase-single",ref:t,icon:Ha}))});lo.displayName="IncreaseSingle";const Wa=lo;var qa={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"mask",attrs:{id:"mask0_102_556",style:{maskType:"alpha"},width:16,height:16,x:0,y:0,maskUnits:"userSpaceOnUse"},children:[{tag:"path",attrs:{fill:"#D9D9D9",d:"M0 0H16V16H0z"}}]},{tag:"g",attrs:{mask:"url(#mask0_102_556)"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M0.629584 3.99986C1.13729 3.4922 1.9604 3.49224 2.46806 3.99995L7.57569 9.10806C7.81 9.3424 8.18992 9.3424 8.42424 9.10808L13.5323 3.99998C14.04 3.4923 14.8631 3.4923 15.3708 3.99998C15.8785 4.50766 15.8785 5.33078 15.3708 5.83846L9.41415 11.7951C8.63307 12.5762 7.36669 12.5762 6.58565 11.7951L0.629497 5.83834C0.121839 5.33063 0.121879 4.50752 0.629584 3.99986Z",fillRule:"evenodd",clipRule:"evenodd"}}]}]},co=w.forwardRef(function(e,t){return w.createElement(rt,Object.assign({},e,{id:"more-down-single",ref:t,icon:qa}))});co.displayName="MoreDownSingle";const qn=co;var Ba={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"mask",attrs:{id:"mask0_622_8",style:{maskType:"alpha"},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 4 7 3.44772 6.55228 3 6 3 5.44772 3 5 3.44772 5 4 5 4.55228 5.44772 5 6 5zM6 9C6.55228 9 7 8.55229 7 8 7 7.44772 6.55228 7 6 7 5.44772 7 5 7.44772 5 8 5 8.55229 5.44772 9 6 9zM7 12C7 12.5523 6.55228 13 6 13 5.44772 13 5 12.5523 5 12 5 11.4477 5.44772 11 6 11 6.55228 11 7 11.4477 7 12zM10 5C10.5523 5 11 4.55228 11 4 11 3.44772 10.5523 3 10 3 9.44771 3 9 3.44772 9 4 9 4.55228 9.44771 5 10 5zM11 8C11 8.55229 10.5523 9 10 9 9.44771 9 9 8.55229 9 8 9 7.44772 9.44771 7 10 7 10.5523 7 11 7.44772 11 8zM10 13C10.5523 13 11 12.5523 11 12 11 11.4477 10.5523 11 10 11 9.44771 11 9 11.4477 9 12 9 12.5523 9.44771 13 10 13z"}}]}]},uo=w.forwardRef(function(e,t){return w.createElement(rt,Object.assign({},e,{id:"sequence-single",ref:t,icon:Ba}))});uo.displayName="SequenceSingle";const Ga=uo;var Xa={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"mask",attrs:{id:"mask0_436_41",style:{maskType:"alpha"},width:17,height:17,x:0,y:0,maskUnits:"userSpaceOnUse"},children:[{tag:"path",attrs:{fill:"#D9D9D9",d:"M0.35 0.48H16.35V16.48H0.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"}}]}]},fo=w.forwardRef(function(e,t){return w.createElement(rt,Object.assign({},e,{id:"slash-single",ref:t,icon:Xa}))});fo.displayName="SlashSingle";const en=fo,wr=[k.SetWorksheetActiveOperation.id,s.AddConditionalRuleMutation.id,s.SetConditionalRuleMutation.id,s.DeleteConditionalRuleMutation.id,s.MoveConditionalRuleMutation.id],Ya=e=>{const t="conditional-formatting-menu-icon";return e.register(t,Aa),n=>{const r=n.get(g.LocaleService),o=n.get(k.SelectionManagerService),a=n.get(g.ICommandService),i=n.get(g.IUniverInstanceService),c=n.get(s.ConditionalFormattingRuleModel),l=new _e.Observable(h=>_e.merge(o.selectionMoveEnd$,new _e.Observable(f=>{const v=a.onCommandExecuted(y=>{var S;const{id:b,params:x}=y,_=(S=i.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET))==null?void 0:S.getUnitId();wr.includes(b)&&x.unitId===_&&f.next(null)});return()=>v.dispose()})).pipe(Ee.debounceTime(16)).subscribe(()=>{var x;const f=((x=o.getSelections())==null?void 0:x.map(_=>_.range))||[],v=i.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET);if(!v)return;const b=(c.getSubunitRules(v.getUnitId(),v.getActiveSheet().getSheetId())||[]).filter(_=>_.ranges.some(S=>f.some(C=>g.Rectangle.intersects(C,S))));h.next(!!b.length)})),u=new _e.Observable(h=>_e.merge(o.selectionMoveEnd$,new _e.Observable(f=>{const v=a.onCommandExecuted(y=>{var S;const{id:b,params:x}=y,_=(S=i.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET))==null?void 0:S.getUnitId();wr.includes(b)&&x.unitId===_&&f.next(null)});return()=>v.dispose()})).pipe(Ee.debounceTime(16)).subscribe(()=>{const f=i.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET);if(!f)return;const v=c.getSubunitRules(f.getUnitId(),f.getActiveSheet().getSheetId())||[];h.next(!!v.length)})),d=new _e.Observable(h=>{const f=Ka(r);l.subscribe(v=>{const y=f.find(b=>b.value===Re.clearRangeRules);y&&(y.disabled=!v,h.next(f))}),u.subscribe(v=>{const y=f.find(b=>b.value===Re.clearWorkSheetRules);y&&(y.disabled=!v,h.next(f))}),h.next(f)});return{id:Ta.id,type:be.MenuItemType.SELECTOR,group:be.MenuGroup.TOOLBAR_FORMULAS_INSERT,positions:[be.MenuPosition.TOOLBAR_START],icon:t,tooltip:r.t("sheet.cf.title"),selections:d,hidden$:be.getMenuHiddenObservable(n,g.UniverInstanceType.UNIVER_SHEET)}}};function Ka(e){return[{label:e.t("sheet.cf.ruleType.highlightCell"),value:Re.highlightCell},{label:e.t("sheet.cf.panel.rankAndAverage"),value:Re.rank},{label:e.t("sheet.cf.ruleType.formula"),value:Re.formula},{label:e.t("sheet.cf.ruleType.colorScale"),value:Re.colorScale},{label:e.t("sheet.cf.ruleType.dataBar"),value:Re.dataBar},{label:e.t("sheet.cf.ruleType.iconSet"),value:Re.icon},{label:e.t("sheet.cf.menu.manageConditionalFormatting"),value:Re.viewRule},{label:e.t("sheet.cf.menu.createConditionalFormatting"),value:Re.createRule},{label:e.t("sheet.cf.menu.clearRangeRules"),value:Re.clearRangeRules,disabled:!1},{label:e.t("sheet.cf.menu.clearWorkSheetRules"),value:Re.clearWorkSheetRules}]}var Ue=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Bn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Za(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}),n}var po={exports:{}},tn={};/**
1
+ "use strict";var _i=Object.defineProperty;var wi=(e,t,n)=>t in e?_i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Be=(e,t,n)=>(wi(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("@univerjs/core"),V=require("@wendellhu/redi"),s=require("@univerjs/sheets-conditional-formatting"),$=require("@univerjs/sheets"),Re=require("@univerjs/ui"),Ie=require("rxjs"),Fe=require("rxjs/operators"),le=require("@univerjs/sheets-ui"),I=require("react"),B=require("@univerjs/design"),te=require("@wendellhu/redi/react-bindings"),ao=require("@univerjs/engine-formula"),Ye=require("clsx"),so=require("react-dom"),Ii=require("@univerjs/engine-render"),xi={type:g.CommandType.COMMAND,id:"sheet.command.add-average-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o,operator:i}=t,a=e.get(s.ConditionalFormattingRuleModel),c=e.get(g.ICommandService),l=e.get(g.IUniverInstanceService),u=$.getSheetCommandTarget(l);if(!u)return!1;const{unitId:d,subUnitId:p}=u,f=a.createCfId(d,p),v={ranges:n,cfId:f,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.average,operator:i,style:r}};return c.executeCommand(s.AddConditionalRuleMutation.id,{unitId:d,subUnitId:p,rule:v})}},Oi={type:g.CommandType.COMMAND,id:"sheet.command.add-color-scale-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,config:r,stopIfTrue:o}=t,i=e.get(s.ConditionalFormattingRuleModel),a=e.get(g.ICommandService),c=e.get(g.IUniverInstanceService),l=$.getSheetCommandTarget(c);if(!l)return!1;const{unitId:u,subUnitId:d}=l,p=i.createCfId(u,d),f={ranges:n,cfId:p,stopIfTrue:!!o,rule:{type:s.CFRuleType.colorScale,config:r}};return a.executeCommand(s.AddConditionalRuleMutation.id,{unitId:u,subUnitId:d,rule:f})}},Ei={type:g.CommandType.COMMAND,id:"sheet.command.add-data-bar-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,min:r,max:o,nativeColor:i,positiveColor:a,isGradient:c,stopIfTrue:l,isShowValue:u}=t,d=e.get(s.ConditionalFormattingRuleModel),p=e.get(g.IUniverInstanceService),f=$.getSheetCommandTarget(p);if(!f)return!1;const{unitId:v,subUnitId:y}=f,S=e.get(g.ICommandService),x=d.createCfId(v,y),_={ranges:n,cfId:x,stopIfTrue:!!l,rule:{type:s.CFRuleType.dataBar,isShowValue:u,config:{min:r,max:o,nativeColor:i,positiveColor:a,isGradient:c}}};return S.executeCommand(s.AddConditionalRuleMutation.id,{unitId:v,subUnitId:y,rule:_})}},Pi={type:g.CommandType.COMMAND,id:"sheet.command.add-duplicate-values-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o}=t,i=e.get(s.ConditionalFormattingRuleModel),a=e.get(g.ICommandService),c=e.get(g.IUniverInstanceService),l=$.getSheetCommandTarget(c);if(!l)return!1;const{unitId:u,subUnitId:d}=l,p=i.createCfId(u,d),f={ranges:n,cfId:p,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.duplicateValues,style:r}};return a.executeCommand(s.AddConditionalRuleMutation.id,{unitId:u,subUnitId:d,rule:f})}},Di={type:g.CommandType.COMMAND,id:"sheet.command.add-number-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o,operator:i,value:a}=t,c=e.get(s.ConditionalFormattingRuleModel),l=e.get(g.ICommandService),u=e.get(g.IUniverInstanceService),d=$.getSheetCommandTarget(u);if(!d)return!1;const{unitId:p,subUnitId:f}=d,v=c.createCfId(p,f);let y;if([s.CFNumberOperator.between,s.CFNumberOperator.notBetween].includes(i)){const S=a;if(S.length!==2||!Array.isArray(S))return!1;y={ranges:n,cfId:v,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.number,operator:i,style:r,value:S}}}else{const S=a;if(typeof S!="number")return!1;y={ranges:n,cfId:v,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.number,operator:i,style:r,value:S}}}return l.executeCommand(s.AddConditionalRuleMutation.id,{unitId:p,subUnitId:f,rule:y})}},Mi={type:g.CommandType.COMMAND,id:"sheet.command.add-rank-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o,isPercent:i,isBottom:a,value:c}=t,l=e.get(s.ConditionalFormattingRuleModel),u=e.get(g.IUniverInstanceService),d=e.get(g.ICommandService),p=$.getSheetCommandTarget(u);if(!p)return!1;const{unitId:f,subUnitId:v}=p,y=l.createCfId(f,v),S={ranges:n,cfId:y,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.rank,isPercent:i,isBottom:a,style:r,value:c}};return d.executeCommand(s.AddConditionalRuleMutation.id,{unitId:f,subUnitId:v,rule:S})}},Ni={type:g.CommandType.COMMAND,id:"sheet.command.add-text-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o,operator:i,value:a}=t,c=e.get(s.ConditionalFormattingRuleModel),l=e.get(g.IUniverInstanceService),u=$.getSheetCommandTarget(l);if(!u)return!1;const{unitId:d,subUnitId:p}=u,f=e.get(g.ICommandService),v=c.createCfId(d,p),y={ranges:n,cfId:v,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.text,operator:i,style:r,value:a}};return f.executeCommand(s.AddConditionalRuleMutation.id,{unitId:d,subUnitId:p,rule:y})}},Fi={type:g.CommandType.COMMAND,id:"sheet.command.add-time-period-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o,operator:i}=t,a=e.get(s.ConditionalFormattingRuleModel),c=e.get(g.IUniverInstanceService),l=e.get(g.ICommandService),u=$.getSheetCommandTarget(c);if(!u)return!1;const{unitId:d,subUnitId:p}=u,f=a.createCfId(d,p),v={ranges:n,cfId:f,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.timePeriod,operator:i,style:r}};return l.executeCommand(s.AddConditionalRuleMutation.id,{unitId:d,subUnitId:p,rule:v})}},ji={type:g.CommandType.COMMAND,id:"sheet.command.add-uniqueValues-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:o}=t,i=e.get(s.ConditionalFormattingRuleModel),a=e.get(g.IUniverInstanceService),c=e.get(g.ICommandService),l=$.getSheetCommandTarget(a);if(!l)return!1;const{unitId:u,subUnitId:d}=l,p=i.createCfId(u,d),f={ranges:n,cfId:p,stopIfTrue:!!o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.uniqueValues,style:r}};return c.executeCommand(s.AddConditionalRuleMutation.id,{unitId:u,subUnitId:d,rule:f})}},lo={type:g.CommandType.COMMAND,id:"sheet.command.clear-range-conditional-rule",handler(e,t){var S;if(!t)return!1;const n=e.get(s.ConditionalFormattingRuleModel),r=e.get(g.IUniverInstanceService),o=e.get(g.ICommandService),i=e.get(g.IUndoRedoService),a=e.get($.SelectionManagerService),c=$.getSheetCommandTarget(r,t);if(!c)return!1;const{unitId:l,subUnitId:u}=c,d=((S=a.getSelections())==null?void 0:S.map(x=>x.range))||[],p=n.getSubunitRules(l,u);if(!(p!=null&&p.length)||!d.length)return!1;const f=[],v=[];p.forEach(x=>{const _=new g.ObjectMatrix;x.ranges.forEach(C=>{g.Range.foreach(C,(T,m)=>{_.setValue(T,m,1)})}),d.forEach(C=>{g.Range.foreach(C,(T,m)=>{_.realDeleteValue(T,m)})});const b=$.findAllRectangle($.createTopMatrixFromMatrix(_));if(b.length){const C={...x,ranges:b},T={unitId:l,subUnitId:u,rule:C},m=s.setConditionalRuleMutationUndoFactory(e,T);f.push({id:s.SetConditionalRuleMutation.id,params:T}),v.push(...m)}else{const C={unitId:l,subUnitId:u,cfId:x.cfId},T=s.DeleteConditionalRuleMutationUndoFactory(e,C);f.push({id:s.DeleteConditionalRuleMutation.id,params:C}),v.push(...T)}});const y=g.sequenceExecute(f,o).result;return y&&i.pushUndoRedo({unitID:l,redoMutations:f,undoMutations:v}),y}},Xn={type:g.CommandType.COMMAND,id:"sheet.command.clear-worksheet-conditional-rule",handler(e,t){const n=e.get(s.ConditionalFormattingRuleModel),r=e.get(g.IUniverInstanceService),o=e.get(g.ICommandService),i=e.get(g.IUndoRedoService),a=$.getSheetCommandTarget(r,t);if(!a)return!1;const{unitId:c,subUnitId:l}=a,u=n.getSubunitRules(c,l);if(!(u!=null&&u.length))return!1;const d=u.map(y=>({cfId:y.cfId,unitId:c,subUnitId:l})),p=d.map(y=>({id:s.DeleteConditionalRuleMutation.id,params:y})),f=d.map(y=>s.DeleteConditionalRuleMutationUndoFactory(e,y)[0]),v=g.sequenceExecute(p,o).result;return v&&i.pushUndoRedo({unitID:c,redoMutations:p,undoMutations:f}),v}};var Ae=(e=>(e[e.View=0]="View",e[e.Edit=1]="Edit",e[e.ManageCollaborator=2]="ManageCollaborator",e[e.Print=3]="Print",e[e.Duplicate=4]="Duplicate",e[e.Comment=5]="Comment",e[e.Copy=6]="Copy",e[e.Share=7]="Share",e[e.Export=8]="Export",e[e.MoveWorksheet=9]="MoveWorksheet",e[e.DeleteWorksheet=10]="DeleteWorksheet",e[e.HideWorksheet=11]="HideWorksheet",e[e.RenameWorksheet=12]="RenameWorksheet",e[e.CreateWorksheet=13]="CreateWorksheet",e[e.SetWorksheetStyle=14]="SetWorksheetStyle",e[e.EditWorksheetCell=15]="EditWorksheetCell",e[e.InsertHyperlink=16]="InsertHyperlink",e[e.Sort=17]="Sort",e[e.Filter=18]="Filter",e[e.PivotTable=19]="PivotTable",e[e.FloatImg=20]="FloatImg",e[e.History=21]="History",e[e.RwHgtClWdt=22]="RwHgtClWdt",e[e.ViemRwHgtClWdt=23]="ViemRwHgtClWdt",e[e.ViewFilter=24]="ViewFilter",e[e.MoveSheet=25]="MoveSheet",e[e.DeleteSheet=26]="DeleteSheet",e[e.HideSheet=27]="HideSheet",e[e.CopySheet=28]="CopySheet",e[e.RenameSheet=29]="RenameSheet",e[e.CreateSheet=30]="CreateSheet",e[e.SelectProtectedCells=31]="SelectProtectedCells",e[e.SelectUnProtectedCells=32]="SelectUnProtectedCells",e[e.SetCellStyle=33]="SetCellStyle",e[e.SetCellValue=34]="SetCellValue",e[e.SetRowStyle=35]="SetRowStyle",e[e.SetColumnStyle=36]="SetColumnStyle",e[e.InsertRow=37]="InsertRow",e[e.InsertColumn=38]="InsertColumn",e[e.DeleteRow=39]="DeleteRow",e[e.DeleteColumn=40]="DeleteColumn",e[e.EditExtraObject=41]="EditExtraObject",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(Ae||{});const Er=[$.SetWorksheetActiveOperation.id,s.AddConditionalRuleMutation.id,s.SetConditionalRuleMutation.id,s.DeleteConditionalRuleMutation.id,s.MoveConditionalRuleMutation.id],$i=e=>{const t=[{label:"sheet.cf.ruleType.highlightCell",value:we.highlightCell},{label:"sheet.cf.panel.rankAndAverage",value:we.rank},{label:"sheet.cf.ruleType.formula",value:we.formula},{label:"sheet.cf.ruleType.colorScale",value:we.colorScale},{label:"sheet.cf.ruleType.dataBar",value:we.dataBar},{label:"sheet.cf.ruleType.iconSet",value:we.icon},{label:"sheet.cf.menu.manageConditionalFormatting",value:we.viewRule},{label:"sheet.cf.menu.createConditionalFormatting",value:we.createRule},{label:"sheet.cf.menu.clearRangeRules",value:we.clearRangeRules,disabled:!1},{label:"sheet.cf.menu.clearWorkSheetRules",value:we.clearWorkSheetRules}],n=e.get($.SelectionManagerService),r=e.get(g.ICommandService),o=e.get(g.IUniverInstanceService),i=e.get(s.ConditionalFormattingRuleModel),a=new Ie.Observable(u=>Ie.merge(n.selectionMoveEnd$,new Ie.Observable(d=>{const p=r.onCommandExecuted(f=>{var x;const{id:v,params:y}=f,S=(x=o.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET))==null?void 0:x.getUnitId();Er.includes(v)&&y.unitId===S&&d.next(null)});return()=>p.dispose()})).pipe(Fe.debounceTime(16)).subscribe(()=>{var y;const d=((y=n.getSelections())==null?void 0:y.map(S=>S.range))||[],p=o.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET);if(!p)return;const v=(i.getSubunitRules(p.getUnitId(),p.getActiveSheet().getSheetId())||[]).filter(S=>S.ranges.some(x=>d.some(_=>g.Rectangle.intersects(_,x))));u.next(!!v.length)})),c=new Ie.Observable(u=>Ie.merge(n.selectionMoveEnd$,new Ie.Observable(d=>{const p=r.onCommandExecuted(f=>{var x;const{id:v,params:y}=f,S=(x=o.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET))==null?void 0:x.getUnitId();Er.includes(v)&&y.unitId===S&&d.next(null)});return()=>p.dispose()})).pipe(Fe.debounceTime(16)).subscribe(()=>{const d=o.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET);if(!d)return;const p=d.getActiveSheet(),v=(i.getSubunitRules(d.getUnitId(),d.getActiveSheet().getSheetId())||[]).some(y=>y.ranges.some(x=>{var m,O;const{startRow:_,startColumn:b,endRow:C,endColumn:T}=x;for(let E=_;E<=C;E++)for(let w=b;w<=T;w++){const F=(O=(m=p.getCell(E,w))==null?void 0:m.selectionProtection)==null?void 0:O[0];if((F==null?void 0:F[Ae.Edit])===!1||(F==null?void 0:F[Ae.View])===!1)return!0}return!1}));u.next(!v)})),l=new Ie.Observable(u=>{a.subscribe(d=>{const p=t.find(f=>f.value===we.clearRangeRules);p&&(p.disabled=!d,u.next(t))}),c.subscribe(d=>{const p=t.find(f=>f.value===we.clearWorkSheetRules);p&&(p.disabled=!d,u.next(t))}),u.next(t)});return{id:Ri.id,type:Re.MenuItemType.SELECTOR,group:Re.MenuGroup.TOOLBAR_FORMULAS_INSERT,positions:[Re.MenuPosition.TOOLBAR_START],icon:"Conditions",tooltip:"sheet.cf.title",selections:l,hidden$:Re.getMenuHiddenObservable(e,g.UniverInstanceType.UNIVER_SHEET),disabled$:le.getCurrentRangeDisable$(e,{workbookTypes:[$.WorkbookEditablePermission],worksheetTypes:[$.WorksheetSetCellStylePermission,$.WorksheetEditPermission],rangeTypes:[$.RangeProtectionPermissionEditPoint]})}};var He=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Yn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Li(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}),n}var co={exports:{}},nn={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,6 +6,6 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Ja=w,Qa=Symbol.for("react.element"),ei=Symbol.for("react.fragment"),ti=Object.prototype.hasOwnProperty,ni=Ja.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,ri={key:!0,ref:!0,__self:!0,__source:!0};function ho(e,t,n){var r,o={},a=null,i=null;n!==void 0&&(a=""+n),t.key!==void 0&&(a=""+t.key),t.ref!==void 0&&(i=t.ref);for(r in t)ti.call(t,r)&&!ri.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)o[r]===void 0&&(o[r]=t[r]);return{$$typeof:Qa,type:e,key:a,ref:i,props:o,_owner:ni.current}}tn.Fragment=ei;tn.jsx=ho;tn.jsxs=ho;po.exports=tn;var p=po.exports;const oi="univer-conditional-formatting-wrap",ai="univer-cf-rule-item",ii="univer-preview",si="univer-create-rule",li="univer-button",ci="univer-title",ui="univer-label",di="univer-label-container",fi="univer-input-width",pi="univer-m-t-base",hi="univer-m-t-sm",gi="univer-m-t-xl",mi="univer-m-l-sm",vi="univer-m-l-xl",yi="univer-m-l-xxs",Ci="univer-m-l-0",Si="univer-m-r-0",D={conditionalFormattingWrap:oi,cfRuleItem:ai,preview:ii,createRule:si,button:li,title:ci,label:ui,labelContainer:di,inputWidth:fi,mTBase:pi,mTSm:hi,mTXl:gi,mLSm:mi,mLXl:vi,mLXxs:yi,mL0:Ci,mR0:Si};var go={exports:{}},Nt={},Pn={exports:{}};(function(e,t){(function(n,r){r(t)})(Ue,function(n){function r(N){return function(J,Y,K,oe,ue,Ie,ae){return N(J,Y,ae)}}function o(N){return function(J,Y,K,oe){if(!J||!Y||typeof J!="object"||typeof Y!="object")return N(J,Y,K,oe);var ue=oe.get(J),Ie=oe.get(Y);if(ue&&Ie)return ue===Y&&Ie===J;oe.set(J,Y),oe.set(Y,J);var ae=N(J,Y,K,oe);return oe.delete(J),oe.delete(Y),ae}}function a(N,U){var J={};for(var Y in N)J[Y]=N[Y];for(var Y in U)J[Y]=U[Y];return J}function i(N){return N.constructor===Object||N.constructor==null}function c(N){return typeof N.then=="function"}function l(N,U){return N===U||N!==N&&U!==U}var u="[object Arguments]",d="[object Boolean]",h="[object Date]",f="[object RegExp]",v="[object Map]",y="[object Number]",b="[object Object]",x="[object Set]",_="[object String]",S=Object.prototype.toString;function C(N){var U=N.areArraysEqual,J=N.areDatesEqual,Y=N.areMapsEqual,K=N.areObjectsEqual,oe=N.areRegExpsEqual,ue=N.areSetsEqual,Ie=N.createIsNestedEqual,ae=Ie(De);function De(ne,ie,Pe){if(ne===ie)return!0;if(!ne||!ie||typeof ne!="object"||typeof ie!="object")return ne!==ne&&ie!==ie;if(i(ne)&&i(ie))return K(ne,ie,ae,Pe);var Rr=Array.isArray(ne),_r=Array.isArray(ie);if(Rr||_r)return Rr===_r&&U(ne,ie,ae,Pe);var Ne=S.call(ne);return Ne!==S.call(ie)?!1:Ne===h?J(ne,ie,ae,Pe):Ne===f?oe(ne,ie,ae,Pe):Ne===v?Y(ne,ie,ae,Pe):Ne===x?ue(ne,ie,ae,Pe):Ne===b||Ne===u?c(ne)||c(ie)?!1:K(ne,ie,ae,Pe):Ne===d||Ne===y||Ne===_?l(ne.valueOf(),ie.valueOf()):!1}return De}function R(N,U,J,Y){var K=N.length;if(U.length!==K)return!1;for(;K-- >0;)if(!J(N[K],U[K],K,K,N,U,Y))return!1;return!0}var m=o(R);function O(N,U){return l(N.valueOf(),U.valueOf())}function M(N,U,J,Y){var K=N.size===U.size;if(!K)return!1;if(!N.size)return!0;var oe={},ue=0;return N.forEach(function(Ie,ae){if(K){var De=!1,ne=0;U.forEach(function(ie,Pe){!De&&!oe[ne]&&(De=J(ae,Pe,ue,ne,N,U,Y)&&J(Ie,ie,ae,Pe,N,U,Y))&&(oe[ne]=!0),ne++}),ue++,K=De}}),K}var I=o(M),F="_owner",$=Object.prototype.hasOwnProperty;function j(N,U,J,Y){var K=Object.keys(N),oe=K.length;if(Object.keys(U).length!==oe)return!1;for(var ue;oe-- >0;){if(ue=K[oe],ue===F){var Ie=!!N.$$typeof,ae=!!U.$$typeof;if((Ie||ae)&&Ie!==ae)return!1}if(!$.call(U,ue)||!J(N[ue],U[ue],ue,ue,N,U,Y))return!1}return!0}var q=o(j);function T(N,U){return N.source===U.source&&N.flags===U.flags}function E(N,U,J,Y){var K=N.size===U.size;if(!K)return!1;if(!N.size)return!0;var oe={};return N.forEach(function(ue,Ie){if(K){var ae=!1,De=0;U.forEach(function(ne,ie){!ae&&!oe[De]&&(ae=J(ue,ne,Ie,ie,N,U,Y))&&(oe[De]=!0),De++}),K=ae}}),K}var Z=o(E),me=Object.freeze({areArraysEqual:R,areDatesEqual:O,areMapsEqual:M,areObjectsEqual:j,areRegExpsEqual:T,areSetsEqual:E,createIsNestedEqual:r}),L=Object.freeze({areArraysEqual:m,areDatesEqual:O,areMapsEqual:I,areObjectsEqual:q,areRegExpsEqual:T,areSetsEqual:Z,createIsNestedEqual:r}),B=C(me);function ee(N,U){return B(N,U,void 0)}var se=C(a(me,{createIsNestedEqual:function(){return l}}));function fe(N,U){return se(N,U,void 0)}var ve=C(L);function ye(N,U){return ve(N,U,new WeakMap)}var Me=C(a(L,{createIsNestedEqual:function(){return l}}));function Be(N,U){return Me(N,U,new WeakMap)}function Ct(N){return C(a(me,N(me)))}function Ra(N){var U=C(a(L,N(L)));return function(J,Y,K){return K===void 0&&(K=new WeakMap),U(J,Y,K)}}n.circularDeepEqual=ye,n.circularShallowEqual=Be,n.createCustomCircularEqual=Ra,n.createCustomEqual=Ct,n.deepEqual=ee,n.sameValueZeroEqual=l,n.shallowEqual=fe,Object.defineProperty(n,"__esModule",{value:!0})})})(Pn,Pn.exports);var Gn=Pn.exports,W={},bi=function(t,n,r){return t===n?!0:t.className===n.className&&r(t.style,n.style)&&t.width===n.width&&t.autoSize===n.autoSize&&t.cols===n.cols&&t.draggableCancel===n.draggableCancel&&t.draggableHandle===n.draggableHandle&&r(t.verticalCompact,n.verticalCompact)&&r(t.compactType,n.compactType)&&r(t.layout,n.layout)&&r(t.margin,n.margin)&&r(t.containerPadding,n.containerPadding)&&t.rowHeight===n.rowHeight&&t.maxRows===n.maxRows&&t.isBounded===n.isBounded&&t.isDraggable===n.isDraggable&&t.isResizable===n.isResizable&&t.allowOverlap===n.allowOverlap&&t.preventCollision===n.preventCollision&&t.useCSSTransforms===n.useCSSTransforms&&t.transformScale===n.transformScale&&t.isDroppable===n.isDroppable&&r(t.resizeHandles,n.resizeHandles)&&r(t.resizeHandle,n.resizeHandle)&&t.onLayoutChange===n.onLayoutChange&&t.onDragStart===n.onDragStart&&t.onDrag===n.onDrag&&t.onDragStop===n.onDragStop&&t.onResizeStart===n.onResizeStart&&t.onResize===n.onResize&&t.onResizeStop===n.onResizeStop&&t.onDrop===n.onDrop&&r(t.droppingItem,n.droppingItem)&&r(t.innerRef,n.innerRef)};Object.defineProperty(W,"__esModule",{value:!0});W.bottom=Xn;W.childrenEqual=_i;W.cloneLayout=mo;W.cloneLayoutItem=Qe;W.collides=nn;W.compact=yo;W.compactItem=Co;W.compactType=Vi;W.correctBounds=So;W.fastPositionEqual=wi;W.fastRGLPropsEqual=void 0;W.getAllCollisions=bo;W.getFirstCollision=Ze;W.getLayoutItem=Yn;W.getStatics=Kn;W.modifyLayout=vo;W.moveElement=Ot;W.moveElementAwayFromCollision=Fn;W.noop=void 0;W.perc=xi;W.resizeItemInDirection=Ni;W.setTopLeft=$i;W.setTransform=Fi;W.sortLayoutItems=nr;W.sortLayoutItemsByColRow=Io;W.sortLayoutItemsByRowCol=wo;W.synchronizeLayoutWithChildren=ji;W.validateLayout=Li;W.withLayoutItem=Ri;var Ir=Gn,xt=Ti(w);function Ti(e){return e&&e.__esModule?e:{default:e}}function Xn(e){let t=0,n;for(let r=0,o=e.length;r<o;r++)n=e[r].y+e[r].h,n>t&&(t=n);return t}function mo(e){const t=Array(e.length);for(let n=0,r=e.length;n<r;n++)t[n]=Qe(e[n]);return t}function vo(e,t){const n=Array(e.length);for(let r=0,o=e.length;r<o;r++)t.i===e[r].i?n[r]=t:n[r]=e[r];return n}function Ri(e,t,n){let r=Yn(e,t);return r?(r=n(Qe(r)),e=vo(e,r),[e,r]):[e,null]}function Qe(e){return{w:e.w,h:e.h,x:e.x,y:e.y,i:e.i,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,moved:!!e.moved,static:!!e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,isBounded:e.isBounded}}function _i(e,t){return(0,Ir.deepEqual)(xt.default.Children.map(e,n=>n==null?void 0:n.key),xt.default.Children.map(t,n=>n==null?void 0:n.key))&&(0,Ir.deepEqual)(xt.default.Children.map(e,n=>n==null?void 0:n.props["data-grid"]),xt.default.Children.map(t,n=>n==null?void 0:n.props["data-grid"]))}W.fastRGLPropsEqual=bi;function wi(e,t){return e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height}function nn(e,t){return!(e.i===t.i||e.x+e.w<=t.x||e.x>=t.x+t.w||e.y+e.h<=t.y||e.y>=t.y+t.h)}function yo(e,t,n,r){const o=Kn(e),a=nr(e,t),i=Array(e.length);for(let c=0,l=a.length;c<l;c++){let u=Qe(a[c]);u.static||(u=Co(o,u,t,n,a,r),o.push(u)),i[e.indexOf(a[c])]=u,u.moved=!1}return i}const Ii={x:"w",y:"h"};function Nn(e,t,n,r){const o=Ii[r];t[r]+=1;const a=e.map(i=>i.i).indexOf(t.i);for(let i=a+1;i<e.length;i++){const c=e[i];if(!c.static){if(c.y>t.y+t.h)break;nn(t,c)&&Nn(e,c,n+t[o],r)}}t[r]=n}function Co(e,t,n,r,o,a){const i=n==="vertical",c=n==="horizontal";if(i)for(t.y=Math.min(Xn(e),t.y);t.y>0&&!Ze(e,t);)t.y--;else if(c)for(;t.x>0&&!Ze(e,t);)t.x--;let l;for(;(l=Ze(e,t))&&!(n===null&&a);)if(c?Nn(o,t,l.x+l.w,"x"):Nn(o,t,l.y+l.h,"y"),c&&t.x+t.w>r)for(t.x=r-t.w,t.y++;t.x>0&&!Ze(e,t);)t.x--;return t.y=Math.max(t.y,0),t.x=Math.max(t.x,0),t}function So(e,t){const n=Kn(e);for(let r=0,o=e.length;r<o;r++){const a=e[r];if(a.x+a.w>t.cols&&(a.x=t.cols-a.w),a.x<0&&(a.x=0,a.w=t.cols),!a.static)n.push(a);else for(;Ze(n,a);)a.y++}return e}function Yn(e,t){for(let n=0,r=e.length;n<r;n++)if(e[n].i===t)return e[n]}function Ze(e,t){for(let n=0,r=e.length;n<r;n++)if(nn(e[n],t))return e[n]}function bo(e,t){return e.filter(n=>nn(n,t))}function Kn(e){return e.filter(t=>t.static)}function Ot(e,t,n,r,o,a,i,c,l){if(t.static&&t.isDraggable!==!0||t.y===r&&t.x===n)return e;`${t.i}${String(n)}${String(r)}${t.x}${t.y}`;const u=t.x,d=t.y;typeof n=="number"&&(t.x=n),typeof r=="number"&&(t.y=r),t.moved=!0;let h=nr(e,i);(i==="vertical"&&typeof r=="number"?d>=r:i==="horizontal"&&typeof n=="number"?u>=n:!1)&&(h=h.reverse());const v=bo(h,t),y=v.length>0;if(y&&l)return mo(e);if(y&&a)return`${t.i}`,t.x=u,t.y=d,t.moved=!1,e;for(let b=0,x=v.length;b<x;b++){const _=v[b];`${t.i}${t.x}${t.y}${_.i}${_.x}${_.y}`,!_.moved&&(_.static?e=Fn(e,_,t,o,i):e=Fn(e,t,_,o,i))}return e}function Fn(e,t,n,r,o,a){const i=o==="horizontal",c=o==="vertical",l=t.static;if(r){r=!1;const h={x:i?Math.max(t.x-n.w,0):n.x,y:c?Math.max(t.y-n.h,0):n.y,w:n.w,h:n.h,i:"-1"},f=Ze(e,h),v=f&&f.y+f.h>t.y,y=f&&t.x+t.w>f.x;if(f){if(v&&c)return Ot(e,n,void 0,t.y+1,r,l,o);if(v&&o==null)return t.y=n.y,n.y=n.y+n.h,e;if(y&&i)return Ot(e,t,n.x,void 0,r,l,o)}else return`${n.i}${h.x}${h.y}`,Ot(e,n,i?h.x:void 0,c?h.y:void 0,r,l,o)}const u=i?n.x+1:void 0,d=c?n.y+1:void 0;return u==null&&d==null?e:Ot(e,n,i?n.x+1:void 0,c?n.y+1:void 0,r,l,o)}function xi(e){return e*100+"%"}const To=(e,t,n,r)=>e+n>r?t:n,Ro=(e,t,n)=>e<0?t:n,_o=e=>Math.max(0,e),Zn=e=>Math.max(0,e),Jn=(e,t,n)=>{let{left:r,height:o,width:a}=t;const i=e.top-(o-e.height);return{left:r,width:a,height:Ro(i,e.height,o),top:Zn(i)}},Qn=(e,t,n)=>{let{top:r,left:o,height:a,width:i}=t;return{top:r,height:a,width:To(e.left,e.width,i,n),left:_o(o)}},er=(e,t,n)=>{let{top:r,height:o,width:a}=t;const i=e.left-(a-e.width);return{height:o,width:i<0?e.width:To(e.left,e.width,a,n),top:Zn(r),left:_o(i)}},tr=(e,t,n)=>{let{top:r,left:o,height:a,width:i}=t;return{width:i,left:o,height:Ro(r,e.height,a),top:Zn(r)}},Oi=function(){return Jn(arguments.length<=0?void 0:arguments[0],Qn(...arguments))},Ei=function(){return Jn(arguments.length<=0?void 0:arguments[0],er(...arguments))},Mi=function(){return tr(arguments.length<=0?void 0:arguments[0],Qn(...arguments))},Di=function(){return tr(arguments.length<=0?void 0:arguments[0],er(...arguments))},Pi={n:Jn,ne:Oi,e:Qn,se:Mi,s:tr,sw:Di,w:er,nw:Ei};function Ni(e,t,n,r){const o=Pi[e];return o?o(t,{...t,...n},r):n}function Fi(e){let{top:t,left:n,width:r,height:o}=e;const a=`translate(${n}px,${t}px)`;return{transform:a,WebkitTransform:a,MozTransform:a,msTransform:a,OTransform:a,width:`${r}px`,height:`${o}px`,position:"absolute"}}function $i(e){let{top:t,left:n,width:r,height:o}=e;return{top:`${t}px`,left:`${n}px`,width:`${r}px`,height:`${o}px`,position:"absolute"}}function nr(e,t){return t==="horizontal"?Io(e):t==="vertical"?wo(e):e}function wo(e){return e.slice(0).sort(function(t,n){return t.y>n.y||t.y===n.y&&t.x>n.x?1:t.y===n.y&&t.x===n.x?0:-1})}function Io(e){return e.slice(0).sort(function(t,n){return t.x>n.x||t.x===n.x&&t.y>n.y?1:-1})}function ji(e,t,n,r,o){e=e||[];const a=[];xt.default.Children.forEach(t,c=>{if((c==null?void 0:c.key)==null)return;const l=Yn(e,String(c.key)),u=c.props["data-grid"];l&&u==null?a.push(Qe(l)):u?a.push(Qe({...u,i:c.key})):a.push(Qe({w:1,h:1,x:0,y:Xn(a),i:String(c.key)}))});const i=So(a,{cols:n});return o?i:yo(i,r,n)}function Li(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Layout";const n=["x","y","w","h"];if(!Array.isArray(e))throw new Error(t+" must be an array!");for(let r=0,o=e.length;r<o;r++){const a=e[r];for(let i=0;i<n.length;i++)if(typeof a[n[i]]!="number")throw new Error("ReactGridLayout: "+t+"["+r+"]."+n[i]+" must be a number!")}}function Vi(e){const{verticalCompact:t,compactType:n}=e||{};return t===!1?null:n}const Ui=()=>{};W.noop=Ui;var $e={};Object.defineProperty($e,"__esModule",{value:!0});$e.calcGridColWidth=rn;$e.calcGridItemPosition=zi;$e.calcGridItemWHPx=$n;$e.calcWH=ki;$e.calcXY=Ai;$e.clamp=Je;function rn(e){const{margin:t,containerPadding:n,containerWidth:r,cols:o}=e;return(r-t[0]*(o-1)-n[0]*2)/o}function $n(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function zi(e,t,n,r,o,a){const{margin:i,containerPadding:c,rowHeight:l}=e,u=rn(e),d={};return a&&a.resizing?(d.width=Math.round(a.resizing.width),d.height=Math.round(a.resizing.height)):(d.width=$n(r,u,i[0]),d.height=$n(o,l,i[1])),a&&a.dragging?(d.top=Math.round(a.dragging.top),d.left=Math.round(a.dragging.left)):a&&a.resizing&&typeof a.resizing.top=="number"&&typeof a.resizing.left=="number"?(d.top=Math.round(a.resizing.top),d.left=Math.round(a.resizing.left)):(d.top=Math.round((l+i[1])*n+c[1]),d.left=Math.round((u+i[0])*t+c[0])),d}function Ai(e,t,n,r,o){const{margin:a,cols:i,rowHeight:c,maxRows:l}=e,u=rn(e);let d=Math.round((n-a[0])/(u+a[0])),h=Math.round((t-a[1])/(c+a[1]));return d=Je(d,0,i-r),h=Je(h,0,l-o),{x:d,y:h}}function ki(e,t,n,r,o,a){const{margin:i,maxRows:c,cols:l,rowHeight:u}=e,d=rn(e);let h=Math.round((t+i[0])/(d+i[0])),f=Math.round((n+i[1])/(u+i[1])),v=Je(h,0,l-r),y=Je(f,0,c-o);return["sw","w","nw"].indexOf(a)!==-1&&(v=Je(h,0,l)),["nw","n","ne"].indexOf(a)!==-1&&(y=Je(f,0,c)),{w:v,h:y}}function Je(e,t,n){return Math.max(Math.min(e,n),t)}var on={},xo={exports:{}},Hi="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",Wi=Hi,qi=Wi;function Oo(){}function Eo(){}Eo.resetWarningCache=Oo;var Bi=function(){function e(r,o,a,i,c,l){if(l!==qi){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:Eo,resetWarningCache:Oo};return n.PropTypes=n,n};xo.exports=Bi();var qe=xo.exports,an={exports:{}},Mo={},re={},je={};Object.defineProperty(je,"__esModule",{value:!0});je.dontSetMe=Zi;je.findInArray=Gi;je.int=Ki;je.isFunction=Xi;je.isNum=Yi;function Gi(e,t){for(let n=0,r=e.length;n<r;n++)if(t.apply(t,[e[n],n,e]))return e[n]}function Xi(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Function]"}function Yi(e){return typeof e=="number"&&!isNaN(e)}function Ki(e){return parseInt(e,10)}function Zi(e,t,n){if(e[t])return new Error("Invalid prop ".concat(t," passed to ").concat(n," - do not set this, set it on the child."))}var ot={};Object.defineProperty(ot,"__esModule",{value:!0});ot.browserPrefixToKey=Po;ot.browserPrefixToStyle=Ji;ot.default=void 0;ot.getPrefix=Do;const bn=["Moz","Webkit","O","ms"];function Do(){var e;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const n=(e=window.document)===null||e===void 0||(e=e.documentElement)===null||e===void 0?void 0:e.style;if(!n||t in n)return"";for(let r=0;r<bn.length;r++)if(Po(t,bn[r])in n)return bn[r];return""}function Po(e,t){return t?"".concat(t).concat(Qi(e)):e}function Ji(e,t){return t?"-".concat(t.toLowerCase(),"-").concat(e):e}function Qi(e){let t="",n=!0;for(let r=0;r<e.length;r++)n?(t+=e[r].toUpperCase(),n=!1):e[r]==="-"?n=!0:t+=e[r];return t}ot.default=Do();Object.defineProperty(re,"__esModule",{value:!0});re.addClassName=$o;re.addEvent=ns;re.addUserSelectStyles=ps;re.createCSSTransform=cs;re.createSVGTransform=us;re.getTouch=ds;re.getTouchIdentifier=fs;re.getTranslation=rr;re.innerHeight=is;re.innerWidth=ss;re.matchesSelector=Fo;re.matchesSelectorAndParentsTo=ts;re.offsetXYFromParent=ls;re.outerHeight=os;re.outerWidth=as;re.removeClassName=jo;re.removeEvent=rs;re.removeUserSelectStyles=hs;var we=je,xr=es(ot);function No(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(No=function(r){return r?n:t})(e)}function es(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=No(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(a!=="default"&&Object.prototype.hasOwnProperty.call(e,a)){var i=o?Object.getOwnPropertyDescriptor(e,a):null;i&&(i.get||i.set)?Object.defineProperty(r,a,i):r[a]=e[a]}return r.default=e,n&&n.set(e,r),r}let jt="";function Fo(e,t){return jt||(jt=(0,we.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(n){return(0,we.isFunction)(e[n])})),(0,we.isFunction)(e[jt])?e[jt](t):!1}function ts(e,t,n){let r=e;do{if(Fo(r,t))return!0;if(r===n)return!1;r=r.parentNode}while(r);return!1}function ns(e,t,n,r){if(!e)return;const o={capture:!0,...r};e.addEventListener?e.addEventListener(t,n,o):e.attachEvent?e.attachEvent("on"+t,n):e["on"+t]=n}function rs(e,t,n,r){if(!e)return;const o={capture:!0,...r};e.removeEventListener?e.removeEventListener(t,n,o):e.detachEvent?e.detachEvent("on"+t,n):e["on"+t]=null}function os(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,we.int)(n.borderTopWidth),t+=(0,we.int)(n.borderBottomWidth),t}function as(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,we.int)(n.borderLeftWidth),t+=(0,we.int)(n.borderRightWidth),t}function is(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,we.int)(n.paddingTop),t-=(0,we.int)(n.paddingBottom),t}function ss(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,we.int)(n.paddingLeft),t-=(0,we.int)(n.paddingRight),t}function ls(e,t,n){const o=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect(),a=(e.clientX+t.scrollLeft-o.left)/n,i=(e.clientY+t.scrollTop-o.top)/n;return{x:a,y:i}}function cs(e,t){const n=rr(e,t,"px");return{[(0,xr.browserPrefixToKey)("transform",xr.default)]:n}}function us(e,t){return rr(e,t,"")}function rr(e,t,n){let{x:r,y:o}=e,a="translate(".concat(r).concat(n,",").concat(o).concat(n,")");if(t){const i="".concat(typeof t.x=="string"?t.x:t.x+n),c="".concat(typeof t.y=="string"?t.y:t.y+n);a="translate(".concat(i,", ").concat(c,")")+a}return a}function ds(e,t){return e.targetTouches&&(0,we.findInArray)(e.targetTouches,n=>t===n.identifier)||e.changedTouches&&(0,we.findInArray)(e.changedTouches,n=>t===n.identifier)}function fs(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function ps(e){if(!e)return;let t=e.getElementById("react-draggable-style-el");t||(t=e.createElement("style"),t.type="text/css",t.id="react-draggable-style-el",t.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
9
+ */var Ui=I,Vi=Symbol.for("react.element"),ki=Symbol.for("react.fragment"),Wi=Object.prototype.hasOwnProperty,zi=Ui.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Ai={key:!0,ref:!0,__self:!0,__source:!0};function uo(e,t,n){var r,o={},i=null,a=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(a=t.ref);for(r in t)Wi.call(t,r)&&!Ai.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)o[r]===void 0&&(o[r]=t[r]);return{$$typeof:Vi,type:e,key:i,ref:a,props:o,_owner:zi.current}}nn.Fragment=ki;nn.jsx=uo;nn.jsxs=uo;co.exports=nn;var h=co.exports;const Hi="univer-conditional-formatting-wrap",qi="univer-cf-rule-item",Bi="univer-preview",Gi="univer-create-rule",Xi="univer-button",Yi="univer-title",Ki="univer-label",Zi="univer-label-container",Ji="univer-input-width",Qi="univer-m-t-base",ea="univer-m-t-sm",ta="univer-m-t-xl",na="univer-m-l-sm",ra="univer-m-l-xl",oa="univer-m-l-xxs",ia="univer-m-l-0",aa="univer-m-r-0",D={conditionalFormattingWrap:Hi,cfRuleItem:qi,preview:Bi,createRule:Gi,button:Xi,title:Yi,label:Ki,labelContainer:Zi,inputWidth:Ji,mTBase:Qi,mTSm:ea,mTXl:ta,mLSm:na,mLXl:ra,mLXxs:oa,mL0:ia,mR0:aa};var Ee=function(){return Ee=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},Ee.apply(this,arguments)},sa=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n},Ct=I.forwardRef(function(e,t){var n=e.icon,r=e.id,o=e.className,i=e.extend,a=sa(e,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(r," ").concat(o||"").trim(),l=I.useRef("_".concat(ua()));return fo(n,"".concat(r),{defIds:n.defIds,idSuffix:l.current},Ee({ref:t,className:c},a),i)});function fo(e,t,n,r,o){return I.createElement(e.tag,Ee(Ee({key:t},la(e,n,o)),r),(ca(e,n).children||[]).map(function(i,a){return fo(i,"".concat(t,"-").concat(e.tag,"-").concat(a),n,void 0,o)}))}function la(e,t,n){var r=Ee({},e.attrs);n!=null&&n.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=n.colorChannel1);var o=t.defIds;return!o||o.length===0||(e.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+t.idSuffix),Object.entries(r).forEach(function(i){var a=i[0],c=i[1];typeof c=="string"&&(r[a]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),r}function ca(e,t){var n,r=t.defIds;return!r||r.length===0?e:e.tag==="defs"&&(!((n=e.children)===null||n===void 0)&&n.length)?Ee(Ee({},e),{children:e.children.map(function(o){return typeof o.attrs.id=="string"&&r&&r.indexOf(o.attrs.id)>-1?Ee(Ee({},o),{attrs:Ee(Ee({},o.attrs),{id:o.attrs.id+t.idSuffix})}):o})}):e}function ua(){return Math.random().toString(36).substring(2,8)}Ct.displayName="UniverIcon";var da={tag:"svg",attrs:{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.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.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.64443 14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443zM6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928 9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171 10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778 9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539 9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263 6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539 5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778 6.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"}}]},po=I.forwardRef(function(e,t){return I.createElement(Ct,Object.assign({},e,{id:"delete-single",ref:t,icon:da}))});po.displayName="DeleteSingle";const Rn=po;var fa={tag:"svg",attrs:{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"}}]},ho=I.forwardRef(function(e,t){return I.createElement(Ct,Object.assign({},e,{id:"increase-single",ref:t,icon:fa}))});ho.displayName="IncreaseSingle";const pa=ho;var ha={tag:"svg",attrs:{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"}}]},go=I.forwardRef(function(e,t){return I.createElement(Ct,Object.assign({},e,{id:"more-down-single",ref:t,icon:ha}))});go.displayName="MoreDownSingle";const Kn=go;var ga={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"mask",attrs:{id:"mask0_622_8",style:{maskType:"alpha"},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 4 7 3.44772 6.55228 3 6 3 5.44772 3 5 3.44772 5 4 5 4.55228 5.44772 5 6 5zM6 9C6.55228 9 7 8.55229 7 8 7 7.44772 6.55228 7 6 7 5.44772 7 5 7.44772 5 8 5 8.55229 5.44772 9 6 9zM7 12C7 12.5523 6.55228 13 6 13 5.44772 13 5 12.5523 5 12 5 11.4477 5.44772 11 6 11 6.55228 11 7 11.4477 7 12zM10 5C10.5523 5 11 4.55228 11 4 11 3.44772 10.5523 3 10 3 9.44771 3 9 3.44772 9 4 9 4.55228 9.44771 5 10 5zM11 8C11 8.55229 10.5523 9 10 9 9.44771 9 9 8.55229 9 8 9 7.44772 9.44771 7 10 7 10.5523 7 11 7.44772 11 8zM10 13C10.5523 13 11 12.5523 11 12 11 11.4477 10.5523 11 10 11 9.44771 11 9 11.4477 9 12 9 12.5523 9.44771 13 10 13z"}}]}]},mo=I.forwardRef(function(e,t){return I.createElement(Ct,Object.assign({},e,{id:"sequence-single",ref:t,icon:ga}))});mo.displayName="SequenceSingle";const ma=mo;var va={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"mask",attrs:{id:"mask0_436_41",style:{maskType:"alpha"},width:17,height:17,x:0,y:0,maskUnits:"userSpaceOnUse"},children:[{tag:"path",attrs:{fill:"#D9D9D9",d:"M0.35 0.48H16.35V16.48H0.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"}}]}]},vo=I.forwardRef(function(e,t){return I.createElement(Ct,Object.assign({},e,{id:"slash-single",ref:t,icon:va}))});vo.displayName="SlashSingle";const rn=vo;var yo={exports:{}},jt={},$n={exports:{}};(function(e,t){(function(n,r){r(t)})(He,function(n){function r(M){return function(Z,X,G,ne,ie,me,Q){return M(Z,X,Q)}}function o(M){return function(Z,X,G,ne){if(!Z||!X||typeof Z!="object"||typeof X!="object")return M(Z,X,G,ne);var ie=ne.get(Z),me=ne.get(X);if(ie&&me)return ie===X&&me===Z;ne.set(Z,X),ne.set(X,Z);var Q=M(Z,X,G,ne);return ne.delete(Z),ne.delete(X),Q}}function i(M,U){var Z={};for(var X in M)Z[X]=M[X];for(var X in U)Z[X]=U[X];return Z}function a(M){return M.constructor===Object||M.constructor==null}function c(M){return typeof M.then=="function"}function l(M,U){return M===U||M!==M&&U!==U}var u="[object Arguments]",d="[object Boolean]",p="[object Date]",f="[object RegExp]",v="[object Map]",y="[object Number]",S="[object Object]",x="[object Set]",_="[object String]",b=Object.prototype.toString;function C(M){var U=M.areArraysEqual,Z=M.areDatesEqual,X=M.areMapsEqual,G=M.areObjectsEqual,ne=M.areRegExpsEqual,ie=M.areSetsEqual,me=M.createIsNestedEqual,Q=me(je);function je(re,se,$e){if(re===se)return!0;if(!re||!se||typeof re!="object"||typeof se!="object")return re!==re&&se!==se;if(a(re)&&a(se))return G(re,se,Q,$e);var xr=Array.isArray(re),Or=Array.isArray(se);if(xr||Or)return xr===Or&&U(re,se,Q,$e);var Le=b.call(re);return Le!==b.call(se)?!1:Le===p?Z(re,se,Q,$e):Le===f?ne(re,se,Q,$e):Le===v?X(re,se,Q,$e):Le===x?ie(re,se,Q,$e):Le===S||Le===u?c(re)||c(se)?!1:G(re,se,Q,$e):Le===d||Le===y||Le===_?l(re.valueOf(),se.valueOf()):!1}return je}function T(M,U,Z,X){var G=M.length;if(U.length!==G)return!1;for(;G-- >0;)if(!Z(M[G],U[G],G,G,M,U,X))return!1;return!0}var m=o(T);function O(M,U){return l(M.valueOf(),U.valueOf())}function E(M,U,Z,X){var G=M.size===U.size;if(!G)return!1;if(!M.size)return!0;var ne={},ie=0;return M.forEach(function(me,Q){if(G){var je=!1,re=0;U.forEach(function(se,$e){!je&&!ne[re]&&(je=Z(Q,$e,ie,re,M,U,X)&&Z(me,se,Q,$e,M,U,X))&&(ne[re]=!0),re++}),ie++,G=je}}),G}var w=o(E),F="_owner",j=Object.prototype.hasOwnProperty;function L(M,U,Z,X){var G=Object.keys(M),ne=G.length;if(Object.keys(U).length!==ne)return!1;for(var ie;ne-- >0;){if(ie=G[ne],ie===F){var me=!!M.$$typeof,Q=!!U.$$typeof;if((me||Q)&&me!==Q)return!1}if(!j.call(U,ie)||!Z(M[ie],U[ie],ie,ie,M,U,X))return!1}return!0}var q=o(L);function R(M,U){return M.source===U.source&&M.flags===U.flags}function P(M,U,Z,X){var G=M.size===U.size;if(!G)return!1;if(!M.size)return!0;var ne={};return M.forEach(function(ie,me){if(G){var Q=!1,je=0;U.forEach(function(re,se){!Q&&!ne[je]&&(Q=Z(ie,re,me,se,M,U,X))&&(ne[je]=!0),je++}),G=Q}}),G}var J=o(P),Se=Object.freeze({areArraysEqual:T,areDatesEqual:O,areMapsEqual:E,areObjectsEqual:L,areRegExpsEqual:R,areSetsEqual:P,createIsNestedEqual:r}),he=Object.freeze({areArraysEqual:m,areDatesEqual:O,areMapsEqual:w,areObjectsEqual:q,areRegExpsEqual:R,areSetsEqual:J,createIsNestedEqual:r}),ge=C(Se);function Pe(M,U){return ge(M,U,void 0)}var k=C(i(Se,{createIsNestedEqual:function(){return l}}));function K(M,U){return k(M,U,void 0)}var oe=C(he);function de(M,U){return oe(M,U,new WeakMap)}var ce=C(i(he,{createIsNestedEqual:function(){return l}}));function fe(M,U){return ce(M,U,new WeakMap)}function Oe(M){return C(i(Se,M(Se)))}function De(M){var U=C(i(he,M(he)));return function(Z,X,G){return G===void 0&&(G=new WeakMap),U(Z,X,G)}}n.circularDeepEqual=de,n.circularShallowEqual=fe,n.createCustomCircularEqual=De,n.createCustomEqual=Oe,n.deepEqual=Pe,n.sameValueZeroEqual=l,n.shallowEqual=K,Object.defineProperty(n,"__esModule",{value:!0})})})($n,$n.exports);var Zn=$n.exports,H={},ya=function(t,n,r){return t===n?!0:t.className===n.className&&r(t.style,n.style)&&t.width===n.width&&t.autoSize===n.autoSize&&t.cols===n.cols&&t.draggableCancel===n.draggableCancel&&t.draggableHandle===n.draggableHandle&&r(t.verticalCompact,n.verticalCompact)&&r(t.compactType,n.compactType)&&r(t.layout,n.layout)&&r(t.margin,n.margin)&&r(t.containerPadding,n.containerPadding)&&t.rowHeight===n.rowHeight&&t.maxRows===n.maxRows&&t.isBounded===n.isBounded&&t.isDraggable===n.isDraggable&&t.isResizable===n.isResizable&&t.allowOverlap===n.allowOverlap&&t.preventCollision===n.preventCollision&&t.useCSSTransforms===n.useCSSTransforms&&t.transformScale===n.transformScale&&t.isDroppable===n.isDroppable&&r(t.resizeHandles,n.resizeHandles)&&r(t.resizeHandle,n.resizeHandle)&&t.onLayoutChange===n.onLayoutChange&&t.onDragStart===n.onDragStart&&t.onDrag===n.onDrag&&t.onDragStop===n.onDragStop&&t.onResizeStart===n.onResizeStart&&t.onResize===n.onResize&&t.onResizeStop===n.onResizeStop&&t.onDrop===n.onDrop&&r(t.droppingItem,n.droppingItem)&&r(t.innerRef,n.innerRef)};Object.defineProperty(H,"__esModule",{value:!0});H.bottom=Jn;H.childrenEqual=ba;H.cloneLayout=Co;H.cloneLayoutItem=nt;H.collides=on;H.compact=bo;H.compactItem=To;H.compactType=ja;H.correctBounds=Ro;H.fastPositionEqual=Ta;H.fastRGLPropsEqual=void 0;H.getAllCollisions=_o;H.getFirstCollision=et;H.getLayoutItem=Qn;H.getStatics=er;H.modifyLayout=So;H.moveElement=Dt;H.moveElementAwayFromCollision=Un;H.noop=void 0;H.perc=_a;H.resizeItemInDirection=Pa;H.setTopLeft=Ma;H.setTransform=Da;H.sortLayoutItems=ar;H.sortLayoutItemsByColRow=Eo;H.sortLayoutItemsByRowCol=Oo;H.synchronizeLayoutWithChildren=Na;H.validateLayout=Fa;H.withLayoutItem=Sa;var Pr=Zn,Pt=Ca(I);function Ca(e){return e&&e.__esModule?e:{default:e}}function Jn(e){let t=0,n;for(let r=0,o=e.length;r<o;r++)n=e[r].y+e[r].h,n>t&&(t=n);return t}function Co(e){const t=Array(e.length);for(let n=0,r=e.length;n<r;n++)t[n]=nt(e[n]);return t}function So(e,t){const n=Array(e.length);for(let r=0,o=e.length;r<o;r++)t.i===e[r].i?n[r]=t:n[r]=e[r];return n}function Sa(e,t,n){let r=Qn(e,t);return r?(r=n(nt(r)),e=So(e,r),[e,r]):[e,null]}function nt(e){return{w:e.w,h:e.h,x:e.x,y:e.y,i:e.i,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,moved:!!e.moved,static:!!e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,isBounded:e.isBounded}}function ba(e,t){return(0,Pr.deepEqual)(Pt.default.Children.map(e,n=>n==null?void 0:n.key),Pt.default.Children.map(t,n=>n==null?void 0:n.key))&&(0,Pr.deepEqual)(Pt.default.Children.map(e,n=>n==null?void 0:n.props["data-grid"]),Pt.default.Children.map(t,n=>n==null?void 0:n.props["data-grid"]))}H.fastRGLPropsEqual=ya;function Ta(e,t){return e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height}function on(e,t){return!(e.i===t.i||e.x+e.w<=t.x||e.x>=t.x+t.w||e.y+e.h<=t.y||e.y>=t.y+t.h)}function bo(e,t,n,r){const o=er(e),i=ar(e,t),a=Array(e.length);for(let c=0,l=i.length;c<l;c++){let u=nt(i[c]);u.static||(u=To(o,u,t,n,i,r),o.push(u)),a[e.indexOf(i[c])]=u,u.moved=!1}return a}const Ra={x:"w",y:"h"};function Ln(e,t,n,r){const o=Ra[r];t[r]+=1;const i=e.map(a=>a.i).indexOf(t.i);for(let a=i+1;a<e.length;a++){const c=e[a];if(!c.static){if(c.y>t.y+t.h)break;on(t,c)&&Ln(e,c,n+t[o],r)}}t[r]=n}function To(e,t,n,r,o,i){const a=n==="vertical",c=n==="horizontal";if(a)for(t.y=Math.min(Jn(e),t.y);t.y>0&&!et(e,t);)t.y--;else if(c)for(;t.x>0&&!et(e,t);)t.x--;let l;for(;(l=et(e,t))&&!(n===null&&i);)if(c?Ln(o,t,l.x+l.w,"x"):Ln(o,t,l.y+l.h,"y"),c&&t.x+t.w>r)for(t.x=r-t.w,t.y++;t.x>0&&!et(e,t);)t.x--;return t.y=Math.max(t.y,0),t.x=Math.max(t.x,0),t}function Ro(e,t){const n=er(e);for(let r=0,o=e.length;r<o;r++){const i=e[r];if(i.x+i.w>t.cols&&(i.x=t.cols-i.w),i.x<0&&(i.x=0,i.w=t.cols),!i.static)n.push(i);else for(;et(n,i);)i.y++}return e}function Qn(e,t){for(let n=0,r=e.length;n<r;n++)if(e[n].i===t)return e[n]}function et(e,t){for(let n=0,r=e.length;n<r;n++)if(on(e[n],t))return e[n]}function _o(e,t){return e.filter(n=>on(n,t))}function er(e){return e.filter(t=>t.static)}function Dt(e,t,n,r,o,i,a,c,l){if(t.static&&t.isDraggable!==!0||t.y===r&&t.x===n)return e;`${t.i}${String(n)}${String(r)}${t.x}${t.y}`;const u=t.x,d=t.y;typeof n=="number"&&(t.x=n),typeof r=="number"&&(t.y=r),t.moved=!0;let p=ar(e,a);(a==="vertical"&&typeof r=="number"?d>=r:a==="horizontal"&&typeof n=="number"?u>=n:!1)&&(p=p.reverse());const v=_o(p,t),y=v.length>0;if(y&&l)return Co(e);if(y&&i)return`${t.i}`,t.x=u,t.y=d,t.moved=!1,e;for(let S=0,x=v.length;S<x;S++){const _=v[S];`${t.i}${t.x}${t.y}${_.i}${_.x}${_.y}`,!_.moved&&(_.static?e=Un(e,_,t,o,a):e=Un(e,t,_,o,a))}return e}function Un(e,t,n,r,o,i){const a=o==="horizontal",c=o==="vertical",l=t.static;if(r){r=!1;const p={x:a?Math.max(t.x-n.w,0):n.x,y:c?Math.max(t.y-n.h,0):n.y,w:n.w,h:n.h,i:"-1"},f=et(e,p),v=f&&f.y+f.h>t.y,y=f&&t.x+t.w>f.x;if(f){if(v&&c)return Dt(e,n,void 0,t.y+1,r,l,o);if(v&&o==null)return t.y=n.y,n.y=n.y+n.h,e;if(y&&a)return Dt(e,t,n.x,void 0,r,l,o)}else return`${n.i}${p.x}${p.y}`,Dt(e,n,a?p.x:void 0,c?p.y:void 0,r,l,o)}const u=a?n.x+1:void 0,d=c?n.y+1:void 0;return u==null&&d==null?e:Dt(e,n,a?n.x+1:void 0,c?n.y+1:void 0,r,l,o)}function _a(e){return e*100+"%"}const wo=(e,t,n,r)=>e+n>r?t:n,Io=(e,t,n)=>e<0?t:n,xo=e=>Math.max(0,e),tr=e=>Math.max(0,e),nr=(e,t,n)=>{let{left:r,height:o,width:i}=t;const a=e.top-(o-e.height);return{left:r,width:i,height:Io(a,e.height,o),top:tr(a)}},rr=(e,t,n)=>{let{top:r,left:o,height:i,width:a}=t;return{top:r,height:i,width:wo(e.left,e.width,a,n),left:xo(o)}},or=(e,t,n)=>{let{top:r,height:o,width:i}=t;const a=e.left-(i-e.width);return{height:o,width:a<0?e.width:wo(e.left,e.width,i,n),top:tr(r),left:xo(a)}},ir=(e,t,n)=>{let{top:r,left:o,height:i,width:a}=t;return{width:a,left:o,height:Io(r,e.height,i),top:tr(r)}},wa=function(){return nr(arguments.length<=0?void 0:arguments[0],rr(...arguments))},Ia=function(){return nr(arguments.length<=0?void 0:arguments[0],or(...arguments))},xa=function(){return ir(arguments.length<=0?void 0:arguments[0],rr(...arguments))},Oa=function(){return ir(arguments.length<=0?void 0:arguments[0],or(...arguments))},Ea={n:nr,ne:wa,e:rr,se:xa,s:ir,sw:Oa,w:or,nw:Ia};function Pa(e,t,n,r){const o=Ea[e];return o?o(t,{...t,...n},r):n}function Da(e){let{top:t,left:n,width:r,height:o}=e;const i=`translate(${n}px,${t}px)`;return{transform:i,WebkitTransform:i,MozTransform:i,msTransform:i,OTransform:i,width:`${r}px`,height:`${o}px`,position:"absolute"}}function Ma(e){let{top:t,left:n,width:r,height:o}=e;return{top:`${t}px`,left:`${n}px`,width:`${r}px`,height:`${o}px`,position:"absolute"}}function ar(e,t){return t==="horizontal"?Eo(e):t==="vertical"?Oo(e):e}function Oo(e){return e.slice(0).sort(function(t,n){return t.y>n.y||t.y===n.y&&t.x>n.x?1:t.y===n.y&&t.x===n.x?0:-1})}function Eo(e){return e.slice(0).sort(function(t,n){return t.x>n.x||t.x===n.x&&t.y>n.y?1:-1})}function Na(e,t,n,r,o){e=e||[];const i=[];Pt.default.Children.forEach(t,c=>{if((c==null?void 0:c.key)==null)return;const l=Qn(e,String(c.key)),u=c.props["data-grid"];l&&u==null?i.push(nt(l)):u?i.push(nt({...u,i:c.key})):i.push(nt({w:1,h:1,x:0,y:Jn(i),i:String(c.key)}))});const a=Ro(i,{cols:n});return o?a:bo(a,r,n)}function Fa(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Layout";const n=["x","y","w","h"];if(!Array.isArray(e))throw new Error(t+" must be an array!");for(let r=0,o=e.length;r<o;r++){const i=e[r];for(let a=0;a<n.length;a++)if(typeof i[n[a]]!="number")throw new Error("ReactGridLayout: "+t+"["+r+"]."+n[a]+" must be a number!")}}function ja(e){const{verticalCompact:t,compactType:n}=e||{};return t===!1?null:n}const $a=()=>{};H.noop=$a;var Ve={};Object.defineProperty(Ve,"__esModule",{value:!0});Ve.calcGridColWidth=an;Ve.calcGridItemPosition=La;Ve.calcGridItemWHPx=Vn;Ve.calcWH=Va;Ve.calcXY=Ua;Ve.clamp=tt;function an(e){const{margin:t,containerPadding:n,containerWidth:r,cols:o}=e;return(r-t[0]*(o-1)-n[0]*2)/o}function Vn(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function La(e,t,n,r,o,i){const{margin:a,containerPadding:c,rowHeight:l}=e,u=an(e),d={};return i&&i.resizing?(d.width=Math.round(i.resizing.width),d.height=Math.round(i.resizing.height)):(d.width=Vn(r,u,a[0]),d.height=Vn(o,l,a[1])),i&&i.dragging?(d.top=Math.round(i.dragging.top),d.left=Math.round(i.dragging.left)):i&&i.resizing&&typeof i.resizing.top=="number"&&typeof i.resizing.left=="number"?(d.top=Math.round(i.resizing.top),d.left=Math.round(i.resizing.left)):(d.top=Math.round((l+a[1])*n+c[1]),d.left=Math.round((u+a[0])*t+c[0])),d}function Ua(e,t,n,r,o){const{margin:i,cols:a,rowHeight:c,maxRows:l}=e,u=an(e);let d=Math.round((n-i[0])/(u+i[0])),p=Math.round((t-i[1])/(c+i[1]));return d=tt(d,0,a-r),p=tt(p,0,l-o),{x:d,y:p}}function Va(e,t,n,r,o,i){const{margin:a,maxRows:c,cols:l,rowHeight:u}=e,d=an(e);let p=Math.round((t+a[0])/(d+a[0])),f=Math.round((n+a[1])/(u+a[1])),v=tt(p,0,l-r),y=tt(f,0,c-o);return["sw","w","nw"].indexOf(i)!==-1&&(v=tt(p,0,l)),["nw","n","ne"].indexOf(i)!==-1&&(y=tt(f,0,c)),{w:v,h:y}}function tt(e,t,n){return Math.max(Math.min(e,n),t)}var sn={},Po={exports:{}},ka="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",Wa=ka,za=Wa;function Do(){}function Mo(){}Mo.resetWarningCache=Do;var Aa=function(){function e(r,o,i,a,c,l){if(l!==za){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:Mo,resetWarningCache:Do};return n.PropTypes=n,n};Po.exports=Aa();var Ke=Po.exports,ln={exports:{}},No={},ae={},ke={};Object.defineProperty(ke,"__esModule",{value:!0});ke.dontSetMe=Xa;ke.findInArray=Ha;ke.int=Ga;ke.isFunction=qa;ke.isNum=Ba;function Ha(e,t){for(let n=0,r=e.length;n<r;n++)if(t.apply(t,[e[n],n,e]))return e[n]}function qa(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Function]"}function Ba(e){return typeof e=="number"&&!isNaN(e)}function Ga(e){return parseInt(e,10)}function Xa(e,t,n){if(e[t])return new Error("Invalid prop ".concat(t," passed to ").concat(n," - do not set this, set it on the child."))}var at={};Object.defineProperty(at,"__esModule",{value:!0});at.browserPrefixToKey=jo;at.browserPrefixToStyle=Ya;at.default=void 0;at.getPrefix=Fo;const _n=["Moz","Webkit","O","ms"];function Fo(){var e;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const n=(e=window.document)===null||e===void 0||(e=e.documentElement)===null||e===void 0?void 0:e.style;if(!n||t in n)return"";for(let r=0;r<_n.length;r++)if(jo(t,_n[r])in n)return _n[r];return""}function jo(e,t){return t?"".concat(t).concat(Ka(e)):e}function Ya(e,t){return t?"-".concat(t.toLowerCase(),"-").concat(e):e}function Ka(e){let t="",n=!0;for(let r=0;r<e.length;r++)n?(t+=e[r].toUpperCase(),n=!1):e[r]==="-"?n=!0:t+=e[r];return t}at.default=Fo();Object.defineProperty(ae,"__esModule",{value:!0});ae.addClassName=Uo;ae.addEvent=Qa;ae.addUserSelectStyles=us;ae.createCSSTransform=as;ae.createSVGTransform=ss;ae.getTouch=ls;ae.getTouchIdentifier=cs;ae.getTranslation=sr;ae.innerHeight=rs;ae.innerWidth=os;ae.matchesSelector=Lo;ae.matchesSelectorAndParentsTo=Ja;ae.offsetXYFromParent=is;ae.outerHeight=ts;ae.outerWidth=ns;ae.removeClassName=Vo;ae.removeEvent=es;ae.removeUserSelectStyles=ds;var xe=ke,Dr=Za(at);function $o(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return($o=function(r){return r?n:t})(e)}function Za(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=$o(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}let Ut="";function Lo(e,t){return Ut||(Ut=(0,xe.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(n){return(0,xe.isFunction)(e[n])})),(0,xe.isFunction)(e[Ut])?e[Ut](t):!1}function Ja(e,t,n){let r=e;do{if(Lo(r,t))return!0;if(r===n)return!1;r=r.parentNode}while(r);return!1}function Qa(e,t,n,r){if(!e)return;const o={capture:!0,...r};e.addEventListener?e.addEventListener(t,n,o):e.attachEvent?e.attachEvent("on"+t,n):e["on"+t]=n}function es(e,t,n,r){if(!e)return;const o={capture:!0,...r};e.removeEventListener?e.removeEventListener(t,n,o):e.detachEvent?e.detachEvent("on"+t,n):e["on"+t]=null}function ts(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,xe.int)(n.borderTopWidth),t+=(0,xe.int)(n.borderBottomWidth),t}function ns(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,xe.int)(n.borderLeftWidth),t+=(0,xe.int)(n.borderRightWidth),t}function rs(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,xe.int)(n.paddingTop),t-=(0,xe.int)(n.paddingBottom),t}function os(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,xe.int)(n.paddingLeft),t-=(0,xe.int)(n.paddingRight),t}function is(e,t,n){const o=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect(),i=(e.clientX+t.scrollLeft-o.left)/n,a=(e.clientY+t.scrollTop-o.top)/n;return{x:i,y:a}}function as(e,t){const n=sr(e,t,"px");return{[(0,Dr.browserPrefixToKey)("transform",Dr.default)]:n}}function ss(e,t){return sr(e,t,"")}function sr(e,t,n){let{x:r,y:o}=e,i="translate(".concat(r).concat(n,",").concat(o).concat(n,")");if(t){const a="".concat(typeof t.x=="string"?t.x:t.x+n),c="".concat(typeof t.y=="string"?t.y:t.y+n);i="translate(".concat(a,", ").concat(c,")")+i}return i}function ls(e,t){return e.targetTouches&&(0,xe.findInArray)(e.targetTouches,n=>t===n.identifier)||e.changedTouches&&(0,xe.findInArray)(e.changedTouches,n=>t===n.identifier)}function cs(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function us(e){if(!e)return;let t=e.getElementById("react-draggable-style-el");t||(t=e.createElement("style"),t.type="text/css",t.id="react-draggable-style-el",t.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
10
10
  `,t.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
11
- `,e.getElementsByTagName("head")[0].appendChild(t)),e.body&&$o(e.body,"react-draggable-transparent-selection")}function hs(e){if(e)try{if(e.body&&jo(e.body,"react-draggable-transparent-selection"),e.selection)e.selection.empty();else{const t=(e.defaultView||window).getSelection();t&&t.type!=="Caret"&&t.removeAllRanges()}}catch{}}function $o(e,t){e.classList?e.classList.add(t):e.className.match(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)")))||(e.className+=" ".concat(t))}function jo(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)"),"g"),"")}var Le={};Object.defineProperty(Le,"__esModule",{value:!0});Le.canDragX=vs;Le.canDragY=ys;Le.createCoreData=Ss;Le.createDraggableData=bs;Le.getBoundPosition=gs;Le.getControlPosition=Cs;Le.snapToGrid=ms;var Te=je,pt=re;function gs(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r=="string"?r:Ts(r);const o=or(e);if(typeof r=="string"){const{ownerDocument:a}=o,i=a.defaultView;let c;if(r==="parent"?c=o.parentNode:c=a.querySelector(r),!(c instanceof i.HTMLElement))throw new Error('Bounds selector "'+r+'" could not find an element.');const l=c,u=i.getComputedStyle(o),d=i.getComputedStyle(l);r={left:-o.offsetLeft+(0,Te.int)(d.paddingLeft)+(0,Te.int)(u.marginLeft),top:-o.offsetTop+(0,Te.int)(d.paddingTop)+(0,Te.int)(u.marginTop),right:(0,pt.innerWidth)(l)-(0,pt.outerWidth)(o)-o.offsetLeft+(0,Te.int)(d.paddingRight)-(0,Te.int)(u.marginRight),bottom:(0,pt.innerHeight)(l)-(0,pt.outerHeight)(o)-o.offsetTop+(0,Te.int)(d.paddingBottom)-(0,Te.int)(u.marginBottom)}}return(0,Te.isNum)(r.right)&&(t=Math.min(t,r.right)),(0,Te.isNum)(r.bottom)&&(n=Math.min(n,r.bottom)),(0,Te.isNum)(r.left)&&(t=Math.max(t,r.left)),(0,Te.isNum)(r.top)&&(n=Math.max(n,r.top)),[t,n]}function ms(e,t,n){const r=Math.round(t/e[0])*e[0],o=Math.round(n/e[1])*e[1];return[r,o]}function vs(e){return e.props.axis==="both"||e.props.axis==="x"}function ys(e){return e.props.axis==="both"||e.props.axis==="y"}function Cs(e,t,n){const r=typeof t=="number"?(0,pt.getTouch)(e,t):null;if(typeof t=="number"&&!r)return null;const o=or(n),a=n.props.offsetParent||o.offsetParent||o.ownerDocument.body;return(0,pt.offsetXYFromParent)(r||e,a,n.props.scale)}function Ss(e,t,n){const r=!(0,Te.isNum)(e.lastX),o=or(e);return r?{node:o,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:o,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}}function bs(e,t){const n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}}function Ts(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function or(e){const t=e.findDOMNode();if(!t)throw new Error("<DraggableCore>: Unmounted during event!");return t}var sn={},ln={};Object.defineProperty(ln,"__esModule",{value:!0});ln.default=Rs;function Rs(){}Object.defineProperty(sn,"__esModule",{value:!0});sn.default=void 0;var Tn=ws(w),Ce=ar(qe),_s=ar(ro),pe=re,ke=Le,Rn=je,St=ar(ln);function ar(e){return e&&e.__esModule?e:{default:e}}function Lo(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(Lo=function(r){return r?n:t})(e)}function ws(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=Lo(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(a!=="default"&&Object.prototype.hasOwnProperty.call(e,a)){var i=o?Object.getOwnPropertyDescriptor(e,a):null;i&&(i.get||i.set)?Object.defineProperty(r,a,i):r[a]=e[a]}return r.default=e,n&&n.set(e,r),r}function ge(e,t,n){return t=Is(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Is(e){var t=xs(e,"string");return typeof t=="symbol"?t:String(t)}function xs(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}const Oe={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let He=Oe.mouse,cn=class extends Tn.Component{constructor(){super(...arguments),ge(this,"dragging",!1),ge(this,"lastX",NaN),ge(this,"lastY",NaN),ge(this,"touchIdentifier",null),ge(this,"mounted",!1),ge(this,"handleDragStart",t=>{if(this.props.onMouseDown(t),!this.props.allowAnyClick&&typeof t.button=="number"&&t.button!==0)return!1;const n=this.findDOMNode();if(!n||!n.ownerDocument||!n.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:r}=n;if(this.props.disabled||!(t.target instanceof r.defaultView.Node)||this.props.handle&&!(0,pe.matchesSelectorAndParentsTo)(t.target,this.props.handle,n)||this.props.cancel&&(0,pe.matchesSelectorAndParentsTo)(t.target,this.props.cancel,n))return;t.type==="touchstart"&&t.preventDefault();const o=(0,pe.getTouchIdentifier)(t);this.touchIdentifier=o;const a=(0,ke.getControlPosition)(t,o,this);if(a==null)return;const{x:i,y:c}=a,l=(0,ke.createCoreData)(this,i,c);(0,St.default)("DraggableCore: handleDragStart: %j",l),(0,St.default)("calling",this.props.onStart),!(this.props.onStart(t,l)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,pe.addUserSelectStyles)(r),this.dragging=!0,this.lastX=i,this.lastY=c,(0,pe.addEvent)(r,He.move,this.handleDrag),(0,pe.addEvent)(r,He.stop,this.handleDragStop))}),ge(this,"handleDrag",t=>{const n=(0,ke.getControlPosition)(t,this.touchIdentifier,this);if(n==null)return;let{x:r,y:o}=n;if(Array.isArray(this.props.grid)){let c=r-this.lastX,l=o-this.lastY;if([c,l]=(0,ke.snapToGrid)(this.props.grid,c,l),!c&&!l)return;r=this.lastX+c,o=this.lastY+l}const a=(0,ke.createCoreData)(this,r,o);if((0,St.default)("DraggableCore: handleDrag: %j",a),this.props.onDrag(t,a)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const l=document.createEvent("MouseEvents");l.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(l)}return}this.lastX=r,this.lastY=o}),ge(this,"handleDragStop",t=>{if(!this.dragging)return;const n=(0,ke.getControlPosition)(t,this.touchIdentifier,this);if(n==null)return;let{x:r,y:o}=n;if(Array.isArray(this.props.grid)){let l=r-this.lastX||0,u=o-this.lastY||0;[l,u]=(0,ke.snapToGrid)(this.props.grid,l,u),r=this.lastX+l,o=this.lastY+u}const a=(0,ke.createCoreData)(this,r,o);if(this.props.onStop(t,a)===!1||this.mounted===!1)return!1;const c=this.findDOMNode();c&&this.props.enableUserSelectHack&&(0,pe.removeUserSelectStyles)(c.ownerDocument),(0,St.default)("DraggableCore: handleDragStop: %j",a),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,c&&((0,St.default)("DraggableCore: Removing handlers"),(0,pe.removeEvent)(c.ownerDocument,He.move,this.handleDrag),(0,pe.removeEvent)(c.ownerDocument,He.stop,this.handleDragStop))}),ge(this,"onMouseDown",t=>(He=Oe.mouse,this.handleDragStart(t))),ge(this,"onMouseUp",t=>(He=Oe.mouse,this.handleDragStop(t))),ge(this,"onTouchStart",t=>(He=Oe.touch,this.handleDragStart(t))),ge(this,"onTouchEnd",t=>(He=Oe.touch,this.handleDragStop(t)))}componentDidMount(){this.mounted=!0;const t=this.findDOMNode();t&&(0,pe.addEvent)(t,Oe.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const t=this.findDOMNode();if(t){const{ownerDocument:n}=t;(0,pe.removeEvent)(n,Oe.mouse.move,this.handleDrag),(0,pe.removeEvent)(n,Oe.touch.move,this.handleDrag),(0,pe.removeEvent)(n,Oe.mouse.stop,this.handleDragStop),(0,pe.removeEvent)(n,Oe.touch.stop,this.handleDragStop),(0,pe.removeEvent)(t,Oe.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,pe.removeUserSelectStyles)(n)}}findDOMNode(){var t,n;return(t=this.props)!==null&&t!==void 0&&t.nodeRef?(n=this.props)===null||n===void 0||(n=n.nodeRef)===null||n===void 0?void 0:n.current:_s.default.findDOMNode(this)}render(){return Tn.cloneElement(Tn.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};sn.default=cn;ge(cn,"displayName","DraggableCore");ge(cn,"propTypes",{allowAnyClick:Ce.default.bool,children:Ce.default.node.isRequired,disabled:Ce.default.bool,enableUserSelectHack:Ce.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:Ce.default.arrayOf(Ce.default.number),handle:Ce.default.string,cancel:Ce.default.string,nodeRef:Ce.default.object,onStart:Ce.default.func,onDrag:Ce.default.func,onStop:Ce.default.func,onMouseDown:Ce.default.func,scale:Ce.default.number,className:Rn.dontSetMe,style:Rn.dontSetMe,transform:Rn.dontSetMe});ge(cn,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1});(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"DraggableCore",{enumerable:!0,get:function(){return l.default}}),e.default=void 0;var t=f(w),n=d(qe),r=d(ro),o=d(We),a=re,i=Le,c=je,l=d(sn),u=d(ln);function d(S){return S&&S.__esModule?S:{default:S}}function h(S){if(typeof WeakMap!="function")return null;var C=new WeakMap,R=new WeakMap;return(h=function(m){return m?R:C})(S)}function f(S,C){if(!C&&S&&S.__esModule)return S;if(S===null||typeof S!="object"&&typeof S!="function")return{default:S};var R=h(C);if(R&&R.has(S))return R.get(S);var m={},O=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var M in S)if(M!=="default"&&Object.prototype.hasOwnProperty.call(S,M)){var I=O?Object.getOwnPropertyDescriptor(S,M):null;I&&(I.get||I.set)?Object.defineProperty(m,M,I):m[M]=S[M]}return m.default=S,R&&R.set(S,m),m}function v(){return v=Object.assign?Object.assign.bind():function(S){for(var C=1;C<arguments.length;C++){var R=arguments[C];for(var m in R)Object.prototype.hasOwnProperty.call(R,m)&&(S[m]=R[m])}return S},v.apply(this,arguments)}function y(S,C,R){return C=b(C),C in S?Object.defineProperty(S,C,{value:R,enumerable:!0,configurable:!0,writable:!0}):S[C]=R,S}function b(S){var C=x(S,"string");return typeof C=="symbol"?C:String(C)}function x(S,C){if(typeof S!="object"||S===null)return S;var R=S[Symbol.toPrimitive];if(R!==void 0){var m=R.call(S,C||"default");if(typeof m!="object")return m;throw new TypeError("@@toPrimitive must return a primitive value.")}return(C==="string"?String:Number)(S)}class _ extends t.Component{static getDerivedStateFromProps(C,R){let{position:m}=C,{prevPropsPosition:O}=R;return m&&(!O||m.x!==O.x||m.y!==O.y)?((0,u.default)("Draggable: getDerivedStateFromProps %j",{position:m,prevPropsPosition:O}),{x:m.x,y:m.y,prevPropsPosition:{...m}}):null}constructor(C){super(C),y(this,"onDragStart",(R,m)=>{if((0,u.default)("Draggable: onDragStart: %j",m),this.props.onStart(R,(0,i.createDraggableData)(this,m))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),y(this,"onDrag",(R,m)=>{if(!this.state.dragging)return!1;(0,u.default)("Draggable: onDrag: %j",m);const O=(0,i.createDraggableData)(this,m),M={x:O.x,y:O.y,slackX:0,slackY:0};if(this.props.bounds){const{x:F,y:$}=M;M.x+=this.state.slackX,M.y+=this.state.slackY;const[j,q]=(0,i.getBoundPosition)(this,M.x,M.y);M.x=j,M.y=q,M.slackX=this.state.slackX+(F-M.x),M.slackY=this.state.slackY+($-M.y),O.x=M.x,O.y=M.y,O.deltaX=M.x-this.state.x,O.deltaY=M.y-this.state.y}if(this.props.onDrag(R,O)===!1)return!1;this.setState(M)}),y(this,"onDragStop",(R,m)=>{if(!this.state.dragging||this.props.onStop(R,(0,i.createDraggableData)(this,m))===!1)return!1;(0,u.default)("Draggable: onDragStop: %j",m);const M={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:F,y:$}=this.props.position;M.x=F,M.y=$}this.setState(M)}),this.state={dragging:!1,dragged:!1,x:C.position?C.position.x:C.defaultPosition.x,y:C.position?C.position.y:C.defaultPosition.y,prevPropsPosition:{...C.position},slackX:0,slackY:0,isElementSVG:!1},C.position&&!(C.onDrag||C.onStop)&&console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}componentDidMount(){typeof window.SVGElement<"u"&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.setState({dragging:!1})}findDOMNode(){var C,R;return(C=(R=this.props)===null||R===void 0||(R=R.nodeRef)===null||R===void 0?void 0:R.current)!==null&&C!==void 0?C:r.default.findDOMNode(this)}render(){const{axis:C,bounds:R,children:m,defaultPosition:O,defaultClassName:M,defaultClassNameDragging:I,defaultClassNameDragged:F,position:$,positionOffset:j,scale:q,...T}=this.props;let E={},Z=null;const L=!!!$||this.state.dragging,B=$||O,ee={x:(0,i.canDragX)(this)&&L?this.state.x:B.x,y:(0,i.canDragY)(this)&&L?this.state.y:B.y};this.state.isElementSVG?Z=(0,a.createSVGTransform)(ee,j):E=(0,a.createCSSTransform)(ee,j);const se=(0,o.default)(m.props.className||"",M,{[I]:this.state.dragging,[F]:this.state.dragged});return t.createElement(l.default,v({},T,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),t.cloneElement(t.Children.only(m),{className:se,style:{...m.props.style,...E},transform:Z}))}}e.default=_,y(_,"displayName","Draggable"),y(_,"propTypes",{...l.default.propTypes,axis:n.default.oneOf(["both","x","y","none"]),bounds:n.default.oneOfType([n.default.shape({left:n.default.number,right:n.default.number,top:n.default.number,bottom:n.default.number}),n.default.string,n.default.oneOf([!1])]),defaultClassName:n.default.string,defaultClassNameDragging:n.default.string,defaultClassNameDragged:n.default.string,defaultPosition:n.default.shape({x:n.default.number,y:n.default.number}),positionOffset:n.default.shape({x:n.default.oneOfType([n.default.number,n.default.string]),y:n.default.oneOfType([n.default.number,n.default.string])}),position:n.default.shape({x:n.default.number,y:n.default.number}),className:c.dontSetMe,style:c.dontSetMe,transform:c.dontSetMe}),y(_,"defaultProps",{...l.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})})(Mo);const{default:Vo,DraggableCore:Os}=Mo;an.exports=Vo;an.exports.default=Vo;an.exports.DraggableCore=Os;var Uo=an.exports,un={exports:{}},Ft={},ir={};ir.__esModule=!0;ir.cloneElement=Fs;var Es=Ms(w);function Ms(e){return e&&e.__esModule?e:{default:e}}function Or(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Er(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Or(Object(n),!0).forEach(function(r){Ds(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Or(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Ds(e,t,n){return t=Ps(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ps(e){var t=Ns(e,"string");return typeof t=="symbol"?t:String(t)}function Ns(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Fs(e,t){return t.style&&e.props.style&&(t.style=Er(Er({},e.props.style),t.style)),t.className&&e.props.className&&(t.className=e.props.className+" "+t.className),Es.default.cloneElement(e,t)}var $t={};$t.__esModule=!0;$t.resizableProps=void 0;var A=$s(qe);function $s(e){return e&&e.__esModule?e:{default:e}}var js={axis:A.default.oneOf(["both","x","y","none"]),className:A.default.string,children:A.default.element.isRequired,draggableOpts:A.default.shape({allowAnyClick:A.default.bool,cancel:A.default.string,children:A.default.node,disabled:A.default.bool,enableUserSelectHack:A.default.bool,offsetParent:A.default.node,grid:A.default.arrayOf(A.default.number),handle:A.default.string,nodeRef:A.default.object,onStart:A.default.func,onDrag:A.default.func,onStop:A.default.func,onMouseDown:A.default.func,scale:A.default.number}),height:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=n[0];if(o.axis==="both"||o.axis==="y"){var a;return(a=A.default.number).isRequired.apply(a,n)}return A.default.number.apply(A.default,n)},handle:A.default.oneOfType([A.default.node,A.default.func]),handleSize:A.default.arrayOf(A.default.number),lockAspectRatio:A.default.bool,maxConstraints:A.default.arrayOf(A.default.number),minConstraints:A.default.arrayOf(A.default.number),onResizeStop:A.default.func,onResizeStart:A.default.func,onResize:A.default.func,resizeHandles:A.default.arrayOf(A.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:A.default.number,width:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=n[0];if(o.axis==="both"||o.axis==="x"){var a;return(a=A.default.number).isRequired.apply(a,n)}return A.default.number.apply(A.default,n)}};$t.resizableProps=js;Ft.__esModule=!0;Ft.default=void 0;var bt=As(w),Ls=Uo,Vs=ir,Us=$t,zs=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function zo(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(zo=function(o){return o?n:t})(e)}function As(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=zo(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(a!=="default"&&Object.prototype.hasOwnProperty.call(e,a)){var i=o?Object.getOwnPropertyDescriptor(e,a):null;i&&(i.get||i.set)?Object.defineProperty(r,a,i):r[a]=e[a]}return r.default=e,n&&n.set(e,r),r}function jn(){return jn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},jn.apply(this,arguments)}function ks(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,a;for(a=0;a<r.length;a++)o=r[a],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function Mr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function _n(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Mr(Object(n),!0).forEach(function(r){Hs(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Mr(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Hs(e,t,n){return t=Ws(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ws(e){var t=qs(e,"string");return typeof t=="symbol"?t:String(t)}function qs(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Bs(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Ln(e,t)}function Ln(e,t){return Ln=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},Ln(e,t)}var sr=function(e){Bs(t,e);function t(){for(var r,o=arguments.length,a=new Array(o),i=0;i<o;i++)a[i]=arguments[i];return r=e.call.apply(e,[this].concat(a))||this,r.handleRefs={},r.lastHandleRect=null,r.slack=null,r}var n=t.prototype;return n.componentWillUnmount=function(){this.resetData()},n.resetData=function(){this.lastHandleRect=this.slack=null},n.runConstraints=function(o,a){var i=this.props,c=i.minConstraints,l=i.maxConstraints,u=i.lockAspectRatio;if(!c&&!l&&!u)return[o,a];if(u){var d=this.props.width/this.props.height,h=o-this.props.width,f=a-this.props.height;Math.abs(h)>Math.abs(f*d)?a=o/d:o=a*d}var v=o,y=a,b=this.slack||[0,0],x=b[0],_=b[1];return o+=x,a+=_,c&&(o=Math.max(c[0],o),a=Math.max(c[1],a)),l&&(o=Math.min(l[0],o),a=Math.min(l[1],a)),this.slack=[x+(v-o),_+(y-a)],[o,a]},n.resizeHandler=function(o,a){var i=this;return function(c,l){var u=l.node,d=l.deltaX,h=l.deltaY;o==="onResizeStart"&&i.resetData();var f=(i.props.axis==="both"||i.props.axis==="x")&&a!=="n"&&a!=="s",v=(i.props.axis==="both"||i.props.axis==="y")&&a!=="e"&&a!=="w";if(!(!f&&!v)){var y=a[0],b=a[a.length-1],x=u.getBoundingClientRect();if(i.lastHandleRect!=null){if(b==="w"){var _=x.left-i.lastHandleRect.left;d+=_}if(y==="n"){var S=x.top-i.lastHandleRect.top;h+=S}}i.lastHandleRect=x,b==="w"&&(d=-d),y==="n"&&(h=-h);var C=i.props.width+(f?d/i.props.transformScale:0),R=i.props.height+(v?h/i.props.transformScale:0),m=i.runConstraints(C,R);C=m[0],R=m[1];var O=C!==i.props.width||R!==i.props.height,M=typeof i.props[o]=="function"?i.props[o]:null,I=o==="onResize"&&!O;M&&!I&&(c.persist==null||c.persist(),M(c,{node:u,size:{width:C,height:R},handle:a})),o==="onResizeStop"&&i.resetData()}}},n.renderResizeHandle=function(o,a){var i=this.props.handle;if(!i)return bt.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+o,ref:a});if(typeof i=="function")return i(o,a);var c=typeof i.type=="string",l=_n({ref:a},c?{}:{handleAxis:o});return bt.cloneElement(i,l)},n.render=function(){var o=this,a=this.props,i=a.children,c=a.className,l=a.draggableOpts;a.width,a.height,a.handle,a.handleSize,a.lockAspectRatio,a.axis,a.minConstraints,a.maxConstraints,a.onResize,a.onResizeStop,a.onResizeStart;var u=a.resizeHandles;a.transformScale;var d=ks(a,zs);return(0,Vs.cloneElement)(i,_n(_n({},d),{},{className:(c?c+" ":"")+"react-resizable",children:[].concat(i.props.children,u.map(function(h){var f,v=(f=o.handleRefs[h])!=null?f:o.handleRefs[h]=bt.createRef();return bt.createElement(Ls.DraggableCore,jn({},l,{nodeRef:v,key:"resizableHandle-"+h,onStop:o.resizeHandler("onResizeStop",h),onStart:o.resizeHandler("onResizeStart",h),onDrag:o.resizeHandler("onResize",h)}),o.renderResizeHandle(h,v))}))}))},t}(bt.Component);Ft.default=sr;sr.propTypes=Us.resizableProps;sr.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1};var dn={};dn.__esModule=!0;dn.default=void 0;var wn=Zs(w),Gs=Ao(qe),Xs=Ao(Ft),Ys=$t,Ks=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function Ao(e){return e&&e.__esModule?e:{default:e}}function ko(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(ko=function(o){return o?n:t})(e)}function Zs(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=ko(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(a!=="default"&&Object.prototype.hasOwnProperty.call(e,a)){var i=o?Object.getOwnPropertyDescriptor(e,a):null;i&&(i.get||i.set)?Object.defineProperty(r,a,i):r[a]=e[a]}return r.default=e,n&&n.set(e,r),r}function Vn(){return Vn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Vn.apply(this,arguments)}function Dr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Yt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Dr(Object(n),!0).forEach(function(r){Js(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Dr(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Js(e,t,n){return t=Qs(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Qs(e){var t=el(e,"string");return typeof t=="symbol"?t:String(t)}function el(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function tl(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,a;for(a=0;a<r.length;a++)o=r[a],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function nl(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Un(e,t)}function Un(e,t){return Un=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},Un(e,t)}var Ho=function(e){nl(t,e);function t(){for(var r,o=arguments.length,a=new Array(o),i=0;i<o;i++)a[i]=arguments[i];return r=e.call.apply(e,[this].concat(a))||this,r.state={width:r.props.width,height:r.props.height,propsWidth:r.props.width,propsHeight:r.props.height},r.onResize=function(c,l){var u=l.size;r.props.onResize?(c.persist==null||c.persist(),r.setState(u,function(){return r.props.onResize&&r.props.onResize(c,l)})):r.setState(u)},r}t.getDerivedStateFromProps=function(o,a){return a.propsWidth!==o.width||a.propsHeight!==o.height?{width:o.width,height:o.height,propsWidth:o.width,propsHeight:o.height}:null};var n=t.prototype;return n.render=function(){var o=this.props,a=o.handle,i=o.handleSize;o.onResize;var c=o.onResizeStart,l=o.onResizeStop,u=o.draggableOpts,d=o.minConstraints,h=o.maxConstraints,f=o.lockAspectRatio,v=o.axis;o.width,o.height;var y=o.resizeHandles,b=o.style,x=o.transformScale,_=tl(o,Ks);return wn.createElement(Xs.default,{axis:v,draggableOpts:u,handle:a,handleSize:i,height:this.state.height,lockAspectRatio:f,maxConstraints:h,minConstraints:d,onResizeStart:c,onResize:this.onResize,onResizeStop:l,resizeHandles:y,transformScale:x,width:this.state.width},wn.createElement("div",Vn({},_,{style:Yt(Yt({},b),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},t}(wn.Component);dn.default=Ho;Ho.propTypes=Yt(Yt({},Ys.resizableProps),{},{children:Gs.default.element});un.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")};un.exports.Resizable=Ft.default;un.exports.ResizableBox=dn.default;var rl=un.exports,ze={};Object.defineProperty(ze,"__esModule",{value:!0});ze.resizeHandleType=ze.resizeHandleAxesType=ze.default=void 0;var H=Wo(qe),ol=Wo(w);function Wo(e){return e&&e.__esModule?e:{default:e}}const al=ze.resizeHandleAxesType=H.default.arrayOf(H.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),il=ze.resizeHandleType=H.default.oneOfType([H.default.node,H.default.func]);ze.default={className:H.default.string,style:H.default.object,width:H.default.number,autoSize:H.default.bool,cols:H.default.number,draggableCancel:H.default.string,draggableHandle:H.default.string,verticalCompact:function(e){e.verticalCompact},compactType:H.default.oneOf(["vertical","horizontal"]),layout:function(e){var t=e.layout;t!==void 0&&W.validateLayout(t,"layout")},margin:H.default.arrayOf(H.default.number),containerPadding:H.default.arrayOf(H.default.number),rowHeight:H.default.number,maxRows:H.default.number,isBounded:H.default.bool,isDraggable:H.default.bool,isResizable:H.default.bool,allowOverlap:H.default.bool,preventCollision:H.default.bool,useCSSTransforms:H.default.bool,transformScale:H.default.number,isDroppable:H.default.bool,resizeHandles:al,resizeHandle:il,onLayoutChange:H.default.func,onDragStart:H.default.func,onDrag:H.default.func,onDragStop:H.default.func,onResizeStart:H.default.func,onResize:H.default.func,onResizeStop:H.default.func,onDrop:H.default.func,droppingItem:H.default.shape({i:H.default.string.isRequired,w:H.default.number.isRequired,h:H.default.number.isRequired}),children:function(e,t){const n=e[t],r={};ol.default.Children.forEach(n,function(o){if((o==null?void 0:o.key)!=null){if(r[o.key])throw new Error('Duplicate child key "'+o.key+'" found! This will cause problems in ReactGridLayout.');r[o.key]=!0}})},innerRef:H.default.any};Object.defineProperty(on,"__esModule",{value:!0});on.default=void 0;var lt=lr(w),X=lr(qe),sl=Uo,ll=rl,ct=W,de=$e,Pr=ze,cl=lr(We);function lr(e){return e&&e.__esModule?e:{default:e}}function Fe(e,t,n){return t=ul(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ul(e){var t=dl(e,"string");return typeof t=="symbol"?t:String(t)}function dl(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class cr extends lt.default.Component{constructor(){super(...arguments),Fe(this,"state",{resizing:null,dragging:null,className:""}),Fe(this,"elementRef",lt.default.createRef()),Fe(this,"onDragStart",(t,n)=>{let{node:r}=n;const{onDragStart:o,transformScale:a}=this.props;if(!o)return;const i={top:0,left:0},{offsetParent:c}=r;if(!c)return;const l=c.getBoundingClientRect(),u=r.getBoundingClientRect(),d=u.left/a,h=l.left/a,f=u.top/a,v=l.top/a;i.left=d-h+c.scrollLeft,i.top=f-v+c.scrollTop,this.setState({dragging:i});const{x:y,y:b}=(0,de.calcXY)(this.getPositionParams(),i.top,i.left,this.props.w,this.props.h);return o.call(this,this.props.i,y,b,{e:t,node:r,newPosition:i})}),Fe(this,"onDrag",(t,n)=>{let{node:r,deltaX:o,deltaY:a}=n;const{onDrag:i}=this.props;if(!i)return;if(!this.state.dragging)throw new Error("onDrag called before onDragStart.");let c=this.state.dragging.top+a,l=this.state.dragging.left+o;const{isBounded:u,i:d,w:h,h:f,containerWidth:v}=this.props,y=this.getPositionParams();if(u){const{offsetParent:C}=r;if(C){const{margin:R,rowHeight:m,containerPadding:O}=this.props,M=C.clientHeight-(0,de.calcGridItemWHPx)(f,m,R[1]);c=(0,de.clamp)(c-O[1],0,M);const I=(0,de.calcGridColWidth)(y),F=v-(0,de.calcGridItemWHPx)(h,I,R[0]);l=(0,de.clamp)(l-O[0],0,F)}}const b={top:c,left:l};this.setState({dragging:b});const{containerPadding:x}=this.props,{x:_,y:S}=(0,de.calcXY)(y,c-x[1],l-x[0],h,f);return i.call(this,d,_,S,{e:t,node:r,newPosition:b})}),Fe(this,"onDragStop",(t,n)=>{let{node:r}=n;const{onDragStop:o}=this.props;if(!o)return;if(!this.state.dragging)throw new Error("onDragEnd called before onDragStart.");const{w:a,h:i,i:c,containerPadding:l}=this.props,{left:u,top:d}=this.state.dragging,h={top:d,left:u};this.setState({dragging:null});const{x:f,y:v}=(0,de.calcXY)(this.getPositionParams(),d-l[1],u-l[0],a,i);return o.call(this,c,f,v,{e:t,node:r,newPosition:h})}),Fe(this,"onResizeStop",(t,n,r)=>this.onResizeHandler(t,n,r,"onResizeStop")),Fe(this,"onResizeStart",(t,n,r)=>this.onResizeHandler(t,n,r,"onResizeStart")),Fe(this,"onResize",(t,n,r)=>this.onResizeHandler(t,n,r,"onResize"))}shouldComponentUpdate(t,n){if(this.props.children!==t.children||this.props.droppingPosition!==t.droppingPosition)return!0;const r=(0,de.calcGridItemPosition)(this.getPositionParams(this.props),this.props.x,this.props.y,this.props.w,this.props.h,this.state),o=(0,de.calcGridItemPosition)(this.getPositionParams(t),t.x,t.y,t.w,t.h,n);return!(0,ct.fastPositionEqual)(r,o)||this.props.useCSSTransforms!==t.useCSSTransforms}componentDidMount(){this.moveDroppingItem({})}componentDidUpdate(t){this.moveDroppingItem(t)}moveDroppingItem(t){const{droppingPosition:n}=this.props;if(!n)return;const r=this.elementRef.current;if(!r)return;const o=t.droppingPosition||{left:0,top:0},{dragging:a}=this.state,i=a&&n.left!==o.left||n.top!==o.top;if(!a)this.onDragStart(n.e,{node:r,deltaX:n.left,deltaY:n.top});else if(i){const c=n.left-a.left,l=n.top-a.top;this.onDrag(n.e,{node:r,deltaX:c,deltaY:l})}}getPositionParams(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.props;return{cols:t.cols,containerPadding:t.containerPadding,containerWidth:t.containerWidth,margin:t.margin,maxRows:t.maxRows,rowHeight:t.rowHeight}}createStyle(t){const{usePercentages:n,containerWidth:r,useCSSTransforms:o}=this.props;let a;return o?a=(0,ct.setTransform)(t):(a=(0,ct.setTopLeft)(t),n&&(a.left=(0,ct.perc)(t.left/r),a.width=(0,ct.perc)(t.width/r))),a}mixinDraggable(t,n){return lt.default.createElement(sl.DraggableCore,{disabled:!n,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop,handle:this.props.handle,cancel:".react-resizable-handle"+(this.props.cancel?","+this.props.cancel:""),scale:this.props.transformScale,nodeRef:this.elementRef},t)}curryResizeHandler(t,n){return(r,o)=>n(r,o,t)}mixinResizable(t,n,r){const{cols:o,minW:a,minH:i,maxW:c,maxH:l,transformScale:u,resizeHandles:d,resizeHandle:h}=this.props,f=this.getPositionParams(),v=(0,de.calcGridItemPosition)(f,0,0,o,0).width,y=(0,de.calcGridItemPosition)(f,0,0,a,i),b=(0,de.calcGridItemPosition)(f,0,0,c,l),x=[y.width,y.height],_=[Math.min(b.width,v),Math.min(b.height,1/0)];return lt.default.createElement(ll.Resizable,{draggableOpts:{disabled:!r},className:r?void 0:"react-resizable-hide",width:n.width,height:n.height,minConstraints:x,maxConstraints:_,onResizeStop:this.curryResizeHandler(n,this.onResizeStop),onResizeStart:this.curryResizeHandler(n,this.onResizeStart),onResize:this.curryResizeHandler(n,this.onResize),transformScale:u,resizeHandles:d,handle:h},t)}onResizeHandler(t,n,r,o){let{node:a,size:i,handle:c}=n;const l=this.props[o];if(!l)return;const{x:u,y:d,i:h,maxH:f,minH:v,containerWidth:y}=this.props,{minW:b,maxW:x}=this.props;let _=i;a&&(_=(0,ct.resizeItemInDirection)(c,r,i,y),this.setState({resizing:o==="onResizeStop"?null:_}));let{w:S,h:C}=(0,de.calcWH)(this.getPositionParams(),_.width,_.height,u,d,c);S=(0,de.clamp)(S,Math.max(b,1),x),C=(0,de.clamp)(C,v,f),l.call(this,h,S,C,{e:t,node:a,size:_,handle:c})}render(){const{x:t,y:n,w:r,h:o,isDraggable:a,isResizable:i,droppingPosition:c,useCSSTransforms:l}=this.props,u=(0,de.calcGridItemPosition)(this.getPositionParams(),t,n,r,o,this.state),d=lt.default.Children.only(this.props.children);let h=lt.default.cloneElement(d,{ref:this.elementRef,className:(0,cl.default)("react-grid-item",d.props.className,this.props.className,{static:this.props.static,resizing:!!this.state.resizing,"react-draggable":a,"react-draggable-dragging":!!this.state.dragging,dropping:!!c,cssTransforms:l}),style:{...this.props.style,...d.props.style,...this.createStyle(u)}});return h=this.mixinResizable(h,u,i),h=this.mixinDraggable(h,a),h}}on.default=cr;Fe(cr,"propTypes",{children:X.default.element,cols:X.default.number.isRequired,containerWidth:X.default.number.isRequired,rowHeight:X.default.number.isRequired,margin:X.default.array.isRequired,maxRows:X.default.number.isRequired,containerPadding:X.default.array.isRequired,x:X.default.number.isRequired,y:X.default.number.isRequired,w:X.default.number.isRequired,h:X.default.number.isRequired,minW:function(e,t){const n=e[t];if(typeof n!="number")return new Error("minWidth not Number");if(n>e.w||n>e.maxW)return new Error("minWidth larger than item width/maxWidth")},maxW:function(e,t){const n=e[t];if(typeof n!="number")return new Error("maxWidth not Number");if(n<e.w||n<e.minW)return new Error("maxWidth smaller than item width/minWidth")},minH:function(e,t){const n=e[t];if(typeof n!="number")return new Error("minHeight not Number");if(n>e.h||n>e.maxH)return new Error("minHeight larger than item height/maxHeight")},maxH:function(e,t){const n=e[t];if(typeof n!="number")return new Error("maxHeight not Number");if(n<e.h||n<e.minH)return new Error("maxHeight smaller than item height/minHeight")},i:X.default.string.isRequired,resizeHandles:Pr.resizeHandleAxesType,resizeHandle:Pr.resizeHandleType,onDragStop:X.default.func,onDragStart:X.default.func,onDrag:X.default.func,onResizeStop:X.default.func,onResizeStart:X.default.func,onResize:X.default.func,isDraggable:X.default.bool.isRequired,isResizable:X.default.bool.isRequired,isBounded:X.default.bool.isRequired,static:X.default.bool,useCSSTransforms:X.default.bool.isRequired,transformScale:X.default.number,className:X.default.string,handle:X.default.string,cancel:X.default.string,droppingPosition:X.default.shape({e:X.default.object.isRequired,left:X.default.number.isRequired,top:X.default.number.isRequired})});Fe(cr,"defaultProps",{className:"",cancel:"",handle:"",minH:1,minW:1,maxH:1/0,maxW:1/0,transformScale:1});Object.defineProperty(Nt,"__esModule",{value:!0});Nt.default=void 0;var Ge=gl(w),In=Gn,fl=ur(We),V=W,pl=$e,Nr=ur(on),hl=ur(ze);function ur(e){return e&&e.__esModule?e:{default:e}}function qo(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(qo=function(r){return r?n:t})(e)}function gl(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=qo(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(a!=="default"&&Object.prototype.hasOwnProperty.call(e,a)){var i=o?Object.getOwnPropertyDescriptor(e,a):null;i&&(i.get||i.set)?Object.defineProperty(r,a,i):r[a]=e[a]}return r.default=e,n&&n.set(e,r),r}function he(e,t,n){return t=ml(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ml(e){var t=vl(e,"string");return typeof t=="symbol"?t:String(t)}function vl(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}const Fr="react-grid-layout";let Bo=!1;try{Bo=/firefox/i.test(navigator.userAgent)}catch{}class fn extends Ge.Component{constructor(){super(...arguments),he(this,"state",{activeDrag:null,layout:(0,V.synchronizeLayoutWithChildren)(this.props.layout,this.props.children,this.props.cols,(0,V.compactType)(this.props),this.props.allowOverlap),mounted:!1,oldDragItem:null,oldLayout:null,oldResizeItem:null,resizing:!1,droppingDOMNode:null,children:[]}),he(this,"dragEnterCounter",0),he(this,"onDragStart",(t,n,r,o)=>{let{e:a,node:i}=o;const{layout:c}=this.state,l=(0,V.getLayoutItem)(c,t);if(!l)return;const u={w:l.w,h:l.h,x:l.x,y:l.y,placeholder:!0,i:t};return this.setState({oldDragItem:(0,V.cloneLayoutItem)(l),oldLayout:c,activeDrag:u}),this.props.onDragStart(c,l,l,null,a,i)}),he(this,"onDrag",(t,n,r,o)=>{let{e:a,node:i}=o;const{oldDragItem:c}=this.state;let{layout:l}=this.state;const{cols:u,allowOverlap:d,preventCollision:h}=this.props,f=(0,V.getLayoutItem)(l,t);if(!f)return;const v={w:f.w,h:f.h,x:f.x,y:f.y,placeholder:!0,i:t};l=(0,V.moveElement)(l,f,n,r,!0,h,(0,V.compactType)(this.props),u,d),this.props.onDrag(l,c,f,v,a,i),this.setState({layout:d?l:(0,V.compact)(l,(0,V.compactType)(this.props),u),activeDrag:v})}),he(this,"onDragStop",(t,n,r,o)=>{let{e:a,node:i}=o;if(!this.state.activeDrag)return;const{oldDragItem:c}=this.state;let{layout:l}=this.state;const{cols:u,preventCollision:d,allowOverlap:h}=this.props,f=(0,V.getLayoutItem)(l,t);if(!f)return;l=(0,V.moveElement)(l,f,n,r,!0,d,(0,V.compactType)(this.props),u,h);const y=h?l:(0,V.compact)(l,(0,V.compactType)(this.props),u);this.props.onDragStop(y,c,f,null,a,i);const{oldLayout:b}=this.state;this.setState({activeDrag:null,layout:y,oldDragItem:null,oldLayout:null}),this.onLayoutMaybeChanged(y,b)}),he(this,"onResizeStart",(t,n,r,o)=>{let{e:a,node:i}=o;const{layout:c}=this.state,l=(0,V.getLayoutItem)(c,t);l&&(this.setState({oldResizeItem:(0,V.cloneLayoutItem)(l),oldLayout:this.state.layout,resizing:!0}),this.props.onResizeStart(c,l,l,null,a,i))}),he(this,"onResize",(t,n,r,o)=>{let{e:a,node:i,size:c,handle:l}=o;const{oldResizeItem:u}=this.state,{layout:d}=this.state,{cols:h,preventCollision:f,allowOverlap:v}=this.props;let y=!1,b,x,_;const[S,C]=(0,V.withLayoutItem)(d,t,m=>{let O;return x=m.x,_=m.y,["sw","w","nw","n","ne"].indexOf(l)!==-1&&(["sw","nw","w"].indexOf(l)!==-1&&(x=m.x+(m.w-n),n=m.x!==x&&x<0?m.w:n,x=x<0?0:x),["ne","n","nw"].indexOf(l)!==-1&&(_=m.y+(m.h-r),r=m.y!==_&&_<0?m.h:r,_=_<0?0:_),y=!0),f&&!v&&(O=(0,V.getAllCollisions)(d,{...m,w:n,h:r,x,y:_}).filter(I=>I.i!==m.i).length>0,O&&(_=m.y,r=m.h,x=m.x,n=m.w,y=!1)),m.w=n,m.h=r,m});if(!C)return;b=S,y&&(b=(0,V.moveElement)(S,C,x,_,!0,this.props.preventCollision,(0,V.compactType)(this.props),h,v));const R={w:C.w,h:C.h,x:C.x,y:C.y,static:!0,i:t};this.props.onResize(b,u,C,R,a,i),this.setState({layout:v?b:(0,V.compact)(b,(0,V.compactType)(this.props),h),activeDrag:R})}),he(this,"onResizeStop",(t,n,r,o)=>{let{e:a,node:i}=o;const{layout:c,oldResizeItem:l}=this.state,{cols:u,allowOverlap:d}=this.props,h=(0,V.getLayoutItem)(c,t),f=d?c:(0,V.compact)(c,(0,V.compactType)(this.props),u);this.props.onResizeStop(f,l,h,null,a,i);const{oldLayout:v}=this.state;this.setState({activeDrag:null,layout:f,oldResizeItem:null,oldLayout:null,resizing:!1}),this.onLayoutMaybeChanged(f,v)}),he(this,"onDragOver",t=>{var S;if(t.preventDefault(),t.stopPropagation(),Bo&&!((S=t.nativeEvent.target)!=null&&S.classList.contains(Fr)))return!1;const{droppingItem:n,onDropDragOver:r,margin:o,cols:a,rowHeight:i,maxRows:c,width:l,containerPadding:u,transformScale:d}=this.props,h=r==null?void 0:r(t);if(h===!1)return this.state.droppingDOMNode&&this.removeDroppingPlaceholder(),!1;const f={...n,...h},{layout:v}=this.state,y=t.currentTarget.getBoundingClientRect(),b=t.clientX-y.left,x=t.clientY-y.top,_={left:b/d,top:x/d,e:t};if(this.state.droppingDOMNode){if(this.state.droppingPosition){const{left:C,top:R}=this.state.droppingPosition;(C!=b||R!=x)&&this.setState({droppingPosition:_})}}else{const C={cols:a,margin:o,maxRows:c,rowHeight:i,containerWidth:l,containerPadding:u||o},R=(0,pl.calcXY)(C,x,b,f.w,f.h);this.setState({droppingDOMNode:Ge.createElement("div",{key:f.i}),droppingPosition:_,layout:[...v,{...f,x:R.x,y:R.y,static:!1,isDraggable:!0}]})}}),he(this,"removeDroppingPlaceholder",()=>{const{droppingItem:t,cols:n}=this.props,{layout:r}=this.state,o=(0,V.compact)(r.filter(a=>a.i!==t.i),(0,V.compactType)(this.props),n,this.props.allowOverlap);this.setState({layout:o,droppingDOMNode:null,activeDrag:null,droppingPosition:void 0})}),he(this,"onDragLeave",t=>{t.preventDefault(),t.stopPropagation(),this.dragEnterCounter--,this.dragEnterCounter===0&&this.removeDroppingPlaceholder()}),he(this,"onDragEnter",t=>{t.preventDefault(),t.stopPropagation(),this.dragEnterCounter++}),he(this,"onDrop",t=>{t.preventDefault(),t.stopPropagation();const{droppingItem:n}=this.props,{layout:r}=this.state,o=r.find(a=>a.i===n.i);this.dragEnterCounter=0,this.removeDroppingPlaceholder(),this.props.onDrop(r,o,t)})}componentDidMount(){this.setState({mounted:!0}),this.onLayoutMaybeChanged(this.state.layout,this.props.layout)}static getDerivedStateFromProps(t,n){let r;return n.activeDrag?null:(!(0,In.deepEqual)(t.layout,n.propsLayout)||t.compactType!==n.compactType?r=t.layout:(0,V.childrenEqual)(t.children,n.children)||(r=n.layout),r?{layout:(0,V.synchronizeLayoutWithChildren)(r,t.children,t.cols,(0,V.compactType)(t),t.allowOverlap),compactType:t.compactType,children:t.children,propsLayout:t.layout}:null)}shouldComponentUpdate(t,n){return this.props.children!==t.children||!(0,V.fastRGLPropsEqual)(this.props,t,In.deepEqual)||this.state.activeDrag!==n.activeDrag||this.state.mounted!==n.mounted||this.state.droppingPosition!==n.droppingPosition}componentDidUpdate(t,n){if(!this.state.activeDrag){const r=this.state.layout,o=n.layout;this.onLayoutMaybeChanged(r,o)}}containerHeight(){if(!this.props.autoSize)return;const t=(0,V.bottom)(this.state.layout),n=this.props.containerPadding?this.props.containerPadding[1]:this.props.margin[1];return t*this.props.rowHeight+(t-1)*this.props.margin[1]+n*2+"px"}onLayoutMaybeChanged(t,n){n||(n=this.state.layout),(0,In.deepEqual)(n,t)||this.props.onLayoutChange(t)}placeholder(){const{activeDrag:t}=this.state;if(!t)return null;const{width:n,cols:r,margin:o,containerPadding:a,rowHeight:i,maxRows:c,useCSSTransforms:l,transformScale:u}=this.props;return Ge.createElement(Nr.default,{w:t.w,h:t.h,x:t.x,y:t.y,i:t.i,className:`react-grid-placeholder ${this.state.resizing?"placeholder-resizing":""}`,containerWidth:n,cols:r,margin:o,containerPadding:a||o,maxRows:c,rowHeight:i,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:l,transformScale:u},Ge.createElement("div",null))}processGridItem(t,n){if(!t||!t.key)return;const r=(0,V.getLayoutItem)(this.state.layout,String(t.key));if(!r)return null;const{width:o,cols:a,margin:i,containerPadding:c,rowHeight:l,maxRows:u,isDraggable:d,isResizable:h,isBounded:f,useCSSTransforms:v,transformScale:y,draggableCancel:b,draggableHandle:x,resizeHandles:_,resizeHandle:S}=this.props,{mounted:C,droppingPosition:R}=this.state,m=typeof r.isDraggable=="boolean"?r.isDraggable:!r.static&&d,O=typeof r.isResizable=="boolean"?r.isResizable:!r.static&&h,M=r.resizeHandles||_,I=m&&f&&r.isBounded!==!1;return Ge.createElement(Nr.default,{containerWidth:o,cols:a,margin:i,containerPadding:c||i,maxRows:u,rowHeight:l,cancel:b,handle:x,onDragStop:this.onDragStop,onDragStart:this.onDragStart,onDrag:this.onDrag,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,isDraggable:m,isResizable:O,isBounded:I,useCSSTransforms:v&&C,usePercentages:!C,transformScale:y,w:r.w,h:r.h,x:r.x,y:r.y,i:r.i,minH:r.minH,minW:r.minW,maxH:r.maxH,maxW:r.maxW,static:r.static,droppingPosition:n?R:void 0,resizeHandles:M,resizeHandle:S},t)}render(){const{className:t,style:n,isDroppable:r,innerRef:o}=this.props,a=(0,fl.default)(Fr,t),i={height:this.containerHeight(),...n};return Ge.createElement("div",{ref:o,className:a,style:i,onDrop:r?this.onDrop:V.noop,onDragLeave:r?this.onDragLeave:V.noop,onDragEnter:r?this.onDragEnter:V.noop,onDragOver:r?this.onDragOver:V.noop},Ge.Children.map(this.props.children,c=>this.processGridItem(c)),r&&this.state.droppingDOMNode&&this.processGridItem(this.state.droppingDOMNode,!0),this.placeholder())}}Nt.default=fn;he(fn,"displayName","ReactGridLayout");he(fn,"propTypes",hl.default);he(fn,"defaultProps",{autoSize:!0,cols:12,className:"",style:{},draggableHandle:"",draggableCancel:"",containerPadding:null,rowHeight:150,maxRows:1/0,layout:[],margin:[10,10],isBounded:!1,isDraggable:!0,isResizable:!0,allowOverlap:!1,isDroppable:!1,useCSSTransforms:!0,transformScale:1,verticalCompact:!0,compactType:"vertical",preventCollision:!1,droppingItem:{i:"__dropping-elem__",h:1,w:1},resizeHandles:["se"],onLayoutChange:V.noop,onDragStart:V.noop,onDrag:V.noop,onDragStop:V.noop,onResizeStart:V.noop,onResize:V.noop,onResizeStop:V.noop,onDrop:V.noop,onDropDragOver:V.noop});var pn={},at={};Object.defineProperty(at,"__esModule",{value:!0});at.findOrGenerateResponsiveLayout=Sl;at.getBreakpointFromWidth=yl;at.getColsFromBreakpoint=Cl;at.sortBreakpoints=dr;var Lt=W;function yl(e,t){const n=dr(e);let r=n[0];for(let o=1,a=n.length;o<a;o++){const i=n[o];t>e[i]&&(r=i)}return r}function Cl(e,t){if(!t[e])throw new Error("ResponsiveReactGridLayout: `cols` entry for breakpoint "+e+" is missing!");return t[e]}function Sl(e,t,n,r,o,a){if(e[n])return(0,Lt.cloneLayout)(e[n]);let i=e[r];const c=dr(t),l=c.slice(c.indexOf(n));for(let u=0,d=l.length;u<d;u++){const h=l[u];if(e[h]){i=e[h];break}}return i=(0,Lt.cloneLayout)(i||[]),(0,Lt.compact)((0,Lt.correctBounds)(i,{cols:o}),a,o)}function dr(e){return Object.keys(e).sort(function(n,r){return e[n]-e[r]})}Object.defineProperty(pn,"__esModule",{value:!0});pn.default=void 0;var $r=Tl(w),Se=Go(qe),xn=Gn,ht=W,Xe=at,bl=Go(Nt);function Go(e){return e&&e.__esModule?e:{default:e}}function Xo(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(Xo=function(r){return r?n:t})(e)}function Tl(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=Xo(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(a!=="default"&&Object.prototype.hasOwnProperty.call(e,a)){var i=o?Object.getOwnPropertyDescriptor(e,a):null;i&&(i.get||i.set)?Object.defineProperty(r,a,i):r[a]=e[a]}return r.default=e,n&&n.set(e,r),r}function zn(){return zn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},zn.apply(this,arguments)}function Kt(e,t,n){return t=Rl(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Rl(e){var t=_l(e,"string");return typeof t=="symbol"?t:String(t)}function _l(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}const jr=e=>Object.prototype.toString.call(e);function Vt(e,t){return e==null?null:Array.isArray(e)?e:e[t]}class fr extends $r.Component{constructor(){super(...arguments),Kt(this,"state",this.generateInitialState()),Kt(this,"onLayoutChange",t=>{this.props.onLayoutChange(t,{...this.props.layouts,[this.state.breakpoint]:t})})}generateInitialState(){const{width:t,breakpoints:n,layouts:r,cols:o}=this.props,a=(0,Xe.getBreakpointFromWidth)(n,t),i=(0,Xe.getColsFromBreakpoint)(a,o),c=this.props.verticalCompact===!1?null:this.props.compactType;return{layout:(0,Xe.findOrGenerateResponsiveLayout)(r,n,a,a,i,c),breakpoint:a,cols:i}}static getDerivedStateFromProps(t,n){if(!(0,xn.deepEqual)(t.layouts,n.layouts)){const{breakpoint:r,cols:o}=n;return{layout:(0,Xe.findOrGenerateResponsiveLayout)(t.layouts,t.breakpoints,r,r,o,t.compactType),layouts:t.layouts}}return null}componentDidUpdate(t){(this.props.width!=t.width||this.props.breakpoint!==t.breakpoint||!(0,xn.deepEqual)(this.props.breakpoints,t.breakpoints)||!(0,xn.deepEqual)(this.props.cols,t.cols))&&this.onWidthChange(t)}onWidthChange(t){const{breakpoints:n,cols:r,layouts:o,compactType:a}=this.props,i=this.props.breakpoint||(0,Xe.getBreakpointFromWidth)(this.props.breakpoints,this.props.width),c=this.state.breakpoint,l=(0,Xe.getColsFromBreakpoint)(i,r),u={...o};if(c!==i||t.breakpoints!==n||t.cols!==r){c in u||(u[c]=(0,ht.cloneLayout)(this.state.layout));let f=(0,Xe.findOrGenerateResponsiveLayout)(u,n,i,c,l,a);f=(0,ht.synchronizeLayoutWithChildren)(f,this.props.children,l,a,this.props.allowOverlap),u[i]=f,this.props.onLayoutChange(f,u),this.props.onBreakpointChange(i,l),this.setState({breakpoint:i,layout:f,cols:l})}const d=Vt(this.props.margin,i),h=Vt(this.props.containerPadding,i);this.props.onWidthChange(this.props.width,d,l,h)}render(){const{breakpoint:t,breakpoints:n,cols:r,layouts:o,margin:a,containerPadding:i,onBreakpointChange:c,onLayoutChange:l,onWidthChange:u,...d}=this.props;return $r.createElement(bl.default,zn({},d,{margin:Vt(a,this.state.breakpoint),containerPadding:Vt(i,this.state.breakpoint),onLayoutChange:this.onLayoutChange,layout:this.state.layout,cols:this.state.cols}))}}pn.default=fr;Kt(fr,"propTypes",{breakpoint:Se.default.string,breakpoints:Se.default.object,allowOverlap:Se.default.bool,cols:Se.default.object,margin:Se.default.oneOfType([Se.default.array,Se.default.object]),containerPadding:Se.default.oneOfType([Se.default.array,Se.default.object]),layouts(e,t){if(jr(e[t])!=="[object Object]")throw new Error("Layout property must be an object. Received: "+jr(e[t]));Object.keys(e[t]).forEach(n=>{if(!(n in e.breakpoints))throw new Error("Each key in layouts must align with a key in breakpoints.");(0,ht.validateLayout)(e.layouts[n],"layouts."+n)})},width:Se.default.number.isRequired,onBreakpointChange:Se.default.func,onLayoutChange:Se.default.func,onWidthChange:Se.default.func});Kt(fr,"defaultProps",{breakpoints:{lg:1200,md:996,sm:768,xs:480,xxs:0},cols:{lg:12,md:10,sm:6,xs:4,xxs:2},containerPadding:{lg:null,md:null,sm:null,xs:null,xxs:null},layouts:{},margin:[10,10],allowOverlap:!1,onBreakpointChange:ht.noop,onLayoutChange:ht.noop,onWidthChange:ht.noop});var pr={},Yo=function(){if(typeof Map<"u")return Map;function e(t,n){var r=-1;return t.some(function(o,a){return o[0]===n?(r=a,!0):!1}),r}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(n){var r=e(this.__entries__,n),o=this.__entries__[r];return o&&o[1]},t.prototype.set=function(n,r){var o=e(this.__entries__,n);~o?this.__entries__[o][1]=r:this.__entries__.push([n,r])},t.prototype.delete=function(n){var r=this.__entries__,o=e(r,n);~o&&r.splice(o,1)},t.prototype.has=function(n){return!!~e(this.__entries__,n)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(n,r){r===void 0&&(r=null);for(var o=0,a=this.__entries__;o<a.length;o++){var i=a[o];n.call(r,i[1],i[0])}},t}()}(),An=typeof window<"u"&&typeof document<"u"&&window.document===document,Zt=function(){return typeof global<"u"&&global.Math===Math?global:typeof self<"u"&&self.Math===Math?self:typeof window<"u"&&window.Math===Math?window:Function("return this")()}(),wl=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(Zt):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)}}(),Il=2;function xl(e,t){var n=!1,r=!1,o=0;function a(){n&&(n=!1,e()),r&&c()}function i(){wl(a)}function c(){var l=Date.now();if(n){if(l-o<Il)return;r=!0}else n=!0,r=!1,setTimeout(i,t);o=l}return c}var Ol=20,El=["top","right","bottom","left","width","height","size","weight"],Ml=typeof MutationObserver<"u",Dl=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=xl(this.refresh.bind(this),Ol)}return e.prototype.addObserver=function(t){~this.observers_.indexOf(t)||this.observers_.push(t),this.connected_||this.connect_()},e.prototype.removeObserver=function(t){var n=this.observers_,r=n.indexOf(t);~r&&n.splice(r,1),!n.length&&this.connected_&&this.disconnect_()},e.prototype.refresh=function(){var t=this.updateObservers_();t&&this.refresh()},e.prototype.updateObservers_=function(){var t=this.observers_.filter(function(n){return n.gatherActive(),n.hasActive()});return t.forEach(function(n){return n.broadcastActive()}),t.length>0},e.prototype.connect_=function(){!An||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),Ml?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){!An||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(t){var n=t.propertyName,r=n===void 0?"":n,o=El.some(function(a){return!!~r.indexOf(a)});o&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),Ko=function(e,t){for(var n=0,r=Object.keys(t);n<r.length;n++){var o=r[n];Object.defineProperty(e,o,{value:t[o],enumerable:!1,writable:!1,configurable:!0})}return e},gt=function(e){var t=e&&e.ownerDocument&&e.ownerDocument.defaultView;return t||Zt},Zo=hn(0,0,0,0);function Jt(e){return parseFloat(e)||0}function Lr(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return t.reduce(function(r,o){var a=e["border-"+o+"-width"];return r+Jt(a)},0)}function Pl(e){for(var t=["top","right","bottom","left"],n={},r=0,o=t;r<o.length;r++){var a=o[r],i=e["padding-"+a];n[a]=Jt(i)}return n}function Nl(e){var t=e.getBBox();return hn(0,0,t.width,t.height)}function Fl(e){var t=e.clientWidth,n=e.clientHeight;if(!t&&!n)return Zo;var r=gt(e).getComputedStyle(e),o=Pl(r),a=o.left+o.right,i=o.top+o.bottom,c=Jt(r.width),l=Jt(r.height);if(r.boxSizing==="border-box"&&(Math.round(c+a)!==t&&(c-=Lr(r,"left","right")+a),Math.round(l+i)!==n&&(l-=Lr(r,"top","bottom")+i)),!jl(e)){var u=Math.round(c+a)-t,d=Math.round(l+i)-n;Math.abs(u)!==1&&(c-=u),Math.abs(d)!==1&&(l-=d)}return hn(o.left,o.top,c,l)}var $l=function(){return typeof SVGGraphicsElement<"u"?function(e){return e instanceof gt(e).SVGGraphicsElement}:function(e){return e instanceof gt(e).SVGElement&&typeof e.getBBox=="function"}}();function jl(e){return e===gt(e).document.documentElement}function Ll(e){return An?$l(e)?Nl(e):Fl(e):Zo}function Vl(e){var t=e.x,n=e.y,r=e.width,o=e.height,a=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,i=Object.create(a.prototype);return Ko(i,{x:t,y:n,width:r,height:o,top:n,right:t+r,bottom:o+n,left:t}),i}function hn(e,t,n,r){return{x:e,y:t,width:n,height:r}}var Ul=function(){function e(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=hn(0,0,0,0),this.target=t}return e.prototype.isActive=function(){var t=Ll(this.target);return this.contentRect_=t,t.width!==this.broadcastWidth||t.height!==this.broadcastHeight},e.prototype.broadcastRect=function(){var t=this.contentRect_;return this.broadcastWidth=t.width,this.broadcastHeight=t.height,t},e}(),zl=function(){function e(t,n){var r=Vl(n);Ko(this,{target:t,contentRect:r})}return e}(),Al=function(){function e(t,n,r){if(this.activeObservations_=[],this.observations_=new Yo,typeof t!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=t,this.controller_=n,this.callbackCtx_=r}return e.prototype.observe=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof gt(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(t)||(n.set(t,new Ul(t)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof gt(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(t)&&(n.delete(t),n.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var t=this;this.clearActive(),this.observations_.forEach(function(n){n.isActive()&&t.activeObservations_.push(n)})},e.prototype.broadcastActive=function(){if(this.hasActive()){var t=this.callbackCtx_,n=this.activeObservations_.map(function(r){return new zl(r.target,r.broadcastRect())});this.callback_.call(t,n,t),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e}(),Jo=typeof WeakMap<"u"?new WeakMap:new Yo,Qo=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=Dl.getInstance(),r=new Al(t,n,this);Jo.set(this,r)}return e}();["observe","unobserve","disconnect"].forEach(function(e){Qo.prototype[e]=function(){var t;return(t=Jo.get(this))[e].apply(t,arguments)}});var kl=function(){return typeof Zt.ResizeObserver<"u"?Zt.ResizeObserver:Qo}();const Hl=Object.freeze(Object.defineProperty({__proto__:null,default:kl},Symbol.toStringTag,{value:"Module"})),Wl=Za(Hl);Object.defineProperty(pr,"__esModule",{value:!0});pr.default=Jl;var Ut=Xl(w),ql=hr(qe),Bl=hr(Wl),Gl=hr(We);function hr(e){return e&&e.__esModule?e:{default:e}}function ea(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(ea=function(r){return r?n:t})(e)}function Xl(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=ea(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(a!=="default"&&Object.prototype.hasOwnProperty.call(e,a)){var i=o?Object.getOwnPropertyDescriptor(e,a):null;i&&(i.get||i.set)?Object.defineProperty(r,a,i):r[a]=e[a]}return r.default=e,n&&n.set(e,r),r}function kn(){return kn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},kn.apply(this,arguments)}function ut(e,t,n){return t=Yl(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Yl(e){var t=Kl(e,"string");return typeof t=="symbol"?t:String(t)}function Kl(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}const Zl="react-grid-layout";function Jl(e){var t;return t=class extends Ut.Component{constructor(){super(...arguments),ut(this,"state",{width:1280}),ut(this,"elementRef",Ut.createRef()),ut(this,"mounted",!1),ut(this,"resizeObserver",void 0)}componentDidMount(){this.mounted=!0,this.resizeObserver=new Bl.default(o=>{if(this.elementRef.current instanceof HTMLElement){const i=o[0].contentRect.width;this.setState({width:i})}});const r=this.elementRef.current;r instanceof HTMLElement&&this.resizeObserver.observe(r)}componentWillUnmount(){this.mounted=!1;const r=this.elementRef.current;r instanceof HTMLElement&&this.resizeObserver.unobserve(r),this.resizeObserver.disconnect()}render(){const{measureBeforeMount:r,...o}=this.props;return r&&!this.mounted?Ut.createElement("div",{className:(0,Gl.default)(this.props.className,Zl),style:this.props.style,ref:this.elementRef}):Ut.createElement(e,kn({innerRef:this.elementRef},o,this.state))}},ut(t,"defaultProps",{measureBeforeMount:!1}),ut(t,"propTypes",{measureBeforeMount:ql.default.bool}),t}(function(e){e.exports=Nt.default,e.exports.utils=W,e.exports.calculateUtils=$e,e.exports.Responsive=pn.default,e.exports.Responsive.utils=at,e.exports.WidthProvider=pr.default})(go);var Ql=go.exports;const ec=Bn(Ql),Hn={type:g.CommandType.COMMAND,id:"sheet.command.delete-conditional-rule",handler(e,t){if(!t)return!1;const n=e.get(g.IUndoRedoService),r=e.get(g.ICommandService),o=e.get(g.IUniverInstanceService),a=k.getSheetCommandTarget(o,t);if(!a)return!1;const{unitId:i,subUnitId:c}=a,l={unitId:i,subUnitId:c,cfId:t.cfId},u=s.DeleteConditionalRuleMutationUndoFactory(e,l),d=r.syncExecuteCommand(s.DeleteConditionalRuleMutation.id,l);return d&&n.pushUndoRedo({unitID:i,undoMutations:u,redoMutations:[{id:s.DeleteConditionalRuleMutation.id,params:l}]}),d}},ta={type:g.CommandType.COMMAND,id:"sheet.command.move-conditional-rule",handler(e,t){if(!t)return!1;const n=e.get(g.IUndoRedoService),r=e.get(g.ICommandService),o=e.get(g.IUniverInstanceService),a=e.get(s.ConditionalFormattingRuleModel),i=k.getSheetCommandTarget(o,t);if(!i)return!1;const{unitId:c,subUnitId:l}=i,u=s.transformSupportSymmetryAnchor(t.start,t.end,a.getSubunitRules(c,l)||[],b=>b.cfId);if(!u)return!1;const[d,h]=u,f={unitId:c,subUnitId:l,start:d,end:h},v=s.MoveConditionalRuleMutationUndoFactory(f),y=r.syncExecuteCommand(s.MoveConditionalRuleMutation.id,f);return y&&n.pushUndoRedo({unitID:c,redoMutations:[{id:s.MoveConditionalRuleMutation.id,params:f}],undoMutations:v}),y}},tc="univer-cf-preview",zt={cfPreview:tc},mt=e=>{var o,a;const t=e.rule;if(!t)return null;const n=w.useMemo(()=>{if(t.type===s.CFRuleType.colorScale){const i=t.config.map((u,d)=>({color:new g.ColorKit(u.color),value:d})),c=i.length-1;return new Array(5).fill("").map((u,d,h)=>d*c/(h.length-1)).map(u=>s.getColorScaleFromValue(i,u))}return null},[t]),r=w.useMemo(()=>{if(t.type===s.CFRuleType.iconSet)return t.config.map(i=>{const c=s.iconMap[i.iconType];return c&&c[Number(i.iconId)]})},[t]);switch(t.type){case s.CFRuleType.dataBar:{const{isGradient:i}=t.config,c={width:"50%",height:"100%"},l=i?`linear-gradient(to right, ${t.config.positiveColor}, rgb(255 255 255))`:t.config.positiveColor,u=i?`linear-gradient(to right, rgb(255 255 255),${t.config.nativeColor})`:t.config.nativeColor;return p.jsxs("div",{className:zt.cfPreview,children:[p.jsx("div",{style:{...c,background:u,border:`1px solid ${t.config.nativeColor}`}}),p.jsx("div",{style:{...c,background:l,border:`1px solid ${t.config.positiveColor}`}})]})}case s.CFRuleType.colorScale:return n&&p.jsx("div",{className:zt.cfPreview,children:n.map((i,c)=>p.jsx("div",{style:{width:`${100/n.length}%`,height:"100%",background:i}},c))});case s.CFRuleType.iconSet:return r&&p.jsx("div",{className:zt.cfPreview,children:r.map((i,c)=>i?p.jsx("img",{style:{height:"100%"},src:i},c):p.jsx(en,{},c))});case s.CFRuleType.highlightCell:{const{ul:i,st:c,it:l,bl:u,bg:d,cl:h}=t.style,f=(i==null?void 0:i.s)===g.BooleanNumber.TRUE,v=(c==null?void 0:c.s)===g.BooleanNumber.TRUE,y=l===g.BooleanNumber.TRUE,b=u===g.BooleanNumber.TRUE,x=(o=d==null?void 0:d.rgb)!=null?o:s.DEFAULT_BG_COLOR,_=(a=h==null?void 0:h.rgb)!=null?a:s.DEFAULT_FONT_COLOR,S={fontWeight:b?"bold":void 0,fontStyle:y?"italic":void 0,textDecoration:`${f?"underline":""} ${v?"line-through":""}`.replace(/^ /,"")||void 0,backgroundColor:x,color:_};return p.jsx("div",{style:S,className:zt.cfPreview,children:"123"})}}return null},nc={sheet:{cf:{title:"Conditional Formatting",menu:{manageConditionalFormatting:"Manage Conditional Formatting",createConditionalFormatting:"Create Conditional Formatting",clearRangeRules:"Clear Rules for Selected Range",clearWorkSheetRules:"Clear Rules for Entire Sheet"},form:{lessThan:"The value must be less than {0}",lessThanOrEqual:"The value must be less than or equal to {0}",greaterThan:"The value must be greater than {0}",greaterThanOrEqual:"The value must be greater than or equal to {0}",rangeSelector:"Select Range or Enter Value"},iconSet:{direction:"Direction",shape:"Shape",mark:"Mark",rank:"Rank",rule:"Rule",icon:"Icon",type:"Type",value:"Value",reverseIconOrder:"Reverse Icon Order",and:"And",when:"When",onlyShowIcon:"Only Show Icon"},symbol:{greaterThan:">",greaterThanOrEqual:">=",lessThan:"<",lessThanOrEqual:"<="},panel:{createRule:"Create Rule",clear:"Clear All Rules",range:"Apply Range",styleType:"Style Type",submit:"Submit",cancel:"Cancel",rankAndAverage:"Top/Bottom/Average",styleRule:"Style Rule",isNotBottom:"Top",isBottom:"Bottom",greaterThanAverage:"Greater Than Average",lessThanAverage:"Less Than Average",medianValue:"Median Value",fillType:"Fill Type",pureColor:"Solid Color",gradient:"Gradient",colorSet:"Color Set",positive:"Positive",native:"Negative",workSheet:"Entire Sheet",selectedRange:"Selected Range",managerRuleSelect:"Manage {0} Rules",onlyShowDataBar:"Only Show Data Bars"},preview:{describe:{beginsWith:"Begins with {0}",endsWith:"Ends with {0}",containsText:"Text contains {0}",notContainsText:"Text does not contain {0}",equal:"Equal to {0}",notEqual:"Not equal to {0}",containsBlanks:"Contains Blanks",notContainsBlanks:"Does not contain Blanks",containsErrors:"Contains Errors",notContainsErrors:"Does not contain Errors",greaterThan:"Greater than {0}",greaterThanOrEqual:"Greater than or equal to {0}",lessThan:"Less than {0}",lessThanOrEqual:"Less than or equal to {0}",notBetween:"Not between {0} and {1}",between:"Between {0} and {1}",yesterday:"Yesterday",tomorrow:"Tomorrow",last7Days:"Last 7 Days",thisMonth:"This Month",lastMonth:"Last Month",nextMonth:"Next Month",thisWeek:"This Week",lastWeek:"Last Week",nextWeek:"Next Week",today:"Today",topN:"Top {0}",bottomN:"Bottom {0}",topNPercent:"Top {0}%",bottomNPercent:"Bottom {0}%"}},operator:{beginsWith:"Begins with",endsWith:"Ends with",containsText:"Text contains",notContainsText:"Text does not contain",equal:"Equal to",notEqual:"Not equal to",containsBlanks:"Contains Blanks",notContainsBlanks:"Does not contain Blanks",containsErrors:"Contains Errors",notContainsErrors:"Does not contain Errors",greaterThan:"Greater than",greaterThanOrEqual:"Greater than or equal to",lessThan:"Less than",lessThanOrEqual:"Less than or equal to",notBetween:"Not between",between:"Between",yesterday:"Yesterday",tomorrow:"Tomorrow",last7Days:"Last 7 Days",thisMonth:"This Month",lastMonth:"Last Month",nextMonth:"Next Month",thisWeek:"This Week",lastWeek:"Last Week",nextWeek:"Next Week",today:"Today"},ruleType:{highlightCell:"Highlight Cell",dataBar:"Data Bar",colorScale:"Color Scale",formula:"Custom Formula",iconSet:"Icon Set",duplicateValues:"Duplicate Values",uniqueValues:"Unique Values"},subRuleType:{uniqueValues:"Unique Values",duplicateValues:"Duplicate Values",rank:"Rank",text:"Text",timePeriod:"Time Period",number:"Number",average:"Average"},valueType:{num:"Number",min:"Minimum",max:"Maximum",percent:"Percentage",percentile:"Percentile",formula:"Formula",none:"None"}}}},rc=nc,oc={sheet:{cf:{title:"条件格式",menu:{manageConditionalFormatting:"管理条件格式",createConditionalFormatting:"新建条件格式",clearRangeRules:"清除所选区域的规则",clearWorkSheetRules:"清除整个工作表的规则"},form:{lessThan:"该值必须小于 {0}",lessThanOrEqual:"该值必须小于等于 {0}",greaterThan:"该值必大于 {0}",greaterThanOrEqual:"该值必大于等于 {0}",rangeSelector:"选择范围或者输入值"},iconSet:{direction:"方向",shape:"形状",mark:"标记",rank:"等级",rule:"规则",icon:"图标",type:"类型",value:"值",reverseIconOrder:"反转图标次序",and:"且",when:"当值",onlyShowIcon:"仅显示图标"},symbol:{greaterThan:">",greaterThanOrEqual:">=",lessThan:"<",lessThanOrEqual:"<="},panel:{createRule:"新增规则",clear:"清空所有规则",range:"应用范围",styleType:"样式类型",submit:"确认",cancel:"取消",rankAndAverage:"最前/最后/平均值",styleRule:"样式规则",isNotBottom:"最前",isBottom:"最后",greaterThanAverage:"大于平均值",lessThanAverage:"小于平均值",medianValue:"中间值",fillType:"填充方式",pureColor:"纯色",gradient:"渐变",colorSet:"颜色设置",positive:"正值",native:"负值",workSheet:"整张工作表",selectedRange:"所选单元格",managerRuleSelect:"管理 {0} 的规则",onlyShowDataBar:"仅显示数据条"},preview:{describe:{beginsWith:"开头为{0}",endsWith:"结尾为{0}",containsText:"文本包含{0}",notContainsText:"文本不包含{0}",equal:"等于{0}",notEqual:"不等于{0}",containsBlanks:"为空",notContainsBlanks:"不为空",containsErrors:"错误",notContainsErrors:"非错误",greaterThan:"大于{0}",greaterThanOrEqual:"大于等于{0}",lessThan:"小于{0}",lessThanOrEqual:"小于等于{0}",notBetween:"不介于{0}和{1}之间",between:"介于{0}和{1}之间",yesterday:"昨日",tomorrow:"明日",last7Days:"最近7天",thisMonth:"本月",lastMonth:"上个月",nextMonth:"下个月",thisWeek:"本周",lastWeek:"上周",nextWeek:"下周",today:"今日",topN:"前{0}项",bottomN:"后{0}项",topNPercent:"前{0}%",bottomNPercent:"后{0}%"}},operator:{beginsWith:"开头为",endsWith:"结尾为",containsText:"文本包含",notContainsText:"文本不包含",equal:"等于",notEqual:"不等于",containsBlanks:"为空",notContainsBlanks:"不为空",containsErrors:"错误",notContainsErrors:"非错误",greaterThan:"大于",greaterThanOrEqual:"大于等于",lessThan:"小于",lessThanOrEqual:"小于等于",notBetween:"不介于",between:"介于",yesterday:"昨日",tomorrow:"明日",last7Days:"最近 7 天",thisMonth:"本月",lastMonth:"上个月",nextMonth:"下个月",thisWeek:"本周",lastWeek:"上周",nextWeek:"下周",today:"今日"},ruleType:{highlightCell:"突出显示单元格",dataBar:"数据条",colorScale:"色阶",formula:"自定义公式",iconSet:"图标集",duplicateValues:"重复值",uniqueValues:"唯一值"},subRuleType:{uniqueValues:"唯一值",duplicateValues:"重复值",rank:"最前最后",text:"文本",timePeriod:"时间日期",number:"数值",average:"平均值"},valueType:{num:"数值",min:"最小值",max:"最大值",percent:"百分比",percentile:"百分点",formula:"公式",none:"无"}}}},na=oc,ac={sheet:{cf:{title:"Условное форматирование",menu:{manageConditionalFormatting:"Управление условным форматированием",createConditionalFormatting:"Создание условного форматирования",clearRangeRules:"Очистить правила для выбранного диапазона",clearWorkSheetRules:"Очистить правила для всего листа"},form:{lessThan:"Значение должно быть меньше {0}",lessThanOrEqual:"Значение должно быть меньше или равно {0}",greaterThan:"Значение должно быть больше {0}",greaterThanOrEqual:"Значение должно быть больше или равно {0}",rangeSelector:"Выберите диапазон или введите значение"},iconSet:{direction:"Направление",shape:"Форма",mark:"Знак",rank:"Ранг",rule:"Правило",icon:"Иконка",type:"Тип",value:"Значение",reverseIconOrder:"Обратный порядок иконок",and:"И",when:"Когда",onlyShowIcon:"Показывать только иконку"},symbol:{greaterThan:">",greaterThanOrEqual:">=",lessThan:"<",lessThanOrEqual:"<="},panel:{createRule:"Создать правило",clear:"Очистить все правила",range:"Применить диапазон",styleType:"Тип стиля",submit:"Подтвердить",cancel:"Отменить",rankAndAverage:"Верх/Низ/Среднее",styleRule:"Правило стиля",isNotBottom:"Верх",isBottom:"Низ",greaterThanAverage:"Больше среднего",lessThanAverage:"Меньше среднего",medianValue:"Медианное значение",fillType:"Тип заполнения",pureColor:"Сплошной цвет",gradient:"Градиент",colorSet:"Набор цветов",positive:"Положительный",native:"Отрицательный",workSheet:"Весь лист",selectedRange:"Выбранный диапазон",managerRuleSelect:"Управление правилами {0}",onlyShowDataBar:"Показывать только гистограммы данных"},preview:{describe:{beginsWith:"Начинается с {0}",endsWith:"Заканчивается на {0}",containsText:"Содержит текст {0}",notContainsText:"Не содержит текст {0}",equal:"Равно {0}",notEqual:"Не равно {0}",containsBlanks:"Содержит пустые ячейки",notContainsBlanks:"Не содержит пустых ячеек",containsErrors:"Содержит ошибки",notContainsErrors:"Не содержит ошибок",greaterThan:"Больше чем {0}",greaterThanOrEqual:"Больше или равно {0}",lessThan:"Меньше чем {0}",lessThanOrEqual:"Меньше или равно {0}",notBetween:"Не между {0} и {1}",between:"Между {0} и {1}",yesterday:"Вчера",tomorrow:"Завтра",last7Days:"Последние 7 дней",thisMonth:"Этот месяц",lastMonth:"Прошлый месяц",nextMonth:"Следующий месяц",thisWeek:"Эта неделя",lastWeek:"Прошлая неделя",nextWeek:"Следующая неделя",today:"Сегодня",topN:"Топ {0}",bottomN:"Низ {0}",topNPercent:"Топ {0}%",bottomNPercent:"Низ {0}%"}},operator:{beginsWith:"Начинается с",endsWith:"Заканчивается на",containsText:"Содержит текст",notContainsText:"Не содержит текст",equal:"Равно",notEqual:"Не равно",containsBlanks:"Содержит пустые ячейки",notContainsBlanks:"Не содержит пустых ячеек",containsErrors:"Содержит ошибки",notContainsErrors:"Не содержит ошибок",greaterThan:"Больше чем",greaterThanOrEqual:"Больше или равно",lessThan:"Меньше чем",lessThanOrEqual:"Меньше или равно",notBetween:"Не между",between:"Между",yesterday:"Вчера",tomorrow:"Завтра",last7Days:"Последние 7 дней",thisMonth:"Этот месяц",lastMonth:"Прошлый месяц",nextMonth:"Следующий месяц",thisWeek:"Эта неделя",lastWeek:"Прошлая неделя",nextWeek:"Следующая неделя",today:"Сегодня"},ruleType:{highlightCell:"Выделение ячеек",dataBar:"Гистограмма данных",colorScale:"Цветовая шкала",formula:"Пользовательская формула",iconSet:"Набор иконок",duplicateValues:"Дублирующиеся значения",uniqueValues:"Уникальные значения"},subRuleType:{uniqueValues:"Уникальные значения",duplicateValues:"Дублирующиеся значения",rank:"Ранг",text:"Текст",timePeriod:"Период времени",number:"Число",average:"Среднее"},valueType:{num:"Число",min:"Минимум",max:"Максимум",percent:"Процент",percentile:"Процентиль",formula:"Формула",none:"Нет"}}}},ic=ac;var sc=Object.defineProperty,lc=Object.getOwnPropertyDescriptor,cc=(e,t,n,r)=>{for(var o=r>1?void 0:r?lc(t,n):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(o=(r?i(t,n,o):i(o))||o);return r&&o&&sc(t,n,o),o},uc=(e,t)=>(n,r)=>t(n,r,e);let Et=class extends g.Disposable{constructor(t){super();Ae(this,"_initLocal",()=>{this._localeService.load({zhCN:na})});Ae(this,"_findReplaceIndex",t=>{const n=/\{([^}]+)?\}/g,r=[];let o=n.exec(t);for(;o;)r.push({startIndex:o.index,key:Number(o[1]),endIndex:o.index+o[0].length-1}),o=n.exec(t);return r});this._localeService=t,this._initLocal()}tWithReactNode(t,...n){const r=this._localeService.getLocales(),o=t.split("."),a=r&&this._localeService.resolveKeyPath(r,o);if(typeof a=="string"){const i=[];return this._findReplaceIndex(a).forEach((c,l,u)=>{const d=u[l-1]||{startIndex:0,endIndex:-1};if(d.endIndex+1<c.startIndex){const h=a.slice(d.endIndex+1,c.startIndex);h&&i.push(h)}if(n[c.key]&&i.push(n[c.key]),l===u.length-1){const h=a.slice(c.endIndex+1);h&&i.push(h)}}),i}return[]}};Et=cc([g.OnLifecycle(g.LifecycleStages.Rendered,Et),uc(0,z.Inject(g.LocaleService))],Et);const dc=(e=[])=>{const t=te.useDependency(ce.IMarkSelectionService);w.useEffect(()=>{const n=e.map(r=>t.addShape({range:r,style:{hasAutoFill:!1,fill:"rgba(73, 184, 17, 0.05)",strokeWidth:1,stroke:"#49B811",widgets:{}},primary:{startColumn:r.startColumn,endColumn:r.endColumn,startRow:r.startRow,endRow:r.endRow,actualRow:r.startRow,actualColumn:r.startColumn,isMerged:!1,isMergedMainCell:!1}}));return()=>{n.forEach(r=>{r&&t.removeShape(r)})}},[e])},fc="univer-cf-rule-list",pc="univer-rule-selector",hc="univer-select",gc="univer-select-selector",mc="univer-select-selection-item",vc="univer-select-selection-search-input",yc="univer-btn-list",Cc="univer-gap",Sc="univer-icon",bc="univer-disabled",Tc="univer-rule-item",Rc="univer-rule-describe",_c="univer-rule-type",wc="univer-rule-range",Ic="univer-active",xc="univer-draggableHandle",Oc="univer-delete-item",Ec="univer-grid-layout-wrap",Mc="univer-react-grid-item",le={cfRuleList:fc,ruleSelector:pc,select:hc,selectSelector:gc,selectSelectionItem:mc,selectSelectionSearchInput:vc,btnList:yc,gap:Cc,icon:Sc,disabled:bc,ruleItem:Tc,ruleDescribe:Rc,ruleType:_c,ruleRange:wc,active:Ic,draggableHandle:xc,deleteItem:Oc,gridLayoutWrap:Ec,reactGridItem:Mc},Dc=(e,t)=>{const n=e.rule;switch(n.type){case s.CFRuleType.colorScale:return t.t("sheet.cf.ruleType.colorScale");case s.CFRuleType.dataBar:return t.t("sheet.cf.ruleType.dataBar");case s.CFRuleType.iconSet:return t.t("sheet.cf.ruleType.iconSet");case s.CFRuleType.highlightCell:switch(n.subType){case s.CFSubRuleType.average:{const r=n.operator;return t.t(`sheet.cf.preview.describe.${r}`,t.t("sheet.cf.subRuleType.average"))}case s.CFSubRuleType.duplicateValues:return t.t("sheet.cf.subRuleType.duplicateValues");case s.CFSubRuleType.uniqueValues:return t.t("sheet.cf.subRuleType.uniqueValues");case s.CFSubRuleType.number:{const r=n.operator;return t.t(`sheet.cf.preview.describe.${r}`,...Array.isArray(n.value)?n.value.map(o=>String(o)):[String(n.value||"")])}case s.CFSubRuleType.text:{const r=n.operator;return t.t(`sheet.cf.preview.describe.${r}`,n.value||"")}case s.CFSubRuleType.timePeriod:{const r=n.operator;return t.t(`sheet.cf.preview.describe.${r}`)}case s.CFSubRuleType.rank:return n.isPercent?n.isBottom?t.t("sheet.cf.preview.describe.bottomNPercent",String(n.value)):t.t("sheet.cf.preview.describe.topNPercent",String(n.value)):n.isBottom?t.t("sheet.cf.preview.describe.bottomN",String(n.value)):t.t("sheet.cf.preview.describe.topN",String(n.value));case s.CFSubRuleType.formula:return t.t("sheet.cf.ruleType.formula")}}};let Vr=0;const Pc=e=>{const{onClick:t}=e,n=te.useDependency(s.ConditionalFormattingRuleModel),r=te.useDependency(g.IUniverInstanceService),o=te.useDependency(k.SelectionManagerService),a=te.useDependency(g.ICommandService),i=te.useDependency(g.LocaleService),c=te.useDependency(Et),l=r.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET),u=l.getUnitId(),h=l.getActiveSheet().getSheetId(),[f,v]=w.useState([]),[y,b]=w.useState("2"),[x,_]=w.useState(0),[S,C]=w.useState(-1),[R,m]=w.useState(Vr),O=w.useRef(null),M=[{label:i.t("sheet.cf.panel.workSheet"),value:"2"},{label:i.t("sheet.cf.panel.selectedRange"),value:"1"}],I=()=>{const L=n.getSubunitRules(u,h);if(!L||!L.length)return[];if(y==="1"){const B=o.getLast();if(!B)return[];const ee=B.range;return L.filter(fe=>fe.ranges.some(ve=>g.Rectangle.intersects(ve,ee)))}else if(y==="2")return L;return[]},[F,$]=w.useState(I);dc(f),w.useEffect(()=>{const L=a.onCommandExecuted(B=>{B.id===k.SetWorksheetActiveOperation.id&&_(Math.random())});return()=>L.dispose()}),w.useEffect(()=>{$(I)},[y,x,u,h]),w.useEffect(()=>{if(y==="2")return;const L=new _e.Observable(B=>{const ee=[k.SetSelectionsOperation.id,s.AddConditionalRuleMutation.id,s.SetConditionalRuleMutation.id,s.DeleteConditionalRuleMutation.id,s.MoveConditionalRuleMutation.id],se=a.onCommandExecuted(fe=>{const{id:ve,params:ye}=fe,Me=r.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getUnitId();ee.includes(ve)&&ye.unitId===Me&&B.next(null)});return()=>se.dispose()}).pipe(_e.debounceTime(16)).subscribe(()=>{$(I)});return()=>{L.unsubscribe()}},[r,y,u,h]),w.useEffect(()=>{const L=n.$ruleChange.subscribe(()=>{_(Math.random())});return()=>L.unsubscribe()},[n]),w.useEffect(()=>{const L=()=>{var fe;const se=Math.max(0,(((fe=O.current)==null?void 0:fe.getBoundingClientRect().width)||0)-8);return Vr=se,se},ee=new _e.Observable(se=>{const fe=document.querySelector(".univer-sidebar");if(fe){let ve=setTimeout(()=>{se.next()},150);const ye=()=>{ve&&clearTimeout(ve),ve=null},Me=Be=>{Be.propertyName==="width"&&(ye(),se.next())};return fe.addEventListener("transitionend",Me),()=>{ye(),fe.removeEventListener("transitionend",Me)}}}).pipe(_e.debounceTime(16)).subscribe(()=>{m(L())});return()=>{ee.unsubscribe()}},[]);const j=L=>{const B=r.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getUnitId(),ee=r.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getActiveSheet().getSheetId();a.executeCommand(Hn.id,{unitId:B,subUnitId:ee,cfId:L.cfId})},q=(L,B)=>{C(B.y)},T=(L,B,ee)=>{C(-1);const se=r.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getUnitId(),fe=r.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getActiveSheet().getSheetId(),ve=Be=>{const Ct=F.length;return Math.min(Ct-1,Math.max(0,Be))},ye=F[ve(B.y)].cfId,Me=F[ve(ee.y)].cfId;ye!==Me&&a.executeCommand(ta.id,{unitId:se,subUnitId:fe,start:{id:ye,type:"self"},end:{id:Me,type:ee.y>B.y?"after":"before"}})},E=()=>{e.onCreate()},Z=()=>{y==="2"?a.executeCommand(Wn.id):y==="1"&&F.map(B=>({unitId:u,subUnitId:h,cfId:B.cfId})).forEach(B=>{a.executeCommand(Hn.id,B)})},me=F.map((L,B)=>({i:L.cfId,x:0,w:12,y:B,h:1,isResizable:!1}));return p.jsxs("div",{className:le.cfRuleList,children:[p.jsxs("div",{className:le.ruleSelector,children:[p.jsx("div",{children:c.tWithReactNode("sheet.cf.panel.managerRuleSelect",p.jsx(G.Select,{className:le.select,options:M,value:y,onChange:L=>{b(L)}})).map((L,B)=>p.jsx("span",{children:L},B))}),p.jsxs("div",{className:le.btnList,children:[p.jsx(G.Tooltip,{title:i.t("sheet.cf.panel.createRule"),placement:"bottom",children:p.jsx("div",{className:`${le.icon}`,onClick:E,children:p.jsx(Wa,{})})}),F.length?p.jsx(G.Tooltip,{title:i.t("sheet.cf.panel.clear"),placement:"bottom",children:p.jsx("div",{className:`${le.gap} ${le.icon}`,onClick:Z,children:p.jsx(Sn,{})})}):p.jsx("div",{className:`${le.gap} ${le.disabled}`,children:p.jsx(Sn,{})})]})]}),p.jsx("div",{ref:O,className:le.gridLayoutWrap,children:R?p.jsx(ec,{onDragStop:T,onDragStart:q,layout:me,cols:12,rowHeight:60,width:R,margin:[0,10],draggableHandle:".draggableHandle",children:F.map((L,B)=>p.jsx("div",{children:p.jsxs("div",{onMouseMove:()=>{L.ranges!==f&&v(L.ranges)},onMouseLeave:()=>v([]),onClick:()=>t(L),className:`${le.ruleItem} ${S===B?le.active:""}`,children:[p.jsx("div",{className:`${le.draggableHandle} draggableHandle`,onClick:ee=>ee.stopPropagation(),children:p.jsx(Ga,{})}),p.jsxs("div",{className:le.ruleDescribe,children:[p.jsx("div",{className:le.ruleType,children:Dc(L,i)}),p.jsx("div",{className:le.ruleRange,children:L.ranges.map(ee=>no.serializeRange(ee)).join(",")})]}),p.jsx("div",{className:le.preview,children:p.jsx(mt,{rule:L.rule})}),p.jsx("div",{className:`${le.deleteItem} ${S===B?le.active:""}`,onClick:ee=>{ee.stopPropagation(),j(L)},children:p.jsx(Sn,{})})]})},`${L.cfId}`))}):null})]})},ra={type:g.CommandType.COMMAND,id:"sheet.command.add-conditional-rule",handler(e,t){if(!t)return!1;const{rule:n}=t,r=e.get(g.IUndoRedoService),o=e.get(g.ICommandService),a=e.get(s.ConditionalFormattingRuleModel),i=e.get(g.IUniverInstanceService),c=k.getSheetCommandTarget(i);if(!c)return!1;const{unitId:l,subUnitId:u}=c,d=a.createCfId(l,u),h={unitId:l,subUnitId:u,rule:{...n,cfId:n.cfId||d}},f=s.AddConditionalRuleMutationUndoFactory(e,h),v=o.syncExecuteCommand(s.AddConditionalRuleMutation.id,h);return v&&r.pushUndoRedo({unitID:l,redoMutations:[{id:s.AddConditionalRuleMutation.id,params:h}],undoMutations:[f]}),v}},oa={type:g.CommandType.COMMAND,id:"sheet.command.set-conditional-rule",handler(e,t){if(!t)return!1;const n=e.get(g.IUndoRedoService),r=e.get(g.ICommandService),o=e.get(g.IUniverInstanceService),a=k.getSheetCommandTarget(o,t);if(!a)return!1;const{unitId:i,subUnitId:c}=a,l={unitId:i,subUnitId:c,rule:t.rule},u=s.setConditionalRuleMutationUndoFactory(e,l),d=r.syncExecuteCommand(s.SetConditionalRuleMutation.id,l);return d&&n.pushUndoRedo({unitID:i,undoMutations:u,redoMutations:[{id:s.SetConditionalRuleMutation.id,params:l}]}),d}},Nc=g.createInterceptorKey("beforeSubmit"),Fc=g.createInterceptorKey("submit"),$c="univer-cf-color-picker",jc="univer-cf-color-picker-icon",Lc="univer-icon-dropdown",On={cfColorPicker:$c,cfColorPickerIcon:jc,iconDropdown:Lc},et=e=>{const{color:t,onChange:n,disable:r=!1,iconId:o="PaintBucket",className:a,isNeedDropdownIcon:i=!0}=e,c=te.useDependency(be.ComponentManager),l=w.useMemo(()=>new g.ColorKit(t),[t]),u=c.get(o);return u&&(r?p.jsx(u,{className:a,extend:{colorChannel1:l.isValid?t:"rgb(var(--primary-color))"}}):p.jsx(G.Dropdown,{overlay:p.jsx("div",{className:`${On.cfColorPicker} `,children:p.jsx(G.ColorPicker,{color:t,onChange:n})}),children:p.jsxs("span",{className:`${On.cfColorPickerIcon} ${a}`,children:[p.jsx(u,{extend:{colorChannel1:l.isValid?t:"rgb(var(--primary-color))"}}),i&&p.jsx(qn,{className:On.iconDropdown})]})}))},Vc="univer-cf-rule-style-editor",Uc="univer-cf-preview-wrap",zc="univer-text",Ac="univer-position-relative",kc="univer-btn-list",Hc="univer-util-item",Wc="univer-icon-set",qc="univer-render-config",Bc="univer-flex",Gc="univer-width45",Xc="univer-icon-wrap",Yc="univer-icon",Kc="univer-dropdown-icon",Zc="univer-error-input",Jc="univer-error-text",Qc="univer-icon-group-list",eu="univer-title",tu="univer-group",nu="univer-item-content",ru="univer-item-wrap",ou="univer-item",au="univer-icon-item-list-wrap",iu="univer-none",su="univer-icon-item-list",lu="univer-width100",cu="univer-stress",P={cfRuleStyleEditor:Vc,cfPreviewWrap:Uc,text:zc,positionRelative:Ac,btnList:kc,utilItem:Hc,iconSet:Wc,renderConfig:qc,flex:Bc,width45:Gc,iconWrap:Xc,icon:Yc,dropdownIcon:Kc,errorInput:Zc,errorText:Jc,iconGroupList:Qc,title:eu,group:tu,itemContent:nu,itemWrap:ru,item:ou,iconItemListWrap:au,none:iu,iconItemList:su,width100:lu,stress:cu},Ye=(e,t)=>({label:t.t(`sheet.cf.valueType.${e}`),value:e}),En=e=>{const{type:t,className:n,onChange:r,id:o,value:a}=e,i=te.useDependency(g.IUniverInstanceService),c=i.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getUnitId(),l=i.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getActiveSheet().getSheetId(),u=w.useMemo(()=>String(a).startsWith("=")?String(a):"=",[a]),d=w.useMemo(()=>[s.CFValueType.max,s.CFValueType.min,"none"].includes(t)?{disabled:!0}:[s.CFValueType.percent,s.CFValueType.percentile].includes(t)?{min:0,max:100}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[t]);return t===s.CFValueType.formula?p.jsx(be.TextEditor,{openForSheetSubUnitId:l,openForSheetUnitId:c,id:g.createInternalEditorID(`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_colo_scale_${o}`),value:u,style:{maxWidth:"50%",marginLeft:4},canvasStyle:{fontSize:10},onlyInputFormula:!0,onChange:(h="")=>{r(h||"")}}):p.jsx(G.InputNumber,{className:n,value:Number(e.value)||0,onChange:h=>e.onChange(h||0),...d})},uu=e=>{var q;const{interceptorManager:t}=e,n=te.useDependency(g.LocaleService),r=((q=e.rule)==null?void 0:q.type)===s.CFRuleType.colorScale?e.rule:void 0,o=[Ye(s.CFValueType.num,n),Ye(s.CFValueType.percent,n),Ye(s.CFValueType.percentile,n),Ye(s.CFValueType.formula,n)],a=[Ye(s.CFValueType.min,n),...o],i=[Ye("none",n),...o],c=[Ye(s.CFValueType.max,n),...o],[l,u]=w.useState(()=>{var E;const T=s.CFValueType.min;return r&&((E=r.config[0])==null?void 0:E.value.type)||T}),[d,h]=w.useState(()=>{var E;const T="none";return!r||r.config.length!==3?T:((E=r.config[1])==null?void 0:E.value.type)||T}),[f,v]=w.useState(()=>{var E;const T=s.CFValueType.max;return r&&((E=r.config[r.config.length-1])==null?void 0:E.value.type)||T}),[y,b]=w.useState(()=>{if(!r)return 10;const E=r.config[0];return(E==null?void 0:E.value.value)===void 0?10:E==null?void 0:E.value.value}),[x,_]=w.useState(()=>{var Z;if(!r||r.config.length!==3)return 50;const E=(Z=r.config[1])==null?void 0:Z.value.value;return E===void 0?50:E}),[S,C]=w.useState(()=>{var Z;if(!r)return 90;const E=(Z=r.config[r.config.length-1])==null?void 0:Z.value.value;return E===void 0?90:E}),[R,m]=w.useState(()=>{var E;const T="#d0d9fb";return r&&((E=r.config[0])==null?void 0:E.color)||T}),[O,M]=w.useState(()=>{var E;const T="#7790f3";return!r||r.config.length!==3?T:((E=r.config[1])==null?void 0:E.color)||T}),[I,F]=w.useState(()=>{var E;const T="#2e55ef";return r&&((E=r.config[r.config.length-1])==null?void 0:E.color)||T}),$=w.useMemo(()=>T=>{const{minType:E,medianType:Z,maxType:me,minValue:L,medianValue:B,maxValue:ee,minColor:se,medianColor:fe,maxColor:ve}=T,ye=[];return ye.push({color:se,value:{type:E,value:L}}),Z!=="none"&&ye.push({color:fe,value:{type:Z,value:B}}),ye.push({color:ve,value:{type:me,value:ee}}),{config:ye.map((Be,Ct)=>({...Be,index:Ct})),type:s.CFRuleType.colorScale}},[]);w.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return $({minType:l,medianType:d,maxType:f,minValue:y,medianValue:x,maxValue:S,minColor:R,medianColor:O,maxColor:I})}}),[$,l,d,f,y,x,S,R,O,I,t]);const j=T=>{e.onChange($(T))};return p.jsxs("div",{children:[p.jsx("div",{className:D.title,children:n.t("sheet.cf.panel.styleRule")}),p.jsx("div",{className:`${P.cfPreviewWrap}`,children:p.jsx(mt,{rule:$({minType:l,medianType:d,maxType:f,minValue:y,medianValue:x,maxValue:S,minColor:R,medianColor:O,maxColor:I})})}),p.jsx("div",{className:D.label,children:n.t("sheet.cf.valueType.min")}),p.jsxs("div",{className:`${D.labelContainer} ${D.mTSm}`,children:[p.jsx(G.Select,{options:a,value:l,onChange:T=>{u(T);const E=s.createDefaultValueByValueType(T,10);b(E),j({minType:T,medianType:d,maxType:f,minValue:E,medianValue:x,maxValue:S,minColor:R,medianColor:O,maxColor:I})}}),p.jsx(En,{id:"min",className:`${D.mLXxs}`,value:y,type:l,onChange:T=>{b(T),j({minType:l,medianType:d,maxType:f,minValue:T,medianValue:x,maxValue:S,minColor:R,medianColor:O,maxColor:I})}}),p.jsx(et,{className:D.mLXxs,color:R,onChange:T=>{m(T),j({minType:l,medianType:d,maxType:f,minValue:y,medianValue:x,maxValue:S,minColor:T,medianColor:O,maxColor:I})}})]}),p.jsx("div",{className:D.label,children:n.t("sheet.cf.panel.medianValue")}),p.jsxs("div",{className:`${D.labelContainer} ${D.mTSm}`,children:[p.jsx(G.Select,{options:i,value:d,onChange:T=>{h(T);const E=s.createDefaultValueByValueType(T,50);_(E),j({minType:l,medianType:T,maxType:f,minValue:y,medianValue:E,maxValue:S,minColor:R,medianColor:O,maxColor:I})}}),p.jsx(En,{id:"median",className:` ${D.mLXxs}`,value:x,type:d,onChange:T=>{_(T),j({minType:l,medianType:d,maxType:f,minValue:y,medianValue:T,maxValue:S,minColor:R,medianColor:O,maxColor:I})}}),d!=="none"&&p.jsx(et,{className:D.mLXxs,color:O,onChange:T=>{M(T),j({minType:l,medianType:d,maxType:f,minValue:y,medianValue:x,maxValue:S,minColor:R,medianColor:T,maxColor:I})}})]}),p.jsx("div",{className:D.label,children:n.t("sheet.cf.valueType.max")}),p.jsxs("div",{className:`${D.labelContainer} ${D.mTSm}`,children:[p.jsx(G.Select,{options:c,value:f,onChange:T=>{v(T);const E=s.createDefaultValueByValueType(T,90);C(E),j({minType:l,medianType:d,maxType:T,minValue:y,medianValue:x,maxValue:E,minColor:R,medianColor:O,maxColor:I})}}),p.jsx(En,{id:"max",className:`${D.mLXxs}`,value:S,type:f,onChange:T=>{C(T),j({minType:l,medianType:d,maxType:f,minValue:y,medianValue:x,maxValue:T,minColor:R,medianColor:O,maxColor:I})}}),p.jsx(et,{className:D.mLXxs,color:I,onChange:T=>{F(T),j({minType:l,medianType:d,maxType:f,minValue:y,medianValue:x,maxValue:S,minColor:R,medianColor:O,maxColor:T})}})]})]})},dt=(e,t)=>({label:t.t(`sheet.cf.valueType.${e}`),value:e}),Ur=e=>{const{onChange:t,className:n,value:r,type:o,id:a,disabled:i=!1}=e,c=te.useDependency(g.IUniverInstanceService),l=c.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getUnitId(),u=c.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getActiveSheet().getSheetId(),d=w.useRef(r),h=w.useMemo(()=>[s.CFValueType.percentile,s.CFValueType.percent].includes(o)?{max:100,min:0}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[o]);if(o===s.CFValueType.formula){const f=String(d.current).startsWith("=")?String(d.current)||"":"=";return p.jsx(be.TextEditor,{id:g.createInternalEditorID(`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_data_bar_${a}`),value:f,openForSheetSubUnitId:u,openForSheetUnitId:l,style:{width:"47%",marginLeft:14},canvasStyle:{fontSize:10},onlyInputFormula:!0,onChange:(v="")=>{t(v||"")}})}return p.jsx(G.InputNumber,{className:n,value:Number(r)||0,disabled:i,onChange:f=>{t(f||0)},...h})},du=e=>{var q;const{interceptorManager:t}=e,n=te.useDependency(g.LocaleService),r=((q=e.rule)==null?void 0:q.type)===s.CFRuleType.dataBar?e.rule:void 0,[o,a]=w.useState(()=>{var E;const T="0";return r?(E=r.config)!=null&&E.isGradient?"1":"0":T}),[i,c]=w.useState(()=>{var E;const T="#abd91a";return r&&((E=r.config)==null?void 0:E.positiveColor)||T}),[l,u]=w.useState(()=>{var E;const T="#ffbe38";return r&&((E=r.config)==null?void 0:E.nativeColor)||T}),d=[dt(s.CFValueType.num,n),dt(s.CFValueType.percent,n),dt(s.CFValueType.percentile,n),dt(s.CFValueType.formula,n)],h=[dt(s.CFValueType.min,n),...d],f=[dt(s.CFValueType.max,n),...d],[v,y]=w.useState(()=>{var E;const T=h[0].value;return r&&((E=r.config)==null?void 0:E.min.type)||T}),[b,x]=w.useState(()=>{var E;const T=f[0].value;return r&&((E=r.config)==null?void 0:E.max.type)||T}),[_,S]=w.useState(()=>{var Z;if(!r)return 0;const E=((Z=r.config)==null?void 0:Z.min)||{};return E.type===s.CFValueType.formula?E.value||"=":E.value||0}),[C,R]=w.useState(()=>{var Z;if(!r)return 100;const E=((Z=r.config)==null?void 0:Z.max)||{};return E.type===s.CFValueType.formula?E.value||"=":E.value===void 0?100:E.value}),[m,O]=w.useState(()=>r?r.isShowValue===void 0?!0:!!r.isShowValue:!0),M=T=>({config:{min:{type:T.minValueType,value:T.minValue},max:{type:T.maxValueType,value:T.maxValue},isGradient:T.isGradient==="1",positiveColor:T.positiveColor,nativeColor:T.nativeColor},type:s.CFRuleType.dataBar,isShowValue:T.isShowValue});w.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return M({isGradient:o,minValue:_,minValueType:v,maxValue:C,maxValueType:b,positiveColor:i,nativeColor:l,isShowValue:m})}}),[o,_,v,C,b,i,l,t,m]);const I=T=>{e.onChange(M(T))},F=T=>{c(T),I({isGradient:o,minValue:_,minValueType:v,maxValue:C,maxValueType:b,positiveColor:T,nativeColor:l,isShowValue:m})},$=T=>{u(T),I({isGradient:o,minValue:_,minValueType:v,maxValue:C,maxValueType:b,positiveColor:i,nativeColor:T,isShowValue:m})},j=T=>d.map(E=>E.value).includes(T);return p.jsxs("div",{children:[p.jsx("div",{className:D.title,children:n.t("sheet.cf.panel.styleRule")}),p.jsx("div",{className:`${P.cfPreviewWrap}`,children:p.jsx(mt,{rule:M({isGradient:o,minValue:_,minValueType:v,maxValue:C,maxValueType:b,positiveColor:i,nativeColor:l,isShowValue:m})})}),p.jsxs("div",{children:[p.jsx("div",{className:D.label,children:n.t("sheet.cf.panel.fillType")}),p.jsxs("div",{className:`${D.mTSm} ${D.mLXxs} ${D.labelContainer} `,children:[p.jsxs(G.RadioGroup,{value:o,onChange:T=>{a(T),I({isGradient:T,minValue:_,minValueType:v,maxValue:C,maxValueType:b,positiveColor:i,nativeColor:l,isShowValue:m})},children:[p.jsx(G.Radio,{value:"0",children:p.jsx("span",{className:P.text,children:n.t("sheet.cf.panel.pureColor")})}),p.jsx(G.Radio,{value:"1",children:p.jsx("span",{className:P.text,children:n.t("sheet.cf.panel.gradient")})})]}),p.jsxs("div",{className:`${P.utilItem} ${D.mLXl}`,children:[p.jsx(G.Checkbox,{checked:!m,onChange:T=>{O(!T),I({isGradient:T,minValue:_,minValueType:v,maxValue:C,maxValueType:b,positiveColor:i,nativeColor:l,isShowValue:!T})}}),n.t("sheet.cf.panel.onlyShowDataBar")]})]})]}),p.jsxs("div",{children:[p.jsx("div",{className:D.label,children:n.t("sheet.cf.panel.colorSet")}),p.jsxs("div",{className:`${D.labelContainer} ${D.mTSm} ${D.mLXxs}`,children:[p.jsxs("div",{className:`${D.labelContainer}`,children:[p.jsx("div",{className:`${P.text}`,children:n.t("sheet.cf.panel.native")}),p.jsx(et,{color:l,onChange:$})]}),p.jsxs("div",{className:`${D.labelContainer} ${D.mLSm} `,children:[p.jsx("div",{className:`${P.text} `,children:n.t("sheet.cf.panel.positive")}),p.jsx(et,{color:i,onChange:F})]})]})]}),p.jsxs("div",{children:[p.jsx("div",{className:D.label,children:n.t("sheet.cf.valueType.min")}),p.jsxs("div",{className:`${D.mTSm} ${D.labelContainer}`,children:[p.jsx(G.Select,{options:h,value:v,onChange:T=>{y(T);const E=s.createDefaultValueByValueType(T,10);S(E),I({isGradient:o,minValue:E,minValueType:T,maxValue:C,maxValueType:b,positiveColor:i,nativeColor:l,isShowValue:m})}}),p.jsx(Ur,{disabled:!j(v),id:"min",type:v,className:D.mLSm,value:_,onChange:T=>{S(T||0),I({isGradient:o,minValue:T||0,minValueType:v,maxValue:C,maxValueType:b,positiveColor:i,nativeColor:l,isShowValue:m})}})]}),p.jsx("div",{className:D.label,children:n.t("sheet.cf.valueType.max")}),p.jsxs("div",{className:`${D.mTSm} ${D.labelContainer}`,children:[p.jsx(G.Select,{options:f,value:b,onChange:T=>{x(T);const E=s.createDefaultValueByValueType(T,90);R(E),I({isGradient:o,minValue:_,minValueType:v,maxValue:E,maxValueType:T,positiveColor:i,nativeColor:l,isShowValue:m})}}),p.jsx(Ur,{disabled:!j(b),id:"max",type:b,className:D.mLSm,value:C,onChange:T=>{R(T||0),I({isGradient:o,minValue:_,minValueType:v,maxValue:T||0,maxValueType:b,positiveColor:i,nativeColor:l,isShowValue:m})}})]})]})]})},fu="univer-cf-style-edit",pu="univer-button-item",hu="univer-isActive",Ve={cfStyleEdit:fu,buttonItem:pu,isActive:hu},At=e=>[g.BooleanNumber.FALSE,void 0].includes(e)?g.BooleanNumber.TRUE:g.BooleanNumber.FALSE,kt=e=>e!==g.BooleanNumber.FALSE,gr=e=>{const{style:t,onChange:n,className:r}=e,o=te.useDependency(be.ComponentManager),[a,i]=w.useState(()=>{if(t!=null&&t.bl)return t.bl}),[c,l]=w.useState(()=>{if(t!=null&&t.it)return t.it}),[u,d]=w.useState(()=>{if(t!=null&&t.ul)return t.ul.s}),[h,f]=w.useState(()=>{if(t!=null&&t.st)return t.st.s}),[v,y]=w.useState(()=>{var O;const m="#2f56ef";return(O=t==null?void 0:t.cl)!=null&&O.rgb?t.cl.rgb:m}),[b,x]=w.useState(()=>{var O;const m="#e8ecfc";return(O=t==null?void 0:t.bg)!=null&&O.rgb?t.bg.rgb:m}),_=o.get("BoldSingle"),S=o.get("ItalicSingle"),C=o.get("UnderlineSingle"),R=o.get("StrikethroughSingle");return w.useEffect(()=>{const m={bl:a,it:c};v!==void 0&&(m.cl={rgb:v}),b!==void 0&&(m.bg={rgb:b}),h!==void 0&&(m.st={s:h}),u!==void 0&&(m.ul={s:u}),n(s.removeUndefinedAttr(m))},[a,c,u,h,v,b]),p.jsxs("div",{className:`${Ve.cfStyleEdit} ${r}`,children:[_&&p.jsx("div",{className:We({[Ve.isActive]:kt(a||g.BooleanNumber.FALSE)},Ve.buttonItem),onClick:()=>i(At(a)),children:p.jsx(_,{})}),S&&p.jsx("div",{className:We({[Ve.isActive]:kt(c||g.BooleanNumber.FALSE)},Ve.buttonItem),onClick:()=>l(At(c)),children:p.jsx(S,{})}),C&&p.jsx("div",{className:We({[Ve.isActive]:kt(u||g.BooleanNumber.FALSE)},Ve.buttonItem),onClick:()=>d(At(u)),children:p.jsx(C,{})}),R&&p.jsx("div",{className:We({[Ve.isActive]:kt(h||g.BooleanNumber.FALSE)},Ve.buttonItem),onClick:()=>f(At(h)),children:p.jsx(R,{})}),p.jsx(et,{color:v,onChange:y,iconId:"FontColor"}),p.jsx(et,{color:b,onChange:x,iconId:"PaintBucket"})]})},gu=e=>{var x;const{onChange:t,interceptorManager:n}=e,r=te.useDependency(g.LocaleService),o=((x=e.rule)==null?void 0:x.type)===s.CFRuleType.highlightCell?e.rule:void 0,a=[{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"}],[i,c]=w.useState(()=>{const _=a[0].value,S=o==null?void 0:o.type;if(!o)return _;switch(S){case s.CFRuleType.highlightCell:switch(o.subType){case s.CFSubRuleType.average:return[s.CFNumberOperator.greaterThan,s.CFNumberOperator.greaterThanOrEqual].includes(o.operator)?"greaterThanAverage":[s.CFNumberOperator.lessThan,s.CFNumberOperator.lessThanOrEqual].includes(o.operator)?"lessThanAverage":_;case s.CFSubRuleType.rank:return o.isBottom?"isBottom":"isNotBottom"}}return _}),[l,u]=w.useState(()=>{const S=o==null?void 0:o.type;if(!o)return 10;switch(S){case s.CFRuleType.highlightCell:switch(o.subType){case s.CFSubRuleType.rank:return o.value||10}}return 10}),[d,h]=w.useState(()=>{const S=o==null?void 0:o.type;if(!o)return!1;switch(S){case s.CFRuleType.highlightCell:switch(o.subType){case s.CFSubRuleType.rank:return o.isPercent||!1}}return!1}),[f,v]=w.useState({}),y=_=>{const{type:S,isPercent:C,value:R,style:m}=_;if(S==="isNotBottom")return{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.rank,isPercent:C,isBottom:!1,value:R,style:m};if(S==="isBottom")return{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.rank,isPercent:C,isBottom:!0,value:R,style:m};if(S==="greaterThanAverage")return{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.average,operator:s.CFNumberOperator.greaterThan,style:m};if(S==="lessThanAverage")return{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.average,operator:s.CFNumberOperator.lessThan,style:m}};w.useEffect(()=>n.intercept(n.getInterceptPoints().submit,{handler(){return y({type:i,isPercent:d,value:l,style:f})}}),[i,d,l,f,n]);const b=_=>{t(y(_))};return p.jsxs("div",{children:[p.jsx("div",{className:`${D.title} ${D.mTBase}`,children:r.t("sheet.cf.panel.styleRule")}),p.jsx(G.Select,{className:`${P.width100} ${D.mTSm}`,value:i,options:a,onChange:_=>{c(_),b({type:_,isPercent:d,value:l,style:f})}}),["isNotBottom","isBottom"].includes(i)&&p.jsxs("div",{className:`${D.labelContainer} ${D.mTSm}`,children:[p.jsx(G.InputNumber,{min:1,max:1e3,value:l,onChange:_=>{const S=_||0;u(S),b({type:i,isPercent:d,value:S,style:f})}}),p.jsxs("div",{className:`${D.mLSm} ${D.labelContainer} ${P.text}`,children:[p.jsx(G.Checkbox,{checked:d,onChange:_=>{h(!!_),b({type:i,isPercent:!!_,value:l,style:f})}}),r.t("sheet.cf.valueType.percent")]})]}),p.jsx("div",{className:`${P.cfPreviewWrap} `,children:p.jsx(mt,{rule:y({type:i,isPercent:d,value:l,style:f})})}),p.jsx(gr,{style:o==null?void 0:o.style,className:`${D.mTSm} `,onChange:_=>{v(_),b({type:i,isPercent:d,value:l,style:_})}})]})},Q=(e,t)=>({label:t.t(`sheet.cf.operator.${e}`),value:e}),mu=e=>{const{type:t,operator:n,onChange:r,value:o}=e,[a,i]=w.useState(()=>typeof o=="number"?o:0),[c,l]=w.useState(()=>typeof o=="string"?o:""),[u,d]=w.useState(()=>Array.isArray(o)?o[0]===void 0?0:o[0]:0),[h,f]=w.useState(()=>Array.isArray(o)?o[1]===void 0?100:o[1]:100);switch(w.useEffect(()=>{switch(t){case s.CFSubRuleType.text:{[s.CFTextOperator.beginsWith,s.CFTextOperator.endsWith,s.CFTextOperator.containsText,s.CFTextOperator.notContainsText,s.CFTextOperator.equal,s.CFTextOperator.notEqual].includes(n)&&r(c);break}case s.CFSubRuleType.number:{[s.CFNumberOperator.equal,s.CFNumberOperator.notEqual,s.CFNumberOperator.greaterThan,s.CFNumberOperator.greaterThanOrEqual,s.CFNumberOperator.lessThan,s.CFNumberOperator.lessThanOrEqual].includes(n)&&r(a),[s.CFNumberOperator.between,s.CFNumberOperator.notBetween].includes(n)&&r([u,h]);break}}},[t]),t){case s.CFSubRuleType.text:{if([s.CFTextOperator.beginsWith,s.CFTextOperator.endsWith,s.CFTextOperator.containsText,s.CFTextOperator.notContainsText,s.CFTextOperator.equal,s.CFTextOperator.notEqual].includes(n)){const v=y=>{l(y),r(y)};return p.jsx("div",{className:`${D.mTSm}`,children:p.jsx(G.Input,{className:P.width100,value:c,onChange:v})})}break}case s.CFSubRuleType.number:{if([s.CFNumberOperator.equal,s.CFNumberOperator.notEqual,s.CFNumberOperator.greaterThan,s.CFNumberOperator.greaterThanOrEqual,s.CFNumberOperator.lessThan,s.CFNumberOperator.lessThanOrEqual].includes(n)){const v=y=>{i(y||0),r(y||0)};return p.jsx("div",{className:`${D.mTSm}`,children:p.jsx(G.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,className:P.width100,value:a,onChange:v})})}if([s.CFNumberOperator.between,s.CFNumberOperator.notBetween].includes(n)){const v=b=>{d(b||0),r([b||0,h])},y=b=>{f(b||0),r([u,b||0])};return p.jsxs("div",{className:`${D.mTSm} ${D.labelContainer} `,children:[p.jsx(G.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,value:u,onChange:v}),p.jsx(G.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,className:`${D.mLSm}`,value:h,onChange:y})]})}}}return null},zr=(e,t)=>{switch(e){case s.CFSubRuleType.text:return[Q(s.CFTextOperator.containsText,t),Q(s.CFTextOperator.notContainsText,t),Q(s.CFTextOperator.beginsWith,t),Q(s.CFTextOperator.endsWith,t),Q(s.CFTextOperator.equal,t),Q(s.CFTextOperator.notEqual,t),Q(s.CFTextOperator.containsBlanks,t),Q(s.CFTextOperator.notContainsBlanks,t),Q(s.CFTextOperator.containsErrors,t),Q(s.CFTextOperator.notContainsErrors,t)];case s.CFSubRuleType.number:return[Q(s.CFNumberOperator.between,t),Q(s.CFNumberOperator.notBetween,t),Q(s.CFNumberOperator.equal,t),Q(s.CFNumberOperator.notEqual,t),Q(s.CFNumberOperator.greaterThan,t),Q(s.CFNumberOperator.greaterThanOrEqual,t),Q(s.CFNumberOperator.lessThan,t),Q(s.CFNumberOperator.lessThanOrEqual,t)];case s.CFSubRuleType.timePeriod:return[Q(s.CFTimePeriodOperator.yesterday,t),Q(s.CFTimePeriodOperator.today,t),Q(s.CFTimePeriodOperator.tomorrow,t),Q(s.CFTimePeriodOperator.last7Days,t),Q(s.CFTimePeriodOperator.lastWeek,t),Q(s.CFTimePeriodOperator.thisWeek,t),Q(s.CFTimePeriodOperator.nextWeek,t),Q(s.CFTimePeriodOperator.lastMonth,t),Q(s.CFTimePeriodOperator.thisMonth,t),Q(s.CFTimePeriodOperator.nextMonth,t)]}},Ar=e=>{var R;const{interceptorManager:t,onChange:n}=e,r=te.useDependency(g.LocaleService),o=((R=e.rule)==null?void 0:R.type)===s.CFRuleType.highlightCell?e.rule:void 0,[a,i]=w.useState(()=>{const m=s.CFSubRuleType.text;return o&&o.subType||m}),c=[{value:s.CFSubRuleType.text,label:r.t("sheet.cf.subRuleType.text")},{value:s.CFSubRuleType.number,label:r.t("sheet.cf.subRuleType.number")},{value:s.CFSubRuleType.timePeriod,label:r.t("sheet.cf.subRuleType.timePeriod")},{value:s.CFSubRuleType.duplicateValues,label:r.t("sheet.cf.subRuleType.duplicateValues")},{value:s.CFSubRuleType.uniqueValues,label:r.t("sheet.cf.subRuleType.uniqueValues")}],l=w.useMemo(()=>zr(a,r),[a]),[u,d]=w.useState(()=>{const m=l?l[0].value:void 0;return o&&o.operator||m}),[h,f]=w.useState(()=>{var M;const m="";return o?(M=o.value)!=null?M:s.createDefaultValue(o.subType,o.operator):m}),[v,y]=w.useState({}),b=w.useMemo(()=>m=>{var O,M,I,F,$,j,q,T,E,Z,me,L,B,ee,se;switch(m.subType||a){case s.CFSubRuleType.text:{if([s.CFTextOperator.beginsWith,s.CFTextOperator.endsWith,s.CFTextOperator.containsText,s.CFTextOperator.notContainsText,s.CFTextOperator.equal,s.CFTextOperator.notEqual].includes(u))return{type:s.CFRuleType.highlightCell,subType:(O=m.subType)!=null?O:a,operator:(M=m.operator)!=null?M:u,style:(I=m.style)!=null?I:v,value:(F=m.value)!=null?F:h};break}case s.CFSubRuleType.number:{if([s.CFNumberOperator.equal,s.CFNumberOperator.notEqual,s.CFNumberOperator.greaterThan,s.CFNumberOperator.greaterThanOrEqual,s.CFNumberOperator.lessThan,s.CFNumberOperator.lessThanOrEqual].includes(u))return{type:s.CFRuleType.highlightCell,subType:($=m.subType)!=null?$:a,operator:(j=m.operator)!=null?j:u,style:(q=m.style)!=null?q:v,value:(T=m.value)!=null?T:h};if([s.CFNumberOperator.between,s.CFNumberOperator.notBetween].includes(u))return{type:s.CFRuleType.highlightCell,subType:(E=m.subType)!=null?E:a,operator:(Z=m.operator)!=null?Z:u,style:(me=m.style)!=null?me:v,value:(L=m.value)!=null?L:h};break}}return{type:s.CFRuleType.highlightCell,subType:(B=m.subType)!=null?B:a,operator:(ee=m.operator)!=null?ee:u,style:(se=m.style)!=null?se:v}},[a,u,h,v]);w.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return b({})}}),[b,t]),w.useEffect(()=>{c.some(m=>m.value===a)||i(c[0].value)},[c]);const x=m=>{const O=m,M=zr(O,r),I=M&&M[0].value;i(O),d(I),I&&f(s.createDefaultValue(O,I)),n(b({subType:O,operator:I}))},_=m=>{const O=m;d(O),n(b({operator:O}))},S=m=>{f(m),n(b({value:m}))},C=w.useMemo(()=>`${a}_${u}_${Math.random()}`,[a,u]);return p.jsxs("div",{children:[p.jsx("div",{className:`${D.title} ${D.mTBase}`,children:r.t("sheet.cf.panel.styleRule")}),p.jsx(G.Select,{className:`${D.mTSm} ${P.width100}`,onChange:x,value:a,options:c}),(l==null?void 0:l.length)&&p.jsx(G.Select,{className:`${D.mTSm} ${P.width100}`,onChange:_,value:u||"",options:l}),p.jsx(mu,{value:h,interceptorManager:t,type:a,operator:u,rule:o,onChange:S},C),p.jsx("div",{className:`${P.cfPreviewWrap}`,children:p.jsx(mt,{rule:b({})})}),p.jsx(gr,{style:o==null?void 0:o.style,className:`${D.mLXxs}`,onChange:m=>{y(m),n(b({style:m}))}})]})},vu=e=>{var y;const{onChange:t,interceptorManager:n}=e,r=te.useDependency(g.LocaleService),a=te.useDependency(g.IUniverInstanceService).getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET),i=a.getActiveSheet(),c=((y=e.rule)==null?void 0:y.type)===s.CFRuleType.highlightCell?e.rule:void 0,[l,u]=w.useState({}),[d,h]=w.useState(()=>(c==null?void 0:c.subType)===s.CFSubRuleType.formula?c.value:"="),f=b=>({style:b.style,value:d,type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.formula});w.useEffect(()=>n.intercept(n.getInterceptPoints().submit,{handler(){return f({style:l,formula:d})}}),[l,d,n]);const v=b=>{t(f(b))};return p.jsxs("div",{children:[p.jsx("div",{className:`${D.title} ${D.mTBase}`,children:r.t("sheet.cf.panel.styleRule")}),p.jsx("div",{className:`${D.mTSm}`,children:p.jsx(be.TextEditor,{id:g.createInternalEditorID(`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_formula`),openForSheetSubUnitId:i.getSheetId(),openForSheetUnitId:a.getUnitId(),value:d,canvasStyle:{fontSize:10},onlyInputFormula:!0,onChange:(b="")=>{const x=b||"";h(x),v({style:l,formula:x})}})}),p.jsx("div",{className:`${P.cfPreviewWrap} `,children:p.jsx(mt,{rule:f({style:l,formula:d})})}),p.jsx(gr,{style:c==null?void 0:c.style,className:`${D.mTSm} `,onChange:b=>{u(b),v({style:b,formula:d})}})]})};var yu="Expected a function",aa="__lodash_hash_undefined__",ia=1/0,Cu=9007199254740991,Su="[object Function]",bu="[object GeneratorFunction]",Tu="[object Symbol]",Ru=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,_u=/^\w*$/,wu=/^\./,Iu=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,xu=/[\\^$.*+?()[\]{}|]/g,Ou=/\\(\\)?/g,Eu=/^\[object .+?Constructor\]$/,Mu=/^(?:0|[1-9]\d*)$/,Du=typeof Ue=="object"&&Ue&&Ue.Object===Object&&Ue,Pu=typeof self=="object"&&self&&self.Object===Object&&self,mr=Du||Pu||Function("return this")();function Nu(e,t){return e==null?void 0:e[t]}function Fu(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch{}return t}var $u=Array.prototype,ju=Function.prototype,sa=Object.prototype,Mn=mr["__core-js_shared__"],kr=function(){var e=/[^.]+$/.exec(Mn&&Mn.keys&&Mn.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),la=ju.toString,gn=sa.hasOwnProperty,ca=sa.toString,Lu=RegExp("^"+la.call(gn).replace(xu,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Hr=mr.Symbol,Vu=$u.splice,Uu=ua(mr,"Map"),Dt=ua(Object,"create"),Wr=Hr?Hr.prototype:void 0,qr=Wr?Wr.toString:void 0;function tt(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function zu(){this.__data__=Dt?Dt(null):{}}function Au(e){return this.has(e)&&delete this.__data__[e]}function ku(e){var t=this.__data__;if(Dt){var n=t[e];return n===aa?void 0:n}return gn.call(t,e)?t[e]:void 0}function Hu(e){var t=this.__data__;return Dt?t[e]!==void 0:gn.call(t,e)}function Wu(e,t){var n=this.__data__;return n[e]=Dt&&t===void 0?aa:t,this}tt.prototype.clear=zu;tt.prototype.delete=Au;tt.prototype.get=ku;tt.prototype.has=Hu;tt.prototype.set=Wu;function vt(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function qu(){this.__data__=[]}function Bu(e){var t=this.__data__,n=mn(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():Vu.call(t,n,1),!0}function Gu(e){var t=this.__data__,n=mn(t,e);return n<0?void 0:t[n][1]}function Xu(e){return mn(this.__data__,e)>-1}function Yu(e,t){var n=this.__data__,r=mn(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}vt.prototype.clear=qu;vt.prototype.delete=Bu;vt.prototype.get=Gu;vt.prototype.has=Xu;vt.prototype.set=Yu;function it(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ku(){this.__data__={hash:new tt,map:new(Uu||vt),string:new tt}}function Zu(e){return vn(this,e).delete(e)}function Ju(e){return vn(this,e).get(e)}function Qu(e){return vn(this,e).has(e)}function ed(e,t){return vn(this,e).set(e,t),this}it.prototype.clear=Ku;it.prototype.delete=Zu;it.prototype.get=Ju;it.prototype.has=Qu;it.prototype.set=ed;function td(e,t,n){var r=e[t];(!(gn.call(e,t)&&da(r,n))||n===void 0&&!(t in e))&&(e[t]=n)}function mn(e,t){for(var n=e.length;n--;)if(da(e[n][0],t))return n;return-1}function nd(e){if(!Qt(e)||cd(e))return!1;var t=pd(e)||Fu(e)?Lu:Eu;return t.test(fd(e))}function rd(e,t,n,r){if(!Qt(e))return e;t=sd(t,e)?[t]:ad(t);for(var o=-1,a=t.length,i=a-1,c=e;c!=null&&++o<a;){var l=dd(t[o]),u=n;if(o!=i){var d=c[l];u=r?r(d,l,c):void 0,u===void 0&&(u=Qt(d)?d:id(t[o+1])?[]:{})}td(c,l,u),c=c[l]}return e}function od(e){if(typeof e=="string")return e;if(yr(e))return qr?qr.call(e):"";var t=e+"";return t=="0"&&1/e==-ia?"-0":t}function ad(e){return fa(e)?e:ud(e)}function vn(e,t){var n=e.__data__;return ld(t)?n[typeof t=="string"?"string":"hash"]:n.map}function ua(e,t){var n=Nu(e,t);return nd(n)?n:void 0}function id(e,t){return t=t==null?Cu:t,!!t&&(typeof e=="number"||Mu.test(e))&&e>-1&&e%1==0&&e<t}function sd(e,t){if(fa(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||yr(e)?!0:_u.test(e)||!Ru.test(e)||t!=null&&e in Object(t)}function ld(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function cd(e){return!!kr&&kr in e}var ud=vr(function(e){e=gd(e);var t=[];return wu.test(e)&&t.push(""),e.replace(Iu,function(n,r,o,a){t.push(o?a.replace(Ou,"$1"):r||n)}),t});function dd(e){if(typeof e=="string"||yr(e))return e;var t=e+"";return t=="0"&&1/e==-ia?"-0":t}function fd(e){if(e!=null){try{return la.call(e)}catch{}try{return e+""}catch{}}return""}function vr(e,t){if(typeof e!="function"||t&&typeof t!="function")throw new TypeError(yu);var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],a=n.cache;if(a.has(o))return a.get(o);var i=e.apply(this,r);return n.cache=a.set(o,i),i};return n.cache=new(vr.Cache||it),n}vr.Cache=it;function da(e,t){return e===t||e!==e&&t!==t}var fa=Array.isArray;function pd(e){var t=Qt(e)?ca.call(e):"";return t==Su||t==bu}function Qt(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function hd(e){return!!e&&typeof e=="object"}function yr(e){return typeof e=="symbol"||hd(e)&&ca.call(e)==Tu}function gd(e){return e==null?"":od(e)}function md(e,t,n){return e==null?e:rd(e,t,n)}var vd=md;const yd=Bn(vd);var Cd="Expected a function",pa="__lodash_hash_undefined__",ha=1/0,Sd="[object Function]",bd="[object GeneratorFunction]",Td="[object Symbol]",Rd=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,_d=/^\w*$/,wd=/^\./,Id=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,xd=/[\\^$.*+?()[\]{}|]/g,Od=/\\(\\)?/g,Ed=/^\[object .+?Constructor\]$/,Md=typeof Ue=="object"&&Ue&&Ue.Object===Object&&Ue,Dd=typeof self=="object"&&self&&self.Object===Object&&self,Cr=Md||Dd||Function("return this")();function Pd(e,t){return e==null?void 0:e[t]}function Nd(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch{}return t}var Fd=Array.prototype,$d=Function.prototype,ga=Object.prototype,Dn=Cr["__core-js_shared__"],Br=function(){var e=/[^.]+$/.exec(Dn&&Dn.keys&&Dn.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),ma=$d.toString,Sr=ga.hasOwnProperty,va=ga.toString,jd=RegExp("^"+ma.call(Sr).replace(xd,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Gr=Cr.Symbol,Ld=Fd.splice,Vd=ya(Cr,"Map"),Pt=ya(Object,"create"),Xr=Gr?Gr.prototype:void 0,Yr=Xr?Xr.toString:void 0;function nt(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ud(){this.__data__=Pt?Pt(null):{}}function zd(e){return this.has(e)&&delete this.__data__[e]}function Ad(e){var t=this.__data__;if(Pt){var n=t[e];return n===pa?void 0:n}return Sr.call(t,e)?t[e]:void 0}function kd(e){var t=this.__data__;return Pt?t[e]!==void 0:Sr.call(t,e)}function Hd(e,t){var n=this.__data__;return n[e]=Pt&&t===void 0?pa:t,this}nt.prototype.clear=Ud;nt.prototype.delete=zd;nt.prototype.get=Ad;nt.prototype.has=kd;nt.prototype.set=Hd;function yt(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Wd(){this.__data__=[]}function qd(e){var t=this.__data__,n=yn(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():Ld.call(t,n,1),!0}function Bd(e){var t=this.__data__,n=yn(t,e);return n<0?void 0:t[n][1]}function Gd(e){return yn(this.__data__,e)>-1}function Xd(e,t){var n=this.__data__,r=yn(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}yt.prototype.clear=Wd;yt.prototype.delete=qd;yt.prototype.get=Bd;yt.prototype.has=Gd;yt.prototype.set=Xd;function st(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Yd(){this.__data__={hash:new nt,map:new(Vd||yt),string:new nt}}function Kd(e){return Cn(this,e).delete(e)}function Zd(e){return Cn(this,e).get(e)}function Jd(e){return Cn(this,e).has(e)}function Qd(e,t){return Cn(this,e).set(e,t),this}st.prototype.clear=Yd;st.prototype.delete=Kd;st.prototype.get=Zd;st.prototype.has=Jd;st.prototype.set=Qd;function yn(e,t){for(var n=e.length;n--;)if(df(e[n][0],t))return n;return-1}function ef(e,t){t=of(t,e)?[t]:rf(t);for(var n=0,r=t.length;e!=null&&n<r;)e=e[cf(t[n++])];return n&&n==r?e:void 0}function tf(e){if(!Sa(e)||sf(e))return!1;var t=ff(e)||Nd(e)?jd:Ed;return t.test(uf(e))}function nf(e){if(typeof e=="string")return e;if(Tr(e))return Yr?Yr.call(e):"";var t=e+"";return t=="0"&&1/e==-ha?"-0":t}function rf(e){return Ca(e)?e:lf(e)}function Cn(e,t){var n=e.__data__;return af(t)?n[typeof t=="string"?"string":"hash"]:n.map}function ya(e,t){var n=Pd(e,t);return tf(n)?n:void 0}function of(e,t){if(Ca(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Tr(e)?!0:_d.test(e)||!Rd.test(e)||t!=null&&e in Object(t)}function af(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function sf(e){return!!Br&&Br in e}var lf=br(function(e){e=hf(e);var t=[];return wd.test(e)&&t.push(""),e.replace(Id,function(n,r,o,a){t.push(o?a.replace(Od,"$1"):r||n)}),t});function cf(e){if(typeof e=="string"||Tr(e))return e;var t=e+"";return t=="0"&&1/e==-ha?"-0":t}function uf(e){if(e!=null){try{return ma.call(e)}catch{}try{return e+""}catch{}}return""}function br(e,t){if(typeof e!="function"||t&&typeof t!="function")throw new TypeError(Cd);var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],a=n.cache;if(a.has(o))return a.get(o);var i=e.apply(this,r);return n.cache=a.set(o,i),i};return n.cache=new(br.Cache||st),n}br.Cache=st;function df(e,t){return e===t||e!==e&&t!==t}var Ca=Array.isArray;function ff(e){var t=Sa(e)?va.call(e):"";return t==Sd||t==bd}function Sa(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function pf(e){return!!e&&typeof e=="object"}function Tr(e){return typeof e=="symbol"||pf(e)&&va.call(e)==Td}function hf(e){return e==null?"":nf(e)}function gf(e,t,n){var r=e==null?void 0:ef(e,t);return r===void 0?n:r}var mf=gf;const vf=Bn(mf),ba=(e,t)=>(s.iconMap[e]||[])[Number(t)]||"",yf=e=>{const t=te.useDependency(g.IUniverInstanceService),n=t.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getUnitId(),r=t.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getActiveSheet().getSheetId(),o=w.useMemo(()=>e.error?P.errorInput:"",[e.error]);return p.jsx("div",{className:P.positionRelative,children:e.type!==s.CFValueType.formula?p.jsxs(p.Fragment,{children:[p.jsx(G.InputNumber,{className:o,value:Number(e.value)||0,onChange:a=>e.onChange(a!=null?a:0)}),e.error&&p.jsx("div",{className:P.errorText,children:e.error})]}):p.jsx(be.TextEditor,{id:g.createInternalEditorID(`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_icon_set_${e.id}`),value:String(e.value).startsWith("=")?String(e.value):"=",openForSheetSubUnitId:r,openForSheetUnitId:n,canvasStyle:{fontSize:10},onlyInputFormula:!0,onChange:(a="")=>{const i=a||"";e.onChange(i)}})})},Kr=(e,t,n)=>({operator:s.CFNumberOperator.greaterThan,value:{type:s.CFValueType.num,value:(n.length-1-t)*10},iconType:e,iconId:String(t)}),Cf=e=>{const t=te.useDependency(g.LocaleService),n=r=>{e.onClick(r)};return p.jsx("div",{className:P.iconGroupList,children:s.iconGroup.map((r,o)=>p.jsxs("div",{className:P.group,children:[p.jsx("div",{className:P.title,children:t.t(r.title)}),p.jsx("div",{className:P.itemContent,children:r.group.map(a=>p.jsx("div",{className:P.itemWrap,onClick:()=>{n(a.name)},children:p.jsx("div",{className:P.item,children:a.list.map((i,c)=>p.jsx("img",{className:P.icon,src:i},c))})},a.name))})]},o))})},Sf=e=>{const t=w.useMemo(()=>{const r=[];for(const o in s.iconMap){const a=s.iconMap[o],i=o;a.forEach((c,l)=>{r.push({iconType:i,base64:c,iconId:String(l)})})}return r},[]),n=r=>{e.onClick(r.iconType,r.iconId)};return p.jsxs("div",{className:P.iconItemListWrap,children:[p.jsxs("div",{className:P.none,onClick:()=>n({iconType:s.EMPTY_ICON_TYPE,iconId:"",base64:""}),children:[p.jsx(en,{className:P.icon}),p.jsx("span",{children:"无单元格图标"})]}),p.jsx("div",{className:P.iconItemList,children:t.map(r=>p.jsx("div",{className:P.item,children:p.jsx("img",{onClick:()=>n(r),className:`${P.icon}`,src:r.base64})},`${r.iconType}_${r.iconId}`))})]})},bf=e=>{const{onChange:t,configList:n,errorMap:r={}}=e,o=te.useDependency(g.LocaleService),a=[{label:o.t(`sheet.cf.symbol.${s.CFNumberOperator.greaterThan}`),value:s.CFNumberOperator.greaterThan},{label:o.t(`sheet.cf.symbol.${s.CFNumberOperator.greaterThanOrEqual}`),value:s.CFNumberOperator.greaterThanOrEqual}],i=[{label:o.t(`sheet.cf.valueType.${s.CFValueType.num}`),value:s.CFValueType.num},{label:o.t(`sheet.cf.valueType.${s.CFValueType.percent}`),value:s.CFValueType.percent},{label:o.t(`sheet.cf.valueType.${s.CFValueType.percentile}`),value:s.CFValueType.percentile},{label:o.t(`sheet.cf.valueType.${s.CFValueType.formula}`),value:s.CFValueType.formula}],c=(h,f)=>{t([String(f),"value","value"],h)},l=(h,f)=>{t([String(f),"operator"],h);const v=s.createDefaultValue(s.CFSubRuleType.number,h);c(v,f)},u=(h,f)=>{t([String(f),"value","type"],h)};return w.useMemo(()=>n.map((h,f)=>{const v=r[f],y=ba(h.iconType,h.iconId),b=f===n.length-1,x=f===0,_=n[f-1],S=(_==null?void 0:_.value.type)===s.CFValueType.formula?o.t("sheet.cf.valueType.formula"):_==null?void 0:_.value.value,C=(R,m)=>{const O={...h,iconId:m,iconType:R};t([String(f)],O)};return p.jsxs("div",{className:`${f?D.mTXl:D.mTSm}`,children:[p.jsxs("div",{className:`${D.label} ${P.flex}`,children:[p.jsxs("div",{className:`${P.width45}`,children:[o.t("sheet.cf.iconSet.icon"),f+1]}),p.jsx("div",{className:`${P.width45}`,children:p.jsxs(p.Fragment,{children:[!x&&!b&&o.t("sheet.cf.iconSet.rule"),!x&&!b&&p.jsxs("span",{className:P.stress,children:["(",o.t("sheet.cf.iconSet.when"),o.t(`sheet.cf.symbol.${s.getOppositeOperator(_.operator)}`),S,b?"":` ${o.t("sheet.cf.iconSet.and")} `,")"]})]})})]}),p.jsxs("div",{className:`${P.flex} ${D.mTSm}`,children:[p.jsx("div",{className:`${P.iconWrap} ${P.width45}`,children:p.jsx(G.Dropdown,{overlay:p.jsx(Sf,{onClick:C,iconId:h.iconId,iconType:h.iconType}),children:p.jsxs("div",{className:P.dropdownIcon,children:[y?p.jsx("img",{src:y,className:P.icon}):p.jsx(en,{className:P.icon}),p.jsx(qn,{})]})})}),b?p.jsxs("div",{className:`${P.width45} ${D.label}`,style:{marginTop:0},children:[o.t("sheet.cf.iconSet.rule"),p.jsxs("span",{className:P.stress,children:["(",o.t("sheet.cf.iconSet.when"),o.t(`sheet.cf.symbol.${s.getOppositeOperator(_.operator)}`),S,b?"":` ${o.t("sheet.cf.iconSet.and")} `,")"]})]}):p.jsx(G.Select,{className:`${D.mL0} ${P.width45} ${D.mR0}`,options:a,value:h.operator,onChange:R=>{l(R,f)}})]}),b?p.jsx("div",{}):p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:`${D.mTSm} ${D.label} ${P.flex}`,children:[p.jsx("div",{className:`${P.width45}`,children:o.t("sheet.cf.iconSet.type")}),p.jsx("div",{className:`${P.width45}`,children:o.t("sheet.cf.iconSet.value")})]}),p.jsxs("div",{className:`${D.mTSm} ${P.flex}`,children:[p.jsx(G.Select,{className:`${P.width45} ${D.mL0}`,options:i,value:h.value.type,onChange:R=>{u(R,f)}}),p.jsx("div",{className:`${D.mL0} ${P.width45}`,children:p.jsx(yf,{id:f,type:h.value.type,error:v,value:h.value.value||"",onChange:R=>c(R,f)})})]})]})]},f)}),[n,r])},Tf=e=>{var _;const{interceptorManager:t}=e,n=((_=e.rule)==null?void 0:_.type)===s.CFRuleType.iconSet?e.rule:void 0,r=te.useDependency(g.LocaleService),[o,a]=w.useState({}),[i,c]=w.useState(()=>{const S=Object.keys(s.iconMap)[0];if(n&&n.config.length){const C=n.config[0].iconType;if(!n.config.some(m=>m.iconType!==C))return C}return S}),[l,u]=w.useState(()=>{if(n&&n.config.length)return g.Tools.deepClone(n==null?void 0:n.config);const S=s.iconMap[i]||[];return new Array(S.length).fill("").map((C,R,m)=>R===m.length-1?{operator:s.CFNumberOperator.lessThanOrEqual,value:{type:s.CFValueType.num,value:Number.MAX_SAFE_INTEGER},iconType:i,iconId:String(R)}:Kr(i,R,m))}),[d,h]=w.useState(()=>n?!!n.isShowValue:!0),f=w.useMemo(()=>{const S=l.map(C=>ba(C.iconType,C.iconId));return p.jsx("div",{className:P.iconWrap,children:S.map((C,R)=>C?p.jsx("img",{className:P.icon,src:C},R):p.jsx(en,{className:P.icon},R))})},[l]),v=S=>{if(S.reduce((R,m,O)=>R.preType&&!R.result||S.length-1===O?R:m.value.type===s.CFValueType.formula?{preType:s.CFValueType.formula,result:!1}:R.preType?{result:R.preType===m.value.type,preType:m.value.type}:{result:!0,preType:m.value.type},{result:!0,preType:""}).result&&[s.CFValueType.num,s.CFValueType.percent,s.CFValueType.percentile].includes(S[0].value.type)){const R={};return S.forEach((m,O,M)=>{if(O-1<0||O===M.length-1)return;const F=S[O-1],$=s.getOppositeOperator(F.operator);s.compareWithNumber({operator:$,value:F.value.value},m.value.value)||(R[O]=`${r.t(`sheet.cf.form.${$}`,String(F.value.value))} `)}),R}return{}},y=(S,C)=>{vf(l,S)!==C&&(yd(l,S,C),u([...l]),a(v(l)))},b=S=>{c(S);const C=s.iconMap[S]||[],R=new Array(C.length).fill("").map((m,O,M)=>Kr(S,O,M));u(R),a(v(R))};w.useEffect(()=>{const S=t.intercept(t.getInterceptPoints().submit,{handler(){return{type:s.CFRuleType.iconSet,isShowValue:d,config:l}}});return()=>{S()}},[d,l,t]),w.useEffect(()=>{const S=t.intercept(t.getInterceptPoints().beforeSubmit,{handler(){return Object.keys(o).length===0}});return()=>{S()}},[d,l,t,o]);const x=()=>{const S=l.map(C=>({...C}));l.forEach((C,R)=>{const m=l.length-1-R,O=S[m];C.iconId=O.iconId,C.iconType=O.iconType}),u([...l])};return p.jsxs("div",{className:P.iconSet,children:[p.jsx("div",{className:D.title,children:r.t("sheet.cf.panel.styleRule")}),p.jsx("div",{className:`${D.mTSm}`,children:p.jsx(G.Dropdown,{overlay:p.jsx(Cf,{iconType:i,onClick:b}),children:p.jsxs("div",{className:P.dropdownIcon,style:{width:"unset"},children:[f,p.jsx(qn,{})]})})}),p.jsxs("div",{className:`${D.mTSm} ${P.renderConfig}`,children:[p.jsxs("div",{className:P.utilItem,children:[p.jsx(G.Checkbox,{onChange:x}),r.t("sheet.cf.iconSet.reverseIconOrder")]}),p.jsxs("div",{className:`${P.utilItem} ${D.mLXl}`,children:[p.jsx(G.Checkbox,{checked:!d,onChange:S=>{h(!S)}}),r.t("sheet.cf.iconSet.onlyShowIcon")]})]}),p.jsx(bf,{errorMap:o,onChange:y,configList:l})]})},Zr=e=>e.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getUnitId(),Jr=e=>e.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getActiveSheet().getSheetId(),Rf=e=>{var R,m,O,M;const t=te.useDependency(g.LocaleService),n=te.useDependency(g.ICommandService),r=te.useDependency(g.IUniverInstanceService),o=te.useDependency(s.ConditionalFormattingRuleModel),a=te.useDependency(k.SelectionManagerService),i=Zr(r),c=Jr(r),l=w.useRef((m=(R=e.rule)==null?void 0:R.ranges)!=null?m:[]),u=w.useMemo(()=>{var F,$;let I=(F=e.rule)==null?void 0:F.ranges;return I!=null&&I.length||(I=($=a.getSelectionRanges())!=null?$:[]),l.current=I,I!=null&&I.length?I.map(j=>{const q=no.serializeRange(j);return q==="NaN"?"":q}).filter(j=>!!j).join(","):""},[e.rule]),d=[{label:t.t("sheet.cf.ruleType.highlightCell"),value:"1"},{label:t.t("sheet.cf.panel.rankAndAverage"),value:"2"},{label:t.t("sheet.cf.ruleType.dataBar"),value:"3"},{label:t.t("sheet.cf.ruleType.colorScale"),value:"4"},{label:t.t("sheet.cf.ruleType.formula"),value:"5"},{label:t.t("sheet.cf.ruleType.iconSet"),value:"6"}],[h,f]=w.useState(()=>{var $,j;const I=($=e.rule)==null?void 0:$.rule.type,F=d[0].value;if(!I)return F;switch(I){case s.CFRuleType.highlightCell:{switch((j=e.rule)==null?void 0:j.rule.subType){case s.CFSubRuleType.number:case s.CFSubRuleType.text:case s.CFSubRuleType.duplicateValues:case s.CFSubRuleType.uniqueValues:case s.CFSubRuleType.timePeriod:return"1";case s.CFSubRuleType.average:case s.CFSubRuleType.rank:return"2";case s.CFSubRuleType.formula:return"5"}break}case s.CFRuleType.dataBar:return"3";case s.CFRuleType.colorScale:return"4";case s.CFRuleType.iconSet:return"6"}return F}),v=w.useRef(),y=w.useMemo(()=>new g.InterceptorManager({beforeSubmit:Nc,submit:Fc}),[]),b=w.useMemo(()=>{switch(h){case"1":return Ar;case"2":return gu;case"3":return du;case"4":return uu;case"5":return vu;case"6":return Tf;default:return Ar}},[h]);w.useEffect(()=>{var I;if(((I=e.rule)==null?void 0:I.cfId)!==void 0){const F=n.onCommandExecuted($=>{if($.id===k.RemoveSheetMutation.id){const j=$.params;j.subUnitId===c&&j.unitId===i&&e.onCancel()}$.id===k.SetWorksheetActiveOperation.id&&e.onCancel()});return()=>F.dispose()}},[(O=e.rule)==null?void 0:O.cfId]);const x=I=>{v.current=I},_=I=>{l.current=I.map(F=>F.range)},S=()=>{const I=y.fetchThroughInterceptors(y.getInterceptPoints().beforeSubmit)(!0,null),F=()=>{const $=r.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getActiveSheet();return l.current.map(T=>k.setEndForRange(T,$.getRowCount(),$.getColumnCount())).filter(T=>!(Number.isNaN(T.startRow)||Number.isNaN(T.startColumn)))};if(I){const $=y.fetchThroughInterceptors(y.getInterceptPoints().submit)(null,null),j=F();if($&&j.length){const q=Zr(r),T=Jr(r);let E={};e.rule&&e.rule.cfId?(E={...e.rule,ranges:j,rule:$},n.executeCommand(oa.id,{unitId:q,subUnitId:T,rule:E}),e.onCancel()):(E={cfId:o.createCfId(q,T),ranges:j,rule:$,stopIfTrue:!1},n.executeCommand(ra.id,{unitId:q,subUnitId:T,rule:E}),e.onCancel())}}},C=()=>{e.onCancel()};return p.jsxs("div",{className:P.cfRuleStyleEditor,children:[p.jsx("div",{className:D.title,children:t.t("sheet.cf.panel.range")}),p.jsx("div",{className:`${D.mTBase}`,children:p.jsx(be.RangeSelector,{placeholder:t.t("sheet.cf.form.rangeSelector"),width:"100%",openForSheetSubUnitId:c,openForSheetUnitId:i,value:u,id:g.createInternalEditorID(`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_rangeSelector`),onChange:_})}),p.jsx("div",{className:D.title,children:t.t("sheet.cf.panel.styleType")}),p.jsx("div",{className:D.mTBase,children:p.jsx(G.Select,{className:P.width100,value:h,options:d,onChange:I=>f(I)})}),p.jsx(b,{interceptorManager:y,rule:(M=e.rule)==null?void 0:M.rule,onChange:x}),p.jsxs("div",{className:`${D.mTBase} ${P.btnList}`,children:[p.jsx(G.Button,{size:"small",onClick:C,children:t.t("sheet.cf.panel.cancel")}),p.jsx(G.Button,{className:D.mLSm,size:"small",type:"primary",onClick:S,children:t.t("sheet.cf.panel.submit")})]})]})},_f=e=>{const[t,n]=w.useState(e.rule),[r,o]=w.useState(!!e.rule),a=()=>{o(!0)},i=()=>{o(!1),n(void 0)},c=l=>{n(l),o(!0)};return p.jsx("div",{className:D.conditionalFormattingWrap,children:r?p.jsx(Rf,{onCancel:i,rule:t}):p.jsx(Pc,{onClick:c,onCreate:a})})};var wf=Object.defineProperty,If=Object.getOwnPropertyDescriptor,xf=(e,t,n,r)=>{for(var o=r>1?void 0:r?If(t,n):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(o=(r?i(t,n,o):i(o))||o);return r&&o&&wf(t,n,o),o},ft=(e,t)=>(n,r)=>t(n,r,e);const Qr="sheet.conditional.formatting.panel";let Mt=class extends g.Disposable{constructor(t,n,r,o,a,i){super();Ae(this,"_sidebarDisposable",null);this._univerInstanceService=t,this._injector=n,this._componentManager=r,this._menuService=o,this._sidebarService=a,this._localeService=i,this._initMenu(),this._initPanel(),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(g.UniverInstanceType.UNIVER_SHEET).subscribe(c=>{var l;c||(l=this._sidebarDisposable)==null||l.dispose()}))}openPanel(t){const n={header:{title:this._localeService.t("sheet.cf.title")},children:{label:Qr,rule:t},onClose:()=>this._sidebarDisposable=null};this._sidebarDisposable=this._sidebarService.open(n)}_initMenu(){this._menuService.addMenuItem(Ya(this._componentManager)(this._injector))}_initPanel(){this._componentManager.register(Qr,_f)}};Mt=xf([g.OnLifecycle(g.LifecycleStages.Ready,Mt),ft(0,g.IUniverInstanceService),ft(1,z.Inject(z.Injector)),ft(2,z.Inject(be.ComponentManager)),ft(3,z.Inject(be.IMenuService)),ft(4,z.Inject(be.ISidebarService)),ft(5,z.Inject(g.LocaleService))],Mt);var Re=(e=>(e[e.createRule=1]="createRule",e[e.viewRule=2]="viewRule",e[e.highlightCell=3]="highlightCell",e[e.rank=4]="rank",e[e.formula=5]="formula",e[e.colorScale=6]="colorScale",e[e.dataBar=7]="dataBar",e[e.icon=8]="icon",e[e.clearRangeRules=9]="clearRangeRules",e[e.clearWorkSheetRules=10]="clearWorkSheetRules",e))(Re||{});const Ta={id:"sheet.operation.open.conditional.formatting.panel",type:g.CommandType.OPERATION,handler:(e,t)=>{const n=e.get(Mt),r=e.get(k.SelectionManagerService),o=e.get(g.ICommandService),a=r.getSelectionRanges()||[];switch(t.value){case 3:{n.openPanel({...s.createDefaultRule(),ranges:a});break}case 4:{const c={...s.createDefaultRule,ranges:a,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.rank}};n.openPanel(c);break}case 5:{const c={...s.createDefaultRule,ranges:a,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.formula,value:"="}};n.openPanel(c);break}case 6:{const c={...s.createDefaultRule,ranges:a,rule:{type:s.CFRuleType.colorScale,config:[]}};n.openPanel(c);break}case 7:{const c={...s.createDefaultRule,ranges:a,rule:{type:s.CFRuleType.dataBar,isShowValue:!0}};n.openPanel(c);break}case 8:{const c={...s.createDefaultRule,ranges:a,rule:{type:s.CFRuleType.iconSet,config:[],isShowValue:!0}};n.openPanel(c);break}case 2:{n.openPanel();break}case 1:{n.openPanel({...s.createDefaultRule(),ranges:a});break}case 9:{o.executeCommand(oo.id,{ranges:a});break}case 10:{o.executeCommand(Wn.id);break}}return!0}};var Of=Object.defineProperty,Ef=Object.getOwnPropertyDescriptor,Mf=(e,t,n,r)=>{for(var o=r>1?void 0:r?Ef(t,n):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(o=(r?i(t,n,o):i(o))||o);return r&&o&&Of(t,n,o),o},Ke=(e,t)=>(n,r)=>t(n,r,e);let Ht=class extends g.Disposable{constructor(e,t,n,r,o,a,i){super(),this._sheetInterceptorService=e,this._conditionalFormattingService=t,this._univerInstanceService=n,this._renderManagerService=r,this._conditionalFormattingViewModel=o,this._conditionalFormattingRuleModel=a,this._sheetSkeletonManagerService=i,this._initViewModelInterceptor(),this._initSkeleton(),this._initRender()}_initRender(){const e=[[s.dataBarUKey,s.DataBar],[s.IconUKey,s.ConditionalFormattingIcon]],t=r=>{const o=r&&this._renderManagerService.getRenderById(r),a=o&&o.mainComponent;a&&e.forEach(([i,c])=>{a.getExtensionByKey(i)||a.register(new c)})};this.disposeWithMe(this._renderManagerService.currentRender$.subscribe(r=>{r&&t(r)}));const n=this._univerInstanceService.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET);n&&t(n.getUnitId())}_initSkeleton(){const e=()=>{var n,r;this._sheetSkeletonManagerService.reCalculate();const t=this._univerInstanceService.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getUnitId();(r=(n=this._renderManagerService.getRenderById(t))==null?void 0:n.mainComponent)==null||r.makeDirty()};this.disposeWithMe(this._conditionalFormattingViewModel.markDirty$.pipe(Ee.bufferTime(16),Ee.filter(t=>{const n=this._univerInstanceService.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();return t.filter(o=>o.unitId===n.getUnitId()&&o.subUnitId===r.getSheetId()).length>0})).subscribe(e)),this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.pipe(Ee.bufferTime(16),Ee.filter(t=>{const n=this._univerInstanceService.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();return t.filter(o=>["sort","delete"].includes(o.type)&&o.unitId===n.getUnitId()&&o.subUnitId===r.getSheetId()).length>0})).subscribe(e)),this.disposeWithMe(this._conditionalFormattingService.ruleComputeStatus$.pipe(Ee.bufferTime(16),Ee.filter(t=>{const n=this._univerInstanceService.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();return t.filter(o=>o.unitId===n.getUnitId()&&o.subUnitId===r.getSheetId()).length>0})).subscribe(e))}_initViewModelInterceptor(){this.disposeWithMe(this._sheetInterceptorService.intercept(k.INTERCEPTOR_POINT.CELL_CONTENT,{handler:(e,t,n)=>{const r=this._conditionalFormattingService.composeStyle(t.unitId,t.subUnitId,t.row,t.col);if(!r)return n(e);const o=t.workbook.getStyles(),i={...(typeof(e==null?void 0:e.s)=="string"?o.get(e==null?void 0:e.s):e==null?void 0:e.s)||{}},c={...e,s:i};return r.style&&Object.assign(i,r.style),c.fontRenderExtension||(c.fontRenderExtension={},r.isShowValue!==void 0&&(c.fontRenderExtension.isSkip=!r.isShowValue)),r.dataBar&&(c.dataBar=r.dataBar),r.iconSet&&(c.iconSet=r.iconSet,c.fontRenderExtension.leftOffset=s.DEFAULT_PADDING+s.DEFAULT_WIDTH),n(c)}}))}};Ht=Mf([g.OnLifecycle(g.LifecycleStages.Rendered,Ht),Ke(0,z.Inject(k.SheetInterceptorService)),Ke(1,z.Inject(s.ConditionalFormattingService)),Ke(2,z.Inject(g.IUniverInstanceService)),Ke(3,z.Inject(Ia.IRenderManagerService)),Ke(4,z.Inject(s.ConditionalFormattingViewModel)),Ke(5,z.Inject(s.ConditionalFormattingRuleModel)),Ke(6,z.Inject(ce.SheetSkeletonManagerService))],Ht);var Df=Object.defineProperty,Pf=Object.getOwnPropertyDescriptor,Nf=(e,t,n,r)=>{for(var o=r>1?void 0:r?Pf(t,n):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(o=(r?i(t,n,o):i(o))||o);return r&&o&&Df(t,n,o),o},Tt=(e,t)=>(n,r)=>t(n,r,e);let Wt=class extends g.Disposable{constructor(t,n,r,o,a){super();Ae(this,"_copyInfo");this._sheetClipboardService=t,this._conditionalFormattingRuleModel=n,this._injector=r,this._conditionalFormattingViewModel=o,this._univerInstanceService=a,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:s.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onBeforeCopy:(t,n,r)=>this._collectConditionalRule(t,n,r),onPasteCells:(t,n,r,o)=>{const{copyType:a=ce.COPY_TYPE.COPY,pasteType:i}=o,{range:c}=t||{},{range:l}=n;return this._generateConditionalFormattingMutations(l,{copyType:a,pasteType:i,copyRange:c})}}))}_collectConditionalRule(t,n,r){const o=new g.ObjectMatrix,a={};this._copyInfo={matrix:o,info:{unitId:t,subUnitId:n,cfMap:a}};const i=this._conditionalFormattingViewModel.getMatrix(t,n);if(!i)return;const c={get:this._injector.get.bind(this._injector)},l=ce.rangeToDiscreteRange(r,c,t,n);if(!l)return;const{rows:u,cols:d}=l,h=new Set;u.forEach((f,v)=>{d.forEach((y,b)=>{const x=this._conditionalFormattingViewModel.getCellCf(t,n,f,y,i);x&&(x.cfList.forEach(_=>h.add(_.cfId)),o.setValue(v,b,x.cfList.map(_=>_.cfId)))})}),h.forEach(f=>{const v=this._conditionalFormattingRuleModel.getRule(t,n,f);v&&(a[f]=v.rule)})}_generateConditionalFormattingMutations(t,n){const r=this._univerInstanceService.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET),o=r.getActiveSheet(),a=r.getUnitId(),i=o.getSheetId();if(n.copyType===ce.COPY_TYPE.CUT)return this._copyInfo=null,{redos:[],undos:[]};if(!this._copyInfo||!n.copyRange)return{redos:[],undos:[]};if(![ce.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT,ce.PREDEFINED_HOOK_NAME.DEFAULT_PASTE,ce.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_BESIDES_BORDER].includes(n.pasteType))return{redos:[],undos:[]};const{ranges:[c,l],mapFunc:u}=ce.virtualizeDiscreteRanges([n.copyRange,t]),d=ce.getRepeatRange(c,l,!0),h=this._conditionalFormattingViewModel.getMatrix(a,i),f={};g.Range.foreach(l,(m,O)=>{const{row:M,col:I}=u(m,O),F=this._conditionalFormattingViewModel.getCellCf(a,i,M,I,h);F&&F.cfList.forEach($=>{if(!f[$.cfId]){const j=new g.ObjectMatrix;f[$.cfId]=j;const q=this._conditionalFormattingRuleModel.getRule(a,i,$.cfId);q==null||q.ranges.forEach(T=>{g.Range.foreach(T,(E,Z)=>{j.setValue(E,Z,1)})})}f[$.cfId].realDeleteValue(M,I)})});const{matrix:v,info:y}=this._copyInfo,b=[];let x=this._conditionalFormattingRuleModel.createCfId(a,i);const _={},S=m=>{if(_[m])return _[m];const O=y==null?void 0:y.cfMap[m],M=[...this._conditionalFormattingRuleModel.getSubunitRules(a,i)||[],...b].find(I=>g.Tools.diffValue(I.rule,O));if(M)return _[m]=M,M;{const I={rule:O,cfId:x,ranges:[],stopIfTrue:!1};return _[m]=I,b.push(I),x=`${Number(x)+1}`,I}};d.forEach(m=>{v&&v.forValue((O,M,I)=>{const F=g.Rectangle.getPositionRange({startRow:O,endRow:O,startColumn:M,endColumn:M},m.startRange),{row:$,col:j}=u(F.startRow,F.startColumn);I.forEach(q=>{if(!f[q]){const T=S(q),E=new g.ObjectMatrix;f[q]=E,T.ranges.forEach(Z=>{g.Range.foreach(Z,(me,L)=>{E.setValue(me,L,1)})})}f[q].setValue($,j,1)})})});const C=[],R=[];for(const m in f){const O=f[m],M=k.findAllRectangle(k.createTopMatrixFromMatrix(O));if(!M.length){const I={unitId:a,subUnitId:i,cfId:m};C.push({id:s.DeleteConditionalRuleMutation.id,params:I}),R.push(...s.DeleteConditionalRuleMutationUndoFactory(this._injector,I))}if(b.some(I=>I.cfId===m)){const I=S(m),F={unitId:a,subUnitId:i,rule:{...I,ranges:M}};C.push({id:s.AddConditionalRuleMutation.id,params:F}),R.push(s.AddConditionalRuleMutationUndoFactory(this._injector,F))}else{const I=this._conditionalFormattingRuleModel.getRule(a,i,m);if(!I)continue;const F={unitId:a,subUnitId:i,rule:{...I,ranges:M}};C.push({id:s.SetConditionalRuleMutation.id,params:F}),R.push(...s.setConditionalRuleMutationUndoFactory(this._injector,F))}}return{redos:C,undos:R}}};Wt=Nf([g.OnLifecycle(g.LifecycleStages.Rendered,Wt),Tt(0,z.Inject(ce.ISheetClipboardService)),Tt(1,z.Inject(s.ConditionalFormattingRuleModel)),Tt(2,z.Inject(z.Injector)),Tt(3,z.Inject(s.ConditionalFormattingViewModel)),Tt(4,z.Inject(g.IUniverInstanceService))],Wt);var Ff=Object.defineProperty,$f=Object.getOwnPropertyDescriptor,jf=(e,t,n,r)=>{for(var o=r>1?void 0:r?$f(t,n):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(o=(r?i(t,n,o):i(o))||o);return r&&o&&Ff(t,n,o),o},Rt=(e,t)=>(n,r)=>t(n,r,e);let qt=class extends g.Disposable{constructor(e,t,n,r,o){super(),this._injector=e,this._univerInstanceService=t,this._autoFillService=n,this._conditionalFormattingRuleModel=r,this._conditionalFormattingViewModel=o,this._initAutoFill()}_initAutoFill(){const e=()=>({redos:[],undos:[]}),t=(o,a,i,c,l)=>{const u=this._univerInstanceService.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getUnitId(),d=this._univerInstanceService.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getActiveSheet().getSheetId(),h={startRow:o.row,startColumn:o.col,endColumn:o.col,endRow:o.row},f={startRow:a.row,startColumn:a.col,endColumn:a.col,endRow:a.row};g.Range.foreach(i,(v,y)=>{const b=g.Rectangle.getPositionRange({startRow:v,startColumn:y,endColumn:y,endRow:v},h),x=g.Rectangle.getPositionRange({startRow:v,startColumn:y,endColumn:y,endRow:v},f),{row:_,col:S}=l(b.startRow,b.startColumn),C=this._conditionalFormattingViewModel.getCellCf(u,d,_,S),{row:R,col:m}=l(x.startRow,x.startColumn),O=this._conditionalFormattingViewModel.getCellCf(u,d,R,m);O&&O.cfList.forEach(M=>{let I=c.get(M.cfId);if(!c.get(M.cfId)){const F=this._conditionalFormattingRuleModel.getRule(u,d,M.cfId);if(!F)return;I=new g.ObjectMatrix,F.ranges.forEach($=>{g.Range.foreach($,(j,q)=>{I.setValue(j,q,1)})}),c.set(M.cfId,I)}I.realDeleteValue(R,m)}),C&&C.cfList.forEach(M=>{let I=c.get(M.cfId);if(!c.get(M.cfId)){const F=this._conditionalFormattingRuleModel.getRule(u,d,M.cfId);if(!F)return;I=new g.ObjectMatrix,F.ranges.forEach($=>{g.Range.foreach($,(j,q)=>{I.setValue(j,q,1)})}),c.set(M.cfId,I)}I.setValue(R,m,1)})})},n=(o,a)=>{var _,S;const i=(_=this._univerInstanceService.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET))==null?void 0:_.getUnitId(),c=(S=this._univerInstanceService.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET))==null?void 0:S.getActiveSheet().getSheetId(),l=new Map,u=[],d=[];if(!i||!c)return e();const h=ce.virtualizeDiscreteRanges([o,a]),[f,v]=h.ranges,{mapFunc:y}=h,b={row:f.startRow,col:f.startColumn};return ce.getAutoFillRepeatRange(f,v).forEach(C=>{t(b,C.repeatStartCell,C.relativeRange,l,y)}),l.forEach((C,R)=>{const m=this._conditionalFormattingRuleModel.getRule(i,c,R);if(!m)return;const O=k.findAllRectangle(k.createTopMatrixFromMatrix(C)),M={unitId:i,subUnitId:c,rule:{...m,ranges:O}};u.push({id:s.SetConditionalRuleMutation.id,params:M}),d.push(...s.setConditionalRuleMutationUndoFactory(this._injector,M))}),{undos:d,redos:u}},r={id:s.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onFillData:(o,a,i)=>{if(i===ce.APPLY_TYPE.COPY||i===ce.APPLY_TYPE.ONLY_FORMAT||i===ce.APPLY_TYPE.SERIES){const{source:c,target:l}=o;return n(c,l)}return e()}};this.disposeWithMe(this._autoFillService.addHook(r))}};qt=jf([g.OnLifecycle(g.LifecycleStages.Rendered,qt),Rt(0,z.Inject(z.Injector)),Rt(1,z.Inject(g.IUniverInstanceService)),Rt(2,z.Inject(ce.IAutoFillService)),Rt(3,z.Inject(s.ConditionalFormattingRuleModel)),Rt(4,z.Inject(s.ConditionalFormattingViewModel))],qt);var Lf=Object.defineProperty,Vf=Object.getOwnPropertyDescriptor,Uf=(e,t,n,r)=>{for(var o=r>1?void 0:r?Vf(t,n):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(o=(r?i(t,n,o):i(o))||o);return r&&o&&Lf(t,n,o),o},_t=(e,t)=>(n,r)=>t(n,r,e);let Bt=class extends g.Disposable{constructor(e,t,n,r,o){super(),this._conditionalFormattingRuleModel=e,this._univerInstanceService=t,this._injector=n,this._sheetSkeletonManagerService=r,this._refRangeService=o,this._initRefRange()}_initRefRange(){const e=new Map,t=(r,o,a)=>`${r}_${o}_${a}`,n=(r,o,a)=>{const i=l=>{const u=[...a.ranges],d=u.map(f=>k.handleDefaultRangeChangeWithEffectRefCommands(f,l)).filter(f=>!!f);if(s.isRangesEqual(d,u))return{redos:[],undos:[]};if(d.length){const f={unitId:r,subUnitId:o,rule:{...a,ranges:d}},v=[{id:s.SetConditionalRuleMutation.id,params:f}],y=s.setConditionalRuleMutationUndoFactory(this._injector,f);return{redos:v,undos:y}}else{const f={unitId:r,subUnitId:o,cfId:a.cfId},v=[{id:s.DeleteConditionalRuleMutation.id,params:f}],y=s.DeleteConditionalRuleMutationUndoFactory(this._injector,f);return{redos:v,undos:y}}},c=[];a.ranges.forEach(l=>{const u=this._refRangeService.registerRefRange(l,i);c.push(()=>u.dispose())}),e.set(t(r,o,a.cfId),()=>c.forEach(l=>l()))};this.disposeWithMe(_e.merge(this._sheetSkeletonManagerService.currentSkeleton$.pipe(Ee.map(r=>r==null?void 0:r.sheetId),Ee.distinctUntilChanged())).pipe(Ee.switchMap(()=>new _e.Observable(r=>{const o=new g.DisposableCollection;return r.next(o),()=>{o.dispose()}}))).subscribe(r=>{r.add(g.toDisposable(this._conditionalFormattingRuleModel.$ruleChange.subscribe(o=>{const{unitId:a,subUnitId:i,rule:c}=o,l=this._univerInstanceService.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET),u=l.getActiveSheet();if(!(o.unitId!==l.getUnitId()||o.subUnitId!==u.getSheetId()))switch(o.type){case"add":{n(o.unitId,o.subUnitId,o.rule);break}case"delete":{const d=e.get(t(a,i,c.cfId));d&&d();break}case"set":{const d=e.get(t(a,i,c.cfId));d&&d(),n(o.unitId,o.subUnitId,o.rule)}}})))})),this.disposeWithMe(g.toDisposable(()=>{e.forEach(r=>{r()}),e.clear()}))}};Bt=Uf([g.OnLifecycle(g.LifecycleStages.Rendered,Bt),_t(0,z.Inject(s.ConditionalFormattingRuleModel)),_t(1,z.Inject(g.IUniverInstanceService)),_t(2,z.Inject(z.Injector)),_t(3,z.Inject(ce.SheetSkeletonManagerService)),_t(4,z.Inject(k.RefRangeService))],Bt);var zf=Object.defineProperty,Af=Object.getOwnPropertyDescriptor,kf=(e,t,n,r)=>{for(var o=r>1?void 0:r?Af(t,n):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(o=(r?i(t,n,o):i(o))||o);return r&&o&&zf(t,n,o),o},eo=(e,t)=>(n,r)=>t(n,r,e);let Gt=class extends g.Disposable{constructor(e,t){super(),this._editorBridgeService=e,this._conditionalFormattingService=t,this._initInterceptorEditorEnd()}_initInterceptorEditorEnd(){this.disposeWithMe(g.toDisposable(this._editorBridgeService.interceptor.intercept(this._editorBridgeService.interceptor.getInterceptPoints().AFTER_CELL_EDIT,{handler:(e,t,n)=>{const r=this._conditionalFormattingService.composeStyle(t.unitId,t.subUnitId,t.row,t.col);if(r!=null&&r.style&&(e!=null&&e.p)){const o=Object.keys(r==null?void 0:r.style);if(o.length>0){const a=s.getStringFromDataStream(e.p),i={...(typeof e.s=="string"?t.workbook.getStyles().get(e.s):e.s)||{}};o.forEach(l=>{delete i[l]});const c={...e,s:{...i},v:a};return delete c.p,n(c)}}return n(e)}})))}};Gt=kf([g.OnLifecycle(g.LifecycleStages.Rendered,Gt),eo(0,z.Inject(ce.IEditorBridgeService)),eo(1,z.Inject(s.ConditionalFormattingService))],Gt);var Hf=Object.defineProperty,Wf=Object.getOwnPropertyDescriptor,qf=(e,t,n,r)=>{for(var o=r>1?void 0:r?Wf(t,n):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(o=(r?i(t,n,o):i(o))||o);return r&&o&&Hf(t,n,o),o},wt=(e,t)=>(n,r)=>t(n,r,e);let Xt=class extends g.Disposable{constructor(e,t,n,r,o){super(),this._injector=e,this._univerInstanceService=t,this._sheetInterceptorService=n,this._selectionManagerService=r,this._conditionalFormattingRuleModel=o,this._init()}_init(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{const t=[],n=[],r={redos:t,undos:n};if([k.ClearSelectionFormatCommand.id,k.ClearSelectionAllCommand.id].includes(e.id)){const o=this._selectionManagerService.getSelectionRanges();if(!o)return r;const a=this._univerInstanceService.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET),i=a.getActiveSheet(),c=this._conditionalFormattingRuleModel.getSubunitRules(a.getUnitId(),i.getSheetId());if(!c||!c.length)return r;c.filter(l=>o.some(u=>l.ranges.some(d=>g.Rectangle.getIntersects(d,u)))).forEach(l=>{const d=new k.RangeMergeUtil().add(...l.ranges).subtract(...o).merge();if(d.length){const h={id:s.SetConditionalRuleMutation.id,params:{unitId:a.getUnitId(),subUnitId:i.getSheetId(),rule:{...l,ranges:d}}},f=s.setConditionalRuleMutationUndoFactory(this._injector,h.params);t.push(h),n.push(...f)}else{const h={id:s.DeleteConditionalRuleMutation.id,params:{unitId:a.getUnitId(),subUnitId:i.getSheetId(),cfId:l.cfId}},f=s.DeleteConditionalRuleMutationUndoFactory(this._injector,h.params);t.push(h),n.push(...f)}})}return r}}))}};Xt=qf([g.OnLifecycle(g.LifecycleStages.Rendered,Xt),wt(0,z.Inject(z.Injector)),wt(1,z.Inject(g.IUniverInstanceService)),wt(2,z.Inject(k.SheetInterceptorService)),wt(3,z.Inject(k.SelectionManagerService)),wt(4,z.Inject(s.ConditionalFormattingRuleModel))],Xt);var Bf=Object.defineProperty,Gf=Object.getOwnPropertyDescriptor,Xf=(e,t,n,r)=>{for(var o=r>1?void 0:r?Gf(t,n):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(o=(r?i(t,n,o):i(o))||o);return r&&o&&Bf(t,n,o),o},to=(e,t)=>(n,r)=>t(n,r,e),It;exports.UniverSheetsConditionalFormattingUIPlugin=(It=class extends g.Plugin{constructor(t,n,r){super(),this._injector=n,this._commandService=r,this._initCommand(),s.SheetsConditionalFormattingPlugin.dependencyList.forEach(o=>{this._injector.add(o)}),this._injector.add([Ht]),this._injector.add([Bt]),this._injector.add([Wt]),this._injector.add([qt]),this._injector.add([Mt]),this._injector.add([Et]),this._injector.add([Gt]),this._injector.add([Xt])}_initCommand(){[...s.SheetsConditionalFormattingPlugin.mutationList,...exports.UniverSheetsConditionalFormattingUIPlugin.commandList].forEach(t=>{this._commandService.registerCommand(t)})}},Ae(It,"pluginName",s.SHEET_CONDITIONAL_FORMATTING_PLUGIN),Ae(It,"type",g.UniverInstanceType.UNIVER_SHEET),Ae(It,"commandList",[xa,Oa,Ea,Ma,Da,Pa,Na,Fa,$a,Ta,Hn,oa,ta,ra,oo,Wn]),It);exports.UniverSheetsConditionalFormattingUIPlugin=Xf([to(1,z.Inject(z.Injector)),to(2,z.Inject(g.ICommandService))],exports.UniverSheetsConditionalFormattingUIPlugin);exports.enUS=rc;exports.ruRU=ic;exports.zhCN=na;
11
+ `,e.getElementsByTagName("head")[0].appendChild(t)),e.body&&Uo(e.body,"react-draggable-transparent-selection")}function ds(e){if(e)try{if(e.body&&Vo(e.body,"react-draggable-transparent-selection"),e.selection)e.selection.empty();else{const t=(e.defaultView||window).getSelection();t&&t.type!=="Caret"&&t.removeAllRanges()}}catch{}}function Uo(e,t){e.classList?e.classList.add(t):e.className.match(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)")))||(e.className+=" ".concat(t))}function Vo(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)"),"g"),"")}var We={};Object.defineProperty(We,"__esModule",{value:!0});We.canDragX=hs;We.canDragY=gs;We.createCoreData=vs;We.createDraggableData=ys;We.getBoundPosition=fs;We.getControlPosition=ms;We.snapToGrid=ps;var _e=ke,gt=ae;function fs(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r=="string"?r:Cs(r);const o=lr(e);if(typeof r=="string"){const{ownerDocument:i}=o,a=i.defaultView;let c;if(r==="parent"?c=o.parentNode:c=i.querySelector(r),!(c instanceof a.HTMLElement))throw new Error('Bounds selector "'+r+'" could not find an element.');const l=c,u=a.getComputedStyle(o),d=a.getComputedStyle(l);r={left:-o.offsetLeft+(0,_e.int)(d.paddingLeft)+(0,_e.int)(u.marginLeft),top:-o.offsetTop+(0,_e.int)(d.paddingTop)+(0,_e.int)(u.marginTop),right:(0,gt.innerWidth)(l)-(0,gt.outerWidth)(o)-o.offsetLeft+(0,_e.int)(d.paddingRight)-(0,_e.int)(u.marginRight),bottom:(0,gt.innerHeight)(l)-(0,gt.outerHeight)(o)-o.offsetTop+(0,_e.int)(d.paddingBottom)-(0,_e.int)(u.marginBottom)}}return(0,_e.isNum)(r.right)&&(t=Math.min(t,r.right)),(0,_e.isNum)(r.bottom)&&(n=Math.min(n,r.bottom)),(0,_e.isNum)(r.left)&&(t=Math.max(t,r.left)),(0,_e.isNum)(r.top)&&(n=Math.max(n,r.top)),[t,n]}function ps(e,t,n){const r=Math.round(t/e[0])*e[0],o=Math.round(n/e[1])*e[1];return[r,o]}function hs(e){return e.props.axis==="both"||e.props.axis==="x"}function gs(e){return e.props.axis==="both"||e.props.axis==="y"}function ms(e,t,n){const r=typeof t=="number"?(0,gt.getTouch)(e,t):null;if(typeof t=="number"&&!r)return null;const o=lr(n),i=n.props.offsetParent||o.offsetParent||o.ownerDocument.body;return(0,gt.offsetXYFromParent)(r||e,i,n.props.scale)}function vs(e,t,n){const r=!(0,_e.isNum)(e.lastX),o=lr(e);return r?{node:o,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:o,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}}function ys(e,t){const n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}}function Cs(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function lr(e){const t=e.findDOMNode();if(!t)throw new Error("<DraggableCore>: Unmounted during event!");return t}var cn={},un={};Object.defineProperty(un,"__esModule",{value:!0});un.default=Ss;function Ss(){}Object.defineProperty(cn,"__esModule",{value:!0});cn.default=void 0;var wn=Ts(I),be=cr(Ke),bs=cr(so),ve=ae,Ge=We,In=ke,Rt=cr(un);function cr(e){return e&&e.__esModule?e:{default:e}}function ko(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(ko=function(r){return r?n:t})(e)}function Ts(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=ko(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function Ce(e,t,n){return t=Rs(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Rs(e){var t=_s(e,"string");return typeof t=="symbol"?t:String(t)}function _s(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}const Ne={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let Xe=Ne.mouse,dn=class extends wn.Component{constructor(){super(...arguments),Ce(this,"dragging",!1),Ce(this,"lastX",NaN),Ce(this,"lastY",NaN),Ce(this,"touchIdentifier",null),Ce(this,"mounted",!1),Ce(this,"handleDragStart",t=>{if(this.props.onMouseDown(t),!this.props.allowAnyClick&&typeof t.button=="number"&&t.button!==0)return!1;const n=this.findDOMNode();if(!n||!n.ownerDocument||!n.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:r}=n;if(this.props.disabled||!(t.target instanceof r.defaultView.Node)||this.props.handle&&!(0,ve.matchesSelectorAndParentsTo)(t.target,this.props.handle,n)||this.props.cancel&&(0,ve.matchesSelectorAndParentsTo)(t.target,this.props.cancel,n))return;t.type==="touchstart"&&t.preventDefault();const o=(0,ve.getTouchIdentifier)(t);this.touchIdentifier=o;const i=(0,Ge.getControlPosition)(t,o,this);if(i==null)return;const{x:a,y:c}=i,l=(0,Ge.createCoreData)(this,a,c);(0,Rt.default)("DraggableCore: handleDragStart: %j",l),(0,Rt.default)("calling",this.props.onStart),!(this.props.onStart(t,l)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,ve.addUserSelectStyles)(r),this.dragging=!0,this.lastX=a,this.lastY=c,(0,ve.addEvent)(r,Xe.move,this.handleDrag),(0,ve.addEvent)(r,Xe.stop,this.handleDragStop))}),Ce(this,"handleDrag",t=>{const n=(0,Ge.getControlPosition)(t,this.touchIdentifier,this);if(n==null)return;let{x:r,y:o}=n;if(Array.isArray(this.props.grid)){let c=r-this.lastX,l=o-this.lastY;if([c,l]=(0,Ge.snapToGrid)(this.props.grid,c,l),!c&&!l)return;r=this.lastX+c,o=this.lastY+l}const i=(0,Ge.createCoreData)(this,r,o);if((0,Rt.default)("DraggableCore: handleDrag: %j",i),this.props.onDrag(t,i)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const l=document.createEvent("MouseEvents");l.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(l)}return}this.lastX=r,this.lastY=o}),Ce(this,"handleDragStop",t=>{if(!this.dragging)return;const n=(0,Ge.getControlPosition)(t,this.touchIdentifier,this);if(n==null)return;let{x:r,y:o}=n;if(Array.isArray(this.props.grid)){let l=r-this.lastX||0,u=o-this.lastY||0;[l,u]=(0,Ge.snapToGrid)(this.props.grid,l,u),r=this.lastX+l,o=this.lastY+u}const i=(0,Ge.createCoreData)(this,r,o);if(this.props.onStop(t,i)===!1||this.mounted===!1)return!1;const c=this.findDOMNode();c&&this.props.enableUserSelectHack&&(0,ve.removeUserSelectStyles)(c.ownerDocument),(0,Rt.default)("DraggableCore: handleDragStop: %j",i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,c&&((0,Rt.default)("DraggableCore: Removing handlers"),(0,ve.removeEvent)(c.ownerDocument,Xe.move,this.handleDrag),(0,ve.removeEvent)(c.ownerDocument,Xe.stop,this.handleDragStop))}),Ce(this,"onMouseDown",t=>(Xe=Ne.mouse,this.handleDragStart(t))),Ce(this,"onMouseUp",t=>(Xe=Ne.mouse,this.handleDragStop(t))),Ce(this,"onTouchStart",t=>(Xe=Ne.touch,this.handleDragStart(t))),Ce(this,"onTouchEnd",t=>(Xe=Ne.touch,this.handleDragStop(t)))}componentDidMount(){this.mounted=!0;const t=this.findDOMNode();t&&(0,ve.addEvent)(t,Ne.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const t=this.findDOMNode();if(t){const{ownerDocument:n}=t;(0,ve.removeEvent)(n,Ne.mouse.move,this.handleDrag),(0,ve.removeEvent)(n,Ne.touch.move,this.handleDrag),(0,ve.removeEvent)(n,Ne.mouse.stop,this.handleDragStop),(0,ve.removeEvent)(n,Ne.touch.stop,this.handleDragStop),(0,ve.removeEvent)(t,Ne.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,ve.removeUserSelectStyles)(n)}}findDOMNode(){var t,n;return(t=this.props)!==null&&t!==void 0&&t.nodeRef?(n=this.props)===null||n===void 0||(n=n.nodeRef)===null||n===void 0?void 0:n.current:bs.default.findDOMNode(this)}render(){return wn.cloneElement(wn.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};cn.default=dn;Ce(dn,"displayName","DraggableCore");Ce(dn,"propTypes",{allowAnyClick:be.default.bool,children:be.default.node.isRequired,disabled:be.default.bool,enableUserSelectHack:be.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:be.default.arrayOf(be.default.number),handle:be.default.string,cancel:be.default.string,nodeRef:be.default.object,onStart:be.default.func,onDrag:be.default.func,onStop:be.default.func,onMouseDown:be.default.func,scale:be.default.number,className:In.dontSetMe,style:In.dontSetMe,transform:In.dontSetMe});Ce(dn,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1});(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"DraggableCore",{enumerable:!0,get:function(){return l.default}}),e.default=void 0;var t=f(I),n=d(Ke),r=d(so),o=d(Ye),i=ae,a=We,c=ke,l=d(cn),u=d(un);function d(b){return b&&b.__esModule?b:{default:b}}function p(b){if(typeof WeakMap!="function")return null;var C=new WeakMap,T=new WeakMap;return(p=function(m){return m?T:C})(b)}function f(b,C){if(!C&&b&&b.__esModule)return b;if(b===null||typeof b!="object"&&typeof b!="function")return{default:b};var T=p(C);if(T&&T.has(b))return T.get(b);var m={},O=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var E in b)if(E!=="default"&&Object.prototype.hasOwnProperty.call(b,E)){var w=O?Object.getOwnPropertyDescriptor(b,E):null;w&&(w.get||w.set)?Object.defineProperty(m,E,w):m[E]=b[E]}return m.default=b,T&&T.set(b,m),m}function v(){return v=Object.assign?Object.assign.bind():function(b){for(var C=1;C<arguments.length;C++){var T=arguments[C];for(var m in T)Object.prototype.hasOwnProperty.call(T,m)&&(b[m]=T[m])}return b},v.apply(this,arguments)}function y(b,C,T){return C=S(C),C in b?Object.defineProperty(b,C,{value:T,enumerable:!0,configurable:!0,writable:!0}):b[C]=T,b}function S(b){var C=x(b,"string");return typeof C=="symbol"?C:String(C)}function x(b,C){if(typeof b!="object"||b===null)return b;var T=b[Symbol.toPrimitive];if(T!==void 0){var m=T.call(b,C||"default");if(typeof m!="object")return m;throw new TypeError("@@toPrimitive must return a primitive value.")}return(C==="string"?String:Number)(b)}class _ extends t.Component{static getDerivedStateFromProps(C,T){let{position:m}=C,{prevPropsPosition:O}=T;return m&&(!O||m.x!==O.x||m.y!==O.y)?((0,u.default)("Draggable: getDerivedStateFromProps %j",{position:m,prevPropsPosition:O}),{x:m.x,y:m.y,prevPropsPosition:{...m}}):null}constructor(C){super(C),y(this,"onDragStart",(T,m)=>{if((0,u.default)("Draggable: onDragStart: %j",m),this.props.onStart(T,(0,a.createDraggableData)(this,m))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),y(this,"onDrag",(T,m)=>{if(!this.state.dragging)return!1;(0,u.default)("Draggable: onDrag: %j",m);const O=(0,a.createDraggableData)(this,m),E={x:O.x,y:O.y,slackX:0,slackY:0};if(this.props.bounds){const{x:F,y:j}=E;E.x+=this.state.slackX,E.y+=this.state.slackY;const[L,q]=(0,a.getBoundPosition)(this,E.x,E.y);E.x=L,E.y=q,E.slackX=this.state.slackX+(F-E.x),E.slackY=this.state.slackY+(j-E.y),O.x=E.x,O.y=E.y,O.deltaX=E.x-this.state.x,O.deltaY=E.y-this.state.y}if(this.props.onDrag(T,O)===!1)return!1;this.setState(E)}),y(this,"onDragStop",(T,m)=>{if(!this.state.dragging||this.props.onStop(T,(0,a.createDraggableData)(this,m))===!1)return!1;(0,u.default)("Draggable: onDragStop: %j",m);const E={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:F,y:j}=this.props.position;E.x=F,E.y=j}this.setState(E)}),this.state={dragging:!1,dragged:!1,x:C.position?C.position.x:C.defaultPosition.x,y:C.position?C.position.y:C.defaultPosition.y,prevPropsPosition:{...C.position},slackX:0,slackY:0,isElementSVG:!1},C.position&&!(C.onDrag||C.onStop)&&console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}componentDidMount(){typeof window.SVGElement<"u"&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.setState({dragging:!1})}findDOMNode(){var C,T;return(C=(T=this.props)===null||T===void 0||(T=T.nodeRef)===null||T===void 0?void 0:T.current)!==null&&C!==void 0?C:r.default.findDOMNode(this)}render(){const{axis:C,bounds:T,children:m,defaultPosition:O,defaultClassName:E,defaultClassNameDragging:w,defaultClassNameDragged:F,position:j,positionOffset:L,scale:q,...R}=this.props;let P={},J=null;const he=!!!j||this.state.dragging,ge=j||O,Pe={x:(0,a.canDragX)(this)&&he?this.state.x:ge.x,y:(0,a.canDragY)(this)&&he?this.state.y:ge.y};this.state.isElementSVG?J=(0,i.createSVGTransform)(Pe,L):P=(0,i.createCSSTransform)(Pe,L);const k=(0,o.default)(m.props.className||"",E,{[w]:this.state.dragging,[F]:this.state.dragged});return t.createElement(l.default,v({},R,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),t.cloneElement(t.Children.only(m),{className:k,style:{...m.props.style,...P},transform:J}))}}e.default=_,y(_,"displayName","Draggable"),y(_,"propTypes",{...l.default.propTypes,axis:n.default.oneOf(["both","x","y","none"]),bounds:n.default.oneOfType([n.default.shape({left:n.default.number,right:n.default.number,top:n.default.number,bottom:n.default.number}),n.default.string,n.default.oneOf([!1])]),defaultClassName:n.default.string,defaultClassNameDragging:n.default.string,defaultClassNameDragged:n.default.string,defaultPosition:n.default.shape({x:n.default.number,y:n.default.number}),positionOffset:n.default.shape({x:n.default.oneOfType([n.default.number,n.default.string]),y:n.default.oneOfType([n.default.number,n.default.string])}),position:n.default.shape({x:n.default.number,y:n.default.number}),className:c.dontSetMe,style:c.dontSetMe,transform:c.dontSetMe}),y(_,"defaultProps",{...l.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})})(No);const{default:Wo,DraggableCore:ws}=No;ln.exports=Wo;ln.exports.default=Wo;ln.exports.DraggableCore=ws;var zo=ln.exports,fn={exports:{}},$t={},ur={};ur.__esModule=!0;ur.cloneElement=Ds;var Is=xs(I);function xs(e){return e&&e.__esModule?e:{default:e}}function Mr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Nr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Mr(Object(n),!0).forEach(function(r){Os(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Mr(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Os(e,t,n){return t=Es(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Es(e){var t=Ps(e,"string");return typeof t=="symbol"?t:String(t)}function Ps(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ds(e,t){return t.style&&e.props.style&&(t.style=Nr(Nr({},e.props.style),t.style)),t.className&&e.props.className&&(t.className=e.props.className+" "+t.className),Is.default.cloneElement(e,t)}var Lt={};Lt.__esModule=!0;Lt.resizableProps=void 0;var z=Ms(Ke);function Ms(e){return e&&e.__esModule?e:{default:e}}var Ns={axis:z.default.oneOf(["both","x","y","none"]),className:z.default.string,children:z.default.element.isRequired,draggableOpts:z.default.shape({allowAnyClick:z.default.bool,cancel:z.default.string,children:z.default.node,disabled:z.default.bool,enableUserSelectHack:z.default.bool,offsetParent:z.default.node,grid:z.default.arrayOf(z.default.number),handle:z.default.string,nodeRef:z.default.object,onStart:z.default.func,onDrag:z.default.func,onStop:z.default.func,onMouseDown:z.default.func,scale:z.default.number}),height:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=n[0];if(o.axis==="both"||o.axis==="y"){var i;return(i=z.default.number).isRequired.apply(i,n)}return z.default.number.apply(z.default,n)},handle:z.default.oneOfType([z.default.node,z.default.func]),handleSize:z.default.arrayOf(z.default.number),lockAspectRatio:z.default.bool,maxConstraints:z.default.arrayOf(z.default.number),minConstraints:z.default.arrayOf(z.default.number),onResizeStop:z.default.func,onResizeStart:z.default.func,onResize:z.default.func,resizeHandles:z.default.arrayOf(z.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:z.default.number,width:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=n[0];if(o.axis==="both"||o.axis==="x"){var i;return(i=z.default.number).isRequired.apply(i,n)}return z.default.number.apply(z.default,n)}};Lt.resizableProps=Ns;$t.__esModule=!0;$t.default=void 0;var _t=Us(I),Fs=zo,js=ur,$s=Lt,Ls=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function Ao(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(Ao=function(o){return o?n:t})(e)}function Us(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=Ao(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function kn(){return kn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},kn.apply(this,arguments)}function Vs(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function Fr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function xn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Fr(Object(n),!0).forEach(function(r){ks(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fr(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ks(e,t,n){return t=Ws(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ws(e){var t=zs(e,"string");return typeof t=="symbol"?t:String(t)}function zs(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function As(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Wn(e,t)}function Wn(e,t){return Wn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},Wn(e,t)}var dr=function(e){As(t,e);function t(){for(var r,o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return r=e.call.apply(e,[this].concat(i))||this,r.handleRefs={},r.lastHandleRect=null,r.slack=null,r}var n=t.prototype;return n.componentWillUnmount=function(){this.resetData()},n.resetData=function(){this.lastHandleRect=this.slack=null},n.runConstraints=function(o,i){var a=this.props,c=a.minConstraints,l=a.maxConstraints,u=a.lockAspectRatio;if(!c&&!l&&!u)return[o,i];if(u){var d=this.props.width/this.props.height,p=o-this.props.width,f=i-this.props.height;Math.abs(p)>Math.abs(f*d)?i=o/d:o=i*d}var v=o,y=i,S=this.slack||[0,0],x=S[0],_=S[1];return o+=x,i+=_,c&&(o=Math.max(c[0],o),i=Math.max(c[1],i)),l&&(o=Math.min(l[0],o),i=Math.min(l[1],i)),this.slack=[x+(v-o),_+(y-i)],[o,i]},n.resizeHandler=function(o,i){var a=this;return function(c,l){var u=l.node,d=l.deltaX,p=l.deltaY;o==="onResizeStart"&&a.resetData();var f=(a.props.axis==="both"||a.props.axis==="x")&&i!=="n"&&i!=="s",v=(a.props.axis==="both"||a.props.axis==="y")&&i!=="e"&&i!=="w";if(!(!f&&!v)){var y=i[0],S=i[i.length-1],x=u.getBoundingClientRect();if(a.lastHandleRect!=null){if(S==="w"){var _=x.left-a.lastHandleRect.left;d+=_}if(y==="n"){var b=x.top-a.lastHandleRect.top;p+=b}}a.lastHandleRect=x,S==="w"&&(d=-d),y==="n"&&(p=-p);var C=a.props.width+(f?d/a.props.transformScale:0),T=a.props.height+(v?p/a.props.transformScale:0),m=a.runConstraints(C,T);C=m[0],T=m[1];var O=C!==a.props.width||T!==a.props.height,E=typeof a.props[o]=="function"?a.props[o]:null,w=o==="onResize"&&!O;E&&!w&&(c.persist==null||c.persist(),E(c,{node:u,size:{width:C,height:T},handle:i})),o==="onResizeStop"&&a.resetData()}}},n.renderResizeHandle=function(o,i){var a=this.props.handle;if(!a)return _t.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+o,ref:i});if(typeof a=="function")return a(o,i);var c=typeof a.type=="string",l=xn({ref:i},c?{}:{handleAxis:o});return _t.cloneElement(a,l)},n.render=function(){var o=this,i=this.props,a=i.children,c=i.className,l=i.draggableOpts;i.width,i.height,i.handle,i.handleSize,i.lockAspectRatio,i.axis,i.minConstraints,i.maxConstraints,i.onResize,i.onResizeStop,i.onResizeStart;var u=i.resizeHandles;i.transformScale;var d=Vs(i,Ls);return(0,js.cloneElement)(a,xn(xn({},d),{},{className:(c?c+" ":"")+"react-resizable",children:[].concat(a.props.children,u.map(function(p){var f,v=(f=o.handleRefs[p])!=null?f:o.handleRefs[p]=_t.createRef();return _t.createElement(Fs.DraggableCore,kn({},l,{nodeRef:v,key:"resizableHandle-"+p,onStop:o.resizeHandler("onResizeStop",p),onStart:o.resizeHandler("onResizeStart",p),onDrag:o.resizeHandler("onResize",p)}),o.renderResizeHandle(p,v))}))}))},t}(_t.Component);$t.default=dr;dr.propTypes=$s.resizableProps;dr.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1};var pn={};pn.__esModule=!0;pn.default=void 0;var On=Xs(I),Hs=Ho(Ke),qs=Ho($t),Bs=Lt,Gs=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function Ho(e){return e&&e.__esModule?e:{default:e}}function qo(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(qo=function(o){return o?n:t})(e)}function Xs(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=qo(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function zn(){return zn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},zn.apply(this,arguments)}function jr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Zt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?jr(Object(n),!0).forEach(function(r){Ys(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jr(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Ys(e,t,n){return t=Ks(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ks(e){var t=Zs(e,"string");return typeof t=="symbol"?t:String(t)}function Zs(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Js(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function Qs(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,An(e,t)}function An(e,t){return An=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},An(e,t)}var Bo=function(e){Qs(t,e);function t(){for(var r,o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return r=e.call.apply(e,[this].concat(i))||this,r.state={width:r.props.width,height:r.props.height,propsWidth:r.props.width,propsHeight:r.props.height},r.onResize=function(c,l){var u=l.size;r.props.onResize?(c.persist==null||c.persist(),r.setState(u,function(){return r.props.onResize&&r.props.onResize(c,l)})):r.setState(u)},r}t.getDerivedStateFromProps=function(o,i){return i.propsWidth!==o.width||i.propsHeight!==o.height?{width:o.width,height:o.height,propsWidth:o.width,propsHeight:o.height}:null};var n=t.prototype;return n.render=function(){var o=this.props,i=o.handle,a=o.handleSize;o.onResize;var c=o.onResizeStart,l=o.onResizeStop,u=o.draggableOpts,d=o.minConstraints,p=o.maxConstraints,f=o.lockAspectRatio,v=o.axis;o.width,o.height;var y=o.resizeHandles,S=o.style,x=o.transformScale,_=Js(o,Gs);return On.createElement(qs.default,{axis:v,draggableOpts:u,handle:i,handleSize:a,height:this.state.height,lockAspectRatio:f,maxConstraints:p,minConstraints:d,onResizeStart:c,onResize:this.onResize,onResizeStop:l,resizeHandles:y,transformScale:x,width:this.state.width},On.createElement("div",zn({},_,{style:Zt(Zt({},S),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},t}(On.Component);pn.default=Bo;Bo.propTypes=Zt(Zt({},Bs.resizableProps),{},{children:Hs.default.element});fn.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")};fn.exports.Resizable=$t.default;fn.exports.ResizableBox=pn.default;var el=fn.exports,qe={};Object.defineProperty(qe,"__esModule",{value:!0});qe.resizeHandleType=qe.resizeHandleAxesType=qe.default=void 0;var A=Go(Ke),tl=Go(I);function Go(e){return e&&e.__esModule?e:{default:e}}const nl=qe.resizeHandleAxesType=A.default.arrayOf(A.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),rl=qe.resizeHandleType=A.default.oneOfType([A.default.node,A.default.func]);qe.default={className:A.default.string,style:A.default.object,width:A.default.number,autoSize:A.default.bool,cols:A.default.number,draggableCancel:A.default.string,draggableHandle:A.default.string,verticalCompact:function(e){e.verticalCompact},compactType:A.default.oneOf(["vertical","horizontal"]),layout:function(e){var t=e.layout;t!==void 0&&H.validateLayout(t,"layout")},margin:A.default.arrayOf(A.default.number),containerPadding:A.default.arrayOf(A.default.number),rowHeight:A.default.number,maxRows:A.default.number,isBounded:A.default.bool,isDraggable:A.default.bool,isResizable:A.default.bool,allowOverlap:A.default.bool,preventCollision:A.default.bool,useCSSTransforms:A.default.bool,transformScale:A.default.number,isDroppable:A.default.bool,resizeHandles:nl,resizeHandle:rl,onLayoutChange:A.default.func,onDragStart:A.default.func,onDrag:A.default.func,onDragStop:A.default.func,onResizeStart:A.default.func,onResize:A.default.func,onResizeStop:A.default.func,onDrop:A.default.func,droppingItem:A.default.shape({i:A.default.string.isRequired,w:A.default.number.isRequired,h:A.default.number.isRequired}),children:function(e,t){const n=e[t],r={};tl.default.Children.forEach(n,function(o){if((o==null?void 0:o.key)!=null){if(r[o.key])throw new Error('Duplicate child key "'+o.key+'" found! This will cause problems in ReactGridLayout.');r[o.key]=!0}})},innerRef:A.default.any};Object.defineProperty(sn,"__esModule",{value:!0});sn.default=void 0;var ut=fr(I),Y=fr(Ke),ol=zo,il=el,dt=H,pe=Ve,$r=qe,al=fr(Ye);function fr(e){return e&&e.__esModule?e:{default:e}}function Ue(e,t,n){return t=sl(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function sl(e){var t=ll(e,"string");return typeof t=="symbol"?t:String(t)}function ll(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class pr extends ut.default.Component{constructor(){super(...arguments),Ue(this,"state",{resizing:null,dragging:null,className:""}),Ue(this,"elementRef",ut.default.createRef()),Ue(this,"onDragStart",(t,n)=>{let{node:r}=n;const{onDragStart:o,transformScale:i}=this.props;if(!o)return;const a={top:0,left:0},{offsetParent:c}=r;if(!c)return;const l=c.getBoundingClientRect(),u=r.getBoundingClientRect(),d=u.left/i,p=l.left/i,f=u.top/i,v=l.top/i;a.left=d-p+c.scrollLeft,a.top=f-v+c.scrollTop,this.setState({dragging:a});const{x:y,y:S}=(0,pe.calcXY)(this.getPositionParams(),a.top,a.left,this.props.w,this.props.h);return o.call(this,this.props.i,y,S,{e:t,node:r,newPosition:a})}),Ue(this,"onDrag",(t,n)=>{let{node:r,deltaX:o,deltaY:i}=n;const{onDrag:a}=this.props;if(!a)return;if(!this.state.dragging)throw new Error("onDrag called before onDragStart.");let c=this.state.dragging.top+i,l=this.state.dragging.left+o;const{isBounded:u,i:d,w:p,h:f,containerWidth:v}=this.props,y=this.getPositionParams();if(u){const{offsetParent:C}=r;if(C){const{margin:T,rowHeight:m,containerPadding:O}=this.props,E=C.clientHeight-(0,pe.calcGridItemWHPx)(f,m,T[1]);c=(0,pe.clamp)(c-O[1],0,E);const w=(0,pe.calcGridColWidth)(y),F=v-(0,pe.calcGridItemWHPx)(p,w,T[0]);l=(0,pe.clamp)(l-O[0],0,F)}}const S={top:c,left:l};this.setState({dragging:S});const{containerPadding:x}=this.props,{x:_,y:b}=(0,pe.calcXY)(y,c-x[1],l-x[0],p,f);return a.call(this,d,_,b,{e:t,node:r,newPosition:S})}),Ue(this,"onDragStop",(t,n)=>{let{node:r}=n;const{onDragStop:o}=this.props;if(!o)return;if(!this.state.dragging)throw new Error("onDragEnd called before onDragStart.");const{w:i,h:a,i:c,containerPadding:l}=this.props,{left:u,top:d}=this.state.dragging,p={top:d,left:u};this.setState({dragging:null});const{x:f,y:v}=(0,pe.calcXY)(this.getPositionParams(),d-l[1],u-l[0],i,a);return o.call(this,c,f,v,{e:t,node:r,newPosition:p})}),Ue(this,"onResizeStop",(t,n,r)=>this.onResizeHandler(t,n,r,"onResizeStop")),Ue(this,"onResizeStart",(t,n,r)=>this.onResizeHandler(t,n,r,"onResizeStart")),Ue(this,"onResize",(t,n,r)=>this.onResizeHandler(t,n,r,"onResize"))}shouldComponentUpdate(t,n){if(this.props.children!==t.children||this.props.droppingPosition!==t.droppingPosition)return!0;const r=(0,pe.calcGridItemPosition)(this.getPositionParams(this.props),this.props.x,this.props.y,this.props.w,this.props.h,this.state),o=(0,pe.calcGridItemPosition)(this.getPositionParams(t),t.x,t.y,t.w,t.h,n);return!(0,dt.fastPositionEqual)(r,o)||this.props.useCSSTransforms!==t.useCSSTransforms}componentDidMount(){this.moveDroppingItem({})}componentDidUpdate(t){this.moveDroppingItem(t)}moveDroppingItem(t){const{droppingPosition:n}=this.props;if(!n)return;const r=this.elementRef.current;if(!r)return;const o=t.droppingPosition||{left:0,top:0},{dragging:i}=this.state,a=i&&n.left!==o.left||n.top!==o.top;if(!i)this.onDragStart(n.e,{node:r,deltaX:n.left,deltaY:n.top});else if(a){const c=n.left-i.left,l=n.top-i.top;this.onDrag(n.e,{node:r,deltaX:c,deltaY:l})}}getPositionParams(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.props;return{cols:t.cols,containerPadding:t.containerPadding,containerWidth:t.containerWidth,margin:t.margin,maxRows:t.maxRows,rowHeight:t.rowHeight}}createStyle(t){const{usePercentages:n,containerWidth:r,useCSSTransforms:o}=this.props;let i;return o?i=(0,dt.setTransform)(t):(i=(0,dt.setTopLeft)(t),n&&(i.left=(0,dt.perc)(t.left/r),i.width=(0,dt.perc)(t.width/r))),i}mixinDraggable(t,n){return ut.default.createElement(ol.DraggableCore,{disabled:!n,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop,handle:this.props.handle,cancel:".react-resizable-handle"+(this.props.cancel?","+this.props.cancel:""),scale:this.props.transformScale,nodeRef:this.elementRef},t)}curryResizeHandler(t,n){return(r,o)=>n(r,o,t)}mixinResizable(t,n,r){const{cols:o,minW:i,minH:a,maxW:c,maxH:l,transformScale:u,resizeHandles:d,resizeHandle:p}=this.props,f=this.getPositionParams(),v=(0,pe.calcGridItemPosition)(f,0,0,o,0).width,y=(0,pe.calcGridItemPosition)(f,0,0,i,a),S=(0,pe.calcGridItemPosition)(f,0,0,c,l),x=[y.width,y.height],_=[Math.min(S.width,v),Math.min(S.height,1/0)];return ut.default.createElement(il.Resizable,{draggableOpts:{disabled:!r},className:r?void 0:"react-resizable-hide",width:n.width,height:n.height,minConstraints:x,maxConstraints:_,onResizeStop:this.curryResizeHandler(n,this.onResizeStop),onResizeStart:this.curryResizeHandler(n,this.onResizeStart),onResize:this.curryResizeHandler(n,this.onResize),transformScale:u,resizeHandles:d,handle:p},t)}onResizeHandler(t,n,r,o){let{node:i,size:a,handle:c}=n;const l=this.props[o];if(!l)return;const{x:u,y:d,i:p,maxH:f,minH:v,containerWidth:y}=this.props,{minW:S,maxW:x}=this.props;let _=a;i&&(_=(0,dt.resizeItemInDirection)(c,r,a,y),this.setState({resizing:o==="onResizeStop"?null:_}));let{w:b,h:C}=(0,pe.calcWH)(this.getPositionParams(),_.width,_.height,u,d,c);b=(0,pe.clamp)(b,Math.max(S,1),x),C=(0,pe.clamp)(C,v,f),l.call(this,p,b,C,{e:t,node:i,size:_,handle:c})}render(){const{x:t,y:n,w:r,h:o,isDraggable:i,isResizable:a,droppingPosition:c,useCSSTransforms:l}=this.props,u=(0,pe.calcGridItemPosition)(this.getPositionParams(),t,n,r,o,this.state),d=ut.default.Children.only(this.props.children);let p=ut.default.cloneElement(d,{ref:this.elementRef,className:(0,al.default)("react-grid-item",d.props.className,this.props.className,{static:this.props.static,resizing:!!this.state.resizing,"react-draggable":i,"react-draggable-dragging":!!this.state.dragging,dropping:!!c,cssTransforms:l}),style:{...this.props.style,...d.props.style,...this.createStyle(u)}});return p=this.mixinResizable(p,u,a),p=this.mixinDraggable(p,i),p}}sn.default=pr;Ue(pr,"propTypes",{children:Y.default.element,cols:Y.default.number.isRequired,containerWidth:Y.default.number.isRequired,rowHeight:Y.default.number.isRequired,margin:Y.default.array.isRequired,maxRows:Y.default.number.isRequired,containerPadding:Y.default.array.isRequired,x:Y.default.number.isRequired,y:Y.default.number.isRequired,w:Y.default.number.isRequired,h:Y.default.number.isRequired,minW:function(e,t){const n=e[t];if(typeof n!="number")return new Error("minWidth not Number");if(n>e.w||n>e.maxW)return new Error("minWidth larger than item width/maxWidth")},maxW:function(e,t){const n=e[t];if(typeof n!="number")return new Error("maxWidth not Number");if(n<e.w||n<e.minW)return new Error("maxWidth smaller than item width/minWidth")},minH:function(e,t){const n=e[t];if(typeof n!="number")return new Error("minHeight not Number");if(n>e.h||n>e.maxH)return new Error("minHeight larger than item height/maxHeight")},maxH:function(e,t){const n=e[t];if(typeof n!="number")return new Error("maxHeight not Number");if(n<e.h||n<e.minH)return new Error("maxHeight smaller than item height/minHeight")},i:Y.default.string.isRequired,resizeHandles:$r.resizeHandleAxesType,resizeHandle:$r.resizeHandleType,onDragStop:Y.default.func,onDragStart:Y.default.func,onDrag:Y.default.func,onResizeStop:Y.default.func,onResizeStart:Y.default.func,onResize:Y.default.func,isDraggable:Y.default.bool.isRequired,isResizable:Y.default.bool.isRequired,isBounded:Y.default.bool.isRequired,static:Y.default.bool,useCSSTransforms:Y.default.bool.isRequired,transformScale:Y.default.number,className:Y.default.string,handle:Y.default.string,cancel:Y.default.string,droppingPosition:Y.default.shape({e:Y.default.object.isRequired,left:Y.default.number.isRequired,top:Y.default.number.isRequired})});Ue(pr,"defaultProps",{className:"",cancel:"",handle:"",minH:1,minW:1,maxH:1/0,maxW:1/0,transformScale:1});Object.defineProperty(jt,"__esModule",{value:!0});jt.default=void 0;var Ze=fl(I),En=Zn,cl=hr(Ye),W=H,ul=Ve,Lr=hr(sn),dl=hr(qe);function hr(e){return e&&e.__esModule?e:{default:e}}function Xo(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(Xo=function(r){return r?n:t})(e)}function fl(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=Xo(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function ye(e,t,n){return t=pl(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pl(e){var t=hl(e,"string");return typeof t=="symbol"?t:String(t)}function hl(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}const Ur="react-grid-layout";let Yo=!1;try{Yo=/firefox/i.test(navigator.userAgent)}catch{}class hn extends Ze.Component{constructor(){super(...arguments),ye(this,"state",{activeDrag:null,layout:(0,W.synchronizeLayoutWithChildren)(this.props.layout,this.props.children,this.props.cols,(0,W.compactType)(this.props),this.props.allowOverlap),mounted:!1,oldDragItem:null,oldLayout:null,oldResizeItem:null,resizing:!1,droppingDOMNode:null,children:[]}),ye(this,"dragEnterCounter",0),ye(this,"onDragStart",(t,n,r,o)=>{let{e:i,node:a}=o;const{layout:c}=this.state,l=(0,W.getLayoutItem)(c,t);if(!l)return;const u={w:l.w,h:l.h,x:l.x,y:l.y,placeholder:!0,i:t};return this.setState({oldDragItem:(0,W.cloneLayoutItem)(l),oldLayout:c,activeDrag:u}),this.props.onDragStart(c,l,l,null,i,a)}),ye(this,"onDrag",(t,n,r,o)=>{let{e:i,node:a}=o;const{oldDragItem:c}=this.state;let{layout:l}=this.state;const{cols:u,allowOverlap:d,preventCollision:p}=this.props,f=(0,W.getLayoutItem)(l,t);if(!f)return;const v={w:f.w,h:f.h,x:f.x,y:f.y,placeholder:!0,i:t};l=(0,W.moveElement)(l,f,n,r,!0,p,(0,W.compactType)(this.props),u,d),this.props.onDrag(l,c,f,v,i,a),this.setState({layout:d?l:(0,W.compact)(l,(0,W.compactType)(this.props),u),activeDrag:v})}),ye(this,"onDragStop",(t,n,r,o)=>{let{e:i,node:a}=o;if(!this.state.activeDrag)return;const{oldDragItem:c}=this.state;let{layout:l}=this.state;const{cols:u,preventCollision:d,allowOverlap:p}=this.props,f=(0,W.getLayoutItem)(l,t);if(!f)return;l=(0,W.moveElement)(l,f,n,r,!0,d,(0,W.compactType)(this.props),u,p);const y=p?l:(0,W.compact)(l,(0,W.compactType)(this.props),u);this.props.onDragStop(y,c,f,null,i,a);const{oldLayout:S}=this.state;this.setState({activeDrag:null,layout:y,oldDragItem:null,oldLayout:null}),this.onLayoutMaybeChanged(y,S)}),ye(this,"onResizeStart",(t,n,r,o)=>{let{e:i,node:a}=o;const{layout:c}=this.state,l=(0,W.getLayoutItem)(c,t);l&&(this.setState({oldResizeItem:(0,W.cloneLayoutItem)(l),oldLayout:this.state.layout,resizing:!0}),this.props.onResizeStart(c,l,l,null,i,a))}),ye(this,"onResize",(t,n,r,o)=>{let{e:i,node:a,size:c,handle:l}=o;const{oldResizeItem:u}=this.state,{layout:d}=this.state,{cols:p,preventCollision:f,allowOverlap:v}=this.props;let y=!1,S,x,_;const[b,C]=(0,W.withLayoutItem)(d,t,m=>{let O;return x=m.x,_=m.y,["sw","w","nw","n","ne"].indexOf(l)!==-1&&(["sw","nw","w"].indexOf(l)!==-1&&(x=m.x+(m.w-n),n=m.x!==x&&x<0?m.w:n,x=x<0?0:x),["ne","n","nw"].indexOf(l)!==-1&&(_=m.y+(m.h-r),r=m.y!==_&&_<0?m.h:r,_=_<0?0:_),y=!0),f&&!v&&(O=(0,W.getAllCollisions)(d,{...m,w:n,h:r,x,y:_}).filter(w=>w.i!==m.i).length>0,O&&(_=m.y,r=m.h,x=m.x,n=m.w,y=!1)),m.w=n,m.h=r,m});if(!C)return;S=b,y&&(S=(0,W.moveElement)(b,C,x,_,!0,this.props.preventCollision,(0,W.compactType)(this.props),p,v));const T={w:C.w,h:C.h,x:C.x,y:C.y,static:!0,i:t};this.props.onResize(S,u,C,T,i,a),this.setState({layout:v?S:(0,W.compact)(S,(0,W.compactType)(this.props),p),activeDrag:T})}),ye(this,"onResizeStop",(t,n,r,o)=>{let{e:i,node:a}=o;const{layout:c,oldResizeItem:l}=this.state,{cols:u,allowOverlap:d}=this.props,p=(0,W.getLayoutItem)(c,t),f=d?c:(0,W.compact)(c,(0,W.compactType)(this.props),u);this.props.onResizeStop(f,l,p,null,i,a);const{oldLayout:v}=this.state;this.setState({activeDrag:null,layout:f,oldResizeItem:null,oldLayout:null,resizing:!1}),this.onLayoutMaybeChanged(f,v)}),ye(this,"onDragOver",t=>{var b;if(t.preventDefault(),t.stopPropagation(),Yo&&!((b=t.nativeEvent.target)!=null&&b.classList.contains(Ur)))return!1;const{droppingItem:n,onDropDragOver:r,margin:o,cols:i,rowHeight:a,maxRows:c,width:l,containerPadding:u,transformScale:d}=this.props,p=r==null?void 0:r(t);if(p===!1)return this.state.droppingDOMNode&&this.removeDroppingPlaceholder(),!1;const f={...n,...p},{layout:v}=this.state,y=t.currentTarget.getBoundingClientRect(),S=t.clientX-y.left,x=t.clientY-y.top,_={left:S/d,top:x/d,e:t};if(this.state.droppingDOMNode){if(this.state.droppingPosition){const{left:C,top:T}=this.state.droppingPosition;(C!=S||T!=x)&&this.setState({droppingPosition:_})}}else{const C={cols:i,margin:o,maxRows:c,rowHeight:a,containerWidth:l,containerPadding:u||o},T=(0,ul.calcXY)(C,x,S,f.w,f.h);this.setState({droppingDOMNode:Ze.createElement("div",{key:f.i}),droppingPosition:_,layout:[...v,{...f,x:T.x,y:T.y,static:!1,isDraggable:!0}]})}}),ye(this,"removeDroppingPlaceholder",()=>{const{droppingItem:t,cols:n}=this.props,{layout:r}=this.state,o=(0,W.compact)(r.filter(i=>i.i!==t.i),(0,W.compactType)(this.props),n,this.props.allowOverlap);this.setState({layout:o,droppingDOMNode:null,activeDrag:null,droppingPosition:void 0})}),ye(this,"onDragLeave",t=>{t.preventDefault(),t.stopPropagation(),this.dragEnterCounter--,this.dragEnterCounter===0&&this.removeDroppingPlaceholder()}),ye(this,"onDragEnter",t=>{t.preventDefault(),t.stopPropagation(),this.dragEnterCounter++}),ye(this,"onDrop",t=>{t.preventDefault(),t.stopPropagation();const{droppingItem:n}=this.props,{layout:r}=this.state,o=r.find(i=>i.i===n.i);this.dragEnterCounter=0,this.removeDroppingPlaceholder(),this.props.onDrop(r,o,t)})}componentDidMount(){this.setState({mounted:!0}),this.onLayoutMaybeChanged(this.state.layout,this.props.layout)}static getDerivedStateFromProps(t,n){let r;return n.activeDrag?null:(!(0,En.deepEqual)(t.layout,n.propsLayout)||t.compactType!==n.compactType?r=t.layout:(0,W.childrenEqual)(t.children,n.children)||(r=n.layout),r?{layout:(0,W.synchronizeLayoutWithChildren)(r,t.children,t.cols,(0,W.compactType)(t),t.allowOverlap),compactType:t.compactType,children:t.children,propsLayout:t.layout}:null)}shouldComponentUpdate(t,n){return this.props.children!==t.children||!(0,W.fastRGLPropsEqual)(this.props,t,En.deepEqual)||this.state.activeDrag!==n.activeDrag||this.state.mounted!==n.mounted||this.state.droppingPosition!==n.droppingPosition}componentDidUpdate(t,n){if(!this.state.activeDrag){const r=this.state.layout,o=n.layout;this.onLayoutMaybeChanged(r,o)}}containerHeight(){if(!this.props.autoSize)return;const t=(0,W.bottom)(this.state.layout),n=this.props.containerPadding?this.props.containerPadding[1]:this.props.margin[1];return t*this.props.rowHeight+(t-1)*this.props.margin[1]+n*2+"px"}onLayoutMaybeChanged(t,n){n||(n=this.state.layout),(0,En.deepEqual)(n,t)||this.props.onLayoutChange(t)}placeholder(){const{activeDrag:t}=this.state;if(!t)return null;const{width:n,cols:r,margin:o,containerPadding:i,rowHeight:a,maxRows:c,useCSSTransforms:l,transformScale:u}=this.props;return Ze.createElement(Lr.default,{w:t.w,h:t.h,x:t.x,y:t.y,i:t.i,className:`react-grid-placeholder ${this.state.resizing?"placeholder-resizing":""}`,containerWidth:n,cols:r,margin:o,containerPadding:i||o,maxRows:c,rowHeight:a,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:l,transformScale:u},Ze.createElement("div",null))}processGridItem(t,n){if(!t||!t.key)return;const r=(0,W.getLayoutItem)(this.state.layout,String(t.key));if(!r)return null;const{width:o,cols:i,margin:a,containerPadding:c,rowHeight:l,maxRows:u,isDraggable:d,isResizable:p,isBounded:f,useCSSTransforms:v,transformScale:y,draggableCancel:S,draggableHandle:x,resizeHandles:_,resizeHandle:b}=this.props,{mounted:C,droppingPosition:T}=this.state,m=typeof r.isDraggable=="boolean"?r.isDraggable:!r.static&&d,O=typeof r.isResizable=="boolean"?r.isResizable:!r.static&&p,E=r.resizeHandles||_,w=m&&f&&r.isBounded!==!1;return Ze.createElement(Lr.default,{containerWidth:o,cols:i,margin:a,containerPadding:c||a,maxRows:u,rowHeight:l,cancel:S,handle:x,onDragStop:this.onDragStop,onDragStart:this.onDragStart,onDrag:this.onDrag,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,isDraggable:m,isResizable:O,isBounded:w,useCSSTransforms:v&&C,usePercentages:!C,transformScale:y,w:r.w,h:r.h,x:r.x,y:r.y,i:r.i,minH:r.minH,minW:r.minW,maxH:r.maxH,maxW:r.maxW,static:r.static,droppingPosition:n?T:void 0,resizeHandles:E,resizeHandle:b},t)}render(){const{className:t,style:n,isDroppable:r,innerRef:o}=this.props,i=(0,cl.default)(Ur,t),a={height:this.containerHeight(),...n};return Ze.createElement("div",{ref:o,className:i,style:a,onDrop:r?this.onDrop:W.noop,onDragLeave:r?this.onDragLeave:W.noop,onDragEnter:r?this.onDragEnter:W.noop,onDragOver:r?this.onDragOver:W.noop},Ze.Children.map(this.props.children,c=>this.processGridItem(c)),r&&this.state.droppingDOMNode&&this.processGridItem(this.state.droppingDOMNode,!0),this.placeholder())}}jt.default=hn;ye(hn,"displayName","ReactGridLayout");ye(hn,"propTypes",dl.default);ye(hn,"defaultProps",{autoSize:!0,cols:12,className:"",style:{},draggableHandle:"",draggableCancel:"",containerPadding:null,rowHeight:150,maxRows:1/0,layout:[],margin:[10,10],isBounded:!1,isDraggable:!0,isResizable:!0,allowOverlap:!1,isDroppable:!1,useCSSTransforms:!0,transformScale:1,verticalCompact:!0,compactType:"vertical",preventCollision:!1,droppingItem:{i:"__dropping-elem__",h:1,w:1},resizeHandles:["se"],onLayoutChange:W.noop,onDragStart:W.noop,onDrag:W.noop,onDragStop:W.noop,onResizeStart:W.noop,onResize:W.noop,onResizeStop:W.noop,onDrop:W.noop,onDropDragOver:W.noop});var gn={},st={};Object.defineProperty(st,"__esModule",{value:!0});st.findOrGenerateResponsiveLayout=vl;st.getBreakpointFromWidth=gl;st.getColsFromBreakpoint=ml;st.sortBreakpoints=gr;var Vt=H;function gl(e,t){const n=gr(e);let r=n[0];for(let o=1,i=n.length;o<i;o++){const a=n[o];t>e[a]&&(r=a)}return r}function ml(e,t){if(!t[e])throw new Error("ResponsiveReactGridLayout: `cols` entry for breakpoint "+e+" is missing!");return t[e]}function vl(e,t,n,r,o,i){if(e[n])return(0,Vt.cloneLayout)(e[n]);let a=e[r];const c=gr(t),l=c.slice(c.indexOf(n));for(let u=0,d=l.length;u<d;u++){const p=l[u];if(e[p]){a=e[p];break}}return a=(0,Vt.cloneLayout)(a||[]),(0,Vt.compact)((0,Vt.correctBounds)(a,{cols:o}),i,o)}function gr(e){return Object.keys(e).sort(function(n,r){return e[n]-e[r]})}Object.defineProperty(gn,"__esModule",{value:!0});gn.default=void 0;var Vr=Cl(I),Te=Ko(Ke),Pn=Zn,mt=H,Je=st,yl=Ko(jt);function Ko(e){return e&&e.__esModule?e:{default:e}}function Zo(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(Zo=function(r){return r?n:t})(e)}function Cl(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=Zo(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function Hn(){return Hn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Hn.apply(this,arguments)}function Jt(e,t,n){return t=Sl(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Sl(e){var t=bl(e,"string");return typeof t=="symbol"?t:String(t)}function bl(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}const kr=e=>Object.prototype.toString.call(e);function kt(e,t){return e==null?null:Array.isArray(e)?e:e[t]}class mr extends Vr.Component{constructor(){super(...arguments),Jt(this,"state",this.generateInitialState()),Jt(this,"onLayoutChange",t=>{this.props.onLayoutChange(t,{...this.props.layouts,[this.state.breakpoint]:t})})}generateInitialState(){const{width:t,breakpoints:n,layouts:r,cols:o}=this.props,i=(0,Je.getBreakpointFromWidth)(n,t),a=(0,Je.getColsFromBreakpoint)(i,o),c=this.props.verticalCompact===!1?null:this.props.compactType;return{layout:(0,Je.findOrGenerateResponsiveLayout)(r,n,i,i,a,c),breakpoint:i,cols:a}}static getDerivedStateFromProps(t,n){if(!(0,Pn.deepEqual)(t.layouts,n.layouts)){const{breakpoint:r,cols:o}=n;return{layout:(0,Je.findOrGenerateResponsiveLayout)(t.layouts,t.breakpoints,r,r,o,t.compactType),layouts:t.layouts}}return null}componentDidUpdate(t){(this.props.width!=t.width||this.props.breakpoint!==t.breakpoint||!(0,Pn.deepEqual)(this.props.breakpoints,t.breakpoints)||!(0,Pn.deepEqual)(this.props.cols,t.cols))&&this.onWidthChange(t)}onWidthChange(t){const{breakpoints:n,cols:r,layouts:o,compactType:i}=this.props,a=this.props.breakpoint||(0,Je.getBreakpointFromWidth)(this.props.breakpoints,this.props.width),c=this.state.breakpoint,l=(0,Je.getColsFromBreakpoint)(a,r),u={...o};if(c!==a||t.breakpoints!==n||t.cols!==r){c in u||(u[c]=(0,mt.cloneLayout)(this.state.layout));let f=(0,Je.findOrGenerateResponsiveLayout)(u,n,a,c,l,i);f=(0,mt.synchronizeLayoutWithChildren)(f,this.props.children,l,i,this.props.allowOverlap),u[a]=f,this.props.onLayoutChange(f,u),this.props.onBreakpointChange(a,l),this.setState({breakpoint:a,layout:f,cols:l})}const d=kt(this.props.margin,a),p=kt(this.props.containerPadding,a);this.props.onWidthChange(this.props.width,d,l,p)}render(){const{breakpoint:t,breakpoints:n,cols:r,layouts:o,margin:i,containerPadding:a,onBreakpointChange:c,onLayoutChange:l,onWidthChange:u,...d}=this.props;return Vr.createElement(yl.default,Hn({},d,{margin:kt(i,this.state.breakpoint),containerPadding:kt(a,this.state.breakpoint),onLayoutChange:this.onLayoutChange,layout:this.state.layout,cols:this.state.cols}))}}gn.default=mr;Jt(mr,"propTypes",{breakpoint:Te.default.string,breakpoints:Te.default.object,allowOverlap:Te.default.bool,cols:Te.default.object,margin:Te.default.oneOfType([Te.default.array,Te.default.object]),containerPadding:Te.default.oneOfType([Te.default.array,Te.default.object]),layouts(e,t){if(kr(e[t])!=="[object Object]")throw new Error("Layout property must be an object. Received: "+kr(e[t]));Object.keys(e[t]).forEach(n=>{if(!(n in e.breakpoints))throw new Error("Each key in layouts must align with a key in breakpoints.");(0,mt.validateLayout)(e.layouts[n],"layouts."+n)})},width:Te.default.number.isRequired,onBreakpointChange:Te.default.func,onLayoutChange:Te.default.func,onWidthChange:Te.default.func});Jt(mr,"defaultProps",{breakpoints:{lg:1200,md:996,sm:768,xs:480,xxs:0},cols:{lg:12,md:10,sm:6,xs:4,xxs:2},containerPadding:{lg:null,md:null,sm:null,xs:null,xxs:null},layouts:{},margin:[10,10],allowOverlap:!1,onBreakpointChange:mt.noop,onLayoutChange:mt.noop,onWidthChange:mt.noop});var vr={},Jo=function(){if(typeof Map<"u")return Map;function e(t,n){var r=-1;return t.some(function(o,i){return o[0]===n?(r=i,!0):!1}),r}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(n){var r=e(this.__entries__,n),o=this.__entries__[r];return o&&o[1]},t.prototype.set=function(n,r){var o=e(this.__entries__,n);~o?this.__entries__[o][1]=r:this.__entries__.push([n,r])},t.prototype.delete=function(n){var r=this.__entries__,o=e(r,n);~o&&r.splice(o,1)},t.prototype.has=function(n){return!!~e(this.__entries__,n)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(n,r){r===void 0&&(r=null);for(var o=0,i=this.__entries__;o<i.length;o++){var a=i[o];n.call(r,a[1],a[0])}},t}()}(),qn=typeof window<"u"&&typeof document<"u"&&window.document===document,Qt=function(){return typeof global<"u"&&global.Math===Math?global:typeof self<"u"&&self.Math===Math?self:typeof window<"u"&&window.Math===Math?window:Function("return this")()}(),Tl=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(Qt):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)}}(),Rl=2;function _l(e,t){var n=!1,r=!1,o=0;function i(){n&&(n=!1,e()),r&&c()}function a(){Tl(i)}function c(){var l=Date.now();if(n){if(l-o<Rl)return;r=!0}else n=!0,r=!1,setTimeout(a,t);o=l}return c}var wl=20,Il=["top","right","bottom","left","width","height","size","weight"],xl=typeof MutationObserver<"u",Ol=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=_l(this.refresh.bind(this),wl)}return e.prototype.addObserver=function(t){~this.observers_.indexOf(t)||this.observers_.push(t),this.connected_||this.connect_()},e.prototype.removeObserver=function(t){var n=this.observers_,r=n.indexOf(t);~r&&n.splice(r,1),!n.length&&this.connected_&&this.disconnect_()},e.prototype.refresh=function(){var t=this.updateObservers_();t&&this.refresh()},e.prototype.updateObservers_=function(){var t=this.observers_.filter(function(n){return n.gatherActive(),n.hasActive()});return t.forEach(function(n){return n.broadcastActive()}),t.length>0},e.prototype.connect_=function(){!qn||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),xl?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){!qn||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(t){var n=t.propertyName,r=n===void 0?"":n,o=Il.some(function(i){return!!~r.indexOf(i)});o&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),Qo=function(e,t){for(var n=0,r=Object.keys(t);n<r.length;n++){var o=r[n];Object.defineProperty(e,o,{value:t[o],enumerable:!1,writable:!1,configurable:!0})}return e},yt=function(e){var t=e&&e.ownerDocument&&e.ownerDocument.defaultView;return t||Qt},ei=mn(0,0,0,0);function en(e){return parseFloat(e)||0}function Wr(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return t.reduce(function(r,o){var i=e["border-"+o+"-width"];return r+en(i)},0)}function El(e){for(var t=["top","right","bottom","left"],n={},r=0,o=t;r<o.length;r++){var i=o[r],a=e["padding-"+i];n[i]=en(a)}return n}function Pl(e){var t=e.getBBox();return mn(0,0,t.width,t.height)}function Dl(e){var t=e.clientWidth,n=e.clientHeight;if(!t&&!n)return ei;var r=yt(e).getComputedStyle(e),o=El(r),i=o.left+o.right,a=o.top+o.bottom,c=en(r.width),l=en(r.height);if(r.boxSizing==="border-box"&&(Math.round(c+i)!==t&&(c-=Wr(r,"left","right")+i),Math.round(l+a)!==n&&(l-=Wr(r,"top","bottom")+a)),!Nl(e)){var u=Math.round(c+i)-t,d=Math.round(l+a)-n;Math.abs(u)!==1&&(c-=u),Math.abs(d)!==1&&(l-=d)}return mn(o.left,o.top,c,l)}var Ml=function(){return typeof SVGGraphicsElement<"u"?function(e){return e instanceof yt(e).SVGGraphicsElement}:function(e){return e instanceof yt(e).SVGElement&&typeof e.getBBox=="function"}}();function Nl(e){return e===yt(e).document.documentElement}function Fl(e){return qn?Ml(e)?Pl(e):Dl(e):ei}function jl(e){var t=e.x,n=e.y,r=e.width,o=e.height,i=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,a=Object.create(i.prototype);return Qo(a,{x:t,y:n,width:r,height:o,top:n,right:t+r,bottom:o+n,left:t}),a}function mn(e,t,n,r){return{x:e,y:t,width:n,height:r}}var $l=function(){function e(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=mn(0,0,0,0),this.target=t}return e.prototype.isActive=function(){var t=Fl(this.target);return this.contentRect_=t,t.width!==this.broadcastWidth||t.height!==this.broadcastHeight},e.prototype.broadcastRect=function(){var t=this.contentRect_;return this.broadcastWidth=t.width,this.broadcastHeight=t.height,t},e}(),Ll=function(){function e(t,n){var r=jl(n);Qo(this,{target:t,contentRect:r})}return e}(),Ul=function(){function e(t,n,r){if(this.activeObservations_=[],this.observations_=new Jo,typeof t!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=t,this.controller_=n,this.callbackCtx_=r}return e.prototype.observe=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof yt(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(t)||(n.set(t,new $l(t)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof yt(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(t)&&(n.delete(t),n.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var t=this;this.clearActive(),this.observations_.forEach(function(n){n.isActive()&&t.activeObservations_.push(n)})},e.prototype.broadcastActive=function(){if(this.hasActive()){var t=this.callbackCtx_,n=this.activeObservations_.map(function(r){return new Ll(r.target,r.broadcastRect())});this.callback_.call(t,n,t),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e}(),ti=typeof WeakMap<"u"?new WeakMap:new Jo,ni=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=Ol.getInstance(),r=new Ul(t,n,this);ti.set(this,r)}return e}();["observe","unobserve","disconnect"].forEach(function(e){ni.prototype[e]=function(){var t;return(t=ti.get(this))[e].apply(t,arguments)}});var Vl=function(){return typeof Qt.ResizeObserver<"u"?Qt.ResizeObserver:ni}();const kl=Object.freeze(Object.defineProperty({__proto__:null,default:Vl},Symbol.toStringTag,{value:"Module"})),Wl=Li(kl);Object.defineProperty(vr,"__esModule",{value:!0});vr.default=Yl;var Wt=ql(I),zl=yr(Ke),Al=yr(Wl),Hl=yr(Ye);function yr(e){return e&&e.__esModule?e:{default:e}}function ri(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(ri=function(r){return r?n:t})(e)}function ql(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=ri(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function Bn(){return Bn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Bn.apply(this,arguments)}function ft(e,t,n){return t=Bl(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Bl(e){var t=Gl(e,"string");return typeof t=="symbol"?t:String(t)}function Gl(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}const Xl="react-grid-layout";function Yl(e){var t;return t=class extends Wt.Component{constructor(){super(...arguments),ft(this,"state",{width:1280}),ft(this,"elementRef",Wt.createRef()),ft(this,"mounted",!1),ft(this,"resizeObserver",void 0)}componentDidMount(){this.mounted=!0,this.resizeObserver=new Al.default(o=>{if(this.elementRef.current instanceof HTMLElement){const a=o[0].contentRect.width;this.setState({width:a})}});const r=this.elementRef.current;r instanceof HTMLElement&&this.resizeObserver.observe(r)}componentWillUnmount(){this.mounted=!1;const r=this.elementRef.current;r instanceof HTMLElement&&this.resizeObserver.unobserve(r),this.resizeObserver.disconnect()}render(){const{measureBeforeMount:r,...o}=this.props;return r&&!this.mounted?Wt.createElement("div",{className:(0,Hl.default)(this.props.className,Xl),style:this.props.style,ref:this.elementRef}):Wt.createElement(e,Bn({innerRef:this.elementRef},o,this.state))}},ft(t,"defaultProps",{measureBeforeMount:!1}),ft(t,"propTypes",{measureBeforeMount:zl.default.bool}),t}(function(e){e.exports=jt.default,e.exports.utils=H,e.exports.calculateUtils=Ve,e.exports.Responsive=gn.default,e.exports.Responsive.utils=st,e.exports.WidthProvider=vr.default})(yo);var Kl=yo.exports;const Zl=Yn(Kl),Gn={type:g.CommandType.COMMAND,id:"sheet.command.delete-conditional-rule",handler(e,t){if(!t)return!1;const n=e.get(g.IUndoRedoService),r=e.get(g.ICommandService),o=e.get(g.IUniverInstanceService),i=$.getSheetCommandTarget(o,t);if(!i)return!1;const{unitId:a,subUnitId:c}=i,l={unitId:a,subUnitId:c,cfId:t.cfId},u=s.DeleteConditionalRuleMutationUndoFactory(e,l),d=r.syncExecuteCommand(s.DeleteConditionalRuleMutation.id,l);return d&&n.pushUndoRedo({unitID:a,undoMutations:u,redoMutations:[{id:s.DeleteConditionalRuleMutation.id,params:l}]}),d}},oi={type:g.CommandType.COMMAND,id:"sheet.command.move-conditional-rule",handler(e,t){if(!t)return!1;const n=e.get(g.IUndoRedoService),r=e.get(g.ICommandService),o=e.get(g.IUniverInstanceService),i=e.get(s.ConditionalFormattingRuleModel),a=$.getSheetCommandTarget(o,t);if(!a)return!1;const{unitId:c,subUnitId:l}=a,u=s.transformSupportSymmetryAnchor(t.start,t.end,i.getSubunitRules(c,l)||[],S=>S.cfId);if(!u)return!1;const[d,p]=u,f={unitId:c,subUnitId:l,start:d,end:p},v=s.MoveConditionalRuleMutationUndoFactory(f),y=r.syncExecuteCommand(s.MoveConditionalRuleMutation.id,f);return y&&n.pushUndoRedo({unitID:c,redoMutations:[{id:s.MoveConditionalRuleMutation.id,params:f}],undoMutations:v}),y}},Jl="univer-cf-preview",zt={cfPreview:Jl},St=e=>{var o,i;const t=e.rule;if(!t)return null;const n=I.useMemo(()=>{if(t.type===s.CFRuleType.colorScale){const a=t.config.map((u,d)=>({color:new g.ColorKit(u.color),value:d})),c=a.length-1;return new Array(5).fill("").map((u,d,p)=>d*c/(p.length-1)).map(u=>s.getColorScaleFromValue(a,u))}return null},[t]),r=I.useMemo(()=>{if(t.type===s.CFRuleType.iconSet)return t.config.map(a=>{const c=s.iconMap[a.iconType];return c&&c[Number(a.iconId)]})},[t]);switch(t.type){case s.CFRuleType.dataBar:{const{isGradient:a}=t.config,c={width:"50%",height:"100%"},l=a?`linear-gradient(to right, ${t.config.positiveColor}, rgb(255 255 255))`:t.config.positiveColor,u=a?`linear-gradient(to right, rgb(255 255 255),${t.config.nativeColor})`:t.config.nativeColor;return h.jsxs("div",{className:zt.cfPreview,children:[h.jsx("div",{style:{...c,background:u,border:`1px solid ${t.config.nativeColor}`}}),h.jsx("div",{style:{...c,background:l,border:`1px solid ${t.config.positiveColor}`}})]})}case s.CFRuleType.colorScale:return n&&h.jsx("div",{className:zt.cfPreview,children:n.map((a,c)=>h.jsx("div",{style:{width:`${100/n.length}%`,height:"100%",background:a}},c))});case s.CFRuleType.iconSet:return r&&h.jsx("div",{className:zt.cfPreview,children:r.map((a,c)=>a?h.jsx("img",{style:{height:"100%"},src:a},c):h.jsx(rn,{},c))});case s.CFRuleType.highlightCell:{const{ul:a,st:c,it:l,bl:u,bg:d,cl:p}=t.style,f=(a==null?void 0:a.s)===g.BooleanNumber.TRUE,v=(c==null?void 0:c.s)===g.BooleanNumber.TRUE,y=l===g.BooleanNumber.TRUE,S=u===g.BooleanNumber.TRUE,x=(o=d==null?void 0:d.rgb)!=null?o:s.DEFAULT_BG_COLOR,_=(i=p==null?void 0:p.rgb)!=null?i:s.DEFAULT_FONT_COLOR,b={fontWeight:S?"bold":void 0,fontStyle:y?"italic":void 0,textDecoration:`${f?"underline":""} ${v?"line-through":""}`.replace(/^ /,"")||void 0,backgroundColor:x,color:_};return h.jsx("div",{style:b,className:zt.cfPreview,children:"123"})}}return null};var Ql=Object.defineProperty,ec=Object.getOwnPropertyDescriptor,tc=(e,t,n,r)=>{for(var o=r>1?void 0:r?ec(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&Ql(t,n,o),o},nc=(e,t)=>(n,r)=>t(n,r,e);let Mt=class extends g.Disposable{constructor(t){super();Be(this,"_initLocal",()=>{});Be(this,"_findReplaceIndex",t=>{const n=/\{([^}]+)?\}/g,r=[];let o=n.exec(t);for(;o;)r.push({startIndex:o.index,key:Number(o[1]),endIndex:o.index+o[0].length-1}),o=n.exec(t);return r});this._localeService=t,this._initLocal()}tWithReactNode(t,...n){const r=this._localeService.getLocales(),o=t.split("."),i=r&&this._localeService.resolveKeyPath(r,o);if(typeof i=="string"){const a=[];return this._findReplaceIndex(i).forEach((c,l,u)=>{const d=u[l-1]||{startIndex:0,endIndex:-1};if(d.endIndex+1<c.startIndex){const p=i.slice(d.endIndex+1,c.startIndex);p&&a.push(p)}if(n[c.key]&&a.push(n[c.key]),l===u.length-1){const p=i.slice(c.endIndex+1);p&&a.push(p)}}),a}return[]}};Mt=tc([g.OnLifecycle(g.LifecycleStages.Rendered,Mt),nc(0,V.Inject(g.LocaleService))],Mt);const rc="univer-cf-rule-list",oc="univer-rule-selector",ic="univer-select",ac="univer-select-selector",sc="univer-select-selection-item",lc="univer-select-selection-search-input",cc="univer-btn-list",uc="univer-gap",dc="univer-icon",fc="univer-disabled",pc="univer-rule-item",hc="univer-rule-describe",gc="univer-rule-type",mc="univer-rule-range",vc="univer-active",yc="univer-draggableHandle",Cc="univer-delete-item",Sc="univer-grid-layout-wrap",bc="univer-react-grid-item",ue={cfRuleList:rc,ruleSelector:oc,select:ic,selectSelector:ac,selectSelectionItem:sc,selectSelectionSearchInput:lc,btnList:cc,gap:uc,icon:dc,disabled:fc,ruleItem:pc,ruleDescribe:hc,ruleType:gc,ruleRange:mc,active:vc,draggableHandle:yc,deleteItem:Cc,gridLayoutWrap:Sc,reactGridItem:bc},Tc=(e,t)=>{const n=e.rule;switch(n.type){case s.CFRuleType.colorScale:return t.t("sheet.cf.ruleType.colorScale");case s.CFRuleType.dataBar:return t.t("sheet.cf.ruleType.dataBar");case s.CFRuleType.iconSet:return t.t("sheet.cf.ruleType.iconSet");case s.CFRuleType.highlightCell:switch(n.subType){case s.CFSubRuleType.average:{const r=n.operator;return t.t(`sheet.cf.preview.describe.${r}`,t.t("sheet.cf.subRuleType.average"))}case s.CFSubRuleType.duplicateValues:return t.t("sheet.cf.subRuleType.duplicateValues");case s.CFSubRuleType.uniqueValues:return t.t("sheet.cf.subRuleType.uniqueValues");case s.CFSubRuleType.number:{const r=n.operator;return t.t(`sheet.cf.preview.describe.${r}`,...Array.isArray(n.value)?n.value.map(o=>String(o)):[String(n.value||"")])}case s.CFSubRuleType.text:{const r=n.operator;return t.t(`sheet.cf.preview.describe.${r}`,n.value||"")}case s.CFSubRuleType.timePeriod:{const r=n.operator;return t.t(`sheet.cf.preview.describe.${r}`)}case s.CFSubRuleType.rank:return n.isPercent?n.isBottom?t.t("sheet.cf.preview.describe.bottomNPercent",String(n.value)):t.t("sheet.cf.preview.describe.topNPercent",String(n.value)):n.isBottom?t.t("sheet.cf.preview.describe.bottomN",String(n.value)):t.t("sheet.cf.preview.describe.topN",String(n.value));case s.CFSubRuleType.formula:return t.t("sheet.cf.ruleType.formula")}}};let zr=0;const Rc=e=>{const{onClick:t}=e,n=te.useDependency(s.ConditionalFormattingRuleModel),r=te.useDependency(g.IUniverInstanceService),o=te.useDependency($.SelectionManagerService),i=te.useDependency(g.ICommandService),a=te.useDependency(g.LocaleService),c=te.useDependency(Mt),l=r.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET),u=l.getUnitId(),p=l.getActiveSheet().getSheetId(),[f,v]=I.useState([]),[y,S]=I.useState("2"),[x,_]=I.useState(0),[b,C]=I.useState(-1),[T,m]=I.useState(zr),O=I.useRef(null),E=[{label:a.t("sheet.cf.panel.workSheet"),value:"2"},{label:a.t("sheet.cf.panel.selectedRange"),value:"1"}],w=()=>{const k=n.getSubunitRules(u,p);if(!k||!k.length)return[];if(y==="1"){const K=o.getLast();if(!K)return[];const oe=K.range;return k.filter(ce=>ce.ranges.some(fe=>g.Rectangle.intersects(fe,oe)))}else if(y==="2")return k;return[]},F=k=>{const oe=r.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getActiveSheet();return k.map(ce=>{const fe=ce.ranges;return(fe==null?void 0:fe.some(De=>{var G,ne;const{startRow:M,startColumn:U,endRow:Z,endColumn:X}=De;for(let ie=M;ie<=Z;ie++)for(let me=U;me<=X;me++){const Q=(ne=(G=oe.getCell(ie,me))==null?void 0:G.selectionProtection)==null?void 0:ne[0];if((Q==null?void 0:Q[Ae.Edit])===!1||(Q==null?void 0:Q[Ae.View])===!1)return!0}return!1}))?{...ce,disable:!0}:{...ce}})},[j,L]=I.useState(w);le.useHighlightRange(f),I.useEffect(()=>{const k=i.onCommandExecuted(K=>{K.id===$.SetWorksheetActiveOperation.id&&_(Math.random())});return()=>k.dispose()}),I.useEffect(()=>{L(w)},[y,x,u,p]),I.useEffect(()=>{if(y==="2")return;const k=new Ie.Observable(K=>{const oe=[$.SetSelectionsOperation.id,s.AddConditionalRuleMutation.id,s.SetConditionalRuleMutation.id,s.DeleteConditionalRuleMutation.id,s.MoveConditionalRuleMutation.id],de=i.onCommandExecuted(ce=>{const{id:fe,params:Oe}=ce,De=r.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getUnitId();oe.includes(fe)&&Oe.unitId===De&&K.next(null)});return()=>de.dispose()}).pipe(Ie.debounceTime(16)).subscribe(()=>{L(w)});return()=>{k.unsubscribe()}},[r,y,u,p]),I.useEffect(()=>{const k=n.$ruleChange.subscribe(()=>{_(Math.random())});return()=>k.unsubscribe()},[n]),I.useEffect(()=>{const k=()=>{var ce;const de=Math.max(0,(((ce=O.current)==null?void 0:ce.getBoundingClientRect().width)||0)-8);return zr=de,de},oe=new Ie.Observable(de=>{const ce=document.querySelector(".univer-sidebar");if(ce){let fe=setTimeout(()=>{de.next()},150);const Oe=()=>{fe&&clearTimeout(fe),fe=null},De=M=>{M.propertyName==="width"&&(Oe(),de.next())};return ce.addEventListener("transitionend",De),()=>{Oe(),ce.removeEventListener("transitionend",De)}}}).pipe(Ie.debounceTime(16)).subscribe(()=>{m(k())});return()=>{oe.unsubscribe()}},[]);const q=k=>{const K=r.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getUnitId(),oe=r.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getActiveSheet().getSheetId();i.executeCommand(Gn.id,{unitId:K,subUnitId:oe,cfId:k.cfId})},R=(k,K)=>{C(K.y)},P=(k,K,oe)=>{C(-1);const de=r.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getUnitId(),ce=r.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getActiveSheet().getSheetId(),fe=M=>{const U=j.length;return Math.min(U-1,Math.max(0,M))},Oe=j[fe(K.y)].cfId,De=j[fe(oe.y)].cfId;Oe!==De&&i.executeCommand(oi.id,{unitId:de,subUnitId:ce,start:{id:Oe,type:"self"},end:{id:De,type:oe.y>K.y?"after":"before"}})},J=()=>{e.onCreate()},Se=()=>{y==="2"?i.executeCommand(Xn.id):y==="1"&&j.map(K=>({unitId:u,subUnitId:p,cfId:K.cfId})).forEach(K=>{i.executeCommand(Gn.id,K)})},he=j.map((k,K)=>({i:k.cfId,x:0,w:12,y:K,h:1,isResizable:!1})),ge=F(j),Pe=ge==null?void 0:ge.some(k=>k.disable);return h.jsxs("div",{className:ue.cfRuleList,children:[h.jsxs("div",{className:ue.ruleSelector,children:[h.jsx("div",{children:c.tWithReactNode("sheet.cf.panel.managerRuleSelect",h.jsx(B.Select,{className:ue.select,options:E,value:y,onChange:k=>{S(k)}})).map((k,K)=>h.jsx("span",{children:k},K))}),h.jsxs("div",{className:ue.btnList,children:[h.jsx(B.Tooltip,{title:a.t("sheet.cf.panel.createRule"),placement:"bottom",children:h.jsx("div",{className:`${ue.icon}`,onClick:J,children:h.jsx(pa,{})})}),j.length&&!Pe?h.jsx(B.Tooltip,{title:a.t("sheet.cf.panel.clear"),placement:"bottom",children:h.jsx("div",{className:`${ue.gap} ${ue.icon}`,onClick:Se,children:h.jsx(Rn,{})})}):h.jsx("div",{className:`${ue.gap} ${ue.disabled}`,children:h.jsx(Rn,{})})]})]}),h.jsx("div",{ref:O,className:ue.gridLayoutWrap,children:T?h.jsx(Zl,{onDragStop:P,onDragStart:R,layout:he,cols:12,rowHeight:60,width:T,margin:[0,10],draggableHandle:".draggableHandle",children:ge==null?void 0:ge.map((k,K)=>h.jsx("div",{children:h.jsxs("div",{onMouseMove:()=>{k.ranges!==f&&v(k.ranges)},onMouseLeave:()=>v([]),onClick:()=>{k.disable||t(k)},className:`${ue.ruleItem} ${b===K?ue.active:""}`,children:[h.jsx("div",{className:`${ue.draggableHandle} draggableHandle`,onClick:oe=>oe.stopPropagation(),children:h.jsx(ma,{})}),h.jsxs("div",{className:ue.ruleDescribe,children:[h.jsx("div",{className:ue.ruleType,children:Tc(k,a)}),h.jsx("div",{className:ue.ruleRange,children:k.ranges.map(oe=>ao.serializeRange(oe)).join(",")})]}),h.jsx("div",{className:ue.preview,children:h.jsx(St,{rule:k.rule})}),!k.disable&&h.jsx("div",{className:`${ue.deleteItem} ${b===K?ue.active:""}`,onClick:oe=>{oe.stopPropagation(),q(k)},children:h.jsx(Rn,{})})]})},`${k.cfId}`))}):null})]})},vn={type:g.CommandType.COMMAND,id:"sheet.command.add-conditional-rule",handler(e,t){if(!t)return!1;const{rule:n}=t,r=e.get(g.IUndoRedoService),o=e.get(g.ICommandService),i=e.get(s.ConditionalFormattingRuleModel),a=e.get(g.IUniverInstanceService),c=$.getSheetCommandTarget(a);if(!c)return!1;const{unitId:l,subUnitId:u}=c,d=i.createCfId(l,u),p={unitId:l,subUnitId:u,rule:{...n,cfId:n.cfId||d}},f=s.AddConditionalRuleMutationUndoFactory(e,p),v=o.syncExecuteCommand(s.AddConditionalRuleMutation.id,p);return v&&r.pushUndoRedo({unitID:l,redoMutations:[{id:s.AddConditionalRuleMutation.id,params:p}],undoMutations:[f]}),v}},ii={type:g.CommandType.COMMAND,id:"sheet.command.set-conditional-rule",handler(e,t){if(!t)return!1;const n=e.get(g.IUndoRedoService),r=e.get(g.ICommandService),o=e.get(g.IUniverInstanceService),i=$.getSheetCommandTarget(o,t);if(!i)return!1;const{unitId:a,subUnitId:c}=i,l={unitId:a,subUnitId:c,rule:t.rule},u=s.setConditionalRuleMutationUndoFactory(e,l),d=r.syncExecuteCommand(s.SetConditionalRuleMutation.id,l);return d&&n.pushUndoRedo({unitID:a,undoMutations:u,redoMutations:[{id:s.SetConditionalRuleMutation.id,params:l}]}),d}},_c=g.createInterceptorKey("beforeSubmit"),wc=g.createInterceptorKey("submit"),Ic="univer-cf-color-picker",xc="univer-cf-color-picker-icon",Oc="univer-icon-dropdown",Dn={cfColorPicker:Ic,cfColorPickerIcon:xc,iconDropdown:Oc},rt=e=>{const{color:t,onChange:n,disable:r=!1,iconId:o="PaintBucket",className:i,isNeedDropdownIcon:a=!0}=e,c=te.useDependency(Re.ComponentManager),l=I.useMemo(()=>new g.ColorKit(t),[t]),u=c.get(o);return u&&(r?h.jsx(u,{className:i,extend:{colorChannel1:l.isValid?t:"rgb(var(--primary-color))"}}):h.jsx(B.Dropdown,{overlay:h.jsx("div",{className:`${Dn.cfColorPicker} `,children:h.jsx(B.ColorPicker,{color:t,onChange:n})}),children:h.jsxs("span",{className:`${Dn.cfColorPickerIcon} ${i}`,children:[h.jsx(u,{extend:{colorChannel1:l.isValid?t:"rgb(var(--primary-color))"}}),a&&h.jsx(Kn,{className:Dn.iconDropdown})]})}))},Ec="univer-cf-rule-style-editor",Pc="univer-cf-preview-wrap",Dc="univer-text",Mc="univer-position-relative",Nc="univer-btn-list",Fc="univer-util-item",jc="univer-icon-set",$c="univer-render-config",Lc="univer-flex",Uc="univer-width45",Vc="univer-icon-wrap",kc="univer-icon",Wc="univer-dropdown-icon",zc="univer-error-input",Ac="univer-error-text",Hc="univer-icon-group-list",qc="univer-title",Bc="univer-group",Gc="univer-item-content",Xc="univer-item-wrap",Yc="univer-item",Kc="univer-icon-item-list-wrap",Zc="univer-none",Jc="univer-icon-item-list",Qc="univer-width100",eu="univer-stress",N={cfRuleStyleEditor:Ec,cfPreviewWrap:Pc,text:Dc,positionRelative:Mc,btnList:Nc,utilItem:Fc,iconSet:jc,renderConfig:$c,flex:Lc,width45:Uc,iconWrap:Vc,icon:kc,dropdownIcon:Wc,errorInput:zc,errorText:Ac,iconGroupList:Hc,title:qc,group:Bc,itemContent:Gc,itemWrap:Xc,item:Yc,iconItemListWrap:Kc,none:Zc,iconItemList:Jc,width100:Qc,stress:eu},Qe=(e,t)=>({label:t.t(`sheet.cf.valueType.${e}`),value:e}),Mn=e=>{const{type:t,className:n,onChange:r,id:o,value:i}=e,a=te.useDependency(g.IUniverInstanceService),c=a.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getUnitId(),l=a.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getActiveSheet().getSheetId(),u=I.useMemo(()=>String(i).startsWith("=")?String(i):"=",[i]),d=I.useMemo(()=>[s.CFValueType.max,s.CFValueType.min,"none"].includes(t)?{disabled:!0}:[s.CFValueType.percent,s.CFValueType.percentile].includes(t)?{min:0,max:100}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[t]);return t===s.CFValueType.formula?h.jsx(Re.TextEditor,{openForSheetSubUnitId:l,openForSheetUnitId:c,id:g.createInternalEditorID(`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_colo_scale_${o}`),value:u,style:{maxWidth:"50%",marginLeft:4},canvasStyle:{fontSize:10},onlyInputFormula:!0,onChange:(p="")=>{r(p||"")}}):h.jsx(B.InputNumber,{className:n,value:Number(e.value)||0,onChange:p=>e.onChange(p||0),...d})},tu=e=>{var q;const{interceptorManager:t}=e,n=te.useDependency(g.LocaleService),r=((q=e.rule)==null?void 0:q.type)===s.CFRuleType.colorScale?e.rule:void 0,o=[Qe(s.CFValueType.num,n),Qe(s.CFValueType.percent,n),Qe(s.CFValueType.percentile,n),Qe(s.CFValueType.formula,n)],i=[Qe(s.CFValueType.min,n),...o],a=[Qe("none",n),...o],c=[Qe(s.CFValueType.max,n),...o],[l,u]=I.useState(()=>{var P;const R=s.CFValueType.min;return r&&((P=r.config[0])==null?void 0:P.value.type)||R}),[d,p]=I.useState(()=>{var P;const R="none";return!r||r.config.length!==3?R:((P=r.config[1])==null?void 0:P.value.type)||R}),[f,v]=I.useState(()=>{var P;const R=s.CFValueType.max;return r&&((P=r.config[r.config.length-1])==null?void 0:P.value.type)||R}),[y,S]=I.useState(()=>{if(!r)return 10;const P=r.config[0];return(P==null?void 0:P.value.value)===void 0?10:P==null?void 0:P.value.value}),[x,_]=I.useState(()=>{var J;if(!r||r.config.length!==3)return 50;const P=(J=r.config[1])==null?void 0:J.value.value;return P===void 0?50:P}),[b,C]=I.useState(()=>{var J;if(!r)return 90;const P=(J=r.config[r.config.length-1])==null?void 0:J.value.value;return P===void 0?90:P}),[T,m]=I.useState(()=>{var P;const R="#d0d9fb";return r&&((P=r.config[0])==null?void 0:P.color)||R}),[O,E]=I.useState(()=>{var P;const R="#7790f3";return!r||r.config.length!==3?R:((P=r.config[1])==null?void 0:P.color)||R}),[w,F]=I.useState(()=>{var P;const R="#2e55ef";return r&&((P=r.config[r.config.length-1])==null?void 0:P.color)||R}),j=I.useMemo(()=>R=>{const{minType:P,medianType:J,maxType:Se,minValue:he,medianValue:ge,maxValue:Pe,minColor:k,medianColor:K,maxColor:oe}=R,de=[];return de.push({color:k,value:{type:P,value:he}}),J!=="none"&&de.push({color:K,value:{type:J,value:ge}}),de.push({color:oe,value:{type:Se,value:Pe}}),{config:de.map((fe,Oe)=>({...fe,index:Oe})),type:s.CFRuleType.colorScale}},[]);I.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return j({minType:l,medianType:d,maxType:f,minValue:y,medianValue:x,maxValue:b,minColor:T,medianColor:O,maxColor:w})}}),[j,l,d,f,y,x,b,T,O,w,t]);const L=R=>{e.onChange(j(R))};return h.jsxs("div",{children:[h.jsx("div",{className:D.title,children:n.t("sheet.cf.panel.styleRule")}),h.jsx("div",{className:`${N.cfPreviewWrap}`,children:h.jsx(St,{rule:j({minType:l,medianType:d,maxType:f,minValue:y,medianValue:x,maxValue:b,minColor:T,medianColor:O,maxColor:w})})}),h.jsx("div",{className:D.label,children:n.t("sheet.cf.valueType.min")}),h.jsxs("div",{className:`${D.labelContainer} ${D.mTSm}`,children:[h.jsx(B.Select,{options:i,value:l,onChange:R=>{u(R);const P=s.createDefaultValueByValueType(R,10);S(P),L({minType:R,medianType:d,maxType:f,minValue:P,medianValue:x,maxValue:b,minColor:T,medianColor:O,maxColor:w})}}),h.jsx(Mn,{id:"min",className:`${D.mLXxs}`,value:y,type:l,onChange:R=>{S(R),L({minType:l,medianType:d,maxType:f,minValue:R,medianValue:x,maxValue:b,minColor:T,medianColor:O,maxColor:w})}}),h.jsx(rt,{className:D.mLXxs,color:T,onChange:R=>{m(R),L({minType:l,medianType:d,maxType:f,minValue:y,medianValue:x,maxValue:b,minColor:R,medianColor:O,maxColor:w})}})]}),h.jsx("div",{className:D.label,children:n.t("sheet.cf.panel.medianValue")}),h.jsxs("div",{className:`${D.labelContainer} ${D.mTSm}`,children:[h.jsx(B.Select,{options:a,value:d,onChange:R=>{p(R);const P=s.createDefaultValueByValueType(R,50);_(P),L({minType:l,medianType:R,maxType:f,minValue:y,medianValue:P,maxValue:b,minColor:T,medianColor:O,maxColor:w})}}),h.jsx(Mn,{id:"median",className:` ${D.mLXxs}`,value:x,type:d,onChange:R=>{_(R),L({minType:l,medianType:d,maxType:f,minValue:y,medianValue:R,maxValue:b,minColor:T,medianColor:O,maxColor:w})}}),d!=="none"&&h.jsx(rt,{className:D.mLXxs,color:O,onChange:R=>{E(R),L({minType:l,medianType:d,maxType:f,minValue:y,medianValue:x,maxValue:b,minColor:T,medianColor:R,maxColor:w})}})]}),h.jsx("div",{className:D.label,children:n.t("sheet.cf.valueType.max")}),h.jsxs("div",{className:`${D.labelContainer} ${D.mTSm}`,children:[h.jsx(B.Select,{options:c,value:f,onChange:R=>{v(R);const P=s.createDefaultValueByValueType(R,90);C(P),L({minType:l,medianType:d,maxType:R,minValue:y,medianValue:x,maxValue:P,minColor:T,medianColor:O,maxColor:w})}}),h.jsx(Mn,{id:"max",className:`${D.mLXxs}`,value:b,type:f,onChange:R=>{C(R),L({minType:l,medianType:d,maxType:f,minValue:y,medianValue:x,maxValue:R,minColor:T,medianColor:O,maxColor:w})}}),h.jsx(rt,{className:D.mLXxs,color:w,onChange:R=>{F(R),L({minType:l,medianType:d,maxType:f,minValue:y,medianValue:x,maxValue:b,minColor:T,medianColor:O,maxColor:R})}})]})]})},pt=(e,t)=>({label:t.t(`sheet.cf.valueType.${e}`),value:e}),Ar=e=>{const{onChange:t,className:n,value:r,type:o,id:i,disabled:a=!1}=e,c=te.useDependency(g.IUniverInstanceService),l=c.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getUnitId(),u=c.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getActiveSheet().getSheetId(),d=I.useRef(r),p=I.useMemo(()=>[s.CFValueType.percentile,s.CFValueType.percent].includes(o)?{max:100,min:0}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[o]);if(o===s.CFValueType.formula){const f=String(d.current).startsWith("=")?String(d.current)||"":"=";return h.jsx(Re.TextEditor,{id:g.createInternalEditorID(`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_data_bar_${i}`),value:f,openForSheetSubUnitId:u,openForSheetUnitId:l,style:{width:"47%",marginLeft:14},canvasStyle:{fontSize:10},onlyInputFormula:!0,onChange:(v="")=>{t(v||"")}})}return h.jsx(B.InputNumber,{className:n,value:Number(r)||0,disabled:a,onChange:f=>{t(f||0)},...p})},nu=e=>{var q;const{interceptorManager:t}=e,n=te.useDependency(g.LocaleService),r=((q=e.rule)==null?void 0:q.type)===s.CFRuleType.dataBar?e.rule:void 0,[o,i]=I.useState(()=>{var P;const R="0";return r?(P=r.config)!=null&&P.isGradient?"1":"0":R}),[a,c]=I.useState(()=>{var P;const R="#abd91a";return r&&((P=r.config)==null?void 0:P.positiveColor)||R}),[l,u]=I.useState(()=>{var P;const R="#ffbe38";return r&&((P=r.config)==null?void 0:P.nativeColor)||R}),d=[pt(s.CFValueType.num,n),pt(s.CFValueType.percent,n),pt(s.CFValueType.percentile,n),pt(s.CFValueType.formula,n)],p=[pt(s.CFValueType.min,n),...d],f=[pt(s.CFValueType.max,n),...d],[v,y]=I.useState(()=>{var P;const R=p[0].value;return r&&((P=r.config)==null?void 0:P.min.type)||R}),[S,x]=I.useState(()=>{var P;const R=f[0].value;return r&&((P=r.config)==null?void 0:P.max.type)||R}),[_,b]=I.useState(()=>{var J;if(!r)return 0;const P=((J=r.config)==null?void 0:J.min)||{};return P.type===s.CFValueType.formula?P.value||"=":P.value||0}),[C,T]=I.useState(()=>{var J;if(!r)return 100;const P=((J=r.config)==null?void 0:J.max)||{};return P.type===s.CFValueType.formula?P.value||"=":P.value===void 0?100:P.value}),[m,O]=I.useState(()=>r?r.isShowValue===void 0?!0:!!r.isShowValue:!0),E=R=>({config:{min:{type:R.minValueType,value:R.minValue},max:{type:R.maxValueType,value:R.maxValue},isGradient:R.isGradient==="1",positiveColor:R.positiveColor,nativeColor:R.nativeColor},type:s.CFRuleType.dataBar,isShowValue:R.isShowValue});I.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return E({isGradient:o,minValue:_,minValueType:v,maxValue:C,maxValueType:S,positiveColor:a,nativeColor:l,isShowValue:m})}}),[o,_,v,C,S,a,l,t,m]);const w=R=>{e.onChange(E(R))},F=R=>{c(R),w({isGradient:o,minValue:_,minValueType:v,maxValue:C,maxValueType:S,positiveColor:R,nativeColor:l,isShowValue:m})},j=R=>{u(R),w({isGradient:o,minValue:_,minValueType:v,maxValue:C,maxValueType:S,positiveColor:a,nativeColor:R,isShowValue:m})},L=R=>d.map(P=>P.value).includes(R);return h.jsxs("div",{children:[h.jsx("div",{className:D.title,children:n.t("sheet.cf.panel.styleRule")}),h.jsx("div",{className:`${N.cfPreviewWrap}`,children:h.jsx(St,{rule:E({isGradient:o,minValue:_,minValueType:v,maxValue:C,maxValueType:S,positiveColor:a,nativeColor:l,isShowValue:m})})}),h.jsxs("div",{children:[h.jsx("div",{className:D.label,children:n.t("sheet.cf.panel.fillType")}),h.jsxs("div",{className:`${D.mTSm} ${D.mLXxs} ${D.labelContainer} `,children:[h.jsxs(B.RadioGroup,{value:o,onChange:R=>{i(R),w({isGradient:R,minValue:_,minValueType:v,maxValue:C,maxValueType:S,positiveColor:a,nativeColor:l,isShowValue:m})},children:[h.jsx(B.Radio,{value:"0",children:h.jsx("span",{className:N.text,children:n.t("sheet.cf.panel.pureColor")})}),h.jsx(B.Radio,{value:"1",children:h.jsx("span",{className:N.text,children:n.t("sheet.cf.panel.gradient")})})]}),h.jsxs("div",{className:`${N.utilItem} ${D.mLXl}`,children:[h.jsx(B.Checkbox,{checked:!m,onChange:R=>{O(!R),w({isGradient:R,minValue:_,minValueType:v,maxValue:C,maxValueType:S,positiveColor:a,nativeColor:l,isShowValue:!R})}}),n.t("sheet.cf.panel.onlyShowDataBar")]})]})]}),h.jsxs("div",{children:[h.jsx("div",{className:D.label,children:n.t("sheet.cf.panel.colorSet")}),h.jsxs("div",{className:`${D.labelContainer} ${D.mTSm} ${D.mLXxs}`,children:[h.jsxs("div",{className:`${D.labelContainer}`,children:[h.jsx("div",{className:`${N.text}`,children:n.t("sheet.cf.panel.native")}),h.jsx(rt,{color:l,onChange:j})]}),h.jsxs("div",{className:`${D.labelContainer} ${D.mLSm} `,children:[h.jsx("div",{className:`${N.text} `,children:n.t("sheet.cf.panel.positive")}),h.jsx(rt,{color:a,onChange:F})]})]})]}),h.jsxs("div",{children:[h.jsx("div",{className:D.label,children:n.t("sheet.cf.valueType.min")}),h.jsxs("div",{className:`${D.mTSm} ${D.labelContainer}`,children:[h.jsx(B.Select,{options:p,value:v,onChange:R=>{y(R);const P=s.createDefaultValueByValueType(R,10);b(P),w({isGradient:o,minValue:P,minValueType:R,maxValue:C,maxValueType:S,positiveColor:a,nativeColor:l,isShowValue:m})}}),h.jsx(Ar,{disabled:!L(v),id:"min",type:v,className:D.mLSm,value:_,onChange:R=>{b(R||0),w({isGradient:o,minValue:R||0,minValueType:v,maxValue:C,maxValueType:S,positiveColor:a,nativeColor:l,isShowValue:m})}})]}),h.jsx("div",{className:D.label,children:n.t("sheet.cf.valueType.max")}),h.jsxs("div",{className:`${D.mTSm} ${D.labelContainer}`,children:[h.jsx(B.Select,{options:f,value:S,onChange:R=>{x(R);const P=s.createDefaultValueByValueType(R,90);T(P),w({isGradient:o,minValue:_,minValueType:v,maxValue:P,maxValueType:R,positiveColor:a,nativeColor:l,isShowValue:m})}}),h.jsx(Ar,{disabled:!L(S),id:"max",type:S,className:D.mLSm,value:C,onChange:R=>{T(R||0),w({isGradient:o,minValue:_,minValueType:v,maxValue:R||0,maxValueType:S,positiveColor:a,nativeColor:l,isShowValue:m})}})]})]})]})},ru="univer-cf-style-edit",ou="univer-button-item",iu="univer-isActive",ze={cfStyleEdit:ru,buttonItem:ou,isActive:iu},At=e=>[g.BooleanNumber.FALSE,void 0].includes(e)?g.BooleanNumber.TRUE:g.BooleanNumber.FALSE,Ht=e=>e!==g.BooleanNumber.FALSE,Cr=e=>{const{style:t,onChange:n,className:r}=e,o=te.useDependency(Re.ComponentManager),[i,a]=I.useState(()=>{if(t!=null&&t.bl)return t.bl}),[c,l]=I.useState(()=>{if(t!=null&&t.it)return t.it}),[u,d]=I.useState(()=>{if(t!=null&&t.ul)return t.ul.s}),[p,f]=I.useState(()=>{if(t!=null&&t.st)return t.st.s}),[v,y]=I.useState(()=>{var O;const m="#2f56ef";return(O=t==null?void 0:t.cl)!=null&&O.rgb?t.cl.rgb:m}),[S,x]=I.useState(()=>{var O;const m="#e8ecfc";return(O=t==null?void 0:t.bg)!=null&&O.rgb?t.bg.rgb:m}),_=o.get("BoldSingle"),b=o.get("ItalicSingle"),C=o.get("UnderlineSingle"),T=o.get("StrikethroughSingle");return I.useEffect(()=>{const m={bl:i,it:c};v!==void 0&&(m.cl={rgb:v}),S!==void 0&&(m.bg={rgb:S}),p!==void 0&&(m.st={s:p}),u!==void 0&&(m.ul={s:u}),n(s.removeUndefinedAttr(m))},[i,c,u,p,v,S]),h.jsxs("div",{className:`${ze.cfStyleEdit} ${r}`,children:[_&&h.jsx("div",{className:Ye({[ze.isActive]:Ht(i||g.BooleanNumber.FALSE)},ze.buttonItem),onClick:()=>a(At(i)),children:h.jsx(_,{})}),b&&h.jsx("div",{className:Ye({[ze.isActive]:Ht(c||g.BooleanNumber.FALSE)},ze.buttonItem),onClick:()=>l(At(c)),children:h.jsx(b,{})}),C&&h.jsx("div",{className:Ye({[ze.isActive]:Ht(u||g.BooleanNumber.FALSE)},ze.buttonItem),onClick:()=>d(At(u)),children:h.jsx(C,{})}),T&&h.jsx("div",{className:Ye({[ze.isActive]:Ht(p||g.BooleanNumber.FALSE)},ze.buttonItem),onClick:()=>f(At(p)),children:h.jsx(T,{})}),h.jsx(rt,{color:v,onChange:y,iconId:"FontColor"}),h.jsx(rt,{color:S,onChange:x,iconId:"PaintBucket"})]})},au=e=>{var x;const{onChange:t,interceptorManager:n}=e,r=te.useDependency(g.LocaleService),o=((x=e.rule)==null?void 0:x.type)===s.CFRuleType.highlightCell?e.rule:void 0,i=[{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"}],[a,c]=I.useState(()=>{const _=i[0].value,b=o==null?void 0:o.type;if(!o)return _;switch(b){case s.CFRuleType.highlightCell:switch(o.subType){case s.CFSubRuleType.average:return[s.CFNumberOperator.greaterThan,s.CFNumberOperator.greaterThanOrEqual].includes(o.operator)?"greaterThanAverage":[s.CFNumberOperator.lessThan,s.CFNumberOperator.lessThanOrEqual].includes(o.operator)?"lessThanAverage":_;case s.CFSubRuleType.rank:return o.isBottom?"isBottom":"isNotBottom"}}return _}),[l,u]=I.useState(()=>{const b=o==null?void 0:o.type;if(!o)return 10;switch(b){case s.CFRuleType.highlightCell:switch(o.subType){case s.CFSubRuleType.rank:return o.value||10}}return 10}),[d,p]=I.useState(()=>{const b=o==null?void 0:o.type;if(!o)return!1;switch(b){case s.CFRuleType.highlightCell:switch(o.subType){case s.CFSubRuleType.rank:return o.isPercent||!1}}return!1}),[f,v]=I.useState({}),y=_=>{const{type:b,isPercent:C,value:T,style:m}=_;if(b==="isNotBottom")return{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.rank,isPercent:C,isBottom:!1,value:T,style:m};if(b==="isBottom")return{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.rank,isPercent:C,isBottom:!0,value:T,style:m};if(b==="greaterThanAverage")return{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.average,operator:s.CFNumberOperator.greaterThan,style:m};if(b==="lessThanAverage")return{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.average,operator:s.CFNumberOperator.lessThan,style:m}};I.useEffect(()=>n.intercept(n.getInterceptPoints().submit,{handler(){return y({type:a,isPercent:d,value:l,style:f})}}),[a,d,l,f,n]);const S=_=>{t(y(_))};return h.jsxs("div",{children:[h.jsx("div",{className:`${D.title} ${D.mTBase}`,children:r.t("sheet.cf.panel.styleRule")}),h.jsx(B.Select,{className:`${N.width100} ${D.mTSm}`,value:a,options:i,onChange:_=>{c(_),S({type:_,isPercent:d,value:l,style:f})}}),["isNotBottom","isBottom"].includes(a)&&h.jsxs("div",{className:`${D.labelContainer} ${D.mTSm}`,children:[h.jsx(B.InputNumber,{min:1,max:1e3,value:l,onChange:_=>{const b=_||0;u(b),S({type:a,isPercent:d,value:b,style:f})}}),h.jsxs("div",{className:`${D.mLSm} ${D.labelContainer} ${N.text}`,children:[h.jsx(B.Checkbox,{checked:d,onChange:_=>{p(!!_),S({type:a,isPercent:!!_,value:l,style:f})}}),r.t("sheet.cf.valueType.percent")]})]}),h.jsx("div",{className:`${N.cfPreviewWrap} `,children:h.jsx(St,{rule:y({type:a,isPercent:d,value:l,style:f})})}),h.jsx(Cr,{style:o==null?void 0:o.style,className:`${D.mTSm} `,onChange:_=>{v(_),S({type:a,isPercent:d,value:l,style:_})}})]})},ee=(e,t)=>({label:t.t(`sheet.cf.operator.${e}`),value:e}),su=e=>{const{type:t,operator:n,onChange:r,value:o}=e,[i,a]=I.useState(()=>typeof o=="number"?o:0),[c,l]=I.useState(()=>typeof o=="string"?o:""),[u,d]=I.useState(()=>Array.isArray(o)?o[0]===void 0?0:o[0]:0),[p,f]=I.useState(()=>Array.isArray(o)?o[1]===void 0?100:o[1]:100);switch(I.useEffect(()=>{switch(t){case s.CFSubRuleType.text:{[s.CFTextOperator.beginsWith,s.CFTextOperator.endsWith,s.CFTextOperator.containsText,s.CFTextOperator.notContainsText,s.CFTextOperator.equal,s.CFTextOperator.notEqual].includes(n)&&r(c);break}case s.CFSubRuleType.number:{[s.CFNumberOperator.equal,s.CFNumberOperator.notEqual,s.CFNumberOperator.greaterThan,s.CFNumberOperator.greaterThanOrEqual,s.CFNumberOperator.lessThan,s.CFNumberOperator.lessThanOrEqual].includes(n)&&r(i),[s.CFNumberOperator.between,s.CFNumberOperator.notBetween].includes(n)&&r([u,p]);break}}},[t]),t){case s.CFSubRuleType.text:{if([s.CFTextOperator.beginsWith,s.CFTextOperator.endsWith,s.CFTextOperator.containsText,s.CFTextOperator.notContainsText,s.CFTextOperator.equal,s.CFTextOperator.notEqual].includes(n)){const v=y=>{l(y),r(y)};return h.jsx("div",{className:`${D.mTSm}`,children:h.jsx(B.Input,{className:N.width100,value:c,onChange:v})})}break}case s.CFSubRuleType.number:{if([s.CFNumberOperator.equal,s.CFNumberOperator.notEqual,s.CFNumberOperator.greaterThan,s.CFNumberOperator.greaterThanOrEqual,s.CFNumberOperator.lessThan,s.CFNumberOperator.lessThanOrEqual].includes(n)){const v=y=>{a(y||0),r(y||0)};return h.jsx("div",{className:`${D.mTSm}`,children:h.jsx(B.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,className:N.width100,value:i,onChange:v})})}if([s.CFNumberOperator.between,s.CFNumberOperator.notBetween].includes(n)){const v=S=>{d(S||0),r([S||0,p])},y=S=>{f(S||0),r([u,S||0])};return h.jsxs("div",{className:`${D.mTSm} ${D.labelContainer} `,children:[h.jsx(B.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,value:u,onChange:v}),h.jsx(B.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,className:`${D.mLSm}`,value:p,onChange:y})]})}}}return null},Hr=(e,t)=>{switch(e){case s.CFSubRuleType.text:return[ee(s.CFTextOperator.containsText,t),ee(s.CFTextOperator.notContainsText,t),ee(s.CFTextOperator.beginsWith,t),ee(s.CFTextOperator.endsWith,t),ee(s.CFTextOperator.equal,t),ee(s.CFTextOperator.notEqual,t),ee(s.CFTextOperator.containsBlanks,t),ee(s.CFTextOperator.notContainsBlanks,t),ee(s.CFTextOperator.containsErrors,t),ee(s.CFTextOperator.notContainsErrors,t)];case s.CFSubRuleType.number:return[ee(s.CFNumberOperator.between,t),ee(s.CFNumberOperator.notBetween,t),ee(s.CFNumberOperator.equal,t),ee(s.CFNumberOperator.notEqual,t),ee(s.CFNumberOperator.greaterThan,t),ee(s.CFNumberOperator.greaterThanOrEqual,t),ee(s.CFNumberOperator.lessThan,t),ee(s.CFNumberOperator.lessThanOrEqual,t)];case s.CFSubRuleType.timePeriod:return[ee(s.CFTimePeriodOperator.yesterday,t),ee(s.CFTimePeriodOperator.today,t),ee(s.CFTimePeriodOperator.tomorrow,t),ee(s.CFTimePeriodOperator.last7Days,t),ee(s.CFTimePeriodOperator.lastWeek,t),ee(s.CFTimePeriodOperator.thisWeek,t),ee(s.CFTimePeriodOperator.nextWeek,t),ee(s.CFTimePeriodOperator.lastMonth,t),ee(s.CFTimePeriodOperator.thisMonth,t),ee(s.CFTimePeriodOperator.nextMonth,t)]}},qr=e=>{var T;const{interceptorManager:t,onChange:n}=e,r=te.useDependency(g.LocaleService),o=((T=e.rule)==null?void 0:T.type)===s.CFRuleType.highlightCell?e.rule:void 0,[i,a]=I.useState(()=>{const m=s.CFSubRuleType.text;return o&&o.subType||m}),c=[{value:s.CFSubRuleType.text,label:r.t("sheet.cf.subRuleType.text")},{value:s.CFSubRuleType.number,label:r.t("sheet.cf.subRuleType.number")},{value:s.CFSubRuleType.timePeriod,label:r.t("sheet.cf.subRuleType.timePeriod")},{value:s.CFSubRuleType.duplicateValues,label:r.t("sheet.cf.subRuleType.duplicateValues")},{value:s.CFSubRuleType.uniqueValues,label:r.t("sheet.cf.subRuleType.uniqueValues")}],l=I.useMemo(()=>Hr(i,r),[i]),[u,d]=I.useState(()=>{const m=l?l[0].value:void 0;return o&&o.operator||m}),[p,f]=I.useState(()=>{var E;const m="";return o?(E=o.value)!=null?E:s.createDefaultValue(o.subType,o.operator):m}),[v,y]=I.useState({}),S=I.useMemo(()=>m=>{var O,E,w,F,j,L,q,R,P,J,Se,he,ge,Pe,k;switch(m.subType||i){case s.CFSubRuleType.text:{if([s.CFTextOperator.beginsWith,s.CFTextOperator.endsWith,s.CFTextOperator.containsText,s.CFTextOperator.notContainsText,s.CFTextOperator.equal,s.CFTextOperator.notEqual].includes(u))return{type:s.CFRuleType.highlightCell,subType:(O=m.subType)!=null?O:i,operator:(E=m.operator)!=null?E:u,style:(w=m.style)!=null?w:v,value:(F=m.value)!=null?F:p};break}case s.CFSubRuleType.number:{if([s.CFNumberOperator.equal,s.CFNumberOperator.notEqual,s.CFNumberOperator.greaterThan,s.CFNumberOperator.greaterThanOrEqual,s.CFNumberOperator.lessThan,s.CFNumberOperator.lessThanOrEqual].includes(u))return{type:s.CFRuleType.highlightCell,subType:(j=m.subType)!=null?j:i,operator:(L=m.operator)!=null?L:u,style:(q=m.style)!=null?q:v,value:(R=m.value)!=null?R:p};if([s.CFNumberOperator.between,s.CFNumberOperator.notBetween].includes(u))return{type:s.CFRuleType.highlightCell,subType:(P=m.subType)!=null?P:i,operator:(J=m.operator)!=null?J:u,style:(Se=m.style)!=null?Se:v,value:(he=m.value)!=null?he:p};break}}return{type:s.CFRuleType.highlightCell,subType:(ge=m.subType)!=null?ge:i,operator:(Pe=m.operator)!=null?Pe:u,style:(k=m.style)!=null?k:v}},[i,u,p,v]);I.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return S({})}}),[S,t]),I.useEffect(()=>{c.some(m=>m.value===i)||a(c[0].value)},[c]);const x=m=>{const O=m,E=Hr(O,r),w=E&&E[0].value;a(O),d(w),w&&f(s.createDefaultValue(O,w)),n(S({subType:O,operator:w}))},_=m=>{const O=m;d(O),n(S({operator:O}))},b=m=>{f(m),n(S({value:m}))},C=I.useMemo(()=>`${i}_${u}_${Math.random()}`,[i,u]);return h.jsxs("div",{children:[h.jsx("div",{className:`${D.title} ${D.mTBase}`,children:r.t("sheet.cf.panel.styleRule")}),h.jsx(B.Select,{className:`${D.mTSm} ${N.width100}`,onChange:x,value:i,options:c}),(l==null?void 0:l.length)&&h.jsx(B.Select,{className:`${D.mTSm} ${N.width100}`,onChange:_,value:u||"",options:l}),h.jsx(su,{value:p,interceptorManager:t,type:i,operator:u,rule:o,onChange:b},C),h.jsx("div",{className:`${N.cfPreviewWrap}`,children:h.jsx(St,{rule:S({})})}),h.jsx(Cr,{style:o==null?void 0:o.style,className:`${D.mLXxs}`,onChange:m=>{y(m),n(S({style:m}))}})]})},lu=e=>{var y;const{onChange:t,interceptorManager:n}=e,r=te.useDependency(g.LocaleService),i=te.useDependency(g.IUniverInstanceService).getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET),a=i.getActiveSheet(),c=((y=e.rule)==null?void 0:y.type)===s.CFRuleType.highlightCell?e.rule:void 0,[l,u]=I.useState({}),[d,p]=I.useState(()=>(c==null?void 0:c.subType)===s.CFSubRuleType.formula?c.value:"="),f=S=>({style:S.style,value:d,type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.formula});I.useEffect(()=>n.intercept(n.getInterceptPoints().submit,{handler(){return f({style:l,formula:d})}}),[l,d,n]);const v=S=>{t(f(S))};return h.jsxs("div",{children:[h.jsx("div",{className:`${D.title} ${D.mTBase}`,children:r.t("sheet.cf.panel.styleRule")}),h.jsx("div",{className:`${D.mTSm}`,children:h.jsx(Re.TextEditor,{id:g.createInternalEditorID(`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_formula`),openForSheetSubUnitId:a.getSheetId(),openForSheetUnitId:i.getUnitId(),value:d,canvasStyle:{fontSize:10},onlyInputFormula:!0,onChange:(S="")=>{const x=S||"";p(x),v({style:l,formula:x})}})}),h.jsx("div",{className:`${N.cfPreviewWrap} `,children:h.jsx(St,{rule:f({style:l,formula:d})})}),h.jsx(Cr,{style:c==null?void 0:c.style,className:`${D.mTSm} `,onChange:S=>{u(S),v({style:S,formula:d})}})]})};var cu="Expected a function",ai="__lodash_hash_undefined__",si=1/0,uu=9007199254740991,du="[object Function]",fu="[object GeneratorFunction]",pu="[object Symbol]",hu=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,gu=/^\w*$/,mu=/^\./,vu=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,yu=/[\\^$.*+?()[\]{}|]/g,Cu=/\\(\\)?/g,Su=/^\[object .+?Constructor\]$/,bu=/^(?:0|[1-9]\d*)$/,Tu=typeof He=="object"&&He&&He.Object===Object&&He,Ru=typeof self=="object"&&self&&self.Object===Object&&self,Sr=Tu||Ru||Function("return this")();function _u(e,t){return e==null?void 0:e[t]}function wu(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch{}return t}var Iu=Array.prototype,xu=Function.prototype,li=Object.prototype,Nn=Sr["__core-js_shared__"],Br=function(){var e=/[^.]+$/.exec(Nn&&Nn.keys&&Nn.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),ci=xu.toString,yn=li.hasOwnProperty,ui=li.toString,Ou=RegExp("^"+ci.call(yn).replace(yu,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Gr=Sr.Symbol,Eu=Iu.splice,Pu=di(Sr,"Map"),Nt=di(Object,"create"),Xr=Gr?Gr.prototype:void 0,Yr=Xr?Xr.toString:void 0;function ot(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Du(){this.__data__=Nt?Nt(null):{}}function Mu(e){return this.has(e)&&delete this.__data__[e]}function Nu(e){var t=this.__data__;if(Nt){var n=t[e];return n===ai?void 0:n}return yn.call(t,e)?t[e]:void 0}function Fu(e){var t=this.__data__;return Nt?t[e]!==void 0:yn.call(t,e)}function ju(e,t){var n=this.__data__;return n[e]=Nt&&t===void 0?ai:t,this}ot.prototype.clear=Du;ot.prototype.delete=Mu;ot.prototype.get=Nu;ot.prototype.has=Fu;ot.prototype.set=ju;function bt(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function $u(){this.__data__=[]}function Lu(e){var t=this.__data__,n=Cn(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():Eu.call(t,n,1),!0}function Uu(e){var t=this.__data__,n=Cn(t,e);return n<0?void 0:t[n][1]}function Vu(e){return Cn(this.__data__,e)>-1}function ku(e,t){var n=this.__data__,r=Cn(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}bt.prototype.clear=$u;bt.prototype.delete=Lu;bt.prototype.get=Uu;bt.prototype.has=Vu;bt.prototype.set=ku;function lt(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Wu(){this.__data__={hash:new ot,map:new(Pu||bt),string:new ot}}function zu(e){return Sn(this,e).delete(e)}function Au(e){return Sn(this,e).get(e)}function Hu(e){return Sn(this,e).has(e)}function qu(e,t){return Sn(this,e).set(e,t),this}lt.prototype.clear=Wu;lt.prototype.delete=zu;lt.prototype.get=Au;lt.prototype.has=Hu;lt.prototype.set=qu;function Bu(e,t,n){var r=e[t];(!(yn.call(e,t)&&fi(r,n))||n===void 0&&!(t in e))&&(e[t]=n)}function Cn(e,t){for(var n=e.length;n--;)if(fi(e[n][0],t))return n;return-1}function Gu(e){if(!tn(e)||ed(e))return!1;var t=od(e)||wu(e)?Ou:Su;return t.test(rd(e))}function Xu(e,t,n,r){if(!tn(e))return e;t=Ju(t,e)?[t]:Ku(t);for(var o=-1,i=t.length,a=i-1,c=e;c!=null&&++o<i;){var l=nd(t[o]),u=n;if(o!=a){var d=c[l];u=r?r(d,l,c):void 0,u===void 0&&(u=tn(d)?d:Zu(t[o+1])?[]:{})}Bu(c,l,u),c=c[l]}return e}function Yu(e){if(typeof e=="string")return e;if(Tr(e))return Yr?Yr.call(e):"";var t=e+"";return t=="0"&&1/e==-si?"-0":t}function Ku(e){return pi(e)?e:td(e)}function Sn(e,t){var n=e.__data__;return Qu(t)?n[typeof t=="string"?"string":"hash"]:n.map}function di(e,t){var n=_u(e,t);return Gu(n)?n:void 0}function Zu(e,t){return t=t==null?uu:t,!!t&&(typeof e=="number"||bu.test(e))&&e>-1&&e%1==0&&e<t}function Ju(e,t){if(pi(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Tr(e)?!0:gu.test(e)||!hu.test(e)||t!=null&&e in Object(t)}function Qu(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function ed(e){return!!Br&&Br in e}var td=br(function(e){e=ad(e);var t=[];return mu.test(e)&&t.push(""),e.replace(vu,function(n,r,o,i){t.push(o?i.replace(Cu,"$1"):r||n)}),t});function nd(e){if(typeof e=="string"||Tr(e))return e;var t=e+"";return t=="0"&&1/e==-si?"-0":t}function rd(e){if(e!=null){try{return ci.call(e)}catch{}try{return e+""}catch{}}return""}function br(e,t){if(typeof e!="function"||t&&typeof t!="function")throw new TypeError(cu);var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var a=e.apply(this,r);return n.cache=i.set(o,a),a};return n.cache=new(br.Cache||lt),n}br.Cache=lt;function fi(e,t){return e===t||e!==e&&t!==t}var pi=Array.isArray;function od(e){var t=tn(e)?ui.call(e):"";return t==du||t==fu}function tn(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function id(e){return!!e&&typeof e=="object"}function Tr(e){return typeof e=="symbol"||id(e)&&ui.call(e)==pu}function ad(e){return e==null?"":Yu(e)}function sd(e,t,n){return e==null?e:Xu(e,t,n)}var ld=sd;const cd=Yn(ld);var ud="Expected a function",hi="__lodash_hash_undefined__",gi=1/0,dd="[object Function]",fd="[object GeneratorFunction]",pd="[object Symbol]",hd=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,gd=/^\w*$/,md=/^\./,vd=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,yd=/[\\^$.*+?()[\]{}|]/g,Cd=/\\(\\)?/g,Sd=/^\[object .+?Constructor\]$/,bd=typeof He=="object"&&He&&He.Object===Object&&He,Td=typeof self=="object"&&self&&self.Object===Object&&self,Rr=bd||Td||Function("return this")();function Rd(e,t){return e==null?void 0:e[t]}function _d(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch{}return t}var wd=Array.prototype,Id=Function.prototype,mi=Object.prototype,Fn=Rr["__core-js_shared__"],Kr=function(){var e=/[^.]+$/.exec(Fn&&Fn.keys&&Fn.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),vi=Id.toString,_r=mi.hasOwnProperty,yi=mi.toString,xd=RegExp("^"+vi.call(_r).replace(yd,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Zr=Rr.Symbol,Od=wd.splice,Ed=Ci(Rr,"Map"),Ft=Ci(Object,"create"),Jr=Zr?Zr.prototype:void 0,Qr=Jr?Jr.toString:void 0;function it(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Pd(){this.__data__=Ft?Ft(null):{}}function Dd(e){return this.has(e)&&delete this.__data__[e]}function Md(e){var t=this.__data__;if(Ft){var n=t[e];return n===hi?void 0:n}return _r.call(t,e)?t[e]:void 0}function Nd(e){var t=this.__data__;return Ft?t[e]!==void 0:_r.call(t,e)}function Fd(e,t){var n=this.__data__;return n[e]=Ft&&t===void 0?hi:t,this}it.prototype.clear=Pd;it.prototype.delete=Dd;it.prototype.get=Md;it.prototype.has=Nd;it.prototype.set=Fd;function Tt(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function jd(){this.__data__=[]}function $d(e){var t=this.__data__,n=bn(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():Od.call(t,n,1),!0}function Ld(e){var t=this.__data__,n=bn(t,e);return n<0?void 0:t[n][1]}function Ud(e){return bn(this.__data__,e)>-1}function Vd(e,t){var n=this.__data__,r=bn(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}Tt.prototype.clear=jd;Tt.prototype.delete=$d;Tt.prototype.get=Ld;Tt.prototype.has=Ud;Tt.prototype.set=Vd;function ct(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function kd(){this.__data__={hash:new it,map:new(Ed||Tt),string:new it}}function Wd(e){return Tn(this,e).delete(e)}function zd(e){return Tn(this,e).get(e)}function Ad(e){return Tn(this,e).has(e)}function Hd(e,t){return Tn(this,e).set(e,t),this}ct.prototype.clear=kd;ct.prototype.delete=Wd;ct.prototype.get=zd;ct.prototype.has=Ad;ct.prototype.set=Hd;function bn(e,t){for(var n=e.length;n--;)if(tf(e[n][0],t))return n;return-1}function qd(e,t){t=Yd(t,e)?[t]:Xd(t);for(var n=0,r=t.length;e!=null&&n<r;)e=e[Qd(t[n++])];return n&&n==r?e:void 0}function Bd(e){if(!bi(e)||Zd(e))return!1;var t=nf(e)||_d(e)?xd:Sd;return t.test(ef(e))}function Gd(e){if(typeof e=="string")return e;if(Ir(e))return Qr?Qr.call(e):"";var t=e+"";return t=="0"&&1/e==-gi?"-0":t}function Xd(e){return Si(e)?e:Jd(e)}function Tn(e,t){var n=e.__data__;return Kd(t)?n[typeof t=="string"?"string":"hash"]:n.map}function Ci(e,t){var n=Rd(e,t);return Bd(n)?n:void 0}function Yd(e,t){if(Si(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Ir(e)?!0:gd.test(e)||!hd.test(e)||t!=null&&e in Object(t)}function Kd(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Zd(e){return!!Kr&&Kr in e}var Jd=wr(function(e){e=of(e);var t=[];return md.test(e)&&t.push(""),e.replace(vd,function(n,r,o,i){t.push(o?i.replace(Cd,"$1"):r||n)}),t});function Qd(e){if(typeof e=="string"||Ir(e))return e;var t=e+"";return t=="0"&&1/e==-gi?"-0":t}function ef(e){if(e!=null){try{return vi.call(e)}catch{}try{return e+""}catch{}}return""}function wr(e,t){if(typeof e!="function"||t&&typeof t!="function")throw new TypeError(ud);var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var a=e.apply(this,r);return n.cache=i.set(o,a),a};return n.cache=new(wr.Cache||ct),n}wr.Cache=ct;function tf(e,t){return e===t||e!==e&&t!==t}var Si=Array.isArray;function nf(e){var t=bi(e)?yi.call(e):"";return t==dd||t==fd}function bi(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function rf(e){return!!e&&typeof e=="object"}function Ir(e){return typeof e=="symbol"||rf(e)&&yi.call(e)==pd}function of(e){return e==null?"":Gd(e)}function af(e,t,n){var r=e==null?void 0:qd(e,t);return r===void 0?n:r}var sf=af;const lf=Yn(sf),Ti=(e,t)=>(s.iconMap[e]||[])[Number(t)]||"",cf=e=>{const t=te.useDependency(g.IUniverInstanceService),n=t.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getUnitId(),r=t.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getActiveSheet().getSheetId(),o=I.useMemo(()=>e.error?N.errorInput:"",[e.error]);return h.jsx("div",{className:N.positionRelative,children:e.type!==s.CFValueType.formula?h.jsxs(h.Fragment,{children:[h.jsx(B.InputNumber,{className:o,value:Number(e.value)||0,onChange:i=>e.onChange(i!=null?i:0)}),e.error&&h.jsx("div",{className:N.errorText,children:e.error})]}):h.jsx(Re.TextEditor,{id:g.createInternalEditorID(`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_icon_set_${e.id}`),value:String(e.value).startsWith("=")?String(e.value):"=",openForSheetSubUnitId:r,openForSheetUnitId:n,canvasStyle:{fontSize:10},onlyInputFormula:!0,onChange:(i="")=>{const a=i||"";e.onChange(a)}})})},eo=(e,t,n)=>({operator:s.CFNumberOperator.greaterThan,value:{type:s.CFValueType.num,value:(n.length-1-t)*10},iconType:e,iconId:String(t)}),uf=e=>{const t=te.useDependency(g.LocaleService),n=r=>{e.onClick(r)};return h.jsx("div",{className:N.iconGroupList,children:s.iconGroup.map((r,o)=>h.jsxs("div",{className:N.group,children:[h.jsx("div",{className:N.title,children:t.t(r.title)}),h.jsx("div",{className:N.itemContent,children:r.group.map(i=>h.jsx("div",{className:N.itemWrap,onClick:()=>{n(i.name)},children:h.jsx("div",{className:N.item,children:i.list.map((a,c)=>h.jsx("img",{className:N.icon,src:a},c))})},i.name))})]},o))})},df=e=>{const t=I.useMemo(()=>{const r=[];for(const o in s.iconMap){const i=s.iconMap[o],a=o;i.forEach((c,l)=>{r.push({iconType:a,base64:c,iconId:String(l)})})}return r},[]),n=r=>{e.onClick(r.iconType,r.iconId)};return h.jsxs("div",{className:N.iconItemListWrap,children:[h.jsxs("div",{className:N.none,onClick:()=>n({iconType:s.EMPTY_ICON_TYPE,iconId:"",base64:""}),children:[h.jsx(rn,{className:N.icon}),h.jsx("span",{children:"无单元格图标"})]}),h.jsx("div",{className:N.iconItemList,children:t.map(r=>h.jsx("div",{className:N.item,children:h.jsx("img",{onClick:()=>n(r),className:`${N.icon}`,src:r.base64})},`${r.iconType}_${r.iconId}`))})]})},ff=e=>{const{onChange:t,configList:n,errorMap:r={}}=e,o=te.useDependency(g.LocaleService),i=[{label:o.t(`sheet.cf.symbol.${s.CFNumberOperator.greaterThan}`),value:s.CFNumberOperator.greaterThan},{label:o.t(`sheet.cf.symbol.${s.CFNumberOperator.greaterThanOrEqual}`),value:s.CFNumberOperator.greaterThanOrEqual}],a=[{label:o.t(`sheet.cf.valueType.${s.CFValueType.num}`),value:s.CFValueType.num},{label:o.t(`sheet.cf.valueType.${s.CFValueType.percent}`),value:s.CFValueType.percent},{label:o.t(`sheet.cf.valueType.${s.CFValueType.percentile}`),value:s.CFValueType.percentile},{label:o.t(`sheet.cf.valueType.${s.CFValueType.formula}`),value:s.CFValueType.formula}],c=(p,f)=>{t([String(f),"value","value"],p)},l=(p,f)=>{t([String(f),"operator"],p);const v=s.createDefaultValue(s.CFSubRuleType.number,p);c(v,f)},u=(p,f)=>{t([String(f),"value","type"],p)};return I.useMemo(()=>n.map((p,f)=>{const v=r[f],y=Ti(p.iconType,p.iconId),S=f===n.length-1,x=f===0,_=n[f-1],b=(_==null?void 0:_.value.type)===s.CFValueType.formula?o.t("sheet.cf.valueType.formula"):_==null?void 0:_.value.value,C=(T,m)=>{const O={...p,iconId:m,iconType:T};t([String(f)],O)};return h.jsxs("div",{className:`${f?D.mTXl:D.mTSm}`,children:[h.jsxs("div",{className:`${D.label} ${N.flex}`,children:[h.jsxs("div",{className:`${N.width45}`,children:[o.t("sheet.cf.iconSet.icon"),f+1]}),h.jsx("div",{className:`${N.width45}`,children:h.jsxs(h.Fragment,{children:[!x&&!S&&o.t("sheet.cf.iconSet.rule"),!x&&!S&&h.jsxs("span",{className:N.stress,children:["(",o.t("sheet.cf.iconSet.when"),o.t(`sheet.cf.symbol.${s.getOppositeOperator(_.operator)}`),b,S?"":` ${o.t("sheet.cf.iconSet.and")} `,")"]})]})})]}),h.jsxs("div",{className:`${N.flex} ${D.mTSm}`,children:[h.jsx("div",{className:`${N.iconWrap} ${N.width45}`,children:h.jsx(B.Dropdown,{overlay:h.jsx(df,{onClick:C,iconId:p.iconId,iconType:p.iconType}),children:h.jsxs("div",{className:N.dropdownIcon,children:[y?h.jsx("img",{src:y,className:N.icon}):h.jsx(rn,{className:N.icon}),h.jsx(Kn,{})]})})}),S?h.jsxs("div",{className:`${N.width45} ${D.label}`,style:{marginTop:0},children:[o.t("sheet.cf.iconSet.rule"),h.jsxs("span",{className:N.stress,children:["(",o.t("sheet.cf.iconSet.when"),o.t(`sheet.cf.symbol.${s.getOppositeOperator(_.operator)}`),b,S?"":` ${o.t("sheet.cf.iconSet.and")} `,")"]})]}):h.jsx(B.Select,{className:`${D.mL0} ${N.width45} ${D.mR0}`,options:i,value:p.operator,onChange:T=>{l(T,f)}})]}),S?h.jsx("div",{}):h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:`${D.mTSm} ${D.label} ${N.flex}`,children:[h.jsx("div",{className:`${N.width45}`,children:o.t("sheet.cf.iconSet.type")}),h.jsx("div",{className:`${N.width45}`,children:o.t("sheet.cf.iconSet.value")})]}),h.jsxs("div",{className:`${D.mTSm} ${N.flex}`,children:[h.jsx(B.Select,{className:`${N.width45} ${D.mL0}`,options:a,value:p.value.type,onChange:T=>{u(T,f)}}),h.jsx("div",{className:`${D.mL0} ${N.width45}`,children:h.jsx(cf,{id:f,type:p.value.type,error:v,value:p.value.value||"",onChange:T=>c(T,f)})})]})]})]},f)}),[n,r])},pf=e=>{var _;const{interceptorManager:t}=e,n=((_=e.rule)==null?void 0:_.type)===s.CFRuleType.iconSet?e.rule:void 0,r=te.useDependency(g.LocaleService),[o,i]=I.useState({}),[a,c]=I.useState(()=>{const b=Object.keys(s.iconMap)[0];if(n&&n.config.length){const C=n.config[0].iconType;if(!n.config.some(m=>m.iconType!==C))return C}return b}),[l,u]=I.useState(()=>{if(n&&n.config.length)return g.Tools.deepClone(n==null?void 0:n.config);const b=s.iconMap[a]||[];return new Array(b.length).fill("").map((C,T,m)=>T===m.length-1?{operator:s.CFNumberOperator.lessThanOrEqual,value:{type:s.CFValueType.num,value:Number.MAX_SAFE_INTEGER},iconType:a,iconId:String(T)}:eo(a,T,m))}),[d,p]=I.useState(()=>n?!!n.isShowValue:!0),f=I.useMemo(()=>{const b=l.map(C=>Ti(C.iconType,C.iconId));return h.jsx("div",{className:N.iconWrap,children:b.map((C,T)=>C?h.jsx("img",{className:N.icon,src:C},T):h.jsx(rn,{className:N.icon},T))})},[l]),v=b=>{if(b.reduce((T,m,O)=>T.preType&&!T.result||b.length-1===O?T:m.value.type===s.CFValueType.formula?{preType:s.CFValueType.formula,result:!1}:T.preType?{result:T.preType===m.value.type,preType:m.value.type}:{result:!0,preType:m.value.type},{result:!0,preType:""}).result&&[s.CFValueType.num,s.CFValueType.percent,s.CFValueType.percentile].includes(b[0].value.type)){const T={};return b.forEach((m,O,E)=>{if(O-1<0||O===E.length-1)return;const F=b[O-1],j=s.getOppositeOperator(F.operator);s.compareWithNumber({operator:j,value:F.value.value},m.value.value)||(T[O]=`${r.t(`sheet.cf.form.${j}`,String(F.value.value))} `)}),T}return{}},y=(b,C)=>{lf(l,b)!==C&&(cd(l,b,C),u([...l]),i(v(l)))},S=b=>{c(b);const C=s.iconMap[b]||[],T=new Array(C.length).fill("").map((m,O,E)=>eo(b,O,E));u(T),i(v(T))};I.useEffect(()=>{const b=t.intercept(t.getInterceptPoints().submit,{handler(){return{type:s.CFRuleType.iconSet,isShowValue:d,config:l}}});return()=>{b()}},[d,l,t]),I.useEffect(()=>{const b=t.intercept(t.getInterceptPoints().beforeSubmit,{handler(){return Object.keys(o).length===0}});return()=>{b()}},[d,l,t,o]);const x=()=>{const b=l.map(C=>({...C}));l.forEach((C,T)=>{const m=l.length-1-T,O=b[m];C.iconId=O.iconId,C.iconType=O.iconType}),u([...l])};return h.jsxs("div",{className:N.iconSet,children:[h.jsx("div",{className:D.title,children:r.t("sheet.cf.panel.styleRule")}),h.jsx("div",{className:`${D.mTSm}`,children:h.jsx(B.Dropdown,{overlay:h.jsx(uf,{iconType:a,onClick:S}),children:h.jsxs("div",{className:N.dropdownIcon,style:{width:"unset"},children:[f,h.jsx(Kn,{})]})})}),h.jsxs("div",{className:`${D.mTSm} ${N.renderConfig}`,children:[h.jsxs("div",{className:N.utilItem,children:[h.jsx(B.Checkbox,{onChange:x}),r.t("sheet.cf.iconSet.reverseIconOrder")]}),h.jsxs("div",{className:`${N.utilItem} ${D.mLXl}`,children:[h.jsx(B.Checkbox,{checked:!d,onChange:b=>{p(!b)}}),r.t("sheet.cf.iconSet.onlyShowIcon")]})]}),h.jsx(ff,{errorMap:o,onChange:y,configList:l})]})},to=e=>e.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getUnitId(),no=e=>e.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getActiveSheet().getSheetId(),hf=e=>{var T,m,O,E;const t=te.useDependency(g.LocaleService),n=te.useDependency(g.ICommandService),r=te.useDependency(g.IUniverInstanceService),o=te.useDependency(s.ConditionalFormattingRuleModel),i=te.useDependency($.SelectionManagerService),a=to(r),c=no(r),l=I.useRef((m=(T=e.rule)==null?void 0:T.ranges)!=null?m:[]),u=I.useMemo(()=>{var F,j;let w=(F=e.rule)==null?void 0:F.ranges;return w!=null&&w.length||(w=(j=i.getSelectionRanges())!=null?j:[]),l.current=w,w!=null&&w.length?w.map(L=>{const q=ao.serializeRange(L);return q==="NaN"?"":q}).filter(L=>!!L).join(","):""},[e.rule]),d=[{label:t.t("sheet.cf.ruleType.highlightCell"),value:"1"},{label:t.t("sheet.cf.panel.rankAndAverage"),value:"2"},{label:t.t("sheet.cf.ruleType.dataBar"),value:"3"},{label:t.t("sheet.cf.ruleType.colorScale"),value:"4"},{label:t.t("sheet.cf.ruleType.formula"),value:"5"},{label:t.t("sheet.cf.ruleType.iconSet"),value:"6"}],[p,f]=I.useState(()=>{var j,L;const w=(j=e.rule)==null?void 0:j.rule.type,F=d[0].value;if(!w)return F;switch(w){case s.CFRuleType.highlightCell:{switch((L=e.rule)==null?void 0:L.rule.subType){case s.CFSubRuleType.number:case s.CFSubRuleType.text:case s.CFSubRuleType.duplicateValues:case s.CFSubRuleType.uniqueValues:case s.CFSubRuleType.timePeriod:return"1";case s.CFSubRuleType.average:case s.CFSubRuleType.rank:return"2";case s.CFSubRuleType.formula:return"5"}break}case s.CFRuleType.dataBar:return"3";case s.CFRuleType.colorScale:return"4";case s.CFRuleType.iconSet:return"6"}return F}),v=I.useRef(),y=I.useMemo(()=>new g.InterceptorManager({beforeSubmit:_c,submit:wc}),[]),S=I.useMemo(()=>{switch(p){case"1":return qr;case"2":return au;case"3":return nu;case"4":return tu;case"5":return lu;case"6":return pf;default:return qr}},[p]);I.useEffect(()=>{var w;if(((w=e.rule)==null?void 0:w.cfId)!==void 0){const F=n.onCommandExecuted(j=>{if(j.id===$.RemoveSheetMutation.id){const L=j.params;L.subUnitId===c&&L.unitId===a&&e.onCancel()}j.id===$.SetWorksheetActiveOperation.id&&e.onCancel()});return()=>F.dispose()}},[(O=e.rule)==null?void 0:O.cfId]);const x=w=>{v.current=w},_=w=>{l.current=w.map(F=>F.range)},b=()=>{const w=y.fetchThroughInterceptors(y.getInterceptPoints().beforeSubmit)(!0,null),F=()=>{const j=r.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getActiveSheet();return l.current.map(R=>$.setEndForRange(R,j.getRowCount(),j.getColumnCount())).filter(R=>!(Number.isNaN(R.startRow)||Number.isNaN(R.startColumn)))};if(w){const j=y.fetchThroughInterceptors(y.getInterceptPoints().submit)(null,null),L=F();if(j&&L.length){const q=to(r),R=no(r);let P={};e.rule&&e.rule.cfId?(P={...e.rule,ranges:L,rule:j},n.executeCommand(ii.id,{unitId:q,subUnitId:R,rule:P}),e.onCancel()):(P={cfId:o.createCfId(q,R),ranges:L,rule:j,stopIfTrue:!1},n.executeCommand(vn.id,{unitId:q,subUnitId:R,rule:P}),e.onCancel())}}},C=()=>{e.onCancel()};return h.jsxs("div",{className:N.cfRuleStyleEditor,children:[h.jsx("div",{className:D.title,children:t.t("sheet.cf.panel.range")}),h.jsx("div",{className:`${D.mTBase}`,children:h.jsx(Re.RangeSelector,{placeholder:t.t("sheet.cf.form.rangeSelector"),width:"100%",openForSheetSubUnitId:c,openForSheetUnitId:a,value:u,id:g.createInternalEditorID(`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_rangeSelector`),onChange:_})}),h.jsx("div",{className:D.title,children:t.t("sheet.cf.panel.styleType")}),h.jsx("div",{className:D.mTBase,children:h.jsx(B.Select,{className:N.width100,value:p,options:d,onChange:w=>f(w)})}),h.jsx(S,{interceptorManager:y,rule:(E=e.rule)==null?void 0:E.rule,onChange:x}),h.jsxs("div",{className:`${D.mTBase} ${N.btnList}`,children:[h.jsx(B.Button,{size:"small",onClick:C,children:t.t("sheet.cf.panel.cancel")}),h.jsx(B.Button,{className:D.mLSm,size:"small",type:"primary",onClick:b,children:t.t("sheet.cf.panel.submit")})]})]})},gf=e=>{const[t,n]=I.useState(e.rule),[r,o]=I.useState(!!e.rule),i=()=>{o(!0)},a=()=>{o(!1),n(void 0)},c=l=>{n(l),o(!0)};return h.jsx("div",{className:D.conditionalFormattingWrap,children:r?h.jsx(hf,{onCancel:a,rule:t}):h.jsx(Rc,{onClick:c,onCreate:i})})};var mf=Object.defineProperty,vf=Object.getOwnPropertyDescriptor,yf=(e,t,n,r)=>{for(var o=r>1?void 0:r?vf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&mf(t,n,o),o},ht=(e,t)=>(n,r)=>t(n,r,e);const Cf={},ro="sheet.conditional.formatting.panel";let vt=class extends g.Disposable{constructor(t,n,r,o,i,a,c){super();Be(this,"_sidebarDisposable",null);this._config=t,this._univerInstanceService=n,this._injector=r,this._componentManager=o,this._menuService=i,this._sidebarService=a,this._localeService=c,this._initMenu(),this._initPanel(),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(g.UniverInstanceType.UNIVER_SHEET).subscribe(l=>{var u;l||(u=this._sidebarDisposable)==null||u.dispose()}))}openPanel(t){const n={header:{title:this._localeService.t("sheet.cf.title")},children:{label:ro,rule:t},onClose:()=>this._sidebarDisposable=null};this._sidebarDisposable=this._sidebarService.open(n)}_initMenu(){const{menu:t={}}=this._config;this._menuService.addMenuItem($i(this._injector),t)}_initPanel(){this._componentManager.register(ro,gf)}};vt=yf([g.OnLifecycle(g.LifecycleStages.Ready,vt),ht(1,g.IUniverInstanceService),ht(2,V.Inject(V.Injector)),ht(3,V.Inject(Re.ComponentManager)),ht(4,V.Inject(Re.IMenuService)),ht(5,V.Inject(Re.ISidebarService)),ht(6,V.Inject(g.LocaleService))],vt);var we=(e=>(e[e.createRule=1]="createRule",e[e.viewRule=2]="viewRule",e[e.highlightCell=3]="highlightCell",e[e.rank=4]="rank",e[e.formula=5]="formula",e[e.colorScale=6]="colorScale",e[e.dataBar=7]="dataBar",e[e.icon=8]="icon",e[e.clearRangeRules=9]="clearRangeRules",e[e.clearWorkSheetRules=10]="clearWorkSheetRules",e))(we||{});const Ri={id:"sheet.operation.open.conditional.formatting.panel",type:g.CommandType.OPERATION,handler:(e,t)=>{const n=e.get(vt),r=e.get($.SelectionManagerService),o=e.get(g.ICommandService),i=r.getSelectionRanges()||[];switch(t.value){case 3:{n.openPanel({...s.createDefaultRule(),ranges:i});break}case 4:{const c={...s.createDefaultRule,ranges:i,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.rank}};n.openPanel(c);break}case 5:{const c={...s.createDefaultRule,ranges:i,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.formula,value:"="}};n.openPanel(c);break}case 6:{const c={...s.createDefaultRule,ranges:i,rule:{type:s.CFRuleType.colorScale,config:[]}};n.openPanel(c);break}case 7:{const c={...s.createDefaultRule,ranges:i,rule:{type:s.CFRuleType.dataBar,isShowValue:!0}};n.openPanel(c);break}case 8:{const c={...s.createDefaultRule,ranges:i,rule:{type:s.CFRuleType.iconSet,config:[],isShowValue:!0}};n.openPanel(c);break}case 2:{n.openPanel();break}case 1:{n.openPanel({...s.createDefaultRule(),ranges:i});break}case 9:{o.executeCommand(lo.id,{ranges:i});break}case 10:{o.executeCommand(Xn.id);break}}return!0}};var Sf=Object.defineProperty,bf=Object.getOwnPropertyDescriptor,Tf=(e,t,n,r)=>{for(var o=r>1?void 0:r?bf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&Sf(t,n,o),o},Me=(e,t)=>(n,r)=>t(n,r,e);let qt=class extends g.Disposable{constructor(e,t,n,r,o,i,a,c,l,u,d){super(),this._sheetInterceptorService=e,this._conditionalFormattingService=t,this._univerInstanceService=n,this._renderManagerService=r,this._conditionalFormattingViewModel=o,this._conditionalFormattingRuleModel=i,this._sheetSkeletonManagerService=a,this._selectionProtectionRenderModel=c,this._rangeProtectionRuleModel=l,this._worksheetProtectionRuleModel=u,this._permissionService=d,this._initViewModelInterceptor(),this._initSkeleton()}_initSkeleton(){const e=()=>{var n,r;this._sheetSkeletonManagerService.reCalculate();const t=this._univerInstanceService.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getUnitId();(r=(n=this._renderManagerService.getRenderById(t))==null?void 0:n.mainComponent)==null||r.makeDirty()};this.disposeWithMe(this._conditionalFormattingViewModel.markDirty$.pipe(Fe.bufferTime(16),Fe.filter(t=>{const n=this._univerInstanceService.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();return t.filter(o=>o.unitId===n.getUnitId()&&o.subUnitId===r.getSheetId()).length>0})).subscribe(e)),this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.pipe(Fe.bufferTime(16),Fe.filter(t=>{const n=this._univerInstanceService.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();return t.filter(o=>["sort","delete"].includes(o.type)&&o.unitId===n.getUnitId()&&o.subUnitId===r.getSheetId()).length>0})).subscribe(e)),this.disposeWithMe(this._conditionalFormattingService.ruleComputeStatus$.pipe(Fe.bufferTime(16),Fe.filter(t=>{const n=this._univerInstanceService.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();return t.filter(o=>o.unitId===n.getUnitId()&&o.subUnitId===r.getSheetId()).length>0})).subscribe(e))}_initViewModelInterceptor(){this.disposeWithMe(this._sheetInterceptorService.intercept($.INTERCEPTOR_POINT.CELL_CONTENT,{handler:(e,t,n)=>{const r=this._conditionalFormattingService.composeStyle(t.unitId,t.subUnitId,t.row,t.col);if(!r)return n(e);const o=t.workbook.getStyles(),a={...(typeof(e==null?void 0:e.s)=="string"?o.get(e==null?void 0:e.s):e==null?void 0:e.s)||{}},c={...e,s:a};return r.style&&Object.assign(a,r.style),c.fontRenderExtension||(c.fontRenderExtension={},r.isShowValue!==void 0&&(c.fontRenderExtension.isSkip=!r.isShowValue)),r.dataBar&&(c.dataBar=r.dataBar),r.iconSet&&(c.iconSet=r.iconSet,c.fontRenderExtension.leftOffset=s.DEFAULT_PADDING+s.DEFAULT_WIDTH),n(c)},priority:10}))}_initViewModelByRangeInterceptor(){this.disposeWithMe(this._sheetInterceptorService.intercept($.INTERCEPTOR_POINT.CELL_CONTENT,{handler:(e={},t,n)=>{const{unitId:r,subUnitId:o,row:i,col:a}=t,c=this._selectionProtectionRenderModel.getCellInfo(r,o,i,a).filter(l=>!!l.ruleId).map(l=>{const u=this._rangeProtectionRuleModel.getRule(r,o,l.ruleId)||{};return{...l,ranges:u.ranges}}).filter(l=>!!l.ranges);if(c.length){const l=c.some(f=>!(f!=null&&f[Ae.View])),u={...e,selectionProtection:c},{dataBar:d,iconSet:p}=u;return l&&(d&&(d.isSkip=!0),p&&(p.isSkip=!0)),n(u)}return n(e)}}))}_initViewModelBySheetInterceptor(){this.disposeWithMe(this._sheetInterceptorService.intercept($.INTERCEPTOR_POINT.CELL_CONTENT,{handler:(e={},t,n)=>{var a,c,l,u,d;const{unitId:r,subUnitId:o}=t,i=this._worksheetProtectionRuleModel.getRule(r,o);if(i!=null&&i.permissionId&&i.name){const p=[{[Ae.View]:(c=(a=this._permissionService.getPermissionPoint(new $.WorksheetViewPermission(r,o).id))==null?void 0:a.value)!=null?c:!1,[Ae.Edit]:(u=(l=this._permissionService.getPermissionPoint(new $.WorksheetEditPermission(r,o).id))==null?void 0:l.value)!=null?u:!1}],f=!((d=p[0])!=null&&d[Ae.View]),v={...e,hasWorksheetRule:!0,selectionProtection:p},{dataBar:y,iconSet:S}=v;return f&&(y&&(y.isSkip=!0),S&&(S.isSkip=!0)),n(v)}return n(e)}}))}};qt=Tf([g.OnLifecycle(g.LifecycleStages.Rendered,qt),Me(0,V.Inject($.SheetInterceptorService)),Me(1,V.Inject(s.ConditionalFormattingService)),Me(2,V.Inject(g.IUniverInstanceService)),Me(3,V.Inject(Ii.IRenderManagerService)),Me(4,V.Inject(s.ConditionalFormattingViewModel)),Me(5,V.Inject(s.ConditionalFormattingRuleModel)),Me(6,V.Inject(le.SheetSkeletonManagerService)),Me(7,V.Inject($.RangeProtectionRenderModel)),Me(8,V.Inject($.RangeProtectionRuleModel)),Me(9,V.Inject($.WorksheetProtectionRuleModel)),Me(10,g.IPermissionService)],qt);var Rf=Object.defineProperty,_f=Object.getOwnPropertyDescriptor,wf=(e,t,n,r)=>{for(var o=r>1?void 0:r?_f(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&Rf(t,n,o),o},wt=(e,t)=>(n,r)=>t(n,r,e);let Bt=class extends g.Disposable{constructor(t,n,r,o,i){super();Be(this,"_copyInfo");this._sheetClipboardService=t,this._conditionalFormattingRuleModel=n,this._injector=r,this._conditionalFormattingViewModel=o,this._univerInstanceService=i,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:s.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onBeforeCopy:(t,n,r)=>this._collectConditionalRule(t,n,r),onPasteCells:(t,n,r,o)=>{const{copyType:i=le.COPY_TYPE.COPY,pasteType:a}=o,{range:c}=t||{},{range:l}=n;return this._generateConditionalFormattingMutations(l,{copyType:i,pasteType:a,copyRange:c})}}))}_collectConditionalRule(t,n,r){const o=new g.ObjectMatrix,i={};this._copyInfo={matrix:o,info:{unitId:t,subUnitId:n,cfMap:i}};const a=this._conditionalFormattingViewModel.getMatrix(t,n);if(!a)return;const c={get:this._injector.get.bind(this._injector)},l=le.rangeToDiscreteRange(r,c,t,n);if(!l)return;const{rows:u,cols:d}=l,p=new Set;u.forEach((f,v)=>{d.forEach((y,S)=>{const x=this._conditionalFormattingViewModel.getCellCf(t,n,f,y,a);x&&(x.cfList.forEach(_=>p.add(_.cfId)),o.setValue(v,S,x.cfList.map(_=>_.cfId)))})}),p.forEach(f=>{const v=this._conditionalFormattingRuleModel.getRule(t,n,f);v&&(i[f]=v.rule)})}_generateConditionalFormattingMutations(t,n){const r=this._univerInstanceService.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET),o=r.getActiveSheet(),i=r.getUnitId(),a=o.getSheetId();if(n.copyType===le.COPY_TYPE.CUT)return this._copyInfo=null,{redos:[],undos:[]};if(!this._copyInfo||!n.copyRange)return{redos:[],undos:[]};if(![le.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT,le.PREDEFINED_HOOK_NAME.DEFAULT_PASTE,le.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_BESIDES_BORDER].includes(n.pasteType))return{redos:[],undos:[]};const{ranges:[c,l],mapFunc:u}=le.virtualizeDiscreteRanges([n.copyRange,t]),d=le.getRepeatRange(c,l,!0),p=this._conditionalFormattingViewModel.getMatrix(i,a),f={};g.Range.foreach(l,(m,O)=>{const{row:E,col:w}=u(m,O),F=this._conditionalFormattingViewModel.getCellCf(i,a,E,w,p);F&&F.cfList.forEach(j=>{if(!f[j.cfId]){const L=new g.ObjectMatrix;f[j.cfId]=L;const q=this._conditionalFormattingRuleModel.getRule(i,a,j.cfId);q==null||q.ranges.forEach(R=>{g.Range.foreach(R,(P,J)=>{L.setValue(P,J,1)})})}f[j.cfId].realDeleteValue(E,w)})});const{matrix:v,info:y}=this._copyInfo,S=[];let x=this._conditionalFormattingRuleModel.createCfId(i,a);const _={},b=m=>{if(_[m])return _[m];const O=y==null?void 0:y.cfMap[m],E=[...this._conditionalFormattingRuleModel.getSubunitRules(i,a)||[],...S].find(w=>g.Tools.diffValue(w.rule,O));if(E)return _[m]=E,E;{const w={rule:O,cfId:x,ranges:[],stopIfTrue:!1};return _[m]=w,S.push(w),x=`${Number(x)+1}`,w}};d.forEach(m=>{v&&v.forValue((O,E,w)=>{const F=g.Rectangle.getPositionRange({startRow:O,endRow:O,startColumn:E,endColumn:E},m.startRange),{row:j,col:L}=u(F.startRow,F.startColumn);w.forEach(q=>{if(!f[q]){const R=b(q),P=new g.ObjectMatrix;f[q]=P,R.ranges.forEach(J=>{g.Range.foreach(J,(Se,he)=>{P.setValue(Se,he,1)})})}f[q].setValue(j,L,1)})})});const C=[],T=[];for(const m in f){const O=f[m],E=$.findAllRectangle($.createTopMatrixFromMatrix(O));if(!E.length){const w={unitId:i,subUnitId:a,cfId:m};C.push({id:s.DeleteConditionalRuleMutation.id,params:w}),T.push(...s.DeleteConditionalRuleMutationUndoFactory(this._injector,w))}if(S.some(w=>w.cfId===m)){const w=b(m),F={unitId:i,subUnitId:a,rule:{...w,ranges:E}};C.push({id:s.AddConditionalRuleMutation.id,params:F}),T.push(s.AddConditionalRuleMutationUndoFactory(this._injector,F))}else{const w=this._conditionalFormattingRuleModel.getRule(i,a,m);if(!w)continue;const F={unitId:i,subUnitId:a,rule:{...w,ranges:E}};C.push({id:s.SetConditionalRuleMutation.id,params:F}),T.push(...s.setConditionalRuleMutationUndoFactory(this._injector,F))}}return{redos:C,undos:T}}};Bt=wf([g.OnLifecycle(g.LifecycleStages.Rendered,Bt),wt(0,V.Inject(le.ISheetClipboardService)),wt(1,V.Inject(s.ConditionalFormattingRuleModel)),wt(2,V.Inject(V.Injector)),wt(3,V.Inject(s.ConditionalFormattingViewModel)),wt(4,V.Inject(g.IUniverInstanceService))],Bt);var If=Object.defineProperty,xf=Object.getOwnPropertyDescriptor,Of=(e,t,n,r)=>{for(var o=r>1?void 0:r?xf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&If(t,n,o),o},It=(e,t)=>(n,r)=>t(n,r,e);let Gt=class extends g.Disposable{constructor(e,t,n,r,o){super(),this._injector=e,this._univerInstanceService=t,this._autoFillService=n,this._conditionalFormattingRuleModel=r,this._conditionalFormattingViewModel=o,this._initAutoFill()}_initAutoFill(){const e=()=>({redos:[],undos:[]}),t=(o,i,a,c,l)=>{const u=this._univerInstanceService.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getUnitId(),d=this._univerInstanceService.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET).getActiveSheet().getSheetId(),p={startRow:o.row,startColumn:o.col,endColumn:o.col,endRow:o.row},f={startRow:i.row,startColumn:i.col,endColumn:i.col,endRow:i.row};g.Range.foreach(a,(v,y)=>{const S=g.Rectangle.getPositionRange({startRow:v,startColumn:y,endColumn:y,endRow:v},p),x=g.Rectangle.getPositionRange({startRow:v,startColumn:y,endColumn:y,endRow:v},f),{row:_,col:b}=l(S.startRow,S.startColumn),C=this._conditionalFormattingViewModel.getCellCf(u,d,_,b),{row:T,col:m}=l(x.startRow,x.startColumn),O=this._conditionalFormattingViewModel.getCellCf(u,d,T,m);O&&O.cfList.forEach(E=>{let w=c.get(E.cfId);if(!c.get(E.cfId)){const F=this._conditionalFormattingRuleModel.getRule(u,d,E.cfId);if(!F)return;w=new g.ObjectMatrix,F.ranges.forEach(j=>{g.Range.foreach(j,(L,q)=>{w.setValue(L,q,1)})}),c.set(E.cfId,w)}w.realDeleteValue(T,m)}),C&&C.cfList.forEach(E=>{let w=c.get(E.cfId);if(!c.get(E.cfId)){const F=this._conditionalFormattingRuleModel.getRule(u,d,E.cfId);if(!F)return;w=new g.ObjectMatrix,F.ranges.forEach(j=>{g.Range.foreach(j,(L,q)=>{w.setValue(L,q,1)})}),c.set(E.cfId,w)}w.setValue(T,m,1)})})},n=(o,i)=>{var _,b;const a=(_=this._univerInstanceService.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET))==null?void 0:_.getUnitId(),c=(b=this._univerInstanceService.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET))==null?void 0:b.getActiveSheet().getSheetId(),l=new Map,u=[],d=[];if(!a||!c)return e();const p=le.virtualizeDiscreteRanges([o,i]),[f,v]=p.ranges,{mapFunc:y}=p,S={row:f.startRow,col:f.startColumn};return le.getAutoFillRepeatRange(f,v).forEach(C=>{t(S,C.repeatStartCell,C.relativeRange,l,y)}),l.forEach((C,T)=>{const m=this._conditionalFormattingRuleModel.getRule(a,c,T);if(!m)return;const O=$.findAllRectangle($.createTopMatrixFromMatrix(C)),E={unitId:a,subUnitId:c,rule:{...m,ranges:O}};u.push({id:s.SetConditionalRuleMutation.id,params:E}),d.push(...s.setConditionalRuleMutationUndoFactory(this._injector,E))}),{undos:d,redos:u}},r={id:s.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onFillData:(o,i,a)=>{if(a===le.APPLY_TYPE.COPY||a===le.APPLY_TYPE.ONLY_FORMAT||a===le.APPLY_TYPE.SERIES){const{source:c,target:l}=o;return n(c,l)}return e()}};this.disposeWithMe(this._autoFillService.addHook(r))}};Gt=Of([g.OnLifecycle(g.LifecycleStages.Rendered,Gt),It(0,V.Inject(V.Injector)),It(1,V.Inject(g.IUniverInstanceService)),It(2,V.Inject(le.IAutoFillService)),It(3,V.Inject(s.ConditionalFormattingRuleModel)),It(4,V.Inject(s.ConditionalFormattingViewModel))],Gt);var Ef=Object.defineProperty,Pf=Object.getOwnPropertyDescriptor,Df=(e,t,n,r)=>{for(var o=r>1?void 0:r?Pf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&Ef(t,n,o),o},xt=(e,t)=>(n,r)=>t(n,r,e);let Xt=class extends g.Disposable{constructor(e,t,n,r,o){super(),this._conditionalFormattingRuleModel=e,this._univerInstanceService=t,this._injector=n,this._sheetSkeletonManagerService=r,this._refRangeService=o,this._initRefRange()}_initRefRange(){const e=new Map,t=(r,o,i)=>`${r}_${o}_${i}`,n=(r,o,i)=>{const a=l=>{const u=[...i.ranges],d=u.map(f=>$.handleDefaultRangeChangeWithEffectRefCommands(f,l)).filter(f=>!!f);if(s.isRangesEqual(d,u))return{redos:[],undos:[]};if(d.length){const f={unitId:r,subUnitId:o,rule:{...i,ranges:d}},v=[{id:s.SetConditionalRuleMutation.id,params:f}],y=s.setConditionalRuleMutationUndoFactory(this._injector,f);return{redos:v,undos:y}}else{const f={unitId:r,subUnitId:o,cfId:i.cfId},v=[{id:s.DeleteConditionalRuleMutation.id,params:f}],y=s.DeleteConditionalRuleMutationUndoFactory(this._injector,f);return{redos:v,undos:y}}},c=[];i.ranges.forEach(l=>{const u=this._refRangeService.registerRefRange(l,a);c.push(()=>u.dispose())}),e.set(t(r,o,i.cfId),()=>c.forEach(l=>l()))};this.disposeWithMe(Ie.merge(this._sheetSkeletonManagerService.currentSkeleton$.pipe(Fe.map(r=>r==null?void 0:r.sheetId),Fe.distinctUntilChanged())).pipe(Fe.switchMap(()=>new Ie.Observable(r=>{const o=new g.DisposableCollection;return r.next(o),()=>{o.dispose()}}))).subscribe(r=>{r.add(g.toDisposable(this._conditionalFormattingRuleModel.$ruleChange.subscribe(o=>{const{unitId:i,subUnitId:a,rule:c}=o,l=this._univerInstanceService.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET),u=l.getActiveSheet();if(!(o.unitId!==l.getUnitId()||o.subUnitId!==u.getSheetId()))switch(o.type){case"add":{n(o.unitId,o.subUnitId,o.rule);break}case"delete":{const d=e.get(t(i,a,c.cfId));d&&d();break}case"set":{const d=e.get(t(i,a,c.cfId));d&&d(),n(o.unitId,o.subUnitId,o.rule)}}})))})),this.disposeWithMe(g.toDisposable(()=>{e.forEach(r=>{r()}),e.clear()}))}};Xt=Df([g.OnLifecycle(g.LifecycleStages.Rendered,Xt),xt(0,V.Inject(s.ConditionalFormattingRuleModel)),xt(1,V.Inject(g.IUniverInstanceService)),xt(2,V.Inject(V.Injector)),xt(3,V.Inject(le.SheetSkeletonManagerService)),xt(4,V.Inject($.RefRangeService))],Xt);var Mf=Object.defineProperty,Nf=Object.getOwnPropertyDescriptor,Ff=(e,t,n,r)=>{for(var o=r>1?void 0:r?Nf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&Mf(t,n,o),o},oo=(e,t)=>(n,r)=>t(n,r,e);let Yt=class extends g.Disposable{constructor(e,t){super(),this._editorBridgeService=e,this._conditionalFormattingService=t,this._initInterceptorEditorEnd()}_initInterceptorEditorEnd(){this.disposeWithMe(g.toDisposable(this._editorBridgeService.interceptor.intercept(this._editorBridgeService.interceptor.getInterceptPoints().AFTER_CELL_EDIT,{handler:(e,t,n)=>{const r=this._conditionalFormattingService.composeStyle(t.unitId,t.subUnitId,t.row,t.col);if(r!=null&&r.style&&(e!=null&&e.p)){const o=Object.keys(r==null?void 0:r.style);if(o.length>0){const i=s.getStringFromDataStream(e.p),a={...(typeof e.s=="string"?t.workbook.getStyles().get(e.s):e.s)||{}};o.forEach(l=>{delete a[l]});const c={...e,s:{...a},v:i};return delete c.p,n(c)}}return n(e)}})))}};Yt=Ff([g.OnLifecycle(g.LifecycleStages.Rendered,Yt),oo(0,V.Inject(le.IEditorBridgeService)),oo(1,V.Inject(s.ConditionalFormattingService))],Yt);var jf=Object.defineProperty,$f=Object.getOwnPropertyDescriptor,Lf=(e,t,n,r)=>{for(var o=r>1?void 0:r?$f(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&jf(t,n,o),o},Ot=(e,t)=>(n,r)=>t(n,r,e);exports.ConditionalFormattingClearController=class extends g.Disposable{constructor(t,n,r,o,i){super(),this._injector=t,this._univerInstanceService=n,this._sheetInterceptorService=r,this._selectionManagerService=o,this._conditionalFormattingRuleModel=i,this._init()}_init(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:t=>{const n=[],r=[],o={redos:n,undos:r};if([$.ClearSelectionFormatCommand.id,$.ClearSelectionAllCommand.id].includes(t.id)){const i=this._selectionManagerService.getSelectionRanges();if(!i)return o;const a=this._univerInstanceService.getCurrentUnitForType(g.UniverInstanceType.UNIVER_SHEET),c=a.getActiveSheet(),l=this._conditionalFormattingRuleModel.getSubunitRules(a.getUnitId(),c.getSheetId());if(!l||!l.length)return o;l.filter(u=>i.some(d=>u.ranges.some(p=>g.Rectangle.getIntersects(p,d)))).forEach(u=>{const p=new $.RangeMergeUtil().add(...u.ranges).subtract(...i).merge();if(p.length){const f={id:s.SetConditionalRuleMutation.id,params:{unitId:a.getUnitId(),subUnitId:c.getSheetId(),rule:{...u,ranges:p}}},v=s.setConditionalRuleMutationUndoFactory(this._injector,f.params);n.push(f),r.push(...v)}else{const f={id:s.DeleteConditionalRuleMutation.id,params:{unitId:a.getUnitId(),subUnitId:c.getSheetId(),cfId:u.cfId}},v=s.DeleteConditionalRuleMutationUndoFactory(this._injector,f.params);n.push(f),r.push(...v)}})}return o}}))}};exports.ConditionalFormattingClearController=Lf([g.OnLifecycle(g.LifecycleStages.Rendered,exports.ConditionalFormattingClearController),Ot(0,V.Inject(V.Injector)),Ot(1,V.Inject(g.IUniverInstanceService)),Ot(2,V.Inject($.SheetInterceptorService)),Ot(3,V.Inject($.SelectionManagerService)),Ot(4,V.Inject(s.ConditionalFormattingRuleModel))],exports.ConditionalFormattingClearController);var Uf=Object.defineProperty,Vf=Object.getOwnPropertyDescriptor,kf=(e,t,n,r)=>{for(var o=r>1?void 0:r?Vf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&Uf(t,n,o),o},jn=(e,t)=>(n,r)=>t(n,r,e);let Kt=class extends g.Disposable{constructor(e,t,n){super(),this._localeService=e,this._commandService=t,this._sheetPermissionInterceptorBaseController=n,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(e=>{e.id===vn.id&&(this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({workbookTypes:[$.WorkbookEditablePermission],rangeTypes:[$.RangeProtectionPermissionEditPoint],worksheetTypes:[$.WorksheetEditPermission,$.WorksheetSetCellStylePermission]},e.params.rule.ranges)||this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.setStyleErr")))}))}};Kt=kf([g.OnLifecycle(g.LifecycleStages.Rendered,Kt),jn(0,V.Inject(g.LocaleService)),jn(1,g.ICommandService),jn(2,V.Inject(le.SheetPermissionInterceptorBaseController))],Kt);var Wf=Object.defineProperty,zf=Object.getOwnPropertyDescriptor,Af=(e,t,n,r)=>{for(var o=r>1?void 0:r?zf(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&Wf(t,n,o),o},io=(e,t)=>(n,r)=>t(n,r,e),Et;exports.UniverSheetsConditionalFormattingUIPlugin=(Et=class extends g.Plugin{constructor(t={},n,r){super(),this._config=t,this._injector=n,this._commandService=r,this._config=g.Tools.deepMerge({},Cf,this._config),this._initCommand(),s.SheetsConditionalFormattingPlugin.dependencyList.forEach(o=>{this._injector.add(o)}),this._injector.add([qt]),this._injector.add([Xt]),this._injector.add([Bt]),this._injector.add([Gt]),this._injector.add([Kt]),this._injector.add([vt,{useFactory:()=>this._injector.createInstance(vt,this._config)}]),this._injector.add([Mt]),this._injector.add([Yt]),this._injector.add([exports.ConditionalFormattingClearController])}_initCommand(){[...s.SheetsConditionalFormattingPlugin.mutationList,...exports.UniverSheetsConditionalFormattingUIPlugin.commandList].forEach(t=>{this._commandService.registerCommand(t)})}},Be(Et,"pluginName",s.SHEET_CONDITIONAL_FORMATTING_PLUGIN),Be(Et,"type",g.UniverInstanceType.UNIVER_SHEET),Be(Et,"commandList",[xi,Oi,Ei,Pi,Di,Mi,Ni,Fi,ji,Ri,Gn,ii,oi,vn,lo,Xn]),Et);exports.UniverSheetsConditionalFormattingUIPlugin=Af([io(1,V.Inject(V.Injector)),io(2,V.Inject(g.ICommandService))],exports.UniverSheetsConditionalFormattingUIPlugin);const Hf={sheet:{cf:{title:"Conditional Formatting",menu:{manageConditionalFormatting:"Manage Conditional Formatting",createConditionalFormatting:"Create Conditional Formatting",clearRangeRules:"Clear Rules for Selected Range",clearWorkSheetRules:"Clear Rules for Entire Sheet"},form:{lessThan:"The value must be less than {0}",lessThanOrEqual:"The value must be less than or equal to {0}",greaterThan:"The value must be greater than {0}",greaterThanOrEqual:"The value must be greater than or equal to {0}",rangeSelector:"Select Range or Enter Value"},iconSet:{direction:"Direction",shape:"Shape",mark:"Mark",rank:"Rank",rule:"Rule",icon:"Icon",type:"Type",value:"Value",reverseIconOrder:"Reverse Icon Order",and:"And",when:"When",onlyShowIcon:"Only Show Icon"},symbol:{greaterThan:">",greaterThanOrEqual:">=",lessThan:"<",lessThanOrEqual:"<="},panel:{createRule:"Create Rule",clear:"Clear All Rules",range:"Apply Range",styleType:"Style Type",submit:"Submit",cancel:"Cancel",rankAndAverage:"Top/Bottom/Average",styleRule:"Style Rule",isNotBottom:"Top",isBottom:"Bottom",greaterThanAverage:"Greater Than Average",lessThanAverage:"Less Than Average",medianValue:"Median Value",fillType:"Fill Type",pureColor:"Solid Color",gradient:"Gradient",colorSet:"Color Set",positive:"Positive",native:"Negative",workSheet:"Entire Sheet",selectedRange:"Selected Range",managerRuleSelect:"Manage {0} Rules",onlyShowDataBar:"Only Show Data Bars"},preview:{describe:{beginsWith:"Begins with {0}",endsWith:"Ends with {0}",containsText:"Text contains {0}",notContainsText:"Text does not contain {0}",equal:"Equal to {0}",notEqual:"Not equal to {0}",containsBlanks:"Contains Blanks",notContainsBlanks:"Does not contain Blanks",containsErrors:"Contains Errors",notContainsErrors:"Does not contain Errors",greaterThan:"Greater than {0}",greaterThanOrEqual:"Greater than or equal to {0}",lessThan:"Less than {0}",lessThanOrEqual:"Less than or equal to {0}",notBetween:"Not between {0} and {1}",between:"Between {0} and {1}",yesterday:"Yesterday",tomorrow:"Tomorrow",last7Days:"Last 7 Days",thisMonth:"This Month",lastMonth:"Last Month",nextMonth:"Next Month",thisWeek:"This Week",lastWeek:"Last Week",nextWeek:"Next Week",today:"Today",topN:"Top {0}",bottomN:"Bottom {0}",topNPercent:"Top {0}%",bottomNPercent:"Bottom {0}%"}},operator:{beginsWith:"Begins with",endsWith:"Ends with",containsText:"Text contains",notContainsText:"Text does not contain",equal:"Equal to",notEqual:"Not equal to",containsBlanks:"Contains Blanks",notContainsBlanks:"Does not contain Blanks",containsErrors:"Contains Errors",notContainsErrors:"Does not contain Errors",greaterThan:"Greater than",greaterThanOrEqual:"Greater than or equal to",lessThan:"Less than",lessThanOrEqual:"Less than or equal to",notBetween:"Not between",between:"Between",yesterday:"Yesterday",tomorrow:"Tomorrow",last7Days:"Last 7 Days",thisMonth:"This Month",lastMonth:"Last Month",nextMonth:"Next Month",thisWeek:"This Week",lastWeek:"Last Week",nextWeek:"Next Week",today:"Today"},ruleType:{highlightCell:"Highlight Cell",dataBar:"Data Bar",colorScale:"Color Scale",formula:"Custom Formula",iconSet:"Icon Set",duplicateValues:"Duplicate Values",uniqueValues:"Unique Values"},subRuleType:{uniqueValues:"Unique Values",duplicateValues:"Duplicate Values",rank:"Rank",text:"Text",timePeriod:"Time Period",number:"Number",average:"Average"},valueType:{num:"Number",min:"Minimum",max:"Maximum",percent:"Percentage",percentile:"Percentile",formula:"Formula",none:"None"}}}},qf=Object.freeze(Object.defineProperty({__proto__:null,default:Hf},Symbol.toStringTag,{value:"Module"})),Bf={sheet:{cf:{title:"条件格式",menu:{manageConditionalFormatting:"管理条件格式",createConditionalFormatting:"新建条件格式",clearRangeRules:"清除所选区域的规则",clearWorkSheetRules:"清除整个工作表的规则"},form:{lessThan:"该值必须小于 {0}",lessThanOrEqual:"该值必须小于等于 {0}",greaterThan:"该值必大于 {0}",greaterThanOrEqual:"该值必大于等于 {0}",rangeSelector:"选择范围或者输入值"},iconSet:{direction:"方向",shape:"形状",mark:"标记",rank:"等级",rule:"规则",icon:"图标",type:"类型",value:"值",reverseIconOrder:"反转图标次序",and:"且",when:"当值",onlyShowIcon:"仅显示图标"},symbol:{greaterThan:">",greaterThanOrEqual:">=",lessThan:"<",lessThanOrEqual:"<="},panel:{createRule:"新增规则",clear:"清空所有规则",range:"应用范围",styleType:"样式类型",submit:"确认",cancel:"取消",rankAndAverage:"最前/最后/平均值",styleRule:"样式规则",isNotBottom:"最前",isBottom:"最后",greaterThanAverage:"大于平均值",lessThanAverage:"小于平均值",medianValue:"中间值",fillType:"填充方式",pureColor:"纯色",gradient:"渐变",colorSet:"颜色设置",positive:"正值",native:"负值",workSheet:"整张工作表",selectedRange:"所选单元格",managerRuleSelect:"管理 {0} 的规则",onlyShowDataBar:"仅显示数据条"},preview:{describe:{beginsWith:"开头为{0}",endsWith:"结尾为{0}",containsText:"文本包含{0}",notContainsText:"文本不包含{0}",equal:"等于{0}",notEqual:"不等于{0}",containsBlanks:"为空",notContainsBlanks:"不为空",containsErrors:"错误",notContainsErrors:"非错误",greaterThan:"大于{0}",greaterThanOrEqual:"大于等于{0}",lessThan:"小于{0}",lessThanOrEqual:"小于等于{0}",notBetween:"不介于{0}和{1}之间",between:"介于{0}和{1}之间",yesterday:"昨日",tomorrow:"明日",last7Days:"最近7天",thisMonth:"本月",lastMonth:"上个月",nextMonth:"下个月",thisWeek:"本周",lastWeek:"上周",nextWeek:"下周",today:"今日",topN:"前{0}项",bottomN:"后{0}项",topNPercent:"前{0}%",bottomNPercent:"后{0}%"}},operator:{beginsWith:"开头为",endsWith:"结尾为",containsText:"文本包含",notContainsText:"文本不包含",equal:"等于",notEqual:"不等于",containsBlanks:"为空",notContainsBlanks:"不为空",containsErrors:"错误",notContainsErrors:"非错误",greaterThan:"大于",greaterThanOrEqual:"大于等于",lessThan:"小于",lessThanOrEqual:"小于等于",notBetween:"不介于",between:"介于",yesterday:"昨日",tomorrow:"明日",last7Days:"最近 7 天",thisMonth:"本月",lastMonth:"上个月",nextMonth:"下个月",thisWeek:"本周",lastWeek:"上周",nextWeek:"下周",today:"今日"},ruleType:{highlightCell:"突出显示单元格",dataBar:"数据条",colorScale:"色阶",formula:"自定义公式",iconSet:"图标集",duplicateValues:"重复值",uniqueValues:"唯一值"},subRuleType:{uniqueValues:"唯一值",duplicateValues:"重复值",rank:"最前最后",text:"文本",timePeriod:"时间日期",number:"数值",average:"平均值"},valueType:{num:"数值",min:"最小值",max:"最大值",percent:"百分比",percentile:"百分点",formula:"公式",none:"无"}}}},Gf=Object.freeze(Object.defineProperty({__proto__:null,default:Bf},Symbol.toStringTag,{value:"Module"})),Xf={sheet:{cf:{title:"Условное форматирование",menu:{manageConditionalFormatting:"Управление условным форматированием",createConditionalFormatting:"Создание условного форматирования",clearRangeRules:"Очистить правила для выбранного диапазона",clearWorkSheetRules:"Очистить правила для всего листа"},form:{lessThan:"Значение должно быть меньше {0}",lessThanOrEqual:"Значение должно быть меньше или равно {0}",greaterThan:"Значение должно быть больше {0}",greaterThanOrEqual:"Значение должно быть больше или равно {0}",rangeSelector:"Выберите диапазон или введите значение"},iconSet:{direction:"Направление",shape:"Форма",mark:"Знак",rank:"Ранг",rule:"Правило",icon:"Иконка",type:"Тип",value:"Значение",reverseIconOrder:"Обратный порядок иконок",and:"И",when:"Когда",onlyShowIcon:"Показывать только иконку"},symbol:{greaterThan:">",greaterThanOrEqual:">=",lessThan:"<",lessThanOrEqual:"<="},panel:{createRule:"Создать правило",clear:"Очистить все правила",range:"Применить диапазон",styleType:"Тип стиля",submit:"Подтвердить",cancel:"Отменить",rankAndAverage:"Верх/Низ/Среднее",styleRule:"Правило стиля",isNotBottom:"Верх",isBottom:"Низ",greaterThanAverage:"Больше среднего",lessThanAverage:"Меньше среднего",medianValue:"Медианное значение",fillType:"Тип заполнения",pureColor:"Сплошной цвет",gradient:"Градиент",colorSet:"Набор цветов",positive:"Положительный",native:"Отрицательный",workSheet:"Весь лист",selectedRange:"Выбранный диапазон",managerRuleSelect:"Управление правилами {0}",onlyShowDataBar:"Показывать только гистограммы данных"},preview:{describe:{beginsWith:"Начинается с {0}",endsWith:"Заканчивается на {0}",containsText:"Содержит текст {0}",notContainsText:"Не содержит текст {0}",equal:"Равно {0}",notEqual:"Не равно {0}",containsBlanks:"Содержит пустые ячейки",notContainsBlanks:"Не содержит пустых ячеек",containsErrors:"Содержит ошибки",notContainsErrors:"Не содержит ошибок",greaterThan:"Больше чем {0}",greaterThanOrEqual:"Больше или равно {0}",lessThan:"Меньше чем {0}",lessThanOrEqual:"Меньше или равно {0}",notBetween:"Не между {0} и {1}",between:"Между {0} и {1}",yesterday:"Вчера",tomorrow:"Завтра",last7Days:"Последние 7 дней",thisMonth:"Этот месяц",lastMonth:"Прошлый месяц",nextMonth:"Следующий месяц",thisWeek:"Эта неделя",lastWeek:"Прошлая неделя",nextWeek:"Следующая неделя",today:"Сегодня",topN:"Топ {0}",bottomN:"Низ {0}",topNPercent:"Топ {0}%",bottomNPercent:"Низ {0}%"}},operator:{beginsWith:"Начинается с",endsWith:"Заканчивается на",containsText:"Содержит текст",notContainsText:"Не содержит текст",equal:"Равно",notEqual:"Не равно",containsBlanks:"Содержит пустые ячейки",notContainsBlanks:"Не содержит пустых ячеек",containsErrors:"Содержит ошибки",notContainsErrors:"Не содержит ошибок",greaterThan:"Больше чем",greaterThanOrEqual:"Больше или равно",lessThan:"Меньше чем",lessThanOrEqual:"Меньше или равно",notBetween:"Не между",between:"Между",yesterday:"Вчера",tomorrow:"Завтра",last7Days:"Последние 7 дней",thisMonth:"Этот месяц",lastMonth:"Прошлый месяц",nextMonth:"Следующий месяц",thisWeek:"Эта неделя",lastWeek:"Прошлая неделя",nextWeek:"Следующая неделя",today:"Сегодня"},ruleType:{highlightCell:"Выделение ячеек",dataBar:"Гистограмма данных",colorScale:"Цветовая шкала",formula:"Пользовательская формула",iconSet:"Набор иконок",duplicateValues:"Дублирующиеся значения",uniqueValues:"Уникальные значения"},subRuleType:{uniqueValues:"Уникальные значения",duplicateValues:"Дублирующиеся значения",rank:"Ранг",text:"Текст",timePeriod:"Период времени",number:"Число",average:"Среднее"},valueType:{num:"Число",min:"Минимум",max:"Максимум",percent:"Процент",percentile:"Процентиль",formula:"Формула",none:"Нет"}}}},Yf=Object.freeze(Object.defineProperty({__proto__:null,default:Xf},Symbol.toStringTag,{value:"Module"}));exports.AddCfCommand=vn;exports.enUS=qf;exports.ruRU=Yf;exports.zhCN=Gf;