@univerjs/sheets-conditional-formatting-ui 0.1.7 → 0.1.8
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 +3 -3
- package/lib/es/index.js +2930 -2871
- package/lib/types/controllers/cf.render.controller.d.ts +3 -0
- package/lib/types/menu/manage-rule.d.ts +1 -1
- package/lib/types/plugin.d.ts +3 -2
- package/lib/umd/index.js +3 -3
- package/package.json +24 -24
package/lib/umd/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(F,v){typeof exports=="object"&&typeof module<"u"?v(exports,require("@univerjs/core"),require("@wendellhu/redi"),require("@univerjs/sheets-conditional-formatting"),require("@univerjs/sheets"),require("@univerjs/ui"),require("rxjs"),require("rxjs/operators"),require("react"),require("@univerjs/design"),require("@wendellhu/redi/react-bindings"),require("@univerjs/engine-formula"),require("clsx"),require("react-dom"),require("@univerjs/sheets-ui"),require("@univerjs/engine-render")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@wendellhu/redi","@univerjs/sheets-conditional-formatting","@univerjs/sheets","@univerjs/ui","rxjs","rxjs/operators","react","@univerjs/design","@wendellhu/redi/react-bindings","@univerjs/engine-formula","clsx","react-dom","@univerjs/sheets-ui","@univerjs/engine-render"],v):(F=typeof globalThis<"u"?globalThis:F||self,v(F.UniverSheetsConditionalFormattingUi={},F.UniverCore,F["@wendellhu/redi"],F.UniverSheetsConditionalFormatting,F.UniverSheets,F.UniverUi,F.rxjs,F.rxjs.operators,F.React,F.UniverDesign,F["@wendellhu/redi/react-bindings"],F.UniverEngineFormula,F.clsx,F.ReactDOM,F.UniverSheetsUi,F.UniverEngineRender))})(this,function(F,v,L,s,J,ve,Re,Me,x,B,Q,wr,He,Tr,fe,Io){"use strict";var Cd=Object.defineProperty;var Rd=(F,v,L)=>v in F?Cd(F,v,{enumerable:!0,configurable:!0,writable:!0,value:L}):F[v]=L;var yt=(F,v,L)=>(Rd(F,typeof v!="symbol"?v+"":v,L),L);var bn;const wo={type:v.CommandType.COMMAND,id:"sheet.command.add-average-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:a,operator:o}=t,i=e.get(s.ConditionalFormattingRuleModel),c=e.get(v.ICommandService),u=e.get(v.IUniverInstanceService).getCurrentUniverSheetInstance(),d=u.getActiveSheet(),h=u.getUnitId(),p=d.getSheetId(),m=i.createCfId(h,p),C={ranges:n,cfId:m,stopIfTrue:!!a,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.average,operator:o,style:r}};return c.executeCommand(s.AddConditionalRuleMutation.id,{unitId:h,subUnitId:p,rule:C})}},To={type:v.CommandType.COMMAND,id:"sheet.command.add-color-scale-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,config:r,stopIfTrue:a}=t,o=e.get(s.ConditionalFormattingRuleModel),i=e.get(v.ICommandService),l=e.get(v.IUniverInstanceService).getCurrentUniverSheetInstance(),u=l.getActiveSheet(),d=l.getUnitId(),h=u.getSheetId(),p=o.createCfId(d,h),m={ranges:n,cfId:p,stopIfTrue:!!a,rule:{type:s.CFRuleType.colorScale,config:r}};return i.executeCommand(s.AddConditionalRuleMutation.id,{unitId:d,subUnitId:h,rule:m})}},_o={type:v.CommandType.COMMAND,id:"sheet.command.add-data-bar-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,min:r,max:a,nativeColor:o,positiveColor:i,isGradient:c,stopIfTrue:l,isShowValue:u}=t,d=e.get(s.ConditionalFormattingRuleModel),h=e.get(v.IUniverInstanceService),p=e.get(v.ICommandService),m=h.getCurrentUniverSheetInstance(),C=m.getActiveSheet(),b=m.getUnitId(),_=C.getSheetId(),I=d.createCfId(b,_),y={ranges:n,cfId:I,stopIfTrue:!!l,rule:{type:s.CFRuleType.dataBar,isShowValue:u,config:{min:r,max:a,nativeColor:o,positiveColor:i,isGradient:c}}};return p.executeCommand(s.AddConditionalRuleMutation.id,{unitId:b,subUnitId:_,rule:y})}},xo={type:v.CommandType.COMMAND,id:"sheet.command.add-duplicate-values-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:a}=t,o=e.get(s.ConditionalFormattingRuleModel),i=e.get(v.ICommandService),l=e.get(v.IUniverInstanceService).getCurrentUniverSheetInstance(),u=l.getActiveSheet(),d=l.getUnitId(),h=u.getSheetId(),p=o.createCfId(d,h),m={ranges:n,cfId:p,stopIfTrue:!!a,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.duplicateValues,style:r}};return i.executeCommand(s.AddConditionalRuleMutation.id,{unitId:d,subUnitId:h,rule:m})}},Oo={type:v.CommandType.COMMAND,id:"sheet.command.add-number-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:a,operator:o,value:i}=t,c=e.get(s.ConditionalFormattingRuleModel),l=e.get(v.ICommandService),d=e.get(v.IUniverInstanceService).getCurrentUniverSheetInstance(),h=d.getActiveSheet(),p=d.getUnitId(),m=h.getSheetId(),C=c.createCfId(p,m);let b;if([s.CFNumberOperator.between,s.CFNumberOperator.notBetween].includes(o)){const _=i;if(_.length!==2||!Array.isArray(_))return!1;b={ranges:n,cfId:C,stopIfTrue:!!a,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.number,operator:o,style:r,value:_}}}else{const _=i;if(typeof _!="number")return!1;b={ranges:n,cfId:C,stopIfTrue:!!a,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.number,operator:o,style:r,value:_}}}return l.executeCommand(s.AddConditionalRuleMutation.id,{unitId:p,subUnitId:m,rule:b})}},Mo={type:v.CommandType.COMMAND,id:"sheet.command.add-rank-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:a,isPercent:o,isBottom:i,value:c}=t,l=e.get(s.ConditionalFormattingRuleModel),u=e.get(v.IUniverInstanceService),d=e.get(v.ICommandService),h=u.getCurrentUniverSheetInstance(),p=h.getActiveSheet(),m=h.getUnitId(),C=p.getSheetId(),b=l.createCfId(m,C),_={ranges:n,cfId:b,stopIfTrue:!!a,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.rank,isPercent:o,isBottom:i,style:r,value:c}};return d.executeCommand(s.AddConditionalRuleMutation.id,{unitId:m,subUnitId:C,rule:_})}},Do={type:v.CommandType.COMMAND,id:"sheet.command.add-text-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:a,operator:o,value:i}=t,c=e.get(s.ConditionalFormattingRuleModel),u=e.get(v.IUniverInstanceService).getCurrentUniverSheetInstance(),d=e.get(v.ICommandService),h=u.getActiveSheet(),p=u.getUnitId(),m=h.getSheetId(),C=c.createCfId(p,m),b={ranges:n,cfId:C,stopIfTrue:!!a,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.text,operator:o,style:r,value:i}};return d.executeCommand(s.AddConditionalRuleMutation.id,{unitId:p,subUnitId:m,rule:b})}},Eo={type:v.CommandType.COMMAND,id:"sheet.command.add-time-period-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:a,operator:o}=t,i=e.get(s.ConditionalFormattingRuleModel),c=e.get(v.IUniverInstanceService),l=e.get(v.ICommandService),u=c.getCurrentUniverSheetInstance(),d=u.getActiveSheet(),h=u.getUnitId(),p=d.getSheetId(),m=i.createCfId(h,p),C={ranges:n,cfId:m,stopIfTrue:!!a,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.timePeriod,operator:o,style:r}};return l.executeCommand(s.AddConditionalRuleMutation.id,{unitId:h,subUnitId:p,rule:C})}},Po={type:v.CommandType.COMMAND,id:"sheet.command.add-uniqueValues-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:a}=t,o=e.get(s.ConditionalFormattingRuleModel),i=e.get(v.IUniverInstanceService),c=e.get(v.ICommandService),l=i.getCurrentUniverSheetInstance(),u=l.getActiveSheet(),d=l.getUnitId(),h=u.getSheetId(),p=o.createCfId(d,h),m={ranges:n,cfId:p,stopIfTrue:!!a,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.uniqueValues,style:r}};return c.executeCommand(s.AddConditionalRuleMutation.id,{unitId:d,subUnitId:h,rule:m})}},_r={type:v.CommandType.COMMAND,id:"sheet.command.clear-range-conditional-rule",handler(e,t){var _,I,y;if(!t)return!1;const n=e.get(s.ConditionalFormattingRuleModel),r=e.get(v.IUniverInstanceService),a=e.get(v.ICommandService),o=r.getCurrentUniverSheetInstance(),i=e.get(v.IUndoRedoService),c=e.get(J.SelectionManagerService),l=o.getActiveSheet(),u=(_=t.unitId)!=null?_:o.getUnitId(),d=(I=t.subUnitId)!=null?I:l.getSheetId(),h=((y=c.getSelections())==null?void 0:y.map(S=>S.range))||[],p=n.getSubunitRules(u,d);if(!(p!=null&&p.length)||!h.length)return!1;const m=[],C=[];p.forEach(S=>{const R=new v.ObjectMatrix;S.ranges.forEach(w=>{v.Range.foreach(w,(O,E)=>{R.setValue(O,E,1)})}),h.forEach(w=>{v.Range.foreach(w,(O,E)=>{R.realDeleteValue(O,E)})});const g=J.findAllRectangle(J.createTopMatrixFromMatrix(R));if(g.length){const w={...S,ranges:g},O={unitId:u,subUnitId:d,rule:w},E=s.setConditionalRuleMutationUndoFactory(e,O);m.push({id:s.SetConditionalRuleMutation.id,params:O}),C.push(...E)}else{const w={unitId:u,subUnitId:d,cfId:S.cfId},O=s.DeleteConditionalRuleMutationUndoFactory(e,w);m.push({id:s.DeleteConditionalRuleMutation.id,params:w}),C.push(...O)}});const b=v.sequenceExecute(m,a).result;return b&&i.pushUndoRedo({unitID:u,redoMutations:m,undoMutations:C}),b}},Cn={type:v.CommandType.COMMAND,id:"sheet.command.clear-worksheet-conditional-rule",handler(e,t){var b,_;const n=e.get(s.ConditionalFormattingRuleModel),r=e.get(v.IUniverInstanceService),a=e.get(v.ICommandService),o=r.getCurrentUniverSheetInstance(),i=e.get(v.IUndoRedoService),c=o.getActiveSheet(),l=(b=t==null?void 0:t.unitId)!=null?b:o.getUnitId(),u=(_=t==null?void 0:t.subUnitId)!=null?_:c.getSheetId(),d=n.getSubunitRules(l,u);if(!(d!=null&&d.length))return!1;const h=d.map(I=>({cfId:I.cfId,unitId:l,subUnitId:u})),p=h.map(I=>({id:s.DeleteConditionalRuleMutation.id,params:I})),m=h.map(I=>s.DeleteConditionalRuleMutationUndoFactory(e,I)[0]),C=v.sequenceExecute(p,a).result;return C&&i.pushUndoRedo({unitID:l,redoMutations:p,undoMutations:m}),C}};var _e=function(){return _e=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},_e.apply(this,arguments)},No=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 a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n},Fe=x.forwardRef(function(e,t){var n=e.icon,r=e.id,a=e.className,o=e.extend,i=No(e,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(r," ").concat(a||"").trim(),l=x.useRef("_".concat(ko()));return xr(n,"".concat(r),{defIds:n.defIds,idSuffix:l.current},_e({ref:t,className:c},i),o)});function xr(e,t,n,r,a){return x.createElement(e.tag,_e(_e({key:t},jo(e,n,a)),r),(Lo(e,n).children||[]).map(function(o,i){return xr(o,"".concat(t,"-").concat(e.tag,"-").concat(i),n,void 0,a)}))}function jo(e,t,n){var r=_e({},e.attrs);n!=null&&n.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=n.colorChannel1);var a=t.defIds;return!a||a.length===0||(e.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+t.idSuffix),Object.entries(r).forEach(function(o){var i=o[0],c=o[1];typeof c=="string"&&(r[i]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),r}function Lo(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)?_e(_e({},e),{children:e.children.map(function(a){return typeof a.attrs.id=="string"&&r&&r.indexOf(a.attrs.id)>-1?_e(_e({},a),{attrs:_e(_e({},a.attrs),{id:a.attrs.id+t.idSuffix})}):a})}):e}function ko(){return Math.random().toString(36).substring(2,8)}Fe.displayName="UniverIcon";var Vo={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"}}]},Or=x.forwardRef(function(e,t){return x.createElement(Fe,Object.assign({},e,{id:"conditions",ref:t,icon:Vo}))});Or.displayName="Conditions";const Ao=Or;var zo={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"}}]},Mr=x.forwardRef(function(e,t){return x.createElement(Fe,Object.assign({},e,{id:"delete-single",ref:t,icon:zo}))});Mr.displayName="DeleteSingle";const Rn=Mr;var Uo={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"}}]}]},Dr=x.forwardRef(function(e,t){return x.createElement(Fe,Object.assign({},e,{id:"increase-single",ref:t,icon:Uo}))});Dr.displayName="IncreaseSingle";const Wo=Dr;var Ho={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"}}]}]},Er=x.forwardRef(function(e,t){return x.createElement(Fe,Object.assign({},e,{id:"more-down-single",ref:t,icon:Ho}))});Er.displayName="MoreDownSingle";const In=Er;var $o={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"}}]}]},Pr=x.forwardRef(function(e,t){return x.createElement(Fe,Object.assign({},e,{id:"sequence-single",ref:t,icon:$o}))});Pr.displayName="SequenceSingle";const Bo=Pr;var Go={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"}}]}]},Nr=x.forwardRef(function(e,t){return x.createElement(Fe,Object.assign({},e,{id:"slash-single",ref:t,icon:Go}))});Nr.displayName="SlashSingle";const kt=Nr,Fo=e=>{const t="conditional-formatting-menu-icon";return e.register(t,Ao),n=>{const r=n.get(v.LocaleService),a=n.get(J.SelectionManagerService),o=n.get(v.ICommandService),i=n.get(v.IUniverInstanceService),c=n.get(s.ConditionalFormattingRuleModel),l=[J.SetWorksheetActiveOperation.id,s.AddConditionalRuleMutation.id,s.SetConditionalRuleMutation.id,s.DeleteConditionalRuleMutation.id,s.MoveConditionalRuleMutation.id],u=new Re.Observable(p=>Re.merge(a.selectionMoveEnd$,new Re.Observable(m=>{const C=o.onCommandExecuted(b=>{const{id:_,params:I}=b,y=i.getCurrentUniverSheetInstance().getUnitId();l.includes(_)&&I.unitId===y&&m.next(null)});return()=>C.dispose()})).pipe(Me.debounceTime(16)).subscribe(()=>{var y;const m=((y=a.getSelections())==null?void 0:y.map(S=>S.range))||[],C=i.getCurrentUniverSheetInstance().getUnitId(),b=i.getCurrentUniverSheetInstance().getActiveSheet().getSheetId(),I=(c.getSubunitRules(C,b)||[]).filter(S=>S.ranges.some(R=>m.some(g=>v.Rectangle.intersects(g,R))));p.next(!!I.length)})),d=new Re.Observable(p=>Re.merge(a.selectionMoveEnd$,new Re.Observable(m=>{const C=o.onCommandExecuted(b=>{const{id:_,params:I}=b,y=i.getCurrentUniverSheetInstance().getUnitId();l.includes(_)&&I.unitId===y&&m.next(null)});return()=>C.dispose()})).pipe(Me.debounceTime(16)).subscribe(()=>{const m=i.getCurrentUniverSheetInstance().getUnitId(),C=i.getCurrentUniverSheetInstance().getActiveSheet().getSheetId(),b=c.getSubunitRules(m,C)||[];p.next(!!b.length)})),h=new Re.Observable(p=>{const m=[{label:r.t("sheet.cf.ruleType.highlightCell"),value:Te.highlightCell},{label:r.t("sheet.cf.panel.rankAndAverage"),value:Te.rank},{label:r.t("sheet.cf.ruleType.formula"),value:Te.formula},{label:r.t("sheet.cf.ruleType.colorScale"),value:Te.colorScale},{label:r.t("sheet.cf.ruleType.dataBar"),value:Te.dataBar},{label:r.t("sheet.cf.ruleType.iconSet"),value:Te.icon},{label:r.t("sheet.cf.menu.manageConditionalFormatting"),value:Te.viewRule},{label:r.t("sheet.cf.menu.createConditionalFormatting"),value:Te.createRule},{label:r.t("sheet.cf.menu.clearRangeRules"),value:Te.clearRangeRules,disabled:!u},{label:r.t("sheet.cf.menu.clearWorkSheetRules"),value:Te.clearWorkSheetRules}];u.subscribe(C=>{const b=m.find(_=>_.value===Te.clearRangeRules);b&&(b.disabled=!C,p.next(m))}),d.subscribe(C=>{const b=m.find(_=>_.value===Te.clearWorkSheetRules);b&&(b.disabled=!C,p.next(m))}),p.next(m)});return{id:yo.id,type:ve.MenuItemType.SELECTOR,group:ve.MenuGroup.TOOLBAR_FORMULAS_INSERT,positions:[ve.MenuPosition.TOOLBAR_START],icon:t,tooltip:r.t("sheet.cf.title"),selections:h,hidden$:ve.getMenuHiddenObservable(n,v.UniverInstanceType.SHEET)}}};var ze=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function wn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function qo(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 a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}),n}var jr={exports:{}},Vt={};/**
|
|
1
|
+
(function(X,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("@univerjs/core"),require("@wendellhu/redi"),require("@univerjs/sheets-conditional-formatting"),require("@univerjs/sheets"),require("@univerjs/ui"),require("rxjs"),require("rxjs/operators"),require("react"),require("@univerjs/design"),require("@wendellhu/redi/react-bindings"),require("@univerjs/engine-formula"),require("clsx"),require("react-dom"),require("@univerjs/sheets-ui"),require("@univerjs/engine-render")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@wendellhu/redi","@univerjs/sheets-conditional-formatting","@univerjs/sheets","@univerjs/ui","rxjs","rxjs/operators","react","@univerjs/design","@wendellhu/redi/react-bindings","@univerjs/engine-formula","clsx","react-dom","@univerjs/sheets-ui","@univerjs/engine-render"],m):(X=typeof globalThis<"u"?globalThis:X||self,m(X.UniverSheetsConditionalFormattingUi={},X.UniverCore,X["@wendellhu/redi"],X.UniverSheetsConditionalFormatting,X.UniverSheets,X.UniverUi,X.rxjs,X.rxjs.operators,X.React,X.UniverDesign,X["@wendellhu/redi/react-bindings"],X.UniverEngineFormula,X.clsx,X.ReactDOM,X.UniverSheetsUi,X.UniverEngineRender))})(this,function(X,m,V,s,k,ve,Ce,Ee,w,G,te,_r,We,wr,le,_o){"use strict";var Cd=Object.defineProperty;var _d=(X,m,V)=>m in X?Cd(X,m,{enumerable:!0,configurable:!0,writable:!0,value:V}):X[m]=V;var lt=(X,m,V)=>(_d(X,typeof m!="symbol"?m+"":m,V),V);var Lt;const wo={type:m.CommandType.COMMAND,id:"sheet.command.add-average-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:a,operator:o}=t,i=e.get(s.ConditionalFormattingRuleModel),u=e.get(m.ICommandService),l=e.get(m.IUniverInstanceService),c=k.getSheetCommandTarget(l);if(!c)return!1;const{unitId:d,subUnitId:h}=c,f=i.createCfId(d,h),v={ranges:n,cfId:f,stopIfTrue:!!a,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.average,operator:o,style:r}};return u.executeCommand(s.AddConditionalRuleMutation.id,{unitId:d,subUnitId:h,rule:v})}},Io={type:m.CommandType.COMMAND,id:"sheet.command.add-color-scale-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,config:r,stopIfTrue:a}=t,o=e.get(s.ConditionalFormattingRuleModel),i=e.get(m.ICommandService),u=e.get(m.IUniverInstanceService),l=k.getSheetCommandTarget(u);if(!l)return!1;const{unitId:c,subUnitId:d}=l,h=o.createCfId(c,d),f={ranges:n,cfId:h,stopIfTrue:!!a,rule:{type:s.CFRuleType.colorScale,config:r}};return i.executeCommand(s.AddConditionalRuleMutation.id,{unitId:c,subUnitId:d,rule:f})}},xo={type:m.CommandType.COMMAND,id:"sheet.command.add-data-bar-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,min:r,max:a,nativeColor:o,positiveColor:i,isGradient:u,stopIfTrue:l,isShowValue:c}=t,d=e.get(s.ConditionalFormattingRuleModel),h=e.get(m.IUniverInstanceService),f=k.getSheetCommandTarget(h);if(!f)return!1;const{unitId:v,subUnitId:y}=f,T=e.get(m.ICommandService),x=d.createCfId(v,y),_={ranges:n,cfId:x,stopIfTrue:!!l,rule:{type:s.CFRuleType.dataBar,isShowValue:c,config:{min:r,max:a,nativeColor:o,positiveColor:i,isGradient:u}}};return T.executeCommand(s.AddConditionalRuleMutation.id,{unitId:v,subUnitId:y,rule:_})}},Oo={type:m.CommandType.COMMAND,id:"sheet.command.add-duplicate-values-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:a}=t,o=e.get(s.ConditionalFormattingRuleModel),i=e.get(m.ICommandService),u=e.get(m.IUniverInstanceService),l=k.getSheetCommandTarget(u);if(!l)return!1;const{unitId:c,subUnitId:d}=l,h=o.createCfId(c,d),f={ranges:n,cfId:h,stopIfTrue:!!a,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.duplicateValues,style:r}};return i.executeCommand(s.AddConditionalRuleMutation.id,{unitId:c,subUnitId:d,rule:f})}},Eo={type:m.CommandType.COMMAND,id:"sheet.command.add-number-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:a,operator:o,value:i}=t,u=e.get(s.ConditionalFormattingRuleModel),l=e.get(m.ICommandService),c=e.get(m.IUniverInstanceService),d=k.getSheetCommandTarget(c);if(!d)return!1;const{unitId:h,subUnitId:f}=d,v=u.createCfId(h,f);let y;if([s.CFNumberOperator.between,s.CFNumberOperator.notBetween].includes(o)){const T=i;if(T.length!==2||!Array.isArray(T))return!1;y={ranges:n,cfId:v,stopIfTrue:!!a,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.number,operator:o,style:r,value:T}}}else{const T=i;if(typeof T!="number")return!1;y={ranges:n,cfId:v,stopIfTrue:!!a,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.number,operator:o,style:r,value:T}}}return l.executeCommand(s.AddConditionalRuleMutation.id,{unitId:h,subUnitId:f,rule:y})}},Mo={type:m.CommandType.COMMAND,id:"sheet.command.add-rank-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:a,isPercent:o,isBottom:i,value:u}=t,l=e.get(s.ConditionalFormattingRuleModel),c=e.get(m.IUniverInstanceService),d=e.get(m.ICommandService),h=k.getSheetCommandTarget(c);if(!h)return!1;const{unitId:f,subUnitId:v}=h,y=l.createCfId(f,v),T={ranges:n,cfId:y,stopIfTrue:!!a,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.rank,isPercent:o,isBottom:i,style:r,value:u}};return d.executeCommand(s.AddConditionalRuleMutation.id,{unitId:f,subUnitId:v,rule:T})}},Do={type:m.CommandType.COMMAND,id:"sheet.command.add-text-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:a,operator:o,value:i}=t,u=e.get(s.ConditionalFormattingRuleModel),l=e.get(m.IUniverInstanceService),c=k.getSheetCommandTarget(l);if(!c)return!1;const{unitId:d,subUnitId:h}=c,f=e.get(m.ICommandService),v=u.createCfId(d,h),y={ranges:n,cfId:v,stopIfTrue:!!a,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.text,operator:o,style:r,value:i}};return f.executeCommand(s.AddConditionalRuleMutation.id,{unitId:d,subUnitId:h,rule:y})}},Po={type:m.CommandType.COMMAND,id:"sheet.command.add-time-period-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:a,operator:o}=t,i=e.get(s.ConditionalFormattingRuleModel),u=e.get(m.IUniverInstanceService),l=e.get(m.ICommandService),c=k.getSheetCommandTarget(u);if(!c)return!1;const{unitId:d,subUnitId:h}=c,f=i.createCfId(d,h),v={ranges:n,cfId:f,stopIfTrue:!!a,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.timePeriod,operator:o,style:r}};return l.executeCommand(s.AddConditionalRuleMutation.id,{unitId:d,subUnitId:h,rule:v})}},No={type:m.CommandType.COMMAND,id:"sheet.command.add-uniqueValues-conditional-rule",handler(e,t){if(!t)return!1;const{ranges:n,style:r,stopIfTrue:a}=t,o=e.get(s.ConditionalFormattingRuleModel),i=e.get(m.IUniverInstanceService),u=e.get(m.ICommandService),l=k.getSheetCommandTarget(i);if(!l)return!1;const{unitId:c,subUnitId:d}=l,h=o.createCfId(c,d),f={ranges:n,cfId:h,stopIfTrue:!!a,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.uniqueValues,style:r}};return u.executeCommand(s.AddConditionalRuleMutation.id,{unitId:c,subUnitId:d,rule:f})}},Ir={type:m.CommandType.COMMAND,id:"sheet.command.clear-range-conditional-rule",handler(e,t){var T;if(!t)return!1;const n=e.get(s.ConditionalFormattingRuleModel),r=e.get(m.IUniverInstanceService),a=e.get(m.ICommandService),o=e.get(m.IUndoRedoService),i=e.get(k.SelectionManagerService),u=k.getSheetCommandTarget(r,t);if(!u)return!1;const{unitId:l,subUnitId:c}=u,d=((T=i.getSelections())==null?void 0:T.map(x=>x.range))||[],h=n.getSubunitRules(l,c);if(!(h!=null&&h.length)||!d.length)return!1;const f=[],v=[];h.forEach(x=>{const _=new m.ObjectMatrix;x.ranges.forEach(S=>{m.Range.foreach(S,(C,g)=>{_.setValue(C,g,1)})}),d.forEach(S=>{m.Range.foreach(S,(C,g)=>{_.realDeleteValue(C,g)})});const b=k.findAllRectangle(k.createTopMatrixFromMatrix(_));if(b.length){const S={...x,ranges:b},C={unitId:l,subUnitId:c,rule:S},g=s.setConditionalRuleMutationUndoFactory(e,C);f.push({id:s.SetConditionalRuleMutation.id,params:C}),v.push(...g)}else{const S={unitId:l,subUnitId:c,cfId:x.cfId},C=s.DeleteConditionalRuleMutationUndoFactory(e,S);f.push({id:s.DeleteConditionalRuleMutation.id,params:S}),v.push(...C)}});const y=m.sequenceExecute(f,a).result;return y&&o.pushUndoRedo({unitID:l,redoMutations:f,undoMutations:v}),y}},Tn={type:m.CommandType.COMMAND,id:"sheet.command.clear-worksheet-conditional-rule",handler(e,t){const n=e.get(s.ConditionalFormattingRuleModel),r=e.get(m.IUniverInstanceService),a=e.get(m.ICommandService),o=e.get(m.IUndoRedoService),i=k.getSheetCommandTarget(r,t);if(!i)return!1;const{unitId:u,subUnitId:l}=i,c=n.getSubunitRules(u,l);if(!(c!=null&&c.length))return!1;const d=c.map(y=>({cfId:y.cfId,unitId:u,subUnitId:l})),h=d.map(y=>({id:s.DeleteConditionalRuleMutation.id,params:y})),f=d.map(y=>s.DeleteConditionalRuleMutationUndoFactory(e,y)[0]),v=m.sequenceExecute(h,a).result;return v&&o.pushUndoRedo({unitID:u,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 a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},xe.apply(this,arguments)},jo=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 a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n},Ge=w.forwardRef(function(e,t){var n=e.icon,r=e.id,a=e.className,o=e.extend,i=jo(e,["icon","id","className","extend"]),u="univerjs-icon univerjs-icon-".concat(r," ").concat(a||"").trim(),l=w.useRef("_".concat(Uo()));return xr(n,"".concat(r),{defIds:n.defIds,idSuffix:l.current},xe({ref:t,className:u},i),o)});function xr(e,t,n,r,a){return w.createElement(e.tag,xe(xe({key:t},Lo(e,n,a)),r),(Vo(e,n).children||[]).map(function(o,i){return xr(o,"".concat(t,"-").concat(e.tag,"-").concat(i),n,void 0,a)}))}function Lo(e,t,n){var r=xe({},e.attrs);n!=null&&n.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=n.colorChannel1);var a=t.defIds;return!a||a.length===0||(e.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+t.idSuffix),Object.entries(r).forEach(function(o){var i=o[0],u=o[1];typeof u=="string"&&(r[i]=u.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),r}function Vo(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(a){return typeof a.attrs.id=="string"&&r&&r.indexOf(a.attrs.id)>-1?xe(xe({},a),{attrs:xe(xe({},a.attrs),{id:a.attrs.id+t.idSuffix})}):a})}):e}function Uo(){return Math.random().toString(36).substring(2,8)}Ge.displayName="UniverIcon";var zo={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"}}]},Or=w.forwardRef(function(e,t){return w.createElement(Ge,Object.assign({},e,{id:"conditions",ref:t,icon:zo}))});Or.displayName="Conditions";const Ao=Or;var Ho={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"}}]},Er=w.forwardRef(function(e,t){return w.createElement(Ge,Object.assign({},e,{id:"delete-single",ref:t,icon:Ho}))});Er.displayName="DeleteSingle";const Rn=Er;var ko={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"}}]}]},Mr=w.forwardRef(function(e,t){return w.createElement(Ge,Object.assign({},e,{id:"increase-single",ref:t,icon:ko}))});Mr.displayName="IncreaseSingle";const Wo=Mr;var $o={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"}}]}]},Dr=w.forwardRef(function(e,t){return w.createElement(Ge,Object.assign({},e,{id:"more-down-single",ref:t,icon:$o}))});Dr.displayName="MoreDownSingle";const Cn=Dr;var Bo={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"}}]}]},Pr=w.forwardRef(function(e,t){return w.createElement(Ge,Object.assign({},e,{id:"sequence-single",ref:t,icon:Bo}))});Pr.displayName="SequenceSingle";const Fo=Pr;var Go={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"}}]}]},Nr=w.forwardRef(function(e,t){return w.createElement(Ge,Object.assign({},e,{id:"slash-single",ref:t,icon:Go}))});Nr.displayName="SlashSingle";const Ut=Nr,jr=[k.SetWorksheetActiveOperation.id,s.AddConditionalRuleMutation.id,s.SetConditionalRuleMutation.id,s.DeleteConditionalRuleMutation.id,s.MoveConditionalRuleMutation.id],qo=e=>{const t="conditional-formatting-menu-icon";return e.register(t,Ao),n=>{const r=n.get(m.LocaleService),a=n.get(k.SelectionManagerService),o=n.get(m.ICommandService),i=n.get(m.IUniverInstanceService),u=n.get(s.ConditionalFormattingRuleModel),l=new Ce.Observable(h=>Ce.merge(a.selectionMoveEnd$,new Ce.Observable(f=>{const v=o.onCommandExecuted(y=>{var b;const{id:T,params:x}=y,_=(b=i.getCurrentUnitForType(m.UniverInstanceType.UNIVER_SHEET))==null?void 0:b.getUnitId();jr.includes(T)&&x.unitId===_&&f.next(null)});return()=>v.dispose()})).pipe(Ee.debounceTime(16)).subscribe(()=>{var x;const f=((x=a.getSelections())==null?void 0:x.map(_=>_.range))||[],v=i.getCurrentUnitForType(m.UniverInstanceType.UNIVER_SHEET);if(!v)return;const T=(u.getSubunitRules(v.getUnitId(),v.getActiveSheet().getSheetId())||[]).filter(_=>_.ranges.some(b=>f.some(S=>m.Rectangle.intersects(S,b))));h.next(!!T.length)})),c=new Ce.Observable(h=>Ce.merge(a.selectionMoveEnd$,new Ce.Observable(f=>{const v=o.onCommandExecuted(y=>{var b;const{id:T,params:x}=y,_=(b=i.getCurrentUnitForType(m.UniverInstanceType.UNIVER_SHEET))==null?void 0:b.getUnitId();jr.includes(T)&&x.unitId===_&&f.next(null)});return()=>v.dispose()})).pipe(Ee.debounceTime(16)).subscribe(()=>{const f=i.getCurrentUnitForType(m.UniverInstanceType.UNIVER_SHEET);if(!f)return;const v=u.getSubunitRules(f.getUnitId(),f.getActiveSheet().getSheetId())||[];h.next(!!v.length)})),d=new Ce.Observable(h=>{const f=Xo(r);l.subscribe(v=>{const y=f.find(T=>T.value===Ie.clearRangeRules);y&&(y.disabled=!v,h.next(f))}),c.subscribe(v=>{const y=f.find(T=>T.value===Ie.clearWorkSheetRules);y&&(y.disabled=!v,h.next(f))}),h.next(f)});return{id:So.id,type:ve.MenuItemType.SELECTOR,group:ve.MenuGroup.TOOLBAR_FORMULAS_INSERT,positions:[ve.MenuPosition.TOOLBAR_START],icon:t,tooltip:r.t("sheet.cf.title"),selections:d,hidden$:ve.getMenuHiddenObservable(n,m.UniverInstanceType.UNIVER_SHEET)}}};function Xo(e){return[{label:e.t("sheet.cf.ruleType.highlightCell"),value:Ie.highlightCell},{label:e.t("sheet.cf.panel.rankAndAverage"),value:Ie.rank},{label:e.t("sheet.cf.ruleType.formula"),value:Ie.formula},{label:e.t("sheet.cf.ruleType.colorScale"),value:Ie.colorScale},{label:e.t("sheet.cf.ruleType.dataBar"),value:Ie.dataBar},{label:e.t("sheet.cf.ruleType.iconSet"),value:Ie.icon},{label:e.t("sheet.cf.menu.manageConditionalFormatting"),value:Ie.viewRule},{label:e.t("sheet.cf.menu.createConditionalFormatting"),value:Ie.createRule},{label:e.t("sheet.cf.menu.clearRangeRules"),value:Ie.clearRangeRules,disabled:!1},{label:e.t("sheet.cf.menu.clearWorkSheetRules"),value:Ie.clearWorkSheetRules}]}var Ae=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function _n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Yo(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 a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}),n}var Lr={exports:{}},zt={};/**
|
|
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 Xo=x,Yo=Symbol.for("react.element"),Ko=Symbol.for("react.fragment"),Zo=Object.prototype.hasOwnProperty,Jo=Xo.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Qo={key:!0,ref:!0,__self:!0,__source:!0};function Lr(e,t,n){var r,a={},o=null,i=null;n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(i=t.ref);for(r in t)Zo.call(t,r)&&!Qo.hasOwnProperty(r)&&(a[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)a[r]===void 0&&(a[r]=t[r]);return{$$typeof:Yo,type:e,key:o,ref:i,props:a,_owner:Jo.current}}Vt.Fragment=Ko,Vt.jsx=Lr,Vt.jsxs=Lr,jr.exports=Vt;var f=jr.exports;const D={conditionalFormattingWrap:"univer-conditional-formatting-wrap",cfRuleItem:"univer-cf-rule-item",preview:"univer-preview",createRule:"univer-create-rule",button:"univer-button",title:"univer-title",label:"univer-label",labelContainer:"univer-label-container",inputWidth:"univer-input-width",mTBase:"univer-m-t-base",mTSm:"univer-m-t-sm",mTXl:"univer-m-t-xl",mLSm:"univer-m-l-sm",mLXl:"univer-m-l-xl",mLXxs:"univer-m-l-xxs",mL0:"univer-m-l-0",mR0:"univer-m-r-0"};var kr={exports:{}},St={},Tn={exports:{}};(function(e,t){(function(n,r){r(t)})(ze,function(n){function r(N){return function(Z,X,Y,oe,ue,Oe,ie){return N(Z,X,ie)}}function a(N){return function(Z,X,Y,oe){if(!Z||!X||typeof Z!="object"||typeof X!="object")return N(Z,X,Y,oe);var ue=oe.get(Z),Oe=oe.get(X);if(ue&&Oe)return ue===X&&Oe===Z;oe.set(Z,X),oe.set(X,Z);var ie=N(Z,X,Y,oe);return oe.delete(Z),oe.delete(X),ie}}function o(N,A){var Z={};for(var X in N)Z[X]=N[X];for(var X in A)Z[X]=A[X];return Z}function i(N){return N.constructor===Object||N.constructor==null}function c(N){return typeof N.then=="function"}function l(N,A){return N===A||N!==N&&A!==A}var u="[object Arguments]",d="[object Boolean]",h="[object Date]",p="[object RegExp]",m="[object Map]",C="[object Number]",b="[object Object]",_="[object Set]",I="[object String]",y=Object.prototype.toString;function S(N){var A=N.areArraysEqual,Z=N.areDatesEqual,X=N.areMapsEqual,Y=N.areObjectsEqual,oe=N.areRegExpsEqual,ue=N.areSetsEqual,Oe=N.createIsNestedEqual,ie=Oe(ke);function ke(ne,se,Ve){if(ne===se)return!0;if(!ne||!se||typeof ne!="object"||typeof se!="object")return ne!==ne&&se!==se;if(i(ne)&&i(se))return Y(ne,se,ie,Ve);var Co=Array.isArray(ne),Ro=Array.isArray(se);if(Co||Ro)return Co===Ro&&A(ne,se,ie,Ve);var Ae=y.call(ne);return Ae!==y.call(se)?!1:Ae===h?Z(ne,se,ie,Ve):Ae===p?oe(ne,se,ie,Ve):Ae===m?X(ne,se,ie,Ve):Ae===_?ue(ne,se,ie,Ve):Ae===b||Ae===u?c(ne)||c(se)?!1:Y(ne,se,ie,Ve):Ae===d||Ae===C||Ae===I?l(ne.valueOf(),se.valueOf()):!1}return ke}function R(N,A,Z,X){var Y=N.length;if(A.length!==Y)return!1;for(;Y-- >0;)if(!Z(N[Y],A[Y],Y,Y,N,A,X))return!1;return!0}var g=a(R);function w(N,A){return l(N.valueOf(),A.valueOf())}function O(N,A,Z,X){var Y=N.size===A.size;if(!Y)return!1;if(!N.size)return!0;var oe={},ue=0;return N.forEach(function(Oe,ie){if(Y){var ke=!1,ne=0;A.forEach(function(se,Ve){!ke&&!oe[ne]&&(ke=Z(ie,Ve,ue,ne,N,A,X)&&Z(Oe,se,ie,Ve,N,A,X))&&(oe[ne]=!0),ne++}),ue++,Y=ke}}),Y}var E=a(O),j="_owner",H=Object.prototype.hasOwnProperty;function $(N,A,Z,X){var Y=Object.keys(N),oe=Y.length;if(Object.keys(A).length!==oe)return!1;for(var ue;oe-- >0;){if(ue=Y[oe],ue===j){var Oe=!!N.$$typeof,ie=!!A.$$typeof;if((Oe||ie)&&Oe!==ie)return!1}if(!H.call(A,ue)||!Z(N[ue],A[ue],ue,ue,N,A,X))return!1}return!0}var ae=a($);function T(N,A){return N.source===A.source&&N.flags===A.flags}function M(N,A,Z,X){var Y=N.size===A.size;if(!Y)return!1;if(!N.size)return!0;var oe={};return N.forEach(function(ue,Oe){if(Y){var ie=!1,ke=0;A.forEach(function(ne,se){!ie&&!oe[ke]&&(ie=Z(ue,ne,Oe,se,N,A,X))&&(oe[ke]=!0),ke++}),Y=ie}}),Y}var te=a(M),xe=Object.freeze({areArraysEqual:R,areDatesEqual:w,areMapsEqual:O,areObjectsEqual:$,areRegExpsEqual:T,areSetsEqual:M,createIsNestedEqual:r}),V=Object.freeze({areArraysEqual:g,areDatesEqual:w,areMapsEqual:E,areObjectsEqual:ae,areRegExpsEqual:T,areSetsEqual:te,createIsNestedEqual:r}),G=S(xe);function ee(N,A){return G(N,A,void 0)}var ce=S(o(xe,{createIsNestedEqual:function(){return l}}));function ge(N,A){return ce(N,A,void 0)}var be=S(V);function Ce(N,A){return be(N,A,new WeakMap)}var Le=S(o(V,{createIsNestedEqual:function(){return l}}));function st(N,A){return Le(N,A,new WeakMap)}function Lt(N){return S(o(xe,N(xe)))}function bd(N){var A=S(o(V,N(V)));return function(Z,X,Y){return Y===void 0&&(Y=new WeakMap),A(Z,X,Y)}}n.circularDeepEqual=Ce,n.circularShallowEqual=st,n.createCustomCircularEqual=bd,n.createCustomEqual=Lt,n.deepEqual=ee,n.sameValueZeroEqual=l,n.shallowEqual=ge,Object.defineProperty(n,"__esModule",{value:!0})})})(Tn,Tn.exports);var _n=Tn.exports,W={},ei=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=ri,W.cloneLayout=Ar,W.cloneLayoutItem=qe,W.collides=At,W.compact=Ur,W.compactItem=Wr,W.compactType=pi,W.correctBounds=Hr,W.fastPositionEqual=ai,W.fastRGLPropsEqual=void 0,W.getAllCollisions=$r,W.getFirstCollision=Xe,W.getLayoutItem=Mn,W.getStatics=Dn,W.modifyLayout=zr,W.moveElement=Ct,W.moveElementAwayFromCollision=En,W.noop=void 0,W.perc=ii,W.resizeItemInDirection=li,W.setTopLeft=ui,W.setTransform=ci,W.sortLayoutItems=Vn,W.sortLayoutItemsByColRow=Xr,W.sortLayoutItemsByRowCol=qr,W.synchronizeLayoutWithChildren=di,W.validateLayout=fi,W.withLayoutItem=ni;var Vr=_n,bt=ti(x);function ti(e){return e&&e.__esModule?e:{default:e}}function xn(e){let t=0,n;for(let r=0,a=e.length;r<a;r++)n=e[r].y+e[r].h,n>t&&(t=n);return t}function Ar(e){const t=Array(e.length);for(let n=0,r=e.length;n<r;n++)t[n]=qe(e[n]);return t}function zr(e,t){const n=Array(e.length);for(let r=0,a=e.length;r<a;r++)t.i===e[r].i?n[r]=t:n[r]=e[r];return n}function ni(e,t,n){let r=Mn(e,t);return r?(r=n(qe(r)),e=zr(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 ri(e,t){return(0,Vr.deepEqual)(bt.default.Children.map(e,n=>n==null?void 0:n.key),bt.default.Children.map(t,n=>n==null?void 0:n.key))&&(0,Vr.deepEqual)(bt.default.Children.map(e,n=>n==null?void 0:n.props["data-grid"]),bt.default.Children.map(t,n=>n==null?void 0:n.props["data-grid"]))}W.fastRGLPropsEqual=ei;function ai(e,t){return e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height}function At(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 Ur(e,t,n,r){const a=Dn(e),o=Vn(e,t),i=Array(e.length);for(let c=0,l=o.length;c<l;c++){let u=qe(o[c]);u.static||(u=Wr(a,u,t,n,o,r),a.push(u)),i[e.indexOf(o[c])]=u,u.moved=!1}return i}const oi={x:"w",y:"h"};function On(e,t,n,r){const a=oi[r];t[r]+=1;const o=e.map(i=>i.i).indexOf(t.i);for(let i=o+1;i<e.length;i++){const c=e[i];if(!c.static){if(c.y>t.y+t.h)break;At(t,c)&&On(e,c,n+t[a],r)}}t[r]=n}function Wr(e,t,n,r,a,o){const i=n==="vertical",c=n==="horizontal";if(i)for(t.y=Math.min(xn(e),t.y);t.y>0&&!Xe(e,t);)t.y--;else if(c)for(;t.x>0&&!Xe(e,t);)t.x--;let l;for(;(l=Xe(e,t))&&!(n===null&&o);)if(c?On(a,t,l.x+l.w,"x"):On(a,t,l.y+l.h,"y"),c&&t.x+t.w>r)for(t.x=r-t.w,t.y++;t.x>0&&!Xe(e,t);)t.x--;return t.y=Math.max(t.y,0),t.x=Math.max(t.x,0),t}function Hr(e,t){const n=Dn(e);for(let r=0,a=e.length;r<a;r++){const o=e[r];if(o.x+o.w>t.cols&&(o.x=t.cols-o.w),o.x<0&&(o.x=0,o.w=t.cols),!o.static)n.push(o);else for(;Xe(n,o);)o.y++}return e}function Mn(e,t){for(let n=0,r=e.length;n<r;n++)if(e[n].i===t)return e[n]}function Xe(e,t){for(let n=0,r=e.length;n<r;n++)if(At(e[n],t))return e[n]}function $r(e,t){return e.filter(n=>At(n,t))}function Dn(e){return e.filter(t=>t.static)}function Ct(e,t,n,r,a,o,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=Vn(e,i);(i==="vertical"&&typeof r=="number"?d>=r:i==="horizontal"&&typeof n=="number"?u>=n:!1)&&(h=h.reverse());const m=$r(h,t),C=m.length>0;if(C&&l)return Ar(e);if(C&&o)return`${t.i}`,t.x=u,t.y=d,t.moved=!1,e;for(let b=0,_=m.length;b<_;b++){const I=m[b];`${t.i}${t.x}${t.y}${I.i}${I.x}${I.y}`,!I.moved&&(I.static?e=En(e,I,t,a,i):e=En(e,t,I,a,i))}return e}function En(e,t,n,r,a,o){const i=a==="horizontal",c=a==="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"},p=Xe(e,h),m=p&&p.y+p.h>t.y,C=p&&t.x+t.w>p.x;if(p){if(m&&c)return Ct(e,n,void 0,t.y+1,r,l,a);if(m&&a==null)return t.y=n.y,n.y=n.y+n.h,e;if(C&&i)return Ct(e,t,n.x,void 0,r,l,a)}else return`${n.i}${h.x}${h.y}`,Ct(e,n,i?h.x:void 0,c?h.y:void 0,r,l,a)}const u=i?n.x+1:void 0,d=c?n.y+1:void 0;return u==null&&d==null?e:Ct(e,n,i?n.x+1:void 0,c?n.y+1:void 0,r,l,a)}function ii(e){return e*100+"%"}const Br=(e,t,n,r)=>e+n>r?t:n,Gr=(e,t,n)=>e<0?t:n,Fr=e=>Math.max(0,e),Pn=e=>Math.max(0,e),Nn=(e,t,n)=>{let{left:r,height:a,width:o}=t;const i=e.top-(a-e.height);return{left:r,width:o,height:Gr(i,e.height,a),top:Pn(i)}},jn=(e,t,n)=>{let{top:r,left:a,height:o,width:i}=t;return{top:r,height:o,width:Br(e.left,e.width,i,n),left:Fr(a)}},Ln=(e,t,n)=>{let{top:r,height:a,width:o}=t;const i=e.left-(o-e.width);return{height:a,width:i<0?e.width:Br(e.left,e.width,o,n),top:Pn(r),left:Fr(i)}},kn=(e,t,n)=>{let{top:r,left:a,height:o,width:i}=t;return{width:i,left:a,height:Gr(r,e.height,o),top:Pn(r)}},si={n:Nn,ne:function(){return Nn(arguments.length<=0?void 0:arguments[0],jn(...arguments))},e:jn,se:function(){return kn(arguments.length<=0?void 0:arguments[0],jn(...arguments))},s:kn,sw:function(){return kn(arguments.length<=0?void 0:arguments[0],Ln(...arguments))},w:Ln,nw:function(){return Nn(arguments.length<=0?void 0:arguments[0],Ln(...arguments))}};function li(e,t,n,r){const a=si[e];return a?a(t,{...t,...n},r):n}function ci(e){let{top:t,left:n,width:r,height:a}=e;const o=`translate(${n}px,${t}px)`;return{transform:o,WebkitTransform:o,MozTransform:o,msTransform:o,OTransform:o,width:`${r}px`,height:`${a}px`,position:"absolute"}}function ui(e){let{top:t,left:n,width:r,height:a}=e;return{top:`${t}px`,left:`${n}px`,width:`${r}px`,height:`${a}px`,position:"absolute"}}function Vn(e,t){return t==="horizontal"?Xr(e):t==="vertical"?qr(e):e}function qr(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 Xr(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 di(e,t,n,r,a){e=e||[];const o=[];bt.default.Children.forEach(t,c=>{if((c==null?void 0:c.key)==null)return;const l=Mn(e,String(c.key)),u=c.props["data-grid"];l&&u==null?o.push(qe(l)):u?o.push(qe({...u,i:c.key})):o.push(qe({w:1,h:1,x:0,y:xn(o),i:String(c.key)}))});const i=Hr(o,{cols:n});return a?i:Ur(i,r,n)}function fi(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,a=e.length;r<a;r++){const o=e[r];for(let i=0;i<n.length;i++)if(typeof o[n[i]]!="number")throw new Error("ReactGridLayout: "+t+"["+r+"]."+n[i]+" must be a number!")}}function pi(e){const{verticalCompact:t,compactType:n}=e||{};return t===!1?null:n}function Bd(){}const hi=()=>{};W.noop=hi;var Ee={};Object.defineProperty(Ee,"__esModule",{value:!0}),Ee.calcGridColWidth=zt,Ee.calcGridItemPosition=gi,Ee.calcGridItemWHPx=An,Ee.calcWH=vi,Ee.calcXY=mi,Ee.clamp=Ye;function zt(e){const{margin:t,containerPadding:n,containerWidth:r,cols:a}=e;return(r-t[0]*(a-1)-n[0]*2)/a}function An(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function gi(e,t,n,r,a,o){const{margin:i,containerPadding:c,rowHeight:l}=e,u=zt(e),d={};return o&&o.resizing?(d.width=Math.round(o.resizing.width),d.height=Math.round(o.resizing.height)):(d.width=An(r,u,i[0]),d.height=An(a,l,i[1])),o&&o.dragging?(d.top=Math.round(o.dragging.top),d.left=Math.round(o.dragging.left)):o&&o.resizing&&typeof o.resizing.top=="number"&&typeof o.resizing.left=="number"?(d.top=Math.round(o.resizing.top),d.left=Math.round(o.resizing.left)):(d.top=Math.round((l+i[1])*n+c[1]),d.left=Math.round((u+i[0])*t+c[0])),d}function mi(e,t,n,r,a){const{margin:o,cols:i,rowHeight:c,maxRows:l}=e,u=zt(e);let d=Math.round((n-o[0])/(u+o[0])),h=Math.round((t-o[1])/(c+o[1]));return d=Ye(d,0,i-r),h=Ye(h,0,l-a),{x:d,y:h}}function vi(e,t,n,r,a,o){const{margin:i,maxRows:c,cols:l,rowHeight:u}=e,d=zt(e);let h=Math.round((t+i[0])/(d+i[0])),p=Math.round((n+i[1])/(u+i[1])),m=Ye(h,0,l-r),C=Ye(p,0,c-a);return["sw","w","nw"].indexOf(o)!==-1&&(m=Ye(h,0,l)),["nw","n","ne"].indexOf(o)!==-1&&(C=Ye(p,0,c)),{w:m,h:C}}function Ye(e,t,n){return Math.max(Math.min(e,n),t)}var Ut={},Yr={exports:{}},yi="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",Si=yi,bi=Si;function Kr(){}function Zr(){}Zr.resetWarningCache=Kr;var Ci=function(){function e(r,a,o,i,c,l){if(l!==bi){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:Zr,resetWarningCache:Kr};return n.PropTypes=n,n};Yr.exports=Ci();var $e=Yr.exports,Wt={exports:{}},Jr={},re={},Pe={};Object.defineProperty(Pe,"__esModule",{value:!0}),Pe.dontSetMe=_i,Pe.findInArray=Ri,Pe.int=Ti,Pe.isFunction=Ii,Pe.isNum=wi;function Ri(e,t){for(let n=0,r=e.length;n<r;n++)if(t.apply(t,[e[n],n,e]))return e[n]}function Ii(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Function]"}function wi(e){return typeof e=="number"&&!isNaN(e)}function Ti(e){return parseInt(e,10)}function _i(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 Ke={};Object.defineProperty(Ke,"__esModule",{value:!0}),Ke.browserPrefixToKey=ea,Ke.browserPrefixToStyle=xi,Ke.default=void 0,Ke.getPrefix=Qr;const zn=["Moz","Webkit","O","ms"];function Qr(){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<zn.length;r++)if(ea(t,zn[r])in n)return zn[r];return""}function ea(e,t){return t?"".concat(t).concat(Oi(e)):e}function xi(e,t){return t?"-".concat(t.toLowerCase(),"-").concat(e):e}function Oi(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}Ke.default=Qr(),Object.defineProperty(re,"__esModule",{value:!0}),re.addClassName=aa,re.addEvent=Ei,re.addUserSelectStyles=Hi,re.createCSSTransform=Ai,re.createSVGTransform=zi,re.getTouch=Ui,re.getTouchIdentifier=Wi,re.getTranslation=Un,re.innerHeight=Li,re.innerWidth=ki,re.matchesSelector=ra,re.matchesSelectorAndParentsTo=Di,re.offsetXYFromParent=Vi,re.outerHeight=Ni,re.outerWidth=ji,re.removeClassName=oa,re.removeEvent=Pi,re.removeUserSelectStyles=$i;var Ie=Pe,ta=Mi(Ke);function na(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(na=function(r){return r?n:t})(e)}function Mi(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=na(t);if(n&&n.has(e))return n.get(e);var r={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(o!=="default"&&Object.prototype.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}let Ht="";function ra(e,t){return Ht||(Ht=(0,Ie.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(n){return(0,Ie.isFunction)(e[n])})),(0,Ie.isFunction)(e[Ht])?e[Ht](t):!1}function Di(e,t,n){let r=e;do{if(ra(r,t))return!0;if(r===n)return!1;r=r.parentNode}while(r);return!1}function Ei(e,t,n,r){if(!e)return;const a={capture:!0,...r};e.addEventListener?e.addEventListener(t,n,a):e.attachEvent?e.attachEvent("on"+t,n):e["on"+t]=n}function Pi(e,t,n,r){if(!e)return;const a={capture:!0,...r};e.removeEventListener?e.removeEventListener(t,n,a):e.detachEvent?e.detachEvent("on"+t,n):e["on"+t]=null}function Ni(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,Ie.int)(n.borderTopWidth),t+=(0,Ie.int)(n.borderBottomWidth),t}function ji(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,Ie.int)(n.borderLeftWidth),t+=(0,Ie.int)(n.borderRightWidth),t}function Li(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,Ie.int)(n.paddingTop),t-=(0,Ie.int)(n.paddingBottom),t}function ki(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,Ie.int)(n.paddingLeft),t-=(0,Ie.int)(n.paddingRight),t}function Vi(e,t,n){const a=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect(),o=(e.clientX+t.scrollLeft-a.left)/n,i=(e.clientY+t.scrollTop-a.top)/n;return{x:o,y:i}}function Ai(e,t){const n=Un(e,t,"px");return{[(0,ta.browserPrefixToKey)("transform",ta.default)]:n}}function zi(e,t){return Un(e,t,"")}function Un(e,t,n){let{x:r,y:a}=e,o="translate(".concat(r).concat(n,",").concat(a).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);o="translate(".concat(i,", ").concat(c,")")+o}return o}function Ui(e,t){return e.targetTouches&&(0,Ie.findInArray)(e.targetTouches,n=>t===n.identifier)||e.changedTouches&&(0,Ie.findInArray)(e.changedTouches,n=>t===n.identifier)}function Wi(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function Hi(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 Ko=w,Zo=Symbol.for("react.element"),Jo=Symbol.for("react.fragment"),Qo=Object.prototype.hasOwnProperty,ei=Ko.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,ti={key:!0,ref:!0,__self:!0,__source:!0};function Vr(e,t,n){var r,a={},o=null,i=null;n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(i=t.ref);for(r in t)Qo.call(t,r)&&!ti.hasOwnProperty(r)&&(a[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)a[r]===void 0&&(a[r]=t[r]);return{$$typeof:Zo,type:e,key:o,ref:i,props:a,_owner:ei.current}}zt.Fragment=Jo,zt.jsx=Vr,zt.jsxs=Vr,Lr.exports=zt;var p=Lr.exports;const D={conditionalFormattingWrap:"univer-conditional-formatting-wrap",cfRuleItem:"univer-cf-rule-item",preview:"univer-preview",createRule:"univer-create-rule",button:"univer-button",title:"univer-title",label:"univer-label",labelContainer:"univer-label-container",inputWidth:"univer-input-width",mTBase:"univer-m-t-base",mTSm:"univer-m-t-sm",mTXl:"univer-m-t-xl",mLSm:"univer-m-l-sm",mLXl:"univer-m-l-xl",mLXxs:"univer-m-l-xxs",mL0:"univer-m-l-0",mR0:"univer-m-r-0"};var Ur={exports:{}},St={},wn={exports:{}};(function(e,t){(function(n,r){r(t)})(Ae,function(n){function r(N){return function(ee,K,Z,oe,de,Oe,ie){return N(ee,K,ie)}}function a(N){return function(ee,K,Z,oe){if(!ee||!K||typeof ee!="object"||typeof K!="object")return N(ee,K,Z,oe);var de=oe.get(ee),Oe=oe.get(K);if(de&&Oe)return de===K&&Oe===ee;oe.set(ee,K),oe.set(K,ee);var ie=N(ee,K,Z,oe);return oe.delete(ee),oe.delete(K),ie}}function o(N,H){var ee={};for(var K in N)ee[K]=N[K];for(var K in H)ee[K]=H[K];return ee}function i(N){return N.constructor===Object||N.constructor==null}function u(N){return typeof N.then=="function"}function l(N,H){return N===H||N!==N&&H!==H}var c="[object Arguments]",d="[object Boolean]",h="[object Date]",f="[object RegExp]",v="[object Map]",y="[object Number]",T="[object Object]",x="[object Set]",_="[object String]",b=Object.prototype.toString;function S(N){var H=N.areArraysEqual,ee=N.areDatesEqual,K=N.areMapsEqual,Z=N.areObjectsEqual,oe=N.areRegExpsEqual,de=N.areSetsEqual,Oe=N.createIsNestedEqual,ie=Oe(Ve);function Ve(re,se,Ue){if(re===se)return!0;if(!re||!se||typeof re!="object"||typeof se!="object")return re!==re&&se!==se;if(i(re)&&i(se))return Z(re,se,ie,Ue);var Ro=Array.isArray(re),Co=Array.isArray(se);if(Ro||Co)return Ro===Co&&H(re,se,ie,Ue);var ze=b.call(re);return ze!==b.call(se)?!1:ze===h?ee(re,se,ie,Ue):ze===f?oe(re,se,ie,Ue):ze===v?K(re,se,ie,Ue):ze===x?de(re,se,ie,Ue):ze===T||ze===c?u(re)||u(se)?!1:Z(re,se,ie,Ue):ze===d||ze===y||ze===_?l(re.valueOf(),se.valueOf()):!1}return Ve}function C(N,H,ee,K){var Z=N.length;if(H.length!==Z)return!1;for(;Z-- >0;)if(!ee(N[Z],H[Z],Z,Z,N,H,K))return!1;return!0}var g=a(C);function O(N,H){return l(N.valueOf(),H.valueOf())}function M(N,H,ee,K){var Z=N.size===H.size;if(!Z)return!1;if(!N.size)return!0;var oe={},de=0;return N.forEach(function(Oe,ie){if(Z){var Ve=!1,re=0;H.forEach(function(se,Ue){!Ve&&!oe[re]&&(Ve=ee(ie,Ue,de,re,N,H,K)&&ee(Oe,se,ie,Ue,N,H,K))&&(oe[re]=!0),re++}),de++,Z=Ve}}),Z}var I=a(M),j="_owner",L=Object.prototype.hasOwnProperty;function U(N,H,ee,K){var Z=Object.keys(N),oe=Z.length;if(Object.keys(H).length!==oe)return!1;for(var de;oe-- >0;){if(de=Z[oe],de===j){var Oe=!!N.$$typeof,ie=!!H.$$typeof;if((Oe||ie)&&Oe!==ie)return!1}if(!L.call(H,de)||!ee(N[de],H[de],de,de,N,H,K))return!1}return!0}var F=a(U);function R(N,H){return N.source===H.source&&N.flags===H.flags}function E(N,H,ee,K){var Z=N.size===H.size;if(!Z)return!1;if(!N.size)return!0;var oe={};return N.forEach(function(de,Oe){if(Z){var ie=!1,Ve=0;H.forEach(function(re,se){!ie&&!oe[Ve]&&(ie=ee(de,re,Oe,se,N,H,K))&&(oe[Ve]=!0),Ve++}),Z=ie}}),Z}var J=a(E),be=Object.freeze({areArraysEqual:C,areDatesEqual:O,areMapsEqual:M,areObjectsEqual:U,areRegExpsEqual:R,areSetsEqual:E,createIsNestedEqual:r}),z=Object.freeze({areArraysEqual:g,areDatesEqual:O,areMapsEqual:I,areObjectsEqual:F,areRegExpsEqual:R,areSetsEqual:J,createIsNestedEqual:r}),q=S(be);function ne(N,H){return q(N,H,void 0)}var ce=S(o(be,{createIsNestedEqual:function(){return l}}));function me(N,H){return ce(N,H,void 0)}var Te=S(z);function Re(N,H){return Te(N,H,new WeakMap)}var Le=S(o(z,{createIsNestedEqual:function(){return l}}));function st(N,H){return Le(N,H,new WeakMap)}function Vt(N){return S(o(be,N(be)))}function Rd(N){var H=S(o(z,N(z)));return function(ee,K,Z){return Z===void 0&&(Z=new WeakMap),H(ee,K,Z)}}n.circularDeepEqual=Re,n.circularShallowEqual=st,n.createCustomCircularEqual=Rd,n.createCustomEqual=Vt,n.deepEqual=ne,n.sameValueZeroEqual=l,n.shallowEqual=me,Object.defineProperty(n,"__esModule",{value:!0})})})(wn,wn.exports);var In=wn.exports,B={},ni=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(B,"__esModule",{value:!0}),B.bottom=xn,B.childrenEqual=oi,B.cloneLayout=Ar,B.cloneLayoutItem=qe,B.collides=At,B.compact=kr,B.compactItem=Wr,B.compactType=mi,B.correctBounds=$r,B.fastPositionEqual=ii,B.fastRGLPropsEqual=void 0,B.getAllCollisions=Br,B.getFirstCollision=Xe,B.getLayoutItem=En,B.getStatics=Mn,B.modifyLayout=Hr,B.moveElement=Tt,B.moveElementAwayFromCollision=Dn,B.noop=void 0,B.perc=li,B.resizeItemInDirection=ci,B.setTopLeft=fi,B.setTransform=di,B.sortLayoutItems=Un,B.sortLayoutItemsByColRow=Yr,B.sortLayoutItemsByRowCol=Xr,B.synchronizeLayoutWithChildren=pi,B.validateLayout=hi,B.withLayoutItem=ai;var zr=In,bt=ri(w);function ri(e){return e&&e.__esModule?e:{default:e}}function xn(e){let t=0,n;for(let r=0,a=e.length;r<a;r++)n=e[r].y+e[r].h,n>t&&(t=n);return t}function Ar(e){const t=Array(e.length);for(let n=0,r=e.length;n<r;n++)t[n]=qe(e[n]);return t}function Hr(e,t){const n=Array(e.length);for(let r=0,a=e.length;r<a;r++)t.i===e[r].i?n[r]=t:n[r]=e[r];return n}function ai(e,t,n){let r=En(e,t);return r?(r=n(qe(r)),e=Hr(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 oi(e,t){return(0,zr.deepEqual)(bt.default.Children.map(e,n=>n==null?void 0:n.key),bt.default.Children.map(t,n=>n==null?void 0:n.key))&&(0,zr.deepEqual)(bt.default.Children.map(e,n=>n==null?void 0:n.props["data-grid"]),bt.default.Children.map(t,n=>n==null?void 0:n.props["data-grid"]))}B.fastRGLPropsEqual=ni;function ii(e,t){return e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height}function At(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 kr(e,t,n,r){const a=Mn(e),o=Un(e,t),i=Array(e.length);for(let u=0,l=o.length;u<l;u++){let c=qe(o[u]);c.static||(c=Wr(a,c,t,n,o,r),a.push(c)),i[e.indexOf(o[u])]=c,c.moved=!1}return i}const si={x:"w",y:"h"};function On(e,t,n,r){const a=si[r];t[r]+=1;const o=e.map(i=>i.i).indexOf(t.i);for(let i=o+1;i<e.length;i++){const u=e[i];if(!u.static){if(u.y>t.y+t.h)break;At(t,u)&&On(e,u,n+t[a],r)}}t[r]=n}function Wr(e,t,n,r,a,o){const i=n==="vertical",u=n==="horizontal";if(i)for(t.y=Math.min(xn(e),t.y);t.y>0&&!Xe(e,t);)t.y--;else if(u)for(;t.x>0&&!Xe(e,t);)t.x--;let l;for(;(l=Xe(e,t))&&!(n===null&&o);)if(u?On(a,t,l.x+l.w,"x"):On(a,t,l.y+l.h,"y"),u&&t.x+t.w>r)for(t.x=r-t.w,t.y++;t.x>0&&!Xe(e,t);)t.x--;return t.y=Math.max(t.y,0),t.x=Math.max(t.x,0),t}function $r(e,t){const n=Mn(e);for(let r=0,a=e.length;r<a;r++){const o=e[r];if(o.x+o.w>t.cols&&(o.x=t.cols-o.w),o.x<0&&(o.x=0,o.w=t.cols),!o.static)n.push(o);else for(;Xe(n,o);)o.y++}return e}function En(e,t){for(let n=0,r=e.length;n<r;n++)if(e[n].i===t)return e[n]}function Xe(e,t){for(let n=0,r=e.length;n<r;n++)if(At(e[n],t))return e[n]}function Br(e,t){return e.filter(n=>At(n,t))}function Mn(e){return e.filter(t=>t.static)}function Tt(e,t,n,r,a,o,i,u,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 c=t.x,d=t.y;typeof n=="number"&&(t.x=n),typeof r=="number"&&(t.y=r),t.moved=!0;let h=Un(e,i);(i==="vertical"&&typeof r=="number"?d>=r:i==="horizontal"&&typeof n=="number"?c>=n:!1)&&(h=h.reverse());const v=Br(h,t),y=v.length>0;if(y&&l)return Ar(e);if(y&&o)return`${t.i}`,t.x=c,t.y=d,t.moved=!1,e;for(let T=0,x=v.length;T<x;T++){const _=v[T];`${t.i}${t.x}${t.y}${_.i}${_.x}${_.y}`,!_.moved&&(_.static?e=Dn(e,_,t,a,i):e=Dn(e,t,_,a,i))}return e}function Dn(e,t,n,r,a,o){const i=a==="horizontal",u=a==="vertical",l=t.static;if(r){r=!1;const h={x:i?Math.max(t.x-n.w,0):n.x,y:u?Math.max(t.y-n.h,0):n.y,w:n.w,h:n.h,i:"-1"},f=Xe(e,h),v=f&&f.y+f.h>t.y,y=f&&t.x+t.w>f.x;if(f){if(v&&u)return Tt(e,n,void 0,t.y+1,r,l,a);if(v&&a==null)return t.y=n.y,n.y=n.y+n.h,e;if(y&&i)return Tt(e,t,n.x,void 0,r,l,a)}else return`${n.i}${h.x}${h.y}`,Tt(e,n,i?h.x:void 0,u?h.y:void 0,r,l,a)}const c=i?n.x+1:void 0,d=u?n.y+1:void 0;return c==null&&d==null?e:Tt(e,n,i?n.x+1:void 0,u?n.y+1:void 0,r,l,a)}function li(e){return e*100+"%"}const Fr=(e,t,n,r)=>e+n>r?t:n,Gr=(e,t,n)=>e<0?t:n,qr=e=>Math.max(0,e),Pn=e=>Math.max(0,e),Nn=(e,t,n)=>{let{left:r,height:a,width:o}=t;const i=e.top-(a-e.height);return{left:r,width:o,height:Gr(i,e.height,a),top:Pn(i)}},jn=(e,t,n)=>{let{top:r,left:a,height:o,width:i}=t;return{top:r,height:o,width:Fr(e.left,e.width,i,n),left:qr(a)}},Ln=(e,t,n)=>{let{top:r,height:a,width:o}=t;const i=e.left-(o-e.width);return{height:a,width:i<0?e.width:Fr(e.left,e.width,o,n),top:Pn(r),left:qr(i)}},Vn=(e,t,n)=>{let{top:r,left:a,height:o,width:i}=t;return{width:i,left:a,height:Gr(r,e.height,o),top:Pn(r)}},ui={n:Nn,ne:function(){return Nn(arguments.length<=0?void 0:arguments[0],jn(...arguments))},e:jn,se:function(){return Vn(arguments.length<=0?void 0:arguments[0],jn(...arguments))},s:Vn,sw:function(){return Vn(arguments.length<=0?void 0:arguments[0],Ln(...arguments))},w:Ln,nw:function(){return Nn(arguments.length<=0?void 0:arguments[0],Ln(...arguments))}};function ci(e,t,n,r){const a=ui[e];return a?a(t,{...t,...n},r):n}function di(e){let{top:t,left:n,width:r,height:a}=e;const o=`translate(${n}px,${t}px)`;return{transform:o,WebkitTransform:o,MozTransform:o,msTransform:o,OTransform:o,width:`${r}px`,height:`${a}px`,position:"absolute"}}function fi(e){let{top:t,left:n,width:r,height:a}=e;return{top:`${t}px`,left:`${n}px`,width:`${r}px`,height:`${a}px`,position:"absolute"}}function Un(e,t){return t==="horizontal"?Yr(e):t==="vertical"?Xr(e):e}function Xr(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 Yr(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 pi(e,t,n,r,a){e=e||[];const o=[];bt.default.Children.forEach(t,u=>{if((u==null?void 0:u.key)==null)return;const l=En(e,String(u.key)),c=u.props["data-grid"];l&&c==null?o.push(qe(l)):c?o.push(qe({...c,i:u.key})):o.push(qe({w:1,h:1,x:0,y:xn(o),i:String(u.key)}))});const i=$r(o,{cols:n});return a?i:kr(i,r,n)}function hi(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,a=e.length;r<a;r++){const o=e[r];for(let i=0;i<n.length;i++)if(typeof o[n[i]]!="number")throw new Error("ReactGridLayout: "+t+"["+r+"]."+n[i]+" must be a number!")}}function mi(e){const{verticalCompact:t,compactType:n}=e||{};return t===!1?null:n}function Gd(){}const gi=()=>{};B.noop=gi;var De={};Object.defineProperty(De,"__esModule",{value:!0}),De.calcGridColWidth=Ht,De.calcGridItemPosition=vi,De.calcGridItemWHPx=zn,De.calcWH=Si,De.calcXY=yi,De.clamp=Ye;function Ht(e){const{margin:t,containerPadding:n,containerWidth:r,cols:a}=e;return(r-t[0]*(a-1)-n[0]*2)/a}function zn(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function vi(e,t,n,r,a,o){const{margin:i,containerPadding:u,rowHeight:l}=e,c=Ht(e),d={};return o&&o.resizing?(d.width=Math.round(o.resizing.width),d.height=Math.round(o.resizing.height)):(d.width=zn(r,c,i[0]),d.height=zn(a,l,i[1])),o&&o.dragging?(d.top=Math.round(o.dragging.top),d.left=Math.round(o.dragging.left)):o&&o.resizing&&typeof o.resizing.top=="number"&&typeof o.resizing.left=="number"?(d.top=Math.round(o.resizing.top),d.left=Math.round(o.resizing.left)):(d.top=Math.round((l+i[1])*n+u[1]),d.left=Math.round((c+i[0])*t+u[0])),d}function yi(e,t,n,r,a){const{margin:o,cols:i,rowHeight:u,maxRows:l}=e,c=Ht(e);let d=Math.round((n-o[0])/(c+o[0])),h=Math.round((t-o[1])/(u+o[1]));return d=Ye(d,0,i-r),h=Ye(h,0,l-a),{x:d,y:h}}function Si(e,t,n,r,a,o){const{margin:i,maxRows:u,cols:l,rowHeight:c}=e,d=Ht(e);let h=Math.round((t+i[0])/(d+i[0])),f=Math.round((n+i[1])/(c+i[1])),v=Ye(h,0,l-r),y=Ye(f,0,u-a);return["sw","w","nw"].indexOf(o)!==-1&&(v=Ye(h,0,l)),["nw","n","ne"].indexOf(o)!==-1&&(y=Ye(f,0,u)),{w:v,h:y}}function Ye(e,t,n){return Math.max(Math.min(e,n),t)}var kt={},Kr={exports:{}},bi="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",Ti=bi,Ri=Ti;function Zr(){}function Jr(){}Jr.resetWarningCache=Zr;var Ci=function(){function e(r,a,o,i,u,l){if(l!==Ri){var c=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 c.name="Invariant Violation",c}}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:Jr,resetWarningCache:Zr};return n.PropTypes=n,n};Kr.exports=Ci();var $e=Kr.exports,Wt={exports:{}},Qr={},ae={},Pe={};Object.defineProperty(Pe,"__esModule",{value:!0}),Pe.dontSetMe=Oi,Pe.findInArray=_i,Pe.int=xi,Pe.isFunction=wi,Pe.isNum=Ii;function _i(e,t){for(let n=0,r=e.length;n<r;n++)if(t.apply(t,[e[n],n,e]))return e[n]}function wi(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Function]"}function Ii(e){return typeof e=="number"&&!isNaN(e)}function xi(e){return parseInt(e,10)}function Oi(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 Ke={};Object.defineProperty(Ke,"__esModule",{value:!0}),Ke.browserPrefixToKey=ta,Ke.browserPrefixToStyle=Ei,Ke.default=void 0,Ke.getPrefix=ea;const An=["Moz","Webkit","O","ms"];function ea(){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<An.length;r++)if(ta(t,An[r])in n)return An[r];return""}function ta(e,t){return t?"".concat(t).concat(Mi(e)):e}function Ei(e,t){return t?"-".concat(t.toLowerCase(),"-").concat(e):e}function Mi(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}Ke.default=ea(),Object.defineProperty(ae,"__esModule",{value:!0}),ae.addClassName=oa,ae.addEvent=Ni,ae.addUserSelectStyles=Bi,ae.createCSSTransform=Hi,ae.createSVGTransform=ki,ae.getTouch=Wi,ae.getTouchIdentifier=$i,ae.getTranslation=Hn,ae.innerHeight=Ui,ae.innerWidth=zi,ae.matchesSelector=aa,ae.matchesSelectorAndParentsTo=Pi,ae.offsetXYFromParent=Ai,ae.outerHeight=Li,ae.outerWidth=Vi,ae.removeClassName=ia,ae.removeEvent=ji,ae.removeUserSelectStyles=Fi;var _e=Pe,na=Di(Ke);function ra(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(ra=function(r){return r?n:t})(e)}function Di(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=ra(t);if(n&&n.has(e))return n.get(e);var r={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(o!=="default"&&Object.prototype.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}let $t="";function aa(e,t){return $t||($t=(0,_e.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(n){return(0,_e.isFunction)(e[n])})),(0,_e.isFunction)(e[$t])?e[$t](t):!1}function Pi(e,t,n){let r=e;do{if(aa(r,t))return!0;if(r===n)return!1;r=r.parentNode}while(r);return!1}function Ni(e,t,n,r){if(!e)return;const a={capture:!0,...r};e.addEventListener?e.addEventListener(t,n,a):e.attachEvent?e.attachEvent("on"+t,n):e["on"+t]=n}function ji(e,t,n,r){if(!e)return;const a={capture:!0,...r};e.removeEventListener?e.removeEventListener(t,n,a):e.detachEvent?e.detachEvent("on"+t,n):e["on"+t]=null}function Li(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,_e.int)(n.borderTopWidth),t+=(0,_e.int)(n.borderBottomWidth),t}function Vi(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,_e.int)(n.borderLeftWidth),t+=(0,_e.int)(n.borderRightWidth),t}function Ui(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,_e.int)(n.paddingTop),t-=(0,_e.int)(n.paddingBottom),t}function zi(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,_e.int)(n.paddingLeft),t-=(0,_e.int)(n.paddingRight),t}function Ai(e,t,n){const a=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect(),o=(e.clientX+t.scrollLeft-a.left)/n,i=(e.clientY+t.scrollTop-a.top)/n;return{x:o,y:i}}function Hi(e,t){const n=Hn(e,t,"px");return{[(0,na.browserPrefixToKey)("transform",na.default)]:n}}function ki(e,t){return Hn(e,t,"")}function Hn(e,t,n){let{x:r,y:a}=e,o="translate(".concat(r).concat(n,",").concat(a).concat(n,")");if(t){const i="".concat(typeof t.x=="string"?t.x:t.x+n),u="".concat(typeof t.y=="string"?t.y:t.y+n);o="translate(".concat(i,", ").concat(u,")")+o}return o}function Wi(e,t){return e.targetTouches&&(0,_e.findInArray)(e.targetTouches,n=>t===n.identifier)||e.changedTouches&&(0,_e.findInArray)(e.changedTouches,n=>t===n.identifier)}function $i(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function Bi(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&&aa(e.body,"react-draggable-transparent-selection")}function $i(e){if(e)try{if(e.body&&oa(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 aa(e,t){e.classList?e.classList.add(t):e.className.match(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)")))||(e.className+=" ".concat(t))}function oa(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)"),"g"),"")}var Ne={};Object.defineProperty(Ne,"__esModule",{value:!0}),Ne.canDragX=Fi,Ne.canDragY=qi,Ne.createCoreData=Yi,Ne.createDraggableData=Ki,Ne.getBoundPosition=Bi,Ne.getControlPosition=Xi,Ne.snapToGrid=Gi;var we=Pe,lt=re;function Bi(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r=="string"?r:Zi(r);const a=Wn(e);if(typeof r=="string"){const{ownerDocument:o}=a,i=o.defaultView;let c;if(r==="parent"?c=a.parentNode:c=o.querySelector(r),!(c instanceof i.HTMLElement))throw new Error('Bounds selector "'+r+'" could not find an element.');const l=c,u=i.getComputedStyle(a),d=i.getComputedStyle(l);r={left:-a.offsetLeft+(0,we.int)(d.paddingLeft)+(0,we.int)(u.marginLeft),top:-a.offsetTop+(0,we.int)(d.paddingTop)+(0,we.int)(u.marginTop),right:(0,lt.innerWidth)(l)-(0,lt.outerWidth)(a)-a.offsetLeft+(0,we.int)(d.paddingRight)-(0,we.int)(u.marginRight),bottom:(0,lt.innerHeight)(l)-(0,lt.outerHeight)(a)-a.offsetTop+(0,we.int)(d.paddingBottom)-(0,we.int)(u.marginBottom)}}return(0,we.isNum)(r.right)&&(t=Math.min(t,r.right)),(0,we.isNum)(r.bottom)&&(n=Math.min(n,r.bottom)),(0,we.isNum)(r.left)&&(t=Math.max(t,r.left)),(0,we.isNum)(r.top)&&(n=Math.max(n,r.top)),[t,n]}function Gi(e,t,n){const r=Math.round(t/e[0])*e[0],a=Math.round(n/e[1])*e[1];return[r,a]}function Fi(e){return e.props.axis==="both"||e.props.axis==="x"}function qi(e){return e.props.axis==="both"||e.props.axis==="y"}function Xi(e,t,n){const r=typeof t=="number"?(0,lt.getTouch)(e,t):null;if(typeof t=="number"&&!r)return null;const a=Wn(n),o=n.props.offsetParent||a.offsetParent||a.ownerDocument.body;return(0,lt.offsetXYFromParent)(r||e,o,n.props.scale)}function Yi(e,t,n){const r=!(0,we.isNum)(e.lastX),a=Wn(e);return r?{node:a,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:a,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}}function Ki(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 Zi(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function Wn(e){const t=e.findDOMNode();if(!t)throw new Error("<DraggableCore>: Unmounted during event!");return t}var $t={},Bt={};Object.defineProperty(Bt,"__esModule",{value:!0}),Bt.default=Ji;function Ji(){}Object.defineProperty($t,"__esModule",{value:!0}),$t.default=void 0;var Hn=es(x),ye=Bn($e),Qi=Bn(Tr),pe=re,Be=Ne,$n=Pe,Rt=Bn(Bt);function Bn(e){return e&&e.__esModule?e:{default:e}}function ia(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(ia=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=ia(t);if(n&&n.has(e))return n.get(e);var r={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(o!=="default"&&Object.prototype.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}function me(e,t,n){return t=ts(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ts(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)}const De={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let Ge=De.mouse,Gt=class extends Hn.Component{constructor(){super(...arguments),me(this,"dragging",!1),me(this,"lastX",NaN),me(this,"lastY",NaN),me(this,"touchIdentifier",null),me(this,"mounted",!1),me(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 a=(0,pe.getTouchIdentifier)(t);this.touchIdentifier=a;const o=(0,Be.getControlPosition)(t,a,this);if(o==null)return;const{x:i,y:c}=o,l=(0,Be.createCoreData)(this,i,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,pe.addUserSelectStyles)(r),this.dragging=!0,this.lastX=i,this.lastY=c,(0,pe.addEvent)(r,Ge.move,this.handleDrag),(0,pe.addEvent)(r,Ge.stop,this.handleDragStop))}),me(this,"handleDrag",t=>{const n=(0,Be.getControlPosition)(t,this.touchIdentifier,this);if(n==null)return;let{x:r,y:a}=n;if(Array.isArray(this.props.grid)){let c=r-this.lastX,l=a-this.lastY;if([c,l]=(0,Be.snapToGrid)(this.props.grid,c,l),!c&&!l)return;r=this.lastX+c,a=this.lastY+l}const o=(0,Be.createCoreData)(this,r,a);if((0,Rt.default)("DraggableCore: handleDrag: %j",o),this.props.onDrag(t,o)===!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=a}),me(this,"handleDragStop",t=>{if(!this.dragging)return;const n=(0,Be.getControlPosition)(t,this.touchIdentifier,this);if(n==null)return;let{x:r,y:a}=n;if(Array.isArray(this.props.grid)){let l=r-this.lastX||0,u=a-this.lastY||0;[l,u]=(0,Be.snapToGrid)(this.props.grid,l,u),r=this.lastX+l,a=this.lastY+u}const o=(0,Be.createCoreData)(this,r,a);if(this.props.onStop(t,o)===!1||this.mounted===!1)return!1;const c=this.findDOMNode();c&&this.props.enableUserSelectHack&&(0,pe.removeUserSelectStyles)(c.ownerDocument),(0,Rt.default)("DraggableCore: handleDragStop: %j",o),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,c&&((0,Rt.default)("DraggableCore: Removing handlers"),(0,pe.removeEvent)(c.ownerDocument,Ge.move,this.handleDrag),(0,pe.removeEvent)(c.ownerDocument,Ge.stop,this.handleDragStop))}),me(this,"onMouseDown",t=>(Ge=De.mouse,this.handleDragStart(t))),me(this,"onMouseUp",t=>(Ge=De.mouse,this.handleDragStop(t))),me(this,"onTouchStart",t=>(Ge=De.touch,this.handleDragStart(t))),me(this,"onTouchEnd",t=>(Ge=De.touch,this.handleDragStop(t)))}componentDidMount(){this.mounted=!0;const t=this.findDOMNode();t&&(0,pe.addEvent)(t,De.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const t=this.findDOMNode();if(t){const{ownerDocument:n}=t;(0,pe.removeEvent)(n,De.mouse.move,this.handleDrag),(0,pe.removeEvent)(n,De.touch.move,this.handleDrag),(0,pe.removeEvent)(n,De.mouse.stop,this.handleDragStop),(0,pe.removeEvent)(n,De.touch.stop,this.handleDragStop),(0,pe.removeEvent)(t,De.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:Qi.default.findDOMNode(this)}render(){return Hn.cloneElement(Hn.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};$t.default=Gt,me(Gt,"displayName","DraggableCore"),me(Gt,"propTypes",{allowAnyClick:ye.default.bool,children:ye.default.node.isRequired,disabled:ye.default.bool,enableUserSelectHack:ye.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:ye.default.arrayOf(ye.default.number),handle:ye.default.string,cancel:ye.default.string,nodeRef:ye.default.object,onStart:ye.default.func,onDrag:ye.default.func,onStop:ye.default.func,onMouseDown:ye.default.func,scale:ye.default.number,className:$n.dontSetMe,style:$n.dontSetMe,transform:$n.dontSetMe}),me(Gt,"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=p(x),n=d($e),r=d(Tr),a=d(He),o=re,i=Ne,c=Pe,l=d($t),u=d(Bt);function d(y){return y&&y.__esModule?y:{default:y}}function h(y){if(typeof WeakMap!="function")return null;var S=new WeakMap,R=new WeakMap;return(h=function(g){return g?R:S})(y)}function p(y,S){if(!S&&y&&y.__esModule)return y;if(y===null||typeof y!="object"&&typeof y!="function")return{default:y};var R=h(S);if(R&&R.has(y))return R.get(y);var g={},w=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in y)if(O!=="default"&&Object.prototype.hasOwnProperty.call(y,O)){var E=w?Object.getOwnPropertyDescriptor(y,O):null;E&&(E.get||E.set)?Object.defineProperty(g,O,E):g[O]=y[O]}return g.default=y,R&&R.set(y,g),g}function m(){return m=Object.assign?Object.assign.bind():function(y){for(var S=1;S<arguments.length;S++){var R=arguments[S];for(var g in R)Object.prototype.hasOwnProperty.call(R,g)&&(y[g]=R[g])}return y},m.apply(this,arguments)}function C(y,S,R){return S=b(S),S in y?Object.defineProperty(y,S,{value:R,enumerable:!0,configurable:!0,writable:!0}):y[S]=R,y}function b(y){var S=_(y,"string");return typeof S=="symbol"?S:String(S)}function _(y,S){if(typeof y!="object"||y===null)return y;var R=y[Symbol.toPrimitive];if(R!==void 0){var g=R.call(y,S||"default");if(typeof g!="object")return g;throw new TypeError("@@toPrimitive must return a primitive value.")}return(S==="string"?String:Number)(y)}class I extends t.Component{static getDerivedStateFromProps(S,R){let{position:g}=S,{prevPropsPosition:w}=R;return g&&(!w||g.x!==w.x||g.y!==w.y)?((0,u.default)("Draggable: getDerivedStateFromProps %j",{position:g,prevPropsPosition:w}),{x:g.x,y:g.y,prevPropsPosition:{...g}}):null}constructor(S){super(S),C(this,"onDragStart",(R,g)=>{if((0,u.default)("Draggable: onDragStart: %j",g),this.props.onStart(R,(0,i.createDraggableData)(this,g))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),C(this,"onDrag",(R,g)=>{if(!this.state.dragging)return!1;(0,u.default)("Draggable: onDrag: %j",g);const w=(0,i.createDraggableData)(this,g),O={x:w.x,y:w.y,slackX:0,slackY:0};if(this.props.bounds){const{x:j,y:H}=O;O.x+=this.state.slackX,O.y+=this.state.slackY;const[$,ae]=(0,i.getBoundPosition)(this,O.x,O.y);O.x=$,O.y=ae,O.slackX=this.state.slackX+(j-O.x),O.slackY=this.state.slackY+(H-O.y),w.x=O.x,w.y=O.y,w.deltaX=O.x-this.state.x,w.deltaY=O.y-this.state.y}if(this.props.onDrag(R,w)===!1)return!1;this.setState(O)}),C(this,"onDragStop",(R,g)=>{if(!this.state.dragging||this.props.onStop(R,(0,i.createDraggableData)(this,g))===!1)return!1;(0,u.default)("Draggable: onDragStop: %j",g);const O={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:j,y:H}=this.props.position;O.x=j,O.y=H}this.setState(O)}),this.state={dragging:!1,dragged:!1,x:S.position?S.position.x:S.defaultPosition.x,y:S.position?S.position.y:S.defaultPosition.y,prevPropsPosition:{...S.position},slackX:0,slackY:0,isElementSVG:!1},S.position&&!(S.onDrag||S.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 S,R;return(S=(R=this.props)===null||R===void 0||(R=R.nodeRef)===null||R===void 0?void 0:R.current)!==null&&S!==void 0?S:r.default.findDOMNode(this)}render(){const{axis:S,bounds:R,children:g,defaultPosition:w,defaultClassName:O,defaultClassNameDragging:E,defaultClassNameDragged:j,position:H,positionOffset:$,scale:ae,...T}=this.props;let M={},te=null;const V=!!!H||this.state.dragging,G=H||w,ee={x:(0,i.canDragX)(this)&&V?this.state.x:G.x,y:(0,i.canDragY)(this)&&V?this.state.y:G.y};this.state.isElementSVG?te=(0,o.createSVGTransform)(ee,$):M=(0,o.createCSSTransform)(ee,$);const ce=(0,a.default)(g.props.className||"",O,{[E]:this.state.dragging,[j]:this.state.dragged});return t.createElement(l.default,m({},T,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),t.cloneElement(t.Children.only(g),{className:ce,style:{...g.props.style,...M},transform:te}))}}e.default=I,C(I,"displayName","Draggable"),C(I,"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}),C(I,"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})}(Jr);const{default:sa,DraggableCore:rs}=Jr;Wt.exports=sa,Wt.exports.default=sa,Wt.exports.DraggableCore=rs;var la=Wt.exports,Ft={exports:{}},It={},Gn={};Gn.__esModule=!0,Gn.cloneElement=cs;var as=os(x);function os(e){return e&&e.__esModule?e:{default:e}}function ca(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ua(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ca(Object(n),!0).forEach(function(r){is(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ca(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function is(e,t,n){return t=ss(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ss(e){var t=ls(e,"string");return typeof t=="symbol"?t:String(t)}function ls(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 cs(e,t){return t.style&&e.props.style&&(t.style=ua(ua({},e.props.style),t.style)),t.className&&e.props.className&&(t.className=e.props.className+" "+t.className),as.default.cloneElement(e,t)}var wt={};wt.__esModule=!0,wt.resizableProps=void 0;var z=us($e);function us(e){return e&&e.__esModule?e:{default:e}}var ds={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 a=n[0];if(a.axis==="both"||a.axis==="y"){var o;return(o=z.default.number).isRequired.apply(o,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 a=n[0];if(a.axis==="both"||a.axis==="x"){var o;return(o=z.default.number).isRequired.apply(o,n)}return z.default.number.apply(z.default,n)}};wt.resizableProps=ds,It.__esModule=!0,It.default=void 0;var Tt=ms(x),fs=la,ps=Gn,hs=wt,gs=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function da(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(da=function(a){return a?n:t})(e)}function ms(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=da(t);if(n&&n.has(e))return n.get(e);var r={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(o!=="default"&&Object.prototype.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}function Fn(){return Fn=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},Fn.apply(this,arguments)}function vs(e,t){if(e==null)return{};var n={},r=Object.keys(e),a,o;for(o=0;o<r.length;o++)a=r[o],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}function fa(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function qn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?fa(Object(n),!0).forEach(function(r){ys(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fa(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ys(e,t,n){return t=Ss(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ss(e){var t=bs(e,"string");return typeof t=="symbol"?t:String(t)}function bs(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 Cs(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Xn(e,t)}function Xn(e,t){return Xn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},Xn(e,t)}var Yn=function(e){Cs(t,e);function t(){for(var r,a=arguments.length,o=new Array(a),i=0;i<a;i++)o[i]=arguments[i];return r=e.call.apply(e,[this].concat(o))||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(a,o){var i=this.props,c=i.minConstraints,l=i.maxConstraints,u=i.lockAspectRatio;if(!c&&!l&&!u)return[a,o];if(u){var d=this.props.width/this.props.height,h=a-this.props.width,p=o-this.props.height;Math.abs(h)>Math.abs(p*d)?o=a/d:a=o*d}var m=a,C=o,b=this.slack||[0,0],_=b[0],I=b[1];return a+=_,o+=I,c&&(a=Math.max(c[0],a),o=Math.max(c[1],o)),l&&(a=Math.min(l[0],a),o=Math.min(l[1],o)),this.slack=[_+(m-a),I+(C-o)],[a,o]},n.resizeHandler=function(a,o){var i=this;return function(c,l){var u=l.node,d=l.deltaX,h=l.deltaY;a==="onResizeStart"&&i.resetData();var p=(i.props.axis==="both"||i.props.axis==="x")&&o!=="n"&&o!=="s",m=(i.props.axis==="both"||i.props.axis==="y")&&o!=="e"&&o!=="w";if(!(!p&&!m)){var C=o[0],b=o[o.length-1],_=u.getBoundingClientRect();if(i.lastHandleRect!=null){if(b==="w"){var I=_.left-i.lastHandleRect.left;d+=I}if(C==="n"){var y=_.top-i.lastHandleRect.top;h+=y}}i.lastHandleRect=_,b==="w"&&(d=-d),C==="n"&&(h=-h);var S=i.props.width+(p?d/i.props.transformScale:0),R=i.props.height+(m?h/i.props.transformScale:0),g=i.runConstraints(S,R);S=g[0],R=g[1];var w=S!==i.props.width||R!==i.props.height,O=typeof i.props[a]=="function"?i.props[a]:null,E=a==="onResize"&&!w;O&&!E&&(c.persist==null||c.persist(),O(c,{node:u,size:{width:S,height:R},handle:o})),a==="onResizeStop"&&i.resetData()}}},n.renderResizeHandle=function(a,o){var i=this.props.handle;if(!i)return Tt.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+a,ref:o});if(typeof i=="function")return i(a,o);var c=typeof i.type=="string",l=qn({ref:o},c?{}:{handleAxis:a});return Tt.cloneElement(i,l)},n.render=function(){var a=this,o=this.props,i=o.children,c=o.className,l=o.draggableOpts;o.width,o.height,o.handle,o.handleSize,o.lockAspectRatio,o.axis,o.minConstraints,o.maxConstraints,o.onResize,o.onResizeStop,o.onResizeStart;var u=o.resizeHandles;o.transformScale;var d=vs(o,gs);return(0,ps.cloneElement)(i,qn(qn({},d),{},{className:(c?c+" ":"")+"react-resizable",children:[].concat(i.props.children,u.map(function(h){var p,m=(p=a.handleRefs[h])!=null?p:a.handleRefs[h]=Tt.createRef();return Tt.createElement(fs.DraggableCore,Fn({},l,{nodeRef:m,key:"resizableHandle-"+h,onStop:a.resizeHandler("onResizeStop",h),onStart:a.resizeHandler("onResizeStart",h),onDrag:a.resizeHandler("onResize",h)}),a.renderResizeHandle(h,m))}))}))},t}(Tt.Component);It.default=Yn,Yn.propTypes=hs.resizableProps,Yn.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1};var qt={};qt.__esModule=!0,qt.default=void 0;var Kn=_s(x),Rs=pa($e),Is=pa(It),ws=wt,Ts=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function pa(e){return e&&e.__esModule?e:{default:e}}function ha(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(ha=function(a){return a?n:t})(e)}function _s(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=ha(t);if(n&&n.has(e))return n.get(e);var r={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(o!=="default"&&Object.prototype.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}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 ga(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Xt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ga(Object(n),!0).forEach(function(r){xs(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ga(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function xs(e,t,n){return t=Os(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Os(e){var t=Ms(e,"string");return typeof t=="symbol"?t:String(t)}function Ms(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){if(e==null)return{};var n={},r=Object.keys(e),a,o;for(o=0;o<r.length;o++)a=r[o],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}function Es(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Jn(e,t)}function Jn(e,t){return Jn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},Jn(e,t)}var ma=function(e){Es(t,e);function t(){for(var r,a=arguments.length,o=new Array(a),i=0;i<a;i++)o[i]=arguments[i];return r=e.call.apply(e,[this].concat(o))||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(a,o){return o.propsWidth!==a.width||o.propsHeight!==a.height?{width:a.width,height:a.height,propsWidth:a.width,propsHeight:a.height}:null};var n=t.prototype;return n.render=function(){var a=this.props,o=a.handle,i=a.handleSize;a.onResize;var c=a.onResizeStart,l=a.onResizeStop,u=a.draggableOpts,d=a.minConstraints,h=a.maxConstraints,p=a.lockAspectRatio,m=a.axis;a.width,a.height;var C=a.resizeHandles,b=a.style,_=a.transformScale,I=Ds(a,Ts);return Kn.createElement(Is.default,{axis:m,draggableOpts:u,handle:o,handleSize:i,height:this.state.height,lockAspectRatio:p,maxConstraints:h,minConstraints:d,onResizeStart:c,onResize:this.onResize,onResizeStop:l,resizeHandles:C,transformScale:_,width:this.state.width},Kn.createElement("div",Zn({},I,{style:Xt(Xt({},b),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},t}(Kn.Component);qt.default=ma,ma.propTypes=Xt(Xt({},ws.resizableProps),{},{children:Rs.default.element}),Ft.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")},Ft.exports.Resizable=It.default,Ft.exports.ResizableBox=qt.default;var Ps=Ft.exports,Ue={};Object.defineProperty(Ue,"__esModule",{value:!0}),Ue.resizeHandleType=Ue.resizeHandleAxesType=Ue.default=void 0;var U=va($e),Ns=va(x);function va(e){return e&&e.__esModule?e:{default:e}}const js=Ue.resizeHandleAxesType=U.default.arrayOf(U.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),Ls=Ue.resizeHandleType=U.default.oneOfType([U.default.node,U.default.func]);Ue.default={className:U.default.string,style:U.default.object,width:U.default.number,autoSize:U.default.bool,cols:U.default.number,draggableCancel:U.default.string,draggableHandle:U.default.string,verticalCompact:function(e){e.verticalCompact},compactType:U.default.oneOf(["vertical","horizontal"]),layout:function(e){var t=e.layout;t!==void 0&&W.validateLayout(t,"layout")},margin:U.default.arrayOf(U.default.number),containerPadding:U.default.arrayOf(U.default.number),rowHeight:U.default.number,maxRows:U.default.number,isBounded:U.default.bool,isDraggable:U.default.bool,isResizable:U.default.bool,allowOverlap:U.default.bool,preventCollision:U.default.bool,useCSSTransforms:U.default.bool,transformScale:U.default.number,isDroppable:U.default.bool,resizeHandles:js,resizeHandle:Ls,onLayoutChange:U.default.func,onDragStart:U.default.func,onDrag:U.default.func,onDragStop:U.default.func,onResizeStart:U.default.func,onResize:U.default.func,onResizeStop:U.default.func,onDrop:U.default.func,droppingItem:U.default.shape({i:U.default.string.isRequired,w:U.default.number.isRequired,h:U.default.number.isRequired}),children:function(e,t){const n=e[t],r={};Ns.default.Children.forEach(n,function(a){if((a==null?void 0:a.key)!=null){if(r[a.key])throw new Error('Duplicate child key "'+a.key+'" found! This will cause problems in ReactGridLayout.');r[a.key]=!0}})},innerRef:U.default.any},Object.defineProperty(Ut,"__esModule",{value:!0}),Ut.default=void 0;var ct=Qn(x),q=Qn($e),ks=la,Vs=Ps,ut=W,de=Ee,ya=Ue,As=Qn(He);function Qn(e){return e&&e.__esModule?e:{default:e}}function je(e,t,n){return t=zs(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zs(e){var t=Us(e,"string");return typeof t=="symbol"?t:String(t)}function Us(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 er extends ct.default.Component{constructor(){super(...arguments),je(this,"state",{resizing:null,dragging:null,className:""}),je(this,"elementRef",ct.default.createRef()),je(this,"onDragStart",(t,n)=>{let{node:r}=n;const{onDragStart:a,transformScale:o}=this.props;if(!a)return;const i={top:0,left:0},{offsetParent:c}=r;if(!c)return;const l=c.getBoundingClientRect(),u=r.getBoundingClientRect(),d=u.left/o,h=l.left/o,p=u.top/o,m=l.top/o;i.left=d-h+c.scrollLeft,i.top=p-m+c.scrollTop,this.setState({dragging:i});const{x:C,y:b}=(0,de.calcXY)(this.getPositionParams(),i.top,i.left,this.props.w,this.props.h);return a.call(this,this.props.i,C,b,{e:t,node:r,newPosition:i})}),je(this,"onDrag",(t,n)=>{let{node:r,deltaX:a,deltaY:o}=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+o,l=this.state.dragging.left+a;const{isBounded:u,i:d,w:h,h:p,containerWidth:m}=this.props,C=this.getPositionParams();if(u){const{offsetParent:S}=r;if(S){const{margin:R,rowHeight:g,containerPadding:w}=this.props,O=S.clientHeight-(0,de.calcGridItemWHPx)(p,g,R[1]);c=(0,de.clamp)(c-w[1],0,O);const E=(0,de.calcGridColWidth)(C),j=m-(0,de.calcGridItemWHPx)(h,E,R[0]);l=(0,de.clamp)(l-w[0],0,j)}}const b={top:c,left:l};this.setState({dragging:b});const{containerPadding:_}=this.props,{x:I,y}=(0,de.calcXY)(C,c-_[1],l-_[0],h,p);return i.call(this,d,I,y,{e:t,node:r,newPosition:b})}),je(this,"onDragStop",(t,n)=>{let{node:r}=n;const{onDragStop:a}=this.props;if(!a)return;if(!this.state.dragging)throw new Error("onDragEnd called before onDragStart.");const{w:o,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:p,y:m}=(0,de.calcXY)(this.getPositionParams(),d-l[1],u-l[0],o,i);return a.call(this,c,p,m,{e:t,node:r,newPosition:h})}),je(this,"onResizeStop",(t,n,r)=>this.onResizeHandler(t,n,r,"onResizeStop")),je(this,"onResizeStart",(t,n,r)=>this.onResizeHandler(t,n,r,"onResizeStart")),je(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),a=(0,de.calcGridItemPosition)(this.getPositionParams(t),t.x,t.y,t.w,t.h,n);return!(0,ut.fastPositionEqual)(r,a)||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 a=t.droppingPosition||{left:0,top:0},{dragging:o}=this.state,i=o&&n.left!==a.left||n.top!==a.top;if(!o)this.onDragStart(n.e,{node:r,deltaX:n.left,deltaY:n.top});else if(i){const c=n.left-o.left,l=n.top-o.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:a}=this.props;let o;return a?o=(0,ut.setTransform)(t):(o=(0,ut.setTopLeft)(t),n&&(o.left=(0,ut.perc)(t.left/r),o.width=(0,ut.perc)(t.width/r))),o}mixinDraggable(t,n){return ct.default.createElement(ks.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,a)=>n(r,a,t)}mixinResizable(t,n,r){const{cols:a,minW:o,minH:i,maxW:c,maxH:l,transformScale:u,resizeHandles:d,resizeHandle:h}=this.props,p=this.getPositionParams(),m=(0,de.calcGridItemPosition)(p,0,0,a,0).width,C=(0,de.calcGridItemPosition)(p,0,0,o,i),b=(0,de.calcGridItemPosition)(p,0,0,c,l),_=[C.width,C.height],I=[Math.min(b.width,m),Math.min(b.height,1/0)];return ct.default.createElement(Vs.Resizable,{draggableOpts:{disabled:!r},className:r?void 0:"react-resizable-hide",width:n.width,height:n.height,minConstraints:_,maxConstraints:I,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,a){let{node:o,size:i,handle:c}=n;const l=this.props[a];if(!l)return;const{x:u,y:d,i:h,maxH:p,minH:m,containerWidth:C}=this.props,{minW:b,maxW:_}=this.props;let I=i;o&&(I=(0,ut.resizeItemInDirection)(c,r,i,C),this.setState({resizing:a==="onResizeStop"?null:I}));let{w:y,h:S}=(0,de.calcWH)(this.getPositionParams(),I.width,I.height,u,d,c);y=(0,de.clamp)(y,Math.max(b,1),_),S=(0,de.clamp)(S,m,p),l.call(this,h,y,S,{e:t,node:o,size:I,handle:c})}render(){const{x:t,y:n,w:r,h:a,isDraggable:o,isResizable:i,droppingPosition:c,useCSSTransforms:l}=this.props,u=(0,de.calcGridItemPosition)(this.getPositionParams(),t,n,r,a,this.state),d=ct.default.Children.only(this.props.children);let h=ct.default.cloneElement(d,{ref:this.elementRef,className:(0,As.default)("react-grid-item",d.props.className,this.props.className,{static:this.props.static,resizing:!!this.state.resizing,"react-draggable":o,"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,o),h}}Ut.default=er,je(er,"propTypes",{children:q.default.element,cols:q.default.number.isRequired,containerWidth:q.default.number.isRequired,rowHeight:q.default.number.isRequired,margin:q.default.array.isRequired,maxRows:q.default.number.isRequired,containerPadding:q.default.array.isRequired,x:q.default.number.isRequired,y:q.default.number.isRequired,w:q.default.number.isRequired,h:q.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:q.default.string.isRequired,resizeHandles:ya.resizeHandleAxesType,resizeHandle:ya.resizeHandleType,onDragStop:q.default.func,onDragStart:q.default.func,onDrag:q.default.func,onResizeStop:q.default.func,onResizeStart:q.default.func,onResize:q.default.func,isDraggable:q.default.bool.isRequired,isResizable:q.default.bool.isRequired,isBounded:q.default.bool.isRequired,static:q.default.bool,useCSSTransforms:q.default.bool.isRequired,transformScale:q.default.number,className:q.default.string,handle:q.default.string,cancel:q.default.string,droppingPosition:q.default.shape({e:q.default.object.isRequired,left:q.default.number.isRequired,top:q.default.number.isRequired})}),je(er,"defaultProps",{className:"",cancel:"",handle:"",minH:1,minW:1,maxH:1/0,maxW:1/0,transformScale:1}),Object.defineProperty(St,"__esModule",{value:!0}),St.default=void 0;var Ze=Bs(x),tr=_n,Ws=nr(He),k=W,Hs=Ee,Sa=nr(Ut),$s=nr(Ue);function nr(e){return e&&e.__esModule?e:{default:e}}function ba(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(ba=function(r){return r?n:t})(e)}function Bs(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=ba(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(o!=="default"&&Object.prototype.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}function he(e,t,n){return t=Gs(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Gs(e){var t=Fs(e,"string");return typeof t=="symbol"?t:String(t)}function Fs(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 Ca="react-grid-layout";let Ra=!1;try{Ra=/firefox/i.test(navigator.userAgent)}catch{}class Yt extends Ze.Component{constructor(){super(...arguments),he(this,"state",{activeDrag:null,layout:(0,k.synchronizeLayoutWithChildren)(this.props.layout,this.props.children,this.props.cols,(0,k.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,a)=>{let{e:o,node:i}=a;const{layout:c}=this.state,l=(0,k.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,k.cloneLayoutItem)(l),oldLayout:c,activeDrag:u}),this.props.onDragStart(c,l,l,null,o,i)}),he(this,"onDrag",(t,n,r,a)=>{let{e:o,node:i}=a;const{oldDragItem:c}=this.state;let{layout:l}=this.state;const{cols:u,allowOverlap:d,preventCollision:h}=this.props,p=(0,k.getLayoutItem)(l,t);if(!p)return;const m={w:p.w,h:p.h,x:p.x,y:p.y,placeholder:!0,i:t};l=(0,k.moveElement)(l,p,n,r,!0,h,(0,k.compactType)(this.props),u,d),this.props.onDrag(l,c,p,m,o,i),this.setState({layout:d?l:(0,k.compact)(l,(0,k.compactType)(this.props),u),activeDrag:m})}),he(this,"onDragStop",(t,n,r,a)=>{let{e:o,node:i}=a;if(!this.state.activeDrag)return;const{oldDragItem:c}=this.state;let{layout:l}=this.state;const{cols:u,preventCollision:d,allowOverlap:h}=this.props,p=(0,k.getLayoutItem)(l,t);if(!p)return;l=(0,k.moveElement)(l,p,n,r,!0,d,(0,k.compactType)(this.props),u,h);const C=h?l:(0,k.compact)(l,(0,k.compactType)(this.props),u);this.props.onDragStop(C,c,p,null,o,i);const{oldLayout:b}=this.state;this.setState({activeDrag:null,layout:C,oldDragItem:null,oldLayout:null}),this.onLayoutMaybeChanged(C,b)}),he(this,"onResizeStart",(t,n,r,a)=>{let{e:o,node:i}=a;const{layout:c}=this.state,l=(0,k.getLayoutItem)(c,t);l&&(this.setState({oldResizeItem:(0,k.cloneLayoutItem)(l),oldLayout:this.state.layout,resizing:!0}),this.props.onResizeStart(c,l,l,null,o,i))}),he(this,"onResize",(t,n,r,a)=>{let{e:o,node:i,size:c,handle:l}=a;const{oldResizeItem:u}=this.state,{layout:d}=this.state,{cols:h,preventCollision:p,allowOverlap:m}=this.props;let C=!1,b,_,I;const[y,S]=(0,k.withLayoutItem)(d,t,g=>{let w;return _=g.x,I=g.y,["sw","w","nw","n","ne"].indexOf(l)!==-1&&(["sw","nw","w"].indexOf(l)!==-1&&(_=g.x+(g.w-n),n=g.x!==_&&_<0?g.w:n,_=_<0?0:_),["ne","n","nw"].indexOf(l)!==-1&&(I=g.y+(g.h-r),r=g.y!==I&&I<0?g.h:r,I=I<0?0:I),C=!0),p&&!m&&(w=(0,k.getAllCollisions)(d,{...g,w:n,h:r,x:_,y:I}).filter(E=>E.i!==g.i).length>0,w&&(I=g.y,r=g.h,_=g.x,n=g.w,C=!1)),g.w=n,g.h=r,g});if(!S)return;b=y,C&&(b=(0,k.moveElement)(y,S,_,I,!0,this.props.preventCollision,(0,k.compactType)(this.props),h,m));const R={w:S.w,h:S.h,x:S.x,y:S.y,static:!0,i:t};this.props.onResize(b,u,S,R,o,i),this.setState({layout:m?b:(0,k.compact)(b,(0,k.compactType)(this.props),h),activeDrag:R})}),he(this,"onResizeStop",(t,n,r,a)=>{let{e:o,node:i}=a;const{layout:c,oldResizeItem:l}=this.state,{cols:u,allowOverlap:d}=this.props,h=(0,k.getLayoutItem)(c,t),p=d?c:(0,k.compact)(c,(0,k.compactType)(this.props),u);this.props.onResizeStop(p,l,h,null,o,i);const{oldLayout:m}=this.state;this.setState({activeDrag:null,layout:p,oldResizeItem:null,oldLayout:null,resizing:!1}),this.onLayoutMaybeChanged(p,m)}),he(this,"onDragOver",t=>{var y;if(t.preventDefault(),t.stopPropagation(),Ra&&!((y=t.nativeEvent.target)!=null&&y.classList.contains(Ca)))return!1;const{droppingItem:n,onDropDragOver:r,margin:a,cols:o,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 p={...n,...h},{layout:m}=this.state,C=t.currentTarget.getBoundingClientRect(),b=t.clientX-C.left,_=t.clientY-C.top,I={left:b/d,top:_/d,e:t};if(this.state.droppingDOMNode){if(this.state.droppingPosition){const{left:S,top:R}=this.state.droppingPosition;(S!=b||R!=_)&&this.setState({droppingPosition:I})}}else{const S={cols:o,margin:a,maxRows:c,rowHeight:i,containerWidth:l,containerPadding:u||a},R=(0,Hs.calcXY)(S,_,b,p.w,p.h);this.setState({droppingDOMNode:Ze.createElement("div",{key:p.i}),droppingPosition:I,layout:[...m,{...p,x:R.x,y:R.y,static:!1,isDraggable:!0}]})}}),he(this,"removeDroppingPlaceholder",()=>{const{droppingItem:t,cols:n}=this.props,{layout:r}=this.state,a=(0,k.compact)(r.filter(o=>o.i!==t.i),(0,k.compactType)(this.props),n,this.props.allowOverlap);this.setState({layout:a,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,a=r.find(o=>o.i===n.i);this.dragEnterCounter=0,this.removeDroppingPlaceholder(),this.props.onDrop(r,a,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,tr.deepEqual)(t.layout,n.propsLayout)||t.compactType!==n.compactType?r=t.layout:(0,k.childrenEqual)(t.children,n.children)||(r=n.layout),r?{layout:(0,k.synchronizeLayoutWithChildren)(r,t.children,t.cols,(0,k.compactType)(t),t.allowOverlap),compactType:t.compactType,children:t.children,propsLayout:t.layout}:null)}shouldComponentUpdate(t,n){return this.props.children!==t.children||!(0,k.fastRGLPropsEqual)(this.props,t,tr.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,a=n.layout;this.onLayoutMaybeChanged(r,a)}}containerHeight(){if(!this.props.autoSize)return;const t=(0,k.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,tr.deepEqual)(n,t)||this.props.onLayoutChange(t)}placeholder(){const{activeDrag:t}=this.state;if(!t)return null;const{width:n,cols:r,margin:a,containerPadding:o,rowHeight:i,maxRows:c,useCSSTransforms:l,transformScale:u}=this.props;return Ze.createElement(Sa.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:a,containerPadding:o||a,maxRows:c,rowHeight:i,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,k.getLayoutItem)(this.state.layout,String(t.key));if(!r)return null;const{width:a,cols:o,margin:i,containerPadding:c,rowHeight:l,maxRows:u,isDraggable:d,isResizable:h,isBounded:p,useCSSTransforms:m,transformScale:C,draggableCancel:b,draggableHandle:_,resizeHandles:I,resizeHandle:y}=this.props,{mounted:S,droppingPosition:R}=this.state,g=typeof r.isDraggable=="boolean"?r.isDraggable:!r.static&&d,w=typeof r.isResizable=="boolean"?r.isResizable:!r.static&&h,O=r.resizeHandles||I,E=g&&p&&r.isBounded!==!1;return Ze.createElement(Sa.default,{containerWidth:a,cols:o,margin:i,containerPadding:c||i,maxRows:u,rowHeight:l,cancel:b,handle:_,onDragStop:this.onDragStop,onDragStart:this.onDragStart,onDrag:this.onDrag,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,isDraggable:g,isResizable:w,isBounded:E,useCSSTransforms:m&&S,usePercentages:!S,transformScale:C,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:O,resizeHandle:y},t)}render(){const{className:t,style:n,isDroppable:r,innerRef:a}=this.props,o=(0,Ws.default)(Ca,t),i={height:this.containerHeight(),...n};return Ze.createElement("div",{ref:a,className:o,style:i,onDrop:r?this.onDrop:k.noop,onDragLeave:r?this.onDragLeave:k.noop,onDragEnter:r?this.onDragEnter:k.noop,onDragOver:r?this.onDragOver:k.noop},Ze.Children.map(this.props.children,c=>this.processGridItem(c)),r&&this.state.droppingDOMNode&&this.processGridItem(this.state.droppingDOMNode,!0),this.placeholder())}}St.default=Yt,he(Yt,"displayName","ReactGridLayout"),he(Yt,"propTypes",$s.default),he(Yt,"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:k.noop,onDragStart:k.noop,onDrag:k.noop,onDragStop:k.noop,onResizeStart:k.noop,onResize:k.noop,onResizeStop:k.noop,onDrop:k.noop,onDropDragOver:k.noop});var Kt={},Je={};Object.defineProperty(Je,"__esModule",{value:!0}),Je.findOrGenerateResponsiveLayout=Ys,Je.getBreakpointFromWidth=qs,Je.getColsFromBreakpoint=Xs,Je.sortBreakpoints=rr;var Zt=W;function qs(e,t){const n=rr(e);let r=n[0];for(let a=1,o=n.length;a<o;a++){const i=n[a];t>e[i]&&(r=i)}return r}function Xs(e,t){if(!t[e])throw new Error("ResponsiveReactGridLayout: `cols` entry for breakpoint "+e+" is missing!");return t[e]}function Ys(e,t,n,r,a,o){if(e[n])return(0,Zt.cloneLayout)(e[n]);let i=e[r];const c=rr(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,Zt.cloneLayout)(i||[]),(0,Zt.compact)((0,Zt.correctBounds)(i,{cols:a}),o,a)}function rr(e){return Object.keys(e).sort(function(n,r){return e[n]-e[r]})}Object.defineProperty(Kt,"__esModule",{value:!0}),Kt.default=void 0;var Ia=Zs(x),Se=wa($e),ar=_n,dt=W,Qe=Je,Ks=wa(St);function wa(e){return e&&e.__esModule?e:{default:e}}function Ta(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(Ta=function(r){return r?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=Ta(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(o!=="default"&&Object.prototype.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}function or(){return or=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},or.apply(this,arguments)}function Jt(e,t,n){return t=Js(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Js(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)}const _a=e=>Object.prototype.toString.call(e);function Qt(e,t){return e==null?null:Array.isArray(e)?e:e[t]}class ir extends Ia.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:a}=this.props,o=(0,Qe.getBreakpointFromWidth)(n,t),i=(0,Qe.getColsFromBreakpoint)(o,a),c=this.props.verticalCompact===!1?null:this.props.compactType;return{layout:(0,Qe.findOrGenerateResponsiveLayout)(r,n,o,o,i,c),breakpoint:o,cols:i}}static getDerivedStateFromProps(t,n){if(!(0,ar.deepEqual)(t.layouts,n.layouts)){const{breakpoint:r,cols:a}=n;return{layout:(0,Qe.findOrGenerateResponsiveLayout)(t.layouts,t.breakpoints,r,r,a,t.compactType),layouts:t.layouts}}return null}componentDidUpdate(t){(this.props.width!=t.width||this.props.breakpoint!==t.breakpoint||!(0,ar.deepEqual)(this.props.breakpoints,t.breakpoints)||!(0,ar.deepEqual)(this.props.cols,t.cols))&&this.onWidthChange(t)}onWidthChange(t){const{breakpoints:n,cols:r,layouts:a,compactType:o}=this.props,i=this.props.breakpoint||(0,Qe.getBreakpointFromWidth)(this.props.breakpoints,this.props.width),c=this.state.breakpoint,l=(0,Qe.getColsFromBreakpoint)(i,r),u={...a};if(c!==i||t.breakpoints!==n||t.cols!==r){c in u||(u[c]=(0,dt.cloneLayout)(this.state.layout));let p=(0,Qe.findOrGenerateResponsiveLayout)(u,n,i,c,l,o);p=(0,dt.synchronizeLayoutWithChildren)(p,this.props.children,l,o,this.props.allowOverlap),u[i]=p,this.props.onLayoutChange(p,u),this.props.onBreakpointChange(i,l),this.setState({breakpoint:i,layout:p,cols:l})}const d=Qt(this.props.margin,i),h=Qt(this.props.containerPadding,i);this.props.onWidthChange(this.props.width,d,l,h)}render(){const{breakpoint:t,breakpoints:n,cols:r,layouts:a,margin:o,containerPadding:i,onBreakpointChange:c,onLayoutChange:l,onWidthChange:u,...d}=this.props;return Ia.createElement(Ks.default,or({},d,{margin:Qt(o,this.state.breakpoint),containerPadding:Qt(i,this.state.breakpoint),onLayoutChange:this.onLayoutChange,layout:this.state.layout,cols:this.state.cols}))}}Kt.default=ir,Jt(ir,"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(_a(e[t])!=="[object Object]")throw new Error("Layout property must be an object. Received: "+_a(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,dt.validateLayout)(e.layouts[n],"layouts."+n)})},width:Se.default.number.isRequired,onBreakpointChange:Se.default.func,onLayoutChange:Se.default.func,onWidthChange:Se.default.func}),Jt(ir,"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:dt.noop,onLayoutChange:dt.noop,onWidthChange:dt.noop});var sr={},xa=function(){if(typeof Map<"u")return Map;function e(t,n){var r=-1;return t.some(function(a,o){return a[0]===n?(r=o,!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),a=this.__entries__[r];return a&&a[1]},t.prototype.set=function(n,r){var a=e(this.__entries__,n);~a?this.__entries__[a][1]=r:this.__entries__.push([n,r])},t.prototype.delete=function(n){var r=this.__entries__,a=e(r,n);~a&&r.splice(a,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 a=0,o=this.__entries__;a<o.length;a++){var i=o[a];n.call(r,i[1],i[0])}},t}()}(),lr=typeof window<"u"&&typeof document<"u"&&window.document===document,en=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")()}(),el=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(en):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)}}(),tl=2;function nl(e,t){var n=!1,r=!1,a=0;function o(){n&&(n=!1,e()),r&&c()}function i(){el(o)}function c(){var l=Date.now();if(n){if(l-a<tl)return;r=!0}else n=!0,r=!1,setTimeout(i,t);a=l}return c}var rl=20,al=["top","right","bottom","left","width","height","size","weight"],ol=typeof MutationObserver<"u",il=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=nl(this.refresh.bind(this),rl)}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(){!lr||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),ol?(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(){!lr||!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,a=al.some(function(o){return!!~r.indexOf(o)});a&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),Oa=function(e,t){for(var n=0,r=Object.keys(t);n<r.length;n++){var a=r[n];Object.defineProperty(e,a,{value:t[a],enumerable:!1,writable:!1,configurable:!0})}return e},ft=function(e){var t=e&&e.ownerDocument&&e.ownerDocument.defaultView;return t||en},Ma=nn(0,0,0,0);function tn(e){return parseFloat(e)||0}function Da(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return t.reduce(function(r,a){var o=e["border-"+a+"-width"];return r+tn(o)},0)}function sl(e){for(var t=["top","right","bottom","left"],n={},r=0,a=t;r<a.length;r++){var o=a[r],i=e["padding-"+o];n[o]=tn(i)}return n}function ll(e){var t=e.getBBox();return nn(0,0,t.width,t.height)}function cl(e){var t=e.clientWidth,n=e.clientHeight;if(!t&&!n)return Ma;var r=ft(e).getComputedStyle(e),a=sl(r),o=a.left+a.right,i=a.top+a.bottom,c=tn(r.width),l=tn(r.height);if(r.boxSizing==="border-box"&&(Math.round(c+o)!==t&&(c-=Da(r,"left","right")+o),Math.round(l+i)!==n&&(l-=Da(r,"top","bottom")+i)),!dl(e)){var u=Math.round(c+o)-t,d=Math.round(l+i)-n;Math.abs(u)!==1&&(c-=u),Math.abs(d)!==1&&(l-=d)}return nn(a.left,a.top,c,l)}var ul=function(){return typeof SVGGraphicsElement<"u"?function(e){return e instanceof ft(e).SVGGraphicsElement}:function(e){return e instanceof ft(e).SVGElement&&typeof e.getBBox=="function"}}();function dl(e){return e===ft(e).document.documentElement}function fl(e){return lr?ul(e)?ll(e):cl(e):Ma}function pl(e){var t=e.x,n=e.y,r=e.width,a=e.height,o=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,i=Object.create(o.prototype);return Oa(i,{x:t,y:n,width:r,height:a,top:n,right:t+r,bottom:a+n,left:t}),i}function nn(e,t,n,r){return{x:e,y:t,width:n,height:r}}var hl=function(){function e(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=nn(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}(),gl=function(){function e(t,n){var r=pl(n);Oa(this,{target:t,contentRect:r})}return e}(),ml=function(){function e(t,n,r){if(this.activeObservations_=[],this.observations_=new xa,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 ft(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(t)||(n.set(t,new hl(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 ft(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 gl(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}(),Ea=typeof WeakMap<"u"?new WeakMap:new xa,Pa=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=il.getInstance(),r=new ml(t,n,this);Ea.set(this,r)}return e}();["observe","unobserve","disconnect"].forEach(function(e){Pa.prototype[e]=function(){var t;return(t=Ea.get(this))[e].apply(t,arguments)}});var vl=function(){return typeof en.ResizeObserver<"u"?en.ResizeObserver:Pa}();const yl=qo(Object.freeze(Object.defineProperty({__proto__:null,default:vl},Symbol.toStringTag,{value:"Module"})));Object.defineProperty(sr,"__esModule",{value:!0}),sr.default=_l;var rn=Rl(x),Sl=cr($e),bl=cr(yl),Cl=cr(He);function cr(e){return e&&e.__esModule?e:{default:e}}function Na(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(Na=function(r){return r?n:t})(e)}function Rl(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=Na(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(o!=="default"&&Object.prototype.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}function ur(){return ur=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},ur.apply(this,arguments)}function pt(e,t,n){return t=Il(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Il(e){var t=wl(e,"string");return typeof t=="symbol"?t:String(t)}function wl(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 Tl="react-grid-layout";function _l(e){var t;return t=class extends rn.Component{constructor(){super(...arguments),pt(this,"state",{width:1280}),pt(this,"elementRef",rn.createRef()),pt(this,"mounted",!1),pt(this,"resizeObserver",void 0)}componentDidMount(){this.mounted=!0,this.resizeObserver=new bl.default(a=>{if(this.elementRef.current instanceof HTMLElement){const i=a[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,...a}=this.props;return r&&!this.mounted?rn.createElement("div",{className:(0,Cl.default)(this.props.className,Tl),style:this.props.style,ref:this.elementRef}):rn.createElement(e,ur({innerRef:this.elementRef},a,this.state))}},pt(t,"defaultProps",{measureBeforeMount:!1}),pt(t,"propTypes",{measureBeforeMount:Sl.default.bool}),t}(function(e){e.exports=St.default,e.exports.utils=W,e.exports.calculateUtils=Ee,e.exports.Responsive=Kt.default,e.exports.Responsive.utils=Je,e.exports.WidthProvider=sr.default})(kr);var xl=kr.exports;const Ol=wn(xl),dr={type:v.CommandType.COMMAND,id:"sheet.command.delete-conditional-rule",handler(e,t){var p,m;if(!t)return!1;const n=e.get(v.IUndoRedoService),r=e.get(v.ICommandService),o=e.get(v.IUniverInstanceService).getCurrentUniverSheetInstance(),i=o.getActiveSheet(),c=(p=t.unitId)!=null?p:o.getUnitId(),l=(m=t.subUnitId)!=null?m:i.getSheetId(),u={unitId:c,subUnitId:l,cfId:t.cfId},d=s.DeleteConditionalRuleMutationUndoFactory(e,u),h=r.syncExecuteCommand(s.DeleteConditionalRuleMutation.id,u);return h&&n.pushUndoRedo({unitID:c,undoMutations:d,redoMutations:[{id:s.DeleteConditionalRuleMutation.id,params:u}]}),h}},ja={type:v.CommandType.COMMAND,id:"sheet.command.move-conditional-rule",handler(e,t){var _,I;if(!t)return!1;const n=e.get(v.IUndoRedoService),r=e.get(v.ICommandService),a=e.get(v.IUniverInstanceService),o=e.get(s.ConditionalFormattingRuleModel),i=a.getCurrentUniverSheetInstance(),c=i.getActiveSheet(),l=(_=t.unitId)!=null?_:i.getUnitId(),u=(I=t.subUnitId)!=null?I:c.getSheetId(),d=s.transformSupportSymmetryAnchor(t.start,t.end,o.getSubunitRules(l,u)||[],y=>y.cfId);if(!d)return!1;const[h,p]=d,m={unitId:l,subUnitId:u,start:h,end:p},C=s.MoveConditionalRuleMutationUndoFactory(m),b=r.syncExecuteCommand(s.MoveConditionalRuleMutation.id,m);return b&&n.pushUndoRedo({unitID:l,redoMutations:[{id:s.MoveConditionalRuleMutation.id,params:m}],undoMutations:C}),b}},an={cfPreview:"univer-cf-preview"},ht=e=>{var a,o;const t=e.rule;if(!t)return null;const n=x.useMemo(()=>{if(t.type===s.CFRuleType.colorScale){const i=t.config.map((u,d)=>({color:new v.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=x.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 f.jsxs("div",{className:an.cfPreview,children:[f.jsx("div",{style:{...c,background:u,border:`1px solid ${t.config.nativeColor}`}}),f.jsx("div",{style:{...c,background:l,border:`1px solid ${t.config.positiveColor}`}})]})}case s.CFRuleType.colorScale:return n&&f.jsx("div",{className:an.cfPreview,children:n.map((i,c)=>f.jsx("div",{style:{width:`${100/n.length}%`,height:"100%",background:i}},c))});case s.CFRuleType.iconSet:return r&&f.jsx("div",{className:an.cfPreview,children:r.map((i,c)=>i?f.jsx("img",{style:{height:"100%"},src:i},c):f.jsx(kt,{},c))});case s.CFRuleType.highlightCell:{const{ul:i,st:c,it:l,bl:u,bg:d,cl:h}=t.style,p=(i==null?void 0:i.s)===v.BooleanNumber.TRUE,m=(c==null?void 0:c.s)===v.BooleanNumber.TRUE,C=l===v.BooleanNumber.TRUE,b=u===v.BooleanNumber.TRUE,_=(a=d==null?void 0:d.rgb)!=null?a:s.DEFAULT_BG_COLOR,I=(o=h==null?void 0:h.rgb)!=null?o:s.DEFAULT_FONT_COLOR,y={fontWeight:b?"bold":void 0,fontStyle:C?"italic":void 0,textDecoration:`${p?"underline":""} ${m?"line-through":""}`.replace(/^ /,"")||void 0,backgroundColor:_,color:I};return f.jsx("div",{style:y,className:an.cfPreview,children:"123"})}}return null},Ml={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"}}}},La={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:"无"}}}};var Dl=Object.defineProperty,El=Object.getOwnPropertyDescriptor,Pl=(e,t,n,r)=>{for(var a=r>1?void 0:r?El(t,n):t,o=e.length-1,i;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&Dl(t,n,a),a},Nl=(e,t)=>(n,r)=>t(n,r,e);let _t=class extends v.Disposable{constructor(t){super();yt(this,"_initLocal",()=>{this._localeService.load({zhCN:La})});yt(this,"_findReplaceIndex",t=>{const n=/\{([^}]+)?\}/g,r=[];let a=n.exec(t);for(;a;)r.push({startIndex:a.index,key:Number(a[1]),endIndex:a.index+a[0].length-1}),a=n.exec(t);return r});this._localeService=t,this._initLocal()}tWithReactNode(t,...n){const r=this._localeService.getLocales(),a=t.split("."),o=r&&this._localeService.resolveKeyPath(r,a);if(typeof o=="string"){const i=[];return this._findReplaceIndex(o).forEach((c,l,u)=>{const d=u[l-1]||{startIndex:0,endIndex:-1};if(d.endIndex+1<c.startIndex){const h=o.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=o.slice(c.endIndex+1);h&&i.push(h)}}),i}return[]}};_t=Pl([v.OnLifecycle(v.LifecycleStages.Rendered,_t),Nl(0,L.Inject(v.LocaleService))],_t);const jl=(e=[])=>{const t=Q.useDependency(fe.IMarkSelectionService);x.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])},le={cfRuleList:"univer-cf-rule-list",ruleSelector:"univer-rule-selector",select:"univer-select",selectSelector:"univer-select-selector",selectSelectionItem:"univer-select-selection-item",selectSelectionSearchInput:"univer-select-selection-search-input",btnList:"univer-btn-list",gap:"univer-gap",icon:"univer-icon",disabled:"univer-disabled",ruleItem:"univer-rule-item",ruleDescribe:"univer-rule-describe",ruleType:"univer-rule-type",ruleRange:"univer-rule-range",active:"univer-active",draggableHandle:"univer-draggableHandle",deleteItem:"univer-delete-item",gridLayoutWrap:"univer-grid-layout-wrap",reactGridItem:"univer-react-grid-item"},Ll=(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(a=>String(a)):[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 ka=0;const kl=e=>{const{onClick:t}=e,n=Q.useDependency(s.ConditionalFormattingRuleModel),r=Q.useDependency(v.IUniverInstanceService),a=Q.useDependency(J.SelectionManagerService),o=Q.useDependency(v.ICommandService),i=Q.useDependency(v.LocaleService),c=Q.useDependency(_t),l=r.getCurrentUniverSheetInstance(),u=l.getUnitId(),h=l.getActiveSheet().getSheetId(),[p,m]=x.useState([]),[C,b]=x.useState("2"),[_,I]=x.useState(0),[y,S]=x.useState(-1),[R,g]=x.useState(ka),w=x.useRef(null),O=[{label:i.t("sheet.cf.panel.workSheet"),value:"2"},{label:i.t("sheet.cf.panel.selectedRange"),value:"1"}],E=()=>{const V=n.getSubunitRules(u,h);if(!V||!V.length)return[];if(C==="1"){const G=a.getLast();if(!G)return[];const ee=G.range;return V.filter(ge=>ge.ranges.some(be=>v.Rectangle.intersects(be,ee)))}else if(C==="2")return V;return[]},[j,H]=x.useState(E);jl(p),x.useEffect(()=>{const V=o.onCommandExecuted(G=>{G.id===J.SetWorksheetActiveOperation.id&&I(Math.random())});return()=>V.dispose()}),x.useEffect(()=>{H(E)},[C,_,u,h]),x.useEffect(()=>{if(C==="2")return;const V=new Re.Observable(G=>{const ee=[J.SetSelectionsOperation.id,s.AddConditionalRuleMutation.id,s.SetConditionalRuleMutation.id,s.DeleteConditionalRuleMutation.id,s.MoveConditionalRuleMutation.id],ce=o.onCommandExecuted(ge=>{const{id:be,params:Ce}=ge,Le=r.getCurrentUniverSheetInstance().getUnitId();ee.includes(be)&&Ce.unitId===Le&&G.next(null)});return()=>ce.dispose()}).pipe(Re.debounceTime(16)).subscribe(()=>{H(E)});return()=>{V.unsubscribe()}},[r,C,u,h]),x.useEffect(()=>{const V=n.$ruleChange.subscribe(()=>{I(Math.random())});return()=>V.unsubscribe()},[n]),x.useEffect(()=>{const V=()=>{var ge;const ce=Math.max(0,(((ge=w.current)==null?void 0:ge.getBoundingClientRect().width)||0)-8);return ka=ce,ce},ee=new Re.Observable(ce=>{const ge=document.querySelector(".univer-sidebar");if(ge){let be=setTimeout(()=>{ce.next()},150);const Ce=()=>{be&&clearTimeout(be),be=null},Le=st=>{st.propertyName==="width"&&(Ce(),ce.next())};return ge.addEventListener("transitionend",Le),()=>{Ce(),ge.removeEventListener("transitionend",Le)}}}).pipe(Re.debounceTime(16)).subscribe(()=>{g(V())});return()=>{ee.unsubscribe()}},[]);const $=V=>{const G=r.getCurrentUniverSheetInstance().getUnitId(),ee=r.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();o.executeCommand(dr.id,{unitId:G,subUnitId:ee,cfId:V.cfId})},ae=(V,G)=>{S(G.y)},T=(V,G,ee)=>{S(-1);const ce=r.getCurrentUniverSheetInstance().getUnitId(),ge=r.getCurrentUniverSheetInstance().getActiveSheet().getSheetId(),be=st=>{const Lt=j.length;return Math.min(Lt-1,Math.max(0,st))},Ce=j[be(G.y)].cfId,Le=j[be(ee.y)].cfId;Ce!==Le&&o.executeCommand(ja.id,{unitId:ce,subUnitId:ge,start:{id:Ce,type:"self"},end:{id:Le,type:ee.y>G.y?"after":"before"}})},M=()=>{e.onCreate()},te=()=>{C==="2"?o.executeCommand(Cn.id):C==="1"&&j.map(G=>({unitId:u,subUnitId:h,cfId:G.cfId})).forEach(G=>{o.executeCommand(dr.id,G)})},xe=j.map((V,G)=>({i:V.cfId,x:0,w:12,y:G,h:1,isResizable:!1}));return f.jsxs("div",{className:le.cfRuleList,children:[f.jsxs("div",{className:le.ruleSelector,children:[f.jsx("div",{children:c.tWithReactNode("sheet.cf.panel.managerRuleSelect",f.jsx(B.Select,{className:le.select,options:O,value:C,onChange:V=>{b(V)}})).map((V,G)=>f.jsx("span",{children:V},G))}),f.jsxs("div",{className:le.btnList,children:[f.jsx(B.Tooltip,{title:i.t("sheet.cf.panel.createRule"),placement:"bottom",children:f.jsx("div",{className:`${le.icon}`,onClick:M,children:f.jsx(Wo,{})})}),j.length?f.jsx(B.Tooltip,{title:i.t("sheet.cf.panel.clear"),placement:"bottom",children:f.jsx("div",{className:`${le.gap} ${le.icon}`,onClick:te,children:f.jsx(Rn,{})})}):f.jsx("div",{className:`${le.gap} ${le.disabled}`,children:f.jsx(Rn,{})})]})]}),f.jsx("div",{ref:w,className:le.gridLayoutWrap,children:R?f.jsx(Ol,{onDragStop:T,onDragStart:ae,layout:xe,cols:12,rowHeight:60,width:R,margin:[0,10],draggableHandle:".draggableHandle",children:j.map((V,G)=>f.jsx("div",{children:f.jsxs("div",{onMouseMove:()=>{V.ranges!==p&&m(V.ranges)},onMouseLeave:()=>m([]),onClick:()=>t(V),className:`${le.ruleItem} ${y===G?le.active:""}`,children:[f.jsx("div",{className:`${le.draggableHandle} draggableHandle`,onClick:ee=>ee.stopPropagation(),children:f.jsx(Bo,{})}),f.jsxs("div",{className:le.ruleDescribe,children:[f.jsx("div",{className:le.ruleType,children:Ll(V,i)}),f.jsx("div",{className:le.ruleRange,children:V.ranges.map(ee=>wr.serializeRange(ee)).join(",")})]}),f.jsx("div",{className:le.preview,children:f.jsx(ht,{rule:V.rule})}),f.jsx("div",{className:`${le.deleteItem} ${y===G?le.active:""}`,onClick:ee=>{ee.stopPropagation(),$(V)},children:f.jsx(Rn,{})})]})},`${V.cfId}`))}):null})]})},Va={type:v.CommandType.COMMAND,id:"sheet.command.add-conditional-rule",handler(e,t){var b,_;if(!t)return!1;const{rule:n}=t,r=e.get(v.IUndoRedoService),a=e.get(v.ICommandService),o=e.get(s.ConditionalFormattingRuleModel),c=e.get(v.IUniverInstanceService).getCurrentUniverSheetInstance(),l=c.getActiveSheet(),u=(b=t.unitId)!=null?b:c.getUnitId(),d=(_=t.subUnitId)!=null?_:l.getSheetId(),h=o.createCfId(u,d),p={unitId:u,subUnitId:d,rule:{...n,cfId:n.cfId||h}},m=s.AddConditionalRuleMutationUndoFactory(e,p),C=a.syncExecuteCommand(s.AddConditionalRuleMutation.id,p);return C&&r.pushUndoRedo({unitID:u,redoMutations:[{id:s.AddConditionalRuleMutation.id,params:p}],undoMutations:[m]}),C}},Aa={type:v.CommandType.COMMAND,id:"sheet.command.set-conditional-rule",handler(e,t){var p,m;if(!t)return!1;const n=e.get(v.IUndoRedoService),r=e.get(v.ICommandService),o=e.get(v.IUniverInstanceService).getCurrentUniverSheetInstance(),i=o.getActiveSheet(),c=(p=t.unitId)!=null?p:o.getUnitId(),l=(m=t.subUnitId)!=null?m:i.getSheetId(),u={unitId:c,subUnitId:l,rule:t.rule},d=s.setConditionalRuleMutationUndoFactory(e,u),h=r.syncExecuteCommand(s.SetConditionalRuleMutation.id,u);return h&&n.pushUndoRedo({unitID:c,undoMutations:d,redoMutations:[{id:s.SetConditionalRuleMutation.id,params:u}]}),h}},Vl=v.createInterceptorKey("beforeSubmit"),Al=v.createInterceptorKey("submit"),fr={cfColorPicker:"univer-cf-color-picker",cfColorPickerIcon:"univer-cf-color-picker-icon",iconDropdown:"univer-icon-dropdown"},et=e=>{const{color:t,onChange:n,disable:r=!1,iconId:a="PaintBucket",className:o,isNeedDropdownIcon:i=!0}=e,c=Q.useDependency(ve.ComponentManager),l=x.useMemo(()=>new v.ColorKit(t),[t]),u=c.get(a);return u&&(r?f.jsx(u,{className:o,extend:{colorChannel1:l.isValid?t:"rgb(var(--primary-color))"}}):f.jsx(B.Dropdown,{overlay:f.jsx("div",{className:`${fr.cfColorPicker} `,children:f.jsx(B.ColorPicker,{color:t,onChange:n})}),children:f.jsxs("span",{className:`${fr.cfColorPickerIcon} ${o}`,children:[f.jsx(u,{extend:{colorChannel1:l.isValid?t:"rgb(var(--primary-color))"}}),i&&f.jsx(In,{className:fr.iconDropdown})]})}))},P={cfRuleStyleEditor:"univer-cf-rule-style-editor",cfPreviewWrap:"univer-cf-preview-wrap",text:"univer-text",positionRelative:"univer-position-relative",btnList:"univer-btn-list",utilItem:"univer-util-item",iconSet:"univer-icon-set",renderConfig:"univer-render-config",flex:"univer-flex",width45:"univer-width45",iconWrap:"univer-icon-wrap",icon:"univer-icon",dropdownIcon:"univer-dropdown-icon",errorInput:"univer-error-input",errorText:"univer-error-text",iconGroupList:"univer-icon-group-list",title:"univer-title",group:"univer-group",itemContent:"univer-item-content",itemWrap:"univer-item-wrap",item:"univer-item",iconItemListWrap:"univer-icon-item-list-wrap",none:"univer-none",iconItemList:"univer-icon-item-list",width100:"univer-width100",stress:"univer-stress"},tt=(e,t)=>({label:t.t(`sheet.cf.valueType.${e}`),value:e}),pr=e=>{const{type:t,className:n,onChange:r,id:a,value:o}=e,i=Q.useDependency(v.IUniverInstanceService),c=i.getCurrentUniverSheetInstance().getUnitId(),l=i.getCurrentUniverSheetInstance().getActiveSheet().getSheetId(),u=x.useMemo(()=>String(o).startsWith("=")?String(o):"=",[o]),d=x.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?f.jsx(ve.TextEditor,{openForSheetSubUnitId:l,openForSheetUnitId:c,id:v.createInternalEditorID(`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_colo_scale_${a}`),value:u,style:{maxWidth:"50%",marginLeft:4},canvasStyle:{fontSize:10},onlyInputFormula:!0,onChange:(h="")=>{r(h||"")}}):f.jsx(B.InputNumber,{className:n,value:Number(e.value)||0,onChange:h=>e.onChange(h||0),...d})},zl=e=>{var ae;const{interceptorManager:t}=e,n=Q.useDependency(v.LocaleService),r=((ae=e.rule)==null?void 0:ae.type)===s.CFRuleType.colorScale?e.rule:void 0,a=[tt(s.CFValueType.num,n),tt(s.CFValueType.percent,n),tt(s.CFValueType.percentile,n),tt(s.CFValueType.formula,n)],o=[tt(s.CFValueType.min,n),...a],i=[tt("none",n),...a],c=[tt(s.CFValueType.max,n),...a],[l,u]=x.useState(()=>{var M;const T=s.CFValueType.min;return r&&((M=r.config[0])==null?void 0:M.value.type)||T}),[d,h]=x.useState(()=>{var M;const T="none";return!r||r.config.length!==3?T:((M=r.config[1])==null?void 0:M.value.type)||T}),[p,m]=x.useState(()=>{var M;const T=s.CFValueType.max;return r&&((M=r.config[r.config.length-1])==null?void 0:M.value.type)||T}),[C,b]=x.useState(()=>{if(!r)return 10;const M=r.config[0];return(M==null?void 0:M.value.value)===void 0?10:M==null?void 0:M.value.value}),[_,I]=x.useState(()=>{var te;if(!r||r.config.length!==3)return 50;const M=(te=r.config[1])==null?void 0:te.value.value;return M===void 0?50:M}),[y,S]=x.useState(()=>{var te;if(!r)return 90;const M=(te=r.config[r.config.length-1])==null?void 0:te.value.value;return M===void 0?90:M}),[R,g]=x.useState(()=>{var M;const T="#d0d9fb";return r&&((M=r.config[0])==null?void 0:M.color)||T}),[w,O]=x.useState(()=>{var M;const T="#7790f3";return!r||r.config.length!==3?T:((M=r.config[1])==null?void 0:M.color)||T}),[E,j]=x.useState(()=>{var M;const T="#2e55ef";return r&&((M=r.config[r.config.length-1])==null?void 0:M.color)||T}),H=x.useMemo(()=>T=>{const{minType:M,medianType:te,maxType:xe,minValue:V,medianValue:G,maxValue:ee,minColor:ce,medianColor:ge,maxColor:be}=T,Ce=[];return Ce.push({color:ce,value:{type:M,value:V}}),te!=="none"&&Ce.push({color:ge,value:{type:te,value:G}}),Ce.push({color:be,value:{type:xe,value:ee}}),{config:Ce.map((st,Lt)=>({...st,index:Lt})),type:s.CFRuleType.colorScale}},[]);x.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return H({minType:l,medianType:d,maxType:p,minValue:C,medianValue:_,maxValue:y,minColor:R,medianColor:w,maxColor:E})}}),[H,l,d,p,C,_,y,R,w,E,t]);const $=T=>{e.onChange(H(T))};return f.jsxs("div",{children:[f.jsx("div",{className:D.title,children:n.t("sheet.cf.panel.styleRule")}),f.jsx("div",{className:`${P.cfPreviewWrap}`,children:f.jsx(ht,{rule:H({minType:l,medianType:d,maxType:p,minValue:C,medianValue:_,maxValue:y,minColor:R,medianColor:w,maxColor:E})})}),f.jsx("div",{className:D.label,children:n.t("sheet.cf.valueType.min")}),f.jsxs("div",{className:`${D.labelContainer} ${D.mTSm}`,children:[f.jsx(B.Select,{options:o,value:l,onChange:T=>{u(T);const M=s.createDefaultValueByValueType(T,10);b(M),$({minType:T,medianType:d,maxType:p,minValue:M,medianValue:_,maxValue:y,minColor:R,medianColor:w,maxColor:E})}}),f.jsx(pr,{id:"min",className:`${D.mLXxs}`,value:C,type:l,onChange:T=>{b(T),$({minType:l,medianType:d,maxType:p,minValue:T,medianValue:_,maxValue:y,minColor:R,medianColor:w,maxColor:E})}}),f.jsx(et,{className:D.mLXxs,color:R,onChange:T=>{g(T),$({minType:l,medianType:d,maxType:p,minValue:C,medianValue:_,maxValue:y,minColor:T,medianColor:w,maxColor:E})}})]}),f.jsx("div",{className:D.label,children:n.t("sheet.cf.panel.medianValue")}),f.jsxs("div",{className:`${D.labelContainer} ${D.mTSm}`,children:[f.jsx(B.Select,{options:i,value:d,onChange:T=>{h(T);const M=s.createDefaultValueByValueType(T,50);I(M),$({minType:l,medianType:T,maxType:p,minValue:C,medianValue:M,maxValue:y,minColor:R,medianColor:w,maxColor:E})}}),f.jsx(pr,{id:"median",className:` ${D.mLXxs}`,value:_,type:d,onChange:T=>{I(T),$({minType:l,medianType:d,maxType:p,minValue:C,medianValue:T,maxValue:y,minColor:R,medianColor:w,maxColor:E})}}),d!=="none"&&f.jsx(et,{className:D.mLXxs,color:w,onChange:T=>{O(T),$({minType:l,medianType:d,maxType:p,minValue:C,medianValue:_,maxValue:y,minColor:R,medianColor:T,maxColor:E})}})]}),f.jsx("div",{className:D.label,children:n.t("sheet.cf.valueType.max")}),f.jsxs("div",{className:`${D.labelContainer} ${D.mTSm}`,children:[f.jsx(B.Select,{options:c,value:p,onChange:T=>{m(T);const M=s.createDefaultValueByValueType(T,90);S(M),$({minType:l,medianType:d,maxType:T,minValue:C,medianValue:_,maxValue:M,minColor:R,medianColor:w,maxColor:E})}}),f.jsx(pr,{id:"max",className:`${D.mLXxs}`,value:y,type:p,onChange:T=>{S(T),$({minType:l,medianType:d,maxType:p,minValue:C,medianValue:_,maxValue:T,minColor:R,medianColor:w,maxColor:E})}}),f.jsx(et,{className:D.mLXxs,color:E,onChange:T=>{j(T),$({minType:l,medianType:d,maxType:p,minValue:C,medianValue:_,maxValue:y,minColor:R,medianColor:w,maxColor:T})}})]})]})},gt=(e,t)=>({label:t.t(`sheet.cf.valueType.${e}`),value:e}),za=e=>{const{onChange:t,className:n,value:r,type:a,id:o,disabled:i=!1}=e,c=Q.useDependency(v.IUniverInstanceService),l=c.getCurrentUniverSheetInstance().getUnitId(),u=c.getCurrentUniverSheetInstance().getActiveSheet().getSheetId(),d=x.useRef(r),h=x.useMemo(()=>[s.CFValueType.percentile,s.CFValueType.percent].includes(a)?{max:100,min:0}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[a]);if(a===s.CFValueType.formula){const p=String(d.current).startsWith("=")?String(d.current)||"":"=";return f.jsx(ve.TextEditor,{id:v.createInternalEditorID(`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_data_bar_${o}`),value:p,openForSheetSubUnitId:u,openForSheetUnitId:l,style:{width:"47%",marginLeft:14},canvasStyle:{fontSize:10},onlyInputFormula:!0,onChange:(m="")=>{t(m||"")}})}return f.jsx(B.InputNumber,{className:n,value:Number(r)||0,disabled:i,onChange:p=>{t(p||0)},...h})},Ul=e=>{var ae;const{interceptorManager:t}=e,n=Q.useDependency(v.LocaleService),r=((ae=e.rule)==null?void 0:ae.type)===s.CFRuleType.dataBar?e.rule:void 0,[a,o]=x.useState(()=>{var M;const T="0";return r?(M=r.config)!=null&&M.isGradient?"1":"0":T}),[i,c]=x.useState(()=>{var M;const T="#abd91a";return r&&((M=r.config)==null?void 0:M.positiveColor)||T}),[l,u]=x.useState(()=>{var M;const T="#ffbe38";return r&&((M=r.config)==null?void 0:M.nativeColor)||T}),d=[gt(s.CFValueType.num,n),gt(s.CFValueType.percent,n),gt(s.CFValueType.percentile,n),gt(s.CFValueType.formula,n)],h=[gt(s.CFValueType.min,n),...d],p=[gt(s.CFValueType.max,n),...d],[m,C]=x.useState(()=>{var M;const T=h[0].value;return r&&((M=r.config)==null?void 0:M.min.type)||T}),[b,_]=x.useState(()=>{var M;const T=p[0].value;return r&&((M=r.config)==null?void 0:M.max.type)||T}),[I,y]=x.useState(()=>{var te;if(!r)return 0;const M=((te=r.config)==null?void 0:te.min)||{};return M.type===s.CFValueType.formula?M.value||"=":M.value||0}),[S,R]=x.useState(()=>{var te;if(!r)return 100;const M=((te=r.config)==null?void 0:te.max)||{};return M.type===s.CFValueType.formula?M.value||"=":M.value===void 0?100:M.value}),[g,w]=x.useState(()=>r?r.isShowValue===void 0?!0:!!r.isShowValue:!0),O=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});x.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return O({isGradient:a,minValue:I,minValueType:m,maxValue:S,maxValueType:b,positiveColor:i,nativeColor:l,isShowValue:g})}}),[a,I,m,S,b,i,l,t,g]);const E=T=>{e.onChange(O(T))},j=T=>{c(T),E({isGradient:a,minValue:I,minValueType:m,maxValue:S,maxValueType:b,positiveColor:T,nativeColor:l,isShowValue:g})},H=T=>{u(T),E({isGradient:a,minValue:I,minValueType:m,maxValue:S,maxValueType:b,positiveColor:i,nativeColor:T,isShowValue:g})},$=T=>d.map(M=>M.value).includes(T);return f.jsxs("div",{children:[f.jsx("div",{className:D.title,children:n.t("sheet.cf.panel.styleRule")}),f.jsx("div",{className:`${P.cfPreviewWrap}`,children:f.jsx(ht,{rule:O({isGradient:a,minValue:I,minValueType:m,maxValue:S,maxValueType:b,positiveColor:i,nativeColor:l,isShowValue:g})})}),f.jsxs("div",{children:[f.jsx("div",{className:D.label,children:n.t("sheet.cf.panel.fillType")}),f.jsxs("div",{className:`${D.mTSm} ${D.mLXxs} ${D.labelContainer} `,children:[f.jsxs(B.RadioGroup,{value:a,onChange:T=>{o(T),E({isGradient:T,minValue:I,minValueType:m,maxValue:S,maxValueType:b,positiveColor:i,nativeColor:l,isShowValue:g})},children:[f.jsx(B.Radio,{value:"0",children:f.jsx("span",{className:P.text,children:n.t("sheet.cf.panel.pureColor")})}),f.jsx(B.Radio,{value:"1",children:f.jsx("span",{className:P.text,children:n.t("sheet.cf.panel.gradient")})})]}),f.jsxs("div",{className:`${P.utilItem} ${D.mLXl}`,children:[f.jsx(B.Checkbox,{checked:!g,onChange:T=>{w(!T),E({isGradient:T,minValue:I,minValueType:m,maxValue:S,maxValueType:b,positiveColor:i,nativeColor:l,isShowValue:!T})}}),n.t("sheet.cf.panel.onlyShowDataBar")]})]})]}),f.jsxs("div",{children:[f.jsx("div",{className:D.label,children:n.t("sheet.cf.panel.colorSet")}),f.jsxs("div",{className:`${D.labelContainer} ${D.mTSm} ${D.mLXxs}`,children:[f.jsxs("div",{className:`${D.labelContainer}`,children:[f.jsx("div",{className:`${P.text}`,children:n.t("sheet.cf.panel.native")}),f.jsx(et,{color:l,onChange:H})]}),f.jsxs("div",{className:`${D.labelContainer} ${D.mLSm} `,children:[f.jsx("div",{className:`${P.text} `,children:n.t("sheet.cf.panel.positive")}),f.jsx(et,{color:i,onChange:j})]})]})]}),f.jsxs("div",{children:[f.jsx("div",{className:D.label,children:n.t("sheet.cf.valueType.min")}),f.jsxs("div",{className:`${D.mTSm} ${D.labelContainer}`,children:[f.jsx(B.Select,{options:h,value:m,onChange:T=>{C(T);const M=s.createDefaultValueByValueType(T,10);y(M),E({isGradient:a,minValue:M,minValueType:T,maxValue:S,maxValueType:b,positiveColor:i,nativeColor:l,isShowValue:g})}}),f.jsx(za,{disabled:!$(m),id:"min",type:m,className:D.mLSm,value:I,onChange:T=>{y(T||0),E({isGradient:a,minValue:T||0,minValueType:m,maxValue:S,maxValueType:b,positiveColor:i,nativeColor:l,isShowValue:g})}})]}),f.jsx("div",{className:D.label,children:n.t("sheet.cf.valueType.max")}),f.jsxs("div",{className:`${D.mTSm} ${D.labelContainer}`,children:[f.jsx(B.Select,{options:p,value:b,onChange:T=>{_(T);const M=s.createDefaultValueByValueType(T,90);R(M),E({isGradient:a,minValue:I,minValueType:m,maxValue:M,maxValueType:T,positiveColor:i,nativeColor:l,isShowValue:g})}}),f.jsx(za,{disabled:!$(b),id:"max",type:b,className:D.mLSm,value:S,onChange:T=>{R(T||0),E({isGradient:a,minValue:I,minValueType:m,maxValue:T||0,maxValueType:b,positiveColor:i,nativeColor:l,isShowValue:g})}})]})]})]})},We={cfStyleEdit:"univer-cf-style-edit",buttonItem:"univer-button-item",isActive:"univer-isActive"},on=e=>[v.BooleanNumber.FALSE,void 0].includes(e)?v.BooleanNumber.TRUE:v.BooleanNumber.FALSE,sn=e=>e!==v.BooleanNumber.FALSE,hr=e=>{const{style:t,onChange:n,className:r}=e,a=Q.useDependency(ve.ComponentManager),[o,i]=x.useState(()=>{if(t!=null&&t.bl)return t.bl}),[c,l]=x.useState(()=>{if(t!=null&&t.it)return t.it}),[u,d]=x.useState(()=>{if(t!=null&&t.ul)return t.ul.s}),[h,p]=x.useState(()=>{if(t!=null&&t.st)return t.st.s}),[m,C]=x.useState(()=>{var w;const g="#2f56ef";return(w=t==null?void 0:t.cl)!=null&&w.rgb?t.cl.rgb:g}),[b,_]=x.useState(()=>{var w;const g="#e8ecfc";return(w=t==null?void 0:t.bg)!=null&&w.rgb?t.bg.rgb:g}),I=a.get("BoldSingle"),y=a.get("ItalicSingle"),S=a.get("UnderlineSingle"),R=a.get("StrikethroughSingle");return x.useEffect(()=>{const g={bl:o,it:c};m!==void 0&&(g.cl={rgb:m}),b!==void 0&&(g.bg={rgb:b}),h!==void 0&&(g.st={s:h}),u!==void 0&&(g.ul={s:u}),n(s.removeUndefinedAttr(g))},[o,c,u,h,m,b]),f.jsxs("div",{className:`${We.cfStyleEdit} ${r}`,children:[I&&f.jsx("div",{className:He({[We.isActive]:sn(o||v.BooleanNumber.FALSE)},We.buttonItem),onClick:()=>i(on(o)),children:f.jsx(I,{})}),y&&f.jsx("div",{className:He({[We.isActive]:sn(c||v.BooleanNumber.FALSE)},We.buttonItem),onClick:()=>l(on(c)),children:f.jsx(y,{})}),S&&f.jsx("div",{className:He({[We.isActive]:sn(u||v.BooleanNumber.FALSE)},We.buttonItem),onClick:()=>d(on(u)),children:f.jsx(S,{})}),R&&f.jsx("div",{className:He({[We.isActive]:sn(h||v.BooleanNumber.FALSE)},We.buttonItem),onClick:()=>p(on(h)),children:f.jsx(R,{})}),f.jsx(et,{color:m,onChange:C,iconId:"FontColor"}),f.jsx(et,{color:b,onChange:_,iconId:"PaintBucket"})]})},Wl=e=>{var _;const{onChange:t,interceptorManager:n}=e,r=Q.useDependency(v.LocaleService),a=((_=e.rule)==null?void 0:_.type)===s.CFRuleType.highlightCell?e.rule:void 0,o=[{label:r.t("sheet.cf.panel.isNotBottom"),value:"isNotBottom"},{label:r.t("sheet.cf.panel.isBottom"),value:"isBottom"},{label:r.t("sheet.cf.panel.greaterThanAverage"),value:"greaterThanAverage"},{label:r.t("sheet.cf.panel.lessThanAverage"),value:"lessThanAverage"}],[i,c]=x.useState(()=>{const I=o[0].value,y=a==null?void 0:a.type;if(!a)return I;switch(y){case s.CFRuleType.highlightCell:switch(a.subType){case s.CFSubRuleType.average:return[s.CFNumberOperator.greaterThan,s.CFNumberOperator.greaterThanOrEqual].includes(a.operator)?"greaterThanAverage":[s.CFNumberOperator.lessThan,s.CFNumberOperator.lessThanOrEqual].includes(a.operator)?"lessThanAverage":I;case s.CFSubRuleType.rank:return a.isBottom?"isBottom":"isNotBottom"}}return I}),[l,u]=x.useState(()=>{const y=a==null?void 0:a.type;if(!a)return 10;switch(y){case s.CFRuleType.highlightCell:switch(a.subType){case s.CFSubRuleType.rank:return a.value||10}}return 10}),[d,h]=x.useState(()=>{const y=a==null?void 0:a.type;if(!a)return!1;switch(y){case s.CFRuleType.highlightCell:switch(a.subType){case s.CFSubRuleType.rank:return a.isPercent||!1}}return!1}),[p,m]=x.useState({}),C=I=>{const{type:y,isPercent:S,value:R,style:g}=I;if(y==="isNotBottom")return{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.rank,isPercent:S,isBottom:!1,value:R,style:g};if(y==="isBottom")return{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.rank,isPercent:S,isBottom:!0,value:R,style:g};if(y==="greaterThanAverage")return{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.average,operator:s.CFNumberOperator.greaterThan,style:g};if(y==="lessThanAverage")return{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.average,operator:s.CFNumberOperator.lessThan,style:g}};x.useEffect(()=>n.intercept(n.getInterceptPoints().submit,{handler(){return C({type:i,isPercent:d,value:l,style:p})}}),[i,d,l,p,n]);const b=I=>{t(C(I))};return f.jsxs("div",{children:[f.jsx("div",{className:`${D.title} ${D.mTBase}`,children:r.t("sheet.cf.panel.styleRule")}),f.jsx(B.Select,{className:`${P.width100} ${D.mTSm}`,value:i,options:o,onChange:I=>{c(I),b({type:I,isPercent:d,value:l,style:p})}}),["isNotBottom","isBottom"].includes(i)&&f.jsxs("div",{className:`${D.labelContainer} ${D.mTSm}`,children:[f.jsx(B.InputNumber,{min:1,max:1e3,value:l,onChange:I=>{const y=I||0;u(y),b({type:i,isPercent:d,value:y,style:p})}}),f.jsxs("div",{className:`${D.mLSm} ${D.labelContainer} ${P.text}`,children:[f.jsx(B.Checkbox,{checked:d,onChange:I=>{h(!!I),b({type:i,isPercent:!!I,value:l,style:p})}}),r.t("sheet.cf.valueType.percent")]})]}),f.jsx("div",{className:`${P.cfPreviewWrap} `,children:f.jsx(ht,{rule:C({type:i,isPercent:d,value:l,style:p})})}),f.jsx(hr,{style:a==null?void 0:a.style,className:`${D.mTSm} `,onChange:I=>{m(I),b({type:i,isPercent:d,value:l,style:I})}})]})},K=(e,t)=>({label:t.t(`sheet.cf.operator.${e}`),value:e}),Hl=e=>{const{type:t,operator:n,onChange:r,value:a}=e,[o,i]=x.useState(()=>typeof a=="number"?a:0),[c,l]=x.useState(()=>typeof a=="string"?a:""),[u,d]=x.useState(()=>Array.isArray(a)?a[0]===void 0?0:a[0]:0),[h,p]=x.useState(()=>Array.isArray(a)?a[1]===void 0?100:a[1]:100);switch(x.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(o),[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 m=C=>{l(C),r(C)};return f.jsx("div",{className:`${D.mTSm}`,children:f.jsx(B.Input,{className:P.width100,value:c,onChange:m})})}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 m=C=>{i(C||0),r(C||0)};return f.jsx("div",{className:`${D.mTSm}`,children:f.jsx(B.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,className:P.width100,value:o,onChange:m})})}if([s.CFNumberOperator.between,s.CFNumberOperator.notBetween].includes(n)){const m=b=>{d(b||0),r([b||0,h])},C=b=>{p(b||0),r([u,b||0])};return f.jsxs("div",{className:`${D.mTSm} ${D.labelContainer} `,children:[f.jsx(B.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,value:u,onChange:m}),f.jsx(B.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,className:`${D.mLSm}`,value:h,onChange:C})]})}}}return null},Ua=(e,t)=>{switch(e){case s.CFSubRuleType.text:return[K(s.CFTextOperator.containsText,t),K(s.CFTextOperator.notContainsText,t),K(s.CFTextOperator.beginsWith,t),K(s.CFTextOperator.endsWith,t),K(s.CFTextOperator.equal,t),K(s.CFTextOperator.notEqual,t),K(s.CFTextOperator.containsBlanks,t),K(s.CFTextOperator.notContainsBlanks,t),K(s.CFTextOperator.containsErrors,t),K(s.CFTextOperator.notContainsErrors,t)];case s.CFSubRuleType.number:return[K(s.CFNumberOperator.between,t),K(s.CFNumberOperator.notBetween,t),K(s.CFNumberOperator.equal,t),K(s.CFNumberOperator.notEqual,t),K(s.CFNumberOperator.greaterThan,t),K(s.CFNumberOperator.greaterThanOrEqual,t),K(s.CFNumberOperator.lessThan,t),K(s.CFNumberOperator.lessThanOrEqual,t)];case s.CFSubRuleType.timePeriod:return[K(s.CFTimePeriodOperator.yesterday,t),K(s.CFTimePeriodOperator.today,t),K(s.CFTimePeriodOperator.tomorrow,t),K(s.CFTimePeriodOperator.last7Days,t),K(s.CFTimePeriodOperator.lastWeek,t),K(s.CFTimePeriodOperator.thisWeek,t),K(s.CFTimePeriodOperator.nextWeek,t),K(s.CFTimePeriodOperator.lastMonth,t),K(s.CFTimePeriodOperator.thisMonth,t),K(s.CFTimePeriodOperator.nextMonth,t)]}},Wa=e=>{var R;const{interceptorManager:t,onChange:n}=e,r=Q.useDependency(v.LocaleService),a=((R=e.rule)==null?void 0:R.type)===s.CFRuleType.highlightCell?e.rule:void 0,[o,i]=x.useState(()=>{const g=s.CFSubRuleType.text;return a&&a.subType||g}),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=x.useMemo(()=>Ua(o,r),[o]),[u,d]=x.useState(()=>{const g=l?l[0].value:void 0;return a&&a.operator||g}),[h,p]=x.useState(()=>{var O;const g="";return a?(O=a.value)!=null?O:s.createDefaultValue(a.subType,a.operator):g}),[m,C]=x.useState({}),b=x.useMemo(()=>g=>{var w,O,E,j,H,$,ae,T,M,te,xe,V,G,ee,ce;switch(g.subType||o){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:(w=g.subType)!=null?w:o,operator:(O=g.operator)!=null?O:u,style:(E=g.style)!=null?E:m,value:(j=g.value)!=null?j: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:(H=g.subType)!=null?H:o,operator:($=g.operator)!=null?$:u,style:(ae=g.style)!=null?ae:m,value:(T=g.value)!=null?T:h};if([s.CFNumberOperator.between,s.CFNumberOperator.notBetween].includes(u))return{type:s.CFRuleType.highlightCell,subType:(M=g.subType)!=null?M:o,operator:(te=g.operator)!=null?te:u,style:(xe=g.style)!=null?xe:m,value:(V=g.value)!=null?V:h};break}}return{type:s.CFRuleType.highlightCell,subType:(G=g.subType)!=null?G:o,operator:(ee=g.operator)!=null?ee:u,style:(ce=g.style)!=null?ce:m}},[o,u,h,m]);x.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return b({})}}),[b,t]),x.useEffect(()=>{c.some(g=>g.value===o)||i(c[0].value)},[c]);const _=g=>{const w=g,O=Ua(w,r),E=O&&O[0].value;i(w),d(E),E&&p(s.createDefaultValue(w,E)),n(b({subType:w,operator:E}))},I=g=>{const w=g;d(w),n(b({operator:w}))},y=g=>{p(g),n(b({value:g}))},S=x.useMemo(()=>`${o}_${u}_${Math.random()}`,[o,u]);return f.jsxs("div",{children:[f.jsx("div",{className:`${D.title} ${D.mTBase}`,children:r.t("sheet.cf.panel.styleRule")}),f.jsx(B.Select,{className:`${D.mTSm} ${P.width100}`,onChange:_,value:o,options:c}),(l==null?void 0:l.length)&&f.jsx(B.Select,{className:`${D.mTSm} ${P.width100}`,onChange:I,value:u||"",options:l}),f.jsx(Hl,{value:h,interceptorManager:t,type:o,operator:u,rule:a,onChange:y},S),f.jsx("div",{className:`${P.cfPreviewWrap}`,children:f.jsx(ht,{rule:b({})})}),f.jsx(hr,{style:a==null?void 0:a.style,className:`${D.mLXxs}`,onChange:g=>{C(g),n(b({style:g}))}})]})},$l=e=>{var C;const{onChange:t,interceptorManager:n}=e,r=Q.useDependency(v.LocaleService),o=Q.useDependency(v.IUniverInstanceService).getCurrentUniverSheetInstance(),i=o.getActiveSheet(),c=((C=e.rule)==null?void 0:C.type)===s.CFRuleType.highlightCell?e.rule:void 0,[l,u]=x.useState({}),[d,h]=x.useState(()=>(c==null?void 0:c.subType)===s.CFSubRuleType.formula?c.value:"="),p=b=>({style:b.style,value:d,type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.formula});x.useEffect(()=>n.intercept(n.getInterceptPoints().submit,{handler(){return p({style:l,formula:d})}}),[l,d,n]);const m=b=>{t(p(b))};return f.jsxs("div",{children:[f.jsx("div",{className:`${D.title} ${D.mTBase}`,children:r.t("sheet.cf.panel.styleRule")}),f.jsx("div",{className:`${D.mTSm}`,children:f.jsx(ve.TextEditor,{id:v.createInternalEditorID(`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_formula`),openForSheetSubUnitId:i.getSheetId(),openForSheetUnitId:o.getUnitId(),value:d,canvasStyle:{fontSize:10},onlyInputFormula:!0,onChange:(b="")=>{const _=b||"";h(_),m({style:l,formula:_})}})}),f.jsx("div",{className:`${P.cfPreviewWrap} `,children:f.jsx(ht,{rule:p({style:l,formula:d})})}),f.jsx(hr,{style:c==null?void 0:c.style,className:`${D.mTSm} `,onChange:b=>{u(b),m({style:b,formula:d})}})]})};var Bl="Expected a function",Ha="__lodash_hash_undefined__",$a=1/0,Gl=9007199254740991,Fl="[object Function]",ql="[object GeneratorFunction]",Xl="[object Symbol]",Yl=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Kl=/^\w*$/,Zl=/^\./,Jl=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ql=/[\\^$.*+?()[\]{}|]/g,ec=/\\(\\)?/g,tc=/^\[object .+?Constructor\]$/,nc=/^(?:0|[1-9]\d*)$/,rc=typeof ze=="object"&&ze&&ze.Object===Object&&ze,ac=typeof self=="object"&&self&&self.Object===Object&&self,gr=rc||ac||Function("return this")();function oc(e,t){return e==null?void 0:e[t]}function ic(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch{}return t}var sc=Array.prototype,lc=Function.prototype,Ba=Object.prototype,mr=gr["__core-js_shared__"],Ga=function(){var e=/[^.]+$/.exec(mr&&mr.keys&&mr.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Fa=lc.toString,ln=Ba.hasOwnProperty,qa=Ba.toString,cc=RegExp("^"+Fa.call(ln).replace(Ql,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Xa=gr.Symbol,uc=sc.splice,dc=Za(gr,"Map"),xt=Za(Object,"create"),Ya=Xa?Xa.prototype:void 0,Ka=Ya?Ya.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 fc(){this.__data__=xt?xt(null):{}}function pc(e){return this.has(e)&&delete this.__data__[e]}function hc(e){var t=this.__data__;if(xt){var n=t[e];return n===Ha?void 0:n}return ln.call(t,e)?t[e]:void 0}function gc(e){var t=this.__data__;return xt?t[e]!==void 0:ln.call(t,e)}function mc(e,t){var n=this.__data__;return n[e]=xt&&t===void 0?Ha:t,this}nt.prototype.clear=fc,nt.prototype.delete=pc,nt.prototype.get=hc,nt.prototype.has=gc,nt.prototype.set=mc;function mt(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 vc(){this.__data__=[]}function yc(e){var t=this.__data__,n=cn(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():uc.call(t,n,1),!0}function Sc(e){var t=this.__data__,n=cn(t,e);return n<0?void 0:t[n][1]}function bc(e){return cn(this.__data__,e)>-1}function Cc(e,t){var n=this.__data__,r=cn(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}mt.prototype.clear=vc,mt.prototype.delete=yc,mt.prototype.get=Sc,mt.prototype.has=bc,mt.prototype.set=Cc;function rt(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 Rc(){this.__data__={hash:new nt,map:new(dc||mt),string:new nt}}function Ic(e){return un(this,e).delete(e)}function wc(e){return un(this,e).get(e)}function Tc(e){return un(this,e).has(e)}function _c(e,t){return un(this,e).set(e,t),this}rt.prototype.clear=Rc,rt.prototype.delete=Ic,rt.prototype.get=wc,rt.prototype.has=Tc,rt.prototype.set=_c;function xc(e,t,n){var r=e[t];(!(ln.call(e,t)&&Ja(r,n))||n===void 0&&!(t in e))&&(e[t]=n)}function cn(e,t){for(var n=e.length;n--;)if(Ja(e[n][0],t))return n;return-1}function Oc(e){if(!dn(e)||Lc(e))return!1;var t=zc(e)||ic(e)?cc:tc;return t.test(Ac(e))}function Mc(e,t,n,r){if(!dn(e))return e;t=Nc(t,e)?[t]:Ec(t);for(var a=-1,o=t.length,i=o-1,c=e;c!=null&&++a<o;){var l=Vc(t[a]),u=n;if(a!=i){var d=c[l];u=r?r(d,l,c):void 0,u===void 0&&(u=dn(d)?d:Pc(t[a+1])?[]:{})}xc(c,l,u),c=c[l]}return e}function Dc(e){if(typeof e=="string")return e;if(yr(e))return Ka?Ka.call(e):"";var t=e+"";return t=="0"&&1/e==-$a?"-0":t}function Ec(e){return Qa(e)?e:kc(e)}function un(e,t){var n=e.__data__;return jc(t)?n[typeof t=="string"?"string":"hash"]:n.map}function Za(e,t){var n=oc(e,t);return Oc(n)?n:void 0}function Pc(e,t){return t=t==null?Gl:t,!!t&&(typeof e=="number"||nc.test(e))&&e>-1&&e%1==0&&e<t}function Nc(e,t){if(Qa(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||yr(e)?!0:Kl.test(e)||!Yl.test(e)||t!=null&&e in Object(t)}function jc(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Lc(e){return!!Ga&&Ga in e}var kc=vr(function(e){e=Wc(e);var t=[];return Zl.test(e)&&t.push(""),e.replace(Jl,function(n,r,a,o){t.push(a?o.replace(ec,"$1"):r||n)}),t});function Vc(e){if(typeof e=="string"||yr(e))return e;var t=e+"";return t=="0"&&1/e==-$a?"-0":t}function Ac(e){if(e!=null){try{return Fa.call(e)}catch{}try{return e+""}catch{}}return""}function vr(e,t){if(typeof e!="function"||t&&typeof t!="function")throw new TypeError(Bl);var n=function(){var r=arguments,a=t?t.apply(this,r):r[0],o=n.cache;if(o.has(a))return o.get(a);var i=e.apply(this,r);return n.cache=o.set(a,i),i};return n.cache=new(vr.Cache||rt),n}vr.Cache=rt;function Ja(e,t){return e===t||e!==e&&t!==t}var Qa=Array.isArray;function zc(e){var t=dn(e)?qa.call(e):"";return t==Fl||t==ql}function dn(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function Uc(e){return!!e&&typeof e=="object"}function yr(e){return typeof e=="symbol"||Uc(e)&&qa.call(e)==Xl}function Wc(e){return e==null?"":Dc(e)}function Hc(e,t,n){return e==null?e:Mc(e,t,n)}var $c=Hc;const Bc=wn($c);var Gc="Expected a function",eo="__lodash_hash_undefined__",to=1/0,Fc="[object Function]",qc="[object GeneratorFunction]",Xc="[object Symbol]",Yc=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Kc=/^\w*$/,Zc=/^\./,Jc=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Qc=/[\\^$.*+?()[\]{}|]/g,eu=/\\(\\)?/g,tu=/^\[object .+?Constructor\]$/,nu=typeof ze=="object"&&ze&&ze.Object===Object&&ze,ru=typeof self=="object"&&self&&self.Object===Object&&self,Sr=nu||ru||Function("return this")();function au(e,t){return e==null?void 0:e[t]}function ou(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch{}return t}var iu=Array.prototype,su=Function.prototype,no=Object.prototype,br=Sr["__core-js_shared__"],ro=function(){var e=/[^.]+$/.exec(br&&br.keys&&br.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),ao=su.toString,Cr=no.hasOwnProperty,oo=no.toString,lu=RegExp("^"+ao.call(Cr).replace(Qc,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),io=Sr.Symbol,cu=iu.splice,uu=co(Sr,"Map"),Ot=co(Object,"create"),so=io?io.prototype:void 0,lo=so?so.toString:void 0;function at(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__=Ot?Ot(null):{}}function fu(e){return this.has(e)&&delete this.__data__[e]}function pu(e){var t=this.__data__;if(Ot){var n=t[e];return n===eo?void 0:n}return Cr.call(t,e)?t[e]:void 0}function hu(e){var t=this.__data__;return Ot?t[e]!==void 0:Cr.call(t,e)}function gu(e,t){var n=this.__data__;return n[e]=Ot&&t===void 0?eo:t,this}at.prototype.clear=du,at.prototype.delete=fu,at.prototype.get=pu,at.prototype.has=hu,at.prototype.set=gu;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 mu(){this.__data__=[]}function vu(e){var t=this.__data__,n=fn(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():cu.call(t,n,1),!0}function yu(e){var t=this.__data__,n=fn(t,e);return n<0?void 0:t[n][1]}function Su(e){return fn(this.__data__,e)>-1}function bu(e,t){var n=this.__data__,r=fn(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}vt.prototype.clear=mu,vt.prototype.delete=vu,vt.prototype.get=yu,vt.prototype.has=Su,vt.prototype.set=bu;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 Cu(){this.__data__={hash:new at,map:new(uu||vt),string:new at}}function Ru(e){return pn(this,e).delete(e)}function Iu(e){return pn(this,e).get(e)}function wu(e){return pn(this,e).has(e)}function Tu(e,t){return pn(this,e).set(e,t),this}ot.prototype.clear=Cu,ot.prototype.delete=Ru,ot.prototype.get=Iu,ot.prototype.has=wu,ot.prototype.set=Tu;function fn(e,t){for(var n=e.length;n--;)if(ku(e[n][0],t))return n;return-1}function _u(e,t){t=Du(t,e)?[t]:Mu(t);for(var n=0,r=t.length;e!=null&&n<r;)e=e[ju(t[n++])];return n&&n==r?e:void 0}function xu(e){if(!fo(e)||Pu(e))return!1;var t=Vu(e)||ou(e)?lu:tu;return t.test(Lu(e))}function Ou(e){if(typeof e=="string")return e;if(Ir(e))return lo?lo.call(e):"";var t=e+"";return t=="0"&&1/e==-to?"-0":t}function Mu(e){return uo(e)?e:Nu(e)}function pn(e,t){var n=e.__data__;return Eu(t)?n[typeof t=="string"?"string":"hash"]:n.map}function co(e,t){var n=au(e,t);return xu(n)?n:void 0}function Du(e,t){if(uo(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Ir(e)?!0:Kc.test(e)||!Yc.test(e)||t!=null&&e in Object(t)}function Eu(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Pu(e){return!!ro&&ro in e}var Nu=Rr(function(e){e=zu(e);var t=[];return Zc.test(e)&&t.push(""),e.replace(Jc,function(n,r,a,o){t.push(a?o.replace(eu,"$1"):r||n)}),t});function ju(e){if(typeof e=="string"||Ir(e))return e;var t=e+"";return t=="0"&&1/e==-to?"-0":t}function Lu(e){if(e!=null){try{return ao.call(e)}catch{}try{return e+""}catch{}}return""}function Rr(e,t){if(typeof e!="function"||t&&typeof t!="function")throw new TypeError(Gc);var n=function(){var r=arguments,a=t?t.apply(this,r):r[0],o=n.cache;if(o.has(a))return o.get(a);var i=e.apply(this,r);return n.cache=o.set(a,i),i};return n.cache=new(Rr.Cache||ot),n}Rr.Cache=ot;function ku(e,t){return e===t||e!==e&&t!==t}var uo=Array.isArray;function Vu(e){var t=fo(e)?oo.call(e):"";return t==Fc||t==qc}function fo(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function Au(e){return!!e&&typeof e=="object"}function Ir(e){return typeof e=="symbol"||Au(e)&&oo.call(e)==Xc}function zu(e){return e==null?"":Ou(e)}function Uu(e,t,n){var r=e==null?void 0:_u(e,t);return r===void 0?n:r}var Wu=Uu;const Hu=wn(Wu),po=(e,t)=>(s.iconMap[e]||[])[Number(t)]||"",$u=e=>{const t=Q.useDependency(v.IUniverInstanceService),n=t.getCurrentUniverSheetInstance().getUnitId(),r=t.getCurrentUniverSheetInstance().getActiveSheet().getSheetId(),a=x.useMemo(()=>e.error?P.errorInput:"",[e.error]);return f.jsx("div",{className:P.positionRelative,children:e.type!==s.CFValueType.formula?f.jsxs(f.Fragment,{children:[f.jsx(B.InputNumber,{className:a,value:Number(e.value)||0,onChange:o=>e.onChange(o!=null?o:0)}),e.error&&f.jsx("div",{className:P.errorText,children:e.error})]}):f.jsx(ve.TextEditor,{id:v.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:(o="")=>{const i=o||"";e.onChange(i)}})})},ho=(e,t,n)=>({operator:s.CFNumberOperator.greaterThan,value:{type:s.CFValueType.num,value:(n.length-1-t)*10},iconType:e,iconId:String(t)}),Bu=e=>{const t=Q.useDependency(v.LocaleService),n=r=>{e.onClick(r)};return f.jsx("div",{className:P.iconGroupList,children:s.iconGroup.map((r,a)=>f.jsxs("div",{className:P.group,children:[f.jsx("div",{className:P.title,children:t.t(r.title)}),f.jsx("div",{className:P.itemContent,children:r.group.map(o=>f.jsx("div",{className:P.itemWrap,onClick:()=>{n(o.name)},children:f.jsx("div",{className:P.item,children:o.list.map((i,c)=>f.jsx("img",{className:P.icon,src:i},c))})},o.name))})]},a))})},Gu=e=>{const t=x.useMemo(()=>{const r=[];for(const a in s.iconMap){const o=s.iconMap[a],i=a;o.forEach((c,l)=>{r.push({iconType:i,base64:c,iconId:String(l)})})}return r},[]),n=r=>{e.onClick(r.iconType,r.iconId)};return f.jsxs("div",{className:P.iconItemListWrap,children:[f.jsxs("div",{className:P.none,onClick:()=>n({iconType:s.EMPTY_ICON_TYPE,iconId:"",base64:""}),children:[f.jsx(kt,{className:P.icon}),f.jsx("span",{children:"无单元格图标"})]}),f.jsx("div",{className:P.iconItemList,children:t.map(r=>f.jsx("div",{className:P.item,children:f.jsx("img",{onClick:()=>n(r),className:`${P.icon}`,src:r.base64})},`${r.iconType}_${r.iconId}`))})]})},Fu=e=>{const{onChange:t,configList:n,errorMap:r={}}=e,a=Q.useDependency(v.LocaleService),o=[{label:a.t(`sheet.cf.symbol.${s.CFNumberOperator.greaterThan}`),value:s.CFNumberOperator.greaterThan},{label:a.t(`sheet.cf.symbol.${s.CFNumberOperator.greaterThanOrEqual}`),value:s.CFNumberOperator.greaterThanOrEqual}],i=[{label:a.t(`sheet.cf.valueType.${s.CFValueType.num}`),value:s.CFValueType.num},{label:a.t(`sheet.cf.valueType.${s.CFValueType.percent}`),value:s.CFValueType.percent},{label:a.t(`sheet.cf.valueType.${s.CFValueType.percentile}`),value:s.CFValueType.percentile},{label:a.t(`sheet.cf.valueType.${s.CFValueType.formula}`),value:s.CFValueType.formula}],c=(h,p)=>{t([String(p),"value","value"],h)},l=(h,p)=>{t([String(p),"operator"],h);const m=s.createDefaultValue(s.CFSubRuleType.number,h);c(m,p)},u=(h,p)=>{t([String(p),"value","type"],h)};return x.useMemo(()=>n.map((h,p)=>{const m=r[p],C=po(h.iconType,h.iconId),b=p===n.length-1,_=p===0,I=n[p-1],y=(I==null?void 0:I.value.type)===s.CFValueType.formula?a.t("sheet.cf.valueType.formula"):I==null?void 0:I.value.value,S=(R,g)=>{const w={...h,iconId:g,iconType:R};t([String(p)],w)};return f.jsxs("div",{className:`${p?D.mTXl:D.mTSm}`,children:[f.jsxs("div",{className:`${D.label} ${P.flex}`,children:[f.jsxs("div",{className:`${P.width45}`,children:[a.t("sheet.cf.iconSet.icon"),p+1]}),f.jsx("div",{className:`${P.width45}`,children:f.jsxs(f.Fragment,{children:[!_&&!b&&a.t("sheet.cf.iconSet.rule"),!_&&!b&&f.jsxs("span",{className:P.stress,children:["(",a.t("sheet.cf.iconSet.when"),a.t(`sheet.cf.symbol.${s.getOppositeOperator(I.operator)}`),y,b?"":` ${a.t("sheet.cf.iconSet.and")} `,")"]})]})})]}),f.jsxs("div",{className:`${P.flex} ${D.mTSm}`,children:[f.jsx("div",{className:`${P.iconWrap} ${P.width45}`,children:f.jsx(B.Dropdown,{overlay:f.jsx(Gu,{onClick:S,iconId:h.iconId,iconType:h.iconType}),children:f.jsxs("div",{className:P.dropdownIcon,children:[C?f.jsx("img",{src:C,className:P.icon}):f.jsx(kt,{className:P.icon}),f.jsx(In,{})]})})}),b?f.jsxs("div",{className:`${P.width45} ${D.label}`,style:{marginTop:0},children:[a.t("sheet.cf.iconSet.rule"),f.jsxs("span",{className:P.stress,children:["(",a.t("sheet.cf.iconSet.when"),a.t(`sheet.cf.symbol.${s.getOppositeOperator(I.operator)}`),y,b?"":` ${a.t("sheet.cf.iconSet.and")} `,")"]})]}):f.jsx(B.Select,{className:`${D.mL0} ${P.width45} ${D.mR0}`,options:o,value:h.operator,onChange:R=>{l(R,p)}})]}),b?f.jsx("div",{}):f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:`${D.mTSm} ${D.label} ${P.flex}`,children:[f.jsx("div",{className:`${P.width45}`,children:a.t("sheet.cf.iconSet.type")}),f.jsx("div",{className:`${P.width45}`,children:a.t("sheet.cf.iconSet.value")})]}),f.jsxs("div",{className:`${D.mTSm} ${P.flex}`,children:[f.jsx(B.Select,{className:`${P.width45} ${D.mL0}`,options:i,value:h.value.type,onChange:R=>{u(R,p)}}),f.jsx("div",{className:`${D.mL0} ${P.width45}`,children:f.jsx($u,{id:p,type:h.value.type,error:m,value:h.value.value||"",onChange:R=>c(R,p)})})]})]})]},p)}),[n,r])},qu=e=>{var I;const{interceptorManager:t}=e,n=((I=e.rule)==null?void 0:I.type)===s.CFRuleType.iconSet?e.rule:void 0,r=Q.useDependency(v.LocaleService),[a,o]=x.useState({}),[i,c]=x.useState(()=>{const y=Object.keys(s.iconMap)[0];if(n&&n.config.length){const S=n.config[0].iconType;if(!n.config.some(g=>g.iconType!==S))return S}return y}),[l,u]=x.useState(()=>{if(n&&n.config.length)return v.Tools.deepClone(n==null?void 0:n.config);const y=s.iconMap[i]||[];return new Array(y.length).fill("").map((S,R,g)=>R===g.length-1?{operator:s.CFNumberOperator.lessThanOrEqual,value:{type:s.CFValueType.num,value:Number.MAX_SAFE_INTEGER},iconType:i,iconId:String(R)}:ho(i,R,g))}),[d,h]=x.useState(()=>n?!!n.isShowValue:!0),p=x.useMemo(()=>{const y=l.map(S=>po(S.iconType,S.iconId));return f.jsx("div",{className:P.iconWrap,children:y.map((S,R)=>S?f.jsx("img",{className:P.icon,src:S},R):f.jsx(kt,{className:P.icon},R))})},[l]),m=y=>{if(y.reduce((R,g,w)=>R.preType&&!R.result||y.length-1===w?R:g.value.type===s.CFValueType.formula?{preType:s.CFValueType.formula,result:!1}:R.preType?{result:R.preType===g.value.type,preType:g.value.type}:{result:!0,preType:g.value.type},{result:!0,preType:""}).result&&[s.CFValueType.num,s.CFValueType.percent,s.CFValueType.percentile].includes(y[0].value.type)){const R={};return y.forEach((g,w,O)=>{if(w-1<0||w===O.length-1)return;const j=y[w-1],H=s.getOppositeOperator(j.operator);s.compareWithNumber({operator:H,value:j.value.value},g.value.value)||(R[w]=`${r.t(`sheet.cf.form.${H}`,String(j.value.value))} `)}),R}return{}},C=(y,S)=>{Hu(l,y)!==S&&(Bc(l,y,S),u([...l]),o(m(l)))},b=y=>{c(y);const S=s.iconMap[y]||[],R=new Array(S.length).fill("").map((g,w,O)=>ho(y,w,O));u(R),o(m(R))};x.useEffect(()=>{const y=t.intercept(t.getInterceptPoints().submit,{handler(){return{type:s.CFRuleType.iconSet,isShowValue:d,config:l}}});return()=>{y()}},[d,l,t]),x.useEffect(()=>{const y=t.intercept(t.getInterceptPoints().beforeSubmit,{handler(){return Object.keys(a).length===0}});return()=>{y()}},[d,l,t,a]);const _=()=>{const y=l.map(S=>({...S}));l.forEach((S,R)=>{const g=l.length-1-R,w=y[g];S.iconId=w.iconId,S.iconType=w.iconType}),u([...l])};return f.jsxs("div",{className:P.iconSet,children:[f.jsx("div",{className:D.title,children:r.t("sheet.cf.panel.styleRule")}),f.jsx("div",{className:`${D.mTSm}`,children:f.jsx(B.Dropdown,{overlay:f.jsx(Bu,{iconType:i,onClick:b}),children:f.jsxs("div",{className:P.dropdownIcon,style:{width:"unset"},children:[p,f.jsx(In,{})]})})}),f.jsxs("div",{className:`${D.mTSm} ${P.renderConfig}`,children:[f.jsxs("div",{className:P.utilItem,children:[f.jsx(B.Checkbox,{onChange:_}),r.t("sheet.cf.iconSet.reverseIconOrder")]}),f.jsxs("div",{className:`${P.utilItem} ${D.mLXl}`,children:[f.jsx(B.Checkbox,{checked:!d,onChange:y=>{h(!y)}}),r.t("sheet.cf.iconSet.onlyShowIcon")]})]}),f.jsx(Fu,{errorMap:a,onChange:C,configList:l})]})},go=e=>e.getCurrentUniverSheetInstance().getUnitId(),mo=e=>e.getCurrentUniverSheetInstance().getActiveSheet().getSheetId(),Xu=e=>{var R,g;const t=Q.useDependency(v.LocaleService),n=Q.useDependency(v.ICommandService),r=Q.useDependency(v.IUniverInstanceService),a=Q.useDependency(s.ConditionalFormattingRuleModel),o=Q.useDependency(J.SelectionManagerService),i=go(r),c=mo(r),l=x.useRef([]),u=x.useMemo(()=>{var O,E;let w=(O=e.rule)==null?void 0:O.ranges;return w!=null&&w.length||(w=(E=o.getSelectionRanges())!=null?E:[]),w!=null&&w.length?w.map(j=>{const H=wr.serializeRange(j);return H==="NaN"?"":H}).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,p]=x.useState(()=>{var E,j;const w=(E=e.rule)==null?void 0:E.rule.type,O=d[0].value;if(!w)return O;switch(w){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 O}),m=x.useRef(),C=x.useMemo(()=>new v.InterceptorManager({beforeSubmit:Vl,submit:Al}),[]),b=x.useMemo(()=>{switch(h){case"1":return Wa;case"2":return Wl;case"3":return Ul;case"4":return zl;case"5":return $l;case"6":return qu;default:return Wa}},[h]);x.useEffect(()=>{var w;if(((w=e.rule)==null?void 0:w.cfId)!==void 0){const O=n.onCommandExecuted(E=>{if(E.id===J.RemoveSheetMutation.id){const j=E.params;j.subUnitId===c&&j.unitId===i&&e.onCancel()}E.id===J.SetWorksheetActiveOperation.id&&e.onCancel()});return()=>O.dispose()}},[(R=e.rule)==null?void 0:R.cfId]);const _=w=>{m.current=w},I=w=>{l.current=w.map(O=>O.range)},y=()=>{const w=C.fetchThroughInterceptors(C.getInterceptPoints().beforeSubmit)(!0,null),O=()=>{const E=r.getCurrentUniverSheetInstance().getActiveSheet();return l.current.map($=>J.setEndForRange($,E.getRowCount(),E.getColumnCount())).filter($=>!(Number.isNaN($.startRow)||Number.isNaN($.startColumn)))};if(w){const E=C.fetchThroughInterceptors(C.getInterceptPoints().submit)(null,null),j=O();if(E&&j.length){const H=go(r),$=mo(r);let ae={};e.rule&&e.rule.cfId?(ae={...e.rule,ranges:j,rule:E},n.executeCommand(Aa.id,{unitId:H,subUnitId:$,rule:ae}),e.onCancel()):(ae={cfId:a.createCfId(H,$),ranges:j,rule:E,stopIfTrue:!1},n.executeCommand(Va.id,{unitId:H,subUnitId:$,rule:ae}),e.onCancel())}}},S=()=>{e.onCancel()};return f.jsxs("div",{className:P.cfRuleStyleEditor,children:[f.jsx("div",{className:D.title,children:t.t("sheet.cf.panel.range")}),f.jsx("div",{className:`${D.mTBase}`,children:f.jsx(ve.RangeSelector,{placeholder:t.t("sheet.cf.form.rangeSelector"),width:"100%",openForSheetSubUnitId:c,openForSheetUnitId:i,value:u,id:v.createInternalEditorID(`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_rangeSelector`),onChange:I})}),f.jsx("div",{className:D.title,children:t.t("sheet.cf.panel.styleType")}),f.jsx("div",{className:D.mTBase,children:f.jsx(B.Select,{className:P.width100,value:h,options:d,onChange:w=>p(w)})}),f.jsx(b,{interceptorManager:C,rule:(g=e.rule)==null?void 0:g.rule,onChange:_}),f.jsxs("div",{className:`${D.mTBase} ${P.btnList}`,children:[f.jsx(B.Button,{size:"small",onClick:S,children:t.t("sheet.cf.panel.cancel")}),f.jsx(B.Button,{className:D.mLSm,size:"small",type:"primary",onClick:y,children:t.t("sheet.cf.panel.submit")})]})]})},Yu=e=>{const[t,n]=x.useState(e.rule),[r,a]=x.useState(!!e.rule),o=()=>{a(!0)},i=()=>{a(!1),n(void 0)},c=l=>{n(l),a(!0)};return f.jsx("div",{className:D.conditionalFormattingWrap,children:r?f.jsx(Xu,{onCancel:i,rule:t}):f.jsx(kl,{onClick:c,onCreate:o})})};var Ku=Object.defineProperty,Zu=Object.getOwnPropertyDescriptor,Ju=(e,t,n,r)=>{for(var a=r>1?void 0:r?Zu(t,n):t,o=e.length-1,i;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&Ku(t,n,a),a},Mt=(e,t)=>(n,r)=>t(n,r,e);const vo="sheet.conditional.formatting.panel";let Dt=class extends v.Disposable{constructor(e,t,n,r,a){super(),this._injector=e,this._componentManager=t,this._menuService=n,this._sidebarService=r,this._localeService=a,this._initMenu(),this._initPanel()}openPanel(e){const t={header:{title:this._localeService.t("sheet.cf.title")},children:{label:vo,rule:e}};this._sidebarService.open(t)}_initMenu(){this._menuService.addMenuItem(Fo(this._componentManager)(this._injector))}_initPanel(){this._componentManager.register(vo,Yu)}};Dt=Ju([v.OnLifecycle(v.LifecycleStages.Ready,Dt),Mt(0,L.Inject(L.Injector)),Mt(1,L.Inject(ve.ComponentManager)),Mt(2,L.Inject(ve.IMenuService)),Mt(3,L.Inject(ve.ISidebarService)),Mt(4,L.Inject(v.LocaleService))],Dt);var Te=(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))(Te||{});const yo={id:"sheet.operation.open.conditional.formatting.panel",type:v.CommandType.OPERATION,handler:(e,t)=>{const n=e.get(Dt),r=e.get(J.SelectionManagerService),a=e.get(v.ICommandService),o=r.getSelectionRanges()||[];switch(t.value){case 3:{n.openPanel({...s.createDefaultRule(),ranges:o});break}case 4:{const c={...s.createDefaultRule,ranges:o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.rank}};n.openPanel(c);break}case 5:{const c={...s.createDefaultRule,ranges:o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.formula,value:"="}};n.openPanel(c);break}case 6:{const c={...s.createDefaultRule,ranges:o,rule:{type:s.CFRuleType.colorScale,config:[]}};n.openPanel(c);break}case 7:{const c={...s.createDefaultRule,ranges:o,rule:{type:s.CFRuleType.dataBar,isShowValue:!0}};n.openPanel(c);break}case 8:{const c={...s.createDefaultRule,ranges:o,rule:{type:s.CFRuleType.iconSet,config:[],isShowValue:!0}};n.openPanel(c);break}case 2:{n.openPanel();break}case 1:{n.openPanel({...s.createDefaultRule(),ranges:o});break}case 9:{a.executeCommand(_r.id,{ranges:o});break}case 10:{a.executeCommand(Cn.id);break}}return!0}};var Qu=Object.defineProperty,ed=Object.getOwnPropertyDescriptor,td=(e,t,n,r)=>{for(var a=r>1?void 0:r?ed(t,n):t,o=e.length-1,i;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&Qu(t,n,a),a},it=(e,t)=>(n,r)=>t(n,r,e);let hn=class extends v.Disposable{constructor(e,t,n,r,a,o,i){super(),this._sheetInterceptorService=e,this._conditionalFormattingService=t,this._univerInstanceService=n,this._renderManagerService=r,this._conditionalFormattingViewModel=a,this._conditionalFormattingRuleModel=o,this._sheetSkeletonManagerService=i,this._initViewModelInterceptor(),this._initSkeleton(),this._initRender()}_initRender(){const e=[[s.dataBarUKey,s.DataBar],[s.IconUKey,s.ConditionalFormattingIcon]],t=r=>{const a=r&&this._renderManagerService.getRenderById(r),o=a&&a.mainComponent;o&&e.forEach(([i,c])=>{o.getExtensionByKey(i)||o.register(new c)})};this.disposeWithMe(this._renderManagerService.currentRender$.subscribe(r=>{r&&t(r)}));const n=this._univerInstanceService.getCurrentUniverSheetInstance();n&&t(n.getUnitId())}_initSkeleton(){const e=()=>{var n,r;this._sheetSkeletonManagerService.reCalculate();const t=this._univerInstanceService.getCurrentUniverSheetInstance().getUnitId();(r=(n=this._renderManagerService.getRenderById(t))==null?void 0:n.mainComponent)==null||r.makeDirty()};this.disposeWithMe(this._conditionalFormattingViewModel.markDirty$.pipe(Me.bufferTime(16),Me.filter(t=>{const n=this._univerInstanceService.getCurrentUniverSheetInstance(),r=n.getActiveSheet();return t.filter(a=>a.unitId===n.getUnitId()&&a.subUnitId===r.getSheetId()).length>0})).subscribe(e)),this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.pipe(Me.bufferTime(16),Me.filter(t=>{const n=this._univerInstanceService.getCurrentUniverSheetInstance(),r=n.getActiveSheet();return t.filter(a=>["sort","delete"].includes(a.type)&&a.unitId===n.getUnitId()&&a.subUnitId===r.getSheetId()).length>0})).subscribe(e)),this.disposeWithMe(this._conditionalFormattingService.ruleComputeStatus$.pipe(Me.bufferTime(16),Me.filter(t=>{const n=this._univerInstanceService.getCurrentUniverSheetInstance(),r=n.getActiveSheet();return t.filter(a=>a.unitId===n.getUnitId()&&a.subUnitId===r.getSheetId()).length>0})).subscribe(e))}_initViewModelInterceptor(){this.disposeWithMe(this._sheetInterceptorService.intercept(J.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 a=t.workbook.getStyles(),i={...(typeof(e==null?void 0:e.s)=="string"?a.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||(c.fontRenderExtension.isSkip=!0)),r.dataBar&&(c.dataBar=r.dataBar),r.iconSet&&(c.iconSet=r.iconSet,c.fontRenderExtension.leftOffset=s.DEFAULT_PADDING+s.DEFAULT_WIDTH),n(c)}}))}};hn=td([v.OnLifecycle(v.LifecycleStages.Rendered,hn),it(0,L.Inject(J.SheetInterceptorService)),it(1,L.Inject(s.ConditionalFormattingService)),it(2,L.Inject(v.IUniverInstanceService)),it(3,L.Inject(Io.IRenderManagerService)),it(4,L.Inject(s.ConditionalFormattingViewModel)),it(5,L.Inject(s.ConditionalFormattingRuleModel)),it(6,L.Inject(fe.SheetSkeletonManagerService))],hn);var nd=Object.defineProperty,rd=Object.getOwnPropertyDescriptor,ad=(e,t,n,r)=>{for(var a=r>1?void 0:r?rd(t,n):t,o=e.length-1,i;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&nd(t,n,a),a},Et=(e,t)=>(n,r)=>t(n,r,e);let gn=class extends v.Disposable{constructor(t,n,r,a,o){super();yt(this,"_copyInfo");this._sheetClipboardService=t,this._conditionalFormattingRuleModel=n,this._injector=r,this._conditionalFormattingViewModel=a,this._univerInstanceService=o,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,a)=>{const{copyType:o=fe.COPY_TYPE.COPY,pasteType:i}=a,{range:c}=t||{},{range:l}=n;return this._generateConditionalFormattingMutations(l,{copyType:o,pasteType:i,copyRange:c})}}))}_collectConditionalRule(t,n,r){const a=new v.ObjectMatrix,o={};this._copyInfo={matrix:a,info:{unitId:t,subUnitId:n,cfMap:o}};const i=this._conditionalFormattingViewModel.getMatrix(t,n);if(!i)return;const c=new Set;v.Range.foreach(r,(l,u)=>{const d=this._conditionalFormattingViewModel.getCellCf(t,n,l,u,i);if(!d)return;const h=v.Rectangle.getRelativeRange({startRow:l,endRow:l,startColumn:u,endColumn:u},r);d.cfList.forEach(p=>c.add(p.cfId)),a.setValue(h.startRow,h.startColumn,d.cfList.map(p=>p.cfId))}),c.forEach(l=>{const u=this._conditionalFormattingRuleModel.getRule(t,n,l);u&&(o[l]=u.rule)})}_generateConditionalFormattingMutations(t,n){const r=this._univerInstanceService.getCurrentUniverSheetInstance(),a=r.getActiveSheet(),o=r.getUnitId(),i=a.getSheetId();if(n.copyType===fe.COPY_TYPE.CUT)return this._copyInfo=null,{redos:[],undos:[]};if(!this._copyInfo||!n.copyRange)return{redos:[],undos:[]};if(![fe.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT,fe.PREDEFINED_HOOK_NAME.DEFAULT_PASTE,fe.PREDEFINED_HOOK_NAME.SPECIAL_PASTE_BESIDES_BORDER].includes(n.pasteType))return{redos:[],undos:[]};const c=fe.getRepeatRange(n.copyRange,t,!0),l=this._conditionalFormattingViewModel.getMatrix(o,i),u={};v.Range.foreach(t,(y,S)=>{const R=this._conditionalFormattingViewModel.getCellCf(o,i,y,S,l);R&&R.cfList.forEach(g=>{if(!u[g.cfId]){const w=new v.ObjectMatrix;u[g.cfId]=w;const O=this._conditionalFormattingRuleModel.getRule(o,i,g.cfId);O==null||O.ranges.forEach(E=>{v.Range.foreach(E,(j,H)=>{w.setValue(j,H,1)})})}u[g.cfId].realDeleteValue(y,S)})});const{matrix:d,info:h}=this._copyInfo,p=[];let m=this._conditionalFormattingRuleModel.createCfId(o,i);const C={},b=y=>{if(C[y])return C[y];const S=h==null?void 0:h.cfMap[y],R=[...this._conditionalFormattingRuleModel.getSubunitRules(o,i)||[],...p].find(g=>v.Tools.diffValue(g.rule,S));if(R)return C[y]=R,R;{const g={rule:S,cfId:m,ranges:[],stopIfTrue:!1};return C[y]=g,p.push(g),m=`${Number(m)+1}`,g}};c.forEach(y=>{d&&d.forValue((S,R,g)=>{const w=v.Rectangle.getPositionRange({startRow:S,endRow:S,startColumn:R,endColumn:R},y.startRange),O=w.startRow,E=w.startColumn;g.forEach(j=>{if(!u[j]){const H=b(j),$=new v.ObjectMatrix;u[j]=$,H.ranges.forEach(ae=>{v.Range.foreach(ae,(T,M)=>{$.setValue(T,M,1)})})}u[j].setValue(O,E,1)})})});const _=[],I=[];for(const y in u){const S=u[y],R=J.findAllRectangle(J.createTopMatrixFromMatrix(S));if(!R.length){const g={unitId:o,subUnitId:i,cfId:y};_.push({id:s.DeleteConditionalRuleMutation.id,params:g}),I.push(...s.DeleteConditionalRuleMutationUndoFactory(this._injector,g))}if(p.some(g=>g.cfId===y)){const g=b(y),w={unitId:o,subUnitId:i,rule:{...g,ranges:R}};_.push({id:s.AddConditionalRuleMutation.id,params:w}),I.push(s.AddConditionalRuleMutationUndoFactory(this._injector,w))}else{const g=this._conditionalFormattingRuleModel.getRule(o,i,y);if(!g)continue;const w={unitId:o,subUnitId:i,rule:{...g,ranges:R}};_.push({id:s.SetConditionalRuleMutation.id,params:w}),I.push(...s.setConditionalRuleMutationUndoFactory(this._injector,w))}}return{redos:_,undos:I}}};gn=ad([v.OnLifecycle(v.LifecycleStages.Rendered,gn),Et(0,L.Inject(fe.ISheetClipboardService)),Et(1,L.Inject(s.ConditionalFormattingRuleModel)),Et(2,L.Inject(L.Injector)),Et(3,L.Inject(s.ConditionalFormattingViewModel)),Et(4,L.Inject(v.IUniverInstanceService))],gn);var od=Object.defineProperty,id=Object.getOwnPropertyDescriptor,sd=(e,t,n,r)=>{for(var a=r>1?void 0:r?id(t,n):t,o=e.length-1,i;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&od(t,n,a),a},Pt=(e,t)=>(n,r)=>t(n,r,e);let mn=class extends v.Disposable{constructor(e,t,n,r,a){super(),this._injector=e,this._univerInstanceService=t,this._autoFillService=n,this._conditionalFormattingRuleModel=r,this._conditionalFormattingViewModel=a,this._initAutoFill()}_initAutoFill(){const e=()=>({redos:[],undos:[]}),t=(a,o,i,c)=>{const l=this._univerInstanceService.getCurrentUniverSheetInstance().getUnitId(),u=this._univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet().getSheetId(),d={startRow:a.row,startColumn:a.col,endColumn:a.col,endRow:a.row},h={startRow:o.row,startColumn:o.col,endColumn:o.col,endRow:o.row};v.Range.foreach(i,(p,m)=>{const C=v.Rectangle.getPositionRange({startRow:p,startColumn:m,endColumn:m,endRow:p},d),b=v.Rectangle.getPositionRange({startRow:p,startColumn:m,endColumn:m,endRow:p},h),_=this._conditionalFormattingViewModel.getCellCf(l,u,C.startRow,C.startColumn),I=this._conditionalFormattingViewModel.getCellCf(l,u,b.startRow,b.startColumn);I&&I.cfList.forEach(y=>{let S=c.get(y.cfId);if(!c.get(y.cfId)){const R=this._conditionalFormattingRuleModel.getRule(l,u,y.cfId);if(!R)return;S=new v.ObjectMatrix,R.ranges.forEach(g=>{v.Range.foreach(g,(w,O)=>{S.setValue(w,O,1)})}),c.set(y.cfId,S)}S.realDeleteValue(b.startRow,b.startColumn)}),_&&_.cfList.forEach(y=>{let S=c.get(y.cfId);if(!c.get(y.cfId)){const R=this._conditionalFormattingRuleModel.getRule(l,u,y.cfId);if(!R)return;S=new v.ObjectMatrix,R.ranges.forEach(g=>{v.Range.foreach(g,(w,O)=>{S.setValue(w,O,1)})}),c.set(y.cfId,S)}S.setValue(b.startRow,b.startColumn,1)})})},n=(a,o)=>{const i=this._univerInstanceService.getCurrentUniverSheetInstance().getUnitId(),c=this._univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet().getSheetId(),l=new Map,u=[],d=[],h={row:a.startRow,col:a.startColumn};return fe.getAutoFillRepeatRange(a,o).forEach(m=>{t(h,m.repeatStartCell,m.relativeRange,l)}),l.forEach((m,C)=>{const b=this._conditionalFormattingRuleModel.getRule(i,c,C);if(!b)return;const _=J.findAllRectangle(J.createTopMatrixFromMatrix(m)),I={unitId:i,subUnitId:c,rule:{...b,ranges:_}};u.push({id:s.SetConditionalRuleMutation.id,params:I}),d.push(...s.setConditionalRuleMutationUndoFactory(this._injector,I))}),{undos:d,redos:u}},r={id:s.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onFillData:(a,o,i)=>{if(i===fe.APPLY_TYPE.COPY||i===fe.APPLY_TYPE.ONLY_FORMAT||i===fe.APPLY_TYPE.SERIES){const{source:c,target:l}=a;return n(c,l)}return e()}};this.disposeWithMe(this._autoFillService.addHook(r))}};mn=sd([v.OnLifecycle(v.LifecycleStages.Rendered,mn),Pt(0,L.Inject(L.Injector)),Pt(1,L.Inject(v.IUniverInstanceService)),Pt(2,L.Inject(fe.IAutoFillService)),Pt(3,L.Inject(s.ConditionalFormattingRuleModel)),Pt(4,L.Inject(s.ConditionalFormattingViewModel))],mn);var ld=Object.defineProperty,cd=Object.getOwnPropertyDescriptor,ud=(e,t,n,r)=>{for(var a=r>1?void 0:r?cd(t,n):t,o=e.length-1,i;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&ld(t,n,a),a},Nt=(e,t)=>(n,r)=>t(n,r,e);let vn=class extends v.Disposable{constructor(e,t,n,r,a){super(),this._conditionalFormattingRuleModel=e,this._univerInstanceService=t,this._injector=n,this._sheetSkeletonManagerService=r,this._refRangeService=a,this._initRefRange()}_initRefRange(){const e=new Map,t=(r,a,o)=>`${r}_${a}_${o}`,n=(r,a,o)=>{const i=l=>{const u=[...o.ranges],d=u.map(p=>J.handleDefaultRangeChangeWithEffectRefCommands(p,l)).filter(p=>!!p);if(s.isRangesEqual(d,u))return{redos:[],undos:[]};if(d.length){const p={unitId:r,subUnitId:a,rule:{...o,ranges:d}},m=[{id:s.SetConditionalRuleMutation.id,params:p}],C=s.setConditionalRuleMutationUndoFactory(this._injector,p);return{redos:m,undos:C}}else{const p={unitId:r,subUnitId:a,cfId:o.cfId},m=[{id:s.DeleteConditionalRuleMutation.id,params:p}],C=s.DeleteConditionalRuleMutationUndoFactory(this._injector,p);return{redos:m,undos:C}}},c=[];o.ranges.forEach(l=>{const u=this._refRangeService.registerRefRange(l,i);c.push(()=>u.dispose())}),e.set(t(r,a,o.cfId),()=>c.forEach(l=>l()))};this.disposeWithMe(Re.merge(this._sheetSkeletonManagerService.currentSkeleton$.pipe(Me.map(r=>r==null?void 0:r.sheetId),Me.distinctUntilChanged())).pipe(Me.switchMap(()=>new Re.Observable(r=>{const a=new v.DisposableCollection;return r.next(a),()=>{a.dispose()}}))).subscribe(r=>{r.add(v.toDisposable(this._conditionalFormattingRuleModel.$ruleChange.subscribe(a=>{const{unitId:o,subUnitId:i,rule:c}=a,l=this._univerInstanceService.getCurrentUniverSheetInstance(),u=l.getActiveSheet();if(!(a.unitId!==l.getUnitId()||a.subUnitId!==u.getSheetId()))switch(a.type){case"add":{n(a.unitId,a.subUnitId,a.rule);break}case"delete":{const d=e.get(t(o,i,c.cfId));d&&d();break}case"set":{const d=e.get(t(o,i,c.cfId));d&&d(),n(a.unitId,a.subUnitId,a.rule)}}})))})),this.disposeWithMe(v.toDisposable(()=>{e.forEach(r=>{r()}),e.clear()}))}};vn=ud([v.OnLifecycle(v.LifecycleStages.Rendered,vn),Nt(0,L.Inject(s.ConditionalFormattingRuleModel)),Nt(1,L.Inject(v.IUniverInstanceService)),Nt(2,L.Inject(L.Injector)),Nt(3,L.Inject(fe.SheetSkeletonManagerService)),Nt(4,L.Inject(J.RefRangeService))],vn);var dd=Object.defineProperty,fd=Object.getOwnPropertyDescriptor,pd=(e,t,n,r)=>{for(var a=r>1?void 0:r?fd(t,n):t,o=e.length-1,i;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&dd(t,n,a),a},So=(e,t)=>(n,r)=>t(n,r,e);let yn=class extends v.Disposable{constructor(e,t){super(),this._editorBridgeService=e,this._conditionalFormattingService=t,this._initInterceptorEditorEnd()}_initInterceptorEditorEnd(){this.disposeWithMe(v.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 a=Object.keys(r==null?void 0:r.style);if(a.length>0){const o=s.getStringFromDataStream(e.p),i={...(typeof e.s=="string"?t.workbook.getStyles().get(e.s):e.s)||{}};a.forEach(l=>{delete i[l]});const c={...e,s:{...i},v:o};return delete c.p,n(c)}}return n(e)}})))}};yn=pd([v.OnLifecycle(v.LifecycleStages.Rendered,yn),So(0,L.Inject(fe.IEditorBridgeService)),So(1,L.Inject(s.ConditionalFormattingService))],yn);var hd=Object.defineProperty,gd=Object.getOwnPropertyDescriptor,md=(e,t,n,r)=>{for(var a=r>1?void 0:r?gd(t,n):t,o=e.length-1,i;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&hd(t,n,a),a},jt=(e,t)=>(n,r)=>t(n,r,e);let Sn=class extends v.Disposable{constructor(e,t,n,r,a){super(),this._injector=e,this._univerInstanceService=t,this._sheetInterceptorService=n,this._selectionManagerService=r,this._conditionalFormattingRuleModel=a,this._init()}_init(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{const t=[],n=[],r={redos:t,undos:n};if([J.ClearSelectionFormatCommand.id,J.ClearSelectionAllCommand.id].includes(e.id)){const a=this._selectionManagerService.getSelectionRanges();if(!a)return r;const o=this._univerInstanceService.getCurrentUniverSheetInstance(),i=o.getActiveSheet(),c=this._conditionalFormattingRuleModel.getSubunitRules(o.getUnitId(),i.getSheetId());if(!c||!c.length)return r;c.filter(l=>a.some(u=>l.ranges.some(d=>v.Rectangle.getIntersects(d,u)))).forEach(l=>{const d=new J.RangeMergeUtil().add(...l.ranges).subtract(...a).merge();if(d.length){const h={id:s.SetConditionalRuleMutation.id,params:{unitId:o.getUnitId(),subUnitId:i.getSheetId(),rule:{...l,ranges:d}}},p=s.setConditionalRuleMutationUndoFactory(this._injector,h.params);t.push(h),n.push(...p)}else{const h={id:s.DeleteConditionalRuleMutation.id,params:{unitId:o.getUnitId(),subUnitId:i.getSheetId(),cfId:l.cfId}},p=s.DeleteConditionalRuleMutationUndoFactory(this._injector,h.params);t.push(h),n.push(...p)}})}return r}}))}};Sn=md([v.OnLifecycle(v.LifecycleStages.Rendered,Sn),jt(0,L.Inject(L.Injector)),jt(1,L.Inject(v.IUniverInstanceService)),jt(2,L.Inject(J.SheetInterceptorService)),jt(3,L.Inject(J.SelectionManagerService)),jt(4,L.Inject(s.ConditionalFormattingRuleModel))],Sn);var vd=Object.defineProperty,yd=Object.getOwnPropertyDescriptor,Sd=(e,t,n,r)=>{for(var a=r>1?void 0:r?yd(t,n):t,o=e.length-1,i;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&vd(t,n,a),a},bo=(e,t)=>(n,r)=>t(n,r,e);F.UniverSheetsConditionalFormattingUIPlugin=(bn=class extends v.Plugin{constructor(t,n,r){super(s.SHEET_CONDITIONAL_FORMATTING_PLUGIN),this._injector=n,this._commandService=r,this._initCommand(),s.SheetsConditionalFormattingPlugin.dependencyList.forEach(a=>{this._injector.add(a)}),this._injector.add([hn]),this._injector.add([vn]),this._injector.add([gn]),this._injector.add([mn]),this._injector.add([Dt]),this._injector.add([_t]),this._injector.add([yn]),this._injector.add([Sn])}_initCommand(){[...s.SheetsConditionalFormattingPlugin.mutationList,...F.UniverSheetsConditionalFormattingUIPlugin.commandList].forEach(t=>{this._commandService.registerCommand(t)})}},yt(bn,"type",v.PluginType.Sheet),yt(bn,"commandList",[wo,To,_o,xo,Oo,Mo,Do,Eo,Po,yo,dr,Aa,ja,Va,_r,Cn]),bn),F.UniverSheetsConditionalFormattingUIPlugin=Sd([bo(1,L.Inject(L.Injector)),bo(2,L.Inject(v.ICommandService))],F.UniverSheetsConditionalFormattingUIPlugin),F.enUS=Ml,F.zhCN=La,Object.defineProperty(F,Symbol.toStringTag,{value:"Module"})});
|
|
11
|
+
`,e.getElementsByTagName("head")[0].appendChild(t)),e.body&&oa(e.body,"react-draggable-transparent-selection")}function Fi(e){if(e)try{if(e.body&&ia(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 oa(e,t){e.classList?e.classList.add(t):e.className.match(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)")))||(e.className+=" ".concat(t))}function ia(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)"),"g"),"")}var Ne={};Object.defineProperty(Ne,"__esModule",{value:!0}),Ne.canDragX=Xi,Ne.canDragY=Yi,Ne.createCoreData=Zi,Ne.createDraggableData=Ji,Ne.getBoundPosition=Gi,Ne.getControlPosition=Ki,Ne.snapToGrid=qi;var we=Pe,ut=ae;function Gi(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r=="string"?r:Qi(r);const a=kn(e);if(typeof r=="string"){const{ownerDocument:o}=a,i=o.defaultView;let u;if(r==="parent"?u=a.parentNode:u=o.querySelector(r),!(u instanceof i.HTMLElement))throw new Error('Bounds selector "'+r+'" could not find an element.');const l=u,c=i.getComputedStyle(a),d=i.getComputedStyle(l);r={left:-a.offsetLeft+(0,we.int)(d.paddingLeft)+(0,we.int)(c.marginLeft),top:-a.offsetTop+(0,we.int)(d.paddingTop)+(0,we.int)(c.marginTop),right:(0,ut.innerWidth)(l)-(0,ut.outerWidth)(a)-a.offsetLeft+(0,we.int)(d.paddingRight)-(0,we.int)(c.marginRight),bottom:(0,ut.innerHeight)(l)-(0,ut.outerHeight)(a)-a.offsetTop+(0,we.int)(d.paddingBottom)-(0,we.int)(c.marginBottom)}}return(0,we.isNum)(r.right)&&(t=Math.min(t,r.right)),(0,we.isNum)(r.bottom)&&(n=Math.min(n,r.bottom)),(0,we.isNum)(r.left)&&(t=Math.max(t,r.left)),(0,we.isNum)(r.top)&&(n=Math.max(n,r.top)),[t,n]}function qi(e,t,n){const r=Math.round(t/e[0])*e[0],a=Math.round(n/e[1])*e[1];return[r,a]}function Xi(e){return e.props.axis==="both"||e.props.axis==="x"}function Yi(e){return e.props.axis==="both"||e.props.axis==="y"}function Ki(e,t,n){const r=typeof t=="number"?(0,ut.getTouch)(e,t):null;if(typeof t=="number"&&!r)return null;const a=kn(n),o=n.props.offsetParent||a.offsetParent||a.ownerDocument.body;return(0,ut.offsetXYFromParent)(r||e,o,n.props.scale)}function Zi(e,t,n){const r=!(0,we.isNum)(e.lastX),a=kn(e);return r?{node:a,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:a,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}}function Ji(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 Qi(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function kn(e){const t=e.findDOMNode();if(!t)throw new Error("<DraggableCore>: Unmounted during event!");return t}var Bt={},Ft={};Object.defineProperty(Ft,"__esModule",{value:!0}),Ft.default=es;function es(){}Object.defineProperty(Bt,"__esModule",{value:!0}),Bt.default=void 0;var Wn=ns(w),ye=Bn($e),ts=Bn(wr),pe=ae,Be=Ne,$n=Pe,Rt=Bn(Ft);function Bn(e){return e&&e.__esModule?e:{default:e}}function sa(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(sa=function(r){return r?n:t})(e)}function ns(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=sa(t);if(n&&n.has(e))return n.get(e);var r={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(o!=="default"&&Object.prototype.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}function ge(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=as(e,"string");return typeof t=="symbol"?t:String(t)}function as(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 Me={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let Fe=Me.mouse,Gt=class extends Wn.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 a=(0,pe.getTouchIdentifier)(t);this.touchIdentifier=a;const o=(0,Be.getControlPosition)(t,a,this);if(o==null)return;const{x:i,y:u}=o,l=(0,Be.createCoreData)(this,i,u);(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,pe.addUserSelectStyles)(r),this.dragging=!0,this.lastX=i,this.lastY=u,(0,pe.addEvent)(r,Fe.move,this.handleDrag),(0,pe.addEvent)(r,Fe.stop,this.handleDragStop))}),ge(this,"handleDrag",t=>{const n=(0,Be.getControlPosition)(t,this.touchIdentifier,this);if(n==null)return;let{x:r,y:a}=n;if(Array.isArray(this.props.grid)){let u=r-this.lastX,l=a-this.lastY;if([u,l]=(0,Be.snapToGrid)(this.props.grid,u,l),!u&&!l)return;r=this.lastX+u,a=this.lastY+l}const o=(0,Be.createCoreData)(this,r,a);if((0,Rt.default)("DraggableCore: handleDrag: %j",o),this.props.onDrag(t,o)===!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=a}),ge(this,"handleDragStop",t=>{if(!this.dragging)return;const n=(0,Be.getControlPosition)(t,this.touchIdentifier,this);if(n==null)return;let{x:r,y:a}=n;if(Array.isArray(this.props.grid)){let l=r-this.lastX||0,c=a-this.lastY||0;[l,c]=(0,Be.snapToGrid)(this.props.grid,l,c),r=this.lastX+l,a=this.lastY+c}const o=(0,Be.createCoreData)(this,r,a);if(this.props.onStop(t,o)===!1||this.mounted===!1)return!1;const u=this.findDOMNode();u&&this.props.enableUserSelectHack&&(0,pe.removeUserSelectStyles)(u.ownerDocument),(0,Rt.default)("DraggableCore: handleDragStop: %j",o),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,u&&((0,Rt.default)("DraggableCore: Removing handlers"),(0,pe.removeEvent)(u.ownerDocument,Fe.move,this.handleDrag),(0,pe.removeEvent)(u.ownerDocument,Fe.stop,this.handleDragStop))}),ge(this,"onMouseDown",t=>(Fe=Me.mouse,this.handleDragStart(t))),ge(this,"onMouseUp",t=>(Fe=Me.mouse,this.handleDragStop(t))),ge(this,"onTouchStart",t=>(Fe=Me.touch,this.handleDragStart(t))),ge(this,"onTouchEnd",t=>(Fe=Me.touch,this.handleDragStop(t)))}componentDidMount(){this.mounted=!0;const t=this.findDOMNode();t&&(0,pe.addEvent)(t,Me.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const t=this.findDOMNode();if(t){const{ownerDocument:n}=t;(0,pe.removeEvent)(n,Me.mouse.move,this.handleDrag),(0,pe.removeEvent)(n,Me.touch.move,this.handleDrag),(0,pe.removeEvent)(n,Me.mouse.stop,this.handleDragStop),(0,pe.removeEvent)(n,Me.touch.stop,this.handleDragStop),(0,pe.removeEvent)(t,Me.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:ts.default.findDOMNode(this)}render(){return Wn.cloneElement(Wn.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};Bt.default=Gt,ge(Gt,"displayName","DraggableCore"),ge(Gt,"propTypes",{allowAnyClick:ye.default.bool,children:ye.default.node.isRequired,disabled:ye.default.bool,enableUserSelectHack:ye.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:ye.default.arrayOf(ye.default.number),handle:ye.default.string,cancel:ye.default.string,nodeRef:ye.default.object,onStart:ye.default.func,onDrag:ye.default.func,onStop:ye.default.func,onMouseDown:ye.default.func,scale:ye.default.number,className:$n.dontSetMe,style:$n.dontSetMe,transform:$n.dontSetMe}),ge(Gt,"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($e),r=d(wr),a=d(We),o=ae,i=Ne,u=Pe,l=d(Bt),c=d(Ft);function d(b){return b&&b.__esModule?b:{default:b}}function h(b){if(typeof WeakMap!="function")return null;var S=new WeakMap,C=new WeakMap;return(h=function(g){return g?C:S})(b)}function f(b,S){if(!S&&b&&b.__esModule)return b;if(b===null||typeof b!="object"&&typeof b!="function")return{default:b};var C=h(S);if(C&&C.has(b))return C.get(b);var g={},O=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var M in b)if(M!=="default"&&Object.prototype.hasOwnProperty.call(b,M)){var I=O?Object.getOwnPropertyDescriptor(b,M):null;I&&(I.get||I.set)?Object.defineProperty(g,M,I):g[M]=b[M]}return g.default=b,C&&C.set(b,g),g}function v(){return v=Object.assign?Object.assign.bind():function(b){for(var S=1;S<arguments.length;S++){var C=arguments[S];for(var g in C)Object.prototype.hasOwnProperty.call(C,g)&&(b[g]=C[g])}return b},v.apply(this,arguments)}function y(b,S,C){return S=T(S),S in b?Object.defineProperty(b,S,{value:C,enumerable:!0,configurable:!0,writable:!0}):b[S]=C,b}function T(b){var S=x(b,"string");return typeof S=="symbol"?S:String(S)}function x(b,S){if(typeof b!="object"||b===null)return b;var C=b[Symbol.toPrimitive];if(C!==void 0){var g=C.call(b,S||"default");if(typeof g!="object")return g;throw new TypeError("@@toPrimitive must return a primitive value.")}return(S==="string"?String:Number)(b)}class _ extends t.Component{static getDerivedStateFromProps(S,C){let{position:g}=S,{prevPropsPosition:O}=C;return g&&(!O||g.x!==O.x||g.y!==O.y)?((0,c.default)("Draggable: getDerivedStateFromProps %j",{position:g,prevPropsPosition:O}),{x:g.x,y:g.y,prevPropsPosition:{...g}}):null}constructor(S){super(S),y(this,"onDragStart",(C,g)=>{if((0,c.default)("Draggable: onDragStart: %j",g),this.props.onStart(C,(0,i.createDraggableData)(this,g))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),y(this,"onDrag",(C,g)=>{if(!this.state.dragging)return!1;(0,c.default)("Draggable: onDrag: %j",g);const O=(0,i.createDraggableData)(this,g),M={x:O.x,y:O.y,slackX:0,slackY:0};if(this.props.bounds){const{x:j,y:L}=M;M.x+=this.state.slackX,M.y+=this.state.slackY;const[U,F]=(0,i.getBoundPosition)(this,M.x,M.y);M.x=U,M.y=F,M.slackX=this.state.slackX+(j-M.x),M.slackY=this.state.slackY+(L-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(C,O)===!1)return!1;this.setState(M)}),y(this,"onDragStop",(C,g)=>{if(!this.state.dragging||this.props.onStop(C,(0,i.createDraggableData)(this,g))===!1)return!1;(0,c.default)("Draggable: onDragStop: %j",g);const M={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:j,y:L}=this.props.position;M.x=j,M.y=L}this.setState(M)}),this.state={dragging:!1,dragged:!1,x:S.position?S.position.x:S.defaultPosition.x,y:S.position?S.position.y:S.defaultPosition.y,prevPropsPosition:{...S.position},slackX:0,slackY:0,isElementSVG:!1},S.position&&!(S.onDrag||S.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 S,C;return(S=(C=this.props)===null||C===void 0||(C=C.nodeRef)===null||C===void 0?void 0:C.current)!==null&&S!==void 0?S:r.default.findDOMNode(this)}render(){const{axis:S,bounds:C,children:g,defaultPosition:O,defaultClassName:M,defaultClassNameDragging:I,defaultClassNameDragged:j,position:L,positionOffset:U,scale:F,...R}=this.props;let E={},J=null;const z=!!!L||this.state.dragging,q=L||O,ne={x:(0,i.canDragX)(this)&&z?this.state.x:q.x,y:(0,i.canDragY)(this)&&z?this.state.y:q.y};this.state.isElementSVG?J=(0,o.createSVGTransform)(ne,U):E=(0,o.createCSSTransform)(ne,U);const ce=(0,a.default)(g.props.className||"",M,{[I]:this.state.dragging,[j]:this.state.dragged});return t.createElement(l.default,v({},R,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),t.cloneElement(t.Children.only(g),{className:ce,style:{...g.props.style,...E},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:u.dontSetMe,style:u.dontSetMe,transform:u.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})}(Qr);const{default:la,DraggableCore:os}=Qr;Wt.exports=la,Wt.exports.default=la,Wt.exports.DraggableCore=os;var ua=Wt.exports,qt={exports:{}},Ct={},Fn={};Fn.__esModule=!0,Fn.cloneElement=ds;var is=ss(w);function ss(e){return e&&e.__esModule?e:{default:e}}function ca(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function da(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ca(Object(n),!0).forEach(function(r){ls(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ca(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ls(e,t,n){return t=us(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function us(e){var t=cs(e,"string");return typeof t=="symbol"?t:String(t)}function cs(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=da(da({},e.props.style),t.style)),t.className&&e.props.className&&(t.className=e.props.className+" "+t.className),is.default.cloneElement(e,t)}var _t={};_t.__esModule=!0,_t.resizableProps=void 0;var W=fs($e);function fs(e){return e&&e.__esModule?e:{default:e}}var ps={axis:W.default.oneOf(["both","x","y","none"]),className:W.default.string,children:W.default.element.isRequired,draggableOpts:W.default.shape({allowAnyClick:W.default.bool,cancel:W.default.string,children:W.default.node,disabled:W.default.bool,enableUserSelectHack:W.default.bool,offsetParent:W.default.node,grid:W.default.arrayOf(W.default.number),handle:W.default.string,nodeRef:W.default.object,onStart:W.default.func,onDrag:W.default.func,onStop:W.default.func,onMouseDown:W.default.func,scale:W.default.number}),height:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var a=n[0];if(a.axis==="both"||a.axis==="y"){var o;return(o=W.default.number).isRequired.apply(o,n)}return W.default.number.apply(W.default,n)},handle:W.default.oneOfType([W.default.node,W.default.func]),handleSize:W.default.arrayOf(W.default.number),lockAspectRatio:W.default.bool,maxConstraints:W.default.arrayOf(W.default.number),minConstraints:W.default.arrayOf(W.default.number),onResizeStop:W.default.func,onResizeStart:W.default.func,onResize:W.default.func,resizeHandles:W.default.arrayOf(W.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:W.default.number,width:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var a=n[0];if(a.axis==="both"||a.axis==="x"){var o;return(o=W.default.number).isRequired.apply(o,n)}return W.default.number.apply(W.default,n)}};_t.resizableProps=ps,Ct.__esModule=!0,Ct.default=void 0;var wt=ys(w),hs=ua,ms=Fn,gs=_t,vs=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function fa(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(fa=function(a){return a?n:t})(e)}function ys(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=fa(t);if(n&&n.has(e))return n.get(e);var r={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(o!=="default"&&Object.prototype.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}function Gn(){return Gn=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},Gn.apply(this,arguments)}function Ss(e,t){if(e==null)return{};var n={},r=Object.keys(e),a,o;for(o=0;o<r.length;o++)a=r[o],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}function pa(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function qn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?pa(Object(n),!0).forEach(function(r){bs(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pa(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function bs(e,t,n){return t=Ts(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ts(e){var t=Rs(e,"string");return typeof t=="symbol"?t:String(t)}function Rs(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 Cs(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Xn(e,t)}function Xn(e,t){return Xn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},Xn(e,t)}var Yn=function(e){Cs(t,e);function t(){for(var r,a=arguments.length,o=new Array(a),i=0;i<a;i++)o[i]=arguments[i];return r=e.call.apply(e,[this].concat(o))||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(a,o){var i=this.props,u=i.minConstraints,l=i.maxConstraints,c=i.lockAspectRatio;if(!u&&!l&&!c)return[a,o];if(c){var d=this.props.width/this.props.height,h=a-this.props.width,f=o-this.props.height;Math.abs(h)>Math.abs(f*d)?o=a/d:a=o*d}var v=a,y=o,T=this.slack||[0,0],x=T[0],_=T[1];return a+=x,o+=_,u&&(a=Math.max(u[0],a),o=Math.max(u[1],o)),l&&(a=Math.min(l[0],a),o=Math.min(l[1],o)),this.slack=[x+(v-a),_+(y-o)],[a,o]},n.resizeHandler=function(a,o){var i=this;return function(u,l){var c=l.node,d=l.deltaX,h=l.deltaY;a==="onResizeStart"&&i.resetData();var f=(i.props.axis==="both"||i.props.axis==="x")&&o!=="n"&&o!=="s",v=(i.props.axis==="both"||i.props.axis==="y")&&o!=="e"&&o!=="w";if(!(!f&&!v)){var y=o[0],T=o[o.length-1],x=c.getBoundingClientRect();if(i.lastHandleRect!=null){if(T==="w"){var _=x.left-i.lastHandleRect.left;d+=_}if(y==="n"){var b=x.top-i.lastHandleRect.top;h+=b}}i.lastHandleRect=x,T==="w"&&(d=-d),y==="n"&&(h=-h);var S=i.props.width+(f?d/i.props.transformScale:0),C=i.props.height+(v?h/i.props.transformScale:0),g=i.runConstraints(S,C);S=g[0],C=g[1];var O=S!==i.props.width||C!==i.props.height,M=typeof i.props[a]=="function"?i.props[a]:null,I=a==="onResize"&&!O;M&&!I&&(u.persist==null||u.persist(),M(u,{node:c,size:{width:S,height:C},handle:o})),a==="onResizeStop"&&i.resetData()}}},n.renderResizeHandle=function(a,o){var i=this.props.handle;if(!i)return wt.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+a,ref:o});if(typeof i=="function")return i(a,o);var u=typeof i.type=="string",l=qn({ref:o},u?{}:{handleAxis:a});return wt.cloneElement(i,l)},n.render=function(){var a=this,o=this.props,i=o.children,u=o.className,l=o.draggableOpts;o.width,o.height,o.handle,o.handleSize,o.lockAspectRatio,o.axis,o.minConstraints,o.maxConstraints,o.onResize,o.onResizeStop,o.onResizeStart;var c=o.resizeHandles;o.transformScale;var d=Ss(o,vs);return(0,ms.cloneElement)(i,qn(qn({},d),{},{className:(u?u+" ":"")+"react-resizable",children:[].concat(i.props.children,c.map(function(h){var f,v=(f=a.handleRefs[h])!=null?f:a.handleRefs[h]=wt.createRef();return wt.createElement(hs.DraggableCore,Gn({},l,{nodeRef:v,key:"resizableHandle-"+h,onStop:a.resizeHandler("onResizeStop",h),onStart:a.resizeHandler("onResizeStart",h),onDrag:a.resizeHandler("onResize",h)}),a.renderResizeHandle(h,v))}))}))},t}(wt.Component);Ct.default=Yn,Yn.propTypes=gs.resizableProps,Yn.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1};var Xt={};Xt.__esModule=!0,Xt.default=void 0;var Kn=Os(w),_s=ha($e),ws=ha(Ct),Is=_t,xs=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function ha(e){return e&&e.__esModule?e:{default:e}}function ma(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(ma=function(a){return a?n:t})(e)}function Os(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=ma(t);if(n&&n.has(e))return n.get(e);var r={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(o!=="default"&&Object.prototype.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}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 ga(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).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?ga(Object(n),!0).forEach(function(r){Es(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ga(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Es(e,t,n){return t=Ms(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ms(e){var t=Ds(e,"string");return typeof t=="symbol"?t:String(t)}function Ds(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 Ps(e,t){if(e==null)return{};var n={},r=Object.keys(e),a,o;for(o=0;o<r.length;o++)a=r[o],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}function Ns(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Jn(e,t)}function Jn(e,t){return Jn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},Jn(e,t)}var va=function(e){Ns(t,e);function t(){for(var r,a=arguments.length,o=new Array(a),i=0;i<a;i++)o[i]=arguments[i];return r=e.call.apply(e,[this].concat(o))||this,r.state={width:r.props.width,height:r.props.height,propsWidth:r.props.width,propsHeight:r.props.height},r.onResize=function(u,l){var c=l.size;r.props.onResize?(u.persist==null||u.persist(),r.setState(c,function(){return r.props.onResize&&r.props.onResize(u,l)})):r.setState(c)},r}t.getDerivedStateFromProps=function(a,o){return o.propsWidth!==a.width||o.propsHeight!==a.height?{width:a.width,height:a.height,propsWidth:a.width,propsHeight:a.height}:null};var n=t.prototype;return n.render=function(){var a=this.props,o=a.handle,i=a.handleSize;a.onResize;var u=a.onResizeStart,l=a.onResizeStop,c=a.draggableOpts,d=a.minConstraints,h=a.maxConstraints,f=a.lockAspectRatio,v=a.axis;a.width,a.height;var y=a.resizeHandles,T=a.style,x=a.transformScale,_=Ps(a,xs);return Kn.createElement(ws.default,{axis:v,draggableOpts:c,handle:o,handleSize:i,height:this.state.height,lockAspectRatio:f,maxConstraints:h,minConstraints:d,onResizeStart:u,onResize:this.onResize,onResizeStop:l,resizeHandles:y,transformScale:x,width:this.state.width},Kn.createElement("div",Zn({},_,{style:Yt(Yt({},T),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},t}(Kn.Component);Xt.default=va,va.propTypes=Yt(Yt({},Is.resizableProps),{},{children:_s.default.element}),qt.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")},qt.exports.Resizable=Ct.default,qt.exports.ResizableBox=Xt.default;var js=qt.exports,He={};Object.defineProperty(He,"__esModule",{value:!0}),He.resizeHandleType=He.resizeHandleAxesType=He.default=void 0;var $=ya($e),Ls=ya(w);function ya(e){return e&&e.__esModule?e:{default:e}}const Vs=He.resizeHandleAxesType=$.default.arrayOf($.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),Us=He.resizeHandleType=$.default.oneOfType([$.default.node,$.default.func]);He.default={className:$.default.string,style:$.default.object,width:$.default.number,autoSize:$.default.bool,cols:$.default.number,draggableCancel:$.default.string,draggableHandle:$.default.string,verticalCompact:function(e){e.verticalCompact},compactType:$.default.oneOf(["vertical","horizontal"]),layout:function(e){var t=e.layout;t!==void 0&&B.validateLayout(t,"layout")},margin:$.default.arrayOf($.default.number),containerPadding:$.default.arrayOf($.default.number),rowHeight:$.default.number,maxRows:$.default.number,isBounded:$.default.bool,isDraggable:$.default.bool,isResizable:$.default.bool,allowOverlap:$.default.bool,preventCollision:$.default.bool,useCSSTransforms:$.default.bool,transformScale:$.default.number,isDroppable:$.default.bool,resizeHandles:Vs,resizeHandle:Us,onLayoutChange:$.default.func,onDragStart:$.default.func,onDrag:$.default.func,onDragStop:$.default.func,onResizeStart:$.default.func,onResize:$.default.func,onResizeStop:$.default.func,onDrop:$.default.func,droppingItem:$.default.shape({i:$.default.string.isRequired,w:$.default.number.isRequired,h:$.default.number.isRequired}),children:function(e,t){const n=e[t],r={};Ls.default.Children.forEach(n,function(a){if((a==null?void 0:a.key)!=null){if(r[a.key])throw new Error('Duplicate child key "'+a.key+'" found! This will cause problems in ReactGridLayout.');r[a.key]=!0}})},innerRef:$.default.any},Object.defineProperty(kt,"__esModule",{value:!0}),kt.default=void 0;var ct=Qn(w),Y=Qn($e),zs=ua,As=js,dt=B,fe=De,Sa=He,Hs=Qn(We);function Qn(e){return e&&e.__esModule?e:{default:e}}function je(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=Ws(e,"string");return typeof t=="symbol"?t:String(t)}function Ws(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 er extends ct.default.Component{constructor(){super(...arguments),je(this,"state",{resizing:null,dragging:null,className:""}),je(this,"elementRef",ct.default.createRef()),je(this,"onDragStart",(t,n)=>{let{node:r}=n;const{onDragStart:a,transformScale:o}=this.props;if(!a)return;const i={top:0,left:0},{offsetParent:u}=r;if(!u)return;const l=u.getBoundingClientRect(),c=r.getBoundingClientRect(),d=c.left/o,h=l.left/o,f=c.top/o,v=l.top/o;i.left=d-h+u.scrollLeft,i.top=f-v+u.scrollTop,this.setState({dragging:i});const{x:y,y:T}=(0,fe.calcXY)(this.getPositionParams(),i.top,i.left,this.props.w,this.props.h);return a.call(this,this.props.i,y,T,{e:t,node:r,newPosition:i})}),je(this,"onDrag",(t,n)=>{let{node:r,deltaX:a,deltaY:o}=n;const{onDrag:i}=this.props;if(!i)return;if(!this.state.dragging)throw new Error("onDrag called before onDragStart.");let u=this.state.dragging.top+o,l=this.state.dragging.left+a;const{isBounded:c,i:d,w:h,h:f,containerWidth:v}=this.props,y=this.getPositionParams();if(c){const{offsetParent:S}=r;if(S){const{margin:C,rowHeight:g,containerPadding:O}=this.props,M=S.clientHeight-(0,fe.calcGridItemWHPx)(f,g,C[1]);u=(0,fe.clamp)(u-O[1],0,M);const I=(0,fe.calcGridColWidth)(y),j=v-(0,fe.calcGridItemWHPx)(h,I,C[0]);l=(0,fe.clamp)(l-O[0],0,j)}}const T={top:u,left:l};this.setState({dragging:T});const{containerPadding:x}=this.props,{x:_,y:b}=(0,fe.calcXY)(y,u-x[1],l-x[0],h,f);return i.call(this,d,_,b,{e:t,node:r,newPosition:T})}),je(this,"onDragStop",(t,n)=>{let{node:r}=n;const{onDragStop:a}=this.props;if(!a)return;if(!this.state.dragging)throw new Error("onDragEnd called before onDragStart.");const{w:o,h:i,i:u,containerPadding:l}=this.props,{left:c,top:d}=this.state.dragging,h={top:d,left:c};this.setState({dragging:null});const{x:f,y:v}=(0,fe.calcXY)(this.getPositionParams(),d-l[1],c-l[0],o,i);return a.call(this,u,f,v,{e:t,node:r,newPosition:h})}),je(this,"onResizeStop",(t,n,r)=>this.onResizeHandler(t,n,r,"onResizeStop")),je(this,"onResizeStart",(t,n,r)=>this.onResizeHandler(t,n,r,"onResizeStart")),je(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,fe.calcGridItemPosition)(this.getPositionParams(this.props),this.props.x,this.props.y,this.props.w,this.props.h,this.state),a=(0,fe.calcGridItemPosition)(this.getPositionParams(t),t.x,t.y,t.w,t.h,n);return!(0,dt.fastPositionEqual)(r,a)||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 a=t.droppingPosition||{left:0,top:0},{dragging:o}=this.state,i=o&&n.left!==a.left||n.top!==a.top;if(!o)this.onDragStart(n.e,{node:r,deltaX:n.left,deltaY:n.top});else if(i){const u=n.left-o.left,l=n.top-o.top;this.onDrag(n.e,{node:r,deltaX:u,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:a}=this.props;let o;return a?o=(0,dt.setTransform)(t):(o=(0,dt.setTopLeft)(t),n&&(o.left=(0,dt.perc)(t.left/r),o.width=(0,dt.perc)(t.width/r))),o}mixinDraggable(t,n){return ct.default.createElement(zs.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,a)=>n(r,a,t)}mixinResizable(t,n,r){const{cols:a,minW:o,minH:i,maxW:u,maxH:l,transformScale:c,resizeHandles:d,resizeHandle:h}=this.props,f=this.getPositionParams(),v=(0,fe.calcGridItemPosition)(f,0,0,a,0).width,y=(0,fe.calcGridItemPosition)(f,0,0,o,i),T=(0,fe.calcGridItemPosition)(f,0,0,u,l),x=[y.width,y.height],_=[Math.min(T.width,v),Math.min(T.height,1/0)];return ct.default.createElement(As.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:c,resizeHandles:d,handle:h},t)}onResizeHandler(t,n,r,a){let{node:o,size:i,handle:u}=n;const l=this.props[a];if(!l)return;const{x:c,y:d,i:h,maxH:f,minH:v,containerWidth:y}=this.props,{minW:T,maxW:x}=this.props;let _=i;o&&(_=(0,dt.resizeItemInDirection)(u,r,i,y),this.setState({resizing:a==="onResizeStop"?null:_}));let{w:b,h:S}=(0,fe.calcWH)(this.getPositionParams(),_.width,_.height,c,d,u);b=(0,fe.clamp)(b,Math.max(T,1),x),S=(0,fe.clamp)(S,v,f),l.call(this,h,b,S,{e:t,node:o,size:_,handle:u})}render(){const{x:t,y:n,w:r,h:a,isDraggable:o,isResizable:i,droppingPosition:u,useCSSTransforms:l}=this.props,c=(0,fe.calcGridItemPosition)(this.getPositionParams(),t,n,r,a,this.state),d=ct.default.Children.only(this.props.children);let h=ct.default.cloneElement(d,{ref:this.elementRef,className:(0,Hs.default)("react-grid-item",d.props.className,this.props.className,{static:this.props.static,resizing:!!this.state.resizing,"react-draggable":o,"react-draggable-dragging":!!this.state.dragging,dropping:!!u,cssTransforms:l}),style:{...this.props.style,...d.props.style,...this.createStyle(c)}});return h=this.mixinResizable(h,c,i),h=this.mixinDraggable(h,o),h}}kt.default=er,je(er,"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:Sa.resizeHandleAxesType,resizeHandle:Sa.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})}),je(er,"defaultProps",{className:"",cancel:"",handle:"",minH:1,minW:1,maxH:1/0,maxW:1/0,transformScale:1}),Object.defineProperty(St,"__esModule",{value:!0}),St.default=void 0;var Ze=Gs(w),tr=In,$s=nr(We),A=B,Bs=De,ba=nr(kt),Fs=nr(He);function nr(e){return e&&e.__esModule?e:{default:e}}function Ta(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(Ta=function(r){return r?n:t})(e)}function Gs(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=Ta(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(o!=="default"&&Object.prototype.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}function he(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=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 Ra="react-grid-layout";let Ca=!1;try{Ca=/firefox/i.test(navigator.userAgent)}catch{}class Kt extends Ze.Component{constructor(){super(...arguments),he(this,"state",{activeDrag:null,layout:(0,A.synchronizeLayoutWithChildren)(this.props.layout,this.props.children,this.props.cols,(0,A.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,a)=>{let{e:o,node:i}=a;const{layout:u}=this.state,l=(0,A.getLayoutItem)(u,t);if(!l)return;const c={w:l.w,h:l.h,x:l.x,y:l.y,placeholder:!0,i:t};return this.setState({oldDragItem:(0,A.cloneLayoutItem)(l),oldLayout:u,activeDrag:c}),this.props.onDragStart(u,l,l,null,o,i)}),he(this,"onDrag",(t,n,r,a)=>{let{e:o,node:i}=a;const{oldDragItem:u}=this.state;let{layout:l}=this.state;const{cols:c,allowOverlap:d,preventCollision:h}=this.props,f=(0,A.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,A.moveElement)(l,f,n,r,!0,h,(0,A.compactType)(this.props),c,d),this.props.onDrag(l,u,f,v,o,i),this.setState({layout:d?l:(0,A.compact)(l,(0,A.compactType)(this.props),c),activeDrag:v})}),he(this,"onDragStop",(t,n,r,a)=>{let{e:o,node:i}=a;if(!this.state.activeDrag)return;const{oldDragItem:u}=this.state;let{layout:l}=this.state;const{cols:c,preventCollision:d,allowOverlap:h}=this.props,f=(0,A.getLayoutItem)(l,t);if(!f)return;l=(0,A.moveElement)(l,f,n,r,!0,d,(0,A.compactType)(this.props),c,h);const y=h?l:(0,A.compact)(l,(0,A.compactType)(this.props),c);this.props.onDragStop(y,u,f,null,o,i);const{oldLayout:T}=this.state;this.setState({activeDrag:null,layout:y,oldDragItem:null,oldLayout:null}),this.onLayoutMaybeChanged(y,T)}),he(this,"onResizeStart",(t,n,r,a)=>{let{e:o,node:i}=a;const{layout:u}=this.state,l=(0,A.getLayoutItem)(u,t);l&&(this.setState({oldResizeItem:(0,A.cloneLayoutItem)(l),oldLayout:this.state.layout,resizing:!0}),this.props.onResizeStart(u,l,l,null,o,i))}),he(this,"onResize",(t,n,r,a)=>{let{e:o,node:i,size:u,handle:l}=a;const{oldResizeItem:c}=this.state,{layout:d}=this.state,{cols:h,preventCollision:f,allowOverlap:v}=this.props;let y=!1,T,x,_;const[b,S]=(0,A.withLayoutItem)(d,t,g=>{let O;return x=g.x,_=g.y,["sw","w","nw","n","ne"].indexOf(l)!==-1&&(["sw","nw","w"].indexOf(l)!==-1&&(x=g.x+(g.w-n),n=g.x!==x&&x<0?g.w:n,x=x<0?0:x),["ne","n","nw"].indexOf(l)!==-1&&(_=g.y+(g.h-r),r=g.y!==_&&_<0?g.h:r,_=_<0?0:_),y=!0),f&&!v&&(O=(0,A.getAllCollisions)(d,{...g,w:n,h:r,x,y:_}).filter(I=>I.i!==g.i).length>0,O&&(_=g.y,r=g.h,x=g.x,n=g.w,y=!1)),g.w=n,g.h=r,g});if(!S)return;T=b,y&&(T=(0,A.moveElement)(b,S,x,_,!0,this.props.preventCollision,(0,A.compactType)(this.props),h,v));const C={w:S.w,h:S.h,x:S.x,y:S.y,static:!0,i:t};this.props.onResize(T,c,S,C,o,i),this.setState({layout:v?T:(0,A.compact)(T,(0,A.compactType)(this.props),h),activeDrag:C})}),he(this,"onResizeStop",(t,n,r,a)=>{let{e:o,node:i}=a;const{layout:u,oldResizeItem:l}=this.state,{cols:c,allowOverlap:d}=this.props,h=(0,A.getLayoutItem)(u,t),f=d?u:(0,A.compact)(u,(0,A.compactType)(this.props),c);this.props.onResizeStop(f,l,h,null,o,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 b;if(t.preventDefault(),t.stopPropagation(),Ca&&!((b=t.nativeEvent.target)!=null&&b.classList.contains(Ra)))return!1;const{droppingItem:n,onDropDragOver:r,margin:a,cols:o,rowHeight:i,maxRows:u,width:l,containerPadding:c,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(),T=t.clientX-y.left,x=t.clientY-y.top,_={left:T/d,top:x/d,e:t};if(this.state.droppingDOMNode){if(this.state.droppingPosition){const{left:S,top:C}=this.state.droppingPosition;(S!=T||C!=x)&&this.setState({droppingPosition:_})}}else{const S={cols:o,margin:a,maxRows:u,rowHeight:i,containerWidth:l,containerPadding:c||a},C=(0,Bs.calcXY)(S,x,T,f.w,f.h);this.setState({droppingDOMNode:Ze.createElement("div",{key:f.i}),droppingPosition:_,layout:[...v,{...f,x:C.x,y:C.y,static:!1,isDraggable:!0}]})}}),he(this,"removeDroppingPlaceholder",()=>{const{droppingItem:t,cols:n}=this.props,{layout:r}=this.state,a=(0,A.compact)(r.filter(o=>o.i!==t.i),(0,A.compactType)(this.props),n,this.props.allowOverlap);this.setState({layout:a,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,a=r.find(o=>o.i===n.i);this.dragEnterCounter=0,this.removeDroppingPlaceholder(),this.props.onDrop(r,a,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,tr.deepEqual)(t.layout,n.propsLayout)||t.compactType!==n.compactType?r=t.layout:(0,A.childrenEqual)(t.children,n.children)||(r=n.layout),r?{layout:(0,A.synchronizeLayoutWithChildren)(r,t.children,t.cols,(0,A.compactType)(t),t.allowOverlap),compactType:t.compactType,children:t.children,propsLayout:t.layout}:null)}shouldComponentUpdate(t,n){return this.props.children!==t.children||!(0,A.fastRGLPropsEqual)(this.props,t,tr.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,a=n.layout;this.onLayoutMaybeChanged(r,a)}}containerHeight(){if(!this.props.autoSize)return;const t=(0,A.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,tr.deepEqual)(n,t)||this.props.onLayoutChange(t)}placeholder(){const{activeDrag:t}=this.state;if(!t)return null;const{width:n,cols:r,margin:a,containerPadding:o,rowHeight:i,maxRows:u,useCSSTransforms:l,transformScale:c}=this.props;return Ze.createElement(ba.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:a,containerPadding:o||a,maxRows:u,rowHeight:i,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:l,transformScale:c},Ze.createElement("div",null))}processGridItem(t,n){if(!t||!t.key)return;const r=(0,A.getLayoutItem)(this.state.layout,String(t.key));if(!r)return null;const{width:a,cols:o,margin:i,containerPadding:u,rowHeight:l,maxRows:c,isDraggable:d,isResizable:h,isBounded:f,useCSSTransforms:v,transformScale:y,draggableCancel:T,draggableHandle:x,resizeHandles:_,resizeHandle:b}=this.props,{mounted:S,droppingPosition:C}=this.state,g=typeof r.isDraggable=="boolean"?r.isDraggable:!r.static&&d,O=typeof r.isResizable=="boolean"?r.isResizable:!r.static&&h,M=r.resizeHandles||_,I=g&&f&&r.isBounded!==!1;return Ze.createElement(ba.default,{containerWidth:a,cols:o,margin:i,containerPadding:u||i,maxRows:c,rowHeight:l,cancel:T,handle:x,onDragStop:this.onDragStop,onDragStart:this.onDragStart,onDrag:this.onDrag,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,isDraggable:g,isResizable:O,isBounded:I,useCSSTransforms:v&&S,usePercentages:!S,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?C:void 0,resizeHandles:M,resizeHandle:b},t)}render(){const{className:t,style:n,isDroppable:r,innerRef:a}=this.props,o=(0,$s.default)(Ra,t),i={height:this.containerHeight(),...n};return Ze.createElement("div",{ref:a,className:o,style:i,onDrop:r?this.onDrop:A.noop,onDragLeave:r?this.onDragLeave:A.noop,onDragEnter:r?this.onDragEnter:A.noop,onDragOver:r?this.onDragOver:A.noop},Ze.Children.map(this.props.children,u=>this.processGridItem(u)),r&&this.state.droppingDOMNode&&this.processGridItem(this.state.droppingDOMNode,!0),this.placeholder())}}St.default=Kt,he(Kt,"displayName","ReactGridLayout"),he(Kt,"propTypes",Fs.default),he(Kt,"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:A.noop,onDragStart:A.noop,onDrag:A.noop,onDragStop:A.noop,onResizeStart:A.noop,onResize:A.noop,onResizeStop:A.noop,onDrop:A.noop,onDropDragOver:A.noop});var Zt={},Je={};Object.defineProperty(Je,"__esModule",{value:!0}),Je.findOrGenerateResponsiveLayout=Zs,Je.getBreakpointFromWidth=Ys,Je.getColsFromBreakpoint=Ks,Je.sortBreakpoints=rr;var Jt=B;function Ys(e,t){const n=rr(e);let r=n[0];for(let a=1,o=n.length;a<o;a++){const i=n[a];t>e[i]&&(r=i)}return r}function Ks(e,t){if(!t[e])throw new Error("ResponsiveReactGridLayout: `cols` entry for breakpoint "+e+" is missing!");return t[e]}function Zs(e,t,n,r,a,o){if(e[n])return(0,Jt.cloneLayout)(e[n]);let i=e[r];const u=rr(t),l=u.slice(u.indexOf(n));for(let c=0,d=l.length;c<d;c++){const h=l[c];if(e[h]){i=e[h];break}}return i=(0,Jt.cloneLayout)(i||[]),(0,Jt.compact)((0,Jt.correctBounds)(i,{cols:a}),o,a)}function rr(e){return Object.keys(e).sort(function(n,r){return e[n]-e[r]})}Object.defineProperty(Zt,"__esModule",{value:!0}),Zt.default=void 0;var _a=Qs(w),Se=wa($e),ar=In,ft=B,Qe=Je,Js=wa(St);function wa(e){return e&&e.__esModule?e:{default:e}}function Ia(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(Ia=function(r){return r?n:t})(e)}function Qs(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=Ia(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(o!=="default"&&Object.prototype.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}function or(){return or=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},or.apply(this,arguments)}function Qt(e,t,n){return t=el(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function el(e){var t=tl(e,"string");return typeof t=="symbol"?t:String(t)}function tl(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 xa=e=>Object.prototype.toString.call(e);function en(e,t){return e==null?null:Array.isArray(e)?e:e[t]}class ir extends _a.Component{constructor(){super(...arguments),Qt(this,"state",this.generateInitialState()),Qt(this,"onLayoutChange",t=>{this.props.onLayoutChange(t,{...this.props.layouts,[this.state.breakpoint]:t})})}generateInitialState(){const{width:t,breakpoints:n,layouts:r,cols:a}=this.props,o=(0,Qe.getBreakpointFromWidth)(n,t),i=(0,Qe.getColsFromBreakpoint)(o,a),u=this.props.verticalCompact===!1?null:this.props.compactType;return{layout:(0,Qe.findOrGenerateResponsiveLayout)(r,n,o,o,i,u),breakpoint:o,cols:i}}static getDerivedStateFromProps(t,n){if(!(0,ar.deepEqual)(t.layouts,n.layouts)){const{breakpoint:r,cols:a}=n;return{layout:(0,Qe.findOrGenerateResponsiveLayout)(t.layouts,t.breakpoints,r,r,a,t.compactType),layouts:t.layouts}}return null}componentDidUpdate(t){(this.props.width!=t.width||this.props.breakpoint!==t.breakpoint||!(0,ar.deepEqual)(this.props.breakpoints,t.breakpoints)||!(0,ar.deepEqual)(this.props.cols,t.cols))&&this.onWidthChange(t)}onWidthChange(t){const{breakpoints:n,cols:r,layouts:a,compactType:o}=this.props,i=this.props.breakpoint||(0,Qe.getBreakpointFromWidth)(this.props.breakpoints,this.props.width),u=this.state.breakpoint,l=(0,Qe.getColsFromBreakpoint)(i,r),c={...a};if(u!==i||t.breakpoints!==n||t.cols!==r){u in c||(c[u]=(0,ft.cloneLayout)(this.state.layout));let f=(0,Qe.findOrGenerateResponsiveLayout)(c,n,i,u,l,o);f=(0,ft.synchronizeLayoutWithChildren)(f,this.props.children,l,o,this.props.allowOverlap),c[i]=f,this.props.onLayoutChange(f,c),this.props.onBreakpointChange(i,l),this.setState({breakpoint:i,layout:f,cols:l})}const d=en(this.props.margin,i),h=en(this.props.containerPadding,i);this.props.onWidthChange(this.props.width,d,l,h)}render(){const{breakpoint:t,breakpoints:n,cols:r,layouts:a,margin:o,containerPadding:i,onBreakpointChange:u,onLayoutChange:l,onWidthChange:c,...d}=this.props;return _a.createElement(Js.default,or({},d,{margin:en(o,this.state.breakpoint),containerPadding:en(i,this.state.breakpoint),onLayoutChange:this.onLayoutChange,layout:this.state.layout,cols:this.state.cols}))}}Zt.default=ir,Qt(ir,"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(xa(e[t])!=="[object Object]")throw new Error("Layout property must be an object. Received: "+xa(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,ft.validateLayout)(e.layouts[n],"layouts."+n)})},width:Se.default.number.isRequired,onBreakpointChange:Se.default.func,onLayoutChange:Se.default.func,onWidthChange:Se.default.func}),Qt(ir,"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:ft.noop,onLayoutChange:ft.noop,onWidthChange:ft.noop});var sr={},Oa=function(){if(typeof Map<"u")return Map;function e(t,n){var r=-1;return t.some(function(a,o){return a[0]===n?(r=o,!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),a=this.__entries__[r];return a&&a[1]},t.prototype.set=function(n,r){var a=e(this.__entries__,n);~a?this.__entries__[a][1]=r:this.__entries__.push([n,r])},t.prototype.delete=function(n){var r=this.__entries__,a=e(r,n);~a&&r.splice(a,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 a=0,o=this.__entries__;a<o.length;a++){var i=o[a];n.call(r,i[1],i[0])}},t}()}(),lr=typeof window<"u"&&typeof document<"u"&&window.document===document,tn=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")()}(),nl=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(tn):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)}}(),rl=2;function al(e,t){var n=!1,r=!1,a=0;function o(){n&&(n=!1,e()),r&&u()}function i(){nl(o)}function u(){var l=Date.now();if(n){if(l-a<rl)return;r=!0}else n=!0,r=!1,setTimeout(i,t);a=l}return u}var ol=20,il=["top","right","bottom","left","width","height","size","weight"],sl=typeof MutationObserver<"u",ll=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=al(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(){!lr||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),sl?(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(){!lr||!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,a=il.some(function(o){return!!~r.indexOf(o)});a&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),Ea=function(e,t){for(var n=0,r=Object.keys(t);n<r.length;n++){var a=r[n];Object.defineProperty(e,a,{value:t[a],enumerable:!1,writable:!1,configurable:!0})}return e},pt=function(e){var t=e&&e.ownerDocument&&e.ownerDocument.defaultView;return t||tn},Ma=rn(0,0,0,0);function nn(e){return parseFloat(e)||0}function Da(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return t.reduce(function(r,a){var o=e["border-"+a+"-width"];return r+nn(o)},0)}function ul(e){for(var t=["top","right","bottom","left"],n={},r=0,a=t;r<a.length;r++){var o=a[r],i=e["padding-"+o];n[o]=nn(i)}return n}function cl(e){var t=e.getBBox();return rn(0,0,t.width,t.height)}function dl(e){var t=e.clientWidth,n=e.clientHeight;if(!t&&!n)return Ma;var r=pt(e).getComputedStyle(e),a=ul(r),o=a.left+a.right,i=a.top+a.bottom,u=nn(r.width),l=nn(r.height);if(r.boxSizing==="border-box"&&(Math.round(u+o)!==t&&(u-=Da(r,"left","right")+o),Math.round(l+i)!==n&&(l-=Da(r,"top","bottom")+i)),!pl(e)){var c=Math.round(u+o)-t,d=Math.round(l+i)-n;Math.abs(c)!==1&&(u-=c),Math.abs(d)!==1&&(l-=d)}return rn(a.left,a.top,u,l)}var fl=function(){return typeof SVGGraphicsElement<"u"?function(e){return e instanceof pt(e).SVGGraphicsElement}:function(e){return e instanceof pt(e).SVGElement&&typeof e.getBBox=="function"}}();function pl(e){return e===pt(e).document.documentElement}function hl(e){return lr?fl(e)?cl(e):dl(e):Ma}function ml(e){var t=e.x,n=e.y,r=e.width,a=e.height,o=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,i=Object.create(o.prototype);return Ea(i,{x:t,y:n,width:r,height:a,top:n,right:t+r,bottom:a+n,left:t}),i}function rn(e,t,n,r){return{x:e,y:t,width:n,height:r}}var gl=function(){function e(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=rn(0,0,0,0),this.target=t}return e.prototype.isActive=function(){var t=hl(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}(),vl=function(){function e(t,n){var r=ml(n);Ea(this,{target:t,contentRect:r})}return e}(),yl=function(){function e(t,n,r){if(this.activeObservations_=[],this.observations_=new Oa,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 pt(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(t)||(n.set(t,new gl(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 pt(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 vl(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}(),Pa=typeof WeakMap<"u"?new WeakMap:new Oa,Na=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=ll.getInstance(),r=new yl(t,n,this);Pa.set(this,r)}return e}();["observe","unobserve","disconnect"].forEach(function(e){Na.prototype[e]=function(){var t;return(t=Pa.get(this))[e].apply(t,arguments)}});var Sl=function(){return typeof tn.ResizeObserver<"u"?tn.ResizeObserver:Na}();const bl=Yo(Object.freeze(Object.defineProperty({__proto__:null,default:Sl},Symbol.toStringTag,{value:"Module"})));Object.defineProperty(sr,"__esModule",{value:!0}),sr.default=Ol;var an=_l(w),Tl=ur($e),Rl=ur(bl),Cl=ur(We);function ur(e){return e&&e.__esModule?e:{default:e}}function ja(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(ja=function(r){return r?n:t})(e)}function _l(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=ja(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(o!=="default"&&Object.prototype.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}function cr(){return cr=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},cr.apply(this,arguments)}function ht(e,t,n){return t=wl(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function wl(e){var t=Il(e,"string");return typeof t=="symbol"?t:String(t)}function Il(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 Ol(e){var t;return t=class extends an.Component{constructor(){super(...arguments),ht(this,"state",{width:1280}),ht(this,"elementRef",an.createRef()),ht(this,"mounted",!1),ht(this,"resizeObserver",void 0)}componentDidMount(){this.mounted=!0,this.resizeObserver=new Rl.default(a=>{if(this.elementRef.current instanceof HTMLElement){const i=a[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,...a}=this.props;return r&&!this.mounted?an.createElement("div",{className:(0,Cl.default)(this.props.className,xl),style:this.props.style,ref:this.elementRef}):an.createElement(e,cr({innerRef:this.elementRef},a,this.state))}},ht(t,"defaultProps",{measureBeforeMount:!1}),ht(t,"propTypes",{measureBeforeMount:Tl.default.bool}),t}(function(e){e.exports=St.default,e.exports.utils=B,e.exports.calculateUtils=De,e.exports.Responsive=Zt.default,e.exports.Responsive.utils=Je,e.exports.WidthProvider=sr.default})(Ur);var El=Ur.exports;const Ml=_n(El),dr={type:m.CommandType.COMMAND,id:"sheet.command.delete-conditional-rule",handler(e,t){if(!t)return!1;const n=e.get(m.IUndoRedoService),r=e.get(m.ICommandService),a=e.get(m.IUniverInstanceService),o=k.getSheetCommandTarget(a,t);if(!o)return!1;const{unitId:i,subUnitId:u}=o,l={unitId:i,subUnitId:u,cfId:t.cfId},c=s.DeleteConditionalRuleMutationUndoFactory(e,l),d=r.syncExecuteCommand(s.DeleteConditionalRuleMutation.id,l);return d&&n.pushUndoRedo({unitID:i,undoMutations:c,redoMutations:[{id:s.DeleteConditionalRuleMutation.id,params:l}]}),d}},La={type:m.CommandType.COMMAND,id:"sheet.command.move-conditional-rule",handler(e,t){if(!t)return!1;const n=e.get(m.IUndoRedoService),r=e.get(m.ICommandService),a=e.get(m.IUniverInstanceService),o=e.get(s.ConditionalFormattingRuleModel),i=k.getSheetCommandTarget(a,t);if(!i)return!1;const{unitId:u,subUnitId:l}=i,c=s.transformSupportSymmetryAnchor(t.start,t.end,o.getSubunitRules(u,l)||[],T=>T.cfId);if(!c)return!1;const[d,h]=c,f={unitId:u,subUnitId:l,start:d,end:h},v=s.MoveConditionalRuleMutationUndoFactory(f),y=r.syncExecuteCommand(s.MoveConditionalRuleMutation.id,f);return y&&n.pushUndoRedo({unitID:u,redoMutations:[{id:s.MoveConditionalRuleMutation.id,params:f}],undoMutations:v}),y}},on={cfPreview:"univer-cf-preview"},mt=e=>{var a,o;const t=e.rule;if(!t)return null;const n=w.useMemo(()=>{if(t.type===s.CFRuleType.colorScale){const i=t.config.map((c,d)=>({color:new m.ColorKit(c.color),value:d})),u=i.length-1;return new Array(5).fill("").map((c,d,h)=>d*u/(h.length-1)).map(c=>s.getColorScaleFromValue(i,c))}return null},[t]),r=w.useMemo(()=>{if(t.type===s.CFRuleType.iconSet)return t.config.map(i=>{const u=s.iconMap[i.iconType];return u&&u[Number(i.iconId)]})},[t]);switch(t.type){case s.CFRuleType.dataBar:{const{isGradient:i}=t.config,u={width:"50%",height:"100%"},l=i?`linear-gradient(to right, ${t.config.positiveColor}, rgb(255 255 255))`:t.config.positiveColor,c=i?`linear-gradient(to right, rgb(255 255 255),${t.config.nativeColor})`:t.config.nativeColor;return p.jsxs("div",{className:on.cfPreview,children:[p.jsx("div",{style:{...u,background:c,border:`1px solid ${t.config.nativeColor}`}}),p.jsx("div",{style:{...u,background:l,border:`1px solid ${t.config.positiveColor}`}})]})}case s.CFRuleType.colorScale:return n&&p.jsx("div",{className:on.cfPreview,children:n.map((i,u)=>p.jsx("div",{style:{width:`${100/n.length}%`,height:"100%",background:i}},u))});case s.CFRuleType.iconSet:return r&&p.jsx("div",{className:on.cfPreview,children:r.map((i,u)=>i?p.jsx("img",{style:{height:"100%"},src:i},u):p.jsx(Ut,{},u))});case s.CFRuleType.highlightCell:{const{ul:i,st:u,it:l,bl:c,bg:d,cl:h}=t.style,f=(i==null?void 0:i.s)===m.BooleanNumber.TRUE,v=(u==null?void 0:u.s)===m.BooleanNumber.TRUE,y=l===m.BooleanNumber.TRUE,T=c===m.BooleanNumber.TRUE,x=(a=d==null?void 0:d.rgb)!=null?a:s.DEFAULT_BG_COLOR,_=(o=h==null?void 0:h.rgb)!=null?o:s.DEFAULT_FONT_COLOR,b={fontWeight:T?"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:b,className:on.cfPreview,children:"123"})}}return null},Dl={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"}}}},Va={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:"无"}}}};var Pl=Object.defineProperty,Nl=Object.getOwnPropertyDescriptor,jl=(e,t,n,r)=>{for(var a=r>1?void 0:r?Nl(t,n):t,o=e.length-1,i;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&Pl(t,n,a),a},Ll=(e,t)=>(n,r)=>t(n,r,e);let It=class extends m.Disposable{constructor(t){super();lt(this,"_initLocal",()=>{this._localeService.load({zhCN:Va})});lt(this,"_findReplaceIndex",t=>{const n=/\{([^}]+)?\}/g,r=[];let a=n.exec(t);for(;a;)r.push({startIndex:a.index,key:Number(a[1]),endIndex:a.index+a[0].length-1}),a=n.exec(t);return r});this._localeService=t,this._initLocal()}tWithReactNode(t,...n){const r=this._localeService.getLocales(),a=t.split("."),o=r&&this._localeService.resolveKeyPath(r,a);if(typeof o=="string"){const i=[];return this._findReplaceIndex(o).forEach((u,l,c)=>{const d=c[l-1]||{startIndex:0,endIndex:-1};if(d.endIndex+1<u.startIndex){const h=o.slice(d.endIndex+1,u.startIndex);h&&i.push(h)}if(n[u.key]&&i.push(n[u.key]),l===c.length-1){const h=o.slice(u.endIndex+1);h&&i.push(h)}}),i}return[]}};It=jl([m.OnLifecycle(m.LifecycleStages.Rendered,It),Ll(0,V.Inject(m.LocaleService))],It);const Vl=(e=[])=>{const t=te.useDependency(le.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])},ue={cfRuleList:"univer-cf-rule-list",ruleSelector:"univer-rule-selector",select:"univer-select",selectSelector:"univer-select-selector",selectSelectionItem:"univer-select-selection-item",selectSelectionSearchInput:"univer-select-selection-search-input",btnList:"univer-btn-list",gap:"univer-gap",icon:"univer-icon",disabled:"univer-disabled",ruleItem:"univer-rule-item",ruleDescribe:"univer-rule-describe",ruleType:"univer-rule-type",ruleRange:"univer-rule-range",active:"univer-active",draggableHandle:"univer-draggableHandle",deleteItem:"univer-delete-item",gridLayoutWrap:"univer-grid-layout-wrap",reactGridItem:"univer-react-grid-item"},Ul=(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(a=>String(a)):[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 Ua=0;const zl=e=>{const{onClick:t}=e,n=te.useDependency(s.ConditionalFormattingRuleModel),r=te.useDependency(m.IUniverInstanceService),a=te.useDependency(k.SelectionManagerService),o=te.useDependency(m.ICommandService),i=te.useDependency(m.LocaleService),u=te.useDependency(It),l=r.getCurrentUnitForType(m.UniverInstanceType.UNIVER_SHEET),c=l.getUnitId(),h=l.getActiveSheet().getSheetId(),[f,v]=w.useState([]),[y,T]=w.useState("2"),[x,_]=w.useState(0),[b,S]=w.useState(-1),[C,g]=w.useState(Ua),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 z=n.getSubunitRules(c,h);if(!z||!z.length)return[];if(y==="1"){const q=a.getLast();if(!q)return[];const ne=q.range;return z.filter(me=>me.ranges.some(Te=>m.Rectangle.intersects(Te,ne)))}else if(y==="2")return z;return[]},[j,L]=w.useState(I);Vl(f),w.useEffect(()=>{const z=o.onCommandExecuted(q=>{q.id===k.SetWorksheetActiveOperation.id&&_(Math.random())});return()=>z.dispose()}),w.useEffect(()=>{L(I)},[y,x,c,h]),w.useEffect(()=>{if(y==="2")return;const z=new Ce.Observable(q=>{const ne=[k.SetSelectionsOperation.id,s.AddConditionalRuleMutation.id,s.SetConditionalRuleMutation.id,s.DeleteConditionalRuleMutation.id,s.MoveConditionalRuleMutation.id],ce=o.onCommandExecuted(me=>{const{id:Te,params:Re}=me,Le=r.getCurrentUnitForType(m.UniverInstanceType.UNIVER_SHEET).getUnitId();ne.includes(Te)&&Re.unitId===Le&&q.next(null)});return()=>ce.dispose()}).pipe(Ce.debounceTime(16)).subscribe(()=>{L(I)});return()=>{z.unsubscribe()}},[r,y,c,h]),w.useEffect(()=>{const z=n.$ruleChange.subscribe(()=>{_(Math.random())});return()=>z.unsubscribe()},[n]),w.useEffect(()=>{const z=()=>{var me;const ce=Math.max(0,(((me=O.current)==null?void 0:me.getBoundingClientRect().width)||0)-8);return Ua=ce,ce},ne=new Ce.Observable(ce=>{const me=document.querySelector(".univer-sidebar");if(me){let Te=setTimeout(()=>{ce.next()},150);const Re=()=>{Te&&clearTimeout(Te),Te=null},Le=st=>{st.propertyName==="width"&&(Re(),ce.next())};return me.addEventListener("transitionend",Le),()=>{Re(),me.removeEventListener("transitionend",Le)}}}).pipe(Ce.debounceTime(16)).subscribe(()=>{g(z())});return()=>{ne.unsubscribe()}},[]);const U=z=>{const q=r.getCurrentUnitForType(m.UniverInstanceType.UNIVER_SHEET).getUnitId(),ne=r.getCurrentUnitForType(m.UniverInstanceType.UNIVER_SHEET).getActiveSheet().getSheetId();o.executeCommand(dr.id,{unitId:q,subUnitId:ne,cfId:z.cfId})},F=(z,q)=>{S(q.y)},R=(z,q,ne)=>{S(-1);const ce=r.getCurrentUnitForType(m.UniverInstanceType.UNIVER_SHEET).getUnitId(),me=r.getCurrentUnitForType(m.UniverInstanceType.UNIVER_SHEET).getActiveSheet().getSheetId(),Te=st=>{const Vt=j.length;return Math.min(Vt-1,Math.max(0,st))},Re=j[Te(q.y)].cfId,Le=j[Te(ne.y)].cfId;Re!==Le&&o.executeCommand(La.id,{unitId:ce,subUnitId:me,start:{id:Re,type:"self"},end:{id:Le,type:ne.y>q.y?"after":"before"}})},E=()=>{e.onCreate()},J=()=>{y==="2"?o.executeCommand(Tn.id):y==="1"&&j.map(q=>({unitId:c,subUnitId:h,cfId:q.cfId})).forEach(q=>{o.executeCommand(dr.id,q)})},be=j.map((z,q)=>({i:z.cfId,x:0,w:12,y:q,h:1,isResizable:!1}));return p.jsxs("div",{className:ue.cfRuleList,children:[p.jsxs("div",{className:ue.ruleSelector,children:[p.jsx("div",{children:u.tWithReactNode("sheet.cf.panel.managerRuleSelect",p.jsx(G.Select,{className:ue.select,options:M,value:y,onChange:z=>{T(z)}})).map((z,q)=>p.jsx("span",{children:z},q))}),p.jsxs("div",{className:ue.btnList,children:[p.jsx(G.Tooltip,{title:i.t("sheet.cf.panel.createRule"),placement:"bottom",children:p.jsx("div",{className:`${ue.icon}`,onClick:E,children:p.jsx(Wo,{})})}),j.length?p.jsx(G.Tooltip,{title:i.t("sheet.cf.panel.clear"),placement:"bottom",children:p.jsx("div",{className:`${ue.gap} ${ue.icon}`,onClick:J,children:p.jsx(Rn,{})})}):p.jsx("div",{className:`${ue.gap} ${ue.disabled}`,children:p.jsx(Rn,{})})]})]}),p.jsx("div",{ref:O,className:ue.gridLayoutWrap,children:C?p.jsx(Ml,{onDragStop:R,onDragStart:F,layout:be,cols:12,rowHeight:60,width:C,margin:[0,10],draggableHandle:".draggableHandle",children:j.map((z,q)=>p.jsx("div",{children:p.jsxs("div",{onMouseMove:()=>{z.ranges!==f&&v(z.ranges)},onMouseLeave:()=>v([]),onClick:()=>t(z),className:`${ue.ruleItem} ${b===q?ue.active:""}`,children:[p.jsx("div",{className:`${ue.draggableHandle} draggableHandle`,onClick:ne=>ne.stopPropagation(),children:p.jsx(Fo,{})}),p.jsxs("div",{className:ue.ruleDescribe,children:[p.jsx("div",{className:ue.ruleType,children:Ul(z,i)}),p.jsx("div",{className:ue.ruleRange,children:z.ranges.map(ne=>_r.serializeRange(ne)).join(",")})]}),p.jsx("div",{className:ue.preview,children:p.jsx(mt,{rule:z.rule})}),p.jsx("div",{className:`${ue.deleteItem} ${b===q?ue.active:""}`,onClick:ne=>{ne.stopPropagation(),U(z)},children:p.jsx(Rn,{})})]})},`${z.cfId}`))}):null})]})},za={type:m.CommandType.COMMAND,id:"sheet.command.add-conditional-rule",handler(e,t){if(!t)return!1;const{rule:n}=t,r=e.get(m.IUndoRedoService),a=e.get(m.ICommandService),o=e.get(s.ConditionalFormattingRuleModel),i=e.get(m.IUniverInstanceService),u=k.getSheetCommandTarget(i);if(!u)return!1;const{unitId:l,subUnitId:c}=u,d=o.createCfId(l,c),h={unitId:l,subUnitId:c,rule:{...n,cfId:n.cfId||d}},f=s.AddConditionalRuleMutationUndoFactory(e,h),v=a.syncExecuteCommand(s.AddConditionalRuleMutation.id,h);return v&&r.pushUndoRedo({unitID:l,redoMutations:[{id:s.AddConditionalRuleMutation.id,params:h}],undoMutations:[f]}),v}},Aa={type:m.CommandType.COMMAND,id:"sheet.command.set-conditional-rule",handler(e,t){if(!t)return!1;const n=e.get(m.IUndoRedoService),r=e.get(m.ICommandService),a=e.get(m.IUniverInstanceService),o=k.getSheetCommandTarget(a,t);if(!o)return!1;const{unitId:i,subUnitId:u}=o,l={unitId:i,subUnitId:u,rule:t.rule},c=s.setConditionalRuleMutationUndoFactory(e,l),d=r.syncExecuteCommand(s.SetConditionalRuleMutation.id,l);return d&&n.pushUndoRedo({unitID:i,undoMutations:c,redoMutations:[{id:s.SetConditionalRuleMutation.id,params:l}]}),d}},Al=m.createInterceptorKey("beforeSubmit"),Hl=m.createInterceptorKey("submit"),fr={cfColorPicker:"univer-cf-color-picker",cfColorPickerIcon:"univer-cf-color-picker-icon",iconDropdown:"univer-icon-dropdown"},et=e=>{const{color:t,onChange:n,disable:r=!1,iconId:a="PaintBucket",className:o,isNeedDropdownIcon:i=!0}=e,u=te.useDependency(ve.ComponentManager),l=w.useMemo(()=>new m.ColorKit(t),[t]),c=u.get(a);return c&&(r?p.jsx(c,{className:o,extend:{colorChannel1:l.isValid?t:"rgb(var(--primary-color))"}}):p.jsx(G.Dropdown,{overlay:p.jsx("div",{className:`${fr.cfColorPicker} `,children:p.jsx(G.ColorPicker,{color:t,onChange:n})}),children:p.jsxs("span",{className:`${fr.cfColorPickerIcon} ${o}`,children:[p.jsx(c,{extend:{colorChannel1:l.isValid?t:"rgb(var(--primary-color))"}}),i&&p.jsx(Cn,{className:fr.iconDropdown})]})}))},P={cfRuleStyleEditor:"univer-cf-rule-style-editor",cfPreviewWrap:"univer-cf-preview-wrap",text:"univer-text",positionRelative:"univer-position-relative",btnList:"univer-btn-list",utilItem:"univer-util-item",iconSet:"univer-icon-set",renderConfig:"univer-render-config",flex:"univer-flex",width45:"univer-width45",iconWrap:"univer-icon-wrap",icon:"univer-icon",dropdownIcon:"univer-dropdown-icon",errorInput:"univer-error-input",errorText:"univer-error-text",iconGroupList:"univer-icon-group-list",title:"univer-title",group:"univer-group",itemContent:"univer-item-content",itemWrap:"univer-item-wrap",item:"univer-item",iconItemListWrap:"univer-icon-item-list-wrap",none:"univer-none",iconItemList:"univer-icon-item-list",width100:"univer-width100",stress:"univer-stress"},tt=(e,t)=>({label:t.t(`sheet.cf.valueType.${e}`),value:e}),pr=e=>{const{type:t,className:n,onChange:r,id:a,value:o}=e,i=te.useDependency(m.IUniverInstanceService),u=i.getCurrentUnitForType(m.UniverInstanceType.UNIVER_SHEET).getUnitId(),l=i.getCurrentUnitForType(m.UniverInstanceType.UNIVER_SHEET).getActiveSheet().getSheetId(),c=w.useMemo(()=>String(o).startsWith("=")?String(o):"=",[o]),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(ve.TextEditor,{openForSheetSubUnitId:l,openForSheetUnitId:u,id:m.createInternalEditorID(`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_colo_scale_${a}`),value:c,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})},kl=e=>{var F;const{interceptorManager:t}=e,n=te.useDependency(m.LocaleService),r=((F=e.rule)==null?void 0:F.type)===s.CFRuleType.colorScale?e.rule:void 0,a=[tt(s.CFValueType.num,n),tt(s.CFValueType.percent,n),tt(s.CFValueType.percentile,n),tt(s.CFValueType.formula,n)],o=[tt(s.CFValueType.min,n),...a],i=[tt("none",n),...a],u=[tt(s.CFValueType.max,n),...a],[l,c]=w.useState(()=>{var E;const R=s.CFValueType.min;return r&&((E=r.config[0])==null?void 0:E.value.type)||R}),[d,h]=w.useState(()=>{var E;const R="none";return!r||r.config.length!==3?R:((E=r.config[1])==null?void 0:E.value.type)||R}),[f,v]=w.useState(()=>{var E;const R=s.CFValueType.max;return r&&((E=r.config[r.config.length-1])==null?void 0:E.value.type)||R}),[y,T]=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 J;if(!r||r.config.length!==3)return 50;const E=(J=r.config[1])==null?void 0:J.value.value;return E===void 0?50:E}),[b,S]=w.useState(()=>{var J;if(!r)return 90;const E=(J=r.config[r.config.length-1])==null?void 0:J.value.value;return E===void 0?90:E}),[C,g]=w.useState(()=>{var E;const R="#d0d9fb";return r&&((E=r.config[0])==null?void 0:E.color)||R}),[O,M]=w.useState(()=>{var E;const R="#7790f3";return!r||r.config.length!==3?R:((E=r.config[1])==null?void 0:E.color)||R}),[I,j]=w.useState(()=>{var E;const R="#2e55ef";return r&&((E=r.config[r.config.length-1])==null?void 0:E.color)||R}),L=w.useMemo(()=>R=>{const{minType:E,medianType:J,maxType:be,minValue:z,medianValue:q,maxValue:ne,minColor:ce,medianColor:me,maxColor:Te}=R,Re=[];return Re.push({color:ce,value:{type:E,value:z}}),J!=="none"&&Re.push({color:me,value:{type:J,value:q}}),Re.push({color:Te,value:{type:be,value:ne}}),{config:Re.map((st,Vt)=>({...st,index:Vt})),type:s.CFRuleType.colorScale}},[]);w.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return L({minType:l,medianType:d,maxType:f,minValue:y,medianValue:x,maxValue:b,minColor:C,medianColor:O,maxColor:I})}}),[L,l,d,f,y,x,b,C,O,I,t]);const U=R=>{e.onChange(L(R))};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:L({minType:l,medianType:d,maxType:f,minValue:y,medianValue:x,maxValue:b,minColor:C,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:o,value:l,onChange:R=>{c(R);const E=s.createDefaultValueByValueType(R,10);T(E),U({minType:R,medianType:d,maxType:f,minValue:E,medianValue:x,maxValue:b,minColor:C,medianColor:O,maxColor:I})}}),p.jsx(pr,{id:"min",className:`${D.mLXxs}`,value:y,type:l,onChange:R=>{T(R),U({minType:l,medianType:d,maxType:f,minValue:R,medianValue:x,maxValue:b,minColor:C,medianColor:O,maxColor:I})}}),p.jsx(et,{className:D.mLXxs,color:C,onChange:R=>{g(R),U({minType:l,medianType:d,maxType:f,minValue:y,medianValue:x,maxValue:b,minColor:R,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:R=>{h(R);const E=s.createDefaultValueByValueType(R,50);_(E),U({minType:l,medianType:R,maxType:f,minValue:y,medianValue:E,maxValue:b,minColor:C,medianColor:O,maxColor:I})}}),p.jsx(pr,{id:"median",className:` ${D.mLXxs}`,value:x,type:d,onChange:R=>{_(R),U({minType:l,medianType:d,maxType:f,minValue:y,medianValue:R,maxValue:b,minColor:C,medianColor:O,maxColor:I})}}),d!=="none"&&p.jsx(et,{className:D.mLXxs,color:O,onChange:R=>{M(R),U({minType:l,medianType:d,maxType:f,minValue:y,medianValue:x,maxValue:b,minColor:C,medianColor:R,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:u,value:f,onChange:R=>{v(R);const E=s.createDefaultValueByValueType(R,90);S(E),U({minType:l,medianType:d,maxType:R,minValue:y,medianValue:x,maxValue:E,minColor:C,medianColor:O,maxColor:I})}}),p.jsx(pr,{id:"max",className:`${D.mLXxs}`,value:b,type:f,onChange:R=>{S(R),U({minType:l,medianType:d,maxType:f,minValue:y,medianValue:x,maxValue:R,minColor:C,medianColor:O,maxColor:I})}}),p.jsx(et,{className:D.mLXxs,color:I,onChange:R=>{j(R),U({minType:l,medianType:d,maxType:f,minValue:y,medianValue:x,maxValue:b,minColor:C,medianColor:O,maxColor:R})}})]})]})},gt=(e,t)=>({label:t.t(`sheet.cf.valueType.${e}`),value:e}),Ha=e=>{const{onChange:t,className:n,value:r,type:a,id:o,disabled:i=!1}=e,u=te.useDependency(m.IUniverInstanceService),l=u.getCurrentUnitForType(m.UniverInstanceType.UNIVER_SHEET).getUnitId(),c=u.getCurrentUnitForType(m.UniverInstanceType.UNIVER_SHEET).getActiveSheet().getSheetId(),d=w.useRef(r),h=w.useMemo(()=>[s.CFValueType.percentile,s.CFValueType.percent].includes(a)?{max:100,min:0}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[a]);if(a===s.CFValueType.formula){const f=String(d.current).startsWith("=")?String(d.current)||"":"=";return p.jsx(ve.TextEditor,{id:m.createInternalEditorID(`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_data_bar_${o}`),value:f,openForSheetSubUnitId:c,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})},Wl=e=>{var F;const{interceptorManager:t}=e,n=te.useDependency(m.LocaleService),r=((F=e.rule)==null?void 0:F.type)===s.CFRuleType.dataBar?e.rule:void 0,[a,o]=w.useState(()=>{var E;const R="0";return r?(E=r.config)!=null&&E.isGradient?"1":"0":R}),[i,u]=w.useState(()=>{var E;const R="#abd91a";return r&&((E=r.config)==null?void 0:E.positiveColor)||R}),[l,c]=w.useState(()=>{var E;const R="#ffbe38";return r&&((E=r.config)==null?void 0:E.nativeColor)||R}),d=[gt(s.CFValueType.num,n),gt(s.CFValueType.percent,n),gt(s.CFValueType.percentile,n),gt(s.CFValueType.formula,n)],h=[gt(s.CFValueType.min,n),...d],f=[gt(s.CFValueType.max,n),...d],[v,y]=w.useState(()=>{var E;const R=h[0].value;return r&&((E=r.config)==null?void 0:E.min.type)||R}),[T,x]=w.useState(()=>{var E;const R=f[0].value;return r&&((E=r.config)==null?void 0:E.max.type)||R}),[_,b]=w.useState(()=>{var J;if(!r)return 0;const E=((J=r.config)==null?void 0:J.min)||{};return E.type===s.CFValueType.formula?E.value||"=":E.value||0}),[S,C]=w.useState(()=>{var J;if(!r)return 100;const E=((J=r.config)==null?void 0:J.max)||{};return E.type===s.CFValueType.formula?E.value||"=":E.value===void 0?100:E.value}),[g,O]=w.useState(()=>r?r.isShowValue===void 0?!0:!!r.isShowValue:!0),M=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});w.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return M({isGradient:a,minValue:_,minValueType:v,maxValue:S,maxValueType:T,positiveColor:i,nativeColor:l,isShowValue:g})}}),[a,_,v,S,T,i,l,t,g]);const I=R=>{e.onChange(M(R))},j=R=>{u(R),I({isGradient:a,minValue:_,minValueType:v,maxValue:S,maxValueType:T,positiveColor:R,nativeColor:l,isShowValue:g})},L=R=>{c(R),I({isGradient:a,minValue:_,minValueType:v,maxValue:S,maxValueType:T,positiveColor:i,nativeColor:R,isShowValue:g})},U=R=>d.map(E=>E.value).includes(R);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:a,minValue:_,minValueType:v,maxValue:S,maxValueType:T,positiveColor:i,nativeColor:l,isShowValue:g})})}),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:a,onChange:R=>{o(R),I({isGradient:R,minValue:_,minValueType:v,maxValue:S,maxValueType:T,positiveColor:i,nativeColor:l,isShowValue:g})},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:!g,onChange:R=>{O(!R),I({isGradient:R,minValue:_,minValueType:v,maxValue:S,maxValueType:T,positiveColor:i,nativeColor:l,isShowValue:!R})}}),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:L})]}),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:j})]})]})]}),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:R=>{y(R);const E=s.createDefaultValueByValueType(R,10);b(E),I({isGradient:a,minValue:E,minValueType:R,maxValue:S,maxValueType:T,positiveColor:i,nativeColor:l,isShowValue:g})}}),p.jsx(Ha,{disabled:!U(v),id:"min",type:v,className:D.mLSm,value:_,onChange:R=>{b(R||0),I({isGradient:a,minValue:R||0,minValueType:v,maxValue:S,maxValueType:T,positiveColor:i,nativeColor:l,isShowValue:g})}})]}),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:T,onChange:R=>{x(R);const E=s.createDefaultValueByValueType(R,90);C(E),I({isGradient:a,minValue:_,minValueType:v,maxValue:E,maxValueType:R,positiveColor:i,nativeColor:l,isShowValue:g})}}),p.jsx(Ha,{disabled:!U(T),id:"max",type:T,className:D.mLSm,value:S,onChange:R=>{C(R||0),I({isGradient:a,minValue:_,minValueType:v,maxValue:R||0,maxValueType:T,positiveColor:i,nativeColor:l,isShowValue:g})}})]})]})]})},ke={cfStyleEdit:"univer-cf-style-edit",buttonItem:"univer-button-item",isActive:"univer-isActive"},sn=e=>[m.BooleanNumber.FALSE,void 0].includes(e)?m.BooleanNumber.TRUE:m.BooleanNumber.FALSE,ln=e=>e!==m.BooleanNumber.FALSE,hr=e=>{const{style:t,onChange:n,className:r}=e,a=te.useDependency(ve.ComponentManager),[o,i]=w.useState(()=>{if(t!=null&&t.bl)return t.bl}),[u,l]=w.useState(()=>{if(t!=null&&t.it)return t.it}),[c,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 g="#2f56ef";return(O=t==null?void 0:t.cl)!=null&&O.rgb?t.cl.rgb:g}),[T,x]=w.useState(()=>{var O;const g="#e8ecfc";return(O=t==null?void 0:t.bg)!=null&&O.rgb?t.bg.rgb:g}),_=a.get("BoldSingle"),b=a.get("ItalicSingle"),S=a.get("UnderlineSingle"),C=a.get("StrikethroughSingle");return w.useEffect(()=>{const g={bl:o,it:u};v!==void 0&&(g.cl={rgb:v}),T!==void 0&&(g.bg={rgb:T}),h!==void 0&&(g.st={s:h}),c!==void 0&&(g.ul={s:c}),n(s.removeUndefinedAttr(g))},[o,u,c,h,v,T]),p.jsxs("div",{className:`${ke.cfStyleEdit} ${r}`,children:[_&&p.jsx("div",{className:We({[ke.isActive]:ln(o||m.BooleanNumber.FALSE)},ke.buttonItem),onClick:()=>i(sn(o)),children:p.jsx(_,{})}),b&&p.jsx("div",{className:We({[ke.isActive]:ln(u||m.BooleanNumber.FALSE)},ke.buttonItem),onClick:()=>l(sn(u)),children:p.jsx(b,{})}),S&&p.jsx("div",{className:We({[ke.isActive]:ln(c||m.BooleanNumber.FALSE)},ke.buttonItem),onClick:()=>d(sn(c)),children:p.jsx(S,{})}),C&&p.jsx("div",{className:We({[ke.isActive]:ln(h||m.BooleanNumber.FALSE)},ke.buttonItem),onClick:()=>f(sn(h)),children:p.jsx(C,{})}),p.jsx(et,{color:v,onChange:y,iconId:"FontColor"}),p.jsx(et,{color:T,onChange:x,iconId:"PaintBucket"})]})},$l=e=>{var x;const{onChange:t,interceptorManager:n}=e,r=te.useDependency(m.LocaleService),a=((x=e.rule)==null?void 0:x.type)===s.CFRuleType.highlightCell?e.rule:void 0,o=[{label:r.t("sheet.cf.panel.isNotBottom"),value:"isNotBottom"},{label:r.t("sheet.cf.panel.isBottom"),value:"isBottom"},{label:r.t("sheet.cf.panel.greaterThanAverage"),value:"greaterThanAverage"},{label:r.t("sheet.cf.panel.lessThanAverage"),value:"lessThanAverage"}],[i,u]=w.useState(()=>{const _=o[0].value,b=a==null?void 0:a.type;if(!a)return _;switch(b){case s.CFRuleType.highlightCell:switch(a.subType){case s.CFSubRuleType.average:return[s.CFNumberOperator.greaterThan,s.CFNumberOperator.greaterThanOrEqual].includes(a.operator)?"greaterThanAverage":[s.CFNumberOperator.lessThan,s.CFNumberOperator.lessThanOrEqual].includes(a.operator)?"lessThanAverage":_;case s.CFSubRuleType.rank:return a.isBottom?"isBottom":"isNotBottom"}}return _}),[l,c]=w.useState(()=>{const b=a==null?void 0:a.type;if(!a)return 10;switch(b){case s.CFRuleType.highlightCell:switch(a.subType){case s.CFSubRuleType.rank:return a.value||10}}return 10}),[d,h]=w.useState(()=>{const b=a==null?void 0:a.type;if(!a)return!1;switch(b){case s.CFRuleType.highlightCell:switch(a.subType){case s.CFSubRuleType.rank:return a.isPercent||!1}}return!1}),[f,v]=w.useState({}),y=_=>{const{type:b,isPercent:S,value:C,style:g}=_;if(b==="isNotBottom")return{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.rank,isPercent:S,isBottom:!1,value:C,style:g};if(b==="isBottom")return{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.rank,isPercent:S,isBottom:!0,value:C,style:g};if(b==="greaterThanAverage")return{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.average,operator:s.CFNumberOperator.greaterThan,style:g};if(b==="lessThanAverage")return{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.average,operator:s.CFNumberOperator.lessThan,style:g}};w.useEffect(()=>n.intercept(n.getInterceptPoints().submit,{handler(){return y({type:i,isPercent:d,value:l,style:f})}}),[i,d,l,f,n]);const T=_=>{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:o,onChange:_=>{u(_),T({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 b=_||0;c(b),T({type:i,isPercent:d,value:b,style:f})}}),p.jsxs("div",{className:`${D.mLSm} ${D.labelContainer} ${P.text}`,children:[p.jsx(G.Checkbox,{checked:d,onChange:_=>{h(!!_),T({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(hr,{style:a==null?void 0:a.style,className:`${D.mTSm} `,onChange:_=>{v(_),T({type:i,isPercent:d,value:l,style:_})}})]})},Q=(e,t)=>({label:t.t(`sheet.cf.operator.${e}`),value:e}),Bl=e=>{const{type:t,operator:n,onChange:r,value:a}=e,[o,i]=w.useState(()=>typeof a=="number"?a:0),[u,l]=w.useState(()=>typeof a=="string"?a:""),[c,d]=w.useState(()=>Array.isArray(a)?a[0]===void 0?0:a[0]:0),[h,f]=w.useState(()=>Array.isArray(a)?a[1]===void 0?100:a[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(u);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(o),[s.CFNumberOperator.between,s.CFNumberOperator.notBetween].includes(n)&&r([c,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:u,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:o,onChange:v})})}if([s.CFNumberOperator.between,s.CFNumberOperator.notBetween].includes(n)){const v=T=>{d(T||0),r([T||0,h])},y=T=>{f(T||0),r([c,T||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:c,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},ka=(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)]}},Wa=e=>{var C;const{interceptorManager:t,onChange:n}=e,r=te.useDependency(m.LocaleService),a=((C=e.rule)==null?void 0:C.type)===s.CFRuleType.highlightCell?e.rule:void 0,[o,i]=w.useState(()=>{const g=s.CFSubRuleType.text;return a&&a.subType||g}),u=[{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(()=>ka(o,r),[o]),[c,d]=w.useState(()=>{const g=l?l[0].value:void 0;return a&&a.operator||g}),[h,f]=w.useState(()=>{var M;const g="";return a?(M=a.value)!=null?M:s.createDefaultValue(a.subType,a.operator):g}),[v,y]=w.useState({}),T=w.useMemo(()=>g=>{var O,M,I,j,L,U,F,R,E,J,be,z,q,ne,ce;switch(g.subType||o){case s.CFSubRuleType.text:{if([s.CFTextOperator.beginsWith,s.CFTextOperator.endsWith,s.CFTextOperator.containsText,s.CFTextOperator.notContainsText,s.CFTextOperator.equal,s.CFTextOperator.notEqual].includes(c))return{type:s.CFRuleType.highlightCell,subType:(O=g.subType)!=null?O:o,operator:(M=g.operator)!=null?M:c,style:(I=g.style)!=null?I:v,value:(j=g.value)!=null?j: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(c))return{type:s.CFRuleType.highlightCell,subType:(L=g.subType)!=null?L:o,operator:(U=g.operator)!=null?U:c,style:(F=g.style)!=null?F:v,value:(R=g.value)!=null?R:h};if([s.CFNumberOperator.between,s.CFNumberOperator.notBetween].includes(c))return{type:s.CFRuleType.highlightCell,subType:(E=g.subType)!=null?E:o,operator:(J=g.operator)!=null?J:c,style:(be=g.style)!=null?be:v,value:(z=g.value)!=null?z:h};break}}return{type:s.CFRuleType.highlightCell,subType:(q=g.subType)!=null?q:o,operator:(ne=g.operator)!=null?ne:c,style:(ce=g.style)!=null?ce:v}},[o,c,h,v]);w.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return T({})}}),[T,t]),w.useEffect(()=>{u.some(g=>g.value===o)||i(u[0].value)},[u]);const x=g=>{const O=g,M=ka(O,r),I=M&&M[0].value;i(O),d(I),I&&f(s.createDefaultValue(O,I)),n(T({subType:O,operator:I}))},_=g=>{const O=g;d(O),n(T({operator:O}))},b=g=>{f(g),n(T({value:g}))},S=w.useMemo(()=>`${o}_${c}_${Math.random()}`,[o,c]);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:o,options:u}),(l==null?void 0:l.length)&&p.jsx(G.Select,{className:`${D.mTSm} ${P.width100}`,onChange:_,value:c||"",options:l}),p.jsx(Bl,{value:h,interceptorManager:t,type:o,operator:c,rule:a,onChange:b},S),p.jsx("div",{className:`${P.cfPreviewWrap}`,children:p.jsx(mt,{rule:T({})})}),p.jsx(hr,{style:a==null?void 0:a.style,className:`${D.mLXxs}`,onChange:g=>{y(g),n(T({style:g}))}})]})},Fl=e=>{var y;const{onChange:t,interceptorManager:n}=e,r=te.useDependency(m.LocaleService),o=te.useDependency(m.IUniverInstanceService).getCurrentUnitForType(m.UniverInstanceType.UNIVER_SHEET),i=o.getActiveSheet(),u=((y=e.rule)==null?void 0:y.type)===s.CFRuleType.highlightCell?e.rule:void 0,[l,c]=w.useState({}),[d,h]=w.useState(()=>(u==null?void 0:u.subType)===s.CFSubRuleType.formula?u.value:"="),f=T=>({style:T.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=T=>{t(f(T))};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(ve.TextEditor,{id:m.createInternalEditorID(`${s.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_formula`),openForSheetSubUnitId:i.getSheetId(),openForSheetUnitId:o.getUnitId(),value:d,canvasStyle:{fontSize:10},onlyInputFormula:!0,onChange:(T="")=>{const x=T||"";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(hr,{style:u==null?void 0:u.style,className:`${D.mTSm} `,onChange:T=>{c(T),v({style:T,formula:d})}})]})};var Gl="Expected a function",$a="__lodash_hash_undefined__",Ba=1/0,ql=9007199254740991,Xl="[object Function]",Yl="[object GeneratorFunction]",Kl="[object Symbol]",Zl=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Jl=/^\w*$/,Ql=/^\./,eu=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,tu=/[\\^$.*+?()[\]{}|]/g,nu=/\\(\\)?/g,ru=/^\[object .+?Constructor\]$/,au=/^(?:0|[1-9]\d*)$/,ou=typeof Ae=="object"&&Ae&&Ae.Object===Object&&Ae,iu=typeof self=="object"&&self&&self.Object===Object&&self,mr=ou||iu||Function("return this")();function su(e,t){return e==null?void 0:e[t]}function lu(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch{}return t}var uu=Array.prototype,cu=Function.prototype,Fa=Object.prototype,gr=mr["__core-js_shared__"],Ga=function(){var e=/[^.]+$/.exec(gr&&gr.keys&&gr.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),qa=cu.toString,un=Fa.hasOwnProperty,Xa=Fa.toString,du=RegExp("^"+qa.call(un).replace(tu,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ya=mr.Symbol,fu=uu.splice,pu=Ja(mr,"Map"),xt=Ja(Object,"create"),Ka=Ya?Ya.prototype:void 0,Za=Ka?Ka.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 hu(){this.__data__=xt?xt(null):{}}function mu(e){return this.has(e)&&delete this.__data__[e]}function gu(e){var t=this.__data__;if(xt){var n=t[e];return n===$a?void 0:n}return un.call(t,e)?t[e]:void 0}function vu(e){var t=this.__data__;return xt?t[e]!==void 0:un.call(t,e)}function yu(e,t){var n=this.__data__;return n[e]=xt&&t===void 0?$a:t,this}nt.prototype.clear=hu,nt.prototype.delete=mu,nt.prototype.get=gu,nt.prototype.has=vu,nt.prototype.set=yu;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 Su(){this.__data__=[]}function bu(e){var t=this.__data__,n=cn(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():fu.call(t,n,1),!0}function Tu(e){var t=this.__data__,n=cn(t,e);return n<0?void 0:t[n][1]}function Ru(e){return cn(this.__data__,e)>-1}function Cu(e,t){var n=this.__data__,r=cn(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}vt.prototype.clear=Su,vt.prototype.delete=bu,vt.prototype.get=Tu,vt.prototype.has=Ru,vt.prototype.set=Cu;function rt(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__={hash:new nt,map:new(pu||vt),string:new nt}}function wu(e){return dn(this,e).delete(e)}function Iu(e){return dn(this,e).get(e)}function xu(e){return dn(this,e).has(e)}function Ou(e,t){return dn(this,e).set(e,t),this}rt.prototype.clear=_u,rt.prototype.delete=wu,rt.prototype.get=Iu,rt.prototype.has=xu,rt.prototype.set=Ou;function Eu(e,t,n){var r=e[t];(!(un.call(e,t)&&Qa(r,n))||n===void 0&&!(t in e))&&(e[t]=n)}function cn(e,t){for(var n=e.length;n--;)if(Qa(e[n][0],t))return n;return-1}function Mu(e){if(!fn(e)||Uu(e))return!1;var t=ku(e)||lu(e)?du:ru;return t.test(Hu(e))}function Du(e,t,n,r){if(!fn(e))return e;t=Lu(t,e)?[t]:Nu(t);for(var a=-1,o=t.length,i=o-1,u=e;u!=null&&++a<o;){var l=Au(t[a]),c=n;if(a!=i){var d=u[l];c=r?r(d,l,u):void 0,c===void 0&&(c=fn(d)?d:ju(t[a+1])?[]:{})}Eu(u,l,c),u=u[l]}return e}function Pu(e){if(typeof e=="string")return e;if(yr(e))return Za?Za.call(e):"";var t=e+"";return t=="0"&&1/e==-Ba?"-0":t}function Nu(e){return eo(e)?e:zu(e)}function dn(e,t){var n=e.__data__;return Vu(t)?n[typeof t=="string"?"string":"hash"]:n.map}function Ja(e,t){var n=su(e,t);return Mu(n)?n:void 0}function ju(e,t){return t=t==null?ql:t,!!t&&(typeof e=="number"||au.test(e))&&e>-1&&e%1==0&&e<t}function Lu(e,t){if(eo(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||yr(e)?!0:Jl.test(e)||!Zl.test(e)||t!=null&&e in Object(t)}function Vu(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Uu(e){return!!Ga&&Ga in e}var zu=vr(function(e){e=$u(e);var t=[];return Ql.test(e)&&t.push(""),e.replace(eu,function(n,r,a,o){t.push(a?o.replace(nu,"$1"):r||n)}),t});function Au(e){if(typeof e=="string"||yr(e))return e;var t=e+"";return t=="0"&&1/e==-Ba?"-0":t}function Hu(e){if(e!=null){try{return qa.call(e)}catch{}try{return e+""}catch{}}return""}function vr(e,t){if(typeof e!="function"||t&&typeof t!="function")throw new TypeError(Gl);var n=function(){var r=arguments,a=t?t.apply(this,r):r[0],o=n.cache;if(o.has(a))return o.get(a);var i=e.apply(this,r);return n.cache=o.set(a,i),i};return n.cache=new(vr.Cache||rt),n}vr.Cache=rt;function Qa(e,t){return e===t||e!==e&&t!==t}var eo=Array.isArray;function ku(e){var t=fn(e)?Xa.call(e):"";return t==Xl||t==Yl}function fn(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function Wu(e){return!!e&&typeof e=="object"}function yr(e){return typeof e=="symbol"||Wu(e)&&Xa.call(e)==Kl}function $u(e){return e==null?"":Pu(e)}function Bu(e,t,n){return e==null?e:Du(e,t,n)}var Fu=Bu;const Gu=_n(Fu);var qu="Expected a function",to="__lodash_hash_undefined__",no=1/0,Xu="[object Function]",Yu="[object GeneratorFunction]",Ku="[object Symbol]",Zu=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ju=/^\w*$/,Qu=/^\./,ec=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,tc=/[\\^$.*+?()[\]{}|]/g,nc=/\\(\\)?/g,rc=/^\[object .+?Constructor\]$/,ac=typeof Ae=="object"&&Ae&&Ae.Object===Object&&Ae,oc=typeof self=="object"&&self&&self.Object===Object&&self,Sr=ac||oc||Function("return this")();function ic(e,t){return e==null?void 0:e[t]}function sc(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch{}return t}var lc=Array.prototype,uc=Function.prototype,ro=Object.prototype,br=Sr["__core-js_shared__"],ao=function(){var e=/[^.]+$/.exec(br&&br.keys&&br.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),oo=uc.toString,Tr=ro.hasOwnProperty,io=ro.toString,cc=RegExp("^"+oo.call(Tr).replace(tc,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),so=Sr.Symbol,dc=lc.splice,fc=co(Sr,"Map"),Ot=co(Object,"create"),lo=so?so.prototype:void 0,uo=lo?lo.toString:void 0;function at(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 pc(){this.__data__=Ot?Ot(null):{}}function hc(e){return this.has(e)&&delete this.__data__[e]}function mc(e){var t=this.__data__;if(Ot){var n=t[e];return n===to?void 0:n}return Tr.call(t,e)?t[e]:void 0}function gc(e){var t=this.__data__;return Ot?t[e]!==void 0:Tr.call(t,e)}function vc(e,t){var n=this.__data__;return n[e]=Ot&&t===void 0?to:t,this}at.prototype.clear=pc,at.prototype.delete=hc,at.prototype.get=mc,at.prototype.has=gc,at.prototype.set=vc;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 yc(){this.__data__=[]}function Sc(e){var t=this.__data__,n=pn(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():dc.call(t,n,1),!0}function bc(e){var t=this.__data__,n=pn(t,e);return n<0?void 0:t[n][1]}function Tc(e){return pn(this.__data__,e)>-1}function Rc(e,t){var n=this.__data__,r=pn(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}yt.prototype.clear=yc,yt.prototype.delete=Sc,yt.prototype.get=bc,yt.prototype.has=Tc,yt.prototype.set=Rc;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 Cc(){this.__data__={hash:new at,map:new(fc||yt),string:new at}}function _c(e){return hn(this,e).delete(e)}function wc(e){return hn(this,e).get(e)}function Ic(e){return hn(this,e).has(e)}function xc(e,t){return hn(this,e).set(e,t),this}ot.prototype.clear=Cc,ot.prototype.delete=_c,ot.prototype.get=wc,ot.prototype.has=Ic,ot.prototype.set=xc;function pn(e,t){for(var n=e.length;n--;)if(zc(e[n][0],t))return n;return-1}function Oc(e,t){t=Pc(t,e)?[t]:Dc(t);for(var n=0,r=t.length;e!=null&&n<r;)e=e[Vc(t[n++])];return n&&n==r?e:void 0}function Ec(e){if(!po(e)||jc(e))return!1;var t=Ac(e)||sc(e)?cc:rc;return t.test(Uc(e))}function Mc(e){if(typeof e=="string")return e;if(Cr(e))return uo?uo.call(e):"";var t=e+"";return t=="0"&&1/e==-no?"-0":t}function Dc(e){return fo(e)?e:Lc(e)}function hn(e,t){var n=e.__data__;return Nc(t)?n[typeof t=="string"?"string":"hash"]:n.map}function co(e,t){var n=ic(e,t);return Ec(n)?n:void 0}function Pc(e,t){if(fo(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Cr(e)?!0:Ju.test(e)||!Zu.test(e)||t!=null&&e in Object(t)}function Nc(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function jc(e){return!!ao&&ao in e}var Lc=Rr(function(e){e=kc(e);var t=[];return Qu.test(e)&&t.push(""),e.replace(ec,function(n,r,a,o){t.push(a?o.replace(nc,"$1"):r||n)}),t});function Vc(e){if(typeof e=="string"||Cr(e))return e;var t=e+"";return t=="0"&&1/e==-no?"-0":t}function Uc(e){if(e!=null){try{return oo.call(e)}catch{}try{return e+""}catch{}}return""}function Rr(e,t){if(typeof e!="function"||t&&typeof t!="function")throw new TypeError(qu);var n=function(){var r=arguments,a=t?t.apply(this,r):r[0],o=n.cache;if(o.has(a))return o.get(a);var i=e.apply(this,r);return n.cache=o.set(a,i),i};return n.cache=new(Rr.Cache||ot),n}Rr.Cache=ot;function zc(e,t){return e===t||e!==e&&t!==t}var fo=Array.isArray;function Ac(e){var t=po(e)?io.call(e):"";return t==Xu||t==Yu}function po(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function Hc(e){return!!e&&typeof e=="object"}function Cr(e){return typeof e=="symbol"||Hc(e)&&io.call(e)==Ku}function kc(e){return e==null?"":Mc(e)}function Wc(e,t,n){var r=e==null?void 0:Oc(e,t);return r===void 0?n:r}var $c=Wc;const Bc=_n($c),ho=(e,t)=>(s.iconMap[e]||[])[Number(t)]||"",Fc=e=>{const t=te.useDependency(m.IUniverInstanceService),n=t.getCurrentUnitForType(m.UniverInstanceType.UNIVER_SHEET).getUnitId(),r=t.getCurrentUnitForType(m.UniverInstanceType.UNIVER_SHEET).getActiveSheet().getSheetId(),a=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:a,value:Number(e.value)||0,onChange:o=>e.onChange(o!=null?o:0)}),e.error&&p.jsx("div",{className:P.errorText,children:e.error})]}):p.jsx(ve.TextEditor,{id:m.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:(o="")=>{const i=o||"";e.onChange(i)}})})},mo=(e,t,n)=>({operator:s.CFNumberOperator.greaterThan,value:{type:s.CFValueType.num,value:(n.length-1-t)*10},iconType:e,iconId:String(t)}),Gc=e=>{const t=te.useDependency(m.LocaleService),n=r=>{e.onClick(r)};return p.jsx("div",{className:P.iconGroupList,children:s.iconGroup.map((r,a)=>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(o=>p.jsx("div",{className:P.itemWrap,onClick:()=>{n(o.name)},children:p.jsx("div",{className:P.item,children:o.list.map((i,u)=>p.jsx("img",{className:P.icon,src:i},u))})},o.name))})]},a))})},qc=e=>{const t=w.useMemo(()=>{const r=[];for(const a in s.iconMap){const o=s.iconMap[a],i=a;o.forEach((u,l)=>{r.push({iconType:i,base64:u,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(Ut,{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}`))})]})},Xc=e=>{const{onChange:t,configList:n,errorMap:r={}}=e,a=te.useDependency(m.LocaleService),o=[{label:a.t(`sheet.cf.symbol.${s.CFNumberOperator.greaterThan}`),value:s.CFNumberOperator.greaterThan},{label:a.t(`sheet.cf.symbol.${s.CFNumberOperator.greaterThanOrEqual}`),value:s.CFNumberOperator.greaterThanOrEqual}],i=[{label:a.t(`sheet.cf.valueType.${s.CFValueType.num}`),value:s.CFValueType.num},{label:a.t(`sheet.cf.valueType.${s.CFValueType.percent}`),value:s.CFValueType.percent},{label:a.t(`sheet.cf.valueType.${s.CFValueType.percentile}`),value:s.CFValueType.percentile},{label:a.t(`sheet.cf.valueType.${s.CFValueType.formula}`),value:s.CFValueType.formula}],u=(h,f)=>{t([String(f),"value","value"],h)},l=(h,f)=>{t([String(f),"operator"],h);const v=s.createDefaultValue(s.CFSubRuleType.number,h);u(v,f)},c=(h,f)=>{t([String(f),"value","type"],h)};return w.useMemo(()=>n.map((h,f)=>{const v=r[f],y=ho(h.iconType,h.iconId),T=f===n.length-1,x=f===0,_=n[f-1],b=(_==null?void 0:_.value.type)===s.CFValueType.formula?a.t("sheet.cf.valueType.formula"):_==null?void 0:_.value.value,S=(C,g)=>{const O={...h,iconId:g,iconType:C};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:[a.t("sheet.cf.iconSet.icon"),f+1]}),p.jsx("div",{className:`${P.width45}`,children:p.jsxs(p.Fragment,{children:[!x&&!T&&a.t("sheet.cf.iconSet.rule"),!x&&!T&&p.jsxs("span",{className:P.stress,children:["(",a.t("sheet.cf.iconSet.when"),a.t(`sheet.cf.symbol.${s.getOppositeOperator(_.operator)}`),b,T?"":` ${a.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(qc,{onClick:S,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(Ut,{className:P.icon}),p.jsx(Cn,{})]})})}),T?p.jsxs("div",{className:`${P.width45} ${D.label}`,style:{marginTop:0},children:[a.t("sheet.cf.iconSet.rule"),p.jsxs("span",{className:P.stress,children:["(",a.t("sheet.cf.iconSet.when"),a.t(`sheet.cf.symbol.${s.getOppositeOperator(_.operator)}`),b,T?"":` ${a.t("sheet.cf.iconSet.and")} `,")"]})]}):p.jsx(G.Select,{className:`${D.mL0} ${P.width45} ${D.mR0}`,options:o,value:h.operator,onChange:C=>{l(C,f)}})]}),T?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:a.t("sheet.cf.iconSet.type")}),p.jsx("div",{className:`${P.width45}`,children:a.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:C=>{c(C,f)}}),p.jsx("div",{className:`${D.mL0} ${P.width45}`,children:p.jsx(Fc,{id:f,type:h.value.type,error:v,value:h.value.value||"",onChange:C=>u(C,f)})})]})]})]},f)}),[n,r])},Yc=e=>{var _;const{interceptorManager:t}=e,n=((_=e.rule)==null?void 0:_.type)===s.CFRuleType.iconSet?e.rule:void 0,r=te.useDependency(m.LocaleService),[a,o]=w.useState({}),[i,u]=w.useState(()=>{const b=Object.keys(s.iconMap)[0];if(n&&n.config.length){const S=n.config[0].iconType;if(!n.config.some(g=>g.iconType!==S))return S}return b}),[l,c]=w.useState(()=>{if(n&&n.config.length)return m.Tools.deepClone(n==null?void 0:n.config);const b=s.iconMap[i]||[];return new Array(b.length).fill("").map((S,C,g)=>C===g.length-1?{operator:s.CFNumberOperator.lessThanOrEqual,value:{type:s.CFValueType.num,value:Number.MAX_SAFE_INTEGER},iconType:i,iconId:String(C)}:mo(i,C,g))}),[d,h]=w.useState(()=>n?!!n.isShowValue:!0),f=w.useMemo(()=>{const b=l.map(S=>ho(S.iconType,S.iconId));return p.jsx("div",{className:P.iconWrap,children:b.map((S,C)=>S?p.jsx("img",{className:P.icon,src:S},C):p.jsx(Ut,{className:P.icon},C))})},[l]),v=b=>{if(b.reduce((C,g,O)=>C.preType&&!C.result||b.length-1===O?C:g.value.type===s.CFValueType.formula?{preType:s.CFValueType.formula,result:!1}:C.preType?{result:C.preType===g.value.type,preType:g.value.type}:{result:!0,preType:g.value.type},{result:!0,preType:""}).result&&[s.CFValueType.num,s.CFValueType.percent,s.CFValueType.percentile].includes(b[0].value.type)){const C={};return b.forEach((g,O,M)=>{if(O-1<0||O===M.length-1)return;const j=b[O-1],L=s.getOppositeOperator(j.operator);s.compareWithNumber({operator:L,value:j.value.value},g.value.value)||(C[O]=`${r.t(`sheet.cf.form.${L}`,String(j.value.value))} `)}),C}return{}},y=(b,S)=>{Bc(l,b)!==S&&(Gu(l,b,S),c([...l]),o(v(l)))},T=b=>{u(b);const S=s.iconMap[b]||[],C=new Array(S.length).fill("").map((g,O,M)=>mo(b,O,M));c(C),o(v(C))};w.useEffect(()=>{const b=t.intercept(t.getInterceptPoints().submit,{handler(){return{type:s.CFRuleType.iconSet,isShowValue:d,config:l}}});return()=>{b()}},[d,l,t]),w.useEffect(()=>{const b=t.intercept(t.getInterceptPoints().beforeSubmit,{handler(){return Object.keys(a).length===0}});return()=>{b()}},[d,l,t,a]);const x=()=>{const b=l.map(S=>({...S}));l.forEach((S,C)=>{const g=l.length-1-C,O=b[g];S.iconId=O.iconId,S.iconType=O.iconType}),c([...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(Gc,{iconType:i,onClick:T}),children:p.jsxs("div",{className:P.dropdownIcon,style:{width:"unset"},children:[f,p.jsx(Cn,{})]})})}),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:b=>{h(!b)}}),r.t("sheet.cf.iconSet.onlyShowIcon")]})]}),p.jsx(Xc,{errorMap:a,onChange:y,configList:l})]})},go=e=>e.getCurrentUnitForType(m.UniverInstanceType.UNIVER_SHEET).getUnitId(),vo=e=>e.getCurrentUnitForType(m.UniverInstanceType.UNIVER_SHEET).getActiveSheet().getSheetId(),Kc=e=>{var C,g,O,M;const t=te.useDependency(m.LocaleService),n=te.useDependency(m.ICommandService),r=te.useDependency(m.IUniverInstanceService),a=te.useDependency(s.ConditionalFormattingRuleModel),o=te.useDependency(k.SelectionManagerService),i=go(r),u=vo(r),l=w.useRef((g=(C=e.rule)==null?void 0:C.ranges)!=null?g:[]),c=w.useMemo(()=>{var j,L;let I=(j=e.rule)==null?void 0:j.ranges;return I!=null&&I.length||(I=(L=o.getSelectionRanges())!=null?L:[]),l.current=I,I!=null&&I.length?I.map(U=>{const F=_r.serializeRange(U);return F==="NaN"?"":F}).filter(U=>!!U).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 L,U;const I=(L=e.rule)==null?void 0:L.rule.type,j=d[0].value;if(!I)return j;switch(I){case s.CFRuleType.highlightCell:{switch((U=e.rule)==null?void 0:U.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 j}),v=w.useRef(),y=w.useMemo(()=>new m.InterceptorManager({beforeSubmit:Al,submit:Hl}),[]),T=w.useMemo(()=>{switch(h){case"1":return Wa;case"2":return $l;case"3":return Wl;case"4":return kl;case"5":return Fl;case"6":return Yc;default:return Wa}},[h]);w.useEffect(()=>{var I;if(((I=e.rule)==null?void 0:I.cfId)!==void 0){const j=n.onCommandExecuted(L=>{if(L.id===k.RemoveSheetMutation.id){const U=L.params;U.subUnitId===u&&U.unitId===i&&e.onCancel()}L.id===k.SetWorksheetActiveOperation.id&&e.onCancel()});return()=>j.dispose()}},[(O=e.rule)==null?void 0:O.cfId]);const x=I=>{v.current=I},_=I=>{l.current=I.map(j=>j.range)},b=()=>{const I=y.fetchThroughInterceptors(y.getInterceptPoints().beforeSubmit)(!0,null),j=()=>{const L=r.getCurrentUnitForType(m.UniverInstanceType.UNIVER_SHEET).getActiveSheet();return l.current.map(R=>k.setEndForRange(R,L.getRowCount(),L.getColumnCount())).filter(R=>!(Number.isNaN(R.startRow)||Number.isNaN(R.startColumn)))};if(I){const L=y.fetchThroughInterceptors(y.getInterceptPoints().submit)(null,null),U=j();if(L&&U.length){const F=go(r),R=vo(r);let E={};e.rule&&e.rule.cfId?(E={...e.rule,ranges:U,rule:L},n.executeCommand(Aa.id,{unitId:F,subUnitId:R,rule:E}),e.onCancel()):(E={cfId:a.createCfId(F,R),ranges:U,rule:L,stopIfTrue:!1},n.executeCommand(za.id,{unitId:F,subUnitId:R,rule:E}),e.onCancel())}}},S=()=>{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(ve.RangeSelector,{placeholder:t.t("sheet.cf.form.rangeSelector"),width:"100%",openForSheetSubUnitId:u,openForSheetUnitId:i,value:c,id:m.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(T,{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:S,children:t.t("sheet.cf.panel.cancel")}),p.jsx(G.Button,{className:D.mLSm,size:"small",type:"primary",onClick:b,children:t.t("sheet.cf.panel.submit")})]})]})},Zc=e=>{const[t,n]=w.useState(e.rule),[r,a]=w.useState(!!e.rule),o=()=>{a(!0)},i=()=>{a(!1),n(void 0)},u=l=>{n(l),a(!0)};return p.jsx("div",{className:D.conditionalFormattingWrap,children:r?p.jsx(Kc,{onCancel:i,rule:t}):p.jsx(zl,{onClick:u,onCreate:o})})};var Jc=Object.defineProperty,Qc=Object.getOwnPropertyDescriptor,ed=(e,t,n,r)=>{for(var a=r>1?void 0:r?Qc(t,n):t,o=e.length-1,i;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&Jc(t,n,a),a},Et=(e,t)=>(n,r)=>t(n,r,e);const yo="sheet.conditional.formatting.panel";let Mt=class extends m.Disposable{constructor(e,t,n,r,a){super(),this._injector=e,this._componentManager=t,this._menuService=n,this._sidebarService=r,this._localeService=a,this._initMenu(),this._initPanel()}openPanel(e){const t={header:{title:this._localeService.t("sheet.cf.title")},children:{label:yo,rule:e}};this._sidebarService.open(t)}_initMenu(){this._menuService.addMenuItem(qo(this._componentManager)(this._injector))}_initPanel(){this._componentManager.register(yo,Zc)}};Mt=ed([m.OnLifecycle(m.LifecycleStages.Ready,Mt),Et(0,V.Inject(V.Injector)),Et(1,V.Inject(ve.ComponentManager)),Et(2,V.Inject(ve.IMenuService)),Et(3,V.Inject(ve.ISidebarService)),Et(4,V.Inject(m.LocaleService))],Mt);var Ie=(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))(Ie||{});const So={id:"sheet.operation.open.conditional.formatting.panel",type:m.CommandType.OPERATION,handler:(e,t)=>{const n=e.get(Mt),r=e.get(k.SelectionManagerService),a=e.get(m.ICommandService),o=r.getSelectionRanges()||[];switch(t.value){case 3:{n.openPanel({...s.createDefaultRule(),ranges:o});break}case 4:{const u={...s.createDefaultRule,ranges:o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.rank}};n.openPanel(u);break}case 5:{const u={...s.createDefaultRule,ranges:o,rule:{type:s.CFRuleType.highlightCell,subType:s.CFSubRuleType.formula,value:"="}};n.openPanel(u);break}case 6:{const u={...s.createDefaultRule,ranges:o,rule:{type:s.CFRuleType.colorScale,config:[]}};n.openPanel(u);break}case 7:{const u={...s.createDefaultRule,ranges:o,rule:{type:s.CFRuleType.dataBar,isShowValue:!0}};n.openPanel(u);break}case 8:{const u={...s.createDefaultRule,ranges:o,rule:{type:s.CFRuleType.iconSet,config:[],isShowValue:!0}};n.openPanel(u);break}case 2:{n.openPanel();break}case 1:{n.openPanel({...s.createDefaultRule(),ranges:o});break}case 9:{a.executeCommand(Ir.id,{ranges:o});break}case 10:{a.executeCommand(Tn.id);break}}return!0}};var td=Object.defineProperty,nd=Object.getOwnPropertyDescriptor,rd=(e,t,n,r)=>{for(var a=r>1?void 0:r?nd(t,n):t,o=e.length-1,i;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&td(t,n,a),a},it=(e,t)=>(n,r)=>t(n,r,e);let mn=class extends m.Disposable{constructor(e,t,n,r,a,o,i){super(),this._sheetInterceptorService=e,this._conditionalFormattingService=t,this._univerInstanceService=n,this._renderManagerService=r,this._conditionalFormattingViewModel=a,this._conditionalFormattingRuleModel=o,this._sheetSkeletonManagerService=i,this._initViewModelInterceptor(),this._initSkeleton(),this._initRender()}_initRender(){const e=[[s.dataBarUKey,s.DataBar],[s.IconUKey,s.ConditionalFormattingIcon]],t=r=>{const a=r&&this._renderManagerService.getRenderById(r),o=a&&a.mainComponent;o&&e.forEach(([i,u])=>{o.getExtensionByKey(i)||o.register(new u)})};this.disposeWithMe(this._renderManagerService.currentRender$.subscribe(r=>{r&&t(r)}));const n=this._univerInstanceService.getCurrentUnitForType(m.UniverInstanceType.UNIVER_SHEET);n&&t(n.getUnitId())}_initSkeleton(){const e=()=>{var n,r;this._sheetSkeletonManagerService.reCalculate();const t=this._univerInstanceService.getCurrentUnitForType(m.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(m.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();return t.filter(a=>a.unitId===n.getUnitId()&&a.subUnitId===r.getSheetId()).length>0})).subscribe(e)),this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.pipe(Ee.bufferTime(16),Ee.filter(t=>{const n=this._univerInstanceService.getCurrentUnitForType(m.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();return t.filter(a=>["sort","delete"].includes(a.type)&&a.unitId===n.getUnitId()&&a.subUnitId===r.getSheetId()).length>0})).subscribe(e)),this.disposeWithMe(this._conditionalFormattingService.ruleComputeStatus$.pipe(Ee.bufferTime(16),Ee.filter(t=>{const n=this._univerInstanceService.getCurrentUnitForType(m.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;const r=n.getActiveSheet();return t.filter(a=>a.unitId===n.getUnitId()&&a.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 a=t.workbook.getStyles(),i={...(typeof(e==null?void 0:e.s)=="string"?a.get(e==null?void 0:e.s):e==null?void 0:e.s)||{}},u={...e,s:i};return r.style&&Object.assign(i,r.style),u.fontRenderExtension||(u.fontRenderExtension={},r.isShowValue!==void 0&&(u.fontRenderExtension.isSkip=!r.isShowValue)),r.dataBar&&(u.dataBar=r.dataBar),r.iconSet&&(u.iconSet=r.iconSet,u.fontRenderExtension.leftOffset=s.DEFAULT_PADDING+s.DEFAULT_WIDTH),n(u)}}))}};mn=rd([m.OnLifecycle(m.LifecycleStages.Rendered,mn),it(0,V.Inject(k.SheetInterceptorService)),it(1,V.Inject(s.ConditionalFormattingService)),it(2,V.Inject(m.IUniverInstanceService)),it(3,V.Inject(_o.IRenderManagerService)),it(4,V.Inject(s.ConditionalFormattingViewModel)),it(5,V.Inject(s.ConditionalFormattingRuleModel)),it(6,V.Inject(le.SheetSkeletonManagerService))],mn);var ad=Object.defineProperty,od=Object.getOwnPropertyDescriptor,id=(e,t,n,r)=>{for(var a=r>1?void 0:r?od(t,n):t,o=e.length-1,i;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&ad(t,n,a),a},Dt=(e,t)=>(n,r)=>t(n,r,e);let gn=class extends m.Disposable{constructor(t,n,r,a,o){super();lt(this,"_copyInfo");this._sheetClipboardService=t,this._conditionalFormattingRuleModel=n,this._injector=r,this._conditionalFormattingViewModel=a,this._univerInstanceService=o,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,a)=>{const{copyType:o=le.COPY_TYPE.COPY,pasteType:i}=a,{range:u}=t||{},{range:l}=n;return this._generateConditionalFormattingMutations(l,{copyType:o,pasteType:i,copyRange:u})}}))}_collectConditionalRule(t,n,r){const a=new m.ObjectMatrix,o={};this._copyInfo={matrix:a,info:{unitId:t,subUnitId:n,cfMap:o}};const i=this._conditionalFormattingViewModel.getMatrix(t,n);if(!i)return;const u={get:this._injector.get.bind(this._injector)},l=le.rangeToDiscreteRange(r,u,t,n);if(!l)return;const{rows:c,cols:d}=l,h=new Set;c.forEach((f,v)=>{d.forEach((y,T)=>{const x=this._conditionalFormattingViewModel.getCellCf(t,n,f,y,i);x&&(x.cfList.forEach(_=>h.add(_.cfId)),a.setValue(v,T,x.cfList.map(_=>_.cfId)))})}),h.forEach(f=>{const v=this._conditionalFormattingRuleModel.getRule(t,n,f);v&&(o[f]=v.rule)})}_generateConditionalFormattingMutations(t,n){const r=this._univerInstanceService.getCurrentUnitForType(m.UniverInstanceType.UNIVER_SHEET),a=r.getActiveSheet(),o=r.getUnitId(),i=a.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:[u,l],mapFunc:c}=le.virtualizeDiscreteRanges([n.copyRange,t]),d=le.getRepeatRange(u,l,!0),h=this._conditionalFormattingViewModel.getMatrix(o,i),f={};m.Range.foreach(l,(g,O)=>{const{row:M,col:I}=c(g,O),j=this._conditionalFormattingViewModel.getCellCf(o,i,M,I,h);j&&j.cfList.forEach(L=>{if(!f[L.cfId]){const U=new m.ObjectMatrix;f[L.cfId]=U;const F=this._conditionalFormattingRuleModel.getRule(o,i,L.cfId);F==null||F.ranges.forEach(R=>{m.Range.foreach(R,(E,J)=>{U.setValue(E,J,1)})})}f[L.cfId].realDeleteValue(M,I)})});const{matrix:v,info:y}=this._copyInfo,T=[];let x=this._conditionalFormattingRuleModel.createCfId(o,i);const _={},b=g=>{if(_[g])return _[g];const O=y==null?void 0:y.cfMap[g],M=[...this._conditionalFormattingRuleModel.getSubunitRules(o,i)||[],...T].find(I=>m.Tools.diffValue(I.rule,O));if(M)return _[g]=M,M;{const I={rule:O,cfId:x,ranges:[],stopIfTrue:!1};return _[g]=I,T.push(I),x=`${Number(x)+1}`,I}};d.forEach(g=>{v&&v.forValue((O,M,I)=>{const j=m.Rectangle.getPositionRange({startRow:O,endRow:O,startColumn:M,endColumn:M},g.startRange),{row:L,col:U}=c(j.startRow,j.startColumn);I.forEach(F=>{if(!f[F]){const R=b(F),E=new m.ObjectMatrix;f[F]=E,R.ranges.forEach(J=>{m.Range.foreach(J,(be,z)=>{E.setValue(be,z,1)})})}f[F].setValue(L,U,1)})})});const S=[],C=[];for(const g in f){const O=f[g],M=k.findAllRectangle(k.createTopMatrixFromMatrix(O));if(!M.length){const I={unitId:o,subUnitId:i,cfId:g};S.push({id:s.DeleteConditionalRuleMutation.id,params:I}),C.push(...s.DeleteConditionalRuleMutationUndoFactory(this._injector,I))}if(T.some(I=>I.cfId===g)){const I=b(g),j={unitId:o,subUnitId:i,rule:{...I,ranges:M}};S.push({id:s.AddConditionalRuleMutation.id,params:j}),C.push(s.AddConditionalRuleMutationUndoFactory(this._injector,j))}else{const I=this._conditionalFormattingRuleModel.getRule(o,i,g);if(!I)continue;const j={unitId:o,subUnitId:i,rule:{...I,ranges:M}};S.push({id:s.SetConditionalRuleMutation.id,params:j}),C.push(...s.setConditionalRuleMutationUndoFactory(this._injector,j))}}return{redos:S,undos:C}}};gn=id([m.OnLifecycle(m.LifecycleStages.Rendered,gn),Dt(0,V.Inject(le.ISheetClipboardService)),Dt(1,V.Inject(s.ConditionalFormattingRuleModel)),Dt(2,V.Inject(V.Injector)),Dt(3,V.Inject(s.ConditionalFormattingViewModel)),Dt(4,V.Inject(m.IUniverInstanceService))],gn);var sd=Object.defineProperty,ld=Object.getOwnPropertyDescriptor,ud=(e,t,n,r)=>{for(var a=r>1?void 0:r?ld(t,n):t,o=e.length-1,i;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&sd(t,n,a),a},Pt=(e,t)=>(n,r)=>t(n,r,e);let vn=class extends m.Disposable{constructor(e,t,n,r,a){super(),this._injector=e,this._univerInstanceService=t,this._autoFillService=n,this._conditionalFormattingRuleModel=r,this._conditionalFormattingViewModel=a,this._initAutoFill()}_initAutoFill(){const e=()=>({redos:[],undos:[]}),t=(a,o,i,u,l)=>{const c=this._univerInstanceService.getCurrentUnitForType(m.UniverInstanceType.UNIVER_SHEET).getUnitId(),d=this._univerInstanceService.getCurrentUnitForType(m.UniverInstanceType.UNIVER_SHEET).getActiveSheet().getSheetId(),h={startRow:a.row,startColumn:a.col,endColumn:a.col,endRow:a.row},f={startRow:o.row,startColumn:o.col,endColumn:o.col,endRow:o.row};m.Range.foreach(i,(v,y)=>{const T=m.Rectangle.getPositionRange({startRow:v,startColumn:y,endColumn:y,endRow:v},h),x=m.Rectangle.getPositionRange({startRow:v,startColumn:y,endColumn:y,endRow:v},f),{row:_,col:b}=l(T.startRow,T.startColumn),S=this._conditionalFormattingViewModel.getCellCf(c,d,_,b),{row:C,col:g}=l(x.startRow,x.startColumn),O=this._conditionalFormattingViewModel.getCellCf(c,d,C,g);O&&O.cfList.forEach(M=>{let I=u.get(M.cfId);if(!u.get(M.cfId)){const j=this._conditionalFormattingRuleModel.getRule(c,d,M.cfId);if(!j)return;I=new m.ObjectMatrix,j.ranges.forEach(L=>{m.Range.foreach(L,(U,F)=>{I.setValue(U,F,1)})}),u.set(M.cfId,I)}I.realDeleteValue(C,g)}),S&&S.cfList.forEach(M=>{let I=u.get(M.cfId);if(!u.get(M.cfId)){const j=this._conditionalFormattingRuleModel.getRule(c,d,M.cfId);if(!j)return;I=new m.ObjectMatrix,j.ranges.forEach(L=>{m.Range.foreach(L,(U,F)=>{I.setValue(U,F,1)})}),u.set(M.cfId,I)}I.setValue(C,g,1)})})},n=(a,o)=>{var _,b;const i=(_=this._univerInstanceService.getCurrentUnitForType(m.UniverInstanceType.UNIVER_SHEET))==null?void 0:_.getUnitId(),u=(b=this._univerInstanceService.getCurrentUnitForType(m.UniverInstanceType.UNIVER_SHEET))==null?void 0:b.getActiveSheet().getSheetId(),l=new Map,c=[],d=[];if(!i||!u)return e();const h=le.virtualizeDiscreteRanges([a,o]),[f,v]=h.ranges,{mapFunc:y}=h,T={row:f.startRow,col:f.startColumn};return le.getAutoFillRepeatRange(f,v).forEach(S=>{t(T,S.repeatStartCell,S.relativeRange,l,y)}),l.forEach((S,C)=>{const g=this._conditionalFormattingRuleModel.getRule(i,u,C);if(!g)return;const O=k.findAllRectangle(k.createTopMatrixFromMatrix(S)),M={unitId:i,subUnitId:u,rule:{...g,ranges:O}};c.push({id:s.SetConditionalRuleMutation.id,params:M}),d.push(...s.setConditionalRuleMutationUndoFactory(this._injector,M))}),{undos:d,redos:c}},r={id:s.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onFillData:(a,o,i)=>{if(i===le.APPLY_TYPE.COPY||i===le.APPLY_TYPE.ONLY_FORMAT||i===le.APPLY_TYPE.SERIES){const{source:u,target:l}=a;return n(u,l)}return e()}};this.disposeWithMe(this._autoFillService.addHook(r))}};vn=ud([m.OnLifecycle(m.LifecycleStages.Rendered,vn),Pt(0,V.Inject(V.Injector)),Pt(1,V.Inject(m.IUniverInstanceService)),Pt(2,V.Inject(le.IAutoFillService)),Pt(3,V.Inject(s.ConditionalFormattingRuleModel)),Pt(4,V.Inject(s.ConditionalFormattingViewModel))],vn);var cd=Object.defineProperty,dd=Object.getOwnPropertyDescriptor,fd=(e,t,n,r)=>{for(var a=r>1?void 0:r?dd(t,n):t,o=e.length-1,i;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&cd(t,n,a),a},Nt=(e,t)=>(n,r)=>t(n,r,e);let yn=class extends m.Disposable{constructor(e,t,n,r,a){super(),this._conditionalFormattingRuleModel=e,this._univerInstanceService=t,this._injector=n,this._sheetSkeletonManagerService=r,this._refRangeService=a,this._initRefRange()}_initRefRange(){const e=new Map,t=(r,a,o)=>`${r}_${a}_${o}`,n=(r,a,o)=>{const i=l=>{const c=[...o.ranges],d=c.map(f=>k.handleDefaultRangeChangeWithEffectRefCommands(f,l)).filter(f=>!!f);if(s.isRangesEqual(d,c))return{redos:[],undos:[]};if(d.length){const f={unitId:r,subUnitId:a,rule:{...o,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:a,cfId:o.cfId},v=[{id:s.DeleteConditionalRuleMutation.id,params:f}],y=s.DeleteConditionalRuleMutationUndoFactory(this._injector,f);return{redos:v,undos:y}}},u=[];o.ranges.forEach(l=>{const c=this._refRangeService.registerRefRange(l,i);u.push(()=>c.dispose())}),e.set(t(r,a,o.cfId),()=>u.forEach(l=>l()))};this.disposeWithMe(Ce.merge(this._sheetSkeletonManagerService.currentSkeleton$.pipe(Ee.map(r=>r==null?void 0:r.sheetId),Ee.distinctUntilChanged())).pipe(Ee.switchMap(()=>new Ce.Observable(r=>{const a=new m.DisposableCollection;return r.next(a),()=>{a.dispose()}}))).subscribe(r=>{r.add(m.toDisposable(this._conditionalFormattingRuleModel.$ruleChange.subscribe(a=>{const{unitId:o,subUnitId:i,rule:u}=a,l=this._univerInstanceService.getCurrentUnitForType(m.UniverInstanceType.UNIVER_SHEET),c=l.getActiveSheet();if(!(a.unitId!==l.getUnitId()||a.subUnitId!==c.getSheetId()))switch(a.type){case"add":{n(a.unitId,a.subUnitId,a.rule);break}case"delete":{const d=e.get(t(o,i,u.cfId));d&&d();break}case"set":{const d=e.get(t(o,i,u.cfId));d&&d(),n(a.unitId,a.subUnitId,a.rule)}}})))})),this.disposeWithMe(m.toDisposable(()=>{e.forEach(r=>{r()}),e.clear()}))}};yn=fd([m.OnLifecycle(m.LifecycleStages.Rendered,yn),Nt(0,V.Inject(s.ConditionalFormattingRuleModel)),Nt(1,V.Inject(m.IUniverInstanceService)),Nt(2,V.Inject(V.Injector)),Nt(3,V.Inject(le.SheetSkeletonManagerService)),Nt(4,V.Inject(k.RefRangeService))],yn);var pd=Object.defineProperty,hd=Object.getOwnPropertyDescriptor,md=(e,t,n,r)=>{for(var a=r>1?void 0:r?hd(t,n):t,o=e.length-1,i;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&pd(t,n,a),a},bo=(e,t)=>(n,r)=>t(n,r,e);let Sn=class extends m.Disposable{constructor(e,t){super(),this._editorBridgeService=e,this._conditionalFormattingService=t,this._initInterceptorEditorEnd()}_initInterceptorEditorEnd(){this.disposeWithMe(m.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 a=Object.keys(r==null?void 0:r.style);if(a.length>0){const o=s.getStringFromDataStream(e.p),i={...(typeof e.s=="string"?t.workbook.getStyles().get(e.s):e.s)||{}};a.forEach(l=>{delete i[l]});const u={...e,s:{...i},v:o};return delete u.p,n(u)}}return n(e)}})))}};Sn=md([m.OnLifecycle(m.LifecycleStages.Rendered,Sn),bo(0,V.Inject(le.IEditorBridgeService)),bo(1,V.Inject(s.ConditionalFormattingService))],Sn);var gd=Object.defineProperty,vd=Object.getOwnPropertyDescriptor,yd=(e,t,n,r)=>{for(var a=r>1?void 0:r?vd(t,n):t,o=e.length-1,i;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&gd(t,n,a),a},jt=(e,t)=>(n,r)=>t(n,r,e);let bn=class extends m.Disposable{constructor(e,t,n,r,a){super(),this._injector=e,this._univerInstanceService=t,this._sheetInterceptorService=n,this._selectionManagerService=r,this._conditionalFormattingRuleModel=a,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 a=this._selectionManagerService.getSelectionRanges();if(!a)return r;const o=this._univerInstanceService.getCurrentUnitForType(m.UniverInstanceType.UNIVER_SHEET),i=o.getActiveSheet(),u=this._conditionalFormattingRuleModel.getSubunitRules(o.getUnitId(),i.getSheetId());if(!u||!u.length)return r;u.filter(l=>a.some(c=>l.ranges.some(d=>m.Rectangle.getIntersects(d,c)))).forEach(l=>{const d=new k.RangeMergeUtil().add(...l.ranges).subtract(...a).merge();if(d.length){const h={id:s.SetConditionalRuleMutation.id,params:{unitId:o.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:o.getUnitId(),subUnitId:i.getSheetId(),cfId:l.cfId}},f=s.DeleteConditionalRuleMutationUndoFactory(this._injector,h.params);t.push(h),n.push(...f)}})}return r}}))}};bn=yd([m.OnLifecycle(m.LifecycleStages.Rendered,bn),jt(0,V.Inject(V.Injector)),jt(1,V.Inject(m.IUniverInstanceService)),jt(2,V.Inject(k.SheetInterceptorService)),jt(3,V.Inject(k.SelectionManagerService)),jt(4,V.Inject(s.ConditionalFormattingRuleModel))],bn);var Sd=Object.defineProperty,bd=Object.getOwnPropertyDescriptor,Td=(e,t,n,r)=>{for(var a=r>1?void 0:r?bd(t,n):t,o=e.length-1,i;o>=0;o--)(i=e[o])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&Sd(t,n,a),a},To=(e,t)=>(n,r)=>t(n,r,e);X.UniverSheetsConditionalFormattingUIPlugin=(Lt=class extends m.Plugin{constructor(t,n,r){super(),this._injector=n,this._commandService=r,this._initCommand(),s.SheetsConditionalFormattingPlugin.dependencyList.forEach(a=>{this._injector.add(a)}),this._injector.add([mn]),this._injector.add([yn]),this._injector.add([gn]),this._injector.add([vn]),this._injector.add([Mt]),this._injector.add([It]),this._injector.add([Sn]),this._injector.add([bn])}_initCommand(){[...s.SheetsConditionalFormattingPlugin.mutationList,...X.UniverSheetsConditionalFormattingUIPlugin.commandList].forEach(t=>{this._commandService.registerCommand(t)})}},lt(Lt,"pluginName",s.SHEET_CONDITIONAL_FORMATTING_PLUGIN),lt(Lt,"type",m.UniverInstanceType.UNIVER_SHEET),lt(Lt,"commandList",[wo,Io,xo,Oo,Eo,Mo,Do,Po,No,So,dr,Aa,La,za,Ir,Tn]),Lt),X.UniverSheetsConditionalFormattingUIPlugin=Td([To(1,V.Inject(V.Injector)),To(2,V.Inject(m.ICommandService))],X.UniverSheetsConditionalFormattingUIPlugin),X.enUS=Dl,X.zhCN=Va,Object.defineProperty(X,Symbol.toStringTag,{value:"Module"})});
|